From: Andrea Bianco Date: Sun, 30 Jan 2022 19:05:16 +0000 (+0100) Subject: Built motion from commit 85328c08.|2.5.50 X-Git-Tag: 2.5.50~1 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=ebe00679b2d367c1cf2b2b91609ee1ce4bd8fb94;p=motion2.git Built motion from commit 85328c08.|2.5.50 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 935d50e..03a8516 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-30T18:42:18.121Z", + "time": "2022-01-30T18:58:23.357Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ddee075..bf38bd2 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-30T18:42:18.121Z", + "time": "2022-01-30T18:58:23.357Z", "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 93e608c..f922399 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 _0xc7e7=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','motionbar','jscripty','browser'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc7e7,0x13a));var _0x7c7e=function(_0x15e126,_0x56cc1d){_0x15e126=_0x15e126-0x0;var _0x27a50d=_0xc7e7[_0x15e126];return _0x27a50d;};'use strict';var Sequelize=require('sequelize');module[_0x7c7e('0x0')]={'name':{'type':Sequelize[_0x7c7e('0x1')],'get':function(_0x56b707){return this[_0x7c7e('0x2')](_0x7c7e('0x3'));}},'action':{'type':Sequelize[_0x7c7e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7c7e('0x5'),'integration',_0x7c7e('0x6'),_0x7c7e('0x7'),'urlForward',_0x7c7e('0x8'),_0x7c7e('0x9'),_0x7c7e('0xa')]],'msg':_0x7c7e('0xb')}},'comment':_0x7c7e('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comment':_0x7c7e('0xc')},'data3':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comment':_0x7c7e('0xd')},'data4':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comments':_0x7c7e('0xe')},'data5':{'type':Sequelize[_0x7c7e('0x4')](0x1000),'comments':_0x7c7e('0xf')},'data6':{'type':Sequelize[_0x7c7e('0x4')],'comments':_0x7c7e('0x10')},'data7':{'type':Sequelize[_0x7c7e('0x11')],'comments':_0x7c7e('0x12')}}; \ No newline at end of file +var _0xdde1=['script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x538a38,_0x1843fb){var _0x137886=function(_0x5b76d2){while(--_0x5b76d2){_0x538a38['push'](_0x538a38['shift']());}};_0x137886(++_0x1843fb);}(_0xdde1,0x14a));var _0x1dde=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0xdde1[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0x1dde('0x0'));module[_0x1dde('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x411519){return this[_0x1dde('0x2')]('action');}},'action':{'type':Sequelize[_0x1dde('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x1dde('0x4'),_0x1dde('0x5'),_0x1dde('0x6'),_0x1dde('0x7'),_0x1dde('0x8'),_0x1dde('0x9'),'bot',_0x1dde('0xa')]],'msg':_0x1dde('0xb')}},'comment':_0x1dde('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':_0x1dde('0xc')},'data3':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x1dde('0xd')},'data5':{'type':Sequelize[_0x1dde('0x3')](0x1000),'comments':_0x1dde('0xe')},'data6':{'type':Sequelize[_0x1dde('0x3')],'comments':_0x1dde('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x1dde('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 064f6b9..cf5daff 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 _0x73c7=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','then','destroy','end','stack','name','send','body','find','params','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','squel','crypto','desk.js','to-csv'];(function(_0x3353a6,_0x1c6e93){var _0x2fe073=function(_0x58838c){while(--_0x58838c){_0x3353a6['push'](_0x3353a6['shift']());}};_0x2fe073(++_0x1c6e93);}(_0x73c7,0x176));var _0x773c=function(_0x22f9e5,_0x1f7436){_0x22f9e5=_0x22f9e5-0x0;var _0xa6fe19=_0x73c7[_0x22f9e5];return _0xa6fe19;};'use strict';var emlformat=require(_0x773c('0x0'));var rimraf=require(_0x773c('0x1'));var zipdir=require(_0x773c('0x2'));var jsonpatch=require(_0x773c('0x3'));var rp=require(_0x773c('0x4'));var moment=require(_0x773c('0x5'));var BPromise=require(_0x773c('0x6'));var Mustache=require('mustache');var util=require(_0x773c('0x7'));var path=require('path');var sox=require(_0x773c('0x8'));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(_0x773c('0x9'));var crypto=require(_0x773c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x773c('0xb'));var toCsv=require(_0x773c('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x773c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x773c('0xe'));var as=require(_0x773c('0xf'));var hardwareService=require(_0x773c('0x10'));var logger=require(_0x773c('0x11'))(_0x773c('0x12'));var utils=require(_0x773c('0x13'));var config=require(_0x773c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x773c('0x15'))['db'];function respondWithStatusCode(_0x3d0581,_0x500cdf){_0x500cdf=_0x500cdf||0xcc;return function(_0x8863a1){if(_0x8863a1){return _0x3d0581[_0x773c('0x16')](_0x500cdf);}return _0x3d0581['status'](_0x500cdf)['end']();};}function respondWithResult(_0x2c3711,_0x22cb7c){_0x22cb7c=_0x22cb7c||0xc8;return function(_0x255280){if(_0x255280){return _0x2c3711[_0x773c('0x17')](_0x22cb7c)['json'](_0x255280);}};}function respondWithFilteredResult(_0x11971f,_0x55a1df){return function(_0x3b5daf){if(_0x3b5daf){var _0x1547e1=typeof _0x55a1df[_0x773c('0x18')]===_0x773c('0x19')&&typeof _0x55a1df[_0x773c('0x1a')]===_0x773c('0x19');var _0x228b72=_0x3b5daf[_0x773c('0x1b')];var _0xaa8766=_0x1547e1?0x0:_0x55a1df[_0x773c('0x18')];var _0x3dfb6c=_0x1547e1?_0x3b5daf[_0x773c('0x1b')]:_0x55a1df['offset']+_0x55a1df['limit'];var _0x572f43;if(_0x3dfb6c>=_0x228b72){_0x3dfb6c=_0x228b72;_0x572f43=0xc8;}else{_0x572f43=0xce;}_0x11971f[_0x773c('0x17')](_0x572f43);return _0x11971f[_0x773c('0x1c')]('Content-Range',_0xaa8766+'-'+_0x3dfb6c+'/'+_0x228b72)[_0x773c('0x1d')](_0x3b5daf);}return null;};}function patchUpdates(_0x42e4bb){return function(_0xb84b4){try{jsonpatch[_0x773c('0x1e')](_0xb84b4,_0x42e4bb,!![]);}catch(_0x23640b){return BPromise[_0x773c('0x1f')](_0x23640b);}return _0xb84b4['save']();};}function saveUpdates(_0x3cdb0b,_0x533965){return function(_0x241ad4){if(_0x241ad4){return _0x241ad4['update'](_0x3cdb0b)[_0x773c('0x20')](function(_0x2797ae){return _0x2797ae;});}return null;};}function removeEntity(_0x1492ec,_0x2034a9){return function(_0x41bc1e){if(_0x41bc1e){return _0x41bc1e[_0x773c('0x21')]()[_0x773c('0x20')](function(){_0x1492ec['status'](0xcc)[_0x773c('0x22')]();});}};}function handleEntityNotFound(_0xe46588,_0x1dd7f5){return function(_0x2d3fb6){if(!_0x2d3fb6){_0xe46588[_0x773c('0x16')](0x194);}return _0x2d3fb6;};}function handleError(_0xb9aa38,_0xa54d89){_0xa54d89=_0xa54d89||0x1f4;return function(_0x425bd3){logger['error'](_0x425bd3[_0x773c('0x23')]);if(_0x425bd3[_0x773c('0x24')]){delete _0x425bd3[_0x773c('0x24')];}_0xb9aa38[_0x773c('0x17')](_0xa54d89)[_0x773c('0x25')](_0x425bd3);};}exports['update']=function(_0x42f611,_0x285da0){if(_0x42f611[_0x773c('0x26')]['id']){delete _0x42f611[_0x773c('0x26')]['id'];}return db['Action'][_0x773c('0x27')]({'where':{'id':_0x42f611[_0x773c('0x28')]['id']}})[_0x773c('0x20')](handleEntityNotFound(_0x285da0,null))[_0x773c('0x20')](saveUpdates(_0x42f611['body'],null))[_0x773c('0x20')](respondWithResult(_0x285da0,null))[_0x773c('0x29')](handleError(_0x285da0,null));};exports['destroy']=function(_0x4c2639,_0x4dc943){return db[_0x773c('0x2a')][_0x773c('0x27')]({'where':{'id':_0x4c2639['params']['id']}})['then'](handleEntityNotFound(_0x4dc943,null))[_0x773c('0x20')](removeEntity(_0x4dc943,null))['catch'](handleError(_0x4dc943,null));}; \ No newline at end of file +var _0xe110=['destroy','then','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0xe110,0xcf));var _0x0e11=function(_0x2591e1,_0x1ef4f4){_0x2591e1=_0x2591e1-0x0;var _0x181343=_0xe110[_0x2591e1];return _0x181343;};'use strict';var emlformat=require(_0x0e11('0x0'));var rimraf=require(_0x0e11('0x1'));var zipdir=require(_0x0e11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e11('0x3'));var moment=require('moment');var BPromise=require(_0x0e11('0x4'));var Mustache=require(_0x0e11('0x5'));var util=require(_0x0e11('0x6'));var path=require(_0x0e11('0x7'));var sox=require(_0x0e11('0x8'));var csv=require(_0x0e11('0x9'));var ejs=require(_0x0e11('0xa'));var fs=require('fs');var fs_extra=require(_0x0e11('0xb'));var _=require(_0x0e11('0xc'));var squel=require('squel');var crypto=require(_0x0e11('0xd'));var jsforce=require(_0x0e11('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e11('0x9'));var querystring=require(_0x0e11('0xf'));var Papa=require(_0x0e11('0x10'));var Redis=require(_0x0e11('0x11'));var authService=require(_0x0e11('0x12'));var qs=require(_0x0e11('0x13'));var as=require(_0x0e11('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e11('0x15'))(_0x0e11('0x16'));var utils=require(_0x0e11('0x17'));var config=require(_0x0e11('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e11('0x19'))['db'];function respondWithStatusCode(_0x46c19e,_0xb12ac2){_0xb12ac2=_0xb12ac2||0xcc;return function(_0x63c9eb){if(_0x63c9eb){return _0x46c19e[_0x0e11('0x1a')](_0xb12ac2);}return _0x46c19e[_0x0e11('0x1b')](_0xb12ac2)[_0x0e11('0x1c')]();};}function respondWithResult(_0x14f941,_0x3a5cd2){_0x3a5cd2=_0x3a5cd2||0xc8;return function(_0x5767a0){if(_0x5767a0){return _0x14f941[_0x0e11('0x1b')](_0x3a5cd2)[_0x0e11('0x1d')](_0x5767a0);}};}function respondWithFilteredResult(_0x5d0c6e,_0x29fb1e){return function(_0x454224){if(_0x454224){var _0x3be52f=typeof _0x29fb1e['offset']===_0x0e11('0x1e')&&typeof _0x29fb1e[_0x0e11('0x1f')]==='undefined';var _0x350f7c=_0x454224[_0x0e11('0x20')];var _0x414e7b=_0x3be52f?0x0:_0x29fb1e[_0x0e11('0x21')];var _0x2b78d8=_0x3be52f?_0x454224[_0x0e11('0x20')]:_0x29fb1e['offset']+_0x29fb1e['limit'];var _0x519bbe;if(_0x2b78d8>=_0x350f7c){_0x2b78d8=_0x350f7c;_0x519bbe=0xc8;}else{_0x519bbe=0xce;}_0x5d0c6e[_0x0e11('0x1b')](_0x519bbe);return _0x5d0c6e[_0x0e11('0x22')]('Content-Range',_0x414e7b+'-'+_0x2b78d8+'/'+_0x350f7c)['json'](_0x454224);}return null;};}function patchUpdates(_0x487131){return function(_0x53e363){try{jsonpatch[_0x0e11('0x23')](_0x53e363,_0x487131,!![]);}catch(_0x2c5783){return BPromise[_0x0e11('0x24')](_0x2c5783);}return _0x53e363[_0x0e11('0x25')]();};}function saveUpdates(_0x2f5efc,_0x1898f1){return function(_0x2455d0){if(_0x2455d0){return _0x2455d0['update'](_0x2f5efc)['then'](function(_0x2595a5){return _0x2595a5;});}return null;};}function removeEntity(_0x447561,_0xe9cc42){return function(_0x16e374){if(_0x16e374){return _0x16e374[_0x0e11('0x26')]()[_0x0e11('0x27')](function(){_0x447561['status'](0xcc)[_0x0e11('0x1c')]();});}};}function handleEntityNotFound(_0xb1d939,_0x11f4f6){return function(_0x544dce){if(!_0x544dce){_0xb1d939[_0x0e11('0x1a')](0x194);}return _0x544dce;};}function handleError(_0x575930,_0x4c1dd1){_0x4c1dd1=_0x4c1dd1||0x1f4;return function(_0x56b918){logger['error'](_0x56b918[_0x0e11('0x28')]);if(_0x56b918['name']){delete _0x56b918[_0x0e11('0x29')];}_0x575930[_0x0e11('0x1b')](_0x4c1dd1)[_0x0e11('0x2a')](_0x56b918);};}exports[_0x0e11('0x2b')]=function(_0x7f52a6,_0x232fc9){if(_0x7f52a6[_0x0e11('0x2c')]['id']){delete _0x7f52a6[_0x0e11('0x2c')]['id'];}return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x7f52a6[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x232fc9,null))[_0x0e11('0x27')](saveUpdates(_0x7f52a6[_0x0e11('0x2c')],null))['then'](respondWithResult(_0x232fc9,null))[_0x0e11('0x30')](handleError(_0x232fc9,null));};exports[_0x0e11('0x26')]=function(_0x17c7fb,_0x2440bf){return db[_0x0e11('0x2d')][_0x0e11('0x2e')]({'where':{'id':_0x17c7fb[_0x0e11('0x2f')]['id']}})[_0x0e11('0x27')](handleEntityNotFound(_0x2440bf,null))['then'](removeEntity(_0x2440bf,null))[_0x0e11('0x30')](handleError(_0x2440bf,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5a46718..431be29 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 _0x5c12=['exports','tools_actions','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x101ccf,_0x37e172){var _0x99b0f1=function(_0x4111c8){while(--_0x4111c8){_0x101ccf['push'](_0x101ccf['shift']());}};_0x99b0f1(++_0x37e172);}(_0x5c12,0xac));var _0x25c1=function(_0x2353fe,_0x4b0bca){_0x2353fe=_0x2353fe-0x0;var _0x4d43f6=_0x5c12[_0x2353fe];return _0x4d43f6;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))(_0x25c1('0x2'));var moment=require(_0x25c1('0x3'));var BPromise=require(_0x25c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25c1('0x5'));var rimraf=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var attributes=require('./action.attributes');module[_0x25c1('0x8')]=function(_0x22ff28,_0x38ecbd){return _0x22ff28['define']('Action',attributes,{'tableName':_0x25c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d43=['exports','define','Action','tools_actions','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x18811b,_0x6bede4){var _0x2fbee4=function(_0x4dcf84){while(--_0x4dcf84){_0x18811b['push'](_0x18811b['shift']());}};_0x2fbee4(++_0x6bede4);}(_0x4d43,0x154));var _0x34d4=function(_0x9798fd,_0x37765d){_0x9798fd=_0x9798fd-0x0;var _0x41789e=_0x4d43[_0x9798fd];return _0x41789e;};'use strict';var _=require(_0x34d4('0x0'));var util=require(_0x34d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x34d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x34d4('0x3'));var fs=require('fs');var path=require(_0x34d4('0x4'));var rimraf=require(_0x34d4('0x5'));var config=require(_0x34d4('0x6'));var attributes=require(_0x34d4('0x7'));module[_0x34d4('0x8')]=function(_0x37b23d,_0x3aa141){return _0x37b23d[_0x34d4('0x9')](_0x34d4('0xa'),attributes,{'tableName':_0x34d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 13c47df..157d6a1 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1cb81c,_0x429ed1){var _0x38a2af=function(_0x31c222){while(--_0x31c222){_0x1cb81c['push'](_0x1cb81c['shift']());}};_0x38a2af(++_0x429ed1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x35612e,_0x1b738c){_0x35612e=_0x35612e-0x0;var _0x20d52d=_0x7a54[_0x35612e];return _0x20d52d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 481c55d..ea13cd6 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 _0x6365=['express','Router','fs-extra','../../components/auth/service','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6365,0x1d9));var _0x5636=function(_0x3b1a41,_0x24f62e){_0x3b1a41=_0x3b1a41-0x0;var _0x598089=_0x6365[_0x3b1a41];return _0x598089;};'use strict';var multer=require(_0x5636('0x0'));var util=require('util');var path=require(_0x5636('0x1'));var timeout=require(_0x5636('0x2'));var express=require(_0x5636('0x3'));var router=express[_0x5636('0x4')]();var fs_extra=require(_0x5636('0x5'));var auth=require(_0x5636('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0x5636('0x7')](_0x5636('0x8'),auth[_0x5636('0x9')](),controller[_0x5636('0xa')]);router[_0x5636('0xb')](_0x5636('0x8'),auth[_0x5636('0x9')](),controller[_0x5636('0xc')]);module[_0x5636('0xd')]=router; \ No newline at end of file +var _0xcf7f=['util','path','connect-timeout','express','Router','fs-extra','./action.controller','put','/:id','isAuthenticated','exports','multer'];(function(_0x32b5b1,_0x1da9ad){var _0x1fcc4c=function(_0x120e25){while(--_0x120e25){_0x32b5b1['push'](_0x32b5b1['shift']());}};_0x1fcc4c(++_0x1da9ad);}(_0xcf7f,0x1a3));var _0xfcf7=function(_0x37b9f7,_0x33e9a1){_0x37b9f7=_0x37b9f7-0x0;var _0x311feb=_0xcf7f[_0x37b9f7];return _0x311feb;};'use strict';var multer=require(_0xfcf7('0x0'));var util=require(_0xfcf7('0x1'));var path=require(_0xfcf7('0x2'));var timeout=require(_0xfcf7('0x3'));var express=require(_0xfcf7('0x4'));var router=express[_0xfcf7('0x5')]();var fs_extra=require(_0xfcf7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfcf7('0x7'));router[_0xfcf7('0x8')](_0xfcf7('0x9'),auth[_0xfcf7('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfcf7('0xa')](),controller['destroy']);module[_0xfcf7('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ba72406..7a905cf 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x385eb1,_0x497a94){var _0x5d40eb=function(_0x159029){while(--_0x159029){_0x385eb1['push'](_0x385eb1['shift']());}};_0x5d40eb(++_0x497a94);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x507597,_0x412525){_0x507597=_0x507597-0x0;var _0x110a0f=_0xf2ca[_0x507597];return _0x110a0f;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x1ec684,_0xee510d){var _0x4477ed=function(_0x13777d){while(--_0x13777d){_0x1ec684['push'](_0x1ec684['shift']());}};_0x4477ed(++_0xee510d);}(_0xac9d,0x14d));var _0xdac9=function(_0x5dc45d,_0x55f90f){_0x5dc45d=_0x5dc45d-0x0;var _0x4ce697=_0xac9d[_0x5dc45d];return _0x4ce697;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4b91569..091c1da 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 _0x36ae=['AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','left_join','AnalyticMetric','debug','eml-format','rimraf','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','AnalyticCustomReport','rawAttributes','type','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','intersection','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','from','table','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','MIN(%s)','HOUR(%s)','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','randomstring','generate','output','custom'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ae,0xb3));var _0xe36a=function(_0x5ae8f7,_0x330d91){_0x5ae8f7=_0x5ae8f7-0x0;var _0x54c636=_0x36ae[_0x5ae8f7];return _0x54c636;};'use strict';var emlformat=require(_0xe36a('0x0'));var rimraf=require(_0xe36a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36a('0x2'));var rp=require(_0xe36a('0x3'));var moment=require('moment');var BPromise=require(_0xe36a('0x4'));var Mustache=require(_0xe36a('0x5'));var util=require(_0xe36a('0x6'));var path=require(_0xe36a('0x7'));var sox=require(_0xe36a('0x8'));var csv=require(_0xe36a('0x9'));var ejs=require(_0xe36a('0xa'));var fs=require('fs');var fs_extra=require(_0xe36a('0xb'));var _=require(_0xe36a('0xc'));var squel=require(_0xe36a('0xd'));var crypto=require('crypto');var jsforce=require(_0xe36a('0xe'));var deskjs=require(_0xe36a('0xf'));var toCsv=require(_0xe36a('0x9'));var querystring=require(_0xe36a('0x10'));var Papa=require(_0xe36a('0x11'));var Redis=require(_0xe36a('0x12'));var authService=require(_0xe36a('0x13'));var qs=require(_0xe36a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe36a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe36a('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe36a('0x17'))['dbH'];function respondWithStatusCode(_0x273a4f,_0x42c8ee){_0x42c8ee=_0x42c8ee||0xcc;return function(_0x2865c7){if(_0x2865c7){return _0x273a4f[_0xe36a('0x18')](_0x42c8ee);}return _0x273a4f['status'](_0x42c8ee)[_0xe36a('0x19')]();};}function respondWithResult(_0x6492c5,_0x4d6887){_0x4d6887=_0x4d6887||0xc8;return function(_0x3ea0a6){if(_0x3ea0a6){return _0x6492c5['status'](_0x4d6887)[_0xe36a('0x1a')](_0x3ea0a6);}};}function respondWithFilteredResult(_0x57ecdf,_0x2517a6){return function(_0x703f42){if(_0x703f42){var _0xca4ac0=typeof _0x2517a6[_0xe36a('0x1b')]===_0xe36a('0x1c')&&typeof _0x2517a6['limit']===_0xe36a('0x1c');var _0x2a713b=_0x703f42[_0xe36a('0x1d')];var _0x652a6=_0xca4ac0?0x0:_0x2517a6[_0xe36a('0x1b')];var _0x155066=_0xca4ac0?_0x703f42[_0xe36a('0x1d')]:_0x2517a6[_0xe36a('0x1b')]+_0x2517a6[_0xe36a('0x1e')];var _0x55eecf;if(_0x155066>=_0x2a713b){_0x155066=_0x2a713b;_0x55eecf=0xc8;}else{_0x55eecf=0xce;}_0x57ecdf[_0xe36a('0x1f')](_0x55eecf);return _0x57ecdf[_0xe36a('0x20')](_0xe36a('0x21'),_0x652a6+'-'+_0x155066+'/'+_0x2a713b)[_0xe36a('0x1a')](_0x703f42);}return null;};}function patchUpdates(_0x37cafd){return function(_0xb654de){try{jsonpatch[_0xe36a('0x22')](_0xb654de,_0x37cafd,!![]);}catch(_0x189d71){return BPromise[_0xe36a('0x23')](_0x189d71);}return _0xb654de[_0xe36a('0x24')]();};}function saveUpdates(_0x35cc00,_0x5ed791){return function(_0x477066){if(_0x477066){return _0x477066[_0xe36a('0x25')](_0x35cc00)[_0xe36a('0x26')](function(_0x1522e5){return _0x1522e5;});}return null;};}function removeEntity(_0x47033e,_0x4cdb18){return function(_0x56a305){if(_0x56a305){return _0x56a305[_0xe36a('0x27')]()['then'](function(){var _0x102dd0=_0x56a305['get']({'plain':!![]});var _0x4bcb3a=_0xe36a('0x28');return db[_0xe36a('0x29')][_0xe36a('0x27')]({'where':{'type':_0x4bcb3a,'resourceId':_0x102dd0['id']}})['then'](function(){return _0x56a305;});})[_0xe36a('0x26')](function(){_0x47033e['status'](0xcc)[_0xe36a('0x19')]();});}};}function handleEntityNotFound(_0x217736,_0xc69655){return function(_0x894ca){if(!_0x894ca){_0x217736[_0xe36a('0x18')](0x194);}return _0x894ca;};}function handleError(_0x4ddab1,_0x2d7976){_0x2d7976=_0x2d7976||0x1f4;return function(_0x1a18b2){logger[_0xe36a('0x2a')](_0x1a18b2[_0xe36a('0x2b')]);if(_0x1a18b2[_0xe36a('0x2c')]){delete _0x1a18b2[_0xe36a('0x2c')];}_0x4ddab1[_0xe36a('0x1f')](_0x2d7976)[_0xe36a('0x2d')](_0x1a18b2);};}exports['index']=function(_0x2017d1,_0x43d155){var _0x3a7214={},_0x26a7a6={},_0x1a19eb={'count':0x0,'rows':[]};var _0x3056bc=_['map'](db[_0xe36a('0x2e')][_0xe36a('0x2f')],function(_0x208e8d){return{'name':_0x208e8d['fieldName'],'type':_0x208e8d[_0xe36a('0x30')]['key']};});_0x26a7a6[_0xe36a('0x31')]=_[_0xe36a('0x32')](_0x3056bc,_0xe36a('0x2c'));_0x26a7a6[_0xe36a('0x33')]=_['keys'](_0x2017d1['query']);_0x26a7a6[_0xe36a('0x34')]=_['intersection'](_0x26a7a6[_0xe36a('0x31')],_0x26a7a6[_0xe36a('0x33')]);_0x3a7214[_0xe36a('0x35')]=_['intersection'](_0x26a7a6[_0xe36a('0x31')],qs[_0xe36a('0x36')](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x36')]));_0x3a7214[_0xe36a('0x35')]=_0x3a7214['attributes']['length']?_0x3a7214[_0xe36a('0x35')]:_0x26a7a6[_0xe36a('0x31')];if(!_0x2017d1[_0xe36a('0x33')][_0xe36a('0x37')](_0xe36a('0x38'))){_0x3a7214[_0xe36a('0x1e')]=qs[_0xe36a('0x1e')](_0x2017d1['query'][_0xe36a('0x1e')]);_0x3a7214['offset']=qs['offset'](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x1b')]);}_0x3a7214[_0xe36a('0x39')]=qs[_0xe36a('0x3a')](_0x2017d1[_0xe36a('0x33')][_0xe36a('0x3a')]);_0x3a7214['where']=qs['filters'](_[_0xe36a('0x3b')](_0x2017d1[_0xe36a('0x33')],_0x26a7a6[_0xe36a('0x34')]),_0x3056bc);if(_0x2017d1[_0xe36a('0x33')][_0xe36a('0x3c')]){_0x3a7214[_0xe36a('0x3d')]=_[_0xe36a('0x3e')](_0x3a7214[_0xe36a('0x3d')],{'$or':_[_0xe36a('0x32')](_0x3056bc,function(_0x36169e){if(_0x36169e[_0xe36a('0x30')]!==_0xe36a('0x3f')){var _0x541181={};_0x541181[_0x36169e[_0xe36a('0x2c')]]={'$like':'%'+_0x2017d1['query']['filter']+'%'};return _0x541181;}})});}_0x3a7214=_[_0xe36a('0x3e')]({},_0x3a7214,_0x2017d1[_0xe36a('0x40')]);var _0xd5c9e4={'where':_0x3a7214[_0xe36a('0x3d')]};return db[_0xe36a('0x2e')][_0xe36a('0x1d')](_0xd5c9e4)['then'](function(_0x127cba){_0x1a19eb[_0xe36a('0x1d')]=_0x127cba;if(_0x2017d1[_0xe36a('0x33')][_0xe36a('0x41')]){_0x3a7214['include']=[{'all':!![]}];}return db[_0xe36a('0x2e')][_0xe36a('0x42')](_0x3a7214);})[_0xe36a('0x26')](function(_0x5cb4b9){_0x1a19eb[_0xe36a('0x43')]=_0x5cb4b9;return _0x1a19eb;})[_0xe36a('0x26')](respondWithFilteredResult(_0x43d155,_0x3a7214))[_0xe36a('0x44')](handleError(_0x43d155,null));};exports[_0xe36a('0x45')]=function(_0x12750a,_0xe0343d){var _0x38a38d={'raw':![],'where':{'id':_0x12750a[_0xe36a('0x46')]['id']}},_0x1cec8d={};_0x1cec8d[_0xe36a('0x31')]=_[_0xe36a('0x47')](db[_0xe36a('0x2e')][_0xe36a('0x2f')]);_0x1cec8d[_0xe36a('0x33')]=_[_0xe36a('0x47')](_0x12750a[_0xe36a('0x33')]);_0x1cec8d['filters']=_[_0xe36a('0x48')](_0x1cec8d[_0xe36a('0x31')],_0x1cec8d[_0xe36a('0x33')]);_0x38a38d[_0xe36a('0x35')]=_[_0xe36a('0x48')](_0x1cec8d[_0xe36a('0x31')],qs[_0xe36a('0x36')](_0x12750a['query'][_0xe36a('0x36')]));_0x38a38d[_0xe36a('0x35')]=_0x38a38d['attributes'][_0xe36a('0x49')]?_0x38a38d[_0xe36a('0x35')]:_0x1cec8d['model'];if(_0x12750a[_0xe36a('0x33')][_0xe36a('0x41')]){_0x38a38d[_0xe36a('0x4a')]=[{'all':!![]}];}_0x38a38d=_[_0xe36a('0x3e')]({},_0x38a38d,_0x12750a[_0xe36a('0x40')]);return db['AnalyticCustomReport'][_0xe36a('0x4b')](_0x38a38d)[_0xe36a('0x26')](handleEntityNotFound(_0xe0343d,null))[_0xe36a('0x26')](respondWithResult(_0xe0343d,null))[_0xe36a('0x44')](handleError(_0xe0343d,null));};exports[_0xe36a('0x4c')]=function(_0x5d1953,_0x1084c7){return db[_0xe36a('0x2e')][_0xe36a('0x4c')](_0x5d1953[_0xe36a('0x4d')],{})['then'](function(_0x6e84d){var _0x1d7a68=_0x5d1953[_0xe36a('0x4e')][_0xe36a('0x4f')]({'plain':!![]});if(!_0x1d7a68)throw new Error(_0xe36a('0x50'));if(_0x1d7a68[_0xe36a('0x51')]===_0xe36a('0x4e')){var _0x1a7c3d=_0x6e84d[_0xe36a('0x4f')]({'plain':!![]});var _0x22fab2='Reports';return db[_0xe36a('0x52')]['find']({'where':{'name':_0x22fab2,'userProfileId':_0x1d7a68['userProfileId']},'raw':!![]})[_0xe36a('0x26')](function(_0x10e7a6){if(_0x10e7a6&&_0x10e7a6[_0xe36a('0x53')]===0x0){return db[_0xe36a('0x29')][_0xe36a('0x4c')]({'name':_0x1a7c3d['name'],'resourceId':_0x1a7c3d['id'],'type':_0xe36a('0x28'),'sectionId':_0x10e7a6['id']},{})[_0xe36a('0x26')](function(){return _0x6e84d;});}else{return _0x6e84d;}})[_0xe36a('0x44')](function(_0x2eb2a7){logger['error'](_0xe36a('0x54'),_0x2eb2a7);throw _0x2eb2a7;});}return _0x6e84d;})[_0xe36a('0x26')](respondWithResult(_0x1084c7,0xc9))[_0xe36a('0x44')](handleError(_0x1084c7,null));};exports[_0xe36a('0x25')]=function(_0x506944,_0x38a23e){if(_0x506944['body']['id']){delete _0x506944[_0xe36a('0x4d')]['id'];}return db['AnalyticCustomReport'][_0xe36a('0x4b')]({'where':{'id':_0x506944[_0xe36a('0x46')]['id']}})[_0xe36a('0x26')](handleEntityNotFound(_0x38a23e,null))[_0xe36a('0x26')](saveUpdates(_0x506944[_0xe36a('0x4d')],null))['then'](respondWithResult(_0x38a23e,null))[_0xe36a('0x44')](handleError(_0x38a23e,null));};exports[_0xe36a('0x27')]=function(_0x186ee3,_0x36f4ba){return db[_0xe36a('0x2e')][_0xe36a('0x4b')]({'where':{'id':_0x186ee3[_0xe36a('0x46')]['id']}})[_0xe36a('0x26')](handleEntityNotFound(_0x36f4ba,null))[_0xe36a('0x26')](removeEntity(_0x36f4ba,null))[_0xe36a('0x44')](handleError(_0x36f4ba,null));};exports[_0xe36a('0x55')]=function(_0x376e2d,_0x4f0fb1){var _0x2dde62=0xa;var _0x147457=[_0xe36a('0x56'),'left_join','right_join',_0xe36a('0x57')];var _0xd07bd0={'SUM':_0xe36a('0x58'),'COUNT':_0xe36a('0x59'),'COUNT DISTINCT':_0xe36a('0x5a'),'MAX':_0xe36a('0x5b'),'MIN':'MIN(%s)','AVG':_0xe36a('0x5c'),'GROUP_CONCAT':_0xe36a('0x5d'),'GROUP_CONCAT ASC':_0xe36a('0x5e'),'GROUP_CONCAT DESC':_0xe36a('0x5f')};var _0x40f5f3={'SEC_TO_TIME':_0xe36a('0x60'),'DATE':_0xe36a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':_0xe36a('0x63')};var _0x8368b7=function(_0x51ac1e){return!_[_0xe36a('0x64')]([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0x51ac1e);};var _0x223fa4=function(_0x4528ee){if(!_0x4528ee||!_0x4528ee[_0xe36a('0x69')]['length']){return'';}for(var _0x5163b2='(',_0x191195=0x0;_0x191195<_0x4528ee[_0xe36a('0x69')][_0xe36a('0x49')];_0x191195+=0x1){_0x191195>0x0&&(_0x5163b2+='\x20'+_0x4528ee[_0xe36a('0x6a')]+'\x20');_0x5163b2+=_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6b')]?_0x223fa4(_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6b')]):_0x4528ee['rules'][_0x191195][_0xe36a('0x6c')]+'\x20'+_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6d')]+(_0x8368b7(_0x4528ee['rules'][_0x191195][_0xe36a('0x6d')])?'\x20'+_0x4528ee[_0xe36a('0x69')][_0x191195][_0xe36a('0x6e')]:'');}return _0x5163b2+')';};var _0x2c859d={'where':{'id':_0x376e2d[_0xe36a('0x46')]['id']}},_0x5ea26b,_0x3cbe67,_0x14e1c9,_0x597a79,_0x550097;_0x2c859d=_[_0xe36a('0x3e')]({},_0x2c859d,_0x376e2d[_0xe36a('0x40')]);return db[_0xe36a('0x2e')][_0xe36a('0x4b')](_0x2c859d)[_0xe36a('0x26')](function(_0xf71330){if(_0xf71330){_0x5ea26b=_0xf71330;return _0xf71330[_0xe36a('0x6f')]();}return null;})[_0xe36a('0x26')](function(_0x153d36){if(_0x153d36){if(!_0x153d36[_0xe36a('0x49')]){throw new db[(_0xe36a('0x70'))][(_0xe36a('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cbe67=_0x153d36;return db['AnalyticMetric'][_0xe36a('0x42')]({'raw':!![]});}return null;})[_0xe36a('0x26')](function(_0x1888c6){if(_0x1888c6){_0x14e1c9=_['keyBy'](_0x1888c6,'id');var _0x5bf30b;var _0x5843bb=squel['select']();_0x5843bb[_0xe36a('0x72')](_0x5ea26b[_0xe36a('0x73')]);for(var _0x639ed8=0x0;_0x639ed8<_0x3cbe67[_0xe36a('0x49')];_0x639ed8+=0x1){_0x5bf30b=_0x3cbe67[_0x639ed8]['MetricId']?_0x14e1c9[_0x3cbe67[_0x639ed8]['MetricId']][_0xe36a('0x74')]:_0x3cbe67[_0x639ed8][_0xe36a('0x6c')];_0x5bf30b=_0x3cbe67[_0x639ed8][_0xe36a('0x75')]?_[_0xe36a('0x76')](_0xd07bd0[_0x3cbe67[_0x639ed8][_0xe36a('0x75')]],'%s',_0x5bf30b):_0x5bf30b;_0x5bf30b=_0x3cbe67[_0x639ed8][_0xe36a('0x77')]?_[_0xe36a('0x76')](_0x40f5f3[_0x3cbe67[_0x639ed8][_0xe36a('0x77')]],'%s',_0x5bf30b):_0x5bf30b;if(_0x3cbe67[_0x639ed8][_0xe36a('0x78')]){_0x5843bb[_0xe36a('0x6b')](_0x5bf30b);}_0x3cbe67[_0x639ed8][_0xe36a('0x79')]&&_0x5843bb[_0xe36a('0x39')](_0x5bf30b,_0x3cbe67[_0x639ed8]['orderBy']===_0xe36a('0x7a')?![]:!![]);_0x5843bb[_0xe36a('0x6c')](_0x5bf30b,_0x3cbe67[_0x639ed8][_0xe36a('0x7b')]||_0x5bf30b);}if(_0x5ea26b[_0xe36a('0x7c')]){_0x5ea26b[_0xe36a('0x7c')]=JSON[_0xe36a('0x7d')](_0x5ea26b[_0xe36a('0x7c')]);for(var _0x2f5d4f=0x0;_0x2f5d4f<_0x5ea26b[_0xe36a('0x7c')]['length'];_0x2f5d4f+=0x1){if(_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x30')]&&_[_0xe36a('0x64')](_0x147457,_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x30')])&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7e')]&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7f')]&&_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['foreignKey']){_0x5843bb[_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['type']](_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f]['foreignTable'],null,util[_0xe36a('0x77')]('%s.%s\x20=\x20%s.%s',_0x5ea26b[_0xe36a('0x73')],_0x5ea26b['joins'][_0x2f5d4f][_0xe36a('0x7e')],_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x7f')],_0x5ea26b[_0xe36a('0x7c')][_0x2f5d4f][_0xe36a('0x80')]));}}}if(_0x5ea26b[_0xe36a('0x81')]){_0x5ea26b[_0xe36a('0x81')]=JSON[_0xe36a('0x7d')](_0x5ea26b['conditions']);_0x5843bb['where'](_0x223fa4(_0x5ea26b['conditions']['group']));}_0x550097=_0x5843bb[_0xe36a('0x82')]();_0x5843bb[_0xe36a('0x1e')](_0x2dde62);_0x5843bb['offset'](0x0);logger['debug'](_0xe36a('0x83'),_0x5843bb[_0xe36a('0x84')]());return dbH[_0xe36a('0x85')][_0xe36a('0x33')](_0x5843bb['toString'](),{'type':dbH['sequelize'][_0xe36a('0x86')][_0xe36a('0x87')]});}})[_0xe36a('0x26')](respondWithResult(_0x4f0fb1,null))[_0xe36a('0x44')](handleError(_0x4f0fb1,null));};function runReport(_0x2e4d73,_0x5b114a,_0x51c207){var _0x24e5fd=_0x5b114a[_0xe36a('0x2c')];var _0x35cde8=0xa;var _0xffa2e8=[_0xe36a('0x56'),'left_join',_0xe36a('0x88'),_0xe36a('0x57')];var _0x2c6581={'SUM':_0xe36a('0x58'),'COUNT':_0xe36a('0x59'),'COUNT DISTINCT':_0xe36a('0x5a'),'MAX':_0xe36a('0x5b'),'MIN':_0xe36a('0x89'),'AVG':_0xe36a('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe36a('0x5e'),'GROUP_CONCAT DESC':_0xe36a('0x5f')};var _0x5d2b5b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe36a('0x61'),'HOUR':_0xe36a('0x8a'),'ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':_0xe36a('0x63')};var _0x4633a9=function(_0xab4c5d){return!_['includes']([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0xab4c5d);};var _0x1386e9=function(_0x3af19a){if(!_0x3af19a||!_0x3af19a[_0xe36a('0x69')][_0xe36a('0x49')]){return'';}for(var _0xc0b5df='(',_0x1863f3=0x0;_0x1863f3<_0x3af19a[_0xe36a('0x69')][_0xe36a('0x49')];_0x1863f3+=0x1){_0x1863f3>0x0&&(_0xc0b5df+='\x20'+_0x3af19a[_0xe36a('0x6a')]+'\x20');_0xc0b5df+=_0x3af19a[_0xe36a('0x69')][_0x1863f3]['group']?_0x1386e9(_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6b')]):_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6c')]+'\x20'+_0x3af19a['rules'][_0x1863f3][_0xe36a('0x6d')]+(_0x4633a9(_0x3af19a[_0xe36a('0x69')][_0x1863f3]['condition'])?'\x20'+_0x3af19a[_0xe36a('0x69')][_0x1863f3][_0xe36a('0x6e')]:'');}return _0xc0b5df+')';};var _0x3468a6={'where':{'id':_0x2e4d73['id']}},_0x3c0337,_0x4a5d97,_0x5cda2d,_0x55596f,_0x52e0ca;_0x3468a6=_[_0xe36a('0x3e')]({},_0x3468a6,_0x51c207);return db['AnalyticCustomReport'][_0xe36a('0x4b')](_0x3468a6)[_0xe36a('0x26')](function(_0x30e3b5){if(_0x30e3b5){_0x3c0337=_0x30e3b5;return _0x30e3b5['getFields']();}return null;})['then'](function(_0x1e7ad9){if(_0x1e7ad9){if(!_0x1e7ad9[_0xe36a('0x49')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe36a('0x8b'),0x193);}_0x4a5d97=_0x1e7ad9;return db['AnalyticMetric'][_0xe36a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x536c21){if(_0x536c21){_0x5cda2d=_[_0xe36a('0x8c')](_0x536c21,'id');var _0x2fbdbf;var _0x28b978=squel[_0xe36a('0x8d')]();_0x28b978[_0xe36a('0x72')](_0x3c0337[_0xe36a('0x73')]);for(var _0x5738b0=0x0;_0x5738b0<_0x4a5d97[_0xe36a('0x49')];_0x5738b0+=0x1){_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x8e')]?_0x5cda2d[_0x4a5d97[_0x5738b0][_0xe36a('0x8e')]][_0xe36a('0x74')]:_0x4a5d97[_0x5738b0][_0xe36a('0x6c')];_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x75')]?_['replace'](_0x2c6581[_0x4a5d97[_0x5738b0][_0xe36a('0x75')]],'%s',_0x2fbdbf):_0x2fbdbf;_0x2fbdbf=_0x4a5d97[_0x5738b0][_0xe36a('0x77')]?_['replace'](_0x5d2b5b[_0x4a5d97[_0x5738b0][_0xe36a('0x77')]],'%s',_0x2fbdbf):_0x2fbdbf;if(_0x4a5d97[_0x5738b0][_0xe36a('0x78')]){_0x28b978[_0xe36a('0x6b')](_0x2fbdbf);}_0x4a5d97[_0x5738b0]['orderBy']&&_0x28b978['order'](_0x2fbdbf,_0x4a5d97[_0x5738b0][_0xe36a('0x79')]===_0xe36a('0x7a')?![]:!![]);_0x28b978[_0xe36a('0x6c')](_0x2fbdbf,_0x4a5d97[_0x5738b0][_0xe36a('0x7b')]||_0x2fbdbf);}if(_0x3c0337[_0xe36a('0x7c')]){_0x3c0337[_0xe36a('0x7c')]=JSON[_0xe36a('0x7d')](_0x3c0337[_0xe36a('0x7c')]);for(var _0x11b16b=0x0;_0x11b16b<_0x3c0337[_0xe36a('0x7c')][_0xe36a('0x49')];_0x11b16b+=0x1){if(_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x30')]&&_['includes'](_0xffa2e8,_0x3c0337['joins'][_0x11b16b]['type'])&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7e')]&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7f')]&&_0x3c0337[_0xe36a('0x7c')][_0x11b16b]['foreignKey']){_0x28b978[_0x3c0337['joins'][_0x11b16b][_0xe36a('0x30')]](_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x7f')],null,util[_0xe36a('0x77')](_0xe36a('0x8f'),_0x3c0337['table'],_0x3c0337['joins'][_0x11b16b][_0xe36a('0x7e')],_0x3c0337['joins'][_0x11b16b][_0xe36a('0x7f')],_0x3c0337[_0xe36a('0x7c')][_0x11b16b][_0xe36a('0x80')]));}}}if(_0x3c0337[_0xe36a('0x81')]){_0x3c0337['conditions']=JSON[_0xe36a('0x7d')](_0x3c0337[_0xe36a('0x81')]);_0x28b978['where'](_0x1386e9(_0x3c0337[_0xe36a('0x81')]['group']));}_0x52e0ca=_0x28b978['clone']();_0x28b978['limit'](_0x35cde8);_0x28b978[_0xe36a('0x1b')](0x0);return;}})[_0xe36a('0x26')](function(){if(_0x5b114a['output']===_0xe36a('0x90')){return null;}var _0x49296a=_[_0xe36a('0x3e')](_0x5b114a,{'name':_0x5b114a[_0xe36a('0x91')]||_0x5b114a[_0xe36a('0x2c')]||_0x3c0337[_0xe36a('0x2c')],'basename':_0x24e5fd,'savename':util[_0xe36a('0x77')](_0xe36a('0x92'),_0x5b114a[_0xe36a('0x2c')]||_0x3c0337[_0xe36a('0x2c')],require(_0xe36a('0x93'))[_0xe36a('0x94')](0x4),_0x5b114a[_0xe36a('0x95')]||'csv'),'reportId':_0x3c0337['id'],'reportType':_0xe36a('0x96')});return db[_0xe36a('0x97')]['create'](_0x49296a,{'raw':!![]});})['then'](function(_0x222dcc){if(_0x3c0337['table']===_0xe36a('0x98')){_0x52e0ca[_0xe36a('0x3d')](_0x3c0337[_0xe36a('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5b114a[_0xe36a('0x99')],_0x5b114a[_0xe36a('0x9a')]);}else{_0x52e0ca[_0xe36a('0x3d')](_0x3c0337['table']+_0xe36a('0x9b'),_0x5b114a[_0xe36a('0x99')],_0x5b114a[_0xe36a('0x9a')]);}if(_0x222dcc){logger['info']('Run\x20Query:',_0x52e0ca[_0xe36a('0x84')]());require(_0xe36a('0x9c'))[_0xe36a('0x9d')](path[_0xe36a('0x56')](__dirname,_0xe36a('0x9e'),_0x222dcc[_0xe36a('0x95')]),[_0x222dcc['id'],_0x52e0ca[_0xe36a('0x84')](),path[_0xe36a('0x56')](__dirname,_0xe36a('0x9f'),_0x222dcc['savename']),_0x24e5fd]);return _0x222dcc;}else{var _0x3106b7=squel['select']();_0x3106b7['from']('('+_0x52e0ca[_0xe36a('0x84')]()+')',_0xe36a('0xa0'));_0x3106b7[_0xe36a('0x6c')](_0xe36a('0xa1'),'count');_0x52e0ca[_0xe36a('0x1e')](_0x5b114a[_0xe36a('0x1e')]||_0x35cde8);_0x52e0ca[_0xe36a('0x1b')](_0x5b114a['offset']||0x0);return dbH['sequelize'][_0xe36a('0x33')](_0x3106b7[_0xe36a('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0xe36a('0x87')]})[_0xe36a('0x26')](function(_0x2d4d06){if(!_0x2d4d06[_0xe36a('0x49')]){_0x55596f=0x0;}else{_0x55596f=_0x2d4d06[0x0][_0xe36a('0x1d')]||0x0;}return dbH['sequelize'][_0xe36a('0x33')](_0x52e0ca[_0xe36a('0x84')](),{'type':dbH['sequelize'][_0xe36a('0x86')]['SELECT']});})[_0xe36a('0x26')](function(_0x15b9a5){return{'rows':_0x15b9a5||[],'count':_0x55596f};});}});}exports['run']=function(_0x4a08b2,_0x538af5){return runReport(_0x4a08b2[_0xe36a('0x46')],_0x4a08b2[_0xe36a('0x33')],_0x4a08b2['options'])[_0xe36a('0x26')](respondWithResult(_0x538af5,null))['catch'](handleError(_0x538af5,null));};exports['runReport']=runReport;exports['query']=function(_0x655b66,_0x49e7ed){var _0x531ec8=0xa;var _0x5cb8c9=['join',_0xe36a('0xa2'),_0xe36a('0x88'),'cross_join'];var _0x43019a={'SUM':'SUM(%s)','COUNT':_0xe36a('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe36a('0x5b'),'MIN':_0xe36a('0x89'),'AVG':_0xe36a('0x5c'),'GROUP_CONCAT':_0xe36a('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dad02={'SEC_TO_TIME':_0xe36a('0x60'),'DATE':_0xe36a('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xe36a('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2be918=function(_0xdef831){return!_[_0xe36a('0x64')]([_0xe36a('0x65'),_0xe36a('0x66'),_0xe36a('0x67'),_0xe36a('0x68')],_0xdef831);};var _0x68cc21=function(_0x3e6193){if(!_0x3e6193||!_0x3e6193['rules'][_0xe36a('0x49')]){return'';}for(var _0x13afa3='(',_0x50e357=0x0;_0x50e357<_0x3e6193[_0xe36a('0x69')][_0xe36a('0x49')];_0x50e357+=0x1){_0x50e357>0x0&&(_0x13afa3+='\x20'+_0x3e6193['operator']+'\x20');_0x13afa3+=_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6b')]?_0x68cc21(_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6b')]):_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6c')]+'\x20'+_0x3e6193[_0xe36a('0x69')][_0x50e357][_0xe36a('0x6d')]+(_0x2be918(_0x3e6193['rules'][_0x50e357][_0xe36a('0x6d')])?'\x20'+_0x3e6193[_0xe36a('0x69')][_0x50e357]['value']:'');}return _0x13afa3+')';};var _0x5d27f2={'where':{'id':_0x655b66[_0xe36a('0x46')]['id']}},_0x4a3f99,_0x3f4439,_0x5f1b29,_0x3d68be,_0x41e68a;_0x5d27f2=_['merge']({},_0x5d27f2,_0x655b66['options']);return db[_0xe36a('0x2e')][_0xe36a('0x4b')](_0x5d27f2)['then'](function(_0x2920a6){if(_0x2920a6){_0x4a3f99=_0x2920a6;return _0x2920a6[_0xe36a('0x6f')]();}return null;})[_0xe36a('0x26')](function(_0x6ed048){if(_0x6ed048){if(!_0x6ed048[_0xe36a('0x49')]){throw new db[(_0xe36a('0x70'))][(_0xe36a('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3f4439=_0x6ed048;return db[_0xe36a('0xa3')][_0xe36a('0x42')]({'raw':!![]});}return null;})['then'](function(_0x2f89f1){if(_0x2f89f1){_0x5f1b29=_[_0xe36a('0x8c')](_0x2f89f1,'id');var _0x18876b;var _0x27fad1=squel[_0xe36a('0x8d')]();_0x27fad1[_0xe36a('0x72')](_0x4a3f99['table']);for(var _0x385676=0x0;_0x385676<_0x3f4439[_0xe36a('0x49')];_0x385676+=0x1){_0x18876b=_0x3f4439[_0x385676][_0xe36a('0x8e')]?_0x5f1b29[_0x3f4439[_0x385676][_0xe36a('0x8e')]][_0xe36a('0x74')]:_0x3f4439[_0x385676]['field'];_0x18876b=_0x3f4439[_0x385676]['function']?_[_0xe36a('0x76')](_0x43019a[_0x3f4439[_0x385676][_0xe36a('0x75')]],'%s',_0x18876b):_0x18876b;_0x18876b=_0x3f4439[_0x385676]['format']?_[_0xe36a('0x76')](_0x5dad02[_0x3f4439[_0x385676][_0xe36a('0x77')]],'%s',_0x18876b):_0x18876b;if(_0x3f4439[_0x385676][_0xe36a('0x78')]){_0x27fad1[_0xe36a('0x6b')](_0x18876b);}_0x3f4439[_0x385676]['orderBy']&&_0x27fad1['order'](_0x18876b,_0x3f4439[_0x385676][_0xe36a('0x79')]===_0xe36a('0x7a')?![]:!![]);_0x27fad1[_0xe36a('0x6c')](_0x18876b,_0x3f4439[_0x385676][_0xe36a('0x7b')]||_0x18876b);}if(_0x4a3f99['joins']){_0x4a3f99['joins']=JSON[_0xe36a('0x7d')](_0x4a3f99[_0xe36a('0x7c')]);for(var _0x25d704=0x0;_0x25d704<_0x4a3f99[_0xe36a('0x7c')]['length'];_0x25d704+=0x1){if(_0x4a3f99['joins'][_0x25d704][_0xe36a('0x30')]&&_[_0xe36a('0x64')](_0x5cb8c9,_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x30')])&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7e')]&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7f')]&&_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x80')]){_0x27fad1[_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x30')]](_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x7f')],null,util[_0xe36a('0x77')](_0xe36a('0x8f'),_0x4a3f99['table'],_0x4a3f99[_0xe36a('0x7c')][_0x25d704]['parentKey'],_0x4a3f99['joins'][_0x25d704]['foreignTable'],_0x4a3f99[_0xe36a('0x7c')][_0x25d704][_0xe36a('0x80')]));}}}if(_0x4a3f99[_0xe36a('0x81')]){_0x4a3f99[_0xe36a('0x81')]=JSON[_0xe36a('0x7d')](_0x4a3f99[_0xe36a('0x81')]);_0x27fad1[_0xe36a('0x3d')](_0x68cc21(_0x4a3f99['conditions'][_0xe36a('0x6b')]));}_0x41e68a=_0x27fad1[_0xe36a('0x82')]();_0x27fad1[_0xe36a('0x1e')](_0x531ec8);_0x27fad1[_0xe36a('0x1b')](0x0);logger[_0xe36a('0xa4')](_0xe36a('0x83'),_0x27fad1['toString']());return dbH[_0xe36a('0x85')][_0xe36a('0x33')](_0x27fad1[_0xe36a('0x84')](),{'type':dbH[_0xe36a('0x85')]['QueryTypes'][_0xe36a('0x87')]});}})[_0xe36a('0x26')](function(){return{'sql':_0x41e68a['toString']()};})[_0xe36a('0x26')](respondWithResult(_0x49e7ed,null))[_0xe36a('0x44')](handleError(_0x49e7ed,null));}; \ No newline at end of file +var _0x98e5=['Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','foreignKey','output','web','fullPath','%s-%s.%s','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','COUNT(*)','QueryTypes','run','runReport','COUNT(DISTINCT\x20%s)','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','CustomReports','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','type','key','model','intersection','query','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','keys','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value'];(function(_0x1819a3,_0x142065){var _0x14f218=function(_0x4a7761){while(--_0x4a7761){_0x1819a3['push'](_0x1819a3['shift']());}};_0x14f218(++_0x142065);}(_0x98e5,0xd2));var _0x598e=function(_0x5b5ffe,_0x1c5874){_0x5b5ffe=_0x5b5ffe-0x0;var _0x2d12bc=_0x98e5[_0x5b5ffe];return _0x2d12bc;};'use strict';var emlformat=require(_0x598e('0x0'));var rimraf=require(_0x598e('0x1'));var zipdir=require(_0x598e('0x2'));var jsonpatch=require(_0x598e('0x3'));var rp=require('request-promise');var moment=require(_0x598e('0x4'));var BPromise=require(_0x598e('0x5'));var Mustache=require(_0x598e('0x6'));var util=require(_0x598e('0x7'));var path=require('path');var sox=require(_0x598e('0x8'));var csv=require(_0x598e('0x9'));var ejs=require(_0x598e('0xa'));var fs=require('fs');var fs_extra=require(_0x598e('0xb'));var _=require('lodash');var squel=require(_0x598e('0xc'));var crypto=require(_0x598e('0xd'));var jsforce=require(_0x598e('0xe'));var deskjs=require(_0x598e('0xf'));var toCsv=require(_0x598e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x598e('0x10'));var as=require(_0x598e('0x11'));var hardwareService=require(_0x598e('0x12'));var logger=require(_0x598e('0x13'))('api');var utils=require(_0x598e('0x14'));var config=require(_0x598e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x598e('0x16'))[_0x598e('0x17')];function respondWithStatusCode(_0x1e89f2,_0x34ef86){_0x34ef86=_0x34ef86||0xcc;return function(_0x3ca5c3){if(_0x3ca5c3){return _0x1e89f2['sendStatus'](_0x34ef86);}return _0x1e89f2[_0x598e('0x18')](_0x34ef86)[_0x598e('0x19')]();};}function respondWithResult(_0x1484f7,_0x4ca784){_0x4ca784=_0x4ca784||0xc8;return function(_0x4e9106){if(_0x4e9106){return _0x1484f7[_0x598e('0x18')](_0x4ca784)['json'](_0x4e9106);}};}function respondWithFilteredResult(_0x443155,_0x4bf97e){return function(_0x1a29bd){if(_0x1a29bd){var _0x30d714=typeof _0x4bf97e[_0x598e('0x1a')]===_0x598e('0x1b')&&typeof _0x4bf97e['limit']===_0x598e('0x1b');var _0x476358=_0x1a29bd[_0x598e('0x1c')];var _0x48cc3c=_0x30d714?0x0:_0x4bf97e[_0x598e('0x1a')];var _0x4e8331=_0x30d714?_0x1a29bd[_0x598e('0x1c')]:_0x4bf97e[_0x598e('0x1a')]+_0x4bf97e[_0x598e('0x1d')];var _0x45ac5b;if(_0x4e8331>=_0x476358){_0x4e8331=_0x476358;_0x45ac5b=0xc8;}else{_0x45ac5b=0xce;}_0x443155[_0x598e('0x18')](_0x45ac5b);return _0x443155[_0x598e('0x1e')](_0x598e('0x1f'),_0x48cc3c+'-'+_0x4e8331+'/'+_0x476358)[_0x598e('0x20')](_0x1a29bd);}return null;};}function patchUpdates(_0x4c57bf){return function(_0x2e4733){try{jsonpatch[_0x598e('0x21')](_0x2e4733,_0x4c57bf,!![]);}catch(_0xe87045){return BPromise['reject'](_0xe87045);}return _0x2e4733[_0x598e('0x22')]();};}function saveUpdates(_0x208234,_0x1b60f6){return function(_0x2870a5){if(_0x2870a5){return _0x2870a5[_0x598e('0x23')](_0x208234)[_0x598e('0x24')](function(_0x52c59e){return _0x52c59e;});}return null;};}function removeEntity(_0x3227e7,_0x436b20){return function(_0x18955b){if(_0x18955b){return _0x18955b[_0x598e('0x25')]()['then'](function(){var _0x2e414c=_0x18955b[_0x598e('0x26')]({'plain':!![]});var _0x22b521=_0x598e('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x22b521,'resourceId':_0x2e414c['id']}})[_0x598e('0x24')](function(){return _0x18955b;});})['then'](function(){_0x3227e7[_0x598e('0x18')](0xcc)[_0x598e('0x19')]();});}};}function handleEntityNotFound(_0x33bcc9,_0x2a27d8){return function(_0x3b73d0){if(!_0x3b73d0){_0x33bcc9[_0x598e('0x28')](0x194);}return _0x3b73d0;};}function handleError(_0x486f58,_0x2e7381){_0x2e7381=_0x2e7381||0x1f4;return function(_0x1a3842){logger[_0x598e('0x29')](_0x1a3842[_0x598e('0x2a')]);if(_0x1a3842[_0x598e('0x2b')]){delete _0x1a3842['name'];}_0x486f58[_0x598e('0x18')](_0x2e7381)[_0x598e('0x2c')](_0x1a3842);};}exports[_0x598e('0x2d')]=function(_0x2bba7d,_0xc503a2){var _0x56ce86={},_0x8f582={},_0x3281e4={'count':0x0,'rows':[]};var _0x28492d=_[_0x598e('0x2e')](db[_0x598e('0x2f')]['rawAttributes'],function(_0x2ecc72){return{'name':_0x2ecc72['fieldName'],'type':_0x2ecc72[_0x598e('0x30')][_0x598e('0x31')]};});_0x8f582[_0x598e('0x32')]=_[_0x598e('0x2e')](_0x28492d,'name');_0x8f582['query']=_['keys'](_0x2bba7d['query']);_0x8f582['filters']=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],_0x8f582[_0x598e('0x34')]);_0x56ce86[_0x598e('0x35')]=_[_0x598e('0x33')](_0x8f582[_0x598e('0x32')],qs[_0x598e('0x36')](_0x2bba7d['query'][_0x598e('0x36')]));_0x56ce86[_0x598e('0x35')]=_0x56ce86[_0x598e('0x35')][_0x598e('0x37')]?_0x56ce86['attributes']:_0x8f582[_0x598e('0x32')];if(!_0x2bba7d[_0x598e('0x34')]['hasOwnProperty']('nolimit')){_0x56ce86[_0x598e('0x1d')]=qs[_0x598e('0x1d')](_0x2bba7d[_0x598e('0x34')]['limit']);_0x56ce86[_0x598e('0x1a')]=qs[_0x598e('0x1a')](_0x2bba7d[_0x598e('0x34')][_0x598e('0x1a')]);}_0x56ce86[_0x598e('0x38')]=qs['sort'](_0x2bba7d[_0x598e('0x34')][_0x598e('0x39')]);_0x56ce86[_0x598e('0x3a')]=qs[_0x598e('0x3b')](_[_0x598e('0x3c')](_0x2bba7d[_0x598e('0x34')],_0x8f582[_0x598e('0x3b')]),_0x28492d);if(_0x2bba7d[_0x598e('0x34')]['filter']){_0x56ce86[_0x598e('0x3a')]=_[_0x598e('0x3d')](_0x56ce86[_0x598e('0x3a')],{'$or':_[_0x598e('0x2e')](_0x28492d,function(_0x1f7425){if(_0x1f7425[_0x598e('0x30')]!==_0x598e('0x3e')){var _0x3b599e={};_0x3b599e[_0x1f7425['name']]={'$like':'%'+_0x2bba7d[_0x598e('0x34')][_0x598e('0x3f')]+'%'};return _0x3b599e;}})});}_0x56ce86=_['merge']({},_0x56ce86,_0x2bba7d[_0x598e('0x40')]);var _0x8e92dc={'where':_0x56ce86[_0x598e('0x3a')]};return db[_0x598e('0x2f')][_0x598e('0x1c')](_0x8e92dc)[_0x598e('0x24')](function(_0x4dd3a5){_0x3281e4[_0x598e('0x1c')]=_0x4dd3a5;if(_0x2bba7d[_0x598e('0x34')][_0x598e('0x41')]){_0x56ce86['include']=[{'all':!![]}];}return db[_0x598e('0x2f')][_0x598e('0x42')](_0x56ce86);})[_0x598e('0x24')](function(_0x48211c){_0x3281e4['rows']=_0x48211c;return _0x3281e4;})[_0x598e('0x24')](respondWithFilteredResult(_0xc503a2,_0x56ce86))['catch'](handleError(_0xc503a2,null));};exports[_0x598e('0x43')]=function(_0x22b113,_0x5dbeb7){var _0x9e20e7={'raw':![],'where':{'id':_0x22b113['params']['id']}},_0x3fdb68={};_0x3fdb68[_0x598e('0x32')]=_[_0x598e('0x44')](db[_0x598e('0x2f')]['rawAttributes']);_0x3fdb68[_0x598e('0x34')]=_['keys'](_0x22b113[_0x598e('0x34')]);_0x3fdb68[_0x598e('0x3b')]=_['intersection'](_0x3fdb68['model'],_0x3fdb68[_0x598e('0x34')]);_0x9e20e7[_0x598e('0x35')]=_[_0x598e('0x33')](_0x3fdb68[_0x598e('0x32')],qs[_0x598e('0x36')](_0x22b113['query'][_0x598e('0x36')]));_0x9e20e7['attributes']=_0x9e20e7[_0x598e('0x35')]['length']?_0x9e20e7[_0x598e('0x35')]:_0x3fdb68['model'];if(_0x22b113[_0x598e('0x34')][_0x598e('0x41')]){_0x9e20e7[_0x598e('0x45')]=[{'all':!![]}];}_0x9e20e7=_[_0x598e('0x3d')]({},_0x9e20e7,_0x22b113[_0x598e('0x40')]);return db['AnalyticCustomReport']['find'](_0x9e20e7)[_0x598e('0x24')](handleEntityNotFound(_0x5dbeb7,null))['then'](respondWithResult(_0x5dbeb7,null))[_0x598e('0x46')](handleError(_0x5dbeb7,null));};exports[_0x598e('0x47')]=function(_0x3cd7a2,_0x4b8327){return db[_0x598e('0x2f')][_0x598e('0x47')](_0x3cd7a2[_0x598e('0x48')],{})[_0x598e('0x24')](function(_0x10ca33){var _0x101b99=_0x3cd7a2[_0x598e('0x49')][_0x598e('0x26')]({'plain':!![]});if(!_0x101b99)throw new Error(_0x598e('0x4a'));if(_0x101b99[_0x598e('0x4b')]===_0x598e('0x49')){var _0x488d18=_0x10ca33['get']({'plain':!![]});var _0x4096b9=_0x598e('0x4c');return db[_0x598e('0x4d')][_0x598e('0x4e')]({'where':{'name':_0x4096b9,'userProfileId':_0x101b99[_0x598e('0x4f')]},'raw':!![]})[_0x598e('0x24')](function(_0x5e2d6b){if(_0x5e2d6b&&_0x5e2d6b[_0x598e('0x50')]===0x0){return db[_0x598e('0x51')][_0x598e('0x47')]({'name':_0x488d18[_0x598e('0x2b')],'resourceId':_0x488d18['id'],'type':_0x598e('0x27'),'sectionId':_0x5e2d6b['id']},{})[_0x598e('0x24')](function(){return _0x10ca33;});}else{return _0x10ca33;}})[_0x598e('0x46')](function(_0x41ab5b){logger[_0x598e('0x29')](_0x598e('0x52'),_0x41ab5b);throw _0x41ab5b;});}return _0x10ca33;})[_0x598e('0x24')](respondWithResult(_0x4b8327,0xc9))[_0x598e('0x46')](handleError(_0x4b8327,null));};exports[_0x598e('0x23')]=function(_0x2927fb,_0x1ee699){if(_0x2927fb[_0x598e('0x48')]['id']){delete _0x2927fb[_0x598e('0x48')]['id'];}return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x2927fb[_0x598e('0x53')]['id']}})[_0x598e('0x24')](handleEntityNotFound(_0x1ee699,null))[_0x598e('0x24')](saveUpdates(_0x2927fb[_0x598e('0x48')],null))[_0x598e('0x24')](respondWithResult(_0x1ee699,null))[_0x598e('0x46')](handleError(_0x1ee699,null));};exports['destroy']=function(_0x13ea81,_0x1c5fe5){return db[_0x598e('0x2f')][_0x598e('0x4e')]({'where':{'id':_0x13ea81[_0x598e('0x53')]['id']}})['then'](handleEntityNotFound(_0x1c5fe5,null))[_0x598e('0x24')](removeEntity(_0x1c5fe5,null))['catch'](handleError(_0x1c5fe5,null));};exports[_0x598e('0x54')]=function(_0x1200f1,_0x4387b1){var _0xc2677d=0xa;var _0xe0e641=['join','left_join',_0x598e('0x55'),_0x598e('0x56')];var _0x564412={'SUM':_0x598e('0x57'),'COUNT':_0x598e('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x4f3f06={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x3465fd=function(_0x461784){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),_0x598e('0x63'),'IS\x20NOT\x20EMPTY'],_0x461784);};var _0x3da027=function(_0x1c3e48){if(!_0x1c3e48||!_0x1c3e48[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x286c54='(',_0x16504f=0x0;_0x16504f<_0x1c3e48['rules'][_0x598e('0x37')];_0x16504f+=0x1){_0x16504f>0x0&&(_0x286c54+='\x20'+_0x1c3e48[_0x598e('0x65')]+'\x20');_0x286c54+=_0x1c3e48['rules'][_0x16504f][_0x598e('0x66')]?_0x3da027(_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x66')]):_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x67')]+'\x20'+_0x1c3e48[_0x598e('0x64')][_0x16504f][_0x598e('0x68')]+(_0x3465fd(_0x1c3e48['rules'][_0x16504f][_0x598e('0x68')])?'\x20'+_0x1c3e48['rules'][_0x16504f][_0x598e('0x69')]:'');}return _0x286c54+')';};var _0x4f4291={'where':{'id':_0x1200f1[_0x598e('0x53')]['id']}},_0x2df2d8,_0x205562,_0x389b95,_0x532adc,_0x39ae36;_0x4f4291=_[_0x598e('0x3d')]({},_0x4f4291,_0x1200f1['options']);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x4f4291)[_0x598e('0x24')](function(_0x313744){if(_0x313744){_0x2df2d8=_0x313744;return _0x313744['getFields']();}return null;})[_0x598e('0x24')](function(_0x11fbc9){if(_0x11fbc9){if(!_0x11fbc9[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x205562=_0x11fbc9;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0xe57600){if(_0xe57600){_0x389b95=_[_0x598e('0x6e')](_0xe57600,'id');var _0x2e62fd;var _0x27f46f=squel[_0x598e('0x6f')]();_0x27f46f[_0x598e('0x70')](_0x2df2d8[_0x598e('0x71')]);for(var _0x10ec80=0x0;_0x10ec80<_0x205562[_0x598e('0x37')];_0x10ec80+=0x1){_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x72')]?_0x389b95[_0x205562[_0x10ec80][_0x598e('0x72')]][_0x598e('0x73')]:_0x205562[_0x10ec80][_0x598e('0x67')];_0x2e62fd=_0x205562[_0x10ec80][_0x598e('0x74')]?_[_0x598e('0x75')](_0x564412[_0x205562[_0x10ec80][_0x598e('0x74')]],'%s',_0x2e62fd):_0x2e62fd;_0x2e62fd=_0x205562[_0x10ec80]['format']?_[_0x598e('0x75')](_0x4f3f06[_0x205562[_0x10ec80][_0x598e('0x76')]],'%s',_0x2e62fd):_0x2e62fd;if(_0x205562[_0x10ec80][_0x598e('0x77')]){_0x27f46f[_0x598e('0x66')](_0x2e62fd);}_0x205562[_0x10ec80]['orderBy']&&_0x27f46f[_0x598e('0x38')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x78')]===_0x598e('0x79')?![]:!![]);_0x27f46f[_0x598e('0x67')](_0x2e62fd,_0x205562[_0x10ec80][_0x598e('0x7a')]||_0x2e62fd);}if(_0x2df2d8[_0x598e('0x7b')]){_0x2df2d8['joins']=JSON[_0x598e('0x7c')](_0x2df2d8['joins']);for(var _0x491c4b=0x0;_0x491c4b<_0x2df2d8[_0x598e('0x7b')]['length'];_0x491c4b+=0x1){if(_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]&&_[_0x598e('0x60')](_0xe0e641,_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')])&&_0x2df2d8['joins'][_0x491c4b][_0x598e('0x7d')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')]&&_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']){_0x27f46f[_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x30')]](_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2df2d8[_0x598e('0x71')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7d')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b][_0x598e('0x7e')],_0x2df2d8[_0x598e('0x7b')][_0x491c4b]['foreignKey']));}}}if(_0x2df2d8[_0x598e('0x80')]){_0x2df2d8[_0x598e('0x80')]=JSON[_0x598e('0x7c')](_0x2df2d8[_0x598e('0x80')]);_0x27f46f[_0x598e('0x3a')](_0x3da027(_0x2df2d8[_0x598e('0x80')][_0x598e('0x66')]));}_0x39ae36=_0x27f46f[_0x598e('0x81')]();_0x27f46f[_0x598e('0x1d')](_0xc2677d);_0x27f46f['offset'](0x0);logger[_0x598e('0x82')](_0x598e('0x83'),_0x27f46f[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x27f46f[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')]['QueryTypes'][_0x598e('0x86')]});}})['then'](respondWithResult(_0x4387b1,null))[_0x598e('0x46')](handleError(_0x4387b1,null));};function runReport(_0x255b1f,_0x1785b4,_0x2f3fae){var _0x3e286a=_0x1785b4[_0x598e('0x2b')];var _0xbfca0c=0xa;var _0x42071b=[_0x598e('0x87'),_0x598e('0x88'),_0x598e('0x55'),'cross_join'];var _0x21d9f0={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':_0x598e('0x8c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3c0458={'SEC_TO_TIME':_0x598e('0x5b'),'DATE':_0x598e('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x240f30=function(_0x5d319d){return!_[_0x598e('0x60')]([_0x598e('0x61'),'IS\x20NOT\x20NULL',_0x598e('0x63'),_0x598e('0x8d')],_0x5d319d);};var _0x1c4d83=function(_0x10e868){if(!_0x10e868||!_0x10e868[_0x598e('0x64')][_0x598e('0x37')]){return'';}for(var _0x198495='(',_0x21f968=0x0;_0x21f968<_0x10e868['rules'][_0x598e('0x37')];_0x21f968+=0x1){_0x21f968>0x0&&(_0x198495+='\x20'+_0x10e868[_0x598e('0x65')]+'\x20');_0x198495+=_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x66')]?_0x1c4d83(_0x10e868[_0x598e('0x64')][_0x21f968]['group']):_0x10e868[_0x598e('0x64')][_0x21f968][_0x598e('0x67')]+'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['condition']+(_0x240f30(_0x10e868['rules'][_0x21f968]['condition'])?'\x20'+_0x10e868[_0x598e('0x64')][_0x21f968]['value']:'');}return _0x198495+')';};var _0x521eb0={'where':{'id':_0x255b1f['id']}},_0x2ded26,_0x51297d,_0x46592f,_0x42dc6d,_0x234a56;_0x521eb0=_[_0x598e('0x3d')]({},_0x521eb0,_0x2f3fae);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0x521eb0)[_0x598e('0x24')](function(_0x266665){if(_0x266665){_0x2ded26=_0x266665;return _0x266665['getFields']();}return null;})[_0x598e('0x24')](function(_0x251b48){if(_0x251b48){if(!_0x251b48[_0x598e('0x37')]){throw new db['Sequelize'][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x51297d=_0x251b48;return db[_0x598e('0x6d')][_0x598e('0x42')]({'raw':!![]});}return null;})[_0x598e('0x24')](function(_0x251b36){if(_0x251b36){_0x46592f=_['keyBy'](_0x251b36,'id');var _0x1bfe30;var _0x57140c=squel[_0x598e('0x6f')]();_0x57140c['from'](_0x2ded26[_0x598e('0x71')]);for(var _0x143c78=0x0;_0x143c78<_0x51297d[_0x598e('0x37')];_0x143c78+=0x1){_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x72')]?_0x46592f[_0x51297d[_0x143c78]['MetricId']]['metric']:_0x51297d[_0x143c78][_0x598e('0x67')];_0x1bfe30=_0x51297d[_0x143c78][_0x598e('0x74')]?_[_0x598e('0x75')](_0x21d9f0[_0x51297d[_0x143c78]['function']],'%s',_0x1bfe30):_0x1bfe30;_0x1bfe30=_0x51297d[_0x143c78]['format']?_[_0x598e('0x75')](_0x3c0458[_0x51297d[_0x143c78]['format']],'%s',_0x1bfe30):_0x1bfe30;if(_0x51297d[_0x143c78][_0x598e('0x77')]){_0x57140c['group'](_0x1bfe30);}_0x51297d[_0x143c78]['orderBy']&&_0x57140c[_0x598e('0x38')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x78')]==='DESC'?![]:!![]);_0x57140c[_0x598e('0x67')](_0x1bfe30,_0x51297d[_0x143c78][_0x598e('0x7a')]||_0x1bfe30);}if(_0x2ded26[_0x598e('0x7b')]){_0x2ded26[_0x598e('0x7b')]=JSON['parse'](_0x2ded26[_0x598e('0x7b')]);for(var _0x313713=0x0;_0x313713<_0x2ded26['joins'][_0x598e('0x37')];_0x313713+=0x1){if(_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x42071b,_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')])&&_0x2ded26[_0x598e('0x7b')][_0x313713]['parentKey']&&_0x2ded26['joins'][_0x313713][_0x598e('0x7e')]&&_0x2ded26['joins'][_0x313713]['foreignKey']){_0x57140c[_0x2ded26[_0x598e('0x7b')][_0x313713][_0x598e('0x30')]](_0x2ded26['joins'][_0x313713]['foreignTable'],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x2ded26[_0x598e('0x71')],_0x2ded26['joins'][_0x313713]['parentKey'],_0x2ded26['joins'][_0x313713][_0x598e('0x7e')],_0x2ded26['joins'][_0x313713][_0x598e('0x8e')]));}}}if(_0x2ded26[_0x598e('0x80')]){_0x2ded26['conditions']=JSON[_0x598e('0x7c')](_0x2ded26[_0x598e('0x80')]);_0x57140c[_0x598e('0x3a')](_0x1c4d83(_0x2ded26[_0x598e('0x80')]['group']));}_0x234a56=_0x57140c[_0x598e('0x81')]();_0x57140c['limit'](_0xbfca0c);_0x57140c[_0x598e('0x1a')](0x0);return;}})[_0x598e('0x24')](function(){if(_0x1785b4[_0x598e('0x8f')]===_0x598e('0x90')){return null;}var _0xd95b54=_['merge'](_0x1785b4,{'name':_0x1785b4[_0x598e('0x91')]||_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],'basename':_0x3e286a,'savename':util[_0x598e('0x76')](_0x598e('0x92'),_0x1785b4[_0x598e('0x2b')]||_0x2ded26[_0x598e('0x2b')],require('randomstring')['generate'](0x4),_0x1785b4[_0x598e('0x8f')]||'csv'),'reportId':_0x2ded26['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x598e('0x47')](_0xd95b54,{'raw':!![]});})[_0x598e('0x24')](function(_0x6cb4c9){if(_0x2ded26[_0x598e('0x71')]===_0x598e('0x93')){_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+_0x598e('0x94'),_0x1785b4[_0x598e('0x95')],_0x1785b4[_0x598e('0x96')]);}else{_0x234a56[_0x598e('0x3a')](_0x2ded26[_0x598e('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1785b4['startDate'],_0x1785b4[_0x598e('0x96')]);}if(_0x6cb4c9){logger['info'](_0x598e('0x97'),_0x234a56[_0x598e('0x84')]());require('child_process')['fork'](path[_0x598e('0x87')](__dirname,'../../components/export/',_0x6cb4c9[_0x598e('0x8f')]),[_0x6cb4c9['id'],_0x234a56[_0x598e('0x84')](),path['join'](__dirname,'../../files/reports',_0x6cb4c9['savename']),_0x3e286a]);return _0x6cb4c9;}else{var _0x588a55=squel[_0x598e('0x6f')]();_0x588a55[_0x598e('0x70')]('('+_0x234a56[_0x598e('0x84')]()+')','countTable');_0x588a55[_0x598e('0x67')](_0x598e('0x98'),'count');_0x234a56[_0x598e('0x1d')](_0x1785b4[_0x598e('0x1d')]||_0xbfca0c);_0x234a56[_0x598e('0x1a')](_0x1785b4[_0x598e('0x1a')]||0x0);return dbH['sequelize'][_0x598e('0x34')](_0x588a55[_0x598e('0x84')](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]})[_0x598e('0x24')](function(_0x1fc7c5){if(!_0x1fc7c5[_0x598e('0x37')]){_0x42dc6d=0x0;}else{_0x42dc6d=_0x1fc7c5[0x0][_0x598e('0x1c')]||0x0;}return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x234a56['toString'](),{'type':dbH[_0x598e('0x85')][_0x598e('0x99')][_0x598e('0x86')]});})['then'](function(_0x58a3e2){return{'rows':_0x58a3e2||[],'count':_0x42dc6d};});}});}exports[_0x598e('0x9a')]=function(_0x4f9c25,_0x2fd65c){return runReport(_0x4f9c25['params'],_0x4f9c25[_0x598e('0x34')],_0x4f9c25[_0x598e('0x40')])['then'](respondWithResult(_0x2fd65c,null))['catch'](handleError(_0x2fd65c,null));};exports[_0x598e('0x9b')]=runReport;exports['query']=function(_0x381539,_0x74c91){var _0x5ad460=0xa;var _0x51968c=['join',_0x598e('0x88'),'right_join','cross_join'];var _0x312405={'SUM':_0x598e('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x598e('0x9c'),'MAX':_0x598e('0x59'),'MIN':_0x598e('0x89'),'AVG':_0x598e('0x8a'),'GROUP_CONCAT':_0x598e('0x8b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x598e('0x5a')};var _0x889936={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x598e('0x5c'),'HOUR':_0x598e('0x5d'),'ROUND':_0x598e('0x5e'),'UNIX_TIMESTAMP':_0x598e('0x5f')};var _0x311610=function(_0x24651b){return!_[_0x598e('0x60')]([_0x598e('0x61'),_0x598e('0x62'),'IS\x20EMPTY',_0x598e('0x8d')],_0x24651b);};var _0x3353eb=function(_0x53b068){if(!_0x53b068||!_0x53b068[_0x598e('0x64')]['length']){return'';}for(var _0x2faa88='(',_0x3b39ae=0x0;_0x3b39ae<_0x53b068[_0x598e('0x64')][_0x598e('0x37')];_0x3b39ae+=0x1){_0x3b39ae>0x0&&(_0x2faa88+='\x20'+_0x53b068['operator']+'\x20');_0x2faa88+=_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]?_0x3353eb(_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x66')]):_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x67')]+'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x68')]+(_0x311610(_0x53b068[_0x598e('0x64')][_0x3b39ae]['condition'])?'\x20'+_0x53b068[_0x598e('0x64')][_0x3b39ae][_0x598e('0x69')]:'');}return _0x2faa88+')';};var _0xadc912={'where':{'id':_0x381539[_0x598e('0x53')]['id']}},_0x3e1abf,_0x12e23b,_0x3a80cc,_0x272352,_0x1ab3b3;_0xadc912=_['merge']({},_0xadc912,_0x381539[_0x598e('0x40')]);return db[_0x598e('0x2f')][_0x598e('0x4e')](_0xadc912)['then'](function(_0x268d91){if(_0x268d91){_0x3e1abf=_0x268d91;return _0x268d91[_0x598e('0x9d')]();}return null;})[_0x598e('0x24')](function(_0x3273f6){if(_0x3273f6){if(!_0x3273f6[_0x598e('0x37')]){throw new db[(_0x598e('0x6a'))][(_0x598e('0x6b'))](_0x598e('0x6c'),0x193);}_0x12e23b=_0x3273f6;return db[_0x598e('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x522217){if(_0x522217){_0x3a80cc=_[_0x598e('0x6e')](_0x522217,'id');var _0x2405fb;var _0x29ddc3=squel[_0x598e('0x6f')]();_0x29ddc3[_0x598e('0x70')](_0x3e1abf[_0x598e('0x71')]);for(var _0x3f156f=0x0;_0x3f156f<_0x12e23b[_0x598e('0x37')];_0x3f156f+=0x1){_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x72')]?_0x3a80cc[_0x12e23b[_0x3f156f][_0x598e('0x72')]][_0x598e('0x73')]:_0x12e23b[_0x3f156f][_0x598e('0x67')];_0x2405fb=_0x12e23b[_0x3f156f]['function']?_[_0x598e('0x75')](_0x312405[_0x12e23b[_0x3f156f][_0x598e('0x74')]],'%s',_0x2405fb):_0x2405fb;_0x2405fb=_0x12e23b[_0x3f156f][_0x598e('0x76')]?_['replace'](_0x889936[_0x12e23b[_0x3f156f][_0x598e('0x76')]],'%s',_0x2405fb):_0x2405fb;if(_0x12e23b[_0x3f156f][_0x598e('0x77')]){_0x29ddc3[_0x598e('0x66')](_0x2405fb);}_0x12e23b[_0x3f156f]['orderBy']&&_0x29ddc3[_0x598e('0x38')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x78')]==='DESC'?![]:!![]);_0x29ddc3[_0x598e('0x67')](_0x2405fb,_0x12e23b[_0x3f156f][_0x598e('0x7a')]||_0x2405fb);}if(_0x3e1abf[_0x598e('0x7b')]){_0x3e1abf[_0x598e('0x7b')]=JSON[_0x598e('0x7c')](_0x3e1abf[_0x598e('0x7b')]);for(var _0x5d081a=0x0;_0x5d081a<_0x3e1abf[_0x598e('0x7b')]['length'];_0x5d081a+=0x1){if(_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')]&&_[_0x598e('0x60')](_0x51968c,_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x30')])&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey']&&_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')]&&_0x3e1abf['joins'][_0x5d081a]['foreignKey']){_0x29ddc3[_0x3e1abf['joins'][_0x5d081a][_0x598e('0x30')]](_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],null,util[_0x598e('0x76')](_0x598e('0x7f'),_0x3e1abf['table'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a]['parentKey'],_0x3e1abf[_0x598e('0x7b')][_0x5d081a][_0x598e('0x7e')],_0x3e1abf['joins'][_0x5d081a][_0x598e('0x8e')]));}}}if(_0x3e1abf['conditions']){_0x3e1abf['conditions']=JSON[_0x598e('0x7c')](_0x3e1abf['conditions']);_0x29ddc3[_0x598e('0x3a')](_0x3353eb(_0x3e1abf['conditions'][_0x598e('0x66')]));}_0x1ab3b3=_0x29ddc3['clone']();_0x29ddc3[_0x598e('0x1d')](_0x5ad460);_0x29ddc3[_0x598e('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x29ddc3[_0x598e('0x84')]());return dbH[_0x598e('0x85')][_0x598e('0x34')](_0x29ddc3[_0x598e('0x84')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x598e('0x24')](function(){return{'sql':_0x1ab3b3[_0x598e('0x84')]()};})['then'](respondWithResult(_0x74c91,null))[_0x598e('0x46')](handleError(_0x74c91,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 658d00c..78b1df0 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 _0x4d5a=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x1fb75c,_0x28e425){var _0x52455b=function(_0x4dc73e){while(--_0x4dc73e){_0x1fb75c['push'](_0x1fb75c['shift']());}};_0x52455b(++_0x28e425);}(_0x4d5a,0x1c2));var _0xa4d5=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4d5a[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xa4d5('0x0'));var util=require(_0xa4d5('0x1'));var logger=require(_0xa4d5('0x2'))('api');var moment=require(_0xa4d5('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4d5('0x4'));var fs=require('fs');var path=require(_0xa4d5('0x5'));var rimraf=require('rimraf');var config=require(_0xa4d5('0x6'));var attributes=require(_0xa4d5('0x7'));module[_0xa4d5('0x8')]=function(_0x37593e,_0x57bcee){return _0x37593e[_0xa4d5('0x9')]('AnalyticCustomReport',attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44cd=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x21d94c,_0x564a82){var _0x4772dc=function(_0x4d8107){while(--_0x4d8107){_0x21d94c['push'](_0x21d94c['shift']());}};_0x4772dc(++_0x564a82);}(_0x44cd,0xde));var _0xd44c=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x44cd[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd44c('0x0'));var util=require('util');var logger=require(_0xd44c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd44c('0x2'));var rp=require(_0xd44c('0x3'));var fs=require('fs');var path=require(_0xd44c('0x4'));var rimraf=require(_0xd44c('0x5'));var config=require(_0xd44c('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xd44c('0x7')]=function(_0x3478d8,_0x1c5caf){return _0x3478d8['define'](_0xd44c('0x8'),attributes,{'tableName':_0xd44c('0x9'),'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 7eea0c1..3363988 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 _0xd41f=['jayson/promise','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xfd41('0x0'));var moment=require(_0xfd41('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd41('0x2'));var fs=require('fs');var Redis=require(_0xfd41('0x3'));var db=require(_0xfd41('0x4'))['db'];var utils=require(_0xfd41('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd41('0x6'));var client=jayson['client'][_0xfd41('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a1f71,_0x3c4ba2,_0x289c13){return new BPromise(function(_0x5e9bf2,_0x898a79){return client[_0xfd41('0x8')](_0x5a1f71,_0x289c13)[_0xfd41('0x9')](function(_0x4fdd6f){logger[_0xfd41('0xa')](_0xfd41('0xb'),_0x3c4ba2,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3c4ba2,'request\x20sent',JSON[_0xfd41('0xc')](_0x4fdd6f));if(_0x4fdd6f['error']){if(_0x4fdd6f['error'][_0xfd41('0xd')]===0x1f4){logger[_0xfd41('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c4ba2,_0x4fdd6f[_0xfd41('0xe')]['message']);return _0x898a79(_0x4fdd6f['error'][_0xfd41('0xf')]);}logger[_0xfd41('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c4ba2,_0x4fdd6f[_0xfd41('0xe')][_0xfd41('0xf')]);return _0x5e9bf2(_0x4fdd6f[_0xfd41('0xe')][_0xfd41('0xf')]);}else{logger[_0xfd41('0xa')](_0xfd41('0xb'),_0x3c4ba2,_0xfd41('0x10'));_0x5e9bf2(_0x4fdd6f[_0xfd41('0x11')][_0xfd41('0xf')]);}})[_0xfd41('0x12')](function(_0x5b9868){logger[_0xfd41('0xe')](_0xfd41('0xb'),_0x3c4ba2,_0x5b9868);_0x898a79(_0x5b9868);});});} \ No newline at end of file +var _0x89f9=['jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x89f9,0x19f));var _0x989f=function(_0x37f9ae,_0x577eaa){_0x37f9ae=_0x37f9ae-0x0;var _0x53fbb4=_0x89f9[_0x37f9ae];return _0x53fbb4;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var moment=require(_0x989f('0x2'));var BPromise=require(_0x989f('0x3'));var rs=require(_0x989f('0x4'));var fs=require('fs');var Redis=require(_0x989f('0x5'));var db=require(_0x989f('0x6'))['db'];var utils=require(_0x989f('0x7'));var logger=require(_0x989f('0x8'))('rpc');var config=require(_0x989f('0x9'));var jayson=require(_0x989f('0xa'));var client=jayson[_0x989f('0xb')][_0x989f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x307247,_0x47d120,_0x2838cc){return new BPromise(function(_0x1e71b6,_0xb66a36){return client[_0x989f('0xd')](_0x307247,_0x2838cc)[_0x989f('0xe')](function(_0x30bf90){logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));logger[_0x989f('0x12')](_0x989f('0x13'),_0x47d120,_0x989f('0x11'),JSON[_0x989f('0x14')](_0x30bf90));if(_0x30bf90[_0x989f('0x15')]){if(_0x30bf90['error'][_0x989f('0x16')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x47d120,_0x30bf90['error'][_0x989f('0x17')]);return _0xb66a36(_0x30bf90['error'][_0x989f('0x17')]);}logger[_0x989f('0x15')](_0x989f('0x10'),_0x47d120,_0x30bf90[_0x989f('0x15')][_0x989f('0x17')]);return _0x1e71b6(_0x30bf90['error']['message']);}else{logger[_0x989f('0xf')](_0x989f('0x10'),_0x47d120,_0x989f('0x11'));_0x1e71b6(_0x30bf90[_0x989f('0x18')][_0x989f('0x17')]);}})['catch'](function(_0x291e61){logger['error'](_0x989f('0x10'),_0x47d120,_0x291e61);_0xb66a36(_0x291e61);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 11c8028..702da56 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 _0xc248=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','run','/:id/query','query','post','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xc248,0xfc));var _0x8c24=function(_0x3aeab4,_0x1e7f27){_0x3aeab4=_0x3aeab4-0x0;var _0x2c9286=_0xc248[_0x3aeab4];return _0x2c9286;};'use strict';var multer=require(_0x8c24('0x0'));var util=require(_0x8c24('0x1'));var path=require('path');var timeout=require(_0x8c24('0x2'));var express=require(_0x8c24('0x3'));var router=express[_0x8c24('0x4')]();var fs_extra=require(_0x8c24('0x5'));var auth=require(_0x8c24('0x6'));var interaction=require(_0x8c24('0x7'));var config=require(_0x8c24('0x8'));var controller=require(_0x8c24('0x9'));router[_0x8c24('0xa')]('/',auth[_0x8c24('0xb')](),controller[_0x8c24('0xc')]);router[_0x8c24('0xa')](_0x8c24('0xd'),auth[_0x8c24('0xb')](),controller[_0x8c24('0xe')]);router[_0x8c24('0xa')](_0x8c24('0xf'),auth['isAuthenticated'](),controller['preview']);router[_0x8c24('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0x8c24('0x10')]);router[_0x8c24('0xa')](_0x8c24('0x11'),auth[_0x8c24('0xb')](),controller[_0x8c24('0x12')]);router[_0x8c24('0x13')]('/',auth[_0x8c24('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8c24('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8a33=['isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id'];(function(_0x6c649c,_0x5a5c9e){var _0x28e9e8=function(_0x365f29){while(--_0x365f29){_0x6c649c['push'](_0x6c649c['shift']());}};_0x28e9e8(++_0x5a5c9e);}(_0x8a33,0xee));var _0x38a3=function(_0x443f79,_0x33e446){_0x443f79=_0x443f79-0x0;var _0x3847e4=_0x8a33[_0x443f79];return _0x3847e4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x38a3('0x0'));var timeout=require(_0x38a3('0x1'));var express=require(_0x38a3('0x2'));var router=express[_0x38a3('0x3')]();var fs_extra=require(_0x38a3('0x4'));var auth=require(_0x38a3('0x5'));var interaction=require(_0x38a3('0x6'));var config=require(_0x38a3('0x7'));var controller=require(_0x38a3('0x8'));router[_0x38a3('0x9')]('/',auth['isAuthenticated'](),controller[_0x38a3('0xa')]);router[_0x38a3('0x9')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0xd')]);router[_0x38a3('0x9')](_0x38a3('0xe'),auth['isAuthenticated'](),controller[_0x38a3('0xf')]);router[_0x38a3('0x9')](_0x38a3('0x10'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x11')]);router[_0x38a3('0x9')](_0x38a3('0x12'),auth['isAuthenticated'](),controller[_0x38a3('0x13')]);router[_0x38a3('0x14')]('/',auth['isAuthenticated'](),controller[_0x38a3('0x15')]);router[_0x38a3('0x16')](_0x38a3('0xb'),auth[_0x38a3('0xc')](),controller[_0x38a3('0x17')]);router['delete']('/:id',auth[_0x38a3('0xc')](),controller['destroy']);module[_0x38a3('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 96adf6f..6719bb3 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x46ed,0x168));var _0xd46e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46ed[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x224ce8,_0x565691){var _0x5054a1=function(_0x5dde3f){while(--_0x5dde3f){_0x224ce8['push'](_0x224ce8['shift']());}};_0x5054a1(++_0x565691);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index fe650e5..7be16a5 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x92850b,_0xc43190){var _0x138c1f=function(_0x1587a3){while(--_0x1587a3){_0x92850b['push'](_0x92850b['shift']());}};_0x138c1f(++_0xc43190);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f7c43,_0x5ca843){_0x2f7c43=_0x2f7c43-0x0;var _0x3da68f=_0xf494[_0x2f7c43];return _0x3da68f;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file +var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','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','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x1e6f3b,_0x58993b){_0x1e6f3b=_0x1e6f3b-0x0;var _0x577290=_0x326f[_0x1e6f3b];return _0x577290;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 68f7525..bcfb2da 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 _0x21bd=['AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x21bd,0x1a6));var _0xd21b=function(_0x5b9f58,_0x4fc62d){_0x5b9f58=_0x5b9f58-0x0;var _0xb4365d=_0x21bd[_0x5b9f58];return _0xb4365d;};'use strict';var _=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var logger=require('../../config/logger')(_0xd21b('0x2'));var moment=require(_0xd21b('0x3'));var BPromise=require(_0xd21b('0x4'));var rp=require(_0xd21b('0x5'));var fs=require('fs');var path=require(_0xd21b('0x6'));var rimraf=require(_0xd21b('0x7'));var config=require(_0xd21b('0x8'));var attributes=require(_0xd21b('0x9'));module[_0xd21b('0xa')]=function(_0x35aa12,_0x9c62bb){return _0x35aa12[_0xd21b('0xb')](_0xd21b('0xc'),attributes,{'tableName':_0xd21b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22a7=['../../config/logger','api','moment','bluebird','path','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3a030a,_0x56f29a){var _0xcaf7b8=function(_0x3af88a){while(--_0x3af88a){_0x3a030a['push'](_0x3a030a['shift']());}};_0xcaf7b8(++_0x56f29a);}(_0x22a7,0x1ea));var _0x722a=function(_0x1dfb49,_0x3300db){_0x1dfb49=_0x1dfb49-0x0;var _0x7ea566=_0x22a7[_0x1dfb49];return _0x7ea566;};'use strict';var _=require(_0x722a('0x0'));var util=require(_0x722a('0x1'));var logger=require(_0x722a('0x2'))(_0x722a('0x3'));var moment=require(_0x722a('0x4'));var BPromise=require(_0x722a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x722a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x722a('0x7'));module[_0x722a('0x8')]=function(_0xb7d097,_0x57ad58){return _0xb7d097[_0x722a('0x9')](_0x722a('0xa'),attributes,{'tableName':_0x722a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 029f11b..54f8102 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 _0x53e5=['info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x53e5,0x153));var _0x553e=function(_0x17a98c,_0x5251f5){_0x17a98c=_0x17a98c-0x0;var _0x1bfd30=_0x53e5[_0x17a98c];return _0x1bfd30;};'use strict';var _=require(_0x553e('0x0'));var util=require(_0x553e('0x1'));var moment=require(_0x553e('0x2'));var BPromise=require(_0x553e('0x3'));var rs=require(_0x553e('0x4'));var fs=require('fs');var Redis=require(_0x553e('0x5'));var db=require(_0x553e('0x6'))['db'];var utils=require(_0x553e('0x7'));var logger=require(_0x553e('0x8'))('rpc');var config=require(_0x553e('0x9'));var jayson=require(_0x553e('0xa'));var client=jayson[_0x553e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4931,_0x3d07c3,_0x5357c2){return new BPromise(function(_0x57fee9,_0x3ab38c){return client['request'](_0x5d4931,_0x5357c2)[_0x553e('0xc')](function(_0x28b40a){logger[_0x553e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d07c3,'request\x20sent');logger[_0x553e('0xe')](_0x553e('0xf'),_0x3d07c3,_0x553e('0x10'),JSON['stringify'](_0x28b40a));if(_0x28b40a['error']){if(_0x28b40a[_0x553e('0x11')]['code']===0x1f4){logger['error'](_0x553e('0x12'),_0x3d07c3,_0x28b40a[_0x553e('0x11')]['message']);return _0x3ab38c(_0x28b40a[_0x553e('0x11')][_0x553e('0x13')]);}logger[_0x553e('0x11')](_0x553e('0x12'),_0x3d07c3,_0x28b40a[_0x553e('0x11')][_0x553e('0x13')]);return _0x57fee9(_0x28b40a[_0x553e('0x11')]['message']);}else{logger[_0x553e('0xd')](_0x553e('0x12'),_0x3d07c3,'request\x20sent');_0x57fee9(_0x28b40a[_0x553e('0x14')][_0x553e('0x13')]);}})[_0x553e('0x15')](function(_0x792387){logger[_0x553e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d07c3,_0x792387);_0x3ab38c(_0x792387);});});} \ No newline at end of file +var _0xfe33=['message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0xfe33,0x87));var _0x3fe3=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0xfe33[_0x39e15b];return _0x4e5766;};'use strict';var _=require('lodash');var util=require(_0x3fe3('0x0'));var moment=require(_0x3fe3('0x1'));var BPromise=require(_0x3fe3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fe3('0x4'))(_0x3fe3('0x5'));var config=require(_0x3fe3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3fe3('0x7')][_0x3fe3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f37ff,_0x21b040,_0x9b80a1){return new BPromise(function(_0x3ef4d9,_0x15bc0d){return client[_0x3fe3('0x9')](_0x2f37ff,_0x9b80a1)[_0x3fe3('0xa')](function(_0x28c716){logger[_0x3fe3('0xb')](_0x3fe3('0xc'),_0x21b040,_0x3fe3('0xd'));logger[_0x3fe3('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x21b040,'request\x20sent',JSON[_0x3fe3('0xf')](_0x28c716));if(_0x28c716['error']){if(_0x28c716[_0x3fe3('0x10')]['code']===0x1f4){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);return _0x15bc0d(_0x28c716['error'][_0x3fe3('0x11')]);}logger[_0x3fe3('0x10')](_0x3fe3('0xc'),_0x21b040,_0x28c716['error'][_0x3fe3('0x11')]);return _0x3ef4d9(_0x28c716[_0x3fe3('0x10')][_0x3fe3('0x11')]);}else{logger[_0x3fe3('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x21b040,_0x3fe3('0xd'));_0x3ef4d9(_0x28c716['result']['message']);}})[_0x3fe3('0x12')](function(_0x4a9ae3){logger['error'](_0x3fe3('0xc'),_0x21b040,_0x4a9ae3);_0x15bc0d(_0x4a9ae3);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f78788c..e8f1325 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 _0x83a0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','multer','util','path','connect-timeout','express'];(function(_0x1e5e1c,_0x2125e9){var _0x5e9656=function(_0x4c95e7){while(--_0x4c95e7){_0x1e5e1c['push'](_0x1e5e1c['shift']());}};_0x5e9656(++_0x2125e9);}(_0x83a0,0x181));var _0x083a=function(_0x585837,_0x49c11d){_0x585837=_0x585837-0x0;var _0x3a859e=_0x83a0[_0x585837];return _0x3a859e;};'use strict';var multer=require(_0x083a('0x0'));var util=require(_0x083a('0x1'));var path=require(_0x083a('0x2'));var timeout=require(_0x083a('0x3'));var express=require(_0x083a('0x4'));var router=express[_0x083a('0x5')]();var fs_extra=require(_0x083a('0x6'));var auth=require(_0x083a('0x7'));var interaction=require(_0x083a('0x8'));var config=require(_0x083a('0x9'));var controller=require(_0x083a('0xa'));router[_0x083a('0xb')]('/',auth['isAuthenticated'](),controller[_0x083a('0xc')]);router[_0x083a('0xb')]('/:id',auth[_0x083a('0xd')](),controller[_0x083a('0xe')]);router[_0x083a('0xb')](_0x083a('0xf'),auth[_0x083a('0xd')](),controller[_0x083a('0x10')]);router['get'](_0x083a('0x11'),auth[_0x083a('0xd')](),controller[_0x083a('0x12')]);router[_0x083a('0xb')](_0x083a('0x13'),auth['isAuthenticated'](),controller['query']);router[_0x083a('0x14')]('/',auth[_0x083a('0xd')](),controller[_0x083a('0x15')]);router[_0x083a('0x16')]('/:id',auth[_0x083a('0xd')](),controller[_0x083a('0x17')]);router[_0x083a('0x18')](_0x083a('0x19'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2009=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x37dd5f,_0x104365){var _0x2fc2e7=function(_0x5b7d76){while(--_0x5b7d76){_0x37dd5f['push'](_0x37dd5f['shift']());}};_0x2fc2e7(++_0x104365);}(_0x2009,0xac));var _0x9200=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2009[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9200('0x0'));var util=require('util');var path=require(_0x9200('0x1'));var timeout=require(_0x9200('0x2'));var express=require(_0x9200('0x3'));var router=express[_0x9200('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9200('0x5'));var interaction=require(_0x9200('0x6'));var config=require(_0x9200('0x7'));var controller=require(_0x9200('0x8'));router[_0x9200('0x9')]('/',auth[_0x9200('0xa')](),controller[_0x9200('0xb')]);router[_0x9200('0x9')](_0x9200('0xc'),auth[_0x9200('0xa')](),controller[_0x9200('0xd')]);router[_0x9200('0x9')](_0x9200('0xe'),auth[_0x9200('0xa')](),controller[_0x9200('0xf')]);router[_0x9200('0x9')]('/:id/run',auth[_0x9200('0xa')](),controller[_0x9200('0x10')]);router['get'](_0x9200('0x11'),auth['isAuthenticated'](),controller[_0x9200('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9200('0xa')](),controller[_0x9200('0x13')]);router[_0x9200('0x14')](_0x9200('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9200('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 80e746b..f84e16f 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 _0xa4b8=['DATE','Loading','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf','xlsx'];(function(_0x240f68,_0x5769b9){var _0x1fe163=function(_0x4522b2){while(--_0x4522b2){_0x240f68['push'](_0x240f68['shift']());}};_0x1fe163(++_0x5769b9);}(_0xa4b8,0x1cd));var _0x8a4b=function(_0x245c42,_0x1953e7){_0x245c42=_0x245c42-0x0;var _0x243649=_0xa4b8[_0x245c42];return _0x243649;};'use strict';var Sequelize=require(_0x8a4b('0x0'));var moment=require(_0x8a4b('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8a4b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x8a4b('0x3')](_0x8a4b('0x4'),_0x8a4b('0x5'),_0x8a4b('0x6')),'allowNull':![],'defaultValue':_0x8a4b('0x4')},'savename':{'type':Sequelize[_0x8a4b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8a4b('0x7')]},'endDate':{'type':Sequelize[_0x8a4b('0x7')]},'status':{'type':Sequelize[_0x8a4b('0x2')],'defaultValue':_0x8a4b('0x8')},'type':{'type':Sequelize[_0x8a4b('0x3')]('manual',_0x8a4b('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8a4b('0xa')](0xb)[_0x8a4b('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb341=['ENUM','pdf','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xb341,0x18f));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'basename':{'type':Sequelize[_0x1b34('0x0')],'allowNull':![]},'output':{'type':Sequelize[_0x1b34('0x1')]('csv',_0x1b34('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x1b34('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1b34('0x4')]},'status':{'type':Sequelize[_0x1b34('0x0')],'defaultValue':_0x1b34('0x5')},'type':{'type':Sequelize[_0x1b34('0x1')](_0x1b34('0x6'),_0x1b34('0x7')),'allowNull':![],'defaultValue':_0x1b34('0x6')},'reportId':{'type':Sequelize[_0x1b34('0x8')](0xb)[_0x1b34('0x9')]},'reportType':{'type':Sequelize[_0x1b34('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 5ba0c1e..2b55794 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 _0x0fb1=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','type','includeAll','rows','catch','params','AnalyticExtractedReport','length','include','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','body','download','basename','savename','existsSync','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','server/files/reports','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','stack','name','send','index','map','fieldName'];(function(_0x1b13c8,_0x46c81f){var _0x707ce9=function(_0x40edab){while(--_0x40edab){_0x1b13c8['push'](_0x1b13c8['shift']());}};_0x707ce9(++_0x46c81f);}(_0x0fb1,0xe1));var _0x10fb=function(_0x301d02,_0x25bf0f){_0x301d02=_0x301d02-0x0;var _0x4ce8e5=_0x0fb1[_0x301d02];return _0x4ce8e5;};'use strict';var emlformat=require(_0x10fb('0x0'));var rimraf=require(_0x10fb('0x1'));var zipdir=require(_0x10fb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10fb('0x3'));var moment=require('moment');var BPromise=require(_0x10fb('0x4'));var Mustache=require('mustache');var util=require(_0x10fb('0x5'));var path=require(_0x10fb('0x6'));var sox=require(_0x10fb('0x7'));var csv=require('to-csv');var ejs=require(_0x10fb('0x8'));var fs=require('fs');var fs_extra=require(_0x10fb('0x9'));var _=require('lodash');var squel=require(_0x10fb('0xa'));var crypto=require(_0x10fb('0xb'));var jsforce=require(_0x10fb('0xc'));var deskjs=require(_0x10fb('0xd'));var toCsv=require(_0x10fb('0xe'));var querystring=require(_0x10fb('0xf'));var Papa=require(_0x10fb('0x10'));var Redis=require('ioredis');var authService=require(_0x10fb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x10fb('0x12'));var hardwareService=require(_0x10fb('0x13'));var logger=require('../../config/logger')(_0x10fb('0x14'));var utils=require(_0x10fb('0x15'));var config=require(_0x10fb('0x16'));var licenseUtil=require(_0x10fb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dcabf,_0x4f5d3c){_0x4f5d3c=_0x4f5d3c||0xcc;return function(_0x4c95f5){if(_0x4c95f5){return _0x5dcabf[_0x10fb('0x18')](_0x4f5d3c);}return _0x5dcabf[_0x10fb('0x19')](_0x4f5d3c)[_0x10fb('0x1a')]();};}function respondWithResult(_0x5224da,_0x17b0a3){_0x17b0a3=_0x17b0a3||0xc8;return function(_0x324516){if(_0x324516){return _0x5224da[_0x10fb('0x19')](_0x17b0a3)[_0x10fb('0x1b')](_0x324516);}};}function respondWithFilteredResult(_0x245a04,_0xfcb15d){return function(_0xafb92e){if(_0xafb92e){var _0x3b7414=typeof _0xfcb15d[_0x10fb('0x1c')]===_0x10fb('0x1d')&&typeof _0xfcb15d[_0x10fb('0x1e')]===_0x10fb('0x1d');var _0x1f422a=_0xafb92e[_0x10fb('0x1f')];var _0x3618db=_0x3b7414?0x0:_0xfcb15d[_0x10fb('0x1c')];var _0x389993=_0x3b7414?_0xafb92e[_0x10fb('0x1f')]:_0xfcb15d[_0x10fb('0x1c')]+_0xfcb15d[_0x10fb('0x1e')];var _0x26a742;if(_0x389993>=_0x1f422a){_0x389993=_0x1f422a;_0x26a742=0xc8;}else{_0x26a742=0xce;}_0x245a04[_0x10fb('0x19')](_0x26a742);return _0x245a04[_0x10fb('0x20')](_0x10fb('0x21'),_0x3618db+'-'+_0x389993+'/'+_0x1f422a)[_0x10fb('0x1b')](_0xafb92e);}return null;};}function patchUpdates(_0x2909c0){return function(_0x3b6e95){try{jsonpatch[_0x10fb('0x22')](_0x3b6e95,_0x2909c0,!![]);}catch(_0x2c4904){return BPromise[_0x10fb('0x23')](_0x2c4904);}return _0x3b6e95[_0x10fb('0x24')]();};}function saveUpdates(_0x5f0d1b,_0x8f2eb5){return function(_0x378a69){if(_0x378a69){return _0x378a69[_0x10fb('0x25')](_0x5f0d1b)[_0x10fb('0x26')](function(_0x334eda){return _0x334eda;});}return null;};}function removeEntity(_0x13a100,_0xbfb3b8){return function(_0xb9a1da){if(_0xb9a1da){return _0xb9a1da[_0x10fb('0x27')]()[_0x10fb('0x26')](function(){var _0x2b1e59=_0xb9a1da[_0x10fb('0x28')]({'plain':!![]});var _0x3eaa02=_0x10fb('0x29');return db['UserProfileResource'][_0x10fb('0x27')]({'where':{'type':_0x3eaa02,'resourceId':_0x2b1e59['id']}})['then'](function(){return _0xb9a1da;});})[_0x10fb('0x26')](function(){_0x13a100[_0x10fb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xac09b6,_0x46c33c){return function(_0x4171b6){if(!_0x4171b6){_0xac09b6[_0x10fb('0x18')](0x194);}return _0x4171b6;};}function handleError(_0x1ec224,_0x17fd94){_0x17fd94=_0x17fd94||0x1f4;return function(_0x4af9fa){logger['error'](_0x4af9fa[_0x10fb('0x2a')]);if(_0x4af9fa[_0x10fb('0x2b')]){delete _0x4af9fa[_0x10fb('0x2b')];}_0x1ec224[_0x10fb('0x19')](_0x17fd94)[_0x10fb('0x2c')](_0x4af9fa);};}exports[_0x10fb('0x2d')]=function(_0x521fe7,_0x2a99e0){var _0x496d6e={},_0x366b35={},_0x45ef3c={'count':0x0,'rows':[]};var _0x531417=_[_0x10fb('0x2e')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x49b53f){return{'name':_0x49b53f[_0x10fb('0x2f')],'type':_0x49b53f['type']['key']};});_0x366b35[_0x10fb('0x30')]=_[_0x10fb('0x2e')](_0x531417,'name');_0x366b35[_0x10fb('0x31')]=_[_0x10fb('0x32')](_0x521fe7[_0x10fb('0x31')]);_0x366b35[_0x10fb('0x33')]=_[_0x10fb('0x34')](_0x366b35['model'],_0x366b35[_0x10fb('0x31')]);_0x496d6e[_0x10fb('0x35')]=_[_0x10fb('0x34')](_0x366b35[_0x10fb('0x30')],qs[_0x10fb('0x36')](_0x521fe7[_0x10fb('0x31')]['fields']));_0x496d6e[_0x10fb('0x35')]=_0x496d6e[_0x10fb('0x35')]['length']?_0x496d6e[_0x10fb('0x35')]:_0x366b35[_0x10fb('0x30')];if(!_0x521fe7[_0x10fb('0x31')][_0x10fb('0x37')](_0x10fb('0x38'))){_0x496d6e[_0x10fb('0x1e')]=qs[_0x10fb('0x1e')](_0x521fe7[_0x10fb('0x31')][_0x10fb('0x1e')]);_0x496d6e[_0x10fb('0x1c')]=qs[_0x10fb('0x1c')](_0x521fe7['query'][_0x10fb('0x1c')]);}_0x496d6e[_0x10fb('0x39')]=qs['sort'](_0x521fe7[_0x10fb('0x31')]['sort']);_0x496d6e[_0x10fb('0x3a')]=qs['filters'](_[_0x10fb('0x3b')](_0x521fe7[_0x10fb('0x31')],_0x366b35[_0x10fb('0x33')]),_0x531417);if(_0x521fe7[_0x10fb('0x31')]['filter']){_0x496d6e[_0x10fb('0x3a')]=_['merge'](_0x496d6e[_0x10fb('0x3a')],{'$or':_[_0x10fb('0x2e')](_0x531417,function(_0x1841fe){if(_0x1841fe[_0x10fb('0x3c')]!=='VIRTUAL'){var _0x5283dd={};_0x5283dd[_0x1841fe[_0x10fb('0x2b')]]={'$like':'%'+_0x521fe7['query']['filter']+'%'};return _0x5283dd;}})});}_0x496d6e=_['merge']({},_0x496d6e,_0x521fe7['options']);var _0x3507fd={'where':_0x496d6e[_0x10fb('0x3a')]};return db['AnalyticExtractedReport'][_0x10fb('0x1f')](_0x3507fd)[_0x10fb('0x26')](function(_0x323225){_0x45ef3c['count']=_0x323225;if(_0x521fe7['query'][_0x10fb('0x3d')]){_0x496d6e['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x496d6e);})[_0x10fb('0x26')](function(_0x21123c){_0x45ef3c[_0x10fb('0x3e')]=_0x21123c;return _0x45ef3c;})['then'](respondWithFilteredResult(_0x2a99e0,_0x496d6e))[_0x10fb('0x3f')](handleError(_0x2a99e0,null));};exports['show']=function(_0x296e93,_0x1095f3){var _0x358394={'raw':!![],'where':{'id':_0x296e93[_0x10fb('0x40')]['id']}},_0x2dece7={};_0x2dece7[_0x10fb('0x30')]=_[_0x10fb('0x32')](db[_0x10fb('0x41')]['rawAttributes']);_0x2dece7[_0x10fb('0x31')]=_[_0x10fb('0x32')](_0x296e93[_0x10fb('0x31')]);_0x2dece7[_0x10fb('0x33')]=_[_0x10fb('0x34')](_0x2dece7['model'],_0x2dece7[_0x10fb('0x31')]);_0x358394[_0x10fb('0x35')]=_[_0x10fb('0x34')](_0x2dece7[_0x10fb('0x30')],qs[_0x10fb('0x36')](_0x296e93[_0x10fb('0x31')]['fields']));_0x358394[_0x10fb('0x35')]=_0x358394[_0x10fb('0x35')][_0x10fb('0x42')]?_0x358394[_0x10fb('0x35')]:_0x2dece7[_0x10fb('0x30')];if(_0x296e93[_0x10fb('0x31')][_0x10fb('0x3d')]){_0x358394[_0x10fb('0x43')]=[{'all':!![]}];}_0x358394=_[_0x10fb('0x44')]({},_0x358394,_0x296e93[_0x10fb('0x45')]);return db[_0x10fb('0x41')]['find'](_0x358394)[_0x10fb('0x26')](handleEntityNotFound(_0x1095f3,null))[_0x10fb('0x26')](respondWithResult(_0x1095f3,null))[_0x10fb('0x3f')](handleError(_0x1095f3,null));};exports[_0x10fb('0x46')]=function(_0x414ed7,_0x125e0e){return db[_0x10fb('0x41')][_0x10fb('0x46')](_0x414ed7['body'],{})['then'](function(_0x406ee6){var _0x20d423=_0x414ed7[_0x10fb('0x47')][_0x10fb('0x28')]({'plain':!![]});if(!_0x20d423)throw new Error(_0x10fb('0x48'));if(_0x20d423['role']===_0x10fb('0x47')){var _0x17aa80=_0x406ee6[_0x10fb('0x28')]({'plain':!![]});var _0x4a9778='ExtractedReports';return db[_0x10fb('0x49')][_0x10fb('0x4a')]({'where':{'name':_0x4a9778,'userProfileId':_0x20d423[_0x10fb('0x4b')]},'raw':!![]})[_0x10fb('0x26')](function(_0x2337d0){if(_0x2337d0&&_0x2337d0[_0x10fb('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x17aa80[_0x10fb('0x2b')],'resourceId':_0x17aa80['id'],'type':_0x2337d0[_0x10fb('0x2b')],'sectionId':_0x2337d0['id']},{})[_0x10fb('0x26')](function(){return _0x406ee6;});}else{return _0x406ee6;}})[_0x10fb('0x3f')](function(_0x3bea93){logger[_0x10fb('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bea93);throw _0x3bea93;});}return _0x406ee6;})['then'](respondWithResult(_0x125e0e,0xc9))[_0x10fb('0x3f')](handleError(_0x125e0e,null));};exports[_0x10fb('0x25')]=function(_0x4df615,_0x28580f){if(_0x4df615[_0x10fb('0x4e')]['id']){delete _0x4df615[_0x10fb('0x4e')]['id'];}return db[_0x10fb('0x41')][_0x10fb('0x4a')]({'where':{'id':_0x4df615[_0x10fb('0x40')]['id']}})[_0x10fb('0x26')](handleEntityNotFound(_0x28580f,null))[_0x10fb('0x26')](saveUpdates(_0x4df615['body'],null))[_0x10fb('0x26')](respondWithResult(_0x28580f,null))[_0x10fb('0x3f')](handleError(_0x28580f,null));};exports[_0x10fb('0x27')]=function(_0x5a043c,_0x3c9796){return db[_0x10fb('0x41')]['find']({'where':{'id':_0x5a043c[_0x10fb('0x40')]['id']}})['then'](handleEntityNotFound(_0x3c9796,null))[_0x10fb('0x26')](removeEntity(_0x3c9796,null))[_0x10fb('0x3f')](handleError(_0x3c9796,null));};exports[_0x10fb('0x4f')]=function(_0x1ecf9a,_0x35c59e,_0x2b2f98){return db[_0x10fb('0x41')]['find']({'where':{'id':_0x1ecf9a[_0x10fb('0x40')]['id']},'attributes':['name',_0x10fb('0x50'),_0x10fb('0x51'),'output'],'raw':!![]})[_0x10fb('0x26')](handleEntityNotFound(_0x35c59e,null))[_0x10fb('0x26')](function(_0x43ed19){if(_0x43ed19){if(!fs[_0x10fb('0x52')](path['join'](config['root'],'server/files/reports',_0x43ed19[_0x10fb('0x51')]))){throw new db[(_0x10fb('0x53'))][(_0x10fb('0x54'))](_0x10fb('0x55'));}if(_0x1ecf9a[_0x10fb('0x31')]['exists']){return _0x35c59e[_0x10fb('0x18')](0xc8);}return _0x35c59e[_0x10fb('0x4f')](path[_0x10fb('0x56')](config['root'],_0x10fb('0x57'),_0x43ed19['savename']),util['format'](_0x10fb('0x58'),_0x43ed19[_0x10fb('0x50')]||_0x43ed19[_0x10fb('0x2b')],_0x43ed19[_0x10fb('0x59')][_0x10fb('0x5a')]()));}})[_0x10fb('0x3f')](handleError(_0x35c59e,null));}; \ No newline at end of file +var _0x48af=['%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','then','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format'];(function(_0x2ada28,_0x6125b8){var _0x5187c1=function(_0x26cb63){while(--_0x26cb63){_0x2ada28['push'](_0x2ada28['shift']());}};_0x5187c1(++_0x6125b8);}(_0x48af,0x129));var _0xf48a=function(_0x4d515d,_0x108c96){_0x4d515d=_0x4d515d-0x0;var _0x58fe07=_0x48af[_0x4d515d];return _0x58fe07;};'use strict';var emlformat=require(_0xf48a('0x0'));var rimraf=require(_0xf48a('0x1'));var zipdir=require(_0xf48a('0x2'));var jsonpatch=require(_0xf48a('0x3'));var rp=require('request-promise');var moment=require(_0xf48a('0x4'));var BPromise=require(_0xf48a('0x5'));var Mustache=require('mustache');var util=require(_0xf48a('0x6'));var path=require('path');var sox=require(_0xf48a('0x7'));var csv=require(_0xf48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf48a('0x9'));var _=require(_0xf48a('0xa'));var squel=require(_0xf48a('0xb'));var crypto=require(_0xf48a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf48a('0xd'));var toCsv=require(_0xf48a('0x8'));var querystring=require(_0xf48a('0xe'));var Papa=require(_0xf48a('0xf'));var Redis=require('ioredis');var authService=require(_0xf48a('0x10'));var qs=require(_0xf48a('0x11'));var as=require(_0xf48a('0x12'));var hardwareService=require(_0xf48a('0x13'));var logger=require(_0xf48a('0x14'))(_0xf48a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf48a('0x16'));var db=require(_0xf48a('0x17'))['db'];function respondWithStatusCode(_0x3f3e1b,_0x3ba802){_0x3ba802=_0x3ba802||0xcc;return function(_0x488625){if(_0x488625){return _0x3f3e1b[_0xf48a('0x18')](_0x3ba802);}return _0x3f3e1b[_0xf48a('0x19')](_0x3ba802)[_0xf48a('0x1a')]();};}function respondWithResult(_0x32bf0d,_0x2ea357){_0x2ea357=_0x2ea357||0xc8;return function(_0x1fadbb){if(_0x1fadbb){return _0x32bf0d['status'](_0x2ea357)[_0xf48a('0x1b')](_0x1fadbb);}};}function respondWithFilteredResult(_0x1eddb1,_0x54fad1){return function(_0x129c94){if(_0x129c94){var _0x20b4d1=typeof _0x54fad1['offset']===_0xf48a('0x1c')&&typeof _0x54fad1[_0xf48a('0x1d')]===_0xf48a('0x1c');var _0x519d35=_0x129c94['count'];var _0xb53d2b=_0x20b4d1?0x0:_0x54fad1[_0xf48a('0x1e')];var _0x1b3716=_0x20b4d1?_0x129c94[_0xf48a('0x1f')]:_0x54fad1[_0xf48a('0x1e')]+_0x54fad1[_0xf48a('0x1d')];var _0x55d1fd;if(_0x1b3716>=_0x519d35){_0x1b3716=_0x519d35;_0x55d1fd=0xc8;}else{_0x55d1fd=0xce;}_0x1eddb1['status'](_0x55d1fd);return _0x1eddb1[_0xf48a('0x20')](_0xf48a('0x21'),_0xb53d2b+'-'+_0x1b3716+'/'+_0x519d35)[_0xf48a('0x1b')](_0x129c94);}return null;};}function patchUpdates(_0x13d44c){return function(_0x25846b){try{jsonpatch[_0xf48a('0x22')](_0x25846b,_0x13d44c,!![]);}catch(_0x2c402c){return BPromise['reject'](_0x2c402c);}return _0x25846b[_0xf48a('0x23')]();};}function saveUpdates(_0x2c7e3b,_0x4cc119){return function(_0x1b38f7){if(_0x1b38f7){return _0x1b38f7[_0xf48a('0x24')](_0x2c7e3b)['then'](function(_0x43346e){return _0x43346e;});}return null;};}function removeEntity(_0x4a97cb,_0x206485){return function(_0xd3fb2b){if(_0xd3fb2b){return _0xd3fb2b[_0xf48a('0x25')]()['then'](function(){var _0x11edd8=_0xd3fb2b[_0xf48a('0x26')]({'plain':!![]});var _0x778208='ExtractedReports';return db[_0xf48a('0x27')]['destroy']({'where':{'type':_0x778208,'resourceId':_0x11edd8['id']}})[_0xf48a('0x28')](function(){return _0xd3fb2b;});})[_0xf48a('0x28')](function(){_0x4a97cb[_0xf48a('0x19')](0xcc)[_0xf48a('0x1a')]();});}};}function handleEntityNotFound(_0x461235,_0x54e4a1){return function(_0x451105){if(!_0x451105){_0x461235[_0xf48a('0x18')](0x194);}return _0x451105;};}function handleError(_0x574345,_0x133252){_0x133252=_0x133252||0x1f4;return function(_0x23bc0b){logger[_0xf48a('0x29')](_0x23bc0b[_0xf48a('0x2a')]);if(_0x23bc0b[_0xf48a('0x2b')]){delete _0x23bc0b[_0xf48a('0x2b')];}_0x574345['status'](_0x133252)['send'](_0x23bc0b);};}exports[_0xf48a('0x2c')]=function(_0x49e260,_0x26f53c){var _0x3eb3ca={},_0x5a9e0d={},_0x5826c0={'count':0x0,'rows':[]};var _0x27255a=_[_0xf48a('0x2d')](db[_0xf48a('0x2e')][_0xf48a('0x2f')],function(_0x4ebc24){return{'name':_0x4ebc24[_0xf48a('0x30')],'type':_0x4ebc24[_0xf48a('0x31')][_0xf48a('0x32')]};});_0x5a9e0d[_0xf48a('0x33')]=_[_0xf48a('0x2d')](_0x27255a,'name');_0x5a9e0d[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x49e260[_0xf48a('0x34')]);_0x5a9e0d[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x5a9e0d[_0xf48a('0x33')],_0x5a9e0d[_0xf48a('0x34')]);_0x3eb3ca['attributes']=_['intersection'](_0x5a9e0d[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x49e260[_0xf48a('0x34')][_0xf48a('0x38')]));_0x3eb3ca[_0xf48a('0x39')]=_0x3eb3ca[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x3eb3ca[_0xf48a('0x39')]:_0x5a9e0d[_0xf48a('0x33')];if(!_0x49e260[_0xf48a('0x34')]['hasOwnProperty'](_0xf48a('0x3b'))){_0x3eb3ca[_0xf48a('0x1d')]=qs[_0xf48a('0x1d')](_0x49e260[_0xf48a('0x34')]['limit']);_0x3eb3ca[_0xf48a('0x1e')]=qs[_0xf48a('0x1e')](_0x49e260['query'][_0xf48a('0x1e')]);}_0x3eb3ca[_0xf48a('0x3c')]=qs[_0xf48a('0x3d')](_0x49e260[_0xf48a('0x34')]['sort']);_0x3eb3ca[_0xf48a('0x3e')]=qs[_0xf48a('0x36')](_[_0xf48a('0x3f')](_0x49e260[_0xf48a('0x34')],_0x5a9e0d[_0xf48a('0x36')]),_0x27255a);if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x40')]){_0x3eb3ca[_0xf48a('0x3e')]=_[_0xf48a('0x41')](_0x3eb3ca[_0xf48a('0x3e')],{'$or':_['map'](_0x27255a,function(_0x20cd0f){if(_0x20cd0f['type']!==_0xf48a('0x42')){var _0x177786={};_0x177786[_0x20cd0f['name']]={'$like':'%'+_0x49e260['query'][_0xf48a('0x40')]+'%'};return _0x177786;}})});}_0x3eb3ca=_[_0xf48a('0x41')]({},_0x3eb3ca,_0x49e260[_0xf48a('0x43')]);var _0x1f5c16={'where':_0x3eb3ca[_0xf48a('0x3e')]};return db['AnalyticExtractedReport'][_0xf48a('0x1f')](_0x1f5c16)['then'](function(_0x3da1ef){_0x5826c0[_0xf48a('0x1f')]=_0x3da1ef;if(_0x49e260[_0xf48a('0x34')][_0xf48a('0x44')]){_0x3eb3ca[_0xf48a('0x45')]=[{'all':!![]}];}return db[_0xf48a('0x2e')][_0xf48a('0x46')](_0x3eb3ca);})['then'](function(_0x4262a6){_0x5826c0['rows']=_0x4262a6;return _0x5826c0;})['then'](respondWithFilteredResult(_0x26f53c,_0x3eb3ca))['catch'](handleError(_0x26f53c,null));};exports[_0xf48a('0x47')]=function(_0x353310,_0x1460ae){var _0x5503ec={'raw':!![],'where':{'id':_0x353310[_0xf48a('0x48')]['id']}},_0x2da097={};_0x2da097[_0xf48a('0x33')]=_[_0xf48a('0x35')](db[_0xf48a('0x2e')][_0xf48a('0x2f')]);_0x2da097[_0xf48a('0x34')]=_[_0xf48a('0x35')](_0x353310[_0xf48a('0x34')]);_0x2da097[_0xf48a('0x36')]=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],_0x2da097[_0xf48a('0x34')]);_0x5503ec['attributes']=_[_0xf48a('0x37')](_0x2da097[_0xf48a('0x33')],qs[_0xf48a('0x38')](_0x353310[_0xf48a('0x34')][_0xf48a('0x38')]));_0x5503ec['attributes']=_0x5503ec[_0xf48a('0x39')][_0xf48a('0x3a')]?_0x5503ec[_0xf48a('0x39')]:_0x2da097[_0xf48a('0x33')];if(_0x353310['query'][_0xf48a('0x44')]){_0x5503ec[_0xf48a('0x45')]=[{'all':!![]}];}_0x5503ec=_[_0xf48a('0x41')]({},_0x5503ec,_0x353310[_0xf48a('0x43')]);return db[_0xf48a('0x2e')]['find'](_0x5503ec)[_0xf48a('0x28')](handleEntityNotFound(_0x1460ae,null))['then'](respondWithResult(_0x1460ae,null))[_0xf48a('0x49')](handleError(_0x1460ae,null));};exports[_0xf48a('0x4a')]=function(_0x5f0d9a,_0x39b3c3){return db[_0xf48a('0x2e')][_0xf48a('0x4a')](_0x5f0d9a[_0xf48a('0x4b')],{})[_0xf48a('0x28')](function(_0x3d2f44){var _0x23a7b4=_0x5f0d9a[_0xf48a('0x4c')]['get']({'plain':!![]});if(!_0x23a7b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23a7b4[_0xf48a('0x4d')]===_0xf48a('0x4c')){var _0x308666=_0x3d2f44[_0xf48a('0x26')]({'plain':!![]});var _0x3a617e=_0xf48a('0x4e');return db[_0xf48a('0x4f')][_0xf48a('0x50')]({'where':{'name':_0x3a617e,'userProfileId':_0x23a7b4[_0xf48a('0x51')]},'raw':!![]})[_0xf48a('0x28')](function(_0x3a2124){if(_0x3a2124&&_0x3a2124[_0xf48a('0x52')]===0x0){return db[_0xf48a('0x27')][_0xf48a('0x4a')]({'name':_0x308666['name'],'resourceId':_0x308666['id'],'type':_0x3a2124[_0xf48a('0x2b')],'sectionId':_0x3a2124['id']},{})[_0xf48a('0x28')](function(){return _0x3d2f44;});}else{return _0x3d2f44;}})['catch'](function(_0x480c17){logger[_0xf48a('0x29')](_0xf48a('0x53'),_0x480c17);throw _0x480c17;});}return _0x3d2f44;})['then'](respondWithResult(_0x39b3c3,0xc9))['catch'](handleError(_0x39b3c3,null));};exports['update']=function(_0x5d858a,_0x3c47e0){if(_0x5d858a['body']['id']){delete _0x5d858a[_0xf48a('0x4b')]['id'];}return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x5d858a['params']['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0x3c47e0,null))[_0xf48a('0x28')](saveUpdates(_0x5d858a['body'],null))[_0xf48a('0x28')](respondWithResult(_0x3c47e0,null))[_0xf48a('0x49')](handleError(_0x3c47e0,null));};exports[_0xf48a('0x25')]=function(_0x35bbaa,_0xb37a08){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x35bbaa[_0xf48a('0x48')]['id']}})[_0xf48a('0x28')](handleEntityNotFound(_0xb37a08,null))[_0xf48a('0x28')](removeEntity(_0xb37a08,null))[_0xf48a('0x49')](handleError(_0xb37a08,null));};exports['download']=function(_0x855549,_0x4e0f68,_0xf35d85){return db[_0xf48a('0x2e')][_0xf48a('0x50')]({'where':{'id':_0x855549[_0xf48a('0x48')]['id']},'attributes':[_0xf48a('0x2b'),'basename',_0xf48a('0x54'),_0xf48a('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x4e0f68,null))['then'](function(_0x39a764){if(_0x39a764){if(!fs[_0xf48a('0x56')](path[_0xf48a('0x57')](config[_0xf48a('0x58')],_0xf48a('0x59'),_0x39a764[_0xf48a('0x54')]))){throw new db[(_0xf48a('0x5a'))][(_0xf48a('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x855549[_0xf48a('0x34')][_0xf48a('0x5c')]){return _0x4e0f68[_0xf48a('0x18')](0xc8);}return _0x4e0f68[_0xf48a('0x5d')](path[_0xf48a('0x57')](config['root'],'server/files/reports',_0x39a764[_0xf48a('0x54')]),util[_0xf48a('0x5e')](_0xf48a('0x5f'),_0x39a764[_0xf48a('0x60')]||_0x39a764['name'],_0x39a764[_0xf48a('0x55')][_0xf48a('0x61')]()));}})[_0xf48a('0x49')](handleError(_0x4e0f68,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index eb869bb..363dda8 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 _0x5aba=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x3ce633,_0x431721){var _0xb00c0a=function(_0x2f3180){while(--_0x2f3180){_0x3ce633['push'](_0x3ce633['shift']());}};_0xb00c0a(++_0x431721);}(_0x5aba,0x1d1));var _0xa5ab=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x5aba[_0x616290];return _0x453879;};'use strict';var _=require(_0xa5ab('0x0'));var util=require(_0xa5ab('0x1'));var logger=require(_0xa5ab('0x2'))('api');var moment=require(_0xa5ab('0x3'));var BPromise=require(_0xa5ab('0x4'));var rp=require(_0xa5ab('0x5'));var fs=require('fs');var path=require(_0xa5ab('0x6'));var rimraf=require(_0xa5ab('0x7'));var config=require(_0xa5ab('0x8'));var attributes=require(_0xa5ab('0x9'));module[_0xa5ab('0xa')]=function(_0x112859,_0xda789d){return _0x112859[_0xa5ab('0xb')](_0xa5ab('0xc'),attributes,{'tableName':_0xa5ab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c09=['define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x1ec3fa,_0x3e9940){var _0x349bee=function(_0x539e67){while(--_0x539e67){_0x1ec3fa['push'](_0x1ec3fa['shift']());}};_0x349bee(++_0x3e9940);}(_0x5c09,0x6a));var _0x95c0=function(_0x453c56,_0x14b10d){_0x453c56=_0x453c56-0x0;var _0x3a114d=_0x5c09[_0x453c56];return _0x3a114d;};'use strict';var _=require(_0x95c0('0x0'));var util=require(_0x95c0('0x1'));var logger=require(_0x95c0('0x2'))('api');var moment=require(_0x95c0('0x3'));var BPromise=require(_0x95c0('0x4'));var rp=require(_0x95c0('0x5'));var fs=require('fs');var path=require(_0x95c0('0x6'));var rimraf=require(_0x95c0('0x7'));var config=require(_0x95c0('0x8'));var attributes=require(_0x95c0('0x9'));module[_0x95c0('0xa')]=function(_0x22df75,_0x133672){return _0x22df75[_0x95c0('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x95c0('0xc'),'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 dec33dc..34a173a 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 _0xc35d=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x103e39,_0x7db66){var _0x3e95c3=function(_0x10b2af){while(--_0x10b2af){_0x103e39['push'](_0x103e39['shift']());}};_0x3e95c3(++_0x7db66);}(_0xc35d,0x12e));var _0xdc35=function(_0x26a53e,_0x1b83f5){_0x26a53e=_0x26a53e-0x0;var _0x328de0=_0xc35d[_0x26a53e];return _0x328de0;};'use strict';var _=require(_0xdc35('0x0'));var util=require(_0xdc35('0x1'));var moment=require(_0xdc35('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc35('0x4'))['db'];var utils=require(_0xdc35('0x5'));var logger=require('../../config/logger')(_0xdc35('0x6'));var config=require(_0xdc35('0x7'));var jayson=require(_0xdc35('0x8'));var client=jayson['client'][_0xdc35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23cdff,_0x1aeb54,_0x56583c){return new BPromise(function(_0xe4b441,_0x1bb16d){return client[_0xdc35('0xa')](_0x23cdff,_0x56583c)['then'](function(_0x1e9d54){logger[_0xdc35('0xb')](_0xdc35('0xc'),_0x1aeb54,_0xdc35('0xd'));logger['debug'](_0xdc35('0xe'),_0x1aeb54,_0xdc35('0xd'),JSON[_0xdc35('0xf')](_0x1e9d54));if(_0x1e9d54[_0xdc35('0x10')]){if(_0x1e9d54['error'][_0xdc35('0x11')]===0x1f4){logger['error'](_0xdc35('0xc'),_0x1aeb54,_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);return _0x1bb16d(_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);}logger[_0xdc35('0x10')](_0xdc35('0xc'),_0x1aeb54,_0x1e9d54['error'][_0xdc35('0x12')]);return _0xe4b441(_0x1e9d54[_0xdc35('0x10')][_0xdc35('0x12')]);}else{logger['info'](_0xdc35('0xc'),_0x1aeb54,_0xdc35('0xd'));_0xe4b441(_0x1e9d54['result'][_0xdc35('0x12')]);}})[_0xdc35('0x13')](function(_0x43b3b3){logger[_0xdc35('0x10')](_0xdc35('0xc'),_0x1aeb54,_0x43b3b3);_0x1bb16d(_0x43b3b3);});});} \ No newline at end of file +var _0x90db=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a5f54,_0x42b4fa){var _0x13f830=function(_0x17c2fb){while(--_0x17c2fb){_0x1a5f54['push'](_0x1a5f54['shift']());}};_0x13f830(++_0x42b4fa);}(_0x90db,0x179));var _0xb90d=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x90db[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xb90d('0x0'));var util=require(_0xb90d('0x1'));var moment=require(_0xb90d('0x2'));var BPromise=require(_0xb90d('0x3'));var rs=require(_0xb90d('0x4'));var fs=require('fs');var Redis=require(_0xb90d('0x5'));var db=require(_0xb90d('0x6'))['db'];var utils=require(_0xb90d('0x7'));var logger=require(_0xb90d('0x8'))('rpc');var config=require(_0xb90d('0x9'));var jayson=require(_0xb90d('0xa'));var client=jayson[_0xb90d('0xb')][_0xb90d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46fd49,_0x1b3e51,_0x4d3d15){return new BPromise(function(_0x41a338,_0x38e12c){return client[_0xb90d('0xd')](_0x46fd49,_0x4d3d15)['then'](function(_0x242743){logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));logger['debug'](_0xb90d('0x11'),_0x1b3e51,_0xb90d('0x10'),JSON[_0xb90d('0x12')](_0x242743));if(_0x242743['error']){if(_0x242743[_0xb90d('0x13')][_0xb90d('0x14')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x38e12c(_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x242743[_0xb90d('0x13')][_0xb90d('0x15')]);return _0x41a338(_0x242743['error'][_0xb90d('0x15')]);}else{logger[_0xb90d('0xe')](_0xb90d('0xf'),_0x1b3e51,_0xb90d('0x10'));_0x41a338(_0x242743[_0xb90d('0x16')][_0xb90d('0x15')]);}})[_0xb90d('0x17')](function(_0x5c664d){logger[_0xb90d('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1b3e51,_0x5c664d);_0x38e12c(_0x5c664d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b4244b7..208ba0e 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 _0xbb8b=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','delete'];(function(_0x33c74d,_0x122066){var _0x47d4f0=function(_0x5ea937){while(--_0x5ea937){_0x33c74d['push'](_0x33c74d['shift']());}};_0x47d4f0(++_0x122066);}(_0xbb8b,0x151));var _0xbbb8=function(_0x3b02b7,_0xd2a9f0){_0x3b02b7=_0x3b02b7-0x0;var _0x5cf8d8=_0xbb8b[_0x3b02b7];return _0x5cf8d8;};'use strict';var multer=require(_0xbbb8('0x0'));var util=require(_0xbbb8('0x1'));var path=require(_0xbbb8('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbb8('0x3'));var router=express[_0xbbb8('0x4')]();var fs_extra=require(_0xbbb8('0x5'));var auth=require(_0xbbb8('0x6'));var interaction=require(_0xbbb8('0x7'));var config=require(_0xbbb8('0x8'));var controller=require(_0xbbb8('0x9'));router[_0xbbb8('0xa')]('/',auth[_0xbbb8('0xb')](),controller[_0xbbb8('0xc')]);router[_0xbbb8('0xa')]('/:id',auth[_0xbbb8('0xb')](),controller['show']);router[_0xbbb8('0xa')](_0xbbb8('0xd'),auth[_0xbbb8('0xb')](),controller[_0xbbb8('0xe')]);router[_0xbbb8('0xf')]('/',auth[_0xbbb8('0xb')](),controller[_0xbbb8('0x10')]);router[_0xbbb8('0x11')](_0xbbb8('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xbbb8('0x13')](_0xbbb8('0x12'),auth[_0xbbb8('0xb')](),controller['destroy']);module[_0xbbb8('0x14')]=router; \ No newline at end of file +var _0x65ca=['../../components/auth/service','../../components/interaction/service','get','index','show','isAuthenticated','download','post','create','put','delete','/:id','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x41ffbb,_0x3ed4a9){var _0x2dc5fd=function(_0x35cf91){while(--_0x35cf91){_0x41ffbb['push'](_0x41ffbb['shift']());}};_0x2dc5fd(++_0x3ed4a9);}(_0x65ca,0xb9));var _0xa65c=function(_0x3ed26c,_0xab6b81){_0x3ed26c=_0x3ed26c-0x0;var _0x20074a=_0x65ca[_0x3ed26c];return _0x20074a;};'use strict';var multer=require(_0xa65c('0x0'));var util=require(_0xa65c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa65c('0x2'));var router=express[_0xa65c('0x3')]();var fs_extra=require(_0xa65c('0x4'));var auth=require(_0xa65c('0x5'));var interaction=require(_0xa65c('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xa65c('0x7')]('/',auth['isAuthenticated'](),controller[_0xa65c('0x8')]);router[_0xa65c('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xa65c('0x9')]);router[_0xa65c('0x7')]('/:id/download',auth[_0xa65c('0xa')](),controller[_0xa65c('0xb')]);router[_0xa65c('0xc')]('/',auth[_0xa65c('0xa')](),controller[_0xa65c('0xd')]);router[_0xa65c('0xe')]('/:id',auth[_0xa65c('0xa')](),controller['update']);router[_0xa65c('0xf')](_0xa65c('0x10'),auth[_0xa65c('0xa')](),controller[_0xa65c('0x11')]);module[_0xa65c('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index ee208e2..e86381b 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 _0xa09f=['STRING','BOOLEAN','exports','TEXT'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xa09f,0xc6));var _0xfa09=function(_0x4c6860,_0x4e0bdd){_0x4c6860=_0x4c6860-0x0;var _0x33bd13=_0xa09f[_0x4c6860];return _0x33bd13;};'use strict';var Sequelize=require('sequelize');module[_0xfa09('0x0')]={'field':{'type':Sequelize[_0xfa09('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xfa09('0x2')]},'groupBy':{'type':Sequelize[_0xfa09('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfa09('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3b74=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2e2555,_0x3b1ad5){var _0x13dec4=function(_0x1f7f6c){while(--_0x1f7f6c){_0x2e2555['push'](_0x2e2555['shift']());}};_0x13dec4(++_0x3b1ad5);}(_0x3b74,0xd1));var _0x43b7=function(_0x1804e0,_0x3e69b7){_0x1804e0=_0x1804e0-0x0;var _0x29b36b=_0x3b74[_0x1804e0];return _0x29b36b;};'use strict';var Sequelize=require(_0x43b7('0x0'));module[_0x43b7('0x1')]={'field':{'type':Sequelize[_0x43b7('0x2')]},'alias':{'type':Sequelize[_0x43b7('0x3')]},'function':{'type':Sequelize[_0x43b7('0x3')]},'format':{'type':Sequelize[_0x43b7('0x3')]},'groupBy':{'type':Sequelize[_0x43b7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x43b7('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 1376047..6e5fb7a 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 _0x727a=['count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x727a,0x125));var _0xa727=function(_0x49f3ea,_0x399a85){_0x49f3ea=_0x49f3ea-0x0;var _0x3ca709=_0x727a[_0x49f3ea];return _0x3ca709;};'use strict';var emlformat=require(_0xa727('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa727('0x1'));var rp=require(_0xa727('0x2'));var moment=require(_0xa727('0x3'));var BPromise=require(_0xa727('0x4'));var Mustache=require('mustache');var util=require(_0xa727('0x5'));var path=require(_0xa727('0x6'));var sox=require(_0xa727('0x7'));var csv=require(_0xa727('0x8'));var ejs=require(_0xa727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa727('0xa'));var crypto=require(_0xa727('0xb'));var jsforce=require(_0xa727('0xc'));var deskjs=require(_0xa727('0xd'));var toCsv=require(_0xa727('0x8'));var querystring=require(_0xa727('0xe'));var Papa=require('papaparse');var Redis=require(_0xa727('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa727('0x10'));var as=require(_0xa727('0x11'));var hardwareService=require(_0xa727('0x12'));var logger=require(_0xa727('0x13'))(_0xa727('0x14'));var utils=require(_0xa727('0x15'));var config=require(_0xa727('0x16'));var licenseUtil=require(_0xa727('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358c30,_0x545da9){_0x545da9=_0x545da9||0xcc;return function(_0x37dac2){if(_0x37dac2){return _0x358c30[_0xa727('0x18')](_0x545da9);}return _0x358c30[_0xa727('0x19')](_0x545da9)[_0xa727('0x1a')]();};}function respondWithResult(_0xcb74e6,_0x47033f){_0x47033f=_0x47033f||0xc8;return function(_0x16362f){if(_0x16362f){return _0xcb74e6['status'](_0x47033f)[_0xa727('0x1b')](_0x16362f);}};}function respondWithFilteredResult(_0x5cee96,_0x21dba0){return function(_0x5369f6){if(_0x5369f6){var _0x35b531=typeof _0x21dba0[_0xa727('0x1c')]==='undefined'&&typeof _0x21dba0[_0xa727('0x1d')]===_0xa727('0x1e');var _0x44bb42=_0x5369f6['count'];var _0x418886=_0x35b531?0x0:_0x21dba0[_0xa727('0x1c')];var _0x5ad5c8=_0x35b531?_0x5369f6[_0xa727('0x1f')]:_0x21dba0[_0xa727('0x1c')]+_0x21dba0['limit'];var _0x1d48c1;if(_0x5ad5c8>=_0x44bb42){_0x5ad5c8=_0x44bb42;_0x1d48c1=0xc8;}else{_0x1d48c1=0xce;}_0x5cee96[_0xa727('0x19')](_0x1d48c1);return _0x5cee96[_0xa727('0x20')](_0xa727('0x21'),_0x418886+'-'+_0x5ad5c8+'/'+_0x44bb42)[_0xa727('0x1b')](_0x5369f6);}return null;};}function patchUpdates(_0x477904){return function(_0x45d4f7){try{jsonpatch[_0xa727('0x22')](_0x45d4f7,_0x477904,!![]);}catch(_0x53c921){return BPromise[_0xa727('0x23')](_0x53c921);}return _0x45d4f7[_0xa727('0x24')]();};}function saveUpdates(_0x3ba2da,_0x222eb2){return function(_0x137a51){if(_0x137a51){return _0x137a51['update'](_0x3ba2da)[_0xa727('0x25')](function(_0x2a84f8){return _0x2a84f8;});}return null;};}function removeEntity(_0x449850,_0x2ef050){return function(_0x345bd2){if(_0x345bd2){return _0x345bd2[_0xa727('0x26')]()[_0xa727('0x25')](function(){_0x449850[_0xa727('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b917e,_0x4677e1){return function(_0xaabc38){if(!_0xaabc38){_0x5b917e['sendStatus'](0x194);}return _0xaabc38;};}function handleError(_0x140b05,_0x2c10e){_0x2c10e=_0x2c10e||0x1f4;return function(_0x4cedd6){logger['error'](_0x4cedd6[_0xa727('0x27')]);if(_0x4cedd6[_0xa727('0x28')]){delete _0x4cedd6[_0xa727('0x28')];}_0x140b05[_0xa727('0x19')](_0x2c10e)[_0xa727('0x29')](_0x4cedd6);};}exports[_0xa727('0x2a')]=function(_0x31b085,_0x43c008){var _0x31b43f={},_0x5efed3={},_0x2fdc93={'count':0x0,'rows':[]};var _0x43739a=_[_0xa727('0x2b')](db['AnalyticFieldReport']['rawAttributes'],function(_0x4e3253){return{'name':_0x4e3253[_0xa727('0x2c')],'type':_0x4e3253['type']['key']};});_0x5efed3[_0xa727('0x2d')]=_['map'](_0x43739a,'name');_0x5efed3[_0xa727('0x2e')]=_[_0xa727('0x2f')](_0x31b085['query']);_0x5efed3[_0xa727('0x30')]=_['intersection'](_0x5efed3[_0xa727('0x2d')],_0x5efed3[_0xa727('0x2e')]);_0x31b43f[_0xa727('0x31')]=_[_0xa727('0x32')](_0x5efed3['model'],qs['fields'](_0x31b085['query']['fields']));_0x31b43f[_0xa727('0x31')]=_0x31b43f['attributes'][_0xa727('0x33')]?_0x31b43f[_0xa727('0x31')]:_0x5efed3['model'];if(!_0x31b085[_0xa727('0x2e')]['hasOwnProperty'](_0xa727('0x34'))){_0x31b43f['limit']=qs['limit'](_0x31b085[_0xa727('0x2e')][_0xa727('0x1d')]);_0x31b43f[_0xa727('0x1c')]=qs[_0xa727('0x1c')](_0x31b085['query']['offset']);}_0x31b43f[_0xa727('0x35')]=qs[_0xa727('0x36')](_0x31b085[_0xa727('0x2e')][_0xa727('0x36')]);_0x31b43f['where']=qs['filters'](_[_0xa727('0x37')](_0x31b085[_0xa727('0x2e')],_0x5efed3[_0xa727('0x30')]),_0x43739a);if(_0x31b085['query'][_0xa727('0x38')]){_0x31b43f[_0xa727('0x39')]=_['merge'](_0x31b43f[_0xa727('0x39')],{'$or':_[_0xa727('0x2b')](_0x43739a,function(_0x5e270c){if(_0x5e270c[_0xa727('0x3a')]!==_0xa727('0x3b')){var _0x472e49={};_0x472e49[_0x5e270c['name']]={'$like':'%'+_0x31b085[_0xa727('0x2e')][_0xa727('0x38')]+'%'};return _0x472e49;}})});}_0x31b43f=_[_0xa727('0x3c')]({},_0x31b43f,_0x31b085[_0xa727('0x3d')]);var _0x34e20e={'where':_0x31b43f[_0xa727('0x39')]};return db[_0xa727('0x3e')][_0xa727('0x1f')](_0x34e20e)[_0xa727('0x25')](function(_0xcc0161){_0x2fdc93[_0xa727('0x1f')]=_0xcc0161;if(_0x31b085[_0xa727('0x2e')][_0xa727('0x3f')]){_0x31b43f[_0xa727('0x40')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xa727('0x41')](_0x31b43f);})['then'](function(_0x4daa8d){_0x2fdc93[_0xa727('0x42')]=_0x4daa8d;return _0x2fdc93;})['then'](respondWithFilteredResult(_0x43c008,_0x31b43f))[_0xa727('0x43')](handleError(_0x43c008,null));};exports[_0xa727('0x44')]=function(_0x5e72d9,_0x32e065){var _0x39539f={'raw':![],'where':{'id':_0x5e72d9[_0xa727('0x45')]['id']}},_0x142af={};_0x142af[_0xa727('0x2d')]=_[_0xa727('0x2f')](db[_0xa727('0x3e')]['rawAttributes']);_0x142af[_0xa727('0x2e')]=_[_0xa727('0x2f')](_0x5e72d9['query']);_0x142af['filters']=_['intersection'](_0x142af[_0xa727('0x2d')],_0x142af[_0xa727('0x2e')]);_0x39539f[_0xa727('0x31')]=_[_0xa727('0x32')](_0x142af['model'],qs['fields'](_0x5e72d9[_0xa727('0x2e')][_0xa727('0x46')]));_0x39539f['attributes']=_0x39539f['attributes'][_0xa727('0x33')]?_0x39539f[_0xa727('0x31')]:_0x142af[_0xa727('0x2d')];if(_0x5e72d9[_0xa727('0x2e')][_0xa727('0x3f')]){_0x39539f[_0xa727('0x40')]=[{'all':!![]}];}_0x39539f=_[_0xa727('0x3c')]({},_0x39539f,_0x5e72d9['options']);return db['AnalyticFieldReport'][_0xa727('0x47')](_0x39539f)[_0xa727('0x25')](handleEntityNotFound(_0x32e065,null))[_0xa727('0x25')](respondWithResult(_0x32e065,null))[_0xa727('0x43')](handleError(_0x32e065,null));};exports['create']=function(_0x4f2905,_0x5bb4c1){return db['AnalyticFieldReport'][_0xa727('0x48')](_0x4f2905[_0xa727('0x49')],{})[_0xa727('0x25')](respondWithResult(_0x5bb4c1,0xc9))[_0xa727('0x43')](handleError(_0x5bb4c1,null));};exports['bulkCreate']=function(_0x5b122b,_0x13902a){return db[_0xa727('0x3e')][_0xa727('0x4a')](_0x5b122b['body'],{'raw':![],'individualHooks':!![]})[_0xa727('0x25')](respondWithResult(_0x13902a,0xc9))['catch'](handleError(_0x13902a,null));};exports['update']=function(_0x2de6ba,_0x4b3156){if(_0x2de6ba[_0xa727('0x49')]['id']){delete _0x2de6ba[_0xa727('0x49')]['id'];}return db[_0xa727('0x3e')][_0xa727('0x47')]({'where':{'id':_0x2de6ba[_0xa727('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b3156,null))['then'](saveUpdates(_0x2de6ba[_0xa727('0x49')],null))[_0xa727('0x25')](respondWithResult(_0x4b3156,null))[_0xa727('0x43')](handleError(_0x4b3156,null));};exports[_0xa727('0x26')]=function(_0x20b2f3,_0x850b){return db['AnalyticFieldReport'][_0xa727('0x47')]({'where':{'id':_0x20b2f3[_0xa727('0x45')]['id']}})[_0xa727('0x25')](handleEntityNotFound(_0x850b,null))['then'](removeEntity(_0x850b,null))[_0xa727('0x43')](handleError(_0x850b,null));};exports[_0xa727('0x4b')]=function(_0x5f0579,_0xa4e249){return db['AnalyticFieldReport'][_0xa727('0x26')]({'where':{'id':_0x5f0579[_0xa727('0x2e')][_0xa727('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xa727('0x25')](respondWithResult(_0xa4e249,0xcc))[_0xa727('0x43')](handleError(_0xa4e249,null));};exports[_0xa727('0x4d')]=function(_0x2ee65d,_0x890653,_0x3ad6b6){return db[_0xa727('0x4e')]['findOne']({'where':{'id':_0x2ee65d[_0xa727('0x45')]['id']}})[_0xa727('0x25')](handleEntityNotFound(_0x890653,null))[_0xa727('0x25')](function(_0x56a5ce){if(_0x56a5ce){return db[_0xa727('0x4f')][_0xa727('0x50')](function(_0x552af5){return db[_0xa727('0x3e')][_0xa727('0x26')]({'where':{'CustomReportId':_0x2ee65d[_0xa727('0x45')]['id']},'transaction':_0x552af5})['then'](function(_0xddde91){var _0x4cf23a=_[_0xa727('0x2b')](_0x2ee65d[_0xa727('0x49')],function(_0x516b0d){delete _0x516b0d['id'];_0x516b0d['CustomReportId']=_0x2ee65d[_0xa727('0x45')]['id'];return _0x516b0d;});return db[_0xa727('0x3e')][_0xa727('0x4a')](_0x4cf23a,{'transaction':_0x552af5});});})['then'](function(){return db[_0xa727('0x3e')]['findAll']({'where':{'CustomReportId':_0x2ee65d['params']['id']}});});}})[_0xa727('0x25')](respondWithResult(_0x890653,null))[_0xa727('0x43')](handleError(_0x890653,null));}; \ No newline at end of file +var _0xc485=['nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','create','body','bulkCreate','find','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','status','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0xc485,0x105));var _0x5c48=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0xc485[_0xdb628e];return _0x493aa5;};'use strict';var emlformat=require(_0x5c48('0x0'));var rimraf=require(_0x5c48('0x1'));var zipdir=require(_0x5c48('0x2'));var jsonpatch=require(_0x5c48('0x3'));var rp=require(_0x5c48('0x4'));var moment=require(_0x5c48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c48('0x6'));var util=require(_0x5c48('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c48('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c48('0x9'));var jsforce=require(_0x5c48('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x5c48('0xb'));var querystring=require(_0x5c48('0xc'));var Papa=require(_0x5c48('0xd'));var Redis=require('ioredis');var authService=require(_0x5c48('0xe'));var qs=require(_0x5c48('0xf'));var as=require(_0x5c48('0x10'));var hardwareService=require(_0x5c48('0x11'));var logger=require(_0x5c48('0x12'))(_0x5c48('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c48('0x14'));var db=require(_0x5c48('0x15'))['db'];function respondWithStatusCode(_0x427684,_0x37f8d9){_0x37f8d9=_0x37f8d9||0xcc;return function(_0x3df1d1){if(_0x3df1d1){return _0x427684[_0x5c48('0x16')](_0x37f8d9);}return _0x427684['status'](_0x37f8d9)['end']();};}function respondWithResult(_0x36cb51,_0x1c116e){_0x1c116e=_0x1c116e||0xc8;return function(_0x1e93bc){if(_0x1e93bc){return _0x36cb51['status'](_0x1c116e)[_0x5c48('0x17')](_0x1e93bc);}};}function respondWithFilteredResult(_0x3dda19,_0x36371b){return function(_0x19dc50){if(_0x19dc50){var _0x17a784=typeof _0x36371b[_0x5c48('0x18')]==='undefined'&&typeof _0x36371b[_0x5c48('0x19')]===_0x5c48('0x1a');var _0x12c781=_0x19dc50[_0x5c48('0x1b')];var _0x1b1877=_0x17a784?0x0:_0x36371b[_0x5c48('0x18')];var _0x4f57dc=_0x17a784?_0x19dc50['count']:_0x36371b[_0x5c48('0x18')]+_0x36371b['limit'];var _0x1f1c9a;if(_0x4f57dc>=_0x12c781){_0x4f57dc=_0x12c781;_0x1f1c9a=0xc8;}else{_0x1f1c9a=0xce;}_0x3dda19['status'](_0x1f1c9a);return _0x3dda19['set'](_0x5c48('0x1c'),_0x1b1877+'-'+_0x4f57dc+'/'+_0x12c781)['json'](_0x19dc50);}return null;};}function patchUpdates(_0x3a7975){return function(_0x2adb1d){try{jsonpatch[_0x5c48('0x1d')](_0x2adb1d,_0x3a7975,!![]);}catch(_0xc28b4c){return BPromise[_0x5c48('0x1e')](_0xc28b4c);}return _0x2adb1d[_0x5c48('0x1f')]();};}function saveUpdates(_0x5eb373,_0x175fa7){return function(_0x28c09b){if(_0x28c09b){return _0x28c09b[_0x5c48('0x20')](_0x5eb373)[_0x5c48('0x21')](function(_0x36bc86){return _0x36bc86;});}return null;};}function removeEntity(_0x63c5b1,_0x37c5eb){return function(_0x237380){if(_0x237380){return _0x237380[_0x5c48('0x22')]()[_0x5c48('0x21')](function(){_0x63c5b1[_0x5c48('0x23')](0xcc)[_0x5c48('0x24')]();});}};}function handleEntityNotFound(_0x1c2474,_0x18e2fe){return function(_0x468e49){if(!_0x468e49){_0x1c2474[_0x5c48('0x16')](0x194);}return _0x468e49;};}function handleError(_0x47b309,_0x72662c){_0x72662c=_0x72662c||0x1f4;return function(_0x1ad680){logger[_0x5c48('0x25')](_0x1ad680[_0x5c48('0x26')]);if(_0x1ad680[_0x5c48('0x27')]){delete _0x1ad680[_0x5c48('0x27')];}_0x47b309[_0x5c48('0x23')](_0x72662c)[_0x5c48('0x28')](_0x1ad680);};}exports[_0x5c48('0x29')]=function(_0x2391d8,_0x16f33b){var _0x7c1e9c={},_0x4d1623={},_0x5a5bf7={'count':0x0,'rows':[]};var _0x2c3131=_[_0x5c48('0x2a')](db[_0x5c48('0x2b')][_0x5c48('0x2c')],function(_0x4ec341){return{'name':_0x4ec341[_0x5c48('0x2d')],'type':_0x4ec341[_0x5c48('0x2e')][_0x5c48('0x2f')]};});_0x4d1623['model']=_[_0x5c48('0x2a')](_0x2c3131,_0x5c48('0x27'));_0x4d1623[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x2391d8[_0x5c48('0x30')]);_0x4d1623[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],_0x4d1623[_0x5c48('0x30')]);_0x7c1e9c[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x4d1623[_0x5c48('0x34')],qs[_0x5c48('0x36')](_0x2391d8['query']['fields']));_0x7c1e9c[_0x5c48('0x35')]=_0x7c1e9c[_0x5c48('0x35')]['length']?_0x7c1e9c[_0x5c48('0x35')]:_0x4d1623[_0x5c48('0x34')];if(!_0x2391d8[_0x5c48('0x30')]['hasOwnProperty'](_0x5c48('0x37'))){_0x7c1e9c[_0x5c48('0x19')]=qs['limit'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x19')]);_0x7c1e9c['offset']=qs['offset'](_0x2391d8[_0x5c48('0x30')][_0x5c48('0x18')]);}_0x7c1e9c['order']=qs[_0x5c48('0x38')](_0x2391d8[_0x5c48('0x30')]['sort']);_0x7c1e9c['where']=qs[_0x5c48('0x32')](_[_0x5c48('0x39')](_0x2391d8[_0x5c48('0x30')],_0x4d1623['filters']),_0x2c3131);if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]){_0x7c1e9c[_0x5c48('0x3b')]=_['merge'](_0x7c1e9c['where'],{'$or':_[_0x5c48('0x2a')](_0x2c3131,function(_0x22faaa){if(_0x22faaa[_0x5c48('0x2e')]!=='VIRTUAL'){var _0x43bdac={};_0x43bdac[_0x22faaa['name']]={'$like':'%'+_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3a')]+'%'};return _0x43bdac;}})});}_0x7c1e9c=_[_0x5c48('0x3c')]({},_0x7c1e9c,_0x2391d8[_0x5c48('0x3d')]);var _0xe36d2b={'where':_0x7c1e9c[_0x5c48('0x3b')]};return db[_0x5c48('0x2b')][_0x5c48('0x1b')](_0xe36d2b)[_0x5c48('0x21')](function(_0x18b3b1){_0x5a5bf7['count']=_0x18b3b1;if(_0x2391d8[_0x5c48('0x30')][_0x5c48('0x3e')]){_0x7c1e9c[_0x5c48('0x3f')]=[{'all':!![]}];}return db[_0x5c48('0x2b')][_0x5c48('0x40')](_0x7c1e9c);})[_0x5c48('0x21')](function(_0x35cf29){_0x5a5bf7[_0x5c48('0x41')]=_0x35cf29;return _0x5a5bf7;})[_0x5c48('0x21')](respondWithFilteredResult(_0x16f33b,_0x7c1e9c))[_0x5c48('0x42')](handleError(_0x16f33b,null));};exports['show']=function(_0x14036a,_0x5b8a6d){var _0x129860={'raw':![],'where':{'id':_0x14036a['params']['id']}},_0x20bc00={};_0x20bc00[_0x5c48('0x34')]=_[_0x5c48('0x31')](db['AnalyticFieldReport'][_0x5c48('0x2c')]);_0x20bc00[_0x5c48('0x30')]=_[_0x5c48('0x31')](_0x14036a[_0x5c48('0x30')]);_0x20bc00[_0x5c48('0x32')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],_0x20bc00[_0x5c48('0x30')]);_0x129860[_0x5c48('0x35')]=_[_0x5c48('0x33')](_0x20bc00[_0x5c48('0x34')],qs['fields'](_0x14036a[_0x5c48('0x30')][_0x5c48('0x36')]));_0x129860[_0x5c48('0x35')]=_0x129860[_0x5c48('0x35')]['length']?_0x129860[_0x5c48('0x35')]:_0x20bc00['model'];if(_0x14036a['query']['includeAll']){_0x129860[_0x5c48('0x3f')]=[{'all':!![]}];}_0x129860=_[_0x5c48('0x3c')]({},_0x129860,_0x14036a[_0x5c48('0x3d')]);return db[_0x5c48('0x2b')]['find'](_0x129860)[_0x5c48('0x21')](handleEntityNotFound(_0x5b8a6d,null))[_0x5c48('0x21')](respondWithResult(_0x5b8a6d,null))[_0x5c48('0x42')](handleError(_0x5b8a6d,null));};exports[_0x5c48('0x43')]=function(_0x4e0380,_0x5f1de4){return db[_0x5c48('0x2b')][_0x5c48('0x43')](_0x4e0380[_0x5c48('0x44')],{})[_0x5c48('0x21')](respondWithResult(_0x5f1de4,0xc9))[_0x5c48('0x42')](handleError(_0x5f1de4,null));};exports[_0x5c48('0x45')]=function(_0x16de15,_0x17f77c){return db['AnalyticFieldReport']['bulkCreate'](_0x16de15['body'],{'raw':![],'individualHooks':!![]})[_0x5c48('0x21')](respondWithResult(_0x17f77c,0xc9))[_0x5c48('0x42')](handleError(_0x17f77c,null));};exports[_0x5c48('0x20')]=function(_0x58c0f1,_0x396409){if(_0x58c0f1[_0x5c48('0x44')]['id']){delete _0x58c0f1[_0x5c48('0x44')]['id'];}return db[_0x5c48('0x2b')]['find']({'where':{'id':_0x58c0f1['params']['id']}})['then'](handleEntityNotFound(_0x396409,null))[_0x5c48('0x21')](saveUpdates(_0x58c0f1['body'],null))[_0x5c48('0x21')](respondWithResult(_0x396409,null))['catch'](handleError(_0x396409,null));};exports['destroy']=function(_0x44c605,_0x13895d){return db[_0x5c48('0x2b')][_0x5c48('0x46')]({'where':{'id':_0x44c605[_0x5c48('0x47')]['id']}})[_0x5c48('0x21')](handleEntityNotFound(_0x13895d,null))['then'](removeEntity(_0x13895d,null))['catch'](handleError(_0x13895d,null));};exports[_0x5c48('0x48')]=function(_0x422f26,_0x4a9b31){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'id':_0x422f26[_0x5c48('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4a9b31,0xcc))[_0x5c48('0x42')](handleError(_0x4a9b31,null));};exports[_0x5c48('0x49')]=function(_0xc74a0a,_0x76aeae,_0x4e5fcf){return db[_0x5c48('0x4a')][_0x5c48('0x4b')]({'where':{'id':_0xc74a0a[_0x5c48('0x47')]['id']}})['then'](handleEntityNotFound(_0x76aeae,null))[_0x5c48('0x21')](function(_0x1d3c75){if(_0x1d3c75){return db[_0x5c48('0x4c')][_0x5c48('0x4d')](function(_0x2f9338){return db['AnalyticFieldReport'][_0x5c48('0x22')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']},'transaction':_0x2f9338})[_0x5c48('0x21')](function(_0xa102c4){var _0x3509f4=_[_0x5c48('0x2a')](_0xc74a0a[_0x5c48('0x44')],function(_0x254d43){delete _0x254d43['id'];_0x254d43[_0x5c48('0x4e')]=_0xc74a0a[_0x5c48('0x47')]['id'];return _0x254d43;});return db['AnalyticFieldReport'][_0x5c48('0x45')](_0x3509f4,{'transaction':_0x2f9338});});})['then'](function(){return db[_0x5c48('0x2b')][_0x5c48('0x40')]({'where':{'CustomReportId':_0xc74a0a[_0x5c48('0x47')]['id']}});});}})[_0x5c48('0x21')](respondWithResult(_0x76aeae,null))['catch'](handleError(_0x76aeae,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d652ed9..0363054 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 _0xcf3e=['util','../../config/logger','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x182709,_0x394059){var _0x30fd33=function(_0x155351){while(--_0x155351){_0x182709['push'](_0x182709['shift']());}};_0x30fd33(++_0x394059);}(_0xcf3e,0x1af));var _0xecf3=function(_0x5c7cf3,_0x4800f8){_0x5c7cf3=_0x5c7cf3-0x0;var _0x4a67c=_0xcf3e[_0x5c7cf3];return _0x4a67c;};'use strict';var _=require(_0xecf3('0x0'));var util=require(_0xecf3('0x1'));var logger=require(_0xecf3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xecf3('0x3'));var rp=require(_0xecf3('0x4'));var fs=require('fs');var path=require(_0xecf3('0x5'));var rimraf=require(_0xecf3('0x6'));var config=require('../../config/environment');var attributes=require(_0xecf3('0x7'));module[_0xecf3('0x8')]=function(_0x443584,_0x1bb103){return _0x443584[_0xecf3('0x9')](_0xecf3('0xa'),attributes,{'tableName':_0xecf3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc80e=['analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x204b09,_0x309f2a){var _0x38508d=function(_0x18d6f5){while(--_0x18d6f5){_0x204b09['push'](_0x204b09['shift']());}};_0x38508d(++_0x309f2a);}(_0xc80e,0x15d));var _0xec80=function(_0xb2320d,_0xe69d49){_0xb2320d=_0xb2320d-0x0;var _0x9db91a=_0xc80e[_0xb2320d];return _0x9db91a;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var logger=require(_0xec80('0x2'))(_0xec80('0x3'));var moment=require('moment');var BPromise=require(_0xec80('0x4'));var rp=require(_0xec80('0x5'));var fs=require('fs');var path=require(_0xec80('0x6'));var rimraf=require('rimraf');var config=require(_0xec80('0x7'));var attributes=require(_0xec80('0x8'));module[_0xec80('0x9')]=function(_0x315a4f,_0x240161){return _0x315a4f['define'](_0xec80('0xa'),attributes,{'tableName':_0xec80('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3c69fc9..fff1b72 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 _0x3a2d=['../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xc21ae,_0x173f65){var _0x358c22=function(_0x2445d3){while(--_0x2445d3){_0xc21ae['push'](_0xc21ae['shift']());}};_0x358c22(++_0x173f65);}(_0x3a2d,0xeb));var _0xd3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd3a2('0x0'));var util=require(_0xd3a2('0x1'));var moment=require(_0xd3a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3a2('0x3'));var db=require(_0xd3a2('0x4'))['db'];var utils=require(_0xd3a2('0x5'));var logger=require('../../config/logger')(_0xd3a2('0x6'));var config=require(_0xd3a2('0x7'));var jayson=require(_0xd3a2('0x8'));var client=jayson['client'][_0xd3a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18102c,_0x2173aa,_0x4c8ff7){return new BPromise(function(_0x1da390,_0x56da4e){return client[_0xd3a2('0xa')](_0x18102c,_0x4c8ff7)[_0xd3a2('0xb')](function(_0x341f9c){logger[_0xd3a2('0xc')](_0xd3a2('0xd'),_0x2173aa,_0xd3a2('0xe'));logger[_0xd3a2('0xf')](_0xd3a2('0x10'),_0x2173aa,'request\x20sent',JSON[_0xd3a2('0x11')](_0x341f9c));if(_0x341f9c['error']){if(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x13')]===0x1f4){logger[_0xd3a2('0x12')](_0xd3a2('0xd'),_0x2173aa,_0x341f9c['error'][_0xd3a2('0x14')]);return _0x56da4e(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x14')]);}logger[_0xd3a2('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2173aa,_0x341f9c['error']['message']);return _0x1da390(_0x341f9c[_0xd3a2('0x12')][_0xd3a2('0x14')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2173aa,_0xd3a2('0xe'));_0x1da390(_0x341f9c[_0xd3a2('0x15')]['message']);}})['catch'](function(_0x2cfca9){logger[_0xd3a2('0x12')](_0xd3a2('0xd'),_0x2173aa,_0x2cfca9);_0x56da4e(_0x2cfca9);});});} \ No newline at end of file +var _0x7a20=['request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xfa4dad,_0x1ae1c9){var _0x454a6d=function(_0x46629d){while(--_0x46629d){_0xfa4dad['push'](_0xfa4dad['shift']());}};_0x454a6d(++_0x1ae1c9);}(_0x7a20,0x64));var _0x07a2=function(_0x39a51b,_0x29a07e){_0x39a51b=_0x39a51b-0x0;var _0x2e882f=_0x7a20[_0x39a51b];return _0x2e882f;};'use strict';var _=require(_0x07a2('0x0'));var util=require(_0x07a2('0x1'));var moment=require(_0x07a2('0x2'));var BPromise=require(_0x07a2('0x3'));var rs=require(_0x07a2('0x4'));var fs=require('fs');var Redis=require(_0x07a2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07a2('0x6'));var logger=require(_0x07a2('0x7'))(_0x07a2('0x8'));var config=require(_0x07a2('0x9'));var jayson=require(_0x07a2('0xa'));var client=jayson[_0x07a2('0xb')][_0x07a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa24d82,_0x33fb70,_0x504732){return new BPromise(function(_0xc7d28a,_0x27b64f){return client[_0x07a2('0xd')](_0xa24d82,_0x504732)[_0x07a2('0xe')](function(_0x525a9c){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x33fb70,_0x07a2('0xf'));logger['debug'](_0x07a2('0x10'),_0x33fb70,_0x07a2('0xf'),JSON[_0x07a2('0x11')](_0x525a9c));if(_0x525a9c[_0x07a2('0x12')]){if(_0x525a9c[_0x07a2('0x12')]['code']===0x1f4){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c['error'][_0x07a2('0x14')]);return _0x27b64f(_0x525a9c['error'][_0x07a2('0x14')]);}logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x525a9c[_0x07a2('0x12')][_0x07a2('0x14')]);return _0xc7d28a(_0x525a9c['error']['message']);}else{logger[_0x07a2('0x15')](_0x07a2('0x13'),_0x33fb70,_0x07a2('0xf'));_0xc7d28a(_0x525a9c[_0x07a2('0x16')]['message']);}})['catch'](function(_0x4fa504){logger[_0x07a2('0x12')](_0x07a2('0x13'),_0x33fb70,_0x4fa504);_0x27b64f(_0x4fa504);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 246f796..31fd7a8 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(_0x7b9f1c,_0x36fcc1){var _0xd5f045=function(_0x140d04){while(--_0x140d04){_0x7b9f1c['push'](_0x7b9f1c['shift']());}};_0xd5f045(++_0x36fcc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x2381d5,_0x430612){var _0x4d4e0e=function(_0x553673){while(--_0x553673){_0x2381d5['push'](_0x2381d5['shift']());}};_0x4d4e0e(++_0x430612);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 1d42f7e..b54864d 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 _0xc36d=['sequelize','exports','STRING','name','TEXT'];(function(_0x2ec3a7,_0x1d5993){var _0x507f82=function(_0x5ce431){while(--_0x5ce431){_0x2ec3a7['push'](_0x2ec3a7['shift']());}};_0x507f82(++_0x1d5993);}(_0xc36d,0x7d));var _0xdc36=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xc36d[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'name':{'type':Sequelize[_0xdc36('0x2')],'allowNull':![],'unique':_0xdc36('0x3')},'table':{'type':Sequelize[_0xdc36('0x2')]},'metric':{'type':Sequelize[_0xdc36('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa75b=['sequelize','name','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa75b,0x170));var _0xba75=function(_0x203a21,_0x274fa9){_0x203a21=_0x203a21-0x0;var _0x3ce90a=_0xa75b[_0x203a21];return _0x3ce90a;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xba75('0x1')},'table':{'type':Sequelize[_0xba75('0x2')]},'metric':{'type':Sequelize[_0xba75('0x3')]},'description':{'type':Sequelize[_0xba75('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c1bf2c8..7d38114 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 _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(_0x242cae,_0x2c7699){var _0x2a45a8=function(_0x23db19){while(--_0x23db19){_0x242cae['push'](_0x242cae['shift']());}};_0x2a45a8(++_0x2c7699);}(_0x3e74,0x175));var _0x43e7=function(_0x295e66,_0x2be5ec){_0x295e66=_0x295e66-0x0;var _0x267a7d=_0x3e74[_0x295e66];return _0x267a7d;};'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 +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x16669a,_0x168e42){var _0x3db0b7=function(_0x4a5893){while(--_0x4a5893){_0x16669a['push'](_0x16669a['shift']());}};_0x3db0b7(++_0x168e42);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26b1b8,_0x35bfd4){_0x26b1b8=_0x26b1b8-0x0;var _0x401762=_0x7fbe[_0x26b1b8];return _0x401762;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 71bc066..37d4756 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 _0xec46=['rimraf','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x4f6a33,_0x4f43f5){var _0x16a50a=function(_0x14c812){while(--_0x14c812){_0x4f6a33['push'](_0x4f6a33['shift']());}};_0x16a50a(++_0x4f43f5);}(_0xec46,0x19c));var _0x6ec4=function(_0x15e56a,_0x5483d9){_0x15e56a=_0x15e56a-0x0;var _0x472c0d=_0xec46[_0x15e56a];return _0x472c0d;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var logger=require(_0x6ec4('0x2'))(_0x6ec4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6ec4('0x4'));var fs=require('fs');var path=require(_0x6ec4('0x5'));var rimraf=require(_0x6ec4('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ec4('0x7'));module[_0x6ec4('0x8')]=function(_0x55b203,_0x533fda){return _0x55b203['define'](_0x6ec4('0x9'),attributes,{'tableName':_0x6ec4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x302c=['moment','path','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x302c,0x15c));var _0xc302=function(_0x1fb2c6,_0x4a5110){_0x1fb2c6=_0x1fb2c6-0x0;var _0x187e7f=_0x302c[_0x1fb2c6];return _0x187e7f;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require(_0xc302('0x2'))(_0xc302('0x3'));var moment=require(_0xc302('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require(_0xc302('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x13139e,_0x59ba1e){return _0x13139e[_0xc302('0x8')](_0xc302('0x9'),attributes,{'tableName':_0xc302('0xa'),'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 0645302..0c55aaa 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 _0x7224=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x30804d,_0x38b1a4){var _0x3bdf9f=function(_0x3f86cf){while(--_0x3f86cf){_0x30804d['push'](_0x30804d['shift']());}};_0x3bdf9f(++_0x38b1a4);}(_0x7224,0x167));var _0x4722=function(_0x4165d6,_0x3229f5){_0x4165d6=_0x4165d6-0x0;var _0x188c3e=_0x7224[_0x4165d6];return _0x188c3e;};'use strict';var _=require(_0x4722('0x0'));var util=require(_0x4722('0x1'));var moment=require(_0x4722('0x2'));var BPromise=require(_0x4722('0x3'));var rs=require(_0x4722('0x4'));var fs=require('fs');var Redis=require(_0x4722('0x5'));var db=require(_0x4722('0x6'))['db'];var utils=require(_0x4722('0x7'));var logger=require(_0x4722('0x8'))(_0x4722('0x9'));var config=require(_0x4722('0xa'));var jayson=require(_0x4722('0xb'));var client=jayson[_0x4722('0xc')][_0x4722('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c70bb,_0x6240a6,_0x2f92b8){return new BPromise(function(_0x32962b,_0x2f202e){return client[_0x4722('0xe')](_0x3c70bb,_0x2f92b8)[_0x4722('0xf')](function(_0x48f1d0){logger['info'](_0x4722('0x10'),_0x6240a6,_0x4722('0x11'));logger['debug'](_0x4722('0x12'),_0x6240a6,_0x4722('0x11'),JSON['stringify'](_0x48f1d0));if(_0x48f1d0[_0x4722('0x13')]){if(_0x48f1d0[_0x4722('0x13')][_0x4722('0x14')]===0x1f4){logger['error'](_0x4722('0x10'),_0x6240a6,_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);return _0x2f202e(_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x6240a6,_0x48f1d0[_0x4722('0x13')][_0x4722('0x15')]);return _0x32962b(_0x48f1d0['error'][_0x4722('0x15')]);}else{logger[_0x4722('0x16')]('AnalyticMetric,\x20%s,\x20%s',_0x6240a6,'request\x20sent');_0x32962b(_0x48f1d0[_0x4722('0x17')][_0x4722('0x15')]);}})[_0x4722('0x18')](function(_0xa3cdf1){logger['error'](_0x4722('0x10'),_0x6240a6,_0xa3cdf1);_0x2f202e(_0xa3cdf1);});});} \ No newline at end of file +var _0x2aa9=['../../config/logger','rpc','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x2aa9,0x18a));var _0x92aa=function(_0x305753,_0x299ca1){_0x305753=_0x305753-0x0;var _0x3ad6ff=_0x2aa9[_0x305753];return _0x3ad6ff;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var moment=require(_0x92aa('0x2'));var BPromise=require(_0x92aa('0x3'));var rs=require(_0x92aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x92aa('0x6'))(_0x92aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x92aa('0x8')][_0x92aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x486b33,_0x7655b7,_0x3a0ec5){return new BPromise(function(_0x60d396,_0x361f52){return client['request'](_0x486b33,_0x3a0ec5)[_0x92aa('0xa')](function(_0x27b665){logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));logger[_0x92aa('0xe')](_0x92aa('0xf'),_0x7655b7,_0x92aa('0xd'),JSON[_0x92aa('0x10')](_0x27b665));if(_0x27b665['error']){if(_0x27b665[_0x92aa('0x11')]['code']===0x1f4){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x361f52(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x27b665['error'][_0x92aa('0x12')]);return _0x60d396(_0x27b665[_0x92aa('0x11')][_0x92aa('0x12')]);}else{logger[_0x92aa('0xb')](_0x92aa('0xc'),_0x7655b7,_0x92aa('0xd'));_0x60d396(_0x27b665['result']['message']);}})[_0x92aa('0x13')](function(_0x35e1aa){logger[_0x92aa('0x11')](_0x92aa('0xc'),_0x7655b7,_0x35e1aa);_0x361f52(_0x35e1aa);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3a8f421..218b450 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 _0xfd20=['util','express','Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports'];(function(_0x3f872a,_0x3ec864){var _0x13e5fd=function(_0x1db5a6){while(--_0x1db5a6){_0x3f872a['push'](_0x3f872a['shift']());}};_0x13e5fd(++_0x3ec864);}(_0xfd20,0x66));var _0x0fd2=function(_0x2df13f,_0x3a3921){_0x2df13f=_0x2df13f-0x0;var _0x5c8a3f=_0xfd20[_0x2df13f];return _0x5c8a3f;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fd2('0x4'));var controller=require(_0x0fd2('0x5'));router[_0x0fd2('0x6')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x8')]);router['get']('/:id',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0x9')]);router[_0x0fd2('0xa')]('/',auth[_0x0fd2('0x7')](),controller[_0x0fd2('0xb')]);router[_0x0fd2('0xc')](_0x0fd2('0xd'),auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);router[_0x0fd2('0xf')]('/:id',auth[_0x0fd2('0x7')](),controller['destroy']);module[_0x0fd2('0x10')]=router; \ No newline at end of file +var _0x5fd1=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x568172,_0x173414){var _0xda2d46=function(_0x2f2a03){while(--_0x2f2a03){_0x568172['push'](_0x568172['shift']());}};_0xda2d46(++_0x173414);}(_0x5fd1,0x155));var _0x15fd=function(_0x2fa263,_0x38401e){_0x2fa263=_0x2fa263-0x0;var _0x13f4ea=_0x5fd1[_0x2fa263];return _0x13f4ea;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x15fd('0x4'));var interaction=require(_0x15fd('0x5'));var config=require(_0x15fd('0x6'));var controller=require('./analyticMetric.controller');router[_0x15fd('0x7')]('/',auth[_0x15fd('0x8')](),controller[_0x15fd('0x9')]);router[_0x15fd('0x7')](_0x15fd('0xa'),auth['isAuthenticated'](),controller[_0x15fd('0xb')]);router[_0x15fd('0xc')]('/',auth[_0x15fd('0x8')](),controller['create']);router[_0x15fd('0xd')]('/:id',auth[_0x15fd('0x8')](),controller[_0x15fd('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xf')]);module[_0x15fd('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1b498c3..4f392eb 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 _0x062e=['TEXT','sequelize','exports'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x062e,0x1c6));var _0xe062=function(_0x4e1f1e,_0xc5b862){_0x4e1f1e=_0x4e1f1e-0x0;var _0x50d3de=_0x062e[_0x4e1f1e];return _0x50d3de;};'use strict';var Sequelize=require(_0xe062('0x0'));module[_0xe062('0x1')]={'tree':{'type':Sequelize[_0xe062('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x16c1=['sequelize','exports','TEXT'];(function(_0x48f85a,_0x1efd94){var _0x1bd655=function(_0x1a800d){while(--_0x1a800d){_0x48f85a['push'](_0x48f85a['shift']());}};_0x1bd655(++_0x1efd94);}(_0x16c1,0x66));var _0x116c=function(_0x46b079,_0x55b2bb){_0x46b079=_0x46b079-0x0;var _0x5c2a9f=_0x16c1[_0x46b079];return _0x5c2a9f;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'tree':{'type':Sequelize[_0x116c('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 75eab4b..e399166 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 _0xf31a=['json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','AnalyticTreeReport','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf31a,0x159));var _0xaf31=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xf31a[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0xaf31('0x0'));var rimraf=require(_0xaf31('0x1'));var zipdir=require(_0xaf31('0x2'));var jsonpatch=require(_0xaf31('0x3'));var rp=require(_0xaf31('0x4'));var moment=require(_0xaf31('0x5'));var BPromise=require(_0xaf31('0x6'));var Mustache=require(_0xaf31('0x7'));var util=require(_0xaf31('0x8'));var path=require(_0xaf31('0x9'));var sox=require(_0xaf31('0xa'));var csv=require(_0xaf31('0xb'));var ejs=require(_0xaf31('0xc'));var fs=require('fs');var fs_extra=require(_0xaf31('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaf31('0xe'));var deskjs=require(_0xaf31('0xf'));var toCsv=require(_0xaf31('0xb'));var querystring=require(_0xaf31('0x10'));var Papa=require(_0xaf31('0x11'));var Redis=require(_0xaf31('0x12'));var authService=require(_0xaf31('0x13'));var qs=require(_0xaf31('0x14'));var as=require(_0xaf31('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf31('0x16'))(_0xaf31('0x17'));var utils=require(_0xaf31('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaf31('0x19'));var db=require(_0xaf31('0x1a'))['db'];function respondWithStatusCode(_0xbca3e0,_0x2e3629){_0x2e3629=_0x2e3629||0xcc;return function(_0x1d8c65){if(_0x1d8c65){return _0xbca3e0[_0xaf31('0x1b')](_0x2e3629);}return _0xbca3e0[_0xaf31('0x1c')](_0x2e3629)[_0xaf31('0x1d')]();};}function respondWithResult(_0x25bd07,_0x58c279){_0x58c279=_0x58c279||0xc8;return function(_0xc04939){if(_0xc04939){return _0x25bd07[_0xaf31('0x1c')](_0x58c279)[_0xaf31('0x1e')](_0xc04939);}};}function respondWithFilteredResult(_0xd02d7,_0x2ca935){return function(_0x204153){if(_0x204153){var _0x59e97c=typeof _0x2ca935[_0xaf31('0x1f')]==='undefined'&&typeof _0x2ca935[_0xaf31('0x20')]==='undefined';var _0x4ac26f=_0x204153[_0xaf31('0x21')];var _0x542b8e=_0x59e97c?0x0:_0x2ca935[_0xaf31('0x1f')];var _0x470cc0=_0x59e97c?_0x204153['count']:_0x2ca935[_0xaf31('0x1f')]+_0x2ca935['limit'];var _0x5de237;if(_0x470cc0>=_0x4ac26f){_0x470cc0=_0x4ac26f;_0x5de237=0xc8;}else{_0x5de237=0xce;}_0xd02d7[_0xaf31('0x1c')](_0x5de237);return _0xd02d7['set'](_0xaf31('0x22'),_0x542b8e+'-'+_0x470cc0+'/'+_0x4ac26f)[_0xaf31('0x1e')](_0x204153);}return null;};}function patchUpdates(_0x10206e){return function(_0x23711f){try{jsonpatch[_0xaf31('0x23')](_0x23711f,_0x10206e,!![]);}catch(_0x3518a9){return BPromise[_0xaf31('0x24')](_0x3518a9);}return _0x23711f['save']();};}function saveUpdates(_0x5c1d99,_0x588e5e){return function(_0x479fc7){if(_0x479fc7){return _0x479fc7[_0xaf31('0x25')](_0x5c1d99)[_0xaf31('0x26')](function(_0x1de4ad){return _0x1de4ad;});}return null;};}function removeEntity(_0x1689be,_0xe307e7){return function(_0x1ded77){if(_0x1ded77){return _0x1ded77[_0xaf31('0x27')]()[_0xaf31('0x26')](function(){_0x1689be['status'](0xcc)[_0xaf31('0x1d')]();});}};}function handleEntityNotFound(_0x3ad1d6,_0xf5c7c3){return function(_0x5ca024){if(!_0x5ca024){_0x3ad1d6[_0xaf31('0x1b')](0x194);}return _0x5ca024;};}function handleError(_0x5d80bf,_0x34430d){_0x34430d=_0x34430d||0x1f4;return function(_0x4a3a9a){logger[_0xaf31('0x28')](_0x4a3a9a[_0xaf31('0x29')]);if(_0x4a3a9a[_0xaf31('0x2a')]){delete _0x4a3a9a[_0xaf31('0x2a')];}_0x5d80bf['status'](_0x34430d)['send'](_0x4a3a9a);};}exports[_0xaf31('0x2b')]=function(_0x3ce3a6,_0x596474){var _0x8526fb={},_0x42b8b3={},_0x5e6cd2={'count':0x0,'rows':[]};var _0x5e93b0=_['map'](db[_0xaf31('0x2c')]['rawAttributes'],function(_0x2a7276){return{'name':_0x2a7276[_0xaf31('0x2d')],'type':_0x2a7276[_0xaf31('0x2e')][_0xaf31('0x2f')]};});_0x42b8b3['model']=_[_0xaf31('0x30')](_0x5e93b0,'name');_0x42b8b3[_0xaf31('0x31')]=_[_0xaf31('0x32')](_0x3ce3a6[_0xaf31('0x31')]);_0x42b8b3[_0xaf31('0x33')]=_[_0xaf31('0x34')](_0x42b8b3[_0xaf31('0x35')],_0x42b8b3[_0xaf31('0x31')]);_0x8526fb[_0xaf31('0x36')]=_[_0xaf31('0x34')](_0x42b8b3['model'],qs[_0xaf31('0x37')](_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x37')]));_0x8526fb[_0xaf31('0x36')]=_0x8526fb[_0xaf31('0x36')][_0xaf31('0x38')]?_0x8526fb['attributes']:_0x42b8b3[_0xaf31('0x35')];if(!_0x3ce3a6['query'][_0xaf31('0x39')](_0xaf31('0x3a'))){_0x8526fb[_0xaf31('0x20')]=qs[_0xaf31('0x20')](_0x3ce3a6[_0xaf31('0x31')]['limit']);_0x8526fb[_0xaf31('0x1f')]=qs[_0xaf31('0x1f')](_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x1f')]);}_0x8526fb[_0xaf31('0x3b')]=qs[_0xaf31('0x3c')](_0x3ce3a6['query']['sort']);_0x8526fb[_0xaf31('0x3d')]=qs[_0xaf31('0x33')](_['pick'](_0x3ce3a6[_0xaf31('0x31')],_0x42b8b3[_0xaf31('0x33')]),_0x5e93b0);if(_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x3e')]){_0x8526fb[_0xaf31('0x3d')]=_[_0xaf31('0x3f')](_0x8526fb[_0xaf31('0x3d')],{'$or':_[_0xaf31('0x30')](_0x5e93b0,function(_0x561f0d){if(_0x561f0d[_0xaf31('0x2e')]!=='VIRTUAL'){var _0x287acf={};_0x287acf[_0x561f0d[_0xaf31('0x2a')]]={'$like':'%'+_0x3ce3a6[_0xaf31('0x31')][_0xaf31('0x3e')]+'%'};return _0x287acf;}})});}_0x8526fb=_[_0xaf31('0x3f')]({},_0x8526fb,_0x3ce3a6[_0xaf31('0x40')]);var _0x4bad7f={'where':_0x8526fb[_0xaf31('0x3d')]};return db[_0xaf31('0x2c')][_0xaf31('0x21')](_0x4bad7f)[_0xaf31('0x26')](function(_0x479b62){_0x5e6cd2[_0xaf31('0x21')]=_0x479b62;if(_0x3ce3a6[_0xaf31('0x31')]['includeAll']){_0x8526fb[_0xaf31('0x41')]=[{'all':!![]}];}return db[_0xaf31('0x2c')][_0xaf31('0x42')](_0x8526fb);})['then'](function(_0x279f2f){_0x5e6cd2[_0xaf31('0x43')]=_0x279f2f;return _0x5e6cd2;})[_0xaf31('0x26')](respondWithFilteredResult(_0x596474,_0x8526fb))['catch'](handleError(_0x596474,null));};exports[_0xaf31('0x44')]=function(_0x5cf301,_0x19ed61){var _0x22139f={'raw':!![],'where':{'id':_0x5cf301[_0xaf31('0x45')]['id']}},_0x5e3ada={};_0x5e3ada[_0xaf31('0x35')]=_[_0xaf31('0x32')](db[_0xaf31('0x2c')]['rawAttributes']);_0x5e3ada[_0xaf31('0x31')]=_[_0xaf31('0x32')](_0x5cf301[_0xaf31('0x31')]);_0x5e3ada['filters']=_['intersection'](_0x5e3ada['model'],_0x5e3ada['query']);_0x22139f[_0xaf31('0x36')]=_[_0xaf31('0x34')](_0x5e3ada[_0xaf31('0x35')],qs['fields'](_0x5cf301[_0xaf31('0x31')][_0xaf31('0x37')]));_0x22139f[_0xaf31('0x36')]=_0x22139f[_0xaf31('0x36')]['length']?_0x22139f[_0xaf31('0x36')]:_0x5e3ada[_0xaf31('0x35')];if(_0x5cf301[_0xaf31('0x31')][_0xaf31('0x46')]){_0x22139f[_0xaf31('0x41')]=[{'all':!![]}];}_0x22139f=_[_0xaf31('0x3f')]({},_0x22139f,_0x5cf301[_0xaf31('0x40')]);return db[_0xaf31('0x2c')]['find'](_0x22139f)[_0xaf31('0x26')](handleEntityNotFound(_0x19ed61,null))[_0xaf31('0x26')](respondWithResult(_0x19ed61,null))[_0xaf31('0x47')](handleError(_0x19ed61,null));};exports[_0xaf31('0x48')]=function(_0x4fe3fd,_0x5a3d8c){return db[_0xaf31('0x2c')][_0xaf31('0x48')](_0x4fe3fd['body'],{})[_0xaf31('0x26')](respondWithResult(_0x5a3d8c,0xc9))[_0xaf31('0x47')](handleError(_0x5a3d8c,null));};exports[_0xaf31('0x25')]=function(_0x517c85,_0x573a85){if(_0x517c85[_0xaf31('0x49')]['id']){delete _0x517c85['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x517c85[_0xaf31('0x45')]['id']}})[_0xaf31('0x26')](handleEntityNotFound(_0x573a85,null))[_0xaf31('0x26')](saveUpdates(_0x517c85[_0xaf31('0x49')],null))[_0xaf31('0x26')](respondWithResult(_0x573a85,null))[_0xaf31('0x47')](handleError(_0x573a85,null));};exports['destroy']=function(_0x26e9e7,_0x3b7dba){return db[_0xaf31('0x2c')][_0xaf31('0x4a')]({'where':{'id':_0x26e9e7[_0xaf31('0x45')]['id']}})[_0xaf31('0x26')](handleEntityNotFound(_0x3b7dba,null))['then'](removeEntity(_0x3b7dba,null))['catch'](handleError(_0x3b7dba,null));}; \ No newline at end of file +var _0xb10f=['sox','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb10f,0x160));var _0xfb10=function(_0x551e5,_0x107952){_0x551e5=_0x551e5-0x0;var _0x2b6288=_0xb10f[_0x551e5];return _0x2b6288;};'use strict';var emlformat=require(_0xfb10('0x0'));var rimraf=require(_0xfb10('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb10('0x2'));var rp=require('request-promise');var moment=require(_0xfb10('0x3'));var BPromise=require(_0xfb10('0x4'));var Mustache=require(_0xfb10('0x5'));var util=require(_0xfb10('0x6'));var path=require(_0xfb10('0x7'));var sox=require(_0xfb10('0x8'));var csv=require(_0xfb10('0x9'));var ejs=require(_0xfb10('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb10('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb10('0xc'));var toCsv=require(_0xfb10('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb10('0xd'));var authService=require(_0xfb10('0xe'));var qs=require(_0xfb10('0xf'));var as=require(_0xfb10('0x10'));var hardwareService=require(_0xfb10('0x11'));var logger=require('../../config/logger')(_0xfb10('0x12'));var utils=require(_0xfb10('0x13'));var config=require(_0xfb10('0x14'));var licenseUtil=require(_0xfb10('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517e1e,_0x3df9ac){_0x3df9ac=_0x3df9ac||0xcc;return function(_0x3fe5b8){if(_0x3fe5b8){return _0x517e1e[_0xfb10('0x16')](_0x3df9ac);}return _0x517e1e[_0xfb10('0x17')](_0x3df9ac)[_0xfb10('0x18')]();};}function respondWithResult(_0x187ab8,_0x5b70b3){_0x5b70b3=_0x5b70b3||0xc8;return function(_0x436cb5){if(_0x436cb5){return _0x187ab8[_0xfb10('0x17')](_0x5b70b3)['json'](_0x436cb5);}};}function respondWithFilteredResult(_0x59e321,_0x3852bf){return function(_0x4cdb94){if(_0x4cdb94){var _0x3eb1d2=typeof _0x3852bf[_0xfb10('0x19')]===_0xfb10('0x1a')&&typeof _0x3852bf[_0xfb10('0x1b')]===_0xfb10('0x1a');var _0x456849=_0x4cdb94[_0xfb10('0x1c')];var _0x43b19b=_0x3eb1d2?0x0:_0x3852bf[_0xfb10('0x19')];var _0x4cf7bc=_0x3eb1d2?_0x4cdb94[_0xfb10('0x1c')]:_0x3852bf[_0xfb10('0x19')]+_0x3852bf[_0xfb10('0x1b')];var _0x573725;if(_0x4cf7bc>=_0x456849){_0x4cf7bc=_0x456849;_0x573725=0xc8;}else{_0x573725=0xce;}_0x59e321[_0xfb10('0x17')](_0x573725);return _0x59e321[_0xfb10('0x1d')](_0xfb10('0x1e'),_0x43b19b+'-'+_0x4cf7bc+'/'+_0x456849)[_0xfb10('0x1f')](_0x4cdb94);}return null;};}function patchUpdates(_0x243dc9){return function(_0x583bbd){try{jsonpatch[_0xfb10('0x20')](_0x583bbd,_0x243dc9,!![]);}catch(_0x1566d3){return BPromise[_0xfb10('0x21')](_0x1566d3);}return _0x583bbd[_0xfb10('0x22')]();};}function saveUpdates(_0x50a4af,_0x2c2315){return function(_0x546372){if(_0x546372){return _0x546372[_0xfb10('0x23')](_0x50a4af)[_0xfb10('0x24')](function(_0x8e2d70){return _0x8e2d70;});}return null;};}function removeEntity(_0x5a1062,_0x5f1a90){return function(_0x5347f0){if(_0x5347f0){return _0x5347f0[_0xfb10('0x25')]()[_0xfb10('0x24')](function(){_0x5a1062[_0xfb10('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ddf2,_0x1ff69e){return function(_0x445fc6){if(!_0x445fc6){_0x30ddf2[_0xfb10('0x16')](0x194);}return _0x445fc6;};}function handleError(_0xdd1ee0,_0x1246bf){_0x1246bf=_0x1246bf||0x1f4;return function(_0x49ca50){logger[_0xfb10('0x26')](_0x49ca50[_0xfb10('0x27')]);if(_0x49ca50[_0xfb10('0x28')]){delete _0x49ca50[_0xfb10('0x28')];}_0xdd1ee0[_0xfb10('0x17')](_0x1246bf)[_0xfb10('0x29')](_0x49ca50);};}exports[_0xfb10('0x2a')]=function(_0x2d4caf,_0x36735e){var _0x2cb4c0={},_0x583a70={},_0x2c054d={'count':0x0,'rows':[]};var _0x495b58=_['map'](db[_0xfb10('0x2b')][_0xfb10('0x2c')],function(_0x145d98){return{'name':_0x145d98[_0xfb10('0x2d')],'type':_0x145d98[_0xfb10('0x2e')][_0xfb10('0x2f')]};});_0x583a70[_0xfb10('0x30')]=_[_0xfb10('0x31')](_0x495b58,_0xfb10('0x28'));_0x583a70[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x2d4caf[_0xfb10('0x32')]);_0x583a70[_0xfb10('0x34')]=_['intersection'](_0x583a70[_0xfb10('0x30')],_0x583a70[_0xfb10('0x32')]);_0x2cb4c0['attributes']=_[_0xfb10('0x35')](_0x583a70[_0xfb10('0x30')],qs['fields'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x36')]));_0x2cb4c0['attributes']=_0x2cb4c0[_0xfb10('0x37')][_0xfb10('0x38')]?_0x2cb4c0[_0xfb10('0x37')]:_0x583a70[_0xfb10('0x30')];if(!_0x2d4caf['query']['hasOwnProperty'](_0xfb10('0x39'))){_0x2cb4c0['limit']=qs[_0xfb10('0x1b')](_0x2d4caf['query']['limit']);_0x2cb4c0[_0xfb10('0x19')]=qs[_0xfb10('0x19')](_0x2d4caf['query'][_0xfb10('0x19')]);}_0x2cb4c0['order']=qs['sort'](_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3a')]);_0x2cb4c0[_0xfb10('0x3b')]=qs[_0xfb10('0x34')](_['pick'](_0x2d4caf[_0xfb10('0x32')],_0x583a70[_0xfb10('0x34')]),_0x495b58);if(_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]){_0x2cb4c0[_0xfb10('0x3b')]=_[_0xfb10('0x3d')](_0x2cb4c0[_0xfb10('0x3b')],{'$or':_[_0xfb10('0x31')](_0x495b58,function(_0x54976e){if(_0x54976e[_0xfb10('0x2e')]!=='VIRTUAL'){var _0x38575d={};_0x38575d[_0x54976e[_0xfb10('0x28')]]={'$like':'%'+_0x2d4caf[_0xfb10('0x32')][_0xfb10('0x3c')]+'%'};return _0x38575d;}})});}_0x2cb4c0=_[_0xfb10('0x3d')]({},_0x2cb4c0,_0x2d4caf[_0xfb10('0x3e')]);var _0x451d4f={'where':_0x2cb4c0['where']};return db[_0xfb10('0x2b')][_0xfb10('0x1c')](_0x451d4f)[_0xfb10('0x24')](function(_0x587e2e){_0x2c054d[_0xfb10('0x1c')]=_0x587e2e;if(_0x2d4caf['query'][_0xfb10('0x3f')]){_0x2cb4c0[_0xfb10('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xfb10('0x41')](_0x2cb4c0);})['then'](function(_0x531360){_0x2c054d[_0xfb10('0x42')]=_0x531360;return _0x2c054d;})[_0xfb10('0x24')](respondWithFilteredResult(_0x36735e,_0x2cb4c0))[_0xfb10('0x43')](handleError(_0x36735e,null));};exports['show']=function(_0x996047,_0x51804f){var _0x1f84bd={'raw':!![],'where':{'id':_0x996047[_0xfb10('0x44')]['id']}},_0xea909e={};_0xea909e['model']=_[_0xfb10('0x33')](db[_0xfb10('0x2b')]['rawAttributes']);_0xea909e[_0xfb10('0x32')]=_[_0xfb10('0x33')](_0x996047[_0xfb10('0x32')]);_0xea909e[_0xfb10('0x34')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],_0xea909e[_0xfb10('0x32')]);_0x1f84bd[_0xfb10('0x37')]=_[_0xfb10('0x35')](_0xea909e[_0xfb10('0x30')],qs['fields'](_0x996047[_0xfb10('0x32')][_0xfb10('0x36')]));_0x1f84bd[_0xfb10('0x37')]=_0x1f84bd['attributes'][_0xfb10('0x38')]?_0x1f84bd[_0xfb10('0x37')]:_0xea909e[_0xfb10('0x30')];if(_0x996047[_0xfb10('0x32')][_0xfb10('0x3f')]){_0x1f84bd[_0xfb10('0x40')]=[{'all':!![]}];}_0x1f84bd=_['merge']({},_0x1f84bd,_0x996047[_0xfb10('0x3e')]);return db[_0xfb10('0x2b')][_0xfb10('0x45')](_0x1f84bd)['then'](handleEntityNotFound(_0x51804f,null))[_0xfb10('0x24')](respondWithResult(_0x51804f,null))['catch'](handleError(_0x51804f,null));};exports[_0xfb10('0x46')]=function(_0x52a15b,_0x46d854){return db[_0xfb10('0x2b')][_0xfb10('0x46')](_0x52a15b['body'],{})[_0xfb10('0x24')](respondWithResult(_0x46d854,0xc9))[_0xfb10('0x43')](handleError(_0x46d854,null));};exports[_0xfb10('0x23')]=function(_0x1fdbc7,_0x423d52){if(_0x1fdbc7[_0xfb10('0x47')]['id']){delete _0x1fdbc7[_0xfb10('0x47')]['id'];}return db[_0xfb10('0x2b')]['find']({'where':{'id':_0x1fdbc7[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x423d52,null))[_0xfb10('0x24')](saveUpdates(_0x1fdbc7[_0xfb10('0x47')],null))[_0xfb10('0x24')](respondWithResult(_0x423d52,null))[_0xfb10('0x43')](handleError(_0x423d52,null));};exports['destroy']=function(_0x56c770,_0x502b62){return db[_0xfb10('0x2b')][_0xfb10('0x45')]({'where':{'id':_0x56c770[_0xfb10('0x44')]['id']}})[_0xfb10('0x24')](handleEntityNotFound(_0x502b62,null))['then'](removeEntity(_0x502b62,null))[_0xfb10('0x43')](handleError(_0x502b62,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 543a8a1..a68f544 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 _0xd905=['request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','bluebird'];(function(_0x2cfad5,_0x15c56b){var _0x3568fb=function(_0x35179b){while(--_0x35179b){_0x2cfad5['push'](_0x2cfad5['shift']());}};_0x3568fb(++_0x15c56b);}(_0xd905,0x11b));var _0x5d90=function(_0x25ac47,_0x17c52e){_0x25ac47=_0x25ac47-0x0;var _0x11fda2=_0xd905[_0x25ac47];return _0x11fda2;};'use strict';var _=require('lodash');var util=require(_0x5d90('0x0'));var logger=require(_0x5d90('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5d90('0x2'));var rp=require(_0x5d90('0x3'));var fs=require('fs');var path=require(_0x5d90('0x4'));var rimraf=require('rimraf');var config=require(_0x5d90('0x5'));var attributes=require(_0x5d90('0x6'));module[_0x5d90('0x7')]=function(_0x19a847,_0x441639){return _0x19a847[_0x5d90('0x8')](_0x5d90('0x9'),attributes,{'tableName':_0x5d90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5afe=['exports','define','AnalyticTreeReport','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0xc70293,_0x2cc6f4){var _0x29036b=function(_0x225d0c){while(--_0x225d0c){_0xc70293['push'](_0xc70293['shift']());}};_0x29036b(++_0x2cc6f4);}(_0x5afe,0x10b));var _0xe5af=function(_0x2128d3,_0x420dfa){_0x2128d3=_0x2128d3-0x0;var _0x49fa00=_0x5afe[_0x2128d3];return _0x49fa00;};'use strict';var _=require('lodash');var util=require(_0xe5af('0x0'));var logger=require(_0xe5af('0x1'))(_0xe5af('0x2'));var moment=require('moment');var BPromise=require(_0xe5af('0x3'));var rp=require(_0xe5af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5af('0x5'));var config=require(_0xe5af('0x6'));var attributes=require(_0xe5af('0x7'));module[_0xe5af('0x8')]=function(_0xffac45,_0x719722){return _0xffac45[_0xe5af('0x9')](_0xe5af('0xa'),attributes,{'tableName':'analytics_report_trees','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 a54b256..8c26b5b 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 _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(_0x3889a2,_0x150b68){var _0xf6699f=function(_0x586c44){while(--_0x586c44){_0x3889a2['push'](_0x3889a2['shift']());}};_0xf6699f(++_0x150b68);}(_0x2ef3,0xba));var _0x32ef=function(_0x3394ba,_0x5b0737){_0x3394ba=_0x3394ba-0x0;var _0x39daff=_0x2ef3[_0x3394ba];return _0x39daff;};'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 +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x238a1a,_0x3b01f2){var _0x5bbacc=function(_0x13d7cb){while(--_0x13d7cb){_0x238a1a['push'](_0x238a1a['shift']());}};_0x5bbacc(++_0x3b01f2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21d47d,_0x46cab0){_0x21d47d=_0x21d47d-0x0;var _0x395148=_0x5f2f[_0x21d47d];return _0x395148;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 782d2fa..db4ccb6 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 _0xe1cf=['create','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x50ad27,_0x984993){var _0x203d36=function(_0x42b068){while(--_0x42b068){_0x50ad27['push'](_0x50ad27['shift']());}};_0x203d36(++_0x984993);}(_0xe1cf,0x194));var _0xfe1c=function(_0x4dbf53,_0x3213ea){_0x4dbf53=_0x4dbf53-0x0;var _0x269abc=_0xe1cf[_0x4dbf53];return _0x269abc;};'use strict';var multer=require(_0xfe1c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfe1c('0x1'));var express=require(_0xfe1c('0x2'));var router=express['Router']();var fs_extra=require(_0xfe1c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfe1c('0x4'));var config=require(_0xfe1c('0x5'));var controller=require(_0xfe1c('0x6'));router[_0xfe1c('0x7')]('/',auth[_0xfe1c('0x8')](),controller[_0xfe1c('0x9')]);router['get'](_0xfe1c('0xa'),auth['isAuthenticated'](),controller[_0xfe1c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfe1c('0xc')]);router['put'](_0xfe1c('0xa'),auth[_0xfe1c('0x8')](),controller[_0xfe1c('0xd')]);router[_0xfe1c('0xe')](_0xfe1c('0xa'),auth[_0xfe1c('0x8')](),controller['destroy']);module[_0xfe1c('0xf')]=router; \ No newline at end of file +var _0x077b=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x665132,_0x5bbb19){var _0x312117=function(_0x152870){while(--_0x152870){_0x665132['push'](_0x665132['shift']());}};_0x312117(++_0x5bbb19);}(_0x077b,0xbd));var _0xb077=function(_0x4f41cf,_0xdf03fe){_0x4f41cf=_0x4f41cf-0x0;var _0x5e19d0=_0x077b[_0x4f41cf];return _0x5e19d0;};'use strict';var multer=require(_0xb077('0x0'));var util=require(_0xb077('0x1'));var path=require('path');var timeout=require(_0xb077('0x2'));var express=require(_0xb077('0x3'));var router=express[_0xb077('0x4')]();var fs_extra=require(_0xb077('0x5'));var auth=require(_0xb077('0x6'));var interaction=require(_0xb077('0x7'));var config=require(_0xb077('0x8'));var controller=require(_0xb077('0x9'));router[_0xb077('0xa')]('/',auth[_0xb077('0xb')](),controller['index']);router['get'](_0xb077('0xc'),auth[_0xb077('0xb')](),controller['show']);router[_0xb077('0xd')]('/',auth[_0xb077('0xb')](),controller[_0xb077('0xe')]);router[_0xb077('0xf')](_0xb077('0xc'),auth[_0xb077('0xb')](),controller[_0xb077('0x10')]);router[_0xb077('0x11')](_0xb077('0xc'),auth['isAuthenticated'](),controller[_0xb077('0x12')]);module[_0xb077('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 8f224be..53b6197 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 _0x4156=['STRING','sequelize','exports'];(function(_0x8b0ec1,_0x1c6b02){var _0x3c51ca=function(_0x4c3ffc){while(--_0x4c3ffc){_0x8b0ec1['push'](_0x8b0ec1['shift']());}};_0x3c51ca(++_0x1c6b02);}(_0x4156,0xf1));var _0x6415=function(_0x4258a3,_0x58b9bc){_0x4258a3=_0x4258a3-0x0;var _0x3a6232=_0x4156[_0x4258a3];return _0x3a6232;};'use strict';var Sequelize=require(_0x6415('0x0'));module[_0x6415('0x1')]={'name':{'type':Sequelize[_0x6415('0x2')]},'basename':{'type':Sequelize[_0x6415('0x2')]},'type':{'type':Sequelize[_0x6415('0x2')]}}; \ No newline at end of file +var _0xc718=['sequelize','STRING'];(function(_0x597b7a,_0x5660e8){var _0xc37f49=function(_0x15053b){while(--_0x15053b){_0x597b7a['push'](_0x597b7a['shift']());}};_0xc37f49(++_0x5660e8);}(_0xc718,0xb6));var _0x8c71=function(_0x195eb3,_0x59180c){_0x195eb3=_0x195eb3-0x0;var _0x36ea03=_0xc718[_0x195eb3];return _0x36ea03;};'use strict';var Sequelize=require(_0x8c71('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c71('0x1')]},'basename':{'type':Sequelize[_0x8c71('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c0f6f1b..5347cb4 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 _0x4667=['filter','options','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','updatedAt','body','createdAt','create','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL'];(function(_0x321399,_0x32957f){var _0x29b4a2=function(_0x2bf04f){while(--_0x2bf04f){_0x321399['push'](_0x321399['shift']());}};_0x29b4a2(++_0x32957f);}(_0x4667,0x12b));var _0x7466=function(_0x483cbe,_0x1832da){_0x483cbe=_0x483cbe-0x0;var _0x191c71=_0x4667[_0x483cbe];return _0x191c71;};'use strict';var emlformat=require(_0x7466('0x0'));var rimraf=require(_0x7466('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7466('0x2'));var moment=require('moment');var BPromise=require(_0x7466('0x3'));var Mustache=require(_0x7466('0x4'));var util=require(_0x7466('0x5'));var path=require('path');var sox=require(_0x7466('0x6'));var csv=require(_0x7466('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7466('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7466('0x9'));var jsforce=require(_0x7466('0xa'));var deskjs=require(_0x7466('0xb'));var toCsv=require(_0x7466('0x7'));var querystring=require('querystring');var Papa=require(_0x7466('0xc'));var Redis=require('ioredis');var authService=require(_0x7466('0xd'));var qs=require(_0x7466('0xe'));var as=require(_0x7466('0xf'));var hardwareService=require(_0x7466('0x10'));var logger=require(_0x7466('0x11'))(_0x7466('0x12'));var utils=require(_0x7466('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7466('0x14'));var db=require(_0x7466('0x15'))['db'];function respondWithStatusCode(_0x434485,_0x4fef86){_0x4fef86=_0x4fef86||0xcc;return function(_0x7dcbf8){if(_0x7dcbf8){return _0x434485[_0x7466('0x16')](_0x4fef86);}return _0x434485['status'](_0x4fef86)[_0x7466('0x17')]();};}function respondWithResult(_0x3ad738,_0x4e437a){_0x4e437a=_0x4e437a||0xc8;return function(_0x163237){if(_0x163237){return _0x3ad738['status'](_0x4e437a)['json'](_0x163237);}};}function respondWithFilteredResult(_0x59593a,_0x4e5c7b){return function(_0x1d674a){if(_0x1d674a){var _0x4a1ff4=typeof _0x4e5c7b[_0x7466('0x18')]===_0x7466('0x19')&&typeof _0x4e5c7b['limit']===_0x7466('0x19');var _0x18878a=_0x1d674a[_0x7466('0x1a')];var _0x1110db=_0x4a1ff4?0x0:_0x4e5c7b[_0x7466('0x18')];var _0x16b646=_0x4a1ff4?_0x1d674a[_0x7466('0x1a')]:_0x4e5c7b[_0x7466('0x18')]+_0x4e5c7b[_0x7466('0x1b')];var _0x514bae;if(_0x16b646>=_0x18878a){_0x16b646=_0x18878a;_0x514bae=0xc8;}else{_0x514bae=0xce;}_0x59593a[_0x7466('0x1c')](_0x514bae);return _0x59593a[_0x7466('0x1d')](_0x7466('0x1e'),_0x1110db+'-'+_0x16b646+'/'+_0x18878a)[_0x7466('0x1f')](_0x1d674a);}return null;};}function patchUpdates(_0x571ac2){return function(_0x1fe6a3){try{jsonpatch['apply'](_0x1fe6a3,_0x571ac2,!![]);}catch(_0x343ec8){return BPromise[_0x7466('0x20')](_0x343ec8);}return _0x1fe6a3[_0x7466('0x21')]();};}function saveUpdates(_0x56be55,_0x4ad0a0){return function(_0x522593){if(_0x522593){return _0x522593[_0x7466('0x22')](_0x56be55)[_0x7466('0x23')](function(_0x1a2762){return _0x1a2762;});}return null;};}function removeEntity(_0x1ca31f,_0x532960){return function(_0x29be30){if(_0x29be30){return _0x29be30[_0x7466('0x24')]()[_0x7466('0x23')](function(){_0x1ca31f[_0x7466('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1b93,_0x5a31ea){return function(_0x428719){if(!_0x428719){_0x5b1b93[_0x7466('0x16')](0x194);}return _0x428719;};}function handleError(_0x597087,_0x58c71e){_0x58c71e=_0x58c71e||0x1f4;return function(_0x3cbdaf){logger['error'](_0x3cbdaf['stack']);if(_0x3cbdaf[_0x7466('0x25')]){delete _0x3cbdaf[_0x7466('0x25')];}_0x597087[_0x7466('0x1c')](_0x58c71e)[_0x7466('0x26')](_0x3cbdaf);};}exports[_0x7466('0x27')]=function(_0x3c19b5,_0x1ff047){var _0x3006a6={},_0x377352={},_0x1e509c={'count':0x0,'rows':[]};var _0x58966a=_[_0x7466('0x28')](db[_0x7466('0x29')][_0x7466('0x2a')],function(_0x15fc25){return{'name':_0x15fc25[_0x7466('0x2b')],'type':_0x15fc25['type'][_0x7466('0x2c')]};});_0x377352[_0x7466('0x2d')]=_[_0x7466('0x28')](_0x58966a,_0x7466('0x25'));_0x377352[_0x7466('0x2e')]=_[_0x7466('0x2f')](_0x3c19b5[_0x7466('0x2e')]);_0x377352[_0x7466('0x30')]=_[_0x7466('0x31')](_0x377352[_0x7466('0x2d')],_0x377352['query']);_0x3006a6['attributes']=_[_0x7466('0x31')](_0x377352[_0x7466('0x2d')],qs['fields'](_0x3c19b5[_0x7466('0x2e')][_0x7466('0x32')]));_0x3006a6[_0x7466('0x33')]=_0x3006a6[_0x7466('0x33')][_0x7466('0x34')]?_0x3006a6[_0x7466('0x33')]:_0x377352[_0x7466('0x2d')];if(!_0x3c19b5[_0x7466('0x2e')][_0x7466('0x35')](_0x7466('0x36'))){_0x3006a6[_0x7466('0x1b')]=qs[_0x7466('0x1b')](_0x3c19b5['query'][_0x7466('0x1b')]);_0x3006a6['offset']=qs[_0x7466('0x18')](_0x3c19b5[_0x7466('0x2e')]['offset']);}_0x3006a6['order']=qs[_0x7466('0x37')](_0x3c19b5[_0x7466('0x2e')][_0x7466('0x37')]);_0x3006a6[_0x7466('0x38')]=qs[_0x7466('0x30')](_[_0x7466('0x39')](_0x3c19b5[_0x7466('0x2e')],_0x377352[_0x7466('0x30')]),_0x58966a);if(_0x3c19b5[_0x7466('0x2e')]['filter']){_0x3006a6[_0x7466('0x38')]=_[_0x7466('0x3a')](_0x3006a6['where'],{'$or':_['map'](_0x58966a,function(_0x36ee11){if(_0x36ee11[_0x7466('0x3b')]!==_0x7466('0x3c')){var _0x4b37a9={};_0x4b37a9[_0x36ee11[_0x7466('0x25')]]={'$like':'%'+_0x3c19b5[_0x7466('0x2e')][_0x7466('0x3d')]+'%'};return _0x4b37a9;}})});}_0x3006a6=_[_0x7466('0x3a')]({},_0x3006a6,_0x3c19b5[_0x7466('0x3e')]);var _0x30b0e6={'where':_0x3006a6[_0x7466('0x38')]};return db[_0x7466('0x29')]['count'](_0x30b0e6)[_0x7466('0x23')](function(_0x438917){_0x1e509c['count']=_0x438917;if(_0x3c19b5[_0x7466('0x2e')][_0x7466('0x3f')]){_0x3006a6[_0x7466('0x40')]=[{'all':!![]}];}return db[_0x7466('0x29')][_0x7466('0x41')](_0x3006a6);})['then'](function(_0xf5de24){_0x1e509c[_0x7466('0x42')]=_0xf5de24;return _0x1e509c;})['then'](respondWithFilteredResult(_0x1ff047,_0x3006a6))[_0x7466('0x43')](handleError(_0x1ff047,null));};exports[_0x7466('0x44')]=function(_0x22a8f6,_0xe09314){var _0x379dff={'raw':!![],'where':{'id':_0x22a8f6[_0x7466('0x45')]['id']}},_0xcdb9dc={};_0xcdb9dc[_0x7466('0x2d')]=_[_0x7466('0x2f')](db[_0x7466('0x29')][_0x7466('0x2a')]);_0xcdb9dc[_0x7466('0x2e')]=_['keys'](_0x22a8f6[_0x7466('0x2e')]);_0xcdb9dc[_0x7466('0x30')]=_[_0x7466('0x31')](_0xcdb9dc['model'],_0xcdb9dc[_0x7466('0x2e')]);_0x379dff[_0x7466('0x33')]=_[_0x7466('0x31')](_0xcdb9dc[_0x7466('0x2d')],qs['fields'](_0x22a8f6['query'][_0x7466('0x32')]));_0x379dff[_0x7466('0x33')]=_0x379dff['attributes'][_0x7466('0x34')]?_0x379dff['attributes']:_0xcdb9dc['model'];if(_0x22a8f6[_0x7466('0x2e')][_0x7466('0x3f')]){_0x379dff[_0x7466('0x40')]=[{'all':!![]}];}_0x379dff=_[_0x7466('0x3a')]({},_0x379dff,_0x22a8f6['options']);return db[_0x7466('0x29')][_0x7466('0x46')](_0x379dff)[_0x7466('0x23')](handleEntityNotFound(_0xe09314,null))[_0x7466('0x23')](respondWithResult(_0xe09314,null))['catch'](handleError(_0xe09314,null));};exports[_0x7466('0x47')]=function(_0x1b79ba,_0x2a443e){var _0x569c96={'where':{'id':_0x1b79ba[_0x7466('0x45')]['id']}},_0x4c1006={};_0x4c1006[_0x7466('0x2d')]=_[_0x7466('0x2f')](db[_0x7466('0x29')][_0x7466('0x2a')]);_0x569c96['attributes']=_[_0x7466('0x31')](_0x4c1006[_0x7466('0x2d')],qs[_0x7466('0x32')](_0x1b79ba['query'][_0x7466('0x32')]));_0x569c96[_0x7466('0x33')]=_0x569c96[_0x7466('0x33')][_0x7466('0x34')]?_0x569c96['attributes']:_0x4c1006[_0x7466('0x2d')];if(_0x1b79ba['query'][_0x7466('0x3f')]){_0x569c96[_0x7466('0x40')]=[{'all':!![]}];}_0x569c96=_['merge']({},_0x569c96,_0x1b79ba[_0x7466('0x3e')]);return db[_0x7466('0x29')][_0x7466('0x46')](_0x569c96)[_0x7466('0x23')](handleEntityNotFound(_0x2a443e,null))['then'](function(_0x386f5f){if(_0x386f5f){var _0x323ec6=_0x386f5f[_0x7466('0x48')]({'plain':!![]});_0x323ec6=qs[_0x7466('0x49')](_0x323ec6,['id','createdAt',_0x7466('0x4a')]);_0x1b79ba['body']=_['omit'](_0x1b79ba[_0x7466('0x4b')],['id',_0x7466('0x4c'),_0x7466('0x4a')]);return db['Attachment'][_0x7466('0x4d')](_['merge'](_0x323ec6,_0x1b79ba['body']),{'include':_0x1b79ba[_0x7466('0x2e')][_0x7466('0x3f')]?[{'all':!![]}]:undefined});}})[_0x7466('0x23')](respondWithResult(_0x2a443e,0xc9))[_0x7466('0x43')](handleError(_0x2a443e,null));};exports[_0x7466('0x22')]=function(_0x36db6a,_0x5387e4){if(_0x36db6a['body']['id']){delete _0x36db6a[_0x7466('0x4b')]['id'];}return db[_0x7466('0x29')][_0x7466('0x46')]({'where':{'id':_0x36db6a['params']['id']}})['then'](handleEntityNotFound(_0x5387e4,null))[_0x7466('0x23')](saveUpdates(_0x36db6a[_0x7466('0x4b')],null))[_0x7466('0x23')](respondWithResult(_0x5387e4,null))[_0x7466('0x43')](handleError(_0x5387e4,null));};exports[_0x7466('0x24')]=function(_0x552257,_0xd83f4a){return db[_0x7466('0x29')][_0x7466('0x46')]({'where':{'id':_0x552257[_0x7466('0x45')]['id']}})[_0x7466('0x23')](handleEntityNotFound(_0xd83f4a,null))[_0x7466('0x23')](removeEntity(_0xd83f4a,null))['catch'](handleError(_0xd83f4a,null));};exports['create']=function(_0x36cdbc,_0x9409c8,_0x1dbf7d){_0x36cdbc[_0x7466('0x4b')]['name']=_0x36cdbc['file'][_0x7466('0x4e')];_0x36cdbc[_0x7466('0x4b')][_0x7466('0x4f')]=_0x36cdbc[_0x7466('0x50')][_0x7466('0x51')];_0x36cdbc[_0x7466('0x4b')][_0x7466('0x3b')]=_0x36cdbc[_0x7466('0x50')][_0x7466('0x52')];return db['Attachment'][_0x7466('0x4d')](_0x36cdbc[_0x7466('0x4b')])[_0x7466('0x23')](respondWithResult(_0x9409c8,0xc9))[_0x7466('0x43')](handleError(_0x9409c8,null));};exports[_0x7466('0x53')]=function(_0x5a7a87,_0x16aa65,_0x172897){return db[_0x7466('0x29')][_0x7466('0x54')]({'where':{'id':_0x5a7a87['params']['id']},'raw':!![]})[_0x7466('0x23')](handleEntityNotFound(_0x16aa65,null))['then'](function(_0x161423){if(_0x161423){var _0x425dba=_0x161423[_0x7466('0x55')]!==null;var _0x595747=path[_0x7466('0x56')](config[_0x7466('0x57')],_0x7466('0x58'));if(_0x425dba){_0x595747=path[_0x7466('0x56')](_0x595747,_0x7466('0x59'));}var _0x27e7af=path[_0x7466('0x56')](_0x595747,_0x161423[_0x7466('0x4f')]);return _0x16aa65['download'](_0x27e7af);}})[_0x7466('0x43')](handleError(_0x16aa65,null));}; \ No newline at end of file +var _0x946e=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','find','clone','get','updatedAt','body','createdAt','create','file','originalname','filename','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','basename','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0xc90440,_0x4cf80b){var _0x46ef96=function(_0x428ee0){while(--_0x428ee0){_0xc90440['push'](_0xc90440['shift']());}};_0x46ef96(++_0x4cf80b);}(_0x946e,0xae));var _0xe946=function(_0x1f878b,_0x1f894d){_0x1f878b=_0x1f878b-0x0;var _0x3fa595=_0x946e[_0x1f878b];return _0x3fa595;};'use strict';var emlformat=require(_0xe946('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe946('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe946('0x2'));var BPromise=require(_0xe946('0x3'));var Mustache=require(_0xe946('0x4'));var util=require(_0xe946('0x5'));var path=require(_0xe946('0x6'));var sox=require(_0xe946('0x7'));var csv=require(_0xe946('0x8'));var ejs=require(_0xe946('0x9'));var fs=require('fs');var fs_extra=require(_0xe946('0xa'));var _=require(_0xe946('0xb'));var squel=require(_0xe946('0xc'));var crypto=require(_0xe946('0xd'));var jsforce=require(_0xe946('0xe'));var deskjs=require(_0xe946('0xf'));var toCsv=require(_0xe946('0x8'));var querystring=require(_0xe946('0x10'));var Papa=require(_0xe946('0x11'));var Redis=require(_0xe946('0x12'));var authService=require(_0xe946('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe946('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe946('0x15'))(_0xe946('0x16'));var utils=require(_0xe946('0x17'));var config=require(_0xe946('0x18'));var licenseUtil=require(_0xe946('0x19'));var db=require(_0xe946('0x1a'))['db'];function respondWithStatusCode(_0x3232b1,_0x1cc8e7){_0x1cc8e7=_0x1cc8e7||0xcc;return function(_0x15f5cc){if(_0x15f5cc){return _0x3232b1[_0xe946('0x1b')](_0x1cc8e7);}return _0x3232b1[_0xe946('0x1c')](_0x1cc8e7)['end']();};}function respondWithResult(_0x40e2f4,_0x292863){_0x292863=_0x292863||0xc8;return function(_0x44404d){if(_0x44404d){return _0x40e2f4['status'](_0x292863)[_0xe946('0x1d')](_0x44404d);}};}function respondWithFilteredResult(_0x5caeb2,_0x4da63a){return function(_0x457ffd){if(_0x457ffd){var _0x2afe31=typeof _0x4da63a['offset']===_0xe946('0x1e')&&typeof _0x4da63a[_0xe946('0x1f')]==='undefined';var _0x49b8d2=_0x457ffd['count'];var _0x5d5feb=_0x2afe31?0x0:_0x4da63a[_0xe946('0x20')];var _0x6e9c58=_0x2afe31?_0x457ffd[_0xe946('0x21')]:_0x4da63a[_0xe946('0x20')]+_0x4da63a[_0xe946('0x1f')];var _0x442cc6;if(_0x6e9c58>=_0x49b8d2){_0x6e9c58=_0x49b8d2;_0x442cc6=0xc8;}else{_0x442cc6=0xce;}_0x5caeb2[_0xe946('0x1c')](_0x442cc6);return _0x5caeb2[_0xe946('0x22')](_0xe946('0x23'),_0x5d5feb+'-'+_0x6e9c58+'/'+_0x49b8d2)[_0xe946('0x1d')](_0x457ffd);}return null;};}function patchUpdates(_0x570632){return function(_0x4ff80b){try{jsonpatch['apply'](_0x4ff80b,_0x570632,!![]);}catch(_0x143551){return BPromise[_0xe946('0x24')](_0x143551);}return _0x4ff80b[_0xe946('0x25')]();};}function saveUpdates(_0x118307,_0x139f7c){return function(_0x1b09e0){if(_0x1b09e0){return _0x1b09e0[_0xe946('0x26')](_0x118307)[_0xe946('0x27')](function(_0x1e0496){return _0x1e0496;});}return null;};}function removeEntity(_0x293197,_0x5c9dcf){return function(_0x583c20){if(_0x583c20){return _0x583c20[_0xe946('0x28')]()[_0xe946('0x27')](function(){_0x293197[_0xe946('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5395a8,_0x325b03){return function(_0x15f995){if(!_0x15f995){_0x5395a8[_0xe946('0x1b')](0x194);}return _0x15f995;};}function handleError(_0x54a7a3,_0x5a7b26){_0x5a7b26=_0x5a7b26||0x1f4;return function(_0x97c5ca){logger['error'](_0x97c5ca[_0xe946('0x29')]);if(_0x97c5ca[_0xe946('0x2a')]){delete _0x97c5ca[_0xe946('0x2a')];}_0x54a7a3['status'](_0x5a7b26)[_0xe946('0x2b')](_0x97c5ca);};}exports['index']=function(_0x5da043,_0x5cac72){var _0x4fb148={},_0x10ef26={},_0x50aee6={'count':0x0,'rows':[]};var _0x1bf6b1=_[_0xe946('0x2c')](db[_0xe946('0x2d')][_0xe946('0x2e')],function(_0x36603e){return{'name':_0x36603e[_0xe946('0x2f')],'type':_0x36603e[_0xe946('0x30')][_0xe946('0x31')]};});_0x10ef26['model']=_[_0xe946('0x2c')](_0x1bf6b1,_0xe946('0x2a'));_0x10ef26[_0xe946('0x32')]=_[_0xe946('0x33')](_0x5da043[_0xe946('0x32')]);_0x10ef26[_0xe946('0x34')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],_0x10ef26[_0xe946('0x32')]);_0x4fb148[_0xe946('0x37')]=_[_0xe946('0x35')](_0x10ef26[_0xe946('0x36')],qs['fields'](_0x5da043[_0xe946('0x32')][_0xe946('0x38')]));_0x4fb148[_0xe946('0x37')]=_0x4fb148[_0xe946('0x37')]['length']?_0x4fb148[_0xe946('0x37')]:_0x10ef26['model'];if(!_0x5da043[_0xe946('0x32')][_0xe946('0x39')](_0xe946('0x3a'))){_0x4fb148[_0xe946('0x1f')]=qs[_0xe946('0x1f')](_0x5da043[_0xe946('0x32')]['limit']);_0x4fb148[_0xe946('0x20')]=qs[_0xe946('0x20')](_0x5da043[_0xe946('0x32')][_0xe946('0x20')]);}_0x4fb148[_0xe946('0x3b')]=qs[_0xe946('0x3c')](_0x5da043[_0xe946('0x32')][_0xe946('0x3c')]);_0x4fb148[_0xe946('0x3d')]=qs['filters'](_[_0xe946('0x3e')](_0x5da043[_0xe946('0x32')],_0x10ef26['filters']),_0x1bf6b1);if(_0x5da043[_0xe946('0x32')][_0xe946('0x3f')]){_0x4fb148[_0xe946('0x3d')]=_[_0xe946('0x40')](_0x4fb148[_0xe946('0x3d')],{'$or':_[_0xe946('0x2c')](_0x1bf6b1,function(_0x3da745){if(_0x3da745[_0xe946('0x30')]!==_0xe946('0x41')){var _0x234df1={};_0x234df1[_0x3da745[_0xe946('0x2a')]]={'$like':'%'+_0x5da043[_0xe946('0x32')]['filter']+'%'};return _0x234df1;}})});}_0x4fb148=_[_0xe946('0x40')]({},_0x4fb148,_0x5da043[_0xe946('0x42')]);var _0x3e1d67={'where':_0x4fb148[_0xe946('0x3d')]};return db['Attachment']['count'](_0x3e1d67)['then'](function(_0x22aaba){_0x50aee6[_0xe946('0x21')]=_0x22aaba;if(_0x5da043[_0xe946('0x32')][_0xe946('0x43')]){_0x4fb148[_0xe946('0x44')]=[{'all':!![]}];}return db[_0xe946('0x2d')][_0xe946('0x45')](_0x4fb148);})[_0xe946('0x27')](function(_0x486665){_0x50aee6['rows']=_0x486665;return _0x50aee6;})[_0xe946('0x27')](respondWithFilteredResult(_0x5cac72,_0x4fb148))[_0xe946('0x46')](handleError(_0x5cac72,null));};exports[_0xe946('0x47')]=function(_0x2c23f8,_0x110ff9){var _0x3aa609={'raw':!![],'where':{'id':_0x2c23f8[_0xe946('0x48')]['id']}},_0x1ac248={};_0x1ac248[_0xe946('0x36')]=_[_0xe946('0x33')](db[_0xe946('0x2d')][_0xe946('0x2e')]);_0x1ac248[_0xe946('0x32')]=_[_0xe946('0x33')](_0x2c23f8[_0xe946('0x32')]);_0x1ac248[_0xe946('0x34')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],_0x1ac248['query']);_0x3aa609[_0xe946('0x37')]=_[_0xe946('0x35')](_0x1ac248[_0xe946('0x36')],qs[_0xe946('0x38')](_0x2c23f8['query'][_0xe946('0x38')]));_0x3aa609[_0xe946('0x37')]=_0x3aa609[_0xe946('0x37')][_0xe946('0x49')]?_0x3aa609[_0xe946('0x37')]:_0x1ac248[_0xe946('0x36')];if(_0x2c23f8['query'][_0xe946('0x43')]){_0x3aa609[_0xe946('0x44')]=[{'all':!![]}];}_0x3aa609=_['merge']({},_0x3aa609,_0x2c23f8[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x3aa609)[_0xe946('0x27')](handleEntityNotFound(_0x110ff9,null))[_0xe946('0x27')](respondWithResult(_0x110ff9,null))[_0xe946('0x46')](handleError(_0x110ff9,null));};exports[_0xe946('0x4b')]=function(_0x17dad0,_0x21844f){var _0x8b1615={'where':{'id':_0x17dad0[_0xe946('0x48')]['id']}},_0x5487bc={};_0x5487bc[_0xe946('0x36')]=_[_0xe946('0x33')](db['Attachment'][_0xe946('0x2e')]);_0x8b1615[_0xe946('0x37')]=_[_0xe946('0x35')](_0x5487bc['model'],qs[_0xe946('0x38')](_0x17dad0[_0xe946('0x32')][_0xe946('0x38')]));_0x8b1615['attributes']=_0x8b1615[_0xe946('0x37')][_0xe946('0x49')]?_0x8b1615['attributes']:_0x5487bc[_0xe946('0x36')];if(_0x17dad0[_0xe946('0x32')]['includeAll']){_0x8b1615[_0xe946('0x44')]=[{'all':!![]}];}_0x8b1615=_[_0xe946('0x40')]({},_0x8b1615,_0x17dad0[_0xe946('0x42')]);return db[_0xe946('0x2d')][_0xe946('0x4a')](_0x8b1615)[_0xe946('0x27')](handleEntityNotFound(_0x21844f,null))[_0xe946('0x27')](function(_0x324140){if(_0x324140){var _0x5a8f62=_0x324140[_0xe946('0x4c')]({'plain':!![]});_0x5a8f62=qs['omit'](_0x5a8f62,['id','createdAt',_0xe946('0x4d')]);_0x17dad0[_0xe946('0x4e')]=_['omit'](_0x17dad0['body'],['id',_0xe946('0x4f'),_0xe946('0x4d')]);return db['Attachment'][_0xe946('0x50')](_[_0xe946('0x40')](_0x5a8f62,_0x17dad0[_0xe946('0x4e')]),{'include':_0x17dad0[_0xe946('0x32')][_0xe946('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x21844f,0xc9))[_0xe946('0x46')](handleError(_0x21844f,null));};exports[_0xe946('0x26')]=function(_0x126fab,_0x339ab2){if(_0x126fab['body']['id']){delete _0x126fab[_0xe946('0x4e')]['id'];}return db[_0xe946('0x2d')][_0xe946('0x4a')]({'where':{'id':_0x126fab[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x339ab2,null))[_0xe946('0x27')](saveUpdates(_0x126fab[_0xe946('0x4e')],null))[_0xe946('0x27')](respondWithResult(_0x339ab2,null))[_0xe946('0x46')](handleError(_0x339ab2,null));};exports[_0xe946('0x28')]=function(_0xbac5c0,_0x5c832c){return db[_0xe946('0x2d')]['find']({'where':{'id':_0xbac5c0[_0xe946('0x48')]['id']}})[_0xe946('0x27')](handleEntityNotFound(_0x5c832c,null))['then'](removeEntity(_0x5c832c,null))['catch'](handleError(_0x5c832c,null));};exports[_0xe946('0x50')]=function(_0x26c754,_0xeb89e1,_0x2279a4){_0x26c754['body'][_0xe946('0x2a')]=_0x26c754[_0xe946('0x51')][_0xe946('0x52')];_0x26c754['body']['basename']=_0x26c754[_0xe946('0x51')][_0xe946('0x53')];_0x26c754['body'][_0xe946('0x30')]=_0x26c754[_0xe946('0x51')]['mimetype'];return db[_0xe946('0x2d')]['create'](_0x26c754[_0xe946('0x4e')])[_0xe946('0x27')](respondWithResult(_0xeb89e1,0xc9))[_0xe946('0x46')](handleError(_0xeb89e1,null));};exports[_0xe946('0x54')]=function(_0x369e02,_0x32333d,_0x34570e){return db[_0xe946('0x2d')][_0xe946('0x55')]({'where':{'id':_0x369e02[_0xe946('0x48')]['id']},'raw':!![]})[_0xe946('0x27')](handleEntityNotFound(_0x32333d,null))[_0xe946('0x27')](function(_0x24d6e7){if(_0x24d6e7){var _0x4825fc=_0x24d6e7[_0xe946('0x56')]!==null;var _0x61c191=path['join'](config[_0xe946('0x57')],_0xe946('0x58'));if(_0x4825fc){_0x61c191=path[_0xe946('0x59')](_0x61c191,'offline-chat/');}var _0xd6bc11=path[_0xe946('0x59')](_0x61c191,_0x24d6e7[_0xe946('0x5a')]);return _0x32333d['download'](_0xd6bc11);}})[_0xe946('0x46')](handleError(_0x32333d,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index cae24a6..389b06f 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 _0x24f2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./attachment.attributes','define','Attachment'];(function(_0x27c25f,_0x4ff5fe){var _0x2da4c4=function(_0x1f3c9a){while(--_0x1f3c9a){_0x27c25f['push'](_0x27c25f['shift']());}};_0x2da4c4(++_0x4ff5fe);}(_0x24f2,0x11e));var _0x224f=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0x24f2[_0x3e961c];return _0x474f9c;};'use strict';var _=require(_0x224f('0x0'));var util=require(_0x224f('0x1'));var logger=require(_0x224f('0x2'))(_0x224f('0x3'));var moment=require(_0x224f('0x4'));var BPromise=require(_0x224f('0x5'));var rp=require(_0x224f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x224f('0x7'));var config=require('../../config/environment');var attributes=require(_0x224f('0x8'));module['exports']=function(_0x4ddef1,_0xd2f71b){return _0x4ddef1[_0x224f('0x9')](_0x224f('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5248=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','lodash','../../config/logger','api','moment'];(function(_0x232caf,_0x358822){var _0x4a5781=function(_0x33beeb){while(--_0x33beeb){_0x232caf['push'](_0x232caf['shift']());}};_0x4a5781(++_0x358822);}(_0x5248,0x1f4));var _0x8524=function(_0x1a31e5,_0x28b0da){_0x1a31e5=_0x1a31e5-0x0;var _0x14eff7=_0x5248[_0x1a31e5];return _0x14eff7;};'use strict';var _=require(_0x8524('0x0'));var util=require('util');var logger=require(_0x8524('0x1'))(_0x8524('0x2'));var moment=require(_0x8524('0x3'));var BPromise=require(_0x8524('0x4'));var rp=require(_0x8524('0x5'));var fs=require('fs');var path=require(_0x8524('0x6'));var rimraf=require(_0x8524('0x7'));var config=require(_0x8524('0x8'));var attributes=require(_0x8524('0x9'));module[_0x8524('0xa')]=function(_0x120e9d,_0x476c72){return _0x120e9d[_0x8524('0xb')]('Attachment',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 71a1437..3ee86cb 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 _0x4517=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','CreateAttachment','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4517,0x112));var _0x7451=function(_0x1d30b5,_0x5265f2){_0x1d30b5=_0x1d30b5-0x0;var _0x16c997=_0x4517[_0x1d30b5];return _0x16c997;};'use strict';var _=require('lodash');var util=require(_0x7451('0x0'));var moment=require(_0x7451('0x1'));var BPromise=require('bluebird');var rs=require(_0x7451('0x2'));var fs=require('fs');var Redis=require(_0x7451('0x3'));var db=require(_0x7451('0x4'))['db'];var utils=require(_0x7451('0x5'));var logger=require(_0x7451('0x6'))(_0x7451('0x7'));var config=require(_0x7451('0x8'));var jayson=require(_0x7451('0x9'));var client=jayson[_0x7451('0xa')][_0x7451('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ac271,_0x1bfc08,_0x26306e){return new BPromise(function(_0x443b80,_0x2c2ace){return client[_0x7451('0xc')](_0x3ac271,_0x26306e)[_0x7451('0xd')](function(_0x4b7888){logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));logger[_0x7451('0x11')](_0x7451('0x12'),_0x1bfc08,_0x7451('0x10'),JSON[_0x7451('0x13')](_0x4b7888));if(_0x4b7888['error']){if(_0x4b7888['error'][_0x7451('0x14')]===0x1f4){logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')]['message']);return _0x2c2ace(_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);}logger['error'](_0x7451('0xf'),_0x1bfc08,_0x4b7888[_0x7451('0x15')][_0x7451('0x16')]);return _0x443b80(_0x4b7888[_0x7451('0x15')]['message']);}else{logger[_0x7451('0xe')](_0x7451('0xf'),_0x1bfc08,_0x7451('0x10'));_0x443b80(_0x4b7888['result']['message']);}})[_0x7451('0x17')](function(_0x1db688){logger[_0x7451('0x15')](_0x7451('0xf'),_0x1bfc08,_0x1db688);_0x2c2ace(_0x1db688);});});}exports[_0x7451('0x18')]=function(_0xd47ee4){var _0x31a4b2=this;return new Promise(function(_0x1120b1,_0x125ab1){return db['Attachment'][_0x7451('0x19')](_0xd47ee4[_0x7451('0x1a')],{'raw':_0xd47ee4[_0x7451('0x1b')]?_0xd47ee4['options'][_0x7451('0x1c')]===undefined?!![]:![]:!![]})[_0x7451('0xd')](function(_0x3ffb08){logger[_0x7451('0xe')](_0x7451('0x18'),_0xd47ee4);logger[_0x7451('0x11')](_0x7451('0x18'),_0xd47ee4,JSON['stringify'](_0x3ffb08));_0x1120b1(_0x3ffb08);})[_0x7451('0x17')](function(_0x309be0){logger['error'](_0x7451('0x18'),_0x309be0[_0x7451('0x16')],_0xd47ee4);_0x125ab1(_0x31a4b2[_0x7451('0x15')](0x1f4,_0x309be0['message']));});});}; \ No newline at end of file +var _0xf874=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','moment','bluebird','randomstring'];(function(_0x1c80bd,_0x356976){var _0x15b7fc=function(_0x1ad2a){while(--_0x1ad2a){_0x1c80bd['push'](_0x1c80bd['shift']());}};_0x15b7fc(++_0x356976);}(_0xf874,0xed));var _0x4f87=function(_0x5465c3,_0x9698c4){_0x5465c3=_0x5465c3-0x0;var _0x2ee395=_0xf874[_0x5465c3];return _0x2ee395;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f87('0x0'));var BPromise=require(_0x4f87('0x1'));var rs=require(_0x4f87('0x2'));var fs=require('fs');var Redis=require(_0x4f87('0x3'));var db=require(_0x4f87('0x4'))['db'];var utils=require(_0x4f87('0x5'));var logger=require('../../config/logger')(_0x4f87('0x6'));var config=require(_0x4f87('0x7'));var jayson=require(_0x4f87('0x8'));var client=jayson[_0x4f87('0x9')][_0x4f87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44fea6,_0x4a0662,_0x3a89e3){return new BPromise(function(_0x194853,_0x592008){return client[_0x4f87('0xb')](_0x44fea6,_0x3a89e3)[_0x4f87('0xc')](function(_0x4d8354){logger[_0x4f87('0xd')](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4a0662,_0x4f87('0xf'),JSON[_0x4f87('0x12')](_0x4d8354));if(_0x4d8354['error']){if(_0x4d8354['error'][_0x4f87('0x13')]===0x1f4){logger[_0x4f87('0x14')](_0x4f87('0xe'),_0x4a0662,_0x4d8354['error']['message']);return _0x592008(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}logger[_0x4f87('0x14')]('Attachment,\x20%s,\x20%s',_0x4a0662,_0x4d8354[_0x4f87('0x14')]['message']);return _0x194853(_0x4d8354[_0x4f87('0x14')][_0x4f87('0x15')]);}else{logger['info'](_0x4f87('0xe'),_0x4a0662,_0x4f87('0xf'));_0x194853(_0x4d8354[_0x4f87('0x16')][_0x4f87('0x15')]);}})[_0x4f87('0x17')](function(_0x3bd90f){logger['error'](_0x4f87('0xe'),_0x4a0662,_0x3bd90f);_0x592008(_0x3bd90f);});});}exports['CreateAttachment']=function(_0x10551e){var _0x6a3017=this;return new Promise(function(_0x46492d,_0x42c399){return db[_0x4f87('0x18')][_0x4f87('0x19')](_0x10551e[_0x4f87('0x1a')],{'raw':_0x10551e[_0x4f87('0x1b')]?_0x10551e[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![]})[_0x4f87('0xc')](function(_0x2c13a0){logger[_0x4f87('0xd')]('CreateAttachment',_0x10551e);logger['debug'](_0x4f87('0x1d'),_0x10551e,JSON[_0x4f87('0x12')](_0x2c13a0));_0x46492d(_0x2c13a0);})['catch'](function(_0x592edd){logger[_0x4f87('0x14')]('CreateAttachment',_0x592edd['message'],_0x10551e);_0x42c399(_0x6a3017[_0x4f87('0x14')](0x1f4,_0x592edd[_0x4f87('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index bb66a02..ce38a5c 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(_0x164d8d,_0x48184c){var _0x5c6b35=function(_0xe9cf76){while(--_0xe9cf76){_0x164d8d['push'](_0x164d8d['shift']());}};_0x5c6b35(++_0x48184c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7eaa5d,_0x2fab26){_0x7eaa5d=_0x7eaa5d-0x0;var _0x327825=_0x5f2f[_0x7eaa5d];return _0x327825;};'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(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x0b0e,0x187));var _0xe0b0=function(_0x54d49e,_0x5d9911){_0x54d49e=_0x54d49e-0x0;var _0x4af0f1=_0x0b0e[_0x54d49e];return _0x4af0f1;};'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 7530bda..4061a18 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 _0xc727=['role','admin','user','agent','then','name','disabled','blocked','blockedAt','add','getLicense','catch','status','send','message','ad-login','signToken','json','online','use','passport','passport-local','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','api','undefined','activedirectory','url','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','password'];(function(_0x1e51b8,_0x46ae21){var _0x2b5c9a=function(_0xdbb7a){while(--_0xdbb7a){_0x1e51b8['push'](_0x1e51b8['shift']());}};_0x2b5c9a(++_0x46ae21);}(_0xc727,0x16c));var _0x7c72=function(_0x11816c,_0x136fde){_0x11816c=_0x11816c-0x0;var _0x5f27d0=_0xc727[_0x11816c];return _0x5f27d0;};'use strict';var passport=require(_0x7c72('0x0'));var LocalStrategy=require(_0x7c72('0x1'))['Strategy'];var moment=require('moment');var ActiveDirectory=require(_0x7c72('0x2'));var BPromise=require(_0x7c72('0x3'));var util=require(_0x7c72('0x4'));var db=require(_0x7c72('0x5'))['db'];var authService=require(_0x7c72('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x7c72('0x7'))(_0x7c72('0x8'));function isActiveDirectoryConfigured(_0x228abf){var _0x1dca72=![];if(typeof _0x228abf['activedirectory']!==_0x7c72('0x9')){_0x1dca72=_0x228abf['activedirectory']['baseDN']&&_0x228abf[_0x7c72('0xa')][_0x7c72('0xb')]&&_0x228abf['activedirectory'][_0x7c72('0xc')];}return _0x1dca72;}function adAuthenticate(_0x2af509,_0x1dbb92,_0x3aef80){return new BPromise(function(_0x4445e7,_0x2761fe){try{var _0x2b3d99=new ActiveDirectory(_0x2af509);_0x2b3d99[_0x7c72('0xd')](_0x1dbb92,_0x3aef80,function(_0x4ad971,_0x3fdacb){if(_0x4ad971){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x1dbb92,util[_0x7c72('0xe')](_0x4ad971,{'showHidden':![],'depth':null}));_0x2761fe(_0x7c72('0xf'));}else if(!_0x3fdacb){logger[_0x7c72('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x1dbb92);_0x2761fe(_0x7c72('0xf'));}else{_0x4445e7(_0x3fdacb);}});}catch(_0x485333){_0x2761fe(_0x485333);}});}function ActiveDirectoryAuthenticate(_0x579ebc,_0x5bc266,_0x2d4633,_0x120bf4){var _0x17bac7,_0x20e4a5;if(!isActiveDirectoryConfigured(config)){logger[_0x7c72('0x10')](_0x7c72('0x11'),_0x5bc266);return _0x120bf4(null,![],{'message':_0x7c72('0xf')});}return db[_0x7c72('0x12')][_0x7c72('0x13')]({'where':{'id':0x1},'attributes':[_0x7c72('0x14'),_0x7c72('0x15')],'raw':!![]})['then'](function(_0x353bbb){_0x17bac7=_0x353bbb;if(!_0x17bac7[_0x7c72('0x14')]){logger[_0x7c72('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x5bc266);throw new Error(_0x7c72('0xf'));}return _0x579ebc[_0x7c72('0x13')]({'logging':!![],'attributes':['id','name',_0x7c72('0x16'),'salt',_0x7c72('0x17'),'disabled','blocked','blockedAt','online'],'where':{'name':_0x5bc266,'role':{'$or':[_0x7c72('0x18'),_0x7c72('0x19'),_0x7c72('0x1a')]},'adSsoEnabled':!![]}});})[_0x7c72('0x1b')](function(_0x4cc47a){if(!_0x4cc47a||_0x4cc47a&&_0x4cc47a[_0x7c72('0x1c')]!==_0x5bc266){throw new Error(_0x7c72('0xf'));}_0x20e4a5=_0x4cc47a;var _0x37b379=_0x20e4a5[_0x7c72('0x1c')]+'@'+config[_0x7c72('0xa')][_0x7c72('0xc')];return adAuthenticate(config['activedirectory'],_0x37b379,_0x2d4633);})['then'](function(_0x1be2d6){if(_0x20e4a5[_0x7c72('0x1d')]){throw new Error(_0x7c72('0xf'));}if(_0x17bac7[_0x7c72('0x15')]>0x0){if(_0x20e4a5[_0x7c72('0x1e')]){if(moment(_0x20e4a5[_0x7c72('0x1f')])[_0x7c72('0x20')](_0x17bac7['blockDuration'],'minutes')>moment()){throw new Error(_0x7c72('0xf'));}return utils['clearBlockUser'](_0x20e4a5,0x0,![],null)[_0x7c72('0x1b')](function(){return utils['getLicense'](_0x20e4a5);})[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}else{return utils[_0x7c72('0x21')](_0x20e4a5)[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}}else{return utils[_0x7c72('0x21')](_0x20e4a5)[_0x7c72('0x1b')](function(){return _0x120bf4(null,_0x20e4a5);});}})[_0x7c72('0x22')](function(_0x1b9510){return _0x120bf4(null,![],_0x1b9510);});}function handleError(_0x410bc2,_0x68c10d,_0x261007){return _0x410bc2[_0x7c72('0x23')](_0x68c10d||0x1f4)[_0x7c72('0x24')]({'message':_0x261007?_0x261007[_0x7c72('0x25')]||_0x261007:''});}exports['login']=function(_0x44dcd0,_0x52f23d,_0x39f50d){passport['authenticate'](_0x7c72('0x26'),function(_0xdc225b,_0x26dcf6,_0x55d5ea){var _0x1f4925=_0xdc225b||_0x55d5ea;if(_0x1f4925){return handleError(_0x52f23d,0x191,_0x1f4925);}if(!_0x26dcf6){return handleError(_0x52f23d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4b389c={'payload':{'id':_0x26dcf6['id'],'role':_0x26dcf6['role']},'options':{'expiresIn':0x15180}};return authService[_0x7c72('0x27')](_0x4b389c)[_0x7c72('0x1b')](function(_0x5c39dc){_0x52f23d[_0x7c72('0x28')]({'id':_0x26dcf6['id'],'token':_0x5c39dc,'statusCall':'','isAlreadyLogged':_0x26dcf6[_0x7c72('0x29')]});});}})(_0x44dcd0,_0x52f23d,_0x39f50d);};passport[_0x7c72('0x2a')](_0x7c72('0x26'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x6a56d6,_0x44324d,_0x14c85){return ActiveDirectoryAuthenticate(db['User'],_0x6a56d6,_0x44324d,_0x14c85);})); \ No newline at end of file +var _0x194c=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','minutes','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x194c,0x19b));var _0xc194=function(_0x4e8452,_0xf5645a){_0x4e8452=_0x4e8452-0x0;var _0x2b97f4=_0x194c[_0x4e8452];return _0x2b97f4;};'use strict';var passport=require(_0xc194('0x0'));var LocalStrategy=require(_0xc194('0x1'))[_0xc194('0x2')];var moment=require(_0xc194('0x3'));var ActiveDirectory=require(_0xc194('0x4'));var BPromise=require(_0xc194('0x5'));var util=require(_0xc194('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xc194('0x7'));var utils=require(_0xc194('0x8'));var config=require(_0xc194('0x9'));var logger=require(_0xc194('0xa'))(_0xc194('0xb'));function isActiveDirectoryConfigured(_0x330147){var _0x17462b=![];if(typeof _0x330147[_0xc194('0xc')]!==_0xc194('0xd')){_0x17462b=_0x330147[_0xc194('0xc')]['baseDN']&&_0x330147[_0xc194('0xc')]['url']&&_0x330147[_0xc194('0xc')][_0xc194('0xe')];}return _0x17462b;}function adAuthenticate(_0x7a75b9,_0x5bdc73,_0x3f547c){return new BPromise(function(_0x5608d8,_0x52124e){try{var _0x35c2c2=new ActiveDirectory(_0x7a75b9);_0x35c2c2[_0xc194('0xf')](_0x5bdc73,_0x3f547c,function(_0xb8bcd2,_0x585768){if(_0xb8bcd2){logger[_0xc194('0x10')](_0xc194('0x11'),_0x5bdc73,util[_0xc194('0x12')](_0xb8bcd2,{'showHidden':![],'depth':null}));_0x52124e(_0xc194('0x13'));}else if(!_0x585768){logger['error'](_0xc194('0x14'),_0x5bdc73);_0x52124e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5608d8(_0x585768);}});}catch(_0x14920a){_0x52124e(_0x14920a);}});}function ActiveDirectoryAuthenticate(_0x3b832d,_0x4222bd,_0x4ad6c2,_0x46a877){var _0x34a170,_0x4abcc7;if(!isActiveDirectoryConfigured(config)){logger[_0xc194('0x10')](_0xc194('0x15'),_0x4222bd);return _0x46a877(null,![],{'message':_0xc194('0x13')});}return db['Setting'][_0xc194('0x16')]({'where':{'id':0x1},'attributes':[_0xc194('0x17'),_0xc194('0x18')],'raw':!![]})[_0xc194('0x19')](function(_0x16789f){_0x34a170=_0x16789f;if(!_0x34a170[_0xc194('0x17')]){logger['error'](_0xc194('0x1a'),_0x4222bd);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3b832d[_0xc194('0x16')]({'logging':!![],'attributes':['id',_0xc194('0x1b'),_0xc194('0x1c'),_0xc194('0x1d'),_0xc194('0x1e'),_0xc194('0x1f'),_0xc194('0x20'),_0xc194('0x21'),_0xc194('0x22')],'where':{'name':_0x4222bd,'role':{'$or':['admin',_0xc194('0x23'),_0xc194('0x24')]},'adSsoEnabled':!![]}});})['then'](function(_0xdeb133){if(!_0xdeb133||_0xdeb133&&_0xdeb133[_0xc194('0x1b')]!==_0x4222bd){throw new Error(_0xc194('0x13'));}_0x4abcc7=_0xdeb133;var _0x13e98a=_0x4abcc7['name']+'@'+config[_0xc194('0xc')][_0xc194('0xe')];return adAuthenticate(config[_0xc194('0xc')],_0x13e98a,_0x4ad6c2);})[_0xc194('0x19')](function(_0x279adb){if(_0x4abcc7['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x34a170[_0xc194('0x18')]>0x0){if(_0x4abcc7[_0xc194('0x20')]){if(moment(_0x4abcc7[_0xc194('0x21')])['add'](_0x34a170[_0xc194('0x18')],_0xc194('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x4abcc7,0x0,![],null)[_0xc194('0x19')](function(){return utils[_0xc194('0x26')](_0x4abcc7);})['then'](function(){return _0x46a877(null,_0x4abcc7);});}else{return utils[_0xc194('0x26')](_0x4abcc7)['then'](function(){return _0x46a877(null,_0x4abcc7);});}}else{return utils[_0xc194('0x26')](_0x4abcc7)[_0xc194('0x19')](function(){return _0x46a877(null,_0x4abcc7);});}})[_0xc194('0x27')](function(_0x370f90){return _0x46a877(null,![],_0x370f90);});}function handleError(_0x1e30a9,_0x284d89,_0x567d7f){return _0x1e30a9[_0xc194('0x28')](_0x284d89||0x1f4)[_0xc194('0x29')]({'message':_0x567d7f?_0x567d7f['message']||_0x567d7f:''});}exports[_0xc194('0x2a')]=function(_0x364641,_0x9e77a1,_0x2bbb47){passport['authenticate'](_0xc194('0x2b'),function(_0x88598c,_0x54b6e9,_0x19cbbb){var _0x6ebb26=_0x88598c||_0x19cbbb;if(_0x6ebb26){return handleError(_0x9e77a1,0x191,_0x6ebb26);}if(!_0x54b6e9){return handleError(_0x9e77a1,0x194,{'message':_0xc194('0x2c')});}else{var _0x4f335a={'payload':{'id':_0x54b6e9['id'],'role':_0x54b6e9[_0xc194('0x1e')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4f335a)[_0xc194('0x19')](function(_0x45b007){_0x9e77a1[_0xc194('0x2d')]({'id':_0x54b6e9['id'],'token':_0x45b007,'statusCall':'','isAlreadyLogged':_0x54b6e9[_0xc194('0x22')]});});}})(_0x364641,_0x9e77a1,_0x2bbb47);};passport[_0xc194('0x2e')]('ad-login',new LocalStrategy({'usernameField':_0xc194('0x1b'),'passwordField':_0xc194('0x1c')},function(_0x19b599,_0x4a003b,_0xc2cb8e){return ActiveDirectoryAuthenticate(db[_0xc194('0x2f')],_0x19b599,_0x4a003b,_0xc2cb8e);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 9acf6e9..d2acb13 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 _0x176c=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x176c,0x68));var _0xc176=function(_0x1d9897,_0x3a9d74){_0x1d9897=_0x1d9897-0x0;var _0x18f24d=_0x176c[_0x1d9897];return _0x18f24d;};'use strict';var express=require(_0xc176('0x0'));var router=express['Router']();var controller=require(_0xc176('0x1'));router[_0xc176('0x2')]('/',controller[_0xc176('0x3')]);module[_0xc176('0x4')]=router; \ No newline at end of file +var _0xf6eb=['express','login','exports'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf6eb,0xb4));var _0xbf6e=function(_0x290700,_0x22b692){_0x290700=_0x290700-0x0;var _0x1cd47d=_0xf6eb[_0x290700];return _0x1cd47d;};'use strict';var express=require(_0xbf6e('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0xbf6e('0x1')]);module[_0xbf6e('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index fd03c3b..6f5d2b3 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(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x5e261f,_0x572205){_0x5e261f=_0x5e261f-0x0;var _0x2f1ea4=_0x7a54[_0x5e261f];return _0x2f1ea4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x4ff94f,_0x14c098){var _0x446781=function(_0x30372e){while(--_0x30372e){_0x4ff94f['push'](_0x4ff94f['shift']());}};_0x446781(++_0x14c098);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 140cc4b..5ebb8a5 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 _0x24ba=['../../components/auth/service','get','login','isMiddleware','express','Router','../user/user.controller.js'];(function(_0x48a6cb,_0x2f146f){var _0x12e4d8=function(_0x81faca){while(--_0x81faca){_0x48a6cb['push'](_0x48a6cb['shift']());}};_0x12e4d8(++_0x2f146f);}(_0x24ba,0xf2));var _0xa24b=function(_0x5d76ad,_0x26158d){_0x5d76ad=_0x5d76ad-0x0;var _0x4f7937=_0x24ba[_0x5d76ad];return _0x4f7937;};'use strict';var express=require(_0xa24b('0x0'));var passport=require('passport');var router=express[_0xa24b('0x1')]();var controller=require('./authGoogle.controller');var userController=require(_0xa24b('0x2'));var authService=require(_0xa24b('0x3'));router[_0xa24b('0x4')]('/',controller[_0xa24b('0x5')]);router[_0xa24b('0x4')]('/callback',controller['callback'],authService[_0xa24b('0x6')],userController[_0xa24b('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xea1c=['callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var passport=require(_0xcea1('0x0'));var router=express[_0xcea1('0x1')]();var controller=require(_0xcea1('0x2'));var userController=require(_0xcea1('0x3'));var authService=require(_0xcea1('0x4'));router['get']('/',controller[_0xcea1('0x5')]);router[_0xcea1('0x6')]('/callback',controller[_0xcea1('0x7')],authService[_0xcea1('0x8')],userController[_0xcea1('0x5')],authService[_0xcea1('0x9')]);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 21ee814..43f6564 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 _0x830b=['Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','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','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','add','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','getLicense','catch','find','email','MailServerOut'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x830b,0xd2));var _0xb830=function(_0x4b1bd3,_0x506647){_0x4b1bd3=_0x4b1bd3-0x0;var _0xacb11f=_0x830b[_0x4b1bd3];return _0xacb11f;};'use strict';var util=require(_0xb830('0x0'));var passport=require(_0xb830('0x1'));var LocalStrategy=require(_0xb830('0x2'))['Strategy'];var jayson=require(_0xb830('0x3'));var _=require(_0xb830('0x4'));var rs=require(_0xb830('0x5'));var moment=require(_0xb830('0x6'));var db=require(_0xb830('0x7'))['db'];var authService=require(_0xb830('0x8'));var utils=require(_0xb830('0x9'));var client=jayson[_0xb830('0xa')][_0xb830('0xb')]({'port':0x232b});function localAuthenticate(_0x58ad64,_0x3c3882,_0x20975e,_0x55475e){var _0x400c09,_0x25e56d;return db[_0xb830('0xc')][_0xb830('0xd')]({'where':{'id':0x1},'attributes':[_0xb830('0xe'),_0xb830('0xf')],'raw':!![]})[_0xb830('0x10')](function(_0x393054){_0x400c09=_0x393054;return _0x58ad64[_0xb830('0xd')]({'attributes':['id',_0xb830('0x11'),_0xb830('0x12'),'salt',_0xb830('0x13'),_0xb830('0x14'),_0xb830('0x15'),_0xb830('0x16'),_0xb830('0x17')],'where':{'name':_0x3c3882,'role':{'$or':[_0xb830('0x18'),_0xb830('0x19'),_0xb830('0x1a')]}}});})[_0xb830('0x10')](function(_0x24e083){if(!_0x24e083||_0x24e083&&_0x24e083[_0xb830('0x11')]!==_0x3c3882){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x25e56d=_0x24e083;return _0x25e56d;}})[_0xb830('0x10')](function(){_0x25e56d['authenticate'](_0x20975e,function(_0x52377b,_0x339b1f){var _0x856c44=_0x25e56d[_0xb830('0x17')]+0x1;if(_0x52377b){return _0x55475e(_0x52377b);}else if(!_0x339b1f){if(_0x25e56d['disabled']){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x400c09[_0xb830('0xe')]>0x0){if(_0x25e56d[_0xb830('0x15')]){if(_0x400c09[_0xb830('0xf')]>0x0){if(moment(_0x25e56d[_0xb830('0x16')])[_0xb830('0x1b')](_0x400c09[_0xb830('0xf')],_0xb830('0x1c'))>moment()){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb830('0x1d')](_0x25e56d,_0x856c44,![],null)[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x856c44>=_0x400c09[_0xb830('0xe')]){return utils[_0xb830('0x1d')](_0x25e56d,0x0,!![],moment())[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':_0xb830('0x1e')});});}else{return utils[_0xb830('0x1d')](_0x25e56d,_0x856c44,![],null)[_0xb830('0x10')](function(){return _0x55475e(null,![],{'message':_0xb830('0x1e')});});}}}else{return _0x55475e(null,![],{'message':_0xb830('0x1e')});}}else{if(_0x25e56d[_0xb830('0x14')]){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else if(_0x400c09[_0xb830('0xe')]>0x0){if(_0x25e56d[_0xb830('0x15')]){if(_0x400c09[_0xb830('0xf')]>0x0){if(moment(_0x25e56d[_0xb830('0x16')])[_0xb830('0x1b')](_0x400c09[_0xb830('0xf')],_0xb830('0x1c'))>moment()){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else{return utils[_0xb830('0x1d')](_0x25e56d,0x0,![],null)['then'](function(){return utils[_0xb830('0x1f')](_0x25e56d);})[_0xb830('0x10')](function(){return _0x55475e(null,_0x25e56d);});}}else{return _0x55475e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xb830('0x1d')](_0x25e56d,0x0,![],null)[_0xb830('0x10')](function(){return utils['getLicense'](_0x25e56d);})[_0xb830('0x10')](function(){return _0x55475e(null,_0x25e56d);})[_0xb830('0x20')](function(_0x1bcca7){return _0x55475e(null,![],_0x1bcca7);});}}else{if(_0x25e56d[_0xb830('0x15')]){return _0x55475e(null,![],{'message':_0xb830('0x1e')});}else{return utils[_0xb830('0x1f')](_0x25e56d)['then'](function(){return _0x55475e(null,_0x25e56d);});}}}});})[_0xb830('0x20')](function(_0x4c5f0d){return _0x55475e(null,![],_0x4c5f0d);});}function sendServiceMail(_0x56dc52){return db['MailAccount'][_0xb830('0x21')]({'where':{'service':!![]},'attributes':['id',_0xb830('0x11'),_0xb830('0x22')],'include':[{'model':db[_0xb830('0x23')],'as':_0xb830('0x24'),'include':[{'model':db[_0xb830('0x25')],'as':_0xb830('0x25')}]}]})['then'](function(_0x2d53ef){if(!_0x2d53ef){throw new Error(_0xb830('0x26'));}var _0x2bf2a5=_0x2d53ef[_0xb830('0x27')]();var _0x3f662b={'account':_0x2bf2a5,'message':_[_0xb830('0x28')]({'from':util[_0xb830('0x29')](_0xb830('0x2a'),_0x2d53ef[_0xb830('0x11')],_0x2d53ef[_0xb830('0x22')]||_0x2d53ef['Smtp'][_0xb830('0x19')])},_0x56dc52)};return client[_0xb830('0x2b')](_0xb830('0x2c'),_0x3f662b);})[_0xb830('0x10')](function(_0x5a8a2a){if(_0x5a8a2a['error']){throw new Error(util[_0xb830('0x29')](_0xb830('0x2d'),_0x5a8a2a[_0xb830('0x2e')][_0xb830('0x2f')]||JSON[_0xb830('0x30')](_0x5a8a2a[_0xb830('0x2e')])));}return!![];});}function handleError(_0x4768a1,_0x54f215,_0x4c2fe4){return _0x4768a1[_0xb830('0x31')](_0x54f215||0x1f4)[_0xb830('0x32')]({'message':_0x4c2fe4?_0x4c2fe4['message']||_0x4c2fe4:''});}exports[_0xb830('0x33')]=function(_0x1df864,_0x825782,_0x3d2a5){passport['authenticate'](_0xb830('0x34'),function(_0x6e9d66,_0x9c8d9d,_0x45bd41){var _0x40354a=_0x6e9d66||_0x45bd41;if(_0x40354a){return handleError(_0x825782,0x191,_0x40354a);}if(!_0x9c8d9d){return handleError(_0x825782,0x194,{'message':_0xb830('0x35')});}else{var _0x4aceca={'payload':{'id':_0x9c8d9d['id'],'role':_0x9c8d9d['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4aceca)['then'](function(_0x9d9f6d){_0x825782[_0xb830('0x36')]({'id':_0x9c8d9d['id'],'token':_0x9d9f6d,'statusCall':'','isAlreadyLogged':_0x9c8d9d['online']});});}})(_0x1df864,_0x825782,_0x3d2a5);};exports[_0xb830('0x37')]=function(_0x3e1af5,_0x4b5d03){if(!_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')]){return handleError(_0x4b5d03,0x1f4,{'message':_0xb830('0x39')});}var _0x3280b4=rs[_0xb830('0x3a')]();_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')]=_0x3e1af5['body'][_0xb830('0x22')][_0xb830('0x3b')]()[_0xb830('0x3c')]();var _0x5e6ffd;return db[_0xb830('0xc')][_0xb830('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xb830('0x10')](function(_0xe260e1){_0x5e6ffd=_0xe260e1;return db['User'][_0xb830('0x21')]({'where':{'email':_0x3e1af5[_0xb830('0x38')]['email']}});})[_0xb830('0x10')](function(_0x55c179){if(!_0x55c179){throw new Error(_0xb830('0x3d'));}if(_0x55c179[_0xb830('0x14')]){throw new Error(_0xb830('0x3e'));}if(_0x55c179[_0xb830('0x15')]){if(moment(_0x55c179[_0xb830('0x16')])['add'](_0x5e6ffd[_0xb830('0xf')],_0xb830('0x1c'))>moment()){throw new Error(_0xb830('0x3f'));}else{_0x55c179[_0xb830('0x15')]=![];_0x55c179[_0xb830('0x16')]=null;}}_0x55c179[_0xb830('0x40')]=_0x3280b4;_0x55c179[_0xb830('0x41')]=Date[_0xb830('0x42')]()+0x36ee80;return _0x55c179['save']();})[_0xb830('0x10')](function(){return sendServiceMail({'to':_0x3e1af5[_0xb830('0x38')][_0xb830('0x22')],'subject':_0xb830('0x43'),'text':_0xb830('0x44')+_0xb830('0x45')+'https://'+_0x3e1af5['headers'][_0xb830('0x46')]+'/reset/'+_0x3280b4+'\x0a\x0a'+_0xb830('0x47')});})[_0xb830('0x10')](function(){_0x4b5d03[_0xb830('0x31')](0xc8)[_0xb830('0x32')]({'message':_0xb830('0x48')});})[_0xb830('0x20')](function(_0x2f4d50){return handleError(_0x4b5d03,0x1f4,_0x2f4d50);});};exports[_0xb830('0x49')]=function(_0x426ee9,_0x3b212e){return db['User']['find']({'where':{'resetPasswordToken':_0x426ee9['params'][_0xb830('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xb830('0x42')]()}}})[_0xb830('0x10')](function(_0x4ed9e1){if(!_0x4ed9e1){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xb830('0xd')]({'attributes':['id',_0xb830('0x4b'),_0xb830('0x4c'),_0xb830('0x4d')]})['then'](function(_0x6ded84){if(_0x6ded84[_0xb830('0x4b')])authService[_0xb830('0x4e')](_0x426ee9[_0xb830('0x38')][_0xb830('0x12')]);if(!_0x6ded84[_0xb830('0x4c')]||!_0x4ed9e1['previousPasswords'])return _0x4ed9e1;authService['validatePasswordHistory'](_0x426ee9[_0xb830('0x38')]['password'],_0x4ed9e1['previousPasswords'],_0x6ded84[_0xb830('0x4d')]);return _0x4ed9e1;})[_0xb830('0x10')](function(){_0x4ed9e1[_0xb830('0x12')]=_0x426ee9[_0xb830('0x38')][_0xb830('0x12')];_0x4ed9e1[_0xb830('0x40')]=null;_0x4ed9e1[_0xb830('0x41')]=null;return _0x4ed9e1[_0xb830('0x4f')]();});})[_0xb830('0x10')](function(){_0x3b212e[_0xb830('0x31')](0xc8)[_0xb830('0x32')]({'message':_0xb830('0x50')});})[_0xb830('0x20')](function(_0x170160){return handleError(_0x3b212e,0x1f4,_0x170160);});};passport[_0xb830('0x51')](_0xb830('0x34'),new LocalStrategy({'usernameField':_0xb830('0x11'),'passwordField':'password'},function(_0x5e3d0e,_0x129d23,_0x11282f){return localAuthenticate(db['User'],_0x5e3d0e,_0x129d23,_0x11282f);})); \ No newline at end of file +var _0x781e=['blocked','admin','user','agent','loginAttempts','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','body','Email\x20parameter\x20is\x20missing','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','catch','find','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','disabled'];(function(_0x3560de,_0x28b150){var _0x2d31c1=function(_0x1c13d9){while(--_0x1c13d9){_0x3560de['push'](_0x3560de['shift']());}};_0x2d31c1(++_0x28b150);}(_0x781e,0xda));var _0xe781=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x781e[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0xe781('0x0'));var passport=require(_0xe781('0x1'));var LocalStrategy=require('passport-local')[_0xe781('0x2')];var jayson=require(_0xe781('0x3'));var _=require('lodash');var rs=require(_0xe781('0x4'));var moment=require(_0xe781('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xe781('0x6'));var utils=require(_0xe781('0x7'));var client=jayson[_0xe781('0x8')][_0xe781('0x9')]({'port':0x232b});function localAuthenticate(_0x385920,_0x536217,_0x14b27e,_0x16e9bd){var _0x4ee18d,_0x12c128;return db[_0xe781('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0xe781('0xb'),_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x3bd40b){_0x4ee18d=_0x3bd40b;return _0x385920[_0xe781('0xe')]({'attributes':['id',_0xe781('0xf'),_0xe781('0x10'),_0xe781('0x11'),'role',_0xe781('0x12'),_0xe781('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x536217,'role':{'$or':[_0xe781('0x14'),_0xe781('0x15'),_0xe781('0x16')]}}});})[_0xe781('0xd')](function(_0x302319){if(!_0x302319||_0x302319&&_0x302319[_0xe781('0xf')]!==_0x536217){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x12c128=_0x302319;return _0x12c128;}})[_0xe781('0xd')](function(){_0x12c128['authenticate'](_0x14b27e,function(_0x58177d,_0x217032){var _0x37472e=_0x12c128[_0xe781('0x17')]+0x1;if(_0x58177d){return _0x16e9bd(_0x58177d);}else if(!_0x217032){if(_0x12c128['disabled']){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d[_0xe781('0xb')]>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)['then'](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{if(_0x37472e>=_0x4ee18d[_0xe781('0xb')]){return utils[_0xe781('0x1c')](_0x12c128,0x0,!![],moment())[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}else{return utils[_0xe781('0x1c')](_0x12c128,_0x37472e,![],null)[_0xe781('0xd')](function(){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});});}}}else{return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12c128[_0xe781('0x12')]){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4ee18d['allowedLoginAttempts']>0x0){if(_0x12c128[_0xe781('0x13')]){if(_0x4ee18d[_0xe781('0xc')]>0x0){if(moment(_0x12c128[_0xe781('0x18')])[_0xe781('0x19')](_0x4ee18d[_0xe781('0xc')],_0xe781('0x1a'))>moment()){return _0x16e9bd(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils[_0xe781('0x1d')](_0x12c128);})['then'](function(){return _0x16e9bd(null,_0x12c128);});}}else{return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}}else{return utils[_0xe781('0x1c')](_0x12c128,0x0,![],null)[_0xe781('0xd')](function(){return utils['getLicense'](_0x12c128);})[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);})['catch'](function(_0x5ea9b8){return _0x16e9bd(null,![],_0x5ea9b8);});}}else{if(_0x12c128['blocked']){return _0x16e9bd(null,![],{'message':_0xe781('0x1b')});}else{return utils['getLicense'](_0x12c128)[_0xe781('0xd')](function(){return _0x16e9bd(null,_0x12c128);});}}}});})['catch'](function(_0x188a44){return _0x16e9bd(null,![],_0x188a44);});}function sendServiceMail(_0x26e6ec){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xe781('0x1e')],'include':[{'model':db[_0xe781('0x1f')],'as':_0xe781('0x20'),'include':[{'model':db[_0xe781('0x21')],'as':'CloudProvider'}]}]})['then'](function(_0x366f6f){if(!_0x366f6f){throw new Error(_0xe781('0x22'));}var _0x3adf36=_0x366f6f['getSmtpOptions']();var _0xd58a56={'account':_0x3adf36,'message':_[_0xe781('0x23')]({'from':util[_0xe781('0x24')](_0xe781('0x25'),_0x366f6f[_0xe781('0xf')],_0x366f6f[_0xe781('0x1e')]||_0x366f6f['Smtp']['user'])},_0x26e6ec)};return client[_0xe781('0x26')](_0xe781('0x27'),_0xd58a56);})[_0xe781('0xd')](function(_0x29c834){if(_0x29c834[_0xe781('0x28')]){throw new Error(util['format'](_0xe781('0x29'),_0x29c834[_0xe781('0x28')][_0xe781('0x2a')]||JSON['stringify'](_0x29c834[_0xe781('0x28')])));}return!![];});}function handleError(_0x3bdc9e,_0x204b9a,_0x431292){return _0x3bdc9e[_0xe781('0x2b')](_0x204b9a||0x1f4)[_0xe781('0x2c')]({'message':_0x431292?_0x431292[_0xe781('0x2a')]||_0x431292:''});}exports[_0xe781('0x2d')]=function(_0x3eaa2c,_0x16dc43,_0x4ff6fa){passport[_0xe781('0x2e')](_0xe781('0x2f'),function(_0x2311b4,_0x7115f,_0x2b87fe){var _0x512581=_0x2311b4||_0x2b87fe;if(_0x512581){return handleError(_0x16dc43,0x191,_0x512581);}if(!_0x7115f){return handleError(_0x16dc43,0x194,{'message':_0xe781('0x30')});}else{var _0x8d7a26={'payload':{'id':_0x7115f['id'],'role':_0x7115f['role']},'options':{'expiresIn':0x15180}};return authService[_0xe781('0x31')](_0x8d7a26)[_0xe781('0xd')](function(_0x160b33){_0x16dc43[_0xe781('0x32')]({'id':_0x7115f['id'],'token':_0x160b33,'statusCall':'','isAlreadyLogged':_0x7115f['online']});});}})(_0x3eaa2c,_0x16dc43,_0x4ff6fa);};exports['forgot']=function(_0x4f9781,_0x5cc8e4){if(!_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]){return handleError(_0x5cc8e4,0x1f4,{'message':_0xe781('0x34')});}var _0x40b9d3=rs[_0xe781('0x35')]();_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')]=_0x4f9781[_0xe781('0x33')][_0xe781('0x1e')][_0xe781('0x36')]()['toLowerCase']();var _0x55cdae;return db[_0xe781('0xa')][_0xe781('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe781('0xc')],'raw':!![]})[_0xe781('0xd')](function(_0x2c9560){_0x55cdae=_0x2c9560;return db[_0xe781('0x37')]['find']({'where':{'email':_0x4f9781['body'][_0xe781('0x1e')]}});})['then'](function(_0x519546){if(!_0x519546){throw new Error(_0xe781('0x38'));}if(_0x519546[_0xe781('0x12')]){throw new Error(_0xe781('0x39'));}if(_0x519546['blocked']){if(moment(_0x519546[_0xe781('0x18')])['add'](_0x55cdae['blockDuration'],'minutes')>moment()){throw new Error(_0xe781('0x3a'));}else{_0x519546[_0xe781('0x13')]=![];_0x519546[_0xe781('0x18')]=null;}}_0x519546[_0xe781('0x3b')]=_0x40b9d3;_0x519546['resetPasswordExpires']=Date[_0xe781('0x3c')]()+0x36ee80;return _0x519546[_0xe781('0x3d')]();})[_0xe781('0xd')](function(){return sendServiceMail({'to':_0x4f9781['body'][_0xe781('0x1e')],'subject':_0xe781('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xe781('0x3f')+_0xe781('0x40')+_0x4f9781['headers'][_0xe781('0x41')]+_0xe781('0x42')+_0x40b9d3+'\x0a\x0a'+_0xe781('0x43')});})[_0xe781('0xd')](function(){_0x5cc8e4[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':'Reset\x20Email\x20sent!'});})[_0xe781('0x44')](function(_0x3534f3){return handleError(_0x5cc8e4,0x1f4,_0x3534f3);});};exports['reset']=function(_0x23cb34,_0x21c9e7){return db['User'][_0xe781('0x45')]({'where':{'resetPasswordToken':_0x23cb34['params'][_0xe781('0x46')],'resetPasswordExpires':{'$gt':Date[_0xe781('0x3c')]()}}})[_0xe781('0xd')](function(_0x2689ff){if(!_0x2689ff){throw new Error(_0xe781('0x47'));}return db['Setting'][_0xe781('0xe')]({'attributes':['id',_0xe781('0x48'),_0xe781('0x49'),'passwordHistoryLimit']})[_0xe781('0xd')](function(_0xd397d4){if(_0xd397d4[_0xe781('0x48')])authService[_0xe781('0x4a')](_0x23cb34[_0xe781('0x33')][_0xe781('0x10')]);if(!_0xd397d4['enforcePasswordHistory']||!_0x2689ff[_0xe781('0x4b')])return _0x2689ff;authService['validatePasswordHistory'](_0x23cb34['body'][_0xe781('0x10')],_0x2689ff['previousPasswords'],_0xd397d4[_0xe781('0x4c')]);return _0x2689ff;})[_0xe781('0xd')](function(){_0x2689ff[_0xe781('0x10')]=_0x23cb34[_0xe781('0x33')][_0xe781('0x10')];_0x2689ff[_0xe781('0x3b')]=null;_0x2689ff['resetPasswordExpires']=null;return _0x2689ff[_0xe781('0x3d')]();});})[_0xe781('0xd')](function(){_0x21c9e7[_0xe781('0x2b')](0xc8)[_0xe781('0x2c')]({'message':_0xe781('0x4d')});})[_0xe781('0x44')](function(_0x822bcc){return handleError(_0x21c9e7,0x1f4,_0x822bcc);});};passport[_0xe781('0x4e')](_0xe781('0x2f'),new LocalStrategy({'usernameField':_0xe781('0xf'),'passwordField':_0xe781('0x10')},function(_0x52ad35,_0x1c538d,_0x81b56c){return localAuthenticate(db[_0xe781('0x37')],_0x52ad35,_0x1c538d,_0x81b56c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6595179..64dfe63 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 _0xe626=['express','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0xe626,0x1ef));var _0x6e62=function(_0x265e7a,_0x1fb3d1){_0x265e7a=_0x265e7a-0x0;var _0x56ae30=_0xe626[_0x265e7a];return _0x56ae30;};'use strict';var express=require(_0x6e62('0x0'));var router=express[_0x6e62('0x1')]();var controller=require(_0x6e62('0x2'));router[_0x6e62('0x3')]('/',controller[_0x6e62('0x4')]);router['post'](_0x6e62('0x5'),controller['forgot']);router[_0x6e62('0x3')](_0x6e62('0x6'),controller[_0x6e62('0x7')]);module[_0x6e62('0x8')]=router; \ No newline at end of file +var _0x22e0=['/forgot','forgot','/reset/:token','reset','exports','express','Router','login'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x22e0,0xa5));var _0x022e=function(_0x1953e7,_0x20a3d9){_0x1953e7=_0x1953e7-0x0;var _0x3b3d49=_0x22e0[_0x1953e7];return _0x3b3d49;};'use strict';var express=require(_0x022e('0x0'));var router=express[_0x022e('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x022e('0x2')]);router['post'](_0x022e('0x3'),controller[_0x022e('0x4')]);router['post'](_0x022e('0x5'),controller[_0x022e('0x6')]);module[_0x022e('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index ebeb0c3..83580b3 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 _0x3892=['STRING','INTEGER','sequelize','exports'];(function(_0x18d03a,_0x2fe246){var _0x26ff7d=function(_0x36e7b9){while(--_0x36e7b9){_0x18d03a['push'](_0x18d03a['shift']());}};_0x26ff7d(++_0x2fe246);}(_0x3892,0xe6));var _0x2389=function(_0x44cfab,_0xf35628){_0x44cfab=_0x44cfab-0x0;var _0x2fd092=_0x3892[_0x44cfab];return _0x2fd092;};'use strict';var Sequelize=require(_0x2389('0x0'));module[_0x2389('0x1')]={'name':{'type':Sequelize[_0x2389('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2389('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2389('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb2ed=['STRING','BOOLEAN','INTEGER'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb2ed,0xc0));var _0xdb2e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xb2ed[_0x5317b5];return _0x3b7ce2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb2e('0x0')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb2e('0x0')]},'status':{'type':Sequelize[_0xdb2e('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdb2e('0x2')],'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 f6121df..0bb0aad 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 _0x2aba=['map','addActions','getActions','findOne','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Automation','includeAll','include','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions'];(function(_0x36b5be,_0x25cbb9){var _0x186b09=function(_0x559d03){while(--_0x559d03){_0x36b5be['push'](_0x36b5be['shift']());}};_0x186b09(++_0x25cbb9);}(_0x2aba,0x151));var _0xa2ab=function(_0x335b1d,_0x4d5e1e){_0x335b1d=_0x335b1d-0x0;var _0x588161=_0x2aba[_0x335b1d];return _0x588161;};'use strict';var emlformat=require(_0xa2ab('0x0'));var rimraf=require(_0xa2ab('0x1'));var zipdir=require(_0xa2ab('0x2'));var jsonpatch=require(_0xa2ab('0x3'));var rp=require(_0xa2ab('0x4'));var moment=require('moment');var BPromise=require(_0xa2ab('0x5'));var Mustache=require(_0xa2ab('0x6'));var util=require(_0xa2ab('0x7'));var path=require('path');var sox=require(_0xa2ab('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2ab('0x9'));var squel=require(_0xa2ab('0xa'));var crypto=require(_0xa2ab('0xb'));var jsforce=require(_0xa2ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa2ab('0xd'));var querystring=require(_0xa2ab('0xe'));var Papa=require(_0xa2ab('0xf'));var Redis=require(_0xa2ab('0x10'));var authService=require(_0xa2ab('0x11'));var qs=require(_0xa2ab('0x12'));var as=require(_0xa2ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2ab('0x14'))(_0xa2ab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa2ab('0x16'));var db=require(_0xa2ab('0x17'))['db'];function respondWithStatusCode(_0x5f32e3,_0x1b8abe){_0x1b8abe=_0x1b8abe||0xcc;return function(_0x127350){if(_0x127350){return _0x5f32e3[_0xa2ab('0x18')](_0x1b8abe);}return _0x5f32e3[_0xa2ab('0x19')](_0x1b8abe)[_0xa2ab('0x1a')]();};}function respondWithResult(_0x4fb0cb,_0x505adb){_0x505adb=_0x505adb||0xc8;return function(_0x19ce04){if(_0x19ce04){return _0x4fb0cb['status'](_0x505adb)['json'](_0x19ce04);}};}function respondWithFilteredResult(_0x21a902,_0x1cfc17){return function(_0x5dfd9d){if(_0x5dfd9d){var _0x47e552=typeof _0x1cfc17['offset']===_0xa2ab('0x1b')&&typeof _0x1cfc17['limit']===_0xa2ab('0x1b');var _0x942ffd=_0x5dfd9d['count'];var _0x296f3a=_0x47e552?0x0:_0x1cfc17[_0xa2ab('0x1c')];var _0x208c4b=_0x47e552?_0x5dfd9d[_0xa2ab('0x1d')]:_0x1cfc17[_0xa2ab('0x1c')]+_0x1cfc17[_0xa2ab('0x1e')];var _0x460431;if(_0x208c4b>=_0x942ffd){_0x208c4b=_0x942ffd;_0x460431=0xc8;}else{_0x460431=0xce;}_0x21a902[_0xa2ab('0x19')](_0x460431);return _0x21a902[_0xa2ab('0x1f')](_0xa2ab('0x20'),_0x296f3a+'-'+_0x208c4b+'/'+_0x942ffd)[_0xa2ab('0x21')](_0x5dfd9d);}return null;};}function patchUpdates(_0x3a800b){return function(_0x182f16){try{jsonpatch[_0xa2ab('0x22')](_0x182f16,_0x3a800b,!![]);}catch(_0x27bfc7){return BPromise[_0xa2ab('0x23')](_0x27bfc7);}return _0x182f16[_0xa2ab('0x24')]();};}function saveUpdates(_0xf5025f,_0x473158){return function(_0x17c9de){if(_0x17c9de){return _0x17c9de[_0xa2ab('0x25')](_0xf5025f)[_0xa2ab('0x26')](function(_0x2c2fc4){return _0x2c2fc4;});}return null;};}function removeEntity(_0x55f6a2,_0x593c08){return function(_0x515659){if(_0x515659){return _0x515659[_0xa2ab('0x27')]()[_0xa2ab('0x26')](function(){_0x55f6a2[_0xa2ab('0x19')](0xcc)[_0xa2ab('0x1a')]();});}};}function handleEntityNotFound(_0x46d01b,_0x36b52c){return function(_0x245113){if(!_0x245113){_0x46d01b['sendStatus'](0x194);}return _0x245113;};}function handleError(_0x2f7644,_0x35603a){_0x35603a=_0x35603a||0x1f4;return function(_0x2df76d){logger['error'](_0x2df76d[_0xa2ab('0x28')]);if(_0x2df76d[_0xa2ab('0x29')]){delete _0x2df76d[_0xa2ab('0x29')];}_0x2f7644[_0xa2ab('0x19')](_0x35603a)['send'](_0x2df76d);};}exports[_0xa2ab('0x2a')]=function(_0x2e17b1,_0x38f9c1){var _0x33da9f={},_0x35d25f={},_0xa904b4={'count':0x0,'rows':[]};var _0x16ddfa=_['map'](db['Automation'][_0xa2ab('0x2b')],function(_0x414bbf){return{'name':_0x414bbf['fieldName'],'type':_0x414bbf[_0xa2ab('0x2c')][_0xa2ab('0x2d')]};});_0x35d25f[_0xa2ab('0x2e')]=_['map'](_0x16ddfa,_0xa2ab('0x29'));_0x35d25f[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x2e17b1[_0xa2ab('0x2f')]);_0x35d25f[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x35d25f['model'],_0x35d25f[_0xa2ab('0x2f')]);_0x33da9f[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x35d25f[_0xa2ab('0x2e')],qs[_0xa2ab('0x34')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x34')]));_0x33da9f[_0xa2ab('0x33')]=_0x33da9f[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x33da9f[_0xa2ab('0x33')]:_0x35d25f[_0xa2ab('0x2e')];if(!_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x36')](_0xa2ab('0x37'))){_0x33da9f[_0xa2ab('0x1e')]=qs[_0xa2ab('0x1e')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x1e')]);_0x33da9f['offset']=qs[_0xa2ab('0x1c')](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x1c')]);}_0x33da9f[_0xa2ab('0x38')]=qs['sort'](_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x39')]);_0x33da9f[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_[_0xa2ab('0x3b')](_0x2e17b1[_0xa2ab('0x2f')],_0x35d25f[_0xa2ab('0x31')]),_0x16ddfa);if(_0x2e17b1[_0xa2ab('0x2f')]['filter']){_0x33da9f[_0xa2ab('0x3a')]=_[_0xa2ab('0x3c')](_0x33da9f[_0xa2ab('0x3a')],{'$or':_['map'](_0x16ddfa,function(_0x40e297){if(_0x40e297['type']!=='VIRTUAL'){var _0x532144={};_0x532144[_0x40e297[_0xa2ab('0x29')]]={'$like':'%'+_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x3d')]+'%'};return _0x532144;}})});}_0x33da9f=_[_0xa2ab('0x3c')]({},_0x33da9f,_0x2e17b1[_0xa2ab('0x3e')]);var _0x392167={'where':_0x33da9f['where']};return db[_0xa2ab('0x3f')]['count'](_0x392167)[_0xa2ab('0x26')](function(_0x44093e){_0xa904b4[_0xa2ab('0x1d')]=_0x44093e;if(_0x2e17b1[_0xa2ab('0x2f')][_0xa2ab('0x40')]){_0x33da9f[_0xa2ab('0x41')]=[{'all':!![]}];}return db[_0xa2ab('0x3f')]['findAll'](_0x33da9f);})[_0xa2ab('0x26')](function(_0x19e374){_0xa904b4[_0xa2ab('0x42')]=_0x19e374;return _0xa904b4;})['then'](respondWithFilteredResult(_0x38f9c1,_0x33da9f))[_0xa2ab('0x43')](handleError(_0x38f9c1,null));};exports[_0xa2ab('0x44')]=function(_0x5253f3,_0x5a9a6a){var _0x46a5c7={'raw':![],'where':{'id':_0x5253f3[_0xa2ab('0x45')]['id']}},_0x3f7ba8={};_0x3f7ba8['model']=_['keys'](db[_0xa2ab('0x3f')][_0xa2ab('0x2b')]);_0x3f7ba8[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x5253f3[_0xa2ab('0x2f')]);_0x3f7ba8[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x3f7ba8[_0xa2ab('0x2e')],_0x3f7ba8['query']);_0x46a5c7[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x3f7ba8['model'],qs['fields'](_0x5253f3[_0xa2ab('0x2f')][_0xa2ab('0x34')]));_0x46a5c7['attributes']=_0x46a5c7[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x46a5c7['attributes']:_0x3f7ba8[_0xa2ab('0x2e')];if(_0x5253f3[_0xa2ab('0x2f')][_0xa2ab('0x40')]){_0x46a5c7[_0xa2ab('0x41')]=[{'all':!![]}];}_0x46a5c7=_[_0xa2ab('0x3c')]({},_0x46a5c7,_0x5253f3[_0xa2ab('0x3e')]);return db[_0xa2ab('0x3f')][_0xa2ab('0x46')](_0x46a5c7)[_0xa2ab('0x26')](handleEntityNotFound(_0x5a9a6a,null))[_0xa2ab('0x26')](respondWithResult(_0x5a9a6a,null))[_0xa2ab('0x43')](handleError(_0x5a9a6a,null));};exports['create']=function(_0x35b699,_0x3bac97){return db['Automation'][_0xa2ab('0x47')](_0x35b699['body'],{})[_0xa2ab('0x26')](respondWithResult(_0x3bac97,0xc9))[_0xa2ab('0x43')](handleError(_0x3bac97,null));};exports[_0xa2ab('0x25')]=function(_0x2b894,_0x198380){if(_0x2b894[_0xa2ab('0x48')]['id']){delete _0x2b894[_0xa2ab('0x48')]['id'];}return db[_0xa2ab('0x3f')][_0xa2ab('0x46')]({'where':{'id':_0x2b894[_0xa2ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x198380,null))['then'](saveUpdates(_0x2b894[_0xa2ab('0x48')],null))[_0xa2ab('0x26')](respondWithResult(_0x198380,null))[_0xa2ab('0x43')](handleError(_0x198380,null));};exports[_0xa2ab('0x27')]=function(_0x1a0488,_0x52633f){return db[_0xa2ab('0x3f')]['find']({'where':{'id':_0x1a0488[_0xa2ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x52633f,null))[_0xa2ab('0x26')](removeEntity(_0x52633f,null))[_0xa2ab('0x43')](handleError(_0x52633f,null));};exports[_0xa2ab('0x49')]=function(_0x379579,_0x2b15e0,_0x115610){return db[_0xa2ab('0x4a')][_0xa2ab('0x46')]({'where':{'id':_0x379579[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x2b15e0,null))[_0xa2ab('0x26')](function(_0x5e05ca){if(_0x5e05ca){return _0x5e05ca['addConditions'](_0x379579[_0xa2ab('0x48')][_0xa2ab('0x4b')],_[_0xa2ab('0x4c')](_0x379579[_0xa2ab('0x48')],[_0xa2ab('0x4b'),'id'])||{});}})[_0xa2ab('0x26')](respondWithResult(_0x2b15e0,null))[_0xa2ab('0x43')](handleError(_0x2b15e0,null));};exports[_0xa2ab('0x4d')]=function(_0x57b870,_0x27b352,_0x8c2b8b){var _0x341658={};var _0x478447={};var _0x28ba3c;var _0x12a6e1;return db[_0xa2ab('0x3f')]['findOne']({'where':{'id':_0x57b870[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x27b352,null))[_0xa2ab('0x26')](function(_0x5c91e6){if(_0x5c91e6){_0x28ba3c=_0x5c91e6;_0x478447[_0xa2ab('0x2e')]=_[_0xa2ab('0x30')](db[_0xa2ab('0x4a')]['rawAttributes']);_0x478447[_0xa2ab('0x2f')]=_[_0xa2ab('0x30')](_0x57b870[_0xa2ab('0x2f')]);_0x478447[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x478447[_0xa2ab('0x2e')],_0x478447[_0xa2ab('0x2f')]);_0x341658[_0xa2ab('0x33')]=_[_0xa2ab('0x32')](_0x478447[_0xa2ab('0x2e')],qs[_0xa2ab('0x34')](_0x57b870[_0xa2ab('0x2f')]['fields']));_0x341658[_0xa2ab('0x33')]=_0x341658[_0xa2ab('0x33')][_0xa2ab('0x35')]?_0x341658[_0xa2ab('0x33')]:_0x478447[_0xa2ab('0x2e')];_0x341658[_0xa2ab('0x38')]=qs[_0xa2ab('0x39')](_0x57b870[_0xa2ab('0x2f')]['sort']);_0x341658[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_[_0xa2ab('0x3b')](_0x57b870[_0xa2ab('0x2f')],_0x478447[_0xa2ab('0x31')]));if(_0x57b870[_0xa2ab('0x2f')]['filter']){_0x341658['where']=_[_0xa2ab('0x3c')](_0x341658[_0xa2ab('0x3a')],{'$or':_[_0xa2ab('0x4e')](_0x341658[_0xa2ab('0x33')],function(_0x56ea74){var _0x19eb17={};_0x19eb17[_0x56ea74]={'$like':'%'+_0x57b870[_0xa2ab('0x2f')][_0xa2ab('0x3d')]+'%'};return _0x19eb17;})});}_0x341658=_[_0xa2ab('0x3c')]({},_0x341658,_0x57b870['options']);return _0x28ba3c[_0xa2ab('0x4d')](_0x341658);}})[_0xa2ab('0x26')](function(_0x439519){if(_0x439519){_0x12a6e1=_0x439519[_0xa2ab('0x35')];if(!_0x57b870[_0xa2ab('0x2f')]['hasOwnProperty'](_0xa2ab('0x37'))){_0x341658[_0xa2ab('0x1e')]=qs[_0xa2ab('0x1e')](_0x57b870[_0xa2ab('0x2f')]['limit']);_0x341658[_0xa2ab('0x1c')]=qs[_0xa2ab('0x1c')](_0x57b870[_0xa2ab('0x2f')][_0xa2ab('0x1c')]);}return _0x28ba3c[_0xa2ab('0x4d')](_0x341658);}})[_0xa2ab('0x26')](function(_0x3d304e){if(_0x3d304e){return _0x3d304e?{'count':_0x12a6e1,'rows':_0x3d304e}:null;}})[_0xa2ab('0x26')](respondWithResult(_0x27b352,null))['catch'](handleError(_0x27b352,null));};exports[_0xa2ab('0x4f')]=function(_0x146c01,_0x242192,_0x4d2857){return db['Action']['find']({'where':{'id':_0x146c01[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x242192,null))[_0xa2ab('0x26')](function(_0x3e4f81){if(_0x3e4f81){return _0x3e4f81['addActions'](_0x146c01[_0xa2ab('0x48')][_0xa2ab('0x4b')],_[_0xa2ab('0x4c')](_0x146c01[_0xa2ab('0x48')],[_0xa2ab('0x4b'),'id'])||{});}})[_0xa2ab('0x26')](respondWithResult(_0x242192,null))[_0xa2ab('0x43')](handleError(_0x242192,null));};exports[_0xa2ab('0x50')]=function(_0x56d8dc,_0x4f707c,_0x392bc5){var _0x40a9e8={};var _0x34df09={};var _0x5e2abf;var _0x4d23a4;return db[_0xa2ab('0x3f')][_0xa2ab('0x51')]({'where':{'id':_0x56d8dc[_0xa2ab('0x45')]['id']}})[_0xa2ab('0x26')](handleEntityNotFound(_0x4f707c,null))[_0xa2ab('0x26')](function(_0x3235d5){if(_0x3235d5){_0x5e2abf=_0x3235d5;_0x34df09['model']=_[_0xa2ab('0x30')](db[_0xa2ab('0x52')][_0xa2ab('0x2b')]);_0x34df09['query']=_[_0xa2ab('0x30')](_0x56d8dc[_0xa2ab('0x2f')]);_0x34df09[_0xa2ab('0x31')]=_[_0xa2ab('0x32')](_0x34df09[_0xa2ab('0x2e')],_0x34df09[_0xa2ab('0x2f')]);_0x40a9e8['attributes']=_[_0xa2ab('0x32')](_0x34df09[_0xa2ab('0x2e')],qs['fields'](_0x56d8dc[_0xa2ab('0x2f')]['fields']));_0x40a9e8[_0xa2ab('0x33')]=_0x40a9e8['attributes'][_0xa2ab('0x35')]?_0x40a9e8['attributes']:_0x34df09[_0xa2ab('0x2e')];_0x40a9e8[_0xa2ab('0x38')]=qs['sort'](_0x56d8dc['query'][_0xa2ab('0x39')]);_0x40a9e8[_0xa2ab('0x3a')]=qs[_0xa2ab('0x31')](_['pick'](_0x56d8dc[_0xa2ab('0x2f')],_0x34df09['filters']));if(_0x56d8dc[_0xa2ab('0x2f')][_0xa2ab('0x3d')]){_0x40a9e8[_0xa2ab('0x3a')]=_[_0xa2ab('0x3c')](_0x40a9e8[_0xa2ab('0x3a')],{'$or':_[_0xa2ab('0x4e')](_0x40a9e8['attributes'],function(_0xe2ea0f){var _0x5c9ba8={};_0x5c9ba8[_0xe2ea0f]={'$like':'%'+_0x56d8dc['query'][_0xa2ab('0x3d')]+'%'};return _0x5c9ba8;})});}_0x40a9e8=_[_0xa2ab('0x3c')]({},_0x40a9e8,_0x56d8dc[_0xa2ab('0x3e')]);return _0x5e2abf[_0xa2ab('0x50')](_0x40a9e8);}})[_0xa2ab('0x26')](function(_0x3c6c1d){if(_0x3c6c1d){_0x4d23a4=_0x3c6c1d['length'];if(!_0x56d8dc['query'][_0xa2ab('0x36')](_0xa2ab('0x37'))){_0x40a9e8[_0xa2ab('0x1e')]=qs['limit'](_0x56d8dc['query'][_0xa2ab('0x1e')]);_0x40a9e8[_0xa2ab('0x1c')]=qs[_0xa2ab('0x1c')](_0x56d8dc['query'][_0xa2ab('0x1c')]);}return _0x5e2abf[_0xa2ab('0x50')](_0x40a9e8);}})[_0xa2ab('0x26')](function(_0x4afe95){if(_0x4afe95){return _0x4afe95?{'count':_0x4d23a4,'rows':_0x4afe95}:null;}})['then'](respondWithResult(_0x4f707c,null))[_0xa2ab('0x43')](handleError(_0x4f707c,null));}; \ No newline at end of file +var _0x8068=['Condition','pick','getConditions','hasOwnProperty','addActions','Action','getActions','findOne','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','count','include','findAll','rows','catch','params','rawAttributes','includeAll','merge','create','body','destroy','find','addConditions','ids','omit'];(function(_0x54fb7a,_0x24dc21){var _0x981a80=function(_0x40324f){while(--_0x40324f){_0x54fb7a['push'](_0x54fb7a['shift']());}};_0x981a80(++_0x24dc21);}(_0x8068,0x15d));var _0x8806=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x8068[_0x333fc8];return _0x432439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8806('0x0'));var zipdir=require(_0x8806('0x1'));var jsonpatch=require(_0x8806('0x2'));var rp=require(_0x8806('0x3'));var moment=require(_0x8806('0x4'));var BPromise=require(_0x8806('0x5'));var Mustache=require('mustache');var util=require(_0x8806('0x6'));var path=require('path');var sox=require(_0x8806('0x7'));var csv=require(_0x8806('0x8'));var ejs=require(_0x8806('0x9'));var fs=require('fs');var fs_extra=require(_0x8806('0xa'));var _=require(_0x8806('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8806('0xc'));var deskjs=require(_0x8806('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8806('0xe'));var Redis=require(_0x8806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8806('0x10'));var as=require(_0x8806('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8806('0x12'))(_0x8806('0x13'));var utils=require(_0x8806('0x14'));var config=require(_0x8806('0x15'));var licenseUtil=require(_0x8806('0x16'));var db=require(_0x8806('0x17'))['db'];function respondWithStatusCode(_0x4858f0,_0x40453e){_0x40453e=_0x40453e||0xcc;return function(_0x1c9718){if(_0x1c9718){return _0x4858f0['sendStatus'](_0x40453e);}return _0x4858f0['status'](_0x40453e)[_0x8806('0x18')]();};}function respondWithResult(_0x1e56f2,_0x467360){_0x467360=_0x467360||0xc8;return function(_0x4171d1){if(_0x4171d1){return _0x1e56f2[_0x8806('0x19')](_0x467360)[_0x8806('0x1a')](_0x4171d1);}};}function respondWithFilteredResult(_0x1dbcc6,_0x53601e){return function(_0x139b81){if(_0x139b81){var _0x4ff617=typeof _0x53601e[_0x8806('0x1b')]===_0x8806('0x1c')&&typeof _0x53601e[_0x8806('0x1d')]===_0x8806('0x1c');var _0x47c869=_0x139b81['count'];var _0x5355ea=_0x4ff617?0x0:_0x53601e[_0x8806('0x1b')];var _0x50e741=_0x4ff617?_0x139b81['count']:_0x53601e[_0x8806('0x1b')]+_0x53601e['limit'];var _0x4f337d;if(_0x50e741>=_0x47c869){_0x50e741=_0x47c869;_0x4f337d=0xc8;}else{_0x4f337d=0xce;}_0x1dbcc6[_0x8806('0x19')](_0x4f337d);return _0x1dbcc6['set'](_0x8806('0x1e'),_0x5355ea+'-'+_0x50e741+'/'+_0x47c869)[_0x8806('0x1a')](_0x139b81);}return null;};}function patchUpdates(_0x4baca6){return function(_0x4db274){try{jsonpatch[_0x8806('0x1f')](_0x4db274,_0x4baca6,!![]);}catch(_0x3afeea){return BPromise[_0x8806('0x20')](_0x3afeea);}return _0x4db274[_0x8806('0x21')]();};}function saveUpdates(_0x3087c2,_0x734e44){return function(_0x19c3bd){if(_0x19c3bd){return _0x19c3bd[_0x8806('0x22')](_0x3087c2)[_0x8806('0x23')](function(_0x292534){return _0x292534;});}return null;};}function removeEntity(_0xe736dd,_0x38031b){return function(_0x5e7c72){if(_0x5e7c72){return _0x5e7c72['destroy']()[_0x8806('0x23')](function(){_0xe736dd[_0x8806('0x19')](0xcc)[_0x8806('0x18')]();});}};}function handleEntityNotFound(_0x13f220,_0x58709c){return function(_0x24abfa){if(!_0x24abfa){_0x13f220[_0x8806('0x24')](0x194);}return _0x24abfa;};}function handleError(_0x134eb6,_0x2dddfb){_0x2dddfb=_0x2dddfb||0x1f4;return function(_0x4b459c){logger['error'](_0x4b459c[_0x8806('0x25')]);if(_0x4b459c['name']){delete _0x4b459c[_0x8806('0x26')];}_0x134eb6[_0x8806('0x19')](_0x2dddfb)[_0x8806('0x27')](_0x4b459c);};}exports[_0x8806('0x28')]=function(_0x570f3b,_0x177268){var _0x4786c8={},_0x4e06b6={},_0x115cf4={'count':0x0,'rows':[]};var _0x8210c=_[_0x8806('0x29')](db[_0x8806('0x2a')]['rawAttributes'],function(_0x126f00){return{'name':_0x126f00[_0x8806('0x2b')],'type':_0x126f00[_0x8806('0x2c')][_0x8806('0x2d')]};});_0x4e06b6[_0x8806('0x2e')]=_[_0x8806('0x29')](_0x8210c,_0x8806('0x26'));_0x4e06b6[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x570f3b['query']);_0x4e06b6[_0x8806('0x31')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],_0x4e06b6['query']);_0x4786c8[_0x8806('0x33')]=_[_0x8806('0x32')](_0x4e06b6[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x570f3b[_0x8806('0x2f')][_0x8806('0x34')]));_0x4786c8[_0x8806('0x33')]=_0x4786c8[_0x8806('0x33')][_0x8806('0x35')]?_0x4786c8[_0x8806('0x33')]:_0x4e06b6[_0x8806('0x2e')];if(!_0x570f3b['query']['hasOwnProperty'](_0x8806('0x36'))){_0x4786c8[_0x8806('0x1d')]=qs['limit'](_0x570f3b[_0x8806('0x2f')]['limit']);_0x4786c8[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x570f3b['query']['offset']);}_0x4786c8['order']=qs[_0x8806('0x37')](_0x570f3b['query'][_0x8806('0x37')]);_0x4786c8[_0x8806('0x38')]=qs[_0x8806('0x31')](_['pick'](_0x570f3b[_0x8806('0x2f')],_0x4e06b6['filters']),_0x8210c);if(_0x570f3b['query'][_0x8806('0x39')]){_0x4786c8[_0x8806('0x38')]=_['merge'](_0x4786c8[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0x8210c,function(_0x42acf8){if(_0x42acf8[_0x8806('0x2c')]!==_0x8806('0x3a')){var _0x4f0d33={};_0x4f0d33[_0x42acf8[_0x8806('0x26')]]={'$like':'%'+_0x570f3b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4f0d33;}})});}_0x4786c8=_['merge']({},_0x4786c8,_0x570f3b[_0x8806('0x3b')]);var _0x5d3ac7={'where':_0x4786c8['where']};return db['Automation'][_0x8806('0x3c')](_0x5d3ac7)[_0x8806('0x23')](function(_0x453419){_0x115cf4[_0x8806('0x3c')]=_0x453419;if(_0x570f3b[_0x8806('0x2f')]['includeAll']){_0x4786c8[_0x8806('0x3d')]=[{'all':!![]}];}return db[_0x8806('0x2a')][_0x8806('0x3e')](_0x4786c8);})[_0x8806('0x23')](function(_0x19f8a0){_0x115cf4[_0x8806('0x3f')]=_0x19f8a0;return _0x115cf4;})['then'](respondWithFilteredResult(_0x177268,_0x4786c8))[_0x8806('0x40')](handleError(_0x177268,null));};exports['show']=function(_0x188a37,_0x95b785){var _0x3eea2f={'raw':![],'where':{'id':_0x188a37[_0x8806('0x41')]['id']}},_0x160f95={};_0x160f95[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x2a')][_0x8806('0x42')]);_0x160f95[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x188a37[_0x8806('0x2f')]);_0x160f95['filters']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],_0x160f95['query']);_0x3eea2f['attributes']=_[_0x8806('0x32')](_0x160f95[_0x8806('0x2e')],qs['fields'](_0x188a37['query'][_0x8806('0x34')]));_0x3eea2f[_0x8806('0x33')]=_0x3eea2f[_0x8806('0x33')]['length']?_0x3eea2f[_0x8806('0x33')]:_0x160f95[_0x8806('0x2e')];if(_0x188a37[_0x8806('0x2f')][_0x8806('0x43')]){_0x3eea2f[_0x8806('0x3d')]=[{'all':!![]}];}_0x3eea2f=_[_0x8806('0x44')]({},_0x3eea2f,_0x188a37[_0x8806('0x3b')]);return db[_0x8806('0x2a')]['find'](_0x3eea2f)[_0x8806('0x23')](handleEntityNotFound(_0x95b785,null))[_0x8806('0x23')](respondWithResult(_0x95b785,null))['catch'](handleError(_0x95b785,null));};exports[_0x8806('0x45')]=function(_0x2c27de,_0x3bf095){return db[_0x8806('0x2a')][_0x8806('0x45')](_0x2c27de[_0x8806('0x46')],{})[_0x8806('0x23')](respondWithResult(_0x3bf095,0xc9))[_0x8806('0x40')](handleError(_0x3bf095,null));};exports[_0x8806('0x22')]=function(_0x4237cb,_0x334fac){if(_0x4237cb[_0x8806('0x46')]['id']){delete _0x4237cb[_0x8806('0x46')]['id'];}return db[_0x8806('0x2a')]['find']({'where':{'id':_0x4237cb[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x334fac,null))[_0x8806('0x23')](saveUpdates(_0x4237cb[_0x8806('0x46')],null))[_0x8806('0x23')](respondWithResult(_0x334fac,null))[_0x8806('0x40')](handleError(_0x334fac,null));};exports[_0x8806('0x47')]=function(_0x571090,_0x423f67){return db['Automation'][_0x8806('0x48')]({'where':{'id':_0x571090[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x423f67,null))[_0x8806('0x23')](removeEntity(_0x423f67,null))['catch'](handleError(_0x423f67,null));};exports[_0x8806('0x49')]=function(_0x195074,_0x3ba4f4,_0x48705a){return db['Condition'][_0x8806('0x48')]({'where':{'id':_0x195074[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x3ba4f4,null))['then'](function(_0xe1b1f5){if(_0xe1b1f5){return _0xe1b1f5[_0x8806('0x49')](_0x195074['body'][_0x8806('0x4a')],_[_0x8806('0x4b')](_0x195074['body'],[_0x8806('0x4a'),'id'])||{});}})[_0x8806('0x23')](respondWithResult(_0x3ba4f4,null))[_0x8806('0x40')](handleError(_0x3ba4f4,null));};exports['getConditions']=function(_0x23b8dd,_0xdb21ac,_0x4148bf){var _0xe9eca2={};var _0x24fea2={};var _0x1cbf08;var _0x211220;return db[_0x8806('0x2a')]['findOne']({'where':{'id':_0x23b8dd[_0x8806('0x41')]['id']}})['then'](handleEntityNotFound(_0xdb21ac,null))[_0x8806('0x23')](function(_0x398836){if(_0x398836){_0x1cbf08=_0x398836;_0x24fea2[_0x8806('0x2e')]=_[_0x8806('0x30')](db[_0x8806('0x4c')][_0x8806('0x42')]);_0x24fea2[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x23b8dd[_0x8806('0x2f')]);_0x24fea2[_0x8806('0x31')]=_['intersection'](_0x24fea2[_0x8806('0x2e')],_0x24fea2[_0x8806('0x2f')]);_0xe9eca2[_0x8806('0x33')]=_[_0x8806('0x32')](_0x24fea2[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x23b8dd['query'][_0x8806('0x34')]));_0xe9eca2[_0x8806('0x33')]=_0xe9eca2[_0x8806('0x33')]['length']?_0xe9eca2[_0x8806('0x33')]:_0x24fea2[_0x8806('0x2e')];_0xe9eca2['order']=qs['sort'](_0x23b8dd[_0x8806('0x2f')]['sort']);_0xe9eca2[_0x8806('0x38')]=qs[_0x8806('0x31')](_[_0x8806('0x4d')](_0x23b8dd[_0x8806('0x2f')],_0x24fea2[_0x8806('0x31')]));if(_0x23b8dd[_0x8806('0x2f')]['filter']){_0xe9eca2[_0x8806('0x38')]=_[_0x8806('0x44')](_0xe9eca2[_0x8806('0x38')],{'$or':_[_0x8806('0x29')](_0xe9eca2[_0x8806('0x33')],function(_0x3163e3){var _0x4435f6={};_0x4435f6[_0x3163e3]={'$like':'%'+_0x23b8dd[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x4435f6;})});}_0xe9eca2=_[_0x8806('0x44')]({},_0xe9eca2,_0x23b8dd[_0x8806('0x3b')]);return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x157aba){if(_0x157aba){_0x211220=_0x157aba[_0x8806('0x35')];if(!_0x23b8dd[_0x8806('0x2f')][_0x8806('0x4f')](_0x8806('0x36'))){_0xe9eca2['limit']=qs[_0x8806('0x1d')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1d')]);_0xe9eca2[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x23b8dd[_0x8806('0x2f')][_0x8806('0x1b')]);}return _0x1cbf08[_0x8806('0x4e')](_0xe9eca2);}})[_0x8806('0x23')](function(_0x26254b){if(_0x26254b){return _0x26254b?{'count':_0x211220,'rows':_0x26254b}:null;}})[_0x8806('0x23')](respondWithResult(_0xdb21ac,null))[_0x8806('0x40')](handleError(_0xdb21ac,null));};exports[_0x8806('0x50')]=function(_0x51187a,_0x5e306,_0x1a8fc3){return db[_0x8806('0x51')]['find']({'where':{'id':_0x51187a[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5e306,null))[_0x8806('0x23')](function(_0x5eba2f){if(_0x5eba2f){return _0x5eba2f['addActions'](_0x51187a[_0x8806('0x46')]['ids'],_[_0x8806('0x4b')](_0x51187a[_0x8806('0x46')],[_0x8806('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x5e306,null))[_0x8806('0x40')](handleError(_0x5e306,null));};exports[_0x8806('0x52')]=function(_0x443d2b,_0x5bf539,_0x430d72){var _0x144c9c={};var _0x505f6e={};var _0x11f13f;var _0x45a199;return db[_0x8806('0x2a')][_0x8806('0x53')]({'where':{'id':_0x443d2b[_0x8806('0x41')]['id']}})[_0x8806('0x23')](handleEntityNotFound(_0x5bf539,null))[_0x8806('0x23')](function(_0x2a78ad){if(_0x2a78ad){_0x11f13f=_0x2a78ad;_0x505f6e['model']=_['keys'](db[_0x8806('0x51')][_0x8806('0x42')]);_0x505f6e[_0x8806('0x2f')]=_[_0x8806('0x30')](_0x443d2b[_0x8806('0x2f')]);_0x505f6e[_0x8806('0x31')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],_0x505f6e[_0x8806('0x2f')]);_0x144c9c[_0x8806('0x33')]=_[_0x8806('0x32')](_0x505f6e[_0x8806('0x2e')],qs[_0x8806('0x34')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x34')]));_0x144c9c[_0x8806('0x33')]=_0x144c9c['attributes'][_0x8806('0x35')]?_0x144c9c['attributes']:_0x505f6e['model'];_0x144c9c[_0x8806('0x54')]=qs[_0x8806('0x37')](_0x443d2b['query'][_0x8806('0x37')]);_0x144c9c[_0x8806('0x38')]=qs['filters'](_['pick'](_0x443d2b['query'],_0x505f6e[_0x8806('0x31')]));if(_0x443d2b[_0x8806('0x2f')]['filter']){_0x144c9c[_0x8806('0x38')]=_['merge'](_0x144c9c['where'],{'$or':_[_0x8806('0x29')](_0x144c9c[_0x8806('0x33')],function(_0x465263){var _0x1963e4={};_0x1963e4[_0x465263]={'$like':'%'+_0x443d2b[_0x8806('0x2f')][_0x8806('0x39')]+'%'};return _0x1963e4;})});}_0x144c9c=_[_0x8806('0x44')]({},_0x144c9c,_0x443d2b[_0x8806('0x3b')]);return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x73d5dc){if(_0x73d5dc){_0x45a199=_0x73d5dc[_0x8806('0x35')];if(!_0x443d2b[_0x8806('0x2f')]['hasOwnProperty'](_0x8806('0x36'))){_0x144c9c[_0x8806('0x1d')]=qs[_0x8806('0x1d')](_0x443d2b[_0x8806('0x2f')][_0x8806('0x1d')]);_0x144c9c[_0x8806('0x1b')]=qs[_0x8806('0x1b')](_0x443d2b['query']['offset']);}return _0x11f13f['getActions'](_0x144c9c);}})[_0x8806('0x23')](function(_0x445fa1){if(_0x445fa1){return _0x445fa1?{'count':_0x45a199,'rows':_0x445fa1}:null;}})['then'](respondWithResult(_0x5bf539,null))['catch'](handleError(_0x5bf539,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c9c6822..8cbb004 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 _0xd7b6=['util','../../config/logger','request-promise','path','../../config/environment','./automation.attributes','exports','define','lodash'];(function(_0x1df9da,_0xd84bc1){var _0x25a0f1=function(_0x716b2c){while(--_0x716b2c){_0x1df9da['push'](_0x1df9da['shift']());}};_0x25a0f1(++_0xd84bc1);}(_0xd7b6,0xc5));var _0x6d7b=function(_0x4effac,_0x2c2237){_0x4effac=_0x4effac-0x0;var _0x3db5f9=_0xd7b6[_0x4effac];return _0x3db5f9;};'use strict';var _=require(_0x6d7b('0x0'));var util=require(_0x6d7b('0x1'));var logger=require(_0x6d7b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6d7b('0x3'));var fs=require('fs');var path=require(_0x6d7b('0x4'));var rimraf=require('rimraf');var config=require(_0x6d7b('0x5'));var attributes=require(_0x6d7b('0x6'));module[_0x6d7b('0x7')]=function(_0x4a2b16,_0x48b46f){return _0x4a2b16[_0x6d7b('0x8')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b6f=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','util','../../config/logger'];(function(_0x4a5010,_0x625447){var _0x44f3d5=function(_0xdb2f58){while(--_0xdb2f58){_0x4a5010['push'](_0x4a5010['shift']());}};_0x44f3d5(++_0x625447);}(_0x2b6f,0x94));var _0xf2b6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x2b6f[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xf2b6('0x0'));var logger=require(_0xf2b6('0x1'))(_0xf2b6('0x2'));var moment=require('moment');var BPromise=require(_0xf2b6('0x3'));var rp=require(_0xf2b6('0x4'));var fs=require('fs');var path=require(_0xf2b6('0x5'));var rimraf=require(_0xf2b6('0x6'));var config=require(_0xf2b6('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x5b7b71,_0x1f2372){return _0x5b7b71[_0xf2b6('0x8')](_0xf2b6('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index a0ecbbb..5bd07e7 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 _0x1410=['jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1410,0x130));var _0x0141=function(_0x572736,_0x1690c7){_0x572736=_0x572736-0x0;var _0x9912bd=_0x1410[_0x572736];return _0x9912bd;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f701,_0x22b566,_0x25511f){return new BPromise(function(_0x2d8f15,_0x57cfbb){return client[_0x0141('0xb')](_0x24f701,_0x25511f)[_0x0141('0xc')](function(_0x2b4f13){logger[_0x0141('0xd')](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));logger[_0x0141('0x10')](_0x0141('0x11'),_0x22b566,'request\x20sent',JSON[_0x0141('0x12')](_0x2b4f13));if(_0x2b4f13[_0x0141('0x13')]){if(_0x2b4f13[_0x0141('0x13')][_0x0141('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x57cfbb(_0x2b4f13['error'][_0x0141('0x15')]);}logger[_0x0141('0x13')](_0x0141('0xe'),_0x22b566,_0x2b4f13[_0x0141('0x13')][_0x0141('0x15')]);return _0x2d8f15(_0x2b4f13['error'][_0x0141('0x15')]);}else{logger['info'](_0x0141('0xe'),_0x22b566,_0x0141('0xf'));_0x2d8f15(_0x2b4f13[_0x0141('0x16')][_0x0141('0x15')]);}})[_0x0141('0x17')](function(_0x3c91e8){logger['error']('Automation,\x20%s,\x20%s',_0x22b566,_0x3c91e8);_0x57cfbb(_0x3c91e8);});});} \ No newline at end of file +var _0x0570=['request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x0570,0x172));var _0x0057=function(_0x5472cc,_0x35ef9c){_0x5472cc=_0x5472cc-0x0;var _0x4255cf=_0x0570[_0x5472cc];return _0x4255cf;};'use strict';var _=require('lodash');var util=require(_0x0057('0x0'));var moment=require(_0x0057('0x1'));var BPromise=require(_0x0057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0057('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0057('0x4'));var logger=require('../../config/logger')(_0x0057('0x5'));var config=require(_0x0057('0x6'));var jayson=require(_0x0057('0x7'));var client=jayson[_0x0057('0x8')][_0x0057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5096e2,_0xc86734,_0x529f55){return new BPromise(function(_0x15d424,_0x2f9d7f){return client[_0x0057('0xa')](_0x5096e2,_0x529f55)[_0x0057('0xb')](function(_0x29b7c6){logger['info'](_0x0057('0xc'),_0xc86734,_0x0057('0xd'));logger[_0x0057('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'),JSON[_0x0057('0xf')](_0x29b7c6));if(_0x29b7c6['error']){if(_0x29b7c6['error'][_0x0057('0x10')]===0x1f4){logger[_0x0057('0x11')](_0x0057('0xc'),_0xc86734,_0x29b7c6['error'][_0x0057('0x12')]);return _0x2f9d7f(_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);}logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x29b7c6[_0x0057('0x11')][_0x0057('0x12')]);return _0x15d424(_0x29b7c6['error'][_0x0057('0x12')]);}else{logger[_0x0057('0x13')]('Automation,\x20%s,\x20%s',_0xc86734,_0x0057('0xd'));_0x15d424(_0x29b7c6['result'][_0x0057('0x12')]);}})['catch'](function(_0x4be851){logger[_0x0057('0x11')]('Automation,\x20%s,\x20%s',_0xc86734,_0x4be851);_0x2f9d7f(_0x4be851);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 530a475..583c419 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 _0x0fc2=['get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','post','create','addConditions','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x3c9e88,_0x3992e0){var _0x374fc1=function(_0x28bdc0){while(--_0x28bdc0){_0x3c9e88['push'](_0x3c9e88['shift']());}};_0x374fc1(++_0x3992e0);}(_0x0fc2,0x6e));var _0x20fc=function(_0x45fa5a,_0xcfb5bf){_0x45fa5a=_0x45fa5a-0x0;var _0x26cb6e=_0x0fc2[_0x45fa5a];return _0x26cb6e;};'use strict';var multer=require(_0x20fc('0x0'));var util=require(_0x20fc('0x1'));var path=require(_0x20fc('0x2'));var timeout=require(_0x20fc('0x3'));var express=require('express');var router=express[_0x20fc('0x4')]();var fs_extra=require(_0x20fc('0x5'));var auth=require(_0x20fc('0x6'));var interaction=require(_0x20fc('0x7'));var config=require(_0x20fc('0x8'));var controller=require(_0x20fc('0x9'));router[_0x20fc('0xa')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0xc')]);router[_0x20fc('0xa')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0xe')]);router[_0x20fc('0xa')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller['getConditions']);router[_0x20fc('0xa')](_0x20fc('0x10'),auth[_0x20fc('0xb')](),controller['getActions']);router[_0x20fc('0x11')]('/',auth[_0x20fc('0xb')](),controller[_0x20fc('0x12')]);router[_0x20fc('0x11')](_0x20fc('0xf'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x13')]);router[_0x20fc('0x11')]('/:id/actions',auth[_0x20fc('0xb')](),controller['addActions']);router[_0x20fc('0x14')]('/:id',auth[_0x20fc('0xb')](),controller['update']);router[_0x20fc('0x15')](_0x20fc('0xd'),auth[_0x20fc('0xb')](),controller[_0x20fc('0x16')]);module[_0x20fc('0x17')]=router; \ No newline at end of file +var _0x16e4=['Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x59190d,_0x1fe75c){var _0x3f28c3=function(_0x3069d1){while(--_0x3069d1){_0x59190d['push'](_0x59190d['shift']());}};_0x3f28c3(++_0x1fe75c);}(_0x16e4,0x97));var _0x416e=function(_0x576596,_0x1e85e3){_0x576596=_0x576596-0x0;var _0x5cd85a=_0x16e4[_0x576596];return _0x5cd85a;};'use strict';var multer=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var path=require(_0x416e('0x2'));var timeout=require(_0x416e('0x3'));var express=require(_0x416e('0x4'));var router=express[_0x416e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x416e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x416e('0x7'));var controller=require(_0x416e('0x8'));router['get']('/',auth[_0x416e('0x9')](),controller[_0x416e('0xa')]);router[_0x416e('0xb')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0xd')]);router[_0x416e('0xb')](_0x416e('0xe'),auth[_0x416e('0x9')](),controller['getConditions']);router[_0x416e('0xb')]('/:id/actions',auth[_0x416e('0x9')](),controller[_0x416e('0xf')]);router[_0x416e('0x10')]('/',auth['isAuthenticated'](),controller[_0x416e('0x11')]);router[_0x416e('0x10')](_0x416e('0xe'),auth['isAuthenticated'](),controller[_0x416e('0x12')]);router['post'](_0x416e('0x13'),auth[_0x416e('0x9')](),controller[_0x416e('0x14')]);router[_0x416e('0x15')]('/:id',auth[_0x416e('0x9')](),controller[_0x416e('0x16')]);router[_0x416e('0x17')](_0x416e('0xc'),auth[_0x416e('0x9')](),controller[_0x416e('0x18')]);module[_0x416e('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index a001d57..f3f5c7f 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 _0x0c01=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','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','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x0c01,0x10f));var _0x10c0=function(_0x233a82,_0x268519){_0x233a82=_0x233a82-0x0;var _0x4bfb74=_0x0c01[_0x233a82];return _0x4bfb74;};'use strict';var Sequelize=require(_0x10c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x10c0('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x10c0('0x2')},'description':{'type':Sequelize[_0x10c0('0x3')]},'active':{'type':Sequelize[_0x10c0('0x4')],'defaultValue':0x0,'comment':_0x10c0('0x5')},'limitCalls':{'type':Sequelize[_0x10c0('0x6')](0x4)[_0x10c0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x10c0('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x10c0('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'comment':_0x10c0('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x10c0('0xe')},'dialTimezone':{'type':Sequelize[_0x10c0('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x10c0('0x3')],'defaultValue':_0x10c0('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x10c0('0x10'),'never',_0x10c0('0x11')),'defaultValue':_0x10c0('0x10')},'dialAMDActive':{'type':Sequelize[_0x10c0('0x4')],'defaultValue':0x0,'comment':_0x10c0('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x10c0('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x10c0('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x10c0('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x10c0('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x10c0('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x10c0('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x10c0('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x10c0('0x6')](0x9)[_0x10c0('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x10c0('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x10c0('0x1b')},'dialCutDigit':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x10c0('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x10c0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x10c0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x10c0('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x10c0('0x6')](0x5)[_0x10c0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x10c0('0x25')}}; \ No newline at end of file +var _0x99e7=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x534216,_0x3789b4){var _0x3731ce=function(_0x44c6d1){while(--_0x44c6d1){_0x534216['push'](_0x534216['shift']());}};_0x3731ce(++_0x3789b4);}(_0x99e7,0x1b5));var _0x799e=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x99e7[_0x2bb3f6];return _0x62b339;};'use strict';var Sequelize=require(_0x799e('0x0'));module[_0x799e('0x1')]={'name':{'type':Sequelize[_0x799e('0x2')],'unique':_0x799e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x5')),'allowNull':![],'defaultValue':_0x799e('0x5')},'description':{'type':Sequelize[_0x799e('0x2')]},'active':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x799e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'comment':_0x799e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x799e('0xf')},'dialTimezone':{'type':Sequelize[_0x799e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x799e('0x2')],'defaultValue':_0x799e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x799e('0x4')](_0x799e('0x11'),'never','onlyIfOpen'),'defaultValue':_0x799e('0x11')},'dialAMDActive':{'type':Sequelize[_0x799e('0x6')],'defaultValue':0x0,'comment':_0x799e('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x799e('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x799e('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x799e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x799e('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x799e('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x799e('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x799e('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x799e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x799e('0x8')](0x9)[_0x799e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x799e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x799e('0x1b'),_0x799e('0x1c')),'defaultValue':_0x799e('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1d')},'dialCutDigit':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x799e('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x799e('0x8')](0x3)[_0x799e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x799e('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x799e('0x8')](0x5)[_0x799e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x799e('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fa1fc3d..9c00954 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 _0x1b0a=['Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','hasOwnProperty','pick','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','scheduledAt','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CampaignId\x20=\x20?','push','sequelize','all','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','error','stack','name','send','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','user'];(function(_0x4a5d24,_0x13effb){var _0x47faf2=function(_0x1ab18c){while(--_0x1ab18c){_0x4a5d24['push'](_0x4a5d24['shift']());}};_0x47faf2(++_0x13effb);}(_0x1b0a,0x14b));var _0xa1b0=function(_0x1062d6,_0x300e87){_0x1062d6=_0x1062d6-0x0;var _0x234793=_0x1b0a[_0x1062d6];return _0x234793;};'use strict';var emlformat=require(_0xa1b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1b0('0x2'));var moment=require(_0xa1b0('0x3'));var BPromise=require(_0xa1b0('0x4'));var Mustache=require(_0xa1b0('0x5'));var util=require(_0xa1b0('0x6'));var path=require(_0xa1b0('0x7'));var sox=require(_0xa1b0('0x8'));var csv=require(_0xa1b0('0x9'));var ejs=require(_0xa1b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa1b0('0xb'));var crypto=require(_0xa1b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa1b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa1b0('0xe'));var Papa=require(_0xa1b0('0xf'));var Redis=require(_0xa1b0('0x10'));var authService=require(_0xa1b0('0x11'));var qs=require(_0xa1b0('0x12'));var as=require(_0xa1b0('0x13'));var hardwareService=require(_0xa1b0('0x14'));var logger=require(_0xa1b0('0x15'))(_0xa1b0('0x16'));var utils=require(_0xa1b0('0x17'));var config=require(_0xa1b0('0x18'));var licenseUtil=require(_0xa1b0('0x19'));var db=require(_0xa1b0('0x1a'))['db'];function respondWithStatusCode(_0x358705,_0x3b687b){_0x3b687b=_0x3b687b||0xcc;return function(_0x4b70fd){if(_0x4b70fd){return _0x358705[_0xa1b0('0x1b')](_0x3b687b);}return _0x358705[_0xa1b0('0x1c')](_0x3b687b)['end']();};}function respondWithResult(_0xea9a15,_0x2d1dcc){_0x2d1dcc=_0x2d1dcc||0xc8;return function(_0x4d3526){if(_0x4d3526){return _0xea9a15[_0xa1b0('0x1c')](_0x2d1dcc)[_0xa1b0('0x1d')](_0x4d3526);}};}function respondWithFilteredResult(_0x431a2e,_0x495960){return function(_0x27e5e3){if(_0x27e5e3){var _0x57a62a=typeof _0x495960[_0xa1b0('0x1e')]===_0xa1b0('0x1f')&&typeof _0x495960[_0xa1b0('0x20')]===_0xa1b0('0x1f');var _0x10c84c=_0x27e5e3[_0xa1b0('0x21')];var _0x1490d2=_0x57a62a?0x0:_0x495960[_0xa1b0('0x1e')];var _0x322368=_0x57a62a?_0x27e5e3['count']:_0x495960[_0xa1b0('0x1e')]+_0x495960[_0xa1b0('0x20')];var _0x594505;if(_0x322368>=_0x10c84c){_0x322368=_0x10c84c;_0x594505=0xc8;}else{_0x594505=0xce;}_0x431a2e[_0xa1b0('0x1c')](_0x594505);return _0x431a2e['set'](_0xa1b0('0x22'),_0x1490d2+'-'+_0x322368+'/'+_0x10c84c)['json'](_0x27e5e3);}return null;};}function patchUpdates(_0x4fe262){return function(_0x3ff8b0){try{jsonpatch['apply'](_0x3ff8b0,_0x4fe262,!![]);}catch(_0x361469){return BPromise[_0xa1b0('0x23')](_0x361469);}return _0x3ff8b0['save']();};}function saveUpdates(_0x10614f,_0x3b54d2){return function(_0x5bf006){if(_0x5bf006){return _0x5bf006[_0xa1b0('0x24')](_0x10614f)[_0xa1b0('0x25')](function(_0x329a1e){return _0x329a1e;});}return null;};}function removeEntity(_0x31dc36,_0xe39d60){return function(_0x258108){if(_0x258108){return _0x258108[_0xa1b0('0x26')]()[_0xa1b0('0x25')](function(){var _0x28297f=_0x258108[_0xa1b0('0x27')]({'plain':!![]});var _0x4e7b5e=_0xa1b0('0x28');return db[_0xa1b0('0x29')][_0xa1b0('0x26')]({'where':{'type':_0x4e7b5e,'resourceId':_0x28297f['id']}})[_0xa1b0('0x25')](function(){return _0x258108;});})[_0xa1b0('0x25')](function(){_0x31dc36[_0xa1b0('0x1c')](0xcc)[_0xa1b0('0x2a')]();});}};}function handleEntityNotFound(_0x1dc969,_0x36f3de){return function(_0x1bbca7){if(!_0x1bbca7){_0x1dc969[_0xa1b0('0x1b')](0x194);}return _0x1bbca7;};}function handleError(_0x3417a0,_0x4ecae6){_0x4ecae6=_0x4ecae6||0x1f4;return function(_0x1f925d){logger[_0xa1b0('0x2b')](_0x1f925d[_0xa1b0('0x2c')]);if(_0x1f925d[_0xa1b0('0x2d')]){delete _0x1f925d['name'];}_0x3417a0[_0xa1b0('0x1c')](_0x4ecae6)[_0xa1b0('0x2e')](_0x1f925d);};}exports['index']=function(_0xa554fe,_0x2205bd){var _0x267721={},_0x1a1d7a={},_0x540272={'count':0x0,'rows':[]};var _0x531acc=_[_0xa1b0('0x2f')](db[_0xa1b0('0x30')][_0xa1b0('0x31')],function(_0x22d2ef){return{'name':_0x22d2ef['fieldName'],'type':_0x22d2ef[_0xa1b0('0x32')][_0xa1b0('0x33')]};});_0x1a1d7a[_0xa1b0('0x34')]=_[_0xa1b0('0x2f')](_0x531acc,_0xa1b0('0x2d'));_0x1a1d7a[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0xa554fe['query']);_0x1a1d7a[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x1a1d7a['model'],_0x1a1d7a[_0xa1b0('0x35')]);_0x267721[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x1a1d7a[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x267721['attributes']=_0x267721[_0xa1b0('0x39')]['length']?_0x267721[_0xa1b0('0x39')]:_0x1a1d7a['model'];if(!_0xa554fe[_0xa1b0('0x35')]['hasOwnProperty'](_0xa1b0('0x3b'))){_0x267721[_0xa1b0('0x20')]=qs['limit'](_0xa554fe[_0xa1b0('0x35')]['limit']);_0x267721[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x267721[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0xa554fe[_0xa1b0('0x35')]['sort']);_0x267721['where']=qs[_0xa1b0('0x37')](_['pick'](_0xa554fe[_0xa1b0('0x35')],_0x1a1d7a[_0xa1b0('0x37')]),_0x531acc);if(_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x267721[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x267721[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x531acc,function(_0x288312){if(_0x288312[_0xa1b0('0x32')]!==_0xa1b0('0x41')){var _0x18f2b1={};_0x18f2b1[_0x288312[_0xa1b0('0x2d')]]={'$like':'%'+_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x18f2b1;}})});}_0x267721=_[_0xa1b0('0x40')]({},_0x267721,_0xa554fe[_0xa1b0('0x42')]);var _0x51bd11={'where':_0x267721[_0xa1b0('0x3f')]};return db['Campaign'][_0xa1b0('0x21')](_0x51bd11)[_0xa1b0('0x25')](function(_0x277b1d){_0x540272['count']=_0x277b1d;if(_0xa554fe[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x267721[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x30')][_0xa1b0('0x45')](_0x267721);})[_0xa1b0('0x25')](function(_0x41884a){_0x540272[_0xa1b0('0x46')]=_0x41884a;return _0x540272;})[_0xa1b0('0x25')](respondWithFilteredResult(_0x2205bd,_0x267721))[_0xa1b0('0x47')](handleError(_0x2205bd,null));};exports[_0xa1b0('0x48')]=function(_0x52dc52,_0x47f20c){var _0x38bc73={'raw':![],'where':{'id':_0x52dc52['params']['id']}},_0xb4c8d7={};_0xb4c8d7[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x30')][_0xa1b0('0x31')]);_0xb4c8d7['query']=_[_0xa1b0('0x36')](_0x52dc52[_0xa1b0('0x35')]);_0xb4c8d7['filters']=_[_0xa1b0('0x38')](_0xb4c8d7[_0xa1b0('0x34')],_0xb4c8d7[_0xa1b0('0x35')]);_0x38bc73[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0xb4c8d7[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x52dc52['query'][_0xa1b0('0x3a')]));_0x38bc73['attributes']=_0x38bc73['attributes'][_0xa1b0('0x49')]?_0x38bc73[_0xa1b0('0x39')]:_0xb4c8d7[_0xa1b0('0x34')];if(_0x52dc52[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x38bc73[_0xa1b0('0x44')]=[{'all':!![]}];}_0x38bc73=_['merge']({},_0x38bc73,_0x52dc52['options']);return db[_0xa1b0('0x30')]['find'](_0x38bc73)[_0xa1b0('0x25')](handleEntityNotFound(_0x47f20c,null))[_0xa1b0('0x25')](respondWithResult(_0x47f20c,null))[_0xa1b0('0x47')](handleError(_0x47f20c,null));};exports['create']=function(_0x2be27f,_0x5e4594){return db['Campaign'][_0xa1b0('0x4a')](_0x2be27f[_0xa1b0('0x4b')],{})[_0xa1b0('0x25')](function(_0x10a478){var _0x51987d=_0x2be27f[_0xa1b0('0x4c')][_0xa1b0('0x27')]({'plain':!![]});if(!_0x51987d)throw new Error(_0xa1b0('0x4d'));if(_0x51987d['role']===_0xa1b0('0x4c')){var _0x296831=_0x10a478[_0xa1b0('0x27')]({'plain':!![]});var _0x38aac0=_0xa1b0('0x28');return db['UserProfileSection'][_0xa1b0('0x4e')]({'where':{'name':_0x38aac0,'userProfileId':_0x51987d[_0xa1b0('0x4f')]},'raw':!![]})[_0xa1b0('0x25')](function(_0x1d54a1){if(_0x1d54a1&&_0x1d54a1[_0xa1b0('0x50')]===0x0){return db[_0xa1b0('0x29')][_0xa1b0('0x4a')]({'name':_0x296831[_0xa1b0('0x2d')],'resourceId':_0x296831['id'],'type':_0x1d54a1[_0xa1b0('0x2d')],'sectionId':_0x1d54a1['id']},{})['then'](function(){return _0x10a478;});}else{return _0x10a478;}})[_0xa1b0('0x47')](function(_0x33df99){logger[_0xa1b0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33df99);throw _0x33df99;});}return _0x10a478;})[_0xa1b0('0x25')](respondWithResult(_0x5e4594,0xc9))[_0xa1b0('0x47')](handleError(_0x5e4594,null));};exports['clone']=function(_0x580d9a,_0x3122a8){var _0x275692={'where':{'id':_0x580d9a[_0xa1b0('0x51')]['id']}},_0x2b9aa1={};_0x2b9aa1[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x30')]['rawAttributes']);_0x275692[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x2b9aa1['model'],qs[_0xa1b0('0x3a')](_0x580d9a[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x275692[_0xa1b0('0x39')]=_0x275692[_0xa1b0('0x39')]['length']?_0x275692['attributes']:_0x2b9aa1['model'];if(_0x580d9a[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x275692['include']=[{'all':!![]}];}_0x275692=_[_0xa1b0('0x40')]({},_0x275692,_0x580d9a['options']);return db[_0xa1b0('0x30')][_0xa1b0('0x4e')](_0x275692)[_0xa1b0('0x25')](handleEntityNotFound(_0x3122a8,null))[_0xa1b0('0x25')](function(_0x46a837){if(_0x46a837){var _0x1a7a12=_0x46a837[_0xa1b0('0x27')]({'plain':!![]});_0x1a7a12=qs[_0xa1b0('0x52')](_0x1a7a12,['id',_0xa1b0('0x53'),_0xa1b0('0x54')]);_0x580d9a[_0xa1b0('0x4b')]=_[_0xa1b0('0x52')](_0x580d9a['body'],['id',_0xa1b0('0x53'),_0xa1b0('0x54')]);return db[_0xa1b0('0x30')][_0xa1b0('0x4a')](_['merge'](_0x1a7a12,_0x580d9a['body']),{'include':_0x580d9a[_0xa1b0('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x2f583a){var _0x271228=_0x580d9a[_0xa1b0('0x4c')][_0xa1b0('0x27')]({'plain':!![]});if(!_0x271228)throw new Error(_0xa1b0('0x4d'));if(_0x271228[_0xa1b0('0x55')]===_0xa1b0('0x4c')){var _0x3eafdd=_0x2f583a[_0xa1b0('0x27')]({'plain':!![]});var _0x5b6b2b='IvrCampaigns';return db[_0xa1b0('0x56')][_0xa1b0('0x4e')]({'where':{'name':_0x5b6b2b,'userProfileId':_0x271228[_0xa1b0('0x4f')]},'raw':!![]})['then'](function(_0x41f687){if(_0x41f687&&_0x41f687[_0xa1b0('0x50')]===0x0){return db[_0xa1b0('0x29')][_0xa1b0('0x4a')]({'name':_0x3eafdd[_0xa1b0('0x2d')],'resourceId':_0x3eafdd['id'],'type':_0x41f687[_0xa1b0('0x2d')],'sectionId':_0x41f687['id']},{})[_0xa1b0('0x25')](function(){return _0x2f583a;});}else{return _0x2f583a;}})[_0xa1b0('0x47')](function(_0x5db82c){logger[_0xa1b0('0x2b')](_0xa1b0('0x57'),_0x5db82c);throw _0x5db82c;});}return _0x2f583a;});}})[_0xa1b0('0x25')](respondWithResult(_0x3122a8,0xc9))[_0xa1b0('0x47')](handleError(_0x3122a8,null));};exports[_0xa1b0('0x24')]=function(_0x29bfc2,_0x4388d8){if(_0x29bfc2[_0xa1b0('0x4b')]['id']){delete _0x29bfc2[_0xa1b0('0x4b')]['id'];}return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x29bfc2['params']['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x4388d8,null))[_0xa1b0('0x25')](saveUpdates(_0x29bfc2[_0xa1b0('0x4b')],null))['then'](respondWithResult(_0x4388d8,null))[_0xa1b0('0x47')](handleError(_0x4388d8,null));};exports[_0xa1b0('0x26')]=function(_0x45ef33,_0x2f54cc){return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x45ef33[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x2f54cc,null))[_0xa1b0('0x25')](removeEntity(_0x2f54cc,null))['catch'](handleError(_0x2f54cc,null));};exports[_0xa1b0('0x58')]=function(_0x6f5ca5,_0x5a0896,_0x47d605){var _0x5dc3b2={'raw':!![],'where':{}};var _0x176b9a={};var _0x592405={'count':0x0,'rows':[]};return db['Campaign'][_0xa1b0('0x59')]({'where':{'id':_0x6f5ca5[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x5a0896,null))[_0xa1b0('0x25')](function(_0x26b035){if(_0x26b035){_0x176b9a[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmHopper']['rawAttributes']);_0x176b9a[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x6f5ca5[_0xa1b0('0x35')]);_0x176b9a['filters']=_['intersection'](_0x176b9a['model'],_0x176b9a[_0xa1b0('0x35')]);_0x5dc3b2['attributes']=_['intersection'](_0x176b9a[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x5dc3b2[_0xa1b0('0x39')]=_0x5dc3b2[_0xa1b0('0x39')][_0xa1b0('0x49')]?_0x5dc3b2[_0xa1b0('0x39')]:_0x176b9a['model'];if(!_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x5dc3b2[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x6f5ca5[_0xa1b0('0x35')]['limit']);_0x5dc3b2[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x5dc3b2[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x6f5ca5[_0xa1b0('0x35')]['sort']);_0x5dc3b2[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x6f5ca5[_0xa1b0('0x35')],_0x176b9a['filters']));_0x5dc3b2[_0xa1b0('0x3f')]['CampaignId']=_0x26b035['id'];if(_0x6f5ca5[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x5dc3b2[_0xa1b0('0x3f')]=_['merge'](_0x5dc3b2[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x5dc3b2[_0xa1b0('0x39')],function(_0x463ef){var _0x514f0c={};_0x514f0c[_0x463ef]={'$like':'%'+_0x6f5ca5['query'][_0xa1b0('0x3e')]+'%'};return _0x514f0c;})});}_0x5dc3b2=_[_0xa1b0('0x40')]({},_0x5dc3b2,_0x6f5ca5[_0xa1b0('0x42')]);return db['CmHopper'][_0xa1b0('0x21')]({'where':_0x5dc3b2[_0xa1b0('0x3f')]})['then'](function(_0x1b081f){_0x592405['count']=_0x1b081f;if(_0x6f5ca5[_0xa1b0('0x35')]['includeAll']){_0x5dc3b2['include']=[{'all':!![]}];}return db[_0xa1b0('0x5c')][_0xa1b0('0x45')](_0x5dc3b2);})[_0xa1b0('0x25')](function(_0x3258ee){_0x592405[_0xa1b0('0x46')]=_0x3258ee;return _0x592405;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x5a0896,_0x5dc3b2))[_0xa1b0('0x47')](handleError(_0x5a0896,null));};exports[_0xa1b0('0x5d')]=function(_0x4ee7ee,_0x256441,_0x36c5c4){var _0x3b5146={'raw':!![],'where':{}};var _0x303668={};var _0x4698ca={'count':0x0,'rows':[]};return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x4ee7ee[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x256441,null))[_0xa1b0('0x25')](function(_0x8c3b39){if(_0x8c3b39){_0x303668[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x5e')][_0xa1b0('0x31')]);_0x303668[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x4ee7ee['query']);_0x303668['filters']=_['intersection'](_0x303668[_0xa1b0('0x34')],_0x303668[_0xa1b0('0x35')]);_0x3b5146[_0xa1b0('0x39')]=_[_0xa1b0('0x38')](_0x303668['model'],qs[_0xa1b0('0x3a')](_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x3b5146[_0xa1b0('0x39')]=_0x3b5146['attributes'][_0xa1b0('0x49')]?_0x3b5146[_0xa1b0('0x39')]:_0x303668['model'];if(!_0x4ee7ee[_0xa1b0('0x35')]['hasOwnProperty'](_0xa1b0('0x3b'))){_0x3b5146['limit']=qs[_0xa1b0('0x20')](_0x4ee7ee['query'][_0xa1b0('0x20')]);_0x3b5146['offset']=qs[_0xa1b0('0x1e')](_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x3b5146[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x4ee7ee['query']['sort']);_0x3b5146['where']=qs[_0xa1b0('0x37')](_['pick'](_0x4ee7ee[_0xa1b0('0x35')],_0x303668['filters']));_0x3b5146[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x8c3b39['id'];if(_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x3b5146['where']=_[_0xa1b0('0x40')](_0x3b5146['where'],{'$or':_[_0xa1b0('0x2f')](_0x3b5146['attributes'],function(_0x3502e5){var _0x42eb2b={};_0x42eb2b[_0x3502e5]={'$like':'%'+_0x4ee7ee['query'][_0xa1b0('0x3e')]+'%'};return _0x42eb2b;})});}_0x3b5146=_[_0xa1b0('0x40')]({},_0x3b5146,_0x4ee7ee[_0xa1b0('0x42')]);return db[_0xa1b0('0x5e')][_0xa1b0('0x21')]({'where':_0x3b5146[_0xa1b0('0x3f')]})[_0xa1b0('0x25')](function(_0x14b199){_0x4698ca[_0xa1b0('0x21')]=_0x14b199;if(_0x4ee7ee[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x3b5146[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x5e')][_0xa1b0('0x45')](_0x3b5146);})[_0xa1b0('0x25')](function(_0x23ee83){_0x4698ca[_0xa1b0('0x46')]=_0x23ee83;return _0x4698ca;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x256441,_0x3b5146))['catch'](handleError(_0x256441,null));};exports['getHopperFinals']=function(_0x4b6a3e,_0x128800,_0xd2ae73){var _0x4bdd33={'raw':!![],'where':{}};var _0x536db0={};var _0x44b9f3={'count':0x0,'rows':[]};return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x4b6a3e[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x128800,null))[_0xa1b0('0x25')](function(_0x5c9a3f){if(_0x5c9a3f){_0x536db0[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db[_0xa1b0('0x60')][_0xa1b0('0x31')]);_0x536db0['query']=_[_0xa1b0('0x36')](_0x4b6a3e[_0xa1b0('0x35')]);_0x536db0[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x536db0['model'],_0x536db0[_0xa1b0('0x35')]);_0x4bdd33[_0xa1b0('0x39')]=_['intersection'](_0x536db0['model'],qs['fields'](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x4bdd33[_0xa1b0('0x39')]=_0x4bdd33['attributes'][_0xa1b0('0x49')]?_0x4bdd33['attributes']:_0x536db0[_0xa1b0('0x34')];if(!_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x4bdd33[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0x4bdd33['offset']=qs[_0xa1b0('0x1e')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x4bdd33[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0x4bdd33['where']=qs['filters'](_[_0xa1b0('0x5b')](_0x4b6a3e[_0xa1b0('0x35')],_0x536db0['filters']));_0x4bdd33[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x5c9a3f['id'];if(_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x4bdd33[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x4bdd33[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x4bdd33[_0xa1b0('0x39')],function(_0x4a8e74){var _0x42bc94={};_0x42bc94[_0x4a8e74]={'$like':'%'+_0x4b6a3e[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x42bc94;})});}_0x4bdd33=_[_0xa1b0('0x40')]({},_0x4bdd33,_0x4b6a3e[_0xa1b0('0x42')]);return db['CmHopperFinal']['count']({'where':_0x4bdd33[_0xa1b0('0x3f')]})['then'](function(_0x152aae){_0x44b9f3['count']=_0x152aae;if(_0x4b6a3e['query'][_0xa1b0('0x43')]){_0x4bdd33[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x60')][_0xa1b0('0x45')](_0x4bdd33);})[_0xa1b0('0x25')](function(_0x33e96b){_0x44b9f3[_0xa1b0('0x46')]=_0x33e96b;return _0x44b9f3;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x128800,_0x4bdd33))[_0xa1b0('0x47')](handleError(_0x128800,null));};exports[_0xa1b0('0x61')]=function(_0x16e73f,_0x376a89,_0x59ee0e){var _0x4bb1d3={'raw':!![],'where':{}};var _0x457d89={};var _0x23d117={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x16e73f['params']['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x376a89,null))[_0xa1b0('0x25')](function(_0x1bd61c){if(_0x1bd61c){_0x457d89['model']=_[_0xa1b0('0x36')](db[_0xa1b0('0x62')]['rawAttributes']);_0x457d89[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x16e73f[_0xa1b0('0x35')]);_0x457d89[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x457d89[_0xa1b0('0x34')],_0x457d89['query']);_0x4bb1d3[_0xa1b0('0x39')]=_['intersection'](_0x457d89[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x4bb1d3[_0xa1b0('0x39')]=_0x4bb1d3['attributes'][_0xa1b0('0x49')]?_0x4bb1d3['attributes']:_0x457d89['model'];if(!_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x4bb1d3[_0xa1b0('0x20')]=qs['limit'](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0x4bb1d3[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x1e')]);}_0x4bb1d3[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0x4bb1d3[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x16e73f[_0xa1b0('0x35')],_0x457d89[_0xa1b0('0x37')]));_0x4bb1d3[_0xa1b0('0x3f')][_0xa1b0('0x5f')]=_0x1bd61c['id'];if(_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0x4bb1d3[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x4bb1d3[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0x4bb1d3['attributes'],function(_0x3b8f5d){var _0x1c3712={};_0x1c3712[_0x3b8f5d]={'$like':'%'+_0x16e73f[_0xa1b0('0x35')]['filter']+'%'};return _0x1c3712;})});}_0x4bb1d3=_['merge']({},_0x4bb1d3,_0x16e73f['options']);return db[_0xa1b0('0x62')][_0xa1b0('0x21')]({'where':_0x4bb1d3[_0xa1b0('0x3f')]})[_0xa1b0('0x25')](function(_0x1aa056){_0x23d117[_0xa1b0('0x21')]=_0x1aa056;if(_0x16e73f[_0xa1b0('0x35')][_0xa1b0('0x43')]){_0x4bb1d3[_0xa1b0('0x44')]=[{'all':!![]}];}return db[_0xa1b0('0x62')]['findAll'](_0x4bb1d3);})[_0xa1b0('0x25')](function(_0x23b325){_0x23d117[_0xa1b0('0x46')]=_0x23b325;return _0x23d117;});}})[_0xa1b0('0x25')](respondWithFilteredResult(_0x376a89,_0x4bb1d3))[_0xa1b0('0x47')](handleError(_0x376a89,null));};exports['getLists']=function(_0x31eee2,_0x50e73e,_0x4c27b2){var _0x1adeea={};var _0x2c3606={};var _0x3e6db1;var _0x38f9f6;return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x31eee2[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x50e73e,null))[_0xa1b0('0x25')](function(_0x2a9222){if(_0x2a9222){_0x3e6db1=_0x2a9222;_0x2c3606[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmList']['rawAttributes']);_0x2c3606['query']=_[_0xa1b0('0x36')](_0x31eee2[_0xa1b0('0x35')]);_0x2c3606[_0xa1b0('0x37')]=_[_0xa1b0('0x38')](_0x2c3606[_0xa1b0('0x34')],_0x2c3606[_0xa1b0('0x35')]);_0x1adeea[_0xa1b0('0x39')]=_['intersection'](_0x2c3606[_0xa1b0('0x34')],qs[_0xa1b0('0x3a')](_0x31eee2[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0x1adeea[_0xa1b0('0x39')]=_0x1adeea[_0xa1b0('0x39')][_0xa1b0('0x49')]?_0x1adeea[_0xa1b0('0x39')]:_0x2c3606[_0xa1b0('0x34')];_0x1adeea[_0xa1b0('0x3c')]=qs[_0xa1b0('0x3d')](_0x31eee2[_0xa1b0('0x35')]['sort']);_0x1adeea['where']=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x31eee2[_0xa1b0('0x35')],_0x2c3606[_0xa1b0('0x37')]));if(_0x31eee2['query'][_0xa1b0('0x3e')]){_0x1adeea[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0x1adeea['where'],{'$or':_[_0xa1b0('0x2f')](_0x1adeea['attributes'],function(_0x2d9768){var _0x374919={};_0x374919[_0x2d9768]={'$like':'%'+_0x31eee2['query'][_0xa1b0('0x3e')]+'%'};return _0x374919;})});}_0x1adeea=_[_0xa1b0('0x40')]({},_0x1adeea,_0x31eee2[_0xa1b0('0x42')]);return _0x3e6db1[_0xa1b0('0x63')](_0x1adeea);}})['then'](function(_0x3c9d65){if(_0x3c9d65){_0x38f9f6=_0x3c9d65[_0xa1b0('0x49')];if(!_0x31eee2[_0xa1b0('0x35')][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0x1adeea[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x31eee2[_0xa1b0('0x35')]['limit']);_0x1adeea['offset']=qs['offset'](_0x31eee2['query'][_0xa1b0('0x1e')]);}return _0x3e6db1['getLists'](_0x1adeea);}})[_0xa1b0('0x25')](function(_0x4a32bc){if(_0x4a32bc){return _0x4a32bc?{'count':_0x38f9f6,'rows':_0x4a32bc}:null;}})[_0xa1b0('0x25')](respondWithResult(_0x50e73e,null))[_0xa1b0('0x47')](handleError(_0x50e73e,null));};exports[_0xa1b0('0x64')]=function(_0x4b7de7,_0x3c42db,_0x1b4f85){var _0x13540e,_0x5a7368;return db['Campaign']['find']({'where':{'id':_0x4b7de7[_0xa1b0('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c42db,null))[_0xa1b0('0x25')](function(_0x51eda8){if(_0x51eda8){_0x5a7368=_0x51eda8;return _0x51eda8[_0xa1b0('0x64')](_0x4b7de7['body'][_0xa1b0('0x65')],_[_0xa1b0('0x52')](_0x4b7de7[_0xa1b0('0x4b')],[_0xa1b0('0x65'),'id'])||{});}return null;})[_0xa1b0('0x66')](function(_0x3f60b5){var _0x2b115d;_0x13540e=_0x3f60b5||[];var _0x1bc720=[];if(_0x3f60b5){for(var _0x17284f=0x0;_0x17284f<_0x3f60b5[_0xa1b0('0x49')];_0x17284f+=0x1){var _0x3c5029=_0x3f60b5[_0x17284f][_0xa1b0('0x27')]({'plain':!![]});_0x5a7368['dialCheckDuplicateType']=_0x4b7de7[_0xa1b0('0x4b')][_0xa1b0('0x67')]?_0x4b7de7[_0xa1b0('0x4b')][_0xa1b0('0x67')]:_0x5a7368['dialCheckDuplicateType'];switch(_0x5a7368[_0xa1b0('0x67')]){case _0xa1b0('0x68'):_0x2b115d=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x6b'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),'scheduledAt',_0xa1b0('0x6e'),_0xa1b0('0x6f'),'CampaignId','createdAt',_0xa1b0('0x54')],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x6d'),_0xa1b0('0x6d'))[_0xa1b0('0x71')]('NOW()',_0xa1b0('0x72'))['field']('id',_0xa1b0('0x6e'))[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')]['toString'](),'ListId')['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),'CampaignId')['field']('NOW()','createdAt')[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))['from'](_0xa1b0('0x76'))['where'](_0xa1b0('0x77'))[_0xa1b0('0x3f')](_0xa1b0('0x78'),_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')]())[_0xa1b0('0x3f')](_0xa1b0('0x79'))[_0xa1b0('0x3f')](_0xa1b0('0x7a'),squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7b'))[_0xa1b0('0x7c')](_0xa1b0('0x7d'))[_0xa1b0('0x3f')]('CampaignId\x20=\x20?',_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]()))['where'](_0xa1b0('0x7a'),squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7e'))[_0xa1b0('0x7c')]('cm_hopper')[_0xa1b0('0x3f')]('CampaignId\x20=\x20?',_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]())))['toString']();break;case _0xa1b0('0x7f'):_0x2b115d=squel[_0xa1b0('0x69')]()['into'](_0xa1b0('0x6b'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),_0xa1b0('0x72'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),'updatedAt'],squel[_0xa1b0('0x70')]()['field']('phone',_0xa1b0('0x6d'))[_0xa1b0('0x71')]('NOW()','scheduledAt')[_0xa1b0('0x71')]('id','ContactId')[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')](),_0xa1b0('0x6f'))['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')](_0xa1b0('0x75'),'createdAt')[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))[_0xa1b0('0x7c')]('cm_contacts')[_0xa1b0('0x3f')](_0xa1b0('0x77'))[_0xa1b0('0x3f')](_0xa1b0('0x78'),_0x3c5029['CmListId'][_0xa1b0('0x74')]())[_0xa1b0('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x7e'))[_0xa1b0('0x7c')](_0xa1b0('0x6b'))[_0xa1b0('0x3f')](_0xa1b0('0x80'),_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')]())))['toString']();break;default:_0x2b115d=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x6b'))['fromQuery']([_0xa1b0('0x6d'),_0xa1b0('0x72'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),'updatedAt'],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')]('phone','phone')['field'](_0xa1b0('0x75'),_0xa1b0('0x72'))[_0xa1b0('0x71')]('id',_0xa1b0('0x6e'))[_0xa1b0('0x71')](_0x3c5029[_0xa1b0('0x73')][_0xa1b0('0x74')](),_0xa1b0('0x6f'))['field'](_0x4b7de7[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')]('NOW()','createdAt')[_0xa1b0('0x71')]('NOW()',_0xa1b0('0x54'))[_0xa1b0('0x7c')](_0xa1b0('0x76'))[_0xa1b0('0x3f')](_0xa1b0('0x77'))['where'](_0xa1b0('0x78'),_0x3c5029['CmListId']['toString']())['where'](_0xa1b0('0x79')))[_0xa1b0('0x74')]();}_0x1bc720[_0xa1b0('0x81')](db[_0xa1b0('0x82')][_0xa1b0('0x35')](_0x2b115d));}return BPromise[_0xa1b0('0x83')](_0x1bc720);}})[_0xa1b0('0x25')](function(){return _0x13540e;})[_0xa1b0('0x25')](respondWithResult(_0x3c42db,null))[_0xa1b0('0x47')](handleError(_0x3c42db,null));};exports['removeLists']=function(_0x4d12ae,_0x119deb,_0x5406c1){return db[_0xa1b0('0x30')]['find']({'where':{'id':_0x4d12ae[_0xa1b0('0x51')]['id']}})['then'](handleEntityNotFound(_0x119deb,null))[_0xa1b0('0x25')](function(_0x4872f1){if(_0x4872f1){return _0x4872f1['removeLists'](_0x4d12ae[_0xa1b0('0x35')][_0xa1b0('0x65')]);}})[_0xa1b0('0x25')](function(_0x291121){if(_0x291121){return db[_0xa1b0('0x5c')][_0xa1b0('0x26')]({'where':{'ListId':_0x4d12ae[_0xa1b0('0x35')]['ids'],'CampaignId':_0x4d12ae['params']['id']}})['then'](function(){return _0x291121;});}})[_0xa1b0('0x25')](respondWithStatusCode(_0x119deb,null))[_0xa1b0('0x47')](handleError(_0x119deb,null));};exports['getBlackLists']=function(_0x234b5e,_0x33161d,_0x526e3d){var _0xd931b6={};var _0x187e2f={};var _0x4e7cfa;var _0x10248;return db[_0xa1b0('0x30')][_0xa1b0('0x59')]({'where':{'id':_0x234b5e[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x33161d,null))[_0xa1b0('0x25')](function(_0x24313f){if(_0x24313f){_0x4e7cfa=_0x24313f;_0x187e2f[_0xa1b0('0x34')]=_[_0xa1b0('0x36')](db['CmList'][_0xa1b0('0x31')]);_0x187e2f[_0xa1b0('0x35')]=_[_0xa1b0('0x36')](_0x234b5e[_0xa1b0('0x35')]);_0x187e2f['filters']=_[_0xa1b0('0x38')](_0x187e2f['model'],_0x187e2f['query']);_0xd931b6[_0xa1b0('0x39')]=_['intersection'](_0x187e2f[_0xa1b0('0x34')],qs['fields'](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3a')]));_0xd931b6['attributes']=_0xd931b6[_0xa1b0('0x39')]['length']?_0xd931b6[_0xa1b0('0x39')]:_0x187e2f[_0xa1b0('0x34')];_0xd931b6['order']=qs[_0xa1b0('0x3d')](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3d')]);_0xd931b6[_0xa1b0('0x3f')]=qs[_0xa1b0('0x37')](_[_0xa1b0('0x5b')](_0x234b5e[_0xa1b0('0x35')],_0x187e2f[_0xa1b0('0x37')]));if(_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3e')]){_0xd931b6[_0xa1b0('0x3f')]=_[_0xa1b0('0x40')](_0xd931b6[_0xa1b0('0x3f')],{'$or':_[_0xa1b0('0x2f')](_0xd931b6[_0xa1b0('0x39')],function(_0x5e393b){var _0x2f7515={};_0x2f7515[_0x5e393b]={'$like':'%'+_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x3e')]+'%'};return _0x2f7515;})});}_0xd931b6=_[_0xa1b0('0x40')]({},_0xd931b6,_0x234b5e['options']);return _0x4e7cfa['getBlackLists'](_0xd931b6);}})['then'](function(_0x2dd541){if(_0x2dd541){_0x10248=_0x2dd541[_0xa1b0('0x49')];if(!_0x234b5e['query'][_0xa1b0('0x5a')](_0xa1b0('0x3b'))){_0xd931b6[_0xa1b0('0x20')]=qs[_0xa1b0('0x20')](_0x234b5e[_0xa1b0('0x35')][_0xa1b0('0x20')]);_0xd931b6[_0xa1b0('0x1e')]=qs[_0xa1b0('0x1e')](_0x234b5e[_0xa1b0('0x35')]['offset']);}return _0x4e7cfa[_0xa1b0('0x84')](_0xd931b6);}})[_0xa1b0('0x25')](function(_0x131aa7){if(_0x131aa7){return _0x131aa7?{'count':_0x10248,'rows':_0x131aa7}:null;}})[_0xa1b0('0x25')](respondWithResult(_0x33161d,null))[_0xa1b0('0x47')](handleError(_0x33161d,null));};exports['addBlackLists']=function(_0x1ac959,_0x1d70d7,_0x6c2c40){var _0x4c9a86,_0x3126ed;return db['Campaign'][_0xa1b0('0x4e')]({'where':{'id':_0x1ac959[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x1d70d7,null))['then'](function(_0x1558d3){if(_0x1558d3){_0x3126ed=_0x1558d3;return _0x1558d3[_0xa1b0('0x85')](_0x1ac959[_0xa1b0('0x4b')][_0xa1b0('0x65')],_[_0xa1b0('0x52')](_0x1ac959[_0xa1b0('0x4b')],[_0xa1b0('0x65'),'id'])||{});}return null;})[_0xa1b0('0x66')](function(_0x3104f0){var _0x5266b4;_0x4c9a86=_0x3104f0||[];var _0x987b27=[];if(_0x3104f0){for(var _0x1f9f53=0x0;_0x1f9f53<_0x3104f0['length'];_0x1f9f53+=0x1){var _0x44402e=_0x3104f0[_0x1f9f53]['get']({'plain':!![]});_0x5266b4=squel[_0xa1b0('0x69')]()[_0xa1b0('0x6a')](_0xa1b0('0x86'))[_0xa1b0('0x6c')]([_0xa1b0('0x6d'),_0xa1b0('0x6e'),_0xa1b0('0x6f'),_0xa1b0('0x5f'),_0xa1b0('0x53'),_0xa1b0('0x54')],squel[_0xa1b0('0x70')]()[_0xa1b0('0x71')](_0xa1b0('0x6d'),_0xa1b0('0x6d'))[_0xa1b0('0x71')]('id','ContactId')[_0xa1b0('0x71')](_0x44402e[_0xa1b0('0x73')]['toString'](),_0xa1b0('0x6f'))[_0xa1b0('0x71')](_0x1ac959[_0xa1b0('0x51')]['id'][_0xa1b0('0x74')](),_0xa1b0('0x5f'))[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x53'))[_0xa1b0('0x71')](_0xa1b0('0x75'),_0xa1b0('0x54'))['from']('cm_contacts')[_0xa1b0('0x3f')](_0xa1b0('0x77'))[_0xa1b0('0x3f')]('ListId\x20=\x20?',_0x44402e[_0xa1b0('0x73')][_0xa1b0('0x74')]())['where'](_0xa1b0('0x79')))[_0xa1b0('0x74')]();_0x987b27[_0xa1b0('0x81')](db['sequelize']['query'](_0x5266b4));}return BPromise[_0xa1b0('0x83')](_0x987b27);}})[_0xa1b0('0x25')](function(){return _0x4c9a86;})['then'](respondWithResult(_0x1d70d7,null))[_0xa1b0('0x47')](handleError(_0x1d70d7,null));};exports[_0xa1b0('0x87')]=function(_0x3e4296,_0x29b522,_0x2681d4){return db[_0xa1b0('0x30')][_0xa1b0('0x4e')]({'where':{'id':_0x3e4296[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](handleEntityNotFound(_0x29b522,null))[_0xa1b0('0x25')](function(_0x50f446){if(_0x50f446){return _0x50f446[_0xa1b0('0x87')](_0x3e4296[_0xa1b0('0x35')][_0xa1b0('0x65')]);}})['then'](function(_0x4ae882){if(_0x4ae882){return db[_0xa1b0('0x62')][_0xa1b0('0x26')]({'where':{'ListId':_0x3e4296[_0xa1b0('0x35')][_0xa1b0('0x65')],'CampaignId':_0x3e4296[_0xa1b0('0x51')]['id']}})[_0xa1b0('0x25')](function(){return _0x4ae882;});}})[_0xa1b0('0x25')](respondWithStatusCode(_0x29b522,null))[_0xa1b0('0x47')](handleError(_0x29b522,null));}; \ No newline at end of file +var _0xa169=['CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','sequelize','removeBlackLists','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','UserProfileResource','destroy','stack','name','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Campaign','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','IvrCampaigns','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','error','getHoppers','findOne','CmHopper'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xa169,0x13b));var _0x9a16=function(_0x9c502c,_0x12f7d0){_0x9c502c=_0x9c502c-0x0;var _0x8a1834=_0xa169[_0x9c502c];return _0x8a1834;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a16('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a16('0x1'));var BPromise=require(_0x9a16('0x2'));var Mustache=require('mustache');var util=require(_0x9a16('0x3'));var path=require(_0x9a16('0x4'));var sox=require(_0x9a16('0x5'));var csv=require(_0x9a16('0x6'));var ejs=require(_0x9a16('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a16('0x8'));var squel=require(_0x9a16('0x9'));var crypto=require(_0x9a16('0xa'));var jsforce=require(_0x9a16('0xb'));var deskjs=require(_0x9a16('0xc'));var toCsv=require(_0x9a16('0x6'));var querystring=require(_0x9a16('0xd'));var Papa=require(_0x9a16('0xe'));var Redis=require(_0x9a16('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a16('0x10'));var as=require(_0x9a16('0x11'));var hardwareService=require(_0x9a16('0x12'));var logger=require(_0x9a16('0x13'))(_0x9a16('0x14'));var utils=require(_0x9a16('0x15'));var config=require(_0x9a16('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a16('0x17'))['db'];function respondWithStatusCode(_0x59bcd6,_0x4290c3){_0x4290c3=_0x4290c3||0xcc;return function(_0xab63fb){if(_0xab63fb){return _0x59bcd6[_0x9a16('0x18')](_0x4290c3);}return _0x59bcd6['status'](_0x4290c3)[_0x9a16('0x19')]();};}function respondWithResult(_0x3bfc04,_0x1e59d1){_0x1e59d1=_0x1e59d1||0xc8;return function(_0x2eb354){if(_0x2eb354){return _0x3bfc04['status'](_0x1e59d1)[_0x9a16('0x1a')](_0x2eb354);}};}function respondWithFilteredResult(_0x10253a,_0x27f834){return function(_0x293454){if(_0x293454){var _0x3e044b=typeof _0x27f834[_0x9a16('0x1b')]===_0x9a16('0x1c')&&typeof _0x27f834[_0x9a16('0x1d')]==='undefined';var _0x40bee0=_0x293454[_0x9a16('0x1e')];var _0x33e0bc=_0x3e044b?0x0:_0x27f834[_0x9a16('0x1b')];var _0x1b05e1=_0x3e044b?_0x293454[_0x9a16('0x1e')]:_0x27f834[_0x9a16('0x1b')]+_0x27f834[_0x9a16('0x1d')];var _0xb4d5d6;if(_0x1b05e1>=_0x40bee0){_0x1b05e1=_0x40bee0;_0xb4d5d6=0xc8;}else{_0xb4d5d6=0xce;}_0x10253a[_0x9a16('0x1f')](_0xb4d5d6);return _0x10253a[_0x9a16('0x20')](_0x9a16('0x21'),_0x33e0bc+'-'+_0x1b05e1+'/'+_0x40bee0)[_0x9a16('0x1a')](_0x293454);}return null;};}function patchUpdates(_0xffdcca){return function(_0x442665){try{jsonpatch['apply'](_0x442665,_0xffdcca,!![]);}catch(_0xaa94f4){return BPromise[_0x9a16('0x22')](_0xaa94f4);}return _0x442665['save']();};}function saveUpdates(_0xe7f027,_0x255756){return function(_0x4ef667){if(_0x4ef667){return _0x4ef667[_0x9a16('0x23')](_0xe7f027)[_0x9a16('0x24')](function(_0x43e018){return _0x43e018;});}return null;};}function removeEntity(_0x89c0bd,_0x3fa6e9){return function(_0x133952){if(_0x133952){return _0x133952['destroy']()[_0x9a16('0x24')](function(){var _0x424969=_0x133952[_0x9a16('0x25')]({'plain':!![]});var _0x20e276='IvrCampaigns';return db[_0x9a16('0x26')][_0x9a16('0x27')]({'where':{'type':_0x20e276,'resourceId':_0x424969['id']}})[_0x9a16('0x24')](function(){return _0x133952;});})[_0x9a16('0x24')](function(){_0x89c0bd[_0x9a16('0x1f')](0xcc)[_0x9a16('0x19')]();});}};}function handleEntityNotFound(_0x3424a2,_0x385ad1){return function(_0x3a550f){if(!_0x3a550f){_0x3424a2[_0x9a16('0x18')](0x194);}return _0x3a550f;};}function handleError(_0x16329b,_0x30fa0b){_0x30fa0b=_0x30fa0b||0x1f4;return function(_0x4c118a){logger['error'](_0x4c118a[_0x9a16('0x28')]);if(_0x4c118a[_0x9a16('0x29')]){delete _0x4c118a[_0x9a16('0x29')];}_0x16329b[_0x9a16('0x1f')](_0x30fa0b)['send'](_0x4c118a);};}exports[_0x9a16('0x2a')]=function(_0x483fc1,_0xb279af){var _0x13cc7f={},_0x167b25={},_0x233161={'count':0x0,'rows':[]};var _0x1ab751=_['map'](db['Campaign'][_0x9a16('0x2b')],function(_0x2b6a2e){return{'name':_0x2b6a2e['fieldName'],'type':_0x2b6a2e[_0x9a16('0x2c')]['key']};});_0x167b25[_0x9a16('0x2d')]=_[_0x9a16('0x2e')](_0x1ab751,'name');_0x167b25[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x483fc1[_0x9a16('0x2f')]);_0x167b25[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x167b25['model'],_0x167b25[_0x9a16('0x2f')]);_0x13cc7f[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x167b25[_0x9a16('0x2d')],qs['fields'](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x13cc7f[_0x9a16('0x33')]=_0x13cc7f[_0x9a16('0x33')][_0x9a16('0x35')]?_0x13cc7f['attributes']:_0x167b25[_0x9a16('0x2d')];if(!_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x13cc7f['limit']=qs[_0x9a16('0x1d')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x13cc7f['offset']=qs[_0x9a16('0x1b')](_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x13cc7f[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x483fc1['query'][_0x9a16('0x39')]);_0x13cc7f[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x483fc1[_0x9a16('0x2f')],_0x167b25[_0x9a16('0x31')]),_0x1ab751);if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x13cc7f[_0x9a16('0x3a')]=_['merge'](_0x13cc7f[_0x9a16('0x3a')],{'$or':_['map'](_0x1ab751,function(_0x34e71d){if(_0x34e71d['type']!==_0x9a16('0x3d')){var _0x1da105={};_0x1da105[_0x34e71d[_0x9a16('0x29')]]={'$like':'%'+_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x1da105;}})});}_0x13cc7f=_[_0x9a16('0x3e')]({},_0x13cc7f,_0x483fc1[_0x9a16('0x3f')]);var _0x25ce6c={'where':_0x13cc7f[_0x9a16('0x3a')]};return db['Campaign']['count'](_0x25ce6c)[_0x9a16('0x24')](function(_0x534bea){_0x233161['count']=_0x534bea;if(_0x483fc1[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x13cc7f[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x42')][_0x9a16('0x43')](_0x13cc7f);})[_0x9a16('0x24')](function(_0x4bf1f2){_0x233161[_0x9a16('0x44')]=_0x4bf1f2;return _0x233161;})[_0x9a16('0x24')](respondWithFilteredResult(_0xb279af,_0x13cc7f))[_0x9a16('0x45')](handleError(_0xb279af,null));};exports[_0x9a16('0x46')]=function(_0x2759aa,_0x1b30b0){var _0x4afa39={'raw':![],'where':{'id':_0x2759aa[_0x9a16('0x47')]['id']}},_0x1b6497={};_0x1b6497['model']=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x1b6497[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x2759aa[_0x9a16('0x2f')]);_0x1b6497['filters']=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],_0x1b6497[_0x9a16('0x2f')]);_0x4afa39[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x1b6497[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x4afa39['attributes']=_0x4afa39['attributes'][_0x9a16('0x35')]?_0x4afa39[_0x9a16('0x33')]:_0x1b6497[_0x9a16('0x2d')];if(_0x2759aa[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4afa39[_0x9a16('0x41')]=[{'all':!![]}];}_0x4afa39=_[_0x9a16('0x3e')]({},_0x4afa39,_0x2759aa['options']);return db[_0x9a16('0x42')][_0x9a16('0x48')](_0x4afa39)['then'](handleEntityNotFound(_0x1b30b0,null))['then'](respondWithResult(_0x1b30b0,null))['catch'](handleError(_0x1b30b0,null));};exports['create']=function(_0xebb110,_0x26b126){return db[_0x9a16('0x42')][_0x9a16('0x49')](_0xebb110['body'],{})[_0x9a16('0x24')](function(_0x316665){var _0x1c1b92=_0xebb110['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x1c1b92)throw new Error(_0x9a16('0x4a'));if(_0x1c1b92[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x1c4072=_0x316665[_0x9a16('0x25')]({'plain':!![]});var _0x46b0bf=_0x9a16('0x4d');return db[_0x9a16('0x4e')][_0x9a16('0x48')]({'where':{'name':_0x46b0bf,'userProfileId':_0x1c1b92[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x3156ab){if(_0x3156ab&&_0x3156ab['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x1c4072[_0x9a16('0x29')],'resourceId':_0x1c4072['id'],'type':_0x3156ab['name'],'sectionId':_0x3156ab['id']},{})[_0x9a16('0x24')](function(){return _0x316665;});}else{return _0x316665;}})[_0x9a16('0x45')](function(_0x2037f0){logger['error'](_0x9a16('0x50'),_0x2037f0);throw _0x2037f0;});}return _0x316665;})[_0x9a16('0x24')](respondWithResult(_0x26b126,0xc9))[_0x9a16('0x45')](handleError(_0x26b126,null));};exports[_0x9a16('0x51')]=function(_0x312895,_0x367ffa){var _0x4e18c1={'where':{'id':_0x312895[_0x9a16('0x47')]['id']}},_0x2dda7c={};_0x2dda7c[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x42')][_0x9a16('0x2b')]);_0x4e18c1['attributes']=_[_0x9a16('0x32')](_0x2dda7c[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x312895['query'][_0x9a16('0x34')]));_0x4e18c1[_0x9a16('0x33')]=_0x4e18c1[_0x9a16('0x33')]['length']?_0x4e18c1[_0x9a16('0x33')]:_0x2dda7c[_0x9a16('0x2d')];if(_0x312895[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x4e18c1['include']=[{'all':!![]}];}_0x4e18c1=_[_0x9a16('0x3e')]({},_0x4e18c1,_0x312895[_0x9a16('0x3f')]);return db['Campaign']['find'](_0x4e18c1)[_0x9a16('0x24')](handleEntityNotFound(_0x367ffa,null))[_0x9a16('0x24')](function(_0x3f339f){if(_0x3f339f){var _0x5b15eb=_0x3f339f[_0x9a16('0x25')]({'plain':!![]});_0x5b15eb=qs['omit'](_0x5b15eb,['id','createdAt',_0x9a16('0x52')]);_0x312895[_0x9a16('0x53')]=_[_0x9a16('0x54')](_0x312895[_0x9a16('0x53')],['id',_0x9a16('0x55'),_0x9a16('0x52')]);return db[_0x9a16('0x42')][_0x9a16('0x49')](_['merge'](_0x5b15eb,_0x312895[_0x9a16('0x53')]),{'include':_0x312895['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x50a3c7){var _0x4de5af=_0x312895['user'][_0x9a16('0x25')]({'plain':!![]});if(!_0x4de5af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4de5af[_0x9a16('0x4b')]===_0x9a16('0x4c')){var _0x3fa395=_0x50a3c7[_0x9a16('0x25')]({'plain':!![]});var _0x8eb4b7=_0x9a16('0x4d');return db[_0x9a16('0x4e')]['find']({'where':{'name':_0x8eb4b7,'userProfileId':_0x4de5af[_0x9a16('0x4f')]},'raw':!![]})[_0x9a16('0x24')](function(_0x1130c3){if(_0x1130c3&&_0x1130c3['autoAssociation']===0x0){return db[_0x9a16('0x26')][_0x9a16('0x49')]({'name':_0x3fa395[_0x9a16('0x29')],'resourceId':_0x3fa395['id'],'type':_0x1130c3['name'],'sectionId':_0x1130c3['id']},{})['then'](function(){return _0x50a3c7;});}else{return _0x50a3c7;}})[_0x9a16('0x45')](function(_0x8ee3c6){logger[_0x9a16('0x56')](_0x9a16('0x50'),_0x8ee3c6);throw _0x8ee3c6;});}return _0x50a3c7;});}})['then'](respondWithResult(_0x367ffa,0xc9))['catch'](handleError(_0x367ffa,null));};exports[_0x9a16('0x23')]=function(_0x5ec523,_0x21b422){if(_0x5ec523[_0x9a16('0x53')]['id']){delete _0x5ec523[_0x9a16('0x53')]['id'];}return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x5ec523['params']['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x21b422,null))['then'](saveUpdates(_0x5ec523[_0x9a16('0x53')],null))[_0x9a16('0x24')](respondWithResult(_0x21b422,null))['catch'](handleError(_0x21b422,null));};exports[_0x9a16('0x27')]=function(_0x2e78cd,_0x4a9b9e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x2e78cd[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4a9b9e,null))['then'](removeEntity(_0x4a9b9e,null))[_0x9a16('0x45')](handleError(_0x4a9b9e,null));};exports[_0x9a16('0x57')]=function(_0x3f67a6,_0x3f3c35,_0x2ff8d4){var _0xc90f56={'raw':!![],'where':{}};var _0x3898b0={};var _0xdc6f8a={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x3f67a6[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3f3c35,null))[_0x9a16('0x24')](function(_0x556928){if(_0x556928){_0x3898b0[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x59')]['rawAttributes']);_0x3898b0['query']=_['keys'](_0x3f67a6['query']);_0x3898b0[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],_0x3898b0[_0x9a16('0x2f')]);_0xc90f56[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x3898b0[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x3f67a6['query'][_0x9a16('0x34')]));_0xc90f56[_0x9a16('0x33')]=_0xc90f56[_0x9a16('0x33')][_0x9a16('0x35')]?_0xc90f56[_0x9a16('0x33')]:_0x3898b0['model'];if(!_0x3f67a6['query'][_0x9a16('0x36')](_0x9a16('0x37'))){_0xc90f56[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xc90f56['offset']=qs[_0x9a16('0x1b')](_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xc90f56[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x3f67a6[_0x9a16('0x2f')]['sort']);_0xc90f56[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x3f67a6['query'],_0x3898b0[_0x9a16('0x31')]));_0xc90f56[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x556928['id'];if(_0x3f67a6[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xc90f56[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xc90f56[_0x9a16('0x3a')],{'$or':_['map'](_0xc90f56['attributes'],function(_0x1b91fc){var _0x5f088e={};_0x5f088e[_0x1b91fc]={'$like':'%'+_0x3f67a6['query'][_0x9a16('0x3c')]+'%'};return _0x5f088e;})});}_0xc90f56=_[_0x9a16('0x3e')]({},_0xc90f56,_0x3f67a6[_0x9a16('0x3f')]);return db[_0x9a16('0x59')][_0x9a16('0x1e')]({'where':_0xc90f56['where']})[_0x9a16('0x24')](function(_0x230f25){_0xdc6f8a[_0x9a16('0x1e')]=_0x230f25;if(_0x3f67a6[_0x9a16('0x2f')]['includeAll']){_0xc90f56[_0x9a16('0x41')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xc90f56);})['then'](function(_0x485a6c){_0xdc6f8a[_0x9a16('0x44')]=_0x485a6c;return _0xdc6f8a;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3f3c35,_0xc90f56))[_0x9a16('0x45')](handleError(_0x3f3c35,null));};exports[_0x9a16('0x5b')]=function(_0x5b21e8,_0x5e58c7,_0x4c01df){var _0x35bb1e={'raw':!![],'where':{}};var _0x289262={};var _0x3cc496={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x5b21e8[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5e58c7,null))[_0x9a16('0x24')](function(_0x3d0de0){if(_0x3d0de0){_0x289262[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x5c')][_0x9a16('0x2b')]);_0x289262[_0x9a16('0x2f')]=_['keys'](_0x5b21e8['query']);_0x289262[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x289262[_0x9a16('0x2d')],_0x289262['query']);_0x35bb1e['attributes']=_[_0x9a16('0x32')](_0x289262['model'],qs[_0x9a16('0x34')](_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x35bb1e[_0x9a16('0x33')]=_0x35bb1e['attributes'][_0x9a16('0x35')]?_0x35bb1e[_0x9a16('0x33')]:_0x289262[_0x9a16('0x2d')];if(!_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x35bb1e['limit']=qs[_0x9a16('0x1d')](_0x5b21e8['query'][_0x9a16('0x1d')]);_0x35bb1e['offset']=qs[_0x9a16('0x1b')](_0x5b21e8['query'][_0x9a16('0x1b')]);}_0x35bb1e[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x5b21e8[_0x9a16('0x2f')]['sort']);_0x35bb1e['where']=qs[_0x9a16('0x31')](_['pick'](_0x5b21e8['query'],_0x289262[_0x9a16('0x31')]));_0x35bb1e[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x3d0de0['id'];if(_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x35bb1e['where']=_[_0x9a16('0x3e')](_0x35bb1e[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x35bb1e[_0x9a16('0x33')],function(_0x3bb9bf){var _0xbaf780={};_0xbaf780[_0x3bb9bf]={'$like':'%'+_0x5b21e8[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0xbaf780;})});}_0x35bb1e=_['merge']({},_0x35bb1e,_0x5b21e8[_0x9a16('0x3f')]);return db[_0x9a16('0x5c')][_0x9a16('0x1e')]({'where':_0x35bb1e['where']})['then'](function(_0x15b936){_0x3cc496['count']=_0x15b936;if(_0x5b21e8[_0x9a16('0x2f')]['includeAll']){_0x35bb1e[_0x9a16('0x41')]=[{'all':!![]}];}return db[_0x9a16('0x5c')][_0x9a16('0x43')](_0x35bb1e);})['then'](function(_0x14ff36){_0x3cc496[_0x9a16('0x44')]=_0x14ff36;return _0x3cc496;});}})['then'](respondWithFilteredResult(_0x5e58c7,_0x35bb1e))[_0x9a16('0x45')](handleError(_0x5e58c7,null));};exports[_0x9a16('0x5d')]=function(_0x52442a,_0x4d8d8e,_0x173fe0){var _0xe6a16c={'raw':!![],'where':{}};var _0x493e66={};var _0x185cd8={'count':0x0,'rows':[]};return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x52442a[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x4d8d8e,null))[_0x9a16('0x24')](function(_0x44984a){if(_0x44984a){_0x493e66[_0x9a16('0x2d')]=_['keys'](db[_0x9a16('0x5e')]['rawAttributes']);_0x493e66[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x52442a['query']);_0x493e66[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x493e66[_0x9a16('0x2d')],_0x493e66[_0x9a16('0x2f')]);_0xe6a16c[_0x9a16('0x33')]=_['intersection'](_0x493e66['model'],qs['fields'](_0x52442a['query'][_0x9a16('0x34')]));_0xe6a16c[_0x9a16('0x33')]=_0xe6a16c[_0x9a16('0x33')][_0x9a16('0x35')]?_0xe6a16c[_0x9a16('0x33')]:_0x493e66[_0x9a16('0x2d')];if(!_0x52442a['query'][_0x9a16('0x36')]('nolimit')){_0xe6a16c[_0x9a16('0x1d')]=qs['limit'](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0xe6a16c[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x52442a[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0xe6a16c[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x52442a['query']['sort']);_0xe6a16c['where']=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0x52442a[_0x9a16('0x2f')],_0x493e66[_0x9a16('0x31')]));_0xe6a16c['where']['CampaignId']=_0x44984a['id'];if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0xe6a16c[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0xe6a16c[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0xe6a16c[_0x9a16('0x33')],function(_0x1762a5){var _0x2edad0={};_0x2edad0[_0x1762a5]={'$like':'%'+_0x52442a[_0x9a16('0x2f')]['filter']+'%'};return _0x2edad0;})});}_0xe6a16c=_[_0x9a16('0x3e')]({},_0xe6a16c,_0x52442a[_0x9a16('0x3f')]);return db[_0x9a16('0x5e')]['count']({'where':_0xe6a16c['where']})[_0x9a16('0x24')](function(_0x32e50c){_0x185cd8[_0x9a16('0x1e')]=_0x32e50c;if(_0x52442a[_0x9a16('0x2f')][_0x9a16('0x40')]){_0xe6a16c['include']=[{'all':!![]}];}return db[_0x9a16('0x5e')][_0x9a16('0x43')](_0xe6a16c);})[_0x9a16('0x24')](function(_0x1d7d55){_0x185cd8[_0x9a16('0x44')]=_0x1d7d55;return _0x185cd8;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x4d8d8e,_0xe6a16c))[_0x9a16('0x45')](handleError(_0x4d8d8e,null));};exports[_0x9a16('0x5f')]=function(_0xeaddea,_0x3c59f9,_0x3e3dae){var _0x5d3899={'raw':!![],'where':{}};var _0x147753={};var _0x84a3c={'count':0x0,'rows':[]};return db['Campaign'][_0x9a16('0x58')]({'where':{'id':_0xeaddea[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x3c59f9,null))['then'](function(_0x46c526){if(_0x46c526){_0x147753[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db[_0x9a16('0x60')][_0x9a16('0x2b')]);_0x147753[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0xeaddea[_0x9a16('0x2f')]);_0x147753[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],_0x147753[_0x9a16('0x2f')]);_0x5d3899[_0x9a16('0x33')]=_[_0x9a16('0x32')](_0x147753[_0x9a16('0x2d')],qs['fields'](_0xeaddea[_0x9a16('0x2f')]['fields']));_0x5d3899[_0x9a16('0x33')]=_0x5d3899[_0x9a16('0x33')]['length']?_0x5d3899[_0x9a16('0x33')]:_0x147753[_0x9a16('0x2d')];if(!_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x36')](_0x9a16('0x37'))){_0x5d3899[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x5d3899['offset']=qs[_0x9a16('0x1b')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x1b')]);}_0x5d3899['order']=qs[_0x9a16('0x39')](_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x5d3899[_0x9a16('0x3a')]=qs[_0x9a16('0x31')](_[_0x9a16('0x3b')](_0xeaddea['query'],_0x147753[_0x9a16('0x31')]));_0x5d3899[_0x9a16('0x3a')][_0x9a16('0x5a')]=_0x46c526['id'];if(_0xeaddea[_0x9a16('0x2f')]['filter']){_0x5d3899[_0x9a16('0x3a')]=_['merge'](_0x5d3899['where'],{'$or':_[_0x9a16('0x2e')](_0x5d3899[_0x9a16('0x33')],function(_0x4a6352){var _0x93a271={};_0x93a271[_0x4a6352]={'$like':'%'+_0xeaddea['query'][_0x9a16('0x3c')]+'%'};return _0x93a271;})});}_0x5d3899=_['merge']({},_0x5d3899,_0xeaddea['options']);return db[_0x9a16('0x60')][_0x9a16('0x1e')]({'where':_0x5d3899[_0x9a16('0x3a')]})[_0x9a16('0x24')](function(_0x402f7d){_0x84a3c[_0x9a16('0x1e')]=_0x402f7d;if(_0xeaddea[_0x9a16('0x2f')][_0x9a16('0x40')]){_0x5d3899['include']=[{'all':!![]}];}return db[_0x9a16('0x60')][_0x9a16('0x43')](_0x5d3899);})[_0x9a16('0x24')](function(_0x5100f2){_0x84a3c['rows']=_0x5100f2;return _0x84a3c;});}})[_0x9a16('0x24')](respondWithFilteredResult(_0x3c59f9,_0x5d3899))[_0x9a16('0x45')](handleError(_0x3c59f9,null));};exports[_0x9a16('0x61')]=function(_0x195a29,_0x49cebf,_0x141949){var _0x22e5d1={};var _0x159891={};var _0x592669;var _0xdaf8ad;return db[_0x9a16('0x42')]['findOne']({'where':{'id':_0x195a29['params']['id']}})['then'](handleEntityNotFound(_0x49cebf,null))[_0x9a16('0x24')](function(_0xf0eaa9){if(_0xf0eaa9){_0x592669=_0xf0eaa9;_0x159891[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList']['rawAttributes']);_0x159891[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x195a29[_0x9a16('0x2f')]);_0x159891[_0x9a16('0x31')]=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],_0x159891['query']);_0x22e5d1['attributes']=_[_0x9a16('0x32')](_0x159891[_0x9a16('0x2d')],qs[_0x9a16('0x34')](_0x195a29['query']['fields']));_0x22e5d1[_0x9a16('0x33')]=_0x22e5d1[_0x9a16('0x33')][_0x9a16('0x35')]?_0x22e5d1[_0x9a16('0x33')]:_0x159891['model'];_0x22e5d1[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x22e5d1['where']=qs[_0x9a16('0x31')](_['pick'](_0x195a29[_0x9a16('0x2f')],_0x159891[_0x9a16('0x31')]));if(_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x22e5d1[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x22e5d1['where'],{'$or':_[_0x9a16('0x2e')](_0x22e5d1[_0x9a16('0x33')],function(_0x260ba1){var _0x39127a={};_0x39127a[_0x260ba1]={'$like':'%'+_0x195a29[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x39127a;})});}_0x22e5d1=_[_0x9a16('0x3e')]({},_0x22e5d1,_0x195a29[_0x9a16('0x3f')]);return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x284c15){if(_0x284c15){_0xdaf8ad=_0x284c15['length'];if(!_0x195a29[_0x9a16('0x2f')]['hasOwnProperty']('nolimit')){_0x22e5d1['limit']=qs[_0x9a16('0x1d')](_0x195a29[_0x9a16('0x2f')]['limit']);_0x22e5d1['offset']=qs[_0x9a16('0x1b')](_0x195a29[_0x9a16('0x2f')][_0x9a16('0x1b')]);}return _0x592669[_0x9a16('0x61')](_0x22e5d1);}})['then'](function(_0x2a8d2d){if(_0x2a8d2d){return _0x2a8d2d?{'count':_0xdaf8ad,'rows':_0x2a8d2d}:null;}})['then'](respondWithResult(_0x49cebf,null))['catch'](handleError(_0x49cebf,null));};exports[_0x9a16('0x62')]=function(_0x559581,_0x5b332b,_0x4be2e5){var _0x370523,_0x3af669;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x559581[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x5b332b,null))[_0x9a16('0x24')](function(_0xba1c55){if(_0xba1c55){_0x3af669=_0xba1c55;return _0xba1c55[_0x9a16('0x62')](_0x559581[_0x9a16('0x53')]['ids'],_['omit'](_0x559581[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})['spread'](function(_0x5eddb3){var _0x428a0e;_0x370523=_0x5eddb3||[];var _0x342278=[];if(_0x5eddb3){for(var _0x3fe33a=0x0;_0x3fe33a<_0x5eddb3[_0x9a16('0x35')];_0x3fe33a+=0x1){var _0xbfae=_0x5eddb3[_0x3fe33a][_0x9a16('0x25')]({'plain':!![]});_0x3af669['dialCheckDuplicateType']=_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]?_0x559581[_0x9a16('0x53')][_0x9a16('0x64')]:_0x3af669[_0x9a16('0x64')];switch(_0x3af669[_0x9a16('0x64')]){case _0x9a16('0x65'):_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6b'),_0x9a16('0x6c'),'ListId',_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel['select']()[_0x9a16('0x6d')]('phone','phone')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id','ContactId')[_0x9a16('0x6d')](_0xbfae['CmListId'][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),_0x9a16('0x5a'))['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')]('cm_contacts')[_0x9a16('0x3a')](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')]['toString']())['where'](_0x9a16('0x75'))[_0x9a16('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x77'))[_0x9a16('0x71')](_0x9a16('0x78'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]()))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')]('cm_hopper')['where'](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;case _0x9a16('0x7c'):_0x428a0e=squel[_0x9a16('0x66')]()['into']('cm_hopper')[_0x9a16('0x69')](['phone',_0x9a16('0x6b'),'ContactId',_0x9a16('0x70'),_0x9a16('0x5a'),_0x9a16('0x55'),_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))['field'](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),_0x9a16('0x70'))[_0x9a16('0x6d')](_0x559581['params']['id']['toString'](),'CampaignId')[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')]('NOW()',_0x9a16('0x52'))['from']('cm_contacts')['where'](_0x9a16('0x72'))[_0x9a16('0x3a')](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75'))[_0x9a16('0x3a')](_0x9a16('0x7a'),squel['select']()[_0x9a16('0x6d')](_0x9a16('0x7b'))[_0x9a16('0x71')](_0x9a16('0x68'))[_0x9a16('0x3a')](_0x9a16('0x79'),_0x559581[_0x9a16('0x47')]['id'][_0x9a16('0x6f')]())))[_0x9a16('0x6f')]();break;default:_0x428a0e=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x68'))['fromQuery'](['phone',_0x9a16('0x6b'),_0x9a16('0x6c'),_0x9a16('0x70'),_0x9a16('0x5a'),'createdAt',_0x9a16('0x52')],squel[_0x9a16('0x76')]()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x6b'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))[_0x9a16('0x6d')](_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')](),'ListId')['field'](_0x559581['params']['id']['toString'](),'CampaignId')['field'](_0x9a16('0x6e'),_0x9a16('0x55'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x52'))[_0x9a16('0x71')](_0x9a16('0x7d'))[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xbfae[_0x9a16('0x74')][_0x9a16('0x6f')]())[_0x9a16('0x3a')](_0x9a16('0x75')))['toString']();}_0x342278[_0x9a16('0x7e')](db['sequelize'][_0x9a16('0x2f')](_0x428a0e));}return BPromise[_0x9a16('0x7f')](_0x342278);}})[_0x9a16('0x24')](function(){return _0x370523;})[_0x9a16('0x24')](respondWithResult(_0x5b332b,null))[_0x9a16('0x45')](handleError(_0x5b332b,null));};exports[_0x9a16('0x80')]=function(_0x40a0e2,_0x199255,_0xb8fc2d){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x40a0e2[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x199255,null))[_0x9a16('0x24')](function(_0x21d101){if(_0x21d101){return _0x21d101['removeLists'](_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0x9a6a1a){if(_0x9a6a1a){return db[_0x9a16('0x59')]['destroy']({'where':{'ListId':_0x40a0e2[_0x9a16('0x2f')][_0x9a16('0x63')],'CampaignId':_0x40a0e2['params']['id']}})['then'](function(){return _0x9a6a1a;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x199255,null))[_0x9a16('0x45')](handleError(_0x199255,null));};exports['getBlackLists']=function(_0x318553,_0x23e42f,_0xb5a6d3){var _0x29d474={};var _0x4db13e={};var _0x26c437;var _0x1a7e4c;return db[_0x9a16('0x42')][_0x9a16('0x58')]({'where':{'id':_0x318553[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](handleEntityNotFound(_0x23e42f,null))[_0x9a16('0x24')](function(_0x3e800a){if(_0x3e800a){_0x26c437=_0x3e800a;_0x4db13e[_0x9a16('0x2d')]=_[_0x9a16('0x30')](db['CmList'][_0x9a16('0x2b')]);_0x4db13e[_0x9a16('0x2f')]=_[_0x9a16('0x30')](_0x318553['query']);_0x4db13e[_0x9a16('0x31')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],_0x4db13e[_0x9a16('0x2f')]);_0x29d474[_0x9a16('0x33')]=_['intersection'](_0x4db13e[_0x9a16('0x2d')],qs['fields'](_0x318553[_0x9a16('0x2f')][_0x9a16('0x34')]));_0x29d474[_0x9a16('0x33')]=_0x29d474['attributes'][_0x9a16('0x35')]?_0x29d474[_0x9a16('0x33')]:_0x4db13e[_0x9a16('0x2d')];_0x29d474[_0x9a16('0x38')]=qs[_0x9a16('0x39')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x39')]);_0x29d474[_0x9a16('0x3a')]=qs['filters'](_['pick'](_0x318553[_0x9a16('0x2f')],_0x4db13e[_0x9a16('0x31')]));if(_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]){_0x29d474[_0x9a16('0x3a')]=_[_0x9a16('0x3e')](_0x29d474[_0x9a16('0x3a')],{'$or':_[_0x9a16('0x2e')](_0x29d474[_0x9a16('0x33')],function(_0x3f77b2){var _0x2c23d2={};_0x2c23d2[_0x3f77b2]={'$like':'%'+_0x318553[_0x9a16('0x2f')][_0x9a16('0x3c')]+'%'};return _0x2c23d2;})});}_0x29d474=_[_0x9a16('0x3e')]({},_0x29d474,_0x318553['options']);return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x18d16d){if(_0x18d16d){_0x1a7e4c=_0x18d16d[_0x9a16('0x35')];if(!_0x318553[_0x9a16('0x2f')][_0x9a16('0x36')]('nolimit')){_0x29d474[_0x9a16('0x1d')]=qs[_0x9a16('0x1d')](_0x318553[_0x9a16('0x2f')][_0x9a16('0x1d')]);_0x29d474[_0x9a16('0x1b')]=qs[_0x9a16('0x1b')](_0x318553['query'][_0x9a16('0x1b')]);}return _0x26c437[_0x9a16('0x81')](_0x29d474);}})[_0x9a16('0x24')](function(_0x4aa7a5){if(_0x4aa7a5){return _0x4aa7a5?{'count':_0x1a7e4c,'rows':_0x4aa7a5}:null;}})[_0x9a16('0x24')](respondWithResult(_0x23e42f,null))[_0x9a16('0x45')](handleError(_0x23e42f,null));};exports[_0x9a16('0x82')]=function(_0x442c2a,_0x577692,_0x3e8c12){var _0xcd787,_0x6a5bff;return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x442c2a['params']['id']}})['then'](handleEntityNotFound(_0x577692,null))['then'](function(_0xbb1d3b){if(_0xbb1d3b){_0x6a5bff=_0xbb1d3b;return _0xbb1d3b[_0x9a16('0x82')](_0x442c2a[_0x9a16('0x53')][_0x9a16('0x63')],_[_0x9a16('0x54')](_0x442c2a[_0x9a16('0x53')],[_0x9a16('0x63'),'id'])||{});}return null;})[_0x9a16('0x83')](function(_0x4817be){var _0x64f946;_0xcd787=_0x4817be||[];var _0x20777a=[];if(_0x4817be){for(var _0x5a553b=0x0;_0x5a553b<_0x4817be[_0x9a16('0x35')];_0x5a553b+=0x1){var _0xe45c1e=_0x4817be[_0x5a553b][_0x9a16('0x25')]({'plain':!![]});_0x64f946=squel[_0x9a16('0x66')]()[_0x9a16('0x67')](_0x9a16('0x84'))[_0x9a16('0x69')]([_0x9a16('0x6a'),_0x9a16('0x6c'),_0x9a16('0x70'),'CampaignId',_0x9a16('0x55'),'updatedAt'],squel['select']()[_0x9a16('0x6d')](_0x9a16('0x6a'),_0x9a16('0x6a'))[_0x9a16('0x6d')]('id',_0x9a16('0x6c'))['field'](_0xe45c1e['CmListId']['toString'](),_0x9a16('0x70'))['field'](_0x442c2a['params']['id'][_0x9a16('0x6f')](),_0x9a16('0x5a'))[_0x9a16('0x6d')](_0x9a16('0x6e'),_0x9a16('0x55'))['field'](_0x9a16('0x6e'),'updatedAt')['from']('cm_contacts')[_0x9a16('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0x9a16('0x73'),_0xe45c1e[_0x9a16('0x74')]['toString']())[_0x9a16('0x3a')](_0x9a16('0x75')))[_0x9a16('0x6f')]();_0x20777a['push'](db[_0x9a16('0x85')]['query'](_0x64f946));}return BPromise['all'](_0x20777a);}})['then'](function(){return _0xcd787;})[_0x9a16('0x24')](respondWithResult(_0x577692,null))['catch'](handleError(_0x577692,null));};exports['removeBlackLists']=function(_0x171a01,_0x12b247,_0x30f28e){return db[_0x9a16('0x42')][_0x9a16('0x48')]({'where':{'id':_0x171a01[_0x9a16('0x47')]['id']}})['then'](handleEntityNotFound(_0x12b247,null))[_0x9a16('0x24')](function(_0x3906d4){if(_0x3906d4){return _0x3906d4[_0x9a16('0x86')](_0x171a01[_0x9a16('0x2f')][_0x9a16('0x63')]);}})['then'](function(_0xaac4ab){if(_0xaac4ab){return db[_0x9a16('0x60')][_0x9a16('0x27')]({'where':{'ListId':_0x171a01['query'][_0x9a16('0x63')],'CampaignId':_0x171a01[_0x9a16('0x47')]['id']}})[_0x9a16('0x24')](function(){return _0xaac4ab;});}})[_0x9a16('0x24')](respondWithStatusCode(_0x12b247,null))[_0x9a16('0x45')](handleError(_0x12b247,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index aaa0bfa..4d4ddaa 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x14e589,_0x5d5c97){var _0x4ceb8c=function(_0x55f065){while(--_0x55f065){_0x14e589['push'](_0x14e589['shift']());}};_0x4ceb8c(++_0x5d5c97);}(_0x7a54,0x106));var _0x47a5=function(_0x522bef,_0x4b6cae){_0x522bef=_0x522bef-0x0;var _0x38c629=_0x7a54[_0x522bef];return _0x38c629;};'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 7cfa0ea..ddc5ee1 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 _0xc252=['raw','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options'];(function(_0x14996e,_0x108636){var _0x2f0151=function(_0x20dd91){while(--_0x20dd91){_0x14996e['push'](_0x14996e['shift']());}};_0x2f0151(++_0x108636);}(_0xc252,0x118));var _0x2c25=function(_0x22650a,_0x4de8e4){_0x22650a=_0x22650a-0x0;var _0x87dc8d=_0xc252[_0x22650a];return _0x87dc8d;};'use strict';var _=require(_0x2c25('0x0'));var util=require(_0x2c25('0x1'));var moment=require(_0x2c25('0x2'));var BPromise=require(_0x2c25('0x3'));var rs=require(_0x2c25('0x4'));var fs=require('fs');var Redis=require(_0x2c25('0x5'));var db=require(_0x2c25('0x6'))['db'];var utils=require(_0x2c25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2c25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2c25('0x9')][_0x2c25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39972f,_0x1ec60a,_0x5f1278){return new BPromise(function(_0x491314,_0x16f20){return client[_0x2c25('0xb')](_0x39972f,_0x5f1278)[_0x2c25('0xc')](function(_0x1f927e){logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,_0x2c25('0xf'));logger['debug'](_0x2c25('0x10'),_0x1ec60a,'request\x20sent',JSON[_0x2c25('0x11')](_0x1f927e));if(_0x1f927e['error']){if(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x13')]===0x1f4){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')]['message']);return _0x16f20(_0x1f927e['error'][_0x2c25('0x14')]);}logger[_0x2c25('0x12')](_0x2c25('0xe'),_0x1ec60a,_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);return _0x491314(_0x1f927e[_0x2c25('0x12')][_0x2c25('0x14')]);}else{logger[_0x2c25('0xd')](_0x2c25('0xe'),_0x1ec60a,'request\x20sent');_0x491314(_0x1f927e['result'][_0x2c25('0x14')]);}})[_0x2c25('0x15')](function(_0x8b04ce){logger['error'](_0x2c25('0xe'),_0x1ec60a,_0x8b04ce);_0x16f20(_0x8b04ce);});});}exports[_0x2c25('0x16')]=function(_0x28093a){var _0x19ff99=this;return new Promise(function(_0x4bfc1e,_0xe0af6){return db[_0x2c25('0x17')][_0x2c25('0x18')]({'raw':_0x28093a[_0x2c25('0x19')]?_0x28093a['options'][_0x2c25('0x1a')]===undefined?!![]:![]:!![],'where':_0x28093a['options']?_0x28093a['options'][_0x2c25('0x1b')]||null:null,'attributes':_0x28093a['options']?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1c')]||null:null,'limit':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1d')]||null:null,'include':_0x28093a[_0x2c25('0x19')]?_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')]?_[_0x2c25('0x1f')](_0x28093a[_0x2c25('0x19')][_0x2c25('0x1e')],function(_0x516ed1){return{'model':db[_0x516ed1['model']],'as':_0x516ed1['as'],'attributes':_0x516ed1[_0x2c25('0x1c')],'include':_0x516ed1['include']?_[_0x2c25('0x1f')](_0x516ed1[_0x2c25('0x1e')],function(_0x41c26b){return{'model':db[_0x41c26b[_0x2c25('0x20')]],'as':_0x41c26b['as'],'attributes':_0x41c26b[_0x2c25('0x1c')],'include':_0x41c26b['include']?_[_0x2c25('0x1f')](_0x41c26b[_0x2c25('0x1e')],function(_0x3f6906){return{'model':db[_0x3f6906['model']],'as':_0x3f6906['as'],'attributes':_0x3f6906[_0x2c25('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa7cbb6){logger[_0x2c25('0xd')]('GetCampaign',_0x28093a);logger[_0x2c25('0x21')](_0x2c25('0x16'),_0x28093a,JSON['stringify'](_0xa7cbb6));_0x4bfc1e(_0xa7cbb6);})[_0x2c25('0x15')](function(_0x4a8193){logger['error'](_0x2c25('0x16'),_0x4a8193[_0x2c25('0x14')],_0x28093a);_0xe0af6(_0x19ff99[_0x2c25('0x12')](0x1f4,_0x4a8193[_0x2c25('0x14')]));});});}; \ No newline at end of file +var _0x4403=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCampaign','findAll','options','raw','where','attributes','include','model','map'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4403,0x179));var _0x3440=function(_0x136de0,_0xed928c){_0x136de0=_0x136de0-0x0;var _0x3a08df=_0x4403[_0x136de0];return _0x3a08df;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3440('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3440('0x1'));var db=require(_0x3440('0x2'))['db'];var utils=require(_0x3440('0x3'));var logger=require(_0x3440('0x4'))('rpc');var config=require(_0x3440('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3440('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3121bd,_0x338e48,_0x4abc5a){return new BPromise(function(_0x33a070,_0x59d581){return client[_0x3440('0x7')](_0x3121bd,_0x4abc5a)[_0x3440('0x8')](function(_0x4559cd){logger['info'](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));logger[_0x3440('0xb')](_0x3440('0xc'),_0x338e48,_0x3440('0xa'),JSON[_0x3440('0xd')](_0x4559cd));if(_0x4559cd[_0x3440('0xe')]){if(_0x4559cd['error'][_0x3440('0xf')]===0x1f4){logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x59d581(_0x4559cd[_0x3440('0xe')][_0x3440('0x10')]);}logger[_0x3440('0xe')](_0x3440('0x9'),_0x338e48,_0x4559cd['error'][_0x3440('0x10')]);return _0x33a070(_0x4559cd['error'][_0x3440('0x10')]);}else{logger[_0x3440('0x11')](_0x3440('0x9'),_0x338e48,_0x3440('0xa'));_0x33a070(_0x4559cd[_0x3440('0x12')][_0x3440('0x10')]);}})[_0x3440('0x13')](function(_0xb66a69){logger['error'](_0x3440('0x9'),_0x338e48,_0xb66a69);_0x59d581(_0xb66a69);});});}exports[_0x3440('0x14')]=function(_0x43fd39){var _0x1c10fd=this;return new Promise(function(_0x31a8dd,_0x39ee81){return db['Campaign'][_0x3440('0x15')]({'raw':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x17')]===undefined?!![]:![]:!![],'where':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x18')]||null:null,'attributes':_0x43fd39[_0x3440('0x16')]?_0x43fd39[_0x3440('0x16')][_0x3440('0x19')]||null:null,'limit':_0x43fd39[_0x3440('0x16')]?_0x43fd39['options']['limit']||null:null,'include':_0x43fd39['options']?_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')]?_['map'](_0x43fd39[_0x3440('0x16')][_0x3440('0x1a')],function(_0x33cfb5){return{'model':db[_0x33cfb5[_0x3440('0x1b')]],'as':_0x33cfb5['as'],'attributes':_0x33cfb5[_0x3440('0x19')],'include':_0x33cfb5['include']?_[_0x3440('0x1c')](_0x33cfb5[_0x3440('0x1a')],function(_0x3b9e75){return{'model':db[_0x3b9e75[_0x3440('0x1b')]],'as':_0x3b9e75['as'],'attributes':_0x3b9e75[_0x3440('0x19')],'include':_0x3b9e75['include']?_[_0x3440('0x1c')](_0x3b9e75[_0x3440('0x1a')],function(_0x1cfe3a){return{'model':db[_0x1cfe3a[_0x3440('0x1b')]],'as':_0x1cfe3a['as'],'attributes':_0x1cfe3a[_0x3440('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x391728){logger[_0x3440('0x11')](_0x3440('0x14'),_0x43fd39);logger[_0x3440('0xb')](_0x3440('0x14'),_0x43fd39,JSON[_0x3440('0xd')](_0x391728));_0x31a8dd(_0x391728);})[_0x3440('0x13')](function(_0x1f7fee){logger[_0x3440('0xe')](_0x3440('0x14'),_0x1f7fee[_0x3440('0x10')],_0x43fd39);_0x39ee81(_0x1c10fd['error'](0x1f4,_0x1f7fee['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index bf6aed5..83500fe 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 _0x2463=['removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','put','update','delete'];(function(_0x4aaffa,_0x1cb820){var _0x332342=function(_0xf099d4){while(--_0xf099d4){_0x4aaffa['push'](_0x4aaffa['shift']());}};_0x332342(++_0x1cb820);}(_0x2463,0xf7));var _0x3246=function(_0x47dc4a,_0x370407){_0x47dc4a=_0x47dc4a-0x0;var _0x254a3a=_0x2463[_0x47dc4a];return _0x254a3a;};'use strict';var multer=require(_0x3246('0x0'));var util=require(_0x3246('0x1'));var path=require(_0x3246('0x2'));var timeout=require(_0x3246('0x3'));var express=require(_0x3246('0x4'));var router=express[_0x3246('0x5')]();var fs_extra=require(_0x3246('0x6'));var auth=require(_0x3246('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3246('0x8'));var controller=require('./campaign.controller');router['get']('/',auth[_0x3246('0x9')](),controller[_0x3246('0xa')]);router[_0x3246('0xb')](_0x3246('0xc'),auth['isAuthenticated'](),controller[_0x3246('0xd')]);router[_0x3246('0xb')](_0x3246('0xe'),auth[_0x3246('0x9')](),controller[_0x3246('0xf')]);router['get'](_0x3246('0x10'),auth[_0x3246('0x9')](),controller[_0x3246('0x11')]);router[_0x3246('0xb')](_0x3246('0x12'),auth[_0x3246('0x9')](),controller[_0x3246('0x13')]);router['get'](_0x3246('0x14'),auth['isAuthenticated'](),controller[_0x3246('0x15')]);router[_0x3246('0xb')]('/:id/lists',auth[_0x3246('0x9')](),controller['getLists']);router[_0x3246('0xb')](_0x3246('0x16'),auth[_0x3246('0x9')](),controller[_0x3246('0x17')]);router[_0x3246('0x18')]('/',auth['isAuthenticated'](),controller[_0x3246('0x19')]);router[_0x3246('0x18')](_0x3246('0x1a'),auth[_0x3246('0x9')](),controller[_0x3246('0x1b')]);router[_0x3246('0x18')](_0x3246('0x1c'),auth[_0x3246('0x9')](),controller['addLists']);router['post'](_0x3246('0x16'),auth['isAuthenticated'](),controller[_0x3246('0x1d')]);router[_0x3246('0x1e')](_0x3246('0xc'),auth[_0x3246('0x9')](),controller[_0x3246('0x1f')]);router[_0x3246('0x20')]('/:id',auth[_0x3246('0x9')](),controller['destroy']);router[_0x3246('0x20')](_0x3246('0x1c'),auth['isAuthenticated'](),controller[_0x3246('0x21')]);router[_0x3246('0x20')]('/:id/blacklists',auth[_0x3246('0x9')](),controller[_0x3246('0x22')]);module['exports']=router; \ No newline at end of file +var _0xa051=['./campaign.controller','isAuthenticated','index','/:id','show','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0xa051,0x156));var _0x1a05=function(_0x48d94e,_0xfbb342){_0x48d94e=_0x48d94e-0x0;var _0x1fd8e8=_0xa051[_0x48d94e];return _0x1fd8e8;};'use strict';var multer=require(_0x1a05('0x0'));var util=require('util');var path=require(_0x1a05('0x1'));var timeout=require('connect-timeout');var express=require(_0x1a05('0x2'));var router=express[_0x1a05('0x3')]();var fs_extra=require(_0x1a05('0x4'));var auth=require(_0x1a05('0x5'));var interaction=require(_0x1a05('0x6'));var config=require(_0x1a05('0x7'));var controller=require(_0x1a05('0x8'));router['get']('/',auth[_0x1a05('0x9')](),controller[_0x1a05('0xa')]);router['get'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xc')]);router[_0x1a05('0xd')](_0x1a05('0xe'),auth[_0x1a05('0x9')](),controller[_0x1a05('0xf')]);router[_0x1a05('0xd')](_0x1a05('0x10'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x11')]);router[_0x1a05('0xd')](_0x1a05('0x12'),auth['isAuthenticated'](),controller[_0x1a05('0x13')]);router[_0x1a05('0xd')]('/:id/hopper_black',auth[_0x1a05('0x9')](),controller['getHopperBlacks']);router[_0x1a05('0xd')](_0x1a05('0x14'),auth['isAuthenticated'](),controller[_0x1a05('0x15')]);router[_0x1a05('0xd')](_0x1a05('0x16'),auth['isAuthenticated'](),controller[_0x1a05('0x17')]);router[_0x1a05('0x18')]('/',auth['isAuthenticated'](),controller[_0x1a05('0x19')]);router['post'](_0x1a05('0x1a'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1b')]);router[_0x1a05('0x18')](_0x1a05('0x14'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller['addBlackLists']);router[_0x1a05('0x1c')](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1d')]);router['delete'](_0x1a05('0xb'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x1e')]);router[_0x1a05('0x1f')](_0x1a05('0x14'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x20')]);router[_0x1a05('0x1f')](_0x1a05('0x16'),auth[_0x1a05('0x9')](),controller[_0x1a05('0x21')]);module[_0x1a05('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1f52519..c6465cf 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 _0x4fa6=['STRING','VIRTUAL','sequelize','exports'];(function(_0x1cc9b2,_0xe77730){var _0x30b919=function(_0x122a33){while(--_0x122a33){_0x1cc9b2['push'](_0x1cc9b2['shift']());}};_0x30b919(++_0xe77730);}(_0x4fa6,0x162));var _0x64fa=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x4fa6[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x64fa('0x0'));module[_0x64fa('0x1')]={'key':{'type':Sequelize[_0x64fa('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x64fa('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0xf0f6=['VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x482404,_0x15fb83){var _0x3e8826=function(_0x188b5e){while(--_0x188b5e){_0x482404['push'](_0x482404['shift']());}};_0x3e8826(++_0x15fb83);}(_0xf0f6,0x159));var _0x6f0f=function(_0x1ea797,_0x158bed){_0x1ea797=_0x1ea797-0x0;var _0x420fba=_0xf0f6[_0x1ea797];return _0x420fba;};'use strict';var Sequelize=require(_0x6f0f('0x0'));module[_0x6f0f('0x1')]={'key':{'type':Sequelize[_0x6f0f('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x6f0f('0x2')]},'name':{'type':Sequelize[_0x6f0f('0x3')],'get':function(){return this[_0x6f0f('0x4')](_0x6f0f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 164ab13..c426712 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 _0x0163=['apply','reject','update','destroy','get','CannedAnswers','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','CannedAnswer','includeAll','findAll','rows','show','params','include','options','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','undefined','limit','count','offset','json'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x0163,0x136));var _0x3016=function(_0x4e41db,_0xf3e14c){_0x4e41db=_0x4e41db-0x0;var _0x6255cc=_0x0163[_0x4e41db];return _0x6255cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3016('0x0'));var zipdir=require(_0x3016('0x1'));var jsonpatch=require(_0x3016('0x2'));var rp=require(_0x3016('0x3'));var moment=require(_0x3016('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3016('0x5'));var util=require(_0x3016('0x6'));var path=require('path');var sox=require(_0x3016('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3016('0x8'));var _=require(_0x3016('0x9'));var squel=require(_0x3016('0xa'));var crypto=require(_0x3016('0xb'));var jsforce=require(_0x3016('0xc'));var deskjs=require(_0x3016('0xd'));var toCsv=require(_0x3016('0xe'));var querystring=require(_0x3016('0xf'));var Papa=require('papaparse');var Redis=require(_0x3016('0x10'));var authService=require(_0x3016('0x11'));var qs=require(_0x3016('0x12'));var as=require(_0x3016('0x13'));var hardwareService=require(_0x3016('0x14'));var logger=require('../../config/logger')(_0x3016('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552fbf,_0x4aed71){_0x4aed71=_0x4aed71||0xcc;return function(_0x44055b){if(_0x44055b){return _0x552fbf[_0x3016('0x16')](_0x4aed71);}return _0x552fbf[_0x3016('0x17')](_0x4aed71)[_0x3016('0x18')]();};}function respondWithResult(_0x1c56ca,_0x36a673){_0x36a673=_0x36a673||0xc8;return function(_0x20b5b0){if(_0x20b5b0){return _0x1c56ca[_0x3016('0x17')](_0x36a673)['json'](_0x20b5b0);}};}function respondWithFilteredResult(_0x24d187,_0xe0ea99){return function(_0x1474ba){if(_0x1474ba){var _0x5834a5=typeof _0xe0ea99['offset']===_0x3016('0x19')&&typeof _0xe0ea99[_0x3016('0x1a')]==='undefined';var _0x91c30c=_0x1474ba[_0x3016('0x1b')];var _0x41871f=_0x5834a5?0x0:_0xe0ea99[_0x3016('0x1c')];var _0x306404=_0x5834a5?_0x1474ba['count']:_0xe0ea99['offset']+_0xe0ea99[_0x3016('0x1a')];var _0x192f7b;if(_0x306404>=_0x91c30c){_0x306404=_0x91c30c;_0x192f7b=0xc8;}else{_0x192f7b=0xce;}_0x24d187[_0x3016('0x17')](_0x192f7b);return _0x24d187['set']('Content-Range',_0x41871f+'-'+_0x306404+'/'+_0x91c30c)[_0x3016('0x1d')](_0x1474ba);}return null;};}function patchUpdates(_0x209e76){return function(_0x2528dc){try{jsonpatch[_0x3016('0x1e')](_0x2528dc,_0x209e76,!![]);}catch(_0x161bb8){return BPromise[_0x3016('0x1f')](_0x161bb8);}return _0x2528dc['save']();};}function saveUpdates(_0x5dcc36,_0x13c439){return function(_0x5f1927){if(_0x5f1927){return _0x5f1927[_0x3016('0x20')](_0x5dcc36)['then'](function(_0xc315fa){return _0xc315fa;});}return null;};}function removeEntity(_0x2f643d,_0x3fce13){return function(_0x374e9b){if(_0x374e9b){return _0x374e9b[_0x3016('0x21')]()['then'](function(){var _0x4900a0=_0x374e9b[_0x3016('0x22')]({'plain':!![]});var _0x30c351=_0x3016('0x23');return db['UserProfileResource'][_0x3016('0x21')]({'where':{'type':_0x30c351,'resourceId':_0x4900a0['id']}})[_0x3016('0x24')](function(){return _0x374e9b;});})[_0x3016('0x24')](function(){_0x2f643d[_0x3016('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec530,_0x538bd2){return function(_0x342424){if(!_0x342424){_0x5ec530[_0x3016('0x16')](0x194);}return _0x342424;};}function handleError(_0x5919ce,_0x59556b){_0x59556b=_0x59556b||0x1f4;return function(_0xbe60d9){logger['error'](_0xbe60d9['stack']);if(_0xbe60d9[_0x3016('0x25')]){delete _0xbe60d9['name'];}_0x5919ce[_0x3016('0x17')](_0x59556b)['send'](_0xbe60d9);};}exports[_0x3016('0x26')]=function(_0x405862,_0x3113e3){var _0x48ce62={},_0x35d6fc={},_0x39da7c={'count':0x0,'rows':[]};var _0x5aa594=_[_0x3016('0x27')](db['CannedAnswer'][_0x3016('0x28')],function(_0x264ec9){return{'name':_0x264ec9[_0x3016('0x29')],'type':_0x264ec9[_0x3016('0x2a')][_0x3016('0x2b')]};});_0x35d6fc[_0x3016('0x2c')]=_[_0x3016('0x27')](_0x5aa594,_0x3016('0x25'));_0x35d6fc[_0x3016('0x2d')]=_[_0x3016('0x2e')](_0x405862[_0x3016('0x2d')]);_0x35d6fc[_0x3016('0x2f')]=_['intersection'](_0x35d6fc[_0x3016('0x2c')],_0x35d6fc[_0x3016('0x2d')]);_0x48ce62['attributes']=_[_0x3016('0x30')](_0x35d6fc[_0x3016('0x2c')],qs['fields'](_0x405862['query'][_0x3016('0x31')]));_0x48ce62[_0x3016('0x32')]=_0x48ce62[_0x3016('0x32')][_0x3016('0x33')]?_0x48ce62[_0x3016('0x32')]:_0x35d6fc['model'];if(!_0x405862[_0x3016('0x2d')][_0x3016('0x34')](_0x3016('0x35'))){_0x48ce62[_0x3016('0x1a')]=qs[_0x3016('0x1a')](_0x405862[_0x3016('0x2d')][_0x3016('0x1a')]);_0x48ce62[_0x3016('0x1c')]=qs[_0x3016('0x1c')](_0x405862[_0x3016('0x2d')][_0x3016('0x1c')]);}_0x48ce62[_0x3016('0x36')]=qs[_0x3016('0x37')](_0x405862[_0x3016('0x2d')][_0x3016('0x37')]);_0x48ce62['where']=qs[_0x3016('0x2f')](_[_0x3016('0x38')](_0x405862['query'],_0x35d6fc[_0x3016('0x2f')]),_0x5aa594);if(_0x405862[_0x3016('0x2d')][_0x3016('0x39')]){_0x48ce62[_0x3016('0x3a')]=_[_0x3016('0x3b')](_0x48ce62[_0x3016('0x3a')],{'$or':[{'key':{'$like':'%'+_0x405862[_0x3016('0x2d')]['filter']+'%'}},{'value':{'$like':'%'+_0x405862[_0x3016('0x2d')][_0x3016('0x39')]+'%'}}]});}_0x48ce62=_[_0x3016('0x3b')]({},_0x48ce62,_0x405862['options']);var _0x4b6dca={'where':_0x48ce62['where']};return db[_0x3016('0x3c')][_0x3016('0x1b')](_0x4b6dca)[_0x3016('0x24')](function(_0x139e59){_0x39da7c['count']=_0x139e59;if(_0x405862[_0x3016('0x2d')][_0x3016('0x3d')]){_0x48ce62['include']=[{'all':!![]}];}return db[_0x3016('0x3c')][_0x3016('0x3e')](_0x48ce62);})[_0x3016('0x24')](function(_0x5184f3){_0x39da7c[_0x3016('0x3f')]=_0x5184f3;return _0x39da7c;})[_0x3016('0x24')](respondWithFilteredResult(_0x3113e3,_0x48ce62))['catch'](handleError(_0x3113e3,null));};exports[_0x3016('0x40')]=function(_0x1caeaa,_0x3a5b9c){var _0x1b0d98={'raw':!![],'where':{'id':_0x1caeaa[_0x3016('0x41')]['id']}},_0x509c71={};_0x509c71[_0x3016('0x2c')]=_[_0x3016('0x2e')](db[_0x3016('0x3c')][_0x3016('0x28')]);_0x509c71['query']=_[_0x3016('0x2e')](_0x1caeaa[_0x3016('0x2d')]);_0x509c71['filters']=_[_0x3016('0x30')](_0x509c71[_0x3016('0x2c')],_0x509c71[_0x3016('0x2d')]);_0x1b0d98[_0x3016('0x32')]=_[_0x3016('0x30')](_0x509c71['model'],qs['fields'](_0x1caeaa[_0x3016('0x2d')][_0x3016('0x31')]));_0x1b0d98[_0x3016('0x32')]=_0x1b0d98[_0x3016('0x32')]['length']?_0x1b0d98[_0x3016('0x32')]:_0x509c71[_0x3016('0x2c')];if(_0x1caeaa[_0x3016('0x2d')][_0x3016('0x3d')]){_0x1b0d98[_0x3016('0x42')]=[{'all':!![]}];}_0x1b0d98=_[_0x3016('0x3b')]({},_0x1b0d98,_0x1caeaa[_0x3016('0x43')]);return db[_0x3016('0x3c')][_0x3016('0x44')](_0x1b0d98)['then'](handleEntityNotFound(_0x3a5b9c,null))[_0x3016('0x24')](respondWithResult(_0x3a5b9c,null))[_0x3016('0x45')](handleError(_0x3a5b9c,null));};exports[_0x3016('0x20')]=function(_0x5b2ce6,_0x322e1a){if(_0x5b2ce6['body']['id']){delete _0x5b2ce6[_0x3016('0x46')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x5b2ce6[_0x3016('0x41')]['id']}})[_0x3016('0x24')](handleEntityNotFound(_0x322e1a,null))[_0x3016('0x24')](saveUpdates(_0x5b2ce6[_0x3016('0x46')],null))[_0x3016('0x24')](respondWithResult(_0x322e1a,null))['catch'](handleError(_0x322e1a,null));};exports[_0x3016('0x21')]=function(_0x805295,_0x2acd13){return db[_0x3016('0x3c')][_0x3016('0x44')]({'where':{'id':_0x805295[_0x3016('0x41')]['id']}})[_0x3016('0x24')](handleEntityNotFound(_0x2acd13,null))[_0x3016('0x24')](removeEntity(_0x2acd13,null))['catch'](handleError(_0x2acd13,null));};exports['create']=function(_0x55f823,_0x1a8572){var _0x15beae={'key':_0x55f823['body'][_0x3016('0x2b')]};if(_0x55f823[_0x3016('0x46')][_0x3016('0x47')]){_0x15beae[_0x3016('0x47')]=_0x55f823[_0x3016('0x46')][_0x3016('0x47')];}else if(_0x55f823[_0x3016('0x46')][_0x3016('0x48')]){_0x15beae['SmsAccountId']=_0x55f823[_0x3016('0x46')]['SmsAccountId'];}else if(_0x55f823[_0x3016('0x46')][_0x3016('0x49')]){_0x15beae[_0x3016('0x49')]=_0x55f823['body']['OpenchannelAccountId'];}else if(_0x55f823[_0x3016('0x46')]['ChatWebsiteId']){_0x15beae[_0x3016('0x4a')]=_0x55f823[_0x3016('0x46')][_0x3016('0x4a')];}return db[_0x3016('0x3c')][_0x3016('0x44')]({'where':_0x15beae})[_0x3016('0x24')](function(_0x21b8ea){if(_0x21b8ea){throw new db[(_0x3016('0x4b'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x3016('0x3c')][_0x3016('0x4c')](_0x55f823[_0x3016('0x46')]);})[_0x3016('0x24')](function(_0x349522){var _0x485577=_0x55f823[_0x3016('0x4d')]['get']({'plain':!![]});if(!_0x485577)throw new Error(_0x3016('0x4e'));if(_0x485577[_0x3016('0x4f')]===_0x3016('0x4d')){var _0x12e7d9=_0x349522[_0x3016('0x22')]({'plain':!![]});return db[_0x3016('0x50')][_0x3016('0x44')]({'where':{'name':_0x3016('0x23'),'userProfileId':_0x485577[_0x3016('0x51')]},'raw':!![]})[_0x3016('0x24')](function(_0x4457e0){if(_0x4457e0&&_0x4457e0[_0x3016('0x52')]===0x0){return db[_0x3016('0x53')][_0x3016('0x4c')]({'name':_0x12e7d9['name'],'resourceId':_0x12e7d9['id'],'type':_0x4457e0[_0x3016('0x25')],'sectionId':_0x4457e0['id']},{})[_0x3016('0x24')](function(){return _0x349522;});}else{return _0x349522;}})[_0x3016('0x45')](function(_0x28284b){logger['error'](_0x3016('0x54'),_0x28284b);throw _0x28284b;});}return _0x349522;})[_0x3016('0x24')](respondWithResult(_0x1a8572,0xc9))[_0x3016('0x45')](handleError(_0x1a8572,null));}; \ No newline at end of file +var _0x78f0=['map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','CannedAnswer','findAll','show','options','find','catch','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','name','index','rawAttributes','type','key','model'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x78f0,0x75));var _0x078f=function(_0x170b3e,_0x46abbf){_0x170b3e=_0x170b3e-0x0;var _0xff2428=_0x78f0[_0x170b3e];return _0xff2428;};'use strict';var emlformat=require(_0x078f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x078f('0x1'));var rp=require(_0x078f('0x2'));var moment=require(_0x078f('0x3'));var BPromise=require(_0x078f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x078f('0x5'));var sox=require(_0x078f('0x6'));var csv=require(_0x078f('0x7'));var ejs=require(_0x078f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x078f('0x9'));var crypto=require(_0x078f('0xa'));var jsforce=require(_0x078f('0xb'));var deskjs=require(_0x078f('0xc'));var toCsv=require(_0x078f('0x7'));var querystring=require('querystring');var Papa=require(_0x078f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x078f('0xe'));var as=require(_0x078f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x078f('0x10'));var utils=require('../../config/utils');var config=require(_0x078f('0x11'));var licenseUtil=require(_0x078f('0x12'));var db=require(_0x078f('0x13'))['db'];function respondWithStatusCode(_0x34d250,_0x8c2cb5){_0x8c2cb5=_0x8c2cb5||0xcc;return function(_0x505cad){if(_0x505cad){return _0x34d250[_0x078f('0x14')](_0x8c2cb5);}return _0x34d250[_0x078f('0x15')](_0x8c2cb5)[_0x078f('0x16')]();};}function respondWithResult(_0x35e44d,_0x2dabf4){_0x2dabf4=_0x2dabf4||0xc8;return function(_0x2a5d84){if(_0x2a5d84){return _0x35e44d['status'](_0x2dabf4)[_0x078f('0x17')](_0x2a5d84);}};}function respondWithFilteredResult(_0x3b86d5,_0x4647b0){return function(_0x45ab09){if(_0x45ab09){var _0x1e8ecb=typeof _0x4647b0['offset']==='undefined'&&typeof _0x4647b0[_0x078f('0x18')]===_0x078f('0x19');var _0x4c44b8=_0x45ab09[_0x078f('0x1a')];var _0x4fca98=_0x1e8ecb?0x0:_0x4647b0[_0x078f('0x1b')];var _0xe0bb18=_0x1e8ecb?_0x45ab09['count']:_0x4647b0[_0x078f('0x1b')]+_0x4647b0['limit'];var _0x4f1eb0;if(_0xe0bb18>=_0x4c44b8){_0xe0bb18=_0x4c44b8;_0x4f1eb0=0xc8;}else{_0x4f1eb0=0xce;}_0x3b86d5[_0x078f('0x15')](_0x4f1eb0);return _0x3b86d5[_0x078f('0x1c')](_0x078f('0x1d'),_0x4fca98+'-'+_0xe0bb18+'/'+_0x4c44b8)[_0x078f('0x17')](_0x45ab09);}return null;};}function patchUpdates(_0xcbe3be){return function(_0x133047){try{jsonpatch[_0x078f('0x1e')](_0x133047,_0xcbe3be,!![]);}catch(_0x4f1452){return BPromise['reject'](_0x4f1452);}return _0x133047[_0x078f('0x1f')]();};}function saveUpdates(_0x2865e7,_0x3951d9){return function(_0x13c9b4){if(_0x13c9b4){return _0x13c9b4[_0x078f('0x20')](_0x2865e7)[_0x078f('0x21')](function(_0x1877d9){return _0x1877d9;});}return null;};}function removeEntity(_0x3af948,_0xfeefbb){return function(_0x10a87c){if(_0x10a87c){return _0x10a87c['destroy']()['then'](function(){var _0x51dea1=_0x10a87c[_0x078f('0x22')]({'plain':!![]});var _0x214dbd=_0x078f('0x23');return db[_0x078f('0x24')][_0x078f('0x25')]({'where':{'type':_0x214dbd,'resourceId':_0x51dea1['id']}})['then'](function(){return _0x10a87c;});})[_0x078f('0x21')](function(){_0x3af948[_0x078f('0x15')](0xcc)[_0x078f('0x16')]();});}};}function handleEntityNotFound(_0x162007,_0x4c4956){return function(_0x513f5f){if(!_0x513f5f){_0x162007[_0x078f('0x14')](0x194);}return _0x513f5f;};}function handleError(_0x3fa572,_0x564b92){_0x564b92=_0x564b92||0x1f4;return function(_0xa16216){logger[_0x078f('0x26')](_0xa16216['stack']);if(_0xa16216[_0x078f('0x27')]){delete _0xa16216[_0x078f('0x27')];}_0x3fa572['status'](_0x564b92)['send'](_0xa16216);};}exports[_0x078f('0x28')]=function(_0xe30a88,_0x5952ea){var _0x103f7f={},_0x292f60={},_0x40c028={'count':0x0,'rows':[]};var _0x5b4596=_['map'](db['CannedAnswer'][_0x078f('0x29')],function(_0x53b18e){return{'name':_0x53b18e['fieldName'],'type':_0x53b18e[_0x078f('0x2a')][_0x078f('0x2b')]};});_0x292f60[_0x078f('0x2c')]=_[_0x078f('0x2d')](_0x5b4596,_0x078f('0x27'));_0x292f60['query']=_[_0x078f('0x2e')](_0xe30a88[_0x078f('0x2f')]);_0x292f60[_0x078f('0x30')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],_0x292f60[_0x078f('0x2f')]);_0x103f7f[_0x078f('0x32')]=_[_0x078f('0x31')](_0x292f60[_0x078f('0x2c')],qs['fields'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x33')]));_0x103f7f[_0x078f('0x32')]=_0x103f7f[_0x078f('0x32')][_0x078f('0x34')]?_0x103f7f[_0x078f('0x32')]:_0x292f60[_0x078f('0x2c')];if(!_0xe30a88['query']['hasOwnProperty'](_0x078f('0x35'))){_0x103f7f[_0x078f('0x18')]=qs['limit'](_0xe30a88[_0x078f('0x2f')][_0x078f('0x18')]);_0x103f7f[_0x078f('0x1b')]=qs[_0x078f('0x1b')](_0xe30a88['query']['offset']);}_0x103f7f[_0x078f('0x36')]=qs[_0x078f('0x37')](_0xe30a88[_0x078f('0x2f')][_0x078f('0x37')]);_0x103f7f[_0x078f('0x38')]=qs[_0x078f('0x30')](_[_0x078f('0x39')](_0xe30a88['query'],_0x292f60[_0x078f('0x30')]),_0x5b4596);if(_0xe30a88[_0x078f('0x2f')][_0x078f('0x3a')]){_0x103f7f[_0x078f('0x38')]=_[_0x078f('0x3b')](_0x103f7f[_0x078f('0x38')],{'$or':[{'key':{'$like':'%'+_0xe30a88[_0x078f('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0xe30a88['query'][_0x078f('0x3a')]+'%'}}]});}_0x103f7f=_[_0x078f('0x3b')]({},_0x103f7f,_0xe30a88['options']);var _0x2d154d={'where':_0x103f7f['where']};return db['CannedAnswer'][_0x078f('0x1a')](_0x2d154d)[_0x078f('0x21')](function(_0x4b8ff1){_0x40c028[_0x078f('0x1a')]=_0x4b8ff1;if(_0xe30a88[_0x078f('0x2f')]['includeAll']){_0x103f7f[_0x078f('0x3c')]=[{'all':!![]}];}return db[_0x078f('0x3d')][_0x078f('0x3e')](_0x103f7f);})[_0x078f('0x21')](function(_0x44973f){_0x40c028['rows']=_0x44973f;return _0x40c028;})[_0x078f('0x21')](respondWithFilteredResult(_0x5952ea,_0x103f7f))['catch'](handleError(_0x5952ea,null));};exports[_0x078f('0x3f')]=function(_0x5bc926,_0xd92888){var _0x26a1f8={'raw':!![],'where':{'id':_0x5bc926['params']['id']}},_0xf2b449={};_0xf2b449[_0x078f('0x2c')]=_[_0x078f('0x2e')](db[_0x078f('0x3d')][_0x078f('0x29')]);_0xf2b449['query']=_[_0x078f('0x2e')](_0x5bc926[_0x078f('0x2f')]);_0xf2b449[_0x078f('0x30')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],_0xf2b449['query']);_0x26a1f8[_0x078f('0x32')]=_[_0x078f('0x31')](_0xf2b449[_0x078f('0x2c')],qs[_0x078f('0x33')](_0x5bc926['query'][_0x078f('0x33')]));_0x26a1f8[_0x078f('0x32')]=_0x26a1f8[_0x078f('0x32')]['length']?_0x26a1f8['attributes']:_0xf2b449['model'];if(_0x5bc926[_0x078f('0x2f')]['includeAll']){_0x26a1f8[_0x078f('0x3c')]=[{'all':!![]}];}_0x26a1f8=_[_0x078f('0x3b')]({},_0x26a1f8,_0x5bc926[_0x078f('0x40')]);return db[_0x078f('0x3d')][_0x078f('0x41')](_0x26a1f8)[_0x078f('0x21')](handleEntityNotFound(_0xd92888,null))['then'](respondWithResult(_0xd92888,null))[_0x078f('0x42')](handleError(_0xd92888,null));};exports[_0x078f('0x20')]=function(_0x38c205,_0x169434){if(_0x38c205[_0x078f('0x43')]['id']){delete _0x38c205[_0x078f('0x43')]['id'];}return db[_0x078f('0x3d')]['find']({'where':{'id':_0x38c205[_0x078f('0x44')]['id']}})[_0x078f('0x21')](handleEntityNotFound(_0x169434,null))[_0x078f('0x21')](saveUpdates(_0x38c205[_0x078f('0x43')],null))[_0x078f('0x21')](respondWithResult(_0x169434,null))[_0x078f('0x42')](handleError(_0x169434,null));};exports['destroy']=function(_0x53f2a8,_0xa159a2){return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':{'id':_0x53f2a8[_0x078f('0x44')]['id']}})['then'](handleEntityNotFound(_0xa159a2,null))['then'](removeEntity(_0xa159a2,null))['catch'](handleError(_0xa159a2,null));};exports['create']=function(_0x247757,_0x1fa66a){var _0x364301={'key':_0x247757['body'][_0x078f('0x2b')]};if(_0x247757[_0x078f('0x43')]['MailAccountId']){_0x364301[_0x078f('0x45')]=_0x247757[_0x078f('0x43')]['MailAccountId'];}else if(_0x247757['body'][_0x078f('0x46')]){_0x364301[_0x078f('0x46')]=_0x247757[_0x078f('0x43')]['SmsAccountId'];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x47')]){_0x364301['OpenchannelAccountId']=_0x247757[_0x078f('0x43')][_0x078f('0x47')];}else if(_0x247757[_0x078f('0x43')][_0x078f('0x48')]){_0x364301[_0x078f('0x48')]=_0x247757['body'][_0x078f('0x48')];}return db[_0x078f('0x3d')][_0x078f('0x41')]({'where':_0x364301})[_0x078f('0x21')](function(_0x23a14e){if(_0x23a14e){throw new db['Sequelize'][(_0x078f('0x49'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x078f('0x3d')][_0x078f('0x4a')](_0x247757[_0x078f('0x43')]);})[_0x078f('0x21')](function(_0x918295){var _0x4eb85a=_0x247757[_0x078f('0x4b')]['get']({'plain':!![]});if(!_0x4eb85a)throw new Error(_0x078f('0x4c'));if(_0x4eb85a[_0x078f('0x4d')]===_0x078f('0x4b')){var _0x3ad67c=_0x918295[_0x078f('0x22')]({'plain':!![]});return db[_0x078f('0x4e')][_0x078f('0x41')]({'where':{'name':_0x078f('0x23'),'userProfileId':_0x4eb85a[_0x078f('0x4f')]},'raw':!![]})[_0x078f('0x21')](function(_0x1b3605){if(_0x1b3605&&_0x1b3605[_0x078f('0x50')]===0x0){return db[_0x078f('0x24')][_0x078f('0x4a')]({'name':_0x3ad67c['name'],'resourceId':_0x3ad67c['id'],'type':_0x1b3605[_0x078f('0x27')],'sectionId':_0x1b3605['id']},{})[_0x078f('0x21')](function(){return _0x918295;});}else{return _0x918295;}})['catch'](function(_0xddf7d1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xddf7d1);throw _0xddf7d1;});}return _0x918295;})[_0x078f('0x21')](respondWithResult(_0x1fa66a,0xc9))[_0x078f('0x42')](handleError(_0x1fa66a,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index eadd85d..782f257 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 _0x06b8=['api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','../../config/logger'];(function(_0xddc681,_0x261034){var _0xf33bab=function(_0x346fb4){while(--_0x346fb4){_0xddc681['push'](_0xddc681['shift']());}};_0xf33bab(++_0x261034);}(_0x06b8,0x17e));var _0x806b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06b8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x806b('0x0'));var util=require('util');var logger=require(_0x806b('0x1'))(_0x806b('0x2'));var moment=require(_0x806b('0x3'));var BPromise=require(_0x806b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x806b('0x5'));var rimraf=require(_0x806b('0x6'));var config=require('../../config/environment');var attributes=require(_0x806b('0x7'));module[_0x806b('0x8')]=function(_0x35ac2b,_0x1c0eed){return _0x35ac2b[_0x806b('0x9')](_0x806b('0xa'),attributes,{'tableName':_0x806b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6cb4=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x1f0448,_0xa2865f){var _0x16fe78=function(_0x43517b){while(--_0x43517b){_0x1f0448['push'](_0x1f0448['shift']());}};_0x16fe78(++_0xa2865f);}(_0x6cb4,0x9c));var _0x46cb=function(_0x391ebe,_0x596823){_0x391ebe=_0x391ebe-0x0;var _0x5aac03=_0x6cb4[_0x391ebe];return _0x5aac03;};'use strict';var _=require(_0x46cb('0x0'));var util=require('util');var logger=require(_0x46cb('0x1'))('api');var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46cb('0x4'));var rimraf=require(_0x46cb('0x5'));var config=require(_0x46cb('0x6'));var attributes=require(_0x46cb('0x7'));module[_0x46cb('0x8')]=function(_0x566d65,_0x372630){return _0x566d65[_0x46cb('0x9')](_0x46cb('0xa'),attributes,{'tableName':_0x46cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x46cb('0xc'),'collate':_0x46cb('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b1fa760..240521a 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(_0x1b9e96,_0x4b7504){var _0x1c1ccf=function(_0x2be7e3){while(--_0x2be7e3){_0x1b9e96['push'](_0x1b9e96['shift']());}};_0x1c1ccf(++_0x4b7504);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x4b7204,_0x1081df){var _0x1ea9b7=function(_0x153741){while(--_0x153741){_0x4b7204['push'](_0x4b7204['shift']());}};_0x1ea9b7(++_0x1081df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 8a96a54..a9cceb6 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 _0x6b09=['/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x45c67f,_0x269e16){var _0x4e6271=function(_0x238da8){while(--_0x238da8){_0x45c67f['push'](_0x45c67f['shift']());}};_0x4e6271(++_0x269e16);}(_0x6b09,0x1d4));var _0x96b0=function(_0x1d69e5,_0x2a29af){_0x1d69e5=_0x1d69e5-0x0;var _0x17da11=_0x6b09[_0x1d69e5];return _0x17da11;};'use strict';var multer=require(_0x96b0('0x0'));var util=require('util');var path=require(_0x96b0('0x1'));var timeout=require(_0x96b0('0x2'));var express=require(_0x96b0('0x3'));var router=express[_0x96b0('0x4')]();var fs_extra=require(_0x96b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x96b0('0x6'));var config=require(_0x96b0('0x7'));var controller=require(_0x96b0('0x8'));router[_0x96b0('0x9')]('/',auth[_0x96b0('0xa')](),controller[_0x96b0('0xb')]);router[_0x96b0('0x9')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0xd')]);router[_0x96b0('0xe')]('/',auth[_0x96b0('0xa')](),controller['create']);router[_0x96b0('0xf')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x10')]);router[_0x96b0('0x11')](_0x96b0('0xc'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x12')]);module[_0x96b0('0x13')]=router; \ No newline at end of file +var _0x3eac=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','put'];(function(_0x1e4713,_0x558735){var _0x5cddcb=function(_0x14a8c5){while(--_0x14a8c5){_0x1e4713['push'](_0x1e4713['shift']());}};_0x5cddcb(++_0x558735);}(_0x3eac,0xb4));var _0xc3ea=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x3eac[_0x4b6778];return _0x22dbb9;};'use strict';var multer=require(_0xc3ea('0x0'));var util=require('util');var path=require(_0xc3ea('0x1'));var timeout=require(_0xc3ea('0x2'));var express=require(_0xc3ea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc3ea('0x4'));var config=require(_0xc3ea('0x5'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xc3ea('0x6')](),controller[_0xc3ea('0x7')]);router[_0xc3ea('0x8')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xa')]);router['post']('/',auth[_0xc3ea('0x6')](),controller['create']);router[_0xc3ea('0xb')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xc')]);router[_0xc3ea('0xd')](_0xc3ea('0x9'),auth[_0xc3ea('0x6')](),controller[_0xc3ea('0xe')]);module[_0xc3ea('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index ac71bda..04c5cf3 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 _0x902b=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x57bc2e,_0x43754f){var _0x2be43a=function(_0x267fd6){while(--_0x267fd6){_0x57bc2e['push'](_0x57bc2e['shift']());}};_0x2be43a(++_0x43754f);}(_0x902b,0x6a));var _0xb902=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x902b[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xb902('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xb902('0x1')],'allowNull':![],'defaultValue':_0xb902('0x2')},'clid':{'type':Sequelize[_0xb902('0x3')]},'src':{'type':Sequelize[_0xb902('0x3')]},'dst':{'type':Sequelize[_0xb902('0x3')]},'dcontext':{'type':Sequelize[_0xb902('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xb902('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xb902('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb902('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xb902('0x3')]},'sequence':{'type':Sequelize[_0xb902('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xb902('0x3')]}}; \ No newline at end of file +var _0xa0bc=['STRING','INTEGER','exports','DATE'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xca0b('0x0')]={'calldate':{'type':Sequelize[_0xca0b('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xca0b('0x2')]},'src':{'type':Sequelize[_0xca0b('0x2')]},'dst':{'type':Sequelize[_0xca0b('0x2')]},'dcontext':{'type':Sequelize[_0xca0b('0x2')]},'channel':{'type':Sequelize[_0xca0b('0x2')]},'dstchannel':{'type':Sequelize[_0xca0b('0x2')]},'lastapp':{'type':Sequelize[_0xca0b('0x2')]},'lastdata':{'type':Sequelize[_0xca0b('0x2')]},'duration':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xca0b('0x2')]},'amaflags':{'type':Sequelize[_0xca0b('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xca0b('0x2')]},'userfield':{'type':Sequelize[_0xca0b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xca0b('0x2')]},'sequence':{'type':Sequelize[_0xca0b('0x2')]},'peeraccount':{'type':Sequelize[_0xca0b('0x2')]},'type':{'type':Sequelize[_0xca0b('0x2')]},'tag':{'type':Sequelize[_0xca0b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 42b0f67..8db855d 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 _0x236d=['undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','destroy','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3086e3,_0x42bab4){var _0x46369a=function(_0x17c8c6){while(--_0x17c8c6){_0x3086e3['push'](_0x3086e3['shift']());}};_0x46369a(++_0x42bab4);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd236('0x0'));var rimraf=require(_0xd236('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd236('0x2'));var rp=require('request-promise');var moment=require(_0xd236('0x3'));var BPromise=require(_0xd236('0x4'));var Mustache=require(_0xd236('0x5'));var util=require(_0xd236('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd236('0x7'));var ejs=require(_0xd236('0x8'));var fs=require('fs');var fs_extra=require(_0xd236('0x9'));var _=require(_0xd236('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd236('0xb'));var deskjs=require(_0xd236('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd236('0xd'));var Papa=require(_0xd236('0xe'));var Redis=require('ioredis');var authService=require(_0xd236('0xf'));var qs=require(_0xd236('0x10'));var as=require(_0xd236('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd236('0x12'))(_0xd236('0x13'));var utils=require(_0xd236('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd236('0x15'));var db=require(_0xd236('0x16'))['db'];function respondWithStatusCode(_0x3d1076,_0x160cb1){_0x160cb1=_0x160cb1||0xcc;return function(_0x21f27b){if(_0x21f27b){return _0x3d1076[_0xd236('0x17')](_0x160cb1);}return _0x3d1076[_0xd236('0x18')](_0x160cb1)[_0xd236('0x19')]();};}function respondWithResult(_0x22435c,_0x3d7465){_0x3d7465=_0x3d7465||0xc8;return function(_0x348734){if(_0x348734){return _0x22435c[_0xd236('0x18')](_0x3d7465)[_0xd236('0x1a')](_0x348734);}};}function respondWithFilteredResult(_0x3b60a7,_0xd851b5){return function(_0x3b2535){if(_0x3b2535){var _0x2a076d=typeof _0xd851b5[_0xd236('0x1b')]===_0xd236('0x1c')&&typeof _0xd851b5[_0xd236('0x1d')]==='undefined';var _0x4f06c6=_0x3b2535[_0xd236('0x1e')];var _0x1b02a5=_0x2a076d?0x0:_0xd851b5['offset'];var _0x11c6ec=_0x2a076d?_0x3b2535[_0xd236('0x1e')]:_0xd851b5[_0xd236('0x1b')]+_0xd851b5['limit'];var _0x355b65;if(_0x11c6ec>=_0x4f06c6){_0x11c6ec=_0x4f06c6;_0x355b65=0xc8;}else{_0x355b65=0xce;}_0x3b60a7[_0xd236('0x18')](_0x355b65);return _0x3b60a7[_0xd236('0x1f')]('Content-Range',_0x1b02a5+'-'+_0x11c6ec+'/'+_0x4f06c6)[_0xd236('0x1a')](_0x3b2535);}return null;};}function patchUpdates(_0x3b0a27){return function(_0x26c758){try{jsonpatch[_0xd236('0x20')](_0x26c758,_0x3b0a27,!![]);}catch(_0x2f512d){return BPromise['reject'](_0x2f512d);}return _0x26c758[_0xd236('0x21')]();};}function saveUpdates(_0x30e7aa,_0x1e4ddb){return function(_0x3d1e4e){if(_0x3d1e4e){return _0x3d1e4e[_0xd236('0x22')](_0x30e7aa)['then'](function(_0x4a35d0){return _0x4a35d0;});}return null;};}function removeEntity(_0x257f27,_0x4be5ac){return function(_0x22924d){if(_0x22924d){return _0x22924d['destroy']()[_0xd236('0x23')](function(){_0x257f27[_0xd236('0x18')](0xcc)[_0xd236('0x19')]();});}};}function handleEntityNotFound(_0x49d822,_0x41049a){return function(_0x339b08){if(!_0x339b08){_0x49d822[_0xd236('0x17')](0x194);}return _0x339b08;};}function handleError(_0x13ba7a,_0x3a30d8){_0x3a30d8=_0x3a30d8||0x1f4;return function(_0x17f927){logger[_0xd236('0x24')](_0x17f927[_0xd236('0x25')]);if(_0x17f927[_0xd236('0x26')]){delete _0x17f927[_0xd236('0x26')];}_0x13ba7a[_0xd236('0x18')](_0x3a30d8)[_0xd236('0x27')](_0x17f927);};}exports[_0xd236('0x28')]=function(_0x23714d,_0x3108f4){var _0x28175d={},_0x436a19={},_0x471ed6={'count':0x0,'rows':[]};var _0x463fc8=_[_0xd236('0x29')](db[_0xd236('0x2a')][_0xd236('0x2b')],function(_0x3c1617){return{'name':_0x3c1617[_0xd236('0x2c')],'type':_0x3c1617[_0xd236('0x2d')][_0xd236('0x2e')]};});_0x436a19[_0xd236('0x2f')]=_[_0xd236('0x29')](_0x463fc8,_0xd236('0x26'));_0x436a19['query']=_[_0xd236('0x30')](_0x23714d['query']);_0x436a19[_0xd236('0x31')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],_0x436a19['query']);_0x28175d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x436a19[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x23714d[_0xd236('0x35')][_0xd236('0x34')]));_0x28175d[_0xd236('0x33')]=_0x28175d['attributes'][_0xd236('0x36')]?_0x28175d['attributes']:_0x436a19[_0xd236('0x2f')];if(!_0x23714d['query'][_0xd236('0x37')](_0xd236('0x38'))){_0x28175d[_0xd236('0x1d')]=qs[_0xd236('0x1d')](_0x23714d[_0xd236('0x35')][_0xd236('0x1d')]);_0x28175d[_0xd236('0x1b')]=qs[_0xd236('0x1b')](_0x23714d[_0xd236('0x35')][_0xd236('0x1b')]);}_0x28175d[_0xd236('0x39')]=qs[_0xd236('0x3a')](_0x23714d[_0xd236('0x35')]['sort']);_0x28175d[_0xd236('0x3b')]=qs[_0xd236('0x31')](_[_0xd236('0x3c')](_0x23714d['query'],_0x436a19[_0xd236('0x31')]),_0x463fc8);if(_0x23714d[_0xd236('0x35')][_0xd236('0x3d')]){_0x28175d[_0xd236('0x3b')]=_[_0xd236('0x3e')](_0x28175d[_0xd236('0x3b')],{'$or':_['map'](_0x463fc8,function(_0x696bed){if(_0x696bed[_0xd236('0x2d')]!==_0xd236('0x3f')){var _0x3c798f={};_0x3c798f[_0x696bed[_0xd236('0x26')]]={'$like':'%'+_0x23714d[_0xd236('0x35')]['filter']+'%'};return _0x3c798f;}})});}_0x28175d=_[_0xd236('0x3e')]({},_0x28175d,_0x23714d[_0xd236('0x40')]);var _0x2ba3ae={'where':_0x28175d['where']};return db[_0xd236('0x2a')]['count'](_0x2ba3ae)[_0xd236('0x23')](function(_0x5793bf){_0x471ed6['count']=_0x5793bf;if(_0x23714d[_0xd236('0x35')][_0xd236('0x41')]){_0x28175d[_0xd236('0x42')]=[{'all':!![]}];}return db[_0xd236('0x2a')][_0xd236('0x43')](_0x28175d);})['then'](function(_0x4d0d65){_0x471ed6[_0xd236('0x44')]=_0x4d0d65;return _0x471ed6;})[_0xd236('0x23')](respondWithFilteredResult(_0x3108f4,_0x28175d))['catch'](handleError(_0x3108f4,null));};exports[_0xd236('0x45')]=function(_0x342fd5,_0x2d815b){var _0x55007d={'raw':!![],'where':{'id':_0x342fd5['params']['id']}},_0x58a93a={};_0x58a93a[_0xd236('0x2f')]=_['keys'](db['Cdr'][_0xd236('0x2b')]);_0x58a93a[_0xd236('0x35')]=_[_0xd236('0x30')](_0x342fd5[_0xd236('0x35')]);_0x58a93a[_0xd236('0x31')]=_['intersection'](_0x58a93a['model'],_0x58a93a[_0xd236('0x35')]);_0x55007d[_0xd236('0x33')]=_[_0xd236('0x32')](_0x58a93a[_0xd236('0x2f')],qs[_0xd236('0x34')](_0x342fd5[_0xd236('0x35')]['fields']));_0x55007d[_0xd236('0x33')]=_0x55007d['attributes'][_0xd236('0x36')]?_0x55007d[_0xd236('0x33')]:_0x58a93a['model'];if(_0x342fd5['query']['includeAll']){_0x55007d['include']=[{'all':!![]}];}_0x55007d=_[_0xd236('0x3e')]({},_0x55007d,_0x342fd5[_0xd236('0x40')]);return db[_0xd236('0x2a')][_0xd236('0x46')](_0x55007d)[_0xd236('0x23')](handleEntityNotFound(_0x2d815b,null))['then'](respondWithResult(_0x2d815b,null))['catch'](handleError(_0x2d815b,null));};exports[_0xd236('0x47')]=function(_0x7c0650,_0xbf4ba9){return db[_0xd236('0x2a')][_0xd236('0x47')](_0x7c0650[_0xd236('0x48')],{})['then'](respondWithResult(_0xbf4ba9,0xc9))[_0xd236('0x49')](handleError(_0xbf4ba9,null));};exports['update']=function(_0x223a14,_0x2c8861){if(_0x223a14['body']['id']){delete _0x223a14[_0xd236('0x48')]['id'];}return db[_0xd236('0x2a')]['find']({'where':{'id':_0x223a14['params']['id']}})[_0xd236('0x23')](handleEntityNotFound(_0x2c8861,null))[_0xd236('0x23')](saveUpdates(_0x223a14[_0xd236('0x48')],null))[_0xd236('0x23')](respondWithResult(_0x2c8861,null))['catch'](handleError(_0x2c8861,null));};exports[_0xd236('0x4a')]=function(_0x43c12b,_0x3d8ca6){return db[_0xd236('0x2a')][_0xd236('0x46')]({'where':{'id':_0x43c12b[_0xd236('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d8ca6,null))['then'](removeEntity(_0x3d8ca6,null))[_0xd236('0x49')](handleError(_0x3d8ca6,null));};exports['describe']=function(_0xa39da6,_0x30c336){return db['Cdr'][_0xd236('0x4c')]()[_0xd236('0x23')](respondWithResult(_0x30c336,null))['catch'](handleError(_0x30c336,null));}; \ No newline at end of file +var _0xd6d6=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type'];(function(_0x5800e9,_0xa9ef46){var _0x193060=function(_0x1ff026){while(--_0x1ff026){_0x5800e9['push'](_0x5800e9['shift']());}};_0x193060(++_0xa9ef46);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3878a0,_0x3a3d86){_0x3878a0=_0x3878a0-0x0;var _0x3cb4a4=_0xd6d6[_0x3878a0];return _0x3cb4a4;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x2d')](_0xde3272,'name');_0x8a9a84[_0x6d6d('0x34')]=_['keys'](_0x553645[_0x6d6d('0x34')]);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x553645['query'][_0x6d6d('0x38')]));_0x5273cd[_0x6d6d('0x37')]=_0x5273cd[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x5273cd[_0x6d6d('0x37')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x34')][_0x6d6d('0x3a')](_0x6d6d('0x3b'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1e')]);_0x5273cd[_0x6d6d('0x1f')]=qs['offset'](_0x553645[_0x6d6d('0x34')][_0x6d6d('0x1f')]);}_0x5273cd[_0x6d6d('0x3c')]=qs[_0x6d6d('0x3d')](_0x553645['query']['sort']);_0x5273cd[_0x6d6d('0x3e')]=qs[_0x6d6d('0x35')](_[_0x6d6d('0x3f')](_0x553645['query'],_0x8a9a84[_0x6d6d('0x35')]),_0xde3272);if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]){_0x5273cd[_0x6d6d('0x3e')]=_['merge'](_0x5273cd['where'],{'$or':_['map'](_0xde3272,function(_0x62620d){if(_0x62620d[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x22a49a={};_0x22a49a[_0x62620d['name']]={'$like':'%'+_0x553645[_0x6d6d('0x34')][_0x6d6d('0x40')]+'%'};return _0x22a49a;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x3d632c={'where':_0x5273cd[_0x6d6d('0x3e')]};return db['Cdr'][_0x6d6d('0x20')](_0x3d632c)[_0x6d6d('0x27')](function(_0x42aff0){_0x57341f[_0x6d6d('0x20')]=_0x42aff0;if(_0x553645[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x5273cd[_0x6d6d('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x6d6d('0x46')](_0x5273cd);})[_0x6d6d('0x27')](function(_0x16e177){_0x57341f[_0x6d6d('0x47')]=_0x16e177;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))['catch'](handleError(_0x3edcce,null));};exports[_0x6d6d('0x48')]=function(_0x39f2a9,_0x55dba8){var _0x452de2={'raw':!![],'where':{'id':_0x39f2a9[_0x6d6d('0x49')]['id']}},_0x50dc17={};_0x50dc17[_0x6d6d('0x33')]=_['keys'](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x50dc17[_0x6d6d('0x34')]=_[_0x6d6d('0x4a')](_0x39f2a9[_0x6d6d('0x34')]);_0x50dc17['filters']=_['intersection'](_0x50dc17[_0x6d6d('0x33')],_0x50dc17['query']);_0x452de2['attributes']=_[_0x6d6d('0x36')](_0x50dc17[_0x6d6d('0x33')],qs[_0x6d6d('0x38')](_0x39f2a9['query'][_0x6d6d('0x38')]));_0x452de2['attributes']=_0x452de2[_0x6d6d('0x37')][_0x6d6d('0x39')]?_0x452de2[_0x6d6d('0x37')]:_0x50dc17[_0x6d6d('0x33')];if(_0x39f2a9[_0x6d6d('0x34')][_0x6d6d('0x44')]){_0x452de2[_0x6d6d('0x45')]=[{'all':!![]}];}_0x452de2=_['merge']({},_0x452de2,_0x39f2a9[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')](_0x452de2)[_0x6d6d('0x27')](handleEntityNotFound(_0x55dba8,null))[_0x6d6d('0x27')](respondWithResult(_0x55dba8,null))[_0x6d6d('0x4c')](handleError(_0x55dba8,null));};exports[_0x6d6d('0x4d')]=function(_0x1d2b20,_0x24cec2){return db['Cdr']['create'](_0x1d2b20[_0x6d6d('0x4e')],{})[_0x6d6d('0x27')](respondWithResult(_0x24cec2,0xc9))[_0x6d6d('0x4c')](handleError(_0x24cec2,null));};exports[_0x6d6d('0x26')]=function(_0xe2a20e,_0x492834){if(_0xe2a20e[_0x6d6d('0x4e')]['id']){delete _0xe2a20e[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0xe2a20e[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0x27')](saveUpdates(_0xe2a20e[_0x6d6d('0x4e')],null))[_0x6d6d('0x27')](respondWithResult(_0x492834,null))[_0x6d6d('0x4c')](handleError(_0x492834,null));};exports[_0x6d6d('0x28')]=function(_0x175e26,_0x4d9811){return db[_0x6d6d('0x2e')][_0x6d6d('0x4b')]({'where':{'id':_0x175e26[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x4d9811,null))[_0x6d6d('0x27')](removeEntity(_0x4d9811,null))['catch'](handleError(_0x4d9811,null));};exports[_0x6d6d('0x4f')]=function(_0x36bc5a,_0x45340b){return db['Cdr']['describe']()[_0x6d6d('0x27')](respondWithResult(_0x45340b,null))['catch'](handleError(_0x45340b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 8ea4b2b..7f4b328 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(_0x33652d,_0x1914ed){var _0x4aa6ce=function(_0x1089ac){while(--_0x1089ac){_0x33652d['push'](_0x33652d['shift']());}};_0x4aa6ce(++_0x1914ed);}(_0x7a54,0x106));var _0x47a5=function(_0x3c65b1,_0x170c0d){_0x3c65b1=_0x3c65b1-0x0;var _0x9f9bbe=_0x7a54[_0x3c65b1];return _0x9f9bbe;};'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(_0x50fb4e,_0x39559b){var _0x3bf8ba=function(_0x25a45b){while(--_0x25a45b){_0x50fb4e['push'](_0x50fb4e['shift']());}};_0x3bf8ba(++_0x39559b);}(_0x7a54,0x106));var _0x47a5=function(_0x45149f,_0x2ee534){_0x45149f=_0x45149f-0x0;var _0x473c1b=_0x7a54[_0x45149f];return _0x473c1b;};'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 854383f..5fbe3bf 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 _0x8030=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8030,0x8a));var _0x0803=function(_0x66a2aa,_0x43001c){_0x66a2aa=_0x66a2aa-0x0;var _0x3933e7=_0x8030[_0x66a2aa];return _0x3933e7;};'use strict';var _=require('lodash');var util=require(_0x0803('0x0'));var moment=require(_0x0803('0x1'));var BPromise=require(_0x0803('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0803('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0803('0x4'));var logger=require(_0x0803('0x5'))(_0x0803('0x6'));var config=require(_0x0803('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0803('0x8')][_0x0803('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46075e,_0x43cba6,_0x5ec083){return new BPromise(function(_0x3a77c7,_0x293eed){return client[_0x0803('0xa')](_0x46075e,_0x5ec083)[_0x0803('0xb')](function(_0x25a605){logger[_0x0803('0xc')](_0x0803('0xd'),_0x43cba6,_0x0803('0xe'));logger[_0x0803('0xf')](_0x0803('0x10'),_0x43cba6,_0x0803('0xe'),JSON[_0x0803('0x11')](_0x25a605));if(_0x25a605[_0x0803('0x12')]){if(_0x25a605[_0x0803('0x12')][_0x0803('0x13')]===0x1f4){logger['error'](_0x0803('0xd'),_0x43cba6,_0x25a605[_0x0803('0x12')][_0x0803('0x14')]);return _0x293eed(_0x25a605['error'][_0x0803('0x14')]);}logger['error'](_0x0803('0xd'),_0x43cba6,_0x25a605[_0x0803('0x12')][_0x0803('0x14')]);return _0x3a77c7(_0x25a605['error']['message']);}else{logger[_0x0803('0xc')](_0x0803('0xd'),_0x43cba6,'request\x20sent');_0x3a77c7(_0x25a605[_0x0803('0x15')][_0x0803('0x14')]);}})[_0x0803('0x16')](function(_0x408e5e){logger[_0x0803('0x12')](_0x0803('0xd'),_0x43cba6,_0x408e5e);_0x293eed(_0x408e5e);});});} \ No newline at end of file +var _0xc118=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e3e1,_0x1d45af){var _0x211a2b=function(_0x3ea9b4){while(--_0x3ea9b4){_0x42e3e1['push'](_0x42e3e1['shift']());}};_0x211a2b(++_0x1d45af);}(_0xc118,0x18a));var _0x8c11=function(_0x4d00be,_0x1315c2){_0x4d00be=_0x4d00be-0x0;var _0x4f26fa=_0xc118[_0x4d00be];return _0x4f26fa;};'use strict';var _=require('lodash');var util=require(_0x8c11('0x0'));var moment=require(_0x8c11('0x1'));var BPromise=require(_0x8c11('0x2'));var rs=require(_0x8c11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c11('0x4'))['db'];var utils=require(_0x8c11('0x5'));var logger=require('../../config/logger')(_0x8c11('0x6'));var config=require(_0x8c11('0x7'));var jayson=require(_0x8c11('0x8'));var client=jayson[_0x8c11('0x9')][_0x8c11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11e4f7,_0x36289c,_0x9bc943){return new BPromise(function(_0x3e93ce,_0x59f01f){return client[_0x8c11('0xb')](_0x11e4f7,_0x9bc943)[_0x8c11('0xc')](function(_0x4cc773){logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));logger[_0x8c11('0x10')](_0x8c11('0x11'),_0x36289c,_0x8c11('0xf'),JSON[_0x8c11('0x12')](_0x4cc773));if(_0x4cc773[_0x8c11('0x13')]){if(_0x4cc773['error'][_0x8c11('0x14')]===0x1f4){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x59f01f(_0x4cc773['error'][_0x8c11('0x15')]);}logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x4cc773['error'][_0x8c11('0x15')]);return _0x3e93ce(_0x4cc773[_0x8c11('0x13')][_0x8c11('0x15')]);}else{logger[_0x8c11('0xd')](_0x8c11('0xe'),_0x36289c,_0x8c11('0xf'));_0x3e93ce(_0x4cc773[_0x8c11('0x16')][_0x8c11('0x15')]);}})['catch'](function(_0x3ac5ad){logger[_0x8c11('0x13')](_0x8c11('0xe'),_0x36289c,_0x3ac5ad);_0x59f01f(_0x3ac5ad);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 605ba8f..378eac7 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x235884,_0x1c4355){var _0x211158=function(_0x3d620c){while(--_0x3d620c){_0x235884['push'](_0x235884['shift']());}};_0x211158(++_0x1c4355);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x413838,_0x405f52){var _0x4ec54a=function(_0x568563){while(--_0x568563){_0x413838['push'](_0x413838['shift']());}};_0x4ec54a(++_0x405f52);}(_0xb10b,0x12a));var _0xbb10=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0xb10b[_0x25f39c];return _0x19bb4a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0736351..fd0ab06 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 _0xd0b0=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xd0b0,0xbe));var _0x0d0b=function(_0x521d25,_0x1434b1){_0x521d25=_0x521d25-0x0;var _0x26f3b0=_0xd0b0[_0x521d25];return _0x26f3b0;};'use strict';var Sequelize=require(_0x0d0b('0x0'));module[_0x0d0b('0x1')]={'priority':{'type':Sequelize[_0x0d0b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0d0b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0d0b('0x3')],'defaultValue':_0x0d0b('0x4')}}; \ No newline at end of file +var _0x2693=['exports','STRING','TEXT','sequelize'];(function(_0x33aefe,_0x371ccd){var _0x471d19=function(_0x566c26){while(--_0x566c26){_0x33aefe['push'](_0x33aefe['shift']());}};_0x471d19(++_0x371ccd);}(_0x2693,0x1ef));var _0x3269=function(_0x31571c,_0x1e9e35){_0x31571c=_0x31571c-0x0;var _0x410db2=_0x2693[_0x31571c];return _0x410db2;};'use strict';var Sequelize=require(_0x3269('0x0'));module[_0x3269('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3269('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3269('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3269('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 233aec1..8851295 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 _0x876b=['set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','include','options','find','catch','body','params','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x29ab68,_0x5d1155){var _0x3c64d1=function(_0x25ef42){while(--_0x25ef42){_0x29ab68['push'](_0x29ab68['shift']());}};_0x3c64d1(++_0x5d1155);}(_0x876b,0x1ba));var _0xb876=function(_0x2c4594,_0x523e85){_0x2c4594=_0x2c4594-0x0;var _0x223db7=_0x876b[_0x2c4594];return _0x223db7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb876('0x0'));var jsonpatch=require(_0xb876('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb876('0x2'));var Mustache=require(_0xb876('0x3'));var util=require('util');var path=require(_0xb876('0x4'));var sox=require(_0xb876('0x5'));var csv=require(_0xb876('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb876('0x7'));var _=require(_0xb876('0x8'));var squel=require('squel');var crypto=require(_0xb876('0x9'));var jsforce=require(_0xb876('0xa'));var deskjs=require(_0xb876('0xb'));var toCsv=require(_0xb876('0x6'));var querystring=require('querystring');var Papa=require(_0xb876('0xc'));var Redis=require('ioredis');var authService=require(_0xb876('0xd'));var qs=require(_0xb876('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb876('0xf'));var utils=require('../../config/utils');var config=require(_0xb876('0x10'));var licenseUtil=require(_0xb876('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84b7bb,_0x19fb7e){_0x19fb7e=_0x19fb7e||0xcc;return function(_0x2c2a0f){if(_0x2c2a0f){return _0x84b7bb[_0xb876('0x12')](_0x19fb7e);}return _0x84b7bb[_0xb876('0x13')](_0x19fb7e)[_0xb876('0x14')]();};}function respondWithResult(_0x39bc32,_0x31a5fa){_0x31a5fa=_0x31a5fa||0xc8;return function(_0x248165){if(_0x248165){return _0x39bc32[_0xb876('0x13')](_0x31a5fa)[_0xb876('0x15')](_0x248165);}};}function respondWithFilteredResult(_0x239804,_0x497380){return function(_0x33f264){if(_0x33f264){var _0x6bf9ad=typeof _0x497380[_0xb876('0x16')]===_0xb876('0x17')&&typeof _0x497380[_0xb876('0x18')]===_0xb876('0x17');var _0x526ea7=_0x33f264[_0xb876('0x19')];var _0x3da83a=_0x6bf9ad?0x0:_0x497380['offset'];var _0x5eb24a=_0x6bf9ad?_0x33f264[_0xb876('0x19')]:_0x497380[_0xb876('0x16')]+_0x497380[_0xb876('0x18')];var _0x587af4;if(_0x5eb24a>=_0x526ea7){_0x5eb24a=_0x526ea7;_0x587af4=0xc8;}else{_0x587af4=0xce;}_0x239804[_0xb876('0x13')](_0x587af4);return _0x239804[_0xb876('0x1a')](_0xb876('0x1b'),_0x3da83a+'-'+_0x5eb24a+'/'+_0x526ea7)[_0xb876('0x15')](_0x33f264);}return null;};}function patchUpdates(_0x10b085){return function(_0x4f9b80){try{jsonpatch['apply'](_0x4f9b80,_0x10b085,!![]);}catch(_0x4b4382){return BPromise[_0xb876('0x1c')](_0x4b4382);}return _0x4f9b80[_0xb876('0x1d')]();};}function saveUpdates(_0x36f701,_0x115f17){return function(_0x5d775c){if(_0x5d775c){return _0x5d775c[_0xb876('0x1e')](_0x36f701)[_0xb876('0x1f')](function(_0x20006c){return _0x20006c;});}return null;};}function removeEntity(_0x359b44,_0xe939c2){return function(_0x351dc3){if(_0x351dc3){return _0x351dc3[_0xb876('0x20')]()[_0xb876('0x1f')](function(){_0x359b44[_0xb876('0x13')](0xcc)[_0xb876('0x14')]();});}};}function handleEntityNotFound(_0x244e2b,_0x2f41ce){return function(_0x30a7f8){if(!_0x30a7f8){_0x244e2b[_0xb876('0x12')](0x194);}return _0x30a7f8;};}function handleError(_0xbd522f,_0x22d680){_0x22d680=_0x22d680||0x1f4;return function(_0x213c8a){logger['error'](_0x213c8a[_0xb876('0x21')]);if(_0x213c8a[_0xb876('0x22')]){delete _0x213c8a[_0xb876('0x22')];}_0xbd522f['status'](_0x22d680)[_0xb876('0x23')](_0x213c8a);};}exports[_0xb876('0x24')]=function(_0x11c061,_0x5a4ade){var _0x20bd3b={'raw':!![],'where':{'id':_0x11c061['params']['id']}},_0x45a8a5={};_0x45a8a5[_0xb876('0x25')]=_['keys'](db[_0xb876('0x26')][_0xb876('0x27')]);_0x45a8a5[_0xb876('0x28')]=_[_0xb876('0x29')](_0x11c061['query']);_0x45a8a5[_0xb876('0x2a')]=_[_0xb876('0x2b')](_0x45a8a5[_0xb876('0x25')],_0x45a8a5[_0xb876('0x28')]);_0x20bd3b[_0xb876('0x2c')]=_[_0xb876('0x2b')](_0x45a8a5[_0xb876('0x25')],qs['fields'](_0x11c061[_0xb876('0x28')][_0xb876('0x2d')]));_0x20bd3b[_0xb876('0x2c')]=_0x20bd3b['attributes']['length']?_0x20bd3b[_0xb876('0x2c')]:_0x45a8a5[_0xb876('0x25')];if(_0x11c061[_0xb876('0x28')]['includeAll']){_0x20bd3b[_0xb876('0x2e')]=[{'all':!![]}];}_0x20bd3b=_['merge']({},_0x20bd3b,_0x11c061[_0xb876('0x2f')]);return db[_0xb876('0x26')][_0xb876('0x30')](_0x20bd3b)['then'](handleEntityNotFound(_0x5a4ade,null))[_0xb876('0x1f')](respondWithResult(_0x5a4ade,null))[_0xb876('0x31')](handleError(_0x5a4ade,null));};exports[_0xb876('0x1e')]=function(_0xa17e24,_0x29b70e){if(_0xa17e24[_0xb876('0x32')]['id']){delete _0xa17e24[_0xb876('0x32')]['id'];}return db[_0xb876('0x26')]['find']({'where':{'id':_0xa17e24['params']['id']}})[_0xb876('0x1f')](handleEntityNotFound(_0x29b70e,null))[_0xb876('0x1f')](saveUpdates(_0xa17e24[_0xb876('0x32')],null))[_0xb876('0x1f')](respondWithResult(_0x29b70e,null))['catch'](handleError(_0x29b70e,null));};exports[_0xb876('0x20')]=function(_0x3d162c,_0x40cc32){return db[_0xb876('0x26')][_0xb876('0x30')]({'where':{'id':_0x3d162c[_0xb876('0x33')]['id']}})[_0xb876('0x1f')](handleEntityNotFound(_0x40cc32,null))[_0xb876('0x1f')](removeEntity(_0x40cc32,null))['catch'](handleError(_0x40cc32,null));}; \ No newline at end of file +var _0x0e0f=['error','stack','name','send','show','model','ChatApplication','query','keys','filters','attributes','intersection','fields','includeAll','include','options','catch','update','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','undefined','limit','offset','save','then','destroy','end'];(function(_0x4beb44,_0x45c192){var _0x150dc0=function(_0x2ed5f5){while(--_0x2ed5f5){_0x4beb44['push'](_0x4beb44['shift']());}};_0x150dc0(++_0x45c192);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x446122,_0x2210aa){_0x446122=_0x446122-0x0;var _0x4410c3=_0x0e0f[_0x446122];return _0x4410c3;};'use strict';var emlformat=require(_0xf0e0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0e0('0x1'));var rp=require(_0xf0e0('0x2'));var moment=require(_0xf0e0('0x3'));var BPromise=require(_0xf0e0('0x4'));var Mustache=require(_0xf0e0('0x5'));var util=require('util');var path=require(_0xf0e0('0x6'));var sox=require(_0xf0e0('0x7'));var csv=require('to-csv');var ejs=require(_0xf0e0('0x8'));var fs=require('fs');var fs_extra=require(_0xf0e0('0x9'));var _=require(_0xf0e0('0xa'));var squel=require(_0xf0e0('0xb'));var crypto=require(_0xf0e0('0xc'));var jsforce=require(_0xf0e0('0xd'));var deskjs=require(_0xf0e0('0xe'));var toCsv=require(_0xf0e0('0xf'));var querystring=require(_0xf0e0('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf0e0('0x12'));var as=require(_0xf0e0('0x13'));var hardwareService=require(_0xf0e0('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0e0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x501c86,_0x24d3a9){_0x24d3a9=_0x24d3a9||0xcc;return function(_0x5bd0ab){if(_0x5bd0ab){return _0x501c86[_0xf0e0('0x16')](_0x24d3a9);}return _0x501c86[_0xf0e0('0x17')](_0x24d3a9)['end']();};}function respondWithResult(_0x552683,_0x457bfc){_0x457bfc=_0x457bfc||0xc8;return function(_0x5b3719){if(_0x5b3719){return _0x552683[_0xf0e0('0x17')](_0x457bfc)['json'](_0x5b3719);}};}function respondWithFilteredResult(_0x3357f0,_0x55e350){return function(_0x40d87b){if(_0x40d87b){var _0x186e92=typeof _0x55e350['offset']===_0xf0e0('0x18')&&typeof _0x55e350[_0xf0e0('0x19')]===_0xf0e0('0x18');var _0x36206d=_0x40d87b['count'];var _0x3d725b=_0x186e92?0x0:_0x55e350[_0xf0e0('0x1a')];var _0x5e221e=_0x186e92?_0x40d87b['count']:_0x55e350[_0xf0e0('0x1a')]+_0x55e350[_0xf0e0('0x19')];var _0x51c8c8;if(_0x5e221e>=_0x36206d){_0x5e221e=_0x36206d;_0x51c8c8=0xc8;}else{_0x51c8c8=0xce;}_0x3357f0[_0xf0e0('0x17')](_0x51c8c8);return _0x3357f0['set']('Content-Range',_0x3d725b+'-'+_0x5e221e+'/'+_0x36206d)['json'](_0x40d87b);}return null;};}function patchUpdates(_0x350649){return function(_0x3ed3f8){try{jsonpatch['apply'](_0x3ed3f8,_0x350649,!![]);}catch(_0x54e139){return BPromise['reject'](_0x54e139);}return _0x3ed3f8[_0xf0e0('0x1b')]();};}function saveUpdates(_0x52e518,_0x586ef0){return function(_0x48b789){if(_0x48b789){return _0x48b789['update'](_0x52e518)[_0xf0e0('0x1c')](function(_0x357e3a){return _0x357e3a;});}return null;};}function removeEntity(_0x1a1cdb,_0x211d1c){return function(_0x507c66){if(_0x507c66){return _0x507c66[_0xf0e0('0x1d')]()[_0xf0e0('0x1c')](function(){_0x1a1cdb['status'](0xcc)[_0xf0e0('0x1e')]();});}};}function handleEntityNotFound(_0x50cb6e,_0x379256){return function(_0x364675){if(!_0x364675){_0x50cb6e['sendStatus'](0x194);}return _0x364675;};}function handleError(_0xce3161,_0x3e7e3a){_0x3e7e3a=_0x3e7e3a||0x1f4;return function(_0x51c3e2){logger[_0xf0e0('0x1f')](_0x51c3e2[_0xf0e0('0x20')]);if(_0x51c3e2[_0xf0e0('0x21')]){delete _0x51c3e2[_0xf0e0('0x21')];}_0xce3161[_0xf0e0('0x17')](_0x3e7e3a)[_0xf0e0('0x22')](_0x51c3e2);};}exports[_0xf0e0('0x23')]=function(_0x3b4a3b,_0xfe6ec){var _0xb08e13={'raw':!![],'where':{'id':_0x3b4a3b['params']['id']}},_0x251a8b={};_0x251a8b[_0xf0e0('0x24')]=_['keys'](db[_0xf0e0('0x25')]['rawAttributes']);_0x251a8b[_0xf0e0('0x26')]=_[_0xf0e0('0x27')](_0x3b4a3b[_0xf0e0('0x26')]);_0x251a8b[_0xf0e0('0x28')]=_['intersection'](_0x251a8b[_0xf0e0('0x24')],_0x251a8b[_0xf0e0('0x26')]);_0xb08e13[_0xf0e0('0x29')]=_[_0xf0e0('0x2a')](_0x251a8b['model'],qs[_0xf0e0('0x2b')](_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2b')]));_0xb08e13[_0xf0e0('0x29')]=_0xb08e13[_0xf0e0('0x29')]['length']?_0xb08e13[_0xf0e0('0x29')]:_0x251a8b[_0xf0e0('0x24')];if(_0x3b4a3b[_0xf0e0('0x26')][_0xf0e0('0x2c')]){_0xb08e13[_0xf0e0('0x2d')]=[{'all':!![]}];}_0xb08e13=_['merge']({},_0xb08e13,_0x3b4a3b[_0xf0e0('0x2e')]);return db[_0xf0e0('0x25')]['find'](_0xb08e13)[_0xf0e0('0x1c')](handleEntityNotFound(_0xfe6ec,null))[_0xf0e0('0x1c')](respondWithResult(_0xfe6ec,null))[_0xf0e0('0x2f')](handleError(_0xfe6ec,null));};exports[_0xf0e0('0x30')]=function(_0x89dbf3,_0x1105d7){if(_0x89dbf3[_0xf0e0('0x31')]['id']){delete _0x89dbf3['body']['id'];}return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x89dbf3[_0xf0e0('0x33')]['id']}})[_0xf0e0('0x1c')](handleEntityNotFound(_0x1105d7,null))[_0xf0e0('0x1c')](saveUpdates(_0x89dbf3[_0xf0e0('0x31')],null))['then'](respondWithResult(_0x1105d7,null))['catch'](handleError(_0x1105d7,null));};exports[_0xf0e0('0x1d')]=function(_0x5addaf,_0x11113c){return db[_0xf0e0('0x25')][_0xf0e0('0x32')]({'where':{'id':_0x5addaf[_0xf0e0('0x33')]['id']}})['then'](handleEntityNotFound(_0x11113c,null))['then'](removeEntity(_0x11113c,null))[_0xf0e0('0x2f')](handleError(_0x11113c,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d2b6ad1..8b563ee 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 _0x4706=['ChatApplication','chat_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x315f3a,_0x269ada){var _0x3139f8=function(_0x4696fc){while(--_0x4696fc){_0x315f3a['push'](_0x315f3a['shift']());}};_0x3139f8(++_0x269ada);}(_0x4706,0xf1));var _0x6470=function(_0x43f1f4,_0x2509a8){_0x43f1f4=_0x43f1f4-0x0;var _0x241794=_0x4706[_0x43f1f4];return _0x241794;};'use strict';var _=require('lodash');var util=require(_0x6470('0x0'));var logger=require(_0x6470('0x1'))(_0x6470('0x2'));var moment=require(_0x6470('0x3'));var BPromise=require(_0x6470('0x4'));var rp=require(_0x6470('0x5'));var fs=require('fs');var path=require(_0x6470('0x6'));var rimraf=require(_0x6470('0x7'));var config=require(_0x6470('0x8'));var attributes=require(_0x6470('0x9'));module[_0x6470('0xa')]=function(_0x4174f3,_0x329ea0){return _0x4174f3['define'](_0x6470('0xb'),attributes,{'tableName':_0x6470('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6470('0xd')});}; \ No newline at end of file +var _0x05cd=['api','moment','request-promise','path','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x205123,_0x240ebe){var _0x5b69fb=function(_0x488aaf){while(--_0x488aaf){_0x205123['push'](_0x205123['shift']());}};_0x5b69fb(++_0x240ebe);}(_0x05cd,0x1bd));var _0xd05c=function(_0x266ca7,_0x15005f){_0x266ca7=_0x266ca7-0x0;var _0x2969ca=_0x05cd[_0x266ca7];return _0x2969ca;};'use strict';var _=require(_0xd05c('0x0'));var util=require(_0xd05c('0x1'));var logger=require(_0xd05c('0x2'))(_0xd05c('0x3'));var moment=require(_0xd05c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd05c('0x5'));var fs=require('fs');var path=require(_0xd05c('0x6'));var rimraf=require('rimraf');var config=require(_0xd05c('0x7'));var attributes=require(_0xd05c('0x8'));module[_0xd05c('0x9')]=function(_0x55ed53,_0x572586){return _0x55ed53[_0xd05c('0xa')](_0xd05c('0xb'),attributes,{'tableName':_0xd05c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd05c('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 66dcd26..71839fd 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 _0x604b=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x604b,0x1cb));var _0xb604=function(_0x1e491b,_0x3877d5){_0x1e491b=_0x1e491b-0x0;var _0x4b984f=_0x604b[_0x1e491b];return _0x4b984f;};'use strict';var _=require(_0xb604('0x0'));var util=require(_0xb604('0x1'));var moment=require(_0xb604('0x2'));var BPromise=require('bluebird');var rs=require(_0xb604('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb604('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb604('0x5'))('rpc');var config=require(_0xb604('0x6'));var jayson=require(_0xb604('0x7'));var client=jayson[_0xb604('0x8')][_0xb604('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xeba047,_0x21ca4b,_0x3037dc){return new BPromise(function(_0x3312ed,_0x5ef651){return client[_0xb604('0xa')](_0xeba047,_0x3037dc)[_0xb604('0xb')](function(_0xf30e63){logger['info'](_0xb604('0xc'),_0x21ca4b,_0xb604('0xd'));logger[_0xb604('0xe')](_0xb604('0xf'),_0x21ca4b,_0xb604('0xd'),JSON[_0xb604('0x10')](_0xf30e63));if(_0xf30e63[_0xb604('0x11')]){if(_0xf30e63[_0xb604('0x11')][_0xb604('0x12')]===0x1f4){logger[_0xb604('0x11')](_0xb604('0xc'),_0x21ca4b,_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);return _0x5ef651(_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);}logger[_0xb604('0x11')](_0xb604('0xc'),_0x21ca4b,_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);return _0x3312ed(_0xf30e63[_0xb604('0x11')][_0xb604('0x13')]);}else{logger[_0xb604('0x14')]('ChatApplication,\x20%s,\x20%s',_0x21ca4b,_0xb604('0xd'));_0x3312ed(_0xf30e63['result'][_0xb604('0x13')]);}})[_0xb604('0x15')](function(_0x3b964a){logger['error']('ChatApplication,\x20%s,\x20%s',_0x21ca4b,_0x3b964a);_0x5ef651(_0x3b964a);});});} \ No newline at end of file +var _0xcbf8=['code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xcbf8,0x118));var _0x8cbf=function(_0x5b73ac,_0x4a1422){_0x5b73ac=_0x5b73ac-0x0;var _0x32bcdf=_0xcbf8[_0x5b73ac];return _0x32bcdf;};'use strict';var _=require(_0x8cbf('0x0'));var util=require(_0x8cbf('0x1'));var moment=require(_0x8cbf('0x2'));var BPromise=require(_0x8cbf('0x3'));var rs=require(_0x8cbf('0x4'));var fs=require('fs');var Redis=require(_0x8cbf('0x5'));var db=require(_0x8cbf('0x6'))['db'];var utils=require(_0x8cbf('0x7'));var logger=require(_0x8cbf('0x8'))(_0x8cbf('0x9'));var config=require(_0x8cbf('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8cbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4625cd,_0x3bbcfe,_0x2bb948){return new BPromise(function(_0x936320,_0x425ade){return client[_0x8cbf('0xc')](_0x4625cd,_0x2bb948)[_0x8cbf('0xd')](function(_0x5e1005){logger[_0x8cbf('0xe')]('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));logger[_0x8cbf('0x10')](_0x8cbf('0x11'),_0x3bbcfe,_0x8cbf('0xf'),JSON[_0x8cbf('0x12')](_0x5e1005));if(_0x5e1005[_0x8cbf('0x13')]){if(_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x14')]===0x1f4){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')]['message']);return _0x425ade(_0x5e1005['error'][_0x8cbf('0x16')]);}logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x5e1005[_0x8cbf('0x13')][_0x8cbf('0x16')]);return _0x936320(_0x5e1005['error'][_0x8cbf('0x16')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3bbcfe,_0x8cbf('0xf'));_0x936320(_0x5e1005[_0x8cbf('0x17')][_0x8cbf('0x16')]);}})[_0x8cbf('0x18')](function(_0x25cc85){logger[_0x8cbf('0x13')](_0x8cbf('0x15'),_0x3bbcfe,_0x25cc85);_0x425ade(_0x25cc85);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 85926cf..99f9c00 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 _0x6812=['../../config/environment','get','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x53fedc,_0x1a5126){var _0x576b8a=function(_0x40ca5b){while(--_0x40ca5b){_0x53fedc['push'](_0x53fedc['shift']());}};_0x576b8a(++_0x1a5126);}(_0x6812,0x17e));var _0x2681=function(_0x40b108,_0x3be04c){_0x40b108=_0x40b108-0x0;var _0x586363=_0x6812[_0x40b108];return _0x586363;};'use strict';var multer=require(_0x2681('0x0'));var util=require(_0x2681('0x1'));var path=require(_0x2681('0x2'));var timeout=require(_0x2681('0x3'));var express=require(_0x2681('0x4'));var router=express[_0x2681('0x5')]();var fs_extra=require(_0x2681('0x6'));var auth=require(_0x2681('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2681('0x8'));var controller=require('./chatApplication.controller');router[_0x2681('0x9')](_0x2681('0xa'),auth[_0x2681('0xb')](),controller['show']);router['put'](_0x2681('0xa'),auth['isAuthenticated'](),controller[_0x2681('0xc')]);router[_0x2681('0xd')](_0x2681('0xa'),auth[_0x2681('0xb')](),controller['destroy']);module[_0x2681('0xe')]=router; \ No newline at end of file +var _0xf1a1=['exports','multer','util','Router','fs-extra','/:id','isAuthenticated','put','delete','destroy'];(function(_0x269825,_0x271c62){var _0x2d7a7a=function(_0x6ad778){while(--_0x6ad778){_0x269825['push'](_0x269825['shift']());}};_0x2d7a7a(++_0x271c62);}(_0xf1a1,0xdd));var _0x1f1a=function(_0x39a42e,_0x594f2c){_0x39a42e=_0x39a42e-0x0;var _0x462d94=_0xf1a1[_0x39a42e];return _0x462d94;};'use strict';var multer=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f1a('0x2')]();var fs_extra=require(_0x1f1a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['show']);router[_0x1f1a('0x6')](_0x1f1a('0x4'),auth[_0x1f1a('0x5')](),controller['update']);router[_0x1f1a('0x7')]('/:id',auth[_0x1f1a('0x5')](),controller[_0x1f1a('0x8')]);module[_0x1f1a('0x9')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d01c6a3..e99682f 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 _0x3a1a=['exports','STRING','BOOLEAN'];(function(_0x519d70,_0xadec7b){var _0x1bb8d3=function(_0x5bb6c1){while(--_0x5bb6c1){_0x519d70['push'](_0x519d70['shift']());}};_0x1bb8d3(++_0xadec7b);}(_0x3a1a,0x15f));var _0xa3a1=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3a1a[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xa3a1('0x0')]={'name':{'type':Sequelize[_0xa3a1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3a1('0x1')]},'write':{'type':Sequelize[_0xa3a1('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfb67=['BOOLEAN','sequelize','exports','STRING'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xfb67,0xdd));var _0x7fb6=function(_0x773a85,_0x11cd42){_0x773a85=_0x773a85-0x0;var _0x4dd465=_0xfb67[_0x773a85];return _0x4dd465;};'use strict';var Sequelize=require(_0x7fb6('0x0'));module[_0x7fb6('0x1')]={'name':{'type':Sequelize[_0x7fb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7fb6('0x2')]},'write':{'type':Sequelize[_0x7fb6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index f72a122..b608454 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 _0xc7ee=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','pick','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4f5108,_0x46a54b){var _0x2d56ca=function(_0x5b3c1e){while(--_0x5b3c1e){_0x4f5108['push'](_0x4f5108['shift']());}};_0x2d56ca(++_0x46a54b);}(_0xc7ee,0x180));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec7e('0x0'));var zipdir=require(_0xec7e('0x1'));var jsonpatch=require(_0xec7e('0x2'));var rp=require('request-promise');var moment=require(_0xec7e('0x3'));var BPromise=require(_0xec7e('0x4'));var Mustache=require(_0xec7e('0x5'));var util=require(_0xec7e('0x6'));var path=require(_0xec7e('0x7'));var sox=require(_0xec7e('0x8'));var csv=require(_0xec7e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec7e('0xa'));var squel=require(_0xec7e('0xb'));var crypto=require(_0xec7e('0xc'));var jsforce=require(_0xec7e('0xd'));var deskjs=require(_0xec7e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec7e('0xf'));var Papa=require(_0xec7e('0x10'));var Redis=require(_0xec7e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec7e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec7e('0x13'))('api');var utils=require(_0xec7e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xec7e('0x15'))['db'];config[_0xec7e('0x16')]=_['defaults'](config[_0xec7e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xec7e('0x17'))(new Redis(config[_0xec7e('0x16')]));require(_0xec7e('0x18'))[_0xec7e('0x19')](socket);function respondWithStatusCode(_0x597a8d,_0x2365c4){_0x2365c4=_0x2365c4||0xcc;return function(_0x33143f){if(_0x33143f){return _0x597a8d[_0xec7e('0x1a')](_0x2365c4);}return _0x597a8d[_0xec7e('0x1b')](_0x2365c4)['end']();};}function respondWithResult(_0x313523,_0x4a7440){_0x4a7440=_0x4a7440||0xc8;return function(_0x1848ee){if(_0x1848ee){return _0x313523[_0xec7e('0x1b')](_0x4a7440)[_0xec7e('0x1c')](_0x1848ee);}};}function respondWithFilteredResult(_0x985800,_0xbc066a){return function(_0x5dfbff){if(_0x5dfbff){var _0x463b6b=typeof _0xbc066a['offset']===_0xec7e('0x1d')&&typeof _0xbc066a[_0xec7e('0x1e')]===_0xec7e('0x1d');var _0x162ab8=_0x5dfbff[_0xec7e('0x1f')];var _0x3854d6=_0x463b6b?0x0:_0xbc066a[_0xec7e('0x20')];var _0x12d0e5=_0x463b6b?_0x5dfbff[_0xec7e('0x1f')]:_0xbc066a['offset']+_0xbc066a[_0xec7e('0x1e')];var _0x2ec739;if(_0x12d0e5>=_0x162ab8){_0x12d0e5=_0x162ab8;_0x2ec739=0xc8;}else{_0x2ec739=0xce;}_0x985800[_0xec7e('0x1b')](_0x2ec739);return _0x985800[_0xec7e('0x21')](_0xec7e('0x22'),_0x3854d6+'-'+_0x12d0e5+'/'+_0x162ab8)[_0xec7e('0x1c')](_0x5dfbff);}return null;};}function patchUpdates(_0x316529){return function(_0x2c8dab){try{jsonpatch[_0xec7e('0x23')](_0x2c8dab,_0x316529,!![]);}catch(_0x73f89e){return BPromise[_0xec7e('0x24')](_0x73f89e);}return _0x2c8dab['save']();};}function saveUpdates(_0x2f8a70,_0x395354){return function(_0x1698a5){if(_0x1698a5){return _0x1698a5[_0xec7e('0x25')](_0x2f8a70)[_0xec7e('0x26')](function(_0x538158){return _0x538158;});}return null;};}function removeEntity(_0xcb7822,_0x1c7580){return function(_0x3c3abb){if(_0x3c3abb){return _0x3c3abb[_0xec7e('0x27')]()['then'](function(){_0xcb7822[_0xec7e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520b84,_0x3cc823){return function(_0x5abf22){if(!_0x5abf22){_0x520b84[_0xec7e('0x1a')](0x194);}return _0x5abf22;};}function handleError(_0xad8dc3,_0x1dfcc1){_0x1dfcc1=_0x1dfcc1||0x1f4;return function(_0x149ffa){logger[_0xec7e('0x28')](_0x149ffa[_0xec7e('0x29')]);if(_0x149ffa[_0xec7e('0x2a')]){delete _0x149ffa[_0xec7e('0x2a')];}_0xad8dc3['status'](_0x1dfcc1)[_0xec7e('0x2b')](_0x149ffa);};}exports[_0xec7e('0x2c')]=function(_0x315f7d,_0x4b729f){var _0x237fe7={},_0x10546b={},_0xc7bb85={'count':0x0,'rows':[]};var _0x140b7f=_[_0xec7e('0x2d')](db[_0xec7e('0x2e')][_0xec7e('0x2f')],function(_0x4bc5c6){return{'name':_0x4bc5c6['fieldName'],'type':_0x4bc5c6[_0xec7e('0x30')][_0xec7e('0x31')]};});_0x10546b[_0xec7e('0x32')]=_[_0xec7e('0x2d')](_0x140b7f,_0xec7e('0x2a'));_0x10546b['query']=_[_0xec7e('0x33')](_0x315f7d['query']);_0x10546b[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x10546b[_0xec7e('0x32')],_0x10546b[_0xec7e('0x36')]);_0x237fe7['attributes']=_[_0xec7e('0x35')](_0x10546b[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x315f7d['query'][_0xec7e('0x37')]));_0x237fe7[_0xec7e('0x38')]=_0x237fe7[_0xec7e('0x38')][_0xec7e('0x39')]?_0x237fe7['attributes']:_0x10546b[_0xec7e('0x32')];if(!_0x315f7d[_0xec7e('0x36')][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x237fe7[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x237fe7['offset']=qs[_0xec7e('0x20')](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x20')]);}_0x237fe7[_0xec7e('0x3c')]=qs['sort'](_0x315f7d[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x237fe7[_0xec7e('0x3e')]=qs[_0xec7e('0x34')](_['pick'](_0x315f7d[_0xec7e('0x36')],_0x10546b['filters']),_0x140b7f);if(_0x315f7d['query'][_0xec7e('0x3f')]){_0x237fe7[_0xec7e('0x3e')]=_['merge'](_0x237fe7[_0xec7e('0x3e')],{'$or':_[_0xec7e('0x2d')](_0x140b7f,function(_0x107105){if(_0x107105['type']!==_0xec7e('0x40')){var _0x55984c={};_0x55984c[_0x107105[_0xec7e('0x2a')]]={'$like':'%'+_0x315f7d[_0xec7e('0x36')]['filter']+'%'};return _0x55984c;}})});}_0x237fe7=_[_0xec7e('0x41')]({},_0x237fe7,_0x315f7d[_0xec7e('0x42')]);var _0x2af7c2={'where':_0x237fe7['where']};return db[_0xec7e('0x2e')]['count'](_0x2af7c2)[_0xec7e('0x26')](function(_0x594a7e){_0xc7bb85[_0xec7e('0x1f')]=_0x594a7e;if(_0x315f7d['query'][_0xec7e('0x43')]){_0x237fe7[_0xec7e('0x44')]=[{'all':!![]}];}return db[_0xec7e('0x2e')][_0xec7e('0x45')](_0x237fe7);})[_0xec7e('0x26')](function(_0x33715a){_0xc7bb85[_0xec7e('0x46')]=_0x33715a;return _0xc7bb85;})[_0xec7e('0x26')](respondWithFilteredResult(_0x4b729f,_0x237fe7))[_0xec7e('0x47')](handleError(_0x4b729f,null));};exports[_0xec7e('0x48')]=function(_0x2babde,_0x2feef7){var _0x23a16d={'raw':!![],'where':{'id':_0x2babde['params']['id']}},_0x695483={};_0x695483[_0xec7e('0x32')]=_[_0xec7e('0x33')](db[_0xec7e('0x2e')]['rawAttributes']);_0x695483['query']=_[_0xec7e('0x33')](_0x2babde['query']);_0x695483[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x695483[_0xec7e('0x32')],_0x695483[_0xec7e('0x36')]);_0x23a16d[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x695483['model'],qs[_0xec7e('0x37')](_0x2babde[_0xec7e('0x36')]['fields']));_0x23a16d[_0xec7e('0x38')]=_0x23a16d[_0xec7e('0x38')]['length']?_0x23a16d['attributes']:_0x695483[_0xec7e('0x32')];if(_0x2babde[_0xec7e('0x36')]['includeAll']){_0x23a16d['include']=[{'all':!![]}];}_0x23a16d=_['merge']({},_0x23a16d,_0x2babde[_0xec7e('0x42')]);return db[_0xec7e('0x2e')][_0xec7e('0x49')](_0x23a16d)[_0xec7e('0x26')](handleEntityNotFound(_0x2feef7,null))['then'](respondWithResult(_0x2feef7,null))[_0xec7e('0x47')](handleError(_0x2feef7,null));};exports[_0xec7e('0x4a')]=function(_0x1cce44,_0x2e386d){return db[_0xec7e('0x2e')][_0xec7e('0x4a')](_0x1cce44['body'],{})[_0xec7e('0x26')](respondWithResult(_0x2e386d,0xc9))[_0xec7e('0x47')](handleError(_0x2e386d,null));};exports[_0xec7e('0x25')]=function(_0x35f8e2,_0x3363a){if(_0x35f8e2[_0xec7e('0x4b')]['id']){delete _0x35f8e2['body']['id'];}return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0x35f8e2[_0xec7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3363a,null))[_0xec7e('0x26')](saveUpdates(_0x35f8e2[_0xec7e('0x4b')],null))[_0xec7e('0x26')](respondWithResult(_0x3363a,null))[_0xec7e('0x47')](handleError(_0x3363a,null));};exports['destroy']=function(_0x249aa6,_0xaee0a5){return db[_0xec7e('0x2e')]['find']({'where':{'id':_0x249aa6[_0xec7e('0x4c')]['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0xaee0a5,null))[_0xec7e('0x26')](removeEntity(_0xaee0a5,null))[_0xec7e('0x47')](handleError(_0xaee0a5,null));};exports['describe']=function(_0x4f6a8a,_0x4bd08d){return db[_0xec7e('0x2e')][_0xec7e('0x4d')]()['then'](respondWithResult(_0x4bd08d,null))[_0xec7e('0x47')](handleError(_0x4bd08d,null));};exports[_0xec7e('0x4e')]=function(_0x129b88,_0xdc1b0c,_0x2640ec){return db[_0xec7e('0x4f')][_0xec7e('0x1f')]({'where':{'ChatGroupId':_0x129b88[_0xec7e('0x4c')]['id'],'ToId':_0x129b88[_0xec7e('0x50')]['id'],'read':![]}})[_0xec7e('0x26')](function(_0x31fbcb){return{'id':_[_0xec7e('0x51')](_0x129b88['params']['id']),'count':_0x31fbcb};})[_0xec7e('0x26')](respondWithResult(_0xdc1b0c,null))[_0xec7e('0x47')](handleError(_0xdc1b0c,null));};exports[_0xec7e('0x52')]=function(_0xde83a3,_0x391b04,_0x2328d7){return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0xde83a3[_0xec7e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x391b04,null))[_0xec7e('0x26')](function(_0xe24e24){if(_0xe24e24){return _0xe24e24[_0xec7e('0x52')](_0xde83a3[_0xec7e('0x4b')][_0xec7e('0x53')],_[_0xec7e('0x54')](_0xde83a3[_0xec7e('0x4b')],['ids','id'])||{});}})[_0xec7e('0x26')](respondWithResult(_0x391b04,null))[_0xec7e('0x47')](handleError(_0x391b04,null));};exports['getMembers']=function(_0x137cd8,_0x2e67d3,_0x3f0103){var _0x7cbf5d={};var _0x8d83fb={};var _0x3220ab;var _0x5d293e;return db[_0xec7e('0x2e')]['findOne']({'where':{'id':_0x137cd8[_0xec7e('0x4c')]['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x2e67d3,null))[_0xec7e('0x26')](function(_0x4da5de){if(_0x4da5de){_0x3220ab=_0x4da5de;_0x8d83fb['model']=_[_0xec7e('0x33')](db[_0xec7e('0x55')][_0xec7e('0x2f')]);_0x8d83fb[_0xec7e('0x36')]=_[_0xec7e('0x33')](_0x137cd8['query']);_0x8d83fb[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x8d83fb[_0xec7e('0x32')],_0x8d83fb[_0xec7e('0x36')]);_0x7cbf5d[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x8d83fb[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x37')]));_0x7cbf5d[_0xec7e('0x38')]=_0x7cbf5d[_0xec7e('0x38')][_0xec7e('0x39')]?_0x7cbf5d[_0xec7e('0x38')]:_0x8d83fb[_0xec7e('0x32')];_0x7cbf5d[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x7cbf5d[_0xec7e('0x3e')]=qs[_0xec7e('0x34')](_[_0xec7e('0x56')](_0x137cd8[_0xec7e('0x36')],_0x8d83fb[_0xec7e('0x34')]));if(_0x137cd8[_0xec7e('0x36')][_0xec7e('0x3f')]){_0x7cbf5d[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x7cbf5d[_0xec7e('0x3e')],{'$or':_[_0xec7e('0x2d')](_0x7cbf5d['attributes'],function(_0x5e0c1c){var _0x545b05={};_0x545b05[_0x5e0c1c]={'$like':'%'+_0x137cd8[_0xec7e('0x36')]['filter']+'%'};return _0x545b05;})});}_0x7cbf5d=_['merge']({},_0x7cbf5d,_0x137cd8[_0xec7e('0x42')]);return _0x3220ab[_0xec7e('0x57')](_0x7cbf5d);}})[_0xec7e('0x26')](function(_0x43efda){if(_0x43efda){_0x5d293e=_0x43efda[_0xec7e('0x39')];if(!_0x137cd8['query'][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x7cbf5d[_0xec7e('0x1e')]=qs[_0xec7e('0x1e')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x7cbf5d[_0xec7e('0x20')]=qs[_0xec7e('0x20')](_0x137cd8[_0xec7e('0x36')][_0xec7e('0x20')]);}return _0x3220ab[_0xec7e('0x57')](_0x7cbf5d);}})[_0xec7e('0x26')](function(_0x5fd24d){if(_0x5fd24d){return _0x5fd24d?{'count':_0x5d293e,'rows':_0x5fd24d}:null;}})[_0xec7e('0x26')](respondWithResult(_0x2e67d3,null))[_0xec7e('0x47')](handleError(_0x2e67d3,null));};exports['removeMembers']=function(_0x5001e4,_0xb7139a,_0x5efaec){return db['ChatGroup'][_0xec7e('0x49')]({'where':{'id':_0x5001e4['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0xb7139a,null))[_0xec7e('0x26')](function(_0x354bfe){if(_0x354bfe){return _0x354bfe[_0xec7e('0x58')](_0x5001e4[_0xec7e('0x36')][_0xec7e('0x53')]);}})[_0xec7e('0x26')](respondWithStatusCode(_0xb7139a,null))[_0xec7e('0x47')](handleError(_0xb7139a,null));};exports[_0xec7e('0x59')]=function(_0x1dde76,_0x5995ea,_0x1cbdb4){if(_0x1dde76[_0xec7e('0x4b')]['id']){delete _0x1dde76['body']['id'];}return db[_0xec7e('0x2e')][_0xec7e('0x49')]({'where':{'id':_0x1dde76['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x5995ea,null))[_0xec7e('0x26')](function(_0x1b0cd3){if(_0x1b0cd3){_0x1dde76['body'][_0xec7e('0x5a')]=_0x1b0cd3['id'];return db['ChatInternalMessage'][_0xec7e('0x4a')](_0x1dde76[_0xec7e('0x4b')]);}})[_0xec7e('0x26')](respondWithResult(_0x5995ea,null))[_0xec7e('0x47')](handleError(_0x5995ea,null));};exports[_0xec7e('0x5b')]=function(_0x27d832,_0x3b1bdb,_0x2b73dc){var _0x1bc3ac={};var _0x2b42ff={};var _0x512f60;var _0x2e0b93;return db[_0xec7e('0x2e')][_0xec7e('0x5c')]({'where':{'id':_0x27d832['params']['id']}})[_0xec7e('0x26')](handleEntityNotFound(_0x3b1bdb,null))[_0xec7e('0x26')](function(_0x1bf2c7){if(_0x1bf2c7){_0x512f60=_0x1bf2c7;_0x2b42ff[_0xec7e('0x32')]=_[_0xec7e('0x33')](db[_0xec7e('0x4f')][_0xec7e('0x2f')]);_0x2b42ff['query']=_[_0xec7e('0x33')](_0x27d832[_0xec7e('0x36')]);_0x2b42ff[_0xec7e('0x34')]=_[_0xec7e('0x35')](_0x2b42ff['model'],_0x2b42ff['query']);_0x1bc3ac[_0xec7e('0x38')]=_[_0xec7e('0x35')](_0x2b42ff[_0xec7e('0x32')],qs[_0xec7e('0x37')](_0x27d832[_0xec7e('0x36')]['fields']));_0x1bc3ac[_0xec7e('0x38')]=_0x1bc3ac['attributes']['length']?_0x1bc3ac[_0xec7e('0x38')]:_0x2b42ff[_0xec7e('0x32')];_0x1bc3ac[_0xec7e('0x3c')]=qs[_0xec7e('0x3d')](_0x27d832[_0xec7e('0x36')][_0xec7e('0x3d')]);_0x1bc3ac['where']=qs[_0xec7e('0x34')](_[_0xec7e('0x56')](_0x27d832['query'],_0x2b42ff[_0xec7e('0x34')]));if(_0x27d832[_0xec7e('0x36')][_0xec7e('0x3f')]){_0x1bc3ac[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x1bc3ac['where'],{'$or':_[_0xec7e('0x2d')](_0x1bc3ac['attributes'],function(_0xbdadb6){var _0x2a6bfe={};_0x2a6bfe[_0xbdadb6]={'$like':'%'+_0x27d832[_0xec7e('0x36')][_0xec7e('0x3f')]+'%'};return _0x2a6bfe;})});}if(_0x27d832[_0xec7e('0x36')][_0xec7e('0x5d')]){var _0x80d46c=_0x27d832[_0xec7e('0x36')][_0xec7e('0x5d')]['split'](',');var _0x3178a0={};_0x3178a0[_0x80d46c[0x0]]={'$gte':moment(_0x80d46c[0x1])[_0xec7e('0x5e')](_0xec7e('0x5f'))};_0x1bc3ac[_0xec7e('0x3e')]=_[_0xec7e('0x41')](_0x1bc3ac[_0xec7e('0x3e')],_0x3178a0);}_0x1bc3ac=_[_0xec7e('0x41')]({},_0x1bc3ac,_0x27d832['options']);return _0x512f60[_0xec7e('0x5b')](_0x1bc3ac);}})['then'](function(_0x341bd2){if(_0x341bd2){_0x2e0b93=_0x341bd2[_0xec7e('0x39')];if(!_0x27d832[_0xec7e('0x36')][_0xec7e('0x3a')](_0xec7e('0x3b'))){_0x1bc3ac['limit']=qs['limit'](_0x27d832[_0xec7e('0x36')][_0xec7e('0x1e')]);_0x1bc3ac[_0xec7e('0x20')]=qs[_0xec7e('0x20')](_0x27d832[_0xec7e('0x36')][_0xec7e('0x20')]);}return _0x512f60[_0xec7e('0x5b')](_0x1bc3ac);}})[_0xec7e('0x26')](function(_0x263f83){if(_0x263f83){return _0x263f83?{'count':_0x2e0b93,'rows':_0x263f83}:null;}})[_0xec7e('0x26')](respondWithResult(_0x3b1bdb,null))[_0xec7e('0x47')](handleError(_0x3b1bdb,null));}; \ No newline at end of file +var _0x3fe7=['fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','rows','catch','show','params','fields','length','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3fe7,0xc4));var _0x73fe=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x3fe7[_0x2bd1ec];return _0x2f7577;};'use strict';var emlformat=require(_0x73fe('0x0'));var rimraf=require(_0x73fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x73fe('0x2'));var rp=require(_0x73fe('0x3'));var moment=require(_0x73fe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x73fe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73fe('0x6'));var ejs=require(_0x73fe('0x7'));var fs=require('fs');var fs_extra=require(_0x73fe('0x8'));var _=require(_0x73fe('0x9'));var squel=require(_0x73fe('0xa'));var crypto=require(_0x73fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x73fe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x73fe('0xd'));var Papa=require(_0x73fe('0xe'));var Redis=require(_0x73fe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x73fe('0x10'));var as=require(_0x73fe('0x11'));var hardwareService=require(_0x73fe('0x12'));var logger=require(_0x73fe('0x13'))(_0x73fe('0x14'));var utils=require(_0x73fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x73fe('0x16'));var db=require(_0x73fe('0x17'))['db'];config[_0x73fe('0x18')]=_[_0x73fe('0x19')](config[_0x73fe('0x18')],{'host':_0x73fe('0x1a'),'port':0x18eb});var socket=require(_0x73fe('0x1b'))(new Redis(config[_0x73fe('0x18')]));require(_0x73fe('0x1c'))[_0x73fe('0x1d')](socket);function respondWithStatusCode(_0x38ef91,_0x4c934f){_0x4c934f=_0x4c934f||0xcc;return function(_0x29150d){if(_0x29150d){return _0x38ef91['sendStatus'](_0x4c934f);}return _0x38ef91[_0x73fe('0x1e')](_0x4c934f)[_0x73fe('0x1f')]();};}function respondWithResult(_0x253579,_0x53fd08){_0x53fd08=_0x53fd08||0xc8;return function(_0xa7c45d){if(_0xa7c45d){return _0x253579[_0x73fe('0x1e')](_0x53fd08)[_0x73fe('0x20')](_0xa7c45d);}};}function respondWithFilteredResult(_0x3df4e4,_0x531c14){return function(_0x4fafc0){if(_0x4fafc0){var _0x361791=typeof _0x531c14[_0x73fe('0x21')]===_0x73fe('0x22')&&typeof _0x531c14[_0x73fe('0x23')]===_0x73fe('0x22');var _0x4eaa32=_0x4fafc0[_0x73fe('0x24')];var _0x388a3c=_0x361791?0x0:_0x531c14[_0x73fe('0x21')];var _0x2b437f=_0x361791?_0x4fafc0[_0x73fe('0x24')]:_0x531c14[_0x73fe('0x21')]+_0x531c14[_0x73fe('0x23')];var _0x3f6627;if(_0x2b437f>=_0x4eaa32){_0x2b437f=_0x4eaa32;_0x3f6627=0xc8;}else{_0x3f6627=0xce;}_0x3df4e4[_0x73fe('0x1e')](_0x3f6627);return _0x3df4e4[_0x73fe('0x25')](_0x73fe('0x26'),_0x388a3c+'-'+_0x2b437f+'/'+_0x4eaa32)[_0x73fe('0x20')](_0x4fafc0);}return null;};}function patchUpdates(_0x4cd3f9){return function(_0xce58be){try{jsonpatch[_0x73fe('0x27')](_0xce58be,_0x4cd3f9,!![]);}catch(_0x4ece5c){return BPromise['reject'](_0x4ece5c);}return _0xce58be[_0x73fe('0x28')]();};}function saveUpdates(_0x48d620,_0x17c200){return function(_0x5d7370){if(_0x5d7370){return _0x5d7370[_0x73fe('0x29')](_0x48d620)[_0x73fe('0x2a')](function(_0x5be41a){return _0x5be41a;});}return null;};}function removeEntity(_0x54c01a,_0x231f86){return function(_0x49f76c){if(_0x49f76c){return _0x49f76c[_0x73fe('0x2b')]()[_0x73fe('0x2a')](function(){_0x54c01a[_0x73fe('0x1e')](0xcc)[_0x73fe('0x1f')]();});}};}function handleEntityNotFound(_0xa0782d,_0x2261b3){return function(_0x51a176){if(!_0x51a176){_0xa0782d[_0x73fe('0x2c')](0x194);}return _0x51a176;};}function handleError(_0x4c4641,_0x13e46e){_0x13e46e=_0x13e46e||0x1f4;return function(_0x140f5a){logger['error'](_0x140f5a[_0x73fe('0x2d')]);if(_0x140f5a[_0x73fe('0x2e')]){delete _0x140f5a[_0x73fe('0x2e')];}_0x4c4641[_0x73fe('0x1e')](_0x13e46e)[_0x73fe('0x2f')](_0x140f5a);};}exports[_0x73fe('0x30')]=function(_0x1d4d3f,_0x132fca){var _0x589a1a={},_0x18b30c={},_0x52d85f={'count':0x0,'rows':[]};var _0x186103=_[_0x73fe('0x31')](db[_0x73fe('0x32')][_0x73fe('0x33')],function(_0x3bc81e){return{'name':_0x3bc81e[_0x73fe('0x34')],'type':_0x3bc81e[_0x73fe('0x35')][_0x73fe('0x36')]};});_0x18b30c[_0x73fe('0x37')]=_[_0x73fe('0x31')](_0x186103,_0x73fe('0x2e'));_0x18b30c[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x1d4d3f['query']);_0x18b30c['filters']=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],_0x18b30c['query']);_0x589a1a[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x18b30c[_0x73fe('0x37')],qs['fields'](_0x1d4d3f[_0x73fe('0x38')]['fields']));_0x589a1a['attributes']=_0x589a1a[_0x73fe('0x3b')]['length']?_0x589a1a[_0x73fe('0x3b')]:_0x18b30c[_0x73fe('0x37')];if(!_0x1d4d3f['query'][_0x73fe('0x3c')]('nolimit')){_0x589a1a['limit']=qs[_0x73fe('0x23')](_0x1d4d3f['query'][_0x73fe('0x23')]);_0x589a1a[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x21')]);}_0x589a1a[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x1d4d3f['query'][_0x73fe('0x3e')]);_0x589a1a[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_['pick'](_0x1d4d3f['query'],_0x18b30c[_0x73fe('0x40')]),_0x186103);if(_0x1d4d3f['query'][_0x73fe('0x41')]){_0x589a1a[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x589a1a[_0x73fe('0x3f')],{'$or':_[_0x73fe('0x31')](_0x186103,function(_0x1fa431){if(_0x1fa431['type']!==_0x73fe('0x43')){var _0x12980d={};_0x12980d[_0x1fa431[_0x73fe('0x2e')]]={'$like':'%'+_0x1d4d3f[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x12980d;}})});}_0x589a1a=_[_0x73fe('0x42')]({},_0x589a1a,_0x1d4d3f[_0x73fe('0x44')]);var _0x5f05d1={'where':_0x589a1a[_0x73fe('0x3f')]};return db[_0x73fe('0x32')][_0x73fe('0x24')](_0x5f05d1)[_0x73fe('0x2a')](function(_0x42372a){_0x52d85f[_0x73fe('0x24')]=_0x42372a;if(_0x1d4d3f[_0x73fe('0x38')]['includeAll']){_0x589a1a['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x589a1a);})[_0x73fe('0x2a')](function(_0x1c6764){_0x52d85f[_0x73fe('0x45')]=_0x1c6764;return _0x52d85f;})[_0x73fe('0x2a')](respondWithFilteredResult(_0x132fca,_0x589a1a))[_0x73fe('0x46')](handleError(_0x132fca,null));};exports[_0x73fe('0x47')]=function(_0x8cc8dc,_0x12d862){var _0x3eda7d={'raw':!![],'where':{'id':_0x8cc8dc[_0x73fe('0x48')]['id']}},_0x1ffb60={};_0x1ffb60[_0x73fe('0x37')]=_['keys'](db[_0x73fe('0x32')][_0x73fe('0x33')]);_0x1ffb60[_0x73fe('0x38')]=_['keys'](_0x8cc8dc[_0x73fe('0x38')]);_0x1ffb60[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],_0x1ffb60[_0x73fe('0x38')]);_0x3eda7d[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x1ffb60[_0x73fe('0x37')],qs['fields'](_0x8cc8dc['query'][_0x73fe('0x49')]));_0x3eda7d[_0x73fe('0x3b')]=_0x3eda7d['attributes'][_0x73fe('0x4a')]?_0x3eda7d['attributes']:_0x1ffb60[_0x73fe('0x37')];if(_0x8cc8dc[_0x73fe('0x38')][_0x73fe('0x4b')]){_0x3eda7d[_0x73fe('0x4c')]=[{'all':!![]}];}_0x3eda7d=_[_0x73fe('0x42')]({},_0x3eda7d,_0x8cc8dc[_0x73fe('0x44')]);return db['ChatGroup'][_0x73fe('0x4d')](_0x3eda7d)['then'](handleEntityNotFound(_0x12d862,null))[_0x73fe('0x2a')](respondWithResult(_0x12d862,null))[_0x73fe('0x46')](handleError(_0x12d862,null));};exports[_0x73fe('0x4e')]=function(_0x444ed7,_0x4afb9e){return db[_0x73fe('0x32')][_0x73fe('0x4e')](_0x444ed7[_0x73fe('0x4f')],{})['then'](respondWithResult(_0x4afb9e,0xc9))['catch'](handleError(_0x4afb9e,null));};exports[_0x73fe('0x29')]=function(_0x1785cb,_0xd0246d){if(_0x1785cb['body']['id']){delete _0x1785cb['body']['id'];}return db[_0x73fe('0x32')]['find']({'where':{'id':_0x1785cb[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0xd0246d,null))[_0x73fe('0x2a')](saveUpdates(_0x1785cb[_0x73fe('0x4f')],null))[_0x73fe('0x2a')](respondWithResult(_0xd0246d,null))[_0x73fe('0x46')](handleError(_0xd0246d,null));};exports['destroy']=function(_0x4462d3,_0x258acf){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x4462d3[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x258acf,null))['then'](removeEntity(_0x258acf,null))['catch'](handleError(_0x258acf,null));};exports[_0x73fe('0x50')]=function(_0x3bf0da,_0x5cda19){return db[_0x73fe('0x32')][_0x73fe('0x50')]()[_0x73fe('0x2a')](respondWithResult(_0x5cda19,null))['catch'](handleError(_0x5cda19,null));};exports[_0x73fe('0x51')]=function(_0x3bf973,_0x23e3c8,_0x2be132){return db[_0x73fe('0x52')][_0x73fe('0x24')]({'where':{'ChatGroupId':_0x3bf973['params']['id'],'ToId':_0x3bf973['user']['id'],'read':![]}})['then'](function(_0x44cf3b){return{'id':_[_0x73fe('0x53')](_0x3bf973[_0x73fe('0x48')]['id']),'count':_0x44cf3b};})[_0x73fe('0x2a')](respondWithResult(_0x23e3c8,null))[_0x73fe('0x46')](handleError(_0x23e3c8,null));};exports['addMembers']=function(_0xa63ad4,_0x5242f6,_0xcd18e9){return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0xa63ad4[_0x73fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x5242f6,null))['then'](function(_0x12174a){if(_0x12174a){return _0x12174a[_0x73fe('0x54')](_0xa63ad4[_0x73fe('0x4f')][_0x73fe('0x55')],_[_0x73fe('0x56')](_0xa63ad4[_0x73fe('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x5242f6,null))[_0x73fe('0x46')](handleError(_0x5242f6,null));};exports[_0x73fe('0x57')]=function(_0x32117c,_0x186f96,_0x5c567f){var _0x88af41={};var _0x276c93={};var _0x44b5e9;var _0x384551;return db['ChatGroup'][_0x73fe('0x58')]({'where':{'id':_0x32117c['params']['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x186f96,null))['then'](function(_0x7973b9){if(_0x7973b9){_0x44b5e9=_0x7973b9;_0x276c93['model']=_[_0x73fe('0x39')](db[_0x73fe('0x59')][_0x73fe('0x33')]);_0x276c93[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x32117c['query']);_0x276c93[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],_0x276c93[_0x73fe('0x38')]);_0x88af41['attributes']=_[_0x73fe('0x3a')](_0x276c93[_0x73fe('0x37')],qs[_0x73fe('0x49')](_0x32117c['query']['fields']));_0x88af41[_0x73fe('0x3b')]=_0x88af41[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x88af41['attributes']:_0x276c93[_0x73fe('0x37')];_0x88af41[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x32117c['query'][_0x73fe('0x3e')]);_0x88af41[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x32117c[_0x73fe('0x38')],_0x276c93['filters']));if(_0x32117c[_0x73fe('0x38')]['filter']){_0x88af41[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x88af41['where'],{'$or':_[_0x73fe('0x31')](_0x88af41[_0x73fe('0x3b')],function(_0x1f879a){var _0x1207da={};_0x1207da[_0x1f879a]={'$like':'%'+_0x32117c[_0x73fe('0x38')][_0x73fe('0x41')]+'%'};return _0x1207da;})});}_0x88af41=_[_0x73fe('0x42')]({},_0x88af41,_0x32117c[_0x73fe('0x44')]);return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x2efc61){if(_0x2efc61){_0x384551=_0x2efc61[_0x73fe('0x4a')];if(!_0x32117c['query'][_0x73fe('0x3c')]('nolimit')){_0x88af41[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x23')]);_0x88af41[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x32117c[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x44b5e9['getMembers'](_0x88af41);}})[_0x73fe('0x2a')](function(_0x27c4ef){if(_0x27c4ef){return _0x27c4ef?{'count':_0x384551,'rows':_0x27c4ef}:null;}})['then'](respondWithResult(_0x186f96,null))[_0x73fe('0x46')](handleError(_0x186f96,null));};exports[_0x73fe('0x5b')]=function(_0x30ecf7,_0x4aa862,_0x5470de){return db[_0x73fe('0x32')]['find']({'where':{'id':_0x30ecf7[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x4aa862,null))[_0x73fe('0x2a')](function(_0x530e31){if(_0x530e31){return _0x530e31[_0x73fe('0x5b')](_0x30ecf7['query'][_0x73fe('0x55')]);}})['then'](respondWithStatusCode(_0x4aa862,null))[_0x73fe('0x46')](handleError(_0x4aa862,null));};exports['addMessage']=function(_0x3ae69c,_0x15597d,_0x1e8c59){if(_0x3ae69c['body']['id']){delete _0x3ae69c[_0x73fe('0x4f')]['id'];}return db[_0x73fe('0x32')][_0x73fe('0x4d')]({'where':{'id':_0x3ae69c[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x15597d,null))[_0x73fe('0x2a')](function(_0x1debc4){if(_0x1debc4){_0x3ae69c[_0x73fe('0x4f')][_0x73fe('0x5c')]=_0x1debc4['id'];return db[_0x73fe('0x52')][_0x73fe('0x4e')](_0x3ae69c[_0x73fe('0x4f')]);}})['then'](respondWithResult(_0x15597d,null))['catch'](handleError(_0x15597d,null));};exports[_0x73fe('0x5d')]=function(_0x287eef,_0x1af16f,_0x1e1861){var _0x503167={};var _0x4b58fb={};var _0x31ee52;var _0x53183b;return db[_0x73fe('0x32')]['findOne']({'where':{'id':_0x287eef[_0x73fe('0x48')]['id']}})[_0x73fe('0x2a')](handleEntityNotFound(_0x1af16f,null))[_0x73fe('0x2a')](function(_0x2c3f69){if(_0x2c3f69){_0x31ee52=_0x2c3f69;_0x4b58fb[_0x73fe('0x37')]=_[_0x73fe('0x39')](db[_0x73fe('0x52')][_0x73fe('0x33')]);_0x4b58fb[_0x73fe('0x38')]=_[_0x73fe('0x39')](_0x287eef['query']);_0x4b58fb[_0x73fe('0x40')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],_0x4b58fb['query']);_0x503167[_0x73fe('0x3b')]=_[_0x73fe('0x3a')](_0x4b58fb['model'],qs['fields'](_0x287eef['query'][_0x73fe('0x49')]));_0x503167[_0x73fe('0x3b')]=_0x503167[_0x73fe('0x3b')][_0x73fe('0x4a')]?_0x503167[_0x73fe('0x3b')]:_0x4b58fb['model'];_0x503167[_0x73fe('0x3d')]=qs[_0x73fe('0x3e')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x3e')]);_0x503167[_0x73fe('0x3f')]=qs[_0x73fe('0x40')](_[_0x73fe('0x5a')](_0x287eef['query'],_0x4b58fb[_0x73fe('0x40')]));if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x41')]){_0x503167[_0x73fe('0x3f')]=_[_0x73fe('0x42')](_0x503167['where'],{'$or':_[_0x73fe('0x31')](_0x503167['attributes'],function(_0x460b64){var _0x37c5b8={};_0x37c5b8[_0x460b64]={'$like':'%'+_0x287eef['query'][_0x73fe('0x41')]+'%'};return _0x37c5b8;})});}if(_0x287eef[_0x73fe('0x38')][_0x73fe('0x5e')]){var _0x3c89eb=_0x287eef['query'][_0x73fe('0x5e')][_0x73fe('0x5f')](',');var _0x397a5b={};_0x397a5b[_0x3c89eb[0x0]]={'$gte':moment(_0x3c89eb[0x1])[_0x73fe('0x60')](_0x73fe('0x61'))};_0x503167['where']=_[_0x73fe('0x42')](_0x503167['where'],_0x397a5b);}_0x503167=_[_0x73fe('0x42')]({},_0x503167,_0x287eef['options']);return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})[_0x73fe('0x2a')](function(_0x451c4f){if(_0x451c4f){_0x53183b=_0x451c4f[_0x73fe('0x4a')];if(!_0x287eef['query'][_0x73fe('0x3c')](_0x73fe('0x62'))){_0x503167[_0x73fe('0x23')]=qs[_0x73fe('0x23')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x23')]);_0x503167[_0x73fe('0x21')]=qs[_0x73fe('0x21')](_0x287eef[_0x73fe('0x38')][_0x73fe('0x21')]);}return _0x31ee52[_0x73fe('0x5d')](_0x503167);}})['then'](function(_0x1146ff){if(_0x1146ff){return _0x1146ff?{'count':_0x53183b,'rows':_0x1146ff}:null;}})[_0x73fe('0x2a')](respondWithResult(_0x1af16f,null))['catch'](handleError(_0x1af16f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 4226c5b..15d71f2 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 _0x675f=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2b5f04,_0x442d05){var _0x5445ae=function(_0x316801){while(--_0x316801){_0x2b5f04['push'](_0x2b5f04['shift']());}};_0x5445ae(++_0x442d05);}(_0x675f,0x149));var _0xf675=function(_0xde6ef1,_0xcff7a1){_0xde6ef1=_0xde6ef1-0x0;var _0x2f8492=_0x675f[_0xde6ef1];return _0x2f8492;};'use strict';var EventEmitter=require(_0xf675('0x0'));var ChatGroup=require(_0xf675('0x1'))['db'][_0xf675('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf675('0x3')](0x0);var events={'afterCreate':_0xf675('0x4'),'afterUpdate':_0xf675('0x5'),'afterDestroy':_0xf675('0x6')};function emitEvent(_0x1372bb){return function(_0x251abe,_0x463d13,_0x3e5daf){ChatGroupEvents['emit'](_0x1372bb+':'+_0x251abe['id'],_0x251abe);ChatGroupEvents[_0xf675('0x7')](_0x1372bb,_0x251abe);_0x3e5daf(null);};}for(var e in events){if(events[_0xf675('0x8')](e)){var event=events[e];ChatGroup[_0xf675('0x9')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x8cad=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x3b8bde,_0x75252){var _0x17c714=function(_0x567c17){while(--_0x567c17){_0x3b8bde['push'](_0x3b8bde['shift']());}};_0x17c714(++_0x75252);}(_0x8cad,0xfe));var _0xd8ca=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8cad[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0xd8ca('0x0'));var ChatGroup=require(_0xd8ca('0x1'))['db'][_0xd8ca('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xd8ca('0x3')](0x0);var events={'afterCreate':_0xd8ca('0x4'),'afterUpdate':_0xd8ca('0x5'),'afterDestroy':_0xd8ca('0x6')};function emitEvent(_0x10c3c8){return function(_0x1334ec,_0x1e29ce,_0x388aeb){ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8+':'+_0x1334ec['id'],_0x1334ec);ChatGroupEvents[_0xd8ca('0x7')](_0x10c3c8,_0x1334ec);_0x388aeb(null);};}for(var e in events){if(events[_0xd8ca('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xd8ca('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 60f92fa..256d125 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 _0xecb6=['ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x1d758d,_0x35a5a8){var _0x3572ca=function(_0x290904){while(--_0x290904){_0x1d758d['push'](_0x1d758d['shift']());}};_0x3572ca(++_0x35a5a8);}(_0xecb6,0xdf));var _0x6ecb=function(_0x4e85bf,_0x45e7e9){_0x4e85bf=_0x4e85bf-0x0;var _0x983070=_0xecb6[_0x4e85bf];return _0x983070;};'use strict';var _=require('lodash');var util=require(_0x6ecb('0x0'));var logger=require(_0x6ecb('0x1'))(_0x6ecb('0x2'));var moment=require(_0x6ecb('0x3'));var BPromise=require(_0x6ecb('0x4'));var rp=require(_0x6ecb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ecb('0x6'));var config=require(_0x6ecb('0x7'));var attributes=require(_0x6ecb('0x8'));module[_0x6ecb('0x9')]=function(_0x4f604c,_0x3e00f6){return _0x4f604c[_0x6ecb('0xa')](_0x6ecb('0xb'),attributes,{'tableName':_0x6ecb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5bb=['../../config/logger','bluebird','request-promise','rimraf','exports','chat_groups','lodash','util'];(function(_0x3e15f4,_0x2d29a1){var _0x3bb93d=function(_0x396c8b){while(--_0x396c8b){_0x3e15f4['push'](_0x3e15f4['shift']());}};_0x3bb93d(++_0x2d29a1);}(_0xf5bb,0x6e));var _0xbf5b=function(_0x14d82f,_0x59df29){_0x14d82f=_0x14d82f-0x0;var _0x133722=_0xf5bb[_0x14d82f];return _0x133722;};'use strict';var _=require(_0xbf5b('0x0'));var util=require(_0xbf5b('0x1'));var logger=require(_0xbf5b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf5b('0x3'));var rp=require(_0xbf5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf5b('0x5'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xbf5b('0x6')]=function(_0x4322e1,_0xd9e96a){return _0x4322e1['define']('ChatGroup',attributes,{'tableName':_0xbf5b('0x7'),'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 55d6c4a..07288c9 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 _0xe953=['result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x41c24c,_0x5275ce){var _0xafb71a=function(_0x317294){while(--_0x317294){_0x41c24c['push'](_0x41c24c['shift']());}};_0xafb71a(++_0x5275ce);}(_0xe953,0x1d0));var _0x3e95=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xe953[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e95('0x0'));var db=require(_0x3e95('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e95('0x2'))('rpc');var config=require(_0x3e95('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3e95('0x4')][_0x3e95('0x5')]({'port':0x232a});config[_0x3e95('0x6')]=_[_0x3e95('0x7')](config[_0x3e95('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e95('0x8'))(new Redis(config[_0x3e95('0x6')]));require(_0x3e95('0x9'))['register'](socket);function respondWithRpcPromise(_0xf019c5,_0x12a756,_0x35ed18){return new BPromise(function(_0x459b58,_0x57c602){return client[_0x3e95('0xa')](_0xf019c5,_0x35ed18)['then'](function(_0x4719dc){logger[_0x3e95('0xb')](_0x3e95('0xc'),_0x12a756,_0x3e95('0xd'));logger[_0x3e95('0xe')](_0x3e95('0xf'),_0x12a756,'request\x20sent',JSON[_0x3e95('0x10')](_0x4719dc));if(_0x4719dc[_0x3e95('0x11')]){if(_0x4719dc['error'][_0x3e95('0x12')]===0x1f4){logger[_0x3e95('0x11')](_0x3e95('0xc'),_0x12a756,_0x4719dc[_0x3e95('0x11')]['message']);return _0x57c602(_0x4719dc[_0x3e95('0x11')][_0x3e95('0x13')]);}logger['error'](_0x3e95('0xc'),_0x12a756,_0x4719dc[_0x3e95('0x11')][_0x3e95('0x13')]);return _0x459b58(_0x4719dc[_0x3e95('0x11')]['message']);}else{logger[_0x3e95('0xb')]('ChatGroup,\x20%s,\x20%s',_0x12a756,_0x3e95('0xd'));_0x459b58(_0x4719dc[_0x3e95('0x14')]['message']);}})[_0x3e95('0x15')](function(_0x3e8b32){logger[_0x3e95('0x11')](_0x3e95('0xc'),_0x12a756,_0x3e8b32);_0x57c602(_0x3e8b32);});});} \ No newline at end of file +var _0x57d4=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./chatGroup.socket','register','request','then','info'];(function(_0x34a717,_0x2c828c){var _0x4cf768=function(_0x4db333){while(--_0x4db333){_0x34a717['push'](_0x34a717['shift']());}};_0x4cf768(++_0x2c828c);}(_0x57d4,0x78));var _0x457d=function(_0x5204b2,_0x4a531a){_0x5204b2=_0x5204b2-0x0;var _0x8b129c=_0x57d4[_0x5204b2];return _0x8b129c;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var moment=require('moment');var BPromise=require(_0x457d('0x2'));var rs=require(_0x457d('0x3'));var fs=require('fs');var Redis=require(_0x457d('0x4'));var db=require(_0x457d('0x5'))['db'];var utils=require(_0x457d('0x6'));var logger=require(_0x457d('0x7'))(_0x457d('0x8'));var config=require(_0x457d('0x9'));var jayson=require(_0x457d('0xa'));var client=jayson[_0x457d('0xb')][_0x457d('0xc')]({'port':0x232a});config['redis']=_[_0x457d('0xd')](config[_0x457d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x457d('0xe')]));require(_0x457d('0xf'))[_0x457d('0x10')](socket);function respondWithRpcPromise(_0x559024,_0x5bc628,_0x568a59){return new BPromise(function(_0x2214e6,_0x38ec93){return client[_0x457d('0x11')](_0x559024,_0x568a59)[_0x457d('0x12')](function(_0x25ae31){logger[_0x457d('0x13')](_0x457d('0x14'),_0x5bc628,_0x457d('0x15'));logger[_0x457d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5bc628,_0x457d('0x15'),JSON[_0x457d('0x17')](_0x25ae31));if(_0x25ae31['error']){if(_0x25ae31['error'][_0x457d('0x18')]===0x1f4){logger[_0x457d('0x19')](_0x457d('0x14'),_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x38ec93(_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);}logger[_0x457d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x25ae31[_0x457d('0x19')][_0x457d('0x1a')]);return _0x2214e6(_0x25ae31[_0x457d('0x19')]['message']);}else{logger['info'](_0x457d('0x14'),_0x5bc628,'request\x20sent');_0x2214e6(_0x25ae31[_0x457d('0x1b')][_0x457d('0x1a')]);}})['catch'](function(_0x2a22b6){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5bc628,_0x2a22b6);_0x38ec93(_0x2a22b6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 09c281f..1d03d43 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 _0x9916=['save','remove','update','emit','removeListener','register','./chatGroup.events'];(function(_0x16a411,_0x4af997){var _0x239801=function(_0x2036b9){while(--_0x2036b9){_0x16a411['push'](_0x16a411['shift']());}};_0x239801(++_0x4af997);}(_0x9916,0x172));var _0x6991=function(_0x2ee522,_0x21b1ea){_0x2ee522=_0x2ee522-0x0;var _0x1f0028=_0x9916[_0x2ee522];return _0x1f0028;};'use strict';var ChatGroupEvents=require(_0x6991('0x0'));var events=[_0x6991('0x1'),_0x6991('0x2'),_0x6991('0x3')];function createListener(_0x3e5406,_0x1c6c65){return function(_0x1bbca5){_0x1c6c65[_0x6991('0x4')](_0x3e5406,_0x1bbca5);};}function removeListener(_0x5d51e6,_0x1846b4){return function(){ChatGroupEvents[_0x6991('0x5')](_0x5d51e6,_0x1846b4);};}exports[_0x6991('0x6')]=function(_0x1c8926){for(var _0x33d97b=0x0,_0x1684e8=events['length'];_0x33d97b<_0x1684e8;_0x33d97b++){var _0xbeabda=events[_0x33d97b];var _0x24f5b0=createListener('chatGroup:'+_0xbeabda,_0x1c8926);ChatGroupEvents['on'](_0xbeabda,_0x24f5b0);}}; \ No newline at end of file +var _0x19dd=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','update'];(function(_0x4ca4ba,_0x155385){var _0x1cf44d=function(_0x25f438){while(--_0x25f438){_0x4ca4ba['push'](_0x4ca4ba['shift']());}};_0x1cf44d(++_0x155385);}(_0x19dd,0xed));var _0xd19d=function(_0x4c108a,_0x446e7d){_0x4c108a=_0x4c108a-0x0;var _0x402892=_0x19dd[_0x4c108a];return _0x402892;};'use strict';var ChatGroupEvents=require(_0xd19d('0x0'));var events=[_0xd19d('0x1'),'remove',_0xd19d('0x2')];function createListener(_0xb4920c,_0x2c0c9f){return function(_0x1d6ecd){_0x2c0c9f[_0xd19d('0x3')](_0xb4920c,_0x1d6ecd);};}function removeListener(_0x255f24,_0x17767b){return function(){ChatGroupEvents[_0xd19d('0x4')](_0x255f24,_0x17767b);};}exports[_0xd19d('0x5')]=function(_0x49c6f1){for(var _0x528600=0x0,_0x16d31c=events[_0xd19d('0x6')];_0x528600<_0x16d31c;_0x528600++){var _0x4a8c63=events[_0x528600];var _0x47ad98=createListener(_0xd19d('0x7')+_0x4a8c63,_0x49c6f1);ChatGroupEvents['on'](_0x4a8c63,_0x47ad98);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 32ab1ef..18a9199 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 _0x2213=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','removeMembers','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x2213,0x1e0));var _0x3221=function(_0x5840c5,_0x2024ce){_0x5840c5=_0x5840c5-0x0;var _0x5d0e6a=_0x2213[_0x5840c5];return _0x5d0e6a;};'use strict';var multer=require('multer');var util=require(_0x3221('0x0'));var path=require(_0x3221('0x1'));var timeout=require(_0x3221('0x2'));var express=require('express');var router=express[_0x3221('0x3')]();var fs_extra=require(_0x3221('0x4'));var auth=require(_0x3221('0x5'));var interaction=require(_0x3221('0x6'));var config=require(_0x3221('0x7'));var controller=require('./chatGroup.controller');router[_0x3221('0x8')]('/',auth[_0x3221('0x9')](),controller[_0x3221('0xa')]);router['get'](_0x3221('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3221('0xc'),auth[_0x3221('0x9')](),controller['show']);router[_0x3221('0x8')](_0x3221('0xd'),auth[_0x3221('0x9')](),controller[_0x3221('0xe')]);router[_0x3221('0x8')](_0x3221('0xf'),auth[_0x3221('0x9')](),controller['getMembers']);router[_0x3221('0x8')](_0x3221('0x10'),auth[_0x3221('0x9')](),controller[_0x3221('0x11')]);router[_0x3221('0x12')]('/',auth[_0x3221('0x9')](),controller[_0x3221('0x13')]);router['post']('/:id/members',auth[_0x3221('0x9')](),controller[_0x3221('0x14')]);router[_0x3221('0x12')](_0x3221('0x10'),auth[_0x3221('0x9')](),controller[_0x3221('0x15')]);router[_0x3221('0x16')](_0x3221('0xc'),auth[_0x3221('0x9')](),controller[_0x3221('0x17')]);router[_0x3221('0x18')](_0x3221('0xc'),auth[_0x3221('0x9')](),controller['destroy']);router['delete']('/:id/members',auth[_0x3221('0x9')](),controller[_0x3221('0x19')]);module[_0x3221('0x1a')]=router; \ No newline at end of file +var _0x5a23=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','destroy','exports','multer'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5a23,0xdf));var _0x35a2=function(_0x1eb25d,_0x65835a){_0x1eb25d=_0x1eb25d-0x0;var _0x22348c=_0x5a23[_0x1eb25d];return _0x22348c;};'use strict';var multer=require(_0x35a2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35a2('0x1'));var router=express[_0x35a2('0x2')]();var fs_extra=require(_0x35a2('0x3'));var auth=require(_0x35a2('0x4'));var interaction=require(_0x35a2('0x5'));var config=require('../../config/environment');var controller=require(_0x35a2('0x6'));router[_0x35a2('0x7')]('/',auth[_0x35a2('0x8')](),controller[_0x35a2('0x9')]);router[_0x35a2('0x7')](_0x35a2('0xa'),auth[_0x35a2('0x8')](),controller['describe']);router[_0x35a2('0x7')](_0x35a2('0xb'),auth['isAuthenticated'](),controller[_0x35a2('0xc')]);router[_0x35a2('0x7')](_0x35a2('0xd'),auth['isAuthenticated'](),controller[_0x35a2('0xe')]);router[_0x35a2('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x35a2('0xf')]);router[_0x35a2('0x7')](_0x35a2('0x10'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x11')]);router[_0x35a2('0x12')]('/',auth['isAuthenticated'](),controller[_0x35a2('0x13')]);router[_0x35a2('0x12')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x15')]);router[_0x35a2('0x12')](_0x35a2('0x10'),auth['isAuthenticated'](),controller[_0x35a2('0x16')]);router[_0x35a2('0x17')]('/:id',auth[_0x35a2('0x8')](),controller[_0x35a2('0x18')]);router[_0x35a2('0x19')](_0x35a2('0xb'),auth[_0x35a2('0x8')](),controller[_0x35a2('0x1a')]);router[_0x35a2('0x19')](_0x35a2('0x14'),auth[_0x35a2('0x8')](),controller['removeMembers']);module[_0x35a2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 9acdd8e..db3ad88 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 _0x38d0=['DATE','STRING','ENUM','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0x8ce9e8,_0x967453){var _0x2acf86=function(_0x32a3c9){while(--_0x32a3c9){_0x8ce9e8['push'](_0x8ce9e8['shift']());}};_0x2acf86(++_0x967453);}(_0x38d0,0x123));var _0x038d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x38d0[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require('sequelize');module[_0x038d('0x0')]={'closed':{'type':Sequelize[_0x038d('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x038d('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x038d('0x3'),_0x038d('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x038d('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x038d('0x6')]},'disposition':{'type':Sequelize[_0x038d('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x038d('0x7')]},'note':{'type':Sequelize[_0x038d('0x7')]},'browserName':{'type':Sequelize[_0x038d('0x7')]},'browserVersion':{'type':Sequelize[_0x038d('0x7')]},'osName':{'type':Sequelize[_0x038d('0x7')]},'osVersion':{'type':Sequelize[_0x038d('0x7')]},'deviceModel':{'type':Sequelize[_0x038d('0x7')]},'deviceVendor':{'type':Sequelize[_0x038d('0x7')]},'deviceType':{'type':Sequelize[_0x038d('0x7')]},'referer':{'type':Sequelize[_0x038d('0x5')]},'customerIp':{'type':Sequelize[_0x038d('0x7')]},'formData':{'type':Sequelize[_0x038d('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x038d('0x6')]},'lastMsgAt':{'type':Sequelize[_0x038d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x038d('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x038d('0x7')]},'customerPort':{'type':Sequelize[_0x038d('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x038d('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x038d('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xe511=['DATE','long','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT','STRING'];(function(_0x275c8f,_0x316886){var _0x47519b=function(_0x576942){while(--_0x576942){_0x275c8f['push'](_0x275c8f['shift']());}};_0x47519b(++_0x316886);}(_0xe511,0x16f));var _0x1e51=function(_0x2a99f1,_0x198fd7){_0x2a99f1=_0x2a99f1-0x0;var _0x6948e5=_0xe511[_0x2a99f1];return _0x6948e5;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1e51('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x1e51('0x3'),_0x1e51('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1e51('0x5')]},'pathTranscript':{'type':Sequelize[_0x1e51('0x5')]},'mailTranscript':{'type':Sequelize[_0x1e51('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1e51('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1e51('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1e51('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x1e51('0x6')]},'osName':{'type':Sequelize[_0x1e51('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1e51('0x6')]},'deviceType':{'type':Sequelize[_0x1e51('0x6')]},'referer':{'type':Sequelize[_0x1e51('0x5')]},'customerIp':{'type':Sequelize[_0x1e51('0x6')]},'formData':{'type':Sequelize[_0x1e51('0x5')](_0x1e51('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1e51('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1e51('0x9')]('in',_0x1e51('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1e51('0x6')]},'customerPort':{'type':Sequelize[_0x1e51('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1e51('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f61524b..fe09c43 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 _0xd2ea=['Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','filter','$gte','findAll','getMyMessages','include','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','server','tmp','files','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','destroy','name','send','render','merge','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','total','closed','UserId','disposition','abandoned','answered','index','ChatInteraction','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','rawAttributes','intersection','options','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut'];(function(_0x3d474,_0x5f50f7){var _0xca0cca=function(_0x195368){while(--_0x195368){_0x3d474['push'](_0x3d474['shift']());}};_0xca0cca(++_0x5f50f7);}(_0xd2ea,0x15f));var _0xad2e=function(_0xd18bb,_0x4dfdb9){_0xd18bb=_0xd18bb-0x0;var _0x5e9922=_0xd2ea[_0xd18bb];return _0x5e9922;};'use strict';var rimraf=require(_0xad2e('0x0'));var zipdir=require(_0xad2e('0x1'));var rp=require(_0xad2e('0x2'));var moment=require(_0xad2e('0x3'));var BPromise=require(_0xad2e('0x4'));var Mustache=require('mustache');var util=require(_0xad2e('0x5'));var path=require(_0xad2e('0x6'));var ejs=require(_0xad2e('0x7'));var fs=require('fs');var _=require(_0xad2e('0x8'));var squel=require(_0xad2e('0x9'));var Redis=require(_0xad2e('0xa'));var qs=require(_0xad2e('0xb'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xad2e('0xc'));var logger=require(_0xad2e('0xd'))(_0xad2e('0xe'));var config=require('../../config/environment');var db=require(_0xad2e('0xf'))['db'];config[_0xad2e('0x10')]=_['defaults'](config[_0xad2e('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0x11'))(new Redis(config[_0xad2e('0x10')]));require(_0xad2e('0x12'))[_0xad2e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xad2e('0x14')]['http']({'port':0x232b});var client9004=jayson[_0xad2e('0x14')][_0xad2e('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x433696,_0x42e2f2,_0x59a342,_0x27fb5a){return new BPromise(function(_0x59201f,_0x1a91ce){var _0x5772f0=_0x27fb5a||client;return _0x5772f0['request'](_0x433696,_0x59a342)['then'](function(_0x5c96a7){logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));logger[_0xad2e('0x19')](_0xad2e('0x1a'),_0x42e2f2,_0xad2e('0x18'),JSON[_0xad2e('0x1b')](_0x5c96a7));if(_0x5c96a7[_0xad2e('0x1c')]){if(_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1d')]===0x1f4){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7[_0xad2e('0x1c')][_0xad2e('0x1e')]);return _0x1a91ce(_0x5c96a7[_0xad2e('0x1c')]['message']);}logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x5c96a7['error']['message']);return _0x59201f(_0x5c96a7['error']['message']);}else{logger[_0xad2e('0x16')](_0xad2e('0x17'),_0x42e2f2,_0xad2e('0x18'));_0x59201f(_0x5c96a7[_0xad2e('0x1f')][_0xad2e('0x1e')]);}})[_0xad2e('0x20')](function(_0x29dc4f){logger[_0xad2e('0x1c')](_0xad2e('0x17'),_0x42e2f2,_0x29dc4f);_0x1a91ce(_0x29dc4f);});});}function respondWithStatusCode(_0x154d54,_0x40e1e4){_0x40e1e4=_0x40e1e4||0xcc;return function(_0x142631){if(_0x142631){return _0x154d54[_0xad2e('0x21')](_0x40e1e4);}return _0x154d54[_0xad2e('0x22')](_0x40e1e4)[_0xad2e('0x23')]();};}function respondWithResult(_0x2e1c95,_0x59630b){_0x59630b=_0x59630b||0xc8;return function(_0x2e727c){if(_0x2e727c){return _0x2e1c95[_0xad2e('0x22')](_0x59630b)[_0xad2e('0x24')](_0x2e727c);}};}function respondWithFilteredResult(_0x350c66,_0x2f9370){return function(_0x58acc8){if(_0x58acc8){var _0x1161d5=typeof _0x2f9370[_0xad2e('0x25')]===_0xad2e('0x26')&&typeof _0x2f9370['limit']===_0xad2e('0x26');var _0x5d675f=_0x58acc8[_0xad2e('0x27')];var _0x28ef72=_0x1161d5?0x0:_0x2f9370[_0xad2e('0x25')];var _0x11bfa9=_0x1161d5?_0x58acc8[_0xad2e('0x27')]:_0x2f9370[_0xad2e('0x25')]+_0x2f9370[_0xad2e('0x28')];var _0x454c04;if(_0x11bfa9>=_0x5d675f){_0x11bfa9=_0x5d675f;_0x454c04=0xc8;}else{_0x454c04=0xce;}_0x350c66[_0xad2e('0x22')](_0x454c04);return _0x350c66[_0xad2e('0x29')]('Content-Range',_0x28ef72+'-'+_0x11bfa9+'/'+_0x5d675f)[_0xad2e('0x24')](_0x58acc8);}return null;};}function saveUpdates(_0xfd2087){return function(_0x2a0dc7){if(_0x2a0dc7){return _0x2a0dc7[_0xad2e('0x2a')](_0xfd2087)[_0xad2e('0x2b')](function(_0x9b4a23){return _0x9b4a23;});}return null;};}function removeEntity(_0x409f58){return function(_0x3e3d86){if(_0x3e3d86){return _0x3e3d86[_0xad2e('0x2c')]()[_0xad2e('0x2b')](function(){_0x409f58[_0xad2e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3099fd){return function(_0x55e1dc){if(!_0x55e1dc){_0x3099fd[_0xad2e('0x21')](0x194);}return _0x55e1dc;};}function handleError(_0x3a6419,_0x5ac436){_0x5ac436=_0x5ac436||0x1f4;return function(_0x19d0fa){logger[_0xad2e('0x1c')](_0x19d0fa['stack']);if(_0x19d0fa[_0xad2e('0x2d')]){delete _0x19d0fa[_0xad2e('0x2d')];}_0x3a6419['status'](_0x5ac436)[_0xad2e('0x2e')](_0x19d0fa);};}function getMustacheRender(_0x100b35,_0x569b9c){return Mustache[_0xad2e('0x2f')](_0x100b35,_[_0xad2e('0x30')](_0x569b9c[_0xad2e('0x31')],{'contact':_0x569b9c[_0xad2e('0x32')],'message':_0x569b9c[_0xad2e('0x1e')],'agent':_0x569b9c[_0xad2e('0x33')],'interaction':_0x569b9c[_0xad2e('0x34')],'account':_0x569b9c['account']}))||'';}function getInteractionUsers(_0x41a022,_0x5b4386){return new BPromise(function(_0x49db79,_0x161402){try{if(_0x5b4386[_0x41a022['id']]){_0x41a022[_0xad2e('0x35')]=_[_0xad2e('0x36')](_0x5b4386[_0x41a022['id']],function(_0x14d8d6){return{'id':_0x14d8d6['id'],'fullname':_0x14d8d6[_0xad2e('0x37')]};});}}catch(_0xf4ae70){_0x161402(_0xf4ae70);}_0x49db79(_0x41a022);});}function getInteractionTags(_0x4fe4f6,_0x5d6ac1){return new BPromise(function(_0x924f10,_0x4b53d6){try{if(_0x4fe4f6[_0xad2e('0x38')]){_0x4fe4f6[_0xad2e('0x39')]=[];_0x4fe4f6[_0xad2e('0x38')][_0xad2e('0x3a')](',')[_0xad2e('0x3b')](function(_0x5d55f9){_0x4fe4f6[_0xad2e('0x39')][_0xad2e('0x3c')](_0x5d6ac1[_0x5d55f9]);});}delete _0x4fe4f6['TagIds'];}catch(_0x596eee){_0x4b53d6(_0x596eee);}_0x924f10(_0x4fe4f6);});}function updateChatInteraction(_0x5ba338,_0x274fd8,_0x54dac3){return new BPromise(function(_0x5f29a5,_0x2d0018){return getInteractionUsers(_0x5ba338,_0x54dac3)[_0xad2e('0x2b')](function(_0x271a49){return getInteractionTags(_0x271a49,_0x274fd8);})[_0xad2e('0x2b')](function(_0x6f4fbc){return getStateInteraction(_0x6f4fbc);})[_0xad2e('0x2b')](function(_0x382665){_0x5f29a5(_0x382665);})['catch'](function(_0xec9e1a){_0x2d0018(_0xec9e1a);});});}function getStateInteraction(_0x341f51){return new BPromise(function(_0x46684d){_0x341f51[_0xad2e('0x3d')]=0x0;_0x341f51[_0xad2e('0x3e')]=0x0;_0x341f51['answered']=0x0;_0x341f51[_0xad2e('0x3f')]=0x0;_0x341f51['abandoned']=0x0;_0x341f51[_0xad2e('0x40')]=0x0;if(!_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3d')]+=0x1;}if(!_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x3e')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x43')]===_0xad2e('0x44')){_0x341f51[_0xad2e('0x44')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51[_0xad2e('0x3d')]-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&!_0x341f51[_0xad2e('0x42')]&&_0x341f51[_0xad2e('0x43')]){_0x341f51[_0xad2e('0x3f')]+=0x1;if(_0x341f51[_0xad2e('0x3d')]){_0x341f51['waiting']-=0x1;}}else if(_0x341f51[_0xad2e('0x41')]&&_0x341f51[_0xad2e('0x42')]){_0x341f51[_0xad2e('0x45')]+=0x1;if(_0x341f51[_0xad2e('0x3e')]){_0x341f51[_0xad2e('0x3e')]-=0x1;}}_0x341f51[_0xad2e('0x40')]+=0x1;_0x46684d(_0x341f51);});}exports[_0xad2e('0x46')]=function(_0x4c99ec,_0x15e253){var _0x579a26={},_0x1f2f49={},_0x2ad66e={'count':0x0,'rows':[]};var _0x36b103=_[_0xad2e('0x36')](db[_0xad2e('0x47')]['rawAttributes'],function(_0xf80dd8){return{'name':_0xf80dd8[_0xad2e('0x48')],'type':_0xf80dd8[_0xad2e('0x49')][_0xad2e('0x4a')]};});_0x1f2f49[_0xad2e('0x4b')]=_['map'](_0x36b103,_0xad2e('0x2d'));_0x1f2f49[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x4c99ec[_0xad2e('0x4c')]);_0x1f2f49['filters']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],_0x1f2f49[_0xad2e('0x4c')]);_0x579a26['attributes']=_['intersection'](_0x1f2f49[_0xad2e('0x4b')],qs['fields'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x579a26['attributes']=_0x579a26[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x579a26[_0xad2e('0x4f')]:_0x1f2f49[_0xad2e('0x4b')];if(!_0x4c99ec['query']['hasOwnProperty'](_0xad2e('0x51'))){_0x579a26[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x579a26[_0xad2e('0x25')]=qs[_0xad2e('0x25')](_0x4c99ec[_0xad2e('0x4c')]['offset']);}_0x579a26[_0xad2e('0x52')]=qs['sort'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x579a26[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x4c99ec[_0xad2e('0x4c')],_0x1f2f49[_0xad2e('0x55')]),_0x36b103);var _0x4aeb4a=[];var _0x411956=squel['select']()[_0xad2e('0x57')]('id')[_0xad2e('0x57')](_0xad2e('0x2d'))[_0xad2e('0x57')]('color')[_0xad2e('0x58')](_0xad2e('0x59'));var _0x56e633=squel[_0xad2e('0x5a')]()['field'](_0xad2e('0x5b'))[_0xad2e('0x57')](_0xad2e('0x5c'))[_0xad2e('0x57')](_0xad2e('0x5d'))[_0xad2e('0x58')](_0xad2e('0x5e'),'ui')[_0xad2e('0x5f')](_0xad2e('0x60'),'u','u.id\x20=\x20ui.UserId');var _0xe2d4ac=squel[_0xad2e('0x5a')]()[_0xad2e('0x58')](_0xad2e('0x61'),'i')['left_join']('cm_contacts','c',_0xad2e('0x62'))[_0xad2e('0x5f')](_0xad2e('0x60'),'o',_0xad2e('0x63'))[_0xad2e('0x5f')](_0xad2e('0x64'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xad2e('0x5f')](_0xad2e('0x65'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xad2e('0x5f')](_0xad2e('0x66'),'it',_0xad2e('0x67'))[_0xad2e('0x5f')](_0xad2e('0x59'),'t',_0xad2e('0x68'));var _0x1ce266=squel[_0xad2e('0x69')]();var _0x745c47=[];var _0x124eaf=squel['expr']();var _0x583c12;if(_0x4c99ec[_0xad2e('0x4c')]['search']){_0x583c12=as['parseSearch'](_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x6a')]);var _0x3bfa74=_0x583c12['sqlOperator'];for(var _0x114ed5=0x0;_0x114ed5<_0x583c12[_0xad2e('0x6b')][_0xad2e('0x50')];_0x114ed5++){var _0x470bda=_0x583c12[_0xad2e('0x6b')][_0x114ed5];var _0x5d538c='i';var _0x22554f=_['find'](_0x36b103,['name',_0x470bda['field']]);if(!_0x22554f){switch(_0x470bda['field']){case _0xad2e('0x6c'):if(_0x470bda[_0xad2e('0x6d')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x6f'));}else{_0xe2d4ac[_0xad2e('0x6e')]('`'+_0x470bda[_0xad2e('0x57')]+_0xad2e('0x70'));}break;case _0xad2e('0x71'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){if(_0x470bda['value'][_0xad2e('0x3a')]('\x20')[_0xad2e('0x50')]>0x1){_0x1ce266[_0x3bfa74]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x470bda[_0xad2e('0x6d')]),null);}else{var _0x49a7d9='%'+_0x470bda[_0xad2e('0x6d')]+'%';_0x1ce266[_0x3bfa74](_0xad2e('0x74'),_0x49a7d9,_0x49a7d9,_0x49a7d9);}}else{_0x22554f=_[_0xad2e('0x75')](_0x36b103,[_0xad2e('0x2d'),_0xad2e('0x76')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x76');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e['value']['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case'Tag':var _0x33846a=_0x470bda[_0xad2e('0x6d')][_0xad2e('0x3a')](',')['map'](function(_0x1e5f05){return Number(_0x1e5f05);});_0x33846a['forEach'](function(_0x1469a2){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1469a2+',%');});_0x745c47=_[_0xad2e('0x79')](_0x745c47,_0x33846a);break;case _0xad2e('0x7a'):if(_0x470bda[_0xad2e('0x72')]===_0xad2e('0x73')){_0x1ce266[_0x3bfa74](_0xad2e('0x7b'),'%'+_0x470bda[_0xad2e('0x6d')]+'%',null);}else{_0x22554f=_['find'](_0x36b103,['name',_0xad2e('0x42')]);_0x470bda[_0xad2e('0x57')]=_0xad2e('0x42');_0x46bf5e=as[_0xad2e('0x77')](_0x5d538c,_0x22554f['type'],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}break;case _0xad2e('0x31'):_0x46bf5e=as[_0xad2e('0x77')]('me',null,_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')]['start'],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);break;}}else{var _0x46bf5e=as['buildExpression'](_0x5d538c,_0x22554f[_0xad2e('0x49')],_0x470bda);_0x1ce266[_0x3bfa74](_0x46bf5e[_0xad2e('0x78')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x7c')],_0x46bf5e[_0xad2e('0x6d')][_0xad2e('0x23')]);}}}else{var _0x4cf84e=_(_0x4c99ec['query'])['keys']()['map'](function(_0xa426c8){return _[_0xad2e('0x7d')](_0x36b103,['name',_0xa426c8])?_0xa426c8:undefined;})[_0xad2e('0x7e')]()[_0xad2e('0x6d')]();if(!_[_0xad2e('0x7f')](_0x4cf84e)){_0x4cf84e[_0xad2e('0x3b')](function(_0x13491c){if(_0x13491c===_0xad2e('0x80')){_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),[]['concat'](_0x4c99ec['query'][_0x13491c]));}else if(_0x13491c==='createdAt'){var _0x4eb716=JSON['parse'](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$gte'];var _0x3bdc76=JSON[_0xad2e('0x82')](_0x4c99ec[_0xad2e('0x4c')][_0x13491c])['$lte'];_0xe2d4ac['where'](_0xad2e('0x83'),_0x4eb716,_0x3bdc76);}else{if(_0x4c99ec['query'][_0x13491c]==='null'){_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x84'));}else{_0xe2d4ac[_0xad2e('0x54')]('i.'+_0x13491c+_0xad2e('0x85'),_0x4c99ec[_0xad2e('0x4c')][_0x13491c]);}}});}if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x86')]==0x1){_0xe2d4ac[_0xad2e('0x6e')]('`unreadMessages`\x20=\x200');}else{_0xe2d4ac['having'](_0xad2e('0x87'));}}if(_0x4c99ec[_0xad2e('0x4c')]['tag']){_0x745c47=_[_0xad2e('0x88')](_0x4c99ec[_0xad2e('0x4c')]['tag'])?_0x4c99ec['query'][_0xad2e('0x89')]:new Array(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x89')]);_0x745c47[_0xad2e('0x3b')](function(_0x11421f){_0x124eaf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x11421f+',%');});}if(_0x4c99ec[_0xad2e('0x4c')]['filter']){var _0x76b71a=_0x4c99ec[_0xad2e('0x4c')]['filter'][_0xad2e('0x8a')]('\x5c','\x5c\x5c')[_0xad2e('0x8a')](/'/g,'\x27\x27');if(qs[_0xad2e('0x8b')](_0x76b71a)){_0x1ce266['or']('i.id\x20LIKE\x20?',_0x76b71a+'%');}else{_0x1ce266['or'](_0xad2e('0x8c'),qs[_0xad2e('0x8d')](_0x76b71a))['or'](_0xad2e('0x8e'),_0x76b71a+'%');}}}_0xe2d4ac[_0xad2e('0x54')](_0x1ce266);_0xe2d4ac[_0xad2e('0x8f')]('i.id');var _0x2ea2d8={'type':db['Sequelize'][_0xad2e('0x90')][_0xad2e('0x91')],'raw':!![]};var _0x10672d=_0xe2d4ac[_0xad2e('0x92')]();_0x10672d[_0xad2e('0x57')](_0xad2e('0x93'));_0x10672d[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));if(_0x579a26[_0xad2e('0x52')]){_0x579a26[_0xad2e('0x52')][_0xad2e('0x3b')](function(_0x4a7a2e){var _0x1f2c13=_0x4a7a2e[0x0]===_0xad2e('0x95')?_0x4a7a2e[0x0]:'i.'+_0x4a7a2e[0x0];_0xe2d4ac[_0xad2e('0x52')](_0x1f2c13,_0x4a7a2e[0x1]===_0xad2e('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x745c47)){_0xe2d4ac[_0xad2e('0x6e')](_0x124eaf);_0x10672d[_0xad2e('0x54')](_0xad2e('0x97'),_0x745c47);}BPromise[_0xad2e('0x98')]()['then'](function(){if(!_0x583c12){if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return;_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x99'));return;}if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]!=='agent')return;return _0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9c')]({'attributes':['id'],'raw':!![]})[_0xad2e('0x2b')](function(_0xc55f6a){if(_[_0xad2e('0x7f')](_0xc55f6a)){_0x10672d[_0xad2e('0x54')](_0xad2e('0x9d'));_0xe2d4ac[_0xad2e('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x10672d[_0xad2e('0x54')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0xc55f6a,'id'));_0xe2d4ac[_0xad2e('0x54')](_0xad2e('0x81'),_[_0xad2e('0x36')](_0xc55f6a,'id'));}});})[_0xad2e('0x2b')](function(){if(_0x4c99ec[_0xad2e('0x9a')][_0xad2e('0x9b')]===_0xad2e('0x33')&&!_0x583c12&&!_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x80')])return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x10672d[_0xad2e('0x9f')](),_0x2ea2d8);})['then'](function(_0x2f029b){_0x2ad66e[_0xad2e('0x27')]=_0x2f029b[_0xad2e('0x50')];if(_0x2ad66e[_0xad2e('0x27')]===0x0)return[];return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x411956[_0xad2e('0x9f')](),_0x2ea2d8)[_0xad2e('0x2b')](function(_0x35d060){_0x4aeb4a=_[_0xad2e('0xa0')](_0x35d060,'id');_0x2ea2d8=_['merge'](_0x2ea2d8,{'model':db[_0xad2e('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c99ec[_0xad2e('0x4c')][_0xad2e('0x4e')]){_0x579a26[_0xad2e('0x4f')]['forEach'](function(_0x3c95ac){_0xe2d4ac['field']('i.'+_0x3c95ac);});}else{_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0x94'),_0xad2e('0x6c'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa1'),_0xad2e('0xa2'));_0xe2d4ac[_0xad2e('0x57')]('a.mandatoryDisposition',_0xad2e('0xa3'));_0xe2d4ac[_0xad2e('0x57')]('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','contactName');_0xe2d4ac[_0xad2e('0x57')]('i.*');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa4'),'Contact.firstName');_0xe2d4ac['field'](_0xad2e('0xa5'),'Contact.lastName');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa6'),'Contact.email');_0xe2d4ac[_0xad2e('0x57')]('c.phone',_0xad2e('0xa7'));_0xe2d4ac[_0xad2e('0x57')]('c.mobile','Contact.mobile');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa8'),'Contact.fax');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xa9'),'Owner.fullname');_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xaa'),_0xad2e('0xab'));_0xe2d4ac[_0xad2e('0x57')](_0xad2e('0xac'),'TagIds');}if(_0x579a26[_0xad2e('0x28')])_0xe2d4ac[_0xad2e('0x28')](_0x579a26[_0xad2e('0x28')]);if(_0x579a26[_0xad2e('0x25')])_0xe2d4ac['offset'](_0x579a26[_0xad2e('0x25')]);return db['sequelize'][_0xad2e('0x4c')](_0xe2d4ac['toString'](),_0x2ea2d8);})[_0xad2e('0x2b')](function(_0x3692ec){if(_0x3692ec[_0xad2e('0x50')]>0x0)_0x56e633[_0xad2e('0x54')]('ui.ChatInteractionId\x20IN\x20?',_[_0xad2e('0x36')](_0x3692ec,'id'));return db[_0xad2e('0x9e')][_0xad2e('0x4c')](_0x56e633[_0xad2e('0x9f')](),_0x2ea2d8)['then'](function(_0x6a83f7){var _0x23f261=_[_0xad2e('0xad')](_0x6a83f7,'ChatInteractionId');var _0x45c0f6=[];_0x3692ec[_0xad2e('0x3b')](function(_0x10337a){_0x45c0f6['push'](updateChatInteraction(_0x10337a,_0x4aeb4a,_0x23f261));});return BPromise[_0xad2e('0xae')](_0x45c0f6);});});})[_0xad2e('0x2b')](function(_0x44708f){_0x2ad66e[_0xad2e('0xaf')]=_0x44708f;return _0x2ad66e;})[_0xad2e('0x2b')](respondWithFilteredResult(_0x15e253,_0x579a26))[_0xad2e('0x20')](handleError(_0x15e253,null));};exports['show']=function(_0x519618,_0x3f6971){var _0x114ff1={'raw':![],'where':{'id':_0x519618['params']['id']}},_0x495392={};_0x495392[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0x47')][_0xad2e('0xb0')]);_0x495392[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x519618['query']);_0x495392['filters']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],_0x495392[_0xad2e('0x4c')]);_0x114ff1['attributes']=_[_0xad2e('0xb1')](_0x495392[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x519618['query'][_0xad2e('0x4e')]));_0x114ff1['attributes']=_0x114ff1[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x114ff1[_0xad2e('0x4f')]:_0x495392[_0xad2e('0x4b')];if(_0x519618[_0xad2e('0x4c')]['includeAll']){_0x114ff1['include']=[{'all':!![]}];}_0x114ff1=_['merge']({},_0x114ff1,_0x519618[_0xad2e('0xb2')]);return db[_0xad2e('0x47')][_0xad2e('0x75')](_0x114ff1)[_0xad2e('0x2b')](handleEntityNotFound(_0x3f6971,null))['then'](respondWithResult(_0x3f6971,null))[_0xad2e('0x20')](handleError(_0x3f6971,null));};exports[_0xad2e('0xb3')]=function(_0x413235,_0x4c5051){return db[_0xad2e('0x47')]['create'](_0x413235[_0xad2e('0x31')],{})[_0xad2e('0x2b')](respondWithResult(_0x4c5051,0xc9))[_0xad2e('0x20')](handleError(_0x4c5051,null));};exports[_0xad2e('0x2a')]=function(_0x284cd4,_0x1f49ee){if(_0x284cd4[_0xad2e('0x31')]['id']){delete _0x284cd4[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x284cd4[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f49ee,null))[_0xad2e('0x2b')](saveUpdates(_0x284cd4[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f49ee,null))[_0xad2e('0x20')](handleError(_0x1f49ee,null));};exports['destroy']=function(_0x2d358a,_0x39f3d7){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x2d358a['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x39f3d7,null))[_0xad2e('0x2b')](removeEntity(_0x39f3d7,null))[_0xad2e('0x20')](handleError(_0x39f3d7,null));};exports['describe']=function(_0x5345fe,_0x40dd77){return db['ChatInteraction'][_0xad2e('0xb5')]()[_0xad2e('0x2b')](respondWithResult(_0x40dd77,null))['catch'](handleError(_0x40dd77,null));};exports[_0xad2e('0xb6')]=function(_0x271306,_0x34685b){var _0x3a447a=_0x271306['params']['id'];var _0x574f67;var _0x4ef473;var _0x843547;return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x3a447a}})[_0xad2e('0x2b')](function(_0x3a70de){_0x574f67=_0x3a70de;return db[_0xad2e('0xb8')]['findOne']({'where':{'id':_0x3a70de[_0xad2e('0x80')]},'attributes':['id','vidaooApiKey',_0xad2e('0xb9'),_0xad2e('0xba'),_0xad2e('0xbb'),_0xad2e('0xbc')],'raw':!![]});})[_0xad2e('0x2b')](function(_0x2fe953){if(_0x2fe953&&_0x2fe953[_0xad2e('0xbd')]&&_0x2fe953[_0xad2e('0xb9')]){_0x4ef473=_0x2fe953;var _0x4a14de={'interaction':{'id':_0x3a447a},'agent':{'id':_0x271306['user']['id'],'name':_0x271306[_0xad2e('0x9a')][_0xad2e('0x2d')],'fullname':_0x271306['user'][_0xad2e('0x37')],'email':_0x271306[_0xad2e('0x9a')][_0xad2e('0xbe')]},'contact':_0x271306[_0xad2e('0x31')][_0xad2e('0x32')],'account':_0x271306[_0xad2e('0x31')]['account']};var _0x528e42={'rejectUnauthorized':![],'method':_0xad2e('0xbf'),'url':_0xad2e('0xc0'),'headers':{'X-APIKEY':_0x2fe953[_0xad2e('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x271306['user']['email']],'buttons':null,'topic':_0x4ef473[_0xad2e('0xba')],'note':_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbb')])?null:getMustacheRender(_0x4ef473[_0xad2e('0xbb')],_0x4a14de),'metadata':null},'redirect':_0xad2e('0xc2'),'json':!![]};try{if(!_[_0xad2e('0xc1')](_0x4ef473[_0xad2e('0xbc')])){var _0xf710d=getMustacheRender(_0x4ef473[_0xad2e('0xbc')],_0x4a14de);var _0x2a59af=JSON['parse'](_0xf710d);_0x528e42['body'][_0xad2e('0xc3')]=_0x2a59af;}}catch(_0x447f04){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xc6'));}return rp(_0x528e42);}else{throw new db['Sequelize'][(_0xad2e('0xc5'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x529069){_0x843547=_0x529069;if(_0x843547['id']){var _0x209d06={'body':_0x843547[_0xad2e('0xc7')],'ChatWebsiteId':_0x4ef473['id'],'ChatInteractionId':_0x574f67['id'],'direction':'out','UserId':_0x271306['user']['id']};return db[_0xad2e('0xc8')][_0xad2e('0xb3')](_0x209d06,{});}else{throw new db['Sequelize'][(_0xad2e('0xc5'))](_0xad2e('0xc9'));}})[_0xad2e('0x2b')](function(){return _0x574f67[_0xad2e('0xca')]({'vidaooSessionId':_0x843547['id']});})[_0xad2e('0x2b')](respondWithResult(_0x34685b,null))['catch'](handleError(_0x34685b,null));};exports[_0xad2e('0xcb')]=function(_0x3b2c9a,_0x1f7222){if(_0x3b2c9a[_0xad2e('0x31')]['id']){delete _0x3b2c9a[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')]['find']({'where':{'id':_0x3b2c9a[_0xad2e('0xb4')]['id']},'include':[{'model':db[_0xad2e('0xcc')],'as':'Contact'}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1f7222,null))['then'](saveUpdates(_0x3b2c9a[_0xad2e('0x31')],null))[_0xad2e('0x2b')](respondWithResult(_0x1f7222,null))[_0xad2e('0x20')](handleError(_0x1f7222,null));};exports[_0xad2e('0xcd')]=function(_0x5888fb,_0x1c4530){if(_0x5888fb[_0xad2e('0x31')]['id']){delete _0x5888fb[_0xad2e('0x31')]['id'];}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x5888fb[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](function(_0x1afe03){if(!_0x1afe03){logger[_0xad2e('0x1c')](_0xad2e('0xce'),_0xad2e('0xcd'),0x194,_0xad2e('0xcf'));_0x1c4530[_0xad2e('0x21')](0x194);}else{if(_0x1afe03[_0xad2e('0x42')]){throw new db[(_0xad2e('0xc4'))][(_0xad2e('0xc5'))](_0xad2e('0xd0'));}}return _0x1afe03;})[_0xad2e('0x2b')](function(_0x5f1aaf){if(_0x5f1aaf){return _0x5f1aaf[_0xad2e('0x2a')]({'closed':_0x5888fb[_0xad2e('0x31')][_0xad2e('0x41')],'disposition':_0x5888fb['body']['disposition']})[_0xad2e('0x2b')](function(_0x55b7de){return _0x55b7de;});}})[_0xad2e('0x2b')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5888fb[_0xad2e('0x31')],client9004);})[_0xad2e('0x2b')](respondWithResult(_0x1c4530,null))[_0xad2e('0x20')](handleError(_0x1c4530,null));};exports[_0xad2e('0xd1')]=function(_0x394518,_0xa25ed2){_0x394518['body']['name']=_0x394518[_0xad2e('0xd2')][_0xad2e('0xd3')];_0x394518[_0xad2e('0x31')]['basename']=_0x394518['file'][_0xad2e('0xd4')];_0x394518[_0xad2e('0x31')]['type']=_0x394518[_0xad2e('0xd2')]['mimetype'];return db[_0xad2e('0xd5')][_0xad2e('0xb3')](_0x394518[_0xad2e('0x31')])[_0xad2e('0x2b')](respondWithResult(_0xa25ed2,0xc9))[_0xad2e('0x20')](handleError(_0xa25ed2,null));};exports[_0xad2e('0xd6')]=function(_0x57ed5c,_0x1e9ade){return db[_0xad2e('0x47')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0xb4')]['id']},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null))[_0xad2e('0x2b')](function(_0x360d04){if(_0x360d04){if(_0x360d04[_0xad2e('0x41')]){return _0x1e9ade[_0xad2e('0x22')](0x193)[_0xad2e('0x24')]({'status':0x193,'message':'Unauthorized'});}return db[_0xad2e('0xd5')]['findOne']({'where':{'id':_0x57ed5c[_0xad2e('0x4c')][_0xad2e('0xd7')]},'raw':!![]})[_0xad2e('0x2b')](handleEntityNotFound(_0x1e9ade,null));}})[_0xad2e('0x2b')](function(_0x1466fd){if(_0x1466fd){var _0x9b10b=_0x1466fd[_0xad2e('0xd8')]!==null;var _0x4f546b=path['join'](config[_0xad2e('0xd9')],_0xad2e('0xda'));if(_0x9b10b){_0x4f546b=path[_0xad2e('0xdb')](_0x4f546b,_0xad2e('0xdc'));}var _0x255aa0=path[_0xad2e('0xdb')](_0x4f546b,_0x1466fd[_0xad2e('0xdd')]);return _0x1e9ade[_0xad2e('0xde')](_0x255aa0);}})['catch'](handleError(_0x1e9ade,null));};exports['close']=function(_0xa94b3f,_0x203105){var _0x4d18b4=null;var _0x15a98d=null;var _0x2c5621=null;if(_0xa94b3f[_0xad2e('0x31')]['id']){delete _0xa94b3f[_0xad2e('0x31')]['id'];}if(_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xdf')]){_0x2c5621=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0xe0'),util[_0xad2e('0xe1')]('transcript-%s.txt',Date[_0xad2e('0xe2')]()));_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe3')]=_0x2c5621;}return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0xa94b3f[_0xad2e('0xb4')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xad2e('0x7a')}]}]})[_0xad2e('0x2b')](handleEntityNotFound(_0x203105,null))['then'](saveUpdates(_0xa94b3f['body'],null))['then'](function(_0x36fa66){if(_0x36fa66){_0x4d18b4=_0x36fa66;return db['ChatWebsite'][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x80')]}});}})['then'](function(_0x3a7e1f){if(_0x3a7e1f){_0x15a98d=_0x3a7e1f;return db[_0xad2e('0xcc')][_0xad2e('0x75')]({'where':{'id':_0x4d18b4[_0xad2e('0x76')]}});}})[_0xad2e('0x2b')](function(_0x2a9579){if(_0x2a9579){if(_0x2c5621){var _0x423e41=null;for(var _0x56aa85=0x1;_0x56aa85<_0x4d18b4['Messages'][_0xad2e('0x50')];++_0x56aa85){_0x423e41=_0x4d18b4[_0xad2e('0xe4')][_0x56aa85];var _0x3efa33=_0x423e41['UserId']?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41[_0xad2e('0x42')]):'System';var _0x31250b=_0xa94b3f[_0xad2e('0x31')][_0xad2e('0xe7')]||util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0xad2e('0xe8'),_0x423e41[_0xad2e('0x76')]);switch(_0x15a98d[_0xad2e('0xe9')]){case _0xad2e('0xea'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')](_0xad2e('0xe5'),_0x15a98d[_0xad2e('0xe6')],_0x423e41['UserId']):_0xad2e('0xeb');break;case _0xad2e('0xec'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41[_0xad2e('0x7a')][_0xad2e('0xed')]||_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;case _0xad2e('0xee'):_0x3efa33=_0x423e41[_0xad2e('0x42')]?_0x423e41['User'][_0xad2e('0x37')]:_0xad2e('0xeb');break;default:_0x3efa33=_0x423e41[_0xad2e('0x42')]?util[_0xad2e('0xe1')]('%s%d',_0x15a98d['agentAlias'],_0x423e41[_0xad2e('0x42')]):_0xad2e('0xeb');}var _0x2a1fd3=util['format'](_0xad2e('0xef'),moment(_0x423e41[_0xad2e('0xf0')])[_0xad2e('0xe1')](_0xad2e('0xf1')),_0x423e41[_0xad2e('0xf2')]==='in'?_0x31250b:_0x3efa33,_0x423e41[_0xad2e('0x31')]);if(!_0x423e41[_0xad2e('0xf3')]){fs[_0xad2e('0xf4')](_0x2c5621,_0x2a1fd3);}}return db[_0xad2e('0xf5')][_0xad2e('0xb7')]({'where':{'service':!![]},'include':[{'model':db[_0xad2e('0xf6')],'as':_0xad2e('0xf7'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xad2e('0xf8'),'raw':!![]}]}]});}}})[_0xad2e('0x2b')](function(_0x7ab79a){if(!_0x7ab79a||!_0x7ab79a[_0xad2e('0xf7')]||!_0xa94b3f[_0xad2e('0x31')])return _0x4d18b4;var _0x19dde7=_0x7ab79a['getSmtpOptions']();return respondWithRpcPromise(_0xad2e('0xf9'),_0xad2e('0xfa'),{'account':_0x19dde7,'message':{'from':util[_0xad2e('0xe1')](_0xad2e('0xfb'),_0x7ab79a[_0xad2e('0x2d')],_0x7ab79a[_0xad2e('0xbe')]||_0x7ab79a[_0xad2e('0xf7')][_0xad2e('0x9a')]),'to':_0xa94b3f[_0xad2e('0x31')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xad2e('0xe1')](_0xad2e('0xfc'),_0xa94b3f['body'][_0xad2e('0xdf')]),'attachments':[{'path':_0x2c5621}]}})['then'](function(){return _0x4d18b4;})[_0xad2e('0x20')](function(_0x33de0b){logger['error'](_0x33de0b);});})['then'](respondWithStatusCode(_0x203105,0xc8))['catch'](handleError(_0x203105,null));};exports[_0xad2e('0xfd')]=function(_0x55947c,_0x1392f0){return db[_0xad2e('0xc8')][_0xad2e('0x75')]({'where':{'id':_0x55947c['params']['id']}})['then'](handleEntityNotFound(_0x1392f0,null))['then'](function(_0x167f32){if(_0x167f32){return _0x167f32['addMessage'](_0x55947c[_0xad2e('0x31')][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x55947c['body'],[_0xad2e('0xfe'),'id'])||{});}})[_0xad2e('0x2b')](respondWithResult(_0x1392f0,null))['catch'](handleError(_0x1392f0,null));};exports[_0xad2e('0x100')]=function(_0x14ed73,_0x54391f){var _0x52584a={'raw':![],'where':{}};var _0x4ce397={};var _0x2e5acc={'count':0x0,'rows':[]};return db[_0xad2e('0x47')][_0xad2e('0xb7')]({'where':{'id':_0x14ed73[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x54391f,null))[_0xad2e('0x2b')](function(_0x2f59fd){if(_0x2f59fd){_0x4ce397[_0xad2e('0x4b')]=_[_0xad2e('0x4d')](db[_0xad2e('0xc8')][_0xad2e('0xb0')]);_0x4ce397[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x14ed73['query']);_0x4ce397[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4ce397['model'],_0x4ce397[_0xad2e('0x4c')]);_0x52584a[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4ce397['model'],qs[_0xad2e('0x4e')](_0x14ed73['query'][_0xad2e('0x4e')]));_0x52584a[_0xad2e('0x4f')]=_0x52584a[_0xad2e('0x4f')][_0xad2e('0x50')]?_0x52584a[_0xad2e('0x4f')]:_0x4ce397[_0xad2e('0x4b')];if(!_0x14ed73['query'][_0xad2e('0x101')](_0xad2e('0x51'))){_0x52584a[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x14ed73['query']['limit']);_0x52584a['offset']=qs['offset'](_0x14ed73[_0xad2e('0x4c')]['offset']);}_0x52584a[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x14ed73['query'][_0xad2e('0x53')]);_0x52584a[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x14ed73[_0xad2e('0x4c')],_0x4ce397[_0xad2e('0x55')]));_0x52584a[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2f59fd['id'];if(_0x14ed73['query']['filter']){_0x52584a[_0xad2e('0x54')]=_[_0xad2e('0x30')](_0x52584a[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x52584a[_0xad2e('0x4f')],function(_0x5b9636){var _0x5c9dc0={};_0x5c9dc0[_0x5b9636]={'$like':'%'+_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x103')]+'%'};return _0x5c9dc0;})});}if(_0x14ed73['query'][_0xad2e('0x104')]){var _0x4c70b8=_0x14ed73[_0xad2e('0x4c')][_0xad2e('0x104')][_0xad2e('0x3a')](',');var _0x180166={};_0x180166[_0x4c70b8[0x0]]={'$gte':moment(_0x4c70b8[0x1])[_0xad2e('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x52584a[_0xad2e('0x54')]=_['merge'](_0x52584a['where'],_0x180166);}_0x52584a=_[_0xad2e('0x30')]({},_0x52584a,_0x14ed73[_0xad2e('0xb2')]);return db[_0xad2e('0xc8')][_0xad2e('0x27')]({'where':_0x52584a[_0xad2e('0x54')]})[_0xad2e('0x2b')](function(_0x14b851){_0x2e5acc['count']=_0x14b851;if(_0x14ed73[_0xad2e('0x4c')]['includeAll']){_0x52584a['include']=[{'all':!![]}];}return db['ChatMessage'][_0xad2e('0x105')](_0x52584a);})[_0xad2e('0x2b')](function(_0x4f28e2){_0x2e5acc['rows']=_0x4f28e2;return _0x2e5acc;});}})[_0xad2e('0x2b')](respondWithFilteredResult(_0x54391f,_0x52584a))[_0xad2e('0x20')](handleError(_0x54391f,null));};exports[_0xad2e('0x106')]=function(_0x59df92,_0x34bbc6){var _0x54feb5={'where':{}},_0x4a6fa3={},_0x4d4a27={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xad2e('0xb7')]({'where':{'id':_0x59df92['params']['id']}})['then'](handleEntityNotFound(_0x34bbc6,null))[_0xad2e('0x2b')](function(_0x2dcb83){if(_0x2dcb83){_0x4a6fa3[_0xad2e('0x4b')]=_['keys'](db['ChatMessage'][_0xad2e('0xb0')]);_0x4a6fa3[_0xad2e('0x4c')]=_[_0xad2e('0x4d')](_0x59df92['query']);_0x4a6fa3[_0xad2e('0x55')]=_[_0xad2e('0xb1')](_0x4a6fa3['model'],_0x4a6fa3[_0xad2e('0x4c')]);_0x54feb5[_0xad2e('0x4f')]=_[_0xad2e('0xb1')](_0x4a6fa3[_0xad2e('0x4b')],qs[_0xad2e('0x4e')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x4e')]));_0x54feb5[_0xad2e('0x4f')]=_0x54feb5['attributes'][_0xad2e('0x50')]?_0x54feb5['attributes']:_0x4a6fa3[_0xad2e('0x4b')];if(!_0x59df92[_0xad2e('0x4c')]['hasOwnProperty']('nolimit')){_0x54feb5[_0xad2e('0x28')]=qs[_0xad2e('0x28')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x28')]);_0x54feb5['offset']=qs[_0xad2e('0x25')](_0x59df92['query'][_0xad2e('0x25')]);}_0x54feb5[_0xad2e('0x52')]=qs[_0xad2e('0x53')](_0x59df92[_0xad2e('0x4c')][_0xad2e('0x53')]);_0x54feb5[_0xad2e('0x54')]=qs[_0xad2e('0x55')](_[_0xad2e('0x56')](_0x59df92[_0xad2e('0x4c')],_0x4a6fa3[_0xad2e('0x55')]));_0x54feb5[_0xad2e('0x54')][_0xad2e('0x102')]=_0x2dcb83['id'];if(_0x59df92['query'][_0xad2e('0x103')]){_0x54feb5[_0xad2e('0x54')]=_['merge'](_0x54feb5[_0xad2e('0x54')],{'$or':_[_0xad2e('0x36')](_0x54feb5[_0xad2e('0x4f')],function(_0x5a85a4){var _0x20bca3={};_0x20bca3[_0x5a85a4]={'$like':'%'+_0x59df92[_0xad2e('0x4c')]['filter']+'%'};return _0x20bca3;})});}_0x54feb5[_0xad2e('0x54')][_0xad2e('0xf3')]=![];if(_0x59df92[_0xad2e('0x4c')]['id']){_0x54feb5[_0xad2e('0x54')]['id']={'$gt':_0x59df92[_0xad2e('0x4c')]['id']};}_0x54feb5=_[_0xad2e('0x30')]({},_0x54feb5,_0x59df92[_0xad2e('0xb2')]);return db['ChatMessage']['count']({'where':_0x54feb5['where']})[_0xad2e('0x2b')](function(_0x1cfdda){_0x4d4a27[_0xad2e('0x27')]=_0x1cfdda;_0x54feb5[_0xad2e('0x107')]=[];if(_0x59df92['query']['includeAgent']){_0x54feb5[_0xad2e('0x107')][_0xad2e('0x3c')]({'model':db['User'],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37'),'alias']});}if(_0x59df92[_0xad2e('0x4c')]['includeAll']){_0x54feb5[_0xad2e('0x107')]=[{'all':!![]}];}return db[_0xad2e('0xc8')]['findAll'](_0x54feb5);})[_0xad2e('0x2b')](function(_0x2cf359){_0x4d4a27['rows']=_0x2cf359;return _0x4d4a27;});}})['then'](respondWithFilteredResult(_0x34bbc6,_0x54feb5))[_0xad2e('0x20')](handleError(_0x34bbc6,null));};exports[_0xad2e('0x108')]=function(_0x492b7e,_0xad9fab){return db['ChatInteraction'][_0xad2e('0x75')]({'where':{'id':_0x492b7e[_0xad2e('0xb4')]['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0xad9fab,null))[_0xad2e('0x2b')](function(_0x2331f1){if(_0x2331f1){return _0x2331f1['setTags'](_0x492b7e['body'][_0xad2e('0xfe')],_[_0xad2e('0xff')](_0x492b7e[_0xad2e('0x31')],['ids','id'])||{})[_0xad2e('0x109')](function(){return db[_0xad2e('0x10a')][_0xad2e('0x105')]({'attributes':['id',_0xad2e('0x2d'),_0xad2e('0x10b')],'where':{'id':_0x492b7e[_0xad2e('0x31')][_0xad2e('0xfe')]}});})[_0xad2e('0x2b')](function(_0x21964b){socket[_0xad2e('0x10c')](_0xad2e('0x10d'),{'id':Number(_0x492b7e['params']['id']),'tags':_0x21964b||[]});return{'id':Number(_0x492b7e[_0xad2e('0xb4')]['id']),'tags':_0x21964b||[]};});}})[_0xad2e('0x2b')](respondWithResult(_0xad9fab,null))['catch'](handleError(_0xad9fab,null));};exports[_0xad2e('0x10e')]=function(_0x8bb3c4,_0x453fa7){return db[_0xad2e('0x47')][_0xad2e('0x75')]({'where':{'id':_0x8bb3c4['params']['id']}})[_0xad2e('0x2b')](handleEntityNotFound(_0x453fa7,null))[_0xad2e('0x2b')](function(_0x27ad41){if(_0x27ad41){return _0x27ad41[_0xad2e('0x10e')](_0x8bb3c4[_0xad2e('0x4c')][_0xad2e('0xfe')]);}})[_0xad2e('0x2b')](respondWithStatusCode(_0x453fa7,null))[_0xad2e('0x20')](handleError(_0x453fa7,null));};exports[_0xad2e('0xde')]=function(_0x40e752,_0x4c7c51){var _0x12a370=moment()['unix']()[_0xad2e('0x9f')]();var _0x853563=path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),'files',_0xad2e('0x110'));var _0x10eb76=path[_0xad2e('0xdb')](config['root'],_0xad2e('0x10f'),_0xad2e('0x111'),_0xad2e('0x112'));var _0x2dbfbd=path['join'](_0x853563,_0x12a370);var _0x56ac2d=util[_0xad2e('0xe1')]('transcript-%d-%s.zip',_0x40e752[_0xad2e('0xb4')]['id'],_0x12a370);var _0xf892e9=path[_0xad2e('0xdb')](_0x853563,_0x56ac2d);var _0x414763=[];_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x7a'),'attributes':['id',_0xad2e('0x37')],'raw':!![]});_0x414763[_0xad2e('0x3c')]({'model':db[_0xad2e('0xcc')],'as':'Contact','attributes':['id',_0xad2e('0x113'),_0xad2e('0x114')],'raw':!![]});if(_0x40e752[_0xad2e('0x4c')][_0xad2e('0x112')]){_0x414763['push']({'model':db[_0xad2e('0xd5')],'as':_0xad2e('0xd5'),'raw':!![]});}var _0x366ebe=[{'model':db['ChatMessage'],'as':_0xad2e('0xe4'),'attributes':['id',_0xad2e('0x31'),'createdAt',_0xad2e('0xf2'),_0xad2e('0xf3'),_0xad2e('0x86')],'include':_0x414763}];_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0xb8')],'as':_0xad2e('0x115'),'attributes':['id','name']});_0x366ebe[_0xad2e('0x3c')]({'model':db[_0xad2e('0x7a')],'as':_0xad2e('0x116'),'attributes':['id',_0xad2e('0x37')]});return db[_0xad2e('0x47')]['find']({'where':{'id':_0x40e752[_0xad2e('0xb4')]['id']},'include':_0x366ebe})[_0xad2e('0x2b')](handleEntityNotFound(_0x4c7c51,null))[_0xad2e('0x2b')](function(_0x6d6ab1){if(_0x6d6ab1){var _0x2e8154=_0x6d6ab1[_0xad2e('0x117')]({'plain':!![]});fs[_0xad2e('0x118')](_0x2dbfbd);var _0x1d7adc={'channel':_0xad2e('0x119'),'account':_0x2e8154['Account'][_0xad2e('0x2d')],'agent':_0x2e8154[_0xad2e('0x116')]?_0x2e8154[_0xad2e('0x116')][_0xad2e('0x37')]:_0xad2e('0x11a'),'createdAt':moment(_0x2e8154[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'closedAt':_0x2e8154[_0xad2e('0x41')]?moment(_0x2e8154[_0xad2e('0x11c')])[_0xad2e('0xe1')](_0xad2e('0x11b'))[_0xad2e('0x9f')]():'','disposition':_0x2e8154[_0xad2e('0x43')],'chatInfo':{'browser':_0x2e8154[_0xad2e('0x11d')],'os':_0x2e8154[_0xad2e('0x11e')],'referer':_0x2e8154[_0xad2e('0x11f')],'customerIp':_0x2e8154[_0xad2e('0x120')],'customerPort':_0x2e8154[_0xad2e('0x121')]?_0x2e8154[_0xad2e('0x121')]:'N.A.'},'messages':_(_0x2e8154[_0xad2e('0xe4')])[_0xad2e('0x122')]()[_0xad2e('0x103')]({'secret':![]})['map'](function(_0x4fbe64){if(_0x4fbe64[_0xad2e('0xd5')]){var _0x424b02=path[_0xad2e('0xdb')](_0x10eb76,_0x4fbe64['Attachment'][_0xad2e('0xdd')]);if(fs['existsSync'](_0x424b02)){fs['createReadStream'](_0x424b02)[_0xad2e('0x123')](fs[_0xad2e('0x124')](path[_0xad2e('0xdb')](_0x2dbfbd,_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')])));}}return{'date':moment(_0x4fbe64[_0xad2e('0xf0')])['format'](_0xad2e('0x11b'))[_0xad2e('0x9f')](),'sender':_0x4fbe64['direction']===_0xad2e('0x125')?_0x4fbe64[_0xad2e('0x7a')]?_0x4fbe64[_0xad2e('0x7a')][_0xad2e('0x37')]:'System':_0x4fbe64[_0xad2e('0x71')][_0xad2e('0x113')]+(_0x4fbe64['Contact'][_0xad2e('0x114')]?'\x20'+_0x4fbe64['Contact']['lastName']:''),'body':_0x4fbe64[_0xad2e('0xd5')]?_0x4fbe64[_0xad2e('0xd5')][_0xad2e('0xdd')]:_0x4fbe64[_0xad2e('0x31')],'direction':_0x4fbe64[_0xad2e('0xf2')]===_0xad2e('0x125')?'A':'C','secret':_0x4fbe64[_0xad2e('0xf3')],'read':_0x4fbe64[_0xad2e('0x86')],'attachment':_0x4fbe64['Attachment']};})[_0xad2e('0x6d')]()};return ejs[_0xad2e('0x126')](path[_0xad2e('0xdb')](config[_0xad2e('0xd9')],_0xad2e('0x10f'),_0xad2e('0x127'),_0xad2e('0x128')),{'interaction':_0x1d7adc})[_0xad2e('0x2b')](function(_0x25057b){var _0x30ac7f=path['join'](_0x2dbfbd,'transcript-'+_0x2e8154['id']+'-'+_0x12a370+'.pdf');var _0x5839ae={'path':_0x30ac7f,'channel':'Chat','interactionId':_0x2e8154['id']};return pdf[_0xad2e('0x129')](_0x25057b,_0x5839ae);})[_0xad2e('0x2b')](function(){return new Promise(function(_0x4db1d3,_0x50c6a0){zipdir(_0x2dbfbd,{'saveTo':_0xf892e9},function(_0x300d87,_0x1afd35){if(_0x300d87)return _0x50c6a0(_0x300d87);return _0x4db1d3(_0x1afd35);});})[_0xad2e('0x2b')](function(){return new BPromise(function(_0x231853,_0x1a60d6){rimraf(_0x2dbfbd,function(_0x2812f9){if(_0x2812f9)_0x1a60d6(_0x2812f9);return _0x231853();});});})['then'](function(){return _0x4c7c51[_0xad2e('0xde')](_0xf892e9,_0x56ac2d,function(_0x3ff14a){if(_0x3ff14a){logger[_0xad2e('0x1c')]('err',_0x3ff14a);}else{fs[_0xad2e('0x12a')](_0xf892e9);}});});});}else{return _0x4c7c51[_0xad2e('0x21')](0xc8);}})[_0xad2e('0x20')](handleError(_0x4c7c51,null));}; \ No newline at end of file +var _0x55e0=['nolimit','order','sort','where','select','field','color','tools_tags','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','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','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','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?','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','contactName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','catch','show','params','includeAll','include','options','create','describe','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','follow','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','ContactId','%s%d','System','customer','format','Visitor','agentIdentifier','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','addMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','pick','secret','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','Account','Owner','mkdirSync','Chat','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','createWriteStream','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','request-promise','moment','util','path','ejs','lodash','squel','ioredis','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','name','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x475516,_0x1a8b71){var _0x2732f2=function(_0x5ab274){while(--_0x5ab274){_0x475516['push'](_0x475516['shift']());}};_0x2732f2(++_0x1a8b71);}(_0x55e0,0xdc));var _0x055e=function(_0x3e29bf,_0xc3b103){_0x3e29bf=_0x3e29bf-0x0;var _0x2c1601=_0x55e0[_0x3e29bf];return _0x2c1601;};'use strict';var rimraf=require(_0x055e('0x0'));var zipdir=require(_0x055e('0x1'));var rp=require(_0x055e('0x2'));var moment=require(_0x055e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x055e('0x4'));var path=require(_0x055e('0x5'));var ejs=require(_0x055e('0x6'));var fs=require('fs');var _=require(_0x055e('0x7'));var squel=require(_0x055e('0x8'));var Redis=require(_0x055e('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x055e('0xa'));var logger=require('../../config/logger')(_0x055e('0xb'));var config=require(_0x055e('0xc'));var db=require(_0x055e('0xd'))['db'];config[_0x055e('0xe')]=_[_0x055e('0xf')](config['redis'],{'host':_0x055e('0x10'),'port':0x18eb});var socket=require(_0x055e('0x11'))(new Redis(config[_0x055e('0xe')]));require(_0x055e('0x12'))[_0x055e('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x055e('0x14')]({'port':0x232b});var client9004=jayson['client'][_0x055e('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x466da3,_0x72d424,_0x101bc3,_0xc98c6a){return new BPromise(function(_0x31c649,_0x236a2b){var _0x4bca5d=_0xc98c6a||client;return _0x4bca5d[_0x055e('0x15')](_0x466da3,_0x101bc3)[_0x055e('0x16')](function(_0x3cfd14){logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,'request\x20sent');logger[_0x055e('0x19')](_0x055e('0x1a'),_0x72d424,_0x055e('0x1b'),JSON['stringify'](_0x3cfd14));if(_0x3cfd14[_0x055e('0x1c')]){if(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1d')]===0x1f4){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x3cfd14['error'][_0x055e('0x1e')]);return _0x236a2b(_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);}logger[_0x055e('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x72d424,_0x3cfd14[_0x055e('0x1c')][_0x055e('0x1e')]);return _0x31c649(_0x3cfd14['error'][_0x055e('0x1e')]);}else{logger[_0x055e('0x17')](_0x055e('0x18'),_0x72d424,_0x055e('0x1b'));_0x31c649(_0x3cfd14[_0x055e('0x1f')][_0x055e('0x1e')]);}})['catch'](function(_0x31c355){logger[_0x055e('0x1c')](_0x055e('0x18'),_0x72d424,_0x31c355);_0x236a2b(_0x31c355);});});}function respondWithStatusCode(_0x5930ff,_0x3f444a){_0x3f444a=_0x3f444a||0xcc;return function(_0x2da6b){if(_0x2da6b){return _0x5930ff[_0x055e('0x20')](_0x3f444a);}return _0x5930ff[_0x055e('0x21')](_0x3f444a)['end']();};}function respondWithResult(_0x71a6e1,_0x56c372){_0x56c372=_0x56c372||0xc8;return function(_0x33ffdf){if(_0x33ffdf){return _0x71a6e1[_0x055e('0x21')](_0x56c372)[_0x055e('0x22')](_0x33ffdf);}};}function respondWithFilteredResult(_0x1a76c6,_0x40c62a){return function(_0x4c653c){if(_0x4c653c){var _0x58caf9=typeof _0x40c62a[_0x055e('0x23')]===_0x055e('0x24')&&typeof _0x40c62a[_0x055e('0x25')]==='undefined';var _0x408e38=_0x4c653c[_0x055e('0x26')];var _0x42f2df=_0x58caf9?0x0:_0x40c62a[_0x055e('0x23')];var _0x59539d=_0x58caf9?_0x4c653c[_0x055e('0x26')]:_0x40c62a['offset']+_0x40c62a[_0x055e('0x25')];var _0x35def0;if(_0x59539d>=_0x408e38){_0x59539d=_0x408e38;_0x35def0=0xc8;}else{_0x35def0=0xce;}_0x1a76c6[_0x055e('0x21')](_0x35def0);return _0x1a76c6[_0x055e('0x27')](_0x055e('0x28'),_0x42f2df+'-'+_0x59539d+'/'+_0x408e38)['json'](_0x4c653c);}return null;};}function saveUpdates(_0x99a372){return function(_0x453e5e){if(_0x453e5e){return _0x453e5e[_0x055e('0x29')](_0x99a372)[_0x055e('0x16')](function(_0x36abb2){return _0x36abb2;});}return null;};}function removeEntity(_0x225c88){return function(_0x59f8c4){if(_0x59f8c4){return _0x59f8c4[_0x055e('0x2a')]()['then'](function(){_0x225c88[_0x055e('0x21')](0xcc)[_0x055e('0x2b')]();});}};}function handleEntityNotFound(_0x5cfeea){return function(_0xd9298d){if(!_0xd9298d){_0x5cfeea[_0x055e('0x20')](0x194);}return _0xd9298d;};}function handleError(_0x524344,_0x20717b){_0x20717b=_0x20717b||0x1f4;return function(_0x23c611){logger[_0x055e('0x1c')](_0x23c611['stack']);if(_0x23c611['name']){delete _0x23c611[_0x055e('0x2c')];}_0x524344['status'](_0x20717b)['send'](_0x23c611);};}function getMustacheRender(_0x55a1ee,_0x31ee60){return Mustache[_0x055e('0x2d')](_0x55a1ee,_[_0x055e('0x2e')](_0x31ee60[_0x055e('0x2f')],{'contact':_0x31ee60[_0x055e('0x30')],'message':_0x31ee60[_0x055e('0x1e')],'agent':_0x31ee60[_0x055e('0x31')],'interaction':_0x31ee60[_0x055e('0x32')],'account':_0x31ee60[_0x055e('0x33')]}))||'';}function getInteractionUsers(_0x2f60fa,_0x2f839c){return new BPromise(function(_0x263a81,_0x54539e){try{if(_0x2f839c[_0x2f60fa['id']]){_0x2f60fa['Users']=_[_0x055e('0x34')](_0x2f839c[_0x2f60fa['id']],function(_0x47790a){return{'id':_0x47790a['id'],'fullname':_0x47790a[_0x055e('0x35')]};});}}catch(_0xf3abf6){_0x54539e(_0xf3abf6);}_0x263a81(_0x2f60fa);});}function getInteractionTags(_0x34d5f2,_0x21aaad){return new BPromise(function(_0xb08e29,_0x4f24f8){try{if(_0x34d5f2[_0x055e('0x36')]){_0x34d5f2[_0x055e('0x37')]=[];_0x34d5f2[_0x055e('0x36')][_0x055e('0x38')](',')[_0x055e('0x39')](function(_0x585b8a){_0x34d5f2[_0x055e('0x37')][_0x055e('0x3a')](_0x21aaad[_0x585b8a]);});}delete _0x34d5f2['TagIds'];}catch(_0x39ecd7){_0x4f24f8(_0x39ecd7);}_0xb08e29(_0x34d5f2);});}function updateChatInteraction(_0x1a109f,_0x4a97ab,_0x99688b){return new BPromise(function(_0x2d7815,_0x4e424b){return getInteractionUsers(_0x1a109f,_0x99688b)[_0x055e('0x16')](function(_0x233423){return getInteractionTags(_0x233423,_0x4a97ab);})['then'](function(_0x1012a4){return getStateInteraction(_0x1012a4);})[_0x055e('0x16')](function(_0x1478c2){_0x2d7815(_0x1478c2);})['catch'](function(_0x1715ed){_0x4e424b(_0x1715ed);});});}function getStateInteraction(_0x1dd07b){return new BPromise(function(_0x574ea0){_0x1dd07b[_0x055e('0x3b')]=0x0;_0x1dd07b[_0x055e('0x3c')]=0x0;_0x1dd07b[_0x055e('0x3d')]=0x0;_0x1dd07b['unmanaged']=0x0;_0x1dd07b[_0x055e('0x3e')]=0x0;_0x1dd07b[_0x055e('0x3f')]=0x0;if(!_0x1dd07b[_0x055e('0x40')]&&!_0x1dd07b['UserId']){_0x1dd07b['waiting']+=0x1;}if(!_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b['talking']+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}if(_0x1dd07b[_0x055e('0x40')]&&_0x1dd07b['disposition']===_0x055e('0x3e')){_0x1dd07b[_0x055e('0x3e')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&!_0x1dd07b[_0x055e('0x41')]&&_0x1dd07b[_0x055e('0x42')]){_0x1dd07b[_0x055e('0x43')]+=0x1;if(_0x1dd07b[_0x055e('0x3b')]){_0x1dd07b['waiting']-=0x1;}}else if(_0x1dd07b['closed']&&_0x1dd07b[_0x055e('0x41')]){_0x1dd07b[_0x055e('0x3d')]+=0x1;if(_0x1dd07b['talking']){_0x1dd07b[_0x055e('0x3c')]-=0x1;}}_0x1dd07b[_0x055e('0x3f')]+=0x1;_0x574ea0(_0x1dd07b);});}exports[_0x055e('0x44')]=function(_0x20eb76,_0x19e29c){var _0x1f3c73={},_0x479f4e={},_0x297edd={'count':0x0,'rows':[]};var _0x118a0e=_['map'](db[_0x055e('0x45')][_0x055e('0x46')],function(_0x341c46){return{'name':_0x341c46[_0x055e('0x47')],'type':_0x341c46[_0x055e('0x48')][_0x055e('0x49')]};});_0x479f4e[_0x055e('0x4a')]=_['map'](_0x118a0e,_0x055e('0x2c'));_0x479f4e['query']=_[_0x055e('0x4b')](_0x20eb76[_0x055e('0x4c')]);_0x479f4e[_0x055e('0x4d')]=_['intersection'](_0x479f4e['model'],_0x479f4e[_0x055e('0x4c')]);_0x1f3c73[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x479f4e[_0x055e('0x4a')],qs[_0x055e('0x50')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]));_0x1f3c73[_0x055e('0x4e')]=_0x1f3c73[_0x055e('0x4e')]['length']?_0x1f3c73[_0x055e('0x4e')]:_0x479f4e[_0x055e('0x4a')];if(!_0x20eb76[_0x055e('0x4c')][_0x055e('0x51')](_0x055e('0x52'))){_0x1f3c73['limit']=qs[_0x055e('0x25')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x25')]);_0x1f3c73['offset']=qs[_0x055e('0x23')](_0x20eb76['query'][_0x055e('0x23')]);}_0x1f3c73[_0x055e('0x53')]=qs['sort'](_0x20eb76[_0x055e('0x4c')][_0x055e('0x54')]);_0x1f3c73[_0x055e('0x55')]=qs['filters'](_['pick'](_0x20eb76[_0x055e('0x4c')],_0x479f4e[_0x055e('0x4d')]),_0x118a0e);var _0x393717=[];var _0x248e5f=squel[_0x055e('0x56')]()[_0x055e('0x57')]('id')[_0x055e('0x57')](_0x055e('0x2c'))[_0x055e('0x57')](_0x055e('0x58'))['from'](_0x055e('0x59'));var _0x7f03ed=squel[_0x055e('0x56')]()[_0x055e('0x57')]('u.id')[_0x055e('0x57')](_0x055e('0x5a'))[_0x055e('0x57')](_0x055e('0x5b'))['from']('user_has_chat_interactions','ui')[_0x055e('0x5c')](_0x055e('0x5d'),'u',_0x055e('0x5e'));var _0x2fbb1c=squel[_0x055e('0x56')]()[_0x055e('0x5f')](_0x055e('0x60'),'i')[_0x055e('0x5c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x055e('0x5c')](_0x055e('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x055e('0x5c')](_0x055e('0x61'),'a',_0x055e('0x62'))[_0x055e('0x5c')]('chat_messages','me',_0x055e('0x63'))[_0x055e('0x5c')](_0x055e('0x64'),'it',_0x055e('0x65'))[_0x055e('0x5c')](_0x055e('0x59'),'t',_0x055e('0x66'));var _0x31935b=squel['expr']();var _0x3cb600=[];var _0x23794c=squel['expr']();var _0x29b754;if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x67')]){_0x29b754=as[_0x055e('0x68')](_0x20eb76['query'][_0x055e('0x67')]);var _0x18b7f7=_0x29b754[_0x055e('0x69')];for(var _0x4deec3=0x0;_0x4deec3<_0x29b754[_0x055e('0x6a')][_0x055e('0x6b')];_0x4deec3++){var _0xf2c62d=_0x29b754[_0x055e('0x6a')][_0x4deec3];var _0xcc4661='i';var _0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0xf2c62d[_0x055e('0x57')]]);if(!_0x584e60){switch(_0xf2c62d[_0x055e('0x57')]){case _0x055e('0x6d'):if(_0xf2c62d['value']==0x1){_0x2fbb1c[_0x055e('0x6e')]('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x6f'));}else{_0x2fbb1c['having']('`'+_0xf2c62d[_0x055e('0x57')]+_0x055e('0x70'));}break;case _0x055e('0x71'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){if(_0xf2c62d['value'][_0x055e('0x38')]('\x20')['length']>0x1){_0x31935b[_0x18b7f7](_0x055e('0x74'),qs[_0x055e('0x75')](_0xf2c62d['value']),null);}else{var _0x3137bb='%'+_0xf2c62d[_0x055e('0x76')]+'%';_0x31935b[_0x18b7f7](_0x055e('0x77'),_0x3137bb,_0x3137bb,_0x3137bb);}}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,['name','ContactId']);_0xf2c62d[_0x055e('0x57')]='ContactId';_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x7b'):var _0x3de5f1=_0xf2c62d[_0x055e('0x76')]['split'](',')['map'](function(_0xb8b2a0){return Number(_0xb8b2a0);});_0x3de5f1[_0x055e('0x39')](function(_0x52a6e9){_0x23794c['or'](_0x055e('0x7c'),'%,'+_0x52a6e9+',%');});_0x3cb600=_['union'](_0x3cb600,_0x3de5f1);break;case _0x055e('0x7d'):if(_0xf2c62d[_0x055e('0x72')]===_0x055e('0x73')){_0x31935b[_0x18b7f7](_0x055e('0x7e'),'%'+_0xf2c62d[_0x055e('0x76')]+'%',null);}else{_0x584e60=_[_0x055e('0x6c')](_0x118a0e,[_0x055e('0x2c'),_0x055e('0x41')]);_0xf2c62d['field']=_0x055e('0x41');_0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60[_0x055e('0x48')],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}break;case _0x055e('0x2f'):_0x200ed2=as['buildExpression']('me',null,_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')]['start'],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);break;}}else{var _0x200ed2=as[_0x055e('0x78')](_0xcc4661,_0x584e60['type'],_0xf2c62d);_0x31935b[_0x18b7f7](_0x200ed2[_0x055e('0x79')],_0x200ed2[_0x055e('0x76')][_0x055e('0x7a')],_0x200ed2[_0x055e('0x76')][_0x055e('0x2b')]);}}}else{var _0x525d4f=_(_0x20eb76[_0x055e('0x4c')])[_0x055e('0x4b')]()[_0x055e('0x34')](function(_0xe21a0e){return _['some'](_0x118a0e,[_0x055e('0x2c'),_0xe21a0e])?_0xe21a0e:undefined;})[_0x055e('0x7f')]()[_0x055e('0x76')]();if(!_[_0x055e('0x80')](_0x525d4f)){_0x525d4f[_0x055e('0x39')](function(_0x59e669){if(_0x59e669===_0x055e('0x81')){_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),[][_0x055e('0x83')](_0x20eb76['query'][_0x59e669]));}else if(_0x59e669===_0x055e('0x84')){var _0x94e3e=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])['$gte'];var _0x22f4db=JSON[_0x055e('0x85')](_0x20eb76[_0x055e('0x4c')][_0x59e669])[_0x055e('0x86')];_0x2fbb1c[_0x055e('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x94e3e,_0x22f4db);}else{if(_0x20eb76[_0x055e('0x4c')][_0x59e669]===_0x055e('0x87')){_0x2fbb1c[_0x055e('0x55')]('i.'+_0x59e669+'\x20IS\x20NULL');}else{_0x2fbb1c['where']('i.'+_0x59e669+_0x055e('0x88'),_0x20eb76['query'][_0x59e669]);}}});}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x89')]){if(_0x20eb76['query'][_0x055e('0x89')]==0x1){_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8a'));}else{_0x2fbb1c[_0x055e('0x6e')](_0x055e('0x8b'));}}if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]){_0x3cb600=_[_0x055e('0x8d')](_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')])?_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]:new Array(_0x20eb76[_0x055e('0x4c')][_0x055e('0x8c')]);_0x3cb600[_0x055e('0x39')](function(_0xba91c3){_0x23794c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xba91c3+',%');});}if(_0x20eb76[_0x055e('0x4c')]['filter']){var _0x5d2993=_0x20eb76[_0x055e('0x4c')][_0x055e('0x8e')][_0x055e('0x8f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x055e('0x90')](_0x5d2993)){_0x31935b['or'](_0x055e('0x91'),_0x5d2993+'%');}else{_0x31935b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x055e('0x75')](_0x5d2993))['or'](_0x055e('0x92'),_0x5d2993+'%');}}}_0x2fbb1c['where'](_0x31935b);_0x2fbb1c[_0x055e('0x93')]('i.id');var _0xc825b0={'type':db[_0x055e('0x94')][_0x055e('0x95')][_0x055e('0x96')],'raw':!![]};var _0x49db81=_0x2fbb1c['clone']();_0x49db81['field'](_0x055e('0x97'));_0x49db81['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x055e('0x6d'));if(_0x1f3c73['order']){_0x1f3c73[_0x055e('0x53')][_0x055e('0x39')](function(_0x15a107){var _0x1c3a1a=_0x15a107[0x0]==='contactName'?_0x15a107[0x0]:'i.'+_0x15a107[0x0];_0x2fbb1c['order'](_0x1c3a1a,_0x15a107[0x1]===_0x055e('0x98')?![]:!![]);});}if(!_[_0x055e('0x80')](_0x3cb600)){_0x2fbb1c[_0x055e('0x6e')](_0x23794c);_0x49db81[_0x055e('0x55')](_0x055e('0x99'),_0x3cb600);}BPromise[_0x055e('0x9a')]()[_0x055e('0x16')](function(){if(!_0x29b754){if(_0x20eb76['query'][_0x055e('0x81')])return;_0x49db81['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9b'));return;}if(_0x20eb76[_0x055e('0x9c')]['role']!==_0x055e('0x31'))return;return _0x20eb76[_0x055e('0x9c')][_0x055e('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x785c9c){if(_[_0x055e('0x80')](_0x785c9c)){_0x49db81[_0x055e('0x55')](_0x055e('0x9e'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x9e'));}else{_0x49db81[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));_0x2fbb1c[_0x055e('0x55')](_0x055e('0x82'),_[_0x055e('0x34')](_0x785c9c,'id'));}});})[_0x055e('0x16')](function(){if(_0x20eb76[_0x055e('0x9c')][_0x055e('0x9f')]===_0x055e('0x31')&&!_0x29b754&&!_0x20eb76['query'][_0x055e('0x81')])return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x49db81['toString'](),_0xc825b0);})['then'](function(_0x4fd7e2){_0x297edd[_0x055e('0x26')]=_0x4fd7e2[_0x055e('0x6b')];if(_0x297edd[_0x055e('0x26')]===0x0)return[];return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x248e5f[_0x055e('0xa1')](),_0xc825b0)[_0x055e('0x16')](function(_0x2f9a0f){_0x393717=_['keyBy'](_0x2f9a0f,'id');_0xc825b0=_[_0x055e('0x2e')](_0xc825b0,{'model':db[_0x055e('0x45')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20eb76[_0x055e('0x4c')][_0x055e('0x50')]){_0x1f3c73[_0x055e('0x4e')][_0x055e('0x39')](function(_0x46e8f4){_0x2fbb1c[_0x055e('0x57')]('i.'+_0x46e8f4);});}else{_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa2'),_0x055e('0x6d'));_0x2fbb1c[_0x055e('0x57')]('a.key','Account.key');_0x2fbb1c[_0x055e('0x57')](_0x055e('0xa3'),_0x055e('0xa4'));_0x2fbb1c['field'](_0x055e('0xa5'),_0x055e('0xa6'));_0x2fbb1c[_0x055e('0x57')]('i.*');_0x2fbb1c[_0x055e('0x57')]('c.firstName',_0x055e('0xa7'));_0x2fbb1c['field'](_0x055e('0xa8'),_0x055e('0xa9'));_0x2fbb1c['field']('c.email',_0x055e('0xaa'));_0x2fbb1c['field']('c.phone',_0x055e('0xab'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xac'),_0x055e('0xad'));_0x2fbb1c[_0x055e('0x57')]('c.fax',_0x055e('0xae'));_0x2fbb1c[_0x055e('0x57')]('o.fullname',_0x055e('0xaf'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb0'),_0x055e('0xb1'));_0x2fbb1c[_0x055e('0x57')](_0x055e('0xb2'),_0x055e('0x36'));}if(_0x1f3c73[_0x055e('0x25')])_0x2fbb1c['limit'](_0x1f3c73[_0x055e('0x25')]);if(_0x1f3c73[_0x055e('0x23')])_0x2fbb1c[_0x055e('0x23')](_0x1f3c73[_0x055e('0x23')]);return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x2fbb1c[_0x055e('0xa1')](),_0xc825b0);})[_0x055e('0x16')](function(_0x21ae7c){if(_0x21ae7c[_0x055e('0x6b')]>0x0)_0x7f03ed[_0x055e('0x55')]('ui.ChatInteractionId\x20IN\x20?',_[_0x055e('0x34')](_0x21ae7c,'id'));return db[_0x055e('0xa0')][_0x055e('0x4c')](_0x7f03ed['toString'](),_0xc825b0)['then'](function(_0x35e203){var _0x27b463=_[_0x055e('0xb3')](_0x35e203,_0x055e('0xb4'));var _0xe63e29=[];_0x21ae7c[_0x055e('0x39')](function(_0x505cc4){_0xe63e29[_0x055e('0x3a')](updateChatInteraction(_0x505cc4,_0x393717,_0x27b463));});return BPromise[_0x055e('0xb5')](_0xe63e29);});});})[_0x055e('0x16')](function(_0x324a3d){_0x297edd[_0x055e('0xb6')]=_0x324a3d;return _0x297edd;})[_0x055e('0x16')](respondWithFilteredResult(_0x19e29c,_0x1f3c73))[_0x055e('0xb7')](handleError(_0x19e29c,null));};exports[_0x055e('0xb8')]=function(_0x207f31,_0x4abd2e){var _0x58bf27={'raw':![],'where':{'id':_0x207f31[_0x055e('0xb9')]['id']}},_0x478da3={};_0x478da3[_0x055e('0x4a')]=_[_0x055e('0x4b')](db['ChatInteraction'][_0x055e('0x46')]);_0x478da3[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x207f31[_0x055e('0x4c')]);_0x478da3[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],_0x478da3[_0x055e('0x4c')]);_0x58bf27['attributes']=_[_0x055e('0x4f')](_0x478da3[_0x055e('0x4a')],qs['fields'](_0x207f31['query'][_0x055e('0x50')]));_0x58bf27[_0x055e('0x4e')]=_0x58bf27[_0x055e('0x4e')][_0x055e('0x6b')]?_0x58bf27['attributes']:_0x478da3['model'];if(_0x207f31[_0x055e('0x4c')][_0x055e('0xba')]){_0x58bf27[_0x055e('0xbb')]=[{'all':!![]}];}_0x58bf27=_[_0x055e('0x2e')]({},_0x58bf27,_0x207f31[_0x055e('0xbc')]);return db['ChatInteraction'][_0x055e('0x6c')](_0x58bf27)[_0x055e('0x16')](handleEntityNotFound(_0x4abd2e,null))['then'](respondWithResult(_0x4abd2e,null))[_0x055e('0xb7')](handleError(_0x4abd2e,null));};exports['create']=function(_0x495d7d,_0x47f131){return db[_0x055e('0x45')][_0x055e('0xbd')](_0x495d7d['body'],{})[_0x055e('0x16')](respondWithResult(_0x47f131,0xc9))[_0x055e('0xb7')](handleError(_0x47f131,null));};exports['update']=function(_0xae5b5a,_0x5dffc3){if(_0xae5b5a[_0x055e('0x2f')]['id']){delete _0xae5b5a['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0xae5b5a[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5dffc3,null))['then'](saveUpdates(_0xae5b5a[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x5dffc3,null))['catch'](handleError(_0x5dffc3,null));};exports[_0x055e('0x2a')]=function(_0x116f84,_0x174a30){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x116f84[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x174a30,null))[_0x055e('0x16')](removeEntity(_0x174a30,null))[_0x055e('0xb7')](handleError(_0x174a30,null));};exports[_0x055e('0xbe')]=function(_0x1bd652,_0x32bf47){return db[_0x055e('0x45')][_0x055e('0xbe')]()[_0x055e('0x16')](respondWithResult(_0x32bf47,null))[_0x055e('0xb7')](handleError(_0x32bf47,null));};exports['createVidaooSession']=function(_0x2d5bf8,_0x484ee0){var _0x204fef=_0x2d5bf8[_0x055e('0xb9')]['id'];var _0x5ca835;var _0xfb3b6d;var _0x5ee76f;return db[_0x055e('0x45')]['findOne']({'where':{'id':_0x204fef}})[_0x055e('0x16')](function(_0x127c91){_0x5ca835=_0x127c91;return db['ChatWebsite'][_0x055e('0xbf')]({'where':{'id':_0x127c91[_0x055e('0x81')]},'attributes':['id',_0x055e('0xc0'),'vidaooEscalation',_0x055e('0xc1'),_0x055e('0xc2'),_0x055e('0xc3')],'raw':!![]});})[_0x055e('0x16')](function(_0x9d0c0f){if(_0x9d0c0f&&_0x9d0c0f[_0x055e('0xc0')]&&_0x9d0c0f['vidaooEscalation']){_0xfb3b6d=_0x9d0c0f;var _0x41b2af={'interaction':{'id':_0x204fef},'agent':{'id':_0x2d5bf8['user']['id'],'name':_0x2d5bf8[_0x055e('0x9c')][_0x055e('0x2c')],'fullname':_0x2d5bf8['user']['fullname'],'email':_0x2d5bf8[_0x055e('0x9c')]['email']},'contact':_0x2d5bf8['body'][_0x055e('0x30')],'account':_0x2d5bf8['body'][_0x055e('0x33')]};var _0x51c37b={'rejectUnauthorized':![],'method':_0x055e('0xc4'),'url':_0x055e('0xc5'),'headers':{'X-APIKEY':_0x9d0c0f[_0x055e('0xc0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2d5bf8[_0x055e('0x9c')][_0x055e('0xc6')]],'buttons':null,'topic':_0xfb3b6d['vidaooTopic'],'note':_['isNull'](_0xfb3b6d[_0x055e('0xc2')])?null:getMustacheRender(_0xfb3b6d[_0x055e('0xc2')],_0x41b2af),'metadata':null},'redirect':_0x055e('0xc7'),'json':!![]};try{if(!_[_0x055e('0xc8')](_0xfb3b6d['vidaooMetadata'])){var _0x2b4096=getMustacheRender(_0xfb3b6d[_0x055e('0xc3')],_0x41b2af);var _0x5ed6a5=JSON[_0x055e('0x85')](_0x2b4096);_0x51c37b[_0x055e('0x2f')][_0x055e('0xc9')]=_0x5ed6a5;}}catch(_0x45a14b){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x51c37b);}else{throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xcb'));}})['then'](function(_0x38a846){_0x5ee76f=_0x38a846;if(_0x5ee76f['id']){var _0x7d100={'body':_0x5ee76f[_0x055e('0xcc')],'ChatWebsiteId':_0xfb3b6d['id'],'ChatInteractionId':_0x5ca835['id'],'direction':'out','UserId':_0x2d5bf8['user']['id']};return db[_0x055e('0xcd')][_0x055e('0xbd')](_0x7d100,{});}else{throw new db['Sequelize']['ValidationError'](_0x055e('0xce'));}})['then'](function(){return _0x5ca835[_0x055e('0xcf')]({'vidaooSessionId':_0x5ee76f['id']});})[_0x055e('0x16')](respondWithResult(_0x484ee0,null))[_0x055e('0xb7')](handleError(_0x484ee0,null));};exports['customUpdate']=function(_0x1423f4,_0x31db97){if(_0x1423f4[_0x055e('0x2f')]['id']){delete _0x1423f4['body']['id'];}return db[_0x055e('0x45')]['find']({'where':{'id':_0x1423f4[_0x055e('0xb9')]['id']},'include':[{'model':db[_0x055e('0xd0')],'as':_0x055e('0x71')}]})[_0x055e('0x16')](handleEntityNotFound(_0x31db97,null))[_0x055e('0x16')](saveUpdates(_0x1423f4[_0x055e('0x2f')],null))[_0x055e('0x16')](respondWithResult(_0x31db97,null))[_0x055e('0xb7')](handleError(_0x31db97,null));};exports[_0x055e('0xd1')]=function(_0x2b3b85,_0xb88a07){if(_0x2b3b85['body']['id']){delete _0x2b3b85['body']['id'];}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2b3b85[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](function(_0x2704a1){if(!_0x2704a1){logger[_0x055e('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x055e('0xd1'),0x194,_0x055e('0xd2'));_0xb88a07[_0x055e('0x20')](0x194);}else{if(_0x2704a1[_0x055e('0x41')]){throw new db[(_0x055e('0x94'))][(_0x055e('0xca'))](_0x055e('0xd3'));}}return _0x2704a1;})[_0x055e('0x16')](function(_0x4900bc){if(_0x4900bc){return _0x4900bc[_0x055e('0x29')]({'closed':_0x2b3b85[_0x055e('0x2f')]['closed'],'disposition':_0x2b3b85[_0x055e('0x2f')][_0x055e('0x42')]})['then'](function(_0x2a3726){return _0x2a3726;});}})[_0x055e('0x16')](function(){return respondWithRpcPromise(_0x055e('0xd4'),'abandon',_0x2b3b85[_0x055e('0x2f')],client9004);})['then'](respondWithResult(_0xb88a07,null))['catch'](handleError(_0xb88a07,null));};exports[_0x055e('0xd5')]=function(_0x400ab5,_0x324439){_0x400ab5[_0x055e('0x2f')][_0x055e('0x2c')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd7')];_0x400ab5[_0x055e('0x2f')][_0x055e('0xd8')]=_0x400ab5[_0x055e('0xd6')][_0x055e('0xd9')];_0x400ab5[_0x055e('0x2f')]['type']=_0x400ab5[_0x055e('0xd6')][_0x055e('0xda')];return db[_0x055e('0xdb')][_0x055e('0xbd')](_0x400ab5[_0x055e('0x2f')])[_0x055e('0x16')](respondWithResult(_0x324439,0xc9))[_0x055e('0xb7')](handleError(_0x324439,null));};exports['attachmentDownload']=function(_0xfbb46b,_0x148aae){return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0xb9')]['id']},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null))[_0x055e('0x16')](function(_0x36ae94){if(_0x36ae94){if(_0x36ae94[_0x055e('0x40')]){return _0x148aae[_0x055e('0x21')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x055e('0xdb')][_0x055e('0xbf')]({'where':{'id':_0xfbb46b[_0x055e('0x4c')][_0x055e('0xdc')]},'raw':!![]})[_0x055e('0x16')](handleEntityNotFound(_0x148aae,null));}})['then'](function(_0xa60f8e){if(_0xa60f8e){var _0x115d2b=_0xa60f8e[_0x055e('0xdd')]!==null;var _0x1d00ab=path[_0x055e('0xde')](config['root'],_0x055e('0xdf'));if(_0x115d2b){_0x1d00ab=path[_0x055e('0xde')](_0x1d00ab,_0x055e('0xe0'));}var _0x444324=path[_0x055e('0xde')](_0x1d00ab,_0xa60f8e[_0x055e('0xd8')]);return _0x148aae[_0x055e('0xe1')](_0x444324);}})[_0x055e('0xb7')](handleError(_0x148aae,null));};exports[_0x055e('0xe2')]=function(_0x42077b,_0x6aeb60){var _0x5b00e4=null;var _0x2fb64a=null;var _0x4d3029=null;if(_0x42077b[_0x055e('0x2f')]['id']){delete _0x42077b[_0x055e('0x2f')]['id'];}if(_0x42077b['body']['mailTranscript']){_0x4d3029=path['join'](config[_0x055e('0xe3')],_0x055e('0xe4'),util['format'](_0x055e('0xe5'),Date[_0x055e('0xe6')]()));_0x42077b[_0x055e('0x2f')][_0x055e('0xe7')]=_0x4d3029;}return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x42077b['params']['id']},'include':[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'include':[{'model':db['User'],'as':_0x055e('0x7d')}]}]})[_0x055e('0x16')](handleEntityNotFound(_0x6aeb60,null))['then'](saveUpdates(_0x42077b[_0x055e('0x2f')],null))[_0x055e('0x16')](function(_0x49db7a){if(_0x49db7a){_0x5b00e4=_0x49db7a;return db[_0x055e('0xe9')]['find']({'where':{'id':_0x5b00e4[_0x055e('0x81')]}});}})['then'](function(_0xb60055){if(_0xb60055){_0x2fb64a=_0xb60055;return db['CmContact'][_0x055e('0x6c')]({'where':{'id':_0x5b00e4[_0x055e('0xea')]}});}})[_0x055e('0x16')](function(_0x25011f){if(_0x25011f){if(_0x4d3029){var _0xe83c1f=null;for(var _0x3084c7=0x1;_0x3084c7<_0x5b00e4[_0x055e('0xe8')][_0x055e('0x6b')];++_0x3084c7){_0xe83c1f=_0x5b00e4['Messages'][_0x3084c7];var _0x1dc506=_0xe83c1f['UserId']?util['format'](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');var _0x2c4cc6=_0x42077b[_0x055e('0x2f')][_0x055e('0xed')]||util[_0x055e('0xee')](_0x055e('0xeb'),_0x055e('0xef'),_0xe83c1f[_0x055e('0xea')]);switch(_0x2fb64a[_0x055e('0xf0')]){case'website_alias':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a[_0x055e('0xf1')],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');break;case _0x055e('0xf2'):_0x1dc506=_0xe83c1f['UserId']?_0xe83c1f[_0x055e('0x7d')][_0x055e('0xf3')]||_0xe83c1f['User']['fullname']:_0x055e('0xec');break;case'agent_fullname':_0x1dc506=_0xe83c1f[_0x055e('0x41')]?_0xe83c1f['User'][_0x055e('0x35')]:'System';break;default:_0x1dc506=_0xe83c1f[_0x055e('0x41')]?util[_0x055e('0xee')](_0x055e('0xeb'),_0x2fb64a['agentAlias'],_0xe83c1f[_0x055e('0x41')]):_0x055e('0xec');}var _0x43038c=util[_0x055e('0xee')](_0x055e('0xf4'),moment(_0xe83c1f[_0x055e('0x84')])[_0x055e('0xee')](_0x055e('0xf5')),_0xe83c1f[_0x055e('0xf6')]==='in'?_0x2c4cc6:_0x1dc506,_0xe83c1f['body']);if(!_0xe83c1f['secret']){fs[_0x055e('0xf7')](_0x4d3029,_0x43038c);}}return db[_0x055e('0xf8')][_0x055e('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0x055e('0xf9')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x055e('0xfa')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x055e('0x16')](function(_0x133c5a){if(!_0x133c5a||!_0x133c5a[_0x055e('0xfb')]||!_0x42077b[_0x055e('0x2f')])return _0x5b00e4;var _0x5c9dfb=_0x133c5a[_0x055e('0xfc')]();return respondWithRpcPromise(_0x055e('0xfd'),_0x055e('0xfe'),{'account':_0x5c9dfb,'message':{'from':util[_0x055e('0xee')](_0x055e('0xff'),_0x133c5a[_0x055e('0x2c')],_0x133c5a['email']||_0x133c5a[_0x055e('0xfb')][_0x055e('0x9c')]),'to':_0x42077b[_0x055e('0x2f')][_0x055e('0x100')],'subject':'Mail\x20Transcript','text':util[_0x055e('0xee')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x42077b['body'][_0x055e('0x100')]),'attachments':[{'path':_0x4d3029}]}})['then'](function(){return _0x5b00e4;})['catch'](function(_0x11025e){logger[_0x055e('0x1c')](_0x11025e);});})['then'](respondWithStatusCode(_0x6aeb60,0xc8))['catch'](handleError(_0x6aeb60,null));};exports[_0x055e('0x101')]=function(_0x1458fc,_0x5be45a){return db[_0x055e('0xcd')][_0x055e('0x6c')]({'where':{'id':_0x1458fc['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x5be45a,null))[_0x055e('0x16')](function(_0x1ac372){if(_0x1ac372){return _0x1ac372[_0x055e('0x101')](_0x1458fc[_0x055e('0x2f')][_0x055e('0x102')],_[_0x055e('0x103')](_0x1458fc['body'],[_0x055e('0x102'),'id'])||{});}})['then'](respondWithResult(_0x5be45a,null))['catch'](handleError(_0x5be45a,null));};exports[_0x055e('0x104')]=function(_0x3168db,_0x293731){var _0x3b58fa={'raw':![],'where':{}};var _0x47bc47={};var _0x5c9091={'count':0x0,'rows':[]};return db[_0x055e('0x45')][_0x055e('0xbf')]({'where':{'id':_0x3168db['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x293731,null))[_0x055e('0x16')](function(_0x5b3e5f){if(_0x5b3e5f){_0x47bc47[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x47bc47['query']=_[_0x055e('0x4b')](_0x3168db['query']);_0x47bc47[_0x055e('0x4d')]=_['intersection'](_0x47bc47['model'],_0x47bc47[_0x055e('0x4c')]);_0x3b58fa[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x47bc47[_0x055e('0x4a')],qs['fields'](_0x3168db[_0x055e('0x4c')]['fields']));_0x3b58fa['attributes']=_0x3b58fa[_0x055e('0x4e')][_0x055e('0x6b')]?_0x3b58fa[_0x055e('0x4e')]:_0x47bc47[_0x055e('0x4a')];if(!_0x3168db[_0x055e('0x4c')][_0x055e('0x51')]('nolimit')){_0x3b58fa[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x3168db[_0x055e('0x4c')][_0x055e('0x25')]);_0x3b58fa[_0x055e('0x23')]=qs['offset'](_0x3168db[_0x055e('0x4c')]['offset']);}_0x3b58fa['order']=qs[_0x055e('0x54')](_0x3168db['query'][_0x055e('0x54')]);_0x3b58fa[_0x055e('0x55')]=qs[_0x055e('0x4d')](_['pick'](_0x3168db[_0x055e('0x4c')],_0x47bc47[_0x055e('0x4d')]));_0x3b58fa['where'][_0x055e('0xb4')]=_0x5b3e5f['id'];if(_0x3168db[_0x055e('0x4c')][_0x055e('0x8e')]){_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],{'$or':_[_0x055e('0x34')](_0x3b58fa[_0x055e('0x4e')],function(_0x2a9661){var _0x5e7e2e={};_0x5e7e2e[_0x2a9661]={'$like':'%'+_0x3168db['query']['filter']+'%'};return _0x5e7e2e;})});}if(_0x3168db['query'][_0x055e('0x105')]){var _0x496b08=_0x3168db[_0x055e('0x4c')]['$gte']['split'](',');var _0x366512={};_0x366512[_0x496b08[0x0]]={'$gte':moment(_0x496b08[0x1])[_0x055e('0xee')](_0x055e('0x106'))};_0x3b58fa[_0x055e('0x55')]=_[_0x055e('0x2e')](_0x3b58fa[_0x055e('0x55')],_0x366512);}_0x3b58fa=_['merge']({},_0x3b58fa,_0x3168db['options']);return db[_0x055e('0xcd')][_0x055e('0x26')]({'where':_0x3b58fa[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x56456b){_0x5c9091[_0x055e('0x26')]=_0x56456b;if(_0x3168db[_0x055e('0x4c')][_0x055e('0xba')]){_0x3b58fa[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0x3b58fa);})[_0x055e('0x16')](function(_0x5ad564){_0x5c9091[_0x055e('0xb6')]=_0x5ad564;return _0x5c9091;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x293731,_0x3b58fa))[_0x055e('0xb7')](handleError(_0x293731,null));};exports[_0x055e('0x108')]=function(_0x52414e,_0x1b69f8){var _0xdaddd0={'where':{}},_0x5b7239={},_0x456ce6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x055e('0xbf')]({'where':{'id':_0x52414e[_0x055e('0xb9')]['id']}})['then'](handleEntityNotFound(_0x1b69f8,null))['then'](function(_0x3f6e40){if(_0x3f6e40){_0x5b7239[_0x055e('0x4a')]=_[_0x055e('0x4b')](db[_0x055e('0xcd')]['rawAttributes']);_0x5b7239[_0x055e('0x4c')]=_[_0x055e('0x4b')](_0x52414e['query']);_0x5b7239[_0x055e('0x4d')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],_0x5b7239[_0x055e('0x4c')]);_0xdaddd0[_0x055e('0x4e')]=_[_0x055e('0x4f')](_0x5b7239[_0x055e('0x4a')],qs['fields'](_0x52414e[_0x055e('0x4c')][_0x055e('0x50')]));_0xdaddd0['attributes']=_0xdaddd0['attributes'][_0x055e('0x6b')]?_0xdaddd0[_0x055e('0x4e')]:_0x5b7239['model'];if(!_0x52414e['query']['hasOwnProperty'](_0x055e('0x52'))){_0xdaddd0[_0x055e('0x25')]=qs[_0x055e('0x25')](_0x52414e[_0x055e('0x4c')]['limit']);_0xdaddd0[_0x055e('0x23')]=qs[_0x055e('0x23')](_0x52414e[_0x055e('0x4c')][_0x055e('0x23')]);}_0xdaddd0[_0x055e('0x53')]=qs[_0x055e('0x54')](_0x52414e[_0x055e('0x4c')][_0x055e('0x54')]);_0xdaddd0[_0x055e('0x55')]=qs[_0x055e('0x4d')](_[_0x055e('0x109')](_0x52414e['query'],_0x5b7239[_0x055e('0x4d')]));_0xdaddd0[_0x055e('0x55')][_0x055e('0xb4')]=_0x3f6e40['id'];if(_0x52414e[_0x055e('0x4c')]['filter']){_0xdaddd0['where']=_['merge'](_0xdaddd0['where'],{'$or':_['map'](_0xdaddd0['attributes'],function(_0x348631){var _0x57d1a6={};_0x57d1a6[_0x348631]={'$like':'%'+_0x52414e['query']['filter']+'%'};return _0x57d1a6;})});}_0xdaddd0['where'][_0x055e('0x10a')]=![];if(_0x52414e['query']['id']){_0xdaddd0[_0x055e('0x55')]['id']={'$gt':_0x52414e['query']['id']};}_0xdaddd0=_[_0x055e('0x2e')]({},_0xdaddd0,_0x52414e['options']);return db[_0x055e('0xcd')]['count']({'where':_0xdaddd0[_0x055e('0x55')]})[_0x055e('0x16')](function(_0x411090){_0x456ce6['count']=_0x411090;_0xdaddd0[_0x055e('0xbb')]=[];if(_0x52414e['query'][_0x055e('0x10b')]){_0xdaddd0[_0x055e('0xbb')][_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id','fullname',_0x055e('0xf3')]});}if(_0x52414e['query'][_0x055e('0xba')]){_0xdaddd0[_0x055e('0xbb')]=[{'all':!![]}];}return db[_0x055e('0xcd')][_0x055e('0x107')](_0xdaddd0);})['then'](function(_0x597e1d){_0x456ce6[_0x055e('0xb6')]=_0x597e1d;return _0x456ce6;});}})[_0x055e('0x16')](respondWithFilteredResult(_0x1b69f8,_0xdaddd0))[_0x055e('0xb7')](handleError(_0x1b69f8,null));};exports[_0x055e('0x10c')]=function(_0x5c7de1,_0x1f14d1){return db['ChatInteraction'][_0x055e('0x6c')]({'where':{'id':_0x5c7de1[_0x055e('0xb9')]['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x1f14d1,null))[_0x055e('0x16')](function(_0x419b3d){if(_0x419b3d){return _0x419b3d[_0x055e('0x10d')](_0x5c7de1['body'][_0x055e('0x102')],_[_0x055e('0x103')](_0x5c7de1[_0x055e('0x2f')],['ids','id'])||{})[_0x055e('0x10e')](function(){return db[_0x055e('0x7b')][_0x055e('0x107')]({'attributes':['id',_0x055e('0x2c'),'color'],'where':{'id':_0x5c7de1[_0x055e('0x2f')]['ids']}});})[_0x055e('0x16')](function(_0x342b10){socket[_0x055e('0x10f')](_0x055e('0x110'),{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]});return{'id':Number(_0x5c7de1[_0x055e('0xb9')]['id']),'tags':_0x342b10||[]};});}})['then'](respondWithResult(_0x1f14d1,null))[_0x055e('0xb7')](handleError(_0x1f14d1,null));};exports[_0x055e('0x111')]=function(_0x2fdf9b,_0x27e111){return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x2fdf9b['params']['id']}})[_0x055e('0x16')](handleEntityNotFound(_0x27e111,null))['then'](function(_0x1feb0f){if(_0x1feb0f){return _0x1feb0f[_0x055e('0x111')](_0x2fdf9b[_0x055e('0x4c')]['ids']);}})[_0x055e('0x16')](respondWithStatusCode(_0x27e111,null))[_0x055e('0xb7')](handleError(_0x27e111,null));};exports['download']=function(_0x199b86,_0x4c8dcf){var _0x433494=moment()[_0x055e('0x112')]()[_0x055e('0xa1')]();var _0x2c1052=path[_0x055e('0xde')](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x115'));var _0xebbb8c=path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x114'),_0x055e('0x116'));var _0x43cf78=path[_0x055e('0xde')](_0x2c1052,_0x433494);var _0x3b27ba=util[_0x055e('0xee')](_0x055e('0x117'),_0x199b86[_0x055e('0xb9')]['id'],_0x433494);var _0x56cd75=path[_0x055e('0xde')](_0x2c1052,_0x3b27ba);var _0xc967a1=[];_0xc967a1[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x7d'),'attributes':['id',_0x055e('0x35')],'raw':!![]});_0xc967a1[_0x055e('0x3a')]({'model':db['CmContact'],'as':_0x055e('0x71'),'attributes':['id',_0x055e('0x118'),'lastName'],'raw':!![]});if(_0x199b86[_0x055e('0x4c')][_0x055e('0x116')]){_0xc967a1['push']({'model':db[_0x055e('0xdb')],'as':_0x055e('0xdb'),'raw':!![]});}var _0x41313e=[{'model':db[_0x055e('0xcd')],'as':_0x055e('0xe8'),'attributes':['id',_0x055e('0x2f'),_0x055e('0x84'),'direction',_0x055e('0x10a'),_0x055e('0x89')],'include':_0xc967a1}];_0x41313e['push']({'model':db[_0x055e('0xe9')],'as':_0x055e('0x119'),'attributes':['id','name']});_0x41313e[_0x055e('0x3a')]({'model':db[_0x055e('0x7d')],'as':_0x055e('0x11a'),'attributes':['id',_0x055e('0x35')]});return db[_0x055e('0x45')][_0x055e('0x6c')]({'where':{'id':_0x199b86['params']['id']},'include':_0x41313e})['then'](handleEntityNotFound(_0x4c8dcf,null))['then'](function(_0x43b91c){if(_0x43b91c){var _0x26028f=_0x43b91c['get']({'plain':!![]});fs[_0x055e('0x11b')](_0x43cf78);var _0x1167e6={'channel':_0x055e('0x11c'),'account':_0x26028f[_0x055e('0x119')][_0x055e('0x2c')],'agent':_0x26028f[_0x055e('0x11a')]?_0x26028f[_0x055e('0x11a')]['fullname']:'N.A.','createdAt':moment(_0x26028f[_0x055e('0x84')])['format'](_0x055e('0x106'))[_0x055e('0xa1')](),'closedAt':_0x26028f['closed']?moment(_0x26028f['closedAt'])[_0x055e('0xee')](_0x055e('0x106'))['toString']():'','disposition':_0x26028f[_0x055e('0x42')],'chatInfo':{'browser':_0x26028f['browserName'],'os':_0x26028f['osName'],'referer':_0x26028f[_0x055e('0x11d')],'customerIp':_0x26028f[_0x055e('0x11e')],'customerPort':_0x26028f[_0x055e('0x11f')]?_0x26028f[_0x055e('0x11f')]:_0x055e('0x120')},'messages':_(_0x26028f[_0x055e('0xe8')])[_0x055e('0x121')]()[_0x055e('0x8e')]({'secret':![]})['map'](function(_0x45acae){if(_0x45acae[_0x055e('0xdb')]){var _0x1b3fc7=path[_0x055e('0xde')](_0xebbb8c,_0x45acae['Attachment'][_0x055e('0xd8')]);if(fs[_0x055e('0x122')](_0x1b3fc7)){fs[_0x055e('0x123')](_0x1b3fc7)['pipe'](fs[_0x055e('0x124')](path[_0x055e('0xde')](_0x43cf78,_0x45acae[_0x055e('0xdb')]['basename'])));}}return{'date':moment(_0x45acae['createdAt'])[_0x055e('0xee')](_0x055e('0x106'))[_0x055e('0xa1')](),'sender':_0x45acae['direction']===_0x055e('0x125')?_0x45acae[_0x055e('0x7d')]?_0x45acae['User'][_0x055e('0x35')]:_0x055e('0xec'):_0x45acae[_0x055e('0x71')][_0x055e('0x118')]+(_0x45acae[_0x055e('0x71')][_0x055e('0x126')]?'\x20'+_0x45acae[_0x055e('0x71')][_0x055e('0x126')]:''),'body':_0x45acae['Attachment']?_0x45acae[_0x055e('0xdb')][_0x055e('0xd8')]:_0x45acae[_0x055e('0x2f')],'direction':_0x45acae[_0x055e('0xf6')]===_0x055e('0x125')?'A':'C','secret':_0x45acae[_0x055e('0x10a')],'read':_0x45acae[_0x055e('0x89')],'attachment':_0x45acae[_0x055e('0xdb')]};})['value']()};return ejs[_0x055e('0x127')](path['join'](config[_0x055e('0xe3')],_0x055e('0x113'),_0x055e('0x128'),_0x055e('0x129')),{'interaction':_0x1167e6})[_0x055e('0x16')](function(_0x1990c8){var _0x45b0dd=path[_0x055e('0xde')](_0x43cf78,_0x055e('0x12a')+_0x26028f['id']+'-'+_0x433494+_0x055e('0x12b'));var _0x4fac37={'path':_0x45b0dd,'channel':_0x055e('0x11c'),'interactionId':_0x26028f['id']};return pdf['createPdfFromHTML'](_0x1990c8,_0x4fac37);})['then'](function(){return new Promise(function(_0x551a21,_0x365f1c){zipdir(_0x43cf78,{'saveTo':_0x56cd75},function(_0x2bd1a9,_0x2a888e){if(_0x2bd1a9)return _0x365f1c(_0x2bd1a9);return _0x551a21(_0x2a888e);});})[_0x055e('0x16')](function(){return new BPromise(function(_0x3420fc,_0x9b5222){rimraf(_0x43cf78,function(_0xce341b){if(_0xce341b)_0x9b5222(_0xce341b);return _0x3420fc();});});})['then'](function(){return _0x4c8dcf[_0x055e('0xe1')](_0x56cd75,_0x3b27ba,function(_0x8509c7){if(_0x8509c7){logger['error'](_0x055e('0x12c'),_0x8509c7);}else{fs[_0x055e('0x12d')](_0x56cd75);}});});});}else{return _0x4c8dcf[_0x055e('0x20')](0xc8);}})[_0x055e('0xb7')](handleError(_0x4c8dcf,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 2915bf5..0ea600f 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 _0x60e0=['../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','events'];(function(_0x80d57,_0x20ae16){var _0x37381d=function(_0x5b3f32){while(--_0x5b3f32){_0x80d57['push'](_0x80d57['shift']());}};_0x37381d(++_0x20ae16);}(_0x60e0,0x12b));var _0x060e=function(_0x104aed,_0x4c7f3f){_0x104aed=_0x104aed-0x0;var _0x31da6a=_0x60e0[_0x104aed];return _0x31da6a;};'use strict';var EventEmitter=require(_0x060e('0x0'));var ChatInteraction=require(_0x060e('0x1'))['db'][_0x060e('0x2')];var ChatMessage=require(_0x060e('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x060e('0x3')](0x0);var events={'afterCreate':_0x060e('0x4'),'afterUpdate':'update','afterDestroy':_0x060e('0x5')};function emitEvent(_0x1d9d0e){return function(_0x28ae80,_0x11f887,_0xff3353){_0x28ae80[_0x060e('0x6')]({'attributes':['id'],'raw':!![]})[_0x060e('0x7')](function(_0x457359){_0x28ae80[_0x060e('0x8')](_0x060e('0x9'),_0x457359['map'](function(_0x409599){return{'id':_0x409599['id']};}));return ChatMessage[_0x060e('0xa')]({'where':{'ChatInteractionId':_0x28ae80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e65f4){_0x28ae80[_0x060e('0x8')]('unreadMessages',_0x2e65f4[_0x060e('0xb')]);ChatInteractionEvents[_0x060e('0xc')](_0x1d9d0e+':'+_0x28ae80['id'],_0x28ae80);ChatInteractionEvents['emit'](_0x1d9d0e,_0x28ae80);_0xff3353(null);})['catch'](_0xff3353(null));};}for(var e in events){if(events[_0x060e('0xd')](e)){var event=events[e];ChatInteraction[_0x060e('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xb558=['ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','then','length','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction'];(function(_0x3a0019,_0x393997){var _0x135e81=function(_0x2ee99a){while(--_0x2ee99a){_0x3a0019['push'](_0x3a0019['shift']());}};_0x135e81(++_0x393997);}(_0xb558,0x11d));var _0x8b55=function(_0x3470bb,_0x34e3de){_0x3470bb=_0x3470bb-0x0;var _0x51fe56=_0xb558[_0x3470bb];return _0x51fe56;};'use strict';var EventEmitter=require(_0x8b55('0x0'));var ChatInteraction=require(_0x8b55('0x1'))['db'][_0x8b55('0x2')];var ChatMessage=require(_0x8b55('0x1'))['db'][_0x8b55('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b55('0x4')](0x0);var events={'afterCreate':_0x8b55('0x5'),'afterUpdate':_0x8b55('0x6'),'afterDestroy':_0x8b55('0x7')};function emitEvent(_0x14f451){return function(_0x5cd075,_0x1186b0,_0x51f856){_0x5cd075[_0x8b55('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x72e5f5){_0x5cd075[_0x8b55('0x9')]('Users',_0x72e5f5[_0x8b55('0xa')](function(_0xca360f){return{'id':_0xca360f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5cd075['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b55('0xb')](function(_0x2ee81d){_0x5cd075[_0x8b55('0x9')]('unreadMessages',_0x2ee81d[_0x8b55('0xc')]);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451+':'+_0x5cd075['id'],_0x5cd075);ChatInteractionEvents[_0x8b55('0xd')](_0x14f451,_0x5cd075);_0x51f856(null);})['catch'](_0x51f856(null));};}for(var e in events){if(events[_0x8b55('0xe')](e)){var event=events[e];ChatInteraction[_0x8b55('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d8552bd..68e4908 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 _0x5cfb=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','path','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed'];(function(_0xd692d4,_0x52efa4){var _0x567410=function(_0x478d92){while(--_0x478d92){_0xd692d4['push'](_0xd692d4['shift']());}};_0x567410(++_0x52efa4);}(_0x5cfb,0xaa));var _0xb5cf=function(_0x1ba6ad,_0x13e6e9){_0x1ba6ad=_0x1ba6ad-0x0;var _0x3cf481=_0x5cfb[_0x1ba6ad];return _0x3cf481;};'use strict';var _=require(_0xb5cf('0x0'));var util=require(_0xb5cf('0x1'));var logger=require('../../config/logger')(_0xb5cf('0x2'));var moment=require('moment');var BPromise=require(_0xb5cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5cf('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb5cf('0x5'));module['exports']=function(_0x313562,_0x29bd83){return _0x313562[_0xb5cf('0x6')](_0xb5cf('0x7'),attributes,{'tableName':_0xb5cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bba55,_0x2189de,_0x3bfa10){if(_0x4bba55['changed'](_0xb5cf('0x9'))){_0x4bba55[_0xb5cf('0xa')]=moment()[_0xb5cf('0xb')](_0xb5cf('0xc'));}_0x3bfa10(null,_0x4bba55);}},'charset':_0xb5cf('0xd'),'collate':_0xb5cf('0xe')});}; \ No newline at end of file +var _0x5539=['chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x44eb28,_0x4c4308){var _0x4da0d9=function(_0x2e5c21){while(--_0x2e5c21){_0x44eb28['push'](_0x44eb28['shift']());}};_0x4da0d9(++_0x4c4308);}(_0x5539,0x97));var _0x9553=function(_0x7dd4f6,_0x25fd40){_0x7dd4f6=_0x7dd4f6-0x0;var _0x10809e=_0x5539[_0x7dd4f6];return _0x10809e;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var logger=require(_0x9553('0x2'))(_0x9553('0x3'));var moment=require(_0x9553('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9553('0x5'));var rimraf=require(_0x9553('0x6'));var config=require(_0x9553('0x7'));var attributes=require(_0x9553('0x8'));module[_0x9553('0x9')]=function(_0x4ebf20,_0xa886ac){return _0x4ebf20[_0x9553('0xa')]('ChatInteraction',attributes,{'tableName':_0x9553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41fb17,_0x1d5a47,_0x3412c0){if(_0x41fb17[_0x9553('0xc')](_0x9553('0xd'))){_0x41fb17[_0x9553('0xe')]=moment()[_0x9553('0xf')](_0x9553('0x10'));}_0x3412c0(null,_0x41fb17);}},'charset':'utf8mb4','collate':_0x9553('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 380c3d5..d2c2088 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 _0x57e3=['attributes','limit','AddTagsToChatInteraction','find','where','addTags','omit','info','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57e3,0xb1));var _0x357e=function(_0x188aa0,_0x109706){_0x188aa0=_0x188aa0-0x0;var _0x6528e5=_0x57e3[_0x188aa0];return _0x6528e5;};'use strict';var _=require('lodash');var util=require(_0x357e('0x0'));var moment=require(_0x357e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x357e('0x2'));var db=require(_0x357e('0x3'))['db'];var utils=require(_0x357e('0x4'));var logger=require(_0x357e('0x5'))(_0x357e('0x6'));var config=require(_0x357e('0x7'));var jayson=require(_0x357e('0x8'));var client=jayson[_0x357e('0x9')][_0x357e('0xa')]({'port':0x232a});config[_0x357e('0xb')]=_['defaults'](config[_0x357e('0xb')],{'host':_0x357e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x357e('0xb')]));require(_0x357e('0xd'))[_0x357e('0xe')](socket);function respondWithRpcPromise(_0x59e7ec,_0x466802,_0x1c5966){return new BPromise(function(_0x249dba,_0x33697e){return client[_0x357e('0xf')](_0x59e7ec,_0x1c5966)[_0x357e('0x10')](function(_0x43bede){logger['info'](_0x357e('0x11'),_0x466802,_0x357e('0x12'));logger[_0x357e('0x13')](_0x357e('0x14'),_0x466802,'request\x20sent',JSON[_0x357e('0x15')](_0x43bede));if(_0x43bede[_0x357e('0x16')]){if(_0x43bede[_0x357e('0x16')][_0x357e('0x17')]===0x1f4){logger[_0x357e('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x466802,_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);return _0x33697e(_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x466802,_0x43bede['error']['message']);return _0x249dba(_0x43bede[_0x357e('0x16')][_0x357e('0x18')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x466802,'request\x20sent');_0x249dba(_0x43bede[_0x357e('0x19')][_0x357e('0x18')]);}})[_0x357e('0x1a')](function(_0x33abac){logger['error'](_0x357e('0x11'),_0x466802,_0x33abac);_0x33697e(_0x33abac);});});}exports[_0x357e('0x1b')]=function(_0x2b7bb8){var _0x3be5ba=this;return new Promise(function(_0x433a76,_0x1e1caf){return db[_0x357e('0x1c')][_0x357e('0x1d')](_0x2b7bb8[_0x357e('0x1e')],{'raw':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8['options'][_0x357e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8[_0x357e('0x1f')]['where']||null:null,'attributes':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8['options'][_0x357e('0x21')]||null:null,'limit':_0x2b7bb8[_0x357e('0x1f')]?_0x2b7bb8[_0x357e('0x1f')][_0x357e('0x22')]||null:null})[_0x357e('0x10')](function(_0x1543df){logger['info'](_0x357e('0x1b'),_0x2b7bb8);logger[_0x357e('0x13')](_0x357e('0x1b'),_0x2b7bb8,JSON['stringify'](_0x1543df));_0x433a76(_0x1543df);})[_0x357e('0x1a')](function(_0x4fc5cd){logger[_0x357e('0x16')](_0x357e('0x1b'),_0x4fc5cd['message'],_0x2b7bb8);_0x1e1caf(_0x3be5ba[_0x357e('0x16')](0x1f4,_0x4fc5cd[_0x357e('0x18')]));});});};exports[_0x357e('0x23')]=function(_0x3ad75c){return new Promise(function(_0x24da7e,_0x25feaa){return db[_0x357e('0x1c')][_0x357e('0x24')]({'where':_0x3ad75c['options']?_0x3ad75c['options'][_0x357e('0x25')]||null:null})[_0x357e('0x10')](function(_0x4ff253){if(_0x4ff253){return _0x4ff253[_0x357e('0x26')](_0x3ad75c[_0x357e('0x1e')]['ids'],_[_0x357e('0x27')](_0x3ad75c[_0x357e('0x1e')],['ids','id'])||{});}})['spread'](function(_0x160077){logger[_0x357e('0x28')](_0x357e('0x29'),_0x3ad75c);logger['debug'](_0x357e('0x29'),_0x3ad75c,JSON[_0x357e('0x15')](_0x160077));_0x24da7e(_0x160077);})[_0x357e('0x1a')](function(_0x571bc0){logger[_0x357e('0x16')](_0x357e('0x29'),_0x571bc0[_0x357e('0x18')],_0x3ad75c);_0x25feaa(_this[_0x357e('0x16')](0x1f4,_0x571bc0['message']));});});}; \ No newline at end of file +var _0x2e38=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','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','options','raw','where','attributes','then','AddTagsToChatInteraction','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x456f1c,_0x4453d5){var _0x51918c=function(_0x12ce55){while(--_0x12ce55){_0x456f1c['push'](_0x456f1c['shift']());}};_0x51918c(++_0x4453d5);}(_0x2e38,0x1be));var _0x82e3=function(_0x4c9ee6,_0x90caf9){_0x4c9ee6=_0x4c9ee6-0x0;var _0x130ee8=_0x2e38[_0x4c9ee6];return _0x130ee8;};'use strict';var _=require(_0x82e3('0x0'));var util=require(_0x82e3('0x1'));var moment=require('moment');var BPromise=require(_0x82e3('0x2'));var rs=require(_0x82e3('0x3'));var fs=require('fs');var Redis=require(_0x82e3('0x4'));var db=require(_0x82e3('0x5'))['db'];var utils=require(_0x82e3('0x6'));var logger=require(_0x82e3('0x7'))(_0x82e3('0x8'));var config=require(_0x82e3('0x9'));var jayson=require(_0x82e3('0xa'));var client=jayson[_0x82e3('0xb')][_0x82e3('0xc')]({'port':0x232a});config[_0x82e3('0xd')]=_['defaults'](config[_0x82e3('0xd')],{'host':_0x82e3('0xe'),'port':0x18eb});var socket=require(_0x82e3('0xf'))(new Redis(config[_0x82e3('0xd')]));require(_0x82e3('0x10'))[_0x82e3('0x11')](socket);function respondWithRpcPromise(_0xd16f14,_0x40bf12,_0x56e175){return new BPromise(function(_0x47290,_0x4e8cd4){return client[_0x82e3('0x12')](_0xd16f14,_0x56e175)['then'](function(_0x46dfc3){logger['info'](_0x82e3('0x13'),_0x40bf12,_0x82e3('0x14'));logger[_0x82e3('0x15')](_0x82e3('0x16'),_0x40bf12,_0x82e3('0x14'),JSON[_0x82e3('0x17')](_0x46dfc3));if(_0x46dfc3[_0x82e3('0x18')]){if(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x19')]===0x1f4){logger['error'](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x4e8cd4(_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);}logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x46dfc3[_0x82e3('0x18')][_0x82e3('0x1a')]);return _0x47290(_0x46dfc3[_0x82e3('0x18')]['message']);}else{logger[_0x82e3('0x1b')](_0x82e3('0x13'),_0x40bf12,'request\x20sent');_0x47290(_0x46dfc3[_0x82e3('0x1c')]['message']);}})[_0x82e3('0x1d')](function(_0x3781c5){logger[_0x82e3('0x18')](_0x82e3('0x13'),_0x40bf12,_0x3781c5);_0x4e8cd4(_0x3781c5);});});}exports[_0x82e3('0x1e')]=function(_0x707dc8){var _0x470711=this;return new Promise(function(_0x28bfba,_0x2bfc32){return db[_0x82e3('0x1f')][_0x82e3('0x20')](_0x707dc8['body'],{'raw':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x23')]||null:null,'attributes':_0x707dc8[_0x82e3('0x21')]?_0x707dc8[_0x82e3('0x21')][_0x82e3('0x24')]||null:null,'limit':_0x707dc8['options']?_0x707dc8[_0x82e3('0x21')]['limit']||null:null})[_0x82e3('0x25')](function(_0x45756c){logger[_0x82e3('0x1b')]('UpdateChatInteraction',_0x707dc8);logger[_0x82e3('0x15')](_0x82e3('0x1e'),_0x707dc8,JSON['stringify'](_0x45756c));_0x28bfba(_0x45756c);})['catch'](function(_0x12449b){logger[_0x82e3('0x18')](_0x82e3('0x1e'),_0x12449b['message'],_0x707dc8);_0x2bfc32(_0x470711['error'](0x1f4,_0x12449b[_0x82e3('0x1a')]));});});};exports[_0x82e3('0x26')]=function(_0x3efef6){return new Promise(function(_0x49da7a,_0x43918b){return db[_0x82e3('0x1f')]['find']({'where':_0x3efef6[_0x82e3('0x21')]?_0x3efef6['options'][_0x82e3('0x23')]||null:null})[_0x82e3('0x25')](function(_0x33b764){if(_0x33b764){return _0x33b764[_0x82e3('0x27')](_0x3efef6[_0x82e3('0x28')][_0x82e3('0x29')],_[_0x82e3('0x2a')](_0x3efef6[_0x82e3('0x28')],[_0x82e3('0x29'),'id'])||{});}})[_0x82e3('0x2b')](function(_0x37d4dc){logger['info'](_0x82e3('0x2c'),_0x3efef6);logger[_0x82e3('0x15')]('AddTags',_0x3efef6,JSON[_0x82e3('0x17')](_0x37d4dc));_0x49da7a(_0x37d4dc);})[_0x82e3('0x1d')](function(_0x435c29){logger[_0x82e3('0x18')](_0x82e3('0x2c'),_0x435c29['message'],_0x3efef6);_0x43918b(_this[_0x82e3('0x18')](0x1f4,_0x435c29['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c343ce3..eb753c4 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 _0x2a8f=['remove','update','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4f1482,_0x3309a2){var _0x512d2b=function(_0x3459d8){while(--_0x3459d8){_0x4f1482['push'](_0x4f1482['shift']());}};_0x512d2b(++_0x3309a2);}(_0x2a8f,0x16d));var _0xf2a8=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x2a8f[_0x2b9b7f];return _0x4ed19a;};'use strict';var ChatInteractionEvents=require(_0xf2a8('0x0'));var events=['save',_0xf2a8('0x1'),_0xf2a8('0x2')];function createListener(_0x1e1823,_0x471b01){return function(_0x5f184e){_0x471b01['emit'](_0x1e1823,_0x5f184e);};}function removeListener(_0x1a0472,_0x52c491){return function(){ChatInteractionEvents['removeListener'](_0x1a0472,_0x52c491);};}exports[_0xf2a8('0x3')]=function(_0x1ba3d0){for(var _0x294dd9=0x0,_0x16d713=events[_0xf2a8('0x4')];_0x294dd9<_0x16d713;_0x294dd9++){var _0x3e811a=events[_0x294dd9];var _0x23874a=createListener(_0xf2a8('0x5')+_0x3e811a,_0x1ba3d0);ChatInteractionEvents['on'](_0x3e811a,_0x23874a);}}; \ No newline at end of file +var _0x4349=['update','emit','length','chatInteraction:','save'];(function(_0x4ba1e7,_0x23b5ef){var _0xafdfb6=function(_0x1c6ca8){while(--_0x1c6ca8){_0x4ba1e7['push'](_0x4ba1e7['shift']());}};_0xafdfb6(++_0x23b5ef);}(_0x4349,0x1c6));var _0x9434=function(_0x4c6327,_0xcbdd4b){_0x4c6327=_0x4c6327-0x0;var _0x3c8bc1=_0x4349[_0x4c6327];return _0x3c8bc1;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x9434('0x0'),'remove',_0x9434('0x1')];function createListener(_0x428503,_0x2ef439){return function(_0x2c46cc){_0x2ef439[_0x9434('0x2')](_0x428503,_0x2c46cc);};}function removeListener(_0x15817c,_0x46c92d){return function(){ChatInteractionEvents['removeListener'](_0x15817c,_0x46c92d);};}exports['register']=function(_0xa89207){for(var _0x5b80b0=0x0,_0x29a394=events[_0x9434('0x3')];_0x5b80b0<_0x29a394;_0x5b80b0++){var _0x24af73=events[_0x5b80b0];var _0x4270b1=createListener(_0x9434('0x4')+_0x24af73,_0xa89207);ChatInteractionEvents['on'](_0x24af73,_0x4270b1);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 21fcf05..cbd981f 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 _0xc9f6=['join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage'];(function(_0x40a30e,_0x5af2e6){var _0x4e6ef5=function(_0x521bbb){while(--_0x521bbb){_0x40a30e['push'](_0x40a30e['shift']());}};_0x4e6ef5(++_0x5af2e6);}(_0xc9f6,0x83));var _0x6c9f=function(_0x1e0a3a,_0x3135fc){_0x1e0a3a=_0x1e0a3a-0x0;var _0x1a426d=_0xc9f6[_0x1e0a3a];return _0x1a426d;};'use strict';var multer=require(_0x6c9f('0x0'));var util=require(_0x6c9f('0x1'));var path=require(_0x6c9f('0x2'));var timeout=require(_0x6c9f('0x3'));var express=require('express');var router=express[_0x6c9f('0x4')]();var fs_extra=require(_0x6c9f('0x5'));var auth=require(_0x6c9f('0x6'));var interaction=require(_0x6c9f('0x7'));var config=require(_0x6c9f('0x8'));var controller=require(_0x6c9f('0x9'));router[_0x6c9f('0xa')]('/',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0xc')]);router[_0x6c9f('0xa')]('/describe',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0xd')]);router['get']('/:id',auth[_0x6c9f('0xe')](),controller[_0x6c9f('0xf')]);router[_0x6c9f('0xa')](_0x6c9f('0x10'),auth[_0x6c9f('0xe')](),controller['attachmentDownload']);router['get']('/:id/messages',auth[_0x6c9f('0xb')](),controller['getMessages']);router[_0x6c9f('0xa')](_0x6c9f('0x11'),auth[_0x6c9f('0xe')](),controller[_0x6c9f('0x12')]);router[_0x6c9f('0xa')]('/:id/download',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x13')]);router[_0x6c9f('0x14')]('/',auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x15')]);router[_0x6c9f('0x14')](_0x6c9f('0x16'),auth[_0x6c9f('0xb')](),controller[_0x6c9f('0x17')]);var upload=multer({'storage':multer[_0x6c9f('0x18')]({'destination':function(_0x2ec8c5,_0x55d1df,_0x322b13){_0x322b13(null,path[_0x6c9f('0x19')](config[_0x6c9f('0x1a')],_0x6c9f('0x1b')));},'filename':function(_0x348883,_0x444e4a,_0x3f39e2){_0x3f39e2(null,util['format'](_0x6c9f('0x1c'),Date[_0x6c9f('0x1d')](),_0x444e4a[_0x6c9f('0x1e')][_0x6c9f('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c9f('0x14')]('/:id/attachment_upload',upload[_0x6c9f('0x20')](_0x6c9f('0x21')),controller[_0x6c9f('0x22')]);router[_0x6c9f('0x14')](_0x6c9f('0x23'),auth['isChatInteractionAuthorized'](),controller[_0x6c9f('0x24')]);router[_0x6c9f('0x14')](_0x6c9f('0x25'),auth['isAuthenticated'](),interaction[_0x6c9f('0x26')](_0x6c9f('0x27'),_0x6c9f('0x28')),controller[_0x6c9f('0x29')]);router[_0x6c9f('0x2a')]('/:id',auth[_0x6c9f('0xb')](),interaction[_0x6c9f('0x26')]('chat','chatinteraction:update'),controller[_0x6c9f('0x2b')]);router['put'](_0x6c9f('0x2c'),controller['customUpdate']);router['put'](_0x6c9f('0x2d'),auth[_0x6c9f('0xe')](),controller[_0x6c9f('0x2e')]);router[_0x6c9f('0x2a')](_0x6c9f('0x2f'),controller['close']);router[_0x6c9f('0x30')]('/:id',auth[_0x6c9f('0xb')](),interaction[_0x6c9f('0x26')](_0x6c9f('0x27'),_0x6c9f('0x31')),controller[_0x6c9f('0x32')]);router[_0x6c9f('0x30')](_0x6c9f('0x25'),auth['isAuthenticated'](),controller['removeTags']);module[_0x6c9f('0x33')]=router; \ No newline at end of file +var _0x1a77=['isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','/:id/messages','addMessage','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','put','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0xa670ec,_0x14fc26){var _0x117e86=function(_0x46d765){while(--_0x46d765){_0xa670ec['push'](_0xa670ec['shift']());}};_0x117e86(++_0x14fc26);}(_0x1a77,0x12c));var _0x71a7=function(_0x31fac5,_0x48230e){_0x31fac5=_0x31fac5-0x0;var _0x1521db=_0x1a77[_0x31fac5];return _0x1521db;};'use strict';var multer=require(_0x71a7('0x0'));var util=require(_0x71a7('0x1'));var path=require(_0x71a7('0x2'));var timeout=require('connect-timeout');var express=require(_0x71a7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x71a7('0x4'));var interaction=require(_0x71a7('0x5'));var config=require(_0x71a7('0x6'));var controller=require(_0x71a7('0x7'));router[_0x71a7('0x8')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0xa')]);router[_0x71a7('0x8')](_0x71a7('0xb'),auth[_0x71a7('0x9')](),controller['describe']);router[_0x71a7('0x8')]('/:id',auth[_0x71a7('0xc')](),controller[_0x71a7('0xd')]);router['get'](_0x71a7('0xe'),auth[_0x71a7('0xc')](),controller['attachmentDownload']);router[_0x71a7('0x8')]('/:id/messages',auth[_0x71a7('0x9')](),controller[_0x71a7('0xf')]);router[_0x71a7('0x8')](_0x71a7('0x10'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x71a7('0x8')](_0x71a7('0x11'),auth['isAuthenticated'](),controller[_0x71a7('0x12')]);router[_0x71a7('0x13')]('/',auth[_0x71a7('0x9')](),controller[_0x71a7('0x14')]);router[_0x71a7('0x13')](_0x71a7('0x15'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x16')]);var upload=multer({'storage':multer[_0x71a7('0x17')]({'destination':function(_0x36a5be,_0x160b4d,_0x47a47e){_0x47a47e(null,path[_0x71a7('0x18')](config[_0x71a7('0x19')],_0x71a7('0x1a')));},'filename':function(_0x3f59f7,_0x2fe6d9,_0x2317ca){_0x2317ca(null,util[_0x71a7('0x1b')](_0x71a7('0x1c'),Date[_0x71a7('0x1d')](),_0x2fe6d9[_0x71a7('0x1e')][_0x71a7('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x71a7('0x13')]('/:id/attachment_upload',upload[_0x71a7('0x20')]('file'),controller['attachmentUpload']);router['post'](_0x71a7('0x21'),auth[_0x71a7('0xc')](),controller[_0x71a7('0x22')]);router[_0x71a7('0x13')]('/:id/tags',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x24')),controller[_0x71a7('0x25')]);router['put']('/:id',auth[_0x71a7('0x9')](),interaction['tracked'](_0x71a7('0x23'),_0x71a7('0x26')),controller[_0x71a7('0x27')]);router['put'](_0x71a7('0x28'),controller[_0x71a7('0x29')]);router['put'](_0x71a7('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x71a7('0x2b')](_0x71a7('0x2c'),controller[_0x71a7('0x2d')]);router[_0x71a7('0x2e')](_0x71a7('0x2f'),auth[_0x71a7('0x9')](),interaction['tracked']('chat',_0x71a7('0x30')),controller[_0x71a7('0x31')]);router[_0x71a7('0x2e')](_0x71a7('0x32'),auth[_0x71a7('0x9')](),controller[_0x71a7('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fc9007b..4a49058 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 _0x5125=['BOOLEAN','sequelize','medium'];(function(_0x1a1de1,_0x57c036){var _0x213534=function(_0x1cfc86){while(--_0x1cfc86){_0x1a1de1['push'](_0x1a1de1['shift']());}};_0x213534(++_0x57c036);}(_0x5125,0x109));var _0x5512=function(_0x50b72e,_0x4c8e49){_0x50b72e=_0x50b72e-0x0;var _0x476f92=_0x5125[_0x50b72e];return _0x476f92;};'use strict';var Sequelize=require(_0x5512('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x5512('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5512('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6aeb=['medium','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x53955a,_0x1177fd){var _0x146e46=function(_0x5b1535){while(--_0x5b1535){_0x53955a['push'](_0x53955a['shift']());}};_0x146e46(++_0x1177fd);}(_0x6aeb,0x139));var _0xb6ae=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x6aeb[_0x2e6dbf];return _0x2680e5;};'use strict';var Sequelize=require(_0xb6ae('0x0'));module[_0xb6ae('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb6ae('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb6ae('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb6ae('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6a01fc7..b32fdde 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 _0x94f5=['find','create','body','describe','createdAt','lastMessage','lastMessageAt','format','getUsers','User','role','userpic','online','lastLoginAt','showWebBar','VoiceQueue','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','filter','messages','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','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','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x8707c,_0x5d9ffa){var _0x54fea9=function(_0x2dd5d5){while(--_0x2dd5d5){_0x8707c['push'](_0x8707c['shift']());}};_0x54fea9(++_0x5d9ffa);}(_0x94f5,0x8d));var _0x594f=function(_0x18965b,_0x311cd4){_0x18965b=_0x18965b-0x0;var _0x37f9b8=_0x94f5[_0x18965b];return _0x37f9b8;};'use strict';var emlformat=require(_0x594f('0x0'));var rimraf=require(_0x594f('0x1'));var zipdir=require(_0x594f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x594f('0x3'));var moment=require(_0x594f('0x4'));var BPromise=require(_0x594f('0x5'));var Mustache=require('mustache');var util=require(_0x594f('0x6'));var path=require(_0x594f('0x7'));var sox=require(_0x594f('0x8'));var csv=require('to-csv');var ejs=require(_0x594f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x594f('0xa'));var squel=require('squel');var crypto=require(_0x594f('0xb'));var jsforce=require(_0x594f('0xc'));var deskjs=require(_0x594f('0xd'));var toCsv=require(_0x594f('0xe'));var querystring=require('querystring');var Papa=require(_0x594f('0xf'));var Redis=require(_0x594f('0x10'));var authService=require(_0x594f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x594f('0x12'));var hardwareService=require(_0x594f('0x13'));var logger=require('../../config/logger')(_0x594f('0x14'));var utils=require(_0x594f('0x15'));var config=require(_0x594f('0x16'));var licenseUtil=require(_0x594f('0x17'));var db=require(_0x594f('0x18'))['db'];config[_0x594f('0x19')]=_[_0x594f('0x1a')](config[_0x594f('0x19')],{'host':_0x594f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x594f('0x1c')](socket);function respondWithStatusCode(_0x87aff8,_0x462ef9){_0x462ef9=_0x462ef9||0xcc;return function(_0x29f8c1){if(_0x29f8c1){return _0x87aff8[_0x594f('0x1d')](_0x462ef9);}return _0x87aff8[_0x594f('0x1e')](_0x462ef9)['end']();};}function respondWithResult(_0x1f9adb,_0x57361c){_0x57361c=_0x57361c||0xc8;return function(_0x5935a7){if(_0x5935a7){return _0x1f9adb[_0x594f('0x1e')](_0x57361c)['json'](_0x5935a7);}};}function respondWithFilteredResult(_0x810761,_0x12089f){return function(_0x32148f){if(_0x32148f){var _0x1117b5=typeof _0x12089f[_0x594f('0x1f')]===_0x594f('0x20')&&typeof _0x12089f['limit']===_0x594f('0x20');var _0x20954d=_0x32148f[_0x594f('0x21')];var _0x1215c8=_0x1117b5?0x0:_0x12089f[_0x594f('0x1f')];var _0x1416b6=_0x1117b5?_0x32148f[_0x594f('0x21')]:_0x12089f['offset']+_0x12089f[_0x594f('0x22')];var _0x4ed3e9;if(_0x1416b6>=_0x20954d){_0x1416b6=_0x20954d;_0x4ed3e9=0xc8;}else{_0x4ed3e9=0xce;}_0x810761['status'](_0x4ed3e9);return _0x810761[_0x594f('0x23')](_0x594f('0x24'),_0x1215c8+'-'+_0x1416b6+'/'+_0x20954d)[_0x594f('0x25')](_0x32148f);}return null;};}function patchUpdates(_0x6d3bb2){return function(_0x495d71){try{jsonpatch[_0x594f('0x26')](_0x495d71,_0x6d3bb2,!![]);}catch(_0x48fee1){return BPromise['reject'](_0x48fee1);}return _0x495d71[_0x594f('0x27')]();};}function saveUpdates(_0x1091e6,_0x2b798c){return function(_0x23bf84){if(_0x23bf84){return _0x23bf84[_0x594f('0x28')](_0x1091e6)[_0x594f('0x29')](function(_0x4814b8){return _0x4814b8;});}return null;};}function removeEntity(_0x2bfbd3,_0x2f469b){return function(_0x165e40){if(_0x165e40){return _0x165e40[_0x594f('0x2a')]()['then'](function(){_0x2bfbd3['status'](0xcc)[_0x594f('0x2b')]();});}};}function handleEntityNotFound(_0x4882fd,_0x4a352a){return function(_0x431337){if(!_0x431337){_0x4882fd[_0x594f('0x1d')](0x194);}return _0x431337;};}function handleError(_0x331b2e,_0x577aec){_0x577aec=_0x577aec||0x1f4;return function(_0xbf2bcb){logger[_0x594f('0x2c')](_0xbf2bcb[_0x594f('0x2d')]);if(_0xbf2bcb[_0x594f('0x2e')]){delete _0xbf2bcb[_0x594f('0x2e')];}_0x331b2e['status'](_0x577aec)['send'](_0xbf2bcb);};}exports['index']=function(_0xd28632,_0xc17d0f){var _0x44ac16={},_0x5d2fb9={},_0xb4ef6a={'count':0x0,'rows':[]};var _0x301a00=_[_0x594f('0x2f')](db[_0x594f('0x30')][_0x594f('0x31')],function(_0x373f33){return{'name':_0x373f33['fieldName'],'type':_0x373f33[_0x594f('0x32')][_0x594f('0x33')]};});_0x5d2fb9[_0x594f('0x34')]=_['map'](_0x301a00,_0x594f('0x2e'));_0x5d2fb9['query']=_[_0x594f('0x35')](_0xd28632[_0x594f('0x36')]);_0x5d2fb9[_0x594f('0x37')]=_['intersection'](_0x5d2fb9[_0x594f('0x34')],_0x5d2fb9[_0x594f('0x36')]);_0x44ac16['attributes']=_[_0x594f('0x38')](_0x5d2fb9[_0x594f('0x34')],qs['fields'](_0xd28632['query']['fields']));_0x44ac16['attributes']=_0x44ac16[_0x594f('0x39')][_0x594f('0x3a')]?_0x44ac16['attributes']:_0x5d2fb9[_0x594f('0x34')];if(!_0xd28632[_0x594f('0x36')][_0x594f('0x3b')]('nolimit')){_0x44ac16[_0x594f('0x22')]=qs[_0x594f('0x22')](_0xd28632['query'][_0x594f('0x22')]);_0x44ac16[_0x594f('0x1f')]=qs[_0x594f('0x1f')](_0xd28632[_0x594f('0x36')]['offset']);}_0x44ac16[_0x594f('0x3c')]=qs[_0x594f('0x3d')](_0xd28632[_0x594f('0x36')][_0x594f('0x3d')]);_0x44ac16[_0x594f('0x3e')]=qs[_0x594f('0x37')](_[_0x594f('0x3f')](_0xd28632[_0x594f('0x36')],_0x5d2fb9[_0x594f('0x37')]),_0x301a00);if(_0xd28632[_0x594f('0x36')]['filter']){_0x44ac16['where']=_[_0x594f('0x40')](_0x44ac16[_0x594f('0x3e')],{'$or':_[_0x594f('0x2f')](_0x301a00,function(_0x2f28a3){if(_0x2f28a3[_0x594f('0x32')]!==_0x594f('0x41')){var _0x1646f7={};_0x1646f7[_0x2f28a3[_0x594f('0x2e')]]={'$like':'%'+_0xd28632[_0x594f('0x36')]['filter']+'%'};return _0x1646f7;}})});}_0x44ac16=_['merge']({},_0x44ac16,_0xd28632[_0x594f('0x42')]);var _0x5773c3={'where':_0x44ac16[_0x594f('0x3e')]};return db[_0x594f('0x30')]['count'](_0x5773c3)[_0x594f('0x29')](function(_0xd7b8f2){_0xb4ef6a[_0x594f('0x21')]=_0xd7b8f2;if(_0xd28632[_0x594f('0x36')][_0x594f('0x43')]){_0x44ac16[_0x594f('0x44')]=[{'all':!![]}];}return db[_0x594f('0x30')][_0x594f('0x45')](_0x44ac16);})[_0x594f('0x29')](function(_0x436994){_0xb4ef6a[_0x594f('0x46')]=_0x436994;return _0xb4ef6a;})[_0x594f('0x29')](respondWithFilteredResult(_0xc17d0f,_0x44ac16))[_0x594f('0x47')](handleError(_0xc17d0f,null));};exports[_0x594f('0x48')]=function(_0x16505b,_0xcf3298){var _0x954ff1={'raw':!![],'where':{'id':_0x16505b[_0x594f('0x49')]['id']}},_0x36fbd4={};_0x36fbd4[_0x594f('0x34')]=_['keys'](db[_0x594f('0x30')][_0x594f('0x31')]);_0x36fbd4['query']=_[_0x594f('0x35')](_0x16505b[_0x594f('0x36')]);_0x36fbd4['filters']=_['intersection'](_0x36fbd4['model'],_0x36fbd4[_0x594f('0x36')]);_0x954ff1[_0x594f('0x39')]=_[_0x594f('0x38')](_0x36fbd4[_0x594f('0x34')],qs[_0x594f('0x4a')](_0x16505b['query'][_0x594f('0x4a')]));_0x954ff1[_0x594f('0x39')]=_0x954ff1[_0x594f('0x39')][_0x594f('0x3a')]?_0x954ff1[_0x594f('0x39')]:_0x36fbd4['model'];if(_0x16505b[_0x594f('0x36')][_0x594f('0x43')]){_0x954ff1[_0x594f('0x44')]=[{'all':!![]}];}_0x954ff1=_[_0x594f('0x40')]({},_0x954ff1,_0x16505b[_0x594f('0x42')]);return db[_0x594f('0x30')][_0x594f('0x4b')](_0x954ff1)[_0x594f('0x29')](handleEntityNotFound(_0xcf3298,null))[_0x594f('0x29')](respondWithResult(_0xcf3298,null))['catch'](handleError(_0xcf3298,null));};exports[_0x594f('0x4c')]=function(_0x1cf184,_0x8f653d){return db[_0x594f('0x30')][_0x594f('0x4c')](_0x1cf184['body'],{})[_0x594f('0x29')](respondWithResult(_0x8f653d,0xc9))[_0x594f('0x47')](handleError(_0x8f653d,null));};exports[_0x594f('0x28')]=function(_0x4a36ec,_0x253e51){if(_0x4a36ec[_0x594f('0x4d')]['id']){delete _0x4a36ec[_0x594f('0x4d')]['id'];}return db[_0x594f('0x30')][_0x594f('0x4b')]({'where':{'id':_0x4a36ec[_0x594f('0x49')]['id']}})[_0x594f('0x29')](handleEntityNotFound(_0x253e51,null))['then'](saveUpdates(_0x4a36ec['body'],null))[_0x594f('0x29')](respondWithResult(_0x253e51,null))[_0x594f('0x47')](handleError(_0x253e51,null));};exports[_0x594f('0x2a')]=function(_0xc15599,_0x1a9393){return db[_0x594f('0x30')][_0x594f('0x4b')]({'where':{'id':_0xc15599[_0x594f('0x49')]['id']}})[_0x594f('0x29')](handleEntityNotFound(_0x1a9393,null))[_0x594f('0x29')](removeEntity(_0x1a9393,null))['catch'](handleError(_0x1a9393,null));};exports[_0x594f('0x4e')]=function(_0x347d39,_0x4f011c){return db[_0x594f('0x30')][_0x594f('0x4e')]()[_0x594f('0x29')](respondWithResult(_0x4f011c,null))[_0x594f('0x47')](handleError(_0x4f011c,null));};function wrapUser(_0x3eb880){return function(_0x5ca379){var _0x3bd0e5=_0x3eb880['get']({'plain':!![]});_0x3bd0e5['messages']=[];if(_0x5ca379){_0x3bd0e5['lastMessageAt']=_0x5ca379[_0x594f('0x4f')];_0x3bd0e5[_0x594f('0x50')]=_0x5ca379;}else{_0x3bd0e5[_0x594f('0x51')]=moment(0x0)[_0x594f('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bd0e5['lastMessage']={};}return _0x3bd0e5;};}exports[_0x594f('0x53')]=function(_0x3cb4ba,_0x32728e,_0x2889d3){var _0x2e0a6a=[];return db[_0x594f('0x54')][_0x594f('0x45')]({'where':{'role':['agent','admin','user']},'attributes':['id','fullname',_0x594f('0x2e'),_0x594f('0x55'),_0x594f('0x56'),'internal',_0x594f('0x57'),_0x594f('0x58'),'allowmessenger',_0x594f('0x59')],'order':qs[_0x594f('0x3d')]('-online'),'include':[{'model':db[_0x594f('0x5a')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x594f('0x29')](function(_0x4e8bce){if(_0x4e8bce){var _0x146958=_0x3cb4ba[_0x594f('0x5b')][_0x594f('0x5c')]({'plain':!![]});if(!_0x146958)throw new Error(_0x594f('0x5d'));if(_0x146958[_0x594f('0x55')]==='user'){return db[_0x594f('0x5e')][_0x594f('0x4b')]({'where':{'name':'Agents','userProfileId':_0x146958[_0x594f('0x5f')]},'raw':!![]})['then'](function(_0xc93553){if(_0xc93553){if(_0xc93553[_0x594f('0x60')]===0x0){return db[_0x594f('0x61')][_0x594f('0x45')]({'where':{'sectionId':_0xc93553['id']},'raw':!![]})['then'](function(_0x10de78){var _0x2428a6=[];if(_[_0x594f('0x62')](_0x10de78)){_0x2428a6=_['filter'](_0x4e8bce,function(_0x19f442){if(_0x19f442[_0x594f('0x55')]!=='agent'){return _0x19f442;}});return _0x2428a6;}else{for(var _0x30c6f5=0x0;_0x30c6f5<_0x4e8bce[_0x594f('0x3a')];_0x30c6f5++){var _0x3b76cc=_0x4e8bce[_0x30c6f5];if(_0x3b76cc[_0x594f('0x55')]===_0x594f('0x63')){var _0x4dcfd7=_[_0x594f('0x4b')](_0x10de78,function(_0xda19d3){return _0xda19d3[_0x594f('0x64')]===_0x3b76cc['id'];});if(_0x4dcfd7)_0x2428a6[_0x594f('0x65')](_0x3b76cc);}else{_0x2428a6[_0x594f('0x65')](_0x3b76cc);}}return _0x2428a6;}});}else{return _0x4e8bce;}}else{var _0x57bf15=_[_0x594f('0x66')](_0x4e8bce,function(_0x5307b4){if(_0x5307b4[_0x594f('0x55')]!=='agent'){return _0x5307b4;}});return _0x57bf15;}});}else{return _0x4e8bce;}}})[_0x594f('0x29')](function(_0xd46278){var _0x5129db=[];if(_0xd46278){_0x2e0a6a=_0xd46278;for(var _0x36f142=0x0;_0x36f142<_0xd46278[_0x594f('0x3a')];_0x36f142+=0x1){_0x2e0a6a[_0x36f142][_0x594f('0x67')]=[];_0x5129db[_0x594f('0x65')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x3cb4ba[_0x594f('0x5b')]['id'],_0xd46278[_0x36f142]['id']],'ToId':[_0x3cb4ba['user']['id'],_0xd46278[_0x36f142]['id']],'ChatGroupId':null},'attributes':['id',_0x594f('0x4f'),_0x594f('0x68'),_0x594f('0x69'),'read','body'],'order':qs[_0x594f('0x3d')](_0x594f('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x594f('0x29')](wrapUser(_0xd46278[_0x36f142])));}return BPromise[_0x594f('0x6b')](_0x5129db);}return[];})[_0x594f('0x29')](function(_0x596bcf){return{'rows':_0x596bcf,'count':_0x596bcf['length']};})['then'](respondWithResult(_0x32728e,null))[_0x594f('0x47')](handleError(_0x32728e,null));}; \ No newline at end of file +var _0x0783=['update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','messages','createdAt','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','internal','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x290fc9,_0x3069fe){var _0x31c8bd=function(_0x4bec21){while(--_0x4bec21){_0x290fc9['push'](_0x290fc9['shift']());}};_0x31c8bd(++_0x3069fe);}(_0x0783,0x126));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3078('0x0'));var zipdir=require(_0x3078('0x1'));var jsonpatch=require(_0x3078('0x2'));var rp=require(_0x3078('0x3'));var moment=require('moment');var BPromise=require(_0x3078('0x4'));var Mustache=require(_0x3078('0x5'));var util=require(_0x3078('0x6'));var path=require(_0x3078('0x7'));var sox=require(_0x3078('0x8'));var csv=require(_0x3078('0x9'));var ejs=require(_0x3078('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3078('0xb'));var squel=require(_0x3078('0xc'));var crypto=require(_0x3078('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3078('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3078('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3078('0xf'));var as=require(_0x3078('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3078('0x11'))('api');var utils=require(_0x3078('0x12'));var config=require(_0x3078('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3078('0x14'))['db'];config[_0x3078('0x15')]=_[_0x3078('0x16')](config['redis'],{'host':_0x3078('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3078('0x15')]));require(_0x3078('0x18'))[_0x3078('0x19')](socket);function respondWithStatusCode(_0xf5b54b,_0x201d14){_0x201d14=_0x201d14||0xcc;return function(_0x43ae65){if(_0x43ae65){return _0xf5b54b[_0x3078('0x1a')](_0x201d14);}return _0xf5b54b[_0x3078('0x1b')](_0x201d14)[_0x3078('0x1c')]();};}function respondWithResult(_0x349a5e,_0x146f95){_0x146f95=_0x146f95||0xc8;return function(_0x5183ec){if(_0x5183ec){return _0x349a5e[_0x3078('0x1b')](_0x146f95)[_0x3078('0x1d')](_0x5183ec);}};}function respondWithFilteredResult(_0x269a33,_0x5a412f){return function(_0xd4f3b){if(_0xd4f3b){var _0x3330a3=typeof _0x5a412f['offset']===_0x3078('0x1e')&&typeof _0x5a412f[_0x3078('0x1f')]===_0x3078('0x1e');var _0x24bb34=_0xd4f3b[_0x3078('0x20')];var _0x16062c=_0x3330a3?0x0:_0x5a412f[_0x3078('0x21')];var _0x8f91e4=_0x3330a3?_0xd4f3b['count']:_0x5a412f[_0x3078('0x21')]+_0x5a412f[_0x3078('0x1f')];var _0x1a8b13;if(_0x8f91e4>=_0x24bb34){_0x8f91e4=_0x24bb34;_0x1a8b13=0xc8;}else{_0x1a8b13=0xce;}_0x269a33[_0x3078('0x1b')](_0x1a8b13);return _0x269a33[_0x3078('0x22')](_0x3078('0x23'),_0x16062c+'-'+_0x8f91e4+'/'+_0x24bb34)[_0x3078('0x1d')](_0xd4f3b);}return null;};}function patchUpdates(_0x47acdb){return function(_0x5e0993){try{jsonpatch[_0x3078('0x24')](_0x5e0993,_0x47acdb,!![]);}catch(_0x58c806){return BPromise[_0x3078('0x25')](_0x58c806);}return _0x5e0993[_0x3078('0x26')]();};}function saveUpdates(_0x44df8b,_0x165ffb){return function(_0x2b0789){if(_0x2b0789){return _0x2b0789[_0x3078('0x27')](_0x44df8b)[_0x3078('0x28')](function(_0x116ae6){return _0x116ae6;});}return null;};}function removeEntity(_0x37322f,_0x3199a8){return function(_0x4400a3){if(_0x4400a3){return _0x4400a3[_0x3078('0x29')]()[_0x3078('0x28')](function(){_0x37322f[_0x3078('0x1b')](0xcc)[_0x3078('0x1c')]();});}};}function handleEntityNotFound(_0x360d87,_0x3aa993){return function(_0x231b4f){if(!_0x231b4f){_0x360d87[_0x3078('0x1a')](0x194);}return _0x231b4f;};}function handleError(_0x590047,_0x4c7b4f){_0x4c7b4f=_0x4c7b4f||0x1f4;return function(_0x1fea41){logger[_0x3078('0x2a')](_0x1fea41[_0x3078('0x2b')]);if(_0x1fea41[_0x3078('0x2c')]){delete _0x1fea41[_0x3078('0x2c')];}_0x590047['status'](_0x4c7b4f)[_0x3078('0x2d')](_0x1fea41);};}exports[_0x3078('0x2e')]=function(_0x19943e,_0x3a04e9){var _0x52c6dd={},_0x1bcb8e={},_0x202a36={'count':0x0,'rows':[]};var _0x4442b2=_[_0x3078('0x2f')](db[_0x3078('0x30')][_0x3078('0x31')],function(_0x58d4fb){return{'name':_0x58d4fb[_0x3078('0x32')],'type':_0x58d4fb[_0x3078('0x33')]['key']};});_0x1bcb8e[_0x3078('0x34')]=_[_0x3078('0x2f')](_0x4442b2,_0x3078('0x2c'));_0x1bcb8e[_0x3078('0x35')]=_[_0x3078('0x36')](_0x19943e['query']);_0x1bcb8e['filters']=_['intersection'](_0x1bcb8e[_0x3078('0x34')],_0x1bcb8e[_0x3078('0x35')]);_0x52c6dd['attributes']=_[_0x3078('0x37')](_0x1bcb8e['model'],qs[_0x3078('0x38')](_0x19943e[_0x3078('0x35')][_0x3078('0x38')]));_0x52c6dd[_0x3078('0x39')]=_0x52c6dd[_0x3078('0x39')][_0x3078('0x3a')]?_0x52c6dd[_0x3078('0x39')]:_0x1bcb8e[_0x3078('0x34')];if(!_0x19943e[_0x3078('0x35')][_0x3078('0x3b')](_0x3078('0x3c'))){_0x52c6dd['limit']=qs[_0x3078('0x1f')](_0x19943e[_0x3078('0x35')][_0x3078('0x1f')]);_0x52c6dd[_0x3078('0x21')]=qs[_0x3078('0x21')](_0x19943e[_0x3078('0x35')][_0x3078('0x21')]);}_0x52c6dd[_0x3078('0x3d')]=qs[_0x3078('0x3e')](_0x19943e[_0x3078('0x35')][_0x3078('0x3e')]);_0x52c6dd[_0x3078('0x3f')]=qs[_0x3078('0x40')](_[_0x3078('0x41')](_0x19943e[_0x3078('0x35')],_0x1bcb8e[_0x3078('0x40')]),_0x4442b2);if(_0x19943e[_0x3078('0x35')][_0x3078('0x42')]){_0x52c6dd[_0x3078('0x3f')]=_[_0x3078('0x43')](_0x52c6dd[_0x3078('0x3f')],{'$or':_[_0x3078('0x2f')](_0x4442b2,function(_0x3428f5){if(_0x3428f5['type']!==_0x3078('0x44')){var _0xaa9fe2={};_0xaa9fe2[_0x3428f5[_0x3078('0x2c')]]={'$like':'%'+_0x19943e[_0x3078('0x35')]['filter']+'%'};return _0xaa9fe2;}})});}_0x52c6dd=_[_0x3078('0x43')]({},_0x52c6dd,_0x19943e[_0x3078('0x45')]);var _0x2a29a5={'where':_0x52c6dd[_0x3078('0x3f')]};return db['ChatInternalMessage'][_0x3078('0x20')](_0x2a29a5)[_0x3078('0x28')](function(_0x1c0897){_0x202a36[_0x3078('0x20')]=_0x1c0897;if(_0x19943e['query']['includeAll']){_0x52c6dd[_0x3078('0x46')]=[{'all':!![]}];}return db[_0x3078('0x30')][_0x3078('0x47')](_0x52c6dd);})[_0x3078('0x28')](function(_0x303a03){_0x202a36[_0x3078('0x48')]=_0x303a03;return _0x202a36;})['then'](respondWithFilteredResult(_0x3a04e9,_0x52c6dd))[_0x3078('0x49')](handleError(_0x3a04e9,null));};exports[_0x3078('0x4a')]=function(_0x25ac2b,_0x2eeb27){var _0x2b6a46={'raw':!![],'where':{'id':_0x25ac2b[_0x3078('0x4b')]['id']}},_0x138178={};_0x138178[_0x3078('0x34')]=_['keys'](db[_0x3078('0x30')][_0x3078('0x31')]);_0x138178[_0x3078('0x35')]=_[_0x3078('0x36')](_0x25ac2b[_0x3078('0x35')]);_0x138178[_0x3078('0x40')]=_[_0x3078('0x37')](_0x138178[_0x3078('0x34')],_0x138178[_0x3078('0x35')]);_0x2b6a46[_0x3078('0x39')]=_[_0x3078('0x37')](_0x138178['model'],qs[_0x3078('0x38')](_0x25ac2b['query'][_0x3078('0x38')]));_0x2b6a46['attributes']=_0x2b6a46[_0x3078('0x39')][_0x3078('0x3a')]?_0x2b6a46[_0x3078('0x39')]:_0x138178[_0x3078('0x34')];if(_0x25ac2b[_0x3078('0x35')][_0x3078('0x4c')]){_0x2b6a46[_0x3078('0x46')]=[{'all':!![]}];}_0x2b6a46=_[_0x3078('0x43')]({},_0x2b6a46,_0x25ac2b[_0x3078('0x45')]);return db[_0x3078('0x30')]['find'](_0x2b6a46)[_0x3078('0x28')](handleEntityNotFound(_0x2eeb27,null))[_0x3078('0x28')](respondWithResult(_0x2eeb27,null))[_0x3078('0x49')](handleError(_0x2eeb27,null));};exports[_0x3078('0x4d')]=function(_0x35636d,_0x65cf2a){return db[_0x3078('0x30')][_0x3078('0x4d')](_0x35636d[_0x3078('0x4e')],{})[_0x3078('0x28')](respondWithResult(_0x65cf2a,0xc9))[_0x3078('0x49')](handleError(_0x65cf2a,null));};exports[_0x3078('0x27')]=function(_0xb1d79,_0x2ff04c){if(_0xb1d79[_0x3078('0x4e')]['id']){delete _0xb1d79[_0x3078('0x4e')]['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0xb1d79['params']['id']}})[_0x3078('0x28')](handleEntityNotFound(_0x2ff04c,null))[_0x3078('0x28')](saveUpdates(_0xb1d79[_0x3078('0x4e')],null))['then'](respondWithResult(_0x2ff04c,null))[_0x3078('0x49')](handleError(_0x2ff04c,null));};exports[_0x3078('0x29')]=function(_0x2deb69,_0x47c7c4){return db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'id':_0x2deb69[_0x3078('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47c7c4,null))['then'](removeEntity(_0x47c7c4,null))[_0x3078('0x49')](handleError(_0x47c7c4,null));};exports[_0x3078('0x50')]=function(_0x3256c0,_0x2e483c){return db[_0x3078('0x30')][_0x3078('0x50')]()[_0x3078('0x28')](respondWithResult(_0x2e483c,null))['catch'](handleError(_0x2e483c,null));};function wrapUser(_0x12cfe1){return function(_0x2d5213){var _0x2e5205=_0x12cfe1['get']({'plain':!![]});_0x2e5205[_0x3078('0x51')]=[];if(_0x2d5213){_0x2e5205['lastMessageAt']=_0x2d5213[_0x3078('0x52')];_0x2e5205['lastMessage']=_0x2d5213;}else{_0x2e5205[_0x3078('0x53')]=moment(0x0)['format'](_0x3078('0x54'));_0x2e5205[_0x3078('0x55')]={};}return _0x2e5205;};}exports[_0x3078('0x56')]=function(_0x7f3bf,_0x46bec6,_0x37818a){var _0x12dc28=[];return db['User']['findAll']({'where':{'role':[_0x3078('0x57'),_0x3078('0x58'),_0x3078('0x59')]},'attributes':['id',_0x3078('0x5a'),_0x3078('0x2c'),_0x3078('0x5b'),'userpic',_0x3078('0x5c'),'online',_0x3078('0x5d'),'allowmessenger',_0x3078('0x5e')],'order':qs[_0x3078('0x3e')](_0x3078('0x5f')),'include':[{'model':db[_0x3078('0x60')],'as':_0x3078('0x61'),'attributes':['id',_0x3078('0x2c'),_0x3078('0x33')],'through':{'attributes':[]}}]})[_0x3078('0x28')](function(_0x1d8ce1){if(_0x1d8ce1){var _0x5c89f7=_0x7f3bf[_0x3078('0x59')][_0x3078('0x62')]({'plain':!![]});if(!_0x5c89f7)throw new Error(_0x3078('0x63'));if(_0x5c89f7['role']===_0x3078('0x59')){return db[_0x3078('0x64')][_0x3078('0x4f')]({'where':{'name':_0x3078('0x65'),'userProfileId':_0x5c89f7[_0x3078('0x66')]},'raw':!![]})[_0x3078('0x28')](function(_0x22e032){if(_0x22e032){if(_0x22e032[_0x3078('0x67')]===0x0){return db[_0x3078('0x68')][_0x3078('0x47')]({'where':{'sectionId':_0x22e032['id']},'raw':!![]})[_0x3078('0x28')](function(_0xbef07f){var _0x35734d=[];if(_['isEmpty'](_0xbef07f)){_0x35734d=_['filter'](_0x1d8ce1,function(_0x1682ad){if(_0x1682ad[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x1682ad;}});return _0x35734d;}else{for(var _0x404c31=0x0;_0x404c31<_0x1d8ce1[_0x3078('0x3a')];_0x404c31++){var _0x3fe74c=_0x1d8ce1[_0x404c31];if(_0x3fe74c[_0x3078('0x5b')]===_0x3078('0x57')){var _0x554223=_[_0x3078('0x4f')](_0xbef07f,function(_0x4260ca){return _0x4260ca[_0x3078('0x69')]===_0x3fe74c['id'];});if(_0x554223)_0x35734d[_0x3078('0x6a')](_0x3fe74c);}else{_0x35734d[_0x3078('0x6a')](_0x3fe74c);}}return _0x35734d;}});}else{return _0x1d8ce1;}}else{var _0x5d7030=_[_0x3078('0x42')](_0x1d8ce1,function(_0x369476){if(_0x369476[_0x3078('0x5b')]!==_0x3078('0x57')){return _0x369476;}});return _0x5d7030;}});}else{return _0x1d8ce1;}}})[_0x3078('0x28')](function(_0x356ab9){var _0x59506e=[];if(_0x356ab9){_0x12dc28=_0x356ab9;for(var _0x3ea1e7=0x0;_0x3ea1e7<_0x356ab9[_0x3078('0x3a')];_0x3ea1e7+=0x1){_0x12dc28[_0x3ea1e7][_0x3078('0x51')]=[];_0x59506e[_0x3078('0x6a')](db[_0x3078('0x30')][_0x3078('0x4f')]({'where':{'FromId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ToId':[_0x7f3bf[_0x3078('0x59')]['id'],_0x356ab9[_0x3ea1e7]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x3078('0x6b'),_0x3078('0x6c'),_0x3078('0x4e')],'order':qs[_0x3078('0x3e')](_0x3078('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3078('0x28')](wrapUser(_0x356ab9[_0x3ea1e7])));}return BPromise[_0x3078('0x6e')](_0x59506e);}return[];})[_0x3078('0x28')](function(_0x315c9d){return{'rows':_0x315c9d,'count':_0x315c9d['length']};})['then'](respondWithResult(_0x46bec6,null))[_0x3078('0x49')](handleError(_0x46bec6,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b90ceed..d3e994c 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 _0x4ef9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove'];(function(_0xb305f3,_0x4d9926){var _0x1a418a=function(_0x6b026){while(--_0x6b026){_0xb305f3['push'](_0xb305f3['shift']());}};_0x1a418a(++_0x4d9926);}(_0x4ef9,0x144));var _0x94ef=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x4ef9[_0x57486e];return _0x5f110b;};'use strict';var EventEmitter=require(_0x94ef('0x0'));var ChatInternalMessage=require(_0x94ef('0x1'))['db'][_0x94ef('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x94ef('0x3'),'afterUpdate':_0x94ef('0x4'),'afterDestroy':_0x94ef('0x5')};function emitEvent(_0x53eae1){return function(_0x1a8030,_0x2cb58e,_0x4b2398){ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1+':'+_0x1a8030['id'],_0x1a8030);ChatInternalMessageEvents[_0x94ef('0x6')](_0x53eae1,_0x1a8030);_0x4b2398(null);};}for(var e in events){if(events[_0x94ef('0x7')](e)){var event=events[e];ChatInternalMessage[_0x94ef('0x8')](e,emitEvent(event));}}module[_0x94ef('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x076b=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','hook'];(function(_0x5902a0,_0x5bc8f6){var _0x3d3022=function(_0x4adcd0){while(--_0x4adcd0){_0x5902a0['push'](_0x5902a0['shift']());}};_0x3d3022(++_0x5bc8f6);}(_0x076b,0x1c1));var _0xb076=function(_0x5e207d,_0xe1b62a){_0x5e207d=_0x5e207d-0x0;var _0x263d1a=_0x076b[_0x5e207d];return _0x263d1a;};'use strict';var EventEmitter=require(_0xb076('0x0'));var ChatInternalMessage=require(_0xb076('0x1'))['db'][_0xb076('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb076('0x3')](0x0);var events={'afterCreate':_0xb076('0x4'),'afterUpdate':_0xb076('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5da5dd){return function(_0x1817f6,_0x3168a5,_0x3d872a){ChatInternalMessageEvents['emit'](_0x5da5dd+':'+_0x1817f6['id'],_0x1817f6);ChatInternalMessageEvents['emit'](_0x5da5dd,_0x1817f6);_0x3d872a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xb076('0x6')](e,emitEvent(event));}}module[_0xb076('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 5aec1d4..216fe19 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 _0xf826=['utf8mb4','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage'];(function(_0x574d9b,_0x2063da){var _0x31d2a5=function(_0x97ce4c){while(--_0x97ce4c){_0x574d9b['push'](_0x574d9b['shift']());}};_0x31d2a5(++_0x2063da);}(_0xf826,0x1c3));var _0x6f82=function(_0x45a230,_0x4823ad){_0x45a230=_0x45a230-0x0;var _0x41779d=_0xf826[_0x45a230];return _0x41779d;};'use strict';var _=require(_0x6f82('0x0'));var util=require(_0x6f82('0x1'));var logger=require(_0x6f82('0x2'))('api');var moment=require(_0x6f82('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f82('0x5'));var attributes=require(_0x6f82('0x6'));module[_0x6f82('0x7')]=function(_0x5c699b,_0x2b8d2e){return _0x5c699b['define'](_0x6f82('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f82('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0984=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x6a91d0,_0x208f52){var _0x1abb82=function(_0x3bfb53){while(--_0x3bfb53){_0x6a91d0['push'](_0x6a91d0['shift']());}};_0x1abb82(++_0x208f52);}(_0x0984,0x6d));var _0x4098=function(_0xa22606,_0x497098){_0xa22606=_0xa22606-0x0;var _0x5252d2=_0x0984[_0xa22606];return _0x5252d2;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var logger=require(_0x4098('0x2'))(_0x4098('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4098('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4098('0x5'));var config=require(_0x4098('0x6'));var attributes=require(_0x4098('0x7'));module['exports']=function(_0x58814f,_0x47aa57){return _0x58814f['define'](_0x4098('0x8'),attributes,{'tableName':_0x4098('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4098('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 6da7ce8..7113374 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 _0x1d44=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x8d69f4,_0x1c3f4b){var _0x5a3daa=function(_0x59e86d){while(--_0x59e86d){_0x8d69f4['push'](_0x8d69f4['shift']());}};_0x5a3daa(++_0x1c3f4b);}(_0x1d44,0xad));var _0x41d4=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x1d44[_0x3ebb04];return _0x535db0;};'use strict';var _=require(_0x41d4('0x0'));var util=require(_0x41d4('0x1'));var moment=require(_0x41d4('0x2'));var BPromise=require(_0x41d4('0x3'));var rs=require(_0x41d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41d4('0x5'))['db'];var utils=require(_0x41d4('0x6'));var logger=require('../../config/logger')(_0x41d4('0x7'));var config=require(_0x41d4('0x8'));var jayson=require(_0x41d4('0x9'));var client=jayson[_0x41d4('0xa')][_0x41d4('0xb')]({'port':0x232a});config[_0x41d4('0xc')]=_[_0x41d4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x41d4('0xe'))(new Redis(config['redis']));require(_0x41d4('0xf'))[_0x41d4('0x10')](socket);function respondWithRpcPromise(_0x99b8c4,_0x1b059f,_0x483fe1){return new BPromise(function(_0x4578ed,_0x21c6fe){return client[_0x41d4('0x11')](_0x99b8c4,_0x483fe1)[_0x41d4('0x12')](function(_0x2781ad){logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));logger[_0x41d4('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1b059f,_0x41d4('0x15'),JSON[_0x41d4('0x17')](_0x2781ad));if(_0x2781ad[_0x41d4('0x18')]){if(_0x2781ad['error']['code']===0x1f4){logger['error'](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x21c6fe(_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);}logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x2781ad[_0x41d4('0x18')][_0x41d4('0x19')]);return _0x4578ed(_0x2781ad['error'][_0x41d4('0x19')]);}else{logger[_0x41d4('0x13')](_0x41d4('0x14'),_0x1b059f,_0x41d4('0x15'));_0x4578ed(_0x2781ad[_0x41d4('0x1a')]['message']);}})[_0x41d4('0x1b')](function(_0x339310){logger[_0x41d4('0x18')](_0x41d4('0x14'),_0x1b059f,_0x339310);_0x21c6fe(_0x339310);});});} \ No newline at end of file +var _0xf8b5=['info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then'];(function(_0x4441b1,_0x17bf98){var _0x3d510f=function(_0x2eed93){while(--_0x2eed93){_0x4441b1['push'](_0x4441b1['shift']());}};_0x3d510f(++_0x17bf98);}(_0xf8b5,0x1c4));var _0x5f8b=function(_0xf970f0,_0x3360b6){_0xf970f0=_0xf970f0-0x0;var _0xd1f8aa=_0xf8b5[_0xf970f0];return _0xd1f8aa;};'use strict';var _=require(_0x5f8b('0x0'));var util=require(_0x5f8b('0x1'));var moment=require('moment');var BPromise=require(_0x5f8b('0x2'));var rs=require(_0x5f8b('0x3'));var fs=require('fs');var Redis=require(_0x5f8b('0x4'));var db=require(_0x5f8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f8b('0x6'))(_0x5f8b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f8b('0x8'));var client=jayson[_0x5f8b('0x9')]['http']({'port':0x232a});config[_0x5f8b('0xa')]=_['defaults'](config[_0x5f8b('0xa')],{'host':_0x5f8b('0xb'),'port':0x18eb});var socket=require(_0x5f8b('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5f8b('0xd')](socket);function respondWithRpcPromise(_0x2460bf,_0x353d6e,_0x2aecbc){return new BPromise(function(_0x4e67ba,_0x50a623){return client[_0x5f8b('0xe')](_0x2460bf,_0x2aecbc)[_0x5f8b('0xf')](function(_0x558812){logger[_0x5f8b('0x10')](_0x5f8b('0x11'),_0x353d6e,'request\x20sent');logger['debug'](_0x5f8b('0x12'),_0x353d6e,_0x5f8b('0x13'),JSON[_0x5f8b('0x14')](_0x558812));if(_0x558812[_0x5f8b('0x15')]){if(_0x558812['error'][_0x5f8b('0x16')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x353d6e,_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);return _0x50a623(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x558812['error'][_0x5f8b('0x17')]);return _0x4e67ba(_0x558812[_0x5f8b('0x15')][_0x5f8b('0x17')]);}else{logger['info'](_0x5f8b('0x11'),_0x353d6e,_0x5f8b('0x13'));_0x4e67ba(_0x558812[_0x5f8b('0x18')][_0x5f8b('0x17')]);}})[_0x5f8b('0x19')](function(_0x11b58a){logger[_0x5f8b('0x15')](_0x5f8b('0x11'),_0x353d6e,_0x11b58a);_0x50a623(_0x11b58a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a8af9fa..0dda5b0 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 _0x15db=['update','removeListener','length','./chatInternalMessage.events','save','remove'];(function(_0x32ad36,_0x5c18c0){var _0x1972e3=function(_0x9ba9f0){while(--_0x9ba9f0){_0x32ad36['push'](_0x32ad36['shift']());}};_0x1972e3(++_0x5c18c0);}(_0x15db,0xf9));var _0xb15d=function(_0x4a76d7,_0x1dc4ed){_0x4a76d7=_0x4a76d7-0x0;var _0x368d2b=_0x15db[_0x4a76d7];return _0x368d2b;};'use strict';var ChatInternalMessageEvents=require(_0xb15d('0x0'));var events=[_0xb15d('0x1'),_0xb15d('0x2'),_0xb15d('0x3')];function createListener(_0x2550ad,_0x17b750){return function(_0x4a7538){_0x17b750['emit'](_0x2550ad,_0x4a7538);};}function removeListener(_0x59b9aa,_0x494bcc){return function(){ChatInternalMessageEvents[_0xb15d('0x4')](_0x59b9aa,_0x494bcc);};}exports['register']=function(_0x1b44d6){for(var _0x10f944=0x0,_0x5255f=events[_0xb15d('0x5')];_0x10f944<_0x5255f;_0x10f944++){var _0x82c188=events[_0x10f944];var _0x337e06=createListener('chatInternalMessage:'+_0x82c188,_0x1b44d6);ChatInternalMessageEvents['on'](_0x82c188,_0x337e06);}}; \ No newline at end of file +var _0x9707=['./chatInternalMessage.events','save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x9707,0xbd));var _0x7970=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9707[_0x122ef9];return _0x42fba0;};'use strict';var ChatInternalMessageEvents=require(_0x7970('0x0'));var events=[_0x7970('0x1'),'remove',_0x7970('0x2')];function createListener(_0x31b202,_0x1a1fd1){return function(_0x45953d){_0x1a1fd1[_0x7970('0x3')](_0x31b202,_0x45953d);};}function removeListener(_0x22e828,_0x357285){return function(){ChatInternalMessageEvents[_0x7970('0x4')](_0x22e828,_0x357285);};}exports['register']=function(_0xa33d8e){for(var _0x12c4d9=0x0,_0x2c6b6d=events[_0x7970('0x5')];_0x12c4d9<_0x2c6b6d;_0x12c4d9++){var _0x520375=events[_0x12c4d9];var _0x19e8da=createListener(_0x7970('0x6')+_0x520375,_0xa33d8e);ChatInternalMessageEvents['on'](_0x520375,_0x19e8da);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index bc80af6..5654453 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 _0xc98f=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/users','/:id','show','post','create','put'];(function(_0x2384a2,_0x1effc5){var _0x28e214=function(_0x5dea58){while(--_0x5dea58){_0x2384a2['push'](_0x2384a2['shift']());}};_0x28e214(++_0x1effc5);}(_0xc98f,0x1a5));var _0xfc98=function(_0x33b856,_0x2035d1){_0x33b856=_0x33b856-0x0;var _0x29481e=_0xc98f[_0x33b856];return _0x29481e;};'use strict';var multer=require(_0xfc98('0x0'));var util=require('util');var path=require(_0xfc98('0x1'));var timeout=require(_0xfc98('0x2'));var express=require(_0xfc98('0x3'));var router=express[_0xfc98('0x4')]();var fs_extra=require(_0xfc98('0x5'));var auth=require(_0xfc98('0x6'));var interaction=require(_0xfc98('0x7'));var config=require(_0xfc98('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xfc98('0x9')]('/',auth[_0xfc98('0xa')](),controller[_0xfc98('0xb')]);router['get']('/describe',auth[_0xfc98('0xa')](),controller[_0xfc98('0xc')]);router[_0xfc98('0x9')](_0xfc98('0xd'),auth[_0xfc98('0xa')](),controller['getUsers']);router[_0xfc98('0x9')](_0xfc98('0xe'),auth[_0xfc98('0xa')](),controller[_0xfc98('0xf')]);router[_0xfc98('0x10')]('/',auth[_0xfc98('0xa')](),controller[_0xfc98('0x11')]);router[_0xfc98('0x12')]('/:id',controller[_0xfc98('0x13')]);router[_0xfc98('0x14')]('/:id',auth[_0xfc98('0xa')](),controller['destroy']);module[_0xfc98('0x15')]=router; \ No newline at end of file +var _0xc0c2=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','getUsers','/:id'];(function(_0x2065f7,_0x2f3111){var _0xdbb6fe=function(_0x53e4a9){while(--_0x53e4a9){_0x2065f7['push'](_0x2065f7['shift']());}};_0xdbb6fe(++_0x2f3111);}(_0xc0c2,0x74));var _0x2c0c=function(_0x2e3ebb,_0x5afc59){_0x2e3ebb=_0x2e3ebb-0x0;var _0x8f027f=_0xc0c2[_0x2e3ebb];return _0x8f027f;};'use strict';var multer=require('multer');var util=require(_0x2c0c('0x0'));var path=require(_0x2c0c('0x1'));var timeout=require(_0x2c0c('0x2'));var express=require(_0x2c0c('0x3'));var router=express[_0x2c0c('0x4')]();var fs_extra=require(_0x2c0c('0x5'));var auth=require(_0x2c0c('0x6'));var interaction=require(_0x2c0c('0x7'));var config=require(_0x2c0c('0x8'));var controller=require(_0x2c0c('0x9'));router[_0x2c0c('0xa')]('/',auth[_0x2c0c('0xb')](),controller['index']);router[_0x2c0c('0xa')](_0x2c0c('0xc'),auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xd')]);router['get']('/users',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0xe')]);router['get'](_0x2c0c('0xf'),auth[_0x2c0c('0xb')](),controller['show']);router['post']('/',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x10')]);router[_0x2c0c('0x11')](_0x2c0c('0xf'),controller[_0x2c0c('0x12')]);router[_0x2c0c('0x13')]('/:id',auth[_0x2c0c('0xb')](),controller[_0x2c0c('0x14')]);module[_0x2c0c('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e42b32a..b6e879e 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 _0x8eba=['exports','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x3c05f8,_0x21a4ef){var _0x21d5e3=function(_0x40a07c){while(--_0x40a07c){_0x3c05f8['push'](_0x3c05f8['shift']());}};_0x21d5e3(++_0x21a4ef);}(_0x8eba,0xc3));var _0xa8eb=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x8eba[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xa8eb('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8eb('0x3')]('in',_0xa8eb('0x4')),'defaultValue':_0xa8eb('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xa8eb('0x5')]},'providerResponse':{'type':Sequelize[_0xa8eb('0x6')]}}; \ No newline at end of file +var _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xdd6e,0xa5));var _0xedd6=function(_0x85dc6e,_0x4c0f9b){_0x85dc6e=_0x85dc6e-0x0;var _0x160547=_0xdd6e[_0x85dc6e];return _0x160547;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 2af49b0..6076999 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 _0x9a4a=['fullname','email','internal','interface','SIP/%s','motionChannel','channel','EventManager','acceptmessage','parse','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','event','rejectmessage','formData','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x560389,_0x2e440a){var _0x217c99=function(_0x123845){while(--_0x123845){_0x560389['push'](_0x560389['shift']());}};_0x217c99(++_0x2e440a);}(_0x9a4a,0x18f));var _0xa9a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a4a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa9a4('0x0'));var rimraf=require(_0xa9a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a4('0x2'));var rp=require('request-promise');var moment=require(_0xa9a4('0x3'));var BPromise=require(_0xa9a4('0x4'));var Mustache=require('mustache');var util=require(_0xa9a4('0x5'));var path=require('path');var sox=require(_0xa9a4('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9a4('0x7'));var squel=require(_0xa9a4('0x8'));var crypto=require(_0xa9a4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xa9a4('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9a4('0xb'));var authService=require(_0xa9a4('0xc'));var qs=require(_0xa9a4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9a4('0xe'))(_0xa9a4('0xf'));var utils=require('../../config/utils');var config=require(_0xa9a4('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9a4('0x11'))['db'];config[_0xa9a4('0x12')]=_[_0xa9a4('0x13')](config[_0xa9a4('0x12')],{'host':_0xa9a4('0x14'),'port':0x18eb});var socket=require(_0xa9a4('0x15'))(new Redis(config[_0xa9a4('0x12')]));require(_0xa9a4('0x16'))[_0xa9a4('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xa9a4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x44b292,_0x36f1fb,_0x27f565,_0x481757){return new BPromise(function(_0x3dd817,_0x351383){var _0x5a9d9e=_0x481757||client;return _0x5a9d9e[_0xa9a4('0x19')](_0x44b292,_0x27f565)[_0xa9a4('0x1a')](function(_0x2822a5){logger[_0xa9a4('0x1b')](_0xa9a4('0x1c'),_0x36f1fb,_0xa9a4('0x1d'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x36f1fb,_0xa9a4('0x1d'),JSON[_0xa9a4('0x1e')](_0x2822a5));if(_0x2822a5['error']){if(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x20')]===0x1f4){logger[_0xa9a4('0x1f')](_0xa9a4('0x1c'),_0x36f1fb,_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);return _0x351383(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);}logger[_0xa9a4('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x36f1fb,_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);return _0x3dd817(_0x2822a5[_0xa9a4('0x1f')][_0xa9a4('0x21')]);}else{logger['info'](_0xa9a4('0x1c'),_0x36f1fb,_0xa9a4('0x1d'));_0x3dd817(_0x2822a5[_0xa9a4('0x22')][_0xa9a4('0x21')]);}})['catch'](function(_0x4173cd){logger[_0xa9a4('0x1f')](_0xa9a4('0x1c'),_0x36f1fb,_0x4173cd);_0x351383(_0x4173cd);});});}function respondWithStatusCode(_0x1f8369,_0x1a2c14){_0x1a2c14=_0x1a2c14||0xcc;return function(_0x44e910){if(_0x44e910){return _0x1f8369[_0xa9a4('0x23')](_0x1a2c14);}return _0x1f8369[_0xa9a4('0x24')](_0x1a2c14)['end']();};}function respondWithResult(_0x4c63f3,_0x103678){_0x103678=_0x103678||0xc8;return function(_0x78b145){if(_0x78b145){return _0x4c63f3[_0xa9a4('0x24')](_0x103678)[_0xa9a4('0x25')](_0x78b145);}};}function respondWithFilteredResult(_0x297104,_0x54e60d){return function(_0x567f45){if(_0x567f45){var _0x5634a9=typeof _0x54e60d[_0xa9a4('0x26')]===_0xa9a4('0x27')&&typeof _0x54e60d[_0xa9a4('0x28')]===_0xa9a4('0x27');var _0x599bcc=_0x567f45[_0xa9a4('0x29')];var _0x1b461e=_0x5634a9?0x0:_0x54e60d['offset'];var _0x92192e=_0x5634a9?_0x567f45['count']:_0x54e60d[_0xa9a4('0x26')]+_0x54e60d['limit'];var _0x96a00b;if(_0x92192e>=_0x599bcc){_0x92192e=_0x599bcc;_0x96a00b=0xc8;}else{_0x96a00b=0xce;}_0x297104[_0xa9a4('0x24')](_0x96a00b);return _0x297104[_0xa9a4('0x2a')](_0xa9a4('0x2b'),_0x1b461e+'-'+_0x92192e+'/'+_0x599bcc)['json'](_0x567f45);}return null;};}function patchUpdates(_0x2c0c8b){return function(_0x4ea02b){try{jsonpatch[_0xa9a4('0x2c')](_0x4ea02b,_0x2c0c8b,!![]);}catch(_0x45214b){return BPromise[_0xa9a4('0x2d')](_0x45214b);}return _0x4ea02b[_0xa9a4('0x2e')]();};}function saveUpdates(_0x1fd523,_0x154eff){return function(_0xac9678){if(_0xac9678){return _0xac9678[_0xa9a4('0x2f')](_0x1fd523)['then'](function(_0x4ca8a5){return _0x4ca8a5;});}return null;};}function removeEntity(_0xc7c7d1,_0x79692b){return function(_0x35a2f7){if(_0x35a2f7){return _0x35a2f7[_0xa9a4('0x30')]()[_0xa9a4('0x1a')](function(){_0xc7c7d1['status'](0xcc)[_0xa9a4('0x31')]();});}};}function handleEntityNotFound(_0x53b5d1,_0x3966f9){return function(_0x668d76){if(!_0x668d76){_0x53b5d1[_0xa9a4('0x23')](0x194);}return _0x668d76;};}function handleError(_0x2b15fb,_0x25ccc6){_0x25ccc6=_0x25ccc6||0x1f4;return function(_0x5e43c9){logger[_0xa9a4('0x1f')](_0x5e43c9[_0xa9a4('0x32')]);if(_0x5e43c9[_0xa9a4('0x33')]){delete _0x5e43c9[_0xa9a4('0x33')];}_0x2b15fb[_0xa9a4('0x24')](_0x25ccc6)[_0xa9a4('0x34')](_0x5e43c9);};}exports[_0xa9a4('0x35')]=function(_0x250da5,_0x151bb8){var _0x39610={},_0x165d82={},_0xdd581d={'count':0x0,'rows':[]};var _0x1a5a12=_[_0xa9a4('0x36')](db[_0xa9a4('0x37')][_0xa9a4('0x38')],function(_0x16569e){return{'name':_0x16569e['fieldName'],'type':_0x16569e[_0xa9a4('0x39')][_0xa9a4('0x3a')]};});_0x165d82['model']=_[_0xa9a4('0x36')](_0x1a5a12,_0xa9a4('0x33'));_0x165d82[_0xa9a4('0x3b')]=_[_0xa9a4('0x3c')](_0x250da5[_0xa9a4('0x3b')]);_0x165d82['filters']=_[_0xa9a4('0x3d')](_0x165d82[_0xa9a4('0x3e')],_0x165d82[_0xa9a4('0x3b')]);_0x39610['attributes']=_[_0xa9a4('0x3d')](_0x165d82['model'],qs['fields'](_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x3f')]));_0x39610['attributes']=_0x39610[_0xa9a4('0x40')][_0xa9a4('0x41')]?_0x39610[_0xa9a4('0x40')]:_0x165d82[_0xa9a4('0x3e')];if(!_0x250da5[_0xa9a4('0x3b')]['hasOwnProperty'](_0xa9a4('0x42'))){_0x39610[_0xa9a4('0x28')]=qs[_0xa9a4('0x28')](_0x250da5['query']['limit']);_0x39610[_0xa9a4('0x26')]=qs[_0xa9a4('0x26')](_0x250da5['query'][_0xa9a4('0x26')]);}_0x39610[_0xa9a4('0x43')]=qs[_0xa9a4('0x44')](_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x44')]);_0x39610[_0xa9a4('0x45')]=qs[_0xa9a4('0x46')](_['pick'](_0x250da5[_0xa9a4('0x3b')],_0x165d82[_0xa9a4('0x46')]),_0x1a5a12);if(_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x47')]){_0x39610[_0xa9a4('0x45')]=_[_0xa9a4('0x48')](_0x39610[_0xa9a4('0x45')],{'$or':_['map'](_0x1a5a12,function(_0x5b0c3e){if(_0x5b0c3e['type']!=='VIRTUAL'){var _0x33f4d3={};_0x33f4d3[_0x5b0c3e[_0xa9a4('0x33')]]={'$like':'%'+_0x250da5[_0xa9a4('0x3b')][_0xa9a4('0x47')]+'%'};return _0x33f4d3;}})});}_0x39610=_[_0xa9a4('0x48')]({},_0x39610,_0x250da5[_0xa9a4('0x49')]);var _0xb03670={'where':_0x39610['where']};return db['ChatMessage'][_0xa9a4('0x29')](_0xb03670)[_0xa9a4('0x1a')](function(_0x32df48){_0xdd581d[_0xa9a4('0x29')]=_0x32df48;if(_0x250da5[_0xa9a4('0x3b')]['includeAll']){_0x39610[_0xa9a4('0x4a')]=[{'all':!![]}];}return db[_0xa9a4('0x37')][_0xa9a4('0x4b')](_0x39610);})['then'](function(_0x4c41ef){_0xdd581d[_0xa9a4('0x4c')]=_0x4c41ef;return _0xdd581d;})[_0xa9a4('0x1a')](respondWithFilteredResult(_0x151bb8,_0x39610))[_0xa9a4('0x4d')](handleError(_0x151bb8,null));};exports[_0xa9a4('0x4e')]=function(_0xb47060,_0x463236){var _0x2c2965={'raw':!![],'where':{'id':_0xb47060[_0xa9a4('0x4f')]['id']}},_0x95a8da={};_0x95a8da[_0xa9a4('0x3e')]=_[_0xa9a4('0x3c')](db[_0xa9a4('0x37')]['rawAttributes']);_0x95a8da[_0xa9a4('0x3b')]=_['keys'](_0xb47060[_0xa9a4('0x3b')]);_0x95a8da['filters']=_[_0xa9a4('0x3d')](_0x95a8da[_0xa9a4('0x3e')],_0x95a8da[_0xa9a4('0x3b')]);_0x2c2965['attributes']=_[_0xa9a4('0x3d')](_0x95a8da['model'],qs['fields'](_0xb47060[_0xa9a4('0x3b')][_0xa9a4('0x3f')]));_0x2c2965[_0xa9a4('0x40')]=_0x2c2965[_0xa9a4('0x40')][_0xa9a4('0x41')]?_0x2c2965[_0xa9a4('0x40')]:_0x95a8da[_0xa9a4('0x3e')];if(_0xb47060[_0xa9a4('0x3b')]['includeAll']){_0x2c2965['include']=[{'all':!![]}];}_0x2c2965=_[_0xa9a4('0x48')]({},_0x2c2965,_0xb47060[_0xa9a4('0x49')]);return db['ChatMessage'][_0xa9a4('0x50')](_0x2c2965)[_0xa9a4('0x1a')](handleEntityNotFound(_0x463236,null))[_0xa9a4('0x1a')](respondWithResult(_0x463236,null))[_0xa9a4('0x4d')](handleError(_0x463236,null));};exports[_0xa9a4('0x51')]=function(_0x2448bf,_0x44a819){return db['ChatMessage'][_0xa9a4('0x51')](_0x2448bf[_0xa9a4('0x52')],{})[_0xa9a4('0x1a')](respondWithResult(_0x44a819,0xc9))[_0xa9a4('0x4d')](handleError(_0x44a819,null));};exports['update']=function(_0x404ed9,_0x266411){if(_0x404ed9['body']['id']){delete _0x404ed9[_0xa9a4('0x52')]['id'];}return db['ChatMessage'][_0xa9a4('0x50')]({'where':{'id':_0x404ed9[_0xa9a4('0x4f')]['id']}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x266411,null))[_0xa9a4('0x1a')](saveUpdates(_0x404ed9[_0xa9a4('0x52')],null))[_0xa9a4('0x1a')](respondWithResult(_0x266411,null))[_0xa9a4('0x4d')](handleError(_0x266411,null));};exports[_0xa9a4('0x30')]=function(_0x2dc8c8,_0x5c1cef){return db[_0xa9a4('0x37')]['find']({'where':{'id':_0x2dc8c8['params']['id']}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5c1cef,null))[_0xa9a4('0x1a')](removeEntity(_0x5c1cef,null))['catch'](handleError(_0x5c1cef,null));};exports[_0xa9a4('0x53')]=function(_0x40e084,_0x43428d){return db[_0xa9a4('0x37')]['describe']()[_0xa9a4('0x1a')](respondWithResult(_0x43428d,null))[_0xa9a4('0x4d')](handleError(_0x43428d,null));};var interaction_log=require('../../config/logger')(_0xa9a4('0x54'));exports[_0xa9a4('0x55')]=function(_0x33e46c,_0x45188d,_0x392323){var _0x3551dc={'agent':{},'channel':_0xa9a4('0x56')};if(_0x33e46c[_0xa9a4('0x52')]['id']){delete _0x33e46c['body']['id'];}_0x33e46c['body'][_0xa9a4('0x57')]=!![];_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x58')]=moment()[_0xa9a4('0x59')](_0xa9a4('0x5a'));_0x33e46c['body']['UserId']=_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')]||_0x33e46c[_0xa9a4('0x5c')]['id'];_0x3551dc['agent']['id']=_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')];return db[_0xa9a4('0x37')]['find']({'where':{'id':_0x33e46c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45188d,null))['then'](saveUpdates(_0x33e46c[_0xa9a4('0x52')],null))[_0xa9a4('0x1a')](function(_0x3f0021){if(_0x3f0021){_0x3551dc[_0xa9a4('0x21')]=_0x3f0021[_0xa9a4('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xa9a4('0x50')]({'where':{'id':_0x3f0021[_0xa9a4('0x5e')]}});}return null;})[_0xa9a4('0x1a')](handleEntityNotFound(_0x45188d,null))['then'](function(_0x53fa74){if(_0x53fa74){return _0x53fa74[_0xa9a4('0x2f')]({'UserId':_0x33e46c['body']['UserId'],'read1stAt':_[_0xa9a4('0x5f')](_0x53fa74['read1stAt'])?moment()[_0xa9a4('0x59')](_0xa9a4('0x5a')):undefined});}return null;})['then'](function(_0x26fa79){if(_0x26fa79){_0x3551dc[_0xa9a4('0x60')]=_0x26fa79['get']({'plain':!![]});interaction_log['info'](_0xa9a4('0x61'),_0x33e46c[_0xa9a4('0x5c')]['id'],_0x33e46c[_0xa9a4('0x5c')][_0xa9a4('0x33')],_0x33e46c['user']['role'],_0x3551dc[_0xa9a4('0x60')]['id'],_0x33e46c[_0xa9a4('0x52')]?JSON[_0xa9a4('0x1e')](_0x33e46c[_0xa9a4('0x52')]):_0xa9a4('0x62'));return respondWithRpcPromise(_0xa9a4('0x63'),_0xa9a4('0x64'),_0x3551dc);}return null;})[_0xa9a4('0x1a')](function(_0x11088f){var _0x2593e8=_0xa9a4('0x65')+_0x11088f['message'][_0xa9a4('0x66')];return db[_0xa9a4('0x67')][_0xa9a4('0x3b')](_0x2593e8,{'type':db[_0xa9a4('0x68')][_0xa9a4('0x69')][_0xa9a4('0x6a')],'raw':!![]})['then'](function(_0x56a47d){return _0x56a47d;});})[_0xa9a4('0x1a')](function(_0x3497c8){if(_0x3497c8){_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x6b')]=_0x3497c8[0x0];if(!_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')])return;return db[_0xa9a4('0x6c')][_0xa9a4('0x50')]({'where':{'id':_0x33e46c[_0xa9a4('0x52')][_0xa9a4('0x5b')],'role':'agent'},'attributes':['id',_0xa9a4('0x33'),_0xa9a4('0x6d'),_0xa9a4('0x6e'),_0xa9a4('0x6f')],'raw':!![]});}return null;})['then'](function(_0x45a9e0){if(!_0x45a9e0)return null;_0x3551dc['message']['agent']=_0x45a9e0;return _0x3551dc;})['then'](function(_0x340072){if(_0x340072){if(_0x33e46c[_0xa9a4('0x52')]['manual']){_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x70')]=util[_0xa9a4('0x59')](_0xa9a4('0x71'),_0x33e46c[_0xa9a4('0x5c')]['name']);_0x3551dc[_0xa9a4('0x21')]['channel']=_0x3551dc['channel'];_0x3551dc[_0xa9a4('0x21')][_0xa9a4('0x72')]=_0x3551dc[_0xa9a4('0x73')];_0x3551dc[_0xa9a4('0x21')]['event']=_0xa9a4('0x55');return respondWithRpcPromise(_0xa9a4('0x74'),_0xa9a4('0x74'),{'event':_0xa9a4('0x75'),'message':_[_0xa9a4('0x48')](_0x3551dc[_0xa9a4('0x21')],JSON[_0xa9a4('0x76')](_0x3551dc[_0xa9a4('0x60')]['formData']))},client9002)[_0xa9a4('0x1a')](function(){return _0x3551dc;});}return _0x3551dc;}return null;})[_0xa9a4('0x1a')](respondWithResult(_0x45188d,null))[_0xa9a4('0x4d')](handleError(_0x45188d,null));};var interaction_log=require(_0xa9a4('0xe'))(_0xa9a4('0x54'));exports[_0xa9a4('0x2d')]=function(_0x540b8d,_0x5395c9,_0x52bb91){var _0x5c4d43={'agent':{},'channel':_0xa9a4('0x56')};if(_0x540b8d[_0xa9a4('0x52')]['id']){delete _0x540b8d['body']['id'];}_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')]=_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')]||_0x540b8d[_0xa9a4('0x5c')]['id'];_0x5c4d43[_0xa9a4('0x77')]['id']=_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')];return db[_0xa9a4('0x37')][_0xa9a4('0x50')]({'where':{'id':_0x540b8d['params']['id'],'UserId':null}})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5395c9,null))[_0xa9a4('0x1a')](function(_0x7b2891){if(_0x7b2891){_0x5c4d43['message']=_0x7b2891[_0xa9a4('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xa9a4('0x50')]({'where':{'id':_0x7b2891[_0xa9a4('0x5e')]}});}return null;})[_0xa9a4('0x1a')](handleEntityNotFound(_0x5395c9,null))[_0xa9a4('0x1a')](function(_0x57fb9f){if(_0x57fb9f){_0x5c4d43[_0xa9a4('0x60')]=_0x57fb9f['get']({'plain':!![]});interaction_log[_0xa9a4('0x1b')](_0xa9a4('0x78'),_0x540b8d[_0xa9a4('0x5c')]['id'],_0x540b8d['user'][_0xa9a4('0x33')],_0x540b8d['user'][_0xa9a4('0x79')],_0x5c4d43['interaction']['id'],_0x540b8d[_0xa9a4('0x52')]?JSON[_0xa9a4('0x1e')](_0x540b8d[_0xa9a4('0x52')]):_0xa9a4('0x62'));return respondWithRpcPromise(_0xa9a4('0x7a'),_0xa9a4('0x7b'),_0x5c4d43);}return null;})['then'](function(_0x168fc0){var _0x141019='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x168fc0[_0xa9a4('0x21')][_0xa9a4('0x66')];return db[_0xa9a4('0x67')][_0xa9a4('0x3b')](_0x141019,{'type':db[_0xa9a4('0x68')]['QueryTypes'][_0xa9a4('0x6a')],'raw':!![]})['then'](function(_0x1c34a2){return _0x1c34a2;});})[_0xa9a4('0x1a')](function(_0x358187){if(_0x358187){_0x5c4d43[_0xa9a4('0x21')]['contact']=_0x358187[0x0];if(!_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')])return;return db['User']['find']({'where':{'id':_0x540b8d[_0xa9a4('0x52')][_0xa9a4('0x5b')],'role':_0xa9a4('0x77')},'attributes':['id',_0xa9a4('0x33'),_0xa9a4('0x6d'),_0xa9a4('0x6e'),'internal'],'raw':!![]});}return null;})[_0xa9a4('0x1a')](function(_0x43a2c7){if(!_0x43a2c7)return null;_0x5c4d43[_0xa9a4('0x21')][_0xa9a4('0x77')]=_0x43a2c7;return _0x5c4d43;})['then'](function(_0x4b6c06){if(_0x4b6c06){_0x4b6c06['message']['interface']=util['format'](_0xa9a4('0x71'),_0x540b8d['user'][_0xa9a4('0x33')]);_0x4b6c06[_0xa9a4('0x21')]['channel']=_0x5c4d43['channel'];_0x4b6c06[_0xa9a4('0x21')][_0xa9a4('0x72')]=_0x5c4d43[_0xa9a4('0x73')];_0x4b6c06[_0xa9a4('0x21')][_0xa9a4('0x7c')]=_0xa9a4('0x2d');respondWithRpcPromise(_0xa9a4('0x74'),_0xa9a4('0x74'),{'event':_0xa9a4('0x7d'),'message':_[_0xa9a4('0x48')](_0x5c4d43[_0xa9a4('0x21')],JSON[_0xa9a4('0x76')](_0x5c4d43['interaction'][_0xa9a4('0x7e')]))},client9002);return _0x5c4d43;}return null;})[_0xa9a4('0x1a')](respondWithResult(_0x5395c9,null))['catch'](handleError(_0x5395c9,null));}; \ No newline at end of file +var _0x009e=['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','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','email','manual','interface','SIP/%s','channel','event','accept','acceptmessage','parse','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','internal','motionChannel','EventManager','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x009e,0x100));var _0xe009=function(_0x374c1c,_0x522606){_0x374c1c=_0x374c1c-0x0;var _0x1c1c33=_0x009e[_0x374c1c];return _0x1c1c33;};'use strict';var emlformat=require(_0xe009('0x0'));var rimraf=require(_0xe009('0x1'));var zipdir=require(_0xe009('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe009('0x3'));var moment=require(_0xe009('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe009('0x5'));var util=require(_0xe009('0x6'));var path=require('path');var sox=require(_0xe009('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe009('0x8'));var _=require(_0xe009('0x9'));var squel=require(_0xe009('0xa'));var crypto=require(_0xe009('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe009('0xc'));var querystring=require('querystring');var Papa=require(_0xe009('0xd'));var Redis=require(_0xe009('0xe'));var authService=require(_0xe009('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe009('0x10'));var hardwareService=require(_0xe009('0x11'));var logger=require(_0xe009('0x12'))('api');var utils=require(_0xe009('0x13'));var config=require(_0xe009('0x14'));var licenseUtil=require(_0xe009('0x15'));var db=require(_0xe009('0x16'))['db'];config[_0xe009('0x17')]=_[_0xe009('0x18')](config[_0xe009('0x17')],{'host':_0xe009('0x19'),'port':0x18eb});var socket=require(_0xe009('0x1a'))(new Redis(config[_0xe009('0x17')]));require('./chatMessage.socket')[_0xe009('0x1b')](socket);var jayson=require(_0xe009('0x1c'));var client=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232c});var client9002=jayson[_0xe009('0x1d')][_0xe009('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc196a1,_0x376b50,_0x2d6eef,_0x1bb718){return new BPromise(function(_0x5608e2,_0x5c6e16){var _0x1be21f=_0x1bb718||client;return _0x1be21f[_0xe009('0x1f')](_0xc196a1,_0x2d6eef)[_0xe009('0x20')](function(_0x17a24d){logger[_0xe009('0x21')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0xe009('0x22'));logger[_0xe009('0x23')](_0xe009('0x24'),_0x376b50,_0xe009('0x22'),JSON[_0xe009('0x25')](_0x17a24d));if(_0x17a24d['error']){if(_0x17a24d[_0xe009('0x26')][_0xe009('0x27')]===0x1f4){logger['error'](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5c6e16(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}logger[_0xe009('0x26')](_0xe009('0x28'),_0x376b50,_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);return _0x5608e2(_0x17a24d[_0xe009('0x26')][_0xe009('0x29')]);}else{logger[_0xe009('0x21')](_0xe009('0x28'),_0x376b50,_0xe009('0x22'));_0x5608e2(_0x17a24d[_0xe009('0x2a')][_0xe009('0x29')]);}})[_0xe009('0x2b')](function(_0x20cb17){logger[_0xe009('0x26')]('ChatMessage,\x20%s,\x20%s',_0x376b50,_0x20cb17);_0x5c6e16(_0x20cb17);});});}function respondWithStatusCode(_0x144ba6,_0x8d7c8a){_0x8d7c8a=_0x8d7c8a||0xcc;return function(_0x27645f){if(_0x27645f){return _0x144ba6[_0xe009('0x2c')](_0x8d7c8a);}return _0x144ba6[_0xe009('0x2d')](_0x8d7c8a)[_0xe009('0x2e')]();};}function respondWithResult(_0x20a0b3,_0x1b5057){_0x1b5057=_0x1b5057||0xc8;return function(_0x4aff80){if(_0x4aff80){return _0x20a0b3[_0xe009('0x2d')](_0x1b5057)[_0xe009('0x2f')](_0x4aff80);}};}function respondWithFilteredResult(_0x29af6d,_0x9e7158){return function(_0x226102){if(_0x226102){var _0x64f245=typeof _0x9e7158[_0xe009('0x30')]==='undefined'&&typeof _0x9e7158[_0xe009('0x31')]==='undefined';var _0x310c83=_0x226102[_0xe009('0x32')];var _0x36a4d2=_0x64f245?0x0:_0x9e7158[_0xe009('0x30')];var _0x47a759=_0x64f245?_0x226102[_0xe009('0x32')]:_0x9e7158['offset']+_0x9e7158[_0xe009('0x31')];var _0xa1619b;if(_0x47a759>=_0x310c83){_0x47a759=_0x310c83;_0xa1619b=0xc8;}else{_0xa1619b=0xce;}_0x29af6d['status'](_0xa1619b);return _0x29af6d[_0xe009('0x33')](_0xe009('0x34'),_0x36a4d2+'-'+_0x47a759+'/'+_0x310c83)[_0xe009('0x2f')](_0x226102);}return null;};}function patchUpdates(_0x107bc6){return function(_0x30860c){try{jsonpatch[_0xe009('0x35')](_0x30860c,_0x107bc6,!![]);}catch(_0x44cdd6){return BPromise[_0xe009('0x36')](_0x44cdd6);}return _0x30860c[_0xe009('0x37')]();};}function saveUpdates(_0xc1873e,_0x43265d){return function(_0x240912){if(_0x240912){return _0x240912[_0xe009('0x38')](_0xc1873e)[_0xe009('0x20')](function(_0x2a1030){return _0x2a1030;});}return null;};}function removeEntity(_0x2a40d5,_0x2d3af4){return function(_0x57cff8){if(_0x57cff8){return _0x57cff8[_0xe009('0x39')]()[_0xe009('0x20')](function(){_0x2a40d5['status'](0xcc)[_0xe009('0x2e')]();});}};}function handleEntityNotFound(_0x3836e6,_0x213ee9){return function(_0xdcea0e){if(!_0xdcea0e){_0x3836e6[_0xe009('0x2c')](0x194);}return _0xdcea0e;};}function handleError(_0x3bd0ed,_0x95f08c){_0x95f08c=_0x95f08c||0x1f4;return function(_0x49c1d4){logger['error'](_0x49c1d4['stack']);if(_0x49c1d4[_0xe009('0x3a')]){delete _0x49c1d4['name'];}_0x3bd0ed[_0xe009('0x2d')](_0x95f08c)[_0xe009('0x3b')](_0x49c1d4);};}exports[_0xe009('0x3c')]=function(_0x48d2af,_0x83152){var _0xa637a2={},_0x5d9ddb={},_0x513008={'count':0x0,'rows':[]};var _0x3a220b=_[_0xe009('0x3d')](db[_0xe009('0x3e')]['rawAttributes'],function(_0x108453){return{'name':_0x108453['fieldName'],'type':_0x108453[_0xe009('0x3f')][_0xe009('0x40')]};});_0x5d9ddb[_0xe009('0x41')]=_['map'](_0x3a220b,_0xe009('0x3a'));_0x5d9ddb['query']=_[_0xe009('0x42')](_0x48d2af['query']);_0x5d9ddb[_0xe009('0x43')]=_['intersection'](_0x5d9ddb[_0xe009('0x41')],_0x5d9ddb[_0xe009('0x44')]);_0xa637a2[_0xe009('0x45')]=_[_0xe009('0x46')](_0x5d9ddb[_0xe009('0x41')],qs[_0xe009('0x47')](_0x48d2af['query']['fields']));_0xa637a2[_0xe009('0x45')]=_0xa637a2[_0xe009('0x45')][_0xe009('0x48')]?_0xa637a2['attributes']:_0x5d9ddb['model'];if(!_0x48d2af['query'][_0xe009('0x49')](_0xe009('0x4a'))){_0xa637a2['limit']=qs[_0xe009('0x31')](_0x48d2af[_0xe009('0x44')]['limit']);_0xa637a2[_0xe009('0x30')]=qs[_0xe009('0x30')](_0x48d2af[_0xe009('0x44')][_0xe009('0x30')]);}_0xa637a2[_0xe009('0x4b')]=qs[_0xe009('0x4c')](_0x48d2af[_0xe009('0x44')]['sort']);_0xa637a2[_0xe009('0x4d')]=qs[_0xe009('0x43')](_[_0xe009('0x4e')](_0x48d2af[_0xe009('0x44')],_0x5d9ddb['filters']),_0x3a220b);if(_0x48d2af['query'][_0xe009('0x4f')]){_0xa637a2['where']=_[_0xe009('0x50')](_0xa637a2[_0xe009('0x4d')],{'$or':_['map'](_0x3a220b,function(_0x3e563d){if(_0x3e563d['type']!==_0xe009('0x51')){var _0x5babb8={};_0x5babb8[_0x3e563d[_0xe009('0x3a')]]={'$like':'%'+_0x48d2af[_0xe009('0x44')]['filter']+'%'};return _0x5babb8;}})});}_0xa637a2=_[_0xe009('0x50')]({},_0xa637a2,_0x48d2af[_0xe009('0x52')]);var _0x35737c={'where':_0xa637a2[_0xe009('0x4d')]};return db['ChatMessage']['count'](_0x35737c)[_0xe009('0x20')](function(_0x578aa3){_0x513008['count']=_0x578aa3;if(_0x48d2af[_0xe009('0x44')]['includeAll']){_0xa637a2[_0xe009('0x53')]=[{'all':!![]}];}return db[_0xe009('0x3e')][_0xe009('0x54')](_0xa637a2);})[_0xe009('0x20')](function(_0x4f153a){_0x513008[_0xe009('0x55')]=_0x4f153a;return _0x513008;})[_0xe009('0x20')](respondWithFilteredResult(_0x83152,_0xa637a2))[_0xe009('0x2b')](handleError(_0x83152,null));};exports[_0xe009('0x56')]=function(_0x25a9ca,_0x409340){var _0xba677d={'raw':!![],'where':{'id':_0x25a9ca[_0xe009('0x57')]['id']}},_0xc3ed02={};_0xc3ed02[_0xe009('0x41')]=_['keys'](db[_0xe009('0x3e')][_0xe009('0x58')]);_0xc3ed02[_0xe009('0x44')]=_['keys'](_0x25a9ca[_0xe009('0x44')]);_0xc3ed02['filters']=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],_0xc3ed02['query']);_0xba677d[_0xe009('0x45')]=_[_0xe009('0x46')](_0xc3ed02[_0xe009('0x41')],qs[_0xe009('0x47')](_0x25a9ca['query']['fields']));_0xba677d[_0xe009('0x45')]=_0xba677d[_0xe009('0x45')][_0xe009('0x48')]?_0xba677d[_0xe009('0x45')]:_0xc3ed02[_0xe009('0x41')];if(_0x25a9ca[_0xe009('0x44')][_0xe009('0x59')]){_0xba677d['include']=[{'all':!![]}];}_0xba677d=_[_0xe009('0x50')]({},_0xba677d,_0x25a9ca[_0xe009('0x52')]);return db['ChatMessage'][_0xe009('0x5a')](_0xba677d)['then'](handleEntityNotFound(_0x409340,null))['then'](respondWithResult(_0x409340,null))[_0xe009('0x2b')](handleError(_0x409340,null));};exports[_0xe009('0x5b')]=function(_0x4228d5,_0x43555d){return db[_0xe009('0x3e')]['create'](_0x4228d5[_0xe009('0x5c')],{})[_0xe009('0x20')](respondWithResult(_0x43555d,0xc9))['catch'](handleError(_0x43555d,null));};exports[_0xe009('0x38')]=function(_0x396fa3,_0x52f454){if(_0x396fa3['body']['id']){delete _0x396fa3['body']['id'];}return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x396fa3[_0xe009('0x57')]['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x52f454,null))['then'](saveUpdates(_0x396fa3['body'],null))[_0xe009('0x20')](respondWithResult(_0x52f454,null))['catch'](handleError(_0x52f454,null));};exports[_0xe009('0x39')]=function(_0x4fe9ed,_0x2ed100){return db[_0xe009('0x3e')][_0xe009('0x5a')]({'where':{'id':_0x4fe9ed['params']['id']}})[_0xe009('0x20')](handleEntityNotFound(_0x2ed100,null))[_0xe009('0x20')](removeEntity(_0x2ed100,null))[_0xe009('0x2b')](handleError(_0x2ed100,null));};exports[_0xe009('0x5d')]=function(_0x2d1531,_0x50c29b){return db[_0xe009('0x3e')][_0xe009('0x5d')]()['then'](respondWithResult(_0x50c29b,null))['catch'](handleError(_0x50c29b,null));};var interaction_log=require('../../config/logger')(_0xe009('0x5e'));exports['accept']=function(_0x1ec3a0,_0x274353,_0x5ae96d){var _0x5eb828={'agent':{},'channel':_0xe009('0x5f')};if(_0x1ec3a0[_0xe009('0x5c')]['id']){delete _0x1ec3a0[_0xe009('0x5c')]['id'];}_0x1ec3a0['body'][_0xe009('0x60')]=!![];_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x61')]=moment()[_0xe009('0x62')](_0xe009('0x63'));_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]=_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')]||_0x1ec3a0[_0xe009('0x65')]['id'];_0x5eb828[_0xe009('0x66')]['id']=_0x1ec3a0[_0xe009('0x5c')]['UserId'];return db[_0xe009('0x3e')]['find']({'where':{'id':_0x1ec3a0[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))['then'](saveUpdates(_0x1ec3a0[_0xe009('0x5c')],null))['then'](function(_0x5e5d8a){if(_0x5e5d8a){_0x5eb828[_0xe009('0x29')]=_0x5e5d8a[_0xe009('0x67')]({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x5e5d8a['ChatInteractionId']}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0x274353,null))[_0xe009('0x20')](function(_0x268a58){if(_0x268a58){return _0x268a58[_0xe009('0x38')]({'UserId':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'read1stAt':_['isNil'](_0x268a58[_0xe009('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe009('0x20')](function(_0x2480d1){if(_0x2480d1){_0x5eb828['interaction']=_0x2480d1[_0xe009('0x67')]({'plain':!![]});interaction_log['info'](_0xe009('0x6a'),_0x1ec3a0[_0xe009('0x65')]['id'],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')],_0x1ec3a0[_0xe009('0x65')][_0xe009('0x6b')],_0x5eb828['interaction']['id'],_0x1ec3a0['body']?JSON['stringify'](_0x1ec3a0[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5eb828);}return null;})[_0xe009('0x20')](function(_0x5008e6){var _0x320a3b=_0xe009('0x6d')+_0x5008e6[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x320a3b,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xe009('0x20')](function(_0x19f8b8){return _0x19f8b8;});})[_0xe009('0x20')](function(_0x5194d9){if(_0x5194d9){_0x5eb828[_0xe009('0x29')][_0xe009('0x6e')]=_0x5194d9[0x0];if(!_0x1ec3a0[_0xe009('0x5c')]['UserId'])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id',_0xe009('0x3a'),'fullname',_0xe009('0x70'),'internal'],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x5b1cfd){if(!_0x5b1cfd)return null;_0x5eb828['message'][_0xe009('0x66')]=_0x5b1cfd;return _0x5eb828;})[_0xe009('0x20')](function(_0x393728){if(_0x393728){if(_0x1ec3a0[_0xe009('0x5c')][_0xe009('0x71')]){_0x5eb828[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x1ec3a0[_0xe009('0x65')][_0xe009('0x3a')]);_0x5eb828[_0xe009('0x29')][_0xe009('0x74')]=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')]['motionChannel']=_0x5eb828[_0xe009('0x74')];_0x5eb828[_0xe009('0x29')][_0xe009('0x75')]=_0xe009('0x76');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xe009('0x77'),'message':_[_0xe009('0x50')](_0x5eb828['message'],JSON[_0xe009('0x78')](_0x5eb828['interaction']['formData']))},client9002)['then'](function(){return _0x5eb828;});}return _0x5eb828;}return null;})[_0xe009('0x20')](respondWithResult(_0x274353,null))[_0xe009('0x2b')](handleError(_0x274353,null));};var interaction_log=require(_0xe009('0x12'))(_0xe009('0x5e'));exports[_0xe009('0x36')]=function(_0x485913,_0xbc1f52,_0x3f9980){var _0x1f3806={'agent':{},'channel':_0xe009('0x5f')};if(_0x485913[_0xe009('0x5c')]['id']){delete _0x485913[_0xe009('0x5c')]['id'];}_0x485913['body'][_0xe009('0x64')]=_0x485913['body'][_0xe009('0x64')]||_0x485913[_0xe009('0x65')]['id'];_0x1f3806[_0xe009('0x66')]['id']=_0x485913[_0xe009('0x5c')][_0xe009('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x485913[_0xe009('0x57')]['id'],'UserId':null}})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))[_0xe009('0x20')](function(_0x54c962){if(_0x54c962){_0x1f3806[_0xe009('0x29')]=_0x54c962['get']({'plain':!![]});return db[_0xe009('0x68')][_0xe009('0x5a')]({'where':{'id':_0x54c962[_0xe009('0x79')]}});}return null;})[_0xe009('0x20')](handleEntityNotFound(_0xbc1f52,null))['then'](function(_0x3b34f3){if(_0x3b34f3){_0x1f3806['interaction']=_0x3b34f3[_0xe009('0x67')]({'plain':!![]});interaction_log[_0xe009('0x21')](_0xe009('0x7a'),_0x485913[_0xe009('0x65')]['id'],_0x485913['user'][_0xe009('0x3a')],_0x485913[_0xe009('0x65')]['role'],_0x1f3806[_0xe009('0x7b')]['id'],_0x485913[_0xe009('0x5c')]?JSON[_0xe009('0x25')](_0x485913[_0xe009('0x5c')]):_0xe009('0x6c'));return respondWithRpcPromise(_0xe009('0x7c'),_0xe009('0x7d'),_0x1f3806);}return null;})[_0xe009('0x20')](function(_0x239596){var _0x73b9b0=_0xe009('0x6d')+_0x239596[_0xe009('0x29')]['ContactId'];return db['sequelize'][_0xe009('0x44')](_0x73b9b0,{'type':db[_0xe009('0x7e')][_0xe009('0x7f')][_0xe009('0x80')],'raw':!![]})['then'](function(_0xb27ecf){return _0xb27ecf;});})[_0xe009('0x20')](function(_0x164c01){if(_0x164c01){_0x1f3806[_0xe009('0x29')]['contact']=_0x164c01[0x0];if(!_0x485913[_0xe009('0x5c')][_0xe009('0x64')])return;return db[_0xe009('0x6f')][_0xe009('0x5a')]({'where':{'id':_0x485913['body'][_0xe009('0x64')],'role':_0xe009('0x66')},'attributes':['id','name',_0xe009('0x81'),_0xe009('0x70'),_0xe009('0x82')],'raw':!![]});}return null;})[_0xe009('0x20')](function(_0x3bbb7a){if(!_0x3bbb7a)return null;_0x1f3806[_0xe009('0x29')][_0xe009('0x66')]=_0x3bbb7a;return _0x1f3806;})['then'](function(_0x31cbfd){if(_0x31cbfd){_0x31cbfd[_0xe009('0x29')][_0xe009('0x72')]=util[_0xe009('0x62')](_0xe009('0x73'),_0x485913[_0xe009('0x65')][_0xe009('0x3a')]);_0x31cbfd[_0xe009('0x29')][_0xe009('0x74')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x83')]=_0x1f3806[_0xe009('0x74')];_0x31cbfd[_0xe009('0x29')][_0xe009('0x75')]='reject';respondWithRpcPromise(_0xe009('0x84'),'EventManager',{'event':_0xe009('0x85'),'message':_[_0xe009('0x50')](_0x1f3806[_0xe009('0x29')],JSON[_0xe009('0x78')](_0x1f3806[_0xe009('0x7b')]['formData']))},client9002);return _0x1f3806;}return null;})[_0xe009('0x20')](respondWithResult(_0xbc1f52,null))[_0xe009('0x2b')](handleError(_0xbc1f52,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cfe6e44..0463c86 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 _0xbdc3=['remove','emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update'];(function(_0x1290e6,_0xfc37c6){var _0x16391b=function(_0x358324){while(--_0x358324){_0x1290e6['push'](_0x1290e6['shift']());}};_0x16391b(++_0xfc37c6);}(_0xbdc3,0xfc));var _0x3bdc=function(_0x4e0882,_0x4f72ef){_0x4e0882=_0x4e0882-0x0;var _0x29adb7=_0xbdc3[_0x4e0882];return _0x29adb7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3bdc('0x0'))['db'][_0x3bdc('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3bdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bdc('0x3'),'afterDestroy':_0x3bdc('0x4')};function emitEvent(_0x1a2c98){return function(_0x4f50a2,_0x35db02,_0x379ccb){ChatMessageEvents['emit'](_0x1a2c98+':'+_0x4f50a2['id'],_0x4f50a2);ChatMessageEvents[_0x3bdc('0x5')](_0x1a2c98,_0x4f50a2);_0x379ccb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x3bdc('0x6')](e,emitEvent(event));}}module[_0x3bdc('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xb98a=['ChatMessage','setMaxListeners','update','remove','emit','events'];(function(_0x5e48ba,_0x5dd869){var _0x27076e=function(_0x5e6d75){while(--_0x5e6d75){_0x5e48ba['push'](_0x5e48ba['shift']());}};_0x27076e(++_0x5dd869);}(_0xb98a,0x1f1));var _0xab98=function(_0x1235a8,_0x2db48e){_0x1235a8=_0x1235a8-0x0;var _0x41a2cf=_0xb98a[_0x1235a8];return _0x41a2cf;};'use strict';var EventEmitter=require(_0xab98('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xab98('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab98('0x3'),'afterDestroy':_0xab98('0x4')};function emitEvent(_0x1ae6a0){return function(_0x4c4631,_0x2a2f1e,_0x4cfae4){ChatMessageEvents['emit'](_0x1ae6a0+':'+_0x4c4631['id'],_0x4c4631);ChatMessageEvents[_0xab98('0x5')](_0x1ae6a0,_0x4c4631);_0x4cfae4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6bee575..b7f515d 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 _0xe9d5=['out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','direction','toLowerCase'];(function(_0x4385b6,_0x22cea0){var _0x7a3252=function(_0x5a3470){while(--_0x5a3470){_0x4385b6['push'](_0x4385b6['shift']());}};_0x7a3252(++_0x22cea0);}(_0xe9d5,0x191));var _0x5e9d=function(_0x42e2a0,_0xd2a7e1){_0x42e2a0=_0x42e2a0-0x0;var _0x3dbf06=_0xe9d5[_0x42e2a0];return _0x3dbf06;};'use strict';var _=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var logger=require(_0x5e9d('0x2'))(_0x5e9d('0x3'));var moment=require(_0x5e9d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e9d('0x5'));var fs=require('fs');var path=require(_0x5e9d('0x6'));var rimraf=require(_0x5e9d('0x7'));var config=require(_0x5e9d('0x8'));var attributes=require(_0x5e9d('0x9'));module[_0x5e9d('0xa')]=function(_0x22cedf,_0x2c156f){return _0x22cedf[_0x5e9d('0xb')](_0x5e9d('0xc'),attributes,{'tableName':_0x5e9d('0xd'),'paranoid':![],'indexes':[{'name':_0x5e9d('0xe'),'fields':['body'],'type':_0x5e9d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2747b9,_0x8bdc65,_0x43a167){var _0x11d50b=_0x22cedf[_0x5e9d('0x10')];var _0x206aaa=_0x2747b9['get']({'plain':!![]});if(_0x206aaa[_0x5e9d('0x11')][_0x5e9d('0x12')]()==='in'||_0x206aaa['direction'][_0x5e9d('0x12')]()===_0x5e9d('0x13')&&!_0x206aaa[_0x5e9d('0x14')]&&!_[_0x5e9d('0x15')](_0x206aaa[_0x5e9d('0x16')])){_0x11d50b[_0x5e9d('0x17')][_0x5e9d('0x18')]({'where':{'id':_0x206aaa[_0x5e9d('0x19')]}})[_0x5e9d('0x1a')](function(_0x224167){if(_0x224167){_0x224167['update']({'lastMsgAt':_0x206aaa['createdAt'],'lastMsgDirection':_0x206aaa[_0x5e9d('0x11')][_0x5e9d('0x12')]()});}})[_0x5e9d('0x1b')](function(_0x564037){console['error'](_0x564037);});}_0x43a167();}},'charset':_0x5e9d('0x1c'),'collate':_0x5e9d('0x1d')});}; \ No newline at end of file +var _0x330c=['update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteractionId','then'];(function(_0x383875,_0x45b02b){var _0x128fc2=function(_0x247f99){while(--_0x247f99){_0x383875['push'](_0x383875['shift']());}};_0x128fc2(++_0x45b02b);}(_0x330c,0x186));var _0xc330=function(_0x56f0f8,_0x28d84a){_0x56f0f8=_0x56f0f8-0x0;var _0x29c23c=_0x330c[_0x56f0f8];return _0x29c23c;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[{'name':_0xc330('0xd'),'fields':[_0xc330('0xe')],'type':_0xc330('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bebaa,_0x48480e,_0x150c7d){var _0x4c1a5f=_0x4f49fb[_0xc330('0x10')];var _0x49ad4c=_0x1bebaa[_0xc330('0x11')]({'plain':!![]});if(_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()==='in'||_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()===_0xc330('0x14')&&!_0x49ad4c[_0xc330('0x15')]&&!_[_0xc330('0x16')](_0x49ad4c[_0xc330('0x17')])){_0x4c1a5f['ChatInteraction']['findOne']({'where':{'id':_0x49ad4c[_0xc330('0x18')]}})[_0xc330('0x19')](function(_0x5066d8){if(_0x5066d8){_0x5066d8[_0xc330('0x1a')]({'lastMsgAt':_0x49ad4c[_0xc330('0x1b')],'lastMsgDirection':_0x49ad4c[_0xc330('0x12')][_0xc330('0x13')]()});}})[_0xc330('0x1c')](function(_0xdd6f7f){console[_0xc330('0x1d')](_0xdd6f7f);});}_0x150c7d();}},'charset':_0xc330('0x1e'),'collate':_0xc330('0x1f')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7f6d3c9..888ff0f 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 _0x28f9=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util'];(function(_0x43371b,_0x1cb4cf){var _0x19cd26=function(_0x5f43bf){while(--_0x5f43bf){_0x43371b['push'](_0x43371b['shift']());}};_0x19cd26(++_0x1cb4cf);}(_0x28f9,0x174));var _0x928f=function(_0x13e655,_0x14669a){_0x13e655=_0x13e655-0x0;var _0xb47447=_0x28f9[_0x13e655];return _0xb47447;};'use strict';var _=require(_0x928f('0x0'));var util=require(_0x928f('0x1'));var moment=require(_0x928f('0x2'));var BPromise=require(_0x928f('0x3'));var rs=require(_0x928f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x928f('0x5'));var logger=require(_0x928f('0x6'))(_0x928f('0x7'));var config=require(_0x928f('0x8'));var jayson=require(_0x928f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x928f('0xa')]=_[_0x928f('0xb')](config['redis'],{'host':_0x928f('0xc'),'port':0x18eb});var socket=require(_0x928f('0xd'))(new Redis(config[_0x928f('0xa')]));require(_0x928f('0xe'))[_0x928f('0xf')](socket);function respondWithRpcPromise(_0x34481f,_0xa862b2,_0x3b92f6){return new BPromise(function(_0xaee291,_0x1d4d24){return client[_0x928f('0x10')](_0x34481f,_0x3b92f6)[_0x928f('0x11')](function(_0x4bbddd){logger[_0x928f('0x12')]('ChatMessage,\x20%s,\x20%s',_0xa862b2,_0x928f('0x13'));logger[_0x928f('0x14')](_0x928f('0x15'),_0xa862b2,_0x928f('0x13'),JSON[_0x928f('0x16')](_0x4bbddd));if(_0x4bbddd[_0x928f('0x17')]){if(_0x4bbddd['error'][_0x928f('0x18')]===0x1f4){logger[_0x928f('0x17')]('ChatMessage,\x20%s,\x20%s',_0xa862b2,_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);return _0x1d4d24(_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);}logger[_0x928f('0x17')](_0x928f('0x1a'),_0xa862b2,_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);return _0xaee291(_0x4bbddd[_0x928f('0x17')][_0x928f('0x19')]);}else{logger[_0x928f('0x12')](_0x928f('0x1a'),_0xa862b2,_0x928f('0x13'));_0xaee291(_0x4bbddd['result'][_0x928f('0x19')]);}})[_0x928f('0x1b')](function(_0x1b92ed){logger[_0x928f('0x17')](_0x928f('0x1a'),_0xa862b2,_0x1b92ed);_0x1d4d24(_0x1b92ed);});});}exports[_0x928f('0x1c')]=function(_0x1eb22e){var _0x485caf=this;return new Promise(function(_0xe946c,_0xd630a2){return db[_0x928f('0x1d')][_0x928f('0x1e')](_0x1eb22e[_0x928f('0x1f')],{'raw':_0x1eb22e['options']?_0x1eb22e[_0x928f('0x20')][_0x928f('0x21')]===undefined?!![]:![]:!![]})[_0x928f('0x11')](function(_0x2e5b25){logger[_0x928f('0x12')](_0x928f('0x1c'),_0x1eb22e);logger[_0x928f('0x14')](_0x928f('0x1c'),_0x1eb22e,JSON[_0x928f('0x16')](_0x2e5b25));_0xe946c(_0x2e5b25);})['catch'](function(_0xfee195){logger[_0x928f('0x17')]('CreateChatMessage',_0xfee195['message'],_0x1eb22e);_0xd630a2(_0x485caf[_0x928f('0x17')](0x1f4,_0xfee195[_0x928f('0x19')]));});});}; \ No newline at end of file +var _0x3cb7=['redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','body','options','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x1f62c9,_0x57a575){var _0x150b84=function(_0x48d237){while(--_0x48d237){_0x1f62c9['push'](_0x1f62c9['shift']());}};_0x150b84(++_0x57a575);}(_0x3cb7,0xcf));var _0x73cb=function(_0x5d68a2,_0x4304cf){_0x5d68a2=_0x5d68a2-0x0;var _0x5b3088=_0x3cb7[_0x5d68a2];return _0x5b3088;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});config[_0x73cb('0xa')]=_[_0x73cb('0xb')](config[_0x73cb('0xa')],{'host':_0x73cb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73cb('0xa')]));require(_0x73cb('0xd'))[_0x73cb('0xe')](socket);function respondWithRpcPromise(_0x29deae,_0x1826dd,_0xc1a63e){return new BPromise(function(_0x43eab2,_0x501542){return client[_0x73cb('0xf')](_0x29deae,_0xc1a63e)[_0x73cb('0x10')](function(_0x35900e){logger[_0x73cb('0x11')](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));logger['debug'](_0x73cb('0x14'),_0x1826dd,_0x73cb('0x13'),JSON[_0x73cb('0x15')](_0x35900e));if(_0x35900e[_0x73cb('0x16')]){if(_0x35900e[_0x73cb('0x16')][_0x73cb('0x17')]===0x1f4){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x501542(_0x35900e['error']['message']);}logger['error'](_0x73cb('0x12'),_0x1826dd,_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);return _0x43eab2(_0x35900e[_0x73cb('0x16')][_0x73cb('0x18')]);}else{logger['info'](_0x73cb('0x12'),_0x1826dd,_0x73cb('0x13'));_0x43eab2(_0x35900e[_0x73cb('0x19')][_0x73cb('0x18')]);}})[_0x73cb('0x1a')](function(_0x28ee3b){logger[_0x73cb('0x16')](_0x73cb('0x12'),_0x1826dd,_0x28ee3b);_0x501542(_0x28ee3b);});});}exports[_0x73cb('0x1b')]=function(_0x31fb89){var _0x50a5c4=this;return new Promise(function(_0xe092aa,_0x18d19e){return db['ChatMessage']['create'](_0x31fb89[_0x73cb('0x1c')],{'raw':_0x31fb89[_0x73cb('0x1d')]?_0x31fb89[_0x73cb('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x73cb('0x10')](function(_0x4885e9){logger['info'](_0x73cb('0x1b'),_0x31fb89);logger[_0x73cb('0x1e')]('CreateChatMessage',_0x31fb89,JSON[_0x73cb('0x15')](_0x4885e9));_0xe092aa(_0x4885e9);})[_0x73cb('0x1a')](function(_0x24bae0){logger['error'](_0x73cb('0x1b'),_0x24bae0[_0x73cb('0x18')],_0x31fb89);_0x18d19e(_0x50a5c4[_0x73cb('0x16')](0x1f4,_0x24bae0[_0x73cb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 18ab84f..7ef8b49 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 _0xd6d2=['save','update','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x49290b,_0x3916bf){_0x49290b=_0x49290b-0x0;var _0x23a179=_0xd6d2[_0x49290b];return _0x23a179;};'use strict';var ChatMessageEvents=require(_0x2d6d('0x0'));var events=[_0x2d6d('0x1'),'remove',_0x2d6d('0x2')];function createListener(_0x224caa,_0x5b4a5b){return function(_0x2c2dd9){_0x5b4a5b['emit'](_0x224caa,_0x2c2dd9);};}function removeListener(_0x1c5e54,_0x3ee519){return function(){ChatMessageEvents[_0x2d6d('0x3')](_0x1c5e54,_0x3ee519);};}exports['register']=function(_0xfcdb1d){for(var _0x132361=0x0,_0xf59b20=events[_0x2d6d('0x4')];_0x132361<_0xf59b20;_0x132361++){var _0x4002b7=events[_0x132361];var _0x42d802=createListener(_0x2d6d('0x5')+_0x4002b7,_0xfcdb1d);ChatMessageEvents['on'](_0x4002b7,_0x42d802);}}; \ No newline at end of file +var _0x19da=['update','register','length','save'];(function(_0x3771c8,_0x4f1814){var _0x54917f=function(_0x5287d3){while(--_0x5287d3){_0x3771c8['push'](_0x3771c8['shift']());}};_0x54917f(++_0x4f1814);}(_0x19da,0x9f));var _0xa19d=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x19da[_0x59bcb1];return _0x4a737f;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xa19d('0x0'),'remove',_0xa19d('0x1')];function createListener(_0x5ba569,_0x3a48f4){return function(_0x17f1c6){_0x3a48f4['emit'](_0x5ba569,_0x17f1c6);};}function removeListener(_0x179db7,_0x28ec9a){return function(){ChatMessageEvents['removeListener'](_0x179db7,_0x28ec9a);};}exports[_0xa19d('0x2')]=function(_0x330adb){for(var _0x1f6e10=0x0,_0x14dc68=events[_0xa19d('0x3')];_0x1f6e10<_0x14dc68;_0x1f6e10++){var _0x4b4627=events[_0x1f6e10];var _0x197c4e=createListener('chatMessage:'+_0x4b4627,_0x330adb);ChatMessageEvents['on'](_0x4b4627,_0x197c4e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 25ee71d..7dc0c69 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 _0x464b=['create','put','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat'];(function(_0x4a4fd1,_0x538e3d){var _0x490c2e=function(_0xc903d6){while(--_0xc903d6){_0x4a4fd1['push'](_0x4a4fd1['shift']());}};_0x490c2e(++_0x538e3d);}(_0x464b,0x1d4));var _0xb464=function(_0x3e1c5d,_0x49b4fa){_0x3e1c5d=_0x3e1c5d-0x0;var _0x52979e=_0x464b[_0x3e1c5d];return _0x52979e;};'use strict';var multer=require(_0xb464('0x0'));var util=require(_0xb464('0x1'));var path=require(_0xb464('0x2'));var timeout=require(_0xb464('0x3'));var express=require('express');var router=express[_0xb464('0x4')]();var fs_extra=require(_0xb464('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb464('0x6'));var controller=require('./chatMessage.controller');router[_0xb464('0x7')]('/',auth[_0xb464('0x8')](),controller[_0xb464('0x9')]);router['get'](_0xb464('0xa'),auth[_0xb464('0x8')](),controller[_0xb464('0xb')]);router[_0xb464('0x7')](_0xb464('0xc'),auth[_0xb464('0x8')](),controller['show']);router[_0xb464('0xd')]('/',auth[_0xb464('0x8')](),interaction[_0xb464('0xe')](_0xb464('0xf'),'chatmessage:create'),controller[_0xb464('0x10')]);router['put'](_0xb464('0xc'),controller['update']);router[_0xb464('0x11')](_0xb464('0x12'),auth[_0xb464('0x8')](),controller[_0xb464('0x13')]);router['put'](_0xb464('0x14'),auth[_0xb464('0x8')](),controller[_0xb464('0x15')]);router['delete'](_0xb464('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x87d1=['put','/:id/accept','accept','reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','tracked','chat'];(function(_0x22e8a9,_0x148d2b){var _0x46f0b2=function(_0x3b3079){while(--_0x3b3079){_0x22e8a9['push'](_0x22e8a9['shift']());}};_0x46f0b2(++_0x148d2b);}(_0x87d1,0x1bf));var _0x187d=function(_0x1be453,_0x4328ae){_0x1be453=_0x1be453-0x0;var _0x569960=_0x87d1[_0x1be453];return _0x569960;};'use strict';var multer=require(_0x187d('0x0'));var util=require('util');var path=require(_0x187d('0x1'));var timeout=require(_0x187d('0x2'));var express=require('express');var router=express[_0x187d('0x3')]();var fs_extra=require(_0x187d('0x4'));var auth=require(_0x187d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x187d('0x6'));router[_0x187d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x187d('0x7')]('/describe',auth[_0x187d('0x8')](),controller[_0x187d('0x9')]);router['get'](_0x187d('0xa'),auth[_0x187d('0x8')](),controller['show']);router['post']('/',auth[_0x187d('0x8')](),interaction[_0x187d('0xb')](_0x187d('0xc'),'chatmessage:create'),controller['create']);router[_0x187d('0xd')]('/:id',controller['update']);router['put'](_0x187d('0xe'),auth[_0x187d('0x8')](),controller[_0x187d('0xf')]);router[_0x187d('0xd')]('/:id/reject',auth['isAuthenticated'](),controller[_0x187d('0x10')]);router[_0x187d('0x11')](_0x187d('0xa'),auth['isAuthenticated'](),controller[_0x187d('0x12')]);module[_0x187d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f92eaa6..ba7609d 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0xa388be,_0x2ff1ae){var _0x4d03ef=function(_0x3f0ab7){while(--_0x3f0ab7){_0xa388be['push'](_0xa388be['shift']());}};_0x4d03ef(++_0x2ff1ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e1297,_0x4a2705){_0x5e1297=_0x5e1297-0x0;var _0x7f80d=_0x5f2f[_0x5e1297];return _0x7f80d;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x23183c,_0x46de69){var _0x231ba2=function(_0x1c4eb5){while(--_0x1c4eb5){_0x23183c['push'](_0x23183c['shift']());}};_0x231ba2(++_0x46de69);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3dc688,_0x4c604b){_0x3dc688=_0x3dc688-0x0;var _0x26cea2=_0x5f2f[_0x3dc688];return _0x26cea2;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b2fc182..e2bc9ce 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(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2596,_0x43a807){_0x4f2596=_0x4f2596-0x0;var _0x1be403=_0x7a54[_0x4f2596];return _0x1be403;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7a54,0x106));var _0x47a5=function(_0x66f9f7,_0x4ee763){_0x66f9f7=_0x66f9f7-0x0;var _0x51948f=_0x7a54[_0x66f9f7];return _0x51948f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index fc8f4e6..5ae0e9d 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 _0x35a1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x35a1,0x1ad));var _0x135a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35a1[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x135a('0x0'))['db'][_0x135a('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x135a('0x2'),'afterUpdate':_0x135a('0x3'),'afterDestroy':_0x135a('0x4')};function emitEvent(_0x4bf63e){return function(_0x416949,_0x31b116,_0x4db0fc){ChatOfflineMessageEvents[_0x135a('0x5')](_0x4bf63e+':'+_0x416949['id'],_0x416949);ChatOfflineMessageEvents['emit'](_0x4bf63e,_0x416949);_0x4db0fc(null);};}for(var e in events){if(events[_0x135a('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x135a('0x7')](e,emitEvent(event));}}module[_0x135a('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x9b09=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x2134b7,_0x1eb5e2){var _0x6c5914=function(_0x1da201){while(--_0x1da201){_0x2134b7['push'](_0x2134b7['shift']());}};_0x6c5914(++_0x1eb5e2);}(_0x9b09,0xfd));var _0x99b0=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x9b09[_0x1559a5];return _0x17a783;};'use strict';var EventEmitter=require(_0x99b0('0x0'));var ChatOfflineMessage=require(_0x99b0('0x1'))['db'][_0x99b0('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x99b0('0x3')};function emitEvent(_0x38c7be){return function(_0x163d3b,_0x30f596,_0x120ca5){ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be+':'+_0x163d3b['id'],_0x163d3b);ChatOfflineMessageEvents[_0x99b0('0x4')](_0x38c7be,_0x163d3b);_0x120ca5(null);};}for(var e in events){if(events[_0x99b0('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x99b0('0x6')](e,emitEvent(event));}}module[_0x99b0('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5c50f02..afb5525 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 _0x55a2=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x58bda4,_0x1c83fe){var _0x1e7305=function(_0x25f958){while(--_0x25f958){_0x58bda4['push'](_0x58bda4['shift']());}};_0x1e7305(++_0x1c83fe);}(_0x55a2,0x7e));var _0x255a=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x55a2[_0x548627];return _0x844a84;};'use strict';var attributes=require(_0x255a('0x0'));module[_0x255a('0x1')]=function(_0x3e22c5){return _0x3e22c5[_0x255a('0x2')](_0x255a('0x3'),attributes,{'tableName':_0x255a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x255a('0x5'),'collate':_0x255a('0x6')});}; \ No newline at end of file +var _0x085c=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x42a3c0,_0x522753){var _0x1da011=function(_0x24cda7){while(--_0x24cda7){_0x42a3c0['push'](_0x42a3c0['shift']());}};_0x1da011(++_0x522753);}(_0x085c,0x13e));var _0xc085=function(_0x33ea9e,_0x2f0d10){_0x33ea9e=_0x33ea9e-0x0;var _0x3ac557=_0x085c[_0x33ea9e];return _0x3ac557;};'use strict';var attributes=require(_0xc085('0x0'));module[_0xc085('0x1')]=function(_0x4fe6bd){return _0x4fe6bd['define'](_0xc085('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc085('0x3'),'collate':_0xc085('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f002207..7996092 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 _0x8987=['result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent'];(function(_0x42754d,_0x33a711){var _0x2190d0=function(_0xd2083){while(--_0xd2083){_0x42754d['push'](_0x42754d['shift']());}};_0x2190d0(++_0x33a711);}(_0x8987,0xc9));var _0x7898=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x8987[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x7898('0x0'));var moment=require(_0x7898('0x1'));var BPromise=require(_0x7898('0x2'));var rs=require(_0x7898('0x3'));var fs=require('fs');var Redis=require(_0x7898('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7898('0x5'));var logger=require(_0x7898('0x6'))(_0x7898('0x7'));var config=require(_0x7898('0x8'));var jayson=require(_0x7898('0x9'));var client=jayson[_0x7898('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd71b66,_0x2d9ea6,_0x35d16c){return new BPromise(function(_0x56347f,_0x2a88c2){return client[_0x7898('0xb')](_0xd71b66,_0x35d16c)['then'](function(_0x8db27){logger[_0x7898('0xc')](_0x7898('0xd'),_0x2d9ea6,'request\x20sent');logger[_0x7898('0xe')](_0x7898('0xf'),_0x2d9ea6,'request\x20sent',JSON['stringify'](_0x8db27));if(_0x8db27[_0x7898('0x10')]){if(_0x8db27['error']['code']===0x1f4){logger[_0x7898('0x10')](_0x7898('0xd'),_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x2a88c2(_0x8db27[_0x7898('0x10')]['message']);}logger[_0x7898('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);return _0x56347f(_0x8db27[_0x7898('0x10')][_0x7898('0x11')]);}else{logger[_0x7898('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d9ea6,_0x7898('0x12'));_0x56347f(_0x8db27[_0x7898('0x13')][_0x7898('0x11')]);}})['catch'](function(_0x26cb5a){logger['error'](_0x7898('0xd'),_0x2d9ea6,_0x26cb5a);_0x2a88c2(_0x26cb5a);});});} \ No newline at end of file +var _0xb13b=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xb13b,0x1de));var _0xbb13=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb13b[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var moment=require(_0xbb13('0x2'));var BPromise=require(_0xbb13('0x3'));var rs=require(_0xbb13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb13('0x5'))['db'];var utils=require(_0xbb13('0x6'));var logger=require('../../config/logger')(_0xbb13('0x7'));var config=require(_0xbb13('0x8'));var jayson=require(_0xbb13('0x9'));var client=jayson[_0xbb13('0xa')][_0xbb13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd4a4bd,_0x1067a5,_0x3be2d2){return new BPromise(function(_0x56dc8f,_0x58d7d0){return client[_0xbb13('0xc')](_0xd4a4bd,_0x3be2d2)[_0xbb13('0xd')](function(_0x1c71b9){logger[_0xbb13('0xe')](_0xbb13('0xf'),_0x1067a5,_0xbb13('0x10'));logger[_0xbb13('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1067a5,_0xbb13('0x10'),JSON[_0xbb13('0x12')](_0x1c71b9));if(_0x1c71b9[_0xbb13('0x13')]){if(_0x1c71b9['error'][_0xbb13('0x14')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x58d7d0(_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);}logger['error'](_0xbb13('0xf'),_0x1067a5,_0x1c71b9[_0xbb13('0x13')][_0xbb13('0x15')]);return _0x56dc8f(_0x1c71b9['error'][_0xbb13('0x15')]);}else{logger['info'](_0xbb13('0xf'),_0x1067a5,'request\x20sent');_0x56dc8f(_0x1c71b9[_0xbb13('0x16')][_0xbb13('0x15')]);}})[_0xbb13('0x17')](function(_0x53602a){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x1067a5,_0x53602a);_0x58d7d0(_0x53602a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a1372ec..2ee7f38 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 _0xe910=['update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put'];(function(_0x26adb2,_0x7bb3f8){var _0x39b09b=function(_0x3fa344){while(--_0x3fa344){_0x26adb2['push'](_0x26adb2['shift']());}};_0x39b09b(++_0x7bb3f8);}(_0xe910,0x1a7));var _0x0e91=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xe910[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require('multer');var util=require(_0x0e91('0x0'));var path=require(_0x0e91('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e91('0x2'));var router=express[_0x0e91('0x3')]();var fs_extra=require(_0x0e91('0x4'));var auth=require(_0x0e91('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e91('0x6'));var controller=require(_0x0e91('0x7'));router['get']('/',auth[_0x0e91('0x8')](),controller['index']);router[_0x0e91('0x9')](_0x0e91('0xa'),auth[_0x0e91('0x8')](),controller[_0x0e91('0xb')]);router[_0x0e91('0x9')](_0x0e91('0xc'),auth['isAuthenticated'](),controller[_0x0e91('0xd')]);router[_0x0e91('0xe')]('/',auth['isAuthenticated'](),controller[_0x0e91('0xf')]);router[_0x0e91('0x10')](_0x0e91('0xc'),auth[_0x0e91('0x8')](),controller[_0x0e91('0x11')]);router[_0x0e91('0x12')](_0x0e91('0xc'),auth[_0x0e91('0x8')](),controller[_0x0e91('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0b93=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b93,0x15f));var _0x30b9=function(_0x49534b,_0x147009){_0x49534b=_0x49534b-0x0;var _0x22517e=_0x0b93[_0x49534b];return _0x22517e;};'use strict';var multer=require('multer');var util=require(_0x30b9('0x0'));var path=require('path');var timeout=require(_0x30b9('0x1'));var express=require(_0x30b9('0x2'));var router=express[_0x30b9('0x3')]();var fs_extra=require(_0x30b9('0x4'));var auth=require(_0x30b9('0x5'));var interaction=require(_0x30b9('0x6'));var config=require(_0x30b9('0x7'));var controller=require(_0x30b9('0x8'));router[_0x30b9('0x9')]('/',auth[_0x30b9('0xa')](),controller[_0x30b9('0xb')]);router[_0x30b9('0x9')](_0x30b9('0xc'),auth[_0x30b9('0xa')](),controller[_0x30b9('0xd')]);router[_0x30b9('0x9')](_0x30b9('0xe'),auth['isAuthenticated'](),controller[_0x30b9('0xf')]);router[_0x30b9('0x10')]('/',auth['isAuthenticated'](),controller[_0x30b9('0x11')]);router[_0x30b9('0x12')](_0x30b9('0xe'),auth[_0x30b9('0xa')](),controller['update']);router[_0x30b9('0x13')](_0x30b9('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x30b9('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3d4f5e8..c125392 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 _0xb543=['STRING','ENUM','mouseOver','timeout','sequelize','exports'];(function(_0x4a3684,_0x167231){var _0x227b6f=function(_0x515864){while(--_0x515864){_0x4a3684['push'](_0x4a3684['shift']());}};_0x227b6f(++_0x167231);}(_0xb543,0x7c));var _0x3b54=function(_0x3a8a05,_0xbf58dc){_0x3a8a05=_0x3a8a05-0x0;var _0x1f7fa1=_0xb543[_0x3a8a05];return _0x1f7fa1;};'use strict';var Sequelize=require(_0x3b54('0x0'));module[_0x3b54('0x1')]={'name':{'type':Sequelize[_0x3b54('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3b54('0x3')](_0x3b54('0x4'),_0x3b54('0x5')),'defaultValue':_0x3b54('0x4')},'selector':{'type':Sequelize[_0x3b54('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe9a9=['exports','STRING','ENUM','mouseOver','timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe9a9,0x1b3));var _0x9e9a=function(_0x5fb411,_0x5e0a38){_0x5fb411=_0x5fb411-0x0;var _0xb5443d=_0xe9a9[_0x5fb411];return _0xb5443d;};'use strict';var Sequelize=require('sequelize');module[_0x9e9a('0x0')]={'name':{'type':Sequelize[_0x9e9a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9e9a('0x2')](_0x9e9a('0x3'),_0x9e9a('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x9e9a('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 486b58d..bf7850e 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 _0x8a28=['options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','params','ChatProactiveAction','rawAttributes','query','keys','filters','model','attributes','intersection','fields','includeAll','merge'];(function(_0x1cd708,_0x19f60d){var _0x2899d3=function(_0x256399){while(--_0x256399){_0x1cd708['push'](_0x1cd708['shift']());}};_0x2899d3(++_0x19f60d);}(_0x8a28,0xfd));var _0x88a2=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x8a28[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require(_0x88a2('0x2'));var jsonpatch=require(_0x88a2('0x3'));var rp=require(_0x88a2('0x4'));var moment=require(_0x88a2('0x5'));var BPromise=require(_0x88a2('0x6'));var Mustache=require(_0x88a2('0x7'));var util=require('util');var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require(_0x88a2('0xa'));var ejs=require(_0x88a2('0xb'));var fs=require('fs');var fs_extra=require(_0x88a2('0xc'));var _=require('lodash');var squel=require(_0x88a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x88a2('0xe'));var deskjs=require(_0x88a2('0xf'));var toCsv=require(_0x88a2('0xa'));var querystring=require(_0x88a2('0x10'));var Papa=require(_0x88a2('0x11'));var Redis=require(_0x88a2('0x12'));var authService=require(_0x88a2('0x13'));var qs=require(_0x88a2('0x14'));var as=require(_0x88a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88a2('0x16'));var utils=require(_0x88a2('0x17'));var config=require(_0x88a2('0x18'));var licenseUtil=require(_0x88a2('0x19'));var db=require(_0x88a2('0x1a'))['db'];function respondWithStatusCode(_0x4887fc,_0x210a52){_0x210a52=_0x210a52||0xcc;return function(_0x1a4056){if(_0x1a4056){return _0x4887fc[_0x88a2('0x1b')](_0x210a52);}return _0x4887fc[_0x88a2('0x1c')](_0x210a52)['end']();};}function respondWithResult(_0x923706,_0x407ef0){_0x407ef0=_0x407ef0||0xc8;return function(_0x3b83ce){if(_0x3b83ce){return _0x923706['status'](_0x407ef0)[_0x88a2('0x1d')](_0x3b83ce);}};}function respondWithFilteredResult(_0x207b12,_0x462b7b){return function(_0x42facc){if(_0x42facc){var _0x1beccd=typeof _0x462b7b[_0x88a2('0x1e')]===_0x88a2('0x1f')&&typeof _0x462b7b[_0x88a2('0x20')]===_0x88a2('0x1f');var _0x417bf8=_0x42facc[_0x88a2('0x21')];var _0x3c030e=_0x1beccd?0x0:_0x462b7b[_0x88a2('0x1e')];var _0x29dc1b=_0x1beccd?_0x42facc[_0x88a2('0x21')]:_0x462b7b[_0x88a2('0x1e')]+_0x462b7b[_0x88a2('0x20')];var _0x46ed82;if(_0x29dc1b>=_0x417bf8){_0x29dc1b=_0x417bf8;_0x46ed82=0xc8;}else{_0x46ed82=0xce;}_0x207b12['status'](_0x46ed82);return _0x207b12[_0x88a2('0x22')](_0x88a2('0x23'),_0x3c030e+'-'+_0x29dc1b+'/'+_0x417bf8)['json'](_0x42facc);}return null;};}function patchUpdates(_0x499891){return function(_0x7a054c){try{jsonpatch[_0x88a2('0x24')](_0x7a054c,_0x499891,!![]);}catch(_0x102139){return BPromise[_0x88a2('0x25')](_0x102139);}return _0x7a054c[_0x88a2('0x26')]();};}function saveUpdates(_0x54c6ed,_0x3b6401){return function(_0xda54c4){if(_0xda54c4){return _0xda54c4[_0x88a2('0x27')](_0x54c6ed)[_0x88a2('0x28')](function(_0x4be832){return _0x4be832;});}return null;};}function removeEntity(_0x1f104c,_0x527744){return function(_0x5bbd79){if(_0x5bbd79){return _0x5bbd79[_0x88a2('0x29')]()[_0x88a2('0x28')](function(){_0x1f104c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1343fc,_0xac4afe){return function(_0x5be767){if(!_0x5be767){_0x1343fc[_0x88a2('0x1b')](0x194);}return _0x5be767;};}function handleError(_0x4427a1,_0x2ba881){_0x2ba881=_0x2ba881||0x1f4;return function(_0x2474fc){logger['error'](_0x2474fc[_0x88a2('0x2a')]);if(_0x2474fc['name']){delete _0x2474fc[_0x88a2('0x2b')];}_0x4427a1[_0x88a2('0x1c')](_0x2ba881)[_0x88a2('0x2c')](_0x2474fc);};}exports['show']=function(_0x165259,_0x3eca1a){var _0x4c441a={'raw':!![],'where':{'id':_0x165259[_0x88a2('0x2d')]['id']}},_0x21bd1b={};_0x21bd1b['model']=_['keys'](db[_0x88a2('0x2e')][_0x88a2('0x2f')]);_0x21bd1b[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x165259[_0x88a2('0x30')]);_0x21bd1b[_0x88a2('0x32')]=_['intersection'](_0x21bd1b[_0x88a2('0x33')],_0x21bd1b[_0x88a2('0x30')]);_0x4c441a[_0x88a2('0x34')]=_[_0x88a2('0x35')](_0x21bd1b[_0x88a2('0x33')],qs[_0x88a2('0x36')](_0x165259[_0x88a2('0x30')][_0x88a2('0x36')]));_0x4c441a[_0x88a2('0x34')]=_0x4c441a[_0x88a2('0x34')]['length']?_0x4c441a['attributes']:_0x21bd1b[_0x88a2('0x33')];if(_0x165259[_0x88a2('0x30')][_0x88a2('0x37')]){_0x4c441a['include']=[{'all':!![]}];}_0x4c441a=_[_0x88a2('0x38')]({},_0x4c441a,_0x165259[_0x88a2('0x39')]);return db['ChatProactiveAction'][_0x88a2('0x3a')](_0x4c441a)[_0x88a2('0x28')](handleEntityNotFound(_0x3eca1a,null))[_0x88a2('0x28')](respondWithResult(_0x3eca1a,null))['catch'](handleError(_0x3eca1a,null));};exports['create']=function(_0xd8b70b,_0x14a616){return db['ChatProactiveAction'][_0x88a2('0x3b')](_0xd8b70b[_0x88a2('0x3c')],{})[_0x88a2('0x28')](respondWithResult(_0x14a616,0xc9))[_0x88a2('0x3d')](handleError(_0x14a616,null));};exports[_0x88a2('0x27')]=function(_0xabe2b1,_0x367044){if(_0xabe2b1[_0x88a2('0x3c')]['id']){delete _0xabe2b1['body']['id'];}return db[_0x88a2('0x2e')][_0x88a2('0x3a')]({'where':{'id':_0xabe2b1['params']['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x367044,null))[_0x88a2('0x28')](saveUpdates(_0xabe2b1[_0x88a2('0x3c')],null))[_0x88a2('0x28')](respondWithResult(_0x367044,null))[_0x88a2('0x3d')](handleError(_0x367044,null));};exports[_0x88a2('0x29')]=function(_0x2357ad,_0x21828b){return db[_0x88a2('0x2e')][_0x88a2('0x3a')]({'where':{'id':_0x2357ad[_0x88a2('0x2d')]['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x21828b,null))[_0x88a2('0x28')](removeEntity(_0x21828b,null))[_0x88a2('0x3d')](handleError(_0x21828b,null));}; \ No newline at end of file +var _0x4016=['then','destroy','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4016,0x131));var _0x6401=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4016[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];function respondWithStatusCode(_0x26ec93,_0x45e88a){_0x45e88a=_0x45e88a||0xcc;return function(_0xf7fc5){if(_0xf7fc5){return _0x26ec93[_0x6401('0x12')](_0x45e88a);}return _0x26ec93[_0x6401('0x13')](_0x45e88a)[_0x6401('0x14')]();};}function respondWithResult(_0x381c17,_0x1f6edf){_0x1f6edf=_0x1f6edf||0xc8;return function(_0x45fcea){if(_0x45fcea){return _0x381c17[_0x6401('0x13')](_0x1f6edf)[_0x6401('0x15')](_0x45fcea);}};}function respondWithFilteredResult(_0x29fedc,_0x4c740a){return function(_0x1b510e){if(_0x1b510e){var _0x1fd3b8=typeof _0x4c740a[_0x6401('0x16')]===_0x6401('0x17')&&typeof _0x4c740a[_0x6401('0x18')]===_0x6401('0x17');var _0x4521b6=_0x1b510e['count'];var _0x55ca87=_0x1fd3b8?0x0:_0x4c740a[_0x6401('0x16')];var _0x50eda7=_0x1fd3b8?_0x1b510e[_0x6401('0x19')]:_0x4c740a[_0x6401('0x16')]+_0x4c740a[_0x6401('0x18')];var _0x3c3a6c;if(_0x50eda7>=_0x4521b6){_0x50eda7=_0x4521b6;_0x3c3a6c=0xc8;}else{_0x3c3a6c=0xce;}_0x29fedc[_0x6401('0x13')](_0x3c3a6c);return _0x29fedc[_0x6401('0x1a')](_0x6401('0x1b'),_0x55ca87+'-'+_0x50eda7+'/'+_0x4521b6)['json'](_0x1b510e);}return null;};}function patchUpdates(_0x10fd3c){return function(_0x44525b){try{jsonpatch[_0x6401('0x1c')](_0x44525b,_0x10fd3c,!![]);}catch(_0x1757ab){return BPromise['reject'](_0x1757ab);}return _0x44525b[_0x6401('0x1d')]();};}function saveUpdates(_0x343d25,_0x4ed76d){return function(_0x20b445){if(_0x20b445){return _0x20b445[_0x6401('0x1e')](_0x343d25)[_0x6401('0x1f')](function(_0xdea921){return _0xdea921;});}return null;};}function removeEntity(_0x19d6a0,_0x39bca3){return function(_0xed5d29){if(_0xed5d29){return _0xed5d29[_0x6401('0x20')]()[_0x6401('0x1f')](function(){_0x19d6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55818a,_0xee5737){return function(_0x12f19a){if(!_0x12f19a){_0x55818a[_0x6401('0x12')](0x194);}return _0x12f19a;};}function handleError(_0x4e6d9f,_0x3b1d99){_0x3b1d99=_0x3b1d99||0x1f4;return function(_0x102f69){logger[_0x6401('0x21')](_0x102f69[_0x6401('0x22')]);if(_0x102f69['name']){delete _0x102f69['name'];}_0x4e6d9f[_0x6401('0x13')](_0x3b1d99)[_0x6401('0x23')](_0x102f69);};}exports[_0x6401('0x24')]=function(_0x466a35,_0x549b8c){var _0x7f6e88={'raw':!![],'where':{'id':_0x466a35[_0x6401('0x25')]['id']}},_0x43e089={};_0x43e089[_0x6401('0x26')]=_[_0x6401('0x27')](db[_0x6401('0x28')][_0x6401('0x29')]);_0x43e089[_0x6401('0x2a')]=_['keys'](_0x466a35[_0x6401('0x2a')]);_0x43e089[_0x6401('0x2b')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],_0x43e089['query']);_0x7f6e88[_0x6401('0x2d')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],qs['fields'](_0x466a35['query'][_0x6401('0x2e')]));_0x7f6e88['attributes']=_0x7f6e88[_0x6401('0x2d')][_0x6401('0x2f')]?_0x7f6e88[_0x6401('0x2d')]:_0x43e089[_0x6401('0x26')];if(_0x466a35[_0x6401('0x2a')][_0x6401('0x30')]){_0x7f6e88[_0x6401('0x31')]=[{'all':!![]}];}_0x7f6e88=_[_0x6401('0x32')]({},_0x7f6e88,_0x466a35[_0x6401('0x33')]);return db['ChatProactiveAction'][_0x6401('0x34')](_0x7f6e88)[_0x6401('0x1f')](handleEntityNotFound(_0x549b8c,null))[_0x6401('0x1f')](respondWithResult(_0x549b8c,null))[_0x6401('0x35')](handleError(_0x549b8c,null));};exports[_0x6401('0x36')]=function(_0x556354,_0xd7a00f){return db[_0x6401('0x28')]['create'](_0x556354[_0x6401('0x37')],{})['then'](respondWithResult(_0xd7a00f,0xc9))[_0x6401('0x35')](handleError(_0xd7a00f,null));};exports[_0x6401('0x1e')]=function(_0x5317f8,_0x444339){if(_0x5317f8[_0x6401('0x37')]['id']){delete _0x5317f8[_0x6401('0x37')]['id'];}return db[_0x6401('0x28')]['find']({'where':{'id':_0x5317f8[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x444339,null))[_0x6401('0x1f')](saveUpdates(_0x5317f8['body'],null))[_0x6401('0x1f')](respondWithResult(_0x444339,null))[_0x6401('0x35')](handleError(_0x444339,null));};exports['destroy']=function(_0x79d73f,_0x337d1c){return db[_0x6401('0x28')][_0x6401('0x34')]({'where':{'id':_0x79d73f[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x337d1c,null))[_0x6401('0x1f')](removeEntity(_0x337d1c,null))[_0x6401('0x35')](handleError(_0x337d1c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cf525cb..a831cfa 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 _0xfd80=['chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0xfe3ab1,_0x22b418){var _0x38b498=function(_0x36499f){while(--_0x36499f){_0xfe3ab1['push'](_0xfe3ab1['shift']());}};_0x38b498(++_0x22b418);}(_0xfd80,0xa9));var _0x0fd8=function(_0x3ff771,_0x41c013){_0x3ff771=_0x3ff771-0x0;var _0xe4eb51=_0xfd80[_0x3ff771];return _0xe4eb51;};'use strict';var _=require(_0x0fd8('0x0'));var util=require('util');var logger=require(_0x0fd8('0x1'))(_0x0fd8('0x2'));var moment=require(_0x0fd8('0x3'));var BPromise=require(_0x0fd8('0x4'));var rp=require(_0x0fd8('0x5'));var fs=require('fs');var path=require(_0x0fd8('0x6'));var rimraf=require(_0x0fd8('0x7'));var config=require(_0x0fd8('0x8'));var attributes=require(_0x0fd8('0x9'));module[_0x0fd8('0xa')]=function(_0x36927f,_0x155b9f){return _0x36927f[_0x0fd8('0xb')](_0x0fd8('0xc'),attributes,{'tableName':_0x0fd8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be2=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x36858d,_0x4e1f31){var _0x59ea81=function(_0x2533ca){while(--_0x2533ca){_0x36858d['push'](_0x36858d['shift']());}};_0x59ea81(++_0x4e1f31);}(_0x7be2,0xdd));var _0x27be=function(_0x3e417d,_0xaf2086){_0x3e417d=_0x3e417d-0x0;var _0x5c2ede=_0x7be2[_0x3e417d];return _0x5c2ede;};'use strict';var _=require(_0x27be('0x0'));var util=require(_0x27be('0x1'));var logger=require(_0x27be('0x2'))('api');var moment=require(_0x27be('0x3'));var BPromise=require(_0x27be('0x4'));var rp=require(_0x27be('0x5'));var fs=require('fs');var path=require(_0x27be('0x6'));var rimraf=require(_0x27be('0x7'));var config=require('../../config/environment');var attributes=require(_0x27be('0x8'));module[_0x27be('0x9')]=function(_0x3da188,_0x31b74e){return _0x3da188[_0x27be('0xa')](_0x27be('0xb'),attributes,{'tableName':_0x27be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index e4ba4e9..5a67505 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 _0x7314=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7314,0x1b6));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var moment=require(_0x4731('0x2'));var BPromise=require(_0x4731('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4731('0x4'));var db=require(_0x4731('0x5'))['db'];var utils=require(_0x4731('0x6'));var logger=require(_0x4731('0x7'))(_0x4731('0x8'));var config=require(_0x4731('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4731('0xa')][_0x4731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4861c7,_0xe9f83c,_0x4bd579){return new BPromise(function(_0x3c0ba3,_0x3d9d88){return client[_0x4731('0xc')](_0x4861c7,_0x4bd579)[_0x4731('0xd')](function(_0x58e43){logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0xe9f83c,_0x4731('0x10'),JSON[_0x4731('0x11')](_0x58e43));if(_0x58e43[_0x4731('0x12')]){if(_0x58e43['error']['code']===0x1f4){logger[_0x4731('0x12')](_0x4731('0xf'),_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3d9d88(_0x58e43['error'][_0x4731('0x13')]);}logger[_0x4731('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0xe9f83c,_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);return _0x3c0ba3(_0x58e43[_0x4731('0x12')][_0x4731('0x13')]);}else{logger[_0x4731('0xe')](_0x4731('0xf'),_0xe9f83c,_0x4731('0x10'));_0x3c0ba3(_0x58e43[_0x4731('0x14')]['message']);}})[_0x4731('0x15')](function(_0x15da4a){logger['error'](_0x4731('0xf'),_0xe9f83c,_0x15da4a);_0x3d9d88(_0x15da4a);});});} \ No newline at end of file +var _0x46ee=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x46ee,0x6b));var _0xe46e=function(_0x3545aa,_0x59c5a6){_0x3545aa=_0x3545aa-0x0;var _0x513534=_0x46ee[_0x3545aa];return _0x513534;};'use strict';var _=require(_0xe46e('0x0'));var util=require(_0xe46e('0x1'));var moment=require(_0xe46e('0x2'));var BPromise=require(_0xe46e('0x3'));var rs=require(_0xe46e('0x4'));var fs=require('fs');var Redis=require(_0xe46e('0x5'));var db=require(_0xe46e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe46e('0x7'));var client=jayson[_0xe46e('0x8')][_0xe46e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cbf01,_0x2bd6db,_0x503d16){return new BPromise(function(_0x417fa7,_0x209d13){return client[_0xe46e('0xa')](_0x5cbf01,_0x503d16)['then'](function(_0x317a04){logger[_0xe46e('0xb')](_0xe46e('0xc'),_0x2bd6db,'request\x20sent');logger['debug'](_0xe46e('0xd'),_0x2bd6db,_0xe46e('0xe'),JSON['stringify'](_0x317a04));if(_0x317a04[_0xe46e('0xf')]){if(_0x317a04[_0xe46e('0xf')][_0xe46e('0x10')]===0x1f4){logger[_0xe46e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);return _0x209d13(_0x317a04[_0xe46e('0xf')][_0xe46e('0x11')]);}logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x317a04['error'][_0xe46e('0x11')]);return _0x417fa7(_0x317a04['error'][_0xe46e('0x11')]);}else{logger[_0xe46e('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x2bd6db,_0xe46e('0xe'));_0x417fa7(_0x317a04[_0xe46e('0x12')][_0xe46e('0x11')]);}})[_0xe46e('0x13')](function(_0x4d359a){logger[_0xe46e('0xf')](_0xe46e('0xc'),_0x2bd6db,_0x4d359a);_0x209d13(_0x4d359a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index eb20606..e05a691 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 _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x2eadce,_0x310a08){var _0x25cd1d=function(_0xc7dd49){while(--_0xc7dd49){_0x2eadce['push'](_0x2eadce['shift']());}};_0x25cd1d(++_0x310a08);}(_0xeda8,0x104));var _0x8eda=function(_0x5a0018,_0x4ea1b1){_0x5a0018=_0x5a0018-0x0;var _0x5354c1=_0xeda8[_0x5a0018];return _0x5354c1;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x038b,0x114));var _0xb038=function(_0xb091a1,_0x310718){_0xb091a1=_0xb091a1-0x0;var _0x262451=_0x038b[_0xb091a1];return _0x262451;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f5bcaf6..28958eb 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 _0xa682=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x3a62f3,_0x387ae2){var _0x486ebf=function(_0x2dc4eb){while(--_0x2dc4eb){_0x3a62f3['push'](_0x3a62f3['shift']());}};_0x486ebf(++_0x387ae2);}(_0xa682,0x1b3));var _0x2a68=function(_0xba4e2d,_0x2077a3){_0xba4e2d=_0xba4e2d-0x0;var _0x4d988c=_0xa682[_0xba4e2d];return _0x4d988c;};'use strict';var Sequelize=require('sequelize');module[_0x2a68('0x0')]={'name':{'type':Sequelize[_0x2a68('0x1')],'unique':_0x2a68('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2a68('0x1')]},'timeout':{'type':Sequelize[_0x2a68('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a68('0x4')](_0x2a68('0x5'),_0x2a68('0x6'),_0x2a68('0x7'))}}; \ No newline at end of file +var _0x09bc=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x09bc,0x1ba));var _0xc09b=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x09bc[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0xc09b('0x0'));module[_0xc09b('0x1')]={'name':{'type':Sequelize[_0xc09b('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc09b('0x2')]},'timeout':{'type':Sequelize[_0xc09b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc09b('0x4'),_0xc09b('0x5'),_0xc09b('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 16a41e3..4d01f40 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 _0xca59=['removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','http','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','UserId','updatedAt','createdAt','format','SIP','chatPause','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value'];(function(_0x7cc7c3,_0x5d2075){var _0x40d43d=function(_0x5965da){while(--_0x5965da){_0x7cc7c3['push'](_0x7cc7c3['shift']());}};_0x40d43d(++_0x5d2075);}(_0xca59,0x1cd));var _0x9ca5=function(_0x46c6f9,_0x39d9c4){_0x46c6f9=_0x46c6f9-0x0;var _0x4f9bd2=_0xca59[_0x46c6f9];return _0x4f9bd2;};'use strict';var emlformat=require(_0x9ca5('0x0'));var rimraf=require(_0x9ca5('0x1'));var zipdir=require(_0x9ca5('0x2'));var jsonpatch=require(_0x9ca5('0x3'));var rp=require(_0x9ca5('0x4'));var moment=require(_0x9ca5('0x5'));var BPromise=require(_0x9ca5('0x6'));var Mustache=require(_0x9ca5('0x7'));var util=require(_0x9ca5('0x8'));var path=require(_0x9ca5('0x9'));var sox=require(_0x9ca5('0xa'));var csv=require(_0x9ca5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ca5('0xc'));var _=require('lodash');var squel=require(_0x9ca5('0xd'));var crypto=require(_0x9ca5('0xe'));var jsforce=require(_0x9ca5('0xf'));var deskjs=require(_0x9ca5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9ca5('0x11'));var Redis=require(_0x9ca5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ca5('0x13'));var logger=require(_0x9ca5('0x14'))(_0x9ca5('0x15'));var utils=require(_0x9ca5('0x16'));var config=require(_0x9ca5('0x17'));var licenseUtil=require(_0x9ca5('0x18'));var db=require(_0x9ca5('0x19'))['db'];config[_0x9ca5('0x1a')]=_['defaults'](config[_0x9ca5('0x1a')],{'host':_0x9ca5('0x1b'),'port':0x18eb});var socket=require(_0x9ca5('0x1c'))(new Redis(config[_0x9ca5('0x1a')]));require(_0x9ca5('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9ca5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xc6d6e7,_0x5d2019,_0x25e4e7,_0x10452f){return new BPromise(function(_0x469742,_0x54c610){var _0x54076a=_0x10452f||client;return _0x54076a['request'](_0xc6d6e7,_0x25e4e7)[_0x9ca5('0x1f')](function(_0x110cac){logger[_0x9ca5('0x20')](_0x9ca5('0x21'),_0x5d2019,'request\x20sent');logger[_0x9ca5('0x22')](_0x9ca5('0x23'),_0x5d2019,_0x9ca5('0x24'),JSON[_0x9ca5('0x25')](_0x110cac));if(_0x110cac[_0x9ca5('0x26')]){if(_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x27')]===0x1f4){logger[_0x9ca5('0x26')](_0x9ca5('0x21'),_0x5d2019,_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x28')]);return _0x54c610(_0x110cac['error'][_0x9ca5('0x28')]);}logger[_0x9ca5('0x26')](_0x9ca5('0x21'),_0x5d2019,_0x110cac['error'][_0x9ca5('0x28')]);return _0x469742(_0x110cac[_0x9ca5('0x26')][_0x9ca5('0x28')]);}else{logger[_0x9ca5('0x20')](_0x9ca5('0x21'),_0x5d2019,_0x9ca5('0x24'));_0x469742(_0x110cac[_0x9ca5('0x29')][_0x9ca5('0x28')]);}})[_0x9ca5('0x2a')](function(_0x4e5501){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5d2019,_0x4e5501);_0x54c610(_0x4e5501);});});}function respondWithStatusCode(_0x3be1e0,_0x56ef16){_0x56ef16=_0x56ef16||0xcc;return function(_0x582427){if(_0x582427){return _0x3be1e0[_0x9ca5('0x2b')](_0x56ef16);}return _0x3be1e0[_0x9ca5('0x2c')](_0x56ef16)['end']();};}function respondWithResult(_0x575a5a,_0x33e6fa){_0x33e6fa=_0x33e6fa||0xc8;return function(_0x5e45ae){if(_0x5e45ae){return _0x575a5a[_0x9ca5('0x2c')](_0x33e6fa)[_0x9ca5('0x2d')](_0x5e45ae);}};}function respondWithFilteredResult(_0x20e1d9,_0x4fb728){return function(_0xbe6384){if(_0xbe6384){var _0x2ee84b=typeof _0x4fb728[_0x9ca5('0x2e')]===_0x9ca5('0x2f')&&typeof _0x4fb728[_0x9ca5('0x30')]===_0x9ca5('0x2f');var _0xae526c=_0xbe6384[_0x9ca5('0x31')];var _0x12bd5c=_0x2ee84b?0x0:_0x4fb728[_0x9ca5('0x2e')];var _0x2930de=_0x2ee84b?_0xbe6384[_0x9ca5('0x31')]:_0x4fb728['offset']+_0x4fb728[_0x9ca5('0x30')];var _0x16e07e;if(_0x2930de>=_0xae526c){_0x2930de=_0xae526c;_0x16e07e=0xc8;}else{_0x16e07e=0xce;}_0x20e1d9[_0x9ca5('0x2c')](_0x16e07e);return _0x20e1d9[_0x9ca5('0x32')](_0x9ca5('0x33'),_0x12bd5c+'-'+_0x2930de+'/'+_0xae526c)[_0x9ca5('0x2d')](_0xbe6384);}return null;};}function patchUpdates(_0x50a43e){return function(_0x575d4b){try{jsonpatch[_0x9ca5('0x34')](_0x575d4b,_0x50a43e,!![]);}catch(_0x13cf8b){return BPromise['reject'](_0x13cf8b);}return _0x575d4b[_0x9ca5('0x35')]();};}function saveUpdates(_0x4e9f6c,_0xb48913){return function(_0x14e68f){if(_0x14e68f){return _0x14e68f[_0x9ca5('0x36')](_0x4e9f6c)[_0x9ca5('0x1f')](function(_0x4b285d){return _0x4b285d;});}return null;};}function removeEntity(_0x119262,_0x281053){return function(_0x216c28){if(_0x216c28){return _0x216c28[_0x9ca5('0x37')]()[_0x9ca5('0x1f')](function(){var _0x2ea5ed=_0x216c28[_0x9ca5('0x38')]({'plain':!![]});var _0x532057=_0x9ca5('0x39');return db[_0x9ca5('0x3a')]['destroy']({'where':{'type':_0x532057,'resourceId':_0x2ea5ed['id']}})[_0x9ca5('0x1f')](function(){return _0x216c28;});})[_0x9ca5('0x1f')](function(){_0x119262[_0x9ca5('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x243b81,_0x497acb){return function(_0x41d0ee){if(!_0x41d0ee){_0x243b81[_0x9ca5('0x2b')](0x194);}return _0x41d0ee;};}function handleError(_0x26ad6f,_0xde62e3){_0xde62e3=_0xde62e3||0x1f4;return function(_0x2174a3){logger[_0x9ca5('0x26')](_0x2174a3['stack']);if(_0x2174a3['name']){delete _0x2174a3[_0x9ca5('0x3b')];}_0x26ad6f[_0x9ca5('0x2c')](_0xde62e3)['send'](_0x2174a3);};}exports[_0x9ca5('0x3c')]=function(_0x25ae80,_0x46b317){var _0x3ef2f2={},_0x1494d9={},_0x121462={'count':0x0,'rows':[]};var _0x262012=_[_0x9ca5('0x3d')](db[_0x9ca5('0x3e')][_0x9ca5('0x3f')],function(_0x29b519){return{'name':_0x29b519[_0x9ca5('0x40')],'type':_0x29b519[_0x9ca5('0x41')][_0x9ca5('0x42')]};});_0x1494d9['model']=_[_0x9ca5('0x3d')](_0x262012,_0x9ca5('0x3b'));_0x1494d9[_0x9ca5('0x43')]=_[_0x9ca5('0x44')](_0x25ae80['query']);_0x1494d9[_0x9ca5('0x45')]=_['intersection'](_0x1494d9['model'],_0x1494d9[_0x9ca5('0x43')]);_0x3ef2f2[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x1494d9['model'],qs[_0x9ca5('0x48')](_0x25ae80['query'][_0x9ca5('0x48')]));_0x3ef2f2[_0x9ca5('0x46')]=_0x3ef2f2[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x3ef2f2[_0x9ca5('0x46')]:_0x1494d9[_0x9ca5('0x4a')];if(!_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x4b')](_0x9ca5('0x4c'))){_0x3ef2f2[_0x9ca5('0x30')]=qs['limit'](_0x25ae80['query'][_0x9ca5('0x30')]);_0x3ef2f2[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}_0x3ef2f2[_0x9ca5('0x4d')]=qs[_0x9ca5('0x4e')](_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x3ef2f2[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x25ae80[_0x9ca5('0x43')],_0x1494d9[_0x9ca5('0x45')]),_0x262012);if(_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x3ef2f2[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x3ef2f2[_0x9ca5('0x4f')],{'$or':_['map'](_0x262012,function(_0x1277bc){if(_0x1277bc[_0x9ca5('0x41')]!==_0x9ca5('0x53')){var _0x183ed1={};_0x183ed1[_0x1277bc[_0x9ca5('0x3b')]]={'$like':'%'+_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x51')]+'%'};return _0x183ed1;}})});}_0x3ef2f2=_[_0x9ca5('0x52')]({},_0x3ef2f2,_0x25ae80[_0x9ca5('0x54')]);var _0x534d17={'where':_0x3ef2f2[_0x9ca5('0x4f')]};return db[_0x9ca5('0x3e')][_0x9ca5('0x31')](_0x534d17)[_0x9ca5('0x1f')](function(_0x426060){_0x121462[_0x9ca5('0x31')]=_0x426060;if(_0x25ae80[_0x9ca5('0x43')][_0x9ca5('0x55')]){_0x3ef2f2['include']=[{'all':!![]}];}return db[_0x9ca5('0x3e')][_0x9ca5('0x56')](_0x3ef2f2);})[_0x9ca5('0x1f')](function(_0x55daca){_0x121462[_0x9ca5('0x57')]=_0x55daca;return _0x121462;})[_0x9ca5('0x1f')](respondWithFilteredResult(_0x46b317,_0x3ef2f2))[_0x9ca5('0x2a')](handleError(_0x46b317,null));};exports[_0x9ca5('0x58')]=function(_0x52d927,_0xad049e){var _0x3d93f0={'raw':!![],'where':{'id':_0x52d927[_0x9ca5('0x59')]['id']}},_0x587a90={};_0x587a90[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db[_0x9ca5('0x3e')][_0x9ca5('0x3f')]);_0x587a90[_0x9ca5('0x43')]=_[_0x9ca5('0x44')](_0x52d927['query']);_0x587a90['filters']=_['intersection'](_0x587a90['model'],_0x587a90['query']);_0x3d93f0[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x587a90[_0x9ca5('0x4a')],qs['fields'](_0x52d927['query'][_0x9ca5('0x48')]));_0x3d93f0[_0x9ca5('0x46')]=_0x3d93f0[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x3d93f0[_0x9ca5('0x46')]:_0x587a90[_0x9ca5('0x4a')];if(_0x52d927[_0x9ca5('0x43')][_0x9ca5('0x55')]){_0x3d93f0[_0x9ca5('0x5a')]=[{'all':!![]}];}_0x3d93f0=_['merge']({},_0x3d93f0,_0x52d927[_0x9ca5('0x54')]);return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')](_0x3d93f0)[_0x9ca5('0x1f')](handleEntityNotFound(_0xad049e,null))[_0x9ca5('0x1f')](respondWithResult(_0xad049e,null))['catch'](handleError(_0xad049e,null));};exports['create']=function(_0x165e51,_0x337a16){return db['ChatQueue'][_0x9ca5('0x5c')](_0x165e51['body'],{})[_0x9ca5('0x1f')](function(_0xb1612e){var _0x42246b=_0x165e51['user'][_0x9ca5('0x38')]({'plain':!![]});if(!_0x42246b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42246b[_0x9ca5('0x5d')]===_0x9ca5('0x5e')){var _0x7f0ae0=_0xb1612e[_0x9ca5('0x38')]({'plain':!![]});var _0x2e080f=_0x9ca5('0x39');return db[_0x9ca5('0x5f')][_0x9ca5('0x5b')]({'where':{'name':_0x2e080f,'userProfileId':_0x42246b['userProfileId']},'raw':!![]})['then'](function(_0x3b5500){if(_0x3b5500&&_0x3b5500[_0x9ca5('0x60')]===0x0){return db[_0x9ca5('0x3a')][_0x9ca5('0x5c')]({'name':_0x7f0ae0[_0x9ca5('0x3b')],'resourceId':_0x7f0ae0['id'],'type':_0x3b5500[_0x9ca5('0x3b')],'sectionId':_0x3b5500['id']},{})[_0x9ca5('0x1f')](function(){return _0xb1612e;});}else{return _0xb1612e;}})[_0x9ca5('0x2a')](function(_0x252561){logger[_0x9ca5('0x26')](_0x9ca5('0x61'),_0x252561);throw _0x252561;});}return _0xb1612e;})[_0x9ca5('0x1f')](respondWithResult(_0x337a16,0xc9))[_0x9ca5('0x2a')](handleError(_0x337a16,null));};exports[_0x9ca5('0x36')]=function(_0x11470f,_0x57b603){if(_0x11470f[_0x9ca5('0x62')]['id']){delete _0x11470f['body']['id'];}return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x11470f[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x57b603,null))[_0x9ca5('0x1f')](saveUpdates(_0x11470f[_0x9ca5('0x62')],null))[_0x9ca5('0x1f')](respondWithResult(_0x57b603,null))['catch'](handleError(_0x57b603,null));};exports[_0x9ca5('0x37')]=function(_0x44c885,_0x9f0639){return db[_0x9ca5('0x3e')]['find']({'where':{'id':_0x44c885[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x9f0639,null))[_0x9ca5('0x1f')](removeEntity(_0x9f0639,null))[_0x9ca5('0x2a')](handleError(_0x9f0639,null));};exports[_0x9ca5('0x63')]=function(_0x250847,_0x3e15e4){return db[_0x9ca5('0x3e')]['describe']()[_0x9ca5('0x1f')](respondWithResult(_0x3e15e4,null))['catch'](handleError(_0x3e15e4,null));};exports[_0x9ca5('0x64')]=function(_0x20e569,_0x156527,_0x367f21){var _0x2bb168={'raw':!![],'where':{}},_0x452a78={},_0x241f68;return db['ChatQueue'][_0x9ca5('0x65')]({'where':{'id':_0x20e569[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x156527,null))['then'](function(_0x4bfaf7){if(_0x4bfaf7){_0x241f68=_0x4bfaf7['get']({'plain':!![]});_0x452a78[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db[_0x9ca5('0x66')][_0x9ca5('0x3f')]);_0x452a78['query']=_[_0x9ca5('0x44')](_0x20e569['query']);_0x452a78[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x452a78[_0x9ca5('0x4a')],_0x452a78[_0x9ca5('0x43')]);_0x2bb168[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x452a78[_0x9ca5('0x4a')],qs['fields'](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x48')]));_0x2bb168['attributes']=_0x2bb168[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x2bb168[_0x9ca5('0x46')]:_0x452a78[_0x9ca5('0x4a')];if(!_0x20e569[_0x9ca5('0x43')]['hasOwnProperty'](_0x9ca5('0x4c'))){_0x2bb168[_0x9ca5('0x30')]=qs['limit'](_0x20e569[_0x9ca5('0x43')]['limit']);_0x2bb168['offset']=qs[_0x9ca5('0x2e')](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}_0x2bb168[_0x9ca5('0x4d')]=qs[_0x9ca5('0x4e')](_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x2bb168[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_['pick'](_0x20e569['query'],_0x452a78[_0x9ca5('0x45')]));_0x2bb168['where'][_0x9ca5('0x67')]=_0x4bfaf7['id'];if(_0x20e569[_0x9ca5('0x43')]['filter']){_0x2bb168[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x2bb168['where'],{'$or':_[_0x9ca5('0x3d')](_0x2bb168[_0x9ca5('0x46')],function(_0xd62db8){var _0x4f9e1a={};_0x4f9e1a[_0xd62db8]={'$like':'%'+_0x20e569[_0x9ca5('0x43')][_0x9ca5('0x51')]+'%'};return _0x4f9e1a;})});}_0x2bb168=_['merge']({},_0x2bb168,_0x20e569[_0x9ca5('0x54')]);return db[_0x9ca5('0x66')][_0x9ca5('0x56')](_0x2bb168);}})[_0x9ca5('0x1f')](function(_0x58c343){if(_0x58c343){return db[_0x9ca5('0x68')]['findAndCountAll']({'where':{'id':_[_0x9ca5('0x3d')](_0x58c343,_0x9ca5('0x69')),'role':'agent'},'attributes':['id',_0x9ca5('0x3b'),'chatPause',_0x9ca5('0x6a'),_0x9ca5('0x6b')]});}})['then'](function(_0x112601){if(_0x112601){return{'count':_0x112601[_0x9ca5('0x31')],'rows':_[_0x9ca5('0x3d')](_0x112601['rows'],function(_0x12c154){return{'membername':_0x12c154[_0x9ca5('0x3b')],'UserId':_0x12c154['id'],'queue_name':_0x241f68[_0x9ca5('0x3b')],'ChatQueueId':_0x241f68['id'],'interface':util[_0x9ca5('0x6c')]('%s/%s',_0x9ca5('0x6d'),_0x12c154[_0x9ca5('0x3b')]),'penalty':0x0,'paused':_0x12c154[_0x9ca5('0x6e')],'createdAt':_0x12c154[_0x9ca5('0x6b')],'updatedAt':_0x12c154['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9ca5('0x1f')](respondWithFilteredResult(_0x156527,_0x2bb168))['catch'](handleError(_0x156527,null));};exports[_0x9ca5('0x6f')]=function(_0x1d9640,_0x21ded8,_0x1f8d89){var _0x20bda1={};var _0x5ccf3d={};var _0x4c4bf7;var _0x2257cf;return db[_0x9ca5('0x3e')][_0x9ca5('0x65')]({'where':{'id':_0x1d9640[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x21ded8,null))[_0x9ca5('0x1f')](function(_0x7a08fd){if(_0x7a08fd){_0x4c4bf7=_0x7a08fd;_0x5ccf3d[_0x9ca5('0x4a')]=_[_0x9ca5('0x44')](db['Team']['rawAttributes']);_0x5ccf3d['query']=_[_0x9ca5('0x44')](_0x1d9640['query']);_0x5ccf3d[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x5ccf3d['model'],_0x5ccf3d[_0x9ca5('0x43')]);_0x20bda1[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x5ccf3d[_0x9ca5('0x4a')],qs[_0x9ca5('0x48')](_0x1d9640[_0x9ca5('0x43')]['fields']));_0x20bda1[_0x9ca5('0x46')]=_0x20bda1[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x20bda1[_0x9ca5('0x46')]:_0x5ccf3d[_0x9ca5('0x4a')];_0x20bda1['order']=qs[_0x9ca5('0x4e')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x4e')]);_0x20bda1['where']=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x1d9640[_0x9ca5('0x43')],_0x5ccf3d['filters']));if(_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x20bda1[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x20bda1['where'],{'$or':_[_0x9ca5('0x3d')](_0x20bda1[_0x9ca5('0x46')],function(_0x536df9){var _0x32d898={};_0x32d898[_0x536df9]={'$like':'%'+_0x1d9640['query'][_0x9ca5('0x51')]+'%'};return _0x32d898;})});}_0x20bda1=_['merge']({},_0x20bda1,_0x1d9640['options']);return _0x4c4bf7[_0x9ca5('0x6f')](_0x20bda1);}})[_0x9ca5('0x1f')](function(_0x5d53eb){if(_0x5d53eb){_0x2257cf=_0x5d53eb[_0x9ca5('0x49')];if(!_0x1d9640[_0x9ca5('0x43')]['hasOwnProperty'](_0x9ca5('0x4c'))){_0x20bda1[_0x9ca5('0x30')]=qs[_0x9ca5('0x30')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x30')]);_0x20bda1[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x1d9640[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}return _0x4c4bf7[_0x9ca5('0x6f')](_0x20bda1);}})[_0x9ca5('0x1f')](function(_0x13b6d3){if(_0x13b6d3){return _0x13b6d3?{'count':_0x2257cf,'rows':_0x13b6d3}:null;}})['then'](respondWithResult(_0x21ded8,null))[_0x9ca5('0x2a')](handleError(_0x21ded8,null));};exports[_0x9ca5('0x70')]=function(_0x2b558b,_0x5e1441,_0x10bacd){var _0x34e82d=_0x2b558b[_0x9ca5('0x62')][_0x9ca5('0x71')];return db[_0x9ca5('0x72')][_0x9ca5('0x56')]({'where':{'id':_0x34e82d},'attributes':['id'],'include':[{'model':db[_0x9ca5('0x68')],'as':_0x9ca5('0x73'),'attributes':['id','name',_0x9ca5('0x74'),_0x9ca5('0x75'),_0x9ca5('0x76')],'raw':!![]}]})[_0x9ca5('0x1f')](function(_0x4f3306){if(_0x4f3306){var _0x3b1a68=_[_0x9ca5('0x77')](_0x4f3306,function(_0x17c22c){var _0x28a0a8=_0x17c22c[_0x9ca5('0x38')]({'plain':!![]});return _0x28a0a8[_0x9ca5('0x73')];});return db[_0x9ca5('0x3e')]['find']({'where':{'id':_0x2b558b[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](function(_0x3c4c70){return db[_0x9ca5('0x78')][_0x9ca5('0x79')](function(_0x5e08b5){return _0x3c4c70[_0x9ca5('0x70')](_0x34e82d,{'transaction':_0x5e08b5})[_0x9ca5('0x1f')](function(){return BPromise['each'](_0x3b1a68,function(_0x174b31){return db[_0x9ca5('0x66')][_0x9ca5('0x7a')]({'where':{'UserId':_0x174b31['id'],'ChatQueueId':_0x2b558b[_0x9ca5('0x59')]['id']},'transaction':_0x5e08b5});});})['then'](function(){_0x3b1a68[_0x9ca5('0x7b')](function(_0x5e26c1){socket['emit']('userChatQueue:save',{'UserId':_0x5e26c1['id'],'ChatQueueId':_0x3c4c70['id']});});});});});}})[_0x9ca5('0x1f')](respondWithStatusCode(_0x5e1441,null))[_0x9ca5('0x2a')](handleError(_0x5e1441,null));};exports[_0x9ca5('0x7c')]=function(_0x2cf3df,_0x158b14,_0x2c94b1){return db[_0x9ca5('0x72')][_0x9ca5('0x56')]({'where':{'id':_0x2cf3df[_0x9ca5('0x43')][_0x9ca5('0x71')]},'attributes':['id'],'include':[{'model':db[_0x9ca5('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9ca5('0x1f')](handleEntityNotFound(_0x158b14,null))[_0x9ca5('0x1f')](function(_0x214b8a){var _0x357008=_['map'](_0x214b8a,'id');var _0x46fffa=[];var _0x57705b=[];var _0x2f89d2=squel[_0x9ca5('0x7d')]();_0x2f89d2[_0x9ca5('0x7e')](_0x9ca5('0x7f'))[_0x9ca5('0x80')](_0x9ca5('0x81'),'tq')['join'](_0x9ca5('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9ca5('0x4f')]('ChatQueueId\x20=\x20?',_0x2cf3df['params']['id']);for(var _0x31e1f3=0x0;_0x31e1f3<_0x214b8a['length'];_0x31e1f3+=0x1){let _0x4522a3=_0x214b8a[_0x31e1f3];for(var _0x36cdd4=0x0;_0x36cdd4<_0x4522a3[_0x9ca5('0x73')][_0x9ca5('0x49')];_0x36cdd4+=0x1){let _0x24e8d1=_0x4522a3[_0x9ca5('0x73')][_0x36cdd4];var _0x4e9ccb=_0x2f89d2[_0x9ca5('0x83')]();_0x4e9ccb[_0x9ca5('0x4f')](_0x9ca5('0x84'),_0x24e8d1['id']);_0x57705b[_0x9ca5('0x85')](db[_0x9ca5('0x78')][_0x9ca5('0x43')](_0x4e9ccb[_0x9ca5('0x86')](),{'type':db[_0x9ca5('0x78')][_0x9ca5('0x87')][_0x9ca5('0x88')]})[_0x9ca5('0x1f')](function(_0xcc0dff){if(_0xcc0dff['length']===0x1){return _0x24e8d1['id'];}else{var _0x5ccde6=_[_0x9ca5('0x89')](_[_0x9ca5('0x3d')](_0xcc0dff,_0x9ca5('0x8a')),function(_0x5e3647){return _['includes'](_0x357008,_0x5e3647);});if(_0x5ccde6){return _0x24e8d1['id'];}}}));}}return BPromise[_0x9ca5('0x8b')](_0x57705b)[_0x9ca5('0x1f')](function(_0x4649ea){_0x46fffa=_(_0x46fffa)[_0x9ca5('0x8c')](_0x4649ea)[_0x9ca5('0x8d')]()[_0x9ca5('0x8e')]();return db['ChatQueue'][_0x9ca5('0x5b')]({'where':{'id':_0x2cf3df['params']['id']}})[_0x9ca5('0x1f')](function(_0x128a5d){return db[_0x9ca5('0x78')]['transaction'](function(_0x17ddf1){return _0x128a5d[_0x9ca5('0x7c')](_0x2cf3df[_0x9ca5('0x43')][_0x9ca5('0x71')],{'transaction':_0x17ddf1})[_0x9ca5('0x1f')](function(){if(!_['isEmpty'](_0x46fffa)){return _0x128a5d[_0x9ca5('0x8f')](_0x46fffa,{'transaction':_0x17ddf1});}})['then'](function(){_0x46fffa[_0x9ca5('0x7b')](function(_0x37eb83){socket[_0x9ca5('0x90')](_0x9ca5('0x91'),{'UserId':_0x37eb83,'ChatQueueId':_0x128a5d['id']});});});});});});})[_0x9ca5('0x1f')](respondWithStatusCode(_0x158b14,null))[_0x9ca5('0x2a')](handleError(_0x158b14,null));};exports['addAgents']=function(_0x39f27c,_0x19d076,_0x4f4c32){return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x39f27c[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x19d076,null))[_0x9ca5('0x1f')](function(_0x3507fc){if(_0x3507fc){return _0x3507fc[_0x9ca5('0x92')](_0x39f27c[_0x9ca5('0x62')][_0x9ca5('0x71')],_[_0x9ca5('0x93')](_0x39f27c[_0x9ca5('0x62')],[_0x9ca5('0x71'),'id'])||{})[_0x9ca5('0x94')](function(_0x31f368){for(var _0x2be27c=0x0;_0x2be27c<_0x39f27c['body'][_0x9ca5('0x71')][_0x9ca5('0x49')];_0x2be27c+=0x1){socket[_0x9ca5('0x90')]('userChatQueue:save',{'UserId':Number(_0x39f27c['body'][_0x9ca5('0x71')][_0x2be27c]),'ChatQueueId':Number(_0x39f27c[_0x9ca5('0x59')]['id'])});}return _0x31f368;});}})[_0x9ca5('0x1f')](respondWithResult(_0x19d076,null))[_0x9ca5('0x2a')](handleError(_0x19d076,null));};exports[_0x9ca5('0x8f')]=function(_0x5cefc1,_0x18cee8,_0x1a1485){return db[_0x9ca5('0x3e')][_0x9ca5('0x5b')]({'where':{'id':_0x5cefc1[_0x9ca5('0x59')]['id']}})[_0x9ca5('0x1f')](handleEntityNotFound(_0x18cee8,null))[_0x9ca5('0x1f')](function(_0x59b0f8){if(_0x59b0f8){return _0x59b0f8[_0x9ca5('0x8f')](_0x5cefc1[_0x9ca5('0x43')]['ids'])[_0x9ca5('0x1f')](function(){if(_[_0x9ca5('0x95')](_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')])){for(var _0x4509f3=0x0;_0x4509f3<_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')][_0x9ca5('0x49')];_0x4509f3+=0x1){socket[_0x9ca5('0x90')](_0x9ca5('0x91'),{'UserId':Number(_0x5cefc1['query']['ids'][_0x4509f3]),'ChatQueueId':Number(_0x5cefc1[_0x9ca5('0x59')]['id'])});}}else{socket['emit'](_0x9ca5('0x91'),{'UserId':Number(_0x5cefc1[_0x9ca5('0x43')][_0x9ca5('0x71')]),'ChatQueueId':Number(_0x5cefc1[_0x9ca5('0x59')]['id'])});}});}})[_0x9ca5('0x1f')](respondWithStatusCode(_0x18cee8,null))[_0x9ca5('0x2a')](handleError(_0x18cee8,null));};exports['getAgents']=function(_0x340cdc,_0x315ba1,_0x430123){var _0x5ba063={};var _0x2bdcf7={};var _0xed0861;var _0x582594;return db[_0x9ca5('0x3e')][_0x9ca5('0x65')]({'where':{'id':_0x340cdc[_0x9ca5('0x59')]['id']}})['then'](handleEntityNotFound(_0x315ba1,null))[_0x9ca5('0x1f')](function(_0x995578){if(_0x995578){_0xed0861=_0x995578;_0x2bdcf7['model']=_[_0x9ca5('0x44')](db['User'][_0x9ca5('0x3f')]);_0x2bdcf7[_0x9ca5('0x43')]=_['keys'](_0x340cdc[_0x9ca5('0x43')]);_0x2bdcf7[_0x9ca5('0x45')]=_[_0x9ca5('0x47')](_0x2bdcf7[_0x9ca5('0x4a')],_0x2bdcf7[_0x9ca5('0x43')]);_0x5ba063[_0x9ca5('0x46')]=_[_0x9ca5('0x47')](_0x2bdcf7[_0x9ca5('0x4a')],qs[_0x9ca5('0x48')](_0x340cdc['query']['fields']));_0x5ba063[_0x9ca5('0x46')]=_0x5ba063[_0x9ca5('0x46')][_0x9ca5('0x49')]?_0x5ba063['attributes']:_0x2bdcf7[_0x9ca5('0x4a')];_0x5ba063[_0x9ca5('0x4d')]=qs['sort'](_0x340cdc[_0x9ca5('0x43')]['sort']);_0x5ba063[_0x9ca5('0x4f')]=qs[_0x9ca5('0x45')](_[_0x9ca5('0x50')](_0x340cdc[_0x9ca5('0x43')],_0x2bdcf7[_0x9ca5('0x45')]));if(_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x51')]){_0x5ba063[_0x9ca5('0x4f')]=_[_0x9ca5('0x52')](_0x5ba063[_0x9ca5('0x4f')],{'$or':_[_0x9ca5('0x3d')](_0x5ba063[_0x9ca5('0x46')],function(_0x4d04b6){var _0x19ebad={};_0x19ebad[_0x4d04b6]={'$like':'%'+_0x340cdc['query']['filter']+'%'};return _0x19ebad;})});}_0x5ba063=_[_0x9ca5('0x52')]({},_0x5ba063,_0x340cdc[_0x9ca5('0x54')]);return _0xed0861[_0x9ca5('0x96')](_0x5ba063);}})[_0x9ca5('0x1f')](function(_0x51bc80){if(_0x51bc80){_0x582594=_0x51bc80[_0x9ca5('0x49')];if(!_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x4b')](_0x9ca5('0x4c'))){_0x5ba063[_0x9ca5('0x30')]=qs[_0x9ca5('0x30')](_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x30')]);_0x5ba063[_0x9ca5('0x2e')]=qs[_0x9ca5('0x2e')](_0x340cdc[_0x9ca5('0x43')][_0x9ca5('0x2e')]);}return _0xed0861[_0x9ca5('0x96')](_0x5ba063);}})[_0x9ca5('0x1f')](function(_0x3192b8){if(_0x3192b8){return _0x3192b8?{'count':_0x582594,'rows':_0x3192b8}:null;}})['then'](respondWithResult(_0x315ba1,null))[_0x9ca5('0x2a')](handleError(_0x315ba1,null));}; \ No newline at end of file +var _0x50c2=['UserChatQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userChatQueue:remove','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../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','./chatQueue.socket','register','jayson/promise','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','then','ChatQueues','UserProfileResource','destroy','sendStatus','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','length','merge','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','update','describe','getMembers','findOne'];(function(_0xe8668f,_0x42446c){var _0xf3d4ff=function(_0x5447d6){while(--_0x5447d6){_0xe8668f['push'](_0xe8668f['shift']());}};_0xf3d4ff(++_0x42446c);}(_0x50c2,0x1e8));var _0x250c=function(_0x4a7244,_0x2eb6d3){_0x4a7244=_0x4a7244-0x0;var _0x551233=_0x50c2[_0x4a7244];return _0x551233;};'use strict';var emlformat=require(_0x250c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x250c('0x1'));var jsonpatch=require(_0x250c('0x2'));var rp=require('request-promise');var moment=require(_0x250c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x250c('0x4'));var util=require(_0x250c('0x5'));var path=require(_0x250c('0x6'));var sox=require(_0x250c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x250c('0x8'));var _=require(_0x250c('0x9'));var squel=require(_0x250c('0xa'));var crypto=require(_0x250c('0xb'));var jsforce=require(_0x250c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x250c('0xd'));var Redis=require('ioredis');var authService=require(_0x250c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x250c('0xf'));var hardwareService=require(_0x250c('0x10'));var logger=require(_0x250c('0x11'))('api');var utils=require(_0x250c('0x12'));var config=require(_0x250c('0x13'));var licenseUtil=require(_0x250c('0x14'));var db=require(_0x250c('0x15'))['db'];config[_0x250c('0x16')]=_[_0x250c('0x17')](config[_0x250c('0x16')],{'host':_0x250c('0x18'),'port':0x18eb});var socket=require(_0x250c('0x19'))(new Redis(config['redis']));require(_0x250c('0x1a'))[_0x250c('0x1b')](socket);var jayson=require(_0x250c('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb44357,_0x1d7263,_0x1a90db,_0x59f7fe){return new BPromise(function(_0x1c90b3,_0x2fdf70){var _0x3f36bb=_0x59f7fe||client;return _0x3f36bb['request'](_0xb44357,_0x1a90db)['then'](function(_0x2feecf){logger['info'](_0x250c('0x1d'),_0x1d7263,'request\x20sent');logger[_0x250c('0x1e')](_0x250c('0x1f'),_0x1d7263,'request\x20sent',JSON[_0x250c('0x20')](_0x2feecf));if(_0x2feecf[_0x250c('0x21')]){if(_0x2feecf['error'][_0x250c('0x22')]===0x1f4){logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x2fdf70(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}logger[_0x250c('0x21')](_0x250c('0x1d'),_0x1d7263,_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);return _0x1c90b3(_0x2feecf[_0x250c('0x21')][_0x250c('0x23')]);}else{logger[_0x250c('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1d7263,_0x250c('0x25'));_0x1c90b3(_0x2feecf[_0x250c('0x26')][_0x250c('0x23')]);}})[_0x250c('0x27')](function(_0x24204a){logger['error'](_0x250c('0x1d'),_0x1d7263,_0x24204a);_0x2fdf70(_0x24204a);});});}function respondWithStatusCode(_0x40239c,_0x2b3fce){_0x2b3fce=_0x2b3fce||0xcc;return function(_0x4a5ab1){if(_0x4a5ab1){return _0x40239c['sendStatus'](_0x2b3fce);}return _0x40239c['status'](_0x2b3fce)[_0x250c('0x28')]();};}function respondWithResult(_0x595900,_0x2bb0f8){_0x2bb0f8=_0x2bb0f8||0xc8;return function(_0x38c2a5){if(_0x38c2a5){return _0x595900[_0x250c('0x29')](_0x2bb0f8)[_0x250c('0x2a')](_0x38c2a5);}};}function respondWithFilteredResult(_0xaca396,_0x4c388d){return function(_0x4a2ea1){if(_0x4a2ea1){var _0x24d97f=typeof _0x4c388d[_0x250c('0x2b')]===_0x250c('0x2c')&&typeof _0x4c388d[_0x250c('0x2d')]==='undefined';var _0x376af7=_0x4a2ea1[_0x250c('0x2e')];var _0x353ee5=_0x24d97f?0x0:_0x4c388d[_0x250c('0x2b')];var _0x53e3c0=_0x24d97f?_0x4a2ea1['count']:_0x4c388d['offset']+_0x4c388d['limit'];var _0x1d0685;if(_0x53e3c0>=_0x376af7){_0x53e3c0=_0x376af7;_0x1d0685=0xc8;}else{_0x1d0685=0xce;}_0xaca396['status'](_0x1d0685);return _0xaca396[_0x250c('0x2f')]('Content-Range',_0x353ee5+'-'+_0x53e3c0+'/'+_0x376af7)[_0x250c('0x2a')](_0x4a2ea1);}return null;};}function patchUpdates(_0x590bd8){return function(_0x2645a9){try{jsonpatch[_0x250c('0x30')](_0x2645a9,_0x590bd8,!![]);}catch(_0x176b6a){return BPromise[_0x250c('0x31')](_0x176b6a);}return _0x2645a9['save']();};}function saveUpdates(_0x1bebfb,_0x2a8691){return function(_0x276ddf){if(_0x276ddf){return _0x276ddf['update'](_0x1bebfb)[_0x250c('0x32')](function(_0x208c04){return _0x208c04;});}return null;};}function removeEntity(_0x387119,_0x40e18f){return function(_0xaad7e5){if(_0xaad7e5){return _0xaad7e5['destroy']()['then'](function(){var _0x549a53=_0xaad7e5['get']({'plain':!![]});var _0x38d75b=_0x250c('0x33');return db[_0x250c('0x34')][_0x250c('0x35')]({'where':{'type':_0x38d75b,'resourceId':_0x549a53['id']}})['then'](function(){return _0xaad7e5;});})[_0x250c('0x32')](function(){_0x387119[_0x250c('0x29')](0xcc)[_0x250c('0x28')]();});}};}function handleEntityNotFound(_0x19e43c,_0x50189c){return function(_0x3b3c2b){if(!_0x3b3c2b){_0x19e43c[_0x250c('0x36')](0x194);}return _0x3b3c2b;};}function handleError(_0x19cc86,_0x4d26d7){_0x4d26d7=_0x4d26d7||0x1f4;return function(_0x2b6e0e){logger[_0x250c('0x21')](_0x2b6e0e[_0x250c('0x37')]);if(_0x2b6e0e[_0x250c('0x38')]){delete _0x2b6e0e[_0x250c('0x38')];}_0x19cc86[_0x250c('0x29')](_0x4d26d7)[_0x250c('0x39')](_0x2b6e0e);};}exports['index']=function(_0x3744a4,_0x442de6){var _0x1501ff={},_0x3fe6db={},_0x38b6a4={'count':0x0,'rows':[]};var _0x408673=_[_0x250c('0x3a')](db[_0x250c('0x3b')][_0x250c('0x3c')],function(_0xda987d){return{'name':_0xda987d[_0x250c('0x3d')],'type':_0xda987d['type'][_0x250c('0x3e')]};});_0x3fe6db[_0x250c('0x3f')]=_[_0x250c('0x3a')](_0x408673,_0x250c('0x38'));_0x3fe6db[_0x250c('0x40')]=_['keys'](_0x3744a4['query']);_0x3fe6db[_0x250c('0x41')]=_[_0x250c('0x42')](_0x3fe6db['model'],_0x3fe6db['query']);_0x1501ff['attributes']=_[_0x250c('0x42')](_0x3fe6db[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x3744a4['query']['fields']));_0x1501ff[_0x250c('0x44')]=_0x1501ff[_0x250c('0x44')]['length']?_0x1501ff['attributes']:_0x3fe6db[_0x250c('0x3f')];if(!_0x3744a4[_0x250c('0x40')][_0x250c('0x45')]('nolimit')){_0x1501ff[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x3744a4[_0x250c('0x40')]['limit']);_0x1501ff['offset']=qs[_0x250c('0x2b')](_0x3744a4[_0x250c('0x40')][_0x250c('0x2b')]);}_0x1501ff[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x3744a4[_0x250c('0x40')][_0x250c('0x47')]);_0x1501ff[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x3744a4[_0x250c('0x40')],_0x3fe6db['filters']),_0x408673);if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4a')]){_0x1501ff['where']=_['merge'](_0x1501ff[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x408673,function(_0x20440b){if(_0x20440b['type']!==_0x250c('0x4b')){var _0x4f8521={};_0x4f8521[_0x20440b[_0x250c('0x38')]]={'$like':'%'+_0x3744a4['query'][_0x250c('0x4a')]+'%'};return _0x4f8521;}})});}_0x1501ff=_['merge']({},_0x1501ff,_0x3744a4['options']);var _0x40a7aa={'where':_0x1501ff[_0x250c('0x48')]};return db[_0x250c('0x3b')][_0x250c('0x2e')](_0x40a7aa)['then'](function(_0xe0a317){_0x38b6a4['count']=_0xe0a317;if(_0x3744a4[_0x250c('0x40')][_0x250c('0x4c')]){_0x1501ff[_0x250c('0x4d')]=[{'all':!![]}];}return db['ChatQueue'][_0x250c('0x4e')](_0x1501ff);})[_0x250c('0x32')](function(_0x30c2a2){_0x38b6a4[_0x250c('0x4f')]=_0x30c2a2;return _0x38b6a4;})['then'](respondWithFilteredResult(_0x442de6,_0x1501ff))[_0x250c('0x27')](handleError(_0x442de6,null));};exports[_0x250c('0x50')]=function(_0x2d05d6,_0x1a56e8){var _0x512dd5={'raw':!![],'where':{'id':_0x2d05d6[_0x250c('0x51')]['id']}},_0x4b6886={};_0x4b6886[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x3b')][_0x250c('0x3c')]);_0x4b6886['query']=_['keys'](_0x2d05d6[_0x250c('0x40')]);_0x4b6886[_0x250c('0x41')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],_0x4b6886[_0x250c('0x40')]);_0x512dd5[_0x250c('0x44')]=_[_0x250c('0x42')](_0x4b6886[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x2d05d6[_0x250c('0x40')]['fields']));_0x512dd5[_0x250c('0x44')]=_0x512dd5['attributes'][_0x250c('0x53')]?_0x512dd5[_0x250c('0x44')]:_0x4b6886[_0x250c('0x3f')];if(_0x2d05d6[_0x250c('0x40')][_0x250c('0x4c')]){_0x512dd5['include']=[{'all':!![]}];}_0x512dd5=_[_0x250c('0x54')]({},_0x512dd5,_0x2d05d6[_0x250c('0x55')]);return db[_0x250c('0x3b')][_0x250c('0x56')](_0x512dd5)[_0x250c('0x32')](handleEntityNotFound(_0x1a56e8,null))[_0x250c('0x32')](respondWithResult(_0x1a56e8,null))[_0x250c('0x27')](handleError(_0x1a56e8,null));};exports[_0x250c('0x57')]=function(_0x4bfd34,_0x5549e5){return db[_0x250c('0x3b')][_0x250c('0x57')](_0x4bfd34[_0x250c('0x58')],{})[_0x250c('0x32')](function(_0x39fb27){var _0x385365=_0x4bfd34[_0x250c('0x59')][_0x250c('0x5a')]({'plain':!![]});if(!_0x385365)throw new Error(_0x250c('0x5b'));if(_0x385365['role']===_0x250c('0x59')){var _0x3441a8=_0x39fb27[_0x250c('0x5a')]({'plain':!![]});var _0x376f00='ChatQueues';return db[_0x250c('0x5c')]['find']({'where':{'name':_0x376f00,'userProfileId':_0x385365[_0x250c('0x5d')]},'raw':!![]})[_0x250c('0x32')](function(_0x4c59e5){if(_0x4c59e5&&_0x4c59e5[_0x250c('0x5e')]===0x0){return db[_0x250c('0x34')]['create']({'name':_0x3441a8[_0x250c('0x38')],'resourceId':_0x3441a8['id'],'type':_0x4c59e5[_0x250c('0x38')],'sectionId':_0x4c59e5['id']},{})[_0x250c('0x32')](function(){return _0x39fb27;});}else{return _0x39fb27;}})['catch'](function(_0x412217){logger[_0x250c('0x21')](_0x250c('0x5f'),_0x412217);throw _0x412217;});}return _0x39fb27;})[_0x250c('0x32')](respondWithResult(_0x5549e5,0xc9))[_0x250c('0x27')](handleError(_0x5549e5,null));};exports[_0x250c('0x60')]=function(_0x2fd085,_0x43872b){if(_0x2fd085[_0x250c('0x58')]['id']){delete _0x2fd085['body']['id'];}return db[_0x250c('0x3b')]['find']({'where':{'id':_0x2fd085[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x43872b,null))[_0x250c('0x32')](saveUpdates(_0x2fd085[_0x250c('0x58')],null))['then'](respondWithResult(_0x43872b,null))[_0x250c('0x27')](handleError(_0x43872b,null));};exports[_0x250c('0x35')]=function(_0x3cddd2,_0x1d32ad){return db[_0x250c('0x3b')]['find']({'where':{'id':_0x3cddd2[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x1d32ad,null))[_0x250c('0x32')](removeEntity(_0x1d32ad,null))[_0x250c('0x27')](handleError(_0x1d32ad,null));};exports[_0x250c('0x61')]=function(_0x2596b8,_0x4bc91a){return db[_0x250c('0x3b')][_0x250c('0x61')]()[_0x250c('0x32')](respondWithResult(_0x4bc91a,null))[_0x250c('0x27')](handleError(_0x4bc91a,null));};exports[_0x250c('0x62')]=function(_0x1b2976,_0x1cb3ac,_0x26bcbd){var _0x3f1b7a={'raw':!![],'where':{}},_0xc6569={},_0x2d8ddd;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x1b2976['params']['id']}})['then'](handleEntityNotFound(_0x1cb3ac,null))[_0x250c('0x32')](function(_0x247f75){if(_0x247f75){_0x2d8ddd=_0x247f75[_0x250c('0x5a')]({'plain':!![]});_0xc6569[_0x250c('0x3f')]=_['keys'](db[_0x250c('0x64')][_0x250c('0x3c')]);_0xc6569['query']=_[_0x250c('0x52')](_0x1b2976[_0x250c('0x40')]);_0xc6569[_0x250c('0x41')]=_['intersection'](_0xc6569[_0x250c('0x3f')],_0xc6569[_0x250c('0x40')]);_0x3f1b7a['attributes']=_['intersection'](_0xc6569['model'],qs[_0x250c('0x43')](_0x1b2976[_0x250c('0x40')][_0x250c('0x43')]));_0x3f1b7a[_0x250c('0x44')]=_0x3f1b7a[_0x250c('0x44')][_0x250c('0x53')]?_0x3f1b7a[_0x250c('0x44')]:_0xc6569[_0x250c('0x3f')];if(!_0x1b2976['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x3f1b7a[_0x250c('0x2d')]=qs[_0x250c('0x2d')](_0x1b2976['query'][_0x250c('0x2d')]);_0x3f1b7a['offset']=qs['offset'](_0x1b2976[_0x250c('0x40')]['offset']);}_0x3f1b7a['order']=qs['sort'](_0x1b2976['query'][_0x250c('0x47')]);_0x3f1b7a['where']=qs[_0x250c('0x41')](_[_0x250c('0x49')](_0x1b2976[_0x250c('0x40')],_0xc6569[_0x250c('0x41')]));_0x3f1b7a[_0x250c('0x48')]['ChatQueueId']=_0x247f75['id'];if(_0x1b2976[_0x250c('0x40')][_0x250c('0x4a')]){_0x3f1b7a['where']=_[_0x250c('0x54')](_0x3f1b7a[_0x250c('0x48')],{'$or':_['map'](_0x3f1b7a[_0x250c('0x44')],function(_0x3e479f){var _0x22e983={};_0x22e983[_0x3e479f]={'$like':'%'+_0x1b2976['query'][_0x250c('0x4a')]+'%'};return _0x22e983;})});}_0x3f1b7a=_[_0x250c('0x54')]({},_0x3f1b7a,_0x1b2976['options']);return db[_0x250c('0x64')][_0x250c('0x4e')](_0x3f1b7a);}})[_0x250c('0x32')](function(_0x1e8698){if(_0x1e8698){return db[_0x250c('0x66')][_0x250c('0x67')]({'where':{'id':_[_0x250c('0x3a')](_0x1e8698,_0x250c('0x68')),'role':_0x250c('0x69')},'attributes':['id','name','chatPause',_0x250c('0x6a'),_0x250c('0x6b')]});}})[_0x250c('0x32')](function(_0x14b892){if(_0x14b892){return{'count':_0x14b892[_0x250c('0x2e')],'rows':_[_0x250c('0x3a')](_0x14b892[_0x250c('0x4f')],function(_0x3d2574){return{'membername':_0x3d2574[_0x250c('0x38')],'UserId':_0x3d2574['id'],'queue_name':_0x2d8ddd[_0x250c('0x38')],'ChatQueueId':_0x2d8ddd['id'],'interface':util[_0x250c('0x6c')]('%s/%s',_0x250c('0x6d'),_0x3d2574['name']),'penalty':0x0,'paused':_0x3d2574[_0x250c('0x6e')],'createdAt':_0x3d2574[_0x250c('0x6b')],'updatedAt':_0x3d2574[_0x250c('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x250c('0x32')](respondWithFilteredResult(_0x1cb3ac,_0x3f1b7a))['catch'](handleError(_0x1cb3ac,null));};exports[_0x250c('0x6f')]=function(_0x43160d,_0x99aeef,_0x28a684){var _0x61a35={};var _0xf28a3b={};var _0x7bc1a6;var _0x302996;return db[_0x250c('0x3b')]['findOne']({'where':{'id':_0x43160d[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x99aeef,null))['then'](function(_0x4b3687){if(_0x4b3687){_0x7bc1a6=_0x4b3687;_0xf28a3b[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x70')][_0x250c('0x3c')]);_0xf28a3b[_0x250c('0x40')]=_[_0x250c('0x52')](_0x43160d[_0x250c('0x40')]);_0xf28a3b['filters']=_[_0x250c('0x42')](_0xf28a3b['model'],_0xf28a3b[_0x250c('0x40')]);_0x61a35[_0x250c('0x44')]=_[_0x250c('0x42')](_0xf28a3b[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x43160d[_0x250c('0x40')]['fields']));_0x61a35[_0x250c('0x44')]=_0x61a35[_0x250c('0x44')][_0x250c('0x53')]?_0x61a35[_0x250c('0x44')]:_0xf28a3b[_0x250c('0x3f')];_0x61a35[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x43160d[_0x250c('0x40')][_0x250c('0x47')]);_0x61a35[_0x250c('0x48')]=qs['filters'](_[_0x250c('0x49')](_0x43160d[_0x250c('0x40')],_0xf28a3b[_0x250c('0x41')]));if(_0x43160d[_0x250c('0x40')][_0x250c('0x4a')]){_0x61a35[_0x250c('0x48')]=_['merge'](_0x61a35[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x61a35['attributes'],function(_0x50feda){var _0x73b10={};_0x73b10[_0x50feda]={'$like':'%'+_0x43160d[_0x250c('0x40')]['filter']+'%'};return _0x73b10;})});}_0x61a35=_[_0x250c('0x54')]({},_0x61a35,_0x43160d[_0x250c('0x55')]);return _0x7bc1a6[_0x250c('0x6f')](_0x61a35);}})[_0x250c('0x32')](function(_0x52effa){if(_0x52effa){_0x302996=_0x52effa[_0x250c('0x53')];if(!_0x43160d['query'][_0x250c('0x45')](_0x250c('0x65'))){_0x61a35[_0x250c('0x2d')]=qs['limit'](_0x43160d[_0x250c('0x40')]['limit']);_0x61a35[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x43160d[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x7bc1a6['getTeams'](_0x61a35);}})[_0x250c('0x32')](function(_0x5a4131){if(_0x5a4131){return _0x5a4131?{'count':_0x302996,'rows':_0x5a4131}:null;}})[_0x250c('0x32')](respondWithResult(_0x99aeef,null))[_0x250c('0x27')](handleError(_0x99aeef,null));};exports[_0x250c('0x71')]=function(_0xd31f5,_0x353b93,_0x25017e){var _0x1b2052=_0xd31f5[_0x250c('0x58')][_0x250c('0x72')];return db[_0x250c('0x70')]['findAll']({'where':{'id':_0x1b2052},'attributes':['id'],'include':[{'model':db['User'],'as':_0x250c('0x73'),'attributes':['id',_0x250c('0x38'),_0x250c('0x74'),_0x250c('0x75'),'interface'],'raw':!![]}]})[_0x250c('0x32')](function(_0x30130a){if(_0x30130a){var _0x7c3a0c=_[_0x250c('0x76')](_0x30130a,function(_0x4d7402){var _0x2fd7a5=_0x4d7402['get']({'plain':!![]});return _0x2fd7a5[_0x250c('0x73')];});return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0xd31f5[_0x250c('0x51')]['id']}})['then'](function(_0x259adb){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0x1befbe){return _0x259adb[_0x250c('0x71')](_0x1b2052,{'transaction':_0x1befbe})[_0x250c('0x32')](function(){return BPromise[_0x250c('0x79')](_0x7c3a0c,function(_0x4d9ae0){return db[_0x250c('0x64')][_0x250c('0x7a')]({'where':{'UserId':_0x4d9ae0['id'],'ChatQueueId':_0xd31f5['params']['id']},'transaction':_0x1befbe});});})[_0x250c('0x32')](function(){_0x7c3a0c[_0x250c('0x7b')](function(_0x5b46be){socket[_0x250c('0x7c')](_0x250c('0x7d'),{'UserId':_0x5b46be['id'],'ChatQueueId':_0x259adb['id']});});});});});}})[_0x250c('0x32')](respondWithStatusCode(_0x353b93,null))['catch'](handleError(_0x353b93,null));};exports[_0x250c('0x7e')]=function(_0x53d06d,_0x474be3,_0x1f517c){return db[_0x250c('0x70')][_0x250c('0x4e')]({'where':{'id':_0x53d06d[_0x250c('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x250c('0x66')],'as':_0x250c('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x474be3,null))[_0x250c('0x32')](function(_0x3dcfb3){var _0x118712=_['map'](_0x3dcfb3,'id');var _0x5065f0=[];var _0x48d631=[];var _0x3cc2ae=squel['select']();_0x3cc2ae[_0x250c('0x7f')](_0x250c('0x80'))['from']('team_has_chat_queues','tq')[_0x250c('0x81')](_0x250c('0x82'),'ut',_0x250c('0x83'))[_0x250c('0x48')]('ChatQueueId\x20=\x20?',_0x53d06d[_0x250c('0x51')]['id']);for(var _0x1d974d=0x0;_0x1d974d<_0x3dcfb3[_0x250c('0x53')];_0x1d974d+=0x1){let _0x140fa1=_0x3dcfb3[_0x1d974d];for(var _0x35855d=0x0;_0x35855d<_0x140fa1[_0x250c('0x73')][_0x250c('0x53')];_0x35855d+=0x1){let _0x572408=_0x140fa1[_0x250c('0x73')][_0x35855d];var _0x2c9c10=_0x3cc2ae[_0x250c('0x84')]();_0x2c9c10[_0x250c('0x48')]('ut.UserId\x20=\x20?',_0x572408['id']);_0x48d631['push'](db['sequelize'][_0x250c('0x40')](_0x2c9c10[_0x250c('0x85')](),{'type':db['sequelize']['QueryTypes'][_0x250c('0x86')]})['then'](function(_0x2a30c9){if(_0x2a30c9[_0x250c('0x53')]===0x1){return _0x572408['id'];}else{var _0x5e7274=_[_0x250c('0x87')](_['map'](_0x2a30c9,_0x250c('0x88')),function(_0x53d14f){return _[_0x250c('0x89')](_0x118712,_0x53d14f);});if(_0x5e7274){return _0x572408['id'];}}}));}}return BPromise[_0x250c('0x8a')](_0x48d631)[_0x250c('0x32')](function(_0x25220f){_0x5065f0=_(_0x5065f0)[_0x250c('0x8b')](_0x25220f)['compact']()['value']();return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x53d06d['params']['id']}})[_0x250c('0x32')](function(_0x4b9e34){return db[_0x250c('0x77')][_0x250c('0x78')](function(_0xd9e69f){return _0x4b9e34[_0x250c('0x7e')](_0x53d06d[_0x250c('0x40')][_0x250c('0x72')],{'transaction':_0xd9e69f})[_0x250c('0x32')](function(){if(!_[_0x250c('0x8c')](_0x5065f0)){return _0x4b9e34[_0x250c('0x8d')](_0x5065f0,{'transaction':_0xd9e69f});}})['then'](function(){_0x5065f0[_0x250c('0x7b')](function(_0x37c10d){socket['emit'](_0x250c('0x8e'),{'UserId':_0x37c10d,'ChatQueueId':_0x4b9e34['id']});});});});});});})[_0x250c('0x32')](respondWithStatusCode(_0x474be3,null))[_0x250c('0x27')](handleError(_0x474be3,null));};exports['addAgents']=function(_0x4f8fcd,_0x4bcc6f,_0x42253f){return db['ChatQueue'][_0x250c('0x56')]({'where':{'id':_0x4f8fcd[_0x250c('0x51')]['id']}})[_0x250c('0x32')](handleEntityNotFound(_0x4bcc6f,null))[_0x250c('0x32')](function(_0x2a1604){if(_0x2a1604){return _0x2a1604['addAgents'](_0x4f8fcd[_0x250c('0x58')]['ids'],_[_0x250c('0x8f')](_0x4f8fcd[_0x250c('0x58')],[_0x250c('0x72'),'id'])||{})[_0x250c('0x90')](function(_0x128f27){for(var _0x564e8f=0x0;_0x564e8f<_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x250c('0x53')];_0x564e8f+=0x1){socket[_0x250c('0x7c')]('userChatQueue:save',{'UserId':Number(_0x4f8fcd[_0x250c('0x58')][_0x250c('0x72')][_0x564e8f]),'ChatQueueId':Number(_0x4f8fcd[_0x250c('0x51')]['id'])});}return _0x128f27;});}})[_0x250c('0x32')](respondWithResult(_0x4bcc6f,null))[_0x250c('0x27')](handleError(_0x4bcc6f,null));};exports[_0x250c('0x8d')]=function(_0x1249a7,_0x27c807,_0x20f128){return db[_0x250c('0x3b')][_0x250c('0x56')]({'where':{'id':_0x1249a7[_0x250c('0x51')]['id']}})['then'](handleEntityNotFound(_0x27c807,null))['then'](function(_0x2632ae){if(_0x2632ae){return _0x2632ae[_0x250c('0x8d')](_0x1249a7['query'][_0x250c('0x72')])[_0x250c('0x32')](function(){if(_[_0x250c('0x91')](_0x1249a7[_0x250c('0x40')][_0x250c('0x72')])){for(var _0x1e3d0b=0x0;_0x1e3d0b<_0x1249a7[_0x250c('0x40')]['ids']['length'];_0x1e3d0b+=0x1){socket[_0x250c('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x1249a7[_0x250c('0x40')][_0x250c('0x72')][_0x1e3d0b]),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}}else{socket[_0x250c('0x7c')](_0x250c('0x8e'),{'UserId':Number(_0x1249a7['query']['ids']),'ChatQueueId':Number(_0x1249a7[_0x250c('0x51')]['id'])});}});}})[_0x250c('0x32')](respondWithStatusCode(_0x27c807,null))[_0x250c('0x27')](handleError(_0x27c807,null));};exports['getAgents']=function(_0x115164,_0x27e479,_0x16ef29){var _0x20027f={};var _0x2c3470={};var _0x23d101;var _0x1299e4;return db[_0x250c('0x3b')][_0x250c('0x63')]({'where':{'id':_0x115164['params']['id']}})['then'](handleEntityNotFound(_0x27e479,null))[_0x250c('0x32')](function(_0x1ee55d){if(_0x1ee55d){_0x23d101=_0x1ee55d;_0x2c3470[_0x250c('0x3f')]=_[_0x250c('0x52')](db[_0x250c('0x66')][_0x250c('0x3c')]);_0x2c3470[_0x250c('0x40')]=_[_0x250c('0x52')](_0x115164[_0x250c('0x40')]);_0x2c3470[_0x250c('0x41')]=_[_0x250c('0x42')](_0x2c3470[_0x250c('0x3f')],_0x2c3470[_0x250c('0x40')]);_0x20027f[_0x250c('0x44')]=_['intersection'](_0x2c3470[_0x250c('0x3f')],qs[_0x250c('0x43')](_0x115164[_0x250c('0x40')]['fields']));_0x20027f['attributes']=_0x20027f[_0x250c('0x44')][_0x250c('0x53')]?_0x20027f[_0x250c('0x44')]:_0x2c3470[_0x250c('0x3f')];_0x20027f[_0x250c('0x46')]=qs[_0x250c('0x47')](_0x115164[_0x250c('0x40')][_0x250c('0x47')]);_0x20027f[_0x250c('0x48')]=qs[_0x250c('0x41')](_['pick'](_0x115164['query'],_0x2c3470[_0x250c('0x41')]));if(_0x115164[_0x250c('0x40')]['filter']){_0x20027f[_0x250c('0x48')]=_['merge'](_0x20027f[_0x250c('0x48')],{'$or':_[_0x250c('0x3a')](_0x20027f[_0x250c('0x44')],function(_0x1bf9f0){var _0x49e578={};_0x49e578[_0x1bf9f0]={'$like':'%'+_0x115164[_0x250c('0x40')][_0x250c('0x4a')]+'%'};return _0x49e578;})});}_0x20027f=_[_0x250c('0x54')]({},_0x20027f,_0x115164[_0x250c('0x55')]);return _0x23d101['getAgents'](_0x20027f);}})['then'](function(_0x4c60b2){if(_0x4c60b2){_0x1299e4=_0x4c60b2[_0x250c('0x53')];if(!_0x115164[_0x250c('0x40')]['hasOwnProperty'](_0x250c('0x65'))){_0x20027f[_0x250c('0x2d')]=qs['limit'](_0x115164[_0x250c('0x40')][_0x250c('0x2d')]);_0x20027f[_0x250c('0x2b')]=qs[_0x250c('0x2b')](_0x115164[_0x250c('0x40')][_0x250c('0x2b')]);}return _0x23d101[_0x250c('0x92')](_0x20027f);}})['then'](function(_0xe39f25){if(_0xe39f25){return _0xe39f25?{'count':_0x1299e4,'rows':_0xe39f25}:null;}})['then'](respondWithResult(_0x27e479,null))[_0x250c('0x27')](handleError(_0x27e479,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1b416bb..e1795aa 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 _0x1dc2=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1da9f9,_0x3b96e3){var _0x3d0bde=function(_0x51bfd3){while(--_0x51bfd3){_0x1da9f9['push'](_0x1da9f9['shift']());}};_0x3d0bde(++_0x3b96e3);}(_0x1dc2,0xb0));var _0x21dc=function(_0x1575d4,_0x3563da){_0x1575d4=_0x1575d4-0x0;var _0x17d732=_0x1dc2[_0x1575d4];return _0x17d732;};'use strict';var EventEmitter=require(_0x21dc('0x0'));var ChatQueue=require(_0x21dc('0x1'))['db'][_0x21dc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x21dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x21dc('0x4'),'afterDestroy':_0x21dc('0x5')};function emitEvent(_0x135c72){return function(_0x328896,_0x2353e6,_0x6f8b79){ChatQueueEvents[_0x21dc('0x6')](_0x135c72+':'+_0x328896['id'],_0x328896);ChatQueueEvents[_0x21dc('0x6')](_0x135c72,_0x328896);_0x6f8b79(null);};}for(var e in events){if(events[_0x21dc('0x7')](e)){var event=events[e];ChatQueue[_0x21dc('0x8')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5430=['exports','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x3f6d5a,_0x2a83c8){var _0x33b363=function(_0x2da4c2){while(--_0x2da4c2){_0x3f6d5a['push'](_0x3f6d5a['shift']());}};_0x33b363(++_0x2a83c8);}(_0x5430,0xc7));var _0x0543=function(_0x4a9874,_0x48f997){_0x4a9874=_0x4a9874-0x0;var _0x26b791=_0x5430[_0x4a9874];return _0x26b791;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0543('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0543('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0543('0x2')};function emitEvent(_0x50274e){return function(_0x5cce70,_0x3b4e30,_0x377152){ChatQueueEvents['emit'](_0x50274e+':'+_0x5cce70['id'],_0x5cce70);ChatQueueEvents[_0x0543('0x3')](_0x50274e,_0x5cce70);_0x377152(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x0543('0x4')](e,emitEvent(event));}}module[_0x0543('0x5')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d10bd5f..8506684 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 _0x0999=['bluebird','request-promise','../../config/environment','./chatQueue.attributes','chat_queues','api'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x0999,0x9b));var _0x9099=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x0999[_0x387dc1];return _0x17567c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9099('0x0'));var moment=require('moment');var BPromise=require(_0x9099('0x1'));var rp=require(_0x9099('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9099('0x3'));var attributes=require(_0x9099('0x4'));module['exports']=function(_0x637c0c,_0x3d2597){return _0x637c0c['define']('ChatQueue',attributes,{'tableName':_0x9099('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ba=['exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x375c38,_0x1afa1d){var _0x37076c=function(_0x3a2d0f){while(--_0x3a2d0f){_0x375c38['push'](_0x375c38['shift']());}};_0x37076c(++_0x1afa1d);}(_0xd8ba,0xc7));var _0xad8b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd8ba[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xad8b('0x0'));var util=require(_0xad8b('0x1'));var logger=require(_0xad8b('0x2'))(_0xad8b('0x3'));var moment=require(_0xad8b('0x4'));var BPromise=require(_0xad8b('0x5'));var rp=require(_0xad8b('0x6'));var fs=require('fs');var path=require(_0xad8b('0x7'));var rimraf=require(_0xad8b('0x8'));var config=require(_0xad8b('0x9'));var attributes=require(_0xad8b('0xa'));module[_0xad8b('0xb')]=function(_0x5b8fe6,_0xe75eba){return _0x5b8fe6[_0xad8b('0xc')](_0xad8b('0xd'),attributes,{'tableName':_0xad8b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 6a3bd27..391a5b4 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 _0xd7a0=['debug','find','raw','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xd7a0,0x163));var _0x0d7a=function(_0x2c58b1,_0x26b3bf){_0x2c58b1=_0x2c58b1-0x0;var _0x32fd71=_0xd7a0[_0x2c58b1];return _0x32fd71;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});config[_0x0d7a('0xb')]=_[_0x0d7a('0xc')](config[_0x0d7a('0xb')],{'host':_0x0d7a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d7a('0xb')]));require(_0x0d7a('0xe'))[_0x0d7a('0xf')](socket);function respondWithRpcPromise(_0x4688bf,_0x5107c7,_0x410bdd){return new BPromise(function(_0x842056,_0x5064ac){return client[_0x0d7a('0x10')](_0x4688bf,_0x410bdd)[_0x0d7a('0x11')](function(_0x4275a9){logger[_0x0d7a('0x12')](_0x0d7a('0x13'),_0x5107c7,'request\x20sent');logger['debug'](_0x0d7a('0x14'),_0x5107c7,_0x0d7a('0x15'),JSON[_0x0d7a('0x16')](_0x4275a9));if(_0x4275a9['error']){if(_0x4275a9[_0x0d7a('0x17')]['code']===0x1f4){logger['error'](_0x0d7a('0x13'),_0x5107c7,_0x4275a9['error'][_0x0d7a('0x18')]);return _0x5064ac(_0x4275a9[_0x0d7a('0x17')][_0x0d7a('0x18')]);}logger[_0x0d7a('0x17')]('ChatQueue,\x20%s,\x20%s',_0x5107c7,_0x4275a9[_0x0d7a('0x17')][_0x0d7a('0x18')]);return _0x842056(_0x4275a9['error'][_0x0d7a('0x18')]);}else{logger[_0x0d7a('0x12')](_0x0d7a('0x13'),_0x5107c7,_0x0d7a('0x15'));_0x842056(_0x4275a9['result'][_0x0d7a('0x18')]);}})['catch'](function(_0x569285){logger['error']('ChatQueue,\x20%s,\x20%s',_0x5107c7,_0x569285);_0x5064ac(_0x569285);});});}exports[_0x0d7a('0x19')]=function(_0x4c303f){var _0x1c117e=this;return new Promise(function(_0x2264c3,_0x4c997f){return db[_0x0d7a('0x1a')][_0x0d7a('0x1b')]({'raw':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x1d')]||null:null,'attributes':_0x4c303f['options']?_0x4c303f['options'][_0x0d7a('0x1e')]||null:null,'limit':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x1f')]||null:null,'include':_0x4c303f[_0x0d7a('0x1c')]?_0x4c303f['options'][_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x4c303f[_0x0d7a('0x1c')][_0x0d7a('0x20')],function(_0x53fe77){return{'model':db[_0x53fe77['model']],'as':_0x53fe77['as'],'attributes':_0x53fe77[_0x0d7a('0x1e')],'include':_0x53fe77[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x53fe77[_0x0d7a('0x20')],function(_0x2d3631){return{'model':db[_0x2d3631[_0x0d7a('0x22')]],'as':_0x2d3631['as'],'attributes':_0x2d3631[_0x0d7a('0x1e')],'include':_0x2d3631[_0x0d7a('0x20')]?_['map'](_0x2d3631[_0x0d7a('0x20')],function(_0x5e6e05){return{'model':db[_0x5e6e05[_0x0d7a('0x22')]],'as':_0x5e6e05['as'],'attributes':_0x5e6e05[_0x0d7a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d7a('0x11')](function(_0x1ca942){logger[_0x0d7a('0x12')]('GetChatQueue',_0x4c303f);logger[_0x0d7a('0x23')](_0x0d7a('0x19'),_0x4c303f,JSON[_0x0d7a('0x16')](_0x1ca942));_0x2264c3(_0x1ca942);})['catch'](function(_0x223160){logger[_0x0d7a('0x17')]('GetChatQueue',_0x223160[_0x0d7a('0x18')],_0x4c303f);_0x4c997f(_0x1c117e[_0x0d7a('0x17')](0x1f4,_0x223160[_0x0d7a('0x18')]));});});};exports['ShowChatQueue']=function(_0x1229f5){var _0x482c9f=this;return new Promise(function(_0x2a15df,_0x3d976c){return db['ChatQueue'][_0x0d7a('0x24')]({'raw':_0x1229f5[_0x0d7a('0x1c')]?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x25')]===undefined?!![]:![]:!![],'where':_0x1229f5[_0x0d7a('0x1c')]?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x1d')]||null:null,'attributes':_0x1229f5['options']?_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x1e')]||null:null,'include':_0x1229f5['options']?_0x1229f5[_0x0d7a('0x1c')]['include']?_['map'](_0x1229f5[_0x0d7a('0x1c')][_0x0d7a('0x20')],function(_0xfebcb9){return{'model':db[_0xfebcb9['model']],'as':_0xfebcb9['as'],'attributes':_0xfebcb9[_0x0d7a('0x1e')],'include':_0xfebcb9[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0xfebcb9[_0x0d7a('0x20')],function(_0x2d06b8){return{'model':db[_0x2d06b8[_0x0d7a('0x22')]],'as':_0x2d06b8['as'],'attributes':_0x2d06b8[_0x0d7a('0x1e')],'include':_0x2d06b8[_0x0d7a('0x20')]?_[_0x0d7a('0x21')](_0x2d06b8[_0x0d7a('0x20')],function(_0x1ca02b){return{'model':db[_0x1ca02b[_0x0d7a('0x22')]],'as':_0x1ca02b['as'],'attributes':_0x1ca02b[_0x0d7a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cd533){logger[_0x0d7a('0x12')](_0x0d7a('0x26'),_0x1229f5);logger['debug'](_0x0d7a('0x26'),_0x1229f5,JSON[_0x0d7a('0x16')](_0x5cd533));_0x2a15df(_0x5cd533);})['catch'](function(_0x3b3add){logger[_0x0d7a('0x17')]('ShowChatQueue',_0x3b3add[_0x0d7a('0x18')],_0x1229f5);_0x3d976c(_0x482c9f['error'](0x1f4,_0x3b3add[_0x0d7a('0x18')]));});});}; \ No newline at end of file +var _0xebc4=['./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','info','GetChatQueue','ChatQueue','then','ShowChatQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','redis','socket.io-emitter'];(function(_0x1b6f3d,_0x52bddf){var _0x2a3d6d=function(_0x348d0d){while(--_0x348d0d){_0x1b6f3d['push'](_0x1b6f3d['shift']());}};_0x2a3d6d(++_0x52bddf);}(_0xebc4,0xf9));var _0x4ebc=function(_0x34e106,_0x91d313){_0x34e106=_0x34e106-0x0;var _0x23a796=_0xebc4[_0x34e106];return _0x23a796;};'use strict';var _=require('lodash');var util=require(_0x4ebc('0x0'));var moment=require(_0x4ebc('0x1'));var BPromise=require(_0x4ebc('0x2'));var rs=require(_0x4ebc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ebc('0x4'))['db'];var utils=require(_0x4ebc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ebc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ebc('0x7')]['http']({'port':0x232a});config[_0x4ebc('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ebc('0x9'))(new Redis(config[_0x4ebc('0x8')]));require(_0x4ebc('0xa'))[_0x4ebc('0xb')](socket);function respondWithRpcPromise(_0x46e0dc,_0x5d6a99,_0x27a221){return new BPromise(function(_0x1b5dbc,_0x12e3c6){return client[_0x4ebc('0xc')](_0x46e0dc,_0x27a221)['then'](function(_0x1522b9){logger['info'](_0x4ebc('0xd'),_0x5d6a99,_0x4ebc('0xe'));logger[_0x4ebc('0xf')](_0x4ebc('0x10'),_0x5d6a99,'request\x20sent',JSON[_0x4ebc('0x11')](_0x1522b9));if(_0x1522b9['error']){if(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x13')]===0x1f4){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);return _0x12e3c6(_0x1522b9['error'][_0x4ebc('0x14')]);}logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x1522b9[_0x4ebc('0x12')]['message']);return _0x1b5dbc(_0x1522b9[_0x4ebc('0x12')][_0x4ebc('0x14')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x5d6a99,_0x4ebc('0xe'));_0x1b5dbc(_0x1522b9[_0x4ebc('0x15')]['message']);}})[_0x4ebc('0x16')](function(_0x28571e){logger[_0x4ebc('0x12')](_0x4ebc('0xd'),_0x5d6a99,_0x28571e);_0x12e3c6(_0x28571e);});});}exports['GetChatQueue']=function(_0x59251b){var _0x249dcf=this;return new Promise(function(_0x3e6195,_0x137ec9){return db['ChatQueue'][_0x4ebc('0x17')]({'raw':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x19')]===undefined?!![]:![]:!![],'where':_0x59251b['options']?_0x59251b['options'][_0x4ebc('0x1a')]||null:null,'attributes':_0x59251b['options']?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'limit':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1c')]||null:null,'include':_0x59251b[_0x4ebc('0x18')]?_0x59251b[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x59251b[_0x4ebc('0x18')]['include'],function(_0x376a83){return{'model':db[_0x376a83[_0x4ebc('0x1f')]],'as':_0x376a83['as'],'attributes':_0x376a83[_0x4ebc('0x1b')],'include':_0x376a83[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x376a83[_0x4ebc('0x1d')],function(_0x165924){return{'model':db[_0x165924[_0x4ebc('0x1f')]],'as':_0x165924['as'],'attributes':_0x165924[_0x4ebc('0x1b')],'include':_0x165924[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x165924['include'],function(_0x10b09a){return{'model':db[_0x10b09a[_0x4ebc('0x1f')]],'as':_0x10b09a['as'],'attributes':_0x10b09a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42590d){logger[_0x4ebc('0x20')](_0x4ebc('0x21'),_0x59251b);logger[_0x4ebc('0xf')](_0x4ebc('0x21'),_0x59251b,JSON[_0x4ebc('0x11')](_0x42590d));_0x3e6195(_0x42590d);})[_0x4ebc('0x16')](function(_0x1d3d15){logger[_0x4ebc('0x12')]('GetChatQueue',_0x1d3d15[_0x4ebc('0x14')],_0x59251b);_0x137ec9(_0x249dcf[_0x4ebc('0x12')](0x1f4,_0x1d3d15[_0x4ebc('0x14')]));});});};exports['ShowChatQueue']=function(_0x3f9c40){var _0xbf2673=this;return new Promise(function(_0x141869,_0x3da50a){return db[_0x4ebc('0x22')]['find']({'raw':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1a')]||null:null,'attributes':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1b')]||null:null,'include':_0x3f9c40[_0x4ebc('0x18')]?_0x3f9c40[_0x4ebc('0x18')][_0x4ebc('0x1d')]?_['map'](_0x3f9c40['options'][_0x4ebc('0x1d')],function(_0x136d78){return{'model':db[_0x136d78[_0x4ebc('0x1f')]],'as':_0x136d78['as'],'attributes':_0x136d78[_0x4ebc('0x1b')],'include':_0x136d78[_0x4ebc('0x1d')]?_[_0x4ebc('0x1e')](_0x136d78[_0x4ebc('0x1d')],function(_0x4af0ec){return{'model':db[_0x4af0ec[_0x4ebc('0x1f')]],'as':_0x4af0ec['as'],'attributes':_0x4af0ec['attributes'],'include':_0x4af0ec['include']?_[_0x4ebc('0x1e')](_0x4af0ec[_0x4ebc('0x1d')],function(_0x34b276){return{'model':db[_0x34b276[_0x4ebc('0x1f')]],'as':_0x34b276['as'],'attributes':_0x34b276[_0x4ebc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ebc('0x23')](function(_0x4fcfb6){logger[_0x4ebc('0x20')]('ShowChatQueue',_0x3f9c40);logger['debug'](_0x4ebc('0x24'),_0x3f9c40,JSON[_0x4ebc('0x11')](_0x4fcfb6));_0x141869(_0x4fcfb6);})[_0x4ebc('0x16')](function(_0x28ab22){logger[_0x4ebc('0x12')](_0x4ebc('0x24'),_0x28ab22[_0x4ebc('0x14')],_0x3f9c40);_0x3da50a(_0xbf2673['error'](0x1f4,_0x28ab22['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ea9b046..c28b02f 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 _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x3c72ae,_0x4e342c){var _0x27dada=function(_0x3a5dbf){while(--_0x3a5dbf){_0x3c72ae['push'](_0x3c72ae['shift']());}};_0x27dada(++_0x4e342c);}(_0xcb99,0x8b));var _0x9cb9=function(_0x36375a,_0x43ede3){_0x36375a=_0x36375a-0x0;var _0xe646d0=_0xcb99[_0x36375a];return _0xe646d0;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file +var _0x5c12=['removeListener','chatQueue:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c12,0x188));var _0x25c1=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0x5c12[_0x81e39d];return _0x548fbb;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x25c1('0x0'),_0x25c1('0x1'),'update'];function createListener(_0x44bc2e,_0x1991e5){return function(_0x4042fe){_0x1991e5[_0x25c1('0x2')](_0x44bc2e,_0x4042fe);};}function removeListener(_0x2c5df0,_0x21ec20){return function(){ChatQueueEvents[_0x25c1('0x3')](_0x2c5df0,_0x21ec20);};}exports['register']=function(_0x204287){for(var _0x42ac16=0x0,_0x382922=events['length'];_0x42ac16<_0x382922;_0x42ac16++){var _0x5c69b1=events[_0x42ac16];var _0x24981c=createListener(_0x25c1('0x4')+_0x5c69b1,_0x204287);ChatQueueEvents['on'](_0x5c69b1,_0x24981c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0ff0a15..cfcd139 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3351d8,_0x2d2e79){var _0x23bdce=function(_0x40cf8c){while(--_0x40cf8c){_0x3351d8['push'](_0x3351d8['shift']());}};_0x23bdce(++_0x2d2e79);}(_0x008c,0x188));var _0xc008=function(_0x4727f1,_0x2ff773){_0x4727f1=_0x4727f1-0x0;var _0x2977ce=_0x008c[_0x4727f1];return _0x2977ce;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0x5fc3[_0x36feb2];return _0x292b43;};'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/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 690293c..f017f19 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 _0x92c7=['exports','STRING','DATE','moment','sequelize'];(function(_0x582f75,_0x24cc69){var _0x312ce5=function(_0x196c4b){while(--_0x196c4b){_0x582f75['push'](_0x582f75['shift']());}};_0x312ce5(++_0x24cc69);}(_0x92c7,0x7b));var _0x792c=function(_0x5b0ab4,_0x3e7c0b){_0x5b0ab4=_0x5b0ab4-0x0;var _0x3b8f55=_0x92c7[_0x5b0ab4];return _0x3b8f55;};'use strict';var moment=require(_0x792c('0x0'));var Sequelize=require(_0x792c('0x1'));module[_0x792c('0x2')]={'uniqueid':{'type':Sequelize[_0x792c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x792c('0x4')]},'leaveAt':{'type':Sequelize[_0x792c('0x4')]},'acceptAt':{'type':Sequelize[_0x792c('0x4')]},'exitAt':{'type':Sequelize[_0x792c('0x4')]},'reason':{'type':Sequelize[_0x792c('0x3')]}}; \ No newline at end of file +var _0x5b2d=['moment','exports','STRING','DATE'];(function(_0x1a3c0e,_0x1dea68){var _0xdab41=function(_0x3be01a){while(--_0x3be01a){_0x1a3c0e['push'](_0x1a3c0e['shift']());}};_0xdab41(++_0x1dea68);}(_0x5b2d,0x140));var _0xd5b2=function(_0x11d7ac,_0x1aefb4){_0x11d7ac=_0x11d7ac-0x0;var _0xff1914=_0x5b2d[_0x11d7ac];return _0xff1914;};'use strict';var moment=require(_0xd5b2('0x0'));var Sequelize=require('sequelize');module[_0xd5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xd5b2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd5b2('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd5b2('0x3')]},'acceptAt':{'type':Sequelize[_0xd5b2('0x3')]},'exitAt':{'type':Sequelize[_0xd5b2('0x3')]},'reason':{'type':Sequelize[_0xd5b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c0762f1..2e8a55e 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 _0xc373=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','apply','reject','then','error','name','send','index','ChatQueueReport','rawAttributes','type'];(function(_0x411bcb,_0x48247e){var _0x377884=function(_0x7598bb){while(--_0x7598bb){_0x411bcb['push'](_0x411bcb['shift']());}};_0x377884(++_0x48247e);}(_0xc373,0x1c7));var _0x3c37=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xc373[_0x5538d5];return _0x323b1a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c37('0x0'));var zipdir=require(_0x3c37('0x1'));var jsonpatch=require(_0x3c37('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c37('0x3'));var Mustache=require(_0x3c37('0x4'));var util=require(_0x3c37('0x5'));var path=require(_0x3c37('0x6'));var sox=require(_0x3c37('0x7'));var csv=require(_0x3c37('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c37('0x9'));var squel=require(_0x3c37('0xa'));var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require(_0x3c37('0xd'));var toCsv=require(_0x3c37('0x8'));var querystring=require(_0x3c37('0xe'));var Papa=require(_0x3c37('0xf'));var Redis=require(_0x3c37('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c37('0x11'));var hardwareService=require(_0x3c37('0x12'));var logger=require(_0x3c37('0x13'))(_0x3c37('0x14'));var utils=require(_0x3c37('0x15'));var config=require(_0x3c37('0x16'));var licenseUtil=require(_0x3c37('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc333c2,_0x454f92){_0x454f92=_0x454f92||0xcc;return function(_0x458002){if(_0x458002){return _0xc333c2['sendStatus'](_0x454f92);}return _0xc333c2['status'](_0x454f92)[_0x3c37('0x18')]();};}function respondWithResult(_0x57c33f,_0x52ab1f){_0x52ab1f=_0x52ab1f||0xc8;return function(_0x37904b){if(_0x37904b){return _0x57c33f[_0x3c37('0x19')](_0x52ab1f)[_0x3c37('0x1a')](_0x37904b);}};}function respondWithFilteredResult(_0x1b70a6,_0x1268b3){return function(_0x22e851){if(_0x22e851){var _0x25d36e=typeof _0x1268b3[_0x3c37('0x1b')]===_0x3c37('0x1c')&&typeof _0x1268b3['limit']===_0x3c37('0x1c');var _0x214a0b=_0x22e851['count'];var _0x55761e=_0x25d36e?0x0:_0x1268b3[_0x3c37('0x1b')];var _0x12a47c=_0x25d36e?_0x22e851[_0x3c37('0x1d')]:_0x1268b3[_0x3c37('0x1b')]+_0x1268b3[_0x3c37('0x1e')];var _0x2b0f25;if(_0x12a47c>=_0x214a0b){_0x12a47c=_0x214a0b;_0x2b0f25=0xc8;}else{_0x2b0f25=0xce;}_0x1b70a6['status'](_0x2b0f25);return _0x1b70a6[_0x3c37('0x1f')]('Content-Range',_0x55761e+'-'+_0x12a47c+'/'+_0x214a0b)['json'](_0x22e851);}return null;};}function patchUpdates(_0x3bc0bb){return function(_0x2882ba){try{jsonpatch[_0x3c37('0x20')](_0x2882ba,_0x3bc0bb,!![]);}catch(_0x7fe4f0){return BPromise[_0x3c37('0x21')](_0x7fe4f0);}return _0x2882ba['save']();};}function saveUpdates(_0x27f83e,_0x54776f){return function(_0x3399a7){if(_0x3399a7){return _0x3399a7['update'](_0x27f83e)[_0x3c37('0x22')](function(_0x2e4226){return _0x2e4226;});}return null;};}function removeEntity(_0x348802,_0x574890){return function(_0x51d25d){if(_0x51d25d){return _0x51d25d['destroy']()['then'](function(){_0x348802['status'](0xcc)[_0x3c37('0x18')]();});}};}function handleEntityNotFound(_0xb334d0,_0x1655c1){return function(_0x3ab6bd){if(!_0x3ab6bd){_0xb334d0['sendStatus'](0x194);}return _0x3ab6bd;};}function handleError(_0x52b5d9,_0x565902){_0x565902=_0x565902||0x1f4;return function(_0x65ac66){logger[_0x3c37('0x23')](_0x65ac66['stack']);if(_0x65ac66['name']){delete _0x65ac66[_0x3c37('0x24')];}_0x52b5d9[_0x3c37('0x19')](_0x565902)[_0x3c37('0x25')](_0x65ac66);};}exports[_0x3c37('0x26')]=function(_0x64474f,_0x56d9c2){var _0x1ce403={},_0x3abacf={},_0x415999={'count':0x0,'rows':[]};var _0xf1d5cb=_['map'](db[_0x3c37('0x27')][_0x3c37('0x28')],function(_0x531931){return{'name':_0x531931['fieldName'],'type':_0x531931[_0x3c37('0x29')][_0x3c37('0x2a')]};});_0x3abacf[_0x3c37('0x2b')]=_['map'](_0xf1d5cb,_0x3c37('0x24'));_0x3abacf['query']=_[_0x3c37('0x2c')](_0x64474f[_0x3c37('0x2d')]);_0x3abacf[_0x3c37('0x2e')]=_[_0x3c37('0x2f')](_0x3abacf[_0x3c37('0x2b')],_0x3abacf[_0x3c37('0x2d')]);_0x1ce403[_0x3c37('0x30')]=_[_0x3c37('0x2f')](_0x3abacf[_0x3c37('0x2b')],qs[_0x3c37('0x31')](_0x64474f['query']['fields']));_0x1ce403['attributes']=_0x1ce403[_0x3c37('0x30')][_0x3c37('0x32')]?_0x1ce403[_0x3c37('0x30')]:_0x3abacf[_0x3c37('0x2b')];if(!_0x64474f[_0x3c37('0x2d')][_0x3c37('0x33')](_0x3c37('0x34'))){_0x1ce403[_0x3c37('0x1e')]=qs[_0x3c37('0x1e')](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x1e')]);_0x1ce403[_0x3c37('0x1b')]=qs['offset'](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x1b')]);}_0x1ce403['order']=qs['sort'](_0x64474f[_0x3c37('0x2d')][_0x3c37('0x35')]);_0x1ce403[_0x3c37('0x36')]=qs[_0x3c37('0x2e')](_[_0x3c37('0x37')](_0x64474f[_0x3c37('0x2d')],_0x3abacf[_0x3c37('0x2e')]),_0xf1d5cb);if(_0x64474f[_0x3c37('0x2d')][_0x3c37('0x38')]){_0x1ce403['where']=_[_0x3c37('0x39')](_0x1ce403[_0x3c37('0x36')],{'$or':_[_0x3c37('0x3a')](_0xf1d5cb,function(_0x280e81){if(_0x280e81[_0x3c37('0x29')]!==_0x3c37('0x3b')){var _0xf76905={};_0xf76905[_0x280e81[_0x3c37('0x24')]]={'$like':'%'+_0x64474f[_0x3c37('0x2d')][_0x3c37('0x38')]+'%'};return _0xf76905;}})});}_0x1ce403=_['merge']({},_0x1ce403,_0x64474f[_0x3c37('0x3c')]);var _0x18acc3={'where':_0x1ce403[_0x3c37('0x36')]};return db[_0x3c37('0x27')][_0x3c37('0x1d')](_0x18acc3)['then'](function(_0x2ac3ca){_0x415999[_0x3c37('0x1d')]=_0x2ac3ca;if(_0x64474f[_0x3c37('0x2d')][_0x3c37('0x3d')]){_0x1ce403['include']=[{'all':!![]}];}return db[_0x3c37('0x27')]['findAll'](_0x1ce403);})[_0x3c37('0x22')](function(_0x51687d){_0x415999[_0x3c37('0x3e')]=_0x51687d;return _0x415999;})[_0x3c37('0x22')](respondWithFilteredResult(_0x56d9c2,_0x1ce403))[_0x3c37('0x3f')](handleError(_0x56d9c2,null));};exports['show']=function(_0x3bf68a,_0x34096f){var _0x2e82d0={'raw':!![],'where':{'id':_0x3bf68a[_0x3c37('0x40')]['id']}},_0x2a4300={};_0x2a4300['model']=_[_0x3c37('0x2c')](db[_0x3c37('0x27')][_0x3c37('0x28')]);_0x2a4300[_0x3c37('0x2d')]=_[_0x3c37('0x2c')](_0x3bf68a[_0x3c37('0x2d')]);_0x2a4300[_0x3c37('0x2e')]=_['intersection'](_0x2a4300[_0x3c37('0x2b')],_0x2a4300[_0x3c37('0x2d')]);_0x2e82d0[_0x3c37('0x30')]=_['intersection'](_0x2a4300[_0x3c37('0x2b')],qs['fields'](_0x3bf68a[_0x3c37('0x2d')][_0x3c37('0x31')]));_0x2e82d0[_0x3c37('0x30')]=_0x2e82d0[_0x3c37('0x30')]['length']?_0x2e82d0['attributes']:_0x2a4300['model'];if(_0x3bf68a[_0x3c37('0x2d')][_0x3c37('0x3d')]){_0x2e82d0['include']=[{'all':!![]}];}_0x2e82d0=_['merge']({},_0x2e82d0,_0x3bf68a[_0x3c37('0x3c')]);return db['ChatQueueReport'][_0x3c37('0x41')](_0x2e82d0)[_0x3c37('0x22')](handleEntityNotFound(_0x34096f,null))[_0x3c37('0x22')](respondWithResult(_0x34096f,null))[_0x3c37('0x3f')](handleError(_0x34096f,null));};exports[_0x3c37('0x42')]=function(_0x300d58,_0x436b28){return db[_0x3c37('0x27')][_0x3c37('0x42')](_0x300d58[_0x3c37('0x43')],{})[_0x3c37('0x22')](respondWithResult(_0x436b28,0xc9))['catch'](handleError(_0x436b28,null));};exports[_0x3c37('0x44')]=function(_0x1869ad,_0x4b8351){if(_0x1869ad[_0x3c37('0x43')]['id']){delete _0x1869ad[_0x3c37('0x43')]['id'];}return db[_0x3c37('0x27')]['find']({'where':{'id':_0x1869ad[_0x3c37('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b8351,null))[_0x3c37('0x22')](saveUpdates(_0x1869ad[_0x3c37('0x43')],null))[_0x3c37('0x22')](respondWithResult(_0x4b8351,null))['catch'](handleError(_0x4b8351,null));};exports[_0x3c37('0x45')]=function(_0x415bac,_0x1dc208){return db[_0x3c37('0x27')][_0x3c37('0x41')]({'where':{'id':_0x415bac[_0x3c37('0x40')]['id']}})[_0x3c37('0x22')](handleEntityNotFound(_0x1dc208,null))[_0x3c37('0x22')](removeEntity(_0x1dc208,null))[_0x3c37('0x3f')](handleError(_0x1dc208,null));};exports[_0x3c37('0x46')]=function(_0x31d553,_0x2aee66){return db[_0x3c37('0x27')]['describe']()[_0x3c37('0x22')](respondWithResult(_0x2aee66,null))[_0x3c37('0x3f')](handleError(_0x2aee66,null));}; \ No newline at end of file +var _0x084b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','fields','include','create','body','find','describe','eml-format','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x4b9c74,_0x1b66bb){var _0x229a46=function(_0x2edf37){while(--_0x2edf37){_0x4b9c74['push'](_0x4b9c74['shift']());}};_0x229a46(++_0x1b66bb);}(_0x084b,0xd5));var _0xb084=function(_0x1234e5,_0x599458){_0x1234e5=_0x1234e5-0x0;var _0x1a351e=_0x084b[_0x1234e5];return _0x1a351e;};'use strict';var emlformat=require(_0xb084('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb084('0x1'));var moment=require(_0xb084('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb084('0x3'));var util=require(_0xb084('0x4'));var path=require(_0xb084('0x5'));var sox=require('sox');var csv=require(_0xb084('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb084('0x7'));var _=require(_0xb084('0x8'));var squel=require(_0xb084('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb084('0xa'));var toCsv=require(_0xb084('0x6'));var querystring=require(_0xb084('0xb'));var Papa=require(_0xb084('0xc'));var Redis=require(_0xb084('0xd'));var authService=require(_0xb084('0xe'));var qs=require(_0xb084('0xf'));var as=require(_0xb084('0x10'));var hardwareService=require(_0xb084('0x11'));var logger=require(_0xb084('0x12'))(_0xb084('0x13'));var utils=require(_0xb084('0x14'));var config=require(_0xb084('0x15'));var licenseUtil=require(_0xb084('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51aee2,_0x3582a0){_0x3582a0=_0x3582a0||0xcc;return function(_0x514829){if(_0x514829){return _0x51aee2['sendStatus'](_0x3582a0);}return _0x51aee2[_0xb084('0x17')](_0x3582a0)[_0xb084('0x18')]();};}function respondWithResult(_0x5bae3a,_0x4da0fb){_0x4da0fb=_0x4da0fb||0xc8;return function(_0x44be03){if(_0x44be03){return _0x5bae3a[_0xb084('0x17')](_0x4da0fb)[_0xb084('0x19')](_0x44be03);}};}function respondWithFilteredResult(_0x28ad2d,_0xc6df71){return function(_0x5a5d11){if(_0x5a5d11){var _0x240838=typeof _0xc6df71[_0xb084('0x1a')]===_0xb084('0x1b')&&typeof _0xc6df71[_0xb084('0x1c')]===_0xb084('0x1b');var _0x2cce88=_0x5a5d11[_0xb084('0x1d')];var _0x42657a=_0x240838?0x0:_0xc6df71[_0xb084('0x1a')];var _0x19d426=_0x240838?_0x5a5d11['count']:_0xc6df71['offset']+_0xc6df71['limit'];var _0x5b076b;if(_0x19d426>=_0x2cce88){_0x19d426=_0x2cce88;_0x5b076b=0xc8;}else{_0x5b076b=0xce;}_0x28ad2d[_0xb084('0x17')](_0x5b076b);return _0x28ad2d['set'](_0xb084('0x1e'),_0x42657a+'-'+_0x19d426+'/'+_0x2cce88)[_0xb084('0x19')](_0x5a5d11);}return null;};}function patchUpdates(_0x228ef1){return function(_0x2e8789){try{jsonpatch[_0xb084('0x1f')](_0x2e8789,_0x228ef1,!![]);}catch(_0x434690){return BPromise[_0xb084('0x20')](_0x434690);}return _0x2e8789[_0xb084('0x21')]();};}function saveUpdates(_0x517dc0,_0x5dfc7f){return function(_0x171dd5){if(_0x171dd5){return _0x171dd5[_0xb084('0x22')](_0x517dc0)[_0xb084('0x23')](function(_0x28d074){return _0x28d074;});}return null;};}function removeEntity(_0x5dced1,_0x4795d9){return function(_0x3ef50e){if(_0x3ef50e){return _0x3ef50e[_0xb084('0x24')]()['then'](function(){_0x5dced1[_0xb084('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4983,_0x22059f){return function(_0x5d9314){if(!_0x5d9314){_0x1f4983[_0xb084('0x25')](0x194);}return _0x5d9314;};}function handleError(_0x3d467e,_0x1ecb58){_0x1ecb58=_0x1ecb58||0x1f4;return function(_0x4ce54c){logger[_0xb084('0x26')](_0x4ce54c['stack']);if(_0x4ce54c[_0xb084('0x27')]){delete _0x4ce54c[_0xb084('0x27')];}_0x3d467e['status'](_0x1ecb58)[_0xb084('0x28')](_0x4ce54c);};}exports[_0xb084('0x29')]=function(_0x49cbd6,_0x4587e7){var _0x1a7726={},_0x57406f={},_0x1ad27b={'count':0x0,'rows':[]};var _0x2795cf=_['map'](db[_0xb084('0x2a')][_0xb084('0x2b')],function(_0x330a35){return{'name':_0x330a35[_0xb084('0x2c')],'type':_0x330a35[_0xb084('0x2d')]['key']};});_0x57406f[_0xb084('0x2e')]=_[_0xb084('0x2f')](_0x2795cf,_0xb084('0x27'));_0x57406f[_0xb084('0x30')]=_['keys'](_0x49cbd6[_0xb084('0x30')]);_0x57406f[_0xb084('0x31')]=_[_0xb084('0x32')](_0x57406f[_0xb084('0x2e')],_0x57406f[_0xb084('0x30')]);_0x1a7726['attributes']=_['intersection'](_0x57406f[_0xb084('0x2e')],qs['fields'](_0x49cbd6[_0xb084('0x30')]['fields']));_0x1a7726[_0xb084('0x33')]=_0x1a7726[_0xb084('0x33')][_0xb084('0x34')]?_0x1a7726[_0xb084('0x33')]:_0x57406f['model'];if(!_0x49cbd6[_0xb084('0x30')][_0xb084('0x35')](_0xb084('0x36'))){_0x1a7726[_0xb084('0x1c')]=qs[_0xb084('0x1c')](_0x49cbd6['query'][_0xb084('0x1c')]);_0x1a7726[_0xb084('0x1a')]=qs['offset'](_0x49cbd6['query'][_0xb084('0x1a')]);}_0x1a7726[_0xb084('0x37')]=qs[_0xb084('0x38')](_0x49cbd6[_0xb084('0x30')][_0xb084('0x38')]);_0x1a7726[_0xb084('0x39')]=qs[_0xb084('0x31')](_[_0xb084('0x3a')](_0x49cbd6['query'],_0x57406f[_0xb084('0x31')]),_0x2795cf);if(_0x49cbd6[_0xb084('0x30')]['filter']){_0x1a7726[_0xb084('0x39')]=_['merge'](_0x1a7726[_0xb084('0x39')],{'$or':_[_0xb084('0x2f')](_0x2795cf,function(_0xad9187){if(_0xad9187[_0xb084('0x2d')]!==_0xb084('0x3b')){var _0x2254a3={};_0x2254a3[_0xad9187[_0xb084('0x27')]]={'$like':'%'+_0x49cbd6[_0xb084('0x30')][_0xb084('0x3c')]+'%'};return _0x2254a3;}})});}_0x1a7726=_[_0xb084('0x3d')]({},_0x1a7726,_0x49cbd6[_0xb084('0x3e')]);var _0x77b2cc={'where':_0x1a7726[_0xb084('0x39')]};return db[_0xb084('0x2a')][_0xb084('0x1d')](_0x77b2cc)[_0xb084('0x23')](function(_0x584b34){_0x1ad27b['count']=_0x584b34;if(_0x49cbd6[_0xb084('0x30')][_0xb084('0x3f')]){_0x1a7726['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xb084('0x40')](_0x1a7726);})[_0xb084('0x23')](function(_0x1de365){_0x1ad27b['rows']=_0x1de365;return _0x1ad27b;})[_0xb084('0x23')](respondWithFilteredResult(_0x4587e7,_0x1a7726))[_0xb084('0x41')](handleError(_0x4587e7,null));};exports[_0xb084('0x42')]=function(_0x526c47,_0xc63ca9){var _0x13b059={'raw':!![],'where':{'id':_0x526c47[_0xb084('0x43')]['id']}},_0x3f38f9={};_0x3f38f9['model']=_[_0xb084('0x44')](db[_0xb084('0x2a')][_0xb084('0x2b')]);_0x3f38f9[_0xb084('0x30')]=_['keys'](_0x526c47[_0xb084('0x30')]);_0x3f38f9[_0xb084('0x31')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],_0x3f38f9[_0xb084('0x30')]);_0x13b059[_0xb084('0x33')]=_[_0xb084('0x32')](_0x3f38f9[_0xb084('0x2e')],qs[_0xb084('0x45')](_0x526c47[_0xb084('0x30')][_0xb084('0x45')]));_0x13b059[_0xb084('0x33')]=_0x13b059[_0xb084('0x33')][_0xb084('0x34')]?_0x13b059[_0xb084('0x33')]:_0x3f38f9['model'];if(_0x526c47[_0xb084('0x30')][_0xb084('0x3f')]){_0x13b059[_0xb084('0x46')]=[{'all':!![]}];}_0x13b059=_[_0xb084('0x3d')]({},_0x13b059,_0x526c47[_0xb084('0x3e')]);return db[_0xb084('0x2a')]['find'](_0x13b059)[_0xb084('0x23')](handleEntityNotFound(_0xc63ca9,null))[_0xb084('0x23')](respondWithResult(_0xc63ca9,null))[_0xb084('0x41')](handleError(_0xc63ca9,null));};exports[_0xb084('0x47')]=function(_0x1a95e4,_0x305f4a){return db[_0xb084('0x2a')]['create'](_0x1a95e4[_0xb084('0x48')],{})[_0xb084('0x23')](respondWithResult(_0x305f4a,0xc9))[_0xb084('0x41')](handleError(_0x305f4a,null));};exports[_0xb084('0x22')]=function(_0x32014e,_0xb1fdeb){if(_0x32014e[_0xb084('0x48')]['id']){delete _0x32014e[_0xb084('0x48')]['id'];}return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x32014e[_0xb084('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1fdeb,null))[_0xb084('0x23')](saveUpdates(_0x32014e[_0xb084('0x48')],null))[_0xb084('0x23')](respondWithResult(_0xb1fdeb,null))[_0xb084('0x41')](handleError(_0xb1fdeb,null));};exports[_0xb084('0x24')]=function(_0x4bad1b,_0x2d5ebd){return db['ChatQueueReport'][_0xb084('0x49')]({'where':{'id':_0x4bad1b[_0xb084('0x43')]['id']}})[_0xb084('0x23')](handleEntityNotFound(_0x2d5ebd,null))[_0xb084('0x23')](removeEntity(_0x2d5ebd,null))[_0xb084('0x41')](handleError(_0x2d5ebd,null));};exports[_0xb084('0x4a')]=function(_0x2d9239,_0x557649){return db['ChatQueueReport']['describe']()[_0xb084('0x23')](respondWithResult(_0x557649,null))[_0xb084('0x41')](handleError(_0x557649,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 7b06355..3240e58 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1e3fdd,_0x495be6){var _0x33512e=function(_0x3f445d){while(--_0x3f445d){_0x1e3fdd['push'](_0x1e3fdd['shift']());}};_0x33512e(++_0x495be6);}(_0x757a,0xde));var _0xa757=function(_0x45260d,_0x48ed1f){_0x45260d=_0x45260d-0x0;var _0x2f8c4d=_0x757a[_0x45260d];return _0x2f8c4d;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x421879,_0x4a00c2){var _0x3bec6f=function(_0x338e76){while(--_0x338e76){_0x421879['push'](_0x421879['shift']());}};_0x3bec6f(++_0x4a00c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xb7e7[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 86edd90..c2828a8 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 _0xb7aa=['result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x206341,_0x3dd809){var _0x554768=function(_0x41219a){while(--_0x41219a){_0x206341['push'](_0x206341['shift']());}};_0x554768(++_0x3dd809);}(_0xb7aa,0x11a));var _0xab7a=function(_0x3e0591,_0x358d1b){_0x3e0591=_0x3e0591-0x0;var _0x5e1293=_0xb7aa[_0x3e0591];return _0x5e1293;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require(_0xab7a('0x4'));var fs=require('fs');var Redis=require(_0xab7a('0x5'));var db=require(_0xab7a('0x6'))['db'];var utils=require(_0xab7a('0x7'));var logger=require(_0xab7a('0x8'))(_0xab7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xab7a('0xa'));var client=jayson[_0xab7a('0xb')][_0xab7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29ef15,_0x4e775f,_0x99ac82){return new BPromise(function(_0x1e3b23,_0x520d21){return client[_0xab7a('0xd')](_0x29ef15,_0x99ac82)[_0xab7a('0xe')](function(_0x40e6e6){logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));logger[_0xab7a('0x12')](_0xab7a('0x13'),_0x4e775f,_0xab7a('0x11'),JSON[_0xab7a('0x14')](_0x40e6e6));if(_0x40e6e6['error']){if(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x16')]===0x1f4){logger[_0xab7a('0x15')](_0xab7a('0x10'),_0x4e775f,_0x40e6e6['error'][_0xab7a('0x17')]);return _0x520d21(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);}logger[_0xab7a('0x15')]('ChatQueueReport,\x20%s,\x20%s',_0x4e775f,_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);return _0x1e3b23(_0x40e6e6['error'][_0xab7a('0x17')]);}else{logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));_0x1e3b23(_0x40e6e6[_0xab7a('0x18')]['message']);}})[_0xab7a('0x19')](function(_0x19eeb7){logger['error'](_0xab7a('0x10'),_0x4e775f,_0x19eeb7);_0x520d21(_0x19eeb7);});});}exports[_0xab7a('0x1a')]=function(_0x187f51){var _0xc3bb41=this;return new Promise(function(_0x10b630,_0x14b2b5){return db[_0xab7a('0x1b')]['create'](_0x187f51[_0xab7a('0x1c')],{'raw':_0x187f51[_0xab7a('0x1d')]?_0x187f51[_0xab7a('0x1d')][_0xab7a('0x1e')]===undefined?!![]:![]:!![]})[_0xab7a('0xe')](function(_0x37e3bc){logger[_0xab7a('0xf')](_0xab7a('0x1a'),_0x187f51);logger[_0xab7a('0x12')](_0xab7a('0x1a'),_0x187f51,JSON[_0xab7a('0x14')](_0x37e3bc));_0x10b630(_0x37e3bc);})['catch'](function(_0x4b65f0){logger['error'](_0xab7a('0x1a'),_0x4b65f0[_0xab7a('0x17')],_0x187f51);_0x14b2b5(_0xc3bb41[_0xab7a('0x15')](0x1f4,_0x4b65f0[_0xab7a('0x17')]));});});};exports[_0xab7a('0x1f')]=function(_0x8c1e1f){var _0x3324f2=this;return new Promise(function(_0x533680,_0x4d2ad4){return db[_0xab7a('0x1b')]['update'](_0x8c1e1f['body'],{'raw':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f['options'][_0xab7a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f[_0xab7a('0x1d')][_0xab7a('0x20')]||null:null,'attributes':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f['options'][_0xab7a('0x21')]||null:null,'limit':_0x8c1e1f[_0xab7a('0x1d')]?_0x8c1e1f[_0xab7a('0x1d')]['limit']||null:null})[_0xab7a('0xe')](function(_0x311dfa){logger[_0xab7a('0xf')]('UpdateChatQueueReport',_0x8c1e1f);logger['debug'](_0xab7a('0x1f'),_0x8c1e1f,JSON['stringify'](_0x311dfa));_0x533680(_0x311dfa);})[_0xab7a('0x19')](function(_0x3dfbaf){logger['error'](_0xab7a('0x1f'),_0x3dfbaf[_0xab7a('0x17')],_0x8c1e1f);_0x4d2ad4(_0x3324f2[_0xab7a('0x15')](0x1f4,_0x3dfbaf[_0xab7a('0x17')]));});});}; \ No newline at end of file +var _0xc67c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x426854,_0xb8fb57){var _0x1f0aea=function(_0x124dba){while(--_0x124dba){_0x426854['push'](_0x426854['shift']());}};_0x1f0aea(++_0xb8fb57);}(_0xc67c,0x17b));var _0xcc67=function(_0x7b60c7,_0x50a43c){_0x7b60c7=_0x7b60c7-0x0;var _0x533781=_0xc67c[_0x7b60c7];return _0x533781;};'use strict';var _=require(_0xcc67('0x0'));var util=require(_0xcc67('0x1'));var moment=require(_0xcc67('0x2'));var BPromise=require(_0xcc67('0x3'));var rs=require(_0xcc67('0x4'));var fs=require('fs');var Redis=require(_0xcc67('0x5'));var db=require(_0xcc67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc67('0x7'))(_0xcc67('0x8'));var config=require(_0xcc67('0x9'));var jayson=require(_0xcc67('0xa'));var client=jayson[_0xcc67('0xb')][_0xcc67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xac838d,_0x2cb2da,_0x46b9a5){return new BPromise(function(_0x5d0c1d,_0x92d497){return client[_0xcc67('0xd')](_0xac838d,_0x46b9a5)['then'](function(_0x18282d){logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));logger[_0xcc67('0x11')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2cb2da,_0xcc67('0x10'),JSON[_0xcc67('0x12')](_0x18282d));if(_0x18282d[_0xcc67('0x13')]){if(_0x18282d[_0xcc67('0x13')]['code']===0x1f4){logger['error'](_0xcc67('0xf'),_0x2cb2da,_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);return _0x92d497(_0x18282d['error'][_0xcc67('0x14')]);}logger[_0xcc67('0x13')](_0xcc67('0xf'),_0x2cb2da,_0x18282d['error'][_0xcc67('0x14')]);return _0x5d0c1d(_0x18282d[_0xcc67('0x13')][_0xcc67('0x14')]);}else{logger[_0xcc67('0xe')](_0xcc67('0xf'),_0x2cb2da,_0xcc67('0x10'));_0x5d0c1d(_0x18282d[_0xcc67('0x15')][_0xcc67('0x14')]);}})[_0xcc67('0x16')](function(_0x4c09dc){logger[_0xcc67('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2cb2da,_0x4c09dc);_0x92d497(_0x4c09dc);});});}exports[_0xcc67('0x17')]=function(_0x57c1d6){var _0x153737=this;return new Promise(function(_0x26453c,_0x423bd8){return db['ChatQueueReport'][_0xcc67('0x18')](_0x57c1d6[_0xcc67('0x19')],{'raw':_0x57c1d6[_0xcc67('0x1a')]?_0x57c1d6[_0xcc67('0x1a')][_0xcc67('0x1b')]===undefined?!![]:![]:!![]})[_0xcc67('0x1c')](function(_0x617e7b){logger[_0xcc67('0xe')](_0xcc67('0x17'),_0x57c1d6);logger[_0xcc67('0x11')]('CreateChatQueueReport',_0x57c1d6,JSON[_0xcc67('0x12')](_0x617e7b));_0x26453c(_0x617e7b);})['catch'](function(_0x12b59a){logger[_0xcc67('0x13')]('CreateChatQueueReport',_0x12b59a[_0xcc67('0x14')],_0x57c1d6);_0x423bd8(_0x153737[_0xcc67('0x13')](0x1f4,_0x12b59a[_0xcc67('0x14')]));});});};exports[_0xcc67('0x1d')]=function(_0x1dfe93){var _0x91da96=this;return new Promise(function(_0x23bea2,_0x4c6b30){return db[_0xcc67('0x1e')][_0xcc67('0x1f')](_0x1dfe93[_0xcc67('0x19')],{'raw':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x20')]||null:null,'attributes':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93[_0xcc67('0x1a')][_0xcc67('0x21')]||null:null,'limit':_0x1dfe93[_0xcc67('0x1a')]?_0x1dfe93['options'][_0xcc67('0x22')]||null:null})[_0xcc67('0x1c')](function(_0x274b84){logger[_0xcc67('0xe')](_0xcc67('0x1d'),_0x1dfe93);logger['debug'](_0xcc67('0x1d'),_0x1dfe93,JSON[_0xcc67('0x12')](_0x274b84));_0x23bea2(_0x274b84);})['catch'](function(_0x24dbde){logger[_0xcc67('0x13')](_0xcc67('0x1d'),_0x24dbde[_0xcc67('0x14')],_0x1dfe93);_0x4c6b30(_0x91da96[_0xcc67('0x13')](0x1f4,_0x24dbde[_0xcc67('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index cbd6abe..a751dd1 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 _0xa47e=['express','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','/describe','isAuthenticated','get','/:id','show','post','create','put','update','delete','multer','util','path'];(function(_0x4ed2a8,_0xdb07fd){var _0x2a50c2=function(_0x200ad2){while(--_0x200ad2){_0x4ed2a8['push'](_0x4ed2a8['shift']());}};_0x2a50c2(++_0xdb07fd);}(_0xa47e,0x85));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var path=require(_0xea47('0x2'));var timeout=require('connect-timeout');var express=require(_0xea47('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xea47('0x4'));var interaction=require(_0xea47('0x5'));var config=require('../../config/environment');var controller=require(_0xea47('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xea47('0x7'),auth[_0xea47('0x8')](),controller['describe']);router[_0xea47('0x9')](_0xea47('0xa'),auth[_0xea47('0x8')](),controller[_0xea47('0xb')]);router[_0xea47('0xc')]('/',auth[_0xea47('0x8')](),controller[_0xea47('0xd')]);router[_0xea47('0xe')](_0xea47('0xa'),auth[_0xea47('0x8')](),controller[_0xea47('0xf')]);router[_0xea47('0x10')]('/:id',auth[_0xea47('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0629=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x0629,0xee));var _0x9062=function(_0x5e70a6,_0x31169f){_0x5e70a6=_0x5e70a6-0x0;var _0xd1a237=_0x0629[_0x5e70a6];return _0xd1a237;};'use strict';var multer=require(_0x9062('0x0'));var util=require(_0x9062('0x1'));var path=require(_0x9062('0x2'));var timeout=require(_0x9062('0x3'));var express=require(_0x9062('0x4'));var router=express[_0x9062('0x5')]();var fs_extra=require(_0x9062('0x6'));var auth=require(_0x9062('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9062('0x8'));var controller=require(_0x9062('0x9'));router[_0x9062('0xa')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0xc')]);router[_0x9062('0xa')](_0x9062('0xd'),auth[_0x9062('0xb')](),controller[_0x9062('0xe')]);router[_0x9062('0xa')]('/:id',auth[_0x9062('0xb')](),controller['show']);router[_0x9062('0xf')]('/',auth[_0x9062('0xb')](),controller[_0x9062('0x10')]);router[_0x9062('0x11')](_0x9062('0x12'),auth[_0x9062('0xb')](),controller[_0x9062('0x13')]);router[_0x9062('0x14')]('/:id',auth[_0x9062('0xb')](),controller[_0x9062('0x15')]);module[_0x9062('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 557b61e..894e684 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x54092b,_0x5b1a5e){_0x54092b=_0x54092b-0x0;var _0x31f926=_0x9bde[_0x54092b];return _0x31f926;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x385f81,_0x394333){var _0x390b9e=function(_0x5541b7){while(--_0x5541b7){_0x385f81['push'](_0x385f81['shift']());}};_0x390b9e(++_0x394333);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1e24e3b..5227b9d 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 _0x4936=['apply','reject','save','then','destroy','end','error','name','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','length','create','body','find','params','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','Content-Range'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x4936,0x14d));var _0x6493=function(_0x5ae663,_0x42522a){_0x5ae663=_0x5ae663-0x0;var _0x366149=_0x4936[_0x5ae663];return _0x366149;};'use strict';var emlformat=require(_0x6493('0x0'));var rimraf=require(_0x6493('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6493('0x2'));var moment=require(_0x6493('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6493('0x4'));var util=require('util');var path=require(_0x6493('0x5'));var sox=require(_0x6493('0x6'));var csv=require('to-csv');var ejs=require(_0x6493('0x7'));var fs=require('fs');var fs_extra=require(_0x6493('0x8'));var _=require(_0x6493('0x9'));var squel=require(_0x6493('0xa'));var crypto=require(_0x6493('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6493('0xc'));var toCsv=require(_0x6493('0xd'));var querystring=require(_0x6493('0xe'));var Papa=require(_0x6493('0xf'));var Redis=require(_0x6493('0x10'));var authService=require(_0x6493('0x11'));var qs=require(_0x6493('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6493('0x13'))(_0x6493('0x14'));var utils=require('../../config/utils');var config=require(_0x6493('0x15'));var licenseUtil=require(_0x6493('0x16'));var db=require(_0x6493('0x17'))['db'];function respondWithStatusCode(_0x3c5417,_0x334272){_0x334272=_0x334272||0xcc;return function(_0x227526){if(_0x227526){return _0x3c5417[_0x6493('0x18')](_0x334272);}return _0x3c5417['status'](_0x334272)['end']();};}function respondWithResult(_0x297d48,_0x75dba4){_0x75dba4=_0x75dba4||0xc8;return function(_0x894587){if(_0x894587){return _0x297d48[_0x6493('0x19')](_0x75dba4)[_0x6493('0x1a')](_0x894587);}};}function respondWithFilteredResult(_0x1a077e,_0x35c0c8){return function(_0x1a21f2){if(_0x1a21f2){var _0xaaa388=typeof _0x35c0c8['offset']==='undefined'&&typeof _0x35c0c8[_0x6493('0x1b')]===_0x6493('0x1c');var _0x1223ac=_0x1a21f2['count'];var _0xa38f4f=_0xaaa388?0x0:_0x35c0c8[_0x6493('0x1d')];var _0x50bbca=_0xaaa388?_0x1a21f2[_0x6493('0x1e')]:_0x35c0c8[_0x6493('0x1d')]+_0x35c0c8[_0x6493('0x1b')];var _0x291f88;if(_0x50bbca>=_0x1223ac){_0x50bbca=_0x1223ac;_0x291f88=0xc8;}else{_0x291f88=0xce;}_0x1a077e[_0x6493('0x19')](_0x291f88);return _0x1a077e['set'](_0x6493('0x1f'),_0xa38f4f+'-'+_0x50bbca+'/'+_0x1223ac)[_0x6493('0x1a')](_0x1a21f2);}return null;};}function patchUpdates(_0x55ff6f){return function(_0x5ef8bc){try{jsonpatch[_0x6493('0x20')](_0x5ef8bc,_0x55ff6f,!![]);}catch(_0x4990eb){return BPromise[_0x6493('0x21')](_0x4990eb);}return _0x5ef8bc[_0x6493('0x22')]();};}function saveUpdates(_0x3ce83a,_0x3974d0){return function(_0x585a02){if(_0x585a02){return _0x585a02['update'](_0x3ce83a)[_0x6493('0x23')](function(_0x3fdaaa){return _0x3fdaaa;});}return null;};}function removeEntity(_0x1487c1,_0xef93fc){return function(_0x546a38){if(_0x546a38){return _0x546a38[_0x6493('0x24')]()[_0x6493('0x23')](function(){_0x1487c1[_0x6493('0x19')](0xcc)[_0x6493('0x25')]();});}};}function handleEntityNotFound(_0x312129,_0x5a8a90){return function(_0x1cdee2){if(!_0x1cdee2){_0x312129[_0x6493('0x18')](0x194);}return _0x1cdee2;};}function handleError(_0x188433,_0x18820e){_0x18820e=_0x18820e||0x1f4;return function(_0x50af03){logger[_0x6493('0x26')](_0x50af03['stack']);if(_0x50af03['name']){delete _0x50af03[_0x6493('0x27')];}_0x188433[_0x6493('0x19')](_0x18820e)['send'](_0x50af03);};}exports[_0x6493('0x28')]=function(_0x44df9a,_0x43a3e0){var _0x57f81d={},_0x5936c2={},_0x5b0968={'count':0x0,'rows':[]};var _0x2ff711=_['map'](db[_0x6493('0x29')][_0x6493('0x2a')],function(_0x468368){return{'name':_0x468368[_0x6493('0x2b')],'type':_0x468368[_0x6493('0x2c')][_0x6493('0x2d')]};});_0x5936c2[_0x6493('0x2e')]=_[_0x6493('0x2f')](_0x2ff711,_0x6493('0x27'));_0x5936c2[_0x6493('0x30')]=_[_0x6493('0x31')](_0x44df9a[_0x6493('0x30')]);_0x5936c2[_0x6493('0x32')]=_[_0x6493('0x33')](_0x5936c2[_0x6493('0x2e')],_0x5936c2[_0x6493('0x30')]);_0x57f81d[_0x6493('0x34')]=_[_0x6493('0x33')](_0x5936c2[_0x6493('0x2e')],qs[_0x6493('0x35')](_0x44df9a[_0x6493('0x30')][_0x6493('0x35')]));_0x57f81d['attributes']=_0x57f81d[_0x6493('0x34')]['length']?_0x57f81d[_0x6493('0x34')]:_0x5936c2[_0x6493('0x2e')];if(!_0x44df9a[_0x6493('0x30')][_0x6493('0x36')](_0x6493('0x37'))){_0x57f81d[_0x6493('0x1b')]=qs[_0x6493('0x1b')](_0x44df9a[_0x6493('0x30')][_0x6493('0x1b')]);_0x57f81d[_0x6493('0x1d')]=qs[_0x6493('0x1d')](_0x44df9a['query'][_0x6493('0x1d')]);}_0x57f81d[_0x6493('0x38')]=qs[_0x6493('0x39')](_0x44df9a[_0x6493('0x30')]['sort']);_0x57f81d['where']=qs[_0x6493('0x32')](_[_0x6493('0x3a')](_0x44df9a['query'],_0x5936c2[_0x6493('0x32')]),_0x2ff711);if(_0x44df9a[_0x6493('0x30')][_0x6493('0x3b')]){_0x57f81d[_0x6493('0x3c')]=_[_0x6493('0x3d')](_0x57f81d[_0x6493('0x3c')],{'$or':_[_0x6493('0x2f')](_0x2ff711,function(_0x24cdba){if(_0x24cdba[_0x6493('0x2c')]!=='VIRTUAL'){var _0x3158b5={};_0x3158b5[_0x24cdba[_0x6493('0x27')]]={'$like':'%'+_0x44df9a[_0x6493('0x30')][_0x6493('0x3b')]+'%'};return _0x3158b5;}})});}_0x57f81d=_[_0x6493('0x3d')]({},_0x57f81d,_0x44df9a[_0x6493('0x3e')]);var _0xdf1465={'where':_0x57f81d[_0x6493('0x3c')]};return db[_0x6493('0x29')]['count'](_0xdf1465)['then'](function(_0x3cddd8){_0x5b0968[_0x6493('0x1e')]=_0x3cddd8;if(_0x44df9a['query'][_0x6493('0x3f')]){_0x57f81d['include']=[{'all':!![]}];}return db[_0x6493('0x29')]['findAll'](_0x57f81d);})[_0x6493('0x23')](function(_0x158678){_0x5b0968[_0x6493('0x40')]=_0x158678;return _0x5b0968;})['then'](respondWithFilteredResult(_0x43a3e0,_0x57f81d))[_0x6493('0x41')](handleError(_0x43a3e0,null));};exports[_0x6493('0x42')]=function(_0x15bc29,_0x24f0d6){var _0x183b62={'raw':!![],'where':{'id':_0x15bc29['params']['id']}},_0x16e6f6={};_0x16e6f6[_0x6493('0x2e')]=_[_0x6493('0x31')](db[_0x6493('0x29')][_0x6493('0x2a')]);_0x16e6f6['query']=_[_0x6493('0x31')](_0x15bc29[_0x6493('0x30')]);_0x16e6f6['filters']=_['intersection'](_0x16e6f6[_0x6493('0x2e')],_0x16e6f6[_0x6493('0x30')]);_0x183b62['attributes']=_[_0x6493('0x33')](_0x16e6f6[_0x6493('0x2e')],qs['fields'](_0x15bc29[_0x6493('0x30')]['fields']));_0x183b62[_0x6493('0x34')]=_0x183b62[_0x6493('0x34')][_0x6493('0x43')]?_0x183b62[_0x6493('0x34')]:_0x16e6f6[_0x6493('0x2e')];if(_0x15bc29[_0x6493('0x30')]['includeAll']){_0x183b62['include']=[{'all':!![]}];}_0x183b62=_[_0x6493('0x3d')]({},_0x183b62,_0x15bc29['options']);return db['ChatTransferReport']['find'](_0x183b62)[_0x6493('0x23')](handleEntityNotFound(_0x24f0d6,null))[_0x6493('0x23')](respondWithResult(_0x24f0d6,null))[_0x6493('0x41')](handleError(_0x24f0d6,null));};exports[_0x6493('0x44')]=function(_0x275874,_0x368e05){return db[_0x6493('0x29')][_0x6493('0x44')](_0x275874[_0x6493('0x45')],{})[_0x6493('0x23')](respondWithResult(_0x368e05,0xc9))[_0x6493('0x41')](handleError(_0x368e05,null));};exports['update']=function(_0x3dd7ce,_0x52b302){if(_0x3dd7ce[_0x6493('0x45')]['id']){delete _0x3dd7ce[_0x6493('0x45')]['id'];}return db[_0x6493('0x29')][_0x6493('0x46')]({'where':{'id':_0x3dd7ce[_0x6493('0x47')]['id']}})['then'](handleEntityNotFound(_0x52b302,null))[_0x6493('0x23')](saveUpdates(_0x3dd7ce['body'],null))[_0x6493('0x23')](respondWithResult(_0x52b302,null))[_0x6493('0x41')](handleError(_0x52b302,null));};exports[_0x6493('0x24')]=function(_0x422d59,_0x263abf){return db[_0x6493('0x29')][_0x6493('0x46')]({'where':{'id':_0x422d59['params']['id']}})['then'](handleEntityNotFound(_0x263abf,null))[_0x6493('0x23')](removeEntity(_0x263abf,null))[_0x6493('0x41')](handleError(_0x263abf,null));};exports[_0x6493('0x48')]=function(_0x4e7cb5,_0x3ea199){return db['ChatTransferReport']['describe']()[_0x6493('0x23')](respondWithResult(_0x3ea199,null))[_0x6493('0x41')](handleError(_0x3ea199,null));}; \ No newline at end of file +var _0x4e06=['offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','params','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','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'];(function(_0x3902b8,_0x4b013a){var _0x345127=function(_0x333616){while(--_0x333616){_0x3902b8['push'](_0x3902b8['shift']());}};_0x345127(++_0x4b013a);}(_0x4e06,0x76));var _0x64e0=function(_0x278f0e,_0x107e6e){_0x278f0e=_0x278f0e-0x0;var _0x5b8c27=_0x4e06[_0x278f0e];return _0x5b8c27;};'use strict';var emlformat=require(_0x64e0('0x0'));var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require('request-promise');var moment=require(_0x64e0('0x4'));var BPromise=require(_0x64e0('0x5'));var Mustache=require(_0x64e0('0x6'));var util=require(_0x64e0('0x7'));var path=require(_0x64e0('0x8'));var sox=require(_0x64e0('0x9'));var csv=require(_0x64e0('0xa'));var ejs=require(_0x64e0('0xb'));var fs=require('fs');var fs_extra=require(_0x64e0('0xc'));var _=require(_0x64e0('0xd'));var squel=require('squel');var crypto=require(_0x64e0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64e0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x64e0('0x10'));var authService=require(_0x64e0('0x11'));var qs=require(_0x64e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64e0('0x13'));var logger=require(_0x64e0('0x14'))(_0x64e0('0x15'));var utils=require(_0x64e0('0x16'));var config=require(_0x64e0('0x17'));var licenseUtil=require(_0x64e0('0x18'));var db=require(_0x64e0('0x19'))['db'];function respondWithStatusCode(_0x1a943b,_0x417c95){_0x417c95=_0x417c95||0xcc;return function(_0x25bc9d){if(_0x25bc9d){return _0x1a943b[_0x64e0('0x1a')](_0x417c95);}return _0x1a943b[_0x64e0('0x1b')](_0x417c95)[_0x64e0('0x1c')]();};}function respondWithResult(_0x3d52bb,_0x698c25){_0x698c25=_0x698c25||0xc8;return function(_0x305f79){if(_0x305f79){return _0x3d52bb[_0x64e0('0x1b')](_0x698c25)[_0x64e0('0x1d')](_0x305f79);}};}function respondWithFilteredResult(_0x18c03d,_0x162dcf){return function(_0x1c2b95){if(_0x1c2b95){var _0x105908=typeof _0x162dcf[_0x64e0('0x1e')]===_0x64e0('0x1f')&&typeof _0x162dcf[_0x64e0('0x20')]===_0x64e0('0x1f');var _0x4c635c=_0x1c2b95['count'];var _0x4d3418=_0x105908?0x0:_0x162dcf[_0x64e0('0x1e')];var _0x30991f=_0x105908?_0x1c2b95[_0x64e0('0x21')]:_0x162dcf['offset']+_0x162dcf[_0x64e0('0x20')];var _0x35bdce;if(_0x30991f>=_0x4c635c){_0x30991f=_0x4c635c;_0x35bdce=0xc8;}else{_0x35bdce=0xce;}_0x18c03d['status'](_0x35bdce);return _0x18c03d[_0x64e0('0x22')](_0x64e0('0x23'),_0x4d3418+'-'+_0x30991f+'/'+_0x4c635c)['json'](_0x1c2b95);}return null;};}function patchUpdates(_0x218979){return function(_0x52a546){try{jsonpatch['apply'](_0x52a546,_0x218979,!![]);}catch(_0x54eb5b){return BPromise[_0x64e0('0x24')](_0x54eb5b);}return _0x52a546[_0x64e0('0x25')]();};}function saveUpdates(_0x4456d4,_0x908d24){return function(_0x587d42){if(_0x587d42){return _0x587d42['update'](_0x4456d4)[_0x64e0('0x26')](function(_0x3dac28){return _0x3dac28;});}return null;};}function removeEntity(_0xd71736,_0x228977){return function(_0x1ea4c6){if(_0x1ea4c6){return _0x1ea4c6[_0x64e0('0x27')]()[_0x64e0('0x26')](function(){_0xd71736['status'](0xcc)[_0x64e0('0x1c')]();});}};}function handleEntityNotFound(_0x5c0ecc,_0x4ba4bf){return function(_0x59981a){if(!_0x59981a){_0x5c0ecc[_0x64e0('0x1a')](0x194);}return _0x59981a;};}function handleError(_0x6f5c39,_0x4f7b0a){_0x4f7b0a=_0x4f7b0a||0x1f4;return function(_0x2e8ab4){logger[_0x64e0('0x28')](_0x2e8ab4['stack']);if(_0x2e8ab4[_0x64e0('0x29')]){delete _0x2e8ab4[_0x64e0('0x29')];}_0x6f5c39[_0x64e0('0x1b')](_0x4f7b0a)[_0x64e0('0x2a')](_0x2e8ab4);};}exports[_0x64e0('0x2b')]=function(_0x222a62,_0x1d2486){var _0x2e1406={},_0x5a06f5={},_0xcecffb={'count':0x0,'rows':[]};var _0x591459=_[_0x64e0('0x2c')](db[_0x64e0('0x2d')][_0x64e0('0x2e')],function(_0x24f30c){return{'name':_0x24f30c[_0x64e0('0x2f')],'type':_0x24f30c[_0x64e0('0x30')]['key']};});_0x5a06f5[_0x64e0('0x31')]=_[_0x64e0('0x2c')](_0x591459,_0x64e0('0x29'));_0x5a06f5[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x222a62[_0x64e0('0x32')]);_0x5a06f5['filters']=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],_0x5a06f5[_0x64e0('0x32')]);_0x2e1406[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x5a06f5[_0x64e0('0x31')],qs[_0x64e0('0x36')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x36')]));_0x2e1406[_0x64e0('0x35')]=_0x2e1406[_0x64e0('0x35')][_0x64e0('0x37')]?_0x2e1406[_0x64e0('0x35')]:_0x5a06f5[_0x64e0('0x31')];if(!_0x222a62[_0x64e0('0x32')]['hasOwnProperty']('nolimit')){_0x2e1406[_0x64e0('0x20')]=qs['limit'](_0x222a62[_0x64e0('0x32')][_0x64e0('0x20')]);_0x2e1406[_0x64e0('0x1e')]=qs[_0x64e0('0x1e')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x1e')]);}_0x2e1406[_0x64e0('0x38')]=qs[_0x64e0('0x39')](_0x222a62[_0x64e0('0x32')][_0x64e0('0x39')]);_0x2e1406[_0x64e0('0x3a')]=qs[_0x64e0('0x3b')](_[_0x64e0('0x3c')](_0x222a62[_0x64e0('0x32')],_0x5a06f5['filters']),_0x591459);if(_0x222a62[_0x64e0('0x32')]['filter']){_0x2e1406['where']=_[_0x64e0('0x3d')](_0x2e1406['where'],{'$or':_[_0x64e0('0x2c')](_0x591459,function(_0x353d89){if(_0x353d89[_0x64e0('0x30')]!==_0x64e0('0x3e')){var _0x3d000a={};_0x3d000a[_0x353d89[_0x64e0('0x29')]]={'$like':'%'+_0x222a62[_0x64e0('0x32')][_0x64e0('0x3f')]+'%'};return _0x3d000a;}})});}_0x2e1406=_[_0x64e0('0x3d')]({},_0x2e1406,_0x222a62[_0x64e0('0x40')]);var _0x7684ae={'where':_0x2e1406[_0x64e0('0x3a')]};return db[_0x64e0('0x2d')][_0x64e0('0x21')](_0x7684ae)[_0x64e0('0x26')](function(_0x5da451){_0xcecffb[_0x64e0('0x21')]=_0x5da451;if(_0x222a62[_0x64e0('0x32')][_0x64e0('0x41')]){_0x2e1406[_0x64e0('0x42')]=[{'all':!![]}];}return db[_0x64e0('0x2d')]['findAll'](_0x2e1406);})['then'](function(_0x30b56d){_0xcecffb['rows']=_0x30b56d;return _0xcecffb;})[_0x64e0('0x26')](respondWithFilteredResult(_0x1d2486,_0x2e1406))['catch'](handleError(_0x1d2486,null));};exports['show']=function(_0x170d99,_0x155c7a){var _0x1a2f89={'raw':!![],'where':{'id':_0x170d99[_0x64e0('0x43')]['id']}},_0x52600d={};_0x52600d[_0x64e0('0x31')]=_['keys'](db[_0x64e0('0x2d')][_0x64e0('0x2e')]);_0x52600d[_0x64e0('0x32')]=_[_0x64e0('0x33')](_0x170d99[_0x64e0('0x32')]);_0x52600d['filters']=_[_0x64e0('0x34')](_0x52600d[_0x64e0('0x31')],_0x52600d['query']);_0x1a2f89[_0x64e0('0x35')]=_[_0x64e0('0x34')](_0x52600d['model'],qs[_0x64e0('0x36')](_0x170d99['query']['fields']));_0x1a2f89[_0x64e0('0x35')]=_0x1a2f89[_0x64e0('0x35')]['length']?_0x1a2f89['attributes']:_0x52600d[_0x64e0('0x31')];if(_0x170d99[_0x64e0('0x32')]['includeAll']){_0x1a2f89[_0x64e0('0x42')]=[{'all':!![]}];}_0x1a2f89=_[_0x64e0('0x3d')]({},_0x1a2f89,_0x170d99[_0x64e0('0x40')]);return db[_0x64e0('0x2d')]['find'](_0x1a2f89)[_0x64e0('0x26')](handleEntityNotFound(_0x155c7a,null))[_0x64e0('0x26')](respondWithResult(_0x155c7a,null))[_0x64e0('0x44')](handleError(_0x155c7a,null));};exports['create']=function(_0x2f3a04,_0x228197){return db[_0x64e0('0x2d')][_0x64e0('0x45')](_0x2f3a04[_0x64e0('0x46')],{})['then'](respondWithResult(_0x228197,0xc9))[_0x64e0('0x44')](handleError(_0x228197,null));};exports[_0x64e0('0x47')]=function(_0x1e4cd6,_0x5dbd6f){if(_0x1e4cd6[_0x64e0('0x46')]['id']){delete _0x1e4cd6[_0x64e0('0x46')]['id'];}return db['ChatTransferReport'][_0x64e0('0x48')]({'where':{'id':_0x1e4cd6[_0x64e0('0x43')]['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x5dbd6f,null))[_0x64e0('0x26')](saveUpdates(_0x1e4cd6[_0x64e0('0x46')],null))[_0x64e0('0x26')](respondWithResult(_0x5dbd6f,null))[_0x64e0('0x44')](handleError(_0x5dbd6f,null));};exports[_0x64e0('0x27')]=function(_0x473b70,_0x10fa8a){return db[_0x64e0('0x2d')][_0x64e0('0x48')]({'where':{'id':_0x473b70['params']['id']}})[_0x64e0('0x26')](handleEntityNotFound(_0x10fa8a,null))[_0x64e0('0x26')](removeEntity(_0x10fa8a,null))[_0x64e0('0x44')](handleError(_0x10fa8a,null));};exports[_0x64e0('0x49')]=function(_0x3447f1,_0x2cf2c5){return db[_0x64e0('0x2d')]['describe']()[_0x64e0('0x26')](respondWithResult(_0x2cf2c5,null))[_0x64e0('0x44')](handleError(_0x2cf2c5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 603d074..f9e5f40 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 _0x2689=['request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2f7ba5,_0x10df8d){var _0x2d0d5a=function(_0x293497){while(--_0x293497){_0x2f7ba5['push'](_0x2f7ba5['shift']());}};_0x2d0d5a(++_0x10df8d);}(_0x2689,0xb1));var _0x9268=function(_0x1a2643,_0x42939c){_0x1a2643=_0x1a2643-0x0;var _0x4e5c3c=_0x2689[_0x1a2643];return _0x4e5c3c;};'use strict';var _=require(_0x9268('0x0'));var util=require(_0x9268('0x1'));var logger=require(_0x9268('0x2'))(_0x9268('0x3'));var moment=require('moment');var BPromise=require(_0x9268('0x4'));var rp=require(_0x9268('0x5'));var fs=require('fs');var path=require(_0x9268('0x6'));var rimraf=require('rimraf');var config=require(_0x9268('0x7'));var attributes=require(_0x9268('0x8'));module[_0x9268('0x9')]=function(_0x5f4dec,_0x5ecad5){return _0x5f4dec['define'](_0x9268('0xa'),attributes,{'tableName':_0x9268('0xb'),'paranoid':![],'indexes':[{'name':_0x9268('0xc'),'fields':[_0x9268('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe937=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38be62,_0xc0275f){var _0x2da447=function(_0x2f06f9){while(--_0x2f06f9){_0x38be62['push'](_0x38be62['shift']());}};_0x2da447(++_0xc0275f);}(_0xe937,0x15a));var _0x7e93=function(_0x51a4b1,_0x374955){_0x51a4b1=_0x51a4b1-0x0;var _0x305c71=_0xe937[_0x51a4b1];return _0x305c71;};'use strict';var _=require('lodash');var util=require(_0x7e93('0x0'));var logger=require(_0x7e93('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7e93('0x2'));var rp=require(_0x7e93('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e93('0x4'));var config=require(_0x7e93('0x5'));var attributes=require(_0x7e93('0x6'));module[_0x7e93('0x7')]=function(_0x1afaff,_0x34e382){return _0x1afaff[_0x7e93('0x8')]('ChatTransferReport',attributes,{'tableName':_0x7e93('0x9'),'paranoid':![],'indexes':[{'name':_0x7e93('0xa'),'fields':[_0x7e93('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 99c3ede..b8ff214 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 _0xc61c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x344bd7,_0x38a213){var _0x2a2b98=function(_0x1624be){while(--_0x1624be){_0x344bd7['push'](_0x344bd7['shift']());}};_0x2a2b98(++_0x38a213);}(_0xc61c,0x73));var _0xcc61=function(_0x50004c,_0x55215d){_0x50004c=_0x50004c-0x0;var _0x3c8b0=_0xc61c[_0x50004c];return _0x3c8b0;};'use strict';var _=require(_0xcc61('0x0'));var util=require(_0xcc61('0x1'));var moment=require(_0xcc61('0x2'));var BPromise=require(_0xcc61('0x3'));var rs=require(_0xcc61('0x4'));var fs=require('fs');var Redis=require(_0xcc61('0x5'));var db=require(_0xcc61('0x6'))['db'];var utils=require(_0xcc61('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc61('0x8'));var jayson=require(_0xcc61('0x9'));var client=jayson[_0xcc61('0xa')][_0xcc61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29bc4f,_0x1af7f3,_0x2a5073){return new BPromise(function(_0x43649c,_0x5b69fd){return client[_0xcc61('0xc')](_0x29bc4f,_0x2a5073)['then'](function(_0xfd1517){logger[_0xcc61('0xd')](_0xcc61('0xe'),_0x1af7f3,'request\x20sent');logger['debug'](_0xcc61('0xf'),_0x1af7f3,_0xcc61('0x10'),JSON[_0xcc61('0x11')](_0xfd1517));if(_0xfd1517['error']){if(_0xfd1517[_0xcc61('0x12')][_0xcc61('0x13')]===0x1f4){logger[_0xcc61('0x12')](_0xcc61('0xe'),_0x1af7f3,_0xfd1517['error'][_0xcc61('0x14')]);return _0x5b69fd(_0xfd1517[_0xcc61('0x12')]['message']);}logger[_0xcc61('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0xfd1517['error'][_0xcc61('0x14')]);return _0x43649c(_0xfd1517[_0xcc61('0x12')]['message']);}else{logger[_0xcc61('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0xcc61('0x10'));_0x43649c(_0xfd1517[_0xcc61('0x15')][_0xcc61('0x14')]);}})[_0xcc61('0x16')](function(_0x5e6926){logger[_0xcc61('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x1af7f3,_0x5e6926);_0x5b69fd(_0x5e6926);});});} \ No newline at end of file +var _0xd01b=['stringify','error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd01b,0x112));var _0xbd01=function(_0xd3db80,_0x59dbd8){_0xd3db80=_0xd3db80-0x0;var _0x154baf=_0xd01b[_0xd3db80];return _0x154baf;};'use strict';var _=require('lodash');var util=require(_0xbd01('0x0'));var moment=require('moment');var BPromise=require(_0xbd01('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd01('0x2'));var db=require(_0xbd01('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd01('0x4'))(_0xbd01('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd01('0x6')][_0xbd01('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ce5,_0x27fce7,_0x4e9952){return new BPromise(function(_0x178399,_0x2e2f2b){return client[_0xbd01('0x8')](_0x4f9ce5,_0x4e9952)['then'](function(_0x2111bb){logger[_0xbd01('0x9')](_0xbd01('0xa'),_0x27fce7,_0xbd01('0xb'));logger[_0xbd01('0xc')](_0xbd01('0xd'),_0x27fce7,_0xbd01('0xb'),JSON[_0xbd01('0xe')](_0x2111bb));if(_0x2111bb[_0xbd01('0xf')]){if(_0x2111bb[_0xbd01('0xf')]['code']===0x1f4){logger[_0xbd01('0xf')](_0xbd01('0xa'),_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x2e2f2b(_0x2111bb['error']['message']);}logger[_0xbd01('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);return _0x178399(_0x2111bb[_0xbd01('0xf')][_0xbd01('0x10')]);}else{logger[_0xbd01('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x27fce7,_0xbd01('0xb'));_0x178399(_0x2111bb['result']['message']);}})[_0xbd01('0x11')](function(_0x11e1c3){logger['error'](_0xbd01('0xa'),_0x27fce7,_0x11e1c3);_0x2e2f2b(_0x11e1c3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 866d2bc..c91b7c0 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 _0x5f99=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','util','connect-timeout'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5f99,0x1de));var _0x95f9=function(_0x337a1f,_0xe4b905){_0x337a1f=_0x337a1f-0x0;var _0x320f53=_0x5f99[_0x337a1f];return _0x320f53;};'use strict';var multer=require('multer');var util=require(_0x95f9('0x0'));var path=require('path');var timeout=require(_0x95f9('0x1'));var express=require(_0x95f9('0x2'));var router=express[_0x95f9('0x3')]();var fs_extra=require(_0x95f9('0x4'));var auth=require(_0x95f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x95f9('0x6'));var controller=require('./chatTransferReport.controller');router[_0x95f9('0x7')]('/',auth[_0x95f9('0x8')](),controller[_0x95f9('0x9')]);router['get'](_0x95f9('0xa'),auth[_0x95f9('0x8')](),controller['describe']);router['get'](_0x95f9('0xb'),auth['isAuthenticated'](),controller[_0x95f9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x95f9('0xd')](_0x95f9('0xb'),auth[_0x95f9('0x8')](),controller[_0x95f9('0xe')]);router[_0x95f9('0xf')](_0x95f9('0xb'),auth[_0x95f9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x054d=['/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','isAuthenticated','show','create','update','delete'];(function(_0x312cb2,_0x45f3b2){var _0xe10bef=function(_0x5ab658){while(--_0x5ab658){_0x312cb2['push'](_0x312cb2['shift']());}};_0xe10bef(++_0x45f3b2);}(_0x054d,0x120));var _0xd054=function(_0x5a0213,_0x4ff666){_0x5a0213=_0x5a0213-0x0;var _0x10af77=_0x054d[_0x5a0213];return _0x10af77;};'use strict';var multer=require('multer');var util=require(_0xd054('0x0'));var path=require(_0xd054('0x1'));var timeout=require(_0xd054('0x2'));var express=require(_0xd054('0x3'));var router=express[_0xd054('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd054('0x5'));var interaction=require(_0xd054('0x6'));var config=require(_0xd054('0x7'));var controller=require('./chatTransferReport.controller');router[_0xd054('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd054('0x8')](_0xd054('0x9'),auth['isAuthenticated'](),controller[_0xd054('0xa')]);router[_0xd054('0x8')]('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xc')]);router['post']('/',auth[_0xd054('0xb')](),controller[_0xd054('0xd')]);router['put']('/:id',auth[_0xd054('0xb')](),controller[_0xd054('0xe')]);router[_0xd054('0xf')](_0xd054('0x10'),auth[_0xd054('0xb')](),controller[_0xd054('0x11')]);module[_0xd054('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5a12a64..4ed7b72 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 _0xd2ea=['Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','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','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea'];(function(_0x3fca05,_0x56d103){var _0x350b97=function(_0x5648ce){while(--_0x5648ce){_0x3fca05['push'](_0x3fca05['shift']());}};_0x350b97(++_0x56d103);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1c859a,_0x16c29b){_0x1c859a=_0x1c859a-0x0;var _0xb01c7a=_0xd2ea[_0x1c859a];return _0xb01c7a;};'use strict';var Sequelize=require(_0xad2e('0x0'));var rs=require(_0xad2e('0x1'));module[_0xad2e('0x2')]={'name':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xad2e('0x3')]},'mapKey':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'mapKeyOffline':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x4')},'key':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xad2e('0x3')]},'animation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xad2e('0x8')]('rounded',_0xad2e('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xa')},'start_chat_button':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xad2e('0xe')]},'closingQuestion':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x11')},'noteTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x12')},'placeholderMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x13')},'closingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x14')},'closingMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x16')},'ratingType':{'type':Sequelize[_0xad2e('0x8')](_0xad2e('0x17'),_0xad2e('0x18')),'defaultValue':_0xad2e('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xad2e('0xe')],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':_0xad2e('0x1a'),'variable':null,'config':{'placeholder':_0xad2e('0x1b'),'type':_0xad2e('0x1c'),'required':!![]},'props':{'title':_0xad2e('0x1b'),'helpText':''}},{'type':_0xad2e('0x1a'),'props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x1e'))?JSON[_0xad2e('0x1f')](this[_0xad2e('0x1d')](_0xad2e('0x1e'))):{};},'set':function(_0x58acc8){return this[_0xad2e('0x20')](_0xad2e('0x1e'),JSON[_0xad2e('0x19')](_0x58acc8));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xad2e('0x19')]({'items':[{'type':'input','props':{'title':_0xad2e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xad2e('0x4'),'type':_0xad2e('0x4')},'variable':null},{'type':_0xad2e('0x21'),'config':{'placeholder':_0xad2e('0x22')},'props':{'title':_0xad2e('0x22'),'helpText':_0xad2e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xad2e('0x1d')](_0xad2e('0x24'))?JSON[_0xad2e('0x1f')](this['getDataValue'](_0xad2e('0x24'))):{};},'set':function(_0xfd2087){return this[_0xad2e('0x20')](_0xad2e('0x24'),JSON[_0xad2e('0x19')](_0xfd2087));}},'token':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':function(){return rs[_0xad2e('0x25')]();}},'autoclose':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xad2e('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xad2e('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x26')},'waitingMessage':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xad2e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xad2e('0x2b');}},'notificationSound':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xad2e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xad2e('0x3')],'defaultValue':_0xad2e('0x2d')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2e')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xad2e('0x2f')},'defaultTitle':{'type':Sequelize[_0xad2e('0x3')]},'customerAvatar':{'type':Sequelize[_0xad2e('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xad2e('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xad2e('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xad2e('0x7')],'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[_0xad2e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xad2e('0x6')],'comment':_0xad2e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'comment':_0xad2e('0x32'),'set':function(_0x6f4fbc){if(!_0x6f4fbc)this[_0xad2e('0x20')](_0xad2e('0x33'),null);this['setDataValue'](_0xad2e('0x34'),_0x6f4fbc);}},'vidaooEscalation':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xad2e('0x3')]},'vidaooTopic':{'type':Sequelize[_0xad2e('0x3')],'allowNull':![],'defaultValue':_0xad2e('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xad2e('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xad2e('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xad2e('0xe')]}}; \ No newline at end of file +var _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','New\x20offline\x20message\x20from\x20websiteName','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','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xcb91[_0x33155c];return _0x5becf7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 62fc0d5..86a789a 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 _0xf6ef=['join','custom','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','user-agent','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','asc','ListId','contact','customerIp','headers','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','firstName','messageId','created','close','*,*,*,*','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','files','no\x20available\x20attributes','CompanyId','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','originalname','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','findOne','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','User','internal','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','increment','chatLicenseExceeded','all','some','readFileSync','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','labelText','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','ChatWebsite','include','findAll','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','filter','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','includeAll','rows','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo'];(function(_0x5e3c7c,_0x2d533d){var _0x352d5c=function(_0x26a4d8){while(--_0x26a4d8){_0x5e3c7c['push'](_0x5e3c7c['shift']());}};_0x352d5c(++_0x2d533d);}(_0xf6ef,0xb7));var _0xff6e=function(_0x1569fc,_0x115095){_0x1569fc=_0x1569fc-0x0;var _0x277783=_0xf6ef[_0x1569fc];return _0x277783;};'use strict';var BPromise=require(_0xff6e('0x0'));var Mustache=require(_0xff6e('0x1'));var util=require('util');var path=require(_0xff6e('0x2'));var ejs=require(_0xff6e('0x3'));var fs=require('fs');var fs_extra=require(_0xff6e('0x4'));var _=require(_0xff6e('0x5'));var querystring=require(_0xff6e('0x6'));var Redis=require(_0xff6e('0x7'));var qs=require(_0xff6e('0x8'));var logger=require(_0xff6e('0x9'))(_0xff6e('0xa'));var config=require(_0xff6e('0xb'));var db=require(_0xff6e('0xc'))['db'];config['redis']=_[_0xff6e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff6e('0xe'))(new Redis(config[_0xff6e('0xf')]));require(_0xff6e('0x10'))[_0xff6e('0x11')](socket);var htmlToText=require(_0xff6e('0x12'));var jayson=require(_0xff6e('0x13'));var client=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232c});var client9002=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232a});var client9003=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x232b});var client9001=jayson[_0xff6e('0x14')][_0xff6e('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x2207e6,_0x3d0589,_0x39e326,_0x10897c){return new BPromise(function(_0x4bc343,_0x7e7b8e){var _0x1e0843=_0x10897c||client;return _0x1e0843[_0xff6e('0x16')](_0x2207e6,_0x39e326)['then'](function(_0x562ee4){logger[_0xff6e('0x17')](_0xff6e('0x18'),_0x3d0589,'request\x20sent');logger[_0xff6e('0x19')](_0xff6e('0x1a'),_0x3d0589,_0xff6e('0x1b'),JSON[_0xff6e('0x1c')](_0x562ee4));if(_0x562ee4[_0xff6e('0x1d')]){if(_0x562ee4[_0xff6e('0x1d')][_0xff6e('0x1e')]===0x1f4){logger['error'](_0xff6e('0x18'),_0x3d0589,_0x562ee4[_0xff6e('0x1d')]['message']);return _0x7e7b8e(_0x562ee4[_0xff6e('0x1d')][_0xff6e('0x1f')]);}logger['error'](_0xff6e('0x18'),_0x3d0589,_0x562ee4['error']['message']);return _0x4bc343(_0x562ee4[_0xff6e('0x1d')]['message']);}else{logger['info'](_0xff6e('0x18'),_0x3d0589,'request\x20sent');_0x4bc343(_0x562ee4['result'][_0xff6e('0x1f')]);}})[_0xff6e('0x20')](function(_0x1de941){logger[_0xff6e('0x1d')](_0xff6e('0x18'),_0x3d0589,_0x1de941);_0x7e7b8e(_0x1de941);});});}function respondWithStatusCode(_0x46395c,_0x1434e0){_0x1434e0=_0x1434e0||0xcc;return function(_0x442cba){if(_0x442cba){return _0x46395c[_0xff6e('0x21')](_0x1434e0);}return _0x46395c[_0xff6e('0x22')](_0x1434e0)[_0xff6e('0x23')]();};}function respondWithResult(_0x4fe3e9,_0x5c0cf1){_0x5c0cf1=_0x5c0cf1||0xc8;return function(_0x5a4166){if(_0x5a4166){return _0x4fe3e9[_0xff6e('0x22')](_0x5c0cf1)[_0xff6e('0x24')](_0x5a4166);}};}function respondWithFilteredResult(_0x2f9f33,_0x67a508){return function(_0x16f3c4){if(_0x16f3c4){var _0x4368cf=typeof _0x67a508[_0xff6e('0x25')]===_0xff6e('0x26')&&typeof _0x67a508['limit']===_0xff6e('0x26');var _0x3a068c=_0x16f3c4['count'];var _0x7b1e0d=_0x4368cf?0x0:_0x67a508[_0xff6e('0x25')];var _0x767387=_0x4368cf?_0x16f3c4[_0xff6e('0x27')]:_0x67a508[_0xff6e('0x25')]+_0x67a508[_0xff6e('0x28')];var _0x5cca92;if(_0x767387>=_0x3a068c){_0x767387=_0x3a068c;_0x5cca92=0xc8;}else{_0x5cca92=0xce;}_0x2f9f33['status'](_0x5cca92);return _0x2f9f33['set'](_0xff6e('0x29'),_0x7b1e0d+'-'+_0x767387+'/'+_0x3a068c)['json'](_0x16f3c4);}return null;};}function saveUpdates(_0xf4b274){return function(_0x5790da){if(_0x5790da){return _0x5790da[_0xff6e('0x2a')](_0xf4b274)['then'](function(_0x4fe414){return _0x4fe414;});}return null;};}function removeEntity(_0x506342){return function(_0x39bcda){if(_0x39bcda){return _0x39bcda[_0xff6e('0x2b')]()[_0xff6e('0x2c')](function(){var _0x11d0a4=_0x39bcda[_0xff6e('0x2d')]({'plain':!![]});var _0x116fa1=_0xff6e('0x2e');return db[_0xff6e('0x2f')]['destroy']({'where':{'type':_0x116fa1,'resourceId':_0x11d0a4['id']}})['then'](function(){return _0x39bcda;});})['then'](function(){_0x506342['status'](0xcc)[_0xff6e('0x23')]();});}};}function handleEntityNotFound(_0x336fc6){return function(_0x2959f7){if(!_0x2959f7){_0x336fc6[_0xff6e('0x21')](0x194);}return _0x2959f7;};}function handleError(_0x328bb2,_0xfc8108){_0xfc8108=_0xfc8108||0x1f4;return function(_0x4ae7aa){logger['error'](_0x4ae7aa[_0xff6e('0x30')]);if(_0x4ae7aa[_0xff6e('0x31')]){delete _0x4ae7aa[_0xff6e('0x31')];}_0x328bb2['status'](_0xfc8108)['send'](_0x4ae7aa);};}exports['index']=function(_0xbbfa03,_0x32bd6e){var _0x37acaf={'include':[{'model':db[_0xff6e('0x32')],'as':_0xff6e('0x33')}]},_0x47e4b1={},_0x17d17d={'count':0x0,'rows':[]};var _0x16cb12=_[_0xff6e('0x34')](db['ChatWebsite'][_0xff6e('0x35')],function(_0x521aa3){return{'name':_0x521aa3[_0xff6e('0x36')],'type':_0x521aa3[_0xff6e('0x37')][_0xff6e('0x38')]};});_0x47e4b1['model']=_['map'](_0x16cb12,_0xff6e('0x31'));_0x47e4b1['query']=_['keys'](_0xbbfa03[_0xff6e('0x39')]);_0x47e4b1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x47e4b1['model'],_0x47e4b1[_0xff6e('0x39')]);_0x37acaf['attributes']=_[_0xff6e('0x3b')](_0x47e4b1[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x37acaf[_0xff6e('0x3e')]=_0x37acaf['attributes'][_0xff6e('0x3f')]?_0x37acaf[_0xff6e('0x3e')]:_0x47e4b1[_0xff6e('0x3c')];if(!_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x37acaf['limit']=qs[_0xff6e('0x28')](_0xbbfa03['query']['limit']);_0x37acaf[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0xbbfa03[_0xff6e('0x39')]['offset']);}_0x37acaf[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xbbfa03[_0xff6e('0x39')][_0xff6e('0x43')]);_0x37acaf[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xbbfa03['query'],_0x47e4b1[_0xff6e('0x3a')]),_0x16cb12);if(_0xbbfa03[_0xff6e('0x39')]['filter']){_0x37acaf[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x37acaf[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x16cb12,function(_0x54fad9){if(_0x54fad9['type']!==_0xff6e('0x47')){var _0x5ca2a8={};_0x5ca2a8[_0x54fad9[_0xff6e('0x31')]]={'$like':'%'+_0xbbfa03[_0xff6e('0x39')]['filter']+'%'};return _0x5ca2a8;}})});}_0x37acaf=_[_0xff6e('0x46')]({},_0x37acaf,_0xbbfa03['options']);var _0x31abdc={'where':_0x37acaf[_0xff6e('0x44')]};return db[_0xff6e('0x48')][_0xff6e('0x27')](_0x31abdc)[_0xff6e('0x2c')](function(_0xfa48f8){_0x17d17d[_0xff6e('0x27')]=_0xfa48f8;if(_0xbbfa03[_0xff6e('0x39')]['includeAll']){_0x37acaf[_0xff6e('0x49')]=[{'all':!![]}];}return db['ChatWebsite'][_0xff6e('0x4a')](_0x37acaf);})[_0xff6e('0x2c')](function(_0x163ddd){_0x17d17d['rows']=_0x163ddd;return _0x17d17d;})[_0xff6e('0x2c')](respondWithFilteredResult(_0x32bd6e,_0x37acaf))[_0xff6e('0x20')](handleError(_0x32bd6e,null));};exports[_0xff6e('0x4b')]=function(_0x3f2a64,_0x4cdf44){var _0x51a6b1={'raw':![],'where':{'id':_0x3f2a64[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x32')],'as':'mandatoryDispositionPause'}]},_0x180db1={};_0x180db1[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x48')][_0xff6e('0x35')]);_0x180db1['query']=_[_0xff6e('0x4d')](_0x3f2a64['query']);_0x180db1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x180db1[_0xff6e('0x3c')],_0x180db1[_0xff6e('0x39')]);_0x51a6b1[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x180db1[_0xff6e('0x3c')],qs['fields'](_0x3f2a64['query'][_0xff6e('0x3d')]));_0x51a6b1[_0xff6e('0x3e')]=_0x51a6b1['attributes'][_0xff6e('0x3f')]?_0x51a6b1[_0xff6e('0x3e')]:_0x180db1[_0xff6e('0x3c')];if(_0x3f2a64['query']['includeAll']){_0x51a6b1[_0xff6e('0x49')]=[{'all':!![]}];}_0x51a6b1=_[_0xff6e('0x46')]({},_0x51a6b1,_0x3f2a64['options']);return db['ChatWebsite']['find'](_0x51a6b1)[_0xff6e('0x2c')](handleEntityNotFound(_0x4cdf44,null))[_0xff6e('0x2c')](respondWithResult(_0x4cdf44,null))['catch'](handleError(_0x4cdf44,null));};exports[_0xff6e('0x4e')]=function(_0x4f3ee2,_0x57fe29){return db[_0xff6e('0x48')][_0xff6e('0x4e')](_0x4f3ee2['body'],{})['then'](function(_0x3f3402){var _0x229520=_0x4f3ee2[_0xff6e('0x4f')][_0xff6e('0x2d')]({'plain':!![]});if(!_0x229520)throw new Error(_0xff6e('0x50'));if(_0x229520[_0xff6e('0x51')]===_0xff6e('0x4f')){var _0x4193a3=_0x3f3402[_0xff6e('0x2d')]({'plain':!![]});var _0x35786b=_0xff6e('0x2e');return db[_0xff6e('0x52')]['find']({'where':{'name':_0x35786b,'userProfileId':_0x229520[_0xff6e('0x53')]},'raw':!![]})[_0xff6e('0x2c')](function(_0x10e86e){if(_0x10e86e&&_0x10e86e[_0xff6e('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4193a3[_0xff6e('0x31')],'resourceId':_0x4193a3['id'],'type':_0x10e86e['name'],'sectionId':_0x10e86e['id']},{})['then'](function(){return _0x3f3402;});}else{return _0x3f3402;}})[_0xff6e('0x20')](function(_0x4c15da){logger[_0xff6e('0x1d')](_0xff6e('0x55'),_0x4c15da);throw _0x4c15da;});}return _0x3f3402;})[_0xff6e('0x2c')](respondWithResult(_0x57fe29,0xc9))[_0xff6e('0x20')](handleError(_0x57fe29,null));};exports['update']=function(_0x25ae40,_0x313aa5){if(_0x25ae40['body']['id']){delete _0x25ae40['body']['id'];}return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x25ae40[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x32')],'as':_0xff6e('0x33')}]})['then'](handleEntityNotFound(_0x313aa5,null))[_0xff6e('0x2c')](saveUpdates(_0x25ae40[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x313aa5,null))[_0xff6e('0x20')](handleError(_0x313aa5,null));};exports[_0xff6e('0x2b')]=function(_0x5ea82f,_0x176ea6){return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x5ea82f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x176ea6,null))[_0xff6e('0x2c')](removeEntity(_0x176ea6,null))[_0xff6e('0x20')](handleError(_0x176ea6,null));};exports[_0xff6e('0x58')]=function(_0x514ed9,_0x2eee5a){return db[_0xff6e('0x48')][_0xff6e('0x58')]()[_0xff6e('0x2c')](respondWithResult(_0x2eee5a,null))[_0xff6e('0x20')](handleError(_0x2eee5a,null));};exports[_0xff6e('0x59')]=function(_0x4ec4ee,_0x2a784e){if(_0x4ec4ee[_0xff6e('0x57')]['id']){delete _0x4ec4ee[_0xff6e('0x57')]['id'];}return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x4ec4ee[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x2a784e,null))[_0xff6e('0x2c')](function(_0x50cb5c){if(_0x50cb5c){_0x4ec4ee['body'][_0xff6e('0x5a')]=_0x50cb5c['id'];return db[_0xff6e('0x5b')][_0xff6e('0x4e')](_0x4ec4ee[_0xff6e('0x57')]);}})[_0xff6e('0x2c')](respondWithResult(_0x2a784e,null))['catch'](handleError(_0x2a784e,null));};exports[_0xff6e('0x5c')]=function(_0x1363ad,_0xe0ba1f){var _0x43ef02={'raw':![],'where':{}};var _0x1d0537={};var _0x108579={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1363ad[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0xe0ba1f,null))[_0xff6e('0x2c')](function(_0x313a68){if(_0x313a68){_0x1d0537[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x5b')][_0xff6e('0x35')]);_0x1d0537['query']=_['keys'](_0x1363ad[_0xff6e('0x39')]);_0x1d0537[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x1d0537[_0xff6e('0x3c')],_0x1d0537[_0xff6e('0x39')]);_0x43ef02[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x1d0537[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0x1363ad[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x43ef02[_0xff6e('0x3e')]=_0x43ef02['attributes'][_0xff6e('0x3f')]?_0x43ef02[_0xff6e('0x3e')]:_0x1d0537[_0xff6e('0x3c')];if(!_0x1363ad[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x43ef02['limit']=qs[_0xff6e('0x28')](_0x1363ad[_0xff6e('0x39')]['limit']);_0x43ef02[_0xff6e('0x25')]=qs['offset'](_0x1363ad[_0xff6e('0x39')]['offset']);}_0x43ef02['order']=qs['sort'](_0x1363ad[_0xff6e('0x39')]['sort']);_0x43ef02[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x1363ad['query'],_0x1d0537[_0xff6e('0x3a')]));_0x43ef02['where']['ChatWebsiteId']=_0x313a68['id'];if(_0x1363ad[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x43ef02[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x43ef02[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x43ef02['attributes'],function(_0x3bb4d8){var _0x483e81={};_0x483e81[_0x3bb4d8]={'$like':'%'+_0x1363ad[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x483e81;})});}_0x43ef02=_['merge']({},_0x43ef02,_0x1363ad[_0xff6e('0x5e')]);return db[_0xff6e('0x5b')][_0xff6e('0x27')]({'where':_0x43ef02['where']})[_0xff6e('0x2c')](function(_0x4aec2f){_0x108579['count']=_0x4aec2f;if(_0x1363ad[_0xff6e('0x39')]['includeAll']){_0x43ef02[_0xff6e('0x49')]=[{'all':!![]}];}return db[_0xff6e('0x5b')][_0xff6e('0x4a')](_0x43ef02);})['then'](function(_0x151277){_0x108579['rows']=_0x151277;return _0x108579;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0xe0ba1f,_0x43ef02))[_0xff6e('0x20')](handleError(_0xe0ba1f,null));};exports['removeDispositions']=function(_0x4872a7,_0x11b610){return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4872a7['params']['id']}})['then'](handleEntityNotFound(_0x11b610,null))['then'](function(_0x40c826){if(_0x40c826){return _0x40c826[_0xff6e('0x5f')](_0x4872a7[_0xff6e('0x39')][_0xff6e('0x60')]);}})['then'](respondWithStatusCode(_0x11b610,null))['catch'](handleError(_0x11b610,null));};exports[_0xff6e('0x61')]=function(_0x5b99fa,_0x1e9591){if(_0x5b99fa[_0xff6e('0x57')]['id']){delete _0x5b99fa[_0xff6e('0x57')]['id'];}return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x5b99fa[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1e9591,null))[_0xff6e('0x2c')](function(_0x42b143){if(_0x42b143){_0x5b99fa['body'][_0xff6e('0x5a')]=_0x42b143['id'];return db[_0xff6e('0x62')][_0xff6e('0x4e')](_0x5b99fa[_0xff6e('0x57')]);}})[_0xff6e('0x2c')](respondWithResult(_0x1e9591,null))[_0xff6e('0x20')](handleError(_0x1e9591,null));};exports[_0xff6e('0x63')]=function(_0xcdfddb,_0x42805d){var _0x433e50={'raw':![],'where':{}};var _0x4adcf1={};var _0x58da08={'count':0x0,'rows':[]};return db[_0xff6e('0x48')]['findOne']({'where':{'id':_0xcdfddb[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x42805d,null))[_0xff6e('0x2c')](function(_0x496aea){if(_0x496aea){_0x4adcf1[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x62')]['rawAttributes']);_0x4adcf1[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0xcdfddb[_0xff6e('0x39')]);_0x4adcf1[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x4adcf1['model'],_0x4adcf1[_0xff6e('0x39')]);_0x433e50[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x4adcf1[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x433e50['attributes']=_0x433e50[_0xff6e('0x3e')]['length']?_0x433e50[_0xff6e('0x3e')]:_0x4adcf1[_0xff6e('0x3c')];if(!_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x433e50[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xcdfddb[_0xff6e('0x39')]['limit']);_0x433e50[_0xff6e('0x25')]=qs['offset'](_0xcdfddb['query'][_0xff6e('0x25')]);}_0x433e50[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x43')]);_0x433e50[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xcdfddb[_0xff6e('0x39')],_0x4adcf1[_0xff6e('0x3a')]));_0x433e50[_0xff6e('0x44')][_0xff6e('0x5a')]=_0x496aea['id'];if(_0xcdfddb['query'][_0xff6e('0x5d')]){_0x433e50[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x433e50[_0xff6e('0x44')],{'$or':_['map'](_0x433e50[_0xff6e('0x3e')],function(_0x5e07fb){var _0x5294d2={};_0x5294d2[_0x5e07fb]={'$like':'%'+_0xcdfddb['query'][_0xff6e('0x5d')]+'%'};return _0x5294d2;})});}_0x433e50=_[_0xff6e('0x46')]({},_0x433e50,_0xcdfddb[_0xff6e('0x5e')]);return db[_0xff6e('0x62')]['count']({'where':_0x433e50[_0xff6e('0x44')]})[_0xff6e('0x2c')](function(_0x168530){_0x58da08[_0xff6e('0x27')]=_0x168530;if(_0xcdfddb[_0xff6e('0x39')][_0xff6e('0x64')]){_0x433e50['include']=[{'all':!![]}];}return db[_0xff6e('0x62')][_0xff6e('0x4a')](_0x433e50);})[_0xff6e('0x2c')](function(_0x5c7c0a){_0x58da08[_0xff6e('0x65')]=_0x5c7c0a;return _0x58da08;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x42805d,_0x433e50))[_0xff6e('0x20')](handleError(_0x42805d,null));};exports[_0xff6e('0x66')]=function(_0x4e5bc1,_0x23a26d){return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4e5bc1[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x23a26d,null))[_0xff6e('0x2c')](function(_0x3b74f6){if(_0x3b74f6){return _0x3b74f6[_0xff6e('0x66')](_0x4e5bc1['query'][_0xff6e('0x60')]);}})[_0xff6e('0x2c')](respondWithStatusCode(_0x23a26d,null))['catch'](handleError(_0x23a26d,null));};exports[_0xff6e('0x67')]=function(_0x13412e,_0x30dee9){_0x13412e['body'][_0xff6e('0x68')]=_0x13412e['file'][_0xff6e('0x69')];return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x13412e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x30dee9,null))['then'](saveUpdates(_0x13412e[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x30dee9,null))['catch'](handleError(_0x30dee9,null));};exports['addAvatar']=function(_0x4bee00,_0x573016){_0x4bee00[_0xff6e('0x57')][_0xff6e('0x6a')]=_0x4bee00[_0xff6e('0x6b')]['filename'];return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x4bee00[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x573016,null))[_0xff6e('0x2c')](saveUpdates(_0x4bee00[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x573016,null))[_0xff6e('0x20')](handleError(_0x573016,null));};exports[_0xff6e('0x6c')]=function(_0x4768fb,_0x1f4b08){_0x4768fb[_0xff6e('0x57')][_0xff6e('0x6d')]=_0x4768fb['file'][_0xff6e('0x69')];return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x4768fb[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f4b08,null))[_0xff6e('0x2c')](saveUpdates(_0x4768fb[_0xff6e('0x57')],null))['then'](respondWithResult(_0x1f4b08,null))[_0xff6e('0x20')](handleError(_0x1f4b08,null));};exports[_0xff6e('0x6e')]=function(_0x5c7c2f,_0x566818){_0x5c7c2f[_0xff6e('0x57')]['systemAvatar']=_0x5c7c2f[_0xff6e('0x6b')][_0xff6e('0x69')];return db[_0xff6e('0x48')]['find']({'where':{'id':_0x5c7c2f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x566818,null))[_0xff6e('0x2c')](saveUpdates(_0x5c7c2f[_0xff6e('0x57')],null))[_0xff6e('0x2c')](respondWithResult(_0x566818,null))[_0xff6e('0x20')](handleError(_0x566818,null));};exports[_0xff6e('0x6f')]=function(_0x368e34,_0x591232){var _0x4390f1=path[_0xff6e('0x70')](config['root'],'server/files/images/logos/default_logo.svg');var _0x34bfc1={'where':{'id':_0x368e34[_0xff6e('0x4c')]['id']},'attributes':['id',_0xff6e('0x68')],'raw':!![]};var _0x456b6d=![];return require('../../config/license/util')['getLicense']()[_0xff6e('0x2c')](function(_0x5ba45c){if(_0x5ba45c){_0x456b6d=_0x5ba45c[_0xff6e('0x71')];}})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x34bfc1);})[_0xff6e('0x2c')](handleEntityNotFound(_0x591232,null))['then'](function(_0x5558ea){if(_0x5558ea){if(!_['isNil'](_0x5558ea[_0xff6e('0x68')])){if(fs['existsSync'](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x73'),_0x5558ea[_0xff6e('0x68')]))&&_0x456b6d){_0x4390f1=path['join'](config['root'],_0xff6e('0x73'),_0x5558ea[_0xff6e('0x68')]);}}return _0x591232[_0xff6e('0x74')](_0x4390f1);}})['catch'](handleError(_0x591232,null));};exports[_0xff6e('0x75')]=function(_0x1dffb1,_0x14cb8b){var _0x430a14=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x76'));var _0x2051e8={'where':{'id':_0x1dffb1['params']['id']},'attributes':['id',_0xff6e('0x6a')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x2051e8)[_0xff6e('0x2c')](handleEntityNotFound(_0x14cb8b,null))[_0xff6e('0x2c')](function(_0xec37b){if(_0xec37b){if(!_[_0xff6e('0x77')](_0xec37b[_0xff6e('0x6a')])){if(fs[_0xff6e('0x78')](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0xec37b[_0xff6e('0x6a')]))){_0x430a14=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0xec37b[_0xff6e('0x6a')]);}}return _0x14cb8b[_0xff6e('0x74')](_0x430a14);}})[_0xff6e('0x20')](handleError(_0x14cb8b,null));};exports[_0xff6e('0x7a')]=function(_0x5998c9,_0x291612){var _0x2f3d7c=path[_0xff6e('0x70')](config[_0xff6e('0x72')],'server/files/images/avatars/customer_avatar.png');var _0x20577d={'where':{'id':_0x5998c9['params']['id']},'attributes':['id',_0xff6e('0x6d'),_0xff6e('0x7b')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x20577d)[_0xff6e('0x2c')](handleEntityNotFound(_0x291612,null))[_0xff6e('0x2c')](function(_0x389c8c){if(_0x389c8c){if(!_[_0xff6e('0x77')](_0x389c8c[_0xff6e('0x6d')])){if(fs[_0xff6e('0x78')](path['join'](config[_0xff6e('0x72')],'server/files/images/avatars/',_0x389c8c[_0xff6e('0x6d')]))&&_0x389c8c[_0xff6e('0x7b')]){_0x2f3d7c=path[_0xff6e('0x70')](config['root'],'server/files/images/avatars/',_0x389c8c[_0xff6e('0x6d')]);}}return _0x291612['download'](_0x2f3d7c);}})['catch'](handleError(_0x291612,null));};exports['getSystemAvatar']=function(_0x4add1f,_0x419ae6){var _0x2d7cfd=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x7c'));var _0x42d9f7={'where':{'id':_0x4add1f[_0xff6e('0x4c')]['id']},'attributes':['id',_0xff6e('0x7d')],'raw':!![]};return db[_0xff6e('0x48')][_0xff6e('0x56')](_0x42d9f7)[_0xff6e('0x2c')](handleEntityNotFound(_0x419ae6,null))[_0xff6e('0x2c')](function(_0x555552){if(_0x555552){if(!_['isNil'](_0x555552[_0xff6e('0x7d')])){if(fs[_0xff6e('0x78')](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0x555552[_0xff6e('0x7d')]))){_0x2d7cfd=path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0x79'),_0x555552[_0xff6e('0x7d')]);}}return _0x419ae6[_0xff6e('0x74')](_0x2d7cfd);}})['catch'](handleError(_0x419ae6,null));};exports[_0xff6e('0x7e')]=function(_0x3a6c88,_0x5bb1af){var _0x1d471f=require(_0xff6e('0x7f'));var _0x30dec5=new _0x1d471f();var _0x46dbe7=_0x30dec5['setUA'](_0x3a6c88['headers'][_0xff6e('0x80')])['getResult']();var _0x50a199={'body':_0x3a6c88['body'],'channel':_0xff6e('0x81')};var _0x1df2a9=[];var _0x1dae1f=[];var _0x1d5cb4={};var _0x2949d7=![];return db[_0xff6e('0x82')][_0xff6e('0x58')]()[_0xff6e('0x2c')](function(_0x23df81){if(!_0x23df81){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))]('no\x20available\x20attributes');}_0x1df2a9=_[_0xff6e('0x85')](_['keys'](_0x23df81),[_0xff6e('0x86'),_0xff6e('0x87')]);_0x1dae1f=_[_0xff6e('0x85')](_[_0xff6e('0x4d')](_0x23df81),[_0xff6e('0x86'),_0xff6e('0x87'),'CompanyId','ListId']);if(_0x3a6c88['body']['id']){delete _0x3a6c88['body']['id'];}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')])){throw new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0x89'));}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x57')])||_0x3a6c88[_0xff6e('0x57')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xff6e('0x77')](_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x8a')])){throw new db['Sequelize'][(_0xff6e('0x84'))](_0xff6e('0x8b')+_0x1dae1f);}if(!_[_0xff6e('0x8c')](_0x1dae1f,_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x8a')])){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0x8d')+_0x1dae1f);}_0x1d5cb4[_0x3a6c88['body'][_0xff6e('0x8a')]]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')];})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x3a6c88[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x8e')],'as':_0xff6e('0x8f'),'include':[{'model':db[_0xff6e('0x82')],'as':_0xff6e('0x90'),'where':_0x1d5cb4,'limit':0x1,'order':[[_0xff6e('0x87'),_0xff6e('0x91')]]}]},{'model':db[_0xff6e('0x92')],'as':_0xff6e('0x93')}]});})[_0xff6e('0x2c')](handleEntityNotFound(_0x5bb1af,null))[_0xff6e('0x2c')](function(_0x617be2){if(_0x617be2&&_0x617be2[_0xff6e('0x8f')]){_0x50a199[_0xff6e('0x94')]=_0x617be2;_0x50a199[_0xff6e('0x95')]=_0x617be2[_0xff6e('0x93')];_0x50a199['list']=_0x617be2[_0xff6e('0x8f')];_0x50a199[_0xff6e('0x95')]=_['orderBy'](_0x50a199['applications'],['priority'],[_0xff6e('0x96')]);if(_0x50a199['account']['Applications']){delete _0x50a199[_0xff6e('0x94')][_0xff6e('0x93')];}if(_0x50a199[_0xff6e('0x94')]['List']&&_0x50a199['account'][_0xff6e('0x8f')][_0xff6e('0x90')][_0xff6e('0x3f')]){return _0x50a199[_0xff6e('0x94')][_0xff6e('0x8f')][_0xff6e('0x90')][0x0];}var _0x1a55f9=_['defaults'](_0x3a6c88[_0xff6e('0x57')],{'firstName':_0x3a6c88[_0xff6e('0x57')]['from'],'ListId':_0x617be2[_0xff6e('0x97')]});_0x1a55f9[_0x3a6c88['body'][_0xff6e('0x8a')]]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x88')];return db['CmContact'][_0xff6e('0x4e')](_0x1a55f9,{'fields':_0x1df2a9,'raw':!![]});}})[_0xff6e('0x2c')](handleEntityNotFound(_0x5bb1af,null))[_0xff6e('0x2c')](function(_0x576f7e){_0x50a199[_0xff6e('0x98')]=_0x576f7e;var _0x340dca=_0x3a6c88['body'][_0xff6e('0x99')];if(_0x3a6c88['headers']['cf-connecting-ip']){_0x340dca=_0x3a6c88[_0xff6e('0x9a')]['cf-connecting-ip'];}else if(_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9b')]){_0x340dca=_[_0xff6e('0x9c')](_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9b')][_0xff6e('0x9d')](','));}if(_0x576f7e){var _0x47e04c={'ContactId':_0x576f7e['id'],'ChatWebsiteId':_0x3a6c88[_0xff6e('0x4c')]['id'],'from':(_0x576f7e['firstName']||'')+'\x20'+(_0x576f7e[_0xff6e('0x9e')]||''),'customerIp':_0x340dca,'customerPort':_0x3a6c88[_0xff6e('0x9a')][_0xff6e('0x9f')]?_0x3a6c88[_0xff6e('0x9a')]['x-real-port']:null,'referer':_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa0')],'browserName':_0x46dbe7['browser'][_0xff6e('0x31')]&&_0x46dbe7[_0xff6e('0xa1')][_0xff6e('0xa2')]?util[_0xff6e('0xa3')](_0xff6e('0xa4'),_0x46dbe7[_0xff6e('0xa1')]['name'],_0x46dbe7['browser'][_0xff6e('0xa2')]):_0xff6e('0xa5'),'browserVersion':_0x46dbe7[_0xff6e('0xa1')]['version']||_0xff6e('0xa5'),'osName':util['format'](_0xff6e('0xa4'),_0x46dbe7['os'][_0xff6e('0x31')],_0x46dbe7['os'][_0xff6e('0xa2')]),'osVersion':_0x46dbe7['os']['version'],'deviceModel':_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x3c')]&&_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0xa7')]?util['format'](_0xff6e('0xa8'),_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x3c')],_0x46dbe7[_0xff6e('0xa6')]['vendor'],_0x46dbe7[_0xff6e('0xa6')][_0xff6e('0x37')]):null,'deviceVendor':_0x46dbe7['device'][_0xff6e('0xa7')],'deviceType':_0x46dbe7['device'][_0xff6e('0x37')],'formData':JSON['stringify'](_0x3a6c88[_0xff6e('0x57')])};var _0x18a802={'ChatWebsiteId':_0x3a6c88[_0xff6e('0x4c')]['id'],'closed':![]};if(_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa9')]){_0x18a802[_0xff6e('0xa9')]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xa9')];return db['ChatInteraction'][_0xff6e('0x56')]({'where':_0x18a802})[_0xff6e('0x2c')](function(_0x2b9af8){if(_0x2b9af8){return[_0x2b9af8,![]];}_0x47e04c[_0xff6e('0xa9')]=_0x3a6c88['body'][_0xff6e('0xa9')];_0x47e04c[_0xff6e('0xaa')]=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xaa')];return db[_0xff6e('0xab')][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x1d6a19){return[_0x1d6a19,!![]];});});}_0x18a802[_0xff6e('0xac')]=_0x576f7e['id'];if(_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]&&_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]['id']){_0x18a802['id']=_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xad')]['id'];return db[_0xff6e('0xab')][_0xff6e('0x56')]({'where':_0x18a802})[_0xff6e('0x2c')](function(_0x5801d3){if(_0x5801d3){return[_0x5801d3,![]];}return db['ChatInteraction'][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x34e369){return[_0x34e369,!![]];});});}return db[_0xff6e('0xab')][_0xff6e('0x4e')](_0x47e04c)[_0xff6e('0x2c')](function(_0x290489){return[_0x290489,!![]];});}})[_0xff6e('0xae')](function(_0x3df9a1,_0x2b4e5b){if(_0x3df9a1){_0x2949d7=_0x2b4e5b;if(!_0x2b4e5b){var _0x229a73={'from':(_0x50a199[_0xff6e('0x98')][_0xff6e('0xaf')]||'')+'\x20'+(_0x50a199['contact']['lastName']||'')};if(_0x3a6c88[_0xff6e('0x57')]['threadId']&&_0x3a6c88[_0xff6e('0x57')][_0xff6e('0xb0')]&&_0x3a6c88['body'][_0xff6e('0xa9')]!=_0x3a6c88['body']['messageId']){_0x229a73['threadId']=_0x3a6c88['body'][_0xff6e('0xb0')];}return _0x3df9a1[_0xff6e('0x2a')](_0x229a73);}else{return _0x3df9a1;}}})[_0xff6e('0x2c')](function(_0x15e128){_0x50a199['interaction']=_0x15e128[_0xff6e('0x2d')]({'plain':!![]});_0x50a199['interaction'][_0xff6e('0xb1')]=_0x2949d7;if(_0x50a199['interaction']['created']){if(_0x50a199[_0xff6e('0x94')]['autoclose']){_0x50a199[_0xff6e('0x95')]['push']({'id':0x0,'priority':_0x50a199[_0xff6e('0x95')]['length']+0x1,'app':_0xff6e('0xb2'),'appdata':'unmanaged','interval':_0xff6e('0xb3')});}}return db['ChatMessage'][_0xff6e('0x4e')]({'body':_0x3a6c88[_0xff6e('0x57')][_0xff6e('0x57')],'ChatWebsiteId':_0x3a6c88['params']['id'],'ChatInteractionId':_0x15e128['id'],'direction':'in','ContactId':_0x50a199[_0xff6e('0x98')]['id'],'AttachmentId':_0x3a6c88['body']['AttachmentId']});})['then'](function(_0x22807d){_0x50a199[_0xff6e('0x1f')]=_0x22807d;if(_0x50a199['interaction']['UserId']){return db['User'][_0xff6e('0x56')]({'attributes':['id',_0xff6e('0x31')],'where':{'id':_0x50a199[_0xff6e('0xad')]['UserId']}})['then'](function(_0x28c20e){if(_0x28c20e){_0x50a199[_0xff6e('0x95')][_0xff6e('0xb4')]({'id':0x0,'priority':0x0,'app':_0xff6e('0xb5'),'appdata':_0x28c20e['name']+','+(_0x50a199['account'][_0xff6e('0xb6')]||0xa),'interval':_0xff6e('0xb3')});_0x50a199[_0xff6e('0xb7')]=!![];}return respondWithRpcPromise('Start',_0xff6e('0xb8'),_0x50a199);});}return respondWithRpcPromise(_0xff6e('0xb9'),_0xff6e('0xb8'),_0x50a199);})['then'](function(_0x5b3555){respondWithRpcPromise(_0xff6e('0xba'),'EventManager',{'event':'notify','message':_0x5b3555},client9002);return _0x5b3555;})[_0xff6e('0x2c')](respondWithResult(_0x5bb1af,null))['catch'](handleError(_0x5bb1af,null));};exports['offline']=function(_0x52baeb,_0x21a42c){var _0x103518,_0x4ab522,_0x208105;var _0x2083c9=[];var _0x5ae46b={};var _0x3ee9e5=_0x52baeb[_0xff6e('0xbb')]||[];var _0x2b4177=[];var _0x28142c;return db[_0xff6e('0x82')][_0xff6e('0x58')]()[_0xff6e('0x2c')](function(_0x2b040f){if(!_0x2b040f){throw new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xbc'));}_0x2083c9=_[_0xff6e('0x85')](_[_0xff6e('0x4d')](_0x2b040f),[_0xff6e('0x86'),_0xff6e('0x87'),_0xff6e('0xbd'),_0xff6e('0x97')]);if(_0x52baeb[_0xff6e('0x57')]['id']){delete _0x52baeb[_0xff6e('0x57')]['id'];}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')])){throw _0x21a42c[_0xff6e('0x22')](0x1f4)[_0xff6e('0xbe')](new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0x89')));}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0x57')])||_0x52baeb[_0xff6e('0x57')]['body']===''){throw _0x21a42c[_0xff6e('0x22')](0x1f4)['send'](new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xbf')));}if(_['isNil'](_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')])){throw _0x21a42c['status'](0x1f4)['send'](new db[(_0xff6e('0x83'))]['ValidationError'](_0xff6e('0xc1')+_0x2083c9));}if(!_[_0xff6e('0x8c')](_0x2083c9,_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')])){throw _0x21a42c[_0xff6e('0x22')](0x1f4)[_0xff6e('0xbe')](new db[(_0xff6e('0x83'))][(_0xff6e('0x84'))](_0xff6e('0xc2')+_0x2083c9));}_0x5ae46b[_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')]]=_0x52baeb[_0xff6e('0x57')]['from'];})[_0xff6e('0x2c')](function(){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x52baeb[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0x8e')],'as':_0xff6e('0x8f')},{'model':db[_0xff6e('0xc3')],'as':_0xff6e('0xc3')}]});})[_0xff6e('0x2c')](handleEntityNotFound(_0x21a42c,null))[_0xff6e('0x2c')](function(_0x2c8ea2){if(_0x2c8ea2&&_0x2c8ea2[_0xff6e('0x8f')]){_0x4ab522=_0x2c8ea2;var _0x508c83=_[_0xff6e('0xd')](_0x52baeb[_0xff6e('0x57')],{'firstName':_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')],'phone':_0x52baeb[_0xff6e('0x57')][_0xff6e('0x88')],'ListId':_0x2c8ea2[_0xff6e('0x97')]});_0x508c83[_0x52baeb[_0xff6e('0x57')][_0xff6e('0xc0')]]=_0x52baeb['body'][_0xff6e('0x88')];return db[_0xff6e('0x82')][_0xff6e('0xc4')]({'where':_0x5ae46b,'defaults':_0x508c83});}})[_0xff6e('0xae')](function(_0x289d6e){if(_0x289d6e){_0x208105=_0x289d6e;var _0x581984=fs['readFileSync'](path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0xc5')),_0xff6e('0xc6'));var _0x44d515=ejs['render'](_0x581984,{'body':_[_0xff6e('0xc7')](_0x52baeb['body'][_0xff6e('0x57')]),'bodyTitle':_0x4ab522['offlineMessageBody']});return db['ChatOfflineMessage'][_0xff6e('0x4e')]({'body':_0x44d515,'plainBody':htmlToText['fromString'](_0x44d515),'ContactId':_0x289d6e['id'],'ChatWebsiteId':_0x4ab522['id']});}})[_0xff6e('0x2c')](function(_0x46eb06){_0x28142c=_0x46eb06;if(_0x3ee9e5[_0xff6e('0x3f')]){var _0x2752e8=_0x3ee9e5[_0xff6e('0x34')](function(_0x48fc45){return{'name':_0x48fc45[_0xff6e('0xc8')],'basename':_0x48fc45[_0xff6e('0x69')],'type':_0x48fc45['mimetype'],'ChatOfflineMessageId':_0x46eb06['id']};});_0x2b4177=_0x2752e8[_0xff6e('0x34')](_0xb650cf=>{var _0x2d5c0d={'filename':_0xb650cf[_0xff6e('0x31')],'path':path[_0xff6e('0x70')](config[_0xff6e('0x72')],_0xff6e('0xc9'),'files',_0xff6e('0xca'),_0xff6e('0xcb'),_0xb650cf[_0xff6e('0xcc')])};return _0x2d5c0d;});if(!_0x4ab522[_0xff6e('0xcd')]){return db[_0xff6e('0xce')][_0xff6e('0xcf')](function(_0x526a5c){return db[_0xff6e('0xd0')][_0xff6e('0xd1')](_0x2752e8,{'transaction':_0x526a5c});});}}})[_0xff6e('0x2c')](function(){if(_0x28142c){_0x103518=_0x28142c;return db[_0xff6e('0xc3')][_0xff6e('0xd2')]({'where':{'service':!![]},'include':[{'model':db[_0xff6e('0xd3')],'as':_0xff6e('0xd4'),'raw':!![],'include':[{'model':db[_0xff6e('0xd5')],'as':_0xff6e('0xd5'),'raw':!![]}]}]});}})[_0xff6e('0x2c')](function(_0x55e96b){if(_0x55e96b&&_0x55e96b[_0xff6e('0xd4')]&&_0x4ab522['forwardOffline']&&_0x4ab522[_0xff6e('0xd6')]){var _0x4057d8=_0x55e96b['getSmtpOptions']();return respondWithRpcPromise(_0xff6e('0xd7'),_0xff6e('0xd8'),{'account':_0x4057d8,'message':{'from':util['format'](_0xff6e('0xd9'),_0x55e96b[_0xff6e('0x31')],_0x55e96b[_0xff6e('0xda')]||_0x55e96b[_0xff6e('0xd4')][_0xff6e('0x4f')]),'to':_0x4ab522[_0xff6e('0xd6')],'subject':_0x4ab522['offlineMessageSubject'],'html':_0x103518['body'],'attachments':_0x2b4177}},client9003)['then'](function(){return _0x103518;})[_0xff6e('0x20')](function(_0x1f8967){logger[_0xff6e('0x1d')](_0x1f8967);});}})[_0xff6e('0x2c')](function(){if(_0x4ab522&&_0x4ab522[_0xff6e('0xcd')]&&_0x4ab522[_0xff6e('0xdb')]){var _0x38e70c=[];if(_0x3ee9e5[_0xff6e('0x3f')]){_0x38e70c=_0x3ee9e5[_0xff6e('0x34')](function(_0x55ad18){return{'name':_0x55ad18[_0xff6e('0xc8')],'basename':_0x55ad18[_0xff6e('0x69')],'type':_0x55ad18[_0xff6e('0xdc')],'ChatOfflineMessageId':_0x28142c['id']};});}var _0x5a8210;if(!_[_0xff6e('0x77')](_0x4ab522[_0xff6e('0xdd')])){var _0x3478b1=_[_0xff6e('0x34')](_0x52baeb['body'],function(_0x2c0fb6){return _0x2c0fb6;});var _0x302dee=_['toPairsIn'](_0x3478b1)[0x0];var _0xa9bde8=_[_0xff6e('0xde')](_0x302dee,function(_0x3b1b7d){return _0x3b1b7d;});_0x5a8210=_0xa9bde8[0x1][_0x4ab522['subjectOffline']];}var _0x2c100d={'from':_0x208105['email'],'firstName':_0x208105['firstName'],'lastName':_0x208105[_0xff6e('0x9e')],'mapKey':_0xff6e('0xda'),'message':{'from':_0x208105[_0xff6e('0xda')],'to':_0x4ab522[_0xff6e('0xc3')][_0xff6e('0xda')],'cc':'','subject':_[_0xff6e('0x77')](_0x5a8210)?_0x4ab522[_0xff6e('0xdf')]:_0x5a8210,'messageId':'','sentAt':new Date(),'attach':_0x38e70c['length'],'attachments':_0x38e70c,'originChannel':'Chat','ChatWebsiteId':_0x4ab522['id'],'ChatOfflineMessageId':_0x103518['id'],'originTo':_0x4ab522[_0xff6e('0xc3')][_0xff6e('0xda')]},'body':_0x103518[_0xff6e('0x57')]};var _0x5718e1={'account':{'id':_0x4ab522[_0xff6e('0xdb')]},'body':_0x2c100d,'log':_0xff6e('0xe0')};return respondWithRpcPromise(_0xff6e('0xe0'),_0xff6e('0xe1'),_0x5718e1,client9001)['then'](function(){return _0x103518;})[_0xff6e('0x20')](function(_0x1298b9){logger[_0xff6e('0x1d')](_0x1298b9);});}return;})[_0xff6e('0x2c')](function(){if(_0x103518){return _0x103518;}})[_0xff6e('0x2c')](respondWithResult(_0x21a42c,null))['catch'](function(_0x5aa4fb){logger[_0xff6e('0x1d')](_0xff6e('0x20'),_0x5aa4fb);for(var _0x2234ed of _0x3ee9e5){var _0xfab537=path[_0xff6e('0x70')](config['root'],_0xff6e('0xc9'),_0xff6e('0xbb'),'attachments','offline-chat',_0x2234ed[_0xff6e('0x69')]);fs_extra[_0xff6e('0xe2')](_0xfab537)[_0xff6e('0x20')](function(_0x54e871){logger[_0xff6e('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0xfab537,_0x54e871);});}});};exports[_0xff6e('0xe3')]=function(_0x14f4fe,_0x3cdff9){return db[_0xff6e('0xab')][_0xff6e('0x56')]({'where':{'id':_0x14f4fe['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3cdff9,null))['then'](function(_0x5af42f){if(_0x5af42f){return _0x5af42f[_0xff6e('0xe3')](_0x14f4fe['body'][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x14f4fe[_0xff6e('0x57')],[_0xff6e('0x60'),'id'])||{});}})[_0xff6e('0x2c')](respondWithResult(_0x3cdff9,null))[_0xff6e('0x20')](handleError(_0x3cdff9,null));};exports['getInteractions']=function(_0xafa35f,_0x3726cb){var _0x58d459={'raw':![],'where':{}};var _0x1053a9={};var _0x195977={'count':0x0,'rows':[]};return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0xafa35f['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3726cb,null))[_0xff6e('0x2c')](function(_0x2acaaf){if(_0x2acaaf){_0x1053a9[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0xab')]['rawAttributes']);_0x1053a9[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0xafa35f[_0xff6e('0x39')]);_0x1053a9[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x1053a9[_0xff6e('0x3c')],_0x1053a9['query']);_0x58d459[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x1053a9[_0xff6e('0x3c')],qs[_0xff6e('0x3d')](_0xafa35f[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x58d459[_0xff6e('0x3e')]=_0x58d459[_0xff6e('0x3e')]['length']?_0x58d459[_0xff6e('0x3e')]:_0x1053a9['model'];if(!_0xafa35f[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x58d459[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xafa35f[_0xff6e('0x39')]['limit']);_0x58d459[_0xff6e('0x25')]=qs['offset'](_0xafa35f[_0xff6e('0x39')][_0xff6e('0x25')]);}_0x58d459['order']=qs[_0xff6e('0x43')](_0xafa35f[_0xff6e('0x39')]['sort']);_0x58d459[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0xafa35f[_0xff6e('0x39')],_0x1053a9[_0xff6e('0x3a')]));_0x58d459['where']['ChatWebsiteId']=_0x2acaaf['id'];if(_0xafa35f[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x58d459[_0xff6e('0x44')]=_['merge'](_0x58d459['where'],{'$or':_[_0xff6e('0x34')](_0x58d459[_0xff6e('0x3e')],function(_0x5c431c){var _0x4954d3={};_0x4954d3[_0x5c431c]={'$like':'%'+_0xafa35f[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x4954d3;})});}_0x58d459=_['merge']({},_0x58d459,_0xafa35f[_0xff6e('0x5e')]);return db['ChatInteraction']['count']({'where':_0x58d459[_0xff6e('0x44')]})['then'](function(_0x2cf8fe){_0x195977[_0xff6e('0x27')]=_0x2cf8fe;if(_0xafa35f[_0xff6e('0x39')]['includeAll']){_0x58d459[_0xff6e('0x49')]=[{'model':db[_0xff6e('0x82')],'as':_0xff6e('0xe5'),'required':![]},{'model':db[_0xff6e('0xe6')],'as':'Owner','attributes':[_0xff6e('0x31'),'fullname',_0xff6e('0xe7')],'required':![]},{'model':db['Tag'],'as':_0xff6e('0xe8'),'attributes':['id','name',_0xff6e('0xe9')],'where':_0xafa35f['query'][_0xff6e('0xea')]?{'id':_0xafa35f[_0xff6e('0x39')]['tag']}:undefined,'required':_0xafa35f[_0xff6e('0x39')]['tag']?!![]:![]}];}return db[_0xff6e('0xab')]['findAll'](_0x58d459);})['then'](function(_0x8d7d43){_0x195977[_0xff6e('0x65')]=_0x8d7d43;return _0x195977;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x3726cb,_0x58d459))['catch'](handleError(_0x3726cb,null));};function iftimePromise(_0x394cf6,_0x16fb43){return respondWithRpcPromise(_0xff6e('0xeb'),'getSnippet',{'command':_0x16fb43[_0xff6e('0xec')]?util['format'](_0xff6e('0xed'),_0x394cf6[_0xff6e('0xee')],_0x16fb43[_0xff6e('0xec')]):util['format'](_0xff6e('0xef'),_0x394cf6[_0xff6e('0xee')])},client9002)[_0xff6e('0x2c')](function(_0x3fa8d4){var _0x43126f=_0x3fa8d4&&_0x3fa8d4[_0xff6e('0xf0')](_0xff6e('0xf1'))>=0x0?!![]:![];logger[_0xff6e('0x17')](_0xff6e('0xf2'),_0x16fb43['id'],_0x394cf6['id'],_0x394cf6[_0xff6e('0xee')],_0x43126f?_0xff6e('0xf3'):_0xff6e('0xf4'),_0x16fb43[_0xff6e('0xec')]?_0x16fb43[_0xff6e('0xec')]:_0xff6e('0xf5'));return _0x43126f;})[_0xff6e('0x20')](function(_0x4c3228){logger[_0xff6e('0x1d')](_0xff6e('0xf2'),_0x16fb43['id'],_0x394cf6['id'],_0x394cf6['interval'],util[_0xff6e('0xf6')](_0x4c3228,{'showHidden':![],'depth':null}),_0x16fb43[_0xff6e('0xec')]?_0x16fb43[_0xff6e('0xec')]:_0xff6e('0xf5'));return![];});}exports[_0xff6e('0xf7')]=function(_0x1a8b29,_0x1abb92){var _0x29381c=0x0;var _0x228cf8=0x0;var _0x486d4c=![];var _0x5bdabd;var _0x369d27;return db['ChatWebsite'][_0xff6e('0x56')]({'where':{'id':_0x1a8b29[_0xff6e('0x4c')]['id']},'include':[{'model':db[_0xff6e('0xf8')],'as':_0xff6e('0xf8'),'include':[{'model':db['Interval'],'as':_0xff6e('0xf9'),'attributes':['id',_0xff6e('0xee')],'raw':!![]}]}]})[_0xff6e('0x2c')](handleEntityNotFound(_0x1abb92,null))[_0xff6e('0x2c')](function(_0xb424ba){if(_0xb424ba){_0x5bdabd=_0xb424ba;return _0xb424ba[_0xff6e('0xfa')]({'raw':!![]});}})['then'](function(_0x23c13a){if(_0x5bdabd){if(_0x23c13a){_0x369d27=_0x23c13a;}}return require(_0xff6e('0xfb'))['getLicense']();})['then'](function(_0x360d7e){if(_0x360d7e){_0x228cf8=_0x360d7e[_0xff6e('0xfc')];_0x486d4c=_0x360d7e[_0xff6e('0x71')];}})[_0xff6e('0x2c')](function(){return db[_0xff6e('0xab')][_0xff6e('0x27')]({'where':{'closed':![]}});})[_0xff6e('0x2c')](function(_0x196d13){_0x29381c=_0x196d13;if(_0x228cf8&&_0x196d13>_0x228cf8){return db['License'][_0xff6e('0xd2')]({'where':{'id':0x1}})[_0xff6e('0x2c')](function(_0xe4f9a2){if(_0xe4f9a2){_0xe4f9a2[_0xff6e('0xfd')](_0xff6e('0xfe'));}});}})['then'](function(){if(_0x5bdabd[_0xff6e('0xf8')]&&_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')]){var _0x2c571e=[];for(var _0x10ea92=0x0;_0x10ea92<_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')][_0xff6e('0x3f')];_0x10ea92++){var _0x11b846=_0x5bdabd[_0xff6e('0xf8')][_0xff6e('0xf9')][_0x10ea92]['get']({'plain':!![]});_0x2c571e['push'](iftimePromise(_0x11b846,_0x5bdabd));}return BPromise[_0xff6e('0xff')](_0x2c571e)['then'](function(_0x29eb33){return _[_0xff6e('0x100')](_0x29eb33);});}else{return!![];}})[_0xff6e('0x2c')](function(_0x3d807a){var _0x208689=fs[_0xff6e('0x101')](path[_0xff6e('0x70')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x1a9d6c={'remote':_0x5bdabd[_0xff6e('0x102')],'query':querystring[_0xff6e('0x1c')](_[_0xff6e('0x46')](_0x5bdabd[_0xff6e('0x2d')]({'plain':!![]}),{'customerIp':_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0x9b')]||_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0x103')]||_0x1a8b29['connection'][_0xff6e('0x104')]||_0x1a8b29['ip'],'referer':_0x1a8b29[_0xff6e('0x9a')][_0xff6e('0xa0')],'openedInteractions':_0x29381c,'maxInteractions':_0x228cf8,'virtual':_0x486d4c['virtual'],'online':_0x3d807a,'custom':_0x486d4c}))[_0xff6e('0x105')](/'/g,'\x5c\x27')};_0x1abb92[_0xff6e('0xbe')](ejs[_0xff6e('0x106')](Mustache[_0xff6e('0x106')](_0x208689,_0x1a9d6c),{'proactiveActions':_0x369d27,'alignment':_0x5bdabd[_0xff6e('0x107')],'verticalAlignment':_0x5bdabd[_0xff6e('0x108')],'div_color':_0x5bdabd[_0xff6e('0xe9')],'labelText':_0x5bdabd[_0xff6e('0x109')],'text_color':_0x5bdabd['textColor'],'text_button_color':_0x5bdabd['textButtonColor'],'button_color':_0x5bdabd['color_button'],'background_color':_0x5bdabd[_0xff6e('0x10a')],'hideWhenOffline':_0x5bdabd[_0xff6e('0x10b')],'interval':_0x5bdabd[_0xff6e('0x10c')]}));})[_0xff6e('0x20')](handleError(_0x1abb92,null));};exports[_0xff6e('0x10d')]=function(_0x2e8882,_0xaeb895){var _0x4e47de=_0x2e8882[_0xff6e('0x4c')]['id'];var _0x56f3c6=_0x2e8882[_0xff6e('0x57')];var _0x13c98b=0xc8;var _0xf1609e=null;return db[_0xff6e('0xce')][_0xff6e('0xcf')]({'isolationLevel':db[_0xff6e('0xce')]['Transaction'][_0xff6e('0x10e')][_0xff6e('0x10f')]},function(_0x2a7893){return db['ChatWebsite'][_0xff6e('0xd2')]({'where':{'id':_0x4e47de},'transaction':_0x2a7893})[_0xff6e('0x2c')](function(_0x550b56){if(_0x550b56){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x4e47de},'transaction':_0x2a7893})[_0xff6e('0x2c')](function(){var _0x451ad6=_[_0xff6e('0x34')](_0x56f3c6,function(_0x50c49b){_0x50c49b[_0xff6e('0x5a')]=_0x4e47de;return _0x50c49b;});return db[_0xff6e('0x92')][_0xff6e('0xd1')](_0x451ad6,{'transaction':_0x2a7893});});}else{_0x13c98b=0x194;_0xf1609e=[];}});})[_0xff6e('0x2c')](function(){if(_0x13c98b!==0x194){return db[_0xff6e('0x92')][_0xff6e('0x110')]({'where':{'ChatWebsiteId':_0x4e47de},'order':_0xff6e('0x111')})[_0xff6e('0x2c')](function(_0x30090f){_0xf1609e=_0x30090f;});}})[_0xff6e('0x20')](function(_0x2d99d6){_0x13c98b=0x1f4;logger[_0xff6e('0x1d')](_0x2d99d6['stack']);if(_0x2d99d6[_0xff6e('0x31')]){delete _0x2d99d6[_0xff6e('0x31')];}_0xf1609e=_0x2d99d6;})[_0xff6e('0x112')](function(){if(_0xf1609e===null){_0xaeb895[_0xff6e('0x21')](_0x13c98b);}else{if(_0x13c98b===0x1f4){_0xaeb895[_0xff6e('0x22')](_0x13c98b)[_0xff6e('0xbe')](_0xf1609e);}else{_0xaeb895[_0xff6e('0x22')](_0x13c98b)[_0xff6e('0x24')](_0xf1609e);}}});};exports[_0xff6e('0x113')]=function(_0x2eae09,_0x5f04df){var _0x2bac27={};var _0x414c33={};var _0x86a5ce;var _0x4ea737;return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0x2eae09[_0xff6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5f04df,null))[_0xff6e('0x2c')](function(_0x215ac1){if(_0x215ac1){_0x86a5ce=_0x215ac1;_0x414c33[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x92')][_0xff6e('0x35')]);_0x414c33[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x2eae09[_0xff6e('0x39')]);_0x414c33[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x414c33['model'],_0x414c33[_0xff6e('0x39')]);_0x2bac27[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x414c33['model'],qs['fields'](_0x2eae09['query'][_0xff6e('0x3d')]));_0x2bac27[_0xff6e('0x3e')]=_0x2bac27['attributes']['length']?_0x2bac27['attributes']:_0x414c33[_0xff6e('0x3c')];_0x2bac27[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x2eae09['query']['sort']);_0x2bac27[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x2eae09['query'],_0x414c33['filters']));if(_0x2eae09[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x2bac27[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x2bac27[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x2bac27[_0xff6e('0x3e')],function(_0x25d403){var _0x1a5838={};_0x1a5838[_0x25d403]={'$like':'%'+_0x2eae09[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x1a5838;})});}_0x2bac27=_[_0xff6e('0x46')]({},_0x2bac27,_0x2eae09[_0xff6e('0x5e')]);return _0x86a5ce[_0xff6e('0x113')](_0x2bac27);}})[_0xff6e('0x2c')](function(_0x21ee5b){if(_0x21ee5b){_0x4ea737=_0x21ee5b[_0xff6e('0x3f')];if(!_0x2eae09[_0xff6e('0x39')][_0xff6e('0x40')]('nolimit')){_0x2bac27['limit']=qs[_0xff6e('0x28')](_0x2eae09['query'][_0xff6e('0x28')]);_0x2bac27[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0x2eae09[_0xff6e('0x39')]['offset']);}return _0x86a5ce[_0xff6e('0x113')](_0x2bac27);}})[_0xff6e('0x2c')](function(_0x15efa4){if(_0x15efa4){return _0x15efa4?{'count':_0x4ea737,'rows':_0x15efa4}:null;}})[_0xff6e('0x2c')](respondWithResult(_0x5f04df,null))[_0xff6e('0x20')](handleError(_0x5f04df,null));};exports[_0xff6e('0x114')]=function(_0x459831,_0x3ff6e7){return db[_0xff6e('0x115')][_0xff6e('0x56')]({'where':{'id':_0x459831[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x3ff6e7,null))['then'](function(_0xd62685){if(_0xd62685){return _0xd62685['addProactiveActions'](_0x459831[_0xff6e('0x57')][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x459831[_0xff6e('0x57')],['ids','id'])||{});}})[_0xff6e('0x2c')](respondWithResult(_0x3ff6e7,null))['catch'](handleError(_0x3ff6e7,null));};exports['getProactiveActions']=function(_0xf21bf7,_0x9c6bb6){var _0x3d6de6={};var _0x3a4913={};var _0x14e413;var _0x4bc71f;return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0xf21bf7['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x9c6bb6,null))[_0xff6e('0x2c')](function(_0x3e7179){if(_0x3e7179){_0x14e413=_0x3e7179;_0x3a4913['model']=_[_0xff6e('0x4d')](db[_0xff6e('0x116')]['rawAttributes']);_0x3a4913[_0xff6e('0x39')]=_['keys'](_0xf21bf7[_0xff6e('0x39')]);_0x3a4913[_0xff6e('0x3a')]=_[_0xff6e('0x3b')](_0x3a4913[_0xff6e('0x3c')],_0x3a4913[_0xff6e('0x39')]);_0x3d6de6[_0xff6e('0x3e')]=_[_0xff6e('0x3b')](_0x3a4913['model'],qs[_0xff6e('0x3d')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x3d6de6[_0xff6e('0x3e')]=_0x3d6de6['attributes'][_0xff6e('0x3f')]?_0x3d6de6['attributes']:_0x3a4913['model'];_0x3d6de6[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x43')]);_0x3d6de6[_0xff6e('0x44')]=qs['filters'](_['pick'](_0xf21bf7[_0xff6e('0x39')],_0x3a4913[_0xff6e('0x3a')]));if(_0xf21bf7[_0xff6e('0x39')]['filter']){_0x3d6de6[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x3d6de6[_0xff6e('0x44')],{'$or':_[_0xff6e('0x34')](_0x3d6de6[_0xff6e('0x3e')],function(_0x651f8c){var _0x40564d={};_0x40564d[_0x651f8c]={'$like':'%'+_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x40564d;})});}_0x3d6de6=_[_0xff6e('0x46')]({},_0x3d6de6,_0xf21bf7[_0xff6e('0x5e')]);return _0x14e413[_0xff6e('0xfa')](_0x3d6de6);}})['then'](function(_0x188ae0){if(_0x188ae0){_0x4bc71f=_0x188ae0[_0xff6e('0x3f')];if(!_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x3d6de6[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x28')]);_0x3d6de6[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0xf21bf7[_0xff6e('0x39')][_0xff6e('0x25')]);}return _0x14e413['getProactiveActions'](_0x3d6de6);}})[_0xff6e('0x2c')](function(_0x23191f){if(_0x23191f){return _0x23191f?{'count':_0x4bc71f,'rows':_0x23191f}:null;}})['then'](respondWithResult(_0x9c6bb6,null))[_0xff6e('0x20')](handleError(_0x9c6bb6,null));};exports[_0xff6e('0x117')]=function(_0x5e5b4e,_0x483839){var _0x56a65b=_0x5e5b4e[_0xff6e('0x39')][_0xff6e('0x118')]===_0xff6e('0x119')?_0xff6e('0x11a'):_0xff6e('0x11b');return db['ChatWebsite'][_0xff6e('0x56')]({'attributes':['id',_0x56a65b],'where':{'id':_0x5e5b4e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x483839,null))['then'](function(_0x408e3f){if(_0x408e3f){var _0x2484d2=_0x408e3f[_0x56a65b];var _0x45d38d=_0x2484d2&&_0x2484d2[_0xff6e('0x11c')]?_0x2484d2[_0xff6e('0x11c')]:[];_0x483839[_0xff6e('0xbe')]({'fromKey':_['isNil'](_0x2484d2['fromKey'])?undefined:_0x2484d2[_0xff6e('0x11d')],'count':_0x45d38d[_0xff6e('0x3f')],'rows':_0x45d38d});}})[_0xff6e('0x20')](handleError(_0x483839,null));};exports[_0xff6e('0x11e')]=function(_0x3988b3,_0x200ce0){var _0x77ccce={'raw':![],'where':{}};var _0x10e917={};var _0x49b45a={'count':0x0,'rows':[]};return db[_0xff6e('0x48')][_0xff6e('0xd2')]({'where':{'id':_0x3988b3['params']['id']}})['then'](handleEntityNotFound(_0x200ce0,null))['then'](function(_0x366a4f){if(_0x366a4f){_0x10e917[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0x11f')][_0xff6e('0x35')]);_0x10e917[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x3988b3[_0xff6e('0x39')]);_0x10e917['filters']=_[_0xff6e('0x3b')](_0x10e917['model'],_0x10e917[_0xff6e('0x39')]);_0x77ccce[_0xff6e('0x3e')]=_['intersection'](_0x10e917[_0xff6e('0x3c')],qs['fields'](_0x3988b3[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x77ccce[_0xff6e('0x3e')]=_0x77ccce['attributes'][_0xff6e('0x3f')]?_0x77ccce['attributes']:_0x10e917['model'];if(!_0x3988b3[_0xff6e('0x39')][_0xff6e('0x40')](_0xff6e('0x41'))){_0x77ccce[_0xff6e('0x28')]=qs[_0xff6e('0x28')](_0x3988b3[_0xff6e('0x39')][_0xff6e('0x28')]);_0x77ccce[_0xff6e('0x25')]=qs['offset'](_0x3988b3[_0xff6e('0x39')]['offset']);}_0x77ccce[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x3988b3['query'][_0xff6e('0x43')]);_0x77ccce[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x3988b3[_0xff6e('0x39')],_0x10e917[_0xff6e('0x3a')]));_0x77ccce['where'][_0xff6e('0x5a')]=_0x366a4f['id'];if(_0x3988b3[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x77ccce[_0xff6e('0x44')]=_[_0xff6e('0x46')](_0x77ccce[_0xff6e('0x44')],{'$or':_['map'](_0x77ccce[_0xff6e('0x3e')],function(_0x165665){var _0x4fe841={};_0x4fe841[_0x165665]={'$like':'%'+_0x3988b3[_0xff6e('0x39')][_0xff6e('0x5d')]+'%'};return _0x4fe841;})});}_0x77ccce=_[_0xff6e('0x46')]({},_0x77ccce,_0x3988b3[_0xff6e('0x5e')]);return db['ChatOfflineMessage'][_0xff6e('0x27')]({'where':_0x77ccce['where']})[_0xff6e('0x2c')](function(_0x56fd15){_0x49b45a[_0xff6e('0x27')]=_0x56fd15;if(_0x3988b3[_0xff6e('0x39')]['includeAll']){_0x77ccce[_0xff6e('0x49')]=[{'all':!![]}];}else{_0x77ccce[_0xff6e('0x49')]=[{'model':db['CmContact'],'as':_0xff6e('0xe5'),'required':![]},{'model':db[_0xff6e('0xd0')],'as':'Attachments','required':![]}];}return db[_0xff6e('0x11f')][_0xff6e('0x4a')](_0x77ccce);})['then'](function(_0xab1197){_0x49b45a[_0xff6e('0x65')]=_0xab1197;return _0x49b45a;});}})[_0xff6e('0x2c')](respondWithFilteredResult(_0x200ce0,_0x77ccce))[_0xff6e('0x20')](handleError(_0x200ce0,null));};exports[_0xff6e('0x120')]=function(_0x328418,_0x1267f4){return db[_0xff6e('0x48')][_0xff6e('0x56')]({'where':{'id':_0x328418[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x1267f4,null))[_0xff6e('0x2c')](function(_0x2504ba){if(_0x2504ba){return _0x2504ba['addAgents'](_0x328418[_0xff6e('0x57')][_0xff6e('0x60')],_[_0xff6e('0xe4')](_0x328418['body'],[_0xff6e('0x60'),'id'])||{})['spread'](function(_0x2cbefc){for(var _0x3c1c83=0x0;_0x3c1c83<_0x328418[_0xff6e('0x57')][_0xff6e('0x60')]['length'];_0x3c1c83+=0x1){socket['emit'](_0xff6e('0x121'),{'UserId':Number(_0x328418['body']['ids'][_0x3c1c83]),'ChatWebsiteId':Number(_0x328418[_0xff6e('0x4c')]['id'])});}return _0x2cbefc;});}})['then'](respondWithResult(_0x1267f4,null))[_0xff6e('0x20')](handleError(_0x1267f4,null));};exports[_0xff6e('0x122')]=function(_0x59a05e,_0x1e64a2){return db[_0xff6e('0x48')]['find']({'where':{'id':_0x59a05e[_0xff6e('0x4c')]['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0x1e64a2,null))['then'](function(_0x1249fa){if(_0x1249fa){return _0x1249fa[_0xff6e('0x122')](_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')])[_0xff6e('0x2c')](function(){if(_[_0xff6e('0x123')](_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')])){for(var _0x124862=0x0;_0x124862<_0x59a05e[_0xff6e('0x39')]['ids']['length'];_0x124862+=0x1){socket[_0xff6e('0x124')](_0xff6e('0x125'),{'UserId':Number(_0x59a05e[_0xff6e('0x39')]['ids'][_0x124862]),'ChatWebsiteId':Number(_0x59a05e[_0xff6e('0x4c')]['id'])});}}else{socket[_0xff6e('0x124')](_0xff6e('0x125'),{'UserId':Number(_0x59a05e[_0xff6e('0x39')][_0xff6e('0x60')]),'ChatWebsiteId':Number(_0x59a05e[_0xff6e('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x1e64a2,null))[_0xff6e('0x20')](handleError(_0x1e64a2,null));};exports[_0xff6e('0x126')]=function(_0x26df71,_0xe5b7a3){var _0x39793f={};var _0x518ccd={};var _0x5851de;var _0x4730e3;return db['ChatWebsite'][_0xff6e('0xd2')]({'where':{'id':_0x26df71['params']['id']}})[_0xff6e('0x2c')](handleEntityNotFound(_0xe5b7a3,null))['then'](function(_0x25711e){if(_0x25711e){_0x5851de=_0x25711e;_0x518ccd[_0xff6e('0x3c')]=_[_0xff6e('0x4d')](db[_0xff6e('0xe6')][_0xff6e('0x35')]);_0x518ccd[_0xff6e('0x39')]=_[_0xff6e('0x4d')](_0x26df71['query']);_0x518ccd['filters']=_[_0xff6e('0x3b')](_0x518ccd['model'],_0x518ccd[_0xff6e('0x39')]);_0x39793f['attributes']=_[_0xff6e('0x3b')](_0x518ccd[_0xff6e('0x3c')],qs['fields'](_0x26df71[_0xff6e('0x39')][_0xff6e('0x3d')]));_0x39793f['attributes']=_0x39793f['attributes'][_0xff6e('0x3f')]?_0x39793f[_0xff6e('0x3e')]:_0x518ccd['model'];_0x39793f[_0xff6e('0x42')]=qs[_0xff6e('0x43')](_0x26df71[_0xff6e('0x39')][_0xff6e('0x43')]);_0x39793f[_0xff6e('0x44')]=qs[_0xff6e('0x3a')](_[_0xff6e('0x45')](_0x26df71[_0xff6e('0x39')],_0x518ccd[_0xff6e('0x3a')]));if(_0x26df71[_0xff6e('0x39')][_0xff6e('0x5d')]){_0x39793f['where']=_[_0xff6e('0x46')](_0x39793f['where'],{'$or':_[_0xff6e('0x34')](_0x39793f['attributes'],function(_0x2424a8){var _0x32de44={};_0x32de44[_0x2424a8]={'$like':'%'+_0x26df71['query']['filter']+'%'};return _0x32de44;})});}_0x39793f=_['merge']({},_0x39793f,_0x26df71['options']);return _0x5851de[_0xff6e('0x126')](_0x39793f);}})['then'](function(_0xb45225){if(_0xb45225){_0x4730e3=_0xb45225[_0xff6e('0x3f')];if(!_0x26df71['query']['hasOwnProperty']('nolimit')){_0x39793f['limit']=qs['limit'](_0x26df71['query'][_0xff6e('0x28')]);_0x39793f[_0xff6e('0x25')]=qs[_0xff6e('0x25')](_0x26df71[_0xff6e('0x39')][_0xff6e('0x25')]);}return _0x5851de[_0xff6e('0x126')](_0x39793f);}})[_0xff6e('0x2c')](function(_0x343f8b){if(_0x343f8b){return _0x343f8b?{'count':_0x4730e3,'rows':_0x343f8b}:null;}})[_0xff6e('0x2c')](respondWithResult(_0xe5b7a3,null))['catch'](handleError(_0xe5b7a3,null));}; \ No newline at end of file +var _0x49e3=['no\x20available\x20attributes','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','push','close','*,*,*,*','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','files','createdAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','NotifyMailAccount','notifyMail','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','remoteAddress','render','alignment','verticalAlignment','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','rawAttributes','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x49e3,0x1ce));var _0x349e=function(_0xc9d31b,_0x1554a7){_0xc9d31b=_0xc9d31b-0x0;var _0x1bc442=_0x49e3[_0xc9d31b];return _0x1bc442;};'use strict';var BPromise=require(_0x349e('0x0'));var Mustache=require(_0x349e('0x1'));var util=require('util');var path=require(_0x349e('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var Redis=require(_0x349e('0x3'));var qs=require(_0x349e('0x4'));var logger=require(_0x349e('0x5'))(_0x349e('0x6'));var config=require(_0x349e('0x7'));var db=require(_0x349e('0x8'))['db'];config['redis']=_[_0x349e('0x9')](config[_0x349e('0xa')],{'host':_0x349e('0xb'),'port':0x18eb});var socket=require(_0x349e('0xc'))(new Redis(config[_0x349e('0xa')]));require(_0x349e('0xd'))[_0x349e('0xe')](socket);var htmlToText=require(_0x349e('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x349e('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x349e('0x10')][_0x349e('0x11')]({'port':0x232a});var client9003=jayson['client'][_0x349e('0x11')]({'port':0x232b});var client9001=jayson[_0x349e('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3211ea,_0x46c8e9,_0x209184,_0x1a7a9a){return new BPromise(function(_0x41b65a,_0x1de36d){var _0x1d9e82=_0x1a7a9a||client;return _0x1d9e82[_0x349e('0x12')](_0x3211ea,_0x209184)[_0x349e('0x13')](function(_0x1a56fd){logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));logger[_0x349e('0x17')](_0x349e('0x18'),_0x46c8e9,'request\x20sent',JSON[_0x349e('0x19')](_0x1a56fd));if(_0x1a56fd[_0x349e('0x1a')]){if(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1b')]===0x1f4){logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x1de36d(_0x1a56fd['error']['message']);}logger[_0x349e('0x1a')](_0x349e('0x15'),_0x46c8e9,_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);return _0x41b65a(_0x1a56fd[_0x349e('0x1a')][_0x349e('0x1c')]);}else{logger[_0x349e('0x14')](_0x349e('0x15'),_0x46c8e9,_0x349e('0x16'));_0x41b65a(_0x1a56fd[_0x349e('0x1d')][_0x349e('0x1c')]);}})['catch'](function(_0x47ac78){logger[_0x349e('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x46c8e9,_0x47ac78);_0x1de36d(_0x47ac78);});});}function respondWithStatusCode(_0x3283bc,_0xdaca79){_0xdaca79=_0xdaca79||0xcc;return function(_0x208b8b){if(_0x208b8b){return _0x3283bc[_0x349e('0x1e')](_0xdaca79);}return _0x3283bc['status'](_0xdaca79)['end']();};}function respondWithResult(_0x54bce0,_0x188e18){_0x188e18=_0x188e18||0xc8;return function(_0x558bb7){if(_0x558bb7){return _0x54bce0[_0x349e('0x1f')](_0x188e18)[_0x349e('0x20')](_0x558bb7);}};}function respondWithFilteredResult(_0x2e1710,_0x43a218){return function(_0xd79a46){if(_0xd79a46){var _0x319d68=typeof _0x43a218[_0x349e('0x21')]==='undefined'&&typeof _0x43a218['limit']==='undefined';var _0x4610e0=_0xd79a46[_0x349e('0x22')];var _0x4c112a=_0x319d68?0x0:_0x43a218[_0x349e('0x21')];var _0x2fcd57=_0x319d68?_0xd79a46[_0x349e('0x22')]:_0x43a218[_0x349e('0x21')]+_0x43a218[_0x349e('0x23')];var _0x58b364;if(_0x2fcd57>=_0x4610e0){_0x2fcd57=_0x4610e0;_0x58b364=0xc8;}else{_0x58b364=0xce;}_0x2e1710[_0x349e('0x1f')](_0x58b364);return _0x2e1710[_0x349e('0x24')](_0x349e('0x25'),_0x4c112a+'-'+_0x2fcd57+'/'+_0x4610e0)[_0x349e('0x20')](_0xd79a46);}return null;};}function saveUpdates(_0x5ae29c){return function(_0xaf1b8){if(_0xaf1b8){return _0xaf1b8[_0x349e('0x26')](_0x5ae29c)['then'](function(_0x48aa70){return _0x48aa70;});}return null;};}function removeEntity(_0x1a4cf2){return function(_0x31944f){if(_0x31944f){return _0x31944f[_0x349e('0x27')]()['then'](function(){var _0xb56f9b=_0x31944f[_0x349e('0x28')]({'plain':!![]});var _0x4be34d=_0x349e('0x29');return db[_0x349e('0x2a')][_0x349e('0x27')]({'where':{'type':_0x4be34d,'resourceId':_0xb56f9b['id']}})['then'](function(){return _0x31944f;});})[_0x349e('0x13')](function(){_0x1a4cf2[_0x349e('0x1f')](0xcc)[_0x349e('0x2b')]();});}};}function handleEntityNotFound(_0x44c17b){return function(_0xae5811){if(!_0xae5811){_0x44c17b[_0x349e('0x1e')](0x194);}return _0xae5811;};}function handleError(_0x15823d,_0x1003a2){_0x1003a2=_0x1003a2||0x1f4;return function(_0x2db35f){logger[_0x349e('0x1a')](_0x2db35f['stack']);if(_0x2db35f[_0x349e('0x2c')]){delete _0x2db35f[_0x349e('0x2c')];}_0x15823d[_0x349e('0x1f')](_0x1003a2)[_0x349e('0x2d')](_0x2db35f);};}exports['index']=function(_0x2aeb27,_0x296619){var _0x36c2d7={'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0x4842a4={},_0x556d24={'count':0x0,'rows':[]};var _0xef7ba7=_[_0x349e('0x30')](db[_0x349e('0x31')]['rawAttributes'],function(_0x3f8c5c){return{'name':_0x3f8c5c[_0x349e('0x32')],'type':_0x3f8c5c[_0x349e('0x33')][_0x349e('0x34')]};});_0x4842a4['model']=_['map'](_0xef7ba7,'name');_0x4842a4[_0x349e('0x35')]=_[_0x349e('0x36')](_0x2aeb27[_0x349e('0x35')]);_0x4842a4[_0x349e('0x37')]=_[_0x349e('0x38')](_0x4842a4[_0x349e('0x39')],_0x4842a4[_0x349e('0x35')]);_0x36c2d7['attributes']=_[_0x349e('0x38')](_0x4842a4['model'],qs[_0x349e('0x3a')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3a')]));_0x36c2d7[_0x349e('0x3b')]=_0x36c2d7[_0x349e('0x3b')][_0x349e('0x3c')]?_0x36c2d7[_0x349e('0x3b')]:_0x4842a4['model'];if(!_0x2aeb27[_0x349e('0x35')]['hasOwnProperty'](_0x349e('0x3d'))){_0x36c2d7[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x2aeb27['query'][_0x349e('0x23')]);_0x36c2d7[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x21')]);}_0x36c2d7['order']=qs[_0x349e('0x3e')](_0x2aeb27[_0x349e('0x35')][_0x349e('0x3e')]);_0x36c2d7[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x2aeb27[_0x349e('0x35')],_0x4842a4['filters']),_0xef7ba7);if(_0x2aeb27[_0x349e('0x35')][_0x349e('0x41')]){_0x36c2d7[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x36c2d7[_0x349e('0x3f')],{'$or':_['map'](_0xef7ba7,function(_0x5a43cd){if(_0x5a43cd['type']!==_0x349e('0x43')){var _0xc40996={};_0xc40996[_0x5a43cd[_0x349e('0x2c')]]={'$like':'%'+_0x2aeb27[_0x349e('0x35')]['filter']+'%'};return _0xc40996;}})});}_0x36c2d7=_[_0x349e('0x42')]({},_0x36c2d7,_0x2aeb27['options']);var _0x198385={'where':_0x36c2d7[_0x349e('0x3f')]};return db[_0x349e('0x31')][_0x349e('0x22')](_0x198385)[_0x349e('0x13')](function(_0x37882d){_0x556d24[_0x349e('0x22')]=_0x37882d;if(_0x2aeb27[_0x349e('0x35')]['includeAll']){_0x36c2d7[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x31')][_0x349e('0x45')](_0x36c2d7);})[_0x349e('0x13')](function(_0x51a691){_0x556d24[_0x349e('0x46')]=_0x51a691;return _0x556d24;})['then'](respondWithFilteredResult(_0x296619,_0x36c2d7))[_0x349e('0x47')](handleError(_0x296619,null));};exports[_0x349e('0x48')]=function(_0x47fc02,_0x499f6b){var _0x40fae6={'raw':![],'where':{'id':_0x47fc02[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]},_0xd9bd7e={};_0xd9bd7e['model']=_[_0x349e('0x36')](db[_0x349e('0x31')]['rawAttributes']);_0xd9bd7e['query']=_[_0x349e('0x36')](_0x47fc02[_0x349e('0x35')]);_0xd9bd7e[_0x349e('0x37')]=_[_0x349e('0x38')](_0xd9bd7e[_0x349e('0x39')],_0xd9bd7e[_0x349e('0x35')]);_0x40fae6['attributes']=_['intersection'](_0xd9bd7e[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x47fc02[_0x349e('0x35')]['fields']));_0x40fae6[_0x349e('0x3b')]=_0x40fae6[_0x349e('0x3b')]['length']?_0x40fae6['attributes']:_0xd9bd7e[_0x349e('0x39')];if(_0x47fc02['query'][_0x349e('0x4a')]){_0x40fae6['include']=[{'all':!![]}];}_0x40fae6=_[_0x349e('0x42')]({},_0x40fae6,_0x47fc02['options']);return db[_0x349e('0x31')]['find'](_0x40fae6)[_0x349e('0x13')](handleEntityNotFound(_0x499f6b,null))[_0x349e('0x13')](respondWithResult(_0x499f6b,null))[_0x349e('0x47')](handleError(_0x499f6b,null));};exports['create']=function(_0x647d22,_0x12eb63){return db[_0x349e('0x31')]['create'](_0x647d22[_0x349e('0x4b')],{})['then'](function(_0x3e6a74){var _0x44d03d=_0x647d22[_0x349e('0x4c')]['get']({'plain':!![]});if(!_0x44d03d)throw new Error(_0x349e('0x4d'));if(_0x44d03d[_0x349e('0x4e')]==='user'){var _0x3ae0b9=_0x3e6a74['get']({'plain':!![]});var _0x7f9868=_0x349e('0x29');return db[_0x349e('0x4f')][_0x349e('0x50')]({'where':{'name':_0x7f9868,'userProfileId':_0x44d03d[_0x349e('0x51')]},'raw':!![]})['then'](function(_0x469931){if(_0x469931&&_0x469931['autoAssociation']===0x0){return db[_0x349e('0x2a')][_0x349e('0x52')]({'name':_0x3ae0b9[_0x349e('0x2c')],'resourceId':_0x3ae0b9['id'],'type':_0x469931[_0x349e('0x2c')],'sectionId':_0x469931['id']},{})[_0x349e('0x13')](function(){return _0x3e6a74;});}else{return _0x3e6a74;}})[_0x349e('0x47')](function(_0x1f709c){logger[_0x349e('0x1a')](_0x349e('0x53'),_0x1f709c);throw _0x1f709c;});}return _0x3e6a74;})[_0x349e('0x13')](respondWithResult(_0x12eb63,0xc9))[_0x349e('0x47')](handleError(_0x12eb63,null));};exports['update']=function(_0x112da8,_0x48b5e4){if(_0x112da8[_0x349e('0x4b')]['id']){delete _0x112da8[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x112da8['params']['id']},'include':[{'model':db[_0x349e('0x2e')],'as':_0x349e('0x2f')}]})[_0x349e('0x13')](handleEntityNotFound(_0x48b5e4,null))[_0x349e('0x13')](saveUpdates(_0x112da8['body'],null))[_0x349e('0x13')](respondWithResult(_0x48b5e4,null))['catch'](handleError(_0x48b5e4,null));};exports[_0x349e('0x27')]=function(_0x3ed95a,_0x550e0a){return db['ChatWebsite']['find']({'where':{'id':_0x3ed95a[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x550e0a,null))[_0x349e('0x13')](removeEntity(_0x550e0a,null))[_0x349e('0x47')](handleError(_0x550e0a,null));};exports[_0x349e('0x54')]=function(_0x7e03b3,_0x3011ce){return db[_0x349e('0x31')][_0x349e('0x54')]()['then'](respondWithResult(_0x3011ce,null))[_0x349e('0x47')](handleError(_0x3011ce,null));};exports['addDisposition']=function(_0xe813e2,_0x4c5580){if(_0xe813e2[_0x349e('0x4b')]['id']){delete _0xe813e2[_0x349e('0x4b')]['id'];}return db['ChatWebsite'][_0x349e('0x50')]({'where':{'id':_0xe813e2[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c5580,null))[_0x349e('0x13')](function(_0x53d3d4){if(_0x53d3d4){_0xe813e2[_0x349e('0x4b')][_0x349e('0x55')]=_0x53d3d4['id'];return db[_0x349e('0x56')][_0x349e('0x52')](_0xe813e2[_0x349e('0x4b')]);}})['then'](respondWithResult(_0x4c5580,null))[_0x349e('0x47')](handleError(_0x4c5580,null));};exports[_0x349e('0x57')]=function(_0xe12d3,_0x49e064){var _0x5db83e={'raw':![],'where':{}};var _0x392560={};var _0xfd0be4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xe12d3[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x49e064,null))[_0x349e('0x13')](function(_0x3b22e5){if(_0x3b22e5){_0x392560[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x56')]['rawAttributes']);_0x392560[_0x349e('0x35')]=_[_0x349e('0x36')](_0xe12d3[_0x349e('0x35')]);_0x392560['filters']=_[_0x349e('0x38')](_0x392560['model'],_0x392560[_0x349e('0x35')]);_0x5db83e['attributes']=_['intersection'](_0x392560[_0x349e('0x39')],qs[_0x349e('0x3a')](_0xe12d3[_0x349e('0x35')][_0x349e('0x3a')]));_0x5db83e['attributes']=_0x5db83e['attributes'][_0x349e('0x3c')]?_0x5db83e['attributes']:_0x392560[_0x349e('0x39')];if(!_0xe12d3['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x5db83e[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xe12d3[_0x349e('0x35')][_0x349e('0x23')]);_0x5db83e['offset']=qs[_0x349e('0x21')](_0xe12d3[_0x349e('0x35')][_0x349e('0x21')]);}_0x5db83e[_0x349e('0x5a')]=qs['sort'](_0xe12d3[_0x349e('0x35')][_0x349e('0x3e')]);_0x5db83e[_0x349e('0x3f')]=qs['filters'](_[_0x349e('0x40')](_0xe12d3[_0x349e('0x35')],_0x392560[_0x349e('0x37')]));_0x5db83e[_0x349e('0x3f')][_0x349e('0x55')]=_0x3b22e5['id'];if(_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]){_0x5db83e[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x5db83e[_0x349e('0x3f')],{'$or':_['map'](_0x5db83e[_0x349e('0x3b')],function(_0x432bca){var _0x2f97bf={};_0x2f97bf[_0x432bca]={'$like':'%'+_0xe12d3[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x2f97bf;})});}_0x5db83e=_['merge']({},_0x5db83e,_0xe12d3[_0x349e('0x5b')]);return db[_0x349e('0x56')][_0x349e('0x22')]({'where':_0x5db83e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x5284d1){_0xfd0be4[_0x349e('0x22')]=_0x5284d1;if(_0xe12d3[_0x349e('0x35')][_0x349e('0x4a')]){_0x5db83e[_0x349e('0x44')]=[{'all':!![]}];}return db[_0x349e('0x56')][_0x349e('0x45')](_0x5db83e);})[_0x349e('0x13')](function(_0x5e01e7){_0xfd0be4[_0x349e('0x46')]=_0x5e01e7;return _0xfd0be4;});}})['then'](respondWithFilteredResult(_0x49e064,_0x5db83e))[_0x349e('0x47')](handleError(_0x49e064,null));};exports['removeDispositions']=function(_0x24b5dd,_0x1afa3a){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x24b5dd[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1afa3a,null))[_0x349e('0x13')](function(_0x5df967){if(_0x5df967){return _0x5df967[_0x349e('0x5c')](_0x24b5dd[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1afa3a,null))[_0x349e('0x47')](handleError(_0x1afa3a,null));};exports[_0x349e('0x5e')]=function(_0x35ea51,_0x2fc377){if(_0x35ea51[_0x349e('0x4b')]['id']){delete _0x35ea51[_0x349e('0x4b')]['id'];}return db[_0x349e('0x31')]['find']({'where':{'id':_0x35ea51[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x2fc377,null))[_0x349e('0x13')](function(_0x223cb6){if(_0x223cb6){_0x35ea51[_0x349e('0x4b')][_0x349e('0x55')]=_0x223cb6['id'];return db['CannedAnswer']['create'](_0x35ea51[_0x349e('0x4b')]);}})[_0x349e('0x13')](respondWithResult(_0x2fc377,null))['catch'](handleError(_0x2fc377,null));};exports[_0x349e('0x5f')]=function(_0x39afbe,_0x302b73){var _0x4c512e={'raw':![],'where':{}};var _0x2f7423={};var _0x17a023={'count':0x0,'rows':[]};return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x39afbe[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x302b73,null))[_0x349e('0x13')](function(_0x1927c7){if(_0x1927c7){_0x2f7423[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x60')][_0x349e('0x61')]);_0x2f7423[_0x349e('0x35')]=_[_0x349e('0x36')](_0x39afbe[_0x349e('0x35')]);_0x2f7423[_0x349e('0x37')]=_['intersection'](_0x2f7423[_0x349e('0x39')],_0x2f7423[_0x349e('0x35')]);_0x4c512e[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x2f7423[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x39afbe[_0x349e('0x35')][_0x349e('0x3a')]));_0x4c512e['attributes']=_0x4c512e['attributes'][_0x349e('0x3c')]?_0x4c512e[_0x349e('0x3b')]:_0x2f7423['model'];if(!_0x39afbe['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x4c512e[_0x349e('0x23')]=qs['limit'](_0x39afbe[_0x349e('0x35')][_0x349e('0x23')]);_0x4c512e[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x39afbe[_0x349e('0x35')]['offset']);}_0x4c512e[_0x349e('0x5a')]=qs['sort'](_0x39afbe[_0x349e('0x35')][_0x349e('0x3e')]);_0x4c512e[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x39afbe[_0x349e('0x35')],_0x2f7423['filters']));_0x4c512e[_0x349e('0x3f')][_0x349e('0x55')]=_0x1927c7['id'];if(_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]){_0x4c512e[_0x349e('0x3f')]=_['merge'](_0x4c512e[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x4c512e[_0x349e('0x3b')],function(_0x5248e8){var _0x153b7f={};_0x153b7f[_0x5248e8]={'$like':'%'+_0x39afbe[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x153b7f;})});}_0x4c512e=_['merge']({},_0x4c512e,_0x39afbe['options']);return db['CannedAnswer'][_0x349e('0x22')]({'where':_0x4c512e[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x3f2495){_0x17a023['count']=_0x3f2495;if(_0x39afbe[_0x349e('0x35')]['includeAll']){_0x4c512e['include']=[{'all':!![]}];}return db[_0x349e('0x60')][_0x349e('0x45')](_0x4c512e);})[_0x349e('0x13')](function(_0x2087f1){_0x17a023[_0x349e('0x46')]=_0x2087f1;return _0x17a023;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x302b73,_0x4c512e))[_0x349e('0x47')](handleError(_0x302b73,null));};exports[_0x349e('0x62')]=function(_0x28cedf,_0x1006ea){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x28cedf[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x1006ea,null))[_0x349e('0x13')](function(_0x4ace29){if(_0x4ace29){return _0x4ace29['removeAnswers'](_0x28cedf[_0x349e('0x35')][_0x349e('0x5d')]);}})[_0x349e('0x13')](respondWithStatusCode(_0x1006ea,null))[_0x349e('0x47')](handleError(_0x1006ea,null));};exports[_0x349e('0x63')]=function(_0x50bb54,_0x576f0c){_0x50bb54[_0x349e('0x4b')][_0x349e('0x64')]=_0x50bb54['file'][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x50bb54[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x576f0c,null))[_0x349e('0x13')](saveUpdates(_0x50bb54[_0x349e('0x4b')],null))['then'](respondWithResult(_0x576f0c,null))[_0x349e('0x47')](handleError(_0x576f0c,null));};exports[_0x349e('0x66')]=function(_0x166842,_0xc7e7de){_0x166842[_0x349e('0x4b')][_0x349e('0x67')]=_0x166842[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x166842['params']['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xc7e7de,null))[_0x349e('0x13')](saveUpdates(_0x166842[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0xc7e7de,null))['catch'](handleError(_0xc7e7de,null));};exports[_0x349e('0x69')]=function(_0x21f65d,_0x3a2e2a){_0x21f65d[_0x349e('0x4b')]['customerAvatar']=_0x21f65d[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x21f65d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3a2e2a,null))[_0x349e('0x13')](saveUpdates(_0x21f65d[_0x349e('0x4b')],null))[_0x349e('0x13')](respondWithResult(_0x3a2e2a,null))['catch'](handleError(_0x3a2e2a,null));};exports[_0x349e('0x6a')]=function(_0x2e78cf,_0x10e628){_0x2e78cf[_0x349e('0x4b')][_0x349e('0x6b')]=_0x2e78cf[_0x349e('0x68')][_0x349e('0x65')];return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x2e78cf['params']['id']}})['then'](handleEntityNotFound(_0x10e628,null))[_0x349e('0x13')](saveUpdates(_0x2e78cf['body'],null))[_0x349e('0x13')](respondWithResult(_0x10e628,null))[_0x349e('0x47')](handleError(_0x10e628,null));};exports[_0x349e('0x6c')]=function(_0x141cfb,_0x586bd0){var _0x2d5945=path['join'](config[_0x349e('0x6d')],_0x349e('0x6e'));var _0x490a01={'where':{'id':_0x141cfb['params']['id']},'attributes':['id',_0x349e('0x64')],'raw':!![]};var _0x5d68e3=![];return require('../../config/license/util')[_0x349e('0x6f')]()[_0x349e('0x13')](function(_0x25dfbf){if(_0x25dfbf){_0x5d68e3=_0x25dfbf[_0x349e('0x70')];}})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')](_0x490a01);})[_0x349e('0x13')](handleEntityNotFound(_0x586bd0,null))[_0x349e('0x13')](function(_0x29d583){if(_0x29d583){if(!_[_0x349e('0x71')](_0x29d583[_0x349e('0x64')])){if(fs[_0x349e('0x72')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583[_0x349e('0x64')]))&&_0x5d68e3){_0x2d5945=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x74'),_0x29d583['sitepic']);}}return _0x586bd0[_0x349e('0x75')](_0x2d5945);}})[_0x349e('0x47')](handleError(_0x586bd0,null));};exports['getAvatar']=function(_0x5bf46d,_0x1f7cbc){var _0x23ffa7=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x76'));var _0x462ced={'where':{'id':_0x5bf46d[_0x349e('0x49')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x462ced)['then'](handleEntityNotFound(_0x1f7cbc,null))[_0x349e('0x13')](function(_0x4fc076){if(_0x4fc076){if(!_[_0x349e('0x71')](_0x4fc076['agentAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]))){_0x23ffa7=path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x4fc076[_0x349e('0x67')]);}}return _0x1f7cbc[_0x349e('0x75')](_0x23ffa7);}})[_0x349e('0x47')](handleError(_0x1f7cbc,null));};exports[_0x349e('0x78')]=function(_0x5a6520,_0x30b69d){var _0x21b78c=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x79'));var _0x1293e9={'where':{'id':_0x5a6520[_0x349e('0x49')]['id']},'attributes':['id','customerAvatar',_0x349e('0x7a')],'raw':!![]};return db[_0x349e('0x31')][_0x349e('0x50')](_0x1293e9)[_0x349e('0x13')](handleEntityNotFound(_0x30b69d,null))[_0x349e('0x13')](function(_0x61075b){if(_0x61075b){if(!_['isNil'](_0x61075b['customerAvatar'])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]))&&_0x61075b[_0x349e('0x7a')]){_0x21b78c=path[_0x349e('0x73')](config['root'],_0x349e('0x77'),_0x61075b[_0x349e('0x7b')]);}}return _0x30b69d[_0x349e('0x75')](_0x21b78c);}})[_0x349e('0x47')](handleError(_0x30b69d,null));};exports[_0x349e('0x7c')]=function(_0x373003,_0x27fccb){var _0x3778d8=path['join'](config['root'],_0x349e('0x7d'));var _0x4d711e={'where':{'id':_0x373003[_0x349e('0x49')]['id']},'attributes':['id',_0x349e('0x6b')],'raw':!![]};return db['ChatWebsite'][_0x349e('0x50')](_0x4d711e)[_0x349e('0x13')](handleEntityNotFound(_0x27fccb,null))[_0x349e('0x13')](function(_0x150451){if(_0x150451){if(!_[_0x349e('0x71')](_0x150451[_0x349e('0x6b')])){if(fs[_0x349e('0x72')](path['join'](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451['systemAvatar']))){_0x3778d8=path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0x77'),_0x150451[_0x349e('0x6b')]);}}return _0x27fccb[_0x349e('0x75')](_0x3778d8);}})[_0x349e('0x47')](handleError(_0x27fccb,null));};exports[_0x349e('0x7e')]=function(_0x199844,_0x1739f8){var _0x3fa3ed=require(_0x349e('0x7f'));var _0x2c54b9=new _0x3fa3ed();var _0x2dd88c=_0x2c54b9[_0x349e('0x80')](_0x199844[_0x349e('0x81')][_0x349e('0x82')])[_0x349e('0x83')]();var _0x28ebd1={'body':_0x199844[_0x349e('0x4b')],'channel':_0x349e('0x84')};var _0x17a9be=[];var _0x1d59c6=[];var _0x12672f={};var _0x394c31=![];return db[_0x349e('0x85')][_0x349e('0x54')]()[_0x349e('0x13')](function(_0x5e7251){if(!_0x5e7251){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x88'));}_0x17a9be=_[_0x349e('0x89')](_['keys'](_0x5e7251),['createdAt','updatedAt']);_0x1d59c6=_['difference'](_['keys'](_0x5e7251),['createdAt','updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x199844[_0x349e('0x4b')]['id']){delete _0x199844['body']['id'];}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8c')])){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x4b')])||_0x199844['body'][_0x349e('0x4b')]===''){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8e'));}if(_[_0x349e('0x71')](_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0x90')+_0x1d59c6);}if(!_[_0x349e('0x91')](_0x1d59c6,_0x199844[_0x349e('0x4b')][_0x349e('0x8f')])){throw new db['Sequelize'][(_0x349e('0x87'))](_0x349e('0x92')+_0x1d59c6);}_0x12672f[_0x199844[_0x349e('0x4b')][_0x349e('0x8f')]]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x199844[_0x349e('0x49')]['id']},'include':[{'model':db['CmList'],'as':_0x349e('0x93'),'include':[{'model':db[_0x349e('0x85')],'as':_0x349e('0x94'),'where':_0x12672f,'limit':0x1,'order':[[_0x349e('0x95'),_0x349e('0x96')]]}]},{'model':db[_0x349e('0x97')],'as':_0x349e('0x98')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x5cad2c){if(_0x5cad2c&&_0x5cad2c[_0x349e('0x93')]){_0x28ebd1[_0x349e('0x99')]=_0x5cad2c;_0x28ebd1[_0x349e('0x9a')]=_0x5cad2c['Applications'];_0x28ebd1[_0x349e('0x9b')]=_0x5cad2c[_0x349e('0x93')];_0x28ebd1['applications']=_[_0x349e('0x9c')](_0x28ebd1[_0x349e('0x9a')],[_0x349e('0x9d')],[_0x349e('0x9e')]);if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x98')]){delete _0x28ebd1['account'][_0x349e('0x98')];}if(_0x28ebd1[_0x349e('0x99')][_0x349e('0x93')]&&_0x28ebd1[_0x349e('0x99')]['List']['Contacts'][_0x349e('0x3c')]){return _0x28ebd1[_0x349e('0x99')]['List'][_0x349e('0x94')][0x0];}var _0x13c863=_[_0x349e('0x9')](_0x199844[_0x349e('0x4b')],{'firstName':_0x199844[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0x5cad2c[_0x349e('0x8b')]});_0x13c863[_0x199844['body']['mapKey']]=_0x199844[_0x349e('0x4b')][_0x349e('0x8c')];return db['CmContact'][_0x349e('0x52')](_0x13c863,{'fields':_0x17a9be,'raw':!![]});}})[_0x349e('0x13')](handleEntityNotFound(_0x1739f8,null))[_0x349e('0x13')](function(_0x28af59){_0x28ebd1[_0x349e('0x9f')]=_0x28af59;var _0x45b78a=_0x199844['body'][_0x349e('0xa0')];if(_0x199844['headers']['cf-connecting-ip']){_0x45b78a=_0x199844[_0x349e('0x81')][_0x349e('0xa1')];}else if(_0x199844[_0x349e('0x81')][_0x349e('0xa2')]){_0x45b78a=_['first'](_0x199844[_0x349e('0x81')][_0x349e('0xa2')][_0x349e('0xa3')](','));}if(_0x28af59){var _0x53ab06={'ContactId':_0x28af59['id'],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'from':(_0x28af59[_0x349e('0xa4')]||'')+'\x20'+(_0x28af59[_0x349e('0xa5')]||''),'customerIp':_0x45b78a,'customerPort':_0x199844[_0x349e('0x81')][_0x349e('0xa6')]?_0x199844[_0x349e('0x81')]['x-real-port']:null,'referer':_0x199844['body'][_0x349e('0xa7')],'browserName':_0x2dd88c[_0x349e('0xa8')]['name']&&_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]?util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['browser']['name'],_0x2dd88c[_0x349e('0xa8')][_0x349e('0xa9')]):_0x349e('0xac'),'browserVersion':_0x2dd88c[_0x349e('0xa8')]['version']||_0x349e('0xac'),'osName':util[_0x349e('0xaa')](_0x349e('0xab'),_0x2dd88c['os'][_0x349e('0x2c')],_0x2dd88c['os'][_0x349e('0xa9')]),'osVersion':_0x2dd88c['os'][_0x349e('0xa9')],'deviceModel':_0x2dd88c[_0x349e('0xad')][_0x349e('0x39')]&&_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')]?util[_0x349e('0xaa')]('%s\x20%s\x20%s',_0x2dd88c[_0x349e('0xad')]['model'],_0x2dd88c['device'][_0x349e('0xae')],_0x2dd88c['device'][_0x349e('0x33')]):null,'deviceVendor':_0x2dd88c[_0x349e('0xad')][_0x349e('0xae')],'deviceType':_0x2dd88c['device'][_0x349e('0x33')],'formData':JSON['stringify'](_0x199844[_0x349e('0x4b')])};var _0x30a6fe={'ChatWebsiteId':_0x199844['params']['id'],'closed':![]};if(_0x199844['body'][_0x349e('0xaf')]){_0x30a6fe['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x2f687e){if(_0x2f687e){return[_0x2f687e,![]];}_0x53ab06['threadId']=_0x199844[_0x349e('0x4b')]['threadId'];_0x53ab06[_0x349e('0xb1')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb1')];return db['ChatInteraction']['create'](_0x53ab06)[_0x349e('0x13')](function(_0x379550){return[_0x379550,!![]];});});}_0x30a6fe['ContactId']=_0x28af59['id'];if(_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb2')]['id']){_0x30a6fe['id']=_0x199844['body'][_0x349e('0xb2')]['id'];return db['ChatInteraction']['find']({'where':_0x30a6fe})[_0x349e('0x13')](function(_0x5c89c1){if(_0x5c89c1){return[_0x5c89c1,![]];}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x45c626){return[_0x45c626,!![]];});});}return db[_0x349e('0xb0')][_0x349e('0x52')](_0x53ab06)[_0x349e('0x13')](function(_0x3b0808){return[_0x3b0808,!![]];});}})['spread'](function(_0xa09a2e,_0x35e267){if(_0xa09a2e){_0x394c31=_0x35e267;if(!_0x35e267){var _0x285233={'from':(_0x28ebd1[_0x349e('0x9f')]['firstName']||'')+'\x20'+(_0x28ebd1[_0x349e('0x9f')][_0x349e('0xa5')]||'')};if(_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xb3')]&&_0x199844[_0x349e('0x4b')][_0x349e('0xaf')]!=_0x199844['body'][_0x349e('0xb3')]){_0x285233[_0x349e('0xaf')]=_0x199844[_0x349e('0x4b')][_0x349e('0xb3')];}return _0xa09a2e['update'](_0x285233);}else{return _0xa09a2e;}}})[_0x349e('0x13')](function(_0x8a0f78){_0x28ebd1[_0x349e('0xb2')]=_0x8a0f78[_0x349e('0x28')]({'plain':!![]});_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]=_0x394c31;if(_0x28ebd1[_0x349e('0xb2')][_0x349e('0xb4')]){if(_0x28ebd1[_0x349e('0x99')]['autoclose']){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xb5')]({'id':0x0,'priority':_0x28ebd1[_0x349e('0x9a')][_0x349e('0x3c')]+0x1,'app':_0x349e('0xb6'),'appdata':'unmanaged','interval':_0x349e('0xb7')});}}return db['ChatMessage'][_0x349e('0x52')]({'body':_0x199844[_0x349e('0x4b')][_0x349e('0x4b')],'ChatWebsiteId':_0x199844[_0x349e('0x49')]['id'],'ChatInteractionId':_0x8a0f78['id'],'direction':'in','ContactId':_0x28ebd1[_0x349e('0x9f')]['id'],'AttachmentId':_0x199844[_0x349e('0x4b')]['AttachmentId']});})['then'](function(_0x523506){_0x28ebd1[_0x349e('0x1c')]=_0x523506;if(_0x28ebd1['interaction'][_0x349e('0xb8')]){return db[_0x349e('0xb9')][_0x349e('0x50')]({'attributes':['id','name'],'where':{'id':_0x28ebd1['interaction'][_0x349e('0xb8')]}})[_0x349e('0x13')](function(_0x5f3ff4){if(_0x5f3ff4){_0x28ebd1[_0x349e('0x9a')][_0x349e('0xba')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f3ff4[_0x349e('0x2c')]+','+(_0x28ebd1[_0x349e('0x99')][_0x349e('0xbb')]||0xa),'interval':_0x349e('0xb7')});_0x28ebd1[_0x349e('0xbc')]=!![];}return respondWithRpcPromise('Start',_0x349e('0xbd'),_0x28ebd1);});}return respondWithRpcPromise(_0x349e('0xbe'),_0x349e('0xbd'),_0x28ebd1);})[_0x349e('0x13')](function(_0x4aab49){respondWithRpcPromise(_0x349e('0xbf'),_0x349e('0xbf'),{'event':_0x349e('0x7e'),'message':_0x4aab49},client9002);return _0x4aab49;})['then'](respondWithResult(_0x1739f8,null))[_0x349e('0x47')](handleError(_0x1739f8,null));};exports[_0x349e('0xc0')]=function(_0x35ba6b,_0x2409cb){var _0xc97dc6,_0x4c5aff,_0xd08627;var _0x49e7a6=[];var _0x1c4013={};var _0x447660=_0x35ba6b[_0x349e('0xc1')]||[];var _0x550e36=[];var _0x110581;return db[_0x349e('0x85')][_0x349e('0x54')]()['then'](function(_0x5346bd){if(!_0x5346bd){throw new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('no\x20available\x20attributes');}_0x49e7a6=_[_0x349e('0x89')](_[_0x349e('0x36')](_0x5346bd),[_0x349e('0xc2'),'updatedAt',_0x349e('0x8a'),_0x349e('0x8b')]);if(_0x35ba6b[_0x349e('0x4b')]['id']){delete _0x35ba6b[_0x349e('0x4b')]['id'];}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['from'])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))](_0x349e('0x8d')));}if(_[_0x349e('0x71')](_0x35ba6b[_0x349e('0x4b')]['body'])||_0x35ba6b[_0x349e('0x4b')][_0x349e('0x4b')]===''){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))][(_0x349e('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc4')+_0x49e7a6));}if(!_[_0x349e('0x91')](_0x49e7a6,_0x35ba6b[_0x349e('0x4b')][_0x349e('0xc3')])){throw _0x2409cb[_0x349e('0x1f')](0x1f4)[_0x349e('0x2d')](new db[(_0x349e('0x86'))]['ValidationError'](_0x349e('0xc5')+_0x49e7a6));}_0x1c4013[_0x35ba6b[_0x349e('0x4b')]['mapKeyOffline']]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];})['then'](function(){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x35ba6b[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0xc6')],'as':_0x349e('0x93')},{'model':db[_0x349e('0xc7')],'as':_0x349e('0xc7')}]});})[_0x349e('0x13')](handleEntityNotFound(_0x2409cb,null))[_0x349e('0x13')](function(_0xb4a4a){if(_0xb4a4a&&_0xb4a4a[_0x349e('0x93')]){_0x4c5aff=_0xb4a4a;var _0x1d38b6=_[_0x349e('0x9')](_0x35ba6b[_0x349e('0x4b')],{'firstName':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'phone':_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')],'ListId':_0xb4a4a[_0x349e('0x8b')]});_0x1d38b6[_0x35ba6b['body'][_0x349e('0xc3')]]=_0x35ba6b[_0x349e('0x4b')][_0x349e('0x8c')];return db[_0x349e('0x85')][_0x349e('0xc8')]({'where':_0x1c4013,'defaults':_0x1d38b6});}})[_0x349e('0xc9')](function(_0x44c0ef){if(_0x44c0ef){_0xd08627=_0x44c0ef;var _0x22ce44=fs[_0x349e('0xca')](path[_0x349e('0x73')](config[_0x349e('0x6d')],_0x349e('0xcb')),_0x349e('0xcc'));var _0x1425e5=ejs['render'](_0x22ce44,{'body':_[_0x349e('0xcd')](_0x35ba6b[_0x349e('0x4b')]['body']),'bodyTitle':_0x4c5aff[_0x349e('0xce')]});return db[_0x349e('0xcf')][_0x349e('0x52')]({'body':_0x1425e5,'plainBody':htmlToText[_0x349e('0xd0')](_0x1425e5),'ContactId':_0x44c0ef['id'],'ChatWebsiteId':_0x4c5aff['id']});}})['then'](function(_0xbb12e7){_0x110581=_0xbb12e7;if(_0x447660[_0x349e('0x3c')]){var _0x495cc6=_0x447660[_0x349e('0x30')](function(_0x36a9a9){return{'name':_0x36a9a9[_0x349e('0xd1')],'basename':_0x36a9a9[_0x349e('0x65')],'type':_0x36a9a9[_0x349e('0xd2')],'ChatOfflineMessageId':_0xbb12e7['id']};});_0x550e36=_0x495cc6[_0x349e('0x30')](_0x21ddc5=>{var _0x4a42fb={'filename':_0x21ddc5[_0x349e('0x2c')],'path':path[_0x349e('0x73')](config['root'],_0x349e('0xd3'),_0x349e('0xc1'),'attachments',_0x349e('0xd4'),_0x21ddc5[_0x349e('0xd5')])};return _0x4a42fb;});if(!_0x4c5aff[_0x349e('0xd6')]){return db[_0x349e('0xd7')][_0x349e('0xd8')](function(_0x490ff1){return db[_0x349e('0xd9')][_0x349e('0xda')](_0x495cc6,{'transaction':_0x490ff1});});}}})[_0x349e('0x13')](function(){if(_0x110581){_0xc97dc6=_0x110581;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x349e('0xdb')],'as':_0x349e('0xdc'),'raw':!![],'include':[{'model':db[_0x349e('0xdd')],'as':_0x349e('0xdd'),'raw':!![]}]}]});}})['then'](function(_0x5b0f17){if(_0x5b0f17&&_0x5b0f17[_0x349e('0xdc')]&&_0x4c5aff[_0x349e('0xde')]&&_0x4c5aff[_0x349e('0xdf')]){var _0x4109be=_0x5b0f17[_0x349e('0xe0')]();return respondWithRpcPromise(_0x349e('0xe1'),_0x349e('0xe2'),{'account':_0x4109be,'message':{'from':util[_0x349e('0xaa')](_0x349e('0xe3'),_0x5b0f17[_0x349e('0x2c')],_0x5b0f17[_0x349e('0xe4')]||_0x5b0f17[_0x349e('0xdc')][_0x349e('0x4c')]),'to':_0x4c5aff[_0x349e('0xdf')],'subject':_0x4c5aff[_0x349e('0xe5')],'html':_0xc97dc6[_0x349e('0x4b')],'attachments':_0x550e36}},client9003)[_0x349e('0x13')](function(){return _0xc97dc6;})['catch'](function(_0x1fc787){logger[_0x349e('0x1a')](_0x1fc787);});}})[_0x349e('0x13')](function(){if(_0x4c5aff&&_0x4c5aff[_0x349e('0xd6')]&&_0x4c5aff[_0x349e('0xe6')]){var _0x4c8081=[];if(_0x447660[_0x349e('0x3c')]){_0x4c8081=_0x447660['map'](function(_0x12d010){return{'name':_0x12d010['originalname'],'basename':_0x12d010[_0x349e('0x65')],'type':_0x12d010[_0x349e('0xd2')],'ChatOfflineMessageId':_0x110581['id']};});}var _0x26169d;if(!_[_0x349e('0x71')](_0x4c5aff[_0x349e('0xe7')])){var _0x12b819=_[_0x349e('0x30')](_0x35ba6b[_0x349e('0x4b')],function(_0x363ca0){return _0x363ca0;});var _0x1256cb=_['toPairsIn'](_0x12b819)[0x0];var _0x5c225f=_[_0x349e('0xe8')](_0x1256cb,function(_0x11532a){return _0x11532a;});_0x26169d=_0x5c225f[0x1][_0x4c5aff[_0x349e('0xe7')]];}var _0x530b28={'from':_0xd08627['email'],'firstName':_0xd08627[_0x349e('0xa4')],'lastName':_0xd08627['lastName'],'mapKey':'email','message':{'from':_0xd08627[_0x349e('0xe4')],'to':_0x4c5aff[_0x349e('0xc7')][_0x349e('0xe4')],'cc':'','subject':_[_0x349e('0x71')](_0x26169d)?_0x4c5aff[_0x349e('0xe5')]:_0x26169d,'messageId':'','sentAt':new Date(),'attach':_0x4c8081['length'],'attachments':_0x4c8081,'originChannel':'Chat','ChatWebsiteId':_0x4c5aff['id'],'ChatOfflineMessageId':_0xc97dc6['id'],'originTo':_0x4c5aff['MailAccount'][_0x349e('0xe4')]},'body':_0xc97dc6[_0x349e('0x4b')]};var _0x56e974={'account':{'id':_0x4c5aff[_0x349e('0xe6')]},'body':_0x530b28,'log':_0x349e('0xe9')};return respondWithRpcPromise(_0x349e('0xe9'),_0x349e('0xea'),_0x56e974,client9001)[_0x349e('0x13')](function(){return _0xc97dc6;})[_0x349e('0x47')](function(_0x1fa04e){logger[_0x349e('0x1a')](_0x1fa04e);});}return;})[_0x349e('0x13')](function(){if(_0xc97dc6){return _0xc97dc6;}})[_0x349e('0x13')](respondWithResult(_0x2409cb,null))[_0x349e('0x47')](function(_0x45283b){logger[_0x349e('0x1a')](_0x349e('0x47'),_0x45283b);for(var _0x4f67d6 of _0x447660){var _0x16af1a=path['join'](config[_0x349e('0x6d')],_0x349e('0xd3'),'files','attachments',_0x349e('0xd4'),_0x4f67d6[_0x349e('0x65')]);fs_extra['remove'](_0x16af1a)[_0x349e('0x47')](function(_0x237d5e){logger[_0x349e('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x16af1a,_0x237d5e);});}});};exports[_0x349e('0xeb')]=function(_0x116486,_0x83b849){return db[_0x349e('0xb0')][_0x349e('0x50')]({'where':{'id':_0x116486[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x83b849,null))[_0x349e('0x13')](function(_0x4a3a78){if(_0x4a3a78){return _0x4a3a78[_0x349e('0xeb')](_0x116486[_0x349e('0x4b')]['ids'],_['omit'](_0x116486[_0x349e('0x4b')],['ids','id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x83b849,null))[_0x349e('0x47')](handleError(_0x83b849,null));};exports[_0x349e('0xec')]=function(_0x214c00,_0x57f90a){var _0x5ca8ee={'raw':![],'where':{}};var _0x2d6ac6={};var _0x31e7b0={'count':0x0,'rows':[]};return db[_0x349e('0x31')]['findOne']({'where':{'id':_0x214c00[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x57f90a,null))[_0x349e('0x13')](function(_0x30ebdc){if(_0x30ebdc){_0x2d6ac6[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0xb0')][_0x349e('0x61')]);_0x2d6ac6['query']=_[_0x349e('0x36')](_0x214c00['query']);_0x2d6ac6[_0x349e('0x37')]=_[_0x349e('0x38')](_0x2d6ac6[_0x349e('0x39')],_0x2d6ac6[_0x349e('0x35')]);_0x5ca8ee[_0x349e('0x3b')]=_['intersection'](_0x2d6ac6[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x214c00[_0x349e('0x35')][_0x349e('0x3a')]));_0x5ca8ee[_0x349e('0x3b')]=_0x5ca8ee['attributes'][_0x349e('0x3c')]?_0x5ca8ee[_0x349e('0x3b')]:_0x2d6ac6[_0x349e('0x39')];if(!_0x214c00[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x5ca8ee[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x214c00[_0x349e('0x35')][_0x349e('0x23')]);_0x5ca8ee['offset']=qs[_0x349e('0x21')](_0x214c00[_0x349e('0x35')][_0x349e('0x21')]);}_0x5ca8ee[_0x349e('0x5a')]=qs['sort'](_0x214c00[_0x349e('0x35')][_0x349e('0x3e')]);_0x5ca8ee['where']=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x214c00[_0x349e('0x35')],_0x2d6ac6[_0x349e('0x37')]));_0x5ca8ee[_0x349e('0x3f')][_0x349e('0x55')]=_0x30ebdc['id'];if(_0x214c00['query'][_0x349e('0x41')]){_0x5ca8ee['where']=_[_0x349e('0x42')](_0x5ca8ee[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x5ca8ee['attributes'],function(_0x8f9dce){var _0x3a8c4c={};_0x3a8c4c[_0x8f9dce]={'$like':'%'+_0x214c00[_0x349e('0x35')]['filter']+'%'};return _0x3a8c4c;})});}_0x5ca8ee=_['merge']({},_0x5ca8ee,_0x214c00[_0x349e('0x5b')]);return db['ChatInteraction'][_0x349e('0x22')]({'where':_0x5ca8ee[_0x349e('0x3f')]})['then'](function(_0x46ba31){_0x31e7b0[_0x349e('0x22')]=_0x46ba31;if(_0x214c00[_0x349e('0x35')]['includeAll']){_0x5ca8ee[_0x349e('0x44')]=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xb9')],'as':_0x349e('0xee'),'attributes':['name',_0x349e('0xef'),_0x349e('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x349e('0xf1'),'attributes':['id',_0x349e('0x2c'),_0x349e('0xf2')],'where':_0x214c00['query'][_0x349e('0xf3')]?{'id':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]}:undefined,'required':_0x214c00[_0x349e('0x35')][_0x349e('0xf3')]?!![]:![]}];}return db[_0x349e('0xb0')][_0x349e('0x45')](_0x5ca8ee);})[_0x349e('0x13')](function(_0x13a125){_0x31e7b0[_0x349e('0x46')]=_0x13a125;return _0x31e7b0;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x57f90a,_0x5ca8ee))[_0x349e('0x47')](handleError(_0x57f90a,null));};function iftimePromise(_0x44ff12,_0x41dc25){return respondWithRpcPromise(_0x349e('0xf4'),_0x349e('0xf5'),{'command':_0x41dc25[_0x349e('0xf6')]?util[_0x349e('0xaa')]('iftime\x20%s,%s',_0x44ff12[_0x349e('0xf7')],_0x41dc25[_0x349e('0xf6')]):util[_0x349e('0xaa')](_0x349e('0xf8'),_0x44ff12[_0x349e('0xf7')])},client9002)[_0x349e('0x13')](function(_0x4153a6){var _0x30f316=_0x4153a6&&_0x4153a6[_0x349e('0xf9')](_0x349e('0xfa'))>=0x0?!![]:![];logger['info'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],_0x30f316?_0x349e('0xfc'):_0x349e('0xfd'),_0x41dc25[_0x349e('0xf6')]?_0x41dc25['timezone']:_0x349e('0xfe'));return _0x30f316;})['catch'](function(_0x4f6468){logger['error'](_0x349e('0xfb'),_0x41dc25['id'],_0x44ff12['id'],_0x44ff12[_0x349e('0xf7')],util[_0x349e('0xff')](_0x4f6468,{'showHidden':![],'depth':null}),_0x41dc25[_0x349e('0xf6')]?_0x41dc25[_0x349e('0xf6')]:_0x349e('0xfe'));return![];});}exports['getSnippet']=function(_0x20a007,_0x2faa4e){var _0xdcb99=0x0;var _0x1d8c8e=0x0;var _0x1485bd=![];var _0x2659b6;var _0x6e8323;return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x20a007[_0x349e('0x49')]['id']},'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x100'),'include':[{'model':db[_0x349e('0x100')],'as':_0x349e('0x101'),'attributes':['id',_0x349e('0xf7')],'raw':!![]}]}]})[_0x349e('0x13')](handleEntityNotFound(_0x2faa4e,null))[_0x349e('0x13')](function(_0x2a48df){if(_0x2a48df){_0x2659b6=_0x2a48df;return _0x2a48df[_0x349e('0x102')]({'raw':!![]});}})[_0x349e('0x13')](function(_0x89e063){if(_0x2659b6){if(_0x89e063){_0x6e8323=_0x89e063;}}return require(_0x349e('0x103'))['getLicense']();})[_0x349e('0x13')](function(_0x3e4d9d){if(_0x3e4d9d){_0x1d8c8e=_0x3e4d9d[_0x349e('0x104')];_0x1485bd=_0x3e4d9d['custom'];}})[_0x349e('0x13')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x3911aa){_0xdcb99=_0x3911aa;if(_0x1d8c8e&&_0x3911aa>_0x1d8c8e){return db[_0x349e('0x105')][_0x349e('0x58')]({'where':{'id':0x1}})[_0x349e('0x13')](function(_0xba8e5a){if(_0xba8e5a){_0xba8e5a[_0x349e('0x106')](_0x349e('0x107'));}});}})[_0x349e('0x13')](function(){if(_0x2659b6[_0x349e('0x100')]&&_0x2659b6[_0x349e('0x100')][_0x349e('0x101')]){var _0x199b08=[];for(var _0x555c57=0x0;_0x555c57<_0x2659b6[_0x349e('0x100')]['Intervals'][_0x349e('0x3c')];_0x555c57++){var _0xcf4d2a=_0x2659b6[_0x349e('0x100')][_0x349e('0x101')][_0x555c57][_0x349e('0x28')]({'plain':!![]});_0x199b08[_0x349e('0xb5')](iftimePromise(_0xcf4d2a,_0x2659b6));}return BPromise[_0x349e('0x108')](_0x199b08)[_0x349e('0x13')](function(_0x362f2b){return _['some'](_0x362f2b);});}else{return!![];}})[_0x349e('0x13')](function(_0x5ef9a6){var _0x3c5d97=fs[_0x349e('0xca')](path['join'](config['root'],_0x349e('0x109')),_0x349e('0xcc'));var _0x572303={'remote':_0x2659b6[_0x349e('0x10a')],'query':querystring[_0x349e('0x19')](_[_0x349e('0x42')](_0x2659b6[_0x349e('0x28')]({'plain':!![]}),{'customerIp':_0x20a007[_0x349e('0x81')][_0x349e('0xa2')]||_0x20a007[_0x349e('0x81')]['x-real-ip']||_0x20a007['connection'][_0x349e('0x10b')]||_0x20a007['ip'],'referer':_0x20a007[_0x349e('0x81')][_0x349e('0xa7')],'openedInteractions':_0xdcb99,'maxInteractions':_0x1d8c8e,'virtual':_0x1485bd[_0x349e('0x104')],'online':_0x5ef9a6,'custom':_0x1485bd}))['replace'](/'/g,'\x5c\x27')};_0x2faa4e[_0x349e('0x2d')](ejs[_0x349e('0x10c')](Mustache[_0x349e('0x10c')](_0x3c5d97,_0x572303),{'proactiveActions':_0x6e8323,'alignment':_0x2659b6[_0x349e('0x10d')],'verticalAlignment':_0x2659b6[_0x349e('0x10e')],'div_color':_0x2659b6[_0x349e('0xf2')],'labelText':_0x2659b6['labelText'],'text_color':_0x2659b6['textColor'],'text_button_color':_0x2659b6[_0x349e('0x10f')],'button_color':_0x2659b6[_0x349e('0x110')],'background_color':_0x2659b6[_0x349e('0x111')],'hideWhenOffline':_0x2659b6[_0x349e('0x112')],'interval':_0x2659b6[_0x349e('0x113')]}));})[_0x349e('0x47')](handleError(_0x2faa4e,null));};exports['addApplications']=function(_0x8293d9,_0x59a823){var _0x26e8b5=_0x8293d9[_0x349e('0x49')]['id'];var _0x6bd0cd=_0x8293d9[_0x349e('0x4b')];var _0x4a95c4=0xc8;var _0x4a1f92=null;return db['sequelize'][_0x349e('0xd8')]({'isolationLevel':db['sequelize'][_0x349e('0x114')][_0x349e('0x115')][_0x349e('0x116')]},function(_0xdb1721){return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x26e8b5},'transaction':_0xdb1721})['then'](function(_0x13f59d){if(_0x13f59d){return db['ChatApplication'][_0x349e('0x27')]({'where':{'ChatWebsiteId':_0x26e8b5},'transaction':_0xdb1721})[_0x349e('0x13')](function(){var _0x77901c=_[_0x349e('0x30')](_0x6bd0cd,function(_0x52467b){_0x52467b[_0x349e('0x55')]=_0x26e8b5;return _0x52467b;});return db['ChatApplication'][_0x349e('0xda')](_0x77901c,{'transaction':_0xdb1721});});}else{_0x4a95c4=0x194;_0x4a1f92=[];}});})['then'](function(){if(_0x4a95c4!==0x194){return db[_0x349e('0x97')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x26e8b5},'order':_0x349e('0x9d')})['then'](function(_0x26fa8a){_0x4a1f92=_0x26fa8a;});}})[_0x349e('0x47')](function(_0x720286){_0x4a95c4=0x1f4;logger[_0x349e('0x1a')](_0x720286['stack']);if(_0x720286['name']){delete _0x720286[_0x349e('0x2c')];}_0x4a1f92=_0x720286;})[_0x349e('0x117')](function(){if(_0x4a1f92===null){_0x59a823['sendStatus'](_0x4a95c4);}else{if(_0x4a95c4===0x1f4){_0x59a823[_0x349e('0x1f')](_0x4a95c4)[_0x349e('0x2d')](_0x4a1f92);}else{_0x59a823['status'](_0x4a95c4)[_0x349e('0x20')](_0x4a1f92);}}});};exports[_0x349e('0x118')]=function(_0x4b90cd,_0x305e04){var _0x3c09e1={};var _0x5bf096={};var _0x241fd4;var _0x2a8933;return db['ChatWebsite']['findOne']({'where':{'id':_0x4b90cd[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x305e04,null))['then'](function(_0xe36937){if(_0xe36937){_0x241fd4=_0xe36937;_0x5bf096[_0x349e('0x39')]=_[_0x349e('0x36')](db[_0x349e('0x97')][_0x349e('0x61')]);_0x5bf096[_0x349e('0x35')]=_['keys'](_0x4b90cd[_0x349e('0x35')]);_0x5bf096[_0x349e('0x37')]=_[_0x349e('0x38')](_0x5bf096[_0x349e('0x39')],_0x5bf096[_0x349e('0x35')]);_0x3c09e1[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x5bf096['model'],qs[_0x349e('0x3a')](_0x4b90cd['query'][_0x349e('0x3a')]));_0x3c09e1[_0x349e('0x3b')]=_0x3c09e1[_0x349e('0x3b')]['length']?_0x3c09e1['attributes']:_0x5bf096[_0x349e('0x39')];_0x3c09e1[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x3e')]);_0x3c09e1[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x4b90cd[_0x349e('0x35')],_0x5bf096['filters']));if(_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]){_0x3c09e1['where']=_['merge'](_0x3c09e1[_0x349e('0x3f')],{'$or':_[_0x349e('0x30')](_0x3c09e1['attributes'],function(_0x4d4112){var _0x55a88f={};_0x55a88f[_0x4d4112]={'$like':'%'+_0x4b90cd[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x55a88f;})});}_0x3c09e1=_[_0x349e('0x42')]({},_0x3c09e1,_0x4b90cd[_0x349e('0x5b')]);return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x4eb664){if(_0x4eb664){_0x2a8933=_0x4eb664[_0x349e('0x3c')];if(!_0x4b90cd[_0x349e('0x35')][_0x349e('0x59')](_0x349e('0x3d'))){_0x3c09e1[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x4b90cd['query'][_0x349e('0x23')]);_0x3c09e1[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x4b90cd[_0x349e('0x35')][_0x349e('0x21')]);}return _0x241fd4[_0x349e('0x118')](_0x3c09e1);}})[_0x349e('0x13')](function(_0x36c128){if(_0x36c128){return _0x36c128?{'count':_0x2a8933,'rows':_0x36c128}:null;}})[_0x349e('0x13')](respondWithResult(_0x305e04,null))[_0x349e('0x47')](handleError(_0x305e04,null));};exports[_0x349e('0x119')]=function(_0x30e64f,_0x4c0153){return db[_0x349e('0x11a')][_0x349e('0x50')]({'where':{'id':_0x30e64f[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0153,null))[_0x349e('0x13')](function(_0x24b688){if(_0x24b688){return _0x24b688[_0x349e('0x119')](_0x30e64f['body']['ids'],_[_0x349e('0x11b')](_0x30e64f[_0x349e('0x4b')],[_0x349e('0x5d'),'id'])||{});}})[_0x349e('0x13')](respondWithResult(_0x4c0153,null))['catch'](handleError(_0x4c0153,null));};exports[_0x349e('0x102')]=function(_0x5c1d49,_0x4b2044){var _0x21e9c9={};var _0x49485b={};var _0x277e12;var _0xf852f8;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x5c1d49[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x4b2044,null))[_0x349e('0x13')](function(_0x4b56bc){if(_0x4b56bc){_0x277e12=_0x4b56bc;_0x49485b[_0x349e('0x39')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x49485b[_0x349e('0x35')]=_[_0x349e('0x36')](_0x5c1d49[_0x349e('0x35')]);_0x49485b[_0x349e('0x37')]=_['intersection'](_0x49485b[_0x349e('0x39')],_0x49485b[_0x349e('0x35')]);_0x21e9c9[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x49485b[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3a')]));_0x21e9c9['attributes']=_0x21e9c9['attributes'][_0x349e('0x3c')]?_0x21e9c9[_0x349e('0x3b')]:_0x49485b[_0x349e('0x39')];_0x21e9c9['order']=qs[_0x349e('0x3e')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x3e')]);_0x21e9c9[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0x5c1d49[_0x349e('0x35')],_0x49485b[_0x349e('0x37')]));if(_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]){_0x21e9c9['where']=_[_0x349e('0x42')](_0x21e9c9['where'],{'$or':_['map'](_0x21e9c9[_0x349e('0x3b')],function(_0x43efb0){var _0x51cdda={};_0x51cdda[_0x43efb0]={'$like':'%'+_0x5c1d49[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x51cdda;})});}_0x21e9c9=_[_0x349e('0x42')]({},_0x21e9c9,_0x5c1d49['options']);return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x56198f){if(_0x56198f){_0xf852f8=_0x56198f[_0x349e('0x3c')];if(!_0x5c1d49['query'][_0x349e('0x59')](_0x349e('0x3d'))){_0x21e9c9[_0x349e('0x23')]=qs[_0x349e('0x23')](_0x5c1d49[_0x349e('0x35')][_0x349e('0x23')]);_0x21e9c9[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x5c1d49[_0x349e('0x35')]['offset']);}return _0x277e12[_0x349e('0x102')](_0x21e9c9);}})[_0x349e('0x13')](function(_0x11dba5){if(_0x11dba5){return _0x11dba5?{'count':_0xf852f8,'rows':_0x11dba5}:null;}})['then'](respondWithResult(_0x4b2044,null))[_0x349e('0x47')](handleError(_0x4b2044,null));};exports[_0x349e('0x11c')]=function(_0x243937,_0xfd06d7){var _0x5c7b9d=_0x243937[_0x349e('0x35')][_0x349e('0x11d')]===_0x349e('0x11e')?_0x349e('0x11f'):_0x349e('0x120');return db[_0x349e('0x31')][_0x349e('0x50')]({'attributes':['id',_0x5c7b9d],'where':{'id':_0x243937[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0xfd06d7,null))[_0x349e('0x13')](function(_0x1a7d41){if(_0x1a7d41){var _0x78e426=_0x1a7d41[_0x5c7b9d];var _0x328a1c=_0x78e426&&_0x78e426[_0x349e('0x121')]?_0x78e426['items']:[];_0xfd06d7[_0x349e('0x2d')]({'fromKey':_['isNil'](_0x78e426[_0x349e('0x122')])?undefined:_0x78e426[_0x349e('0x122')],'count':_0x328a1c[_0x349e('0x3c')],'rows':_0x328a1c});}})['catch'](handleError(_0xfd06d7,null));};exports['getOfflineMessages']=function(_0xc17f3d,_0x47fdc1){var _0x4996c2={'raw':![],'where':{}};var _0x138fb7={};var _0xd8e0a6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x349e('0x58')]({'where':{'id':_0xc17f3d[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x47fdc1,null))[_0x349e('0x13')](function(_0x29aa4c){if(_0x29aa4c){_0x138fb7['model']=_[_0x349e('0x36')](db[_0x349e('0xcf')][_0x349e('0x61')]);_0x138fb7[_0x349e('0x35')]=_['keys'](_0xc17f3d[_0x349e('0x35')]);_0x138fb7[_0x349e('0x37')]=_['intersection'](_0x138fb7[_0x349e('0x39')],_0x138fb7['query']);_0x4996c2[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x138fb7['model'],qs['fields'](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3a')]));_0x4996c2[_0x349e('0x3b')]=_0x4996c2[_0x349e('0x3b')]['length']?_0x4996c2[_0x349e('0x3b')]:_0x138fb7['model'];if(!_0xc17f3d[_0x349e('0x35')][_0x349e('0x59')]('nolimit')){_0x4996c2[_0x349e('0x23')]=qs[_0x349e('0x23')](_0xc17f3d[_0x349e('0x35')]['limit']);_0x4996c2['offset']=qs[_0x349e('0x21')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x21')]);}_0x4996c2['order']=qs[_0x349e('0x3e')](_0xc17f3d[_0x349e('0x35')][_0x349e('0x3e')]);_0x4996c2[_0x349e('0x3f')]=qs[_0x349e('0x37')](_[_0x349e('0x40')](_0xc17f3d[_0x349e('0x35')],_0x138fb7['filters']));_0x4996c2[_0x349e('0x3f')][_0x349e('0x55')]=_0x29aa4c['id'];if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]){_0x4996c2[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x4996c2['where'],{'$or':_[_0x349e('0x30')](_0x4996c2[_0x349e('0x3b')],function(_0x2e83e2){var _0xf981e8={};_0xf981e8[_0x2e83e2]={'$like':'%'+_0xc17f3d[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0xf981e8;})});}_0x4996c2=_[_0x349e('0x42')]({},_0x4996c2,_0xc17f3d[_0x349e('0x5b')]);return db[_0x349e('0xcf')][_0x349e('0x22')]({'where':_0x4996c2[_0x349e('0x3f')]})[_0x349e('0x13')](function(_0x4f6832){_0xd8e0a6[_0x349e('0x22')]=_0x4f6832;if(_0xc17f3d[_0x349e('0x35')][_0x349e('0x4a')]){_0x4996c2[_0x349e('0x44')]=[{'all':!![]}];}else{_0x4996c2['include']=[{'model':db['CmContact'],'as':_0x349e('0xed'),'required':![]},{'model':db[_0x349e('0xd9')],'as':_0x349e('0x123'),'required':![]}];}return db['ChatOfflineMessage'][_0x349e('0x45')](_0x4996c2);})[_0x349e('0x13')](function(_0x4c592a){_0xd8e0a6[_0x349e('0x46')]=_0x4c592a;return _0xd8e0a6;});}})[_0x349e('0x13')](respondWithFilteredResult(_0x47fdc1,_0x4996c2))[_0x349e('0x47')](handleError(_0x47fdc1,null));};exports['addAgents']=function(_0x3ca516,_0x3394f5){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x3ca516[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x3394f5,null))[_0x349e('0x13')](function(_0x505f46){if(_0x505f46){return _0x505f46[_0x349e('0x124')](_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')],_[_0x349e('0x11b')](_0x3ca516['body'],[_0x349e('0x5d'),'id'])||{})['spread'](function(_0x11e32a){for(var _0x2366b4=0x0;_0x2366b4<_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')]['length'];_0x2366b4+=0x1){socket[_0x349e('0x125')](_0x349e('0x126'),{'UserId':Number(_0x3ca516[_0x349e('0x4b')][_0x349e('0x5d')][_0x2366b4]),'ChatWebsiteId':Number(_0x3ca516[_0x349e('0x49')]['id'])});}return _0x11e32a;});}})[_0x349e('0x13')](respondWithResult(_0x3394f5,null))[_0x349e('0x47')](handleError(_0x3394f5,null));};exports[_0x349e('0x127')]=function(_0x57e537,_0x2dce5f){return db[_0x349e('0x31')][_0x349e('0x50')]({'where':{'id':_0x57e537[_0x349e('0x49')]['id']}})['then'](handleEntityNotFound(_0x2dce5f,null))[_0x349e('0x13')](function(_0x543aa7){if(_0x543aa7){return _0x543aa7[_0x349e('0x127')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])[_0x349e('0x13')](function(){if(_[_0x349e('0x128')](_0x57e537[_0x349e('0x35')][_0x349e('0x5d')])){for(var _0xc0ecdb=0x0;_0xc0ecdb<_0x57e537['query'][_0x349e('0x5d')]['length'];_0xc0ecdb+=0x1){socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')][_0xc0ecdb]),'ChatWebsiteId':Number(_0x57e537['params']['id'])});}}else{socket[_0x349e('0x125')](_0x349e('0x129'),{'UserId':Number(_0x57e537[_0x349e('0x35')][_0x349e('0x5d')]),'ChatWebsiteId':Number(_0x57e537[_0x349e('0x49')]['id'])});}});}})[_0x349e('0x13')](respondWithStatusCode(_0x2dce5f,null))[_0x349e('0x47')](handleError(_0x2dce5f,null));};exports[_0x349e('0x12a')]=function(_0x29a87c,_0x45156f){var _0x3cb3be={};var _0x44bc51={};var _0x50c044;var _0x3bf043;return db[_0x349e('0x31')][_0x349e('0x58')]({'where':{'id':_0x29a87c[_0x349e('0x49')]['id']}})[_0x349e('0x13')](handleEntityNotFound(_0x45156f,null))[_0x349e('0x13')](function(_0x5324a6){if(_0x5324a6){_0x50c044=_0x5324a6;_0x44bc51[_0x349e('0x39')]=_['keys'](db[_0x349e('0xb9')]['rawAttributes']);_0x44bc51['query']=_[_0x349e('0x36')](_0x29a87c[_0x349e('0x35')]);_0x44bc51[_0x349e('0x37')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],_0x44bc51[_0x349e('0x35')]);_0x3cb3be[_0x349e('0x3b')]=_[_0x349e('0x38')](_0x44bc51[_0x349e('0x39')],qs[_0x349e('0x3a')](_0x29a87c['query'][_0x349e('0x3a')]));_0x3cb3be[_0x349e('0x3b')]=_0x3cb3be[_0x349e('0x3b')][_0x349e('0x3c')]?_0x3cb3be['attributes']:_0x44bc51[_0x349e('0x39')];_0x3cb3be[_0x349e('0x5a')]=qs[_0x349e('0x3e')](_0x29a87c['query'][_0x349e('0x3e')]);_0x3cb3be[_0x349e('0x3f')]=qs['filters'](_['pick'](_0x29a87c[_0x349e('0x35')],_0x44bc51[_0x349e('0x37')]));if(_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]){_0x3cb3be[_0x349e('0x3f')]=_[_0x349e('0x42')](_0x3cb3be[_0x349e('0x3f')],{'$or':_['map'](_0x3cb3be['attributes'],function(_0x5dbf6b){var _0x13479b={};_0x13479b[_0x5dbf6b]={'$like':'%'+_0x29a87c[_0x349e('0x35')][_0x349e('0x41')]+'%'};return _0x13479b;})});}_0x3cb3be=_[_0x349e('0x42')]({},_0x3cb3be,_0x29a87c[_0x349e('0x5b')]);return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})['then'](function(_0x2ec315){if(_0x2ec315){_0x3bf043=_0x2ec315[_0x349e('0x3c')];if(!_0x29a87c['query']['hasOwnProperty'](_0x349e('0x3d'))){_0x3cb3be[_0x349e('0x23')]=qs['limit'](_0x29a87c['query'][_0x349e('0x23')]);_0x3cb3be[_0x349e('0x21')]=qs[_0x349e('0x21')](_0x29a87c[_0x349e('0x35')]['offset']);}return _0x50c044[_0x349e('0x12a')](_0x3cb3be);}})[_0x349e('0x13')](function(_0x5259aa){if(_0x5259aa){return _0x5259aa?{'count':_0x3bf043,'rows':_0x5259aa}:null;}})['then'](respondWithResult(_0x45156f,null))[_0x349e('0x47')](handleError(_0x45156f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 25668ef..5874d65 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 _0x3663=['../../mysqldb','ChatWebsite','save','update','emit','hasOwnProperty','hook','events'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x3663,0x1cf));var _0x3366=function(_0x58f012,_0x2dce4e){_0x58f012=_0x58f012-0x0;var _0x3d7842=_0x3663[_0x58f012];return _0x3d7842;};'use strict';var EventEmitter=require(_0x3366('0x0'));var ChatWebsite=require(_0x3366('0x1'))['db'][_0x3366('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3366('0x3'),'afterUpdate':_0x3366('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2daeb7){return function(_0x206d65,_0x2c87e1,_0x16593e){ChatWebsiteEvents[_0x3366('0x5')](_0x2daeb7+':'+_0x206d65['id'],_0x206d65);ChatWebsiteEvents['emit'](_0x2daeb7,_0x206d65);_0x16593e(null);};}for(var e in events){if(events[_0x3366('0x6')](e)){var event=events[e];ChatWebsite[_0x3366('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x269f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','save','remove'];(function(_0x83420c,_0x50fd91){var _0x1057d7=function(_0x80befc){while(--_0x80befc){_0x83420c['push'](_0x83420c['shift']());}};_0x1057d7(++_0x50fd91);}(_0x269f,0xee));var _0xf269=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x269f[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xf269('0x0'));var ChatWebsite=require(_0xf269('0x1'))['db'][_0xf269('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf269('0x3'),'afterUpdate':'update','afterDestroy':_0xf269('0x4')};function emitEvent(_0x35e943){return function(_0x230d12,_0x22032a,_0x1f9a64){ChatWebsiteEvents['emit'](_0x35e943+':'+_0x230d12['id'],_0x230d12);ChatWebsiteEvents[_0xf269('0x5')](_0x35e943,_0x230d12);_0x1f9a64(null);};}for(var e in events){if(events[_0xf269('0x6')](e)){var event=events[e];ChatWebsite[_0xf269('0x7')](e,emitEvent(event));}}module[_0xf269('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index df52b86..717610a 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 _0x5ec6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util'];(function(_0x1377b2,_0x2017a6){var _0x92c9c8=function(_0x12db87){while(--_0x12db87){_0x1377b2['push'](_0x1377b2['shift']());}};_0x92c9c8(++_0x2017a6);}(_0x5ec6,0xd0));var _0x65ec=function(_0xa3271b,_0x5cccfa){_0xa3271b=_0xa3271b-0x0;var _0xf33eb9=_0x5ec6[_0xa3271b];return _0xf33eb9;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))(_0x65ec('0x3'));var moment=require(_0x65ec('0x4'));var BPromise=require(_0x65ec('0x5'));var rp=require(_0x65ec('0x6'));var fs=require('fs');var path=require(_0x65ec('0x7'));var rimraf=require(_0x65ec('0x8'));var config=require(_0x65ec('0x9'));var attributes=require(_0x65ec('0xa'));module[_0x65ec('0xb')]=function(_0x3d6373,_0x3b1e42){return _0x3d6373['define'](_0x65ec('0xc'),attributes,{'tableName':_0x65ec('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbce6=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatWebsite','chat_websites'];(function(_0x1012f0,_0xed36f7){var _0x5d0f7f=function(_0x3f16ec){while(--_0x3f16ec){_0x1012f0['push'](_0x1012f0['shift']());}};_0x5d0f7f(++_0xed36f7);}(_0xbce6,0x176));var _0x6bce=function(_0x1c24e9,_0x3a8e49){_0x1c24e9=_0x1c24e9-0x0;var _0xe4fdb2=_0xbce6[_0x1c24e9];return _0xe4fdb2;};'use strict';var _=require('lodash');var util=require(_0x6bce('0x0'));var logger=require(_0x6bce('0x1'))(_0x6bce('0x2'));var moment=require(_0x6bce('0x3'));var BPromise=require(_0x6bce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6bce('0x5'));var rimraf=require('rimraf');var config=require(_0x6bce('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x6bce('0x7')]=function(_0x1ef6a7,_0x2733d6){return _0x1ef6a7[_0x6bce('0x8')](_0x6bce('0x9'),attributes,{'tableName':_0x6bce('0xa'),'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 f3bc82e..c4f2ba5 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 _0x8b83=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b83,0xd3));var _0x38b8=function(_0x563120,_0x54bcc8){_0x563120=_0x563120-0x0;var _0x3538ce=_0x8b83[_0x563120];return _0x3538ce;};'use strict';var _=require('lodash');var util=require(_0x38b8('0x0'));var moment=require(_0x38b8('0x1'));var BPromise=require(_0x38b8('0x2'));var rs=require(_0x38b8('0x3'));var fs=require('fs');var Redis=require(_0x38b8('0x4'));var db=require(_0x38b8('0x5'))['db'];var utils=require(_0x38b8('0x6'));var logger=require(_0x38b8('0x7'))(_0x38b8('0x8'));var config=require(_0x38b8('0x9'));var jayson=require(_0x38b8('0xa'));var client=jayson[_0x38b8('0xb')][_0x38b8('0xc')]({'port':0x232a});config[_0x38b8('0xd')]=_[_0x38b8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x38b8('0xf'))(new Redis(config['redis']));require(_0x38b8('0x10'))[_0x38b8('0x11')](socket);function respondWithRpcPromise(_0x22e83f,_0x140067,_0x1b0173){return new BPromise(function(_0xacd7fa,_0x35b80e){return client[_0x38b8('0x12')](_0x22e83f,_0x1b0173)[_0x38b8('0x13')](function(_0x1bfdb9){logger[_0x38b8('0x14')](_0x38b8('0x15'),_0x140067,_0x38b8('0x16'));logger[_0x38b8('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x140067,_0x38b8('0x16'),JSON[_0x38b8('0x18')](_0x1bfdb9));if(_0x1bfdb9[_0x38b8('0x19')]){if(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1a')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);return _0x35b80e(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);}logger[_0x38b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);return _0xacd7fa(_0x1bfdb9[_0x38b8('0x19')][_0x38b8('0x1b')]);}else{logger['info'](_0x38b8('0x15'),_0x140067,_0x38b8('0x16'));_0xacd7fa(_0x1bfdb9[_0x38b8('0x1c')][_0x38b8('0x1b')]);}})[_0x38b8('0x1d')](function(_0x42ec1f){logger[_0x38b8('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x140067,_0x42ec1f);_0x35b80e(_0x42ec1f);});});} \ No newline at end of file +var _0x3960=['defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x35ad5c,_0x58ccf7){var _0x2bd8aa=function(_0x426bdf){while(--_0x426bdf){_0x35ad5c['push'](_0x35ad5c['shift']());}};_0x2bd8aa(++_0x58ccf7);}(_0x3960,0xaf));var _0x0396=function(_0x3de8c5,_0x434f8f){_0x3de8c5=_0x3de8c5-0x0;var _0x48a800=_0x3960[_0x3de8c5];return _0x48a800;};'use strict';var _=require(_0x0396('0x0'));var util=require(_0x0396('0x1'));var moment=require(_0x0396('0x2'));var BPromise=require(_0x0396('0x3'));var rs=require(_0x0396('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0396('0x5'))(_0x0396('0x6'));var config=require(_0x0396('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0396('0x8')]['http']({'port':0x232a});config['redis']=_[_0x0396('0x9')](config[_0x0396('0xa')],{'host':_0x0396('0xb'),'port':0x18eb});var socket=require(_0x0396('0xc'))(new Redis(config['redis']));require(_0x0396('0xd'))['register'](socket);function respondWithRpcPromise(_0x19be2b,_0x5c1cce,_0x1510c1){return new BPromise(function(_0x2f8d51,_0xfeb61a){return client[_0x0396('0xe')](_0x19be2b,_0x1510c1)[_0x0396('0xf')](function(_0xf02a22){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));logger[_0x0396('0x11')](_0x0396('0x12'),_0x5c1cce,_0x0396('0x10'),JSON['stringify'](_0xf02a22));if(_0xf02a22[_0x0396('0x13')]){if(_0xf02a22['error'][_0x0396('0x14')]===0x1f4){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);return _0xfeb61a(_0xf02a22[_0x0396('0x13')]['message']);}logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0xf02a22[_0x0396('0x13')]['message']);return _0x2f8d51(_0xf02a22[_0x0396('0x13')][_0x0396('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5c1cce,_0x0396('0x10'));_0x2f8d51(_0xf02a22['result'][_0x0396('0x16')]);}})['catch'](function(_0x3f1e39){logger[_0x0396('0x13')](_0x0396('0x15'),_0x5c1cce,_0x3f1e39);_0xfeb61a(_0x3f1e39);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index aaaae37..2b7ccf6 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 _0x11f9=['length','chatWebsite:','save','remove'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0x11f9,0x172));var _0x911f=function(_0xe9963a,_0x668b){_0xe9963a=_0xe9963a-0x0;var _0x13c8a3=_0x11f9[_0xe9963a];return _0x13c8a3;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x911f('0x0'),_0x911f('0x1'),'update'];function createListener(_0x100c7f,_0x4af327){return function(_0xf090d8){_0x4af327['emit'](_0x100c7f,_0xf090d8);};}function removeListener(_0x2dd0bf,_0x3447e2){return function(){ChatWebsiteEvents['removeListener'](_0x2dd0bf,_0x3447e2);};}exports['register']=function(_0x3af9f9){for(var _0x2ee3b3=0x0,_0x5b53c1=events[_0x911f('0x2')];_0x2ee3b3<_0x5b53c1;_0x2ee3b3++){var _0x120edc=events[_0x2ee3b3];var _0x555b2a=createListener(_0x911f('0x3')+_0x120edc,_0x3af9f9);ChatWebsiteEvents['on'](_0x120edc,_0x555b2a);}}; \ No newline at end of file +var _0x513f=['length','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener','register'];(function(_0x4fb334,_0x4ca8c9){var _0x56dc84=function(_0x470d7b){while(--_0x470d7b){_0x4fb334['push'](_0x4fb334['shift']());}};_0x56dc84(++_0x4ca8c9);}(_0x513f,0x12a));var _0xf513=function(_0x214ec1,_0x5ace17){_0x214ec1=_0x214ec1-0x0;var _0x54e5f5=_0x513f[_0x214ec1];return _0x54e5f5;};'use strict';var ChatWebsiteEvents=require(_0xf513('0x0'));var events=[_0xf513('0x1'),_0xf513('0x2'),_0xf513('0x3')];function createListener(_0x40c4d7,_0x54cb8a){return function(_0x5a87f3){_0x54cb8a['emit'](_0x40c4d7,_0x5a87f3);};}function removeListener(_0x18639a,_0x2cc3fa){return function(){ChatWebsiteEvents[_0xf513('0x4')](_0x18639a,_0x2cc3fa);};}exports[_0xf513('0x5')]=function(_0x1e94de){for(var _0x15a461=0x0,_0x4202e0=events[_0xf513('0x6')];_0x15a461<_0x4202e0;_0x15a461++){var _0x3c1733=events[_0x15a461];var _0x888a12=createListener(_0xf513('0x7')+_0x3c1733,_0x1e94de);ChatWebsiteEvents['on'](_0x3c1733,_0x888a12);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 3ceaa14..c8b2580 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 _0xe575=['server/files/images/logos/','format','%s-%s','originalname','file','diskStorage','server/files/images/avatars/','now','single','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','root'];(function(_0x123bab,_0x1fd456){var _0x46a65d=function(_0x1edb61){while(--_0x1edb61){_0x123bab['push'](_0x123bab['shift']());}};_0x46a65d(++_0x1fd456);}(_0xe575,0x1ba));var _0x5e57=function(_0x415b19,_0x40aea5){_0x415b19=_0x415b19-0x0;var _0x1ae77e=_0xe575[_0x415b19];return _0x1ae77e;};'use strict';var multer=require(_0x5e57('0x0'));var util=require('util');var path=require(_0x5e57('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e57('0x2'));var router=express[_0x5e57('0x3')]();var fs_extra=require(_0x5e57('0x4'));var auth=require(_0x5e57('0x5'));var interaction=require(_0x5e57('0x6'));var config=require(_0x5e57('0x7'));var controller=require('./chatWebsite.controller');router[_0x5e57('0x8')]('/',auth[_0x5e57('0x9')](),controller['index']);router[_0x5e57('0x8')](_0x5e57('0xa'),auth[_0x5e57('0x9')](),controller[_0x5e57('0xb')]);router[_0x5e57('0x8')](_0x5e57('0xc'),auth['isAuthenticated'](),controller[_0x5e57('0xd')]);router['get'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['getDispositions']);router[_0x5e57('0x8')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x10')]);router[_0x5e57('0x8')]('/:id/logo',controller[_0x5e57('0x11')]);router[_0x5e57('0x8')](_0x5e57('0x12'),controller['getAvatar']);router[_0x5e57('0x8')](_0x5e57('0x13'),controller['getCustomerAvatar']);router['get'](_0x5e57('0x14'),controller[_0x5e57('0x15')]);router[_0x5e57('0x8')](_0x5e57('0x16'),auth['isAuthenticated'](),controller[_0x5e57('0x17')]);router['get'](_0x5e57('0x18'),controller[_0x5e57('0x19')]);router['get'](_0x5e57('0x1a'),auth['isAuthenticated'](),controller[_0x5e57('0x1b')]);router[_0x5e57('0x8')](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x1d')]);router[_0x5e57('0x8')](_0x5e57('0x1e'),controller[_0x5e57('0x1f')]);router[_0x5e57('0x8')](_0x5e57('0x20'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x21')]);router[_0x5e57('0x8')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x23')]);router[_0x5e57('0x24')]('/',auth['isAuthenticated'](),controller[_0x5e57('0x25')]);router[_0x5e57('0x24')](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['addDisposition']);router[_0x5e57('0x24')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5da115,_0x233eff,_0x258813){_0x258813(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x29')));},'filename':function(_0x46540f,_0x53f93f,_0x494af9){_0x494af9(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date['now'](),_0x53f93f[_0x5e57('0x2c')]));}})});router['post']('/:id/logo',upload['single'](_0x5e57('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x12abde,_0x30466f,_0xac5deb){_0xac5deb(null,path['join'](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x7fc62,_0x1a1276,_0x540279){_0x540279(null,util['format'](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x1a1276[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x12'),upload[_0x5e57('0x31')](_0x5e57('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x35e2c5,_0x52c49c,_0x2222e9){_0x2222e9(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x3e7b6f,_0x28cfa5,_0x103fa0){_0x103fa0(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x28cfa5[_0x5e57('0x2c')]));}})});router['post'](_0x5e57('0x13'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x32')]);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x50616c,_0x1c6d21,_0x366b0d){_0x366b0d(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x4d2aff,_0x19ef03,_0x1fef29){_0x1fef29(null,util[_0x5e57('0x2a')]('%s-%s',Date[_0x5e57('0x30')](),_0x19ef03[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x14'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x33')]);router[_0x5e57('0x24')]('/:id/notify',controller[_0x5e57('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x5da44c,_0x592de2,_0x792790){const _0x285188=path['join'](config[_0x5e57('0x28')],_0x5e57('0x35'),_0x5e57('0x36'),_0x5e57('0x37'));fs_extra['ensureDir'](_0x285188,function(){_0x792790(null,_0x285188);});},'filename':function(_0x23f94a,_0x4fc695,_0x3e29b0){const _0x3d547e=_0x4fc695[_0x5e57('0x2c')][_0x5e57('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2597f0=path[_0x5e57('0x39')](_0x3d547e);const _0x45ffcc=Date[_0x5e57('0x30')]()+'-'+_0x3d547e['replace'](_0x2597f0,'')+_0x2597f0;_0x3e29b0(null,_0x45ffcc);}})});router[_0x5e57('0x24')]('/:id/offline',offlineUploadMulter[_0x5e57('0x3a')](),controller[_0x5e57('0x3b')]);router['post'](_0x5e57('0x16'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3c')]);router[_0x5e57('0x24')](_0x5e57('0x1a'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3d')]);router['post'](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3e')]);router[_0x5e57('0x24')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['addAgents']);router[_0x5e57('0x3f')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller['update']);router[_0x5e57('0x40')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x41')]);router['delete'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x42')]);router[_0x5e57('0x40')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x43')]);router[_0x5e57('0x40')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['removeAgents']);module[_0x5e57('0x44')]=router; \ No newline at end of file +var _0x9f94=['offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','/describe','describe','/:id','show','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments'];(function(_0x53fb41,_0x500026){var _0x3f3cbd=function(_0x261510){while(--_0x261510){_0x53fb41['push'](_0x53fb41['shift']());}};_0x3f3cbd(++_0x500026);}(_0x9f94,0x1db));var _0x49f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9f94[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x49f9('0x0'));var util=require('util');var path=require(_0x49f9('0x1'));var timeout=require(_0x49f9('0x2'));var express=require(_0x49f9('0x3'));var router=express[_0x49f9('0x4')]();var fs_extra=require(_0x49f9('0x5'));var auth=require(_0x49f9('0x6'));var interaction=require(_0x49f9('0x7'));var config=require('../../config/environment');var controller=require(_0x49f9('0x8'));router['get']('/',auth[_0x49f9('0x9')](),controller['index']);router['get'](_0x49f9('0xa'),auth['isAuthenticated'](),controller[_0x49f9('0xb')]);router['get'](_0x49f9('0xc'),auth[_0x49f9('0x9')](),controller[_0x49f9('0xd')]);router[_0x49f9('0xe')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x10')]);router[_0x49f9('0xe')](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x12')]);router['get'](_0x49f9('0x13'),controller[_0x49f9('0x14')]);router['get'](_0x49f9('0x15'),controller[_0x49f9('0x16')]);router[_0x49f9('0xe')](_0x49f9('0x17'),controller['getCustomerAvatar']);router[_0x49f9('0xe')]('/:id/system_avatar',controller[_0x49f9('0x18')]);router[_0x49f9('0xe')](_0x49f9('0x19'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x1a')]);router['get'](_0x49f9('0x1b'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1c')]);router[_0x49f9('0xe')]('/:id/proactive_actions',auth[_0x49f9('0x9')](),controller[_0x49f9('0x1d')]);router[_0x49f9('0xe')](_0x49f9('0x1e'),controller[_0x49f9('0x1f')]);router[_0x49f9('0xe')](_0x49f9('0x20'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x21')]);router[_0x49f9('0xe')](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x23')]);router[_0x49f9('0x24')]('/',auth['isAuthenticated'](),controller[_0x49f9('0x25')]);router[_0x49f9('0x24')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x26')]);router['post'](_0x49f9('0x11'),auth[_0x49f9('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x4cde16,_0x2298c8,_0x42af43){_0x42af43(null,path[_0x49f9('0x28')](config[_0x49f9('0x29')],'server/files/images/logos/'));},'filename':function(_0x21f8d1,_0xcdfb65,_0xbf230a){_0xbf230a(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0xcdfb65[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')]('/:id/logo',upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x30')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x147b0b,_0x1358e8,_0x119eff){_0x119eff(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x387a85,_0x712830,_0x158738){_0x158738(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date[_0x49f9('0x2c')](),_0x712830[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x15'),upload['single'](_0x49f9('0x2f')),controller[_0x49f9('0x32')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x194718,_0x13d5a3,_0x47ff42){_0x47ff42(null,path[_0x49f9('0x28')](config['root'],_0x49f9('0x31')));},'filename':function(_0x15501c,_0x2dd588,_0x5ba3fe){_0x5ba3fe(null,util[_0x49f9('0x2a')](_0x49f9('0x2b'),Date['now'](),_0x2dd588[_0x49f9('0x2d')]));}})});router[_0x49f9('0x24')](_0x49f9('0x17'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x33')]);var upload=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x6d2ed4,_0x383ca2,_0x3a1162){_0x3a1162(null,path['join'](config[_0x49f9('0x29')],_0x49f9('0x31')));},'filename':function(_0x5d32d7,_0x40f334,_0x1eeb1c){_0x1eeb1c(null,util['format'](_0x49f9('0x2b'),Date['now'](),_0x40f334[_0x49f9('0x2d')]));}})});router['post'](_0x49f9('0x34'),upload[_0x49f9('0x2e')](_0x49f9('0x2f')),controller[_0x49f9('0x35')]);router[_0x49f9('0x24')](_0x49f9('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x49f9('0x27')]({'destination':function(_0x2a03de,_0x4ee4cd,_0x5642f8){const _0x50f107=path[_0x49f9('0x28')](config[_0x49f9('0x29')],_0x49f9('0x37'),_0x49f9('0x38'),_0x49f9('0x39'));fs_extra[_0x49f9('0x3a')](_0x50f107,function(){_0x5642f8(null,_0x50f107);});},'filename':function(_0x2c75d1,_0x33d1e0,_0x56a6d3){const _0x3ababf=_0x33d1e0['originalname'][_0x49f9('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x456995=path[_0x49f9('0x3c')](_0x3ababf);const _0x4cb9f6=Date[_0x49f9('0x2c')]()+'-'+_0x3ababf[_0x49f9('0x3b')](_0x456995,'')+_0x456995;_0x56a6d3(null,_0x4cb9f6);}})});router['post'](_0x49f9('0x3d'),offlineUploadMulter['any'](),controller[_0x49f9('0x3e')]);router[_0x49f9('0x24')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x49f9('0x3f')]);router[_0x49f9('0x24')](_0x49f9('0x40'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x41')]);router[_0x49f9('0x24')](_0x49f9('0x42'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x43')]);router[_0x49f9('0x24')]('/:id/users',auth[_0x49f9('0x9')](),controller[_0x49f9('0x44')]);router[_0x49f9('0x45')](_0x49f9('0xc'),auth['isAuthenticated'](),controller[_0x49f9('0x46')]);router[_0x49f9('0x47')]('/:id',auth[_0x49f9('0x9')](),controller[_0x49f9('0x48')]);router[_0x49f9('0x47')](_0x49f9('0xf'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x49')]);router[_0x49f9('0x47')](_0x49f9('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x49f9('0x22'),auth[_0x49f9('0x9')](),controller[_0x49f9('0x4a')]);module[_0x49f9('0x4b')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index e3a6cde..c305c2d 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 _0x6fe5=['express','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports'];(function(_0x217cdf,_0x429cc0){var _0x2c81fd=function(_0x55e21d){while(--_0x55e21d){_0x217cdf['push'](_0x217cdf['shift']());}};_0x2c81fd(++_0x429cc0);}(_0x6fe5,0x84));var _0x56fe=function(_0x48d264,_0x3916e6){_0x48d264=_0x48d264-0x0;var _0x2f651d=_0x6fe5[_0x48d264];return _0x2f651d;};var beaverLogger=require('beaver-logger/server');var express=require(_0x56fe('0x0'));var auth=require(_0x56fe('0x1'));var config=require(_0x56fe('0x2'));var router=express[_0x56fe('0x3')]();var isProduction=config[_0x56fe('0x4')]===_0x56fe('0x5')||![];function clientSideLogs(_0x3254a4,_0x163801,_0x2e45ea){var _0x1a13bd=_0x3254a4[_0x56fe('0x6')]['get']('client-side-logger');if(!_0x1a13bd){throw new Error(_0x56fe('0x7'));}return beaverLogger[_0x56fe('0x8')]({'uri':'/client-logs','logger':_0x1a13bd,'enableCors':!isProduction})(_0x3254a4,_0x163801,_0x2e45ea);}router['use'](auth[_0x56fe('0x9')](),clientSideLogs);module[_0x56fe('0xa')]=router; \ No newline at end of file +var _0xff1b=['../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xff1b,0x143));var _0xbff1=function(_0x44b19b,_0x5d33cc){_0x44b19b=_0x44b19b-0x0;var _0x2d7858=_0xff1b[_0x44b19b];return _0x2d7858;};var beaverLogger=require(_0xbff1('0x0'));var express=require(_0xbff1('0x1'));var auth=require(_0xbff1('0x2'));var config=require(_0xbff1('0x3'));var router=express[_0xbff1('0x4')]();var isProduction=config[_0xbff1('0x5')]===_0xbff1('0x6')||![];function clientSideLogs(_0x2abac4,_0x2d2a09,_0x169a02){var _0x13b8f1=_0x2abac4['app'][_0xbff1('0x7')]('client-side-logger');if(!_0x13b8f1){throw new Error(_0xbff1('0x8'));}return beaverLogger[_0xbff1('0x9')]({'uri':'/client-logs','logger':_0x13b8f1,'enableCors':!isProduction})(_0x2abac4,_0x2d2a09,_0x169a02);}router[_0xbff1('0xa')](auth[_0xbff1('0xb')](),clientSideLogs);module[_0xbff1('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 68356c6..3560a9c 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 _0xb161=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x40af8e,_0xbcb4a1){var _0x3b4adc=function(_0x3c9eb3){while(--_0x3c9eb3){_0x40af8e['push'](_0x40af8e['shift']());}};_0x3b4adc(++_0xbcb4a1);}(_0xb161,0xd8));var _0x1b16=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0xb161[_0x2ce6d5];return _0x32d272;};'use strict';var Sequelize=require('sequelize');module[_0x1b16('0x0')]={'name':{'type':Sequelize[_0x1b16('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1b16('0x2')](_0x1b16('0x3'),_0x1b16('0x4'),_0x1b16('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x1b16('0x2')](_0x1b16('0x6'),_0x1b16('0x7'))},'data1':{'type':Sequelize[_0x1b16('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0x8')},'data3':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0x9')},'data4':{'type':Sequelize[_0x1b16('0x1')],'comment':_0x1b16('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x1b16('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x1b16('0xc')},'data7':{'type':Sequelize[_0x1b16('0xd')],'comment':_0x1b16('0xe')}}; \ No newline at end of file +var _0xcbad=['Dynamics365','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x168c0f,_0x579bd4){var _0xaa8902=function(_0x4ae39f){while(--_0x4ae39f){_0x168c0f['push'](_0x168c0f['shift']());}};_0xaa8902(++_0x579bd4);}(_0xcbad,0x110));var _0xdcba=function(_0x5993a5,_0x88f176){_0x5993a5=_0x5993a5-0x0;var _0x2d7a42=_0xcbad[_0x5993a5];return _0x2d7a42;};'use strict';var Sequelize=require(_0xdcba('0x0'));module[_0xdcba('0x1')]={'name':{'type':Sequelize[_0xdcba('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x4'),_0xdcba('0x5'),_0xdcba('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xdcba('0x3')](_0xdcba('0x7'),_0xdcba('0x8'))},'data1':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xdcba('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xdcba('0x2')],'comment':_0xdcba('0x9')},'data5':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xb')},'data6':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xc')},'data7':{'type':Sequelize[_0xdcba('0xa')],'comment':_0xdcba('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 4b71ef0..ccc9993 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 _0xe7aa=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','find','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','body','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','update','then','destroy','end','error','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters'];(function(_0x3d8d0a,_0x11bb87){var _0x5b9df5=function(_0x3ecba2){while(--_0x3ecba2){_0x3d8d0a['push'](_0x3d8d0a['shift']());}};_0x5b9df5(++_0x11bb87);}(_0xe7aa,0x159));var _0xae7a=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xe7aa[_0x521929];return _0x632436;};'use strict';var _=require(_0xae7a('0x0'));var Redis=require(_0xae7a('0x1'));var qs=require(_0xae7a('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xae7a('0x3'));var logger=require(_0xae7a('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require(_0xae7a('0x5'));config[_0xae7a('0x6')]=_[_0xae7a('0x7')](config[_0xae7a('0x6')],{'host':_0xae7a('0x8'),'port':0x18eb});var socket=require(_0xae7a('0x9'))(new Redis(config[_0xae7a('0x6')]));var redis=new Redis(config[_0xae7a('0x6')]);function respondWithStatusCode(_0x156809,_0x2ebf4b){_0x2ebf4b=_0x2ebf4b||0xcc;return function(_0x3f39d7){if(_0x3f39d7){return _0x156809[_0xae7a('0xa')](_0x2ebf4b);}return _0x156809[_0xae7a('0xb')](_0x2ebf4b)['end']();};}function respondWithResult(_0xb103bc,_0x8335a){_0x8335a=_0x8335a||0xc8;return function(_0x40da80){if(_0x40da80){return _0xb103bc[_0xae7a('0xb')](_0x8335a)[_0xae7a('0xc')](_0x40da80);}};}function respondWithFilteredResult(_0x11c4ab,_0x4d8c51){return function(_0x1cb9c0){if(_0x1cb9c0){var _0x11c8b3=typeof _0x4d8c51['offset']===_0xae7a('0xd')&&typeof _0x4d8c51[_0xae7a('0xe')]===_0xae7a('0xd');var _0x4f31a5=_0x1cb9c0[_0xae7a('0xf')];var _0x520025=_0x11c8b3?0x0:_0x4d8c51[_0xae7a('0x10')];var _0x4e96db=_0x11c8b3?_0x1cb9c0['count']:_0x4d8c51[_0xae7a('0x10')]+_0x4d8c51[_0xae7a('0xe')];var _0x2d8c9c;if(_0x4e96db>=_0x4f31a5){_0x4e96db=_0x4f31a5;_0x2d8c9c=0xc8;}else{_0x2d8c9c=0xce;}_0x11c4ab[_0xae7a('0xb')](_0x2d8c9c);return _0x11c4ab['set']('Content-Range',_0x520025+'-'+_0x4e96db+'/'+_0x4f31a5)['json'](_0x1cb9c0);}return null;};}function saveUpdates(_0x39e999){return function(_0x736ce8){if(_0x736ce8){return _0x736ce8[_0xae7a('0x11')](_0x39e999)[_0xae7a('0x12')](function(_0x444e21){return _0x444e21;});}return null;};}function removeEntity(_0x576fc6){return function(_0x254894){if(_0x254894){return _0x254894[_0xae7a('0x13')]()['then'](function(){_0x576fc6[_0xae7a('0xb')](0xcc)[_0xae7a('0x14')]();});}};}function handleEntityNotFound(_0x477abe){return function(_0x2525a7){if(!_0x2525a7){_0x477abe[_0xae7a('0xa')](0x194);}return _0x2525a7;};}function handleError(_0x101a97,_0x5ad11e){_0x5ad11e=_0x5ad11e||0x1f4;return function(_0x263844){logger[_0xae7a('0x15')](_0x263844['stack']);if(_0x263844[_0xae7a('0x16')]){delete _0x263844[_0xae7a('0x16')];}_0x101a97[_0xae7a('0xb')](_0x5ad11e)[_0xae7a('0x17')](_0x263844);};}function maskClientSecret(_0x48e79c){return _[_0xae7a('0x18')](_0x48e79c['slice'](0x0,0x3),0x14,'*');}exports[_0xae7a('0x19')]=function(_0x509dfc,_0x8075f5){var _0x10372f={},_0x895f9e={},_0x27ee05={'count':0x0,'rows':[]};var _0x22f996=_[_0xae7a('0x1a')](db[_0xae7a('0x1b')][_0xae7a('0x1c')],function(_0x3eb3c4){return{'name':_0x3eb3c4['fieldName'],'type':_0x3eb3c4[_0xae7a('0x1d')][_0xae7a('0x1e')]};});_0x895f9e[_0xae7a('0x1f')]=_['map'](_0x22f996,_0xae7a('0x16'));_0x895f9e[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x509dfc[_0xae7a('0x20')]);_0x895f9e[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],_0x895f9e[_0xae7a('0x20')]);_0x10372f[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x895f9e[_0xae7a('0x1f')],qs['fields'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x25')]));_0x10372f[_0xae7a('0x24')]=_0x10372f[_0xae7a('0x24')][_0xae7a('0x26')]?_0x10372f[_0xae7a('0x24')]:_0x895f9e['model'];if(!_0x509dfc['query'][_0xae7a('0x27')](_0xae7a('0x28'))){_0x10372f[_0xae7a('0xe')]=qs['limit'](_0x509dfc['query'][_0xae7a('0xe')]);_0x10372f[_0xae7a('0x10')]=qs['offset'](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x10')]);}_0x10372f[_0xae7a('0x29')]=qs[_0xae7a('0x2a')](_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2a')]);_0x10372f[_0xae7a('0x2b')]=qs[_0xae7a('0x22')](_[_0xae7a('0x2c')](_0x509dfc[_0xae7a('0x20')],_0x895f9e[_0xae7a('0x22')]),_0x22f996);if(_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]){_0x10372f[_0xae7a('0x2b')]=_[_0xae7a('0x2e')](_0x10372f['where'],{'$or':_[_0xae7a('0x1a')](_0x22f996,function(_0x8768ad){if(_0x8768ad[_0xae7a('0x1d')]!==_0xae7a('0x2f')){var _0x4e942a={};_0x4e942a[_0x8768ad['name']]={'$like':'%'+_0x509dfc[_0xae7a('0x20')][_0xae7a('0x2d')]+'%'};return _0x4e942a;}})});}_0x10372f=_['merge']({},_0x10372f,_0x509dfc[_0xae7a('0x30')]);var _0x4b3593={'where':_0x10372f[_0xae7a('0x2b')]};return db[_0xae7a('0x1b')][_0xae7a('0xf')](_0x4b3593)[_0xae7a('0x12')](function(_0x5ce046){_0x27ee05[_0xae7a('0xf')]=_0x5ce046;if(_0x509dfc[_0xae7a('0x20')]['includeAll']){_0x10372f[_0xae7a('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0xae7a('0x32')](_0x10372f);})['then'](function(_0x3d11c6){_0x27ee05[_0xae7a('0x33')]=_['map'](_0x3d11c6,function(_0x517be3){if(_0x517be3[_0xae7a('0x34')]===_0xae7a('0x35')){var _0x32a8f0=encryptor[_0xae7a('0x36')](_0x517be3[_0xae7a('0x37')]);_0x517be3[_0xae7a('0x37')]=maskClientSecret(_0x32a8f0);}return _0x517be3;});return _0x27ee05;})[_0xae7a('0x12')](respondWithFilteredResult(_0x8075f5,_0x10372f))[_0xae7a('0x38')](handleError(_0x8075f5,null));};exports[_0xae7a('0x39')]=function(_0x2fd633,_0xb501c7){var _0x3c49bc={'raw':!![],'where':{'id':_0x2fd633[_0xae7a('0x3a')]['id']}},_0x3fb126={};_0x3fb126[_0xae7a('0x1f')]=_[_0xae7a('0x21')](db[_0xae7a('0x1b')][_0xae7a('0x1c')]);_0x3fb126[_0xae7a('0x20')]=_[_0xae7a('0x21')](_0x2fd633['query']);_0x3fb126[_0xae7a('0x22')]=_[_0xae7a('0x23')](_0x3fb126[_0xae7a('0x1f')],_0x3fb126[_0xae7a('0x20')]);_0x3c49bc[_0xae7a('0x24')]=_[_0xae7a('0x23')](_0x3fb126['model'],qs[_0xae7a('0x25')](_0x2fd633['query'][_0xae7a('0x25')]));_0x3c49bc[_0xae7a('0x24')]=_0x3c49bc[_0xae7a('0x24')]['length']?_0x3c49bc[_0xae7a('0x24')]:_0x3fb126['model'];if(_0x2fd633[_0xae7a('0x20')][_0xae7a('0x3b')]){_0x3c49bc[_0xae7a('0x31')]=[{'all':!![]}];}_0x3c49bc=_[_0xae7a('0x2e')]({},_0x3c49bc,_0x2fd633[_0xae7a('0x30')]);return db[_0xae7a('0x1b')][_0xae7a('0x3c')](_0x3c49bc)[_0xae7a('0x12')](handleEntityNotFound(_0xb501c7,null))[_0xae7a('0x12')](function(_0x352666){if(_0x352666[_0xae7a('0x34')]==='MicrosoftAzure'){var _0x206366=encryptor[_0xae7a('0x36')](_0x352666['data3']);_0x352666[_0xae7a('0x37')]=maskClientSecret(_0x206366);}return _0x352666;})['then'](respondWithResult(_0xb501c7,null))[_0xae7a('0x38')](handleError(_0xb501c7,null));};exports[_0xae7a('0x3d')]=function(_0xd9193b,_0x223982){if(!_0xd9193b['body'][_0xae7a('0x16')])throw new Error(_0xae7a('0x3e'));if(!_0xd9193b['body']['service'])throw new Error(_0xae7a('0x3f'));var _0xd17e0f=db['CloudProvider'][_0xae7a('0x1c')]['service'][_0xae7a('0x40')];if(!_0xd17e0f['includes'](_0xd9193b['body']['service']))throw new Error(_0xae7a('0x41')+_0xd17e0f[_0xae7a('0x42')](',\x20'));if(_0xd9193b['body'][_0xae7a('0x34')]==='MicrosoftAzure'&&_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]){_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor[_0xae7a('0x44')](_0xd9193b[_0xae7a('0x43')][_0xae7a('0x37')]);}return db['CloudProvider']['create'](_0xd9193b[_0xae7a('0x43')],{})[_0xae7a('0x12')](respondWithResult(_0x223982,0xc9))['catch'](handleError(_0x223982,null));};exports[_0xae7a('0x11')]=function(_0x1ac0bf,_0x9666bd){if(_0x1ac0bf[_0xae7a('0x43')]['id']){delete _0x1ac0bf[_0xae7a('0x43')]['id'];}return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x1ac0bf['params']['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x9666bd,null))[_0xae7a('0x12')](function(_0x1c0cf9){if(_0x1c0cf9['service']===_0xae7a('0x35')&&_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]){_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]=encryptor['encryptString'](_0x1ac0bf[_0xae7a('0x43')][_0xae7a('0x37')]);}return _0x1c0cf9;})[_0xae7a('0x12')](saveUpdates(_0x1ac0bf['body'],null))[_0xae7a('0x12')](respondWithResult(_0x9666bd,null))[_0xae7a('0x38')](handleError(_0x9666bd,null));};exports[_0xae7a('0x13')]=function(_0x2b5f1f,_0x2d3c56){return db[_0xae7a('0x1b')][_0xae7a('0x3c')]({'where':{'id':_0x2b5f1f[_0xae7a('0x3a')]['id']}})[_0xae7a('0x12')](handleEntityNotFound(_0x2d3c56,null))[_0xae7a('0x12')](removeEntity(_0x2d3c56,null))[_0xae7a('0x38')](handleError(_0x2d3c56,null));};exports[_0xae7a('0x45')]=function(_0x11f053,_0x47cd94){return db[_0xae7a('0x1b')]['findOne']({'where':{'id':_0x11f053['params']['id']},'raw':!![]})[_0xae7a('0x12')](function(_0x667b7e){if(!_0x667b7e)return _0x47cd94[_0xae7a('0xa')](0x194);return{'url':oauth[_0xae7a('0x46')](_0x667b7e,_0x11f053[_0xae7a('0x47')]['id'])};})['then'](respondWithResult(_0x47cd94,null))[_0xae7a('0x38')](handleError(_0x47cd94,null));};exports['oauth2MicrosoftCallback']=function(_0x2c4533,_0x22900c){var _0x1f4fa4=_0x2c4533[_0xae7a('0x43')];var _0x196c50;var _0x851d51;if(_0x1f4fa4[_0xae7a('0x15')])throw _0x1f4fa4;redis['get'](_0x1f4fa4[_0xae7a('0x48')])[_0xae7a('0x12')](function(_0x615ce0){if(!_0x615ce0)throw new Error(_0xae7a('0x49'));_0x196c50=JSON[_0xae7a('0x4a')](_0x615ce0);var _0x46b256=Buffer[_0xae7a('0x4b')](_0x1f4fa4['state'],_0xae7a('0x4c'))[_0xae7a('0x4d')](_0xae7a('0x4e'));_0x851d51=JSON[_0xae7a('0x4a')](_0x46b256);if(!oauth[_0xae7a('0x4f')](_0x1f4fa4[_0xae7a('0x50')],_0x196c50[_0xae7a('0x51')]))throw new Error(_0xae7a('0x52'));redis['del'](_0x1f4fa4['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x1f4fa4['code'],_0x196c50);})[_0xae7a('0x12')](function(_0x2c7a6c){_0x196c50[_0xae7a('0x53')]=_0x2c7a6c[_0xae7a('0x54')];_0x196c50[_0xae7a('0x55')]=_0x2c7a6c[_0xae7a('0x56')];return db['CloudProvider']['update']({'data5':_0x196c50[_0xae7a('0x53')],'data6':_0x196c50[_0xae7a('0x55')]},{'where':{'id':_0x196c50['id']}});})[_0xae7a('0x12')](function(){oauth[_0xae7a('0x57')](_0x196c50);socket[_0xae7a('0x58')](_0xae7a('0x59'),{'id':_0x851d51['id']});return;})['then'](respondWithStatusCode(_0x22900c,null))[_0xae7a('0x38')](function(_0x221a4e){if(_0x851d51){socket['emit'](_0xae7a('0x5a'),{'id':_0x851d51['id']});}if(!_0x196c50){logger[_0xae7a('0x15')](_0xae7a('0x5b'),_0x221a4e);return _0x22900c[_0xae7a('0xb')](0x1f4)['send'](_0x221a4e[_0xae7a('0x5c')]);}logger['error'](_0xae7a('0x5d'),_0x196c50['id'],JSON[_0xae7a('0x5e')](_0x221a4e));});}; \ No newline at end of file +var _0xca8c=['fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','send','padEnd','slice','map','CloudProvider','rawAttributes'];(function(_0x24ce5a,_0x25d7e9){var _0x595ae3=function(_0xf756e7){while(--_0xf756e7){_0x24ce5a['push'](_0x24ce5a['shift']());}};_0x595ae3(++_0x25d7e9);}(_0xca8c,0x102));var _0xcca8=function(_0x1558bc,_0x191ffb){_0x1558bc=_0x1558bc-0x0;var _0xfe234d=_0xca8c[_0x1558bc];return _0xfe234d;};'use strict';var _=require('lodash');var Redis=require(_0xcca8('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xcca8('0x1'));var config=require(_0xcca8('0x2'));var logger=require(_0xcca8('0x3'))(_0xcca8('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xcca8('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xcca8('0x6'),'port':0x18eb});var socket=require(_0xcca8('0x7'))(new Redis(config[_0xcca8('0x8')]));var redis=new Redis(config[_0xcca8('0x8')]);function respondWithStatusCode(_0x7a93d,_0x27c349){_0x27c349=_0x27c349||0xcc;return function(_0x3be8d6){if(_0x3be8d6){return _0x7a93d[_0xcca8('0x9')](_0x27c349);}return _0x7a93d[_0xcca8('0xa')](_0x27c349)[_0xcca8('0xb')]();};}function respondWithResult(_0x148c49,_0x4fc523){_0x4fc523=_0x4fc523||0xc8;return function(_0x4bcd31){if(_0x4bcd31){return _0x148c49['status'](_0x4fc523)[_0xcca8('0xc')](_0x4bcd31);}};}function respondWithFilteredResult(_0x50c614,_0x5ae436){return function(_0x4c38db){if(_0x4c38db){var _0x13e622=typeof _0x5ae436[_0xcca8('0xd')]===_0xcca8('0xe')&&typeof _0x5ae436['limit']===_0xcca8('0xe');var _0xe41aef=_0x4c38db['count'];var _0xb03554=_0x13e622?0x0:_0x5ae436[_0xcca8('0xd')];var _0x285bbe=_0x13e622?_0x4c38db[_0xcca8('0xf')]:_0x5ae436['offset']+_0x5ae436[_0xcca8('0x10')];var _0x128a59;if(_0x285bbe>=_0xe41aef){_0x285bbe=_0xe41aef;_0x128a59=0xc8;}else{_0x128a59=0xce;}_0x50c614[_0xcca8('0xa')](_0x128a59);return _0x50c614[_0xcca8('0x11')](_0xcca8('0x12'),_0xb03554+'-'+_0x285bbe+'/'+_0xe41aef)[_0xcca8('0xc')](_0x4c38db);}return null;};}function saveUpdates(_0x207245){return function(_0x34cd6e){if(_0x34cd6e){return _0x34cd6e[_0xcca8('0x13')](_0x207245)[_0xcca8('0x14')](function(_0x419d1f){return _0x419d1f;});}return null;};}function removeEntity(_0x4740b8){return function(_0x51cfea){if(_0x51cfea){return _0x51cfea[_0xcca8('0x15')]()[_0xcca8('0x14')](function(){_0x4740b8[_0xcca8('0xa')](0xcc)[_0xcca8('0xb')]();});}};}function handleEntityNotFound(_0x5a402a){return function(_0x56dcc1){if(!_0x56dcc1){_0x5a402a[_0xcca8('0x9')](0x194);}return _0x56dcc1;};}function handleError(_0x341bb1,_0x180a3b){_0x180a3b=_0x180a3b||0x1f4;return function(_0xe9d3b0){logger[_0xcca8('0x16')](_0xe9d3b0[_0xcca8('0x17')]);if(_0xe9d3b0['name']){delete _0xe9d3b0['name'];}_0x341bb1['status'](_0x180a3b)[_0xcca8('0x18')](_0xe9d3b0);};}function maskClientSecret(_0x210a6d){return _[_0xcca8('0x19')](_0x210a6d[_0xcca8('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4b05cc,_0xa57c76){var _0x48249c={},_0x2b76ff={},_0x4dd515={'count':0x0,'rows':[]};var _0x1172cf=_[_0xcca8('0x1b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')],function(_0x5c93bb){return{'name':_0x5c93bb[_0xcca8('0x1e')],'type':_0x5c93bb[_0xcca8('0x1f')][_0xcca8('0x20')]};});_0x2b76ff['model']=_[_0xcca8('0x1b')](_0x1172cf,_0xcca8('0x21'));_0x2b76ff[_0xcca8('0x22')]=_['keys'](_0x4b05cc['query']);_0x2b76ff['filters']=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],_0x2b76ff[_0xcca8('0x22')]);_0x48249c[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x2b76ff[_0xcca8('0x24')],qs[_0xcca8('0x26')](_0x4b05cc['query'][_0xcca8('0x26')]));_0x48249c[_0xcca8('0x25')]=_0x48249c['attributes'][_0xcca8('0x27')]?_0x48249c[_0xcca8('0x25')]:_0x2b76ff[_0xcca8('0x24')];if(!_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x28')](_0xcca8('0x29'))){_0x48249c[_0xcca8('0x10')]=qs[_0xcca8('0x10')](_0x4b05cc['query']['limit']);_0x48249c[_0xcca8('0xd')]=qs[_0xcca8('0xd')](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0xd')]);}_0x48249c[_0xcca8('0x2a')]=qs['sort'](_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2b')]);_0x48249c['where']=qs[_0xcca8('0x2c')](_['pick'](_0x4b05cc['query'],_0x2b76ff[_0xcca8('0x2c')]),_0x1172cf);if(_0x4b05cc[_0xcca8('0x22')][_0xcca8('0x2d')]){_0x48249c[_0xcca8('0x2e')]=_[_0xcca8('0x2f')](_0x48249c['where'],{'$or':_[_0xcca8('0x1b')](_0x1172cf,function(_0x2206dc){if(_0x2206dc[_0xcca8('0x1f')]!==_0xcca8('0x30')){var _0x348421={};_0x348421[_0x2206dc[_0xcca8('0x21')]]={'$like':'%'+_0x4b05cc[_0xcca8('0x22')]['filter']+'%'};return _0x348421;}})});}_0x48249c=_[_0xcca8('0x2f')]({},_0x48249c,_0x4b05cc[_0xcca8('0x31')]);var _0x285edf={'where':_0x48249c[_0xcca8('0x2e')]};return db[_0xcca8('0x1c')][_0xcca8('0xf')](_0x285edf)[_0xcca8('0x14')](function(_0x5162fb){_0x4dd515[_0xcca8('0xf')]=_0x5162fb;if(_0x4b05cc['query']['includeAll']){_0x48249c['include']=[{'all':!![]}];}return db['CloudProvider'][_0xcca8('0x32')](_0x48249c);})[_0xcca8('0x14')](function(_0x34e769){_0x4dd515[_0xcca8('0x33')]=_[_0xcca8('0x1b')](_0x34e769,function(_0x5edb87){if(_0x5edb87[_0xcca8('0x34')]===_0xcca8('0x35')){var _0x4195a3=encryptor[_0xcca8('0x36')](_0x5edb87[_0xcca8('0x37')]);_0x5edb87[_0xcca8('0x37')]=maskClientSecret(_0x4195a3);}return _0x5edb87;});return _0x4dd515;})[_0xcca8('0x14')](respondWithFilteredResult(_0xa57c76,_0x48249c))[_0xcca8('0x38')](handleError(_0xa57c76,null));};exports[_0xcca8('0x39')]=function(_0x598e41,_0x1e182f){var _0x14bdec={'raw':!![],'where':{'id':_0x598e41[_0xcca8('0x3a')]['id']}},_0x33c369={};_0x33c369[_0xcca8('0x24')]=_[_0xcca8('0x3b')](db[_0xcca8('0x1c')][_0xcca8('0x1d')]);_0x33c369[_0xcca8('0x22')]=_[_0xcca8('0x3b')](_0x598e41['query']);_0x33c369[_0xcca8('0x2c')]=_[_0xcca8('0x23')](_0x33c369['model'],_0x33c369[_0xcca8('0x22')]);_0x14bdec[_0xcca8('0x25')]=_[_0xcca8('0x23')](_0x33c369[_0xcca8('0x24')],qs['fields'](_0x598e41[_0xcca8('0x22')]['fields']));_0x14bdec[_0xcca8('0x25')]=_0x14bdec[_0xcca8('0x25')][_0xcca8('0x27')]?_0x14bdec[_0xcca8('0x25')]:_0x33c369[_0xcca8('0x24')];if(_0x598e41[_0xcca8('0x22')][_0xcca8('0x3c')]){_0x14bdec['include']=[{'all':!![]}];}_0x14bdec=_[_0xcca8('0x2f')]({},_0x14bdec,_0x598e41['options']);return db[_0xcca8('0x1c')][_0xcca8('0x3d')](_0x14bdec)[_0xcca8('0x14')](handleEntityNotFound(_0x1e182f,null))['then'](function(_0x59fd63){if(_0x59fd63[_0xcca8('0x34')]==='MicrosoftAzure'){var _0x4f6fe2=encryptor['decryptString'](_0x59fd63[_0xcca8('0x37')]);_0x59fd63[_0xcca8('0x37')]=maskClientSecret(_0x4f6fe2);}return _0x59fd63;})[_0xcca8('0x14')](respondWithResult(_0x1e182f,null))[_0xcca8('0x38')](handleError(_0x1e182f,null));};exports[_0xcca8('0x3e')]=function(_0x255a2f,_0x5d7214){if(!_0x255a2f[_0xcca8('0x3f')]['name'])throw new Error(_0xcca8('0x40'));if(!_0x255a2f[_0xcca8('0x3f')]['service'])throw new Error(_0xcca8('0x41'));var _0x5b7718=db['CloudProvider'][_0xcca8('0x1d')][_0xcca8('0x34')]['values'];if(!_0x5b7718[_0xcca8('0x42')](_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x5b7718[_0xcca8('0x43')](',\x20'));if(_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x34')]==='MicrosoftAzure'&&_0x255a2f[_0xcca8('0x3f')][_0xcca8('0x37')]){_0x255a2f[_0xcca8('0x3f')]['data3']=encryptor[_0xcca8('0x44')](_0x255a2f[_0xcca8('0x3f')]['data3']);}return db['CloudProvider']['create'](_0x255a2f[_0xcca8('0x3f')],{})[_0xcca8('0x14')](respondWithResult(_0x5d7214,0xc9))[_0xcca8('0x38')](handleError(_0x5d7214,null));};exports[_0xcca8('0x13')]=function(_0xc903d2,_0x5e03e5){if(_0xc903d2['body']['id']){delete _0xc903d2[_0xcca8('0x3f')]['id'];}return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0xc903d2[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x5e03e5,null))[_0xcca8('0x14')](function(_0x9ad335){if(_0x9ad335[_0xcca8('0x34')]===_0xcca8('0x35')&&_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]){_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]=encryptor[_0xcca8('0x44')](_0xc903d2[_0xcca8('0x3f')][_0xcca8('0x37')]);}return _0x9ad335;})[_0xcca8('0x14')](saveUpdates(_0xc903d2[_0xcca8('0x3f')],null))[_0xcca8('0x14')](respondWithResult(_0x5e03e5,null))[_0xcca8('0x38')](handleError(_0x5e03e5,null));};exports[_0xcca8('0x15')]=function(_0x2a2312,_0x19b266){return db[_0xcca8('0x1c')][_0xcca8('0x3d')]({'where':{'id':_0x2a2312[_0xcca8('0x3a')]['id']}})[_0xcca8('0x14')](handleEntityNotFound(_0x19b266,null))['then'](removeEntity(_0x19b266,null))[_0xcca8('0x38')](handleError(_0x19b266,null));};exports[_0xcca8('0x45')]=function(_0x4aa6e1,_0x34a944){return db[_0xcca8('0x1c')][_0xcca8('0x46')]({'where':{'id':_0x4aa6e1[_0xcca8('0x3a')]['id']},'raw':!![]})['then'](function(_0x348125){if(!_0x348125)return _0x34a944[_0xcca8('0x9')](0x194);return{'url':oauth[_0xcca8('0x47')](_0x348125,_0x4aa6e1['user']['id'])};})[_0xcca8('0x14')](respondWithResult(_0x34a944,null))['catch'](handleError(_0x34a944,null));};exports[_0xcca8('0x48')]=function(_0x51b1fd,_0x2806d1){var _0x1abefa=_0x51b1fd[_0xcca8('0x3f')];var _0x232d53;var _0x5a4fcf;if(_0x1abefa[_0xcca8('0x16')])throw _0x1abefa;redis[_0xcca8('0x49')](_0x1abefa[_0xcca8('0x4a')])['then'](function(_0xba8b76){if(!_0xba8b76)throw new Error(_0xcca8('0x4b'));_0x232d53=JSON['parse'](_0xba8b76);var _0x470cc3=Buffer[_0xcca8('0x4c')](_0x1abefa[_0xcca8('0x4a')],'base64')['toString'](_0xcca8('0x4d'));_0x5a4fcf=JSON[_0xcca8('0x4e')](_0x470cc3);if(!oauth[_0xcca8('0x4f')](_0x1abefa[_0xcca8('0x50')],_0x232d53[_0xcca8('0x51')]))throw new Error(_0xcca8('0x52'));redis[_0xcca8('0x53')](_0x1abefa[_0xcca8('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1abefa[_0xcca8('0x54')],_0x232d53);})[_0xcca8('0x14')](function(_0x4dcca6){_0x232d53[_0xcca8('0x55')]=_0x4dcca6[_0xcca8('0x56')];_0x232d53[_0xcca8('0x57')]=_0x4dcca6[_0xcca8('0x58')];return db['CloudProvider'][_0xcca8('0x13')]({'data5':_0x232d53[_0xcca8('0x55')],'data6':_0x232d53[_0xcca8('0x57')]},{'where':{'id':_0x232d53['id']}});})[_0xcca8('0x14')](function(){oauth[_0xcca8('0x59')](_0x232d53);socket[_0xcca8('0x5a')](_0xcca8('0x5b'),{'id':_0x5a4fcf['id']});return;})[_0xcca8('0x14')](respondWithStatusCode(_0x2806d1,null))[_0xcca8('0x38')](function(_0xeb321d){if(_0x5a4fcf){socket[_0xcca8('0x5a')](_0xcca8('0x5c'),{'id':_0x5a4fcf['id']});}if(!_0x232d53){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0xeb321d);return _0x2806d1['status'](0x1f4)[_0xcca8('0x18')](_0xeb321d[_0xcca8('0x5d')]);}logger[_0xcca8('0x16')](_0xcca8('0x5e'),_0x232d53['id'],JSON[_0xcca8('0x5f')](_0xeb321d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 5c75f21..4a107c8 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 _0xda9c=['../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x34b6ba,_0x2ebe76){var _0x34779a=function(_0x1e509f){while(--_0x1e509f){_0x34b6ba['push'](_0x34b6ba['shift']());}};_0x34779a(++_0x2ebe76);}(_0xda9c,0x113));var _0xcda9=function(_0x25efb3,_0x417166){_0x25efb3=_0x25efb3-0x0;var _0x15e1f9=_0xda9c[_0x25efb3];return _0x15e1f9;};'use strict';var _=require(_0xcda9('0x0'));var util=require(_0xcda9('0x1'));var logger=require(_0xcda9('0x2'))('api');var moment=require(_0xcda9('0x3'));var BPromise=require(_0xcda9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcda9('0x5'));var attributes=require(_0xcda9('0x6'));module[_0xcda9('0x7')]=function(_0x4171f3,_0x52cd4b){return _0x4171f3['define'](_0xcda9('0x8'),attributes,{'tableName':_0xcda9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd867=['./cloudProvider.attributes','exports','define','CloudProvider','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x467180,_0x44b5c6){var _0x573b61=function(_0x48df01){while(--_0x48df01){_0x467180['push'](_0x467180['shift']());}};_0x573b61(++_0x44b5c6);}(_0xd867,0x1bc));var _0x7d86=function(_0x24c63a,_0x3017dd){_0x24c63a=_0x24c63a-0x0;var _0x27e88e=_0xd867[_0x24c63a];return _0x27e88e;};'use strict';var _=require(_0x7d86('0x0'));var util=require(_0x7d86('0x1'));var logger=require(_0x7d86('0x2'))(_0x7d86('0x3'));var moment=require('moment');var BPromise=require(_0x7d86('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d86('0x5'));var config=require(_0x7d86('0x6'));var attributes=require(_0x7d86('0x7'));module[_0x7d86('0x8')]=function(_0x23481a,_0x3db015){return _0x23481a[_0x7d86('0x9')](_0x7d86('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 3a702d2..79aaf15 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 _0xa767=['response_mode','form_post','scope','state','prompt','login','key','oauth2Claims','oauth2/','data1','set','payload','iss','issuer','audience','nonce','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','POST','{TENANT_ID}','intervals','bind','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','map','Dynamics365','push','data7','/.default','type','Outlook365','data2','code','id_token','from','stringify','toString','base64','hex','response_type','data4'];(function(_0x2717c9,_0x3166f1){var _0x553f1a=function(_0xadab68){while(--_0xadab68){_0x2717c9['push'](_0x2717c9['shift']());}};_0x553f1a(++_0x3166f1);}(_0xa767,0x156));var _0x7a76=function(_0x509af6,_0x348740){_0x509af6=_0x509af6-0x0;var _0x54edde=_0xa767[_0x509af6];return _0x54edde;};'use strict';var _=require(_0x7a76('0x0'));var crypto=require(_0x7a76('0x1'));var jwt=require(_0x7a76('0x2'));var moment=require(_0x7a76('0x3'));var Redis=require(_0x7a76('0x4'));var rp=require(_0x7a76('0x5'));var util=require(_0x7a76('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0x7a76('0x7'));var logger=require(_0x7a76('0x8'))('api');var schedule=require(_0x7a76('0x9'));var db=require(_0x7a76('0xa'))['db'];config['redis']=_[_0x7a76('0xb')](config[_0x7a76('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x7a76('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x7a76('0xe'),_0x7a76('0xf'),_0x7a76('0x10'),_0x7a76('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x7a76('0x12')],'Dynamics365':[_0x7a76('0x13'),_0x7a76('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x7a76('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x467eb8){var _0x1bd5b2=_[_0x7a76('0x15')](AZURE_AUTH_SCOPES[_0x467eb8['type']]);if(_0x467eb8['type']===_0x7a76('0x16'))_0x1bd5b2[_0x7a76('0x17')](_0x467eb8[_0x7a76('0x18')]+_0x7a76('0x19'));return _0x1bd5b2['join']('\x20');}function getAccessTokenScope(_0x6a7fc4){if(_0x6a7fc4[_0x7a76('0x1a')]===_0x7a76('0x1b'))return _0x7a76('0x11');if(_0x6a7fc4['type']===_0x7a76('0x16'))return _0x6a7fc4[_0x7a76('0x18')]+_0x7a76('0x19');}function generateMicrosoftAuthorizationUrl(_0x10680c,_0x41f2d2){var _0x58243e=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x10680c[_0x7a76('0x1c')]);var _0xb8bcfd=[_0x7a76('0x1d'),_0x7a76('0x1e')];var _0x3fad82=Buffer[_0x7a76('0x1f')](JSON[_0x7a76('0x20')]({'id':_0x41f2d2}))[_0x7a76('0x21')](_0x7a76('0x22'));var _0x5df7c8=crypto['randomBytes'](0x10)['toString'](_0x7a76('0x23'));var _0x131dbe=getAuthorizationScopes(_0x10680c);var _0x1de4e2=[{'key':'client_id','value':_0x10680c['data1']},{'key':_0x7a76('0x24'),'value':encodeURIComponent(_0xb8bcfd['join']('\x20'))},{'key':'redirect_uri','value':_0x10680c[_0x7a76('0x25')]},{'key':_0x7a76('0x26'),'value':_0x7a76('0x27')},{'key':_0x7a76('0x28'),'value':encodeURIComponent(_0x131dbe)},{'key':_0x7a76('0x29'),'value':_0x3fad82},{'key':'nonce','value':_0x5df7c8},{'key':_0x7a76('0x2a'),'value':_0x7a76('0x2b')}];var _0x404c6f=_0x58243e+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x7a76('0x15')](_0x1de4e2,function(_0x5323fc){return _0x5323fc[_0x7a76('0x2c')]+'='+_0x5323fc['value'];})['join']('&');_0x10680c[_0x7a76('0x2d')]={'issuer':_0x58243e['replace'](_0x7a76('0x2e'),''),'audience':_0x10680c[_0x7a76('0x2f')],'state':_0x3fad82,'nonce':_0x5df7c8};redis[_0x7a76('0x30')](_0x3fad82,JSON['stringify'](_0x10680c));return _0x404c6f;}function isValidIdToken(_0x2b2bb3,_0x55312f){try{var _0x43839=jwt['decode'](_0x2b2bb3,{'complete':!![]});var _0x18fdc0=_0x43839[_0x7a76('0x31')];if(_0x18fdc0[_0x7a76('0x32')]!==_0x55312f[_0x7a76('0x33')])return![];if(_0x18fdc0['aud']!==_0x55312f[_0x7a76('0x34')])return![];if(_0x18fdc0['nonce']!==_0x55312f[_0x7a76('0x35')])return![];if(moment()['isAfter'](moment['unix'](_0x18fdc0[_0x7a76('0x36')])))return![];return!![];}catch(_0x9d4378){throw _0x9d4378;}}function refreshOauth2MicrosoftAccessToken(_0xe38bb9){return Promise[_0x7a76('0x37')]()[_0x7a76('0x38')](function(){if(_0xe38bb9['data3'])return _0xe38bb9;return db[_0x7a76('0x39')][_0x7a76('0x3a')]({'where':{'id':_0xe38bb9['id']},'raw':!![]});})[_0x7a76('0x38')](function(_0x2d6440){var _0x4cdbda={'grant_type':_0x7a76('0x3b'),'refresh_token':_0x2d6440[_0x7a76('0x3c')],'scope':getAccessTokenScope(_0x2d6440),'redirect_uri':_0x2d6440['data4'],'client_id':_0x2d6440[_0x7a76('0x2f')],'client_secret':encryptor[_0x7a76('0x3d')](_0x2d6440['data3'])};var _0x34daa2={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x2d6440[_0x7a76('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4cdbda,'json':!![]};return rp(_0x34daa2);})[_0x7a76('0x38')](function(_0x4bec94){_0xe38bb9[_0x7a76('0x3e')]=_0x4bec94[_0x7a76('0x3f')];_0xe38bb9['data6']=_0x4bec94['refresh_token'];return db['CloudProvider'][_0x7a76('0x40')]({'data5':_0xe38bb9[_0x7a76('0x3e')],'data6':_0xe38bb9[_0x7a76('0x3c')]},{'where':{'id':_0xe38bb9['id']}});})['then'](function(){return _0xe38bb9;})[_0x7a76('0x41')](function(_0x2a66d1){logger[_0x7a76('0x42')](_0x7a76('0x43'),_0xe38bb9['id'],_0x2a66d1);});}function getOauth2MicrosoftAccessToken(_0x3cba68,_0x4f1c47){var _0xa2e1bb={'grant_type':_0x7a76('0x44'),'code':_0x3cba68,'scope':getAccessTokenScope(_0x4f1c47),'redirect_uri':_0x4f1c47[_0x7a76('0x25')],'client_id':_0x4f1c47[_0x7a76('0x2f')],'client_secret':encryptor[_0x7a76('0x3d')](_0x4f1c47[_0x7a76('0x45')])};var _0x184145={'method':_0x7a76('0x46'),'uri':MICROSOFT_AUTH_URL['replace'](_0x7a76('0x47'),_0x4f1c47[_0x7a76('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xa2e1bb,'json':!![]};return rp(_0x184145);}function startRefreshInterval(_0x31beba){var _0x2cb25c=schedule[_0x7a76('0x48')];if(_0x2cb25c[_0x31beba['id']])clearInterval(_0x2cb25c[_0x31beba['id']]);_0x2cb25c[_0x31beba['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x7a76('0x49')](this,{'id':_0x31beba['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x7a76('0x48')]=_0x2cb25c;}function startAllRefreshIntervals(){return db[_0x7a76('0x39')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x7a76('0x38')](function(_0x211d29){var _0x3d31e5=_0x211d29[_0x7a76('0x15')](function(_0x889231){return refreshOauth2MicrosoftAccessToken(_0x889231)[_0x7a76('0x38')](function(_0x444e6b){startRefreshInterval(_0x444e6b);});});return Promise['all'](_0x3d31e5);})['catch'](function(_0x265e86){var _0x330d5d=_0x265e86?util[_0x7a76('0x4a')](_0x265e86,{'showHidden':![],'depth':null}):'';logger[_0x7a76('0x42')](_0x7a76('0x4b'),_0x330d5d);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x8143=['response_mode','form_post','scope','state','nonce','map','key','oauth2Claims','oauth2/','payload','iss','issuer','aud','audience','isAfter','exp','then','data3','CloudProvider','findOne','refresh_token','data6','data4','decryptString','replace','data5','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','catch','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','type','Dynamics365','push','/.default','Outlook365','data7','{TENANT_ID}','data2','code','id_token','from','stringify','base64','randomBytes','toString','hex','client_id','data1','join'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x8143,0x73));var _0x3814=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8143[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x3814('0x0'));var crypto=require('crypto');var jwt=require(_0x3814('0x1'));var moment=require('moment');var Redis=require(_0x3814('0x2'));var rp=require('request-promise');var util=require(_0x3814('0x3'));var encryptor=require(_0x3814('0x4'));var config=require(_0x3814('0x5'));var logger=require(_0x3814('0x6'))(_0x3814('0x7'));var schedule=require(_0x3814('0x8'));var db=require(_0x3814('0x9'))['db'];config[_0x3814('0xa')]=_[_0x3814('0xb')](config[_0x3814('0xa')],{'host':_0x3814('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x3814('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3814('0xe'),_0x3814('0xf'),'email',_0x3814('0x10'),_0x3814('0x11'),_0x3814('0x12'),_0x3814('0x13')],'Dynamics365':[_0x3814('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4e93c6){var _0x29afce=_['map'](AZURE_AUTH_SCOPES[_0x4e93c6['type']]);if(_0x4e93c6[_0x3814('0x14')]===_0x3814('0x15'))_0x29afce[_0x3814('0x16')](_0x4e93c6['data7']+_0x3814('0x17'));return _0x29afce['join']('\x20');}function getAccessTokenScope(_0x126652){if(_0x126652['type']===_0x3814('0x18'))return _0x3814('0x11');if(_0x126652[_0x3814('0x14')]===_0x3814('0x15'))return _0x126652[_0x3814('0x19')]+_0x3814('0x17');}function generateMicrosoftAuthorizationUrl(_0x55bf86,_0x5cc6ef){var _0x4ed6bd=MICROSOFT_AUTH_URL['replace'](_0x3814('0x1a'),_0x55bf86[_0x3814('0x1b')]);var _0xfc2486=[_0x3814('0x1c'),_0x3814('0x1d')];var _0x4c2df5=Buffer[_0x3814('0x1e')](JSON[_0x3814('0x1f')]({'id':_0x5cc6ef}))['toString'](_0x3814('0x20'));var _0x58dd48=crypto[_0x3814('0x21')](0x10)[_0x3814('0x22')](_0x3814('0x23'));var _0x4aa74d=getAuthorizationScopes(_0x55bf86);var _0x120362=[{'key':_0x3814('0x24'),'value':_0x55bf86[_0x3814('0x25')]},{'key':'response_type','value':encodeURIComponent(_0xfc2486[_0x3814('0x26')]('\x20'))},{'key':'redirect_uri','value':_0x55bf86['data4']},{'key':_0x3814('0x27'),'value':_0x3814('0x28')},{'key':_0x3814('0x29'),'value':encodeURIComponent(_0x4aa74d)},{'key':_0x3814('0x2a'),'value':_0x4c2df5},{'key':_0x3814('0x2b'),'value':_0x58dd48},{'key':'prompt','value':'login'}];var _0x2700d0=_0x4ed6bd+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3814('0x2c')](_0x120362,function(_0x4f6b54){return _0x4f6b54[_0x3814('0x2d')]+'='+_0x4f6b54['value'];})['join']('&');_0x55bf86[_0x3814('0x2e')]={'issuer':_0x4ed6bd['replace'](_0x3814('0x2f'),''),'audience':_0x55bf86[_0x3814('0x25')],'state':_0x4c2df5,'nonce':_0x58dd48};redis['set'](_0x4c2df5,JSON[_0x3814('0x1f')](_0x55bf86));return _0x2700d0;}function isValidIdToken(_0x29cca2,_0x1530d7){try{var _0x3d40c8=jwt['decode'](_0x29cca2,{'complete':!![]});var _0x4c864b=_0x3d40c8[_0x3814('0x30')];if(_0x4c864b[_0x3814('0x31')]!==_0x1530d7[_0x3814('0x32')])return![];if(_0x4c864b[_0x3814('0x33')]!==_0x1530d7[_0x3814('0x34')])return![];if(_0x4c864b[_0x3814('0x2b')]!==_0x1530d7[_0x3814('0x2b')])return![];if(moment()[_0x3814('0x35')](moment['unix'](_0x4c864b[_0x3814('0x36')])))return![];return!![];}catch(_0x54b461){throw _0x54b461;}}function refreshOauth2MicrosoftAccessToken(_0x53bf14){return Promise['resolve']()[_0x3814('0x37')](function(){if(_0x53bf14[_0x3814('0x38')])return _0x53bf14;return db[_0x3814('0x39')][_0x3814('0x3a')]({'where':{'id':_0x53bf14['id']},'raw':!![]});})[_0x3814('0x37')](function(_0x66e419){var _0x31e794={'grant_type':_0x3814('0x3b'),'refresh_token':_0x66e419[_0x3814('0x3c')],'scope':getAccessTokenScope(_0x66e419),'redirect_uri':_0x66e419[_0x3814('0x3d')],'client_id':_0x66e419[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0x66e419[_0x3814('0x38')])};var _0x27073f={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')]('{TENANT_ID}',_0x66e419['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x31e794,'json':!![]};return rp(_0x27073f);})['then'](function(_0x3f9d97){_0x53bf14[_0x3814('0x40')]=_0x3f9d97['access_token'];_0x53bf14[_0x3814('0x3c')]=_0x3f9d97[_0x3814('0x3b')];return db[_0x3814('0x39')][_0x3814('0x41')]({'data5':_0x53bf14[_0x3814('0x40')],'data6':_0x53bf14[_0x3814('0x3c')]},{'where':{'id':_0x53bf14['id']}});})[_0x3814('0x37')](function(){return _0x53bf14;})['catch'](function(_0x2239e1){logger['error'](_0x3814('0x42'),_0x53bf14['id'],_0x2239e1);});}function getOauth2MicrosoftAccessToken(_0x1e6e63,_0xe1d356){var _0x309c5a={'grant_type':_0x3814('0x43'),'code':_0x1e6e63,'scope':getAccessTokenScope(_0xe1d356),'redirect_uri':_0xe1d356[_0x3814('0x3d')],'client_id':_0xe1d356[_0x3814('0x25')],'client_secret':encryptor[_0x3814('0x3e')](_0xe1d356[_0x3814('0x38')])};var _0x468d8b={'method':_0x3814('0x44'),'uri':MICROSOFT_AUTH_URL[_0x3814('0x3f')](_0x3814('0x1a'),_0xe1d356[_0x3814('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x309c5a,'json':!![]};return rp(_0x468d8b);}function startRefreshInterval(_0x29423b){var _0x29ae83=schedule[_0x3814('0x45')];if(_0x29ae83[_0x29423b['id']])clearInterval(_0x29ae83[_0x29423b['id']]);_0x29ae83[_0x29423b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3814('0x46')](this,{'id':_0x29423b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3814('0x45')]=_0x29ae83;}function startAllRefreshIntervals(){return db[_0x3814('0x39')][_0x3814('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x3814('0x37')](function(_0x4325ac){var _0x5ac3ef=_0x4325ac[_0x3814('0x2c')](function(_0x43b7be){return refreshOauth2MicrosoftAccessToken(_0x43b7be)[_0x3814('0x37')](function(_0x2f91c7){startRefreshInterval(_0x2f91c7);});});return Promise[_0x3814('0x48')](_0x5ac3ef);})[_0x3814('0x49')](function(_0x16b8aa){var _0x480c8e=_0x16b8aa?util['inspect'](_0x16b8aa,{'showHidden':![],'depth':null}):'';logger[_0x3814('0x4a')](_0x3814('0x4b'),_0x480c8e);});}module[_0x3814('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 dae8c40..3588bd4 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 _0xdcdb=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdcdb,0x64));var _0xbdcd=function(_0x144ae9,_0x4f551f){_0x144ae9=_0x144ae9-0x0;var _0x2bae3d=_0xdcdb[_0x144ae9];return _0x2bae3d;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var moment=require(_0xbdcd('0x2'));var BPromise=require(_0xbdcd('0x3'));var rs=require(_0xbdcd('0x4'));var fs=require('fs');var Redis=require(_0xbdcd('0x5'));var db=require(_0xbdcd('0x6'))['db'];var utils=require(_0xbdcd('0x7'));var logger=require(_0xbdcd('0x8'))(_0xbdcd('0x9'));var config=require(_0xbdcd('0xa'));var jayson=require(_0xbdcd('0xb'));var client=jayson[_0xbdcd('0xc')][_0xbdcd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3f2bbc,_0x8744ad,_0xbccbe2){return new BPromise(function(_0x338a29,_0x201493){return client[_0xbdcd('0xe')](_0x3f2bbc,_0xbccbe2)['then'](function(_0x6d798a){logger[_0xbdcd('0xf')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0xbdcd('0x10'));logger[_0xbdcd('0x11')](_0xbdcd('0x12'),_0x8744ad,_0xbdcd('0x10'),JSON[_0xbdcd('0x13')](_0x6d798a));if(_0x6d798a[_0xbdcd('0x14')]){if(_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x15')]===0x1f4){logger['error'](_0xbdcd('0x16'),_0x8744ad,_0x6d798a['error'][_0xbdcd('0x17')]);return _0x201493(_0x6d798a['error']['message']);}logger[_0xbdcd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8744ad,_0x6d798a[_0xbdcd('0x14')][_0xbdcd('0x17')]);return _0x338a29(_0x6d798a['error'][_0xbdcd('0x17')]);}else{logger[_0xbdcd('0xf')](_0xbdcd('0x16'),_0x8744ad,_0xbdcd('0x10'));_0x338a29(_0x6d798a['result'][_0xbdcd('0x17')]);}})[_0xbdcd('0x18')](function(_0x2893d7){logger[_0xbdcd('0x14')](_0xbdcd('0x16'),_0x8744ad,_0x2893d7);_0x201493(_0x2893d7);});});} \ No newline at end of file +var _0x896e=['CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2bcdf4,_0x1a2f20){var _0x4a0f7a=function(_0x1e924f){while(--_0x1e924f){_0x2bcdf4['push'](_0x2bcdf4['shift']());}};_0x4a0f7a(++_0x1a2f20);}(_0x896e,0x1e9));var _0xe896=function(_0x122818,_0x4fab10){_0x122818=_0x122818-0x0;var _0x3d7e15=_0x896e[_0x122818];return _0x3d7e15;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 0f4670c..97aae92 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 _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x55476a,_0x30248d){var _0x3dc586=function(_0xdf6b76){while(--_0xdf6b76){_0x55476a['push'](_0x55476a['shift']());}};_0x3dc586(++_0x30248d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +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(_0x4e4b9c,_0x5874d7){var _0x438597=function(_0xdc17fb){while(--_0xdc17fb){_0x4e4b9c['push'](_0x4e4b9c['shift']());}};_0x438597(++_0x5874d7);}(_0xdb28,0x106));var _0x8db2=function(_0x2034f2,_0x3c62e8){_0x2034f2=_0x2034f2-0x0;var _0x34947d=_0xdb28[_0x2034f2];return _0x34947d;};'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 9f0028a..aec1a49 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 _0x3770=['STRING','sequelize','exports'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x3770,0x13c));var _0x0377=function(_0x510a7a,_0x542a25){_0x510a7a=_0x510a7a-0x0;var _0x3ff130=_0x3770[_0x510a7a];return _0x3ff130;};'use strict';var Sequelize=require(_0x0377('0x0'));module[_0x0377('0x1')]={'name':{'type':Sequelize[_0x0377('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x0377('0x2')]},'website':{'type':Sequelize[_0x0377('0x2')]},'phone':{'type':Sequelize[_0x0377('0x2')]},'fax':{'type':Sequelize[_0x0377('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0377('0x2')]},'postalCode':{'type':Sequelize[_0x0377('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0377('0x2')]},'email':{'type':Sequelize[_0x0377('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x0377('0x2')]},'sPostalCode':{'type':Sequelize[_0x0377('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x0377('0x2')]},'description':{'type':Sequelize[_0x0377('0x2')]}}; \ No newline at end of file +var _0x4278=['name','exports','STRING'];(function(_0x2bbab0,_0x26d5b1){var _0x2a0573=function(_0x1a6a70){while(--_0x1a6a70){_0x2bbab0['push'](_0x2bbab0['shift']());}};_0x2a0573(++_0x26d5b1);}(_0x4278,0x18d));var _0x8427=function(_0x4a7ea8,_0x29cf44){_0x4a7ea8=_0x4a7ea8-0x0;var _0x37d438=_0x4278[_0x4a7ea8];return _0x37d438;};'use strict';var Sequelize=require('sequelize');module[_0x8427('0x0')]={'name':{'type':Sequelize[_0x8427('0x1')],'unique':_0x8427('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8427('0x1')]},'companyId':{'type':Sequelize[_0x8427('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8427('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8427('0x1')]},'postalCode':{'type':Sequelize[_0x8427('0x1')]},'city':{'type':Sequelize[_0x8427('0x1')]},'country':{'type':Sequelize[_0x8427('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8427('0x1')]},'sStreet':{'type':Sequelize[_0x8427('0x1')]},'sPostalCode':{'type':Sequelize[_0x8427('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8427('0x1')]},'description':{'type':Sequelize[_0x8427('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 942cca3..0cb4a1c 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 _0x0486=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','stack','name','send','index','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','CmCompany','findAll','catch','show','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','ids','getContacts','findOne','CmContact','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x0486,0x9e));var _0x6048=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x0486[_0x2a18b7];return _0x45e74e;};'use strict';var emlformat=require(_0x6048('0x0'));var rimraf=require(_0x6048('0x1'));var zipdir=require(_0x6048('0x2'));var jsonpatch=require(_0x6048('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6048('0x4'));var Mustache=require('mustache');var util=require(_0x6048('0x5'));var path=require('path');var sox=require(_0x6048('0x6'));var csv=require(_0x6048('0x7'));var ejs=require(_0x6048('0x8'));var fs=require('fs');var fs_extra=require(_0x6048('0x9'));var _=require(_0x6048('0xa'));var squel=require(_0x6048('0xb'));var crypto=require(_0x6048('0xc'));var jsforce=require(_0x6048('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6048('0x7'));var querystring=require('querystring');var Papa=require(_0x6048('0xe'));var Redis=require(_0x6048('0xf'));var authService=require(_0x6048('0x10'));var qs=require(_0x6048('0x11'));var as=require(_0x6048('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6048('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6048('0x14'));var licenseUtil=require(_0x6048('0x15'));var db=require(_0x6048('0x16'))['db'];function respondWithStatusCode(_0x112c43,_0x3cfba8){_0x3cfba8=_0x3cfba8||0xcc;return function(_0x3a04f5){if(_0x3a04f5){return _0x112c43['sendStatus'](_0x3cfba8);}return _0x112c43[_0x6048('0x17')](_0x3cfba8)[_0x6048('0x18')]();};}function respondWithResult(_0x54165d,_0x18ad75){_0x18ad75=_0x18ad75||0xc8;return function(_0x433b07){if(_0x433b07){return _0x54165d[_0x6048('0x17')](_0x18ad75)['json'](_0x433b07);}};}function respondWithFilteredResult(_0x22e626,_0x1a8c26){return function(_0x3242cf){if(_0x3242cf){var _0x1c4870=typeof _0x1a8c26[_0x6048('0x19')]===_0x6048('0x1a')&&typeof _0x1a8c26[_0x6048('0x1b')]===_0x6048('0x1a');var _0xfd99ab=_0x3242cf['count'];var _0x43c209=_0x1c4870?0x0:_0x1a8c26[_0x6048('0x19')];var _0x1d33b0=_0x1c4870?_0x3242cf[_0x6048('0x1c')]:_0x1a8c26[_0x6048('0x19')]+_0x1a8c26[_0x6048('0x1b')];var _0x2d206e;if(_0x1d33b0>=_0xfd99ab){_0x1d33b0=_0xfd99ab;_0x2d206e=0xc8;}else{_0x2d206e=0xce;}_0x22e626[_0x6048('0x17')](_0x2d206e);return _0x22e626[_0x6048('0x1d')](_0x6048('0x1e'),_0x43c209+'-'+_0x1d33b0+'/'+_0xfd99ab)[_0x6048('0x1f')](_0x3242cf);}return null;};}function patchUpdates(_0x294466){return function(_0x4b7452){try{jsonpatch[_0x6048('0x20')](_0x4b7452,_0x294466,!![]);}catch(_0x3b6817){return BPromise[_0x6048('0x21')](_0x3b6817);}return _0x4b7452[_0x6048('0x22')]();};}function saveUpdates(_0x34425f,_0x1e25a4){return function(_0x29d1aa){if(_0x29d1aa){return _0x29d1aa[_0x6048('0x23')](_0x34425f)[_0x6048('0x24')](function(_0x18a37f){return _0x18a37f;});}return null;};}function removeEntity(_0x1d7771,_0xf191fe){return function(_0x5d3636){if(_0x5d3636){return _0x5d3636[_0x6048('0x25')]()[_0x6048('0x24')](function(){var _0x5e986e=_0x5d3636[_0x6048('0x26')]({'plain':!![]});var _0x4091ed=_0x6048('0x27');return db[_0x6048('0x28')][_0x6048('0x25')]({'where':{'type':_0x4091ed,'resourceId':_0x5e986e['id']}})[_0x6048('0x24')](function(){return _0x5d3636;});})[_0x6048('0x24')](function(){_0x1d7771['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dcae,_0x55cd37){return function(_0x5b59d9){if(!_0x5b59d9){_0x25dcae[_0x6048('0x29')](0x194);}return _0x5b59d9;};}function handleError(_0x30da42,_0x2d194f){_0x2d194f=_0x2d194f||0x1f4;return function(_0x181677){logger['error'](_0x181677[_0x6048('0x2a')]);if(_0x181677[_0x6048('0x2b')]){delete _0x181677[_0x6048('0x2b')];}_0x30da42[_0x6048('0x17')](_0x2d194f)[_0x6048('0x2c')](_0x181677);};}exports[_0x6048('0x2d')]=function(_0x7ca377,_0x5a28a8){var _0x2590e8={},_0x17c6ff={},_0x520450={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x6048('0x24')](function(_0x399642){_0x17c6ff[_0x6048('0x2e')]=_[_0x6048('0x2f')](_0x399642);_0x17c6ff[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x7ca377[_0x6048('0x30')]);_0x17c6ff[_0x6048('0x31')]=_[_0x6048('0x32')](_0x17c6ff[_0x6048('0x2e')],_0x17c6ff['query']);_0x2590e8[_0x6048('0x33')]=_['intersection'](_0x17c6ff[_0x6048('0x2e')],qs['fields'](_0x7ca377[_0x6048('0x30')]['fields']));_0x2590e8[_0x6048('0x33')]=_0x2590e8[_0x6048('0x33')][_0x6048('0x34')]?_0x2590e8[_0x6048('0x33')]:_0x17c6ff[_0x6048('0x2e')];if(!_0x7ca377[_0x6048('0x30')][_0x6048('0x35')](_0x6048('0x36'))){_0x2590e8[_0x6048('0x1b')]=qs[_0x6048('0x1b')](_0x7ca377['query'][_0x6048('0x1b')]);_0x2590e8[_0x6048('0x19')]=qs[_0x6048('0x19')](_0x7ca377['query'][_0x6048('0x19')]);}_0x2590e8[_0x6048('0x37')]=qs['sort'](_0x7ca377[_0x6048('0x30')][_0x6048('0x38')]);_0x2590e8[_0x6048('0x39')]=qs['filters'](_[_0x6048('0x3a')](_0x7ca377[_0x6048('0x30')],_0x17c6ff[_0x6048('0x31')]),_0x399642);if(_0x7ca377[_0x6048('0x30')]['filter']){_0x2590e8[_0x6048('0x39')]=_[_0x6048('0x3b')](_0x2590e8[_0x6048('0x39')],{'$or':_[_0x6048('0x3c')](_0x2590e8[_0x6048('0x33')],function(_0x1f7bb8){var _0x4f9cc2={};_0x4f9cc2[_0x1f7bb8]={'$like':'%'+_0x7ca377['query'][_0x6048('0x3d')]+'%'};return _0x4f9cc2;})});}_0x2590e8=_[_0x6048('0x3b')]({},_0x2590e8,_0x7ca377[_0x6048('0x3e')]);var _0x171786={'where':_0x2590e8[_0x6048('0x39')]};return db['CmCompany'][_0x6048('0x1c')](_0x171786)[_0x6048('0x24')](function(_0x10b58a){_0x520450[_0x6048('0x1c')]=_0x10b58a;if(_0x7ca377[_0x6048('0x30')][_0x6048('0x3f')]){_0x2590e8[_0x6048('0x40')]=[{'all':!![]}];}return db[_0x6048('0x41')][_0x6048('0x42')](_0x2590e8);})[_0x6048('0x24')](function(_0x306284){_0x520450['rows']=_0x306284;return _0x520450;})[_0x6048('0x24')](respondWithFilteredResult(_0x5a28a8,_0x2590e8))[_0x6048('0x43')](handleError(_0x5a28a8,null));})[_0x6048('0x43')](handleError(_0x5a28a8,null));};exports[_0x6048('0x44')]=function(_0x591d5e,_0x400078){var _0x516afa={'raw':![],'where':{'id':_0x591d5e['params']['id']}},_0x5c6f1a={};_0x5c6f1a[_0x6048('0x2e')]=_['keys'](db[_0x6048('0x41')][_0x6048('0x45')]);_0x5c6f1a[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x591d5e[_0x6048('0x30')]);_0x5c6f1a[_0x6048('0x31')]=_['intersection'](_0x5c6f1a[_0x6048('0x2e')],_0x5c6f1a[_0x6048('0x30')]);_0x516afa[_0x6048('0x33')]=_[_0x6048('0x32')](_0x5c6f1a['model'],qs[_0x6048('0x46')](_0x591d5e[_0x6048('0x30')][_0x6048('0x46')]));_0x516afa[_0x6048('0x33')]=_0x516afa[_0x6048('0x33')][_0x6048('0x34')]?_0x516afa['attributes']:_0x5c6f1a['model'];if(_0x591d5e[_0x6048('0x30')][_0x6048('0x3f')]){_0x516afa['include']=[{'all':!![]}];}_0x516afa=_[_0x6048('0x3b')]({},_0x516afa,_0x591d5e['options']);return db[_0x6048('0x41')][_0x6048('0x47')](_0x516afa)[_0x6048('0x24')](handleEntityNotFound(_0x400078,null))[_0x6048('0x24')](respondWithResult(_0x400078,null))[_0x6048('0x43')](handleError(_0x400078,null));};exports[_0x6048('0x48')]=function(_0x3343a2,_0xa8228d){return db[_0x6048('0x41')]['create'](_0x3343a2[_0x6048('0x49')],{})['then'](function(_0x420ec8){var _0x2e1d42=_0x3343a2[_0x6048('0x4a')][_0x6048('0x26')]({'plain':!![]});if(!_0x2e1d42)throw new Error(_0x6048('0x4b'));if(_0x2e1d42[_0x6048('0x4c')]==='user'){var _0xc1fc7c=_0x420ec8[_0x6048('0x26')]({'plain':!![]});var _0x370df2=_0x6048('0x27');return db[_0x6048('0x4d')][_0x6048('0x47')]({'where':{'name':_0x370df2,'userProfileId':_0x2e1d42['userProfileId']},'raw':!![]})[_0x6048('0x24')](function(_0x503480){if(_0x503480&&_0x503480[_0x6048('0x4e')]===0x0){return db[_0x6048('0x28')][_0x6048('0x48')]({'name':_0xc1fc7c['name'],'resourceId':_0xc1fc7c['id'],'type':_0x503480['name'],'sectionId':_0x503480['id']},{})[_0x6048('0x24')](function(){return _0x420ec8;});}else{return _0x420ec8;}})['catch'](function(_0x33336f){logger[_0x6048('0x4f')](_0x6048('0x50'),_0x33336f);throw _0x33336f;});}return _0x420ec8;})['then'](respondWithResult(_0xa8228d,0xc9))[_0x6048('0x43')](handleError(_0xa8228d,null));};exports[_0x6048('0x23')]=function(_0x3bde24,_0x1f4364){if(_0x3bde24[_0x6048('0x49')]['id']){delete _0x3bde24[_0x6048('0x49')]['id'];}return db[_0x6048('0x41')][_0x6048('0x47')]({'where':{'id':_0x3bde24[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x1f4364,null))['then'](saveUpdates(_0x3bde24['body'],null))[_0x6048('0x24')](respondWithResult(_0x1f4364,null))[_0x6048('0x43')](handleError(_0x1f4364,null));};exports[_0x6048('0x25')]=function(_0x221e21,_0x55cce8){return db[_0x6048('0x41')][_0x6048('0x47')]({'where':{'id':_0x221e21[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x55cce8,null))['then'](removeEntity(_0x55cce8,null))[_0x6048('0x43')](handleError(_0x55cce8,null));};exports[_0x6048('0x52')]=function(_0x42958f,_0x148b2b){return db[_0x6048('0x41')][_0x6048('0x52')]()['then'](respondWithResult(_0x148b2b,null))['catch'](handleError(_0x148b2b,null));};exports[_0x6048('0x53')]=function(_0x37ff29,_0x3beb69,_0x3aee9d){return db['CmContact'][_0x6048('0x47')]({'where':{'id':_0x37ff29[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x3beb69,null))[_0x6048('0x24')](function(_0x55e8aa){if(_0x55e8aa){return _0x55e8aa[_0x6048('0x53')](_0x37ff29['body']['ids'],_['omit'](_0x37ff29[_0x6048('0x49')],[_0x6048('0x54'),'id'])||{});}})[_0x6048('0x24')](respondWithResult(_0x3beb69,null))[_0x6048('0x43')](handleError(_0x3beb69,null));};exports[_0x6048('0x55')]=function(_0x32e6c4,_0x40b1a4,_0x1e7948){var _0x533205={};var _0x22949e={};var _0x1ac43e;var _0x3dc9e4;return db['CmCompany'][_0x6048('0x56')]({'where':{'id':_0x32e6c4[_0x6048('0x51')]['id']}})[_0x6048('0x24')](handleEntityNotFound(_0x40b1a4,null))[_0x6048('0x24')](function(_0x4082ad){if(_0x4082ad){_0x1ac43e=_0x4082ad;_0x22949e[_0x6048('0x2e')]=_[_0x6048('0x2f')](db[_0x6048('0x57')][_0x6048('0x45')]);_0x22949e[_0x6048('0x30')]=_[_0x6048('0x2f')](_0x32e6c4[_0x6048('0x30')]);_0x22949e[_0x6048('0x31')]=_[_0x6048('0x32')](_0x22949e[_0x6048('0x2e')],_0x22949e['query']);_0x533205[_0x6048('0x33')]=_['intersection'](_0x22949e[_0x6048('0x2e')],qs[_0x6048('0x46')](_0x32e6c4[_0x6048('0x30')][_0x6048('0x46')]));_0x533205[_0x6048('0x33')]=_0x533205[_0x6048('0x33')]['length']?_0x533205['attributes']:_0x22949e[_0x6048('0x2e')];_0x533205['order']=qs[_0x6048('0x38')](_0x32e6c4['query']['sort']);_0x533205[_0x6048('0x39')]=qs[_0x6048('0x31')](_['pick'](_0x32e6c4[_0x6048('0x30')],_0x22949e[_0x6048('0x31')]));if(_0x32e6c4[_0x6048('0x30')]['filter']){_0x533205[_0x6048('0x39')]=_[_0x6048('0x3b')](_0x533205['where'],{'$or':_[_0x6048('0x3c')](_0x533205[_0x6048('0x33')],function(_0x93cb2){var _0x2367f2={};_0x2367f2[_0x93cb2]={'$like':'%'+_0x32e6c4[_0x6048('0x30')]['filter']+'%'};return _0x2367f2;})});}_0x533205=_[_0x6048('0x3b')]({},_0x533205,_0x32e6c4['options']);return _0x1ac43e[_0x6048('0x55')](_0x533205);}})['then'](function(_0x2422ea){if(_0x2422ea){_0x3dc9e4=_0x2422ea[_0x6048('0x34')];if(!_0x32e6c4[_0x6048('0x30')][_0x6048('0x35')](_0x6048('0x36'))){_0x533205[_0x6048('0x1b')]=qs[_0x6048('0x1b')](_0x32e6c4[_0x6048('0x30')][_0x6048('0x1b')]);_0x533205[_0x6048('0x19')]=qs[_0x6048('0x19')](_0x32e6c4[_0x6048('0x30')]['offset']);}return _0x1ac43e[_0x6048('0x55')](_0x533205);}})[_0x6048('0x24')](function(_0x5ea77f){if(_0x5ea77f){return _0x5ea77f?{'count':_0x3dc9e4,'rows':_0x5ea77f}:null;}})[_0x6048('0x24')](respondWithResult(_0x40b1a4,null))[_0x6048('0x43')](handleError(_0x40b1a4,null));}; \ No newline at end of file +var _0x6c47=['fields','length','nolimit','sort','where','pick','filter','map','merge','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','getContacts','findOne','rawAttributes','order','hasOwnProperty','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','Companies','destroy','then','end','stack','send','CmCompany','describe','model','keys','filters','intersection','query','attributes'];(function(_0x5b72d5,_0xf47723){var _0x2e8fb4=function(_0x397eff){while(--_0x397eff){_0x5b72d5['push'](_0x5b72d5['shift']());}};_0x2e8fb4(++_0xf47723);}(_0x6c47,0x1cc));var _0x76c4=function(_0x58c7a9,_0x4ef324){_0x58c7a9=_0x58c7a9-0x0;var _0x46c842=_0x6c47[_0x58c7a9];return _0x46c842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76c4('0x0'));var zipdir=require(_0x76c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76c4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76c4('0x3'));var util=require(_0x76c4('0x4'));var path=require(_0x76c4('0x5'));var sox=require(_0x76c4('0x6'));var csv=require(_0x76c4('0x7'));var ejs=require(_0x76c4('0x8'));var fs=require('fs');var fs_extra=require(_0x76c4('0x9'));var _=require(_0x76c4('0xa'));var squel=require('squel');var crypto=require(_0x76c4('0xb'));var jsforce=require(_0x76c4('0xc'));var deskjs=require(_0x76c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x76c4('0xe'));var Papa=require(_0x76c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76c4('0x10'));var hardwareService=require(_0x76c4('0x11'));var logger=require(_0x76c4('0x12'))(_0x76c4('0x13'));var utils=require(_0x76c4('0x14'));var config=require(_0x76c4('0x15'));var licenseUtil=require(_0x76c4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf600,_0x423a5e){_0x423a5e=_0x423a5e||0xcc;return function(_0x1ecbc7){if(_0x1ecbc7){return _0x4bf600[_0x76c4('0x17')](_0x423a5e);}return _0x4bf600[_0x76c4('0x18')](_0x423a5e)['end']();};}function respondWithResult(_0x194557,_0x39654f){_0x39654f=_0x39654f||0xc8;return function(_0x205bd7){if(_0x205bd7){return _0x194557[_0x76c4('0x18')](_0x39654f)[_0x76c4('0x19')](_0x205bd7);}};}function respondWithFilteredResult(_0x2964e5,_0x25bfe2){return function(_0x175e02){if(_0x175e02){var _0xbcec6b=typeof _0x25bfe2[_0x76c4('0x1a')]===_0x76c4('0x1b')&&typeof _0x25bfe2[_0x76c4('0x1c')]===_0x76c4('0x1b');var _0x44de0e=_0x175e02['count'];var _0x4c293c=_0xbcec6b?0x0:_0x25bfe2[_0x76c4('0x1a')];var _0x293378=_0xbcec6b?_0x175e02[_0x76c4('0x1d')]:_0x25bfe2['offset']+_0x25bfe2[_0x76c4('0x1c')];var _0x3cb3ae;if(_0x293378>=_0x44de0e){_0x293378=_0x44de0e;_0x3cb3ae=0xc8;}else{_0x3cb3ae=0xce;}_0x2964e5['status'](_0x3cb3ae);return _0x2964e5[_0x76c4('0x1e')](_0x76c4('0x1f'),_0x4c293c+'-'+_0x293378+'/'+_0x44de0e)[_0x76c4('0x19')](_0x175e02);}return null;};}function patchUpdates(_0x34b92c){return function(_0x461a09){try{jsonpatch[_0x76c4('0x20')](_0x461a09,_0x34b92c,!![]);}catch(_0x211175){return BPromise[_0x76c4('0x21')](_0x211175);}return _0x461a09['save']();};}function saveUpdates(_0x2e422d,_0x1c449b){return function(_0x1fdfb1){if(_0x1fdfb1){return _0x1fdfb1[_0x76c4('0x22')](_0x2e422d)['then'](function(_0x475c56){return _0x475c56;});}return null;};}function removeEntity(_0x4335e4,_0x52e928){return function(_0x4cf7eb){if(_0x4cf7eb){return _0x4cf7eb['destroy']()['then'](function(){var _0x15a2ed=_0x4cf7eb[_0x76c4('0x23')]({'plain':!![]});var _0x53ba7c=_0x76c4('0x24');return db['UserProfileResource'][_0x76c4('0x25')]({'where':{'type':_0x53ba7c,'resourceId':_0x15a2ed['id']}})[_0x76c4('0x26')](function(){return _0x4cf7eb;});})['then'](function(){_0x4335e4[_0x76c4('0x18')](0xcc)[_0x76c4('0x27')]();});}};}function handleEntityNotFound(_0x553246,_0x49cd2f){return function(_0xf0a816){if(!_0xf0a816){_0x553246[_0x76c4('0x17')](0x194);}return _0xf0a816;};}function handleError(_0x2f4cb6,_0x35e417){_0x35e417=_0x35e417||0x1f4;return function(_0x489952){logger['error'](_0x489952[_0x76c4('0x28')]);if(_0x489952['name']){delete _0x489952['name'];}_0x2f4cb6[_0x76c4('0x18')](_0x35e417)[_0x76c4('0x29')](_0x489952);};}exports['index']=function(_0x40ed2a,_0x4dbad7){var _0x39e33f={},_0x3eb8b2={},_0x2c2f42={'count':0x0,'rows':[]};return db[_0x76c4('0x2a')][_0x76c4('0x2b')]()['then'](function(_0x2eccbb){_0x3eb8b2[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](_0x2eccbb);_0x3eb8b2['query']=_['keys'](_0x40ed2a['query']);_0x3eb8b2[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],_0x3eb8b2[_0x76c4('0x30')]);_0x39e33f[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3eb8b2[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x32')]));_0x39e33f[_0x76c4('0x31')]=_0x39e33f[_0x76c4('0x31')][_0x76c4('0x33')]?_0x39e33f[_0x76c4('0x31')]:_0x3eb8b2['model'];if(!_0x40ed2a[_0x76c4('0x30')]['hasOwnProperty'](_0x76c4('0x34'))){_0x39e33f[_0x76c4('0x1c')]=qs['limit'](_0x40ed2a[_0x76c4('0x30')]['limit']);_0x39e33f[_0x76c4('0x1a')]=qs[_0x76c4('0x1a')](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x1a')]);}_0x39e33f['order']=qs['sort'](_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x35')]);_0x39e33f[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_[_0x76c4('0x37')](_0x40ed2a[_0x76c4('0x30')],_0x3eb8b2[_0x76c4('0x2e')]),_0x2eccbb);if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]){_0x39e33f[_0x76c4('0x36')]=_['merge'](_0x39e33f[_0x76c4('0x36')],{'$or':_[_0x76c4('0x39')](_0x39e33f[_0x76c4('0x31')],function(_0x31211f){var _0x5300ab={};_0x5300ab[_0x31211f]={'$like':'%'+_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x38')]+'%'};return _0x5300ab;})});}_0x39e33f=_[_0x76c4('0x3a')]({},_0x39e33f,_0x40ed2a['options']);var _0xee99d8={'where':_0x39e33f[_0x76c4('0x36')]};return db[_0x76c4('0x2a')][_0x76c4('0x1d')](_0xee99d8)[_0x76c4('0x26')](function(_0x81b05e){_0x2c2f42[_0x76c4('0x1d')]=_0x81b05e;if(_0x40ed2a[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x39e33f['include']=[{'all':!![]}];}return db[_0x76c4('0x2a')][_0x76c4('0x3c')](_0x39e33f);})[_0x76c4('0x26')](function(_0x3a0080){_0x2c2f42['rows']=_0x3a0080;return _0x2c2f42;})['then'](respondWithFilteredResult(_0x4dbad7,_0x39e33f))[_0x76c4('0x3d')](handleError(_0x4dbad7,null));})[_0x76c4('0x3d')](handleError(_0x4dbad7,null));};exports[_0x76c4('0x3e')]=function(_0x1f92ca,_0x2f4740){var _0x56d488={'raw':![],'where':{'id':_0x1f92ca[_0x76c4('0x3f')]['id']}},_0x513098={};_0x513098[_0x76c4('0x2c')]=_[_0x76c4('0x2d')](db[_0x76c4('0x2a')]['rawAttributes']);_0x513098['query']=_[_0x76c4('0x2d')](_0x1f92ca['query']);_0x513098[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],_0x513098[_0x76c4('0x30')]);_0x56d488['attributes']=_[_0x76c4('0x2f')](_0x513098[_0x76c4('0x2c')],qs['fields'](_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x32')]));_0x56d488[_0x76c4('0x31')]=_0x56d488[_0x76c4('0x31')][_0x76c4('0x33')]?_0x56d488['attributes']:_0x513098[_0x76c4('0x2c')];if(_0x1f92ca[_0x76c4('0x30')][_0x76c4('0x3b')]){_0x56d488[_0x76c4('0x40')]=[{'all':!![]}];}_0x56d488=_['merge']({},_0x56d488,_0x1f92ca[_0x76c4('0x41')]);return db[_0x76c4('0x2a')][_0x76c4('0x42')](_0x56d488)[_0x76c4('0x26')](handleEntityNotFound(_0x2f4740,null))[_0x76c4('0x26')](respondWithResult(_0x2f4740,null))[_0x76c4('0x3d')](handleError(_0x2f4740,null));};exports[_0x76c4('0x43')]=function(_0x45fa98,_0x21e2bd){return db[_0x76c4('0x2a')][_0x76c4('0x43')](_0x45fa98[_0x76c4('0x44')],{})[_0x76c4('0x26')](function(_0x5c0cff){var _0x41cfe0=_0x45fa98[_0x76c4('0x45')][_0x76c4('0x23')]({'plain':!![]});if(!_0x41cfe0)throw new Error(_0x76c4('0x46'));if(_0x41cfe0[_0x76c4('0x47')]==='user'){var _0x300cea=_0x5c0cff[_0x76c4('0x23')]({'plain':!![]});var _0x1f9f62=_0x76c4('0x24');return db[_0x76c4('0x48')][_0x76c4('0x42')]({'where':{'name':_0x1f9f62,'userProfileId':_0x41cfe0[_0x76c4('0x49')]},'raw':!![]})[_0x76c4('0x26')](function(_0x6241be){if(_0x6241be&&_0x6241be['autoAssociation']===0x0){return db[_0x76c4('0x4a')][_0x76c4('0x43')]({'name':_0x300cea[_0x76c4('0x4b')],'resourceId':_0x300cea['id'],'type':_0x6241be['name'],'sectionId':_0x6241be['id']},{})[_0x76c4('0x26')](function(){return _0x5c0cff;});}else{return _0x5c0cff;}})['catch'](function(_0x15de53){logger[_0x76c4('0x4c')](_0x76c4('0x4d'),_0x15de53);throw _0x15de53;});}return _0x5c0cff;})[_0x76c4('0x26')](respondWithResult(_0x21e2bd,0xc9))['catch'](handleError(_0x21e2bd,null));};exports[_0x76c4('0x22')]=function(_0x555feb,_0x58e403){if(_0x555feb[_0x76c4('0x44')]['id']){delete _0x555feb[_0x76c4('0x44')]['id'];}return db['CmCompany'][_0x76c4('0x42')]({'where':{'id':_0x555feb['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x58e403,null))['then'](saveUpdates(_0x555feb['body'],null))[_0x76c4('0x26')](respondWithResult(_0x58e403,null))[_0x76c4('0x3d')](handleError(_0x58e403,null));};exports['destroy']=function(_0x1e45f4,_0x4cd0df){return db[_0x76c4('0x2a')]['find']({'where':{'id':_0x1e45f4[_0x76c4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4cd0df,null))['then'](removeEntity(_0x4cd0df,null))['catch'](handleError(_0x4cd0df,null));};exports[_0x76c4('0x2b')]=function(_0x1cda07,_0x2a7a3c){return db['CmCompany'][_0x76c4('0x2b')]()['then'](respondWithResult(_0x2a7a3c,null))[_0x76c4('0x3d')](handleError(_0x2a7a3c,null));};exports['addContacts']=function(_0x210e96,_0x37c229,_0x1fd91b){return db[_0x76c4('0x4e')][_0x76c4('0x42')]({'where':{'id':_0x210e96[_0x76c4('0x3f')]['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x37c229,null))[_0x76c4('0x26')](function(_0x389c45){if(_0x389c45){return _0x389c45['addContacts'](_0x210e96[_0x76c4('0x44')][_0x76c4('0x4f')],_['omit'](_0x210e96[_0x76c4('0x44')],[_0x76c4('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x37c229,null))[_0x76c4('0x3d')](handleError(_0x37c229,null));};exports[_0x76c4('0x50')]=function(_0x2f6c7d,_0x230935,_0x3a111a){var _0xcae341={};var _0x3c3405={};var _0x558878;var _0x1468f6;return db[_0x76c4('0x2a')][_0x76c4('0x51')]({'where':{'id':_0x2f6c7d['params']['id']}})[_0x76c4('0x26')](handleEntityNotFound(_0x230935,null))['then'](function(_0x5ee59){if(_0x5ee59){_0x558878=_0x5ee59;_0x3c3405[_0x76c4('0x2c')]=_['keys'](db[_0x76c4('0x4e')][_0x76c4('0x52')]);_0x3c3405[_0x76c4('0x30')]=_[_0x76c4('0x2d')](_0x2f6c7d[_0x76c4('0x30')]);_0x3c3405[_0x76c4('0x2e')]=_[_0x76c4('0x2f')](_0x3c3405['model'],_0x3c3405[_0x76c4('0x30')]);_0xcae341[_0x76c4('0x31')]=_[_0x76c4('0x2f')](_0x3c3405[_0x76c4('0x2c')],qs[_0x76c4('0x32')](_0x2f6c7d[_0x76c4('0x30')]['fields']));_0xcae341[_0x76c4('0x31')]=_0xcae341['attributes'][_0x76c4('0x33')]?_0xcae341[_0x76c4('0x31')]:_0x3c3405[_0x76c4('0x2c')];_0xcae341[_0x76c4('0x53')]=qs[_0x76c4('0x35')](_0x2f6c7d['query'][_0x76c4('0x35')]);_0xcae341[_0x76c4('0x36')]=qs[_0x76c4('0x2e')](_['pick'](_0x2f6c7d[_0x76c4('0x30')],_0x3c3405[_0x76c4('0x2e')]));if(_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x38')]){_0xcae341[_0x76c4('0x36')]=_['merge'](_0xcae341[_0x76c4('0x36')],{'$or':_['map'](_0xcae341[_0x76c4('0x31')],function(_0x50f7e5){var _0x208922={};_0x208922[_0x50f7e5]={'$like':'%'+_0x2f6c7d['query'][_0x76c4('0x38')]+'%'};return _0x208922;})});}_0xcae341=_[_0x76c4('0x3a')]({},_0xcae341,_0x2f6c7d['options']);return _0x558878[_0x76c4('0x50')](_0xcae341);}})[_0x76c4('0x26')](function(_0x27c5b9){if(_0x27c5b9){_0x1468f6=_0x27c5b9['length'];if(!_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x54')](_0x76c4('0x34'))){_0xcae341['limit']=qs[_0x76c4('0x1c')](_0x2f6c7d[_0x76c4('0x30')]['limit']);_0xcae341[_0x76c4('0x1a')]=qs['offset'](_0x2f6c7d[_0x76c4('0x30')][_0x76c4('0x1a')]);}return _0x558878['getContacts'](_0xcae341);}})['then'](function(_0x4b8c66){if(_0x4b8c66){return _0x4b8c66?{'count':_0x1468f6,'rows':_0x4b8c66}:null;}})[_0x76c4('0x26')](respondWithResult(_0x230935,null))[_0x76c4('0x3d')](handleError(_0x230935,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6a35dbf..e40f5d7 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 _0x6c30=['exports','define','cm_companies','lodash','util','../../config/logger','api','bluebird','../../config/environment'];(function(_0x243f93,_0x5503eb){var _0x55cdaa=function(_0x5c79e6){while(--_0x5c79e6){_0x243f93['push'](_0x243f93['shift']());}};_0x55cdaa(++_0x5503eb);}(_0x6c30,0xe4));var _0x06c3=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x6c30[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x06c3('0x0'));var util=require(_0x06c3('0x1'));var logger=require(_0x06c3('0x2'))(_0x06c3('0x3'));var moment=require('moment');var BPromise=require(_0x06c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x06c3('0x5'));var attributes=require('./cmCompany.attributes');module[_0x06c3('0x6')]=function(_0x1ac0d2,_0x247154){return _0x1ac0d2[_0x06c3('0x7')]('CmCompany',attributes,{'tableName':_0x06c3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x763e=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0x1be5ca,_0x4d5966){var _0x255754=function(_0xe270c2){while(--_0xe270c2){_0x1be5ca['push'](_0x1be5ca['shift']());}};_0x255754(++_0x4d5966);}(_0x763e,0x184));var _0xe763=function(_0x56072d,_0x187f3d){_0x56072d=_0x56072d-0x0;var _0x5ef918=_0x763e[_0x56072d];return _0x5ef918;};'use strict';var _=require(_0xe763('0x0'));var util=require(_0xe763('0x1'));var logger=require(_0xe763('0x2'))(_0xe763('0x3'));var moment=require(_0xe763('0x4'));var BPromise=require('bluebird');var rp=require(_0xe763('0x5'));var fs=require('fs');var path=require(_0xe763('0x6'));var rimraf=require(_0xe763('0x7'));var config=require(_0xe763('0x8'));var attributes=require(_0xe763('0x9'));module['exports']=function(_0x44bdd2,_0x5106a1){return _0x44bdd2[_0xe763('0xa')](_0xe763('0xb'),attributes,{'tableName':_0xe763('0xc'),'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 89b2921..3cc1afe 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 _0xe1b7=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xe961d5,_0xabcb0d){var _0x3cf8c3=function(_0x273d93){while(--_0x273d93){_0xe961d5['push'](_0xe961d5['shift']());}};_0x3cf8c3(++_0xabcb0d);}(_0xe1b7,0x179));var _0x7e1b=function(_0x2219bd,_0x9cfd12){_0x2219bd=_0x2219bd-0x0;var _0xb72639=_0xe1b7[_0x2219bd];return _0xb72639;};'use strict';var _=require(_0x7e1b('0x0'));var util=require(_0x7e1b('0x1'));var moment=require(_0x7e1b('0x2'));var BPromise=require(_0x7e1b('0x3'));var rs=require(_0x7e1b('0x4'));var fs=require('fs');var Redis=require(_0x7e1b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e1b('0x6'));var logger=require(_0x7e1b('0x7'))(_0x7e1b('0x8'));var config=require(_0x7e1b('0x9'));var jayson=require(_0x7e1b('0xa'));var client=jayson[_0x7e1b('0xb')][_0x7e1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x515fc2,_0xaf42c,_0x5c610e){return new BPromise(function(_0x2a4339,_0x14e303){return client[_0x7e1b('0xd')](_0x515fc2,_0x5c610e)[_0x7e1b('0xe')](function(_0x501a17){logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0xaf42c,_0x7e1b('0x11'));logger[_0x7e1b('0x12')](_0x7e1b('0x13'),_0xaf42c,'request\x20sent',JSON[_0x7e1b('0x14')](_0x501a17));if(_0x501a17[_0x7e1b('0x15')]){if(_0x501a17[_0x7e1b('0x15')]['code']===0x1f4){logger['error'](_0x7e1b('0x10'),_0xaf42c,_0x501a17['error'][_0x7e1b('0x16')]);return _0x14e303(_0x501a17['error']['message']);}logger[_0x7e1b('0x15')](_0x7e1b('0x10'),_0xaf42c,_0x501a17['error'][_0x7e1b('0x16')]);return _0x2a4339(_0x501a17[_0x7e1b('0x15')][_0x7e1b('0x16')]);}else{logger[_0x7e1b('0xf')](_0x7e1b('0x10'),_0xaf42c,_0x7e1b('0x11'));_0x2a4339(_0x501a17[_0x7e1b('0x17')]['message']);}})[_0x7e1b('0x18')](function(_0x4746bd){logger[_0x7e1b('0x15')](_0x7e1b('0x10'),_0xaf42c,_0x4746bd);_0x14e303(_0x4746bd);});});} \ No newline at end of file +var _0x7f11=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x3b516e,_0x565238){var _0x1a929c=function(_0xe2fab6){while(--_0xe2fab6){_0x3b516e['push'](_0x3b516e['shift']());}};_0x1a929c(++_0x565238);}(_0x7f11,0x175));var _0x17f1=function(_0x16495f,_0x5f2cac){_0x16495f=_0x16495f-0x0;var _0x957e3e=_0x7f11[_0x16495f];return _0x957e3e;};'use strict';var _=require(_0x17f1('0x0'));var util=require(_0x17f1('0x1'));var moment=require(_0x17f1('0x2'));var BPromise=require('bluebird');var rs=require(_0x17f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17f1('0x4'))['db'];var utils=require(_0x17f1('0x5'));var logger=require(_0x17f1('0x6'))(_0x17f1('0x7'));var config=require(_0x17f1('0x8'));var jayson=require(_0x17f1('0x9'));var client=jayson[_0x17f1('0xa')][_0x17f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ce48c,_0x1485a8,_0x1c7dff){return new BPromise(function(_0x5c4804,_0x32ad56){return client[_0x17f1('0xc')](_0x2ce48c,_0x1c7dff)[_0x17f1('0xd')](function(_0x7da095){logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));logger[_0x17f1('0x11')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x1485a8,_0x17f1('0x10'),JSON[_0x17f1('0x12')](_0x7da095));if(_0x7da095['error']){if(_0x7da095[_0x17f1('0x13')]['code']===0x1f4){logger['error'](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x32ad56(_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);}logger[_0x17f1('0x13')](_0x17f1('0xf'),_0x1485a8,_0x7da095[_0x17f1('0x13')][_0x17f1('0x14')]);return _0x5c4804(_0x7da095[_0x17f1('0x13')]['message']);}else{logger[_0x17f1('0xe')](_0x17f1('0xf'),_0x1485a8,_0x17f1('0x10'));_0x5c4804(_0x7da095['result'][_0x17f1('0x14')]);}})[_0x17f1('0x15')](function(_0x22c8eb){logger[_0x17f1('0x13')]('CmCompany,\x20%s,\x20%s',_0x1485a8,_0x22c8eb);_0x32ad56(_0x22c8eb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index cf7bab3..a39bb7f 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 _0xd2ee=['getContacts','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','show'];(function(_0x1a4f8d,_0x57ce58){var _0x436671=function(_0x477f72){while(--_0x477f72){_0x1a4f8d['push'](_0x1a4f8d['shift']());}};_0x436671(++_0x57ce58);}(_0xd2ee,0x1a7));var _0xed2e=function(_0x58c701,_0xd216a9){_0x58c701=_0x58c701-0x0;var _0x24a7ce=_0xd2ee[_0x58c701];return _0x24a7ce;};'use strict';var multer=require(_0xed2e('0x0'));var util=require(_0xed2e('0x1'));var path=require('path');var timeout=require(_0xed2e('0x2'));var express=require('express');var router=express[_0xed2e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed2e('0x4'));var interaction=require(_0xed2e('0x5'));var config=require(_0xed2e('0x6'));var controller=require(_0xed2e('0x7'));router['get']('/',auth[_0xed2e('0x8')](),controller[_0xed2e('0x9')]);router['get'](_0xed2e('0xa'),auth[_0xed2e('0x8')](),controller[_0xed2e('0xb')]);router[_0xed2e('0xc')]('/:id',auth[_0xed2e('0x8')](),controller[_0xed2e('0xd')]);router[_0xed2e('0xc')]('/:id/contacts',auth[_0xed2e('0x8')](),controller[_0xed2e('0xe')]);router[_0xed2e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0xed2e('0x8')](),controller[_0xed2e('0x10')]);router[_0xed2e('0x11')](_0xed2e('0x12'),auth['isAuthenticated'](),controller[_0xed2e('0x13')]);router[_0xed2e('0x14')]('/:id',auth[_0xed2e('0x8')](),controller[_0xed2e('0x15')]);module[_0xed2e('0x16')]=router; \ No newline at end of file +var _0xaf38=['get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaa24f8,_0x19e09f){var _0x39c565=function(_0xde1729){while(--_0xde1729){_0xaa24f8['push'](_0xaa24f8['shift']());}};_0x39c565(++_0x19e09f);}(_0xaf38,0x10b));var _0x8af3=function(_0x36a5df,_0x3711be){_0x36a5df=_0x36a5df-0x0;var _0x4e671f=_0xaf38[_0x36a5df];return _0x4e671f;};'use strict';var multer=require(_0x8af3('0x0'));var util=require(_0x8af3('0x1'));var path=require(_0x8af3('0x2'));var timeout=require(_0x8af3('0x3'));var express=require(_0x8af3('0x4'));var router=express[_0x8af3('0x5')]();var fs_extra=require(_0x8af3('0x6'));var auth=require(_0x8af3('0x7'));var interaction=require(_0x8af3('0x8'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x8af3('0x9')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0xb')]);router[_0x8af3('0x9')](_0x8af3('0xc'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xd')]);router['get'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0xf')]);router[_0x8af3('0x9')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x10')]);router[_0x8af3('0x11')]('/',auth[_0x8af3('0xa')](),controller[_0x8af3('0x12')]);router[_0x8af3('0x11')]('/:id/contacts',auth[_0x8af3('0xa')](),controller[_0x8af3('0x13')]);router[_0x8af3('0x14')]('/:id',auth[_0x8af3('0xa')](),controller['update']);router['delete'](_0x8af3('0xe'),auth[_0x8af3('0xa')](),controller[_0x8af3('0x15')]);module[_0x8af3('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 2d08bec..c0dc139 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 _0x5f2f=['INTEGER','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2a428a,_0x507be7){var _0x501b4b=function(_0x592f03){while(--_0x592f03){_0x2a428a['push'](_0x2a428a['shift']());}};_0x501b4b(++_0x507be7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f4f78,_0x19ed14){_0x5f4f78=_0x5f4f78-0x0;var _0x445ce5=_0x5f2f[_0x5f4f78];return _0x445ce5;};'use strict';var _=require(_0xf5f2('0x0'));var Sequelize=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'firstName':{'type':Sequelize[_0xf5f2('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf5f2('0x3')]},'street':{'type':Sequelize[_0xf5f2('0x3')]},'postalCode':{'type':Sequelize[_0xf5f2('0x3')]},'city':{'type':Sequelize[_0xf5f2('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5f2('0x4')]},'phone':{'type':Sequelize[_0xf5f2('0x3')]},'mobile':{'type':Sequelize[_0xf5f2('0x3')]},'fax':{'type':Sequelize[_0xf5f2('0x3')]},'email':{'type':Sequelize[_0xf5f2('0x3')]},'url':{'type':Sequelize[_0xf5f2('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xf5f2('0x3')]},'twitter':{'type':Sequelize[_0xf5f2('0x3')]},'skype':{'type':Sequelize[_0xf5f2('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xf5f2('0x3')]},'line':{'type':Sequelize[_0xf5f2('0x3')]},'wechat':{'type':Sequelize[_0xf5f2('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xf5f2('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':Sequelize[_0xf5f2('0x7')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf5f2('0x5')]}}; \ No newline at end of file +var _0x0b0e=['exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x1050b5,_0x4e97c7){var _0x411620=function(_0x573cd0){while(--_0x573cd0){_0x1050b5['push'](_0x1050b5['shift']());}};_0x411620(++_0x4e97c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x0b0e[_0x232cf2];return _0x463cec;};'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 a3de24d..cdc606e 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 _0x3d2e=['Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','User','binding','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','sms','fax','whatsapp','voice','-createdAt','includes','channel','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','callerid','starttime','duration','note','userDisposition','UserId','fullname','createdAt','findAndCountAll','startCase','Website','Account','closedAt','key','chat','browserName','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','openchannel','externalUrl','threadId','Interaction','Owner','flatten','sortBy','reverse','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','socket.io-emitter','./cmContact.socket','status','undefined','limit','count','offset','Content-Range','json','update','then','destroy','end','sendStatus','error','name','send','index','CmContact','describe','keys','length','startsWith','push','CmCustomField','trimStart','cf_','all','fieldType','model','query','fields','attributes','nolimit','order','sort','where','filters','pick','select','field','color','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','start','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','some','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','TagIds','Tags','catch','find','params','columnName','displayName','analytics','findAll','alias','values','body','from','get','mergeWith','isArray','tags','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','$or','spread','show','omit','format','cf_%d','$and','pickBy','table','setFields','id\x20=\x20?','toParam','phone','getTags','Tag','rawAttributes','intersection','setTags','findOne','ids','getHoppers','hasOwnProperty','ContactId','options','include','getHopperHistories','rows','getHopperFinals','getJscriptySessions','includeAll','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x3d2e,0x169));var _0xe3d2=function(_0x1c1ecc,_0x52ca15){_0x1c1ecc=_0x1c1ecc-0x0;var _0x39e611=_0x3d2e[_0x1c1ecc];return _0x39e611;};'use strict';var moment=require('moment');var BPromise=require(_0xe3d2('0x0'));var util=require(_0xe3d2('0x1'));var path=require(_0xe3d2('0x2'));var fs=require('fs');var _=require(_0xe3d2('0x3'));var squel=require(_0xe3d2('0x4'));var Papa=require(_0xe3d2('0x5'));var Redis=require(_0xe3d2('0x6'));var qs=require(_0xe3d2('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xe3d2('0x8'))('api');var config=require(_0xe3d2('0x9'));var shared=require(_0xe3d2('0xa'));var db=require(_0xe3d2('0xb'))['db'];config[_0xe3d2('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe3d2('0xd'))(new Redis(config['redis']));require(_0xe3d2('0xe'))['register'](socket);function respondWithResult(_0x1dd6b0,_0x3dacf1){_0x3dacf1=_0x3dacf1||0xc8;return function(_0xf3db8f){if(_0xf3db8f){return _0x1dd6b0[_0xe3d2('0xf')](_0x3dacf1)['json'](_0xf3db8f);}};}function respondWithFilteredResult(_0x5bbdab,_0x220847){return function(_0x223b40){if(_0x223b40){var _0x1a1465=typeof _0x220847['offset']===_0xe3d2('0x10')&&typeof _0x220847[_0xe3d2('0x11')]===_0xe3d2('0x10');var _0x331df1=_0x223b40[_0xe3d2('0x12')];var _0xa1e846=_0x1a1465?0x0:_0x220847['offset'];var _0x249e35=_0x1a1465?_0x223b40[_0xe3d2('0x12')]:_0x220847[_0xe3d2('0x13')]+_0x220847[_0xe3d2('0x11')];var _0x589f24;if(_0x249e35>=_0x331df1){_0x249e35=_0x331df1;_0x589f24=0xc8;}else{_0x589f24=0xce;}_0x5bbdab[_0xe3d2('0xf')](_0x589f24);return _0x5bbdab['set'](_0xe3d2('0x14'),_0xa1e846+'-'+_0x249e35+'/'+_0x331df1)[_0xe3d2('0x15')](_0x223b40);}return null;};}function saveUpdates(_0x1efabc){return function(_0x13b5e2){if(_0x13b5e2){return _0x13b5e2[_0xe3d2('0x16')](_0x1efabc)[_0xe3d2('0x17')](function(_0x577c60){return _0x577c60;});}return null;};}function removeEntity(_0x2e006c){return function(_0x4bd9a2){if(_0x4bd9a2){return _0x4bd9a2[_0xe3d2('0x18')]()[_0xe3d2('0x17')](function(){_0x2e006c[_0xe3d2('0xf')](0xcc)[_0xe3d2('0x19')]();});}};}function handleEntityNotFound(_0xe188e9){return function(_0xfad5a4){if(!_0xfad5a4){_0xe188e9[_0xe3d2('0x1a')](0x194);}return _0xfad5a4;};}function handleError(_0x277a27,_0x2d8d44){_0x2d8d44=_0x2d8d44||0x1f4;return function(_0x2926d3){logger[_0xe3d2('0x1b')](_0x2926d3['stack']);if(_0x2926d3[_0xe3d2('0x1c')]){delete _0x2926d3[_0xe3d2('0x1c')];}_0x277a27[_0xe3d2('0xf')](_0x2d8d44)[_0xe3d2('0x1d')](_0x2926d3);};}exports[_0xe3d2('0x1e')]=function(_0x196a45,_0x1433eb){var _0x557487={},_0x4023f4={},_0x583824={'count':0x0,'rows':[]};return db[_0xe3d2('0x1f')][_0xe3d2('0x20')]()[_0xe3d2('0x17')](function(_0x1acafa){var _0x3a598e=[];for(var _0x1e9ecd=0x0;_0x1e9ecd0x1){_0xbff85d['or'](_0xe3d2('0x5e'),qs['getFullTextValue'](_0x5d4dcb),null);}else{if(qs[_0xe3d2('0x5f')](_0x5d4dcb)){_0xbff85d['or'](_0xe3d2('0x60'),_0x5d4dcb+'%');_0xbff85d['or'](_0xe3d2('0x61'),_0x5d4dcb+'%');_0xbff85d['or'](_0xe3d2('0x62'),_0x5d4dcb+'%');_0xbff85d['or'](_0xe3d2('0x63'),_0x5d4dcb+'%');}else if(qs[_0xe3d2('0x64')](_0x5d4dcb)){_0xbff85d['or'](_0xe3d2('0x65'),_0x5d4dcb+'%');}else{_0xbff85d['or'](_0xe3d2('0x66'),'%'+_0x5d4dcb+'%');_0xbff85d['or'](_0xe3d2('0x67'),'%'+_0x5d4dcb+'%');_0xbff85d['or'](_0xe3d2('0x65'),'%'+_0x5d4dcb+'%');}}}}_0x387dae['where'](_0xbff85d);_0x387dae['group'](_0xe3d2('0x68'));var _0x119f6c={'type':db['Sequelize'][_0xe3d2('0x69')][_0xe3d2('0x6a')],'raw':!![]};var _0x2f17fe=_0x387dae[_0xe3d2('0x6b')]()[_0xe3d2('0x35')](_0xe3d2('0x68'));if(_0x557487['order']){_0x557487['order'][_0xe3d2('0x47')](function(_0xc345e0){_0x387dae['order']('c.'+_0xc345e0[0x0],_0xc345e0[0x1]===_0xe3d2('0x6c')?![]:!![]);});}if(!_[_0xe3d2('0x56')](_0xa56ce4)){_0x387dae[_0xe3d2('0x6d')](_0x2adb8a);_0x2f17fe[_0xe3d2('0x31')](_0xe3d2('0x6e'),_0xa56ce4);}BPromise[_0xe3d2('0x6f')]()[_0xe3d2('0x17')](function(){if(!_0x17c3f5)return;if(_0x196a45[_0xe3d2('0x70')][_0xe3d2('0x71')]!=='agent')return;if(!_[_0xe3d2('0x72')](_0x17c3f5[_0xe3d2('0x43')],[_0xe3d2('0x35'),'User'])){return _0x196a45[_0xe3d2('0x70')][_0xe3d2('0x73')]({'attributes':['id'],'raw':!![]})[_0xe3d2('0x17')](function(_0x40d766){if(_['isEmpty'](_0x40d766)){_0x2f17fe[_0xe3d2('0x31')](_0xe3d2('0x74'));_0x387dae['where']('c.ListId\x20IS\x20NULL');}else{_0x2f17fe[_0xe3d2('0x31')](_0xe3d2('0x58'),_[_0xe3d2('0x46')](_0x40d766,'id'));_0x387dae[_0xe3d2('0x31')](_0xe3d2('0x58'),_['map'](_0x40d766,'id'));}});}})[_0xe3d2('0x17')](function(){if(_0x196a45[_0xe3d2('0x70')][_0xe3d2('0x71')]===_0xe3d2('0x75')&&!_0x17c3f5&&!_0x196a45[_0xe3d2('0x2b')]['ListId'])return[];return db[_0xe3d2('0x76')][_0xe3d2('0x2b')](_0x2f17fe[_0xe3d2('0x77')](),_0x119f6c);})[_0xe3d2('0x17')](function(_0x3e8816){_0x583824[_0xe3d2('0x12')]=_0x3e8816['length'];if(_0x583824[_0xe3d2('0x12')]===0x0)return[];return db[_0xe3d2('0x76')][_0xe3d2('0x2b')](_0x3cbec7[_0xe3d2('0x77')](),_0x119f6c)[_0xe3d2('0x17')](function(_0x4a4b1a){_0x1ec4a6=_[_0xe3d2('0x78')](_0x4a4b1a,'id');_0x119f6c=_[_0xe3d2('0x79')](_0x119f6c,{'model':db[_0xe3d2('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x196a45['query'][_0xe3d2('0x2c')]){_0x557487[_0xe3d2('0x2d')][_0xe3d2('0x47')](function(_0x2f7edf){_0x387dae['field']('c.'+_0x2f7edf);});}else{_0x387dae['field']('c.id');_0x387dae[_0xe3d2('0x35')](_0xe3d2('0x7a'));_0x387dae[_0xe3d2('0x35')]('c.lastName');_0x387dae['field'](_0xe3d2('0x7b'));_0x387dae[_0xe3d2('0x35')](_0xe3d2('0x7c'));_0x387dae['field'](_0xe3d2('0x7d'));_0x387dae[_0xe3d2('0x35')](_0xe3d2('0x7e'));_0x387dae[_0xe3d2('0x35')](_0xe3d2('0x7f'));_0x387dae['field'](_0xe3d2('0x80'));_0x387dae[_0xe3d2('0x35')](_0xe3d2('0x81'));_0x387dae[_0xe3d2('0x35')]('c.CompanyId');_0x387dae[_0xe3d2('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe3d2('0x82'));}if(_0x557487[_0xe3d2('0x11')])_0x387dae['limit'](_0x557487['limit']);if(_0x557487[_0xe3d2('0x13')])_0x387dae[_0xe3d2('0x13')](_0x557487[_0xe3d2('0x13')]);return db[_0xe3d2('0x76')][_0xe3d2('0x2b')](_0x387dae['toString'](),_0x119f6c);});})[_0xe3d2('0x17')](function(_0x598b77){_0x598b77['forEach'](function(_0x4e8540){if(_0x4e8540[_0xe3d2('0x82')]){_0x4e8540[_0xe3d2('0x83')]=[];_0x4e8540[_0xe3d2('0x82')]['split'](',')[_0xe3d2('0x47')](function(_0x4e6d52){_0x4e8540[_0xe3d2('0x83')][_0xe3d2('0x24')](_0x1ec4a6[_0x4e6d52]);});}delete _0x4e8540[_0xe3d2('0x82')];});_0x583824['rows']=_0x598b77;return _0x583824;})[_0xe3d2('0x17')](respondWithFilteredResult(_0x1433eb,_0x557487));})[_0xe3d2('0x84')](handleError(_0x1433eb,null));};exports[_0xe3d2('0x18')]=function(_0x138189,_0x1f4032){return db[_0xe3d2('0x1f')][_0xe3d2('0x85')]({'where':{'id':_0x138189[_0xe3d2('0x86')]['id']}})[_0xe3d2('0x17')](handleEntityNotFound(_0x1f4032,null))[_0xe3d2('0x17')](removeEntity(_0x1f4032,null))[_0xe3d2('0x84')](handleError(_0x1f4032,null));};exports[_0xe3d2('0x20')]=function(_0x885635,_0x151854){return db[_0xe3d2('0x1f')][_0xe3d2('0x20')]()['then'](function(_0x3fc14a){delete _0x3fc14a['tags'];for(var _0x18281d=0x0;_0x18281d=_0xf13cbf){_0x43a530=_0xf13cbf;_0x1aae8b=0xc8;}else{_0x1aae8b=0xce;}_0x98711f[_0x2b4f('0x11')](_0x1aae8b);return _0x98711f[_0x2b4f('0x16')](_0x2b4f('0x17'),_0x2e537c+'-'+_0x43a530+'/'+_0xf13cbf)['json'](_0x2e5b83);}return null;};}function saveUpdates(_0x1362fb){return function(_0x10e536){if(_0x10e536){return _0x10e536[_0x2b4f('0x18')](_0x1362fb)[_0x2b4f('0x19')](function(_0x278b47){return _0x278b47;});}return null;};}function removeEntity(_0x20d97b){return function(_0x4edd21){if(_0x4edd21){return _0x4edd21[_0x2b4f('0x1a')]()[_0x2b4f('0x19')](function(){_0x20d97b[_0x2b4f('0x11')](0xcc)[_0x2b4f('0x1b')]();});}};}function handleEntityNotFound(_0xc5fb86){return function(_0x2d62cb){if(!_0x2d62cb){_0xc5fb86[_0x2b4f('0x1c')](0x194);}return _0x2d62cb;};}function handleError(_0x12751e,_0x449137){_0x449137=_0x449137||0x1f4;return function(_0x4ba2f1){logger[_0x2b4f('0x1d')](_0x4ba2f1[_0x2b4f('0x1e')]);if(_0x4ba2f1[_0x2b4f('0x1f')]){delete _0x4ba2f1['name'];}_0x12751e['status'](_0x449137)['send'](_0x4ba2f1);};}exports[_0x2b4f('0x20')]=function(_0x4858c8,_0x21f2a5){var _0x59b3c9={},_0x3ce3ee={},_0x3d5621={'count':0x0,'rows':[]};return db[_0x2b4f('0x21')][_0x2b4f('0x22')]()[_0x2b4f('0x19')](function(_0x2922dd){var _0x428b94=[];for(var _0x497004=0x0;_0x4970040x1){_0x4aaf95['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b4f('0x5f')](_0x10f248),null);}else{if(qs[_0x2b4f('0x60')](_0x10f248)){_0x4aaf95['or'](_0x2b4f('0x61'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x62'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x63'),_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x64'),_0x10f248+'%');}else if(qs[_0x2b4f('0x65')](_0x10f248)){_0x4aaf95['or']('c.email\x20LIKE\x20?',_0x10f248+'%');}else{_0x4aaf95['or'](_0x2b4f('0x66'),'%'+_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x67'),'%'+_0x10f248+'%');_0x4aaf95['or'](_0x2b4f('0x68'),'%'+_0x10f248+'%');}}}}_0x3446b9['where'](_0x4aaf95);_0x3446b9[_0x2b4f('0x69')](_0x2b4f('0x6a'));var _0x244673={'type':db[_0x2b4f('0x6b')][_0x2b4f('0x6c')]['SELECT'],'raw':!![]};var _0x56b26f=_0x3446b9[_0x2b4f('0x6d')]()[_0x2b4f('0x36')](_0x2b4f('0x6a'));if(_0x59b3c9['order']){_0x59b3c9['order'][_0x2b4f('0x57')](function(_0x5f5a90){_0x3446b9[_0x2b4f('0x32')]('c.'+_0x5f5a90[0x0],_0x5f5a90[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2b4f('0x56')](_0x5f16a6)){_0x3446b9[_0x2b4f('0x6e')](_0x2e9dac);_0x56b26f[_0x2b4f('0x34')](_0x2b4f('0x6f'),_0x5f16a6);}BPromise[_0x2b4f('0x70')]()[_0x2b4f('0x19')](function(){if(!_0x59f790)return;if(_0x4858c8['user'][_0x2b4f('0x71')]!==_0x2b4f('0x72'))return;if(!_[_0x2b4f('0x73')](_0x59f790[_0x2b4f('0x44')],['field',_0x2b4f('0x74')])){return _0x4858c8[_0x2b4f('0x75')]['getLists']({'attributes':['id'],'raw':!![]})['then'](function(_0x17be21){if(_[_0x2b4f('0x56')](_0x17be21)){_0x56b26f[_0x2b4f('0x34')]('c.ListId\x20IS\x20NULL');_0x3446b9['where'](_0x2b4f('0x76'));}else{_0x56b26f[_0x2b4f('0x34')](_0x2b4f('0x59'),_[_0x2b4f('0x48')](_0x17be21,'id'));_0x3446b9[_0x2b4f('0x34')]('c.ListId\x20IN\x20?',_[_0x2b4f('0x48')](_0x17be21,'id'));}});}})['then'](function(){if(_0x4858c8[_0x2b4f('0x75')][_0x2b4f('0x71')]===_0x2b4f('0x72')&&!_0x59f790&&!_0x4858c8[_0x2b4f('0x2d')][_0x2b4f('0x58')])return[];return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x56b26f[_0x2b4f('0x78')](),_0x244673);})[_0x2b4f('0x19')](function(_0x5743de){_0x3d5621[_0x2b4f('0x15')]=_0x5743de[_0x2b4f('0x24')];if(_0x3d5621[_0x2b4f('0x15')]===0x0)return[];return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x24f1f8['toString'](),_0x244673)[_0x2b4f('0x19')](function(_0xc88381){_0x220a28=_[_0x2b4f('0x79')](_0xc88381,'id');_0x244673=_[_0x2b4f('0x7a')](_0x244673,{'model':db[_0x2b4f('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4858c8['query'][_0x2b4f('0x2e')]){_0x59b3c9[_0x2b4f('0x2f')][_0x2b4f('0x57')](function(_0x4360cf){_0x3446b9[_0x2b4f('0x36')]('c.'+_0x4360cf);});}else{_0x3446b9['field'](_0x2b4f('0x6a'));_0x3446b9['field']('c.firstName');_0x3446b9[_0x2b4f('0x36')]('c.lastName');_0x3446b9['field'](_0x2b4f('0x7b'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7c'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7d'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7e'));_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x7f'));_0x3446b9['field'](_0x2b4f('0x80'));_0x3446b9['field']('c.deletedAt');_0x3446b9[_0x2b4f('0x36')](_0x2b4f('0x81'));_0x3446b9[_0x2b4f('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2b4f('0x82'));}if(_0x59b3c9['limit'])_0x3446b9[_0x2b4f('0x14')](_0x59b3c9[_0x2b4f('0x14')]);if(_0x59b3c9[_0x2b4f('0x12')])_0x3446b9[_0x2b4f('0x12')](_0x59b3c9[_0x2b4f('0x12')]);return db[_0x2b4f('0x77')][_0x2b4f('0x2d')](_0x3446b9[_0x2b4f('0x78')](),_0x244673);});})[_0x2b4f('0x19')](function(_0x5e4a5b){_0x5e4a5b[_0x2b4f('0x57')](function(_0x3e6e4b){if(_0x3e6e4b[_0x2b4f('0x82')]){_0x3e6e4b[_0x2b4f('0x83')]=[];_0x3e6e4b[_0x2b4f('0x82')]['split'](',')[_0x2b4f('0x57')](function(_0x132b7f){_0x3e6e4b[_0x2b4f('0x83')][_0x2b4f('0x26')](_0x220a28[_0x132b7f]);});}delete _0x3e6e4b['TagIds'];});_0x3d5621[_0x2b4f('0x84')]=_0x5e4a5b;return _0x3d5621;})[_0x2b4f('0x19')](respondWithFilteredResult(_0x21f2a5,_0x59b3c9));})[_0x2b4f('0x85')](handleError(_0x21f2a5,null));};exports[_0x2b4f('0x1a')]=function(_0x388495,_0x5615a2){return db['CmContact'][_0x2b4f('0x45')]({'where':{'id':_0x388495[_0x2b4f('0x86')]['id']}})[_0x2b4f('0x19')](handleEntityNotFound(_0x5615a2,null))[_0x2b4f('0x19')](removeEntity(_0x5615a2,null))[_0x2b4f('0x85')](handleError(_0x5615a2,null));};exports['describe']=function(_0x65c51d,_0xe6bf5b){return db[_0x2b4f('0x21')][_0x2b4f('0x22')]()[_0x2b4f('0x19')](function(_0x3dff73){delete _0x3dff73['tags'];for(var _0x42ed53=0x0;_0x42ed53{}\s\\|]/g,'-');_0x1f819a(null,util['format'](_0x3846('0x22'),path[_0x3846('0x23')](_0x2c61fb[_0x3846('0x20')],path['extname'](_0x2c61fb['originalname'])),Date[_0x3846('0x24')](),path[_0x3846('0x25')](_0x2c61fb['originalname'])));}})});router[_0x3846('0x17')](_0x3846('0x26'),upload['single'](_0x3846('0x27')),controller[_0x3846('0x28')]);var upload=multer({'storage':multer[_0x3846('0x1c')]({'destination':function(_0x562533,_0x2e9f9f,_0x408924){_0x408924(null,path[_0x3846('0x1d')](config[_0x3846('0x1e')],_0x3846('0x1f')));},'filename':function(_0xa69d19,_0x520137,_0x31f1e5){_0x520137[_0x3846('0x20')]=_0x520137[_0x3846('0x20')][_0x3846('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x31f1e5(null,util[_0x3846('0x29')](_0x3846('0x22'),path[_0x3846('0x23')](_0x520137[_0x3846('0x20')],path[_0x3846('0x25')](_0x520137['originalname'])),Date['now'](),path[_0x3846('0x25')](_0x520137[_0x3846('0x20')])));}})});router[_0x3846('0x17')](_0x3846('0x2a'),upload[_0x3846('0x2b')](_0x3846('0x27')),controller[_0x3846('0x2c')]);router['post'](_0x3846('0x2d'),auth[_0x3846('0x9')](),controller[_0x3846('0x2e')]);router[_0x3846('0x2f')](_0x3846('0x30'),auth['isAuthenticated'](),controller[_0x3846('0x31')]);router[_0x3846('0x32')](_0x3846('0x30'),auth['isAuthenticated'](),controller[_0x3846('0x33')]);module[_0x3846('0x34')]=router; \ No newline at end of file +var _0x0c54=['/create_many','/:id/tags','setTags','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','server/files/tmp','upload','/upload/:id','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','describe','/:id','show','getTags','/:id/hoppers','/:id/hopper_histories','getJourney','post','/merge','merge','create'];(function(_0x3c12af,_0x3de924){var _0x43eba5=function(_0x4100cb){while(--_0x4100cb){_0x3c12af['push'](_0x3c12af['shift']());}};_0x43eba5(++_0x3de924);}(_0x0c54,0x17d));var _0x40c5=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x0c54[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var path=require(_0x40c5('0x2'));var timeout=require(_0x40c5('0x3'));var express=require('express');var router=express[_0x40c5('0x4')]();var fs_extra=require(_0x40c5('0x5'));var auth=require(_0x40c5('0x6'));var interaction=require(_0x40c5('0x7'));var config=require(_0x40c5('0x8'));var controller=require(_0x40c5('0x9'));router[_0x40c5('0xa')]('/',auth[_0x40c5('0xb')](),controller[_0x40c5('0xc')]);router[_0x40c5('0xa')]('/describe',auth[_0x40c5('0xb')](),controller[_0x40c5('0xd')]);router[_0x40c5('0xa')](_0x40c5('0xe'),auth['isAuthenticated'](),controller[_0x40c5('0xf')]);router['get']('/:id/tags',auth[_0x40c5('0xb')](),controller[_0x40c5('0x10')]);router['get'](_0x40c5('0x11'),auth[_0x40c5('0xb')](),controller['getHoppers']);router[_0x40c5('0xa')](_0x40c5('0x12'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x40c5('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x40c5('0xa')]('/:id/jscripty_sessions',auth[_0x40c5('0xb')](),controller['getJscriptySessions']);router[_0x40c5('0xa')]('/:id/journey',auth[_0x40c5('0xb')](),controller[_0x40c5('0x13')]);router[_0x40c5('0x14')](_0x40c5('0x15'),auth['isAuthenticated'](),controller[_0x40c5('0x16')]);router[_0x40c5('0x14')]('/',auth[_0x40c5('0xb')](),controller[_0x40c5('0x17')]);router['post'](_0x40c5('0x18'),auth[_0x40c5('0xb')](),controller['bulkCreate']);router['post'](_0x40c5('0x19'),auth['isAuthenticated'](),controller[_0x40c5('0x1a')]);var upload=multer({'storage':multer[_0x40c5('0x1b')]({'destination':function(_0x15228e,_0x21d712,_0x1197b9){_0x1197b9(null,path[_0x40c5('0x1c')](config['root'],'server/files/tmp'));},'filename':function(_0x522044,_0x20ded8,_0x6254f2){_0x20ded8[_0x40c5('0x1d')]=_0x20ded8[_0x40c5('0x1d')][_0x40c5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6254f2(null,util[_0x40c5('0x1f')](_0x40c5('0x20'),path[_0x40c5('0x21')](_0x20ded8['originalname'],path[_0x40c5('0x22')](_0x20ded8[_0x40c5('0x1d')])),Date[_0x40c5('0x23')](),path['extname'](_0x20ded8['originalname'])));}})});router[_0x40c5('0x14')](_0x40c5('0x24'),upload[_0x40c5('0x25')](_0x40c5('0x26')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x40c5('0x1b')]({'destination':function(_0x475c10,_0x28a6f5,_0x27ef0d){_0x27ef0d(null,path[_0x40c5('0x1c')](config['root'],_0x40c5('0x27')));},'filename':function(_0x1f421b,_0x33ca76,_0x36a9dc){_0x33ca76[_0x40c5('0x1d')]=_0x33ca76[_0x40c5('0x1d')][_0x40c5('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x36a9dc(null,util['format'](_0x40c5('0x20'),path['basename'](_0x33ca76[_0x40c5('0x1d')],path[_0x40c5('0x22')](_0x33ca76['originalname'])),Date[_0x40c5('0x23')](),path[_0x40c5('0x22')](_0x33ca76[_0x40c5('0x1d')])));}})});router[_0x40c5('0x14')]('/upload',upload[_0x40c5('0x25')](_0x40c5('0x26')),controller[_0x40c5('0x28')]);router[_0x40c5('0x14')](_0x40c5('0x29'),auth[_0x40c5('0xb')](),controller['import']);router[_0x40c5('0x2a')](_0x40c5('0xe'),auth[_0x40c5('0xb')](),controller[_0x40c5('0x2b')]);router[_0x40c5('0x2c')](_0x40c5('0xe'),auth[_0x40c5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index d42715f..d2558f7 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 _0x1bc5=['sequelize','lodash','exports','VIRTUAL','getDataValue','setDataValue','alias','name','STRING','long','select','parse','values','stringify','BOOLEAN'];(function(_0x5d895b,_0x3678a0){var _0x1e52c6=function(_0x42a50b){while(--_0x42a50b){_0x5d895b['push'](_0x5d895b['shift']());}};_0x1e52c6(++_0x3678a0);}(_0x1bc5,0x1c2));var _0x51bc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1bc5[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x51bc('0x0'));var _=require(_0x51bc('0x1'));module[_0x51bc('0x2')]={'name':{'type':Sequelize[_0x51bc('0x3')],'get':function(_0x3c95db){return this[_0x51bc('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x16d499){this[_0x51bc('0x5')](_0x51bc('0x6'),_0x16d499?_0x16d499:this['getDataValue'](_0x51bc('0x7')));}},'type':{'type':Sequelize[_0x51bc('0x8')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x51bc('0x9')),'get':function(){if(this[_0x51bc('0x4')]('type')===_0x51bc('0xa')){return JSON[_0x51bc('0xb')](this[_0x51bc('0x4')](_0x51bc('0xc')));}else{return this[_0x51bc('0x4')](_0x51bc('0xc'));}},'set':function(_0x5f7855){if(Array['isArray'](_0x5f7855)){this[_0x51bc('0x5')]('values',JSON[_0x51bc('0xd')](_0x5f7855));}else{this['setDataValue'](_0x51bc('0xc'),_0x5f7855);}}},'required':{'type':Sequelize[_0x51bc('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x51bc('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0xcb63=['parse','stringify','values','BOOLEAN','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','TEXT','type'];(function(_0x2a85df,_0x21230a){var _0x428275=function(_0x90c986){while(--_0x90c986){_0x2a85df['push'](_0x2a85df['shift']());}};_0x428275(++_0x21230a);}(_0xcb63,0x115));var _0x3cb6=function(_0x744ce5,_0x32c683){_0x744ce5=_0x744ce5-0x0;var _0x4ca6f8=_0xcb63[_0x744ce5];return _0x4ca6f8;};'use strict';var Sequelize=require(_0x3cb6('0x0'));var _=require('lodash');module[_0x3cb6('0x1')]={'name':{'type':Sequelize[_0x3cb6('0x2')],'get':function(_0x45acdb){return this[_0x3cb6('0x3')]('alias');}},'alias':{'type':Sequelize[_0x3cb6('0x4')],'allowNull':![],'set':function(_0x257f2b){this[_0x3cb6('0x5')](_0x3cb6('0x6'),_0x257f2b?_0x257f2b:this[_0x3cb6('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3cb6('0x7')]('long'),'get':function(){if(this[_0x3cb6('0x3')](_0x3cb6('0x8'))==='select'){return JSON[_0x3cb6('0x9')](this[_0x3cb6('0x3')]('values'));}else{return this[_0x3cb6('0x3')]('values');}},'set':function(_0x56e725){if(Array['isArray'](_0x56e725)){this['setDataValue']('values',JSON[_0x3cb6('0xa')](_0x56e725));}else{this[_0x3cb6('0x5')](_0x3cb6('0xb'),_0x56e725);}}},'required':{'type':Sequelize[_0x3cb6('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x3cb6('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cbb93e5..4e94ed6 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 _0x30f6=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','CmCustomField','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','body','sequelize','transaction','create','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x53da6c,_0x5930d4){var _0x33c828=function(_0x4f8960){while(--_0x4f8960){_0x53da6c['push'](_0x53da6c['shift']());}};_0x33c828(++_0x5930d4);}(_0x30f6,0x1ac));var _0x630f=function(_0x44d5b7,_0x38c266){_0x44d5b7=_0x44d5b7-0x0;var _0x44f102=_0x30f6[_0x44d5b7];return _0x44f102;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x630f('0x0'));var rp=require(_0x630f('0x1'));var moment=require(_0x630f('0x2'));var BPromise=require(_0x630f('0x3'));var Mustache=require(_0x630f('0x4'));var util=require('util');var path=require(_0x630f('0x5'));var sox=require(_0x630f('0x6'));var csv=require(_0x630f('0x7'));var ejs=require(_0x630f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x630f('0x9'));var squel=require(_0x630f('0xa'));var crypto=require(_0x630f('0xb'));var jsforce=require(_0x630f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x630f('0x7'));var querystring=require(_0x630f('0xd'));var Papa=require(_0x630f('0xe'));var Redis=require(_0x630f('0xf'));var authService=require(_0x630f('0x10'));var qs=require(_0x630f('0x11'));var as=require(_0x630f('0x12'));var hardwareService=require(_0x630f('0x13'));var logger=require(_0x630f('0x14'))(_0x630f('0x15'));var utils=require(_0x630f('0x16'));var config=require(_0x630f('0x17'));var licenseUtil=require(_0x630f('0x18'));var db=require(_0x630f('0x19'))['db'];function respondWithStatusCode(_0x57e526,_0x423506){_0x423506=_0x423506||0xcc;return function(_0x1dba7a){if(_0x1dba7a){return _0x57e526[_0x630f('0x1a')](_0x423506);}return _0x57e526[_0x630f('0x1b')](_0x423506)[_0x630f('0x1c')]();};}function respondWithResult(_0x2ae8dd,_0x59b8d6){_0x59b8d6=_0x59b8d6||0xc8;return function(_0x22f169){if(_0x22f169){return _0x2ae8dd[_0x630f('0x1b')](_0x59b8d6)[_0x630f('0x1d')](_0x22f169);}};}function respondWithFilteredResult(_0x58ff40,_0x5ac35c){return function(_0x839b32){if(_0x839b32){var _0x1ea237=typeof _0x5ac35c[_0x630f('0x1e')]===_0x630f('0x1f')&&typeof _0x5ac35c[_0x630f('0x20')]==='undefined';var _0x46c747=_0x839b32[_0x630f('0x21')];var _0x1388ef=_0x1ea237?0x0:_0x5ac35c[_0x630f('0x1e')];var _0x18ca93=_0x1ea237?_0x839b32[_0x630f('0x21')]:_0x5ac35c[_0x630f('0x1e')]+_0x5ac35c['limit'];var _0x383951;if(_0x18ca93>=_0x46c747){_0x18ca93=_0x46c747;_0x383951=0xc8;}else{_0x383951=0xce;}_0x58ff40['status'](_0x383951);return _0x58ff40[_0x630f('0x22')](_0x630f('0x23'),_0x1388ef+'-'+_0x18ca93+'/'+_0x46c747)[_0x630f('0x1d')](_0x839b32);}return null;};}function patchUpdates(_0x81f344){return function(_0xd9480e){try{jsonpatch[_0x630f('0x24')](_0xd9480e,_0x81f344,!![]);}catch(_0x136fd6){return BPromise[_0x630f('0x25')](_0x136fd6);}return _0xd9480e[_0x630f('0x26')]();};}function saveUpdates(_0x21e04c,_0x396a58){return function(_0x6cf7b8){if(_0x6cf7b8){return _0x6cf7b8[_0x630f('0x27')](_0x21e04c)[_0x630f('0x28')](function(_0x45d171){return _0x45d171;});}return null;};}function removeEntity(_0x3bd679,_0x1aa7dc){return function(_0x4912d6){if(_0x4912d6){return _0x4912d6['destroy']()[_0x630f('0x28')](function(){_0x3bd679[_0x630f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0c54,_0xbd296a){return function(_0x3c0035){if(!_0x3c0035){_0x3a0c54[_0x630f('0x1a')](0x194);}return _0x3c0035;};}function handleError(_0x1add50,_0x3642f0){_0x3642f0=_0x3642f0||0x1f4;return function(_0x529737){logger[_0x630f('0x29')](_0x529737[_0x630f('0x2a')]);if(_0x529737['name']){delete _0x529737[_0x630f('0x2b')];}_0x1add50[_0x630f('0x1b')](_0x3642f0)[_0x630f('0x2c')](_0x529737);};}exports[_0x630f('0x2d')]=function(_0x20fe4c,_0x4e5b6d){var _0x20392e={},_0x190703={},_0x194e6b={'count':0x0,'rows':[]};var _0x20eba5=_['map'](db[_0x630f('0x2e')]['rawAttributes'],function(_0x1a9d05){return{'name':_0x1a9d05['fieldName'],'type':_0x1a9d05['type']['key']};});_0x190703[_0x630f('0x2f')]=_[_0x630f('0x30')](_[_0x630f('0x31')](_0x20eba5,'name'),[_0x630f('0x2b')]);_0x190703[_0x630f('0x32')]=_['keys'](_0x20fe4c[_0x630f('0x32')]);_0x190703[_0x630f('0x33')]=_[_0x630f('0x34')](_0x190703[_0x630f('0x2f')],_0x190703[_0x630f('0x32')]);_0x20392e['attributes']=_[_0x630f('0x34')](_0x190703[_0x630f('0x2f')],qs['fields'](_0x20fe4c['query'][_0x630f('0x35')]));_0x20392e[_0x630f('0x36')]=_0x20392e[_0x630f('0x36')][_0x630f('0x37')]?_0x20392e[_0x630f('0x36')]:_0x190703[_0x630f('0x2f')];if(!_0x20fe4c[_0x630f('0x32')][_0x630f('0x38')](_0x630f('0x39'))){_0x20392e[_0x630f('0x20')]=qs[_0x630f('0x20')](_0x20fe4c[_0x630f('0x32')][_0x630f('0x20')]);_0x20392e[_0x630f('0x1e')]=qs['offset'](_0x20fe4c[_0x630f('0x32')][_0x630f('0x1e')]);}_0x20392e[_0x630f('0x3a')]=qs[_0x630f('0x3b')](_0x20fe4c['query'][_0x630f('0x3b')]);_0x20392e[_0x630f('0x3c')]=qs[_0x630f('0x33')](_['pick'](_0x20fe4c[_0x630f('0x32')],_0x190703[_0x630f('0x33')]),_0x20eba5);if(_0x20fe4c[_0x630f('0x32')][_0x630f('0x3d')]){_0x20392e['where']=_[_0x630f('0x3e')](_0x20392e['where'],{'$or':_[_0x630f('0x31')](_0x20eba5,function(_0x5f8b1d){if(_0x5f8b1d[_0x630f('0x3f')]!==_0x630f('0x40')){var _0x150904={};_0x150904[_0x5f8b1d[_0x630f('0x2b')]]={'$like':'%'+_0x20fe4c[_0x630f('0x32')][_0x630f('0x3d')]+'%'};return _0x150904;}})});}_0x20392e=_[_0x630f('0x3e')]({},_0x20392e,_0x20fe4c[_0x630f('0x41')]);var _0x3f6e7e={'where':_0x20392e['where']};return db[_0x630f('0x2e')][_0x630f('0x21')](_0x3f6e7e)[_0x630f('0x28')](function(_0x3e7e82){_0x194e6b['count']=_0x3e7e82;if(_0x20fe4c[_0x630f('0x32')][_0x630f('0x42')]){_0x20392e[_0x630f('0x43')]=[{'all':!![]}];}return db[_0x630f('0x2e')][_0x630f('0x44')](_0x20392e);})[_0x630f('0x28')](function(_0x4c422e){_0x194e6b[_0x630f('0x45')]=_0x4c422e;return _0x194e6b;})[_0x630f('0x28')](respondWithFilteredResult(_0x4e5b6d,_0x20392e))[_0x630f('0x46')](handleError(_0x4e5b6d,null));};exports[_0x630f('0x47')]=function(_0x43e27f,_0x341709){var _0x29c50c={'raw':!![],'where':{'id':_0x43e27f[_0x630f('0x48')]['id']}},_0x296fac={};_0x296fac[_0x630f('0x2f')]=_[_0x630f('0x49')](db[_0x630f('0x2e')][_0x630f('0x4a')]);_0x296fac[_0x630f('0x32')]=_[_0x630f('0x49')](_0x43e27f[_0x630f('0x32')]);_0x296fac['filters']=_[_0x630f('0x34')](_0x296fac[_0x630f('0x2f')],_0x296fac['query']);_0x29c50c[_0x630f('0x36')]=_[_0x630f('0x34')](_0x296fac[_0x630f('0x2f')],qs[_0x630f('0x35')](_0x43e27f[_0x630f('0x32')][_0x630f('0x35')]));_0x29c50c[_0x630f('0x36')]=_0x29c50c['attributes']['length']?_0x29c50c[_0x630f('0x36')]:_0x296fac['model'];if(_0x43e27f[_0x630f('0x32')][_0x630f('0x42')]){_0x29c50c[_0x630f('0x43')]=[{'all':!![]}];}_0x29c50c=_['merge']({},_0x29c50c,_0x43e27f[_0x630f('0x41')]);return db[_0x630f('0x2e')][_0x630f('0x4b')](_0x29c50c)[_0x630f('0x28')](handleEntityNotFound(_0x341709,null))[_0x630f('0x28')](respondWithResult(_0x341709,null))[_0x630f('0x46')](handleError(_0x341709,null));};exports['update']=function(_0xfe7452,_0x5a854c){if(_0xfe7452[_0x630f('0x4c')]['id']){delete _0xfe7452[_0x630f('0x4c')]['id'];}return db[_0x630f('0x2e')][_0x630f('0x4b')]({'where':{'id':_0xfe7452['params']['id']}})[_0x630f('0x28')](handleEntityNotFound(_0x5a854c,null))['then'](saveUpdates(_0xfe7452[_0x630f('0x4c')],null))[_0x630f('0x28')](respondWithResult(_0x5a854c,null))['catch'](handleError(_0x5a854c,null));};exports['destroy']=function(_0x321d4e,_0x4972bb){return db[_0x630f('0x2e')][_0x630f('0x4b')]({'where':{'id':_0x321d4e['params']['id']}})['then'](handleEntityNotFound(_0x4972bb,null))[_0x630f('0x28')](removeEntity(_0x4972bb,null))[_0x630f('0x46')](handleError(_0x4972bb,null));};exports['create']=function(_0x4d8848,_0x16ce9b){var _0x40dce3;return db[_0x630f('0x4d')][_0x630f('0x4e')](function(_0xa2ed82){return db[_0x630f('0x2e')][_0x630f('0x4f')](_0x4d8848[_0x630f('0x4c')],{'transaction':_0xa2ed82})['then'](function(_0x4b2683){_0x40dce3=_0x4b2683;var _0x1f78a4={'type':db[_0x630f('0x50')][_0x630f('0x51')],'transaction':_0xa2ed82};switch(_0x4d8848['body']['type']){case _0x630f('0x52'):_0x1f78a4[_0x630f('0x3f')]=db[_0x630f('0x50')][_0x630f('0x51')];break;case _0x630f('0x53'):_0x1f78a4[_0x630f('0x3f')]=db[_0x630f('0x50')]['INTEGER'];break;case _0x630f('0x54'):_0x1f78a4[_0x630f('0x3f')]=db['Sequelize'][_0x630f('0x55')];_0x1f78a4[_0x630f('0x56')]=![];break;default:}return db[_0x630f('0x4d')][_0x630f('0x57')][_0x630f('0x58')](_0x630f('0x59'),util[_0x630f('0x5a')]('cf_%d',_0x40dce3['id']),_0x1f78a4);})[_0x630f('0x28')](function(){return _0x40dce3;});})[_0x630f('0x28')](respondWithResult(_0x16ce9b,0xc9))[_0x630f('0x46')](handleError(_0x16ce9b,null));}; \ No newline at end of file +var _0xe1e5=['find','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include'];(function(_0x13f6bb,_0x1d625f){var _0x413673=function(_0x6dacf6){while(--_0x6dacf6){_0x13f6bb['push'](_0x13f6bb['shift']());}};_0x413673(++_0x1d625f);}(_0xe1e5,0x16f));var _0x5e1e=function(_0x4ce15c,_0x1bbcbd){_0x4ce15c=_0x4ce15c-0x0;var _0x5ee259=_0xe1e5[_0x4ce15c];return _0x5ee259;};'use strict';var emlformat=require(_0x5e1e('0x0'));var rimraf=require(_0x5e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e1e('0x2'));var rp=require('request-promise');var moment=require(_0x5e1e('0x3'));var BPromise=require(_0x5e1e('0x4'));var Mustache=require(_0x5e1e('0x5'));var util=require(_0x5e1e('0x6'));var path=require(_0x5e1e('0x7'));var sox=require(_0x5e1e('0x8'));var csv=require(_0x5e1e('0x9'));var ejs=require(_0x5e1e('0xa'));var fs=require('fs');var fs_extra=require(_0x5e1e('0xb'));var _=require(_0x5e1e('0xc'));var squel=require(_0x5e1e('0xd'));var crypto=require(_0x5e1e('0xe'));var jsforce=require(_0x5e1e('0xf'));var deskjs=require(_0x5e1e('0x10'));var toCsv=require(_0x5e1e('0x9'));var querystring=require(_0x5e1e('0x11'));var Papa=require(_0x5e1e('0x12'));var Redis=require('ioredis');var authService=require(_0x5e1e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5e1e('0x14'));var hardwareService=require(_0x5e1e('0x15'));var logger=require(_0x5e1e('0x16'))(_0x5e1e('0x17'));var utils=require(_0x5e1e('0x18'));var config=require(_0x5e1e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cf565,_0x42f996){_0x42f996=_0x42f996||0xcc;return function(_0x1f97d3){if(_0x1f97d3){return _0x1cf565['sendStatus'](_0x42f996);}return _0x1cf565[_0x5e1e('0x1a')](_0x42f996)[_0x5e1e('0x1b')]();};}function respondWithResult(_0x5c7ad8,_0x457693){_0x457693=_0x457693||0xc8;return function(_0x6976a1){if(_0x6976a1){return _0x5c7ad8[_0x5e1e('0x1a')](_0x457693)[_0x5e1e('0x1c')](_0x6976a1);}};}function respondWithFilteredResult(_0x7b7539,_0x4f2478){return function(_0x3277e9){if(_0x3277e9){var _0x4062ff=typeof _0x4f2478['offset']===_0x5e1e('0x1d')&&typeof _0x4f2478[_0x5e1e('0x1e')]===_0x5e1e('0x1d');var _0x207f1c=_0x3277e9['count'];var _0x9e596=_0x4062ff?0x0:_0x4f2478[_0x5e1e('0x1f')];var _0x4502ab=_0x4062ff?_0x3277e9['count']:_0x4f2478[_0x5e1e('0x1f')]+_0x4f2478[_0x5e1e('0x1e')];var _0x453256;if(_0x4502ab>=_0x207f1c){_0x4502ab=_0x207f1c;_0x453256=0xc8;}else{_0x453256=0xce;}_0x7b7539[_0x5e1e('0x1a')](_0x453256);return _0x7b7539['set']('Content-Range',_0x9e596+'-'+_0x4502ab+'/'+_0x207f1c)['json'](_0x3277e9);}return null;};}function patchUpdates(_0x17bd06){return function(_0x1fa80f){try{jsonpatch[_0x5e1e('0x20')](_0x1fa80f,_0x17bd06,!![]);}catch(_0x176cbd){return BPromise[_0x5e1e('0x21')](_0x176cbd);}return _0x1fa80f[_0x5e1e('0x22')]();};}function saveUpdates(_0x423c19,_0xffc52b){return function(_0x2def90){if(_0x2def90){return _0x2def90[_0x5e1e('0x23')](_0x423c19)[_0x5e1e('0x24')](function(_0x4bbe13){return _0x4bbe13;});}return null;};}function removeEntity(_0x5cdc07,_0x1b330d){return function(_0x1d49c1){if(_0x1d49c1){return _0x1d49c1[_0x5e1e('0x25')]()[_0x5e1e('0x24')](function(){_0x5cdc07[_0x5e1e('0x1a')](0xcc)[_0x5e1e('0x1b')]();});}};}function handleEntityNotFound(_0x404b84,_0x5b44f3){return function(_0x2d7f6d){if(!_0x2d7f6d){_0x404b84[_0x5e1e('0x26')](0x194);}return _0x2d7f6d;};}function handleError(_0x410d9c,_0x5cc69b){_0x5cc69b=_0x5cc69b||0x1f4;return function(_0x37d186){logger[_0x5e1e('0x27')](_0x37d186[_0x5e1e('0x28')]);if(_0x37d186[_0x5e1e('0x29')]){delete _0x37d186[_0x5e1e('0x29')];}_0x410d9c[_0x5e1e('0x1a')](_0x5cc69b)[_0x5e1e('0x2a')](_0x37d186);};}exports[_0x5e1e('0x2b')]=function(_0x45a96a,_0x5ee658){var _0xc6dd66={},_0x25259e={},_0x1ce4c9={'count':0x0,'rows':[]};var _0x42c960=_[_0x5e1e('0x2c')](db[_0x5e1e('0x2d')][_0x5e1e('0x2e')],function(_0x55d133){return{'name':_0x55d133['fieldName'],'type':_0x55d133[_0x5e1e('0x2f')]['key']};});_0x25259e['model']=_['differenceBy'](_[_0x5e1e('0x2c')](_0x42c960,_0x5e1e('0x29')),[_0x5e1e('0x29')]);_0x25259e[_0x5e1e('0x30')]=_[_0x5e1e('0x31')](_0x45a96a['query']);_0x25259e[_0x5e1e('0x32')]=_[_0x5e1e('0x33')](_0x25259e[_0x5e1e('0x34')],_0x25259e[_0x5e1e('0x30')]);_0xc6dd66[_0x5e1e('0x35')]=_[_0x5e1e('0x33')](_0x25259e[_0x5e1e('0x34')],qs[_0x5e1e('0x36')](_0x45a96a['query']['fields']));_0xc6dd66[_0x5e1e('0x35')]=_0xc6dd66['attributes'][_0x5e1e('0x37')]?_0xc6dd66[_0x5e1e('0x35')]:_0x25259e[_0x5e1e('0x34')];if(!_0x45a96a[_0x5e1e('0x30')]['hasOwnProperty'](_0x5e1e('0x38'))){_0xc6dd66['limit']=qs[_0x5e1e('0x1e')](_0x45a96a['query'][_0x5e1e('0x1e')]);_0xc6dd66[_0x5e1e('0x1f')]=qs['offset'](_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x1f')]);}_0xc6dd66[_0x5e1e('0x39')]=qs[_0x5e1e('0x3a')](_0x45a96a['query'][_0x5e1e('0x3a')]);_0xc6dd66[_0x5e1e('0x3b')]=qs[_0x5e1e('0x32')](_[_0x5e1e('0x3c')](_0x45a96a[_0x5e1e('0x30')],_0x25259e[_0x5e1e('0x32')]),_0x42c960);if(_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x3d')]){_0xc6dd66['where']=_[_0x5e1e('0x3e')](_0xc6dd66[_0x5e1e('0x3b')],{'$or':_[_0x5e1e('0x2c')](_0x42c960,function(_0x15554d){if(_0x15554d[_0x5e1e('0x2f')]!==_0x5e1e('0x3f')){var _0x484db3={};_0x484db3[_0x15554d[_0x5e1e('0x29')]]={'$like':'%'+_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x3d')]+'%'};return _0x484db3;}})});}_0xc6dd66=_[_0x5e1e('0x3e')]({},_0xc6dd66,_0x45a96a[_0x5e1e('0x40')]);var _0xfa8b63={'where':_0xc6dd66[_0x5e1e('0x3b')]};return db['CmCustomField'][_0x5e1e('0x41')](_0xfa8b63)['then'](function(_0x33ec30){_0x1ce4c9['count']=_0x33ec30;if(_0x45a96a[_0x5e1e('0x30')][_0x5e1e('0x42')]){_0xc6dd66['include']=[{'all':!![]}];}return db[_0x5e1e('0x2d')][_0x5e1e('0x43')](_0xc6dd66);})[_0x5e1e('0x24')](function(_0x16860d){_0x1ce4c9[_0x5e1e('0x44')]=_0x16860d;return _0x1ce4c9;})[_0x5e1e('0x24')](respondWithFilteredResult(_0x5ee658,_0xc6dd66))[_0x5e1e('0x45')](handleError(_0x5ee658,null));};exports[_0x5e1e('0x46')]=function(_0x10e2c8,_0x107285){var _0x15d453={'raw':!![],'where':{'id':_0x10e2c8[_0x5e1e('0x47')]['id']}},_0x400084={};_0x400084[_0x5e1e('0x34')]=_[_0x5e1e('0x31')](db[_0x5e1e('0x2d')]['rawAttributes']);_0x400084[_0x5e1e('0x30')]=_['keys'](_0x10e2c8[_0x5e1e('0x30')]);_0x400084[_0x5e1e('0x32')]=_[_0x5e1e('0x33')](_0x400084['model'],_0x400084[_0x5e1e('0x30')]);_0x15d453['attributes']=_[_0x5e1e('0x33')](_0x400084[_0x5e1e('0x34')],qs[_0x5e1e('0x36')](_0x10e2c8['query'][_0x5e1e('0x36')]));_0x15d453['attributes']=_0x15d453[_0x5e1e('0x35')]['length']?_0x15d453[_0x5e1e('0x35')]:_0x400084['model'];if(_0x10e2c8['query'][_0x5e1e('0x42')]){_0x15d453[_0x5e1e('0x48')]=[{'all':!![]}];}_0x15d453=_[_0x5e1e('0x3e')]({},_0x15d453,_0x10e2c8[_0x5e1e('0x40')]);return db[_0x5e1e('0x2d')][_0x5e1e('0x49')](_0x15d453)[_0x5e1e('0x24')](handleEntityNotFound(_0x107285,null))['then'](respondWithResult(_0x107285,null))[_0x5e1e('0x45')](handleError(_0x107285,null));};exports['update']=function(_0x478750,_0x250b54){if(_0x478750[_0x5e1e('0x4a')]['id']){delete _0x478750[_0x5e1e('0x4a')]['id'];}return db['CmCustomField'][_0x5e1e('0x49')]({'where':{'id':_0x478750[_0x5e1e('0x47')]['id']}})['then'](handleEntityNotFound(_0x250b54,null))[_0x5e1e('0x24')](saveUpdates(_0x478750[_0x5e1e('0x4a')],null))[_0x5e1e('0x24')](respondWithResult(_0x250b54,null))[_0x5e1e('0x45')](handleError(_0x250b54,null));};exports['destroy']=function(_0x335901,_0x3df82f){return db[_0x5e1e('0x2d')][_0x5e1e('0x49')]({'where':{'id':_0x335901[_0x5e1e('0x47')]['id']}})[_0x5e1e('0x24')](handleEntityNotFound(_0x3df82f,null))[_0x5e1e('0x24')](removeEntity(_0x3df82f,null))[_0x5e1e('0x45')](handleError(_0x3df82f,null));};exports['create']=function(_0x1dff92,_0x4f515e){var _0x3f40ad;return db[_0x5e1e('0x4b')]['transaction'](function(_0x33914b){return db[_0x5e1e('0x2d')][_0x5e1e('0x4c')](_0x1dff92[_0x5e1e('0x4a')],{'transaction':_0x33914b})['then'](function(_0x5b067d){_0x3f40ad=_0x5b067d;var _0x3c6e18={'type':db[_0x5e1e('0x4d')][_0x5e1e('0x4e')],'transaction':_0x33914b};switch(_0x1dff92[_0x5e1e('0x4a')]['type']){case _0x5e1e('0x4f'):_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x4e')];break;case'number':_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x50')];break;case _0x5e1e('0x51'):_0x3c6e18[_0x5e1e('0x2f')]=db[_0x5e1e('0x4d')][_0x5e1e('0x52')];_0x3c6e18[_0x5e1e('0x53')]=![];break;default:}return db[_0x5e1e('0x4b')][_0x5e1e('0x54')][_0x5e1e('0x55')]('cm_contacts',util[_0x5e1e('0x56')](_0x5e1e('0x57'),_0x3f40ad['id']),_0x3c6e18);})['then'](function(){return _0x3f40ad;});})[_0x5e1e('0x24')](respondWithResult(_0x4f515e,0xc9))['catch'](handleError(_0x4f515e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 17a7c83..098e0bc 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 _0xb36c=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','lodash'];(function(_0x53b16b,_0x2a6550){var _0x5d10f3=function(_0x4fe533){while(--_0x4fe533){_0x53b16b['push'](_0x53b16b['shift']());}};_0x5d10f3(++_0x2a6550);}(_0xb36c,0xdb));var _0xcb36=function(_0x1b46c0,_0x2dad7f){_0x1b46c0=_0x1b46c0-0x0;var _0x48aa44=_0xb36c[_0x1b46c0];return _0x48aa44;};'use strict';var _=require(_0xcb36('0x0'));var util=require(_0xcb36('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcb36('0x2'));var BPromise=require(_0xcb36('0x3'));var rp=require(_0xcb36('0x4'));var fs=require('fs');var path=require(_0xcb36('0x5'));var rimraf=require(_0xcb36('0x6'));var config=require(_0xcb36('0x7'));var attributes=require(_0xcb36('0x8'));module[_0xcb36('0x9')]=function(_0x1ab0b3,_0x141cf2){return _0x1ab0b3['define'](_0xcb36('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a5e=['./cmCustomField.attributes','exports','cm_custom_fields','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4ebe54,_0xb8f8d0){var _0x164a0f=function(_0x10e064){while(--_0x10e064){_0x4ebe54['push'](_0x4ebe54['shift']());}};_0x164a0f(++_0xb8f8d0);}(_0x7a5e,0x12f));var _0xe7a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe7a5('0x0'));var util=require(_0xe7a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe7a5('0x2'));var BPromise=require(_0xe7a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7a5('0x4'));var rimraf=require(_0xe7a5('0x5'));var config=require(_0xe7a5('0x6'));var attributes=require(_0xe7a5('0x7'));module[_0xe7a5('0x8')]=function(_0x217294,_0x2d46ca){return _0x217294['define']('CmCustomField',attributes,{'tableName':_0xe7a5('0x9'),'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 b77a5a3..54ee38d 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 _0x418c=['error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x54172c,_0xfad7c6){var _0x38ca99=function(_0x439d44){while(--_0x439d44){_0x54172c['push'](_0x54172c['shift']());}};_0x38ca99(++_0xfad7c6);}(_0x418c,0x15c));var _0xc418=function(_0x4e1dac,_0x5d2313){_0x4e1dac=_0x4e1dac-0x0;var _0x15dcc7=_0x418c[_0x4e1dac];return _0x15dcc7;};'use strict';var _=require(_0xc418('0x0'));var util=require('util');var moment=require(_0xc418('0x1'));var BPromise=require('bluebird');var rs=require(_0xc418('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc418('0x3'))['db'];var utils=require(_0xc418('0x4'));var logger=require(_0xc418('0x5'))(_0xc418('0x6'));var config=require(_0xc418('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34dd87,_0x3ef8cc,_0x26749f){return new BPromise(function(_0x594243,_0x2177c1){return client[_0xc418('0x8')](_0x34dd87,_0x26749f)['then'](function(_0x135088){logger[_0xc418('0x9')]('CmCustomField,\x20%s,\x20%s',_0x3ef8cc,_0xc418('0xa'));logger[_0xc418('0xb')](_0xc418('0xc'),_0x3ef8cc,_0xc418('0xa'),JSON['stringify'](_0x135088));if(_0x135088[_0xc418('0xd')]){if(_0x135088[_0xc418('0xd')][_0xc418('0xe')]===0x1f4){logger['error'](_0xc418('0xf'),_0x3ef8cc,_0x135088[_0xc418('0xd')][_0xc418('0x10')]);return _0x2177c1(_0x135088[_0xc418('0xd')][_0xc418('0x10')]);}logger[_0xc418('0xd')]('CmCustomField,\x20%s,\x20%s',_0x3ef8cc,_0x135088[_0xc418('0xd')][_0xc418('0x10')]);return _0x594243(_0x135088['error'][_0xc418('0x10')]);}else{logger['info'](_0xc418('0xf'),_0x3ef8cc,_0xc418('0xa'));_0x594243(_0x135088[_0xc418('0x11')][_0xc418('0x10')]);}})[_0xc418('0x12')](function(_0x1b49c1){logger['error']('CmCustomField,\x20%s,\x20%s',_0x3ef8cc,_0x1b49c1);_0x2177c1(_0x1b49c1);});});} \ No newline at end of file +var _0xa66f=['request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0xa66f,0xde));var _0xfa66=function(_0x5eab85,_0xb5fed3){_0x5eab85=_0x5eab85-0x0;var _0x3f9bdd=_0xa66f[_0x5eab85];return _0x3f9bdd;};'use strict';var _=require('lodash');var util=require(_0xfa66('0x0'));var moment=require(_0xfa66('0x1'));var BPromise=require('bluebird');var rs=require(_0xfa66('0x2'));var fs=require('fs');var Redis=require(_0xfa66('0x3'));var db=require(_0xfa66('0x4'))['db'];var utils=require(_0xfa66('0x5'));var logger=require('../../config/logger')(_0xfa66('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa66('0x7'));var client=jayson['client'][_0xfa66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ba9b3,_0x4ae66a,_0x53a514){return new BPromise(function(_0x339a52,_0x558ae7){return client[_0xfa66('0x9')](_0x3ba9b3,_0x53a514)[_0xfa66('0xa')](function(_0x280126){logger[_0xfa66('0xb')](_0xfa66('0xc'),_0x4ae66a,_0xfa66('0xd'));logger[_0xfa66('0xe')](_0xfa66('0xf'),_0x4ae66a,_0xfa66('0xd'),JSON[_0xfa66('0x10')](_0x280126));if(_0x280126['error']){if(_0x280126[_0xfa66('0x11')][_0xfa66('0x12')]===0x1f4){logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x280126['error'][_0xfa66('0x13')]);return _0x558ae7(_0x280126['error'][_0xfa66('0x13')]);}logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x280126[_0xfa66('0x11')][_0xfa66('0x13')]);return _0x339a52(_0x280126[_0xfa66('0x11')][_0xfa66('0x13')]);}else{logger[_0xfa66('0xb')]('CmCustomField,\x20%s,\x20%s',_0x4ae66a,_0xfa66('0xd'));_0x339a52(_0x280126[_0xfa66('0x14')][_0xfa66('0x13')]);}})['catch'](function(_0x406c50){logger[_0xfa66('0x11')](_0xfa66('0xc'),_0x4ae66a,_0x406c50);_0x558ae7(_0x406c50);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 515a223..eea2896 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 _0xf3cc=['Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5e7767,_0x327e8f){var _0x5994bc=function(_0x5b1955){while(--_0x5b1955){_0x5e7767['push'](_0x5e7767['shift']());}};_0x5994bc(++_0x327e8f);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x374ccf,_0xa945c4){_0x374ccf=_0x374ccf-0x0;var _0x443cde=_0xf3cc[_0x374ccf];return _0x443cde;};'use strict';var multer=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var path=require(_0xcf3c('0x2'));var timeout=require(_0xcf3c('0x3'));var express=require('express');var router=express[_0xcf3c('0x4')]();var fs_extra=require(_0xcf3c('0x5'));var auth=require(_0xcf3c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf3c('0x7'));var controller=require(_0xcf3c('0x8'));router['get']('/',auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xa')]);router[_0xcf3c('0xb')](_0xcf3c('0xc'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xd')]);router[_0xcf3c('0xe')]('/',auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xf')]);router[_0xcf3c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcf3c('0x11')]);router[_0xcf3c('0x12')](_0xcf3c('0xc'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0x13')]);module[_0xcf3c('0x14')]=router; \ No newline at end of file +var _0x4fd7=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x422ecc,_0x29a565){var _0x113f85=function(_0x4ecdfa){while(--_0x4ecdfa){_0x422ecc['push'](_0x422ecc['shift']());}};_0x113f85(++_0x29a565);}(_0x4fd7,0xe6));var _0x74fd=function(_0x821cf9,_0x33028c){_0x821cf9=_0x821cf9-0x0;var _0x1eff7c=_0x4fd7[_0x821cf9];return _0x1eff7c;};'use strict';var multer=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var path=require(_0x74fd('0x2'));var timeout=require(_0x74fd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x74fd('0x4'));var auth=require(_0x74fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x74fd('0x6'));var controller=require('./cmCustomField.controller');router[_0x74fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x74fd('0x8')]);router[_0x74fd('0x7')]('/:id',auth[_0x74fd('0x9')](),controller[_0x74fd('0xa')]);router['post']('/',auth[_0x74fd('0x9')](),controller[_0x74fd('0xb')]);router[_0x74fd('0xc')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0xe')]);router[_0x74fd('0xf')](_0x74fd('0xd'),auth[_0x74fd('0x9')](),controller[_0x74fd('0x10')]);module[_0x74fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f6b2726..5d4ff0b 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 _0x4137=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x31e0d7,_0xe6ced){var _0x11d56e=function(_0x12955e){while(--_0x12955e){_0x31e0d7['push'](_0x31e0d7['shift']());}};_0x11d56e(++_0xe6ced);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var moment=require(_0x7413('0x0'));var Sequelize=require(_0x7413('0x1'));module[_0x7413('0x2')]={'phone':{'type':Sequelize[_0x7413('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7413('0x5')],'defaultValue':moment()[_0x7413('0x6')](_0x7413('0x7'))},'countbusyretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7413('0x5')]},'priority':{'type':Sequelize[_0x7413('0x8')](0x2)[_0x7413('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7413('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x7413('0xa')},'ListId':{'type':Sequelize[_0x7413('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x7413('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x7413('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x7413('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7413('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x7413('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x7413('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9536=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x40ff3b,_0x238af7){var _0x3ccf4f=function(_0x397ae0){while(--_0x397ae0){_0x40ff3b['push'](_0x40ff3b['shift']());}};_0x3ccf4f(++_0x238af7);}(_0x9536,0x179));var _0x6953=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x9536[_0x5a7d41];return _0x98d8fa;};'use strict';var moment=require(_0x6953('0x0'));var Sequelize=require(_0x6953('0x1'));module[_0x6953('0x2')]={'phone':{'type':Sequelize[_0x6953('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6953('0x4')],'defaultValue':moment()['format'](_0x6953('0x5'))},'countbusyretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6953('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6953('0x4')]},'priority':{'type':Sequelize[_0x6953('0x6')](0x2)[_0x6953('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6953('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6953('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6953('0x6')],'unique':_0x6953('0x9')},'UserId':{'type':Sequelize[_0x6953('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6953('0x9')},'CampaignId':{'type':Sequelize[_0x6953('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6953('0x6')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6953('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6953('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 80d73e2..918dbd3 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 _0xaa2a=['$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','rawAttributes','include','find','create','body','update','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','campaign','user','UserId','deletedat','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','ASC','scheduledAt','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','hopperIds','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','CmCompany','List','Queue','dialActive','getPreviewRecall','transaction','hopperId','LOCK','Company','CmList','YYYY-MM-DD\x20HH:mm:ss','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','reject','then','end','error','stack','name','map','CmHopper','type','key','model','query','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike'];(function(_0x481143,_0x3ff7cb){var _0x3f69fb=function(_0x14390d){while(--_0x14390d){_0x481143['push'](_0x481143['shift']());}};_0x3f69fb(++_0x3ff7cb);}(_0xaa2a,0x1a4));var _0xaaa2=function(_0x7a0496,_0x3b4dbc){_0x7a0496=_0x7a0496-0x0;var _0x4d5a25=_0xaa2a[_0x7a0496];return _0x4d5a25;};'use strict';var emlformat=require(_0xaaa2('0x0'));var rimraf=require(_0xaaa2('0x1'));var zipdir=require(_0xaaa2('0x2'));var jsonpatch=require(_0xaaa2('0x3'));var rp=require('request-promise');var moment=require(_0xaaa2('0x4'));var BPromise=require(_0xaaa2('0x5'));var Mustache=require(_0xaaa2('0x6'));var util=require(_0xaaa2('0x7'));var path=require(_0xaaa2('0x8'));var sox=require('sox');var csv=require(_0xaaa2('0x9'));var ejs=require(_0xaaa2('0xa'));var fs=require('fs');var fs_extra=require(_0xaaa2('0xb'));var _=require(_0xaaa2('0xc'));var squel=require(_0xaaa2('0xd'));var crypto=require('crypto');var jsforce=require(_0xaaa2('0xe'));var deskjs=require(_0xaaa2('0xf'));var toCsv=require(_0xaaa2('0x9'));var querystring=require(_0xaaa2('0x10'));var Papa=require(_0xaaa2('0x11'));var Redis=require('ioredis');var authService=require(_0xaaa2('0x12'));var qs=require(_0xaaa2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaa2('0x14'));var logger=require(_0xaaa2('0x15'))(_0xaaa2('0x16'));var utils=require('../../config/utils');var config=require(_0xaaa2('0x17'));var shared=require(_0xaaa2('0x17'));var licenseUtil=require(_0xaaa2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7eff,_0x200a34){_0x200a34=_0x200a34||0xcc;return function(_0x23d15d){if(_0x23d15d){return _0x2c7eff[_0xaaa2('0x19')](_0x200a34);}return _0x2c7eff[_0xaaa2('0x1a')](_0x200a34)['end']();};}function respondWithResult(_0xc84eaf,_0x49f944){_0x49f944=_0x49f944||0xc8;return function(_0x1732bf){if(_0x1732bf){return _0xc84eaf['status'](_0x49f944)[_0xaaa2('0x1b')](_0x1732bf);}};}function respondWithFilteredResult(_0x434f26,_0x3f2d54){return function(_0x45f4ef){if(_0x45f4ef){var _0x1cde1a=typeof _0x3f2d54[_0xaaa2('0x1c')]===_0xaaa2('0x1d')&&typeof _0x3f2d54[_0xaaa2('0x1e')]===_0xaaa2('0x1d');var _0x3fbd97=_0x45f4ef['count'];var _0xdbd1dd=_0x1cde1a?0x0:_0x3f2d54[_0xaaa2('0x1c')];var _0x50aff2=_0x1cde1a?_0x45f4ef[_0xaaa2('0x1f')]:_0x3f2d54[_0xaaa2('0x1c')]+_0x3f2d54['limit'];var _0x130bba;if(_0x50aff2>=_0x3fbd97){_0x50aff2=_0x3fbd97;_0x130bba=0xc8;}else{_0x130bba=0xce;}_0x434f26[_0xaaa2('0x1a')](_0x130bba);return _0x434f26[_0xaaa2('0x20')]('Content-Range',_0xdbd1dd+'-'+_0x50aff2+'/'+_0x3fbd97)[_0xaaa2('0x1b')](_0x45f4ef);}return null;};}function patchUpdates(_0x127ea4){return function(_0x4123d4){try{jsonpatch['apply'](_0x4123d4,_0x127ea4,!![]);}catch(_0x5ab98e){return BPromise[_0xaaa2('0x21')](_0x5ab98e);}return _0x4123d4['save']();};}function saveUpdates(_0x23eadb,_0x3fddcd){return function(_0x1e9859){if(_0x1e9859){return _0x1e9859['update'](_0x23eadb)[_0xaaa2('0x22')](function(_0x23f65f){return _0x23f65f;});}return null;};}function removeEntity(_0x5f325e,_0x5c4216){return function(_0xa32e32){if(_0xa32e32){return _0xa32e32['destroy']()['then'](function(){_0x5f325e[_0xaaa2('0x1a')](0xcc)[_0xaaa2('0x23')]();});}};}function handleEntityNotFound(_0x38fc11,_0x24ef79){return function(_0x2f6a5a){if(!_0x2f6a5a){_0x38fc11[_0xaaa2('0x19')](0x194);}return _0x2f6a5a;};}function handleError(_0x4a7538,_0x3980a0){_0x3980a0=_0x3980a0||0x1f4;return function(_0x3687d5){logger[_0xaaa2('0x24')](_0x3687d5[_0xaaa2('0x25')]);if(_0x3687d5[_0xaaa2('0x26')]){delete _0x3687d5['name'];}_0x4a7538['status'](_0x3980a0)['send'](_0x3687d5);};}exports['index']=function(_0x50e628,_0x51664c){var _0x270bf3={},_0x2bac20={},_0x3214ca={'count':0x0,'rows':[]};var _0x4439cc=_[_0xaaa2('0x27')](db[_0xaaa2('0x28')]['rawAttributes'],function(_0x531929){return{'name':_0x531929['fieldName'],'type':_0x531929[_0xaaa2('0x29')][_0xaaa2('0x2a')]};});_0x2bac20[_0xaaa2('0x2b')]=_['map'](_0x4439cc,_0xaaa2('0x26'));_0x2bac20['query']=_['keys'](_0x50e628[_0xaaa2('0x2c')]);_0x2bac20['filters']=_[_0xaaa2('0x2d')](_0x2bac20[_0xaaa2('0x2b')],_0x2bac20[_0xaaa2('0x2c')]);_0x2bac20[_0xaaa2('0x2e')]=_[_0xaaa2('0x2f')](_0x2bac20['filters'],[_0xaaa2('0x30'),_0xaaa2('0x31'),_0xaaa2('0x32'),_0xaaa2('0x33'),_0xaaa2('0x34'),_0xaaa2('0x35'),_0xaaa2('0x36'),_0xaaa2('0x37'),_0xaaa2('0x38'),_0xaaa2('0x39'),'$notBetween',_0xaaa2('0x3a'),_0xaaa2('0x3b'),_0xaaa2('0x3c'),_0xaaa2('0x3d'),_0xaaa2('0x3e'),_0xaaa2('0x3f'),_0xaaa2('0x3c'),_0xaaa2('0x40'),_0xaaa2('0x41'),_0xaaa2('0x42'),_0xaaa2('0x43')]);_0x270bf3[_0xaaa2('0x44')]=_['intersection'](_0x2bac20[_0xaaa2('0x2b')],qs[_0xaaa2('0x45')](_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x45')]));_0x270bf3[_0xaaa2('0x44')]=_0x270bf3['attributes'][_0xaaa2('0x46')]?_0x270bf3['attributes']:_0x2bac20[_0xaaa2('0x2b')];if(!_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x47')](_0xaaa2('0x48'))){_0x270bf3['limit']=qs[_0xaaa2('0x1e')](_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x1e')]);_0x270bf3[_0xaaa2('0x1c')]=qs[_0xaaa2('0x1c')](_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x1c')]);}_0x270bf3[_0xaaa2('0x49')]=qs['sort'](_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x4a')]);_0x270bf3[_0xaaa2('0x4b')]=qs[_0xaaa2('0x2e')](_['pick'](_0x50e628[_0xaaa2('0x2c')],_0x2bac20[_0xaaa2('0x2e')]),_0x4439cc);if(_0x50e628['query'][_0xaaa2('0x4c')]){_0x270bf3[_0xaaa2('0x4b')]=_[_0xaaa2('0x4d')](_0x270bf3[_0xaaa2('0x4b')],{'$or':_[_0xaaa2('0x27')](_0x4439cc,function(_0x1ea3d5){if(_0x1ea3d5[_0xaaa2('0x29')]!==_0xaaa2('0x4e')){var _0x28b0ff={};_0x28b0ff[_0x1ea3d5[_0xaaa2('0x26')]]={'$like':'%'+_0x50e628[_0xaaa2('0x2c')]['filter']+'%'};return _0x28b0ff;}})});}_0x270bf3=_['merge']({},_0x270bf3,_0x50e628[_0xaaa2('0x4f')]);var _0x8d433a={'where':_0x270bf3[_0xaaa2('0x4b')]};return db[_0xaaa2('0x28')][_0xaaa2('0x1f')](_0x8d433a)[_0xaaa2('0x22')](function(_0x1dbf2d){_0x3214ca[_0xaaa2('0x1f')]=_0x1dbf2d;if(_0x50e628[_0xaaa2('0x2c')][_0xaaa2('0x50')]){_0x270bf3['include']=[{'all':!![]}];}return db[_0xaaa2('0x28')][_0xaaa2('0x51')](_0x270bf3);})['then'](function(_0x5ca9da){_0x3214ca[_0xaaa2('0x52')]=_0x5ca9da;return _0x3214ca;})[_0xaaa2('0x22')](respondWithFilteredResult(_0x51664c,_0x270bf3))[_0xaaa2('0x53')](handleError(_0x51664c,null));};exports['show']=function(_0xd452bc,_0x4f619a){var _0x479ec0={'raw':!![],'where':{'id':_0xd452bc['params']['id']}},_0x497e70={};_0x497e70[_0xaaa2('0x2b')]=_[_0xaaa2('0x54')](db[_0xaaa2('0x28')][_0xaaa2('0x55')]);_0x497e70['query']=_[_0xaaa2('0x54')](_0xd452bc[_0xaaa2('0x2c')]);_0x497e70['filters']=_[_0xaaa2('0x2d')](_0x497e70[_0xaaa2('0x2b')],_0x497e70[_0xaaa2('0x2c')]);_0x479ec0[_0xaaa2('0x44')]=_[_0xaaa2('0x2d')](_0x497e70['model'],qs[_0xaaa2('0x45')](_0xd452bc['query']['fields']));_0x479ec0['attributes']=_0x479ec0[_0xaaa2('0x44')][_0xaaa2('0x46')]?_0x479ec0['attributes']:_0x497e70['model'];if(_0xd452bc[_0xaaa2('0x2c')][_0xaaa2('0x50')]){_0x479ec0[_0xaaa2('0x56')]=[{'all':!![]}];}_0x479ec0=_['merge']({},_0x479ec0,_0xd452bc[_0xaaa2('0x4f')]);return db[_0xaaa2('0x28')][_0xaaa2('0x57')](_0x479ec0)['then'](handleEntityNotFound(_0x4f619a,null))['then'](respondWithResult(_0x4f619a,null))[_0xaaa2('0x53')](handleError(_0x4f619a,null));};exports['create']=function(_0x4d7485,_0x31daeb){return db[_0xaaa2('0x28')][_0xaaa2('0x58')](_0x4d7485[_0xaaa2('0x59')],{})[_0xaaa2('0x22')](respondWithResult(_0x31daeb,0xc9))[_0xaaa2('0x53')](handleError(_0x31daeb,null));};exports[_0xaaa2('0x5a')]=function(_0x26fc0f,_0x4ea3ad){if(_0x26fc0f['body']['id']){delete _0x26fc0f['body']['id'];}return db[_0xaaa2('0x28')][_0xaaa2('0x57')]({'where':{'id':_0x26fc0f[_0xaaa2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ea3ad,null))[_0xaaa2('0x22')](saveUpdates(_0x26fc0f['body'],null))[_0xaaa2('0x22')](respondWithResult(_0x4ea3ad,null))['catch'](handleError(_0x4ea3ad,null));};exports[_0xaaa2('0x5c')]=function(_0x298252,_0x44c366){return db['CmHopper'][_0xaaa2('0x5c')]()[_0xaaa2('0x22')](respondWithResult(_0x44c366,null))['catch'](handleError(_0x44c366,null));};exports[_0xaaa2('0x5d')]=function(_0x1c5781,_0x210961){var _0x5de605;return db[_0xaaa2('0x28')][_0xaaa2('0x57')]({'where':{'id':_0x1c5781['params']['id']}})[_0xaaa2('0x22')](handleEntityNotFound(_0x210961,null))[_0xaaa2('0x22')](function(_0xf6e14f){if(_0xf6e14f){return _0xf6e14f[_0xaaa2('0x5d')]()[_0xaaa2('0x22')](function(_0x5f1899){return _0x5f1899;});}})[_0xaaa2('0x22')](function(_0x3a50dc){_0x5de605=_0x3a50dc;if(_0x3a50dc){if(_0x3a50dc[_0xaaa2('0x5e')]||_0x3a50dc[_0xaaa2('0x5f')]){return db[_0x3a50dc[_0xaaa2('0x5e')]?_0xaaa2('0x60'):_0xaaa2('0x61')][_0xaaa2('0x57')]({'where':{'id':_0x3a50dc[_0xaaa2('0x5e')]?_0x3a50dc[_0xaaa2('0x5e')]:_0x3a50dc[_0xaaa2('0x5f')]},'attributes':['id',_0xaaa2('0x26')],'raw':!![]});}}})[_0xaaa2('0x22')](function(_0x17caec){var _0x38c8e1={};if(_0x17caec){_[_0xaaa2('0x4d')](_0x38c8e1,_[_0xaaa2('0x62')](_0x5de605[_0xaaa2('0x63')],[_0xaaa2('0x64'),'updatedAt','id']));_0x38c8e1[_0xaaa2('0x65')]=0x15;_0x38c8e1[_0xaaa2('0x66')]='deleted';_0x38c8e1[_0xaaa2('0x67')]=_0x17caec['name'];_0x38c8e1['membername']=_0x1c5781[_0xaaa2('0x68')]['name'];_0x38c8e1[_0xaaa2('0x69')]=_0x1c5781[_0xaaa2('0x68')]['id'];_0x38c8e1['deleted']=!![];_0x38c8e1[_0xaaa2('0x6a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x38c8e1['calleridnum']=_0x5de605[_0xaaa2('0x6b')];_0x38c8e1[_0xaaa2('0x6c')]=_0x5de605[_0xaaa2('0x5e')]?_0xaaa2('0x6d'):_0xaaa2('0x6e');return db[_0xaaa2('0x6f')][_0xaaa2('0x57')]({'where':{'id':_0x38c8e1[_0xaaa2('0x70')]},'attributes':['firstName',_0xaaa2('0x71')]})[_0xaaa2('0x22')](function(_0xacf44d){if(!_[_0xaaa2('0x72')](_0x210961)&&!_[_0xaaa2('0x72')](_0xacf44d[_0xaaa2('0x73')])){_0x38c8e1[_0xaaa2('0x74')]=_0xacf44d[_0xaaa2('0x73')];if(!_[_0xaaa2('0x72')](_0xacf44d[_0xaaa2('0x71')])){_0x38c8e1[_0xaaa2('0x74')]+='\x20'+_0xacf44d[_0xaaa2('0x71')];}}})[_0xaaa2('0x75')](function(){return db[_0xaaa2('0x76')]['create'](_0x38c8e1);});}})[_0xaaa2('0x22')](function(){return _0x210961['status'](0xcc)[_0xaaa2('0x23')]();})[_0xaaa2('0x53')](handleError(_0x210961,null));};exports[_0xaaa2('0x77')]=function(_0xff74ed,_0x115910,_0x3d0aa1){var _0x2becc1=[];return db[_0xaaa2('0x6f')][_0xaaa2('0x5c')]()['then'](function(_0x2fd31f){_0x2becc1=_[_0xaaa2('0x54')](_0x2fd31f);return _0xff74ed[_0xaaa2('0x68')][_0xaaa2('0x78')]({'where':{'type':_0xaaa2('0x79'),'dialActive':!![],'dialMethod':_0xaaa2('0x7a')},'attributes':['id','dialOrderByScheduledAt',_0xaaa2('0x7b')],'raw':!![]});})[_0xaaa2('0x22')](function(_0x339d71){if(_0x339d71&&_0x339d71[_0xaaa2('0x46')]){return db[_0xaaa2('0x7c')]['transaction'](function(_0x19e7fc){var _0x3ac89a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xaaa2('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xaaa2('0x27')](_0x339d71,'id')},'$or':[{'UserId':null},{'UserId':_0xff74ed[_0xaaa2('0x68')]['id']}]};var _0x31a94a={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x339d71)[_0xaaa2('0x4c')]([_0xaaa2('0x7b'),0x0])[_0xaaa2('0x27')]('id')[_0xaaa2('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0xff74ed[_0xaaa2('0x68')]['id']}]};var _0x3f51a8={'$or':[_0x3ac89a,_0x31a94a]};var _0x16dee7=[];if(_0xff74ed[_0xaaa2('0x59')][_0xaaa2('0x7f')]&&_0xff74ed['body'][_0xaaa2('0x7f')]===_0xaaa2('0x80')){if(!_[_0xaaa2('0x81')](_0xff74ed[_0xaaa2('0x59')]['hopperIds'])){_0x3f51a8['id']={'$in':_0xff74ed[_0xaaa2('0x59')]['hopperIds']};}_0x16dee7=[['priority',_0xaaa2('0x82')],[_0xaaa2('0x83'),_0x339d71[0x0][_0xaaa2('0x84')]===_0xaaa2('0x82')?_0xaaa2('0x85'):_0xaaa2('0x82')],db[_0xaaa2('0x7c')]['literal'](_0xaaa2('0x86')),['id',_0xaaa2('0x85')]];}else{if(!_[_0xaaa2('0x81')](_0xff74ed[_0xaaa2('0x59')]['hopperIds'])){_0x3f51a8['id']={'$notIn':_0xff74ed['body'][_0xaaa2('0x87')]};}_0x16dee7=[[_0xaaa2('0x88'),_0xaaa2('0x85')],['scheduledAt',_0x339d71[0x0][_0xaaa2('0x84')]],db['sequelize'][_0xaaa2('0x89')](_0xaaa2('0x8a')),['id','ASC']];}return db['CmHopper'][_0xaaa2('0x8b')]({'attributes':['id',_0xaaa2('0x8c'),_0xaaa2('0x8d')],'where':_0x3f51a8,'order':_0x16dee7,'transaction':_0x19e7fc,'lock':_0x19e7fc['LOCK'][_0xaaa2('0x8e')],'include':[{'model':db[_0xaaa2('0x6f')],'as':'Contact','attributes':_0x2becc1,'include':[{'model':db[_0xaaa2('0x8f')],'as':'Company','attributes':['id',_0xaaa2('0x26')]}]},{'model':db['CmList'],'as':_0xaaa2('0x90'),'attributes':['id',_0xaaa2('0x26')]},{'model':db[_0xaaa2('0x60')],'as':_0xaaa2('0x91'),'attributes':['id','name',_0xaaa2('0x92')]}]})['then'](function(_0x16eb57){if(_0x16eb57){return _0x16eb57[_0xaaa2('0x5a')]({'UserId':_0xff74ed[_0xaaa2('0x68')]['id']},{'transaction':_0x19e7fc});}});});}})[_0xaaa2('0x22')](handleEntityNotFound(_0x115910,null))[_0xaaa2('0x22')](respondWithResult(_0x115910,null))[_0xaaa2('0x53')](handleError(_0x115910,null));};exports[_0xaaa2('0x93')]=function(_0x560423,_0x3c7e0e,_0x46627c){var _0x5c241a=[];return db[_0xaaa2('0x6f')][_0xaaa2('0x5c')]()[_0xaaa2('0x22')](function(_0x40a9e0){_0x5c241a=_[_0xaaa2('0x54')](_0x40a9e0);return _0x560423[_0xaaa2('0x68')][_0xaaa2('0x78')]({'where':{'type':_0xaaa2('0x79'),'dialActive':!![],'dialMethod':_0xaaa2('0x7a')},'attributes':['id',_0xaaa2('0x84'),_0xaaa2('0x7b')],'raw':!![]});})[_0xaaa2('0x22')](function(_0x2214aa){if(_0x2214aa&&_0x2214aa[_0xaaa2('0x46')]){return db['sequelize'][_0xaaa2('0x94')](function(_0x198c74){var _0x56dd38={'active':![],'recallme':!![],'id':_0x560423[_0xaaa2('0x59')][_0xaaa2('0x95')]};return db[_0xaaa2('0x28')]['findOne']({'attributes':['id',_0xaaa2('0x8c'),'recallme'],'where':_0x56dd38,'transaction':_0x198c74,'lock':_0x198c74[_0xaaa2('0x96')][_0xaaa2('0x8e')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5c241a,'include':[{'model':db[_0xaaa2('0x8f')],'as':_0xaaa2('0x97'),'attributes':['id','name']}]},{'model':db[_0xaaa2('0x98')],'as':_0xaaa2('0x90'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xaaa2('0x91'),'attributes':['id',_0xaaa2('0x26'),_0xaaa2('0x92')]}]})['then'](function(_0x4c541b){if(_0x4c541b){return _0x4c541b['update']({'UserId':_0x560423[_0xaaa2('0x68')]['id']},{'transaction':_0x198c74});}});});}})['then'](handleEntityNotFound(_0x3c7e0e,null))[_0xaaa2('0x22')](respondWithResult(_0x3c7e0e,null))['catch'](handleError(_0x3c7e0e,null));};exports['getOpenContacts']=function(_0x5bf967,_0x1046ae,_0x327d1e){return _0x5bf967[_0xaaa2('0x68')][_0xaaa2('0x78')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xaaa2('0x7a')},'attributes':['id'],'raw':!![]})[_0xaaa2('0x22')](function(_0x23340d){if(_0x23340d&&_0x23340d[_0xaaa2('0x46')]){return db[_0xaaa2('0x28')][_0xaaa2('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xaaa2('0x99'))},'VoiceQueueId':{'$in':_[_0xaaa2('0x27')](_0x23340d,'id')},'$or':[{'UserId':null},{'UserId':_0x5bf967[_0xaaa2('0x68')]['id']}]}});}return 0x0;})[_0xaaa2('0x22')](function(_0x3432fa){if(!_[_0xaaa2('0x72')](_0x3432fa)&&_[_0xaaa2('0x9a')](_0x3432fa)){return _0x1046ae['status'](0xc8)[_0xaaa2('0x1b')]({'contacts':_0x3432fa});}else{logger[_0xaaa2('0x24')](_0xaaa2('0x9b'),'getOpenContacts',0x194,_0xaaa2('0x9c'));_0x1046ae['sendStatus'](0x194);}})[_0xaaa2('0x53')](handleError(_0x1046ae,null));};exports[_0xaaa2('0x9d')]=function(_0x5c2553,_0x4f6135,_0x265382){var _0x4e6d96=shared[_0xaaa2('0x9e')];var _0x1ce47a=[];_[_0xaaa2('0x27')](_0x4e6d96,function(_0x153f54){_0x1ce47a[_0xaaa2('0x9f')]({'id':_0x153f54[_0xaaa2('0x26')],'name':_0x153f54['name'],'utcOffset':_0x153f54[_0xaaa2('0xa0')]});});return _0x4f6135[_0xaaa2('0x1a')](0xc8)[_0xaaa2('0x1b')]({'tz':_0x1ce47a});};exports['getTimezone']=function(_0x72fcd8,_0x1f0bc3,_0x4f7cac){var _0x542fb5=shared[_0xaaa2('0x9e')];var _0x3adaec={};if(!_[_0xaaa2('0x72')](_0x542fb5[_0x72fcd8[_0xaaa2('0x59')]['id']]))_0x3adaec=_0x542fb5[_0x72fcd8['body']['id']];return _0x1f0bc3[_0xaaa2('0x1a')](0xc8)['json'](_0x3adaec);}; \ No newline at end of file +var _0x8b19=['$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notILike','$overlap','$contains','$contained','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','filter','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','priority','recallme','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','hopperId','findOne','CmCompany','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','model','query','filters','concat','$and','$or','$gt','$lt'];(function(_0x34f273,_0x37a8c3){var _0x1f2544=function(_0x1b9a6b){while(--_0x1b9a6b){_0x34f273['push'](_0x34f273['shift']());}};_0x1f2544(++_0x37a8c3);}(_0x8b19,0x1a1));var _0x98b1=function(_0xba6066,_0x318f7b){_0xba6066=_0xba6066-0x0;var _0x546a76=_0x8b19[_0xba6066];return _0x546a76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98b1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98b1('0x1'));var moment=require('moment');var BPromise=require(_0x98b1('0x2'));var Mustache=require(_0x98b1('0x3'));var util=require('util');var path=require(_0x98b1('0x4'));var sox=require(_0x98b1('0x5'));var csv=require(_0x98b1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98b1('0x7'));var _=require(_0x98b1('0x8'));var squel=require('squel');var crypto=require(_0x98b1('0x9'));var jsforce=require(_0x98b1('0xa'));var deskjs=require(_0x98b1('0xb'));var toCsv=require(_0x98b1('0x6'));var querystring=require(_0x98b1('0xc'));var Papa=require(_0x98b1('0xd'));var Redis=require(_0x98b1('0xe'));var authService=require(_0x98b1('0xf'));var qs=require(_0x98b1('0x10'));var as=require(_0x98b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x98b1('0x12'))(_0x98b1('0x13'));var utils=require(_0x98b1('0x14'));var config=require('../../config/environment');var shared=require(_0x98b1('0x15'));var licenseUtil=require(_0x98b1('0x16'));var db=require(_0x98b1('0x17'))['db'];function respondWithStatusCode(_0x569b5e,_0x4b21bd){_0x4b21bd=_0x4b21bd||0xcc;return function(_0x57f460){if(_0x57f460){return _0x569b5e[_0x98b1('0x18')](_0x4b21bd);}return _0x569b5e[_0x98b1('0x19')](_0x4b21bd)[_0x98b1('0x1a')]();};}function respondWithResult(_0x2ad173,_0x3298d9){_0x3298d9=_0x3298d9||0xc8;return function(_0x232677){if(_0x232677){return _0x2ad173['status'](_0x3298d9)[_0x98b1('0x1b')](_0x232677);}};}function respondWithFilteredResult(_0x19ce84,_0x1b2788){return function(_0x57fb61){if(_0x57fb61){var _0x25eb60=typeof _0x1b2788['offset']===_0x98b1('0x1c')&&typeof _0x1b2788['limit']===_0x98b1('0x1c');var _0x3d78e9=_0x57fb61[_0x98b1('0x1d')];var _0x53b804=_0x25eb60?0x0:_0x1b2788['offset'];var _0x329279=_0x25eb60?_0x57fb61[_0x98b1('0x1d')]:_0x1b2788[_0x98b1('0x1e')]+_0x1b2788[_0x98b1('0x1f')];var _0x1d924f;if(_0x329279>=_0x3d78e9){_0x329279=_0x3d78e9;_0x1d924f=0xc8;}else{_0x1d924f=0xce;}_0x19ce84[_0x98b1('0x19')](_0x1d924f);return _0x19ce84['set'](_0x98b1('0x20'),_0x53b804+'-'+_0x329279+'/'+_0x3d78e9)['json'](_0x57fb61);}return null;};}function patchUpdates(_0x335fc5){return function(_0x30a7d5){try{jsonpatch[_0x98b1('0x21')](_0x30a7d5,_0x335fc5,!![]);}catch(_0x5517ad){return BPromise[_0x98b1('0x22')](_0x5517ad);}return _0x30a7d5[_0x98b1('0x23')]();};}function saveUpdates(_0xa4c391,_0x44d818){return function(_0x12e457){if(_0x12e457){return _0x12e457[_0x98b1('0x24')](_0xa4c391)[_0x98b1('0x25')](function(_0x257174){return _0x257174;});}return null;};}function removeEntity(_0x57cf59,_0x2f70e9){return function(_0x1c8c61){if(_0x1c8c61){return _0x1c8c61[_0x98b1('0x26')]()[_0x98b1('0x25')](function(){_0x57cf59[_0x98b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dbcb7,_0x4e9225){return function(_0x11110f){if(!_0x11110f){_0x2dbcb7[_0x98b1('0x18')](0x194);}return _0x11110f;};}function handleError(_0xdec995,_0x55282f){_0x55282f=_0x55282f||0x1f4;return function(_0x489dc2){logger[_0x98b1('0x27')](_0x489dc2[_0x98b1('0x28')]);if(_0x489dc2['name']){delete _0x489dc2[_0x98b1('0x29')];}_0xdec995[_0x98b1('0x19')](_0x55282f)[_0x98b1('0x2a')](_0x489dc2);};}exports[_0x98b1('0x2b')]=function(_0x2e37eb,_0x1b4183){var _0x2ca8aa={},_0x27ec56={},_0x2b45ff={'count':0x0,'rows':[]};var _0x3b54da=_[_0x98b1('0x2c')](db[_0x98b1('0x2d')][_0x98b1('0x2e')],function(_0x35b674){return{'name':_0x35b674['fieldName'],'type':_0x35b674[_0x98b1('0x2f')][_0x98b1('0x30')]};});_0x27ec56[_0x98b1('0x31')]=_['map'](_0x3b54da,_0x98b1('0x29'));_0x27ec56['query']=_['keys'](_0x2e37eb[_0x98b1('0x32')]);_0x27ec56[_0x98b1('0x33')]=_['intersection'](_0x27ec56[_0x98b1('0x31')],_0x27ec56[_0x98b1('0x32')]);_0x27ec56[_0x98b1('0x33')]=_[_0x98b1('0x34')](_0x27ec56[_0x98b1('0x33')],[_0x98b1('0x35'),_0x98b1('0x36'),_0x98b1('0x37'),'$gte',_0x98b1('0x38'),_0x98b1('0x39'),_0x98b1('0x3a'),_0x98b1('0x3b'),_0x98b1('0x3c'),_0x98b1('0x3d'),_0x98b1('0x3e'),'$in',_0x98b1('0x3f'),_0x98b1('0x40'),'$notLike','$iLike',_0x98b1('0x41'),_0x98b1('0x40'),_0x98b1('0x42'),_0x98b1('0x43'),_0x98b1('0x44'),'$any']);_0x2ca8aa[_0x98b1('0x45')]=_[_0x98b1('0x46')](_0x27ec56[_0x98b1('0x31')],qs[_0x98b1('0x47')](_0x2e37eb[_0x98b1('0x32')][_0x98b1('0x47')]));_0x2ca8aa[_0x98b1('0x45')]=_0x2ca8aa['attributes']['length']?_0x2ca8aa[_0x98b1('0x45')]:_0x27ec56[_0x98b1('0x31')];if(!_0x2e37eb[_0x98b1('0x32')][_0x98b1('0x48')](_0x98b1('0x49'))){_0x2ca8aa['limit']=qs[_0x98b1('0x1f')](_0x2e37eb[_0x98b1('0x32')]['limit']);_0x2ca8aa[_0x98b1('0x1e')]=qs[_0x98b1('0x1e')](_0x2e37eb[_0x98b1('0x32')]['offset']);}_0x2ca8aa[_0x98b1('0x4a')]=qs[_0x98b1('0x4b')](_0x2e37eb[_0x98b1('0x32')]['sort']);_0x2ca8aa['where']=qs[_0x98b1('0x33')](_[_0x98b1('0x4c')](_0x2e37eb[_0x98b1('0x32')],_0x27ec56[_0x98b1('0x33')]),_0x3b54da);if(_0x2e37eb['query']['filter']){_0x2ca8aa[_0x98b1('0x4d')]=_[_0x98b1('0x4e')](_0x2ca8aa[_0x98b1('0x4d')],{'$or':_['map'](_0x3b54da,function(_0x598451){if(_0x598451[_0x98b1('0x2f')]!==_0x98b1('0x4f')){var _0xb53870={};_0xb53870[_0x598451['name']]={'$like':'%'+_0x2e37eb[_0x98b1('0x32')]['filter']+'%'};return _0xb53870;}})});}_0x2ca8aa=_['merge']({},_0x2ca8aa,_0x2e37eb[_0x98b1('0x50')]);var _0xd703d6={'where':_0x2ca8aa[_0x98b1('0x4d')]};return db[_0x98b1('0x2d')][_0x98b1('0x1d')](_0xd703d6)['then'](function(_0x32c649){_0x2b45ff[_0x98b1('0x1d')]=_0x32c649;if(_0x2e37eb[_0x98b1('0x32')]['includeAll']){_0x2ca8aa['include']=[{'all':!![]}];}return db[_0x98b1('0x2d')][_0x98b1('0x51')](_0x2ca8aa);})[_0x98b1('0x25')](function(_0x5d8354){_0x2b45ff[_0x98b1('0x52')]=_0x5d8354;return _0x2b45ff;})['then'](respondWithFilteredResult(_0x1b4183,_0x2ca8aa))[_0x98b1('0x53')](handleError(_0x1b4183,null));};exports[_0x98b1('0x54')]=function(_0x5d1787,_0x431c78){var _0x253024={'raw':!![],'where':{'id':_0x5d1787[_0x98b1('0x55')]['id']}},_0x51ca5a={};_0x51ca5a['model']=_[_0x98b1('0x56')](db['CmHopper'][_0x98b1('0x2e')]);_0x51ca5a[_0x98b1('0x32')]=_[_0x98b1('0x56')](_0x5d1787[_0x98b1('0x32')]);_0x51ca5a[_0x98b1('0x33')]=_[_0x98b1('0x46')](_0x51ca5a['model'],_0x51ca5a[_0x98b1('0x32')]);_0x253024[_0x98b1('0x45')]=_[_0x98b1('0x46')](_0x51ca5a[_0x98b1('0x31')],qs[_0x98b1('0x47')](_0x5d1787[_0x98b1('0x32')][_0x98b1('0x47')]));_0x253024['attributes']=_0x253024[_0x98b1('0x45')]['length']?_0x253024[_0x98b1('0x45')]:_0x51ca5a[_0x98b1('0x31')];if(_0x5d1787[_0x98b1('0x32')][_0x98b1('0x57')]){_0x253024[_0x98b1('0x58')]=[{'all':!![]}];}_0x253024=_[_0x98b1('0x4e')]({},_0x253024,_0x5d1787[_0x98b1('0x50')]);return db[_0x98b1('0x2d')][_0x98b1('0x59')](_0x253024)[_0x98b1('0x25')](handleEntityNotFound(_0x431c78,null))[_0x98b1('0x25')](respondWithResult(_0x431c78,null))[_0x98b1('0x53')](handleError(_0x431c78,null));};exports[_0x98b1('0x5a')]=function(_0x1a1a04,_0x2b48bd){return db[_0x98b1('0x2d')][_0x98b1('0x5a')](_0x1a1a04[_0x98b1('0x5b')],{})[_0x98b1('0x25')](respondWithResult(_0x2b48bd,0xc9))[_0x98b1('0x53')](handleError(_0x2b48bd,null));};exports[_0x98b1('0x24')]=function(_0xe07c11,_0x779f66){if(_0xe07c11[_0x98b1('0x5b')]['id']){delete _0xe07c11['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0xe07c11[_0x98b1('0x55')]['id']}})[_0x98b1('0x25')](handleEntityNotFound(_0x779f66,null))[_0x98b1('0x25')](saveUpdates(_0xe07c11['body'],null))[_0x98b1('0x25')](respondWithResult(_0x779f66,null))[_0x98b1('0x53')](handleError(_0x779f66,null));};exports[_0x98b1('0x5c')]=function(_0x514ec3,_0x4a6fa3){return db[_0x98b1('0x2d')][_0x98b1('0x5c')]()[_0x98b1('0x25')](respondWithResult(_0x4a6fa3,null))[_0x98b1('0x53')](handleError(_0x4a6fa3,null));};exports[_0x98b1('0x26')]=function(_0x1574cf,_0x5cac20){var _0x619ef5;return db[_0x98b1('0x2d')][_0x98b1('0x59')]({'where':{'id':_0x1574cf[_0x98b1('0x55')]['id']}})[_0x98b1('0x25')](handleEntityNotFound(_0x5cac20,null))['then'](function(_0x3cb689){if(_0x3cb689){return _0x3cb689['destroy']()[_0x98b1('0x25')](function(_0x381e4a){return _0x381e4a;});}})[_0x98b1('0x25')](function(_0x17ed15){_0x619ef5=_0x17ed15;if(_0x17ed15){if(_0x17ed15[_0x98b1('0x5d')]||_0x17ed15['CampaignId']){return db[_0x17ed15[_0x98b1('0x5d')]?'VoiceQueue':_0x98b1('0x5e')][_0x98b1('0x59')]({'where':{'id':_0x17ed15[_0x98b1('0x5d')]?_0x17ed15[_0x98b1('0x5d')]:_0x17ed15[_0x98b1('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x98b1('0x25')](function(_0x219f80){var _0x4b7c9f={};if(_0x219f80){_[_0x98b1('0x4e')](_0x4b7c9f,_[_0x98b1('0x60')](_0x619ef5[_0x98b1('0x61')],[_0x98b1('0x62'),_0x98b1('0x63'),'id']));_0x4b7c9f[_0x98b1('0x64')]=0x15;_0x4b7c9f['statedesc']=_0x98b1('0x65');_0x4b7c9f[_0x98b1('0x66')]=_0x219f80[_0x98b1('0x29')];_0x4b7c9f[_0x98b1('0x67')]=_0x1574cf[_0x98b1('0x68')][_0x98b1('0x29')];_0x4b7c9f['UserId']=_0x1574cf['user']['id'];_0x4b7c9f['deleted']=!![];_0x4b7c9f['deletedat']=moment()[_0x98b1('0x69')](_0x98b1('0x6a'));_0x4b7c9f[_0x98b1('0x6b')]=_0x619ef5['phone'];_0x4b7c9f[_0x98b1('0x6c')]=_0x619ef5[_0x98b1('0x5d')]?_0x98b1('0x6d'):_0x98b1('0x6e');return db[_0x98b1('0x6f')][_0x98b1('0x59')]({'where':{'id':_0x4b7c9f[_0x98b1('0x70')]},'attributes':[_0x98b1('0x71'),'lastName']})['then'](function(_0x95a634){if(!_[_0x98b1('0x72')](_0x5cac20)&&!_[_0x98b1('0x72')](_0x95a634[_0x98b1('0x71')])){_0x4b7c9f[_0x98b1('0x73')]=_0x95a634[_0x98b1('0x71')];if(!_['isNil'](_0x95a634[_0x98b1('0x74')])){_0x4b7c9f[_0x98b1('0x73')]+='\x20'+_0x95a634[_0x98b1('0x74')];}}})[_0x98b1('0x75')](function(){return db['CmHopperFinal'][_0x98b1('0x5a')](_0x4b7c9f);});}})['then'](function(){return _0x5cac20['status'](0xcc)[_0x98b1('0x1a')]();})['catch'](handleError(_0x5cac20,null));};exports['getPreview']=function(_0x1aee01,_0x1a824b,_0x404dbd){var _0x47df83=[];return db[_0x98b1('0x6f')][_0x98b1('0x5c')]()[_0x98b1('0x25')](function(_0x2aaef1){_0x47df83=_[_0x98b1('0x56')](_0x2aaef1);return _0x1aee01[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id',_0x98b1('0x79'),_0x98b1('0x7a')],'raw':!![]});})[_0x98b1('0x25')](function(_0x212b26){if(_0x212b26&&_0x212b26[_0x98b1('0x7b')]){return db[_0x98b1('0x7c')][_0x98b1('0x7d')](function(_0x572008){var _0x665fc1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x98b1('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x212b26,'id')},'$or':[{'UserId':null},{'UserId':_0x1aee01[_0x98b1('0x68')]['id']}]};var _0x55dac8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x212b26)[_0x98b1('0x7e')]([_0x98b1('0x7a'),0x0])['map']('id')[_0x98b1('0x7f')]()},'$or':[{'UserId':null},{'UserId':_0x1aee01[_0x98b1('0x68')]['id']}]};var _0x5447ea={'$or':[_0x665fc1,_0x55dac8]};var _0x110e6a=[];if(_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x80')]&&_0x1aee01[_0x98b1('0x5b')]['direction']===_0x98b1('0x81')){if(!_[_0x98b1('0x82')](_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')])){_0x5447ea['id']={'$in':_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')]};}_0x110e6a=[['priority',_0x98b1('0x84')],[_0x98b1('0x85'),_0x212b26[0x0][_0x98b1('0x79')]===_0x98b1('0x84')?'DESC':_0x98b1('0x84')],db[_0x98b1('0x7c')][_0x98b1('0x86')](_0x98b1('0x87')),['id',_0x98b1('0x88')]];}else{if(!_[_0x98b1('0x82')](_0x1aee01['body'][_0x98b1('0x83')])){_0x5447ea['id']={'$notIn':_0x1aee01[_0x98b1('0x5b')][_0x98b1('0x83')]};}_0x110e6a=[[_0x98b1('0x89'),'DESC'],[_0x98b1('0x85'),_0x212b26[0x0][_0x98b1('0x79')]],db[_0x98b1('0x7c')][_0x98b1('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x98b1('0x84')]];}return db[_0x98b1('0x2d')]['findOne']({'attributes':['id','scheduledat',_0x98b1('0x8a')],'where':_0x5447ea,'order':_0x110e6a,'transaction':_0x572008,'lock':_0x572008[_0x98b1('0x8b')][_0x98b1('0x8c')],'include':[{'model':db['CmContact'],'as':_0x98b1('0x8d'),'attributes':_0x47df83,'include':[{'model':db['CmCompany'],'as':_0x98b1('0x8e'),'attributes':['id','name']}]},{'model':db[_0x98b1('0x8f')],'as':_0x98b1('0x90'),'attributes':['id',_0x98b1('0x29')]},{'model':db[_0x98b1('0x91')],'as':_0x98b1('0x92'),'attributes':['id',_0x98b1('0x29'),_0x98b1('0x93')]}]})[_0x98b1('0x25')](function(_0x3e2226){if(_0x3e2226){return _0x3e2226['update']({'UserId':_0x1aee01[_0x98b1('0x68')]['id']},{'transaction':_0x572008});}});});}})[_0x98b1('0x25')](handleEntityNotFound(_0x1a824b,null))['then'](respondWithResult(_0x1a824b,null))['catch'](handleError(_0x1a824b,null));};exports['getPreviewRecall']=function(_0xb91713,_0x332c53,_0x54bbd8){var _0x3e5e83=[];return db['CmContact'][_0x98b1('0x5c')]()[_0x98b1('0x25')](function(_0x3ba499){_0x3e5e83=_['keys'](_0x3ba499);return _0xb91713[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id',_0x98b1('0x79'),_0x98b1('0x7a')],'raw':!![]});})[_0x98b1('0x25')](function(_0x19e27b){if(_0x19e27b&&_0x19e27b[_0x98b1('0x7b')]){return db['sequelize'][_0x98b1('0x7d')](function(_0x2e2092){var _0x3819f3={'active':![],'recallme':!![],'id':_0xb91713[_0x98b1('0x5b')][_0x98b1('0x94')]};return db[_0x98b1('0x2d')][_0x98b1('0x95')]({'attributes':['id','scheduledat','recallme'],'where':_0x3819f3,'transaction':_0x2e2092,'lock':_0x2e2092[_0x98b1('0x8b')][_0x98b1('0x8c')],'include':[{'model':db[_0x98b1('0x6f')],'as':'Contact','attributes':_0x3e5e83,'include':[{'model':db[_0x98b1('0x96')],'as':_0x98b1('0x8e'),'attributes':['id',_0x98b1('0x29')]}]},{'model':db[_0x98b1('0x8f')],'as':_0x98b1('0x90'),'attributes':['id',_0x98b1('0x29')]},{'model':db[_0x98b1('0x91')],'as':_0x98b1('0x92'),'attributes':['id','name',_0x98b1('0x93')]}]})[_0x98b1('0x25')](function(_0x13e6ad){if(_0x13e6ad){return _0x13e6ad[_0x98b1('0x24')]({'UserId':_0xb91713['user']['id']},{'transaction':_0x2e2092});}});});}})['then'](handleEntityNotFound(_0x332c53,null))[_0x98b1('0x25')](respondWithResult(_0x332c53,null))['catch'](handleError(_0x332c53,null));};exports['getOpenContacts']=function(_0x26117a,_0xb99ccc,_0x498b6f){return _0x26117a[_0x98b1('0x68')][_0x98b1('0x76')]({'where':{'type':_0x98b1('0x77'),'dialActive':!![],'dialMethod':_0x98b1('0x78')},'attributes':['id'],'raw':!![]})[_0x98b1('0x25')](function(_0x25a1d7){if(_0x25a1d7&&_0x25a1d7[_0x98b1('0x7b')]){return db['CmHopper'][_0x98b1('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x98b1('0x69')](_0x98b1('0x6a'))},'VoiceQueueId':{'$in':_[_0x98b1('0x2c')](_0x25a1d7,'id')},'$or':[{'UserId':null},{'UserId':_0x26117a[_0x98b1('0x68')]['id']}]}});}return 0x0;})['then'](function(_0x5dd80c){if(!_[_0x98b1('0x72')](_0x5dd80c)&&_['isNumber'](_0x5dd80c)){return _0xb99ccc[_0x98b1('0x19')](0xc8)[_0x98b1('0x1b')]({'contacts':_0x5dd80c});}else{logger['error'](_0x98b1('0x97'),_0x98b1('0x98'),0x194,_0x98b1('0x99'));_0xb99ccc['sendStatus'](0x194);}})[_0x98b1('0x53')](handleError(_0xb99ccc,null));};exports[_0x98b1('0x9a')]=function(_0x3d4ef5,_0x2cfad7,_0x22f247){var _0x4b0e24=shared['timezones'];var _0x4dd60a=[];_[_0x98b1('0x2c')](_0x4b0e24,function(_0x13f902){_0x4dd60a[_0x98b1('0x9b')]({'id':_0x13f902[_0x98b1('0x29')],'name':_0x13f902[_0x98b1('0x29')],'utcOffset':_0x13f902[_0x98b1('0x9c')]});});return _0x2cfad7[_0x98b1('0x19')](0xc8)['json']({'tz':_0x4dd60a});};exports['getTimezone']=function(_0x3dcc88,_0x2a0393,_0x1042d1){var _0x4f4532=shared[_0x98b1('0x9d')];var _0x3e6963={};if(!_['isNil'](_0x4f4532[_0x3dcc88[_0x98b1('0x5b')]['id']]))_0x3e6963=_0x4f4532[_0x3dcc88[_0x98b1('0x5b')]['id']];return _0x2a0393[_0x98b1('0x19')](0xc8)[_0x98b1('0x1b')](_0x3e6963);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index eb4961f..f0fcd29 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 _0xfcf0=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','api'];(function(_0x39fa8f,_0x5540d3){var _0x5af889=function(_0x379934){while(--_0x379934){_0x39fa8f['push'](_0x39fa8f['shift']());}};_0x5af889(++_0x5540d3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0xfcf0[_0x3877c1];return _0x59056a;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0fcf('0xc'),'fields':[_0x0fcf('0xc')]},{'name':_0x0fcf('0xd'),'fields':['phone']},{'name':_0x0fcf('0xe'),'fields':[_0x0fcf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger'];(function(_0x162f4b,_0x31b569){var _0x57b00b=function(_0xef34c9){while(--_0xef34c9){_0x162f4b['push'](_0x162f4b['shift']());}};_0x57b00b(++_0x31b569);}(_0x2a07,0x74));var _0x72a0=function(_0x279614,_0x4cce43){_0x279614=_0x279614-0x0;var _0x2a331c=_0x2a07[_0x279614];return _0x2a331c;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xe')]},{'name':_0x72a0('0xf'),'fields':[_0x72a0('0xf')]},{'name':_0x72a0('0x10'),'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 4dde7c1..270e872 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 _0xa12f=['push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','User','List','\x20MINUTE','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','CmHopper,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopper','ShowCmHopper','CmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','includes'];(function(_0x58e448,_0x5242fe){var _0x9f48a7=function(_0x2c628b){while(--_0x2c628b){_0x58e448['push'](_0x58e448['shift']());}};_0x9f48a7(++_0x5242fe);}(_0xa12f,0x1df));var _0xfa12=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa12f[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xfa12('0x0'));var util=require(_0xfa12('0x1'));var moment=require(_0xfa12('0x2'));var BPromise=require('bluebird');var rs=require(_0xfa12('0x3'));var fs=require('fs');var Redis=require(_0xfa12('0x4'));var db=require(_0xfa12('0x5'))['db'];var utils=require(_0xfa12('0x6'));var logger=require(_0xfa12('0x7'))(_0xfa12('0x8'));var config=require(_0xfa12('0x9'));var jayson=require(_0xfa12('0xa'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0xfa12('0xb')][_0xfa12('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dbbeb,_0x47555a,_0x427ce4){return new BPromise(function(_0x39f423,_0x1e3273){return client[_0xfa12('0xd')](_0x2dbbeb,_0x427ce4)[_0xfa12('0xe')](function(_0x5e897e){logger[_0xfa12('0xf')]('CmHopper,\x20%s,\x20%s',_0x47555a,_0xfa12('0x10'));logger[_0xfa12('0x11')](_0xfa12('0x12'),_0x47555a,_0xfa12('0x10'),JSON[_0xfa12('0x13')](_0x5e897e));if(_0x5e897e[_0xfa12('0x14')]){if(_0x5e897e[_0xfa12('0x14')]['code']===0x1f4){logger[_0xfa12('0x14')]('CmHopper,\x20%s,\x20%s',_0x47555a,_0x5e897e['error']['message']);return _0x1e3273(_0x5e897e[_0xfa12('0x14')][_0xfa12('0x15')]);}logger[_0xfa12('0x14')](_0xfa12('0x16'),_0x47555a,_0x5e897e['error']['message']);return _0x39f423(_0x5e897e['error']['message']);}else{logger[_0xfa12('0xf')]('CmHopper,\x20%s,\x20%s',_0x47555a,_0xfa12('0x10'));_0x39f423(_0x5e897e[_0xfa12('0x17')][_0xfa12('0x15')]);}})[_0xfa12('0x18')](function(_0x398f44){logger[_0xfa12('0x14')](_0xfa12('0x16'),_0x47555a,_0x398f44);_0x1e3273(_0x398f44);});});}exports['GetCmHopper']=function(_0x4e48f1){var _0x5e597c=this;return new Promise(function(_0x4cf9a0,_0x44957c){return db['CmHopper'][_0xfa12('0x19')]({'raw':_0x4e48f1[_0xfa12('0x1a')]?_0x4e48f1[_0xfa12('0x1a')][_0xfa12('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e48f1[_0xfa12('0x1a')]?_0x4e48f1[_0xfa12('0x1a')][_0xfa12('0x1c')]||null:null,'attributes':_0x4e48f1[_0xfa12('0x1a')]?_0x4e48f1[_0xfa12('0x1a')][_0xfa12('0x1d')]||null:null,'limit':_0x4e48f1['options']?_0x4e48f1[_0xfa12('0x1a')][_0xfa12('0x1e')]||null:null,'include':_0x4e48f1[_0xfa12('0x1a')]?_0x4e48f1[_0xfa12('0x1a')][_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0x4e48f1[_0xfa12('0x1a')]['include'],function(_0x3acbea){return{'model':db[_0x3acbea['model']],'as':_0x3acbea['as'],'attributes':_0x3acbea[_0xfa12('0x1d')],'include':_0x3acbea['include']?_[_0xfa12('0x20')](_0x3acbea['include'],function(_0xe9cdda){return{'model':db[_0xe9cdda[_0xfa12('0x21')]],'as':_0xe9cdda['as'],'attributes':_0xe9cdda['attributes'],'include':_0xe9cdda[_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0xe9cdda[_0xfa12('0x1f')],function(_0xf9de9c){return{'model':db[_0xf9de9c[_0xfa12('0x21')]],'as':_0xf9de9c['as'],'attributes':_0xf9de9c[_0xfa12('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfa12('0xe')](function(_0x6ee832){logger['info'](_0xfa12('0x22'),_0x4e48f1);logger['debug'](_0xfa12('0x22'),_0x4e48f1,JSON[_0xfa12('0x13')](_0x6ee832));_0x4cf9a0(_0x6ee832);})[_0xfa12('0x18')](function(_0x245c7c){logger[_0xfa12('0x14')](_0xfa12('0x22'),_0x245c7c[_0xfa12('0x15')],_0x4e48f1);_0x44957c(_0x5e597c['error'](0x1f4,_0x245c7c[_0xfa12('0x15')]));});});};exports[_0xfa12('0x23')]=function(_0x5705a1){var _0x4b0ec5=this;return new Promise(function(_0x4536c7,_0x4700a2){return db[_0xfa12('0x24')][_0xfa12('0x25')]({'raw':_0x5705a1[_0xfa12('0x1a')]?_0x5705a1[_0xfa12('0x1a')][_0xfa12('0x1b')]===undefined?!![]:![]:!![],'where':_0x5705a1[_0xfa12('0x1a')]?_0x5705a1[_0xfa12('0x1a')][_0xfa12('0x1c')]||null:null,'attributes':_0x5705a1[_0xfa12('0x1a')]?_0x5705a1['options']['attributes']||null:null,'include':_0x5705a1[_0xfa12('0x1a')]?_0x5705a1[_0xfa12('0x1a')]['include']?_[_0xfa12('0x20')](_0x5705a1[_0xfa12('0x1a')][_0xfa12('0x1f')],function(_0x24b07a){return{'model':db[_0x24b07a['model']],'as':_0x24b07a['as'],'attributes':_0x24b07a[_0xfa12('0x1d')],'include':_0x24b07a[_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0x24b07a[_0xfa12('0x1f')],function(_0x332b2c){return{'model':db[_0x332b2c[_0xfa12('0x21')]],'as':_0x332b2c['as'],'attributes':_0x332b2c[_0xfa12('0x1d')],'include':_0x332b2c['include']?_[_0xfa12('0x20')](_0x332b2c['include'],function(_0x3bc15d){return{'model':db[_0x3bc15d['model']],'as':_0x3bc15d['as'],'attributes':_0x3bc15d[_0xfa12('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eb9c0){logger[_0xfa12('0xf')](_0xfa12('0x23'),_0x5705a1);logger[_0xfa12('0x11')](_0xfa12('0x23'),_0x5705a1,JSON['stringify'](_0x2eb9c0));_0x4536c7(_0x2eb9c0);})[_0xfa12('0x18')](function(_0x509e84){logger[_0xfa12('0x14')]('ShowCmHopper',_0x509e84['message'],_0x5705a1);_0x4700a2(_0x4b0ec5['error'](0x1f4,_0x509e84[_0xfa12('0x15')]));});});};exports[_0xfa12('0x26')]=function(_0x45321d){var _0x296ac7=this;return new Promise(function(_0x38cd9a,_0x41146a){return db[_0xfa12('0x24')][_0xfa12('0x27')](_0x45321d[_0xfa12('0x28')],{'raw':_0x45321d[_0xfa12('0x1a')]?_0x45321d[_0xfa12('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xfa12('0xe')](function(_0x3855fd){logger[_0xfa12('0xf')](_0xfa12('0x26'),_0x45321d);logger[_0xfa12('0x11')](_0xfa12('0x26'),_0x45321d,JSON[_0xfa12('0x13')](_0x3855fd));_0x38cd9a(_0x3855fd);})[_0xfa12('0x18')](function(_0x3c055e){logger[_0xfa12('0x14')](_0xfa12('0x26'),_0x3c055e[_0xfa12('0x15')],_0x45321d);_0x41146a(_0x296ac7[_0xfa12('0x14')](0x1f4,_0x3c055e[_0xfa12('0x15')]));});});};exports[_0xfa12('0x29')]=function(_0xa7e70c){var _0x79d806=this;return new Promise(function(_0x17a561,_0x5189b0){return db[_0xfa12('0x24')][_0xfa12('0x2a')](_0xa7e70c[_0xfa12('0x28')],{'raw':_0xa7e70c[_0xfa12('0x1a')]?_0xa7e70c[_0xfa12('0x1a')][_0xfa12('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7e70c[_0xfa12('0x1a')]?_0xa7e70c[_0xfa12('0x1a')]['where']||null:null,'attributes':_0xa7e70c[_0xfa12('0x1a')]?_0xa7e70c['options'][_0xfa12('0x1d')]||null:null,'limit':_0xa7e70c[_0xfa12('0x1a')]?_0xa7e70c[_0xfa12('0x1a')]['limit']||null:null})['then'](function(_0x2b6a50){logger[_0xfa12('0xf')](_0xfa12('0x29'),_0xa7e70c);logger[_0xfa12('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xfa12('0x13')](_0xa7e70c[_0xfa12('0x1a')][_0xfa12('0x1c')]),_0xa7e70c[_0xfa12('0x28')][_0xfa12('0x2b')]);logger[_0xfa12('0x11')](_0xfa12('0x29'),_0xa7e70c,JSON['stringify'](_0x2b6a50));_0x17a561(_0x2b6a50);})[_0xfa12('0x18')](function(_0x40310f){logger['error'](_0xfa12('0x29'),_0x40310f[_0xfa12('0x15')],_0xa7e70c);_0x5189b0(_0x79d806[_0xfa12('0x14')](0x1f4,_0x40310f[_0xfa12('0x15')]));});});};exports[_0xfa12('0x2c')]=function(_0x2042f8){var _0x28aea5=this;return new Promise(function(_0x58d6c7,_0x3cb234){return db['CmHopper']['destroy']({'where':_0x2042f8[_0xfa12('0x1a')]?_0x2042f8[_0xfa12('0x1a')]['where']||null:null})['then'](function(_0x3869da){logger[_0xfa12('0xf')](_0xfa12('0x2c'),_0x2042f8);logger[_0xfa12('0x11')](_0xfa12('0x2c'),_0x2042f8,JSON[_0xfa12('0x13')](_0x3869da));_0x58d6c7(_0x3869da);})[_0xfa12('0x18')](function(_0x45744a){logger['error'](_0xfa12('0x2c'),_0x45744a[_0xfa12('0x15')],_0x2042f8);_0x3cb234(_0x28aea5[_0xfa12('0x14')](0x1f4,_0x45744a[_0xfa12('0x15')]));});});};exports[_0xfa12('0x2d')]=function(_0x477810){var _0x1e5ea2=this;return new Promise(function(_0x59534e,_0x4b7065){return db[_0xfa12('0x2e')][_0xfa12('0x2f')]()[_0xfa12('0xe')](function(_0x524d76){return db[_0xfa12('0x30')][_0xfa12('0x31')](function(_0x288345){return db[_0xfa12('0x24')][_0xfa12('0x19')]({'where':_0x477810[_0xfa12('0x1a')]?_0x477810[_0xfa12('0x1a')][_0xfa12('0x1c')]||null:null,'attributes':_0x477810[_0xfa12('0x1a')]?_0x477810[_0xfa12('0x1a')][_0xfa12('0x1d')]||null:null,'limit':_0x477810[_0xfa12('0x1a')]?_0x477810[_0xfa12('0x1a')][_0xfa12('0x1e')]||null:null,'order':_0x477810[_0xfa12('0x1a')]?_0x477810[_0xfa12('0x1a')][_0xfa12('0x32')]||null:null,'transaction':_0x288345,'lock':_0x288345[_0xfa12('0x33')][_0xfa12('0x34')],'include':[{'model':db[_0xfa12('0x2e')],'as':_0xfa12('0x35'),'attributes':_[_0xfa12('0x36')](_0x524d76)},{'model':db['User'],'as':_0xfa12('0x37'),'attributes':['id',_0xfa12('0x38'),_0xfa12('0x39')]}]})[_0xfa12('0xe')](function(_0xbebe5d){var _0x4d1713=[];var _0x29187e=[];for(var _0x3a5bef=0x0;_0x3a5bef<_0xbebe5d[_0xfa12('0x3a')];_0x3a5bef+=0x1){var _0x4e8798=_0xbebe5d[_0x3a5bef][_0xfa12('0x3b')];if(_0x4e8798===null){_0x4d1713['push'](_0xbebe5d[_0x3a5bef]['update'](_0x477810['body'],{'transaction':_0x288345}));}else if(!_0x29187e[_0xfa12('0x3c')](_0x4e8798)){_0x29187e[_0xfa12('0x3d')](_0x4e8798);_0x4d1713[_0xfa12('0x3d')](_0xbebe5d[_0x3a5bef][_0xfa12('0x2a')](_0x477810[_0xfa12('0x28')],{'transaction':_0x288345}));}}return BPromise[_0xfa12('0x3e')](_0x4d1713);});})[_0xfa12('0xe')](function(_0x2d13b9){logger['info'](_0xfa12('0x2d'),_0x477810);if(_0x2d13b9[_0xfa12('0x3a')]>0x0){logger[_0xfa12('0xf')](_0xfa12('0x3f'),_0x2d13b9[0x0][_0xfa12('0x40')]['id'],_0x2d13b9[0x0][_0xfa12('0x40')][_0xfa12('0x41')],_0x2d13b9[0x0][_0xfa12('0x40')]['active']);}logger[_0xfa12('0x11')]('GetContactDialer',_0x477810,JSON[_0xfa12('0x13')](_0x2d13b9));_0x59534e(_0x2d13b9);})[_0xfa12('0x18')](function(_0x462169){logger[_0xfa12('0x14')](_0xfa12('0x2d'),_0x462169[_0xfa12('0x15')],_0x477810);_0x4b7065(_0x1e5ea2[_0xfa12('0x14')](0x1f4,_0x462169[_0xfa12('0x15')]));});});});};exports[_0xfa12('0x42')]=function(_0x3b4102){var _0x325885=this;return new Promise(function(_0x4a1703,_0x30bf7b){return db['sequelize'][_0xfa12('0x31')](function(_0x531e32){return db[_0xfa12('0x43')][_0xfa12('0x27')](_0x3b4102['body'],{'raw':_0x3b4102[_0xfa12('0x1a')]?_0x3b4102[_0xfa12('0x1a')][_0xfa12('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x531e32})[_0xfa12('0xe')](function(){logger['info'](_0xfa12('0x44'),JSON[_0xfa12('0x13')](_0x3b4102['options']['where']),_0x3b4102[_0xfa12('0x1a')][_0xfa12('0x1c')]['active']);return db[_0xfa12('0x24')]['destroy']({'where':_0x3b4102[_0xfa12('0x1a')]?_0x3b4102['options'][_0xfa12('0x1c')]||null:null,'transaction':_0x531e32});});})[_0xfa12('0xe')](function(_0x13ed2a){logger[_0xfa12('0xf')](_0xfa12('0x42'),_0x3b4102);logger[_0xfa12('0x11')](_0xfa12('0x42'),_0x3b4102,JSON[_0xfa12('0x13')](_0x13ed2a));_0x4a1703(_0x13ed2a);})[_0xfa12('0x18')](function(_0x38c3c4){logger[_0xfa12('0x14')](_0xfa12('0x42'),_0x38c3c4[_0xfa12('0x15')],_0x3b4102);_0x30bf7b(_0x325885['error'](0x1f4,_0x38c3c4['message']));});});};exports[_0xfa12('0x45')]=function(_0x111ee0){var _0x4ee212=this;return new Promise(function(_0x5e36c2,_0x3650a7){return db['CmHopper'][_0xfa12('0x19')]({'raw':_0x111ee0['options']?_0x111ee0[_0xfa12('0x1a')][_0xfa12('0x1b')]===undefined?!![]:![]:!![],'where':_0x111ee0['options']?_0x111ee0[_0xfa12('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xfa12('0x46'),db[_0xfa12('0x30')]['fn']('IF',db[_0xfa12('0x30')][_0xfa12('0x47')]('`scheduledat`\x20>=\x20'+util['format'](_0xfa12('0x48'),moment()[_0xfa12('0x49')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xfa12('0x4a')))),_0xfa12('0x4b')]]})[_0xfa12('0xe')](function(_0x4f31c7){logger[_0xfa12('0xf')](_0xfa12('0x45'),_0x111ee0);logger[_0xfa12('0x11')](_0xfa12('0x45'),_0x111ee0,JSON[_0xfa12('0x13')](_0x4f31c7));_0x5e36c2(_0x4f31c7);})['catch'](function(_0x210c29){logger[_0xfa12('0x14')](_0xfa12('0x45'),_0x210c29[_0xfa12('0x15')],_0x111ee0);_0x3650a7(_0x4ee212[_0xfa12('0x14')](0x1f4,_0x210c29[_0xfa12('0x15')]));});});};exports[_0xfa12('0x4c')]=function(_0xb4be0e){var _0x204814=this;return new Promise(function(_0x209224,_0x48e4d6){return db[_0xfa12('0x2e')][_0xfa12('0x2f')]()['then'](function(_0x1e4746){return db[_0xfa12('0x30')][_0xfa12('0x31')](function(_0x1360c7){return db[_0xfa12('0x24')]['findAll']({'where':_0xb4be0e[_0xfa12('0x1a')]?_0xb4be0e[_0xfa12('0x1a')]['where']||null:null,'attributes':_0xb4be0e['options']?_0xb4be0e[_0xfa12('0x1a')][_0xfa12('0x1d')]||null:null,'limit':0x1,'order':_0xb4be0e['options']?_0xb4be0e[_0xfa12('0x1a')][_0xfa12('0x32')]||null:null,'group':db[_0xfa12('0x24')][_0xfa12('0x3b')],'transaction':_0x1360c7,'lock':_0x1360c7[_0xfa12('0x33')][_0xfa12('0x34')],'include':_0xb4be0e[_0xfa12('0x1a')]?_0xb4be0e['options'][_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0xb4be0e[_0xfa12('0x1a')][_0xfa12('0x1f')],function(_0x1fb01a){return{'model':db[_0x1fb01a[_0xfa12('0x21')]],'as':_0x1fb01a['as'],'attributes':_0x1fb01a[_0xfa12('0x1d')],'include':_0x1fb01a[_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0x1fb01a[_0xfa12('0x1f')],function(_0x1e104c){return{'model':db[_0x1e104c[_0xfa12('0x21')]],'as':_0x1e104c['as'],'attributes':_0x1e104c[_0xfa12('0x1d')],'include':_0x1e104c[_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0x1e104c[_0xfa12('0x1f')],function(_0x269e4a){return{'model':db[_0x269e4a[_0xfa12('0x21')]],'as':_0x269e4a['as'],'attributes':_0x269e4a[_0xfa12('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfa12('0xe')](function(_0x4e32e6){var _0x202317=[];for(var _0x2f9625=0x0;_0x2f9625<_0x4e32e6[_0xfa12('0x3a')];_0x2f9625+=0x1){_0x202317[_0xfa12('0x3d')](_0x4e32e6[_0x2f9625][_0xfa12('0x2a')](_0xb4be0e[_0xfa12('0x28')],{'transaction':_0x1360c7}));}return BPromise[_0xfa12('0x3e')](_0x202317);});})[_0xfa12('0xe')](function(_0x1f85fb){logger[_0xfa12('0xf')](_0xfa12('0x4c'),_0xb4be0e);logger['debug']('GetContactRecallMe',_0xb4be0e,JSON['stringify'](_0x1f85fb));_0x209224(_0x1f85fb);})[_0xfa12('0x18')](function(_0x7953d){logger[_0xfa12('0x14')](_0xfa12('0x4c'),_0x7953d[_0xfa12('0x15')],_0xb4be0e);_0x48e4d6(_0x204814[_0xfa12('0x14')](0x1f4,_0x7953d[_0xfa12('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x17bba7){var _0x221e28=this;return new Promise(function(_0x5e1a6c,_0x37abeb){db[_0xfa12('0x2e')][_0xfa12('0x2f')]()[_0xfa12('0xe')](function(_0x2897d6){return db[_0xfa12('0x24')][_0xfa12('0x19')]({'raw':_0x17bba7[_0xfa12('0x1a')]?_0x17bba7[_0xfa12('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x17bba7[_0xfa12('0x1a')]?_0x17bba7[_0xfa12('0x1a')][_0xfa12('0x1c')]||null:null,'attributes':_0x17bba7[_0xfa12('0x1a')]?_0x17bba7[_0xfa12('0x1a')][_0xfa12('0x1d')]||null:null,'limit':_0x17bba7[_0xfa12('0x1a')]?_0x17bba7[_0xfa12('0x1a')][_0xfa12('0x1e')]||null:null,'include':_0x17bba7[_0xfa12('0x1a')]?_0x17bba7[_0xfa12('0x1a')][_0xfa12('0x1f')]?_[_0xfa12('0x20')](_0x17bba7[_0xfa12('0x1a')]['include'],function(_0x1984e3){return{'model':db[_0x1984e3['model']],'as':_0x1984e3['as'],'attributes':_0x1984e3['as']===_0xfa12('0x35')?_[_0xfa12('0x36')](_0x2897d6):_0x1984e3[_0xfa12('0x1d')],'include':_0x1984e3['include']?_[_0xfa12('0x20')](_0x1984e3[_0xfa12('0x1f')],function(_0x1203b5){return{'model':db[_0x1203b5[_0xfa12('0x21')]],'as':_0x1203b5['as'],'attributes':_0x1203b5['attributes'],'include':_0x1203b5['include']?_[_0xfa12('0x20')](_0x1203b5['include'],function(_0x55c3c4){return{'model':db[_0x55c3c4[_0xfa12('0x21')]],'as':_0x55c3c4['as'],'attributes':_0x55c3c4[_0xfa12('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfa12('0xe')](function(_0x262dce){logger[_0xfa12('0xf')]('GetCmHopper',_0x17bba7);logger['debug']('GetCmHopper',_0x17bba7,JSON[_0xfa12('0x13')](_0x262dce));_0x5e1a6c(_0x262dce);})[_0xfa12('0x18')](function(_0x6fbb1e){logger[_0xfa12('0x14')](_0xfa12('0x22'),_0x6fbb1e['message'],_0x17bba7);_0x37abeb(_0x221e28[_0xfa12('0x14')](0x1f4,_0x6fbb1e['message']));});});});};exports['GetContactByPhone']=function(_0x1d44be){var _0x3e0bf2=this;return new Promise(function(_0x4821cb,_0x18cc0d){return db[_0xfa12('0x2e')][_0xfa12('0x4d')]({'raw':!![],'where':{'phone':_0x1d44be[_0xfa12('0x1a')][_0xfa12('0x1c')][_0xfa12('0x4e')]},'attributes':['id',_0xfa12('0x4f')],'order':[['id',_0xfa12('0x50')]]})[_0xfa12('0xe')](function(_0x251860){logger[_0xfa12('0xf')]('getContactByPhone',_0x1d44be);logger[_0xfa12('0x11')]('getContactByPhone',_0x1d44be,JSON[_0xfa12('0x13')](_0x251860));_0x4821cb(_0x251860);})['catch'](function(_0x13fb30){logger['error'](_0xfa12('0x51'),_0x13fb30[_0xfa12('0x15')],_0x1d44be);_0x18cc0d(_0x3e0bf2[_0xfa12('0x14')](0x1f4,_0x13fb30[_0xfa12('0x15')]));});});};exports[_0xfa12('0x52')]=function(_0x14b20b){var _0xc1f405=this;return new Promise(function(_0x312edb,_0x4467c4){return db[_0xfa12('0x30')]['transaction'](function(_0x1c1df2){return db[_0xfa12('0x24')][_0xfa12('0x2a')]({'active':![]},{'where':{},'transaction':_0x1c1df2})[_0xfa12('0xe')](function(_0x43c089){logger[_0xfa12('0xf')](_0xfa12('0x52'),_0x14b20b);logger[_0xfa12('0x11')](_0xfa12('0x52'),_0x14b20b,JSON['stringify'](_0x43c089));_0x312edb(_0x43c089);})[_0xfa12('0x18')](function(_0x47d37d){logger[_0xfa12('0x14')]('ResetActiveCalls',_0x47d37d['message'],_0x14b20b);_0x4467c4(_0xc1f405[_0xfa12('0x14')](0x1f4,_0x47d37d[_0xfa12('0x15')]));});});});};exports[_0xfa12('0x53')]=function(_0x22b017){var _0x2a99c0=this;var _0x32c6e2=_0x22b017[_0xfa12('0x28')][_0xfa12('0x1c')][_0xfa12('0x54')];var _0x5a98a4=_0x22b017[_0xfa12('0x28')][_0xfa12('0x1c')][_0xfa12('0x55')];return new Promise(function(_0x14f6b3,_0x423b1c){return db[_0xfa12('0x24')][_0xfa12('0x19')]({'where':{'voiceQueueId':_0x32c6e2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0xfa12('0x47')](_0xfa12('0x56')+_0x5a98a4+'\x20MINUTE')}},'include':[{'model':db[_0xfa12('0x2e')],'as':_0xfa12('0x35')},{'model':db[_0xfa12('0x57')],'as':_0xfa12('0x37'),'attributes':['id',_0xfa12('0x38'),'voicePause']},{'model':db['CmList'],'as':_0xfa12('0x58')}]})[_0xfa12('0xe')](function(_0x73e2ef){return db[_0xfa12('0x30')][_0xfa12('0x31')](function(_0x5ed6d9){return db[_0xfa12('0x24')][_0xfa12('0x2a')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x32c6e2,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0xfa12('0x30')]['literal'](_0xfa12('0x56')+_0x5a98a4+_0xfa12('0x59'))}},'transaction':_0x5ed6d9})['then'](function(_0x4af5a7){_0x14f6b3(_0x73e2ef);})['catch'](function(_0x15215c){logger[_0xfa12('0x14')](_0xfa12('0x53'),_0x15215c[_0xfa12('0x15')],_0x22b017);_0x423b1c(validateExpressRequest);});});})[_0xfa12('0x18')](function(_0x569fc1){logger[_0xfa12('0x14')](_0xfa12('0x53'),_0x569fc1[_0xfa12('0x15')],_0x22b017);_0x423b1c(_0x2a99c0[_0xfa12('0x14')](0x1f4,_0x569fc1['message']));});});}; \ No newline at end of file +var _0x2a99=['voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','info','request\x20sent','error','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowCmHopper','find','then','debug','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','LOCK','CmContact','Contact','User','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','order','UPDATE','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x2a99,0xb5));var _0x92a9=function(_0x5dbc86,_0xcdbb86){_0x5dbc86=_0x5dbc86-0x0;var _0x1f80e3=_0x2a99[_0x5dbc86];return _0x1f80e3;};'use strict';var _=require(_0x92a9('0x0'));var util=require(_0x92a9('0x1'));var moment=require(_0x92a9('0x2'));var BPromise=require(_0x92a9('0x3'));var rs=require(_0x92a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x92a9('0x5'))(_0x92a9('0x6'));var config=require(_0x92a9('0x7'));var jayson=require(_0x92a9('0x8'));const {validateExpressRequest}=require(_0x92a9('0x9'));var client=jayson[_0x92a9('0xa')][_0x92a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xde139e,_0x2e649c,_0x3d1173){return new BPromise(function(_0x51d2e5,_0x4db777){return client[_0x92a9('0xc')](_0xde139e,_0x3d1173)['then'](function(_0x4921b1){logger[_0x92a9('0xd')]('CmHopper,\x20%s,\x20%s',_0x2e649c,_0x92a9('0xe'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x2e649c,_0x92a9('0xe'),JSON['stringify'](_0x4921b1));if(_0x4921b1[_0x92a9('0xf')]){if(_0x4921b1[_0x92a9('0xf')]['code']===0x1f4){logger['error'](_0x92a9('0x10'),_0x2e649c,_0x4921b1['error']['message']);return _0x4db777(_0x4921b1['error']['message']);}logger[_0x92a9('0xf')](_0x92a9('0x10'),_0x2e649c,_0x4921b1[_0x92a9('0xf')][_0x92a9('0x11')]);return _0x51d2e5(_0x4921b1[_0x92a9('0xf')][_0x92a9('0x11')]);}else{logger['info'](_0x92a9('0x10'),_0x2e649c,_0x92a9('0xe'));_0x51d2e5(_0x4921b1[_0x92a9('0x12')]['message']);}})[_0x92a9('0x13')](function(_0x4f7826){logger[_0x92a9('0xf')](_0x92a9('0x10'),_0x2e649c,_0x4f7826);_0x4db777(_0x4f7826);});});}exports[_0x92a9('0x14')]=function(_0x54565c){var _0x747c62=this;return new Promise(function(_0x2f3c29,_0x568513){return db[_0x92a9('0x15')][_0x92a9('0x16')]({'raw':_0x54565c[_0x92a9('0x17')]?_0x54565c[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x54565c[_0x92a9('0x17')]?_0x54565c['options'][_0x92a9('0x19')]||null:null,'attributes':_0x54565c[_0x92a9('0x17')]?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1a')]||null:null,'limit':_0x54565c['options']?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1b')]||null:null,'include':_0x54565c['options']?_0x54565c[_0x92a9('0x17')][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x54565c[_0x92a9('0x17')][_0x92a9('0x1c')],function(_0x3ce9b7){return{'model':db[_0x3ce9b7['model']],'as':_0x3ce9b7['as'],'attributes':_0x3ce9b7[_0x92a9('0x1a')],'include':_0x3ce9b7[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x3ce9b7['include'],function(_0x1b5e51){return{'model':db[_0x1b5e51[_0x92a9('0x1e')]],'as':_0x1b5e51['as'],'attributes':_0x1b5e51['attributes'],'include':_0x1b5e51[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x1b5e51[_0x92a9('0x1c')],function(_0x547a95){return{'model':db[_0x547a95[_0x92a9('0x1e')]],'as':_0x547a95['as'],'attributes':_0x547a95[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x175f6d){logger['info']('GetCmHopper',_0x54565c);logger['debug'](_0x92a9('0x14'),_0x54565c,JSON[_0x92a9('0x1f')](_0x175f6d));_0x2f3c29(_0x175f6d);})[_0x92a9('0x13')](function(_0x1ce10f){logger[_0x92a9('0xf')](_0x92a9('0x14'),_0x1ce10f[_0x92a9('0x11')],_0x54565c);_0x568513(_0x747c62[_0x92a9('0xf')](0x1f4,_0x1ce10f[_0x92a9('0x11')]));});});};exports[_0x92a9('0x20')]=function(_0x289f4d){var _0x23007d=this;return new Promise(function(_0x19ef51,_0x47c1ff){return db[_0x92a9('0x15')][_0x92a9('0x21')]({'raw':_0x289f4d[_0x92a9('0x17')]?_0x289f4d[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x289f4d[_0x92a9('0x17')]?_0x289f4d['options']['where']||null:null,'attributes':_0x289f4d[_0x92a9('0x17')]?_0x289f4d[_0x92a9('0x17')]['attributes']||null:null,'include':_0x289f4d[_0x92a9('0x17')]?_0x289f4d['options'][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x289f4d[_0x92a9('0x17')]['include'],function(_0x44152a){return{'model':db[_0x44152a[_0x92a9('0x1e')]],'as':_0x44152a['as'],'attributes':_0x44152a[_0x92a9('0x1a')],'include':_0x44152a[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x44152a[_0x92a9('0x1c')],function(_0x5a173f){return{'model':db[_0x5a173f[_0x92a9('0x1e')]],'as':_0x5a173f['as'],'attributes':_0x5a173f['attributes'],'include':_0x5a173f[_0x92a9('0x1c')]?_['map'](_0x5a173f['include'],function(_0x5ba59a){return{'model':db[_0x5ba59a[_0x92a9('0x1e')]],'as':_0x5ba59a['as'],'attributes':_0x5ba59a[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92a9('0x22')](function(_0x370756){logger['info'](_0x92a9('0x20'),_0x289f4d);logger[_0x92a9('0x23')](_0x92a9('0x20'),_0x289f4d,JSON[_0x92a9('0x1f')](_0x370756));_0x19ef51(_0x370756);})[_0x92a9('0x13')](function(_0x199ef8){logger[_0x92a9('0xf')](_0x92a9('0x20'),_0x199ef8[_0x92a9('0x11')],_0x289f4d);_0x47c1ff(_0x23007d[_0x92a9('0xf')](0x1f4,_0x199ef8[_0x92a9('0x11')]));});});};exports[_0x92a9('0x24')]=function(_0x121bad){var _0x26d3d6=this;return new Promise(function(_0x1cfae3,_0x4d9e1d){return db['CmHopper']['create'](_0x121bad[_0x92a9('0x25')],{'raw':_0x121bad['options']?_0x121bad[_0x92a9('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x92a9('0x22')](function(_0x436a86){logger[_0x92a9('0xd')](_0x92a9('0x24'),_0x121bad);logger[_0x92a9('0x23')](_0x92a9('0x24'),_0x121bad,JSON[_0x92a9('0x1f')](_0x436a86));_0x1cfae3(_0x436a86);})['catch'](function(_0x3f48a3){logger[_0x92a9('0xf')]('CreateCmHopper',_0x3f48a3[_0x92a9('0x11')],_0x121bad);_0x4d9e1d(_0x26d3d6[_0x92a9('0xf')](0x1f4,_0x3f48a3['message']));});});};exports[_0x92a9('0x26')]=function(_0x3c5bac){var _0x337d9a=this;return new Promise(function(_0x3eb1b1,_0x53f284){return db['CmHopper'][_0x92a9('0x27')](_0x3c5bac[_0x92a9('0x25')],{'raw':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac['options']['where']||null:null,'attributes':_0x3c5bac[_0x92a9('0x17')]?_0x3c5bac[_0x92a9('0x17')]['attributes']||null:null,'limit':_0x3c5bac['options']?_0x3c5bac[_0x92a9('0x17')]['limit']||null:null})[_0x92a9('0x22')](function(_0x3df4e7){logger[_0x92a9('0xd')]('UpdateCmHopper',_0x3c5bac);logger[_0x92a9('0xd')](_0x92a9('0x28'),JSON[_0x92a9('0x1f')](_0x3c5bac[_0x92a9('0x17')][_0x92a9('0x19')]),_0x3c5bac[_0x92a9('0x25')][_0x92a9('0x29')]);logger[_0x92a9('0x23')](_0x92a9('0x26'),_0x3c5bac,JSON['stringify'](_0x3df4e7));_0x3eb1b1(_0x3df4e7);})[_0x92a9('0x13')](function(_0xb61f69){logger[_0x92a9('0xf')](_0x92a9('0x26'),_0xb61f69['message'],_0x3c5bac);_0x53f284(_0x337d9a[_0x92a9('0xf')](0x1f4,_0xb61f69[_0x92a9('0x11')]));});});};exports[_0x92a9('0x2a')]=function(_0x1f6d8d){var _0x4c45de=this;return new Promise(function(_0x2a8f38,_0xdfd0fe){return db['CmHopper'][_0x92a9('0x2b')]({'where':_0x1f6d8d[_0x92a9('0x17')]?_0x1f6d8d[_0x92a9('0x17')][_0x92a9('0x19')]||null:null})[_0x92a9('0x22')](function(_0xe5f5f8){logger[_0x92a9('0xd')](_0x92a9('0x2a'),_0x1f6d8d);logger[_0x92a9('0x23')](_0x92a9('0x2a'),_0x1f6d8d,JSON[_0x92a9('0x1f')](_0xe5f5f8));_0x2a8f38(_0xe5f5f8);})[_0x92a9('0x13')](function(_0x58274a){logger[_0x92a9('0xf')]('DestroyCmHopper',_0x58274a['message'],_0x1f6d8d);_0xdfd0fe(_0x4c45de['error'](0x1f4,_0x58274a[_0x92a9('0x11')]));});});};exports[_0x92a9('0x2c')]=function(_0x14d955){var _0x202519=this;return new Promise(function(_0x31670e,_0x3295d5){return db['CmContact'][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x26acd7){return db['sequelize'][_0x92a9('0x2e')](function(_0x232bb2){return db[_0x92a9('0x15')]['findAll']({'where':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':_0x14d955[_0x92a9('0x17')]?_0x14d955['options'][_0x92a9('0x1a')]||null:null,'limit':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')][_0x92a9('0x1b')]||null:null,'order':_0x14d955[_0x92a9('0x17')]?_0x14d955[_0x92a9('0x17')]['order']||null:null,'transaction':_0x232bb2,'lock':_0x232bb2[_0x92a9('0x2f')]['UPDATE'],'include':[{'model':db[_0x92a9('0x30')],'as':_0x92a9('0x31'),'attributes':_['keys'](_0x26acd7)},{'model':db[_0x92a9('0x32')],'as':'Agent','attributes':['id',_0x92a9('0x33'),_0x92a9('0x34')]}]})[_0x92a9('0x22')](function(_0x130a7a){var _0x2ca35b=[];var _0x794d3d=[];for(var _0x28932b=0x0;_0x28932b<_0x130a7a[_0x92a9('0x35')];_0x28932b+=0x1){var _0xa94b85=_0x130a7a[_0x28932b][_0x92a9('0x36')];if(_0xa94b85===null){_0x2ca35b[_0x92a9('0x37')](_0x130a7a[_0x28932b][_0x92a9('0x27')](_0x14d955[_0x92a9('0x25')],{'transaction':_0x232bb2}));}else if(!_0x794d3d[_0x92a9('0x38')](_0xa94b85)){_0x794d3d[_0x92a9('0x37')](_0xa94b85);_0x2ca35b[_0x92a9('0x37')](_0x130a7a[_0x28932b]['update'](_0x14d955[_0x92a9('0x25')],{'transaction':_0x232bb2}));}}return BPromise[_0x92a9('0x39')](_0x2ca35b);});})['then'](function(_0x1e3b08){logger[_0x92a9('0xd')]('GetContactDialer',_0x14d955);if(_0x1e3b08[_0x92a9('0x35')]>0x0){logger[_0x92a9('0xd')](_0x92a9('0x3a'),_0x1e3b08[0x0][_0x92a9('0x3b')]['id'],_0x1e3b08[0x0][_0x92a9('0x3b')][_0x92a9('0x3c')],_0x1e3b08[0x0][_0x92a9('0x3b')][_0x92a9('0x29')]);}logger['debug']('GetContactDialer',_0x14d955,JSON['stringify'](_0x1e3b08));_0x31670e(_0x1e3b08);})[_0x92a9('0x13')](function(_0x3ec1d2){logger[_0x92a9('0xf')](_0x92a9('0x2c'),_0x3ec1d2['message'],_0x14d955);_0x3295d5(_0x202519[_0x92a9('0xf')](0x1f4,_0x3ec1d2[_0x92a9('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x1c7600){var _0x584402=this;return new Promise(function(_0x3fac2d,_0x55aeca){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x4ba61c){return db[_0x92a9('0x3e')][_0x92a9('0x3f')](_0x1c7600[_0x92a9('0x25')],{'raw':_0x1c7600[_0x92a9('0x17')]?_0x1c7600[_0x92a9('0x17')][_0x92a9('0x18')]===undefined?!![]:![]:!![],'transaction':_0x4ba61c})['then'](function(){logger[_0x92a9('0xd')](_0x92a9('0x40'),JSON['stringify'](_0x1c7600[_0x92a9('0x17')]['where']),_0x1c7600[_0x92a9('0x17')][_0x92a9('0x19')][_0x92a9('0x29')]);return db[_0x92a9('0x15')]['destroy']({'where':_0x1c7600['options']?_0x1c7600['options'][_0x92a9('0x19')]||null:null,'transaction':_0x4ba61c});});})[_0x92a9('0x22')](function(_0x25f3f6){logger['info'](_0x92a9('0x41'),_0x1c7600);logger[_0x92a9('0x23')](_0x92a9('0x41'),_0x1c7600,JSON[_0x92a9('0x1f')](_0x25f3f6));_0x3fac2d(_0x25f3f6);})[_0x92a9('0x13')](function(_0x5c0851){logger[_0x92a9('0xf')](_0x92a9('0x41'),_0x5c0851[_0x92a9('0x11')],_0x1c7600);_0x55aeca(_0x584402['error'](0x1f4,_0x5c0851[_0x92a9('0x11')]));});});};exports[_0x92a9('0x42')]=function(_0x46847c){var _0x4704b0=this;return new Promise(function(_0x1c8804,_0x20962b){return db[_0x92a9('0x15')][_0x92a9('0x16')]({'raw':_0x46847c['options']?_0x46847c['options'][_0x92a9('0x18')]===undefined?!![]:![]:!![],'where':_0x46847c['options']?_0x46847c[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':[[db[_0x92a9('0x3d')]['fn'](_0x92a9('0x43'),db[_0x92a9('0x3d')]['fn']('IF',db[_0x92a9('0x3d')][_0x92a9('0x44')](_0x92a9('0x45')+util[_0x92a9('0x46')](_0x92a9('0x47'),moment()[_0x92a9('0x46')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x92a9('0x48')]]})[_0x92a9('0x22')](function(_0x4f05c1){logger[_0x92a9('0xd')](_0x92a9('0x42'),_0x46847c);logger[_0x92a9('0x23')]('CountReScheduled',_0x46847c,JSON[_0x92a9('0x1f')](_0x4f05c1));_0x1c8804(_0x4f05c1);})[_0x92a9('0x13')](function(_0x249375){logger[_0x92a9('0xf')]('CountReScheduled',_0x249375[_0x92a9('0x11')],_0x46847c);_0x20962b(_0x4704b0[_0x92a9('0xf')](0x1f4,_0x249375[_0x92a9('0x11')]));});});};exports[_0x92a9('0x49')]=function(_0x3e0238){var _0x341712=this;return new Promise(function(_0x167a98,_0x498ec0){return db[_0x92a9('0x30')][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x583fd4){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x4ddf93){return db['CmHopper'][_0x92a9('0x16')]({'where':_0x3e0238[_0x92a9('0x17')]?_0x3e0238['options'][_0x92a9('0x19')]||null:null,'attributes':_0x3e0238[_0x92a9('0x17')]?_0x3e0238[_0x92a9('0x17')][_0x92a9('0x1a')]||null:null,'limit':0x1,'order':_0x3e0238[_0x92a9('0x17')]?_0x3e0238[_0x92a9('0x17')][_0x92a9('0x4a')]||null:null,'group':db[_0x92a9('0x15')][_0x92a9('0x36')],'transaction':_0x4ddf93,'lock':_0x4ddf93[_0x92a9('0x2f')][_0x92a9('0x4b')],'include':_0x3e0238[_0x92a9('0x17')]?_0x3e0238['options'][_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x3e0238[_0x92a9('0x17')][_0x92a9('0x1c')],function(_0x518a44){return{'model':db[_0x518a44['model']],'as':_0x518a44['as'],'attributes':_0x518a44['attributes'],'include':_0x518a44[_0x92a9('0x1c')]?_[_0x92a9('0x1d')](_0x518a44[_0x92a9('0x1c')],function(_0x31a9ac){return{'model':db[_0x31a9ac['model']],'as':_0x31a9ac['as'],'attributes':_0x31a9ac[_0x92a9('0x1a')],'include':_0x31a9ac['include']?_[_0x92a9('0x1d')](_0x31a9ac['include'],function(_0x5c739e){return{'model':db[_0x5c739e['model']],'as':_0x5c739e['as'],'attributes':_0x5c739e[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a00d5){var _0x3f13b3=[];for(var _0x4da890=0x0;_0x4da890<_0x5a00d5['length'];_0x4da890+=0x1){_0x3f13b3['push'](_0x5a00d5[_0x4da890][_0x92a9('0x27')](_0x3e0238[_0x92a9('0x25')],{'transaction':_0x4ddf93}));}return BPromise[_0x92a9('0x39')](_0x3f13b3);});})[_0x92a9('0x22')](function(_0x1551e3){logger[_0x92a9('0xd')](_0x92a9('0x49'),_0x3e0238);logger[_0x92a9('0x23')]('GetContactRecallMe',_0x3e0238,JSON[_0x92a9('0x1f')](_0x1551e3));_0x167a98(_0x1551e3);})[_0x92a9('0x13')](function(_0xb9e570){logger[_0x92a9('0xf')](_0x92a9('0x49'),_0xb9e570['message'],_0x3e0238);_0x498ec0(_0x341712[_0x92a9('0xf')](0x1f4,_0xb9e570[_0x92a9('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x4c10fc){var _0x36ea04=this;return new Promise(function(_0x36e8fd,_0xc21038){db[_0x92a9('0x30')][_0x92a9('0x2d')]()[_0x92a9('0x22')](function(_0x3a94a4){return db[_0x92a9('0x15')]['findAll']({'raw':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')][_0x92a9('0x19')]||null:null,'attributes':_0x4c10fc['options']?_0x4c10fc[_0x92a9('0x17')]['attributes']||null:null,'limit':_0x4c10fc[_0x92a9('0x17')]?_0x4c10fc[_0x92a9('0x17')]['limit']||null:null,'include':_0x4c10fc['options']?_0x4c10fc['options']['include']?_['map'](_0x4c10fc[_0x92a9('0x17')]['include'],function(_0xc39526){return{'model':db[_0xc39526[_0x92a9('0x1e')]],'as':_0xc39526['as'],'attributes':_0xc39526['as']===_0x92a9('0x31')?_['keys'](_0x3a94a4):_0xc39526[_0x92a9('0x1a')],'include':_0xc39526['include']?_['map'](_0xc39526[_0x92a9('0x1c')],function(_0x1a2954){return{'model':db[_0x1a2954[_0x92a9('0x1e')]],'as':_0x1a2954['as'],'attributes':_0x1a2954[_0x92a9('0x1a')],'include':_0x1a2954[_0x92a9('0x1c')]?_['map'](_0x1a2954[_0x92a9('0x1c')],function(_0x3b8129){return{'model':db[_0x3b8129[_0x92a9('0x1e')]],'as':_0x3b8129['as'],'attributes':_0x3b8129[_0x92a9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x92a9('0x22')](function(_0x31db03){logger[_0x92a9('0xd')]('GetCmHopper',_0x4c10fc);logger['debug'](_0x92a9('0x14'),_0x4c10fc,JSON[_0x92a9('0x1f')](_0x31db03));_0x36e8fd(_0x31db03);})[_0x92a9('0x13')](function(_0x5d1547){logger['error'](_0x92a9('0x14'),_0x5d1547['message'],_0x4c10fc);_0xc21038(_0x36ea04[_0x92a9('0xf')](0x1f4,_0x5d1547[_0x92a9('0x11')]));});});});};exports['GetContactByPhone']=function(_0x27dcb4){var _0x59156a=this;return new Promise(function(_0x3fa2a9,_0x1e48e7){return db['CmContact'][_0x92a9('0x4c')]({'raw':!![],'where':{'phone':_0x27dcb4[_0x92a9('0x17')][_0x92a9('0x19')][_0x92a9('0x4d')]},'attributes':['id',_0x92a9('0x4e')],'order':[['id',_0x92a9('0x4f')]]})[_0x92a9('0x22')](function(_0x46a59a){logger['info']('getContactByPhone',_0x27dcb4);logger['debug'](_0x92a9('0x50'),_0x27dcb4,JSON['stringify'](_0x46a59a));_0x3fa2a9(_0x46a59a);})[_0x92a9('0x13')](function(_0x286144){logger[_0x92a9('0xf')](_0x92a9('0x50'),_0x286144['message'],_0x27dcb4);_0x1e48e7(_0x59156a[_0x92a9('0xf')](0x1f4,_0x286144[_0x92a9('0x11')]));});});};exports[_0x92a9('0x51')]=function(_0x30e850){var _0x2350c4=this;return new Promise(function(_0x340970,_0x1ed895){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x3a4ccf){return db[_0x92a9('0x15')][_0x92a9('0x27')]({'active':![]},{'where':{},'transaction':_0x3a4ccf})[_0x92a9('0x22')](function(_0x3bb7ec){logger['info']('ResetActiveCalls',_0x30e850);logger[_0x92a9('0x23')](_0x92a9('0x51'),_0x30e850,JSON['stringify'](_0x3bb7ec));_0x340970(_0x3bb7ec);})[_0x92a9('0x13')](function(_0x55f4d5){logger[_0x92a9('0xf')](_0x92a9('0x51'),_0x55f4d5['message'],_0x30e850);_0x1ed895(_0x2350c4[_0x92a9('0xf')](0x1f4,_0x55f4d5[_0x92a9('0x11')]));});});});};exports[_0x92a9('0x52')]=function(_0x408d0d){var _0x14fab9=this;var _0x2b9357=_0x408d0d[_0x92a9('0x25')][_0x92a9('0x19')][_0x92a9('0x53')];var _0x322c0a=_0x408d0d[_0x92a9('0x25')][_0x92a9('0x19')]['interval'];return new Promise(function(_0x6082f3,_0x495478){return db[_0x92a9('0x15')]['findAll']({'where':{'voiceQueueId':_0x2b9357,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x92a9('0x3d')][_0x92a9('0x44')](_0x92a9('0x54')+_0x322c0a+_0x92a9('0x55'))}},'include':[{'model':db[_0x92a9('0x30')],'as':'Contact'},{'model':db[_0x92a9('0x32')],'as':_0x92a9('0x56'),'attributes':['id',_0x92a9('0x33'),_0x92a9('0x34')]},{'model':db[_0x92a9('0x57')],'as':'List'}]})[_0x92a9('0x22')](function(_0x42a761){return db[_0x92a9('0x3d')][_0x92a9('0x2e')](function(_0x5b208c){return db[_0x92a9('0x15')][_0x92a9('0x27')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x2b9357,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x92a9('0x3d')][_0x92a9('0x44')]('NOW()\x20+\x20INTERVAL\x20'+_0x322c0a+'\x20MINUTE')}},'transaction':_0x5b208c})[_0x92a9('0x22')](function(_0xe8231d){_0x6082f3(_0x42a761);})[_0x92a9('0x13')](function(_0x23e883){logger[_0x92a9('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x23e883[_0x92a9('0x11')],_0x408d0d);_0x495478(validateExpressRequest);});});})[_0x92a9('0x13')](function(_0x52325e){logger[_0x92a9('0xf')](_0x92a9('0x52'),_0x52325e[_0x92a9('0x11')],_0x408d0d);_0x495478(_0x14fab9[_0x92a9('0xf')](0x1f4,_0x52325e[_0x92a9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 619eb4d..dcd4bb9 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 _0x4566=['express','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','show','post','create','/preview','getPreview','getTimezone','getPreviewRecall','put','/:id','update','destroy','exports','multer','connect-timeout'];(function(_0x527365,_0x36fb3a){var _0x5de073=function(_0x52a251){while(--_0x52a251){_0x527365['push'](_0x527365['shift']());}};_0x5de073(++_0x36fb3a);}(_0x4566,0x80));var _0x6456=function(_0x14ea59,_0x3f2964){_0x14ea59=_0x14ea59-0x0;var _0x3ea98a=_0x4566[_0x14ea59];return _0x3ea98a;};'use strict';var multer=require(_0x6456('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6456('0x1'));var express=require(_0x6456('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6456('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6456('0x4'));var controller=require(_0x6456('0x5'));router[_0x6456('0x6')]('/',auth[_0x6456('0x7')](),controller[_0x6456('0x8')]);router[_0x6456('0x6')](_0x6456('0x9'),auth['isAuthenticated'](),controller[_0x6456('0xa')]);router[_0x6456('0x6')]('/opencontacts',auth[_0x6456('0x7')](),controller[_0x6456('0xb')]);router[_0x6456('0x6')](_0x6456('0xc'),auth[_0x6456('0x7')](),controller[_0x6456('0xd')]);router[_0x6456('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6456('0xe')]);router[_0x6456('0xf')]('/',auth['isAuthenticated'](),controller[_0x6456('0x10')]);router['post'](_0x6456('0x11'),auth[_0x6456('0x7')](),controller[_0x6456('0x12')]);router[_0x6456('0xf')]('/timezone',auth[_0x6456('0x7')](),controller[_0x6456('0x13')]);router[_0x6456('0xf')]('/previewrecall',auth['isAuthenticated'](),controller[_0x6456('0x14')]);router[_0x6456('0x15')](_0x6456('0x16'),auth['isAuthenticated'](),controller[_0x6456('0x17')]);router['delete'](_0x6456('0x16'),auth[_0x6456('0x7')](),controller[_0x6456('0x18')]);module[_0x6456('0x19')]=router; \ No newline at end of file +var _0xdc50=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','get','/timezones','getTimezones','/:id','create','post','getPreview','/timezone','getTimezone','getPreviewRecall','put','update','destroy'];(function(_0x5d19f8,_0x56a7bb){var _0x42e896=function(_0x15d7c6){while(--_0x15d7c6){_0x5d19f8['push'](_0x5d19f8['shift']());}};_0x42e896(++_0x56a7bb);}(_0xdc50,0xb5));var _0x0dc5=function(_0x3fdea2,_0x5499bf){_0x3fdea2=_0x3fdea2-0x0;var _0x596ae3=_0xdc50[_0x3fdea2];return _0x596ae3;};'use strict';var multer=require(_0x0dc5('0x0'));var util=require(_0x0dc5('0x1'));var path=require(_0x0dc5('0x2'));var timeout=require(_0x0dc5('0x3'));var express=require(_0x0dc5('0x4'));var router=express[_0x0dc5('0x5')]();var fs_extra=require(_0x0dc5('0x6'));var auth=require(_0x0dc5('0x7'));var interaction=require(_0x0dc5('0x8'));var config=require('../../config/environment');var controller=require(_0x0dc5('0x9'));router['get']('/',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0xb')]);router['get'](_0x0dc5('0xc'),auth['isAuthenticated'](),controller[_0x0dc5('0xd')]);router['get'](_0x0dc5('0xe'),auth['isAuthenticated'](),controller[_0x0dc5('0xf')]);router[_0x0dc5('0x10')](_0x0dc5('0x11'),auth['isAuthenticated'](),controller[_0x0dc5('0x12')]);router[_0x0dc5('0x10')](_0x0dc5('0x13'),auth[_0x0dc5('0xa')](),controller['show']);router['post']('/',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x14')]);router[_0x0dc5('0x15')]('/preview',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x16')]);router['post'](_0x0dc5('0x17'),auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x18')]);router[_0x0dc5('0x15')]('/previewrecall',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x19')]);router[_0x0dc5('0x1a')]('/:id',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x1b')]);router['delete']('/:id',auth[_0x0dc5('0xa')](),controller[_0x0dc5('0x1c')]);module[_0x0dc5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5a810e0..7e6cb07 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 _0x4e83=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x1161c8,_0x461403){var _0x3eb954=function(_0x1e8a13){while(--_0x1e8a13){_0x1161c8['push'](_0x1161c8['shift']());}};_0x3eb954(++_0x461403);}(_0x4e83,0x1ae));var _0x34e8=function(_0x5a7d7c,_0x9ae68a){_0x5a7d7c=_0x5a7d7c-0x0;var _0x239238=_0x4e83[_0x5a7d7c];return _0x239238;};'use strict';var moment=require(_0x34e8('0x0'));var Sequelize=require('sequelize');module[_0x34e8('0x1')]={'phone':{'type':Sequelize[_0x34e8('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x34e8('0x3')],'unique':_0x34e8('0x4')},'ListId':{'type':Sequelize[_0x34e8('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x723e=['INTEGER','contactListQueue','sequelize','exports','STRING'];(function(_0x44d146,_0x942e69){var _0x12c747=function(_0x2927a2){while(--_0x2927a2){_0x44d146['push'](_0x44d146['shift']());}};_0x12c747(++_0x942e69);}(_0x723e,0x179));var _0xe723=function(_0x1e7634,_0x37d8e2){_0x1e7634=_0x1e7634-0x0;var _0x50a829=_0x723e[_0x1e7634];return _0x50a829;};'use strict';var moment=require('moment');var Sequelize=require(_0xe723('0x0'));module[_0xe723('0x1')]={'phone':{'type':Sequelize[_0xe723('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')},'ListId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')},'VoiceQueueId':{'type':Sequelize[_0xe723('0x3')],'unique':_0xe723('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9d1d47d..7b1fcea 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 _0x17b9=['fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x17b9,0xd6));var _0x917b=function(_0x27d40a,_0x4dc77f){_0x27d40a=_0x27d40a-0x0;var _0x2fda64=_0x17b9[_0x27d40a];return _0x2fda64;};'use strict';var emlformat=require(_0x917b('0x0'));var rimraf=require(_0x917b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x917b('0x2'));var rp=require(_0x917b('0x3'));var moment=require(_0x917b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x917b('0x5'));var util=require('util');var path=require(_0x917b('0x6'));var sox=require(_0x917b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x917b('0x8'));var _=require(_0x917b('0x9'));var squel=require(_0x917b('0xa'));var crypto=require(_0x917b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x917b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x917b('0xd'));var Redis=require(_0x917b('0xe'));var authService=require(_0x917b('0xf'));var qs=require(_0x917b('0x10'));var as=require(_0x917b('0x11'));var hardwareService=require(_0x917b('0x12'));var logger=require(_0x917b('0x13'))(_0x917b('0x14'));var utils=require(_0x917b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x917b('0x16'));var db=require(_0x917b('0x17'))['db'];function respondWithStatusCode(_0xe9c3e6,_0x42a0b9){_0x42a0b9=_0x42a0b9||0xcc;return function(_0x21b00f){if(_0x21b00f){return _0xe9c3e6['sendStatus'](_0x42a0b9);}return _0xe9c3e6['status'](_0x42a0b9)[_0x917b('0x18')]();};}function respondWithResult(_0x45739e,_0x42b65f){_0x42b65f=_0x42b65f||0xc8;return function(_0x3d10b9){if(_0x3d10b9){return _0x45739e[_0x917b('0x19')](_0x42b65f)['json'](_0x3d10b9);}};}function respondWithFilteredResult(_0x4c0918,_0xabf60a){return function(_0x4196cd){if(_0x4196cd){var _0x513cee=typeof _0xabf60a[_0x917b('0x1a')]===_0x917b('0x1b')&&typeof _0xabf60a[_0x917b('0x1c')]===_0x917b('0x1b');var _0xfa7a40=_0x4196cd[_0x917b('0x1d')];var _0x31a179=_0x513cee?0x0:_0xabf60a[_0x917b('0x1a')];var _0x287c27=_0x513cee?_0x4196cd['count']:_0xabf60a[_0x917b('0x1a')]+_0xabf60a['limit'];var _0x3616ff;if(_0x287c27>=_0xfa7a40){_0x287c27=_0xfa7a40;_0x3616ff=0xc8;}else{_0x3616ff=0xce;}_0x4c0918[_0x917b('0x19')](_0x3616ff);return _0x4c0918[_0x917b('0x1e')](_0x917b('0x1f'),_0x31a179+'-'+_0x287c27+'/'+_0xfa7a40)['json'](_0x4196cd);}return null;};}function patchUpdates(_0x5055d0){return function(_0x1e8141){try{jsonpatch[_0x917b('0x20')](_0x1e8141,_0x5055d0,!![]);}catch(_0x22f0fb){return BPromise[_0x917b('0x21')](_0x22f0fb);}return _0x1e8141[_0x917b('0x22')]();};}function saveUpdates(_0x4572d9,_0x3b1bdd){return function(_0x3462d7){if(_0x3462d7){return _0x3462d7[_0x917b('0x23')](_0x4572d9)[_0x917b('0x24')](function(_0x2733fc){return _0x2733fc;});}return null;};}function removeEntity(_0x5d709f,_0x8d811e){return function(_0x1864d1){if(_0x1864d1){return _0x1864d1['destroy']()[_0x917b('0x24')](function(){_0x5d709f[_0x917b('0x19')](0xcc)[_0x917b('0x18')]();});}};}function handleEntityNotFound(_0x2db729,_0x58c27c){return function(_0x19aca3){if(!_0x19aca3){_0x2db729[_0x917b('0x25')](0x194);}return _0x19aca3;};}function handleError(_0x53a624,_0x36a5a4){_0x36a5a4=_0x36a5a4||0x1f4;return function(_0x1818fa){logger[_0x917b('0x26')](_0x1818fa['stack']);if(_0x1818fa[_0x917b('0x27')]){delete _0x1818fa[_0x917b('0x27')];}_0x53a624[_0x917b('0x19')](_0x36a5a4)[_0x917b('0x28')](_0x1818fa);};}exports[_0x917b('0x29')]=function(_0x3103f0,_0x212291){var _0xaeefb5={},_0x2a2d69={},_0x7dc09a={'count':0x0,'rows':[]};var _0x3e53d6=_['map'](db[_0x917b('0x2a')][_0x917b('0x2b')],function(_0x442bb2){return{'name':_0x442bb2[_0x917b('0x2c')],'type':_0x442bb2[_0x917b('0x2d')][_0x917b('0x2e')]};});_0x2a2d69[_0x917b('0x2f')]=_[_0x917b('0x30')](_0x3e53d6,'name');_0x2a2d69[_0x917b('0x31')]=_[_0x917b('0x32')](_0x3103f0[_0x917b('0x31')]);_0x2a2d69[_0x917b('0x33')]=_['intersection'](_0x2a2d69[_0x917b('0x2f')],_0x2a2d69['query']);_0xaeefb5['attributes']=_[_0x917b('0x34')](_0x2a2d69[_0x917b('0x2f')],qs[_0x917b('0x35')](_0x3103f0[_0x917b('0x31')][_0x917b('0x35')]));_0xaeefb5[_0x917b('0x36')]=_0xaeefb5[_0x917b('0x36')][_0x917b('0x37')]?_0xaeefb5[_0x917b('0x36')]:_0x2a2d69[_0x917b('0x2f')];if(!_0x3103f0['query'][_0x917b('0x38')](_0x917b('0x39'))){_0xaeefb5[_0x917b('0x1c')]=qs[_0x917b('0x1c')](_0x3103f0[_0x917b('0x31')][_0x917b('0x1c')]);_0xaeefb5[_0x917b('0x1a')]=qs[_0x917b('0x1a')](_0x3103f0[_0x917b('0x31')][_0x917b('0x1a')]);}_0xaeefb5['order']=qs[_0x917b('0x3a')](_0x3103f0[_0x917b('0x31')][_0x917b('0x3a')]);_0xaeefb5[_0x917b('0x3b')]=qs[_0x917b('0x33')](_[_0x917b('0x3c')](_0x3103f0[_0x917b('0x31')],_0x2a2d69[_0x917b('0x33')]),_0x3e53d6);if(_0x3103f0[_0x917b('0x31')][_0x917b('0x3d')]){_0xaeefb5[_0x917b('0x3b')]=_['merge'](_0xaeefb5[_0x917b('0x3b')],{'$or':_[_0x917b('0x30')](_0x3e53d6,function(_0x1b6246){if(_0x1b6246[_0x917b('0x2d')]!==_0x917b('0x3e')){var _0x1570a0={};_0x1570a0[_0x1b6246[_0x917b('0x27')]]={'$like':'%'+_0x3103f0[_0x917b('0x31')][_0x917b('0x3d')]+'%'};return _0x1570a0;}})});}_0xaeefb5=_[_0x917b('0x3f')]({},_0xaeefb5,_0x3103f0[_0x917b('0x40')]);var _0x57462a={'where':_0xaeefb5[_0x917b('0x3b')]};return db[_0x917b('0x2a')]['count'](_0x57462a)[_0x917b('0x24')](function(_0x2757ed){_0x7dc09a['count']=_0x2757ed;if(_0x3103f0[_0x917b('0x31')][_0x917b('0x41')]){_0xaeefb5['include']=[{'all':!![]}];}return db[_0x917b('0x2a')]['findAll'](_0xaeefb5);})[_0x917b('0x24')](function(_0x2e5d67){_0x7dc09a[_0x917b('0x42')]=_0x2e5d67;return _0x7dc09a;})[_0x917b('0x24')](respondWithFilteredResult(_0x212291,_0xaeefb5))[_0x917b('0x43')](handleError(_0x212291,null));};exports['show']=function(_0x500c14,_0x770eae){var _0x5b8d69={'raw':!![],'where':{'id':_0x500c14[_0x917b('0x44')]['id']}},_0x59c2ef={};_0x59c2ef[_0x917b('0x2f')]=_[_0x917b('0x32')](db[_0x917b('0x2a')][_0x917b('0x2b')]);_0x59c2ef['query']=_[_0x917b('0x32')](_0x500c14[_0x917b('0x31')]);_0x59c2ef[_0x917b('0x33')]=_[_0x917b('0x34')](_0x59c2ef['model'],_0x59c2ef[_0x917b('0x31')]);_0x5b8d69[_0x917b('0x36')]=_['intersection'](_0x59c2ef['model'],qs[_0x917b('0x35')](_0x500c14[_0x917b('0x31')]['fields']));_0x5b8d69[_0x917b('0x36')]=_0x5b8d69['attributes'][_0x917b('0x37')]?_0x5b8d69[_0x917b('0x36')]:_0x59c2ef[_0x917b('0x2f')];if(_0x500c14[_0x917b('0x31')][_0x917b('0x41')]){_0x5b8d69[_0x917b('0x45')]=[{'all':!![]}];}_0x5b8d69=_[_0x917b('0x3f')]({},_0x5b8d69,_0x500c14[_0x917b('0x40')]);return db['CmHopperBlack'][_0x917b('0x46')](_0x5b8d69)['then'](handleEntityNotFound(_0x770eae,null))[_0x917b('0x24')](respondWithResult(_0x770eae,null))[_0x917b('0x43')](handleError(_0x770eae,null));};exports[_0x917b('0x23')]=function(_0x4b7d3d,_0x244a11){if(_0x4b7d3d[_0x917b('0x47')]['id']){delete _0x4b7d3d[_0x917b('0x47')]['id'];}return db[_0x917b('0x2a')][_0x917b('0x46')]({'where':{'id':_0x4b7d3d[_0x917b('0x44')]['id']}})['then'](handleEntityNotFound(_0x244a11,null))[_0x917b('0x24')](saveUpdates(_0x4b7d3d[_0x917b('0x47')],null))[_0x917b('0x24')](respondWithResult(_0x244a11,null))[_0x917b('0x43')](handleError(_0x244a11,null));};exports[_0x917b('0x48')]=function(_0x56daca,_0xd058a3){return db['CmHopperBlack'][_0x917b('0x46')]({'where':{'id':_0x56daca['params']['id']}})[_0x917b('0x24')](handleEntityNotFound(_0xd058a3,null))[_0x917b('0x24')](removeEntity(_0xd058a3,null))[_0x917b('0x43')](handleError(_0xd058a3,null));};exports[_0x917b('0x49')]=function(_0x381c7b,_0xe62e62){return db['CmHopperBlack'][_0x917b('0x49')]()['then'](respondWithResult(_0xe62e62,null))['catch'](handleError(_0xe62e62,null));}; \ No newline at end of file +var _0x689f=['squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','offset','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','CmHopperBlack','include','findAll','catch','show','fields','find','update','body','params','describe','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra'];(function(_0x32edf6,_0x699bf0){var _0x3d6297=function(_0x4ea160){while(--_0x4ea160){_0x32edf6['push'](_0x32edf6['shift']());}};_0x3d6297(++_0x699bf0);}(_0x689f,0x81));var _0xf689=function(_0x56dbe5,_0x57fa97){_0x56dbe5=_0x56dbe5-0x0;var _0x47009d=_0x689f[_0x56dbe5];return _0x47009d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf689('0x0'));var rp=require(_0xf689('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf689('0x2'));var util=require('util');var path=require(_0xf689('0x3'));var sox=require('sox');var csv=require(_0xf689('0x4'));var ejs=require(_0xf689('0x5'));var fs=require('fs');var fs_extra=require(_0xf689('0x6'));var _=require('lodash');var squel=require(_0xf689('0x7'));var crypto=require(_0xf689('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xf689('0x9'));var toCsv=require(_0xf689('0x4'));var querystring=require('querystring');var Papa=require(_0xf689('0xa'));var Redis=require(_0xf689('0xb'));var authService=require(_0xf689('0xc'));var qs=require(_0xf689('0xd'));var as=require(_0xf689('0xe'));var hardwareService=require(_0xf689('0xf'));var logger=require(_0xf689('0x10'))('api');var utils=require(_0xf689('0x11'));var config=require(_0xf689('0x12'));var licenseUtil=require(_0xf689('0x13'));var db=require(_0xf689('0x14'))['db'];function respondWithStatusCode(_0x2c7e72,_0x462bf7){_0x462bf7=_0x462bf7||0xcc;return function(_0x1f1a54){if(_0x1f1a54){return _0x2c7e72[_0xf689('0x15')](_0x462bf7);}return _0x2c7e72[_0xf689('0x16')](_0x462bf7)['end']();};}function respondWithResult(_0x1ea3f2,_0x25f0aa){_0x25f0aa=_0x25f0aa||0xc8;return function(_0x3cd379){if(_0x3cd379){return _0x1ea3f2[_0xf689('0x16')](_0x25f0aa)['json'](_0x3cd379);}};}function respondWithFilteredResult(_0x27e485,_0x125b5e){return function(_0xd01a52){if(_0xd01a52){var _0x2f0c9f=typeof _0x125b5e['offset']===_0xf689('0x17')&&typeof _0x125b5e['limit']===_0xf689('0x17');var _0x2960c7=_0xd01a52['count'];var _0x4f730d=_0x2f0c9f?0x0:_0x125b5e[_0xf689('0x18')];var _0x195d50=_0x2f0c9f?_0xd01a52[_0xf689('0x19')]:_0x125b5e[_0xf689('0x18')]+_0x125b5e['limit'];var _0x678a5a;if(_0x195d50>=_0x2960c7){_0x195d50=_0x2960c7;_0x678a5a=0xc8;}else{_0x678a5a=0xce;}_0x27e485[_0xf689('0x16')](_0x678a5a);return _0x27e485[_0xf689('0x1a')](_0xf689('0x1b'),_0x4f730d+'-'+_0x195d50+'/'+_0x2960c7)[_0xf689('0x1c')](_0xd01a52);}return null;};}function patchUpdates(_0x33464a){return function(_0x5503ed){try{jsonpatch[_0xf689('0x1d')](_0x5503ed,_0x33464a,!![]);}catch(_0x1fbdbf){return BPromise[_0xf689('0x1e')](_0x1fbdbf);}return _0x5503ed[_0xf689('0x1f')]();};}function saveUpdates(_0x3f2f1f,_0xec4872){return function(_0x208914){if(_0x208914){return _0x208914['update'](_0x3f2f1f)[_0xf689('0x20')](function(_0x5a3058){return _0x5a3058;});}return null;};}function removeEntity(_0x4a1758,_0x578c4c){return function(_0x59b436){if(_0x59b436){return _0x59b436[_0xf689('0x21')]()[_0xf689('0x20')](function(){_0x4a1758['status'](0xcc)[_0xf689('0x22')]();});}};}function handleEntityNotFound(_0xdf14ca,_0x266960){return function(_0x59d563){if(!_0x59d563){_0xdf14ca[_0xf689('0x15')](0x194);}return _0x59d563;};}function handleError(_0x399fd6,_0x604c8e){_0x604c8e=_0x604c8e||0x1f4;return function(_0x413ea8){logger[_0xf689('0x23')](_0x413ea8[_0xf689('0x24')]);if(_0x413ea8[_0xf689('0x25')]){delete _0x413ea8[_0xf689('0x25')];}_0x399fd6[_0xf689('0x16')](_0x604c8e)[_0xf689('0x26')](_0x413ea8);};}exports['index']=function(_0x43a1f4,_0x4d68d8){var _0x4e60ed={},_0x5a3e8f={},_0xebc372={'count':0x0,'rows':[]};var _0x75f007=_[_0xf689('0x27')](db['CmHopperBlack'][_0xf689('0x28')],function(_0x539a86){return{'name':_0x539a86['fieldName'],'type':_0x539a86['type'][_0xf689('0x29')]};});_0x5a3e8f['model']=_[_0xf689('0x27')](_0x75f007,_0xf689('0x25'));_0x5a3e8f[_0xf689('0x2a')]=_[_0xf689('0x2b')](_0x43a1f4[_0xf689('0x2a')]);_0x5a3e8f[_0xf689('0x2c')]=_[_0xf689('0x2d')](_0x5a3e8f[_0xf689('0x2e')],_0x5a3e8f['query']);_0x4e60ed['attributes']=_[_0xf689('0x2d')](_0x5a3e8f['model'],qs['fields'](_0x43a1f4[_0xf689('0x2a')]['fields']));_0x4e60ed[_0xf689('0x2f')]=_0x4e60ed['attributes'][_0xf689('0x30')]?_0x4e60ed['attributes']:_0x5a3e8f['model'];if(!_0x43a1f4[_0xf689('0x2a')][_0xf689('0x31')](_0xf689('0x32'))){_0x4e60ed[_0xf689('0x33')]=qs['limit'](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x33')]);_0x4e60ed['offset']=qs[_0xf689('0x18')](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x18')]);}_0x4e60ed['order']=qs[_0xf689('0x34')](_0x43a1f4[_0xf689('0x2a')][_0xf689('0x34')]);_0x4e60ed[_0xf689('0x35')]=qs['filters'](_['pick'](_0x43a1f4[_0xf689('0x2a')],_0x5a3e8f['filters']),_0x75f007);if(_0x43a1f4[_0xf689('0x2a')][_0xf689('0x36')]){_0x4e60ed[_0xf689('0x35')]=_[_0xf689('0x37')](_0x4e60ed[_0xf689('0x35')],{'$or':_[_0xf689('0x27')](_0x75f007,function(_0x49575a){if(_0x49575a['type']!=='VIRTUAL'){var _0x50014f={};_0x50014f[_0x49575a['name']]={'$like':'%'+_0x43a1f4[_0xf689('0x2a')][_0xf689('0x36')]+'%'};return _0x50014f;}})});}_0x4e60ed=_['merge']({},_0x4e60ed,_0x43a1f4[_0xf689('0x38')]);var _0x2b8eb4={'where':_0x4e60ed[_0xf689('0x35')]};return db[_0xf689('0x39')][_0xf689('0x19')](_0x2b8eb4)[_0xf689('0x20')](function(_0x160a5c){_0xebc372[_0xf689('0x19')]=_0x160a5c;if(_0x43a1f4[_0xf689('0x2a')]['includeAll']){_0x4e60ed[_0xf689('0x3a')]=[{'all':!![]}];}return db[_0xf689('0x39')][_0xf689('0x3b')](_0x4e60ed);})['then'](function(_0x179849){_0xebc372['rows']=_0x179849;return _0xebc372;})['then'](respondWithFilteredResult(_0x4d68d8,_0x4e60ed))[_0xf689('0x3c')](handleError(_0x4d68d8,null));};exports[_0xf689('0x3d')]=function(_0x54bfa6,_0xfe048c){var _0x1d76c0={'raw':!![],'where':{'id':_0x54bfa6['params']['id']}},_0x448155={};_0x448155['model']=_['keys'](db[_0xf689('0x39')][_0xf689('0x28')]);_0x448155[_0xf689('0x2a')]=_[_0xf689('0x2b')](_0x54bfa6['query']);_0x448155['filters']=_['intersection'](_0x448155['model'],_0x448155['query']);_0x1d76c0[_0xf689('0x2f')]=_[_0xf689('0x2d')](_0x448155[_0xf689('0x2e')],qs[_0xf689('0x3e')](_0x54bfa6['query'][_0xf689('0x3e')]));_0x1d76c0[_0xf689('0x2f')]=_0x1d76c0[_0xf689('0x2f')][_0xf689('0x30')]?_0x1d76c0[_0xf689('0x2f')]:_0x448155['model'];if(_0x54bfa6[_0xf689('0x2a')]['includeAll']){_0x1d76c0['include']=[{'all':!![]}];}_0x1d76c0=_[_0xf689('0x37')]({},_0x1d76c0,_0x54bfa6[_0xf689('0x38')]);return db[_0xf689('0x39')][_0xf689('0x3f')](_0x1d76c0)['then'](handleEntityNotFound(_0xfe048c,null))[_0xf689('0x20')](respondWithResult(_0xfe048c,null))[_0xf689('0x3c')](handleError(_0xfe048c,null));};exports[_0xf689('0x40')]=function(_0x39f512,_0x49a0ac){if(_0x39f512[_0xf689('0x41')]['id']){delete _0x39f512[_0xf689('0x41')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x39f512['params']['id']}})[_0xf689('0x20')](handleEntityNotFound(_0x49a0ac,null))['then'](saveUpdates(_0x39f512[_0xf689('0x41')],null))['then'](respondWithResult(_0x49a0ac,null))[_0xf689('0x3c')](handleError(_0x49a0ac,null));};exports[_0xf689('0x21')]=function(_0x4ba793,_0x3d3240){return db[_0xf689('0x39')][_0xf689('0x3f')]({'where':{'id':_0x4ba793[_0xf689('0x42')]['id']}})[_0xf689('0x20')](handleEntityNotFound(_0x3d3240,null))[_0xf689('0x20')](removeEntity(_0x3d3240,null))[_0xf689('0x3c')](handleError(_0x3d3240,null));};exports[_0xf689('0x43')]=function(_0x24dc9f,_0x4f4719){return db[_0xf689('0x39')][_0xf689('0x43')]()[_0xf689('0x20')](respondWithResult(_0x4f4719,null))['catch'](handleError(_0x4f4719,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index efc4da9..2853462 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 _0x5de2=['bluebird','request-promise','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','util','api','moment'];(function(_0x3f8667,_0x526ac1){var _0x413586=function(_0x5b4a70){while(--_0x5b4a70){_0x3f8667['push'](_0x3f8667['shift']());}};_0x413586(++_0x526ac1);}(_0x5de2,0x9f));var _0x25de=function(_0x4b96bb,_0x273d86){_0x4b96bb=_0x4b96bb-0x0;var _0x5e309b=_0x5de2[_0x4b96bb];return _0x5e309b;};'use strict';var _=require('lodash');var util=require(_0x25de('0x0'));var logger=require('../../config/logger')(_0x25de('0x1'));var moment=require(_0x25de('0x2'));var BPromise=require(_0x25de('0x3'));var rp=require(_0x25de('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25de('0x5'));var attributes=require(_0x25de('0x6'));module['exports']=function(_0x710197,_0x3bc7c2){return _0x710197['define'](_0x25de('0x7'),attributes,{'tableName':_0x25de('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9203=['api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','lodash','../../config/logger'];(function(_0x1353bc,_0x432b07){var _0x3097a6=function(_0x1ab3c2){while(--_0x1ab3c2){_0x1353bc['push'](_0x1353bc['shift']());}};_0x3097a6(++_0x432b07);}(_0x9203,0x115));var _0x3920=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0x9203[_0x54b2b0];return _0x1a0d6b;};'use strict';var _=require(_0x3920('0x0'));var util=require('util');var logger=require(_0x3920('0x1'))(_0x3920('0x2'));var moment=require('moment');var BPromise=require(_0x3920('0x3'));var rp=require(_0x3920('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3920('0x5'));var config=require(_0x3920('0x6'));var attributes=require(_0x3920('0x7'));module['exports']=function(_0x144fa3,_0x565d72){return _0x144fa3['define'](_0x3920('0x8'),attributes,{'tableName':'cm_hopper_black','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 7adddf0..d924dd8 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 _0x8004=['jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','options','limit','map','include','model','attributes','info','catch','UpdateCmHopperBlack','update','body','raw','where','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8004,0x98));var _0x4800=function(_0x1c607d,_0x1c8659){_0x1c607d=_0x1c607d-0x0;var _0x13b001=_0x8004[_0x1c607d];return _0x13b001;};'use strict';var _=require(_0x4800('0x0'));var util=require(_0x4800('0x1'));var moment=require('moment');var BPromise=require(_0x4800('0x2'));var rs=require(_0x4800('0x3'));var fs=require('fs');var Redis=require(_0x4800('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4800('0x5'));var logger=require(_0x4800('0x6'))(_0x4800('0x7'));var config=require('../../config/environment');var jayson=require(_0x4800('0x8'));var client=jayson[_0x4800('0x9')][_0x4800('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6f67,_0x4f1211,_0xc85940){return new BPromise(function(_0x223896,_0x173992){return client[_0x4800('0xb')](_0x4f6f67,_0xc85940)[_0x4800('0xc')](function(_0x5e18e8){logger['info'](_0x4800('0xd'),_0x4f1211,'request\x20sent');logger[_0x4800('0xe')](_0x4800('0xf'),_0x4f1211,'request\x20sent',JSON[_0x4800('0x10')](_0x5e18e8));if(_0x5e18e8[_0x4800('0x11')]){if(_0x5e18e8['error'][_0x4800('0x12')]===0x1f4){logger[_0x4800('0x11')](_0x4800('0xd'),_0x4f1211,_0x5e18e8[_0x4800('0x11')][_0x4800('0x13')]);return _0x173992(_0x5e18e8[_0x4800('0x11')][_0x4800('0x13')]);}logger[_0x4800('0x11')](_0x4800('0xd'),_0x4f1211,_0x5e18e8[_0x4800('0x11')][_0x4800('0x13')]);return _0x223896(_0x5e18e8[_0x4800('0x11')][_0x4800('0x13')]);}else{logger['info'](_0x4800('0xd'),_0x4f1211,_0x4800('0x14'));_0x223896(_0x5e18e8[_0x4800('0x15')]['message']);}})['catch'](function(_0x1da98e){logger[_0x4800('0x11')](_0x4800('0xd'),_0x4f1211,_0x1da98e);_0x173992(_0x1da98e);});});}exports[_0x4800('0x16')]=function(_0x308b01){var _0x2e4d73=this;return new Promise(function(_0x5ece1c,_0x100562){return db[_0x4800('0x17')][_0x4800('0x18')]({'raw':_0x308b01[_0x4800('0x19')]?_0x308b01[_0x4800('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x308b01[_0x4800('0x19')]?_0x308b01[_0x4800('0x19')]['where']||null:null,'attributes':_0x308b01[_0x4800('0x19')]?_0x308b01[_0x4800('0x19')]['attributes']||null:null,'limit':_0x308b01[_0x4800('0x19')]?_0x308b01[_0x4800('0x19')][_0x4800('0x1a')]||null:null,'include':_0x308b01[_0x4800('0x19')]?_0x308b01[_0x4800('0x19')]['include']?_[_0x4800('0x1b')](_0x308b01['options'][_0x4800('0x1c')],function(_0x1ac96b){return{'model':db[_0x1ac96b['model']],'as':_0x1ac96b['as'],'attributes':_0x1ac96b['attributes'],'include':_0x1ac96b['include']?_['map'](_0x1ac96b[_0x4800('0x1c')],function(_0x3ee0bc){return{'model':db[_0x3ee0bc[_0x4800('0x1d')]],'as':_0x3ee0bc['as'],'attributes':_0x3ee0bc[_0x4800('0x1e')],'include':_0x3ee0bc[_0x4800('0x1c')]?_[_0x4800('0x1b')](_0x3ee0bc['include'],function(_0x15d5d7){return{'model':db[_0x15d5d7['model']],'as':_0x15d5d7['as'],'attributes':_0x15d5d7[_0x4800('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x328a57){logger[_0x4800('0x1f')]('GetCmHopperBlack',_0x308b01);logger[_0x4800('0xe')](_0x4800('0x16'),_0x308b01,JSON[_0x4800('0x10')](_0x328a57));_0x5ece1c(_0x328a57);})[_0x4800('0x20')](function(_0x28fb38){logger[_0x4800('0x11')]('GetCmHopperBlack',_0x28fb38['message'],_0x308b01);_0x100562(_0x2e4d73[_0x4800('0x11')](0x1f4,_0x28fb38[_0x4800('0x13')]));});});};exports[_0x4800('0x21')]=function(_0x2c8681){var _0x524bc6=this;return new Promise(function(_0x2ef3f5,_0x2b0f33){return db[_0x4800('0x17')][_0x4800('0x22')](_0x2c8681[_0x4800('0x23')],{'raw':_0x2c8681[_0x4800('0x19')]?_0x2c8681['options'][_0x4800('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c8681['options']?_0x2c8681['options'][_0x4800('0x25')]||null:null,'attributes':_0x2c8681[_0x4800('0x19')]?_0x2c8681[_0x4800('0x19')][_0x4800('0x1e')]||null:null,'limit':_0x2c8681['options']?_0x2c8681[_0x4800('0x19')][_0x4800('0x1a')]||null:null})[_0x4800('0xc')](function(_0x448feb){logger[_0x4800('0x1f')](_0x4800('0x21'),_0x2c8681);logger[_0x4800('0xe')](_0x4800('0x21'),_0x2c8681,JSON[_0x4800('0x10')](_0x448feb));_0x2ef3f5(_0x448feb);})[_0x4800('0x20')](function(_0x11d6d2){logger[_0x4800('0x11')](_0x4800('0x21'),_0x11d6d2[_0x4800('0x13')],_0x2c8681);_0x2b0f33(_0x524bc6[_0x4800('0x11')](0x1f4,_0x11d6d2['message']));});});};exports[_0x4800('0x26')]=function(_0x45b1ab){var _0x37dabc=this;return new Promise(function(_0x5cac45,_0x527d04){return db[_0x4800('0x17')][_0x4800('0x27')]({'where':_0x45b1ab[_0x4800('0x19')]?_0x45b1ab[_0x4800('0x19')][_0x4800('0x25')]||null:null})[_0x4800('0xc')](function(_0x454d56){logger[_0x4800('0x1f')](_0x4800('0x26'),_0x45b1ab);logger[_0x4800('0xe')](_0x4800('0x26'),_0x45b1ab,JSON['stringify'](_0x454d56));_0x5cac45(_0x454d56);})['catch'](function(_0x1b62ea){logger[_0x4800('0x11')](_0x4800('0x26'),_0x1b62ea[_0x4800('0x13')],_0x45b1ab);_0x527d04(_0x37dabc[_0x4800('0x11')](0x1f4,_0x1b62ea[_0x4800('0x13')]));});});}; \ No newline at end of file +var _0x0c48=['GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x9d930d,_0x1fa969){var _0x3993e9=function(_0x300a11){while(--_0x300a11){_0x9d930d['push'](_0x9d930d['shift']());}};_0x3993e9(++_0x1fa969);}(_0x0c48,0x1d9));var _0x80c4=function(_0x41ea56,_0x56e108){_0x41ea56=_0x41ea56-0x0;var _0x184e8d=_0x0c48[_0x41ea56];return _0x184e8d;};'use strict';var _=require('lodash');var util=require(_0x80c4('0x0'));var moment=require('moment');var BPromise=require(_0x80c4('0x1'));var rs=require(_0x80c4('0x2'));var fs=require('fs');var Redis=require(_0x80c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x80c4('0x4'));var logger=require(_0x80c4('0x5'))(_0x80c4('0x6'));var config=require(_0x80c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x80c4('0x8')][_0x80c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7979c1,_0x2882ae,_0x1888af){return new BPromise(function(_0x3e1ea9,_0x2220cb){return client['request'](_0x7979c1,_0x1888af)['then'](function(_0x5b531a){logger[_0x80c4('0xa')](_0x80c4('0xb'),_0x2882ae,_0x80c4('0xc'));logger[_0x80c4('0xd')](_0x80c4('0xe'),_0x2882ae,'request\x20sent',JSON[_0x80c4('0xf')](_0x5b531a));if(_0x5b531a[_0x80c4('0x10')]){if(_0x5b531a[_0x80c4('0x10')][_0x80c4('0x11')]===0x1f4){logger[_0x80c4('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x2882ae,_0x5b531a[_0x80c4('0x10')][_0x80c4('0x12')]);return _0x2220cb(_0x5b531a['error'][_0x80c4('0x12')]);}logger[_0x80c4('0x10')](_0x80c4('0xb'),_0x2882ae,_0x5b531a[_0x80c4('0x10')][_0x80c4('0x12')]);return _0x3e1ea9(_0x5b531a['error']['message']);}else{logger[_0x80c4('0xa')](_0x80c4('0xb'),_0x2882ae,'request\x20sent');_0x3e1ea9(_0x5b531a[_0x80c4('0x13')][_0x80c4('0x12')]);}})[_0x80c4('0x14')](function(_0x54bfd7){logger[_0x80c4('0x10')](_0x80c4('0xb'),_0x2882ae,_0x54bfd7);_0x2220cb(_0x54bfd7);});});}exports[_0x80c4('0x15')]=function(_0x3f189c){var _0x21b945=this;return new Promise(function(_0x2aaf54,_0x369b58){return db['CmHopperBlack'][_0x80c4('0x16')]({'raw':_0x3f189c[_0x80c4('0x17')]?_0x3f189c['options'][_0x80c4('0x18')]===undefined?!![]:![]:!![],'where':_0x3f189c['options']?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x19')]||null:null,'attributes':_0x3f189c[_0x80c4('0x17')]?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x1a')]||null:null,'limit':_0x3f189c[_0x80c4('0x17')]?_0x3f189c[_0x80c4('0x17')][_0x80c4('0x1b')]||null:null,'include':_0x3f189c[_0x80c4('0x17')]?_0x3f189c['options'][_0x80c4('0x1c')]?_['map'](_0x3f189c[_0x80c4('0x17')]['include'],function(_0x53870f){return{'model':db[_0x53870f[_0x80c4('0x1d')]],'as':_0x53870f['as'],'attributes':_0x53870f['attributes'],'include':_0x53870f[_0x80c4('0x1c')]?_['map'](_0x53870f['include'],function(_0x483dbf){return{'model':db[_0x483dbf[_0x80c4('0x1d')]],'as':_0x483dbf['as'],'attributes':_0x483dbf[_0x80c4('0x1a')],'include':_0x483dbf[_0x80c4('0x1c')]?_[_0x80c4('0x1e')](_0x483dbf[_0x80c4('0x1c')],function(_0x5e152c){return{'model':db[_0x5e152c['model']],'as':_0x5e152c['as'],'attributes':_0x5e152c['attributes']};}):[]};}):[]};}):[]:[]})[_0x80c4('0x1f')](function(_0x2a2b7b){logger[_0x80c4('0xa')](_0x80c4('0x15'),_0x3f189c);logger[_0x80c4('0xd')](_0x80c4('0x15'),_0x3f189c,JSON[_0x80c4('0xf')](_0x2a2b7b));_0x2aaf54(_0x2a2b7b);})[_0x80c4('0x14')](function(_0x881945){logger[_0x80c4('0x10')](_0x80c4('0x15'),_0x881945['message'],_0x3f189c);_0x369b58(_0x21b945['error'](0x1f4,_0x881945['message']));});});};exports['UpdateCmHopperBlack']=function(_0x4a5cf4){var _0x3599b4=this;return new Promise(function(_0x5a36dc,_0x380ba3){return db[_0x80c4('0x20')][_0x80c4('0x21')](_0x4a5cf4[_0x80c4('0x22')],{'raw':_0x4a5cf4['options']?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5cf4[_0x80c4('0x17')]?_0x4a5cf4[_0x80c4('0x17')]['where']||null:null,'attributes':_0x4a5cf4[_0x80c4('0x17')]?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x1a')]||null:null,'limit':_0x4a5cf4['options']?_0x4a5cf4[_0x80c4('0x17')][_0x80c4('0x1b')]||null:null})[_0x80c4('0x1f')](function(_0x3a66ea){logger['info'](_0x80c4('0x23'),_0x4a5cf4);logger[_0x80c4('0xd')](_0x80c4('0x23'),_0x4a5cf4,JSON['stringify'](_0x3a66ea));_0x5a36dc(_0x3a66ea);})[_0x80c4('0x14')](function(_0x57b226){logger[_0x80c4('0x10')](_0x80c4('0x23'),_0x57b226[_0x80c4('0x12')],_0x4a5cf4);_0x380ba3(_0x3599b4[_0x80c4('0x10')](0x1f4,_0x57b226[_0x80c4('0x12')]));});});};exports[_0x80c4('0x24')]=function(_0x1113f1){var _0x13bef4=this;return new Promise(function(_0x9611be,_0x30eadb){return db[_0x80c4('0x20')][_0x80c4('0x25')]({'where':_0x1113f1['options']?_0x1113f1[_0x80c4('0x17')][_0x80c4('0x19')]||null:null})[_0x80c4('0x1f')](function(_0x3d196e){logger['info'](_0x80c4('0x24'),_0x1113f1);logger[_0x80c4('0xd')]('DestroyCmHopperBlack',_0x1113f1,JSON['stringify'](_0x3d196e));_0x9611be(_0x3d196e);})[_0x80c4('0x14')](function(_0x12c398){logger[_0x80c4('0x10')](_0x80c4('0x24'),_0x12c398[_0x80c4('0x12')],_0x1113f1);_0x30eadb(_0x13bef4[_0x80c4('0x10')](0x1f4,_0x12c398[_0x80c4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bf0bfa6..849521d 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 _0x3a6d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','describe','/:id','show','put','delete','destroy','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a6d,0x143));var _0xd3a6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3a6d[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var fs_extra=require(_0xd3a6('0x5'));var auth=require(_0xd3a6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd3a6('0x7'));var controller=require(_0xd3a6('0x8'));router[_0xd3a6('0x9')]('/',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xb')]);router[_0xd3a6('0x9')]('/describe',auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x9')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0xf')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller['update']);router[_0xd3a6('0x10')](_0xd3a6('0xd'),auth[_0xd3a6('0xa')](),controller[_0xd3a6('0x11')]);module[_0xd3a6('0x12')]=router; \ No newline at end of file +var _0xeda8=['get','isAuthenticated','index','describe','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x302099,_0xe61dca){var _0x24a042=function(_0x50b7fb){while(--_0x50b7fb){_0x302099['push'](_0x302099['shift']());}};_0x24a042(++_0xe61dca);}(_0xeda8,0x104));var _0x8eda=function(_0x2d1be0,_0x5ef4e4){_0x2d1be0=_0x2d1be0-0x0;var _0x15492d=_0xeda8[_0x2d1be0];return _0x15492d;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')]('/',auth[_0x8eda('0xb')](),controller[_0x8eda('0xc')]);router[_0x8eda('0xa')]('/describe',auth[_0x8eda('0xb')](),controller[_0x8eda('0xd')]);router[_0x8eda('0xa')](_0x8eda('0xe'),auth['isAuthenticated'](),controller['show']);router['put']('/:id',auth[_0x8eda('0xb')](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/:id',auth[_0x8eda('0xb')](),controller['destroy']);module[_0x8eda('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 22d4d5a..af67f0f 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 _0x8e29=['endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','exports','DATE','INTEGER','STRING','getDataValue'];(function(_0x27b655,_0x35d76f){var _0x367228=function(_0xb75a9f){while(--_0xb75a9f){_0x27b655['push'](_0x27b655['shift']());}};_0x367228(++_0x35d76f);}(_0x8e29,0x10d));var _0x98e2=function(_0x29c2ef,_0x4d4517){_0x29c2ef=_0x29c2ef-0x0;var _0xa85873=_0x8e29[_0x29c2ef];return _0xa85873;};'use strict';var Sequelize=require(_0x98e2('0x0'));var moment=require('moment');module[_0x98e2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x98e2('0x2')]},'countbusyretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x98e2('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x98e2('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x98e2('0x4')]},'calleridname':{'type':Sequelize[_0x98e2('0x4')]},'starttime':{'type':Sequelize[_0x98e2('0x2')]},'responsetime':{'type':Sequelize[_0x98e2('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x98e2('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x98e2('0x4')]},'campaign':{'type':Sequelize[_0x98e2('0x4')]},'campaigntype':{'type':Sequelize[_0x98e2('0x4')]},'membername':{'type':Sequelize[_0x98e2('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x98e2('0x4')]},'secondDisposition':{'type':Sequelize[_0x98e2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x98e2('0x4')]},'dispositionat':{'type':Sequelize[_0x98e2('0x2')],'set':function(_0x339eb1){var _0x2db7ba=this[_0x98e2('0x5')](_0x98e2('0x6'));if(_0x2db7ba&&_0x339eb1){this[_0x98e2('0x7')]('followuptime',moment(_0x339eb1)[_0x98e2('0x8')](moment(_0x2db7ba),_0x98e2('0x9')));}return this[_0x98e2('0x7')]('dispositionat',_0x339eb1);}},'amd':{'type':Sequelize[_0x98e2('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x98e2('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x98e2('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x98e2('0x2')]},'callback':{'type':Sequelize[_0x98e2('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x98e2('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x98e2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4200=['BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x4200,0x199));var _0x0420=function(_0x3d8dcd,_0x32a653){_0x3d8dcd=_0x3d8dcd-0x0;var _0x3891f8=_0x4200[_0x3d8dcd];return _0x3891f8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0420('0x0'));module[_0x0420('0x1')]={'state':{'type':Sequelize[_0x0420('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0420('0x3')]},'scheduledat':{'type':Sequelize[_0x0420('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0420('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0420('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0420('0x3')]},'calleridname':{'type':Sequelize[_0x0420('0x3')]},'starttime':{'type':Sequelize[_0x0420('0x4')]},'responsetime':{'type':Sequelize[_0x0420('0x4')]},'answertime':{'type':Sequelize[_0x0420('0x4')]},'droptime':{'type':Sequelize[_0x0420('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0420('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0420('0x3')]},'membername':{'type':Sequelize[_0x0420('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0420('0x3')]},'secondDisposition':{'type':Sequelize[_0x0420('0x3')]},'thirdDisposition':{'type':Sequelize[_0x0420('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4832c1){var _0x53b7bc=this[_0x0420('0x5')](_0x0420('0x6'));if(_0x53b7bc&&_0x4832c1){this[_0x0420('0x7')](_0x0420('0x8'),moment(_0x4832c1)[_0x0420('0x9')](moment(_0x53b7bc),'seconds'));}return this[_0x0420('0x7')](_0x0420('0xa'),_0x4832c1);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0420('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0420('0x4')]},'recallme':{'type':Sequelize[_0x0420('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0420('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0420('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 abbc50b..9f0e292 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 _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x299773,_0x3abbde){var _0x1e513c=function(_0x3bf22d){while(--_0x3bf22d){_0x299773['push'](_0x299773['shift']());}};_0x1e513c(++_0x3abbde);}(_0xadb5,0xad));var _0x5adb=function(_0x263c28,_0x368acc){_0x263c28=_0x263c28-0x0;var _0x22c2b8=_0xadb5[_0x263c28];return _0x22c2b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file +var _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5df788,_0xe4aa00){_0x5df788=_0x5df788-0x0;var _0x30139c=_0xc1c6[_0x5df788];return _0x30139c;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 50421a5..4e6dbba 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 _0xce19=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x42dc8b,_0x24f41a){var _0x42764b=function(_0x386c4c){while(--_0x386c4c){_0x42dc8b['push'](_0x42dc8b['shift']());}};_0x42764b(++_0x24f41a);}(_0xce19,0x7a));var _0x9ce1=function(_0x46a30d,_0x34b9ad){_0x46a30d=_0x46a30d-0x0;var _0x3d1914=_0xce19[_0x46a30d];return _0x3d1914;};'use strict';var _=require(_0x9ce1('0x0'));var util=require('util');var logger=require(_0x9ce1('0x1'))(_0x9ce1('0x2'));var moment=require(_0x9ce1('0x3'));var BPromise=require(_0x9ce1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ce1('0x5'));var rimraf=require('rimraf');var config=require(_0x9ce1('0x6'));var attributes=require(_0x9ce1('0x7'));module[_0x9ce1('0x8')]=function(_0x16c35b,_0x44a321){return _0x16c35b[_0x9ce1('0x9')](_0x9ce1('0xa'),attributes,{'tableName':_0x9ce1('0xb'),'paranoid':![],'indexes':[{'name':_0x9ce1('0xc'),'fields':['calleridnum']},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5010=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','uniqueid'];(function(_0x3763a7,_0x416e51){var _0xd30ec4=function(_0x56b9ff){while(--_0x56b9ff){_0x3763a7['push'](_0x3763a7['shift']());}};_0xd30ec4(++_0x416e51);}(_0x5010,0x64));var _0x0501=function(_0x179af7,_0x4bca78){_0x179af7=_0x179af7-0x0;var _0x4f16e1=_0x5010[_0x179af7];return _0x4f16e1;};'use strict';var _=require(_0x0501('0x0'));var util=require('util');var logger=require(_0x0501('0x1'))('api');var moment=require(_0x0501('0x2'));var BPromise=require(_0x0501('0x3'));var rp=require(_0x0501('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0501('0x5'));var config=require('../../config/environment');var attributes=require(_0x0501('0x6'));module['exports']=function(_0x36249b,_0x5366ca){return _0x36249b[_0x0501('0x7')](_0x0501('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0x0501('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 59984e8..3b7f05b 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x139795,_0xce8b04){var _0x5bdf72=function(_0x11a02c){while(--_0x11a02c){_0x139795['push'](_0x139795['shift']());}};_0x5bdf72(++_0xce8b04);}(_0xb10b,0x12a));var _0xbb10=function(_0x54e3ab,_0x1c8fcc){_0x54e3ab=_0x54e3ab-0x0;var _0x5c2814=_0xb10b[_0x54e3ab];return _0x5c2814;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x284723,_0x3e1083){var _0x5a2ad3=function(_0x1a4381){while(--_0x1a4381){_0x284723['push'](_0x284723['shift']());}};_0x5a2ad3(++_0x3e1083);}(_0x7a54,0x106));var _0x47a5=function(_0x1e5d01,_0x10d7f7){_0x1e5d01=_0x1e5d01-0x0;var _0x5596a6=_0x7a54[_0x1e5d01];return _0x5596a6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index cbdc1ba..4e58952 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 _0x6c90=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','checkContactHopper','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4bd440,_0x1760ee){var _0xe79792=function(_0x46d052){while(--_0x46d052){_0x4bd440['push'](_0x4bd440['shift']());}};_0xe79792(++_0x1760ee);}(_0x6c90,0x1de));var _0x06c9=function(_0x2eeee7,_0x1cc6a4){_0x2eeee7=_0x2eeee7-0x0;var _0x1dfba7=_0x6c90[_0x2eeee7];return _0x1dfba7;};'use strict';var multer=require('multer');var util=require(_0x06c9('0x0'));var path=require(_0x06c9('0x1'));var timeout=require('connect-timeout');var express=require(_0x06c9('0x2'));var router=express[_0x06c9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x06c9('0x4'));var interaction=require(_0x06c9('0x5'));var config=require(_0x06c9('0x6'));var controller=require(_0x06c9('0x7'));router[_0x06c9('0x8')]('/',auth[_0x06c9('0x9')](),controller['index']);router[_0x06c9('0x8')](_0x06c9('0xa'),auth['isAuthenticated'](),controller[_0x06c9('0xb')]);router[_0x06c9('0x8')](_0x06c9('0xc'),auth[_0x06c9('0x9')](),controller[_0x06c9('0xd')]);router[_0x06c9('0x8')]('/voice/queue/countAttributes/:id',auth[_0x06c9('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x06c9('0x8')](_0x06c9('0xe'),auth[_0x06c9('0x9')](),controller[_0x06c9('0xf')]);router[_0x06c9('0x10')](_0x06c9('0x11'),auth['isAuthenticated'](),controller[_0x06c9('0x12')]);router[_0x06c9('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x06c9('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x06c9('0x10')]('/checkContactHopper',auth[_0x06c9('0x9')](),controller[_0x06c9('0x13')]);router['put']('/:id',auth[_0x06c9('0x9')](),controller['update']);module[_0x06c9('0x14')]=router; \ No newline at end of file +var _0x79a3=['/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','path','connect-timeout','Router','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x44b8ba,_0x44d3ba){var _0x13e22b=function(_0x3d7b07){while(--_0x3d7b07){_0x44b8ba['push'](_0x44b8ba['shift']());}};_0x13e22b(++_0x44d3ba);}(_0x79a3,0x80));var _0x379a=function(_0xdc188e,_0x587e20){_0xdc188e=_0xdc188e-0x0;var _0x3ac2f6=_0x79a3[_0xdc188e];return _0x3ac2f6;};'use strict';var multer=require(_0x379a('0x0'));var util=require('util');var path=require(_0x379a('0x1'));var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x379a('0x4'));var controller=require(_0x379a('0x5'));router[_0x379a('0x6')]('/',auth[_0x379a('0x7')](),controller[_0x379a('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x379a('0x9')]);router[_0x379a('0x6')](_0x379a('0xa'),auth[_0x379a('0x7')](),controller[_0x379a('0xb')]);router[_0x379a('0x6')](_0x379a('0xc'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0x379a('0x6')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x379a('0xd')]);router[_0x379a('0xe')](_0x379a('0xf'),auth[_0x379a('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router['post']('/voice/campaign/moveContacts/:id',auth[_0x379a('0x7')](),controller[_0x379a('0x10')]);router[_0x379a('0xe')](_0x379a('0x11'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x379a('0x12')](_0x379a('0xa'),auth[_0x379a('0x7')](),controller[_0x379a('0x13')]);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 a7bdff2..1bb47fc 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 _0x04d0=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x2bab27,_0x372f57){var _0x921a3=function(_0x42100f){while(--_0x42100f){_0x2bab27['push'](_0x2bab27['shift']());}};_0x921a3(++_0x372f57);}(_0x04d0,0x12a));var _0x004d=function(_0x433ada,_0x267730){_0x433ada=_0x433ada-0x0;var _0x80dd45=_0x04d0[_0x433ada];return _0x80dd45;};'use strict';var Sequelize=require(_0x004d('0x0'));module['exports']={'state':{'type':Sequelize[_0x004d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x004d('0x2')]},'scheduledat':{'type':Sequelize[_0x004d('0x3')]},'countbusyretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x004d('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x004d('0x2')]},'calleridnum':{'type':Sequelize[_0x004d('0x2')]},'calleridname':{'type':Sequelize[_0x004d('0x2')]},'starttime':{'type':Sequelize[_0x004d('0x3')]},'responsetime':{'type':Sequelize[_0x004d('0x3')]},'answertime':{'type':Sequelize[_0x004d('0x3')]},'droptime':{'type':Sequelize[_0x004d('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x004d('0x2')]},'campaign':{'type':Sequelize[_0x004d('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x004d('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x004d('0x3')]},'recallme':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x004d('0x3')]},'edited':{'type':Sequelize[_0x004d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x004d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x004d('0x2')]}}; \ No newline at end of file +var _0xd6bc=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xd6bc[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0xcd6b('0x0'));module[_0xcd6b('0x1')]={'state':{'type':Sequelize[_0xcd6b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcd6b('0x3')]},'scheduledat':{'type':Sequelize[_0xcd6b('0x4')]},'countbusyretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcd6b('0x3')]},'calleridnum':{'type':Sequelize[_0xcd6b('0x3')]},'calleridname':{'type':Sequelize[_0xcd6b('0x3')]},'starttime':{'type':Sequelize[_0xcd6b('0x4')]},'responsetime':{'type':Sequelize[_0xcd6b('0x4')]},'answertime':{'type':Sequelize[_0xcd6b('0x4')]},'droptime':{'type':Sequelize[_0xcd6b('0x4')]},'endtime':{'type':Sequelize[_0xcd6b('0x4')]},'ringtime':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcd6b('0x3')]},'campaign':{'type':Sequelize[_0xcd6b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcd6b('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd6b('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcd6b('0x4')]},'recallme':{'type':Sequelize[_0xcd6b('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd6b('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 15d584a..0583aed 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 _0x58d6=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','where','map','type','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x24ec7b,_0x4a9e39){var _0x1acdc9=function(_0x43a1c4){while(--_0x43a1c4){_0x24ec7b['push'](_0x24ec7b['shift']());}};_0x1acdc9(++_0x4a9e39);}(_0x58d6,0xed));var _0x658d=function(_0x1cc8a2,_0x5dce88){_0x1cc8a2=_0x1cc8a2-0x0;var _0xadb7a6=_0x58d6[_0x1cc8a2];return _0xadb7a6;};'use strict';var emlformat=require(_0x658d('0x0'));var rimraf=require(_0x658d('0x1'));var zipdir=require(_0x658d('0x2'));var jsonpatch=require(_0x658d('0x3'));var rp=require(_0x658d('0x4'));var moment=require(_0x658d('0x5'));var BPromise=require(_0x658d('0x6'));var Mustache=require(_0x658d('0x7'));var util=require(_0x658d('0x8'));var path=require(_0x658d('0x9'));var sox=require(_0x658d('0xa'));var csv=require('to-csv');var ejs=require(_0x658d('0xb'));var fs=require('fs');var fs_extra=require(_0x658d('0xc'));var _=require(_0x658d('0xd'));var squel=require(_0x658d('0xe'));var crypto=require(_0x658d('0xf'));var jsforce=require(_0x658d('0x10'));var deskjs=require(_0x658d('0x11'));var toCsv=require(_0x658d('0x12'));var querystring=require(_0x658d('0x13'));var Papa=require('papaparse');var Redis=require(_0x658d('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x658d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x658d('0x16'))(_0x658d('0x17'));var utils=require(_0x658d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x658d('0x19'));var db=require(_0x658d('0x1a'))['db'];function respondWithStatusCode(_0x512f44,_0x17aef9){_0x17aef9=_0x17aef9||0xcc;return function(_0x4c51ea){if(_0x4c51ea){return _0x512f44[_0x658d('0x1b')](_0x17aef9);}return _0x512f44['status'](_0x17aef9)[_0x658d('0x1c')]();};}function respondWithResult(_0x44cb70,_0x20f7b4){_0x20f7b4=_0x20f7b4||0xc8;return function(_0x2f1fcd){if(_0x2f1fcd){return _0x44cb70[_0x658d('0x1d')](_0x20f7b4)['json'](_0x2f1fcd);}};}function respondWithFilteredResult(_0x391fd4,_0x43810d){return function(_0xe03bfc){if(_0xe03bfc){var _0x222f1f=typeof _0x43810d[_0x658d('0x1e')]==='undefined'&&typeof _0x43810d[_0x658d('0x1f')]===_0x658d('0x20');var _0x11270a=_0xe03bfc['count'];var _0x138706=_0x222f1f?0x0:_0x43810d['offset'];var _0x4d6ee0=_0x222f1f?_0xe03bfc[_0x658d('0x21')]:_0x43810d[_0x658d('0x1e')]+_0x43810d[_0x658d('0x1f')];var _0x32f842;if(_0x4d6ee0>=_0x11270a){_0x4d6ee0=_0x11270a;_0x32f842=0xc8;}else{_0x32f842=0xce;}_0x391fd4[_0x658d('0x1d')](_0x32f842);return _0x391fd4[_0x658d('0x22')](_0x658d('0x23'),_0x138706+'-'+_0x4d6ee0+'/'+_0x11270a)[_0x658d('0x24')](_0xe03bfc);}return null;};}function patchUpdates(_0x4b9af7){return function(_0x356fe1){try{jsonpatch[_0x658d('0x25')](_0x356fe1,_0x4b9af7,!![]);}catch(_0x48ef87){return BPromise[_0x658d('0x26')](_0x48ef87);}return _0x356fe1[_0x658d('0x27')]();};}function saveUpdates(_0x4e32bb,_0x425184){return function(_0x312bc2){if(_0x312bc2){return _0x312bc2[_0x658d('0x28')](_0x4e32bb)[_0x658d('0x29')](function(_0x99066){return _0x99066;});}return null;};}function removeEntity(_0xbf2c1f,_0x57302a){return function(_0x284198){if(_0x284198){return _0x284198[_0x658d('0x2a')]()[_0x658d('0x29')](function(){_0xbf2c1f['status'](0xcc)[_0x658d('0x1c')]();});}};}function handleEntityNotFound(_0x148653,_0x2cbc38){return function(_0x26b278){if(!_0x26b278){_0x148653[_0x658d('0x1b')](0x194);}return _0x26b278;};}function handleError(_0x380c40,_0xe84ea1){_0xe84ea1=_0xe84ea1||0x1f4;return function(_0x406b19){logger[_0x658d('0x2b')](_0x406b19[_0x658d('0x2c')]);if(_0x406b19[_0x658d('0x2d')]){delete _0x406b19[_0x658d('0x2d')];}_0x380c40[_0x658d('0x1d')](_0xe84ea1)[_0x658d('0x2e')](_0x406b19);};}exports[_0x658d('0x2f')]=function(_0x5e9272,_0x4f3cad){var _0x28fa6d={},_0x5020b7={},_0x85c2de={'count':0x0,'rows':[]};var _0x349d8b=_['map'](db[_0x658d('0x30')][_0x658d('0x31')],function(_0x42ec12){return{'name':_0x42ec12[_0x658d('0x32')],'type':_0x42ec12['type'][_0x658d('0x33')]};});_0x5020b7[_0x658d('0x34')]=_['map'](_0x349d8b,_0x658d('0x2d'));_0x5020b7['query']=_[_0x658d('0x35')](_0x5e9272[_0x658d('0x36')]);_0x5020b7[_0x658d('0x37')]=_[_0x658d('0x38')](_0x5020b7[_0x658d('0x34')],_0x5020b7[_0x658d('0x36')]);_0x28fa6d[_0x658d('0x39')]=_[_0x658d('0x38')](_0x5020b7['model'],qs[_0x658d('0x3a')](_0x5e9272[_0x658d('0x36')][_0x658d('0x3a')]));_0x28fa6d['attributes']=_0x28fa6d[_0x658d('0x39')][_0x658d('0x3b')]?_0x28fa6d[_0x658d('0x39')]:_0x5020b7[_0x658d('0x34')];if(!_0x5e9272['query'][_0x658d('0x3c')]('nolimit')){_0x28fa6d[_0x658d('0x1f')]=qs[_0x658d('0x1f')](_0x5e9272[_0x658d('0x36')][_0x658d('0x1f')]);_0x28fa6d[_0x658d('0x1e')]=qs[_0x658d('0x1e')](_0x5e9272[_0x658d('0x36')][_0x658d('0x1e')]);}_0x28fa6d[_0x658d('0x3d')]=qs['sort'](_0x5e9272[_0x658d('0x36')]['sort']);_0x28fa6d['where']=qs[_0x658d('0x37')](_[_0x658d('0x3e')](_0x5e9272[_0x658d('0x36')],_0x5020b7[_0x658d('0x37')]),_0x349d8b);if(_0x5e9272[_0x658d('0x36')][_0x658d('0x3f')]){_0x28fa6d[_0x658d('0x40')]=_['merge'](_0x28fa6d[_0x658d('0x40')],{'$or':_[_0x658d('0x41')](_0x349d8b,function(_0x1e9cab){if(_0x1e9cab[_0x658d('0x42')]!=='VIRTUAL'){var _0x2b60a4={};_0x2b60a4[_0x1e9cab['name']]={'$like':'%'+_0x5e9272['query']['filter']+'%'};return _0x2b60a4;}})});}_0x28fa6d=_[_0x658d('0x43')]({},_0x28fa6d,_0x5e9272[_0x658d('0x44')]);var _0xdcf2e2={'where':_0x28fa6d[_0x658d('0x40')]};return db[_0x658d('0x30')][_0x658d('0x21')](_0xdcf2e2)[_0x658d('0x29')](function(_0x298131){_0x85c2de[_0x658d('0x21')]=_0x298131;if(_0x5e9272[_0x658d('0x36')][_0x658d('0x45')]){_0x28fa6d['include']=[{'all':!![]}];}return db[_0x658d('0x30')][_0x658d('0x46')](_0x28fa6d);})[_0x658d('0x29')](function(_0x39f1c8){_0x85c2de[_0x658d('0x47')]=_0x39f1c8;return _0x85c2de;})['then'](respondWithFilteredResult(_0x4f3cad,_0x28fa6d))[_0x658d('0x48')](handleError(_0x4f3cad,null));};exports[_0x658d('0x49')]=function(_0x59c8b6,_0x405f92){var _0xd25240={'raw':!![],'where':{'id':_0x59c8b6[_0x658d('0x4a')]['id']}},_0x846ed7={};_0x846ed7[_0x658d('0x34')]=_[_0x658d('0x35')](db[_0x658d('0x30')][_0x658d('0x31')]);_0x846ed7[_0x658d('0x36')]=_[_0x658d('0x35')](_0x59c8b6['query']);_0x846ed7['filters']=_['intersection'](_0x846ed7[_0x658d('0x34')],_0x846ed7['query']);_0xd25240[_0x658d('0x39')]=_[_0x658d('0x38')](_0x846ed7[_0x658d('0x34')],qs[_0x658d('0x3a')](_0x59c8b6[_0x658d('0x36')]['fields']));_0xd25240[_0x658d('0x39')]=_0xd25240[_0x658d('0x39')][_0x658d('0x3b')]?_0xd25240[_0x658d('0x39')]:_0x846ed7[_0x658d('0x34')];if(_0x59c8b6[_0x658d('0x36')]['includeAll']){_0xd25240[_0x658d('0x4b')]=[{'all':!![]}];}_0xd25240=_[_0x658d('0x43')]({},_0xd25240,_0x59c8b6[_0x658d('0x44')]);return db[_0x658d('0x30')][_0x658d('0x4c')](_0xd25240)[_0x658d('0x29')](handleEntityNotFound(_0x405f92,null))['then'](respondWithResult(_0x405f92,null))[_0x658d('0x48')](handleError(_0x405f92,null));};exports[_0x658d('0x4d')]=function(_0x352750,_0x473614){return db['CmHopperHistory']['create'](_0x352750[_0x658d('0x4e')],{})[_0x658d('0x29')](respondWithResult(_0x473614,0xc9))[_0x658d('0x48')](handleError(_0x473614,null));};exports['describe']=function(_0x40aecf,_0x1fac91){return db[_0x658d('0x30')][_0x658d('0x4f')]()[_0x658d('0x29')](respondWithResult(_0x1fac91,null))[_0x658d('0x48')](handleError(_0x1fac91,null));};exports[_0x658d('0x28')]=function(_0x11efc3,_0x3034a4){if(_0x11efc3['body'][_0x658d('0x50')]){delete _0x11efc3[_0x658d('0x4e')][_0x658d('0x50')];}return db[_0x658d('0x30')][_0x658d('0x4c')]({'where':{'uniqueid':_0x11efc3['params']['id']}})[_0x658d('0x29')](handleEntityNotFound(_0x3034a4,null))[_0x658d('0x29')](saveUpdates(_0x11efc3['body'],null))[_0x658d('0x29')](respondWithResult(_0x3034a4,null))[_0x658d('0x48')](handleError(_0x3034a4,null));}; \ No newline at end of file +var _0x49c8=['index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','CmHopperHistory','findAll','rows','catch','show','params','length','include','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name'];(function(_0x200660,_0x5bdc1d){var _0x1d412c=function(_0x21db72){while(--_0x21db72){_0x200660['push'](_0x200660['shift']());}};_0x1d412c(++_0x5bdc1d);}(_0x49c8,0x14f));var _0x849c=function(_0x5592ab,_0xe01026){_0x5592ab=_0x5592ab-0x0;var _0x524d1f=_0x49c8[_0x5592ab];return _0x524d1f;};'use strict';var emlformat=require(_0x849c('0x0'));var rimraf=require(_0x849c('0x1'));var zipdir=require(_0x849c('0x2'));var jsonpatch=require(_0x849c('0x3'));var rp=require(_0x849c('0x4'));var moment=require('moment');var BPromise=require(_0x849c('0x5'));var Mustache=require('mustache');var util=require(_0x849c('0x6'));var path=require('path');var sox=require(_0x849c('0x7'));var csv=require('to-csv');var ejs=require(_0x849c('0x8'));var fs=require('fs');var fs_extra=require(_0x849c('0x9'));var _=require(_0x849c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x849c('0xb'));var querystring=require('querystring');var Papa=require(_0x849c('0xc'));var Redis=require(_0x849c('0xd'));var authService=require(_0x849c('0xe'));var qs=require(_0x849c('0xf'));var as=require(_0x849c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x849c('0x11'))('api');var utils=require(_0x849c('0x12'));var config=require(_0x849c('0x13'));var licenseUtil=require(_0x849c('0x14'));var db=require(_0x849c('0x15'))['db'];function respondWithStatusCode(_0x40557b,_0x56fa82){_0x56fa82=_0x56fa82||0xcc;return function(_0xc31bbc){if(_0xc31bbc){return _0x40557b[_0x849c('0x16')](_0x56fa82);}return _0x40557b['status'](_0x56fa82)[_0x849c('0x17')]();};}function respondWithResult(_0xa58593,_0x22b511){_0x22b511=_0x22b511||0xc8;return function(_0x22b8df){if(_0x22b8df){return _0xa58593[_0x849c('0x18')](_0x22b511)['json'](_0x22b8df);}};}function respondWithFilteredResult(_0xc4ab15,_0x353825){return function(_0x38f7c5){if(_0x38f7c5){var _0xf33147=typeof _0x353825[_0x849c('0x19')]==='undefined'&&typeof _0x353825[_0x849c('0x1a')]===_0x849c('0x1b');var _0x412f3a=_0x38f7c5[_0x849c('0x1c')];var _0x5df3ef=_0xf33147?0x0:_0x353825['offset'];var _0x4ffa6c=_0xf33147?_0x38f7c5[_0x849c('0x1c')]:_0x353825['offset']+_0x353825[_0x849c('0x1a')];var _0x48ff34;if(_0x4ffa6c>=_0x412f3a){_0x4ffa6c=_0x412f3a;_0x48ff34=0xc8;}else{_0x48ff34=0xce;}_0xc4ab15[_0x849c('0x18')](_0x48ff34);return _0xc4ab15[_0x849c('0x1d')](_0x849c('0x1e'),_0x5df3ef+'-'+_0x4ffa6c+'/'+_0x412f3a)[_0x849c('0x1f')](_0x38f7c5);}return null;};}function patchUpdates(_0x1a3dbd){return function(_0x85b91){try{jsonpatch[_0x849c('0x20')](_0x85b91,_0x1a3dbd,!![]);}catch(_0x4d99db){return BPromise[_0x849c('0x21')](_0x4d99db);}return _0x85b91['save']();};}function saveUpdates(_0x284854,_0xd8ce28){return function(_0x5b4d8e){if(_0x5b4d8e){return _0x5b4d8e[_0x849c('0x22')](_0x284854)[_0x849c('0x23')](function(_0x1de1f2){return _0x1de1f2;});}return null;};}function removeEntity(_0x52fd9a,_0x3030a1){return function(_0x50f162){if(_0x50f162){return _0x50f162[_0x849c('0x24')]()[_0x849c('0x23')](function(){_0x52fd9a[_0x849c('0x18')](0xcc)[_0x849c('0x17')]();});}};}function handleEntityNotFound(_0x40d8ae,_0x1829fc){return function(_0x5258e6){if(!_0x5258e6){_0x40d8ae[_0x849c('0x16')](0x194);}return _0x5258e6;};}function handleError(_0xeb40d0,_0x3e8753){_0x3e8753=_0x3e8753||0x1f4;return function(_0x4bf160){logger[_0x849c('0x25')](_0x4bf160[_0x849c('0x26')]);if(_0x4bf160[_0x849c('0x27')]){delete _0x4bf160[_0x849c('0x27')];}_0xeb40d0[_0x849c('0x18')](_0x3e8753)['send'](_0x4bf160);};}exports[_0x849c('0x28')]=function(_0x4b6588,_0x5bdc00){var _0x580717={},_0x1a4f66={},_0x3dde35={'count':0x0,'rows':[]};var _0x1f6f32=_[_0x849c('0x29')](db['CmHopperHistory'][_0x849c('0x2a')],function(_0x537b74){return{'name':_0x537b74[_0x849c('0x2b')],'type':_0x537b74[_0x849c('0x2c')][_0x849c('0x2d')]};});_0x1a4f66['model']=_['map'](_0x1f6f32,_0x849c('0x27'));_0x1a4f66[_0x849c('0x2e')]=_[_0x849c('0x2f')](_0x4b6588[_0x849c('0x2e')]);_0x1a4f66['filters']=_[_0x849c('0x30')](_0x1a4f66[_0x849c('0x31')],_0x1a4f66[_0x849c('0x2e')]);_0x580717[_0x849c('0x32')]=_[_0x849c('0x30')](_0x1a4f66['model'],qs[_0x849c('0x33')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x33')]));_0x580717[_0x849c('0x32')]=_0x580717[_0x849c('0x32')]['length']?_0x580717['attributes']:_0x1a4f66['model'];if(!_0x4b6588[_0x849c('0x2e')][_0x849c('0x34')](_0x849c('0x35'))){_0x580717['limit']=qs[_0x849c('0x1a')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x1a')]);_0x580717[_0x849c('0x19')]=qs['offset'](_0x4b6588[_0x849c('0x2e')]['offset']);}_0x580717[_0x849c('0x36')]=qs[_0x849c('0x37')](_0x4b6588[_0x849c('0x2e')][_0x849c('0x37')]);_0x580717[_0x849c('0x38')]=qs['filters'](_[_0x849c('0x39')](_0x4b6588[_0x849c('0x2e')],_0x1a4f66[_0x849c('0x3a')]),_0x1f6f32);if(_0x4b6588[_0x849c('0x2e')][_0x849c('0x3b')]){_0x580717[_0x849c('0x38')]=_['merge'](_0x580717[_0x849c('0x38')],{'$or':_[_0x849c('0x29')](_0x1f6f32,function(_0x2431ff){if(_0x2431ff[_0x849c('0x2c')]!==_0x849c('0x3c')){var _0x882b4c={};_0x882b4c[_0x2431ff[_0x849c('0x27')]]={'$like':'%'+_0x4b6588[_0x849c('0x2e')]['filter']+'%'};return _0x882b4c;}})});}_0x580717=_[_0x849c('0x3d')]({},_0x580717,_0x4b6588[_0x849c('0x3e')]);var _0x504b8d={'where':_0x580717[_0x849c('0x38')]};return db['CmHopperHistory']['count'](_0x504b8d)[_0x849c('0x23')](function(_0x1b3e35){_0x3dde35['count']=_0x1b3e35;if(_0x4b6588[_0x849c('0x2e')]['includeAll']){_0x580717['include']=[{'all':!![]}];}return db[_0x849c('0x3f')][_0x849c('0x40')](_0x580717);})[_0x849c('0x23')](function(_0x110237){_0x3dde35[_0x849c('0x41')]=_0x110237;return _0x3dde35;})[_0x849c('0x23')](respondWithFilteredResult(_0x5bdc00,_0x580717))[_0x849c('0x42')](handleError(_0x5bdc00,null));};exports[_0x849c('0x43')]=function(_0x8cbaf9,_0x32cc56){var _0x26cb9b={'raw':!![],'where':{'id':_0x8cbaf9[_0x849c('0x44')]['id']}},_0x1a005b={};_0x1a005b[_0x849c('0x31')]=_[_0x849c('0x2f')](db[_0x849c('0x3f')][_0x849c('0x2a')]);_0x1a005b['query']=_[_0x849c('0x2f')](_0x8cbaf9['query']);_0x1a005b[_0x849c('0x3a')]=_[_0x849c('0x30')](_0x1a005b[_0x849c('0x31')],_0x1a005b[_0x849c('0x2e')]);_0x26cb9b[_0x849c('0x32')]=_[_0x849c('0x30')](_0x1a005b[_0x849c('0x31')],qs[_0x849c('0x33')](_0x8cbaf9[_0x849c('0x2e')][_0x849c('0x33')]));_0x26cb9b[_0x849c('0x32')]=_0x26cb9b[_0x849c('0x32')][_0x849c('0x45')]?_0x26cb9b[_0x849c('0x32')]:_0x1a005b[_0x849c('0x31')];if(_0x8cbaf9[_0x849c('0x2e')]['includeAll']){_0x26cb9b[_0x849c('0x46')]=[{'all':!![]}];}_0x26cb9b=_[_0x849c('0x3d')]({},_0x26cb9b,_0x8cbaf9[_0x849c('0x3e')]);return db['CmHopperHistory']['find'](_0x26cb9b)[_0x849c('0x23')](handleEntityNotFound(_0x32cc56,null))[_0x849c('0x23')](respondWithResult(_0x32cc56,null))[_0x849c('0x42')](handleError(_0x32cc56,null));};exports['create']=function(_0x4de9ae,_0x2a60f6){return db['CmHopperHistory'][_0x849c('0x47')](_0x4de9ae[_0x849c('0x48')],{})['then'](respondWithResult(_0x2a60f6,0xc9))[_0x849c('0x42')](handleError(_0x2a60f6,null));};exports['describe']=function(_0x483678,_0x14d3ed){return db[_0x849c('0x3f')][_0x849c('0x49')]()[_0x849c('0x23')](respondWithResult(_0x14d3ed,null))[_0x849c('0x42')](handleError(_0x14d3ed,null));};exports[_0x849c('0x22')]=function(_0x5f1c66,_0x1d71c3){if(_0x5f1c66[_0x849c('0x48')]['uniqueid']){delete _0x5f1c66[_0x849c('0x48')][_0x849c('0x4a')];}return db[_0x849c('0x3f')]['find']({'where':{'uniqueid':_0x5f1c66[_0x849c('0x44')]['id']}})[_0x849c('0x23')](handleEntityNotFound(_0x1d71c3,null))['then'](saveUpdates(_0x5f1c66[_0x849c('0x48')],null))[_0x849c('0x23')](respondWithResult(_0x1d71c3,null))[_0x849c('0x42')](handleError(_0x1d71c3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 03232d9..246e719 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 _0xa329=['endtime','uniqueid','lodash','util','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa329,0x162));var _0x9a32=function(_0x119f8d,_0x2e792f){_0x119f8d=_0x119f8d-0x0;var _0x10c3f8=_0xa329[_0x119f8d];return _0x10c3f8;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var logger=require('../../config/logger')(_0x9a32('0x2'));var moment=require('moment');var BPromise=require(_0x9a32('0x3'));var rp=require(_0x9a32('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a32('0x5'));var attributes=require(_0x9a32('0x6'));module[_0x9a32('0x7')]=function(_0x21907f,_0x12735a){return _0x21907f[_0x9a32('0x8')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9a32('0x9')]},{'name':_0x9a32('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa32b=['./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xa32b,0x68));var _0xba32=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0xa32b[_0x4b784d];return _0x2cdeaf;};'use strict';var _=require(_0xba32('0x0'));var util=require('util');var logger=require(_0xba32('0x1'))('api');var moment=require('moment');var BPromise=require(_0xba32('0x2'));var rp=require(_0xba32('0x3'));var fs=require('fs');var path=require(_0xba32('0x4'));var rimraf=require('rimraf');var config=require(_0xba32('0x5'));var attributes=require(_0xba32('0x6'));module[_0xba32('0x7')]=function(_0x312fe7,_0x31dc74){return _0x312fe7['define'](_0xba32('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xba32('0x9'),'fields':[_0xba32('0x9')]},{'name':_0xba32('0xa'),'fields':[_0xba32('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index bf158d9..5250818 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 _0x9011=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','findAll','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring'];(function(_0x33de88,_0x581346){var _0x105957=function(_0x52752d){while(--_0x52752d){_0x33de88['push'](_0x33de88['shift']());}};_0x105957(++_0x581346);}(_0x9011,0x1f4));var _0x1901=function(_0xd646f6,_0x2c4baf){_0xd646f6=_0xd646f6-0x0;var _0x10ed12=_0x9011[_0xd646f6];return _0x10ed12;};'use strict';var _=require('lodash');var util=require(_0x1901('0x0'));var moment=require(_0x1901('0x1'));var BPromise=require(_0x1901('0x2'));var rs=require(_0x1901('0x3'));var fs=require('fs');var Redis=require(_0x1901('0x4'));var db=require(_0x1901('0x5'))['db'];var utils=require(_0x1901('0x6'));var logger=require(_0x1901('0x7'))('rpc');var config=require(_0x1901('0x8'));var jayson=require(_0x1901('0x9'));var client=jayson[_0x1901('0xa')][_0x1901('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55260b,_0x30246e,_0x1baab6){return new BPromise(function(_0xa94186,_0x3f2260){return client['request'](_0x55260b,_0x1baab6)[_0x1901('0xc')](function(_0x51082d){logger[_0x1901('0xd')](_0x1901('0xe'),_0x30246e,_0x1901('0xf'));logger[_0x1901('0x10')](_0x1901('0x11'),_0x30246e,_0x1901('0xf'),JSON[_0x1901('0x12')](_0x51082d));if(_0x51082d[_0x1901('0x13')]){if(_0x51082d[_0x1901('0x13')][_0x1901('0x14')]===0x1f4){logger[_0x1901('0x13')](_0x1901('0xe'),_0x30246e,_0x51082d[_0x1901('0x13')][_0x1901('0x15')]);return _0x3f2260(_0x51082d[_0x1901('0x13')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x30246e,_0x51082d[_0x1901('0x13')][_0x1901('0x15')]);return _0xa94186(_0x51082d[_0x1901('0x13')][_0x1901('0x15')]);}else{logger[_0x1901('0xd')](_0x1901('0xe'),_0x30246e,'request\x20sent');_0xa94186(_0x51082d[_0x1901('0x16')]['message']);}})[_0x1901('0x17')](function(_0xf5748a){logger[_0x1901('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x30246e,_0xf5748a);_0x3f2260(_0xf5748a);});});}exports[_0x1901('0x18')]=function(_0x13063b){var _0x18298c=this;return new Promise(function(_0x14402b,_0x31a2cf){return db[_0x1901('0x19')][_0x1901('0x1a')](_0x13063b['body'],{'raw':_0x13063b[_0x1901('0x1b')]?_0x13063b['options'][_0x1901('0x1c')]===undefined?!![]:![]:!![]})[_0x1901('0xc')](function(_0x2a0586){logger[_0x1901('0xd')]('CreateCmHopperHistory',_0x13063b);logger[_0x1901('0x10')]('CreateCmHopperHistory',_0x13063b,JSON[_0x1901('0x12')](_0x2a0586));_0x14402b(_0x2a0586);})[_0x1901('0x17')](function(_0x1c98e9){logger['error'](_0x1901('0x18'),_0x1c98e9['message'],_0x13063b);_0x31a2cf(_0x18298c[_0x1901('0x13')](0x1f4,_0x1c98e9[_0x1901('0x15')]));});});};exports['AvgHandleTime']=function(_0x54f617){var _0x3b59e5=this;return new Promise(function(_0x27b941,_0x56c8f7){return db[_0x1901('0x19')]['findAll']({'raw':_0x54f617[_0x1901('0x1b')]?_0x54f617[_0x1901('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x54f617[_0x1901('0x1b')]?_0x54f617[_0x1901('0x1b')][_0x1901('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')][_0x1901('0x20')]('id')),_0x1901('0x21')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x23')))),_0x1901('0x24')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x1901('0x25')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x26')))),_0x1901('0x27')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x28'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x29')))),_0x1901('0x2a')],[db['sequelize']['fn'](_0x1901('0x28'),db['sequelize']['fn']('IF',db[_0x1901('0x1f')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1901('0x2b')]]})['then'](function(_0x4929fb){logger['info']('AvgHandleTime',_0x54f617);logger[_0x1901('0x10')]('AvgHandleTime',_0x54f617,JSON[_0x1901('0x12')](_0x4929fb));_0x27b941(_0x4929fb);})[_0x1901('0x17')](function(_0x51a798){logger['error']('AvgHandleTime',_0x51a798[_0x1901('0x15')],_0x54f617);_0x56c8f7(_0x3b59e5[_0x1901('0x13')](0x1f4,_0x51a798[_0x1901('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x93a64f){var _0x281070=this;return new Promise(function(_0x5d27fb,_0x1e8980){return db[_0x1901('0x19')][_0x1901('0x2c')]({'raw':_0x93a64f[_0x1901('0x1b')]?_0x93a64f[_0x1901('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x93a64f['options']?_0x93a64f[_0x1901('0x1b')][_0x1901('0x1d')]||null:null,'attributes':[['campaign','name'],[db[_0x1901('0x1f')]['fn']('COUNT',db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x2d')))),_0x1901('0x2e')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x1901('0x2f')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1901('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x1901('0x30')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x31')))),_0x1901('0x32')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')]['literal'](_0x1901('0x33')))),_0x1901('0x34')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db['sequelize'][_0x1901('0x22')](_0x1901('0x35')))),_0x1901('0x36')],[db['sequelize']['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')]['literal'](_0x1901('0x37')))),_0x1901('0x38')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x39')))),'outboundUnknownCallsDay'],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')]['literal'](_0x1901('0x3a')))),'outboundBlacklistCallsDay'],[db[_0x1901('0x1f')]['fn']('COUNT',db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x3b')))),_0x1901('0x3c')],[db['sequelize']['fn'](_0x1901('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x1901('0x22')](_0x1901('0x3d')))),_0x1901('0x3e')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db['sequelize']['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')](_0x1901('0x3f')))),_0x1901('0x40')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')]['literal'](_0x1901('0x41')))),_0x1901('0x3e')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db['sequelize']['fn']('IF',db[_0x1901('0x1f')][_0x1901('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x1901('0x42')]})[_0x1901('0xc')](function(_0x163d9b){logger[_0x1901('0xd')](_0x1901('0x43'),_0x93a64f);logger[_0x1901('0x10')](_0x1901('0x43'),_0x93a64f,JSON['stringify'](_0x163d9b));_0x5d27fb(_0x163d9b);})[_0x1901('0x17')](function(_0x577187){logger[_0x1901('0x13')](_0x1901('0x43'),_0x577187[_0x1901('0x15')],_0x93a64f);_0x1e8980(_0x281070['error'](0x1f4,_0x577187[_0x1901('0x15')]));});});};exports[_0x1901('0x44')]=function(_0x3da60c){var _0xf3cfad=this;return new Promise(function(_0x4e588d,_0x4495cc){return db[_0x1901('0x19')]['findAll']({'raw':_0x3da60c[_0x1901('0x1b')]?_0x3da60c[_0x1901('0x1b')][_0x1901('0x1c')]===undefined?!![]:![]:!![],'where':_0x3da60c['options']?_0x3da60c['options'][_0x1901('0x1d')]||null:null,'attributes':[[_0x1901('0x42'),_0x1901('0x45')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')][_0x1901('0x20')]('id')),_0x1901('0x46')],[db[_0x1901('0x1f')]['fn'](_0x1901('0x1e'),db[_0x1901('0x1f')]['fn']('IF',db[_0x1901('0x1f')]['literal'](_0x1901('0x23')))),_0x1901('0x47')]],'group':[_0x1901('0x42')]})[_0x1901('0xc')](function(_0x4f1dd9){logger[_0x1901('0xd')](_0x1901('0x44'),_0x3da60c);logger[_0x1901('0x10')](_0x1901('0x44'),_0x3da60c,JSON[_0x1901('0x12')](_0x4f1dd9));_0x4e588d(_0x4f1dd9);})[_0x1901('0x17')](function(_0x13d4ad){logger[_0x1901('0x13')](_0x1901('0x44'),_0x13d4ad[_0x1901('0x15')],_0x3da60c);_0x4495cc(_0xf3cfad[_0x1901('0x13')](0x1f4,_0x13d4ad[_0x1901('0x15')]));});});}; \ No newline at end of file +var _0x634d=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit'];(function(_0x547646,_0x32c386){var _0x25f8b2=function(_0x2f2ff9){while(--_0x2f2ff9){_0x547646['push'](_0x547646['shift']());}};_0x25f8b2(++_0x32c386);}(_0x634d,0x120));var _0xd634=function(_0x1e5e14,_0x4010e3){_0x1e5e14=_0x1e5e14-0x0;var _0x442cd4=_0x634d[_0x1e5e14];return _0x442cd4;};'use strict';var _=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var moment=require(_0xd634('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd634('0x3'))['db'];var utils=require(_0xd634('0x4'));var logger=require(_0xd634('0x5'))('rpc');var config=require(_0xd634('0x6'));var jayson=require(_0xd634('0x7'));var client=jayson['client'][_0xd634('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c930f,_0x121b88,_0x10c5d2){return new BPromise(function(_0x11b091,_0x14bfc7){return client['request'](_0x5c930f,_0x10c5d2)[_0xd634('0x9')](function(_0x38bb9e){logger['info'](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));logger['debug'](_0xd634('0xc'),_0x121b88,'request\x20sent',JSON['stringify'](_0x38bb9e));if(_0x38bb9e['error']){if(_0x38bb9e[_0xd634('0xd')][_0xd634('0xe')]===0x1f4){logger[_0xd634('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x121b88,_0x38bb9e['error'][_0xd634('0xf')]);return _0x14bfc7(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}logger['error'](_0xd634('0xa'),_0x121b88,_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);return _0x11b091(_0x38bb9e[_0xd634('0xd')][_0xd634('0xf')]);}else{logger[_0xd634('0x10')](_0xd634('0xa'),_0x121b88,_0xd634('0xb'));_0x11b091(_0x38bb9e[_0xd634('0x11')]['message']);}})[_0xd634('0x12')](function(_0x123c26){logger[_0xd634('0xd')](_0xd634('0xa'),_0x121b88,_0x123c26);_0x14bfc7(_0x123c26);});});}exports[_0xd634('0x13')]=function(_0x271fa2){var _0x1a9696=this;return new Promise(function(_0x16ee0a,_0x17c604){return db[_0xd634('0x14')]['create'](_0x271fa2[_0xd634('0x15')],{'raw':_0x271fa2[_0xd634('0x16')]?_0x271fa2[_0xd634('0x16')][_0xd634('0x17')]===undefined?!![]:![]:!![]})[_0xd634('0x9')](function(_0x1f904d){logger[_0xd634('0x10')](_0xd634('0x13'),_0x271fa2);logger[_0xd634('0x18')](_0xd634('0x13'),_0x271fa2,JSON['stringify'](_0x1f904d));_0x16ee0a(_0x1f904d);})['catch'](function(_0x2c1bf2){logger[_0xd634('0xd')](_0xd634('0x13'),_0x2c1bf2['message'],_0x271fa2);_0x17c604(_0x1a9696[_0xd634('0xd')](0x1f4,_0x2c1bf2[_0xd634('0xf')]));});});};exports['AvgHandleTime']=function(_0x51509c){var _0x34fdae=this;return new Promise(function(_0x560111,_0x4e2b8c){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x51509c[_0xd634('0x16')]?_0x51509c['options']['raw']===undefined?!![]:![]:!![],'where':_0x51509c[_0xd634('0x16')]?_0x51509c['options'][_0xd634('0x1a')]||null:null,'attributes':[[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')][_0xd634('0x1d')]('id')),_0xd634('0x1e')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x20')))),_0xd634('0x21')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x22')))),_0xd634('0x23')],[db[_0xd634('0x1b')]['fn']('COUNT',db[_0xd634('0x1b')]['fn']('IF',db['sequelize'][_0xd634('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0xd634('0x24')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x25'),db['sequelize']['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x26')))),_0xd634('0x27')],[db['sequelize']['fn'](_0xd634('0x25'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x28')))),_0xd634('0x29')]]})[_0xd634('0x9')](function(_0x13cc54){logger['info'](_0xd634('0x2a'),_0x51509c);logger[_0xd634('0x18')]('AvgHandleTime',_0x51509c,JSON['stringify'](_0x13cc54));_0x560111(_0x13cc54);})['catch'](function(_0x2a55ba){logger[_0xd634('0xd')](_0xd634('0x2a'),_0x2a55ba[_0xd634('0xf')],_0x51509c);_0x4e2b8c(_0x34fdae[_0xd634('0xd')](0x1f4,_0x2a55ba[_0xd634('0xf')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2fa9c6){var _0xff6d26=this;return new Promise(function(_0x3278d2,_0x1c7a21){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x2fa9c6[_0xd634('0x16')]?_0x2fa9c6[_0xd634('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2fa9c6[_0xd634('0x16')]?_0x2fa9c6['options'][_0xd634('0x1a')]||null:null,'attributes':[[_0xd634('0x2b'),_0xd634('0x2c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal'](_0xd634('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x20')))),'outboundAnswerCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x2f')))),_0xd634('0x30')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')]['literal'](_0xd634('0x31')))),_0xd634('0x32')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x33')))),_0xd634('0x34')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x35')))),_0xd634('0x36')],[db['sequelize']['fn'](_0xd634('0x1c'),db['sequelize']['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x37')))),_0xd634('0x38')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x39')))),_0xd634('0x3a')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x3b')))),_0xd634('0x3c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')](_0xd634('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0xd634('0x3c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xd634('0x3e')]],'group':[_0xd634('0x2b')]})[_0xd634('0x9')](function(_0x4ccd58){logger[_0xd634('0x10')](_0xd634('0x3f'),_0x2fa9c6);logger[_0xd634('0x18')](_0xd634('0x3f'),_0x2fa9c6,JSON['stringify'](_0x4ccd58));_0x3278d2(_0x4ccd58);})['catch'](function(_0x604290){logger[_0xd634('0xd')](_0xd634('0x3f'),_0x604290[_0xd634('0xf')],_0x2fa9c6);_0x1c7a21(_0xff6d26[_0xd634('0xd')](0x1f4,_0x604290['message']));});});};exports[_0xd634('0x40')]=function(_0x28459b){var _0xc503e6=this;return new Promise(function(_0x50a387,_0x3a7338){return db[_0xd634('0x14')][_0xd634('0x19')]({'raw':_0x28459b['options']?_0x28459b['options'][_0xd634('0x17')]===undefined?!![]:![]:!![],'where':_0x28459b[_0xd634('0x16')]?_0x28459b[_0xd634('0x16')][_0xd634('0x1a')]||null:null,'attributes':[[_0xd634('0x2b'),_0xd634('0x2c')],[db[_0xd634('0x1b')]['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')][_0xd634('0x1d')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xd634('0x1c'),db[_0xd634('0x1b')]['fn']('IF',db[_0xd634('0x1b')][_0xd634('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xd634('0x9')](function(_0x2f9117){logger['info'](_0xd634('0x40'),_0x28459b);logger['debug'](_0xd634('0x40'),_0x28459b,JSON['stringify'](_0x2f9117));_0x50a387(_0x2f9117);})[_0xd634('0x12')](function(_0x5a9f8f){logger[_0xd634('0xd')](_0xd634('0x40'),_0x5a9f8f[_0xd634('0xf')],_0x28459b);_0x3a7338(_0xc503e6[_0xd634('0xd')](0x1f4,_0x5a9f8f[_0xd634('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 547d41d..d83ce9d 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 _0x0721=['post','create','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x33a86b,_0x77c146){var _0x4e3bf1=function(_0x2cee43){while(--_0x2cee43){_0x33a86b['push'](_0x33a86b['shift']());}};_0x4e3bf1(++_0x77c146);}(_0x0721,0x1bd));var _0x1072=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0x0721[_0x5e7e1a];return _0x46b94f;};'use strict';var multer=require(_0x1072('0x0'));var util=require(_0x1072('0x1'));var path=require('path');var timeout=require(_0x1072('0x2'));var express=require(_0x1072('0x3'));var router=express[_0x1072('0x4')]();var fs_extra=require(_0x1072('0x5'));var auth=require(_0x1072('0x6'));var interaction=require(_0x1072('0x7'));var config=require(_0x1072('0x8'));var controller=require(_0x1072('0x9'));router[_0x1072('0xa')]('/',auth[_0x1072('0xb')](),controller[_0x1072('0xc')]);router['get'](_0x1072('0xd'),auth[_0x1072('0xb')](),controller[_0x1072('0xe')]);router[_0x1072('0xa')](_0x1072('0xf'),auth[_0x1072('0xb')](),controller[_0x1072('0x10')]);router[_0x1072('0x11')]('/',auth[_0x1072('0xb')](),controller[_0x1072('0x12')]);router[_0x1072('0x13')](_0x1072('0xf'),auth[_0x1072('0xb')](),controller[_0x1072('0x14')]);module[_0x1072('0x15')]=router; \ No newline at end of file +var _0x804c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','exports','multer','util','path'];(function(_0x2e1416,_0x1c1fb4){var _0x134b42=function(_0x259591){while(--_0x259591){_0x2e1416['push'](_0x2e1416['shift']());}};_0x134b42(++_0x1c1fb4);}(_0x804c,0x115));var _0xc804=function(_0x58a3f6,_0x279eca){_0x58a3f6=_0x58a3f6-0x0;var _0x2ba99b=_0x804c[_0x58a3f6];return _0x2ba99b;};'use strict';var multer=require(_0xc804('0x0'));var util=require(_0xc804('0x1'));var path=require(_0xc804('0x2'));var timeout=require(_0xc804('0x3'));var express=require(_0xc804('0x4'));var router=express[_0xc804('0x5')]();var fs_extra=require(_0xc804('0x6'));var auth=require(_0xc804('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc804('0x8'));var controller=require(_0xc804('0x9'));router[_0xc804('0xa')]('/',auth[_0xc804('0xb')](),controller['index']);router[_0xc804('0xa')](_0xc804('0xc'),auth[_0xc804('0xb')](),controller[_0xc804('0xd')]);router[_0xc804('0xa')](_0xc804('0xe'),auth['isAuthenticated'](),controller[_0xc804('0xf')]);router[_0xc804('0x10')]('/',auth['isAuthenticated'](),controller[_0xc804('0x11')]);router[_0xc804('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xc804('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b19ed1f..3428027 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 _0x6c32=['STRING','name','sequelize','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x26c3('0x0'));module[_0x26c3('0x1')]={'name':{'type':Sequelize[_0x26c3('0x2')],'unique':_0x26c3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26c3('0x2')]},'dialPrefix':{'type':Sequelize[_0x26c3('0x2')]}}; \ No newline at end of file +var _0x6737=['exports','STRING'];(function(_0x54ab28,_0x16bc07){var _0x251a4f=function(_0x573910){while(--_0x573910){_0x54ab28['push'](_0x54ab28['shift']());}};_0x251a4f(++_0x16bc07);}(_0x6737,0xe2));var _0x7673=function(_0x1ebe91,_0x2ed5ec){_0x1ebe91=_0x1ebe91-0x0;var _0x4e87f2=_0x6737[_0x1ebe91];return _0x4e87f2;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'name':{'type':Sequelize[_0x7673('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7673('0x1')]},'dialPrefix':{'type':Sequelize[_0x7673('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 5d6c614..ca4a07d 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 _0xd33f=['register','sendStatus','status','offset','undefined','count','Content-Range','json','reject','then','destroy','get','Lists','end','error','name','index','map','CmList','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','findAll','rows','show','includeAll','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','length','include','removeDispositions','addContacts','CmContact','tags','isArray','join','each','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','format','raw','now','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket'];(function(_0x3434bb,_0x1c576b){var _0xe558f8=function(_0x525b45){while(--_0x525b45){_0x3434bb['push'](_0x3434bb['shift']());}};_0xe558f8(++_0x1c576b);}(_0xd33f,0x78));var _0xfd33=function(_0x1115aa,_0x2448e8){_0x1115aa=_0x1115aa-0x0;var _0x25be29=_0xd33f[_0x1115aa];return _0x25be29;};'use strict';var emlformat=require(_0xfd33('0x0'));var rimraf=require(_0xfd33('0x1'));var zipdir=require(_0xfd33('0x2'));var jsonpatch=require(_0xfd33('0x3'));var rp=require(_0xfd33('0x4'));var moment=require(_0xfd33('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfd33('0x6'));var util=require(_0xfd33('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfd33('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd33('0x9'));var _=require(_0xfd33('0xa'));var squel=require(_0xfd33('0xb'));var crypto=require(_0xfd33('0xc'));var jsforce=require(_0xfd33('0xd'));var deskjs=require(_0xfd33('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfd33('0xf'));var Papa=require(_0xfd33('0x10'));var Redis=require(_0xfd33('0x11'));var authService=require(_0xfd33('0x12'));var qs=require(_0xfd33('0x13'));var as=require(_0xfd33('0x14'));var hardwareService=require(_0xfd33('0x15'));var logger=require('../../config/logger')(_0xfd33('0x16'));var utils=require(_0xfd33('0x17'));var config=require(_0xfd33('0x18'));var licenseUtil=require(_0xfd33('0x19'));var db=require('../../mysqldb')['db'];config[_0xfd33('0x1a')]=_[_0xfd33('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfd33('0x1c'))(new Redis(config[_0xfd33('0x1a')]));require(_0xfd33('0x1d'))[_0xfd33('0x1e')](socket);function respondWithStatusCode(_0x1796b1,_0x5a034c){_0x5a034c=_0x5a034c||0xcc;return function(_0x3133f8){if(_0x3133f8){return _0x1796b1[_0xfd33('0x1f')](_0x5a034c);}return _0x1796b1[_0xfd33('0x20')](_0x5a034c)['end']();};}function respondWithResult(_0xf15b1e,_0x16117a){_0x16117a=_0x16117a||0xc8;return function(_0x1c105f){if(_0x1c105f){return _0xf15b1e[_0xfd33('0x20')](_0x16117a)['json'](_0x1c105f);}};}function respondWithFilteredResult(_0x84f925,_0x134606){return function(_0x576991){if(_0x576991){var _0x3415fb=typeof _0x134606[_0xfd33('0x21')]===_0xfd33('0x22')&&typeof _0x134606['limit']===_0xfd33('0x22');var _0x2c5fd5=_0x576991[_0xfd33('0x23')];var _0x141d36=_0x3415fb?0x0:_0x134606[_0xfd33('0x21')];var _0x1f23f1=_0x3415fb?_0x576991[_0xfd33('0x23')]:_0x134606[_0xfd33('0x21')]+_0x134606['limit'];var _0x134a30;if(_0x1f23f1>=_0x2c5fd5){_0x1f23f1=_0x2c5fd5;_0x134a30=0xc8;}else{_0x134a30=0xce;}_0x84f925[_0xfd33('0x20')](_0x134a30);return _0x84f925['set'](_0xfd33('0x24'),_0x141d36+'-'+_0x1f23f1+'/'+_0x2c5fd5)[_0xfd33('0x25')](_0x576991);}return null;};}function patchUpdates(_0x53f957){return function(_0x216d92){try{jsonpatch['apply'](_0x216d92,_0x53f957,!![]);}catch(_0x4e5ca7){return BPromise[_0xfd33('0x26')](_0x4e5ca7);}return _0x216d92['save']();};}function saveUpdates(_0x5c1ce0,_0x2a46bd){return function(_0xbe7258){if(_0xbe7258){return _0xbe7258['update'](_0x5c1ce0)[_0xfd33('0x27')](function(_0x8e656a){return _0x8e656a;});}return null;};}function removeEntity(_0x51dc9a,_0x127650){return function(_0x437232){if(_0x437232){return _0x437232[_0xfd33('0x28')]()['then'](function(){var _0xee8342=_0x437232[_0xfd33('0x29')]({'plain':!![]});var _0x23d272=_0xfd33('0x2a');return db['UserProfileResource'][_0xfd33('0x28')]({'where':{'type':_0x23d272,'resourceId':_0xee8342['id']}})[_0xfd33('0x27')](function(){return _0x437232;});})[_0xfd33('0x27')](function(){_0x51dc9a['status'](0xcc)[_0xfd33('0x2b')]();});}};}function handleEntityNotFound(_0x374bd6,_0x6efb58){return function(_0x5050d3){if(!_0x5050d3){_0x374bd6['sendStatus'](0x194);}return _0x5050d3;};}function handleError(_0x2ba654,_0x5435e0){_0x5435e0=_0x5435e0||0x1f4;return function(_0x2792da){logger[_0xfd33('0x2c')](_0x2792da['stack']);if(_0x2792da[_0xfd33('0x2d')]){delete _0x2792da[_0xfd33('0x2d')];}_0x2ba654[_0xfd33('0x20')](_0x5435e0)['send'](_0x2792da);};}exports[_0xfd33('0x2e')]=function(_0x366ffa,_0x1c96bd){var _0x2986ba={},_0x343f30={},_0x4dd349={'count':0x0,'rows':[]};var _0x190a6b=_[_0xfd33('0x2f')](db[_0xfd33('0x30')][_0xfd33('0x31')],function(_0x2c1240){return{'name':_0x2c1240[_0xfd33('0x32')],'type':_0x2c1240['type']['key']};});_0x343f30[_0xfd33('0x33')]=_[_0xfd33('0x2f')](_0x190a6b,'name');_0x343f30[_0xfd33('0x34')]=_[_0xfd33('0x35')](_0x366ffa[_0xfd33('0x34')]);_0x343f30['filters']=_[_0xfd33('0x36')](_0x343f30[_0xfd33('0x33')],_0x343f30[_0xfd33('0x34')]);_0x2986ba[_0xfd33('0x37')]=_[_0xfd33('0x36')](_0x343f30[_0xfd33('0x33')],qs[_0xfd33('0x38')](_0x366ffa[_0xfd33('0x34')][_0xfd33('0x38')]));_0x2986ba['attributes']=_0x2986ba[_0xfd33('0x37')]['length']?_0x2986ba['attributes']:_0x343f30[_0xfd33('0x33')];if(!_0x366ffa[_0xfd33('0x34')][_0xfd33('0x39')](_0xfd33('0x3a'))){_0x2986ba[_0xfd33('0x3b')]=qs[_0xfd33('0x3b')](_0x366ffa[_0xfd33('0x34')]['limit']);_0x2986ba[_0xfd33('0x21')]=qs['offset'](_0x366ffa[_0xfd33('0x34')]['offset']);}_0x2986ba[_0xfd33('0x3c')]=qs[_0xfd33('0x3d')](_0x366ffa[_0xfd33('0x34')]['sort']);_0x2986ba['where']=qs[_0xfd33('0x3e')](_[_0xfd33('0x3f')](_0x366ffa[_0xfd33('0x34')],_0x343f30[_0xfd33('0x3e')]),_0x190a6b);if(_0x366ffa['query']['filter']){_0x2986ba[_0xfd33('0x40')]=_['merge'](_0x2986ba[_0xfd33('0x40')],{'$or':_[_0xfd33('0x2f')](_0x190a6b,function(_0x1e982d){if(_0x1e982d['type']!==_0xfd33('0x41')){var _0x1ad688={};_0x1ad688[_0x1e982d['name']]={'$like':'%'+_0x366ffa[_0xfd33('0x34')][_0xfd33('0x42')]+'%'};return _0x1ad688;}})});}_0x2986ba=_[_0xfd33('0x43')]({},_0x2986ba,_0x366ffa[_0xfd33('0x44')]);var _0x46aafb={'where':_0x2986ba[_0xfd33('0x40')]};return db['CmList'][_0xfd33('0x23')](_0x46aafb)[_0xfd33('0x27')](function(_0x322c09){_0x4dd349[_0xfd33('0x23')]=_0x322c09;if(_0x366ffa[_0xfd33('0x34')]['includeAll']){_0x2986ba['include']=[{'all':!![]}];}return db[_0xfd33('0x30')][_0xfd33('0x45')](_0x2986ba);})['then'](function(_0x39f0e0){_0x4dd349[_0xfd33('0x46')]=_0x39f0e0;return _0x4dd349;})[_0xfd33('0x27')](respondWithFilteredResult(_0x1c96bd,_0x2986ba))['catch'](handleError(_0x1c96bd,null));};exports[_0xfd33('0x47')]=function(_0x2d0e7c,_0x46cbf7){var _0x4c89bc={'raw':![],'where':{'id':_0x2d0e7c['params']['id']}},_0x485979={};_0x485979[_0xfd33('0x33')]=_[_0xfd33('0x35')](db['CmList'][_0xfd33('0x31')]);_0x485979[_0xfd33('0x34')]=_[_0xfd33('0x35')](_0x2d0e7c['query']);_0x485979['filters']=_[_0xfd33('0x36')](_0x485979[_0xfd33('0x33')],_0x485979[_0xfd33('0x34')]);_0x4c89bc['attributes']=_[_0xfd33('0x36')](_0x485979[_0xfd33('0x33')],qs['fields'](_0x2d0e7c[_0xfd33('0x34')][_0xfd33('0x38')]));_0x4c89bc[_0xfd33('0x37')]=_0x4c89bc[_0xfd33('0x37')]['length']?_0x4c89bc[_0xfd33('0x37')]:_0x485979[_0xfd33('0x33')];if(_0x2d0e7c[_0xfd33('0x34')][_0xfd33('0x48')]){_0x4c89bc['include']=[{'all':!![]}];}_0x4c89bc=_['merge']({},_0x4c89bc,_0x2d0e7c['options']);return db['CmList'][_0xfd33('0x49')](_0x4c89bc)[_0xfd33('0x27')](handleEntityNotFound(_0x46cbf7,null))[_0xfd33('0x27')](respondWithResult(_0x46cbf7,null))[_0xfd33('0x4a')](handleError(_0x46cbf7,null));};exports[_0xfd33('0x4b')]=function(_0x149f65,_0x18dd98){return db[_0xfd33('0x30')][_0xfd33('0x4b')](_0x149f65[_0xfd33('0x4c')],{})['then'](function(_0xefc4ea){var _0x11aca0=_0x149f65[_0xfd33('0x4d')][_0xfd33('0x29')]({'plain':!![]});if(!_0x11aca0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11aca0[_0xfd33('0x4e')]===_0xfd33('0x4d')){var _0x1f66ab=_0xefc4ea[_0xfd33('0x29')]({'plain':!![]});var _0x34fb31=_0xfd33('0x2a');return db[_0xfd33('0x4f')]['find']({'where':{'name':_0x34fb31,'userProfileId':_0x11aca0[_0xfd33('0x50')]},'raw':!![]})[_0xfd33('0x27')](function(_0x216d09){if(_0x216d09&&_0x216d09[_0xfd33('0x51')]===0x0){return db[_0xfd33('0x52')][_0xfd33('0x4b')]({'name':_0x1f66ab[_0xfd33('0x2d')],'resourceId':_0x1f66ab['id'],'type':_0x216d09[_0xfd33('0x2d')],'sectionId':_0x216d09['id']},{})[_0xfd33('0x27')](function(){return _0xefc4ea;});}else{return _0xefc4ea;}})[_0xfd33('0x4a')](function(_0x45ea83){logger[_0xfd33('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45ea83);throw _0x45ea83;});}return _0xefc4ea;})[_0xfd33('0x27')](respondWithResult(_0x18dd98,0xc9))[_0xfd33('0x4a')](handleError(_0x18dd98,null));};exports[_0xfd33('0x53')]=function(_0x1c8d46,_0x17effd){if(_0x1c8d46[_0xfd33('0x4c')]['id']){delete _0x1c8d46[_0xfd33('0x4c')]['id'];}return db[_0xfd33('0x30')][_0xfd33('0x49')]({'where':{'id':_0x1c8d46['params']['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x17effd,null))[_0xfd33('0x27')](saveUpdates(_0x1c8d46['body'],null))[_0xfd33('0x27')](respondWithResult(_0x17effd,null))[_0xfd33('0x4a')](handleError(_0x17effd,null));};exports[_0xfd33('0x28')]=function(_0x52a8fb,_0xbedc93){return db[_0xfd33('0x30')][_0xfd33('0x49')]({'where':{'id':_0x52a8fb[_0xfd33('0x54')]['id']}})['then'](handleEntityNotFound(_0xbedc93,null))[_0xfd33('0x27')](removeEntity(_0xbedc93,null))[_0xfd33('0x4a')](handleError(_0xbedc93,null));};exports['describe']=function(_0x5c799d,_0x2e8c72){return db[_0xfd33('0x30')][_0xfd33('0x55')]()[_0xfd33('0x27')](respondWithResult(_0x2e8c72,null))[_0xfd33('0x4a')](handleError(_0x2e8c72,null));};exports[_0xfd33('0x56')]=function(_0x42b211,_0x4d7f3c,_0x90d078){if(_0x42b211[_0xfd33('0x4c')]['id']){delete _0x42b211[_0xfd33('0x4c')]['id'];}return db['CmList'][_0xfd33('0x49')]({'where':{'id':_0x42b211[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x4d7f3c,null))[_0xfd33('0x27')](function(_0x164c67){if(_0x164c67){_0x42b211[_0xfd33('0x4c')][_0xfd33('0x57')]=_0x164c67['id'];return db[_0xfd33('0x58')][_0xfd33('0x4b')](_0x42b211[_0xfd33('0x4c')]);}})[_0xfd33('0x27')](respondWithResult(_0x4d7f3c,null))[_0xfd33('0x4a')](handleError(_0x4d7f3c,null));};exports[_0xfd33('0x59')]=function(_0x52fe9f,_0x21fcfe,_0x2e2a1e){var _0x2d2fdf={'raw':![],'where':{}};var _0x4f9901={};var _0x3555ce={'count':0x0,'rows':[]};return db['CmList'][_0xfd33('0x5a')]({'where':{'id':_0x52fe9f['params']['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x21fcfe,null))[_0xfd33('0x27')](function(_0x33f8e1){if(_0x33f8e1){_0x4f9901[_0xfd33('0x33')]=_['keys'](db['Disposition'][_0xfd33('0x31')]);_0x4f9901[_0xfd33('0x34')]=_[_0xfd33('0x35')](_0x52fe9f['query']);_0x4f9901[_0xfd33('0x3e')]=_[_0xfd33('0x36')](_0x4f9901[_0xfd33('0x33')],_0x4f9901[_0xfd33('0x34')]);_0x2d2fdf[_0xfd33('0x37')]=_[_0xfd33('0x36')](_0x4f9901[_0xfd33('0x33')],qs[_0xfd33('0x38')](_0x52fe9f[_0xfd33('0x34')][_0xfd33('0x38')]));_0x2d2fdf[_0xfd33('0x37')]=_0x2d2fdf[_0xfd33('0x37')][_0xfd33('0x5b')]?_0x2d2fdf['attributes']:_0x4f9901['model'];if(!_0x52fe9f[_0xfd33('0x34')][_0xfd33('0x39')](_0xfd33('0x3a'))){_0x2d2fdf['limit']=qs[_0xfd33('0x3b')](_0x52fe9f['query'][_0xfd33('0x3b')]);_0x2d2fdf[_0xfd33('0x21')]=qs[_0xfd33('0x21')](_0x52fe9f['query'][_0xfd33('0x21')]);}_0x2d2fdf['order']=qs[_0xfd33('0x3d')](_0x52fe9f[_0xfd33('0x34')]['sort']);_0x2d2fdf['where']=qs['filters'](_[_0xfd33('0x3f')](_0x52fe9f[_0xfd33('0x34')],_0x4f9901['filters']));_0x2d2fdf[_0xfd33('0x40')][_0xfd33('0x57')]=_0x33f8e1['id'];if(_0x52fe9f[_0xfd33('0x34')]['filter']){_0x2d2fdf[_0xfd33('0x40')]=_[_0xfd33('0x43')](_0x2d2fdf['where'],{'$or':_['map'](_0x2d2fdf[_0xfd33('0x37')],function(_0x55556f){var _0x4954ff={};_0x4954ff[_0x55556f]={'$like':'%'+_0x52fe9f[_0xfd33('0x34')][_0xfd33('0x42')]+'%'};return _0x4954ff;})});}_0x2d2fdf=_[_0xfd33('0x43')]({},_0x2d2fdf,_0x52fe9f['options']);return db[_0xfd33('0x58')][_0xfd33('0x23')]({'where':_0x2d2fdf[_0xfd33('0x40')]})[_0xfd33('0x27')](function(_0x47b3c2){_0x3555ce['count']=_0x47b3c2;if(_0x52fe9f[_0xfd33('0x34')]['includeAll']){_0x2d2fdf[_0xfd33('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0xfd33('0x45')](_0x2d2fdf);})['then'](function(_0x38f88a){_0x3555ce[_0xfd33('0x46')]=_0x38f88a;return _0x3555ce;});}})['then'](respondWithFilteredResult(_0x21fcfe,_0x2d2fdf))['catch'](handleError(_0x21fcfe,null));};exports[_0xfd33('0x5d')]=function(_0x4b7f1c,_0xb9c10d,_0x4744f2){return db[_0xfd33('0x30')][_0xfd33('0x49')]({'where':{'id':_0x4b7f1c[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0xb9c10d,null))[_0xfd33('0x27')](function(_0x545e5e){if(_0x545e5e){return _0x545e5e[_0xfd33('0x5d')](_0x4b7f1c[_0xfd33('0x34')]['ids']);}})[_0xfd33('0x27')](respondWithStatusCode(_0xb9c10d,null))[_0xfd33('0x4a')](handleError(_0xb9c10d,null));};exports[_0xfd33('0x5e')]=function(_0x3bfe77,_0x25d9c8,_0xe2f846){return db[_0xfd33('0x30')]['find']({'where':{'id':_0x3bfe77[_0xfd33('0x54')]['id']}})['then'](handleEntityNotFound(_0x25d9c8,null))[_0xfd33('0x27')](function(_0x4f9bd3){if(_0x4f9bd3){var _0x35f977=[];var _0x1287af={'success':[],'errors':[]};return db[_0xfd33('0x5f')][_0xfd33('0x55')]()[_0xfd33('0x27')](function(_0x50c687){if(_0x3bfe77[_0xfd33('0x4c')][_0xfd33('0x60')]&&_[_0xfd33('0x61')](_0x3bfe77[_0xfd33('0x4c')][_0xfd33('0x60')])){if(_0x3bfe77['body']['tags'][_0xfd33('0x5b')]){_0x3bfe77['body'][_0xfd33('0x60')]=_0x3bfe77[_0xfd33('0x4c')][_0xfd33('0x60')][_0xfd33('0x62')](';')+';';}else{_0x3bfe77[_0xfd33('0x4c')][_0xfd33('0x60')]=null;}}else{_0x3bfe77[_0xfd33('0x4c')][_0xfd33('0x60')]=null;}if(_0x3bfe77[_0xfd33('0x4c')]&&_[_0xfd33('0x61')](_0x3bfe77['body'])){for(var _0x29da60=0x0;_0x29da60<_0x3bfe77['body'][_0xfd33('0x5b')];_0x29da60+=0x1){_0x3bfe77['body'][_0x29da60]['ListId']=_0x3bfe77[_0xfd33('0x54')]['id'];_0x35f977['push'](_0x3bfe77['body'][_0x29da60]);}return BPromise[_0xfd33('0x63')](_0x35f977,function(_0x3adb35){return db[_0xfd33('0x5f')][_0xfd33('0x4b')](_[_0xfd33('0x64')](_0x3adb35,[_0xfd33('0x65'),'id'])||{},{'fields':_[_0xfd33('0x35')](_0x50c687),'raw':!![]})[_0xfd33('0x27')](function(_0x1af6fe){_0x1287af[_0xfd33('0x66')]['push'](_0x1af6fe[_0xfd33('0x67')]);})[_0xfd33('0x4a')](function(_0x5398b2){_0x1287af[_0xfd33('0x68')][_0xfd33('0x69')]({'data':_0x3adb35,'error':_0x5398b2[_0xfd33('0x6a')]});});})[_0xfd33('0x27')](function(_0x276349){return _0x1287af;})[_0xfd33('0x4a')](function(_0x2bf640){return _0x2bf640;});}else{_0x25d9c8[_0xfd33('0x20')](0x190)[_0xfd33('0x25')]({'message':_0xfd33('0x6b')});}});}})[_0xfd33('0x27')](respondWithResult(_0x25d9c8,null))[_0xfd33('0x4a')](handleError(_0x25d9c8,null));};exports[_0xfd33('0x6c')]=function(_0x9ec23b,_0x4f4dd5,_0x175dad){var _0x6a314c;return db[_0xfd33('0x30')][_0xfd33('0x49')]({'where':{'id':_0x9ec23b[_0xfd33('0x54')]['id']},'include':[{'model':db[_0xfd33('0x6d')],'as':_0xfd33('0x6e')}]})['then'](handleEntityNotFound(_0x4f4dd5,null))[_0xfd33('0x27')](function(_0x27cbd4){if(_0x27cbd4){_0x6a314c=_0x27cbd4;return db[_0xfd33('0x5f')]['rawAttributes'];}})[_0xfd33('0x27')](function(_0x5194ae){if(_0x5194ae){var _0x39ef18={};var _0x140194={};_0x140194[_0xfd33('0x33')]=_[_0xfd33('0x6f')](_['keys'](_0x5194ae),_[_0xfd33('0x2f')](_0x6a314c['CustomFields'],function(_0x42c9fb){return util['format'](_0xfd33('0x70'),_0x42c9fb['id']);}));_0x140194['query']=_['keys'](_0x9ec23b[_0xfd33('0x34')]);_0x140194[_0xfd33('0x3e')]=_[_0xfd33('0x36')](_0x140194[_0xfd33('0x33')],_0x140194[_0xfd33('0x34')]);_0x39ef18[_0xfd33('0x37')]=_[_0xfd33('0x36')](_0x140194['model'],qs[_0xfd33('0x38')](_0x9ec23b['query'][_0xfd33('0x38')]));_0x39ef18[_0xfd33('0x37')]=_0x39ef18[_0xfd33('0x37')]['length']?_0x39ef18['attributes']:_0x140194[_0xfd33('0x33')];if(!_0x9ec23b[_0xfd33('0x34')][_0xfd33('0x39')](_0xfd33('0x3a'))){_0x39ef18[_0xfd33('0x3b')]=qs[_0xfd33('0x3b')](_0x9ec23b[_0xfd33('0x34')]['limit']);_0x39ef18[_0xfd33('0x21')]=qs[_0xfd33('0x21')](_0x9ec23b[_0xfd33('0x34')][_0xfd33('0x21')]);}_0x39ef18[_0xfd33('0x3c')]=qs[_0xfd33('0x3d')](_0x9ec23b[_0xfd33('0x34')][_0xfd33('0x3d')]);_0x39ef18['where']=qs[_0xfd33('0x3e')](_[_0xfd33('0x3f')](_0x9ec23b['query'],_0x140194[_0xfd33('0x3e')]));_0x39ef18['raw']=!![];if(_0x9ec23b['query']['filter']){_0x39ef18[_0xfd33('0x40')]=_['merge'](_0x39ef18['where'],{'$or':_[_0xfd33('0x2f')](_0x39ef18[_0xfd33('0x37')],function(_0x476c16){var _0x49eb4c={};_0x49eb4c[_0x476c16]={'$like':'%'+_0x9ec23b[_0xfd33('0x34')]['filter']+'%'};return _0x49eb4c;})});}_0x39ef18=_[_0xfd33('0x43')]({},_0x39ef18,_0x9ec23b['options']);return _0x6a314c[_0xfd33('0x6c')](_0x39ef18);}})[_0xfd33('0x27')](respondWithResult(_0x4f4dd5,null))[_0xfd33('0x4a')](handleError(_0x4f4dd5,null));};exports[_0xfd33('0x71')]=function(_0x566608,_0x2a621d,_0x155a2d){var _0x6c30a5;return db[_0xfd33('0x30')]['find']({'where':{'id':_0x566608[_0xfd33('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xfd33('0x6e')}]})['then'](handleEntityNotFound(_0x2a621d,null))[_0xfd33('0x27')](function(_0x39a4dc){if(_0x39a4dc){_0x6c30a5=_0x39a4dc;return db[_0xfd33('0x5f')][_0xfd33('0x31')];}})[_0xfd33('0x27')](function(_0x33b4a1){if(_0x33b4a1){var _0x5660a1={};var _0x5768cb={};_0x5768cb['model']=_['concat'](_[_0xfd33('0x35')](_0x33b4a1),_[_0xfd33('0x2f')](_0x6c30a5[_0xfd33('0x6e')],function(_0x4f1469){return util[_0xfd33('0x72')]('cf_%d',_0x4f1469['id']);}));_0x5768cb[_0xfd33('0x34')]=_[_0xfd33('0x35')](_0x566608[_0xfd33('0x34')]);_0x5768cb[_0xfd33('0x3e')]=_['intersection'](_0x5768cb['model'],_0x5768cb[_0xfd33('0x34')]);_0x5660a1[_0xfd33('0x37')]=_['intersection'](_0x5768cb['model'],qs[_0xfd33('0x38')](_0x566608[_0xfd33('0x34')][_0xfd33('0x38')]));_0x5660a1['attributes']=_0x5660a1[_0xfd33('0x37')]['length']?_0x5660a1[_0xfd33('0x37')]:_0x5768cb[_0xfd33('0x33')];if(!_0x566608[_0xfd33('0x34')][_0xfd33('0x39')](_0xfd33('0x3a'))){_0x5660a1[_0xfd33('0x3b')]=qs['limit'](_0x566608[_0xfd33('0x34')][_0xfd33('0x3b')]);_0x5660a1[_0xfd33('0x21')]=qs[_0xfd33('0x21')](_0x566608['query'][_0xfd33('0x21')]);}_0x5660a1[_0xfd33('0x3c')]=qs['sort'](_0x566608[_0xfd33('0x34')][_0xfd33('0x3d')]);_0x5660a1[_0xfd33('0x40')]=qs[_0xfd33('0x3e')](_[_0xfd33('0x3f')](_0x566608['query'],_0x5768cb[_0xfd33('0x3e')]));_0x5660a1[_0xfd33('0x73')]=!![];if(_0x566608[_0xfd33('0x34')][_0xfd33('0x42')]){_0x5660a1[_0xfd33('0x40')]=_['merge'](_0x5660a1[_0xfd33('0x40')],{'$or':_[_0xfd33('0x2f')](_0x5660a1['attributes'],function(_0x5ce2de){var _0x143f1a={};_0x143f1a[_0x5ce2de]={'$like':'%'+_0x566608[_0xfd33('0x34')][_0xfd33('0x42')]+'%'};return _0x143f1a;})});}_0x5660a1=_[_0xfd33('0x43')]({},_0x5660a1,_0x566608[_0xfd33('0x44')]);return _0x6c30a5[_0xfd33('0x6c')](_0x5660a1);}})[_0xfd33('0x27')](function(_0x1dd4de){if(!_['isEmpty'](_0x1dd4de)){var _0x2775c7=toCsv(_0x1dd4de);var _0x49517d=Date[_0xfd33('0x74')]();fs[_0xfd33('0x75')](util[_0xfd33('0x72')]('/tmp/list_%d_%s.csv',_0x6c30a5['id'],_0x49517d),_0x2775c7);_0x2a621d['setHeader'](_0xfd33('0x76'),_0xfd33('0x77')+util[_0xfd33('0x72')](_0xfd33('0x78'),_0x6c30a5['id'],_0x49517d));_0x2a621d[_0xfd33('0x79')](_0xfd33('0x7a'),_0xfd33('0x7b'));return _0x2a621d[_0xfd33('0x7c')](util[_0xfd33('0x72')](_0xfd33('0x7d'),_0x6c30a5['id'],_0x49517d));}else{return _0x2a621d[_0xfd33('0x1f')](0xcc);}})[_0xfd33('0x4a')](handleError(_0x2a621d,null));};exports[_0xfd33('0x7e')]=function(_0x4eba6c,_0x280adf,_0x4b4324){var _0x1ba6b6;delete _0x4eba6c[_0xfd33('0x4c')]['id'];return db[_0xfd33('0x30')]['findOne']({'where':{'id':_0x4eba6c[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x280adf,null))['then'](function(_0x506c98){if(_0x506c98){return db[_0xfd33('0x7f')]['transaction'](function(_0x2dc651){return db[_0xfd33('0x6d')]['create'](_0x4eba6c['body'],{'transaction':_0x2dc651})[_0xfd33('0x27')](function(_0x742734){_0x1ba6b6=_0x742734;return _0x506c98[_0xfd33('0x80')](_0x742734,{'transaction':_0x2dc651});})['then'](function(){var _0x11717c={'type':db[_0xfd33('0x81')][_0xfd33('0x82')],'transaction':_0x2dc651};switch(_0x4eba6c[_0xfd33('0x4c')][_0xfd33('0x83')]){case _0xfd33('0x84'):_0x11717c[_0xfd33('0x83')]=db[_0xfd33('0x81')][_0xfd33('0x82')];break;case _0xfd33('0x85'):_0x11717c[_0xfd33('0x83')]=db[_0xfd33('0x81')][_0xfd33('0x86')];break;case _0xfd33('0x87'):_0x11717c['type']=db['Sequelize'][_0xfd33('0x88')];_0x11717c[_0xfd33('0x89')]=![];break;default:}return db['sequelize'][_0xfd33('0x8a')]['addColumn'](_0xfd33('0x8b'),util['format'](_0xfd33('0x8c'),_0x1ba6b6['id']),_0x11717c);})[_0xfd33('0x27')](function(){return _0x1ba6b6;});});}})[_0xfd33('0x27')](respondWithResult(_0x280adf,null))['catch'](handleError(_0x280adf,null));};exports[_0xfd33('0x8d')]=function(_0x46d05a,_0x15c98a,_0x1c4377){var _0x2dfe91={};var _0x5a5b4d={};var _0x1f30ed;var _0x2d6518;return db['CmList'][_0xfd33('0x5a')]({'where':{'id':_0x46d05a['params']['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x15c98a,null))[_0xfd33('0x27')](function(_0x34aaf3){if(_0x34aaf3){_0x1f30ed=_0x34aaf3;_0x5a5b4d['model']=_[_0xfd33('0x35')](db['CmCustomField'][_0xfd33('0x31')]);_0x5a5b4d[_0xfd33('0x34')]=_['keys'](_0x46d05a[_0xfd33('0x34')]);_0x5a5b4d[_0xfd33('0x3e')]=_[_0xfd33('0x36')](_0x5a5b4d[_0xfd33('0x33')],_0x5a5b4d[_0xfd33('0x34')]);_0x2dfe91['attributes']=_[_0xfd33('0x36')](_0x5a5b4d[_0xfd33('0x33')],qs[_0xfd33('0x38')](_0x46d05a['query']['fields']));_0x2dfe91['attributes']=_0x2dfe91[_0xfd33('0x37')][_0xfd33('0x5b')]?_0x2dfe91[_0xfd33('0x37')]:_0x5a5b4d[_0xfd33('0x33')];_0x2dfe91['order']=qs['sort'](_0x46d05a[_0xfd33('0x34')][_0xfd33('0x3d')]);_0x2dfe91['where']=qs[_0xfd33('0x3e')](_[_0xfd33('0x3f')](_0x46d05a[_0xfd33('0x34')],_0x5a5b4d[_0xfd33('0x3e')]));_0x2dfe91[_0xfd33('0x40')]=_['merge'](_0x2dfe91[_0xfd33('0x40')],{'$or':[{'ListId':_0x34aaf3['id']},{'ListId':null}]});if(_0x46d05a[_0xfd33('0x34')]['filter']){_0x2dfe91['where']=_[_0xfd33('0x43')](_0x2dfe91[_0xfd33('0x40')],{'$or':_[_0xfd33('0x2f')](_0x2dfe91[_0xfd33('0x37')],function(_0x2a6217){var _0x59d3fb={};_0x59d3fb[_0x2a6217]={'$like':'%'+_0x46d05a[_0xfd33('0x34')][_0xfd33('0x42')]+'%'};return _0x59d3fb;})});}_0x2dfe91=_[_0xfd33('0x43')]({},_0x2dfe91,_0x46d05a[_0xfd33('0x44')]);return db[_0xfd33('0x6d')][_0xfd33('0x8e')](_0x2dfe91);}})[_0xfd33('0x27')](respondWithResult(_0x15c98a,null))[_0xfd33('0x4a')](handleError(_0x15c98a,null));};exports['addAgents']=function(_0x185324,_0x28ddca,_0x38ced8){return db[_0xfd33('0x30')]['find']({'where':{'id':_0x185324[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x28ddca,null))[_0xfd33('0x27')](function(_0x44c046){if(_0x44c046){return _0x44c046[_0xfd33('0x8f')](_0x185324['body'][_0xfd33('0x65')],_['omit'](_0x185324[_0xfd33('0x4c')],[_0xfd33('0x65'),'id'])||{})[_0xfd33('0x90')](function(_0x490c3c){for(var _0x13ce00=0x0;_0x13ce00<_0x185324[_0xfd33('0x4c')][_0xfd33('0x65')][_0xfd33('0x5b')];_0x13ce00+=0x1){socket[_0xfd33('0x91')](_0xfd33('0x92'),{'UserId':Number(_0x185324[_0xfd33('0x4c')]['ids'][_0x13ce00]),'CmListId':Number(_0x185324[_0xfd33('0x54')]['id'])});}return _0x490c3c;});}})[_0xfd33('0x27')](respondWithResult(_0x28ddca,null))[_0xfd33('0x4a')](handleError(_0x28ddca,null));};exports[_0xfd33('0x93')]=function(_0x8e92b4,_0x5881b9,_0x3e12a3){return db[_0xfd33('0x30')]['find']({'where':{'id':_0x8e92b4[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x5881b9,null))[_0xfd33('0x27')](function(_0x8eb1e4){if(_0x8eb1e4){return _0x8eb1e4[_0xfd33('0x93')](_0x8e92b4[_0xfd33('0x34')][_0xfd33('0x65')])['then'](function(){if(_[_0xfd33('0x61')](_0x8e92b4[_0xfd33('0x34')][_0xfd33('0x65')])){for(var _0x12ce8c=0x0;_0x12ce8c<_0x8e92b4['query'][_0xfd33('0x65')][_0xfd33('0x5b')];_0x12ce8c+=0x1){socket[_0xfd33('0x91')](_0xfd33('0x94'),{'UserId':Number(_0x8e92b4[_0xfd33('0x34')]['ids'][_0x12ce8c]),'CmListId':Number(_0x8e92b4[_0xfd33('0x54')]['id'])});}}else{socket[_0xfd33('0x91')](_0xfd33('0x94'),{'UserId':Number(_0x8e92b4[_0xfd33('0x34')][_0xfd33('0x65')]),'CmListId':Number(_0x8e92b4[_0xfd33('0x54')]['id'])});}});}})[_0xfd33('0x27')](respondWithStatusCode(_0x5881b9,null))[_0xfd33('0x4a')](handleError(_0x5881b9,null));};exports['getAgents']=function(_0x800e65,_0x5356fe,_0x1b47c3){var _0x3c2c6d={};var _0x3ef728={};var _0x3ebdc4;var _0x2c644f;return db['CmList'][_0xfd33('0x5a')]({'where':{'id':_0x800e65[_0xfd33('0x54')]['id']}})[_0xfd33('0x27')](handleEntityNotFound(_0x5356fe,null))['then'](function(_0x12559d){if(_0x12559d){_0x3ebdc4=_0x12559d;_0x3ef728[_0xfd33('0x33')]=_[_0xfd33('0x35')](db['User'][_0xfd33('0x31')]);_0x3ef728[_0xfd33('0x34')]=_[_0xfd33('0x35')](_0x800e65['query']);_0x3ef728[_0xfd33('0x3e')]=_[_0xfd33('0x36')](_0x3ef728[_0xfd33('0x33')],_0x3ef728['query']);_0x3c2c6d['attributes']=_[_0xfd33('0x36')](_0x3ef728[_0xfd33('0x33')],qs[_0xfd33('0x38')](_0x800e65[_0xfd33('0x34')][_0xfd33('0x38')]));_0x3c2c6d[_0xfd33('0x37')]=_0x3c2c6d[_0xfd33('0x37')][_0xfd33('0x5b')]?_0x3c2c6d[_0xfd33('0x37')]:_0x3ef728[_0xfd33('0x33')];_0x3c2c6d[_0xfd33('0x3c')]=qs[_0xfd33('0x3d')](_0x800e65[_0xfd33('0x34')]['sort']);_0x3c2c6d[_0xfd33('0x40')]=qs[_0xfd33('0x3e')](_[_0xfd33('0x3f')](_0x800e65[_0xfd33('0x34')],_0x3ef728[_0xfd33('0x3e')]));if(_0x800e65['query'][_0xfd33('0x42')]){_0x3c2c6d[_0xfd33('0x40')]=_[_0xfd33('0x43')](_0x3c2c6d[_0xfd33('0x40')],{'$or':_['map'](_0x3c2c6d['attributes'],function(_0x3e4685){var _0x20be00={};_0x20be00[_0x3e4685]={'$like':'%'+_0x800e65[_0xfd33('0x34')][_0xfd33('0x42')]+'%'};return _0x20be00;})});}_0x3c2c6d=_[_0xfd33('0x43')]({},_0x3c2c6d,_0x800e65[_0xfd33('0x44')]);return _0x3ebdc4['getAgents'](_0x3c2c6d);}})[_0xfd33('0x27')](function(_0x548b39){if(_0x548b39){_0x2c644f=_0x548b39[_0xfd33('0x5b')];if(!_0x800e65[_0xfd33('0x34')][_0xfd33('0x39')](_0xfd33('0x3a'))){_0x3c2c6d[_0xfd33('0x3b')]=qs[_0xfd33('0x3b')](_0x800e65['query']['limit']);_0x3c2c6d[_0xfd33('0x21')]=qs[_0xfd33('0x21')](_0x800e65[_0xfd33('0x34')][_0xfd33('0x21')]);}return _0x3ebdc4[_0xfd33('0x95')](_0x3c2c6d);}})['then'](function(_0x334ec4){if(_0x334ec4){return _0x334ec4?{'count':_0x2c644f,'rows':_0x334ec4}:null;}})[_0xfd33('0x27')](respondWithResult(_0x5356fe,null))['catch'](handleError(_0x5356fe,null));}; \ No newline at end of file +var _0x73b7=['User','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','findAll','rows','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','length','filter','include','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','cf_%d','getContactsCsv','isEmpty','now','writeFileSync','setHeader','Content-disposition','format','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents'];(function(_0xdc2882,_0x3169b7){var _0x1ed287=function(_0xad592a){while(--_0xad592a){_0xdc2882['push'](_0xdc2882['shift']());}};_0x1ed287(++_0x3169b7);}(_0x73b7,0x1bd));var _0x773b=function(_0x4f354a,_0x109a73){_0x4f354a=_0x4f354a-0x0;var _0x4c99a0=_0x73b7[_0x4f354a];return _0x4c99a0;};'use strict';var emlformat=require(_0x773b('0x0'));var rimraf=require(_0x773b('0x1'));var zipdir=require(_0x773b('0x2'));var jsonpatch=require(_0x773b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x773b('0x4'));var Mustache=require(_0x773b('0x5'));var util=require(_0x773b('0x6'));var path=require('path');var sox=require(_0x773b('0x7'));var csv=require(_0x773b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x773b('0x9'));var squel=require(_0x773b('0xa'));var crypto=require(_0x773b('0xb'));var jsforce=require(_0x773b('0xc'));var deskjs=require(_0x773b('0xd'));var toCsv=require(_0x773b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x773b('0xe'));var authService=require(_0x773b('0xf'));var qs=require(_0x773b('0x10'));var as=require(_0x773b('0x11'));var hardwareService=require(_0x773b('0x12'));var logger=require(_0x773b('0x13'))(_0x773b('0x14'));var utils=require(_0x773b('0x15'));var config=require(_0x773b('0x16'));var licenseUtil=require(_0x773b('0x17'));var db=require(_0x773b('0x18'))['db'];config[_0x773b('0x19')]=_[_0x773b('0x1a')](config[_0x773b('0x19')],{'host':_0x773b('0x1b'),'port':0x18eb});var socket=require(_0x773b('0x1c'))(new Redis(config[_0x773b('0x19')]));require(_0x773b('0x1d'))[_0x773b('0x1e')](socket);function respondWithStatusCode(_0x515e60,_0x124e54){_0x124e54=_0x124e54||0xcc;return function(_0x4de2bd){if(_0x4de2bd){return _0x515e60[_0x773b('0x1f')](_0x124e54);}return _0x515e60[_0x773b('0x20')](_0x124e54)[_0x773b('0x21')]();};}function respondWithResult(_0x134240,_0x2befe3){_0x2befe3=_0x2befe3||0xc8;return function(_0x21947b){if(_0x21947b){return _0x134240[_0x773b('0x20')](_0x2befe3)[_0x773b('0x22')](_0x21947b);}};}function respondWithFilteredResult(_0x4e0601,_0x463ffd){return function(_0x27d6f5){if(_0x27d6f5){var _0x159173=typeof _0x463ffd[_0x773b('0x23')]===_0x773b('0x24')&&typeof _0x463ffd[_0x773b('0x25')]==='undefined';var _0x4eeb07=_0x27d6f5[_0x773b('0x26')];var _0x4229a6=_0x159173?0x0:_0x463ffd[_0x773b('0x23')];var _0x4b608f=_0x159173?_0x27d6f5['count']:_0x463ffd['offset']+_0x463ffd[_0x773b('0x25')];var _0x1222f6;if(_0x4b608f>=_0x4eeb07){_0x4b608f=_0x4eeb07;_0x1222f6=0xc8;}else{_0x1222f6=0xce;}_0x4e0601['status'](_0x1222f6);return _0x4e0601['set'](_0x773b('0x27'),_0x4229a6+'-'+_0x4b608f+'/'+_0x4eeb07)['json'](_0x27d6f5);}return null;};}function patchUpdates(_0x3d7e36){return function(_0x32a83b){try{jsonpatch[_0x773b('0x28')](_0x32a83b,_0x3d7e36,!![]);}catch(_0x14b89b){return BPromise[_0x773b('0x29')](_0x14b89b);}return _0x32a83b[_0x773b('0x2a')]();};}function saveUpdates(_0x312509,_0x8f443d){return function(_0x4079d9){if(_0x4079d9){return _0x4079d9[_0x773b('0x2b')](_0x312509)[_0x773b('0x2c')](function(_0x5f190f){return _0x5f190f;});}return null;};}function removeEntity(_0x73f994,_0x331016){return function(_0x3b57e5){if(_0x3b57e5){return _0x3b57e5[_0x773b('0x2d')]()[_0x773b('0x2c')](function(){var _0x58d283=_0x3b57e5[_0x773b('0x2e')]({'plain':!![]});var _0x36f046=_0x773b('0x2f');return db[_0x773b('0x30')]['destroy']({'where':{'type':_0x36f046,'resourceId':_0x58d283['id']}})[_0x773b('0x2c')](function(){return _0x3b57e5;});})['then'](function(){_0x73f994[_0x773b('0x20')](0xcc)[_0x773b('0x21')]();});}};}function handleEntityNotFound(_0xe7180d,_0x552f13){return function(_0x29794f){if(!_0x29794f){_0xe7180d[_0x773b('0x1f')](0x194);}return _0x29794f;};}function handleError(_0x585797,_0x1fbb1f){_0x1fbb1f=_0x1fbb1f||0x1f4;return function(_0x1e6861){logger[_0x773b('0x31')](_0x1e6861[_0x773b('0x32')]);if(_0x1e6861[_0x773b('0x33')]){delete _0x1e6861['name'];}_0x585797['status'](_0x1fbb1f)[_0x773b('0x34')](_0x1e6861);};}exports[_0x773b('0x35')]=function(_0x2d30e6,_0x1de3af){var _0x5a0c1c={},_0x1328e5={},_0x44a770={'count':0x0,'rows':[]};var _0x3cd8e4=_[_0x773b('0x36')](db[_0x773b('0x37')][_0x773b('0x38')],function(_0x3b96de){return{'name':_0x3b96de['fieldName'],'type':_0x3b96de[_0x773b('0x39')][_0x773b('0x3a')]};});_0x1328e5[_0x773b('0x3b')]=_[_0x773b('0x36')](_0x3cd8e4,_0x773b('0x33'));_0x1328e5['query']=_[_0x773b('0x3c')](_0x2d30e6[_0x773b('0x3d')]);_0x1328e5[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x1328e5['model'],_0x1328e5['query']);_0x5a0c1c[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x1328e5[_0x773b('0x3b')],qs['fields'](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x41')]));_0x5a0c1c[_0x773b('0x40')]=_0x5a0c1c[_0x773b('0x40')]['length']?_0x5a0c1c[_0x773b('0x40')]:_0x1328e5[_0x773b('0x3b')];if(!_0x2d30e6[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x5a0c1c[_0x773b('0x25')]=qs[_0x773b('0x25')](_0x2d30e6['query'][_0x773b('0x25')]);_0x5a0c1c[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x23')]);}_0x5a0c1c[_0x773b('0x44')]=qs[_0x773b('0x45')](_0x2d30e6[_0x773b('0x3d')][_0x773b('0x45')]);_0x5a0c1c['where']=qs['filters'](_[_0x773b('0x46')](_0x2d30e6[_0x773b('0x3d')],_0x1328e5[_0x773b('0x3e')]),_0x3cd8e4);if(_0x2d30e6['query']['filter']){_0x5a0c1c['where']=_[_0x773b('0x47')](_0x5a0c1c[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x3cd8e4,function(_0x413fc2){if(_0x413fc2[_0x773b('0x39')]!==_0x773b('0x49')){var _0x4f7f41={};_0x4f7f41[_0x413fc2[_0x773b('0x33')]]={'$like':'%'+_0x2d30e6['query']['filter']+'%'};return _0x4f7f41;}})});}_0x5a0c1c=_[_0x773b('0x47')]({},_0x5a0c1c,_0x2d30e6[_0x773b('0x4a')]);var _0x55c7e1={'where':_0x5a0c1c[_0x773b('0x48')]};return db[_0x773b('0x37')][_0x773b('0x26')](_0x55c7e1)['then'](function(_0x24d705){_0x44a770[_0x773b('0x26')]=_0x24d705;if(_0x2d30e6[_0x773b('0x3d')]['includeAll']){_0x5a0c1c['include']=[{'all':!![]}];}return db[_0x773b('0x37')][_0x773b('0x4b')](_0x5a0c1c);})[_0x773b('0x2c')](function(_0x42d619){_0x44a770[_0x773b('0x4c')]=_0x42d619;return _0x44a770;})[_0x773b('0x2c')](respondWithFilteredResult(_0x1de3af,_0x5a0c1c))['catch'](handleError(_0x1de3af,null));};exports['show']=function(_0x2407a4,_0x491390){var _0x41ffc8={'raw':![],'where':{'id':_0x2407a4[_0x773b('0x4d')]['id']}},_0x3770a4={};_0x3770a4[_0x773b('0x3b')]=_['keys'](db['CmList'][_0x773b('0x38')]);_0x3770a4['query']=_[_0x773b('0x3c')](_0x2407a4[_0x773b('0x3d')]);_0x3770a4[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x3770a4['model'],_0x3770a4[_0x773b('0x3d')]);_0x41ffc8[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x3770a4['model'],qs['fields'](_0x2407a4[_0x773b('0x3d')][_0x773b('0x41')]));_0x41ffc8['attributes']=_0x41ffc8[_0x773b('0x40')]['length']?_0x41ffc8[_0x773b('0x40')]:_0x3770a4['model'];if(_0x2407a4['query'][_0x773b('0x4e')]){_0x41ffc8['include']=[{'all':!![]}];}_0x41ffc8=_[_0x773b('0x47')]({},_0x41ffc8,_0x2407a4[_0x773b('0x4a')]);return db['CmList'][_0x773b('0x4f')](_0x41ffc8)['then'](handleEntityNotFound(_0x491390,null))[_0x773b('0x2c')](respondWithResult(_0x491390,null))[_0x773b('0x50')](handleError(_0x491390,null));};exports['create']=function(_0x4d5050,_0xbcaa13){return db[_0x773b('0x37')][_0x773b('0x51')](_0x4d5050[_0x773b('0x52')],{})[_0x773b('0x2c')](function(_0x35b4fa){var _0x1b1ed9=_0x4d5050[_0x773b('0x53')]['get']({'plain':!![]});if(!_0x1b1ed9)throw new Error(_0x773b('0x54'));if(_0x1b1ed9['role']===_0x773b('0x53')){var _0xdb6f29=_0x35b4fa['get']({'plain':!![]});var _0x21acae=_0x773b('0x2f');return db['UserProfileSection'][_0x773b('0x4f')]({'where':{'name':_0x21acae,'userProfileId':_0x1b1ed9[_0x773b('0x55')]},'raw':!![]})[_0x773b('0x2c')](function(_0x1949aa){if(_0x1949aa&&_0x1949aa[_0x773b('0x56')]===0x0){return db[_0x773b('0x30')][_0x773b('0x51')]({'name':_0xdb6f29[_0x773b('0x33')],'resourceId':_0xdb6f29['id'],'type':_0x1949aa['name'],'sectionId':_0x1949aa['id']},{})[_0x773b('0x2c')](function(){return _0x35b4fa;});}else{return _0x35b4fa;}})[_0x773b('0x50')](function(_0x512b6e){logger[_0x773b('0x31')](_0x773b('0x57'),_0x512b6e);throw _0x512b6e;});}return _0x35b4fa;})[_0x773b('0x2c')](respondWithResult(_0xbcaa13,0xc9))[_0x773b('0x50')](handleError(_0xbcaa13,null));};exports[_0x773b('0x2b')]=function(_0x45c33a,_0x2639fa){if(_0x45c33a[_0x773b('0x52')]['id']){delete _0x45c33a['body']['id'];}return db[_0x773b('0x37')]['find']({'where':{'id':_0x45c33a['params']['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x2639fa,null))[_0x773b('0x2c')](saveUpdates(_0x45c33a[_0x773b('0x52')],null))[_0x773b('0x2c')](respondWithResult(_0x2639fa,null))['catch'](handleError(_0x2639fa,null));};exports[_0x773b('0x2d')]=function(_0x267ea0,_0x4e2be5){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x267ea0[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x4e2be5,null))['then'](removeEntity(_0x4e2be5,null))['catch'](handleError(_0x4e2be5,null));};exports['describe']=function(_0x1a3028,_0x551aa1){return db[_0x773b('0x37')][_0x773b('0x58')]()[_0x773b('0x2c')](respondWithResult(_0x551aa1,null))[_0x773b('0x50')](handleError(_0x551aa1,null));};exports[_0x773b('0x59')]=function(_0x58c067,_0x74fe3a,_0x2d7481){if(_0x58c067[_0x773b('0x52')]['id']){delete _0x58c067[_0x773b('0x52')]['id'];}return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x58c067[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x74fe3a,null))[_0x773b('0x2c')](function(_0x5ada0a){if(_0x5ada0a){_0x58c067['body'][_0x773b('0x5a')]=_0x5ada0a['id'];return db[_0x773b('0x5b')][_0x773b('0x51')](_0x58c067[_0x773b('0x52')]);}})[_0x773b('0x2c')](respondWithResult(_0x74fe3a,null))[_0x773b('0x50')](handleError(_0x74fe3a,null));};exports['getDispositions']=function(_0xebf5b8,_0x29c017,_0xa98619){var _0x21ba0e={'raw':![],'where':{}};var _0x2eddc3={};var _0x401b69={'count':0x0,'rows':[]};return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0xebf5b8[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x29c017,null))['then'](function(_0x4fb5f6){if(_0x4fb5f6){_0x2eddc3['model']=_[_0x773b('0x3c')](db['Disposition'][_0x773b('0x38')]);_0x2eddc3['query']=_[_0x773b('0x3c')](_0xebf5b8[_0x773b('0x3d')]);_0x2eddc3[_0x773b('0x3e')]=_['intersection'](_0x2eddc3[_0x773b('0x3b')],_0x2eddc3[_0x773b('0x3d')]);_0x21ba0e[_0x773b('0x40')]=_['intersection'](_0x2eddc3[_0x773b('0x3b')],qs[_0x773b('0x41')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x41')]));_0x21ba0e[_0x773b('0x40')]=_0x21ba0e[_0x773b('0x40')][_0x773b('0x5d')]?_0x21ba0e[_0x773b('0x40')]:_0x2eddc3[_0x773b('0x3b')];if(!_0xebf5b8[_0x773b('0x3d')]['hasOwnProperty'](_0x773b('0x43'))){_0x21ba0e['limit']=qs[_0x773b('0x25')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x25')]);_0x21ba0e[_0x773b('0x23')]=qs[_0x773b('0x23')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x23')]);}_0x21ba0e[_0x773b('0x44')]=qs[_0x773b('0x45')](_0xebf5b8[_0x773b('0x3d')][_0x773b('0x45')]);_0x21ba0e[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0xebf5b8[_0x773b('0x3d')],_0x2eddc3[_0x773b('0x3e')]));_0x21ba0e[_0x773b('0x48')][_0x773b('0x5a')]=_0x4fb5f6['id'];if(_0xebf5b8[_0x773b('0x3d')][_0x773b('0x5e')]){_0x21ba0e[_0x773b('0x48')]=_['merge'](_0x21ba0e[_0x773b('0x48')],{'$or':_['map'](_0x21ba0e['attributes'],function(_0x4ddff6){var _0x2e9137={};_0x2e9137[_0x4ddff6]={'$like':'%'+_0xebf5b8[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x2e9137;})});}_0x21ba0e=_[_0x773b('0x47')]({},_0x21ba0e,_0xebf5b8[_0x773b('0x4a')]);return db[_0x773b('0x5b')][_0x773b('0x26')]({'where':_0x21ba0e['where']})[_0x773b('0x2c')](function(_0x628797){_0x401b69[_0x773b('0x26')]=_0x628797;if(_0xebf5b8[_0x773b('0x3d')]['includeAll']){_0x21ba0e[_0x773b('0x5f')]=[{'all':!![]}];}return db[_0x773b('0x5b')][_0x773b('0x4b')](_0x21ba0e);})[_0x773b('0x2c')](function(_0x10ecf0){_0x401b69[_0x773b('0x4c')]=_0x10ecf0;return _0x401b69;});}})[_0x773b('0x2c')](respondWithFilteredResult(_0x29c017,_0x21ba0e))[_0x773b('0x50')](handleError(_0x29c017,null));};exports[_0x773b('0x60')]=function(_0x3fdb51,_0x5d7449,_0x595fe8){return db['CmList'][_0x773b('0x4f')]({'where':{'id':_0x3fdb51[_0x773b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d7449,null))[_0x773b('0x2c')](function(_0x5208fc){if(_0x5208fc){return _0x5208fc['removeDispositions'](_0x3fdb51[_0x773b('0x3d')][_0x773b('0x61')]);}})[_0x773b('0x2c')](respondWithStatusCode(_0x5d7449,null))[_0x773b('0x50')](handleError(_0x5d7449,null));};exports[_0x773b('0x62')]=function(_0x4529cc,_0x4fbaa9,_0xa71d51){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x4529cc[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x4fbaa9,null))[_0x773b('0x2c')](function(_0x1035e5){if(_0x1035e5){var _0x1fa535=[];var _0x1cc743={'success':[],'errors':[]};return db[_0x773b('0x63')]['describe']()['then'](function(_0x25d33f){if(_0x4529cc[_0x773b('0x52')]['tags']&&_['isArray'](_0x4529cc[_0x773b('0x52')][_0x773b('0x64')])){if(_0x4529cc[_0x773b('0x52')][_0x773b('0x64')][_0x773b('0x5d')]){_0x4529cc['body'][_0x773b('0x64')]=_0x4529cc['body'][_0x773b('0x64')][_0x773b('0x65')](';')+';';}else{_0x4529cc['body'][_0x773b('0x64')]=null;}}else{_0x4529cc[_0x773b('0x52')][_0x773b('0x64')]=null;}if(_0x4529cc[_0x773b('0x52')]&&_[_0x773b('0x66')](_0x4529cc[_0x773b('0x52')])){for(var _0x231552=0x0;_0x231552<_0x4529cc[_0x773b('0x52')]['length'];_0x231552+=0x1){_0x4529cc[_0x773b('0x52')][_0x231552][_0x773b('0x5a')]=_0x4529cc['params']['id'];_0x1fa535[_0x773b('0x67')](_0x4529cc[_0x773b('0x52')][_0x231552]);}return BPromise['each'](_0x1fa535,function(_0x160f15){return db['CmContact'][_0x773b('0x51')](_[_0x773b('0x68')](_0x160f15,[_0x773b('0x61'),'id'])||{},{'fields':_[_0x773b('0x3c')](_0x25d33f),'raw':!![]})[_0x773b('0x2c')](function(_0xbcb5f2){_0x1cc743[_0x773b('0x69')][_0x773b('0x67')](_0xbcb5f2[_0x773b('0x6a')]);})['catch'](function(_0x3ebe30){_0x1cc743[_0x773b('0x6b')][_0x773b('0x67')]({'data':_0x160f15,'error':_0x3ebe30[_0x773b('0x6c')]});});})[_0x773b('0x2c')](function(_0x2b36d0){return _0x1cc743;})[_0x773b('0x50')](function(_0x2b8275){return _0x2b8275;});}else{_0x4fbaa9[_0x773b('0x20')](0x190)[_0x773b('0x22')]({'message':_0x773b('0x6d')});}});}})[_0x773b('0x2c')](respondWithResult(_0x4fbaa9,null))[_0x773b('0x50')](handleError(_0x4fbaa9,null));};exports[_0x773b('0x6e')]=function(_0x924c16,_0x28730c,_0x1698b2){var _0x33b5c4;return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x924c16[_0x773b('0x4d')]['id']},'include':[{'model':db[_0x773b('0x6f')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x28730c,null))['then'](function(_0x2c21d4){if(_0x2c21d4){_0x33b5c4=_0x2c21d4;return db[_0x773b('0x63')][_0x773b('0x38')];}})['then'](function(_0x5425cd){if(_0x5425cd){var _0x4efd2f={};var _0x10ad12={};_0x10ad12[_0x773b('0x3b')]=_[_0x773b('0x70')](_['keys'](_0x5425cd),_[_0x773b('0x36')](_0x33b5c4[_0x773b('0x71')],function(_0x2d68d6){return util['format'](_0x773b('0x72'),_0x2d68d6['id']);}));_0x10ad12['query']=_[_0x773b('0x3c')](_0x924c16['query']);_0x10ad12[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x10ad12[_0x773b('0x3b')],_0x10ad12[_0x773b('0x3d')]);_0x4efd2f[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x10ad12[_0x773b('0x3b')],qs[_0x773b('0x41')](_0x924c16[_0x773b('0x3d')][_0x773b('0x41')]));_0x4efd2f['attributes']=_0x4efd2f[_0x773b('0x40')][_0x773b('0x5d')]?_0x4efd2f[_0x773b('0x40')]:_0x10ad12[_0x773b('0x3b')];if(!_0x924c16[_0x773b('0x3d')][_0x773b('0x42')]('nolimit')){_0x4efd2f['limit']=qs[_0x773b('0x25')](_0x924c16[_0x773b('0x3d')][_0x773b('0x25')]);_0x4efd2f[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x924c16[_0x773b('0x3d')][_0x773b('0x23')]);}_0x4efd2f[_0x773b('0x44')]=qs['sort'](_0x924c16[_0x773b('0x3d')][_0x773b('0x45')]);_0x4efd2f[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0x924c16[_0x773b('0x3d')],_0x10ad12[_0x773b('0x3e')]));_0x4efd2f['raw']=!![];if(_0x924c16[_0x773b('0x3d')][_0x773b('0x5e')]){_0x4efd2f[_0x773b('0x48')]=_[_0x773b('0x47')](_0x4efd2f['where'],{'$or':_[_0x773b('0x36')](_0x4efd2f['attributes'],function(_0x1e1153){var _0x328006={};_0x328006[_0x1e1153]={'$like':'%'+_0x924c16[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x328006;})});}_0x4efd2f=_[_0x773b('0x47')]({},_0x4efd2f,_0x924c16[_0x773b('0x4a')]);return _0x33b5c4[_0x773b('0x6e')](_0x4efd2f);}})[_0x773b('0x2c')](respondWithResult(_0x28730c,null))[_0x773b('0x50')](handleError(_0x28730c,null));};exports[_0x773b('0x73')]=function(_0x49f28c,_0x4e8ef1,_0xb7687e){var _0x2ee76c;return db[_0x773b('0x37')]['find']({'where':{'id':_0x49f28c[_0x773b('0x4d')]['id']},'include':[{'model':db[_0x773b('0x6f')],'as':_0x773b('0x71')}]})[_0x773b('0x2c')](handleEntityNotFound(_0x4e8ef1,null))['then'](function(_0x55eeaf){if(_0x55eeaf){_0x2ee76c=_0x55eeaf;return db['CmContact'][_0x773b('0x38')];}})['then'](function(_0x595e16){if(_0x595e16){var _0x2bc4fd={};var _0x218d03={};_0x218d03[_0x773b('0x3b')]=_['concat'](_[_0x773b('0x3c')](_0x595e16),_[_0x773b('0x36')](_0x2ee76c[_0x773b('0x71')],function(_0x411d2a){return util['format'](_0x773b('0x72'),_0x411d2a['id']);}));_0x218d03['query']=_[_0x773b('0x3c')](_0x49f28c[_0x773b('0x3d')]);_0x218d03[_0x773b('0x3e')]=_[_0x773b('0x3f')](_0x218d03[_0x773b('0x3b')],_0x218d03[_0x773b('0x3d')]);_0x2bc4fd[_0x773b('0x40')]=_[_0x773b('0x3f')](_0x218d03[_0x773b('0x3b')],qs[_0x773b('0x41')](_0x49f28c['query'][_0x773b('0x41')]));_0x2bc4fd[_0x773b('0x40')]=_0x2bc4fd[_0x773b('0x40')][_0x773b('0x5d')]?_0x2bc4fd[_0x773b('0x40')]:_0x218d03[_0x773b('0x3b')];if(!_0x49f28c[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x2bc4fd[_0x773b('0x25')]=qs[_0x773b('0x25')](_0x49f28c['query'][_0x773b('0x25')]);_0x2bc4fd[_0x773b('0x23')]=qs[_0x773b('0x23')](_0x49f28c[_0x773b('0x3d')][_0x773b('0x23')]);}_0x2bc4fd[_0x773b('0x44')]=qs[_0x773b('0x45')](_0x49f28c[_0x773b('0x3d')][_0x773b('0x45')]);_0x2bc4fd[_0x773b('0x48')]=qs[_0x773b('0x3e')](_['pick'](_0x49f28c[_0x773b('0x3d')],_0x218d03['filters']));_0x2bc4fd['raw']=!![];if(_0x49f28c[_0x773b('0x3d')][_0x773b('0x5e')]){_0x2bc4fd[_0x773b('0x48')]=_['merge'](_0x2bc4fd[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x2bc4fd[_0x773b('0x40')],function(_0x3f2557){var _0x3c3816={};_0x3c3816[_0x3f2557]={'$like':'%'+_0x49f28c[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x3c3816;})});}_0x2bc4fd=_[_0x773b('0x47')]({},_0x2bc4fd,_0x49f28c[_0x773b('0x4a')]);return _0x2ee76c[_0x773b('0x6e')](_0x2bc4fd);}})[_0x773b('0x2c')](function(_0x2400f0){if(!_[_0x773b('0x74')](_0x2400f0)){var _0x25fb72=toCsv(_0x2400f0);var _0x212da9=Date[_0x773b('0x75')]();fs[_0x773b('0x76')](util['format']('/tmp/list_%d_%s.csv',_0x2ee76c['id'],_0x212da9),_0x25fb72);_0x4e8ef1[_0x773b('0x77')](_0x773b('0x78'),'attachment;\x20filename='+util[_0x773b('0x79')](_0x773b('0x7a'),_0x2ee76c['id'],_0x212da9));_0x4e8ef1[_0x773b('0x77')]('Content-type',_0x773b('0x7b'));return _0x4e8ef1[_0x773b('0x7c')](util[_0x773b('0x79')](_0x773b('0x7d'),_0x2ee76c['id'],_0x212da9));}else{return _0x4e8ef1['sendStatus'](0xcc);}})[_0x773b('0x50')](handleError(_0x4e8ef1,null));};exports[_0x773b('0x7e')]=function(_0x579aab,_0x3f6ee5,_0x2b6f8b){var _0x3f718b;delete _0x579aab[_0x773b('0x52')]['id'];return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0x579aab[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x3f6ee5,null))[_0x773b('0x2c')](function(_0x144091){if(_0x144091){return db[_0x773b('0x7f')][_0x773b('0x80')](function(_0x5a74df){return db[_0x773b('0x6f')][_0x773b('0x51')](_0x579aab['body'],{'transaction':_0x5a74df})['then'](function(_0x41ab5c){_0x3f718b=_0x41ab5c;return _0x144091[_0x773b('0x81')](_0x41ab5c,{'transaction':_0x5a74df});})[_0x773b('0x2c')](function(){var _0x50ed39={'type':db[_0x773b('0x82')]['TEXT'],'transaction':_0x5a74df};switch(_0x579aab[_0x773b('0x52')][_0x773b('0x39')]){case _0x773b('0x83'):_0x50ed39['type']=db[_0x773b('0x82')]['TEXT'];break;case _0x773b('0x84'):_0x50ed39['type']=db[_0x773b('0x82')][_0x773b('0x85')];break;case'switch':_0x50ed39[_0x773b('0x39')]=db[_0x773b('0x82')][_0x773b('0x86')];_0x50ed39[_0x773b('0x87')]=![];break;default:}return db[_0x773b('0x7f')][_0x773b('0x88')][_0x773b('0x89')]('cm_contacts',util[_0x773b('0x79')]('cf_%s',_0x3f718b['id']),_0x50ed39);})['then'](function(){return _0x3f718b;});});}})[_0x773b('0x2c')](respondWithResult(_0x3f6ee5,null))[_0x773b('0x50')](handleError(_0x3f6ee5,null));};exports[_0x773b('0x8a')]=function(_0xb6a9de,_0x993567,_0x34ce46){var _0x29ad0c={};var _0x2bcb84={};var _0x4fc3e8;var _0x218edd;return db[_0x773b('0x37')]['findOne']({'where':{'id':_0xb6a9de['params']['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x993567,null))[_0x773b('0x2c')](function(_0x4f57f2){if(_0x4f57f2){_0x4fc3e8=_0x4f57f2;_0x2bcb84[_0x773b('0x3b')]=_[_0x773b('0x3c')](db[_0x773b('0x6f')]['rawAttributes']);_0x2bcb84['query']=_['keys'](_0xb6a9de[_0x773b('0x3d')]);_0x2bcb84[_0x773b('0x3e')]=_['intersection'](_0x2bcb84[_0x773b('0x3b')],_0x2bcb84[_0x773b('0x3d')]);_0x29ad0c[_0x773b('0x40')]=_['intersection'](_0x2bcb84['model'],qs[_0x773b('0x41')](_0xb6a9de[_0x773b('0x3d')][_0x773b('0x41')]));_0x29ad0c[_0x773b('0x40')]=_0x29ad0c[_0x773b('0x40')]['length']?_0x29ad0c['attributes']:_0x2bcb84[_0x773b('0x3b')];_0x29ad0c['order']=qs['sort'](_0xb6a9de[_0x773b('0x3d')]['sort']);_0x29ad0c[_0x773b('0x48')]=qs['filters'](_[_0x773b('0x46')](_0xb6a9de[_0x773b('0x3d')],_0x2bcb84[_0x773b('0x3e')]));_0x29ad0c[_0x773b('0x48')]=_[_0x773b('0x47')](_0x29ad0c[_0x773b('0x48')],{'$or':[{'ListId':_0x4f57f2['id']},{'ListId':null}]});if(_0xb6a9de[_0x773b('0x3d')][_0x773b('0x5e')]){_0x29ad0c[_0x773b('0x48')]=_[_0x773b('0x47')](_0x29ad0c[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x29ad0c[_0x773b('0x40')],function(_0x4c17ed){var _0x492947={};_0x492947[_0x4c17ed]={'$like':'%'+_0xb6a9de['query'][_0x773b('0x5e')]+'%'};return _0x492947;})});}_0x29ad0c=_[_0x773b('0x47')]({},_0x29ad0c,_0xb6a9de[_0x773b('0x4a')]);return db[_0x773b('0x6f')][_0x773b('0x8b')](_0x29ad0c);}})['then'](respondWithResult(_0x993567,null))[_0x773b('0x50')](handleError(_0x993567,null));};exports[_0x773b('0x8c')]=function(_0x4f3856,_0x463d86,_0x44aee){return db[_0x773b('0x37')][_0x773b('0x4f')]({'where':{'id':_0x4f3856[_0x773b('0x4d')]['id']}})[_0x773b('0x2c')](handleEntityNotFound(_0x463d86,null))[_0x773b('0x2c')](function(_0x1412c4){if(_0x1412c4){return _0x1412c4['addAgents'](_0x4f3856[_0x773b('0x52')]['ids'],_[_0x773b('0x68')](_0x4f3856['body'],['ids','id'])||{})[_0x773b('0x8d')](function(_0x37fe5e){for(var _0x1d3e4a=0x0;_0x1d3e4a<_0x4f3856[_0x773b('0x52')][_0x773b('0x61')][_0x773b('0x5d')];_0x1d3e4a+=0x1){socket['emit'](_0x773b('0x8e'),{'UserId':Number(_0x4f3856[_0x773b('0x52')][_0x773b('0x61')][_0x1d3e4a]),'CmListId':Number(_0x4f3856['params']['id'])});}return _0x37fe5e;});}})[_0x773b('0x2c')](respondWithResult(_0x463d86,null))[_0x773b('0x50')](handleError(_0x463d86,null));};exports['removeAgents']=function(_0x11b48c,_0xc57766,_0x3cb377){return db['CmList']['find']({'where':{'id':_0x11b48c[_0x773b('0x4d')]['id']}})['then'](handleEntityNotFound(_0xc57766,null))[_0x773b('0x2c')](function(_0x381d98){if(_0x381d98){return _0x381d98[_0x773b('0x8f')](_0x11b48c['query'][_0x773b('0x61')])['then'](function(){if(_['isArray'](_0x11b48c['query'][_0x773b('0x61')])){for(var _0x562531=0x0;_0x562531<_0x11b48c[_0x773b('0x3d')][_0x773b('0x61')][_0x773b('0x5d')];_0x562531+=0x1){socket[_0x773b('0x90')]('userCmList:remove',{'UserId':Number(_0x11b48c[_0x773b('0x3d')]['ids'][_0x562531]),'CmListId':Number(_0x11b48c[_0x773b('0x4d')]['id'])});}}else{socket['emit'](_0x773b('0x91'),{'UserId':Number(_0x11b48c[_0x773b('0x3d')][_0x773b('0x61')]),'CmListId':Number(_0x11b48c[_0x773b('0x4d')]['id'])});}});}})[_0x773b('0x2c')](respondWithStatusCode(_0xc57766,null))['catch'](handleError(_0xc57766,null));};exports[_0x773b('0x92')]=function(_0x3131e0,_0x2a8b0f,_0x310057){var _0x37d218={};var _0x24a7b0={};var _0x116f0f;var _0x56f388;return db[_0x773b('0x37')][_0x773b('0x5c')]({'where':{'id':_0x3131e0['params']['id']}})['then'](handleEntityNotFound(_0x2a8b0f,null))[_0x773b('0x2c')](function(_0x3c3422){if(_0x3c3422){_0x116f0f=_0x3c3422;_0x24a7b0[_0x773b('0x3b')]=_[_0x773b('0x3c')](db[_0x773b('0x93')][_0x773b('0x38')]);_0x24a7b0[_0x773b('0x3d')]=_[_0x773b('0x3c')](_0x3131e0['query']);_0x24a7b0['filters']=_[_0x773b('0x3f')](_0x24a7b0[_0x773b('0x3b')],_0x24a7b0[_0x773b('0x3d')]);_0x37d218['attributes']=_[_0x773b('0x3f')](_0x24a7b0[_0x773b('0x3b')],qs['fields'](_0x3131e0[_0x773b('0x3d')][_0x773b('0x41')]));_0x37d218[_0x773b('0x40')]=_0x37d218[_0x773b('0x40')][_0x773b('0x5d')]?_0x37d218['attributes']:_0x24a7b0[_0x773b('0x3b')];_0x37d218[_0x773b('0x44')]=qs['sort'](_0x3131e0[_0x773b('0x3d')][_0x773b('0x45')]);_0x37d218[_0x773b('0x48')]=qs[_0x773b('0x3e')](_[_0x773b('0x46')](_0x3131e0[_0x773b('0x3d')],_0x24a7b0['filters']));if(_0x3131e0[_0x773b('0x3d')][_0x773b('0x5e')]){_0x37d218[_0x773b('0x48')]=_['merge'](_0x37d218[_0x773b('0x48')],{'$or':_[_0x773b('0x36')](_0x37d218['attributes'],function(_0x23dcaa){var _0x2b9782={};_0x2b9782[_0x23dcaa]={'$like':'%'+_0x3131e0[_0x773b('0x3d')][_0x773b('0x5e')]+'%'};return _0x2b9782;})});}_0x37d218=_[_0x773b('0x47')]({},_0x37d218,_0x3131e0[_0x773b('0x4a')]);return _0x116f0f[_0x773b('0x92')](_0x37d218);}})[_0x773b('0x2c')](function(_0x6a16fc){if(_0x6a16fc){_0x56f388=_0x6a16fc[_0x773b('0x5d')];if(!_0x3131e0[_0x773b('0x3d')][_0x773b('0x42')](_0x773b('0x43'))){_0x37d218['limit']=qs[_0x773b('0x25')](_0x3131e0[_0x773b('0x3d')][_0x773b('0x25')]);_0x37d218[_0x773b('0x23')]=qs['offset'](_0x3131e0['query'][_0x773b('0x23')]);}return _0x116f0f['getAgents'](_0x37d218);}})['then'](function(_0x4356fe){if(_0x4356fe){return _0x4356fe?{'count':_0x56f388,'rows':_0x4356fe}:null;}})[_0x773b('0x2c')](respondWithResult(_0x2a8b0f,null))['catch'](handleError(_0x2a8b0f,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fa7e70a..19bffa6 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(_0x58cdc7,_0x5558b8){var _0x45c601=function(_0x1a424b){while(--_0x1a424b){_0x58cdc7['push'](_0x58cdc7['shift']());}};_0x45c601(++_0x5558b8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe14b,0x93));var _0xbe14=function(_0x494207,_0xa9e87e){_0x494207=_0x494207-0x0;var _0x3ed6c7=_0xe14b[_0x494207];return _0x3ed6c7;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9826ec3..e6983c9 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 _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x878f,0x173));var _0xf878=function(_0x552267,_0x444b2c){_0x552267=_0x552267-0x0;var _0x342f10=_0x878f[_0x552267];return _0x342f10;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x54e698,_0x4c6d5c){var _0x1eb4a6=function(_0x210a7d){while(--_0x210a7d){_0x54e698['push'](_0x54e698['shift']());}};_0x1eb4a6(++_0x4c6d5c);}(_0x750a,0x140));var _0xa750=function(_0x3aa0f4,_0x49fa72){_0x3aa0f4=_0x3aa0f4-0x0;var _0x3ce03e=_0x750a[_0x3aa0f4];return _0x3ce03e;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 38a10aa..13d24be 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 _0xc1ba=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5119dc,_0x3753a4){var _0x35385b=function(_0x2d90e7){while(--_0x2d90e7){_0x5119dc['push'](_0x5119dc['shift']());}};_0x35385b(++_0x3753a4);}(_0xc1ba,0x13e));var _0xac1b=function(_0x3e93d8,_0x36e2fe){_0x3e93d8=_0x3e93d8-0x0;var _0x32a1de=_0xc1ba[_0x3e93d8];return _0x32a1de;};'use strict';var _=require(_0xac1b('0x0'));var util=require(_0xac1b('0x1'));var moment=require('moment');var BPromise=require(_0xac1b('0x2'));var rs=require(_0xac1b('0x3'));var fs=require('fs');var Redis=require(_0xac1b('0x4'));var db=require(_0xac1b('0x5'))['db'];var utils=require(_0xac1b('0x6'));var logger=require('../../config/logger')(_0xac1b('0x7'));var config=require(_0xac1b('0x8'));var jayson=require(_0xac1b('0x9'));var client=jayson[_0xac1b('0xa')][_0xac1b('0xb')]({'port':0x232a});config[_0xac1b('0xc')]=_[_0xac1b('0xd')](config[_0xac1b('0xc')],{'host':_0xac1b('0xe'),'port':0x18eb});var socket=require(_0xac1b('0xf'))(new Redis(config[_0xac1b('0xc')]));require(_0xac1b('0x10'))[_0xac1b('0x11')](socket);function respondWithRpcPromise(_0xa69387,_0x1f188e,_0x5dbd0b){return new BPromise(function(_0x40b0b9,_0x1f7af0){return client[_0xac1b('0x12')](_0xa69387,_0x5dbd0b)[_0xac1b('0x13')](function(_0x5af944){logger[_0xac1b('0x14')](_0xac1b('0x15'),_0x1f188e,_0xac1b('0x16'));logger[_0xac1b('0x17')](_0xac1b('0x18'),_0x1f188e,_0xac1b('0x16'),JSON[_0xac1b('0x19')](_0x5af944));if(_0x5af944[_0xac1b('0x1a')]){if(_0x5af944[_0xac1b('0x1a')][_0xac1b('0x1b')]===0x1f4){logger[_0xac1b('0x1a')](_0xac1b('0x15'),_0x1f188e,_0x5af944[_0xac1b('0x1a')]['message']);return _0x1f7af0(_0x5af944[_0xac1b('0x1a')][_0xac1b('0x1c')]);}logger[_0xac1b('0x1a')]('CmList,\x20%s,\x20%s',_0x1f188e,_0x5af944['error'][_0xac1b('0x1c')]);return _0x40b0b9(_0x5af944[_0xac1b('0x1a')]['message']);}else{logger[_0xac1b('0x14')]('CmList,\x20%s,\x20%s',_0x1f188e,_0xac1b('0x16'));_0x40b0b9(_0x5af944['result'][_0xac1b('0x1c')]);}})[_0xac1b('0x1d')](function(_0x3f034a){logger[_0xac1b('0x1a')](_0xac1b('0x15'),_0x1f188e,_0x3f034a);_0x1f7af0(_0x3f034a);});});} \ No newline at end of file +var _0xf459=['http','redis','defaults','localhost','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xf459,0xd3));var _0x9f45=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xf459[_0x2300c7];return _0x23f720;};'use strict';var _=require(_0x9f45('0x0'));var util=require(_0x9f45('0x1'));var moment=require(_0x9f45('0x2'));var BPromise=require(_0x9f45('0x3'));var rs=require(_0x9f45('0x4'));var fs=require('fs');var Redis=require(_0x9f45('0x5'));var db=require(_0x9f45('0x6'))['db'];var utils=require(_0x9f45('0x7'));var logger=require(_0x9f45('0x8'))(_0x9f45('0x9'));var config=require(_0x9f45('0xa'));var jayson=require(_0x9f45('0xb'));var client=jayson[_0x9f45('0xc')][_0x9f45('0xd')]({'port':0x232a});config[_0x9f45('0xe')]=_[_0x9f45('0xf')](config[_0x9f45('0xe')],{'host':_0x9f45('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f45('0xe')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x287402,_0x4a681b,_0xc16e7a){return new BPromise(function(_0x1c5413,_0x537169){return client['request'](_0x287402,_0xc16e7a)[_0x9f45('0x11')](function(_0x5b819b){logger[_0x9f45('0x12')](_0x9f45('0x13'),_0x4a681b,_0x9f45('0x14'));logger[_0x9f45('0x15')](_0x9f45('0x16'),_0x4a681b,_0x9f45('0x14'),JSON['stringify'](_0x5b819b));if(_0x5b819b[_0x9f45('0x17')]){if(_0x5b819b['error'][_0x9f45('0x18')]===0x1f4){logger[_0x9f45('0x17')](_0x9f45('0x13'),_0x4a681b,_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);return _0x537169(_0x5b819b[_0x9f45('0x17')]['message']);}logger[_0x9f45('0x17')](_0x9f45('0x13'),_0x4a681b,_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);return _0x1c5413(_0x5b819b[_0x9f45('0x17')][_0x9f45('0x19')]);}else{logger['info'](_0x9f45('0x13'),_0x4a681b,_0x9f45('0x14'));_0x1c5413(_0x5b819b[_0x9f45('0x1a')][_0x9f45('0x19')]);}})[_0x9f45('0x1b')](function(_0x44def6){logger[_0x9f45('0x17')]('CmList,\x20%s,\x20%s',_0x4a681b,_0x44def6);_0x537169(_0x44def6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6851552..c85fc59 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 _0x029c=['removeListener','register','cmList:','./cmList.events','save','remove','update'];(function(_0x52880b,_0x1da1c8){var _0x18c572=function(_0x4de5f0){while(--_0x4de5f0){_0x52880b['push'](_0x52880b['shift']());}};_0x18c572(++_0x1da1c8);}(_0x029c,0x153));var _0xc029=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x029c[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0xc029('0x0'));var events=[_0xc029('0x1'),_0xc029('0x2'),_0xc029('0x3')];function createListener(_0x572c29,_0x185755){return function(_0x72a36d){_0x185755['emit'](_0x572c29,_0x72a36d);};}function removeListener(_0x3196c3,_0x2c85c1){return function(){CmListEvents[_0xc029('0x4')](_0x3196c3,_0x2c85c1);};}exports[_0xc029('0x5')]=function(_0x48b55a){for(var _0x9060bb=0x0,_0x4f6ee1=events['length'];_0x9060bb<_0x4f6ee1;_0x9060bb++){var _0x199bb4=events[_0x9060bb];var _0xe9146e=createListener(_0xc029('0x6')+_0x199bb4,_0x48b55a);CmListEvents['on'](_0x199bb4,_0xe9146e);}}; \ No newline at end of file +var _0x80bc=['emit','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x80bc,0x18c));var _0xc80b=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x80bc[_0xa4f636];return _0x37e02a;};'use strict';var CmListEvents=require(_0xc80b('0x0'));var events=[_0xc80b('0x1'),_0xc80b('0x2'),_0xc80b('0x3')];function createListener(_0x1178c8,_0x2385e0){return function(_0x10f7ab){_0x2385e0[_0xc80b('0x4')](_0x1178c8,_0x10f7ab);};}function removeListener(_0x3fd8cb,_0x6602dd){return function(){CmListEvents['removeListener'](_0x3fd8cb,_0x6602dd);};}exports[_0xc80b('0x5')]=function(_0x11beb8){for(var _0x5252d0=0x0,_0xfa0f37=events[_0xc80b('0x6')];_0x5252d0<_0xfa0f37;_0x5252d0++){var _0x2ad157=events[_0x5252d0];var _0x49dd03=createListener(_0xc80b('0x7')+_0x2ad157,_0x11beb8);CmListEvents['on'](_0x2ad157,_0x49dd03);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8d3da3c..9697d96 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 _0x8e0f=['put','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8e0f,0x1aa));var _0xf8e0=function(_0x1dcc79,_0x64916b){_0x1dcc79=_0x1dcc79-0x0;var _0x1c5118=_0x8e0f[_0x1dcc79];return _0x1c5118;};'use strict';var multer=require(_0xf8e0('0x0'));var util=require('util');var path=require(_0xf8e0('0x1'));var timeout=require(_0xf8e0('0x2'));var express=require(_0xf8e0('0x3'));var router=express[_0xf8e0('0x4')]();var fs_extra=require(_0xf8e0('0x5'));var auth=require(_0xf8e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e0('0x7'));var controller=require(_0xf8e0('0x8'));router[_0xf8e0('0x9')]('/',auth[_0xf8e0('0xa')](),controller[_0xf8e0('0xb')]);router[_0xf8e0('0x9')](_0xf8e0('0xc'),auth['isAuthenticated'](),controller[_0xf8e0('0xd')]);router[_0xf8e0('0x9')](_0xf8e0('0xe'),auth[_0xf8e0('0xa')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xf8e0('0x9')]('/:id/contacts',auth[_0xf8e0('0xa')](),controller[_0xf8e0('0xf')]);router[_0xf8e0('0x9')]('/:id/contacts/csv',auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x10')]);router[_0xf8e0('0x9')](_0xf8e0('0x11'),auth['isAuthenticated'](),controller[_0xf8e0('0x12')]);router['get'](_0xf8e0('0x13'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x14')]);router[_0xf8e0('0x15')]('/',auth['isAuthenticated'](),controller[_0xf8e0('0x16')]);router[_0xf8e0('0x15')](_0xf8e0('0x17'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x18')]);router[_0xf8e0('0x15')](_0xf8e0('0x19'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x1a')]);router[_0xf8e0('0x15')]('/:id/fields',auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x1b')]);router['post'](_0xf8e0('0x13'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x1c')]);router[_0xf8e0('0x1d')](_0xf8e0('0xe'),auth[_0xf8e0('0xa')](),controller['update']);router[_0xf8e0('0x1e')](_0xf8e0('0xe'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x1f')]);router['delete'](_0xf8e0('0x17'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x20')]);router[_0xf8e0('0x1e')](_0xf8e0('0x13'),auth[_0xf8e0('0xa')](),controller[_0xf8e0('0x21')]);module[_0xf8e0('0x22')]=router; \ No newline at end of file +var _0xcfb7=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','/:id/contacts','addContacts','addCustomField','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5213b3,_0x36ed06){var _0x3ae17d=function(_0x44e14c){while(--_0x44e14c){_0x5213b3['push'](_0x5213b3['shift']());}};_0x3ae17d(++_0x36ed06);}(_0xcfb7,0xd4));var _0x7cfb=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xcfb7[_0xfcbcb8];return _0x1b1f97;};'use strict';var multer=require(_0x7cfb('0x0'));var util=require('util');var path=require(_0x7cfb('0x1'));var timeout=require(_0x7cfb('0x2'));var express=require('express');var router=express[_0x7cfb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7cfb('0x4'));var interaction=require(_0x7cfb('0x5'));var config=require(_0x7cfb('0x6'));var controller=require(_0x7cfb('0x7'));router[_0x7cfb('0x8')]('/',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0xa')]);router[_0x7cfb('0x8')](_0x7cfb('0xb'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0xc')]);router[_0x7cfb('0x8')](_0x7cfb('0xd'),auth['isAuthenticated'](),controller[_0x7cfb('0xe')]);router[_0x7cfb('0x8')](_0x7cfb('0xf'),auth[_0x7cfb('0x9')](),controller['getDispositions']);router[_0x7cfb('0x8')]('/:id/contacts',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x10')]);router[_0x7cfb('0x8')]('/:id/contacts/csv',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x11')]);router[_0x7cfb('0x8')](_0x7cfb('0x12'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x13')]);router['get'](_0x7cfb('0x14'),auth[_0x7cfb('0x9')](),controller['getAgents']);router[_0x7cfb('0x15')]('/',auth[_0x7cfb('0x9')](),controller['create']);router[_0x7cfb('0x15')]('/:id/dispositions',auth[_0x7cfb('0x9')](),controller['addDisposition']);router[_0x7cfb('0x15')](_0x7cfb('0x16'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x17')]);router[_0x7cfb('0x15')](_0x7cfb('0x12'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x18')]);router[_0x7cfb('0x15')]('/:id/users',auth[_0x7cfb('0x9')](),controller['addAgents']);router[_0x7cfb('0x19')]('/:id',auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x1a')]);router[_0x7cfb('0x1b')](_0x7cfb('0xd'),auth[_0x7cfb('0x9')](),controller[_0x7cfb('0x1c')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x7cfb('0x14'),auth['isAuthenticated'](),controller[_0x7cfb('0x1d')]);module[_0x7cfb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c24e2e4..d445a5e 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 _0xdfae=['sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdfae,0x111));var _0xedfa=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0xdfae[_0x290fa6];return _0x47f1f3;};'use strict';var Sequelize=require(_0xedfa('0x0'));module[_0xedfa('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4dac2f){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xedfa('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xedfa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3102=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x3102,0x1a8));var _0x2310=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x3102[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0x2310('0x0'));module[_0x2310('0x1')]={'name':{'type':Sequelize[_0x2310('0x2')],'get':function(_0x1d7f8a){return this['getDataValue'](_0x2310('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x2310('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x2310('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index dc57821..6738181 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(_0x44c6ad,_0x40f5b8){var _0x15b4f4=function(_0x360b17){while(--_0x360b17){_0x44c6ad['push'](_0x44c6ad['shift']());}};_0x15b4f4(++_0x40f5b8);}(_0x7a54,0x106));var _0x47a5=function(_0x2cf877,_0x596c2d){_0x2cf877=_0x2cf877-0x0;var _0x5b07d6=_0x7a54[_0x2cf877];return _0x5b07d6;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x4625db,_0x12f635){var _0x26803c=function(_0x1d9b3f){while(--_0x1d9b3f){_0x4625db['push'](_0x4625db['shift']());}};_0x26803c(++_0x12f635);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1324464..c6ce4cf 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 _0xb960=['../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','util','api','request-promise','path','rimraf'];(function(_0x362afe,_0x195e54){var _0x40df26=function(_0x203e09){while(--_0x203e09){_0x362afe['push'](_0x362afe['shift']());}};_0x40df26(++_0x195e54);}(_0xb960,0x176));var _0x0b96=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xb960[_0x33fcbb];return _0x2efe40;};'use strict';var _=require(_0x0b96('0x0'));var util=require(_0x0b96('0x1'));var logger=require('../../config/logger')(_0x0b96('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b96('0x3'));var fs=require('fs');var path=require(_0x0b96('0x4'));var rimraf=require(_0x0b96('0x5'));var config=require(_0x0b96('0x6'));var attributes=require(_0x0b96('0x7'));module['exports']=function(_0x435b4a,_0xc4dbf6){return _0x435b4a['define'](_0x0b96('0x8'),attributes,{'tableName':_0x0b96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c3=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','api','bluebird','request-promise','path'];(function(_0x4bb7b2,_0x509bbb){var _0x80d2ca=function(_0x596297){while(--_0x596297){_0x4bb7b2['push'](_0x4bb7b2['shift']());}};_0x80d2ca(++_0x509bbb);}(_0x82c3,0x132));var _0x382c=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x82c3[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x382c('0x0'));var util=require(_0x382c('0x1'));var logger=require('../../config/logger')(_0x382c('0x2'));var moment=require('moment');var BPromise=require(_0x382c('0x3'));var rp=require(_0x382c('0x4'));var fs=require('fs');var path=require(_0x382c('0x5'));var rimraf=require(_0x382c('0x6'));var config=require(_0x382c('0x7'));var attributes=require(_0x382c('0x8'));module[_0x382c('0x9')]=function(_0x34f566,_0x90b8c0){return _0x34f566[_0x382c('0xa')](_0x382c('0xb'),attributes,{'tableName':_0x382c('0xc'),'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 3cde075..633576e 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 _0xfc64=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xfc64,0x135));var _0x4fc6=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xfc64[_0x59c301];return _0x3866b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4fc6('0x0'));var BPromise=require(_0x4fc6('0x1'));var rs=require(_0x4fc6('0x2'));var fs=require('fs');var Redis=require(_0x4fc6('0x3'));var db=require(_0x4fc6('0x4'))['db'];var utils=require(_0x4fc6('0x5'));var logger=require(_0x4fc6('0x6'))('rpc');var config=require(_0x4fc6('0x7'));var jayson=require(_0x4fc6('0x8'));var client=jayson[_0x4fc6('0x9')][_0x4fc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328110,_0x541f0e,_0x32409b){return new BPromise(function(_0x47e79e,_0x239835){return client[_0x4fc6('0xb')](_0x328110,_0x32409b)['then'](function(_0x204925){logger[_0x4fc6('0xc')](_0x4fc6('0xd'),_0x541f0e,_0x4fc6('0xe'));logger[_0x4fc6('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x541f0e,_0x4fc6('0xe'),JSON[_0x4fc6('0x10')](_0x204925));if(_0x204925[_0x4fc6('0x11')]){if(_0x204925[_0x4fc6('0x11')]['code']===0x1f4){logger[_0x4fc6('0x11')](_0x4fc6('0xd'),_0x541f0e,_0x204925[_0x4fc6('0x11')][_0x4fc6('0x12')]);return _0x239835(_0x204925[_0x4fc6('0x11')][_0x4fc6('0x12')]);}logger['error'](_0x4fc6('0xd'),_0x541f0e,_0x204925[_0x4fc6('0x11')][_0x4fc6('0x12')]);return _0x47e79e(_0x204925['error'][_0x4fc6('0x12')]);}else{logger[_0x4fc6('0xc')](_0x4fc6('0xd'),_0x541f0e,'request\x20sent');_0x47e79e(_0x204925[_0x4fc6('0x13')][_0x4fc6('0x12')]);}})[_0x4fc6('0x14')](function(_0x1fe5e1){logger['error']('Condition,\x20%s,\x20%s',_0x541f0e,_0x1fe5e1);_0x239835(_0x1fe5e1);});});} \ No newline at end of file +var _0x7034=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','message','lodash','bluebird','ioredis','../../config/utils'];(function(_0x1a3de9,_0x25aff8){var _0x56e0fc=function(_0x5380c5){while(--_0x5380c5){_0x1a3de9['push'](_0x1a3de9['shift']());}};_0x56e0fc(++_0x25aff8);}(_0x7034,0x164));var _0x4703=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7034[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x4703('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4703('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4703('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4703('0x3'));var logger=require(_0x4703('0x4'))(_0x4703('0x5'));var config=require(_0x4703('0x6'));var jayson=require(_0x4703('0x7'));var client=jayson['client'][_0x4703('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d5e91,_0x44b49b,_0x44639a){return new BPromise(function(_0x31cd4d,_0x3b2a44){return client[_0x4703('0x9')](_0x3d5e91,_0x44639a)[_0x4703('0xa')](function(_0x2864ba){logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));logger[_0x4703('0xe')](_0x4703('0xf'),_0x44b49b,_0x4703('0xd'),JSON['stringify'](_0x2864ba));if(_0x2864ba[_0x4703('0x10')]){if(_0x2864ba[_0x4703('0x10')]['code']===0x1f4){logger['error'](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x3b2a44(_0x2864ba[_0x4703('0x10')]['message']);}logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x2864ba[_0x4703('0x10')][_0x4703('0x11')]);return _0x31cd4d(_0x2864ba['error'][_0x4703('0x11')]);}else{logger[_0x4703('0xb')](_0x4703('0xc'),_0x44b49b,_0x4703('0xd'));_0x31cd4d(_0x2864ba['result'][_0x4703('0x11')]);}})['catch'](function(_0x4983d1){logger[_0x4703('0x10')](_0x4703('0xc'),_0x44b49b,_0x4983d1);_0x3b2a44(_0x4983d1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index af57a91..47b8fd0 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 _0x5a24=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x5a24,0x1bb));var _0x45a2=function(_0x6c9834,_0x206e85){_0x6c9834=_0x6c9834-0x0;var _0x1cab51=_0x5a24[_0x6c9834];return _0x1cab51;};'use strict';var multer=require(_0x45a2('0x0'));var util=require(_0x45a2('0x1'));var path=require(_0x45a2('0x2'));var timeout=require(_0x45a2('0x3'));var express=require(_0x45a2('0x4'));var router=express[_0x45a2('0x5')]();var fs_extra=require(_0x45a2('0x6'));var auth=require(_0x45a2('0x7'));var interaction=require(_0x45a2('0x8'));var config=require(_0x45a2('0x9'));var controller=require(_0x45a2('0xa'));router[_0x45a2('0xb')](_0x45a2('0xc'),auth['isAuthenticated'](),controller[_0x45a2('0xd')]);router['delete'](_0x45a2('0xc'),auth['isAuthenticated'](),controller[_0x45a2('0xe')]);module['exports']=router; \ No newline at end of file +var _0x93ba=['put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x307d88,_0x3f8bba){var _0x38d74b=function(_0x4ea955){while(--_0x4ea955){_0x307d88['push'](_0x307d88['shift']());}};_0x38d74b(++_0x3f8bba);}(_0x93ba,0x117));var _0xa93b=function(_0x2eb794,_0x27550f){_0x2eb794=_0x2eb794-0x0;var _0x64e283=_0x93ba[_0x2eb794];return _0x64e283;};'use strict';var multer=require(_0xa93b('0x0'));var util=require(_0xa93b('0x1'));var path=require(_0xa93b('0x2'));var timeout=require(_0xa93b('0x3'));var express=require('express');var router=express[_0xa93b('0x4')]();var fs_extra=require(_0xa93b('0x5'));var auth=require(_0xa93b('0x6'));var interaction=require(_0xa93b('0x7'));var config=require(_0xa93b('0x8'));var controller=require('./condition.controller');router[_0xa93b('0x9')]('/:id',auth[_0xa93b('0xa')](),controller[_0xa93b('0xb')]);router[_0xa93b('0xc')](_0xa93b('0xd'),auth['isAuthenticated'](),controller[_0xa93b('0xe')]);module[_0xa93b('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4b8ef3b..c03bc0f 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x579873,_0x4865a9){var _0x222961=function(_0x9605fb){while(--_0x9605fb){_0x579873['push'](_0x579873['shift']());}};_0x222961(++_0x4865a9);}(_0x757a,0xde));var _0xa757=function(_0x50894d,_0x34dddf){_0x50894d=_0x50894d-0x0;var _0xd6b208=_0x757a[_0x50894d];return _0xd6b208;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xa306bb,_0x262db8){var _0x483f9c=function(_0x3a7fc9){while(--_0x3a7fc9){_0xa306bb['push'](_0xa306bb['shift']());}};_0x483f9c(++_0x262db8);}(_0x2032,0xd9));var _0x2203=function(_0x273da5,_0x33d909){_0x273da5=_0x273da5-0x0;var _0xe841d4=_0x2032[_0x273da5];return _0xe841d4;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index fe72b66..a2c7017 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 _0xe73a=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','map','type','VIRTUAL','options','Dashboard','includeAll','include','findAll','show','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','keys','length','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4d50a1,_0x188247){var _0x2d733f=function(_0x4d104c){while(--_0x4d104c){_0x4d50a1['push'](_0x4d50a1['shift']());}};_0x2d733f(++_0x188247);}(_0xe73a,0x80));var _0xae73=function(_0x58256e,_0x48f062){_0x58256e=_0x58256e-0x0;var _0xc9e57b=_0xe73a[_0x58256e];return _0xc9e57b;};'use strict';var emlformat=require(_0xae73('0x0'));var rimraf=require(_0xae73('0x1'));var zipdir=require(_0xae73('0x2'));var jsonpatch=require(_0xae73('0x3'));var rp=require(_0xae73('0x4'));var moment=require(_0xae73('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae73('0x6'));var util=require(_0xae73('0x7'));var path=require('path');var sox=require(_0xae73('0x8'));var csv=require(_0xae73('0x9'));var ejs=require(_0xae73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae73('0xb'));var squel=require(_0xae73('0xc'));var crypto=require(_0xae73('0xd'));var jsforce=require(_0xae73('0xe'));var deskjs=require(_0xae73('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae73('0x10'));var Papa=require('papaparse');var Redis=require(_0xae73('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xae73('0x12'));var as=require(_0xae73('0x13'));var hardwareService=require(_0xae73('0x14'));var logger=require('../../config/logger')(_0xae73('0x15'));var utils=require('../../config/utils');var config=require(_0xae73('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xae73('0x17')](config['redis'],{'host':_0xae73('0x18'),'port':0x18eb});var socket=require(_0xae73('0x19'))(new Redis(config[_0xae73('0x1a')]));require(_0xae73('0x1b'))[_0xae73('0x1c')](socket);function respondWithStatusCode(_0x12dc8c,_0x275d28){_0x275d28=_0x275d28||0xcc;return function(_0x491c00){if(_0x491c00){return _0x12dc8c[_0xae73('0x1d')](_0x275d28);}return _0x12dc8c[_0xae73('0x1e')](_0x275d28)[_0xae73('0x1f')]();};}function respondWithResult(_0x51ebd6,_0x5740c3){_0x5740c3=_0x5740c3||0xc8;return function(_0x22e588){if(_0x22e588){return _0x51ebd6[_0xae73('0x1e')](_0x5740c3)[_0xae73('0x20')](_0x22e588);}};}function respondWithFilteredResult(_0xa12b27,_0x34822d){return function(_0x290ba5){if(_0x290ba5){var _0x3e51cc=typeof _0x34822d[_0xae73('0x21')]==='undefined'&&typeof _0x34822d['limit']==='undefined';var _0x134763=_0x290ba5[_0xae73('0x22')];var _0x520ff3=_0x3e51cc?0x0:_0x34822d[_0xae73('0x21')];var _0xbc2f7d=_0x3e51cc?_0x290ba5['count']:_0x34822d['offset']+_0x34822d[_0xae73('0x23')];var _0x37e00e;if(_0xbc2f7d>=_0x134763){_0xbc2f7d=_0x134763;_0x37e00e=0xc8;}else{_0x37e00e=0xce;}_0xa12b27[_0xae73('0x1e')](_0x37e00e);return _0xa12b27[_0xae73('0x24')](_0xae73('0x25'),_0x520ff3+'-'+_0xbc2f7d+'/'+_0x134763)[_0xae73('0x20')](_0x290ba5);}return null;};}function patchUpdates(_0x47e4fa){return function(_0x18a19d){try{jsonpatch['apply'](_0x18a19d,_0x47e4fa,!![]);}catch(_0x59bb9f){return BPromise[_0xae73('0x26')](_0x59bb9f);}return _0x18a19d[_0xae73('0x27')]();};}function saveUpdates(_0x26ef52,_0x517fb4){return function(_0x4fdb31){if(_0x4fdb31){return _0x4fdb31[_0xae73('0x28')](_0x26ef52)['then'](function(_0x295099){return _0x295099;});}return null;};}function removeEntity(_0x1988f9,_0x1508ac){return function(_0x5eb5f4){if(_0x5eb5f4){return _0x5eb5f4[_0xae73('0x29')]()[_0xae73('0x2a')](function(){var _0x1e2eff=_0x5eb5f4[_0xae73('0x2b')]({'plain':!![]});var _0x2b14c7=_0xae73('0x2c');return db[_0xae73('0x2d')][_0xae73('0x29')]({'where':{'type':_0x2b14c7,'resourceId':_0x1e2eff['id']}})[_0xae73('0x2a')](function(){return _0x5eb5f4;});})['then'](function(){_0x1988f9[_0xae73('0x1e')](0xcc)[_0xae73('0x1f')]();});}};}function handleEntityNotFound(_0xf534f4,_0x3e0155){return function(_0x524a57){if(!_0x524a57){_0xf534f4[_0xae73('0x1d')](0x194);}return _0x524a57;};}function handleError(_0x516a4f,_0x2b7cba){_0x2b7cba=_0x2b7cba||0x1f4;return function(_0x28729a){logger[_0xae73('0x2e')](_0x28729a[_0xae73('0x2f')]);if(_0x28729a['name']){delete _0x28729a[_0xae73('0x30')];}_0x516a4f[_0xae73('0x1e')](_0x2b7cba)[_0xae73('0x31')](_0x28729a);};}exports[_0xae73('0x32')]=function(_0xd95526,_0xbb18de){var _0xa2c19e={},_0x1e5f3a={},_0x9e9ff6={'count':0x0,'rows':[]};var _0x7ee443=_['map'](db['Dashboard'][_0xae73('0x33')],function(_0x12e865){return{'name':_0x12e865['fieldName'],'type':_0x12e865['type'][_0xae73('0x34')]};});_0x1e5f3a[_0xae73('0x35')]=_['map'](_0x7ee443,_0xae73('0x30'));_0x1e5f3a[_0xae73('0x36')]=_['keys'](_0xd95526[_0xae73('0x36')]);_0x1e5f3a[_0xae73('0x37')]=_[_0xae73('0x38')](_0x1e5f3a[_0xae73('0x35')],_0x1e5f3a[_0xae73('0x36')]);_0xa2c19e[_0xae73('0x39')]=_['intersection'](_0x1e5f3a[_0xae73('0x35')],qs['fields'](_0xd95526[_0xae73('0x36')][_0xae73('0x3a')]));_0xa2c19e[_0xae73('0x39')]=_0xa2c19e[_0xae73('0x39')]['length']?_0xa2c19e[_0xae73('0x39')]:_0x1e5f3a[_0xae73('0x35')];if(!_0xd95526[_0xae73('0x36')][_0xae73('0x3b')](_0xae73('0x3c'))){_0xa2c19e['limit']=qs[_0xae73('0x23')](_0xd95526[_0xae73('0x36')][_0xae73('0x23')]);_0xa2c19e[_0xae73('0x21')]=qs[_0xae73('0x21')](_0xd95526['query'][_0xae73('0x21')]);}_0xa2c19e[_0xae73('0x3d')]=qs[_0xae73('0x3e')](_0xd95526[_0xae73('0x36')][_0xae73('0x3e')]);_0xa2c19e['where']=qs[_0xae73('0x37')](_['pick'](_0xd95526['query'],_0x1e5f3a[_0xae73('0x37')]),_0x7ee443);if(_0xd95526['query'][_0xae73('0x3f')]){_0xa2c19e['where']=_[_0xae73('0x40')](_0xa2c19e[_0xae73('0x41')],{'$or':_[_0xae73('0x42')](_0x7ee443,function(_0x4c64aa){if(_0x4c64aa[_0xae73('0x43')]!==_0xae73('0x44')){var _0x485b6c={};_0x485b6c[_0x4c64aa[_0xae73('0x30')]]={'$like':'%'+_0xd95526[_0xae73('0x36')]['filter']+'%'};return _0x485b6c;}})});}_0xa2c19e=_[_0xae73('0x40')]({},_0xa2c19e,_0xd95526[_0xae73('0x45')]);var _0x2bb8ef={'where':_0xa2c19e[_0xae73('0x41')]};return db[_0xae73('0x46')][_0xae73('0x22')](_0x2bb8ef)[_0xae73('0x2a')](function(_0x55eeb1){_0x9e9ff6[_0xae73('0x22')]=_0x55eeb1;if(_0xd95526[_0xae73('0x36')][_0xae73('0x47')]){_0xa2c19e[_0xae73('0x48')]=[{'all':!![]}];}return db[_0xae73('0x46')][_0xae73('0x49')](_0xa2c19e);})[_0xae73('0x2a')](function(_0x30a56e){_0x9e9ff6['rows']=_0x30a56e;return _0x9e9ff6;})[_0xae73('0x2a')](respondWithFilteredResult(_0xbb18de,_0xa2c19e))['catch'](handleError(_0xbb18de,null));};exports[_0xae73('0x4a')]=function(_0x4dfac9,_0x1636fd){var _0x483af2={'raw':![],'where':{'id':_0x4dfac9['params']['id']}},_0xeb0ef1={};_0xeb0ef1[_0xae73('0x35')]=_['keys'](db[_0xae73('0x46')][_0xae73('0x33')]);_0xeb0ef1[_0xae73('0x36')]=_['keys'](_0x4dfac9[_0xae73('0x36')]);_0xeb0ef1[_0xae73('0x37')]=_['intersection'](_0xeb0ef1[_0xae73('0x35')],_0xeb0ef1['query']);_0x483af2[_0xae73('0x39')]=_['intersection'](_0xeb0ef1['model'],qs[_0xae73('0x3a')](_0x4dfac9[_0xae73('0x36')][_0xae73('0x3a')]));_0x483af2[_0xae73('0x39')]=_0x483af2[_0xae73('0x39')]['length']?_0x483af2['attributes']:_0xeb0ef1[_0xae73('0x35')];if(_0x4dfac9[_0xae73('0x36')][_0xae73('0x47')]){_0x483af2[_0xae73('0x48')]=[{'all':!![]}];}_0x483af2=_[_0xae73('0x40')]({},_0x483af2,_0x4dfac9[_0xae73('0x45')]);return db['Dashboard'][_0xae73('0x4b')](_0x483af2)[_0xae73('0x2a')](handleEntityNotFound(_0x1636fd,null))[_0xae73('0x2a')](respondWithResult(_0x1636fd,null))[_0xae73('0x4c')](handleError(_0x1636fd,null));};exports[_0xae73('0x4d')]=function(_0x1cad4b,_0x54e3f7){return db[_0xae73('0x46')]['create'](_0x1cad4b[_0xae73('0x4e')],{})[_0xae73('0x2a')](function(_0x574cae){var _0x285475=_0x1cad4b[_0xae73('0x4f')][_0xae73('0x2b')]({'plain':!![]});if(!_0x285475)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x285475[_0xae73('0x50')]===_0xae73('0x4f')){var _0x11bd23=_0x574cae[_0xae73('0x2b')]({'plain':!![]});var _0x306189=_0xae73('0x2c');return db[_0xae73('0x51')][_0xae73('0x4b')]({'where':{'name':_0x306189,'userProfileId':_0x285475[_0xae73('0x52')]},'raw':!![]})['then'](function(_0x53385e){if(_0x53385e&&_0x53385e[_0xae73('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x11bd23['name'],'resourceId':_0x11bd23['id'],'type':_0x53385e['name'],'sectionId':_0x53385e['id']},{})[_0xae73('0x2a')](function(){return _0x574cae;});}else{return _0x574cae;}})['catch'](function(_0x25237d){logger[_0xae73('0x2e')](_0xae73('0x54'),_0x25237d);throw _0x25237d;});}return _0x574cae;})[_0xae73('0x2a')](respondWithResult(_0x54e3f7,0xc9))[_0xae73('0x4c')](handleError(_0x54e3f7,null));};exports[_0xae73('0x55')]=function(_0x5c0496,_0xe5370f){var _0x28a4f4={'where':{'id':_0x5c0496[_0xae73('0x56')]['id']}},_0x6e605e={};_0x6e605e[_0xae73('0x35')]=_['keys'](db[_0xae73('0x46')][_0xae73('0x33')]);_0x28a4f4[_0xae73('0x39')]=_[_0xae73('0x38')](_0x6e605e['model'],qs[_0xae73('0x3a')](_0x5c0496[_0xae73('0x36')][_0xae73('0x3a')]));_0x28a4f4[_0xae73('0x39')]=_0x28a4f4['attributes']['length']?_0x28a4f4[_0xae73('0x39')]:_0x6e605e['model'];if(_0x5c0496[_0xae73('0x36')][_0xae73('0x47')]){_0x28a4f4[_0xae73('0x48')]=[{'all':!![]}];}_0x28a4f4=_[_0xae73('0x40')]({},_0x28a4f4,_0x5c0496[_0xae73('0x45')]);return db[_0xae73('0x46')][_0xae73('0x4b')](_0x28a4f4)[_0xae73('0x2a')](handleEntityNotFound(_0xe5370f,null))[_0xae73('0x2a')](function(_0x82e548){if(_0x82e548){var _0x5a0930=_0x82e548['get']({'plain':!![]});_0x5a0930=qs['omit'](_0x5a0930,['id','createdAt',_0xae73('0x57')]);_0x5c0496[_0xae73('0x4e')]=_[_0xae73('0x58')](_0x5c0496[_0xae73('0x4e')],['id',_0xae73('0x59'),_0xae73('0x57')]);return db['Dashboard'][_0xae73('0x4d')](_['merge'](_0x5a0930,_0x5c0496['body']),{'include':_0x5c0496[_0xae73('0x36')][_0xae73('0x47')]?[{'all':!![]}]:undefined})[_0xae73('0x2a')](function(_0x4463f7){var _0x545555=_0x5c0496[_0xae73('0x4f')][_0xae73('0x2b')]({'plain':!![]});if(!_0x545555)throw new Error(_0xae73('0x5a'));if(_0x545555[_0xae73('0x50')]===_0xae73('0x4f')){var _0x44852e=_0x4463f7[_0xae73('0x2b')]({'plain':!![]});var _0x414f95='CustomDashboards';return db['UserProfileSection'][_0xae73('0x4b')]({'where':{'name':_0x414f95,'userProfileId':_0x545555[_0xae73('0x52')]},'raw':!![]})[_0xae73('0x2a')](function(_0x574c38){if(_0x574c38&&_0x574c38['autoAssociation']===0x0){return db[_0xae73('0x2d')]['create']({'name':_0x44852e[_0xae73('0x30')],'resourceId':_0x44852e['id'],'type':_0x574c38['name'],'sectionId':_0x574c38['id']},{})[_0xae73('0x2a')](function(){return _0x4463f7;});}else{return _0x4463f7;}})['catch'](function(_0x10e315){logger[_0xae73('0x2e')](_0xae73('0x54'),_0x10e315);throw _0x10e315;});}return _0x4463f7;});}})['then'](respondWithResult(_0xe5370f,0xc9))[_0xae73('0x4c')](handleError(_0xe5370f,null));};exports[_0xae73('0x28')]=function(_0x160431,_0xeed6b2){if(_0x160431['body']['id']){delete _0x160431[_0xae73('0x4e')]['id'];}return db[_0xae73('0x46')][_0xae73('0x4b')]({'where':{'id':_0x160431['params']['id']}})[_0xae73('0x2a')](handleEntityNotFound(_0xeed6b2,null))[_0xae73('0x2a')](saveUpdates(_0x160431['body'],null))['then'](respondWithResult(_0xeed6b2,null))[_0xae73('0x4c')](handleError(_0xeed6b2,null));};exports[_0xae73('0x29')]=function(_0x573015,_0x2d16db){return db['Dashboard'][_0xae73('0x4b')]({'where':{'id':_0x573015['params']['id']}})[_0xae73('0x2a')](handleEntityNotFound(_0x2d16db,null))['then'](removeEntity(_0x2d16db,null))['catch'](handleError(_0x2d16db,null));};function widgetAttributes(_0x14190f){try{switch(_0x14190f[_0xae73('0x43')]){case _0xae73('0x5b'):return[{'name':'attrUrl','value':_0x14190f[_0xae73('0x5c')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['value']:undefined)||_0xae73('0x5e')}];case _0xae73('0x5f'):return[{'name':'attrPath','value':_0x14190f[_0xae73('0x60')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||''}];case _0xae73('0x62'):return[{'name':_0xae73('0x63'),'value':_0x14190f[_0xae73('0x63')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['value']:undefined)||_0xae73('0x64')},{'name':_0xae73('0x65'),'value':_0x14190f[_0xae73('0x65')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1]['value']:undefined)||_0xae73('0x66')},{'name':_0xae73('0x67'),'value':_0x14190f['attrFontSize']||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f['attrs'][0x2][_0xae73('0x61')]:undefined)||0xc}];case _0xae73('0x68'):return[{'name':_0xae73('0x69'),'value':_0x14190f[_0xae73('0x69')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||_0xae73('0x6a')},{'name':_0xae73('0x6b'),'value':_0x14190f['attrVoiceQueues']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||[]},{'name':_0xae73('0x67'),'value':_0x14190f['attrFontSize']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f[_0xae73('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0xae73('0x6c'),'value':_0x14190f[_0xae73('0x6c')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x3]?_0x14190f[_0xae73('0x5d')][0x3][_0xae73('0x61')]:undefined)||_0xae73('0x6d')},{'name':'attrEmailAccounts','value':_0x14190f[_0xae73('0x6e')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x4]?_0x14190f[_0xae73('0x5d')][0x4][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x6f'),'value':_0x14190f[_0xae73('0x6f')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x5]?_0x14190f[_0xae73('0x5d')][0x5][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x70'),'value':_0x14190f[_0xae73('0x70')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x6]?_0x14190f[_0xae73('0x5d')][0x6][_0xae73('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x14190f[_0xae73('0x71')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x7]?_0x14190f[_0xae73('0x5d')][0x7]['value']:undefined)||''},{'name':_0xae73('0x72'),'value':_0x14190f[_0xae73('0x72')]||(_0x14190f['attrs']&&_0x14190f['attrs'][0x8]?_0x14190f['attrs'][0x8]['value']:undefined)||''},{'name':_0xae73('0x73'),'value':_0x14190f[_0xae73('0x73')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x9]?_0x14190f[_0xae73('0x5d')][0x9][_0xae73('0x61')]:undefined)||''}];case _0xae73('0x74'):case _0xae73('0x75'):return[{'name':_0xae73('0x76'),'value':_0x14190f[_0xae73('0x76')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f['attrs'][0x0][_0xae73('0x61')]:undefined)||_0xae73('0x6a')},{'name':_0xae73('0x77'),'value':_0x14190f[_0xae73('0x77')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x78'),'value':_0x14190f['attrSerie3']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x2]?_0x14190f[_0xae73('0x5d')][0x2][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x6b'),'value':_0x14190f[_0xae73('0x6b')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x3]?_0x14190f['attrs'][0x3][_0xae73('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x14190f[_0xae73('0x6c')]||(_0x14190f['attrs']&&_0x14190f['attrs'][0x4]?_0x14190f['attrs'][0x4][_0xae73('0x61')]:undefined)||_0xae73('0x6d')},{'name':_0xae73('0x6e'),'value':_0x14190f['attrEmailAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x5]?_0x14190f[_0xae73('0x5d')][0x5][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x6f'),'value':_0x14190f[_0xae73('0x6f')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x6]?_0x14190f[_0xae73('0x5d')][0x6][_0xae73('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x14190f['attrSmsAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x7]?_0x14190f[_0xae73('0x5d')][0x7][_0xae73('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x14190f[_0xae73('0x71')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f['attrs'][0x8]?_0x14190f[_0xae73('0x5d')][0x8][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x72'),'value':_0x14190f['attrWhatsappAccounts']||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x9]?_0x14190f[_0xae73('0x5d')][0x9][_0xae73('0x61')]:undefined)||''},{'name':_0xae73('0x73'),'value':_0x14190f[_0xae73('0x73')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0xa]?_0x14190f[_0xae73('0x5d')][0xa]['value']:undefined)||''}];case _0xae73('0x79'):return[{'name':_0xae73('0x7a'),'type':_0x14190f[_0xae73('0x7b')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0]['type']:undefined)||null,'value':_0x14190f[_0xae73('0x7a')]||(_0x14190f[_0xae73('0x5d')]&&_0x14190f[_0xae73('0x5d')][0x0]?_0x14190f[_0xae73('0x5d')][0x0][_0xae73('0x61')]:undefined)||null},{'name':_0xae73('0x7c'),'value':_0x14190f[_0xae73('0x7c')]||(_0x14190f['attrs']&&_0x14190f[_0xae73('0x5d')][0x1]?_0x14190f[_0xae73('0x5d')][0x1][_0xae73('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4ab6ee){logger[_0xae73('0x2e')](_0xae73('0x7d'),JSON[_0xae73('0x7e')](_0x4ab6ee));return[];}}exports[_0xae73('0x7f')]=function(_0x683607,_0x22f05d,_0x26f655){if(_0x683607['body']['id']){delete _0x683607[_0xae73('0x4e')]['id'];}return db[_0xae73('0x46')][_0xae73('0x4b')]({'where':{'id':_0x683607['params']['id']}})['then'](handleEntityNotFound(_0x22f05d,null))[_0xae73('0x2a')](function(_0x5e6b91){if(_0x5e6b91){_0x683607[_0xae73('0x4e')][_0xae73('0x80')]=_0x5e6b91['id'];_0x683607[_0xae73('0x4e')][_0xae73('0x5d')]=widgetAttributes(_0x683607['body']);return db[_0xae73('0x81')]['create'](_0x683607[_0xae73('0x4e')]);}})[_0xae73('0x2a')](respondWithResult(_0x22f05d,null))[_0xae73('0x4c')](handleError(_0x22f05d,null));};exports[_0xae73('0x82')]=function(_0x49fb8a,_0x359ad2,_0x47879d){var _0x10aa5c={};var _0x235c37={};var _0x44f492;var _0x34ac27;return db['Dashboard'][_0xae73('0x83')]({'where':{'id':_0x49fb8a[_0xae73('0x56')]['id']}})['then'](handleEntityNotFound(_0x359ad2,null))['then'](function(_0x987fe3){if(_0x987fe3){_0x44f492=_0x987fe3;_0x235c37[_0xae73('0x35')]=_[_0xae73('0x84')](db['DashboardItem'][_0xae73('0x33')]);_0x235c37[_0xae73('0x36')]=_[_0xae73('0x84')](_0x49fb8a[_0xae73('0x36')]);_0x235c37[_0xae73('0x37')]=_[_0xae73('0x38')](_0x235c37['model'],_0x235c37[_0xae73('0x36')]);_0x10aa5c[_0xae73('0x39')]=_[_0xae73('0x38')](_0x235c37[_0xae73('0x35')],qs['fields'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x3a')]));_0x10aa5c[_0xae73('0x39')]=_0x10aa5c[_0xae73('0x39')][_0xae73('0x85')]?_0x10aa5c[_0xae73('0x39')]:_0x235c37[_0xae73('0x35')];_0x10aa5c[_0xae73('0x3d')]=qs[_0xae73('0x3e')](_0x49fb8a['query'][_0xae73('0x3e')]);_0x10aa5c['where']=qs[_0xae73('0x37')](_[_0xae73('0x86')](_0x49fb8a[_0xae73('0x36')],_0x235c37['filters']));if(_0x49fb8a[_0xae73('0x36')][_0xae73('0x3f')]){_0x10aa5c[_0xae73('0x41')]=_[_0xae73('0x40')](_0x10aa5c[_0xae73('0x41')],{'$or':_[_0xae73('0x42')](_0x10aa5c[_0xae73('0x39')],function(_0x4958c2){var _0x1826bc={};_0x1826bc[_0x4958c2]={'$like':'%'+_0x49fb8a[_0xae73('0x36')][_0xae73('0x3f')]+'%'};return _0x1826bc;})});}_0x10aa5c=_[_0xae73('0x40')]({},_0x10aa5c,_0x49fb8a[_0xae73('0x45')]);return _0x44f492[_0xae73('0x82')](_0x10aa5c);}})[_0xae73('0x2a')](function(_0x10bd8a){if(_0x10bd8a){_0x34ac27=_0x10bd8a['length'];if(!_0x49fb8a[_0xae73('0x36')][_0xae73('0x3b')](_0xae73('0x3c'))){_0x10aa5c[_0xae73('0x23')]=qs['limit'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x23')]);_0x10aa5c[_0xae73('0x21')]=qs['offset'](_0x49fb8a[_0xae73('0x36')][_0xae73('0x21')]);}return _0x44f492[_0xae73('0x82')](_0x10aa5c);}})[_0xae73('0x2a')](function(_0x1bb939){if(_0x1bb939){return _0x1bb939?{'count':_0x34ac27,'rows':_0x1bb939}:null;}})['then'](respondWithResult(_0x359ad2,null))[_0xae73('0x4c')](handleError(_0x359ad2,null));}; \ No newline at end of file +var _0x3490=['map','Dashboard','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','catch','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','get','CustomDashboards','end','stack','name','index'];(function(_0x380213,_0x4ce407){var _0x5c640d=function(_0x2f71ad){while(--_0x2f71ad){_0x380213['push'](_0x380213['shift']());}};_0x5c640d(++_0x4ce407);}(_0x3490,0xd1));var _0x0349=function(_0x144b19,_0x459235){_0x144b19=_0x144b19-0x0;var _0x35b0dd=_0x3490[_0x144b19];return _0x35b0dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0349('0x0'));var zipdir=require(_0x0349('0x1'));var jsonpatch=require(_0x0349('0x2'));var rp=require('request-promise');var moment=require(_0x0349('0x3'));var BPromise=require(_0x0349('0x4'));var Mustache=require(_0x0349('0x5'));var util=require(_0x0349('0x6'));var path=require('path');var sox=require(_0x0349('0x7'));var csv=require(_0x0349('0x8'));var ejs=require(_0x0349('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0349('0xa'));var squel=require(_0x0349('0xb'));var crypto=require(_0x0349('0xc'));var jsforce=require(_0x0349('0xd'));var deskjs=require(_0x0349('0xe'));var toCsv=require(_0x0349('0x8'));var querystring=require(_0x0349('0xf'));var Papa=require(_0x0349('0x10'));var Redis=require(_0x0349('0x11'));var authService=require(_0x0349('0x12'));var qs=require(_0x0349('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0349('0x14'));var logger=require(_0x0349('0x15'))('api');var utils=require(_0x0349('0x16'));var config=require(_0x0349('0x17'));var licenseUtil=require(_0x0349('0x18'));var db=require(_0x0349('0x19'))['db'];config[_0x0349('0x1a')]=_[_0x0349('0x1b')](config[_0x0349('0x1a')],{'host':_0x0349('0x1c'),'port':0x18eb});var socket=require(_0x0349('0x1d'))(new Redis(config[_0x0349('0x1a')]));require(_0x0349('0x1e'))[_0x0349('0x1f')](socket);function respondWithStatusCode(_0x222154,_0x5e8e92){_0x5e8e92=_0x5e8e92||0xcc;return function(_0x389102){if(_0x389102){return _0x222154[_0x0349('0x20')](_0x5e8e92);}return _0x222154[_0x0349('0x21')](_0x5e8e92)['end']();};}function respondWithResult(_0x2ae420,_0x59b856){_0x59b856=_0x59b856||0xc8;return function(_0x5e2160){if(_0x5e2160){return _0x2ae420[_0x0349('0x21')](_0x59b856)['json'](_0x5e2160);}};}function respondWithFilteredResult(_0xec8e5a,_0x4d6c45){return function(_0x92e41d){if(_0x92e41d){var _0x2c96aa=typeof _0x4d6c45['offset']==='undefined'&&typeof _0x4d6c45[_0x0349('0x22')]==='undefined';var _0x8500f=_0x92e41d[_0x0349('0x23')];var _0x5d08d9=_0x2c96aa?0x0:_0x4d6c45[_0x0349('0x24')];var _0x963475=_0x2c96aa?_0x92e41d[_0x0349('0x23')]:_0x4d6c45[_0x0349('0x24')]+_0x4d6c45[_0x0349('0x22')];var _0x28bb81;if(_0x963475>=_0x8500f){_0x963475=_0x8500f;_0x28bb81=0xc8;}else{_0x28bb81=0xce;}_0xec8e5a[_0x0349('0x21')](_0x28bb81);return _0xec8e5a[_0x0349('0x25')](_0x0349('0x26'),_0x5d08d9+'-'+_0x963475+'/'+_0x8500f)[_0x0349('0x27')](_0x92e41d);}return null;};}function patchUpdates(_0x18105d){return function(_0x1b511f){try{jsonpatch['apply'](_0x1b511f,_0x18105d,!![]);}catch(_0x382629){return BPromise[_0x0349('0x28')](_0x382629);}return _0x1b511f[_0x0349('0x29')]();};}function saveUpdates(_0x4b3290,_0x55fb97){return function(_0x948f6a){if(_0x948f6a){return _0x948f6a[_0x0349('0x2a')](_0x4b3290)[_0x0349('0x2b')](function(_0x429544){return _0x429544;});}return null;};}function removeEntity(_0x9eae4b,_0x4c4ebc){return function(_0x11e9cd){if(_0x11e9cd){return _0x11e9cd[_0x0349('0x2c')]()['then'](function(){var _0x201e5d=_0x11e9cd[_0x0349('0x2d')]({'plain':!![]});var _0x388a7d=_0x0349('0x2e');return db['UserProfileResource'][_0x0349('0x2c')]({'where':{'type':_0x388a7d,'resourceId':_0x201e5d['id']}})[_0x0349('0x2b')](function(){return _0x11e9cd;});})['then'](function(){_0x9eae4b[_0x0349('0x21')](0xcc)[_0x0349('0x2f')]();});}};}function handleEntityNotFound(_0x4a3ed7,_0x50728b){return function(_0x2feb05){if(!_0x2feb05){_0x4a3ed7[_0x0349('0x20')](0x194);}return _0x2feb05;};}function handleError(_0xc2b731,_0x18b29b){_0x18b29b=_0x18b29b||0x1f4;return function(_0x1f333b){logger['error'](_0x1f333b[_0x0349('0x30')]);if(_0x1f333b[_0x0349('0x31')]){delete _0x1f333b[_0x0349('0x31')];}_0xc2b731[_0x0349('0x21')](_0x18b29b)['send'](_0x1f333b);};}exports[_0x0349('0x32')]=function(_0x2ce75f,_0x3843ed){var _0x2ddc47={},_0x3223a6={},_0x23f1c4={'count':0x0,'rows':[]};var _0x110ffa=_[_0x0349('0x33')](db[_0x0349('0x34')][_0x0349('0x35')],function(_0x2ab877){return{'name':_0x2ab877[_0x0349('0x36')],'type':_0x2ab877[_0x0349('0x37')][_0x0349('0x38')]};});_0x3223a6['model']=_[_0x0349('0x33')](_0x110ffa,_0x0349('0x31'));_0x3223a6['query']=_[_0x0349('0x39')](_0x2ce75f[_0x0349('0x3a')]);_0x3223a6[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x3223a6[_0x0349('0x3d')],_0x3223a6['query']);_0x2ddc47[_0x0349('0x3e')]=_[_0x0349('0x3c')](_0x3223a6[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x2ce75f[_0x0349('0x3a')]['fields']));_0x2ddc47[_0x0349('0x3e')]=_0x2ddc47[_0x0349('0x3e')]['length']?_0x2ddc47[_0x0349('0x3e')]:_0x3223a6[_0x0349('0x3d')];if(!_0x2ce75f[_0x0349('0x3a')][_0x0349('0x40')](_0x0349('0x41'))){_0x2ddc47['limit']=qs[_0x0349('0x22')](_0x2ce75f[_0x0349('0x3a')][_0x0349('0x22')]);_0x2ddc47[_0x0349('0x24')]=qs[_0x0349('0x24')](_0x2ce75f['query'][_0x0349('0x24')]);}_0x2ddc47[_0x0349('0x42')]=qs['sort'](_0x2ce75f['query'][_0x0349('0x43')]);_0x2ddc47[_0x0349('0x44')]=qs[_0x0349('0x3b')](_['pick'](_0x2ce75f[_0x0349('0x3a')],_0x3223a6[_0x0349('0x3b')]),_0x110ffa);if(_0x2ce75f[_0x0349('0x3a')][_0x0349('0x45')]){_0x2ddc47[_0x0349('0x44')]=_[_0x0349('0x46')](_0x2ddc47['where'],{'$or':_[_0x0349('0x33')](_0x110ffa,function(_0x4f36f1){if(_0x4f36f1['type']!=='VIRTUAL'){var _0x4402ca={};_0x4402ca[_0x4f36f1[_0x0349('0x31')]]={'$like':'%'+_0x2ce75f[_0x0349('0x3a')][_0x0349('0x45')]+'%'};return _0x4402ca;}})});}_0x2ddc47=_[_0x0349('0x46')]({},_0x2ddc47,_0x2ce75f['options']);var _0x2b050d={'where':_0x2ddc47['where']};return db[_0x0349('0x34')][_0x0349('0x23')](_0x2b050d)['then'](function(_0x172703){_0x23f1c4[_0x0349('0x23')]=_0x172703;if(_0x2ce75f[_0x0349('0x3a')]['includeAll']){_0x2ddc47[_0x0349('0x47')]=[{'all':!![]}];}return db[_0x0349('0x34')][_0x0349('0x48')](_0x2ddc47);})[_0x0349('0x2b')](function(_0x110d80){_0x23f1c4['rows']=_0x110d80;return _0x23f1c4;})['then'](respondWithFilteredResult(_0x3843ed,_0x2ddc47))[_0x0349('0x49')](handleError(_0x3843ed,null));};exports[_0x0349('0x4a')]=function(_0x1cc8eb,_0x24fd6d){var _0x5b7a52={'raw':![],'where':{'id':_0x1cc8eb[_0x0349('0x4b')]['id']}},_0x2978f5={};_0x2978f5[_0x0349('0x3d')]=_['keys'](db['Dashboard'][_0x0349('0x35')]);_0x2978f5['query']=_[_0x0349('0x39')](_0x1cc8eb['query']);_0x2978f5[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x2978f5[_0x0349('0x3d')],_0x2978f5[_0x0349('0x3a')]);_0x5b7a52[_0x0349('0x3e')]=_[_0x0349('0x3c')](_0x2978f5['model'],qs[_0x0349('0x3f')](_0x1cc8eb[_0x0349('0x3a')][_0x0349('0x3f')]));_0x5b7a52['attributes']=_0x5b7a52[_0x0349('0x3e')][_0x0349('0x4c')]?_0x5b7a52[_0x0349('0x3e')]:_0x2978f5[_0x0349('0x3d')];if(_0x1cc8eb[_0x0349('0x3a')][_0x0349('0x4d')]){_0x5b7a52[_0x0349('0x47')]=[{'all':!![]}];}_0x5b7a52=_[_0x0349('0x46')]({},_0x5b7a52,_0x1cc8eb[_0x0349('0x4e')]);return db['Dashboard'][_0x0349('0x4f')](_0x5b7a52)[_0x0349('0x2b')](handleEntityNotFound(_0x24fd6d,null))[_0x0349('0x2b')](respondWithResult(_0x24fd6d,null))[_0x0349('0x49')](handleError(_0x24fd6d,null));};exports[_0x0349('0x50')]=function(_0x5a1ab2,_0x4b850d){return db[_0x0349('0x34')][_0x0349('0x50')](_0x5a1ab2[_0x0349('0x51')],{})[_0x0349('0x2b')](function(_0x49e0d1){var _0x283a40=_0x5a1ab2[_0x0349('0x52')][_0x0349('0x2d')]({'plain':!![]});if(!_0x283a40)throw new Error(_0x0349('0x53'));if(_0x283a40[_0x0349('0x54')]===_0x0349('0x52')){var _0x2290bb=_0x49e0d1[_0x0349('0x2d')]({'plain':!![]});var _0x483dac=_0x0349('0x2e');return db[_0x0349('0x55')][_0x0349('0x4f')]({'where':{'name':_0x483dac,'userProfileId':_0x283a40[_0x0349('0x56')]},'raw':!![]})[_0x0349('0x2b')](function(_0x59c965){if(_0x59c965&&_0x59c965[_0x0349('0x57')]===0x0){return db['UserProfileResource'][_0x0349('0x50')]({'name':_0x2290bb[_0x0349('0x31')],'resourceId':_0x2290bb['id'],'type':_0x59c965[_0x0349('0x31')],'sectionId':_0x59c965['id']},{})[_0x0349('0x2b')](function(){return _0x49e0d1;});}else{return _0x49e0d1;}})[_0x0349('0x49')](function(_0x2da907){logger[_0x0349('0x58')](_0x0349('0x59'),_0x2da907);throw _0x2da907;});}return _0x49e0d1;})[_0x0349('0x2b')](respondWithResult(_0x4b850d,0xc9))['catch'](handleError(_0x4b850d,null));};exports[_0x0349('0x5a')]=function(_0x3536e,_0x220fd2){var _0x42a137={'where':{'id':_0x3536e[_0x0349('0x4b')]['id']}},_0x122ce7={};_0x122ce7[_0x0349('0x3d')]=_[_0x0349('0x39')](db['Dashboard'][_0x0349('0x35')]);_0x42a137['attributes']=_[_0x0349('0x3c')](_0x122ce7[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x3536e[_0x0349('0x3a')][_0x0349('0x3f')]));_0x42a137[_0x0349('0x3e')]=_0x42a137[_0x0349('0x3e')][_0x0349('0x4c')]?_0x42a137[_0x0349('0x3e')]:_0x122ce7['model'];if(_0x3536e[_0x0349('0x3a')][_0x0349('0x4d')]){_0x42a137[_0x0349('0x47')]=[{'all':!![]}];}_0x42a137=_['merge']({},_0x42a137,_0x3536e[_0x0349('0x4e')]);return db[_0x0349('0x34')]['find'](_0x42a137)['then'](handleEntityNotFound(_0x220fd2,null))[_0x0349('0x2b')](function(_0x56c424){if(_0x56c424){var _0x51fe1b=_0x56c424[_0x0349('0x2d')]({'plain':!![]});_0x51fe1b=qs[_0x0349('0x5b')](_0x51fe1b,['id','createdAt',_0x0349('0x5c')]);_0x3536e[_0x0349('0x51')]=_[_0x0349('0x5b')](_0x3536e[_0x0349('0x51')],['id',_0x0349('0x5d'),'updatedAt']);return db[_0x0349('0x34')]['create'](_['merge'](_0x51fe1b,_0x3536e[_0x0349('0x51')]),{'include':_0x3536e[_0x0349('0x3a')][_0x0349('0x4d')]?[{'all':!![]}]:undefined})[_0x0349('0x2b')](function(_0x4f0050){var _0x2e403e=_0x3536e[_0x0349('0x52')][_0x0349('0x2d')]({'plain':!![]});if(!_0x2e403e)throw new Error(_0x0349('0x53'));if(_0x2e403e[_0x0349('0x54')]===_0x0349('0x52')){var _0x2ee72b=_0x4f0050[_0x0349('0x2d')]({'plain':!![]});var _0x1c16d3='CustomDashboards';return db[_0x0349('0x55')][_0x0349('0x4f')]({'where':{'name':_0x1c16d3,'userProfileId':_0x2e403e[_0x0349('0x56')]},'raw':!![]})[_0x0349('0x2b')](function(_0x5b5944){if(_0x5b5944&&_0x5b5944[_0x0349('0x57')]===0x0){return db['UserProfileResource'][_0x0349('0x50')]({'name':_0x2ee72b[_0x0349('0x31')],'resourceId':_0x2ee72b['id'],'type':_0x5b5944[_0x0349('0x31')],'sectionId':_0x5b5944['id']},{})[_0x0349('0x2b')](function(){return _0x4f0050;});}else{return _0x4f0050;}})[_0x0349('0x49')](function(_0x106299){logger[_0x0349('0x58')](_0x0349('0x59'),_0x106299);throw _0x106299;});}return _0x4f0050;});}})['then'](respondWithResult(_0x220fd2,0xc9))[_0x0349('0x49')](handleError(_0x220fd2,null));};exports['update']=function(_0x33b131,_0x4f2e75){if(_0x33b131[_0x0349('0x51')]['id']){delete _0x33b131['body']['id'];}return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x33b131[_0x0349('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f2e75,null))[_0x0349('0x2b')](saveUpdates(_0x33b131[_0x0349('0x51')],null))['then'](respondWithResult(_0x4f2e75,null))[_0x0349('0x49')](handleError(_0x4f2e75,null));};exports[_0x0349('0x2c')]=function(_0x165453,_0x15572a){return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x165453['params']['id']}})['then'](handleEntityNotFound(_0x15572a,null))[_0x0349('0x2b')](removeEntity(_0x15572a,null))[_0x0349('0x49')](handleError(_0x15572a,null));};function widgetAttributes(_0x5ef109){try{switch(_0x5ef109[_0x0349('0x37')]){case _0x0349('0x5e'):return[{'name':_0x0349('0x5f'),'value':_0x5ef109[_0x0349('0x5f')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x62')}];case _0x0349('0x63'):return[{'name':_0x0349('0x64'),'value':_0x5ef109[_0x0349('0x64')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x61')]:undefined)||''}];case _0x0349('0x65'):return[{'name':_0x0349('0x66'),'value':_0x5ef109[_0x0349('0x66')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x67')},{'name':_0x0349('0x68'),'value':_0x5ef109[_0x0349('0x68')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109[_0x0349('0x60')][0x1][_0x0349('0x61')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x5ef109[_0x0349('0x69')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x2]?_0x5ef109[_0x0349('0x60')][0x2]['value']:undefined)||0xc}];case _0x0349('0x6a'):return[{'name':_0x0349('0x6b'),'value':_0x5ef109[_0x0349('0x6b')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||_0x0349('0x6c')},{'name':_0x0349('0x6d'),'value':_0x5ef109[_0x0349('0x6d')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109[_0x0349('0x60')][0x1]['value']:undefined)||[]},{'name':_0x0349('0x69'),'value':_0x5ef109['attrFontSize']||(_0x5ef109['attrs']&&_0x5ef109['attrs'][0x2]?_0x5ef109[_0x0349('0x60')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5ef109[_0x0349('0x6e')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x3]?_0x5ef109[_0x0349('0x60')][0x3][_0x0349('0x61')]:undefined)||_0x0349('0x6f')},{'name':_0x0349('0x70'),'value':_0x5ef109[_0x0349('0x70')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x4]?_0x5ef109[_0x0349('0x60')][0x4][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x71'),'value':_0x5ef109[_0x0349('0x71')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x5]?_0x5ef109[_0x0349('0x60')][0x5]['value']:undefined)||''},{'name':_0x0349('0x72'),'value':_0x5ef109[_0x0349('0x72')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x6]?_0x5ef109[_0x0349('0x60')][0x6]['value']:undefined)||''},{'name':_0x0349('0x73'),'value':_0x5ef109[_0x0349('0x73')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x7]?_0x5ef109[_0x0349('0x60')][0x7]['value']:undefined)||''},{'name':_0x0349('0x74'),'value':_0x5ef109['attrWhatsappAccounts']||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x8]?_0x5ef109[_0x0349('0x60')][0x8][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x75'),'value':_0x5ef109[_0x0349('0x75')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x9]?_0x5ef109['attrs'][0x9]['value']:undefined)||''}];case _0x0349('0x76'):case'pie-chart':return[{'name':_0x0349('0x77'),'value':_0x5ef109[_0x0349('0x77')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||'total'},{'name':_0x0349('0x78'),'value':_0x5ef109[_0x0349('0x78')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x1]?_0x5ef109['attrs'][0x1]['value']:undefined)||null},{'name':_0x0349('0x79'),'value':_0x5ef109[_0x0349('0x79')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x2]?_0x5ef109['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5ef109[_0x0349('0x6d')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x3]?_0x5ef109['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x5ef109[_0x0349('0x6e')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x4]?_0x5ef109['attrs'][0x4][_0x0349('0x61')]:undefined)||'voice'},{'name':_0x0349('0x70'),'value':_0x5ef109[_0x0349('0x70')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x5]?_0x5ef109['attrs'][0x5][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x71'),'value':_0x5ef109[_0x0349('0x71')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x6]?_0x5ef109[_0x0349('0x60')][0x6][_0x0349('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5ef109[_0x0349('0x72')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x7]?_0x5ef109[_0x0349('0x60')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5ef109[_0x0349('0x73')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x8]?_0x5ef109[_0x0349('0x60')][0x8]['value']:undefined)||''},{'name':_0x0349('0x74'),'value':_0x5ef109[_0x0349('0x74')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x9]?_0x5ef109[_0x0349('0x60')][0x9][_0x0349('0x61')]:undefined)||''},{'name':_0x0349('0x75'),'value':_0x5ef109[_0x0349('0x75')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0xa]?_0x5ef109[_0x0349('0x60')][0xa][_0x0349('0x61')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x5ef109['reportType']||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109[_0x0349('0x60')][0x0][_0x0349('0x37')]:undefined)||null,'value':_0x5ef109[_0x0349('0x7a')]||(_0x5ef109['attrs']&&_0x5ef109[_0x0349('0x60')][0x0]?_0x5ef109['attrs'][0x0][_0x0349('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x5ef109[_0x0349('0x7b')]||(_0x5ef109[_0x0349('0x60')]&&_0x5ef109['attrs'][0x1]?_0x5ef109[_0x0349('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x363a11){logger['error'](_0x0349('0x7c'),JSON[_0x0349('0x7d')](_0x363a11));return[];}}exports[_0x0349('0x7e')]=function(_0x4ae153,_0x1087d3,_0x524851){if(_0x4ae153[_0x0349('0x51')]['id']){delete _0x4ae153[_0x0349('0x51')]['id'];}return db['Dashboard'][_0x0349('0x4f')]({'where':{'id':_0x4ae153[_0x0349('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1087d3,null))['then'](function(_0x1376c6){if(_0x1376c6){_0x4ae153['body']['DashboardId']=_0x1376c6['id'];_0x4ae153[_0x0349('0x51')][_0x0349('0x60')]=widgetAttributes(_0x4ae153['body']);return db[_0x0349('0x7f')]['create'](_0x4ae153['body']);}})[_0x0349('0x2b')](respondWithResult(_0x1087d3,null))[_0x0349('0x49')](handleError(_0x1087d3,null));};exports['getItems']=function(_0x5d27ac,_0xc9cb3b,_0x184109){var _0x270701={};var _0x59a801={};var _0x1809d8;var _0x31b5c1;return db['Dashboard'][_0x0349('0x80')]({'where':{'id':_0x5d27ac[_0x0349('0x4b')]['id']}})[_0x0349('0x2b')](handleEntityNotFound(_0xc9cb3b,null))['then'](function(_0x53c693){if(_0x53c693){_0x1809d8=_0x53c693;_0x59a801[_0x0349('0x3d')]=_[_0x0349('0x39')](db[_0x0349('0x7f')][_0x0349('0x35')]);_0x59a801[_0x0349('0x3a')]=_[_0x0349('0x39')](_0x5d27ac[_0x0349('0x3a')]);_0x59a801[_0x0349('0x3b')]=_[_0x0349('0x3c')](_0x59a801[_0x0349('0x3d')],_0x59a801[_0x0349('0x3a')]);_0x270701['attributes']=_[_0x0349('0x3c')](_0x59a801[_0x0349('0x3d')],qs[_0x0349('0x3f')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x3f')]));_0x270701['attributes']=_0x270701['attributes'][_0x0349('0x4c')]?_0x270701['attributes']:_0x59a801['model'];_0x270701[_0x0349('0x42')]=qs['sort'](_0x5d27ac['query'][_0x0349('0x43')]);_0x270701[_0x0349('0x44')]=qs[_0x0349('0x3b')](_['pick'](_0x5d27ac['query'],_0x59a801[_0x0349('0x3b')]));if(_0x5d27ac[_0x0349('0x3a')][_0x0349('0x45')]){_0x270701[_0x0349('0x44')]=_['merge'](_0x270701[_0x0349('0x44')],{'$or':_[_0x0349('0x33')](_0x270701[_0x0349('0x3e')],function(_0x3bf102){var _0x3e5589={};_0x3e5589[_0x3bf102]={'$like':'%'+_0x5d27ac[_0x0349('0x3a')][_0x0349('0x45')]+'%'};return _0x3e5589;})});}_0x270701=_[_0x0349('0x46')]({},_0x270701,_0x5d27ac['options']);return _0x1809d8[_0x0349('0x81')](_0x270701);}})[_0x0349('0x2b')](function(_0x2f186e){if(_0x2f186e){_0x31b5c1=_0x2f186e[_0x0349('0x4c')];if(!_0x5d27ac['query']['hasOwnProperty']('nolimit')){_0x270701[_0x0349('0x22')]=qs[_0x0349('0x22')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x22')]);_0x270701['offset']=qs[_0x0349('0x24')](_0x5d27ac[_0x0349('0x3a')][_0x0349('0x24')]);}return _0x1809d8['getItems'](_0x270701);}})[_0x0349('0x2b')](function(_0x47b4d2){if(_0x47b4d2){return _0x47b4d2?{'count':_0x31b5c1,'rows':_0x47b4d2}:null;}})[_0x0349('0x2b')](respondWithResult(_0xc9cb3b,null))[_0x0349('0x49')](handleError(_0xc9cb3b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b12a3e4..f820be6 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 _0xaac6=['emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','remove'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xaac6,0x11b));var _0x6aac=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xaac6[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x6aac('0x0'));var Dashboard=require(_0x6aac('0x1'))['db'][_0x6aac('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6aac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6aac('0x4')};function emitEvent(_0x39987c){return function(_0x2b6f51,_0x5a9a38,_0x1a1c9d){DashboardEvents[_0x6aac('0x5')](_0x39987c+':'+_0x2b6f51['id'],_0x2b6f51);DashboardEvents[_0x6aac('0x5')](_0x39987c,_0x2b6f51);_0x1a1c9d(null);};}for(var e in events){if(events[_0x6aac('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x6aac('0x7')]=DashboardEvents; \ No newline at end of file +var _0xfe33=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x31980d,_0x3615f6){var _0x372a55=function(_0x282df7){while(--_0x282df7){_0x31980d['push'](_0x31980d['shift']());}};_0x372a55(++_0x3615f6);}(_0xfe33,0x13e));var _0x3fe3=function(_0x508986,_0x43d040){_0x508986=_0x508986-0x0;var _0x25d13a=_0xfe33[_0x508986];return _0x25d13a;};'use strict';var EventEmitter=require(_0x3fe3('0x0'));var Dashboard=require(_0x3fe3('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3fe3('0x2')](0x0);var events={'afterCreate':_0x3fe3('0x3'),'afterUpdate':_0x3fe3('0x4'),'afterDestroy':_0x3fe3('0x5')};function emitEvent(_0x2cef79){return function(_0x201cb7,_0xcceeeb,_0x239b97){DashboardEvents[_0x3fe3('0x6')](_0x2cef79+':'+_0x201cb7['id'],_0x201cb7);DashboardEvents['emit'](_0x2cef79,_0x201cb7);_0x239b97(null);};}for(var e in events){if(events[_0x3fe3('0x7')](e)){var event=events[e];Dashboard[_0x3fe3('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e5396ba..fbb65be 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 _0xed2a=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','dashboards','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xed2a,0x1e8));var _0xaed2=function(_0x3ec5f0,_0x18ddbc){_0x3ec5f0=_0x3ec5f0-0x0;var _0xf9ace0=_0xed2a[_0x3ec5f0];return _0xf9ace0;};'use strict';var _=require(_0xaed2('0x0'));var util=require(_0xaed2('0x1'));var logger=require(_0xaed2('0x2'))(_0xaed2('0x3'));var moment=require(_0xaed2('0x4'));var BPromise=require(_0xaed2('0x5'));var rp=require(_0xaed2('0x6'));var fs=require('fs');var path=require(_0xaed2('0x7'));var rimraf=require(_0xaed2('0x8'));var config=require(_0xaed2('0x9'));var attributes=require(_0xaed2('0xa'));module[_0xaed2('0xb')]=function(_0x3c4b85,_0x41fe9d){return _0x3c4b85['define']('Dashboard',attributes,{'tableName':_0xaed2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa3=['./dashboard.attributes','exports','Dashboard','dashboards','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2d8d65,_0x4db2c0){var _0x434585=function(_0x4de1e2){while(--_0x4de1e2){_0x2d8d65['push'](_0x2d8d65['shift']());}};_0x434585(++_0x4db2c0);}(_0xcfa3,0x88));var _0x3cfa=function(_0x561db7,_0x4ba8ea){_0x561db7=_0x561db7-0x0;var _0x5b2845=_0xcfa3[_0x561db7];return _0x5b2845;};'use strict';var _=require('lodash');var util=require(_0x3cfa('0x0'));var logger=require('../../config/logger')(_0x3cfa('0x1'));var moment=require(_0x3cfa('0x2'));var BPromise=require('bluebird');var rp=require(_0x3cfa('0x3'));var fs=require('fs');var path=require(_0x3cfa('0x4'));var rimraf=require(_0x3cfa('0x5'));var config=require(_0x3cfa('0x6'));var attributes=require(_0x3cfa('0x7'));module[_0x3cfa('0x8')]=function(_0x3adb1e,_0x454773){return _0x3adb1e['define'](_0x3cfa('0x9'),attributes,{'tableName':_0x3cfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8be1823..c436012 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 _0xaa73=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x41fa20,_0x5bac83){var _0x1260e4=function(_0x2f64d8){while(--_0x2f64d8){_0x41fa20['push'](_0x41fa20['shift']());}};_0x1260e4(++_0x5bac83);}(_0xaa73,0xe2));var _0x3aa7=function(_0x44f310,_0x41b638){_0x44f310=_0x44f310-0x0;var _0x1f97da=_0xaa73[_0x44f310];return _0x1f97da;};'use strict';var _=require(_0x3aa7('0x0'));var util=require(_0x3aa7('0x1'));var moment=require(_0x3aa7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3aa7('0x3'));var fs=require('fs');var Redis=require(_0x3aa7('0x4'));var db=require(_0x3aa7('0x5'))['db'];var utils=require(_0x3aa7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3aa7('0x7'));var jayson=require(_0x3aa7('0x8'));var client=jayson['client'][_0x3aa7('0x9')]({'port':0x232a});config['redis']=_[_0x3aa7('0xa')](config[_0x3aa7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3aa7('0xc'))(new Redis(config[_0x3aa7('0xb')]));require('./dashboard.socket')[_0x3aa7('0xd')](socket);function respondWithRpcPromise(_0x4b61b9,_0x117dfc,_0x1ae3e2){return new BPromise(function(_0x42eccc,_0x2d2b4f){return client[_0x3aa7('0xe')](_0x4b61b9,_0x1ae3e2)['then'](function(_0x498724){logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));logger[_0x3aa7('0x12')](_0x3aa7('0x13'),_0x117dfc,_0x3aa7('0x11'),JSON[_0x3aa7('0x14')](_0x498724));if(_0x498724[_0x3aa7('0x15')]){if(_0x498724[_0x3aa7('0x15')]['code']===0x1f4){logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')]['message']);return _0x2d2b4f(_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);}logger['error'](_0x3aa7('0x10'),_0x117dfc,_0x498724[_0x3aa7('0x15')][_0x3aa7('0x16')]);return _0x42eccc(_0x498724[_0x3aa7('0x15')]['message']);}else{logger[_0x3aa7('0xf')](_0x3aa7('0x10'),_0x117dfc,_0x3aa7('0x11'));_0x42eccc(_0x498724[_0x3aa7('0x17')]['message']);}})[_0x3aa7('0x18')](function(_0x1169b2){logger[_0x3aa7('0x15')](_0x3aa7('0x10'),_0x117dfc,_0x1169b2);_0x2d2b4f(_0x1169b2);});});} \ No newline at end of file +var _0x889a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xfb299e,_0x2ca984){var _0x564de9=function(_0x39e05f){while(--_0x39e05f){_0xfb299e['push'](_0xfb299e['shift']());}};_0x564de9(++_0x2ca984);}(_0x889a,0x109));var _0xa889=function(_0x161622,_0x5012f3){_0x161622=_0x161622-0x0;var _0x296b15=_0x889a[_0x161622];return _0x296b15;};'use strict';var _=require(_0xa889('0x0'));var util=require(_0xa889('0x1'));var moment=require(_0xa889('0x2'));var BPromise=require(_0xa889('0x3'));var rs=require(_0xa889('0x4'));var fs=require('fs');var Redis=require(_0xa889('0x5'));var db=require(_0xa889('0x6'))['db'];var utils=require(_0xa889('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa889('0x8'));var jayson=require(_0xa889('0x9'));var client=jayson[_0xa889('0xa')][_0xa889('0xb')]({'port':0x232a});config[_0xa889('0xc')]=_[_0xa889('0xd')](config[_0xa889('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa889('0xe'))(new Redis(config[_0xa889('0xc')]));require(_0xa889('0xf'))[_0xa889('0x10')](socket);function respondWithRpcPromise(_0x5c9455,_0x186b36,_0x277744){return new BPromise(function(_0x418d25,_0x4eb598){return client['request'](_0x5c9455,_0x277744)[_0xa889('0x11')](function(_0x260cf5){logger[_0xa889('0x12')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0xa889('0x13'));logger[_0xa889('0x14')](_0xa889('0x15'),_0x186b36,_0xa889('0x13'),JSON['stringify'](_0x260cf5));if(_0x260cf5['error']){if(_0x260cf5[_0xa889('0x16')][_0xa889('0x17')]===0x1f4){logger[_0xa889('0x16')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0x260cf5[_0xa889('0x16')]['message']);return _0x4eb598(_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);}logger[_0xa889('0x16')]('Dashboard,\x20%s,\x20%s',_0x186b36,_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);return _0x418d25(_0x260cf5[_0xa889('0x16')][_0xa889('0x18')]);}else{logger[_0xa889('0x12')](_0xa889('0x19'),_0x186b36,_0xa889('0x13'));_0x418d25(_0x260cf5['result'][_0xa889('0x18')]);}})[_0xa889('0x1a')](function(_0x597b49){logger[_0xa889('0x16')](_0xa889('0x19'),_0x186b36,_0x597b49);_0x4eb598(_0x597b49);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e0b0d53..b352e21 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 _0xd234=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xd234,0x151));var _0x4d23=function(_0x1161b7,_0x1214f1){_0x1161b7=_0x1161b7-0x0;var _0x519c92=_0xd234[_0x1161b7];return _0x519c92;};'use strict';var DashboardEvents=require(_0x4d23('0x0'));var events=[_0x4d23('0x1'),_0x4d23('0x2'),_0x4d23('0x3')];function createListener(_0xad4a30,_0x1fce9e){return function(_0xa989e8){_0x1fce9e[_0x4d23('0x4')](_0xad4a30,_0xa989e8);};}function removeListener(_0x47965b,_0x5cd8db){return function(){DashboardEvents[_0x4d23('0x5')](_0x47965b,_0x5cd8db);};}exports[_0x4d23('0x6')]=function(_0x5ce919){for(var _0x20df44=0x0,_0x3e3381=events['length'];_0x20df44<_0x3e3381;_0x20df44++){var _0x12d463=events[_0x20df44];var _0x412799=createListener(_0x4d23('0x7')+_0x12d463,_0x5ce919);DashboardEvents['on'](_0x12d463,_0x412799);}}; \ No newline at end of file +var _0x0f0d=['save','remove','update','removeListener','register','dashboard:','./dashboard.events'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x0f0d,0xf4));var _0xd0f0=function(_0x44124b,_0x2b2b32){_0x44124b=_0x44124b-0x0;var _0xafe8bf=_0x0f0d[_0x44124b];return _0xafe8bf;};'use strict';var DashboardEvents=require(_0xd0f0('0x0'));var events=[_0xd0f0('0x1'),_0xd0f0('0x2'),_0xd0f0('0x3')];function createListener(_0x2f33cc,_0x21b88e){return function(_0x3cac25){_0x21b88e['emit'](_0x2f33cc,_0x3cac25);};}function removeListener(_0x58cb91,_0x3276e4){return function(){DashboardEvents[_0xd0f0('0x4')](_0x58cb91,_0x3276e4);};}exports[_0xd0f0('0x5')]=function(_0x2bb695){for(var _0x44fee8=0x0,_0x462ed4=events['length'];_0x44fee8<_0x462ed4;_0x44fee8++){var _0x122623=events[_0x44fee8];var _0x36a2d2=createListener(_0xd0f0('0x6')+_0x122623,_0x2bb695);DashboardEvents['on'](_0x122623,_0x36a2d2);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2e307fd..9afdb7b 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 _0x2214=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports'];(function(_0x2ac61f,_0x3f0ec0){var _0x5df70a=function(_0x21c7be){while(--_0x21c7be){_0x2ac61f['push'](_0x2ac61f['shift']());}};_0x5df70a(++_0x3f0ec0);}(_0x2214,0x138));var _0x4221=function(_0x1f8399,_0x29a098){_0x1f8399=_0x1f8399-0x0;var _0x27f551=_0x2214[_0x1f8399];return _0x27f551;};'use strict';var multer=require('multer');var util=require(_0x4221('0x0'));var path=require('path');var timeout=require(_0x4221('0x1'));var express=require(_0x4221('0x2'));var router=express[_0x4221('0x3')]();var fs_extra=require(_0x4221('0x4'));var auth=require(_0x4221('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4221('0x6'));router[_0x4221('0x7')]('/',auth[_0x4221('0x8')](),controller[_0x4221('0x9')]);router[_0x4221('0x7')](_0x4221('0xa'),auth['isAuthenticated'](),controller[_0x4221('0xb')]);router[_0x4221('0x7')](_0x4221('0xc'),auth['isAuthenticated'](),controller[_0x4221('0xd')]);router[_0x4221('0xe')]('/',auth[_0x4221('0x8')](),controller[_0x4221('0xf')]);router['post'](_0x4221('0x10'),auth[_0x4221('0x8')](),controller[_0x4221('0x11')]);router[_0x4221('0xe')](_0x4221('0xc'),auth[_0x4221('0x8')](),controller[_0x4221('0x12')]);router[_0x4221('0x13')](_0x4221('0xa'),auth[_0x4221('0x8')](),controller[_0x4221('0x14')]);router[_0x4221('0x15')](_0x4221('0xa'),auth[_0x4221('0x8')](),controller[_0x4221('0x16')]);module[_0x4221('0x17')]=router; \ No newline at end of file +var _0x2703=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','show','getItems','create','post','update','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x2703,0x1b2));var _0x3270=function(_0x41b14f,_0x5d2cba){_0x41b14f=_0x41b14f-0x0;var _0x72f0d6=_0x2703[_0x41b14f];return _0x72f0d6;};'use strict';var multer=require(_0x3270('0x0'));var util=require('util');var path=require(_0x3270('0x1'));var timeout=require(_0x3270('0x2'));var express=require(_0x3270('0x3'));var router=express[_0x3270('0x4')]();var fs_extra=require(_0x3270('0x5'));var auth=require(_0x3270('0x6'));var interaction=require(_0x3270('0x7'));var config=require('../../config/environment');var controller=require(_0x3270('0x8'));router[_0x3270('0x9')]('/',auth[_0x3270('0xa')](),controller['index']);router[_0x3270('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3270('0xb')]);router[_0x3270('0x9')]('/:id/items',auth['isAuthenticated'](),controller[_0x3270('0xc')]);router['post']('/',auth[_0x3270('0xa')](),controller[_0x3270('0xd')]);router[_0x3270('0xe')]('/:id/clone',auth[_0x3270('0xa')](),controller['clone']);router['post']('/:id/items',auth[_0x3270('0xa')](),controller['addItem']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3270('0xf')]);router['delete'](_0x3270('0x10'),auth['isAuthenticated'](),controller[_0x3270('0x11')]);module[_0x3270('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 42e3f85..b4d09ef 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 _0x5fc3=['squel','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x203d64,_0x1ec79c){var _0x462ab3=function(_0x55ee6e){while(--_0x55ee6e){_0x203d64['push'](_0x203d64['shift']());}};_0x462ab3(++_0x1ec79c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x5fc3[_0x1b1e76];return _0x3d743a;};'use strict';var Sequelize=require(_0x35fc('0x0'));var squel=require(_0x35fc('0x1'));var _=require('lodash');module[_0x35fc('0x2')]={'title':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x35fc('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x35fc('0x4')](_0x35fc('0x5')),'get':function(){try{return JSON['parse'](this[_0x35fc('0x6')](_0x35fc('0x7')));}catch(_0x186a06){return[];}},'set':function(_0x5b85ad){try{this['setDataValue'](_0x35fc('0x7'),JSON['stringify'](_0x5b85ad));}catch(_0x16e153){this[_0x35fc('0x8')](_0x35fc('0x7'),JSON[_0x35fc('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x35fc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![],'defaultValue':_0x35fc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35fc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x35fc('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x524e=['exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','lodash'];(function(_0x42195a,_0x163a3e){var _0x2e1403=function(_0x52ee92){while(--_0x52ee92){_0x42195a['push'](_0x42195a['shift']());}};_0x2e1403(++_0x163a3e);}(_0x524e,0x15e));var _0xe524=function(_0x2d839b,_0x12459c){_0x2d839b=_0x2d839b-0x0;var _0x1b9a58=_0x524e[_0x2d839b];return _0x1b9a58;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require(_0xe524('0x0'));module[_0xe524('0x1')]={'title':{'type':Sequelize[_0xe524('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4')),'get':function(){try{return JSON[_0xe524('0x5')](this[_0xe524('0x6')](_0xe524('0x7')));}catch(_0x110cff){return[];}},'set':function(_0x4f75d6){try{this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')](_0x4f75d6));}catch(_0x533c14){this[_0xe524('0x8')](_0xe524('0x7'),JSON[_0xe524('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe524('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe524('0xa')]},'col':{'type':Sequelize[_0xe524('0xa')]},'background':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe524('0x2')],'allowNull':![],'defaultValue':_0xe524('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe524('0x2')]},'titleFontSize':{'type':Sequelize[_0xe524('0xa')],'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 9fce111..a4bd5db 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 _0x975b=['then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','DashboardItem','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x975b,0x1c9));var _0xb975=function(_0x5834c2,_0x3716f1){_0x5834c2=_0x5834c2-0x0;var _0x1d64ad=_0x975b[_0x5834c2];return _0x1d64ad;};'use strict';var emlformat=require(_0xb975('0x0'));var rimraf=require(_0xb975('0x1'));var zipdir=require(_0xb975('0x2'));var jsonpatch=require(_0xb975('0x3'));var rp=require(_0xb975('0x4'));var moment=require(_0xb975('0x5'));var BPromise=require(_0xb975('0x6'));var Mustache=require('mustache');var util=require(_0xb975('0x7'));var path=require(_0xb975('0x8'));var sox=require(_0xb975('0x9'));var csv=require(_0xb975('0xa'));var ejs=require(_0xb975('0xb'));var fs=require('fs');var fs_extra=require(_0xb975('0xc'));var _=require(_0xb975('0xd'));var squel=require('squel');var crypto=require(_0xb975('0xe'));var jsforce=require(_0xb975('0xf'));var deskjs=require(_0xb975('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb975('0x11'));var Papa=require(_0xb975('0x12'));var Redis=require(_0xb975('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb975('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb975('0x15'));var logger=require('../../config/logger')(_0xb975('0x16'));var utils=require('../../config/utils');var config=require(_0xb975('0x17'));var licenseUtil=require(_0xb975('0x18'));var db=require(_0xb975('0x19'))['db'];config[_0xb975('0x1a')]=_[_0xb975('0x1b')](config['redis'],{'host':_0xb975('0x1c'),'port':0x18eb});var socket=require(_0xb975('0x1d'))(new Redis(config[_0xb975('0x1a')]));require(_0xb975('0x1e'))['register'](socket);function respondWithStatusCode(_0x470ead,_0x3bc289){_0x3bc289=_0x3bc289||0xcc;return function(_0x394b6d){if(_0x394b6d){return _0x470ead['sendStatus'](_0x3bc289);}return _0x470ead[_0xb975('0x1f')](_0x3bc289)[_0xb975('0x20')]();};}function respondWithResult(_0x36d959,_0x5dc59d){_0x5dc59d=_0x5dc59d||0xc8;return function(_0x15c8b2){if(_0x15c8b2){return _0x36d959['status'](_0x5dc59d)[_0xb975('0x21')](_0x15c8b2);}};}function respondWithFilteredResult(_0x34e062,_0xaa1ba3){return function(_0x347a04){if(_0x347a04){var _0x2c5d5f=typeof _0xaa1ba3[_0xb975('0x22')]===_0xb975('0x23')&&typeof _0xaa1ba3['limit']==='undefined';var _0x2abb84=_0x347a04[_0xb975('0x24')];var _0x2e34a6=_0x2c5d5f?0x0:_0xaa1ba3[_0xb975('0x22')];var _0x504057=_0x2c5d5f?_0x347a04[_0xb975('0x24')]:_0xaa1ba3['offset']+_0xaa1ba3[_0xb975('0x25')];var _0x3f0876;if(_0x504057>=_0x2abb84){_0x504057=_0x2abb84;_0x3f0876=0xc8;}else{_0x3f0876=0xce;}_0x34e062[_0xb975('0x1f')](_0x3f0876);return _0x34e062['set'](_0xb975('0x26'),_0x2e34a6+'-'+_0x504057+'/'+_0x2abb84)['json'](_0x347a04);}return null;};}function patchUpdates(_0x5d1312){return function(_0x25e027){try{jsonpatch[_0xb975('0x27')](_0x25e027,_0x5d1312,!![]);}catch(_0x226f21){return BPromise[_0xb975('0x28')](_0x226f21);}return _0x25e027[_0xb975('0x29')]();};}function saveUpdates(_0x5620fc,_0xad0c02){return function(_0x4db831){if(_0x4db831){return _0x4db831[_0xb975('0x2a')](_0x5620fc)[_0xb975('0x2b')](function(_0xc0d861){return _0xc0d861;});}return null;};}function removeEntity(_0x263f73,_0x5309c6){return function(_0x13c091){if(_0x13c091){return _0x13c091[_0xb975('0x2c')]()[_0xb975('0x2b')](function(){_0x263f73[_0xb975('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x323600,_0x388f4d){return function(_0x67fcc5){if(!_0x67fcc5){_0x323600[_0xb975('0x2d')](0x194);}return _0x67fcc5;};}function handleError(_0x7b12da,_0x165e2d){_0x165e2d=_0x165e2d||0x1f4;return function(_0x442bc6){logger[_0xb975('0x2e')](_0x442bc6[_0xb975('0x2f')]);if(_0x442bc6['name']){delete _0x442bc6[_0xb975('0x30')];}_0x7b12da[_0xb975('0x1f')](_0x165e2d)[_0xb975('0x31')](_0x442bc6);};}exports[_0xb975('0x32')]=function(_0x1fa1c3,_0x3bd5cb){var _0x2de7e5={'raw':![],'where':{'id':_0x1fa1c3[_0xb975('0x33')]['id']}},_0xa8ee8c={};_0xa8ee8c[_0xb975('0x34')]=_[_0xb975('0x35')](db['DashboardItem'][_0xb975('0x36')]);_0xa8ee8c['query']=_['keys'](_0x1fa1c3[_0xb975('0x37')]);_0xa8ee8c['filters']=_[_0xb975('0x38')](_0xa8ee8c[_0xb975('0x34')],_0xa8ee8c['query']);_0x2de7e5[_0xb975('0x39')]=_['intersection'](_0xa8ee8c[_0xb975('0x34')],qs[_0xb975('0x3a')](_0x1fa1c3[_0xb975('0x37')][_0xb975('0x3a')]));_0x2de7e5[_0xb975('0x39')]=_0x2de7e5['attributes'][_0xb975('0x3b')]?_0x2de7e5['attributes']:_0xa8ee8c['model'];if(_0x1fa1c3[_0xb975('0x37')][_0xb975('0x3c')]){_0x2de7e5[_0xb975('0x3d')]=[{'all':!![]}];}_0x2de7e5=_[_0xb975('0x3e')]({},_0x2de7e5,_0x1fa1c3[_0xb975('0x3f')]);return db[_0xb975('0x40')][_0xb975('0x41')](_0x2de7e5)[_0xb975('0x2b')](handleEntityNotFound(_0x3bd5cb,null))['then'](respondWithResult(_0x3bd5cb,null))[_0xb975('0x42')](handleError(_0x3bd5cb,null));};exports[_0xb975('0x2c')]=function(_0x5c6fe2,_0x271798){return db[_0xb975('0x40')][_0xb975('0x41')]({'where':{'id':_0x5c6fe2[_0xb975('0x33')]['id']}})[_0xb975('0x2b')](handleEntityNotFound(_0x271798,null))[_0xb975('0x2b')](removeEntity(_0x271798,null))[_0xb975('0x42')](handleError(_0x271798,null));};function widgetAttributes(_0x4d9864){try{switch(_0x4d9864[_0xb975('0x43')]){case'iframe':return[{'name':_0xb975('0x44'),'value':_0x4d9864[_0xb975('0x44')]||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x0]?_0x4d9864['attrs'][0x0][_0xb975('0x46')]:undefined)||_0xb975('0x47')}];case _0xb975('0x48'):return[{'name':_0xb975('0x49'),'value':_0x4d9864[_0xb975('0x49')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x0]?_0x4d9864[_0xb975('0x45')][0x0]['value']:undefined)||''}];case _0xb975('0x4a'):return[{'name':_0xb975('0x4b'),'value':_0x4d9864[_0xb975('0x4b')]||(_0x4d9864['attrs']&&_0x4d9864['attrs'][0x0]?_0x4d9864[_0xb975('0x45')][0x0][_0xb975('0x46')]:undefined)||_0xb975('0x4c')},{'name':'attrTimezone','value':_0x4d9864['attrTimezone']||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x1]?_0x4d9864[_0xb975('0x45')][0x1][_0xb975('0x46')]:undefined)||'0.00'},{'name':_0xb975('0x4d'),'value':_0x4d9864[_0xb975('0x4d')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x2]?_0x4d9864['attrs'][0x2][_0xb975('0x46')]:undefined)||0xc}];case _0xb975('0x4e'):return[{'name':'attrMetric','value':_0x4d9864['attrMetric']||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864['attrs'][0x0]?_0x4d9864['attrs'][0x0][_0xb975('0x46')]:undefined)||'total'},{'name':_0xb975('0x4f'),'value':_0x4d9864[_0xb975('0x4f')]||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x1]?_0x4d9864[_0xb975('0x45')][0x1][_0xb975('0x46')]:undefined)||[]},{'name':_0xb975('0x4d'),'value':_0x4d9864[_0xb975('0x4d')]||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x2]?_0x4d9864[_0xb975('0x45')][0x2][_0xb975('0x46')]:undefined)||0x14},{'name':'attrChannel','value':_0x4d9864[_0xb975('0x50')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x3]?_0x4d9864['attrs'][0x3][_0xb975('0x46')]:undefined)||_0xb975('0x51')},{'name':_0xb975('0x52'),'value':_0x4d9864[_0xb975('0x52')]||(_0x4d9864['attrs']&&_0x4d9864['attrs'][0x4]?_0x4d9864['attrs'][0x4][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x53'),'value':_0x4d9864[_0xb975('0x53')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x5]?_0x4d9864[_0xb975('0x45')][0x5][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x54'),'value':_0x4d9864[_0xb975('0x54')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x6]?_0x4d9864['attrs'][0x6][_0xb975('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4d9864['attrOpenchannelAccounts']||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x7]?_0x4d9864[_0xb975('0x45')][0x7]['value']:undefined)||''},{'name':_0xb975('0x55'),'value':_0x4d9864[_0xb975('0x55')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x8]?_0x4d9864[_0xb975('0x45')][0x8][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x56'),'value':_0x4d9864[_0xb975('0x56')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864['attrs'][0x9]?_0x4d9864['attrs'][0x9]['value']:undefined)||''}];case _0xb975('0x57'):case _0xb975('0x58'):return[{'name':'attrSerie1','value':_0x4d9864[_0xb975('0x59')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x0]?_0x4d9864['attrs'][0x0][_0xb975('0x46')]:undefined)||'total'},{'name':_0xb975('0x5a'),'value':_0x4d9864['attrSerie2']||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x1]?_0x4d9864[_0xb975('0x45')][0x1][_0xb975('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x4d9864[_0xb975('0x5b')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864['attrs'][0x2]?_0x4d9864['attrs'][0x2]['value']:undefined)||null},{'name':_0xb975('0x4f'),'value':_0x4d9864[_0xb975('0x4f')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x3]?_0x4d9864[_0xb975('0x45')][0x3][_0xb975('0x46')]:undefined)||[]},{'name':_0xb975('0x50'),'value':_0x4d9864[_0xb975('0x50')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x4]?_0x4d9864[_0xb975('0x45')][0x4][_0xb975('0x46')]:undefined)||_0xb975('0x51')},{'name':_0xb975('0x52'),'value':_0x4d9864[_0xb975('0x52')]||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x5]?_0x4d9864[_0xb975('0x45')][0x5][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x53'),'value':_0x4d9864[_0xb975('0x53')]||(_0x4d9864['attrs']&&_0x4d9864['attrs'][0x6]?_0x4d9864['attrs'][0x6][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x54'),'value':_0x4d9864[_0xb975('0x54')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x7]?_0x4d9864[_0xb975('0x45')][0x7]['value']:undefined)||''},{'name':_0xb975('0x5c'),'value':_0x4d9864['attrOpenchannelAccounts']||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864['attrs'][0x8]?_0x4d9864[_0xb975('0x45')][0x8][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x55'),'value':_0x4d9864[_0xb975('0x55')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0x9]?_0x4d9864[_0xb975('0x45')][0x9][_0xb975('0x46')]:undefined)||''},{'name':_0xb975('0x56'),'value':_0x4d9864[_0xb975('0x56')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864[_0xb975('0x45')][0xa]?_0x4d9864[_0xb975('0x45')][0xa][_0xb975('0x46')]:undefined)||''}];case _0xb975('0x5d'):return[{'name':_0xb975('0x5e'),'type':_0x4d9864['reportType']||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x0]?_0x4d9864['attrs'][0x0][_0xb975('0x43')]:undefined)||null,'value':_0x4d9864[_0xb975('0x5e')]||(_0x4d9864[_0xb975('0x45')]&&_0x4d9864['attrs'][0x0]?_0x4d9864[_0xb975('0x45')][0x0][_0xb975('0x46')]:undefined)||null},{'name':'attrRefresh','value':_0x4d9864[_0xb975('0x5f')]||(_0x4d9864['attrs']&&_0x4d9864[_0xb975('0x45')][0x1]?_0x4d9864[_0xb975('0x45')][0x1][_0xb975('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x2c1aca){logger[_0xb975('0x2e')](_0xb975('0x60'),JSON[_0xb975('0x61')](_0x2c1aca));return[];}}exports[_0xb975('0x62')]=function(_0xad129e,_0x318174){if(_0xad129e[_0xb975('0x63')]){_0xad129e[_0xb975('0x63')][_0xb975('0x45')]=widgetAttributes(_0xad129e['body']);}return db[_0xb975('0x40')][_0xb975('0x62')](_0xad129e[_0xb975('0x63')],{})['then'](respondWithResult(_0x318174,0xc9))['catch'](handleError(_0x318174,null));};exports[_0xb975('0x2a')]=function(_0x270640,_0xb2c0d1){if(_0x270640[_0xb975('0x63')]['id']){delete _0x270640[_0xb975('0x63')]['id'];}_0x270640[_0xb975('0x63')][_0xb975('0x45')]=widgetAttributes(_0x270640[_0xb975('0x63')]);return db[_0xb975('0x40')][_0xb975('0x41')]({'where':{'id':_0x270640[_0xb975('0x33')]['id']}})['then'](handleEntityNotFound(_0xb2c0d1,null))[_0xb975('0x2b')](saveUpdates(_0x270640[_0xb975('0x63')],null))[_0xb975('0x2b')](respondWithResult(_0xb2c0d1,null))[_0xb975('0x42')](handleError(_0xb2c0d1,null));}; \ No newline at end of file +var _0x307e=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','stack','name','send','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','create','update','eml-format'];(function(_0x508953,_0x5b6946){var _0x5a7758=function(_0x45b127){while(--_0x45b127){_0x508953['push'](_0x508953['shift']());}};_0x5a7758(++_0x5b6946);}(_0x307e,0xc9));var _0xe307=function(_0x289c59,_0x486558){_0x289c59=_0x289c59-0x0;var _0x218b52=_0x307e[_0x289c59];return _0x218b52;};'use strict';var emlformat=require(_0xe307('0x0'));var rimraf=require(_0xe307('0x1'));var zipdir=require(_0xe307('0x2'));var jsonpatch=require(_0xe307('0x3'));var rp=require(_0xe307('0x4'));var moment=require('moment');var BPromise=require(_0xe307('0x5'));var Mustache=require(_0xe307('0x6'));var util=require('util');var path=require(_0xe307('0x7'));var sox=require('sox');var csv=require(_0xe307('0x8'));var ejs=require(_0xe307('0x9'));var fs=require('fs');var fs_extra=require(_0xe307('0xa'));var _=require('lodash');var squel=require(_0xe307('0xb'));var crypto=require(_0xe307('0xc'));var jsforce=require(_0xe307('0xd'));var deskjs=require(_0xe307('0xe'));var toCsv=require(_0xe307('0x8'));var querystring=require(_0xe307('0xf'));var Papa=require(_0xe307('0x10'));var Redis=require(_0xe307('0x11'));var authService=require(_0xe307('0x12'));var qs=require(_0xe307('0x13'));var as=require(_0xe307('0x14'));var hardwareService=require(_0xe307('0x15'));var logger=require(_0xe307('0x16'))(_0xe307('0x17'));var utils=require(_0xe307('0x18'));var config=require(_0xe307('0x19'));var licenseUtil=require(_0xe307('0x1a'));var db=require(_0xe307('0x1b'))['db'];config[_0xe307('0x1c')]=_[_0xe307('0x1d')](config['redis'],{'host':_0xe307('0x1e'),'port':0x18eb});var socket=require(_0xe307('0x1f'))(new Redis(config['redis']));require(_0xe307('0x20'))[_0xe307('0x21')](socket);function respondWithStatusCode(_0x2d3a73,_0x1e38f2){_0x1e38f2=_0x1e38f2||0xcc;return function(_0x23b5b8){if(_0x23b5b8){return _0x2d3a73[_0xe307('0x22')](_0x1e38f2);}return _0x2d3a73[_0xe307('0x23')](_0x1e38f2)['end']();};}function respondWithResult(_0x2abf63,_0x15631c){_0x15631c=_0x15631c||0xc8;return function(_0x46f63a){if(_0x46f63a){return _0x2abf63[_0xe307('0x23')](_0x15631c)[_0xe307('0x24')](_0x46f63a);}};}function respondWithFilteredResult(_0x52f83b,_0x4e4dfe){return function(_0xbc07f){if(_0xbc07f){var _0x52ef79=typeof _0x4e4dfe[_0xe307('0x25')]===_0xe307('0x26')&&typeof _0x4e4dfe[_0xe307('0x27')]===_0xe307('0x26');var _0x40e290=_0xbc07f[_0xe307('0x28')];var _0x11adc1=_0x52ef79?0x0:_0x4e4dfe[_0xe307('0x25')];var _0x1f3cf3=_0x52ef79?_0xbc07f[_0xe307('0x28')]:_0x4e4dfe[_0xe307('0x25')]+_0x4e4dfe[_0xe307('0x27')];var _0x394bde;if(_0x1f3cf3>=_0x40e290){_0x1f3cf3=_0x40e290;_0x394bde=0xc8;}else{_0x394bde=0xce;}_0x52f83b[_0xe307('0x23')](_0x394bde);return _0x52f83b[_0xe307('0x29')]('Content-Range',_0x11adc1+'-'+_0x1f3cf3+'/'+_0x40e290)[_0xe307('0x24')](_0xbc07f);}return null;};}function patchUpdates(_0x1ec000){return function(_0x85410d){try{jsonpatch[_0xe307('0x2a')](_0x85410d,_0x1ec000,!![]);}catch(_0x4fdf45){return BPromise[_0xe307('0x2b')](_0x4fdf45);}return _0x85410d[_0xe307('0x2c')]();};}function saveUpdates(_0x9c9503,_0x39c839){return function(_0x2f1b9c){if(_0x2f1b9c){return _0x2f1b9c['update'](_0x9c9503)['then'](function(_0x405ef6){return _0x405ef6;});}return null;};}function removeEntity(_0x11fe69,_0x3b169f){return function(_0x188f14){if(_0x188f14){return _0x188f14[_0xe307('0x2d')]()[_0xe307('0x2e')](function(){_0x11fe69[_0xe307('0x23')](0xcc)[_0xe307('0x2f')]();});}};}function handleEntityNotFound(_0x1fc65c,_0x47b075){return function(_0x6b9643){if(!_0x6b9643){_0x1fc65c[_0xe307('0x22')](0x194);}return _0x6b9643;};}function handleError(_0x5aa461,_0x122c71){_0x122c71=_0x122c71||0x1f4;return function(_0x51769d){logger['error'](_0x51769d[_0xe307('0x30')]);if(_0x51769d[_0xe307('0x31')]){delete _0x51769d[_0xe307('0x31')];}_0x5aa461['status'](_0x122c71)[_0xe307('0x32')](_0x51769d);};}exports['show']=function(_0x3fa6e5,_0x4b17ce){var _0x59e18b={'raw':![],'where':{'id':_0x3fa6e5['params']['id']}},_0x4b3bd7={};_0x4b3bd7[_0xe307('0x33')]=_[_0xe307('0x34')](db['DashboardItem'][_0xe307('0x35')]);_0x4b3bd7[_0xe307('0x36')]=_[_0xe307('0x34')](_0x3fa6e5[_0xe307('0x36')]);_0x4b3bd7['filters']=_[_0xe307('0x37')](_0x4b3bd7['model'],_0x4b3bd7['query']);_0x59e18b[_0xe307('0x38')]=_[_0xe307('0x37')](_0x4b3bd7[_0xe307('0x33')],qs[_0xe307('0x39')](_0x3fa6e5['query'][_0xe307('0x39')]));_0x59e18b['attributes']=_0x59e18b[_0xe307('0x38')][_0xe307('0x3a')]?_0x59e18b['attributes']:_0x4b3bd7[_0xe307('0x33')];if(_0x3fa6e5[_0xe307('0x36')][_0xe307('0x3b')]){_0x59e18b[_0xe307('0x3c')]=[{'all':!![]}];}_0x59e18b=_['merge']({},_0x59e18b,_0x3fa6e5['options']);return db[_0xe307('0x3d')][_0xe307('0x3e')](_0x59e18b)['then'](handleEntityNotFound(_0x4b17ce,null))[_0xe307('0x2e')](respondWithResult(_0x4b17ce,null))[_0xe307('0x3f')](handleError(_0x4b17ce,null));};exports[_0xe307('0x2d')]=function(_0x53ef30,_0x5b758f){return db[_0xe307('0x3d')]['find']({'where':{'id':_0x53ef30['params']['id']}})['then'](handleEntityNotFound(_0x5b758f,null))[_0xe307('0x2e')](removeEntity(_0x5b758f,null))['catch'](handleError(_0x5b758f,null));};function widgetAttributes(_0x20f8a0){try{switch(_0x20f8a0[_0xe307('0x40')]){case _0xe307('0x41'):return[{'name':_0xe307('0x42'),'value':_0x20f8a0['attrUrl']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0]['value']:undefined)||_0xe307('0x44')}];case'custom':return[{'name':'attrPath','value':_0x20f8a0[_0xe307('0x45')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x20f8a0[_0xe307('0x47')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0][_0xe307('0x46')]:undefined)||_0xe307('0x48')},{'name':'attrTimezone','value':_0x20f8a0[_0xe307('0x49')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0['attrs'][0x1]['value']:undefined)||_0xe307('0x4a')},{'name':'attrFontSize','value':_0x20f8a0[_0xe307('0x4b')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0[_0xe307('0x43')][0x2][_0xe307('0x46')]:undefined)||0xc}];case _0xe307('0x4c'):return[{'name':_0xe307('0x4d'),'value':_0x20f8a0[_0xe307('0x4d')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||_0xe307('0x4e')},{'name':_0xe307('0x4f'),'value':_0x20f8a0[_0xe307('0x4f')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||[]},{'name':_0xe307('0x4b'),'value':_0x20f8a0[_0xe307('0x4b')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0[_0xe307('0x43')][0x2][_0xe307('0x46')]:undefined)||0x14},{'name':_0xe307('0x50'),'value':_0x20f8a0['attrChannel']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x3]?_0x20f8a0[_0xe307('0x43')][0x3][_0xe307('0x46')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x20f8a0[_0xe307('0x51')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x4]?_0x20f8a0[_0xe307('0x43')][0x4]['value']:undefined)||''},{'name':_0xe307('0x52'),'value':_0x20f8a0[_0xe307('0x52')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x5]?_0x20f8a0[_0xe307('0x43')][0x5][_0xe307('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x20f8a0[_0xe307('0x53')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x6]?_0x20f8a0[_0xe307('0x43')][0x6][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x54'),'value':_0x20f8a0[_0xe307('0x54')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x7]?_0x20f8a0[_0xe307('0x43')][0x7]['value']:undefined)||''},{'name':_0xe307('0x55'),'value':_0x20f8a0['attrWhatsappAccounts']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x8]?_0x20f8a0[_0xe307('0x43')][0x8][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x56'),'value':_0x20f8a0[_0xe307('0x56')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x9]?_0x20f8a0['attrs'][0x9][_0xe307('0x46')]:undefined)||''}];case _0xe307('0x57'):case _0xe307('0x58'):return[{'name':'attrSerie1','value':_0x20f8a0['attrSerie1']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x46')]:undefined)||'total'},{'name':_0xe307('0x59'),'value':_0x20f8a0['attrSerie2']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||null},{'name':_0xe307('0x5a'),'value':_0x20f8a0[_0xe307('0x5a')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x2]?_0x20f8a0['attrs'][0x2][_0xe307('0x46')]:undefined)||null},{'name':_0xe307('0x4f'),'value':_0x20f8a0[_0xe307('0x4f')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x3]?_0x20f8a0[_0xe307('0x43')][0x3][_0xe307('0x46')]:undefined)||[]},{'name':_0xe307('0x50'),'value':_0x20f8a0[_0xe307('0x50')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x4]?_0x20f8a0[_0xe307('0x43')][0x4][_0xe307('0x46')]:undefined)||_0xe307('0x5b')},{'name':_0xe307('0x51'),'value':_0x20f8a0['attrEmailAccounts']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x5]?_0x20f8a0[_0xe307('0x43')][0x5][_0xe307('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x20f8a0[_0xe307('0x52')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x6]?_0x20f8a0[_0xe307('0x43')][0x6][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x53'),'value':_0x20f8a0[_0xe307('0x53')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x7]?_0x20f8a0[_0xe307('0x43')][0x7][_0xe307('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x20f8a0[_0xe307('0x54')]||(_0x20f8a0['attrs']&&_0x20f8a0[_0xe307('0x43')][0x8]?_0x20f8a0['attrs'][0x8]['value']:undefined)||''},{'name':_0xe307('0x55'),'value':_0x20f8a0[_0xe307('0x55')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0['attrs'][0x9]?_0x20f8a0[_0xe307('0x43')][0x9][_0xe307('0x46')]:undefined)||''},{'name':_0xe307('0x56'),'value':_0x20f8a0[_0xe307('0x56')]||(_0x20f8a0['attrs']&&_0x20f8a0['attrs'][0xa]?_0x20f8a0[_0xe307('0x43')][0xa][_0xe307('0x46')]:undefined)||''}];case _0xe307('0x5c'):return[{'name':_0xe307('0x5d'),'type':_0x20f8a0[_0xe307('0x5e')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0[_0xe307('0x43')][0x0][_0xe307('0x40')]:undefined)||null,'value':_0x20f8a0[_0xe307('0x5d')]||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x0]?_0x20f8a0['attrs'][0x0][_0xe307('0x46')]:undefined)||null},{'name':_0xe307('0x5f'),'value':_0x20f8a0['attrRefresh']||(_0x20f8a0[_0xe307('0x43')]&&_0x20f8a0[_0xe307('0x43')][0x1]?_0x20f8a0[_0xe307('0x43')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x7824ac){logger[_0xe307('0x60')](_0xe307('0x61'),JSON['stringify'](_0x7824ac));return[];}}exports['create']=function(_0x350ff2,_0x1172aa){if(_0x350ff2[_0xe307('0x62')]){_0x350ff2[_0xe307('0x62')][_0xe307('0x43')]=widgetAttributes(_0x350ff2['body']);}return db[_0xe307('0x3d')][_0xe307('0x63')](_0x350ff2[_0xe307('0x62')],{})[_0xe307('0x2e')](respondWithResult(_0x1172aa,0xc9))[_0xe307('0x3f')](handleError(_0x1172aa,null));};exports[_0xe307('0x64')]=function(_0x1b5bbe,_0x45bbb6){if(_0x1b5bbe['body']['id']){delete _0x1b5bbe[_0xe307('0x62')]['id'];}_0x1b5bbe[_0xe307('0x62')]['attrs']=widgetAttributes(_0x1b5bbe[_0xe307('0x62')]);return db[_0xe307('0x3d')]['find']({'where':{'id':_0x1b5bbe['params']['id']}})[_0xe307('0x2e')](handleEntityNotFound(_0x45bbb6,null))[_0xe307('0x2e')](saveUpdates(_0x1b5bbe[_0xe307('0x62')],null))[_0xe307('0x2e')](respondWithResult(_0x45bbb6,null))[_0xe307('0x3f')](handleError(_0x45bbb6,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6489b63..4e9a0c5 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 _0x2ede=['save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x187266,_0x3f99df){var _0x1a83bc=function(_0x189626){while(--_0x189626){_0x187266['push'](_0x187266['shift']());}};_0x1a83bc(++_0x3f99df);}(_0x2ede,0x69));var _0xe2ed=function(_0x457729,_0x4edaf7){_0x457729=_0x457729-0x0;var _0x2a7e43=_0x2ede[_0x457729];return _0x2a7e43;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe2ed('0x0'),'afterUpdate':_0xe2ed('0x1'),'afterDestroy':_0xe2ed('0x2')};function emitEvent(_0x1f4343){return function(_0x5234ef,_0x441f04,_0x9a284b){DashboardItemEvents['emit'](_0x1f4343+':'+_0x5234ef['id'],_0x5234ef);DashboardItemEvents[_0xe2ed('0x3')](_0x1f4343,_0x5234ef);_0x9a284b(null);};}for(var e in events){if(events[_0xe2ed('0x4')](e)){var event=events[e];DashboardItem[_0xe2ed('0x5')](e,emitEvent(event));}}module[_0xe2ed('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xce41=['events','DashboardItem','save','update','emit','hook','exports'];(function(_0x5e4844,_0x46883d){var _0xa0e771=function(_0x1a72ae){while(--_0x1a72ae){_0x5e4844['push'](_0x5e4844['shift']());}};_0xa0e771(++_0x46883d);}(_0xce41,0x1c0));var _0x1ce4=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xce41[_0x313df3];return _0x241d59;};'use strict';var EventEmitter=require(_0x1ce4('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1ce4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ce4('0x2'),'afterUpdate':_0x1ce4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x413318){return function(_0x41617d,_0x4d3937,_0x54a8a1){DashboardItemEvents[_0x1ce4('0x4')](_0x413318+':'+_0x41617d['id'],_0x41617d);DashboardItemEvents[_0x1ce4('0x4')](_0x413318,_0x41617d);_0x54a8a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1ce4('0x5')](e,emitEvent(event));}}module[_0x1ce4('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 2f2c000..2abddfb 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 _0xa529=['path','rimraf','../../config/environment','exports','define','DashboardItem','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa529,0x16e));var _0x9a52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa529[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9a52('0x0'));var logger=require(_0x9a52('0x1'))('api');var moment=require(_0x9a52('0x2'));var BPromise=require('bluebird');var rp=require(_0x9a52('0x3'));var fs=require('fs');var path=require(_0x9a52('0x4'));var rimraf=require(_0x9a52('0x5'));var config=require(_0x9a52('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x9a52('0x7')]=function(_0x42efbd,_0x1fa1be){return _0x42efbd[_0x9a52('0x8')](_0x9a52('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4829=['dashboard_items','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','DashboardItem'];(function(_0x40c4e0,_0x9fdbfa){var _0x588be5=function(_0x1c5758){while(--_0x1c5758){_0x40c4e0['push'](_0x40c4e0['shift']());}};_0x588be5(++_0x9fdbfa);}(_0x4829,0xcd));var _0x9482=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x4829[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0x9482('0x0'));var logger=require(_0x9482('0x1'))(_0x9482('0x2'));var moment=require(_0x9482('0x3'));var BPromise=require(_0x9482('0x4'));var rp=require(_0x9482('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9482('0x6'));var config=require(_0x9482('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x9482('0x8')]=function(_0x5e734f,_0x244e22){return _0x5e734f[_0x9482('0x9')](_0x9482('0xa'),attributes,{'tableName':_0x9482('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 fbc0fee..b3f047d 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 _0x6c49=['message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x58eeba,_0x48e6c3){var _0x15aa6e=function(_0x4801bf){while(--_0x4801bf){_0x58eeba['push'](_0x58eeba['shift']());}};_0x15aa6e(++_0x48e6c3);}(_0x6c49,0xfd));var _0x96c4=function(_0x526f3e,_0x2a2a5d){_0x526f3e=_0x526f3e-0x0;var _0x34b218=_0x6c49[_0x526f3e];return _0x34b218;};'use strict';var _=require(_0x96c4('0x0'));var util=require(_0x96c4('0x1'));var moment=require('moment');var BPromise=require(_0x96c4('0x2'));var rs=require(_0x96c4('0x3'));var fs=require('fs');var Redis=require(_0x96c4('0x4'));var db=require(_0x96c4('0x5'))['db'];var utils=require(_0x96c4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x96c4('0x7'));var jayson=require(_0x96c4('0x8'));var client=jayson[_0x96c4('0x9')][_0x96c4('0xa')]({'port':0x232a});config[_0x96c4('0xb')]=_[_0x96c4('0xc')](config[_0x96c4('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x96c4('0xd'))[_0x96c4('0xe')](socket);function respondWithRpcPromise(_0x5f396c,_0x4c0359,_0x3e4932){return new BPromise(function(_0xd3ee6f,_0x402f0d){return client[_0x96c4('0xf')](_0x5f396c,_0x3e4932)['then'](function(_0x23c614){logger['info'](_0x96c4('0x10'),_0x4c0359,_0x96c4('0x11'));logger['debug'](_0x96c4('0x12'),_0x4c0359,_0x96c4('0x11'),JSON[_0x96c4('0x13')](_0x23c614));if(_0x23c614[_0x96c4('0x14')]){if(_0x23c614['error'][_0x96c4('0x15')]===0x1f4){logger[_0x96c4('0x14')](_0x96c4('0x10'),_0x4c0359,_0x23c614['error']['message']);return _0x402f0d(_0x23c614['error'][_0x96c4('0x16')]);}logger[_0x96c4('0x14')](_0x96c4('0x10'),_0x4c0359,_0x23c614[_0x96c4('0x14')][_0x96c4('0x16')]);return _0xd3ee6f(_0x23c614[_0x96c4('0x14')][_0x96c4('0x16')]);}else{logger[_0x96c4('0x17')](_0x96c4('0x10'),_0x4c0359,_0x96c4('0x11'));_0xd3ee6f(_0x23c614[_0x96c4('0x18')][_0x96c4('0x16')]);}})['catch'](function(_0x104cff){logger['error']('DashboardItem,\x20%s,\x20%s',_0x4c0359,_0x104cff);_0x402f0d(_0x104cff);});});} \ No newline at end of file +var _0x3515=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x37dbe8,_0x10e968){var _0x2416b6=function(_0xd39957){while(--_0xd39957){_0x37dbe8['push'](_0x37dbe8['shift']());}};_0x2416b6(++_0x10e968);}(_0x3515,0x1e2));var _0x5351=function(_0x1c1bee,_0x27451f){_0x1c1bee=_0x1c1bee-0x0;var _0x3ed968=_0x3515[_0x1c1bee];return _0x3ed968;};'use strict';var _=require(_0x5351('0x0'));var util=require(_0x5351('0x1'));var moment=require(_0x5351('0x2'));var BPromise=require(_0x5351('0x3'));var rs=require(_0x5351('0x4'));var fs=require('fs');var Redis=require(_0x5351('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5351('0x6'));var logger=require(_0x5351('0x7'))(_0x5351('0x8'));var config=require(_0x5351('0x9'));var jayson=require(_0x5351('0xa'));var client=jayson[_0x5351('0xb')][_0x5351('0xc')]({'port':0x232a});config[_0x5351('0xd')]=_[_0x5351('0xe')](config[_0x5351('0xd')],{'host':_0x5351('0xf'),'port':0x18eb});var socket=require(_0x5351('0x10'))(new Redis(config[_0x5351('0xd')]));require(_0x5351('0x11'))[_0x5351('0x12')](socket);function respondWithRpcPromise(_0x48c4a1,_0x4b13e1,_0x380735){return new BPromise(function(_0x34904d,_0x2c657f){return client[_0x5351('0x13')](_0x48c4a1,_0x380735)[_0x5351('0x14')](function(_0xec7377){logger[_0x5351('0x15')]('DashboardItem,\x20%s,\x20%s',_0x4b13e1,_0x5351('0x16'));logger[_0x5351('0x17')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4b13e1,'request\x20sent',JSON[_0x5351('0x18')](_0xec7377));if(_0xec7377[_0x5351('0x19')]){if(_0xec7377['error'][_0x5351('0x1a')]===0x1f4){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377['error'][_0x5351('0x1c')]);return _0x2c657f(_0xec7377['error'][_0x5351('0x1c')]);}logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0xec7377[_0x5351('0x19')][_0x5351('0x1c')]);return _0x34904d(_0xec7377[_0x5351('0x19')]['message']);}else{logger[_0x5351('0x15')](_0x5351('0x1b'),_0x4b13e1,_0x5351('0x16'));_0x34904d(_0xec7377[_0x5351('0x1d')][_0x5351('0x1c')]);}})[_0x5351('0x1e')](function(_0x64fdb8){logger[_0x5351('0x19')](_0x5351('0x1b'),_0x4b13e1,_0x64fdb8);_0x2c657f(_0x64fdb8);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f72b76e..6ca0697 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 _0x52d9=['save','remove','update','emit','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x5875f4,_0x453703){var _0x33cd34=function(_0x2bf72c){while(--_0x2bf72c){_0x5875f4['push'](_0x5875f4['shift']());}};_0x33cd34(++_0x453703);}(_0x52d9,0x18f));var _0x952d=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x52d9[_0x57fa7e];return _0x320671;};'use strict';var DashboardItemEvents=require(_0x952d('0x0'));var events=[_0x952d('0x1'),_0x952d('0x2'),_0x952d('0x3')];function createListener(_0x2d76cc,_0x3ba42d){return function(_0x426db0){_0x3ba42d[_0x952d('0x4')](_0x2d76cc,_0x426db0);};}function removeListener(_0x3117b4,_0x22433c){return function(){DashboardItemEvents['removeListener'](_0x3117b4,_0x22433c);};}exports[_0x952d('0x5')]=function(_0x4180e2){for(var _0x187224=0x0,_0x16b426=events[_0x952d('0x6')];_0x187224<_0x16b426;_0x187224++){var _0x20a8fb=events[_0x187224];var _0x510958=createListener(_0x952d('0x7')+_0x20a8fb,_0x4180e2);DashboardItemEvents['on'](_0x20a8fb,_0x510958);}}; \ No newline at end of file +var _0x3db9=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x450a7c,_0xc09cd4){var _0x2b9149=function(_0x1f35ca){while(--_0x1f35ca){_0x450a7c['push'](_0x450a7c['shift']());}};_0x2b9149(++_0xc09cd4);}(_0x3db9,0x1bd));var _0x93db=function(_0x22dd0a,_0x26da6b){_0x22dd0a=_0x22dd0a-0x0;var _0x398287=_0x3db9[_0x22dd0a];return _0x398287;};'use strict';var DashboardItemEvents=require(_0x93db('0x0'));var events=['save',_0x93db('0x1'),_0x93db('0x2')];function createListener(_0x4830a1,_0x2a94f4){return function(_0x20737d){_0x2a94f4[_0x93db('0x3')](_0x4830a1,_0x20737d);};}function removeListener(_0x38c187,_0x134432){return function(){DashboardItemEvents[_0x93db('0x4')](_0x38c187,_0x134432);};}exports[_0x93db('0x5')]=function(_0x2788b2){for(var _0x21a698=0x0,_0x3e062d=events[_0x93db('0x6')];_0x21a698<_0x3e062d;_0x21a698++){var _0x52edcf=events[_0x21a698];var _0x303395=createListener(_0x93db('0x7')+_0x52edcf,_0x2788b2);DashboardItemEvents['on'](_0x52edcf,_0x303395);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 65e2872..5655d69 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 _0x3568=['post','create','put','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3568,0x1b8));var _0x8356=function(_0x23858c,_0x4fac44){_0x23858c=_0x23858c-0x0;var _0x19f732=_0x3568[_0x23858c];return _0x19f732;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8356('0x0'));var timeout=require('connect-timeout');var express=require(_0x8356('0x1'));var router=express[_0x8356('0x2')]();var fs_extra=require(_0x8356('0x3'));var auth=require(_0x8356('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8356('0x5'));var controller=require(_0x8356('0x6'));router['get'](_0x8356('0x7'),auth[_0x8356('0x8')](),controller[_0x8356('0x9')]);router[_0x8356('0xa')]('/',auth['isAuthenticated'](),controller[_0x8356('0xb')]);router[_0x8356('0xc')](_0x8356('0x7'),auth[_0x8356('0x8')](),controller['update']);router[_0x8356('0xd')](_0x8356('0x7'),auth[_0x8356('0x8')](),controller[_0x8356('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9402=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x4edbdb,_0x4eb680){var _0x4e880b=function(_0x495f1c){while(--_0x495f1c){_0x4edbdb['push'](_0x4edbdb['shift']());}};_0x4e880b(++_0x4eb680);}(_0x9402,0x1d0));var _0x2940=function(_0xde2040,_0x41b1a4){_0xde2040=_0xde2040-0x0;var _0x5ae21f=_0x9402[_0xde2040];return _0x5ae21f;};'use strict';var multer=require(_0x2940('0x0'));var util=require('util');var path=require(_0x2940('0x1'));var timeout=require('connect-timeout');var express=require(_0x2940('0x2'));var router=express[_0x2940('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2940('0x4'));var interaction=require(_0x2940('0x5'));var config=require(_0x2940('0x6'));var controller=require(_0x2940('0x7'));router[_0x2940('0x8')](_0x2940('0x9'),auth[_0x2940('0xa')](),controller[_0x2940('0xb')]);router[_0x2940('0xc')]('/',auth['isAuthenticated'](),controller[_0x2940('0xd')]);router['put']('/:id',auth[_0x2940('0xa')](),controller[_0x2940('0xe')]);router[_0x2940('0xf')]('/:id',auth[_0x2940('0xa')](),controller[_0x2940('0x10')]);module[_0x2940('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d098501..f2765a6 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 _0x437e=['STRING','ENUM','first','third','sequelize'];(function(_0x4f60e0,_0x29369e){var _0x45e65b=function(_0x2f2559){while(--_0x2f2559){_0x4f60e0['push'](_0x4f60e0['shift']());}};_0x45e65b(++_0x29369e);}(_0x437e,0x194));var _0xe437=function(_0x2d4521,_0x8d98b6){_0x2d4521=_0x2d4521-0x0;var _0x5d765f=_0x437e[_0x2d4521];return _0x5d765f;};'use strict';var Sequelize=require(_0xe437('0x0'));module['exports']={'name':{'type':Sequelize[_0xe437('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xe437('0x2')](_0xe437('0x3'),'second',_0xe437('0x4')),'allowNull':![],'defaultValue':_0xe437('0x3')},'description':{'type':Sequelize[_0xe437('0x1')]}}; \ No newline at end of file +var _0x40c7=['first','sequelize','exports','STRING','ENUM','second'];(function(_0xf35bd4,_0x51ff64){var _0x47912b=function(_0x269818){while(--_0x269818){_0xf35bd4['push'](_0xf35bd4['shift']());}};_0x47912b(++_0x51ff64);}(_0x40c7,0x121));var _0x740c=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x40c7[_0x5e2862];return _0x8dcad4;};'use strict';var Sequelize=require(_0x740c('0x0'));module[_0x740c('0x1')]={'name':{'type':Sequelize[_0x740c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x740c('0x3')]('first',_0x740c('0x4'),'third'),'allowNull':![],'defaultValue':_0x740c('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e4d78d7..df37960 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 _0x931f=['to-csv','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','count','limit','Content-Range','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','stack','name','index','map','Disposition','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','show','params','rawAttributes','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js'];(function(_0x2ae2cd,_0xb42c96){var _0xc52725=function(_0x4dda00){while(--_0x4dda00){_0x2ae2cd['push'](_0x2ae2cd['shift']());}};_0xc52725(++_0xb42c96);}(_0x931f,0x139));var _0xf931=function(_0xba60f1,_0x3b111b){_0xba60f1=_0xba60f1-0x0;var _0x120520=_0x931f[_0xba60f1];return _0x120520;};'use strict';var emlformat=require(_0xf931('0x0'));var rimraf=require(_0xf931('0x1'));var zipdir=require(_0xf931('0x2'));var jsonpatch=require(_0xf931('0x3'));var rp=require(_0xf931('0x4'));var moment=require(_0xf931('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf931('0x6'));var util=require(_0xf931('0x7'));var path=require(_0xf931('0x8'));var sox=require(_0xf931('0x9'));var csv=require('to-csv');var ejs=require(_0xf931('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf931('0xb'));var crypto=require(_0xf931('0xc'));var jsforce=require(_0xf931('0xd'));var deskjs=require(_0xf931('0xe'));var toCsv=require(_0xf931('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf931('0x10'));var authService=require(_0xf931('0x11'));var qs=require(_0xf931('0x12'));var as=require(_0xf931('0x13'));var hardwareService=require(_0xf931('0x14'));var logger=require(_0xf931('0x15'))(_0xf931('0x16'));var utils=require(_0xf931('0x17'));var config=require(_0xf931('0x18'));var licenseUtil=require(_0xf931('0x19'));var db=require(_0xf931('0x1a'))['db'];function respondWithStatusCode(_0x455661,_0xcb77a3){_0xcb77a3=_0xcb77a3||0xcc;return function(_0x309ab5){if(_0x309ab5){return _0x455661[_0xf931('0x1b')](_0xcb77a3);}return _0x455661[_0xf931('0x1c')](_0xcb77a3)[_0xf931('0x1d')]();};}function respondWithResult(_0x35c4af,_0x268df5){_0x268df5=_0x268df5||0xc8;return function(_0x295782){if(_0x295782){return _0x35c4af[_0xf931('0x1c')](_0x268df5)[_0xf931('0x1e')](_0x295782);}};}function respondWithFilteredResult(_0x2f4166,_0xa0d2b4){return function(_0x2cc860){if(_0x2cc860){var _0x402197=typeof _0xa0d2b4[_0xf931('0x1f')]==='undefined'&&typeof _0xa0d2b4['limit']==='undefined';var _0x1ebcd1=_0x2cc860[_0xf931('0x20')];var _0x48bec5=_0x402197?0x0:_0xa0d2b4['offset'];var _0x555404=_0x402197?_0x2cc860[_0xf931('0x20')]:_0xa0d2b4['offset']+_0xa0d2b4[_0xf931('0x21')];var _0x3db5b1;if(_0x555404>=_0x1ebcd1){_0x555404=_0x1ebcd1;_0x3db5b1=0xc8;}else{_0x3db5b1=0xce;}_0x2f4166[_0xf931('0x1c')](_0x3db5b1);return _0x2f4166['set'](_0xf931('0x22'),_0x48bec5+'-'+_0x555404+'/'+_0x1ebcd1)[_0xf931('0x1e')](_0x2cc860);}return null;};}function patchUpdates(_0x63d21b){return function(_0x51ed3b){try{jsonpatch[_0xf931('0x23')](_0x51ed3b,_0x63d21b,!![]);}catch(_0x467172){return BPromise[_0xf931('0x24')](_0x467172);}return _0x51ed3b[_0xf931('0x25')]();};}function saveUpdates(_0x42db47,_0x1d591a){return function(_0x25e8ba){if(_0x25e8ba){return _0x25e8ba['update'](_0x42db47)['then'](function(_0x3a880c){return _0x3a880c;});}return null;};}function removeEntity(_0x810d2d,_0x2e5d27){return function(_0x436579){if(_0x436579){return _0x436579[_0xf931('0x26')]()[_0xf931('0x27')](function(){var _0x2af110=_0x436579[_0xf931('0x28')]({'plain':!![]});var _0x4c7e47=_0xf931('0x29');return db[_0xf931('0x2a')][_0xf931('0x26')]({'where':{'type':_0x4c7e47,'resourceId':_0x2af110['id']}})['then'](function(){return _0x436579;});})[_0xf931('0x27')](function(){_0x810d2d[_0xf931('0x1c')](0xcc)[_0xf931('0x1d')]();});}};}function handleEntityNotFound(_0x527d2d,_0x5c784c){return function(_0x4909ad){if(!_0x4909ad){_0x527d2d['sendStatus'](0x194);}return _0x4909ad;};}function handleError(_0x67a58b,_0x59ba93){_0x59ba93=_0x59ba93||0x1f4;return function(_0x19535b){logger['error'](_0x19535b[_0xf931('0x2b')]);if(_0x19535b[_0xf931('0x2c')]){delete _0x19535b[_0xf931('0x2c')];}_0x67a58b[_0xf931('0x1c')](_0x59ba93)['send'](_0x19535b);};}exports[_0xf931('0x2d')]=function(_0xe417a0,_0x392b99){var _0x1c8069={},_0x5847c1={},_0x157218={'count':0x0,'rows':[]};var _0x126367=_[_0xf931('0x2e')](db[_0xf931('0x2f')]['rawAttributes'],function(_0x5bdf72){return{'name':_0x5bdf72[_0xf931('0x30')],'type':_0x5bdf72[_0xf931('0x31')][_0xf931('0x32')]};});_0x5847c1['model']=_[_0xf931('0x2e')](_0x126367,_0xf931('0x2c'));_0x5847c1['query']=_[_0xf931('0x33')](_0xe417a0[_0xf931('0x34')]);_0x5847c1[_0xf931('0x35')]=_['intersection'](_0x5847c1['model'],_0x5847c1[_0xf931('0x34')]);_0x1c8069[_0xf931('0x36')]=_[_0xf931('0x37')](_0x5847c1[_0xf931('0x38')],qs['fields'](_0xe417a0[_0xf931('0x34')][_0xf931('0x39')]));_0x1c8069[_0xf931('0x36')]=_0x1c8069[_0xf931('0x36')][_0xf931('0x3a')]?_0x1c8069[_0xf931('0x36')]:_0x5847c1[_0xf931('0x38')];if(!_0xe417a0[_0xf931('0x34')][_0xf931('0x3b')](_0xf931('0x3c'))){_0x1c8069[_0xf931('0x21')]=qs[_0xf931('0x21')](_0xe417a0[_0xf931('0x34')][_0xf931('0x21')]);_0x1c8069[_0xf931('0x1f')]=qs['offset'](_0xe417a0[_0xf931('0x34')][_0xf931('0x1f')]);}_0x1c8069[_0xf931('0x3d')]=qs['sort'](_0xe417a0[_0xf931('0x34')][_0xf931('0x3e')]);_0x1c8069[_0xf931('0x3f')]=qs[_0xf931('0x35')](_['pick'](_0xe417a0[_0xf931('0x34')],_0x5847c1[_0xf931('0x35')]),_0x126367);if(_0xe417a0[_0xf931('0x34')][_0xf931('0x40')]){_0x1c8069[_0xf931('0x3f')]=_['merge'](_0x1c8069[_0xf931('0x3f')],{'$or':_[_0xf931('0x2e')](_0x126367,function(_0xf1a2b7){if(_0xf1a2b7['type']!==_0xf931('0x41')){var _0x8f5fdb={};_0x8f5fdb[_0xf1a2b7[_0xf931('0x2c')]]={'$like':'%'+_0xe417a0[_0xf931('0x34')][_0xf931('0x40')]+'%'};return _0x8f5fdb;}})});}_0x1c8069=_[_0xf931('0x42')]({},_0x1c8069,_0xe417a0[_0xf931('0x43')]);var _0x217adf={'where':_0x1c8069[_0xf931('0x3f')]};return db[_0xf931('0x2f')]['count'](_0x217adf)['then'](function(_0x37a020){_0x157218[_0xf931('0x20')]=_0x37a020;if(_0xe417a0['query']['includeAll']){_0x1c8069[_0xf931('0x44')]=[{'all':!![]}];}return db[_0xf931('0x2f')]['findAll'](_0x1c8069);})[_0xf931('0x27')](function(_0xbccc58){_0x157218[_0xf931('0x45')]=_0xbccc58;return _0x157218;})[_0xf931('0x27')](respondWithFilteredResult(_0x392b99,_0x1c8069))['catch'](handleError(_0x392b99,null));};exports[_0xf931('0x46')]=function(_0x5dbb11,_0x19cf21){var _0x467ccb={'raw':!![],'where':{'id':_0x5dbb11[_0xf931('0x47')]['id']}},_0x1363a4={};_0x1363a4[_0xf931('0x38')]=_['keys'](db[_0xf931('0x2f')][_0xf931('0x48')]);_0x1363a4[_0xf931('0x34')]=_['keys'](_0x5dbb11['query']);_0x1363a4[_0xf931('0x35')]=_[_0xf931('0x37')](_0x1363a4[_0xf931('0x38')],_0x1363a4[_0xf931('0x34')]);_0x467ccb[_0xf931('0x36')]=_['intersection'](_0x1363a4[_0xf931('0x38')],qs[_0xf931('0x39')](_0x5dbb11[_0xf931('0x34')][_0xf931('0x39')]));_0x467ccb['attributes']=_0x467ccb['attributes']['length']?_0x467ccb[_0xf931('0x36')]:_0x1363a4['model'];if(_0x5dbb11[_0xf931('0x34')][_0xf931('0x49')]){_0x467ccb['include']=[{'all':!![]}];}_0x467ccb=_['merge']({},_0x467ccb,_0x5dbb11[_0xf931('0x43')]);return db[_0xf931('0x2f')][_0xf931('0x4a')](_0x467ccb)[_0xf931('0x27')](handleEntityNotFound(_0x19cf21,null))[_0xf931('0x27')](respondWithResult(_0x19cf21,null))[_0xf931('0x4b')](handleError(_0x19cf21,null));};exports[_0xf931('0x4c')]=function(_0x3944e4,_0x259cd8){return db[_0xf931('0x2f')][_0xf931('0x4c')](_0x3944e4[_0xf931('0x4d')],{})[_0xf931('0x27')](function(_0x24238a){var _0x511a01=_0x3944e4['user'][_0xf931('0x28')]({'plain':!![]});if(!_0x511a01)throw new Error(_0xf931('0x4e'));if(_0x511a01['role']===_0xf931('0x4f')){var _0x5ed484=_0x24238a[_0xf931('0x28')]({'plain':!![]});var _0x123f55=_0xf931('0x29');return db[_0xf931('0x50')]['find']({'where':{'name':_0x123f55,'userProfileId':_0x511a01['userProfileId']},'raw':!![]})[_0xf931('0x27')](function(_0x3658da){if(_0x3658da&&_0x3658da['autoAssociation']===0x0){return db[_0xf931('0x2a')][_0xf931('0x4c')]({'name':_0x5ed484['name'],'resourceId':_0x5ed484['id'],'type':_0x3658da[_0xf931('0x2c')],'sectionId':_0x3658da['id']},{})[_0xf931('0x27')](function(){return _0x24238a;});}else{return _0x24238a;}})[_0xf931('0x4b')](function(_0x49f10c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49f10c);throw _0x49f10c;});}return _0x24238a;})[_0xf931('0x27')](respondWithResult(_0x259cd8,0xc9))[_0xf931('0x4b')](handleError(_0x259cd8,null));};exports[_0xf931('0x51')]=function(_0x19170f,_0xc93222){if(_0x19170f[_0xf931('0x4d')]['id']){delete _0x19170f[_0xf931('0x4d')]['id'];}return db[_0xf931('0x2f')]['find']({'where':{'id':_0x19170f[_0xf931('0x47')]['id']}})[_0xf931('0x27')](handleEntityNotFound(_0xc93222,null))[_0xf931('0x27')](saveUpdates(_0x19170f[_0xf931('0x4d')],null))['then'](respondWithResult(_0xc93222,null))[_0xf931('0x4b')](handleError(_0xc93222,null));};exports['destroy']=function(_0x2f15b3,_0x4c4a0f){return db[_0xf931('0x2f')]['find']({'where':{'id':_0x2f15b3['params']['id']}})[_0xf931('0x27')](handleEntityNotFound(_0x4c4a0f,null))[_0xf931('0x27')](removeEntity(_0x4c4a0f,null))[_0xf931('0x4b')](handleError(_0x4c4a0f,null));}; \ No newline at end of file +var _0x2159=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x300806,_0x510f9b){var _0x101011=function(_0x29486b){while(--_0x29486b){_0x300806['push'](_0x300806['shift']());}};_0x101011(++_0x510f9b);}(_0x2159,0x17f));var _0x9215=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0x2159[_0x560924];return _0x5c694d;};'use strict';var emlformat=require(_0x9215('0x0'));var rimraf=require(_0x9215('0x1'));var zipdir=require(_0x9215('0x2'));var jsonpatch=require(_0x9215('0x3'));var rp=require('request-promise');var moment=require(_0x9215('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9215('0x5'));var util=require(_0x9215('0x6'));var path=require(_0x9215('0x7'));var sox=require(_0x9215('0x8'));var csv=require(_0x9215('0x9'));var ejs=require(_0x9215('0xa'));var fs=require('fs');var fs_extra=require(_0x9215('0xb'));var _=require(_0x9215('0xc'));var squel=require('squel');var crypto=require(_0x9215('0xd'));var jsforce=require(_0x9215('0xe'));var deskjs=require(_0x9215('0xf'));var toCsv=require(_0x9215('0x9'));var querystring=require(_0x9215('0x10'));var Papa=require('papaparse');var Redis=require(_0x9215('0x11'));var authService=require(_0x9215('0x12'));var qs=require(_0x9215('0x13'));var as=require(_0x9215('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9215('0x15'))(_0x9215('0x16'));var utils=require('../../config/utils');var config=require(_0x9215('0x17'));var licenseUtil=require(_0x9215('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b660,_0x10b08f){_0x10b08f=_0x10b08f||0xcc;return function(_0x56c546){if(_0x56c546){return _0x43b660[_0x9215('0x19')](_0x10b08f);}return _0x43b660['status'](_0x10b08f)[_0x9215('0x1a')]();};}function respondWithResult(_0x5124b9,_0x1d65f4){_0x1d65f4=_0x1d65f4||0xc8;return function(_0x2d62dd){if(_0x2d62dd){return _0x5124b9[_0x9215('0x1b')](_0x1d65f4)[_0x9215('0x1c')](_0x2d62dd);}};}function respondWithFilteredResult(_0x4826bb,_0x3f44d3){return function(_0x40b41f){if(_0x40b41f){var _0x4c5ab5=typeof _0x3f44d3[_0x9215('0x1d')]===_0x9215('0x1e')&&typeof _0x3f44d3[_0x9215('0x1f')]===_0x9215('0x1e');var _0x229c46=_0x40b41f[_0x9215('0x20')];var _0x36ffb5=_0x4c5ab5?0x0:_0x3f44d3['offset'];var _0x197a47=_0x4c5ab5?_0x40b41f[_0x9215('0x20')]:_0x3f44d3[_0x9215('0x1d')]+_0x3f44d3[_0x9215('0x1f')];var _0x1aee05;if(_0x197a47>=_0x229c46){_0x197a47=_0x229c46;_0x1aee05=0xc8;}else{_0x1aee05=0xce;}_0x4826bb[_0x9215('0x1b')](_0x1aee05);return _0x4826bb[_0x9215('0x21')]('Content-Range',_0x36ffb5+'-'+_0x197a47+'/'+_0x229c46)['json'](_0x40b41f);}return null;};}function patchUpdates(_0x5bc65b){return function(_0x2fd6dd){try{jsonpatch[_0x9215('0x22')](_0x2fd6dd,_0x5bc65b,!![]);}catch(_0x54d9d7){return BPromise[_0x9215('0x23')](_0x54d9d7);}return _0x2fd6dd[_0x9215('0x24')]();};}function saveUpdates(_0xa58f48,_0x311cfb){return function(_0x518c52){if(_0x518c52){return _0x518c52[_0x9215('0x25')](_0xa58f48)[_0x9215('0x26')](function(_0x163a4a){return _0x163a4a;});}return null;};}function removeEntity(_0x240d25,_0x355cfe){return function(_0x19c276){if(_0x19c276){return _0x19c276[_0x9215('0x27')]()[_0x9215('0x26')](function(){var _0x10f51c=_0x19c276[_0x9215('0x28')]({'plain':!![]});var _0x2725d4='Dispositions';return db[_0x9215('0x29')][_0x9215('0x27')]({'where':{'type':_0x2725d4,'resourceId':_0x10f51c['id']}})[_0x9215('0x26')](function(){return _0x19c276;});})['then'](function(){_0x240d25[_0x9215('0x1b')](0xcc)[_0x9215('0x1a')]();});}};}function handleEntityNotFound(_0x4159a3,_0x896e9){return function(_0x10fa42){if(!_0x10fa42){_0x4159a3[_0x9215('0x19')](0x194);}return _0x10fa42;};}function handleError(_0x57a761,_0xc51dcf){_0xc51dcf=_0xc51dcf||0x1f4;return function(_0x83774f){logger[_0x9215('0x2a')](_0x83774f[_0x9215('0x2b')]);if(_0x83774f['name']){delete _0x83774f[_0x9215('0x2c')];}_0x57a761['status'](_0xc51dcf)[_0x9215('0x2d')](_0x83774f);};}exports['index']=function(_0x44c5ac,_0x4ac99f){var _0x38046d={},_0x4ff78a={},_0x4d0bc2={'count':0x0,'rows':[]};var _0x8af2e5=_[_0x9215('0x2e')](db['Disposition']['rawAttributes'],function(_0x33dc2d){return{'name':_0x33dc2d[_0x9215('0x2f')],'type':_0x33dc2d[_0x9215('0x30')][_0x9215('0x31')]};});_0x4ff78a['model']=_['map'](_0x8af2e5,_0x9215('0x2c'));_0x4ff78a[_0x9215('0x32')]=_[_0x9215('0x33')](_0x44c5ac[_0x9215('0x32')]);_0x4ff78a[_0x9215('0x34')]=_[_0x9215('0x35')](_0x4ff78a[_0x9215('0x36')],_0x4ff78a['query']);_0x38046d['attributes']=_[_0x9215('0x35')](_0x4ff78a[_0x9215('0x36')],qs[_0x9215('0x37')](_0x44c5ac['query'][_0x9215('0x37')]));_0x38046d[_0x9215('0x38')]=_0x38046d['attributes'][_0x9215('0x39')]?_0x38046d[_0x9215('0x38')]:_0x4ff78a[_0x9215('0x36')];if(!_0x44c5ac[_0x9215('0x32')]['hasOwnProperty']('nolimit')){_0x38046d[_0x9215('0x1f')]=qs[_0x9215('0x1f')](_0x44c5ac['query']['limit']);_0x38046d[_0x9215('0x1d')]=qs['offset'](_0x44c5ac['query'][_0x9215('0x1d')]);}_0x38046d[_0x9215('0x3a')]=qs[_0x9215('0x3b')](_0x44c5ac[_0x9215('0x32')][_0x9215('0x3b')]);_0x38046d[_0x9215('0x3c')]=qs[_0x9215('0x34')](_[_0x9215('0x3d')](_0x44c5ac[_0x9215('0x32')],_0x4ff78a['filters']),_0x8af2e5);if(_0x44c5ac[_0x9215('0x32')]['filter']){_0x38046d[_0x9215('0x3c')]=_[_0x9215('0x3e')](_0x38046d['where'],{'$or':_[_0x9215('0x2e')](_0x8af2e5,function(_0x5bc497){if(_0x5bc497[_0x9215('0x30')]!==_0x9215('0x3f')){var _0x438b79={};_0x438b79[_0x5bc497[_0x9215('0x2c')]]={'$like':'%'+_0x44c5ac['query']['filter']+'%'};return _0x438b79;}})});}_0x38046d=_['merge']({},_0x38046d,_0x44c5ac[_0x9215('0x40')]);var _0x19b112={'where':_0x38046d[_0x9215('0x3c')]};return db[_0x9215('0x41')][_0x9215('0x20')](_0x19b112)[_0x9215('0x26')](function(_0x159804){_0x4d0bc2[_0x9215('0x20')]=_0x159804;if(_0x44c5ac[_0x9215('0x32')][_0x9215('0x42')]){_0x38046d[_0x9215('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x9215('0x44')](_0x38046d);})[_0x9215('0x26')](function(_0x1e6a6){_0x4d0bc2['rows']=_0x1e6a6;return _0x4d0bc2;})[_0x9215('0x26')](respondWithFilteredResult(_0x4ac99f,_0x38046d))[_0x9215('0x45')](handleError(_0x4ac99f,null));};exports['show']=function(_0x5bd54b,_0x2069f2){var _0x4e1aad={'raw':!![],'where':{'id':_0x5bd54b[_0x9215('0x46')]['id']}},_0x38af40={};_0x38af40[_0x9215('0x36')]=_[_0x9215('0x33')](db['Disposition'][_0x9215('0x47')]);_0x38af40['query']=_['keys'](_0x5bd54b[_0x9215('0x32')]);_0x38af40[_0x9215('0x34')]=_[_0x9215('0x35')](_0x38af40['model'],_0x38af40[_0x9215('0x32')]);_0x4e1aad[_0x9215('0x38')]=_['intersection'](_0x38af40[_0x9215('0x36')],qs['fields'](_0x5bd54b[_0x9215('0x32')][_0x9215('0x37')]));_0x4e1aad['attributes']=_0x4e1aad['attributes'][_0x9215('0x39')]?_0x4e1aad['attributes']:_0x38af40[_0x9215('0x36')];if(_0x5bd54b[_0x9215('0x32')][_0x9215('0x42')]){_0x4e1aad['include']=[{'all':!![]}];}_0x4e1aad=_[_0x9215('0x3e')]({},_0x4e1aad,_0x5bd54b[_0x9215('0x40')]);return db[_0x9215('0x41')][_0x9215('0x48')](_0x4e1aad)[_0x9215('0x26')](handleEntityNotFound(_0x2069f2,null))[_0x9215('0x26')](respondWithResult(_0x2069f2,null))['catch'](handleError(_0x2069f2,null));};exports['create']=function(_0x3e7d2c,_0x2861b6){return db['Disposition'][_0x9215('0x49')](_0x3e7d2c['body'],{})[_0x9215('0x26')](function(_0x56c7fe){var _0x34b852=_0x3e7d2c[_0x9215('0x4a')]['get']({'plain':!![]});if(!_0x34b852)throw new Error(_0x9215('0x4b'));if(_0x34b852[_0x9215('0x4c')]===_0x9215('0x4a')){var _0x1a2f5a=_0x56c7fe[_0x9215('0x28')]({'plain':!![]});var _0x40d4f0=_0x9215('0x4d');return db[_0x9215('0x4e')][_0x9215('0x48')]({'where':{'name':_0x40d4f0,'userProfileId':_0x34b852[_0x9215('0x4f')]},'raw':!![]})[_0x9215('0x26')](function(_0x1f0982){if(_0x1f0982&&_0x1f0982[_0x9215('0x50')]===0x0){return db[_0x9215('0x29')][_0x9215('0x49')]({'name':_0x1a2f5a[_0x9215('0x2c')],'resourceId':_0x1a2f5a['id'],'type':_0x1f0982[_0x9215('0x2c')],'sectionId':_0x1f0982['id']},{})[_0x9215('0x26')](function(){return _0x56c7fe;});}else{return _0x56c7fe;}})[_0x9215('0x45')](function(_0x523b30){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x523b30);throw _0x523b30;});}return _0x56c7fe;})[_0x9215('0x26')](respondWithResult(_0x2861b6,0xc9))[_0x9215('0x45')](handleError(_0x2861b6,null));};exports[_0x9215('0x25')]=function(_0x5c7129,_0x2dacf9){if(_0x5c7129[_0x9215('0x51')]['id']){delete _0x5c7129[_0x9215('0x51')]['id'];}return db[_0x9215('0x41')][_0x9215('0x48')]({'where':{'id':_0x5c7129[_0x9215('0x46')]['id']}})[_0x9215('0x26')](handleEntityNotFound(_0x2dacf9,null))[_0x9215('0x26')](saveUpdates(_0x5c7129[_0x9215('0x51')],null))[_0x9215('0x26')](respondWithResult(_0x2dacf9,null))[_0x9215('0x45')](handleError(_0x2dacf9,null));};exports[_0x9215('0x27')]=function(_0xe3bc0d,_0x411457){return db[_0x9215('0x41')][_0x9215('0x48')]({'where':{'id':_0xe3bc0d['params']['id']}})[_0x9215('0x26')](handleEntityNotFound(_0x411457,null))['then'](removeEntity(_0x411457,null))['catch'](handleError(_0x411457,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d3ad573..1434859 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 _0x55b6=['Disposition','tools_dispositions','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','../../config/environment','./disposition.attributes','exports','define'];(function(_0x21331a,_0x57fc48){var _0x325c55=function(_0x770dfa){while(--_0x770dfa){_0x21331a['push'](_0x21331a['shift']());}};_0x325c55(++_0x57fc48);}(_0x55b6,0x74));var _0x655b=function(_0x5802e1,_0x2449f6){_0x5802e1=_0x5802e1-0x0;var _0x3faaa6=_0x55b6[_0x5802e1];return _0x3faaa6;};'use strict';var _=require(_0x655b('0x0'));var util=require(_0x655b('0x1'));var logger=require(_0x655b('0x2'))(_0x655b('0x3'));var moment=require(_0x655b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x655b('0x5'));var attributes=require(_0x655b('0x6'));module[_0x655b('0x7')]=function(_0x5d3784,_0x2842f9){return _0x5d3784[_0x655b('0x8')](_0x655b('0x9'),attributes,{'tableName':_0x655b('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x655b('0xb'),'fields':[_0x655b('0xc'),_0x655b('0xd')]},{'unique':!![],'name':_0x655b('0xe'),'fields':[_0x655b('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x655b('0xf'),'fields':[_0x655b('0xc'),_0x655b('0x10')]},{'unique':!![],'name':_0x655b('0x11'),'fields':[_0x655b('0xc'),_0x655b('0x12')]},{'unique':!![],'name':_0x655b('0x13'),'fields':[_0x655b('0xc'),_0x655b('0x14')]},{'unique':!![],'name':_0x655b('0x15'),'fields':[_0x655b('0xc'),_0x655b('0x16')]},{'unique':!![],'name':_0x655b('0x17'),'fields':[_0x655b('0xc'),_0x655b('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8453=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x8453,0x100));var _0x3845=function(_0xa30ce7,_0x2de321){_0xa30ce7=_0xa30ce7-0x0;var _0xa33fda=_0x8453[_0xa30ce7];return _0xa33fda;};'use strict';var _=require(_0x3845('0x0'));var util=require(_0x3845('0x1'));var logger=require(_0x3845('0x2'))(_0x3845('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3845('0x4'));var fs=require('fs');var path=require(_0x3845('0x5'));var rimraf=require(_0x3845('0x6'));var config=require(_0x3845('0x7'));var attributes=require('./disposition.attributes');module[_0x3845('0x8')]=function(_0x1bd83c,_0x40b565){return _0x1bd83c[_0x3845('0x9')](_0x3845('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3845('0xb'),'fields':[_0x3845('0xc'),'ListId']},{'unique':!![],'name':_0x3845('0xd'),'fields':[_0x3845('0xc'),_0x3845('0xe')]},{'unique':!![],'name':_0x3845('0xf'),'fields':[_0x3845('0xc'),_0x3845('0x10')]},{'unique':!![],'name':_0x3845('0x11'),'fields':['name',_0x3845('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x3845('0xc'),_0x3845('0x13')]},{'unique':!![],'name':_0x3845('0x14'),'fields':[_0x3845('0xc'),_0x3845('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x3845('0xc'),_0x3845('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index cf33fd4..196d43b 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(_0x1709f8,_0xcdc88d){var _0x1a2e04=function(_0x29d6c4){while(--_0x29d6c4){_0x1709f8['push'](_0x1709f8['shift']());}};_0x1a2e04(++_0xcdc88d);}(_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 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(_0x46e357,_0x447893){var _0x29a703=function(_0x2da9d7){while(--_0x2da9d7){_0x46e357['push'](_0x46e357['shift']());}};_0x29a703(++_0x447893);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 fee37bf..74f0c64 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 _0xc9c3=['express','Router','fs-extra','./disposition.controller','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','path'];(function(_0x3a49fd,_0xe44f02){var _0x18527d=function(_0x112f5c){while(--_0x112f5c){_0x3a49fd['push'](_0x3a49fd['shift']());}};_0x18527d(++_0xe44f02);}(_0xc9c3,0x147));var _0x3c9c=function(_0x40a30b,_0x117bda){_0x40a30b=_0x40a30b-0x0;var _0x5e6353=_0xc9c3[_0x40a30b];return _0x5e6353;};'use strict';var multer=require(_0x3c9c('0x0'));var util=require(_0x3c9c('0x1'));var path=require(_0x3c9c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x3'));var router=express[_0x3c9c('0x4')]();var fs_extra=require(_0x3c9c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c9c('0x6'));router['get']('/',auth[_0x3c9c('0x7')](),controller[_0x3c9c('0x8')]);router['get'](_0x3c9c('0x9'),auth[_0x3c9c('0x7')](),controller['show']);router[_0x3c9c('0xa')]('/',auth[_0x3c9c('0x7')](),controller['create']);router['put'](_0x3c9c('0x9'),auth[_0x3c9c('0x7')](),controller[_0x3c9c('0xb')]);router[_0x3c9c('0xc')](_0x3c9c('0x9'),auth[_0x3c9c('0x7')](),controller[_0x3c9c('0xd')]);module[_0x3c9c('0xe')]=router; \ No newline at end of file +var _0xcfba=['update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x18540f,_0x59a771){var _0x1f290b=function(_0x3f88c8){while(--_0x3f88c8){_0x18540f['push'](_0x18540f['shift']());}};_0x1f290b(++_0x59a771);}(_0xcfba,0xc5));var _0xacfb=function(_0x3cc3a9,_0x133800){_0x3cc3a9=_0x3cc3a9-0x0;var _0x157d18=_0xcfba[_0x3cc3a9];return _0x157d18;};'use strict';var multer=require('multer');var util=require(_0xacfb('0x0'));var path=require(_0xacfb('0x1'));var timeout=require(_0xacfb('0x2'));var express=require('express');var router=express[_0xacfb('0x3')]();var fs_extra=require(_0xacfb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacfb('0x5'));var config=require(_0xacfb('0x6'));var controller=require('./disposition.controller');router[_0xacfb('0x7')]('/',auth[_0xacfb('0x8')](),controller[_0xacfb('0x9')]);router[_0xacfb('0x7')](_0xacfb('0xa'),auth[_0xacfb('0x8')](),controller['show']);router[_0xacfb('0xb')]('/',auth[_0xacfb('0x8')](),controller[_0xacfb('0xc')]);router['put'](_0xacfb('0xa'),auth['isAuthenticated'](),controller[_0xacfb('0xd')]);router['delete']('/:id',auth[_0xacfb('0x8')](),controller['destroy']);module[_0xacfb('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 13944f8..6560fb6 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 _0xfa2e=['4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','exports','STRING','ENUM','yes','localstationid','2400'];(function(_0x10eaeb,_0x188925){var _0x26182d=function(_0x122279){while(--_0x122279){_0x10eaeb['push'](_0x10eaeb['shift']());}};_0x26182d(++_0x188925);}(_0xfa2e,0xa1));var _0xefa2=function(_0x5083dd,_0xb010cc){_0x5083dd=_0x5083dd-0x0;var _0x4ecf17=_0xfa2e[_0x5083dd];return _0x4ecf17;};'use strict';var Sequelize=require(_0xefa2('0x0'));module[_0xefa2('0x1')]={'name':{'type':Sequelize[_0xefa2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xefa2('0x2')]},'ecm':{'type':Sequelize[_0xefa2('0x3')](_0xefa2('0x4'),'no'),'defaultValue':_0xefa2('0x4')},'headerinfo':{'type':Sequelize[_0xefa2('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xefa2('0x2')],'unique':_0xefa2('0x5')},'minrate':{'type':Sequelize[_0xefa2('0x3')](_0xefa2('0x6'),_0xefa2('0x7'),_0xefa2('0x8'),_0xefa2('0x9'),_0xefa2('0xa'),_0xefa2('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xefa2('0x3')](_0xefa2('0x6'),'4800',_0xefa2('0x8'),_0xefa2('0x9'),_0xefa2('0xa'),_0xefa2('0xb')),'defaultValue':_0xefa2('0xb')},'modem':{'type':Sequelize[_0xefa2('0x2')],'defaultValue':_0xefa2('0xc')},'gateway':{'type':Sequelize[_0xefa2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xefa2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xefa2('0xd'),_0xefa2('0xe'),_0xefa2('0xf'),'KHOMP'),'defaultValue':_0xefa2('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xefa2('0x10')],'defaultValue':function(){return _0xefa2('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xefa2('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xefa2('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xefa2('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xefa2('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xefa2('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xefa2('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0xefa2('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xefa2('0x15'),'set':function(_0x51f5d9){if(!_0x51f5d9)this['setDataValue'](_0xefa2('0x16'),null);this[_0xefa2('0x17')]('mandatoryDisposition',_0x51f5d9);}}}; \ No newline at end of file +var _0x7868=['7200','9600','12000','14400','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x7868,0x1c0));var _0x8786=function(_0x171358,_0x5b80b6){_0x171358=_0x171358-0x0;var _0xf7fc3c=_0x7868[_0x171358];return _0xf7fc3c;};'use strict';var Sequelize=require(_0x8786('0x0'));module['exports']={'name':{'type':Sequelize[_0x8786('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8786('0x1')]},'ecm':{'type':Sequelize[_0x8786('0x2')](_0x8786('0x3'),'no'),'defaultValue':_0x8786('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8786('0x4')},'localstationid':{'type':Sequelize[_0x8786('0x1')],'unique':_0x8786('0x5')},'minrate':{'type':Sequelize[_0x8786('0x2')](_0x8786('0x6'),_0x8786('0x7'),_0x8786('0x8'),_0x8786('0x9'),_0x8786('0xa'),_0x8786('0xb')),'defaultValue':_0x8786('0x7')},'maxrate':{'type':Sequelize[_0x8786('0x2')]('2400','4800',_0x8786('0x8'),_0x8786('0x9'),_0x8786('0xa'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8786('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8786('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8786('0x2')](_0x8786('0xd'),_0x8786('0xe'),'DADHI',_0x8786('0xf')),'defaultValue':_0x8786('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8786('0x10')],'defaultValue':function(){return _0x8786('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8786('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8786('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8786('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8786('0x12')],'defaultValue':![],'comment':_0x8786('0x14'),'set':function(_0x280979){if(!_0x280979)this['setDataValue'](_0x8786('0x15'),null);this[_0x8786('0x16')](_0x8786('0x17'),_0x280979);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 417e30a..7bd6bf8 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 _0x697f=['includeAll','include','findAll','show','params','options','find','create','body','user','FaxAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','Set','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','updatedAt','TrunkId','ListId','findById','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','get','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter'];(function(_0x1db843,_0x18be51){var _0x588c54=function(_0xc3134d){while(--_0xc3134d){_0x1db843['push'](_0x1db843['shift']());}};_0x588c54(++_0x18be51);}(_0x697f,0x6d));var _0xf697=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0x697f[_0x5e6cb8];return _0x3faeb3;};'use strict';var emlformat=require(_0xf697('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf697('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf697('0x2'));var moment=require('moment');var BPromise=require(_0xf697('0x3'));var Mustache=require(_0xf697('0x4'));var util=require(_0xf697('0x5'));var path=require('path');var sox=require(_0xf697('0x6'));var csv=require(_0xf697('0x7'));var ejs=require(_0xf697('0x8'));var fs=require('fs');var fs_extra=require(_0xf697('0x9'));var _=require(_0xf697('0xa'));var squel=require('squel');var crypto=require(_0xf697('0xb'));var jsforce=require(_0xf697('0xc'));var deskjs=require(_0xf697('0xd'));var toCsv=require(_0xf697('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf697('0xe'));var authService=require(_0xf697('0xf'));var qs=require(_0xf697('0x10'));var as=require(_0xf697('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf697('0x12'));var utils=require(_0xf697('0x13'));var config=require(_0xf697('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf697('0x15'))['db'];config[_0xf697('0x16')]=_['defaults'](config[_0xf697('0x16')],{'host':_0xf697('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf697('0x16')]));require(_0xf697('0x18'))[_0xf697('0x19')](socket);var jayson=require(_0xf697('0x1a'));var client=jayson[_0xf697('0x1b')][_0xf697('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xf697('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5ae3c7,_0x3e5350,_0x2721f2,_0x241b84){return new BPromise(function(_0x330314,_0x2b8d8f){var _0x212548=_0x241b84||client;return _0x212548['request'](_0x5ae3c7,_0x2721f2)[_0xf697('0x1d')](function(_0x44dcee){logger['info'](_0xf697('0x1e'),_0x3e5350,_0xf697('0x1f'));logger['debug'](_0xf697('0x20'),_0x3e5350,_0xf697('0x1f'),JSON[_0xf697('0x21')](_0x44dcee));if(_0x44dcee[_0xf697('0x22')]){if(_0x44dcee[_0xf697('0x22')][_0xf697('0x23')]===0x1f4){logger[_0xf697('0x22')](_0xf697('0x1e'),_0x3e5350,_0x44dcee['error']['message']);return _0x2b8d8f(_0x44dcee['error'][_0xf697('0x24')]);}logger[_0xf697('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3e5350,_0x44dcee[_0xf697('0x22')][_0xf697('0x24')]);return _0x330314(_0x44dcee[_0xf697('0x22')][_0xf697('0x24')]);}else{logger[_0xf697('0x25')](_0xf697('0x1e'),_0x3e5350,_0xf697('0x1f'));_0x330314(_0x44dcee[_0xf697('0x26')][_0xf697('0x24')]);}})[_0xf697('0x27')](function(_0x305028){logger[_0xf697('0x22')](_0xf697('0x1e'),_0x3e5350,_0x305028);_0x2b8d8f(_0x305028);});});}function respondWithStatusCode(_0x46cba5,_0x4939fd){_0x4939fd=_0x4939fd||0xcc;return function(_0x40a38c){if(_0x40a38c){return _0x46cba5[_0xf697('0x28')](_0x4939fd);}return _0x46cba5[_0xf697('0x29')](_0x4939fd)[_0xf697('0x2a')]();};}function respondWithResult(_0x5729a0,_0x4fe66d){_0x4fe66d=_0x4fe66d||0xc8;return function(_0x628d90){if(_0x628d90){return _0x5729a0[_0xf697('0x29')](_0x4fe66d)[_0xf697('0x2b')](_0x628d90);}};}function respondWithFilteredResult(_0x5ce691,_0xd82c41){return function(_0x47a906){if(_0x47a906){var _0x4020c7=typeof _0xd82c41[_0xf697('0x2c')]===_0xf697('0x2d')&&typeof _0xd82c41['limit']==='undefined';var _0x573e16=_0x47a906[_0xf697('0x2e')];var _0x7105db=_0x4020c7?0x0:_0xd82c41[_0xf697('0x2c')];var _0x2a1475=_0x4020c7?_0x47a906[_0xf697('0x2e')]:_0xd82c41[_0xf697('0x2c')]+_0xd82c41[_0xf697('0x2f')];var _0x5db651;if(_0x2a1475>=_0x573e16){_0x2a1475=_0x573e16;_0x5db651=0xc8;}else{_0x5db651=0xce;}_0x5ce691[_0xf697('0x29')](_0x5db651);return _0x5ce691[_0xf697('0x30')](_0xf697('0x31'),_0x7105db+'-'+_0x2a1475+'/'+_0x573e16)[_0xf697('0x2b')](_0x47a906);}return null;};}function patchUpdates(_0x248ff2){return function(_0x5c194f){try{jsonpatch[_0xf697('0x32')](_0x5c194f,_0x248ff2,!![]);}catch(_0x2abde6){return BPromise['reject'](_0x2abde6);}return _0x5c194f[_0xf697('0x33')]();};}function saveUpdates(_0xcd76e5,_0xf16886){return function(_0x213e0a){if(_0x213e0a){return _0x213e0a[_0xf697('0x34')](_0xcd76e5)[_0xf697('0x1d')](function(_0x40770b){return _0x40770b;});}return null;};}function removeEntity(_0x4a1869,_0x2d0183){return function(_0x1041e8){if(_0x1041e8){return _0x1041e8['destroy']()[_0xf697('0x1d')](function(){var _0x4595be=_0x1041e8[_0xf697('0x35')]({'plain':!![]});var _0x32cd62='FaxAccounts';return db['UserProfileResource'][_0xf697('0x36')]({'where':{'type':_0x32cd62,'resourceId':_0x4595be['id']}})[_0xf697('0x1d')](function(){return _0x1041e8;});})[_0xf697('0x1d')](function(){_0x4a1869[_0xf697('0x29')](0xcc)[_0xf697('0x2a')]();});}};}function handleEntityNotFound(_0x46b31c,_0x28f306){return function(_0x3118da){if(!_0x3118da){_0x46b31c[_0xf697('0x28')](0x194);}return _0x3118da;};}function handleError(_0x236d22,_0x328e55){_0x328e55=_0x328e55||0x1f4;return function(_0x2a0bf6){logger[_0xf697('0x22')](_0x2a0bf6[_0xf697('0x37')]);if(_0x2a0bf6['name']){delete _0x2a0bf6[_0xf697('0x38')];}_0x236d22[_0xf697('0x29')](_0x328e55)[_0xf697('0x39')](_0x2a0bf6);};}exports['index']=function(_0x4b5425,_0x3a15aa){var _0x5b94ae={'include':[{'model':db[_0xf697('0x3a')],'as':_0xf697('0x3b')}]},_0x31f435={},_0x176700={'count':0x0,'rows':[]};var _0x497a9a=_[_0xf697('0x3c')](db[_0xf697('0x3d')][_0xf697('0x3e')],function(_0x4bacd0){return{'name':_0x4bacd0[_0xf697('0x3f')],'type':_0x4bacd0['type'][_0xf697('0x40')]};});_0x31f435[_0xf697('0x41')]=_[_0xf697('0x3c')](_0x497a9a,_0xf697('0x38'));_0x31f435['query']=_[_0xf697('0x42')](_0x4b5425['query']);_0x31f435[_0xf697('0x43')]=_[_0xf697('0x44')](_0x31f435[_0xf697('0x41')],_0x31f435[_0xf697('0x45')]);_0x5b94ae[_0xf697('0x46')]=_[_0xf697('0x44')](_0x31f435['model'],qs[_0xf697('0x47')](_0x4b5425[_0xf697('0x45')][_0xf697('0x47')]));_0x5b94ae[_0xf697('0x46')]=_0x5b94ae[_0xf697('0x46')][_0xf697('0x48')]?_0x5b94ae['attributes']:_0x31f435['model'];if(!_0x4b5425[_0xf697('0x45')]['hasOwnProperty'](_0xf697('0x49'))){_0x5b94ae[_0xf697('0x2f')]=qs['limit'](_0x4b5425['query'][_0xf697('0x2f')]);_0x5b94ae[_0xf697('0x2c')]=qs[_0xf697('0x2c')](_0x4b5425[_0xf697('0x45')][_0xf697('0x2c')]);}_0x5b94ae[_0xf697('0x4a')]=qs[_0xf697('0x4b')](_0x4b5425[_0xf697('0x45')]['sort']);_0x5b94ae['where']=qs[_0xf697('0x43')](_[_0xf697('0x4c')](_0x4b5425[_0xf697('0x45')],_0x31f435['filters']),_0x497a9a);if(_0x4b5425['query']['filter']){_0x5b94ae[_0xf697('0x4d')]=_[_0xf697('0x4e')](_0x5b94ae[_0xf697('0x4d')],{'$or':_['map'](_0x497a9a,function(_0x15b2a5){if(_0x15b2a5[_0xf697('0x4f')]!==_0xf697('0x50')){var _0x410277={};_0x410277[_0x15b2a5[_0xf697('0x38')]]={'$like':'%'+_0x4b5425[_0xf697('0x45')][_0xf697('0x51')]+'%'};return _0x410277;}})});}_0x5b94ae=_[_0xf697('0x4e')]({},_0x5b94ae,_0x4b5425['options']);var _0x3d5f61={'where':_0x5b94ae[_0xf697('0x4d')]};return db['FaxAccount'][_0xf697('0x2e')](_0x3d5f61)[_0xf697('0x1d')](function(_0x36782d){_0x176700[_0xf697('0x2e')]=_0x36782d;if(_0x4b5425[_0xf697('0x45')][_0xf697('0x52')]){_0x5b94ae[_0xf697('0x53')]=[{'all':!![]}];}return db[_0xf697('0x3d')][_0xf697('0x54')](_0x5b94ae);})[_0xf697('0x1d')](function(_0x11c9dd){_0x176700['rows']=_0x11c9dd;return _0x176700;})['then'](respondWithFilteredResult(_0x3a15aa,_0x5b94ae))[_0xf697('0x27')](handleError(_0x3a15aa,null));};exports[_0xf697('0x55')]=function(_0x25baa4,_0xf00cff){var _0x1e8af8={'raw':![],'where':{'id':_0x25baa4[_0xf697('0x56')]['id']},'include':[{'model':db[_0xf697('0x3a')],'as':_0xf697('0x3b')}]},_0x42947b={};_0x42947b[_0xf697('0x41')]=_['keys'](db['FaxAccount'][_0xf697('0x3e')]);_0x42947b[_0xf697('0x45')]=_[_0xf697('0x42')](_0x25baa4['query']);_0x42947b[_0xf697('0x43')]=_[_0xf697('0x44')](_0x42947b[_0xf697('0x41')],_0x42947b[_0xf697('0x45')]);_0x1e8af8[_0xf697('0x46')]=_[_0xf697('0x44')](_0x42947b[_0xf697('0x41')],qs[_0xf697('0x47')](_0x25baa4[_0xf697('0x45')][_0xf697('0x47')]));_0x1e8af8[_0xf697('0x46')]=_0x1e8af8[_0xf697('0x46')][_0xf697('0x48')]?_0x1e8af8['attributes']:_0x42947b[_0xf697('0x41')];if(_0x25baa4[_0xf697('0x45')][_0xf697('0x52')]){_0x1e8af8['include']=[{'all':!![]}];}_0x1e8af8=_['merge']({},_0x1e8af8,_0x25baa4[_0xf697('0x57')]);return db[_0xf697('0x3d')][_0xf697('0x58')](_0x1e8af8)[_0xf697('0x1d')](handleEntityNotFound(_0xf00cff,null))[_0xf697('0x1d')](respondWithResult(_0xf00cff,null))['catch'](handleError(_0xf00cff,null));};exports['create']=function(_0x25c72c,_0x20c34e){return db[_0xf697('0x3d')][_0xf697('0x59')](_0x25c72c[_0xf697('0x5a')],{})[_0xf697('0x1d')](function(_0xc10317){var _0x2d6940=_0x25c72c[_0xf697('0x5b')][_0xf697('0x35')]({'plain':!![]});if(!_0x2d6940)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d6940['role']===_0xf697('0x5b')){var _0x88d847=_0xc10317['get']({'plain':!![]});var _0x538589=_0xf697('0x5c');return db[_0xf697('0x5d')]['find']({'where':{'name':_0x538589,'userProfileId':_0x2d6940['userProfileId']},'raw':!![]})['then'](function(_0x451901){if(_0x451901&&_0x451901[_0xf697('0x5e')]===0x0){return db[_0xf697('0x5f')][_0xf697('0x59')]({'name':_0x88d847[_0xf697('0x38')],'resourceId':_0x88d847['id'],'type':_0x451901['name'],'sectionId':_0x451901['id']},{})[_0xf697('0x1d')](function(){return _0xc10317;});}else{return _0xc10317;}})[_0xf697('0x27')](function(_0x14fa04){logger[_0xf697('0x22')](_0xf697('0x60'),_0x14fa04);throw _0x14fa04;});}return _0xc10317;})[_0xf697('0x1d')](respondWithResult(_0x20c34e,0xc9))[_0xf697('0x27')](handleError(_0x20c34e,null));};exports[_0xf697('0x34')]=function(_0x2ec1ed,_0x4d2215){if(_0x2ec1ed[_0xf697('0x5a')]['id']){delete _0x2ec1ed['body']['id'];}return db['FaxAccount'][_0xf697('0x58')]({'where':{'id':_0x2ec1ed[_0xf697('0x56')]['id']},'include':[{'model':db[_0xf697('0x3a')],'as':_0xf697('0x3b')}]})['then'](handleEntityNotFound(_0x4d2215,null))['then'](saveUpdates(_0x2ec1ed[_0xf697('0x5a')],null))['then'](respondWithResult(_0x4d2215,null))[_0xf697('0x27')](handleError(_0x4d2215,null));};exports['destroy']=function(_0x360de4,_0x1d45f8){return db[_0xf697('0x3d')]['find']({'where':{'id':_0x360de4[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x1d45f8,null))['then'](removeEntity(_0x1d45f8,null))[_0xf697('0x27')](handleError(_0x1d45f8,null));};exports[_0xf697('0x61')]=function(_0x5b6640,_0x7f781f){return db[_0xf697('0x3d')]['describe']()['then'](respondWithResult(_0x7f781f,null))[_0xf697('0x27')](handleError(_0x7f781f,null));};exports['addDisposition']=function(_0x18cf4b,_0x50a974,_0x34951f){if(_0x18cf4b[_0xf697('0x5a')]['id']){delete _0x18cf4b[_0xf697('0x5a')]['id'];}return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x18cf4b[_0xf697('0x56')]['id']}})['then'](handleEntityNotFound(_0x50a974,null))[_0xf697('0x1d')](function(_0x325161){if(_0x325161){_0x18cf4b[_0xf697('0x5a')][_0xf697('0x62')]=_0x325161['id'];return db[_0xf697('0x63')]['create'](_0x18cf4b[_0xf697('0x5a')]);}})[_0xf697('0x1d')](respondWithResult(_0x50a974,null))[_0xf697('0x27')](handleError(_0x50a974,null));};exports[_0xf697('0x64')]=function(_0x152304,_0xbab0f3,_0x328723){var _0xbef280={'raw':![],'where':{}};var _0xdace65={};var _0x4d3f9a={'count':0x0,'rows':[]};return db[_0xf697('0x3d')]['findOne']({'where':{'id':_0x152304['params']['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0xbab0f3,null))[_0xf697('0x1d')](function(_0x4f53e6){if(_0x4f53e6){_0xdace65[_0xf697('0x41')]=_[_0xf697('0x42')](db[_0xf697('0x63')]['rawAttributes']);_0xdace65['query']=_['keys'](_0x152304[_0xf697('0x45')]);_0xdace65[_0xf697('0x43')]=_['intersection'](_0xdace65[_0xf697('0x41')],_0xdace65[_0xf697('0x45')]);_0xbef280[_0xf697('0x46')]=_[_0xf697('0x44')](_0xdace65[_0xf697('0x41')],qs[_0xf697('0x47')](_0x152304['query'][_0xf697('0x47')]));_0xbef280['attributes']=_0xbef280[_0xf697('0x46')][_0xf697('0x48')]?_0xbef280[_0xf697('0x46')]:_0xdace65[_0xf697('0x41')];if(!_0x152304[_0xf697('0x45')]['hasOwnProperty'](_0xf697('0x49'))){_0xbef280[_0xf697('0x2f')]=qs[_0xf697('0x2f')](_0x152304[_0xf697('0x45')][_0xf697('0x2f')]);_0xbef280[_0xf697('0x2c')]=qs[_0xf697('0x2c')](_0x152304[_0xf697('0x45')][_0xf697('0x2c')]);}_0xbef280[_0xf697('0x4a')]=qs[_0xf697('0x4b')](_0x152304[_0xf697('0x45')][_0xf697('0x4b')]);_0xbef280['where']=qs[_0xf697('0x43')](_[_0xf697('0x4c')](_0x152304[_0xf697('0x45')],_0xdace65[_0xf697('0x43')]));_0xbef280['where']['FaxAccountId']=_0x4f53e6['id'];if(_0x152304[_0xf697('0x45')][_0xf697('0x51')]){_0xbef280[_0xf697('0x4d')]=_[_0xf697('0x4e')](_0xbef280[_0xf697('0x4d')],{'$or':_[_0xf697('0x3c')](_0xbef280[_0xf697('0x46')],function(_0x23a97f){var _0x3a0736={};_0x3a0736[_0x23a97f]={'$like':'%'+_0x152304[_0xf697('0x45')][_0xf697('0x51')]+'%'};return _0x3a0736;})});}_0xbef280=_[_0xf697('0x4e')]({},_0xbef280,_0x152304[_0xf697('0x57')]);return db['Disposition'][_0xf697('0x2e')]({'where':_0xbef280['where']})[_0xf697('0x1d')](function(_0x5f2763){_0x4d3f9a[_0xf697('0x2e')]=_0x5f2763;if(_0x152304[_0xf697('0x45')][_0xf697('0x52')]){_0xbef280[_0xf697('0x53')]=[{'all':!![]}];}return db[_0xf697('0x63')][_0xf697('0x54')](_0xbef280);})[_0xf697('0x1d')](function(_0x343f50){_0x4d3f9a[_0xf697('0x65')]=_0x343f50;return _0x4d3f9a;});}})['then'](respondWithFilteredResult(_0xbab0f3,_0xbef280))[_0xf697('0x27')](handleError(_0xbab0f3,null));};exports[_0xf697('0x66')]=function(_0x2aeaa6,_0xc196e4,_0x218e44){return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x2aeaa6[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0xc196e4,null))[_0xf697('0x1d')](function(_0x5a9311){if(_0x5a9311){return _0x5a9311[_0xf697('0x66')](_0x2aeaa6[_0xf697('0x45')][_0xf697('0x67')]);}})[_0xf697('0x1d')](respondWithStatusCode(_0xc196e4,null))[_0xf697('0x27')](handleError(_0xc196e4,null));};exports[_0xf697('0x68')]=function(_0x2e2afe,_0x5b22a1,_0x190a96){if(_0x2e2afe[_0xf697('0x5a')]['id']){delete _0x2e2afe[_0xf697('0x5a')]['id'];}return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x2e2afe['params']['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x5b22a1,null))[_0xf697('0x1d')](function(_0x453efb){if(_0x453efb){_0x2e2afe[_0xf697('0x5a')][_0xf697('0x62')]=_0x453efb['id'];return db[_0xf697('0x69')][_0xf697('0x59')](_0x2e2afe['body']);}})[_0xf697('0x1d')](respondWithResult(_0x5b22a1,null))[_0xf697('0x27')](handleError(_0x5b22a1,null));};exports[_0xf697('0x6a')]=function(_0x37a5a5,_0x1cba6c,_0x1fc00a){var _0x428261={'raw':![],'where':{}};var _0x5b99d7={};var _0xbf2caf={'count':0x0,'rows':[]};return db['FaxAccount'][_0xf697('0x6b')]({'where':{'id':_0x37a5a5[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x1cba6c,null))['then'](function(_0x190108){if(_0x190108){_0x5b99d7[_0xf697('0x41')]=_['keys'](db[_0xf697('0x69')]['rawAttributes']);_0x5b99d7[_0xf697('0x45')]=_[_0xf697('0x42')](_0x37a5a5['query']);_0x5b99d7[_0xf697('0x43')]=_[_0xf697('0x44')](_0x5b99d7[_0xf697('0x41')],_0x5b99d7[_0xf697('0x45')]);_0x428261[_0xf697('0x46')]=_[_0xf697('0x44')](_0x5b99d7['model'],qs[_0xf697('0x47')](_0x37a5a5[_0xf697('0x45')][_0xf697('0x47')]));_0x428261[_0xf697('0x46')]=_0x428261[_0xf697('0x46')][_0xf697('0x48')]?_0x428261['attributes']:_0x5b99d7[_0xf697('0x41')];if(!_0x37a5a5[_0xf697('0x45')][_0xf697('0x6c')](_0xf697('0x49'))){_0x428261[_0xf697('0x2f')]=qs['limit'](_0x37a5a5['query'][_0xf697('0x2f')]);_0x428261[_0xf697('0x2c')]=qs[_0xf697('0x2c')](_0x37a5a5['query'][_0xf697('0x2c')]);}_0x428261[_0xf697('0x4a')]=qs['sort'](_0x37a5a5[_0xf697('0x45')]['sort']);_0x428261[_0xf697('0x4d')]=qs[_0xf697('0x43')](_[_0xf697('0x4c')](_0x37a5a5[_0xf697('0x45')],_0x5b99d7[_0xf697('0x43')]));_0x428261[_0xf697('0x4d')][_0xf697('0x62')]=_0x190108['id'];if(_0x37a5a5[_0xf697('0x45')][_0xf697('0x51')]){_0x428261[_0xf697('0x4d')]=_['merge'](_0x428261[_0xf697('0x4d')],{'$or':_[_0xf697('0x3c')](_0x428261[_0xf697('0x46')],function(_0x18eb0f){var _0x4206c6={};_0x4206c6[_0x18eb0f]={'$like':'%'+_0x37a5a5['query']['filter']+'%'};return _0x4206c6;})});}_0x428261=_['merge']({},_0x428261,_0x37a5a5[_0xf697('0x57')]);return db[_0xf697('0x69')][_0xf697('0x2e')]({'where':_0x428261[_0xf697('0x4d')]})[_0xf697('0x1d')](function(_0x517d01){_0xbf2caf[_0xf697('0x2e')]=_0x517d01;if(_0x37a5a5[_0xf697('0x45')][_0xf697('0x52')]){_0x428261[_0xf697('0x53')]=[{'all':!![]}];}return db[_0xf697('0x69')]['findAll'](_0x428261);})['then'](function(_0x2e06e1){_0xbf2caf[_0xf697('0x65')]=_0x2e06e1;return _0xbf2caf;});}})['then'](respondWithFilteredResult(_0x1cba6c,_0x428261))[_0xf697('0x27')](handleError(_0x1cba6c,null));};exports[_0xf697('0x6d')]=function(_0x12055f,_0x3516ea,_0x134041){return db['FaxAccount'][_0xf697('0x58')]({'where':{'id':_0x12055f[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x3516ea,null))['then'](function(_0x38c8ac){if(_0x38c8ac){return _0x38c8ac[_0xf697('0x6d')](_0x12055f[_0xf697('0x45')][_0xf697('0x67')]);}})['then'](respondWithStatusCode(_0x3516ea,null))[_0xf697('0x27')](handleError(_0x3516ea,null));};exports[_0xf697('0x6e')]=function(_0x168609,_0x455a0c,_0x2f5f14){return db[_0xf697('0x6f')][_0xf697('0x58')]({'where':{'id':_0x168609[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x455a0c,null))[_0xf697('0x1d')](function(_0x4b334d){if(_0x4b334d){return _0x4b334d[_0xf697('0x6e')](_0x168609[_0xf697('0x5a')][_0xf697('0x67')],_[_0xf697('0x70')](_0x168609['body'],[_0xf697('0x67'),'id'])||{});}})[_0xf697('0x1d')](respondWithResult(_0x455a0c,null))['catch'](handleError(_0x455a0c,null));};exports[_0xf697('0x71')]=function(_0x443b7d,_0x8255c3,_0x48a1d1){var _0x5970dc={'raw':![],'where':{}};var _0x4bdce4={};var _0xdbbb61={'count':0x0,'rows':[]};return db[_0xf697('0x3d')][_0xf697('0x6b')]({'where':{'id':_0x443b7d['params']['id']}})['then'](handleEntityNotFound(_0x8255c3,null))['then'](function(_0x26b023){if(_0x26b023){_0x4bdce4[_0xf697('0x41')]=_['keys'](db['FaxInteraction'][_0xf697('0x3e')]);_0x4bdce4[_0xf697('0x45')]=_[_0xf697('0x42')](_0x443b7d[_0xf697('0x45')]);_0x4bdce4[_0xf697('0x43')]=_[_0xf697('0x44')](_0x4bdce4[_0xf697('0x41')],_0x4bdce4[_0xf697('0x45')]);_0x5970dc[_0xf697('0x46')]=_[_0xf697('0x44')](_0x4bdce4[_0xf697('0x41')],qs[_0xf697('0x47')](_0x443b7d['query'][_0xf697('0x47')]));_0x5970dc[_0xf697('0x46')]=_0x5970dc[_0xf697('0x46')][_0xf697('0x48')]?_0x5970dc[_0xf697('0x46')]:_0x4bdce4[_0xf697('0x41')];if(!_0x443b7d['query']['hasOwnProperty'](_0xf697('0x49'))){_0x5970dc['limit']=qs[_0xf697('0x2f')](_0x443b7d[_0xf697('0x45')]['limit']);_0x5970dc['offset']=qs[_0xf697('0x2c')](_0x443b7d[_0xf697('0x45')][_0xf697('0x2c')]);}_0x5970dc[_0xf697('0x4a')]=qs[_0xf697('0x4b')](_0x443b7d[_0xf697('0x45')][_0xf697('0x4b')]);_0x5970dc[_0xf697('0x4d')]=qs[_0xf697('0x43')](_['pick'](_0x443b7d[_0xf697('0x45')],_0x4bdce4[_0xf697('0x43')]));_0x5970dc[_0xf697('0x4d')][_0xf697('0x62')]=_0x26b023['id'];if(_0x443b7d['query'][_0xf697('0x51')]){_0x5970dc[_0xf697('0x4d')]=_[_0xf697('0x4e')](_0x5970dc[_0xf697('0x4d')],{'$or':_['map'](_0x5970dc[_0xf697('0x46')],function(_0x1905a5){var _0x541c0f={};_0x541c0f[_0x1905a5]={'$like':'%'+_0x443b7d[_0xf697('0x45')]['filter']+'%'};return _0x541c0f;})});}_0x5970dc=_[_0xf697('0x4e')]({},_0x5970dc,_0x443b7d[_0xf697('0x57')]);return db['FaxInteraction'][_0xf697('0x2e')]({'where':_0x5970dc[_0xf697('0x4d')]})[_0xf697('0x1d')](function(_0x52d91e){_0xdbbb61[_0xf697('0x2e')]=_0x52d91e;if(_0x443b7d['query'][_0xf697('0x52')]){_0x5970dc['include']=[{'model':db[_0xf697('0x72')],'as':_0xf697('0x73'),'required':![]},{'model':db[_0xf697('0x74')],'as':'Owner','attributes':[_0xf697('0x38'),'fullname',_0xf697('0x75')],'required':![]},{'model':db[_0xf697('0x76')],'as':_0xf697('0x77'),'attributes':['id','name',_0xf697('0x78')],'where':_0x443b7d[_0xf697('0x45')][_0xf697('0x79')]?{'id':_0x443b7d[_0xf697('0x45')][_0xf697('0x79')]}:undefined,'required':_0x443b7d['query'][_0xf697('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xf697('0x54')](_0x5970dc);})[_0xf697('0x1d')](function(_0x680ee6){_0xdbbb61[_0xf697('0x65')]=_0x680ee6;return _0xdbbb61;});}})[_0xf697('0x1d')](respondWithFilteredResult(_0x8255c3,_0x5970dc))[_0xf697('0x27')](handleError(_0x8255c3,null));};exports[_0xf697('0x7a')]=function(_0xb4861b,_0x581a27){var _0x20d380=_0xb4861b[_0xf697('0x56')]['id'];var _0x371bbb=_0xb4861b[_0xf697('0x5a')];var _0x27fd53=0xc8;var _0x2cf5f3=null;return db['sequelize'][_0xf697('0x7b')]({'isolationLevel':db[_0xf697('0x7c')][_0xf697('0x7d')]['ISOLATION_LEVELS'][_0xf697('0x7e')]},function(_0x4976c5){return db[_0xf697('0x3d')][_0xf697('0x6b')]({'where':{'id':_0x20d380},'transaction':_0x4976c5})[_0xf697('0x1d')](function(_0x1193ba){if(_0x1193ba){return db['FaxApplication'][_0xf697('0x36')]({'where':{'FaxAccountId':_0x20d380},'transaction':_0x4976c5})['then'](function(){var _0xc1d8f0=_['map'](_0x371bbb,function(_0x1dcc11){_0x1dcc11[_0xf697('0x62')]=_0x20d380;return _0x1dcc11;});return db[_0xf697('0x7f')][_0xf697('0x80')](_0xc1d8f0,{'transaction':_0x4976c5});});}else{_0x27fd53=0x194;_0x2cf5f3=[];}});})[_0xf697('0x1d')](function(){if(_0x27fd53!==0x194){return db[_0xf697('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x20d380},'order':_0xf697('0x81')})[_0xf697('0x1d')](function(_0x558407){_0x2cf5f3=_0x558407;});}})[_0xf697('0x27')](function(_0x40df7e){_0x27fd53=0x1f4;logger[_0xf697('0x22')](_0x40df7e[_0xf697('0x37')]);if(_0x40df7e[_0xf697('0x38')]){delete _0x40df7e['name'];}_0x2cf5f3=_0x40df7e;})[_0xf697('0x82')](function(){if(_0x2cf5f3===null){_0x581a27[_0xf697('0x28')](_0x27fd53);}else{if(_0x27fd53===0x1f4){_0x581a27[_0xf697('0x29')](_0x27fd53)[_0xf697('0x39')](_0x2cf5f3);}else{_0x581a27[_0xf697('0x29')](_0x27fd53)[_0xf697('0x2b')](_0x2cf5f3);}}});};exports[_0xf697('0x83')]=function(_0x4a8330,_0x36433a,_0x120e3c){var _0x2c33ba={};var _0x338172={};var _0x3e3163;var _0x231cea;return db['FaxAccount'][_0xf697('0x6b')]({'where':{'id':_0x4a8330['params']['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x36433a,null))['then'](function(_0x4381b2){if(_0x4381b2){_0x3e3163=_0x4381b2;_0x338172[_0xf697('0x41')]=_[_0xf697('0x42')](db['FaxApplication'][_0xf697('0x3e')]);_0x338172[_0xf697('0x45')]=_['keys'](_0x4a8330['query']);_0x338172[_0xf697('0x43')]=_['intersection'](_0x338172[_0xf697('0x41')],_0x338172[_0xf697('0x45')]);_0x2c33ba[_0xf697('0x46')]=_[_0xf697('0x44')](_0x338172[_0xf697('0x41')],qs[_0xf697('0x47')](_0x4a8330[_0xf697('0x45')][_0xf697('0x47')]));_0x2c33ba[_0xf697('0x46')]=_0x2c33ba[_0xf697('0x46')][_0xf697('0x48')]?_0x2c33ba['attributes']:_0x338172[_0xf697('0x41')];_0x2c33ba[_0xf697('0x4a')]=qs['sort'](_0x4a8330[_0xf697('0x45')][_0xf697('0x4b')]);_0x2c33ba[_0xf697('0x4d')]=qs[_0xf697('0x43')](_['pick'](_0x4a8330[_0xf697('0x45')],_0x338172[_0xf697('0x43')]));if(_0x4a8330['query']['filter']){_0x2c33ba[_0xf697('0x4d')]=_[_0xf697('0x4e')](_0x2c33ba[_0xf697('0x4d')],{'$or':_[_0xf697('0x3c')](_0x2c33ba[_0xf697('0x46')],function(_0x270c71){var _0x1128cd={};_0x1128cd[_0x270c71]={'$like':'%'+_0x4a8330[_0xf697('0x45')][_0xf697('0x51')]+'%'};return _0x1128cd;})});}_0x2c33ba=_[_0xf697('0x4e')]({},_0x2c33ba,_0x4a8330['options']);return _0x3e3163[_0xf697('0x83')](_0x2c33ba);}})[_0xf697('0x1d')](function(_0x5c4f55){if(_0x5c4f55){_0x231cea=_0x5c4f55[_0xf697('0x48')];if(!_0x4a8330['query'][_0xf697('0x6c')](_0xf697('0x49'))){_0x2c33ba[_0xf697('0x2f')]=qs[_0xf697('0x2f')](_0x4a8330[_0xf697('0x45')][_0xf697('0x2f')]);_0x2c33ba[_0xf697('0x2c')]=qs['offset'](_0x4a8330[_0xf697('0x45')][_0xf697('0x2c')]);}return _0x3e3163[_0xf697('0x83')](_0x2c33ba);}})[_0xf697('0x1d')](function(_0x45a3e6){if(_0x45a3e6){return _0x45a3e6?{'count':_0x231cea,'rows':_0x45a3e6}:null;}})['then'](respondWithResult(_0x36433a,null))[_0xf697('0x27')](handleError(_0x36433a,null));};function Extension(_0x5f2f77,_0x34d4b1,_0x138b11,_0x454831){this[_0xf697('0x84')]=_0xf697('0x85');this[_0xf697('0x86')]=_0x5f2f77[_0xf697('0x87')];this[_0xf697('0x88')]=_0x454831;this['type']=_0xf697('0x89');this[_0xf697('0x8a')]=_0xf697('0x8b');this[_0xf697('0x62')]=_0x5f2f77['id'];this[_0xf697('0x81')]=_0x34d4b1;this['appdata']=_0x138b11;}function createExtensionsReciveFax(_0xce007d){var _0x5af445=0x1;var _0x1822a4=[];_0x1822a4[_0xf697('0x8c')](new Extension(_0xce007d,_0x5af445,'',_0xf697('0x8d')));_0x5af445+=0x1;_0x1822a4['push'](new Extension(_0xce007d,_0x5af445,'CDR(type)=inbound-fax',_0xf697('0x8e')));_0x5af445+=0x1;for(var _0x322714 in _0xce007d){if(_0xce007d[_0xf697('0x6c')](_0x322714)&&(_0x322714==='ecm'||_0x322714===_0xf697('0x87')||_0x322714==='gateway'||_0x322714===_0xf697('0x8f')||_0x322714===_0xf697('0x90')||_0x322714==='maxrate'||_0x322714===_0xf697('0x91')||_0x322714==='modem'||_0x322714===_0xf697('0x92'))){_0x1822a4[_0xf697('0x8c')](new Extension(_0xce007d,_0x5af445,_0xf697('0x93')+_0x322714+')='+_0xce007d[_0x322714],_0xf697('0x8e')));_0x5af445+=0x1;}}_0x1822a4[_0xf697('0x8c')](new Extension(_0xce007d,_0x5af445,'6',_0xf697('0x94')));_0x5af445+=0x1;_0x1822a4['push'](new Extension(_0xce007d,_0x5af445,_0xf697('0x95'),_0xf697('0x96')));_0x5af445=0x0;return _0x1822a4;}exports['addAccountApplications']=function(_0xc63ba1,_0x5e318b,_0x115bf9){var _0x37c05f;return db[_0xf697('0x7c')][_0xf697('0x7b')](function(_0x33d58b){return db[_0xf697('0x3d')]['create'](_0xc63ba1['body'],{'transaction':_0x33d58b})[_0xf697('0x1d')](function(_0x4dff66){_0x37c05f=_0x4dff66[_0xf697('0x35')]({'plain':!![]});return db['VoiceExtension'][_0xf697('0x80')](createExtensionsReciveFax(_0x37c05f),{'transaction':_0x33d58b});});})[_0xf697('0x1d')](function(){return _0x37c05f;})[_0xf697('0x1d')](respondWithResult(_0x5e318b,null))[_0xf697('0x27')](handleError(_0x5e318b,null));};exports[_0xf697('0x97')]=function(_0x388a0d,_0x30a7d6,_0x59bf3b){var _0x55539b;return db[_0xf697('0x7c')][_0xf697('0x7b')](function(_0x1306db){return db[_0xf697('0x3d')][_0xf697('0x34')](_0x388a0d[_0xf697('0x5a')],{'where':{'id':_0x388a0d[_0xf697('0x5a')]['id']},'transaction':_0x1306db})[_0xf697('0x1d')](function(_0x490c88){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x388a0d[_0xf697('0x5a')]['id']},'transaction':_0x1306db})['then'](function(_0x151385){return db[_0xf697('0x98')][_0xf697('0x80')](createExtensionsReciveFax(_[_0xf697('0x70')](_0x388a0d[_0xf697('0x5a')],['tech',_0xf697('0x40'),'createdAt',_0xf697('0x99'),_0xf697('0x9a'),_0xf697('0x9b')])),{'transaction':_0x1306db});});});})['then'](function(){return db[_0xf697('0x3d')][_0xf697('0x9c')](_0x388a0d[_0xf697('0x5a')]['id']);})['then'](respondWithResult(_0x30a7d6,null))['catch'](handleError(_0x30a7d6,null));};exports['getMessages']=function(_0x16f1e5,_0x25b0d5,_0x4b11ed){var _0x213ba7={'raw':!![],'where':{}};var _0x5d2fbb={};var _0x5ca29f={'count':0x0,'rows':[]};return db[_0xf697('0x3d')]['findOne']({'where':{'id':_0x16f1e5[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x25b0d5,null))[_0xf697('0x1d')](function(_0x18c85e){if(_0x18c85e){_0x5d2fbb[_0xf697('0x41')]=_[_0xf697('0x42')](db['FaxMessage'][_0xf697('0x3e')]);_0x5d2fbb[_0xf697('0x45')]=_[_0xf697('0x42')](_0x16f1e5[_0xf697('0x45')]);_0x5d2fbb['filters']=_[_0xf697('0x44')](_0x5d2fbb[_0xf697('0x41')],_0x5d2fbb[_0xf697('0x45')]);_0x213ba7['attributes']=_[_0xf697('0x44')](_0x5d2fbb[_0xf697('0x41')],qs[_0xf697('0x47')](_0x16f1e5[_0xf697('0x45')]['fields']));_0x213ba7[_0xf697('0x46')]=_0x213ba7['attributes']['length']?_0x213ba7[_0xf697('0x46')]:_0x5d2fbb[_0xf697('0x41')];if(!_0x16f1e5[_0xf697('0x45')]['hasOwnProperty'](_0xf697('0x49'))){_0x213ba7[_0xf697('0x2f')]=qs[_0xf697('0x2f')](_0x16f1e5['query'][_0xf697('0x2f')]);_0x213ba7['offset']=qs[_0xf697('0x2c')](_0x16f1e5[_0xf697('0x45')][_0xf697('0x2c')]);}_0x213ba7[_0xf697('0x4a')]=qs[_0xf697('0x4b')](_0x16f1e5[_0xf697('0x45')][_0xf697('0x4b')]);_0x213ba7[_0xf697('0x4d')]=qs[_0xf697('0x43')](_[_0xf697('0x4c')](_0x16f1e5[_0xf697('0x45')],_0x5d2fbb['filters']));_0x213ba7['where']['FaxAccountId']=_0x18c85e['id'];if(_0x16f1e5[_0xf697('0x45')][_0xf697('0x51')]){_0x213ba7['where']=_[_0xf697('0x4e')](_0x213ba7[_0xf697('0x4d')],{'$or':_[_0xf697('0x3c')](_0x213ba7[_0xf697('0x46')],function(_0x276a2a){var _0x2e9381={};_0x2e9381[_0x276a2a]={'$like':'%'+_0x16f1e5[_0xf697('0x45')][_0xf697('0x51')]+'%'};return _0x2e9381;})});}if(_0x16f1e5[_0xf697('0x45')][_0xf697('0x9d')]){var _0x4dcf6f=_0x16f1e5[_0xf697('0x45')][_0xf697('0x9d')]['split'](',');var _0x421eb2={};_0x421eb2[_0x4dcf6f[0x0]]={'$gte':moment(_0x4dcf6f[0x1])[_0xf697('0x9e')](_0xf697('0x9f'))};_0x213ba7[_0xf697('0x4d')]=_[_0xf697('0x4e')](_0x213ba7[_0xf697('0x4d')],_0x421eb2);}_0x213ba7=_[_0xf697('0x4e')]({},_0x213ba7,_0x16f1e5[_0xf697('0x57')]);return db['FaxMessage'][_0xf697('0x2e')]({'where':_0x213ba7[_0xf697('0x4d')]})['then'](function(_0x4f25f6){_0x5ca29f[_0xf697('0x2e')]=_0x4f25f6;if(_0x16f1e5[_0xf697('0x45')][_0xf697('0x52')]){_0x213ba7[_0xf697('0x53')]=[{'all':!![]}];}return db[_0xf697('0xa0')]['findAll'](_0x213ba7);})['then'](function(_0x3ed07b){_0x5ca29f[_0xf697('0x65')]=_0x3ed07b;return _0x5ca29f;});}})[_0xf697('0x1d')](respondWithFilteredResult(_0x25b0d5,_0x213ba7))['catch'](handleError(_0x25b0d5,null));};exports[_0xf697('0x39')]=function(_0x2e3ba2,_0x2c7fe3,_0x5a89db){var _0x211077,_0x1f9085={},_0x549b0c;if(_0x2e3ba2[_0xf697('0x5a')]['to']){_0x549b0c=_0x2e3ba2[_0xf697('0x5a')]['to'][0x0];}return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x2e3ba2[_0xf697('0x56')]['id']},'include':[{'model':db[_0xf697('0xa1')],'as':_0xf697('0xa2'),'include':[{'model':db[_0xf697('0x72')],'as':'Contacts','where':{'fax':_0x549b0c},'limit':0x1,'order':[[_0xf697('0x99'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2c7fe3,null))[_0xf697('0x1d')](function(_0x27589b){_0x211077=_0x27589b;if(_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')]&&_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][_0xf697('0x48')]){for(var _0x52f74e=0x0;_0x52f74e<_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][_0xf697('0x48')];_0x52f74e+=0x1){_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][_0x52f74e]={'filename':_0x2e3ba2['body'][_0xf697('0xa3')][_0x52f74e]['name'],'id':_0x2e3ba2['body'][_0xf697('0xa3')][_0x52f74e]['id'],'path':path['join'](config[_0xf697('0xa4')],_0xf697('0xa5'),_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][_0x52f74e][_0xf697('0xa6')])};}}return respondWithRpcPromise(_0xf697('0xa7'),_0xf697('0xa7'),{'FaxAccountId':_[_0xf697('0xa8')](_0x2e3ba2[_0xf697('0x56')]['id'])?undefined:_0x2e3ba2['params']['id'],'path':_[_0xf697('0xa8')](_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0]['path'])?undefined:_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0][_0xf697('0xa9')],'fax':_['isNil'](_0x2e3ba2['body']['to'][0x0])?undefined:_0x2e3ba2[_0xf697('0x5a')]['to'][0x0]},client9002);})[_0xf697('0x1d')](function(){if(_0x211077){if(_[_0xf697('0xa8')](_0x2e3ba2['body'][_0xf697('0xaa')])){_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xaa')]=util[_0xf697('0x9e')](_0xf697('0xab'),_0x211077[_0xf697('0x38')],_0x211077[_0xf697('0xac')]);}if(_0x211077[_0xf697('0xa2')]){if(_0x211077['List'][_0xf697('0xad')]['length']){return _0x211077['List'][_0xf697('0xad')][0x0];}else{return db['CmContact']['create'](_[_0xf697('0xae')](_0x2e3ba2[_0xf697('0x5a')],{'firstName':_0x2e3ba2[_0xf697('0x5a')]['to'][0x0],'phone':_0x2e3ba2[_0xf697('0x5a')]['to'][0x0],'fax':_0x2e3ba2[_0xf697('0x5a')]['to'][0x0],'ListId':_0x211077[_0xf697('0x9b')]}));}}else{throw new Error(_0xf697('0xaf'));}}else{throw new Error(_0xf697('0xb0'));}})[_0xf697('0x1d')](function(_0x211208){if(_0x211208){return db['FaxInteraction'][_0xf697('0x58')]({'where':{'ContactId':_0x211208['id'],'closed':![],'FaxAccountId':_0x211077['id']}})[_0xf697('0x1d')](function(_0x40a005){if(_0x40a005){return[_0x40a005,![]];}return db['FaxInteraction']['create']({'UserId':_0x2e3ba2[_0xf697('0x5b')]['id'],'ContactId':_0x211208['id'],'FaxAccountId':_0x211077['id'],'fax':_0x2e3ba2[_0xf697('0x5a')]['to'][0x0],'firstMsgDirection':_0xf697('0xb1'),'Messages':[_['merge'](_0x2e3ba2['body'],{'read':![],'body':_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0][_0xf697('0xb2')],'FaxAccountId':_0x211077['id'],'UserId':_0x2e3ba2['user']['id'],'ContactId':_0x211208['id'],'AttachmentId':_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0xf697('0xa0')],'as':_0xf697('0xb3')}]})[_0xf697('0x1d')](function(_0x13f3b1){return[_0x13f3b1,!![]];});});}else{throw new Error(_0xf697('0xb4'));}})[_0xf697('0xb5')](function(_0x399fa0,_0x5ef56b){if(_0x5ef56b){return _0x399fa0;}return db[_0xf697('0xa0')]['create']({'direction':_0xf697('0xb1'),'read':![],'body':_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0][_0xf697('0xb2')],'FaxAccountId':_0x211077['id'],'FaxInteractionId':_0x399fa0['id'],'UserId':_0x2e3ba2[_0xf697('0x5b')]['id'],'ContactId':_0x399fa0[_0xf697('0xb6')],'AttachmentId':_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0]['id']})['then'](function(_0x205173){_0x399fa0[_0xf697('0xb7')][_0xf697('0xb3')]=[];_0x399fa0[_0xf697('0xb7')][_0xf697('0xb3')][_0xf697('0x8c')](_0x205173['dataValues']);return _0x399fa0;});})[_0xf697('0x1d')](function(_0x3af2e8){respondWithRpcPromise(_0xf697('0xb8'),_0xf697('0xb8'),{'FaxAccountId':_[_0xf697('0xa8')](_0x2e3ba2[_0xf697('0x56')]['id'])?undefined:_0x2e3ba2['params']['id'],'path':_['isNil'](_0x2e3ba2[_0xf697('0x5a')]['attachments'][0x0][_0xf697('0xa9')])?undefined:_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0][_0xf697('0xa9')],'fax':_[_0xf697('0xa8')](_0x2e3ba2['body']['to'][0x0])?undefined:_0x2e3ba2['body']['to'][0x0],'AttachmentId':_0x2e3ba2[_0xf697('0x5a')][_0xf697('0xa3')][0x0]['id']},client9002)[_0xf697('0x1d')](function(_0xb3b582){logger[_0xf697('0x25')]('SendFaxRpc,\x20%s',_0xb3b582);})[_0xf697('0x27')](function(_0x520048){logger[_0xf697('0x25')]('SendFaxRpc,\x20%s',_0x520048);});return _0x3af2e8;})['then'](respondWithResult(_0x2c7fe3,null))[_0xf697('0x27')](handleError(_0x2c7fe3,null));};exports[_0xf697('0xb9')]=function(_0x32405e,_0x781f28,_0x4078c0){return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x32405e[_0xf697('0x56')]['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x781f28,null))[_0xf697('0x1d')](function(_0x5a5f05){if(_0x5a5f05){return _0x5a5f05[_0xf697('0xb9')](_0x32405e[_0xf697('0x5a')][_0xf697('0x67')],_[_0xf697('0x70')](_0x32405e['body'],[_0xf697('0x67'),'id'])||{})[_0xf697('0xb5')](function(_0x772272){for(var _0x222a2b=0x0;_0x222a2b<_0x32405e['body'][_0xf697('0x67')][_0xf697('0x48')];_0x222a2b+=0x1){socket[_0xf697('0xba')](_0xf697('0xbb'),{'UserId':Number(_0x32405e['body'][_0xf697('0x67')][_0x222a2b]),'FaxAccountId':Number(_0x32405e[_0xf697('0x56')]['id'])});}return _0x772272;});}})['then'](respondWithResult(_0x781f28,null))[_0xf697('0x27')](handleError(_0x781f28,null));};exports[_0xf697('0xbc')]=function(_0x56862c,_0x36397c,_0x15cadc){return db[_0xf697('0x3d')][_0xf697('0x58')]({'where':{'id':_0x56862c['params']['id']}})[_0xf697('0x1d')](handleEntityNotFound(_0x36397c,null))['then'](function(_0x4ae1b9){if(_0x4ae1b9){return _0x4ae1b9[_0xf697('0xbc')](_0x56862c[_0xf697('0x45')][_0xf697('0x67')])[_0xf697('0x1d')](function(){if(_[_0xf697('0xbd')](_0x56862c[_0xf697('0x45')][_0xf697('0x67')])){for(var _0x1822ab=0x0;_0x1822ab<_0x56862c[_0xf697('0x45')]['ids'][_0xf697('0x48')];_0x1822ab+=0x1){socket[_0xf697('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x56862c['query']['ids'][_0x1822ab]),'FaxAccountId':Number(_0x56862c['params']['id'])});}}else{socket[_0xf697('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x56862c[_0xf697('0x45')][_0xf697('0x67')]),'FaxAccountId':Number(_0x56862c[_0xf697('0x56')]['id'])});}});}})[_0xf697('0x1d')](respondWithStatusCode(_0x36397c,null))[_0xf697('0x27')](handleError(_0x36397c,null));};exports['getAgents']=function(_0x1a9819,_0x12dca9,_0x4014d7){var _0x368f46={};var _0x40310d={};var _0x20f898;var _0x571835;return db[_0xf697('0x3d')][_0xf697('0x6b')]({'where':{'id':_0x1a9819[_0xf697('0x56')]['id']}})['then'](handleEntityNotFound(_0x12dca9,null))[_0xf697('0x1d')](function(_0x156fb5){if(_0x156fb5){_0x20f898=_0x156fb5;_0x40310d[_0xf697('0x41')]=_[_0xf697('0x42')](db['User'][_0xf697('0x3e')]);_0x40310d[_0xf697('0x45')]=_[_0xf697('0x42')](_0x1a9819['query']);_0x40310d['filters']=_[_0xf697('0x44')](_0x40310d[_0xf697('0x41')],_0x40310d[_0xf697('0x45')]);_0x368f46[_0xf697('0x46')]=_[_0xf697('0x44')](_0x40310d['model'],qs['fields'](_0x1a9819[_0xf697('0x45')][_0xf697('0x47')]));_0x368f46['attributes']=_0x368f46[_0xf697('0x46')]['length']?_0x368f46[_0xf697('0x46')]:_0x40310d[_0xf697('0x41')];_0x368f46[_0xf697('0x4a')]=qs['sort'](_0x1a9819[_0xf697('0x45')]['sort']);_0x368f46[_0xf697('0x4d')]=qs['filters'](_[_0xf697('0x4c')](_0x1a9819[_0xf697('0x45')],_0x40310d[_0xf697('0x43')]));if(_0x1a9819['query'][_0xf697('0x51')]){_0x368f46[_0xf697('0x4d')]=_['merge'](_0x368f46[_0xf697('0x4d')],{'$or':_['map'](_0x368f46[_0xf697('0x46')],function(_0xcf3226){var _0x5233c3={};_0x5233c3[_0xcf3226]={'$like':'%'+_0x1a9819[_0xf697('0x45')][_0xf697('0x51')]+'%'};return _0x5233c3;})});}_0x368f46=_[_0xf697('0x4e')]({},_0x368f46,_0x1a9819[_0xf697('0x57')]);return _0x20f898[_0xf697('0xbe')](_0x368f46);}})[_0xf697('0x1d')](function(_0xf18c3d){if(_0xf18c3d){_0x571835=_0xf18c3d['length'];if(!_0x1a9819[_0xf697('0x45')][_0xf697('0x6c')]('nolimit')){_0x368f46['limit']=qs[_0xf697('0x2f')](_0x1a9819[_0xf697('0x45')][_0xf697('0x2f')]);_0x368f46[_0xf697('0x2c')]=qs[_0xf697('0x2c')](_0x1a9819[_0xf697('0x45')][_0xf697('0x2c')]);}return _0x20f898[_0xf697('0xbe')](_0x368f46);}})[_0xf697('0x1d')](function(_0x1831ab){if(_0x1831ab){return _0x1831ab?{'count':_0x571835,'rows':_0x1831ab}:null;}})['then'](respondWithResult(_0x12dca9,null))[_0xf697('0x27')](handleError(_0x12dca9,null));}; \ No newline at end of file +var _0xcb9b=['CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','transaction','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename'];(function(_0x5d8048,_0x445203){var _0x3affba=function(_0x5e65c4){while(--_0x5e65c4){_0x5d8048['push'](_0x5d8048['shift']());}};_0x3affba(++_0x445203);}(_0xcb9b,0xd9));var _0xbcb9=function(_0x376226,_0x430f59){_0x376226=_0x376226-0x0;var _0x51fa58=_0xcb9b[_0x376226];return _0x51fa58;};'use strict';var emlformat=require(_0xbcb9('0x0'));var rimraf=require(_0xbcb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcb9('0x2'));var rp=require('request-promise');var moment=require(_0xbcb9('0x3'));var BPromise=require(_0xbcb9('0x4'));var Mustache=require(_0xbcb9('0x5'));var util=require(_0xbcb9('0x6'));var path=require(_0xbcb9('0x7'));var sox=require(_0xbcb9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbcb9('0x9'));var _=require(_0xbcb9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbcb9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbcb9('0xc'));var Papa=require(_0xbcb9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcb9('0xe'));var hardwareService=require(_0xbcb9('0xf'));var logger=require(_0xbcb9('0x10'))(_0xbcb9('0x11'));var utils=require(_0xbcb9('0x12'));var config=require(_0xbcb9('0x13'));var licenseUtil=require(_0xbcb9('0x14'));var db=require(_0xbcb9('0x15'))['db'];config['redis']=_[_0xbcb9('0x16')](config[_0xbcb9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcb9('0x18'))(new Redis(config[_0xbcb9('0x17')]));require(_0xbcb9('0x19'))[_0xbcb9('0x1a')](socket);var jayson=require(_0xbcb9('0x1b'));var client=jayson[_0xbcb9('0x1c')][_0xbcb9('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xbcb9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x21cfbc,_0x2e57f5,_0x455e1a,_0x3a74b1){return new BPromise(function(_0x50d758,_0xeb330f){var _0x3006ac=_0x3a74b1||client;return _0x3006ac[_0xbcb9('0x1e')](_0x21cfbc,_0x455e1a)['then'](function(_0x1d7c90){logger[_0xbcb9('0x1f')](_0xbcb9('0x20'),_0x2e57f5,_0xbcb9('0x21'));logger['debug'](_0xbcb9('0x22'),_0x2e57f5,_0xbcb9('0x21'),JSON[_0xbcb9('0x23')](_0x1d7c90));if(_0x1d7c90[_0xbcb9('0x24')]){if(_0x1d7c90['error'][_0xbcb9('0x25')]===0x1f4){logger[_0xbcb9('0x24')](_0xbcb9('0x20'),_0x2e57f5,_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);return _0xeb330f(_0x1d7c90['error'][_0xbcb9('0x26')]);}logger['error'](_0xbcb9('0x20'),_0x2e57f5,_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);return _0x50d758(_0x1d7c90[_0xbcb9('0x24')][_0xbcb9('0x26')]);}else{logger[_0xbcb9('0x1f')](_0xbcb9('0x20'),_0x2e57f5,'request\x20sent');_0x50d758(_0x1d7c90[_0xbcb9('0x27')][_0xbcb9('0x26')]);}})[_0xbcb9('0x28')](function(_0x114135){logger[_0xbcb9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x2e57f5,_0x114135);_0xeb330f(_0x114135);});});}function respondWithStatusCode(_0x242acd,_0x3bdf4b){_0x3bdf4b=_0x3bdf4b||0xcc;return function(_0x1408e9){if(_0x1408e9){return _0x242acd[_0xbcb9('0x29')](_0x3bdf4b);}return _0x242acd[_0xbcb9('0x2a')](_0x3bdf4b)[_0xbcb9('0x2b')]();};}function respondWithResult(_0x449f14,_0x27a01f){_0x27a01f=_0x27a01f||0xc8;return function(_0x14c4e5){if(_0x14c4e5){return _0x449f14[_0xbcb9('0x2a')](_0x27a01f)[_0xbcb9('0x2c')](_0x14c4e5);}};}function respondWithFilteredResult(_0x9da09d,_0x39033e){return function(_0x3b2fb7){if(_0x3b2fb7){var _0xe33497=typeof _0x39033e['offset']===_0xbcb9('0x2d')&&typeof _0x39033e[_0xbcb9('0x2e')]===_0xbcb9('0x2d');var _0x449c0a=_0x3b2fb7[_0xbcb9('0x2f')];var _0x2e99d4=_0xe33497?0x0:_0x39033e[_0xbcb9('0x30')];var _0x9b0e0d=_0xe33497?_0x3b2fb7['count']:_0x39033e[_0xbcb9('0x30')]+_0x39033e[_0xbcb9('0x2e')];var _0x176beb;if(_0x9b0e0d>=_0x449c0a){_0x9b0e0d=_0x449c0a;_0x176beb=0xc8;}else{_0x176beb=0xce;}_0x9da09d['status'](_0x176beb);return _0x9da09d['set'](_0xbcb9('0x31'),_0x2e99d4+'-'+_0x9b0e0d+'/'+_0x449c0a)[_0xbcb9('0x2c')](_0x3b2fb7);}return null;};}function patchUpdates(_0x1e576e){return function(_0x3df55a){try{jsonpatch[_0xbcb9('0x32')](_0x3df55a,_0x1e576e,!![]);}catch(_0xfd5283){return BPromise[_0xbcb9('0x33')](_0xfd5283);}return _0x3df55a[_0xbcb9('0x34')]();};}function saveUpdates(_0x37cca3,_0x14caf9){return function(_0x9e0f7c){if(_0x9e0f7c){return _0x9e0f7c['update'](_0x37cca3)[_0xbcb9('0x35')](function(_0x401161){return _0x401161;});}return null;};}function removeEntity(_0x2ceef6,_0x2948f1){return function(_0x12eea3){if(_0x12eea3){return _0x12eea3[_0xbcb9('0x36')]()[_0xbcb9('0x35')](function(){var _0x1bfada=_0x12eea3[_0xbcb9('0x37')]({'plain':!![]});var _0x2c36d5='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x2c36d5,'resourceId':_0x1bfada['id']}})[_0xbcb9('0x35')](function(){return _0x12eea3;});})[_0xbcb9('0x35')](function(){_0x2ceef6[_0xbcb9('0x2a')](0xcc)[_0xbcb9('0x2b')]();});}};}function handleEntityNotFound(_0x123f54,_0x10b13d){return function(_0x5eaf58){if(!_0x5eaf58){_0x123f54[_0xbcb9('0x29')](0x194);}return _0x5eaf58;};}function handleError(_0x573046,_0x15bf62){_0x15bf62=_0x15bf62||0x1f4;return function(_0x290dd8){logger[_0xbcb9('0x24')](_0x290dd8[_0xbcb9('0x38')]);if(_0x290dd8[_0xbcb9('0x39')]){delete _0x290dd8[_0xbcb9('0x39')];}_0x573046[_0xbcb9('0x2a')](_0x15bf62)[_0xbcb9('0x3a')](_0x290dd8);};}exports['index']=function(_0x310411,_0xea60b6){var _0x2bf4bc={'include':[{'model':db[_0xbcb9('0x3b')],'as':_0xbcb9('0x3c')}]},_0x36759a={},_0x979b16={'count':0x0,'rows':[]};var _0x16584c=_[_0xbcb9('0x3d')](db['FaxAccount'][_0xbcb9('0x3e')],function(_0x1127c5){return{'name':_0x1127c5[_0xbcb9('0x3f')],'type':_0x1127c5[_0xbcb9('0x40')][_0xbcb9('0x41')]};});_0x36759a[_0xbcb9('0x42')]=_['map'](_0x16584c,_0xbcb9('0x39'));_0x36759a[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x310411[_0xbcb9('0x43')]);_0x36759a[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x36759a['model'],_0x36759a[_0xbcb9('0x43')]);_0x2bf4bc[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x36759a[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x310411[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x2bf4bc[_0xbcb9('0x47')]=_0x2bf4bc[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x2bf4bc[_0xbcb9('0x47')]:_0x36759a[_0xbcb9('0x42')];if(!_0x310411[_0xbcb9('0x43')]['hasOwnProperty']('nolimit')){_0x2bf4bc[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x310411['query'][_0xbcb9('0x2e')]);_0x2bf4bc['offset']=qs[_0xbcb9('0x30')](_0x310411['query'][_0xbcb9('0x30')]);}_0x2bf4bc['order']=qs[_0xbcb9('0x4a')](_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x2bf4bc[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x310411['query'],_0x36759a[_0xbcb9('0x45')]),_0x16584c);if(_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x2bf4bc[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x2bf4bc['where'],{'$or':_[_0xbcb9('0x3d')](_0x16584c,function(_0x12656d){if(_0x12656d['type']!==_0xbcb9('0x4f')){var _0x176f55={};_0x176f55[_0x12656d[_0xbcb9('0x39')]]={'$like':'%'+_0x310411[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0x176f55;}})});}_0x2bf4bc=_[_0xbcb9('0x4e')]({},_0x2bf4bc,_0x310411[_0xbcb9('0x50')]);var _0x2d5a78={'where':_0x2bf4bc['where']};return db[_0xbcb9('0x51')][_0xbcb9('0x2f')](_0x2d5a78)[_0xbcb9('0x35')](function(_0x38312c){_0x979b16['count']=_0x38312c;if(_0x310411['query'][_0xbcb9('0x52')]){_0x2bf4bc[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0x51')][_0xbcb9('0x54')](_0x2bf4bc);})[_0xbcb9('0x35')](function(_0x145888){_0x979b16[_0xbcb9('0x55')]=_0x145888;return _0x979b16;})[_0xbcb9('0x35')](respondWithFilteredResult(_0xea60b6,_0x2bf4bc))[_0xbcb9('0x28')](handleError(_0xea60b6,null));};exports[_0xbcb9('0x56')]=function(_0x343244,_0x14b28d){var _0x578a3a={'raw':![],'where':{'id':_0x343244[_0xbcb9('0x57')]['id']},'include':[{'model':db[_0xbcb9('0x3b')],'as':'mandatoryDispositionPause'}]},_0x2a0535={};_0x2a0535[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db[_0xbcb9('0x51')]['rawAttributes']);_0x2a0535[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x343244[_0xbcb9('0x43')]);_0x2a0535[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x2a0535[_0xbcb9('0x42')],_0x2a0535['query']);_0x578a3a['attributes']=_[_0xbcb9('0x46')](_0x2a0535[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x343244[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x578a3a[_0xbcb9('0x47')]=_0x578a3a[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x578a3a[_0xbcb9('0x47')]:_0x2a0535[_0xbcb9('0x42')];if(_0x343244[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x578a3a[_0xbcb9('0x53')]=[{'all':!![]}];}_0x578a3a=_[_0xbcb9('0x4e')]({},_0x578a3a,_0x343244['options']);return db['FaxAccount'][_0xbcb9('0x58')](_0x578a3a)[_0xbcb9('0x35')](handleEntityNotFound(_0x14b28d,null))[_0xbcb9('0x35')](respondWithResult(_0x14b28d,null))[_0xbcb9('0x28')](handleError(_0x14b28d,null));};exports[_0xbcb9('0x59')]=function(_0x57d449,_0x341258){return db[_0xbcb9('0x51')][_0xbcb9('0x59')](_0x57d449[_0xbcb9('0x5a')],{})['then'](function(_0x319bb5){var _0xfba0fa=_0x57d449['user']['get']({'plain':!![]});if(!_0xfba0fa)throw new Error(_0xbcb9('0x5b'));if(_0xfba0fa['role']===_0xbcb9('0x5c')){var _0x389019=_0x319bb5[_0xbcb9('0x37')]({'plain':!![]});var _0x516d6e='FaxAccounts';return db[_0xbcb9('0x5d')][_0xbcb9('0x58')]({'where':{'name':_0x516d6e,'userProfileId':_0xfba0fa['userProfileId']},'raw':!![]})[_0xbcb9('0x35')](function(_0x195cc3){if(_0x195cc3&&_0x195cc3[_0xbcb9('0x5e')]===0x0){return db['UserProfileResource'][_0xbcb9('0x59')]({'name':_0x389019['name'],'resourceId':_0x389019['id'],'type':_0x195cc3[_0xbcb9('0x39')],'sectionId':_0x195cc3['id']},{})[_0xbcb9('0x35')](function(){return _0x319bb5;});}else{return _0x319bb5;}})[_0xbcb9('0x28')](function(_0x5503fd){logger[_0xbcb9('0x24')](_0xbcb9('0x5f'),_0x5503fd);throw _0x5503fd;});}return _0x319bb5;})[_0xbcb9('0x35')](respondWithResult(_0x341258,0xc9))[_0xbcb9('0x28')](handleError(_0x341258,null));};exports[_0xbcb9('0x60')]=function(_0x669408,_0x19a8a1){if(_0x669408[_0xbcb9('0x5a')]['id']){delete _0x669408[_0xbcb9('0x5a')]['id'];}return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x669408[_0xbcb9('0x57')]['id']},'include':[{'model':db[_0xbcb9('0x3b')],'as':_0xbcb9('0x3c')}]})['then'](handleEntityNotFound(_0x19a8a1,null))['then'](saveUpdates(_0x669408[_0xbcb9('0x5a')],null))['then'](respondWithResult(_0x19a8a1,null))['catch'](handleError(_0x19a8a1,null));};exports[_0xbcb9('0x36')]=function(_0x36b9fa,_0x19c69a){return db[_0xbcb9('0x51')]['find']({'where':{'id':_0x36b9fa[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x19c69a,null))[_0xbcb9('0x35')](removeEntity(_0x19c69a,null))[_0xbcb9('0x28')](handleError(_0x19c69a,null));};exports[_0xbcb9('0x61')]=function(_0xa39ae7,_0x5b05f4){return db[_0xbcb9('0x51')][_0xbcb9('0x61')]()['then'](respondWithResult(_0x5b05f4,null))[_0xbcb9('0x28')](handleError(_0x5b05f4,null));};exports[_0xbcb9('0x62')]=function(_0x1768e4,_0x222ec9,_0x4be4ce){if(_0x1768e4[_0xbcb9('0x5a')]['id']){delete _0x1768e4[_0xbcb9('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x1768e4['params']['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x222ec9,null))[_0xbcb9('0x35')](function(_0x23983d){if(_0x23983d){_0x1768e4[_0xbcb9('0x5a')][_0xbcb9('0x63')]=_0x23983d['id'];return db[_0xbcb9('0x64')][_0xbcb9('0x59')](_0x1768e4['body']);}})['then'](respondWithResult(_0x222ec9,null))[_0xbcb9('0x28')](handleError(_0x222ec9,null));};exports['getDispositions']=function(_0x266498,_0xffd3a0,_0x20c4d9){var _0x28b8b3={'raw':![],'where':{}};var _0x5d8ada={};var _0x1935c1={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x266498[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0xffd3a0,null))[_0xbcb9('0x35')](function(_0x30b105){if(_0x30b105){_0x5d8ada[_0xbcb9('0x42')]=_['keys'](db[_0xbcb9('0x64')]['rawAttributes']);_0x5d8ada['query']=_[_0xbcb9('0x44')](_0x266498[_0xbcb9('0x43')]);_0x5d8ada[_0xbcb9('0x45')]=_['intersection'](_0x5d8ada[_0xbcb9('0x42')],_0x5d8ada[_0xbcb9('0x43')]);_0x28b8b3[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x5d8ada[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x28b8b3[_0xbcb9('0x47')]=_0x28b8b3[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x28b8b3[_0xbcb9('0x47')]:_0x5d8ada['model'];if(!_0x266498[_0xbcb9('0x43')]['hasOwnProperty'](_0xbcb9('0x66'))){_0x28b8b3[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x28b8b3[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x266498['query']['offset']);}_0x28b8b3[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x266498[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x28b8b3[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x266498['query'],_0x5d8ada[_0xbcb9('0x45')]));_0x28b8b3[_0xbcb9('0x4b')]['FaxAccountId']=_0x30b105['id'];if(_0x266498[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x28b8b3[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x28b8b3[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x28b8b3['attributes'],function(_0x568a92){var _0x278223={};_0x278223[_0x568a92]={'$like':'%'+_0x266498[_0xbcb9('0x43')]['filter']+'%'};return _0x278223;})});}_0x28b8b3=_['merge']({},_0x28b8b3,_0x266498[_0xbcb9('0x50')]);return db[_0xbcb9('0x64')][_0xbcb9('0x2f')]({'where':_0x28b8b3['where']})[_0xbcb9('0x35')](function(_0x4928fc){_0x1935c1[_0xbcb9('0x2f')]=_0x4928fc;if(_0x266498['query'][_0xbcb9('0x52')]){_0x28b8b3[_0xbcb9('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbcb9('0x54')](_0x28b8b3);})[_0xbcb9('0x35')](function(_0x595db7){_0x1935c1['rows']=_0x595db7;return _0x1935c1;});}})['then'](respondWithFilteredResult(_0xffd3a0,_0x28b8b3))[_0xbcb9('0x28')](handleError(_0xffd3a0,null));};exports[_0xbcb9('0x68')]=function(_0x2d102e,_0x2b6951,_0x425e34){return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x2d102e[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2b6951,null))[_0xbcb9('0x35')](function(_0x437746){if(_0x437746){return _0x437746['removeDispositions'](_0x2d102e[_0xbcb9('0x43')][_0xbcb9('0x69')]);}})['then'](respondWithStatusCode(_0x2b6951,null))[_0xbcb9('0x28')](handleError(_0x2b6951,null));};exports[_0xbcb9('0x6a')]=function(_0x560d69,_0x444f89,_0x69ec69){if(_0x560d69['body']['id']){delete _0x560d69[_0xbcb9('0x5a')]['id'];}return db[_0xbcb9('0x51')]['find']({'where':{'id':_0x560d69[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x444f89,null))[_0xbcb9('0x35')](function(_0x4616b5){if(_0x4616b5){_0x560d69[_0xbcb9('0x5a')][_0xbcb9('0x63')]=_0x4616b5['id'];return db[_0xbcb9('0x6b')][_0xbcb9('0x59')](_0x560d69['body']);}})[_0xbcb9('0x35')](respondWithResult(_0x444f89,null))[_0xbcb9('0x28')](handleError(_0x444f89,null));};exports['getAnswers']=function(_0x4f1bc0,_0x35ec07,_0x4926c7){var _0x306eaf={'raw':![],'where':{}};var _0x1a0c04={};var _0x29b415={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x4f1bc0[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x35ec07,null))[_0xbcb9('0x35')](function(_0x424c15){if(_0x424c15){_0x1a0c04['model']=_['keys'](db[_0xbcb9('0x6b')][_0xbcb9('0x3e')]);_0x1a0c04[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x4f1bc0[_0xbcb9('0x43')]);_0x1a0c04[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0x1a0c04[_0xbcb9('0x42')],_0x1a0c04[_0xbcb9('0x43')]);_0x306eaf[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x1a0c04[_0xbcb9('0x42')],qs['fields'](_0x4f1bc0[_0xbcb9('0x43')]['fields']));_0x306eaf[_0xbcb9('0x47')]=_0x306eaf['attributes'][_0xbcb9('0x49')]?_0x306eaf['attributes']:_0x1a0c04[_0xbcb9('0x42')];if(!_0x4f1bc0['query'][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0x306eaf[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x306eaf[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x30')]);}_0x306eaf['order']=qs[_0xbcb9('0x4a')](_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x306eaf[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x4f1bc0['query'],_0x1a0c04[_0xbcb9('0x45')]));_0x306eaf[_0xbcb9('0x4b')]['FaxAccountId']=_0x424c15['id'];if(_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x306eaf['where']=_[_0xbcb9('0x4e')](_0x306eaf[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x306eaf[_0xbcb9('0x47')],function(_0x264e10){var _0x189f15={};_0x189f15[_0x264e10]={'$like':'%'+_0x4f1bc0[_0xbcb9('0x43')]['filter']+'%'};return _0x189f15;})});}_0x306eaf=_[_0xbcb9('0x4e')]({},_0x306eaf,_0x4f1bc0[_0xbcb9('0x50')]);return db[_0xbcb9('0x6b')][_0xbcb9('0x2f')]({'where':_0x306eaf[_0xbcb9('0x4b')]})[_0xbcb9('0x35')](function(_0x665383){_0x29b415[_0xbcb9('0x2f')]=_0x665383;if(_0x4f1bc0[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x306eaf[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0x6b')][_0xbcb9('0x54')](_0x306eaf);})['then'](function(_0x6d3432){_0x29b415[_0xbcb9('0x55')]=_0x6d3432;return _0x29b415;});}})[_0xbcb9('0x35')](respondWithFilteredResult(_0x35ec07,_0x306eaf))[_0xbcb9('0x28')](handleError(_0x35ec07,null));};exports['removeAnswers']=function(_0x3f5017,_0x5248a3,_0x2912a9){return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x3f5017[_0xbcb9('0x57')]['id']}})['then'](handleEntityNotFound(_0x5248a3,null))[_0xbcb9('0x35')](function(_0x1faacc){if(_0x1faacc){return _0x1faacc['removeAnswers'](_0x3f5017[_0xbcb9('0x43')][_0xbcb9('0x69')]);}})[_0xbcb9('0x35')](respondWithStatusCode(_0x5248a3,null))[_0xbcb9('0x28')](handleError(_0x5248a3,null));};exports[_0xbcb9('0x6d')]=function(_0xe4c3c0,_0x2d5fa0,_0x5b0b52){return db[_0xbcb9('0x6e')]['find']({'where':{'id':_0xe4c3c0[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2d5fa0,null))[_0xbcb9('0x35')](function(_0x549f96){if(_0x549f96){return _0x549f96[_0xbcb9('0x6d')](_0xe4c3c0[_0xbcb9('0x5a')][_0xbcb9('0x69')],_[_0xbcb9('0x6f')](_0xe4c3c0[_0xbcb9('0x5a')],[_0xbcb9('0x69'),'id'])||{});}})[_0xbcb9('0x35')](respondWithResult(_0x2d5fa0,null))[_0xbcb9('0x28')](handleError(_0x2d5fa0,null));};exports[_0xbcb9('0x70')]=function(_0x1ad2ad,_0x2f2ba6,_0x1f50c4){var _0x2b54e2={'raw':![],'where':{}};var _0x30599f={};var _0x22f6c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xbcb9('0x65')]({'where':{'id':_0x1ad2ad[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x2f2ba6,null))[_0xbcb9('0x35')](function(_0x37f428){if(_0x37f428){_0x30599f[_0xbcb9('0x42')]=_['keys'](db[_0xbcb9('0x6e')][_0xbcb9('0x3e')]);_0x30599f['query']=_[_0xbcb9('0x44')](_0x1ad2ad['query']);_0x30599f[_0xbcb9('0x45')]=_['intersection'](_0x30599f['model'],_0x30599f[_0xbcb9('0x43')]);_0x2b54e2[_0xbcb9('0x47')]=_['intersection'](_0x30599f[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x48')]));_0x2b54e2[_0xbcb9('0x47')]=_0x2b54e2[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x2b54e2[_0xbcb9('0x47')]:_0x30599f['model'];if(!_0x1ad2ad[_0xbcb9('0x43')]['hasOwnProperty'](_0xbcb9('0x66'))){_0x2b54e2[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x2b54e2[_0xbcb9('0x30')]=qs[_0xbcb9('0x30')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x30')]);}_0x2b54e2[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x2b54e2[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x1ad2ad[_0xbcb9('0x43')],_0x30599f[_0xbcb9('0x45')]));_0x2b54e2[_0xbcb9('0x4b')]['FaxAccountId']=_0x37f428['id'];if(_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4d')]){_0x2b54e2[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x2b54e2[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x2b54e2[_0xbcb9('0x47')],function(_0x2a7aff){var _0x19efd8={};_0x19efd8[_0x2a7aff]={'$like':'%'+_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0x19efd8;})});}_0x2b54e2=_[_0xbcb9('0x4e')]({},_0x2b54e2,_0x1ad2ad[_0xbcb9('0x50')]);return db[_0xbcb9('0x6e')]['count']({'where':_0x2b54e2[_0xbcb9('0x4b')]})['then'](function(_0x20b70b){_0x22f6c0[_0xbcb9('0x2f')]=_0x20b70b;if(_0x1ad2ad[_0xbcb9('0x43')][_0xbcb9('0x52')]){_0x2b54e2[_0xbcb9('0x53')]=[{'model':db[_0xbcb9('0x71')],'as':_0xbcb9('0x72'),'required':![]},{'model':db['User'],'as':_0xbcb9('0x73'),'attributes':[_0xbcb9('0x39'),_0xbcb9('0x74'),_0xbcb9('0x75')],'required':![]},{'model':db[_0xbcb9('0x76')],'as':_0xbcb9('0x77'),'attributes':['id',_0xbcb9('0x39'),_0xbcb9('0x78')],'where':_0x1ad2ad[_0xbcb9('0x43')]['tag']?{'id':_0x1ad2ad['query'][_0xbcb9('0x79')]}:undefined,'required':_0x1ad2ad[_0xbcb9('0x43')]['tag']?!![]:![]}];}return db[_0xbcb9('0x6e')][_0xbcb9('0x54')](_0x2b54e2);})[_0xbcb9('0x35')](function(_0x409d13){_0x22f6c0[_0xbcb9('0x55')]=_0x409d13;return _0x22f6c0;});}})[_0xbcb9('0x35')](respondWithFilteredResult(_0x2f2ba6,_0x2b54e2))[_0xbcb9('0x28')](handleError(_0x2f2ba6,null));};exports['addApplications']=function(_0x4a508e,_0x198d17){var _0x5f0610=_0x4a508e[_0xbcb9('0x57')]['id'];var _0x33c913=_0x4a508e[_0xbcb9('0x5a')];var _0x3c154b=0xc8;var _0x1f6bec=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xbcb9('0x7a')][_0xbcb9('0x7b')][_0xbcb9('0x7c')][_0xbcb9('0x7d')]},function(_0x35d579){return db[_0xbcb9('0x51')]['findOne']({'where':{'id':_0x5f0610},'transaction':_0x35d579})[_0xbcb9('0x35')](function(_0x14c044){if(_0x14c044){return db['FaxApplication'][_0xbcb9('0x36')]({'where':{'FaxAccountId':_0x5f0610},'transaction':_0x35d579})['then'](function(){var _0xf61196=_[_0xbcb9('0x3d')](_0x33c913,function(_0x541445){_0x541445[_0xbcb9('0x63')]=_0x5f0610;return _0x541445;});return db[_0xbcb9('0x7e')][_0xbcb9('0x7f')](_0xf61196,{'transaction':_0x35d579});});}else{_0x3c154b=0x194;_0x1f6bec=[];}});})[_0xbcb9('0x35')](function(){if(_0x3c154b!==0x194){return db['FaxApplication'][_0xbcb9('0x80')]({'where':{'FaxAccountId':_0x5f0610},'order':'priority'})[_0xbcb9('0x35')](function(_0x29b557){_0x1f6bec=_0x29b557;});}})[_0xbcb9('0x28')](function(_0x429433){_0x3c154b=0x1f4;logger[_0xbcb9('0x24')](_0x429433[_0xbcb9('0x38')]);if(_0x429433[_0xbcb9('0x39')]){delete _0x429433[_0xbcb9('0x39')];}_0x1f6bec=_0x429433;})[_0xbcb9('0x81')](function(){if(_0x1f6bec===null){_0x198d17[_0xbcb9('0x29')](_0x3c154b);}else{if(_0x3c154b===0x1f4){_0x198d17[_0xbcb9('0x2a')](_0x3c154b)[_0xbcb9('0x3a')](_0x1f6bec);}else{_0x198d17['status'](_0x3c154b)[_0xbcb9('0x2c')](_0x1f6bec);}}});};exports[_0xbcb9('0x82')]=function(_0x5f4ff6,_0x39974b,_0x5a7c74){var _0x1f2647={};var _0x4aa7f1={};var _0x4a4af4;var _0x1c97fd;return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x5f4ff6[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x39974b,null))['then'](function(_0x413cca){if(_0x413cca){_0x4a4af4=_0x413cca;_0x4aa7f1[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db['FaxApplication'][_0xbcb9('0x3e')]);_0x4aa7f1['query']=_['keys'](_0x5f4ff6['query']);_0x4aa7f1['filters']=_[_0xbcb9('0x46')](_0x4aa7f1[_0xbcb9('0x42')],_0x4aa7f1[_0xbcb9('0x43')]);_0x1f2647['attributes']=_[_0xbcb9('0x46')](_0x4aa7f1['model'],qs[_0xbcb9('0x48')](_0x5f4ff6['query']['fields']));_0x1f2647[_0xbcb9('0x47')]=_0x1f2647[_0xbcb9('0x47')][_0xbcb9('0x49')]?_0x1f2647[_0xbcb9('0x47')]:_0x4aa7f1[_0xbcb9('0x42')];_0x1f2647[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x5f4ff6['query'][_0xbcb9('0x4a')]);_0x1f2647[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_['pick'](_0x5f4ff6[_0xbcb9('0x43')],_0x4aa7f1[_0xbcb9('0x45')]));if(_0x5f4ff6['query'][_0xbcb9('0x4d')]){_0x1f2647[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x1f2647['where'],{'$or':_['map'](_0x1f2647[_0xbcb9('0x47')],function(_0x5f16af){var _0xee9ee9={};_0xee9ee9[_0x5f16af]={'$like':'%'+_0x5f4ff6[_0xbcb9('0x43')][_0xbcb9('0x4d')]+'%'};return _0xee9ee9;})});}_0x1f2647=_['merge']({},_0x1f2647,_0x5f4ff6[_0xbcb9('0x50')]);return _0x4a4af4[_0xbcb9('0x82')](_0x1f2647);}})['then'](function(_0x305c00){if(_0x305c00){_0x1c97fd=_0x305c00['length'];if(!_0x5f4ff6['query'][_0xbcb9('0x6c')]('nolimit')){_0x1f2647[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x5f4ff6['query'][_0xbcb9('0x2e')]);_0x1f2647['offset']=qs[_0xbcb9('0x30')](_0x5f4ff6[_0xbcb9('0x43')][_0xbcb9('0x30')]);}return _0x4a4af4[_0xbcb9('0x82')](_0x1f2647);}})[_0xbcb9('0x35')](function(_0x5ee5f0){if(_0x5ee5f0){return _0x5ee5f0?{'count':_0x1c97fd,'rows':_0x5ee5f0}:null;}})[_0xbcb9('0x35')](respondWithResult(_0x39974b,null))[_0xbcb9('0x28')](handleError(_0x39974b,null));};function Extension(_0x1690ce,_0x5d66d4,_0x19bdde,_0x308fb1){this[_0xbcb9('0x83')]=_0xbcb9('0x84');this[_0xbcb9('0x85')]=_0x1690ce[_0xbcb9('0x86')];this[_0xbcb9('0x87')]=_0x308fb1;this[_0xbcb9('0x40')]=_0xbcb9('0x88');this[_0xbcb9('0x89')]=_0xbcb9('0x8a');this[_0xbcb9('0x63')]=_0x1690ce['id'];this[_0xbcb9('0x8b')]=_0x5d66d4;this[_0xbcb9('0x8c')]=_0x19bdde;}function createExtensionsReciveFax(_0x41e528){var _0x49a93a=0x1;var _0xe3aca1=[];_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,'','Answer'));_0x49a93a+=0x1;_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x8e'),_0xbcb9('0x8f')));_0x49a93a+=0x1;for(var _0x3320e7 in _0x41e528){if(_0x41e528[_0xbcb9('0x6c')](_0x3320e7)&&(_0x3320e7===_0xbcb9('0x90')||_0x3320e7===_0xbcb9('0x86')||_0x3320e7===_0xbcb9('0x91')||_0x3320e7===_0xbcb9('0x92')||_0x3320e7===_0xbcb9('0x93')||_0x3320e7===_0xbcb9('0x94')||_0x3320e7===_0xbcb9('0x95')||_0x3320e7===_0xbcb9('0x96')||_0x3320e7==='t38timeout')){_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x97')+_0x3320e7+')='+_0x41e528[_0x3320e7],_0xbcb9('0x8f')));_0x49a93a+=0x1;}}_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,'6',_0xbcb9('0x98')));_0x49a93a+=0x1;_0xe3aca1[_0xbcb9('0x8d')](new Extension(_0x41e528,_0x49a93a,_0xbcb9('0x99'),_0xbcb9('0x9a')));_0x49a93a=0x0;return _0xe3aca1;}exports['addAccountApplications']=function(_0x57cf0a,_0x4ee125,_0x7ade03){var _0x88bc75;return db[_0xbcb9('0x7a')][_0xbcb9('0x9b')](function(_0x39b488){return db['FaxAccount'][_0xbcb9('0x59')](_0x57cf0a[_0xbcb9('0x5a')],{'transaction':_0x39b488})[_0xbcb9('0x35')](function(_0x269d6f){_0x88bc75=_0x269d6f[_0xbcb9('0x37')]({'plain':!![]});return db[_0xbcb9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x88bc75),{'transaction':_0x39b488});});})[_0xbcb9('0x35')](function(){return _0x88bc75;})[_0xbcb9('0x35')](respondWithResult(_0x4ee125,null))[_0xbcb9('0x28')](handleError(_0x4ee125,null));};exports[_0xbcb9('0x9d')]=function(_0x25da2f,_0x14b9c6,_0x413350){var _0x4f7405;return db[_0xbcb9('0x7a')][_0xbcb9('0x9b')](function(_0x32beae){return db[_0xbcb9('0x51')][_0xbcb9('0x60')](_0x25da2f[_0xbcb9('0x5a')],{'where':{'id':_0x25da2f[_0xbcb9('0x5a')]['id']},'transaction':_0x32beae})[_0xbcb9('0x35')](function(_0x2a6414){return db[_0xbcb9('0x9c')][_0xbcb9('0x36')]({'where':{'FaxAccountId':_0x25da2f['body']['id']},'transaction':_0x32beae})[_0xbcb9('0x35')](function(_0x12c6a0){return db[_0xbcb9('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0xbcb9('0x6f')](_0x25da2f[_0xbcb9('0x5a')],['tech','key',_0xbcb9('0x9e'),_0xbcb9('0x9f'),_0xbcb9('0xa0'),'ListId'])),{'transaction':_0x32beae});});});})[_0xbcb9('0x35')](function(){return db[_0xbcb9('0x51')]['findById'](_0x25da2f[_0xbcb9('0x5a')]['id']);})[_0xbcb9('0x35')](respondWithResult(_0x14b9c6,null))[_0xbcb9('0x28')](handleError(_0x14b9c6,null));};exports[_0xbcb9('0xa1')]=function(_0x5887b8,_0x373c2b,_0x15b280){var _0x58e123={'raw':!![],'where':{}};var _0xcb754f={};var _0x1ad7bb={'count':0x0,'rows':[]};return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x5887b8[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x373c2b,null))['then'](function(_0x2b0a80){if(_0x2b0a80){_0xcb754f[_0xbcb9('0x42')]=_[_0xbcb9('0x44')](db[_0xbcb9('0xa2')]['rawAttributes']);_0xcb754f[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x5887b8['query']);_0xcb754f[_0xbcb9('0x45')]=_[_0xbcb9('0x46')](_0xcb754f[_0xbcb9('0x42')],_0xcb754f[_0xbcb9('0x43')]);_0x58e123[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0xcb754f[_0xbcb9('0x42')],qs[_0xbcb9('0x48')](_0x5887b8[_0xbcb9('0x43')]['fields']));_0x58e123[_0xbcb9('0x47')]=_0x58e123['attributes']['length']?_0x58e123[_0xbcb9('0x47')]:_0xcb754f[_0xbcb9('0x42')];if(!_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0x58e123[_0xbcb9('0x2e')]=qs[_0xbcb9('0x2e')](_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0x58e123['offset']=qs[_0xbcb9('0x30')](_0x5887b8['query'][_0xbcb9('0x30')]);}_0x58e123[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0x58e123[_0xbcb9('0x4b')]=qs[_0xbcb9('0x45')](_[_0xbcb9('0x4c')](_0x5887b8[_0xbcb9('0x43')],_0xcb754f[_0xbcb9('0x45')]));_0x58e123[_0xbcb9('0x4b')][_0xbcb9('0x63')]=_0x2b0a80['id'];if(_0x5887b8['query'][_0xbcb9('0x4d')]){_0x58e123[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0x58e123[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0x58e123['attributes'],function(_0xf24309){var _0x591550={};_0x591550[_0xf24309]={'$like':'%'+_0x5887b8[_0xbcb9('0x43')]['filter']+'%'};return _0x591550;})});}if(_0x5887b8[_0xbcb9('0x43')]['$gte']){var _0x351d3c=_0x5887b8[_0xbcb9('0x43')][_0xbcb9('0xa3')]['split'](',');var _0x564e69={};_0x564e69[_0x351d3c[0x0]]={'$gte':moment(_0x351d3c[0x1])['format'](_0xbcb9('0xa4'))};_0x58e123['where']=_[_0xbcb9('0x4e')](_0x58e123[_0xbcb9('0x4b')],_0x564e69);}_0x58e123=_[_0xbcb9('0x4e')]({},_0x58e123,_0x5887b8['options']);return db[_0xbcb9('0xa2')][_0xbcb9('0x2f')]({'where':_0x58e123[_0xbcb9('0x4b')]})[_0xbcb9('0x35')](function(_0x46f0d0){_0x1ad7bb['count']=_0x46f0d0;if(_0x5887b8[_0xbcb9('0x43')]['includeAll']){_0x58e123[_0xbcb9('0x53')]=[{'all':!![]}];}return db[_0xbcb9('0xa2')][_0xbcb9('0x54')](_0x58e123);})[_0xbcb9('0x35')](function(_0x16e3bc){_0x1ad7bb[_0xbcb9('0x55')]=_0x16e3bc;return _0x1ad7bb;});}})['then'](respondWithFilteredResult(_0x373c2b,_0x58e123))[_0xbcb9('0x28')](handleError(_0x373c2b,null));};exports['send']=function(_0x501fec,_0x26976b,_0x1d53fa){var _0x5d81c0,_0x1cfee5={},_0x532d00;if(_0x501fec['body']['to']){_0x532d00=_0x501fec[_0xbcb9('0x5a')]['to'][0x0];}return db[_0xbcb9('0x51')][_0xbcb9('0x58')]({'where':{'id':_0x501fec[_0xbcb9('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xbcb9('0xa5'),'include':[{'model':db[_0xbcb9('0x71')],'as':_0xbcb9('0xa6'),'where':{'fax':_0x532d00},'limit':0x1,'order':[[_0xbcb9('0x9f'),_0xbcb9('0xa7')]]}]}]})[_0xbcb9('0x35')](handleEntityNotFound(_0x26976b,null))[_0xbcb9('0x35')](function(_0x51177a){_0x5d81c0=_0x51177a;if(_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')]&&_0x501fec['body'][_0xbcb9('0xa8')][_0xbcb9('0x49')]){for(var _0x464323=0x0;_0x464323<_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0xbcb9('0x49')];_0x464323+=0x1){_0x501fec['body'][_0xbcb9('0xa8')][_0x464323]={'filename':_0x501fec['body'][_0xbcb9('0xa8')][_0x464323][_0xbcb9('0x39')],'id':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0x464323]['id'],'path':path[_0xbcb9('0xa9')](config[_0xbcb9('0xaa')],_0xbcb9('0xab'),_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][_0x464323][_0xbcb9('0xac')])};}}return respondWithRpcPromise(_0xbcb9('0xad'),_0xbcb9('0xad'),{'FaxAccountId':_['isNil'](_0x501fec[_0xbcb9('0x57')]['id'])?undefined:_0x501fec['params']['id'],'path':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')])?undefined:_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')],'fax':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')]['to'][0x0])?undefined:_0x501fec['body']['to'][0x0]},client9002);})['then'](function(){if(_0x5d81c0){if(_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xaf')])){_0x501fec['body']['from']=util[_0xbcb9('0xb0')](_0xbcb9('0xb1'),_0x5d81c0[_0xbcb9('0x39')],_0x5d81c0[_0xbcb9('0xb2')]);}if(_0x5d81c0['List']){if(_0x5d81c0[_0xbcb9('0xa5')][_0xbcb9('0xa6')][_0xbcb9('0x49')]){return _0x5d81c0[_0xbcb9('0xa5')][_0xbcb9('0xa6')][0x0];}else{return db['CmContact'][_0xbcb9('0x59')](_[_0xbcb9('0x16')](_0x501fec[_0xbcb9('0x5a')],{'firstName':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'phone':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'fax':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'ListId':_0x5d81c0[_0xbcb9('0xb3')]}));}}else{throw new Error(_0xbcb9('0xb4'));}}else{throw new Error(_0xbcb9('0xb5'));}})['then'](function(_0x4553c7){if(_0x4553c7){return db['FaxInteraction'][_0xbcb9('0x58')]({'where':{'ContactId':_0x4553c7['id'],'closed':![],'FaxAccountId':_0x5d81c0['id']}})[_0xbcb9('0x35')](function(_0x3c2f67){if(_0x3c2f67){return[_0x3c2f67,![]];}return db[_0xbcb9('0x6e')][_0xbcb9('0x59')]({'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0x4553c7['id'],'FaxAccountId':_0x5d81c0['id'],'fax':_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'firstMsgDirection':_0xbcb9('0xb6'),'Messages':[_[_0xbcb9('0x4e')](_0x501fec[_0xbcb9('0x5a')],{'read':![],'body':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d81c0['id'],'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0x4553c7['id'],'AttachmentId':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xbcb9('0xb7')}]})[_0xbcb9('0x35')](function(_0x520a91){return[_0x520a91,!![]];});});}else{throw new Error(_0xbcb9('0xb8'));}})[_0xbcb9('0xb9')](function(_0xb62fd0,_0x5bb3d5){if(_0x5bb3d5){return _0xb62fd0;}return db[_0xbcb9('0xa2')][_0xbcb9('0x59')]({'direction':'out','read':![],'body':_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d81c0['id'],'FaxInteractionId':_0xb62fd0['id'],'UserId':_0x501fec[_0xbcb9('0x5c')]['id'],'ContactId':_0xb62fd0['ContactId'],'AttachmentId':_0x501fec['body'][_0xbcb9('0xa8')][0x0]['id']})['then'](function(_0x24a0c6){_0xb62fd0[_0xbcb9('0xba')]['Messages']=[];_0xb62fd0[_0xbcb9('0xba')][_0xbcb9('0xb7')][_0xbcb9('0x8d')](_0x24a0c6['dataValues']);return _0xb62fd0;});})[_0xbcb9('0x35')](function(_0x14503c){respondWithRpcPromise(_0xbcb9('0xbb'),_0xbcb9('0xbb'),{'FaxAccountId':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x57')]['id'])?undefined:_0x501fec[_0xbcb9('0x57')]['id'],'path':_[_0xbcb9('0xae')](_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0][_0xbcb9('0x7')])?undefined:_0x501fec[_0xbcb9('0x5a')][_0xbcb9('0xa8')][0x0]['path'],'fax':_['isNil'](_0x501fec[_0xbcb9('0x5a')]['to'][0x0])?undefined:_0x501fec[_0xbcb9('0x5a')]['to'][0x0],'AttachmentId':_0x501fec[_0xbcb9('0x5a')]['attachments'][0x0]['id']},client9002)[_0xbcb9('0x35')](function(_0x9f649c){logger[_0xbcb9('0x1f')](_0xbcb9('0xbc'),_0x9f649c);})[_0xbcb9('0x28')](function(_0x16ca24){logger['info'](_0xbcb9('0xbc'),_0x16ca24);});return _0x14503c;})[_0xbcb9('0x35')](respondWithResult(_0x26976b,null))['catch'](handleError(_0x26976b,null));};exports[_0xbcb9('0xbd')]=function(_0x599ee3,_0x46cf7a,_0x19944f){return db['FaxAccount'][_0xbcb9('0x58')]({'where':{'id':_0x599ee3[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x46cf7a,null))['then'](function(_0x4ccb5b){if(_0x4ccb5b){return _0x4ccb5b[_0xbcb9('0xbd')](_0x599ee3[_0xbcb9('0x5a')][_0xbcb9('0x69')],_[_0xbcb9('0x6f')](_0x599ee3[_0xbcb9('0x5a')],[_0xbcb9('0x69'),'id'])||{})[_0xbcb9('0xb9')](function(_0x4eea71){for(var _0x3bc21b=0x0;_0x3bc21b<_0x599ee3['body'][_0xbcb9('0x69')][_0xbcb9('0x49')];_0x3bc21b+=0x1){socket[_0xbcb9('0xbe')](_0xbcb9('0xbf'),{'UserId':Number(_0x599ee3[_0xbcb9('0x5a')]['ids'][_0x3bc21b]),'FaxAccountId':Number(_0x599ee3[_0xbcb9('0x57')]['id'])});}return _0x4eea71;});}})[_0xbcb9('0x35')](respondWithResult(_0x46cf7a,null))[_0xbcb9('0x28')](handleError(_0x46cf7a,null));};exports[_0xbcb9('0xc0')]=function(_0x12cb19,_0x50160a,_0x3d98e7){return db['FaxAccount'][_0xbcb9('0x58')]({'where':{'id':_0x12cb19[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x50160a,null))[_0xbcb9('0x35')](function(_0x10c14b){if(_0x10c14b){return _0x10c14b['removeAgents'](_0x12cb19[_0xbcb9('0x43')]['ids'])[_0xbcb9('0x35')](function(){if(_[_0xbcb9('0xc1')](_0x12cb19['query']['ids'])){for(var _0x3d37d8=0x0;_0x3d37d8<_0x12cb19[_0xbcb9('0x43')][_0xbcb9('0x69')]['length'];_0x3d37d8+=0x1){socket[_0xbcb9('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x12cb19['query'][_0xbcb9('0x69')][_0x3d37d8]),'FaxAccountId':Number(_0x12cb19[_0xbcb9('0x57')]['id'])});}}else{socket[_0xbcb9('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x12cb19[_0xbcb9('0x43')]['ids']),'FaxAccountId':Number(_0x12cb19['params']['id'])});}});}})['then'](respondWithStatusCode(_0x50160a,null))[_0xbcb9('0x28')](handleError(_0x50160a,null));};exports[_0xbcb9('0xc2')]=function(_0x21dc75,_0x189e5d,_0x48c281){var _0xebeb79={};var _0x8f469d={};var _0x5b55ec;var _0x61ccbc;return db[_0xbcb9('0x51')][_0xbcb9('0x65')]({'where':{'id':_0x21dc75[_0xbcb9('0x57')]['id']}})[_0xbcb9('0x35')](handleEntityNotFound(_0x189e5d,null))[_0xbcb9('0x35')](function(_0x4fb67f){if(_0x4fb67f){_0x5b55ec=_0x4fb67f;_0x8f469d[_0xbcb9('0x42')]=_['keys'](db['User']['rawAttributes']);_0x8f469d[_0xbcb9('0x43')]=_[_0xbcb9('0x44')](_0x21dc75[_0xbcb9('0x43')]);_0x8f469d[_0xbcb9('0x45')]=_['intersection'](_0x8f469d['model'],_0x8f469d['query']);_0xebeb79[_0xbcb9('0x47')]=_[_0xbcb9('0x46')](_0x8f469d[_0xbcb9('0x42')],qs['fields'](_0x21dc75['query'][_0xbcb9('0x48')]));_0xebeb79[_0xbcb9('0x47')]=_0xebeb79[_0xbcb9('0x47')]['length']?_0xebeb79[_0xbcb9('0x47')]:_0x8f469d['model'];_0xebeb79[_0xbcb9('0x67')]=qs[_0xbcb9('0x4a')](_0x21dc75[_0xbcb9('0x43')][_0xbcb9('0x4a')]);_0xebeb79['where']=qs[_0xbcb9('0x45')](_['pick'](_0x21dc75['query'],_0x8f469d[_0xbcb9('0x45')]));if(_0x21dc75['query']['filter']){_0xebeb79[_0xbcb9('0x4b')]=_[_0xbcb9('0x4e')](_0xebeb79[_0xbcb9('0x4b')],{'$or':_[_0xbcb9('0x3d')](_0xebeb79[_0xbcb9('0x47')],function(_0x544f70){var _0x412f10={};_0x412f10[_0x544f70]={'$like':'%'+_0x21dc75['query'][_0xbcb9('0x4d')]+'%'};return _0x412f10;})});}_0xebeb79=_[_0xbcb9('0x4e')]({},_0xebeb79,_0x21dc75[_0xbcb9('0x50')]);return _0x5b55ec[_0xbcb9('0xc2')](_0xebeb79);}})[_0xbcb9('0x35')](function(_0xbd53c4){if(_0xbd53c4){_0x61ccbc=_0xbd53c4[_0xbcb9('0x49')];if(!_0x21dc75['query'][_0xbcb9('0x6c')](_0xbcb9('0x66'))){_0xebeb79['limit']=qs['limit'](_0x21dc75[_0xbcb9('0x43')][_0xbcb9('0x2e')]);_0xebeb79[_0xbcb9('0x30')]=qs['offset'](_0x21dc75[_0xbcb9('0x43')]['offset']);}return _0x5b55ec[_0xbcb9('0xc2')](_0xebeb79);}})['then'](function(_0x1f3855){if(_0x1f3855){return _0x1f3855?{'count':_0x61ccbc,'rows':_0x1f3855}:null;}})[_0xbcb9('0x35')](respondWithResult(_0x189e5d,null))[_0xbcb9('0x28')](handleError(_0x189e5d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 52d9473..dda65d7 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 _0xf534=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hook','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf534,0x9f));var _0x4f53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf534[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x4f53('0x0'));var FaxAccount=require(_0x4f53('0x1'))['db'][_0x4f53('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4f53('0x3')](0x0);var events={'afterCreate':_0x4f53('0x4'),'afterUpdate':'update','afterDestroy':_0x4f53('0x5')};function emitEvent(_0x9d558c){return function(_0x585266,_0x15f7e5,_0x1fe87f){FaxAccountEvents[_0x4f53('0x6')](_0x9d558c+':'+_0x585266['id'],_0x585266);FaxAccountEvents[_0x4f53('0x6')](_0x9d558c,_0x585266);_0x1fe87f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x4f53('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xb6f3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','FaxAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb6f3,0x12a));var _0x3b6f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xb6f3[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x3b6f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x3b6f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3b6f('0x2')](0x0);var events={'afterCreate':_0x3b6f('0x3'),'afterUpdate':_0x3b6f('0x4'),'afterDestroy':_0x3b6f('0x5')};function emitEvent(_0x10488f){return function(_0x3d7fd6,_0xfd524e,_0x492f95){FaxAccountEvents[_0x3b6f('0x6')](_0x10488f+':'+_0x3d7fd6['id'],_0x3d7fd6);FaxAccountEvents[_0x3b6f('0x6')](_0x10488f,_0x3d7fd6);_0x492f95(null);};}for(var e in events){if(events[_0x3b6f('0x7')](e)){var event=events[e];FaxAccount[_0x3b6f('0x8')](e,emitEvent(event));}}module[_0x3b6f('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9fcc29c..896faec 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 _0x2ec6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','lodash','util'];(function(_0x5cc372,_0x339b93){var _0x56f357=function(_0x414c2d){while(--_0x414c2d){_0x5cc372['push'](_0x5cc372['shift']());}};_0x56f357(++_0x339b93);}(_0x2ec6,0x8d));var _0x62ec=function(_0x1d82a8,_0x32a744){_0x1d82a8=_0x1d82a8-0x0;var _0x368fcc=_0x2ec6[_0x1d82a8];return _0x368fcc;};'use strict';var _=require(_0x62ec('0x0'));var util=require(_0x62ec('0x1'));var logger=require(_0x62ec('0x2'))(_0x62ec('0x3'));var moment=require(_0x62ec('0x4'));var BPromise=require(_0x62ec('0x5'));var rp=require(_0x62ec('0x6'));var fs=require('fs');var path=require(_0x62ec('0x7'));var rimraf=require(_0x62ec('0x8'));var config=require('../../config/environment');var attributes=require(_0x62ec('0x9'));module[_0x62ec('0xa')]=function(_0x4666e2,_0x1e8df2){return _0x4666e2['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb163=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','api','moment'];(function(_0x295270,_0x205409){var _0x3d65c7=function(_0x56d6c2){while(--_0x56d6c2){_0x295270['push'](_0x295270['shift']());}};_0x3d65c7(++_0x205409);}(_0xb163,0x127));var _0x3b16=function(_0x3eb1c6,_0x49cdf8){_0x3eb1c6=_0x3eb1c6-0x0;var _0x4fbb63=_0xb163[_0x3eb1c6];return _0x4fbb63;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3b16('0x0'));var moment=require(_0x3b16('0x1'));var BPromise=require('bluebird');var rp=require(_0x3b16('0x2'));var fs=require('fs');var path=require(_0x3b16('0x3'));var rimraf=require(_0x3b16('0x4'));var config=require(_0x3b16('0x5'));var attributes=require(_0x3b16('0x6'));module[_0x3b16('0x7')]=function(_0x30ca0d,_0x35c583){return _0x30ca0d[_0x3b16('0x8')](_0x3b16('0x9'),attributes,{'tableName':_0x3b16('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 7740dac..b31ba20 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 _0x88c4=['CmList','Contacts','DESC','FaxApplication','Applications','List','get','list','applications','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','FaxAccount,\x20%s,\x20%s','message','result','GetFaxAccount','options','raw','where','attributes','include','map','model','debug','catch','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account'];(function(_0x2621ba,_0x1d9d9e){var _0x4a00ec=function(_0x3821ed){while(--_0x3821ed){_0x2621ba['push'](_0x2621ba['shift']());}};_0x4a00ec(++_0x1d9d9e);}(_0x88c4,0x74));var _0x488c=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x88c4[_0x14477e];return _0x5d4a05;};'use strict';var _=require(_0x488c('0x0'));var util=require('util');var moment=require(_0x488c('0x1'));var BPromise=require('bluebird');var rs=require(_0x488c('0x2'));var fs=require('fs');var Redis=require(_0x488c('0x3'));var db=require(_0x488c('0x4'))['db'];var utils=require(_0x488c('0x5'));var logger=require(_0x488c('0x6'))('rpc');var config=require(_0x488c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config[_0x488c('0x8')]=_[_0x488c('0x9')](config['redis'],{'host':_0x488c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x488c('0x8')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x36baa8,_0x3fc066,_0x1cf7d8){return new BPromise(function(_0x45b91c,_0x545fc6){return client[_0x488c('0xb')](_0x36baa8,_0x1cf7d8)[_0x488c('0xc')](function(_0x52b4c9){logger[_0x488c('0xd')]('FaxAccount,\x20%s,\x20%s',_0x3fc066,'request\x20sent');logger['debug'](_0x488c('0xe'),_0x3fc066,_0x488c('0xf'),JSON[_0x488c('0x10')](_0x52b4c9));if(_0x52b4c9['error']){if(_0x52b4c9['error'][_0x488c('0x11')]===0x1f4){logger[_0x488c('0x12')](_0x488c('0x13'),_0x3fc066,_0x52b4c9['error']['message']);return _0x545fc6(_0x52b4c9[_0x488c('0x12')][_0x488c('0x14')]);}logger[_0x488c('0x12')](_0x488c('0x13'),_0x3fc066,_0x52b4c9[_0x488c('0x12')]['message']);return _0x45b91c(_0x52b4c9[_0x488c('0x12')]['message']);}else{logger['info'](_0x488c('0x13'),_0x3fc066,_0x488c('0xf'));_0x45b91c(_0x52b4c9[_0x488c('0x15')][_0x488c('0x14')]);}})['catch'](function(_0x38ee1e){logger[_0x488c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x3fc066,_0x38ee1e);_0x545fc6(_0x38ee1e);});});}exports[_0x488c('0x16')]=function(_0x17feb9){var _0x145671=this;return new Promise(function(_0x322bdd,_0x5ac345){return db['FaxAccount']['findAll']({'raw':_0x17feb9[_0x488c('0x17')]?_0x17feb9[_0x488c('0x17')][_0x488c('0x18')]===undefined?!![]:![]:!![],'where':_0x17feb9[_0x488c('0x17')]?_0x17feb9[_0x488c('0x17')][_0x488c('0x19')]||null:null,'attributes':_0x17feb9[_0x488c('0x17')]?_0x17feb9[_0x488c('0x17')][_0x488c('0x1a')]||null:null,'limit':_0x17feb9[_0x488c('0x17')]?_0x17feb9['options']['limit']||null:null,'include':_0x17feb9[_0x488c('0x17')]?_0x17feb9['options'][_0x488c('0x1b')]?_[_0x488c('0x1c')](_0x17feb9[_0x488c('0x17')][_0x488c('0x1b')],function(_0x2d0202){return{'model':db[_0x2d0202['model']],'as':_0x2d0202['as'],'attributes':_0x2d0202[_0x488c('0x1a')],'include':_0x2d0202['include']?_[_0x488c('0x1c')](_0x2d0202[_0x488c('0x1b')],function(_0x4f61af){return{'model':db[_0x4f61af[_0x488c('0x1d')]],'as':_0x4f61af['as'],'attributes':_0x4f61af[_0x488c('0x1a')],'include':_0x4f61af['include']?_[_0x488c('0x1c')](_0x4f61af['include'],function(_0x4fd62a){return{'model':db[_0x4fd62a['model']],'as':_0x4fd62a['as'],'attributes':_0x4fd62a['attributes']};}):[]};}):[]};}):[]:[]})[_0x488c('0xc')](function(_0x27a6b1){logger[_0x488c('0xd')]('GetFaxAccount',_0x17feb9);logger[_0x488c('0x1e')](_0x488c('0x16'),_0x17feb9,JSON[_0x488c('0x10')](_0x27a6b1));_0x322bdd(_0x27a6b1);})[_0x488c('0x1f')](function(_0x4b7e62){logger['error'](_0x488c('0x16'),_0x4b7e62['message'],_0x17feb9);_0x5ac345(_0x145671[_0x488c('0x12')](0x1f4,_0x4b7e62[_0x488c('0x14')]));});});};exports[_0x488c('0x20')]=function(_0x47f793,_0x3ff3b2,_0x2874e0){var _0x1f9038=this;return new Promise(function(_0x5a59da,_0x311fdf){var _0x1d9d5c={'body':_0x47f793[_0x488c('0x21')],'channel':_0x488c('0x22')};var _0x1973df=[];var _0x4f3afd=[];var _0x48f553={};return db[_0x488c('0x23')][_0x488c('0x24')]()[_0x488c('0xc')](function(_0x39d9c1){if(!_0x39d9c1){throw new db['Sequelize'][(_0x488c('0x25'))](_0x488c('0x26'));}_0x1973df=_[_0x488c('0x27')](_[_0x488c('0x28')](_0x39d9c1),['createdAt','updatedAt']);_0x4f3afd=_[_0x488c('0x27')](_[_0x488c('0x28')](_0x39d9c1),[_0x488c('0x29'),_0x488c('0x2a'),_0x488c('0x2b'),_0x488c('0x2c')]);if(_0x47f793['body']['id']){delete _0x47f793['body']['id'];}if(_[_0x488c('0x2d')](_0x47f793[_0x488c('0x21')][_0x488c('0x2e')])){throw new db[(_0x488c('0x2f'))][(_0x488c('0x25'))](_0x488c('0x30'));}if(_[_0x488c('0x2d')](_0x47f793['body'][_0x488c('0x21')])||_0x47f793[_0x488c('0x21')][_0x488c('0x21')]===''){throw new db[(_0x488c('0x2f'))][(_0x488c('0x25'))](_0x488c('0x31'));}if(_[_0x488c('0x2d')](_0x47f793[_0x488c('0x21')]['mapKey'])){throw new db[(_0x488c('0x2f'))][(_0x488c('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f3afd);}if(!_[_0x488c('0x32')](_0x4f3afd,_0x47f793['body'][_0x488c('0x33')])){throw new db[(_0x488c('0x2f'))][(_0x488c('0x25'))](_0x488c('0x34')+_0x4f3afd);}_0x48f553[_0x47f793[_0x488c('0x21')][_0x488c('0x33')]]=_0x47f793[_0x488c('0x21')][_0x488c('0x2e')];})[_0x488c('0xc')](function(){return db['FaxAccount']['find']({'where':{'id':_0x47f793[_0x488c('0x35')]['id']},'include':[{'model':db[_0x488c('0x36')],'as':'List','include':[{'model':db['CmContact'],'as':_0x488c('0x37'),'where':_0x48f553,'limit':0x1,'order':[['updatedAt',_0x488c('0x38')]]}]},{'model':db[_0x488c('0x39')],'as':_0x488c('0x3a')}]});})[_0x488c('0xc')](function(_0x5e99b1){if(_0x5e99b1&&_0x5e99b1[_0x488c('0x3b')]){var _0x1d98ef=_0x5e99b1[_0x488c('0x3c')]({'plain':!![]});_0x1d9d5c[_0x488c('0x35')]=_0x1d98ef;_0x1d9d5c['applications']=_0x1d98ef[_0x488c('0x3a')];_0x1d9d5c[_0x488c('0x3d')]=_0x1d98ef[_0x488c('0x3b')];_0x1d9d5c[_0x488c('0x3e')]=_['orderBy'](_0x1d9d5c[_0x488c('0x3e')],['priority'],['asc']);if(_0x1d9d5c[_0x488c('0x35')][_0x488c('0x3a')]){delete _0x1d9d5c[_0x488c('0x35')][_0x488c('0x3a')];}if(_0x1d9d5c[_0x488c('0x35')][_0x488c('0x3b')]&&_0x1d9d5c[_0x488c('0x35')][_0x488c('0x3b')][_0x488c('0x37')][_0x488c('0x3f')]){return _0x1d9d5c[_0x488c('0x35')]['List'][_0x488c('0x37')][0x0];}var _0x297172=_[_0x488c('0x9')](_0x47f793['body'],{'firstName':_0x47f793[_0x488c('0x21')][_0x488c('0x2e')],'ListId':_0x1d98ef[_0x488c('0x2c')]});_0x297172[_0x47f793[_0x488c('0x21')][_0x488c('0x33')]]=_0x47f793['body'][_0x488c('0x2e')];return db['CmContact'][_0x488c('0x40')](_0x297172,{'fields':_0x1973df,'raw':!![]});}})[_0x488c('0xc')](function(_0xe4fac6){_0x1d9d5c[_0x488c('0x41')]=_0xe4fac6;if(_0xe4fac6){var _0x3a5672={'ContactId':_0xe4fac6['id'],'FaxAccountId':_0x47f793[_0x488c('0x35')]['id'],'fax':_0xe4fac6[_0x488c('0x22')]};return db[_0x488c('0x42')][_0x488c('0x43')]({'where':{'ContactId':_0xe4fac6['id'],'closed':![],'FaxAccountId':_0x47f793[_0x488c('0x35')]['id']}})[_0x488c('0xc')](function(_0x52f488){if(_0x52f488){return[_0x52f488,![]];}return db['FaxInteraction'][_0x488c('0x40')](_0x3a5672)['then'](function(_0x1b6c39){return[_0x1b6c39,!![]];});});}else{throw new Error(_0x488c('0x44'));}})[_0x488c('0x45')](function(_0x32d0e4,_0x375299){var _0x414c34=_0x32d0e4[_0x488c('0x3c')]({'plain':!![]});if(_0x375299){if(_0x1d9d5c[_0x488c('0x35')][_0x488c('0x46')]){_0x1d9d5c[_0x488c('0x3e')]['push']({'id':0x0,'priority':_0x1d9d5c[_0x488c('0x3e')][_0x488c('0x3f')]+0x1,'app':_0x488c('0x47'),'appdata':_0x488c('0x48'),'interval':_0x488c('0x49')});}_0x414c34[_0x488c('0x4a')]=!![];}else{_0x414c34[_0x488c('0x4a')]=![];}_0x1d9d5c[_0x488c('0x4b')]=_0x414c34;return db[_0x488c('0x4c')][_0x488c('0x40')]({'body':_0x47f793[_0x488c('0x21')][_0x488c('0x21')],'FaxAccountId':_0x47f793[_0x488c('0x35')]['id'],'FaxInteractionId':_0x32d0e4['id'],'direction':'in','ContactId':_0x32d0e4[_0x488c('0x4d')],'AttachmentId':_0x47f793['body']['AttachmentId']});})[_0x488c('0xc')](function(_0x4b57ad){_0x1d9d5c[_0x488c('0x14')]=_0x4b57ad;if(_0x1d9d5c[_0x488c('0x4b')][_0x488c('0x4e')]){return db[_0x488c('0x4f')][_0x488c('0x43')]({'attributes':['id',_0x488c('0x50')],'where':{'id':_0x1d9d5c[_0x488c('0x4b')][_0x488c('0x4e')]}})[_0x488c('0xc')](function(_0x46918f){if(_0x46918f){_0x1d9d5c['applications'][_0x488c('0x51')]({'id':0x0,'priority':0x0,'app':_0x488c('0x52'),'appdata':_0x46918f[_0x488c('0x50')]+','+(_0x1d9d5c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x488c('0x49')});}return respondWithRpcPromise(_0x488c('0x53'),_0x488c('0x54'),_0x1d9d5c);});}return respondWithRpcPromise(_0x488c('0x53'),_0x488c('0x54'),_0x1d9d5c);})[_0x488c('0xc')](function(_0x31b753){_0x5a59da(_0x31b753);})[_0x488c('0x1f')](function(_0x22a609){_0x311fdf(_0x1f9038[_0x488c('0x12')](0x1f4,_0x22a609['message']));});});}; \ No newline at end of file +var _0xccc0=['createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','AttachmentId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','where','limit','include','map','model','attributes','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys'];(function(_0x5445c7,_0x588725){var _0x244494=function(_0x4ebd3d){while(--_0x4ebd3d){_0x5445c7['push'](_0x5445c7['shift']());}};_0x244494(++_0x588725);}(_0xccc0,0x1ec));var _0x0ccc=function(_0x2fe5ff,_0x44310c){_0x2fe5ff=_0x2fe5ff-0x0;var _0x3b1cb7=_0xccc0[_0x2fe5ff];return _0x3b1cb7;};'use strict';var _=require(_0x0ccc('0x0'));var util=require(_0x0ccc('0x1'));var moment=require(_0x0ccc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ccc('0x3'));var db=require(_0x0ccc('0x4'))['db'];var utils=require(_0x0ccc('0x5'));var logger=require(_0x0ccc('0x6'))(_0x0ccc('0x7'));var config=require(_0x0ccc('0x8'));var jayson=require(_0x0ccc('0x9'));var client=jayson[_0x0ccc('0xa')][_0x0ccc('0xb')]({'port':0x232c});config['redis']=_[_0x0ccc('0xc')](config[_0x0ccc('0xd')],{'host':_0x0ccc('0xe'),'port':0x18eb});var socket=require(_0x0ccc('0xf'))(new Redis(config[_0x0ccc('0xd')]));require(_0x0ccc('0x10'))[_0x0ccc('0x11')](socket);function respondWithRpcPromise(_0x1379e1,_0x59e6ba,_0x115c51){return new BPromise(function(_0x59d8e3,_0x176e29){return client['request'](_0x1379e1,_0x115c51)[_0x0ccc('0x12')](function(_0x735be9){logger['info'](_0x0ccc('0x13'),_0x59e6ba,_0x0ccc('0x14'));logger[_0x0ccc('0x15')](_0x0ccc('0x16'),_0x59e6ba,_0x0ccc('0x14'),JSON[_0x0ccc('0x17')](_0x735be9));if(_0x735be9[_0x0ccc('0x18')]){if(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x19')]===0x1f4){logger['error'](_0x0ccc('0x13'),_0x59e6ba,_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);return _0x176e29(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);}logger[_0x0ccc('0x18')](_0x0ccc('0x13'),_0x59e6ba,_0x735be9[_0x0ccc('0x18')]['message']);return _0x59d8e3(_0x735be9[_0x0ccc('0x18')][_0x0ccc('0x1a')]);}else{logger['info'](_0x0ccc('0x13'),_0x59e6ba,'request\x20sent');_0x59d8e3(_0x735be9[_0x0ccc('0x1b')]['message']);}})[_0x0ccc('0x1c')](function(_0x113d29){logger[_0x0ccc('0x18')](_0x0ccc('0x13'),_0x59e6ba,_0x113d29);_0x176e29(_0x113d29);});});}exports['GetFaxAccount']=function(_0x5c9832){var _0x58376d=this;return new Promise(function(_0x19adc0,_0x2fce43){return db[_0x0ccc('0x1d')][_0x0ccc('0x1e')]({'raw':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832[_0x0ccc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5c9832['options']?_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x20')]||null:null,'attributes':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832[_0x0ccc('0x1f')]['attributes']||null:null,'limit':_0x5c9832['options']?_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x21')]||null:null,'include':_0x5c9832[_0x0ccc('0x1f')]?_0x5c9832['options'][_0x0ccc('0x22')]?_[_0x0ccc('0x23')](_0x5c9832[_0x0ccc('0x1f')][_0x0ccc('0x22')],function(_0xfda225){return{'model':db[_0xfda225[_0x0ccc('0x24')]],'as':_0xfda225['as'],'attributes':_0xfda225[_0x0ccc('0x25')],'include':_0xfda225[_0x0ccc('0x22')]?_[_0x0ccc('0x23')](_0xfda225['include'],function(_0x1df8b5){return{'model':db[_0x1df8b5[_0x0ccc('0x24')]],'as':_0x1df8b5['as'],'attributes':_0x1df8b5['attributes'],'include':_0x1df8b5['include']?_[_0x0ccc('0x23')](_0x1df8b5[_0x0ccc('0x22')],function(_0x18674e){return{'model':db[_0x18674e[_0x0ccc('0x24')]],'as':_0x18674e['as'],'attributes':_0x18674e[_0x0ccc('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0ccc('0x12')](function(_0x218081){logger['info'](_0x0ccc('0x26'),_0x5c9832);logger[_0x0ccc('0x15')](_0x0ccc('0x26'),_0x5c9832,JSON[_0x0ccc('0x17')](_0x218081));_0x19adc0(_0x218081);})[_0x0ccc('0x1c')](function(_0x56ab56){logger[_0x0ccc('0x18')](_0x0ccc('0x26'),_0x56ab56[_0x0ccc('0x1a')],_0x5c9832);_0x2fce43(_0x58376d[_0x0ccc('0x18')](0x1f4,_0x56ab56['message']));});});};exports[_0x0ccc('0x27')]=function(_0x46ab97,_0x3f219f,_0x3034e9){var _0x1b2730=this;return new Promise(function(_0x4b103c,_0x31ae85){var _0x104df3={'body':_0x46ab97[_0x0ccc('0x28')],'channel':_0x0ccc('0x29')};var _0x2c5ec0=[];var _0x2ff4f3=[];var _0x24edd5={};return db[_0x0ccc('0x2a')][_0x0ccc('0x2b')]()[_0x0ccc('0x12')](function(_0x4940dc){if(!_0x4940dc){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))]('no\x20available\x20attributes');}_0x2c5ec0=_[_0x0ccc('0x2e')](_[_0x0ccc('0x2f')](_0x4940dc),[_0x0ccc('0x30'),_0x0ccc('0x31')]);_0x2ff4f3=_[_0x0ccc('0x2e')](_[_0x0ccc('0x2f')](_0x4940dc),[_0x0ccc('0x30'),_0x0ccc('0x31'),_0x0ccc('0x32'),'ListId']);if(_0x46ab97[_0x0ccc('0x28')]['id']){delete _0x46ab97['body']['id'];}if(_[_0x0ccc('0x33')](_0x46ab97[_0x0ccc('0x28')]['from'])){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x34'));}if(_['isNil'](_0x46ab97['body'][_0x0ccc('0x28')])||_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x28')]===''){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x35'));}if(_[_0x0ccc('0x33')](_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x36')])){throw new db[(_0x0ccc('0x2c'))][(_0x0ccc('0x2d'))](_0x0ccc('0x37')+_0x2ff4f3);}if(!_['includes'](_0x2ff4f3,_0x46ab97[_0x0ccc('0x28')]['mapKey'])){throw new db[(_0x0ccc('0x2c'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ff4f3);}_0x24edd5[_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x36')]]=_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')];})[_0x0ccc('0x12')](function(){return db[_0x0ccc('0x1d')][_0x0ccc('0x39')]({'where':{'id':_0x46ab97[_0x0ccc('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x0ccc('0x3b'),'where':_0x24edd5,'limit':0x1,'order':[[_0x0ccc('0x31'),_0x0ccc('0x3c')]]}]},{'model':db[_0x0ccc('0x3d')],'as':_0x0ccc('0x3e')}]});})['then'](function(_0x14851f){if(_0x14851f&&_0x14851f[_0x0ccc('0x3f')]){var _0x3fa69e=_0x14851f[_0x0ccc('0x40')]({'plain':!![]});_0x104df3[_0x0ccc('0x3a')]=_0x3fa69e;_0x104df3[_0x0ccc('0x41')]=_0x3fa69e[_0x0ccc('0x3e')];_0x104df3[_0x0ccc('0x42')]=_0x3fa69e[_0x0ccc('0x3f')];_0x104df3['applications']=_[_0x0ccc('0x43')](_0x104df3[_0x0ccc('0x41')],[_0x0ccc('0x44')],[_0x0ccc('0x45')]);if(_0x104df3[_0x0ccc('0x3a')][_0x0ccc('0x3e')]){delete _0x104df3['account'][_0x0ccc('0x3e')];}if(_0x104df3['account'][_0x0ccc('0x3f')]&&_0x104df3['account'][_0x0ccc('0x3f')]['Contacts']['length']){return _0x104df3[_0x0ccc('0x3a')][_0x0ccc('0x3f')][_0x0ccc('0x3b')][0x0];}var _0x4ac6e4=_['defaults'](_0x46ab97[_0x0ccc('0x28')],{'firstName':_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')],'ListId':_0x3fa69e[_0x0ccc('0x46')]});_0x4ac6e4[_0x46ab97[_0x0ccc('0x28')]['mapKey']]=_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x38')];return db[_0x0ccc('0x2a')][_0x0ccc('0x47')](_0x4ac6e4,{'fields':_0x2c5ec0,'raw':!![]});}})[_0x0ccc('0x12')](function(_0x56d510){_0x104df3['contact']=_0x56d510;if(_0x56d510){var _0x40d583={'ContactId':_0x56d510['id'],'FaxAccountId':_0x46ab97[_0x0ccc('0x3a')]['id'],'fax':_0x56d510[_0x0ccc('0x29')]};return db[_0x0ccc('0x48')][_0x0ccc('0x39')]({'where':{'ContactId':_0x56d510['id'],'closed':![],'FaxAccountId':_0x46ab97['account']['id']}})[_0x0ccc('0x12')](function(_0x472ce7){if(_0x472ce7){return[_0x472ce7,![]];}return db[_0x0ccc('0x48')]['create'](_0x40d583)['then'](function(_0xd6f129){return[_0xd6f129,!![]];});});}else{throw new Error(_0x0ccc('0x49'));}})[_0x0ccc('0x4a')](function(_0xa58e24,_0x4eaf09){var _0x2a7b30=_0xa58e24[_0x0ccc('0x40')]({'plain':!![]});if(_0x4eaf09){if(_0x104df3['account'][_0x0ccc('0x4b')]){_0x104df3[_0x0ccc('0x41')][_0x0ccc('0x4c')]({'id':0x0,'priority':_0x104df3[_0x0ccc('0x41')]['length']+0x1,'app':_0x0ccc('0x4d'),'appdata':_0x0ccc('0x4e'),'interval':_0x0ccc('0x4f')});}_0x2a7b30[_0x0ccc('0x50')]=!![];}else{_0x2a7b30['created']=![];}_0x104df3['interaction']=_0x2a7b30;return db['FaxMessage'][_0x0ccc('0x47')]({'body':_0x46ab97[_0x0ccc('0x28')][_0x0ccc('0x28')],'FaxAccountId':_0x46ab97[_0x0ccc('0x3a')]['id'],'FaxInteractionId':_0xa58e24['id'],'direction':'in','ContactId':_0xa58e24[_0x0ccc('0x51')],'AttachmentId':_0x46ab97['body'][_0x0ccc('0x52')]});})['then'](function(_0x244ac7){_0x104df3[_0x0ccc('0x1a')]=_0x244ac7;if(_0x104df3['interaction']['UserId']){return db[_0x0ccc('0x53')][_0x0ccc('0x39')]({'attributes':['id',_0x0ccc('0x54')],'where':{'id':_0x104df3['interaction']['UserId']}})[_0x0ccc('0x12')](function(_0x3ac8e5){if(_0x3ac8e5){_0x104df3[_0x0ccc('0x41')][_0x0ccc('0x55')]({'id':0x0,'priority':0x0,'app':_0x0ccc('0x56'),'appdata':_0x3ac8e5[_0x0ccc('0x54')]+','+(_0x104df3['account'][_0x0ccc('0x57')]||0xa),'interval':_0x0ccc('0x4f')});}return respondWithRpcPromise('Start',_0x0ccc('0x58'),_0x104df3);});}return respondWithRpcPromise(_0x0ccc('0x59'),_0x0ccc('0x58'),_0x104df3);})['then'](function(_0x3a7160){_0x4b103c(_0x3a7160);})['catch'](function(_0x255292){_0x31ae85(_0x1b2730[_0x0ccc('0x18')](0x1f4,_0x255292['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9c2f4ee..f9c0541 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 _0xb08a=['length','update','emit','removeListener'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xb08a,0x155));var _0xab08=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0xb08a[_0xfb0281];return _0x408dd3;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0xab08('0x0')];function createListener(_0x297646,_0x2a5045){return function(_0x1e09c4){_0x2a5045[_0xab08('0x1')](_0x297646,_0x1e09c4);};}function removeListener(_0x4c6fc9,_0x474d86){return function(){FaxAccountEvents[_0xab08('0x2')](_0x4c6fc9,_0x474d86);};}exports['register']=function(_0x2009d8){for(var _0x295790=0x0,_0x7575ad=events[_0xab08('0x3')];_0x295790<_0x7575ad;_0x295790++){var _0x4dd781=events[_0x295790];var _0x3d0d92=createListener('faxAccount:'+_0x4dd781,_0x2009d8);FaxAccountEvents['on'](_0x4dd781,_0x3d0d92);}}; \ No newline at end of file +var _0x0679=['update','emit','removeListener','register','faxAccount:','save','remove'];(function(_0x4630ff,_0x496879){var _0x39d052=function(_0x29099e){while(--_0x29099e){_0x4630ff['push'](_0x4630ff['shift']());}};_0x39d052(++_0x496879);}(_0x0679,0xbb));var _0x9067=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0679[_0x166742];return _0xb7814a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x9067('0x0'),_0x9067('0x1'),_0x9067('0x2')];function createListener(_0xf892df,_0x33a922){return function(_0x3d480d){_0x33a922[_0x9067('0x3')](_0xf892df,_0x3d480d);};}function removeListener(_0x2cce73,_0x2fff61){return function(){FaxAccountEvents[_0x9067('0x4')](_0x2cce73,_0x2fff61);};}exports[_0x9067('0x5')]=function(_0x27c372){for(var _0xc03e99=0x0,_0x22f5c1=events['length'];_0xc03e99<_0x22f5c1;_0xc03e99++){var _0xb86bb1=events[_0xc03e99];var _0x4da69f=createListener(_0x9067('0x6')+_0xb86bb1,_0x27c372);FaxAccountEvents['on'](_0xb86bb1,_0x4da69f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 24fc5c5..964ce29 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(_0x434941,_0x4f3659){var _0x1f0301=function(_0x2267b7){while(--_0x2267b7){_0x434941['push'](_0x434941['shift']());}};_0x1f0301(++_0x4f3659);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x1f21f7,_0x34eda3){var _0x276ed6=function(_0x1e7737){while(--_0x1e7737){_0x1f21f7['push'](_0x1f21f7['shift']());}};_0x276ed6(++_0x34eda3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 1b1b132..a20bae0 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 _0x6c0a=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x6c0a,0xe7));var _0xa6c0=function(_0x1070fc,_0x3c83a7){_0x1070fc=_0x1070fc-0x0;var _0x53b7f6=_0x6c0a[_0x1070fc];return _0x53b7f6;};'use strict';var Sequelize=require(_0xa6c0('0x0'));module[_0xa6c0('0x1')]={'priority':{'type':Sequelize[_0xa6c0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa6c0('0x3')]()},'description':{'type':Sequelize[_0xa6c0('0x4')]},'interval':{'type':Sequelize[_0xa6c0('0x4')],'defaultValue':_0xa6c0('0x5')}}; \ No newline at end of file +var _0x6656=['noop','*,*,*,*','STRING'];(function(_0x22c178,_0x3eedf0){var _0x4c4f43=function(_0x1044bc){while(--_0x1044bc){_0x22c178['push'](_0x22c178['shift']());}};_0x4c4f43(++_0x3eedf0);}(_0x6656,0x16a));var _0x6665=function(_0x221808,_0x4e6ee5){_0x221808=_0x221808-0x0;var _0x26c697=_0x6656[_0x221808];return _0x26c697;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6665('0x0')],'allowNull':![],'defaultValue':_0x6665('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6665('0x0')],'defaultValue':_0x6665('0x2')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3474c29..c2c64fb 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 _0xb213=['bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','then','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xb213,0x8b));var _0x3b21=function(_0x283ef3,_0x136ad1){_0x283ef3=_0x283ef3-0x0;var _0x1d4c24=_0xb213[_0x283ef3];return _0x1d4c24;};'use strict';var emlformat=require(_0x3b21('0x0'));var rimraf=require(_0x3b21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b21('0x2'));var rp=require(_0x3b21('0x3'));var moment=require(_0x3b21('0x4'));var BPromise=require(_0x3b21('0x5'));var Mustache=require('mustache');var util=require(_0x3b21('0x6'));var path=require(_0x3b21('0x7'));var sox=require(_0x3b21('0x8'));var csv=require(_0x3b21('0x9'));var ejs=require(_0x3b21('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b21('0xb'));var squel=require('squel');var crypto=require(_0x3b21('0xc'));var jsforce=require(_0x3b21('0xd'));var deskjs=require(_0x3b21('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3b21('0xf'));var Papa=require(_0x3b21('0x10'));var Redis=require('ioredis');var authService=require(_0x3b21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3b21('0x12'));var hardwareService=require(_0x3b21('0x13'));var logger=require(_0x3b21('0x14'))(_0x3b21('0x15'));var utils=require(_0x3b21('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b21('0x17'));var db=require(_0x3b21('0x18'))['db'];function respondWithStatusCode(_0x23f307,_0x28bc8b){_0x28bc8b=_0x28bc8b||0xcc;return function(_0x3ead76){if(_0x3ead76){return _0x23f307[_0x3b21('0x19')](_0x28bc8b);}return _0x23f307['status'](_0x28bc8b)[_0x3b21('0x1a')]();};}function respondWithResult(_0x430bb7,_0x22e765){_0x22e765=_0x22e765||0xc8;return function(_0x4c3be3){if(_0x4c3be3){return _0x430bb7[_0x3b21('0x1b')](_0x22e765)[_0x3b21('0x1c')](_0x4c3be3);}};}function respondWithFilteredResult(_0x552aca,_0x51ec72){return function(_0x155a82){if(_0x155a82){var _0x1e2386=typeof _0x51ec72['offset']===_0x3b21('0x1d')&&typeof _0x51ec72[_0x3b21('0x1e')]==='undefined';var _0x4d0392=_0x155a82[_0x3b21('0x1f')];var _0x43de73=_0x1e2386?0x0:_0x51ec72[_0x3b21('0x20')];var _0x2a6aae=_0x1e2386?_0x155a82['count']:_0x51ec72['offset']+_0x51ec72[_0x3b21('0x1e')];var _0xb8d3a4;if(_0x2a6aae>=_0x4d0392){_0x2a6aae=_0x4d0392;_0xb8d3a4=0xc8;}else{_0xb8d3a4=0xce;}_0x552aca[_0x3b21('0x1b')](_0xb8d3a4);return _0x552aca[_0x3b21('0x21')]('Content-Range',_0x43de73+'-'+_0x2a6aae+'/'+_0x4d0392)[_0x3b21('0x1c')](_0x155a82);}return null;};}function patchUpdates(_0x4d215b){return function(_0x47d886){try{jsonpatch[_0x3b21('0x22')](_0x47d886,_0x4d215b,!![]);}catch(_0xc80327){return BPromise['reject'](_0xc80327);}return _0x47d886[_0x3b21('0x23')]();};}function saveUpdates(_0x2ad9b5,_0x358125){return function(_0x30a71){if(_0x30a71){return _0x30a71[_0x3b21('0x24')](_0x2ad9b5)['then'](function(_0x1c57e3){return _0x1c57e3;});}return null;};}function removeEntity(_0x436bf7,_0x3081c3){return function(_0x3a1e13){if(_0x3a1e13){return _0x3a1e13[_0x3b21('0x25')]()[_0x3b21('0x26')](function(){_0x436bf7[_0x3b21('0x1b')](0xcc)[_0x3b21('0x1a')]();});}};}function handleEntityNotFound(_0x5f50f5,_0x185d3f){return function(_0x37f9b3){if(!_0x37f9b3){_0x5f50f5[_0x3b21('0x19')](0x194);}return _0x37f9b3;};}function handleError(_0x5c5b9e,_0x5b8e13){_0x5b8e13=_0x5b8e13||0x1f4;return function(_0x2041b7){logger[_0x3b21('0x27')](_0x2041b7[_0x3b21('0x28')]);if(_0x2041b7['name']){delete _0x2041b7[_0x3b21('0x29')];}_0x5c5b9e['status'](_0x5b8e13)[_0x3b21('0x2a')](_0x2041b7);};}exports['index']=function(_0x520e83,_0x17d31e){var _0x53598f={},_0x45a51c={},_0x197fc8={'count':0x0,'rows':[]};var _0x33f5e2=_[_0x3b21('0x2b')](db[_0x3b21('0x2c')][_0x3b21('0x2d')],function(_0x2f0940){return{'name':_0x2f0940[_0x3b21('0x2e')],'type':_0x2f0940[_0x3b21('0x2f')][_0x3b21('0x30')]};});_0x45a51c[_0x3b21('0x31')]=_[_0x3b21('0x2b')](_0x33f5e2,_0x3b21('0x29'));_0x45a51c[_0x3b21('0x32')]=_[_0x3b21('0x33')](_0x520e83[_0x3b21('0x32')]);_0x45a51c[_0x3b21('0x34')]=_[_0x3b21('0x35')](_0x45a51c['model'],_0x45a51c[_0x3b21('0x32')]);_0x53598f[_0x3b21('0x36')]=_['intersection'](_0x45a51c[_0x3b21('0x31')],qs[_0x3b21('0x37')](_0x520e83[_0x3b21('0x32')][_0x3b21('0x37')]));_0x53598f['attributes']=_0x53598f[_0x3b21('0x36')][_0x3b21('0x38')]?_0x53598f['attributes']:_0x45a51c[_0x3b21('0x31')];if(!_0x520e83['query']['hasOwnProperty'](_0x3b21('0x39'))){_0x53598f[_0x3b21('0x1e')]=qs[_0x3b21('0x1e')](_0x520e83[_0x3b21('0x32')][_0x3b21('0x1e')]);_0x53598f['offset']=qs[_0x3b21('0x20')](_0x520e83[_0x3b21('0x32')][_0x3b21('0x20')]);}_0x53598f[_0x3b21('0x3a')]=qs['sort'](_0x520e83[_0x3b21('0x32')][_0x3b21('0x3b')]);_0x53598f[_0x3b21('0x3c')]=qs[_0x3b21('0x34')](_['pick'](_0x520e83[_0x3b21('0x32')],_0x45a51c['filters']),_0x33f5e2);if(_0x520e83[_0x3b21('0x32')][_0x3b21('0x3d')]){_0x53598f[_0x3b21('0x3c')]=_[_0x3b21('0x3e')](_0x53598f[_0x3b21('0x3c')],{'$or':_[_0x3b21('0x2b')](_0x33f5e2,function(_0xed2bdf){if(_0xed2bdf[_0x3b21('0x2f')]!==_0x3b21('0x3f')){var _0x27e5b7={};_0x27e5b7[_0xed2bdf[_0x3b21('0x29')]]={'$like':'%'+_0x520e83[_0x3b21('0x32')][_0x3b21('0x3d')]+'%'};return _0x27e5b7;}})});}_0x53598f=_[_0x3b21('0x3e')]({},_0x53598f,_0x520e83[_0x3b21('0x40')]);var _0x28cad4={'where':_0x53598f[_0x3b21('0x3c')]};return db['FaxApplication'][_0x3b21('0x1f')](_0x28cad4)['then'](function(_0x1d54a8){_0x197fc8[_0x3b21('0x1f')]=_0x1d54a8;if(_0x520e83['query'][_0x3b21('0x41')]){_0x53598f['include']=[{'all':!![]}];}return db[_0x3b21('0x2c')]['findAll'](_0x53598f);})[_0x3b21('0x26')](function(_0x3366e5){_0x197fc8[_0x3b21('0x42')]=_0x3366e5;return _0x197fc8;})['then'](respondWithFilteredResult(_0x17d31e,_0x53598f))[_0x3b21('0x43')](handleError(_0x17d31e,null));};exports['show']=function(_0x5ef64f,_0x404391){var _0x24b932={'raw':!![],'where':{'id':_0x5ef64f[_0x3b21('0x44')]['id']}},_0x2a6e5c={};_0x2a6e5c['model']=_[_0x3b21('0x33')](db[_0x3b21('0x2c')][_0x3b21('0x2d')]);_0x2a6e5c[_0x3b21('0x32')]=_[_0x3b21('0x33')](_0x5ef64f[_0x3b21('0x32')]);_0x2a6e5c['filters']=_['intersection'](_0x2a6e5c['model'],_0x2a6e5c[_0x3b21('0x32')]);_0x24b932['attributes']=_[_0x3b21('0x35')](_0x2a6e5c['model'],qs[_0x3b21('0x37')](_0x5ef64f[_0x3b21('0x32')][_0x3b21('0x37')]));_0x24b932[_0x3b21('0x36')]=_0x24b932[_0x3b21('0x36')][_0x3b21('0x38')]?_0x24b932['attributes']:_0x2a6e5c[_0x3b21('0x31')];if(_0x5ef64f['query'][_0x3b21('0x41')]){_0x24b932[_0x3b21('0x45')]=[{'all':!![]}];}_0x24b932=_['merge']({},_0x24b932,_0x5ef64f[_0x3b21('0x40')]);return db[_0x3b21('0x2c')][_0x3b21('0x46')](_0x24b932)[_0x3b21('0x26')](handleEntityNotFound(_0x404391,null))[_0x3b21('0x26')](respondWithResult(_0x404391,null))[_0x3b21('0x43')](handleError(_0x404391,null));};exports['create']=function(_0x5a098f,_0x7e2386){return db['FaxApplication']['create'](_0x5a098f['body'],{})[_0x3b21('0x26')](respondWithResult(_0x7e2386,0xc9))[_0x3b21('0x43')](handleError(_0x7e2386,null));};exports['update']=function(_0x519ed3,_0x576eaf){if(_0x519ed3[_0x3b21('0x47')]['id']){delete _0x519ed3['body']['id'];}return db['FaxApplication'][_0x3b21('0x46')]({'where':{'id':_0x519ed3[_0x3b21('0x44')]['id']}})['then'](handleEntityNotFound(_0x576eaf,null))['then'](saveUpdates(_0x519ed3[_0x3b21('0x47')],null))[_0x3b21('0x26')](respondWithResult(_0x576eaf,null))[_0x3b21('0x43')](handleError(_0x576eaf,null));};exports[_0x3b21('0x25')]=function(_0x1020e7,_0x12d01a){return db[_0x3b21('0x2c')][_0x3b21('0x46')]({'where':{'id':_0x1020e7[_0x3b21('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d01a,null))['then'](removeEntity(_0x12d01a,null))[_0x3b21('0x43')](handleError(_0x12d01a,null));}; \ No newline at end of file +var _0x7cae=['destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','count','include','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x7cae,0x151));var _0xe7ca=function(_0x3de8a7,_0x57b636){_0x3de8a7=_0x3de8a7-0x0;var _0x370464=_0x7cae[_0x3de8a7];return _0x370464;};'use strict';var emlformat=require(_0xe7ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7ca('0x1'));var jsonpatch=require(_0xe7ca('0x2'));var rp=require(_0xe7ca('0x3'));var moment=require(_0xe7ca('0x4'));var BPromise=require(_0xe7ca('0x5'));var Mustache=require(_0xe7ca('0x6'));var util=require('util');var path=require(_0xe7ca('0x7'));var sox=require(_0xe7ca('0x8'));var csv=require('to-csv');var ejs=require(_0xe7ca('0x9'));var fs=require('fs');var fs_extra=require(_0xe7ca('0xa'));var _=require(_0xe7ca('0xb'));var squel=require(_0xe7ca('0xc'));var crypto=require(_0xe7ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe7ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe7ca('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7ca('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe7ca('0x11'));var hardwareService=require(_0xe7ca('0x12'));var logger=require(_0xe7ca('0x13'))(_0xe7ca('0x14'));var utils=require(_0xe7ca('0x15'));var config=require(_0xe7ca('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ca('0x17'))['db'];function respondWithStatusCode(_0x1d162b,_0x527720){_0x527720=_0x527720||0xcc;return function(_0xed4820){if(_0xed4820){return _0x1d162b[_0xe7ca('0x18')](_0x527720);}return _0x1d162b['status'](_0x527720)[_0xe7ca('0x19')]();};}function respondWithResult(_0x55c1bf,_0x33b7c8){_0x33b7c8=_0x33b7c8||0xc8;return function(_0x4a8173){if(_0x4a8173){return _0x55c1bf['status'](_0x33b7c8)[_0xe7ca('0x1a')](_0x4a8173);}};}function respondWithFilteredResult(_0x289e14,_0x335f54){return function(_0x1c952c){if(_0x1c952c){var _0x1c4f20=typeof _0x335f54[_0xe7ca('0x1b')]===_0xe7ca('0x1c')&&typeof _0x335f54[_0xe7ca('0x1d')]==='undefined';var _0x3b67d8=_0x1c952c['count'];var _0xe49a0a=_0x1c4f20?0x0:_0x335f54['offset'];var _0x5a3d3c=_0x1c4f20?_0x1c952c['count']:_0x335f54[_0xe7ca('0x1b')]+_0x335f54[_0xe7ca('0x1d')];var _0x2512a1;if(_0x5a3d3c>=_0x3b67d8){_0x5a3d3c=_0x3b67d8;_0x2512a1=0xc8;}else{_0x2512a1=0xce;}_0x289e14[_0xe7ca('0x1e')](_0x2512a1);return _0x289e14[_0xe7ca('0x1f')](_0xe7ca('0x20'),_0xe49a0a+'-'+_0x5a3d3c+'/'+_0x3b67d8)[_0xe7ca('0x1a')](_0x1c952c);}return null;};}function patchUpdates(_0x4f91a1){return function(_0x143033){try{jsonpatch[_0xe7ca('0x21')](_0x143033,_0x4f91a1,!![]);}catch(_0x41aa3c){return BPromise[_0xe7ca('0x22')](_0x41aa3c);}return _0x143033[_0xe7ca('0x23')]();};}function saveUpdates(_0xdd4fb8,_0x5c9c9b){return function(_0x4c55b5){if(_0x4c55b5){return _0x4c55b5[_0xe7ca('0x24')](_0xdd4fb8)[_0xe7ca('0x25')](function(_0x3b1118){return _0x3b1118;});}return null;};}function removeEntity(_0x374865,_0x32435a){return function(_0x466628){if(_0x466628){return _0x466628[_0xe7ca('0x26')]()[_0xe7ca('0x25')](function(){_0x374865[_0xe7ca('0x1e')](0xcc)[_0xe7ca('0x19')]();});}};}function handleEntityNotFound(_0x588f5e,_0x2c2c9a){return function(_0x42117a){if(!_0x42117a){_0x588f5e[_0xe7ca('0x18')](0x194);}return _0x42117a;};}function handleError(_0x1a7be8,_0x4ca6ed){_0x4ca6ed=_0x4ca6ed||0x1f4;return function(_0x39e5e5){logger[_0xe7ca('0x27')](_0x39e5e5[_0xe7ca('0x28')]);if(_0x39e5e5['name']){delete _0x39e5e5[_0xe7ca('0x29')];}_0x1a7be8['status'](_0x4ca6ed)[_0xe7ca('0x2a')](_0x39e5e5);};}exports['index']=function(_0x50942b,_0x571c3){var _0x45b3bf={},_0x4e6b23={},_0x3ac989={'count':0x0,'rows':[]};var _0x5eac65=_[_0xe7ca('0x2b')](db[_0xe7ca('0x2c')][_0xe7ca('0x2d')],function(_0x37c900){return{'name':_0x37c900[_0xe7ca('0x2e')],'type':_0x37c900['type'][_0xe7ca('0x2f')]};});_0x4e6b23[_0xe7ca('0x30')]=_[_0xe7ca('0x2b')](_0x5eac65,_0xe7ca('0x29'));_0x4e6b23['query']=_[_0xe7ca('0x31')](_0x50942b[_0xe7ca('0x32')]);_0x4e6b23[_0xe7ca('0x33')]=_['intersection'](_0x4e6b23[_0xe7ca('0x30')],_0x4e6b23[_0xe7ca('0x32')]);_0x45b3bf['attributes']=_['intersection'](_0x4e6b23[_0xe7ca('0x30')],qs['fields'](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x34')]));_0x45b3bf[_0xe7ca('0x35')]=_0x45b3bf[_0xe7ca('0x35')]['length']?_0x45b3bf[_0xe7ca('0x35')]:_0x4e6b23[_0xe7ca('0x30')];if(!_0x50942b['query'][_0xe7ca('0x36')]('nolimit')){_0x45b3bf[_0xe7ca('0x1d')]=qs[_0xe7ca('0x1d')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x1d')]);_0x45b3bf['offset']=qs[_0xe7ca('0x1b')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x1b')]);}_0x45b3bf[_0xe7ca('0x37')]=qs[_0xe7ca('0x38')](_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x38')]);_0x45b3bf[_0xe7ca('0x39')]=qs[_0xe7ca('0x33')](_[_0xe7ca('0x3a')](_0x50942b[_0xe7ca('0x32')],_0x4e6b23[_0xe7ca('0x33')]),_0x5eac65);if(_0x50942b['query'][_0xe7ca('0x3b')]){_0x45b3bf[_0xe7ca('0x39')]=_[_0xe7ca('0x3c')](_0x45b3bf[_0xe7ca('0x39')],{'$or':_[_0xe7ca('0x2b')](_0x5eac65,function(_0x5066df){if(_0x5066df[_0xe7ca('0x3d')]!=='VIRTUAL'){var _0x45a661={};_0x45a661[_0x5066df[_0xe7ca('0x29')]]={'$like':'%'+_0x50942b[_0xe7ca('0x32')][_0xe7ca('0x3b')]+'%'};return _0x45a661;}})});}_0x45b3bf=_['merge']({},_0x45b3bf,_0x50942b[_0xe7ca('0x3e')]);var _0x3f9dd4={'where':_0x45b3bf[_0xe7ca('0x39')]};return db['FaxApplication'][_0xe7ca('0x3f')](_0x3f9dd4)[_0xe7ca('0x25')](function(_0x5ef401){_0x3ac989[_0xe7ca('0x3f')]=_0x5ef401;if(_0x50942b['query']['includeAll']){_0x45b3bf[_0xe7ca('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xe7ca('0x41')](_0x45b3bf);})['then'](function(_0x362b50){_0x3ac989[_0xe7ca('0x42')]=_0x362b50;return _0x3ac989;})[_0xe7ca('0x25')](respondWithFilteredResult(_0x571c3,_0x45b3bf))[_0xe7ca('0x43')](handleError(_0x571c3,null));};exports['show']=function(_0x46c481,_0x43c9c3){var _0x1ae8b6={'raw':!![],'where':{'id':_0x46c481[_0xe7ca('0x44')]['id']}},_0x5b3a13={};_0x5b3a13[_0xe7ca('0x30')]=_[_0xe7ca('0x31')](db[_0xe7ca('0x2c')]['rawAttributes']);_0x5b3a13[_0xe7ca('0x32')]=_[_0xe7ca('0x31')](_0x46c481[_0xe7ca('0x32')]);_0x5b3a13[_0xe7ca('0x33')]=_['intersection'](_0x5b3a13[_0xe7ca('0x30')],_0x5b3a13[_0xe7ca('0x32')]);_0x1ae8b6[_0xe7ca('0x35')]=_[_0xe7ca('0x45')](_0x5b3a13['model'],qs[_0xe7ca('0x34')](_0x46c481[_0xe7ca('0x32')][_0xe7ca('0x34')]));_0x1ae8b6[_0xe7ca('0x35')]=_0x1ae8b6[_0xe7ca('0x35')][_0xe7ca('0x46')]?_0x1ae8b6[_0xe7ca('0x35')]:_0x5b3a13[_0xe7ca('0x30')];if(_0x46c481['query'][_0xe7ca('0x47')]){_0x1ae8b6[_0xe7ca('0x40')]=[{'all':!![]}];}_0x1ae8b6=_[_0xe7ca('0x3c')]({},_0x1ae8b6,_0x46c481[_0xe7ca('0x3e')]);return db[_0xe7ca('0x2c')][_0xe7ca('0x48')](_0x1ae8b6)[_0xe7ca('0x25')](handleEntityNotFound(_0x43c9c3,null))[_0xe7ca('0x25')](respondWithResult(_0x43c9c3,null))[_0xe7ca('0x43')](handleError(_0x43c9c3,null));};exports[_0xe7ca('0x49')]=function(_0x472f64,_0x25eeff){return db[_0xe7ca('0x2c')]['create'](_0x472f64['body'],{})['then'](respondWithResult(_0x25eeff,0xc9))[_0xe7ca('0x43')](handleError(_0x25eeff,null));};exports[_0xe7ca('0x24')]=function(_0x404d65,_0x11fade){if(_0x404d65[_0xe7ca('0x4a')]['id']){delete _0x404d65[_0xe7ca('0x4a')]['id'];}return db[_0xe7ca('0x2c')]['find']({'where':{'id':_0x404d65[_0xe7ca('0x44')]['id']}})['then'](handleEntityNotFound(_0x11fade,null))[_0xe7ca('0x25')](saveUpdates(_0x404d65[_0xe7ca('0x4a')],null))[_0xe7ca('0x25')](respondWithResult(_0x11fade,null))[_0xe7ca('0x43')](handleError(_0x11fade,null));};exports['destroy']=function(_0x170004,_0x150d3e){return db['FaxApplication'][_0xe7ca('0x48')]({'where':{'id':_0x170004[_0xe7ca('0x44')]['id']}})[_0xe7ca('0x25')](handleEntityNotFound(_0x150d3e,null))[_0xe7ca('0x25')](removeEntity(_0x150d3e,null))[_0xe7ca('0x43')](handleError(_0x150d3e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 70faf57..d20f779 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 _0x4834=['exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x4834,0x166));var _0x4483=function(_0x3ea6aa,_0x2f6406){_0x3ea6aa=_0x3ea6aa-0x0;var _0x411f8c=_0x4834[_0x3ea6aa];return _0x411f8c;};'use strict';var _=require(_0x4483('0x0'));var util=require(_0x4483('0x1'));var logger=require(_0x4483('0x2'))(_0x4483('0x3'));var moment=require(_0x4483('0x4'));var BPromise=require('bluebird');var rp=require(_0x4483('0x5'));var fs=require('fs');var path=require(_0x4483('0x6'));var rimraf=require(_0x4483('0x7'));var config=require(_0x4483('0x8'));var attributes=require(_0x4483('0x9'));module[_0x4483('0xa')]=function(_0x467def,_0x182b1d){return _0x467def[_0x4483('0xb')](_0x4483('0xc'),attributes,{'tableName':_0x4483('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4483('0xe'),'collate':_0x4483('0xf')});}; \ No newline at end of file +var _0x581f=['request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x1185f0,_0x2e0dae){var _0x11358f=function(_0x319d80){while(--_0x319d80){_0x1185f0['push'](_0x1185f0['shift']());}};_0x11358f(++_0x2e0dae);}(_0x581f,0x11a));var _0xf581=function(_0x53eac2,_0x20c938){_0x53eac2=_0x53eac2-0x0;var _0x5f28e0=_0x581f[_0x53eac2];return _0x5f28e0;};'use strict';var _=require('lodash');var util=require(_0xf581('0x0'));var logger=require(_0xf581('0x1'))(_0xf581('0x2'));var moment=require(_0xf581('0x3'));var BPromise=require('bluebird');var rp=require(_0xf581('0x4'));var fs=require('fs');var path=require(_0xf581('0x5'));var rimraf=require(_0xf581('0x6'));var config=require(_0xf581('0x7'));var attributes=require('./faxApplication.attributes');module[_0xf581('0x8')]=function(_0x34592c,_0x416e31){return _0x34592c[_0xf581('0x9')](_0xf581('0xa'),attributes,{'tableName':_0xf581('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf581('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7a95211..aad9450 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 _0x3e06=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','stringify','lodash','util'];(function(_0x4788fa,_0xd6c28e){var _0x835143=function(_0x266968){while(--_0x266968){_0x4788fa['push'](_0x4788fa['shift']());}};_0x835143(++_0xd6c28e);}(_0x3e06,0x153));var _0x63e0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3e06[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var moment=require(_0x63e0('0x2'));var BPromise=require(_0x63e0('0x3'));var rs=require(_0x63e0('0x4'));var fs=require('fs');var Redis=require(_0x63e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x63e0('0x6'));var logger=require(_0x63e0('0x7'))(_0x63e0('0x8'));var config=require(_0x63e0('0x9'));var jayson=require(_0x63e0('0xa'));var client=jayson['client'][_0x63e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x467e91,_0xa6ae91,_0x29ad2e){return new BPromise(function(_0x20ba81,_0x2482fb){return client[_0x63e0('0xc')](_0x467e91,_0x29ad2e)[_0x63e0('0xd')](function(_0x4a7bf2){logger[_0x63e0('0xe')]('FaxApplication,\x20%s,\x20%s',_0xa6ae91,_0x63e0('0xf'));logger[_0x63e0('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xa6ae91,_0x63e0('0xf'),JSON['stringify'](_0x4a7bf2));if(_0x4a7bf2['error']){if(_0x4a7bf2[_0x63e0('0x11')]['code']===0x1f4){logger[_0x63e0('0x11')](_0x63e0('0x12'),_0xa6ae91,_0x4a7bf2['error'][_0x63e0('0x13')]);return _0x2482fb(_0x4a7bf2[_0x63e0('0x11')]['message']);}logger[_0x63e0('0x11')](_0x63e0('0x12'),_0xa6ae91,_0x4a7bf2['error'][_0x63e0('0x13')]);return _0x20ba81(_0x4a7bf2[_0x63e0('0x11')][_0x63e0('0x13')]);}else{logger[_0x63e0('0xe')](_0x63e0('0x12'),_0xa6ae91,_0x63e0('0xf'));_0x20ba81(_0x4a7bf2[_0x63e0('0x14')]['message']);}})[_0x63e0('0x15')](function(_0x4f0831){logger[_0x63e0('0x11')]('FaxApplication,\x20%s,\x20%s',_0xa6ae91,_0x4f0831);_0x2482fb(_0x4f0831);});});}exports[_0x63e0('0x16')]=function(_0x5b10bf){var _0x892942=this;return new Promise(function(_0x2a9400,_0x195911){return db[_0x63e0('0x17')]['update'](_0x5b10bf[_0x63e0('0x18')],{'raw':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1b')]||null:null,'attributes':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1c')]||null:null,'limit':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1d')]||null:null})[_0x63e0('0xd')](function(_0x4b9518){logger[_0x63e0('0xe')](_0x63e0('0x16'),_0x5b10bf);logger['debug'](_0x63e0('0x16'),_0x5b10bf,JSON[_0x63e0('0x1e')](_0x4b9518));_0x2a9400(_0x4b9518);})['catch'](function(_0x4aeb3a){logger[_0x63e0('0x11')]('UpdateFaxApplication',_0x4aeb3a[_0x63e0('0x13')],_0x5b10bf);_0x195911(_0x892942[_0x63e0('0x11')](0x1f4,_0x4aeb3a[_0x63e0('0x13')]));});});}; \ No newline at end of file +var _0xc7d3=['request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','body','options','raw','where','attributes','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x6cfdd2,_0x65105a){var _0x57d752=function(_0x565e29){while(--_0x565e29){_0x6cfdd2['push'](_0x6cfdd2['shift']());}};_0x57d752(++_0x65105a);}(_0xc7d3,0x8f));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3c7d('0x0'));var util=require('util');var moment=require(_0x3c7d('0x1'));var BPromise=require(_0x3c7d('0x2'));var rs=require(_0x3c7d('0x3'));var fs=require('fs');var Redis=require(_0x3c7d('0x4'));var db=require(_0x3c7d('0x5'))['db'];var utils=require(_0x3c7d('0x6'));var logger=require(_0x3c7d('0x7'))('rpc');var config=require(_0x3c7d('0x8'));var jayson=require(_0x3c7d('0x9'));var client=jayson[_0x3c7d('0xa')][_0x3c7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d022,_0x59653c,_0x2ca037){return new BPromise(function(_0x5e9370,_0x374cb8){return client[_0x3c7d('0xc')](_0x36d022,_0x2ca037)['then'](function(_0x3a9fa3){logger[_0x3c7d('0xd')](_0x3c7d('0xe'),_0x59653c,_0x3c7d('0xf'));logger[_0x3c7d('0x10')](_0x3c7d('0x11'),_0x59653c,_0x3c7d('0xf'),JSON[_0x3c7d('0x12')](_0x3a9fa3));if(_0x3a9fa3[_0x3c7d('0x13')]){if(_0x3a9fa3['error']['code']===0x1f4){logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x3a9fa3['error'][_0x3c7d('0x14')]);return _0x374cb8(_0x3a9fa3['error'][_0x3c7d('0x14')]);}logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x3a9fa3[_0x3c7d('0x13')][_0x3c7d('0x14')]);return _0x5e9370(_0x3a9fa3[_0x3c7d('0x13')]['message']);}else{logger['info'](_0x3c7d('0xe'),_0x59653c,_0x3c7d('0xf'));_0x5e9370(_0x3a9fa3[_0x3c7d('0x15')][_0x3c7d('0x14')]);}})[_0x3c7d('0x16')](function(_0x26a40c){logger[_0x3c7d('0x13')](_0x3c7d('0xe'),_0x59653c,_0x26a40c);_0x374cb8(_0x26a40c);});});}exports[_0x3c7d('0x17')]=function(_0xbabbbb){var _0x302a4d=this;return new Promise(function(_0xd618b,_0x5032c0){return db['FaxApplication']['update'](_0xbabbbb[_0x3c7d('0x18')],{'raw':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb['options'][_0x3c7d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb['options'][_0x3c7d('0x1b')]||null:null,'attributes':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb[_0x3c7d('0x19')][_0x3c7d('0x1c')]||null:null,'limit':_0xbabbbb[_0x3c7d('0x19')]?_0xbabbbb[_0x3c7d('0x19')][_0x3c7d('0x1d')]||null:null})[_0x3c7d('0x1e')](function(_0x1c0d3f){logger[_0x3c7d('0xd')](_0x3c7d('0x17'),_0xbabbbb);logger['debug'](_0x3c7d('0x17'),_0xbabbbb,JSON[_0x3c7d('0x12')](_0x1c0d3f));_0xd618b(_0x1c0d3f);})[_0x3c7d('0x16')](function(_0x1d8878){logger['error'](_0x3c7d('0x17'),_0x1d8878[_0x3c7d('0x14')],_0xbabbbb);_0x5032c0(_0x302a4d['error'](0x1f4,_0x1d8878['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e8b63b5..a868ffd 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 _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4be623,_0x10b35f){var _0x460936=function(_0x2ae31c){while(--_0x2ae31c){_0x4be623['push'](_0x4be623['shift']());}};_0x460936(++_0x10b35f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5e6bb2,_0x5478c6){_0x5e6bb2=_0x5e6bb2-0x0;var _0x43721e=_0x9c00[_0x5e6bb2];return _0x43721e;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./faxApplication.controller','get'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0xda2d,0x102));var _0xdda2=function(_0x290dd4,_0x22ed03){_0x290dd4=_0x290dd4-0x0;var _0x2e8619=_0xda2d[_0x290dd4];return _0x2e8619;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 760bb37..fd7cf4b 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 _0xd490=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x35d81a,_0x429b4c){var _0x385721=function(_0x491878){while(--_0x491878){_0x35d81a['push'](_0x35d81a['shift']());}};_0x385721(++_0x429b4c);}(_0xd490,0x14d));var _0x0d49=function(_0x3a62a0,_0x200152){_0x3a62a0=_0x3a62a0-0x0;var _0x53a893=_0xd490[_0x3a62a0];return _0x53a893;};'use strict';var Sequelize=require(_0x0d49('0x0'));module[_0x0d49('0x1')]={'closed':{'type':Sequelize[_0x0d49('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0d49('0x3')]},'disposition':{'type':Sequelize[_0x0d49('0x4')]},'secondDisposition':{'type':Sequelize[_0x0d49('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0d49('0x4')]},'note':{'type':Sequelize[_0x0d49('0x4')]},'read1stAt':{'type':Sequelize[_0x0d49('0x3')]},'fax':{'type':Sequelize[_0x0d49('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0d49('0x5')]('in',_0x0d49('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d49('0x5')]('in',_0x0d49('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x110d=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x110d,0x17d));var _0xd110=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0x110d[_0xb247e3];return _0x57fb7b;};'use strict';var Sequelize=require(_0xd110('0x0'));module[_0xd110('0x1')]={'closed':{'type':Sequelize[_0xd110('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd110('0x3')]},'disposition':{'type':Sequelize[_0xd110('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd110('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd110('0x3')]},'fax':{'type':Sequelize[_0xd110('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd110('0x5')]('in',_0xd110('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd110('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd110('0x5')]('in',_0xd110('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 0f53ae7..4e96588 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 _0xcb89=['key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','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','value','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`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','i.id','QueryTypes','clone','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','all','rows','show','params','includeAll','options','create','addMessage','FaxMessage','ids','getMessages','findOne','nolimit','merge','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','omit','emit','removeTags','download','unix','join','server','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','Tags','split','forEach','TagIds','catch','waiting','talking','answered','total','closed','UserId','unmanaged','index','FaxInteraction','rawAttributes','type'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xcb89,0x17f));var _0x9cb8=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xcb89[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require(_0x9cb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9cb8('0x1'));var jsonpatch=require(_0x9cb8('0x2'));var rp=require(_0x9cb8('0x3'));var moment=require('moment');var BPromise=require(_0x9cb8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9cb8('0x5'));var csv=require(_0x9cb8('0x6'));var ejs=require(_0x9cb8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9cb8('0x8'));var crypto=require(_0x9cb8('0x9'));var jsforce=require(_0x9cb8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9cb8('0x6'));var querystring=require('querystring');var Papa=require(_0x9cb8('0xb'));var Redis=require(_0x9cb8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9cb8('0xd'));var as=require(_0x9cb8('0xe'));var hardwareService=require(_0x9cb8('0xf'));var logger=require(_0x9cb8('0x10'))(_0x9cb8('0x11'));var utils=require(_0x9cb8('0x12'));var config=require(_0x9cb8('0x13'));var licenseUtil=require(_0x9cb8('0x14'));var db=require(_0x9cb8('0x15'))['db'];config[_0x9cb8('0x16')]=_[_0x9cb8('0x17')](config[_0x9cb8('0x16')],{'host':_0x9cb8('0x18'),'port':0x18eb});var socket=require(_0x9cb8('0x19'))(new Redis(config[_0x9cb8('0x16')]));require(_0x9cb8('0x1a'))[_0x9cb8('0x1b')](socket);function respondWithStatusCode(_0x4a5cc6,_0x1a359b){_0x1a359b=_0x1a359b||0xcc;return function(_0x1b4667){if(_0x1b4667){return _0x4a5cc6[_0x9cb8('0x1c')](_0x1a359b);}return _0x4a5cc6[_0x9cb8('0x1d')](_0x1a359b)[_0x9cb8('0x1e')]();};}function respondWithResult(_0x27f791,_0x48738a){_0x48738a=_0x48738a||0xc8;return function(_0x103876){if(_0x103876){return _0x27f791[_0x9cb8('0x1d')](_0x48738a)[_0x9cb8('0x1f')](_0x103876);}};}function respondWithFilteredResult(_0x28022d,_0x1b2442){return function(_0x784002){if(_0x784002){var _0x42d1c2=typeof _0x1b2442['offset']===_0x9cb8('0x20')&&typeof _0x1b2442[_0x9cb8('0x21')]===_0x9cb8('0x20');var _0x4e821f=_0x784002[_0x9cb8('0x22')];var _0x25d0a2=_0x42d1c2?0x0:_0x1b2442[_0x9cb8('0x23')];var _0x2477e6=_0x42d1c2?_0x784002[_0x9cb8('0x22')]:_0x1b2442['offset']+_0x1b2442[_0x9cb8('0x21')];var _0x44b9c5;if(_0x2477e6>=_0x4e821f){_0x2477e6=_0x4e821f;_0x44b9c5=0xc8;}else{_0x44b9c5=0xce;}_0x28022d['status'](_0x44b9c5);return _0x28022d[_0x9cb8('0x24')](_0x9cb8('0x25'),_0x25d0a2+'-'+_0x2477e6+'/'+_0x4e821f)[_0x9cb8('0x1f')](_0x784002);}return null;};}function patchUpdates(_0x4cda6c){return function(_0xb7ceb8){try{jsonpatch[_0x9cb8('0x26')](_0xb7ceb8,_0x4cda6c,!![]);}catch(_0x1ecc78){return BPromise[_0x9cb8('0x27')](_0x1ecc78);}return _0xb7ceb8['save']();};}function saveUpdates(_0x2ca5eb,_0xd655a4){return function(_0x45d006){if(_0x45d006){return _0x45d006[_0x9cb8('0x28')](_0x2ca5eb)[_0x9cb8('0x29')](function(_0x16c979){return _0x16c979;});}return null;};}function removeEntity(_0x1fd554,_0x2b993a){return function(_0x4edf39){if(_0x4edf39){return _0x4edf39[_0x9cb8('0x2a')]()[_0x9cb8('0x29')](function(){_0x1fd554[_0x9cb8('0x1d')](0xcc)[_0x9cb8('0x1e')]();});}};}function handleEntityNotFound(_0x3c658a,_0x3233fb){return function(_0x462a50){if(!_0x462a50){_0x3c658a['sendStatus'](0x194);}return _0x462a50;};}function handleError(_0x44b091,_0x52c91d){_0x52c91d=_0x52c91d||0x1f4;return function(_0x14cc23){logger[_0x9cb8('0x2b')](_0x14cc23['stack']);if(_0x14cc23[_0x9cb8('0x2c')]){delete _0x14cc23[_0x9cb8('0x2c')];}_0x44b091[_0x9cb8('0x1d')](_0x52c91d)[_0x9cb8('0x2d')](_0x14cc23);};}function getInteractionUsers(_0x9b6b6f,_0x291c4d){return new BPromise(function(_0x18a195,_0x47d1ad){try{if(_0x291c4d[_0x9b6b6f['id']]){_0x9b6b6f['Users']=_[_0x9cb8('0x2e')](_0x291c4d[_0x9b6b6f['id']],function(_0x5a68c8){return{'id':_0x5a68c8['id'],'fullname':_0x5a68c8['fullname']};});}}catch(_0x4563c3){_0x47d1ad(_0x4563c3);}_0x18a195(_0x9b6b6f);});}function getInteractionTags(_0x1364a3,_0x2fb66e){return new BPromise(function(_0x281773,_0x322056){try{if(_0x1364a3['TagIds']){_0x1364a3[_0x9cb8('0x2f')]=[];_0x1364a3['TagIds'][_0x9cb8('0x30')](',')[_0x9cb8('0x31')](function(_0x1660a8){_0x1364a3[_0x9cb8('0x2f')]['push'](_0x2fb66e[_0x1660a8]);});}delete _0x1364a3[_0x9cb8('0x32')];}catch(_0x2babce){_0x322056(_0x2babce);}_0x281773(_0x1364a3);});}function updateFaxInteraction(_0x806b9b,_0x29b303,_0x118541){return new BPromise(function(_0x51dd5b,_0x4bf26e){return getInteractionUsers(_0x806b9b,_0x118541)['then'](function(_0x1e6430){return getInteractionTags(_0x1e6430,_0x29b303);})['then'](function(_0x4623b6){return getStateInteraction(_0x4623b6);})[_0x9cb8('0x29')](function(_0x25c24d){_0x51dd5b(_0x25c24d);})[_0x9cb8('0x33')](function(_0x5d4640){_0x4bf26e(_0x5d4640);});});}function getStateInteraction(_0x2c94dc){return new BPromise(function(_0x409cb3){_0x2c94dc[_0x9cb8('0x34')]=0x0;_0x2c94dc[_0x9cb8('0x35')]=0x0;_0x2c94dc[_0x9cb8('0x36')]=0x0;_0x2c94dc['unmanaged']=0x0;_0x2c94dc[_0x9cb8('0x37')]=0x0;if(!_0x2c94dc[_0x9cb8('0x38')]&&!_0x2c94dc[_0x9cb8('0x39')]){_0x2c94dc[_0x9cb8('0x34')]+=0x1;}if(!_0x2c94dc['closed']&&_0x2c94dc[_0x9cb8('0x39')]){_0x2c94dc[_0x9cb8('0x35')]+=0x1;if(_0x2c94dc[_0x9cb8('0x34')]){_0x2c94dc['waiting']-=0x1;}}if(_0x2c94dc[_0x9cb8('0x38')]&&_0x2c94dc[_0x9cb8('0x39')]){_0x2c94dc['answered']+=0x1;if(_0x2c94dc['talking']){_0x2c94dc[_0x9cb8('0x35')]-=0x1;}}if(_0x2c94dc[_0x9cb8('0x38')]&&!_0x2c94dc[_0x9cb8('0x39')]){_0x2c94dc[_0x9cb8('0x3a')]+=0x1;if(_0x2c94dc[_0x9cb8('0x34')]){_0x2c94dc[_0x9cb8('0x34')]-=0x1;}}_0x2c94dc[_0x9cb8('0x37')]+=0x1;_0x409cb3(_0x2c94dc);});}exports[_0x9cb8('0x3b')]=function(_0x1889f1,_0x420397){var _0x30671a={},_0x166543={},_0x4550e2={'count':0x0,'rows':[]};var _0x49c31c=_['map'](db[_0x9cb8('0x3c')][_0x9cb8('0x3d')],function(_0x4ddf85){return{'name':_0x4ddf85['fieldName'],'type':_0x4ddf85[_0x9cb8('0x3e')][_0x9cb8('0x3f')]};});_0x166543[_0x9cb8('0x40')]=_[_0x9cb8('0x2e')](_0x49c31c,_0x9cb8('0x2c'));_0x166543['query']=_[_0x9cb8('0x41')](_0x1889f1['query']);_0x166543[_0x9cb8('0x42')]=_[_0x9cb8('0x43')](_0x166543[_0x9cb8('0x40')],_0x166543[_0x9cb8('0x44')]);_0x30671a[_0x9cb8('0x45')]=_['intersection'](_0x166543[_0x9cb8('0x40')],qs['fields'](_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x46')]));_0x30671a[_0x9cb8('0x45')]=_0x30671a[_0x9cb8('0x45')][_0x9cb8('0x47')]?_0x30671a[_0x9cb8('0x45')]:_0x166543[_0x9cb8('0x40')];if(!_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x48')]('nolimit')){_0x30671a[_0x9cb8('0x21')]=qs[_0x9cb8('0x21')](_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x21')]);_0x30671a['offset']=qs['offset'](_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x23')]);}_0x30671a[_0x9cb8('0x49')]=qs[_0x9cb8('0x4a')](_0x1889f1['query'][_0x9cb8('0x4a')]);_0x30671a[_0x9cb8('0x4b')]=qs[_0x9cb8('0x42')](_[_0x9cb8('0x4c')](_0x1889f1[_0x9cb8('0x44')],_0x166543[_0x9cb8('0x42')]),_0x49c31c);var _0x4c92a9=[];var _0x29f24b=squel[_0x9cb8('0x4d')]()[_0x9cb8('0x4e')]('id')['field'](_0x9cb8('0x2c'))[_0x9cb8('0x4e')](_0x9cb8('0x4f'))[_0x9cb8('0x50')](_0x9cb8('0x51'));var _0x23840d=squel[_0x9cb8('0x4d')]()[_0x9cb8('0x4e')](_0x9cb8('0x52'))['field'](_0x9cb8('0x53'))[_0x9cb8('0x4e')](_0x9cb8('0x54'))[_0x9cb8('0x50')](_0x9cb8('0x55'),'ui')[_0x9cb8('0x56')]('users','u','u.id\x20=\x20ui.UserId');var _0x59d21e=squel[_0x9cb8('0x4d')]()[_0x9cb8('0x50')](_0x9cb8('0x57'),'i')[_0x9cb8('0x56')](_0x9cb8('0x58'),'c',_0x9cb8('0x59'))[_0x9cb8('0x56')](_0x9cb8('0x5a'),'o',_0x9cb8('0x5b'))['left_join'](_0x9cb8('0x5c'),'a',_0x9cb8('0x5d'))['left_join'](_0x9cb8('0x5e'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x9cb8('0x56')](_0x9cb8('0x5f'),'it',_0x9cb8('0x60'))['left_join'](_0x9cb8('0x51'),'t',_0x9cb8('0x61'));var _0x4096ce=squel['expr']();var _0x1d89eb=[];var _0x161752=squel[_0x9cb8('0x62')]();var _0x44f7b7;if(_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x63')]){_0x44f7b7=as[_0x9cb8('0x64')](_0x1889f1['query'][_0x9cb8('0x63')]);var _0x19e793=_0x44f7b7[_0x9cb8('0x65')];for(var _0x19844c=0x0;_0x19844c<_0x44f7b7[_0x9cb8('0x66')][_0x9cb8('0x47')];_0x19844c++){var _0x50506f=_0x44f7b7[_0x9cb8('0x66')][_0x19844c];var _0x151998='i';var _0x901a63=_[_0x9cb8('0x67')](_0x49c31c,[_0x9cb8('0x2c'),_0x50506f['field']]);if(!_0x901a63){switch(_0x50506f[_0x9cb8('0x4e')]){case _0x9cb8('0x68'):if(_0x50506f['value']==0x1){_0x59d21e['having']('`'+_0x50506f[_0x9cb8('0x4e')]+_0x9cb8('0x69'));}else{_0x59d21e[_0x9cb8('0x6a')]('`'+_0x50506f[_0x9cb8('0x4e')]+'`\x20>\x200');}break;case'Contact':if(_0x50506f[_0x9cb8('0x6b')]===_0x9cb8('0x6c')){if(_0x50506f['value'][_0x9cb8('0x30')]('\x20')['length']>0x1){_0x4096ce[_0x19e793](_0x9cb8('0x6d'),qs[_0x9cb8('0x6e')](_0x50506f['value']),null);}else{var _0x595c50='%'+_0x50506f['value']+'%';_0x4096ce[_0x19e793](_0x9cb8('0x6f'),_0x595c50,_0x595c50,_0x595c50);}}else{_0x901a63=_['find'](_0x49c31c,[_0x9cb8('0x2c'),_0x9cb8('0x70')]);_0x50506f[_0x9cb8('0x4e')]=_0x9cb8('0x70');_0x43151f=as['buildExpression'](_0x151998,_0x901a63[_0x9cb8('0x3e')],_0x50506f);_0x4096ce[_0x19e793](_0x43151f['text'],_0x43151f[_0x9cb8('0x71')][_0x9cb8('0x72')],_0x43151f[_0x9cb8('0x71')]['end']);}break;case'Tag':var _0xb8c92d=_0x50506f[_0x9cb8('0x71')][_0x9cb8('0x30')](',')[_0x9cb8('0x2e')](function(_0x5dfcea){return Number(_0x5dfcea);});_0xb8c92d['forEach'](function(_0x4e4ac9){_0x161752['or'](_0x9cb8('0x73'),'%,'+_0x4e4ac9+',%');});_0x1d89eb=_[_0x9cb8('0x74')](_0x1d89eb,_0xb8c92d);break;case'User':if(_0x50506f[_0x9cb8('0x6b')]==='$substring'){_0x4096ce[_0x19e793](_0x9cb8('0x75'),'%'+_0x50506f['value']+'%',null);}else{_0x901a63=_[_0x9cb8('0x67')](_0x49c31c,[_0x9cb8('0x2c'),_0x9cb8('0x39')]);_0x50506f[_0x9cb8('0x4e')]=_0x9cb8('0x39');_0x43151f=as[_0x9cb8('0x76')](_0x151998,_0x901a63[_0x9cb8('0x3e')],_0x50506f);_0x4096ce[_0x19e793](_0x43151f[_0x9cb8('0x77')],_0x43151f['value'][_0x9cb8('0x72')],_0x43151f[_0x9cb8('0x71')][_0x9cb8('0x1e')]);}break;case _0x9cb8('0x78'):_0x43151f=as[_0x9cb8('0x76')]('me',null,_0x50506f);_0x4096ce[_0x19e793](_0x43151f[_0x9cb8('0x77')],_0x43151f[_0x9cb8('0x71')]['start'],_0x43151f[_0x9cb8('0x71')][_0x9cb8('0x1e')]);break;}}else{var _0x43151f=as[_0x9cb8('0x76')](_0x151998,_0x901a63[_0x9cb8('0x3e')],_0x50506f);_0x4096ce[_0x19e793](_0x43151f[_0x9cb8('0x77')],_0x43151f['value'][_0x9cb8('0x72')],_0x43151f[_0x9cb8('0x71')][_0x9cb8('0x1e')]);}}}else{var _0x4327ce=_(_0x1889f1[_0x9cb8('0x44')])[_0x9cb8('0x41')]()[_0x9cb8('0x2e')](function(_0x56905c){return _['some'](_0x49c31c,[_0x9cb8('0x2c'),_0x56905c])?_0x56905c:undefined;})[_0x9cb8('0x79')]()['value']();if(!_['isEmpty'](_0x4327ce)){_0x4327ce[_0x9cb8('0x31')](function(_0x16bb3a){if(_0x16bb3a===_0x9cb8('0x7a')){_0x59d21e['where'](_0x9cb8('0x7b'),[][_0x9cb8('0x7c')](_0x1889f1[_0x9cb8('0x44')][_0x16bb3a]));}else if(_0x16bb3a===_0x9cb8('0x7d')){var _0x2908ab=JSON['parse'](_0x1889f1['query'][_0x16bb3a])[_0x9cb8('0x7e')];var _0x5b0e46=JSON['parse'](_0x1889f1['query'][_0x16bb3a])[_0x9cb8('0x7f')];_0x59d21e[_0x9cb8('0x4b')](_0x9cb8('0x80'),_0x2908ab,_0x5b0e46);}else{if(_0x1889f1[_0x9cb8('0x44')][_0x16bb3a]===_0x9cb8('0x81')){_0x59d21e[_0x9cb8('0x4b')]('i.'+_0x16bb3a+_0x9cb8('0x82'));}else{_0x59d21e[_0x9cb8('0x4b')]('i.'+_0x16bb3a+'\x20=\x20?',_0x1889f1[_0x9cb8('0x44')][_0x16bb3a]);}}});}if(_0x1889f1['query'][_0x9cb8('0x83')]){if(_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x83')]==0x1){_0x59d21e[_0x9cb8('0x6a')](_0x9cb8('0x84'));}else{_0x59d21e[_0x9cb8('0x6a')](_0x9cb8('0x85'));}}if(_0x1889f1['query'][_0x9cb8('0x86')]){_0x1d89eb=_[_0x9cb8('0x87')](_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x86')])?_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x86')]:new Array(_0x1889f1['query'][_0x9cb8('0x86')]);_0x1d89eb['forEach'](function(_0x15f714){_0x161752['or'](_0x9cb8('0x73'),'%,'+_0x15f714+',%');});}if(_0x1889f1[_0x9cb8('0x44')]['filter']){var _0x5a7013=_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x88')][_0x9cb8('0x89')]('\x5c','\x5c\x5c')[_0x9cb8('0x89')](/'/g,'\x27\x27');if(qs[_0x9cb8('0x8a')](_0x5a7013)){_0x4096ce['or'](_0x9cb8('0x8b'),_0x5a7013+'%')['or'](_0x9cb8('0x8c'),_0x5a7013+'%');}_0x4096ce['or'](_0x9cb8('0x8d'),_0x5a7013+'%');}}_0x59d21e[_0x9cb8('0x4b')](_0x4096ce);_0x59d21e[_0x9cb8('0x8e')](_0x9cb8('0x8f'));var _0x997d44={'type':db['Sequelize'][_0x9cb8('0x90')]['SELECT'],'raw':!![]};var _0x5b2d6c=_0x59d21e[_0x9cb8('0x91')]();_0x5b2d6c[_0x9cb8('0x4e')]('i.id');_0x5b2d6c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9cb8('0x68'));if(_0x30671a['order']){_0x30671a[_0x9cb8('0x49')]['forEach'](function(_0x1c5207){var _0x3418f6=_0x1c5207[0x0]===_0x9cb8('0x92')?_0x1c5207[0x0]:'i.'+_0x1c5207[0x0];_0x59d21e[_0x9cb8('0x49')](_0x3418f6,_0x1c5207[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9cb8('0x93')](_0x1d89eb)){_0x59d21e[_0x9cb8('0x6a')](_0x161752);_0x5b2d6c[_0x9cb8('0x4b')](_0x9cb8('0x94'),_0x1d89eb);}BPromise[_0x9cb8('0x95')]()[_0x9cb8('0x29')](function(){if(!_0x44f7b7){if(_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x7a')])return;_0x5b2d6c[_0x9cb8('0x4b')](_0x9cb8('0x96'));_0x59d21e[_0x9cb8('0x4b')](_0x9cb8('0x96'));return;}if(_0x1889f1[_0x9cb8('0x97')][_0x9cb8('0x98')]!==_0x9cb8('0x99'))return;return _0x1889f1[_0x9cb8('0x97')][_0x9cb8('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4350d9){if(_['isEmpty'](_0x4350d9)){_0x5b2d6c[_0x9cb8('0x4b')]('i.FaxAccountId\x20IS\x20NULL');_0x59d21e['where'](_0x9cb8('0x9b'));}else{_0x5b2d6c[_0x9cb8('0x4b')](_0x9cb8('0x7b'),_['map'](_0x4350d9,'id'));_0x59d21e[_0x9cb8('0x4b')](_0x9cb8('0x7b'),_[_0x9cb8('0x2e')](_0x4350d9,'id'));}});})['then'](function(){if(_0x1889f1[_0x9cb8('0x97')][_0x9cb8('0x98')]===_0x9cb8('0x99')&&!_0x44f7b7&&!_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x7a')])return[];return db['sequelize']['query'](_0x5b2d6c[_0x9cb8('0x9c')](),_0x997d44);})['then'](function(_0x334f9e){_0x4550e2[_0x9cb8('0x22')]=_0x334f9e[_0x9cb8('0x47')];if(_0x4550e2[_0x9cb8('0x22')]===0x0)return[];return db[_0x9cb8('0x9d')][_0x9cb8('0x44')](_0x29f24b[_0x9cb8('0x9c')](),_0x997d44)[_0x9cb8('0x29')](function(_0x1257d1){_0x4c92a9=_[_0x9cb8('0x9e')](_0x1257d1,'id');_0x997d44=_['merge'](_0x997d44,{'model':db[_0x9cb8('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1889f1[_0x9cb8('0x44')][_0x9cb8('0x46')]){_0x30671a[_0x9cb8('0x45')][_0x9cb8('0x31')](function(_0xab11c5){_0x59d21e[_0x9cb8('0x4e')]('i.'+_0xab11c5);});}else{_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0x9f'),_0x9cb8('0x68'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xa0'),_0x9cb8('0xa1'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xa2'),_0x9cb8('0xa3'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xa4'),'contactName');_0x59d21e['field'](_0x9cb8('0xa5'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xa6'),_0x9cb8('0xa7'));_0x59d21e['field'](_0x9cb8('0xa8'),_0x9cb8('0xa9'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xaa'),_0x9cb8('0xab'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xac'),_0x9cb8('0xad'));_0x59d21e['field']('c.mobile','Contact.mobile');_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xae'),_0x9cb8('0xaf'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xb0'),_0x9cb8('0xb1'));_0x59d21e[_0x9cb8('0x4e')](_0x9cb8('0xb2'),'Owner.internal');_0x59d21e['field'](_0x9cb8('0xb3'),'TagIds');}if(_0x30671a['limit'])_0x59d21e[_0x9cb8('0x21')](_0x30671a['limit']);if(_0x30671a[_0x9cb8('0x23')])_0x59d21e['offset'](_0x30671a[_0x9cb8('0x23')]);return db['sequelize'][_0x9cb8('0x44')](_0x59d21e[_0x9cb8('0x9c')](),_0x997d44);})[_0x9cb8('0x29')](function(_0x31a92d){if(_0x31a92d[_0x9cb8('0x47')]>0x0)_0x23840d['where'](_0x9cb8('0xb4'),_[_0x9cb8('0x2e')](_0x31a92d,'id'));return db[_0x9cb8('0x9d')][_0x9cb8('0x44')](_0x23840d[_0x9cb8('0x9c')](),_0x997d44)[_0x9cb8('0x29')](function(_0x4048e3){var _0x3acdfb=_['groupBy'](_0x4048e3,_0x9cb8('0xb5'));var _0x33e571=[];_0x31a92d[_0x9cb8('0x31')](function(_0x59dbe9){_0x33e571[_0x9cb8('0xb6')](updateFaxInteraction(_0x59dbe9,_0x4c92a9,_0x3acdfb));});return BPromise[_0x9cb8('0xb7')](_0x33e571);});});})['then'](function(_0x53651b){_0x4550e2[_0x9cb8('0xb8')]=_0x53651b;return _0x4550e2;})[_0x9cb8('0x29')](respondWithFilteredResult(_0x420397,_0x30671a))[_0x9cb8('0x33')](handleError(_0x420397,null));};exports[_0x9cb8('0xb9')]=function(_0x2a4331,_0x3aee93){var _0x4b7353={'raw':![],'where':{'id':_0x2a4331[_0x9cb8('0xba')]['id']}},_0x1c986b={};_0x1c986b[_0x9cb8('0x40')]=_[_0x9cb8('0x41')](db[_0x9cb8('0x3c')][_0x9cb8('0x3d')]);_0x1c986b[_0x9cb8('0x44')]=_[_0x9cb8('0x41')](_0x2a4331[_0x9cb8('0x44')]);_0x1c986b[_0x9cb8('0x42')]=_[_0x9cb8('0x43')](_0x1c986b['model'],_0x1c986b[_0x9cb8('0x44')]);_0x4b7353[_0x9cb8('0x45')]=_[_0x9cb8('0x43')](_0x1c986b[_0x9cb8('0x40')],qs[_0x9cb8('0x46')](_0x2a4331[_0x9cb8('0x44')][_0x9cb8('0x46')]));_0x4b7353['attributes']=_0x4b7353[_0x9cb8('0x45')][_0x9cb8('0x47')]?_0x4b7353[_0x9cb8('0x45')]:_0x1c986b[_0x9cb8('0x40')];if(_0x2a4331['query'][_0x9cb8('0xbb')]){_0x4b7353['include']=[{'all':!![]}];}_0x4b7353=_['merge']({},_0x4b7353,_0x2a4331[_0x9cb8('0xbc')]);return db[_0x9cb8('0x3c')]['find'](_0x4b7353)[_0x9cb8('0x29')](handleEntityNotFound(_0x3aee93,null))[_0x9cb8('0x29')](respondWithResult(_0x3aee93,null))[_0x9cb8('0x33')](handleError(_0x3aee93,null));};exports[_0x9cb8('0xbd')]=function(_0x214fa9,_0x12b9b4){return db[_0x9cb8('0x3c')][_0x9cb8('0xbd')](_0x214fa9[_0x9cb8('0x78')],{})[_0x9cb8('0x29')](respondWithResult(_0x12b9b4,0xc9))['catch'](handleError(_0x12b9b4,null));};exports[_0x9cb8('0x28')]=function(_0xccf258,_0x20cb19){if(_0xccf258['body']['id']){delete _0xccf258['body']['id'];}return db[_0x9cb8('0x3c')][_0x9cb8('0x67')]({'where':{'id':_0xccf258[_0x9cb8('0xba')]['id']}})[_0x9cb8('0x29')](handleEntityNotFound(_0x20cb19,null))[_0x9cb8('0x29')](saveUpdates(_0xccf258['body'],null))[_0x9cb8('0x29')](respondWithResult(_0x20cb19,null))[_0x9cb8('0x33')](handleError(_0x20cb19,null));};exports['destroy']=function(_0xa2faee,_0x5e41a4){return db[_0x9cb8('0x3c')]['find']({'where':{'id':_0xa2faee[_0x9cb8('0xba')]['id']}})['then'](handleEntityNotFound(_0x5e41a4,null))[_0x9cb8('0x29')](removeEntity(_0x5e41a4,null))[_0x9cb8('0x33')](handleError(_0x5e41a4,null));};exports['describe']=function(_0x4833b5,_0x5e12be){return db[_0x9cb8('0x3c')]['describe']()['then'](respondWithResult(_0x5e12be,null))[_0x9cb8('0x33')](handleError(_0x5e12be,null));};exports[_0x9cb8('0xbe')]=function(_0x54df4e,_0xda0120,_0x252337){return db[_0x9cb8('0xbf')][_0x9cb8('0x67')]({'where':{'id':_0x54df4e[_0x9cb8('0xba')]['id']}})[_0x9cb8('0x29')](handleEntityNotFound(_0xda0120,null))[_0x9cb8('0x29')](function(_0x2c855e){if(_0x2c855e){return _0x2c855e['addMessage'](_0x54df4e[_0x9cb8('0x78')][_0x9cb8('0xc0')],_['omit'](_0x54df4e['body'],[_0x9cb8('0xc0'),'id'])||{});}})[_0x9cb8('0x29')](respondWithResult(_0xda0120,null))['catch'](handleError(_0xda0120,null));};exports[_0x9cb8('0xc1')]=function(_0x1794a7,_0x2a45f5,_0xc55732){var _0x487e27={'raw':![],'where':{}};var _0xe8f145={};var _0x56bab9={'count':0x0,'rows':[]};return db[_0x9cb8('0x3c')][_0x9cb8('0xc2')]({'where':{'id':_0x1794a7['params']['id']}})[_0x9cb8('0x29')](handleEntityNotFound(_0x2a45f5,null))[_0x9cb8('0x29')](function(_0x8ad47a){if(_0x8ad47a){_0xe8f145['model']=_['keys'](db[_0x9cb8('0xbf')]['rawAttributes']);_0xe8f145[_0x9cb8('0x44')]=_['keys'](_0x1794a7['query']);_0xe8f145[_0x9cb8('0x42')]=_[_0x9cb8('0x43')](_0xe8f145[_0x9cb8('0x40')],_0xe8f145['query']);_0x487e27['attributes']=_['intersection'](_0xe8f145['model'],qs[_0x9cb8('0x46')](_0x1794a7['query'][_0x9cb8('0x46')]));_0x487e27['attributes']=_0x487e27[_0x9cb8('0x45')][_0x9cb8('0x47')]?_0x487e27[_0x9cb8('0x45')]:_0xe8f145[_0x9cb8('0x40')];if(!_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x48')](_0x9cb8('0xc3'))){_0x487e27[_0x9cb8('0x21')]=qs[_0x9cb8('0x21')](_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x21')]);_0x487e27[_0x9cb8('0x23')]=qs[_0x9cb8('0x23')](_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x23')]);}_0x487e27[_0x9cb8('0x49')]=qs['sort'](_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x4a')]);_0x487e27[_0x9cb8('0x4b')]=qs[_0x9cb8('0x42')](_[_0x9cb8('0x4c')](_0x1794a7[_0x9cb8('0x44')],_0xe8f145[_0x9cb8('0x42')]));_0x487e27['where'][_0x9cb8('0xb5')]=_0x8ad47a['id'];if(_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x88')]){_0x487e27[_0x9cb8('0x4b')]=_[_0x9cb8('0xc4')](_0x487e27[_0x9cb8('0x4b')],{'$or':_['map'](_0x487e27[_0x9cb8('0x45')],function(_0x28a277){var _0x243c99={};_0x243c99[_0x28a277]={'$like':'%'+_0x1794a7['query'][_0x9cb8('0x88')]+'%'};return _0x243c99;})});}if(_0x1794a7['query'][_0x9cb8('0x7e')]){var _0x4b0421=_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0x7e')][_0x9cb8('0x30')](',');var _0x4191c7={};_0x4191c7[_0x4b0421[0x0]]={'$gte':moment(_0x4b0421[0x1])[_0x9cb8('0xc5')](_0x9cb8('0xc6'))};_0x487e27[_0x9cb8('0x4b')]=_[_0x9cb8('0xc4')](_0x487e27[_0x9cb8('0x4b')],_0x4191c7);}_0x487e27=_['merge']({},_0x487e27,_0x1794a7[_0x9cb8('0xbc')]);return db[_0x9cb8('0xbf')]['count']({'where':_0x487e27[_0x9cb8('0x4b')]})['then'](function(_0x298a3e){_0x56bab9[_0x9cb8('0x22')]=_0x298a3e;if(_0x1794a7[_0x9cb8('0x44')][_0x9cb8('0xbb')]){_0x487e27[_0x9cb8('0xc7')]=[{'all':!![]}];}return db[_0x9cb8('0xbf')][_0x9cb8('0xc8')](_0x487e27);})[_0x9cb8('0x29')](function(_0x3cfeb2){_0x56bab9[_0x9cb8('0xb8')]=_0x3cfeb2;return _0x56bab9;});}})[_0x9cb8('0x29')](respondWithFilteredResult(_0x2a45f5,_0x487e27))[_0x9cb8('0x33')](handleError(_0x2a45f5,null));};exports[_0x9cb8('0xc9')]=function(_0x399be9,_0x6e90c6,_0x3b1521){return db[_0x9cb8('0x3c')][_0x9cb8('0x67')]({'where':{'id':_0x399be9[_0x9cb8('0xba')]['id']}})[_0x9cb8('0x29')](handleEntityNotFound(_0x6e90c6,null))['then'](function(_0x31cbfe){if(_0x31cbfe){return _0x31cbfe[_0x9cb8('0xca')](_0x399be9[_0x9cb8('0x78')][_0x9cb8('0xc0')],_[_0x9cb8('0xcb')](_0x399be9[_0x9cb8('0x78')],[_0x9cb8('0xc0'),'id'])||{})['spread'](function(){return db['Tag'][_0x9cb8('0xc8')]({'attributes':['id',_0x9cb8('0x2c'),_0x9cb8('0x4f')],'where':{'id':_0x399be9[_0x9cb8('0x78')][_0x9cb8('0xc0')]}});})[_0x9cb8('0x29')](function(_0x4123ac){socket[_0x9cb8('0xcc')]('faxInteractionTags:save',{'id':Number(_0x399be9[_0x9cb8('0xba')]['id']),'tags':_0x4123ac||[]});return{'id':Number(_0x399be9[_0x9cb8('0xba')]['id']),'tags':_0x4123ac||[]};});}})[_0x9cb8('0x29')](respondWithResult(_0x6e90c6,null))[_0x9cb8('0x33')](handleError(_0x6e90c6,null));};exports['removeTags']=function(_0x21c99c,_0x25e37b,_0x2603a9){return db['FaxInteraction'][_0x9cb8('0x67')]({'where':{'id':_0x21c99c[_0x9cb8('0xba')]['id']}})[_0x9cb8('0x29')](handleEntityNotFound(_0x25e37b,null))[_0x9cb8('0x29')](function(_0x4994b1){if(_0x4994b1){return _0x4994b1[_0x9cb8('0xcd')](_0x21c99c['query'][_0x9cb8('0xc0')]);}})['then'](respondWithStatusCode(_0x25e37b,null))[_0x9cb8('0x33')](handleError(_0x25e37b,null));};exports[_0x9cb8('0xce')]=function(_0x226cdc,_0x1d8894){var _0xbb5ae4=moment()[_0x9cb8('0xcf')]()['toString']();var _0x2de644=path[_0x9cb8('0xd0')](config['root'],_0x9cb8('0xd1'),'files','tmp');var _0x2647a6=path[_0x9cb8('0xd0')](config[_0x9cb8('0xd2')],_0x9cb8('0xd1'),_0x9cb8('0xd3'),_0x9cb8('0xd4'));var _0x2b5613=path[_0x9cb8('0xd0')](_0x2de644,_0xbb5ae4);var _0x3f1d0a=util[_0x9cb8('0xc5')](_0x9cb8('0xd5'),_0x226cdc[_0x9cb8('0xba')]['id'],_0xbb5ae4);var _0x1c2f53=path['join'](_0x2de644,_0x3f1d0a);var _0x81e297=[];_0x81e297[_0x9cb8('0xb6')]({'model':db[_0x9cb8('0xd6')],'as':'Attachment','raw':!![]});var _0x9e7276=[{'model':db[_0x9cb8('0xbf')],'as':_0x9cb8('0xd7'),'attributes':['id','body',_0x9cb8('0x7d')],'include':_0x81e297}];return db['FaxInteraction'][_0x9cb8('0x67')]({'where':{'id':_0x226cdc[_0x9cb8('0xba')]['id']},'include':_0x9e7276})[_0x9cb8('0x29')](handleEntityNotFound(_0x1d8894,null))[_0x9cb8('0x29')](function(_0x46eb93){if(_0x46eb93&&_0x46eb93[_0x9cb8('0xd7')]){var _0x45e6c6=_0x46eb93['get']({'plain':!![]});fs['mkdirSync'](_0x2b5613);for(var _0x3686c3=0x0;_0x3686c3<_0x45e6c6[_0x9cb8('0xd7')][_0x9cb8('0x47')];_0x3686c3++){var _0x2ee3a0=_0x45e6c6[_0x9cb8('0xd7')][_0x3686c3][_0x9cb8('0xd6')];if(_0x2ee3a0){var _0xe31807=path[_0x9cb8('0xd0')](_0x2647a6,_0x2ee3a0[_0x9cb8('0xd8')]);if(fs[_0x9cb8('0xd9')](_0xe31807)){fs[_0x9cb8('0xda')](_0xe31807)[_0x9cb8('0xdb')](fs[_0x9cb8('0xdc')](path[_0x9cb8('0xd0')](_0x2b5613,_0x2ee3a0[_0x9cb8('0xd8')])));}}}return BPromise[_0x9cb8('0x95')]()['then'](function(){return new BPromise(function(_0x233206,_0x5ce173){zipdir(_0x2b5613,{'saveTo':_0x1c2f53},function(_0x48b554,_0x2811f7){if(_0x48b554)return _0x5ce173(_0x48b554);return _0x233206(_0x2811f7);});})[_0x9cb8('0x29')](function(){return new BPromise(function(_0x12223c,_0x173bae){rimraf(_0x2b5613,function(_0x857da1){if(_0x857da1)_0x173bae(_0x857da1);return _0x12223c();});});})[_0x9cb8('0x29')](function(){return _0x1d8894[_0x9cb8('0xce')](_0x1c2f53,_0x3f1d0a,function(_0x4293ce){if(_0x4293ce){console[_0x9cb8('0xdd')](_0x9cb8('0xde'),_0x4293ce);}else{fs['unlinkSync'](_0x1c2f53);}});});});}else{return _0x1d8894[_0x9cb8('0x1c')](0xc8);}})[_0x9cb8('0x33')](handleError(_0x1d8894,null));}; \ No newline at end of file +var _0x7764=['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','contactName','c.lastName','Contact.lastName','c.email','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.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','params','FaxInteraction','include','options','create','describe','FaxMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','findAll','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','register','status','end','json','offset','undefined','count','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','waiting','talking','answered','total','closed','UserId','unmanaged','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$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?','i.fax\x20LIKE\x20?','group','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','user','sequelize','toString','merge','Account.key','a.mandatoryDisposition'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7764,0x120));var _0x4776=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x7764[_0x54b062];return _0x255e41;};'use strict';var emlformat=require(_0x4776('0x0'));var rimraf=require(_0x4776('0x1'));var zipdir=require(_0x4776('0x2'));var jsonpatch=require(_0x4776('0x3'));var rp=require(_0x4776('0x4'));var moment=require(_0x4776('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4776('0x6'));var util=require('util');var path=require(_0x4776('0x7'));var sox=require(_0x4776('0x8'));var csv=require(_0x4776('0x9'));var ejs=require(_0x4776('0xa'));var fs=require('fs');var fs_extra=require(_0x4776('0xb'));var _=require(_0x4776('0xc'));var squel=require('squel');var crypto=require(_0x4776('0xd'));var jsforce=require(_0x4776('0xe'));var deskjs=require(_0x4776('0xf'));var toCsv=require(_0x4776('0x9'));var querystring=require(_0x4776('0x10'));var Papa=require(_0x4776('0x11'));var Redis=require(_0x4776('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4776('0x13'));var as=require(_0x4776('0x14'));var hardwareService=require(_0x4776('0x15'));var logger=require(_0x4776('0x16'))(_0x4776('0x17'));var utils=require(_0x4776('0x18'));var config=require(_0x4776('0x19'));var licenseUtil=require(_0x4776('0x1a'));var db=require(_0x4776('0x1b'))['db'];config[_0x4776('0x1c')]=_['defaults'](config[_0x4776('0x1c')],{'host':_0x4776('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4776('0x1c')]));require(_0x4776('0x1e'))[_0x4776('0x1f')](socket);function respondWithStatusCode(_0x1403b0,_0x512c8c){_0x512c8c=_0x512c8c||0xcc;return function(_0x79ed1a){if(_0x79ed1a){return _0x1403b0['sendStatus'](_0x512c8c);}return _0x1403b0[_0x4776('0x20')](_0x512c8c)[_0x4776('0x21')]();};}function respondWithResult(_0x1c314c,_0x1784e7){_0x1784e7=_0x1784e7||0xc8;return function(_0x38cea2){if(_0x38cea2){return _0x1c314c['status'](_0x1784e7)[_0x4776('0x22')](_0x38cea2);}};}function respondWithFilteredResult(_0x14b382,_0x4855c8){return function(_0x3583a3){if(_0x3583a3){var _0x27b347=typeof _0x4855c8[_0x4776('0x23')]===_0x4776('0x24')&&typeof _0x4855c8['limit']===_0x4776('0x24');var _0x49d68e=_0x3583a3['count'];var _0x4136c1=_0x27b347?0x0:_0x4855c8[_0x4776('0x23')];var _0x206a78=_0x27b347?_0x3583a3[_0x4776('0x25')]:_0x4855c8['offset']+_0x4855c8['limit'];var _0x1beccd;if(_0x206a78>=_0x49d68e){_0x206a78=_0x49d68e;_0x1beccd=0xc8;}else{_0x1beccd=0xce;}_0x14b382[_0x4776('0x20')](_0x1beccd);return _0x14b382['set'](_0x4776('0x26'),_0x4136c1+'-'+_0x206a78+'/'+_0x49d68e)['json'](_0x3583a3);}return null;};}function patchUpdates(_0x22e884){return function(_0x547ea3){try{jsonpatch['apply'](_0x547ea3,_0x22e884,!![]);}catch(_0x57b322){return BPromise['reject'](_0x57b322);}return _0x547ea3[_0x4776('0x27')]();};}function saveUpdates(_0x3316ee,_0x2a7a67){return function(_0x2dfc0c){if(_0x2dfc0c){return _0x2dfc0c[_0x4776('0x28')](_0x3316ee)[_0x4776('0x29')](function(_0x1bce63){return _0x1bce63;});}return null;};}function removeEntity(_0x27b39f,_0x3e40b4){return function(_0x57bd86){if(_0x57bd86){return _0x57bd86[_0x4776('0x2a')]()[_0x4776('0x29')](function(){_0x27b39f['status'](0xcc)[_0x4776('0x21')]();});}};}function handleEntityNotFound(_0x1da0a,_0x1489f9){return function(_0x559d1b){if(!_0x559d1b){_0x1da0a[_0x4776('0x2b')](0x194);}return _0x559d1b;};}function handleError(_0x4b4931,_0x1fd561){_0x1fd561=_0x1fd561||0x1f4;return function(_0x20eb1c){logger['error'](_0x20eb1c[_0x4776('0x2c')]);if(_0x20eb1c['name']){delete _0x20eb1c[_0x4776('0x2d')];}_0x4b4931[_0x4776('0x20')](_0x1fd561)[_0x4776('0x2e')](_0x20eb1c);};}function getInteractionUsers(_0x179a22,_0x4c59b9){return new BPromise(function(_0x171578,_0x1bd8b2){try{if(_0x4c59b9[_0x179a22['id']]){_0x179a22[_0x4776('0x2f')]=_[_0x4776('0x30')](_0x4c59b9[_0x179a22['id']],function(_0x1f7f38){return{'id':_0x1f7f38['id'],'fullname':_0x1f7f38[_0x4776('0x31')]};});}}catch(_0x50b6d8){_0x1bd8b2(_0x50b6d8);}_0x171578(_0x179a22);});}function getInteractionTags(_0xfacf3f,_0x554338){return new BPromise(function(_0x5762e5,_0x2e385a){try{if(_0xfacf3f[_0x4776('0x32')]){_0xfacf3f[_0x4776('0x33')]=[];_0xfacf3f['TagIds']['split'](',')[_0x4776('0x34')](function(_0x50c313){_0xfacf3f[_0x4776('0x33')][_0x4776('0x35')](_0x554338[_0x50c313]);});}delete _0xfacf3f[_0x4776('0x32')];}catch(_0x2ffd5e){_0x2e385a(_0x2ffd5e);}_0x5762e5(_0xfacf3f);});}function updateFaxInteraction(_0x2289d8,_0x1a6078,_0xb301a0){return new BPromise(function(_0x2a9484,_0x5c2d34){return getInteractionUsers(_0x2289d8,_0xb301a0)[_0x4776('0x29')](function(_0xee76b5){return getInteractionTags(_0xee76b5,_0x1a6078);})[_0x4776('0x29')](function(_0x1ed76d){return getStateInteraction(_0x1ed76d);})[_0x4776('0x29')](function(_0x4da301){_0x2a9484(_0x4da301);})['catch'](function(_0x903afb){_0x5c2d34(_0x903afb);});});}function getStateInteraction(_0x3142f6){return new BPromise(function(_0x207f64){_0x3142f6[_0x4776('0x36')]=0x0;_0x3142f6[_0x4776('0x37')]=0x0;_0x3142f6[_0x4776('0x38')]=0x0;_0x3142f6['unmanaged']=0x0;_0x3142f6[_0x4776('0x39')]=0x0;if(!_0x3142f6[_0x4776('0x3a')]&&!_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x36')]+=0x1;}if(!_0x3142f6[_0x4776('0x3a')]&&_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x37')]+=0x1;if(_0x3142f6['waiting']){_0x3142f6['waiting']-=0x1;}}if(_0x3142f6[_0x4776('0x3a')]&&_0x3142f6['UserId']){_0x3142f6[_0x4776('0x38')]+=0x1;if(_0x3142f6['talking']){_0x3142f6[_0x4776('0x37')]-=0x1;}}if(_0x3142f6['closed']&&!_0x3142f6[_0x4776('0x3b')]){_0x3142f6[_0x4776('0x3c')]+=0x1;if(_0x3142f6['waiting']){_0x3142f6[_0x4776('0x36')]-=0x1;}}_0x3142f6[_0x4776('0x39')]+=0x1;_0x207f64(_0x3142f6);});}exports['index']=function(_0x2625da,_0x4dd97d){var _0x1637d9={},_0x13c1a2={},_0x220daf={'count':0x0,'rows':[]};var _0x1179c4=_['map'](db['FaxInteraction'][_0x4776('0x3d')],function(_0x10b10b){return{'name':_0x10b10b[_0x4776('0x3e')],'type':_0x10b10b[_0x4776('0x3f')][_0x4776('0x40')]};});_0x13c1a2[_0x4776('0x41')]=_[_0x4776('0x30')](_0x1179c4,_0x4776('0x2d'));_0x13c1a2[_0x4776('0x42')]=_[_0x4776('0x43')](_0x2625da['query']);_0x13c1a2[_0x4776('0x44')]=_[_0x4776('0x45')](_0x13c1a2[_0x4776('0x41')],_0x13c1a2['query']);_0x1637d9[_0x4776('0x46')]=_[_0x4776('0x45')](_0x13c1a2[_0x4776('0x41')],qs['fields'](_0x2625da[_0x4776('0x42')][_0x4776('0x47')]));_0x1637d9[_0x4776('0x46')]=_0x1637d9[_0x4776('0x46')][_0x4776('0x48')]?_0x1637d9[_0x4776('0x46')]:_0x13c1a2[_0x4776('0x41')];if(!_0x2625da['query'][_0x4776('0x49')]('nolimit')){_0x1637d9[_0x4776('0x4a')]=qs[_0x4776('0x4a')](_0x2625da['query'][_0x4776('0x4a')]);_0x1637d9['offset']=qs[_0x4776('0x23')](_0x2625da[_0x4776('0x42')][_0x4776('0x23')]);}_0x1637d9['order']=qs['sort'](_0x2625da['query'][_0x4776('0x4b')]);_0x1637d9[_0x4776('0x4c')]=qs[_0x4776('0x44')](_[_0x4776('0x4d')](_0x2625da[_0x4776('0x42')],_0x13c1a2[_0x4776('0x44')]),_0x1179c4);var _0x83257d=[];var _0xa6a618=squel[_0x4776('0x4e')]()[_0x4776('0x4f')]('id')['field']('name')[_0x4776('0x4f')](_0x4776('0x50'))[_0x4776('0x51')]('tools_tags');var _0x17e18b=squel[_0x4776('0x4e')]()[_0x4776('0x4f')](_0x4776('0x52'))[_0x4776('0x4f')](_0x4776('0x53'))[_0x4776('0x4f')](_0x4776('0x54'))[_0x4776('0x51')](_0x4776('0x55'),'ui')[_0x4776('0x56')](_0x4776('0x57'),'u',_0x4776('0x58'));var _0x26d07f=squel[_0x4776('0x4e')]()[_0x4776('0x51')](_0x4776('0x59'),'i')[_0x4776('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4776('0x56')](_0x4776('0x57'),'o',_0x4776('0x5a'))[_0x4776('0x56')](_0x4776('0x5b'),'a','a.id\x20=\x20i.FaxAccountId')[_0x4776('0x56')]('fax_messages','me',_0x4776('0x5c'))['left_join']('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0x4776('0x5d'),'t',_0x4776('0x5e'));var _0x34a2a5=squel[_0x4776('0x5f')]();var _0xd31b5e=[];var _0x4cecf8=squel[_0x4776('0x5f')]();var _0x50cb2d;if(_0x2625da[_0x4776('0x42')][_0x4776('0x60')]){_0x50cb2d=as['parseSearch'](_0x2625da[_0x4776('0x42')][_0x4776('0x60')]);var _0x549ee7=_0x50cb2d[_0x4776('0x61')];for(var _0x26c72d=0x0;_0x26c72d<_0x50cb2d['conditions'][_0x4776('0x48')];_0x26c72d++){var _0x4537cc=_0x50cb2d[_0x4776('0x62')][_0x26c72d];var _0x1ea373='i';var _0x49c7b0=_[_0x4776('0x63')](_0x1179c4,[_0x4776('0x2d'),_0x4537cc['field']]);if(!_0x49c7b0){switch(_0x4537cc[_0x4776('0x4f')]){case _0x4776('0x64'):if(_0x4537cc[_0x4776('0x65')]==0x1){_0x26d07f['having']('`'+_0x4537cc['field']+_0x4776('0x66'));}else{_0x26d07f[_0x4776('0x67')]('`'+_0x4537cc['field']+_0x4776('0x68'));}break;case _0x4776('0x69'):if(_0x4537cc[_0x4776('0x6a')]==='$substring'){if(_0x4537cc['value'][_0x4776('0x6b')]('\x20')[_0x4776('0x48')]>0x1){_0x34a2a5[_0x549ee7](_0x4776('0x6c'),qs['getFullTextValue'](_0x4537cc[_0x4776('0x65')]),null);}else{var _0x1e82f1='%'+_0x4537cc[_0x4776('0x65')]+'%';_0x34a2a5[_0x549ee7](_0x4776('0x6d'),_0x1e82f1,_0x1e82f1,_0x1e82f1);}}else{_0x49c7b0=_['find'](_0x1179c4,['name',_0x4776('0x6e')]);_0x4537cc[_0x4776('0x4f')]=_0x4776('0x6e');_0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7['text'],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value']['end']);}break;case _0x4776('0x71'):var _0x429069=_0x4537cc[_0x4776('0x65')][_0x4776('0x6b')](',')[_0x4776('0x30')](function(_0x48f00d){return Number(_0x48f00d);});_0x429069[_0x4776('0x34')](function(_0x13eb11){_0x4cecf8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x13eb11+',%');});_0xd31b5e=_[_0x4776('0x72')](_0xd31b5e,_0x429069);break;case'User':if(_0x4537cc[_0x4776('0x6a')]===_0x4776('0x73')){_0x34a2a5[_0x549ee7](_0x4776('0x74'),'%'+_0x4537cc[_0x4776('0x65')]+'%',null);}else{_0x49c7b0=_[_0x4776('0x63')](_0x1179c4,['name','UserId']);_0x4537cc[_0x4776('0x4f')]='UserId';_0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')]['start'],_0x338da7[_0x4776('0x65')][_0x4776('0x21')]);}break;case _0x4776('0x76'):_0x338da7=as[_0x4776('0x6f')]('me',null,_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value'][_0x4776('0x21')]);break;}}else{var _0x338da7=as[_0x4776('0x6f')](_0x1ea373,_0x49c7b0[_0x4776('0x3f')],_0x4537cc);_0x34a2a5[_0x549ee7](_0x338da7[_0x4776('0x75')],_0x338da7[_0x4776('0x65')][_0x4776('0x70')],_0x338da7['value'][_0x4776('0x21')]);}}}else{var _0x1ecb17=_(_0x2625da[_0x4776('0x42')])[_0x4776('0x43')]()['map'](function(_0x5ee2fd){return _[_0x4776('0x77')](_0x1179c4,[_0x4776('0x2d'),_0x5ee2fd])?_0x5ee2fd:undefined;})[_0x4776('0x78')]()['value']();if(!_[_0x4776('0x79')](_0x1ecb17)){_0x1ecb17[_0x4776('0x34')](function(_0x34bffa){if(_0x34bffa===_0x4776('0x7a')){_0x26d07f[_0x4776('0x4c')](_0x4776('0x7b'),[][_0x4776('0x7c')](_0x2625da[_0x4776('0x42')][_0x34bffa]));}else if(_0x34bffa==='createdAt'){var _0x129930=JSON[_0x4776('0x7d')](_0x2625da['query'][_0x34bffa])[_0x4776('0x7e')];var _0x52e4d3=JSON[_0x4776('0x7d')](_0x2625da[_0x4776('0x42')][_0x34bffa])[_0x4776('0x7f')];_0x26d07f[_0x4776('0x4c')](_0x4776('0x80'),_0x129930,_0x52e4d3);}else{if(_0x2625da[_0x4776('0x42')][_0x34bffa]==='null'){_0x26d07f[_0x4776('0x4c')]('i.'+_0x34bffa+_0x4776('0x81'));}else{_0x26d07f[_0x4776('0x4c')]('i.'+_0x34bffa+_0x4776('0x82'),_0x2625da['query'][_0x34bffa]);}}});}if(_0x2625da['query']['read']){if(_0x2625da['query'][_0x4776('0x83')]==0x1){_0x26d07f[_0x4776('0x67')](_0x4776('0x84'));}else{_0x26d07f[_0x4776('0x67')](_0x4776('0x85'));}}if(_0x2625da['query'][_0x4776('0x86')]){_0xd31b5e=_[_0x4776('0x87')](_0x2625da[_0x4776('0x42')][_0x4776('0x86')])?_0x2625da[_0x4776('0x42')][_0x4776('0x86')]:new Array(_0x2625da[_0x4776('0x42')][_0x4776('0x86')]);_0xd31b5e['forEach'](function(_0x4de351){_0x4cecf8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4de351+',%');});}if(_0x2625da[_0x4776('0x42')][_0x4776('0x88')]){var _0x513f0c=_0x2625da['query'][_0x4776('0x88')][_0x4776('0x89')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x513f0c)){_0x34a2a5['or'](_0x4776('0x8a'),_0x513f0c+'%')['or'](_0x4776('0x8b'),_0x513f0c+'%');}_0x34a2a5['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x513f0c+'%');}}_0x26d07f[_0x4776('0x4c')](_0x34a2a5);_0x26d07f[_0x4776('0x8c')]('i.id');var _0x3f6332={'type':db['Sequelize'][_0x4776('0x8d')]['SELECT'],'raw':!![]};var _0x324e4b=_0x26d07f['clone']();_0x324e4b[_0x4776('0x4f')]('i.id');_0x324e4b['field'](_0x4776('0x8e'),'unreadMessages');if(_0x1637d9[_0x4776('0x8f')]){_0x1637d9[_0x4776('0x8f')][_0x4776('0x34')](function(_0xc451bf){var _0x34e18a=_0xc451bf[0x0]==='contactName'?_0xc451bf[0x0]:'i.'+_0xc451bf[0x0];_0x26d07f['order'](_0x34e18a,_0xc451bf[0x1]===_0x4776('0x90')?![]:!![]);});}if(!_[_0x4776('0x79')](_0xd31b5e)){_0x26d07f[_0x4776('0x67')](_0x4cecf8);_0x324e4b[_0x4776('0x4c')](_0x4776('0x91'),_0xd31b5e);}BPromise[_0x4776('0x92')]()[_0x4776('0x29')](function(){if(!_0x50cb2d){if(_0x2625da[_0x4776('0x42')]['FaxAccountId'])return;_0x324e4b[_0x4776('0x4c')](_0x4776('0x93'));_0x26d07f[_0x4776('0x4c')](_0x4776('0x93'));return;}if(_0x2625da['user'][_0x4776('0x94')]!==_0x4776('0x95'))return;return _0x2625da['user'][_0x4776('0x96')]({'attributes':['id'],'raw':!![]})[_0x4776('0x29')](function(_0x4de273){if(_['isEmpty'](_0x4de273)){_0x324e4b[_0x4776('0x4c')]('i.FaxAccountId\x20IS\x20NULL');_0x26d07f[_0x4776('0x4c')](_0x4776('0x97'));}else{_0x324e4b[_0x4776('0x4c')](_0x4776('0x7b'),_[_0x4776('0x30')](_0x4de273,'id'));_0x26d07f[_0x4776('0x4c')](_0x4776('0x7b'),_[_0x4776('0x30')](_0x4de273,'id'));}});})[_0x4776('0x29')](function(){if(_0x2625da[_0x4776('0x98')][_0x4776('0x94')]===_0x4776('0x95')&&!_0x50cb2d&&!_0x2625da[_0x4776('0x42')][_0x4776('0x7a')])return[];return db[_0x4776('0x99')]['query'](_0x324e4b[_0x4776('0x9a')](),_0x3f6332);})[_0x4776('0x29')](function(_0x3e41b7){_0x220daf[_0x4776('0x25')]=_0x3e41b7['length'];if(_0x220daf[_0x4776('0x25')]===0x0)return[];return db['sequelize'][_0x4776('0x42')](_0xa6a618[_0x4776('0x9a')](),_0x3f6332)['then'](function(_0x2170ea){_0x83257d=_['keyBy'](_0x2170ea,'id');_0x3f6332=_[_0x4776('0x9b')](_0x3f6332,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2625da[_0x4776('0x42')][_0x4776('0x47')]){_0x1637d9[_0x4776('0x46')]['forEach'](function(_0x557b63){_0x26d07f['field']('i.'+_0x557b63);});}else{_0x26d07f[_0x4776('0x4f')](_0x4776('0x8e'),'unreadMessages');_0x26d07f[_0x4776('0x4f')]('a.key',_0x4776('0x9c'));_0x26d07f[_0x4776('0x4f')](_0x4776('0x9d'),_0x4776('0x9e'));_0x26d07f[_0x4776('0x4f')](_0x4776('0x9f'),_0x4776('0xa0'));_0x26d07f[_0x4776('0x4f')]('i.*');_0x26d07f['field']('c.firstName','Contact.firstName');_0x26d07f[_0x4776('0x4f')](_0x4776('0xa1'),_0x4776('0xa2'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa3'),_0x4776('0xa4'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa5'),_0x4776('0xa6'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa7'),_0x4776('0xa8'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xa9'),_0x4776('0xaa'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xab'),_0x4776('0xac'));_0x26d07f['field'](_0x4776('0xad'),_0x4776('0xae'));_0x26d07f[_0x4776('0x4f')](_0x4776('0xaf'),_0x4776('0x32'));}if(_0x1637d9[_0x4776('0x4a')])_0x26d07f['limit'](_0x1637d9[_0x4776('0x4a')]);if(_0x1637d9[_0x4776('0x23')])_0x26d07f[_0x4776('0x23')](_0x1637d9['offset']);return db[_0x4776('0x99')][_0x4776('0x42')](_0x26d07f[_0x4776('0x9a')](),_0x3f6332);})[_0x4776('0x29')](function(_0x85d7db){if(_0x85d7db[_0x4776('0x48')]>0x0)_0x17e18b['where'](_0x4776('0xb0'),_[_0x4776('0x30')](_0x85d7db,'id'));return db[_0x4776('0x99')][_0x4776('0x42')](_0x17e18b[_0x4776('0x9a')](),_0x3f6332)[_0x4776('0x29')](function(_0x3ac706){var _0x52aa1c=_[_0x4776('0xb1')](_0x3ac706,_0x4776('0xb2'));var _0x1b1f2b=[];_0x85d7db[_0x4776('0x34')](function(_0x8fec5e){_0x1b1f2b[_0x4776('0x35')](updateFaxInteraction(_0x8fec5e,_0x83257d,_0x52aa1c));});return BPromise[_0x4776('0xb3')](_0x1b1f2b);});});})['then'](function(_0x539e9c){_0x220daf[_0x4776('0xb4')]=_0x539e9c;return _0x220daf;})[_0x4776('0x29')](respondWithFilteredResult(_0x4dd97d,_0x1637d9))[_0x4776('0xb5')](handleError(_0x4dd97d,null));};exports[_0x4776('0xb6')]=function(_0x4c00ad,_0x3145d0){var _0x1661e1={'raw':![],'where':{'id':_0x4c00ad[_0x4776('0xb7')]['id']}},_0x1266d6={};_0x1266d6[_0x4776('0x41')]=_[_0x4776('0x43')](db[_0x4776('0xb8')][_0x4776('0x3d')]);_0x1266d6[_0x4776('0x42')]=_[_0x4776('0x43')](_0x4c00ad[_0x4776('0x42')]);_0x1266d6['filters']=_[_0x4776('0x45')](_0x1266d6[_0x4776('0x41')],_0x1266d6[_0x4776('0x42')]);_0x1661e1['attributes']=_[_0x4776('0x45')](_0x1266d6['model'],qs['fields'](_0x4c00ad['query'][_0x4776('0x47')]));_0x1661e1[_0x4776('0x46')]=_0x1661e1[_0x4776('0x46')][_0x4776('0x48')]?_0x1661e1[_0x4776('0x46')]:_0x1266d6[_0x4776('0x41')];if(_0x4c00ad[_0x4776('0x42')]['includeAll']){_0x1661e1[_0x4776('0xb9')]=[{'all':!![]}];}_0x1661e1=_['merge']({},_0x1661e1,_0x4c00ad[_0x4776('0xba')]);return db[_0x4776('0xb8')][_0x4776('0x63')](_0x1661e1)[_0x4776('0x29')](handleEntityNotFound(_0x3145d0,null))[_0x4776('0x29')](respondWithResult(_0x3145d0,null))[_0x4776('0xb5')](handleError(_0x3145d0,null));};exports[_0x4776('0xbb')]=function(_0x59d21f,_0x290db2){return db['FaxInteraction'][_0x4776('0xbb')](_0x59d21f[_0x4776('0x76')],{})[_0x4776('0x29')](respondWithResult(_0x290db2,0xc9))[_0x4776('0xb5')](handleError(_0x290db2,null));};exports['update']=function(_0xdb37a7,_0x1849d7){if(_0xdb37a7[_0x4776('0x76')]['id']){delete _0xdb37a7[_0x4776('0x76')]['id'];}return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0xdb37a7[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x1849d7,null))[_0x4776('0x29')](saveUpdates(_0xdb37a7[_0x4776('0x76')],null))[_0x4776('0x29')](respondWithResult(_0x1849d7,null))[_0x4776('0xb5')](handleError(_0x1849d7,null));};exports[_0x4776('0x2a')]=function(_0x542150,_0x262f9a){return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x542150[_0x4776('0xb7')]['id']}})['then'](handleEntityNotFound(_0x262f9a,null))[_0x4776('0x29')](removeEntity(_0x262f9a,null))[_0x4776('0xb5')](handleError(_0x262f9a,null));};exports[_0x4776('0xbc')]=function(_0x475fd3,_0x2e8de1){return db[_0x4776('0xb8')][_0x4776('0xbc')]()[_0x4776('0x29')](respondWithResult(_0x2e8de1,null))[_0x4776('0xb5')](handleError(_0x2e8de1,null));};exports['addMessage']=function(_0x40957b,_0x5b02b1,_0x157190){return db[_0x4776('0xbd')][_0x4776('0x63')]({'where':{'id':_0x40957b['params']['id']}})['then'](handleEntityNotFound(_0x5b02b1,null))[_0x4776('0x29')](function(_0x13f28e){if(_0x13f28e){return _0x13f28e['addMessage'](_0x40957b['body'][_0x4776('0xbe')],_[_0x4776('0xbf')](_0x40957b[_0x4776('0x76')],[_0x4776('0xbe'),'id'])||{});}})[_0x4776('0x29')](respondWithResult(_0x5b02b1,null))[_0x4776('0xb5')](handleError(_0x5b02b1,null));};exports[_0x4776('0xc0')]=function(_0x2e6427,_0x7dd36e,_0x4905b2){var _0xb00640={'raw':![],'where':{}};var _0x37fe90={};var _0x314987={'count':0x0,'rows':[]};return db[_0x4776('0xb8')][_0x4776('0xc1')]({'where':{'id':_0x2e6427[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x7dd36e,null))[_0x4776('0x29')](function(_0x599076){if(_0x599076){_0x37fe90[_0x4776('0x41')]=_['keys'](db[_0x4776('0xbd')][_0x4776('0x3d')]);_0x37fe90[_0x4776('0x42')]=_['keys'](_0x2e6427[_0x4776('0x42')]);_0x37fe90['filters']=_[_0x4776('0x45')](_0x37fe90[_0x4776('0x41')],_0x37fe90[_0x4776('0x42')]);_0xb00640[_0x4776('0x46')]=_[_0x4776('0x45')](_0x37fe90[_0x4776('0x41')],qs['fields'](_0x2e6427['query']['fields']));_0xb00640[_0x4776('0x46')]=_0xb00640[_0x4776('0x46')][_0x4776('0x48')]?_0xb00640[_0x4776('0x46')]:_0x37fe90[_0x4776('0x41')];if(!_0x2e6427[_0x4776('0x42')]['hasOwnProperty'](_0x4776('0xc2'))){_0xb00640[_0x4776('0x4a')]=qs[_0x4776('0x4a')](_0x2e6427[_0x4776('0x42')][_0x4776('0x4a')]);_0xb00640['offset']=qs['offset'](_0x2e6427[_0x4776('0x42')][_0x4776('0x23')]);}_0xb00640[_0x4776('0x8f')]=qs[_0x4776('0x4b')](_0x2e6427[_0x4776('0x42')][_0x4776('0x4b')]);_0xb00640[_0x4776('0x4c')]=qs[_0x4776('0x44')](_[_0x4776('0x4d')](_0x2e6427[_0x4776('0x42')],_0x37fe90[_0x4776('0x44')]));_0xb00640[_0x4776('0x4c')][_0x4776('0xb2')]=_0x599076['id'];if(_0x2e6427[_0x4776('0x42')]['filter']){_0xb00640[_0x4776('0x4c')]=_[_0x4776('0x9b')](_0xb00640[_0x4776('0x4c')],{'$or':_[_0x4776('0x30')](_0xb00640[_0x4776('0x46')],function(_0x210d60){var _0x3c52f9={};_0x3c52f9[_0x210d60]={'$like':'%'+_0x2e6427[_0x4776('0x42')][_0x4776('0x88')]+'%'};return _0x3c52f9;})});}if(_0x2e6427[_0x4776('0x42')]['$gte']){var _0x48c400=_0x2e6427[_0x4776('0x42')][_0x4776('0x7e')][_0x4776('0x6b')](',');var _0x43b923={};_0x43b923[_0x48c400[0x0]]={'$gte':moment(_0x48c400[0x1])[_0x4776('0xc3')](_0x4776('0xc4'))};_0xb00640['where']=_[_0x4776('0x9b')](_0xb00640[_0x4776('0x4c')],_0x43b923);}_0xb00640=_[_0x4776('0x9b')]({},_0xb00640,_0x2e6427[_0x4776('0xba')]);return db[_0x4776('0xbd')][_0x4776('0x25')]({'where':_0xb00640['where']})[_0x4776('0x29')](function(_0x240142){_0x314987[_0x4776('0x25')]=_0x240142;if(_0x2e6427[_0x4776('0x42')][_0x4776('0xc5')]){_0xb00640[_0x4776('0xb9')]=[{'all':!![]}];}return db[_0x4776('0xbd')]['findAll'](_0xb00640);})[_0x4776('0x29')](function(_0x2990a9){_0x314987[_0x4776('0xb4')]=_0x2990a9;return _0x314987;});}})[_0x4776('0x29')](respondWithFilteredResult(_0x7dd36e,_0xb00640))['catch'](handleError(_0x7dd36e,null));};exports[_0x4776('0xc6')]=function(_0x315e69,_0x5b02b0,_0x3ab1a2){return db[_0x4776('0xb8')]['find']({'where':{'id':_0x315e69[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x5b02b0,null))['then'](function(_0x3d30ad){if(_0x3d30ad){return _0x3d30ad['setTags'](_0x315e69[_0x4776('0x76')]['ids'],_['omit'](_0x315e69['body'],[_0x4776('0xbe'),'id'])||{})['spread'](function(){return db[_0x4776('0x71')][_0x4776('0xc7')]({'attributes':['id',_0x4776('0x2d'),_0x4776('0x50')],'where':{'id':_0x315e69[_0x4776('0x76')][_0x4776('0xbe')]}});})[_0x4776('0x29')](function(_0x55c049){socket[_0x4776('0xc8')](_0x4776('0xc9'),{'id':Number(_0x315e69[_0x4776('0xb7')]['id']),'tags':_0x55c049||[]});return{'id':Number(_0x315e69[_0x4776('0xb7')]['id']),'tags':_0x55c049||[]};});}})[_0x4776('0x29')](respondWithResult(_0x5b02b0,null))[_0x4776('0xb5')](handleError(_0x5b02b0,null));};exports[_0x4776('0xca')]=function(_0x1269dc,_0x23a21b,_0x151973){return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x1269dc[_0x4776('0xb7')]['id']}})[_0x4776('0x29')](handleEntityNotFound(_0x23a21b,null))[_0x4776('0x29')](function(_0x5a27ba){if(_0x5a27ba){return _0x5a27ba[_0x4776('0xca')](_0x1269dc[_0x4776('0x42')]['ids']);}})[_0x4776('0x29')](respondWithStatusCode(_0x23a21b,null))[_0x4776('0xb5')](handleError(_0x23a21b,null));};exports[_0x4776('0xcb')]=function(_0x197432,_0x3c9ee0){var _0x283ef0=moment()[_0x4776('0xcc')]()['toString']();var _0xf555a0=path[_0x4776('0xcd')](config[_0x4776('0xce')],_0x4776('0xcf'),'files',_0x4776('0xd0'));var _0x36afe1=path[_0x4776('0xcd')](config[_0x4776('0xce')],'server','files',_0x4776('0xd1'));var _0x40cf9a=path[_0x4776('0xcd')](_0xf555a0,_0x283ef0);var _0x4f741d=util['format'](_0x4776('0xd2'),_0x197432['params']['id'],_0x283ef0);var _0x168fda=path[_0x4776('0xcd')](_0xf555a0,_0x4f741d);var _0x1fcbeb=[];_0x1fcbeb[_0x4776('0x35')]({'model':db[_0x4776('0xd3')],'as':'Attachment','raw':!![]});var _0x35b767=[{'model':db[_0x4776('0xbd')],'as':_0x4776('0xd4'),'attributes':['id',_0x4776('0x76'),_0x4776('0xd5')],'include':_0x1fcbeb}];return db[_0x4776('0xb8')][_0x4776('0x63')]({'where':{'id':_0x197432[_0x4776('0xb7')]['id']},'include':_0x35b767})[_0x4776('0x29')](handleEntityNotFound(_0x3c9ee0,null))[_0x4776('0x29')](function(_0x58ddcd){if(_0x58ddcd&&_0x58ddcd[_0x4776('0xd4')]){var _0xba7a75=_0x58ddcd[_0x4776('0xd6')]({'plain':!![]});fs[_0x4776('0xd7')](_0x40cf9a);for(var _0x2a2619=0x0;_0x2a2619<_0xba7a75[_0x4776('0xd4')]['length'];_0x2a2619++){var _0x404c76=_0xba7a75[_0x4776('0xd4')][_0x2a2619]['Attachment'];if(_0x404c76){var _0x442f7a=path[_0x4776('0xcd')](_0x36afe1,_0x404c76[_0x4776('0xd8')]);if(fs[_0x4776('0xd9')](_0x442f7a)){fs[_0x4776('0xda')](_0x442f7a)['pipe'](fs[_0x4776('0xdb')](path[_0x4776('0xcd')](_0x40cf9a,_0x404c76[_0x4776('0xd8')])));}}}return BPromise[_0x4776('0x92')]()['then'](function(){return new BPromise(function(_0x3e29b,_0x1eb298){zipdir(_0x40cf9a,{'saveTo':_0x168fda},function(_0x403552,_0xb4106){if(_0x403552)return _0x1eb298(_0x403552);return _0x3e29b(_0xb4106);});})[_0x4776('0x29')](function(){return new BPromise(function(_0x2733bf,_0xfc57fa){rimraf(_0x40cf9a,function(_0x38cbbc){if(_0x38cbbc)_0xfc57fa(_0x38cbbc);return _0x2733bf();});});})[_0x4776('0x29')](function(){return _0x3c9ee0[_0x4776('0xcb')](_0x168fda,_0x4f741d,function(_0x4d9bec){if(_0x4d9bec){console[_0x4776('0xdc')](_0x4776('0xdd'),_0x4d9bec);}else{fs[_0x4776('0xde')](_0x168fda);}});});});}else{return _0x3c9ee0[_0x4776('0x2b')](0xc8);}})[_0x4776('0xb5')](handleError(_0x3c9ee0,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1669f34..ccfbd21 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 _0x3c21=['../../mysqldb','FaxInteraction','setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','catch','hook','exports','events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3c21,0x12b));var _0x13c2=function(_0xa20c2f,_0x43df3d){_0xa20c2f=_0xa20c2f-0x0;var _0x48b2d0=_0x3c21[_0xa20c2f];return _0x48b2d0;};'use strict';var EventEmitter=require(_0x13c2('0x0'));var FaxInteraction=require(_0x13c2('0x1'))['db'][_0x13c2('0x2')];var FaxMessage=require(_0x13c2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x13c2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b5ba0){return function(_0x38be22,_0x8f810b,_0x3c5f86){_0x38be22[_0x13c2('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50378a){_0x38be22[_0x13c2('0x5')](_0x13c2('0x6'),_0x50378a[_0x13c2('0x7')](function(_0x17bef6){return{'id':_0x17bef6['id']};}));return FaxMessage[_0x13c2('0x8')]({'where':{'FaxInteractionId':_0x38be22['id'],'direction':'in','read':![]},'raw':!![]});})[_0x13c2('0x9')](function(_0x56e95a){_0x38be22[_0x13c2('0x5')](_0x13c2('0xa'),_0x56e95a[_0x13c2('0xb')]);FaxInteractionEvents['emit'](_0x3b5ba0+':'+_0x38be22['id'],_0x38be22);FaxInteractionEvents['emit'](_0x3b5ba0,_0x38be22);_0x3c5f86(null);})[_0x13c2('0xc')](_0x3c5f86(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x13c2('0xd')](e,emitEvent(event));}}module[_0x13c2('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x436f=['unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','save','getUsers','then','Users','map','findAll','setDataValue'];(function(_0xcf8bba,_0x421bdc){var _0x106607=function(_0x221b96){while(--_0x221b96){_0xcf8bba['push'](_0xcf8bba['shift']());}};_0x106607(++_0x421bdc);}(_0x436f,0x1d3));var _0xf436=function(_0x497d07,_0x22aed3){_0x497d07=_0x497d07-0x0;var _0x1f89cd=_0x436f[_0x497d07];return _0x1f89cd;};'use strict';var EventEmitter=require(_0xf436('0x0'));var FaxInteraction=require(_0xf436('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xf436('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf436('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4cbab5){return function(_0x5cdbca,_0x2781f5,_0xaa4c53){_0x5cdbca[_0xf436('0x3')]({'attributes':['id'],'raw':!![]})[_0xf436('0x4')](function(_0x31d999){_0x5cdbca['setDataValue'](_0xf436('0x5'),_0x31d999[_0xf436('0x6')](function(_0xfeaf90){return{'id':_0xfeaf90['id']};}));return FaxMessage[_0xf436('0x7')]({'where':{'FaxInteractionId':_0x5cdbca['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf436('0x4')](function(_0x30a274){_0x5cdbca[_0xf436('0x8')](_0xf436('0x9'),_0x30a274[_0xf436('0xa')]);FaxInteractionEvents['emit'](_0x4cbab5+':'+_0x5cdbca['id'],_0x5cdbca);FaxInteractionEvents[_0xf436('0xb')](_0x4cbab5,_0x5cdbca);_0xaa4c53(null);})['catch'](_0xaa4c53(null));};}for(var e in events){if(events[_0xf436('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf436('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6764673..2a87fc5 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 _0x8fc3=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x504e76,_0x56b71e){var _0x2d7e12=function(_0x357148){while(--_0x357148){_0x504e76['push'](_0x504e76['shift']());}};_0x2d7e12(++_0x56b71e);}(_0x8fc3,0xc4));var _0x38fc=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x8fc3[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x38fc('0x0'));var util=require(_0x38fc('0x1'));var logger=require(_0x38fc('0x2'))(_0x38fc('0x3'));var moment=require(_0x38fc('0x4'));var BPromise=require('bluebird');var rp=require(_0x38fc('0x5'));var fs=require('fs');var path=require(_0x38fc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x145800,_0xcf8516){return _0x145800[_0x38fc('0x7')](_0x38fc('0x8'),attributes,{'tableName':_0x38fc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bfef8,_0x18062f,_0x56191e){if(_0x1bfef8[_0x38fc('0xa')](_0x38fc('0xb'))){_0x1bfef8[_0x38fc('0xc')]=moment()[_0x38fc('0xd')](_0x38fc('0xe'));}_0x56191e(null,_0x1bfef8);}}});}; \ No newline at end of file +var _0x1735=['api','moment','request-promise','rimraf','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x471cc1,_0x490ed3){var _0x34aa3e=function(_0x18fa1c){while(--_0x18fa1c){_0x471cc1['push'](_0x471cc1['shift']());}};_0x34aa3e(++_0x490ed3);}(_0x1735,0xb1));var _0x5173=function(_0x132388,_0x380af0){_0x132388=_0x132388-0x0;var _0x24c044=_0x1735[_0x132388];return _0x24c044;};'use strict';var _=require(_0x5173('0x0'));var util=require(_0x5173('0x1'));var logger=require(_0x5173('0x2'))(_0x5173('0x3'));var moment=require(_0x5173('0x4'));var BPromise=require('bluebird');var rp=require(_0x5173('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5173('0x6'));var config=require('../../config/environment');var attributes=require(_0x5173('0x7'));module['exports']=function(_0x42d5c2,_0x276a71){return _0x42d5c2[_0x5173('0x8')](_0x5173('0x9'),attributes,{'tableName':_0x5173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38452d,_0x2677db,_0x92373f){if(_0x38452d[_0x5173('0xb')](_0x5173('0xc'))){_0x38452d[_0x5173('0xd')]=moment()[_0x5173('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x92373f(null,_0x38452d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b2abb46..0f79a6d 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 _0x1bc0=['FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','limit','AddTagsToFaxInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2431d6,_0x25189a){var _0x4d0f9b=function(_0x52cd84){while(--_0x52cd84){_0x2431d6['push'](_0x2431d6['shift']());}};_0x4d0f9b(++_0x25189a);}(_0x1bc0,0x190));var _0x01bc=function(_0x54fd8e,_0x3fb25d){_0x54fd8e=_0x54fd8e-0x0;var _0x47f301=_0x1bc0[_0x54fd8e];return _0x47f301;};'use strict';var _=require(_0x01bc('0x0'));var util=require('util');var moment=require(_0x01bc('0x1'));var BPromise=require(_0x01bc('0x2'));var rs=require(_0x01bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x01bc('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x01bc('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x01bc('0x6')]=_[_0x01bc('0x7')](config[_0x01bc('0x6')],{'host':_0x01bc('0x8'),'port':0x18eb});var socket=require(_0x01bc('0x9'))(new Redis(config[_0x01bc('0x6')]));require(_0x01bc('0xa'))[_0x01bc('0xb')](socket);function respondWithRpcPromise(_0x581b15,_0x304bdd,_0x55384f){return new BPromise(function(_0xe91be3,_0x3fb472){return client[_0x01bc('0xc')](_0x581b15,_0x55384f)[_0x01bc('0xd')](function(_0x20385a){logger[_0x01bc('0xe')](_0x01bc('0xf'),_0x304bdd,_0x01bc('0x10'));logger[_0x01bc('0x11')](_0x01bc('0x12'),_0x304bdd,_0x01bc('0x10'),JSON[_0x01bc('0x13')](_0x20385a));if(_0x20385a[_0x01bc('0x14')]){if(_0x20385a[_0x01bc('0x14')][_0x01bc('0x15')]===0x1f4){logger[_0x01bc('0x14')](_0x01bc('0xf'),_0x304bdd,_0x20385a['error']['message']);return _0x3fb472(_0x20385a[_0x01bc('0x14')][_0x01bc('0x16')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x304bdd,_0x20385a[_0x01bc('0x14')][_0x01bc('0x16')]);return _0xe91be3(_0x20385a[_0x01bc('0x14')][_0x01bc('0x16')]);}else{logger[_0x01bc('0xe')](_0x01bc('0xf'),_0x304bdd,'request\x20sent');_0xe91be3(_0x20385a[_0x01bc('0x17')][_0x01bc('0x16')]);}})[_0x01bc('0x18')](function(_0x51715c){logger[_0x01bc('0x14')](_0x01bc('0xf'),_0x304bdd,_0x51715c);_0x3fb472(_0x51715c);});});}exports[_0x01bc('0x19')]=function(_0x28a40f){var _0x48d420=this;return new Promise(function(_0x1df3ab,_0x440e2c){return db[_0x01bc('0x1a')]['update'](_0x28a40f['body'],{'raw':_0x28a40f[_0x01bc('0x1b')]?_0x28a40f[_0x01bc('0x1b')][_0x01bc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28a40f[_0x01bc('0x1b')]?_0x28a40f['options']['where']||null:null,'attributes':_0x28a40f[_0x01bc('0x1b')]?_0x28a40f['options']['attributes']||null:null,'limit':_0x28a40f[_0x01bc('0x1b')]?_0x28a40f[_0x01bc('0x1b')][_0x01bc('0x1d')]||null:null})[_0x01bc('0xd')](function(_0x10637d){logger[_0x01bc('0xe')](_0x01bc('0x19'),_0x28a40f);logger[_0x01bc('0x11')](_0x01bc('0x19'),_0x28a40f,JSON[_0x01bc('0x13')](_0x10637d));_0x1df3ab(_0x10637d);})[_0x01bc('0x18')](function(_0x44edeb){logger[_0x01bc('0x14')](_0x01bc('0x19'),_0x44edeb[_0x01bc('0x16')],_0x28a40f);_0x440e2c(_0x48d420['error'](0x1f4,_0x44edeb[_0x01bc('0x16')]));});});};exports[_0x01bc('0x1e')]=function(_0x27b109){return new Promise(function(_0x4a697c,_0x5aed4a){return db[_0x01bc('0x1a')][_0x01bc('0x1f')]({'where':_0x27b109['options']?_0x27b109[_0x01bc('0x1b')]['where']||null:null})[_0x01bc('0xd')](function(_0x44ffff){if(_0x44ffff){return _0x44ffff[_0x01bc('0x20')](_0x27b109['body'][_0x01bc('0x21')],_[_0x01bc('0x22')](_0x27b109[_0x01bc('0x23')],[_0x01bc('0x21'),'id'])||{});}})[_0x01bc('0x24')](function(_0x4f0d61){logger['info'](_0x01bc('0x25'),_0x27b109);logger['debug'](_0x01bc('0x25'),_0x27b109,JSON[_0x01bc('0x13')](_0x4f0d61));_0x4a697c(_0x4f0d61);})[_0x01bc('0x18')](function(_0x3e27d8){logger[_0x01bc('0x14')]('AddTags',_0x3e27d8[_0x01bc('0x16')],_0x27b109);_0x5aed4a(_this[_0x01bc('0x14')](0x1f4,_0x3e27d8['message']));});});}; \ No newline at end of file +var _0x6ecd=['stringify','AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','body','options','raw','where','attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6ecd,0x18e));var _0xd6ec=function(_0x10ffb9,_0x2246eb){_0x10ffb9=_0x10ffb9-0x0;var _0x57d6d7=_0x6ecd[_0x10ffb9];return _0x57d6d7;};'use strict';var _=require(_0xd6ec('0x0'));var util=require(_0xd6ec('0x1'));var moment=require('moment');var BPromise=require(_0xd6ec('0x2'));var rs=require(_0xd6ec('0x3'));var fs=require('fs');var Redis=require(_0xd6ec('0x4'));var db=require(_0xd6ec('0x5'))['db'];var utils=require(_0xd6ec('0x6'));var logger=require('../../config/logger')(_0xd6ec('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6ec('0x8'));var client=jayson[_0xd6ec('0x9')][_0xd6ec('0xa')]({'port':0x232a});config[_0xd6ec('0xb')]=_['defaults'](config[_0xd6ec('0xb')],{'host':_0xd6ec('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6ec('0xb')]));require(_0xd6ec('0xd'))[_0xd6ec('0xe')](socket);function respondWithRpcPromise(_0x59fc19,_0x48c45a,_0x3e07ab){return new BPromise(function(_0x5f4ae7,_0x5ed60d){return client['request'](_0x59fc19,_0x3e07ab)[_0xd6ec('0xf')](function(_0x58fb30){logger[_0xd6ec('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x48c45a,_0xd6ec('0x11'));logger[_0xd6ec('0x12')](_0xd6ec('0x13'),_0x48c45a,'request\x20sent',JSON['stringify'](_0x58fb30));if(_0x58fb30[_0xd6ec('0x14')]){if(_0x58fb30['error']['code']===0x1f4){logger[_0xd6ec('0x14')](_0xd6ec('0x15'),_0x48c45a,_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);return _0x5ed60d(_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);}logger[_0xd6ec('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x48c45a,_0x58fb30[_0xd6ec('0x14')][_0xd6ec('0x16')]);return _0x5f4ae7(_0x58fb30[_0xd6ec('0x14')]['message']);}else{logger[_0xd6ec('0x10')](_0xd6ec('0x15'),_0x48c45a,'request\x20sent');_0x5f4ae7(_0x58fb30[_0xd6ec('0x17')][_0xd6ec('0x16')]);}})[_0xd6ec('0x18')](function(_0x157f95){logger[_0xd6ec('0x14')](_0xd6ec('0x15'),_0x48c45a,_0x157f95);_0x5ed60d(_0x157f95);});});}exports[_0xd6ec('0x19')]=function(_0x1f05cf){var _0x2defda=this;return new Promise(function(_0x583e24,_0x496924){return db['FaxInteraction']['update'](_0x1f05cf[_0xd6ec('0x1a')],{'raw':_0x1f05cf[_0xd6ec('0x1b')]?_0x1f05cf['options'][_0xd6ec('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f05cf['options']?_0x1f05cf[_0xd6ec('0x1b')][_0xd6ec('0x1d')]||null:null,'attributes':_0x1f05cf[_0xd6ec('0x1b')]?_0x1f05cf[_0xd6ec('0x1b')][_0xd6ec('0x1e')]||null:null,'limit':_0x1f05cf['options']?_0x1f05cf[_0xd6ec('0x1b')]['limit']||null:null})[_0xd6ec('0xf')](function(_0x48ad33){logger['info']('UpdateFaxInteraction',_0x1f05cf);logger[_0xd6ec('0x12')]('UpdateFaxInteraction',_0x1f05cf,JSON[_0xd6ec('0x1f')](_0x48ad33));_0x583e24(_0x48ad33);})['catch'](function(_0xbfdfa6){logger[_0xd6ec('0x14')](_0xd6ec('0x19'),_0xbfdfa6[_0xd6ec('0x16')],_0x1f05cf);_0x496924(_0x2defda['error'](0x1f4,_0xbfdfa6[_0xd6ec('0x16')]));});});};exports[_0xd6ec('0x20')]=function(_0x5d70ec){return new Promise(function(_0x56e2bd,_0x5ee5f8){return db[_0xd6ec('0x21')][_0xd6ec('0x22')]({'where':_0x5d70ec[_0xd6ec('0x1b')]?_0x5d70ec[_0xd6ec('0x1b')][_0xd6ec('0x1d')]||null:null})[_0xd6ec('0xf')](function(_0x1b61b1){if(_0x1b61b1){return _0x1b61b1['addTags'](_0x5d70ec[_0xd6ec('0x1a')][_0xd6ec('0x23')],_[_0xd6ec('0x24')](_0x5d70ec[_0xd6ec('0x1a')],['ids','id'])||{});}})[_0xd6ec('0x25')](function(_0x4cd636){logger['info'](_0xd6ec('0x26'),_0x5d70ec);logger[_0xd6ec('0x12')](_0xd6ec('0x26'),_0x5d70ec,JSON[_0xd6ec('0x1f')](_0x4cd636));_0x56e2bd(_0x4cd636);})[_0xd6ec('0x18')](function(_0x459833){logger[_0xd6ec('0x14')](_0xd6ec('0x26'),_0x459833['message'],_0x5d70ec);_0x5ee5f8(_this[_0xd6ec('0x14')](0x1f4,_0x459833[_0xd6ec('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 332ba86..33dc3b7 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 _0x229d=['faxInteraction:','remove','update','emit','removeListener','register'];(function(_0x4cbdc4,_0x8be7a8){var _0x413c70=function(_0x9da4a5){while(--_0x9da4a5){_0x4cbdc4['push'](_0x4cbdc4['shift']());}};_0x413c70(++_0x8be7a8);}(_0x229d,0xd3));var _0xd229=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x229d[_0x6c993a];return _0x27f547;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xd229('0x0'),_0xd229('0x1')];function createListener(_0x4b60d9,_0x34a58d){return function(_0x267be0){_0x34a58d[_0xd229('0x2')](_0x4b60d9,_0x267be0);};}function removeListener(_0xcd4a95,_0x249f64){return function(){FaxInteractionEvents[_0xd229('0x3')](_0xcd4a95,_0x249f64);};}exports[_0xd229('0x4')]=function(_0xcc6e0e){for(var _0x255d78=0x0,_0x4236fe=events['length'];_0x255d78<_0x4236fe;_0x255d78++){var _0x494edf=events[_0x255d78];var _0x17e53d=createListener(_0xd229('0x5')+_0x494edf,_0xcc6e0e);FaxInteractionEvents['on'](_0x494edf,_0x17e53d);}}; \ No newline at end of file +var _0x7b87=['update','emit','removeListener','register','faxInteraction:','save','remove'];(function(_0x67421e,_0x5231af){var _0x1f90a1=function(_0x538e47){while(--_0x538e47){_0x67421e['push'](_0x67421e['shift']());}};_0x1f90a1(++_0x5231af);}(_0x7b87,0x163));var _0x77b8=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x7b87[_0x4b03d3];return _0x58a968;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x77b8('0x0'),_0x77b8('0x1'),_0x77b8('0x2')];function createListener(_0x112904,_0x245747){return function(_0x44899c){_0x245747[_0x77b8('0x3')](_0x112904,_0x44899c);};}function removeListener(_0x4454fc,_0x1cd765){return function(){FaxInteractionEvents[_0x77b8('0x4')](_0x4454fc,_0x1cd765);};}exports[_0x77b8('0x5')]=function(_0x43aaee){for(var _0x1519e9=0x0,_0x15843f=events['length'];_0x1519e9<_0x15843f;_0x1519e9++){var _0x561b19=events[_0x1519e9];var _0x81dd64=createListener(_0x77b8('0x6')+_0x561b19,_0x43aaee);FaxInteractionEvents['on'](_0x561b19,_0x81dd64);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index bb6f400..24ebba5 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 _0x7554=['put','tracked','fax','faxinteraction:update','update','faxinteraction:destroy','delete','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','faxinteraction:addtags','addTags'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7554,0xcf));var _0x4755=function(_0x50585f,_0x2cd50a){_0x50585f=_0x50585f-0x0;var _0x50882c=_0x7554[_0x50585f];return _0x50882c;};'use strict';var multer=require(_0x4755('0x0'));var util=require('util');var path=require(_0x4755('0x1'));var timeout=require('connect-timeout');var express=require(_0x4755('0x2'));var router=express[_0x4755('0x3')]();var fs_extra=require(_0x4755('0x4'));var auth=require(_0x4755('0x5'));var interaction=require(_0x4755('0x6'));var config=require(_0x4755('0x7'));var controller=require(_0x4755('0x8'));router[_0x4755('0x9')]('/',auth[_0x4755('0xa')](),controller[_0x4755('0xb')]);router[_0x4755('0x9')](_0x4755('0xc'),auth[_0x4755('0xa')](),controller['describe']);router[_0x4755('0x9')](_0x4755('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4755('0x9')]('/:id/messages',auth[_0x4755('0xa')](),controller[_0x4755('0xe')]);router['get'](_0x4755('0xf'),auth[_0x4755('0xa')](),controller[_0x4755('0x10')]);router[_0x4755('0x11')]('/',auth['isAuthenticated'](),controller[_0x4755('0x12')]);router['post'](_0x4755('0x13'),auth[_0x4755('0xa')](),controller[_0x4755('0x14')]);router['post'](_0x4755('0x15'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x4755('0x16')),controller[_0x4755('0x17')]);router[_0x4755('0x18')]('/:id',auth[_0x4755('0xa')](),interaction[_0x4755('0x19')](_0x4755('0x1a'),_0x4755('0x1b')),controller[_0x4755('0x1c')]);router['delete'](_0x4755('0xd'),auth[_0x4755('0xa')](),interaction[_0x4755('0x19')](_0x4755('0x1a'),_0x4755('0x1d')),controller['destroy']);router[_0x4755('0x1e')](_0x4755('0x15'),auth[_0x4755('0xa')](),controller[_0x4755('0x1f')]);module[_0x4755('0x20')]=router; \ No newline at end of file +var _0x96b8=['isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','faxinteraction:addtags','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3aa9cb,_0x127520){var _0x4a087e=function(_0xcfe086){while(--_0xcfe086){_0x3aa9cb['push'](_0x3aa9cb['shift']());}};_0x4a087e(++_0x127520);}(_0x96b8,0x100));var _0x896b=function(_0x230e01,_0x30d850){_0x230e01=_0x230e01-0x0;var _0x5e8594=_0x96b8[_0x230e01];return _0x5e8594;};'use strict';var multer=require(_0x896b('0x0'));var util=require(_0x896b('0x1'));var path=require('path');var timeout=require(_0x896b('0x2'));var express=require(_0x896b('0x3'));var router=express[_0x896b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x896b('0x5'));var config=require(_0x896b('0x6'));var controller=require(_0x896b('0x7'));router['get']('/',auth[_0x896b('0x8')](),controller[_0x896b('0x9')]);router['get'](_0x896b('0xa'),auth['isAuthenticated'](),controller[_0x896b('0xb')]);router[_0x896b('0xc')](_0x896b('0xd'),auth['isAuthenticated'](),controller[_0x896b('0xe')]);router['get'](_0x896b('0xf'),auth[_0x896b('0x8')](),controller[_0x896b('0x10')]);router[_0x896b('0xc')](_0x896b('0x11'),auth[_0x896b('0x8')](),controller[_0x896b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x896b('0x13')]);router[_0x896b('0x14')]('/:id/messages',auth[_0x896b('0x8')](),controller[_0x896b('0x15')]);router[_0x896b('0x14')]('/:id/tags',auth[_0x896b('0x8')](),interaction[_0x896b('0x16')]('fax',_0x896b('0x17')),controller['addTags']);router[_0x896b('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0x896b('0x16')](_0x896b('0x19'),_0x896b('0x1a')),controller[_0x896b('0x1b')]);router[_0x896b('0x1c')](_0x896b('0xd'),auth[_0x896b('0x8')](),interaction[_0x896b('0x16')](_0x896b('0x19'),_0x896b('0x1d')),controller[_0x896b('0x1e')]);router[_0x896b('0x1c')]('/:id/tags',auth[_0x896b('0x8')](),controller[_0x896b('0x1f')]);module[_0x896b('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index cb6714d..bfc66d3 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 _0x21d1=['ENUM','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x8fd990,_0x46be51){var _0x58487e=function(_0x31167e){while(--_0x31167e){_0x8fd990['push'](_0x8fd990['shift']());}};_0x58487e(++_0x46be51);}(_0x21d1,0x1c9));var _0x121d=function(_0x2c95fa,_0x264287){_0x2c95fa=_0x2c95fa-0x0;var _0x5adc18=_0x21d1[_0x2c95fa];return _0x5adc18;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'body':{'type':Sequelize[_0x121d('0x2')](_0x121d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x121d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x121d('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x121d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x121d('0x6')]}}; \ No newline at end of file +var _0xf874=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xf874,0xed));var _0x4f87=function(_0x53307e,_0x20d19f){_0x53307e=_0x53307e-0x0;var _0x37fd73=_0xf874[_0x53307e];return _0x37fd73;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4f87('0x0')](_0x4f87('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x4f87('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f87('0x3')]('in',_0x4f87('0x4')),'defaultValue':_0x4f87('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4f87('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 1386cd2..3faf542 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 _0x4c28=['basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','name','send','map','rawAttributes','fieldName','type','key','model','filters','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','rows','show','params','keys','intersection','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','motionChannel','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x4c28,0x1bd));var _0x84c2=function(_0x2d8f47,_0x4aa8d4){_0x2d8f47=_0x2d8f47-0x0;var _0x26cede=_0x4c28[_0x2d8f47];return _0x26cede;};'use strict';var emlformat=require(_0x84c2('0x0'));var rimraf=require(_0x84c2('0x1'));var zipdir=require(_0x84c2('0x2'));var jsonpatch=require(_0x84c2('0x3'));var rp=require(_0x84c2('0x4'));var moment=require('moment');var BPromise=require(_0x84c2('0x5'));var Mustache=require(_0x84c2('0x6'));var util=require(_0x84c2('0x7'));var path=require('path');var sox=require(_0x84c2('0x8'));var csv=require(_0x84c2('0x9'));var ejs=require(_0x84c2('0xa'));var fs=require('fs');var fs_extra=require(_0x84c2('0xb'));var _=require('lodash');var squel=require(_0x84c2('0xc'));var crypto=require(_0x84c2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x84c2('0x9'));var querystring=require(_0x84c2('0xe'));var Papa=require('papaparse');var Redis=require(_0x84c2('0xf'));var authService=require(_0x84c2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x84c2('0x11'));var hardwareService=require(_0x84c2('0x12'));var logger=require(_0x84c2('0x13'))(_0x84c2('0x14'));var utils=require(_0x84c2('0x15'));var config=require(_0x84c2('0x16'));var licenseUtil=require(_0x84c2('0x17'));var db=require(_0x84c2('0x18'))['db'];config[_0x84c2('0x19')]=_[_0x84c2('0x1a')](config[_0x84c2('0x19')],{'host':_0x84c2('0x1b'),'port':0x18eb});var socket=require(_0x84c2('0x1c'))(new Redis(config[_0x84c2('0x19')]));require(_0x84c2('0x1d'))['register'](socket);var jayson=require(_0x84c2('0x1e'));var client=jayson[_0x84c2('0x1f')][_0x84c2('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22ed6d,_0x1f91b4,_0x25f3fb,_0xf190a6){return new BPromise(function(_0x361c2d,_0x562c38){var _0x4a3e10=_0xf190a6||client;return _0x4a3e10[_0x84c2('0x21')](_0x22ed6d,_0x25f3fb)[_0x84c2('0x22')](function(_0x5c285a){logger[_0x84c2('0x23')](_0x84c2('0x24'),_0x1f91b4,_0x84c2('0x25'));logger[_0x84c2('0x26')](_0x84c2('0x27'),_0x1f91b4,_0x84c2('0x25'),JSON[_0x84c2('0x28')](_0x5c285a));if(_0x5c285a['error']){if(_0x5c285a[_0x84c2('0x29')][_0x84c2('0x2a')]===0x1f4){logger[_0x84c2('0x29')](_0x84c2('0x24'),_0x1f91b4,_0x5c285a[_0x84c2('0x29')][_0x84c2('0x2b')]);return _0x562c38(_0x5c285a[_0x84c2('0x29')][_0x84c2('0x2b')]);}logger[_0x84c2('0x29')](_0x84c2('0x24'),_0x1f91b4,_0x5c285a[_0x84c2('0x29')]['message']);return _0x361c2d(_0x5c285a[_0x84c2('0x29')][_0x84c2('0x2b')]);}else{logger['info'](_0x84c2('0x24'),_0x1f91b4,_0x84c2('0x25'));_0x361c2d(_0x5c285a[_0x84c2('0x2c')][_0x84c2('0x2b')]);}})[_0x84c2('0x2d')](function(_0x2bc267){logger[_0x84c2('0x29')](_0x84c2('0x24'),_0x1f91b4,_0x2bc267);_0x562c38(_0x2bc267);});});}function respondWithStatusCode(_0x34ce36,_0x4fbd15){_0x4fbd15=_0x4fbd15||0xcc;return function(_0x3ba38b){if(_0x3ba38b){return _0x34ce36[_0x84c2('0x2e')](_0x4fbd15);}return _0x34ce36[_0x84c2('0x2f')](_0x4fbd15)[_0x84c2('0x30')]();};}function respondWithResult(_0x40b180,_0x1e2613){_0x1e2613=_0x1e2613||0xc8;return function(_0x23ae6e){if(_0x23ae6e){return _0x40b180[_0x84c2('0x2f')](_0x1e2613)[_0x84c2('0x31')](_0x23ae6e);}};}function respondWithFilteredResult(_0x3dd775,_0x2ae410){return function(_0x3104c1){if(_0x3104c1){var _0x47d54c=typeof _0x2ae410[_0x84c2('0x32')]==='undefined'&&typeof _0x2ae410[_0x84c2('0x33')]==='undefined';var _0x5805d4=_0x3104c1[_0x84c2('0x34')];var _0x14cc84=_0x47d54c?0x0:_0x2ae410[_0x84c2('0x32')];var _0x442a30=_0x47d54c?_0x3104c1[_0x84c2('0x34')]:_0x2ae410['offset']+_0x2ae410['limit'];var _0x5bd140;if(_0x442a30>=_0x5805d4){_0x442a30=_0x5805d4;_0x5bd140=0xc8;}else{_0x5bd140=0xce;}_0x3dd775[_0x84c2('0x2f')](_0x5bd140);return _0x3dd775['set'](_0x84c2('0x35'),_0x14cc84+'-'+_0x442a30+'/'+_0x5805d4)[_0x84c2('0x31')](_0x3104c1);}return null;};}function patchUpdates(_0x393fef){return function(_0x1e3bba){try{jsonpatch['apply'](_0x1e3bba,_0x393fef,!![]);}catch(_0x531644){return BPromise[_0x84c2('0x36')](_0x531644);}return _0x1e3bba[_0x84c2('0x37')]();};}function saveUpdates(_0x2ad8c0,_0x4c7f62){return function(_0x43273c){if(_0x43273c){return _0x43273c[_0x84c2('0x38')](_0x2ad8c0)[_0x84c2('0x22')](function(_0x17a431){return _0x17a431;});}return null;};}function removeEntity(_0x1715c9,_0xf0bc6c){return function(_0x286aa3){if(_0x286aa3){return _0x286aa3[_0x84c2('0x39')]()['then'](function(){_0x1715c9[_0x84c2('0x2f')](0xcc)[_0x84c2('0x30')]();});}};}function handleEntityNotFound(_0x9b17fb,_0x2b2699){return function(_0x58f970){if(!_0x58f970){_0x9b17fb[_0x84c2('0x2e')](0x194);}return _0x58f970;};}function handleError(_0x2d1ca1,_0x97c20b){_0x97c20b=_0x97c20b||0x1f4;return function(_0x117bb0){logger[_0x84c2('0x29')](_0x117bb0['stack']);if(_0x117bb0[_0x84c2('0x3a')]){delete _0x117bb0[_0x84c2('0x3a')];}_0x2d1ca1[_0x84c2('0x2f')](_0x97c20b)[_0x84c2('0x3b')](_0x117bb0);};}exports['index']=function(_0x5568ee,_0x3d86c0){var _0xc73521={},_0x1580d1={},_0x1154bd={'count':0x0,'rows':[]};var _0x62d7ef=_[_0x84c2('0x3c')](db['FaxMessage'][_0x84c2('0x3d')],function(_0x126ca5){return{'name':_0x126ca5[_0x84c2('0x3e')],'type':_0x126ca5[_0x84c2('0x3f')][_0x84c2('0x40')]};});_0x1580d1[_0x84c2('0x41')]=_[_0x84c2('0x3c')](_0x62d7ef,'name');_0x1580d1['query']=_['keys'](_0x5568ee['query']);_0x1580d1[_0x84c2('0x42')]=_['intersection'](_0x1580d1['model'],_0x1580d1['query']);_0xc73521[_0x84c2('0x43')]=_['intersection'](_0x1580d1[_0x84c2('0x41')],qs[_0x84c2('0x44')](_0x5568ee[_0x84c2('0x45')]['fields']));_0xc73521[_0x84c2('0x43')]=_0xc73521[_0x84c2('0x43')][_0x84c2('0x46')]?_0xc73521[_0x84c2('0x43')]:_0x1580d1[_0x84c2('0x41')];if(!_0x5568ee[_0x84c2('0x45')][_0x84c2('0x47')]('nolimit')){_0xc73521[_0x84c2('0x33')]=qs['limit'](_0x5568ee[_0x84c2('0x45')][_0x84c2('0x33')]);_0xc73521[_0x84c2('0x32')]=qs[_0x84c2('0x32')](_0x5568ee[_0x84c2('0x45')][_0x84c2('0x32')]);}_0xc73521[_0x84c2('0x48')]=qs[_0x84c2('0x49')](_0x5568ee[_0x84c2('0x45')][_0x84c2('0x49')]);_0xc73521[_0x84c2('0x4a')]=qs[_0x84c2('0x42')](_[_0x84c2('0x4b')](_0x5568ee[_0x84c2('0x45')],_0x1580d1[_0x84c2('0x42')]),_0x62d7ef);if(_0x5568ee['query'][_0x84c2('0x4c')]){_0xc73521[_0x84c2('0x4a')]=_[_0x84c2('0x4d')](_0xc73521[_0x84c2('0x4a')],{'$or':_['map'](_0x62d7ef,function(_0x252f64){if(_0x252f64['type']!==_0x84c2('0x4e')){var _0x168cb2={};_0x168cb2[_0x252f64[_0x84c2('0x3a')]]={'$like':'%'+_0x5568ee[_0x84c2('0x45')]['filter']+'%'};return _0x168cb2;}})});}_0xc73521=_['merge']({},_0xc73521,_0x5568ee[_0x84c2('0x4f')]);var _0x284467={'where':_0xc73521['where']};return db[_0x84c2('0x50')]['count'](_0x284467)[_0x84c2('0x22')](function(_0x2143d1){_0x1154bd[_0x84c2('0x34')]=_0x2143d1;if(_0x5568ee['query'][_0x84c2('0x51')]){_0xc73521[_0x84c2('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x84c2('0x53')](_0xc73521);})[_0x84c2('0x22')](function(_0x55f15f){_0x1154bd[_0x84c2('0x54')]=_0x55f15f;return _0x1154bd;})[_0x84c2('0x22')](respondWithFilteredResult(_0x3d86c0,_0xc73521))['catch'](handleError(_0x3d86c0,null));};exports[_0x84c2('0x55')]=function(_0xcfa0de,_0x4c4a71){var _0x3f1f9a={'raw':!![],'where':{'id':_0xcfa0de[_0x84c2('0x56')]['id']}},_0x3c3cd3={};_0x3c3cd3['model']=_[_0x84c2('0x57')](db[_0x84c2('0x50')]['rawAttributes']);_0x3c3cd3[_0x84c2('0x45')]=_['keys'](_0xcfa0de['query']);_0x3c3cd3['filters']=_[_0x84c2('0x58')](_0x3c3cd3[_0x84c2('0x41')],_0x3c3cd3[_0x84c2('0x45')]);_0x3f1f9a[_0x84c2('0x43')]=_[_0x84c2('0x58')](_0x3c3cd3[_0x84c2('0x41')],qs[_0x84c2('0x44')](_0xcfa0de['query'][_0x84c2('0x44')]));_0x3f1f9a['attributes']=_0x3f1f9a[_0x84c2('0x43')][_0x84c2('0x46')]?_0x3f1f9a[_0x84c2('0x43')]:_0x3c3cd3[_0x84c2('0x41')];if(_0xcfa0de[_0x84c2('0x45')][_0x84c2('0x51')]){_0x3f1f9a['include']=[{'all':!![]}];}_0x3f1f9a=_[_0x84c2('0x4d')]({},_0x3f1f9a,_0xcfa0de[_0x84c2('0x4f')]);return db[_0x84c2('0x50')][_0x84c2('0x59')](_0x3f1f9a)['then'](handleEntityNotFound(_0x4c4a71,null))[_0x84c2('0x22')](respondWithResult(_0x4c4a71,null))[_0x84c2('0x2d')](handleError(_0x4c4a71,null));};exports[_0x84c2('0x38')]=function(_0x136fd9,_0x40d6fc){if(_0x136fd9[_0x84c2('0x5a')]['id']){delete _0x136fd9['body']['id'];}return db['FaxMessage'][_0x84c2('0x59')]({'where':{'id':_0x136fd9['params']['id']}})[_0x84c2('0x22')](handleEntityNotFound(_0x40d6fc,null))[_0x84c2('0x22')](saveUpdates(_0x136fd9[_0x84c2('0x5a')],null))[_0x84c2('0x22')](respondWithResult(_0x40d6fc,null))[_0x84c2('0x2d')](handleError(_0x40d6fc,null));};exports[_0x84c2('0x39')]=function(_0x4b98aa,_0x4b15e0){return db[_0x84c2('0x50')][_0x84c2('0x59')]({'where':{'id':_0x4b98aa[_0x84c2('0x56')]['id']}})[_0x84c2('0x22')](handleEntityNotFound(_0x4b15e0,null))[_0x84c2('0x22')](removeEntity(_0x4b15e0,null))[_0x84c2('0x2d')](handleError(_0x4b15e0,null));};exports[_0x84c2('0x5b')]=function(_0x4d9a94,_0x45a6f7){return db['FaxMessage'][_0x84c2('0x5b')]()[_0x84c2('0x22')](respondWithResult(_0x45a6f7,null))['catch'](handleError(_0x45a6f7,null));};var interaction_log=require('../../config/logger')(_0x84c2('0x5c'));exports[_0x84c2('0x5d')]=function(_0x24bf6c,_0x4a0c79,_0xd5d003){var _0x515336={'agent':{},'channel':_0x84c2('0x5e')};if(_0x24bf6c[_0x84c2('0x5a')]['id']){delete _0x24bf6c['body']['id'];}_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x5f')]=!![];_0x24bf6c['body']['readAt']=moment()[_0x84c2('0x60')](_0x84c2('0x61'));_0x24bf6c[_0x84c2('0x5a')]['UserId']=_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x62')]||_0x24bf6c[_0x84c2('0x63')]['id'];_0x515336[_0x84c2('0x64')]['id']=_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x62')];return db[_0x84c2('0x50')][_0x84c2('0x59')]({'where':{'id':_0x24bf6c[_0x84c2('0x56')]['id'],'UserId':null}})[_0x84c2('0x22')](handleEntityNotFound(_0x4a0c79,null))[_0x84c2('0x22')](saveUpdates(_0x24bf6c[_0x84c2('0x5a')],null))['then'](function(_0x262110){if(_0x262110){_0x515336[_0x84c2('0x2b')]=_0x262110[_0x84c2('0x65')]({'plain':!![]});return db[_0x84c2('0x66')][_0x84c2('0x59')]({'where':{'id':_0x262110[_0x84c2('0x67')]}});}return null;})[_0x84c2('0x22')](handleEntityNotFound(_0x4a0c79,null))[_0x84c2('0x22')](function(_0x2dc663){if(_0x2dc663){return _0x2dc663[_0x84c2('0x38')]({'UserId':_0x24bf6c[_0x84c2('0x5a')]['UserId'],'read1stAt':_[_0x84c2('0x68')](_0x2dc663[_0x84c2('0x69')])?moment()[_0x84c2('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x84c2('0x22')](function(_0x546db3){if(_0x546db3){_0x515336['interaction']=_0x546db3[_0x84c2('0x65')]({'plain':!![]});interaction_log[_0x84c2('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24bf6c['user']['id'],_0x24bf6c[_0x84c2('0x63')][_0x84c2('0x3a')],_0x24bf6c[_0x84c2('0x63')][_0x84c2('0x6a')],_0x515336[_0x84c2('0x6b')]['id'],_0x24bf6c[_0x84c2('0x5a')]?JSON[_0x84c2('0x28')](_0x24bf6c['body']):_0x84c2('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x84c2('0x6d'),_0x515336);}return null;})[_0x84c2('0x22')](function(_0x1f89bc){var _0x52507d=_0x84c2('0x6e')+_0x1f89bc[_0x84c2('0x2b')][_0x84c2('0x6f')];return db[_0x84c2('0x70')]['query'](_0x52507d,{'type':db[_0x84c2('0x71')][_0x84c2('0x72')][_0x84c2('0x73')],'raw':!![]})['then'](function(_0x5dacde){return _0x5dacde;});})[_0x84c2('0x22')](function(_0x3248be){if(_0x3248be){_0x515336['message'][_0x84c2('0x74')]=_0x3248be[0x0];if(!_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x62')])return;return db[_0x84c2('0x75')][_0x84c2('0x59')]({'where':{'id':_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x62')],'role':_0x84c2('0x64')},'attributes':['id',_0x84c2('0x3a'),_0x84c2('0x76'),_0x84c2('0x77'),_0x84c2('0x78')],'raw':!![]});}return null;})[_0x84c2('0x22')](function(_0x51c493){if(!_0x51c493)return null;_0x515336[_0x84c2('0x2b')][_0x84c2('0x64')]=_0x51c493;return _0x515336;})[_0x84c2('0x22')](function(_0x572801){if(_0x572801){if(_0x24bf6c[_0x84c2('0x5a')][_0x84c2('0x79')]){_0x515336[_0x84c2('0x2b')][_0x84c2('0x7a')]=util[_0x84c2('0x60')](_0x84c2('0x7b'),_0x24bf6c[_0x84c2('0x63')][_0x84c2('0x3a')]);_0x515336[_0x84c2('0x2b')][_0x84c2('0x7c')]=_0x515336[_0x84c2('0x7c')];_0x515336[_0x84c2('0x2b')]['motionChannel']=_0x515336['channel'];_0x515336[_0x84c2('0x2b')][_0x84c2('0x7d')]=_0x84c2('0x5d');return respondWithRpcPromise('EventManager',_0x84c2('0x7e'),{'event':_0x84c2('0x7f'),'message':_0x515336[_0x84c2('0x2b')]},client9002)[_0x84c2('0x22')](function(){return _0x515336;});}return _0x515336;}return null;})[_0x84c2('0x22')](respondWithResult(_0x4a0c79,null))[_0x84c2('0x2d')](handleError(_0x4a0c79,null));};var interaction_log=require('../../config/logger')(_0x84c2('0x5c'));exports[_0x84c2('0x36')]=function(_0x638880,_0x3a7009,_0x3c2009){var _0x32ed7a={'agent':{},'channel':_0x84c2('0x5e')};if(_0x638880[_0x84c2('0x5a')]['id']){delete _0x638880[_0x84c2('0x5a')]['id'];}_0x638880[_0x84c2('0x5a')][_0x84c2('0x62')]=_0x638880[_0x84c2('0x5a')][_0x84c2('0x62')]||_0x638880['user']['id'];_0x32ed7a['agent']['id']=_0x638880[_0x84c2('0x5a')][_0x84c2('0x62')];return db[_0x84c2('0x50')][_0x84c2('0x59')]({'where':{'id':_0x638880['params']['id'],'UserId':null}})[_0x84c2('0x22')](handleEntityNotFound(_0x3a7009,null))['then'](function(_0x365c9d){if(_0x365c9d){_0x32ed7a['message']=_0x365c9d['get']({'plain':!![]});return db[_0x84c2('0x66')]['find']({'where':{'id':_0x365c9d['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3a7009,null))['then'](function(_0x24eec6){if(_0x24eec6){_0x32ed7a[_0x84c2('0x6b')]=_0x24eec6[_0x84c2('0x65')]({'plain':!![]});interaction_log['info'](_0x84c2('0x80'),_0x638880[_0x84c2('0x63')]['id'],_0x638880[_0x84c2('0x63')][_0x84c2('0x3a')],_0x638880['user'][_0x84c2('0x6a')],_0x32ed7a[_0x84c2('0x6b')]['id'],_0x638880['body']?JSON['stringify'](_0x638880[_0x84c2('0x5a')]):_0x84c2('0x6c'));return respondWithRpcPromise('RejectMessage',_0x84c2('0x81'),_0x32ed7a);}return null;})[_0x84c2('0x22')](function(_0x300155){var _0x397c7d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x300155[_0x84c2('0x2b')][_0x84c2('0x6f')];return db[_0x84c2('0x70')][_0x84c2('0x45')](_0x397c7d,{'type':db[_0x84c2('0x71')][_0x84c2('0x72')][_0x84c2('0x73')],'raw':!![]})[_0x84c2('0x22')](function(_0x16f55b){return _0x16f55b;});})[_0x84c2('0x22')](function(_0x36e8e7){if(_0x36e8e7){_0x32ed7a['message'][_0x84c2('0x74')]=_0x36e8e7[0x0];if(!_0x638880[_0x84c2('0x5a')][_0x84c2('0x62')])return;return db[_0x84c2('0x75')][_0x84c2('0x59')]({'where':{'id':_0x638880['body'][_0x84c2('0x62')],'role':_0x84c2('0x64')},'attributes':['id',_0x84c2('0x3a'),_0x84c2('0x76'),_0x84c2('0x77'),'internal'],'raw':!![]});}return null;})[_0x84c2('0x22')](function(_0x1f4780){if(!_0x1f4780)return null;_0x32ed7a[_0x84c2('0x2b')][_0x84c2('0x64')]=_0x1f4780;return _0x32ed7a;})['then'](function(_0x5d842a){if(_0x5d842a){_0x5d842a[_0x84c2('0x2b')]['interface']=util[_0x84c2('0x60')](_0x84c2('0x7b'),_0x638880[_0x84c2('0x63')][_0x84c2('0x3a')]);_0x5d842a[_0x84c2('0x2b')][_0x84c2('0x7c')]=_0x32ed7a['channel'];_0x5d842a[_0x84c2('0x2b')][_0x84c2('0x82')]=_0x32ed7a[_0x84c2('0x7c')];_0x5d842a['message']['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x5d842a[_0x84c2('0x2b')]},client9002);return _0x32ed7a;}return null;})['then'](respondWithResult(_0x3a7009,null))[_0x84c2('0x2d')](handleError(_0x3a7009,null));};exports[_0x84c2('0x83')]=function(_0x5d4fdd,_0x2e18bf){var _0x4f79ae;return db[_0x84c2('0x50')][_0x84c2('0x83')](_0x5d4fdd[_0x84c2('0x5a')],{})[_0x84c2('0x22')](function(_0xc3e41d){_0x4f79ae=_0xc3e41d;return db[_0x84c2('0x84')][_0x84c2('0x85')]({'where':{'id':_0x4f79ae[_0x84c2('0x6f')]}});})[_0x84c2('0x22')](function(_0x38bf26){if(_['isNil'](_0x38bf26)){return;}else{_0x4f79ae[_0x84c2('0x5e')]=_0x38bf26[_0x84c2('0x5e')];return db[_0x84c2('0x86')][_0x84c2('0x85')]({'where':{'id':_0x4f79ae[_0x84c2('0x87')]}});}})[_0x84c2('0x22')](function(_0xe7292e){return respondWithRpcPromise(_0x84c2('0x88'),_0x84c2('0x88'),{'FaxAccountId':_[_0x84c2('0x68')](_0x5d4fdd[_0x84c2('0x5a')])?undefined:_0x5d4fdd[_0x84c2('0x5a')][_0x84c2('0x89')],'path':_[_0x84c2('0x68')](_0xe7292e)?undefined:util[_0x84c2('0x60')](_0x84c2('0x8a'),_0xe7292e[_0x84c2('0x8b')]),'fax':_[_0x84c2('0x68')](_0x4f79ae['fax'])?undefined:_0x4f79ae[_0x84c2('0x5e')],'AttachmentId':_0x4f79ae[_0x84c2('0x87')]},client9002);})[_0x84c2('0x22')](respondWithResult(_0x2e18bf,0xc9))[_0x84c2('0x2d')](handleError(_0x2e18bf,null));};exports[_0x84c2('0x8c')]=function(_0x263ac8,_0x14c8d1){var _0x1413a3=path[_0x84c2('0x8d')](config[_0x84c2('0x8e')],_0x84c2('0x8f'),_0x84c2('0x90'),_0x84c2('0x91'));return db['FaxMessage'][_0x84c2('0x59')]({'where':{'id':_0x263ac8[_0x84c2('0x56')]['id']},'include':[{'model':db[_0x84c2('0x86')],'as':_0x84c2('0x86')}]})['then'](handleEntityNotFound(_0x14c8d1,null))['then'](function(_0x24810e){if(_0x24810e){return _0x14c8d1[_0x84c2('0x8c')](path[_0x84c2('0x8d')](_0x1413a3,_0x24810e['Attachment']['basename']));}})[_0x84c2('0x2d')](handleError(_0x14c8d1,null));}; \ No newline at end of file +var _0x1a3f=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','send','index','map','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxMessage','includeAll','rows','include','find','body','params','fax-interactions','accept','fax','read','format','UserId','user','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteraction','null','RejectMessage','rejectMessage','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','basename','download','join','root','server','files','attachments','Attachment','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','http','client','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x1a3f,0x68));var _0xf1a3=function(_0x1459a5,_0x12c452){_0x1459a5=_0x1459a5-0x0;var _0x1ddaaa=_0x1a3f[_0x1459a5];return _0x1ddaaa;};'use strict';var emlformat=require(_0xf1a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1a3('0x1'));var jsonpatch=require(_0xf1a3('0x2'));var rp=require(_0xf1a3('0x3'));var moment=require(_0xf1a3('0x4'));var BPromise=require(_0xf1a3('0x5'));var Mustache=require(_0xf1a3('0x6'));var util=require(_0xf1a3('0x7'));var path=require(_0xf1a3('0x8'));var sox=require('sox');var csv=require(_0xf1a3('0x9'));var ejs=require(_0xf1a3('0xa'));var fs=require('fs');var fs_extra=require(_0xf1a3('0xb'));var _=require('lodash');var squel=require(_0xf1a3('0xc'));var crypto=require('crypto');var jsforce=require(_0xf1a3('0xd'));var deskjs=require(_0xf1a3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf1a3('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf1a3('0x10'));var qs=require(_0xf1a3('0x11'));var as=require(_0xf1a3('0x12'));var hardwareService=require(_0xf1a3('0x13'));var logger=require(_0xf1a3('0x14'))(_0xf1a3('0x15'));var utils=require(_0xf1a3('0x16'));var config=require(_0xf1a3('0x17'));var licenseUtil=require(_0xf1a3('0x18'));var db=require(_0xf1a3('0x19'))['db'];config[_0xf1a3('0x1a')]=_[_0xf1a3('0x1b')](config[_0xf1a3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1a3('0x1c'))(new Redis(config[_0xf1a3('0x1a')]));require(_0xf1a3('0x1d'))[_0xf1a3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf1a3('0x1f')]({'port':0x232c});var client9002=jayson[_0xf1a3('0x20')][_0xf1a3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2632b3,_0x2c299f,_0x339208,_0x579e5e){return new BPromise(function(_0x26fe06,_0x3afe52){var _0x2db8af=_0x579e5e||client;return _0x2db8af[_0xf1a3('0x21')](_0x2632b3,_0x339208)['then'](function(_0x5a46b9){logger[_0xf1a3('0x22')](_0xf1a3('0x23'),_0x2c299f,_0xf1a3('0x24'));logger[_0xf1a3('0x25')](_0xf1a3('0x26'),_0x2c299f,_0xf1a3('0x24'),JSON[_0xf1a3('0x27')](_0x5a46b9));if(_0x5a46b9['error']){if(_0x5a46b9[_0xf1a3('0x28')]['code']===0x1f4){logger[_0xf1a3('0x28')]('FaxMessage,\x20%s,\x20%s',_0x2c299f,_0x5a46b9['error'][_0xf1a3('0x29')]);return _0x3afe52(_0x5a46b9['error']['message']);}logger[_0xf1a3('0x28')](_0xf1a3('0x23'),_0x2c299f,_0x5a46b9[_0xf1a3('0x28')][_0xf1a3('0x29')]);return _0x26fe06(_0x5a46b9[_0xf1a3('0x28')][_0xf1a3('0x29')]);}else{logger[_0xf1a3('0x22')](_0xf1a3('0x23'),_0x2c299f,_0xf1a3('0x24'));_0x26fe06(_0x5a46b9[_0xf1a3('0x2a')][_0xf1a3('0x29')]);}})[_0xf1a3('0x2b')](function(_0x5746fb){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2c299f,_0x5746fb);_0x3afe52(_0x5746fb);});});}function respondWithStatusCode(_0x465015,_0x48e1bc){_0x48e1bc=_0x48e1bc||0xcc;return function(_0x2c2999){if(_0x2c2999){return _0x465015[_0xf1a3('0x2c')](_0x48e1bc);}return _0x465015[_0xf1a3('0x2d')](_0x48e1bc)['end']();};}function respondWithResult(_0x39b00e,_0x27db92){_0x27db92=_0x27db92||0xc8;return function(_0x5979bd){if(_0x5979bd){return _0x39b00e['status'](_0x27db92)[_0xf1a3('0x2e')](_0x5979bd);}};}function respondWithFilteredResult(_0x315460,_0x3fd2cc){return function(_0x4d8b29){if(_0x4d8b29){var _0x225e24=typeof _0x3fd2cc[_0xf1a3('0x2f')]===_0xf1a3('0x30')&&typeof _0x3fd2cc[_0xf1a3('0x31')]===_0xf1a3('0x30');var _0x517283=_0x4d8b29[_0xf1a3('0x32')];var _0x2a79e3=_0x225e24?0x0:_0x3fd2cc[_0xf1a3('0x2f')];var _0x263990=_0x225e24?_0x4d8b29[_0xf1a3('0x32')]:_0x3fd2cc[_0xf1a3('0x2f')]+_0x3fd2cc['limit'];var _0x37ee7c;if(_0x263990>=_0x517283){_0x263990=_0x517283;_0x37ee7c=0xc8;}else{_0x37ee7c=0xce;}_0x315460[_0xf1a3('0x2d')](_0x37ee7c);return _0x315460[_0xf1a3('0x33')](_0xf1a3('0x34'),_0x2a79e3+'-'+_0x263990+'/'+_0x517283)['json'](_0x4d8b29);}return null;};}function patchUpdates(_0xdca904){return function(_0x288a28){try{jsonpatch['apply'](_0x288a28,_0xdca904,!![]);}catch(_0x27d043){return BPromise[_0xf1a3('0x35')](_0x27d043);}return _0x288a28[_0xf1a3('0x36')]();};}function saveUpdates(_0x23886a,_0x37ae5c){return function(_0x35a9a3){if(_0x35a9a3){return _0x35a9a3[_0xf1a3('0x37')](_0x23886a)[_0xf1a3('0x38')](function(_0x1287ca){return _0x1287ca;});}return null;};}function removeEntity(_0x456196,_0x496f4b){return function(_0x3ecf08){if(_0x3ecf08){return _0x3ecf08[_0xf1a3('0x39')]()[_0xf1a3('0x38')](function(){_0x456196[_0xf1a3('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x526c1c,_0x39b470){return function(_0x3b95e9){if(!_0x3b95e9){_0x526c1c['sendStatus'](0x194);}return _0x3b95e9;};}function handleError(_0x1cff8b,_0x15a599){_0x15a599=_0x15a599||0x1f4;return function(_0x2892ac){logger[_0xf1a3('0x28')](_0x2892ac[_0xf1a3('0x3a')]);if(_0x2892ac['name']){delete _0x2892ac['name'];}_0x1cff8b[_0xf1a3('0x2d')](_0x15a599)[_0xf1a3('0x3b')](_0x2892ac);};}exports[_0xf1a3('0x3c')]=function(_0x5647e2,_0x4a54fb){var _0x20acf1={},_0x543686={},_0x464fa9={'count':0x0,'rows':[]};var _0x5d9309=_[_0xf1a3('0x3d')](db['FaxMessage'][_0xf1a3('0x3e')],function(_0x4c860a){return{'name':_0x4c860a['fieldName'],'type':_0x4c860a[_0xf1a3('0x3f')][_0xf1a3('0x40')]};});_0x543686[_0xf1a3('0x41')]=_[_0xf1a3('0x3d')](_0x5d9309,_0xf1a3('0x42'));_0x543686['query']=_[_0xf1a3('0x43')](_0x5647e2[_0xf1a3('0x44')]);_0x543686[_0xf1a3('0x45')]=_['intersection'](_0x543686[_0xf1a3('0x41')],_0x543686[_0xf1a3('0x44')]);_0x20acf1['attributes']=_[_0xf1a3('0x46')](_0x543686[_0xf1a3('0x41')],qs[_0xf1a3('0x47')](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x47')]));_0x20acf1['attributes']=_0x20acf1[_0xf1a3('0x48')][_0xf1a3('0x49')]?_0x20acf1[_0xf1a3('0x48')]:_0x543686[_0xf1a3('0x41')];if(!_0x5647e2['query']['hasOwnProperty'](_0xf1a3('0x4a'))){_0x20acf1[_0xf1a3('0x31')]=qs['limit'](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x31')]);_0x20acf1[_0xf1a3('0x2f')]=qs['offset'](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x2f')]);}_0x20acf1[_0xf1a3('0x4b')]=qs[_0xf1a3('0x4c')](_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4c')]);_0x20acf1[_0xf1a3('0x4d')]=qs[_0xf1a3('0x45')](_[_0xf1a3('0x4e')](_0x5647e2['query'],_0x543686[_0xf1a3('0x45')]),_0x5d9309);if(_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4f')]){_0x20acf1['where']=_[_0xf1a3('0x50')](_0x20acf1[_0xf1a3('0x4d')],{'$or':_[_0xf1a3('0x3d')](_0x5d9309,function(_0x195b16){if(_0x195b16['type']!==_0xf1a3('0x51')){var _0x3e6949={};_0x3e6949[_0x195b16[_0xf1a3('0x42')]]={'$like':'%'+_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x4f')]+'%'};return _0x3e6949;}})});}_0x20acf1=_[_0xf1a3('0x50')]({},_0x20acf1,_0x5647e2[_0xf1a3('0x52')]);var _0x3ce3bc={'where':_0x20acf1[_0xf1a3('0x4d')]};return db[_0xf1a3('0x53')][_0xf1a3('0x32')](_0x3ce3bc)[_0xf1a3('0x38')](function(_0x1d25ab){_0x464fa9[_0xf1a3('0x32')]=_0x1d25ab;if(_0x5647e2[_0xf1a3('0x44')][_0xf1a3('0x54')]){_0x20acf1['include']=[{'all':!![]}];}return db[_0xf1a3('0x53')]['findAll'](_0x20acf1);})[_0xf1a3('0x38')](function(_0x41f4b1){_0x464fa9[_0xf1a3('0x55')]=_0x41f4b1;return _0x464fa9;})[_0xf1a3('0x38')](respondWithFilteredResult(_0x4a54fb,_0x20acf1))[_0xf1a3('0x2b')](handleError(_0x4a54fb,null));};exports['show']=function(_0x205728,_0x302b64){var _0x489a6d={'raw':!![],'where':{'id':_0x205728['params']['id']}},_0x476ba0={};_0x476ba0[_0xf1a3('0x41')]=_['keys'](db[_0xf1a3('0x53')][_0xf1a3('0x3e')]);_0x476ba0[_0xf1a3('0x44')]=_['keys'](_0x205728['query']);_0x476ba0[_0xf1a3('0x45')]=_[_0xf1a3('0x46')](_0x476ba0['model'],_0x476ba0[_0xf1a3('0x44')]);_0x489a6d[_0xf1a3('0x48')]=_[_0xf1a3('0x46')](_0x476ba0[_0xf1a3('0x41')],qs[_0xf1a3('0x47')](_0x205728[_0xf1a3('0x44')][_0xf1a3('0x47')]));_0x489a6d['attributes']=_0x489a6d[_0xf1a3('0x48')][_0xf1a3('0x49')]?_0x489a6d[_0xf1a3('0x48')]:_0x476ba0['model'];if(_0x205728[_0xf1a3('0x44')]['includeAll']){_0x489a6d[_0xf1a3('0x56')]=[{'all':!![]}];}_0x489a6d=_[_0xf1a3('0x50')]({},_0x489a6d,_0x205728[_0xf1a3('0x52')]);return db[_0xf1a3('0x53')][_0xf1a3('0x57')](_0x489a6d)['then'](handleEntityNotFound(_0x302b64,null))[_0xf1a3('0x38')](respondWithResult(_0x302b64,null))['catch'](handleError(_0x302b64,null));};exports[_0xf1a3('0x37')]=function(_0x3a1e10,_0x4aeaed){if(_0x3a1e10[_0xf1a3('0x58')]['id']){delete _0x3a1e10[_0xf1a3('0x58')]['id'];}return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x3a1e10[_0xf1a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x4aeaed,null))[_0xf1a3('0x38')](saveUpdates(_0x3a1e10[_0xf1a3('0x58')],null))[_0xf1a3('0x38')](respondWithResult(_0x4aeaed,null))['catch'](handleError(_0x4aeaed,null));};exports[_0xf1a3('0x39')]=function(_0x536e7d,_0x4e5e5a){return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x536e7d[_0xf1a3('0x59')]['id']}})[_0xf1a3('0x38')](handleEntityNotFound(_0x4e5e5a,null))['then'](removeEntity(_0x4e5e5a,null))[_0xf1a3('0x2b')](handleError(_0x4e5e5a,null));};exports['describe']=function(_0x5dbb31,_0x41b3d2){return db[_0xf1a3('0x53')]['describe']()[_0xf1a3('0x38')](respondWithResult(_0x41b3d2,null))[_0xf1a3('0x2b')](handleError(_0x41b3d2,null));};var interaction_log=require(_0xf1a3('0x14'))(_0xf1a3('0x5a'));exports[_0xf1a3('0x5b')]=function(_0x56ceb3,_0x519236,_0x4ac5fd){var _0x2cfc5e={'agent':{},'channel':_0xf1a3('0x5c')};if(_0x56ceb3[_0xf1a3('0x58')]['id']){delete _0x56ceb3[_0xf1a3('0x58')]['id'];}_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5d')]=!![];_0x56ceb3['body']['readAt']=moment()[_0xf1a3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x56ceb3['body'][_0xf1a3('0x5f')]=_0x56ceb3['body'][_0xf1a3('0x5f')]||_0x56ceb3[_0xf1a3('0x60')]['id'];_0x2cfc5e['agent']['id']=_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5f')];return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0x56ceb3[_0xf1a3('0x59')]['id'],'UserId':null}})[_0xf1a3('0x38')](handleEntityNotFound(_0x519236,null))['then'](saveUpdates(_0x56ceb3['body'],null))['then'](function(_0x1b4b37){if(_0x1b4b37){_0x2cfc5e[_0xf1a3('0x29')]=_0x1b4b37[_0xf1a3('0x61')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1b4b37[_0xf1a3('0x62')]}});}return null;})[_0xf1a3('0x38')](handleEntityNotFound(_0x519236,null))[_0xf1a3('0x38')](function(_0x50f219){if(_0x50f219){return _0x50f219[_0xf1a3('0x37')]({'UserId':_0x56ceb3[_0xf1a3('0x58')]['UserId'],'read1stAt':_[_0xf1a3('0x63')](_0x50f219[_0xf1a3('0x64')])?moment()[_0xf1a3('0x5e')](_0xf1a3('0x65')):undefined});}return null;})['then'](function(_0x672e1f){if(_0x672e1f){_0x2cfc5e[_0xf1a3('0x66')]=_0x672e1f[_0xf1a3('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56ceb3[_0xf1a3('0x60')]['id'],_0x56ceb3[_0xf1a3('0x60')]['name'],_0x56ceb3[_0xf1a3('0x60')][_0xf1a3('0x67')],_0x2cfc5e[_0xf1a3('0x66')]['id'],_0x56ceb3['body']?JSON[_0xf1a3('0x27')](_0x56ceb3[_0xf1a3('0x58')]):'null');return respondWithRpcPromise(_0xf1a3('0x68'),_0xf1a3('0x69'),_0x2cfc5e);}return null;})['then'](function(_0x40d1a4){var _0x5b494e=_0xf1a3('0x6a')+_0x40d1a4['message'][_0xf1a3('0x6b')];return db[_0xf1a3('0x6c')][_0xf1a3('0x44')](_0x5b494e,{'type':db[_0xf1a3('0x6d')][_0xf1a3('0x6e')][_0xf1a3('0x6f')],'raw':!![]})[_0xf1a3('0x38')](function(_0x35b1d4){return _0x35b1d4;});})[_0xf1a3('0x38')](function(_0x256fb0){if(_0x256fb0){_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x70')]=_0x256fb0[0x0];if(!_0x56ceb3['body'][_0xf1a3('0x5f')])return;return db[_0xf1a3('0x71')]['find']({'where':{'id':_0x56ceb3[_0xf1a3('0x58')][_0xf1a3('0x5f')],'role':_0xf1a3('0x72')},'attributes':['id',_0xf1a3('0x42'),_0xf1a3('0x73'),_0xf1a3('0x74'),_0xf1a3('0x75')],'raw':!![]});}return null;})[_0xf1a3('0x38')](function(_0x27945a){if(!_0x27945a)return null;_0x2cfc5e['message'][_0xf1a3('0x72')]=_0x27945a;return _0x2cfc5e;})[_0xf1a3('0x38')](function(_0x1a2278){if(_0x1a2278){if(_0x56ceb3[_0xf1a3('0x58')]['manual']){_0x2cfc5e[_0xf1a3('0x29')]['interface']=util[_0xf1a3('0x5e')](_0xf1a3('0x76'),_0x56ceb3[_0xf1a3('0x60')]['name']);_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x77')]=_0x2cfc5e[_0xf1a3('0x77')];_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x78')]=_0x2cfc5e['channel'];_0x2cfc5e[_0xf1a3('0x29')][_0xf1a3('0x79')]='accept';return respondWithRpcPromise(_0xf1a3('0x7a'),_0xf1a3('0x7a'),{'event':_0xf1a3('0x7b'),'message':_0x2cfc5e[_0xf1a3('0x29')]},client9002)[_0xf1a3('0x38')](function(){return _0x2cfc5e;});}return _0x2cfc5e;}return null;})[_0xf1a3('0x38')](respondWithResult(_0x519236,null))[_0xf1a3('0x2b')](handleError(_0x519236,null));};var interaction_log=require('../../config/logger')(_0xf1a3('0x5a'));exports['reject']=function(_0xf33b5c,_0x52da53,_0x3161d1){var _0x3a2f40={'agent':{},'channel':_0xf1a3('0x5c')};if(_0xf33b5c['body']['id']){delete _0xf33b5c[_0xf1a3('0x58')]['id'];}_0xf33b5c['body'][_0xf1a3('0x5f')]=_0xf33b5c[_0xf1a3('0x58')][_0xf1a3('0x5f')]||_0xf33b5c[_0xf1a3('0x60')]['id'];_0x3a2f40['agent']['id']=_0xf33b5c[_0xf1a3('0x58')][_0xf1a3('0x5f')];return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0xf33b5c[_0xf1a3('0x59')]['id'],'UserId':null}})[_0xf1a3('0x38')](handleEntityNotFound(_0x52da53,null))['then'](function(_0x53e843){if(_0x53e843){_0x3a2f40['message']=_0x53e843[_0xf1a3('0x61')]({'plain':!![]});return db[_0xf1a3('0x7c')][_0xf1a3('0x57')]({'where':{'id':_0x53e843[_0xf1a3('0x62')]}});}return null;})[_0xf1a3('0x38')](handleEntityNotFound(_0x52da53,null))[_0xf1a3('0x38')](function(_0x3686f3){if(_0x3686f3){_0x3a2f40[_0xf1a3('0x66')]=_0x3686f3[_0xf1a3('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf33b5c[_0xf1a3('0x60')]['id'],_0xf33b5c['user'][_0xf1a3('0x42')],_0xf33b5c[_0xf1a3('0x60')]['role'],_0x3a2f40[_0xf1a3('0x66')]['id'],_0xf33b5c['body']?JSON[_0xf1a3('0x27')](_0xf33b5c[_0xf1a3('0x58')]):_0xf1a3('0x7d'));return respondWithRpcPromise(_0xf1a3('0x7e'),_0xf1a3('0x7f'),_0x3a2f40);}return null;})[_0xf1a3('0x38')](function(_0x129dad){var _0x2022d5=_0xf1a3('0x6a')+_0x129dad['message'][_0xf1a3('0x6b')];return db[_0xf1a3('0x6c')]['query'](_0x2022d5,{'type':db[_0xf1a3('0x6d')][_0xf1a3('0x6e')][_0xf1a3('0x6f')],'raw':!![]})[_0xf1a3('0x38')](function(_0xef273f){return _0xef273f;});})[_0xf1a3('0x38')](function(_0x53597f){if(_0x53597f){_0x3a2f40[_0xf1a3('0x29')]['contact']=_0x53597f[0x0];if(!_0xf33b5c[_0xf1a3('0x58')]['UserId'])return;return db[_0xf1a3('0x71')][_0xf1a3('0x57')]({'where':{'id':_0xf33b5c['body'][_0xf1a3('0x5f')],'role':_0xf1a3('0x72')},'attributes':['id','name',_0xf1a3('0x73'),'email',_0xf1a3('0x75')],'raw':!![]});}return null;})['then'](function(_0x11b6f4){if(!_0x11b6f4)return null;_0x3a2f40[_0xf1a3('0x29')][_0xf1a3('0x72')]=_0x11b6f4;return _0x3a2f40;})[_0xf1a3('0x38')](function(_0x22b9eb){if(_0x22b9eb){_0x22b9eb[_0xf1a3('0x29')]['interface']=util[_0xf1a3('0x5e')](_0xf1a3('0x76'),_0xf33b5c[_0xf1a3('0x60')]['name']);_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x77')]=_0x3a2f40[_0xf1a3('0x77')];_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x78')]=_0x3a2f40[_0xf1a3('0x77')];_0x22b9eb[_0xf1a3('0x29')][_0xf1a3('0x79')]=_0xf1a3('0x35');respondWithRpcPromise(_0xf1a3('0x7a'),_0xf1a3('0x7a'),{'event':_0xf1a3('0x80'),'message':_0x22b9eb['message']},client9002);return _0x3a2f40;}return null;})[_0xf1a3('0x38')](respondWithResult(_0x52da53,null))[_0xf1a3('0x2b')](handleError(_0x52da53,null));};exports[_0xf1a3('0x81')]=function(_0x37f6b4,_0x39ef92){var _0x2b6cfa;return db[_0xf1a3('0x53')][_0xf1a3('0x81')](_0x37f6b4[_0xf1a3('0x58')],{})[_0xf1a3('0x38')](function(_0x41ecad){_0x2b6cfa=_0x41ecad;return db[_0xf1a3('0x82')]['findOne']({'where':{'id':_0x2b6cfa['ContactId']}});})[_0xf1a3('0x38')](function(_0x1f4cff){if(_[_0xf1a3('0x63')](_0x1f4cff)){return;}else{_0x2b6cfa[_0xf1a3('0x5c')]=_0x1f4cff[_0xf1a3('0x5c')];return db['Attachment'][_0xf1a3('0x83')]({'where':{'id':_0x2b6cfa[_0xf1a3('0x84')]}});}})[_0xf1a3('0x38')](function(_0x179ca7){return respondWithRpcPromise(_0xf1a3('0x85'),_0xf1a3('0x85'),{'FaxAccountId':_[_0xf1a3('0x63')](_0x37f6b4[_0xf1a3('0x58')])?undefined:_0x37f6b4[_0xf1a3('0x58')]['FaxAccountId'],'path':_[_0xf1a3('0x63')](_0x179ca7)?undefined:util[_0xf1a3('0x5e')]('/var/opt/motion2/server/files/attachments/%s',_0x179ca7[_0xf1a3('0x86')]),'fax':_[_0xf1a3('0x63')](_0x2b6cfa[_0xf1a3('0x5c')])?undefined:_0x2b6cfa[_0xf1a3('0x5c')],'AttachmentId':_0x2b6cfa[_0xf1a3('0x84')]},client9002);})['then'](respondWithResult(_0x39ef92,0xc9))['catch'](handleError(_0x39ef92,null));};exports[_0xf1a3('0x87')]=function(_0xb2231a,_0x592325){var _0x34172d=path[_0xf1a3('0x88')](config[_0xf1a3('0x89')],_0xf1a3('0x8a'),_0xf1a3('0x8b'),_0xf1a3('0x8c'));return db[_0xf1a3('0x53')][_0xf1a3('0x57')]({'where':{'id':_0xb2231a[_0xf1a3('0x59')]['id']},'include':[{'model':db[_0xf1a3('0x8d')],'as':_0xf1a3('0x8d')}]})[_0xf1a3('0x38')](handleEntityNotFound(_0x592325,null))['then'](function(_0x306221){if(_0x306221){return _0x592325[_0xf1a3('0x87')](path[_0xf1a3('0x88')](_0x34172d,_0x306221['Attachment'][_0xf1a3('0x86')]));}})[_0xf1a3('0x2b')](handleError(_0x592325,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index de91e6d..1da3d07 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 _0x5fab=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x514ce1,_0x148c2f){var _0xe89e13=function(_0x46bedd){while(--_0x46bedd){_0x514ce1['push'](_0x514ce1['shift']());}};_0xe89e13(++_0x148c2f);}(_0x5fab,0x177));var _0xb5fa=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x5fab[_0x223461];return _0x4dbe0a;};'use strict';var EventEmitter=require(_0xb5fa('0x0'));var FaxMessage=require(_0xb5fa('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb5fa('0x2')](0x0);var events={'afterCreate':_0xb5fa('0x3'),'afterUpdate':_0xb5fa('0x4'),'afterDestroy':_0xb5fa('0x5')};function emitEvent(_0x67e8e8){return function(_0x595d8b,_0x29390a,_0x4341d3){FaxMessageEvents[_0xb5fa('0x6')](_0x67e8e8+':'+_0x595d8b['id'],_0x595d8b);FaxMessageEvents[_0xb5fa('0x6')](_0x67e8e8,_0x595d8b);_0x4341d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xb5fa('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x573a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1fc75f,_0x456d7c){var _0x40b5ab=function(_0x584934){while(--_0x584934){_0x1fc75f['push'](_0x1fc75f['shift']());}};_0x40b5ab(++_0x456d7c);}(_0x573a,0x124));var _0xa573=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0x573a[_0x2932cf];return _0x1711dd;};'use strict';var EventEmitter=require(_0xa573('0x0'));var FaxMessage=require(_0xa573('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa573('0x2')](0x0);var events={'afterCreate':_0xa573('0x3'),'afterUpdate':_0xa573('0x4'),'afterDestroy':_0xa573('0x5')};function emitEvent(_0x19bca6){return function(_0x59a1d5,_0x41fbd3,_0x4b7f7c){FaxMessageEvents[_0xa573('0x6')](_0x19bca6+':'+_0x59a1d5['id'],_0x59a1d5);FaxMessageEvents[_0xa573('0x6')](_0x19bca6,_0x59a1d5);_0x4b7f7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xa573('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 20e7441..80cc844 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 _0xbaad=['findOne','FaxInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','direction','toLowerCase','out','secret'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xbaad,0x18c));var _0xdbaa=function(_0x17d7a0,_0x2d0249){_0x17d7a0=_0x17d7a0-0x0;var _0x14466f=_0xbaad[_0x17d7a0];return _0x14466f;};'use strict';var _=require(_0xdbaa('0x0'));var util=require(_0xdbaa('0x1'));var logger=require('../../config/logger')(_0xdbaa('0x2'));var moment=require(_0xdbaa('0x3'));var BPromise=require(_0xdbaa('0x4'));var rp=require(_0xdbaa('0x5'));var fs=require('fs');var path=require(_0xdbaa('0x6'));var rimraf=require(_0xdbaa('0x7'));var config=require(_0xdbaa('0x8'));var attributes=require(_0xdbaa('0x9'));module[_0xdbaa('0xa')]=function(_0x3cbe83,_0x1ea8fe){return _0x3cbe83['define'](_0xdbaa('0xb'),attributes,{'tableName':_0xdbaa('0xc'),'paranoid':![],'indexes':[{'name':_0xdbaa('0xd'),'fields':['body'],'type':_0xdbaa('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c6b62,_0x3ab087,_0x571460){var _0x5ec874=_0x3cbe83[_0xdbaa('0xf')];var _0x470e5c=_0x2c6b62['get']({'plain':!![]});if(_0x470e5c[_0xdbaa('0x10')][_0xdbaa('0x11')]()==='in'||_0x470e5c['direction'][_0xdbaa('0x11')]()===_0xdbaa('0x12')&&!_0x470e5c[_0xdbaa('0x13')]&&!_['isNil'](_0x470e5c['UserId'])){_0x5ec874['FaxInteraction'][_0xdbaa('0x14')]({'where':{'id':_0x470e5c[_0xdbaa('0x15')]}})['then'](function(_0x4dae4c){if(_0x4dae4c){_0x4dae4c[_0xdbaa('0x16')]({'lastMsgAt':_0x470e5c['createdAt'],'lastMsgDirection':_0x470e5c['direction'][_0xdbaa('0x11')]()});}})[_0xdbaa('0x17')](function(_0x2f75e3){console['error'](_0x2f75e3);});}_0x571460();}},'charset':_0xdbaa('0x18'),'collate':_0xdbaa('0x19')});}; \ No newline at end of file +var _0x0260=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId'];(function(_0x3cdfdb,_0x40545d){var _0x57d4d8=function(_0x3e7f86){while(--_0x3e7f86){_0x3cdfdb['push'](_0x3cdfdb['shift']());}};_0x57d4d8(++_0x40545d);}(_0x0260,0x7f));var _0x0026=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x0260[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x0026('0x0'));var util=require(_0x0026('0x1'));var logger=require(_0x0026('0x2'))(_0x0026('0x3'));var moment=require('moment');var BPromise=require(_0x0026('0x4'));var rp=require(_0x0026('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0026('0x6'));var config=require('../../config/environment');var attributes=require(_0x0026('0x7'));module['exports']=function(_0x365338,_0x141e20){return _0x365338[_0x0026('0x8')](_0x0026('0x9'),attributes,{'tableName':_0x0026('0xa'),'paranoid':![],'indexes':[{'name':_0x0026('0xb'),'fields':[_0x0026('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa26fae,_0x51f6cc,_0x321ac6){var _0x149e97=_0x365338[_0x0026('0xd')];var _0x2588f8=_0xa26fae[_0x0026('0xe')]({'plain':!![]});if(_0x2588f8['direction'][_0x0026('0xf')]()==='in'||_0x2588f8[_0x0026('0x10')][_0x0026('0xf')]()===_0x0026('0x11')&&!_0x2588f8[_0x0026('0x12')]&&!_[_0x0026('0x13')](_0x2588f8['UserId'])){_0x149e97[_0x0026('0x14')][_0x0026('0x15')]({'where':{'id':_0x2588f8[_0x0026('0x16')]}})[_0x0026('0x17')](function(_0xf05b07){if(_0xf05b07){_0xf05b07[_0x0026('0x18')]({'lastMsgAt':_0x2588f8[_0x0026('0x19')],'lastMsgDirection':_0x2588f8[_0x0026('0x10')]['toLowerCase']()});}})[_0x0026('0x1a')](function(_0x5ed932){console[_0x0026('0x1b')](_0x5ed932);});}_0x321ac6();}},'charset':_0x0026('0x1c'),'collate':_0x0026('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 11eeec9..42be8c4 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 _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x5acc14,_0x2f3058){var _0x58e2b1=function(_0x3a0e9b){while(--_0x3a0e9b){_0x5acc14['push'](_0x5acc14['shift']());}};_0x58e2b1(++_0x2f3058);}(_0xb821,0xa7));var _0x1b82=function(_0x1e438a,_0x38931a){_0x1e438a=_0x1e438a-0x0;var _0x28e65e=_0xb821[_0x1e438a];return _0x28e65e;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file +var _0x0a9a=['error','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','CreateFaxMessage','debug','UpdateFaxMessage','update','raw','where','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a96b5,_0x2adaad){var _0x3458cd=function(_0x211615){while(--_0x211615){_0x2a96b5['push'](_0x2a96b5['shift']());}};_0x3458cd(++_0x2adaad);}(_0x0a9a,0x183));var _0xa0a9=function(_0x14853f,_0xcc9d04){_0x14853f=_0x14853f-0x0;var _0x2aa60a=_0x0a9a[_0x14853f];return _0x2aa60a;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});config[_0xa0a9('0xa')]=_['defaults'](config[_0xa0a9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0a9('0xb'))(new Redis(config[_0xa0a9('0xa')]));require(_0xa0a9('0xc'))[_0xa0a9('0xd')](socket);function respondWithRpcPromise(_0x4b9b93,_0x2ba0ac,_0x1b5bfb){return new BPromise(function(_0x5ce7e9,_0x5909cf){return client[_0xa0a9('0xe')](_0x4b9b93,_0x1b5bfb)[_0xa0a9('0xf')](function(_0x51d5a5){logger[_0xa0a9('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2ba0ac,_0xa0a9('0x11'));logger['debug'](_0xa0a9('0x12'),_0x2ba0ac,_0xa0a9('0x11'),JSON[_0xa0a9('0x13')](_0x51d5a5));if(_0x51d5a5[_0xa0a9('0x14')]){if(_0x51d5a5[_0xa0a9('0x14')]['code']===0x1f4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);return _0x5909cf(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}logger['error'](_0xa0a9('0x15'),_0x2ba0ac,_0x51d5a5['error']['message']);return _0x5ce7e9(_0x51d5a5[_0xa0a9('0x14')][_0xa0a9('0x16')]);}else{logger[_0xa0a9('0x10')](_0xa0a9('0x15'),_0x2ba0ac,'request\x20sent');_0x5ce7e9(_0x51d5a5[_0xa0a9('0x17')][_0xa0a9('0x16')]);}})[_0xa0a9('0x18')](function(_0x27f8d4){logger[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x2ba0ac,_0x27f8d4);_0x5909cf(_0x27f8d4);});});}exports['CreateFaxMessage']=function(_0x3cdd8c){var _0x3107ce=this;return new Promise(function(_0x4a8e80,_0x53b99d){return db[_0xa0a9('0x19')][_0xa0a9('0x1a')](_0x3cdd8c[_0xa0a9('0x1b')],{'raw':_0x3cdd8c['options']?_0x3cdd8c[_0xa0a9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xa0a9('0xf')](function(_0x5e6148){logger[_0xa0a9('0x10')](_0xa0a9('0x1d'),_0x3cdd8c);logger[_0xa0a9('0x1e')](_0xa0a9('0x1d'),_0x3cdd8c,JSON['stringify'](_0x5e6148));_0x4a8e80(_0x5e6148);})[_0xa0a9('0x18')](function(_0x4fb909){logger[_0xa0a9('0x14')](_0xa0a9('0x1d'),_0x4fb909[_0xa0a9('0x16')],_0x3cdd8c);_0x53b99d(_0x3107ce[_0xa0a9('0x14')](0x1f4,_0x4fb909['message']));});});};exports[_0xa0a9('0x1f')]=function(_0xe49d3b){var _0x384cd5=this;return new Promise(function(_0x3f4bea,_0x526dd1){return db[_0xa0a9('0x19')][_0xa0a9('0x20')](_0xe49d3b[_0xa0a9('0x1b')],{'raw':_0xe49d3b['options']?_0xe49d3b['options'][_0xa0a9('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x22')]||null:null,'attributes':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x23')]||null:null,'limit':_0xe49d3b[_0xa0a9('0x1c')]?_0xe49d3b[_0xa0a9('0x1c')][_0xa0a9('0x24')]||null:null})[_0xa0a9('0xf')](function(_0x554191){logger[_0xa0a9('0x10')](_0xa0a9('0x1f'),_0xe49d3b);logger['debug'](_0xa0a9('0x1f'),_0xe49d3b,JSON[_0xa0a9('0x13')](_0x554191));_0x3f4bea(_0x554191);})['catch'](function(_0x47c19b){logger[_0xa0a9('0x14')]('UpdateFaxMessage',_0x47c19b['message'],_0xe49d3b);_0x526dd1(_0x384cd5[_0xa0a9('0x14')](0x1f4,_0x47c19b[_0xa0a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7af2161..64cd174 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 _0x9baa=['update','emit','register','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9baa,0x190));var _0xa9ba=function(_0x4a1f01,_0x45e5c4){_0x4a1f01=_0x4a1f01-0x0;var _0x135de8=_0x9baa[_0x4a1f01];return _0x135de8;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xa9ba('0x0'),_0xa9ba('0x1'),_0xa9ba('0x2')];function createListener(_0x1b47ab,_0x20935d){return function(_0x2dc33b){_0x20935d[_0xa9ba('0x3')](_0x1b47ab,_0x2dc33b);};}function removeListener(_0x3410c2,_0x2a81f8){return function(){FaxMessageEvents['removeListener'](_0x3410c2,_0x2a81f8);};}exports[_0xa9ba('0x4')]=function(_0x2704cd){for(var _0x1ab051=0x0,_0x1bfb75=events[_0xa9ba('0x5')];_0x1ab051<_0x1bfb75;_0x1ab051++){var _0x4cae58=events[_0x1ab051];var _0x5b4564=createListener('faxMessage:'+_0x4cae58,_0x2704cd);FaxMessageEvents['on'](_0x4cae58,_0x5b4564);}}; \ No newline at end of file +var _0x7702=['length','faxMessage:','remove','register'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7702,0xd2));var _0x2770=function(_0x2337ba,_0x2e6c43){_0x2337ba=_0x2337ba-0x0;var _0x3be12b=_0x7702[_0x2337ba];return _0x3be12b;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x2770('0x0'),'update'];function createListener(_0x2846d4,_0x1ee908){return function(_0x252282){_0x1ee908['emit'](_0x2846d4,_0x252282);};}function removeListener(_0x49e589,_0x12783d){return function(){FaxMessageEvents['removeListener'](_0x49e589,_0x12783d);};}exports[_0x2770('0x1')]=function(_0xc708a2){for(var _0x91b186=0x0,_0x50420=events[_0x2770('0x2')];_0x91b186<_0x50420;_0x91b186++){var _0x3ca55d=events[_0x91b186];var _0x51b8c4=createListener(_0x2770('0x3')+_0x3ca55d,_0xc708a2);FaxMessageEvents['on'](_0x3ca55d,_0x51b8c4);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4804777..f2aa1cb 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 _0xeb74=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x294873,_0xfb04cf){var _0x181f5b=function(_0x541357){while(--_0x541357){_0x294873['push'](_0x294873['shift']());}};_0x181f5b(++_0xfb04cf);}(_0xeb74,0xe3));var _0x4eb7=function(_0x6d1e3d,_0x5da35a){_0x6d1e3d=_0x6d1e3d-0x0;var _0x39f838=_0xeb74[_0x6d1e3d];return _0x39f838;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/describe',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),interaction['tracked'](_0x4eb7('0x11'),_0x4eb7('0x12')),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x4eb7('0x17')]);router['put'](_0x4eb7('0x18'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x19')]);router[_0x4eb7('0x1a')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x1b')]);module[_0x4eb7('0x1c')]=router; \ No newline at end of file +var _0xcea2=['create','put','update','/:id/accept','accept','reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0xcea2,0x15a));var _0x2cea=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xcea2[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0xd')]);router[_0x2cea('0x9')](_0x2cea('0xe'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xf')]);router[_0x2cea('0x10')]('/',auth[_0x2cea('0x8')](),interaction[_0x2cea('0x11')]('fax','faxmessage:create'),controller[_0x2cea('0x12')]);router[_0x2cea('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2cea('0x14')]);router['put'](_0x2cea('0x15'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x2cea('0x17')]);router['delete'](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x18')]);module[_0x2cea('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 929e17d..2b935ad 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 _0xc613=['beepall','sequelize','INTEGER','ENUM'];(function(_0x2aa6b3,_0x297436){var _0x25699a=function(_0x4da2c9){while(--_0x4da2c9){_0x2aa6b3['push'](_0x2aa6b3['shift']());}};_0x25699a(++_0x297436);}(_0xc613,0x115));var _0x3c61=function(_0x39869d,_0xba5659){_0x39869d=_0x39869d-0x0;var _0x1d76fc=_0xc613[_0x39869d];return _0x1d76fc;};'use strict';var Sequelize=require(_0x3c61('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3c61('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3c61('0x2')]('rrmemory',_0x3c61('0x3'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3c61('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x74a2=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x45a23e,_0x1b32a5){var _0xc5cd5e=function(_0x3eb5b3){while(--_0x3eb5b3){_0x45a23e['push'](_0x45a23e['shift']());}};_0xc5cd5e(++_0x1b32a5);}(_0x74a2,0x1bf));var _0x274a=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x74a2[_0x2261ce];return _0x524640;};'use strict';var Sequelize=require('sequelize');module[_0x274a('0x0')]={'name':{'type':Sequelize[_0x274a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x274a('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x274a('0x3')](_0x274a('0x4'),_0x274a('0x5'),_0x274a('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x274a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 76e0680..065482d 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 _0xcba4=['forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','then','get','FaxQueues','UserProfileResource','destroy','stack','name','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','fields','options','find','body','user','role','UserProfileSection','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xcba4,0x1c9));var _0x4cba=function(_0x4a3903,_0x447389){_0x4a3903=_0x4a3903-0x0;var _0x124281=_0xcba4[_0x4a3903];return _0x124281;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4cba('0x0'));var zipdir=require(_0x4cba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4cba('0x2'));var moment=require(_0x4cba('0x3'));var BPromise=require(_0x4cba('0x4'));var Mustache=require(_0x4cba('0x5'));var util=require(_0x4cba('0x6'));var path=require(_0x4cba('0x7'));var sox=require(_0x4cba('0x8'));var csv=require('to-csv');var ejs=require(_0x4cba('0x9'));var fs=require('fs');var fs_extra=require(_0x4cba('0xa'));var _=require(_0x4cba('0xb'));var squel=require(_0x4cba('0xc'));var crypto=require(_0x4cba('0xd'));var jsforce=require(_0x4cba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4cba('0xf'));var querystring=require(_0x4cba('0x10'));var Papa=require(_0x4cba('0x11'));var Redis=require(_0x4cba('0x12'));var authService=require(_0x4cba('0x13'));var qs=require(_0x4cba('0x14'));var as=require(_0x4cba('0x15'));var hardwareService=require(_0x4cba('0x16'));var logger=require(_0x4cba('0x17'))(_0x4cba('0x18'));var utils=require(_0x4cba('0x19'));var config=require(_0x4cba('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4cba('0x1b')]=_[_0x4cba('0x1c')](config[_0x4cba('0x1b')],{'host':_0x4cba('0x1d'),'port':0x18eb});var socket=require(_0x4cba('0x1e'))(new Redis(config[_0x4cba('0x1b')]));require(_0x4cba('0x1f'))[_0x4cba('0x20')](socket);function respondWithStatusCode(_0x24abea,_0x2376e1){_0x2376e1=_0x2376e1||0xcc;return function(_0x1053d8){if(_0x1053d8){return _0x24abea[_0x4cba('0x21')](_0x2376e1);}return _0x24abea[_0x4cba('0x22')](_0x2376e1)[_0x4cba('0x23')]();};}function respondWithResult(_0x2f484c,_0x1448e4){_0x1448e4=_0x1448e4||0xc8;return function(_0x4fe9e7){if(_0x4fe9e7){return _0x2f484c['status'](_0x1448e4)['json'](_0x4fe9e7);}};}function respondWithFilteredResult(_0x5638e7,_0x37cc4a){return function(_0x17ed0a){if(_0x17ed0a){var _0x2a2c14=typeof _0x37cc4a[_0x4cba('0x24')]===_0x4cba('0x25')&&typeof _0x37cc4a[_0x4cba('0x26')]===_0x4cba('0x25');var _0xb00eeb=_0x17ed0a['count'];var _0x4d9a31=_0x2a2c14?0x0:_0x37cc4a[_0x4cba('0x24')];var _0x4e9439=_0x2a2c14?_0x17ed0a[_0x4cba('0x27')]:_0x37cc4a['offset']+_0x37cc4a[_0x4cba('0x26')];var _0x40b8b7;if(_0x4e9439>=_0xb00eeb){_0x4e9439=_0xb00eeb;_0x40b8b7=0xc8;}else{_0x40b8b7=0xce;}_0x5638e7[_0x4cba('0x22')](_0x40b8b7);return _0x5638e7[_0x4cba('0x28')]('Content-Range',_0x4d9a31+'-'+_0x4e9439+'/'+_0xb00eeb)[_0x4cba('0x29')](_0x17ed0a);}return null;};}function patchUpdates(_0x8b6770){return function(_0x43d996){try{jsonpatch[_0x4cba('0x2a')](_0x43d996,_0x8b6770,!![]);}catch(_0xebb08e){return BPromise['reject'](_0xebb08e);}return _0x43d996['save']();};}function saveUpdates(_0x241347,_0x40be51){return function(_0x24286b){if(_0x24286b){return _0x24286b['update'](_0x241347)['then'](function(_0x20e5a3){return _0x20e5a3;});}return null;};}function removeEntity(_0x3daa0c,_0x134a86){return function(_0x63d5b4){if(_0x63d5b4){return _0x63d5b4['destroy']()[_0x4cba('0x2b')](function(){var _0xb27110=_0x63d5b4[_0x4cba('0x2c')]({'plain':!![]});var _0x2aa410=_0x4cba('0x2d');return db[_0x4cba('0x2e')][_0x4cba('0x2f')]({'where':{'type':_0x2aa410,'resourceId':_0xb27110['id']}})[_0x4cba('0x2b')](function(){return _0x63d5b4;});})['then'](function(){_0x3daa0c[_0x4cba('0x22')](0xcc)[_0x4cba('0x23')]();});}};}function handleEntityNotFound(_0x36479e,_0x581a01){return function(_0x102bd9){if(!_0x102bd9){_0x36479e[_0x4cba('0x21')](0x194);}return _0x102bd9;};}function handleError(_0x8b1274,_0x1e8544){_0x1e8544=_0x1e8544||0x1f4;return function(_0x448a25){logger['error'](_0x448a25[_0x4cba('0x30')]);if(_0x448a25[_0x4cba('0x31')]){delete _0x448a25[_0x4cba('0x31')];}_0x8b1274['status'](_0x1e8544)['send'](_0x448a25);};}exports[_0x4cba('0x32')]=function(_0x337873,_0x55b774){var _0x59aadf={},_0xa32149={},_0x5187d0={'count':0x0,'rows':[]};var _0x11e5d5=_[_0x4cba('0x33')](db[_0x4cba('0x34')][_0x4cba('0x35')],function(_0x21ab26){return{'name':_0x21ab26[_0x4cba('0x36')],'type':_0x21ab26[_0x4cba('0x37')]['key']};});_0xa32149[_0x4cba('0x38')]=_[_0x4cba('0x33')](_0x11e5d5,_0x4cba('0x31'));_0xa32149[_0x4cba('0x39')]=_[_0x4cba('0x3a')](_0x337873[_0x4cba('0x39')]);_0xa32149['filters']=_['intersection'](_0xa32149['model'],_0xa32149[_0x4cba('0x39')]);_0x59aadf[_0x4cba('0x3b')]=_['intersection'](_0xa32149[_0x4cba('0x38')],qs['fields'](_0x337873[_0x4cba('0x39')]['fields']));_0x59aadf['attributes']=_0x59aadf[_0x4cba('0x3b')][_0x4cba('0x3c')]?_0x59aadf[_0x4cba('0x3b')]:_0xa32149[_0x4cba('0x38')];if(!_0x337873[_0x4cba('0x39')][_0x4cba('0x3d')](_0x4cba('0x3e'))){_0x59aadf[_0x4cba('0x26')]=qs[_0x4cba('0x26')](_0x337873[_0x4cba('0x39')][_0x4cba('0x26')]);_0x59aadf[_0x4cba('0x24')]=qs[_0x4cba('0x24')](_0x337873[_0x4cba('0x39')]['offset']);}_0x59aadf['order']=qs[_0x4cba('0x3f')](_0x337873['query'][_0x4cba('0x3f')]);_0x59aadf[_0x4cba('0x40')]=qs[_0x4cba('0x41')](_[_0x4cba('0x42')](_0x337873['query'],_0xa32149[_0x4cba('0x41')]),_0x11e5d5);if(_0x337873['query'][_0x4cba('0x43')]){_0x59aadf[_0x4cba('0x40')]=_[_0x4cba('0x44')](_0x59aadf[_0x4cba('0x40')],{'$or':_[_0x4cba('0x33')](_0x11e5d5,function(_0x5bf276){if(_0x5bf276[_0x4cba('0x37')]!==_0x4cba('0x45')){var _0x4b5f99={};_0x4b5f99[_0x5bf276[_0x4cba('0x31')]]={'$like':'%'+_0x337873[_0x4cba('0x39')]['filter']+'%'};return _0x4b5f99;}})});}_0x59aadf=_['merge']({},_0x59aadf,_0x337873['options']);var _0xfb8165={'where':_0x59aadf[_0x4cba('0x40')]};return db['FaxQueue'][_0x4cba('0x27')](_0xfb8165)[_0x4cba('0x2b')](function(_0x7ed3f1){_0x5187d0[_0x4cba('0x27')]=_0x7ed3f1;if(_0x337873[_0x4cba('0x39')][_0x4cba('0x46')]){_0x59aadf[_0x4cba('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0x4cba('0x48')](_0x59aadf);})['then'](function(_0x26b436){_0x5187d0[_0x4cba('0x49')]=_0x26b436;return _0x5187d0;})[_0x4cba('0x2b')](respondWithFilteredResult(_0x55b774,_0x59aadf))['catch'](handleError(_0x55b774,null));};exports[_0x4cba('0x4a')]=function(_0x56938c,_0x20b0de){var _0x5d66f1={'raw':!![],'where':{'id':_0x56938c[_0x4cba('0x4b')]['id']}},_0x15f558={};_0x15f558[_0x4cba('0x38')]=_[_0x4cba('0x3a')](db[_0x4cba('0x34')][_0x4cba('0x35')]);_0x15f558[_0x4cba('0x39')]=_[_0x4cba('0x3a')](_0x56938c['query']);_0x15f558[_0x4cba('0x41')]=_[_0x4cba('0x4c')](_0x15f558[_0x4cba('0x38')],_0x15f558[_0x4cba('0x39')]);_0x5d66f1[_0x4cba('0x3b')]=_['intersection'](_0x15f558[_0x4cba('0x38')],qs['fields'](_0x56938c['query'][_0x4cba('0x4d')]));_0x5d66f1[_0x4cba('0x3b')]=_0x5d66f1[_0x4cba('0x3b')][_0x4cba('0x3c')]?_0x5d66f1[_0x4cba('0x3b')]:_0x15f558[_0x4cba('0x38')];if(_0x56938c[_0x4cba('0x39')][_0x4cba('0x46')]){_0x5d66f1[_0x4cba('0x47')]=[{'all':!![]}];}_0x5d66f1=_[_0x4cba('0x44')]({},_0x5d66f1,_0x56938c[_0x4cba('0x4e')]);return db[_0x4cba('0x34')][_0x4cba('0x4f')](_0x5d66f1)[_0x4cba('0x2b')](handleEntityNotFound(_0x20b0de,null))['then'](respondWithResult(_0x20b0de,null))['catch'](handleError(_0x20b0de,null));};exports['create']=function(_0x2c89f3,_0x24c091){return db[_0x4cba('0x34')]['create'](_0x2c89f3[_0x4cba('0x50')],{})[_0x4cba('0x2b')](function(_0x1a1107){var _0x39efc5=_0x2c89f3[_0x4cba('0x51')]['get']({'plain':!![]});if(!_0x39efc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39efc5[_0x4cba('0x52')]===_0x4cba('0x51')){var _0x20fc37=_0x1a1107[_0x4cba('0x2c')]({'plain':!![]});var _0x3e390b=_0x4cba('0x2d');return db[_0x4cba('0x53')][_0x4cba('0x4f')]({'where':{'name':_0x3e390b,'userProfileId':_0x39efc5['userProfileId']},'raw':!![]})['then'](function(_0x3f5666){if(_0x3f5666&&_0x3f5666['autoAssociation']===0x0){return db['UserProfileResource'][_0x4cba('0x54')]({'name':_0x20fc37[_0x4cba('0x31')],'resourceId':_0x20fc37['id'],'type':_0x3f5666[_0x4cba('0x31')],'sectionId':_0x3f5666['id']},{})[_0x4cba('0x2b')](function(){return _0x1a1107;});}else{return _0x1a1107;}})[_0x4cba('0x55')](function(_0xed6abd){logger[_0x4cba('0x56')](_0x4cba('0x57'),_0xed6abd);throw _0xed6abd;});}return _0x1a1107;})['then'](respondWithResult(_0x24c091,0xc9))['catch'](handleError(_0x24c091,null));};exports[_0x4cba('0x58')]=function(_0x2af6c1,_0x1defcc){if(_0x2af6c1[_0x4cba('0x50')]['id']){delete _0x2af6c1[_0x4cba('0x50')]['id'];}return db[_0x4cba('0x34')][_0x4cba('0x4f')]({'where':{'id':_0x2af6c1[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0x1defcc,null))[_0x4cba('0x2b')](saveUpdates(_0x2af6c1[_0x4cba('0x50')],null))['then'](respondWithResult(_0x1defcc,null))['catch'](handleError(_0x1defcc,null));};exports[_0x4cba('0x2f')]=function(_0x4769bc,_0x2ee740){return db[_0x4cba('0x34')][_0x4cba('0x4f')]({'where':{'id':_0x4769bc[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0x2ee740,null))[_0x4cba('0x2b')](removeEntity(_0x2ee740,null))[_0x4cba('0x55')](handleError(_0x2ee740,null));};exports[_0x4cba('0x59')]=function(_0xbacd71,_0x3e3f08){return db['FaxQueue'][_0x4cba('0x59')]()[_0x4cba('0x2b')](respondWithResult(_0x3e3f08,null))['catch'](handleError(_0x3e3f08,null));};exports[_0x4cba('0x5a')]=function(_0x1874bb,_0x20a6eb,_0x2adef9){var _0x14d062={'raw':!![],'where':{}},_0x37fb10={},_0x27fd3b;return db['FaxQueue'][_0x4cba('0x5b')]({'where':{'id':_0x1874bb['params']['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0x20a6eb,null))['then'](function(_0x6f477){if(_0x6f477){_0x27fd3b=_0x6f477[_0x4cba('0x2c')]({'plain':!![]});_0x37fb10[_0x4cba('0x38')]=_['keys'](db[_0x4cba('0x5c')][_0x4cba('0x35')]);_0x37fb10[_0x4cba('0x39')]=_[_0x4cba('0x3a')](_0x1874bb[_0x4cba('0x39')]);_0x37fb10[_0x4cba('0x41')]=_[_0x4cba('0x4c')](_0x37fb10[_0x4cba('0x38')],_0x37fb10[_0x4cba('0x39')]);_0x14d062[_0x4cba('0x3b')]=_[_0x4cba('0x4c')](_0x37fb10[_0x4cba('0x38')],qs[_0x4cba('0x4d')](_0x1874bb[_0x4cba('0x39')]['fields']));_0x14d062[_0x4cba('0x3b')]=_0x14d062[_0x4cba('0x3b')]['length']?_0x14d062[_0x4cba('0x3b')]:_0x37fb10[_0x4cba('0x38')];if(!_0x1874bb[_0x4cba('0x39')][_0x4cba('0x3d')]('nolimit')){_0x14d062['limit']=qs[_0x4cba('0x26')](_0x1874bb['query']['limit']);_0x14d062[_0x4cba('0x24')]=qs[_0x4cba('0x24')](_0x1874bb['query'][_0x4cba('0x24')]);}_0x14d062[_0x4cba('0x5d')]=qs['sort'](_0x1874bb[_0x4cba('0x39')][_0x4cba('0x3f')]);_0x14d062[_0x4cba('0x40')]=qs[_0x4cba('0x41')](_['pick'](_0x1874bb[_0x4cba('0x39')],_0x37fb10[_0x4cba('0x41')]));_0x14d062[_0x4cba('0x40')][_0x4cba('0x5e')]=_0x6f477['id'];if(_0x1874bb[_0x4cba('0x39')][_0x4cba('0x43')]){_0x14d062[_0x4cba('0x40')]=_['merge'](_0x14d062['where'],{'$or':_[_0x4cba('0x33')](_0x14d062['attributes'],function(_0x12cd01){var _0x5526ad={};_0x5526ad[_0x12cd01]={'$like':'%'+_0x1874bb[_0x4cba('0x39')][_0x4cba('0x43')]+'%'};return _0x5526ad;})});}_0x14d062=_[_0x4cba('0x44')]({},_0x14d062,_0x1874bb['options']);return db[_0x4cba('0x5c')][_0x4cba('0x48')](_0x14d062);}})[_0x4cba('0x2b')](function(_0xbb3d95){if(_0xbb3d95){return db[_0x4cba('0x5f')][_0x4cba('0x60')]({'where':{'id':_[_0x4cba('0x33')](_0xbb3d95,_0x4cba('0x61')),'role':_0x4cba('0x62')},'attributes':['id',_0x4cba('0x31'),_0x4cba('0x63'),_0x4cba('0x64'),_0x4cba('0x65')]});}})[_0x4cba('0x2b')](function(_0x5b18fb){if(_0x5b18fb){return{'count':_0x5b18fb['count'],'rows':_['map'](_0x5b18fb[_0x4cba('0x49')],function(_0x35beff){return{'membername':_0x35beff[_0x4cba('0x31')],'UserId':_0x35beff['id'],'queue_name':_0x27fd3b[_0x4cba('0x31')],'FaxQueueId':_0x27fd3b['id'],'interface':util[_0x4cba('0x66')]('%s/%s',_0x4cba('0x67'),_0x35beff[_0x4cba('0x31')]),'penalty':0x0,'paused':_0x35beff[_0x4cba('0x63')],'createdAt':_0x35beff[_0x4cba('0x65')],'updatedAt':_0x35beff[_0x4cba('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x20a6eb,_0x14d062))[_0x4cba('0x55')](handleError(_0x20a6eb,null));};exports[_0x4cba('0x68')]=function(_0x1d36a0,_0xee45e4,_0x73ebc2){var _0x282981={};var _0x470440={};var _0x4772da;var _0xe1d7be;return db[_0x4cba('0x34')][_0x4cba('0x5b')]({'where':{'id':_0x1d36a0[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0xee45e4,null))['then'](function(_0x134052){if(_0x134052){_0x4772da=_0x134052;_0x470440[_0x4cba('0x38')]=_[_0x4cba('0x3a')](db[_0x4cba('0x69')]['rawAttributes']);_0x470440[_0x4cba('0x39')]=_[_0x4cba('0x3a')](_0x1d36a0[_0x4cba('0x39')]);_0x470440[_0x4cba('0x41')]=_[_0x4cba('0x4c')](_0x470440[_0x4cba('0x38')],_0x470440[_0x4cba('0x39')]);_0x282981[_0x4cba('0x3b')]=_[_0x4cba('0x4c')](_0x470440[_0x4cba('0x38')],qs[_0x4cba('0x4d')](_0x1d36a0[_0x4cba('0x39')][_0x4cba('0x4d')]));_0x282981[_0x4cba('0x3b')]=_0x282981[_0x4cba('0x3b')][_0x4cba('0x3c')]?_0x282981['attributes']:_0x470440['model'];_0x282981[_0x4cba('0x5d')]=qs[_0x4cba('0x3f')](_0x1d36a0['query'][_0x4cba('0x3f')]);_0x282981[_0x4cba('0x40')]=qs[_0x4cba('0x41')](_['pick'](_0x1d36a0[_0x4cba('0x39')],_0x470440['filters']));if(_0x1d36a0[_0x4cba('0x39')][_0x4cba('0x43')]){_0x282981[_0x4cba('0x40')]=_[_0x4cba('0x44')](_0x282981[_0x4cba('0x40')],{'$or':_[_0x4cba('0x33')](_0x282981[_0x4cba('0x3b')],function(_0x5aec9c){var _0x61fe44={};_0x61fe44[_0x5aec9c]={'$like':'%'+_0x1d36a0['query'][_0x4cba('0x43')]+'%'};return _0x61fe44;})});}_0x282981=_['merge']({},_0x282981,_0x1d36a0[_0x4cba('0x4e')]);return _0x4772da[_0x4cba('0x68')](_0x282981);}})[_0x4cba('0x2b')](function(_0xaabc31){if(_0xaabc31){_0xe1d7be=_0xaabc31['length'];if(!_0x1d36a0['query'][_0x4cba('0x3d')]('nolimit')){_0x282981[_0x4cba('0x26')]=qs[_0x4cba('0x26')](_0x1d36a0['query'][_0x4cba('0x26')]);_0x282981[_0x4cba('0x24')]=qs[_0x4cba('0x24')](_0x1d36a0['query'][_0x4cba('0x24')]);}return _0x4772da[_0x4cba('0x68')](_0x282981);}})[_0x4cba('0x2b')](function(_0xa0a094){if(_0xa0a094){return _0xa0a094?{'count':_0xe1d7be,'rows':_0xa0a094}:null;}})[_0x4cba('0x2b')](respondWithResult(_0xee45e4,null))[_0x4cba('0x55')](handleError(_0xee45e4,null));};exports[_0x4cba('0x6a')]=function(_0x3c212e,_0xd9b212,_0x13efbb){var _0x3582e7=_0x3c212e[_0x4cba('0x50')][_0x4cba('0x6b')];return db[_0x4cba('0x69')][_0x4cba('0x48')]({'where':{'id':_0x3582e7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4cba('0x6c'),'attributes':['id',_0x4cba('0x31'),_0x4cba('0x6d'),'voicePause',_0x4cba('0x6e')],'raw':!![]}]})[_0x4cba('0x2b')](function(_0x12df83){if(_0x12df83){var _0xc282f7=_[_0x4cba('0x6f')](_0x12df83,function(_0x1dc9b0){var _0x496ec6=_0x1dc9b0['get']({'plain':!![]});return _0x496ec6[_0x4cba('0x6c')];});return db['FaxQueue'][_0x4cba('0x4f')]({'where':{'id':_0x3c212e[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](function(_0x117b38){return db[_0x4cba('0x70')][_0x4cba('0x71')](function(_0xac59e7){return _0x117b38[_0x4cba('0x6a')](_0x3582e7,{'transaction':_0xac59e7})[_0x4cba('0x2b')](function(){return BPromise['each'](_0xc282f7,function(_0x2d16be){return db['UserFaxQueue'][_0x4cba('0x72')]({'where':{'UserId':_0x2d16be['id'],'FaxQueueId':_0x3c212e[_0x4cba('0x4b')]['id']},'transaction':_0xac59e7});});})[_0x4cba('0x2b')](function(){_0xc282f7[_0x4cba('0x73')](function(_0x4ee1d5){socket[_0x4cba('0x74')](_0x4cba('0x75'),{'UserId':_0x4ee1d5['id'],'FaxQueueId':_0x117b38['id']});});});});});}})[_0x4cba('0x2b')](respondWithStatusCode(_0xd9b212,null))[_0x4cba('0x55')](handleError(_0xd9b212,null));};exports[_0x4cba('0x76')]=function(_0x13240b,_0x1e35ba,_0x3b453f){return db[_0x4cba('0x69')][_0x4cba('0x48')]({'where':{'id':_0x13240b['query'][_0x4cba('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x4cba('0x5f')],'as':_0x4cba('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e35ba,null))[_0x4cba('0x2b')](function(_0x27b053){var _0x2ee340=_[_0x4cba('0x33')](_0x27b053,'id');var _0x18b2fb=[];var _0x352b85=[];var _0x1aee93=squel[_0x4cba('0x77')]();_0x1aee93[_0x4cba('0x78')](_0x4cba('0x79'))[_0x4cba('0x7a')]('team_has_fax_queues','tq')[_0x4cba('0x7b')](_0x4cba('0x7c'),'ut',_0x4cba('0x7d'))[_0x4cba('0x40')]('FaxQueueId\x20=\x20?',_0x13240b[_0x4cba('0x4b')]['id']);for(var _0x20edcd=0x0;_0x20edcd<_0x27b053[_0x4cba('0x3c')];_0x20edcd+=0x1){let _0x4891cf=_0x27b053[_0x20edcd];for(var _0x265348=0x0;_0x265348<_0x4891cf[_0x4cba('0x6c')][_0x4cba('0x3c')];_0x265348+=0x1){let _0x56a9ba=_0x4891cf[_0x4cba('0x6c')][_0x265348];var _0x284485=_0x1aee93['clone']();_0x284485['where']('ut.UserId\x20=\x20?',_0x56a9ba['id']);_0x352b85[_0x4cba('0x7e')](db[_0x4cba('0x70')][_0x4cba('0x39')](_0x284485[_0x4cba('0x7f')](),{'type':db[_0x4cba('0x70')][_0x4cba('0x80')][_0x4cba('0x81')]})['then'](function(_0x2a4f50){if(_0x2a4f50['length']===0x1){return _0x56a9ba['id'];}else{var _0x2e34ab=_[_0x4cba('0x82')](_[_0x4cba('0x33')](_0x2a4f50,_0x4cba('0x83')),function(_0x21fbd3){return _['includes'](_0x2ee340,_0x21fbd3);});if(_0x2e34ab){return _0x56a9ba['id'];}}}));}}return BPromise[_0x4cba('0x84')](_0x352b85)[_0x4cba('0x2b')](function(_0x1bde19){_0x18b2fb=_(_0x18b2fb)[_0x4cba('0x85')](_0x1bde19)[_0x4cba('0x86')]()[_0x4cba('0x87')]();return db[_0x4cba('0x34')][_0x4cba('0x4f')]({'where':{'id':_0x13240b[_0x4cba('0x4b')]['id']}})['then'](function(_0x416ca1){return db[_0x4cba('0x70')]['transaction'](function(_0x14e50d){return _0x416ca1['removeTeams'](_0x13240b['query']['ids'],{'transaction':_0x14e50d})[_0x4cba('0x2b')](function(){if(!_[_0x4cba('0x88')](_0x18b2fb)){return _0x416ca1[_0x4cba('0x89')](_0x18b2fb,{'transaction':_0x14e50d});}})[_0x4cba('0x2b')](function(){_0x18b2fb[_0x4cba('0x73')](function(_0x4a8547){socket[_0x4cba('0x74')](_0x4cba('0x8a'),{'UserId':_0x4a8547,'FaxQueueId':_0x416ca1['id']});});});});});});})[_0x4cba('0x2b')](respondWithStatusCode(_0x1e35ba,null))[_0x4cba('0x55')](handleError(_0x1e35ba,null));};exports['addAgents']=function(_0x3900e2,_0x3898ef,_0x3e28eb){return db[_0x4cba('0x34')]['find']({'where':{'id':_0x3900e2[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0x3898ef,null))[_0x4cba('0x2b')](function(_0x46de9c){if(_0x46de9c){return _0x46de9c[_0x4cba('0x8b')](_0x3900e2[_0x4cba('0x50')]['ids'],_['omit'](_0x3900e2[_0x4cba('0x50')],[_0x4cba('0x6b'),'id'])||{})[_0x4cba('0x8c')](function(_0x423463){for(var _0x516228=0x0;_0x516228<_0x3900e2[_0x4cba('0x50')][_0x4cba('0x6b')][_0x4cba('0x3c')];_0x516228+=0x1){socket[_0x4cba('0x74')](_0x4cba('0x75'),{'UserId':Number(_0x3900e2['body']['ids'][_0x516228]),'FaxQueueId':Number(_0x3900e2['params']['id'])});}return _0x423463;});}})['then'](respondWithResult(_0x3898ef,null))[_0x4cba('0x55')](handleError(_0x3898ef,null));};exports['removeAgents']=function(_0x1277b7,_0x26743a,_0x27ede1){return db[_0x4cba('0x34')][_0x4cba('0x4f')]({'where':{'id':_0x1277b7['params']['id']}})['then'](handleEntityNotFound(_0x26743a,null))[_0x4cba('0x2b')](function(_0x5947d4){if(_0x5947d4){return _0x5947d4[_0x4cba('0x89')](_0x1277b7[_0x4cba('0x39')][_0x4cba('0x6b')])[_0x4cba('0x2b')](function(){if(_[_0x4cba('0x8d')](_0x1277b7['query'][_0x4cba('0x6b')])){for(var _0x97647b=0x0;_0x97647b<_0x1277b7['query'][_0x4cba('0x6b')][_0x4cba('0x3c')];_0x97647b+=0x1){socket[_0x4cba('0x74')](_0x4cba('0x8a'),{'UserId':Number(_0x1277b7[_0x4cba('0x39')][_0x4cba('0x6b')][_0x97647b]),'FaxQueueId':Number(_0x1277b7[_0x4cba('0x4b')]['id'])});}}else{socket['emit'](_0x4cba('0x8a'),{'UserId':Number(_0x1277b7[_0x4cba('0x39')][_0x4cba('0x6b')]),'FaxQueueId':Number(_0x1277b7['params']['id'])});}});}})[_0x4cba('0x2b')](respondWithStatusCode(_0x26743a,null))[_0x4cba('0x55')](handleError(_0x26743a,null));};exports[_0x4cba('0x8e')]=function(_0x29a2b3,_0x479f38,_0x11bf33){var _0x52ba9e={};var _0x3e092e={};var _0x4a2095;var _0x86054d;return db['FaxQueue'][_0x4cba('0x5b')]({'where':{'id':_0x29a2b3[_0x4cba('0x4b')]['id']}})[_0x4cba('0x2b')](handleEntityNotFound(_0x479f38,null))[_0x4cba('0x2b')](function(_0x4a76fc){if(_0x4a76fc){_0x4a2095=_0x4a76fc;_0x3e092e[_0x4cba('0x38')]=_[_0x4cba('0x3a')](db['User'][_0x4cba('0x35')]);_0x3e092e[_0x4cba('0x39')]=_[_0x4cba('0x3a')](_0x29a2b3['query']);_0x3e092e[_0x4cba('0x41')]=_[_0x4cba('0x4c')](_0x3e092e[_0x4cba('0x38')],_0x3e092e[_0x4cba('0x39')]);_0x52ba9e[_0x4cba('0x3b')]=_[_0x4cba('0x4c')](_0x3e092e[_0x4cba('0x38')],qs['fields'](_0x29a2b3[_0x4cba('0x39')][_0x4cba('0x4d')]));_0x52ba9e[_0x4cba('0x3b')]=_0x52ba9e['attributes'][_0x4cba('0x3c')]?_0x52ba9e[_0x4cba('0x3b')]:_0x3e092e[_0x4cba('0x38')];_0x52ba9e[_0x4cba('0x5d')]=qs['sort'](_0x29a2b3['query'][_0x4cba('0x3f')]);_0x52ba9e[_0x4cba('0x40')]=qs[_0x4cba('0x41')](_['pick'](_0x29a2b3[_0x4cba('0x39')],_0x3e092e['filters']));if(_0x29a2b3[_0x4cba('0x39')]['filter']){_0x52ba9e[_0x4cba('0x40')]=_[_0x4cba('0x44')](_0x52ba9e[_0x4cba('0x40')],{'$or':_['map'](_0x52ba9e['attributes'],function(_0x12685c){var _0x1cc7cb={};_0x1cc7cb[_0x12685c]={'$like':'%'+_0x29a2b3[_0x4cba('0x39')][_0x4cba('0x43')]+'%'};return _0x1cc7cb;})});}_0x52ba9e=_[_0x4cba('0x44')]({},_0x52ba9e,_0x29a2b3[_0x4cba('0x4e')]);return _0x4a2095[_0x4cba('0x8e')](_0x52ba9e);}})[_0x4cba('0x2b')](function(_0x42866a){if(_0x42866a){_0x86054d=_0x42866a[_0x4cba('0x3c')];if(!_0x29a2b3[_0x4cba('0x39')][_0x4cba('0x3d')]('nolimit')){_0x52ba9e[_0x4cba('0x26')]=qs[_0x4cba('0x26')](_0x29a2b3[_0x4cba('0x39')]['limit']);_0x52ba9e[_0x4cba('0x24')]=qs['offset'](_0x29a2b3['query'][_0x4cba('0x24')]);}return _0x4a2095[_0x4cba('0x8e')](_0x52ba9e);}})[_0x4cba('0x2b')](function(_0x1b3336){if(_0x1b3336){return _0x1b3336?{'count':_0x86054d,'rows':_0x1b3336}:null;}})[_0x4cba('0x2b')](respondWithResult(_0x479f38,null))[_0x4cba('0x55')](handleError(_0x479f38,null));}; \ No newline at end of file +var _0x9cef=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','end','name','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','Agents','online','voicePause','interface','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','offset','undefined'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9cef,0x184));var _0xf9ce=function(_0x36c55d,_0x1c8efa){_0x36c55d=_0x36c55d-0x0;var _0xa16625=_0x9cef[_0x36c55d];return _0xa16625;};'use strict';var emlformat=require(_0xf9ce('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9ce('0x1'));var moment=require(_0xf9ce('0x2'));var BPromise=require(_0xf9ce('0x3'));var Mustache=require(_0xf9ce('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf9ce('0x5'));var csv=require(_0xf9ce('0x6'));var ejs=require(_0xf9ce('0x7'));var fs=require('fs');var fs_extra=require(_0xf9ce('0x8'));var _=require(_0xf9ce('0x9'));var squel=require(_0xf9ce('0xa'));var crypto=require(_0xf9ce('0xb'));var jsforce=require(_0xf9ce('0xc'));var deskjs=require(_0xf9ce('0xd'));var toCsv=require(_0xf9ce('0x6'));var querystring=require(_0xf9ce('0xe'));var Papa=require(_0xf9ce('0xf'));var Redis=require(_0xf9ce('0x10'));var authService=require(_0xf9ce('0x11'));var qs=require(_0xf9ce('0x12'));var as=require(_0xf9ce('0x13'));var hardwareService=require(_0xf9ce('0x14'));var logger=require(_0xf9ce('0x15'))(_0xf9ce('0x16'));var utils=require(_0xf9ce('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf9ce('0x18'));var db=require('../../mysqldb')['db'];config[_0xf9ce('0x19')]=_[_0xf9ce('0x1a')](config[_0xf9ce('0x19')],{'host':_0xf9ce('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9ce('0x19')]));require(_0xf9ce('0x1c'))[_0xf9ce('0x1d')](socket);function respondWithStatusCode(_0x9352bc,_0xf06ba0){_0xf06ba0=_0xf06ba0||0xcc;return function(_0x3a8777){if(_0x3a8777){return _0x9352bc[_0xf9ce('0x1e')](_0xf06ba0);}return _0x9352bc[_0xf9ce('0x1f')](_0xf06ba0)['end']();};}function respondWithResult(_0x3fda05,_0x203e90){_0x203e90=_0x203e90||0xc8;return function(_0xfc87f1){if(_0xfc87f1){return _0x3fda05[_0xf9ce('0x1f')](_0x203e90)[_0xf9ce('0x20')](_0xfc87f1);}};}function respondWithFilteredResult(_0x5e4fb2,_0x4e02d8){return function(_0x54fe01){if(_0x54fe01){var _0x4dda82=typeof _0x4e02d8[_0xf9ce('0x21')]===_0xf9ce('0x22')&&typeof _0x4e02d8[_0xf9ce('0x23')]===_0xf9ce('0x22');var _0x5366d4=_0x54fe01[_0xf9ce('0x24')];var _0x176457=_0x4dda82?0x0:_0x4e02d8[_0xf9ce('0x21')];var _0x23c8be=_0x4dda82?_0x54fe01[_0xf9ce('0x24')]:_0x4e02d8[_0xf9ce('0x21')]+_0x4e02d8[_0xf9ce('0x23')];var _0x1c06dc;if(_0x23c8be>=_0x5366d4){_0x23c8be=_0x5366d4;_0x1c06dc=0xc8;}else{_0x1c06dc=0xce;}_0x5e4fb2[_0xf9ce('0x1f')](_0x1c06dc);return _0x5e4fb2[_0xf9ce('0x25')](_0xf9ce('0x26'),_0x176457+'-'+_0x23c8be+'/'+_0x5366d4)['json'](_0x54fe01);}return null;};}function patchUpdates(_0x466108){return function(_0x45b2bb){try{jsonpatch[_0xf9ce('0x27')](_0x45b2bb,_0x466108,!![]);}catch(_0x54f7d1){return BPromise[_0xf9ce('0x28')](_0x54f7d1);}return _0x45b2bb[_0xf9ce('0x29')]();};}function saveUpdates(_0x6aa708,_0x5893e7){return function(_0xee2a69){if(_0xee2a69){return _0xee2a69[_0xf9ce('0x2a')](_0x6aa708)[_0xf9ce('0x2b')](function(_0x5723b5){return _0x5723b5;});}return null;};}function removeEntity(_0xb6dacf,_0x36dc99){return function(_0x30e90a){if(_0x30e90a){return _0x30e90a[_0xf9ce('0x2c')]()[_0xf9ce('0x2b')](function(){var _0x5dde91=_0x30e90a['get']({'plain':!![]});var _0x4fa297=_0xf9ce('0x2d');return db[_0xf9ce('0x2e')][_0xf9ce('0x2c')]({'where':{'type':_0x4fa297,'resourceId':_0x5dde91['id']}})['then'](function(){return _0x30e90a;});})['then'](function(){_0xb6dacf['status'](0xcc)[_0xf9ce('0x2f')]();});}};}function handleEntityNotFound(_0x2707bc,_0x506d4e){return function(_0x1629ac){if(!_0x1629ac){_0x2707bc[_0xf9ce('0x1e')](0x194);}return _0x1629ac;};}function handleError(_0x14cde1,_0x208b24){_0x208b24=_0x208b24||0x1f4;return function(_0x373cda){logger['error'](_0x373cda['stack']);if(_0x373cda[_0xf9ce('0x30')]){delete _0x373cda[_0xf9ce('0x30')];}_0x14cde1['status'](_0x208b24)['send'](_0x373cda);};}exports[_0xf9ce('0x31')]=function(_0x2e55dd,_0x40c3c7){var _0x555eac={},_0xe08770={},_0x210a8a={'count':0x0,'rows':[]};var _0x51e871=_[_0xf9ce('0x32')](db[_0xf9ce('0x33')][_0xf9ce('0x34')],function(_0x4ee1a4){return{'name':_0x4ee1a4[_0xf9ce('0x35')],'type':_0x4ee1a4[_0xf9ce('0x36')][_0xf9ce('0x37')]};});_0xe08770[_0xf9ce('0x38')]=_[_0xf9ce('0x32')](_0x51e871,_0xf9ce('0x30'));_0xe08770[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x2e55dd['query']);_0xe08770[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0xe08770[_0xf9ce('0x38')],_0xe08770[_0xf9ce('0x39')]);_0x555eac[_0xf9ce('0x3d')]=_['intersection'](_0xe08770[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x2e55dd['query'][_0xf9ce('0x3e')]));_0x555eac[_0xf9ce('0x3d')]=_0x555eac['attributes'][_0xf9ce('0x3f')]?_0x555eac[_0xf9ce('0x3d')]:_0xe08770[_0xf9ce('0x38')];if(!_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x555eac[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x555eac['offset']=qs[_0xf9ce('0x21')](_0x2e55dd[_0xf9ce('0x39')][_0xf9ce('0x21')]);}_0x555eac[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x2e55dd['query'][_0xf9ce('0x43')]);_0x555eac[_0xf9ce('0x44')]=qs['filters'](_[_0xf9ce('0x45')](_0x2e55dd[_0xf9ce('0x39')],_0xe08770['filters']),_0x51e871);if(_0x2e55dd['query'][_0xf9ce('0x46')]){_0x555eac[_0xf9ce('0x44')]=_['merge'](_0x555eac[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x51e871,function(_0x23603d){if(_0x23603d[_0xf9ce('0x36')]!==_0xf9ce('0x47')){var _0x5e3a50={};_0x5e3a50[_0x23603d[_0xf9ce('0x30')]]={'$like':'%'+_0x2e55dd[_0xf9ce('0x39')]['filter']+'%'};return _0x5e3a50;}})});}_0x555eac=_[_0xf9ce('0x48')]({},_0x555eac,_0x2e55dd[_0xf9ce('0x49')]);var _0xe54498={'where':_0x555eac[_0xf9ce('0x44')]};return db[_0xf9ce('0x33')]['count'](_0xe54498)['then'](function(_0x895bd5){_0x210a8a[_0xf9ce('0x24')]=_0x895bd5;if(_0x2e55dd['query']['includeAll']){_0x555eac['include']=[{'all':!![]}];}return db[_0xf9ce('0x33')][_0xf9ce('0x4a')](_0x555eac);})[_0xf9ce('0x2b')](function(_0x2a76a4){_0x210a8a[_0xf9ce('0x4b')]=_0x2a76a4;return _0x210a8a;})[_0xf9ce('0x2b')](respondWithFilteredResult(_0x40c3c7,_0x555eac))[_0xf9ce('0x4c')](handleError(_0x40c3c7,null));};exports[_0xf9ce('0x4d')]=function(_0x1e13af,_0x5c2a0c){var _0xee2a11={'raw':!![],'where':{'id':_0x1e13af['params']['id']}},_0x5de8d9={};_0x5de8d9[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db[_0xf9ce('0x33')][_0xf9ce('0x34')]);_0x5de8d9[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x1e13af[_0xf9ce('0x39')]);_0x5de8d9[_0xf9ce('0x3b')]=_['intersection'](_0x5de8d9[_0xf9ce('0x38')],_0x5de8d9[_0xf9ce('0x39')]);_0xee2a11['attributes']=_[_0xf9ce('0x3c')](_0x5de8d9[_0xf9ce('0x38')],qs['fields'](_0x1e13af[_0xf9ce('0x39')]['fields']));_0xee2a11[_0xf9ce('0x3d')]=_0xee2a11[_0xf9ce('0x3d')][_0xf9ce('0x3f')]?_0xee2a11[_0xf9ce('0x3d')]:_0x5de8d9[_0xf9ce('0x38')];if(_0x1e13af[_0xf9ce('0x39')]['includeAll']){_0xee2a11['include']=[{'all':!![]}];}_0xee2a11=_[_0xf9ce('0x48')]({},_0xee2a11,_0x1e13af[_0xf9ce('0x49')]);return db['FaxQueue'][_0xf9ce('0x4e')](_0xee2a11)[_0xf9ce('0x2b')](handleEntityNotFound(_0x5c2a0c,null))['then'](respondWithResult(_0x5c2a0c,null))['catch'](handleError(_0x5c2a0c,null));};exports[_0xf9ce('0x4f')]=function(_0x3253b9,_0x34c29c){return db[_0xf9ce('0x33')]['create'](_0x3253b9[_0xf9ce('0x50')],{})[_0xf9ce('0x2b')](function(_0x42bddb){var _0x199dd1=_0x3253b9[_0xf9ce('0x51')][_0xf9ce('0x52')]({'plain':!![]});if(!_0x199dd1)throw new Error(_0xf9ce('0x53'));if(_0x199dd1[_0xf9ce('0x54')]===_0xf9ce('0x51')){var _0x2664c2=_0x42bddb[_0xf9ce('0x52')]({'plain':!![]});var _0x901f98=_0xf9ce('0x2d');return db['UserProfileSection'][_0xf9ce('0x4e')]({'where':{'name':_0x901f98,'userProfileId':_0x199dd1[_0xf9ce('0x55')]},'raw':!![]})['then'](function(_0x4eb8ff){if(_0x4eb8ff&&_0x4eb8ff[_0xf9ce('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x2664c2[_0xf9ce('0x30')],'resourceId':_0x2664c2['id'],'type':_0x4eb8ff[_0xf9ce('0x30')],'sectionId':_0x4eb8ff['id']},{})['then'](function(){return _0x42bddb;});}else{return _0x42bddb;}})[_0xf9ce('0x4c')](function(_0x2ef6eb){logger[_0xf9ce('0x57')](_0xf9ce('0x58'),_0x2ef6eb);throw _0x2ef6eb;});}return _0x42bddb;})['then'](respondWithResult(_0x34c29c,0xc9))[_0xf9ce('0x4c')](handleError(_0x34c29c,null));};exports['update']=function(_0x3ad57a,_0xcac946){if(_0x3ad57a[_0xf9ce('0x50')]['id']){delete _0x3ad57a['body']['id'];}return db[_0xf9ce('0x33')][_0xf9ce('0x4e')]({'where':{'id':_0x3ad57a[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0xcac946,null))['then'](saveUpdates(_0x3ad57a['body'],null))[_0xf9ce('0x2b')](respondWithResult(_0xcac946,null))[_0xf9ce('0x4c')](handleError(_0xcac946,null));};exports[_0xf9ce('0x2c')]=function(_0x2d14ef,_0x262aab){return db['FaxQueue']['find']({'where':{'id':_0x2d14ef[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x262aab,null))[_0xf9ce('0x2b')](removeEntity(_0x262aab,null))[_0xf9ce('0x4c')](handleError(_0x262aab,null));};exports[_0xf9ce('0x5a')]=function(_0x1fa785,_0x2a71ce){return db[_0xf9ce('0x33')][_0xf9ce('0x5a')]()[_0xf9ce('0x2b')](respondWithResult(_0x2a71ce,null))[_0xf9ce('0x4c')](handleError(_0x2a71ce,null));};exports[_0xf9ce('0x5b')]=function(_0x22707f,_0x5509be,_0xeb45db){var _0x351867={'raw':!![],'where':{}},_0x1662f7={},_0x3c786c;return db['FaxQueue'][_0xf9ce('0x5c')]({'where':{'id':_0x22707f[_0xf9ce('0x59')]['id']}})['then'](handleEntityNotFound(_0x5509be,null))[_0xf9ce('0x2b')](function(_0x52f1d4){if(_0x52f1d4){_0x3c786c=_0x52f1d4[_0xf9ce('0x52')]({'plain':!![]});_0x1662f7[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db['UserFaxQueue'][_0xf9ce('0x34')]);_0x1662f7[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x22707f[_0xf9ce('0x39')]);_0x1662f7[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0x1662f7[_0xf9ce('0x38')],_0x1662f7[_0xf9ce('0x39')]);_0x351867[_0xf9ce('0x3d')]=_['intersection'](_0x1662f7[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x22707f[_0xf9ce('0x39')]['fields']));_0x351867[_0xf9ce('0x3d')]=_0x351867['attributes'][_0xf9ce('0x3f')]?_0x351867['attributes']:_0x1662f7[_0xf9ce('0x38')];if(!_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x351867[_0xf9ce('0x23')]=qs['limit'](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x351867[_0xf9ce('0x21')]=qs['offset'](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x21')]);}_0x351867[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x351867[_0xf9ce('0x44')]=qs[_0xf9ce('0x3b')](_[_0xf9ce('0x45')](_0x22707f['query'],_0x1662f7['filters']));_0x351867[_0xf9ce('0x44')][_0xf9ce('0x5d')]=_0x52f1d4['id'];if(_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x46')]){_0x351867[_0xf9ce('0x44')]=_['merge'](_0x351867['where'],{'$or':_[_0xf9ce('0x32')](_0x351867[_0xf9ce('0x3d')],function(_0x266334){var _0x26a9a6={};_0x26a9a6[_0x266334]={'$like':'%'+_0x22707f[_0xf9ce('0x39')][_0xf9ce('0x46')]+'%'};return _0x26a9a6;})});}_0x351867=_[_0xf9ce('0x48')]({},_0x351867,_0x22707f[_0xf9ce('0x49')]);return db[_0xf9ce('0x5e')][_0xf9ce('0x4a')](_0x351867);}})[_0xf9ce('0x2b')](function(_0x1fe9f){if(_0x1fe9f){return db[_0xf9ce('0x5f')][_0xf9ce('0x60')]({'where':{'id':_[_0xf9ce('0x32')](_0x1fe9f,_0xf9ce('0x61')),'role':_0xf9ce('0x62')},'attributes':['id',_0xf9ce('0x30'),_0xf9ce('0x63'),_0xf9ce('0x64'),_0xf9ce('0x65')]});}})[_0xf9ce('0x2b')](function(_0x2bcd99){if(_0x2bcd99){return{'count':_0x2bcd99['count'],'rows':_[_0xf9ce('0x32')](_0x2bcd99[_0xf9ce('0x4b')],function(_0x2f66ed){return{'membername':_0x2f66ed[_0xf9ce('0x30')],'UserId':_0x2f66ed['id'],'queue_name':_0x3c786c[_0xf9ce('0x30')],'FaxQueueId':_0x3c786c['id'],'interface':util[_0xf9ce('0x66')]('%s/%s',_0xf9ce('0x67'),_0x2f66ed[_0xf9ce('0x30')]),'penalty':0x0,'paused':_0x2f66ed[_0xf9ce('0x63')],'createdAt':_0x2f66ed[_0xf9ce('0x65')],'updatedAt':_0x2f66ed['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5509be,_0x351867))[_0xf9ce('0x4c')](handleError(_0x5509be,null));};exports['getTeams']=function(_0x4f798b,_0x1a3ef9,_0x2e884d){var _0x10f318={};var _0x4fe54d={};var _0x58300f;var _0x1074a1;return db[_0xf9ce('0x33')]['findOne']({'where':{'id':_0x4f798b[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x1a3ef9,null))[_0xf9ce('0x2b')](function(_0x16359d){if(_0x16359d){_0x58300f=_0x16359d;_0x4fe54d[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db[_0xf9ce('0x68')][_0xf9ce('0x34')]);_0x4fe54d[_0xf9ce('0x39')]=_[_0xf9ce('0x3a')](_0x4f798b[_0xf9ce('0x39')]);_0x4fe54d[_0xf9ce('0x3b')]=_[_0xf9ce('0x3c')](_0x4fe54d['model'],_0x4fe54d[_0xf9ce('0x39')]);_0x10f318[_0xf9ce('0x3d')]=_[_0xf9ce('0x3c')](_0x4fe54d[_0xf9ce('0x38')],qs[_0xf9ce('0x3e')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x3e')]));_0x10f318[_0xf9ce('0x3d')]=_0x10f318[_0xf9ce('0x3d')][_0xf9ce('0x3f')]?_0x10f318[_0xf9ce('0x3d')]:_0x4fe54d[_0xf9ce('0x38')];_0x10f318[_0xf9ce('0x42')]=qs['sort'](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x10f318[_0xf9ce('0x44')]=qs[_0xf9ce('0x3b')](_[_0xf9ce('0x45')](_0x4f798b[_0xf9ce('0x39')],_0x4fe54d[_0xf9ce('0x3b')]));if(_0x4f798b[_0xf9ce('0x39')]['filter']){_0x10f318[_0xf9ce('0x44')]=_[_0xf9ce('0x48')](_0x10f318[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x10f318[_0xf9ce('0x3d')],function(_0x1864b5){var _0x3749ad={};_0x3749ad[_0x1864b5]={'$like':'%'+_0x4f798b[_0xf9ce('0x39')]['filter']+'%'};return _0x3749ad;})});}_0x10f318=_[_0xf9ce('0x48')]({},_0x10f318,_0x4f798b[_0xf9ce('0x49')]);return _0x58300f[_0xf9ce('0x69')](_0x10f318);}})[_0xf9ce('0x2b')](function(_0x5541d1){if(_0x5541d1){_0x1074a1=_0x5541d1['length'];if(!_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x10f318[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x23')]);_0x10f318[_0xf9ce('0x21')]=qs[_0xf9ce('0x21')](_0x4f798b[_0xf9ce('0x39')][_0xf9ce('0x21')]);}return _0x58300f['getTeams'](_0x10f318);}})[_0xf9ce('0x2b')](function(_0x7459b2){if(_0x7459b2){return _0x7459b2?{'count':_0x1074a1,'rows':_0x7459b2}:null;}})[_0xf9ce('0x2b')](respondWithResult(_0x1a3ef9,null))['catch'](handleError(_0x1a3ef9,null));};exports[_0xf9ce('0x6a')]=function(_0x390603,_0x1e3505,_0x471a36){var _0x35b38d=_0x390603[_0xf9ce('0x50')]['ids'];return db[_0xf9ce('0x68')][_0xf9ce('0x4a')]({'where':{'id':_0x35b38d},'attributes':['id'],'include':[{'model':db[_0xf9ce('0x5f')],'as':_0xf9ce('0x6b'),'attributes':['id','name',_0xf9ce('0x6c'),_0xf9ce('0x6d'),_0xf9ce('0x6e')],'raw':!![]}]})[_0xf9ce('0x2b')](function(_0x18e35d){if(_0x18e35d){var _0x4ecae0=_['flatMap'](_0x18e35d,function(_0x24e087){var _0x32c21c=_0x24e087[_0xf9ce('0x52')]({'plain':!![]});return _0x32c21c['Agents'];});return db['FaxQueue']['find']({'where':{'id':_0x390603[_0xf9ce('0x59')]['id']}})['then'](function(_0x53f549){return db[_0xf9ce('0x6f')]['transaction'](function(_0x36c1b1){return _0x53f549[_0xf9ce('0x6a')](_0x35b38d,{'transaction':_0x36c1b1})[_0xf9ce('0x2b')](function(){return BPromise[_0xf9ce('0x70')](_0x4ecae0,function(_0x17300a){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x17300a['id'],'FaxQueueId':_0x390603[_0xf9ce('0x59')]['id']},'transaction':_0x36c1b1});});})[_0xf9ce('0x2b')](function(){_0x4ecae0[_0xf9ce('0x71')](function(_0x4a53e3){socket[_0xf9ce('0x72')](_0xf9ce('0x73'),{'UserId':_0x4a53e3['id'],'FaxQueueId':_0x53f549['id']});});});});});}})['then'](respondWithStatusCode(_0x1e3505,null))[_0xf9ce('0x4c')](handleError(_0x1e3505,null));};exports[_0xf9ce('0x74')]=function(_0x507a88,_0x295efd,_0x35df38){return db[_0xf9ce('0x68')][_0xf9ce('0x4a')]({'where':{'id':_0x507a88[_0xf9ce('0x39')][_0xf9ce('0x75')]},'attributes':['id'],'include':[{'model':db[_0xf9ce('0x5f')],'as':_0xf9ce('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xf9ce('0x2b')](handleEntityNotFound(_0x295efd,null))[_0xf9ce('0x2b')](function(_0x4c662d){var _0x548c3d=_[_0xf9ce('0x32')](_0x4c662d,'id');var _0x56e771=[];var _0x289419=[];var _0x4d26d4=squel['select']();_0x4d26d4[_0xf9ce('0x76')](_0xf9ce('0x77'))[_0xf9ce('0x78')](_0xf9ce('0x79'),'tq')[_0xf9ce('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf9ce('0x44')](_0xf9ce('0x7b'),_0x507a88['params']['id']);for(var _0x595781=0x0;_0x595781<_0x4c662d[_0xf9ce('0x3f')];_0x595781+=0x1){let _0x2e3826=_0x4c662d[_0x595781];for(var _0x4d3132=0x0;_0x4d3132<_0x2e3826[_0xf9ce('0x6b')][_0xf9ce('0x3f')];_0x4d3132+=0x1){let _0x2edaaf=_0x2e3826[_0xf9ce('0x6b')][_0x4d3132];var _0x404035=_0x4d26d4[_0xf9ce('0x7c')]();_0x404035['where'](_0xf9ce('0x7d'),_0x2edaaf['id']);_0x289419['push'](db['sequelize'][_0xf9ce('0x39')](_0x404035[_0xf9ce('0x7e')](),{'type':db['sequelize'][_0xf9ce('0x7f')]['SELECT']})[_0xf9ce('0x2b')](function(_0x30079f){if(_0x30079f[_0xf9ce('0x3f')]===0x1){return _0x2edaaf['id'];}else{var _0x2849b=_[_0xf9ce('0x80')](_['map'](_0x30079f,_0xf9ce('0x81')),function(_0x1303b5){return _[_0xf9ce('0x82')](_0x548c3d,_0x1303b5);});if(_0x2849b){return _0x2edaaf['id'];}}}));}}return BPromise['all'](_0x289419)[_0xf9ce('0x2b')](function(_0x41d759){_0x56e771=_(_0x56e771)[_0xf9ce('0x83')](_0x41d759)[_0xf9ce('0x84')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0x507a88['params']['id']}})[_0xf9ce('0x2b')](function(_0x55ef96){return db['sequelize'][_0xf9ce('0x85')](function(_0x331bb1){return _0x55ef96[_0xf9ce('0x74')](_0x507a88[_0xf9ce('0x39')][_0xf9ce('0x75')],{'transaction':_0x331bb1})[_0xf9ce('0x2b')](function(){if(!_[_0xf9ce('0x86')](_0x56e771)){return _0x55ef96[_0xf9ce('0x87')](_0x56e771,{'transaction':_0x331bb1});}})['then'](function(){_0x56e771[_0xf9ce('0x71')](function(_0x4d5a80){socket['emit'](_0xf9ce('0x88'),{'UserId':_0x4d5a80,'FaxQueueId':_0x55ef96['id']});});});});});});})[_0xf9ce('0x2b')](respondWithStatusCode(_0x295efd,null))[_0xf9ce('0x4c')](handleError(_0x295efd,null));};exports[_0xf9ce('0x89')]=function(_0x427a7d,_0x2d593b,_0x4d7cb1){return db[_0xf9ce('0x33')][_0xf9ce('0x4e')]({'where':{'id':_0x427a7d['params']['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x2d593b,null))[_0xf9ce('0x2b')](function(_0x1edc16){if(_0x1edc16){return _0x1edc16[_0xf9ce('0x89')](_0x427a7d[_0xf9ce('0x50')][_0xf9ce('0x75')],_['omit'](_0x427a7d['body'],[_0xf9ce('0x75'),'id'])||{})[_0xf9ce('0x8a')](function(_0x3afa8e){for(var _0xf1af90=0x0;_0xf1af90<_0x427a7d[_0xf9ce('0x50')]['ids'][_0xf9ce('0x3f')];_0xf1af90+=0x1){socket[_0xf9ce('0x72')](_0xf9ce('0x73'),{'UserId':Number(_0x427a7d[_0xf9ce('0x50')][_0xf9ce('0x75')][_0xf1af90]),'FaxQueueId':Number(_0x427a7d[_0xf9ce('0x59')]['id'])});}return _0x3afa8e;});}})[_0xf9ce('0x2b')](respondWithResult(_0x2d593b,null))['catch'](handleError(_0x2d593b,null));};exports[_0xf9ce('0x87')]=function(_0x43d417,_0x5e4f53,_0x1db5da){return db[_0xf9ce('0x33')]['find']({'where':{'id':_0x43d417['params']['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x5e4f53,null))['then'](function(_0x4bc5bd){if(_0x4bc5bd){return _0x4bc5bd[_0xf9ce('0x87')](_0x43d417['query'][_0xf9ce('0x75')])[_0xf9ce('0x2b')](function(){if(_[_0xf9ce('0x8b')](_0x43d417['query']['ids'])){for(var _0x4fb685=0x0;_0x4fb685<_0x43d417[_0xf9ce('0x39')][_0xf9ce('0x75')]['length'];_0x4fb685+=0x1){socket[_0xf9ce('0x72')](_0xf9ce('0x88'),{'UserId':Number(_0x43d417['query'][_0xf9ce('0x75')][_0x4fb685]),'FaxQueueId':Number(_0x43d417[_0xf9ce('0x59')]['id'])});}}else{socket[_0xf9ce('0x72')](_0xf9ce('0x88'),{'UserId':Number(_0x43d417[_0xf9ce('0x39')][_0xf9ce('0x75')]),'FaxQueueId':Number(_0x43d417[_0xf9ce('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e4f53,null))[_0xf9ce('0x4c')](handleError(_0x5e4f53,null));};exports['getAgents']=function(_0x52d38f,_0x56f404,_0x1200c2){var _0x4484bd={};var _0x4e09a2={};var _0x359615;var _0x94bc4f;return db['FaxQueue']['findOne']({'where':{'id':_0x52d38f[_0xf9ce('0x59')]['id']}})[_0xf9ce('0x2b')](handleEntityNotFound(_0x56f404,null))[_0xf9ce('0x2b')](function(_0x263566){if(_0x263566){_0x359615=_0x263566;_0x4e09a2[_0xf9ce('0x38')]=_[_0xf9ce('0x3a')](db['User'][_0xf9ce('0x34')]);_0x4e09a2[_0xf9ce('0x39')]=_['keys'](_0x52d38f[_0xf9ce('0x39')]);_0x4e09a2['filters']=_[_0xf9ce('0x3c')](_0x4e09a2[_0xf9ce('0x38')],_0x4e09a2[_0xf9ce('0x39')]);_0x4484bd[_0xf9ce('0x3d')]=_['intersection'](_0x4e09a2['model'],qs[_0xf9ce('0x3e')](_0x52d38f['query'][_0xf9ce('0x3e')]));_0x4484bd[_0xf9ce('0x3d')]=_0x4484bd['attributes'][_0xf9ce('0x3f')]?_0x4484bd[_0xf9ce('0x3d')]:_0x4e09a2[_0xf9ce('0x38')];_0x4484bd[_0xf9ce('0x42')]=qs[_0xf9ce('0x43')](_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x43')]);_0x4484bd[_0xf9ce('0x44')]=qs['filters'](_['pick'](_0x52d38f[_0xf9ce('0x39')],_0x4e09a2['filters']));if(_0x52d38f['query'][_0xf9ce('0x46')]){_0x4484bd[_0xf9ce('0x44')]=_[_0xf9ce('0x48')](_0x4484bd[_0xf9ce('0x44')],{'$or':_[_0xf9ce('0x32')](_0x4484bd[_0xf9ce('0x3d')],function(_0x532c35){var _0x47a3dc={};_0x47a3dc[_0x532c35]={'$like':'%'+_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x46')]+'%'};return _0x47a3dc;})});}_0x4484bd=_[_0xf9ce('0x48')]({},_0x4484bd,_0x52d38f[_0xf9ce('0x49')]);return _0x359615['getAgents'](_0x4484bd);}})['then'](function(_0x15097a){if(_0x15097a){_0x94bc4f=_0x15097a['length'];if(!_0x52d38f[_0xf9ce('0x39')][_0xf9ce('0x40')](_0xf9ce('0x41'))){_0x4484bd[_0xf9ce('0x23')]=qs[_0xf9ce('0x23')](_0x52d38f['query'][_0xf9ce('0x23')]);_0x4484bd[_0xf9ce('0x21')]=qs[_0xf9ce('0x21')](_0x52d38f['query']['offset']);}return _0x359615[_0xf9ce('0x8c')](_0x4484bd);}})['then'](function(_0x5d4c1e){if(_0x5d4c1e){return _0x5d4c1e?{'count':_0x94bc4f,'rows':_0x5d4c1e}:null;}})[_0xf9ce('0x2b')](respondWithResult(_0x56f404,null))['catch'](handleError(_0x56f404,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index b0c787d..b475dbb 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 _0x2b30=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3480d8,_0x4d796d){var _0x92eabf=function(_0x5b5af0){while(--_0x5b5af0){_0x3480d8['push'](_0x3480d8['shift']());}};_0x92eabf(++_0x4d796d);}(_0x2b30,0xe9));var _0x02b3=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x2b30[_0x5ad0d7];return _0xd83bd;};'use strict';var EventEmitter=require(_0x02b3('0x0'));var FaxQueue=require(_0x02b3('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x02b3('0x2')](0x0);var events={'afterCreate':_0x02b3('0x3'),'afterUpdate':_0x02b3('0x4'),'afterDestroy':_0x02b3('0x5')};function emitEvent(_0x1c6bbf){return function(_0x4f9856,_0x6f8d6d,_0x2b8d79){FaxQueueEvents[_0x02b3('0x6')](_0x1c6bbf+':'+_0x4f9856['id'],_0x4f9856);FaxQueueEvents['emit'](_0x1c6bbf,_0x4f9856);_0x2b8d79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x02b3('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x6220=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0xaf62c7,_0x5b8b14){var _0x477c6c=function(_0x50dbab){while(--_0x50dbab){_0xaf62c7['push'](_0xaf62c7['shift']());}};_0x477c6c(++_0x5b8b14);}(_0x6220,0xdb));var _0x0622=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6220[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require(_0x0622('0x0'));var FaxQueue=require(_0x0622('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0622('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0622('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ab31a){return function(_0x4d80b3,_0x4e1837,_0x32d89f){FaxQueueEvents[_0x0622('0x4')](_0x2ab31a+':'+_0x4d80b3['id'],_0x4d80b3);FaxQueueEvents[_0x0622('0x4')](_0x2ab31a,_0x4d80b3);_0x32d89f(null);};}for(var e in events){if(events[_0x0622('0x5')](e)){var event=events[e];FaxQueue[_0x0622('0x6')](e,emitEvent(event));}}module[_0x0622('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9902b44..219eaf7 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 _0xabc2=['../../config/environment','define','FaxQueue','lodash','util','api','moment','request-promise','path'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xabc2,0x1a1));var _0x2abc=function(_0x59d85f,_0x2bff6e){_0x59d85f=_0x59d85f-0x0;var _0x10bc14=_0xabc2[_0x59d85f];return _0x10bc14;};'use strict';var _=require(_0x2abc('0x0'));var util=require(_0x2abc('0x1'));var logger=require('../../config/logger')(_0x2abc('0x2'));var moment=require(_0x2abc('0x3'));var BPromise=require('bluebird');var rp=require(_0x2abc('0x4'));var fs=require('fs');var path=require(_0x2abc('0x5'));var rimraf=require('rimraf');var config=require(_0x2abc('0x6'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x335709,_0x41e8ef){return _0x335709[_0x2abc('0x7')](_0x2abc('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b7b=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x7b7b,0x19f));var _0xb7b7=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x7b7b[_0xff5df6];return _0x2634bb;};'use strict';var _=require(_0xb7b7('0x0'));var util=require(_0xb7b7('0x1'));var logger=require(_0xb7b7('0x2'))(_0xb7b7('0x3'));var moment=require(_0xb7b7('0x4'));var BPromise=require(_0xb7b7('0x5'));var rp=require(_0xb7b7('0x6'));var fs=require('fs');var path=require(_0xb7b7('0x7'));var rimraf=require(_0xb7b7('0x8'));var config=require(_0xb7b7('0x9'));var attributes=require(_0xb7b7('0xa'));module[_0xb7b7('0xb')]=function(_0x38f7a1,_0x2a3f44){return _0x38f7a1[_0xb7b7('0xc')](_0xb7b7('0xd'),attributes,{'tableName':_0xb7b7('0xe'),'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 35f7104..5fd38b2 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 _0x481c=['find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowFaxQueue'];(function(_0x3637c4,_0x340f8e){var _0x8c6bc9=function(_0x3715f3){while(--_0x3715f3){_0x3637c4['push'](_0x3637c4['shift']());}};_0x8c6bc9(++_0x340f8e);}(_0x481c,0x1a3));var _0xc481=function(_0x5e58d5,_0x448daf){_0x5e58d5=_0x5e58d5-0x0;var _0x19bdf9=_0x481c[_0x5e58d5];return _0x19bdf9;};'use strict';var _=require(_0xc481('0x0'));var util=require(_0xc481('0x1'));var moment=require(_0xc481('0x2'));var BPromise=require(_0xc481('0x3'));var rs=require(_0xc481('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc481('0x5'))['db'];var utils=require(_0xc481('0x6'));var logger=require(_0xc481('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc481('0x8'));var client=jayson[_0xc481('0x9')]['http']({'port':0x232a});config[_0xc481('0xa')]=_[_0xc481('0xb')](config[_0xc481('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc481('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3175d6,_0x216342,_0x106d19){return new BPromise(function(_0x1ec703,_0x5c525c){return client['request'](_0x3175d6,_0x106d19)[_0xc481('0xd')](function(_0x34748c){logger[_0xc481('0xe')](_0xc481('0xf'),_0x216342,_0xc481('0x10'));logger[_0xc481('0x11')](_0xc481('0x12'),_0x216342,_0xc481('0x10'),JSON[_0xc481('0x13')](_0x34748c));if(_0x34748c[_0xc481('0x14')]){if(_0x34748c[_0xc481('0x14')][_0xc481('0x15')]===0x1f4){logger['error'](_0xc481('0xf'),_0x216342,_0x34748c[_0xc481('0x14')][_0xc481('0x16')]);return _0x5c525c(_0x34748c[_0xc481('0x14')]['message']);}logger[_0xc481('0x14')](_0xc481('0xf'),_0x216342,_0x34748c[_0xc481('0x14')][_0xc481('0x16')]);return _0x1ec703(_0x34748c[_0xc481('0x14')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x216342,_0xc481('0x10'));_0x1ec703(_0x34748c[_0xc481('0x17')][_0xc481('0x16')]);}})[_0xc481('0x18')](function(_0xb22fe5){logger[_0xc481('0x14')](_0xc481('0xf'),_0x216342,_0xb22fe5);_0x5c525c(_0xb22fe5);});});}exports[_0xc481('0x19')]=function(_0x5af9c1){var _0x206d00=this;return new Promise(function(_0x5d55e1,_0x5cac57){return db[_0xc481('0x1a')][_0xc481('0x1b')]({'raw':_0x5af9c1[_0xc481('0x1c')]?_0x5af9c1[_0xc481('0x1c')][_0xc481('0x1d')]===undefined?!![]:![]:!![],'where':_0x5af9c1[_0xc481('0x1c')]?_0x5af9c1[_0xc481('0x1c')][_0xc481('0x1e')]||null:null,'attributes':_0x5af9c1['options']?_0x5af9c1['options']['attributes']||null:null,'limit':_0x5af9c1['options']?_0x5af9c1[_0xc481('0x1c')][_0xc481('0x1f')]||null:null,'include':_0x5af9c1[_0xc481('0x1c')]?_0x5af9c1[_0xc481('0x1c')][_0xc481('0x20')]?_[_0xc481('0x21')](_0x5af9c1['options'][_0xc481('0x20')],function(_0x261698){return{'model':db[_0x261698['model']],'as':_0x261698['as'],'attributes':_0x261698[_0xc481('0x22')],'include':_0x261698[_0xc481('0x20')]?_[_0xc481('0x21')](_0x261698[_0xc481('0x20')],function(_0x30fd39){return{'model':db[_0x30fd39['model']],'as':_0x30fd39['as'],'attributes':_0x30fd39['attributes'],'include':_0x30fd39[_0xc481('0x20')]?_[_0xc481('0x21')](_0x30fd39[_0xc481('0x20')],function(_0x574087){return{'model':db[_0x574087[_0xc481('0x23')]],'as':_0x574087['as'],'attributes':_0x574087[_0xc481('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa2229f){logger[_0xc481('0xe')](_0xc481('0x19'),_0x5af9c1);logger['debug'](_0xc481('0x19'),_0x5af9c1,JSON[_0xc481('0x13')](_0xa2229f));_0x5d55e1(_0xa2229f);})[_0xc481('0x18')](function(_0x265132){logger[_0xc481('0x14')](_0xc481('0x19'),_0x265132[_0xc481('0x16')],_0x5af9c1);_0x5cac57(_0x206d00['error'](0x1f4,_0x265132[_0xc481('0x16')]));});});};exports[_0xc481('0x24')]=function(_0x49feb2){var _0x193e38=this;return new Promise(function(_0x2b6dd7,_0x464c24){return db['FaxQueue'][_0xc481('0x25')]({'raw':_0x49feb2[_0xc481('0x1c')]?_0x49feb2[_0xc481('0x1c')][_0xc481('0x1d')]===undefined?!![]:![]:!![],'where':_0x49feb2[_0xc481('0x1c')]?_0x49feb2[_0xc481('0x1c')]['where']||null:null,'attributes':_0x49feb2[_0xc481('0x1c')]?_0x49feb2[_0xc481('0x1c')][_0xc481('0x22')]||null:null,'include':_0x49feb2[_0xc481('0x1c')]?_0x49feb2[_0xc481('0x1c')][_0xc481('0x20')]?_['map'](_0x49feb2[_0xc481('0x1c')]['include'],function(_0x2db2cf){return{'model':db[_0x2db2cf[_0xc481('0x23')]],'as':_0x2db2cf['as'],'attributes':_0x2db2cf[_0xc481('0x22')],'include':_0x2db2cf[_0xc481('0x20')]?_[_0xc481('0x21')](_0x2db2cf[_0xc481('0x20')],function(_0xc9d353){return{'model':db[_0xc9d353[_0xc481('0x23')]],'as':_0xc9d353['as'],'attributes':_0xc9d353[_0xc481('0x22')],'include':_0xc9d353['include']?_[_0xc481('0x21')](_0xc9d353['include'],function(_0x284fda){return{'model':db[_0x284fda['model']],'as':_0x284fda['as'],'attributes':_0x284fda[_0xc481('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc481('0xd')](function(_0xb804b0){logger[_0xc481('0xe')](_0xc481('0x24'),_0x49feb2);logger[_0xc481('0x11')]('ShowFaxQueue',_0x49feb2,JSON[_0xc481('0x13')](_0xb804b0));_0x2b6dd7(_0xb804b0);})[_0xc481('0x18')](function(_0x358c3a){logger[_0xc481('0x14')](_0xc481('0x24'),_0x358c3a[_0xc481('0x16')],_0x49feb2);_0x464c24(_0x193e38[_0xc481('0x14')](0x1f4,_0x358c3a[_0xc481('0x16')]));});});}; \ No newline at end of file +var _0x04e2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','lodash'];(function(_0x21b413,_0x1ecb1b){var _0x309602=function(_0x35fdd7){while(--_0x35fdd7){_0x21b413['push'](_0x21b413['shift']());}};_0x309602(++_0x1ecb1b);}(_0x04e2,0xbd));var _0x204e=function(_0x2b5691,_0x5215c6){_0x2b5691=_0x2b5691-0x0;var _0x5c01d9=_0x04e2[_0x2b5691];return _0x5c01d9;};'use strict';var _=require(_0x204e('0x0'));var util=require(_0x204e('0x1'));var moment=require(_0x204e('0x2'));var BPromise=require('bluebird');var rs=require(_0x204e('0x3'));var fs=require('fs');var Redis=require(_0x204e('0x4'));var db=require(_0x204e('0x5'))['db'];var utils=require(_0x204e('0x6'));var logger=require(_0x204e('0x7'))(_0x204e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x204e('0x9')][_0x204e('0xa')]({'port':0x232a});config[_0x204e('0xb')]=_['defaults'](config[_0x204e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x204e('0xb')]));require(_0x204e('0xc'))[_0x204e('0xd')](socket);function respondWithRpcPromise(_0x2a6e10,_0x365b5d,_0x24e1c3){return new BPromise(function(_0x3d9937,_0x483150){return client[_0x204e('0xe')](_0x2a6e10,_0x24e1c3)[_0x204e('0xf')](function(_0x312681){logger[_0x204e('0x10')](_0x204e('0x11'),_0x365b5d,'request\x20sent');logger[_0x204e('0x12')](_0x204e('0x13'),_0x365b5d,_0x204e('0x14'),JSON[_0x204e('0x15')](_0x312681));if(_0x312681[_0x204e('0x16')]){if(_0x312681[_0x204e('0x16')][_0x204e('0x17')]===0x1f4){logger[_0x204e('0x16')](_0x204e('0x11'),_0x365b5d,_0x312681[_0x204e('0x16')][_0x204e('0x18')]);return _0x483150(_0x312681['error'][_0x204e('0x18')]);}logger[_0x204e('0x16')](_0x204e('0x11'),_0x365b5d,_0x312681[_0x204e('0x16')][_0x204e('0x18')]);return _0x3d9937(_0x312681[_0x204e('0x16')][_0x204e('0x18')]);}else{logger[_0x204e('0x10')](_0x204e('0x11'),_0x365b5d,'request\x20sent');_0x3d9937(_0x312681[_0x204e('0x19')]['message']);}})[_0x204e('0x1a')](function(_0x90a8ab){logger['error'](_0x204e('0x11'),_0x365b5d,_0x90a8ab);_0x483150(_0x90a8ab);});});}exports['GetFaxQueue']=function(_0xf50b54){var _0x30677c=this;return new Promise(function(_0x4093f3,_0x3e2311){return db[_0x204e('0x1b')][_0x204e('0x1c')]({'raw':_0xf50b54['options']?_0xf50b54[_0x204e('0x1d')][_0x204e('0x1e')]===undefined?!![]:![]:!![],'where':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x1f')]||null:null,'attributes':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x20')]||null:null,'limit':_0xf50b54['options']?_0xf50b54['options']['limit']||null:null,'include':_0xf50b54[_0x204e('0x1d')]?_0xf50b54[_0x204e('0x1d')][_0x204e('0x21')]?_[_0x204e('0x22')](_0xf50b54[_0x204e('0x1d')][_0x204e('0x21')],function(_0x2f5c16){return{'model':db[_0x2f5c16[_0x204e('0x23')]],'as':_0x2f5c16['as'],'attributes':_0x2f5c16[_0x204e('0x20')],'include':_0x2f5c16['include']?_[_0x204e('0x22')](_0x2f5c16[_0x204e('0x21')],function(_0x242317){return{'model':db[_0x242317[_0x204e('0x23')]],'as':_0x242317['as'],'attributes':_0x242317[_0x204e('0x20')],'include':_0x242317[_0x204e('0x21')]?_[_0x204e('0x22')](_0x242317[_0x204e('0x21')],function(_0x3bad86){return{'model':db[_0x3bad86['model']],'as':_0x3bad86['as'],'attributes':_0x3bad86['attributes']};}):[]};}):[]};}):[]:[]})[_0x204e('0xf')](function(_0x29f1f1){logger[_0x204e('0x10')](_0x204e('0x24'),_0xf50b54);logger[_0x204e('0x12')](_0x204e('0x24'),_0xf50b54,JSON[_0x204e('0x15')](_0x29f1f1));_0x4093f3(_0x29f1f1);})[_0x204e('0x1a')](function(_0x28906f){logger[_0x204e('0x16')](_0x204e('0x24'),_0x28906f[_0x204e('0x18')],_0xf50b54);_0x3e2311(_0x30677c['error'](0x1f4,_0x28906f[_0x204e('0x18')]));});});};exports[_0x204e('0x25')]=function(_0x5a7776){var _0x1986e7=this;return new Promise(function(_0x259e83,_0x1cf139){return db['FaxQueue']['find']({'raw':_0x5a7776['options']?_0x5a7776[_0x204e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5a7776[_0x204e('0x1d')]?_0x5a7776[_0x204e('0x1d')]['where']||null:null,'attributes':_0x5a7776['options']?_0x5a7776['options'][_0x204e('0x20')]||null:null,'include':_0x5a7776[_0x204e('0x1d')]?_0x5a7776[_0x204e('0x1d')][_0x204e('0x21')]?_['map'](_0x5a7776[_0x204e('0x1d')][_0x204e('0x21')],function(_0x291d7f){return{'model':db[_0x291d7f[_0x204e('0x23')]],'as':_0x291d7f['as'],'attributes':_0x291d7f[_0x204e('0x20')],'include':_0x291d7f[_0x204e('0x21')]?_[_0x204e('0x22')](_0x291d7f['include'],function(_0x20e86b){return{'model':db[_0x20e86b['model']],'as':_0x20e86b['as'],'attributes':_0x20e86b['attributes'],'include':_0x20e86b[_0x204e('0x21')]?_['map'](_0x20e86b['include'],function(_0x27b5f1){return{'model':db[_0x27b5f1[_0x204e('0x23')]],'as':_0x27b5f1['as'],'attributes':_0x27b5f1[_0x204e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x204e('0xf')](function(_0x2184f7){logger[_0x204e('0x10')]('ShowFaxQueue',_0x5a7776);logger['debug'](_0x204e('0x25'),_0x5a7776,JSON['stringify'](_0x2184f7));_0x259e83(_0x2184f7);})[_0x204e('0x1a')](function(_0x5e88c9){logger[_0x204e('0x16')]('ShowFaxQueue',_0x5e88c9[_0x204e('0x18')],_0x5a7776);_0x1cf139(_0x1986e7[_0x204e('0x16')](0x1f4,_0x5e88c9[_0x204e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d8fc81a..17ca25f 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 _0x0519=['register','length','./faxQueue.events','save','update','emit','removeListener'];(function(_0x5bd93d,_0x897ae2){var _0xdedc74=function(_0x3ea0d6){while(--_0x3ea0d6){_0x5bd93d['push'](_0x5bd93d['shift']());}};_0xdedc74(++_0x897ae2);}(_0x0519,0x1d7));var _0x9051=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x0519[_0x6cf19c];return _0xce14f3;};'use strict';var FaxQueueEvents=require(_0x9051('0x0'));var events=[_0x9051('0x1'),'remove',_0x9051('0x2')];function createListener(_0x2a2e7b,_0x462d71){return function(_0x48cf77){_0x462d71[_0x9051('0x3')](_0x2a2e7b,_0x48cf77);};}function removeListener(_0x119ba7,_0x2e7a70){return function(){FaxQueueEvents[_0x9051('0x4')](_0x119ba7,_0x2e7a70);};}exports[_0x9051('0x5')]=function(_0x333b83){for(var _0x3e11fe=0x0,_0x4ebfe3=events[_0x9051('0x6')];_0x3e11fe<_0x4ebfe3;_0x3e11fe++){var _0x8d5ec=events[_0x3e11fe];var _0x4bd608=createListener('faxQueue:'+_0x8d5ec,_0x333b83);FaxQueueEvents['on'](_0x8d5ec,_0x4bd608);}}; \ No newline at end of file +var _0x4cd7=['length','faxQueue:','save','remove','update','removeListener','register'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4cd7,0x1de));var _0x74cd=function(_0x111915,_0x341c81){_0x111915=_0x111915-0x0;var _0x85022c=_0x4cd7[_0x111915];return _0x85022c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x74cd('0x0'),_0x74cd('0x1'),_0x74cd('0x2')];function createListener(_0x3f1734,_0x63a4d7){return function(_0x20ae34){_0x63a4d7['emit'](_0x3f1734,_0x20ae34);};}function removeListener(_0x19fc70,_0x587b38){return function(){FaxQueueEvents[_0x74cd('0x3')](_0x19fc70,_0x587b38);};}exports[_0x74cd('0x4')]=function(_0x181907){for(var _0x26685a=0x0,_0x5c5f59=events[_0x74cd('0x5')];_0x26685a<_0x5c5f59;_0x26685a++){var _0x268134=events[_0x26685a];var _0x37edc4=createListener(_0x74cd('0x6')+_0x268134,_0x181907);FaxQueueEvents['on'](_0x268134,_0x37edc4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 3407ae6..763b387 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 _0xcaf2=['delete','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','update','destroy'];(function(_0x3ab68a,_0x13a49c){var _0x1e12f1=function(_0x19a398){while(--_0x19a398){_0x3ab68a['push'](_0x3ab68a['shift']());}};_0x1e12f1(++_0x13a49c);}(_0xcaf2,0x8a));var _0x2caf=function(_0x4f7a97,_0x14f986){_0x4f7a97=_0x4f7a97-0x0;var _0x2d97cb=_0xcaf2[_0x4f7a97];return _0x2d97cb;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0x7')](_0x2caf('0xd'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0x7')](_0x2caf('0xf'),auth['isAuthenticated'](),controller[_0x2caf('0x10')]);router[_0x2caf('0x7')](_0x2caf('0x11'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x12')]);router[_0x2caf('0x13')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0x14')]);router['post'](_0x2caf('0xf'),auth[_0x2caf('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x2caf('0x8')](),controller['addAgents']);router[_0x2caf('0x15')](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x16')]);router['delete'](_0x2caf('0xb'),auth['isAuthenticated'](),controller[_0x2caf('0x17')]);router['delete']('/:id/teams',auth[_0x2caf('0x8')](),controller['removeTeams']);router[_0x2caf('0x18')](_0x2caf('0x11'),auth['isAuthenticated'](),controller[_0x2caf('0x19')]);module[_0x2caf('0x1a')]=router; \ No newline at end of file +var _0xee3c=['./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xee3c,0x14a));var _0xcee3=function(_0x162964,_0x3e4b00){_0x162964=_0x162964-0x0;var _0x1758f1=_0xee3c[_0x162964];return _0x1758f1;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/members',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['get'](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x14')]);router[_0xcee3('0x15')]('/',auth[_0xcee3('0xa')](),controller['create']);router[_0xcee3('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xcee3('0x15')](_0xcee3('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcee3('0x16')]('/:id',auth[_0xcee3('0xa')](),controller['update']);router[_0xcee3('0x17')](_0xcee3('0xe'),auth['isAuthenticated'](),controller[_0xcee3('0x18')]);router[_0xcee3('0x17')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller['removeTeams']);router[_0xcee3('0x17')](_0xcee3('0x13'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index acda878..4665c30 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 _0xf444=['exports','STRING','DATE','moment','sequelize'];(function(_0x1b4614,_0x13d44f){var _0x1ff5cf=function(_0x2e11b0){while(--_0x2e11b0){_0x1b4614['push'](_0x1b4614['shift']());}};_0x1ff5cf(++_0x13d44f);}(_0xf444,0x134));var _0x4f44=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf444[_0x4e9628];return _0x27bc8c;};'use strict';var moment=require(_0x4f44('0x0'));var Sequelize=require(_0x4f44('0x1'));module[_0x4f44('0x2')]={'uniqueid':{'type':Sequelize[_0x4f44('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4f44('0x3')]},'joinAt':{'type':Sequelize[_0x4f44('0x4')]},'leaveAt':{'type':Sequelize[_0x4f44('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4f44('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b8e=['exports','STRING','DATE'];(function(_0x57076c,_0x1c75f1){var _0xde25df=function(_0x260773){while(--_0x260773){_0x57076c['push'](_0x57076c['shift']());}};_0xde25df(++_0x1c75f1);}(_0x3b8e,0x10b));var _0xe3b8=function(_0x6ec3c3,_0x5135e6){_0x6ec3c3=_0x6ec3c3-0x0;var _0x2416ce=_0x3b8e[_0x6ec3c3];return _0x2416ce;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe3b8('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe3b8('0x1')]},'joinAt':{'type':Sequelize[_0xe3b8('0x2')]},'leaveAt':{'type':Sequelize[_0xe3b8('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe3b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5d08149..58628f9 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 _0xdace=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x44c7cd,_0x388710){var _0x80fe5d=function(_0x1bf0f7){while(--_0x1bf0f7){_0x44c7cd['push'](_0x44c7cd['shift']());}};_0x80fe5d(++_0x388710);}(_0xdace,0xc5));var _0xedac=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xdace[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21c6ae,_0x1b0503){_0x1b0503=_0x1b0503||0xcc;return function(_0x306af5){if(_0x306af5){return _0x21c6ae[_0xedac('0x15')](_0x1b0503);}return _0x21c6ae[_0xedac('0x16')](_0x1b0503)[_0xedac('0x17')]();};}function respondWithResult(_0x28444a,_0x11f0b0){_0x11f0b0=_0x11f0b0||0xc8;return function(_0x593030){if(_0x593030){return _0x28444a[_0xedac('0x16')](_0x11f0b0)[_0xedac('0x18')](_0x593030);}};}function respondWithFilteredResult(_0x2f0c7c,_0x2676c3){return function(_0x15068){if(_0x15068){var _0x590e9b=typeof _0x2676c3[_0xedac('0x19')]==='undefined'&&typeof _0x2676c3[_0xedac('0x1a')]===_0xedac('0x1b');var _0xdad128=_0x15068[_0xedac('0x1c')];var _0x4fb540=_0x590e9b?0x0:_0x2676c3['offset'];var _0x2d02d7=_0x590e9b?_0x15068[_0xedac('0x1c')]:_0x2676c3[_0xedac('0x19')]+_0x2676c3[_0xedac('0x1a')];var _0x5a5438;if(_0x2d02d7>=_0xdad128){_0x2d02d7=_0xdad128;_0x5a5438=0xc8;}else{_0x5a5438=0xce;}_0x2f0c7c['status'](_0x5a5438);return _0x2f0c7c[_0xedac('0x1d')](_0xedac('0x1e'),_0x4fb540+'-'+_0x2d02d7+'/'+_0xdad128)[_0xedac('0x18')](_0x15068);}return null;};}function patchUpdates(_0xcc1605){return function(_0x2f5eee){try{jsonpatch[_0xedac('0x1f')](_0x2f5eee,_0xcc1605,!![]);}catch(_0x160be7){return BPromise[_0xedac('0x20')](_0x160be7);}return _0x2f5eee['save']();};}function saveUpdates(_0x4593e8,_0x510005){return function(_0x29cd40){if(_0x29cd40){return _0x29cd40[_0xedac('0x21')](_0x4593e8)['then'](function(_0x46e09d){return _0x46e09d;});}return null;};}function removeEntity(_0x404b8d,_0x1c87bf){return function(_0x1e5e47){if(_0x1e5e47){return _0x1e5e47[_0xedac('0x22')]()[_0xedac('0x23')](function(){_0x404b8d['status'](0xcc)[_0xedac('0x17')]();});}};}function handleEntityNotFound(_0x87d343,_0x37563f){return function(_0x41ad8d){if(!_0x41ad8d){_0x87d343[_0xedac('0x15')](0x194);}return _0x41ad8d;};}function handleError(_0x453a3c,_0x40ba53){_0x40ba53=_0x40ba53||0x1f4;return function(_0x26c6f7){logger[_0xedac('0x24')](_0x26c6f7[_0xedac('0x25')]);if(_0x26c6f7['name']){delete _0x26c6f7[_0xedac('0x26')];}_0x453a3c[_0xedac('0x16')](_0x40ba53)[_0xedac('0x27')](_0x26c6f7);};}exports['index']=function(_0x313e06,_0x4f81f6){var _0x524514={},_0x3e28bf={},_0x457d81={'count':0x0,'rows':[]};var _0x44ac60=_[_0xedac('0x28')](db['FaxQueueReport']['rawAttributes'],function(_0xe813e6){return{'name':_0xe813e6[_0xedac('0x29')],'type':_0xe813e6[_0xedac('0x2a')][_0xedac('0x2b')]};});_0x3e28bf[_0xedac('0x2c')]=_[_0xedac('0x28')](_0x44ac60,_0xedac('0x26'));_0x3e28bf['query']=_[_0xedac('0x2d')](_0x313e06[_0xedac('0x2e')]);_0x3e28bf[_0xedac('0x2f')]=_['intersection'](_0x3e28bf[_0xedac('0x2c')],_0x3e28bf[_0xedac('0x2e')]);_0x524514['attributes']=_[_0xedac('0x30')](_0x3e28bf[_0xedac('0x2c')],qs['fields'](_0x313e06[_0xedac('0x2e')][_0xedac('0x31')]));_0x524514[_0xedac('0x32')]=_0x524514[_0xedac('0x32')][_0xedac('0x33')]?_0x524514[_0xedac('0x32')]:_0x3e28bf[_0xedac('0x2c')];if(!_0x313e06[_0xedac('0x2e')][_0xedac('0x34')](_0xedac('0x35'))){_0x524514['limit']=qs[_0xedac('0x1a')](_0x313e06[_0xedac('0x2e')][_0xedac('0x1a')]);_0x524514[_0xedac('0x19')]=qs[_0xedac('0x19')](_0x313e06[_0xedac('0x2e')][_0xedac('0x19')]);}_0x524514[_0xedac('0x36')]=qs[_0xedac('0x37')](_0x313e06[_0xedac('0x2e')][_0xedac('0x37')]);_0x524514[_0xedac('0x38')]=qs[_0xedac('0x2f')](_[_0xedac('0x39')](_0x313e06[_0xedac('0x2e')],_0x3e28bf['filters']),_0x44ac60);if(_0x313e06[_0xedac('0x2e')][_0xedac('0x3a')]){_0x524514[_0xedac('0x38')]=_[_0xedac('0x3b')](_0x524514['where'],{'$or':_[_0xedac('0x28')](_0x44ac60,function(_0x1cee42){if(_0x1cee42[_0xedac('0x2a')]!=='VIRTUAL'){var _0x159145={};_0x159145[_0x1cee42[_0xedac('0x26')]]={'$like':'%'+_0x313e06[_0xedac('0x2e')]['filter']+'%'};return _0x159145;}})});}_0x524514=_[_0xedac('0x3b')]({},_0x524514,_0x313e06[_0xedac('0x3c')]);var _0x47f7c7={'where':_0x524514[_0xedac('0x38')]};return db[_0xedac('0x3d')]['count'](_0x47f7c7)[_0xedac('0x23')](function(_0x534ad3){_0x457d81[_0xedac('0x1c')]=_0x534ad3;if(_0x313e06[_0xedac('0x2e')][_0xedac('0x3e')]){_0x524514[_0xedac('0x3f')]=[{'all':!![]}];}return db[_0xedac('0x3d')][_0xedac('0x40')](_0x524514);})['then'](function(_0x2370aa){_0x457d81[_0xedac('0x41')]=_0x2370aa;return _0x457d81;})[_0xedac('0x23')](respondWithFilteredResult(_0x4f81f6,_0x524514))[_0xedac('0x42')](handleError(_0x4f81f6,null));};exports[_0xedac('0x43')]=function(_0xa3a919,_0x2e9eef){var _0x6a17a9={'raw':!![],'where':{'id':_0xa3a919[_0xedac('0x44')]['id']}},_0x2dcff4={};_0x2dcff4[_0xedac('0x2c')]=_[_0xedac('0x2d')](db[_0xedac('0x3d')][_0xedac('0x45')]);_0x2dcff4[_0xedac('0x2e')]=_[_0xedac('0x2d')](_0xa3a919['query']);_0x2dcff4[_0xedac('0x2f')]=_[_0xedac('0x30')](_0x2dcff4[_0xedac('0x2c')],_0x2dcff4['query']);_0x6a17a9['attributes']=_['intersection'](_0x2dcff4[_0xedac('0x2c')],qs[_0xedac('0x31')](_0xa3a919['query'][_0xedac('0x31')]));_0x6a17a9['attributes']=_0x6a17a9[_0xedac('0x32')]['length']?_0x6a17a9[_0xedac('0x32')]:_0x2dcff4[_0xedac('0x2c')];if(_0xa3a919[_0xedac('0x2e')][_0xedac('0x3e')]){_0x6a17a9[_0xedac('0x3f')]=[{'all':!![]}];}_0x6a17a9=_['merge']({},_0x6a17a9,_0xa3a919['options']);return db[_0xedac('0x3d')]['find'](_0x6a17a9)[_0xedac('0x23')](handleEntityNotFound(_0x2e9eef,null))[_0xedac('0x23')](respondWithResult(_0x2e9eef,null))[_0xedac('0x42')](handleError(_0x2e9eef,null));};exports['create']=function(_0x29a707,_0x45189f){return db[_0xedac('0x3d')]['create'](_0x29a707[_0xedac('0x46')],{})[_0xedac('0x23')](respondWithResult(_0x45189f,0xc9))[_0xedac('0x42')](handleError(_0x45189f,null));};exports['update']=function(_0x5e6079,_0x2cb3ca){if(_0x5e6079[_0xedac('0x46')]['id']){delete _0x5e6079['body']['id'];}return db['FaxQueueReport'][_0xedac('0x47')]({'where':{'id':_0x5e6079[_0xedac('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb3ca,null))[_0xedac('0x23')](saveUpdates(_0x5e6079['body'],null))[_0xedac('0x23')](respondWithResult(_0x2cb3ca,null))[_0xedac('0x42')](handleError(_0x2cb3ca,null));};exports[_0xedac('0x22')]=function(_0x104842,_0x126bd3){return db[_0xedac('0x3d')]['find']({'where':{'id':_0x104842[_0xedac('0x44')]['id']}})[_0xedac('0x23')](handleEntityNotFound(_0x126bd3,null))['then'](removeEntity(_0x126bd3,null))[_0xedac('0x42')](handleError(_0x126bd3,null));};exports[_0xedac('0x48')]=function(_0x3178a1,_0x48875c){return db['FaxQueueReport'][_0xedac('0x48')]()[_0xedac('0x23')](respondWithResult(_0x48875c,null))['catch'](handleError(_0x48875c,null));}; \ No newline at end of file +var _0xbc8b=['api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','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'];(function(_0x34c03b,_0x3a85c9){var _0x2e5517=function(_0x19f947){while(--_0x19f947){_0x34c03b['push'](_0x34c03b['shift']());}};_0x2e5517(++_0x3a85c9);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xbc8b[_0x2307fa];return _0x496486;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];function respondWithStatusCode(_0xc702ca,_0x1c4b00){_0x1c4b00=_0x1c4b00||0xcc;return function(_0x55b386){if(_0x55b386){return _0xc702ca['sendStatus'](_0x1c4b00);}return _0xc702ca[_0xbbc8('0x1a')](_0x1c4b00)['end']();};}function respondWithResult(_0x290045,_0x2add43){_0x2add43=_0x2add43||0xc8;return function(_0x1c76df){if(_0x1c76df){return _0x290045[_0xbbc8('0x1a')](_0x2add43)[_0xbbc8('0x1b')](_0x1c76df);}};}function respondWithFilteredResult(_0x1e9c27,_0x292cc2){return function(_0x1cd58e){if(_0x1cd58e){var _0x38bf2f=typeof _0x292cc2[_0xbbc8('0x1c')]===_0xbbc8('0x1d')&&typeof _0x292cc2[_0xbbc8('0x1e')]===_0xbbc8('0x1d');var _0x21a44b=_0x1cd58e['count'];var _0xc9a328=_0x38bf2f?0x0:_0x292cc2[_0xbbc8('0x1c')];var _0x38e642=_0x38bf2f?_0x1cd58e[_0xbbc8('0x1f')]:_0x292cc2['offset']+_0x292cc2[_0xbbc8('0x1e')];var _0x4f754f;if(_0x38e642>=_0x21a44b){_0x38e642=_0x21a44b;_0x4f754f=0xc8;}else{_0x4f754f=0xce;}_0x1e9c27[_0xbbc8('0x1a')](_0x4f754f);return _0x1e9c27[_0xbbc8('0x20')]('Content-Range',_0xc9a328+'-'+_0x38e642+'/'+_0x21a44b)[_0xbbc8('0x1b')](_0x1cd58e);}return null;};}function patchUpdates(_0x1f7576){return function(_0x14b069){try{jsonpatch[_0xbbc8('0x21')](_0x14b069,_0x1f7576,!![]);}catch(_0x1ec180){return BPromise[_0xbbc8('0x22')](_0x1ec180);}return _0x14b069[_0xbbc8('0x23')]();};}function saveUpdates(_0x58d198,_0x14af5b){return function(_0x5a1e00){if(_0x5a1e00){return _0x5a1e00[_0xbbc8('0x24')](_0x58d198)[_0xbbc8('0x25')](function(_0x3f22f2){return _0x3f22f2;});}return null;};}function removeEntity(_0x37acb1,_0x354312){return function(_0x521c11){if(_0x521c11){return _0x521c11[_0xbbc8('0x26')]()[_0xbbc8('0x25')](function(){_0x37acb1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fba6e,_0x2ee2dd){return function(_0x31fc9b){if(!_0x31fc9b){_0x4fba6e[_0xbbc8('0x27')](0x194);}return _0x31fc9b;};}function handleError(_0x11bdd5,_0x1a0129){_0x1a0129=_0x1a0129||0x1f4;return function(_0x15fd05){logger[_0xbbc8('0x28')](_0x15fd05[_0xbbc8('0x29')]);if(_0x15fd05['name']){delete _0x15fd05[_0xbbc8('0x2a')];}_0x11bdd5[_0xbbc8('0x1a')](_0x1a0129)[_0xbbc8('0x2b')](_0x15fd05);};}exports['index']=function(_0x186572,_0x239e64){var _0x4b0e0c={},_0x130758={},_0x56ce6b={'count':0x0,'rows':[]};var _0x57cc7e=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x4308eb){return{'name':_0x4308eb[_0xbbc8('0x2f')],'type':_0x4308eb[_0xbbc8('0x30')]['key']};});_0x130758['model']=_[_0xbbc8('0x2c')](_0x57cc7e,_0xbbc8('0x2a'));_0x130758[_0xbbc8('0x31')]=_['keys'](_0x186572[_0xbbc8('0x31')]);_0x130758[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],_0x130758[_0xbbc8('0x31')]);_0x4b0e0c[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x130758[_0xbbc8('0x34')],qs[_0xbbc8('0x36')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x36')]));_0x4b0e0c['attributes']=_0x4b0e0c[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x4b0e0c[_0xbbc8('0x35')]:_0x130758[_0xbbc8('0x34')];if(!_0x186572[_0xbbc8('0x31')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x4b0e0c[_0xbbc8('0x1e')]=qs[_0xbbc8('0x1e')](_0x186572[_0xbbc8('0x31')]['limit']);_0x4b0e0c[_0xbbc8('0x1c')]=qs[_0xbbc8('0x1c')](_0x186572[_0xbbc8('0x31')][_0xbbc8('0x1c')]);}_0x4b0e0c[_0xbbc8('0x3a')]=qs[_0xbbc8('0x3b')](_0x186572['query'][_0xbbc8('0x3b')]);_0x4b0e0c[_0xbbc8('0x3c')]=qs[_0xbbc8('0x32')](_[_0xbbc8('0x3d')](_0x186572['query'],_0x130758[_0xbbc8('0x32')]),_0x57cc7e);if(_0x186572[_0xbbc8('0x31')][_0xbbc8('0x3e')]){_0x4b0e0c[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x4b0e0c['where'],{'$or':_[_0xbbc8('0x2c')](_0x57cc7e,function(_0x39babd){if(_0x39babd[_0xbbc8('0x30')]!==_0xbbc8('0x40')){var _0x479e73={};_0x479e73[_0x39babd['name']]={'$like':'%'+_0x186572[_0xbbc8('0x31')]['filter']+'%'};return _0x479e73;}})});}_0x4b0e0c=_[_0xbbc8('0x3f')]({},_0x4b0e0c,_0x186572[_0xbbc8('0x41')]);var _0x14b16c={'where':_0x4b0e0c['where']};return db[_0xbbc8('0x2d')]['count'](_0x14b16c)['then'](function(_0xec130){_0x56ce6b[_0xbbc8('0x1f')]=_0xec130;if(_0x186572['query'][_0xbbc8('0x42')]){_0x4b0e0c[_0xbbc8('0x43')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbbc8('0x44')](_0x4b0e0c);})[_0xbbc8('0x25')](function(_0x10114e){_0x56ce6b['rows']=_0x10114e;return _0x56ce6b;})[_0xbbc8('0x25')](respondWithFilteredResult(_0x239e64,_0x4b0e0c))[_0xbbc8('0x45')](handleError(_0x239e64,null));};exports[_0xbbc8('0x46')]=function(_0x4852a4,_0x3e7e54){var _0x1dfbce={'raw':!![],'where':{'id':_0x4852a4[_0xbbc8('0x47')]['id']}},_0x3dd5f6={};_0x3dd5f6[_0xbbc8('0x34')]=_[_0xbbc8('0x48')](db['FaxQueueReport'][_0xbbc8('0x2e')]);_0x3dd5f6[_0xbbc8('0x31')]=_['keys'](_0x4852a4[_0xbbc8('0x31')]);_0x3dd5f6[_0xbbc8('0x32')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],_0x3dd5f6[_0xbbc8('0x31')]);_0x1dfbce[_0xbbc8('0x35')]=_[_0xbbc8('0x33')](_0x3dd5f6['model'],qs[_0xbbc8('0x36')](_0x4852a4['query'][_0xbbc8('0x36')]));_0x1dfbce[_0xbbc8('0x35')]=_0x1dfbce[_0xbbc8('0x35')]['length']?_0x1dfbce[_0xbbc8('0x35')]:_0x3dd5f6[_0xbbc8('0x34')];if(_0x4852a4[_0xbbc8('0x31')]['includeAll']){_0x1dfbce[_0xbbc8('0x43')]=[{'all':!![]}];}_0x1dfbce=_[_0xbbc8('0x3f')]({},_0x1dfbce,_0x4852a4[_0xbbc8('0x41')]);return db[_0xbbc8('0x2d')][_0xbbc8('0x49')](_0x1dfbce)['then'](handleEntityNotFound(_0x3e7e54,null))[_0xbbc8('0x25')](respondWithResult(_0x3e7e54,null))['catch'](handleError(_0x3e7e54,null));};exports[_0xbbc8('0x4a')]=function(_0x2a961f,_0x528b53){return db['FaxQueueReport'][_0xbbc8('0x4a')](_0x2a961f['body'],{})[_0xbbc8('0x25')](respondWithResult(_0x528b53,0xc9))[_0xbbc8('0x45')](handleError(_0x528b53,null));};exports[_0xbbc8('0x24')]=function(_0x36ad4c,_0x387dbf){if(_0x36ad4c[_0xbbc8('0x4b')]['id']){delete _0x36ad4c[_0xbbc8('0x4b')]['id'];}return db['FaxQueueReport'][_0xbbc8('0x49')]({'where':{'id':_0x36ad4c[_0xbbc8('0x47')]['id']}})['then'](handleEntityNotFound(_0x387dbf,null))['then'](saveUpdates(_0x36ad4c[_0xbbc8('0x4b')],null))['then'](respondWithResult(_0x387dbf,null))[_0xbbc8('0x45')](handleError(_0x387dbf,null));};exports[_0xbbc8('0x26')]=function(_0xe3f94f,_0x45262e){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0xe3f94f[_0xbbc8('0x47')]['id']}})[_0xbbc8('0x25')](handleEntityNotFound(_0x45262e,null))[_0xbbc8('0x25')](removeEntity(_0x45262e,null))[_0xbbc8('0x45')](handleError(_0x45262e,null));};exports[_0xbbc8('0x4c')]=function(_0x4a52da,_0x44510b){return db[_0xbbc8('0x2d')][_0xbbc8('0x4c')]()[_0xbbc8('0x25')](respondWithResult(_0x44510b,null))[_0xbbc8('0x45')](handleError(_0x44510b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index ddf0e69..d721a5a 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(_0x1a6258,_0x33b22b){var _0x2c2cd4=function(_0x237509){while(--_0x237509){_0x1a6258['push'](_0x1a6258['shift']());}};_0x2c2cd4(++_0x33b22b);}(_0x1261,0x144));var _0x1126=function(_0x1878db,_0x18d9f6){_0x1878db=_0x1878db-0x0;var _0x1ae242=_0x1261[_0x1878db];return _0x1ae242;};'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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x4507c2,_0x5d394b){var _0xc37251=function(_0x4af3bf){while(--_0x4af3bf){_0x4507c2['push'](_0x4507c2['shift']());}};_0xc37251(++_0x5d394b);}(_0x326f,0xd1));var _0xf326=function(_0x56d476,_0x1b33f8){_0x56d476=_0x56d476-0x0;var _0x59ce94=_0x326f[_0x56d476];return _0x59ce94;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 34d759e..8174f0e 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 _0xc7df=['../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc7df,0x1b9));var _0xfc7d=function(_0x163528,_0x29d11a){_0x163528=_0x163528-0x0;var _0x466545=_0xc7df[_0x163528];return _0x466545;};'use strict';var _=require(_0xfc7d('0x0'));var util=require(_0xfc7d('0x1'));var moment=require(_0xfc7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc7d('0x3'));var fs=require('fs');var Redis=require(_0xfc7d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc7d('0x5'));var logger=require('../../config/logger')(_0xfc7d('0x6'));var config=require(_0xfc7d('0x7'));var jayson=require(_0xfc7d('0x8'));var client=jayson[_0xfc7d('0x9')][_0xfc7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485a6d,_0x24880b,_0x224204){return new BPromise(function(_0x2c17a2,_0x185681){return client[_0xfc7d('0xb')](_0x485a6d,_0x224204)[_0xfc7d('0xc')](function(_0x3ee04b){logger[_0xfc7d('0xd')](_0xfc7d('0xe'),_0x24880b,_0xfc7d('0xf'));logger[_0xfc7d('0x10')](_0xfc7d('0x11'),_0x24880b,_0xfc7d('0xf'),JSON[_0xfc7d('0x12')](_0x3ee04b));if(_0x3ee04b[_0xfc7d('0x13')]){if(_0x3ee04b['error'][_0xfc7d('0x14')]===0x1f4){logger[_0xfc7d('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x24880b,_0x3ee04b[_0xfc7d('0x13')][_0xfc7d('0x15')]);return _0x185681(_0x3ee04b[_0xfc7d('0x13')]['message']);}logger[_0xfc7d('0x13')](_0xfc7d('0xe'),_0x24880b,_0x3ee04b[_0xfc7d('0x13')][_0xfc7d('0x15')]);return _0x2c17a2(_0x3ee04b[_0xfc7d('0x13')]['message']);}else{logger['info'](_0xfc7d('0xe'),_0x24880b,'request\x20sent');_0x2c17a2(_0x3ee04b['result'][_0xfc7d('0x15')]);}})['catch'](function(_0x5b989b){logger[_0xfc7d('0x13')](_0xfc7d('0xe'),_0x24880b,_0x5b989b);_0x185681(_0x5b989b);});});}exports[_0xfc7d('0x16')]=function(_0xd26a7b){var _0x5c008e=this;return new Promise(function(_0x2f5bab,_0x4b16f8){return db[_0xfc7d('0x17')][_0xfc7d('0x18')](_0xd26a7b[_0xfc7d('0x19')],{'raw':_0xd26a7b['options']?_0xd26a7b[_0xfc7d('0x1a')][_0xfc7d('0x1b')]===undefined?!![]:![]:!![]})[_0xfc7d('0xc')](function(_0x258132){logger['info'](_0xfc7d('0x16'),_0xd26a7b);logger[_0xfc7d('0x10')]('CreateFaxQueueReport',_0xd26a7b,JSON[_0xfc7d('0x12')](_0x258132));_0x2f5bab(_0x258132);})[_0xfc7d('0x1c')](function(_0x16897d){logger['error'](_0xfc7d('0x16'),_0x16897d['message'],_0xd26a7b);_0x4b16f8(_0x5c008e[_0xfc7d('0x13')](0x1f4,_0x16897d['message']));});});};exports['UpdateFaxQueueReport']=function(_0x5c5aeb){var _0x4a0cdf=this;return new Promise(function(_0x5a788d,_0xd9a7c2){return db[_0xfc7d('0x17')]['update'](_0x5c5aeb[_0xfc7d('0x19')],{'raw':_0x5c5aeb[_0xfc7d('0x1a')]?_0x5c5aeb[_0xfc7d('0x1a')][_0xfc7d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c5aeb[_0xfc7d('0x1a')]?_0x5c5aeb[_0xfc7d('0x1a')]['where']||null:null,'attributes':_0x5c5aeb[_0xfc7d('0x1a')]?_0x5c5aeb['options'][_0xfc7d('0x1d')]||null:null,'limit':_0x5c5aeb['options']?_0x5c5aeb[_0xfc7d('0x1a')][_0xfc7d('0x1e')]||null:null})[_0xfc7d('0xc')](function(_0xbba6cb){logger[_0xfc7d('0xd')](_0xfc7d('0x1f'),_0x5c5aeb);logger[_0xfc7d('0x10')](_0xfc7d('0x1f'),_0x5c5aeb,JSON['stringify'](_0xbba6cb));_0x5a788d(_0xbba6cb);})[_0xfc7d('0x1c')](function(_0x527c36){logger[_0xfc7d('0x13')](_0xfc7d('0x1f'),_0x527c36['message'],_0x5c5aeb);_0xd9a7c2(_0x4a0cdf[_0xfc7d('0x13')](0x1f4,_0x527c36[_0xfc7d('0x15')]));});});}; \ No newline at end of file +var _0x1d92=['UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','CreateFaxQueueReport','create','body','options','raw'];(function(_0x34f4ee,_0x48ceec){var _0x4bd432=function(_0x451f09){while(--_0x451f09){_0x34f4ee['push'](_0x34f4ee['shift']());}};_0x4bd432(++_0x48ceec);}(_0x1d92,0x10e));var _0x21d9=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0x1d92[_0x5c918d];return _0x3c4d98;};'use strict';var _=require(_0x21d9('0x0'));var util=require('util');var moment=require(_0x21d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x21d9('0x2'));var fs=require('fs');var Redis=require(_0x21d9('0x3'));var db=require(_0x21d9('0x4'))['db'];var utils=require(_0x21d9('0x5'));var logger=require(_0x21d9('0x6'))(_0x21d9('0x7'));var config=require(_0x21d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21d9('0x9')][_0x21d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24f028,_0x324eca,_0x486347){return new BPromise(function(_0x517942,_0x422c72){return client[_0x21d9('0xb')](_0x24f028,_0x486347)[_0x21d9('0xc')](function(_0x2b834f){logger[_0x21d9('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x324eca,_0x21d9('0xe'));logger[_0x21d9('0xf')](_0x21d9('0x10'),_0x324eca,'request\x20sent',JSON[_0x21d9('0x11')](_0x2b834f));if(_0x2b834f[_0x21d9('0x12')]){if(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x13')]===0x1f4){logger[_0x21d9('0x12')](_0x21d9('0x14'),_0x324eca,_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);return _0x422c72(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);}logger[_0x21d9('0x12')](_0x21d9('0x14'),_0x324eca,_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);return _0x517942(_0x2b834f[_0x21d9('0x12')][_0x21d9('0x15')]);}else{logger[_0x21d9('0xd')](_0x21d9('0x14'),_0x324eca,_0x21d9('0xe'));_0x517942(_0x2b834f['result']['message']);}})['catch'](function(_0x19522a){logger['error'](_0x21d9('0x14'),_0x324eca,_0x19522a);_0x422c72(_0x19522a);});});}exports[_0x21d9('0x16')]=function(_0x257ba7){var _0x5a39f5=this;return new Promise(function(_0x42bfb8,_0x1cd0d7){return db['FaxQueueReport'][_0x21d9('0x17')](_0x257ba7[_0x21d9('0x18')],{'raw':_0x257ba7['options']?_0x257ba7[_0x21d9('0x19')][_0x21d9('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2cb143){logger[_0x21d9('0xd')]('CreateFaxQueueReport',_0x257ba7);logger['debug'](_0x21d9('0x16'),_0x257ba7,JSON['stringify'](_0x2cb143));_0x42bfb8(_0x2cb143);})['catch'](function(_0x346ffa){logger[_0x21d9('0x12')](_0x21d9('0x16'),_0x346ffa[_0x21d9('0x15')],_0x257ba7);_0x1cd0d7(_0x5a39f5[_0x21d9('0x12')](0x1f4,_0x346ffa[_0x21d9('0x15')]));});});};exports[_0x21d9('0x1b')]=function(_0x3f2963){var _0x361ac7=this;return new Promise(function(_0x3c57e5,_0x12629a){return db[_0x21d9('0x1c')][_0x21d9('0x1d')](_0x3f2963['body'],{'raw':_0x3f2963[_0x21d9('0x19')]?_0x3f2963[_0x21d9('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2963[_0x21d9('0x19')]?_0x3f2963['options'][_0x21d9('0x1e')]||null:null,'attributes':_0x3f2963['options']?_0x3f2963[_0x21d9('0x19')][_0x21d9('0x1f')]||null:null,'limit':_0x3f2963[_0x21d9('0x19')]?_0x3f2963[_0x21d9('0x19')]['limit']||null:null})[_0x21d9('0xc')](function(_0x2defaa){logger[_0x21d9('0xd')](_0x21d9('0x1b'),_0x3f2963);logger[_0x21d9('0xf')](_0x21d9('0x1b'),_0x3f2963,JSON[_0x21d9('0x11')](_0x2defaa));_0x3c57e5(_0x2defaa);})[_0x21d9('0x20')](function(_0x11d133){logger[_0x21d9('0x12')]('UpdateFaxQueueReport',_0x11d133[_0x21d9('0x15')],_0x3f2963);_0x12629a(_0x361ac7[_0x21d9('0x12')](0x1f4,_0x11d133[_0x21d9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ccf1bd6..872b5e9 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 _0x4f00=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','express'];(function(_0x190681,_0x590f58){var _0x4f2ada=function(_0x4556db){while(--_0x4556db){_0x190681['push'](_0x190681['shift']());}};_0x4f2ada(++_0x590f58);}(_0x4f00,0xf9));var _0x04f0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4f00[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x04f0('0x0'));var util=require(_0x04f0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04f0('0x2'));var router=express[_0x04f0('0x3')]();var fs_extra=require(_0x04f0('0x4'));var auth=require(_0x04f0('0x5'));var interaction=require(_0x04f0('0x6'));var config=require(_0x04f0('0x7'));var controller=require('./faxQueueReport.controller');router[_0x04f0('0x8')]('/',auth[_0x04f0('0x9')](),controller[_0x04f0('0xa')]);router[_0x04f0('0x8')](_0x04f0('0xb'),auth[_0x04f0('0x9')](),controller[_0x04f0('0xc')]);router[_0x04f0('0x8')](_0x04f0('0xd'),auth[_0x04f0('0x9')](),controller[_0x04f0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x04f0('0xf')]);router[_0x04f0('0x10')](_0x04f0('0xd'),auth[_0x04f0('0x9')](),controller[_0x04f0('0x11')]);router[_0x04f0('0x12')]('/:id',auth[_0x04f0('0x9')](),controller[_0x04f0('0x13')]);module[_0x04f0('0x14')]=router; \ No newline at end of file +var _0x4683=['update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put'];(function(_0x19f670,_0x36d23f){var _0x3ffd49=function(_0x5d9e05){while(--_0x5d9e05){_0x19f670['push'](_0x19f670['shift']());}};_0x3ffd49(++_0x36d23f);}(_0x4683,0x11f));var _0x3468=function(_0x16d754,_0x3dae14){_0x16d754=_0x16d754-0x0;var _0x3dca6b=_0x4683[_0x16d754];return _0x3dca6b;};'use strict';var multer=require('multer');var util=require(_0x3468('0x0'));var path=require(_0x3468('0x1'));var timeout=require(_0x3468('0x2'));var express=require(_0x3468('0x3'));var router=express[_0x3468('0x4')]();var fs_extra=require(_0x3468('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3468('0x6'));var config=require(_0x3468('0x7'));var controller=require(_0x3468('0x8'));router[_0x3468('0x9')]('/',auth[_0x3468('0xa')](),controller[_0x3468('0xb')]);router[_0x3468('0x9')](_0x3468('0xc'),auth[_0x3468('0xa')](),controller[_0x3468('0xd')]);router['get']('/:id',auth[_0x3468('0xa')](),controller['show']);router[_0x3468('0xe')]('/',auth[_0x3468('0xa')](),controller[_0x3468('0xf')]);router[_0x3468('0x10')]('/:id',auth[_0x3468('0xa')](),controller[_0x3468('0x11')]);router['delete']('/:id',auth[_0x3468('0xa')](),controller[_0x3468('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c4b7f4f..30be79d 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x42ea68,_0xb343ab){var _0x3a7c99=function(_0x4f4f56){while(--_0x4f4f56){_0x42ea68['push'](_0x42ea68['shift']());}};_0x3a7c99(++_0xb343ab);}(_0xf4eb,0xec));var _0xbf4e=function(_0x566de5,_0x2c07d7){_0x566de5=_0x566de5-0x0;var _0xd13fc4=_0xf4eb[_0x566de5];return _0xd13fc4;};'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 +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1cd402,_0x4e9e47){var _0x1ba43c=function(_0x2a124f){while(--_0x2a124f){_0x1cd402['push'](_0x1cd402['shift']());}};_0x1ba43c(++_0x4e9e47);}(_0xf4eb,0xec));var _0xbf4e=function(_0x9f6ba9,_0x1f5e61){_0x9f6ba9=_0x9f6ba9-0x0;var _0x1b2b4c=_0xf4eb[_0x9f6ba9];return _0x1b2b4c;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index dfcd452..92c38ca 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 _0x0092=['length','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','FaxTransferReport','findAll','rows','catch','show','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes'];(function(_0x58d90a,_0x1a2ea6){var _0x3938a9=function(_0x4f324c){while(--_0x4f324c){_0x58d90a['push'](_0x58d90a['shift']());}};_0x3938a9(++_0x1a2ea6);}(_0x0092,0xf4));var _0x2009=function(_0x42bda2,_0x4106ca){_0x42bda2=_0x42bda2-0x0;var _0x625d2d=_0x0092[_0x42bda2];return _0x625d2d;};'use strict';var emlformat=require(_0x2009('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2009('0x1'));var jsonpatch=require(_0x2009('0x2'));var rp=require(_0x2009('0x3'));var moment=require(_0x2009('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2009('0x5'));var path=require(_0x2009('0x6'));var sox=require('sox');var csv=require(_0x2009('0x7'));var ejs=require(_0x2009('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2009('0x9'));var squel=require(_0x2009('0xa'));var crypto=require('crypto');var jsforce=require(_0x2009('0xb'));var deskjs=require(_0x2009('0xc'));var toCsv=require(_0x2009('0x7'));var querystring=require(_0x2009('0xd'));var Papa=require(_0x2009('0xe'));var Redis=require(_0x2009('0xf'));var authService=require(_0x2009('0x10'));var qs=require(_0x2009('0x11'));var as=require(_0x2009('0x12'));var hardwareService=require(_0x2009('0x13'));var logger=require(_0x2009('0x14'))(_0x2009('0x15'));var utils=require(_0x2009('0x16'));var config=require(_0x2009('0x17'));var licenseUtil=require(_0x2009('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca051,_0xfbfa4){_0xfbfa4=_0xfbfa4||0xcc;return function(_0x804eb7){if(_0x804eb7){return _0x5ca051[_0x2009('0x19')](_0xfbfa4);}return _0x5ca051[_0x2009('0x1a')](_0xfbfa4)['end']();};}function respondWithResult(_0x270f13,_0x4464b1){_0x4464b1=_0x4464b1||0xc8;return function(_0x1cdda5){if(_0x1cdda5){return _0x270f13[_0x2009('0x1a')](_0x4464b1)[_0x2009('0x1b')](_0x1cdda5);}};}function respondWithFilteredResult(_0x5896ff,_0x281f84){return function(_0x33fcf8){if(_0x33fcf8){var _0x4a9c65=typeof _0x281f84['offset']===_0x2009('0x1c')&&typeof _0x281f84[_0x2009('0x1d')]===_0x2009('0x1c');var _0x6a6e18=_0x33fcf8[_0x2009('0x1e')];var _0x5de38a=_0x4a9c65?0x0:_0x281f84[_0x2009('0x1f')];var _0x30e266=_0x4a9c65?_0x33fcf8['count']:_0x281f84['offset']+_0x281f84[_0x2009('0x1d')];var _0x30b3fd;if(_0x30e266>=_0x6a6e18){_0x30e266=_0x6a6e18;_0x30b3fd=0xc8;}else{_0x30b3fd=0xce;}_0x5896ff['status'](_0x30b3fd);return _0x5896ff[_0x2009('0x20')](_0x2009('0x21'),_0x5de38a+'-'+_0x30e266+'/'+_0x6a6e18)[_0x2009('0x1b')](_0x33fcf8);}return null;};}function patchUpdates(_0x2a3cbd){return function(_0x5b00d9){try{jsonpatch['apply'](_0x5b00d9,_0x2a3cbd,!![]);}catch(_0x162aaa){return BPromise['reject'](_0x162aaa);}return _0x5b00d9['save']();};}function saveUpdates(_0x1653c3,_0xfd6438){return function(_0x3f6b2a){if(_0x3f6b2a){return _0x3f6b2a[_0x2009('0x22')](_0x1653c3)['then'](function(_0x2241ae){return _0x2241ae;});}return null;};}function removeEntity(_0x4c87ed,_0x5e6a11){return function(_0x1e21ac){if(_0x1e21ac){return _0x1e21ac[_0x2009('0x23')]()[_0x2009('0x24')](function(){_0x4c87ed[_0x2009('0x1a')](0xcc)[_0x2009('0x25')]();});}};}function handleEntityNotFound(_0x5a3b47,_0x280db9){return function(_0xe627c0){if(!_0xe627c0){_0x5a3b47['sendStatus'](0x194);}return _0xe627c0;};}function handleError(_0xdc516c,_0x48b57d){_0x48b57d=_0x48b57d||0x1f4;return function(_0x5bda4a){logger[_0x2009('0x26')](_0x5bda4a[_0x2009('0x27')]);if(_0x5bda4a['name']){delete _0x5bda4a[_0x2009('0x28')];}_0xdc516c[_0x2009('0x1a')](_0x48b57d)[_0x2009('0x29')](_0x5bda4a);};}exports[_0x2009('0x2a')]=function(_0x1e0e3c,_0x42e3a9){var _0x8d2def={},_0x4a3eb5={},_0x33168b={'count':0x0,'rows':[]};var _0x3b2fd1=_['map'](db['FaxTransferReport'][_0x2009('0x2b')],function(_0x385bb0){return{'name':_0x385bb0[_0x2009('0x2c')],'type':_0x385bb0['type']['key']};});_0x4a3eb5[_0x2009('0x2d')]=_[_0x2009('0x2e')](_0x3b2fd1,_0x2009('0x28'));_0x4a3eb5[_0x2009('0x2f')]=_[_0x2009('0x30')](_0x1e0e3c[_0x2009('0x2f')]);_0x4a3eb5['filters']=_['intersection'](_0x4a3eb5[_0x2009('0x2d')],_0x4a3eb5['query']);_0x8d2def['attributes']=_[_0x2009('0x31')](_0x4a3eb5[_0x2009('0x2d')],qs[_0x2009('0x32')](_0x1e0e3c[_0x2009('0x2f')]['fields']));_0x8d2def[_0x2009('0x33')]=_0x8d2def[_0x2009('0x33')][_0x2009('0x34')]?_0x8d2def['attributes']:_0x4a3eb5[_0x2009('0x2d')];if(!_0x1e0e3c[_0x2009('0x2f')][_0x2009('0x35')]('nolimit')){_0x8d2def[_0x2009('0x1d')]=qs[_0x2009('0x1d')](_0x1e0e3c[_0x2009('0x2f')][_0x2009('0x1d')]);_0x8d2def[_0x2009('0x1f')]=qs[_0x2009('0x1f')](_0x1e0e3c['query'][_0x2009('0x1f')]);}_0x8d2def[_0x2009('0x36')]=qs['sort'](_0x1e0e3c['query'][_0x2009('0x37')]);_0x8d2def[_0x2009('0x38')]=qs[_0x2009('0x39')](_['pick'](_0x1e0e3c[_0x2009('0x2f')],_0x4a3eb5['filters']),_0x3b2fd1);if(_0x1e0e3c[_0x2009('0x2f')][_0x2009('0x3a')]){_0x8d2def[_0x2009('0x38')]=_['merge'](_0x8d2def[_0x2009('0x38')],{'$or':_['map'](_0x3b2fd1,function(_0x7bf1b0){if(_0x7bf1b0[_0x2009('0x3b')]!==_0x2009('0x3c')){var _0x5c00ab={};_0x5c00ab[_0x7bf1b0[_0x2009('0x28')]]={'$like':'%'+_0x1e0e3c[_0x2009('0x2f')][_0x2009('0x3a')]+'%'};return _0x5c00ab;}})});}_0x8d2def=_[_0x2009('0x3d')]({},_0x8d2def,_0x1e0e3c[_0x2009('0x3e')]);var _0xbad651={'where':_0x8d2def[_0x2009('0x38')]};return db['FaxTransferReport'][_0x2009('0x1e')](_0xbad651)[_0x2009('0x24')](function(_0x1652d8){_0x33168b['count']=_0x1652d8;if(_0x1e0e3c[_0x2009('0x2f')][_0x2009('0x3f')]){_0x8d2def[_0x2009('0x40')]=[{'all':!![]}];}return db[_0x2009('0x41')][_0x2009('0x42')](_0x8d2def);})[_0x2009('0x24')](function(_0x100e38){_0x33168b[_0x2009('0x43')]=_0x100e38;return _0x33168b;})[_0x2009('0x24')](respondWithFilteredResult(_0x42e3a9,_0x8d2def))[_0x2009('0x44')](handleError(_0x42e3a9,null));};exports[_0x2009('0x45')]=function(_0x1149e1,_0x123044){var _0x396fd9={'raw':!![],'where':{'id':_0x1149e1['params']['id']}},_0x134619={};_0x134619[_0x2009('0x2d')]=_[_0x2009('0x30')](db[_0x2009('0x41')][_0x2009('0x2b')]);_0x134619[_0x2009('0x2f')]=_[_0x2009('0x30')](_0x1149e1[_0x2009('0x2f')]);_0x134619['filters']=_[_0x2009('0x31')](_0x134619[_0x2009('0x2d')],_0x134619[_0x2009('0x2f')]);_0x396fd9['attributes']=_['intersection'](_0x134619[_0x2009('0x2d')],qs[_0x2009('0x32')](_0x1149e1['query']['fields']));_0x396fd9[_0x2009('0x33')]=_0x396fd9[_0x2009('0x33')][_0x2009('0x34')]?_0x396fd9[_0x2009('0x33')]:_0x134619[_0x2009('0x2d')];if(_0x1149e1['query'][_0x2009('0x3f')]){_0x396fd9[_0x2009('0x40')]=[{'all':!![]}];}_0x396fd9=_[_0x2009('0x3d')]({},_0x396fd9,_0x1149e1['options']);return db[_0x2009('0x41')]['find'](_0x396fd9)[_0x2009('0x24')](handleEntityNotFound(_0x123044,null))['then'](respondWithResult(_0x123044,null))[_0x2009('0x44')](handleError(_0x123044,null));};exports[_0x2009('0x46')]=function(_0x35ea99,_0x33b0e6){return db[_0x2009('0x41')][_0x2009('0x46')](_0x35ea99[_0x2009('0x47')],{})[_0x2009('0x24')](respondWithResult(_0x33b0e6,0xc9))[_0x2009('0x44')](handleError(_0x33b0e6,null));};exports[_0x2009('0x22')]=function(_0x3e5bb0,_0x583d0d){if(_0x3e5bb0[_0x2009('0x47')]['id']){delete _0x3e5bb0['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x3e5bb0[_0x2009('0x48')]['id']}})['then'](handleEntityNotFound(_0x583d0d,null))[_0x2009('0x24')](saveUpdates(_0x3e5bb0[_0x2009('0x47')],null))[_0x2009('0x24')](respondWithResult(_0x583d0d,null))[_0x2009('0x44')](handleError(_0x583d0d,null));};exports[_0x2009('0x23')]=function(_0x5b0ebc,_0x535fac){return db['FaxTransferReport']['find']({'where':{'id':_0x5b0ebc[_0x2009('0x48')]['id']}})[_0x2009('0x24')](handleEntityNotFound(_0x535fac,null))['then'](removeEntity(_0x535fac,null))[_0x2009('0x44')](handleError(_0x535fac,null));};exports[_0x2009('0x49')]=function(_0x3838af,_0x55ca2b){return db['FaxTransferReport'][_0x2009('0x49')]()[_0x2009('0x24')](respondWithResult(_0x55ca2b,null))[_0x2009('0x44')](handleError(_0x55ca2b,null));}; \ No newline at end of file +var _0xa5e5=['hasOwnProperty','sort','pick','filter','where','name','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','destroy','then','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xa5e5,0xeb));var _0x5a5e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa5e5[_0x1b349a];return _0x5d1f7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a5e('0x0'));var zipdir=require(_0x5a5e('0x1'));var jsonpatch=require(_0x5a5e('0x2'));var rp=require('request-promise');var moment=require(_0x5a5e('0x3'));var BPromise=require(_0x5a5e('0x4'));var Mustache=require(_0x5a5e('0x5'));var util=require(_0x5a5e('0x6'));var path=require('path');var sox=require(_0x5a5e('0x7'));var csv=require(_0x5a5e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a5e('0x9'));var _=require(_0x5a5e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a5e('0xb'));var deskjs=require(_0x5a5e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a5e('0xd'));var Papa=require(_0x5a5e('0xe'));var Redis=require(_0x5a5e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a5e('0x10'));var logger=require('../../config/logger')(_0x5a5e('0x11'));var utils=require(_0x5a5e('0x12'));var config=require(_0x5a5e('0x13'));var licenseUtil=require(_0x5a5e('0x14'));var db=require(_0x5a5e('0x15'))['db'];function respondWithStatusCode(_0x222445,_0x5440d8){_0x5440d8=_0x5440d8||0xcc;return function(_0x2d2aa9){if(_0x2d2aa9){return _0x222445[_0x5a5e('0x16')](_0x5440d8);}return _0x222445['status'](_0x5440d8)[_0x5a5e('0x17')]();};}function respondWithResult(_0x4ca7a6,_0x5ecfe8){_0x5ecfe8=_0x5ecfe8||0xc8;return function(_0x356c83){if(_0x356c83){return _0x4ca7a6['status'](_0x5ecfe8)['json'](_0x356c83);}};}function respondWithFilteredResult(_0x41517a,_0x155b3b){return function(_0x2bcdf3){if(_0x2bcdf3){var _0x58201a=typeof _0x155b3b[_0x5a5e('0x18')]===_0x5a5e('0x19')&&typeof _0x155b3b[_0x5a5e('0x1a')]==='undefined';var _0x21c62d=_0x2bcdf3[_0x5a5e('0x1b')];var _0x4b3f6d=_0x58201a?0x0:_0x155b3b[_0x5a5e('0x18')];var _0x599f6f=_0x58201a?_0x2bcdf3[_0x5a5e('0x1b')]:_0x155b3b[_0x5a5e('0x18')]+_0x155b3b['limit'];var _0x9cd67f;if(_0x599f6f>=_0x21c62d){_0x599f6f=_0x21c62d;_0x9cd67f=0xc8;}else{_0x9cd67f=0xce;}_0x41517a[_0x5a5e('0x1c')](_0x9cd67f);return _0x41517a['set'](_0x5a5e('0x1d'),_0x4b3f6d+'-'+_0x599f6f+'/'+_0x21c62d)[_0x5a5e('0x1e')](_0x2bcdf3);}return null;};}function patchUpdates(_0x33f895){return function(_0x22e5bf){try{jsonpatch[_0x5a5e('0x1f')](_0x22e5bf,_0x33f895,!![]);}catch(_0xf1e631){return BPromise[_0x5a5e('0x20')](_0xf1e631);}return _0x22e5bf[_0x5a5e('0x21')]();};}function saveUpdates(_0x20c6b1,_0x2fcff4){return function(_0x3558c9){if(_0x3558c9){return _0x3558c9[_0x5a5e('0x22')](_0x20c6b1)['then'](function(_0x1b9e92){return _0x1b9e92;});}return null;};}function removeEntity(_0x554b71,_0x3759fe){return function(_0x42f97d){if(_0x42f97d){return _0x42f97d[_0x5a5e('0x23')]()[_0x5a5e('0x24')](function(){_0x554b71['status'](0xcc)[_0x5a5e('0x17')]();});}};}function handleEntityNotFound(_0x48fa83,_0x58667d){return function(_0x4162d4){if(!_0x4162d4){_0x48fa83[_0x5a5e('0x16')](0x194);}return _0x4162d4;};}function handleError(_0x187e4c,_0x1b5f93){_0x1b5f93=_0x1b5f93||0x1f4;return function(_0x489410){logger['error'](_0x489410[_0x5a5e('0x25')]);if(_0x489410['name']){delete _0x489410['name'];}_0x187e4c['status'](_0x1b5f93)[_0x5a5e('0x26')](_0x489410);};}exports[_0x5a5e('0x27')]=function(_0x1e649c,_0x5a3854){var _0x5004c5={},_0x58e26c={},_0x13e688={'count':0x0,'rows':[]};var _0x449d75=_[_0x5a5e('0x28')](db[_0x5a5e('0x29')][_0x5a5e('0x2a')],function(_0x359d04){return{'name':_0x359d04[_0x5a5e('0x2b')],'type':_0x359d04[_0x5a5e('0x2c')][_0x5a5e('0x2d')]};});_0x58e26c[_0x5a5e('0x2e')]=_[_0x5a5e('0x28')](_0x449d75,'name');_0x58e26c[_0x5a5e('0x2f')]=_[_0x5a5e('0x30')](_0x1e649c['query']);_0x58e26c[_0x5a5e('0x31')]=_[_0x5a5e('0x32')](_0x58e26c['model'],_0x58e26c[_0x5a5e('0x2f')]);_0x5004c5[_0x5a5e('0x33')]=_[_0x5a5e('0x32')](_0x58e26c[_0x5a5e('0x2e')],qs[_0x5a5e('0x34')](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x34')]));_0x5004c5[_0x5a5e('0x33')]=_0x5004c5['attributes']['length']?_0x5004c5[_0x5a5e('0x33')]:_0x58e26c[_0x5a5e('0x2e')];if(!_0x1e649c['query'][_0x5a5e('0x35')]('nolimit')){_0x5004c5[_0x5a5e('0x1a')]=qs[_0x5a5e('0x1a')](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x1a')]);_0x5004c5[_0x5a5e('0x18')]=qs['offset'](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x18')]);}_0x5004c5['order']=qs['sort'](_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x36')]);_0x5004c5['where']=qs['filters'](_[_0x5a5e('0x37')](_0x1e649c['query'],_0x58e26c[_0x5a5e('0x31')]),_0x449d75);if(_0x1e649c['query'][_0x5a5e('0x38')]){_0x5004c5[_0x5a5e('0x39')]=_['merge'](_0x5004c5['where'],{'$or':_[_0x5a5e('0x28')](_0x449d75,function(_0x395a38){if(_0x395a38[_0x5a5e('0x2c')]!=='VIRTUAL'){var _0x340256={};_0x340256[_0x395a38[_0x5a5e('0x3a')]]={'$like':'%'+_0x1e649c['query'][_0x5a5e('0x38')]+'%'};return _0x340256;}})});}_0x5004c5=_['merge']({},_0x5004c5,_0x1e649c[_0x5a5e('0x3b')]);var _0x527773={'where':_0x5004c5[_0x5a5e('0x39')]};return db['FaxTransferReport'][_0x5a5e('0x1b')](_0x527773)[_0x5a5e('0x24')](function(_0x13a2ff){_0x13e688[_0x5a5e('0x1b')]=_0x13a2ff;if(_0x1e649c[_0x5a5e('0x2f')][_0x5a5e('0x3c')]){_0x5004c5[_0x5a5e('0x3d')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5a5e('0x3e')](_0x5004c5);})[_0x5a5e('0x24')](function(_0x3ae94e){_0x13e688[_0x5a5e('0x3f')]=_0x3ae94e;return _0x13e688;})[_0x5a5e('0x24')](respondWithFilteredResult(_0x5a3854,_0x5004c5))[_0x5a5e('0x40')](handleError(_0x5a3854,null));};exports[_0x5a5e('0x41')]=function(_0xd671e4,_0xef6808){var _0x32c2ec={'raw':!![],'where':{'id':_0xd671e4[_0x5a5e('0x42')]['id']}},_0xa95117={};_0xa95117['model']=_['keys'](db[_0x5a5e('0x29')][_0x5a5e('0x2a')]);_0xa95117['query']=_[_0x5a5e('0x30')](_0xd671e4['query']);_0xa95117[_0x5a5e('0x31')]=_[_0x5a5e('0x32')](_0xa95117[_0x5a5e('0x2e')],_0xa95117[_0x5a5e('0x2f')]);_0x32c2ec['attributes']=_['intersection'](_0xa95117[_0x5a5e('0x2e')],qs[_0x5a5e('0x34')](_0xd671e4[_0x5a5e('0x2f')]['fields']));_0x32c2ec[_0x5a5e('0x33')]=_0x32c2ec[_0x5a5e('0x33')]['length']?_0x32c2ec[_0x5a5e('0x33')]:_0xa95117[_0x5a5e('0x2e')];if(_0xd671e4[_0x5a5e('0x2f')][_0x5a5e('0x3c')]){_0x32c2ec[_0x5a5e('0x3d')]=[{'all':!![]}];}_0x32c2ec=_[_0x5a5e('0x43')]({},_0x32c2ec,_0xd671e4[_0x5a5e('0x3b')]);return db['FaxTransferReport']['find'](_0x32c2ec)[_0x5a5e('0x24')](handleEntityNotFound(_0xef6808,null))[_0x5a5e('0x24')](respondWithResult(_0xef6808,null))[_0x5a5e('0x40')](handleError(_0xef6808,null));};exports['create']=function(_0x3507b3,_0x185d04){return db['FaxTransferReport'][_0x5a5e('0x44')](_0x3507b3['body'],{})[_0x5a5e('0x24')](respondWithResult(_0x185d04,0xc9))['catch'](handleError(_0x185d04,null));};exports['update']=function(_0x8f72b,_0x3514bd){if(_0x8f72b[_0x5a5e('0x45')]['id']){delete _0x8f72b[_0x5a5e('0x45')]['id'];}return db[_0x5a5e('0x29')]['find']({'where':{'id':_0x8f72b[_0x5a5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x3514bd,null))[_0x5a5e('0x24')](saveUpdates(_0x8f72b['body'],null))[_0x5a5e('0x24')](respondWithResult(_0x3514bd,null))[_0x5a5e('0x40')](handleError(_0x3514bd,null));};exports[_0x5a5e('0x23')]=function(_0x4db8f7,_0x309479){return db[_0x5a5e('0x29')][_0x5a5e('0x46')]({'where':{'id':_0x4db8f7[_0x5a5e('0x42')]['id']}})[_0x5a5e('0x24')](handleEntityNotFound(_0x309479,null))[_0x5a5e('0x24')](removeEntity(_0x309479,null))[_0x5a5e('0x40')](handleError(_0x309479,null));};exports['describe']=function(_0x4c8f81,_0x42384d){return db[_0x5a5e('0x29')][_0x5a5e('0x47')]()['then'](respondWithResult(_0x42384d,null))[_0x5a5e('0x40')](handleError(_0x42384d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0ae9945..3eafae3 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 _0x0a39=['FaxTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x25e2a5,_0x2d7270){var _0x429243=function(_0x16853){while(--_0x16853){_0x25e2a5['push'](_0x25e2a5['shift']());}};_0x429243(++_0x2d7270);}(_0x0a39,0x144));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x90a3('0x0'));var util=require(_0x90a3('0x1'));var logger=require('../../config/logger')(_0x90a3('0x2'));var moment=require(_0x90a3('0x3'));var BPromise=require(_0x90a3('0x4'));var rp=require(_0x90a3('0x5'));var fs=require('fs');var path=require(_0x90a3('0x6'));var rimraf=require(_0x90a3('0x7'));var config=require(_0x90a3('0x8'));var attributes=require(_0x90a3('0x9'));module[_0x90a3('0xa')]=function(_0x48eff1,_0x56f2a9){return _0x48eff1[_0x90a3('0xb')](_0x90a3('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x90a3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['uniqueid','../../config/logger','api','moment','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xa5fd,0x173));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xda5f('0x0'))(_0xda5f('0x1'));var moment=require(_0xda5f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x3'));var config=require(_0xda5f('0x4'));var attributes=require(_0xda5f('0x5'));module[_0xda5f('0x6')]=function(_0x5eea48,_0x1bca8a){return _0x5eea48['define'](_0xda5f('0x7'),attributes,{'tableName':_0xda5f('0x8'),'paranoid':![],'indexes':[{'name':_0xda5f('0x9'),'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 71a1452..1f1efbe 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 _0xa5b7=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x309c3e,_0x2e3299){var _0x553a3e=function(_0x4d624b){while(--_0x4d624b){_0x309c3e['push'](_0x309c3e['shift']());}};_0x553a3e(++_0x2e3299);}(_0xa5b7,0xb2));var _0x7a5b=function(_0x16ec67,_0x18101e){_0x16ec67=_0x16ec67-0x0;var _0x3f3e18=_0xa5b7[_0x16ec67];return _0x3f3e18;};'use strict';var _=require('lodash');var util=require(_0x7a5b('0x0'));var moment=require(_0x7a5b('0x1'));var BPromise=require(_0x7a5b('0x2'));var rs=require(_0x7a5b('0x3'));var fs=require('fs');var Redis=require(_0x7a5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a5b('0x5'));var logger=require(_0x7a5b('0x6'))(_0x7a5b('0x7'));var config=require(_0x7a5b('0x8'));var jayson=require(_0x7a5b('0x9'));var client=jayson[_0x7a5b('0xa')][_0x7a5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2fc5,_0x142b83,_0x38d9a9){return new BPromise(function(_0x2fd2e1,_0x3ef226){return client[_0x7a5b('0xc')](_0x5d2fc5,_0x38d9a9)[_0x7a5b('0xd')](function(_0x2b715d){logger['info'](_0x7a5b('0xe'),_0x142b83,_0x7a5b('0xf'));logger[_0x7a5b('0x10')](_0x7a5b('0x11'),_0x142b83,_0x7a5b('0xf'),JSON[_0x7a5b('0x12')](_0x2b715d));if(_0x2b715d[_0x7a5b('0x13')]){if(_0x2b715d[_0x7a5b('0x13')][_0x7a5b('0x14')]===0x1f4){logger[_0x7a5b('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x142b83,_0x2b715d[_0x7a5b('0x13')][_0x7a5b('0x15')]);return _0x3ef226(_0x2b715d[_0x7a5b('0x13')]['message']);}logger[_0x7a5b('0x13')](_0x7a5b('0xe'),_0x142b83,_0x2b715d[_0x7a5b('0x13')][_0x7a5b('0x15')]);return _0x2fd2e1(_0x2b715d[_0x7a5b('0x13')][_0x7a5b('0x15')]);}else{logger[_0x7a5b('0x16')](_0x7a5b('0xe'),_0x142b83,_0x7a5b('0xf'));_0x2fd2e1(_0x2b715d[_0x7a5b('0x17')][_0x7a5b('0x15')]);}})[_0x7a5b('0x18')](function(_0x414ec5){logger[_0x7a5b('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x142b83,_0x414ec5);_0x3ef226(_0x414ec5);});});} \ No newline at end of file +var _0xfb34=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x41d748,_0x14b588){var _0x4e22bd=function(_0x81fe3b){while(--_0x81fe3b){_0x41d748['push'](_0x41d748['shift']());}};_0x4e22bd(++_0x14b588);}(_0xfb34,0x1cc));var _0x4fb3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfb34[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x4fb3('0x0'));var util=require(_0x4fb3('0x1'));var moment=require(_0x4fb3('0x2'));var BPromise=require(_0x4fb3('0x3'));var rs=require(_0x4fb3('0x4'));var fs=require('fs');var Redis=require(_0x4fb3('0x5'));var db=require(_0x4fb3('0x6'))['db'];var utils=require(_0x4fb3('0x7'));var logger=require(_0x4fb3('0x8'))('rpc');var config=require(_0x4fb3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4fb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x124f84,_0x1d81e1,_0x1bb2bd){return new BPromise(function(_0x1dd463,_0x1117ea){return client[_0x4fb3('0xb')](_0x124f84,_0x1bb2bd)['then'](function(_0x3df587){logger[_0x4fb3('0xc')](_0x4fb3('0xd'),_0x1d81e1,'request\x20sent');logger[_0x4fb3('0xe')](_0x4fb3('0xf'),_0x1d81e1,_0x4fb3('0x10'),JSON[_0x4fb3('0x11')](_0x3df587));if(_0x3df587[_0x4fb3('0x12')]){if(_0x3df587[_0x4fb3('0x12')]['code']===0x1f4){logger[_0x4fb3('0x12')](_0x4fb3('0xd'),_0x1d81e1,_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);return _0x1117ea(_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);}logger[_0x4fb3('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x1d81e1,_0x3df587[_0x4fb3('0x12')][_0x4fb3('0x13')]);return _0x1dd463(_0x3df587[_0x4fb3('0x12')]['message']);}else{logger[_0x4fb3('0xc')](_0x4fb3('0xd'),_0x1d81e1,_0x4fb3('0x10'));_0x1dd463(_0x3df587[_0x4fb3('0x14')]['message']);}})[_0x4fb3('0x15')](function(_0x48879d){logger[_0x4fb3('0x12')](_0x4fb3('0xd'),_0x1d81e1,_0x48879d);_0x1117ea(_0x48879d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 806ac9b..366c0f8 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 _0x7a58=['describe','create','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5bf2b3,_0x56c90c){var _0x49e16e=function(_0x1fca48){while(--_0x1fca48){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x49e16e(++_0x56c90c);}(_0x7a58,0x1bb));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x87a5('0x0'));var path=require(_0x87a5('0x1'));var timeout=require(_0x87a5('0x2'));var express=require(_0x87a5('0x3'));var router=express[_0x87a5('0x4')]();var fs_extra=require(_0x87a5('0x5'));var auth=require(_0x87a5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x87a5('0x7'));var controller=require(_0x87a5('0x8'));router[_0x87a5('0x9')]('/',auth[_0x87a5('0xa')](),controller[_0x87a5('0xb')]);router[_0x87a5('0x9')](_0x87a5('0xc'),auth[_0x87a5('0xa')](),controller[_0x87a5('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x87a5('0xa')](),controller[_0x87a5('0xe')]);router['put'](_0x87a5('0xf'),auth[_0x87a5('0xa')](),controller[_0x87a5('0x10')]);router[_0x87a5('0x11')](_0x87a5('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x87a5('0x12')]=router; \ No newline at end of file +var _0x93b8=['./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x93b8,0x118));var _0x893b=function(_0x267ad4,_0x1d1b88){_0x267ad4=_0x267ad4-0x0;var _0x2f3a7b=_0x93b8[_0x267ad4];return _0x2f3a7b;};'use strict';var multer=require(_0x893b('0x0'));var util=require(_0x893b('0x1'));var path=require(_0x893b('0x2'));var timeout=require(_0x893b('0x3'));var express=require(_0x893b('0x4'));var router=express[_0x893b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x893b('0x6'));var interaction=require(_0x893b('0x7'));var config=require('../../config/environment');var controller=require(_0x893b('0x8'));router[_0x893b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x893b('0x9')](_0x893b('0xa'),auth[_0x893b('0xb')](),controller[_0x893b('0xc')]);router[_0x893b('0x9')](_0x893b('0xd'),auth[_0x893b('0xb')](),controller['show']);router[_0x893b('0xe')]('/',auth[_0x893b('0xb')](),controller[_0x893b('0xf')]);router['put'](_0x893b('0xd'),auth[_0x893b('0xb')](),controller[_0x893b('0x10')]);router[_0x893b('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 894a1c4..7260d7f 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 _0x49e7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','addConfiguration','put','update'];(function(_0x596d7a,_0x295b29){var _0x2c2416=function(_0x39816e){while(--_0x39816e){_0x596d7a['push'](_0x596d7a['shift']());}};_0x2c2416(++_0x295b29);}(_0x49e7,0xfd));var _0x749e=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0x49e7[_0x289891];return _0x31cf2e;};'use strict';var multer=require('multer');var util=require(_0x749e('0x0'));var path=require(_0x749e('0x1'));var timeout=require(_0x749e('0x2'));var express=require(_0x749e('0x3'));var router=express[_0x749e('0x4')]();var fs_extra=require(_0x749e('0x5'));var auth=require(_0x749e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x749e('0x7'));var controller=require(_0x749e('0x8'));router[_0x749e('0x9')]('/',auth['isAuthenticated'](),controller[_0x749e('0xa')]);router[_0x749e('0x9')](_0x749e('0xb'),auth[_0x749e('0xc')](),controller[_0x749e('0xd')]);router[_0x749e('0x9')](_0x749e('0xe'),auth[_0x749e('0xc')](),controller['getConfigurations']);router['get'](_0x749e('0xf'),auth[_0x749e('0xc')](),controller['getFields']);router[_0x749e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x749e('0xe'),auth['isAuthenticated'](),controller[_0x749e('0x11')]);router[_0x749e('0x12')](_0x749e('0xb'),auth[_0x749e('0xc')](),controller[_0x749e('0x13')]);router['delete'](_0x749e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x749e('0x14')]=router; \ No newline at end of file +var _0x3508=['../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2c8972,_0x1aff63){var _0x5d1e22=function(_0x56428c){while(--_0x56428c){_0x2c8972['push'](_0x2c8972['shift']());}};_0x5d1e22(++_0x1aff63);}(_0x3508,0x1c0));var _0x8350=function(_0x154272,_0x224448){_0x154272=_0x154272-0x0;var _0x28555a=_0x3508[_0x154272];return _0x28555a;};'use strict';var multer=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var path=require(_0x8350('0x2'));var timeout=require(_0x8350('0x3'));var express=require(_0x8350('0x4'));var router=express[_0x8350('0x5')]();var fs_extra=require(_0x8350('0x6'));var auth=require(_0x8350('0x7'));var interaction=require(_0x8350('0x8'));var config=require('../../config/environment');var controller=require(_0x8350('0x9'));router[_0x8350('0xa')]('/',auth[_0x8350('0xb')](),controller['index']);router[_0x8350('0xa')](_0x8350('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8350('0xa')](_0x8350('0xd'),auth[_0x8350('0xb')](),controller['getConfigurations']);router[_0x8350('0xa')](_0x8350('0xe'),auth[_0x8350('0xb')](),controller[_0x8350('0xf')]);router[_0x8350('0x10')]('/',auth[_0x8350('0xb')](),controller[_0x8350('0x11')]);router[_0x8350('0x10')](_0x8350('0xd'),auth[_0x8350('0xb')](),controller[_0x8350('0x12')]);router[_0x8350('0x13')]('/:id',auth[_0x8350('0xb')](),controller[_0x8350('0x14')]);router[_0x8350('0x15')]('/:id',auth[_0x8350('0xb')](),controller[_0x8350('0x16')]);module[_0x8350('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 1d3ac16..e851ec7 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 _0x72a0=['sequelize','exports','STRING','basic','integrationTab','newTab'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x72a0,0x1ec));var _0x072a=function(_0x3a83a6,_0x5decfb){_0x3a83a6=_0x3a83a6-0x0;var _0x99f03a=_0x72a0[_0x3a83a6];return _0x99f03a;};'use strict';var Sequelize=require(_0x072a('0x0'));module[_0x072a('0x1')]={'name':{'type':Sequelize[_0x072a('0x2')]},'description':{'type':Sequelize[_0x072a('0x2')]},'username':{'type':Sequelize[_0x072a('0x2')]},'remoteUri':{'type':Sequelize[_0x072a('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x072a('0x3')),'defaultValue':_0x072a('0x3')},'password':{'type':Sequelize[_0x072a('0x2')]},'consumerKey':{'type':Sequelize[_0x072a('0x2')]},'consumerSecret':{'type':Sequelize[_0x072a('0x2')]},'token':{'type':Sequelize[_0x072a('0x2')]},'tokenSecret':{'type':Sequelize[_0x072a('0x2')]},'serverUrl':{'type':Sequelize[_0x072a('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x072a('0x4'),_0x072a('0x5')),'defaultValue':_0x072a('0x4')}}; \ No newline at end of file +var _0x0687=['integrationTab','sequelize','STRING','basic','ENUM','newTab'];(function(_0x306f18,_0x57eb29){var _0x5d470c=function(_0xef0378){while(--_0xef0378){_0x306f18['push'](_0x306f18['shift']());}};_0x5d470c(++_0x57eb29);}(_0x0687,0xfd));var _0x7068=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0687[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7068('0x0'));module['exports']={'name':{'type':Sequelize[_0x7068('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7068('0x1')]},'remoteUri':{'type':Sequelize[_0x7068('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x7068('0x2')),'defaultValue':_0x7068('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7068('0x1')]},'consumerSecret':{'type':Sequelize[_0x7068('0x1')]},'token':{'type':Sequelize[_0x7068('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7068('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7068('0x3')]('integrationTab',_0x7068('0x4')),'defaultValue':_0x7068('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b762fb0..118da84 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 _0xa272=['json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','DeskConfiguration','sort','options','addConfiguration','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','remoteUri','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa272,0x1ab));var _0x2a27=function(_0x4959ee,_0x1ae3eb){_0x4959ee=_0x4959ee-0x0;var _0x50df3d=_0xa272[_0x4959ee];return _0x50df3d;};'use strict';var emlformat=require(_0x2a27('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a27('0x2'));var moment=require('moment');var BPromise=require(_0x2a27('0x3'));var Mustache=require(_0x2a27('0x4'));var util=require(_0x2a27('0x5'));var path=require(_0x2a27('0x6'));var sox=require(_0x2a27('0x7'));var csv=require(_0x2a27('0x8'));var ejs=require(_0x2a27('0x9'));var fs=require('fs');var fs_extra=require(_0x2a27('0xa'));var _=require(_0x2a27('0xb'));var squel=require(_0x2a27('0xc'));var crypto=require(_0x2a27('0xd'));var jsforce=require(_0x2a27('0xe'));var deskjs=require(_0x2a27('0xf'));var toCsv=require(_0x2a27('0x8'));var querystring=require(_0x2a27('0x10'));var Papa=require(_0x2a27('0x11'));var Redis=require(_0x2a27('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a27('0x13'));var as=require(_0x2a27('0x14'));var hardwareService=require(_0x2a27('0x15'));var logger=require(_0x2a27('0x16'))(_0x2a27('0x17'));var utils=require(_0x2a27('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2a27('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2a27('0x1a'));function respondWithStatusCode(_0x1318cd,_0x57b40e){_0x57b40e=_0x57b40e||0xcc;return function(_0x77d6b0){if(_0x77d6b0){return _0x1318cd[_0x2a27('0x1b')](_0x57b40e);}return _0x1318cd['status'](_0x57b40e)[_0x2a27('0x1c')]();};}function respondWithResult(_0x541d4e,_0x3036fc){_0x3036fc=_0x3036fc||0xc8;return function(_0x59162f){if(_0x59162f){return _0x541d4e['status'](_0x3036fc)[_0x2a27('0x1d')](_0x59162f);}};}function respondWithFilteredResult(_0x33fdda,_0x2075bf){return function(_0x3b907b){if(_0x3b907b){var _0x48faaa=typeof _0x2075bf[_0x2a27('0x1e')]==='undefined'&&typeof _0x2075bf[_0x2a27('0x1f')]===_0x2a27('0x20');var _0x562645=_0x3b907b[_0x2a27('0x21')];var _0x438e99=_0x48faaa?0x0:_0x2075bf[_0x2a27('0x1e')];var _0x5676c9=_0x48faaa?_0x3b907b[_0x2a27('0x21')]:_0x2075bf['offset']+_0x2075bf[_0x2a27('0x1f')];var _0x41b394;if(_0x5676c9>=_0x562645){_0x5676c9=_0x562645;_0x41b394=0xc8;}else{_0x41b394=0xce;}_0x33fdda[_0x2a27('0x22')](_0x41b394);return _0x33fdda['set'](_0x2a27('0x23'),_0x438e99+'-'+_0x5676c9+'/'+_0x562645)[_0x2a27('0x1d')](_0x3b907b);}return null;};}function patchUpdates(_0x10454c){return function(_0x110f5a){try{jsonpatch[_0x2a27('0x24')](_0x110f5a,_0x10454c,!![]);}catch(_0x1fbc53){return BPromise[_0x2a27('0x25')](_0x1fbc53);}return _0x110f5a[_0x2a27('0x26')]();};}function saveUpdates(_0x1ffac1,_0x2d0a6c){return function(_0x236ee4){if(_0x236ee4){return _0x236ee4['update'](_0x1ffac1)[_0x2a27('0x27')](function(_0x486436){return _0x486436;});}return null;};}function removeEntity(_0x16b8b9,_0x3efed9){return function(_0x40100b){if(_0x40100b){return _0x40100b[_0x2a27('0x28')]()[_0x2a27('0x27')](function(){_0x16b8b9[_0x2a27('0x22')](0xcc)[_0x2a27('0x1c')]();});}};}function handleEntityNotFound(_0x3894be,_0x41bc27){return function(_0xbca4df){if(!_0xbca4df){_0x3894be[_0x2a27('0x1b')](0x194);}return _0xbca4df;};}function handleError(_0xece922,_0x30072a){_0x30072a=_0x30072a||0x1f4;return function(_0x3f3b40){logger['error'](_0x3f3b40[_0x2a27('0x29')]);if(_0x3f3b40[_0x2a27('0x2a')]){delete _0x3f3b40[_0x2a27('0x2a')];}_0xece922[_0x2a27('0x22')](_0x30072a)[_0x2a27('0x2b')](_0x3f3b40);};}exports[_0x2a27('0x2c')]=function(_0x359274,_0x8e8e52){var _0x53eab5={},_0x59034f={},_0x599da5={'count':0x0,'rows':[]};var _0x5c88ff=_[_0x2a27('0x2d')](db[_0x2a27('0x2e')][_0x2a27('0x2f')],function(_0x3c2804){return{'name':_0x3c2804['fieldName'],'type':_0x3c2804[_0x2a27('0x30')][_0x2a27('0x31')]};});_0x59034f[_0x2a27('0x32')]=_[_0x2a27('0x2d')](_0x5c88ff,_0x2a27('0x2a'));_0x59034f[_0x2a27('0x33')]=_[_0x2a27('0x34')](_0x359274[_0x2a27('0x33')]);_0x59034f[_0x2a27('0x35')]=_[_0x2a27('0x36')](_0x59034f[_0x2a27('0x32')],_0x59034f['query']);_0x53eab5[_0x2a27('0x37')]=_[_0x2a27('0x36')](_0x59034f[_0x2a27('0x32')],qs[_0x2a27('0x38')](_0x359274[_0x2a27('0x33')][_0x2a27('0x38')]));_0x53eab5[_0x2a27('0x37')]=_0x53eab5[_0x2a27('0x37')][_0x2a27('0x39')]?_0x53eab5[_0x2a27('0x37')]:_0x59034f[_0x2a27('0x32')];if(!_0x359274[_0x2a27('0x33')][_0x2a27('0x3a')](_0x2a27('0x3b'))){_0x53eab5[_0x2a27('0x1f')]=qs['limit'](_0x359274[_0x2a27('0x33')][_0x2a27('0x1f')]);_0x53eab5[_0x2a27('0x1e')]=qs[_0x2a27('0x1e')](_0x359274[_0x2a27('0x33')][_0x2a27('0x1e')]);}_0x53eab5[_0x2a27('0x3c')]=qs['sort'](_0x359274[_0x2a27('0x33')]['sort']);_0x53eab5[_0x2a27('0x3d')]=qs[_0x2a27('0x35')](_[_0x2a27('0x3e')](_0x359274[_0x2a27('0x33')],_0x59034f[_0x2a27('0x35')]),_0x5c88ff);if(_0x359274[_0x2a27('0x33')][_0x2a27('0x3f')]){_0x53eab5[_0x2a27('0x3d')]=_[_0x2a27('0x40')](_0x53eab5[_0x2a27('0x3d')],{'$or':_[_0x2a27('0x2d')](_0x5c88ff,function(_0x5c6b35){if(_0x5c6b35['type']!=='VIRTUAL'){var _0x3b9fed={};_0x3b9fed[_0x5c6b35['name']]={'$like':'%'+_0x359274[_0x2a27('0x33')][_0x2a27('0x3f')]+'%'};return _0x3b9fed;}})});}_0x53eab5=_['merge']({},_0x53eab5,_0x359274['options']);var _0x53d97e={'where':_0x53eab5['where']};return db[_0x2a27('0x2e')][_0x2a27('0x21')](_0x53d97e)[_0x2a27('0x27')](function(_0x576a7e){_0x599da5['count']=_0x576a7e;if(_0x359274[_0x2a27('0x33')][_0x2a27('0x41')]){_0x53eab5[_0x2a27('0x42')]=[{'all':!![]}];}return db[_0x2a27('0x2e')][_0x2a27('0x43')](_0x53eab5);})[_0x2a27('0x27')](function(_0x245a5d){_0x599da5[_0x2a27('0x44')]=_0x245a5d;return _0x599da5;})[_0x2a27('0x27')](respondWithFilteredResult(_0x8e8e52,_0x53eab5))[_0x2a27('0x45')](handleError(_0x8e8e52,null));};exports[_0x2a27('0x46')]=function(_0x392705,_0x2ea843){var _0x3fa5ac={'raw':![],'where':{'id':_0x392705[_0x2a27('0x47')]['id']}},_0x22e5f7={};_0x22e5f7[_0x2a27('0x32')]=_[_0x2a27('0x34')](db[_0x2a27('0x2e')][_0x2a27('0x2f')]);_0x22e5f7['query']=_[_0x2a27('0x34')](_0x392705['query']);_0x22e5f7[_0x2a27('0x35')]=_['intersection'](_0x22e5f7['model'],_0x22e5f7[_0x2a27('0x33')]);_0x3fa5ac[_0x2a27('0x37')]=_['intersection'](_0x22e5f7[_0x2a27('0x32')],qs[_0x2a27('0x38')](_0x392705[_0x2a27('0x33')][_0x2a27('0x38')]));_0x3fa5ac[_0x2a27('0x37')]=_0x3fa5ac['attributes']['length']?_0x3fa5ac[_0x2a27('0x37')]:_0x22e5f7[_0x2a27('0x32')];if(_0x392705[_0x2a27('0x33')]['includeAll']){_0x3fa5ac['include']=[{'all':!![]}];}_0x3fa5ac=_[_0x2a27('0x40')]({},_0x3fa5ac,_0x392705['options']);return db[_0x2a27('0x2e')][_0x2a27('0x48')](_0x3fa5ac)[_0x2a27('0x27')](handleEntityNotFound(_0x2ea843,null))['then'](respondWithResult(_0x2ea843,null))[_0x2a27('0x45')](handleError(_0x2ea843,null));};exports[_0x2a27('0x49')]=function(_0x3ef504,_0x5f0cc6){return db[_0x2a27('0x2e')]['create'](_0x3ef504[_0x2a27('0x4a')],{})[_0x2a27('0x27')](respondWithResult(_0x5f0cc6,0xc9))[_0x2a27('0x45')](handleError(_0x5f0cc6,null));};exports[_0x2a27('0x4b')]=function(_0x2d9d11,_0x21f4cf){if(_0x2d9d11[_0x2a27('0x4a')]['id']){delete _0x2d9d11[_0x2a27('0x4a')]['id'];}return db[_0x2a27('0x2e')][_0x2a27('0x48')]({'where':{'id':_0x2d9d11[_0x2a27('0x47')]['id']}})[_0x2a27('0x27')](handleEntityNotFound(_0x21f4cf,null))[_0x2a27('0x27')](saveUpdates(_0x2d9d11['body'],null))[_0x2a27('0x27')](respondWithResult(_0x21f4cf,null))[_0x2a27('0x45')](handleError(_0x21f4cf,null));};exports[_0x2a27('0x28')]=function(_0x3407f1,_0x5d2ffb){return db['DeskAccount'][_0x2a27('0x48')]({'where':{'id':_0x3407f1['params']['id']}})['then'](handleEntityNotFound(_0x5d2ffb,null))[_0x2a27('0x27')](removeEntity(_0x5d2ffb,null))[_0x2a27('0x45')](handleError(_0x5d2ffb,null));};exports[_0x2a27('0x4c')]=function(_0x57c0b7,_0x366532,_0x413b0e){var _0x8ef33e={};var _0x4aedb1={};var _0x54733e;var _0x558e25;return db[_0x2a27('0x2e')][_0x2a27('0x4d')]({'where':{'id':_0x57c0b7['params']['id']}})[_0x2a27('0x27')](handleEntityNotFound(_0x366532,null))[_0x2a27('0x27')](function(_0x2c6c3b){if(_0x2c6c3b){_0x54733e=_0x2c6c3b;_0x4aedb1[_0x2a27('0x32')]=_[_0x2a27('0x34')](db[_0x2a27('0x4e')][_0x2a27('0x2f')]);_0x4aedb1[_0x2a27('0x33')]=_[_0x2a27('0x34')](_0x57c0b7[_0x2a27('0x33')]);_0x4aedb1['filters']=_[_0x2a27('0x36')](_0x4aedb1['model'],_0x4aedb1[_0x2a27('0x33')]);_0x8ef33e[_0x2a27('0x37')]=_[_0x2a27('0x36')](_0x4aedb1[_0x2a27('0x32')],qs['fields'](_0x57c0b7[_0x2a27('0x33')]['fields']));_0x8ef33e['attributes']=_0x8ef33e[_0x2a27('0x37')][_0x2a27('0x39')]?_0x8ef33e[_0x2a27('0x37')]:_0x4aedb1[_0x2a27('0x32')];_0x8ef33e['order']=qs[_0x2a27('0x4f')](_0x57c0b7['query'][_0x2a27('0x4f')]);_0x8ef33e['where']=qs[_0x2a27('0x35')](_['pick'](_0x57c0b7['query'],_0x4aedb1[_0x2a27('0x35')]));if(_0x57c0b7[_0x2a27('0x33')][_0x2a27('0x3f')]){_0x8ef33e['where']=_[_0x2a27('0x40')](_0x8ef33e[_0x2a27('0x3d')],{'$or':_['map'](_0x8ef33e[_0x2a27('0x37')],function(_0x2458dd){var _0x42a2d7={};_0x42a2d7[_0x2458dd]={'$like':'%'+_0x57c0b7[_0x2a27('0x33')]['filter']+'%'};return _0x42a2d7;})});}_0x8ef33e=_[_0x2a27('0x40')]({},_0x8ef33e,_0x57c0b7[_0x2a27('0x50')]);return _0x54733e[_0x2a27('0x4c')](_0x8ef33e);}})['then'](function(_0x1851b2){if(_0x1851b2){_0x558e25=_0x1851b2[_0x2a27('0x39')];if(!_0x57c0b7[_0x2a27('0x33')]['hasOwnProperty'](_0x2a27('0x3b'))){_0x8ef33e[_0x2a27('0x1f')]=qs['limit'](_0x57c0b7['query'][_0x2a27('0x1f')]);_0x8ef33e[_0x2a27('0x1e')]=qs[_0x2a27('0x1e')](_0x57c0b7[_0x2a27('0x33')][_0x2a27('0x1e')]);}return _0x54733e[_0x2a27('0x4c')](_0x8ef33e);}})['then'](function(_0x1818cf){if(_0x1818cf){return _0x1818cf?{'count':_0x558e25,'rows':_0x1818cf}:null;}})['then'](respondWithResult(_0x366532,null))['catch'](handleError(_0x366532,null));};exports[_0x2a27('0x51')]=function(_0x1d0a7b,_0x4d7776,_0x398675){if(_0x1d0a7b[_0x2a27('0x4a')]['id']){delete _0x1d0a7b[_0x2a27('0x4a')]['id'];}return db[_0x2a27('0x2e')][_0x2a27('0x4d')]({'where':{'id':_0x1d0a7b['params']['id']}})[_0x2a27('0x27')](handleEntityNotFound(_0x4d7776,null))[_0x2a27('0x27')](function(_0x3a1340){if(_0x3a1340){_0x1d0a7b[_0x2a27('0x4a')]['AccountId']=_0x3a1340['id'];_0x1d0a7b[_0x2a27('0x4a')][_0x2a27('0x52')]=integrations['getSubjects'](_0x1d0a7b[_0x2a27('0x4a')][_0x2a27('0x53')],_0x1d0a7b[_0x2a27('0x4a')][_0x2a27('0x30')]);_0x1d0a7b[_0x2a27('0x4a')][_0x2a27('0x54')]=integrations[_0x2a27('0x55')](_0x1d0a7b[_0x2a27('0x4a')]['channel'],_0x1d0a7b[_0x2a27('0x4a')][_0x2a27('0x30')]);return db[_0x2a27('0x4e')]['create'](_0x1d0a7b[_0x2a27('0x4a')],{'include':[{'model':db[_0x2a27('0x56')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x2a27('0x54')}]});}return null;})[_0x2a27('0x27')](respondWithResult(_0x4d7776,null))[_0x2a27('0x45')](handleError(_0x4d7776,null));};exports[_0x2a27('0x57')]=function(_0xbf55e2,_0x581ddb,_0x49ba97){var _0x34babb=[{'name':_0x2a27('0x58'),'label':_0x2a27('0x58'),'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 _0xf76fd='';return db[_0x2a27('0x2e')][_0x2a27('0x4d')]({'where':{'id':_0xbf55e2[_0x2a27('0x47')]['id']},'attributes':['id','remoteUri',_0x2a27('0x59'),_0x2a27('0x5a'),_0x2a27('0x5b'),'consumerKey',_0x2a27('0x5c'),_0x2a27('0x5d'),'tokenSecret']})[_0x2a27('0x27')](handleEntityNotFound(_0x581ddb,null))[_0x2a27('0x27')](function(_0x1c8049){if(_0x1c8049){_0xf76fd=_0x1c8049[_0x2a27('0x5e')];var _0x15f8ca=_0xf76fd[_0x2a27('0x5f')](-0x1);if(_0x15f8ca==='/'){_0xf76fd=_0xf76fd[_0x2a27('0x60')](0x0,_0xf76fd[_0x2a27('0x61')](_0x15f8ca));}var _0x1843a3={'method':'GET','uri':util[_0x2a27('0x62')](_0x2a27('0x63'),_0xf76fd),'headers':{'Content-Type':_0x2a27('0x64'),'Accept':_0x2a27('0x64')},'json':!![]};if(_0x1c8049[_0x2a27('0x59')]===_0x2a27('0x65')){_0x1843a3[_0x2a27('0x66')][_0x2a27('0x67')]=util[_0x2a27('0x62')](_0x2a27('0x68'),new Buffer(util[_0x2a27('0x62')]('%s:%s',_0x1c8049[_0x2a27('0x5a')],_0x1c8049['password']))[_0x2a27('0x69')](_0x2a27('0x6a')));}return rp(_0x1843a3)[_0x2a27('0x27')](function(_0x1fdc96){return _0x34babb[_0x2a27('0x6b')](_[_0x2a27('0x2d')](_0x1fdc96['_embedded'][_0x2a27('0x6c')],function(_0x57c383){return{'id':_0x57c383[_0x2a27('0x2a')],'name':_0x57c383['name'],'type':_0x57c383['type'],'active':_0x57c383['active'],'label':_0x57c383[_0x2a27('0x6d')],'custom':!![]};}));});}})[_0x2a27('0x27')](function(_0x272ec9){return{'count':_0x272ec9[_0x2a27('0x39')],'rows':_0x272ec9};})[_0x2a27('0x27')](respondWithResult(_0x581ddb,null))['catch'](function(_0x47b288){var _0x2e6137=_0xbf55e2['query']['test']?0x1f4:_0x47b288[_0x2a27('0x6e')]||0x1f4;logger['error'](_0x2a27('0x6f'),'getFields',_0x2e6137,JSON[_0x2a27('0x70')](_0x47b288));delete _0x47b288[_0x2a27('0x2a')];if(_0x2e6137===0x191){_0x2e6137=0x190;}_0x581ddb[_0x2a27('0x22')](_0x2e6137)[_0x2a27('0x2b')](_0xbf55e2[_0x2a27('0x33')][_0x2a27('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x47b288[_0x2a27('0x6e')]}:_0x47b288);});}; \ No newline at end of file +var _0x8f8a=['intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','type','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','order','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','tokenSecret','remoteUri','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','active','label','test','statusCode','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','key','model','map','keys','query'];(function(_0x90ff37,_0x1db10c){var _0x3598b7=function(_0x38b536){while(--_0x38b536){_0x90ff37['push'](_0x90ff37['shift']());}};_0x3598b7(++_0x1db10c);}(_0x8f8a,0x11a));var _0xa8f8=function(_0x3d8b4c,_0x4e4a7c){_0x3d8b4c=_0x3d8b4c-0x0;var _0xddaeac=_0x8f8a[_0x3d8b4c];return _0xddaeac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8f8('0x0'));var jsonpatch=require(_0xa8f8('0x1'));var rp=require(_0xa8f8('0x2'));var moment=require('moment');var BPromise=require(_0xa8f8('0x3'));var Mustache=require(_0xa8f8('0x4'));var util=require(_0xa8f8('0x5'));var path=require(_0xa8f8('0x6'));var sox=require(_0xa8f8('0x7'));var csv=require(_0xa8f8('0x8'));var ejs=require(_0xa8f8('0x9'));var fs=require('fs');var fs_extra=require(_0xa8f8('0xa'));var _=require(_0xa8f8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8f8('0xc'));var deskjs=require(_0xa8f8('0xd'));var toCsv=require(_0xa8f8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa8f8('0xe'));var authService=require(_0xa8f8('0xf'));var qs=require(_0xa8f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8f8('0x11'));var logger=require('../../config/logger')(_0xa8f8('0x12'));var utils=require(_0xa8f8('0x13'));var config=require(_0xa8f8('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xc57f2d,_0x54e023){_0x54e023=_0x54e023||0xcc;return function(_0x3d6d9e){if(_0x3d6d9e){return _0xc57f2d[_0xa8f8('0x15')](_0x54e023);}return _0xc57f2d[_0xa8f8('0x16')](_0x54e023)['end']();};}function respondWithResult(_0x3b4510,_0xb4caa4){_0xb4caa4=_0xb4caa4||0xc8;return function(_0x2d3168){if(_0x2d3168){return _0x3b4510[_0xa8f8('0x16')](_0xb4caa4)['json'](_0x2d3168);}};}function respondWithFilteredResult(_0x3a31f2,_0x5c8ad9){return function(_0x34e6f6){if(_0x34e6f6){var _0xfe1040=typeof _0x5c8ad9[_0xa8f8('0x17')]===_0xa8f8('0x18')&&typeof _0x5c8ad9[_0xa8f8('0x19')]==='undefined';var _0x3bd068=_0x34e6f6[_0xa8f8('0x1a')];var _0x459e07=_0xfe1040?0x0:_0x5c8ad9['offset'];var _0xc16158=_0xfe1040?_0x34e6f6[_0xa8f8('0x1a')]:_0x5c8ad9['offset']+_0x5c8ad9[_0xa8f8('0x19')];var _0x58ca7c;if(_0xc16158>=_0x3bd068){_0xc16158=_0x3bd068;_0x58ca7c=0xc8;}else{_0x58ca7c=0xce;}_0x3a31f2[_0xa8f8('0x16')](_0x58ca7c);return _0x3a31f2[_0xa8f8('0x1b')]('Content-Range',_0x459e07+'-'+_0xc16158+'/'+_0x3bd068)[_0xa8f8('0x1c')](_0x34e6f6);}return null;};}function patchUpdates(_0x17e519){return function(_0x25598f){try{jsonpatch[_0xa8f8('0x1d')](_0x25598f,_0x17e519,!![]);}catch(_0x491fcb){return BPromise[_0xa8f8('0x1e')](_0x491fcb);}return _0x25598f['save']();};}function saveUpdates(_0x16aa3,_0x53f3cc){return function(_0x1ce48b){if(_0x1ce48b){return _0x1ce48b[_0xa8f8('0x1f')](_0x16aa3)[_0xa8f8('0x20')](function(_0x3b52d8){return _0x3b52d8;});}return null;};}function removeEntity(_0x682f20,_0xd44b3f){return function(_0x22bf8d){if(_0x22bf8d){return _0x22bf8d[_0xa8f8('0x21')]()[_0xa8f8('0x20')](function(){_0x682f20[_0xa8f8('0x16')](0xcc)[_0xa8f8('0x22')]();});}};}function handleEntityNotFound(_0x3d544b,_0x36b645){return function(_0x383e85){if(!_0x383e85){_0x3d544b['sendStatus'](0x194);}return _0x383e85;};}function handleError(_0xa1f150,_0x55a636){_0x55a636=_0x55a636||0x1f4;return function(_0x2b84e2){logger[_0xa8f8('0x23')](_0x2b84e2[_0xa8f8('0x24')]);if(_0x2b84e2['name']){delete _0x2b84e2[_0xa8f8('0x25')];}_0xa1f150[_0xa8f8('0x16')](_0x55a636)[_0xa8f8('0x26')](_0x2b84e2);};}exports[_0xa8f8('0x27')]=function(_0x2f139b,_0x2c5134){var _0x45cee9={},_0x1560b2={},_0x3a6bcb={'count':0x0,'rows':[]};var _0x157e22=_['map'](db[_0xa8f8('0x28')][_0xa8f8('0x29')],function(_0x155c25){return{'name':_0x155c25[_0xa8f8('0x2a')],'type':_0x155c25['type'][_0xa8f8('0x2b')]};});_0x1560b2[_0xa8f8('0x2c')]=_[_0xa8f8('0x2d')](_0x157e22,_0xa8f8('0x25'));_0x1560b2['query']=_[_0xa8f8('0x2e')](_0x2f139b[_0xa8f8('0x2f')]);_0x1560b2['filters']=_[_0xa8f8('0x30')](_0x1560b2[_0xa8f8('0x2c')],_0x1560b2[_0xa8f8('0x2f')]);_0x45cee9[_0xa8f8('0x31')]=_['intersection'](_0x1560b2[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x32')]));_0x45cee9[_0xa8f8('0x31')]=_0x45cee9[_0xa8f8('0x31')][_0xa8f8('0x33')]?_0x45cee9[_0xa8f8('0x31')]:_0x1560b2['model'];if(!_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x34')]('nolimit')){_0x45cee9[_0xa8f8('0x19')]=qs[_0xa8f8('0x19')](_0x2f139b[_0xa8f8('0x2f')]['limit']);_0x45cee9[_0xa8f8('0x17')]=qs['offset'](_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x17')]);}_0x45cee9['order']=qs[_0xa8f8('0x35')](_0x2f139b[_0xa8f8('0x2f')]['sort']);_0x45cee9[_0xa8f8('0x36')]=qs['filters'](_[_0xa8f8('0x37')](_0x2f139b[_0xa8f8('0x2f')],_0x1560b2[_0xa8f8('0x38')]),_0x157e22);if(_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x39')]){_0x45cee9[_0xa8f8('0x36')]=_[_0xa8f8('0x3a')](_0x45cee9['where'],{'$or':_[_0xa8f8('0x2d')](_0x157e22,function(_0x322647){if(_0x322647[_0xa8f8('0x3b')]!=='VIRTUAL'){var _0x32dc39={};_0x32dc39[_0x322647[_0xa8f8('0x25')]]={'$like':'%'+_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x39')]+'%'};return _0x32dc39;}})});}_0x45cee9=_[_0xa8f8('0x3a')]({},_0x45cee9,_0x2f139b['options']);var _0xbc054c={'where':_0x45cee9['where']};return db[_0xa8f8('0x28')][_0xa8f8('0x1a')](_0xbc054c)[_0xa8f8('0x20')](function(_0x443281){_0x3a6bcb[_0xa8f8('0x1a')]=_0x443281;if(_0x2f139b[_0xa8f8('0x2f')][_0xa8f8('0x3c')]){_0x45cee9[_0xa8f8('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0xa8f8('0x3e')](_0x45cee9);})[_0xa8f8('0x20')](function(_0x1e1f61){_0x3a6bcb[_0xa8f8('0x3f')]=_0x1e1f61;return _0x3a6bcb;})['then'](respondWithFilteredResult(_0x2c5134,_0x45cee9))['catch'](handleError(_0x2c5134,null));};exports[_0xa8f8('0x40')]=function(_0x23a7f5,_0x576e2f){var _0x38ed12={'raw':![],'where':{'id':_0x23a7f5[_0xa8f8('0x41')]['id']}},_0x164ff9={};_0x164ff9[_0xa8f8('0x2c')]=_[_0xa8f8('0x2e')](db['DeskAccount']['rawAttributes']);_0x164ff9[_0xa8f8('0x2f')]=_[_0xa8f8('0x2e')](_0x23a7f5[_0xa8f8('0x2f')]);_0x164ff9[_0xa8f8('0x38')]=_[_0xa8f8('0x30')](_0x164ff9[_0xa8f8('0x2c')],_0x164ff9['query']);_0x38ed12[_0xa8f8('0x31')]=_[_0xa8f8('0x30')](_0x164ff9[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0x23a7f5[_0xa8f8('0x2f')][_0xa8f8('0x32')]));_0x38ed12['attributes']=_0x38ed12[_0xa8f8('0x31')][_0xa8f8('0x33')]?_0x38ed12[_0xa8f8('0x31')]:_0x164ff9[_0xa8f8('0x2c')];if(_0x23a7f5['query'][_0xa8f8('0x3c')]){_0x38ed12['include']=[{'all':!![]}];}_0x38ed12=_['merge']({},_0x38ed12,_0x23a7f5[_0xa8f8('0x42')]);return db['DeskAccount'][_0xa8f8('0x43')](_0x38ed12)['then'](handleEntityNotFound(_0x576e2f,null))[_0xa8f8('0x20')](respondWithResult(_0x576e2f,null))[_0xa8f8('0x44')](handleError(_0x576e2f,null));};exports[_0xa8f8('0x45')]=function(_0x52c2ca,_0x33eaf9){return db[_0xa8f8('0x28')][_0xa8f8('0x45')](_0x52c2ca[_0xa8f8('0x46')],{})[_0xa8f8('0x20')](respondWithResult(_0x33eaf9,0xc9))[_0xa8f8('0x44')](handleError(_0x33eaf9,null));};exports['update']=function(_0x33405c,_0x1aba1c){if(_0x33405c[_0xa8f8('0x46')]['id']){delete _0x33405c['body']['id'];}return db[_0xa8f8('0x28')][_0xa8f8('0x43')]({'where':{'id':_0x33405c['params']['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0x1aba1c,null))[_0xa8f8('0x20')](saveUpdates(_0x33405c[_0xa8f8('0x46')],null))[_0xa8f8('0x20')](respondWithResult(_0x1aba1c,null))[_0xa8f8('0x44')](handleError(_0x1aba1c,null));};exports[_0xa8f8('0x21')]=function(_0x34a3d6,_0x17a25d){return db[_0xa8f8('0x28')][_0xa8f8('0x43')]({'where':{'id':_0x34a3d6[_0xa8f8('0x41')]['id']}})['then'](handleEntityNotFound(_0x17a25d,null))[_0xa8f8('0x20')](removeEntity(_0x17a25d,null))['catch'](handleError(_0x17a25d,null));};exports[_0xa8f8('0x47')]=function(_0xc73754,_0xa47cc4,_0x261717){var _0x3fb36d={};var _0x3dd2f1={};var _0x1f7517;var _0x22bc11;return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0xc73754[_0xa8f8('0x41')]['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0xa47cc4,null))[_0xa8f8('0x20')](function(_0x5dd302){if(_0x5dd302){_0x1f7517=_0x5dd302;_0x3dd2f1[_0xa8f8('0x2c')]=_[_0xa8f8('0x2e')](db[_0xa8f8('0x49')]['rawAttributes']);_0x3dd2f1[_0xa8f8('0x2f')]=_[_0xa8f8('0x2e')](_0xc73754['query']);_0x3dd2f1['filters']=_[_0xa8f8('0x30')](_0x3dd2f1[_0xa8f8('0x2c')],_0x3dd2f1['query']);_0x3fb36d[_0xa8f8('0x31')]=_[_0xa8f8('0x30')](_0x3dd2f1[_0xa8f8('0x2c')],qs[_0xa8f8('0x32')](_0xc73754['query'][_0xa8f8('0x32')]));_0x3fb36d[_0xa8f8('0x31')]=_0x3fb36d[_0xa8f8('0x31')]['length']?_0x3fb36d[_0xa8f8('0x31')]:_0x3dd2f1['model'];_0x3fb36d[_0xa8f8('0x4a')]=qs[_0xa8f8('0x35')](_0xc73754[_0xa8f8('0x2f')]['sort']);_0x3fb36d[_0xa8f8('0x36')]=qs[_0xa8f8('0x38')](_[_0xa8f8('0x37')](_0xc73754[_0xa8f8('0x2f')],_0x3dd2f1['filters']));if(_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x39')]){_0x3fb36d[_0xa8f8('0x36')]=_[_0xa8f8('0x3a')](_0x3fb36d['where'],{'$or':_[_0xa8f8('0x2d')](_0x3fb36d[_0xa8f8('0x31')],function(_0x209861){var _0x286a5c={};_0x286a5c[_0x209861]={'$like':'%'+_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x39')]+'%'};return _0x286a5c;})});}_0x3fb36d=_['merge']({},_0x3fb36d,_0xc73754[_0xa8f8('0x42')]);return _0x1f7517[_0xa8f8('0x47')](_0x3fb36d);}})[_0xa8f8('0x20')](function(_0x525e44){if(_0x525e44){_0x22bc11=_0x525e44['length'];if(!_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x34')](_0xa8f8('0x4b'))){_0x3fb36d[_0xa8f8('0x19')]=qs[_0xa8f8('0x19')](_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x19')]);_0x3fb36d['offset']=qs[_0xa8f8('0x17')](_0xc73754[_0xa8f8('0x2f')][_0xa8f8('0x17')]);}return _0x1f7517[_0xa8f8('0x47')](_0x3fb36d);}})[_0xa8f8('0x20')](function(_0x934978){if(_0x934978){return _0x934978?{'count':_0x22bc11,'rows':_0x934978}:null;}})[_0xa8f8('0x20')](respondWithResult(_0xa47cc4,null))[_0xa8f8('0x44')](handleError(_0xa47cc4,null));};exports[_0xa8f8('0x4c')]=function(_0x26d75e,_0x248f76,_0x20b73f){if(_0x26d75e['body']['id']){delete _0x26d75e[_0xa8f8('0x46')]['id'];}return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0x26d75e[_0xa8f8('0x41')]['id']}})[_0xa8f8('0x20')](handleEntityNotFound(_0x248f76,null))[_0xa8f8('0x20')](function(_0x5741f9){if(_0x5741f9){_0x26d75e[_0xa8f8('0x46')]['AccountId']=_0x5741f9['id'];_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x4d')]=integrations[_0xa8f8('0x4e')](_0x26d75e['body'][_0xa8f8('0x4f')],_0x26d75e[_0xa8f8('0x46')]['type']);_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x50')]=integrations[_0xa8f8('0x51')](_0x26d75e[_0xa8f8('0x46')]['channel'],_0x26d75e[_0xa8f8('0x46')][_0xa8f8('0x3b')]);return db[_0xa8f8('0x49')][_0xa8f8('0x45')](_0x26d75e['body'],{'include':[{'model':db[_0xa8f8('0x52')],'as':_0xa8f8('0x4d')},{'model':db[_0xa8f8('0x52')],'as':_0xa8f8('0x50')}]});}return null;})[_0xa8f8('0x20')](respondWithResult(_0x248f76,null))['catch'](handleError(_0x248f76,null));};exports[_0xa8f8('0x53')]=function(_0x4b54c2,_0x170f57,_0x5280d0){var _0x2d59c2=[{'name':_0xa8f8('0x54'),'label':_0xa8f8('0x54'),'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 _0x33df22='';return db[_0xa8f8('0x28')][_0xa8f8('0x48')]({'where':{'id':_0x4b54c2['params']['id']},'attributes':['id','remoteUri',_0xa8f8('0x55'),_0xa8f8('0x56'),'password','consumerKey','consumerSecret','token',_0xa8f8('0x57')]})['then'](handleEntityNotFound(_0x170f57,null))[_0xa8f8('0x20')](function(_0x34e588){if(_0x34e588){_0x33df22=_0x34e588[_0xa8f8('0x58')];var _0x30b134=_0x33df22['slice'](-0x1);if(_0x30b134==='/'){_0x33df22=_0x33df22[_0xa8f8('0x59')](0x0,_0x33df22['lastIndexOf'](_0x30b134));}var _0x4d36a9={'method':_0xa8f8('0x5a'),'uri':util[_0xa8f8('0x5b')](_0xa8f8('0x5c'),_0x33df22),'headers':{'Content-Type':_0xa8f8('0x5d'),'Accept':_0xa8f8('0x5d')},'json':!![]};if(_0x34e588[_0xa8f8('0x55')]===_0xa8f8('0x5e')){_0x4d36a9[_0xa8f8('0x5f')][_0xa8f8('0x60')]=util[_0xa8f8('0x5b')](_0xa8f8('0x61'),new Buffer(util[_0xa8f8('0x5b')](_0xa8f8('0x62'),_0x34e588[_0xa8f8('0x56')],_0x34e588[_0xa8f8('0x63')]))[_0xa8f8('0x64')](_0xa8f8('0x65')));}return rp(_0x4d36a9)[_0xa8f8('0x20')](function(_0x520c24){return _0x2d59c2[_0xa8f8('0x66')](_[_0xa8f8('0x2d')](_0x520c24[_0xa8f8('0x67')]['entries'],function(_0x26df30){return{'id':_0x26df30['name'],'name':_0x26df30[_0xa8f8('0x25')],'type':_0x26df30['type'],'active':_0x26df30[_0xa8f8('0x68')],'label':_0x26df30[_0xa8f8('0x69')],'custom':!![]};}));});}})[_0xa8f8('0x20')](function(_0x12df9a){return{'count':_0x12df9a['length'],'rows':_0x12df9a};})['then'](respondWithResult(_0x170f57,null))['catch'](function(_0x1717e4){var _0x3c6d19=_0x4b54c2[_0xa8f8('0x2f')][_0xa8f8('0x6a')]?0x1f4:_0x1717e4[_0xa8f8('0x6b')]||0x1f4;logger[_0xa8f8('0x23')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3c6d19,JSON[_0xa8f8('0x6c')](_0x1717e4));delete _0x1717e4[_0xa8f8('0x25')];if(_0x3c6d19===0x191){_0x3c6d19=0x190;}_0x170f57[_0xa8f8('0x16')](_0x3c6d19)[_0xa8f8('0x26')](_0x4b54c2['query'][_0xa8f8('0x6a')]?{'message':_0xa8f8('0x6d'),'statusCode':_0x1717e4[_0xa8f8('0x6b')]}:_0x1717e4);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4d41827..566eb8b 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 _0xaf08=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','int_desk_accounts','lodash'];(function(_0x23991f,_0x3cf4ee){var _0x536c7b=function(_0x1b9249){while(--_0x1b9249){_0x23991f['push'](_0x23991f['shift']());}};_0x536c7b(++_0x3cf4ee);}(_0xaf08,0x17f));var _0x8af0=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0xaf08[_0x58fbb0];return _0x1783d2;};'use strict';var _=require(_0x8af0('0x0'));var util=require(_0x8af0('0x1'));var logger=require(_0x8af0('0x2'))(_0x8af0('0x3'));var moment=require(_0x8af0('0x4'));var BPromise=require(_0x8af0('0x5'));var rp=require(_0x8af0('0x6'));var fs=require('fs');var path=require(_0x8af0('0x7'));var rimraf=require(_0x8af0('0x8'));var config=require(_0x8af0('0x9'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x8af0('0xa'));module['exports']=function(_0x2543bb,_0x3c30ff){return _0x2543bb['define']('DeskAccount',attributes,{'tableName':_0x8af0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f78=['util','api','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts'];(function(_0x53e14b,_0x163e2a){var _0x12dc1d=function(_0x44a785){while(--_0x44a785){_0x53e14b['push'](_0x53e14b['shift']());}};_0x12dc1d(++_0x163e2a);}(_0x1f78,0xbb));var _0x81f7=function(_0x2e0d95,_0x46ddd5){_0x2e0d95=_0x2e0d95-0x0;var _0x180302=_0x1f78[_0x2e0d95];return _0x180302;};'use strict';var _=require('lodash');var util=require(_0x81f7('0x0'));var logger=require('../../config/logger')(_0x81f7('0x1'));var moment=require('moment');var BPromise=require(_0x81f7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f7('0x3'));var rimraf=require(_0x81f7('0x4'));var config=require(_0x81f7('0x5'));var attributes=require(_0x81f7('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x81f7('0x7')]=function(_0x11d1f8,_0x1dac3b){return _0x11d1f8[_0x81f7('0x8')](_0x81f7('0x9'),attributes,{'tableName':_0x81f7('0xa'),'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 fabf511..6637c6b 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 _0x55b4=['message','info','catch','GetDeskAccount','findAll','options','attributes','limit','include','model','map','ShowDeskAccount','DeskAccount','find','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x55b4,0xe2));var _0x455b=function(_0x512a66,_0x44cad8){_0x512a66=_0x512a66-0x0;var _0x19c7c1=_0x55b4[_0x512a66];return _0x19c7c1;};'use strict';var _=require(_0x455b('0x0'));var util=require(_0x455b('0x1'));var moment=require(_0x455b('0x2'));var BPromise=require(_0x455b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x455b('0x4'));var db=require(_0x455b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x455b('0x6'))(_0x455b('0x7'));var config=require(_0x455b('0x8'));var jayson=require(_0x455b('0x9'));var client=jayson[_0x455b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ac11,_0x567b12,_0x40f95a){return new BPromise(function(_0x466790,_0x212bdf){return client[_0x455b('0xb')](_0x56ac11,_0x40f95a)['then'](function(_0x105d02){logger['info'](_0x455b('0xc'),_0x567b12,_0x455b('0xd'));logger[_0x455b('0xe')](_0x455b('0xf'),_0x567b12,_0x455b('0xd'),JSON[_0x455b('0x10')](_0x105d02));if(_0x105d02[_0x455b('0x11')]){if(_0x105d02[_0x455b('0x11')][_0x455b('0x12')]===0x1f4){logger[_0x455b('0x11')](_0x455b('0xc'),_0x567b12,_0x105d02[_0x455b('0x11')][_0x455b('0x13')]);return _0x212bdf(_0x105d02[_0x455b('0x11')]['message']);}logger[_0x455b('0x11')](_0x455b('0xc'),_0x567b12,_0x105d02[_0x455b('0x11')][_0x455b('0x13')]);return _0x466790(_0x105d02[_0x455b('0x11')][_0x455b('0x13')]);}else{logger[_0x455b('0x14')](_0x455b('0xc'),_0x567b12,_0x455b('0xd'));_0x466790(_0x105d02['result'][_0x455b('0x13')]);}})[_0x455b('0x15')](function(_0x48d45a){logger[_0x455b('0x11')](_0x455b('0xc'),_0x567b12,_0x48d45a);_0x212bdf(_0x48d45a);});});}exports[_0x455b('0x16')]=function(_0x563412){var _0x468c87=this;return new Promise(function(_0x458b5a,_0xf3fe90){return db['DeskAccount'][_0x455b('0x17')]({'raw':_0x563412[_0x455b('0x18')]?_0x563412[_0x455b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x563412[_0x455b('0x18')]?_0x563412['options']['where']||null:null,'attributes':_0x563412['options']?_0x563412[_0x455b('0x18')][_0x455b('0x19')]||null:null,'limit':_0x563412[_0x455b('0x18')]?_0x563412[_0x455b('0x18')][_0x455b('0x1a')]||null:null,'include':_0x563412[_0x455b('0x18')]?_0x563412[_0x455b('0x18')][_0x455b('0x1b')]?_['map'](_0x563412[_0x455b('0x18')][_0x455b('0x1b')],function(_0x108b74){return{'model':db[_0x108b74[_0x455b('0x1c')]],'as':_0x108b74['as'],'attributes':_0x108b74[_0x455b('0x19')],'include':_0x108b74['include']?_[_0x455b('0x1d')](_0x108b74[_0x455b('0x1b')],function(_0x5b0fec){return{'model':db[_0x5b0fec['model']],'as':_0x5b0fec['as'],'attributes':_0x5b0fec['attributes'],'include':_0x5b0fec[_0x455b('0x1b')]?_[_0x455b('0x1d')](_0x5b0fec['include'],function(_0x5eb6eb){return{'model':db[_0x5eb6eb[_0x455b('0x1c')]],'as':_0x5eb6eb['as'],'attributes':_0x5eb6eb[_0x455b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x327252){logger[_0x455b('0x14')](_0x455b('0x16'),_0x563412);logger['debug'](_0x455b('0x16'),_0x563412,JSON[_0x455b('0x10')](_0x327252));_0x458b5a(_0x327252);})[_0x455b('0x15')](function(_0x29e066){logger[_0x455b('0x11')]('GetDeskAccount',_0x29e066['message'],_0x563412);_0xf3fe90(_0x468c87[_0x455b('0x11')](0x1f4,_0x29e066[_0x455b('0x13')]));});});};exports[_0x455b('0x1e')]=function(_0x59886f){var _0x8cefdd=this;return new Promise(function(_0x202f5f,_0x2533a6){return db[_0x455b('0x1f')][_0x455b('0x20')]({'raw':_0x59886f[_0x455b('0x18')]?_0x59886f[_0x455b('0x18')][_0x455b('0x21')]===undefined?!![]:![]:!![],'where':_0x59886f[_0x455b('0x18')]?_0x59886f['options']['where']||null:null,'attributes':_0x59886f['options']?_0x59886f[_0x455b('0x18')]['attributes']||null:null,'include':_0x59886f[_0x455b('0x18')]?_0x59886f[_0x455b('0x18')][_0x455b('0x1b')]?_[_0x455b('0x1d')](_0x59886f[_0x455b('0x18')]['include'],function(_0x14bf5a){return{'model':db[_0x14bf5a[_0x455b('0x1c')]],'as':_0x14bf5a['as'],'attributes':_0x14bf5a[_0x455b('0x19')],'include':_0x14bf5a['include']?_[_0x455b('0x1d')](_0x14bf5a[_0x455b('0x1b')],function(_0xb06d4d){return{'model':db[_0xb06d4d['model']],'as':_0xb06d4d['as'],'attributes':_0xb06d4d['attributes'],'include':_0xb06d4d[_0x455b('0x1b')]?_[_0x455b('0x1d')](_0xb06d4d['include'],function(_0x27aa0f){return{'model':db[_0x27aa0f['model']],'as':_0x27aa0f['as'],'attributes':_0x27aa0f[_0x455b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x455b('0x22')](function(_0x107614){logger[_0x455b('0x14')](_0x455b('0x1e'),_0x59886f);logger[_0x455b('0xe')](_0x455b('0x1e'),_0x59886f,JSON['stringify'](_0x107614));_0x202f5f(_0x107614);})[_0x455b('0x15')](function(_0x2f7b9c){logger[_0x455b('0x11')](_0x455b('0x1e'),_0x2f7b9c[_0x455b('0x13')],_0x59886f);_0x2533a6(_0x8cefdd[_0x455b('0x11')](0x1f4,_0x2f7b9c[_0x455b('0x13')]));});});}; \ No newline at end of file +var _0x6fe0=['client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowDeskAccount','find','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4fb972,_0x54287a){var _0x42fae6=function(_0x3aa2ed){while(--_0x3aa2ed){_0x4fb972['push'](_0x4fb972['shift']());}};_0x42fae6(++_0x54287a);}(_0x6fe0,0x1be));var _0x06fe=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0x6fe0[_0x71e493];return _0x3d40ab;};'use strict';var _=require(_0x06fe('0x0'));var util=require(_0x06fe('0x1'));var moment=require(_0x06fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x06fe('0x4'));var logger=require(_0x06fe('0x5'))(_0x06fe('0x6'));var config=require(_0x06fe('0x7'));var jayson=require(_0x06fe('0x8'));var client=jayson[_0x06fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7f36,_0x262dfa,_0x2b3f69){return new BPromise(function(_0x37c599,_0x3dc4cd){return client['request'](_0x3f7f36,_0x2b3f69)[_0x06fe('0xa')](function(_0x3ed740){logger[_0x06fe('0xb')](_0x06fe('0xc'),_0x262dfa,_0x06fe('0xd'));logger[_0x06fe('0xe')](_0x06fe('0xf'),_0x262dfa,_0x06fe('0xd'),JSON[_0x06fe('0x10')](_0x3ed740));if(_0x3ed740[_0x06fe('0x11')]){if(_0x3ed740[_0x06fe('0x11')][_0x06fe('0x12')]===0x1f4){logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);return _0x3dc4cd(_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);}logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3ed740[_0x06fe('0x11')][_0x06fe('0x13')]);return _0x37c599(_0x3ed740[_0x06fe('0x11')]['message']);}else{logger[_0x06fe('0xb')](_0x06fe('0xc'),_0x262dfa,_0x06fe('0xd'));_0x37c599(_0x3ed740[_0x06fe('0x14')][_0x06fe('0x13')]);}})['catch'](function(_0x3474fe){logger[_0x06fe('0x11')](_0x06fe('0xc'),_0x262dfa,_0x3474fe);_0x3dc4cd(_0x3474fe);});});}exports[_0x06fe('0x15')]=function(_0x511f6b){var _0xfe034b=this;return new Promise(function(_0x7892c1,_0x4988c7){return db[_0x06fe('0x16')][_0x06fe('0x17')]({'raw':_0x511f6b[_0x06fe('0x18')]?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x19')]===undefined?!![]:![]:!![],'where':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1a')]||null:null,'attributes':_0x511f6b[_0x06fe('0x18')]?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1b')]||null:null,'limit':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1c')]||null:null,'include':_0x511f6b['options']?_0x511f6b[_0x06fe('0x18')]['include']?_[_0x06fe('0x1d')](_0x511f6b[_0x06fe('0x18')][_0x06fe('0x1e')],function(_0x507440){return{'model':db[_0x507440[_0x06fe('0x1f')]],'as':_0x507440['as'],'attributes':_0x507440[_0x06fe('0x1b')],'include':_0x507440[_0x06fe('0x1e')]?_['map'](_0x507440[_0x06fe('0x1e')],function(_0xd1cd46){return{'model':db[_0xd1cd46[_0x06fe('0x1f')]],'as':_0xd1cd46['as'],'attributes':_0xd1cd46['attributes'],'include':_0xd1cd46[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0xd1cd46['include'],function(_0x1fa7e8){return{'model':db[_0x1fa7e8[_0x06fe('0x1f')]],'as':_0x1fa7e8['as'],'attributes':_0x1fa7e8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x489c34){logger[_0x06fe('0xb')]('GetDeskAccount',_0x511f6b);logger['debug'](_0x06fe('0x15'),_0x511f6b,JSON['stringify'](_0x489c34));_0x7892c1(_0x489c34);})[_0x06fe('0x20')](function(_0x30c758){logger[_0x06fe('0x11')](_0x06fe('0x15'),_0x30c758[_0x06fe('0x13')],_0x511f6b);_0x4988c7(_0xfe034b['error'](0x1f4,_0x30c758[_0x06fe('0x13')]));});});};exports[_0x06fe('0x21')]=function(_0x236a6d){var _0x55136a=this;return new Promise(function(_0x3031ca,_0x3d5f00){return db[_0x06fe('0x16')][_0x06fe('0x22')]({'raw':_0x236a6d['options']?_0x236a6d[_0x06fe('0x18')][_0x06fe('0x19')]===undefined?!![]:![]:!![],'where':_0x236a6d[_0x06fe('0x18')]?_0x236a6d[_0x06fe('0x18')]['where']||null:null,'attributes':_0x236a6d['options']?_0x236a6d['options'][_0x06fe('0x1b')]||null:null,'include':_0x236a6d[_0x06fe('0x18')]?_0x236a6d[_0x06fe('0x18')][_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x236a6d[_0x06fe('0x18')][_0x06fe('0x1e')],function(_0x59e548){return{'model':db[_0x59e548[_0x06fe('0x1f')]],'as':_0x59e548['as'],'attributes':_0x59e548[_0x06fe('0x1b')],'include':_0x59e548[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x59e548[_0x06fe('0x1e')],function(_0x5bc978){return{'model':db[_0x5bc978[_0x06fe('0x1f')]],'as':_0x5bc978['as'],'attributes':_0x5bc978[_0x06fe('0x1b')],'include':_0x5bc978[_0x06fe('0x1e')]?_[_0x06fe('0x1d')](_0x5bc978[_0x06fe('0x1e')],function(_0x240fe5){return{'model':db[_0x240fe5[_0x06fe('0x1f')]],'as':_0x240fe5['as'],'attributes':_0x240fe5[_0x06fe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x06fe('0xa')](function(_0xff8115){logger['info'](_0x06fe('0x21'),_0x236a6d);logger[_0x06fe('0xe')](_0x06fe('0x21'),_0x236a6d,JSON[_0x06fe('0x10')](_0xff8115));_0x3031ca(_0xff8115);})['catch'](function(_0x39ded6){logger[_0x06fe('0x11')](_0x06fe('0x21'),_0x39ded6[_0x06fe('0x13')],_0x236a6d);_0x3d5f00(_0x55136a[_0x06fe('0x11')](0x1f4,_0x39ded6[_0x06fe('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 658e12c..bb2acdc 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x47e37b,_0x12c520){var _0x5007e2=function(_0x133151){while(--_0x133151){_0x47e37b['push'](_0x47e37b['shift']());}};_0x5007e2(++_0x12c520);}(_0x3e74,0x175));var _0x43e7=function(_0x5d6319,_0x4cd3c6){_0x5d6319=_0x5d6319-0x0;var _0x590722=_0x3e74[_0x5d6319];return _0x590722;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4e9a14,_0x20b63a){var _0x2b7f53=function(_0x225b38){while(--_0x225b38){_0x4e9a14['push'](_0x4e9a14['shift']());}};_0x2b7f53(++_0x20b63a);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index dcb6244..1301243 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 _0xd87b=['exports','STRING','sequelize'];(function(_0x5dfae9,_0x277056){var _0xd68145=function(_0x1e7940){while(--_0x1e7940){_0x5dfae9['push'](_0x5dfae9['shift']());}};_0xd68145(++_0x277056);}(_0xd87b,0x131));var _0xbd87=function(_0x49d502,_0x261431){_0x49d502=_0x49d502-0x0;var _0x562699=_0xd87b[_0x49d502];return _0x562699;};'use strict';var Sequelize=require(_0xbd87('0x0'));module[_0xbd87('0x1')]={'name':{'type':Sequelize[_0xbd87('0x2')]},'description':{'type':Sequelize[_0xbd87('0x2')]}}; \ No newline at end of file +var _0xb42a=['sequelize','exports','STRING'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xb42a,0x183));var _0xab42=function(_0x4306ae,_0x5e21f6){_0x4306ae=_0x4306ae-0x0;var _0x297d39=_0xb42a[_0x4306ae];return _0x297d39;};'use strict';var Sequelize=require(_0xab42('0x0'));module[_0xab42('0x1')]={'name':{'type':Sequelize[_0xab42('0x2')]},'description':{'type':Sequelize[_0xab42('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 19d0292..5b22b1d 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 _0x5051=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','limit','set','Content-Range','json','reject','update','then','destroy','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','params','length','find','catch','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf'];(function(_0x1ab72b,_0x14deca){var _0x1d9a04=function(_0x394302){while(--_0x394302){_0x1ab72b['push'](_0x1ab72b['shift']());}};_0x1d9a04(++_0x14deca);}(_0x5051,0x100));var _0x1505=function(_0x4a2fe4,_0x4d307a){_0x4a2fe4=_0x4a2fe4-0x0;var _0x5b5093=_0x5051[_0x4a2fe4];return _0x5b5093;};'use strict';var emlformat=require(_0x1505('0x0'));var rimraf=require(_0x1505('0x1'));var zipdir=require(_0x1505('0x2'));var jsonpatch=require(_0x1505('0x3'));var rp=require(_0x1505('0x4'));var moment=require(_0x1505('0x5'));var BPromise=require(_0x1505('0x6'));var Mustache=require(_0x1505('0x7'));var util=require(_0x1505('0x8'));var path=require(_0x1505('0x9'));var sox=require(_0x1505('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1505('0xb'));var _=require(_0x1505('0xc'));var squel=require(_0x1505('0xd'));var crypto=require(_0x1505('0xe'));var jsforce=require(_0x1505('0xf'));var deskjs=require(_0x1505('0x10'));var toCsv=require(_0x1505('0x11'));var querystring=require('querystring');var Papa=require(_0x1505('0x12'));var Redis=require(_0x1505('0x13'));var authService=require(_0x1505('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1505('0x15'));var hardwareService=require(_0x1505('0x16'));var logger=require(_0x1505('0x17'))(_0x1505('0x18'));var utils=require('../../config/utils');var config=require(_0x1505('0x19'));var licenseUtil=require(_0x1505('0x1a'));var db=require(_0x1505('0x1b'))['db'];function respondWithStatusCode(_0x2452d9,_0x527559){_0x527559=_0x527559||0xcc;return function(_0x27ac68){if(_0x27ac68){return _0x2452d9[_0x1505('0x1c')](_0x527559);}return _0x2452d9[_0x1505('0x1d')](_0x527559)[_0x1505('0x1e')]();};}function respondWithResult(_0x264fa2,_0x214fcb){_0x214fcb=_0x214fcb||0xc8;return function(_0x28da40){if(_0x28da40){return _0x264fa2[_0x1505('0x1d')](_0x214fcb)['json'](_0x28da40);}};}function respondWithFilteredResult(_0x5d54b2,_0x5058b3){return function(_0x1bf710){if(_0x1bf710){var _0x418e30=typeof _0x5058b3['offset']===_0x1505('0x1f')&&typeof _0x5058b3['limit']===_0x1505('0x1f');var _0x41fe5c=_0x1bf710['count'];var _0x4d2e8e=_0x418e30?0x0:_0x5058b3[_0x1505('0x20')];var _0x1e97fc=_0x418e30?_0x1bf710['count']:_0x5058b3[_0x1505('0x20')]+_0x5058b3[_0x1505('0x21')];var _0x2f4976;if(_0x1e97fc>=_0x41fe5c){_0x1e97fc=_0x41fe5c;_0x2f4976=0xc8;}else{_0x2f4976=0xce;}_0x5d54b2[_0x1505('0x1d')](_0x2f4976);return _0x5d54b2[_0x1505('0x22')](_0x1505('0x23'),_0x4d2e8e+'-'+_0x1e97fc+'/'+_0x41fe5c)[_0x1505('0x24')](_0x1bf710);}return null;};}function patchUpdates(_0x75fc35){return function(_0x1cd47a){try{jsonpatch['apply'](_0x1cd47a,_0x75fc35,!![]);}catch(_0x519db3){return BPromise[_0x1505('0x25')](_0x519db3);}return _0x1cd47a['save']();};}function saveUpdates(_0x587f3c,_0x4db2d6){return function(_0x4add79){if(_0x4add79){return _0x4add79[_0x1505('0x26')](_0x587f3c)[_0x1505('0x27')](function(_0x5f33fa){return _0x5f33fa;});}return null;};}function removeEntity(_0x2294aa,_0xb22244){return function(_0x28f9fa){if(_0x28f9fa){return _0x28f9fa[_0x1505('0x28')]()[_0x1505('0x27')](function(){_0x2294aa[_0x1505('0x1d')](0xcc)[_0x1505('0x1e')]();});}};}function handleEntityNotFound(_0x2e8896,_0x33638c){return function(_0x1b8170){if(!_0x1b8170){_0x2e8896[_0x1505('0x1c')](0x194);}return _0x1b8170;};}function handleError(_0x1f4f9b,_0x403bf6){_0x403bf6=_0x403bf6||0x1f4;return function(_0x2e8f1f){logger[_0x1505('0x29')](_0x2e8f1f['stack']);if(_0x2e8f1f[_0x1505('0x2a')]){delete _0x2e8f1f[_0x1505('0x2a')];}_0x1f4f9b['status'](_0x403bf6)[_0x1505('0x2b')](_0x2e8f1f);};}exports[_0x1505('0x2c')]=function(_0x49b3b7,_0x334bb5){var _0x3a3ce9={},_0x27484a={},_0x37dcd4={'count':0x0,'rows':[]};var _0x2e1128=_[_0x1505('0x2d')](db[_0x1505('0x2e')][_0x1505('0x2f')],function(_0x150702){return{'name':_0x150702[_0x1505('0x30')],'type':_0x150702[_0x1505('0x31')][_0x1505('0x32')]};});_0x27484a[_0x1505('0x33')]=_['map'](_0x2e1128,_0x1505('0x2a'));_0x27484a[_0x1505('0x34')]=_[_0x1505('0x35')](_0x49b3b7['query']);_0x27484a[_0x1505('0x36')]=_[_0x1505('0x37')](_0x27484a[_0x1505('0x33')],_0x27484a[_0x1505('0x34')]);_0x3a3ce9[_0x1505('0x38')]=_[_0x1505('0x37')](_0x27484a['model'],qs[_0x1505('0x39')](_0x49b3b7[_0x1505('0x34')][_0x1505('0x39')]));_0x3a3ce9[_0x1505('0x38')]=_0x3a3ce9[_0x1505('0x38')]['length']?_0x3a3ce9['attributes']:_0x27484a['model'];if(!_0x49b3b7[_0x1505('0x34')]['hasOwnProperty'](_0x1505('0x3a'))){_0x3a3ce9[_0x1505('0x21')]=qs[_0x1505('0x21')](_0x49b3b7['query'][_0x1505('0x21')]);_0x3a3ce9[_0x1505('0x20')]=qs[_0x1505('0x20')](_0x49b3b7['query'][_0x1505('0x20')]);}_0x3a3ce9[_0x1505('0x3b')]=qs[_0x1505('0x3c')](_0x49b3b7[_0x1505('0x34')]['sort']);_0x3a3ce9[_0x1505('0x3d')]=qs[_0x1505('0x36')](_[_0x1505('0x3e')](_0x49b3b7['query'],_0x27484a['filters']),_0x2e1128);if(_0x49b3b7[_0x1505('0x34')][_0x1505('0x3f')]){_0x3a3ce9[_0x1505('0x3d')]=_['merge'](_0x3a3ce9[_0x1505('0x3d')],{'$or':_['map'](_0x2e1128,function(_0x36c20e){if(_0x36c20e[_0x1505('0x31')]!==_0x1505('0x40')){var _0xeee3fe={};_0xeee3fe[_0x36c20e[_0x1505('0x2a')]]={'$like':'%'+_0x49b3b7[_0x1505('0x34')]['filter']+'%'};return _0xeee3fe;}})});}_0x3a3ce9=_[_0x1505('0x41')]({},_0x3a3ce9,_0x49b3b7[_0x1505('0x42')]);var _0x310e2d={'where':_0x3a3ce9[_0x1505('0x3d')]};return db[_0x1505('0x2e')]['count'](_0x310e2d)[_0x1505('0x27')](function(_0x3ac039){_0x37dcd4['count']=_0x3ac039;if(_0x49b3b7[_0x1505('0x34')][_0x1505('0x43')]){_0x3a3ce9[_0x1505('0x44')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x3a3ce9);})['then'](function(_0x51dd39){_0x37dcd4['rows']=_0x51dd39;return _0x37dcd4;})[_0x1505('0x27')](respondWithFilteredResult(_0x334bb5,_0x3a3ce9))['catch'](handleError(_0x334bb5,null));};exports[_0x1505('0x45')]=function(_0x18ccda,_0x28cae4){var _0x57dcc0={'raw':![],'where':{'id':_0x18ccda[_0x1505('0x46')]['id']}},_0x264bb0={};_0x264bb0[_0x1505('0x33')]=_['keys'](db[_0x1505('0x2e')][_0x1505('0x2f')]);_0x264bb0['query']=_[_0x1505('0x35')](_0x18ccda[_0x1505('0x34')]);_0x264bb0[_0x1505('0x36')]=_[_0x1505('0x37')](_0x264bb0[_0x1505('0x33')],_0x264bb0[_0x1505('0x34')]);_0x57dcc0['attributes']=_[_0x1505('0x37')](_0x264bb0['model'],qs[_0x1505('0x39')](_0x18ccda[_0x1505('0x34')][_0x1505('0x39')]));_0x57dcc0[_0x1505('0x38')]=_0x57dcc0['attributes'][_0x1505('0x47')]?_0x57dcc0['attributes']:_0x264bb0['model'];if(_0x18ccda['query'][_0x1505('0x43')]){_0x57dcc0[_0x1505('0x44')]=[{'all':!![]}];}_0x57dcc0=_[_0x1505('0x41')]({},_0x57dcc0,_0x18ccda[_0x1505('0x42')]);return db[_0x1505('0x2e')][_0x1505('0x48')](_0x57dcc0)[_0x1505('0x27')](handleEntityNotFound(_0x28cae4,null))[_0x1505('0x27')](respondWithResult(_0x28cae4,null))[_0x1505('0x49')](handleError(_0x28cae4,null));};exports[_0x1505('0x4a')]=function(_0x24535e,_0x1a5ed9){return db[_0x1505('0x2e')][_0x1505('0x4a')](_0x24535e[_0x1505('0x4b')],{})[_0x1505('0x27')](respondWithResult(_0x1a5ed9,0xc9))[_0x1505('0x49')](handleError(_0x1a5ed9,null));};exports[_0x1505('0x26')]=function(_0x3e63c0,_0xd12a83){if(_0x3e63c0[_0x1505('0x4b')]['id']){delete _0x3e63c0[_0x1505('0x4b')]['id'];}return db[_0x1505('0x2e')][_0x1505('0x48')]({'where':{'id':_0x3e63c0['params']['id']}})[_0x1505('0x27')](handleEntityNotFound(_0xd12a83,null))['then'](saveUpdates(_0x3e63c0[_0x1505('0x4b')],null))[_0x1505('0x27')](respondWithResult(_0xd12a83,null))[_0x1505('0x49')](handleError(_0xd12a83,null));};exports['destroy']=function(_0x57a1ee,_0xcc3d68){return db[_0x1505('0x2e')][_0x1505('0x48')]({'where':{'id':_0x57a1ee[_0x1505('0x46')]['id']}})['then'](handleEntityNotFound(_0xcc3d68,null))[_0x1505('0x27')](removeEntity(_0xcc3d68,null))['catch'](handleError(_0xcc3d68,null));};exports[_0x1505('0x4c')]=function(_0x39700f,_0x4bdf80,_0x184624){var _0x42fa8e={};var _0x18acbb={};var _0x54399a;var _0x5970d0;return db['DeskConfiguration'][_0x1505('0x4d')]({'where':{'id':_0x39700f[_0x1505('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bdf80,null))[_0x1505('0x27')](function(_0x393553){if(_0x393553){_0x54399a=_0x393553;_0x18acbb['model']=_['keys'](db[_0x1505('0x4e')][_0x1505('0x2f')]);_0x18acbb[_0x1505('0x34')]=_[_0x1505('0x35')](_0x39700f[_0x1505('0x34')]);_0x18acbb[_0x1505('0x36')]=_[_0x1505('0x37')](_0x18acbb[_0x1505('0x33')],_0x18acbb[_0x1505('0x34')]);_0x42fa8e[_0x1505('0x38')]=_[_0x1505('0x37')](_0x18acbb[_0x1505('0x33')],qs['fields'](_0x39700f['query']['fields']));_0x42fa8e[_0x1505('0x38')]=_0x42fa8e['attributes']['length']?_0x42fa8e['attributes']:_0x18acbb[_0x1505('0x33')];_0x42fa8e[_0x1505('0x3b')]=qs[_0x1505('0x3c')](_0x39700f[_0x1505('0x34')]['sort']);_0x42fa8e['where']=qs[_0x1505('0x36')](_[_0x1505('0x3e')](_0x39700f[_0x1505('0x34')],_0x18acbb[_0x1505('0x36')]));if(_0x39700f[_0x1505('0x34')][_0x1505('0x3f')]){_0x42fa8e['where']=_['merge'](_0x42fa8e[_0x1505('0x3d')],{'$or':_[_0x1505('0x2d')](_0x42fa8e['attributes'],function(_0x5ddd5a){var _0x30a01a={};_0x30a01a[_0x5ddd5a]={'$like':'%'+_0x39700f[_0x1505('0x34')]['filter']+'%'};return _0x30a01a;})});}_0x42fa8e=_['merge']({},_0x42fa8e,_0x39700f[_0x1505('0x42')]);return _0x54399a[_0x1505('0x4c')](_0x42fa8e);}})[_0x1505('0x27')](function(_0x30135b){if(_0x30135b){_0x5970d0=_0x30135b[_0x1505('0x47')];if(!_0x39700f[_0x1505('0x34')][_0x1505('0x4f')]('nolimit')){_0x42fa8e[_0x1505('0x21')]=qs[_0x1505('0x21')](_0x39700f[_0x1505('0x34')][_0x1505('0x21')]);_0x42fa8e['offset']=qs['offset'](_0x39700f['query'][_0x1505('0x20')]);}return _0x54399a[_0x1505('0x4c')](_0x42fa8e);}})[_0x1505('0x27')](function(_0x22d0e0){if(_0x22d0e0){return _0x22d0e0?{'count':_0x5970d0,'rows':_0x22d0e0}:null;}})[_0x1505('0x27')](respondWithResult(_0x4bdf80,null))['catch'](handleError(_0x4bdf80,null));};exports['getSubjects']=function(_0x1c5f2c,_0x2683a4,_0x5dc757){var _0x4a632a={};var _0x37f991={};var _0x2a3d57;var _0x21e464;return db[_0x1505('0x2e')][_0x1505('0x4d')]({'where':{'id':_0x1c5f2c[_0x1505('0x46')]['id']}})['then'](handleEntityNotFound(_0x2683a4,null))[_0x1505('0x27')](function(_0x3eb371){if(_0x3eb371){_0x2a3d57=_0x3eb371;_0x37f991[_0x1505('0x33')]=_[_0x1505('0x35')](db[_0x1505('0x4e')][_0x1505('0x2f')]);_0x37f991[_0x1505('0x34')]=_[_0x1505('0x35')](_0x1c5f2c[_0x1505('0x34')]);_0x37f991[_0x1505('0x36')]=_[_0x1505('0x37')](_0x37f991[_0x1505('0x33')],_0x37f991[_0x1505('0x34')]);_0x4a632a['attributes']=_[_0x1505('0x37')](_0x37f991[_0x1505('0x33')],qs[_0x1505('0x39')](_0x1c5f2c['query'][_0x1505('0x39')]));_0x4a632a[_0x1505('0x38')]=_0x4a632a[_0x1505('0x38')][_0x1505('0x47')]?_0x4a632a[_0x1505('0x38')]:_0x37f991[_0x1505('0x33')];_0x4a632a['order']=qs[_0x1505('0x3c')](_0x1c5f2c[_0x1505('0x34')][_0x1505('0x3c')]);_0x4a632a[_0x1505('0x3d')]=qs[_0x1505('0x36')](_[_0x1505('0x3e')](_0x1c5f2c[_0x1505('0x34')],_0x37f991['filters']));if(_0x1c5f2c[_0x1505('0x34')][_0x1505('0x3f')]){_0x4a632a[_0x1505('0x3d')]=_[_0x1505('0x41')](_0x4a632a[_0x1505('0x3d')],{'$or':_[_0x1505('0x2d')](_0x4a632a['attributes'],function(_0x3a4648){var _0x90ac8c={};_0x90ac8c[_0x3a4648]={'$like':'%'+_0x1c5f2c['query'][_0x1505('0x3f')]+'%'};return _0x90ac8c;})});}_0x4a632a=_[_0x1505('0x41')]({},_0x4a632a,_0x1c5f2c[_0x1505('0x42')]);return _0x2a3d57[_0x1505('0x50')](_0x4a632a);}})[_0x1505('0x27')](function(_0x48662e){if(_0x48662e){_0x21e464=_0x48662e[_0x1505('0x47')];if(!_0x1c5f2c[_0x1505('0x34')][_0x1505('0x4f')](_0x1505('0x3a'))){_0x4a632a[_0x1505('0x21')]=qs[_0x1505('0x21')](_0x1c5f2c[_0x1505('0x34')][_0x1505('0x21')]);_0x4a632a[_0x1505('0x20')]=qs[_0x1505('0x20')](_0x1c5f2c[_0x1505('0x34')][_0x1505('0x20')]);}return _0x2a3d57[_0x1505('0x50')](_0x4a632a);}})[_0x1505('0x27')](function(_0xb4868e){if(_0xb4868e){return _0xb4868e?{'count':_0x21e464,'rows':_0xb4868e}:null;}})['then'](respondWithResult(_0x2683a4,null))[_0x1505('0x49')](handleError(_0x2683a4,null));};exports['getDescriptions']=function(_0xb7c26,_0x5a622e,_0x5eaf99){var _0x405f86={};var _0x5bbca8={};var _0x5ace32;var _0x1a69f4;return db[_0x1505('0x2e')][_0x1505('0x4d')]({'where':{'id':_0xb7c26[_0x1505('0x46')]['id']}})[_0x1505('0x27')](handleEntityNotFound(_0x5a622e,null))[_0x1505('0x27')](function(_0x1c9de6){if(_0x1c9de6){_0x5ace32=_0x1c9de6;_0x5bbca8[_0x1505('0x33')]=_[_0x1505('0x35')](db['DeskField']['rawAttributes']);_0x5bbca8[_0x1505('0x34')]=_['keys'](_0xb7c26[_0x1505('0x34')]);_0x5bbca8[_0x1505('0x36')]=_[_0x1505('0x37')](_0x5bbca8[_0x1505('0x33')],_0x5bbca8[_0x1505('0x34')]);_0x405f86[_0x1505('0x38')]=_[_0x1505('0x37')](_0x5bbca8[_0x1505('0x33')],qs[_0x1505('0x39')](_0xb7c26['query'][_0x1505('0x39')]));_0x405f86[_0x1505('0x38')]=_0x405f86['attributes'][_0x1505('0x47')]?_0x405f86['attributes']:_0x5bbca8[_0x1505('0x33')];_0x405f86[_0x1505('0x3b')]=qs[_0x1505('0x3c')](_0xb7c26[_0x1505('0x34')][_0x1505('0x3c')]);_0x405f86[_0x1505('0x3d')]=qs[_0x1505('0x36')](_[_0x1505('0x3e')](_0xb7c26[_0x1505('0x34')],_0x5bbca8[_0x1505('0x36')]));if(_0xb7c26[_0x1505('0x34')][_0x1505('0x3f')]){_0x405f86[_0x1505('0x3d')]=_[_0x1505('0x41')](_0x405f86[_0x1505('0x3d')],{'$or':_[_0x1505('0x2d')](_0x405f86['attributes'],function(_0x528d47){var _0x39c057={};_0x39c057[_0x528d47]={'$like':'%'+_0xb7c26['query'][_0x1505('0x3f')]+'%'};return _0x39c057;})});}_0x405f86=_[_0x1505('0x41')]({},_0x405f86,_0xb7c26[_0x1505('0x42')]);return _0x5ace32['getDescriptions'](_0x405f86);}})[_0x1505('0x27')](function(_0x32b359){if(_0x32b359){_0x1a69f4=_0x32b359['length'];if(!_0xb7c26['query'][_0x1505('0x4f')]('nolimit')){_0x405f86['limit']=qs[_0x1505('0x21')](_0xb7c26[_0x1505('0x34')]['limit']);_0x405f86[_0x1505('0x20')]=qs[_0x1505('0x20')](_0xb7c26[_0x1505('0x34')][_0x1505('0x20')]);}return _0x5ace32[_0x1505('0x51')](_0x405f86);}})[_0x1505('0x27')](function(_0x393aba){if(_0x393aba){return _0x393aba?{'count':_0x1a69f4,'rows':_0x393aba}:null;}})['then'](respondWithResult(_0x5a622e,null))[_0x1505('0x49')](handleError(_0x5a622e,null));};exports[_0x1505('0x52')]=function(_0x152161,_0x1d6cdc,_0xd6c580){var _0x2f6f59={};var _0x4dfa20={};var _0xdbbd84;var _0x1983b1;return db[_0x1505('0x2e')][_0x1505('0x4d')]({'where':{'id':_0x152161[_0x1505('0x46')]['id']}})[_0x1505('0x27')](handleEntityNotFound(_0x1d6cdc,null))[_0x1505('0x27')](function(_0x5f4b70){if(_0x5f4b70){_0xdbbd84=_0x5f4b70;_0x4dfa20[_0x1505('0x33')]=_[_0x1505('0x35')](db[_0x1505('0x53')][_0x1505('0x2f')]);_0x4dfa20['query']=_['keys'](_0x152161[_0x1505('0x34')]);_0x4dfa20[_0x1505('0x36')]=_[_0x1505('0x37')](_0x4dfa20[_0x1505('0x33')],_0x4dfa20[_0x1505('0x34')]);_0x2f6f59[_0x1505('0x38')]=_[_0x1505('0x37')](_0x4dfa20['model'],qs[_0x1505('0x39')](_0x152161[_0x1505('0x34')]['fields']));_0x2f6f59[_0x1505('0x38')]=_0x2f6f59[_0x1505('0x38')]['length']?_0x2f6f59[_0x1505('0x38')]:_0x4dfa20[_0x1505('0x33')];_0x2f6f59[_0x1505('0x3b')]=qs['sort'](_0x152161[_0x1505('0x34')][_0x1505('0x3c')]);_0x2f6f59[_0x1505('0x3d')]=qs[_0x1505('0x36')](_[_0x1505('0x3e')](_0x152161['query'],_0x4dfa20[_0x1505('0x36')]));if(_0x152161[_0x1505('0x34')]['filter']){_0x2f6f59[_0x1505('0x3d')]=_[_0x1505('0x41')](_0x2f6f59['where'],{'$or':_[_0x1505('0x2d')](_0x2f6f59[_0x1505('0x38')],function(_0x46cf41){var _0x322564={};_0x322564[_0x46cf41]={'$like':'%'+_0x152161[_0x1505('0x34')]['filter']+'%'};return _0x322564;})});}_0x2f6f59=_[_0x1505('0x41')]({},_0x2f6f59,_0x152161['options']);return _0xdbbd84[_0x1505('0x52')](_0x2f6f59);}})['then'](function(_0x24b14d){if(_0x24b14d){_0x1983b1=_0x24b14d[_0x1505('0x47')];if(!_0x152161[_0x1505('0x34')][_0x1505('0x4f')](_0x1505('0x3a'))){_0x2f6f59[_0x1505('0x21')]=qs[_0x1505('0x21')](_0x152161['query'][_0x1505('0x21')]);_0x2f6f59[_0x1505('0x20')]=qs[_0x1505('0x20')](_0x152161[_0x1505('0x34')]['offset']);}return _0xdbbd84[_0x1505('0x52')](_0x2f6f59);}})[_0x1505('0x27')](function(_0x15ac8a){if(_0x15ac8a){return _0x15ac8a?{'count':_0x1983b1,'rows':_0x15ac8a}:null;}})[_0x1505('0x27')](respondWithResult(_0x1d6cdc,null))[_0x1505('0x49')](handleError(_0x1d6cdc,null));};exports[_0x1505('0x54')]=function(_0x2d1096,_0x699241,_0x99fa20){if(_0x2d1096[_0x1505('0x4b')]['id']){delete _0x2d1096[_0x1505('0x4b')]['id'];}return db[_0x1505('0x2e')][_0x1505('0x4d')]({'where':{'id':_0x2d1096[_0x1505('0x46')]['id']}})[_0x1505('0x27')](handleEntityNotFound(_0x699241,null))[_0x1505('0x27')](function(_0x22dcde){if(_0x22dcde){return _0x22dcde[_0x1505('0x54')](_0x2d1096[_0x1505('0x4b')][_0x1505('0x55')]||[]);}return null;})[_0x1505('0x27')](respondWithResult(_0x699241,null))[_0x1505('0x49')](handleError(_0x699241,null));}; \ No newline at end of file +var _0xba87=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','map','keys','filters','intersection','query','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','DeskConfiguration','create','catch','body','find','getFields','findOne','DeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xba87,0x1ee));var _0x7ba8=function(_0x5519c4,_0x270f91){_0x5519c4=_0x5519c4-0x0;var _0x2c1c3=_0xba87[_0x5519c4];return _0x2c1c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ba8('0x0'));var zipdir=require(_0x7ba8('0x1'));var jsonpatch=require(_0x7ba8('0x2'));var rp=require(_0x7ba8('0x3'));var moment=require(_0x7ba8('0x4'));var BPromise=require(_0x7ba8('0x5'));var Mustache=require(_0x7ba8('0x6'));var util=require(_0x7ba8('0x7'));var path=require(_0x7ba8('0x8'));var sox=require(_0x7ba8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ba8('0xa'));var _=require('lodash');var squel=require(_0x7ba8('0xb'));var crypto=require(_0x7ba8('0xc'));var jsforce=require(_0x7ba8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7ba8('0xe'));var querystring=require(_0x7ba8('0xf'));var Papa=require(_0x7ba8('0x10'));var Redis=require(_0x7ba8('0x11'));var authService=require(_0x7ba8('0x12'));var qs=require(_0x7ba8('0x13'));var as=require(_0x7ba8('0x14'));var hardwareService=require(_0x7ba8('0x15'));var logger=require(_0x7ba8('0x16'))(_0x7ba8('0x17'));var utils=require(_0x7ba8('0x18'));var config=require(_0x7ba8('0x19'));var licenseUtil=require(_0x7ba8('0x1a'));var db=require(_0x7ba8('0x1b'))['db'];function respondWithStatusCode(_0x2064f6,_0x24b99a){_0x24b99a=_0x24b99a||0xcc;return function(_0x48fcfa){if(_0x48fcfa){return _0x2064f6[_0x7ba8('0x1c')](_0x24b99a);}return _0x2064f6['status'](_0x24b99a)[_0x7ba8('0x1d')]();};}function respondWithResult(_0x18219b,_0x428122){_0x428122=_0x428122||0xc8;return function(_0x403526){if(_0x403526){return _0x18219b[_0x7ba8('0x1e')](_0x428122)[_0x7ba8('0x1f')](_0x403526);}};}function respondWithFilteredResult(_0x5b46be,_0x18ac92){return function(_0x562076){if(_0x562076){var _0xdd85ef=typeof _0x18ac92['offset']===_0x7ba8('0x20')&&typeof _0x18ac92[_0x7ba8('0x21')]===_0x7ba8('0x20');var _0x5d45c1=_0x562076[_0x7ba8('0x22')];var _0x3d625c=_0xdd85ef?0x0:_0x18ac92[_0x7ba8('0x23')];var _0x46c735=_0xdd85ef?_0x562076['count']:_0x18ac92[_0x7ba8('0x23')]+_0x18ac92[_0x7ba8('0x21')];var _0x2879ee;if(_0x46c735>=_0x5d45c1){_0x46c735=_0x5d45c1;_0x2879ee=0xc8;}else{_0x2879ee=0xce;}_0x5b46be[_0x7ba8('0x1e')](_0x2879ee);return _0x5b46be['set']('Content-Range',_0x3d625c+'-'+_0x46c735+'/'+_0x5d45c1)[_0x7ba8('0x1f')](_0x562076);}return null;};}function patchUpdates(_0x2383f0){return function(_0x184e6c){try{jsonpatch['apply'](_0x184e6c,_0x2383f0,!![]);}catch(_0x5c5e55){return BPromise[_0x7ba8('0x24')](_0x5c5e55);}return _0x184e6c[_0x7ba8('0x25')]();};}function saveUpdates(_0x5e6668,_0x350fc1){return function(_0x5b63e4){if(_0x5b63e4){return _0x5b63e4[_0x7ba8('0x26')](_0x5e6668)[_0x7ba8('0x27')](function(_0x1ecf56){return _0x1ecf56;});}return null;};}function removeEntity(_0x3e58d4,_0x320e73){return function(_0x245f80){if(_0x245f80){return _0x245f80[_0x7ba8('0x28')]()[_0x7ba8('0x27')](function(){_0x3e58d4['status'](0xcc)[_0x7ba8('0x1d')]();});}};}function handleEntityNotFound(_0x289e54,_0xc4e00c){return function(_0x23616b){if(!_0x23616b){_0x289e54[_0x7ba8('0x1c')](0x194);}return _0x23616b;};}function handleError(_0x1fb167,_0x579dad){_0x579dad=_0x579dad||0x1f4;return function(_0x42f5d2){logger['error'](_0x42f5d2[_0x7ba8('0x29')]);if(_0x42f5d2[_0x7ba8('0x2a')]){delete _0x42f5d2[_0x7ba8('0x2a')];}_0x1fb167[_0x7ba8('0x1e')](_0x579dad)[_0x7ba8('0x2b')](_0x42f5d2);};}exports[_0x7ba8('0x2c')]=function(_0x48c397,_0x431b41){var _0xa26b60={},_0x4150ea={},_0x35fe5e={'count':0x0,'rows':[]};var _0x51b0c8=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x359b04){return{'name':_0x359b04[_0x7ba8('0x2d')],'type':_0x359b04[_0x7ba8('0x2e')]['key']};});_0x4150ea['model']=_[_0x7ba8('0x2f')](_0x51b0c8,_0x7ba8('0x2a'));_0x4150ea['query']=_[_0x7ba8('0x30')](_0x48c397['query']);_0x4150ea[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x4150ea['model'],_0x4150ea[_0x7ba8('0x33')]);_0xa26b60[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x4150ea[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x48c397['query']['fields']));_0xa26b60[_0x7ba8('0x34')]=_0xa26b60['attributes'][_0x7ba8('0x37')]?_0xa26b60['attributes']:_0x4150ea['model'];if(!_0x48c397[_0x7ba8('0x33')]['hasOwnProperty'](_0x7ba8('0x38'))){_0xa26b60[_0x7ba8('0x21')]=qs['limit'](_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0xa26b60[_0x7ba8('0x23')]=qs['offset'](_0x48c397['query']['offset']);}_0xa26b60[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0xa26b60[_0x7ba8('0x3b')]=qs['filters'](_[_0x7ba8('0x3c')](_0x48c397[_0x7ba8('0x33')],_0x4150ea['filters']),_0x51b0c8);if(_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0xa26b60['where']=_[_0x7ba8('0x3e')](_0xa26b60[_0x7ba8('0x3b')],{'$or':_['map'](_0x51b0c8,function(_0x9a12b1){if(_0x9a12b1[_0x7ba8('0x2e')]!==_0x7ba8('0x3f')){var _0x4d213e={};_0x4d213e[_0x9a12b1[_0x7ba8('0x2a')]]={'$like':'%'+_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x4d213e;}})});}_0xa26b60=_[_0x7ba8('0x3e')]({},_0xa26b60,_0x48c397[_0x7ba8('0x40')]);var _0x3e1cbb={'where':_0xa26b60[_0x7ba8('0x3b')]};return db['DeskConfiguration'][_0x7ba8('0x22')](_0x3e1cbb)[_0x7ba8('0x27')](function(_0x154790){_0x35fe5e[_0x7ba8('0x22')]=_0x154790;if(_0x48c397[_0x7ba8('0x33')][_0x7ba8('0x41')]){_0xa26b60[_0x7ba8('0x42')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7ba8('0x43')](_0xa26b60);})[_0x7ba8('0x27')](function(_0x37ad85){_0x35fe5e['rows']=_0x37ad85;return _0x35fe5e;})['then'](respondWithFilteredResult(_0x431b41,_0xa26b60))['catch'](handleError(_0x431b41,null));};exports[_0x7ba8('0x44')]=function(_0x406c74,_0x302c7e){var _0x164550={'raw':![],'where':{'id':_0x406c74[_0x7ba8('0x45')]['id']}},_0x2414a6={};_0x2414a6['model']=_[_0x7ba8('0x30')](db['DeskConfiguration'][_0x7ba8('0x46')]);_0x2414a6[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x406c74['query']);_0x2414a6[_0x7ba8('0x31')]=_['intersection'](_0x2414a6['model'],_0x2414a6['query']);_0x164550['attributes']=_[_0x7ba8('0x32')](_0x2414a6[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x406c74[_0x7ba8('0x33')]['fields']));_0x164550['attributes']=_0x164550[_0x7ba8('0x34')][_0x7ba8('0x37')]?_0x164550[_0x7ba8('0x34')]:_0x2414a6[_0x7ba8('0x35')];if(_0x406c74[_0x7ba8('0x33')][_0x7ba8('0x41')]){_0x164550['include']=[{'all':!![]}];}_0x164550=_[_0x7ba8('0x3e')]({},_0x164550,_0x406c74[_0x7ba8('0x40')]);return db[_0x7ba8('0x47')]['find'](_0x164550)['then'](handleEntityNotFound(_0x302c7e,null))[_0x7ba8('0x27')](respondWithResult(_0x302c7e,null))['catch'](handleError(_0x302c7e,null));};exports[_0x7ba8('0x48')]=function(_0x59150c,_0x3b498d){return db[_0x7ba8('0x47')][_0x7ba8('0x48')](_0x59150c['body'],{})[_0x7ba8('0x27')](respondWithResult(_0x3b498d,0xc9))[_0x7ba8('0x49')](handleError(_0x3b498d,null));};exports[_0x7ba8('0x26')]=function(_0x1e3188,_0x5cd197){if(_0x1e3188[_0x7ba8('0x4a')]['id']){delete _0x1e3188[_0x7ba8('0x4a')]['id'];}return db[_0x7ba8('0x47')][_0x7ba8('0x4b')]({'where':{'id':_0x1e3188[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x5cd197,null))['then'](saveUpdates(_0x1e3188[_0x7ba8('0x4a')],null))[_0x7ba8('0x27')](respondWithResult(_0x5cd197,null))[_0x7ba8('0x49')](handleError(_0x5cd197,null));};exports[_0x7ba8('0x28')]=function(_0x2536b3,_0xc64e75){return db[_0x7ba8('0x47')][_0x7ba8('0x4b')]({'where':{'id':_0x2536b3[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0xc64e75,null))[_0x7ba8('0x27')](removeEntity(_0xc64e75,null))[_0x7ba8('0x49')](handleError(_0xc64e75,null));};exports[_0x7ba8('0x4c')]=function(_0x40ea5e,_0x35b01e,_0x1aba3d){var _0x5baf1d={};var _0x36b7e7={};var _0x41c38a;var _0x5db2c1;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x40ea5e[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x35b01e,null))[_0x7ba8('0x27')](function(_0x2c576b){if(_0x2c576b){_0x41c38a=_0x2c576b;_0x36b7e7[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')][_0x7ba8('0x46')]);_0x36b7e7['query']=_[_0x7ba8('0x30')](_0x40ea5e[_0x7ba8('0x33')]);_0x36b7e7[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x36b7e7[_0x7ba8('0x35')],_0x36b7e7[_0x7ba8('0x33')]);_0x5baf1d['attributes']=_[_0x7ba8('0x32')](_0x36b7e7[_0x7ba8('0x35')],qs[_0x7ba8('0x36')](_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x36')]));_0x5baf1d[_0x7ba8('0x34')]=_0x5baf1d[_0x7ba8('0x34')][_0x7ba8('0x37')]?_0x5baf1d['attributes']:_0x36b7e7[_0x7ba8('0x35')];_0x5baf1d['order']=qs['sort'](_0x40ea5e['query']['sort']);_0x5baf1d[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x40ea5e[_0x7ba8('0x33')],_0x36b7e7[_0x7ba8('0x31')]));if(_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x5baf1d[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x5baf1d[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x5baf1d[_0x7ba8('0x34')],function(_0x662487){var _0x476566={};_0x476566[_0x662487]={'$like':'%'+_0x40ea5e['query'][_0x7ba8('0x3d')]+'%'};return _0x476566;})});}_0x5baf1d=_[_0x7ba8('0x3e')]({},_0x5baf1d,_0x40ea5e[_0x7ba8('0x40')]);return _0x41c38a['getFields'](_0x5baf1d);}})[_0x7ba8('0x27')](function(_0x3052b5){if(_0x3052b5){_0x5db2c1=_0x3052b5['length'];if(!_0x40ea5e[_0x7ba8('0x33')]['hasOwnProperty'](_0x7ba8('0x38'))){_0x5baf1d['limit']=qs[_0x7ba8('0x21')](_0x40ea5e[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0x5baf1d['offset']=qs['offset'](_0x40ea5e[_0x7ba8('0x33')]['offset']);}return _0x41c38a['getFields'](_0x5baf1d);}})['then'](function(_0x2735fa){if(_0x2735fa){return _0x2735fa?{'count':_0x5db2c1,'rows':_0x2735fa}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x35b01e,null))[_0x7ba8('0x49')](handleError(_0x35b01e,null));};exports[_0x7ba8('0x4f')]=function(_0x37b78a,_0x277bce,_0x5dd9aa){var _0x519457={};var _0x31305c={};var _0x1e0c16;var _0x40c93a;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x37b78a[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x277bce,null))[_0x7ba8('0x27')](function(_0x4fcc49){if(_0x4fcc49){_0x1e0c16=_0x4fcc49;_0x31305c[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')]['rawAttributes']);_0x31305c[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x37b78a[_0x7ba8('0x33')]);_0x31305c[_0x7ba8('0x31')]=_['intersection'](_0x31305c['model'],_0x31305c['query']);_0x519457[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x31305c['model'],qs[_0x7ba8('0x36')](_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x36')]));_0x519457[_0x7ba8('0x34')]=_0x519457[_0x7ba8('0x34')]['length']?_0x519457[_0x7ba8('0x34')]:_0x31305c[_0x7ba8('0x35')];_0x519457[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0x519457[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x37b78a['query'],_0x31305c[_0x7ba8('0x31')]));if(_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x519457[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x519457[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x519457[_0x7ba8('0x34')],function(_0x34e84a){var _0x1b0d7f={};_0x1b0d7f[_0x34e84a]={'$like':'%'+_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x1b0d7f;})});}_0x519457=_[_0x7ba8('0x3e')]({},_0x519457,_0x37b78a[_0x7ba8('0x40')]);return _0x1e0c16[_0x7ba8('0x4f')](_0x519457);}})[_0x7ba8('0x27')](function(_0x59dbb0){if(_0x59dbb0){_0x40c93a=_0x59dbb0['length'];if(!_0x37b78a[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x519457[_0x7ba8('0x21')]=qs[_0x7ba8('0x21')](_0x37b78a['query']['limit']);_0x519457['offset']=qs[_0x7ba8('0x23')](_0x37b78a['query'][_0x7ba8('0x23')]);}return _0x1e0c16['getSubjects'](_0x519457);}})[_0x7ba8('0x27')](function(_0x26ebc8){if(_0x26ebc8){return _0x26ebc8?{'count':_0x40c93a,'rows':_0x26ebc8}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x277bce,null))[_0x7ba8('0x49')](handleError(_0x277bce,null));};exports['getDescriptions']=function(_0x4d8701,_0x4f3453,_0x46a0bb){var _0x4ef306={};var _0x4598={};var _0x33f1dc;var _0x205d03;return db[_0x7ba8('0x47')]['findOne']({'where':{'id':_0x4d8701[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x4f3453,null))['then'](function(_0x5127e4){if(_0x5127e4){_0x33f1dc=_0x5127e4;_0x4598[_0x7ba8('0x35')]=_[_0x7ba8('0x30')](db[_0x7ba8('0x4e')][_0x7ba8('0x46')]);_0x4598[_0x7ba8('0x33')]=_[_0x7ba8('0x30')](_0x4d8701['query']);_0x4598[_0x7ba8('0x31')]=_[_0x7ba8('0x32')](_0x4598['model'],_0x4598[_0x7ba8('0x33')]);_0x4ef306[_0x7ba8('0x34')]=_[_0x7ba8('0x32')](_0x4598[_0x7ba8('0x35')],qs['fields'](_0x4d8701[_0x7ba8('0x33')]['fields']));_0x4ef306['attributes']=_0x4ef306[_0x7ba8('0x34')]['length']?_0x4ef306[_0x7ba8('0x34')]:_0x4598[_0x7ba8('0x35')];_0x4ef306[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x4d8701[_0x7ba8('0x33')]['sort']);_0x4ef306[_0x7ba8('0x3b')]=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x4d8701[_0x7ba8('0x33')],_0x4598['filters']));if(_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x3d')]){_0x4ef306[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x4ef306[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x4ef306[_0x7ba8('0x34')],function(_0x17c330){var _0x57c8bb={};_0x57c8bb[_0x17c330]={'$like':'%'+_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x57c8bb;})});}_0x4ef306=_['merge']({},_0x4ef306,_0x4d8701[_0x7ba8('0x40')]);return _0x33f1dc['getDescriptions'](_0x4ef306);}})[_0x7ba8('0x27')](function(_0x11d1d2){if(_0x11d1d2){_0x205d03=_0x11d1d2[_0x7ba8('0x37')];if(!_0x4d8701[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x4ef306[_0x7ba8('0x21')]=qs[_0x7ba8('0x21')](_0x4d8701[_0x7ba8('0x33')]['limit']);_0x4ef306[_0x7ba8('0x23')]=qs[_0x7ba8('0x23')](_0x4d8701[_0x7ba8('0x33')]['offset']);}return _0x33f1dc[_0x7ba8('0x51')](_0x4ef306);}})[_0x7ba8('0x27')](function(_0x3c1268){if(_0x3c1268){return _0x3c1268?{'count':_0x205d03,'rows':_0x3c1268}:null;}})[_0x7ba8('0x27')](respondWithResult(_0x4f3453,null))[_0x7ba8('0x49')](handleError(_0x4f3453,null));};exports[_0x7ba8('0x52')]=function(_0x38c295,_0x44b36d,_0x437708){var _0x906583={};var _0x5eea84={};var _0x3c9421;var _0x560936;return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x38c295[_0x7ba8('0x45')]['id']}})['then'](handleEntityNotFound(_0x44b36d,null))['then'](function(_0x1123f7){if(_0x1123f7){_0x3c9421=_0x1123f7;_0x5eea84[_0x7ba8('0x35')]=_['keys'](db[_0x7ba8('0x53')][_0x7ba8('0x46')]);_0x5eea84['query']=_[_0x7ba8('0x30')](_0x38c295['query']);_0x5eea84['filters']=_[_0x7ba8('0x32')](_0x5eea84[_0x7ba8('0x35')],_0x5eea84['query']);_0x906583[_0x7ba8('0x34')]=_['intersection'](_0x5eea84['model'],qs[_0x7ba8('0x36')](_0x38c295[_0x7ba8('0x33')]['fields']));_0x906583[_0x7ba8('0x34')]=_0x906583[_0x7ba8('0x34')]['length']?_0x906583[_0x7ba8('0x34')]:_0x5eea84[_0x7ba8('0x35')];_0x906583[_0x7ba8('0x39')]=qs[_0x7ba8('0x3a')](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x3a')]);_0x906583['where']=qs[_0x7ba8('0x31')](_[_0x7ba8('0x3c')](_0x38c295[_0x7ba8('0x33')],_0x5eea84['filters']));if(_0x38c295['query'][_0x7ba8('0x3d')]){_0x906583[_0x7ba8('0x3b')]=_[_0x7ba8('0x3e')](_0x906583[_0x7ba8('0x3b')],{'$or':_[_0x7ba8('0x2f')](_0x906583['attributes'],function(_0x33c195){var _0x1c63fd={};_0x1c63fd[_0x33c195]={'$like':'%'+_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x3d')]+'%'};return _0x1c63fd;})});}_0x906583=_['merge']({},_0x906583,_0x38c295['options']);return _0x3c9421[_0x7ba8('0x52')](_0x906583);}})[_0x7ba8('0x27')](function(_0x4a1838){if(_0x4a1838){_0x560936=_0x4a1838[_0x7ba8('0x37')];if(!_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x50')](_0x7ba8('0x38'))){_0x906583['limit']=qs['limit'](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x21')]);_0x906583[_0x7ba8('0x23')]=qs[_0x7ba8('0x23')](_0x38c295[_0x7ba8('0x33')][_0x7ba8('0x23')]);}return _0x3c9421[_0x7ba8('0x52')](_0x906583);}})['then'](function(_0x2688df){if(_0x2688df){return _0x2688df?{'count':_0x560936,'rows':_0x2688df}:null;}})['then'](respondWithResult(_0x44b36d,null))[_0x7ba8('0x49')](handleError(_0x44b36d,null));};exports['setTags']=function(_0x3fd105,_0x4b23ab,_0x2a238f){if(_0x3fd105['body']['id']){delete _0x3fd105[_0x7ba8('0x4a')]['id'];}return db[_0x7ba8('0x47')][_0x7ba8('0x4d')]({'where':{'id':_0x3fd105[_0x7ba8('0x45')]['id']}})[_0x7ba8('0x27')](handleEntityNotFound(_0x4b23ab,null))[_0x7ba8('0x27')](function(_0x4175cf){if(_0x4175cf){return _0x4175cf[_0x7ba8('0x54')](_0x3fd105['body'][_0x7ba8('0x55')]||[]);}return null;})['then'](respondWithResult(_0x4b23ab,null))[_0x7ba8('0x49')](handleError(_0x4b23ab,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ce9214a..17ce981 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 _0x4ac7=['bluebird','request-promise','path','rimraf','../../config/environment','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x1c7c39,_0x3c05b0){var _0x7eac39=function(_0x20bb00){while(--_0x20bb00){_0x1c7c39['push'](_0x1c7c39['shift']());}};_0x7eac39(++_0x3c05b0);}(_0x4ac7,0x170));var _0x74ac=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x4ac7[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x74ac('0x0'));var util=require(_0x74ac('0x1'));var logger=require(_0x74ac('0x2'))('api');var moment=require(_0x74ac('0x3'));var BPromise=require(_0x74ac('0x4'));var rp=require(_0x74ac('0x5'));var fs=require('fs');var path=require(_0x74ac('0x6'));var rimraf=require(_0x74ac('0x7'));var config=require(_0x74ac('0x8'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x416144,_0x58b8da){return _0x416144[_0x74ac('0x9')](_0x74ac('0xa'),attributes,{'tableName':_0x74ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c4c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x16f55c,_0xe368a){var _0x19af68=function(_0x56a224){while(--_0x56a224){_0x16f55c['push'](_0x16f55c['shift']());}};_0x19af68(++_0xe368a);}(_0x3c4c,0x16c));var _0xc3c4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3c4c[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc3c4('0x0'));var util=require('util');var logger=require(_0xc3c4('0x1'))(_0xc3c4('0x2'));var moment=require(_0xc3c4('0x3'));var BPromise=require(_0xc3c4('0x4'));var rp=require(_0xc3c4('0x5'));var fs=require('fs');var path=require(_0xc3c4('0x6'));var rimraf=require(_0xc3c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3c4('0x8'));module[_0xc3c4('0x9')]=function(_0x5ae28f,_0x118d39){return _0x5ae28f[_0xc3c4('0xa')](_0xc3c4('0xb'),attributes,{'tableName':_0xc3c4('0xc'),'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 2e70b94..04505c9 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 _0x041d=['../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x041d,0x185));var _0xd041=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x041d[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xd041('0x0'));var util=require(_0xd041('0x1'));var moment=require(_0xd041('0x2'));var BPromise=require(_0xd041('0x3'));var rs=require(_0xd041('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd041('0x5'));var logger=require('../../config/logger')(_0xd041('0x6'));var config=require(_0xd041('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd041('0x8')][_0xd041('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x155067,_0x2c5cfd,_0x18c403){return new BPromise(function(_0x2afab7,_0x5f5621){return client[_0xd041('0xa')](_0x155067,_0x18c403)[_0xd041('0xb')](function(_0x4672f6){logger[_0xd041('0xc')](_0xd041('0xd'),_0x2c5cfd,'request\x20sent');logger[_0xd041('0xe')](_0xd041('0xf'),_0x2c5cfd,_0xd041('0x10'),JSON['stringify'](_0x4672f6));if(_0x4672f6[_0xd041('0x11')]){if(_0x4672f6['error'][_0xd041('0x12')]===0x1f4){logger[_0xd041('0x11')](_0xd041('0xd'),_0x2c5cfd,_0x4672f6['error']['message']);return _0x5f5621(_0x4672f6[_0xd041('0x11')]['message']);}logger[_0xd041('0x11')](_0xd041('0xd'),_0x2c5cfd,_0x4672f6[_0xd041('0x11')][_0xd041('0x13')]);return _0x2afab7(_0x4672f6[_0xd041('0x11')][_0xd041('0x13')]);}else{logger['info'](_0xd041('0xd'),_0x2c5cfd,_0xd041('0x10'));_0x2afab7(_0x4672f6[_0xd041('0x14')][_0xd041('0x13')]);}})[_0xd041('0x15')](function(_0x3f775f){logger[_0xd041('0x11')](_0xd041('0xd'),_0x2c5cfd,_0x3f775f);_0x5f5621(_0x3f775f);});});} \ No newline at end of file +var _0x1d63=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x1d63,0xa4));var _0x31d6=function(_0x2b3ede,_0x1f0b82){_0x2b3ede=_0x2b3ede-0x0;var _0x55c914=_0x1d63[_0x2b3ede];return _0x55c914;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var moment=require(_0x31d6('0x2'));var BPromise=require(_0x31d6('0x3'));var rs=require(_0x31d6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31d6('0x5'))['db'];var utils=require(_0x31d6('0x6'));var logger=require(_0x31d6('0x7'))(_0x31d6('0x8'));var config=require(_0x31d6('0x9'));var jayson=require(_0x31d6('0xa'));var client=jayson[_0x31d6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b549,_0x6cc83b,_0x4fee16){return new BPromise(function(_0x34a5e3,_0x2c1b36){return client['request'](_0x36b549,_0x4fee16)['then'](function(_0x4b32f8){logger[_0x31d6('0xc')](_0x31d6('0xd'),_0x6cc83b,_0x31d6('0xe'));logger['debug'](_0x31d6('0xf'),_0x6cc83b,_0x31d6('0xe'),JSON[_0x31d6('0x10')](_0x4b32f8));if(_0x4b32f8[_0x31d6('0x11')]){if(_0x4b32f8[_0x31d6('0x11')]['code']===0x1f4){logger[_0x31d6('0x11')](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x2c1b36(_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);}logger['error'](_0x31d6('0xd'),_0x6cc83b,_0x4b32f8[_0x31d6('0x11')][_0x31d6('0x12')]);return _0x34a5e3(_0x4b32f8[_0x31d6('0x11')]['message']);}else{logger[_0x31d6('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x6cc83b,_0x31d6('0xe'));_0x34a5e3(_0x4b32f8[_0x31d6('0x13')][_0x31d6('0x12')]);}})[_0x31d6('0x14')](function(_0x189784){logger[_0x31d6('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x6cc83b,_0x189784);_0x2c1b36(_0x189784);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index bbddbcd..6452c8b 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 _0x34ed=['put','/:id','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','post','create'];(function(_0x44c69d,_0x3c3d1d){var _0x9334e6=function(_0x2dce40){while(--_0x2dce40){_0x44c69d['push'](_0x44c69d['shift']());}};_0x9334e6(++_0x3c3d1d);}(_0x34ed,0x124));var _0xd34e=function(_0x1cd633,_0x21c3db){_0x1cd633=_0x1cd633-0x0;var _0x5bf6d8=_0x34ed[_0x1cd633];return _0x5bf6d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd34e('0x0'));var timeout=require(_0xd34e('0x1'));var express=require(_0xd34e('0x2'));var router=express[_0xd34e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd34e('0x4'));var config=require(_0xd34e('0x5'));var controller=require(_0xd34e('0x6'));router[_0xd34e('0x7')]('/',auth['isAuthenticated'](),controller[_0xd34e('0x8')]);router[_0xd34e('0x7')]('/:id',auth[_0xd34e('0x9')](),controller['show']);router[_0xd34e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd34e('0xb')]);router[_0xd34e('0xc')](_0xd34e('0xd'),auth[_0xd34e('0x9')](),controller['update']);router[_0xd34e('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd34e('0xf')]=router; \ No newline at end of file +var _0x5a3c=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x18f84c,_0x5a0ab8){var _0x1c234f=function(_0x2b7737){while(--_0x2b7737){_0x18f84c['push'](_0x18f84c['shift']());}};_0x1c234f(++_0x5a0ab8);}(_0x5a3c,0x176));var _0xc5a3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x5a3c[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xc5a3('0x0'));var util=require(_0xc5a3('0x1'));var path=require(_0xc5a3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc5a3('0x3'));var router=express[_0xc5a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5a3('0x5'));var interaction=require(_0xc5a3('0x6'));var config=require(_0xc5a3('0x7'));var controller=require(_0xc5a3('0x8'));router[_0xc5a3('0x9')]('/',auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xb')]);router[_0xc5a3('0x9')](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xd')]);router[_0xc5a3('0xe')]('/',auth[_0xc5a3('0xa')](),controller[_0xc5a3('0xf')]);router['put'](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0x10')]);router[_0xc5a3('0x11')](_0xc5a3('0xc'),auth[_0xc5a3('0xa')](),controller[_0xc5a3('0x12')]);module[_0xc5a3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4cce526..32721e8 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 _0x6c26=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1b3ab9,_0x58145c){var _0x2bb665=function(_0x480be4){while(--_0x480be4){_0x1b3ab9['push'](_0x1b3ab9['shift']());}};_0x2bb665(++_0x58145c);}(_0x6c26,0x1c8));var _0x66c2=function(_0x482307,_0x2fc7c3){_0x482307=_0x482307-0x0;var _0x312ac2=_0x6c26[_0x482307];return _0x312ac2;};'use strict';var Sequelize=require(_0x66c2('0x0'));module['exports']={'type':{'type':Sequelize[_0x66c2('0x1')](_0x66c2('0x2'),_0x66c2('0x3'),_0x66c2('0x4'),_0x66c2('0x5'),_0x66c2('0x6')),'defaultValue':_0x66c2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x66c2('0x7')]},'idField':{'type':Sequelize[_0x66c2('0x7')]},'nameField':{'type':Sequelize[_0x66c2('0x7')]},'customField':{'type':Sequelize[_0x66c2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x66c2('0x7')]}}; \ No newline at end of file +var _0x1522=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x2c0005,_0x3dcfe7){var _0x409ffd=function(_0x38e14d){while(--_0x38e14d){_0x2c0005['push'](_0x2c0005['shift']());}};_0x409ffd(++_0x3dcfe7);}(_0x1522,0xec));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2152('0x0'));module['exports']={'type':{'type':Sequelize[_0x2152('0x1')](_0x2152('0x2'),_0x2152('0x3'),_0x2152('0x4'),_0x2152('0x5'),'picklist'),'defaultValue':_0x2152('0x2')},'content':{'type':Sequelize[_0x2152('0x6')]},'key':{'type':Sequelize[_0x2152('0x6')]},'keyType':{'type':Sequelize[_0x2152('0x1')]('string',_0x2152('0x3'),_0x2152('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2152('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2152('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 74745cc..1a764b9 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 _0xc8ba=['filters','intersection','fields','attributes','length','nolimit','order','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','then','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','map','DeskField','rawAttributes','fieldName','key','model','query'];(function(_0x5e7e55,_0x4dadc0){var _0x332810=function(_0x532641){while(--_0x532641){_0x5e7e55['push'](_0x5e7e55['shift']());}};_0x332810(++_0x4dadc0);}(_0xc8ba,0x186));var _0xac8b=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xc8ba[_0x13992d];return _0x3d15bf;};'use strict';var emlformat=require(_0xac8b('0x0'));var rimraf=require(_0xac8b('0x1'));var zipdir=require(_0xac8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xac8b('0x3'));var BPromise=require(_0xac8b('0x4'));var Mustache=require(_0xac8b('0x5'));var util=require(_0xac8b('0x6'));var path=require('path');var sox=require(_0xac8b('0x7'));var csv=require(_0xac8b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac8b('0x9'));var _=require('lodash');var squel=require(_0xac8b('0xa'));var crypto=require(_0xac8b('0xb'));var jsforce=require(_0xac8b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xac8b('0x8'));var querystring=require(_0xac8b('0xd'));var Papa=require(_0xac8b('0xe'));var Redis=require(_0xac8b('0xf'));var authService=require(_0xac8b('0x10'));var qs=require(_0xac8b('0x11'));var as=require(_0xac8b('0x12'));var hardwareService=require(_0xac8b('0x13'));var logger=require(_0xac8b('0x14'))(_0xac8b('0x15'));var utils=require(_0xac8b('0x16'));var config=require(_0xac8b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xac8b('0x18'))['db'];function respondWithStatusCode(_0x2c1729,_0x2874dd){_0x2874dd=_0x2874dd||0xcc;return function(_0xc91ef9){if(_0xc91ef9){return _0x2c1729[_0xac8b('0x19')](_0x2874dd);}return _0x2c1729['status'](_0x2874dd)[_0xac8b('0x1a')]();};}function respondWithResult(_0x5ae845,_0x50f036){_0x50f036=_0x50f036||0xc8;return function(_0x347e16){if(_0x347e16){return _0x5ae845[_0xac8b('0x1b')](_0x50f036)['json'](_0x347e16);}};}function respondWithFilteredResult(_0x2d1de4,_0x27dc56){return function(_0x28f8e9){if(_0x28f8e9){var _0x406618=typeof _0x27dc56[_0xac8b('0x1c')]===_0xac8b('0x1d')&&typeof _0x27dc56['limit']==='undefined';var _0x4640dc=_0x28f8e9[_0xac8b('0x1e')];var _0x5e1b9d=_0x406618?0x0:_0x27dc56[_0xac8b('0x1c')];var _0x3974e4=_0x406618?_0x28f8e9[_0xac8b('0x1e')]:_0x27dc56['offset']+_0x27dc56[_0xac8b('0x1f')];var _0x88b80f;if(_0x3974e4>=_0x4640dc){_0x3974e4=_0x4640dc;_0x88b80f=0xc8;}else{_0x88b80f=0xce;}_0x2d1de4[_0xac8b('0x1b')](_0x88b80f);return _0x2d1de4[_0xac8b('0x20')](_0xac8b('0x21'),_0x5e1b9d+'-'+_0x3974e4+'/'+_0x4640dc)[_0xac8b('0x22')](_0x28f8e9);}return null;};}function patchUpdates(_0x1dbbce){return function(_0x1ea7b8){try{jsonpatch[_0xac8b('0x23')](_0x1ea7b8,_0x1dbbce,!![]);}catch(_0x433813){return BPromise['reject'](_0x433813);}return _0x1ea7b8['save']();};}function saveUpdates(_0x35c211,_0x5419f2){return function(_0x5bed0a){if(_0x5bed0a){return _0x5bed0a[_0xac8b('0x24')](_0x35c211)['then'](function(_0x479d7e){return _0x479d7e;});}return null;};}function removeEntity(_0x18f98c,_0x28a730){return function(_0xe51f65){if(_0xe51f65){return _0xe51f65[_0xac8b('0x25')]()['then'](function(){_0x18f98c[_0xac8b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d0eda,_0x447c97){return function(_0xaebbfd){if(!_0xaebbfd){_0x8d0eda[_0xac8b('0x19')](0x194);}return _0xaebbfd;};}function handleError(_0x4b7287,_0x1e7c33){_0x1e7c33=_0x1e7c33||0x1f4;return function(_0x4fac73){logger['error'](_0x4fac73[_0xac8b('0x26')]);if(_0x4fac73[_0xac8b('0x27')]){delete _0x4fac73['name'];}_0x4b7287[_0xac8b('0x1b')](_0x1e7c33)[_0xac8b('0x28')](_0x4fac73);};}exports['index']=function(_0x26ac33,_0x31bf50){var _0xab0bfc={},_0x329511={},_0x209390={'count':0x0,'rows':[]};var _0x11b1a1=_[_0xac8b('0x29')](db[_0xac8b('0x2a')][_0xac8b('0x2b')],function(_0x517524){return{'name':_0x517524[_0xac8b('0x2c')],'type':_0x517524['type'][_0xac8b('0x2d')]};});_0x329511[_0xac8b('0x2e')]=_[_0xac8b('0x29')](_0x11b1a1,_0xac8b('0x27'));_0x329511[_0xac8b('0x2f')]=_['keys'](_0x26ac33[_0xac8b('0x2f')]);_0x329511[_0xac8b('0x30')]=_['intersection'](_0x329511[_0xac8b('0x2e')],_0x329511[_0xac8b('0x2f')]);_0xab0bfc['attributes']=_[_0xac8b('0x31')](_0x329511[_0xac8b('0x2e')],qs[_0xac8b('0x32')](_0x26ac33['query'][_0xac8b('0x32')]));_0xab0bfc[_0xac8b('0x33')]=_0xab0bfc['attributes'][_0xac8b('0x34')]?_0xab0bfc[_0xac8b('0x33')]:_0x329511['model'];if(!_0x26ac33[_0xac8b('0x2f')]['hasOwnProperty'](_0xac8b('0x35'))){_0xab0bfc[_0xac8b('0x1f')]=qs['limit'](_0x26ac33[_0xac8b('0x2f')][_0xac8b('0x1f')]);_0xab0bfc[_0xac8b('0x1c')]=qs[_0xac8b('0x1c')](_0x26ac33[_0xac8b('0x2f')][_0xac8b('0x1c')]);}_0xab0bfc[_0xac8b('0x36')]=qs['sort'](_0x26ac33[_0xac8b('0x2f')]['sort']);_0xab0bfc['where']=qs[_0xac8b('0x30')](_[_0xac8b('0x37')](_0x26ac33[_0xac8b('0x2f')],_0x329511[_0xac8b('0x30')]),_0x11b1a1);if(_0x26ac33[_0xac8b('0x2f')][_0xac8b('0x38')]){_0xab0bfc[_0xac8b('0x39')]=_['merge'](_0xab0bfc[_0xac8b('0x39')],{'$or':_[_0xac8b('0x29')](_0x11b1a1,function(_0x3c5e6e){if(_0x3c5e6e[_0xac8b('0x3a')]!==_0xac8b('0x3b')){var _0x257012={};_0x257012[_0x3c5e6e[_0xac8b('0x27')]]={'$like':'%'+_0x26ac33[_0xac8b('0x2f')]['filter']+'%'};return _0x257012;}})});}_0xab0bfc=_[_0xac8b('0x3c')]({},_0xab0bfc,_0x26ac33[_0xac8b('0x3d')]);var _0x2d9ef6={'where':_0xab0bfc[_0xac8b('0x39')]};return db[_0xac8b('0x2a')][_0xac8b('0x1e')](_0x2d9ef6)['then'](function(_0xed3e99){_0x209390['count']=_0xed3e99;if(_0x26ac33[_0xac8b('0x2f')][_0xac8b('0x3e')]){_0xab0bfc['include']=[{'all':!![]}];}return db[_0xac8b('0x2a')][_0xac8b('0x3f')](_0xab0bfc);})[_0xac8b('0x40')](function(_0x44671f){_0x209390['rows']=_0x44671f;return _0x209390;})[_0xac8b('0x40')](respondWithFilteredResult(_0x31bf50,_0xab0bfc))[_0xac8b('0x41')](handleError(_0x31bf50,null));};exports[_0xac8b('0x42')]=function(_0x4471ca,_0x1960d7){var _0x54f5b7={'raw':!![],'where':{'id':_0x4471ca[_0xac8b('0x43')]['id']}},_0x20c65b={};_0x20c65b[_0xac8b('0x2e')]=_[_0xac8b('0x44')](db[_0xac8b('0x2a')][_0xac8b('0x2b')]);_0x20c65b[_0xac8b('0x2f')]=_[_0xac8b('0x44')](_0x4471ca[_0xac8b('0x2f')]);_0x20c65b[_0xac8b('0x30')]=_[_0xac8b('0x31')](_0x20c65b['model'],_0x20c65b[_0xac8b('0x2f')]);_0x54f5b7[_0xac8b('0x33')]=_[_0xac8b('0x31')](_0x20c65b['model'],qs['fields'](_0x4471ca['query'][_0xac8b('0x32')]));_0x54f5b7[_0xac8b('0x33')]=_0x54f5b7[_0xac8b('0x33')]['length']?_0x54f5b7[_0xac8b('0x33')]:_0x20c65b[_0xac8b('0x2e')];if(_0x4471ca['query'][_0xac8b('0x3e')]){_0x54f5b7[_0xac8b('0x45')]=[{'all':!![]}];}_0x54f5b7=_[_0xac8b('0x3c')]({},_0x54f5b7,_0x4471ca['options']);return db[_0xac8b('0x2a')][_0xac8b('0x46')](_0x54f5b7)[_0xac8b('0x40')](handleEntityNotFound(_0x1960d7,null))[_0xac8b('0x40')](respondWithResult(_0x1960d7,null))['catch'](handleError(_0x1960d7,null));};exports['create']=function(_0x3a978c,_0x39f64c){return db[_0xac8b('0x2a')][_0xac8b('0x47')](_0x3a978c[_0xac8b('0x48')],{})[_0xac8b('0x40')](respondWithResult(_0x39f64c,0xc9))[_0xac8b('0x41')](handleError(_0x39f64c,null));};exports['update']=function(_0x5796c2,_0x27a02f){if(_0x5796c2[_0xac8b('0x48')]['id']){delete _0x5796c2[_0xac8b('0x48')]['id'];}return db[_0xac8b('0x2a')][_0xac8b('0x46')]({'where':{'id':_0x5796c2[_0xac8b('0x43')]['id']}})[_0xac8b('0x40')](handleEntityNotFound(_0x27a02f,null))['then'](saveUpdates(_0x5796c2[_0xac8b('0x48')],null))[_0xac8b('0x40')](respondWithResult(_0x27a02f,null))['catch'](handleError(_0x27a02f,null));};exports['destroy']=function(_0x22f176,_0x22947e){return db[_0xac8b('0x2a')][_0xac8b('0x46')]({'where':{'id':_0x22f176[_0xac8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x22947e,null))[_0xac8b('0x40')](removeEntity(_0x22947e,null))[_0xac8b('0x41')](handleError(_0x22947e,null));}; \ No newline at end of file +var _0xb9e3=['rows','catch','show','params','keys','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','then','destroy','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x3b8a32,_0x3c41dc){var _0xec0503=function(_0xde8fda){while(--_0xde8fda){_0x3b8a32['push'](_0x3b8a32['shift']());}};_0xec0503(++_0x3c41dc);}(_0xb9e3,0xdc));var _0x3b9e=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0xb9e3[_0x36bf88];return _0x332914;};'use strict';var emlformat=require(_0x3b9e('0x0'));var rimraf=require(_0x3b9e('0x1'));var zipdir=require(_0x3b9e('0x2'));var jsonpatch=require(_0x3b9e('0x3'));var rp=require(_0x3b9e('0x4'));var moment=require('moment');var BPromise=require(_0x3b9e('0x5'));var Mustache=require(_0x3b9e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b9e('0x7'));var fs=require('fs');var fs_extra=require(_0x3b9e('0x8'));var _=require('lodash');var squel=require(_0x3b9e('0x9'));var crypto=require(_0x3b9e('0xa'));var jsforce=require(_0x3b9e('0xb'));var deskjs=require(_0x3b9e('0xc'));var toCsv=require(_0x3b9e('0xd'));var querystring=require(_0x3b9e('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b9e('0xf'));var authService=require(_0x3b9e('0x10'));var qs=require(_0x3b9e('0x11'));var as=require(_0x3b9e('0x12'));var hardwareService=require(_0x3b9e('0x13'));var logger=require('../../config/logger')(_0x3b9e('0x14'));var utils=require(_0x3b9e('0x15'));var config=require(_0x3b9e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b9e('0x17'))['db'];function respondWithStatusCode(_0x1cd6bc,_0x31cbf3){_0x31cbf3=_0x31cbf3||0xcc;return function(_0x32aa24){if(_0x32aa24){return _0x1cd6bc[_0x3b9e('0x18')](_0x31cbf3);}return _0x1cd6bc[_0x3b9e('0x19')](_0x31cbf3)['end']();};}function respondWithResult(_0x1c5c69,_0x3188b4){_0x3188b4=_0x3188b4||0xc8;return function(_0xf4afac){if(_0xf4afac){return _0x1c5c69[_0x3b9e('0x19')](_0x3188b4)[_0x3b9e('0x1a')](_0xf4afac);}};}function respondWithFilteredResult(_0x2c4d75,_0x366f9a){return function(_0x1336f0){if(_0x1336f0){var _0x5f50d1=typeof _0x366f9a['offset']===_0x3b9e('0x1b')&&typeof _0x366f9a[_0x3b9e('0x1c')]===_0x3b9e('0x1b');var _0x1ec65e=_0x1336f0['count'];var _0x24984b=_0x5f50d1?0x0:_0x366f9a['offset'];var _0x21fb05=_0x5f50d1?_0x1336f0['count']:_0x366f9a[_0x3b9e('0x1d')]+_0x366f9a[_0x3b9e('0x1c')];var _0x30f9cc;if(_0x21fb05>=_0x1ec65e){_0x21fb05=_0x1ec65e;_0x30f9cc=0xc8;}else{_0x30f9cc=0xce;}_0x2c4d75['status'](_0x30f9cc);return _0x2c4d75[_0x3b9e('0x1e')]('Content-Range',_0x24984b+'-'+_0x21fb05+'/'+_0x1ec65e)[_0x3b9e('0x1a')](_0x1336f0);}return null;};}function patchUpdates(_0x29b958){return function(_0xf12d62){try{jsonpatch[_0x3b9e('0x1f')](_0xf12d62,_0x29b958,!![]);}catch(_0x183ab9){return BPromise[_0x3b9e('0x20')](_0x183ab9);}return _0xf12d62[_0x3b9e('0x21')]();};}function saveUpdates(_0xe9b77e,_0x43baa7){return function(_0xc10506){if(_0xc10506){return _0xc10506['update'](_0xe9b77e)[_0x3b9e('0x22')](function(_0x49b1f1){return _0x49b1f1;});}return null;};}function removeEntity(_0x3f935b,_0x18720e){return function(_0x53707c){if(_0x53707c){return _0x53707c[_0x3b9e('0x23')]()[_0x3b9e('0x22')](function(){_0x3f935b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc078cc,_0x6b3d25){return function(_0x49e15e){if(!_0x49e15e){_0xc078cc['sendStatus'](0x194);}return _0x49e15e;};}function handleError(_0x368ff7,_0x500e8d){_0x500e8d=_0x500e8d||0x1f4;return function(_0x38d238){logger[_0x3b9e('0x24')](_0x38d238[_0x3b9e('0x25')]);if(_0x38d238[_0x3b9e('0x26')]){delete _0x38d238[_0x3b9e('0x26')];}_0x368ff7['status'](_0x500e8d)[_0x3b9e('0x27')](_0x38d238);};}exports['index']=function(_0x555f15,_0x131181){var _0x313be6={},_0x18c9dc={},_0x4552ba={'count':0x0,'rows':[]};var _0x358c55=_['map'](db[_0x3b9e('0x28')][_0x3b9e('0x29')],function(_0x443afd){return{'name':_0x443afd[_0x3b9e('0x2a')],'type':_0x443afd[_0x3b9e('0x2b')][_0x3b9e('0x2c')]};});_0x18c9dc[_0x3b9e('0x2d')]=_[_0x3b9e('0x2e')](_0x358c55,_0x3b9e('0x26'));_0x18c9dc[_0x3b9e('0x2f')]=_['keys'](_0x555f15[_0x3b9e('0x2f')]);_0x18c9dc[_0x3b9e('0x30')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],_0x18c9dc[_0x3b9e('0x2f')]);_0x313be6[_0x3b9e('0x31')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],qs['fields'](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x313be6[_0x3b9e('0x31')]=_0x313be6[_0x3b9e('0x31')][_0x3b9e('0x33')]?_0x313be6[_0x3b9e('0x31')]:_0x18c9dc[_0x3b9e('0x2d')];if(!_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x34')](_0x3b9e('0x35'))){_0x313be6['limit']=qs[_0x3b9e('0x1c')](_0x555f15['query'][_0x3b9e('0x1c')]);_0x313be6['offset']=qs[_0x3b9e('0x1d')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x1d')]);}_0x313be6[_0x3b9e('0x36')]=qs[_0x3b9e('0x37')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x37')]);_0x313be6[_0x3b9e('0x38')]=qs['filters'](_['pick'](_0x555f15[_0x3b9e('0x2f')],_0x18c9dc[_0x3b9e('0x30')]),_0x358c55);if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]){_0x313be6['where']=_[_0x3b9e('0x3a')](_0x313be6[_0x3b9e('0x38')],{'$or':_[_0x3b9e('0x2e')](_0x358c55,function(_0x170e7c){if(_0x170e7c[_0x3b9e('0x2b')]!==_0x3b9e('0x3b')){var _0x2c4823={};_0x2c4823[_0x170e7c['name']]={'$like':'%'+_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]+'%'};return _0x2c4823;}})});}_0x313be6=_[_0x3b9e('0x3a')]({},_0x313be6,_0x555f15[_0x3b9e('0x3c')]);var _0x17fae2={'where':_0x313be6[_0x3b9e('0x38')]};return db[_0x3b9e('0x28')][_0x3b9e('0x3d')](_0x17fae2)['then'](function(_0x2a9c73){_0x4552ba[_0x3b9e('0x3d')]=_0x2a9c73;if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x3e')]){_0x313be6[_0x3b9e('0x3f')]=[{'all':!![]}];}return db[_0x3b9e('0x28')]['findAll'](_0x313be6);})[_0x3b9e('0x22')](function(_0x596c86){_0x4552ba[_0x3b9e('0x40')]=_0x596c86;return _0x4552ba;})['then'](respondWithFilteredResult(_0x131181,_0x313be6))[_0x3b9e('0x41')](handleError(_0x131181,null));};exports[_0x3b9e('0x42')]=function(_0xcd8ca7,_0x2a93ef){var _0x3ca523={'raw':!![],'where':{'id':_0xcd8ca7[_0x3b9e('0x43')]['id']}},_0x2a33d6={};_0x2a33d6[_0x3b9e('0x2d')]=_[_0x3b9e('0x44')](db[_0x3b9e('0x28')][_0x3b9e('0x29')]);_0x2a33d6[_0x3b9e('0x2f')]=_[_0x3b9e('0x44')](_0xcd8ca7[_0x3b9e('0x2f')]);_0x2a33d6[_0x3b9e('0x30')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],_0x2a33d6[_0x3b9e('0x2f')]);_0x3ca523[_0x3b9e('0x31')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],qs[_0x3b9e('0x32')](_0xcd8ca7[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x3ca523[_0x3b9e('0x31')]=_0x3ca523['attributes'][_0x3b9e('0x33')]?_0x3ca523[_0x3b9e('0x31')]:_0x2a33d6[_0x3b9e('0x2d')];if(_0xcd8ca7['query']['includeAll']){_0x3ca523[_0x3b9e('0x3f')]=[{'all':!![]}];}_0x3ca523=_[_0x3b9e('0x3a')]({},_0x3ca523,_0xcd8ca7[_0x3b9e('0x3c')]);return db[_0x3b9e('0x28')]['find'](_0x3ca523)[_0x3b9e('0x22')](handleEntityNotFound(_0x2a93ef,null))[_0x3b9e('0x22')](respondWithResult(_0x2a93ef,null))[_0x3b9e('0x41')](handleError(_0x2a93ef,null));};exports[_0x3b9e('0x45')]=function(_0x2fd720,_0x10a52d){return db[_0x3b9e('0x28')][_0x3b9e('0x45')](_0x2fd720[_0x3b9e('0x46')],{})[_0x3b9e('0x22')](respondWithResult(_0x10a52d,0xc9))['catch'](handleError(_0x10a52d,null));};exports['update']=function(_0x2159c1,_0x5f1920){if(_0x2159c1[_0x3b9e('0x46')]['id']){delete _0x2159c1['body']['id'];}return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x2159c1[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x5f1920,null))[_0x3b9e('0x22')](saveUpdates(_0x2159c1['body'],null))['then'](respondWithResult(_0x5f1920,null))['catch'](handleError(_0x5f1920,null));};exports[_0x3b9e('0x23')]=function(_0x377b45,_0x582d2){return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x377b45[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x582d2,null))[_0x3b9e('0x22')](removeEntity(_0x582d2,null))[_0x3b9e('0x41')](handleError(_0x582d2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0731150..e6fc157 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 _0x1155=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','idField'];(function(_0x1cb6b7,_0x390222){var _0x40a13a=function(_0x37748e){while(--_0x37748e){_0x1cb6b7['push'](_0x1cb6b7['shift']());}};_0x40a13a(++_0x390222);}(_0x1155,0x1e0));var _0x5115=function(_0x362fe6,_0x7a05ef){_0x362fe6=_0x362fe6-0x0;var _0x51fea1=_0x1155[_0x362fe6];return _0x51fea1;};'use strict';var _=require(_0x5115('0x0'));var util=require(_0x5115('0x1'));var logger=require('../../config/logger')(_0x5115('0x2'));var moment=require(_0x5115('0x3'));var BPromise=require('bluebird');var rp=require(_0x5115('0x4'));var fs=require('fs');var path=require(_0x5115('0x5'));var rimraf=require(_0x5115('0x6'));var config=require(_0x5115('0x7'));var attributes=require(_0x5115('0x8'));module[_0x5115('0x9')]=function(_0x289a35,_0x4f4a1f){return _0x289a35[_0x5115('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x5115('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefa8=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x1df26b,_0x3e5093){var _0x1a508e=function(_0x4c5dad){while(--_0x4c5dad){_0x1df26b['push'](_0x1df26b['shift']());}};_0x1a508e(++_0x3e5093);}(_0xefa8,0x112));var _0x8efa=function(_0x32a7a3,_0x2f11ed){_0x32a7a3=_0x32a7a3-0x0;var _0x4201bf=_0xefa8[_0x32a7a3];return _0x4201bf;};'use strict';var _=require(_0x8efa('0x0'));var util=require(_0x8efa('0x1'));var logger=require(_0x8efa('0x2'))(_0x8efa('0x3'));var moment=require(_0x8efa('0x4'));var BPromise=require(_0x8efa('0x5'));var rp=require(_0x8efa('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8efa('0x7'));var config=require('../../config/environment');var attributes=require(_0x8efa('0x8'));module[_0x8efa('0x9')]=function(_0x541842,_0x2cf4ab){return _0x541842[_0x8efa('0xa')](_0x8efa('0xb'),attributes,{'tableName':_0x8efa('0xc'),'paranoid':![],'indexes':[{'name':_0x8efa('0xd'),'fields':[_0x8efa('0xe'),_0x8efa('0xf')],'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 b9163e0..21cce52 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 _0x38a1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','bluebird'];(function(_0x25c638,_0x18e767){var _0x528849=function(_0x2330d7){while(--_0x2330d7){_0x25c638['push'](_0x25c638['shift']());}};_0x528849(++_0x18e767);}(_0x38a1,0x149));var _0x138a=function(_0xfdbb7c,_0x17cb51){_0xfdbb7c=_0xfdbb7c-0x0;var _0x402b3a=_0x38a1[_0xfdbb7c];return _0x402b3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x138a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x138a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x138a('0x2'));var logger=require(_0x138a('0x3'))(_0x138a('0x4'));var config=require(_0x138a('0x5'));var jayson=require(_0x138a('0x6'));var client=jayson[_0x138a('0x7')][_0x138a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239c08,_0x2e88ae,_0x202a64){return new BPromise(function(_0x116f92,_0x511e9f){return client[_0x138a('0x9')](_0x239c08,_0x202a64)[_0x138a('0xa')](function(_0x3c2805){logger[_0x138a('0xb')]('DeskField,\x20%s,\x20%s',_0x2e88ae,_0x138a('0xc'));logger[_0x138a('0xd')](_0x138a('0xe'),_0x2e88ae,_0x138a('0xc'),JSON[_0x138a('0xf')](_0x3c2805));if(_0x3c2805['error']){if(_0x3c2805[_0x138a('0x10')][_0x138a('0x11')]===0x1f4){logger[_0x138a('0x10')]('DeskField,\x20%s,\x20%s',_0x2e88ae,_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);return _0x511e9f(_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);}logger[_0x138a('0x10')](_0x138a('0x13'),_0x2e88ae,_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);return _0x116f92(_0x3c2805[_0x138a('0x10')]['message']);}else{logger['info'](_0x138a('0x13'),_0x2e88ae,'request\x20sent');_0x116f92(_0x3c2805[_0x138a('0x14')][_0x138a('0x12')]);}})[_0x138a('0x15')](function(_0x51db02){logger[_0x138a('0x10')](_0x138a('0x13'),_0x2e88ae,_0x51db02);_0x511e9f(_0x51db02);});});} \ No newline at end of file +var _0x9fe6=['code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x9fe6,0x1bc));var _0x69fe=function(_0x3ad850,_0x4d8004){_0x3ad850=_0x3ad850-0x0;var _0x5326ab=_0x9fe6[_0x3ad850];return _0x5326ab;};'use strict';var _=require('lodash');var util=require(_0x69fe('0x0'));var moment=require(_0x69fe('0x1'));var BPromise=require(_0x69fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69fe('0x3'));var db=require(_0x69fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69fe('0x5'))(_0x69fe('0x6'));var config=require('../../config/environment');var jayson=require(_0x69fe('0x7'));var client=jayson[_0x69fe('0x8')][_0x69fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd2e696,_0x1c1f2f,_0xf22e83){return new BPromise(function(_0xb7312c,_0x1e90af){return client[_0x69fe('0xa')](_0xd2e696,_0xf22e83)[_0x69fe('0xb')](function(_0x3a83de){logger[_0x69fe('0xc')](_0x69fe('0xd'),_0x1c1f2f,'request\x20sent');logger['debug'](_0x69fe('0xe'),_0x1c1f2f,_0x69fe('0xf'),JSON[_0x69fe('0x10')](_0x3a83de));if(_0x3a83de[_0x69fe('0x11')]){if(_0x3a83de[_0x69fe('0x11')][_0x69fe('0x12')]===0x1f4){logger[_0x69fe('0x11')](_0x69fe('0xd'),_0x1c1f2f,_0x3a83de['error']['message']);return _0x1e90af(_0x3a83de[_0x69fe('0x11')][_0x69fe('0x13')]);}logger[_0x69fe('0x11')](_0x69fe('0xd'),_0x1c1f2f,_0x3a83de['error'][_0x69fe('0x13')]);return _0xb7312c(_0x3a83de[_0x69fe('0x11')]['message']);}else{logger['info'](_0x69fe('0xd'),_0x1c1f2f,_0x69fe('0xf'));_0xb7312c(_0x3a83de[_0x69fe('0x14')][_0x69fe('0x13')]);}})[_0x69fe('0x15')](function(_0x3440c7){logger['error'](_0x69fe('0xd'),_0x1c1f2f,_0x3440c7);_0x1e90af(_0x3440c7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 89cf493..27cf12e 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 _0x1238=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','util','path'];(function(_0x120c1f,_0x10ea80){var _0x28ba8b=function(_0x2b6f11){while(--_0x2b6f11){_0x120c1f['push'](_0x120c1f['shift']());}};_0x28ba8b(++_0x10ea80);}(_0x1238,0x1e2));var _0x8123=function(_0x47638d,_0x2c6518){_0x47638d=_0x47638d-0x0;var _0x42ccbb=_0x1238[_0x47638d];return _0x42ccbb;};'use strict';var multer=require('multer');var util=require(_0x8123('0x0'));var path=require(_0x8123('0x1'));var timeout=require(_0x8123('0x2'));var express=require(_0x8123('0x3'));var router=express[_0x8123('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8123('0x5'));var config=require(_0x8123('0x6'));var controller=require(_0x8123('0x7'));router[_0x8123('0x8')]('/',auth[_0x8123('0x9')](),controller[_0x8123('0xa')]);router[_0x8123('0x8')]('/:id',auth[_0x8123('0x9')](),controller[_0x8123('0xb')]);router[_0x8123('0x8')](_0x8123('0xc'),auth[_0x8123('0x9')](),controller[_0x8123('0xd')]);router[_0x8123('0x8')](_0x8123('0xe'),auth['isAuthenticated'](),controller[_0x8123('0xf')]);router[_0x8123('0x10')]('/',auth[_0x8123('0x9')](),controller[_0x8123('0x11')]);router[_0x8123('0x10')](_0x8123('0xc'),auth['isAuthenticated'](),controller[_0x8123('0x12')]);router[_0x8123('0x13')](_0x8123('0x14'),auth[_0x8123('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8123('0x15')]);module['exports']=router; \ No newline at end of file +var _0x7c8f=['create','/:id/configurations','addConfiguration','put','delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post'];(function(_0x132a19,_0x26fae6){var _0x33bf22=function(_0xf80837){while(--_0xf80837){_0x132a19['push'](_0x132a19['shift']());}};_0x33bf22(++_0x26fae6);}(_0x7c8f,0x1bf));var _0xf7c8=function(_0x232bfe,_0x20b341){_0x232bfe=_0x232bfe-0x0;var _0x2944dc=_0x7c8f[_0x232bfe];return _0x2944dc;};'use strict';var multer=require('multer');var util=require(_0xf7c8('0x0'));var path=require(_0xf7c8('0x1'));var timeout=require(_0xf7c8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf7c8('0x3'));var auth=require(_0xf7c8('0x4'));var interaction=require(_0xf7c8('0x5'));var config=require(_0xf7c8('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xf7c8('0x7')]('/',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0x9')]);router['get'](_0xf7c8('0xa'),auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xb')]);router[_0xf7c8('0x7')]('/:id/configurations',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xc')]);router['get'](_0xf7c8('0xd'),auth[_0xf7c8('0x8')](),controller['getFields']);router[_0xf7c8('0xe')]('/',auth[_0xf7c8('0x8')](),controller[_0xf7c8('0xf')]);router[_0xf7c8('0xe')](_0xf7c8('0x10'),auth[_0xf7c8('0x8')](),controller[_0xf7c8('0x11')]);router[_0xf7c8('0x12')](_0xf7c8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xf7c8('0x13')]('/:id',auth[_0xf7c8('0x8')](),controller['destroy']);module[_0xf7c8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 45b3596..a200f0a 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 _0xacd6=['exports','STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacd6,0xef));var _0x6acd=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xacd6[_0x2e78e9];return _0x35aad4;};'use strict';var Sequelize=require(_0x6acd('0x0'));module[_0x6acd('0x1')]={'name':{'type':Sequelize[_0x6acd('0x2')]},'username':{'type':Sequelize[_0x6acd('0x2')]},'password':{'type':Sequelize[_0x6acd('0x2')]},'remoteUri':{'type':Sequelize[_0x6acd('0x2')]},'tenantId':{'type':Sequelize[_0x6acd('0x2')]},'clientId':{'type':Sequelize[_0x6acd('0x2')]},'clientSecret':{'type':Sequelize[_0x6acd('0x2')]},'serverUrl':{'type':Sequelize[_0x6acd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6acd('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6acd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5e0e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x5e0e,0x89));var _0xe5e0=function(_0x470e3f,_0x3b513d){_0x470e3f=_0x470e3f-0x0;var _0x4fd22b=_0x5e0e[_0x470e3f];return _0x4fd22b;};'use strict';var Sequelize=require(_0xe5e0('0x0'));module[_0xe5e0('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe5e0('0x2')]},'password':{'type':Sequelize[_0xe5e0('0x2')]},'remoteUri':{'type':Sequelize[_0xe5e0('0x2')]},'tenantId':{'type':Sequelize[_0xe5e0('0x2')]},'clientId':{'type':Sequelize[_0xe5e0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe5e0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xe5e0('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3e4627b..5f0f5ba 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 _0x7e37=['clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','LogicalName','@odata.type','push','MetadataId','all','BooleanAttributeMetadata','forEach','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','api','../../mysqldb','../../components/integrations/configuration','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','name','status','index','map','Dynamics365Account','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','options','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','channel','Dynamics365Field','Subjects','Descriptions','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','phonenumber','directioncode','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId'];(function(_0x98a035,_0x20d0ad){var _0x496a2c=function(_0x5923ab){while(--_0x5923ab){_0x98a035['push'](_0x98a035['shift']());}};_0x496a2c(++_0x20d0ad);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var _=require(_0x77e3('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x77e3('0x3'));var db=require(_0x77e3('0x4'))['db'];var integrations=require(_0x77e3('0x5'));function respondWithResult(_0xdff3fb,_0x1bce95){_0x1bce95=_0x1bce95||0xc8;return function(_0x4d45df){if(_0x4d45df){return _0xdff3fb['status'](_0x1bce95)[_0x77e3('0x6')](_0x4d45df);}};}function respondWithFilteredResult(_0x111451,_0xcb6b7){return function(_0x377126){if(_0x377126){var _0x3cedb1=typeof _0xcb6b7[_0x77e3('0x7')]==='undefined'&&typeof _0xcb6b7[_0x77e3('0x8')]===_0x77e3('0x9');var _0x3b9b35=_0x377126['count'];var _0x3b0237=_0x3cedb1?0x0:_0xcb6b7[_0x77e3('0x7')];var _0x376ebe=_0x3cedb1?_0x377126[_0x77e3('0xa')]:_0xcb6b7[_0x77e3('0x7')]+_0xcb6b7[_0x77e3('0x8')];var _0x44ee78;if(_0x376ebe>=_0x3b9b35){_0x376ebe=_0x3b9b35;_0x44ee78=0xc8;}else{_0x44ee78=0xce;}_0x111451['status'](_0x44ee78);return _0x111451[_0x77e3('0xb')](_0x77e3('0xc'),_0x3b0237+'-'+_0x376ebe+'/'+_0x3b9b35)[_0x77e3('0x6')](_0x377126);}return null;};}function saveUpdates(_0x550a28){return function(_0x36896b){if(_0x36896b){return _0x36896b[_0x77e3('0xd')](_0x550a28)[_0x77e3('0xe')](function(_0x18e9e7){return _0x18e9e7;});}return null;};}function removeEntity(_0x435d88){return function(_0x10d6ae){if(_0x10d6ae){return _0x10d6ae[_0x77e3('0xf')]()['then'](function(){_0x435d88['status'](0xcc)[_0x77e3('0x10')]();});}};}function handleEntityNotFound(_0x4a0f08){return function(_0x57bf98){if(!_0x57bf98){_0x4a0f08[_0x77e3('0x11')](0x194);}return _0x57bf98;};}function handleError(_0x174ea6,_0x254127){_0x254127=_0x254127||0x1f4;return function(_0x3d2090){logger['error'](_0x3d2090['stack']);if(_0x3d2090[_0x77e3('0x12')]){delete _0x3d2090[_0x77e3('0x12')];}_0x174ea6[_0x77e3('0x13')](_0x254127)['send'](_0x3d2090);};}exports[_0x77e3('0x14')]=function(_0x14545c,_0x30cd7b){var _0x1ad280={},_0x37aec5={},_0x4311d1={'count':0x0,'rows':[]};var _0x3f3562=_[_0x77e3('0x15')](db[_0x77e3('0x16')][_0x77e3('0x17')],function(_0x257cbd){return{'name':_0x257cbd['fieldName'],'type':_0x257cbd[_0x77e3('0x18')][_0x77e3('0x19')]};});_0x37aec5[_0x77e3('0x1a')]=_[_0x77e3('0x15')](_0x3f3562,'name');_0x37aec5['query']=_[_0x77e3('0x1b')](_0x14545c[_0x77e3('0x1c')]);_0x37aec5[_0x77e3('0x1d')]=_[_0x77e3('0x1e')](_0x37aec5[_0x77e3('0x1a')],_0x37aec5['query']);_0x1ad280[_0x77e3('0x1f')]=_[_0x77e3('0x1e')](_0x37aec5[_0x77e3('0x1a')],qs[_0x77e3('0x20')](_0x14545c[_0x77e3('0x1c')][_0x77e3('0x20')]));_0x1ad280[_0x77e3('0x1f')]=_0x1ad280[_0x77e3('0x1f')][_0x77e3('0x21')]?_0x1ad280[_0x77e3('0x1f')]:_0x37aec5[_0x77e3('0x1a')];if(!_0x14545c[_0x77e3('0x1c')][_0x77e3('0x22')](_0x77e3('0x23'))){_0x1ad280[_0x77e3('0x8')]=qs[_0x77e3('0x8')](_0x14545c[_0x77e3('0x1c')]['limit']);_0x1ad280[_0x77e3('0x7')]=qs[_0x77e3('0x7')](_0x14545c[_0x77e3('0x1c')]['offset']);}_0x1ad280[_0x77e3('0x24')]=qs['sort'](_0x14545c[_0x77e3('0x1c')][_0x77e3('0x25')]);_0x1ad280[_0x77e3('0x26')]=qs[_0x77e3('0x1d')](_[_0x77e3('0x27')](_0x14545c[_0x77e3('0x1c')],_0x37aec5[_0x77e3('0x1d')]),_0x3f3562);if(_0x14545c[_0x77e3('0x1c')][_0x77e3('0x28')]){_0x1ad280[_0x77e3('0x26')]=_['merge'](_0x1ad280[_0x77e3('0x26')],{'$or':_[_0x77e3('0x15')](_0x3f3562,function(_0x13ca2c){if(_0x13ca2c['type']!==_0x77e3('0x29')){var _0x390413={};_0x390413[_0x13ca2c[_0x77e3('0x12')]]={'$like':'%'+_0x14545c['query']['filter']+'%'};return _0x390413;}})});}_0x1ad280=_[_0x77e3('0x2a')]({},_0x1ad280,_0x14545c['options']);var _0x3ad242={'where':_0x1ad280[_0x77e3('0x26')]};return db['Dynamics365Account'][_0x77e3('0xa')](_0x3ad242)[_0x77e3('0xe')](function(_0x2e8dc0){_0x4311d1[_0x77e3('0xa')]=_0x2e8dc0;if(_0x14545c[_0x77e3('0x1c')]['includeAll']){_0x1ad280[_0x77e3('0x2b')]=[{'all':!![]}];}return db[_0x77e3('0x16')][_0x77e3('0x2c')](_0x1ad280);})[_0x77e3('0xe')](function(_0x1ba4eb){_0x4311d1[_0x77e3('0x2d')]=_0x1ba4eb;return _0x4311d1;})[_0x77e3('0xe')](respondWithFilteredResult(_0x30cd7b,_0x1ad280))[_0x77e3('0x2e')](handleError(_0x30cd7b,null));};exports[_0x77e3('0x2f')]=function(_0x3ee77e,_0x26d1f9){var _0x3fce1a={'raw':![],'where':{'id':_0x3ee77e['params']['id']}},_0x356790={};_0x356790[_0x77e3('0x1a')]=_['keys'](db[_0x77e3('0x16')][_0x77e3('0x17')]);_0x356790['query']=_[_0x77e3('0x1b')](_0x3ee77e[_0x77e3('0x1c')]);_0x356790[_0x77e3('0x1d')]=_[_0x77e3('0x1e')](_0x356790[_0x77e3('0x1a')],_0x356790[_0x77e3('0x1c')]);_0x3fce1a['attributes']=_[_0x77e3('0x1e')](_0x356790[_0x77e3('0x1a')],qs[_0x77e3('0x20')](_0x3ee77e[_0x77e3('0x1c')]['fields']));_0x3fce1a[_0x77e3('0x1f')]=_0x3fce1a[_0x77e3('0x1f')][_0x77e3('0x21')]?_0x3fce1a[_0x77e3('0x1f')]:_0x356790['model'];if(_0x3ee77e['query']['includeAll']){_0x3fce1a[_0x77e3('0x2b')]=[{'all':!![]}];}_0x3fce1a=_['merge']({},_0x3fce1a,_0x3ee77e[_0x77e3('0x30')]);return db['Dynamics365Account'][_0x77e3('0x31')](_0x3fce1a)[_0x77e3('0xe')](handleEntityNotFound(_0x26d1f9,null))[_0x77e3('0xe')](respondWithResult(_0x26d1f9,null))['catch'](handleError(_0x26d1f9,null));};exports[_0x77e3('0x32')]=function(_0x5a9edb,_0x425e14){return db['Dynamics365Account'][_0x77e3('0x32')](_0x5a9edb['body'],{})[_0x77e3('0xe')](respondWithResult(_0x425e14,0xc9))[_0x77e3('0x2e')](handleError(_0x425e14,null));};exports[_0x77e3('0xd')]=function(_0x4f44ad,_0x107cf7){if(_0x4f44ad['body']['id']){delete _0x4f44ad[_0x77e3('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x4f44ad[_0x77e3('0x34')]['id']}})['then'](handleEntityNotFound(_0x107cf7,null))[_0x77e3('0xe')](saveUpdates(_0x4f44ad['body'],null))[_0x77e3('0xe')](respondWithResult(_0x107cf7,null))[_0x77e3('0x2e')](handleError(_0x107cf7,null));};exports[_0x77e3('0xf')]=function(_0x252116,_0x99e778){return db[_0x77e3('0x16')][_0x77e3('0x31')]({'where':{'id':_0x252116[_0x77e3('0x34')]['id']}})[_0x77e3('0xe')](handleEntityNotFound(_0x99e778,null))[_0x77e3('0xe')](removeEntity(_0x99e778,null))[_0x77e3('0x2e')](handleError(_0x99e778,null));};exports[_0x77e3('0x35')]=function(_0x5b0278,_0x268991){var _0x42c3c4={};var _0x4cd73a={};var _0x292f0f;var _0x778572;return db[_0x77e3('0x16')][_0x77e3('0x36')]({'where':{'id':_0x5b0278[_0x77e3('0x34')]['id']}})['then'](handleEntityNotFound(_0x268991,null))[_0x77e3('0xe')](function(_0x44e835){if(_0x44e835){_0x292f0f=_0x44e835;_0x4cd73a['model']=_['keys'](db[_0x77e3('0x37')][_0x77e3('0x17')]);_0x4cd73a[_0x77e3('0x1c')]=_['keys'](_0x5b0278[_0x77e3('0x1c')]);_0x4cd73a[_0x77e3('0x1d')]=_[_0x77e3('0x1e')](_0x4cd73a['model'],_0x4cd73a[_0x77e3('0x1c')]);_0x42c3c4[_0x77e3('0x1f')]=_[_0x77e3('0x1e')](_0x4cd73a[_0x77e3('0x1a')],qs[_0x77e3('0x20')](_0x5b0278[_0x77e3('0x1c')]['fields']));_0x42c3c4[_0x77e3('0x1f')]=_0x42c3c4[_0x77e3('0x1f')][_0x77e3('0x21')]?_0x42c3c4['attributes']:_0x4cd73a[_0x77e3('0x1a')];_0x42c3c4['order']=qs[_0x77e3('0x25')](_0x5b0278[_0x77e3('0x1c')]['sort']);_0x42c3c4[_0x77e3('0x26')]=qs['filters'](_[_0x77e3('0x27')](_0x5b0278[_0x77e3('0x1c')],_0x4cd73a[_0x77e3('0x1d')]));if(_0x5b0278[_0x77e3('0x1c')][_0x77e3('0x28')]){_0x42c3c4[_0x77e3('0x26')]=_['merge'](_0x42c3c4[_0x77e3('0x26')],{'$or':_[_0x77e3('0x15')](_0x42c3c4[_0x77e3('0x1f')],function(_0xf26fb0){var _0x1977e5={};_0x1977e5[_0xf26fb0]={'$like':'%'+_0x5b0278[_0x77e3('0x1c')][_0x77e3('0x28')]+'%'};return _0x1977e5;})});}_0x42c3c4=_[_0x77e3('0x2a')]({},_0x42c3c4,_0x5b0278[_0x77e3('0x30')]);return _0x292f0f[_0x77e3('0x35')](_0x42c3c4);}})[_0x77e3('0xe')](function(_0x9e9c04){if(_0x9e9c04){_0x778572=_0x9e9c04[_0x77e3('0x21')];if(!_0x5b0278[_0x77e3('0x1c')][_0x77e3('0x22')](_0x77e3('0x23'))){_0x42c3c4[_0x77e3('0x8')]=qs[_0x77e3('0x8')](_0x5b0278[_0x77e3('0x1c')]['limit']);_0x42c3c4[_0x77e3('0x7')]=qs[_0x77e3('0x7')](_0x5b0278[_0x77e3('0x1c')][_0x77e3('0x7')]);}return _0x292f0f[_0x77e3('0x35')](_0x42c3c4);}})[_0x77e3('0xe')](function(_0x33a84b){if(_0x33a84b){return _0x33a84b?{'count':_0x778572,'rows':_0x33a84b}:null;}})['then'](respondWithResult(_0x268991,null))['catch'](handleError(_0x268991,null));};exports[_0x77e3('0x38')]=function(_0x33235e,_0x5933a6){if(_0x33235e[_0x77e3('0x33')]['id']){delete _0x33235e[_0x77e3('0x33')]['id'];}return db[_0x77e3('0x16')]['findOne']({'where':{'id':_0x33235e[_0x77e3('0x34')]['id']}})[_0x77e3('0xe')](handleEntityNotFound(_0x5933a6,null))['then'](function(_0x28b6a5){if(_0x28b6a5){_0x33235e[_0x77e3('0x33')][_0x77e3('0x39')]=_0x28b6a5['id'];_0x33235e['body']['Subjects']=integrations[_0x77e3('0x3a')](_0x33235e['body'][_0x77e3('0x3b')],_0x33235e[_0x77e3('0x33')][_0x77e3('0x18')]);_0x33235e[_0x77e3('0x33')]['Descriptions']=integrations['getDescriptions'](_0x33235e['body'][_0x77e3('0x3b')],_0x33235e[_0x77e3('0x33')][_0x77e3('0x18')]);return db[_0x77e3('0x37')]['create'](_0x33235e[_0x77e3('0x33')],{'include':[{'model':db[_0x77e3('0x3c')],'as':_0x77e3('0x3d')},{'model':db['Dynamics365Field'],'as':_0x77e3('0x3e')}]});}return null;})[_0x77e3('0xe')](respondWithResult(_0x5933a6,null))[_0x77e3('0x2e')](handleError(_0x5933a6,null));};function sanitizeRemoteUri(_0x16db07){var _0x45cf7a=_0x16db07[_0x77e3('0x3f')](-0x1);if(_0x45cf7a==='/')return _0x16db07[_0x77e3('0x40')](0x0,_0x16db07[_0x77e3('0x41')](_0x45cf7a));return _0x16db07;}function getWebApiUrl(_0x3a07fd){return util[_0x77e3('0x42')]('%s/api/data/v9.0/',_0x3a07fd);}exports[_0x77e3('0x43')]=function(_0x17a5e9,_0xf5daa4){var _0x224456=_0x17a5e9[_0x77e3('0x1c')][_0x77e3('0x44')];var _0xf31ed7=_0x224456===_0x77e3('0x45')?_0x77e3('0x46'):_0x77e3('0x47');var _0x173ff5='';var _0x3ca514='';var _0x566b3d='';var _0x2c6c3b='';var _0x29644a='';var _0xb15e9='';var _0xafc8d='';var _0x59cf86='';var _0x24d384=['title',_0x77e3('0x48'),_0x77e3('0x49'),'ownerid',_0x77e3('0x4a'),'subject',_0x77e3('0x4b'),'regardingobjectid',_0x77e3('0x4c'),'phonecall_activity_parties'];var _0x3765a3=['accountidname','accountidyominame',_0x77e3('0x4d'),'billedserviceunits',_0x77e3('0x4e'),_0x77e3('0x4f'),_0x77e3('0x50'),_0x77e3('0x51'),_0x77e3('0x52'),_0x77e3('0x53'),_0x77e3('0x54'),_0x77e3('0x55'),_0x77e3('0x56'),_0x77e3('0x57'),_0x77e3('0x58'),_0x77e3('0x59'),_0x77e3('0x5a'),'customeridyominame',_0x77e3('0x5b'),_0x77e3('0x5c'),_0x77e3('0x5d'),_0x77e3('0x5e'),'escalatedon','exchangerate',_0x77e3('0x5f'),_0x77e3('0x60'),_0x77e3('0x61'),_0x77e3('0x62'),'kbarticleidname','lastonholdtime',_0x77e3('0x63'),'modifiedbyexternalpartyname',_0x77e3('0x64'),_0x77e3('0x65'),'modifiedbyyominame',_0x77e3('0x66'),_0x77e3('0x67'),_0x77e3('0x68'),_0x77e3('0x69'),'msdyn_iotalertname',_0x77e3('0x6a'),_0x77e3('0x6b'),'overriddencreatedon','owneridname',_0x77e3('0x6c'),'owneridyominame',_0x77e3('0x6d'),_0x77e3('0x6e'),_0x77e3('0x6f'),'prioritycodename',_0x77e3('0x70'),'productserialnumber',_0x77e3('0x71'),_0x77e3('0x72'),'responseby',_0x77e3('0x73'),_0x77e3('0x74'),'sentimentvalue','slainvokedidname',_0x77e3('0x75'),_0x77e3('0x76'),_0x77e3('0x77'),_0x77e3('0x78'),'subjectidname',_0x77e3('0x79'),_0x77e3('0x7a'),_0x77e3('0x7b'),_0x77e3('0x7c'),_0x77e3('0x7d'),_0x77e3('0x7e')];var _0x590dfc=_0x24d384[_0x77e3('0x7f')](_0x3765a3);return db[_0x77e3('0x16')][_0x77e3('0x36')]({'where':{'id':_0x17a5e9[_0x77e3('0x34')]['id']},'attributes':['id',_0x77e3('0x80'),'password',_0x77e3('0x81'),_0x77e3('0x82'),_0x77e3('0x83'),_0x77e3('0x84'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0x77e3('0x85'),'attributes':['id',_0x77e3('0x86'),_0x77e3('0x87')]}]})['then'](handleEntityNotFound(_0xf5daa4,null))[_0x77e3('0xe')](function(_0x334113){if(_0x334113){if(_0x334113[_0x77e3('0x88')]){_0x334113[_0x77e3('0x89')]=_0x334113[_0x77e3('0x85')][_0x77e3('0x86')];_0x59cf86=sanitizeRemoteUri(_0x334113[_0x77e3('0x85')][_0x77e3('0x87')]);_0xafc8d=getWebApiUrl(_0x59cf86);return _0x334113;}_0x59cf86=sanitizeRemoteUri(_0x334113['remoteUri']);_0xafc8d=getWebApiUrl(_0x59cf86);var _0x23ad7d={'method':_0x77e3('0x8a'),'uri':_0x77e3('0x8b')+_0x334113['tenantId']+_0x77e3('0x8c'),'form':{'client_id':_0x334113[_0x77e3('0x83')],'resource':_0x59cf86,'username':_0x334113[_0x77e3('0x80')],'password':_0x334113[_0x77e3('0x8d')],'grant_type':_0x77e3('0x8d'),'client_secret':_0x334113[_0x77e3('0x84')]},'json':!![]};return rp(_0x23ad7d);}})[_0x77e3('0xe')](function(_0x46d91f){_0xb15e9=_0x46d91f[_0x77e3('0x89')];var _0x5139fa={'method':_0x77e3('0x8e'),'uri':encodeURI(_0xafc8d+_0x77e3('0x8f')+_0xf31ed7+'\x27'),'headers':{'Authorization':_0x77e3('0x90')+_0xb15e9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5139fa);})[_0x77e3('0xe')](function(_0x440e5c){var _0x5597ab=_0x440e5c[_0x77e3('0x91')][0x0];var _0x3bc00b=_0x5597ab['MetadataId'];var _0x54389f={'method':_0x77e3('0x8e'),'uri':_0xafc8d+_0x77e3('0x92')+_0x3bc00b+_0x77e3('0x93'),'headers':{'Authorization':_0x77e3('0x90')+_0xb15e9,'If-None-Match':null,'OData-Version':_0x77e3('0x94')},'json':!![]};return rp(_0x54389f);})[_0x77e3('0xe')](function(_0x3298e9){_0x173ff5=_0x3298e9;_0x3ca514=_0x173ff5[_0x77e3('0x95')];_0x3ca514=_[_0x77e3('0x96')](_0x3ca514,function(_0x1c52ff){return!_0x590dfc['includes'](_0x1c52ff[_0x77e3('0x97')]);});var _0x132dcc=[];var _0x51ce06=[];_0x3ca514['forEach'](function(_0x41d43c){if(_0x41d43c[_0x77e3('0x98')]){var _0x1332c7=_0x41d43c[_0x77e3('0x98')][_0x77e3('0x40')](_0x41d43c['@odata.type'][_0x77e3('0x41')]('.')+0x1);if(_0x1332c7==='PicklistAttributeMetadata'){_0x132dcc[_0x77e3('0x99')](getSelectList(_0xafc8d,_0x224456,_0x51ce06,_0x173ff5['MetadataId'],_0x41d43c[_0x77e3('0x9a')],_0xb15e9));}}});return Promise[_0x77e3('0x9b')](_0x132dcc);})[_0x77e3('0xe')](function(_0x13e058){_0x566b3d=_0x13e058[0x0];var _0x51708e=[];var _0x3c6e7f=[];_0x3ca514['forEach'](function(_0x1349aa){if(!_['isNil'](_0x1349aa[_0x77e3('0x98')])){var _0x4f1bdd=_0x1349aa[_0x77e3('0x98')][_0x77e3('0x40')](_0x1349aa[_0x77e3('0x98')][_0x77e3('0x41')]('.')+0x1);if(_0x4f1bdd===_0x77e3('0x9c')){_0x51708e['push'](getBooleanList(_0xafc8d,_0x224456,_0x3c6e7f,_0x173ff5[_0x77e3('0x9a')],_0x1349aa[_0x77e3('0x9a')],_0xb15e9));}}});return Promise[_0x77e3('0x9b')](_0x51708e);})[_0x77e3('0xe')](function(_0x50b4cb){_0x2c6c3b=_0x50b4cb[0x0];var _0x469374=[];var _0x3f5c53=[];_0x3ca514[_0x77e3('0x9d')](function(_0x325448){if(_0x325448[_0x77e3('0x98')]){var _0x54d997=_0x325448['@odata.type']['substring'](_0x325448[_0x77e3('0x98')][_0x77e3('0x41')]('.')+0x1);if(_0x54d997===_0x77e3('0x9e')||_0x54d997===_0x77e3('0x9f')||_0x54d997==='BigIntAttributeMetadata'||_0x54d997===_0x77e3('0xa0')||_0x54d997===_0x77e3('0xa1')||_0x54d997===_0x77e3('0xa2')||_0x54d997===_0x77e3('0xa3')||_0x54d997===_0x77e3('0xa4')||_0x54d997===_0x77e3('0xa5')||_0x54d997===_0x77e3('0xa6')){_0x469374['push'](getInputList(_0xafc8d,_0x224456,_0x54d997,_0x3f5c53,_0x173ff5[_0x77e3('0x9a')],_0x325448[_0x77e3('0x9a')],_0xb15e9));}}});return Promise[_0x77e3('0x9b')](_0x469374);})['then'](function(_0x20627f){_0x29644a=_0x20627f[0x0];var _0x7e8cc9=_0x566b3d[_0x77e3('0x7f')](_0x2c6c3b)[_0x77e3('0x7f')](_0x29644a);var _0x1546e2={'count':_0x7e8cc9[_0x77e3('0x21')],'rows':_0x7e8cc9};return _0x1546e2;})['then'](respondWithResult(_0xf5daa4,null))[_0x77e3('0x2e')](function(_0x37fabc){var _0x4d244f=_0x17a5e9['query'][_0x77e3('0xa7')]?0x1f4:_0x37fabc[_0x77e3('0xa8')]||0x1f4;logger[_0x77e3('0xa9')](_0x37fabc['stack']);delete _0x37fabc['name'];if(_0x4d244f===0x191){_0x4d244f=0x190;}_0xf5daa4[_0x77e3('0x13')](_0x4d244f)[_0x77e3('0xaa')](_0x17a5e9[_0x77e3('0x1c')]['test']?{'message':_0x77e3('0xab'),'statusCode':_0x37fabc['statusCode']}:_0x37fabc);});};function getSelectList(_0x435f52,_0x586249,_0x5e8de4,_0x286df0,_0x5275e3,_0x48662f){var _0x3bb1fc={'method':_0x77e3('0x8e'),'uri':_0x435f52+_0x77e3('0x92')+_0x286df0+')/Attributes('+_0x5275e3+_0x77e3('0xac')+_0x77e3('0xad'),'headers':{'Authorization':_0x77e3('0x90')+_0x48662f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3bb1fc)[_0x77e3('0xe')](function(_0x36cc91){var _0x388126=[];var _0x5b3b8f=_0x36cc91[_0x77e3('0xae')][_0x77e3('0xaf')];_0x5b3b8f[_0x77e3('0x9d')](function(_0x45aa1c){_0x388126[_0x77e3('0x99')]({'name':_0x45aa1c[_0x77e3('0xb0')][_0x77e3('0xb1')]['Label'],'value':String(_0x45aa1c[_0x77e3('0xb2')])});});var _0x22e844={'id':_0x586249+'_'+_0x36cc91['LogicalName'],'name':_0x36cc91[_0x77e3('0xb3')][_0x77e3('0xb1')][_0x77e3('0xb0')],'custom':![],'options':_0x388126};_0x5e8de4[_0x77e3('0x99')](_0x22e844);return _0x5e8de4;});}function getBooleanList(_0x4d09ca,_0xbb88cf,_0x3c67e8,_0x3956b3,_0x46e849,_0x89b235){var _0x4afc21={'method':_0x77e3('0x8e'),'uri':_0x4d09ca+_0x77e3('0x92')+_0x3956b3+_0x77e3('0xb4')+_0x46e849+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x77e3('0x90')+_0x89b235,'If-None-Match':null,'OData-Version':_0x77e3('0x94')},'json':!![]};return rp(_0x4afc21)[_0x77e3('0xe')](function(_0x4f2bec){var _0x4a0868=[];_0x4a0868[_0x77e3('0x99')]({'name':_0x4f2bec[_0x77e3('0xae')][_0x77e3('0xb5')][_0x77e3('0xb0')][_0x77e3('0xb1')][_0x77e3('0xb0')],'value':_0x77e3('0xb6')},{'name':_0x4f2bec['OptionSet'][_0x77e3('0xb7')][_0x77e3('0xb0')]['UserLocalizedLabel'][_0x77e3('0xb0')],'value':_0x77e3('0xb8')});var _0x113b6c={'id':_0xbb88cf+'_'+_0x4f2bec['LogicalName'],'name':_0x4f2bec[_0x77e3('0xb3')][_0x77e3('0xb1')][_0x77e3('0xb0')],'custom':![],'options':_0x4a0868};_0x3c67e8[_0x77e3('0x99')](_0x113b6c);return _0x3c67e8;});}function getInputList(_0x14465a,_0x313c46,_0x5d9aae,_0x13de4a,_0xa644a2,_0x59e1a4,_0x5be403){var _0x3fc419={'method':_0x77e3('0x8e'),'uri':_0x14465a+_0x77e3('0x92')+_0xa644a2+_0x77e3('0xb4')+_0x59e1a4+_0x77e3('0xb9')+_0x5d9aae+_0x77e3('0xba'),'headers':{'Authorization':_0x77e3('0x90')+_0x5be403,'If-None-Match':null,'OData-Version':_0x77e3('0x94')},'json':!![]};return rp(_0x3fc419)[_0x77e3('0xe')](function(_0x33d026){var _0x172719={'id':_0x313c46+'_'+_0x33d026['LogicalName'],'name':_0x33d026[_0x77e3('0xb3')][_0x77e3('0xb1')]?_0x33d026[_0x77e3('0xb3')][_0x77e3('0xb1')][_0x77e3('0xb0')]:_0x33d026[_0x77e3('0x97')],'custom':![],'options':[]};_0x13de4a[_0x77e3('0x99')](_0x172719);return _0x13de4a;});} \ No newline at end of file +var _0xce33=['channel','Descriptions','Dynamics365Field','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidyominame','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','timezoneruleversionnumber','transactioncurrencyidname','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','/oauth2/token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','keys','filters','model','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','includeAll','find','body','update','getConfigurations','findOne','Dynamics365Configuration','options','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x1fffd5,_0x511356){var _0x2da2dd=function(_0x493bb3){while(--_0x493bb3){_0x1fffd5['push'](_0x1fffd5['shift']());}};_0x2da2dd(++_0x511356);}(_0xce33,0x1f3));var _0x3ce3=function(_0x14ad92,_0x3b4315){_0x14ad92=_0x14ad92-0x0;var _0x41ceae=_0xce33[_0x14ad92];return _0x41ceae;};'use strict';var rp=require('request-promise');var util=require(_0x3ce3('0x0'));var _=require(_0x3ce3('0x1'));var qs=require(_0x3ce3('0x2'));var logger=require(_0x3ce3('0x3'))(_0x3ce3('0x4'));var db=require(_0x3ce3('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x77fbbf,_0x1b5019){_0x1b5019=_0x1b5019||0xc8;return function(_0x425aa8){if(_0x425aa8){return _0x77fbbf[_0x3ce3('0x6')](_0x1b5019)[_0x3ce3('0x7')](_0x425aa8);}};}function respondWithFilteredResult(_0x53bb8e,_0x205ba){return function(_0x289739){if(_0x289739){var _0x923bc3=typeof _0x205ba['offset']===_0x3ce3('0x8')&&typeof _0x205ba['limit']==='undefined';var _0x15b20b=_0x289739['count'];var _0x20c760=_0x923bc3?0x0:_0x205ba[_0x3ce3('0x9')];var _0x160be5=_0x923bc3?_0x289739[_0x3ce3('0xa')]:_0x205ba[_0x3ce3('0x9')]+_0x205ba[_0x3ce3('0xb')];var _0x12eb31;if(_0x160be5>=_0x15b20b){_0x160be5=_0x15b20b;_0x12eb31=0xc8;}else{_0x12eb31=0xce;}_0x53bb8e[_0x3ce3('0x6')](_0x12eb31);return _0x53bb8e[_0x3ce3('0xc')](_0x3ce3('0xd'),_0x20c760+'-'+_0x160be5+'/'+_0x15b20b)['json'](_0x289739);}return null;};}function saveUpdates(_0x1f9e1d){return function(_0x40c9c6){if(_0x40c9c6){return _0x40c9c6['update'](_0x1f9e1d)[_0x3ce3('0xe')](function(_0x17af64){return _0x17af64;});}return null;};}function removeEntity(_0x59e7a6){return function(_0x30f696){if(_0x30f696){return _0x30f696[_0x3ce3('0xf')]()['then'](function(){_0x59e7a6[_0x3ce3('0x6')](0xcc)[_0x3ce3('0x10')]();});}};}function handleEntityNotFound(_0x30db61){return function(_0x35e6d0){if(!_0x35e6d0){_0x30db61['sendStatus'](0x194);}return _0x35e6d0;};}function handleError(_0x5b1214,_0x351965){_0x351965=_0x351965||0x1f4;return function(_0x56e8b3){logger[_0x3ce3('0x11')](_0x56e8b3[_0x3ce3('0x12')]);if(_0x56e8b3[_0x3ce3('0x13')]){delete _0x56e8b3[_0x3ce3('0x13')];}_0x5b1214['status'](_0x351965)[_0x3ce3('0x14')](_0x56e8b3);};}exports[_0x3ce3('0x15')]=function(_0x248a91,_0x7d1ced){var _0x1b77d5={},_0x499676={},_0x397dbc={'count':0x0,'rows':[]};var _0x20a7bd=_[_0x3ce3('0x16')](db[_0x3ce3('0x17')]['rawAttributes'],function(_0x37fc0f){return{'name':_0x37fc0f[_0x3ce3('0x18')],'type':_0x37fc0f[_0x3ce3('0x19')][_0x3ce3('0x1a')]};});_0x499676['model']=_[_0x3ce3('0x16')](_0x20a7bd,_0x3ce3('0x13'));_0x499676['query']=_[_0x3ce3('0x1b')](_0x248a91['query']);_0x499676[_0x3ce3('0x1c')]=_['intersection'](_0x499676[_0x3ce3('0x1d')],_0x499676['query']);_0x1b77d5['attributes']=_[_0x3ce3('0x1e')](_0x499676[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x1b77d5[_0x3ce3('0x21')]=_0x1b77d5[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x1b77d5[_0x3ce3('0x21')]:_0x499676[_0x3ce3('0x1d')];if(!_0x248a91['query'][_0x3ce3('0x23')](_0x3ce3('0x24'))){_0x1b77d5['limit']=qs[_0x3ce3('0xb')](_0x248a91[_0x3ce3('0x20')]['limit']);_0x1b77d5['offset']=qs[_0x3ce3('0x9')](_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x9')]);}_0x1b77d5[_0x3ce3('0x25')]=qs[_0x3ce3('0x26')](_0x248a91[_0x3ce3('0x20')]['sort']);_0x1b77d5[_0x3ce3('0x27')]=qs[_0x3ce3('0x1c')](_[_0x3ce3('0x28')](_0x248a91['query'],_0x499676['filters']),_0x20a7bd);if(_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x29')]){_0x1b77d5[_0x3ce3('0x27')]=_[_0x3ce3('0x2a')](_0x1b77d5[_0x3ce3('0x27')],{'$or':_[_0x3ce3('0x16')](_0x20a7bd,function(_0x27d92e){if(_0x27d92e[_0x3ce3('0x19')]!==_0x3ce3('0x2b')){var _0x502e6b={};_0x502e6b[_0x27d92e[_0x3ce3('0x13')]]={'$like':'%'+_0x248a91[_0x3ce3('0x20')][_0x3ce3('0x29')]+'%'};return _0x502e6b;}})});}_0x1b77d5=_['merge']({},_0x1b77d5,_0x248a91['options']);var _0x26f778={'where':_0x1b77d5[_0x3ce3('0x27')]};return db[_0x3ce3('0x17')][_0x3ce3('0xa')](_0x26f778)[_0x3ce3('0xe')](function(_0x4e6d50){_0x397dbc[_0x3ce3('0xa')]=_0x4e6d50;if(_0x248a91[_0x3ce3('0x20')]['includeAll']){_0x1b77d5[_0x3ce3('0x2c')]=[{'all':!![]}];}return db[_0x3ce3('0x17')][_0x3ce3('0x2d')](_0x1b77d5);})[_0x3ce3('0xe')](function(_0x45e9ad){_0x397dbc['rows']=_0x45e9ad;return _0x397dbc;})[_0x3ce3('0xe')](respondWithFilteredResult(_0x7d1ced,_0x1b77d5))[_0x3ce3('0x2e')](handleError(_0x7d1ced,null));};exports[_0x3ce3('0x2f')]=function(_0x3eda57,_0x7bcdd){var _0x3ff336={'raw':![],'where':{'id':_0x3eda57[_0x3ce3('0x30')]['id']}},_0x266942={};_0x266942[_0x3ce3('0x1d')]=_[_0x3ce3('0x1b')](db[_0x3ce3('0x17')][_0x3ce3('0x31')]);_0x266942['query']=_[_0x3ce3('0x1b')](_0x3eda57[_0x3ce3('0x20')]);_0x266942[_0x3ce3('0x1c')]=_[_0x3ce3('0x1e')](_0x266942[_0x3ce3('0x1d')],_0x266942[_0x3ce3('0x20')]);_0x3ff336[_0x3ce3('0x21')]=_[_0x3ce3('0x1e')](_0x266942[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x3eda57[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x3ff336[_0x3ce3('0x21')]=_0x3ff336[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x3ff336['attributes']:_0x266942[_0x3ce3('0x1d')];if(_0x3eda57['query'][_0x3ce3('0x32')]){_0x3ff336['include']=[{'all':!![]}];}_0x3ff336=_[_0x3ce3('0x2a')]({},_0x3ff336,_0x3eda57['options']);return db[_0x3ce3('0x17')][_0x3ce3('0x33')](_0x3ff336)[_0x3ce3('0xe')](handleEntityNotFound(_0x7bcdd,null))[_0x3ce3('0xe')](respondWithResult(_0x7bcdd,null))[_0x3ce3('0x2e')](handleError(_0x7bcdd,null));};exports['create']=function(_0x4ec3c7,_0x357285){return db[_0x3ce3('0x17')]['create'](_0x4ec3c7[_0x3ce3('0x34')],{})['then'](respondWithResult(_0x357285,0xc9))[_0x3ce3('0x2e')](handleError(_0x357285,null));};exports[_0x3ce3('0x35')]=function(_0x4a308f,_0x4767b3){if(_0x4a308f[_0x3ce3('0x34')]['id']){delete _0x4a308f[_0x3ce3('0x34')]['id'];}return db[_0x3ce3('0x17')]['find']({'where':{'id':_0x4a308f[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x4767b3,null))[_0x3ce3('0xe')](saveUpdates(_0x4a308f[_0x3ce3('0x34')],null))['then'](respondWithResult(_0x4767b3,null))['catch'](handleError(_0x4767b3,null));};exports[_0x3ce3('0xf')]=function(_0x218855,_0x1373b7){return db['Dynamics365Account']['find']({'where':{'id':_0x218855[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x1373b7,null))[_0x3ce3('0xe')](removeEntity(_0x1373b7,null))[_0x3ce3('0x2e')](handleError(_0x1373b7,null));};exports[_0x3ce3('0x36')]=function(_0x168350,_0x27f957){var _0x10bf57={};var _0x50f58d={};var _0x18adc5;var _0x5136be;return db['Dynamics365Account'][_0x3ce3('0x37')]({'where':{'id':_0x168350[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x27f957,null))['then'](function(_0x3a275a){if(_0x3a275a){_0x18adc5=_0x3a275a;_0x50f58d[_0x3ce3('0x1d')]=_[_0x3ce3('0x1b')](db[_0x3ce3('0x38')][_0x3ce3('0x31')]);_0x50f58d[_0x3ce3('0x20')]=_['keys'](_0x168350[_0x3ce3('0x20')]);_0x50f58d[_0x3ce3('0x1c')]=_['intersection'](_0x50f58d[_0x3ce3('0x1d')],_0x50f58d[_0x3ce3('0x20')]);_0x10bf57[_0x3ce3('0x21')]=_['intersection'](_0x50f58d[_0x3ce3('0x1d')],qs[_0x3ce3('0x1f')](_0x168350[_0x3ce3('0x20')][_0x3ce3('0x1f')]));_0x10bf57[_0x3ce3('0x21')]=_0x10bf57[_0x3ce3('0x21')][_0x3ce3('0x22')]?_0x10bf57[_0x3ce3('0x21')]:_0x50f58d[_0x3ce3('0x1d')];_0x10bf57[_0x3ce3('0x25')]=qs['sort'](_0x168350[_0x3ce3('0x20')][_0x3ce3('0x26')]);_0x10bf57['where']=qs['filters'](_[_0x3ce3('0x28')](_0x168350[_0x3ce3('0x20')],_0x50f58d['filters']));if(_0x168350[_0x3ce3('0x20')]['filter']){_0x10bf57[_0x3ce3('0x27')]=_[_0x3ce3('0x2a')](_0x10bf57[_0x3ce3('0x27')],{'$or':_[_0x3ce3('0x16')](_0x10bf57[_0x3ce3('0x21')],function(_0x58f878){var _0x45b6aa={};_0x45b6aa[_0x58f878]={'$like':'%'+_0x168350['query']['filter']+'%'};return _0x45b6aa;})});}_0x10bf57=_[_0x3ce3('0x2a')]({},_0x10bf57,_0x168350[_0x3ce3('0x39')]);return _0x18adc5[_0x3ce3('0x36')](_0x10bf57);}})[_0x3ce3('0xe')](function(_0x8945cb){if(_0x8945cb){_0x5136be=_0x8945cb[_0x3ce3('0x22')];if(!_0x168350[_0x3ce3('0x20')]['hasOwnProperty']('nolimit')){_0x10bf57['limit']=qs[_0x3ce3('0xb')](_0x168350[_0x3ce3('0x20')][_0x3ce3('0xb')]);_0x10bf57[_0x3ce3('0x9')]=qs[_0x3ce3('0x9')](_0x168350['query'][_0x3ce3('0x9')]);}return _0x18adc5[_0x3ce3('0x36')](_0x10bf57);}})[_0x3ce3('0xe')](function(_0x1e9081){if(_0x1e9081){return _0x1e9081?{'count':_0x5136be,'rows':_0x1e9081}:null;}})[_0x3ce3('0xe')](respondWithResult(_0x27f957,null))['catch'](handleError(_0x27f957,null));};exports[_0x3ce3('0x3a')]=function(_0xdc71b7,_0x576675){if(_0xdc71b7[_0x3ce3('0x34')]['id']){delete _0xdc71b7[_0x3ce3('0x34')]['id'];}return db[_0x3ce3('0x17')][_0x3ce3('0x37')]({'where':{'id':_0xdc71b7[_0x3ce3('0x30')]['id']}})[_0x3ce3('0xe')](handleEntityNotFound(_0x576675,null))[_0x3ce3('0xe')](function(_0x43cd49){if(_0x43cd49){_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3b')]=_0x43cd49['id'];_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3c')]=integrations[_0x3ce3('0x3d')](_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3e')],_0xdc71b7[_0x3ce3('0x34')]['type']);_0xdc71b7['body'][_0x3ce3('0x3f')]=integrations['getDescriptions'](_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x3e')],_0xdc71b7[_0x3ce3('0x34')][_0x3ce3('0x19')]);return db['Dynamics365Configuration']['create'](_0xdc71b7['body'],{'include':[{'model':db[_0x3ce3('0x40')],'as':_0x3ce3('0x3c')},{'model':db[_0x3ce3('0x40')],'as':_0x3ce3('0x3f')}]});}return null;})['then'](respondWithResult(_0x576675,null))['catch'](handleError(_0x576675,null));};function sanitizeRemoteUri(_0xb81257){var _0x345a73=_0xb81257['slice'](-0x1);if(_0x345a73==='/')return _0xb81257[_0x3ce3('0x41')](0x0,_0xb81257[_0x3ce3('0x42')](_0x345a73));return _0xb81257;}function getWebApiUrl(_0x535e5b){return util[_0x3ce3('0x43')](_0x3ce3('0x44'),_0x535e5b);}exports[_0x3ce3('0x45')]=function(_0x329a81,_0x2af946){var _0x2e55b1=_0x329a81[_0x3ce3('0x20')][_0x3ce3('0x46')];var _0x727875=_0x2e55b1===_0x3ce3('0x47')?_0x3ce3('0x48'):_0x3ce3('0x49');var _0x2d8154='';var _0x2644cf='';var _0x3c4d70='';var _0x98ef0d='';var _0x327843='';var _0x2a2775='';var _0xc4e342='';var _0x3a62dc='';var _0xda5587=[_0x3ce3('0x4a'),'description','customerid','ownerid',_0x3ce3('0x4b'),_0x3ce3('0x4c'),_0x3ce3('0x4d'),_0x3ce3('0x4e'),_0x3ce3('0x4f'),_0x3ce3('0x50')];var _0x457b64=[_0x3ce3('0x51'),_0x3ce3('0x52'),_0x3ce3('0x53'),_0x3ce3('0x54'),_0x3ce3('0x55'),_0x3ce3('0x56'),_0x3ce3('0x57'),_0x3ce3('0x58'),'createdbyexternalpartyname',_0x3ce3('0x59'),_0x3ce3('0x5a'),_0x3ce3('0x5b'),_0x3ce3('0x5c'),_0x3ce3('0x5d'),_0x3ce3('0x5e'),_0x3ce3('0x5f'),'customeridtype',_0x3ce3('0x60'),_0x3ce3('0x61'),_0x3ce3('0x62'),_0x3ce3('0x63'),_0x3ce3('0x64'),_0x3ce3('0x65'),_0x3ce3('0x66'),_0x3ce3('0x67'),'followupby',_0x3ce3('0x68'),'influencescore',_0x3ce3('0x69'),_0x3ce3('0x6a'),_0x3ce3('0x6b'),_0x3ce3('0x6c'),'modifiedbyexternalpartyyominame',_0x3ce3('0x6d'),_0x3ce3('0x6e'),_0x3ce3('0x6f'),'modifiedonbehalfbyname',_0x3ce3('0x70'),_0x3ce3('0x71'),'msdyn_iotalertname',_0x3ce3('0x72'),_0x3ce3('0x73'),_0x3ce3('0x74'),'owneridname','owneridtype',_0x3ce3('0x75'),_0x3ce3('0x76'),'primarycontactidname',_0x3ce3('0x77'),'prioritycodename','productidname',_0x3ce3('0x78'),_0x3ce3('0x79'),'resolvebykpiidname',_0x3ce3('0x7a'),_0x3ce3('0x7b'),_0x3ce3('0x7c'),_0x3ce3('0x7d'),'slainvokedidname',_0x3ce3('0x7e'),'socialprofileidname',_0x3ce3('0x7f'),_0x3ce3('0x80'),'subjectidname','ticketnumber',_0x3ce3('0x81'),_0x3ce3('0x82'),'traversedpath','utcconversiontimezonecode','versionnumber'];var _0x34b200=_0xda5587[_0x3ce3('0x83')](_0x457b64);return db[_0x3ce3('0x17')]['findOne']({'where':{'id':_0x329a81[_0x3ce3('0x30')]['id']},'attributes':['id',_0x3ce3('0x84'),_0x3ce3('0x85'),_0x3ce3('0x86'),_0x3ce3('0x87'),'clientId',_0x3ce3('0x88'),_0x3ce3('0x89')],'include':[{'model':db[_0x3ce3('0x8a')],'as':'CloudProvider','attributes':['id','data5',_0x3ce3('0x8b')]}]})[_0x3ce3('0xe')](handleEntityNotFound(_0x2af946,null))[_0x3ce3('0xe')](function(_0x1452d1){if(_0x1452d1){if(_0x1452d1['modernAuthentication']){_0x1452d1[_0x3ce3('0x8c')]=_0x1452d1[_0x3ce3('0x8a')][_0x3ce3('0x8d')];_0x3a62dc=sanitizeRemoteUri(_0x1452d1['CloudProvider'][_0x3ce3('0x8b')]);_0xc4e342=getWebApiUrl(_0x3a62dc);return _0x1452d1;}_0x3a62dc=sanitizeRemoteUri(_0x1452d1[_0x3ce3('0x86')]);_0xc4e342=getWebApiUrl(_0x3a62dc);var _0x500ec5={'method':_0x3ce3('0x8e'),'uri':'https://login.microsoftonline.com/'+_0x1452d1[_0x3ce3('0x87')]+_0x3ce3('0x8f'),'form':{'client_id':_0x1452d1['clientId'],'resource':_0x3a62dc,'username':_0x1452d1['username'],'password':_0x1452d1['password'],'grant_type':_0x3ce3('0x85'),'client_secret':_0x1452d1[_0x3ce3('0x88')]},'json':!![]};return rp(_0x500ec5);}})[_0x3ce3('0xe')](function(_0x286160){_0x2a2775=_0x286160[_0x3ce3('0x8c')];var _0x4366cc={'method':_0x3ce3('0x90'),'uri':encodeURI(_0xc4e342+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x727875+'\x27'),'headers':{'Authorization':_0x3ce3('0x91')+_0x2a2775,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4366cc);})[_0x3ce3('0xe')](function(_0x2f6e7e){var _0x3ef66d=_0x2f6e7e[_0x3ce3('0x92')][0x0];var _0x167d33=_0x3ef66d[_0x3ce3('0x93')];var _0x56cfbe={'method':_0x3ce3('0x90'),'uri':_0xc4e342+_0x3ce3('0x94')+_0x167d33+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x2a2775,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x56cfbe);})[_0x3ce3('0xe')](function(_0x2e6438){_0x2d8154=_0x2e6438;_0x2644cf=_0x2d8154[_0x3ce3('0x96')];_0x2644cf=_[_0x3ce3('0x97')](_0x2644cf,function(_0x3ab2e5){return!_0x34b200[_0x3ce3('0x98')](_0x3ab2e5['LogicalName']);});var _0x10fe18=[];var _0x531095=[];_0x2644cf[_0x3ce3('0x99')](function(_0x2be0ec){if(_0x2be0ec[_0x3ce3('0x9a')]){var _0x20dc4f=_0x2be0ec[_0x3ce3('0x9a')]['substring'](_0x2be0ec[_0x3ce3('0x9a')]['lastIndexOf']('.')+0x1);if(_0x20dc4f===_0x3ce3('0x9b')){_0x10fe18[_0x3ce3('0x9c')](getSelectList(_0xc4e342,_0x2e55b1,_0x531095,_0x2d8154[_0x3ce3('0x93')],_0x2be0ec['MetadataId'],_0x2a2775));}}});return Promise[_0x3ce3('0x9d')](_0x10fe18);})[_0x3ce3('0xe')](function(_0x3d47bc){_0x3c4d70=_0x3d47bc[0x0];var _0x211e4c=[];var _0x4eddb7=[];_0x2644cf['forEach'](function(_0x251485){if(!_[_0x3ce3('0x9e')](_0x251485['@odata.type'])){var _0x45f9bf=_0x251485['@odata.type'][_0x3ce3('0x41')](_0x251485[_0x3ce3('0x9a')][_0x3ce3('0x42')]('.')+0x1);if(_0x45f9bf===_0x3ce3('0x9f')){_0x211e4c[_0x3ce3('0x9c')](getBooleanList(_0xc4e342,_0x2e55b1,_0x4eddb7,_0x2d8154[_0x3ce3('0x93')],_0x251485[_0x3ce3('0x93')],_0x2a2775));}}});return Promise['all'](_0x211e4c);})['then'](function(_0x5be97a){_0x98ef0d=_0x5be97a[0x0];var _0x1860f0=[];var _0x2f6116=[];_0x2644cf[_0x3ce3('0x99')](function(_0x3caec3){if(_0x3caec3['@odata.type']){var _0x1c4d21=_0x3caec3[_0x3ce3('0x9a')][_0x3ce3('0x41')](_0x3caec3[_0x3ce3('0x9a')][_0x3ce3('0x42')]('.')+0x1);if(_0x1c4d21===_0x3ce3('0xa0')||_0x1c4d21===_0x3ce3('0xa1')||_0x1c4d21===_0x3ce3('0xa2')||_0x1c4d21===_0x3ce3('0xa3')||_0x1c4d21===_0x3ce3('0xa4')||_0x1c4d21===_0x3ce3('0xa5')||_0x1c4d21===_0x3ce3('0xa6')||_0x1c4d21===_0x3ce3('0xa7')||_0x1c4d21==='StateAttributeMetadata'||_0x1c4d21===_0x3ce3('0xa8')){_0x1860f0['push'](getInputList(_0xc4e342,_0x2e55b1,_0x1c4d21,_0x2f6116,_0x2d8154[_0x3ce3('0x93')],_0x3caec3[_0x3ce3('0x93')],_0x2a2775));}}});return Promise[_0x3ce3('0x9d')](_0x1860f0);})['then'](function(_0x24a5a7){_0x327843=_0x24a5a7[0x0];var _0x3cbd2e=_0x3c4d70[_0x3ce3('0x83')](_0x98ef0d)[_0x3ce3('0x83')](_0x327843);var _0x1eecf5={'count':_0x3cbd2e[_0x3ce3('0x22')],'rows':_0x3cbd2e};return _0x1eecf5;})[_0x3ce3('0xe')](respondWithResult(_0x2af946,null))[_0x3ce3('0x2e')](function(_0x30a5fe){var _0x54b66e=_0x329a81[_0x3ce3('0x20')][_0x3ce3('0xa9')]?0x1f4:_0x30a5fe['statusCode']||0x1f4;logger[_0x3ce3('0x11')](_0x30a5fe['stack']);delete _0x30a5fe[_0x3ce3('0x13')];if(_0x54b66e===0x191){_0x54b66e=0x190;}_0x2af946['status'](_0x54b66e)[_0x3ce3('0x14')](_0x329a81[_0x3ce3('0x20')][_0x3ce3('0xa9')]?{'message':_0x3ce3('0xaa'),'statusCode':_0x30a5fe[_0x3ce3('0xab')]}:_0x30a5fe);});};function getSelectList(_0x1baffb,_0xece9a5,_0x40783b,_0x4606eb,_0x31562f,_0x2a4743){var _0x5667e9={'method':'GET','uri':_0x1baffb+'EntityDefinitions('+_0x4606eb+')/Attributes('+_0x31562f+_0x3ce3('0xac')+_0x3ce3('0xad'),'headers':{'Authorization':_0x3ce3('0x91')+_0x2a4743,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x5667e9)['then'](function(_0x3cabe7){var _0x1c20e8=[];var _0x467e71=_0x3cabe7[_0x3ce3('0xae')][_0x3ce3('0xaf')];_0x467e71[_0x3ce3('0x99')](function(_0x166e93){_0x1c20e8['push']({'name':_0x166e93[_0x3ce3('0xb0')][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':String(_0x166e93[_0x3ce3('0xb2')])});});var _0x18f461={'id':_0xece9a5+'_'+_0x3cabe7[_0x3ce3('0xb3')],'name':_0x3cabe7[_0x3ce3('0xb4')]['UserLocalizedLabel'][_0x3ce3('0xb0')],'custom':![],'options':_0x1c20e8};_0x40783b['push'](_0x18f461);return _0x40783b;});}function getBooleanList(_0x28b69f,_0x3eb052,_0x228cb8,_0x2571fd,_0x227e86,_0x497dab){var _0x496af5={'method':'GET','uri':_0x28b69f+_0x3ce3('0x94')+_0x2571fd+_0x3ce3('0xb5')+_0x227e86+_0x3ce3('0xb6'),'headers':{'Authorization':_0x3ce3('0x91')+_0x497dab,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x496af5)[_0x3ce3('0xe')](function(_0x54f702){var _0x426e83=[];_0x426e83['push']({'name':_0x54f702[_0x3ce3('0xae')]['TrueOption'][_0x3ce3('0xb0')][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':_0x3ce3('0xb7')},{'name':_0x54f702[_0x3ce3('0xae')][_0x3ce3('0xb8')]['Label'][_0x3ce3('0xb1')][_0x3ce3('0xb0')],'value':_0x3ce3('0xb9')});var _0x290788={'id':_0x3eb052+'_'+_0x54f702['LogicalName'],'name':_0x54f702[_0x3ce3('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x426e83};_0x228cb8[_0x3ce3('0x9c')](_0x290788);return _0x228cb8;});}function getInputList(_0x206d29,_0x40d541,_0x1998b4,_0x487429,_0x6e0617,_0x3b119d,_0x1118a9){var _0x158b36={'method':_0x3ce3('0x90'),'uri':_0x206d29+'EntityDefinitions('+_0x6e0617+_0x3ce3('0xb5')+_0x3b119d+_0x3ce3('0xba')+_0x1998b4+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3ce3('0x91')+_0x1118a9,'If-None-Match':null,'OData-Version':_0x3ce3('0x95')},'json':!![]};return rp(_0x158b36)[_0x3ce3('0xe')](function(_0x56d2ba){var _0xd1208d={'id':_0x40d541+'_'+_0x56d2ba[_0x3ce3('0xb3')],'name':_0x56d2ba[_0x3ce3('0xb4')]['UserLocalizedLabel']?_0x56d2ba[_0x3ce3('0xb4')]['UserLocalizedLabel'][_0x3ce3('0xb0')]:_0x56d2ba[_0x3ce3('0xb3')],'custom':![],'options':[]};_0x487429[_0x3ce3('0x9c')](_0xd1208d);return _0x487429;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index df11e70..3c4f780 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x164770,_0x1e5ebf){var _0x5ec509=function(_0x561cfa){while(--_0x561cfa){_0x164770['push'](_0x164770['shift']());}};_0x5ec509(++_0x1e5ebf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','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 d186fb1..8d99ab3 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 _0x380d=['catch','ShowDynamics365Account','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account'];(function(_0x2a0dfb,_0x51a704){var _0x1524dc=function(_0x596f85){while(--_0x596f85){_0x2a0dfb['push'](_0x2a0dfb['shift']());}};_0x1524dc(++_0x51a704);}(_0x380d,0x6b));var _0xd380=function(_0x4b06d2,_0x53c12b){_0x4b06d2=_0x4b06d2-0x0;var _0x13cd98=_0x380d[_0x4b06d2];return _0x13cd98;};'use strict';var _=require('lodash');var util=require(_0xd380('0x0'));var moment=require(_0xd380('0x1'));var BPromise=require(_0xd380('0x2'));var rs=require(_0xd380('0x3'));var fs=require('fs');var Redis=require(_0xd380('0x4'));var db=require(_0xd380('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd380('0x6'))('rpc');var config=require(_0xd380('0x7'));var jayson=require(_0xd380('0x8'));var client=jayson[_0xd380('0x9')][_0xd380('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f8b4d,_0x4a17de,_0x3f8003){return new BPromise(function(_0x1c4980,_0x3e5c14){return client[_0xd380('0xb')](_0x1f8b4d,_0x3f8003)[_0xd380('0xc')](function(_0x42b3c1){logger[_0xd380('0xd')](_0xd380('0xe'),_0x4a17de,_0xd380('0xf'));logger[_0xd380('0x10')](_0xd380('0x11'),_0x4a17de,_0xd380('0xf'),JSON[_0xd380('0x12')](_0x42b3c1));if(_0x42b3c1[_0xd380('0x13')]){if(_0x42b3c1[_0xd380('0x13')][_0xd380('0x14')]===0x1f4){logger[_0xd380('0x13')](_0xd380('0xe'),_0x4a17de,_0x42b3c1['error'][_0xd380('0x15')]);return _0x3e5c14(_0x42b3c1['error']['message']);}logger[_0xd380('0x13')](_0xd380('0xe'),_0x4a17de,_0x42b3c1['error']['message']);return _0x1c4980(_0x42b3c1[_0xd380('0x13')][_0xd380('0x15')]);}else{logger[_0xd380('0xd')](_0xd380('0xe'),_0x4a17de,_0xd380('0xf'));_0x1c4980(_0x42b3c1[_0xd380('0x16')]['message']);}})['catch'](function(_0x21327e){logger[_0xd380('0x13')](_0xd380('0xe'),_0x4a17de,_0x21327e);_0x3e5c14(_0x21327e);});});}exports['GetDynamics365Account']=function(_0x135add){var _0x3f7d73=this;return new Promise(function(_0x4b28fe,_0x3a193f){return db[_0xd380('0x17')][_0xd380('0x18')]({'raw':_0x135add[_0xd380('0x19')]?_0x135add[_0xd380('0x19')][_0xd380('0x1a')]===undefined?!![]:![]:!![],'where':_0x135add['options']?_0x135add['options'][_0xd380('0x1b')]||null:null,'attributes':_0x135add[_0xd380('0x19')]?_0x135add['options'][_0xd380('0x1c')]||null:null,'limit':_0x135add[_0xd380('0x19')]?_0x135add['options']['limit']||null:null,'include':_0x135add[_0xd380('0x19')]?_0x135add[_0xd380('0x19')][_0xd380('0x1d')]?_[_0xd380('0x1e')](_0x135add['options'][_0xd380('0x1d')],function(_0x1acc50){return{'model':db[_0x1acc50[_0xd380('0x1f')]],'as':_0x1acc50['as'],'attributes':_0x1acc50['attributes'],'include':_0x1acc50[_0xd380('0x1d')]?_[_0xd380('0x1e')](_0x1acc50[_0xd380('0x1d')],function(_0x434fe1){return{'model':db[_0x434fe1['model']],'as':_0x434fe1['as'],'attributes':_0x434fe1[_0xd380('0x1c')],'include':_0x434fe1[_0xd380('0x1d')]?_[_0xd380('0x1e')](_0x434fe1['include'],function(_0x458f25){return{'model':db[_0x458f25['model']],'as':_0x458f25['as'],'attributes':_0x458f25[_0xd380('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd380('0xc')](function(_0x3b294a){logger['info'](_0xd380('0x20'),_0x135add);logger[_0xd380('0x10')](_0xd380('0x20'),_0x135add,JSON[_0xd380('0x12')](_0x3b294a));_0x4b28fe(_0x3b294a);})[_0xd380('0x21')](function(_0x3c7e60){logger['error'](_0xd380('0x20'),_0x3c7e60['message'],_0x135add);_0x3a193f(_0x3f7d73['error'](0x1f4,_0x3c7e60[_0xd380('0x15')]));});});};exports['ShowDynamics365Account']=function(_0xbbfad8){var _0x3e6d59=this;return new Promise(function(_0x583e80,_0x2d87be){return db[_0xd380('0x17')]['find']({'raw':_0xbbfad8[_0xd380('0x19')]?_0xbbfad8[_0xd380('0x19')][_0xd380('0x1a')]===undefined?!![]:![]:!![],'where':_0xbbfad8['options']?_0xbbfad8['options'][_0xd380('0x1b')]||null:null,'attributes':_0xbbfad8[_0xd380('0x19')]?_0xbbfad8[_0xd380('0x19')]['attributes']||null:null,'include':_0xbbfad8[_0xd380('0x19')]?_0xbbfad8[_0xd380('0x19')]['include']?_[_0xd380('0x1e')](_0xbbfad8[_0xd380('0x19')][_0xd380('0x1d')],function(_0x1938b0){return{'model':db[_0x1938b0[_0xd380('0x1f')]],'as':_0x1938b0['as'],'attributes':_0x1938b0['attributes'],'include':_0x1938b0[_0xd380('0x1d')]?_['map'](_0x1938b0[_0xd380('0x1d')],function(_0x554740){return{'model':db[_0x554740[_0xd380('0x1f')]],'as':_0x554740['as'],'attributes':_0x554740[_0xd380('0x1c')],'include':_0x554740[_0xd380('0x1d')]?_['map'](_0x554740['include'],function(_0x18339c){return{'model':db[_0x18339c[_0xd380('0x1f')]],'as':_0x18339c['as'],'attributes':_0x18339c[_0xd380('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd380('0xc')](function(_0x3025c2){logger[_0xd380('0xd')]('ShowDynamics365Account',_0xbbfad8);logger[_0xd380('0x10')](_0xd380('0x22'),_0xbbfad8,JSON['stringify'](_0x3025c2));_0x583e80(_0x3025c2);})[_0xd380('0x21')](function(_0x3dd246){logger[_0xd380('0x13')]('ShowDynamics365Account',_0x3dd246['message'],_0xbbfad8);_0x2d87be(_0x3e6d59['error'](0x1f4,_0x3dd246[_0xd380('0x15')]));});});}; \ No newline at end of file +var _0x80f2=['request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','result','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','Dynamics365Account','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x523a8b,_0x5a7f8d){var _0x45c38c=function(_0x53c3fb){while(--_0x53c3fb){_0x523a8b['push'](_0x523a8b['shift']());}};_0x45c38c(++_0x5a7f8d);}(_0x80f2,0x7e));var _0x280f=function(_0x42565a,_0x441e1b){_0x42565a=_0x42565a-0x0;var _0x4a8397=_0x80f2[_0x42565a];return _0x4a8397;};'use strict';var _=require(_0x280f('0x0'));var util=require(_0x280f('0x1'));var moment=require('moment');var BPromise=require(_0x280f('0x2'));var rs=require(_0x280f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x280f('0x4'))['db'];var utils=require(_0x280f('0x5'));var logger=require(_0x280f('0x6'))(_0x280f('0x7'));var config=require('../../config/environment');var jayson=require(_0x280f('0x8'));var client=jayson[_0x280f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115f90,_0x57538f,_0x5d088f){return new BPromise(function(_0x109e4c,_0xee888e){return client[_0x280f('0xa')](_0x115f90,_0x5d088f)[_0x280f('0xb')](function(_0x481d09){logger['info'](_0x280f('0xc'),_0x57538f,_0x280f('0xd'));logger[_0x280f('0xe')](_0x280f('0xf'),_0x57538f,_0x280f('0xd'),JSON['stringify'](_0x481d09));if(_0x481d09[_0x280f('0x10')]){if(_0x481d09['error'][_0x280f('0x11')]===0x1f4){logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);return _0xee888e(_0x481d09[_0x280f('0x10')]['message']);}logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);return _0x109e4c(_0x481d09[_0x280f('0x10')][_0x280f('0x12')]);}else{logger[_0x280f('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x57538f,_0x280f('0xd'));_0x109e4c(_0x481d09[_0x280f('0x14')]['message']);}})['catch'](function(_0x52499){logger[_0x280f('0x10')](_0x280f('0xc'),_0x57538f,_0x52499);_0xee888e(_0x52499);});});}exports['GetDynamics365Account']=function(_0x32e958){var _0x7d7d4d=this;return new Promise(function(_0x392cda,_0x1f9501){return db['Dynamics365Account'][_0x280f('0x15')]({'raw':_0x32e958['options']?_0x32e958['options']['raw']===undefined?!![]:![]:!![],'where':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x17')]||null:null,'attributes':_0x32e958['options']?_0x32e958[_0x280f('0x16')][_0x280f('0x18')]||null:null,'limit':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x19')]||null:null,'include':_0x32e958[_0x280f('0x16')]?_0x32e958[_0x280f('0x16')][_0x280f('0x1a')]?_[_0x280f('0x1b')](_0x32e958[_0x280f('0x16')][_0x280f('0x1a')],function(_0x52373f){return{'model':db[_0x52373f[_0x280f('0x1c')]],'as':_0x52373f['as'],'attributes':_0x52373f['attributes'],'include':_0x52373f['include']?_['map'](_0x52373f['include'],function(_0x1592d2){return{'model':db[_0x1592d2['model']],'as':_0x1592d2['as'],'attributes':_0x1592d2['attributes'],'include':_0x1592d2[_0x280f('0x1a')]?_[_0x280f('0x1b')](_0x1592d2[_0x280f('0x1a')],function(_0x138bad){return{'model':db[_0x138bad[_0x280f('0x1c')]],'as':_0x138bad['as'],'attributes':_0x138bad['attributes']};}):[]};}):[]};}):[]:[]})[_0x280f('0xb')](function(_0xe0299a){logger['info'](_0x280f('0x1d'),_0x32e958);logger['debug'](_0x280f('0x1d'),_0x32e958,JSON['stringify'](_0xe0299a));_0x392cda(_0xe0299a);})['catch'](function(_0x1c8866){logger[_0x280f('0x10')](_0x280f('0x1d'),_0x1c8866[_0x280f('0x12')],_0x32e958);_0x1f9501(_0x7d7d4d[_0x280f('0x10')](0x1f4,_0x1c8866['message']));});});};exports[_0x280f('0x1e')]=function(_0x30af8b){var _0x345c01=this;return new Promise(function(_0x1cb80d,_0xb1eeba){return db[_0x280f('0x1f')][_0x280f('0x20')]({'raw':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x21')]===undefined?!![]:![]:!![],'where':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x17')]||null:null,'attributes':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x18')]||null:null,'include':_0x30af8b[_0x280f('0x16')]?_0x30af8b[_0x280f('0x16')][_0x280f('0x1a')]?_['map'](_0x30af8b['options'][_0x280f('0x1a')],function(_0x593023){return{'model':db[_0x593023[_0x280f('0x1c')]],'as':_0x593023['as'],'attributes':_0x593023[_0x280f('0x18')],'include':_0x593023['include']?_[_0x280f('0x1b')](_0x593023[_0x280f('0x1a')],function(_0x201e2b){return{'model':db[_0x201e2b[_0x280f('0x1c')]],'as':_0x201e2b['as'],'attributes':_0x201e2b[_0x280f('0x18')],'include':_0x201e2b['include']?_[_0x280f('0x1b')](_0x201e2b[_0x280f('0x1a')],function(_0x172c7e){return{'model':db[_0x172c7e[_0x280f('0x1c')]],'as':_0x172c7e['as'],'attributes':_0x172c7e[_0x280f('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f74e){logger['info'](_0x280f('0x1e'),_0x30af8b);logger[_0x280f('0xe')]('ShowDynamics365Account',_0x30af8b,JSON['stringify'](_0x59f74e));_0x1cb80d(_0x59f74e);})['catch'](function(_0x36771a){logger[_0x280f('0x10')]('ShowDynamics365Account',_0x36771a[_0x280f('0x12')],_0x30af8b);_0xb1eeba(_0x345c01['error'](0x1f4,_0x36771a['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7405fd3..3c75f43 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 _0xe615=['getSubjects','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','show','get'];(function(_0x71e086,_0x4ad22f){var _0x44a08=function(_0x53b3e3){while(--_0x53b3e3){_0x71e086['push'](_0x71e086['shift']());}};_0x44a08(++_0x4ad22f);}(_0xe615,0xb9));var _0x5e61=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0xe615[_0x18e5c7];return _0x55f2f0;};'use strict';var multer=require(_0x5e61('0x0'));var util=require(_0x5e61('0x1'));var path=require('path');var timeout=require(_0x5e61('0x2'));var express=require(_0x5e61('0x3'));var router=express['Router']();var fs_extra=require(_0x5e61('0x4'));var auth=require(_0x5e61('0x5'));var interaction=require(_0x5e61('0x6'));var config=require(_0x5e61('0x7'));var controller=require(_0x5e61('0x8'));router['get']('/',auth[_0x5e61('0x9')](),controller[_0x5e61('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5e61('0xb')]);router[_0x5e61('0xc')]('/:id/fields',auth[_0x5e61('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x5e61('0x9')](),controller[_0x5e61('0xd')]);router[_0x5e61('0xc')]('/:id/descriptions',auth[_0x5e61('0x9')](),controller['getDescriptions']);router[_0x5e61('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e61('0xf')]);router[_0x5e61('0x10')](_0x5e61('0x11'),auth[_0x5e61('0x9')](),controller[_0x5e61('0x12')]);router[_0x5e61('0x13')](_0x5e61('0x11'),auth[_0x5e61('0x9')](),controller[_0x5e61('0x14')]);module[_0x5e61('0x15')]=router; \ No newline at end of file +var _0x7f48=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','put','delete'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x7f48,0xac));var _0x87f4=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7f48[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var path=require('path');var timeout=require(_0x87f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87f4('0x3'));var auth=require(_0x87f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87f4('0x5'));var controller=require(_0x87f4('0x6'));router[_0x87f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x87f4('0x7')](_0x87f4('0x8'),auth['isAuthenticated'](),controller[_0x87f4('0x9')]);router[_0x87f4('0x7')](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xc')]);router[_0x87f4('0x7')](_0x87f4('0xd'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xe')]);router[_0x87f4('0x7')]('/:id/descriptions',auth[_0x87f4('0xb')](),controller[_0x87f4('0xf')]);router['post']('/',auth[_0x87f4('0xb')](),controller['create']);router[_0x87f4('0x10')](_0x87f4('0x8'),auth[_0x87f4('0xb')](),controller['update']);router[_0x87f4('0x11')](_0x87f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x87f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ce668f4..e06bdb0 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 _0x91ff=['nothing','sequelize','STRING','ENUM','incident','phonecall','contact'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x91ff,0x135));var _0xf91f=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x91ff[_0x30faec];return _0x29484f;};'use strict';var Sequelize=require(_0xf91f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf91f('0x1')]},'description':{'type':Sequelize[_0xf91f('0x1')]},'ticketType':{'type':Sequelize[_0xf91f('0x2')](_0xf91f('0x3'),_0xf91f('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xf91f('0x2')](_0xf91f('0x5'),_0xf91f('0x6')),'defaultValue':_0xf91f('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0xce57=['incident','phonecall','contact','nothing','sequelize','exports','STRING','ENUM'];(function(_0x315514,_0x2c6b54){var _0x5835cb=function(_0x4f33a1){while(--_0x4f33a1){_0x315514['push'](_0x315514['shift']());}};_0x5835cb(++_0x2c6b54);}(_0xce57,0x1d4));var _0x7ce5=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0xce57[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0x7ce5('0x0'));module[_0x7ce5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ce5('0x2')]},'ticketType':{'type':Sequelize[_0x7ce5('0x3')](_0x7ce5('0x4'),_0x7ce5('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7ce5('0x6'),_0x7ce5('0x7')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 3635b95..f09cae9 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 _0x5800=['params','length','options','find','create','body','destroy','findOne','Dynamics365Field','pick','getFields','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','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','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','findAll','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5800,0xb0));var _0x0580=function(_0x263bdd,_0x498f2e){_0x263bdd=_0x263bdd-0x0;var _0x399eed=_0x5800[_0x263bdd];return _0x399eed;};'use strict';var emlformat=require(_0x0580('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0580('0x1'));var jsonpatch=require(_0x0580('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0580('0x3'));var Mustache=require(_0x0580('0x4'));var util=require(_0x0580('0x5'));var path=require('path');var sox=require(_0x0580('0x6'));var csv=require(_0x0580('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0580('0x8'));var _=require(_0x0580('0x9'));var squel=require(_0x0580('0xa'));var crypto=require(_0x0580('0xb'));var jsforce=require(_0x0580('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0580('0x7'));var querystring=require(_0x0580('0xd'));var Papa=require('papaparse');var Redis=require(_0x0580('0xe'));var authService=require(_0x0580('0xf'));var qs=require(_0x0580('0x10'));var as=require(_0x0580('0x11'));var hardwareService=require(_0x0580('0x12'));var logger=require(_0x0580('0x13'))(_0x0580('0x14'));var utils=require(_0x0580('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0580('0x16'));var db=require(_0x0580('0x17'))['db'];function respondWithStatusCode(_0x30fa3b,_0x2770a6){_0x2770a6=_0x2770a6||0xcc;return function(_0xcda2fc){if(_0xcda2fc){return _0x30fa3b['sendStatus'](_0x2770a6);}return _0x30fa3b[_0x0580('0x18')](_0x2770a6)[_0x0580('0x19')]();};}function respondWithResult(_0x1f8215,_0x156f63){_0x156f63=_0x156f63||0xc8;return function(_0x194e94){if(_0x194e94){return _0x1f8215[_0x0580('0x18')](_0x156f63)[_0x0580('0x1a')](_0x194e94);}};}function respondWithFilteredResult(_0x23abbd,_0x141104){return function(_0x50a9c6){if(_0x50a9c6){var _0x3a710b=typeof _0x141104[_0x0580('0x1b')]===_0x0580('0x1c')&&typeof _0x141104['limit']===_0x0580('0x1c');var _0x1b650a=_0x50a9c6[_0x0580('0x1d')];var _0x460fdc=_0x3a710b?0x0:_0x141104['offset'];var _0x16ca46=_0x3a710b?_0x50a9c6[_0x0580('0x1d')]:_0x141104[_0x0580('0x1b')]+_0x141104[_0x0580('0x1e')];var _0x144039;if(_0x16ca46>=_0x1b650a){_0x16ca46=_0x1b650a;_0x144039=0xc8;}else{_0x144039=0xce;}_0x23abbd[_0x0580('0x18')](_0x144039);return _0x23abbd[_0x0580('0x1f')](_0x0580('0x20'),_0x460fdc+'-'+_0x16ca46+'/'+_0x1b650a)[_0x0580('0x1a')](_0x50a9c6);}return null;};}function patchUpdates(_0x1c6c53){return function(_0xd9ea27){try{jsonpatch[_0x0580('0x21')](_0xd9ea27,_0x1c6c53,!![]);}catch(_0x507a4a){return BPromise['reject'](_0x507a4a);}return _0xd9ea27[_0x0580('0x22')]();};}function saveUpdates(_0x215ece,_0x270c08){return function(_0x46c86b){if(_0x46c86b){return _0x46c86b[_0x0580('0x23')](_0x215ece)[_0x0580('0x24')](function(_0x209db7){return _0x209db7;});}return null;};}function removeEntity(_0x48ece8,_0x53d654){return function(_0x1b707e){if(_0x1b707e){return _0x1b707e['destroy']()['then'](function(){_0x48ece8[_0x0580('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35a762,_0x53888e){return function(_0x1f7792){if(!_0x1f7792){_0x35a762[_0x0580('0x25')](0x194);}return _0x1f7792;};}function handleError(_0x3e245d,_0x24d98b){_0x24d98b=_0x24d98b||0x1f4;return function(_0x517c0b){logger[_0x0580('0x26')](_0x517c0b[_0x0580('0x27')]);if(_0x517c0b[_0x0580('0x28')]){delete _0x517c0b[_0x0580('0x28')];}_0x3e245d['status'](_0x24d98b)[_0x0580('0x29')](_0x517c0b);};}exports[_0x0580('0x2a')]=function(_0x2ab059,_0x18c333){var _0x58da68={},_0x41d2e5={},_0x209514={'count':0x0,'rows':[]};var _0x2ddc7f=_[_0x0580('0x2b')](db[_0x0580('0x2c')][_0x0580('0x2d')],function(_0x23ae15){return{'name':_0x23ae15[_0x0580('0x2e')],'type':_0x23ae15[_0x0580('0x2f')][_0x0580('0x30')]};});_0x41d2e5[_0x0580('0x31')]=_['map'](_0x2ddc7f,_0x0580('0x28'));_0x41d2e5[_0x0580('0x32')]=_[_0x0580('0x33')](_0x2ab059[_0x0580('0x32')]);_0x41d2e5[_0x0580('0x34')]=_[_0x0580('0x35')](_0x41d2e5[_0x0580('0x31')],_0x41d2e5['query']);_0x58da68[_0x0580('0x36')]=_[_0x0580('0x35')](_0x41d2e5[_0x0580('0x31')],qs[_0x0580('0x37')](_0x2ab059[_0x0580('0x32')]['fields']));_0x58da68['attributes']=_0x58da68['attributes']['length']?_0x58da68['attributes']:_0x41d2e5[_0x0580('0x31')];if(!_0x2ab059['query'][_0x0580('0x38')](_0x0580('0x39'))){_0x58da68[_0x0580('0x1e')]=qs['limit'](_0x2ab059[_0x0580('0x32')]['limit']);_0x58da68['offset']=qs['offset'](_0x2ab059[_0x0580('0x32')][_0x0580('0x1b')]);}_0x58da68['order']=qs[_0x0580('0x3a')](_0x2ab059[_0x0580('0x32')][_0x0580('0x3a')]);_0x58da68[_0x0580('0x3b')]=qs['filters'](_['pick'](_0x2ab059['query'],_0x41d2e5['filters']),_0x2ddc7f);if(_0x2ab059[_0x0580('0x32')][_0x0580('0x3c')]){_0x58da68[_0x0580('0x3b')]=_[_0x0580('0x3d')](_0x58da68[_0x0580('0x3b')],{'$or':_[_0x0580('0x2b')](_0x2ddc7f,function(_0x675004){if(_0x675004[_0x0580('0x2f')]!=='VIRTUAL'){var _0x2776f4={};_0x2776f4[_0x675004[_0x0580('0x28')]]={'$like':'%'+_0x2ab059[_0x0580('0x32')][_0x0580('0x3c')]+'%'};return _0x2776f4;}})});}_0x58da68=_[_0x0580('0x3d')]({},_0x58da68,_0x2ab059['options']);var _0x569565={'where':_0x58da68[_0x0580('0x3b')]};return db[_0x0580('0x2c')]['count'](_0x569565)[_0x0580('0x24')](function(_0x2ef6a9){_0x209514[_0x0580('0x1d')]=_0x2ef6a9;if(_0x2ab059[_0x0580('0x32')][_0x0580('0x3e')]){_0x58da68[_0x0580('0x3f')]=[{'all':!![]}];}return db[_0x0580('0x2c')][_0x0580('0x40')](_0x58da68);})['then'](function(_0x537e35){_0x209514['rows']=_0x537e35;return _0x209514;})[_0x0580('0x24')](respondWithFilteredResult(_0x18c333,_0x58da68))[_0x0580('0x41')](handleError(_0x18c333,null));};exports[_0x0580('0x42')]=function(_0x24f534,_0xfbbd4){var _0x355201={'raw':![],'where':{'id':_0x24f534[_0x0580('0x43')]['id']}},_0x270230={};_0x270230[_0x0580('0x31')]=_[_0x0580('0x33')](db['Dynamics365Configuration'][_0x0580('0x2d')]);_0x270230['query']=_[_0x0580('0x33')](_0x24f534[_0x0580('0x32')]);_0x270230[_0x0580('0x34')]=_[_0x0580('0x35')](_0x270230[_0x0580('0x31')],_0x270230[_0x0580('0x32')]);_0x355201['attributes']=_[_0x0580('0x35')](_0x270230['model'],qs[_0x0580('0x37')](_0x24f534[_0x0580('0x32')][_0x0580('0x37')]));_0x355201['attributes']=_0x355201[_0x0580('0x36')][_0x0580('0x44')]?_0x355201['attributes']:_0x270230[_0x0580('0x31')];if(_0x24f534[_0x0580('0x32')]['includeAll']){_0x355201[_0x0580('0x3f')]=[{'all':!![]}];}_0x355201=_[_0x0580('0x3d')]({},_0x355201,_0x24f534[_0x0580('0x45')]);return db[_0x0580('0x2c')][_0x0580('0x46')](_0x355201)[_0x0580('0x24')](handleEntityNotFound(_0xfbbd4,null))[_0x0580('0x24')](respondWithResult(_0xfbbd4,null))[_0x0580('0x41')](handleError(_0xfbbd4,null));};exports[_0x0580('0x47')]=function(_0x2727f9,_0x355c26){return db[_0x0580('0x2c')][_0x0580('0x47')](_0x2727f9[_0x0580('0x48')],{})[_0x0580('0x24')](respondWithResult(_0x355c26,0xc9))['catch'](handleError(_0x355c26,null));};exports[_0x0580('0x23')]=function(_0x4e808f,_0x3d0567){if(_0x4e808f[_0x0580('0x48')]['id']){delete _0x4e808f[_0x0580('0x48')]['id'];}return db[_0x0580('0x2c')][_0x0580('0x46')]({'where':{'id':_0x4e808f[_0x0580('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d0567,null))['then'](saveUpdates(_0x4e808f['body'],null))[_0x0580('0x24')](respondWithResult(_0x3d0567,null))['catch'](handleError(_0x3d0567,null));};exports[_0x0580('0x49')]=function(_0x55a29d,_0x4b910c){return db[_0x0580('0x2c')][_0x0580('0x46')]({'where':{'id':_0x55a29d[_0x0580('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b910c,null))[_0x0580('0x24')](removeEntity(_0x4b910c,null))['catch'](handleError(_0x4b910c,null));};exports['getFields']=function(_0x438e6e,_0x4fb47e,_0x52d2ae){var _0x1457c9={};var _0x478a0f={};var _0xd8f143;var _0x13cd68;return db[_0x0580('0x2c')][_0x0580('0x4a')]({'where':{'id':_0x438e6e[_0x0580('0x43')]['id']}})[_0x0580('0x24')](handleEntityNotFound(_0x4fb47e,null))[_0x0580('0x24')](function(_0xce0944){if(_0xce0944){_0xd8f143=_0xce0944;_0x478a0f[_0x0580('0x31')]=_[_0x0580('0x33')](db[_0x0580('0x4b')]['rawAttributes']);_0x478a0f['query']=_[_0x0580('0x33')](_0x438e6e['query']);_0x478a0f['filters']=_['intersection'](_0x478a0f[_0x0580('0x31')],_0x478a0f[_0x0580('0x32')]);_0x1457c9[_0x0580('0x36')]=_[_0x0580('0x35')](_0x478a0f[_0x0580('0x31')],qs[_0x0580('0x37')](_0x438e6e[_0x0580('0x32')][_0x0580('0x37')]));_0x1457c9[_0x0580('0x36')]=_0x1457c9['attributes'][_0x0580('0x44')]?_0x1457c9['attributes']:_0x478a0f[_0x0580('0x31')];_0x1457c9['order']=qs[_0x0580('0x3a')](_0x438e6e[_0x0580('0x32')][_0x0580('0x3a')]);_0x1457c9[_0x0580('0x3b')]=qs[_0x0580('0x34')](_[_0x0580('0x4c')](_0x438e6e['query'],_0x478a0f[_0x0580('0x34')]));if(_0x438e6e[_0x0580('0x32')][_0x0580('0x3c')]){_0x1457c9['where']=_[_0x0580('0x3d')](_0x1457c9[_0x0580('0x3b')],{'$or':_[_0x0580('0x2b')](_0x1457c9['attributes'],function(_0x5d6f0b){var _0x366d00={};_0x366d00[_0x5d6f0b]={'$like':'%'+_0x438e6e[_0x0580('0x32')]['filter']+'%'};return _0x366d00;})});}_0x1457c9=_[_0x0580('0x3d')]({},_0x1457c9,_0x438e6e[_0x0580('0x45')]);return _0xd8f143[_0x0580('0x4d')](_0x1457c9);}})[_0x0580('0x24')](function(_0x1fed8e){if(_0x1fed8e){_0x13cd68=_0x1fed8e[_0x0580('0x44')];if(!_0x438e6e[_0x0580('0x32')][_0x0580('0x38')](_0x0580('0x39'))){_0x1457c9[_0x0580('0x1e')]=qs[_0x0580('0x1e')](_0x438e6e['query']['limit']);_0x1457c9['offset']=qs[_0x0580('0x1b')](_0x438e6e['query'][_0x0580('0x1b')]);}return _0xd8f143[_0x0580('0x4d')](_0x1457c9);}})[_0x0580('0x24')](function(_0x5aea0b){if(_0x5aea0b){return _0x5aea0b?{'count':_0x13cd68,'rows':_0x5aea0b}:null;}})[_0x0580('0x24')](respondWithResult(_0x4fb47e,null))['catch'](handleError(_0x4fb47e,null));};exports[_0x0580('0x4e')]=function(_0xa4a76c,_0x1d5a8c,_0x525e7f){var _0x14b65c={};var _0x4f8a4d={};var _0x712af8;var _0x3b5540;return db[_0x0580('0x2c')][_0x0580('0x4a')]({'where':{'id':_0xa4a76c['params']['id']}})[_0x0580('0x24')](handleEntityNotFound(_0x1d5a8c,null))[_0x0580('0x24')](function(_0x3e5a41){if(_0x3e5a41){_0x712af8=_0x3e5a41;_0x4f8a4d['model']=_[_0x0580('0x33')](db[_0x0580('0x4b')]['rawAttributes']);_0x4f8a4d[_0x0580('0x32')]=_[_0x0580('0x33')](_0xa4a76c[_0x0580('0x32')]);_0x4f8a4d[_0x0580('0x34')]=_[_0x0580('0x35')](_0x4f8a4d[_0x0580('0x31')],_0x4f8a4d[_0x0580('0x32')]);_0x14b65c[_0x0580('0x36')]=_[_0x0580('0x35')](_0x4f8a4d[_0x0580('0x31')],qs['fields'](_0xa4a76c[_0x0580('0x32')][_0x0580('0x37')]));_0x14b65c[_0x0580('0x36')]=_0x14b65c[_0x0580('0x36')][_0x0580('0x44')]?_0x14b65c[_0x0580('0x36')]:_0x4f8a4d[_0x0580('0x31')];_0x14b65c[_0x0580('0x4f')]=qs[_0x0580('0x3a')](_0xa4a76c[_0x0580('0x32')]['sort']);_0x14b65c[_0x0580('0x3b')]=qs[_0x0580('0x34')](_[_0x0580('0x4c')](_0xa4a76c['query'],_0x4f8a4d[_0x0580('0x34')]));if(_0xa4a76c['query'][_0x0580('0x3c')]){_0x14b65c['where']=_['merge'](_0x14b65c['where'],{'$or':_['map'](_0x14b65c[_0x0580('0x36')],function(_0x4da5b4){var _0xf4c830={};_0xf4c830[_0x4da5b4]={'$like':'%'+_0xa4a76c['query'][_0x0580('0x3c')]+'%'};return _0xf4c830;})});}_0x14b65c=_[_0x0580('0x3d')]({},_0x14b65c,_0xa4a76c['options']);return _0x712af8[_0x0580('0x4e')](_0x14b65c);}})[_0x0580('0x24')](function(_0xc3b26){if(_0xc3b26){_0x3b5540=_0xc3b26[_0x0580('0x44')];if(!_0xa4a76c[_0x0580('0x32')][_0x0580('0x38')](_0x0580('0x39'))){_0x14b65c[_0x0580('0x1e')]=qs[_0x0580('0x1e')](_0xa4a76c[_0x0580('0x32')][_0x0580('0x1e')]);_0x14b65c[_0x0580('0x1b')]=qs['offset'](_0xa4a76c['query'][_0x0580('0x1b')]);}return _0x712af8[_0x0580('0x4e')](_0x14b65c);}})[_0x0580('0x24')](function(_0x20c5a2){if(_0x20c5a2){return _0x20c5a2?{'count':_0x3b5540,'rows':_0x20c5a2}:null;}})['then'](respondWithResult(_0x1d5a8c,null))[_0x0580('0x41')](handleError(_0x1d5a8c,null));};exports['getDescriptions']=function(_0x1d7675,_0xa81442,_0x54ebf2){var _0x12669f={};var _0x2a9146={};var _0xbb1cee;var _0x3fb9c0;return db[_0x0580('0x2c')][_0x0580('0x4a')]({'where':{'id':_0x1d7675['params']['id']}})[_0x0580('0x24')](handleEntityNotFound(_0xa81442,null))[_0x0580('0x24')](function(_0x4fb413){if(_0x4fb413){_0xbb1cee=_0x4fb413;_0x2a9146[_0x0580('0x31')]=_['keys'](db[_0x0580('0x4b')][_0x0580('0x2d')]);_0x2a9146['query']=_['keys'](_0x1d7675['query']);_0x2a9146[_0x0580('0x34')]=_[_0x0580('0x35')](_0x2a9146[_0x0580('0x31')],_0x2a9146[_0x0580('0x32')]);_0x12669f['attributes']=_[_0x0580('0x35')](_0x2a9146[_0x0580('0x31')],qs[_0x0580('0x37')](_0x1d7675[_0x0580('0x32')][_0x0580('0x37')]));_0x12669f['attributes']=_0x12669f[_0x0580('0x36')][_0x0580('0x44')]?_0x12669f['attributes']:_0x2a9146[_0x0580('0x31')];_0x12669f[_0x0580('0x4f')]=qs['sort'](_0x1d7675[_0x0580('0x32')][_0x0580('0x3a')]);_0x12669f['where']=qs['filters'](_[_0x0580('0x4c')](_0x1d7675[_0x0580('0x32')],_0x2a9146[_0x0580('0x34')]));if(_0x1d7675[_0x0580('0x32')]['filter']){_0x12669f[_0x0580('0x3b')]=_[_0x0580('0x3d')](_0x12669f[_0x0580('0x3b')],{'$or':_[_0x0580('0x2b')](_0x12669f[_0x0580('0x36')],function(_0xe7032e){var _0x23732a={};_0x23732a[_0xe7032e]={'$like':'%'+_0x1d7675[_0x0580('0x32')]['filter']+'%'};return _0x23732a;})});}_0x12669f=_[_0x0580('0x3d')]({},_0x12669f,_0x1d7675[_0x0580('0x45')]);return _0xbb1cee[_0x0580('0x50')](_0x12669f);}})[_0x0580('0x24')](function(_0x2d53a8){if(_0x2d53a8){_0x3fb9c0=_0x2d53a8[_0x0580('0x44')];if(!_0x1d7675[_0x0580('0x32')][_0x0580('0x38')]('nolimit')){_0x12669f[_0x0580('0x1e')]=qs[_0x0580('0x1e')](_0x1d7675[_0x0580('0x32')][_0x0580('0x1e')]);_0x12669f[_0x0580('0x1b')]=qs[_0x0580('0x1b')](_0x1d7675[_0x0580('0x32')][_0x0580('0x1b')]);}return _0xbb1cee['getDescriptions'](_0x12669f);}})['then'](function(_0x1ce647){if(_0x1ce647){return _0x1ce647?{'count':_0x3fb9c0,'rows':_0x1ce647}:null;}})[_0x0580('0x24')](respondWithResult(_0xa81442,null))['catch'](handleError(_0xa81442,null));}; \ No newline at end of file +var _0x2d12=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getFields','findOne','length','pick','nolimit','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','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','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','Dynamics365Configuration','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters'];(function(_0x319af4,_0x19cce9){var _0x187817=function(_0x28a263){while(--_0x28a263){_0x319af4['push'](_0x319af4['shift']());}};_0x187817(++_0x19cce9);}(_0x2d12,0x1e3));var _0x22d1=function(_0x5f20a8,_0x1581c6){_0x5f20a8=_0x5f20a8-0x0;var _0x482266=_0x2d12[_0x5f20a8];return _0x482266;};'use strict';var emlformat=require(_0x22d1('0x0'));var rimraf=require(_0x22d1('0x1'));var zipdir=require(_0x22d1('0x2'));var jsonpatch=require(_0x22d1('0x3'));var rp=require('request-promise');var moment=require(_0x22d1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x22d1('0x5'));var ejs=require(_0x22d1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22d1('0x7'));var squel=require(_0x22d1('0x8'));var crypto=require(_0x22d1('0x9'));var jsforce=require(_0x22d1('0xa'));var deskjs=require(_0x22d1('0xb'));var toCsv=require(_0x22d1('0x5'));var querystring=require(_0x22d1('0xc'));var Papa=require(_0x22d1('0xd'));var Redis=require('ioredis');var authService=require(_0x22d1('0xe'));var qs=require(_0x22d1('0xf'));var as=require(_0x22d1('0x10'));var hardwareService=require(_0x22d1('0x11'));var logger=require(_0x22d1('0x12'))(_0x22d1('0x13'));var utils=require(_0x22d1('0x14'));var config=require(_0x22d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x22d1('0x16'))['db'];function respondWithStatusCode(_0x350c66,_0x30da3f){_0x30da3f=_0x30da3f||0xcc;return function(_0x5b52a2){if(_0x5b52a2){return _0x350c66['sendStatus'](_0x30da3f);}return _0x350c66[_0x22d1('0x17')](_0x30da3f)[_0x22d1('0x18')]();};}function respondWithResult(_0x362bd5,_0x16be8c){_0x16be8c=_0x16be8c||0xc8;return function(_0x110dba){if(_0x110dba){return _0x362bd5[_0x22d1('0x17')](_0x16be8c)[_0x22d1('0x19')](_0x110dba);}};}function respondWithFilteredResult(_0x566bda,_0x1f26ea){return function(_0x134417){if(_0x134417){var _0x350bd9=typeof _0x1f26ea['offset']===_0x22d1('0x1a')&&typeof _0x1f26ea[_0x22d1('0x1b')]==='undefined';var _0x260b7b=_0x134417[_0x22d1('0x1c')];var _0x17d3a2=_0x350bd9?0x0:_0x1f26ea[_0x22d1('0x1d')];var _0x1bde18=_0x350bd9?_0x134417[_0x22d1('0x1c')]:_0x1f26ea[_0x22d1('0x1d')]+_0x1f26ea['limit'];var _0x37cade;if(_0x1bde18>=_0x260b7b){_0x1bde18=_0x260b7b;_0x37cade=0xc8;}else{_0x37cade=0xce;}_0x566bda['status'](_0x37cade);return _0x566bda[_0x22d1('0x1e')](_0x22d1('0x1f'),_0x17d3a2+'-'+_0x1bde18+'/'+_0x260b7b)[_0x22d1('0x19')](_0x134417);}return null;};}function patchUpdates(_0x5b748d){return function(_0x3c0c34){try{jsonpatch[_0x22d1('0x20')](_0x3c0c34,_0x5b748d,!![]);}catch(_0x4bb801){return BPromise[_0x22d1('0x21')](_0x4bb801);}return _0x3c0c34['save']();};}function saveUpdates(_0x2d4a15,_0x37e773){return function(_0x25c860){if(_0x25c860){return _0x25c860[_0x22d1('0x22')](_0x2d4a15)[_0x22d1('0x23')](function(_0x43aea5){return _0x43aea5;});}return null;};}function removeEntity(_0xfc1fc,_0x591a58){return function(_0x58732d){if(_0x58732d){return _0x58732d[_0x22d1('0x24')]()['then'](function(){_0xfc1fc[_0x22d1('0x17')](0xcc)[_0x22d1('0x18')]();});}};}function handleEntityNotFound(_0x56d47f,_0x5795aa){return function(_0x532180){if(!_0x532180){_0x56d47f['sendStatus'](0x194);}return _0x532180;};}function handleError(_0x53e36b,_0x1d4330){_0x1d4330=_0x1d4330||0x1f4;return function(_0x9d1e04){logger[_0x22d1('0x25')](_0x9d1e04['stack']);if(_0x9d1e04[_0x22d1('0x26')]){delete _0x9d1e04[_0x22d1('0x26')];}_0x53e36b['status'](_0x1d4330)[_0x22d1('0x27')](_0x9d1e04);};}exports['index']=function(_0x2c1f44,_0x13d3b6){var _0x4b2d81={},_0x55719b={},_0x25ad10={'count':0x0,'rows':[]};var _0x1576dc=_[_0x22d1('0x28')](db[_0x22d1('0x29')][_0x22d1('0x2a')],function(_0x364542){return{'name':_0x364542['fieldName'],'type':_0x364542[_0x22d1('0x2b')][_0x22d1('0x2c')]};});_0x55719b[_0x22d1('0x2d')]=_[_0x22d1('0x28')](_0x1576dc,_0x22d1('0x26'));_0x55719b['query']=_[_0x22d1('0x2e')](_0x2c1f44[_0x22d1('0x2f')]);_0x55719b['filters']=_['intersection'](_0x55719b[_0x22d1('0x2d')],_0x55719b[_0x22d1('0x2f')]);_0x4b2d81['attributes']=_[_0x22d1('0x30')](_0x55719b[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x31')]));_0x4b2d81['attributes']=_0x4b2d81[_0x22d1('0x32')]['length']?_0x4b2d81[_0x22d1('0x32')]:_0x55719b[_0x22d1('0x2d')];if(!_0x2c1f44['query'][_0x22d1('0x33')]('nolimit')){_0x4b2d81[_0x22d1('0x1b')]=qs['limit'](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x4b2d81['offset']=qs[_0x22d1('0x1d')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x1d')]);}_0x4b2d81[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x35')]);_0x4b2d81[_0x22d1('0x36')]=qs[_0x22d1('0x37')](_['pick'](_0x2c1f44[_0x22d1('0x2f')],_0x55719b[_0x22d1('0x37')]),_0x1576dc);if(_0x2c1f44[_0x22d1('0x2f')][_0x22d1('0x38')]){_0x4b2d81[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x4b2d81[_0x22d1('0x36')],{'$or':_['map'](_0x1576dc,function(_0x2db7a2){if(_0x2db7a2[_0x22d1('0x2b')]!==_0x22d1('0x3a')){var _0x4183bf={};_0x4183bf[_0x2db7a2[_0x22d1('0x26')]]={'$like':'%'+_0x2c1f44['query']['filter']+'%'};return _0x4183bf;}})});}_0x4b2d81=_[_0x22d1('0x39')]({},_0x4b2d81,_0x2c1f44[_0x22d1('0x3b')]);var _0x34c7f0={'where':_0x4b2d81['where']};return db[_0x22d1('0x29')][_0x22d1('0x1c')](_0x34c7f0)[_0x22d1('0x23')](function(_0x430fe6){_0x25ad10['count']=_0x430fe6;if(_0x2c1f44['query'][_0x22d1('0x3c')]){_0x4b2d81[_0x22d1('0x3d')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x22d1('0x3e')](_0x4b2d81);})[_0x22d1('0x23')](function(_0xf42feb){_0x25ad10['rows']=_0xf42feb;return _0x25ad10;})[_0x22d1('0x23')](respondWithFilteredResult(_0x13d3b6,_0x4b2d81))[_0x22d1('0x3f')](handleError(_0x13d3b6,null));};exports[_0x22d1('0x40')]=function(_0x34c8ed,_0x2e35b4){var _0x5d312f={'raw':![],'where':{'id':_0x34c8ed[_0x22d1('0x41')]['id']}},_0x2a491a={};_0x2a491a[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x29')]['rawAttributes']);_0x2a491a[_0x22d1('0x2f')]=_['keys'](_0x34c8ed[_0x22d1('0x2f')]);_0x2a491a[_0x22d1('0x37')]=_[_0x22d1('0x30')](_0x2a491a[_0x22d1('0x2d')],_0x2a491a[_0x22d1('0x2f')]);_0x5d312f[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x2a491a[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x34c8ed[_0x22d1('0x2f')][_0x22d1('0x31')]));_0x5d312f[_0x22d1('0x32')]=_0x5d312f['attributes']['length']?_0x5d312f['attributes']:_0x2a491a[_0x22d1('0x2d')];if(_0x34c8ed[_0x22d1('0x2f')][_0x22d1('0x3c')]){_0x5d312f[_0x22d1('0x3d')]=[{'all':!![]}];}_0x5d312f=_[_0x22d1('0x39')]({},_0x5d312f,_0x34c8ed[_0x22d1('0x3b')]);return db[_0x22d1('0x29')][_0x22d1('0x42')](_0x5d312f)[_0x22d1('0x23')](handleEntityNotFound(_0x2e35b4,null))[_0x22d1('0x23')](respondWithResult(_0x2e35b4,null))['catch'](handleError(_0x2e35b4,null));};exports[_0x22d1('0x43')]=function(_0x4a0b2d,_0x55af90){return db[_0x22d1('0x29')][_0x22d1('0x43')](_0x4a0b2d['body'],{})[_0x22d1('0x23')](respondWithResult(_0x55af90,0xc9))[_0x22d1('0x3f')](handleError(_0x55af90,null));};exports[_0x22d1('0x22')]=function(_0x49d56a,_0x4e66e2){if(_0x49d56a['body']['id']){delete _0x49d56a[_0x22d1('0x44')]['id'];}return db[_0x22d1('0x29')][_0x22d1('0x42')]({'where':{'id':_0x49d56a[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x4e66e2,null))['then'](saveUpdates(_0x49d56a[_0x22d1('0x44')],null))[_0x22d1('0x23')](respondWithResult(_0x4e66e2,null))['catch'](handleError(_0x4e66e2,null));};exports[_0x22d1('0x24')]=function(_0x5595bb,_0x353679){return db[_0x22d1('0x29')]['find']({'where':{'id':_0x5595bb[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x353679,null))[_0x22d1('0x23')](removeEntity(_0x353679,null))[_0x22d1('0x3f')](handleError(_0x353679,null));};exports[_0x22d1('0x45')]=function(_0x15065e,_0x1ddf3b,_0x5765a1){var _0x7f0347={};var _0x27548a={};var _0x3e91ac;var _0x444e81;return db[_0x22d1('0x29')][_0x22d1('0x46')]({'where':{'id':_0x15065e[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x1ddf3b,null))[_0x22d1('0x23')](function(_0x548847){if(_0x548847){_0x3e91ac=_0x548847;_0x27548a['model']=_[_0x22d1('0x2e')](db['Dynamics365Field'][_0x22d1('0x2a')]);_0x27548a['query']=_[_0x22d1('0x2e')](_0x15065e['query']);_0x27548a['filters']=_[_0x22d1('0x30')](_0x27548a[_0x22d1('0x2d')],_0x27548a[_0x22d1('0x2f')]);_0x7f0347[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x27548a[_0x22d1('0x2d')],qs[_0x22d1('0x31')](_0x15065e[_0x22d1('0x2f')]['fields']));_0x7f0347['attributes']=_0x7f0347[_0x22d1('0x32')][_0x22d1('0x47')]?_0x7f0347[_0x22d1('0x32')]:_0x27548a[_0x22d1('0x2d')];_0x7f0347[_0x22d1('0x34')]=qs['sort'](_0x15065e['query'][_0x22d1('0x35')]);_0x7f0347['where']=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x15065e[_0x22d1('0x2f')],_0x27548a[_0x22d1('0x37')]));if(_0x15065e[_0x22d1('0x2f')][_0x22d1('0x38')]){_0x7f0347[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x7f0347[_0x22d1('0x36')],{'$or':_[_0x22d1('0x28')](_0x7f0347[_0x22d1('0x32')],function(_0x4c69be){var _0x418182={};_0x418182[_0x4c69be]={'$like':'%'+_0x15065e[_0x22d1('0x2f')]['filter']+'%'};return _0x418182;})});}_0x7f0347=_[_0x22d1('0x39')]({},_0x7f0347,_0x15065e[_0x22d1('0x3b')]);return _0x3e91ac['getFields'](_0x7f0347);}})[_0x22d1('0x23')](function(_0x57712d){if(_0x57712d){_0x444e81=_0x57712d[_0x22d1('0x47')];if(!_0x15065e[_0x22d1('0x2f')][_0x22d1('0x33')](_0x22d1('0x49'))){_0x7f0347['limit']=qs[_0x22d1('0x1b')](_0x15065e[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x7f0347[_0x22d1('0x1d')]=qs[_0x22d1('0x1d')](_0x15065e['query'][_0x22d1('0x1d')]);}return _0x3e91ac[_0x22d1('0x45')](_0x7f0347);}})[_0x22d1('0x23')](function(_0x2e3777){if(_0x2e3777){return _0x2e3777?{'count':_0x444e81,'rows':_0x2e3777}:null;}})[_0x22d1('0x23')](respondWithResult(_0x1ddf3b,null))[_0x22d1('0x3f')](handleError(_0x1ddf3b,null));};exports[_0x22d1('0x4a')]=function(_0x2f78f6,_0x534e79,_0x4e0162){var _0x5823f1={};var _0xcc67a4={};var _0x58c7ac;var _0x36c0f5;return db['Dynamics365Configuration'][_0x22d1('0x46')]({'where':{'id':_0x2f78f6[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x534e79,null))[_0x22d1('0x23')](function(_0x1c6690){if(_0x1c6690){_0x58c7ac=_0x1c6690;_0xcc67a4[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x4b')]['rawAttributes']);_0xcc67a4['query']=_[_0x22d1('0x2e')](_0x2f78f6[_0x22d1('0x2f')]);_0xcc67a4[_0x22d1('0x37')]=_['intersection'](_0xcc67a4[_0x22d1('0x2d')],_0xcc67a4['query']);_0x5823f1['attributes']=_[_0x22d1('0x30')](_0xcc67a4['model'],qs[_0x22d1('0x31')](_0x2f78f6['query']['fields']));_0x5823f1[_0x22d1('0x32')]=_0x5823f1[_0x22d1('0x32')][_0x22d1('0x47')]?_0x5823f1[_0x22d1('0x32')]:_0xcc67a4[_0x22d1('0x2d')];_0x5823f1[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x2f78f6[_0x22d1('0x2f')]['sort']);_0x5823f1['where']=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x2f78f6[_0x22d1('0x2f')],_0xcc67a4[_0x22d1('0x37')]));if(_0x2f78f6['query']['filter']){_0x5823f1[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x5823f1['where'],{'$or':_[_0x22d1('0x28')](_0x5823f1[_0x22d1('0x32')],function(_0x41c0a1){var _0xf1348={};_0xf1348[_0x41c0a1]={'$like':'%'+_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x38')]+'%'};return _0xf1348;})});}_0x5823f1=_['merge']({},_0x5823f1,_0x2f78f6['options']);return _0x58c7ac['getSubjects'](_0x5823f1);}})['then'](function(_0x48d356){if(_0x48d356){_0x36c0f5=_0x48d356[_0x22d1('0x47')];if(!_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x33')]('nolimit')){_0x5823f1[_0x22d1('0x1b')]=qs[_0x22d1('0x1b')](_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x1b')]);_0x5823f1[_0x22d1('0x1d')]=qs['offset'](_0x2f78f6[_0x22d1('0x2f')][_0x22d1('0x1d')]);}return _0x58c7ac[_0x22d1('0x4a')](_0x5823f1);}})[_0x22d1('0x23')](function(_0xa8463c){if(_0xa8463c){return _0xa8463c?{'count':_0x36c0f5,'rows':_0xa8463c}:null;}})[_0x22d1('0x23')](respondWithResult(_0x534e79,null))[_0x22d1('0x3f')](handleError(_0x534e79,null));};exports[_0x22d1('0x4c')]=function(_0x342744,_0x1973b1,_0x5e8c39){var _0x500068={};var _0x34c6da={};var _0x3ca95c;var _0x17b0ca;return db[_0x22d1('0x29')][_0x22d1('0x46')]({'where':{'id':_0x342744[_0x22d1('0x41')]['id']}})[_0x22d1('0x23')](handleEntityNotFound(_0x1973b1,null))[_0x22d1('0x23')](function(_0x5535dd){if(_0x5535dd){_0x3ca95c=_0x5535dd;_0x34c6da[_0x22d1('0x2d')]=_[_0x22d1('0x2e')](db[_0x22d1('0x4b')][_0x22d1('0x2a')]);_0x34c6da['query']=_[_0x22d1('0x2e')](_0x342744[_0x22d1('0x2f')]);_0x34c6da[_0x22d1('0x37')]=_[_0x22d1('0x30')](_0x34c6da[_0x22d1('0x2d')],_0x34c6da[_0x22d1('0x2f')]);_0x500068[_0x22d1('0x32')]=_[_0x22d1('0x30')](_0x34c6da[_0x22d1('0x2d')],qs['fields'](_0x342744[_0x22d1('0x2f')]['fields']));_0x500068['attributes']=_0x500068[_0x22d1('0x32')][_0x22d1('0x47')]?_0x500068[_0x22d1('0x32')]:_0x34c6da[_0x22d1('0x2d')];_0x500068[_0x22d1('0x34')]=qs[_0x22d1('0x35')](_0x342744[_0x22d1('0x2f')][_0x22d1('0x35')]);_0x500068[_0x22d1('0x36')]=qs[_0x22d1('0x37')](_[_0x22d1('0x48')](_0x342744[_0x22d1('0x2f')],_0x34c6da[_0x22d1('0x37')]));if(_0x342744['query'][_0x22d1('0x38')]){_0x500068[_0x22d1('0x36')]=_[_0x22d1('0x39')](_0x500068['where'],{'$or':_[_0x22d1('0x28')](_0x500068[_0x22d1('0x32')],function(_0x9a22a5){var _0x483ef4={};_0x483ef4[_0x9a22a5]={'$like':'%'+_0x342744[_0x22d1('0x2f')][_0x22d1('0x38')]+'%'};return _0x483ef4;})});}_0x500068=_[_0x22d1('0x39')]({},_0x500068,_0x342744[_0x22d1('0x3b')]);return _0x3ca95c[_0x22d1('0x4c')](_0x500068);}})[_0x22d1('0x23')](function(_0x5cce2a){if(_0x5cce2a){_0x17b0ca=_0x5cce2a[_0x22d1('0x47')];if(!_0x342744[_0x22d1('0x2f')][_0x22d1('0x33')](_0x22d1('0x49'))){_0x500068['limit']=qs[_0x22d1('0x1b')](_0x342744['query'][_0x22d1('0x1b')]);_0x500068[_0x22d1('0x1d')]=qs['offset'](_0x342744[_0x22d1('0x2f')][_0x22d1('0x1d')]);}return _0x3ca95c[_0x22d1('0x4c')](_0x500068);}})[_0x22d1('0x23')](function(_0x5d1190){if(_0x5d1190){return _0x5d1190?{'count':_0x17b0ca,'rows':_0x5d1190}:null;}})[_0x22d1('0x23')](respondWithResult(_0x1973b1,null))[_0x22d1('0x3f')](handleError(_0x1973b1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8ae37d6..4501b09 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 _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x29e119,_0x51a2fd){var _0x49161b=function(_0x43047e){while(--_0x43047e){_0x29e119['push'](_0x29e119['shift']());}};_0x49161b(++_0x51a2fd);}(_0x34e8,0x12c));var _0x834e=function(_0x341e16,_0x1f912f){_0x341e16=_0x341e16-0x0;var _0xdb6599=_0x34e8[_0x341e16];return _0xdb6599;};'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 +var _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x283cb6,_0x2fe492){var _0x2ad9c9=function(_0x5195f0){while(--_0x5195f0){_0x283cb6['push'](_0x283cb6['shift']());}};_0x2ad9c9(++_0x2fe492);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x49ad17,_0x127d26){_0x49ad17=_0x49ad17-0x0;var _0x1ec05f=_0x8d0e[_0x49ad17];return _0x1ec05f;};'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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 98f8ae3..eb1df75 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 _0x2438=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x912e23,_0x15f457){var _0x453f72=function(_0x46a210){while(--_0x46a210){_0x912e23['push'](_0x912e23['shift']());}};_0x453f72(++_0x15f457);}(_0x2438,0xd4));var _0x8243=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x2438[_0x53f608];return _0x495b7d;};'use strict';var _=require('lodash');var util=require(_0x8243('0x0'));var moment=require(_0x8243('0x1'));var BPromise=require('bluebird');var rs=require(_0x8243('0x2'));var fs=require('fs');var Redis=require(_0x8243('0x3'));var db=require(_0x8243('0x4'))['db'];var utils=require(_0x8243('0x5'));var logger=require('../../config/logger')(_0x8243('0x6'));var config=require(_0x8243('0x7'));var jayson=require(_0x8243('0x8'));var client=jayson[_0x8243('0x9')][_0x8243('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7b638,_0x427216,_0x533a3d){return new BPromise(function(_0x4312f8,_0x2e3772){return client[_0x8243('0xb')](_0xf7b638,_0x533a3d)['then'](function(_0x29caf7){logger[_0x8243('0xc')](_0x8243('0xd'),_0x427216,'request\x20sent');logger[_0x8243('0xe')](_0x8243('0xf'),_0x427216,_0x8243('0x10'),JSON['stringify'](_0x29caf7));if(_0x29caf7['error']){if(_0x29caf7[_0x8243('0x11')]['code']===0x1f4){logger['error'](_0x8243('0xd'),_0x427216,_0x29caf7[_0x8243('0x11')][_0x8243('0x12')]);return _0x2e3772(_0x29caf7[_0x8243('0x11')][_0x8243('0x12')]);}logger[_0x8243('0x11')](_0x8243('0xd'),_0x427216,_0x29caf7['error'][_0x8243('0x12')]);return _0x4312f8(_0x29caf7[_0x8243('0x11')]['message']);}else{logger[_0x8243('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x427216,_0x8243('0x10'));_0x4312f8(_0x29caf7[_0x8243('0x13')]['message']);}})[_0x8243('0x14')](function(_0x127e2b){logger[_0x8243('0x11')](_0x8243('0xd'),_0x427216,_0x127e2b);_0x2e3772(_0x127e2b);});});} \ No newline at end of file +var _0xd885=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f176b,_0x43309e){var _0x1c7a95=function(_0x1cc3a0){while(--_0x1cc3a0){_0x3f176b['push'](_0x3f176b['shift']());}};_0x1c7a95(++_0x43309e);}(_0xd885,0x74));var _0x5d88=function(_0x324498,_0x3c66e5){_0x324498=_0x324498-0x0;var _0xd5685=_0xd885[_0x324498];return _0xd5685;};'use strict';var _=require(_0x5d88('0x0'));var util=require('util');var moment=require(_0x5d88('0x1'));var BPromise=require(_0x5d88('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d88('0x3'))['db'];var utils=require(_0x5d88('0x4'));var logger=require(_0x5d88('0x5'))(_0x5d88('0x6'));var config=require(_0x5d88('0x7'));var jayson=require(_0x5d88('0x8'));var client=jayson[_0x5d88('0x9')][_0x5d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a798e,_0x2fa3db,_0x31d79b){return new BPromise(function(_0x1bac17,_0xc3fdf3){return client[_0x5d88('0xb')](_0x2a798e,_0x31d79b)[_0x5d88('0xc')](function(_0x1c1ffa){logger[_0x5d88('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fa3db,'request\x20sent');logger['debug'](_0x5d88('0xe'),_0x2fa3db,_0x5d88('0xf'),JSON['stringify'](_0x1c1ffa));if(_0x1c1ffa[_0x5d88('0x10')]){if(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x11')]===0x1f4){logger[_0x5d88('0x10')](_0x5d88('0x12'),_0x2fa3db,_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);return _0xc3fdf3(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);}logger['error'](_0x5d88('0x12'),_0x2fa3db,_0x1c1ffa['error'][_0x5d88('0x13')]);return _0x1bac17(_0x1c1ffa[_0x5d88('0x10')][_0x5d88('0x13')]);}else{logger[_0x5d88('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2fa3db,_0x5d88('0xf'));_0x1bac17(_0x1c1ffa['result'][_0x5d88('0x13')]);}})[_0x5d88('0x14')](function(_0xa0e44d){logger[_0x5d88('0x10')](_0x5d88('0x12'),_0x2fa3db,_0xa0e44d);_0xc3fdf3(_0xa0e44d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 2ff899b..d0d765f 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 _0x1668=['update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x44eb56,_0x435842){var _0x16a926=function(_0x1c4bb3){while(--_0x1c4bb3){_0x44eb56['push'](_0x44eb56['shift']());}};_0x16a926(++_0x435842);}(_0x1668,0xf2));var _0x8166=function(_0x1d3091,_0x39f3b5){_0x1d3091=_0x1d3091-0x0;var _0x98700c=_0x1668[_0x1d3091];return _0x98700c;};'use strict';var multer=require('multer');var util=require(_0x8166('0x0'));var path=require(_0x8166('0x1'));var timeout=require(_0x8166('0x2'));var express=require('express');var router=express[_0x8166('0x3')]();var fs_extra=require(_0x8166('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8166('0x5'));var controller=require('./intDynamics365Field.controller');router[_0x8166('0x6')]('/',auth['isAuthenticated'](),controller[_0x8166('0x7')]);router[_0x8166('0x6')](_0x8166('0x8'),auth[_0x8166('0x9')](),controller[_0x8166('0xa')]);router['post']('/',auth[_0x8166('0x9')](),controller[_0x8166('0xb')]);router[_0x8166('0xc')]('/:id',auth[_0x8166('0x9')](),controller[_0x8166('0xd')]);router[_0x8166('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8166('0xf')]);module[_0x8166('0x10')]=router; \ No newline at end of file +var _0xb6c6=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update'];(function(_0x238950,_0xac79d7){var _0x505840=function(_0x3b5bbb){while(--_0x3b5bbb){_0x238950['push'](_0x238950['shift']());}};_0x505840(++_0xac79d7);}(_0xb6c6,0x1e9));var _0x6b6c=function(_0x188658,_0x12b855){_0x188658=_0x188658-0x0;var _0x3b05d3=_0xb6c6[_0x188658];return _0x3b05d3;};'use strict';var multer=require(_0x6b6c('0x0'));var util=require(_0x6b6c('0x1'));var path=require('path');var timeout=require(_0x6b6c('0x2'));var express=require('express');var router=express[_0x6b6c('0x3')]();var fs_extra=require(_0x6b6c('0x4'));var auth=require(_0x6b6c('0x5'));var interaction=require(_0x6b6c('0x6'));var config=require(_0x6b6c('0x7'));var controller=require(_0x6b6c('0x8'));router[_0x6b6c('0x9')]('/',auth[_0x6b6c('0xa')](),controller['index']);router[_0x6b6c('0x9')](_0x6b6c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x6b6c('0xc')]('/',auth[_0x6b6c('0xa')](),controller['create']);router[_0x6b6c('0xd')](_0x6b6c('0xb'),auth['isAuthenticated'](),controller[_0x6b6c('0xe')]);router[_0x6b6c('0xf')](_0x6b6c('0xb'),auth[_0x6b6c('0xa')](),controller[_0x6b6c('0x10')]);module[_0x6b6c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index feb5395..dc32917 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 _0xa158=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1ec09e,_0x15cabd){var _0x3d6a3d=function(_0x5d999a){while(--_0x5d999a){_0x1ec09e['push'](_0x1ec09e['shift']());}};_0x3d6a3d(++_0x15cabd);}(_0xa158,0xf8));var _0x8a15=function(_0x168f28,_0x3479c4){_0x168f28=_0x168f28-0x0;var _0x42d731=_0xa158[_0x168f28];return _0x42d731;};'use strict';var Sequelize=require(_0x8a15('0x0'));module[_0x8a15('0x1')]={'type':{'type':Sequelize[_0x8a15('0x2')](_0x8a15('0x3'),_0x8a15('0x4'),_0x8a15('0x5'),_0x8a15('0x6'),_0x8a15('0x7')),'defaultValue':_0x8a15('0x3')},'content':{'type':Sequelize[_0x8a15('0x8')]},'key':{'type':Sequelize[_0x8a15('0x8')]},'keyType':{'type':Sequelize[_0x8a15('0x2')](_0x8a15('0x3'),_0x8a15('0x4'),_0x8a15('0x5'))},'keyContent':{'type':Sequelize[_0x8a15('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8a15('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a15('0x8')]}}; \ No newline at end of file +var _0xbf4c=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x7700d,_0x2b83b6){var _0x19cf1e=function(_0x18f13e){while(--_0x18f13e){_0x7700d['push'](_0x7700d['shift']());}};_0x19cf1e(++_0x2b83b6);}(_0xbf4c,0x169));var _0xcbf4=function(_0x5f4b44,_0x5463d7){_0x5f4b44=_0x5f4b44-0x0;var _0xe86de0=_0xbf4c[_0x5f4b44];return _0xe86de0;};'use strict';var Sequelize=require(_0xcbf4('0x0'));module[_0xcbf4('0x1')]={'type':{'type':Sequelize[_0xcbf4('0x2')](_0xcbf4('0x3'),_0xcbf4('0x4'),_0xcbf4('0x5'),_0xcbf4('0x6'),'picklist'),'defaultValue':_0xcbf4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcbf4('0x7')]},'keyType':{'type':Sequelize[_0xcbf4('0x2')](_0xcbf4('0x3'),_0xcbf4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xcbf4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcbf4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbf4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a092307..3b0c56a 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 _0xc31a=['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','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','Dynamics365Field','rows','catch','keys','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc31a,0x170));var _0xac31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc31a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xac31('0x0'));var rimraf=require(_0xac31('0x1'));var zipdir=require(_0xac31('0x2'));var jsonpatch=require(_0xac31('0x3'));var rp=require('request-promise');var moment=require(_0xac31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac31('0x5'));var util=require(_0xac31('0x6'));var path=require(_0xac31('0x7'));var sox=require('sox');var csv=require(_0xac31('0x8'));var ejs=require(_0xac31('0x9'));var fs=require('fs');var fs_extra=require(_0xac31('0xa'));var _=require('lodash');var squel=require(_0xac31('0xb'));var crypto=require(_0xac31('0xc'));var jsforce=require(_0xac31('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac31('0x8'));var querystring=require(_0xac31('0xe'));var Papa=require(_0xac31('0xf'));var Redis=require(_0xac31('0x10'));var authService=require(_0xac31('0x11'));var qs=require(_0xac31('0x12'));var as=require(_0xac31('0x13'));var hardwareService=require(_0xac31('0x14'));var logger=require(_0xac31('0x15'))(_0xac31('0x16'));var utils=require(_0xac31('0x17'));var config=require(_0xac31('0x18'));var licenseUtil=require(_0xac31('0x19'));var db=require(_0xac31('0x1a'))['db'];function respondWithStatusCode(_0x530e69,_0x26b12c){_0x26b12c=_0x26b12c||0xcc;return function(_0x4734d9){if(_0x4734d9){return _0x530e69[_0xac31('0x1b')](_0x26b12c);}return _0x530e69[_0xac31('0x1c')](_0x26b12c)[_0xac31('0x1d')]();};}function respondWithResult(_0x2db993,_0x28923d){_0x28923d=_0x28923d||0xc8;return function(_0x1382e4){if(_0x1382e4){return _0x2db993[_0xac31('0x1c')](_0x28923d)[_0xac31('0x1e')](_0x1382e4);}};}function respondWithFilteredResult(_0x213ddd,_0x448c78){return function(_0x36ba26){if(_0x36ba26){var _0x2757ff=typeof _0x448c78[_0xac31('0x1f')]==='undefined'&&typeof _0x448c78['limit']===_0xac31('0x20');var _0xc69f31=_0x36ba26['count'];var _0x49c8cf=_0x2757ff?0x0:_0x448c78[_0xac31('0x1f')];var _0xcef63c=_0x2757ff?_0x36ba26[_0xac31('0x21')]:_0x448c78[_0xac31('0x1f')]+_0x448c78['limit'];var _0xedc5dd;if(_0xcef63c>=_0xc69f31){_0xcef63c=_0xc69f31;_0xedc5dd=0xc8;}else{_0xedc5dd=0xce;}_0x213ddd[_0xac31('0x1c')](_0xedc5dd);return _0x213ddd[_0xac31('0x22')](_0xac31('0x23'),_0x49c8cf+'-'+_0xcef63c+'/'+_0xc69f31)[_0xac31('0x1e')](_0x36ba26);}return null;};}function patchUpdates(_0x35778){return function(_0x1e75ff){try{jsonpatch[_0xac31('0x24')](_0x1e75ff,_0x35778,!![]);}catch(_0x2c39fb){return BPromise[_0xac31('0x25')](_0x2c39fb);}return _0x1e75ff['save']();};}function saveUpdates(_0x345f8f,_0x246ce4){return function(_0x4208c6){if(_0x4208c6){return _0x4208c6[_0xac31('0x26')](_0x345f8f)['then'](function(_0x483f90){return _0x483f90;});}return null;};}function removeEntity(_0x5ab82a,_0xc83af2){return function(_0x4395dc){if(_0x4395dc){return _0x4395dc[_0xac31('0x27')]()[_0xac31('0x28')](function(){_0x5ab82a[_0xac31('0x1c')](0xcc)[_0xac31('0x1d')]();});}};}function handleEntityNotFound(_0x40ca59,_0x5b157a){return function(_0x642c0c){if(!_0x642c0c){_0x40ca59[_0xac31('0x1b')](0x194);}return _0x642c0c;};}function handleError(_0x3799f7,_0x12b679){_0x12b679=_0x12b679||0x1f4;return function(_0x550227){logger['error'](_0x550227[_0xac31('0x29')]);if(_0x550227[_0xac31('0x2a')]){delete _0x550227[_0xac31('0x2a')];}_0x3799f7['status'](_0x12b679)[_0xac31('0x2b')](_0x550227);};}exports[_0xac31('0x2c')]=function(_0x2c5cea,_0x4578d6){var _0x2bd3ae={},_0x25f0f0={},_0x4d06bf={'count':0x0,'rows':[]};var _0x470714=_['map'](db['Dynamics365Field']['rawAttributes'],function(_0x16626e){return{'name':_0x16626e[_0xac31('0x2d')],'type':_0x16626e[_0xac31('0x2e')]['key']};});_0x25f0f0['model']=_[_0xac31('0x2f')](_0x470714,_0xac31('0x2a'));_0x25f0f0['query']=_['keys'](_0x2c5cea[_0xac31('0x30')]);_0x25f0f0[_0xac31('0x31')]=_[_0xac31('0x32')](_0x25f0f0[_0xac31('0x33')],_0x25f0f0['query']);_0x2bd3ae[_0xac31('0x34')]=_[_0xac31('0x32')](_0x25f0f0[_0xac31('0x33')],qs['fields'](_0x2c5cea[_0xac31('0x30')][_0xac31('0x35')]));_0x2bd3ae[_0xac31('0x34')]=_0x2bd3ae[_0xac31('0x34')][_0xac31('0x36')]?_0x2bd3ae[_0xac31('0x34')]:_0x25f0f0[_0xac31('0x33')];if(!_0x2c5cea[_0xac31('0x30')][_0xac31('0x37')](_0xac31('0x38'))){_0x2bd3ae[_0xac31('0x39')]=qs[_0xac31('0x39')](_0x2c5cea[_0xac31('0x30')]['limit']);_0x2bd3ae[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x2c5cea[_0xac31('0x30')][_0xac31('0x1f')]);}_0x2bd3ae[_0xac31('0x3a')]=qs[_0xac31('0x3b')](_0x2c5cea[_0xac31('0x30')][_0xac31('0x3b')]);_0x2bd3ae[_0xac31('0x3c')]=qs[_0xac31('0x31')](_[_0xac31('0x3d')](_0x2c5cea[_0xac31('0x30')],_0x25f0f0[_0xac31('0x31')]),_0x470714);if(_0x2c5cea[_0xac31('0x30')][_0xac31('0x3e')]){_0x2bd3ae[_0xac31('0x3c')]=_[_0xac31('0x3f')](_0x2bd3ae['where'],{'$or':_[_0xac31('0x2f')](_0x470714,function(_0x4c5059){if(_0x4c5059[_0xac31('0x2e')]!=='VIRTUAL'){var _0x3452cc={};_0x3452cc[_0x4c5059[_0xac31('0x2a')]]={'$like':'%'+_0x2c5cea[_0xac31('0x30')]['filter']+'%'};return _0x3452cc;}})});}_0x2bd3ae=_[_0xac31('0x3f')]({},_0x2bd3ae,_0x2c5cea[_0xac31('0x40')]);var _0x1f44bf={'where':_0x2bd3ae[_0xac31('0x3c')]};return db['Dynamics365Field'][_0xac31('0x21')](_0x1f44bf)[_0xac31('0x28')](function(_0x371e15){_0x4d06bf[_0xac31('0x21')]=_0x371e15;if(_0x2c5cea[_0xac31('0x30')][_0xac31('0x41')]){_0x2bd3ae[_0xac31('0x42')]=[{'all':!![]}];}return db[_0xac31('0x43')]['findAll'](_0x2bd3ae);})['then'](function(_0x1e8450){_0x4d06bf[_0xac31('0x44')]=_0x1e8450;return _0x4d06bf;})['then'](respondWithFilteredResult(_0x4578d6,_0x2bd3ae))[_0xac31('0x45')](handleError(_0x4578d6,null));};exports['show']=function(_0x530b7b,_0x5d7138){var _0x381912={'raw':!![],'where':{'id':_0x530b7b['params']['id']}},_0x166164={};_0x166164[_0xac31('0x33')]=_[_0xac31('0x46')](db['Dynamics365Field'][_0xac31('0x47')]);_0x166164[_0xac31('0x30')]=_['keys'](_0x530b7b[_0xac31('0x30')]);_0x166164[_0xac31('0x31')]=_[_0xac31('0x32')](_0x166164[_0xac31('0x33')],_0x166164[_0xac31('0x30')]);_0x381912[_0xac31('0x34')]=_['intersection'](_0x166164['model'],qs[_0xac31('0x35')](_0x530b7b[_0xac31('0x30')]['fields']));_0x381912[_0xac31('0x34')]=_0x381912[_0xac31('0x34')][_0xac31('0x36')]?_0x381912['attributes']:_0x166164['model'];if(_0x530b7b[_0xac31('0x30')]['includeAll']){_0x381912[_0xac31('0x42')]=[{'all':!![]}];}_0x381912=_[_0xac31('0x3f')]({},_0x381912,_0x530b7b[_0xac31('0x40')]);return db[_0xac31('0x43')][_0xac31('0x48')](_0x381912)[_0xac31('0x28')](handleEntityNotFound(_0x5d7138,null))[_0xac31('0x28')](respondWithResult(_0x5d7138,null))['catch'](handleError(_0x5d7138,null));};exports[_0xac31('0x49')]=function(_0x405509,_0x4d830f){return db[_0xac31('0x43')][_0xac31('0x49')](_0x405509['body'],{})['then'](respondWithResult(_0x4d830f,0xc9))[_0xac31('0x45')](handleError(_0x4d830f,null));};exports[_0xac31('0x26')]=function(_0x54c5aa,_0x58706e){if(_0x54c5aa[_0xac31('0x4a')]['id']){delete _0x54c5aa['body']['id'];}return db['Dynamics365Field'][_0xac31('0x48')]({'where':{'id':_0x54c5aa[_0xac31('0x4b')]['id']}})[_0xac31('0x28')](handleEntityNotFound(_0x58706e,null))[_0xac31('0x28')](saveUpdates(_0x54c5aa[_0xac31('0x4a')],null))[_0xac31('0x28')](respondWithResult(_0x58706e,null))[_0xac31('0x45')](handleError(_0x58706e,null));};exports[_0xac31('0x27')]=function(_0x34b947,_0xb11a19){return db['Dynamics365Field'][_0xac31('0x48')]({'where':{'id':_0x34b947['params']['id']}})['then'](handleEntityNotFound(_0xb11a19,null))[_0xac31('0x28')](removeEntity(_0xb11a19,null))[_0xac31('0x45')](handleError(_0xb11a19,null));}; \ No newline at end of file +var _0x9cdc=['includeAll','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','index','map','Dynamics365Field','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','params','keys'];(function(_0x52f36c,_0x971a36){var _0x54073f=function(_0x34f1d1){while(--_0x34f1d1){_0x52f36c['push'](_0x52f36c['shift']());}};_0x54073f(++_0x971a36);}(_0x9cdc,0x8c));var _0xc9cd=function(_0x179da4,_0x2d414b){_0x179da4=_0x179da4-0x0;var _0xf1d8cc=_0x9cdc[_0x179da4];return _0xf1d8cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9cd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9cd('0x1'));var rp=require(_0xc9cd('0x2'));var moment=require(_0xc9cd('0x3'));var BPromise=require(_0xc9cd('0x4'));var Mustache=require(_0xc9cd('0x5'));var util=require('util');var path=require(_0xc9cd('0x6'));var sox=require(_0xc9cd('0x7'));var csv=require('to-csv');var ejs=require(_0xc9cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc9cd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc9cd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc9cd('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc9cd('0xc'));var Papa=require(_0xc9cd('0xd'));var Redis=require(_0xc9cd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc9cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9cd('0x10'));var logger=require('../../config/logger')(_0xc9cd('0x11'));var utils=require('../../config/utils');var config=require(_0xc9cd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9cd('0x13'))['db'];function respondWithStatusCode(_0x13e31e,_0x2178fd){_0x2178fd=_0x2178fd||0xcc;return function(_0x2628c4){if(_0x2628c4){return _0x13e31e[_0xc9cd('0x14')](_0x2178fd);}return _0x13e31e[_0xc9cd('0x15')](_0x2178fd)[_0xc9cd('0x16')]();};}function respondWithResult(_0x426e9a,_0x58961e){_0x58961e=_0x58961e||0xc8;return function(_0x181885){if(_0x181885){return _0x426e9a[_0xc9cd('0x15')](_0x58961e)[_0xc9cd('0x17')](_0x181885);}};}function respondWithFilteredResult(_0xf05825,_0x294581){return function(_0x408ec2){if(_0x408ec2){var _0x57a8d6=typeof _0x294581[_0xc9cd('0x18')]===_0xc9cd('0x19')&&typeof _0x294581[_0xc9cd('0x1a')]===_0xc9cd('0x19');var _0x5edfae=_0x408ec2[_0xc9cd('0x1b')];var _0x57161d=_0x57a8d6?0x0:_0x294581['offset'];var _0x55f38e=_0x57a8d6?_0x408ec2['count']:_0x294581[_0xc9cd('0x18')]+_0x294581[_0xc9cd('0x1a')];var _0x183f29;if(_0x55f38e>=_0x5edfae){_0x55f38e=_0x5edfae;_0x183f29=0xc8;}else{_0x183f29=0xce;}_0xf05825[_0xc9cd('0x15')](_0x183f29);return _0xf05825[_0xc9cd('0x1c')]('Content-Range',_0x57161d+'-'+_0x55f38e+'/'+_0x5edfae)[_0xc9cd('0x17')](_0x408ec2);}return null;};}function patchUpdates(_0x583ba4){return function(_0x1c52b0){try{jsonpatch[_0xc9cd('0x1d')](_0x1c52b0,_0x583ba4,!![]);}catch(_0x35c081){return BPromise[_0xc9cd('0x1e')](_0x35c081);}return _0x1c52b0['save']();};}function saveUpdates(_0x310da1,_0x31ca27){return function(_0x2f3bb0){if(_0x2f3bb0){return _0x2f3bb0[_0xc9cd('0x1f')](_0x310da1)[_0xc9cd('0x20')](function(_0x3d68a1){return _0x3d68a1;});}return null;};}function removeEntity(_0x15617d,_0x32aed8){return function(_0x13cca4){if(_0x13cca4){return _0x13cca4['destroy']()[_0xc9cd('0x20')](function(){_0x15617d[_0xc9cd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb726,_0x2dcfde){return function(_0x4472be){if(!_0x4472be){_0x2bb726[_0xc9cd('0x14')](0x194);}return _0x4472be;};}function handleError(_0x24ef59,_0x352c42){_0x352c42=_0x352c42||0x1f4;return function(_0x3cbff4){logger[_0xc9cd('0x21')](_0x3cbff4['stack']);if(_0x3cbff4[_0xc9cd('0x22')]){delete _0x3cbff4[_0xc9cd('0x22')];}_0x24ef59['status'](_0x352c42)['send'](_0x3cbff4);};}exports[_0xc9cd('0x23')]=function(_0x453a81,_0x3798a7){var _0x103bd3={},_0x16b6a3={},_0x493afa={'count':0x0,'rows':[]};var _0x395c08=_[_0xc9cd('0x24')](db[_0xc9cd('0x25')][_0xc9cd('0x26')],function(_0x5a3a15){return{'name':_0x5a3a15[_0xc9cd('0x27')],'type':_0x5a3a15['type']['key']};});_0x16b6a3[_0xc9cd('0x28')]=_[_0xc9cd('0x24')](_0x395c08,_0xc9cd('0x22'));_0x16b6a3[_0xc9cd('0x29')]=_['keys'](_0x453a81['query']);_0x16b6a3[_0xc9cd('0x2a')]=_[_0xc9cd('0x2b')](_0x16b6a3[_0xc9cd('0x28')],_0x16b6a3[_0xc9cd('0x29')]);_0x103bd3[_0xc9cd('0x2c')]=_[_0xc9cd('0x2b')](_0x16b6a3['model'],qs[_0xc9cd('0x2d')](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x2d')]));_0x103bd3[_0xc9cd('0x2c')]=_0x103bd3[_0xc9cd('0x2c')][_0xc9cd('0x2e')]?_0x103bd3['attributes']:_0x16b6a3[_0xc9cd('0x28')];if(!_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x2f')](_0xc9cd('0x30'))){_0x103bd3[_0xc9cd('0x1a')]=qs['limit'](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x1a')]);_0x103bd3[_0xc9cd('0x18')]=qs[_0xc9cd('0x18')](_0x453a81['query'][_0xc9cd('0x18')]);}_0x103bd3[_0xc9cd('0x31')]=qs[_0xc9cd('0x32')](_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x32')]);_0x103bd3[_0xc9cd('0x33')]=qs[_0xc9cd('0x2a')](_[_0xc9cd('0x34')](_0x453a81['query'],_0x16b6a3[_0xc9cd('0x2a')]),_0x395c08);if(_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x35')]){_0x103bd3[_0xc9cd('0x33')]=_[_0xc9cd('0x36')](_0x103bd3['where'],{'$or':_[_0xc9cd('0x24')](_0x395c08,function(_0x13ee0a){if(_0x13ee0a[_0xc9cd('0x37')]!=='VIRTUAL'){var _0x1c9e2b={};_0x1c9e2b[_0x13ee0a[_0xc9cd('0x22')]]={'$like':'%'+_0x453a81[_0xc9cd('0x29')][_0xc9cd('0x35')]+'%'};return _0x1c9e2b;}})});}_0x103bd3=_[_0xc9cd('0x36')]({},_0x103bd3,_0x453a81[_0xc9cd('0x38')]);var _0x4b3582={'where':_0x103bd3[_0xc9cd('0x33')]};return db[_0xc9cd('0x25')]['count'](_0x4b3582)[_0xc9cd('0x20')](function(_0x16f929){_0x493afa[_0xc9cd('0x1b')]=_0x16f929;if(_0x453a81[_0xc9cd('0x29')]['includeAll']){_0x103bd3[_0xc9cd('0x39')]=[{'all':!![]}];}return db[_0xc9cd('0x25')][_0xc9cd('0x3a')](_0x103bd3);})['then'](function(_0x5d306e){_0x493afa[_0xc9cd('0x3b')]=_0x5d306e;return _0x493afa;})[_0xc9cd('0x20')](respondWithFilteredResult(_0x3798a7,_0x103bd3))[_0xc9cd('0x3c')](handleError(_0x3798a7,null));};exports[_0xc9cd('0x3d')]=function(_0x162a58,_0x4b1ceb){var _0x54c879={'raw':!![],'where':{'id':_0x162a58[_0xc9cd('0x3e')]['id']}},_0x55714e={};_0x55714e['model']=_[_0xc9cd('0x3f')](db[_0xc9cd('0x25')][_0xc9cd('0x26')]);_0x55714e['query']=_[_0xc9cd('0x3f')](_0x162a58[_0xc9cd('0x29')]);_0x55714e[_0xc9cd('0x2a')]=_['intersection'](_0x55714e[_0xc9cd('0x28')],_0x55714e[_0xc9cd('0x29')]);_0x54c879[_0xc9cd('0x2c')]=_[_0xc9cd('0x2b')](_0x55714e[_0xc9cd('0x28')],qs[_0xc9cd('0x2d')](_0x162a58[_0xc9cd('0x29')][_0xc9cd('0x2d')]));_0x54c879[_0xc9cd('0x2c')]=_0x54c879[_0xc9cd('0x2c')]['length']?_0x54c879[_0xc9cd('0x2c')]:_0x55714e[_0xc9cd('0x28')];if(_0x162a58[_0xc9cd('0x29')][_0xc9cd('0x40')]){_0x54c879[_0xc9cd('0x39')]=[{'all':!![]}];}_0x54c879=_[_0xc9cd('0x36')]({},_0x54c879,_0x162a58[_0xc9cd('0x38')]);return db['Dynamics365Field'][_0xc9cd('0x41')](_0x54c879)[_0xc9cd('0x20')](handleEntityNotFound(_0x4b1ceb,null))[_0xc9cd('0x20')](respondWithResult(_0x4b1ceb,null))['catch'](handleError(_0x4b1ceb,null));};exports[_0xc9cd('0x42')]=function(_0x138406,_0x12ae00){return db[_0xc9cd('0x25')]['create'](_0x138406[_0xc9cd('0x43')],{})[_0xc9cd('0x20')](respondWithResult(_0x12ae00,0xc9))[_0xc9cd('0x3c')](handleError(_0x12ae00,null));};exports['update']=function(_0x1d32a5,_0xbb3118){if(_0x1d32a5[_0xc9cd('0x43')]['id']){delete _0x1d32a5['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x1d32a5[_0xc9cd('0x3e')]['id']}})[_0xc9cd('0x20')](handleEntityNotFound(_0xbb3118,null))[_0xc9cd('0x20')](saveUpdates(_0x1d32a5[_0xc9cd('0x43')],null))['then'](respondWithResult(_0xbb3118,null))[_0xc9cd('0x3c')](handleError(_0xbb3118,null));};exports['destroy']=function(_0x2b507f,_0x4cbae8){return db[_0xc9cd('0x25')]['find']({'where':{'id':_0x2b507f['params']['id']}})['then'](handleEntityNotFound(_0x4cbae8,null))[_0xc9cd('0x20')](removeEntity(_0x4cbae8,null))[_0xc9cd('0x3c')](handleError(_0x4cbae8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index be8faca..1701434 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 _0xe734=['int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x1859f1,_0x15ff06){var _0x31ab32=function(_0x527b64){while(--_0x527b64){_0x1859f1['push'](_0x1859f1['shift']());}};_0x31ab32(++_0x15ff06);}(_0xe734,0x8c));var _0x4e73=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xe734[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x4e73('0x0'));var util=require(_0x4e73('0x1'));var logger=require(_0x4e73('0x2'))(_0x4e73('0x3'));var moment=require(_0x4e73('0x4'));var BPromise=require(_0x4e73('0x5'));var rp=require(_0x4e73('0x6'));var fs=require('fs');var path=require(_0x4e73('0x7'));var rimraf=require('rimraf');var config=require(_0x4e73('0x8'));var attributes=require(_0x4e73('0x9'));module[_0x4e73('0xa')]=function(_0x1e56c9,_0x3a40d1){return _0x1e56c9[_0x4e73('0xb')](_0x4e73('0xc'),attributes,{'tableName':_0x4e73('0xd'),'paranoid':![],'indexes':[{'name':_0x4e73('0xe'),'fields':[_0x4e73('0xf'),_0x4e73('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3610=['./intDynamics365Field.attributes','define','int_dynamics365_fields','FieldId','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x11aac0,_0x207202){var _0x5cc03c=function(_0x1a198e){while(--_0x1a198e){_0x11aac0['push'](_0x11aac0['shift']());}};_0x5cc03c(++_0x207202);}(_0x3610,0x1ea));var _0x0361=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x3610[_0xac151d];return _0x111dba;};'use strict';var _=require('lodash');var util=require(_0x0361('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0361('0x1'));var rp=require(_0x0361('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0361('0x3'));var config=require(_0x0361('0x4'));var attributes=require(_0x0361('0x5'));module['exports']=function(_0x17df07,_0x199b0a){return _0x17df07[_0x0361('0x6')]('Dynamics365Field',attributes,{'tableName':_0x0361('0x7'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x0361('0x8')],'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 dea0ee3..d552f8d 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 _0xff07=['http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','client'];(function(_0x51679b,_0x2d621c){var _0x4085f3=function(_0x14c945){while(--_0x14c945){_0x51679b['push'](_0x51679b['shift']());}};_0x4085f3(++_0x2d621c);}(_0xff07,0xbf));var _0x7ff0=function(_0x4719b1,_0x4d3628){_0x4719b1=_0x4719b1-0x0;var _0x5cc325=_0xff07[_0x4719b1];return _0x5cc325;};'use strict';var _=require(_0x7ff0('0x0'));var util=require(_0x7ff0('0x1'));var moment=require('moment');var BPromise=require(_0x7ff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ff0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ff0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7ff0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7ff0('0x6')][_0x7ff0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e9810,_0x17e33e,_0x4bb4fe){return new BPromise(function(_0x2cc24e,_0x5eaa19){return client[_0x7ff0('0x8')](_0x4e9810,_0x4bb4fe)[_0x7ff0('0x9')](function(_0x541a66){logger[_0x7ff0('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x17e33e,_0x7ff0('0xb'));logger[_0x7ff0('0xc')](_0x7ff0('0xd'),_0x17e33e,'request\x20sent',JSON['stringify'](_0x541a66));if(_0x541a66['error']){if(_0x541a66[_0x7ff0('0xe')][_0x7ff0('0xf')]===0x1f4){logger['error'](_0x7ff0('0x10'),_0x17e33e,_0x541a66[_0x7ff0('0xe')][_0x7ff0('0x11')]);return _0x5eaa19(_0x541a66['error'][_0x7ff0('0x11')]);}logger[_0x7ff0('0xe')](_0x7ff0('0x10'),_0x17e33e,_0x541a66[_0x7ff0('0xe')][_0x7ff0('0x11')]);return _0x2cc24e(_0x541a66[_0x7ff0('0xe')][_0x7ff0('0x11')]);}else{logger[_0x7ff0('0xa')](_0x7ff0('0x10'),_0x17e33e,_0x7ff0('0xb'));_0x2cc24e(_0x541a66['result'][_0x7ff0('0x11')]);}})['catch'](function(_0x23f23b){logger[_0x7ff0('0xe')](_0x7ff0('0x10'),_0x17e33e,_0x23f23b);_0x5eaa19(_0x23f23b);});});} \ No newline at end of file +var _0xfaec=['http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x428935,_0x547e65){var _0x580266=function(_0x16055b){while(--_0x16055b){_0x428935['push'](_0x428935['shift']());}};_0x580266(++_0x547e65);}(_0xfaec,0x19c));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var moment=require(_0xcfae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfae('0x3'));var db=require(_0xcfae('0x4'))['db'];var utils=require(_0xcfae('0x5'));var logger=require(_0xcfae('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcfae('0x7'));var client=jayson['client'][_0xcfae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46459f,_0x40dd24,_0x1853b0){return new BPromise(function(_0x2c1f23,_0x53a0e9){return client[_0xcfae('0x9')](_0x46459f,_0x1853b0)[_0xcfae('0xa')](function(_0x97a426){logger[_0xcfae('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x40dd24,_0xcfae('0xc'));logger['debug'](_0xcfae('0xd'),_0x40dd24,_0xcfae('0xc'),JSON[_0xcfae('0xe')](_0x97a426));if(_0x97a426[_0xcfae('0xf')]){if(_0x97a426[_0xcfae('0xf')][_0xcfae('0x10')]===0x1f4){logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x97a426[_0xcfae('0xf')]['message']);return _0x53a0e9(_0x97a426[_0xcfae('0xf')]['message']);}logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x97a426[_0xcfae('0xf')][_0xcfae('0x12')]);return _0x2c1f23(_0x97a426[_0xcfae('0xf')][_0xcfae('0x12')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x40dd24,_0xcfae('0xc'));_0x2c1f23(_0x97a426[_0xcfae('0x13')][_0xcfae('0x12')]);}})['catch'](function(_0x1d7057){logger[_0xcfae('0xf')](_0xcfae('0x11'),_0x40dd24,_0x1d7057);_0x53a0e9(_0x1d7057);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7ca0794..7344367 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 _0x9efd=['show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x50daf7,_0x56bad4){var _0x349faf=function(_0x3d989f){while(--_0x3d989f){_0x50daf7['push'](_0x50daf7['shift']());}};_0x349faf(++_0x56bad4);}(_0x9efd,0x15a));var _0xd9ef=function(_0x40f25d,_0x28a6b4){_0x40f25d=_0x40f25d-0x0;var _0x4cca48=_0x9efd[_0x40f25d];return _0x4cca48;};'use strict';var multer=require(_0xd9ef('0x0'));var util=require(_0xd9ef('0x1'));var path=require(_0xd9ef('0x2'));var timeout=require(_0xd9ef('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd9ef('0x4'));var auth=require(_0xd9ef('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd9ef('0x6'));router[_0xd9ef('0x7')]('/',auth[_0xd9ef('0x8')](),controller[_0xd9ef('0x9')]);router['get'](_0xd9ef('0xa'),auth['isAuthenticated'](),controller[_0xd9ef('0xb')]);router['get'](_0xd9ef('0xc'),auth[_0xd9ef('0x8')](),controller[_0xd9ef('0xd')]);router[_0xd9ef('0x7')](_0xd9ef('0xe'),auth[_0xd9ef('0x8')](),controller['getFields']);router[_0xd9ef('0xf')]('/',auth[_0xd9ef('0x8')](),controller['create']);router['post'](_0xd9ef('0xc'),auth[_0xd9ef('0x8')](),controller[_0xd9ef('0x10')]);router[_0xd9ef('0x11')](_0xd9ef('0xa'),auth[_0xd9ef('0x8')](),controller[_0xd9ef('0x12')]);router['delete']('/:id',auth[_0xd9ef('0x8')](),controller[_0xd9ef('0x13')]);module[_0xd9ef('0x14')]=router; \ No newline at end of file +var _0xcc78=['../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1450c7,_0x464adb){var _0x216e6c=function(_0x4f4eec){while(--_0x4f4eec){_0x1450c7['push'](_0x1450c7['shift']());}};_0x216e6c(++_0x464adb);}(_0xcc78,0xf6));var _0x8cc7=function(_0x11066a,_0x347efe){_0x11066a=_0x11066a-0x0;var _0x58d875=_0xcc78[_0x11066a];return _0x58d875;};'use strict';var multer=require('multer');var util=require(_0x8cc7('0x0'));var path=require(_0x8cc7('0x1'));var timeout=require(_0x8cc7('0x2'));var express=require(_0x8cc7('0x3'));var router=express[_0x8cc7('0x4')]();var fs_extra=require(_0x8cc7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cc7('0x6'));var controller=require(_0x8cc7('0x7'));router['get']('/',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0x9')]);router['get']('/:id',auth[_0x8cc7('0x8')](),controller['show']);router[_0x8cc7('0xa')]('/:id/configurations',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xb')]);router[_0x8cc7('0xa')](_0x8cc7('0xc'),auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xd')]);router[_0x8cc7('0xe')]('/',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0xf')]);router[_0x8cc7('0xe')](_0x8cc7('0x10'),auth[_0x8cc7('0x8')](),controller['addConfiguration']);router[_0x8cc7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8cc7('0x12')]);router['delete']('/:id',auth[_0x8cc7('0x8')](),controller[_0x8cc7('0x13')]);module[_0x8cc7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 64ed039..99208b9 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 _0x6343=['STRING','remoteUri'];(function(_0x348261,_0x3fd10f){var _0x68d01c=function(_0x4f5114){while(--_0x4f5114){_0x348261['push'](_0x348261['shift']());}};_0x68d01c(++_0x3fd10f);}(_0x6343,0x168));var _0x3634=function(_0x12ffe4,_0x5e8111){_0x12ffe4=_0x12ffe4-0x0;var _0x199d35=_0x6343[_0x12ffe4];return _0x199d35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3634('0x0')]},'description':{'type':Sequelize[_0x3634('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3634('0x1')},'serverUrl':{'type':Sequelize[_0x3634('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x37fe05,_0x10956a){var _0x2a2e53=function(_0x381952){while(--_0x381952){_0x37fe05['push'](_0x37fe05['shift']());}};_0x2a2e53(++_0x10956a);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1d022e,_0x10355e){_0x1d022e=_0x1d022e-0x0;var _0x5d7c13=_0x9f0e[_0x1d022e];return _0x5d7c13;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('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 b6d0bcf..383a6c8 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 _0x96d9=['capitalize','test','statusCode','stringify','send','Wrong\x20credentials','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','FreshdeskAccount','includeAll','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','addConfiguration','AccountId','getSubjects','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','Basic\x20%s','format','%s:X','toString','requester','subject','agent','description','ticket_type','group','includes','custom_dropdown','label','default','choices'];(function(_0x3298f1,_0x3794f3){var _0x40fd7c=function(_0x1a9e2f){while(--_0x1a9e2f){_0x3298f1['push'](_0x3298f1['shift']());}};_0x40fd7c(++_0x3794f3);}(_0x96d9,0xea));var _0x996d=function(_0x52d13a,_0x3bdd8e){_0x52d13a=_0x52d13a-0x0;var _0x2a67b1=_0x96d9[_0x52d13a];return _0x2a67b1;};'use strict';var emlformat=require(_0x996d('0x0'));var rimraf=require(_0x996d('0x1'));var zipdir=require(_0x996d('0x2'));var jsonpatch=require(_0x996d('0x3'));var rp=require(_0x996d('0x4'));var moment=require(_0x996d('0x5'));var BPromise=require(_0x996d('0x6'));var Mustache=require(_0x996d('0x7'));var util=require('util');var path=require(_0x996d('0x8'));var sox=require(_0x996d('0x9'));var csv=require(_0x996d('0xa'));var ejs=require(_0x996d('0xb'));var fs=require('fs');var fs_extra=require(_0x996d('0xc'));var _=require(_0x996d('0xd'));var squel=require(_0x996d('0xe'));var crypto=require('crypto');var jsforce=require(_0x996d('0xf'));var deskjs=require(_0x996d('0x10'));var toCsv=require(_0x996d('0xa'));var querystring=require(_0x996d('0x11'));var Papa=require(_0x996d('0x12'));var Redis=require('ioredis');var authService=require(_0x996d('0x13'));var qs=require(_0x996d('0x14'));var as=require(_0x996d('0x15'));var hardwareService=require(_0x996d('0x16'));var logger=require('../../config/logger')(_0x996d('0x17'));var utils=require(_0x996d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x996d('0x19'));function respondWithStatusCode(_0x2a585a,_0x54d85b){_0x54d85b=_0x54d85b||0xcc;return function(_0xa19195){if(_0xa19195){return _0x2a585a[_0x996d('0x1a')](_0x54d85b);}return _0x2a585a['status'](_0x54d85b)[_0x996d('0x1b')]();};}function respondWithResult(_0x269179,_0x18c2b8){_0x18c2b8=_0x18c2b8||0xc8;return function(_0x47cd95){if(_0x47cd95){return _0x269179[_0x996d('0x1c')](_0x18c2b8)['json'](_0x47cd95);}};}function respondWithFilteredResult(_0x1da7b0,_0xd8bcba){return function(_0x281281){if(_0x281281){var _0x15a985=typeof _0xd8bcba[_0x996d('0x1d')]===_0x996d('0x1e')&&typeof _0xd8bcba[_0x996d('0x1f')]==='undefined';var _0x5dacb7=_0x281281[_0x996d('0x20')];var _0x17ce93=_0x15a985?0x0:_0xd8bcba[_0x996d('0x1d')];var _0x26d8c6=_0x15a985?_0x281281[_0x996d('0x20')]:_0xd8bcba[_0x996d('0x1d')]+_0xd8bcba[_0x996d('0x1f')];var _0x2fd906;if(_0x26d8c6>=_0x5dacb7){_0x26d8c6=_0x5dacb7;_0x2fd906=0xc8;}else{_0x2fd906=0xce;}_0x1da7b0['status'](_0x2fd906);return _0x1da7b0['set'](_0x996d('0x21'),_0x17ce93+'-'+_0x26d8c6+'/'+_0x5dacb7)[_0x996d('0x22')](_0x281281);}return null;};}function patchUpdates(_0x2da682){return function(_0x109662){try{jsonpatch[_0x996d('0x23')](_0x109662,_0x2da682,!![]);}catch(_0x2d0979){return BPromise['reject'](_0x2d0979);}return _0x109662[_0x996d('0x24')]();};}function saveUpdates(_0x76a7e,_0x379165){return function(_0x5bbf4c){if(_0x5bbf4c){return _0x5bbf4c['update'](_0x76a7e)[_0x996d('0x25')](function(_0x42fae4){return _0x42fae4;});}return null;};}function removeEntity(_0x53c4d9,_0x2a9da1){return function(_0x273aad){if(_0x273aad){return _0x273aad[_0x996d('0x26')]()[_0x996d('0x25')](function(){_0x53c4d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fbb0,_0x22defb){return function(_0x559030){if(!_0x559030){_0x31fbb0[_0x996d('0x1a')](0x194);}return _0x559030;};}function handleError(_0x54a040,_0x435f27){_0x435f27=_0x435f27||0x1f4;return function(_0x279285){logger[_0x996d('0x27')](_0x279285[_0x996d('0x28')]);if(_0x279285[_0x996d('0x29')]){delete _0x279285[_0x996d('0x29')];}_0x54a040[_0x996d('0x1c')](_0x435f27)['send'](_0x279285);};}exports[_0x996d('0x2a')]=function(_0x150e7d,_0x45a158){var _0x365cc5={},_0x33814d={},_0xdbf420={'count':0x0,'rows':[]};var _0x4b45bc=_['map'](db['FreshdeskAccount'][_0x996d('0x2b')],function(_0x6b3221){return{'name':_0x6b3221[_0x996d('0x2c')],'type':_0x6b3221[_0x996d('0x2d')][_0x996d('0x2e')]};});_0x33814d[_0x996d('0x2f')]=_[_0x996d('0x30')](_0x4b45bc,'name');_0x33814d['query']=_[_0x996d('0x31')](_0x150e7d['query']);_0x33814d[_0x996d('0x32')]=_[_0x996d('0x33')](_0x33814d['model'],_0x33814d[_0x996d('0x34')]);_0x365cc5[_0x996d('0x35')]=_[_0x996d('0x33')](_0x33814d['model'],qs[_0x996d('0x36')](_0x150e7d[_0x996d('0x34')][_0x996d('0x36')]));_0x365cc5['attributes']=_0x365cc5['attributes'][_0x996d('0x37')]?_0x365cc5[_0x996d('0x35')]:_0x33814d['model'];if(!_0x150e7d[_0x996d('0x34')][_0x996d('0x38')](_0x996d('0x39'))){_0x365cc5[_0x996d('0x1f')]=qs[_0x996d('0x1f')](_0x150e7d['query'][_0x996d('0x1f')]);_0x365cc5[_0x996d('0x1d')]=qs[_0x996d('0x1d')](_0x150e7d[_0x996d('0x34')][_0x996d('0x1d')]);}_0x365cc5['order']=qs[_0x996d('0x3a')](_0x150e7d[_0x996d('0x34')][_0x996d('0x3a')]);_0x365cc5[_0x996d('0x3b')]=qs[_0x996d('0x32')](_['pick'](_0x150e7d['query'],_0x33814d['filters']),_0x4b45bc);if(_0x150e7d['query'][_0x996d('0x3c')]){_0x365cc5[_0x996d('0x3b')]=_[_0x996d('0x3d')](_0x365cc5['where'],{'$or':_[_0x996d('0x30')](_0x4b45bc,function(_0x576b99){if(_0x576b99[_0x996d('0x2d')]!==_0x996d('0x3e')){var _0x3750e8={};_0x3750e8[_0x576b99[_0x996d('0x29')]]={'$like':'%'+_0x150e7d[_0x996d('0x34')][_0x996d('0x3c')]+'%'};return _0x3750e8;}})});}_0x365cc5=_[_0x996d('0x3d')]({},_0x365cc5,_0x150e7d[_0x996d('0x3f')]);var _0x226039={'where':_0x365cc5[_0x996d('0x3b')]};return db['FreshdeskAccount'][_0x996d('0x20')](_0x226039)[_0x996d('0x25')](function(_0x4b8586){_0xdbf420[_0x996d('0x20')]=_0x4b8586;if(_0x150e7d['query']['includeAll']){_0x365cc5['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x996d('0x40')](_0x365cc5);})[_0x996d('0x25')](function(_0x4a7e07){_0xdbf420[_0x996d('0x41')]=_0x4a7e07;return _0xdbf420;})[_0x996d('0x25')](respondWithFilteredResult(_0x45a158,_0x365cc5))[_0x996d('0x42')](handleError(_0x45a158,null));};exports[_0x996d('0x43')]=function(_0x2f708b,_0x5853f5){var _0x113997={'raw':![],'where':{'id':_0x2f708b[_0x996d('0x44')]['id']}},_0x2fc99b={};_0x2fc99b[_0x996d('0x2f')]=_[_0x996d('0x31')](db[_0x996d('0x45')]['rawAttributes']);_0x2fc99b[_0x996d('0x34')]=_[_0x996d('0x31')](_0x2f708b[_0x996d('0x34')]);_0x2fc99b['filters']=_[_0x996d('0x33')](_0x2fc99b[_0x996d('0x2f')],_0x2fc99b['query']);_0x113997['attributes']=_[_0x996d('0x33')](_0x2fc99b['model'],qs[_0x996d('0x36')](_0x2f708b[_0x996d('0x34')]['fields']));_0x113997[_0x996d('0x35')]=_0x113997[_0x996d('0x35')][_0x996d('0x37')]?_0x113997[_0x996d('0x35')]:_0x2fc99b[_0x996d('0x2f')];if(_0x2f708b['query'][_0x996d('0x46')]){_0x113997['include']=[{'all':!![]}];}_0x113997=_['merge']({},_0x113997,_0x2f708b['options']);return db['FreshdeskAccount'][_0x996d('0x47')](_0x113997)[_0x996d('0x25')](handleEntityNotFound(_0x5853f5,null))[_0x996d('0x25')](respondWithResult(_0x5853f5,null))['catch'](handleError(_0x5853f5,null));};exports['create']=function(_0x9365a,_0x3513fc){return db[_0x996d('0x45')][_0x996d('0x48')](_0x9365a[_0x996d('0x49')],{})['then'](respondWithResult(_0x3513fc,0xc9))[_0x996d('0x42')](handleError(_0x3513fc,null));};exports[_0x996d('0x4a')]=function(_0xed150d,_0x42c2f0){if(_0xed150d[_0x996d('0x49')]['id']){delete _0xed150d[_0x996d('0x49')]['id'];}return db[_0x996d('0x45')]['find']({'where':{'id':_0xed150d['params']['id']}})[_0x996d('0x25')](handleEntityNotFound(_0x42c2f0,null))[_0x996d('0x25')](saveUpdates(_0xed150d['body'],null))['then'](respondWithResult(_0x42c2f0,null))[_0x996d('0x42')](handleError(_0x42c2f0,null));};exports['destroy']=function(_0x446fa1,_0xcd988b){return db[_0x996d('0x45')][_0x996d('0x47')]({'where':{'id':_0x446fa1['params']['id']}})[_0x996d('0x25')](handleEntityNotFound(_0xcd988b,null))['then'](removeEntity(_0xcd988b,null))[_0x996d('0x42')](handleError(_0xcd988b,null));};exports[_0x996d('0x4b')]=function(_0x37dcac,_0x378efd,_0x536472){var _0x146f47={};var _0x36f354={};var _0xa5ad1;var _0x1107c1;return db[_0x996d('0x45')][_0x996d('0x4c')]({'where':{'id':_0x37dcac[_0x996d('0x44')]['id']}})[_0x996d('0x25')](handleEntityNotFound(_0x378efd,null))['then'](function(_0x590549){if(_0x590549){_0xa5ad1=_0x590549;_0x36f354['model']=_[_0x996d('0x31')](db[_0x996d('0x4d')][_0x996d('0x2b')]);_0x36f354[_0x996d('0x34')]=_[_0x996d('0x31')](_0x37dcac['query']);_0x36f354[_0x996d('0x32')]=_[_0x996d('0x33')](_0x36f354[_0x996d('0x2f')],_0x36f354[_0x996d('0x34')]);_0x146f47[_0x996d('0x35')]=_[_0x996d('0x33')](_0x36f354[_0x996d('0x2f')],qs[_0x996d('0x36')](_0x37dcac[_0x996d('0x34')][_0x996d('0x36')]));_0x146f47['attributes']=_0x146f47[_0x996d('0x35')][_0x996d('0x37')]?_0x146f47[_0x996d('0x35')]:_0x36f354['model'];_0x146f47['order']=qs[_0x996d('0x3a')](_0x37dcac[_0x996d('0x34')][_0x996d('0x3a')]);_0x146f47['where']=qs['filters'](_[_0x996d('0x4e')](_0x37dcac[_0x996d('0x34')],_0x36f354[_0x996d('0x32')]));if(_0x37dcac['query'][_0x996d('0x3c')]){_0x146f47['where']=_[_0x996d('0x3d')](_0x146f47[_0x996d('0x3b')],{'$or':_[_0x996d('0x30')](_0x146f47[_0x996d('0x35')],function(_0x2d7652){var _0x13da79={};_0x13da79[_0x2d7652]={'$like':'%'+_0x37dcac[_0x996d('0x34')][_0x996d('0x3c')]+'%'};return _0x13da79;})});}_0x146f47=_[_0x996d('0x3d')]({},_0x146f47,_0x37dcac['options']);return _0xa5ad1['getConfigurations'](_0x146f47);}})['then'](function(_0x1debd5){if(_0x1debd5){_0x1107c1=_0x1debd5[_0x996d('0x37')];if(!_0x37dcac[_0x996d('0x34')][_0x996d('0x38')](_0x996d('0x39'))){_0x146f47[_0x996d('0x1f')]=qs[_0x996d('0x1f')](_0x37dcac[_0x996d('0x34')]['limit']);_0x146f47[_0x996d('0x1d')]=qs[_0x996d('0x1d')](_0x37dcac[_0x996d('0x34')][_0x996d('0x1d')]);}return _0xa5ad1[_0x996d('0x4b')](_0x146f47);}})['then'](function(_0x2babdc){if(_0x2babdc){return _0x2babdc?{'count':_0x1107c1,'rows':_0x2babdc}:null;}})['then'](respondWithResult(_0x378efd,null))[_0x996d('0x42')](handleError(_0x378efd,null));};exports[_0x996d('0x4f')]=function(_0x466bac,_0x5d7959,_0xecb07b){if(_0x466bac[_0x996d('0x49')]['id']){delete _0x466bac[_0x996d('0x49')]['id'];}return db[_0x996d('0x45')][_0x996d('0x4c')]({'where':{'id':_0x466bac[_0x996d('0x44')]['id']}})[_0x996d('0x25')](handleEntityNotFound(_0x5d7959,null))[_0x996d('0x25')](function(_0x3eb579){if(_0x3eb579){_0x466bac[_0x996d('0x49')][_0x996d('0x50')]=_0x3eb579['id'];_0x466bac[_0x996d('0x49')]['Subjects']=integrations[_0x996d('0x51')](_0x466bac[_0x996d('0x49')]['channel'],_0x466bac[_0x996d('0x49')][_0x996d('0x2d')]);_0x466bac[_0x996d('0x49')][_0x996d('0x52')]=integrations['getDescriptions'](_0x466bac['body']['channel'],_0x466bac['body']['type']);return db['FreshdeskConfiguration'][_0x996d('0x48')](_0x466bac['body'],{'include':[{'model':db[_0x996d('0x53')],'as':_0x996d('0x54')},{'model':db['FreshdeskField'],'as':_0x996d('0x52')}]});}return null;})['then'](respondWithResult(_0x5d7959,null))[_0x996d('0x42')](handleError(_0x5d7959,null));};exports[_0x996d('0x55')]=function(_0x51aa5f,_0x38dd68,_0x24bd7a){var _0x1d71ef='';return db[_0x996d('0x45')][_0x996d('0x4c')]({'where':{'id':_0x51aa5f[_0x996d('0x44')]['id']},'attributes':['id',_0x996d('0x56'),_0x996d('0x57')]})['then'](handleEntityNotFound(_0x38dd68,null))[_0x996d('0x25')](function(_0x912fb0){if(_0x912fb0){_0x1d71ef=_0x912fb0[_0x996d('0x56')];var _0xc48526=_0x1d71ef[_0x996d('0x58')](-0x1);if(_0xc48526==='/'){_0x1d71ef=_0x1d71ef[_0x996d('0x59')](0x0,_0x1d71ef[_0x996d('0x5a')](_0xc48526));}return rp({'method':_0x996d('0x5b'),'uri':util['format']('%s/%s',_0x1d71ef,_0x996d('0x5c')),'headers':{'Authorization':util['format'](_0x996d('0x5d'),new Buffer(util[_0x996d('0x5e')](_0x996d('0x5f'),_0x912fb0[_0x996d('0x57')]))[_0x996d('0x60')]('base64'))},'json':!![]});}})['then'](function(_0x3868bc){if(_0x3868bc){var _0x288690=[_0x996d('0x61'),_0x996d('0x62'),_0x996d('0x63'),_0x996d('0x64'),'status','priority','group','source',_0x996d('0x65'),_0x996d('0x66'),'company'];_['remove'](_0x3868bc,function(_0x316021){return _0x288690[_0x996d('0x67')](_0x316021[_0x996d('0x29')])||!_0x316021['default']&&_0x316021[_0x996d('0x2d')]!=='custom_text'&&_0x316021[_0x996d('0x2d')]!==_0x996d('0x68');});return{'count':_0x3868bc[_0x996d('0x37')],'rows':_[_0x996d('0x30')](_0x3868bc,function(_0x997d1){return{'id':_0x997d1[_0x996d('0x29')],'name':_0x997d1[_0x996d('0x69')],'custom':!_0x997d1[_0x996d('0x6a')],'options':_0x997d1[_0x996d('0x6b')]?_['map'](_0x997d1['choices'],function(_0xf5aafa){return{'name':_[_0x996d('0x6c')](_0xf5aafa),'value':_0xf5aafa};}):[]};})};}})['then'](respondWithResult(_0x38dd68,null))[_0x996d('0x42')](function(_0x452732){var _0x4815b5=_0x51aa5f[_0x996d('0x34')][_0x996d('0x6d')]?0x1f4:_0x452732[_0x996d('0x6e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x996d('0x55'),_0x4815b5,JSON[_0x996d('0x6f')](_0x452732));delete _0x452732['name'];if(_0x4815b5===0x191){_0x4815b5=0x190;}_0x38dd68[_0x996d('0x1c')](_0x4815b5)[_0x996d('0x70')](_0x51aa5f['query'][_0x996d('0x6d')]?{'message':_0x996d('0x71'),'statusCode':_0x452732[_0x996d('0x6e')]}:_0x452732);});}; \ No newline at end of file +var _0x4e34=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','findAll','catch','show','length','includeAll','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','filter','addConfiguration','AccountId','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','subject','agent','description','ticket_type','group','company','remove','includes','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','zip-dir','fast-json-patch','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e34,0x19e));var _0x44e3=function(_0x6c413,_0xeda0e6){_0x6c413=_0x6c413-0x0;var _0x821cbc=_0x4e34[_0x6c413];return _0x821cbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x44e3('0x0'));var jsonpatch=require(_0x44e3('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x44e3('0x2'));var Mustache=require('mustache');var util=require(_0x44e3('0x3'));var path=require(_0x44e3('0x4'));var sox=require(_0x44e3('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44e3('0x6'));var _=require(_0x44e3('0x7'));var squel=require(_0x44e3('0x8'));var crypto=require(_0x44e3('0x9'));var jsforce=require(_0x44e3('0xa'));var deskjs=require(_0x44e3('0xb'));var toCsv=require(_0x44e3('0xc'));var querystring=require('querystring');var Papa=require(_0x44e3('0xd'));var Redis=require(_0x44e3('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x44e3('0xf'));var hardwareService=require(_0x44e3('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x44e3('0x11'));var config=require(_0x44e3('0x12'));var licenseUtil=require(_0x44e3('0x13'));var db=require(_0x44e3('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x473429,_0xecdc78){_0xecdc78=_0xecdc78||0xcc;return function(_0x11eafa){if(_0x11eafa){return _0x473429[_0x44e3('0x15')](_0xecdc78);}return _0x473429[_0x44e3('0x16')](_0xecdc78)[_0x44e3('0x17')]();};}function respondWithResult(_0xf72585,_0x5f1dc){_0x5f1dc=_0x5f1dc||0xc8;return function(_0x493e4c){if(_0x493e4c){return _0xf72585[_0x44e3('0x16')](_0x5f1dc)['json'](_0x493e4c);}};}function respondWithFilteredResult(_0x15bd84,_0x393172){return function(_0x5a140d){if(_0x5a140d){var _0x28fc7a=typeof _0x393172[_0x44e3('0x18')]===_0x44e3('0x19')&&typeof _0x393172[_0x44e3('0x1a')]===_0x44e3('0x19');var _0x111a30=_0x5a140d[_0x44e3('0x1b')];var _0xe495c5=_0x28fc7a?0x0:_0x393172[_0x44e3('0x18')];var _0x5cc0ca=_0x28fc7a?_0x5a140d[_0x44e3('0x1b')]:_0x393172['offset']+_0x393172[_0x44e3('0x1a')];var _0x5cb4cc;if(_0x5cc0ca>=_0x111a30){_0x5cc0ca=_0x111a30;_0x5cb4cc=0xc8;}else{_0x5cb4cc=0xce;}_0x15bd84[_0x44e3('0x16')](_0x5cb4cc);return _0x15bd84[_0x44e3('0x1c')](_0x44e3('0x1d'),_0xe495c5+'-'+_0x5cc0ca+'/'+_0x111a30)[_0x44e3('0x1e')](_0x5a140d);}return null;};}function patchUpdates(_0x3f7c87){return function(_0x38bf24){try{jsonpatch[_0x44e3('0x1f')](_0x38bf24,_0x3f7c87,!![]);}catch(_0x275d7d){return BPromise[_0x44e3('0x20')](_0x275d7d);}return _0x38bf24[_0x44e3('0x21')]();};}function saveUpdates(_0x25e2e1,_0x482de1){return function(_0x5baa32){if(_0x5baa32){return _0x5baa32[_0x44e3('0x22')](_0x25e2e1)['then'](function(_0x1a101f){return _0x1a101f;});}return null;};}function removeEntity(_0x3ca86e,_0x579877){return function(_0x61a5cd){if(_0x61a5cd){return _0x61a5cd[_0x44e3('0x23')]()[_0x44e3('0x24')](function(){_0x3ca86e[_0x44e3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3787c8,_0x3d65c4){return function(_0x574e04){if(!_0x574e04){_0x3787c8[_0x44e3('0x15')](0x194);}return _0x574e04;};}function handleError(_0x22b788,_0x31eddb){_0x31eddb=_0x31eddb||0x1f4;return function(_0x102f2b){logger['error'](_0x102f2b['stack']);if(_0x102f2b[_0x44e3('0x25')]){delete _0x102f2b[_0x44e3('0x25')];}_0x22b788[_0x44e3('0x16')](_0x31eddb)['send'](_0x102f2b);};}exports[_0x44e3('0x26')]=function(_0x4f93d6,_0x119d03){var _0x3659af={},_0x23cb65={},_0x36ed4d={'count':0x0,'rows':[]};var _0x412b39=_[_0x44e3('0x27')](db[_0x44e3('0x28')][_0x44e3('0x29')],function(_0x4b1bd8){return{'name':_0x4b1bd8[_0x44e3('0x2a')],'type':_0x4b1bd8[_0x44e3('0x2b')][_0x44e3('0x2c')]};});_0x23cb65[_0x44e3('0x2d')]=_[_0x44e3('0x27')](_0x412b39,_0x44e3('0x25'));_0x23cb65['query']=_[_0x44e3('0x2e')](_0x4f93d6[_0x44e3('0x2f')]);_0x23cb65['filters']=_[_0x44e3('0x30')](_0x23cb65[_0x44e3('0x2d')],_0x23cb65['query']);_0x3659af[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x23cb65[_0x44e3('0x2d')],qs['fields'](_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x3659af[_0x44e3('0x31')]=_0x3659af[_0x44e3('0x31')]['length']?_0x3659af[_0x44e3('0x31')]:_0x23cb65['model'];if(!_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x33')](_0x44e3('0x34'))){_0x3659af[_0x44e3('0x1a')]=qs[_0x44e3('0x1a')](_0x4f93d6['query'][_0x44e3('0x1a')]);_0x3659af[_0x44e3('0x18')]=qs[_0x44e3('0x18')](_0x4f93d6[_0x44e3('0x2f')][_0x44e3('0x18')]);}_0x3659af[_0x44e3('0x35')]=qs[_0x44e3('0x36')](_0x4f93d6[_0x44e3('0x2f')]['sort']);_0x3659af[_0x44e3('0x37')]=qs['filters'](_[_0x44e3('0x38')](_0x4f93d6[_0x44e3('0x2f')],_0x23cb65[_0x44e3('0x39')]),_0x412b39);if(_0x4f93d6[_0x44e3('0x2f')]['filter']){_0x3659af[_0x44e3('0x37')]=_[_0x44e3('0x3a')](_0x3659af['where'],{'$or':_[_0x44e3('0x27')](_0x412b39,function(_0x18aff5){if(_0x18aff5['type']!==_0x44e3('0x3b')){var _0x5be86d={};_0x5be86d[_0x18aff5[_0x44e3('0x25')]]={'$like':'%'+_0x4f93d6[_0x44e3('0x2f')]['filter']+'%'};return _0x5be86d;}})});}_0x3659af=_[_0x44e3('0x3a')]({},_0x3659af,_0x4f93d6[_0x44e3('0x3c')]);var _0x383e8f={'where':_0x3659af['where']};return db[_0x44e3('0x28')][_0x44e3('0x1b')](_0x383e8f)[_0x44e3('0x24')](function(_0x4f69fb){_0x36ed4d[_0x44e3('0x1b')]=_0x4f69fb;if(_0x4f93d6['query']['includeAll']){_0x3659af['include']=[{'all':!![]}];}return db[_0x44e3('0x28')][_0x44e3('0x3d')](_0x3659af);})[_0x44e3('0x24')](function(_0x3baaf6){_0x36ed4d['rows']=_0x3baaf6;return _0x36ed4d;})[_0x44e3('0x24')](respondWithFilteredResult(_0x119d03,_0x3659af))[_0x44e3('0x3e')](handleError(_0x119d03,null));};exports[_0x44e3('0x3f')]=function(_0x4df091,_0x1fac49){var _0x41f5f0={'raw':![],'where':{'id':_0x4df091['params']['id']}},_0x553539={};_0x553539[_0x44e3('0x2d')]=_['keys'](db['FreshdeskAccount'][_0x44e3('0x29')]);_0x553539[_0x44e3('0x2f')]=_[_0x44e3('0x2e')](_0x4df091[_0x44e3('0x2f')]);_0x553539['filters']=_['intersection'](_0x553539['model'],_0x553539[_0x44e3('0x2f')]);_0x41f5f0[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x553539[_0x44e3('0x2d')],qs[_0x44e3('0x32')](_0x4df091[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x41f5f0[_0x44e3('0x31')]=_0x41f5f0[_0x44e3('0x31')][_0x44e3('0x40')]?_0x41f5f0[_0x44e3('0x31')]:_0x553539['model'];if(_0x4df091[_0x44e3('0x2f')][_0x44e3('0x41')]){_0x41f5f0['include']=[{'all':!![]}];}_0x41f5f0=_['merge']({},_0x41f5f0,_0x4df091[_0x44e3('0x3c')]);return db[_0x44e3('0x28')][_0x44e3('0x42')](_0x41f5f0)['then'](handleEntityNotFound(_0x1fac49,null))[_0x44e3('0x24')](respondWithResult(_0x1fac49,null))[_0x44e3('0x3e')](handleError(_0x1fac49,null));};exports[_0x44e3('0x43')]=function(_0x2590f5,_0x42f4d5){return db[_0x44e3('0x28')][_0x44e3('0x43')](_0x2590f5['body'],{})[_0x44e3('0x24')](respondWithResult(_0x42f4d5,0xc9))[_0x44e3('0x3e')](handleError(_0x42f4d5,null));};exports['update']=function(_0x5d20bd,_0x2b5b87){if(_0x5d20bd[_0x44e3('0x44')]['id']){delete _0x5d20bd['body']['id'];}return db[_0x44e3('0x28')][_0x44e3('0x42')]({'where':{'id':_0x5d20bd[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x2b5b87,null))[_0x44e3('0x24')](saveUpdates(_0x5d20bd[_0x44e3('0x44')],null))['then'](respondWithResult(_0x2b5b87,null))[_0x44e3('0x3e')](handleError(_0x2b5b87,null));};exports[_0x44e3('0x23')]=function(_0x1d07cd,_0x369f04){return db[_0x44e3('0x28')][_0x44e3('0x42')]({'where':{'id':_0x1d07cd[_0x44e3('0x45')]['id']}})['then'](handleEntityNotFound(_0x369f04,null))[_0x44e3('0x24')](removeEntity(_0x369f04,null))['catch'](handleError(_0x369f04,null));};exports[_0x44e3('0x46')]=function(_0x2ac352,_0x114b95,_0x38c6d5){var _0x3cecd5={};var _0x3ae05a={};var _0x42ef05;var _0x54a29e;return db[_0x44e3('0x28')][_0x44e3('0x47')]({'where':{'id':_0x2ac352[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x114b95,null))[_0x44e3('0x24')](function(_0x541877){if(_0x541877){_0x42ef05=_0x541877;_0x3ae05a['model']=_[_0x44e3('0x2e')](db[_0x44e3('0x48')][_0x44e3('0x29')]);_0x3ae05a[_0x44e3('0x2f')]=_['keys'](_0x2ac352[_0x44e3('0x2f')]);_0x3ae05a['filters']=_[_0x44e3('0x30')](_0x3ae05a[_0x44e3('0x2d')],_0x3ae05a[_0x44e3('0x2f')]);_0x3cecd5[_0x44e3('0x31')]=_[_0x44e3('0x30')](_0x3ae05a['model'],qs[_0x44e3('0x32')](_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x32')]));_0x3cecd5[_0x44e3('0x31')]=_0x3cecd5[_0x44e3('0x31')][_0x44e3('0x40')]?_0x3cecd5[_0x44e3('0x31')]:_0x3ae05a['model'];_0x3cecd5[_0x44e3('0x35')]=qs[_0x44e3('0x36')](_0x2ac352[_0x44e3('0x2f')]['sort']);_0x3cecd5['where']=qs['filters'](_['pick'](_0x2ac352[_0x44e3('0x2f')],_0x3ae05a['filters']));if(_0x2ac352['query'][_0x44e3('0x49')]){_0x3cecd5[_0x44e3('0x37')]=_[_0x44e3('0x3a')](_0x3cecd5['where'],{'$or':_[_0x44e3('0x27')](_0x3cecd5[_0x44e3('0x31')],function(_0x18269d){var _0x2733b8={};_0x2733b8[_0x18269d]={'$like':'%'+_0x2ac352['query'][_0x44e3('0x49')]+'%'};return _0x2733b8;})});}_0x3cecd5=_[_0x44e3('0x3a')]({},_0x3cecd5,_0x2ac352[_0x44e3('0x3c')]);return _0x42ef05['getConfigurations'](_0x3cecd5);}})[_0x44e3('0x24')](function(_0x3529dc){if(_0x3529dc){_0x54a29e=_0x3529dc[_0x44e3('0x40')];if(!_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x33')]('nolimit')){_0x3cecd5[_0x44e3('0x1a')]=qs[_0x44e3('0x1a')](_0x2ac352['query']['limit']);_0x3cecd5[_0x44e3('0x18')]=qs['offset'](_0x2ac352[_0x44e3('0x2f')][_0x44e3('0x18')]);}return _0x42ef05[_0x44e3('0x46')](_0x3cecd5);}})[_0x44e3('0x24')](function(_0x169f0f){if(_0x169f0f){return _0x169f0f?{'count':_0x54a29e,'rows':_0x169f0f}:null;}})[_0x44e3('0x24')](respondWithResult(_0x114b95,null))[_0x44e3('0x3e')](handleError(_0x114b95,null));};exports[_0x44e3('0x4a')]=function(_0x4318d0,_0x812a6f,_0x23ac9d){if(_0x4318d0[_0x44e3('0x44')]['id']){delete _0x4318d0['body']['id'];}return db[_0x44e3('0x28')]['findOne']({'where':{'id':_0x4318d0[_0x44e3('0x45')]['id']}})[_0x44e3('0x24')](handleEntityNotFound(_0x812a6f,null))[_0x44e3('0x24')](function(_0x1157c7){if(_0x1157c7){_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4b')]=_0x1157c7['id'];_0x4318d0[_0x44e3('0x44')]['Subjects']=integrations['getSubjects'](_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4c')],_0x4318d0[_0x44e3('0x44')][_0x44e3('0x2b')]);_0x4318d0['body'][_0x44e3('0x4d')]=integrations['getDescriptions'](_0x4318d0[_0x44e3('0x44')][_0x44e3('0x4c')],_0x4318d0['body']['type']);return db[_0x44e3('0x48')][_0x44e3('0x43')](_0x4318d0[_0x44e3('0x44')],{'include':[{'model':db[_0x44e3('0x4e')],'as':_0x44e3('0x4f')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x44e3('0x24')](respondWithResult(_0x812a6f,null))[_0x44e3('0x3e')](handleError(_0x812a6f,null));};exports[_0x44e3('0x50')]=function(_0xaa5060,_0xc1d3fe,_0x57813f){var _0xf8ccbe='';return db[_0x44e3('0x28')][_0x44e3('0x47')]({'where':{'id':_0xaa5060[_0x44e3('0x45')]['id']},'attributes':['id',_0x44e3('0x51'),_0x44e3('0x52')]})['then'](handleEntityNotFound(_0xc1d3fe,null))[_0x44e3('0x24')](function(_0x12ebf7){if(_0x12ebf7){_0xf8ccbe=_0x12ebf7[_0x44e3('0x51')];var _0x2185ae=_0xf8ccbe['slice'](-0x1);if(_0x2185ae==='/'){_0xf8ccbe=_0xf8ccbe[_0x44e3('0x53')](0x0,_0xf8ccbe[_0x44e3('0x54')](_0x2185ae));}return rp({'method':_0x44e3('0x55'),'uri':util[_0x44e3('0x56')](_0x44e3('0x57'),_0xf8ccbe,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x44e3('0x56')]('Basic\x20%s',new Buffer(util[_0x44e3('0x56')](_0x44e3('0x58'),_0x12ebf7[_0x44e3('0x52')]))[_0x44e3('0x59')]('base64'))},'json':!![]});}})[_0x44e3('0x24')](function(_0x2ab5e0){if(_0x2ab5e0){var _0x39af65=['requester',_0x44e3('0x5a'),_0x44e3('0x5b'),_0x44e3('0x5c'),_0x44e3('0x16'),'priority','group','source',_0x44e3('0x5d'),_0x44e3('0x5e'),_0x44e3('0x5f')];_[_0x44e3('0x60')](_0x2ab5e0,function(_0x4eae39){return _0x39af65[_0x44e3('0x61')](_0x4eae39[_0x44e3('0x25')])||!_0x4eae39['default']&&_0x4eae39[_0x44e3('0x2b')]!=='custom_text'&&_0x4eae39[_0x44e3('0x2b')]!==_0x44e3('0x62');});return{'count':_0x2ab5e0[_0x44e3('0x40')],'rows':_[_0x44e3('0x27')](_0x2ab5e0,function(_0x282df1){return{'id':_0x282df1[_0x44e3('0x25')],'name':_0x282df1[_0x44e3('0x63')],'custom':!_0x282df1['default'],'options':_0x282df1[_0x44e3('0x64')]?_['map'](_0x282df1[_0x44e3('0x64')],function(_0x1033d3){return{'name':_[_0x44e3('0x65')](_0x1033d3),'value':_0x1033d3};}):[]};})};}})[_0x44e3('0x24')](respondWithResult(_0xc1d3fe,null))['catch'](function(_0x321904){var _0x489f14=_0xaa5060['query'][_0x44e3('0x66')]?0x1f4:_0x321904[_0x44e3('0x67')]||0x1f4;logger[_0x44e3('0x68')](_0x44e3('0x69'),_0x44e3('0x50'),_0x489f14,JSON[_0x44e3('0x6a')](_0x321904));delete _0x321904['name'];if(_0x489f14===0x191){_0x489f14=0x190;}_0xc1d3fe[_0x44e3('0x16')](_0x489f14)[_0x44e3('0x6b')](_0xaa5060[_0x44e3('0x2f')][_0x44e3('0x66')]?{'message':_0x44e3('0x6c'),'statusCode':_0x321904[_0x44e3('0x67')]}:_0x321904);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e9a91ff..96a2a2c 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 _0x79b7=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','moment','path','../../components/integrations/configuration'];(function(_0x233f6c,_0x4ad06a){var _0x1b4adf=function(_0x6248aa){while(--_0x6248aa){_0x233f6c['push'](_0x233f6c['shift']());}};_0x1b4adf(++_0x4ad06a);}(_0x79b7,0x73));var _0x779b=function(_0x250178,_0x23457c){_0x250178=_0x250178-0x0;var _0x561ea8=_0x79b7[_0x250178];return _0x561ea8;};'use strict';var _=require(_0x779b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x779b('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x779b('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x779b('0x3'));module['exports']=function(_0x574e96,_0x5cbaad){return _0x574e96[_0x779b('0x4')](_0x779b('0x5'),attributes,{'tableName':_0x779b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fd3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash'];(function(_0x421c11,_0xcf7560){var _0x317709=function(_0x5c8c71){while(--_0x5c8c71){_0x421c11['push'](_0x421c11['shift']());}};_0x317709(++_0xcf7560);}(_0x7fd3,0xdf));var _0x37fd=function(_0x5c9237,_0x44aa40){_0x5c9237=_0x5c9237-0x0;var _0x377761=_0x7fd3[_0x5c9237];return _0x377761;};'use strict';var _=require(_0x37fd('0x0'));var util=require('util');var logger=require(_0x37fd('0x1'))(_0x37fd('0x2'));var moment=require(_0x37fd('0x3'));var BPromise=require(_0x37fd('0x4'));var rp=require(_0x37fd('0x5'));var fs=require('fs');var path=require(_0x37fd('0x6'));var rimraf=require(_0x37fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x37fd('0x8'));var integrations=require(_0x37fd('0x9'));module[_0x37fd('0xa')]=function(_0x3dee92,_0x5ab7a4){return _0x3dee92[_0x37fd('0xb')](_0x37fd('0xc'),attributes,{'tableName':_0x37fd('0xd'),'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 865724b..625cd28 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 _0xc061=['request','then','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','include','model','map','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5e920a,_0x4e6f91){var _0x20050c=function(_0x483df0){while(--_0x483df0){_0x5e920a['push'](_0x5e920a['shift']());}};_0x20050c(++_0x4e6f91);}(_0xc061,0x1b0));var _0x1c06=function(_0x4c314b,_0x249ee7){_0x4c314b=_0x4c314b-0x0;var _0x4d7c44=_0xc061[_0x4c314b];return _0x4d7c44;};'use strict';var _=require(_0x1c06('0x0'));var util=require(_0x1c06('0x1'));var moment=require(_0x1c06('0x2'));var BPromise=require(_0x1c06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c06('0x4'))['db'];var utils=require(_0x1c06('0x5'));var logger=require(_0x1c06('0x6'))(_0x1c06('0x7'));var config=require(_0x1c06('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1c06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41cff1,_0x5e7278,_0x331aee){return new BPromise(function(_0x4d1fe2,_0x28443a){return client[_0x1c06('0xa')](_0x41cff1,_0x331aee)[_0x1c06('0xb')](function(_0x5ebe7d){logger['info'](_0x1c06('0xc'),_0x5e7278,'request\x20sent');logger[_0x1c06('0xd')](_0x1c06('0xe'),_0x5e7278,_0x1c06('0xf'),JSON['stringify'](_0x5ebe7d));if(_0x5ebe7d[_0x1c06('0x10')]){if(_0x5ebe7d[_0x1c06('0x10')]['code']===0x1f4){logger[_0x1c06('0x10')](_0x1c06('0xc'),_0x5e7278,_0x5ebe7d['error']['message']);return _0x28443a(_0x5ebe7d['error']['message']);}logger[_0x1c06('0x10')](_0x1c06('0xc'),_0x5e7278,_0x5ebe7d[_0x1c06('0x10')][_0x1c06('0x11')]);return _0x4d1fe2(_0x5ebe7d[_0x1c06('0x10')][_0x1c06('0x11')]);}else{logger[_0x1c06('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e7278,'request\x20sent');_0x4d1fe2(_0x5ebe7d[_0x1c06('0x13')][_0x1c06('0x11')]);}})[_0x1c06('0x14')](function(_0x534f36){logger[_0x1c06('0x10')](_0x1c06('0xc'),_0x5e7278,_0x534f36);_0x28443a(_0x534f36);});});}exports[_0x1c06('0x15')]=function(_0xcd9183){var _0x5c046a=this;return new Promise(function(_0x256828,_0x4f359a){return db['FreshdeskAccount']['findAll']({'raw':_0xcd9183[_0x1c06('0x16')]?_0xcd9183[_0x1c06('0x16')][_0x1c06('0x17')]===undefined?!![]:![]:!![],'where':_0xcd9183[_0x1c06('0x16')]?_0xcd9183[_0x1c06('0x16')][_0x1c06('0x18')]||null:null,'attributes':_0xcd9183[_0x1c06('0x16')]?_0xcd9183[_0x1c06('0x16')][_0x1c06('0x19')]||null:null,'limit':_0xcd9183[_0x1c06('0x16')]?_0xcd9183[_0x1c06('0x16')][_0x1c06('0x1a')]||null:null,'include':_0xcd9183[_0x1c06('0x16')]?_0xcd9183[_0x1c06('0x16')][_0x1c06('0x1b')]?_['map'](_0xcd9183['options'][_0x1c06('0x1b')],function(_0x5c1ab7){return{'model':db[_0x5c1ab7[_0x1c06('0x1c')]],'as':_0x5c1ab7['as'],'attributes':_0x5c1ab7[_0x1c06('0x19')],'include':_0x5c1ab7[_0x1c06('0x1b')]?_[_0x1c06('0x1d')](_0x5c1ab7[_0x1c06('0x1b')],function(_0x546388){return{'model':db[_0x546388['model']],'as':_0x546388['as'],'attributes':_0x546388[_0x1c06('0x19')],'include':_0x546388['include']?_[_0x1c06('0x1d')](_0x546388['include'],function(_0x23b5b9){return{'model':db[_0x23b5b9[_0x1c06('0x1c')]],'as':_0x23b5b9['as'],'attributes':_0x23b5b9[_0x1c06('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1c06('0xb')](function(_0x577fb5){logger[_0x1c06('0x12')]('GetFreshdeskAccount',_0xcd9183);logger[_0x1c06('0xd')](_0x1c06('0x15'),_0xcd9183,JSON[_0x1c06('0x1e')](_0x577fb5));_0x256828(_0x577fb5);})[_0x1c06('0x14')](function(_0x33a15c){logger[_0x1c06('0x10')](_0x1c06('0x15'),_0x33a15c['message'],_0xcd9183);_0x4f359a(_0x5c046a[_0x1c06('0x10')](0x1f4,_0x33a15c[_0x1c06('0x11')]));});});};exports[_0x1c06('0x1f')]=function(_0x4bbd92){var _0x45164a=this;return new Promise(function(_0x55f94,_0x55cb10){return db[_0x1c06('0x20')][_0x1c06('0x21')]({'raw':_0x4bbd92[_0x1c06('0x16')]?_0x4bbd92[_0x1c06('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4bbd92['options']?_0x4bbd92[_0x1c06('0x16')]['where']||null:null,'attributes':_0x4bbd92[_0x1c06('0x16')]?_0x4bbd92['options'][_0x1c06('0x19')]||null:null,'include':_0x4bbd92[_0x1c06('0x16')]?_0x4bbd92[_0x1c06('0x16')]['include']?_[_0x1c06('0x1d')](_0x4bbd92[_0x1c06('0x16')][_0x1c06('0x1b')],function(_0x1ed2ef){return{'model':db[_0x1ed2ef[_0x1c06('0x1c')]],'as':_0x1ed2ef['as'],'attributes':_0x1ed2ef['attributes'],'include':_0x1ed2ef['include']?_[_0x1c06('0x1d')](_0x1ed2ef[_0x1c06('0x1b')],function(_0x173bbe){return{'model':db[_0x173bbe['model']],'as':_0x173bbe['as'],'attributes':_0x173bbe[_0x1c06('0x19')],'include':_0x173bbe[_0x1c06('0x1b')]?_[_0x1c06('0x1d')](_0x173bbe['include'],function(_0xe9d2c4){return{'model':db[_0xe9d2c4[_0x1c06('0x1c')]],'as':_0xe9d2c4['as'],'attributes':_0xe9d2c4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c06('0xb')](function(_0x367bec){logger[_0x1c06('0x12')](_0x1c06('0x1f'),_0x4bbd92);logger['debug'](_0x1c06('0x1f'),_0x4bbd92,JSON[_0x1c06('0x1e')](_0x367bec));_0x55f94(_0x367bec);})['catch'](function(_0xd313ec){logger[_0x1c06('0x10')](_0x1c06('0x1f'),_0xd313ec[_0x1c06('0x11')],_0x4bbd92);_0x55cb10(_0x45164a['error'](0x1f4,_0xd313ec[_0x1c06('0x11')]));});});}; \ No newline at end of file +var _0xd156=['rpc','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','map','model','include','attributes','find','ShowFreshdeskAccount','moment','bluebird','randomstring','../../config/utils'];(function(_0x5957d0,_0x2048b3){var _0x357aad=function(_0x5c9c01){while(--_0x5c9c01){_0x5957d0['push'](_0x5957d0['shift']());}};_0x357aad(++_0x2048b3);}(_0xd156,0x151));var _0x6d15=function(_0x571a60,_0x5cce60){_0x571a60=_0x571a60-0x0;var _0x27fab9=_0xd156[_0x571a60];return _0x27fab9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d15('0x0'));var BPromise=require(_0x6d15('0x1'));var rs=require(_0x6d15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d15('0x3'));var logger=require('../../config/logger')(_0x6d15('0x4'));var config=require('../../config/environment');var jayson=require(_0x6d15('0x5'));var client=jayson[_0x6d15('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b481,_0xd4d4a8,_0x3d4d65){return new BPromise(function(_0x562874,_0x4e7952){return client[_0x6d15('0x7')](_0x51b481,_0x3d4d65)[_0x6d15('0x8')](function(_0x1e50e3){logger[_0x6d15('0x9')](_0x6d15('0xa'),_0xd4d4a8,_0x6d15('0xb'));logger[_0x6d15('0xc')](_0x6d15('0xd'),_0xd4d4a8,'request\x20sent',JSON[_0x6d15('0xe')](_0x1e50e3));if(_0x1e50e3[_0x6d15('0xf')]){if(_0x1e50e3['error'][_0x6d15('0x10')]===0x1f4){logger['error'](_0x6d15('0xa'),_0xd4d4a8,_0x1e50e3['error'][_0x6d15('0x11')]);return _0x4e7952(_0x1e50e3[_0x6d15('0xf')][_0x6d15('0x11')]);}logger[_0x6d15('0xf')](_0x6d15('0xa'),_0xd4d4a8,_0x1e50e3[_0x6d15('0xf')][_0x6d15('0x11')]);return _0x562874(_0x1e50e3[_0x6d15('0xf')]['message']);}else{logger[_0x6d15('0x9')](_0x6d15('0xa'),_0xd4d4a8,'request\x20sent');_0x562874(_0x1e50e3['result'][_0x6d15('0x11')]);}})[_0x6d15('0x12')](function(_0x3c6afd){logger[_0x6d15('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0xd4d4a8,_0x3c6afd);_0x4e7952(_0x3c6afd);});});}exports[_0x6d15('0x13')]=function(_0xc8ae50){var _0x54be65=this;return new Promise(function(_0x5dfb34,_0x30259b){return db[_0x6d15('0x14')][_0x6d15('0x15')]({'raw':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50['options'][_0x6d15('0x17')]||null:null,'attributes':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['attributes']||null:null,'limit':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')][_0x6d15('0x18')]||null:null,'include':_0xc8ae50[_0x6d15('0x16')]?_0xc8ae50[_0x6d15('0x16')]['include']?_[_0x6d15('0x19')](_0xc8ae50[_0x6d15('0x16')]['include'],function(_0x284422){return{'model':db[_0x284422[_0x6d15('0x1a')]],'as':_0x284422['as'],'attributes':_0x284422['attributes'],'include':_0x284422[_0x6d15('0x1b')]?_['map'](_0x284422['include'],function(_0xd4411b){return{'model':db[_0xd4411b[_0x6d15('0x1a')]],'as':_0xd4411b['as'],'attributes':_0xd4411b[_0x6d15('0x1c')],'include':_0xd4411b[_0x6d15('0x1b')]?_['map'](_0xd4411b['include'],function(_0x455519){return{'model':db[_0x455519[_0x6d15('0x1a')]],'as':_0x455519['as'],'attributes':_0x455519['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d15('0x8')](function(_0x546a29){logger[_0x6d15('0x9')](_0x6d15('0x13'),_0xc8ae50);logger['debug'](_0x6d15('0x13'),_0xc8ae50,JSON[_0x6d15('0xe')](_0x546a29));_0x5dfb34(_0x546a29);})[_0x6d15('0x12')](function(_0x5d52ae){logger['error']('GetFreshdeskAccount',_0x5d52ae['message'],_0xc8ae50);_0x30259b(_0x54be65[_0x6d15('0xf')](0x1f4,_0x5d52ae[_0x6d15('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x3de6b6){var _0x380241=this;return new Promise(function(_0x5850d0,_0x2460ea){return db[_0x6d15('0x14')][_0x6d15('0x1d')]({'raw':_0x3de6b6['options']?_0x3de6b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3de6b6[_0x6d15('0x16')]?_0x3de6b6[_0x6d15('0x16')][_0x6d15('0x17')]||null:null,'attributes':_0x3de6b6[_0x6d15('0x16')]?_0x3de6b6[_0x6d15('0x16')][_0x6d15('0x1c')]||null:null,'include':_0x3de6b6['options']?_0x3de6b6['options']['include']?_[_0x6d15('0x19')](_0x3de6b6['options']['include'],function(_0x10a775){return{'model':db[_0x10a775['model']],'as':_0x10a775['as'],'attributes':_0x10a775[_0x6d15('0x1c')],'include':_0x10a775['include']?_[_0x6d15('0x19')](_0x10a775[_0x6d15('0x1b')],function(_0xec55c0){return{'model':db[_0xec55c0[_0x6d15('0x1a')]],'as':_0xec55c0['as'],'attributes':_0xec55c0['attributes'],'include':_0xec55c0['include']?_[_0x6d15('0x19')](_0xec55c0['include'],function(_0x51f439){return{'model':db[_0x51f439['model']],'as':_0x51f439['as'],'attributes':_0x51f439[_0x6d15('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d15('0x8')](function(_0xfd1240){logger[_0x6d15('0x9')]('ShowFreshdeskAccount',_0x3de6b6);logger[_0x6d15('0xc')](_0x6d15('0x1e'),_0x3de6b6,JSON[_0x6d15('0xe')](_0xfd1240));_0x5850d0(_0xfd1240);})[_0x6d15('0x12')](function(_0x27fa19){logger[_0x6d15('0xf')](_0x6d15('0x1e'),_0x27fa19[_0x6d15('0x11')],_0x3de6b6);_0x2460ea(_0x380241['error'](0x1f4,_0x27fa19[_0x6d15('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index dde1c3a..1885d65 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 _0xc9e4=['isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x1635e0,_0x4976f7){var _0x3e4902=function(_0x565bb4){while(--_0x565bb4){_0x1635e0['push'](_0x1635e0['shift']());}};_0x3e4902(++_0x4976f7);}(_0xc9e4,0x1f4));var _0x4c9e=function(_0x1765c4,_0x151565){_0x1765c4=_0x1765c4-0x0;var _0x56645f=_0xc9e4[_0x1765c4];return _0x56645f;};'use strict';var multer=require(_0x4c9e('0x0'));var util=require(_0x4c9e('0x1'));var path=require('path');var timeout=require(_0x4c9e('0x2'));var express=require(_0x4c9e('0x3'));var router=express[_0x4c9e('0x4')]();var fs_extra=require(_0x4c9e('0x5'));var auth=require(_0x4c9e('0x6'));var interaction=require(_0x4c9e('0x7'));var config=require(_0x4c9e('0x8'));var controller=require(_0x4c9e('0x9'));router['get']('/',auth[_0x4c9e('0xa')](),controller[_0x4c9e('0xb')]);router[_0x4c9e('0xc')]('/:id',auth[_0x4c9e('0xa')](),controller[_0x4c9e('0xd')]);router[_0x4c9e('0xc')](_0x4c9e('0xe'),auth[_0x4c9e('0xa')](),controller[_0x4c9e('0xf')]);router['get']('/:id/subjects',auth[_0x4c9e('0xa')](),controller[_0x4c9e('0x10')]);router['get'](_0x4c9e('0x11'),auth[_0x4c9e('0xa')](),controller[_0x4c9e('0x12')]);router[_0x4c9e('0xc')](_0x4c9e('0x13'),auth[_0x4c9e('0xa')](),controller[_0x4c9e('0x14')]);router[_0x4c9e('0x15')]('/',auth[_0x4c9e('0xa')](),controller[_0x4c9e('0x16')]);router[_0x4c9e('0x15')](_0x4c9e('0x13'),auth[_0x4c9e('0xa')](),controller[_0x4c9e('0x17')]);router[_0x4c9e('0x18')](_0x4c9e('0x19'),auth['isAuthenticated'](),controller[_0x4c9e('0x1a')]);router[_0x4c9e('0x1b')](_0x4c9e('0x19'),auth['isAuthenticated'](),controller[_0x4c9e('0x1c')]);module[_0x4c9e('0x1d')]=router; \ No newline at end of file +var _0xcbe4=['destroy','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcbe4,0x182));var _0x4cbe=function(_0x38d5f4,_0x113004){_0x38d5f4=_0x38d5f4-0x0;var _0x481490=_0xcbe4[_0x38d5f4];return _0x481490;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4cbe('0x0'));var express=require(_0x4cbe('0x1'));var router=express[_0x4cbe('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4cbe('0x3'));var config=require(_0x4cbe('0x4'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x4cbe('0x5')]('/',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x7')]);router['get'](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x9')]);router[_0x4cbe('0x5')](_0x4cbe('0xa'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xb')]);router[_0x4cbe('0x5')](_0x4cbe('0xc'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xd')]);router[_0x4cbe('0x5')]('/:id/descriptions',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0xe')]);router['get'](_0x4cbe('0xf'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x10')]);router[_0x4cbe('0x11')]('/',auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x12')]);router[_0x4cbe('0x11')](_0x4cbe('0xf'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x13')]);router['put'](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x14')]);router[_0x4cbe('0x15')](_0x4cbe('0x8'),auth[_0x4cbe('0x6')](),controller[_0x4cbe('0x16')]);module[_0x4cbe('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 85e80d2..893a4de 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 _0x3319=['STRING'];(function(_0x1029de,_0x4737d0){var _0x454e27=function(_0x46b601){while(--_0x46b601){_0x1029de['push'](_0x1029de['shift']());}};_0x454e27(++_0x4737d0);}(_0x3319,0x6a));var _0x9331=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3319[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9331('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4995=['sequelize','exports','STRING'];(function(_0x2a61a9,_0x132d0d){var _0x52c670=function(_0x2813c4){while(--_0x2813c4){_0x2a61a9['push'](_0x2a61a9['shift']());}};_0x52c670(++_0x132d0d);}(_0x4995,0x84));var _0x5499=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4995[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5499('0x0'));module[_0x5499('0x1')]={'name':{'type':Sequelize[_0x5499('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 098e1cd..012283f 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 _0xc101=['util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','getFields','hasOwnProperty','getSubjects','findOne','FreshdeskField','pick','map','getDescriptions','getTags','setTags','rimraf','request-promise','moment','mustache'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xc101,0x187));var _0x1c10=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xc101[_0x438912];return _0x18112f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c10('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c10('0x1'));var moment=require(_0x1c10('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1c10('0x3'));var util=require(_0x1c10('0x4'));var path=require(_0x1c10('0x5'));var sox=require(_0x1c10('0x6'));var csv=require('to-csv');var ejs=require(_0x1c10('0x7'));var fs=require('fs');var fs_extra=require(_0x1c10('0x8'));var _=require('lodash');var squel=require(_0x1c10('0x9'));var crypto=require('crypto');var jsforce=require(_0x1c10('0xa'));var deskjs=require(_0x1c10('0xb'));var toCsv=require(_0x1c10('0xc'));var querystring=require(_0x1c10('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c10('0xe'));var authService=require(_0x1c10('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1c10('0x10'));var hardwareService=require(_0x1c10('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c10('0x12'));var licenseUtil=require(_0x1c10('0x13'));var db=require(_0x1c10('0x14'))['db'];function respondWithStatusCode(_0x254b93,_0x2f59fd){_0x2f59fd=_0x2f59fd||0xcc;return function(_0x4cc69b){if(_0x4cc69b){return _0x254b93[_0x1c10('0x15')](_0x2f59fd);}return _0x254b93[_0x1c10('0x16')](_0x2f59fd)[_0x1c10('0x17')]();};}function respondWithResult(_0x4c372d,_0x205e66){_0x205e66=_0x205e66||0xc8;return function(_0x4c138c){if(_0x4c138c){return _0x4c372d[_0x1c10('0x16')](_0x205e66)[_0x1c10('0x18')](_0x4c138c);}};}function respondWithFilteredResult(_0x4253b7,_0x35420c){return function(_0x397a1b){if(_0x397a1b){var _0x3476b4=typeof _0x35420c[_0x1c10('0x19')]===_0x1c10('0x1a')&&typeof _0x35420c[_0x1c10('0x1b')]===_0x1c10('0x1a');var _0x1c96e4=_0x397a1b[_0x1c10('0x1c')];var _0x431bd8=_0x3476b4?0x0:_0x35420c[_0x1c10('0x19')];var _0x111a00=_0x3476b4?_0x397a1b[_0x1c10('0x1c')]:_0x35420c[_0x1c10('0x19')]+_0x35420c[_0x1c10('0x1b')];var _0x13ec3b;if(_0x111a00>=_0x1c96e4){_0x111a00=_0x1c96e4;_0x13ec3b=0xc8;}else{_0x13ec3b=0xce;}_0x4253b7[_0x1c10('0x16')](_0x13ec3b);return _0x4253b7['set']('Content-Range',_0x431bd8+'-'+_0x111a00+'/'+_0x1c96e4)['json'](_0x397a1b);}return null;};}function patchUpdates(_0x4724b1){return function(_0x19e3f8){try{jsonpatch[_0x1c10('0x1d')](_0x19e3f8,_0x4724b1,!![]);}catch(_0x495388){return BPromise[_0x1c10('0x1e')](_0x495388);}return _0x19e3f8[_0x1c10('0x1f')]();};}function saveUpdates(_0x4786c2,_0x19d129){return function(_0x403f80){if(_0x403f80){return _0x403f80[_0x1c10('0x20')](_0x4786c2)[_0x1c10('0x21')](function(_0x434795){return _0x434795;});}return null;};}function removeEntity(_0x568b73,_0xb148e){return function(_0x126dea){if(_0x126dea){return _0x126dea[_0x1c10('0x22')]()['then'](function(){_0x568b73['status'](0xcc)[_0x1c10('0x17')]();});}};}function handleEntityNotFound(_0x475666,_0x3c0f14){return function(_0x51d889){if(!_0x51d889){_0x475666[_0x1c10('0x15')](0x194);}return _0x51d889;};}function handleError(_0x75c20d,_0x39e59a){_0x39e59a=_0x39e59a||0x1f4;return function(_0x9a1af0){logger[_0x1c10('0x23')](_0x9a1af0['stack']);if(_0x9a1af0[_0x1c10('0x24')]){delete _0x9a1af0[_0x1c10('0x24')];}_0x75c20d[_0x1c10('0x16')](_0x39e59a)[_0x1c10('0x25')](_0x9a1af0);};}exports[_0x1c10('0x26')]=function(_0x5a91fd,_0x1630a3){var _0x1497e3={},_0x1f667c={},_0x329aa4={'count':0x0,'rows':[]};var _0x27d4bf=_['map'](db[_0x1c10('0x27')][_0x1c10('0x28')],function(_0x1a176c){return{'name':_0x1a176c[_0x1c10('0x29')],'type':_0x1a176c[_0x1c10('0x2a')][_0x1c10('0x2b')]};});_0x1f667c['model']=_['map'](_0x27d4bf,_0x1c10('0x24'));_0x1f667c[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x5a91fd['query']);_0x1f667c[_0x1c10('0x2e')]=_[_0x1c10('0x2f')](_0x1f667c[_0x1c10('0x30')],_0x1f667c[_0x1c10('0x2c')]);_0x1497e3[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x1f667c[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x5a91fd[_0x1c10('0x2c')]['fields']));_0x1497e3[_0x1c10('0x31')]=_0x1497e3['attributes'][_0x1c10('0x33')]?_0x1497e3[_0x1c10('0x31')]:_0x1f667c[_0x1c10('0x30')];if(!_0x5a91fd[_0x1c10('0x2c')]['hasOwnProperty'](_0x1c10('0x34'))){_0x1497e3['limit']=qs[_0x1c10('0x1b')](_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0x1497e3[_0x1c10('0x19')]=qs[_0x1c10('0x19')](_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x19')]);}_0x1497e3[_0x1c10('0x35')]=qs[_0x1c10('0x36')](_0x5a91fd['query'][_0x1c10('0x36')]);_0x1497e3[_0x1c10('0x37')]=qs[_0x1c10('0x2e')](_['pick'](_0x5a91fd[_0x1c10('0x2c')],_0x1f667c[_0x1c10('0x2e')]),_0x27d4bf);if(_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x38')]){_0x1497e3[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x1497e3[_0x1c10('0x37')],{'$or':_['map'](_0x27d4bf,function(_0x45a89c){if(_0x45a89c[_0x1c10('0x2a')]!==_0x1c10('0x3a')){var _0x3850f8={};_0x3850f8[_0x45a89c[_0x1c10('0x24')]]={'$like':'%'+_0x5a91fd[_0x1c10('0x2c')]['filter']+'%'};return _0x3850f8;}})});}_0x1497e3=_[_0x1c10('0x39')]({},_0x1497e3,_0x5a91fd[_0x1c10('0x3b')]);var _0x14da01={'where':_0x1497e3[_0x1c10('0x37')]};return db[_0x1c10('0x27')]['count'](_0x14da01)[_0x1c10('0x21')](function(_0x5eb985){_0x329aa4[_0x1c10('0x1c')]=_0x5eb985;if(_0x5a91fd['query']['includeAll']){_0x1497e3[_0x1c10('0x3c')]=[{'all':!![]}];}return db[_0x1c10('0x27')][_0x1c10('0x3d')](_0x1497e3);})['then'](function(_0x40d9e5){_0x329aa4[_0x1c10('0x3e')]=_0x40d9e5;return _0x329aa4;})[_0x1c10('0x21')](respondWithFilteredResult(_0x1630a3,_0x1497e3))[_0x1c10('0x3f')](handleError(_0x1630a3,null));};exports['show']=function(_0x179865,_0x32f7e9){var _0x5972aa={'raw':![],'where':{'id':_0x179865[_0x1c10('0x40')]['id']}},_0x3a9d47={};_0x3a9d47[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x27')][_0x1c10('0x28')]);_0x3a9d47['query']=_[_0x1c10('0x2d')](_0x179865[_0x1c10('0x2c')]);_0x3a9d47['filters']=_[_0x1c10('0x2f')](_0x3a9d47[_0x1c10('0x30')],_0x3a9d47['query']);_0x5972aa[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x3a9d47[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x179865['query'][_0x1c10('0x32')]));_0x5972aa['attributes']=_0x5972aa[_0x1c10('0x31')][_0x1c10('0x33')]?_0x5972aa['attributes']:_0x3a9d47[_0x1c10('0x30')];if(_0x179865[_0x1c10('0x2c')][_0x1c10('0x41')]){_0x5972aa[_0x1c10('0x3c')]=[{'all':!![]}];}_0x5972aa=_['merge']({},_0x5972aa,_0x179865[_0x1c10('0x3b')]);return db['FreshdeskConfiguration']['find'](_0x5972aa)[_0x1c10('0x21')](handleEntityNotFound(_0x32f7e9,null))[_0x1c10('0x21')](respondWithResult(_0x32f7e9,null))[_0x1c10('0x3f')](handleError(_0x32f7e9,null));};exports['create']=function(_0x2066c2,_0x352eab){return db['FreshdeskConfiguration'][_0x1c10('0x42')](_0x2066c2[_0x1c10('0x43')],{})[_0x1c10('0x21')](respondWithResult(_0x352eab,0xc9))['catch'](handleError(_0x352eab,null));};exports[_0x1c10('0x20')]=function(_0x22f57f,_0x4c3b51){if(_0x22f57f[_0x1c10('0x43')]['id']){delete _0x22f57f['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x22f57f['params']['id']}})['then'](handleEntityNotFound(_0x4c3b51,null))[_0x1c10('0x21')](saveUpdates(_0x22f57f[_0x1c10('0x43')],null))[_0x1c10('0x21')](respondWithResult(_0x4c3b51,null))[_0x1c10('0x3f')](handleError(_0x4c3b51,null));};exports['destroy']=function(_0x39fd94,_0x1bfd65){return db['FreshdeskConfiguration'][_0x1c10('0x44')]({'where':{'id':_0x39fd94[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bfd65,null))[_0x1c10('0x21')](removeEntity(_0x1bfd65,null))[_0x1c10('0x3f')](handleError(_0x1bfd65,null));};exports['getFields']=function(_0x555a0c,_0x443409,_0x4419e1){var _0x56d1be={};var _0x41e85a={};var _0xf40a80;var _0x868516;return db[_0x1c10('0x27')]['findOne']({'where':{'id':_0x555a0c[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0x443409,null))[_0x1c10('0x21')](function(_0xda803b){if(_0xda803b){_0xf40a80=_0xda803b;_0x41e85a[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db['FreshdeskField'][_0x1c10('0x28')]);_0x41e85a[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x555a0c[_0x1c10('0x2c')]);_0x41e85a['filters']=_['intersection'](_0x41e85a[_0x1c10('0x30')],_0x41e85a[_0x1c10('0x2c')]);_0x56d1be[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x41e85a[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x555a0c['query'][_0x1c10('0x32')]));_0x56d1be[_0x1c10('0x31')]=_0x56d1be[_0x1c10('0x31')][_0x1c10('0x33')]?_0x56d1be[_0x1c10('0x31')]:_0x41e85a[_0x1c10('0x30')];_0x56d1be[_0x1c10('0x35')]=qs[_0x1c10('0x36')](_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x56d1be['where']=qs[_0x1c10('0x2e')](_['pick'](_0x555a0c['query'],_0x41e85a[_0x1c10('0x2e')]));if(_0x555a0c[_0x1c10('0x2c')]['filter']){_0x56d1be[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x56d1be['where'],{'$or':_['map'](_0x56d1be[_0x1c10('0x31')],function(_0x246ab7){var _0x1e5148={};_0x1e5148[_0x246ab7]={'$like':'%'+_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x38')]+'%'};return _0x1e5148;})});}_0x56d1be=_[_0x1c10('0x39')]({},_0x56d1be,_0x555a0c[_0x1c10('0x3b')]);return _0xf40a80[_0x1c10('0x45')](_0x56d1be);}})[_0x1c10('0x21')](function(_0x15b74c){if(_0x15b74c){_0x868516=_0x15b74c[_0x1c10('0x33')];if(!_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x46')](_0x1c10('0x34'))){_0x56d1be[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0x555a0c['query'][_0x1c10('0x1b')]);_0x56d1be['offset']=qs['offset'](_0x555a0c[_0x1c10('0x2c')]['offset']);}return _0xf40a80[_0x1c10('0x45')](_0x56d1be);}})[_0x1c10('0x21')](function(_0x17e15f){if(_0x17e15f){return _0x17e15f?{'count':_0x868516,'rows':_0x17e15f}:null;}})[_0x1c10('0x21')](respondWithResult(_0x443409,null))[_0x1c10('0x3f')](handleError(_0x443409,null));};exports[_0x1c10('0x47')]=function(_0x1b1572,_0x23163f,_0x63d1c4){var _0xb2b376={};var _0x3d3945={};var _0x1d3497;var _0x3c6192;return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0x1b1572[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x23163f,null))[_0x1c10('0x21')](function(_0x1afe90){if(_0x1afe90){_0x1d3497=_0x1afe90;_0x3d3945[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x49')][_0x1c10('0x28')]);_0x3d3945['query']=_[_0x1c10('0x2d')](_0x1b1572[_0x1c10('0x2c')]);_0x3d3945['filters']=_['intersection'](_0x3d3945['model'],_0x3d3945[_0x1c10('0x2c')]);_0xb2b376[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x3d3945[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x1b1572[_0x1c10('0x2c')]['fields']));_0xb2b376['attributes']=_0xb2b376['attributes'][_0x1c10('0x33')]?_0xb2b376[_0x1c10('0x31')]:_0x3d3945[_0x1c10('0x30')];_0xb2b376[_0x1c10('0x35')]=qs['sort'](_0x1b1572[_0x1c10('0x2c')]['sort']);_0xb2b376['where']=qs[_0x1c10('0x2e')](_[_0x1c10('0x4a')](_0x1b1572['query'],_0x3d3945[_0x1c10('0x2e')]));if(_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x38')]){_0xb2b376[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0xb2b376[_0x1c10('0x37')],{'$or':_[_0x1c10('0x4b')](_0xb2b376[_0x1c10('0x31')],function(_0x5a8436){var _0x29fd3f={};_0x29fd3f[_0x5a8436]={'$like':'%'+_0x1b1572['query'][_0x1c10('0x38')]+'%'};return _0x29fd3f;})});}_0xb2b376=_['merge']({},_0xb2b376,_0x1b1572['options']);return _0x1d3497[_0x1c10('0x47')](_0xb2b376);}})[_0x1c10('0x21')](function(_0x9d0868){if(_0x9d0868){_0x3c6192=_0x9d0868[_0x1c10('0x33')];if(!_0x1b1572['query'][_0x1c10('0x46')](_0x1c10('0x34'))){_0xb2b376[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0xb2b376[_0x1c10('0x19')]=qs[_0x1c10('0x19')](_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x1d3497[_0x1c10('0x47')](_0xb2b376);}})['then'](function(_0x46bfb0){if(_0x46bfb0){return _0x46bfb0?{'count':_0x3c6192,'rows':_0x46bfb0}:null;}})[_0x1c10('0x21')](respondWithResult(_0x23163f,null))[_0x1c10('0x3f')](handleError(_0x23163f,null));};exports[_0x1c10('0x4c')]=function(_0x2825d4,_0x1812bc,_0x13c9b5){var _0x160081={};var _0x155224={};var _0x578924;var _0x150ac0;return db[_0x1c10('0x27')]['findOne']({'where':{'id':_0x2825d4[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x1812bc,null))[_0x1c10('0x21')](function(_0x41a07d){if(_0x41a07d){_0x578924=_0x41a07d;_0x155224[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x49')][_0x1c10('0x28')]);_0x155224[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x2825d4[_0x1c10('0x2c')]);_0x155224['filters']=_[_0x1c10('0x2f')](_0x155224[_0x1c10('0x30')],_0x155224['query']);_0x160081[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x155224[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x2825d4['query'][_0x1c10('0x32')]));_0x160081[_0x1c10('0x31')]=_0x160081[_0x1c10('0x31')][_0x1c10('0x33')]?_0x160081[_0x1c10('0x31')]:_0x155224[_0x1c10('0x30')];_0x160081[_0x1c10('0x35')]=qs['sort'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x160081['where']=qs['filters'](_[_0x1c10('0x4a')](_0x2825d4[_0x1c10('0x2c')],_0x155224[_0x1c10('0x2e')]));if(_0x2825d4['query'][_0x1c10('0x38')]){_0x160081[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x160081[_0x1c10('0x37')],{'$or':_['map'](_0x160081[_0x1c10('0x31')],function(_0x2ffddd){var _0x7ef648={};_0x7ef648[_0x2ffddd]={'$like':'%'+_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x38')]+'%'};return _0x7ef648;})});}_0x160081=_[_0x1c10('0x39')]({},_0x160081,_0x2825d4[_0x1c10('0x3b')]);return _0x578924[_0x1c10('0x4c')](_0x160081);}})['then'](function(_0x28050f){if(_0x28050f){_0x150ac0=_0x28050f[_0x1c10('0x33')];if(!_0x2825d4['query']['hasOwnProperty'](_0x1c10('0x34'))){_0x160081[_0x1c10('0x1b')]=qs['limit'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0x160081['offset']=qs['offset'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x578924[_0x1c10('0x4c')](_0x160081);}})['then'](function(_0x5b5643){if(_0x5b5643){return _0x5b5643?{'count':_0x150ac0,'rows':_0x5b5643}:null;}})[_0x1c10('0x21')](respondWithResult(_0x1812bc,null))['catch'](handleError(_0x1812bc,null));};exports['getTags']=function(_0xc53e3c,_0x2b6516,_0x247482){var _0x5e2ace={};var _0x1c125d={};var _0x92c32c;var _0x48213e;return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0xc53e3c[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0x2b6516,null))[_0x1c10('0x21')](function(_0x3aeeeb){if(_0x3aeeeb){_0x92c32c=_0x3aeeeb;_0x1c125d[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db['Tag'][_0x1c10('0x28')]);_0x1c125d['query']=_[_0x1c10('0x2d')](_0xc53e3c[_0x1c10('0x2c')]);_0x1c125d['filters']=_['intersection'](_0x1c125d[_0x1c10('0x30')],_0x1c125d[_0x1c10('0x2c')]);_0x5e2ace[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x1c125d[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0xc53e3c[_0x1c10('0x2c')]['fields']));_0x5e2ace[_0x1c10('0x31')]=_0x5e2ace['attributes'][_0x1c10('0x33')]?_0x5e2ace['attributes']:_0x1c125d[_0x1c10('0x30')];_0x5e2ace[_0x1c10('0x35')]=qs['sort'](_0xc53e3c[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x5e2ace[_0x1c10('0x37')]=qs['filters'](_[_0x1c10('0x4a')](_0xc53e3c[_0x1c10('0x2c')],_0x1c125d[_0x1c10('0x2e')]));if(_0xc53e3c[_0x1c10('0x2c')]['filter']){_0x5e2ace[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x5e2ace[_0x1c10('0x37')],{'$or':_[_0x1c10('0x4b')](_0x5e2ace[_0x1c10('0x31')],function(_0x5cc4fa){var _0xf32d59={};_0xf32d59[_0x5cc4fa]={'$like':'%'+_0xc53e3c[_0x1c10('0x2c')]['filter']+'%'};return _0xf32d59;})});}_0x5e2ace=_['merge']({},_0x5e2ace,_0xc53e3c['options']);return _0x92c32c[_0x1c10('0x4d')](_0x5e2ace);}})[_0x1c10('0x21')](function(_0xe0eaf7){if(_0xe0eaf7){_0x48213e=_0xe0eaf7[_0x1c10('0x33')];if(!_0xc53e3c['query']['hasOwnProperty'](_0x1c10('0x34'))){_0x5e2ace[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0xc53e3c['query']['limit']);_0x5e2ace['offset']=qs[_0x1c10('0x19')](_0xc53e3c[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x92c32c['getTags'](_0x5e2ace);}})[_0x1c10('0x21')](function(_0xbd3954){if(_0xbd3954){return _0xbd3954?{'count':_0x48213e,'rows':_0xbd3954}:null;}})[_0x1c10('0x21')](respondWithResult(_0x2b6516,null))[_0x1c10('0x3f')](handleError(_0x2b6516,null));};exports['setTags']=function(_0x84386b,_0xa46fa6,_0x38dd23){if(_0x84386b['body']['id']){delete _0x84386b[_0x1c10('0x43')]['id'];}return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0x84386b[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0xa46fa6,null))['then'](function(_0x244c22){if(_0x244c22){return _0x244c22[_0x1c10('0x4e')](_0x84386b[_0x1c10('0x43')]['ids']||[]);}return null;})['then'](respondWithResult(_0xa46fa6,null))['catch'](handleError(_0xa46fa6,null));}; \ No newline at end of file +var _0x3879=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','rows','catch','params','rawAttributes','includeAll','include','find','create','body','getFields','FreshdeskField','pick','findOne','keys','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x291f14,_0x32ddbc){var _0x399cb1=function(_0x3c4ace){while(--_0x3c4ace){_0x291f14['push'](_0x291f14['shift']());}};_0x399cb1(++_0x32ddbc);}(_0x3879,0x1ab));var _0x9387=function(_0x36443f,_0x42cfdb){_0x36443f=_0x36443f-0x0;var _0x37bbf9=_0x3879[_0x36443f];return _0x37bbf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9387('0x1'));var rp=require(_0x9387('0x2'));var moment=require('moment');var BPromise=require(_0x9387('0x3'));var Mustache=require(_0x9387('0x4'));var util=require(_0x9387('0x5'));var path=require(_0x9387('0x6'));var sox=require(_0x9387('0x7'));var csv=require(_0x9387('0x8'));var ejs=require(_0x9387('0x9'));var fs=require('fs');var fs_extra=require(_0x9387('0xa'));var _=require(_0x9387('0xb'));var squel=require('squel');var crypto=require(_0x9387('0xc'));var jsforce=require(_0x9387('0xd'));var deskjs=require(_0x9387('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9387('0xf'));var Papa=require(_0x9387('0x10'));var Redis=require(_0x9387('0x11'));var authService=require(_0x9387('0x12'));var qs=require(_0x9387('0x13'));var as=require(_0x9387('0x14'));var hardwareService=require(_0x9387('0x15'));var logger=require(_0x9387('0x16'))(_0x9387('0x17'));var utils=require(_0x9387('0x18'));var config=require(_0x9387('0x19'));var licenseUtil=require(_0x9387('0x1a'));var db=require(_0x9387('0x1b'))['db'];function respondWithStatusCode(_0x580b1f,_0x55d5e8){_0x55d5e8=_0x55d5e8||0xcc;return function(_0x59374d){if(_0x59374d){return _0x580b1f[_0x9387('0x1c')](_0x55d5e8);}return _0x580b1f[_0x9387('0x1d')](_0x55d5e8)[_0x9387('0x1e')]();};}function respondWithResult(_0x5123f9,_0x556ab8){_0x556ab8=_0x556ab8||0xc8;return function(_0x1930ef){if(_0x1930ef){return _0x5123f9[_0x9387('0x1d')](_0x556ab8)[_0x9387('0x1f')](_0x1930ef);}};}function respondWithFilteredResult(_0x1904a1,_0x17de98){return function(_0x3b7aa7){if(_0x3b7aa7){var _0x5dc252=typeof _0x17de98[_0x9387('0x20')]==='undefined'&&typeof _0x17de98['limit']===_0x9387('0x21');var _0x343d0b=_0x3b7aa7[_0x9387('0x22')];var _0x5a6dab=_0x5dc252?0x0:_0x17de98[_0x9387('0x20')];var _0xc5205e=_0x5dc252?_0x3b7aa7[_0x9387('0x22')]:_0x17de98[_0x9387('0x20')]+_0x17de98[_0x9387('0x23')];var _0x5a3e35;if(_0xc5205e>=_0x343d0b){_0xc5205e=_0x343d0b;_0x5a3e35=0xc8;}else{_0x5a3e35=0xce;}_0x1904a1['status'](_0x5a3e35);return _0x1904a1[_0x9387('0x24')]('Content-Range',_0x5a6dab+'-'+_0xc5205e+'/'+_0x343d0b)['json'](_0x3b7aa7);}return null;};}function patchUpdates(_0x4f41c6){return function(_0x15ef64){try{jsonpatch[_0x9387('0x25')](_0x15ef64,_0x4f41c6,!![]);}catch(_0x1464d1){return BPromise[_0x9387('0x26')](_0x1464d1);}return _0x15ef64[_0x9387('0x27')]();};}function saveUpdates(_0x25858c,_0xa9db64){return function(_0x11d5dd){if(_0x11d5dd){return _0x11d5dd[_0x9387('0x28')](_0x25858c)[_0x9387('0x29')](function(_0x30f5e4){return _0x30f5e4;});}return null;};}function removeEntity(_0x5edf13,_0x19f3a5){return function(_0x198b91){if(_0x198b91){return _0x198b91[_0x9387('0x2a')]()[_0x9387('0x29')](function(){_0x5edf13[_0x9387('0x1d')](0xcc)[_0x9387('0x1e')]();});}};}function handleEntityNotFound(_0x461f6b,_0x34cbb4){return function(_0x2bf730){if(!_0x2bf730){_0x461f6b['sendStatus'](0x194);}return _0x2bf730;};}function handleError(_0x53c67f,_0x50db5f){_0x50db5f=_0x50db5f||0x1f4;return function(_0x1be2e9){logger['error'](_0x1be2e9[_0x9387('0x2b')]);if(_0x1be2e9[_0x9387('0x2c')]){delete _0x1be2e9[_0x9387('0x2c')];}_0x53c67f[_0x9387('0x1d')](_0x50db5f)[_0x9387('0x2d')](_0x1be2e9);};}exports['index']=function(_0x447159,_0x5c9717){var _0x246e79={},_0x520ad6={},_0x4d0773={'count':0x0,'rows':[]};var _0x38b387=_[_0x9387('0x2e')](db[_0x9387('0x2f')]['rawAttributes'],function(_0x312025){return{'name':_0x312025[_0x9387('0x30')],'type':_0x312025['type'][_0x9387('0x31')]};});_0x520ad6[_0x9387('0x32')]=_[_0x9387('0x2e')](_0x38b387,_0x9387('0x2c'));_0x520ad6['query']=_['keys'](_0x447159[_0x9387('0x33')]);_0x520ad6[_0x9387('0x34')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],_0x520ad6[_0x9387('0x33')]);_0x246e79[_0x9387('0x36')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],qs['fields'](_0x447159['query'][_0x9387('0x37')]));_0x246e79['attributes']=_0x246e79['attributes'][_0x9387('0x38')]?_0x246e79[_0x9387('0x36')]:_0x520ad6[_0x9387('0x32')];if(!_0x447159[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x246e79[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x447159[_0x9387('0x33')][_0x9387('0x23')]);_0x246e79[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x447159['query'][_0x9387('0x20')]);}_0x246e79[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x447159[_0x9387('0x33')][_0x9387('0x3c')]);_0x246e79[_0x9387('0x3d')]=qs[_0x9387('0x34')](_['pick'](_0x447159[_0x9387('0x33')],_0x520ad6['filters']),_0x38b387);if(_0x447159[_0x9387('0x33')][_0x9387('0x3e')]){_0x246e79[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x246e79[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x38b387,function(_0x4911cd){if(_0x4911cd[_0x9387('0x40')]!==_0x9387('0x41')){var _0x22465b={};_0x22465b[_0x4911cd[_0x9387('0x2c')]]={'$like':'%'+_0x447159[_0x9387('0x33')][_0x9387('0x3e')]+'%'};return _0x22465b;}})});}_0x246e79=_['merge']({},_0x246e79,_0x447159[_0x9387('0x42')]);var _0x15d3ce={'where':_0x246e79[_0x9387('0x3d')]};return db[_0x9387('0x2f')][_0x9387('0x22')](_0x15d3ce)[_0x9387('0x29')](function(_0x162f0e){_0x4d0773['count']=_0x162f0e;if(_0x447159[_0x9387('0x33')]['includeAll']){_0x246e79['include']=[{'all':!![]}];}return db[_0x9387('0x2f')]['findAll'](_0x246e79);})[_0x9387('0x29')](function(_0x5e8e26){_0x4d0773[_0x9387('0x43')]=_0x5e8e26;return _0x4d0773;})[_0x9387('0x29')](respondWithFilteredResult(_0x5c9717,_0x246e79))[_0x9387('0x44')](handleError(_0x5c9717,null));};exports['show']=function(_0x1dee1e,_0x51df89){var _0x518375={'raw':![],'where':{'id':_0x1dee1e[_0x9387('0x45')]['id']}},_0x3ee003={};_0x3ee003[_0x9387('0x32')]=_['keys'](db[_0x9387('0x2f')][_0x9387('0x46')]);_0x3ee003[_0x9387('0x33')]=_['keys'](_0x1dee1e[_0x9387('0x33')]);_0x3ee003['filters']=_[_0x9387('0x35')](_0x3ee003[_0x9387('0x32')],_0x3ee003['query']);_0x518375[_0x9387('0x36')]=_['intersection'](_0x3ee003[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1dee1e['query'][_0x9387('0x37')]));_0x518375['attributes']=_0x518375['attributes'][_0x9387('0x38')]?_0x518375[_0x9387('0x36')]:_0x3ee003[_0x9387('0x32')];if(_0x1dee1e['query'][_0x9387('0x47')]){_0x518375[_0x9387('0x48')]=[{'all':!![]}];}_0x518375=_['merge']({},_0x518375,_0x1dee1e['options']);return db[_0x9387('0x2f')][_0x9387('0x49')](_0x518375)['then'](handleEntityNotFound(_0x51df89,null))[_0x9387('0x29')](respondWithResult(_0x51df89,null))[_0x9387('0x44')](handleError(_0x51df89,null));};exports[_0x9387('0x4a')]=function(_0x1b2884,_0x5d6143){return db['FreshdeskConfiguration'][_0x9387('0x4a')](_0x1b2884[_0x9387('0x4b')],{})['then'](respondWithResult(_0x5d6143,0xc9))[_0x9387('0x44')](handleError(_0x5d6143,null));};exports[_0x9387('0x28')]=function(_0x1e88dd,_0xb8bb8e){if(_0x1e88dd['body']['id']){delete _0x1e88dd[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')]['find']({'where':{'id':_0x1e88dd[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0xb8bb8e,null))['then'](saveUpdates(_0x1e88dd[_0x9387('0x4b')],null))[_0x9387('0x29')](respondWithResult(_0xb8bb8e,null))[_0x9387('0x44')](handleError(_0xb8bb8e,null));};exports[_0x9387('0x2a')]=function(_0x1d588f,_0x1a8e15){return db[_0x9387('0x2f')][_0x9387('0x49')]({'where':{'id':_0x1d588f[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x1a8e15,null))['then'](removeEntity(_0x1a8e15,null))[_0x9387('0x44')](handleError(_0x1a8e15,null));};exports[_0x9387('0x4c')]=function(_0x692c9a,_0x25cca9,_0x3a7702){var _0x421908={};var _0x2af97f={};var _0x3d22eb;var _0x1989ad;return db[_0x9387('0x2f')]['findOne']({'where':{'id':_0x692c9a[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x25cca9,null))['then'](function(_0x192664){if(_0x192664){_0x3d22eb=_0x192664;_0x2af97f['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x2af97f['query']=_['keys'](_0x692c9a[_0x9387('0x33')]);_0x2af97f[_0x9387('0x34')]=_[_0x9387('0x35')](_0x2af97f['model'],_0x2af97f[_0x9387('0x33')]);_0x421908[_0x9387('0x36')]=_[_0x9387('0x35')](_0x2af97f[_0x9387('0x32')],qs[_0x9387('0x37')](_0x692c9a['query'][_0x9387('0x37')]));_0x421908[_0x9387('0x36')]=_0x421908[_0x9387('0x36')][_0x9387('0x38')]?_0x421908[_0x9387('0x36')]:_0x2af97f[_0x9387('0x32')];_0x421908[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x692c9a[_0x9387('0x33')][_0x9387('0x3c')]);_0x421908[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x692c9a[_0x9387('0x33')],_0x2af97f['filters']));if(_0x692c9a[_0x9387('0x33')][_0x9387('0x3e')]){_0x421908[_0x9387('0x3d')]=_['merge'](_0x421908[_0x9387('0x3d')],{'$or':_['map'](_0x421908['attributes'],function(_0x56e581){var _0x1b2449={};_0x1b2449[_0x56e581]={'$like':'%'+_0x692c9a['query'][_0x9387('0x3e')]+'%'};return _0x1b2449;})});}_0x421908=_[_0x9387('0x3f')]({},_0x421908,_0x692c9a[_0x9387('0x42')]);return _0x3d22eb['getFields'](_0x421908);}})['then'](function(_0x5e35a2){if(_0x5e35a2){_0x1989ad=_0x5e35a2[_0x9387('0x38')];if(!_0x692c9a['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x421908[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x692c9a[_0x9387('0x33')][_0x9387('0x23')]);_0x421908[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x692c9a[_0x9387('0x33')]['offset']);}return _0x3d22eb['getFields'](_0x421908);}})[_0x9387('0x29')](function(_0x3c28a2){if(_0x3c28a2){return _0x3c28a2?{'count':_0x1989ad,'rows':_0x3c28a2}:null;}})['then'](respondWithResult(_0x25cca9,null))[_0x9387('0x44')](handleError(_0x25cca9,null));};exports['getSubjects']=function(_0x5133e8,_0x24857d,_0x26461d){var _0x5e39bd={};var _0x4fde33={};var _0xf939f5;var _0x4cacc9;return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x5133e8['params']['id']}})['then'](handleEntityNotFound(_0x24857d,null))['then'](function(_0x5a372d){if(_0x5a372d){_0xf939f5=_0x5a372d;_0x4fde33['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x4fde33[_0x9387('0x33')]=_[_0x9387('0x50')](_0x5133e8['query']);_0x4fde33[_0x9387('0x34')]=_['intersection'](_0x4fde33[_0x9387('0x32')],_0x4fde33[_0x9387('0x33')]);_0x5e39bd[_0x9387('0x36')]=_[_0x9387('0x35')](_0x4fde33['model'],qs[_0x9387('0x37')](_0x5133e8[_0x9387('0x33')][_0x9387('0x37')]));_0x5e39bd[_0x9387('0x36')]=_0x5e39bd[_0x9387('0x36')][_0x9387('0x38')]?_0x5e39bd[_0x9387('0x36')]:_0x4fde33[_0x9387('0x32')];_0x5e39bd[_0x9387('0x3b')]=qs['sort'](_0x5133e8[_0x9387('0x33')][_0x9387('0x3c')]);_0x5e39bd[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x5133e8[_0x9387('0x33')],_0x4fde33[_0x9387('0x34')]));if(_0x5133e8[_0x9387('0x33')][_0x9387('0x3e')]){_0x5e39bd[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x5e39bd[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x5e39bd['attributes'],function(_0xee9c33){var _0x1c4ab0={};_0x1c4ab0[_0xee9c33]={'$like':'%'+_0x5133e8[_0x9387('0x33')]['filter']+'%'};return _0x1c4ab0;})});}_0x5e39bd=_[_0x9387('0x3f')]({},_0x5e39bd,_0x5133e8[_0x9387('0x42')]);return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})['then'](function(_0x3f6714){if(_0x3f6714){_0x4cacc9=_0x3f6714['length'];if(!_0x5133e8[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x5e39bd[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x5133e8[_0x9387('0x33')][_0x9387('0x23')]);_0x5e39bd[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x5133e8[_0x9387('0x33')][_0x9387('0x20')]);}return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})[_0x9387('0x29')](function(_0x4be591){if(_0x4be591){return _0x4be591?{'count':_0x4cacc9,'rows':_0x4be591}:null;}})['then'](respondWithResult(_0x24857d,null))[_0x9387('0x44')](handleError(_0x24857d,null));};exports[_0x9387('0x52')]=function(_0x36a140,_0x5b8034,_0x524ccd){var _0x554af6={};var _0x7d960c={};var _0x1c4b75;var _0x18e054;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x36a140[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x5b8034,null))[_0x9387('0x29')](function(_0x1d0862){if(_0x1d0862){_0x1c4b75=_0x1d0862;_0x7d960c['model']=_[_0x9387('0x50')](db[_0x9387('0x4d')]['rawAttributes']);_0x7d960c['query']=_[_0x9387('0x50')](_0x36a140['query']);_0x7d960c[_0x9387('0x34')]=_[_0x9387('0x35')](_0x7d960c[_0x9387('0x32')],_0x7d960c[_0x9387('0x33')]);_0x554af6[_0x9387('0x36')]=_['intersection'](_0x7d960c['model'],qs[_0x9387('0x37')](_0x36a140['query'][_0x9387('0x37')]));_0x554af6[_0x9387('0x36')]=_0x554af6[_0x9387('0x36')][_0x9387('0x38')]?_0x554af6[_0x9387('0x36')]:_0x7d960c[_0x9387('0x32')];_0x554af6['order']=qs[_0x9387('0x3c')](_0x36a140[_0x9387('0x33')][_0x9387('0x3c')]);_0x554af6[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x36a140[_0x9387('0x33')],_0x7d960c[_0x9387('0x34')]));if(_0x36a140[_0x9387('0x33')][_0x9387('0x3e')]){_0x554af6['where']=_[_0x9387('0x3f')](_0x554af6['where'],{'$or':_[_0x9387('0x2e')](_0x554af6[_0x9387('0x36')],function(_0x143d05){var _0x492493={};_0x492493[_0x143d05]={'$like':'%'+_0x36a140['query'][_0x9387('0x3e')]+'%'};return _0x492493;})});}_0x554af6=_[_0x9387('0x3f')]({},_0x554af6,_0x36a140[_0x9387('0x42')]);return _0x1c4b75[_0x9387('0x52')](_0x554af6);}})['then'](function(_0x3f84ae){if(_0x3f84ae){_0x18e054=_0x3f84ae['length'];if(!_0x36a140['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x554af6['limit']=qs[_0x9387('0x23')](_0x36a140[_0x9387('0x33')][_0x9387('0x23')]);_0x554af6['offset']=qs['offset'](_0x36a140[_0x9387('0x33')][_0x9387('0x20')]);}return _0x1c4b75['getDescriptions'](_0x554af6);}})[_0x9387('0x29')](function(_0x46d6fa){if(_0x46d6fa){return _0x46d6fa?{'count':_0x18e054,'rows':_0x46d6fa}:null;}})[_0x9387('0x29')](respondWithResult(_0x5b8034,null))[_0x9387('0x44')](handleError(_0x5b8034,null));};exports[_0x9387('0x53')]=function(_0x1ad604,_0x2c4a08,_0x37c0b4){var _0x2ec217={};var _0x44f9fb={};var _0x444411;var _0x1ad963;return db['FreshdeskConfiguration'][_0x9387('0x4f')]({'where':{'id':_0x1ad604[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c4a08,null))[_0x9387('0x29')](function(_0x5ed394){if(_0x5ed394){_0x444411=_0x5ed394;_0x44f9fb[_0x9387('0x32')]=_['keys'](db[_0x9387('0x54')][_0x9387('0x46')]);_0x44f9fb[_0x9387('0x33')]=_['keys'](_0x1ad604[_0x9387('0x33')]);_0x44f9fb[_0x9387('0x34')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],_0x44f9fb[_0x9387('0x33')]);_0x2ec217[_0x9387('0x36')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1ad604['query'][_0x9387('0x37')]));_0x2ec217[_0x9387('0x36')]=_0x2ec217[_0x9387('0x36')][_0x9387('0x38')]?_0x2ec217[_0x9387('0x36')]:_0x44f9fb[_0x9387('0x32')];_0x2ec217['order']=qs[_0x9387('0x3c')](_0x1ad604[_0x9387('0x33')]['sort']);_0x2ec217[_0x9387('0x3d')]=qs['filters'](_[_0x9387('0x4e')](_0x1ad604['query'],_0x44f9fb['filters']));if(_0x1ad604['query'][_0x9387('0x3e')]){_0x2ec217['where']=_[_0x9387('0x3f')](_0x2ec217[_0x9387('0x3d')],{'$or':_['map'](_0x2ec217[_0x9387('0x36')],function(_0x3222eb){var _0x5298df={};_0x5298df[_0x3222eb]={'$like':'%'+_0x1ad604[_0x9387('0x33')]['filter']+'%'};return _0x5298df;})});}_0x2ec217=_[_0x9387('0x3f')]({},_0x2ec217,_0x1ad604[_0x9387('0x42')]);return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x4727e7){if(_0x4727e7){_0x1ad963=_0x4727e7[_0x9387('0x38')];if(!_0x1ad604['query'][_0x9387('0x39')](_0x9387('0x3a'))){_0x2ec217[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x1ad604[_0x9387('0x33')][_0x9387('0x23')]);_0x2ec217[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x1ad604[_0x9387('0x33')][_0x9387('0x20')]);}return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x47cf30){if(_0x47cf30){return _0x47cf30?{'count':_0x1ad963,'rows':_0x47cf30}:null;}})[_0x9387('0x29')](respondWithResult(_0x2c4a08,null))[_0x9387('0x44')](handleError(_0x2c4a08,null));};exports[_0x9387('0x55')]=function(_0x554786,_0x209f69,_0x1eaaf3){if(_0x554786['body']['id']){delete _0x554786[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x554786[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x209f69,null))[_0x9387('0x29')](function(_0xe7ecea){if(_0xe7ecea){return _0xe7ecea[_0x9387('0x55')](_0x554786[_0x9387('0x4b')][_0x9387('0x56')]||[]);}return null;})[_0x9387('0x29')](respondWithResult(_0x209f69,null))[_0x9387('0x44')](handleError(_0x209f69,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4997560..f0f0238 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 _0x1df1=['request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','bluebird'];(function(_0xef9edb,_0x406d7b){var _0x3583e3=function(_0x438197){while(--_0x438197){_0xef9edb['push'](_0xef9edb['shift']());}};_0x3583e3(++_0x406d7b);}(_0x1df1,0xab));var _0x11df=function(_0x16c490,_0xc0fe83){_0x16c490=_0x16c490-0x0;var _0x26073c=_0x1df1[_0x16c490];return _0x26073c;};'use strict';var _=require(_0x11df('0x0'));var util=require(_0x11df('0x1'));var logger=require(_0x11df('0x2'))(_0x11df('0x3'));var moment=require('moment');var BPromise=require(_0x11df('0x4'));var rp=require(_0x11df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x11df('0x6'));var config=require('../../config/environment');var attributes=require(_0x11df('0x7'));module[_0x11df('0x8')]=function(_0x1f7a68,_0xe4a480){return _0x1f7a68[_0x11df('0x9')](_0x11df('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb4b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x358769,_0x400363){var _0x20dce3=function(_0x25f238){while(--_0x25f238){_0x358769['push'](_0x358769['shift']());}};_0x20dce3(++_0x400363);}(_0xfb4b,0x1ac));var _0xbfb4=function(_0xab10a1,_0x2e5f39){_0xab10a1=_0xab10a1-0x0;var _0xf410d6=_0xfb4b[_0xab10a1];return _0xf410d6;};'use strict';var _=require(_0xbfb4('0x0'));var util=require(_0xbfb4('0x1'));var logger=require(_0xbfb4('0x2'))(_0xbfb4('0x3'));var moment=require(_0xbfb4('0x4'));var BPromise=require(_0xbfb4('0x5'));var rp=require(_0xbfb4('0x6'));var fs=require('fs');var path=require(_0xbfb4('0x7'));var rimraf=require('rimraf');var config=require(_0xbfb4('0x8'));var attributes=require(_0xbfb4('0x9'));module[_0xbfb4('0xa')]=function(_0xdcc1ad,_0x10ecb4){return _0xdcc1ad['define'](_0xbfb4('0xb'),attributes,{'tableName':_0xbfb4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 108d9d2..a5877b2 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 _0x179e=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x41ffd2,_0x5de2e3){var _0x218d26=function(_0x444661){while(--_0x444661){_0x41ffd2['push'](_0x41ffd2['shift']());}};_0x218d26(++_0x5de2e3);}(_0x179e,0x150));var _0xe179=function(_0x41453c,_0x241b3d){_0x41453c=_0x41453c-0x0;var _0x39f9d5=_0x179e[_0x41453c];return _0x39f9d5;};'use strict';var _=require('lodash');var util=require(_0xe179('0x0'));var moment=require('moment');var BPromise=require(_0xe179('0x1'));var rs=require(_0xe179('0x2'));var fs=require('fs');var Redis=require(_0xe179('0x3'));var db=require(_0xe179('0x4'))['db'];var utils=require(_0xe179('0x5'));var logger=require(_0xe179('0x6'))('rpc');var config=require(_0xe179('0x7'));var jayson=require(_0xe179('0x8'));var client=jayson[_0xe179('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f10b8,_0x4c8b33,_0x26ca90){return new BPromise(function(_0x393225,_0x53c1d5){return client[_0xe179('0xa')](_0x2f10b8,_0x26ca90)[_0xe179('0xb')](function(_0x903562){logger['info'](_0xe179('0xc'),_0x4c8b33,_0xe179('0xd'));logger[_0xe179('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4c8b33,_0xe179('0xd'),JSON[_0xe179('0xf')](_0x903562));if(_0x903562[_0xe179('0x10')]){if(_0x903562[_0xe179('0x10')]['code']===0x1f4){logger[_0xe179('0x10')](_0xe179('0xc'),_0x4c8b33,_0x903562[_0xe179('0x10')][_0xe179('0x11')]);return _0x53c1d5(_0x903562[_0xe179('0x10')][_0xe179('0x11')]);}logger[_0xe179('0x10')](_0xe179('0xc'),_0x4c8b33,_0x903562[_0xe179('0x10')][_0xe179('0x11')]);return _0x393225(_0x903562['error'][_0xe179('0x11')]);}else{logger[_0xe179('0x12')](_0xe179('0xc'),_0x4c8b33,_0xe179('0xd'));_0x393225(_0x903562['result']['message']);}})[_0xe179('0x13')](function(_0x3459a7){logger[_0xe179('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c8b33,_0x3459a7);_0x53c1d5(_0x3459a7);});});} \ No newline at end of file +var _0x5d96=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x38cbbf,_0x5da053){var _0x208b6a=function(_0x1cb977){while(--_0x1cb977){_0x38cbbf['push'](_0x38cbbf['shift']());}};_0x208b6a(++_0x5da053);}(_0x5d96,0xa6));var _0x65d9=function(_0x421752,_0x20f492){_0x421752=_0x421752-0x0;var _0x23ed3e=_0x5d96[_0x421752];return _0x23ed3e;};'use strict';var _=require(_0x65d9('0x0'));var util=require(_0x65d9('0x1'));var moment=require(_0x65d9('0x2'));var BPromise=require(_0x65d9('0x3'));var rs=require(_0x65d9('0x4'));var fs=require('fs');var Redis=require(_0x65d9('0x5'));var db=require(_0x65d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x65d9('0x7'))(_0x65d9('0x8'));var config=require(_0x65d9('0x9'));var jayson=require(_0x65d9('0xa'));var client=jayson[_0x65d9('0xb')][_0x65d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40ebe1,_0x3c6aab,_0x335736){return new BPromise(function(_0x39d32d,_0x315af5){return client[_0x65d9('0xd')](_0x40ebe1,_0x335736)[_0x65d9('0xe')](function(_0x182e42){logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x3c6aab,'request\x20sent');logger[_0x65d9('0x11')](_0x65d9('0x12'),_0x3c6aab,_0x65d9('0x13'),JSON[_0x65d9('0x14')](_0x182e42));if(_0x182e42[_0x65d9('0x15')]){if(_0x182e42[_0x65d9('0x15')]['code']===0x1f4){logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x182e42[_0x65d9('0x15')][_0x65d9('0x16')]);return _0x315af5(_0x182e42['error']['message']);}logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x182e42['error'][_0x65d9('0x16')]);return _0x39d32d(_0x182e42[_0x65d9('0x15')][_0x65d9('0x16')]);}else{logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x3c6aab,_0x65d9('0x13'));_0x39d32d(_0x182e42[_0x65d9('0x17')]['message']);}})['catch'](function(_0x265b7d){logger[_0x65d9('0x15')](_0x65d9('0x10'),_0x3c6aab,_0x265b7d);_0x315af5(_0x265b7d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b365572..8097575 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 _0xea40=['multer','util','path','express','fs-extra','../../components/interaction/service','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports'];(function(_0x19a102,_0x156131){var _0x51b0de=function(_0x2f1162){while(--_0x2f1162){_0x19a102['push'](_0x19a102['shift']());}};_0x51b0de(++_0x156131);}(_0xea40,0x120));var _0x0ea4=function(_0x136492,_0x701cf4){_0x136492=_0x136492-0x0;var _0x1f0083=_0xea40[_0x136492];return _0x1f0083;};'use strict';var multer=require(_0x0ea4('0x0'));var util=require(_0x0ea4('0x1'));var path=require(_0x0ea4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ea4('0x3'));var router=express['Router']();var fs_extra=require(_0x0ea4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ea4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0ea4('0x6')]);router[_0x0ea4('0x7')](_0x0ea4('0x8'),auth[_0x0ea4('0x9')](),controller['show']);router[_0x0ea4('0xa')]('/',auth[_0x0ea4('0x9')](),controller[_0x0ea4('0xb')]);router[_0x0ea4('0xc')]('/:id',auth[_0x0ea4('0x9')](),controller['update']);router[_0x0ea4('0xd')](_0x0ea4('0x8'),auth[_0x0ea4('0x9')](),controller[_0x0ea4('0xe')]);module[_0x0ea4('0xf')]=router; \ No newline at end of file +var _0x9c4f=['/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x54691e,_0x28b041){var _0x5520b2=function(_0x501a05){while(--_0x501a05){_0x54691e['push'](_0x54691e['shift']());}};_0x5520b2(++_0x28b041);}(_0x9c4f,0x168));var _0xf9c4=function(_0x1e2057,_0x5076ec){_0x1e2057=_0x1e2057-0x0;var _0x2ec031=_0x9c4f[_0x1e2057];return _0x2ec031;};'use strict';var multer=require(_0xf9c4('0x0'));var util=require(_0xf9c4('0x1'));var path=require('path');var timeout=require(_0xf9c4('0x2'));var express=require(_0xf9c4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf9c4('0x4'));var interaction=require(_0xf9c4('0x5'));var config=require(_0xf9c4('0x6'));var controller=require(_0xf9c4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf9c4('0x8'),auth['isAuthenticated'](),controller[_0xf9c4('0x9')]);router[_0xf9c4('0xa')]('/',auth[_0xf9c4('0xb')](),controller[_0xf9c4('0xc')]);router['put'](_0xf9c4('0x8'),auth['isAuthenticated'](),controller[_0xf9c4('0xd')]);router[_0xf9c4('0xe')](_0xf9c4('0x8'),auth[_0xf9c4('0xb')](),controller[_0xf9c4('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a6ba5c9..30ba17e 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 _0x2da8=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x47d045,_0x3f7d68){var _0x45956f=function(_0x18ed2b){while(--_0x18ed2b){_0x47d045['push'](_0x47d045['shift']());}};_0x45956f(++_0x3f7d68);}(_0x2da8,0x1d1));var _0x82da=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2da8[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x82da('0x0'));module[_0x82da('0x1')]={'type':{'type':Sequelize['ENUM'](_0x82da('0x2'),_0x82da('0x3'),_0x82da('0x4'),_0x82da('0x5'),_0x82da('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x82da('0x7')]},'key':{'type':Sequelize[_0x82da('0x7')]},'keyType':{'type':Sequelize[_0x82da('0x8')](_0x82da('0x2'),_0x82da('0x3'),_0x82da('0x4'))},'keyContent':{'type':Sequelize[_0x82da('0x7')]},'idField':{'type':Sequelize[_0x82da('0x7')]},'nameField':{'type':Sequelize[_0x82da('0x7')]},'customField':{'type':Sequelize[_0x82da('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x82da('0x7')]}}; \ No newline at end of file +var _0x62d5=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x62d5,0x123));var _0x562d=function(_0xd6f5eb,_0x15ac61){_0xd6f5eb=_0xd6f5eb-0x0;var _0x572c12=_0x62d5[_0xd6f5eb];return _0x572c12;};'use strict';var Sequelize=require(_0x562d('0x0'));module[_0x562d('0x1')]={'type':{'type':Sequelize[_0x562d('0x2')](_0x562d('0x3'),'variable',_0x562d('0x4'),_0x562d('0x5'),'picklist'),'defaultValue':_0x562d('0x3')},'content':{'type':Sequelize[_0x562d('0x6')]},'key':{'type':Sequelize[_0x562d('0x6')]},'keyType':{'type':Sequelize[_0x562d('0x2')](_0x562d('0x3'),_0x562d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x562d('0x6')]},'idField':{'type':Sequelize[_0x562d('0x6')]},'nameField':{'type':Sequelize[_0x562d('0x6')]},'customField':{'type':Sequelize[_0x562d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x562d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1af9933..efaeacd 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 _0x9d9b=['reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply'];(function(_0x2cfc2c,_0xd2c1f0){var _0x6a88f7=function(_0x56cf10){while(--_0x56cf10){_0x2cfc2c['push'](_0x2cfc2c['shift']());}};_0x6a88f7(++_0xd2c1f0);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x17e1c7,_0x161821){_0x17e1c7=_0x17e1c7-0x0;var _0x38f0b1=_0x9d9b[_0x17e1c7];return _0x38f0b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9d9('0x0'));var zipdir=require(_0xb9d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9d9('0x2'));var moment=require('moment');var BPromise=require(_0xb9d9('0x3'));var Mustache=require(_0xb9d9('0x4'));var util=require(_0xb9d9('0x5'));var path=require('path');var sox=require(_0xb9d9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9d9('0x7'));var fs=require('fs');var fs_extra=require(_0xb9d9('0x8'));var _=require('lodash');var squel=require(_0xb9d9('0x9'));var crypto=require(_0xb9d9('0xa'));var jsforce=require(_0xb9d9('0xb'));var deskjs=require(_0xb9d9('0xc'));var toCsv=require(_0xb9d9('0xd'));var querystring=require(_0xb9d9('0xe'));var Papa=require(_0xb9d9('0xf'));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(_0xb9d9('0x10'));var logger=require(_0xb9d9('0x11'))(_0xb9d9('0x12'));var utils=require('../../config/utils');var config=require(_0xb9d9('0x13'));var licenseUtil=require(_0xb9d9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc03d,_0x5e3782){_0x5e3782=_0x5e3782||0xcc;return function(_0x1245e0){if(_0x1245e0){return _0x3cc03d[_0xb9d9('0x15')](_0x5e3782);}return _0x3cc03d[_0xb9d9('0x16')](_0x5e3782)[_0xb9d9('0x17')]();};}function respondWithResult(_0x26ef71,_0x1d26cf){_0x1d26cf=_0x1d26cf||0xc8;return function(_0x4f0c77){if(_0x4f0c77){return _0x26ef71[_0xb9d9('0x16')](_0x1d26cf)['json'](_0x4f0c77);}};}function respondWithFilteredResult(_0x4c8864,_0x3db648){return function(_0x2c9039){if(_0x2c9039){var _0x3909ab=typeof _0x3db648[_0xb9d9('0x18')]==='undefined'&&typeof _0x3db648['limit']===_0xb9d9('0x19');var _0x5617f1=_0x2c9039['count'];var _0x2b5e26=_0x3909ab?0x0:_0x3db648[_0xb9d9('0x18')];var _0x1e775d=_0x3909ab?_0x2c9039['count']:_0x3db648[_0xb9d9('0x18')]+_0x3db648[_0xb9d9('0x1a')];var _0x493552;if(_0x1e775d>=_0x5617f1){_0x1e775d=_0x5617f1;_0x493552=0xc8;}else{_0x493552=0xce;}_0x4c8864[_0xb9d9('0x16')](_0x493552);return _0x4c8864[_0xb9d9('0x1b')]('Content-Range',_0x2b5e26+'-'+_0x1e775d+'/'+_0x5617f1)[_0xb9d9('0x1c')](_0x2c9039);}return null;};}function patchUpdates(_0x36d55e){return function(_0x50f0ec){try{jsonpatch[_0xb9d9('0x1d')](_0x50f0ec,_0x36d55e,!![]);}catch(_0x42ca87){return BPromise[_0xb9d9('0x1e')](_0x42ca87);}return _0x50f0ec[_0xb9d9('0x1f')]();};}function saveUpdates(_0x288ccd,_0x362104){return function(_0x4c4230){if(_0x4c4230){return _0x4c4230[_0xb9d9('0x20')](_0x288ccd)[_0xb9d9('0x21')](function(_0x53c82a){return _0x53c82a;});}return null;};}function removeEntity(_0x45520b,_0x3d61bf){return function(_0x43bcab){if(_0x43bcab){return _0x43bcab[_0xb9d9('0x22')]()['then'](function(){_0x45520b[_0xb9d9('0x16')](0xcc)[_0xb9d9('0x17')]();});}};}function handleEntityNotFound(_0x6fa6af,_0x436cb7){return function(_0x2650f7){if(!_0x2650f7){_0x6fa6af[_0xb9d9('0x15')](0x194);}return _0x2650f7;};}function handleError(_0x56b394,_0x321937){_0x321937=_0x321937||0x1f4;return function(_0x42181d){logger[_0xb9d9('0x23')](_0x42181d['stack']);if(_0x42181d[_0xb9d9('0x24')]){delete _0x42181d[_0xb9d9('0x24')];}_0x56b394[_0xb9d9('0x16')](_0x321937)[_0xb9d9('0x25')](_0x42181d);};}exports[_0xb9d9('0x26')]=function(_0x402968,_0x89f901){var _0x5c74eb={},_0x39f006={},_0x3e79ef={'count':0x0,'rows':[]};var _0xdf519a=_[_0xb9d9('0x27')](db[_0xb9d9('0x28')][_0xb9d9('0x29')],function(_0x5dbb27){return{'name':_0x5dbb27[_0xb9d9('0x2a')],'type':_0x5dbb27[_0xb9d9('0x2b')][_0xb9d9('0x2c')]};});_0x39f006[_0xb9d9('0x2d')]=_['map'](_0xdf519a,_0xb9d9('0x24'));_0x39f006[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x402968[_0xb9d9('0x2e')]);_0x39f006[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0x39f006['model'],_0x39f006['query']);_0x5c74eb[_0xb9d9('0x32')]=_['intersection'](_0x39f006[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x402968[_0xb9d9('0x2e')]['fields']));_0x5c74eb[_0xb9d9('0x32')]=_0x5c74eb[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x5c74eb[_0xb9d9('0x32')]:_0x39f006[_0xb9d9('0x2d')];if(!_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x35')](_0xb9d9('0x36'))){_0x5c74eb[_0xb9d9('0x1a')]=qs['limit'](_0x402968['query']['limit']);_0x5c74eb[_0xb9d9('0x18')]=qs[_0xb9d9('0x18')](_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x18')]);}_0x5c74eb[_0xb9d9('0x37')]=qs[_0xb9d9('0x38')](_0x402968['query']['sort']);_0x5c74eb['where']=qs[_0xb9d9('0x30')](_[_0xb9d9('0x39')](_0x402968[_0xb9d9('0x2e')],_0x39f006[_0xb9d9('0x30')]),_0xdf519a);if(_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]){_0x5c74eb[_0xb9d9('0x3b')]=_[_0xb9d9('0x3c')](_0x5c74eb[_0xb9d9('0x3b')],{'$or':_[_0xb9d9('0x27')](_0xdf519a,function(_0xd8b9a2){if(_0xd8b9a2[_0xb9d9('0x2b')]!==_0xb9d9('0x3d')){var _0x46d9a7={};_0x46d9a7[_0xd8b9a2[_0xb9d9('0x24')]]={'$like':'%'+_0x402968[_0xb9d9('0x2e')][_0xb9d9('0x3a')]+'%'};return _0x46d9a7;}})});}_0x5c74eb=_[_0xb9d9('0x3c')]({},_0x5c74eb,_0x402968[_0xb9d9('0x3e')]);var _0x4d3cea={'where':_0x5c74eb[_0xb9d9('0x3b')]};return db[_0xb9d9('0x28')]['count'](_0x4d3cea)['then'](function(_0x41cf93){_0x3e79ef['count']=_0x41cf93;if(_0x402968[_0xb9d9('0x2e')]['includeAll']){_0x5c74eb['include']=[{'all':!![]}];}return db[_0xb9d9('0x28')][_0xb9d9('0x3f')](_0x5c74eb);})[_0xb9d9('0x21')](function(_0x2acfe8){_0x3e79ef[_0xb9d9('0x40')]=_0x2acfe8;return _0x3e79ef;})[_0xb9d9('0x21')](respondWithFilteredResult(_0x89f901,_0x5c74eb))[_0xb9d9('0x41')](handleError(_0x89f901,null));};exports[_0xb9d9('0x42')]=function(_0x596cd8,_0x55007a){var _0x3f4b76={'raw':!![],'where':{'id':_0x596cd8[_0xb9d9('0x43')]['id']}},_0xb7c4ec={};_0xb7c4ec['model']=_[_0xb9d9('0x2f')](db[_0xb9d9('0x28')][_0xb9d9('0x29')]);_0xb7c4ec[_0xb9d9('0x2e')]=_[_0xb9d9('0x2f')](_0x596cd8[_0xb9d9('0x2e')]);_0xb7c4ec[_0xb9d9('0x30')]=_[_0xb9d9('0x31')](_0xb7c4ec['model'],_0xb7c4ec[_0xb9d9('0x2e')]);_0x3f4b76[_0xb9d9('0x32')]=_[_0xb9d9('0x31')](_0xb7c4ec[_0xb9d9('0x2d')],qs[_0xb9d9('0x33')](_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x33')]));_0x3f4b76[_0xb9d9('0x32')]=_0x3f4b76[_0xb9d9('0x32')][_0xb9d9('0x34')]?_0x3f4b76[_0xb9d9('0x32')]:_0xb7c4ec[_0xb9d9('0x2d')];if(_0x596cd8[_0xb9d9('0x2e')][_0xb9d9('0x44')]){_0x3f4b76[_0xb9d9('0x45')]=[{'all':!![]}];}_0x3f4b76=_[_0xb9d9('0x3c')]({},_0x3f4b76,_0x596cd8[_0xb9d9('0x3e')]);return db['FreshdeskField'][_0xb9d9('0x46')](_0x3f4b76)[_0xb9d9('0x21')](handleEntityNotFound(_0x55007a,null))['then'](respondWithResult(_0x55007a,null))[_0xb9d9('0x41')](handleError(_0x55007a,null));};exports[_0xb9d9('0x47')]=function(_0x1a4922,_0xa6ce10){return db[_0xb9d9('0x28')][_0xb9d9('0x47')](_0x1a4922['body'],{})[_0xb9d9('0x21')](respondWithResult(_0xa6ce10,0xc9))[_0xb9d9('0x41')](handleError(_0xa6ce10,null));};exports[_0xb9d9('0x20')]=function(_0x30e3b1,_0x53f7cb){if(_0x30e3b1[_0xb9d9('0x48')]['id']){delete _0x30e3b1[_0xb9d9('0x48')]['id'];}return db[_0xb9d9('0x28')]['find']({'where':{'id':_0x30e3b1[_0xb9d9('0x43')]['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x53f7cb,null))[_0xb9d9('0x21')](saveUpdates(_0x30e3b1[_0xb9d9('0x48')],null))[_0xb9d9('0x21')](respondWithResult(_0x53f7cb,null))[_0xb9d9('0x41')](handleError(_0x53f7cb,null));};exports['destroy']=function(_0xd417b9,_0x5cf9a0){return db[_0xb9d9('0x28')][_0xb9d9('0x46')]({'where':{'id':_0xd417b9['params']['id']}})[_0xb9d9('0x21')](handleEntityNotFound(_0x5cf9a0,null))['then'](removeEntity(_0x5cf9a0,null))['catch'](handleError(_0x5cf9a0,null));}; \ No newline at end of file +var _0x777d=['send','index','map','FreshdeskField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','limit','sort','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','update','then','destroy','error','name'];(function(_0x58dec1,_0x548ada){var _0x141df6=function(_0x5072e1){while(--_0x5072e1){_0x58dec1['push'](_0x58dec1['shift']());}};_0x141df6(++_0x548ada);}(_0x777d,0xe9));var _0xd777=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x777d[_0x1d1963];return _0x3f58bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd777('0x0'));var zipdir=require(_0xd777('0x1'));var jsonpatch=require(_0xd777('0x2'));var rp=require('request-promise');var moment=require(_0xd777('0x3'));var BPromise=require(_0xd777('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd777('0x5'));var csv=require('to-csv');var ejs=require(_0xd777('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd777('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd777('0x8'));var toCsv=require(_0xd777('0x9'));var querystring=require(_0xd777('0xa'));var Papa=require(_0xd777('0xb'));var Redis=require(_0xd777('0xc'));var authService=require(_0xd777('0xd'));var qs=require(_0xd777('0xe'));var as=require(_0xd777('0xf'));var hardwareService=require(_0xd777('0x10'));var logger=require(_0xd777('0x11'))(_0xd777('0x12'));var utils=require(_0xd777('0x13'));var config=require(_0xd777('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25f574,_0x560778){_0x560778=_0x560778||0xcc;return function(_0x2cc3e7){if(_0x2cc3e7){return _0x25f574[_0xd777('0x15')](_0x560778);}return _0x25f574[_0xd777('0x16')](_0x560778)[_0xd777('0x17')]();};}function respondWithResult(_0x2ac82f,_0x5d0ded){_0x5d0ded=_0x5d0ded||0xc8;return function(_0x84141c){if(_0x84141c){return _0x2ac82f['status'](_0x5d0ded)[_0xd777('0x18')](_0x84141c);}};}function respondWithFilteredResult(_0x2cd014,_0x1e5ecb){return function(_0x1ef016){if(_0x1ef016){var _0x25e3f2=typeof _0x1e5ecb['offset']===_0xd777('0x19')&&typeof _0x1e5ecb['limit']===_0xd777('0x19');var _0x4dcaed=_0x1ef016[_0xd777('0x1a')];var _0x386f1a=_0x25e3f2?0x0:_0x1e5ecb[_0xd777('0x1b')];var _0x13b63b=_0x25e3f2?_0x1ef016[_0xd777('0x1a')]:_0x1e5ecb[_0xd777('0x1b')]+_0x1e5ecb['limit'];var _0x4d6100;if(_0x13b63b>=_0x4dcaed){_0x13b63b=_0x4dcaed;_0x4d6100=0xc8;}else{_0x4d6100=0xce;}_0x2cd014[_0xd777('0x16')](_0x4d6100);return _0x2cd014['set'](_0xd777('0x1c'),_0x386f1a+'-'+_0x13b63b+'/'+_0x4dcaed)['json'](_0x1ef016);}return null;};}function patchUpdates(_0x58a079){return function(_0x5b2204){try{jsonpatch[_0xd777('0x1d')](_0x5b2204,_0x58a079,!![]);}catch(_0x4e53ed){return BPromise['reject'](_0x4e53ed);}return _0x5b2204['save']();};}function saveUpdates(_0x48d18c,_0x55b975){return function(_0x8cfb5a){if(_0x8cfb5a){return _0x8cfb5a[_0xd777('0x1e')](_0x48d18c)[_0xd777('0x1f')](function(_0x343405){return _0x343405;});}return null;};}function removeEntity(_0xfebc2f,_0x33c3d4){return function(_0x2ff8d3){if(_0x2ff8d3){return _0x2ff8d3[_0xd777('0x20')]()[_0xd777('0x1f')](function(){_0xfebc2f[_0xd777('0x16')](0xcc)[_0xd777('0x17')]();});}};}function handleEntityNotFound(_0x56af61,_0x373646){return function(_0x63e5c1){if(!_0x63e5c1){_0x56af61[_0xd777('0x15')](0x194);}return _0x63e5c1;};}function handleError(_0x15f1fd,_0x184ff6){_0x184ff6=_0x184ff6||0x1f4;return function(_0x5e32de){logger[_0xd777('0x21')](_0x5e32de['stack']);if(_0x5e32de['name']){delete _0x5e32de[_0xd777('0x22')];}_0x15f1fd[_0xd777('0x16')](_0x184ff6)[_0xd777('0x23')](_0x5e32de);};}exports[_0xd777('0x24')]=function(_0x4c941c,_0x453b45){var _0x141baa={},_0x4f93eb={},_0x1975e2={'count':0x0,'rows':[]};var _0xb63cf7=_[_0xd777('0x25')](db[_0xd777('0x26')][_0xd777('0x27')],function(_0x508587){return{'name':_0x508587[_0xd777('0x28')],'type':_0x508587['type']['key']};});_0x4f93eb[_0xd777('0x29')]=_[_0xd777('0x25')](_0xb63cf7,_0xd777('0x22'));_0x4f93eb[_0xd777('0x2a')]=_['keys'](_0x4c941c['query']);_0x4f93eb[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x4f93eb[_0xd777('0x29')],_0x4f93eb[_0xd777('0x2a')]);_0x141baa[_0xd777('0x2d')]=_[_0xd777('0x2c')](_0x4f93eb['model'],qs['fields'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x2e')]));_0x141baa[_0xd777('0x2d')]=_0x141baa[_0xd777('0x2d')][_0xd777('0x2f')]?_0x141baa[_0xd777('0x2d')]:_0x4f93eb[_0xd777('0x29')];if(!_0x4c941c[_0xd777('0x2a')]['hasOwnProperty']('nolimit')){_0x141baa[_0xd777('0x30')]=qs['limit'](_0x4c941c[_0xd777('0x2a')][_0xd777('0x30')]);_0x141baa[_0xd777('0x1b')]=qs[_0xd777('0x1b')](_0x4c941c['query'][_0xd777('0x1b')]);}_0x141baa['order']=qs[_0xd777('0x31')](_0x4c941c['query']['sort']);_0x141baa['where']=qs['filters'](_[_0xd777('0x32')](_0x4c941c[_0xd777('0x2a')],_0x4f93eb[_0xd777('0x2b')]),_0xb63cf7);if(_0x4c941c['query']['filter']){_0x141baa['where']=_[_0xd777('0x33')](_0x141baa[_0xd777('0x34')],{'$or':_[_0xd777('0x25')](_0xb63cf7,function(_0x471bfd){if(_0x471bfd[_0xd777('0x35')]!==_0xd777('0x36')){var _0xf496bb={};_0xf496bb[_0x471bfd[_0xd777('0x22')]]={'$like':'%'+_0x4c941c[_0xd777('0x2a')][_0xd777('0x37')]+'%'};return _0xf496bb;}})});}_0x141baa=_['merge']({},_0x141baa,_0x4c941c[_0xd777('0x38')]);var _0x11a5f7={'where':_0x141baa[_0xd777('0x34')]};return db[_0xd777('0x26')][_0xd777('0x1a')](_0x11a5f7)[_0xd777('0x1f')](function(_0x3356c2){_0x1975e2[_0xd777('0x1a')]=_0x3356c2;if(_0x4c941c[_0xd777('0x2a')][_0xd777('0x39')]){_0x141baa[_0xd777('0x3a')]=[{'all':!![]}];}return db[_0xd777('0x26')]['findAll'](_0x141baa);})[_0xd777('0x1f')](function(_0x52b3d0){_0x1975e2[_0xd777('0x3b')]=_0x52b3d0;return _0x1975e2;})[_0xd777('0x1f')](respondWithFilteredResult(_0x453b45,_0x141baa))[_0xd777('0x3c')](handleError(_0x453b45,null));};exports[_0xd777('0x3d')]=function(_0x149329,_0x11d654){var _0x4af057={'raw':!![],'where':{'id':_0x149329[_0xd777('0x3e')]['id']}},_0x3dd8af={};_0x3dd8af[_0xd777('0x29')]=_['keys'](db[_0xd777('0x26')][_0xd777('0x27')]);_0x3dd8af[_0xd777('0x2a')]=_[_0xd777('0x3f')](_0x149329[_0xd777('0x2a')]);_0x3dd8af[_0xd777('0x2b')]=_[_0xd777('0x2c')](_0x3dd8af['model'],_0x3dd8af[_0xd777('0x2a')]);_0x4af057[_0xd777('0x2d')]=_['intersection'](_0x3dd8af['model'],qs[_0xd777('0x2e')](_0x149329[_0xd777('0x2a')][_0xd777('0x2e')]));_0x4af057[_0xd777('0x2d')]=_0x4af057[_0xd777('0x2d')][_0xd777('0x2f')]?_0x4af057[_0xd777('0x2d')]:_0x3dd8af[_0xd777('0x29')];if(_0x149329[_0xd777('0x2a')][_0xd777('0x39')]){_0x4af057[_0xd777('0x3a')]=[{'all':!![]}];}_0x4af057=_['merge']({},_0x4af057,_0x149329[_0xd777('0x38')]);return db[_0xd777('0x26')][_0xd777('0x40')](_0x4af057)['then'](handleEntityNotFound(_0x11d654,null))['then'](respondWithResult(_0x11d654,null))[_0xd777('0x3c')](handleError(_0x11d654,null));};exports[_0xd777('0x41')]=function(_0x26d5d7,_0x281d1d){return db[_0xd777('0x26')][_0xd777('0x41')](_0x26d5d7[_0xd777('0x42')],{})[_0xd777('0x1f')](respondWithResult(_0x281d1d,0xc9))['catch'](handleError(_0x281d1d,null));};exports[_0xd777('0x1e')]=function(_0x559232,_0x4c059d){if(_0x559232[_0xd777('0x42')]['id']){delete _0x559232[_0xd777('0x42')]['id'];}return db['FreshdeskField'][_0xd777('0x40')]({'where':{'id':_0x559232[_0xd777('0x3e')]['id']}})[_0xd777('0x1f')](handleEntityNotFound(_0x4c059d,null))[_0xd777('0x1f')](saveUpdates(_0x559232['body'],null))['then'](respondWithResult(_0x4c059d,null))[_0xd777('0x3c')](handleError(_0x4c059d,null));};exports['destroy']=function(_0x45b806,_0x24779c){return db[_0xd777('0x26')][_0xd777('0x40')]({'where':{'id':_0x45b806[_0xd777('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24779c,null))[_0xd777('0x1f')](removeEntity(_0x24779c,null))[_0xd777('0x3c')](handleError(_0x24779c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 929ae84..7260443 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 _0xed5a=['freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','int_freshdesk_fields'];(function(_0x892cd6,_0xcee19a){var _0xa55951=function(_0x31aaf2){while(--_0x31aaf2){_0x892cd6['push'](_0x892cd6['shift']());}};_0xa55951(++_0xcee19a);}(_0xed5a,0xb6));var _0xaed5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xed5a[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xaed5('0x0'));var util=require(_0xaed5('0x1'));var logger=require(_0xaed5('0x2'))(_0xaed5('0x3'));var moment=require(_0xaed5('0x4'));var BPromise=require(_0xaed5('0x5'));var rp=require(_0xaed5('0x6'));var fs=require('fs');var path=require(_0xaed5('0x7'));var rimraf=require(_0xaed5('0x8'));var config=require(_0xaed5('0x9'));var attributes=require(_0xaed5('0xa'));module[_0xaed5('0xb')]=function(_0x5a0173,_0x3902c8){return _0x5a0173['define']('FreshdeskField',attributes,{'tableName':_0xaed5('0xc'),'paranoid':![],'indexes':[{'name':_0xaed5('0xd'),'fields':[_0xaed5('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e94=['freshdesk_unique_index','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields'];(function(_0x533a41,_0x53afd0){var _0xfec6b9=function(_0x427352){while(--_0x427352){_0x533a41['push'](_0x533a41['shift']());}};_0xfec6b9(++_0x53afd0);}(_0x0e94,0x8e));var _0x40e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0e94[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x40e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40e9('0x1'));var moment=require(_0x40e9('0x2'));var BPromise=require(_0x40e9('0x3'));var rp=require(_0x40e9('0x4'));var fs=require('fs');var path=require(_0x40e9('0x5'));var rimraf=require(_0x40e9('0x6'));var config=require('../../config/environment');var attributes=require(_0x40e9('0x7'));module[_0x40e9('0x8')]=function(_0xea3cdb,_0x41b6be){return _0xea3cdb[_0x40e9('0x9')](_0x40e9('0xa'),attributes,{'tableName':_0x40e9('0xb'),'paranoid':![],'indexes':[{'name':_0x40e9('0xc'),'fields':['idField',_0x40e9('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 03a918c..fdde426 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 _0x0b6f=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa0c0b8,_0x51879a){var _0x152f89=function(_0x1db1bc){while(--_0x1db1bc){_0xa0c0b8['push'](_0xa0c0b8['shift']());}};_0x152f89(++_0x51879a);}(_0x0b6f,0xed));var _0xf0b6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0b6f[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xf0b6('0x0'));var util=require(_0xf0b6('0x1'));var moment=require(_0xf0b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0b6('0x3'));var fs=require('fs');var Redis=require(_0xf0b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0b6('0x5'));var logger=require(_0xf0b6('0x6'))('rpc');var config=require(_0xf0b6('0x7'));var jayson=require(_0xf0b6('0x8'));var client=jayson[_0xf0b6('0x9')][_0xf0b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b05e1,_0x2d7b42,_0x1b52bc){return new BPromise(function(_0x2e30c0,_0x489d5e){return client['request'](_0x5b05e1,_0x1b52bc)[_0xf0b6('0xb')](function(_0x3a230c){logger[_0xf0b6('0xc')](_0xf0b6('0xd'),_0x2d7b42,_0xf0b6('0xe'));logger[_0xf0b6('0xf')](_0xf0b6('0x10'),_0x2d7b42,_0xf0b6('0xe'),JSON[_0xf0b6('0x11')](_0x3a230c));if(_0x3a230c['error']){if(_0x3a230c[_0xf0b6('0x12')][_0xf0b6('0x13')]===0x1f4){logger[_0xf0b6('0x12')](_0xf0b6('0xd'),_0x2d7b42,_0x3a230c['error'][_0xf0b6('0x14')]);return _0x489d5e(_0x3a230c[_0xf0b6('0x12')][_0xf0b6('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2d7b42,_0x3a230c[_0xf0b6('0x12')][_0xf0b6('0x14')]);return _0x2e30c0(_0x3a230c[_0xf0b6('0x12')][_0xf0b6('0x14')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x2d7b42,'request\x20sent');_0x2e30c0(_0x3a230c[_0xf0b6('0x15')][_0xf0b6('0x14')]);}})[_0xf0b6('0x16')](function(_0x179dbc){logger['error'](_0xf0b6('0xd'),_0x2d7b42,_0x179dbc);_0x489d5e(_0x179dbc);});});} \ No newline at end of file +var _0x5dbc=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x5dbc,0x162));var _0xc5db=function(_0xcc487c,_0x2fda61){_0xcc487c=_0xcc487c-0x0;var _0x4f36d0=_0x5dbc[_0xcc487c];return _0x4f36d0;};'use strict';var _=require(_0xc5db('0x0'));var util=require(_0xc5db('0x1'));var moment=require(_0xc5db('0x2'));var BPromise=require(_0xc5db('0x3'));var rs=require(_0xc5db('0x4'));var fs=require('fs');var Redis=require(_0xc5db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5db('0x6'));var logger=require(_0xc5db('0x7'))('rpc');var config=require(_0xc5db('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52ef1d,_0x161126,_0x3cb177){return new BPromise(function(_0x52ebec,_0x33012f){return client[_0xc5db('0x9')](_0x52ef1d,_0x3cb177)[_0xc5db('0xa')](function(_0x435061){logger[_0xc5db('0xb')](_0xc5db('0xc'),_0x161126,_0xc5db('0xd'));logger[_0xc5db('0xe')](_0xc5db('0xf'),_0x161126,_0xc5db('0xd'),JSON[_0xc5db('0x10')](_0x435061));if(_0x435061['error']){if(_0x435061[_0xc5db('0x11')][_0xc5db('0x12')]===0x1f4){logger[_0xc5db('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x161126,_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);return _0x33012f(_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);}logger[_0xc5db('0x11')](_0xc5db('0xc'),_0x161126,_0x435061['error']['message']);return _0x52ebec(_0x435061[_0xc5db('0x11')][_0xc5db('0x13')]);}else{logger[_0xc5db('0xb')](_0xc5db('0xc'),_0x161126,_0xc5db('0xd'));_0x52ebec(_0x435061[_0xc5db('0x14')][_0xc5db('0x13')]);}})['catch'](function(_0x1419c3){logger[_0xc5db('0x11')](_0xc5db('0xc'),_0x161126,_0x1419c3);_0x33012f(_0x1419c3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index e3d54c8..67da622 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 _0x41bb=['/:id/fields','getFields','post','addConfiguration','put','update','delete','/:id','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0xf44947,_0x2a365c){var _0x5b4551=function(_0x1aab10){while(--_0x1aab10){_0xf44947['push'](_0xf44947['shift']());}};_0x5b4551(++_0x2a365c);}(_0x41bb,0xc5));var _0xb41b=function(_0xb05a3,_0x2f6986){_0xb05a3=_0xb05a3-0x0;var _0x5baeee=_0x41bb[_0xb05a3];return _0x5baeee;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/:id',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),controller['create']);router[_0xb41b('0xf')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x10')]);router[_0xb41b('0x11')]('/:id',auth[_0xb41b('0x9')](),controller[_0xb41b('0x12')]);router[_0xb41b('0x13')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0713=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0x26f512,_0x6335e){var _0x4187c6=function(_0x3d73c0){while(--_0x3d73c0){_0x26f512['push'](_0x26f512['shift']());}};_0x4187c6(++_0x6335e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getConfigurations']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x10')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['put']('/:id',auth[_0x3071('0x9')](),controller['update']);router[_0x3071('0x13')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x14')]);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 4eb7f2f..172766d 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0xb14c00,_0x281183){var _0x236a87=function(_0x290067){while(--_0x290067){_0xb14c00['push'](_0xb14c00['shift']());}};_0x236a87(++_0x281183);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x342ab2,_0x598cf0){_0x342ab2=_0x342ab2-0x0;var _0x173b84=_0xd7d1[_0x342ab2];return _0x173b84;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4888=['exports','STRING','username'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x4888,0x198));var _0x8488=function(_0x536076,_0x4c5460){_0x536076=_0x536076-0x0;var _0x246902=_0x4888[_0x536076];return _0x246902;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3d11760..4c99f04 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 _0x79b8=['api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error','name','send','map','FreshsalesAccount','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x4ecc1e,_0x3ae534){var _0x3f90e2=function(_0x42de1a){while(--_0x42de1a){_0x4ecc1e['push'](_0x4ecc1e['shift']());}};_0x3f90e2(++_0x3ae534);}(_0x79b8,0x11e));var _0x879b=function(_0x7c305b,_0x5512fd){_0x7c305b=_0x7c305b-0x0;var _0x33260f=_0x79b8[_0x7c305b];return _0x33260f;};'use strict';var emlformat=require(_0x879b('0x0'));var rimraf=require(_0x879b('0x1'));var zipdir=require(_0x879b('0x2'));var jsonpatch=require(_0x879b('0x3'));var rp=require(_0x879b('0x4'));var moment=require(_0x879b('0x5'));var BPromise=require(_0x879b('0x6'));var Mustache=require(_0x879b('0x7'));var util=require('util');var path=require(_0x879b('0x8'));var sox=require('sox');var csv=require(_0x879b('0x9'));var ejs=require(_0x879b('0xa'));var fs=require('fs');var fs_extra=require(_0x879b('0xb'));var _=require(_0x879b('0xc'));var squel=require(_0x879b('0xd'));var crypto=require('crypto');var jsforce=require(_0x879b('0xe'));var deskjs=require(_0x879b('0xf'));var toCsv=require(_0x879b('0x9'));var querystring=require(_0x879b('0x10'));var Papa=require(_0x879b('0x11'));var Redis=require(_0x879b('0x12'));var authService=require(_0x879b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x879b('0x14'));var hardwareService=require(_0x879b('0x15'));var logger=require(_0x879b('0x16'))(_0x879b('0x17'));var utils=require('../../config/utils');var config=require(_0x879b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x879b('0x19'));function respondWithStatusCode(_0x404d13,_0xa0296d){_0xa0296d=_0xa0296d||0xcc;return function(_0x1305ee){if(_0x1305ee){return _0x404d13[_0x879b('0x1a')](_0xa0296d);}return _0x404d13[_0x879b('0x1b')](_0xa0296d)[_0x879b('0x1c')]();};}function respondWithResult(_0x567c27,_0x203588){_0x203588=_0x203588||0xc8;return function(_0x55f2bb){if(_0x55f2bb){return _0x567c27[_0x879b('0x1b')](_0x203588)['json'](_0x55f2bb);}};}function respondWithFilteredResult(_0x86d51e,_0x4f5dab){return function(_0x38b957){if(_0x38b957){var _0x3d541e=typeof _0x4f5dab[_0x879b('0x1d')]===_0x879b('0x1e')&&typeof _0x4f5dab[_0x879b('0x1f')]==='undefined';var _0xfa631e=_0x38b957[_0x879b('0x20')];var _0x3cb5ec=_0x3d541e?0x0:_0x4f5dab[_0x879b('0x1d')];var _0x407aab=_0x3d541e?_0x38b957[_0x879b('0x20')]:_0x4f5dab[_0x879b('0x1d')]+_0x4f5dab[_0x879b('0x1f')];var _0x505f01;if(_0x407aab>=_0xfa631e){_0x407aab=_0xfa631e;_0x505f01=0xc8;}else{_0x505f01=0xce;}_0x86d51e['status'](_0x505f01);return _0x86d51e[_0x879b('0x21')]('Content-Range',_0x3cb5ec+'-'+_0x407aab+'/'+_0xfa631e)[_0x879b('0x22')](_0x38b957);}return null;};}function patchUpdates(_0x506611){return function(_0x4b6570){try{jsonpatch[_0x879b('0x23')](_0x4b6570,_0x506611,!![]);}catch(_0x38bcc7){return BPromise[_0x879b('0x24')](_0x38bcc7);}return _0x4b6570[_0x879b('0x25')]();};}function saveUpdates(_0x105817,_0x4a67db){return function(_0x63e638){if(_0x63e638){return _0x63e638['update'](_0x105817)[_0x879b('0x26')](function(_0x41aabe){return _0x41aabe;});}return null;};}function removeEntity(_0x59e795,_0x4ed23d){return function(_0x29e8d2){if(_0x29e8d2){return _0x29e8d2[_0x879b('0x27')]()[_0x879b('0x26')](function(){_0x59e795[_0x879b('0x1b')](0xcc)[_0x879b('0x1c')]();});}};}function handleEntityNotFound(_0xa7af23,_0x597131){return function(_0x1d64cc){if(!_0x1d64cc){_0xa7af23[_0x879b('0x1a')](0x194);}return _0x1d64cc;};}function handleError(_0x59150c,_0x5bde16){_0x5bde16=_0x5bde16||0x1f4;return function(_0x7b85e8){logger[_0x879b('0x28')](_0x7b85e8['stack']);if(_0x7b85e8['name']){delete _0x7b85e8[_0x879b('0x29')];}_0x59150c['status'](_0x5bde16)[_0x879b('0x2a')](_0x7b85e8);};}exports['index']=function(_0x1914a7,_0x234b53){var _0x3762ab={},_0x3e647a={},_0x1e4a56={'count':0x0,'rows':[]};var _0x466ecc=_[_0x879b('0x2b')](db[_0x879b('0x2c')]['rawAttributes'],function(_0x5b77dc){return{'name':_0x5b77dc['fieldName'],'type':_0x5b77dc['type'][_0x879b('0x2d')]};});_0x3e647a['model']=_[_0x879b('0x2b')](_0x466ecc,_0x879b('0x29'));_0x3e647a[_0x879b('0x2e')]=_[_0x879b('0x2f')](_0x1914a7[_0x879b('0x2e')]);_0x3e647a[_0x879b('0x30')]=_[_0x879b('0x31')](_0x3e647a['model'],_0x3e647a['query']);_0x3762ab['attributes']=_[_0x879b('0x31')](_0x3e647a[_0x879b('0x32')],qs['fields'](_0x1914a7[_0x879b('0x2e')][_0x879b('0x33')]));_0x3762ab[_0x879b('0x34')]=_0x3762ab['attributes'][_0x879b('0x35')]?_0x3762ab[_0x879b('0x34')]:_0x3e647a[_0x879b('0x32')];if(!_0x1914a7[_0x879b('0x2e')][_0x879b('0x36')](_0x879b('0x37'))){_0x3762ab[_0x879b('0x1f')]=qs[_0x879b('0x1f')](_0x1914a7[_0x879b('0x2e')][_0x879b('0x1f')]);_0x3762ab[_0x879b('0x1d')]=qs[_0x879b('0x1d')](_0x1914a7[_0x879b('0x2e')][_0x879b('0x1d')]);}_0x3762ab[_0x879b('0x38')]=qs[_0x879b('0x39')](_0x1914a7[_0x879b('0x2e')][_0x879b('0x39')]);_0x3762ab['where']=qs[_0x879b('0x30')](_[_0x879b('0x3a')](_0x1914a7[_0x879b('0x2e')],_0x3e647a[_0x879b('0x30')]),_0x466ecc);if(_0x1914a7[_0x879b('0x2e')][_0x879b('0x3b')]){_0x3762ab[_0x879b('0x3c')]=_[_0x879b('0x3d')](_0x3762ab[_0x879b('0x3c')],{'$or':_[_0x879b('0x2b')](_0x466ecc,function(_0xca7076){if(_0xca7076[_0x879b('0x3e')]!==_0x879b('0x3f')){var _0x5648e8={};_0x5648e8[_0xca7076[_0x879b('0x29')]]={'$like':'%'+_0x1914a7[_0x879b('0x2e')]['filter']+'%'};return _0x5648e8;}})});}_0x3762ab=_[_0x879b('0x3d')]({},_0x3762ab,_0x1914a7[_0x879b('0x40')]);var _0x5dc3ce={'where':_0x3762ab['where']};return db[_0x879b('0x2c')][_0x879b('0x20')](_0x5dc3ce)[_0x879b('0x26')](function(_0x61eef2){_0x1e4a56[_0x879b('0x20')]=_0x61eef2;if(_0x1914a7[_0x879b('0x2e')][_0x879b('0x41')]){_0x3762ab['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x879b('0x42')](_0x3762ab);})[_0x879b('0x26')](function(_0x73d06a){_0x1e4a56[_0x879b('0x43')]=_0x73d06a;return _0x1e4a56;})[_0x879b('0x26')](respondWithFilteredResult(_0x234b53,_0x3762ab))[_0x879b('0x44')](handleError(_0x234b53,null));};exports[_0x879b('0x45')]=function(_0x2aa243,_0x5e3832){var _0x4b6b37={'raw':![],'where':{'id':_0x2aa243[_0x879b('0x46')]['id']}},_0x265d0b={};_0x265d0b[_0x879b('0x32')]=_[_0x879b('0x2f')](db[_0x879b('0x2c')][_0x879b('0x47')]);_0x265d0b[_0x879b('0x2e')]=_['keys'](_0x2aa243['query']);_0x265d0b['filters']=_[_0x879b('0x31')](_0x265d0b[_0x879b('0x32')],_0x265d0b[_0x879b('0x2e')]);_0x4b6b37[_0x879b('0x34')]=_['intersection'](_0x265d0b['model'],qs[_0x879b('0x33')](_0x2aa243[_0x879b('0x2e')][_0x879b('0x33')]));_0x4b6b37[_0x879b('0x34')]=_0x4b6b37[_0x879b('0x34')][_0x879b('0x35')]?_0x4b6b37[_0x879b('0x34')]:_0x265d0b['model'];if(_0x2aa243[_0x879b('0x2e')][_0x879b('0x41')]){_0x4b6b37['include']=[{'all':!![]}];}_0x4b6b37=_[_0x879b('0x3d')]({},_0x4b6b37,_0x2aa243[_0x879b('0x40')]);return db[_0x879b('0x2c')][_0x879b('0x48')](_0x4b6b37)[_0x879b('0x26')](handleEntityNotFound(_0x5e3832,null))[_0x879b('0x26')](respondWithResult(_0x5e3832,null))['catch'](handleError(_0x5e3832,null));};exports[_0x879b('0x49')]=function(_0x545d92,_0x6d1bfe){return db[_0x879b('0x2c')][_0x879b('0x49')](_0x545d92[_0x879b('0x4a')],{})[_0x879b('0x26')](respondWithResult(_0x6d1bfe,0xc9))[_0x879b('0x44')](handleError(_0x6d1bfe,null));};exports['update']=function(_0x4d5b1e,_0x114a64){if(_0x4d5b1e[_0x879b('0x4a')]['id']){delete _0x4d5b1e[_0x879b('0x4a')]['id'];}return db[_0x879b('0x2c')]['find']({'where':{'id':_0x4d5b1e[_0x879b('0x46')]['id']}})['then'](handleEntityNotFound(_0x114a64,null))[_0x879b('0x26')](saveUpdates(_0x4d5b1e[_0x879b('0x4a')],null))[_0x879b('0x26')](respondWithResult(_0x114a64,null))[_0x879b('0x44')](handleError(_0x114a64,null));};exports[_0x879b('0x27')]=function(_0x5b8990,_0x463a0d){return db['FreshsalesAccount'][_0x879b('0x48')]({'where':{'id':_0x5b8990['params']['id']}})[_0x879b('0x26')](handleEntityNotFound(_0x463a0d,null))['then'](removeEntity(_0x463a0d,null))['catch'](handleError(_0x463a0d,null));};exports[_0x879b('0x4b')]=function(_0x3cf76d,_0x248f10,_0x1b0082){var _0x202cce={};var _0x3ac971={};var _0x4356c0;var _0x323f48;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3cf76d[_0x879b('0x46')]['id']}})['then'](handleEntityNotFound(_0x248f10,null))[_0x879b('0x26')](function(_0x535f64){if(_0x535f64){_0x4356c0=_0x535f64;_0x3ac971[_0x879b('0x32')]=_[_0x879b('0x2f')](db[_0x879b('0x4c')]['rawAttributes']);_0x3ac971[_0x879b('0x2e')]=_[_0x879b('0x2f')](_0x3cf76d['query']);_0x3ac971[_0x879b('0x30')]=_[_0x879b('0x31')](_0x3ac971[_0x879b('0x32')],_0x3ac971[_0x879b('0x2e')]);_0x202cce[_0x879b('0x34')]=_[_0x879b('0x31')](_0x3ac971[_0x879b('0x32')],qs['fields'](_0x3cf76d[_0x879b('0x2e')]['fields']));_0x202cce[_0x879b('0x34')]=_0x202cce[_0x879b('0x34')][_0x879b('0x35')]?_0x202cce['attributes']:_0x3ac971[_0x879b('0x32')];_0x202cce['order']=qs[_0x879b('0x39')](_0x3cf76d[_0x879b('0x2e')][_0x879b('0x39')]);_0x202cce['where']=qs[_0x879b('0x30')](_[_0x879b('0x3a')](_0x3cf76d[_0x879b('0x2e')],_0x3ac971[_0x879b('0x30')]));if(_0x3cf76d[_0x879b('0x2e')]['filter']){_0x202cce[_0x879b('0x3c')]=_[_0x879b('0x3d')](_0x202cce[_0x879b('0x3c')],{'$or':_['map'](_0x202cce[_0x879b('0x34')],function(_0x2e1159){var _0x3783e8={};_0x3783e8[_0x2e1159]={'$like':'%'+_0x3cf76d[_0x879b('0x2e')][_0x879b('0x3b')]+'%'};return _0x3783e8;})});}_0x202cce=_['merge']({},_0x202cce,_0x3cf76d[_0x879b('0x40')]);return _0x4356c0['getConfigurations'](_0x202cce);}})[_0x879b('0x26')](function(_0x8b82ad){if(_0x8b82ad){_0x323f48=_0x8b82ad[_0x879b('0x35')];if(!_0x3cf76d[_0x879b('0x2e')][_0x879b('0x36')](_0x879b('0x37'))){_0x202cce['limit']=qs['limit'](_0x3cf76d[_0x879b('0x2e')][_0x879b('0x1f')]);_0x202cce['offset']=qs[_0x879b('0x1d')](_0x3cf76d[_0x879b('0x2e')]['offset']);}return _0x4356c0[_0x879b('0x4b')](_0x202cce);}})[_0x879b('0x26')](function(_0x5aacfc){if(_0x5aacfc){return _0x5aacfc?{'count':_0x323f48,'rows':_0x5aacfc}:null;}})[_0x879b('0x26')](respondWithResult(_0x248f10,null))[_0x879b('0x44')](handleError(_0x248f10,null));};exports[_0x879b('0x4d')]=function(_0x1fc6e6,_0x199852,_0x3cc4d8){if(_0x1fc6e6['body']['id']){delete _0x1fc6e6[_0x879b('0x4a')]['id'];}return db[_0x879b('0x2c')][_0x879b('0x4e')]({'where':{'id':_0x1fc6e6[_0x879b('0x46')]['id']}})['then'](handleEntityNotFound(_0x199852,null))[_0x879b('0x26')](function(_0xbb953e){if(_0xbb953e){_0x1fc6e6[_0x879b('0x4a')]['AccountId']=_0xbb953e['id'];_0x1fc6e6[_0x879b('0x4a')][_0x879b('0x4f')]=integrations[_0x879b('0x50')](_0x1fc6e6[_0x879b('0x4a')][_0x879b('0x51')],_0x1fc6e6[_0x879b('0x4a')]['type']);_0x1fc6e6[_0x879b('0x4a')][_0x879b('0x52')]=integrations[_0x879b('0x53')](_0x1fc6e6[_0x879b('0x4a')][_0x879b('0x51')],_0x1fc6e6[_0x879b('0x4a')][_0x879b('0x3e')]);return db['FreshsalesConfiguration']['create'](_0x1fc6e6[_0x879b('0x4a')],{'include':[{'model':db[_0x879b('0x54')],'as':_0x879b('0x4f')},{'model':db['FreshsalesField'],'as':_0x879b('0x52')}]});}return null;})[_0x879b('0x26')](respondWithResult(_0x199852,null))[_0x879b('0x44')](handleError(_0x199852,null));};exports[_0x879b('0x55')]=function(_0x4d1d3b,_0x550a35,_0x5c4b10){var _0x2b3e00='';var _0x49c552='';return db['FreshsalesAccount'][_0x879b('0x4e')]({'where':{'id':_0x4d1d3b['params']['id']},'attributes':['id',_0x879b('0x56'),_0x879b('0x57'),_0x879b('0x58')]})[_0x879b('0x26')](handleEntityNotFound(_0x550a35,null))['then'](function(_0x51c433){if(_0x51c433){_0x49c552=_0x51c433[_0x879b('0x56')];_0x2b3e00=_0x51c433[_0x879b('0x57')];var _0x2e4d26=_0x51c433['remoteUri'][_0x879b('0x59')](-0x1);if(_0x2e4d26==='/'){_0x2b3e00=_0x2b3e00[_0x879b('0x5a')](0x0,_0x2b3e00['lastIndexOf'](_0x2e4d26));}return rp({'method':'GET','uri':util[_0x879b('0x5b')](_0x879b('0x5c'),_0x2b3e00,_0x879b('0x5d')),'headers':{'Authorization':_0x879b('0x5e')+_0x51c433[_0x879b('0x58')]},'json':!![]});}})[_0x879b('0x26')](function(_0x37c464){if(_0x37c464){var _0xf93ed7=_0x37c464[_0x879b('0x5f')];var _0x1e5d84=![];var _0x12147e=null;for(_0x12147e=0x0;_0x12147e<_0xf93ed7[_0x879b('0x35')];_0x12147e++){if(_0xf93ed7[_0x12147e][_0x879b('0x60')]===_0x49c552){_0x1e5d84=!![];}}if(_0x1e5d84){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x879b('0x61')});}}})['then'](respondWithResult(_0x550a35,null))[_0x879b('0x44')](function(_0x4fba17){var _0xf4281=_0x4d1d3b['query'][_0x879b('0x62')]?0x1f4:_0x4fba17[_0x879b('0x63')]||0x1f4;logger[_0x879b('0x28')](_0x879b('0x64'),'getFields',_0xf4281,JSON[_0x879b('0x65')](_0x4fba17));delete _0x4fba17[_0x879b('0x29')];if(_0xf4281===0x191){_0xf4281=0x190;}_0x550a35[_0x879b('0x1b')](_0xf4281)['send'](_0x4d1d3b[_0x879b('0x2e')]['test']?{'message':_0x879b('0x66'),'statusCode':_0x4fba17[_0x879b('0x63')]}:_0x4fba17);});}; \ No newline at end of file +var _0x0fe5=['sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','rawAttributes','options','body','find','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0x0fe5,0xf7));var _0x50fe=function(_0x25a675,_0x5811ce){_0x25a675=_0x25a675-0x0;var _0x5d6366=_0x0fe5[_0x25a675];return _0x5d6366;};'use strict';var emlformat=require(_0x50fe('0x0'));var rimraf=require(_0x50fe('0x1'));var zipdir=require(_0x50fe('0x2'));var jsonpatch=require(_0x50fe('0x3'));var rp=require(_0x50fe('0x4'));var moment=require(_0x50fe('0x5'));var BPromise=require(_0x50fe('0x6'));var Mustache=require(_0x50fe('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x50fe('0x8'));var ejs=require(_0x50fe('0x9'));var fs=require('fs');var fs_extra=require(_0x50fe('0xa'));var _=require('lodash');var squel=require(_0x50fe('0xb'));var crypto=require('crypto');var jsforce=require(_0x50fe('0xc'));var deskjs=require(_0x50fe('0xd'));var toCsv=require(_0x50fe('0x8'));var querystring=require(_0x50fe('0xe'));var Papa=require(_0x50fe('0xf'));var Redis=require(_0x50fe('0x10'));var authService=require(_0x50fe('0x11'));var qs=require(_0x50fe('0x12'));var as=require(_0x50fe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50fe('0x14'))(_0x50fe('0x15'));var utils=require(_0x50fe('0x16'));var config=require(_0x50fe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x50fe('0x18'))['db'];var integrations=require(_0x50fe('0x19'));function respondWithStatusCode(_0x31c1d3,_0x313d4c){_0x313d4c=_0x313d4c||0xcc;return function(_0x494d1b){if(_0x494d1b){return _0x31c1d3[_0x50fe('0x1a')](_0x313d4c);}return _0x31c1d3[_0x50fe('0x1b')](_0x313d4c)[_0x50fe('0x1c')]();};}function respondWithResult(_0x9d1126,_0x3b1634){_0x3b1634=_0x3b1634||0xc8;return function(_0x531428){if(_0x531428){return _0x9d1126[_0x50fe('0x1b')](_0x3b1634)['json'](_0x531428);}};}function respondWithFilteredResult(_0x4619ba,_0x588ae5){return function(_0x195a5e){if(_0x195a5e){var _0x205fd4=typeof _0x588ae5[_0x50fe('0x1d')]===_0x50fe('0x1e')&&typeof _0x588ae5[_0x50fe('0x1f')]===_0x50fe('0x1e');var _0x227111=_0x195a5e[_0x50fe('0x20')];var _0x2edeae=_0x205fd4?0x0:_0x588ae5[_0x50fe('0x1d')];var _0x108857=_0x205fd4?_0x195a5e[_0x50fe('0x20')]:_0x588ae5['offset']+_0x588ae5['limit'];var _0x57fe3c;if(_0x108857>=_0x227111){_0x108857=_0x227111;_0x57fe3c=0xc8;}else{_0x57fe3c=0xce;}_0x4619ba['status'](_0x57fe3c);return _0x4619ba[_0x50fe('0x21')](_0x50fe('0x22'),_0x2edeae+'-'+_0x108857+'/'+_0x227111)['json'](_0x195a5e);}return null;};}function patchUpdates(_0x59c316){return function(_0x261921){try{jsonpatch[_0x50fe('0x23')](_0x261921,_0x59c316,!![]);}catch(_0x35a438){return BPromise[_0x50fe('0x24')](_0x35a438);}return _0x261921['save']();};}function saveUpdates(_0x19ba8a,_0x22de29){return function(_0x52631a){if(_0x52631a){return _0x52631a[_0x50fe('0x25')](_0x19ba8a)[_0x50fe('0x26')](function(_0x5cf5e0){return _0x5cf5e0;});}return null;};}function removeEntity(_0x3f352f,_0x228aa8){return function(_0x1e44bf){if(_0x1e44bf){return _0x1e44bf[_0x50fe('0x27')]()['then'](function(){_0x3f352f[_0x50fe('0x1b')](0xcc)[_0x50fe('0x1c')]();});}};}function handleEntityNotFound(_0x345ddf,_0xcda070){return function(_0x14f592){if(!_0x14f592){_0x345ddf[_0x50fe('0x1a')](0x194);}return _0x14f592;};}function handleError(_0x439feb,_0x5dcac1){_0x5dcac1=_0x5dcac1||0x1f4;return function(_0xaac70){logger[_0x50fe('0x28')](_0xaac70[_0x50fe('0x29')]);if(_0xaac70['name']){delete _0xaac70[_0x50fe('0x2a')];}_0x439feb['status'](_0x5dcac1)['send'](_0xaac70);};}exports[_0x50fe('0x2b')]=function(_0x4769d7,_0x1528ec){var _0x5434de={},_0x3d0ded={},_0x3a38c1={'count':0x0,'rows':[]};var _0x1b569e=_[_0x50fe('0x2c')](db[_0x50fe('0x2d')]['rawAttributes'],function(_0x2cc093){return{'name':_0x2cc093[_0x50fe('0x2e')],'type':_0x2cc093[_0x50fe('0x2f')][_0x50fe('0x30')]};});_0x3d0ded[_0x50fe('0x31')]=_[_0x50fe('0x2c')](_0x1b569e,_0x50fe('0x2a'));_0x3d0ded[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x4769d7[_0x50fe('0x32')]);_0x3d0ded['filters']=_[_0x50fe('0x34')](_0x3d0ded[_0x50fe('0x31')],_0x3d0ded[_0x50fe('0x32')]);_0x5434de[_0x50fe('0x35')]=_[_0x50fe('0x34')](_0x3d0ded['model'],qs[_0x50fe('0x36')](_0x4769d7[_0x50fe('0x32')]['fields']));_0x5434de[_0x50fe('0x35')]=_0x5434de[_0x50fe('0x35')][_0x50fe('0x37')]?_0x5434de[_0x50fe('0x35')]:_0x3d0ded[_0x50fe('0x31')];if(!_0x4769d7[_0x50fe('0x32')][_0x50fe('0x38')](_0x50fe('0x39'))){_0x5434de[_0x50fe('0x1f')]=qs['limit'](_0x4769d7[_0x50fe('0x32')][_0x50fe('0x1f')]);_0x5434de['offset']=qs['offset'](_0x4769d7['query']['offset']);}_0x5434de[_0x50fe('0x3a')]=qs[_0x50fe('0x3b')](_0x4769d7[_0x50fe('0x32')][_0x50fe('0x3b')]);_0x5434de[_0x50fe('0x3c')]=qs['filters'](_[_0x50fe('0x3d')](_0x4769d7[_0x50fe('0x32')],_0x3d0ded[_0x50fe('0x3e')]),_0x1b569e);if(_0x4769d7[_0x50fe('0x32')]['filter']){_0x5434de[_0x50fe('0x3c')]=_[_0x50fe('0x3f')](_0x5434de[_0x50fe('0x3c')],{'$or':_[_0x50fe('0x2c')](_0x1b569e,function(_0x2906a6){if(_0x2906a6[_0x50fe('0x2f')]!==_0x50fe('0x40')){var _0x58fe05={};_0x58fe05[_0x2906a6[_0x50fe('0x2a')]]={'$like':'%'+_0x4769d7[_0x50fe('0x32')][_0x50fe('0x41')]+'%'};return _0x58fe05;}})});}_0x5434de=_[_0x50fe('0x3f')]({},_0x5434de,_0x4769d7['options']);var _0x197dc5={'where':_0x5434de[_0x50fe('0x3c')]};return db[_0x50fe('0x2d')][_0x50fe('0x20')](_0x197dc5)[_0x50fe('0x26')](function(_0x5cf731){_0x3a38c1[_0x50fe('0x20')]=_0x5cf731;if(_0x4769d7[_0x50fe('0x32')][_0x50fe('0x42')]){_0x5434de[_0x50fe('0x43')]=[{'all':!![]}];}return db[_0x50fe('0x2d')]['findAll'](_0x5434de);})['then'](function(_0x4927e3){_0x3a38c1[_0x50fe('0x44')]=_0x4927e3;return _0x3a38c1;})['then'](respondWithFilteredResult(_0x1528ec,_0x5434de))[_0x50fe('0x45')](handleError(_0x1528ec,null));};exports[_0x50fe('0x46')]=function(_0x4fbfc9,_0x34b3c6){var _0x2bfb0e={'raw':![],'where':{'id':_0x4fbfc9[_0x50fe('0x47')]['id']}},_0xabeea={};_0xabeea['model']=_[_0x50fe('0x33')](db[_0x50fe('0x2d')][_0x50fe('0x48')]);_0xabeea[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x4fbfc9[_0x50fe('0x32')]);_0xabeea[_0x50fe('0x3e')]=_['intersection'](_0xabeea[_0x50fe('0x31')],_0xabeea[_0x50fe('0x32')]);_0x2bfb0e['attributes']=_[_0x50fe('0x34')](_0xabeea['model'],qs['fields'](_0x4fbfc9['query'][_0x50fe('0x36')]));_0x2bfb0e[_0x50fe('0x35')]=_0x2bfb0e[_0x50fe('0x35')][_0x50fe('0x37')]?_0x2bfb0e[_0x50fe('0x35')]:_0xabeea[_0x50fe('0x31')];if(_0x4fbfc9[_0x50fe('0x32')]['includeAll']){_0x2bfb0e['include']=[{'all':!![]}];}_0x2bfb0e=_[_0x50fe('0x3f')]({},_0x2bfb0e,_0x4fbfc9[_0x50fe('0x49')]);return db['FreshsalesAccount']['find'](_0x2bfb0e)[_0x50fe('0x26')](handleEntityNotFound(_0x34b3c6,null))[_0x50fe('0x26')](respondWithResult(_0x34b3c6,null))['catch'](handleError(_0x34b3c6,null));};exports['create']=function(_0x415775,_0x114707){return db[_0x50fe('0x2d')]['create'](_0x415775[_0x50fe('0x4a')],{})[_0x50fe('0x26')](respondWithResult(_0x114707,0xc9))[_0x50fe('0x45')](handleError(_0x114707,null));};exports[_0x50fe('0x25')]=function(_0x17f920,_0x32fe87){if(_0x17f920[_0x50fe('0x4a')]['id']){delete _0x17f920['body']['id'];}return db[_0x50fe('0x2d')][_0x50fe('0x4b')]({'where':{'id':_0x17f920[_0x50fe('0x47')]['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x32fe87,null))[_0x50fe('0x26')](saveUpdates(_0x17f920['body'],null))[_0x50fe('0x26')](respondWithResult(_0x32fe87,null))[_0x50fe('0x45')](handleError(_0x32fe87,null));};exports[_0x50fe('0x27')]=function(_0x51716e,_0x1fe7dd){return db[_0x50fe('0x2d')][_0x50fe('0x4b')]({'where':{'id':_0x51716e[_0x50fe('0x47')]['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x1fe7dd,null))[_0x50fe('0x26')](removeEntity(_0x1fe7dd,null))['catch'](handleError(_0x1fe7dd,null));};exports[_0x50fe('0x4c')]=function(_0x351b3d,_0x33b4cb,_0x2ebc23){var _0x5035f8={};var _0xd4dfc8={};var _0x1b501d;var _0x556f2b;return db['FreshsalesAccount'][_0x50fe('0x4d')]({'where':{'id':_0x351b3d[_0x50fe('0x47')]['id']}})['then'](handleEntityNotFound(_0x33b4cb,null))['then'](function(_0x5261b0){if(_0x5261b0){_0x1b501d=_0x5261b0;_0xd4dfc8['model']=_[_0x50fe('0x33')](db[_0x50fe('0x4e')][_0x50fe('0x48')]);_0xd4dfc8[_0x50fe('0x32')]=_[_0x50fe('0x33')](_0x351b3d[_0x50fe('0x32')]);_0xd4dfc8['filters']=_[_0x50fe('0x34')](_0xd4dfc8[_0x50fe('0x31')],_0xd4dfc8[_0x50fe('0x32')]);_0x5035f8[_0x50fe('0x35')]=_[_0x50fe('0x34')](_0xd4dfc8[_0x50fe('0x31')],qs[_0x50fe('0x36')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x36')]));_0x5035f8[_0x50fe('0x35')]=_0x5035f8[_0x50fe('0x35')][_0x50fe('0x37')]?_0x5035f8[_0x50fe('0x35')]:_0xd4dfc8[_0x50fe('0x31')];_0x5035f8[_0x50fe('0x3a')]=qs[_0x50fe('0x3b')](_0x351b3d[_0x50fe('0x32')]['sort']);_0x5035f8[_0x50fe('0x3c')]=qs[_0x50fe('0x3e')](_['pick'](_0x351b3d[_0x50fe('0x32')],_0xd4dfc8['filters']));if(_0x351b3d[_0x50fe('0x32')][_0x50fe('0x41')]){_0x5035f8[_0x50fe('0x3c')]=_[_0x50fe('0x3f')](_0x5035f8[_0x50fe('0x3c')],{'$or':_[_0x50fe('0x2c')](_0x5035f8[_0x50fe('0x35')],function(_0x46df31){var _0x368f69={};_0x368f69[_0x46df31]={'$like':'%'+_0x351b3d[_0x50fe('0x32')][_0x50fe('0x41')]+'%'};return _0x368f69;})});}_0x5035f8=_[_0x50fe('0x3f')]({},_0x5035f8,_0x351b3d['options']);return _0x1b501d[_0x50fe('0x4c')](_0x5035f8);}})[_0x50fe('0x26')](function(_0x323f31){if(_0x323f31){_0x556f2b=_0x323f31[_0x50fe('0x37')];if(!_0x351b3d[_0x50fe('0x32')][_0x50fe('0x38')](_0x50fe('0x39'))){_0x5035f8[_0x50fe('0x1f')]=qs[_0x50fe('0x1f')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x1f')]);_0x5035f8['offset']=qs[_0x50fe('0x1d')](_0x351b3d[_0x50fe('0x32')][_0x50fe('0x1d')]);}return _0x1b501d[_0x50fe('0x4c')](_0x5035f8);}})[_0x50fe('0x26')](function(_0x491e63){if(_0x491e63){return _0x491e63?{'count':_0x556f2b,'rows':_0x491e63}:null;}})[_0x50fe('0x26')](respondWithResult(_0x33b4cb,null))[_0x50fe('0x45')](handleError(_0x33b4cb,null));};exports[_0x50fe('0x4f')]=function(_0x1c39ea,_0x3373fb,_0x6a63cb){if(_0x1c39ea[_0x50fe('0x4a')]['id']){delete _0x1c39ea['body']['id'];}return db[_0x50fe('0x2d')]['findOne']({'where':{'id':_0x1c39ea['params']['id']}})[_0x50fe('0x26')](handleEntityNotFound(_0x3373fb,null))[_0x50fe('0x26')](function(_0x212bd0){if(_0x212bd0){_0x1c39ea['body'][_0x50fe('0x50')]=_0x212bd0['id'];_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x51')]=integrations[_0x50fe('0x52')](_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x53')],_0x1c39ea['body'][_0x50fe('0x2f')]);_0x1c39ea[_0x50fe('0x4a')][_0x50fe('0x54')]=integrations['getDescriptions'](_0x1c39ea['body'][_0x50fe('0x53')],_0x1c39ea['body']['type']);return db[_0x50fe('0x4e')]['create'](_0x1c39ea[_0x50fe('0x4a')],{'include':[{'model':db[_0x50fe('0x55')],'as':_0x50fe('0x51')},{'model':db[_0x50fe('0x55')],'as':_0x50fe('0x54')}]});}return null;})[_0x50fe('0x26')](respondWithResult(_0x3373fb,null))[_0x50fe('0x45')](handleError(_0x3373fb,null));};exports[_0x50fe('0x56')]=function(_0x23b3c8,_0x22625a,_0x558887){var _0x4cb6ec='';var _0x4e9152='';return db['FreshsalesAccount'][_0x50fe('0x4d')]({'where':{'id':_0x23b3c8[_0x50fe('0x47')]['id']},'attributes':['id',_0x50fe('0x57'),'remoteUri',_0x50fe('0x58')]})['then'](handleEntityNotFound(_0x22625a,null))[_0x50fe('0x26')](function(_0x24f92f){if(_0x24f92f){_0x4e9152=_0x24f92f['username'];_0x4cb6ec=_0x24f92f[_0x50fe('0x59')];var _0x6eca4e=_0x24f92f['remoteUri'][_0x50fe('0x5a')](-0x1);if(_0x6eca4e==='/'){_0x4cb6ec=_0x4cb6ec[_0x50fe('0x5b')](0x0,_0x4cb6ec['lastIndexOf'](_0x6eca4e));}return rp({'method':'GET','uri':util[_0x50fe('0x5c')]('%s%s',_0x4cb6ec,_0x50fe('0x5d')),'headers':{'Authorization':_0x50fe('0x5e')+_0x24f92f['apiKey']},'json':!![]});}})[_0x50fe('0x26')](function(_0xd0ace7){if(_0xd0ace7){var _0x3f99fa=_0xd0ace7[_0x50fe('0x5f')];var _0x55cd69=![];var _0x2aefa0=null;for(_0x2aefa0=0x0;_0x2aefa0<_0x3f99fa[_0x50fe('0x37')];_0x2aefa0++){if(_0x3f99fa[_0x2aefa0][_0x50fe('0x60')]===_0x4e9152){_0x55cd69=!![];}}if(_0x55cd69){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x50fe('0x61')});}}})[_0x50fe('0x26')](respondWithResult(_0x22625a,null))[_0x50fe('0x45')](function(_0x430955){var _0x1f4a0f=_0x23b3c8['query'][_0x50fe('0x62')]?0x1f4:_0x430955[_0x50fe('0x63')]||0x1f4;logger[_0x50fe('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x50fe('0x56'),_0x1f4a0f,JSON[_0x50fe('0x64')](_0x430955));delete _0x430955[_0x50fe('0x2a')];if(_0x1f4a0f===0x191){_0x1f4a0f=0x190;}_0x22625a[_0x50fe('0x1b')](_0x1f4a0f)['send'](_0x23b3c8[_0x50fe('0x32')]['test']?{'message':_0x50fe('0x65'),'statusCode':_0x430955['statusCode']}:_0x430955);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e050dba..51878e5 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 _0xb091=['request-promise','../../config/environment','./intFreshsalesAccount.attributes','exports','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x232b8b,_0x4b5340){var _0x367046=function(_0x1df528){while(--_0x1df528){_0x232b8b['push'](_0x232b8b['shift']());}};_0x367046(++_0x4b5340);}(_0xb091,0x16e));var _0x1b09=function(_0x271324,_0x43af3f){_0x271324=_0x271324-0x0;var _0x2b8afb=_0xb091[_0x271324];return _0x2b8afb;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1b09('0x7')]=function(_0x5fa348,_0x2bf4f6){return _0x5fa348['define'](_0x1b09('0x8'),attributes,{'tableName':_0x1b09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x2fb4aa,_0x3df6c8){var _0x53f4a5=function(_0x17a47d){while(--_0x17a47d){_0x2fb4aa['push'](_0x2fb4aa['shift']());}};_0x53f4a5(++_0x3df6c8);}(_0x82c4,0x1ca));var _0x482c=function(_0x289c9d,_0x55993d){_0x289c9d=_0x289c9d-0x0;var _0x3b749c=_0x82c4[_0x289c9d];return _0x3b749c;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 4a6f883..50337bd 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 _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x4eb633,_0x3ea077){var _0x55f573=function(_0x483caf){while(--_0x483caf){_0x4eb633['push'](_0x4eb633['shift']());}};_0x55f573(++_0x3ea077);}(_0x7bd0,0x111));var _0x07bd=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x7bd0[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});}; \ No newline at end of file +var _0x7b84=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','limit','map','model','include','GetFreshsalesAccount','ShowFreshsalesAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7b84,0x17c));var _0x47b8=function(_0xf3fbe5,_0x2843d5){_0xf3fbe5=_0xf3fbe5-0x0;var _0x58d4f7=_0x7b84[_0xf3fbe5];return _0x58d4f7;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['GetFreshsalesAccount']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['FreshsalesAccount']['findAll']({'raw':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1b')]||null:null,'attributes':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1c')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'include':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')]['include']?_[_0x47b8('0x1e')](_0x4f7317[_0x47b8('0x1a')]['include'],function(_0x22e7dd){return{'model':db[_0x22e7dd[_0x47b8('0x1f')]],'as':_0x22e7dd['as'],'attributes':_0x22e7dd[_0x47b8('0x1c')],'include':_0x22e7dd[_0x47b8('0x20')]?_['map'](_0x22e7dd[_0x47b8('0x20')],function(_0x332c23){return{'model':db[_0x332c23[_0x47b8('0x1f')]],'as':_0x332c23['as'],'attributes':_0x332c23[_0x47b8('0x1c')],'include':_0x332c23[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x332c23[_0x47b8('0x20')],function(_0x568c1e){return{'model':db[_0x568c1e[_0x47b8('0x1f')]],'as':_0x568c1e['as'],'attributes':_0x568c1e[_0x47b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195a66){logger[_0x47b8('0xf')](_0x47b8('0x21'),_0x4f7317);logger[_0x47b8('0x12')]('GetFreshsalesAccount',_0x4f7317,JSON[_0x47b8('0x14')](_0x195a66));_0x36faf1(_0x195a66);})['catch'](function(_0x2c89fc){logger[_0x47b8('0x15')](_0x47b8('0x21'),_0x2c89fc[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195['error'](0x1f4,_0x2c89fc[_0x47b8('0x17')]));});});};exports[_0x47b8('0x22')]=function(_0x402e7c){var _0x1b6c0a=this;return new Promise(function(_0x132f37,_0x197cb5){return db['FreshsalesAccount']['find']({'raw':_0x402e7c['options']?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x23')]===undefined?!![]:![]:!![],'where':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c['options']['where']||null:null,'attributes':_0x402e7c['options']?_0x402e7c['options'][_0x47b8('0x1c')]||null:null,'include':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')],function(_0x460dcc){return{'model':db[_0x460dcc[_0x47b8('0x1f')]],'as':_0x460dcc['as'],'attributes':_0x460dcc['attributes'],'include':_0x460dcc['include']?_[_0x47b8('0x1e')](_0x460dcc[_0x47b8('0x20')],function(_0x531dd2){return{'model':db[_0x531dd2['model']],'as':_0x531dd2['as'],'attributes':_0x531dd2[_0x47b8('0x1c')],'include':_0x531dd2[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x531dd2['include'],function(_0x240ab6){return{'model':db[_0x240ab6[_0x47b8('0x1f')]],'as':_0x240ab6['as'],'attributes':_0x240ab6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1892){logger['info'](_0x47b8('0x22'),_0x402e7c);logger[_0x47b8('0x12')](_0x47b8('0x22'),_0x402e7c,JSON[_0x47b8('0x14')](_0x4f1892));_0x132f37(_0x4f1892);})[_0x47b8('0x19')](function(_0x3c24c1){logger['error']('ShowFreshsalesAccount',_0x3c24c1[_0x47b8('0x17')],_0x402e7c);_0x197cb5(_0x1b6c0a[_0x47b8('0x15')](0x1f4,_0x3c24c1[_0x47b8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 43c70c6..0032b7e 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 _0xaac1=['../../components/auth/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','update','delete','destroy','multer','connect-timeout','express','fs-extra'];(function(_0x26806a,_0x35b2da){var _0x222ca6=function(_0x4f4f4f){while(--_0x4f4f4f){_0x26806a['push'](_0x26806a['shift']());}};_0x222ca6(++_0x35b2da);}(_0xaac1,0xc2));var _0x1aac=function(_0x338cbf,_0x459456){_0x338cbf=_0x338cbf-0x0;var _0x5ab0bf=_0xaac1[_0x338cbf];return _0x5ab0bf;};'use strict';var multer=require(_0x1aac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1aac('0x1'));var express=require(_0x1aac('0x2'));var router=express['Router']();var fs_extra=require(_0x1aac('0x3'));var auth=require(_0x1aac('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1aac('0x5'));router['get']('/',auth[_0x1aac('0x6')](),controller[_0x1aac('0x7')]);router[_0x1aac('0x8')](_0x1aac('0x9'),auth[_0x1aac('0x6')](),controller[_0x1aac('0xa')]);router[_0x1aac('0x8')](_0x1aac('0xb'),auth[_0x1aac('0x6')](),controller[_0x1aac('0xc')]);router[_0x1aac('0x8')](_0x1aac('0xd'),auth['isAuthenticated'](),controller[_0x1aac('0xe')]);router[_0x1aac('0x8')](_0x1aac('0xf'),auth['isAuthenticated'](),controller[_0x1aac('0x10')]);router[_0x1aac('0x11')]('/',auth[_0x1aac('0x6')](),controller[_0x1aac('0x12')]);router['put'](_0x1aac('0x9'),auth[_0x1aac('0x6')](),controller[_0x1aac('0x13')]);router[_0x1aac('0x14')](_0x1aac('0x9'),auth[_0x1aac('0x6')](),controller[_0x1aac('0x15')]);module['exports']=router; \ No newline at end of file +var _0x5919=['getDescriptions','/:id/fields','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3ec6e4,_0x3075bf){var _0x575e09=function(_0x312a51){while(--_0x312a51){_0x3ec6e4['push'](_0x3ec6e4['shift']());}};_0x575e09(++_0x3075bf);}(_0x5919,0xe8));var _0x9591=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x5919[_0x4fa291];return _0x506d9b;};'use strict';var multer=require(_0x9591('0x0'));var util=require(_0x9591('0x1'));var path=require(_0x9591('0x2'));var timeout=require('connect-timeout');var express=require(_0x9591('0x3'));var router=express[_0x9591('0x4')]();var fs_extra=require(_0x9591('0x5'));var auth=require(_0x9591('0x6'));var interaction=require(_0x9591('0x7'));var config=require(_0x9591('0x8'));var controller=require(_0x9591('0x9'));router[_0x9591('0xa')]('/',auth['isAuthenticated'](),controller[_0x9591('0xb')]);router['get'](_0x9591('0xc'),auth[_0x9591('0xd')](),controller[_0x9591('0xe')]);router['get'](_0x9591('0xf'),auth[_0x9591('0xd')](),controller[_0x9591('0x10')]);router[_0x9591('0xa')](_0x9591('0x11'),auth[_0x9591('0xd')](),controller[_0x9591('0x12')]);router[_0x9591('0xa')](_0x9591('0x13'),auth[_0x9591('0xd')](),controller['getFields']);router[_0x9591('0x14')]('/',auth[_0x9591('0xd')](),controller[_0x9591('0x15')]);router[_0x9591('0x16')](_0x9591('0xc'),auth[_0x9591('0xd')](),controller['update']);router[_0x9591('0x17')](_0x9591('0xc'),auth[_0x9591('0xd')](),controller['destroy']);module[_0x9591('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4bacc21..e7f9451 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 _0xdb1a=['sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb1a,0x17a));var _0xadb1=function(_0x16550c,_0x54d7ad){_0x16550c=_0x16550c-0x0;var _0x5a211b=_0xdb1a[_0x16550c];return _0x5a211b;};'use strict';var Sequelize=require(_0xadb1('0x0'));module[_0xadb1('0x1')]={'name':{'type':Sequelize[_0xadb1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xee27=['exports'];(function(_0x5bbc6d,_0x12fe93){var _0x5c9a99=function(_0x5d2d68){while(--_0x5d2d68){_0x5bbc6d['push'](_0x5bbc6d['shift']());}};_0x5c9a99(++_0x12fe93);}(_0xee27,0x13b));var _0x7ee2=function(_0x2fb5c6,_0x4680d3){_0x2fb5c6=_0x2fb5c6-0x0;var _0x12c174=_0xee27[_0x2fb5c6];return _0x12c174;};'use strict';var Sequelize=require('sequelize');module[_0x7ee2('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 01d7ad2..69ca9fb 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 _0x033e=['end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','map','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','FreshsalesConfiguration','includeAll','include','findAll','rows','show','find','create','body','catch','params','getSubjects','getDescriptions','findOne','getFields','FreshsalesField','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2f21cf,_0x21b265){var _0x140461=function(_0x5a0ea5){while(--_0x5a0ea5){_0x2f21cf['push'](_0x2f21cf['shift']());}};_0x140461(++_0x21b265);}(_0x033e,0x87));var _0xe033=function(_0x41dcd2,_0x21abc9){_0x41dcd2=_0x41dcd2-0x0;var _0x3a0604=_0x033e[_0x41dcd2];return _0x3a0604;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe033('0x0'));var zipdir=require(_0xe033('0x1'));var jsonpatch=require(_0xe033('0x2'));var rp=require(_0xe033('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe033('0x4'));var path=require(_0xe033('0x5'));var sox=require(_0xe033('0x6'));var csv=require(_0xe033('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe033('0x8'));var _=require(_0xe033('0x9'));var squel=require('squel');var crypto=require(_0xe033('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe033('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe033('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe033('0xd'));var qs=require(_0xe033('0xe'));var as=require(_0xe033('0xf'));var hardwareService=require(_0xe033('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe033('0x11'));var config=require(_0xe033('0x12'));var licenseUtil=require(_0xe033('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c9e98,_0x3eaf45){_0x3eaf45=_0x3eaf45||0xcc;return function(_0xdbdfc8){if(_0xdbdfc8){return _0x5c9e98[_0xe033('0x14')](_0x3eaf45);}return _0x5c9e98['status'](_0x3eaf45)[_0xe033('0x15')]();};}function respondWithResult(_0x1e7494,_0x2cb37d){_0x2cb37d=_0x2cb37d||0xc8;return function(_0x260124){if(_0x260124){return _0x1e7494[_0xe033('0x16')](_0x2cb37d)[_0xe033('0x17')](_0x260124);}};}function respondWithFilteredResult(_0x35f136,_0x312d0d){return function(_0x16e442){if(_0x16e442){var _0x33c72a=typeof _0x312d0d[_0xe033('0x18')]==='undefined'&&typeof _0x312d0d['limit']===_0xe033('0x19');var _0xa98e22=_0x16e442[_0xe033('0x1a')];var _0x52272b=_0x33c72a?0x0:_0x312d0d['offset'];var _0x28329b=_0x33c72a?_0x16e442[_0xe033('0x1a')]:_0x312d0d[_0xe033('0x18')]+_0x312d0d['limit'];var _0x4faf03;if(_0x28329b>=_0xa98e22){_0x28329b=_0xa98e22;_0x4faf03=0xc8;}else{_0x4faf03=0xce;}_0x35f136[_0xe033('0x16')](_0x4faf03);return _0x35f136['set'](_0xe033('0x1b'),_0x52272b+'-'+_0x28329b+'/'+_0xa98e22)[_0xe033('0x17')](_0x16e442);}return null;};}function patchUpdates(_0x3049fb){return function(_0x3dfcd4){try{jsonpatch[_0xe033('0x1c')](_0x3dfcd4,_0x3049fb,!![]);}catch(_0x881642){return BPromise[_0xe033('0x1d')](_0x881642);}return _0x3dfcd4[_0xe033('0x1e')]();};}function saveUpdates(_0x3bd381,_0x114436){return function(_0x3ef474){if(_0x3ef474){return _0x3ef474[_0xe033('0x1f')](_0x3bd381)[_0xe033('0x20')](function(_0x28bac4){return _0x28bac4;});}return null;};}function removeEntity(_0x4b22b8,_0x23f4d8){return function(_0x44cc45){if(_0x44cc45){return _0x44cc45[_0xe033('0x21')]()['then'](function(){_0x4b22b8[_0xe033('0x16')](0xcc)[_0xe033('0x15')]();});}};}function handleEntityNotFound(_0x16dd5e,_0x24e8f5){return function(_0x1197be){if(!_0x1197be){_0x16dd5e[_0xe033('0x14')](0x194);}return _0x1197be;};}function handleError(_0x53dd26,_0x21aeb6){_0x21aeb6=_0x21aeb6||0x1f4;return function(_0x405ac3){logger[_0xe033('0x22')](_0x405ac3[_0xe033('0x23')]);if(_0x405ac3['name']){delete _0x405ac3['name'];}_0x53dd26[_0xe033('0x16')](_0x21aeb6)[_0xe033('0x24')](_0x405ac3);};}exports[_0xe033('0x25')]=function(_0x4cecf9,_0x52d194){var _0x44e63f={},_0x112aa8={},_0x59971f={'count':0x0,'rows':[]};var _0x4e5157=_['map'](db['FreshsalesConfiguration'][_0xe033('0x26')],function(_0x20a708){return{'name':_0x20a708[_0xe033('0x27')],'type':_0x20a708[_0xe033('0x28')][_0xe033('0x29')]};});_0x112aa8['model']=_[_0xe033('0x2a')](_0x4e5157,_0xe033('0x2b'));_0x112aa8['query']=_[_0xe033('0x2c')](_0x4cecf9[_0xe033('0x2d')]);_0x112aa8[_0xe033('0x2e')]=_[_0xe033('0x2f')](_0x112aa8[_0xe033('0x30')],_0x112aa8[_0xe033('0x2d')]);_0x44e63f['attributes']=_[_0xe033('0x2f')](_0x112aa8[_0xe033('0x30')],qs[_0xe033('0x31')](_0x4cecf9[_0xe033('0x2d')][_0xe033('0x31')]));_0x44e63f['attributes']=_0x44e63f[_0xe033('0x32')][_0xe033('0x33')]?_0x44e63f[_0xe033('0x32')]:_0x112aa8[_0xe033('0x30')];if(!_0x4cecf9[_0xe033('0x2d')][_0xe033('0x34')](_0xe033('0x35'))){_0x44e63f['limit']=qs[_0xe033('0x36')](_0x4cecf9[_0xe033('0x2d')][_0xe033('0x36')]);_0x44e63f[_0xe033('0x18')]=qs[_0xe033('0x18')](_0x4cecf9['query'][_0xe033('0x18')]);}_0x44e63f[_0xe033('0x37')]=qs[_0xe033('0x38')](_0x4cecf9['query'][_0xe033('0x38')]);_0x44e63f[_0xe033('0x39')]=qs[_0xe033('0x2e')](_[_0xe033('0x3a')](_0x4cecf9['query'],_0x112aa8[_0xe033('0x2e')]),_0x4e5157);if(_0x4cecf9[_0xe033('0x2d')]['filter']){_0x44e63f[_0xe033('0x39')]=_[_0xe033('0x3b')](_0x44e63f[_0xe033('0x39')],{'$or':_['map'](_0x4e5157,function(_0x388043){if(_0x388043[_0xe033('0x28')]!=='VIRTUAL'){var _0x52dde6={};_0x52dde6[_0x388043[_0xe033('0x2b')]]={'$like':'%'+_0x4cecf9[_0xe033('0x2d')][_0xe033('0x3c')]+'%'};return _0x52dde6;}})});}_0x44e63f=_[_0xe033('0x3b')]({},_0x44e63f,_0x4cecf9[_0xe033('0x3d')]);var _0x323873={'where':_0x44e63f[_0xe033('0x39')]};return db[_0xe033('0x3e')][_0xe033('0x1a')](_0x323873)['then'](function(_0x3daa9c){_0x59971f['count']=_0x3daa9c;if(_0x4cecf9[_0xe033('0x2d')][_0xe033('0x3f')]){_0x44e63f[_0xe033('0x40')]=[{'all':!![]}];}return db[_0xe033('0x3e')][_0xe033('0x41')](_0x44e63f);})[_0xe033('0x20')](function(_0x336cb7){_0x59971f[_0xe033('0x42')]=_0x336cb7;return _0x59971f;})[_0xe033('0x20')](respondWithFilteredResult(_0x52d194,_0x44e63f))['catch'](handleError(_0x52d194,null));};exports[_0xe033('0x43')]=function(_0x5df62b,_0x223066){var _0x10c64b={'raw':![],'where':{'id':_0x5df62b['params']['id']}},_0x4a4d1d={};_0x4a4d1d[_0xe033('0x30')]=_['keys'](db[_0xe033('0x3e')][_0xe033('0x26')]);_0x4a4d1d['query']=_[_0xe033('0x2c')](_0x5df62b[_0xe033('0x2d')]);_0x4a4d1d[_0xe033('0x2e')]=_['intersection'](_0x4a4d1d['model'],_0x4a4d1d['query']);_0x10c64b['attributes']=_['intersection'](_0x4a4d1d[_0xe033('0x30')],qs[_0xe033('0x31')](_0x5df62b[_0xe033('0x2d')][_0xe033('0x31')]));_0x10c64b['attributes']=_0x10c64b[_0xe033('0x32')][_0xe033('0x33')]?_0x10c64b[_0xe033('0x32')]:_0x4a4d1d['model'];if(_0x5df62b[_0xe033('0x2d')][_0xe033('0x3f')]){_0x10c64b[_0xe033('0x40')]=[{'all':!![]}];}_0x10c64b=_[_0xe033('0x3b')]({},_0x10c64b,_0x5df62b[_0xe033('0x3d')]);return db[_0xe033('0x3e')][_0xe033('0x44')](_0x10c64b)[_0xe033('0x20')](handleEntityNotFound(_0x223066,null))[_0xe033('0x20')](respondWithResult(_0x223066,null))['catch'](handleError(_0x223066,null));};exports[_0xe033('0x45')]=function(_0x1113a8,_0x1716c9){return db[_0xe033('0x3e')]['create'](_0x1113a8['body'],{})[_0xe033('0x20')](respondWithResult(_0x1716c9,0xc9))['catch'](handleError(_0x1716c9,null));};exports[_0xe033('0x1f')]=function(_0x2e41ed,_0x5228c5){if(_0x2e41ed[_0xe033('0x46')]['id']){delete _0x2e41ed[_0xe033('0x46')]['id'];}return db[_0xe033('0x3e')]['find']({'where':{'id':_0x2e41ed['params']['id']}})[_0xe033('0x20')](handleEntityNotFound(_0x5228c5,null))[_0xe033('0x20')](saveUpdates(_0x2e41ed[_0xe033('0x46')],null))[_0xe033('0x20')](respondWithResult(_0x5228c5,null))[_0xe033('0x47')](handleError(_0x5228c5,null));};exports[_0xe033('0x21')]=function(_0x5dee2c,_0x258701){return db[_0xe033('0x3e')][_0xe033('0x44')]({'where':{'id':_0x5dee2c['params']['id']}})[_0xe033('0x20')](handleEntityNotFound(_0x258701,null))[_0xe033('0x20')](removeEntity(_0x258701,null))[_0xe033('0x47')](handleError(_0x258701,null));};exports['getSubjects']=function(_0x54ce89,_0x3bbe94,_0x2e8c2f){var _0x333715={};var _0x4a7ac7={};var _0x3d95d5;var _0x52c2b1;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x54ce89[_0xe033('0x48')]['id']}})[_0xe033('0x20')](handleEntityNotFound(_0x3bbe94,null))[_0xe033('0x20')](function(_0x131e8f){if(_0x131e8f){_0x3d95d5=_0x131e8f;_0x4a7ac7['model']=_[_0xe033('0x2c')](db['FreshsalesField'][_0xe033('0x26')]);_0x4a7ac7['query']=_[_0xe033('0x2c')](_0x54ce89[_0xe033('0x2d')]);_0x4a7ac7[_0xe033('0x2e')]=_[_0xe033('0x2f')](_0x4a7ac7[_0xe033('0x30')],_0x4a7ac7['query']);_0x333715[_0xe033('0x32')]=_[_0xe033('0x2f')](_0x4a7ac7[_0xe033('0x30')],qs[_0xe033('0x31')](_0x54ce89['query'][_0xe033('0x31')]));_0x333715[_0xe033('0x32')]=_0x333715[_0xe033('0x32')][_0xe033('0x33')]?_0x333715[_0xe033('0x32')]:_0x4a7ac7[_0xe033('0x30')];_0x333715['order']=qs['sort'](_0x54ce89[_0xe033('0x2d')]['sort']);_0x333715[_0xe033('0x39')]=qs[_0xe033('0x2e')](_[_0xe033('0x3a')](_0x54ce89[_0xe033('0x2d')],_0x4a7ac7['filters']));if(_0x54ce89['query']['filter']){_0x333715[_0xe033('0x39')]=_['merge'](_0x333715[_0xe033('0x39')],{'$or':_[_0xe033('0x2a')](_0x333715[_0xe033('0x32')],function(_0x5a34b9){var _0x44be9d={};_0x44be9d[_0x5a34b9]={'$like':'%'+_0x54ce89[_0xe033('0x2d')]['filter']+'%'};return _0x44be9d;})});}_0x333715=_['merge']({},_0x333715,_0x54ce89[_0xe033('0x3d')]);return _0x3d95d5[_0xe033('0x49')](_0x333715);}})[_0xe033('0x20')](function(_0x39c235){if(_0x39c235){_0x52c2b1=_0x39c235[_0xe033('0x33')];if(!_0x54ce89['query'][_0xe033('0x34')](_0xe033('0x35'))){_0x333715[_0xe033('0x36')]=qs[_0xe033('0x36')](_0x54ce89[_0xe033('0x2d')][_0xe033('0x36')]);_0x333715['offset']=qs['offset'](_0x54ce89[_0xe033('0x2d')][_0xe033('0x18')]);}return _0x3d95d5[_0xe033('0x49')](_0x333715);}})[_0xe033('0x20')](function(_0x357134){if(_0x357134){return _0x357134?{'count':_0x52c2b1,'rows':_0x357134}:null;}})[_0xe033('0x20')](respondWithResult(_0x3bbe94,null))[_0xe033('0x47')](handleError(_0x3bbe94,null));};exports[_0xe033('0x4a')]=function(_0x291f3a,_0x5b803e,_0x5c6334){var _0x4b5a47={};var _0x34af84={};var _0x2fe2ba;var _0x139ad0;return db[_0xe033('0x3e')][_0xe033('0x4b')]({'where':{'id':_0x291f3a['params']['id']}})[_0xe033('0x20')](handleEntityNotFound(_0x5b803e,null))['then'](function(_0x2d2982){if(_0x2d2982){_0x2fe2ba=_0x2d2982;_0x34af84[_0xe033('0x30')]=_[_0xe033('0x2c')](db['FreshsalesField'][_0xe033('0x26')]);_0x34af84[_0xe033('0x2d')]=_[_0xe033('0x2c')](_0x291f3a[_0xe033('0x2d')]);_0x34af84['filters']=_[_0xe033('0x2f')](_0x34af84[_0xe033('0x30')],_0x34af84[_0xe033('0x2d')]);_0x4b5a47[_0xe033('0x32')]=_[_0xe033('0x2f')](_0x34af84[_0xe033('0x30')],qs[_0xe033('0x31')](_0x291f3a[_0xe033('0x2d')][_0xe033('0x31')]));_0x4b5a47[_0xe033('0x32')]=_0x4b5a47[_0xe033('0x32')]['length']?_0x4b5a47['attributes']:_0x34af84[_0xe033('0x30')];_0x4b5a47[_0xe033('0x37')]=qs['sort'](_0x291f3a[_0xe033('0x2d')][_0xe033('0x38')]);_0x4b5a47[_0xe033('0x39')]=qs[_0xe033('0x2e')](_[_0xe033('0x3a')](_0x291f3a['query'],_0x34af84['filters']));if(_0x291f3a[_0xe033('0x2d')]['filter']){_0x4b5a47[_0xe033('0x39')]=_[_0xe033('0x3b')](_0x4b5a47['where'],{'$or':_[_0xe033('0x2a')](_0x4b5a47[_0xe033('0x32')],function(_0x547bd0){var _0x22d39a={};_0x22d39a[_0x547bd0]={'$like':'%'+_0x291f3a[_0xe033('0x2d')][_0xe033('0x3c')]+'%'};return _0x22d39a;})});}_0x4b5a47=_[_0xe033('0x3b')]({},_0x4b5a47,_0x291f3a['options']);return _0x2fe2ba[_0xe033('0x4a')](_0x4b5a47);}})[_0xe033('0x20')](function(_0x210ba7){if(_0x210ba7){_0x139ad0=_0x210ba7['length'];if(!_0x291f3a[_0xe033('0x2d')][_0xe033('0x34')](_0xe033('0x35'))){_0x4b5a47[_0xe033('0x36')]=qs[_0xe033('0x36')](_0x291f3a['query'][_0xe033('0x36')]);_0x4b5a47[_0xe033('0x18')]=qs[_0xe033('0x18')](_0x291f3a['query'][_0xe033('0x18')]);}return _0x2fe2ba[_0xe033('0x4a')](_0x4b5a47);}})['then'](function(_0x23656a){if(_0x23656a){return _0x23656a?{'count':_0x139ad0,'rows':_0x23656a}:null;}})[_0xe033('0x20')](respondWithResult(_0x5b803e,null))['catch'](handleError(_0x5b803e,null));};exports[_0xe033('0x4c')]=function(_0x4c6482,_0x338fa7,_0x39a029){var _0x27b717={};var _0x120f4e={};var _0x4afd1c;var _0x4cd845;return db[_0xe033('0x3e')][_0xe033('0x4b')]({'where':{'id':_0x4c6482[_0xe033('0x48')]['id']}})[_0xe033('0x20')](handleEntityNotFound(_0x338fa7,null))[_0xe033('0x20')](function(_0x26eed7){if(_0x26eed7){_0x4afd1c=_0x26eed7;_0x120f4e[_0xe033('0x30')]=_[_0xe033('0x2c')](db[_0xe033('0x4d')][_0xe033('0x26')]);_0x120f4e[_0xe033('0x2d')]=_[_0xe033('0x2c')](_0x4c6482['query']);_0x120f4e[_0xe033('0x2e')]=_[_0xe033('0x2f')](_0x120f4e['model'],_0x120f4e[_0xe033('0x2d')]);_0x27b717[_0xe033('0x32')]=_[_0xe033('0x2f')](_0x120f4e[_0xe033('0x30')],qs[_0xe033('0x31')](_0x4c6482[_0xe033('0x2d')][_0xe033('0x31')]));_0x27b717[_0xe033('0x32')]=_0x27b717[_0xe033('0x32')][_0xe033('0x33')]?_0x27b717[_0xe033('0x32')]:_0x120f4e['model'];_0x27b717['order']=qs[_0xe033('0x38')](_0x4c6482[_0xe033('0x2d')]['sort']);_0x27b717[_0xe033('0x39')]=qs[_0xe033('0x2e')](_[_0xe033('0x3a')](_0x4c6482[_0xe033('0x2d')],_0x120f4e[_0xe033('0x2e')]));if(_0x4c6482[_0xe033('0x2d')]['filter']){_0x27b717['where']=_[_0xe033('0x3b')](_0x27b717[_0xe033('0x39')],{'$or':_[_0xe033('0x2a')](_0x27b717[_0xe033('0x32')],function(_0x1b84e3){var _0x50d3b1={};_0x50d3b1[_0x1b84e3]={'$like':'%'+_0x4c6482['query'][_0xe033('0x3c')]+'%'};return _0x50d3b1;})});}_0x27b717=_[_0xe033('0x3b')]({},_0x27b717,_0x4c6482[_0xe033('0x3d')]);return _0x4afd1c[_0xe033('0x4c')](_0x27b717);}})['then'](function(_0x311a40){if(_0x311a40){_0x4cd845=_0x311a40[_0xe033('0x33')];if(!_0x4c6482[_0xe033('0x2d')]['hasOwnProperty']('nolimit')){_0x27b717['limit']=qs[_0xe033('0x36')](_0x4c6482[_0xe033('0x2d')][_0xe033('0x36')]);_0x27b717['offset']=qs['offset'](_0x4c6482['query']['offset']);}return _0x4afd1c[_0xe033('0x4c')](_0x27b717);}})[_0xe033('0x20')](function(_0x5e201d){if(_0x5e201d){return _0x5e201d?{'count':_0x4cd845,'rows':_0x5e201d}:null;}})['then'](respondWithResult(_0x338fa7,null))[_0xe033('0x47')](handleError(_0x338fa7,null));}; \ No newline at end of file +var _0x3531=['includeAll','include','show','params','find','create','body','catch','getSubjects','findOne','options','getDescriptions','getFields','FreshsalesField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL'];(function(_0x44e7b9,_0xf7f5cc){var _0x1de7ac=function(_0x307551){while(--_0x307551){_0x44e7b9['push'](_0x44e7b9['shift']());}};_0x1de7ac(++_0xf7f5cc);}(_0x3531,0xfe));var _0x1353=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3531[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x1353('0x0'));var rimraf=require(_0x1353('0x1'));var zipdir=require(_0x1353('0x2'));var jsonpatch=require(_0x1353('0x3'));var rp=require(_0x1353('0x4'));var moment=require(_0x1353('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1353('0x6'));var util=require(_0x1353('0x7'));var path=require(_0x1353('0x8'));var sox=require(_0x1353('0x9'));var csv=require(_0x1353('0xa'));var ejs=require(_0x1353('0xb'));var fs=require('fs');var fs_extra=require(_0x1353('0xc'));var _=require(_0x1353('0xd'));var squel=require(_0x1353('0xe'));var crypto=require('crypto');var jsforce=require(_0x1353('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1353('0x10'));var Papa=require(_0x1353('0x11'));var Redis=require(_0x1353('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1353('0x13'));var hardwareService=require(_0x1353('0x14'));var logger=require(_0x1353('0x15'))('api');var utils=require(_0x1353('0x16'));var config=require(_0x1353('0x17'));var licenseUtil=require(_0x1353('0x18'));var db=require(_0x1353('0x19'))['db'];function respondWithStatusCode(_0xbf561c,_0x109ce8){_0x109ce8=_0x109ce8||0xcc;return function(_0x3eae5e){if(_0x3eae5e){return _0xbf561c[_0x1353('0x1a')](_0x109ce8);}return _0xbf561c[_0x1353('0x1b')](_0x109ce8)[_0x1353('0x1c')]();};}function respondWithResult(_0x105fb8,_0x21f980){_0x21f980=_0x21f980||0xc8;return function(_0xe60037){if(_0xe60037){return _0x105fb8['status'](_0x21f980)[_0x1353('0x1d')](_0xe60037);}};}function respondWithFilteredResult(_0xd90128,_0x479428){return function(_0x52b7ef){if(_0x52b7ef){var _0x1d599f=typeof _0x479428['offset']==='undefined'&&typeof _0x479428[_0x1353('0x1e')]==='undefined';var _0x22b472=_0x52b7ef['count'];var _0x4d4dbc=_0x1d599f?0x0:_0x479428[_0x1353('0x1f')];var _0x157b38=_0x1d599f?_0x52b7ef[_0x1353('0x20')]:_0x479428['offset']+_0x479428[_0x1353('0x1e')];var _0x5b1f95;if(_0x157b38>=_0x22b472){_0x157b38=_0x22b472;_0x5b1f95=0xc8;}else{_0x5b1f95=0xce;}_0xd90128['status'](_0x5b1f95);return _0xd90128[_0x1353('0x21')]('Content-Range',_0x4d4dbc+'-'+_0x157b38+'/'+_0x22b472)[_0x1353('0x1d')](_0x52b7ef);}return null;};}function patchUpdates(_0x4c0b10){return function(_0x1328fb){try{jsonpatch[_0x1353('0x22')](_0x1328fb,_0x4c0b10,!![]);}catch(_0x51508b){return BPromise[_0x1353('0x23')](_0x51508b);}return _0x1328fb[_0x1353('0x24')]();};}function saveUpdates(_0xfdd52f,_0x12047f){return function(_0x5bf960){if(_0x5bf960){return _0x5bf960[_0x1353('0x25')](_0xfdd52f)[_0x1353('0x26')](function(_0x70325){return _0x70325;});}return null;};}function removeEntity(_0x4feccf,_0x41e5a3){return function(_0x3538ab){if(_0x3538ab){return _0x3538ab[_0x1353('0x27')]()[_0x1353('0x26')](function(){_0x4feccf[_0x1353('0x1b')](0xcc)[_0x1353('0x1c')]();});}};}function handleEntityNotFound(_0x118ea0,_0x330369){return function(_0x38b8b6){if(!_0x38b8b6){_0x118ea0[_0x1353('0x1a')](0x194);}return _0x38b8b6;};}function handleError(_0xb7d8ab,_0x549ae9){_0x549ae9=_0x549ae9||0x1f4;return function(_0x125e90){logger[_0x1353('0x28')](_0x125e90[_0x1353('0x29')]);if(_0x125e90[_0x1353('0x2a')]){delete _0x125e90[_0x1353('0x2a')];}_0xb7d8ab[_0x1353('0x1b')](_0x549ae9)['send'](_0x125e90);};}exports[_0x1353('0x2b')]=function(_0x18625f,_0x52643d){var _0x5437c6={},_0x4abbe7={},_0x2b7ab7={'count':0x0,'rows':[]};var _0x3ec948=_['map'](db[_0x1353('0x2c')][_0x1353('0x2d')],function(_0x5ea183){return{'name':_0x5ea183[_0x1353('0x2e')],'type':_0x5ea183[_0x1353('0x2f')]['key']};});_0x4abbe7[_0x1353('0x30')]=_['map'](_0x3ec948,_0x1353('0x2a'));_0x4abbe7[_0x1353('0x31')]=_[_0x1353('0x32')](_0x18625f['query']);_0x4abbe7['filters']=_[_0x1353('0x33')](_0x4abbe7['model'],_0x4abbe7['query']);_0x5437c6['attributes']=_[_0x1353('0x33')](_0x4abbe7['model'],qs['fields'](_0x18625f[_0x1353('0x31')][_0x1353('0x34')]));_0x5437c6[_0x1353('0x35')]=_0x5437c6['attributes'][_0x1353('0x36')]?_0x5437c6[_0x1353('0x35')]:_0x4abbe7['model'];if(!_0x18625f[_0x1353('0x31')][_0x1353('0x37')](_0x1353('0x38'))){_0x5437c6[_0x1353('0x1e')]=qs['limit'](_0x18625f[_0x1353('0x31')][_0x1353('0x1e')]);_0x5437c6[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x18625f[_0x1353('0x31')][_0x1353('0x1f')]);}_0x5437c6[_0x1353('0x39')]=qs[_0x1353('0x3a')](_0x18625f['query'][_0x1353('0x3a')]);_0x5437c6[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x18625f[_0x1353('0x31')],_0x4abbe7[_0x1353('0x3c')]),_0x3ec948);if(_0x18625f[_0x1353('0x31')][_0x1353('0x3e')]){_0x5437c6[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x5437c6['where'],{'$or':_[_0x1353('0x40')](_0x3ec948,function(_0x696971){if(_0x696971[_0x1353('0x2f')]!==_0x1353('0x41')){var _0x4fb9de={};_0x4fb9de[_0x696971['name']]={'$like':'%'+_0x18625f['query'][_0x1353('0x3e')]+'%'};return _0x4fb9de;}})});}_0x5437c6=_[_0x1353('0x3f')]({},_0x5437c6,_0x18625f['options']);var _0x46b9d9={'where':_0x5437c6[_0x1353('0x3b')]};return db['FreshsalesConfiguration'][_0x1353('0x20')](_0x46b9d9)[_0x1353('0x26')](function(_0x24fef9){_0x2b7ab7[_0x1353('0x20')]=_0x24fef9;if(_0x18625f[_0x1353('0x31')][_0x1353('0x42')]){_0x5437c6[_0x1353('0x43')]=[{'all':!![]}];}return db[_0x1353('0x2c')]['findAll'](_0x5437c6);})[_0x1353('0x26')](function(_0x12df64){_0x2b7ab7['rows']=_0x12df64;return _0x2b7ab7;})[_0x1353('0x26')](respondWithFilteredResult(_0x52643d,_0x5437c6))['catch'](handleError(_0x52643d,null));};exports[_0x1353('0x44')]=function(_0x5881b7,_0x521051){var _0x462565={'raw':![],'where':{'id':_0x5881b7[_0x1353('0x45')]['id']}},_0x42daf8={};_0x42daf8[_0x1353('0x30')]=_['keys'](db['FreshsalesConfiguration'][_0x1353('0x2d')]);_0x42daf8['query']=_[_0x1353('0x32')](_0x5881b7[_0x1353('0x31')]);_0x42daf8['filters']=_['intersection'](_0x42daf8['model'],_0x42daf8[_0x1353('0x31')]);_0x462565[_0x1353('0x35')]=_[_0x1353('0x33')](_0x42daf8[_0x1353('0x30')],qs[_0x1353('0x34')](_0x5881b7[_0x1353('0x31')][_0x1353('0x34')]));_0x462565[_0x1353('0x35')]=_0x462565[_0x1353('0x35')][_0x1353('0x36')]?_0x462565['attributes']:_0x42daf8[_0x1353('0x30')];if(_0x5881b7[_0x1353('0x31')][_0x1353('0x42')]){_0x462565[_0x1353('0x43')]=[{'all':!![]}];}_0x462565=_[_0x1353('0x3f')]({},_0x462565,_0x5881b7['options']);return db[_0x1353('0x2c')][_0x1353('0x46')](_0x462565)[_0x1353('0x26')](handleEntityNotFound(_0x521051,null))['then'](respondWithResult(_0x521051,null))['catch'](handleError(_0x521051,null));};exports[_0x1353('0x47')]=function(_0x4224f6,_0x5ac302){return db[_0x1353('0x2c')][_0x1353('0x47')](_0x4224f6[_0x1353('0x48')],{})[_0x1353('0x26')](respondWithResult(_0x5ac302,0xc9))['catch'](handleError(_0x5ac302,null));};exports[_0x1353('0x25')]=function(_0x54e3e6,_0x1f36ca){if(_0x54e3e6[_0x1353('0x48')]['id']){delete _0x54e3e6[_0x1353('0x48')]['id'];}return db[_0x1353('0x2c')][_0x1353('0x46')]({'where':{'id':_0x54e3e6[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x1f36ca,null))[_0x1353('0x26')](saveUpdates(_0x54e3e6[_0x1353('0x48')],null))['then'](respondWithResult(_0x1f36ca,null))[_0x1353('0x49')](handleError(_0x1f36ca,null));};exports['destroy']=function(_0x100afd,_0x4bce7f){return db[_0x1353('0x2c')][_0x1353('0x46')]({'where':{'id':_0x100afd[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x4bce7f,null))['then'](removeEntity(_0x4bce7f,null))['catch'](handleError(_0x4bce7f,null));};exports[_0x1353('0x4a')]=function(_0x3dd0da,_0x4b1864,_0x2baeaa){var _0x3b55c1={};var _0x560bc4={};var _0x3091aa;var _0x24e31e;return db[_0x1353('0x2c')][_0x1353('0x4b')]({'where':{'id':_0x3dd0da[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x4b1864,null))[_0x1353('0x26')](function(_0x1b9979){if(_0x1b9979){_0x3091aa=_0x1b9979;_0x560bc4[_0x1353('0x30')]=_['keys'](db['FreshsalesField'][_0x1353('0x2d')]);_0x560bc4[_0x1353('0x31')]=_[_0x1353('0x32')](_0x3dd0da[_0x1353('0x31')]);_0x560bc4['filters']=_[_0x1353('0x33')](_0x560bc4[_0x1353('0x30')],_0x560bc4[_0x1353('0x31')]);_0x3b55c1[_0x1353('0x35')]=_[_0x1353('0x33')](_0x560bc4[_0x1353('0x30')],qs['fields'](_0x3dd0da[_0x1353('0x31')]['fields']));_0x3b55c1[_0x1353('0x35')]=_0x3b55c1['attributes'][_0x1353('0x36')]?_0x3b55c1[_0x1353('0x35')]:_0x560bc4[_0x1353('0x30')];_0x3b55c1['order']=qs['sort'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x3a')]);_0x3b55c1[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x3dd0da[_0x1353('0x31')],_0x560bc4[_0x1353('0x3c')]));if(_0x3dd0da[_0x1353('0x31')]['filter']){_0x3b55c1[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x3b55c1['where'],{'$or':_[_0x1353('0x40')](_0x3b55c1[_0x1353('0x35')],function(_0x2a6e32){var _0xcbecef={};_0xcbecef[_0x2a6e32]={'$like':'%'+_0x3dd0da[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0xcbecef;})});}_0x3b55c1=_[_0x1353('0x3f')]({},_0x3b55c1,_0x3dd0da[_0x1353('0x4c')]);return _0x3091aa['getSubjects'](_0x3b55c1);}})[_0x1353('0x26')](function(_0x473379){if(_0x473379){_0x24e31e=_0x473379[_0x1353('0x36')];if(!_0x3dd0da['query']['hasOwnProperty'](_0x1353('0x38'))){_0x3b55c1[_0x1353('0x1e')]=qs['limit'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x1e')]);_0x3b55c1[_0x1353('0x1f')]=qs['offset'](_0x3dd0da[_0x1353('0x31')][_0x1353('0x1f')]);}return _0x3091aa[_0x1353('0x4a')](_0x3b55c1);}})[_0x1353('0x26')](function(_0x54d48f){if(_0x54d48f){return _0x54d48f?{'count':_0x24e31e,'rows':_0x54d48f}:null;}})[_0x1353('0x26')](respondWithResult(_0x4b1864,null))['catch'](handleError(_0x4b1864,null));};exports['getDescriptions']=function(_0x1ae4fd,_0x3af36b,_0x36a35f){var _0x229114={};var _0x186121={};var _0xf7c29c;var _0x515735;return db[_0x1353('0x2c')][_0x1353('0x4b')]({'where':{'id':_0x1ae4fd['params']['id']}})[_0x1353('0x26')](handleEntityNotFound(_0x3af36b,null))[_0x1353('0x26')](function(_0x9dd215){if(_0x9dd215){_0xf7c29c=_0x9dd215;_0x186121[_0x1353('0x30')]=_[_0x1353('0x32')](db['FreshsalesField'][_0x1353('0x2d')]);_0x186121[_0x1353('0x31')]=_[_0x1353('0x32')](_0x1ae4fd[_0x1353('0x31')]);_0x186121[_0x1353('0x3c')]=_[_0x1353('0x33')](_0x186121['model'],_0x186121[_0x1353('0x31')]);_0x229114[_0x1353('0x35')]=_['intersection'](_0x186121['model'],qs['fields'](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x34')]));_0x229114[_0x1353('0x35')]=_0x229114[_0x1353('0x35')][_0x1353('0x36')]?_0x229114[_0x1353('0x35')]:_0x186121[_0x1353('0x30')];_0x229114['order']=qs['sort'](_0x1ae4fd['query'][_0x1353('0x3a')]);_0x229114['where']=qs[_0x1353('0x3c')](_[_0x1353('0x3d')](_0x1ae4fd[_0x1353('0x31')],_0x186121[_0x1353('0x3c')]));if(_0x1ae4fd[_0x1353('0x31')][_0x1353('0x3e')]){_0x229114[_0x1353('0x3b')]=_[_0x1353('0x3f')](_0x229114[_0x1353('0x3b')],{'$or':_['map'](_0x229114[_0x1353('0x35')],function(_0x5b7c78){var _0x11dfbd={};_0x11dfbd[_0x5b7c78]={'$like':'%'+_0x1ae4fd[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0x11dfbd;})});}_0x229114=_[_0x1353('0x3f')]({},_0x229114,_0x1ae4fd[_0x1353('0x4c')]);return _0xf7c29c[_0x1353('0x4d')](_0x229114);}})['then'](function(_0x3792d3){if(_0x3792d3){_0x515735=_0x3792d3[_0x1353('0x36')];if(!_0x1ae4fd['query'][_0x1353('0x37')](_0x1353('0x38'))){_0x229114[_0x1353('0x1e')]=qs['limit'](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x1e')]);_0x229114[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x1ae4fd[_0x1353('0x31')][_0x1353('0x1f')]);}return _0xf7c29c[_0x1353('0x4d')](_0x229114);}})[_0x1353('0x26')](function(_0x29ea5d){if(_0x29ea5d){return _0x29ea5d?{'count':_0x515735,'rows':_0x29ea5d}:null;}})['then'](respondWithResult(_0x3af36b,null))[_0x1353('0x49')](handleError(_0x3af36b,null));};exports[_0x1353('0x4e')]=function(_0x4a1df1,_0xf6801f,_0x3e71be){var _0x4d0455={};var _0x5a5409={};var _0x54dfe9;var _0x459c7a;return db[_0x1353('0x2c')]['findOne']({'where':{'id':_0x4a1df1[_0x1353('0x45')]['id']}})[_0x1353('0x26')](handleEntityNotFound(_0xf6801f,null))[_0x1353('0x26')](function(_0x4404e4){if(_0x4404e4){_0x54dfe9=_0x4404e4;_0x5a5409[_0x1353('0x30')]=_[_0x1353('0x32')](db[_0x1353('0x4f')][_0x1353('0x2d')]);_0x5a5409[_0x1353('0x31')]=_[_0x1353('0x32')](_0x4a1df1[_0x1353('0x31')]);_0x5a5409[_0x1353('0x3c')]=_[_0x1353('0x33')](_0x5a5409[_0x1353('0x30')],_0x5a5409[_0x1353('0x31')]);_0x4d0455['attributes']=_[_0x1353('0x33')](_0x5a5409[_0x1353('0x30')],qs[_0x1353('0x34')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x34')]));_0x4d0455[_0x1353('0x35')]=_0x4d0455[_0x1353('0x35')]['length']?_0x4d0455[_0x1353('0x35')]:_0x5a5409['model'];_0x4d0455[_0x1353('0x39')]=qs['sort'](_0x4a1df1['query'][_0x1353('0x3a')]);_0x4d0455[_0x1353('0x3b')]=qs[_0x1353('0x3c')](_['pick'](_0x4a1df1[_0x1353('0x31')],_0x5a5409[_0x1353('0x3c')]));if(_0x4a1df1[_0x1353('0x31')][_0x1353('0x3e')]){_0x4d0455[_0x1353('0x3b')]=_['merge'](_0x4d0455[_0x1353('0x3b')],{'$or':_[_0x1353('0x40')](_0x4d0455[_0x1353('0x35')],function(_0x2a8105){var _0x340770={};_0x340770[_0x2a8105]={'$like':'%'+_0x4a1df1[_0x1353('0x31')][_0x1353('0x3e')]+'%'};return _0x340770;})});}_0x4d0455=_[_0x1353('0x3f')]({},_0x4d0455,_0x4a1df1[_0x1353('0x4c')]);return _0x54dfe9['getFields'](_0x4d0455);}})['then'](function(_0xb9d2bf){if(_0xb9d2bf){_0x459c7a=_0xb9d2bf[_0x1353('0x36')];if(!_0x4a1df1[_0x1353('0x31')][_0x1353('0x37')](_0x1353('0x38'))){_0x4d0455['limit']=qs[_0x1353('0x1e')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x1e')]);_0x4d0455[_0x1353('0x1f')]=qs[_0x1353('0x1f')](_0x4a1df1[_0x1353('0x31')][_0x1353('0x1f')]);}return _0x54dfe9[_0x1353('0x4e')](_0x4d0455);}})[_0x1353('0x26')](function(_0x5e9829){if(_0x5e9829){return _0x5e9829?{'count':_0x459c7a,'rows':_0x5e9829}:null;}})[_0x1353('0x26')](respondWithResult(_0xf6801f,null))[_0x1353('0x49')](handleError(_0xf6801f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f4814f2..10054a6 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 _0xaa87=['../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x556c75,_0x16f0f3){var _0xba977a=function(_0xf83880){while(--_0xf83880){_0x556c75['push'](_0x556c75['shift']());}};_0xba977a(++_0x16f0f3);}(_0xaa87,0x71));var _0x7aa8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaa87[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x7aa8('0x0'));var logger=require('../../config/logger')(_0x7aa8('0x1'));var moment=require(_0x7aa8('0x2'));var BPromise=require(_0x7aa8('0x3'));var rp=require(_0x7aa8('0x4'));var fs=require('fs');var path=require(_0x7aa8('0x5'));var rimraf=require(_0x7aa8('0x6'));var config=require(_0x7aa8('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x7aa8('0x8')]=function(_0x485fef,_0x22728f){return _0x485fef[_0x7aa8('0x9')](_0x7aa8('0xa'),attributes,{'tableName':_0x7aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf68e=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3c3bf5,_0x3ef83d){var _0x2ffb6b=function(_0x3de22f){while(--_0x3de22f){_0x3c3bf5['push'](_0x3c3bf5['shift']());}};_0x2ffb6b(++_0x3ef83d);}(_0xf68e,0x72));var _0xef68=function(_0x392021,_0x107d7c){_0x392021=_0x392021-0x0;var _0x274878=_0xf68e[_0x392021];return _0x274878;};'use strict';var _=require('lodash');var util=require(_0xef68('0x0'));var logger=require(_0xef68('0x1'))(_0xef68('0x2'));var moment=require('moment');var BPromise=require(_0xef68('0x3'));var rp=require(_0xef68('0x4'));var fs=require('fs');var path=require(_0xef68('0x5'));var rimraf=require(_0xef68('0x6'));var config=require(_0xef68('0x7'));var attributes=require(_0xef68('0x8'));module[_0xef68('0x9')]=function(_0x516843,_0x2885f0){return _0x516843[_0xef68('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xef68('0xb'),'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 eb4cf13..7784131 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 _0x1800=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring'];(function(_0x3f0bb6,_0x336810){var _0x612702=function(_0x34445a){while(--_0x34445a){_0x3f0bb6['push'](_0x3f0bb6['shift']());}};_0x612702(++_0x336810);}(_0x1800,0x123));var _0x0180=function(_0x52c589,_0x59aeb6){_0x52c589=_0x52c589-0x0;var _0x5662c9=_0x1800[_0x52c589];return _0x5662c9;};'use strict';var _=require(_0x0180('0x0'));var util=require(_0x0180('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0180('0x2'));var fs=require('fs');var Redis=require(_0x0180('0x3'));var db=require(_0x0180('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0180('0x5'));var config=require(_0x0180('0x6'));var jayson=require(_0x0180('0x7'));var client=jayson[_0x0180('0x8')][_0x0180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20d537,_0xd68a11,_0x2dc671){return new BPromise(function(_0x36b36b,_0x369321){return client['request'](_0x20d537,_0x2dc671)['then'](function(_0x4d6f68){logger[_0x0180('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd68a11,'request\x20sent');logger[_0x0180('0xb')](_0x0180('0xc'),_0xd68a11,_0x0180('0xd'),JSON[_0x0180('0xe')](_0x4d6f68));if(_0x4d6f68[_0x0180('0xf')]){if(_0x4d6f68[_0x0180('0xf')][_0x0180('0x10')]===0x1f4){logger[_0x0180('0xf')](_0x0180('0x11'),_0xd68a11,_0x4d6f68['error'][_0x0180('0x12')]);return _0x369321(_0x4d6f68[_0x0180('0xf')][_0x0180('0x12')]);}logger[_0x0180('0xf')](_0x0180('0x11'),_0xd68a11,_0x4d6f68[_0x0180('0xf')]['message']);return _0x36b36b(_0x4d6f68['error'][_0x0180('0x12')]);}else{logger[_0x0180('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd68a11,_0x0180('0xd'));_0x36b36b(_0x4d6f68[_0x0180('0x13')]['message']);}})[_0x0180('0x14')](function(_0x158e4c){logger[_0x0180('0xf')](_0x0180('0x11'),_0xd68a11,_0x158e4c);_0x369321(_0x158e4c);});});} \ No newline at end of file +var _0xf97b=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x4268c4,_0x244f25){var _0x1e01f8=function(_0x1b3091){while(--_0x1b3091){_0x4268c4['push'](_0x4268c4['shift']());}};_0x1e01f8(++_0x244f25);}(_0xf97b,0x1b2));var _0xbf97=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf97b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var moment=require(_0xbf97('0x2'));var BPromise=require(_0xbf97('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf97('0x5'))(_0xbf97('0x6'));var config=require(_0xbf97('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbf97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x562dff,_0x4f0ee6,_0x59ecaa){return new BPromise(function(_0xff2327,_0x55211a){return client[_0xbf97('0x9')](_0x562dff,_0x59ecaa)['then'](function(_0x20e183){logger[_0xbf97('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4f0ee6,_0xbf97('0xb'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0ee6,'request\x20sent',JSON[_0xbf97('0xc')](_0x20e183));if(_0x20e183[_0xbf97('0xd')]){if(_0x20e183[_0xbf97('0xd')][_0xbf97('0xe')]===0x1f4){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0x55211a(_0x20e183['error'][_0xbf97('0x10')]);}logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);return _0xff2327(_0x20e183[_0xbf97('0xd')][_0xbf97('0x10')]);}else{logger[_0xbf97('0xa')](_0xbf97('0xf'),_0x4f0ee6,_0xbf97('0xb'));_0xff2327(_0x20e183[_0xbf97('0x11')][_0xbf97('0x10')]);}})['catch'](function(_0x12dbc0){logger[_0xbf97('0xd')](_0xbf97('0xf'),_0x4f0ee6,_0x12dbc0);_0x55211a(_0x12dbc0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 67b0ecd..18577a8 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 _0xb458=['show','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id'];(function(_0x45f6ee,_0x409583){var _0x41bdf5=function(_0x5ee68e){while(--_0x5ee68e){_0x45f6ee['push'](_0x45f6ee['shift']());}};_0x41bdf5(++_0x409583);}(_0xb458,0xca));var _0x8b45=function(_0x41ebe9,_0x450a7e){_0x41ebe9=_0x41ebe9-0x0;var _0x4ffe5b=_0xb458[_0x41ebe9];return _0x4ffe5b;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require(_0x8b45('0x3'));var express=require('express');var router=express[_0x8b45('0x4')]();var fs_extra=require(_0x8b45('0x5'));var auth=require(_0x8b45('0x6'));var interaction=require(_0x8b45('0x7'));var config=require(_0x8b45('0x8'));var controller=require(_0x8b45('0x9'));router[_0x8b45('0xa')]('/',auth[_0x8b45('0xb')](),controller[_0x8b45('0xc')]);router[_0x8b45('0xa')](_0x8b45('0xd'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xe')]);router['post']('/',auth[_0x8b45('0xb')](),controller['create']);router['put'](_0x8b45('0xd'),auth[_0x8b45('0xb')](),controller[_0x8b45('0xf')]);router['delete'](_0x8b45('0xd'),auth['isAuthenticated'](),controller[_0x8b45('0x10')]);module[_0x8b45('0x11')]=router; \ No newline at end of file +var _0xbf82=['multer','path','express','Router','fs-extra','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports'];(function(_0x4dfb03,_0x5837a5){var _0x5a85da=function(_0x4f3629){while(--_0x4f3629){_0x4dfb03['push'](_0x4dfb03['shift']());}};_0x5a85da(++_0x5837a5);}(_0xbf82,0x1cb));var _0x2bf8=function(_0x32c0a4,_0x309956){_0x32c0a4=_0x32c0a4-0x0;var _0x1a2dff=_0xbf82[_0x32c0a4];return _0x1a2dff;};'use strict';var multer=require(_0x2bf8('0x0'));var util=require('util');var path=require(_0x2bf8('0x1'));var timeout=require('connect-timeout');var express=require(_0x2bf8('0x2'));var router=express[_0x2bf8('0x3')]();var fs_extra=require(_0x2bf8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2bf8('0x5'));var controller=require(_0x2bf8('0x6'));router[_0x2bf8('0x7')]('/',auth[_0x2bf8('0x8')](),controller[_0x2bf8('0x9')]);router['get']('/:id',auth[_0x2bf8('0x8')](),controller['show']);router[_0x2bf8('0xa')]('/',auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xb')]);router['put'](_0x2bf8('0xc'),auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xd')]);router[_0x2bf8('0xe')](_0x2bf8('0xc'),auth[_0x2bf8('0x8')](),controller[_0x2bf8('0xf')]);module[_0x2bf8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5b7ef35..2330aef 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 _0xf1b6=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x189cdf,_0x5558f9){var _0x16513d=function(_0x50c1f7){while(--_0x50c1f7){_0x189cdf['push'](_0x189cdf['shift']());}};_0x16513d(++_0x5558f9);}(_0xf1b6,0x1ec));var _0x6f1b=function(_0x744d66,_0x55b61f){_0x744d66=_0x744d66-0x0;var _0x501954=_0xf1b6[_0x744d66];return _0x501954;};'use strict';var Sequelize=require('sequelize');module[_0x6f1b('0x0')]={'type':{'type':Sequelize['ENUM'](_0x6f1b('0x1'),_0x6f1b('0x2'),_0x6f1b('0x3'),_0x6f1b('0x4'),_0x6f1b('0x5')),'defaultValue':_0x6f1b('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6f1b('0x6')]},'keyType':{'type':Sequelize[_0x6f1b('0x7')](_0x6f1b('0x1'),_0x6f1b('0x2'),_0x6f1b('0x3'))},'keyContent':{'type':Sequelize[_0x6f1b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6f1b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6f1b('0x6')]}}; \ No newline at end of file +var _0xfa13=['picklist','STRING','variable','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0x31b99a,_0xfb8adb){var _0x4c5223=function(_0x110443){while(--_0x110443){_0x31b99a['push'](_0x31b99a['shift']());}};_0x4c5223(++_0xfb8adb);}(_0xfa13,0x1e4));var _0x3fa1=function(_0x1a5c85,_0x385211){_0x1a5c85=_0x1a5c85-0x0;var _0x2b1e5e=_0xfa13[_0x1a5c85];return _0x2b1e5e;};'use strict';var Sequelize=require(_0x3fa1('0x0'));module['exports']={'type':{'type':Sequelize[_0x3fa1('0x1')](_0x3fa1('0x2'),'variable',_0x3fa1('0x3'),'keyValue',_0x3fa1('0x4')),'defaultValue':_0x3fa1('0x2')},'content':{'type':Sequelize[_0x3fa1('0x5')]},'key':{'type':Sequelize[_0x3fa1('0x5')]},'keyType':{'type':Sequelize[_0x3fa1('0x1')](_0x3fa1('0x2'),_0x3fa1('0x6'),_0x3fa1('0x3'))},'keyContent':{'type':Sequelize[_0x3fa1('0x5')]},'idField':{'type':Sequelize[_0x3fa1('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3fa1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3fa1('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index ff389c0..4132f42 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 _0x3e1a=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','send','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','show','fields','include','create','body','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x590daa,_0x28be12){var _0x30098a=function(_0x69f1c0){while(--_0x69f1c0){_0x590daa['push'](_0x590daa['shift']());}};_0x30098a(++_0x28be12);}(_0x3e1a,0xbe));var _0xa3e1=function(_0x432c3a,_0x1bae57){_0x432c3a=_0x432c3a-0x0;var _0x28b285=_0x3e1a[_0x432c3a];return _0x28b285;};'use strict';var emlformat=require(_0xa3e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3e1('0x1'));var jsonpatch=require(_0xa3e1('0x2'));var rp=require(_0xa3e1('0x3'));var moment=require(_0xa3e1('0x4'));var BPromise=require(_0xa3e1('0x5'));var Mustache=require('mustache');var util=require(_0xa3e1('0x6'));var path=require(_0xa3e1('0x7'));var sox=require('sox');var csv=require(_0xa3e1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3e1('0x9'));var _=require('lodash');var squel=require(_0xa3e1('0xa'));var crypto=require('crypto');var jsforce=require(_0xa3e1('0xb'));var deskjs=require(_0xa3e1('0xc'));var toCsv=require(_0xa3e1('0x8'));var querystring=require(_0xa3e1('0xd'));var Papa=require(_0xa3e1('0xe'));var Redis=require(_0xa3e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa3e1('0x10'));var as=require(_0xa3e1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3e1('0x12'))(_0xa3e1('0x13'));var utils=require(_0xa3e1('0x14'));var config=require(_0xa3e1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3e1('0x16'))['db'];function respondWithStatusCode(_0xe1a5a3,_0x431d0f){_0x431d0f=_0x431d0f||0xcc;return function(_0x363df8){if(_0x363df8){return _0xe1a5a3[_0xa3e1('0x17')](_0x431d0f);}return _0xe1a5a3[_0xa3e1('0x18')](_0x431d0f)[_0xa3e1('0x19')]();};}function respondWithResult(_0x38bc04,_0x38e2eb){_0x38e2eb=_0x38e2eb||0xc8;return function(_0x3283c7){if(_0x3283c7){return _0x38bc04[_0xa3e1('0x18')](_0x38e2eb)[_0xa3e1('0x1a')](_0x3283c7);}};}function respondWithFilteredResult(_0x38380f,_0x564f7c){return function(_0x449279){if(_0x449279){var _0x3c3c65=typeof _0x564f7c[_0xa3e1('0x1b')]===_0xa3e1('0x1c')&&typeof _0x564f7c[_0xa3e1('0x1d')]===_0xa3e1('0x1c');var _0x76e74=_0x449279[_0xa3e1('0x1e')];var _0x2fa94a=_0x3c3c65?0x0:_0x564f7c[_0xa3e1('0x1b')];var _0x42ed6e=_0x3c3c65?_0x449279[_0xa3e1('0x1e')]:_0x564f7c[_0xa3e1('0x1b')]+_0x564f7c['limit'];var _0xc91273;if(_0x42ed6e>=_0x76e74){_0x42ed6e=_0x76e74;_0xc91273=0xc8;}else{_0xc91273=0xce;}_0x38380f[_0xa3e1('0x18')](_0xc91273);return _0x38380f[_0xa3e1('0x1f')](_0xa3e1('0x20'),_0x2fa94a+'-'+_0x42ed6e+'/'+_0x76e74)['json'](_0x449279);}return null;};}function patchUpdates(_0x2f590f){return function(_0x2e602b){try{jsonpatch[_0xa3e1('0x21')](_0x2e602b,_0x2f590f,!![]);}catch(_0x3bf5d1){return BPromise['reject'](_0x3bf5d1);}return _0x2e602b[_0xa3e1('0x22')]();};}function saveUpdates(_0x385253,_0x3d450c){return function(_0x2b8d75){if(_0x2b8d75){return _0x2b8d75[_0xa3e1('0x23')](_0x385253)[_0xa3e1('0x24')](function(_0x3a1d02){return _0x3a1d02;});}return null;};}function removeEntity(_0x19ac78,_0x241c4b){return function(_0x336577){if(_0x336577){return _0x336577[_0xa3e1('0x25')]()[_0xa3e1('0x24')](function(){_0x19ac78[_0xa3e1('0x18')](0xcc)[_0xa3e1('0x19')]();});}};}function handleEntityNotFound(_0x179fb5,_0x24ec58){return function(_0x50bc8b){if(!_0x50bc8b){_0x179fb5[_0xa3e1('0x17')](0x194);}return _0x50bc8b;};}function handleError(_0x27589a,_0x41b86f){_0x41b86f=_0x41b86f||0x1f4;return function(_0xe014da){logger['error'](_0xe014da['stack']);if(_0xe014da['name']){delete _0xe014da['name'];}_0x27589a['status'](_0x41b86f)[_0xa3e1('0x26')](_0xe014da);};}exports[_0xa3e1('0x27')]=function(_0x29665a,_0x1ba483){var _0x347e7b={},_0x4667e7={},_0x425377={'count':0x0,'rows':[]};var _0x58ac26=_['map'](db[_0xa3e1('0x28')][_0xa3e1('0x29')],function(_0x26e633){return{'name':_0x26e633[_0xa3e1('0x2a')],'type':_0x26e633[_0xa3e1('0x2b')][_0xa3e1('0x2c')]};});_0x4667e7[_0xa3e1('0x2d')]=_[_0xa3e1('0x2e')](_0x58ac26,_0xa3e1('0x2f'));_0x4667e7[_0xa3e1('0x30')]=_[_0xa3e1('0x31')](_0x29665a[_0xa3e1('0x30')]);_0x4667e7['filters']=_[_0xa3e1('0x32')](_0x4667e7[_0xa3e1('0x2d')],_0x4667e7[_0xa3e1('0x30')]);_0x347e7b['attributes']=_['intersection'](_0x4667e7[_0xa3e1('0x2d')],qs['fields'](_0x29665a[_0xa3e1('0x30')]['fields']));_0x347e7b['attributes']=_0x347e7b['attributes'][_0xa3e1('0x33')]?_0x347e7b[_0xa3e1('0x34')]:_0x4667e7['model'];if(!_0x29665a['query'][_0xa3e1('0x35')]('nolimit')){_0x347e7b[_0xa3e1('0x1d')]=qs[_0xa3e1('0x1d')](_0x29665a[_0xa3e1('0x30')]['limit']);_0x347e7b[_0xa3e1('0x1b')]=qs[_0xa3e1('0x1b')](_0x29665a[_0xa3e1('0x30')][_0xa3e1('0x1b')]);}_0x347e7b[_0xa3e1('0x36')]=qs[_0xa3e1('0x37')](_0x29665a['query'][_0xa3e1('0x37')]);_0x347e7b[_0xa3e1('0x38')]=qs[_0xa3e1('0x39')](_[_0xa3e1('0x3a')](_0x29665a[_0xa3e1('0x30')],_0x4667e7[_0xa3e1('0x39')]),_0x58ac26);if(_0x29665a['query'][_0xa3e1('0x3b')]){_0x347e7b['where']=_[_0xa3e1('0x3c')](_0x347e7b[_0xa3e1('0x38')],{'$or':_[_0xa3e1('0x2e')](_0x58ac26,function(_0x187c51){if(_0x187c51[_0xa3e1('0x2b')]!=='VIRTUAL'){var _0x135cc5={};_0x135cc5[_0x187c51[_0xa3e1('0x2f')]]={'$like':'%'+_0x29665a[_0xa3e1('0x30')][_0xa3e1('0x3b')]+'%'};return _0x135cc5;}})});}_0x347e7b=_[_0xa3e1('0x3c')]({},_0x347e7b,_0x29665a[_0xa3e1('0x3d')]);var _0x7769fa={'where':_0x347e7b[_0xa3e1('0x38')]};return db[_0xa3e1('0x28')][_0xa3e1('0x1e')](_0x7769fa)[_0xa3e1('0x24')](function(_0x3d0a4a){_0x425377[_0xa3e1('0x1e')]=_0x3d0a4a;if(_0x29665a['query'][_0xa3e1('0x3e')]){_0x347e7b['include']=[{'all':!![]}];}return db['FreshsalesField'][_0xa3e1('0x3f')](_0x347e7b);})[_0xa3e1('0x24')](function(_0x26d109){_0x425377['rows']=_0x26d109;return _0x425377;})['then'](respondWithFilteredResult(_0x1ba483,_0x347e7b))['catch'](handleError(_0x1ba483,null));};exports[_0xa3e1('0x40')]=function(_0x57375d,_0x7225b8){var _0x3d57e6={'raw':!![],'where':{'id':_0x57375d['params']['id']}},_0x1b5e1b={};_0x1b5e1b[_0xa3e1('0x2d')]=_[_0xa3e1('0x31')](db[_0xa3e1('0x28')][_0xa3e1('0x29')]);_0x1b5e1b[_0xa3e1('0x30')]=_[_0xa3e1('0x31')](_0x57375d['query']);_0x1b5e1b[_0xa3e1('0x39')]=_[_0xa3e1('0x32')](_0x1b5e1b['model'],_0x1b5e1b[_0xa3e1('0x30')]);_0x3d57e6[_0xa3e1('0x34')]=_[_0xa3e1('0x32')](_0x1b5e1b[_0xa3e1('0x2d')],qs['fields'](_0x57375d[_0xa3e1('0x30')][_0xa3e1('0x41')]));_0x3d57e6['attributes']=_0x3d57e6['attributes'][_0xa3e1('0x33')]?_0x3d57e6[_0xa3e1('0x34')]:_0x1b5e1b[_0xa3e1('0x2d')];if(_0x57375d['query'][_0xa3e1('0x3e')]){_0x3d57e6[_0xa3e1('0x42')]=[{'all':!![]}];}_0x3d57e6=_['merge']({},_0x3d57e6,_0x57375d[_0xa3e1('0x3d')]);return db[_0xa3e1('0x28')]['find'](_0x3d57e6)[_0xa3e1('0x24')](handleEntityNotFound(_0x7225b8,null))[_0xa3e1('0x24')](respondWithResult(_0x7225b8,null))['catch'](handleError(_0x7225b8,null));};exports[_0xa3e1('0x43')]=function(_0x4f2c04,_0x54c3d2){return db[_0xa3e1('0x28')]['create'](_0x4f2c04[_0xa3e1('0x44')],{})[_0xa3e1('0x24')](respondWithResult(_0x54c3d2,0xc9))['catch'](handleError(_0x54c3d2,null));};exports[_0xa3e1('0x23')]=function(_0x1153e1,_0x22efac){if(_0x1153e1[_0xa3e1('0x44')]['id']){delete _0x1153e1[_0xa3e1('0x44')]['id'];}return db['FreshsalesField'][_0xa3e1('0x45')]({'where':{'id':_0x1153e1[_0xa3e1('0x46')]['id']}})[_0xa3e1('0x24')](handleEntityNotFound(_0x22efac,null))[_0xa3e1('0x24')](saveUpdates(_0x1153e1['body'],null))['then'](respondWithResult(_0x22efac,null))['catch'](handleError(_0x22efac,null));};exports[_0xa3e1('0x25')]=function(_0x531208,_0x32fec9){return db[_0xa3e1('0x28')][_0xa3e1('0x45')]({'where':{'id':_0x531208['params']['id']}})['then'](handleEntityNotFound(_0x32fec9,null))[_0xa3e1('0x24')](removeEntity(_0x32fec9,null))[_0xa3e1('0x47')](handleError(_0x32fec9,null));}; \ No newline at end of file +var _0x11b8=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status'];(function(_0x210388,_0x13b1a3){var _0x561f6a=function(_0x5a2da0){while(--_0x5a2da0){_0x210388['push'](_0x210388['shift']());}};_0x561f6a(++_0x13b1a3);}(_0x11b8,0x14a));var _0x811b=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x11b8[_0x4715d2];return _0x141811;};'use strict';var emlformat=require(_0x811b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x811b('0x1'));var rp=require(_0x811b('0x2'));var moment=require('moment');var BPromise=require(_0x811b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x811b('0x4'));var sox=require(_0x811b('0x5'));var csv=require(_0x811b('0x6'));var ejs=require(_0x811b('0x7'));var fs=require('fs');var fs_extra=require(_0x811b('0x8'));var _=require(_0x811b('0x9'));var squel=require(_0x811b('0xa'));var crypto=require(_0x811b('0xb'));var jsforce=require(_0x811b('0xc'));var deskjs=require(_0x811b('0xd'));var toCsv=require(_0x811b('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x811b('0xe'));var authService=require(_0x811b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x811b('0x10'));var hardwareService=require(_0x811b('0x11'));var logger=require('../../config/logger')(_0x811b('0x12'));var utils=require(_0x811b('0x13'));var config=require(_0x811b('0x14'));var licenseUtil=require(_0x811b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52519e,_0x593105){_0x593105=_0x593105||0xcc;return function(_0x281857){if(_0x281857){return _0x52519e[_0x811b('0x16')](_0x593105);}return _0x52519e['status'](_0x593105)[_0x811b('0x17')]();};}function respondWithResult(_0x3711a1,_0x54ed09){_0x54ed09=_0x54ed09||0xc8;return function(_0x32ab96){if(_0x32ab96){return _0x3711a1[_0x811b('0x18')](_0x54ed09)[_0x811b('0x19')](_0x32ab96);}};}function respondWithFilteredResult(_0x56feb3,_0x440e72){return function(_0x328041){if(_0x328041){var _0x556ab8=typeof _0x440e72[_0x811b('0x1a')]===_0x811b('0x1b')&&typeof _0x440e72[_0x811b('0x1c')]===_0x811b('0x1b');var _0x3e6473=_0x328041[_0x811b('0x1d')];var _0x153841=_0x556ab8?0x0:_0x440e72['offset'];var _0x1b73a2=_0x556ab8?_0x328041[_0x811b('0x1d')]:_0x440e72[_0x811b('0x1a')]+_0x440e72[_0x811b('0x1c')];var _0x3675da;if(_0x1b73a2>=_0x3e6473){_0x1b73a2=_0x3e6473;_0x3675da=0xc8;}else{_0x3675da=0xce;}_0x56feb3[_0x811b('0x18')](_0x3675da);return _0x56feb3[_0x811b('0x1e')]('Content-Range',_0x153841+'-'+_0x1b73a2+'/'+_0x3e6473)['json'](_0x328041);}return null;};}function patchUpdates(_0x31e972){return function(_0x1982fb){try{jsonpatch[_0x811b('0x1f')](_0x1982fb,_0x31e972,!![]);}catch(_0x157e97){return BPromise[_0x811b('0x20')](_0x157e97);}return _0x1982fb[_0x811b('0x21')]();};}function saveUpdates(_0x482a4b,_0x4541e5){return function(_0x1d0723){if(_0x1d0723){return _0x1d0723[_0x811b('0x22')](_0x482a4b)[_0x811b('0x23')](function(_0x1fbf06){return _0x1fbf06;});}return null;};}function removeEntity(_0xdcc453,_0x2736a1){return function(_0x3bd250){if(_0x3bd250){return _0x3bd250[_0x811b('0x24')]()[_0x811b('0x23')](function(){_0xdcc453[_0x811b('0x18')](0xcc)[_0x811b('0x17')]();});}};}function handleEntityNotFound(_0x4ac0e5,_0x29d595){return function(_0x1b7299){if(!_0x1b7299){_0x4ac0e5[_0x811b('0x16')](0x194);}return _0x1b7299;};}function handleError(_0x1b85ba,_0x450195){_0x450195=_0x450195||0x1f4;return function(_0x32ee81){logger['error'](_0x32ee81[_0x811b('0x25')]);if(_0x32ee81[_0x811b('0x26')]){delete _0x32ee81[_0x811b('0x26')];}_0x1b85ba[_0x811b('0x18')](_0x450195)[_0x811b('0x27')](_0x32ee81);};}exports['index']=function(_0x1011a0,_0x243c20){var _0x432d06={},_0x2122cf={},_0x15ab05={'count':0x0,'rows':[]};var _0x190e59=_['map'](db['FreshsalesField'][_0x811b('0x28')],function(_0x332ab6){return{'name':_0x332ab6[_0x811b('0x29')],'type':_0x332ab6[_0x811b('0x2a')][_0x811b('0x2b')]};});_0x2122cf['model']=_[_0x811b('0x2c')](_0x190e59,'name');_0x2122cf[_0x811b('0x2d')]=_[_0x811b('0x2e')](_0x1011a0[_0x811b('0x2d')]);_0x2122cf[_0x811b('0x2f')]=_[_0x811b('0x30')](_0x2122cf[_0x811b('0x31')],_0x2122cf['query']);_0x432d06[_0x811b('0x32')]=_[_0x811b('0x30')](_0x2122cf[_0x811b('0x31')],qs[_0x811b('0x33')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x33')]));_0x432d06['attributes']=_0x432d06[_0x811b('0x32')]['length']?_0x432d06[_0x811b('0x32')]:_0x2122cf[_0x811b('0x31')];if(!_0x1011a0[_0x811b('0x2d')][_0x811b('0x34')](_0x811b('0x35'))){_0x432d06['limit']=qs[_0x811b('0x1c')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x1c')]);_0x432d06['offset']=qs[_0x811b('0x1a')](_0x1011a0[_0x811b('0x2d')][_0x811b('0x1a')]);}_0x432d06[_0x811b('0x36')]=qs['sort'](_0x1011a0[_0x811b('0x2d')]['sort']);_0x432d06[_0x811b('0x37')]=qs[_0x811b('0x2f')](_[_0x811b('0x38')](_0x1011a0[_0x811b('0x2d')],_0x2122cf['filters']),_0x190e59);if(_0x1011a0[_0x811b('0x2d')]['filter']){_0x432d06['where']=_[_0x811b('0x39')](_0x432d06['where'],{'$or':_[_0x811b('0x2c')](_0x190e59,function(_0x52fdbc){if(_0x52fdbc['type']!==_0x811b('0x3a')){var _0x69f49d={};_0x69f49d[_0x52fdbc[_0x811b('0x26')]]={'$like':'%'+_0x1011a0[_0x811b('0x2d')][_0x811b('0x3b')]+'%'};return _0x69f49d;}})});}_0x432d06=_['merge']({},_0x432d06,_0x1011a0[_0x811b('0x3c')]);var _0x430005={'where':_0x432d06[_0x811b('0x37')]};return db[_0x811b('0x3d')]['count'](_0x430005)[_0x811b('0x23')](function(_0x1c642b){_0x15ab05[_0x811b('0x1d')]=_0x1c642b;if(_0x1011a0[_0x811b('0x2d')][_0x811b('0x3e')]){_0x432d06[_0x811b('0x3f')]=[{'all':!![]}];}return db[_0x811b('0x3d')][_0x811b('0x40')](_0x432d06);})[_0x811b('0x23')](function(_0x2e28d2){_0x15ab05['rows']=_0x2e28d2;return _0x15ab05;})['then'](respondWithFilteredResult(_0x243c20,_0x432d06))['catch'](handleError(_0x243c20,null));};exports[_0x811b('0x41')]=function(_0x5812a3,_0x581d78){var _0x9aa1cb={'raw':!![],'where':{'id':_0x5812a3[_0x811b('0x42')]['id']}},_0x470a4d={};_0x470a4d[_0x811b('0x31')]=_[_0x811b('0x2e')](db[_0x811b('0x3d')][_0x811b('0x28')]);_0x470a4d[_0x811b('0x2d')]=_[_0x811b('0x2e')](_0x5812a3[_0x811b('0x2d')]);_0x470a4d[_0x811b('0x2f')]=_[_0x811b('0x30')](_0x470a4d[_0x811b('0x31')],_0x470a4d[_0x811b('0x2d')]);_0x9aa1cb[_0x811b('0x32')]=_[_0x811b('0x30')](_0x470a4d[_0x811b('0x31')],qs[_0x811b('0x33')](_0x5812a3[_0x811b('0x2d')][_0x811b('0x33')]));_0x9aa1cb[_0x811b('0x32')]=_0x9aa1cb[_0x811b('0x32')]['length']?_0x9aa1cb[_0x811b('0x32')]:_0x470a4d[_0x811b('0x31')];if(_0x5812a3['query'][_0x811b('0x3e')]){_0x9aa1cb[_0x811b('0x3f')]=[{'all':!![]}];}_0x9aa1cb=_[_0x811b('0x39')]({},_0x9aa1cb,_0x5812a3[_0x811b('0x3c')]);return db[_0x811b('0x3d')][_0x811b('0x43')](_0x9aa1cb)[_0x811b('0x23')](handleEntityNotFound(_0x581d78,null))[_0x811b('0x23')](respondWithResult(_0x581d78,null))[_0x811b('0x44')](handleError(_0x581d78,null));};exports['create']=function(_0x1da9a5,_0x1f1e80){return db[_0x811b('0x3d')][_0x811b('0x45')](_0x1da9a5['body'],{})[_0x811b('0x23')](respondWithResult(_0x1f1e80,0xc9))[_0x811b('0x44')](handleError(_0x1f1e80,null));};exports['update']=function(_0x2f99ed,_0x154c80){if(_0x2f99ed['body']['id']){delete _0x2f99ed[_0x811b('0x46')]['id'];}return db[_0x811b('0x3d')][_0x811b('0x43')]({'where':{'id':_0x2f99ed[_0x811b('0x42')]['id']}})[_0x811b('0x23')](handleEntityNotFound(_0x154c80,null))[_0x811b('0x23')](saveUpdates(_0x2f99ed['body'],null))[_0x811b('0x23')](respondWithResult(_0x154c80,null))[_0x811b('0x44')](handleError(_0x154c80,null));};exports[_0x811b('0x24')]=function(_0x4f6033,_0x991549){return db[_0x811b('0x3d')][_0x811b('0x43')]({'where':{'id':_0x4f6033['params']['id']}})[_0x811b('0x23')](handleEntityNotFound(_0x991549,null))[_0x811b('0x23')](removeEntity(_0x991549,null))[_0x811b('0x44')](handleError(_0x991549,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5054ccf..5ef0a6c 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 _0xbca0=['util','bluebird','request-promise','path','rimraf','exports','define','idField','FieldId','lodash'];(function(_0x474d58,_0x268318){var _0x12b43e=function(_0x5a6bb1){while(--_0x5a6bb1){_0x474d58['push'](_0x474d58['shift']());}};_0x12b43e(++_0x268318);}(_0xbca0,0x8b));var _0x0bca=function(_0x25dfd8,_0x58e9cd){_0x25dfd8=_0x25dfd8-0x0;var _0x364fa9=_0xbca0[_0x25dfd8];return _0x364fa9;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0bca('0x2'));var rp=require(_0x0bca('0x3'));var fs=require('fs');var path=require(_0x0bca('0x4'));var rimraf=require(_0x0bca('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x0bca('0x6')]=function(_0x3d1155,_0x3dab5e){return _0x3d1155[_0x0bca('0x7')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x0bca('0x8'),_0x0bca('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd386=['freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields'];(function(_0x3c600d,_0x4b5c85){var _0xd195e3=function(_0x2a2f5f){while(--_0x2a2f5f){_0x3c600d['push'](_0x3c600d['shift']());}};_0xd195e3(++_0x4b5c85);}(_0xd386,0x10c));var _0x6d38=function(_0x175d1e,_0x48ad7e){_0x175d1e=_0x175d1e-0x0;var _0x10aefc=_0xd386[_0x175d1e];return _0x10aefc;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var logger=require(_0x6d38('0x2'))('api');var moment=require(_0x6d38('0x3'));var BPromise=require(_0x6d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d38('0x5'));var rimraf=require(_0x6d38('0x6'));var config=require(_0x6d38('0x7'));var attributes=require(_0x6d38('0x8'));module['exports']=function(_0x1a54fa,_0x25eef5){return _0x1a54fa[_0x6d38('0x9')](_0x6d38('0xa'),attributes,{'tableName':_0x6d38('0xb'),'paranoid':![],'indexes':[{'name':_0x6d38('0xc'),'fields':['idField',_0x6d38('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index b0a9ff6..180b684 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 _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4a0c3c,_0x28efda){var _0x383f56=function(_0x57efd2){while(--_0x57efd2){_0x4a0c3c['push'](_0x4a0c3c['shift']());}};_0x383f56(++_0x28efda);}(_0x2a07,0x74));var _0x72a0=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0x2a07[_0x923ab6];return _0x484752;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0xc8bfa2,_0x25710b){var _0x455ecf=function(_0x335dbb){while(--_0x335dbb){_0xc8bfa2['push'](_0xc8bfa2['shift']());}};_0x455ecf(++_0x25710b);}(_0x4819,0xcd));var _0x9481=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x4819[_0x315b61];return _0x3521e8;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 61a3138..2cc9717 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(_0x2b2874,_0xdd0211){var _0x1869ab=function(_0x5b5546){while(--_0x5b5546){_0x2b2874['push'](_0x2b2874['shift']());}};_0x1869ab(++_0xdd0211);}(_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(_0x1ddb40,_0x2966c8){var _0x508db9=function(_0x33767d){while(--_0x33767d){_0x1ddb40['push'](_0x1ddb40['shift']());}};_0x508db9(++_0x2966c8);}(_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/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 7867c51..3cf6218 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 _0x5532=['sequelize','exports','STRING','integrationTab','newTab'];(function(_0x3c869b,_0xe07c05){var _0x5b784a=function(_0x12020a){while(--_0x12020a){_0x3c869b['push'](_0x3c869b['shift']());}};_0x5b784a(++_0xe07c05);}(_0x5532,0x19a));var _0x2553=function(_0x1fa3a6,_0x59c6bd){_0x1fa3a6=_0x1fa3a6-0x0;var _0x178989=_0x5532[_0x1fa3a6];return _0x178989;};'use strict';var Sequelize=require(_0x2553('0x0'));module[_0x2553('0x1')]={'name':{'type':Sequelize[_0x2553('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2553('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x2553('0x2')]},'password':{'type':Sequelize[_0x2553('0x2')]},'clientId':{'type':Sequelize[_0x2553('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2553('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2553('0x3'),_0x2553('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4a03=['integrationTab','exports','STRING','username','ENUM'];(function(_0x596e30,_0x301282){var _0x5e46af=function(_0x2c3918){while(--_0x2c3918){_0x596e30['push'](_0x596e30['shift']());}};_0x5e46af(++_0x301282);}(_0x4a03,0x16e));var _0x34a0=function(_0xa1cde5,_0x153cbf){_0xa1cde5=_0xa1cde5-0x0;var _0x109a5e=_0x4a03[_0xa1cde5];return _0x109a5e;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')]},'description':{'type':Sequelize[_0x34a0('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x34a0('0x2')},'remoteUri':{'type':Sequelize[_0x34a0('0x1')]},'password':{'type':Sequelize[_0x34a0('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34a0('0x1')]},'securityToken':{'type':Sequelize[_0x34a0('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x34a0('0x3')](_0x34a0('0x4'),'newTab'),'defaultValue':_0x34a0('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 62d0876..3d95326 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 _0x85fc=['test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','SalesforceAccount','includeAll','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x457e20,_0x3985ac){var _0x1f920b=function(_0x3804e4){while(--_0x3804e4){_0x457e20['push'](_0x457e20['shift']());}};_0x1f920b(++_0x3985ac);}(_0x85fc,0x7b));var _0xc85f=function(_0x52f3,_0x1ac14f){_0x52f3=_0x52f3-0x0;var _0x266655=_0x85fc[_0x52f3];return _0x266655;};'use strict';var emlformat=require(_0xc85f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc85f('0x1'));var rp=require(_0xc85f('0x2'));var moment=require(_0xc85f('0x3'));var BPromise=require(_0xc85f('0x4'));var Mustache=require('mustache');var util=require(_0xc85f('0x5'));var path=require(_0xc85f('0x6'));var sox=require('sox');var csv=require(_0xc85f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc85f('0x8'));var crypto=require('crypto');var jsforce=require(_0xc85f('0x9'));var deskjs=require(_0xc85f('0xa'));var toCsv=require(_0xc85f('0x7'));var querystring=require(_0xc85f('0xb'));var Papa=require(_0xc85f('0xc'));var Redis=require(_0xc85f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc85f('0xe'));var as=require(_0xc85f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc85f('0x10'));var utils=require('../../config/utils');var config=require(_0xc85f('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc85f('0x12'));function respondWithStatusCode(_0x2b0fc1,_0x467812){_0x467812=_0x467812||0xcc;return function(_0x17da98){if(_0x17da98){return _0x2b0fc1[_0xc85f('0x13')](_0x467812);}return _0x2b0fc1[_0xc85f('0x14')](_0x467812)[_0xc85f('0x15')]();};}function respondWithResult(_0x43e98e,_0x1878d0){_0x1878d0=_0x1878d0||0xc8;return function(_0x27dc90){if(_0x27dc90){return _0x43e98e[_0xc85f('0x14')](_0x1878d0)['json'](_0x27dc90);}};}function respondWithFilteredResult(_0x4d0964,_0x419e6b){return function(_0x305246){if(_0x305246){var _0x2d1bec=typeof _0x419e6b[_0xc85f('0x16')]===_0xc85f('0x17')&&typeof _0x419e6b[_0xc85f('0x18')]==='undefined';var _0x4bad59=_0x305246[_0xc85f('0x19')];var _0x32f15f=_0x2d1bec?0x0:_0x419e6b[_0xc85f('0x16')];var _0x25d89c=_0x2d1bec?_0x305246[_0xc85f('0x19')]:_0x419e6b[_0xc85f('0x16')]+_0x419e6b[_0xc85f('0x18')];var _0x5281f6;if(_0x25d89c>=_0x4bad59){_0x25d89c=_0x4bad59;_0x5281f6=0xc8;}else{_0x5281f6=0xce;}_0x4d0964[_0xc85f('0x14')](_0x5281f6);return _0x4d0964['set']('Content-Range',_0x32f15f+'-'+_0x25d89c+'/'+_0x4bad59)[_0xc85f('0x1a')](_0x305246);}return null;};}function patchUpdates(_0x316bac){return function(_0x4f7404){try{jsonpatch[_0xc85f('0x1b')](_0x4f7404,_0x316bac,!![]);}catch(_0x4868f1){return BPromise[_0xc85f('0x1c')](_0x4868f1);}return _0x4f7404[_0xc85f('0x1d')]();};}function saveUpdates(_0x5768d2,_0x836571){return function(_0x13647c){if(_0x13647c){return _0x13647c[_0xc85f('0x1e')](_0x5768d2)[_0xc85f('0x1f')](function(_0x1ac15d){return _0x1ac15d;});}return null;};}function removeEntity(_0xfcbf2e,_0x1c2749){return function(_0x579b1c){if(_0x579b1c){return _0x579b1c[_0xc85f('0x20')]()['then'](function(){_0xfcbf2e[_0xc85f('0x14')](0xcc)[_0xc85f('0x15')]();});}};}function handleEntityNotFound(_0x240e92,_0x379160){return function(_0x528fd0){if(!_0x528fd0){_0x240e92['sendStatus'](0x194);}return _0x528fd0;};}function handleError(_0x2bdb8b,_0x9c7b9c){_0x9c7b9c=_0x9c7b9c||0x1f4;return function(_0x464225){logger[_0xc85f('0x21')](_0x464225[_0xc85f('0x22')]);if(_0x464225[_0xc85f('0x23')]){delete _0x464225['name'];}_0x2bdb8b[_0xc85f('0x14')](_0x9c7b9c)[_0xc85f('0x24')](_0x464225);};}exports[_0xc85f('0x25')]=function(_0x23894c,_0x1af152){var _0x3ec423={},_0x50699c={},_0x5f43ff={'count':0x0,'rows':[]};var _0x2e41fe=_[_0xc85f('0x26')](db['SalesforceAccount'][_0xc85f('0x27')],function(_0x520c37){return{'name':_0x520c37[_0xc85f('0x28')],'type':_0x520c37[_0xc85f('0x29')][_0xc85f('0x2a')]};});_0x50699c['model']=_['map'](_0x2e41fe,_0xc85f('0x23'));_0x50699c['query']=_[_0xc85f('0x2b')](_0x23894c[_0xc85f('0x2c')]);_0x50699c[_0xc85f('0x2d')]=_[_0xc85f('0x2e')](_0x50699c[_0xc85f('0x2f')],_0x50699c[_0xc85f('0x2c')]);_0x3ec423[_0xc85f('0x30')]=_[_0xc85f('0x2e')](_0x50699c[_0xc85f('0x2f')],qs[_0xc85f('0x31')](_0x23894c[_0xc85f('0x2c')][_0xc85f('0x31')]));_0x3ec423['attributes']=_0x3ec423[_0xc85f('0x30')]['length']?_0x3ec423[_0xc85f('0x30')]:_0x50699c[_0xc85f('0x2f')];if(!_0x23894c[_0xc85f('0x2c')][_0xc85f('0x32')](_0xc85f('0x33'))){_0x3ec423[_0xc85f('0x18')]=qs[_0xc85f('0x18')](_0x23894c[_0xc85f('0x2c')][_0xc85f('0x18')]);_0x3ec423['offset']=qs[_0xc85f('0x16')](_0x23894c[_0xc85f('0x2c')][_0xc85f('0x16')]);}_0x3ec423[_0xc85f('0x34')]=qs[_0xc85f('0x35')](_0x23894c[_0xc85f('0x2c')][_0xc85f('0x35')]);_0x3ec423[_0xc85f('0x36')]=qs['filters'](_['pick'](_0x23894c[_0xc85f('0x2c')],_0x50699c[_0xc85f('0x2d')]),_0x2e41fe);if(_0x23894c[_0xc85f('0x2c')]['filter']){_0x3ec423[_0xc85f('0x36')]=_[_0xc85f('0x37')](_0x3ec423[_0xc85f('0x36')],{'$or':_['map'](_0x2e41fe,function(_0x71fb8c){if(_0x71fb8c[_0xc85f('0x29')]!==_0xc85f('0x38')){var _0x45df31={};_0x45df31[_0x71fb8c[_0xc85f('0x23')]]={'$like':'%'+_0x23894c[_0xc85f('0x2c')]['filter']+'%'};return _0x45df31;}})});}_0x3ec423=_[_0xc85f('0x37')]({},_0x3ec423,_0x23894c[_0xc85f('0x39')]);var _0x44b4b0={'where':_0x3ec423[_0xc85f('0x36')]};return db[_0xc85f('0x3a')][_0xc85f('0x19')](_0x44b4b0)[_0xc85f('0x1f')](function(_0x59f45d){_0x5f43ff['count']=_0x59f45d;if(_0x23894c[_0xc85f('0x2c')][_0xc85f('0x3b')]){_0x3ec423['include']=[{'all':!![]}];}return db[_0xc85f('0x3a')][_0xc85f('0x3c')](_0x3ec423);})[_0xc85f('0x1f')](function(_0x3ab966){_0x5f43ff[_0xc85f('0x3d')]=_0x3ab966;return _0x5f43ff;})[_0xc85f('0x1f')](respondWithFilteredResult(_0x1af152,_0x3ec423))[_0xc85f('0x3e')](handleError(_0x1af152,null));};exports[_0xc85f('0x3f')]=function(_0x5ab810,_0x2d4307){var _0x47b1f8={'raw':![],'where':{'id':_0x5ab810['params']['id']}},_0x1842ae={};_0x1842ae[_0xc85f('0x2f')]=_[_0xc85f('0x2b')](db['SalesforceAccount'][_0xc85f('0x27')]);_0x1842ae[_0xc85f('0x2c')]=_[_0xc85f('0x2b')](_0x5ab810[_0xc85f('0x2c')]);_0x1842ae[_0xc85f('0x2d')]=_['intersection'](_0x1842ae[_0xc85f('0x2f')],_0x1842ae[_0xc85f('0x2c')]);_0x47b1f8['attributes']=_[_0xc85f('0x2e')](_0x1842ae[_0xc85f('0x2f')],qs['fields'](_0x5ab810['query']['fields']));_0x47b1f8[_0xc85f('0x30')]=_0x47b1f8[_0xc85f('0x30')][_0xc85f('0x40')]?_0x47b1f8['attributes']:_0x1842ae[_0xc85f('0x2f')];if(_0x5ab810[_0xc85f('0x2c')]['includeAll']){_0x47b1f8['include']=[{'all':!![]}];}_0x47b1f8=_[_0xc85f('0x37')]({},_0x47b1f8,_0x5ab810[_0xc85f('0x39')]);return db[_0xc85f('0x3a')][_0xc85f('0x41')](_0x47b1f8)[_0xc85f('0x1f')](handleEntityNotFound(_0x2d4307,null))[_0xc85f('0x1f')](respondWithResult(_0x2d4307,null))[_0xc85f('0x3e')](handleError(_0x2d4307,null));};exports[_0xc85f('0x42')]=function(_0x3a118f,_0x171677){return db[_0xc85f('0x3a')][_0xc85f('0x42')](_0x3a118f['body'],{})[_0xc85f('0x1f')](respondWithResult(_0x171677,0xc9))[_0xc85f('0x3e')](handleError(_0x171677,null));};exports['update']=function(_0x17c280,_0x3e0c00){if(_0x17c280[_0xc85f('0x43')]['id']){delete _0x17c280[_0xc85f('0x43')]['id'];}return db[_0xc85f('0x3a')]['find']({'where':{'id':_0x17c280[_0xc85f('0x44')]['id']}})[_0xc85f('0x1f')](handleEntityNotFound(_0x3e0c00,null))['then'](saveUpdates(_0x17c280['body'],null))[_0xc85f('0x1f')](respondWithResult(_0x3e0c00,null))[_0xc85f('0x3e')](handleError(_0x3e0c00,null));};exports[_0xc85f('0x20')]=function(_0x263a9a,_0x191d04){return db['SalesforceAccount'][_0xc85f('0x41')]({'where':{'id':_0x263a9a[_0xc85f('0x44')]['id']}})[_0xc85f('0x1f')](handleEntityNotFound(_0x191d04,null))[_0xc85f('0x1f')](removeEntity(_0x191d04,null))[_0xc85f('0x3e')](handleError(_0x191d04,null));};exports[_0xc85f('0x45')]=function(_0x4e2290,_0x598e73,_0x148e30){var _0x19add8={};var _0x5ce7e2={};var _0x19968c;var _0x282afc;return db['SalesforceAccount'][_0xc85f('0x46')]({'where':{'id':_0x4e2290[_0xc85f('0x44')]['id']}})['then'](handleEntityNotFound(_0x598e73,null))[_0xc85f('0x1f')](function(_0x17b44c){if(_0x17b44c){_0x19968c=_0x17b44c;_0x5ce7e2[_0xc85f('0x2f')]=_['keys'](db[_0xc85f('0x47')]['rawAttributes']);_0x5ce7e2['query']=_[_0xc85f('0x2b')](_0x4e2290[_0xc85f('0x2c')]);_0x5ce7e2[_0xc85f('0x2d')]=_[_0xc85f('0x2e')](_0x5ce7e2[_0xc85f('0x2f')],_0x5ce7e2['query']);_0x19add8[_0xc85f('0x30')]=_[_0xc85f('0x2e')](_0x5ce7e2[_0xc85f('0x2f')],qs[_0xc85f('0x31')](_0x4e2290['query'][_0xc85f('0x31')]));_0x19add8[_0xc85f('0x30')]=_0x19add8[_0xc85f('0x30')][_0xc85f('0x40')]?_0x19add8[_0xc85f('0x30')]:_0x5ce7e2[_0xc85f('0x2f')];_0x19add8[_0xc85f('0x34')]=qs[_0xc85f('0x35')](_0x4e2290['query'][_0xc85f('0x35')]);_0x19add8['where']=qs['filters'](_['pick'](_0x4e2290[_0xc85f('0x2c')],_0x5ce7e2[_0xc85f('0x2d')]));if(_0x4e2290['query'][_0xc85f('0x48')]){_0x19add8[_0xc85f('0x36')]=_[_0xc85f('0x37')](_0x19add8[_0xc85f('0x36')],{'$or':_[_0xc85f('0x26')](_0x19add8[_0xc85f('0x30')],function(_0x33317a){var _0x3244ad={};_0x3244ad[_0x33317a]={'$like':'%'+_0x4e2290[_0xc85f('0x2c')][_0xc85f('0x48')]+'%'};return _0x3244ad;})});}_0x19add8=_[_0xc85f('0x37')]({},_0x19add8,_0x4e2290[_0xc85f('0x39')]);return _0x19968c[_0xc85f('0x45')](_0x19add8);}})[_0xc85f('0x1f')](function(_0x14c9b6){if(_0x14c9b6){_0x282afc=_0x14c9b6[_0xc85f('0x40')];if(!_0x4e2290['query'][_0xc85f('0x32')](_0xc85f('0x33'))){_0x19add8['limit']=qs[_0xc85f('0x18')](_0x4e2290[_0xc85f('0x2c')]['limit']);_0x19add8[_0xc85f('0x16')]=qs[_0xc85f('0x16')](_0x4e2290[_0xc85f('0x2c')][_0xc85f('0x16')]);}return _0x19968c[_0xc85f('0x45')](_0x19add8);}})[_0xc85f('0x1f')](function(_0x8cf4cf){if(_0x8cf4cf){return _0x8cf4cf?{'count':_0x282afc,'rows':_0x8cf4cf}:null;}})[_0xc85f('0x1f')](respondWithResult(_0x598e73,null))[_0xc85f('0x3e')](handleError(_0x598e73,null));};exports[_0xc85f('0x49')]=function(_0xe28fe,_0x3f248a,_0x50c0f5){if(_0xe28fe['body']['id']){delete _0xe28fe['body']['id'];}return db[_0xc85f('0x3a')][_0xc85f('0x46')]({'where':{'id':_0xe28fe[_0xc85f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f248a,null))[_0xc85f('0x1f')](function(_0x4df548){if(_0x4df548){_0xe28fe[_0xc85f('0x43')][_0xc85f('0x4a')]=_0x4df548['id'];_0xe28fe[_0xc85f('0x43')][_0xc85f('0x4b')]=integrations[_0xc85f('0x4c')](_0xe28fe[_0xc85f('0x43')][_0xc85f('0x4d')],_0xe28fe[_0xc85f('0x43')]['type']);_0xe28fe[_0xc85f('0x43')][_0xc85f('0x4e')]=integrations[_0xc85f('0x4f')](_0xe28fe[_0xc85f('0x43')][_0xc85f('0x4d')],_0xe28fe[_0xc85f('0x43')][_0xc85f('0x29')]);return db[_0xc85f('0x47')][_0xc85f('0x42')](_0xe28fe[_0xc85f('0x43')],{'include':[{'model':db[_0xc85f('0x50')],'as':_0xc85f('0x4b')},{'model':db[_0xc85f('0x50')],'as':_0xc85f('0x4e')}]});}return null;})[_0xc85f('0x1f')](respondWithResult(_0x3f248a,null))[_0xc85f('0x3e')](handleError(_0x3f248a,null));};exports[_0xc85f('0x51')]=function(_0x7ff56d,_0x3c19e6,_0x2f0ba7){var _0x5e60bb;var _0x231332='';var _0x514de9=_0xc85f('0x52');return db[_0xc85f('0x3a')][_0xc85f('0x46')]({'where':{'id':_0x7ff56d['params']['id']},'attributes':['id',_0xc85f('0x53'),'clientId',_0xc85f('0x54'),_0xc85f('0x55'),_0xc85f('0x56'),_0xc85f('0x57')]})[_0xc85f('0x1f')](handleEntityNotFound(_0x3c19e6,null))[_0xc85f('0x1f')](function(_0x3d979e){if(_0x3d979e){_0x231332=_0x3d979e[_0xc85f('0x53')];var _0x5e4399=_0x231332['slice'](-0x1);if(_0x5e4399==='/'){_0x231332=_0x231332[_0xc85f('0x58')](0x0,_0x231332[_0xc85f('0x59')](_0x5e4399));}_0x5e60bb=new jsforce[(_0xc85f('0x5a'))]({'oauth2':{'loginUrl':_0x231332,'clientId':_0x3d979e['clientId'],'clientSecret':_0x3d979e[_0xc85f('0x54')]}});return _0x5e60bb['login'](_0x3d979e['username'],_0x3d979e[_0xc85f('0x56')][_0xc85f('0x5b')](_0x3d979e[_0xc85f('0x57')]));}})[_0xc85f('0x1f')](function(_0x1eb1f1){if(_0x1eb1f1){if(!_[_0xc85f('0x5c')](_0x7ff56d[_0xc85f('0x2c')][_0xc85f('0x5d')])){_0x514de9=_0x7ff56d[_0xc85f('0x2c')]['ticketType'];}return _0x5e60bb['sobject'](_0x514de9)[_0xc85f('0x5e')]();}})['then'](function(_0x1c49b2){var _0x493e3b=[_0xc85f('0x5f'),_0xc85f('0x60'),'IsReminderSet',_0xc85f('0x61'),_0xc85f('0x62'),_0xc85f('0x63')];var _0x35b002=[_0xc85f('0x64'),_0xc85f('0x65'),_0xc85f('0x66'),'boolean',_0xc85f('0x67'),_0xc85f('0x68'),_0xc85f('0x69')];if(_0x1c49b2){_[_0xc85f('0x6a')](_0x1c49b2[_0xc85f('0x31')],function(_0x46228f){return _0x493e3b['includes'](_0x46228f[_0xc85f('0x23')])||!_0x35b002[_0xc85f('0x6b')](_0x46228f[_0xc85f('0x29')]);});return{'count':_0x1c49b2['fields'][_0xc85f('0x40')],'rows':_['map'](_0x1c49b2[_0xc85f('0x31')],function(_0x426dc1){return{'id':_0x426dc1['name'],'name':_0x426dc1[_0xc85f('0x6c')],'custom':_0x426dc1[_0xc85f('0x6d')],'options':_0x426dc1[_0xc85f('0x6e')][_0xc85f('0x40')]>0x0?_['map'](_0x426dc1[_0xc85f('0x6e')],function(_0x252e49){return{'name':_0x252e49[_0xc85f('0x6c')],'value':_0x252e49[_0xc85f('0x6f')]};}):_0x426dc1[_0xc85f('0x29')]==_0xc85f('0x70')?[{'name':'True','value':_0xc85f('0x71')},{'name':_0xc85f('0x72'),'value':_0xc85f('0x73')}]:[]};})};}})[_0xc85f('0x1f')](respondWithResult(_0x3c19e6,null))[_0xc85f('0x3e')](function(_0x4346b8){var _0x1f3f03=_0x7ff56d[_0xc85f('0x2c')]['test']?0x1f4:_0x4346b8[_0xc85f('0x74')]||0x1f4;logger[_0xc85f('0x21')](_0xc85f('0x75'),_0xc85f('0x51'),_0x1f3f03,JSON[_0xc85f('0x76')](_0x4346b8));delete _0x4346b8['name'];if(_0x1f3f03===0x191){_0x1f3f03=0x190;}_0x3c19e6[_0xc85f('0x14')](_0x1f3f03)[_0xc85f('0x24')](_0x7ff56d['query'][_0xc85f('0x77')]?{'message':_0xc85f('0x78'),'statusCode':_0x4346b8['statusCode']}:_0x4346b8);});}; \ No newline at end of file +var _0xd176=['destroy','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','length','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','fields','find','catch','create','body','update','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','value','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','json'];(function(_0x2fbbc2,_0x5d1b8c){var _0x4a55f5=function(_0x19a926){while(--_0x19a926){_0x2fbbc2['push'](_0x2fbbc2['shift']());}};_0x4a55f5(++_0x5d1b8c);}(_0xd176,0x19c));var _0x6d17=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0xd176[_0x204ad4];return _0x50675f;};'use strict';var emlformat=require(_0x6d17('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d17('0x1'));var jsonpatch=require(_0x6d17('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6d17('0x3'));var Mustache=require(_0x6d17('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6d17('0x5'));var csv=require('to-csv');var ejs=require(_0x6d17('0x6'));var fs=require('fs');var fs_extra=require(_0x6d17('0x7'));var _=require('lodash');var squel=require(_0x6d17('0x8'));var crypto=require(_0x6d17('0x9'));var jsforce=require(_0x6d17('0xa'));var deskjs=require(_0x6d17('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6d17('0xc'));var Papa=require(_0x6d17('0xd'));var Redis=require(_0x6d17('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d17('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d17('0x10'));var logger=require(_0x6d17('0x11'))(_0x6d17('0x12'));var utils=require('../../config/utils');var config=require(_0x6d17('0x13'));var licenseUtil=require(_0x6d17('0x14'));var db=require(_0x6d17('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x17983f,_0x3c4bb7){_0x3c4bb7=_0x3c4bb7||0xcc;return function(_0x553433){if(_0x553433){return _0x17983f[_0x6d17('0x16')](_0x3c4bb7);}return _0x17983f['status'](_0x3c4bb7)['end']();};}function respondWithResult(_0x739973,_0x2f2ea4){_0x2f2ea4=_0x2f2ea4||0xc8;return function(_0x237e98){if(_0x237e98){return _0x739973[_0x6d17('0x17')](_0x2f2ea4)['json'](_0x237e98);}};}function respondWithFilteredResult(_0x719f75,_0x2af85b){return function(_0x16400c){if(_0x16400c){var _0x3ab83f=typeof _0x2af85b['offset']===_0x6d17('0x18')&&typeof _0x2af85b[_0x6d17('0x19')]===_0x6d17('0x18');var _0x49a5c7=_0x16400c['count'];var _0x44d56b=_0x3ab83f?0x0:_0x2af85b[_0x6d17('0x1a')];var _0x4c76f0=_0x3ab83f?_0x16400c['count']:_0x2af85b[_0x6d17('0x1a')]+_0x2af85b[_0x6d17('0x19')];var _0x5a5fc5;if(_0x4c76f0>=_0x49a5c7){_0x4c76f0=_0x49a5c7;_0x5a5fc5=0xc8;}else{_0x5a5fc5=0xce;}_0x719f75[_0x6d17('0x17')](_0x5a5fc5);return _0x719f75['set']('Content-Range',_0x44d56b+'-'+_0x4c76f0+'/'+_0x49a5c7)[_0x6d17('0x1b')](_0x16400c);}return null;};}function patchUpdates(_0xee5258){return function(_0x4fbe48){try{jsonpatch['apply'](_0x4fbe48,_0xee5258,!![]);}catch(_0x277fb1){return BPromise['reject'](_0x277fb1);}return _0x4fbe48['save']();};}function saveUpdates(_0x273566,_0xca1e66){return function(_0xd94f5f){if(_0xd94f5f){return _0xd94f5f['update'](_0x273566)['then'](function(_0x18fdd4){return _0x18fdd4;});}return null;};}function removeEntity(_0x5a6871,_0x1a7779){return function(_0x55a39e){if(_0x55a39e){return _0x55a39e[_0x6d17('0x1c')]()[_0x6d17('0x1d')](function(){_0x5a6871[_0x6d17('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b19b1,_0x4ba466){return function(_0x20ad06){if(!_0x20ad06){_0x4b19b1[_0x6d17('0x16')](0x194);}return _0x20ad06;};}function handleError(_0x55b311,_0x33eb0e){_0x33eb0e=_0x33eb0e||0x1f4;return function(_0x1dbb50){logger[_0x6d17('0x1e')](_0x1dbb50[_0x6d17('0x1f')]);if(_0x1dbb50['name']){delete _0x1dbb50[_0x6d17('0x20')];}_0x55b311[_0x6d17('0x17')](_0x33eb0e)[_0x6d17('0x21')](_0x1dbb50);};}exports[_0x6d17('0x22')]=function(_0x42d861,_0x4bf6e7){var _0x30925c={},_0x4618f6={},_0x5d1c32={'count':0x0,'rows':[]};var _0xbd549d=_[_0x6d17('0x23')](db[_0x6d17('0x24')][_0x6d17('0x25')],function(_0x40207f){return{'name':_0x40207f['fieldName'],'type':_0x40207f[_0x6d17('0x26')][_0x6d17('0x27')]};});_0x4618f6['model']=_[_0x6d17('0x23')](_0xbd549d,'name');_0x4618f6[_0x6d17('0x28')]=_[_0x6d17('0x29')](_0x42d861[_0x6d17('0x28')]);_0x4618f6[_0x6d17('0x2a')]=_['intersection'](_0x4618f6['model'],_0x4618f6[_0x6d17('0x28')]);_0x30925c[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x4618f6[_0x6d17('0x2d')],qs['fields'](_0x42d861[_0x6d17('0x28')]['fields']));_0x30925c[_0x6d17('0x2b')]=_0x30925c[_0x6d17('0x2b')][_0x6d17('0x2e')]?_0x30925c[_0x6d17('0x2b')]:_0x4618f6[_0x6d17('0x2d')];if(!_0x42d861[_0x6d17('0x28')]['hasOwnProperty']('nolimit')){_0x30925c[_0x6d17('0x19')]=qs['limit'](_0x42d861[_0x6d17('0x28')][_0x6d17('0x19')]);_0x30925c[_0x6d17('0x1a')]=qs[_0x6d17('0x1a')](_0x42d861['query'][_0x6d17('0x1a')]);}_0x30925c[_0x6d17('0x2f')]=qs['sort'](_0x42d861['query'][_0x6d17('0x30')]);_0x30925c[_0x6d17('0x31')]=qs[_0x6d17('0x2a')](_[_0x6d17('0x32')](_0x42d861[_0x6d17('0x28')],_0x4618f6[_0x6d17('0x2a')]),_0xbd549d);if(_0x42d861[_0x6d17('0x28')][_0x6d17('0x33')]){_0x30925c['where']=_[_0x6d17('0x34')](_0x30925c[_0x6d17('0x31')],{'$or':_[_0x6d17('0x23')](_0xbd549d,function(_0x3a6b9a){if(_0x3a6b9a[_0x6d17('0x26')]!=='VIRTUAL'){var _0x103bb7={};_0x103bb7[_0x3a6b9a['name']]={'$like':'%'+_0x42d861[_0x6d17('0x28')][_0x6d17('0x33')]+'%'};return _0x103bb7;}})});}_0x30925c=_['merge']({},_0x30925c,_0x42d861[_0x6d17('0x35')]);var _0x399c70={'where':_0x30925c[_0x6d17('0x31')]};return db[_0x6d17('0x24')][_0x6d17('0x36')](_0x399c70)['then'](function(_0x1bafc1){_0x5d1c32['count']=_0x1bafc1;if(_0x42d861[_0x6d17('0x28')][_0x6d17('0x37')]){_0x30925c[_0x6d17('0x38')]=[{'all':!![]}];}return db[_0x6d17('0x24')][_0x6d17('0x39')](_0x30925c);})[_0x6d17('0x1d')](function(_0x9809d3){_0x5d1c32['rows']=_0x9809d3;return _0x5d1c32;})['then'](respondWithFilteredResult(_0x4bf6e7,_0x30925c))['catch'](handleError(_0x4bf6e7,null));};exports[_0x6d17('0x3a')]=function(_0x228efe,_0x424120){var _0x5a135c={'raw':![],'where':{'id':_0x228efe[_0x6d17('0x3b')]['id']}},_0x1be626={};_0x1be626['model']=_[_0x6d17('0x29')](db[_0x6d17('0x24')][_0x6d17('0x25')]);_0x1be626['query']=_['keys'](_0x228efe[_0x6d17('0x28')]);_0x1be626[_0x6d17('0x2a')]=_['intersection'](_0x1be626[_0x6d17('0x2d')],_0x1be626['query']);_0x5a135c[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x1be626[_0x6d17('0x2d')],qs[_0x6d17('0x3c')](_0x228efe['query'][_0x6d17('0x3c')]));_0x5a135c[_0x6d17('0x2b')]=_0x5a135c[_0x6d17('0x2b')][_0x6d17('0x2e')]?_0x5a135c[_0x6d17('0x2b')]:_0x1be626[_0x6d17('0x2d')];if(_0x228efe[_0x6d17('0x28')][_0x6d17('0x37')]){_0x5a135c[_0x6d17('0x38')]=[{'all':!![]}];}_0x5a135c=_[_0x6d17('0x34')]({},_0x5a135c,_0x228efe['options']);return db[_0x6d17('0x24')][_0x6d17('0x3d')](_0x5a135c)[_0x6d17('0x1d')](handleEntityNotFound(_0x424120,null))[_0x6d17('0x1d')](respondWithResult(_0x424120,null))[_0x6d17('0x3e')](handleError(_0x424120,null));};exports[_0x6d17('0x3f')]=function(_0x2d1e2e,_0x5314dd){return db[_0x6d17('0x24')][_0x6d17('0x3f')](_0x2d1e2e[_0x6d17('0x40')],{})['then'](respondWithResult(_0x5314dd,0xc9))[_0x6d17('0x3e')](handleError(_0x5314dd,null));};exports[_0x6d17('0x41')]=function(_0x20210e,_0x3d5a13){if(_0x20210e[_0x6d17('0x40')]['id']){delete _0x20210e['body']['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x20210e[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x3d5a13,null))[_0x6d17('0x1d')](saveUpdates(_0x20210e[_0x6d17('0x40')],null))['then'](respondWithResult(_0x3d5a13,null))[_0x6d17('0x3e')](handleError(_0x3d5a13,null));};exports[_0x6d17('0x1c')]=function(_0x4cddb6,_0x35ae93){return db[_0x6d17('0x24')]['find']({'where':{'id':_0x4cddb6[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x35ae93,null))['then'](removeEntity(_0x35ae93,null))[_0x6d17('0x3e')](handleError(_0x35ae93,null));};exports[_0x6d17('0x42')]=function(_0xafdc8c,_0x1b81b1,_0xd923f7){var _0x173c33={};var _0x56b0f8={};var _0xf82207;var _0x2f5969;return db[_0x6d17('0x24')]['findOne']({'where':{'id':_0xafdc8c[_0x6d17('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1b81b1,null))['then'](function(_0x26c756){if(_0x26c756){_0xf82207=_0x26c756;_0x56b0f8[_0x6d17('0x2d')]=_[_0x6d17('0x29')](db['SalesforceConfiguration'][_0x6d17('0x25')]);_0x56b0f8[_0x6d17('0x28')]=_['keys'](_0xafdc8c[_0x6d17('0x28')]);_0x56b0f8[_0x6d17('0x2a')]=_[_0x6d17('0x2c')](_0x56b0f8[_0x6d17('0x2d')],_0x56b0f8[_0x6d17('0x28')]);_0x173c33[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x56b0f8[_0x6d17('0x2d')],qs['fields'](_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x3c')]));_0x173c33[_0x6d17('0x2b')]=_0x173c33['attributes'][_0x6d17('0x2e')]?_0x173c33['attributes']:_0x56b0f8['model'];_0x173c33[_0x6d17('0x2f')]=qs[_0x6d17('0x30')](_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x30')]);_0x173c33[_0x6d17('0x31')]=qs[_0x6d17('0x2a')](_[_0x6d17('0x32')](_0xafdc8c['query'],_0x56b0f8[_0x6d17('0x2a')]));if(_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x33')]){_0x173c33['where']=_[_0x6d17('0x34')](_0x173c33[_0x6d17('0x31')],{'$or':_[_0x6d17('0x23')](_0x173c33['attributes'],function(_0xc1b34f){var _0x11dced={};_0x11dced[_0xc1b34f]={'$like':'%'+_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x33')]+'%'};return _0x11dced;})});}_0x173c33=_[_0x6d17('0x34')]({},_0x173c33,_0xafdc8c['options']);return _0xf82207['getConfigurations'](_0x173c33);}})['then'](function(_0x52f2b8){if(_0x52f2b8){_0x2f5969=_0x52f2b8['length'];if(!_0xafdc8c[_0x6d17('0x28')][_0x6d17('0x43')]('nolimit')){_0x173c33[_0x6d17('0x19')]=qs['limit'](_0xafdc8c[_0x6d17('0x28')]['limit']);_0x173c33['offset']=qs['offset'](_0xafdc8c['query'][_0x6d17('0x1a')]);}return _0xf82207[_0x6d17('0x42')](_0x173c33);}})['then'](function(_0x3a9329){if(_0x3a9329){return _0x3a9329?{'count':_0x2f5969,'rows':_0x3a9329}:null;}})[_0x6d17('0x1d')](respondWithResult(_0x1b81b1,null))['catch'](handleError(_0x1b81b1,null));};exports[_0x6d17('0x44')]=function(_0x4db3dc,_0x422ee3,_0x271bc0){if(_0x4db3dc[_0x6d17('0x40')]['id']){delete _0x4db3dc[_0x6d17('0x40')]['id'];}return db[_0x6d17('0x24')][_0x6d17('0x45')]({'where':{'id':_0x4db3dc[_0x6d17('0x3b')]['id']}})[_0x6d17('0x1d')](handleEntityNotFound(_0x422ee3,null))['then'](function(_0x11eb16){if(_0x11eb16){_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x46')]=_0x11eb16['id'];_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x47')]=integrations[_0x6d17('0x48')](_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x49')],_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x26')]);_0x4db3dc['body'][_0x6d17('0x4a')]=integrations['getDescriptions'](_0x4db3dc[_0x6d17('0x40')]['channel'],_0x4db3dc[_0x6d17('0x40')][_0x6d17('0x26')]);return db['SalesforceConfiguration'][_0x6d17('0x3f')](_0x4db3dc[_0x6d17('0x40')],{'include':[{'model':db[_0x6d17('0x4b')],'as':_0x6d17('0x47')},{'model':db[_0x6d17('0x4b')],'as':_0x6d17('0x4a')}]});}return null;})[_0x6d17('0x1d')](respondWithResult(_0x422ee3,null))['catch'](handleError(_0x422ee3,null));};exports[_0x6d17('0x4c')]=function(_0x25ef17,_0xc0c4e,_0x287283){var _0x4dbd7c;var _0x232dd3='';var _0x5d326e='Task';return db['SalesforceAccount'][_0x6d17('0x45')]({'where':{'id':_0x25ef17[_0x6d17('0x3b')]['id']},'attributes':['id','remoteUri','clientId',_0x6d17('0x4d'),_0x6d17('0x4e'),'password',_0x6d17('0x4f')]})[_0x6d17('0x1d')](handleEntityNotFound(_0xc0c4e,null))[_0x6d17('0x1d')](function(_0x226892){if(_0x226892){_0x232dd3=_0x226892['remoteUri'];var _0x17ab9b=_0x232dd3[_0x6d17('0x50')](-0x1);if(_0x17ab9b==='/'){_0x232dd3=_0x232dd3[_0x6d17('0x51')](0x0,_0x232dd3[_0x6d17('0x52')](_0x17ab9b));}_0x4dbd7c=new jsforce[(_0x6d17('0x53'))]({'oauth2':{'loginUrl':_0x232dd3,'clientId':_0x226892['clientId'],'clientSecret':_0x226892['clientSecret']}});return _0x4dbd7c[_0x6d17('0x54')](_0x226892[_0x6d17('0x4e')],_0x226892['password'][_0x6d17('0x55')](_0x226892[_0x6d17('0x4f')]));}})[_0x6d17('0x1d')](function(_0x4f53b0){if(_0x4f53b0){if(!_[_0x6d17('0x56')](_0x25ef17[_0x6d17('0x28')][_0x6d17('0x57')])){_0x5d326e=_0x25ef17[_0x6d17('0x28')][_0x6d17('0x57')];}return _0x4dbd7c['sobject'](_0x5d326e)[_0x6d17('0x58')]();}})['then'](function(_0x442012){var _0x4ac88b=[_0x6d17('0x59'),_0x6d17('0x5a'),_0x6d17('0x5b'),_0x6d17('0x5c'),_0x6d17('0x5d'),_0x6d17('0x5e')];var _0x465537=[_0x6d17('0x5f'),'int',_0x6d17('0x60'),_0x6d17('0x61'),_0x6d17('0x62'),_0x6d17('0x63'),_0x6d17('0x64')];if(_0x442012){_[_0x6d17('0x65')](_0x442012[_0x6d17('0x3c')],function(_0x3f06fb){return _0x4ac88b[_0x6d17('0x66')](_0x3f06fb[_0x6d17('0x20')])||!_0x465537[_0x6d17('0x66')](_0x3f06fb[_0x6d17('0x26')]);});return{'count':_0x442012[_0x6d17('0x3c')]['length'],'rows':_[_0x6d17('0x23')](_0x442012['fields'],function(_0x390310){return{'id':_0x390310[_0x6d17('0x20')],'name':_0x390310[_0x6d17('0x67')],'custom':_0x390310[_0x6d17('0x68')],'options':_0x390310['picklistValues']['length']>0x0?_[_0x6d17('0x23')](_0x390310['picklistValues'],function(_0x4cc040){return{'name':_0x4cc040[_0x6d17('0x67')],'value':_0x4cc040[_0x6d17('0x69')]};}):_0x390310['type']==_0x6d17('0x61')?[{'name':'True','value':'true'},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0xc0c4e,null))[_0x6d17('0x3e')](function(_0x3bb232){var _0x12bb1a=_0x25ef17['query'][_0x6d17('0x6a')]?0x1f4:_0x3bb232[_0x6d17('0x6b')]||0x1f4;logger[_0x6d17('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0x6d17('0x4c'),_0x12bb1a,JSON[_0x6d17('0x6c')](_0x3bb232));delete _0x3bb232[_0x6d17('0x20')];if(_0x12bb1a===0x191){_0x12bb1a=0x190;}_0xc0c4e[_0x6d17('0x17')](_0x12bb1a)['send'](_0x25ef17[_0x6d17('0x28')][_0x6d17('0x6a')]?{'message':_0x6d17('0x6d'),'statusCode':_0x3bb232[_0x6d17('0x6b')]}:_0x3bb232);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bb76000..fda30d5 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 _0x2ed4=['request-promise','path','rimraf','../../config/environment','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d3a5d,_0x17fc32){var _0x257078=function(_0x482f3a){while(--_0x482f3a){_0x1d3a5d['push'](_0x1d3a5d['shift']());}};_0x257078(++_0x17fc32);}(_0x2ed4,0x1b3));var _0x42ed=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x2ed4[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x42ed('0x0'));var util=require('util');var logger=require(_0x42ed('0x1'))(_0x42ed('0x2'));var moment=require(_0x42ed('0x3'));var BPromise=require(_0x42ed('0x4'));var rp=require(_0x42ed('0x5'));var fs=require('fs');var path=require(_0x42ed('0x6'));var rimraf=require(_0x42ed('0x7'));var config=require(_0x42ed('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x42ed('0x9')]=function(_0xfc6e2,_0x3778ee){return _0xfc6e2[_0x42ed('0xa')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1323=['../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','rimraf'];(function(_0x242117,_0x505596){var _0x51e9df=function(_0x522ddc){while(--_0x522ddc){_0x242117['push'](_0x242117['shift']());}};_0x51e9df(++_0x505596);}(_0x1323,0xcc));var _0x3132=function(_0x261861,_0x4f0a05){_0x261861=_0x261861-0x0;var _0x330f1b=_0x1323[_0x261861];return _0x330f1b;};'use strict';var _=require('lodash');var util=require(_0x3132('0x0'));var logger=require(_0x3132('0x1'))(_0x3132('0x2'));var moment=require(_0x3132('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3132('0x4'));var config=require(_0x3132('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x3132('0x6'));module[_0x3132('0x7')]=function(_0x30a5d5,_0x4f10b8){return _0x30a5d5[_0x3132('0x8')](_0x3132('0x9'),attributes,{'tableName':_0x3132('0xa'),'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 93a6b7e..06a9fd6 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 _0xe6ff=['ShowSalesforceAccount','stringify','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','SalesforceAccount','find'];(function(_0x58cc40,_0x183602){var _0x19f72b=function(_0x26cc96){while(--_0x26cc96){_0x58cc40['push'](_0x58cc40['shift']());}};_0x19f72b(++_0x183602);}(_0xe6ff,0xe2));var _0xfe6f=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xe6ff[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require(_0xfe6f('0x0'));var moment=require(_0xfe6f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe6f('0x2'));var db=require(_0xfe6f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe6f('0x4'))(_0xfe6f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfe6f('0x6')][_0xfe6f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x470235,_0x250a62,_0x35f5d5){return new BPromise(function(_0x2d4ddf,_0x399188){return client['request'](_0x470235,_0x35f5d5)[_0xfe6f('0x8')](function(_0x2a68c0){logger[_0xfe6f('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x250a62,_0xfe6f('0xa'));logger[_0xfe6f('0xb')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x250a62,_0xfe6f('0xa'),JSON['stringify'](_0x2a68c0));if(_0x2a68c0[_0xfe6f('0xc')]){if(_0x2a68c0[_0xfe6f('0xc')][_0xfe6f('0xd')]===0x1f4){logger[_0xfe6f('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x250a62,_0x2a68c0[_0xfe6f('0xc')]['message']);return _0x399188(_0x2a68c0[_0xfe6f('0xc')][_0xfe6f('0xe')]);}logger[_0xfe6f('0xc')](_0xfe6f('0xf'),_0x250a62,_0x2a68c0[_0xfe6f('0xc')][_0xfe6f('0xe')]);return _0x2d4ddf(_0x2a68c0[_0xfe6f('0xc')][_0xfe6f('0xe')]);}else{logger['info'](_0xfe6f('0xf'),_0x250a62,_0xfe6f('0xa'));_0x2d4ddf(_0x2a68c0[_0xfe6f('0x10')][_0xfe6f('0xe')]);}})[_0xfe6f('0x11')](function(_0x262c16){logger[_0xfe6f('0xc')](_0xfe6f('0xf'),_0x250a62,_0x262c16);_0x399188(_0x262c16);});});}exports['GetSalesforceAccount']=function(_0x549b9d){var _0x20f507=this;return new Promise(function(_0x4374d2,_0x4fd4b8){return db['SalesforceAccount'][_0xfe6f('0x12')]({'raw':_0x549b9d['options']?_0x549b9d[_0xfe6f('0x13')][_0xfe6f('0x14')]===undefined?!![]:![]:!![],'where':_0x549b9d['options']?_0x549b9d[_0xfe6f('0x13')][_0xfe6f('0x15')]||null:null,'attributes':_0x549b9d[_0xfe6f('0x13')]?_0x549b9d[_0xfe6f('0x13')][_0xfe6f('0x16')]||null:null,'limit':_0x549b9d[_0xfe6f('0x13')]?_0x549b9d[_0xfe6f('0x13')][_0xfe6f('0x17')]||null:null,'include':_0x549b9d[_0xfe6f('0x13')]?_0x549b9d['options'][_0xfe6f('0x18')]?_[_0xfe6f('0x19')](_0x549b9d[_0xfe6f('0x13')][_0xfe6f('0x18')],function(_0x17302d){return{'model':db[_0x17302d[_0xfe6f('0x1a')]],'as':_0x17302d['as'],'attributes':_0x17302d[_0xfe6f('0x16')],'include':_0x17302d[_0xfe6f('0x18')]?_[_0xfe6f('0x19')](_0x17302d[_0xfe6f('0x18')],function(_0xccde){return{'model':db[_0xccde[_0xfe6f('0x1a')]],'as':_0xccde['as'],'attributes':_0xccde['attributes'],'include':_0xccde['include']?_['map'](_0xccde[_0xfe6f('0x18')],function(_0x2fd934){return{'model':db[_0x2fd934['model']],'as':_0x2fd934['as'],'attributes':_0x2fd934[_0xfe6f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe6f('0x8')](function(_0x35df9b){logger[_0xfe6f('0x9')](_0xfe6f('0x1b'),_0x549b9d);logger[_0xfe6f('0xb')]('GetSalesforceAccount',_0x549b9d,JSON['stringify'](_0x35df9b));_0x4374d2(_0x35df9b);})['catch'](function(_0xe63b33){logger[_0xfe6f('0xc')](_0xfe6f('0x1b'),_0xe63b33[_0xfe6f('0xe')],_0x549b9d);_0x4fd4b8(_0x20f507['error'](0x1f4,_0xe63b33[_0xfe6f('0xe')]));});});};exports['ShowSalesforceAccount']=function(_0x55e55d){var _0x56c977=this;return new Promise(function(_0x167327,_0x5d583b){return db[_0xfe6f('0x1c')][_0xfe6f('0x1d')]({'raw':_0x55e55d[_0xfe6f('0x13')]?_0x55e55d[_0xfe6f('0x13')][_0xfe6f('0x14')]===undefined?!![]:![]:!![],'where':_0x55e55d['options']?_0x55e55d['options'][_0xfe6f('0x15')]||null:null,'attributes':_0x55e55d['options']?_0x55e55d['options'][_0xfe6f('0x16')]||null:null,'include':_0x55e55d['options']?_0x55e55d[_0xfe6f('0x13')][_0xfe6f('0x18')]?_[_0xfe6f('0x19')](_0x55e55d[_0xfe6f('0x13')][_0xfe6f('0x18')],function(_0x5cee76){return{'model':db[_0x5cee76[_0xfe6f('0x1a')]],'as':_0x5cee76['as'],'attributes':_0x5cee76[_0xfe6f('0x16')],'include':_0x5cee76[_0xfe6f('0x18')]?_['map'](_0x5cee76[_0xfe6f('0x18')],function(_0x127b21){return{'model':db[_0x127b21[_0xfe6f('0x1a')]],'as':_0x127b21['as'],'attributes':_0x127b21[_0xfe6f('0x16')],'include':_0x127b21[_0xfe6f('0x18')]?_[_0xfe6f('0x19')](_0x127b21[_0xfe6f('0x18')],function(_0x277159){return{'model':db[_0x277159[_0xfe6f('0x1a')]],'as':_0x277159['as'],'attributes':_0x277159['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe6f('0x8')](function(_0xa96a6b){logger[_0xfe6f('0x9')](_0xfe6f('0x1e'),_0x55e55d);logger[_0xfe6f('0xb')]('ShowSalesforceAccount',_0x55e55d,JSON[_0xfe6f('0x1f')](_0xa96a6b));_0x167327(_0xa96a6b);})[_0xfe6f('0x11')](function(_0x53f0e7){logger[_0xfe6f('0xc')](_0xfe6f('0x1e'),_0x53f0e7[_0xfe6f('0xe')],_0x55e55d);_0x5d583b(_0x56c977['error'](0x1f4,_0x53f0e7['message']));});});}; \ No newline at end of file +var _0xbc71=['include','map','model','catch','ShowSalesforceAccount','find','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit'];(function(_0x58a03d,_0x4276e5){var _0xd3e2e9=function(_0x292a88){while(--_0x292a88){_0x58a03d['push'](_0x58a03d['shift']());}};_0xd3e2e9(++_0x4276e5);}(_0xbc71,0x86));var _0x1bc7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbc71[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1bc7('0x0'));var util=require('util');var moment=require(_0x1bc7('0x1'));var BPromise=require('bluebird');var rs=require(_0x1bc7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bc7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bc7('0x4'));var config=require(_0x1bc7('0x5'));var jayson=require(_0x1bc7('0x6'));var client=jayson['client'][_0x1bc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ea667,_0xeb4ea4,_0x15e220){return new BPromise(function(_0x4cf0a4,_0x844b0a){return client['request'](_0x2ea667,_0x15e220)[_0x1bc7('0x8')](function(_0x5ba951){logger[_0x1bc7('0x9')](_0x1bc7('0xa'),_0xeb4ea4,'request\x20sent');logger[_0x1bc7('0xb')](_0x1bc7('0xc'),_0xeb4ea4,_0x1bc7('0xd'),JSON[_0x1bc7('0xe')](_0x5ba951));if(_0x5ba951['error']){if(_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x10')]===0x1f4){logger['error'](_0x1bc7('0xa'),_0xeb4ea4,_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x11')]);return _0x844b0a(_0x5ba951[_0x1bc7('0xf')][_0x1bc7('0x11')]);}logger['error'](_0x1bc7('0xa'),_0xeb4ea4,_0x5ba951['error']['message']);return _0x4cf0a4(_0x5ba951['error'][_0x1bc7('0x11')]);}else{logger[_0x1bc7('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0xeb4ea4,_0x1bc7('0xd'));_0x4cf0a4(_0x5ba951['result'][_0x1bc7('0x11')]);}})['catch'](function(_0x5806f1){logger[_0x1bc7('0xf')](_0x1bc7('0xa'),_0xeb4ea4,_0x5806f1);_0x844b0a(_0x5806f1);});});}exports[_0x1bc7('0x12')]=function(_0xbd4f88){var _0x2b0ae4=this;return new Promise(function(_0x21e3f3,_0x2e309e){return db[_0x1bc7('0x13')][_0x1bc7('0x14')]({'raw':_0xbd4f88['options']?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x16')]===undefined?!![]:![]:!![],'where':_0xbd4f88['options']?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x17')]||null:null,'attributes':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x18')]||null:null,'limit':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x19')]||null:null,'include':_0xbd4f88[_0x1bc7('0x15')]?_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0xbd4f88[_0x1bc7('0x15')][_0x1bc7('0x1a')],function(_0x3ce3d8){return{'model':db[_0x3ce3d8['model']],'as':_0x3ce3d8['as'],'attributes':_0x3ce3d8['attributes'],'include':_0x3ce3d8[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x3ce3d8[_0x1bc7('0x1a')],function(_0x1cddb4){return{'model':db[_0x1cddb4[_0x1bc7('0x1c')]],'as':_0x1cddb4['as'],'attributes':_0x1cddb4[_0x1bc7('0x18')],'include':_0x1cddb4[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x1cddb4['include'],function(_0x552a84){return{'model':db[_0x552a84[_0x1bc7('0x1c')]],'as':_0x552a84['as'],'attributes':_0x552a84[_0x1bc7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1bc7('0x8')](function(_0x584a2c){logger[_0x1bc7('0x9')](_0x1bc7('0x12'),_0xbd4f88);logger[_0x1bc7('0xb')]('GetSalesforceAccount',_0xbd4f88,JSON[_0x1bc7('0xe')](_0x584a2c));_0x21e3f3(_0x584a2c);})[_0x1bc7('0x1d')](function(_0xdb5fbd){logger[_0x1bc7('0xf')](_0x1bc7('0x12'),_0xdb5fbd[_0x1bc7('0x11')],_0xbd4f88);_0x2e309e(_0x2b0ae4['error'](0x1f4,_0xdb5fbd[_0x1bc7('0x11')]));});});};exports[_0x1bc7('0x1e')]=function(_0x326a0e){var _0x14b2dd=this;return new Promise(function(_0x56b059,_0x460749){return db[_0x1bc7('0x13')][_0x1bc7('0x1f')]({'raw':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x16')]===undefined?!![]:![]:!![],'where':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e['options'][_0x1bc7('0x17')]||null:null,'attributes':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x18')]||null:null,'include':_0x326a0e[_0x1bc7('0x15')]?_0x326a0e[_0x1bc7('0x15')][_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x326a0e['options'][_0x1bc7('0x1a')],function(_0x3ee7a8){return{'model':db[_0x3ee7a8['model']],'as':_0x3ee7a8['as'],'attributes':_0x3ee7a8[_0x1bc7('0x18')],'include':_0x3ee7a8['include']?_[_0x1bc7('0x1b')](_0x3ee7a8[_0x1bc7('0x1a')],function(_0x48ef5c){return{'model':db[_0x48ef5c[_0x1bc7('0x1c')]],'as':_0x48ef5c['as'],'attributes':_0x48ef5c[_0x1bc7('0x18')],'include':_0x48ef5c[_0x1bc7('0x1a')]?_[_0x1bc7('0x1b')](_0x48ef5c[_0x1bc7('0x1a')],function(_0x21432c){return{'model':db[_0x21432c['model']],'as':_0x21432c['as'],'attributes':_0x21432c[_0x1bc7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1bc7('0x8')](function(_0x152353){logger[_0x1bc7('0x9')]('ShowSalesforceAccount',_0x326a0e);logger[_0x1bc7('0xb')](_0x1bc7('0x1e'),_0x326a0e,JSON[_0x1bc7('0xe')](_0x152353));_0x56b059(_0x152353);})['catch'](function(_0x43c7f4){logger[_0x1bc7('0xf')](_0x1bc7('0x1e'),_0x43c7f4[_0x1bc7('0x11')],_0x326a0e);_0x460749(_0x14b2dd[_0x1bc7('0xf')](0x1f4,_0x43c7f4[_0x1bc7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 357b7b1..ac06502 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdb28,0x106));var _0x8db2=function(_0x31a5ac,_0x2223a8){_0x31a5ac=_0x31a5ac-0x0;var _0x5eb150=_0xdb28[_0x31a5ac];return _0x5eb150;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5d15af,_0x33a716){var _0x306530=function(_0x25eb58){while(--_0x25eb58){_0x5d15af['push'](_0x5d15af['shift']());}};_0x306530(++_0x33a716);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2a0dd2f..5c1e1cd 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 _0xee04=['Case','contact','account_contact_lead','nothing','account','lead','sequelize','exports','STRING','ENUM','Task'];(function(_0x1977e5,_0x33fd2e){var _0x2e1bdb=function(_0x49be99){while(--_0x49be99){_0x1977e5['push'](_0x1977e5['shift']());}};_0x2e1bdb(++_0x33fd2e);}(_0xee04,0x124));var _0x4ee0=function(_0x1a9870,_0x180c75){_0x1a9870=_0x1a9870-0x0;var _0x44deb2=_0xee04[_0x1a9870];return _0x44deb2;};'use strict';var Sequelize=require(_0x4ee0('0x0'));module[_0x4ee0('0x1')]={'name':{'type':Sequelize[_0x4ee0('0x2')]},'description':{'type':Sequelize[_0x4ee0('0x2')]},'ticketType':{'type':Sequelize[_0x4ee0('0x3')](_0x4ee0('0x4'),_0x4ee0('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x4ee0('0x6'),'lead',_0x4ee0('0x7'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x4ee0('0x3')](_0x4ee0('0x8'),'contact','lead',_0x4ee0('0x9')),'defaultValue':_0x4ee0('0xa')},'leadId':{'type':Sequelize[_0x4ee0('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x4ee0('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe7c3=['contact','lead','account_contact_lead','nothing','sequelize','exports','STRING','Task','ENUM','contact_lead'];(function(_0x243c62,_0xcb3177){var _0x1b618b=function(_0x527879){while(--_0x527879){_0x243c62['push'](_0x243c62['shift']());}};_0x1b618b(++_0xcb3177);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x5acc9d,_0x1ff605){_0x5acc9d=_0x5acc9d-0x0;var _0x7490a=_0xe7c3[_0x5acc9d];return _0x7490a;};'use strict';var Sequelize=require(_0x3e7c('0x0'));module[_0x3e7c('0x1')]={'name':{'type':Sequelize[_0x3e7c('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x3e7c('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x3e7c('0x4')](_0x3e7c('0x5'),_0x3e7c('0x6'),_0x3e7c('0x7'),_0x3e7c('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x3e7c('0x9'),_0x3e7c('0x6'),_0x3e7c('0x7'),'account'),'defaultValue':_0x3e7c('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x3e7c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 99108d7..28e76db 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 _0x407c=['where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','model','fields','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','SalesforceConfiguration','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x407c,0x68));var _0xc407=function(_0x33d73d,_0x33a4ab){_0x33d73d=_0x33d73d-0x0;var _0x1d8fd0=_0x407c[_0x33d73d];return _0x1d8fd0;};'use strict';var emlformat=require(_0xc407('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc407('0x1'));var jsonpatch=require(_0xc407('0x2'));var rp=require(_0xc407('0x3'));var moment=require(_0xc407('0x4'));var BPromise=require(_0xc407('0x5'));var Mustache=require(_0xc407('0x6'));var util=require('util');var path=require(_0xc407('0x7'));var sox=require(_0xc407('0x8'));var csv=require(_0xc407('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc407('0xa'));var _=require('lodash');var squel=require(_0xc407('0xb'));var crypto=require(_0xc407('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc407('0xd'));var toCsv=require(_0xc407('0x9'));var querystring=require(_0xc407('0xe'));var Papa=require(_0xc407('0xf'));var Redis=require(_0xc407('0x10'));var authService=require(_0xc407('0x11'));var qs=require(_0xc407('0x12'));var as=require(_0xc407('0x13'));var hardwareService=require(_0xc407('0x14'));var logger=require(_0xc407('0x15'))('api');var utils=require(_0xc407('0x16'));var config=require(_0xc407('0x17'));var licenseUtil=require(_0xc407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c516b,_0x3db14c){_0x3db14c=_0x3db14c||0xcc;return function(_0x4e8926){if(_0x4e8926){return _0x2c516b['sendStatus'](_0x3db14c);}return _0x2c516b['status'](_0x3db14c)[_0xc407('0x19')]();};}function respondWithResult(_0x4fac7c,_0x344268){_0x344268=_0x344268||0xc8;return function(_0x4ea752){if(_0x4ea752){return _0x4fac7c[_0xc407('0x1a')](_0x344268)['json'](_0x4ea752);}};}function respondWithFilteredResult(_0x22ba88,_0x22e8da){return function(_0x20255f){if(_0x20255f){var _0x47520b=typeof _0x22e8da[_0xc407('0x1b')]===_0xc407('0x1c')&&typeof _0x22e8da['limit']===_0xc407('0x1c');var _0x5c10f0=_0x20255f[_0xc407('0x1d')];var _0x1bc597=_0x47520b?0x0:_0x22e8da[_0xc407('0x1b')];var _0x4141a6=_0x47520b?_0x20255f[_0xc407('0x1d')]:_0x22e8da['offset']+_0x22e8da['limit'];var _0x2b8249;if(_0x4141a6>=_0x5c10f0){_0x4141a6=_0x5c10f0;_0x2b8249=0xc8;}else{_0x2b8249=0xce;}_0x22ba88[_0xc407('0x1a')](_0x2b8249);return _0x22ba88[_0xc407('0x1e')]('Content-Range',_0x1bc597+'-'+_0x4141a6+'/'+_0x5c10f0)[_0xc407('0x1f')](_0x20255f);}return null;};}function patchUpdates(_0x56fd5){return function(_0x449442){try{jsonpatch[_0xc407('0x20')](_0x449442,_0x56fd5,!![]);}catch(_0x47dfc1){return BPromise[_0xc407('0x21')](_0x47dfc1);}return _0x449442[_0xc407('0x22')]();};}function saveUpdates(_0x548c27,_0x193845){return function(_0x19a7f8){if(_0x19a7f8){return _0x19a7f8[_0xc407('0x23')](_0x548c27)[_0xc407('0x24')](function(_0x41e9d1){return _0x41e9d1;});}return null;};}function removeEntity(_0x2f2bf3,_0x50b3ad){return function(_0x1301dd){if(_0x1301dd){return _0x1301dd[_0xc407('0x25')]()['then'](function(){_0x2f2bf3[_0xc407('0x1a')](0xcc)[_0xc407('0x19')]();});}};}function handleEntityNotFound(_0x536a8d,_0xb9e512){return function(_0x1b5cc3){if(!_0x1b5cc3){_0x536a8d[_0xc407('0x26')](0x194);}return _0x1b5cc3;};}function handleError(_0x48a202,_0x540371){_0x540371=_0x540371||0x1f4;return function(_0xc9db9c){logger[_0xc407('0x27')](_0xc9db9c[_0xc407('0x28')]);if(_0xc9db9c['name']){delete _0xc9db9c['name'];}_0x48a202[_0xc407('0x1a')](_0x540371)[_0xc407('0x29')](_0xc9db9c);};}exports['index']=function(_0x24ee78,_0x20f634){var _0x4d9fc9={},_0x704a13={},_0x54ab76={'count':0x0,'rows':[]};var _0x26644b=_['map'](db[_0xc407('0x2a')][_0xc407('0x2b')],function(_0x168d52){return{'name':_0x168d52[_0xc407('0x2c')],'type':_0x168d52[_0xc407('0x2d')][_0xc407('0x2e')]};});_0x704a13['model']=_[_0xc407('0x2f')](_0x26644b,_0xc407('0x30'));_0x704a13[_0xc407('0x31')]=_[_0xc407('0x32')](_0x24ee78[_0xc407('0x31')]);_0x704a13[_0xc407('0x33')]=_[_0xc407('0x34')](_0x704a13['model'],_0x704a13['query']);_0x4d9fc9[_0xc407('0x35')]=_[_0xc407('0x34')](_0x704a13['model'],qs['fields'](_0x24ee78[_0xc407('0x31')]['fields']));_0x4d9fc9[_0xc407('0x35')]=_0x4d9fc9['attributes'][_0xc407('0x36')]?_0x4d9fc9[_0xc407('0x35')]:_0x704a13['model'];if(!_0x24ee78[_0xc407('0x31')][_0xc407('0x37')](_0xc407('0x38'))){_0x4d9fc9[_0xc407('0x39')]=qs['limit'](_0x24ee78[_0xc407('0x31')][_0xc407('0x39')]);_0x4d9fc9[_0xc407('0x1b')]=qs[_0xc407('0x1b')](_0x24ee78[_0xc407('0x31')][_0xc407('0x1b')]);}_0x4d9fc9[_0xc407('0x3a')]=qs[_0xc407('0x3b')](_0x24ee78['query'][_0xc407('0x3b')]);_0x4d9fc9[_0xc407('0x3c')]=qs['filters'](_[_0xc407('0x3d')](_0x24ee78['query'],_0x704a13['filters']),_0x26644b);if(_0x24ee78[_0xc407('0x31')]['filter']){_0x4d9fc9[_0xc407('0x3c')]=_[_0xc407('0x3e')](_0x4d9fc9['where'],{'$or':_[_0xc407('0x2f')](_0x26644b,function(_0x1ebbc1){if(_0x1ebbc1['type']!==_0xc407('0x3f')){var _0x244d55={};_0x244d55[_0x1ebbc1['name']]={'$like':'%'+_0x24ee78[_0xc407('0x31')][_0xc407('0x40')]+'%'};return _0x244d55;}})});}_0x4d9fc9=_[_0xc407('0x3e')]({},_0x4d9fc9,_0x24ee78[_0xc407('0x41')]);var _0x25de44={'where':_0x4d9fc9[_0xc407('0x3c')]};return db[_0xc407('0x2a')][_0xc407('0x1d')](_0x25de44)[_0xc407('0x24')](function(_0x4aa7cb){_0x54ab76[_0xc407('0x1d')]=_0x4aa7cb;if(_0x24ee78[_0xc407('0x31')][_0xc407('0x42')]){_0x4d9fc9[_0xc407('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc407('0x44')](_0x4d9fc9);})[_0xc407('0x24')](function(_0x36ea3c){_0x54ab76[_0xc407('0x45')]=_0x36ea3c;return _0x54ab76;})[_0xc407('0x24')](respondWithFilteredResult(_0x20f634,_0x4d9fc9))[_0xc407('0x46')](handleError(_0x20f634,null));};exports['show']=function(_0x54ebc6,_0x63c358){var _0x154e78={'raw':![],'where':{'id':_0x54ebc6[_0xc407('0x47')]['id']}},_0xb7830a={};_0xb7830a[_0xc407('0x48')]=_['keys'](db[_0xc407('0x2a')][_0xc407('0x2b')]);_0xb7830a[_0xc407('0x31')]=_[_0xc407('0x32')](_0x54ebc6['query']);_0xb7830a[_0xc407('0x33')]=_[_0xc407('0x34')](_0xb7830a[_0xc407('0x48')],_0xb7830a[_0xc407('0x31')]);_0x154e78[_0xc407('0x35')]=_['intersection'](_0xb7830a[_0xc407('0x48')],qs[_0xc407('0x49')](_0x54ebc6[_0xc407('0x31')]['fields']));_0x154e78[_0xc407('0x35')]=_0x154e78[_0xc407('0x35')][_0xc407('0x36')]?_0x154e78[_0xc407('0x35')]:_0xb7830a[_0xc407('0x48')];if(_0x54ebc6[_0xc407('0x31')][_0xc407('0x42')]){_0x154e78[_0xc407('0x43')]=[{'all':!![]}];}_0x154e78=_[_0xc407('0x3e')]({},_0x154e78,_0x54ebc6['options']);return db[_0xc407('0x2a')][_0xc407('0x4a')](_0x154e78)[_0xc407('0x24')](handleEntityNotFound(_0x63c358,null))[_0xc407('0x24')](respondWithResult(_0x63c358,null))[_0xc407('0x46')](handleError(_0x63c358,null));};exports[_0xc407('0x4b')]=function(_0x150163,_0xca5149){return db[_0xc407('0x2a')][_0xc407('0x4b')](_0x150163[_0xc407('0x4c')],{})[_0xc407('0x24')](respondWithResult(_0xca5149,0xc9))['catch'](handleError(_0xca5149,null));};exports[_0xc407('0x23')]=function(_0xcbe2b1,_0x38425e){if(_0xcbe2b1['body']['id']){delete _0xcbe2b1['body']['id'];}return db[_0xc407('0x2a')][_0xc407('0x4a')]({'where':{'id':_0xcbe2b1['params']['id']}})['then'](handleEntityNotFound(_0x38425e,null))[_0xc407('0x24')](saveUpdates(_0xcbe2b1[_0xc407('0x4c')],null))[_0xc407('0x24')](respondWithResult(_0x38425e,null))[_0xc407('0x46')](handleError(_0x38425e,null));};exports[_0xc407('0x25')]=function(_0x999225,_0x5aae95){return db['SalesforceConfiguration'][_0xc407('0x4a')]({'where':{'id':_0x999225[_0xc407('0x47')]['id']}})[_0xc407('0x24')](handleEntityNotFound(_0x5aae95,null))['then'](removeEntity(_0x5aae95,null))[_0xc407('0x46')](handleError(_0x5aae95,null));};exports[_0xc407('0x4d')]=function(_0x3ac10a,_0x3fb8fa,_0x623f4b){var _0x20ba2c={};var _0x46a830={};var _0x1f2915;var _0x2aab45;return db[_0xc407('0x2a')][_0xc407('0x4e')]({'where':{'id':_0x3ac10a[_0xc407('0x47')]['id']}})[_0xc407('0x24')](handleEntityNotFound(_0x3fb8fa,null))[_0xc407('0x24')](function(_0x48d2c2){if(_0x48d2c2){_0x1f2915=_0x48d2c2;_0x46a830[_0xc407('0x48')]=_[_0xc407('0x32')](db[_0xc407('0x4f')][_0xc407('0x2b')]);_0x46a830[_0xc407('0x31')]=_['keys'](_0x3ac10a[_0xc407('0x31')]);_0x46a830['filters']=_['intersection'](_0x46a830[_0xc407('0x48')],_0x46a830[_0xc407('0x31')]);_0x20ba2c[_0xc407('0x35')]=_[_0xc407('0x34')](_0x46a830['model'],qs[_0xc407('0x49')](_0x3ac10a[_0xc407('0x31')][_0xc407('0x49')]));_0x20ba2c[_0xc407('0x35')]=_0x20ba2c[_0xc407('0x35')][_0xc407('0x36')]?_0x20ba2c['attributes']:_0x46a830[_0xc407('0x48')];_0x20ba2c[_0xc407('0x3a')]=qs[_0xc407('0x3b')](_0x3ac10a[_0xc407('0x31')][_0xc407('0x3b')]);_0x20ba2c['where']=qs['filters'](_[_0xc407('0x3d')](_0x3ac10a[_0xc407('0x31')],_0x46a830['filters']));if(_0x3ac10a[_0xc407('0x31')][_0xc407('0x40')]){_0x20ba2c['where']=_[_0xc407('0x3e')](_0x20ba2c['where'],{'$or':_[_0xc407('0x2f')](_0x20ba2c[_0xc407('0x35')],function(_0x5a0e77){var _0x4b8dba={};_0x4b8dba[_0x5a0e77]={'$like':'%'+_0x3ac10a[_0xc407('0x31')]['filter']+'%'};return _0x4b8dba;})});}_0x20ba2c=_['merge']({},_0x20ba2c,_0x3ac10a[_0xc407('0x41')]);return _0x1f2915[_0xc407('0x4d')](_0x20ba2c);}})['then'](function(_0x29224d){if(_0x29224d){_0x2aab45=_0x29224d['length'];if(!_0x3ac10a[_0xc407('0x31')][_0xc407('0x37')](_0xc407('0x38'))){_0x20ba2c[_0xc407('0x39')]=qs[_0xc407('0x39')](_0x3ac10a['query']['limit']);_0x20ba2c[_0xc407('0x1b')]=qs['offset'](_0x3ac10a['query'][_0xc407('0x1b')]);}return _0x1f2915[_0xc407('0x4d')](_0x20ba2c);}})[_0xc407('0x24')](function(_0x329e65){if(_0x329e65){return _0x329e65?{'count':_0x2aab45,'rows':_0x329e65}:null;}})[_0xc407('0x24')](respondWithResult(_0x3fb8fa,null))['catch'](handleError(_0x3fb8fa,null));};exports[_0xc407('0x50')]=function(_0x78d3e8,_0x27d84d,_0x1f1e8b){var _0x22057f={};var _0x1b59ac={};var _0x2e181d;var _0x5dd75a;return db[_0xc407('0x2a')][_0xc407('0x4e')]({'where':{'id':_0x78d3e8[_0xc407('0x47')]['id']}})[_0xc407('0x24')](handleEntityNotFound(_0x27d84d,null))[_0xc407('0x24')](function(_0x4f4a2a){if(_0x4f4a2a){_0x2e181d=_0x4f4a2a;_0x1b59ac[_0xc407('0x48')]=_['keys'](db[_0xc407('0x4f')][_0xc407('0x2b')]);_0x1b59ac[_0xc407('0x31')]=_[_0xc407('0x32')](_0x78d3e8['query']);_0x1b59ac[_0xc407('0x33')]=_[_0xc407('0x34')](_0x1b59ac['model'],_0x1b59ac[_0xc407('0x31')]);_0x22057f[_0xc407('0x35')]=_['intersection'](_0x1b59ac['model'],qs[_0xc407('0x49')](_0x78d3e8[_0xc407('0x31')][_0xc407('0x49')]));_0x22057f[_0xc407('0x35')]=_0x22057f[_0xc407('0x35')]['length']?_0x22057f[_0xc407('0x35')]:_0x1b59ac[_0xc407('0x48')];_0x22057f[_0xc407('0x3a')]=qs[_0xc407('0x3b')](_0x78d3e8['query'][_0xc407('0x3b')]);_0x22057f['where']=qs['filters'](_['pick'](_0x78d3e8[_0xc407('0x31')],_0x1b59ac[_0xc407('0x33')]));if(_0x78d3e8[_0xc407('0x31')][_0xc407('0x40')]){_0x22057f['where']=_[_0xc407('0x3e')](_0x22057f['where'],{'$or':_[_0xc407('0x2f')](_0x22057f[_0xc407('0x35')],function(_0x19971e){var _0x5e499b={};_0x5e499b[_0x19971e]={'$like':'%'+_0x78d3e8[_0xc407('0x31')][_0xc407('0x40')]+'%'};return _0x5e499b;})});}_0x22057f=_[_0xc407('0x3e')]({},_0x22057f,_0x78d3e8[_0xc407('0x41')]);return _0x2e181d[_0xc407('0x50')](_0x22057f);}})[_0xc407('0x24')](function(_0xb7a5f4){if(_0xb7a5f4){_0x5dd75a=_0xb7a5f4[_0xc407('0x36')];if(!_0x78d3e8[_0xc407('0x31')][_0xc407('0x37')]('nolimit')){_0x22057f[_0xc407('0x39')]=qs[_0xc407('0x39')](_0x78d3e8[_0xc407('0x31')]['limit']);_0x22057f[_0xc407('0x1b')]=qs['offset'](_0x78d3e8[_0xc407('0x31')]['offset']);}return _0x2e181d[_0xc407('0x50')](_0x22057f);}})['then'](function(_0x5278be){if(_0x5278be){return _0x5278be?{'count':_0x5dd75a,'rows':_0x5278be}:null;}})[_0xc407('0x24')](respondWithResult(_0x27d84d,null))[_0xc407('0x46')](handleError(_0x27d84d,null));};exports[_0xc407('0x51')]=function(_0x2e8cd6,_0x494d9a,_0x1d84b0){var _0x3202a0={};var _0x421e37={};var _0x339181;var _0x235269;return db['SalesforceConfiguration'][_0xc407('0x4e')]({'where':{'id':_0x2e8cd6[_0xc407('0x47')]['id']}})['then'](handleEntityNotFound(_0x494d9a,null))[_0xc407('0x24')](function(_0x5b8313){if(_0x5b8313){_0x339181=_0x5b8313;_0x421e37[_0xc407('0x48')]=_['keys'](db[_0xc407('0x4f')][_0xc407('0x2b')]);_0x421e37[_0xc407('0x31')]=_[_0xc407('0x32')](_0x2e8cd6[_0xc407('0x31')]);_0x421e37[_0xc407('0x33')]=_['intersection'](_0x421e37[_0xc407('0x48')],_0x421e37[_0xc407('0x31')]);_0x3202a0[_0xc407('0x35')]=_[_0xc407('0x34')](_0x421e37[_0xc407('0x48')],qs[_0xc407('0x49')](_0x2e8cd6['query']['fields']));_0x3202a0[_0xc407('0x35')]=_0x3202a0['attributes'][_0xc407('0x36')]?_0x3202a0[_0xc407('0x35')]:_0x421e37[_0xc407('0x48')];_0x3202a0[_0xc407('0x3a')]=qs['sort'](_0x2e8cd6['query']['sort']);_0x3202a0[_0xc407('0x3c')]=qs[_0xc407('0x33')](_[_0xc407('0x3d')](_0x2e8cd6[_0xc407('0x31')],_0x421e37[_0xc407('0x33')]));if(_0x2e8cd6[_0xc407('0x31')][_0xc407('0x40')]){_0x3202a0[_0xc407('0x3c')]=_[_0xc407('0x3e')](_0x3202a0[_0xc407('0x3c')],{'$or':_['map'](_0x3202a0[_0xc407('0x35')],function(_0x4abf4f){var _0x4af59d={};_0x4af59d[_0x4abf4f]={'$like':'%'+_0x2e8cd6[_0xc407('0x31')][_0xc407('0x40')]+'%'};return _0x4af59d;})});}_0x3202a0=_[_0xc407('0x3e')]({},_0x3202a0,_0x2e8cd6[_0xc407('0x41')]);return _0x339181['getDescriptions'](_0x3202a0);}})[_0xc407('0x24')](function(_0x2e81fe){if(_0x2e81fe){_0x235269=_0x2e81fe[_0xc407('0x36')];if(!_0x2e8cd6['query'][_0xc407('0x37')](_0xc407('0x38'))){_0x3202a0[_0xc407('0x39')]=qs['limit'](_0x2e8cd6[_0xc407('0x31')][_0xc407('0x39')]);_0x3202a0[_0xc407('0x1b')]=qs[_0xc407('0x1b')](_0x2e8cd6[_0xc407('0x31')][_0xc407('0x1b')]);}return _0x339181[_0xc407('0x51')](_0x3202a0);}})['then'](function(_0x28b2bb){if(_0x28b2bb){return _0x28b2bb?{'count':_0x235269,'rows':_0x28b2bb}:null;}})[_0xc407('0x24')](respondWithResult(_0x494d9a,null))['catch'](handleError(_0x494d9a,null));}; \ No newline at end of file +var _0x97cd=['set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','SalesforceConfiguration','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','create','body','update','find','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','undefined'];(function(_0x3c0666,_0xa7e902){var _0x17801e=function(_0x277552){while(--_0x277552){_0x3c0666['push'](_0x3c0666['shift']());}};_0x17801e(++_0xa7e902);}(_0x97cd,0x1e9));var _0xd97c=function(_0x5a44b5,_0x802d9b){_0x5a44b5=_0x5a44b5-0x0;var _0x4c6f1b=_0x97cd[_0x5a44b5];return _0x4c6f1b;};'use strict';var emlformat=require(_0xd97c('0x0'));var rimraf=require(_0xd97c('0x1'));var zipdir=require(_0xd97c('0x2'));var jsonpatch=require(_0xd97c('0x3'));var rp=require(_0xd97c('0x4'));var moment=require(_0xd97c('0x5'));var BPromise=require(_0xd97c('0x6'));var Mustache=require(_0xd97c('0x7'));var util=require(_0xd97c('0x8'));var path=require(_0xd97c('0x9'));var sox=require(_0xd97c('0xa'));var csv=require(_0xd97c('0xb'));var ejs=require(_0xd97c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd97c('0xd'));var squel=require(_0xd97c('0xe'));var crypto=require(_0xd97c('0xf'));var jsforce=require(_0xd97c('0x10'));var deskjs=require(_0xd97c('0x11'));var toCsv=require(_0xd97c('0xb'));var querystring=require(_0xd97c('0x12'));var Papa=require(_0xd97c('0x13'));var Redis=require(_0xd97c('0x14'));var authService=require(_0xd97c('0x15'));var qs=require(_0xd97c('0x16'));var as=require(_0xd97c('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd97c('0x18'))('api');var utils=require(_0xd97c('0x19'));var config=require(_0xd97c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd97c('0x1b'))['db'];function respondWithStatusCode(_0x4bd0a8,_0x302084){_0x302084=_0x302084||0xcc;return function(_0x5e67e4){if(_0x5e67e4){return _0x4bd0a8['sendStatus'](_0x302084);}return _0x4bd0a8['status'](_0x302084)[_0xd97c('0x1c')]();};}function respondWithResult(_0xbb298a,_0x53a562){_0x53a562=_0x53a562||0xc8;return function(_0x488748){if(_0x488748){return _0xbb298a[_0xd97c('0x1d')](_0x53a562)['json'](_0x488748);}};}function respondWithFilteredResult(_0x9caaeb,_0x4b2d3c){return function(_0x4d1b6c){if(_0x4d1b6c){var _0x7337bb=typeof _0x4b2d3c[_0xd97c('0x1e')]==='undefined'&&typeof _0x4b2d3c[_0xd97c('0x1f')]===_0xd97c('0x20');var _0x18ee0b=_0x4d1b6c['count'];var _0x5cb2b5=_0x7337bb?0x0:_0x4b2d3c[_0xd97c('0x1e')];var _0x373988=_0x7337bb?_0x4d1b6c['count']:_0x4b2d3c[_0xd97c('0x1e')]+_0x4b2d3c[_0xd97c('0x1f')];var _0xa1f6b6;if(_0x373988>=_0x18ee0b){_0x373988=_0x18ee0b;_0xa1f6b6=0xc8;}else{_0xa1f6b6=0xce;}_0x9caaeb[_0xd97c('0x1d')](_0xa1f6b6);return _0x9caaeb[_0xd97c('0x21')](_0xd97c('0x22'),_0x5cb2b5+'-'+_0x373988+'/'+_0x18ee0b)[_0xd97c('0x23')](_0x4d1b6c);}return null;};}function patchUpdates(_0x356bbf){return function(_0x283dda){try{jsonpatch[_0xd97c('0x24')](_0x283dda,_0x356bbf,!![]);}catch(_0x3d97fb){return BPromise[_0xd97c('0x25')](_0x3d97fb);}return _0x283dda[_0xd97c('0x26')]();};}function saveUpdates(_0x27bbed,_0x46a154){return function(_0x2b2995){if(_0x2b2995){return _0x2b2995['update'](_0x27bbed)[_0xd97c('0x27')](function(_0x516972){return _0x516972;});}return null;};}function removeEntity(_0x3e2086,_0x5c49a6){return function(_0x4ac329){if(_0x4ac329){return _0x4ac329[_0xd97c('0x28')]()['then'](function(){_0x3e2086['status'](0xcc)[_0xd97c('0x1c')]();});}};}function handleEntityNotFound(_0xab35d,_0x5234af){return function(_0x33d24c){if(!_0x33d24c){_0xab35d[_0xd97c('0x29')](0x194);}return _0x33d24c;};}function handleError(_0x30a282,_0x2df606){_0x2df606=_0x2df606||0x1f4;return function(_0x2f335a){logger[_0xd97c('0x2a')](_0x2f335a[_0xd97c('0x2b')]);if(_0x2f335a['name']){delete _0x2f335a['name'];}_0x30a282[_0xd97c('0x1d')](_0x2df606)[_0xd97c('0x2c')](_0x2f335a);};}exports[_0xd97c('0x2d')]=function(_0x49cff7,_0x302b8b){var _0x121e49={},_0x3968dd={},_0x96a2d0={'count':0x0,'rows':[]};var _0x4056ec=_[_0xd97c('0x2e')](db[_0xd97c('0x2f')]['rawAttributes'],function(_0x1344b6){return{'name':_0x1344b6[_0xd97c('0x30')],'type':_0x1344b6[_0xd97c('0x31')][_0xd97c('0x32')]};});_0x3968dd[_0xd97c('0x33')]=_['map'](_0x4056ec,_0xd97c('0x34'));_0x3968dd[_0xd97c('0x35')]=_['keys'](_0x49cff7['query']);_0x3968dd['filters']=_[_0xd97c('0x36')](_0x3968dd[_0xd97c('0x33')],_0x3968dd[_0xd97c('0x35')]);_0x121e49[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x3968dd['model'],qs[_0xd97c('0x38')](_0x49cff7['query'][_0xd97c('0x38')]));_0x121e49[_0xd97c('0x37')]=_0x121e49['attributes'][_0xd97c('0x39')]?_0x121e49[_0xd97c('0x37')]:_0x3968dd['model'];if(!_0x49cff7[_0xd97c('0x35')][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x121e49[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x49cff7['query'][_0xd97c('0x1f')]);_0x121e49[_0xd97c('0x1e')]=qs['offset'](_0x49cff7[_0xd97c('0x35')][_0xd97c('0x1e')]);}_0x121e49[_0xd97c('0x3c')]=qs[_0xd97c('0x3d')](_0x49cff7[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x121e49[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x49cff7[_0xd97c('0x35')],_0x3968dd[_0xd97c('0x3f')]),_0x4056ec);if(_0x49cff7[_0xd97c('0x35')]['filter']){_0x121e49[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x121e49[_0xd97c('0x3e')],{'$or':_[_0xd97c('0x2e')](_0x4056ec,function(_0x30898f){if(_0x30898f['type']!==_0xd97c('0x42')){var _0x301b04={};_0x301b04[_0x30898f[_0xd97c('0x34')]]={'$like':'%'+_0x49cff7['query']['filter']+'%'};return _0x301b04;}})});}_0x121e49=_[_0xd97c('0x41')]({},_0x121e49,_0x49cff7[_0xd97c('0x43')]);var _0x253a0e={'where':_0x121e49[_0xd97c('0x3e')]};return db[_0xd97c('0x2f')][_0xd97c('0x44')](_0x253a0e)[_0xd97c('0x27')](function(_0x5874a3){_0x96a2d0[_0xd97c('0x44')]=_0x5874a3;if(_0x49cff7[_0xd97c('0x35')][_0xd97c('0x45')]){_0x121e49[_0xd97c('0x46')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd97c('0x47')](_0x121e49);})[_0xd97c('0x27')](function(_0x586aac){_0x96a2d0[_0xd97c('0x48')]=_0x586aac;return _0x96a2d0;})['then'](respondWithFilteredResult(_0x302b8b,_0x121e49))[_0xd97c('0x49')](handleError(_0x302b8b,null));};exports['show']=function(_0xff3cac,_0x46a8ce){var _0x4ef7c8={'raw':![],'where':{'id':_0xff3cac[_0xd97c('0x4a')]['id']}},_0x224272={};_0x224272[_0xd97c('0x33')]=_['keys'](db['SalesforceConfiguration'][_0xd97c('0x4b')]);_0x224272['query']=_[_0xd97c('0x4c')](_0xff3cac[_0xd97c('0x35')]);_0x224272['filters']=_[_0xd97c('0x36')](_0x224272[_0xd97c('0x33')],_0x224272['query']);_0x4ef7c8[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x224272[_0xd97c('0x33')],qs[_0xd97c('0x38')](_0xff3cac[_0xd97c('0x35')]['fields']));_0x4ef7c8[_0xd97c('0x37')]=_0x4ef7c8[_0xd97c('0x37')]['length']?_0x4ef7c8[_0xd97c('0x37')]:_0x224272[_0xd97c('0x33')];if(_0xff3cac[_0xd97c('0x35')]['includeAll']){_0x4ef7c8[_0xd97c('0x46')]=[{'all':!![]}];}_0x4ef7c8=_[_0xd97c('0x41')]({},_0x4ef7c8,_0xff3cac['options']);return db['SalesforceConfiguration']['find'](_0x4ef7c8)[_0xd97c('0x27')](handleEntityNotFound(_0x46a8ce,null))[_0xd97c('0x27')](respondWithResult(_0x46a8ce,null))[_0xd97c('0x49')](handleError(_0x46a8ce,null));};exports['create']=function(_0x3aca19,_0x576f95){return db[_0xd97c('0x2f')][_0xd97c('0x4d')](_0x3aca19[_0xd97c('0x4e')],{})[_0xd97c('0x27')](respondWithResult(_0x576f95,0xc9))[_0xd97c('0x49')](handleError(_0x576f95,null));};exports[_0xd97c('0x4f')]=function(_0x47673a,_0x3feb32){if(_0x47673a[_0xd97c('0x4e')]['id']){delete _0x47673a['body']['id'];}return db[_0xd97c('0x2f')]['find']({'where':{'id':_0x47673a[_0xd97c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3feb32,null))[_0xd97c('0x27')](saveUpdates(_0x47673a[_0xd97c('0x4e')],null))['then'](respondWithResult(_0x3feb32,null))['catch'](handleError(_0x3feb32,null));};exports['destroy']=function(_0x433f4a,_0x302f01){return db[_0xd97c('0x2f')][_0xd97c('0x50')]({'where':{'id':_0x433f4a[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x302f01,null))['then'](removeEntity(_0x302f01,null))[_0xd97c('0x49')](handleError(_0x302f01,null));};exports[_0xd97c('0x51')]=function(_0x246532,_0x239c0e,_0x17b1b4){var _0x11dbaa={};var _0x16a47e={};var _0x5f569e;var _0x41d55a;return db['SalesforceConfiguration'][_0xd97c('0x52')]({'where':{'id':_0x246532[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x239c0e,null))['then'](function(_0x3304e1){if(_0x3304e1){_0x5f569e=_0x3304e1;_0x16a47e[_0xd97c('0x33')]=_[_0xd97c('0x4c')](db[_0xd97c('0x53')][_0xd97c('0x4b')]);_0x16a47e['query']=_['keys'](_0x246532[_0xd97c('0x35')]);_0x16a47e['filters']=_[_0xd97c('0x36')](_0x16a47e[_0xd97c('0x33')],_0x16a47e[_0xd97c('0x35')]);_0x11dbaa[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x16a47e[_0xd97c('0x33')],qs['fields'](_0x246532['query'][_0xd97c('0x38')]));_0x11dbaa[_0xd97c('0x37')]=_0x11dbaa[_0xd97c('0x37')][_0xd97c('0x39')]?_0x11dbaa[_0xd97c('0x37')]:_0x16a47e['model'];_0x11dbaa['order']=qs['sort'](_0x246532[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x11dbaa[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x246532[_0xd97c('0x35')],_0x16a47e[_0xd97c('0x3f')]));if(_0x246532['query']['filter']){_0x11dbaa[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x11dbaa[_0xd97c('0x3e')],{'$or':_[_0xd97c('0x2e')](_0x11dbaa['attributes'],function(_0x3804fe){var _0x277163={};_0x277163[_0x3804fe]={'$like':'%'+_0x246532[_0xd97c('0x35')]['filter']+'%'};return _0x277163;})});}_0x11dbaa=_['merge']({},_0x11dbaa,_0x246532['options']);return _0x5f569e[_0xd97c('0x51')](_0x11dbaa);}})[_0xd97c('0x27')](function(_0x3b18d0){if(_0x3b18d0){_0x41d55a=_0x3b18d0[_0xd97c('0x39')];if(!_0x246532['query'][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x11dbaa[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x246532[_0xd97c('0x35')][_0xd97c('0x1f')]);_0x11dbaa['offset']=qs['offset'](_0x246532[_0xd97c('0x35')][_0xd97c('0x1e')]);}return _0x5f569e[_0xd97c('0x51')](_0x11dbaa);}})[_0xd97c('0x27')](function(_0x29f0fb){if(_0x29f0fb){return _0x29f0fb?{'count':_0x41d55a,'rows':_0x29f0fb}:null;}})[_0xd97c('0x27')](respondWithResult(_0x239c0e,null))[_0xd97c('0x49')](handleError(_0x239c0e,null));};exports['getSubjects']=function(_0x174202,_0x560462,_0x38e561){var _0x3a87e8={};var _0x15c5f3={};var _0x44ec05;var _0x132811;return db[_0xd97c('0x2f')][_0xd97c('0x52')]({'where':{'id':_0x174202['params']['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x560462,null))['then'](function(_0x369ee3){if(_0x369ee3){_0x44ec05=_0x369ee3;_0x15c5f3[_0xd97c('0x33')]=_[_0xd97c('0x4c')](db[_0xd97c('0x53')][_0xd97c('0x4b')]);_0x15c5f3[_0xd97c('0x35')]=_[_0xd97c('0x4c')](_0x174202[_0xd97c('0x35')]);_0x15c5f3[_0xd97c('0x3f')]=_[_0xd97c('0x36')](_0x15c5f3[_0xd97c('0x33')],_0x15c5f3[_0xd97c('0x35')]);_0x3a87e8[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x15c5f3['model'],qs[_0xd97c('0x38')](_0x174202['query'][_0xd97c('0x38')]));_0x3a87e8[_0xd97c('0x37')]=_0x3a87e8[_0xd97c('0x37')][_0xd97c('0x39')]?_0x3a87e8[_0xd97c('0x37')]:_0x15c5f3[_0xd97c('0x33')];_0x3a87e8[_0xd97c('0x3c')]=qs[_0xd97c('0x3d')](_0x174202[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x3a87e8[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x174202[_0xd97c('0x35')],_0x15c5f3[_0xd97c('0x3f')]));if(_0x174202[_0xd97c('0x35')][_0xd97c('0x54')]){_0x3a87e8['where']=_['merge'](_0x3a87e8['where'],{'$or':_[_0xd97c('0x2e')](_0x3a87e8[_0xd97c('0x37')],function(_0xb88c60){var _0x5ef255={};_0x5ef255[_0xb88c60]={'$like':'%'+_0x174202[_0xd97c('0x35')][_0xd97c('0x54')]+'%'};return _0x5ef255;})});}_0x3a87e8=_[_0xd97c('0x41')]({},_0x3a87e8,_0x174202[_0xd97c('0x43')]);return _0x44ec05[_0xd97c('0x55')](_0x3a87e8);}})[_0xd97c('0x27')](function(_0x3fcafb){if(_0x3fcafb){_0x132811=_0x3fcafb[_0xd97c('0x39')];if(!_0x174202['query']['hasOwnProperty'](_0xd97c('0x3b'))){_0x3a87e8[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x174202[_0xd97c('0x35')]['limit']);_0x3a87e8[_0xd97c('0x1e')]=qs[_0xd97c('0x1e')](_0x174202[_0xd97c('0x35')][_0xd97c('0x1e')]);}return _0x44ec05[_0xd97c('0x55')](_0x3a87e8);}})[_0xd97c('0x27')](function(_0x4c526a){if(_0x4c526a){return _0x4c526a?{'count':_0x132811,'rows':_0x4c526a}:null;}})[_0xd97c('0x27')](respondWithResult(_0x560462,null))[_0xd97c('0x49')](handleError(_0x560462,null));};exports[_0xd97c('0x56')]=function(_0x888c2b,_0x151951,_0x566593){var _0x20a401={};var _0x3fba45={};var _0x58f653;var _0x2e9588;return db[_0xd97c('0x2f')]['findOne']({'where':{'id':_0x888c2b[_0xd97c('0x4a')]['id']}})[_0xd97c('0x27')](handleEntityNotFound(_0x151951,null))[_0xd97c('0x27')](function(_0x27dc76){if(_0x27dc76){_0x58f653=_0x27dc76;_0x3fba45[_0xd97c('0x33')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x3fba45[_0xd97c('0x35')]=_[_0xd97c('0x4c')](_0x888c2b[_0xd97c('0x35')]);_0x3fba45[_0xd97c('0x3f')]=_[_0xd97c('0x36')](_0x3fba45[_0xd97c('0x33')],_0x3fba45[_0xd97c('0x35')]);_0x20a401[_0xd97c('0x37')]=_[_0xd97c('0x36')](_0x3fba45[_0xd97c('0x33')],qs[_0xd97c('0x38')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x38')]));_0x20a401['attributes']=_0x20a401['attributes'][_0xd97c('0x39')]?_0x20a401['attributes']:_0x3fba45[_0xd97c('0x33')];_0x20a401['order']=qs[_0xd97c('0x3d')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x3d')]);_0x20a401[_0xd97c('0x3e')]=qs[_0xd97c('0x3f')](_[_0xd97c('0x40')](_0x888c2b['query'],_0x3fba45[_0xd97c('0x3f')]));if(_0x888c2b[_0xd97c('0x35')][_0xd97c('0x54')]){_0x20a401[_0xd97c('0x3e')]=_[_0xd97c('0x41')](_0x20a401['where'],{'$or':_[_0xd97c('0x2e')](_0x20a401[_0xd97c('0x37')],function(_0x46e9e0){var _0x5a9baf={};_0x5a9baf[_0x46e9e0]={'$like':'%'+_0x888c2b[_0xd97c('0x35')][_0xd97c('0x54')]+'%'};return _0x5a9baf;})});}_0x20a401=_[_0xd97c('0x41')]({},_0x20a401,_0x888c2b[_0xd97c('0x43')]);return _0x58f653['getDescriptions'](_0x20a401);}})[_0xd97c('0x27')](function(_0x3bac97){if(_0x3bac97){_0x2e9588=_0x3bac97[_0xd97c('0x39')];if(!_0x888c2b['query'][_0xd97c('0x3a')](_0xd97c('0x3b'))){_0x20a401[_0xd97c('0x1f')]=qs[_0xd97c('0x1f')](_0x888c2b[_0xd97c('0x35')][_0xd97c('0x1f')]);_0x20a401[_0xd97c('0x1e')]=qs[_0xd97c('0x1e')](_0x888c2b['query']['offset']);}return _0x58f653[_0xd97c('0x56')](_0x20a401);}})[_0xd97c('0x27')](function(_0x3ab78c){if(_0x3ab78c){return _0x3ab78c?{'count':_0x2e9588,'rows':_0x3ab78c}:null;}})['then'](respondWithResult(_0x151951,null))[_0xd97c('0x49')](handleError(_0x151951,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f29c81d..2481562 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 _0x862f=['util','../../config/logger','moment','bluebird','request-promise','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x862f,0x90));var _0xf862=function(_0xf4e659,_0x28f520){_0xf4e659=_0xf4e659-0x0;var _0x237789=_0x862f[_0xf4e659];return _0x237789;};'use strict';var _=require('lodash');var util=require(_0xf862('0x0'));var logger=require(_0xf862('0x1'))('api');var moment=require(_0xf862('0x2'));var BPromise=require(_0xf862('0x3'));var rp=require(_0xf862('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf862('0x5'));module['exports']=function(_0x5975aa,_0x25629a){return _0x5975aa[_0xf862('0x6')]('SalesforceConfiguration',attributes,{'tableName':_0xf862('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a7=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4f5ba9,_0x1c5fc5){var _0xfb4878=function(_0x38b4d5){while(--_0x38b4d5){_0x4f5ba9['push'](_0x4f5ba9['shift']());}};_0xfb4878(++_0x1c5fc5);}(_0xc3a7,0x191));var _0x7c3a=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xc3a7[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x7c3a('0x0'));var util=require(_0x7c3a('0x1'));var logger=require(_0x7c3a('0x2'))(_0x7c3a('0x3'));var moment=require(_0x7c3a('0x4'));var BPromise=require('bluebird');var rp=require(_0x7c3a('0x5'));var fs=require('fs');var path=require(_0x7c3a('0x6'));var rimraf=require(_0x7c3a('0x7'));var config=require(_0x7c3a('0x8'));var attributes=require(_0x7c3a('0x9'));module[_0x7c3a('0xa')]=function(_0x126fb6,_0x47bee6){return _0x126fb6[_0x7c3a('0xb')](_0x7c3a('0xc'),attributes,{'tableName':_0x7c3a('0xd'),'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 a5fb777..c52c84a 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 _0xc844=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc844,0x13b));var _0x4c84=function(_0x350e8e,_0x1eae65){_0x350e8e=_0x350e8e-0x0;var _0x4f1f45=_0xc844[_0x350e8e];return _0x4f1f45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c84('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c84('0x1'));var db=require(_0x4c84('0x2'))['db'];var utils=require(_0x4c84('0x3'));var logger=require('../../config/logger')(_0x4c84('0x4'));var config=require(_0x4c84('0x5'));var jayson=require(_0x4c84('0x6'));var client=jayson[_0x4c84('0x7')][_0x4c84('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e62,_0x3392d5,_0x4738aa){return new BPromise(function(_0xe41eda,_0x146de9){return client[_0x4c84('0x9')](_0x2f2e62,_0x4738aa)[_0x4c84('0xa')](function(_0x5ee2b5){logger[_0x4c84('0xb')](_0x4c84('0xc'),_0x3392d5,_0x4c84('0xd'));logger[_0x4c84('0xe')](_0x4c84('0xf'),_0x3392d5,_0x4c84('0xd'),JSON['stringify'](_0x5ee2b5));if(_0x5ee2b5['error']){if(_0x5ee2b5[_0x4c84('0x10')][_0x4c84('0x11')]===0x1f4){logger[_0x4c84('0x10')](_0x4c84('0xc'),_0x3392d5,_0x5ee2b5['error'][_0x4c84('0x12')]);return _0x146de9(_0x5ee2b5[_0x4c84('0x10')][_0x4c84('0x12')]);}logger[_0x4c84('0x10')](_0x4c84('0xc'),_0x3392d5,_0x5ee2b5[_0x4c84('0x10')][_0x4c84('0x12')]);return _0xe41eda(_0x5ee2b5[_0x4c84('0x10')]['message']);}else{logger['info'](_0x4c84('0xc'),_0x3392d5,_0x4c84('0xd'));_0xe41eda(_0x5ee2b5[_0x4c84('0x13')][_0x4c84('0x12')]);}})[_0x4c84('0x14')](function(_0x275832){logger[_0x4c84('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3392d5,_0x275832);_0x146de9(_0x275832);});});} \ No newline at end of file +var _0xf435=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0xf435,0x14d));var _0x5f43=function(_0x5a0364,_0x2ed849){_0x5a0364=_0x5a0364-0x0;var _0x3d00e2=_0xf435[_0x5a0364];return _0x3d00e2;};'use strict';var _=require(_0x5f43('0x0'));var util=require(_0x5f43('0x1'));var moment=require(_0x5f43('0x2'));var BPromise=require(_0x5f43('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f43('0x4'));var db=require(_0x5f43('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f43('0x6'))(_0x5f43('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f43('0x8'));var client=jayson[_0x5f43('0x9')][_0x5f43('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263f9a,_0x110096,_0x2ab2e3){return new BPromise(function(_0x3b5224,_0x3c7a59){return client['request'](_0x263f9a,_0x2ab2e3)[_0x5f43('0xb')](function(_0x43d480){logger[_0x5f43('0xc')](_0x5f43('0xd'),_0x110096,_0x5f43('0xe'));logger['debug'](_0x5f43('0xf'),_0x110096,_0x5f43('0xe'),JSON['stringify'](_0x43d480));if(_0x43d480[_0x5f43('0x10')]){if(_0x43d480['error'][_0x5f43('0x11')]===0x1f4){logger[_0x5f43('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x110096,_0x43d480[_0x5f43('0x10')][_0x5f43('0x12')]);return _0x3c7a59(_0x43d480[_0x5f43('0x10')][_0x5f43('0x12')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x110096,_0x43d480['error'][_0x5f43('0x12')]);return _0x3b5224(_0x43d480['error']['message']);}else{logger['info'](_0x5f43('0xd'),_0x110096,_0x5f43('0xe'));_0x3b5224(_0x43d480[_0x5f43('0x13')][_0x5f43('0x12')]);}})[_0x5f43('0x14')](function(_0x33ed7e){logger[_0x5f43('0x10')](_0x5f43('0xd'),_0x110096,_0x33ed7e);_0x3c7a59(_0x33ed7e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3ba1ba5..793e6f4 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 _0x2939=['../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x2939,0x14e));var _0x9293=function(_0x574573,_0x4ded8a){_0x574573=_0x574573-0x0;var _0x4461e4=_0x2939[_0x574573];return _0x4461e4;};'use strict';var multer=require(_0x9293('0x0'));var util=require(_0x9293('0x1'));var path=require(_0x9293('0x2'));var timeout=require(_0x9293('0x3'));var express=require(_0x9293('0x4'));var router=express[_0x9293('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9293('0x6'));var interaction=require(_0x9293('0x7'));var config=require('../../config/environment');var controller=require(_0x9293('0x8'));router[_0x9293('0x9')]('/',auth['isAuthenticated'](),controller[_0x9293('0xa')]);router[_0x9293('0x9')](_0x9293('0xb'),auth[_0x9293('0xc')](),controller[_0x9293('0xd')]);router[_0x9293('0xe')]('/',auth[_0x9293('0xc')](),controller[_0x9293('0xf')]);router[_0x9293('0x10')](_0x9293('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9293('0x11')](_0x9293('0xb'),auth[_0x9293('0xc')](),controller[_0x9293('0x12')]);module[_0x9293('0x13')]=router; \ No newline at end of file +var _0x4a15=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x4a15,0x1be));var _0x54a1=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x4a15[_0x9b3efc];return _0x200f05;};'use strict';var multer=require(_0x54a1('0x0'));var util=require('util');var path=require(_0x54a1('0x1'));var timeout=require(_0x54a1('0x2'));var express=require(_0x54a1('0x3'));var router=express[_0x54a1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x54a1('0x5'));var interaction=require(_0x54a1('0x6'));var config=require(_0x54a1('0x7'));var controller=require(_0x54a1('0x8'));router[_0x54a1('0x9')]('/',auth[_0x54a1('0xa')](),controller['index']);router[_0x54a1('0x9')](_0x54a1('0xb'),auth[_0x54a1('0xa')](),controller[_0x54a1('0xc')]);router[_0x54a1('0xd')]('/',auth[_0x54a1('0xa')](),controller[_0x54a1('0xe')]);router[_0x54a1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x54a1('0x10')]);router[_0x54a1('0x11')]('/:id',auth[_0x54a1('0xa')](),controller[_0x54a1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 532c8ad..5d72355 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 _0x724c=['string','STRING','variable','exports','ENUM','keyValue','picklist'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x724c,0x1c3));var _0xc724=function(_0x1baa90,_0x39fe37){_0x1baa90=_0x1baa90-0x0;var _0x20e9a6=_0x724c[_0x1baa90];return _0x20e9a6;};'use strict';var Sequelize=require('sequelize');module[_0xc724('0x0')]={'type':{'type':Sequelize[_0xc724('0x1')]('string','variable','customVariable',_0xc724('0x2'),_0xc724('0x3')),'defaultValue':_0xc724('0x4')},'content':{'type':Sequelize[_0xc724('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc724('0x1')]('string',_0xc724('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xc724('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xc724('0x5')]}}; \ No newline at end of file +var _0x6433=['ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x40ff92,_0x3ed1da){var _0x4eceb2=function(_0x1cf2f5){while(--_0x1cf2f5){_0x40ff92['push'](_0x40ff92['shift']());}};_0x4eceb2(++_0x3ed1da);}(_0x6433,0xd9));var _0x3643=function(_0x55b411,_0xdbfa64){_0x55b411=_0x55b411-0x0;var _0x2bf5a9=_0x6433[_0x55b411];return _0x2bf5a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x3643('0x0')](_0x3643('0x1'),_0x3643('0x2'),_0x3643('0x3'),_0x3643('0x4'),_0x3643('0x5')),'defaultValue':_0x3643('0x1')},'content':{'type':Sequelize[_0x3643('0x6')]},'key':{'type':Sequelize[_0x3643('0x6')]},'keyType':{'type':Sequelize[_0x3643('0x0')](_0x3643('0x1'),_0x3643('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3643('0x6')]},'idField':{'type':Sequelize[_0x3643('0x6')]},'variableName':{'type':Sequelize[_0x3643('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index decb339..7d60efb 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 _0x126f=['offset','limit','set','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','SalesforceField','rows','params','includeAll','include','merge','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0x17f8b7,_0x2fd88d){var _0xb97796=function(_0x147b79){while(--_0x147b79){_0x17f8b7['push'](_0x17f8b7['shift']());}};_0xb97796(++_0x2fd88d);}(_0x126f,0x75));var _0xf126=function(_0x51f632,_0x5a14d5){_0x51f632=_0x51f632-0x0;var _0x24cf36=_0x126f[_0x51f632];return _0x24cf36;};'use strict';var emlformat=require(_0xf126('0x0'));var rimraf=require(_0xf126('0x1'));var zipdir=require(_0xf126('0x2'));var jsonpatch=require(_0xf126('0x3'));var rp=require(_0xf126('0x4'));var moment=require(_0xf126('0x5'));var BPromise=require(_0xf126('0x6'));var Mustache=require(_0xf126('0x7'));var util=require(_0xf126('0x8'));var path=require(_0xf126('0x9'));var sox=require(_0xf126('0xa'));var csv=require(_0xf126('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf126('0xc'));var _=require('lodash');var squel=require(_0xf126('0xd'));var crypto=require(_0xf126('0xe'));var jsforce=require(_0xf126('0xf'));var deskjs=require(_0xf126('0x10'));var toCsv=require(_0xf126('0xb'));var querystring=require('querystring');var Papa=require(_0xf126('0x11'));var Redis=require(_0xf126('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf126('0x13'));var hardwareService=require(_0xf126('0x14'));var logger=require(_0xf126('0x15'))(_0xf126('0x16'));var utils=require('../../config/utils');var config=require(_0xf126('0x17'));var licenseUtil=require(_0xf126('0x18'));var db=require(_0xf126('0x19'))['db'];function respondWithStatusCode(_0x21a6b9,_0x3b55cc){_0x3b55cc=_0x3b55cc||0xcc;return function(_0x30e6f2){if(_0x30e6f2){return _0x21a6b9[_0xf126('0x1a')](_0x3b55cc);}return _0x21a6b9[_0xf126('0x1b')](_0x3b55cc)[_0xf126('0x1c')]();};}function respondWithResult(_0xe63772,_0x2f5fcf){_0x2f5fcf=_0x2f5fcf||0xc8;return function(_0xf02020){if(_0xf02020){return _0xe63772[_0xf126('0x1b')](_0x2f5fcf)['json'](_0xf02020);}};}function respondWithFilteredResult(_0xdb780,_0x15df50){return function(_0x2021f9){if(_0x2021f9){var _0x1fbaf4=typeof _0x15df50['offset']===_0xf126('0x1d')&&typeof _0x15df50['limit']===_0xf126('0x1d');var _0x99568b=_0x2021f9[_0xf126('0x1e')];var _0x3ee184=_0x1fbaf4?0x0:_0x15df50[_0xf126('0x1f')];var _0x23a1ce=_0x1fbaf4?_0x2021f9[_0xf126('0x1e')]:_0x15df50['offset']+_0x15df50[_0xf126('0x20')];var _0x176a5d;if(_0x23a1ce>=_0x99568b){_0x23a1ce=_0x99568b;_0x176a5d=0xc8;}else{_0x176a5d=0xce;}_0xdb780[_0xf126('0x1b')](_0x176a5d);return _0xdb780[_0xf126('0x21')]('Content-Range',_0x3ee184+'-'+_0x23a1ce+'/'+_0x99568b)[_0xf126('0x22')](_0x2021f9);}return null;};}function patchUpdates(_0x1575c2){return function(_0x388487){try{jsonpatch[_0xf126('0x23')](_0x388487,_0x1575c2,!![]);}catch(_0x1ddb45){return BPromise[_0xf126('0x24')](_0x1ddb45);}return _0x388487[_0xf126('0x25')]();};}function saveUpdates(_0x790a5a,_0x5d1554){return function(_0x2b3300){if(_0x2b3300){return _0x2b3300[_0xf126('0x26')](_0x790a5a)['then'](function(_0x5151e1){return _0x5151e1;});}return null;};}function removeEntity(_0x4c5b99,_0x294ece){return function(_0x1a0c14){if(_0x1a0c14){return _0x1a0c14['destroy']()[_0xf126('0x27')](function(){_0x4c5b99['status'](0xcc)[_0xf126('0x1c')]();});}};}function handleEntityNotFound(_0x4eae3a,_0x2b301a){return function(_0x49632f){if(!_0x49632f){_0x4eae3a[_0xf126('0x1a')](0x194);}return _0x49632f;};}function handleError(_0x497d2f,_0x1a1081){_0x1a1081=_0x1a1081||0x1f4;return function(_0x5a1914){logger[_0xf126('0x28')](_0x5a1914[_0xf126('0x29')]);if(_0x5a1914[_0xf126('0x2a')]){delete _0x5a1914[_0xf126('0x2a')];}_0x497d2f[_0xf126('0x1b')](_0x1a1081)['send'](_0x5a1914);};}exports[_0xf126('0x2b')]=function(_0x51b5f7,_0x36afc0){var _0x503475={},_0x113a1c={},_0x27119b={'count':0x0,'rows':[]};var _0x204242=_[_0xf126('0x2c')](db['SalesforceField'][_0xf126('0x2d')],function(_0x39ae43){return{'name':_0x39ae43[_0xf126('0x2e')],'type':_0x39ae43['type']['key']};});_0x113a1c[_0xf126('0x2f')]=_[_0xf126('0x2c')](_0x204242,_0xf126('0x2a'));_0x113a1c[_0xf126('0x30')]=_[_0xf126('0x31')](_0x51b5f7['query']);_0x113a1c[_0xf126('0x32')]=_[_0xf126('0x33')](_0x113a1c[_0xf126('0x2f')],_0x113a1c[_0xf126('0x30')]);_0x503475[_0xf126('0x34')]=_[_0xf126('0x33')](_0x113a1c['model'],qs[_0xf126('0x35')](_0x51b5f7[_0xf126('0x30')][_0xf126('0x35')]));_0x503475[_0xf126('0x34')]=_0x503475[_0xf126('0x34')][_0xf126('0x36')]?_0x503475[_0xf126('0x34')]:_0x113a1c[_0xf126('0x2f')];if(!_0x51b5f7[_0xf126('0x30')]['hasOwnProperty']('nolimit')){_0x503475[_0xf126('0x20')]=qs[_0xf126('0x20')](_0x51b5f7[_0xf126('0x30')][_0xf126('0x20')]);_0x503475[_0xf126('0x1f')]=qs[_0xf126('0x1f')](_0x51b5f7[_0xf126('0x30')]['offset']);}_0x503475[_0xf126('0x37')]=qs[_0xf126('0x38')](_0x51b5f7[_0xf126('0x30')][_0xf126('0x38')]);_0x503475[_0xf126('0x39')]=qs[_0xf126('0x32')](_[_0xf126('0x3a')](_0x51b5f7[_0xf126('0x30')],_0x113a1c[_0xf126('0x32')]),_0x204242);if(_0x51b5f7[_0xf126('0x30')]['filter']){_0x503475[_0xf126('0x39')]=_['merge'](_0x503475[_0xf126('0x39')],{'$or':_[_0xf126('0x2c')](_0x204242,function(_0x4371a2){if(_0x4371a2[_0xf126('0x3b')]!==_0xf126('0x3c')){var _0x464b4d={};_0x464b4d[_0x4371a2[_0xf126('0x2a')]]={'$like':'%'+_0x51b5f7[_0xf126('0x30')][_0xf126('0x3d')]+'%'};return _0x464b4d;}})});}_0x503475=_['merge']({},_0x503475,_0x51b5f7['options']);var _0x3a3cba={'where':_0x503475[_0xf126('0x39')]};return db['SalesforceField']['count'](_0x3a3cba)[_0xf126('0x27')](function(_0x426459){_0x27119b['count']=_0x426459;if(_0x51b5f7[_0xf126('0x30')]['includeAll']){_0x503475['include']=[{'all':!![]}];}return db[_0xf126('0x3e')]['findAll'](_0x503475);})['then'](function(_0x4a75cf){_0x27119b[_0xf126('0x3f')]=_0x4a75cf;return _0x27119b;})[_0xf126('0x27')](respondWithFilteredResult(_0x36afc0,_0x503475))['catch'](handleError(_0x36afc0,null));};exports['show']=function(_0x5cadf5,_0x2f735a){var _0x4c97bf={'raw':!![],'where':{'id':_0x5cadf5[_0xf126('0x40')]['id']}},_0x388886={};_0x388886[_0xf126('0x2f')]=_[_0xf126('0x31')](db[_0xf126('0x3e')][_0xf126('0x2d')]);_0x388886['query']=_[_0xf126('0x31')](_0x5cadf5[_0xf126('0x30')]);_0x388886[_0xf126('0x32')]=_[_0xf126('0x33')](_0x388886[_0xf126('0x2f')],_0x388886[_0xf126('0x30')]);_0x4c97bf[_0xf126('0x34')]=_[_0xf126('0x33')](_0x388886[_0xf126('0x2f')],qs[_0xf126('0x35')](_0x5cadf5[_0xf126('0x30')][_0xf126('0x35')]));_0x4c97bf['attributes']=_0x4c97bf['attributes']['length']?_0x4c97bf[_0xf126('0x34')]:_0x388886[_0xf126('0x2f')];if(_0x5cadf5[_0xf126('0x30')][_0xf126('0x41')]){_0x4c97bf[_0xf126('0x42')]=[{'all':!![]}];}_0x4c97bf=_[_0xf126('0x43')]({},_0x4c97bf,_0x5cadf5[_0xf126('0x44')]);return db[_0xf126('0x3e')][_0xf126('0x45')](_0x4c97bf)[_0xf126('0x27')](handleEntityNotFound(_0x2f735a,null))[_0xf126('0x27')](respondWithResult(_0x2f735a,null))[_0xf126('0x46')](handleError(_0x2f735a,null));};exports[_0xf126('0x47')]=function(_0x13216e,_0x3f5e36){return db[_0xf126('0x3e')][_0xf126('0x47')](_0x13216e['body'],{})[_0xf126('0x27')](respondWithResult(_0x3f5e36,0xc9))[_0xf126('0x46')](handleError(_0x3f5e36,null));};exports['update']=function(_0x5dcd99,_0xf5a98b){if(_0x5dcd99[_0xf126('0x48')]['id']){delete _0x5dcd99[_0xf126('0x48')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x5dcd99[_0xf126('0x40')]['id']}})[_0xf126('0x27')](handleEntityNotFound(_0xf5a98b,null))[_0xf126('0x27')](saveUpdates(_0x5dcd99[_0xf126('0x48')],null))[_0xf126('0x27')](respondWithResult(_0xf5a98b,null))[_0xf126('0x46')](handleError(_0xf5a98b,null));};exports[_0xf126('0x49')]=function(_0x597ea1,_0x57dc96){return db['SalesforceField'][_0xf126('0x45')]({'where':{'id':_0x597ea1['params']['id']}})['then'](handleEntityNotFound(_0x57dc96,null))[_0xf126('0x27')](removeEntity(_0x57dc96,null))[_0xf126('0x46')](handleError(_0x57dc96,null));}; \ No newline at end of file +var _0x616c=['then','destroy','stack','send','index','map','SalesforceField','rawAttributes','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x616c,0xb5));var _0xc616=function(_0x3f2000,_0x51b91b){_0x3f2000=_0x3f2000-0x0;var _0x1edae8=_0x616c[_0x3f2000];return _0x1edae8;};'use strict';var emlformat=require(_0xc616('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc616('0x1'));var rp=require(_0xc616('0x2'));var moment=require(_0xc616('0x3'));var BPromise=require(_0xc616('0x4'));var Mustache=require(_0xc616('0x5'));var util=require(_0xc616('0x6'));var path=require(_0xc616('0x7'));var sox=require(_0xc616('0x8'));var csv=require(_0xc616('0x9'));var ejs=require(_0xc616('0xa'));var fs=require('fs');var fs_extra=require(_0xc616('0xb'));var _=require('lodash');var squel=require(_0xc616('0xc'));var crypto=require(_0xc616('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc616('0xe'));var toCsv=require(_0xc616('0x9'));var querystring=require(_0xc616('0xf'));var Papa=require('papaparse');var Redis=require(_0xc616('0x10'));var authService=require(_0xc616('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc616('0x12'));var hardwareService=require(_0xc616('0x13'));var logger=require(_0xc616('0x14'))(_0xc616('0x15'));var utils=require('../../config/utils');var config=require(_0xc616('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd495b6,_0x447213){_0x447213=_0x447213||0xcc;return function(_0x4018f3){if(_0x4018f3){return _0xd495b6[_0xc616('0x17')](_0x447213);}return _0xd495b6[_0xc616('0x18')](_0x447213)[_0xc616('0x19')]();};}function respondWithResult(_0x3330d4,_0x1b8b32){_0x1b8b32=_0x1b8b32||0xc8;return function(_0x1872de){if(_0x1872de){return _0x3330d4[_0xc616('0x18')](_0x1b8b32)[_0xc616('0x1a')](_0x1872de);}};}function respondWithFilteredResult(_0x38fc0b,_0x5e21e7){return function(_0x51b9a){if(_0x51b9a){var _0x4bd03e=typeof _0x5e21e7[_0xc616('0x1b')]===_0xc616('0x1c')&&typeof _0x5e21e7[_0xc616('0x1d')]===_0xc616('0x1c');var _0x2c7e26=_0x51b9a[_0xc616('0x1e')];var _0x1a7fb1=_0x4bd03e?0x0:_0x5e21e7['offset'];var _0x2f7b22=_0x4bd03e?_0x51b9a['count']:_0x5e21e7[_0xc616('0x1b')]+_0x5e21e7[_0xc616('0x1d')];var _0x4adb52;if(_0x2f7b22>=_0x2c7e26){_0x2f7b22=_0x2c7e26;_0x4adb52=0xc8;}else{_0x4adb52=0xce;}_0x38fc0b['status'](_0x4adb52);return _0x38fc0b[_0xc616('0x1f')](_0xc616('0x20'),_0x1a7fb1+'-'+_0x2f7b22+'/'+_0x2c7e26)[_0xc616('0x1a')](_0x51b9a);}return null;};}function patchUpdates(_0x194a53){return function(_0x756611){try{jsonpatch[_0xc616('0x21')](_0x756611,_0x194a53,!![]);}catch(_0x234519){return BPromise['reject'](_0x234519);}return _0x756611[_0xc616('0x22')]();};}function saveUpdates(_0x449173,_0x5758da){return function(_0x384d2a){if(_0x384d2a){return _0x384d2a['update'](_0x449173)[_0xc616('0x23')](function(_0x5c542d){return _0x5c542d;});}return null;};}function removeEntity(_0x3fbdd7,_0x2fbc92){return function(_0x50fb5e){if(_0x50fb5e){return _0x50fb5e[_0xc616('0x24')]()[_0xc616('0x23')](function(){_0x3fbdd7['status'](0xcc)[_0xc616('0x19')]();});}};}function handleEntityNotFound(_0x55fc38,_0x3e870f){return function(_0x3a8d0b){if(!_0x3a8d0b){_0x55fc38[_0xc616('0x17')](0x194);}return _0x3a8d0b;};}function handleError(_0x2044e1,_0x11d74a){_0x11d74a=_0x11d74a||0x1f4;return function(_0x544036){logger['error'](_0x544036[_0xc616('0x25')]);if(_0x544036['name']){delete _0x544036['name'];}_0x2044e1[_0xc616('0x18')](_0x11d74a)[_0xc616('0x26')](_0x544036);};}exports[_0xc616('0x27')]=function(_0x538f29,_0x4ad711){var _0x1e4d3b={},_0x585378={},_0xfff120={'count':0x0,'rows':[]};var _0x311878=_[_0xc616('0x28')](db[_0xc616('0x29')][_0xc616('0x2a')],function(_0x155f02){return{'name':_0x155f02['fieldName'],'type':_0x155f02[_0xc616('0x2b')][_0xc616('0x2c')]};});_0x585378[_0xc616('0x2d')]=_[_0xc616('0x28')](_0x311878,_0xc616('0x2e'));_0x585378['query']=_[_0xc616('0x2f')](_0x538f29[_0xc616('0x30')]);_0x585378[_0xc616('0x31')]=_[_0xc616('0x32')](_0x585378[_0xc616('0x2d')],_0x585378[_0xc616('0x30')]);_0x1e4d3b['attributes']=_[_0xc616('0x32')](_0x585378[_0xc616('0x2d')],qs['fields'](_0x538f29[_0xc616('0x30')][_0xc616('0x33')]));_0x1e4d3b[_0xc616('0x34')]=_0x1e4d3b[_0xc616('0x34')][_0xc616('0x35')]?_0x1e4d3b[_0xc616('0x34')]:_0x585378['model'];if(!_0x538f29[_0xc616('0x30')][_0xc616('0x36')](_0xc616('0x37'))){_0x1e4d3b[_0xc616('0x1d')]=qs[_0xc616('0x1d')](_0x538f29[_0xc616('0x30')]['limit']);_0x1e4d3b[_0xc616('0x1b')]=qs[_0xc616('0x1b')](_0x538f29[_0xc616('0x30')][_0xc616('0x1b')]);}_0x1e4d3b[_0xc616('0x38')]=qs[_0xc616('0x39')](_0x538f29[_0xc616('0x30')][_0xc616('0x39')]);_0x1e4d3b[_0xc616('0x3a')]=qs['filters'](_['pick'](_0x538f29[_0xc616('0x30')],_0x585378[_0xc616('0x31')]),_0x311878);if(_0x538f29[_0xc616('0x30')]['filter']){_0x1e4d3b[_0xc616('0x3a')]=_[_0xc616('0x3b')](_0x1e4d3b['where'],{'$or':_[_0xc616('0x28')](_0x311878,function(_0x2ad138){if(_0x2ad138[_0xc616('0x2b')]!==_0xc616('0x3c')){var _0x5d037a={};_0x5d037a[_0x2ad138[_0xc616('0x2e')]]={'$like':'%'+_0x538f29['query']['filter']+'%'};return _0x5d037a;}})});}_0x1e4d3b=_[_0xc616('0x3b')]({},_0x1e4d3b,_0x538f29[_0xc616('0x3d')]);var _0x4a0e71={'where':_0x1e4d3b['where']};return db[_0xc616('0x29')]['count'](_0x4a0e71)[_0xc616('0x23')](function(_0x5493e9){_0xfff120[_0xc616('0x1e')]=_0x5493e9;if(_0x538f29[_0xc616('0x30')][_0xc616('0x3e')]){_0x1e4d3b[_0xc616('0x3f')]=[{'all':!![]}];}return db[_0xc616('0x29')][_0xc616('0x40')](_0x1e4d3b);})[_0xc616('0x23')](function(_0x2100a3){_0xfff120[_0xc616('0x41')]=_0x2100a3;return _0xfff120;})[_0xc616('0x23')](respondWithFilteredResult(_0x4ad711,_0x1e4d3b))[_0xc616('0x42')](handleError(_0x4ad711,null));};exports[_0xc616('0x43')]=function(_0x4b85d4,_0x2f308d){var _0x395e8a={'raw':!![],'where':{'id':_0x4b85d4[_0xc616('0x44')]['id']}},_0x1570f0={};_0x1570f0[_0xc616('0x2d')]=_[_0xc616('0x2f')](db[_0xc616('0x29')][_0xc616('0x2a')]);_0x1570f0['query']=_[_0xc616('0x2f')](_0x4b85d4['query']);_0x1570f0[_0xc616('0x31')]=_['intersection'](_0x1570f0['model'],_0x1570f0['query']);_0x395e8a['attributes']=_['intersection'](_0x1570f0[_0xc616('0x2d')],qs['fields'](_0x4b85d4[_0xc616('0x30')]['fields']));_0x395e8a[_0xc616('0x34')]=_0x395e8a[_0xc616('0x34')][_0xc616('0x35')]?_0x395e8a['attributes']:_0x1570f0[_0xc616('0x2d')];if(_0x4b85d4[_0xc616('0x30')]['includeAll']){_0x395e8a[_0xc616('0x3f')]=[{'all':!![]}];}_0x395e8a=_[_0xc616('0x3b')]({},_0x395e8a,_0x4b85d4['options']);return db[_0xc616('0x29')][_0xc616('0x45')](_0x395e8a)[_0xc616('0x23')](handleEntityNotFound(_0x2f308d,null))[_0xc616('0x23')](respondWithResult(_0x2f308d,null))[_0xc616('0x42')](handleError(_0x2f308d,null));};exports[_0xc616('0x46')]=function(_0x18033c,_0x955dfe){return db[_0xc616('0x29')]['create'](_0x18033c[_0xc616('0x47')],{})[_0xc616('0x23')](respondWithResult(_0x955dfe,0xc9))[_0xc616('0x42')](handleError(_0x955dfe,null));};exports['update']=function(_0x1c37ec,_0x4f9d5d){if(_0x1c37ec['body']['id']){delete _0x1c37ec[_0xc616('0x47')]['id'];}return db[_0xc616('0x29')][_0xc616('0x45')]({'where':{'id':_0x1c37ec['params']['id']}})['then'](handleEntityNotFound(_0x4f9d5d,null))[_0xc616('0x23')](saveUpdates(_0x1c37ec['body'],null))[_0xc616('0x23')](respondWithResult(_0x4f9d5d,null))[_0xc616('0x42')](handleError(_0x4f9d5d,null));};exports[_0xc616('0x24')]=function(_0x8de998,_0x362481){return db[_0xc616('0x29')]['find']({'where':{'id':_0x8de998['params']['id']}})[_0xc616('0x23')](handleEntityNotFound(_0x362481,null))['then'](removeEntity(_0x362481,null))[_0xc616('0x42')](handleError(_0x362481,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 17fc3ce..19a16b0 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 _0xec66=['int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SalesforceField'];(function(_0x399214,_0x393d1e){var _0x1c8f4c=function(_0x439153){while(--_0x439153){_0x399214['push'](_0x399214['shift']());}};_0x1c8f4c(++_0x393d1e);}(_0xec66,0x144));var _0x6ec6=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0xec66[_0x4baac8];return _0x56ebc5;};'use strict';var _=require(_0x6ec6('0x0'));var util=require(_0x6ec6('0x1'));var logger=require(_0x6ec6('0x2'))(_0x6ec6('0x3'));var moment=require(_0x6ec6('0x4'));var BPromise=require(_0x6ec6('0x5'));var rp=require(_0x6ec6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ec6('0x7'));var config=require(_0x6ec6('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x6ec6('0x9')]=function(_0x4dcfaa,_0x350dc2){return _0x4dcfaa[_0x6ec6('0xa')](_0x6ec6('0xb'),attributes,{'tableName':_0x6ec6('0xc'),'paranoid':![],'indexes':[{'name':_0x6ec6('0xd'),'fields':[_0x6ec6('0xe'),_0x6ec6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e08=['../../config/environment','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x35b135,_0x1a5f58){var _0x1a592f=function(_0x20c1b4){while(--_0x20c1b4){_0x35b135['push'](_0x35b135['shift']());}};_0x1a592f(++_0x1a5f58);}(_0x0e08,0xbc));var _0x80e0=function(_0x4a209a,_0x1ace06){_0x4a209a=_0x4a209a-0x0;var _0x992c8e=_0x0e08[_0x4a209a];return _0x992c8e;};'use strict';var _=require(_0x80e0('0x0'));var util=require(_0x80e0('0x1'));var logger=require('../../config/logger')(_0x80e0('0x2'));var moment=require(_0x80e0('0x3'));var BPromise=require('bluebird');var rp=require(_0x80e0('0x4'));var fs=require('fs');var path=require(_0x80e0('0x5'));var rimraf=require(_0x80e0('0x6'));var config=require(_0x80e0('0x7'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x180e62,_0x52db49){return _0x180e62['define'](_0x80e0('0x8'),attributes,{'tableName':_0x80e0('0x9'),'paranoid':![],'indexes':[{'name':_0x80e0('0xa'),'fields':[_0x80e0('0xb'),_0x80e0('0xc')],'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 db922bb..5849bba 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 _0xebad=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x30b5d4,_0xee3901){var _0x1e5f1c=function(_0x268485){while(--_0x268485){_0x30b5d4['push'](_0x30b5d4['shift']());}};_0x1e5f1c(++_0xee3901);}(_0xebad,0x17e));var _0xdeba=function(_0x39c00f,_0x590c94){_0x39c00f=_0x39c00f-0x0;var _0x15f021=_0xebad[_0x39c00f];return _0x15f021;};'use strict';var _=require(_0xdeba('0x0'));var util=require(_0xdeba('0x1'));var moment=require(_0xdeba('0x2'));var BPromise=require(_0xdeba('0x3'));var rs=require(_0xdeba('0x4'));var fs=require('fs');var Redis=require(_0xdeba('0x5'));var db=require(_0xdeba('0x6'))['db'];var utils=require(_0xdeba('0x7'));var logger=require(_0xdeba('0x8'))(_0xdeba('0x9'));var config=require(_0xdeba('0xa'));var jayson=require(_0xdeba('0xb'));var client=jayson[_0xdeba('0xc')][_0xdeba('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3c01f0,_0x536023,_0x546df0){return new BPromise(function(_0x30c4b0,_0x2f00fa){return client[_0xdeba('0xe')](_0x3c01f0,_0x546df0)['then'](function(_0x42519c){logger[_0xdeba('0xf')]('SalesforceField,\x20%s,\x20%s',_0x536023,_0xdeba('0x10'));logger['debug'](_0xdeba('0x11'),_0x536023,_0xdeba('0x10'),JSON['stringify'](_0x42519c));if(_0x42519c['error']){if(_0x42519c[_0xdeba('0x12')][_0xdeba('0x13')]===0x1f4){logger[_0xdeba('0x12')](_0xdeba('0x14'),_0x536023,_0x42519c[_0xdeba('0x12')]['message']);return _0x2f00fa(_0x42519c['error']['message']);}logger[_0xdeba('0x12')](_0xdeba('0x14'),_0x536023,_0x42519c['error'][_0xdeba('0x15')]);return _0x30c4b0(_0x42519c[_0xdeba('0x12')]['message']);}else{logger['info'](_0xdeba('0x14'),_0x536023,_0xdeba('0x10'));_0x30c4b0(_0x42519c[_0xdeba('0x16')]['message']);}})['catch'](function(_0x5bc17a){logger[_0xdeba('0x12')](_0xdeba('0x14'),_0x536023,_0x5bc17a);_0x2f00fa(_0x5bc17a);});});} \ No newline at end of file +var _0x32f6=['http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x32f6,0x182));var _0x632f=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x32f6[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x632f('0x0'));var util=require('util');var moment=require(_0x632f('0x1'));var BPromise=require(_0x632f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632f('0x3'));var db=require(_0x632f('0x4'))['db'];var utils=require(_0x632f('0x5'));var logger=require(_0x632f('0x6'))(_0x632f('0x7'));var config=require(_0x632f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x632f('0x9')][_0x632f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15b56a,_0x2a9e9c,_0x41c88a){return new BPromise(function(_0x5bbac7,_0x179c6e){return client[_0x632f('0xb')](_0x15b56a,_0x41c88a)['then'](function(_0x3065b8){logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));logger[_0x632f('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2a9e9c,_0x632f('0xe'),JSON[_0x632f('0x10')](_0x3065b8));if(_0x3065b8[_0x632f('0x11')]){if(_0x3065b8[_0x632f('0x11')][_0x632f('0x12')]===0x1f4){logger[_0x632f('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x179c6e(_0x3065b8['error']['message']);}logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);return _0x5bbac7(_0x3065b8[_0x632f('0x11')][_0x632f('0x13')]);}else{logger[_0x632f('0xc')](_0x632f('0xd'),_0x2a9e9c,_0x632f('0xe'));_0x5bbac7(_0x3065b8[_0x632f('0x14')][_0x632f('0x13')]);}})[_0x632f('0x15')](function(_0x20aedd){logger[_0x632f('0x11')](_0x632f('0xd'),_0x2a9e9c,_0x20aedd);_0x179c6e(_0x20aedd);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 94748ee..f65bc59 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 _0xbe23=['getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show'];(function(_0x3a6edb,_0x2b5f99){var _0x1821af=function(_0x22b264){while(--_0x22b264){_0x3a6edb['push'](_0x3a6edb['shift']());}};_0x1821af(++_0x2b5f99);}(_0xbe23,0x1c2));var _0x3be2=function(_0x2cc9a0,_0x1c456d){_0x2cc9a0=_0x2cc9a0-0x0;var _0x15d5b2=_0xbe23[_0x2cc9a0];return _0x15d5b2;};'use strict';var multer=require(_0x3be2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3be2('0x1'));var express=require(_0x3be2('0x2'));var router=express[_0x3be2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3be2('0x4'));var interaction=require(_0x3be2('0x5'));var config=require(_0x3be2('0x6'));var controller=require(_0x3be2('0x7'));router[_0x3be2('0x8')]('/',auth[_0x3be2('0x9')](),controller['index']);router['get'](_0x3be2('0xa'),auth[_0x3be2('0x9')](),controller[_0x3be2('0xb')]);router[_0x3be2('0x8')]('/:id/configurations',auth[_0x3be2('0x9')](),controller[_0x3be2('0xc')]);router[_0x3be2('0x8')](_0x3be2('0xd'),auth[_0x3be2('0x9')](),controller[_0x3be2('0xe')]);router[_0x3be2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3be2('0x10'),auth[_0x3be2('0x9')](),controller['addConfiguration']);router[_0x3be2('0x11')](_0x3be2('0xa'),auth[_0x3be2('0x9')](),controller['update']);router[_0x3be2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3be2('0x13')]);module[_0x3be2('0x14')]=router; \ No newline at end of file +var _0x8bc8=['Router','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3231ee,_0x44e1ef){var _0x2092f1=function(_0x3329cd){while(--_0x3329cd){_0x3231ee['push'](_0x3231ee['shift']());}};_0x2092f1(++_0x44e1ef);}(_0x8bc8,0xc4));var _0x88bc=function(_0x3211f6,_0x47eb23){_0x3211f6=_0x3211f6-0x0;var _0x273e60=_0x8bc8[_0x3211f6];return _0x273e60;};'use strict';var multer=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var path=require(_0x88bc('0x2'));var timeout=require(_0x88bc('0x3'));var express=require('express');var router=express[_0x88bc('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(_0x88bc('0x5'));router['get']('/',auth[_0x88bc('0x6')](),controller['index']);router[_0x88bc('0x7')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x9')]);router[_0x88bc('0x7')]('/:id/configurations',auth[_0x88bc('0x6')](),controller[_0x88bc('0xa')]);router['get'](_0x88bc('0xb'),auth[_0x88bc('0x6')](),controller[_0x88bc('0xc')]);router[_0x88bc('0xd')]('/',auth[_0x88bc('0x6')](),controller[_0x88bc('0xe')]);router[_0x88bc('0xd')](_0x88bc('0xf'),auth[_0x88bc('0x6')](),controller['addConfiguration']);router[_0x88bc('0x10')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x88bc('0x12')]);module[_0x88bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c7747fd..4ebe74c 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 _0xc118=['username','remoteUri','sequelize','exports','STRING'];(function(_0x522a93,_0x25147d){var _0x2ea295=function(_0x5b32e9){while(--_0x5b32e9){_0x522a93['push'](_0x522a93['shift']());}};_0x2ea295(++_0x25147d);}(_0xc118,0xcf));var _0x8c11=function(_0x4d2893,_0x831a85){_0x4d2893=_0x4d2893-0x0;var _0x5a5a2d=_0xc118[_0x4d2893];return _0x5a5a2d;};'use strict';var Sequelize=require(_0x8c11('0x0'));module[_0x8c11('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c11('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8c11('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8c11('0x2')]},'remoteUri':{'type':Sequelize[_0x8c11('0x2')],'unique':_0x8c11('0x4')},'serverUrl':{'type':Sequelize[_0x8c11('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe8b7=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3a153f,_0x5bb7c5){var _0x260c46=function(_0x1633c8){while(--_0x1633c8){_0x3a153f['push'](_0x3a153f['shift']());}};_0x260c46(++_0x5bb7c5);}(_0xe8b7,0x1ed));var _0x7e8b=function(_0x2e360,_0x236b39){_0x2e360=_0x2e360-0x0;var _0xa728f9=_0xe8b7[_0x2e360];return _0xa728f9;};'use strict';var Sequelize=require(_0x7e8b('0x0'));module[_0x7e8b('0x1')]={'name':{'type':Sequelize[_0x7e8b('0x2')]},'description':{'type':Sequelize[_0x7e8b('0x2')]},'username':{'type':Sequelize[_0x7e8b('0x2')],'unique':_0x7e8b('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7e8b('0x2')]},'remoteUri':{'type':Sequelize[_0x7e8b('0x2')],'unique':_0x7e8b('0x4')},'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 28e43a7..2ab56b7 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 _0xd216=['error','name','index','ServicenowAccount','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','attributes','model','length','order','sort','pick','filter','where','VIRTUAL','merge','options','then','include','rows','show','params','fields','includeAll','catch','create','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','user_input','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','sys_class_name','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','serverUrl','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','stack','send','Wrong\x20credentials','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','Content-Range','reject','save','destroy','end'];(function(_0x1c976c,_0xa5539d){var _0x356ca7=function(_0x2c3198){while(--_0x2c3198){_0x1c976c['push'](_0x1c976c['shift']());}};_0x356ca7(++_0xa5539d);}(_0xd216,0x149));var _0x6d21=function(_0x472b9a,_0x823ee8){_0x472b9a=_0x472b9a-0x0;var _0x533a5c=_0xd216[_0x472b9a];return _0x533a5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d21('0x0'));var zipdir=require(_0x6d21('0x1'));var jsonpatch=require(_0x6d21('0x2'));var rp=require(_0x6d21('0x3'));var moment=require('moment');var BPromise=require(_0x6d21('0x4'));var Mustache=require(_0x6d21('0x5'));var util=require(_0x6d21('0x6'));var path=require('path');var sox=require(_0x6d21('0x7'));var csv=require(_0x6d21('0x8'));var ejs=require(_0x6d21('0x9'));var fs=require('fs');var fs_extra=require(_0x6d21('0xa'));var _=require(_0x6d21('0xb'));var squel=require(_0x6d21('0xc'));var crypto=require('crypto');var jsforce=require(_0x6d21('0xd'));var deskjs=require(_0x6d21('0xe'));var toCsv=require(_0x6d21('0x8'));var querystring=require(_0x6d21('0xf'));var Papa=require(_0x6d21('0x10'));var Redis=require(_0x6d21('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6d21('0x12'));var hardwareService=require(_0x6d21('0x13'));var logger=require(_0x6d21('0x14'))('api');var utils=require(_0x6d21('0x15'));var config=require(_0x6d21('0x16'));var licenseUtil=require(_0x6d21('0x17'));var db=require(_0x6d21('0x18'))['db'];var integrations=require(_0x6d21('0x19'));function respondWithStatusCode(_0x13e536,_0x52f2c0){_0x52f2c0=_0x52f2c0||0xcc;return function(_0x404005){if(_0x404005){return _0x13e536[_0x6d21('0x1a')](_0x52f2c0);}return _0x13e536[_0x6d21('0x1b')](_0x52f2c0)['end']();};}function respondWithResult(_0xb686c8,_0x47b068){_0x47b068=_0x47b068||0xc8;return function(_0x116631){if(_0x116631){return _0xb686c8[_0x6d21('0x1b')](_0x47b068)['json'](_0x116631);}};}function respondWithFilteredResult(_0x41c088,_0x367e4e){return function(_0xb5782a){if(_0xb5782a){var _0x14e1f4=typeof _0x367e4e[_0x6d21('0x1c')]===_0x6d21('0x1d')&&typeof _0x367e4e[_0x6d21('0x1e')]===_0x6d21('0x1d');var _0x158051=_0xb5782a[_0x6d21('0x1f')];var _0xfb5863=_0x14e1f4?0x0:_0x367e4e['offset'];var _0x186548=_0x14e1f4?_0xb5782a['count']:_0x367e4e['offset']+_0x367e4e[_0x6d21('0x1e')];var _0xc5e66d;if(_0x186548>=_0x158051){_0x186548=_0x158051;_0xc5e66d=0xc8;}else{_0xc5e66d=0xce;}_0x41c088['status'](_0xc5e66d);return _0x41c088['set'](_0x6d21('0x20'),_0xfb5863+'-'+_0x186548+'/'+_0x158051)['json'](_0xb5782a);}return null;};}function patchUpdates(_0x324ccb){return function(_0x4660f3){try{jsonpatch['apply'](_0x4660f3,_0x324ccb,!![]);}catch(_0x187335){return BPromise[_0x6d21('0x21')](_0x187335);}return _0x4660f3[_0x6d21('0x22')]();};}function saveUpdates(_0x3dd91c,_0x247f7e){return function(_0x59717){if(_0x59717){return _0x59717['update'](_0x3dd91c)['then'](function(_0x53b28c){return _0x53b28c;});}return null;};}function removeEntity(_0x115d3f,_0x187512){return function(_0x5d219f){if(_0x5d219f){return _0x5d219f[_0x6d21('0x23')]()['then'](function(){_0x115d3f['status'](0xcc)[_0x6d21('0x24')]();});}};}function handleEntityNotFound(_0x44c56d,_0x8c0b90){return function(_0x21c898){if(!_0x21c898){_0x44c56d[_0x6d21('0x1a')](0x194);}return _0x21c898;};}function handleError(_0x4b46c9,_0x569781){_0x569781=_0x569781||0x1f4;return function(_0x4d47e0){logger[_0x6d21('0x25')](_0x4d47e0['stack']);if(_0x4d47e0[_0x6d21('0x26')]){delete _0x4d47e0['name'];}_0x4b46c9[_0x6d21('0x1b')](_0x569781)['send'](_0x4d47e0);};}exports[_0x6d21('0x27')]=function(_0x2d0d88,_0x35fa2c){var _0xd152a2={},_0x4e98e6={},_0x24277a={'count':0x0,'rows':[]};var _0x4167e8=_['map'](db[_0x6d21('0x28')][_0x6d21('0x29')],function(_0x5e85f0){return{'name':_0x5e85f0[_0x6d21('0x2a')],'type':_0x5e85f0[_0x6d21('0x2b')][_0x6d21('0x2c')]};});_0x4e98e6['model']=_[_0x6d21('0x2d')](_0x4167e8,_0x6d21('0x26'));_0x4e98e6['query']=_[_0x6d21('0x2e')](_0x2d0d88[_0x6d21('0x2f')]);_0x4e98e6[_0x6d21('0x30')]=_[_0x6d21('0x31')](_0x4e98e6['model'],_0x4e98e6[_0x6d21('0x2f')]);_0xd152a2[_0x6d21('0x32')]=_[_0x6d21('0x31')](_0x4e98e6[_0x6d21('0x33')],qs['fields'](_0x2d0d88['query']['fields']));_0xd152a2[_0x6d21('0x32')]=_0xd152a2[_0x6d21('0x32')][_0x6d21('0x34')]?_0xd152a2[_0x6d21('0x32')]:_0x4e98e6[_0x6d21('0x33')];if(!_0x2d0d88[_0x6d21('0x2f')]['hasOwnProperty']('nolimit')){_0xd152a2['limit']=qs[_0x6d21('0x1e')](_0x2d0d88[_0x6d21('0x2f')][_0x6d21('0x1e')]);_0xd152a2[_0x6d21('0x1c')]=qs[_0x6d21('0x1c')](_0x2d0d88[_0x6d21('0x2f')][_0x6d21('0x1c')]);}_0xd152a2[_0x6d21('0x35')]=qs[_0x6d21('0x36')](_0x2d0d88[_0x6d21('0x2f')][_0x6d21('0x36')]);_0xd152a2['where']=qs[_0x6d21('0x30')](_[_0x6d21('0x37')](_0x2d0d88[_0x6d21('0x2f')],_0x4e98e6[_0x6d21('0x30')]),_0x4167e8);if(_0x2d0d88[_0x6d21('0x2f')][_0x6d21('0x38')]){_0xd152a2[_0x6d21('0x39')]=_['merge'](_0xd152a2[_0x6d21('0x39')],{'$or':_[_0x6d21('0x2d')](_0x4167e8,function(_0x5953cc){if(_0x5953cc['type']!==_0x6d21('0x3a')){var _0x86ddc2={};_0x86ddc2[_0x5953cc['name']]={'$like':'%'+_0x2d0d88['query']['filter']+'%'};return _0x86ddc2;}})});}_0xd152a2=_[_0x6d21('0x3b')]({},_0xd152a2,_0x2d0d88[_0x6d21('0x3c')]);var _0x4fb186={'where':_0xd152a2['where']};return db['ServicenowAccount']['count'](_0x4fb186)[_0x6d21('0x3d')](function(_0x4b761d){_0x24277a[_0x6d21('0x1f')]=_0x4b761d;if(_0x2d0d88[_0x6d21('0x2f')]['includeAll']){_0xd152a2[_0x6d21('0x3e')]=[{'all':!![]}];}return db[_0x6d21('0x28')]['findAll'](_0xd152a2);})[_0x6d21('0x3d')](function(_0x44aad6){_0x24277a[_0x6d21('0x3f')]=_0x44aad6;return _0x24277a;})['then'](respondWithFilteredResult(_0x35fa2c,_0xd152a2))['catch'](handleError(_0x35fa2c,null));};exports[_0x6d21('0x40')]=function(_0x4f7607,_0x36ca82){var _0x5485ad={'raw':![],'where':{'id':_0x4f7607[_0x6d21('0x41')]['id']}},_0x30028a={};_0x30028a[_0x6d21('0x33')]=_[_0x6d21('0x2e')](db['ServicenowAccount'][_0x6d21('0x29')]);_0x30028a[_0x6d21('0x2f')]=_['keys'](_0x4f7607[_0x6d21('0x2f')]);_0x30028a[_0x6d21('0x30')]=_[_0x6d21('0x31')](_0x30028a[_0x6d21('0x33')],_0x30028a[_0x6d21('0x2f')]);_0x5485ad[_0x6d21('0x32')]=_[_0x6d21('0x31')](_0x30028a[_0x6d21('0x33')],qs[_0x6d21('0x42')](_0x4f7607[_0x6d21('0x2f')][_0x6d21('0x42')]));_0x5485ad[_0x6d21('0x32')]=_0x5485ad[_0x6d21('0x32')][_0x6d21('0x34')]?_0x5485ad[_0x6d21('0x32')]:_0x30028a['model'];if(_0x4f7607[_0x6d21('0x2f')][_0x6d21('0x43')]){_0x5485ad[_0x6d21('0x3e')]=[{'all':!![]}];}_0x5485ad=_[_0x6d21('0x3b')]({},_0x5485ad,_0x4f7607['options']);return db[_0x6d21('0x28')]['find'](_0x5485ad)['then'](handleEntityNotFound(_0x36ca82,null))[_0x6d21('0x3d')](respondWithResult(_0x36ca82,null))[_0x6d21('0x44')](handleError(_0x36ca82,null));};exports[_0x6d21('0x45')]=function(_0x83d83c,_0x4e1a43){return db[_0x6d21('0x28')][_0x6d21('0x45')](_0x83d83c[_0x6d21('0x46')],{})['then'](respondWithResult(_0x4e1a43,0xc9))['catch'](handleError(_0x4e1a43,null));};exports['update']=function(_0x17abd5,_0x4b30c0){if(_0x17abd5[_0x6d21('0x46')]['id']){delete _0x17abd5[_0x6d21('0x46')]['id'];}return db['ServicenowAccount'][_0x6d21('0x47')]({'where':{'id':_0x17abd5[_0x6d21('0x41')]['id']}})[_0x6d21('0x3d')](handleEntityNotFound(_0x4b30c0,null))[_0x6d21('0x3d')](saveUpdates(_0x17abd5[_0x6d21('0x46')],null))[_0x6d21('0x3d')](respondWithResult(_0x4b30c0,null))[_0x6d21('0x44')](handleError(_0x4b30c0,null));};exports[_0x6d21('0x23')]=function(_0x4730c,_0x39d410){return db[_0x6d21('0x28')][_0x6d21('0x47')]({'where':{'id':_0x4730c[_0x6d21('0x41')]['id']}})['then'](handleEntityNotFound(_0x39d410,null))[_0x6d21('0x3d')](removeEntity(_0x39d410,null))[_0x6d21('0x44')](handleError(_0x39d410,null));};exports[_0x6d21('0x48')]=function(_0x23bc1f,_0x315c9c,_0x7d1172){var _0x555378={};var _0x7ba568={};var _0x15ddf1;var _0x5deae2;return db[_0x6d21('0x28')][_0x6d21('0x49')]({'where':{'id':_0x23bc1f['params']['id']}})['then'](handleEntityNotFound(_0x315c9c,null))[_0x6d21('0x3d')](function(_0xf73e2a){if(_0xf73e2a){_0x15ddf1=_0xf73e2a;_0x7ba568['model']=_[_0x6d21('0x2e')](db[_0x6d21('0x4a')][_0x6d21('0x29')]);_0x7ba568['query']=_[_0x6d21('0x2e')](_0x23bc1f[_0x6d21('0x2f')]);_0x7ba568['filters']=_[_0x6d21('0x31')](_0x7ba568[_0x6d21('0x33')],_0x7ba568[_0x6d21('0x2f')]);_0x555378[_0x6d21('0x32')]=_['intersection'](_0x7ba568['model'],qs[_0x6d21('0x42')](_0x23bc1f[_0x6d21('0x2f')]['fields']));_0x555378['attributes']=_0x555378[_0x6d21('0x32')][_0x6d21('0x34')]?_0x555378['attributes']:_0x7ba568[_0x6d21('0x33')];_0x555378[_0x6d21('0x35')]=qs[_0x6d21('0x36')](_0x23bc1f[_0x6d21('0x2f')][_0x6d21('0x36')]);_0x555378['where']=qs[_0x6d21('0x30')](_[_0x6d21('0x37')](_0x23bc1f[_0x6d21('0x2f')],_0x7ba568[_0x6d21('0x30')]));if(_0x23bc1f[_0x6d21('0x2f')][_0x6d21('0x38')]){_0x555378[_0x6d21('0x39')]=_[_0x6d21('0x3b')](_0x555378[_0x6d21('0x39')],{'$or':_[_0x6d21('0x2d')](_0x555378[_0x6d21('0x32')],function(_0x2862b6){var _0x1da1cf={};_0x1da1cf[_0x2862b6]={'$like':'%'+_0x23bc1f[_0x6d21('0x2f')][_0x6d21('0x38')]+'%'};return _0x1da1cf;})});}_0x555378=_[_0x6d21('0x3b')]({},_0x555378,_0x23bc1f[_0x6d21('0x3c')]);return _0x15ddf1[_0x6d21('0x48')](_0x555378);}})[_0x6d21('0x3d')](function(_0x3978fa){if(_0x3978fa){_0x5deae2=_0x3978fa[_0x6d21('0x34')];if(!_0x23bc1f[_0x6d21('0x2f')][_0x6d21('0x4b')](_0x6d21('0x4c'))){_0x555378[_0x6d21('0x1e')]=qs['limit'](_0x23bc1f['query'][_0x6d21('0x1e')]);_0x555378[_0x6d21('0x1c')]=qs[_0x6d21('0x1c')](_0x23bc1f[_0x6d21('0x2f')][_0x6d21('0x1c')]);}return _0x15ddf1[_0x6d21('0x48')](_0x555378);}})[_0x6d21('0x3d')](function(_0x2d1298){if(_0x2d1298){return _0x2d1298?{'count':_0x5deae2,'rows':_0x2d1298}:null;}})[_0x6d21('0x3d')](respondWithResult(_0x315c9c,null))[_0x6d21('0x44')](handleError(_0x315c9c,null));};exports[_0x6d21('0x4d')]=function(_0x5c8db4,_0x5e8f5a,_0x198c30){if(_0x5c8db4[_0x6d21('0x46')]['id']){delete _0x5c8db4[_0x6d21('0x46')]['id'];}return db[_0x6d21('0x28')]['findOne']({'where':{'id':_0x5c8db4[_0x6d21('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e8f5a,null))[_0x6d21('0x3d')](function(_0x48c2fe){if(_0x48c2fe){_0x5c8db4[_0x6d21('0x46')][_0x6d21('0x4e')]=_0x48c2fe['id'];_0x5c8db4[_0x6d21('0x46')]['Subjects']=integrations[_0x6d21('0x4f')](_0x5c8db4[_0x6d21('0x46')]['channel'],_0x5c8db4[_0x6d21('0x46')][_0x6d21('0x2b')]);_0x5c8db4[_0x6d21('0x46')][_0x6d21('0x50')]=integrations['getDescriptions'](_0x5c8db4['body']['channel'],_0x5c8db4[_0x6d21('0x46')][_0x6d21('0x2b')]);return db[_0x6d21('0x4a')]['create'](_0x5c8db4[_0x6d21('0x46')],{'include':[{'model':db[_0x6d21('0x51')],'as':'Subjects'},{'model':db[_0x6d21('0x51')],'as':_0x6d21('0x50')}]});}return null;})[_0x6d21('0x3d')](respondWithResult(_0x5e8f5a,null))[_0x6d21('0x44')](handleError(_0x5e8f5a,null));};exports[_0x6d21('0x52')]=function(_0x31eb05,_0x4dec39,_0x3aca7d){var _0x1cfae3=[_0x6d21('0x53'),_0x6d21('0x54'),_0x6d21('0x55'),_0x6d21('0x56'),_0x6d21('0x57'),_0x6d21('0x58'),_0x6d21('0x59'),_0x6d21('0x5a'),_0x6d21('0x5b')];var _0x411845=[_0x6d21('0x5c'),_0x6d21('0x53'),_0x6d21('0x5d'),_0x6d21('0x5e'),_0x6d21('0x5f'),_0x6d21('0x60'),'child_incidents',_0x6d21('0x54'),_0x6d21('0x61'),'number',_0x6d21('0x62'),'sys_updated_by','opened_by',_0x6d21('0x63'),_0x6d21('0x64'),'sys_domain',_0x6d21('0x65'),_0x6d21('0x66'),'knowledge','order','calendar_stc',_0x6d21('0x67'),_0x6d21('0x68'),_0x6d21('0x69'),_0x6d21('0x6a'),_0x6d21('0x6b'),_0x6d21('0x6c'),'business_service',_0x6d21('0x6d'),_0x6d21('0x6e'),_0x6d21('0x6f'),_0x6d21('0x70'),_0x6d21('0x71'),_0x6d21('0x72'),_0x6d21('0x73'),_0x6d21('0x74'),_0x6d21('0x75'),_0x6d21('0x76'),_0x6d21('0x77'),_0x6d21('0x78'),'approval_set',_0x6d21('0x56'),_0x6d21('0x79'),_0x6d21('0x7a'),_0x6d21('0x57'),_0x6d21('0x7b'),_0x6d21('0x7c'),'work_start','assignment_group',_0x6d21('0x7d'),_0x6d21('0x7e'),'description','calendar_duration',_0x6d21('0x58'),_0x6d21('0x7f'),'close_notes','closed_by',_0x6d21('0x80'),_0x6d21('0x81'),_0x6d21('0x82'),_0x6d21('0x83'),_0x6d21('0x84'),'incident_state',_0x6d21('0x85'),'problem_id',_0x6d21('0x86'),_0x6d21('0x87'),_0x6d21('0x88'),_0x6d21('0x89'),'severity',_0x6d21('0x8a'),'sla_due',_0x6d21('0x8b'),_0x6d21('0x8c'),_0x6d21('0x8d'),_0x6d21('0x8e'),_0x6d21('0x8f'),_0x6d21('0x90'),'escalation',_0x6d21('0x91'),_0x6d21('0x92'),_0x6d21('0x93'),_0x6d21('0x5b')];var _0x4833b7='';var _0xab7a20='';var _0x1f12cc=[];var _0x35a855='';var _0x22cea0='';var _0x3adff8=[];var _0x136412='';var _0x978010='';var _0x1f635a={};var _0x30c1b2='';return db[_0x6d21('0x28')]['findOne']({'where':{'id':_0x31eb05[_0x6d21('0x41')]['id']},'attributes':['id',_0x6d21('0x94'),'password','email','remoteUri',_0x6d21('0x95')]})[_0x6d21('0x3d')](handleEntityNotFound(_0x4dec39,null))['then'](function(_0x253307){if(_0x253307){_0x30c1b2=_0x253307[_0x6d21('0x96')];var _0x38ffc5=_0x30c1b2[_0x6d21('0x97')](-0x1);if(_0x38ffc5==='/'){_0x30c1b2=_0x30c1b2['substring'](0x0,_0x30c1b2[_0x6d21('0x98')](_0x38ffc5));}_0x978010=util['format'](_0x6d21('0x99'),_0x30c1b2);_0x136412=util[_0x6d21('0x9a')]('%s/api/now/table/',_0x30c1b2);_0x1f635a={'user':_0x253307['username'],'pass':_0x253307[_0x6d21('0x9b')]};var _0x3e1ae8={'method':_0x6d21('0x9c'),'uri':_0x978010+_0x6d21('0x9d'),'auth':_0x1f635a,'json':!![]};return rp(_0x3e1ae8);}})[_0x6d21('0x3d')](function(_0x231967){if(_0x231967[_0x6d21('0x9e')][_0x6d21('0x34')]>0x0){_0x4833b7=_0x231967[_0x6d21('0x9e')];}console[_0x6d21('0x9f')](_0x6d21('0xa0'),_0x4833b7);_0x3adff8=[];_0xab7a20=Object[_0x6d21('0xa1')]([],_0x4833b7);_['remove'](_0xab7a20,function(_0x43844d){return!_0x1cfae3[_0x6d21('0xa2')](_0x43844d['name']);});_0xab7a20[_0x6d21('0xa3')](function(_0x48a452){var _0x31328f=createFieldObject(_0x136412,_0x1f635a,_0x48a452[_0x6d21('0xa4')],_0x48a452['name'],_0x48a452[_0x6d21('0xa5')],![]);_0x3adff8['push'](_0x31328f);});return Promise[_0x6d21('0xa6')](_0x3adff8);})[_0x6d21('0x3d')](function(_0x3b0d17){_0x1f12cc=_0x3b0d17;_0x35a855=Object[_0x6d21('0xa1')]([],_0x4833b7);console[_0x6d21('0x9f')](_0x6d21('0xa7'),_0x4833b7);_['remove'](_0x35a855,function(_0x565ad8){return _0x411845[_0x6d21('0xa2')](_0x565ad8[_0x6d21('0x26')]);});console['log'](_0x6d21('0xa8'),_0x35a855);_0x3adff8=[];_0x35a855[_0x6d21('0xa3')](function(_0x67a31){var _0x4d3869=createFieldObject(_0x136412,_0x1f635a,_0x67a31[_0x6d21('0xa4')],_0x67a31['name'],_0x67a31[_0x6d21('0xa5')],!![]);_0x3adff8[_0x6d21('0xa9')](_0x4d3869);});return Promise[_0x6d21('0xa6')](_0x3adff8);})[_0x6d21('0x3d')](function(_0x112652){_0x22cea0=_0x112652;var _0x3d24d3=_0x1f12cc[_0x6d21('0xaa')](_0x22cea0);return{'count':_0x3d24d3[_0x6d21('0x34')],'rows':_0x3d24d3};})[_0x6d21('0x3d')](respondWithResult(_0x4dec39,null))[_0x6d21('0x44')](function(_0x50019c){console[_0x6d21('0x9f')](_0x6d21('0xab')+_0x50019c);var _0x35b1d3=_0x31eb05[_0x6d21('0x2f')][_0x6d21('0xac')]?0x1f4:_0x50019c[_0x6d21('0xad')]||0x1f4;logger['error'](_0x50019c[_0x6d21('0xae')]);delete _0x50019c['name'];if(_0x35b1d3===0x191){_0x35b1d3=0x190;}_0x4dec39[_0x6d21('0x1b')](_0x35b1d3)[_0x6d21('0xaf')](_0x31eb05['query'][_0x6d21('0xac')]?{'message':_0x6d21('0xb0'),'statusCode':_0x50019c[_0x6d21('0xad')]}:_0x50019c);});};function createFieldObject(_0x563569,_0x4382bd,_0x31e42e,_0x367b9b,_0x3d7eb0,_0x3a7988){return new Promise(function(_0x214e7d,_0x12fc50){var _0x24a7a2={'id':_0x367b9b,'name':_0x3d7eb0,'custom':_0x3a7988};if(_0x31e42e==='boolean'){_0x24a7a2[_0x6d21('0x3c')]=[{'name':_0x6d21('0xb1'),'value':'true'},{'name':_0x6d21('0xb2'),'value':_0x6d21('0xb3')}];_0x214e7d(_0x24a7a2);}else{var _0x42ce42={'method':'GET','uri':_0x563569+_0x6d21('0xb4')+_0x367b9b,'auth':_0x4382bd,'json':!![]};return rp(_0x42ce42)['then'](function(_0x39e50f){var _0x59bb37=[];if(_0x39e50f[_0x6d21('0x9e')][_0x6d21('0x34')]>0x0){_0x39e50f[_0x6d21('0x9e')][_0x6d21('0xa3')](function(_0x15d3b6){if(_0x15d3b6[_0x6d21('0xb5')]===_0x6d21('0xb3')){var _0x39c550={'name':_0x15d3b6[_0x6d21('0xa5')],'value':_0x15d3b6[_0x6d21('0xb6')]};_0x59bb37[_0x6d21('0xa9')](_0x39c550);}});}_0x24a7a2['options']=_0x59bb37;if(_0x24a7a2['options']['length']>0x0){_0x214e7d(_0x24a7a2);}else{if(_0x3a7988==![]){_0x214e7d();}else{_0x214e7d(_0x24a7a2);}}});}});} \ No newline at end of file +var _0x98f2=['approval','comments_and_work_notes','reopen_count','sys_tags','escalation','upon_approval','username','remoteUri','serverUrl','slice','substring','lastIndexOf','password','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','internalType','label','push','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','send','test','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','sort','filter','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','type','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','child_incidents','hold_reason','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','closed_at','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','rfc','opened_at','business_duration','work_end','reopened_time','approval_set','work_notes','correlation_display','work_start','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','comments','sla_due'];(function(_0x259340,_0x5d0892){var _0x5ec900=function(_0xad5d1a){while(--_0xad5d1a){_0x259340['push'](_0x259340['shift']());}};_0x5ec900(++_0x5d0892);}(_0x98f2,0x18d));var _0x298f=function(_0x3c252e,_0x5f240c){_0x3c252e=_0x3c252e-0x0;var _0x52897f=_0x98f2[_0x3c252e];return _0x52897f;};'use strict';var emlformat=require(_0x298f('0x0'));var rimraf=require(_0x298f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x298f('0x2'));var rp=require('request-promise');var moment=require(_0x298f('0x3'));var BPromise=require(_0x298f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x298f('0x5'));var sox=require(_0x298f('0x6'));var csv=require(_0x298f('0x7'));var ejs=require(_0x298f('0x8'));var fs=require('fs');var fs_extra=require(_0x298f('0x9'));var _=require(_0x298f('0xa'));var squel=require(_0x298f('0xb'));var crypto=require(_0x298f('0xc'));var jsforce=require(_0x298f('0xd'));var deskjs=require(_0x298f('0xe'));var toCsv=require(_0x298f('0x7'));var querystring=require(_0x298f('0xf'));var Papa=require(_0x298f('0x10'));var Redis=require('ioredis');var authService=require(_0x298f('0x11'));var qs=require(_0x298f('0x12'));var as=require(_0x298f('0x13'));var hardwareService=require(_0x298f('0x14'));var logger=require(_0x298f('0x15'))(_0x298f('0x16'));var utils=require(_0x298f('0x17'));var config=require(_0x298f('0x18'));var licenseUtil=require(_0x298f('0x19'));var db=require(_0x298f('0x1a'))['db'];var integrations=require(_0x298f('0x1b'));function respondWithStatusCode(_0x559bcb,_0x508d72){_0x508d72=_0x508d72||0xcc;return function(_0x974233){if(_0x974233){return _0x559bcb['sendStatus'](_0x508d72);}return _0x559bcb[_0x298f('0x1c')](_0x508d72)['end']();};}function respondWithResult(_0x4d6cc8,_0x24629a){_0x24629a=_0x24629a||0xc8;return function(_0x55429d){if(_0x55429d){return _0x4d6cc8[_0x298f('0x1c')](_0x24629a)[_0x298f('0x1d')](_0x55429d);}};}function respondWithFilteredResult(_0x1bbf1d,_0x2f6436){return function(_0xa02a7b){if(_0xa02a7b){var _0x5a3701=typeof _0x2f6436[_0x298f('0x1e')]==='undefined'&&typeof _0x2f6436[_0x298f('0x1f')]===_0x298f('0x20');var _0x553cf8=_0xa02a7b['count'];var _0x164489=_0x5a3701?0x0:_0x2f6436[_0x298f('0x1e')];var _0x4fb159=_0x5a3701?_0xa02a7b[_0x298f('0x21')]:_0x2f6436[_0x298f('0x1e')]+_0x2f6436['limit'];var _0x1b86e2;if(_0x4fb159>=_0x553cf8){_0x4fb159=_0x553cf8;_0x1b86e2=0xc8;}else{_0x1b86e2=0xce;}_0x1bbf1d[_0x298f('0x1c')](_0x1b86e2);return _0x1bbf1d[_0x298f('0x22')](_0x298f('0x23'),_0x164489+'-'+_0x4fb159+'/'+_0x553cf8)[_0x298f('0x1d')](_0xa02a7b);}return null;};}function patchUpdates(_0x33200f){return function(_0x3d0388){try{jsonpatch[_0x298f('0x24')](_0x3d0388,_0x33200f,!![]);}catch(_0x5263b9){return BPromise[_0x298f('0x25')](_0x5263b9);}return _0x3d0388['save']();};}function saveUpdates(_0x42e21c,_0x3409f9){return function(_0x2b32f3){if(_0x2b32f3){return _0x2b32f3[_0x298f('0x26')](_0x42e21c)['then'](function(_0x50c915){return _0x50c915;});}return null;};}function removeEntity(_0x1f9b41,_0x9c9792){return function(_0x78813d){if(_0x78813d){return _0x78813d[_0x298f('0x27')]()[_0x298f('0x28')](function(){_0x1f9b41[_0x298f('0x1c')](0xcc)[_0x298f('0x29')]();});}};}function handleEntityNotFound(_0x4cca45,_0x76a9f2){return function(_0x39a02b){if(!_0x39a02b){_0x4cca45[_0x298f('0x2a')](0x194);}return _0x39a02b;};}function handleError(_0x5b0a41,_0x5e6045){_0x5e6045=_0x5e6045||0x1f4;return function(_0x310459){logger[_0x298f('0x2b')](_0x310459[_0x298f('0x2c')]);if(_0x310459[_0x298f('0x2d')]){delete _0x310459[_0x298f('0x2d')];}_0x5b0a41[_0x298f('0x1c')](_0x5e6045)['send'](_0x310459);};}exports[_0x298f('0x2e')]=function(_0x2b1544,_0x2afc43){var _0x1c3786={},_0x271270={},_0x25beb1={'count':0x0,'rows':[]};var _0x5ea864=_[_0x298f('0x2f')](db[_0x298f('0x30')][_0x298f('0x31')],function(_0x377012){return{'name':_0x377012[_0x298f('0x32')],'type':_0x377012['type']['key']};});_0x271270[_0x298f('0x33')]=_[_0x298f('0x2f')](_0x5ea864,_0x298f('0x2d'));_0x271270['query']=_[_0x298f('0x34')](_0x2b1544[_0x298f('0x35')]);_0x271270[_0x298f('0x36')]=_[_0x298f('0x37')](_0x271270[_0x298f('0x33')],_0x271270[_0x298f('0x35')]);_0x1c3786[_0x298f('0x38')]=_[_0x298f('0x37')](_0x271270[_0x298f('0x33')],qs['fields'](_0x2b1544[_0x298f('0x35')][_0x298f('0x39')]));_0x1c3786[_0x298f('0x38')]=_0x1c3786[_0x298f('0x38')][_0x298f('0x3a')]?_0x1c3786[_0x298f('0x38')]:_0x271270['model'];if(!_0x2b1544[_0x298f('0x35')]['hasOwnProperty']('nolimit')){_0x1c3786[_0x298f('0x1f')]=qs['limit'](_0x2b1544['query']['limit']);_0x1c3786[_0x298f('0x1e')]=qs[_0x298f('0x1e')](_0x2b1544[_0x298f('0x35')][_0x298f('0x1e')]);}_0x1c3786[_0x298f('0x3b')]=qs['sort'](_0x2b1544[_0x298f('0x35')]['sort']);_0x1c3786[_0x298f('0x3c')]=qs[_0x298f('0x36')](_[_0x298f('0x3d')](_0x2b1544[_0x298f('0x35')],_0x271270[_0x298f('0x36')]),_0x5ea864);if(_0x2b1544[_0x298f('0x35')]['filter']){_0x1c3786[_0x298f('0x3c')]=_[_0x298f('0x3e')](_0x1c3786[_0x298f('0x3c')],{'$or':_[_0x298f('0x2f')](_0x5ea864,function(_0x45dfbe){if(_0x45dfbe['type']!==_0x298f('0x3f')){var _0x38810b={};_0x38810b[_0x45dfbe[_0x298f('0x2d')]]={'$like':'%'+_0x2b1544[_0x298f('0x35')]['filter']+'%'};return _0x38810b;}})});}_0x1c3786=_[_0x298f('0x3e')]({},_0x1c3786,_0x2b1544[_0x298f('0x40')]);var _0xe19c84={'where':_0x1c3786[_0x298f('0x3c')]};return db[_0x298f('0x30')]['count'](_0xe19c84)[_0x298f('0x28')](function(_0xf553dc){_0x25beb1['count']=_0xf553dc;if(_0x2b1544[_0x298f('0x35')][_0x298f('0x41')]){_0x1c3786[_0x298f('0x42')]=[{'all':!![]}];}return db[_0x298f('0x30')][_0x298f('0x43')](_0x1c3786);})[_0x298f('0x28')](function(_0x1d4356){_0x25beb1[_0x298f('0x44')]=_0x1d4356;return _0x25beb1;})[_0x298f('0x28')](respondWithFilteredResult(_0x2afc43,_0x1c3786))['catch'](handleError(_0x2afc43,null));};exports['show']=function(_0x2f2cba,_0x464289){var _0x1ec81a={'raw':![],'where':{'id':_0x2f2cba[_0x298f('0x45')]['id']}},_0x559572={};_0x559572[_0x298f('0x33')]=_[_0x298f('0x34')](db['ServicenowAccount'][_0x298f('0x31')]);_0x559572[_0x298f('0x35')]=_['keys'](_0x2f2cba[_0x298f('0x35')]);_0x559572[_0x298f('0x36')]=_[_0x298f('0x37')](_0x559572['model'],_0x559572[_0x298f('0x35')]);_0x1ec81a[_0x298f('0x38')]=_['intersection'](_0x559572['model'],qs[_0x298f('0x39')](_0x2f2cba[_0x298f('0x35')][_0x298f('0x39')]));_0x1ec81a[_0x298f('0x38')]=_0x1ec81a[_0x298f('0x38')][_0x298f('0x3a')]?_0x1ec81a[_0x298f('0x38')]:_0x559572[_0x298f('0x33')];if(_0x2f2cba[_0x298f('0x35')][_0x298f('0x41')]){_0x1ec81a[_0x298f('0x42')]=[{'all':!![]}];}_0x1ec81a=_[_0x298f('0x3e')]({},_0x1ec81a,_0x2f2cba['options']);return db[_0x298f('0x30')][_0x298f('0x46')](_0x1ec81a)['then'](handleEntityNotFound(_0x464289,null))[_0x298f('0x28')](respondWithResult(_0x464289,null))[_0x298f('0x47')](handleError(_0x464289,null));};exports[_0x298f('0x48')]=function(_0x2e8ab4,_0x380d4e){return db[_0x298f('0x30')][_0x298f('0x48')](_0x2e8ab4[_0x298f('0x49')],{})[_0x298f('0x28')](respondWithResult(_0x380d4e,0xc9))[_0x298f('0x47')](handleError(_0x380d4e,null));};exports[_0x298f('0x26')]=function(_0x4db3ce,_0x38a4c1){if(_0x4db3ce[_0x298f('0x49')]['id']){delete _0x4db3ce[_0x298f('0x49')]['id'];}return db[_0x298f('0x30')][_0x298f('0x46')]({'where':{'id':_0x4db3ce['params']['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x38a4c1,null))[_0x298f('0x28')](saveUpdates(_0x4db3ce['body'],null))[_0x298f('0x28')](respondWithResult(_0x38a4c1,null))['catch'](handleError(_0x38a4c1,null));};exports['destroy']=function(_0x471d41,_0x7ca100){return db[_0x298f('0x30')][_0x298f('0x46')]({'where':{'id':_0x471d41[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x7ca100,null))[_0x298f('0x28')](removeEntity(_0x7ca100,null))[_0x298f('0x47')](handleError(_0x7ca100,null));};exports[_0x298f('0x4a')]=function(_0x43df03,_0x39abec,_0x31d418){var _0x595ed3={};var _0x3676ae={};var _0x587259;var _0x48a2eb;return db[_0x298f('0x30')][_0x298f('0x4b')]({'where':{'id':_0x43df03[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x39abec,null))[_0x298f('0x28')](function(_0x556608){if(_0x556608){_0x587259=_0x556608;_0x3676ae[_0x298f('0x33')]=_['keys'](db[_0x298f('0x4c')][_0x298f('0x31')]);_0x3676ae[_0x298f('0x35')]=_[_0x298f('0x34')](_0x43df03[_0x298f('0x35')]);_0x3676ae[_0x298f('0x36')]=_['intersection'](_0x3676ae[_0x298f('0x33')],_0x3676ae[_0x298f('0x35')]);_0x595ed3[_0x298f('0x38')]=_[_0x298f('0x37')](_0x3676ae[_0x298f('0x33')],qs['fields'](_0x43df03['query'][_0x298f('0x39')]));_0x595ed3[_0x298f('0x38')]=_0x595ed3[_0x298f('0x38')][_0x298f('0x3a')]?_0x595ed3[_0x298f('0x38')]:_0x3676ae['model'];_0x595ed3[_0x298f('0x3b')]=qs['sort'](_0x43df03['query'][_0x298f('0x4d')]);_0x595ed3[_0x298f('0x3c')]=qs['filters'](_[_0x298f('0x3d')](_0x43df03[_0x298f('0x35')],_0x3676ae[_0x298f('0x36')]));if(_0x43df03['query'][_0x298f('0x4e')]){_0x595ed3[_0x298f('0x3c')]=_[_0x298f('0x3e')](_0x595ed3[_0x298f('0x3c')],{'$or':_[_0x298f('0x2f')](_0x595ed3[_0x298f('0x38')],function(_0x504b50){var _0x55cb17={};_0x55cb17[_0x504b50]={'$like':'%'+_0x43df03['query']['filter']+'%'};return _0x55cb17;})});}_0x595ed3=_[_0x298f('0x3e')]({},_0x595ed3,_0x43df03['options']);return _0x587259[_0x298f('0x4a')](_0x595ed3);}})[_0x298f('0x28')](function(_0x3b552b){if(_0x3b552b){_0x48a2eb=_0x3b552b['length'];if(!_0x43df03[_0x298f('0x35')]['hasOwnProperty'](_0x298f('0x4f'))){_0x595ed3[_0x298f('0x1f')]=qs[_0x298f('0x1f')](_0x43df03[_0x298f('0x35')][_0x298f('0x1f')]);_0x595ed3['offset']=qs[_0x298f('0x1e')](_0x43df03[_0x298f('0x35')]['offset']);}return _0x587259[_0x298f('0x4a')](_0x595ed3);}})[_0x298f('0x28')](function(_0x1f12bc){if(_0x1f12bc){return _0x1f12bc?{'count':_0x48a2eb,'rows':_0x1f12bc}:null;}})['then'](respondWithResult(_0x39abec,null))[_0x298f('0x47')](handleError(_0x39abec,null));};exports[_0x298f('0x50')]=function(_0x79aa07,_0x22a6b4,_0x2bbe77){if(_0x79aa07[_0x298f('0x49')]['id']){delete _0x79aa07['body']['id'];}return db['ServicenowAccount'][_0x298f('0x4b')]({'where':{'id':_0x79aa07[_0x298f('0x45')]['id']}})[_0x298f('0x28')](handleEntityNotFound(_0x22a6b4,null))['then'](function(_0x2055e5){if(_0x2055e5){_0x79aa07['body'][_0x298f('0x51')]=_0x2055e5['id'];_0x79aa07[_0x298f('0x49')][_0x298f('0x52')]=integrations['getSubjects'](_0x79aa07[_0x298f('0x49')][_0x298f('0x53')],_0x79aa07['body']['type']);_0x79aa07[_0x298f('0x49')]['Descriptions']=integrations[_0x298f('0x54')](_0x79aa07[_0x298f('0x49')][_0x298f('0x53')],_0x79aa07[_0x298f('0x49')][_0x298f('0x55')]);return db[_0x298f('0x4c')]['create'](_0x79aa07[_0x298f('0x49')],{'include':[{'model':db[_0x298f('0x56')],'as':_0x298f('0x52')},{'model':db[_0x298f('0x56')],'as':_0x298f('0x57')}]});}return null;})[_0x298f('0x28')](respondWithResult(_0x22a6b4,null))[_0x298f('0x47')](handleError(_0x22a6b4,null));};exports[_0x298f('0x58')]=function(_0x2d8d83,_0x36e784,_0x433751){var _0x35e72b=[_0x298f('0x59'),'hold_reason',_0x298f('0x5a'),_0x298f('0x5b'),_0x298f('0x5c'),_0x298f('0x5d'),_0x298f('0x5e'),_0x298f('0x5f'),_0x298f('0x60')];var _0x3a9f80=[_0x298f('0x61'),_0x298f('0x59'),_0x298f('0x62'),'watch_list','upon_reject','sys_updated_on',_0x298f('0x63'),_0x298f('0x64'),'approval_history',_0x298f('0x65'),_0x298f('0x66'),_0x298f('0x67'),_0x298f('0x68'),_0x298f('0x69'),_0x298f('0x6a'),_0x298f('0x6b'),_0x298f('0x6c'),'sys_created_by',_0x298f('0x5a'),_0x298f('0x3b'),'calendar_stc',_0x298f('0x6d'),_0x298f('0x6e'),'delivery_plan',_0x298f('0x6f'),'active',_0x298f('0x70'),_0x298f('0x71'),'priority',_0x298f('0x72'),_0x298f('0x73'),'time_worked','expected_start',_0x298f('0x74'),_0x298f('0x75'),'group_list',_0x298f('0x76'),_0x298f('0x77'),'resolved_at','caller_id',_0x298f('0x78'),'subcategory',_0x298f('0x79'),'short_description',_0x298f('0x5c'),_0x298f('0x7a'),'delivery_task',_0x298f('0x7b'),'assignment_group',_0x298f('0x7c'),'additional_assignee_list',_0x298f('0x7d'),_0x298f('0x7e'),_0x298f('0x5d'),_0x298f('0x7f'),_0x298f('0x80'),_0x298f('0x81'),_0x298f('0x82'),_0x298f('0x83'),_0x298f('0x84'),_0x298f('0x85'),_0x298f('0x86'),_0x298f('0x5e'),_0x298f('0x87'),_0x298f('0x88'),'company',_0x298f('0x89'),'activity_due','assigned_to',_0x298f('0x5f'),_0x298f('0x8a'),_0x298f('0x8b'),_0x298f('0x8c'),_0x298f('0x8d'),'due_date','sys_mod_count',_0x298f('0x8e'),_0x298f('0x8f'),_0x298f('0x90'),_0x298f('0x91'),'correlation_id','location',_0x298f('0x60')];var _0x1775b3='';var _0x5d9924='';var _0x3fde42=[];var _0x3192fd='';var _0x530bd7='';var _0x44f3a5=[];var _0x329f22='';var _0x53b3c6='';var _0x1976ec={};var _0x233671='';return db[_0x298f('0x30')][_0x298f('0x4b')]({'where':{'id':_0x2d8d83['params']['id']},'attributes':['id',_0x298f('0x92'),'password','email',_0x298f('0x93'),_0x298f('0x94')]})['then'](handleEntityNotFound(_0x36e784,null))['then'](function(_0x5bd625){if(_0x5bd625){_0x233671=_0x5bd625[_0x298f('0x93')];var _0x37676c=_0x233671[_0x298f('0x95')](-0x1);if(_0x37676c==='/'){_0x233671=_0x233671[_0x298f('0x96')](0x0,_0x233671[_0x298f('0x97')](_0x37676c));}_0x53b3c6=util['format']('%s/api/now/doc/table/schema/',_0x233671);_0x329f22=util['format']('%s/api/now/table/',_0x233671);_0x1976ec={'user':_0x5bd625[_0x298f('0x92')],'pass':_0x5bd625[_0x298f('0x98')]};var _0x3f2622={'method':_0x298f('0x99'),'uri':_0x53b3c6+_0x298f('0x9a'),'auth':_0x1976ec,'json':!![]};return rp(_0x3f2622);}})['then'](function(_0x51a229){if(_0x51a229[_0x298f('0x9b')][_0x298f('0x3a')]>0x0){_0x1775b3=_0x51a229[_0x298f('0x9b')];}console['log']('incident\x20table\x20objects',_0x1775b3);_0x44f3a5=[];_0x5d9924=Object[_0x298f('0x9c')]([],_0x1775b3);_['remove'](_0x5d9924,function(_0x190cb3){return!_0x35e72b[_0x298f('0x9d')](_0x190cb3[_0x298f('0x2d')]);});_0x5d9924[_0x298f('0x9e')](function(_0x4dfdd5){var _0x447bdb=createFieldObject(_0x329f22,_0x1976ec,_0x4dfdd5[_0x298f('0x9f')],_0x4dfdd5[_0x298f('0x2d')],_0x4dfdd5[_0x298f('0xa0')],![]);_0x44f3a5[_0x298f('0xa1')](_0x447bdb);});return Promise[_0x298f('0xa2')](_0x44f3a5);})[_0x298f('0x28')](function(_0x5d1dbe){_0x3fde42=_0x5d1dbe;_0x3192fd=Object['assign']([],_0x1775b3);console[_0x298f('0xa3')](_0x298f('0xa4'),_0x1775b3);_[_0x298f('0xa5')](_0x3192fd,function(_0x5766f9){return _0x3a9f80['includes'](_0x5766f9[_0x298f('0x2d')]);});console[_0x298f('0xa3')](_0x298f('0xa6'),_0x3192fd);_0x44f3a5=[];_0x3192fd[_0x298f('0x9e')](function(_0x2e85d7){var _0x5bb48d=createFieldObject(_0x329f22,_0x1976ec,_0x2e85d7[_0x298f('0x9f')],_0x2e85d7[_0x298f('0x2d')],_0x2e85d7['label'],!![]);_0x44f3a5[_0x298f('0xa1')](_0x5bb48d);});return Promise['all'](_0x44f3a5);})[_0x298f('0x28')](function(_0x28f1f5){_0x530bd7=_0x28f1f5;var _0x10980f=_0x3fde42[_0x298f('0xa7')](_0x530bd7);return{'count':_0x10980f['length'],'rows':_0x10980f};})[_0x298f('0x28')](respondWithResult(_0x36e784,null))[_0x298f('0x47')](function(_0x5948bf){console[_0x298f('0xa3')](_0x298f('0xa8')+_0x5948bf);var _0x5ab484=_0x2d8d83['query']['test']?0x1f4:_0x5948bf[_0x298f('0xa9')]||0x1f4;logger[_0x298f('0x2b')](_0x5948bf[_0x298f('0x2c')]);delete _0x5948bf['name'];if(_0x5ab484===0x191){_0x5ab484=0x190;}_0x36e784[_0x298f('0x1c')](_0x5ab484)[_0x298f('0xaa')](_0x2d8d83['query'][_0x298f('0xab')]?{'message':_0x298f('0xac'),'statusCode':_0x5948bf['statusCode']}:_0x5948bf);});};function createFieldObject(_0x1bab76,_0x4302b3,_0x44c932,_0x2bdcc2,_0xbef4e1,_0xdcf444){return new Promise(function(_0x210348,_0x91f1f4){var _0x18787b={'id':_0x2bdcc2,'name':_0xbef4e1,'custom':_0xdcf444};if(_0x44c932===_0x298f('0xad')){_0x18787b['options']=[{'name':'True','value':_0x298f('0xae')},{'name':_0x298f('0xaf'),'value':_0x298f('0xb0')}];_0x210348(_0x18787b);}else{var _0x1bd3e2={'method':'GET','uri':_0x1bab76+_0x298f('0xb1')+_0x2bdcc2,'auth':_0x4302b3,'json':!![]};return rp(_0x1bd3e2)[_0x298f('0x28')](function(_0x15abaa){var _0x63bae5=[];if(_0x15abaa['result']['length']>0x0){_0x15abaa['result'][_0x298f('0x9e')](function(_0x56e60e){if(_0x56e60e[_0x298f('0xb2')]===_0x298f('0xb0')){var _0x903b4d={'name':_0x56e60e[_0x298f('0xa0')],'value':_0x56e60e['value']};_0x63bae5[_0x298f('0xa1')](_0x903b4d);}});}_0x18787b[_0x298f('0x40')]=_0x63bae5;if(_0x18787b[_0x298f('0x40')][_0x298f('0x3a')]>0x0){_0x210348(_0x18787b);}else{if(_0xdcf444==![]){_0x210348();}else{_0x210348(_0x18787b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 54152ab..9ab1b01 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x5fc3[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));var integrations=require(_0x35fc('0x9'));module['exports']=function(_0x5754be,_0x19a0d1){return _0x5754be['define'](_0x35fc('0xa'),attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x7fbe[_0x3f3f06];return _0x140feb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'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 bc711a3..1d17aa9 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 _0xd893=['ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','info','GetServicenowAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x57ff0d,_0x1e9fb1){var _0x1ad30b=function(_0x3d2fdb){while(--_0x3d2fdb){_0x57ff0d['push'](_0x57ff0d['shift']());}};_0x1ad30b(++_0x1e9fb1);}(_0xd893,0x123));var _0x3d89=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd893[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3d89('0x0'));var util=require(_0x3d89('0x1'));var moment=require(_0x3d89('0x2'));var BPromise=require(_0x3d89('0x3'));var rs=require(_0x3d89('0x4'));var fs=require('fs');var Redis=require(_0x3d89('0x5'));var db=require(_0x3d89('0x6'))['db'];var utils=require(_0x3d89('0x7'));var logger=require(_0x3d89('0x8'))(_0x3d89('0x9'));var config=require(_0x3d89('0xa'));var jayson=require(_0x3d89('0xb'));var client=jayson[_0x3d89('0xc')][_0x3d89('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4460b8,_0x47be19,_0x574d5a){return new BPromise(function(_0x23ae0a,_0x53b2b7){return client[_0x3d89('0xe')](_0x4460b8,_0x574d5a)[_0x3d89('0xf')](function(_0x50a94a){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x47be19,_0x3d89('0x10'));logger[_0x3d89('0x11')](_0x3d89('0x12'),_0x47be19,_0x3d89('0x10'),JSON[_0x3d89('0x13')](_0x50a94a));if(_0x50a94a[_0x3d89('0x14')]){if(_0x50a94a[_0x3d89('0x14')]['code']===0x1f4){logger['error'](_0x3d89('0x15'),_0x47be19,_0x50a94a['error'][_0x3d89('0x16')]);return _0x53b2b7(_0x50a94a[_0x3d89('0x14')]['message']);}logger[_0x3d89('0x14')](_0x3d89('0x15'),_0x47be19,_0x50a94a[_0x3d89('0x14')][_0x3d89('0x16')]);return _0x23ae0a(_0x50a94a[_0x3d89('0x14')][_0x3d89('0x16')]);}else{logger[_0x3d89('0x17')](_0x3d89('0x15'),_0x47be19,_0x3d89('0x10'));_0x23ae0a(_0x50a94a['result']['message']);}})['catch'](function(_0x12a79e){logger[_0x3d89('0x14')](_0x3d89('0x15'),_0x47be19,_0x12a79e);_0x53b2b7(_0x12a79e);});});}exports[_0x3d89('0x18')]=function(_0x8f54c1){var _0x81cfe3=this;return new Promise(function(_0x5b985a,_0x126cf4){return db['ServicenowAccount'][_0x3d89('0x19')]({'raw':_0x8f54c1[_0x3d89('0x1a')]?_0x8f54c1['options'][_0x3d89('0x1b')]===undefined?!![]:![]:!![],'where':_0x8f54c1['options']?_0x8f54c1[_0x3d89('0x1a')][_0x3d89('0x1c')]||null:null,'attributes':_0x8f54c1[_0x3d89('0x1a')]?_0x8f54c1[_0x3d89('0x1a')][_0x3d89('0x1d')]||null:null,'limit':_0x8f54c1[_0x3d89('0x1a')]?_0x8f54c1[_0x3d89('0x1a')]['limit']||null:null,'include':_0x8f54c1['options']?_0x8f54c1[_0x3d89('0x1a')][_0x3d89('0x1e')]?_[_0x3d89('0x1f')](_0x8f54c1[_0x3d89('0x1a')][_0x3d89('0x1e')],function(_0x35e32a){return{'model':db[_0x35e32a[_0x3d89('0x20')]],'as':_0x35e32a['as'],'attributes':_0x35e32a['attributes'],'include':_0x35e32a['include']?_[_0x3d89('0x1f')](_0x35e32a[_0x3d89('0x1e')],function(_0x1a4f75){return{'model':db[_0x1a4f75[_0x3d89('0x20')]],'as':_0x1a4f75['as'],'attributes':_0x1a4f75[_0x3d89('0x1d')],'include':_0x1a4f75['include']?_[_0x3d89('0x1f')](_0x1a4f75['include'],function(_0xd5d182){return{'model':db[_0xd5d182[_0x3d89('0x20')]],'as':_0xd5d182['as'],'attributes':_0xd5d182[_0x3d89('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d89('0xf')](function(_0x5b96f5){logger[_0x3d89('0x17')](_0x3d89('0x18'),_0x8f54c1);logger['debug'](_0x3d89('0x18'),_0x8f54c1,JSON[_0x3d89('0x13')](_0x5b96f5));_0x5b985a(_0x5b96f5);})['catch'](function(_0x4c5abf){logger[_0x3d89('0x14')](_0x3d89('0x18'),_0x4c5abf[_0x3d89('0x16')],_0x8f54c1);_0x126cf4(_0x81cfe3[_0x3d89('0x14')](0x1f4,_0x4c5abf[_0x3d89('0x16')]));});});};exports[_0x3d89('0x21')]=function(_0x1c785e){var _0x13297d=this;return new Promise(function(_0x3f69a4,_0x597fa4){return db[_0x3d89('0x22')][_0x3d89('0x23')]({'raw':_0x1c785e[_0x3d89('0x1a')]?_0x1c785e[_0x3d89('0x1a')][_0x3d89('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c785e[_0x3d89('0x1a')]?_0x1c785e[_0x3d89('0x1a')][_0x3d89('0x1c')]||null:null,'attributes':_0x1c785e[_0x3d89('0x1a')]?_0x1c785e[_0x3d89('0x1a')][_0x3d89('0x1d')]||null:null,'include':_0x1c785e[_0x3d89('0x1a')]?_0x1c785e[_0x3d89('0x1a')]['include']?_[_0x3d89('0x1f')](_0x1c785e[_0x3d89('0x1a')][_0x3d89('0x1e')],function(_0x2bb882){return{'model':db[_0x2bb882[_0x3d89('0x20')]],'as':_0x2bb882['as'],'attributes':_0x2bb882[_0x3d89('0x1d')],'include':_0x2bb882[_0x3d89('0x1e')]?_[_0x3d89('0x1f')](_0x2bb882['include'],function(_0x17fae3){return{'model':db[_0x17fae3[_0x3d89('0x20')]],'as':_0x17fae3['as'],'attributes':_0x17fae3[_0x3d89('0x1d')],'include':_0x17fae3['include']?_[_0x3d89('0x1f')](_0x17fae3['include'],function(_0x506392){return{'model':db[_0x506392[_0x3d89('0x20')]],'as':_0x506392['as'],'attributes':_0x506392[_0x3d89('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3d89('0xf')](function(_0x8ea2b2){logger['info']('ShowServicenowAccount',_0x1c785e);logger[_0x3d89('0x11')](_0x3d89('0x21'),_0x1c785e,JSON[_0x3d89('0x13')](_0x8ea2b2));_0x3f69a4(_0x8ea2b2);})['catch'](function(_0x14044b){logger['error'](_0x3d89('0x21'),_0x14044b['message'],_0x1c785e);_0x597fa4(_0x13297d[_0x3d89('0x14')](0x1f4,_0x14044b['message']));});});}; \ No newline at end of file +var _0x1c5d=['error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','options','raw','where','attributes','limit','include','map','model','then','catch','ShowServicenowAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x5a6c35,_0x115202){var _0x2ad02d=function(_0x424481){while(--_0x424481){_0x5a6c35['push'](_0x5a6c35['shift']());}};_0x2ad02d(++_0x115202);}(_0x1c5d,0xd7));var _0xd1c5=function(_0x4b9f8c,_0x29ee48){_0x4b9f8c=_0x4b9f8c-0x0;var _0x3fb25d=_0x1c5d[_0x4b9f8c];return _0x3fb25d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd1c5('0x0'));var BPromise=require(_0xd1c5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1c5('0x2'));var db=require(_0xd1c5('0x3'))['db'];var utils=require(_0xd1c5('0x4'));var logger=require(_0xd1c5('0x5'))(_0xd1c5('0x6'));var config=require('../../config/environment');var jayson=require(_0xd1c5('0x7'));var client=jayson[_0xd1c5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d5e8,_0x719482,_0x33f32a){return new BPromise(function(_0x47a2c6,_0x25db80){return client[_0xd1c5('0x9')](_0x40d5e8,_0x33f32a)['then'](function(_0xf848ee){logger[_0xd1c5('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x719482,'request\x20sent');logger[_0xd1c5('0xb')](_0xd1c5('0xc'),_0x719482,_0xd1c5('0xd'),JSON[_0xd1c5('0xe')](_0xf848ee));if(_0xf848ee['error']){if(_0xf848ee['error'][_0xd1c5('0xf')]===0x1f4){logger[_0xd1c5('0x10')](_0xd1c5('0x11'),_0x719482,_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);return _0x25db80(_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);}logger[_0xd1c5('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x719482,_0xf848ee[_0xd1c5('0x10')][_0xd1c5('0x12')]);return _0x47a2c6(_0xf848ee['error'][_0xd1c5('0x12')]);}else{logger[_0xd1c5('0xa')](_0xd1c5('0x11'),_0x719482,_0xd1c5('0xd'));_0x47a2c6(_0xf848ee[_0xd1c5('0x13')]['message']);}})['catch'](function(_0x1badc2){logger['error'](_0xd1c5('0x11'),_0x719482,_0x1badc2);_0x25db80(_0x1badc2);});});}exports[_0xd1c5('0x14')]=function(_0x2273d0){var _0x26610a=this;return new Promise(function(_0x49048c,_0x250f86){return db['ServicenowAccount']['findAll']({'raw':_0x2273d0['options']?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x16')]===undefined?!![]:![]:!![],'where':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x17')]||null:null,'attributes':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x18')]||null:null,'limit':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')][_0xd1c5('0x19')]||null:null,'include':_0x2273d0[_0xd1c5('0x15')]?_0x2273d0[_0xd1c5('0x15')]['include']?_['map'](_0x2273d0['options'][_0xd1c5('0x1a')],function(_0x2755c4){return{'model':db[_0x2755c4['model']],'as':_0x2755c4['as'],'attributes':_0x2755c4['attributes'],'include':_0x2755c4[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x2755c4[_0xd1c5('0x1a')],function(_0x447896){return{'model':db[_0x447896[_0xd1c5('0x1c')]],'as':_0x447896['as'],'attributes':_0x447896[_0xd1c5('0x18')],'include':_0x447896[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x447896[_0xd1c5('0x1a')],function(_0x2b86c3){return{'model':db[_0x2b86c3[_0xd1c5('0x1c')]],'as':_0x2b86c3['as'],'attributes':_0x2b86c3['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1c5('0x1d')](function(_0x3b2f81){logger[_0xd1c5('0xa')]('GetServicenowAccount',_0x2273d0);logger[_0xd1c5('0xb')](_0xd1c5('0x14'),_0x2273d0,JSON['stringify'](_0x3b2f81));_0x49048c(_0x3b2f81);})[_0xd1c5('0x1e')](function(_0x5eadf7){logger[_0xd1c5('0x10')]('GetServicenowAccount',_0x5eadf7[_0xd1c5('0x12')],_0x2273d0);_0x250f86(_0x26610a['error'](0x1f4,_0x5eadf7['message']));});});};exports[_0xd1c5('0x1f')]=function(_0xd1473b){var _0x5697cb=this;return new Promise(function(_0x123bad,_0x25a70c){return db['ServicenowAccount'][_0xd1c5('0x20')]({'raw':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x16')]===undefined?!![]:![]:!![],'where':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b['options'][_0xd1c5('0x17')]||null:null,'attributes':_0xd1473b['options']?_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x18')]||null:null,'include':_0xd1473b[_0xd1c5('0x15')]?_0xd1473b[_0xd1c5('0x15')]['include']?_['map'](_0xd1473b[_0xd1c5('0x15')][_0xd1c5('0x1a')],function(_0x2ddb57){return{'model':db[_0x2ddb57[_0xd1c5('0x1c')]],'as':_0x2ddb57['as'],'attributes':_0x2ddb57[_0xd1c5('0x18')],'include':_0x2ddb57[_0xd1c5('0x1a')]?_[_0xd1c5('0x1b')](_0x2ddb57[_0xd1c5('0x1a')],function(_0x646604){return{'model':db[_0x646604[_0xd1c5('0x1c')]],'as':_0x646604['as'],'attributes':_0x646604[_0xd1c5('0x18')],'include':_0x646604['include']?_[_0xd1c5('0x1b')](_0x646604['include'],function(_0x5880be){return{'model':db[_0x5880be['model']],'as':_0x5880be['as'],'attributes':_0x5880be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0824){logger[_0xd1c5('0xa')](_0xd1c5('0x1f'),_0xd1473b);logger[_0xd1c5('0xb')](_0xd1c5('0x1f'),_0xd1473b,JSON[_0xd1c5('0xe')](_0x4d0824));_0x123bad(_0x4d0824);})[_0xd1c5('0x1e')](function(_0x23afd2){logger[_0xd1c5('0x10')]('ShowServicenowAccount',_0x23afd2['message'],_0xd1473b);_0x25a70c(_0x5697cb[_0xd1c5('0x10')](0x1f4,_0x23afd2[_0xd1c5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 57a4573..e7522ac 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 _0xbc69=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','put','delete','destroy','multer','util','path','express','Router'];(function(_0x537848,_0x4ff8e3){var _0x256ab5=function(_0x23ad34){while(--_0x23ad34){_0x537848['push'](_0x537848['shift']());}};_0x256ab5(++_0x4ff8e3);}(_0xbc69,0x6e));var _0x9bc6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbc69[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x9bc6('0x0'));var util=require(_0x9bc6('0x1'));var path=require(_0x9bc6('0x2'));var timeout=require('connect-timeout');var express=require(_0x9bc6('0x3'));var router=express[_0x9bc6('0x4')]();var fs_extra=require(_0x9bc6('0x5'));var auth=require(_0x9bc6('0x6'));var interaction=require(_0x9bc6('0x7'));var config=require(_0x9bc6('0x8'));var controller=require(_0x9bc6('0x9'));router[_0x9bc6('0xa')]('/',auth[_0x9bc6('0xb')](),controller[_0x9bc6('0xc')]);router[_0x9bc6('0xa')](_0x9bc6('0xd'),auth[_0x9bc6('0xb')](),controller[_0x9bc6('0xe')]);router[_0x9bc6('0xa')](_0x9bc6('0xf'),auth[_0x9bc6('0xb')](),controller['getFields']);router[_0x9bc6('0xa')](_0x9bc6('0x10'),auth[_0x9bc6('0xb')](),controller[_0x9bc6('0x11')]);router['get'](_0x9bc6('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9bc6('0x13')]('/',auth[_0x9bc6('0xb')](),controller['create']);router[_0x9bc6('0x14')](_0x9bc6('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9bc6('0x15')](_0x9bc6('0xd'),auth[_0x9bc6('0xb')](),controller[_0x9bc6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x03c8=['connect-timeout','express','Router','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','update','delete','destroy','multer','util','path'];(function(_0x50536f,_0x20685b){var _0x52f229=function(_0x16c0be){while(--_0x16c0be){_0x50536f['push'](_0x50536f['shift']());}};_0x52f229(++_0x20685b);}(_0x03c8,0x177));var _0x803c=function(_0x34a243,_0x24489f){_0x34a243=_0x34a243-0x0;var _0x21ce4e=_0x03c8[_0x34a243];return _0x21ce4e;};'use strict';var multer=require(_0x803c('0x0'));var util=require(_0x803c('0x1'));var path=require(_0x803c('0x2'));var timeout=require(_0x803c('0x3'));var express=require(_0x803c('0x4'));var router=express[_0x803c('0x5')]();var fs_extra=require(_0x803c('0x6'));var auth=require(_0x803c('0x7'));var interaction=require(_0x803c('0x8'));var config=require(_0x803c('0x9'));var controller=require(_0x803c('0xa'));router[_0x803c('0xb')]('/',auth[_0x803c('0xc')](),controller[_0x803c('0xd')]);router['get'](_0x803c('0xe'),auth[_0x803c('0xc')](),controller['show']);router[_0x803c('0xb')](_0x803c('0xf'),auth[_0x803c('0xc')](),controller[_0x803c('0x10')]);router[_0x803c('0xb')](_0x803c('0x11'),auth[_0x803c('0xc')](),controller[_0x803c('0x12')]);router['get'](_0x803c('0x13'),auth['isAuthenticated'](),controller[_0x803c('0x14')]);router[_0x803c('0x15')]('/',auth[_0x803c('0xc')](),controller[_0x803c('0x16')]);router[_0x803c('0x17')]('/:id',auth[_0x803c('0xc')](),controller[_0x803c('0x18')]);router[_0x803c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x803c('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 92c4f8c..912c782 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 _0x9f84=['sequelize','exports','STRING'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0x9f84,0x8d));var _0x49f8=function(_0x42cb8d,_0x273bca){_0x42cb8d=_0x42cb8d-0x0;var _0x2713b6=_0x9f84[_0x42cb8d];return _0x2713b6;};'use strict';var Sequelize=require(_0x49f8('0x0'));module[_0x49f8('0x1')]={'name':{'type':Sequelize[_0x49f8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x769f=['STRING','sequelize','exports'];(function(_0x49e0b8,_0x3954a1){var _0x2c869c=function(_0x4ec95b){while(--_0x4ec95b){_0x49e0b8['push'](_0x49e0b8['shift']());}};_0x2c869c(++_0x3954a1);}(_0x769f,0x9a));var _0xf769=function(_0x3718c0,_0x373595){_0x3718c0=_0x3718c0-0x0;var _0x1adae7=_0x769f[_0x3718c0];return _0x1adae7;};'use strict';var Sequelize=require(_0xf769('0x0'));module[_0xf769('0x1')]={'name':{'type':Sequelize[_0xf769('0x2')]},'description':{'type':Sequelize[_0xf769('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4e950f5..0c7e33c 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 _0xbc4a=['to-csv','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','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','save','end','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','then','show','params','find','catch','create','update','body','destroy','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc4a,0x188));var _0xabc4=function(_0x2ee89c,_0x27e14d){_0x2ee89c=_0x2ee89c-0x0;var _0x4328a3=_0xbc4a[_0x2ee89c];return _0x4328a3;};'use strict';var emlformat=require(_0xabc4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabc4('0x1'));var jsonpatch=require(_0xabc4('0x2'));var rp=require(_0xabc4('0x3'));var moment=require(_0xabc4('0x4'));var BPromise=require(_0xabc4('0x5'));var Mustache=require('mustache');var util=require(_0xabc4('0x6'));var path=require('path');var sox=require(_0xabc4('0x7'));var csv=require(_0xabc4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabc4('0x9'));var _=require(_0xabc4('0xa'));var squel=require(_0xabc4('0xb'));var crypto=require(_0xabc4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabc4('0xd'));var toCsv=require(_0xabc4('0x8'));var querystring=require(_0xabc4('0xe'));var Papa=require('papaparse');var Redis=require(_0xabc4('0xf'));var authService=require(_0xabc4('0x10'));var qs=require(_0xabc4('0x11'));var as=require(_0xabc4('0x12'));var hardwareService=require(_0xabc4('0x13'));var logger=require(_0xabc4('0x14'))(_0xabc4('0x15'));var utils=require('../../config/utils');var config=require(_0xabc4('0x16'));var licenseUtil=require(_0xabc4('0x17'));var db=require(_0xabc4('0x18'))['db'];function respondWithStatusCode(_0x32bc86,_0x4ec26d){_0x4ec26d=_0x4ec26d||0xcc;return function(_0x465636){if(_0x465636){return _0x32bc86['sendStatus'](_0x4ec26d);}return _0x32bc86['status'](_0x4ec26d)['end']();};}function respondWithResult(_0x54b5d9,_0x5f1c33){_0x5f1c33=_0x5f1c33||0xc8;return function(_0x48b785){if(_0x48b785){return _0x54b5d9[_0xabc4('0x19')](_0x5f1c33)['json'](_0x48b785);}};}function respondWithFilteredResult(_0x102c47,_0x5aaacd){return function(_0xf41b54){if(_0xf41b54){var _0x3aa8d3=typeof _0x5aaacd[_0xabc4('0x1a')]===_0xabc4('0x1b')&&typeof _0x5aaacd['limit']===_0xabc4('0x1b');var _0x173fa7=_0xf41b54[_0xabc4('0x1c')];var _0x1a0282=_0x3aa8d3?0x0:_0x5aaacd[_0xabc4('0x1a')];var _0x5d9667=_0x3aa8d3?_0xf41b54[_0xabc4('0x1c')]:_0x5aaacd[_0xabc4('0x1a')]+_0x5aaacd[_0xabc4('0x1d')];var _0x1e769d;if(_0x5d9667>=_0x173fa7){_0x5d9667=_0x173fa7;_0x1e769d=0xc8;}else{_0x1e769d=0xce;}_0x102c47[_0xabc4('0x19')](_0x1e769d);return _0x102c47['set'](_0xabc4('0x1e'),_0x1a0282+'-'+_0x5d9667+'/'+_0x173fa7)[_0xabc4('0x1f')](_0xf41b54);}return null;};}function patchUpdates(_0x3299f6){return function(_0x23e1d2){try{jsonpatch[_0xabc4('0x20')](_0x23e1d2,_0x3299f6,!![]);}catch(_0x19e0b4){return BPromise['reject'](_0x19e0b4);}return _0x23e1d2[_0xabc4('0x21')]();};}function saveUpdates(_0x1989e9,_0xf3a599){return function(_0x1f334c){if(_0x1f334c){return _0x1f334c['update'](_0x1989e9)['then'](function(_0x32a436){return _0x32a436;});}return null;};}function removeEntity(_0x51885a,_0x2b4c3b){return function(_0x4b54f5){if(_0x4b54f5){return _0x4b54f5['destroy']()['then'](function(){_0x51885a['status'](0xcc)[_0xabc4('0x22')]();});}};}function handleEntityNotFound(_0xdcec75,_0x5dbb97){return function(_0x1ca5d8){if(!_0x1ca5d8){_0xdcec75['sendStatus'](0x194);}return _0x1ca5d8;};}function handleError(_0x2f5f02,_0x369375){_0x369375=_0x369375||0x1f4;return function(_0x2cd345){logger[_0xabc4('0x23')](_0x2cd345[_0xabc4('0x24')]);if(_0x2cd345[_0xabc4('0x25')]){delete _0x2cd345['name'];}_0x2f5f02[_0xabc4('0x19')](_0x369375)[_0xabc4('0x26')](_0x2cd345);};}exports[_0xabc4('0x27')]=function(_0x304633,_0x79a6f8){var _0x5799dc={},_0x1d7c82={},_0x404b2a={'count':0x0,'rows':[]};var _0x451be0=_[_0xabc4('0x28')](db[_0xabc4('0x29')][_0xabc4('0x2a')],function(_0x410c02){return{'name':_0x410c02[_0xabc4('0x2b')],'type':_0x410c02[_0xabc4('0x2c')][_0xabc4('0x2d')]};});_0x1d7c82[_0xabc4('0x2e')]=_[_0xabc4('0x28')](_0x451be0,_0xabc4('0x25'));_0x1d7c82[_0xabc4('0x2f')]=_[_0xabc4('0x30')](_0x304633[_0xabc4('0x2f')]);_0x1d7c82[_0xabc4('0x31')]=_[_0xabc4('0x32')](_0x1d7c82[_0xabc4('0x2e')],_0x1d7c82[_0xabc4('0x2f')]);_0x5799dc['attributes']=_[_0xabc4('0x32')](_0x1d7c82[_0xabc4('0x2e')],qs['fields'](_0x304633[_0xabc4('0x2f')][_0xabc4('0x33')]));_0x5799dc[_0xabc4('0x34')]=_0x5799dc[_0xabc4('0x34')][_0xabc4('0x35')]?_0x5799dc[_0xabc4('0x34')]:_0x1d7c82[_0xabc4('0x2e')];if(!_0x304633[_0xabc4('0x2f')][_0xabc4('0x36')](_0xabc4('0x37'))){_0x5799dc[_0xabc4('0x1d')]=qs[_0xabc4('0x1d')](_0x304633['query'][_0xabc4('0x1d')]);_0x5799dc[_0xabc4('0x1a')]=qs[_0xabc4('0x1a')](_0x304633[_0xabc4('0x2f')]['offset']);}_0x5799dc[_0xabc4('0x38')]=qs['sort'](_0x304633[_0xabc4('0x2f')][_0xabc4('0x39')]);_0x5799dc[_0xabc4('0x3a')]=qs[_0xabc4('0x31')](_[_0xabc4('0x3b')](_0x304633[_0xabc4('0x2f')],_0x1d7c82[_0xabc4('0x31')]),_0x451be0);if(_0x304633[_0xabc4('0x2f')][_0xabc4('0x3c')]){_0x5799dc[_0xabc4('0x3a')]=_[_0xabc4('0x3d')](_0x5799dc[_0xabc4('0x3a')],{'$or':_['map'](_0x451be0,function(_0xbe03aa){if(_0xbe03aa[_0xabc4('0x2c')]!=='VIRTUAL'){var _0xc6c3a1={};_0xc6c3a1[_0xbe03aa[_0xabc4('0x25')]]={'$like':'%'+_0x304633[_0xabc4('0x2f')][_0xabc4('0x3c')]+'%'};return _0xc6c3a1;}})});}_0x5799dc=_[_0xabc4('0x3d')]({},_0x5799dc,_0x304633[_0xabc4('0x3e')]);var _0x3feb44={'where':_0x5799dc[_0xabc4('0x3a')]};return db[_0xabc4('0x29')][_0xabc4('0x1c')](_0x3feb44)['then'](function(_0x4e4998){_0x404b2a[_0xabc4('0x1c')]=_0x4e4998;if(_0x304633[_0xabc4('0x2f')][_0xabc4('0x3f')]){_0x5799dc[_0xabc4('0x40')]=[{'all':!![]}];}return db[_0xabc4('0x29')][_0xabc4('0x41')](_0x5799dc);})[_0xabc4('0x42')](function(_0x563dad){_0x404b2a['rows']=_0x563dad;return _0x404b2a;})[_0xabc4('0x42')](respondWithFilteredResult(_0x79a6f8,_0x5799dc))['catch'](handleError(_0x79a6f8,null));};exports[_0xabc4('0x43')]=function(_0x1069bd,_0x2ab881){var _0x120ead={'raw':![],'where':{'id':_0x1069bd[_0xabc4('0x44')]['id']}},_0x3a1c3e={};_0x3a1c3e[_0xabc4('0x2e')]=_[_0xabc4('0x30')](db[_0xabc4('0x29')][_0xabc4('0x2a')]);_0x3a1c3e[_0xabc4('0x2f')]=_[_0xabc4('0x30')](_0x1069bd[_0xabc4('0x2f')]);_0x3a1c3e[_0xabc4('0x31')]=_[_0xabc4('0x32')](_0x3a1c3e[_0xabc4('0x2e')],_0x3a1c3e[_0xabc4('0x2f')]);_0x120ead[_0xabc4('0x34')]=_['intersection'](_0x3a1c3e[_0xabc4('0x2e')],qs['fields'](_0x1069bd[_0xabc4('0x2f')][_0xabc4('0x33')]));_0x120ead['attributes']=_0x120ead[_0xabc4('0x34')][_0xabc4('0x35')]?_0x120ead[_0xabc4('0x34')]:_0x3a1c3e['model'];if(_0x1069bd[_0xabc4('0x2f')]['includeAll']){_0x120ead['include']=[{'all':!![]}];}_0x120ead=_[_0xabc4('0x3d')]({},_0x120ead,_0x1069bd[_0xabc4('0x3e')]);return db[_0xabc4('0x29')][_0xabc4('0x45')](_0x120ead)[_0xabc4('0x42')](handleEntityNotFound(_0x2ab881,null))[_0xabc4('0x42')](respondWithResult(_0x2ab881,null))[_0xabc4('0x46')](handleError(_0x2ab881,null));};exports[_0xabc4('0x47')]=function(_0x3ec77a,_0x19ec6f){return db[_0xabc4('0x29')][_0xabc4('0x47')](_0x3ec77a['body'],{})[_0xabc4('0x42')](respondWithResult(_0x19ec6f,0xc9))[_0xabc4('0x46')](handleError(_0x19ec6f,null));};exports[_0xabc4('0x48')]=function(_0x142335,_0x500873){if(_0x142335[_0xabc4('0x49')]['id']){delete _0x142335[_0xabc4('0x49')]['id'];}return db['ServicenowConfiguration'][_0xabc4('0x45')]({'where':{'id':_0x142335[_0xabc4('0x44')]['id']}})[_0xabc4('0x42')](handleEntityNotFound(_0x500873,null))['then'](saveUpdates(_0x142335[_0xabc4('0x49')],null))[_0xabc4('0x42')](respondWithResult(_0x500873,null))[_0xabc4('0x46')](handleError(_0x500873,null));};exports[_0xabc4('0x4a')]=function(_0x4afa38,_0x402d8e){return db[_0xabc4('0x29')][_0xabc4('0x45')]({'where':{'id':_0x4afa38[_0xabc4('0x44')]['id']}})[_0xabc4('0x42')](handleEntityNotFound(_0x402d8e,null))['then'](removeEntity(_0x402d8e,null))['catch'](handleError(_0x402d8e,null));};exports['getFields']=function(_0x5dfb18,_0x34d38c,_0x3e22b6){var _0x5122b0={};var _0x3cb101={};var _0x19d6d1;var _0x227696;return db['ServicenowConfiguration'][_0xabc4('0x4b')]({'where':{'id':_0x5dfb18[_0xabc4('0x44')]['id']}})['then'](handleEntityNotFound(_0x34d38c,null))[_0xabc4('0x42')](function(_0x7e79cb){if(_0x7e79cb){_0x19d6d1=_0x7e79cb;_0x3cb101[_0xabc4('0x2e')]=_[_0xabc4('0x30')](db[_0xabc4('0x4c')][_0xabc4('0x2a')]);_0x3cb101[_0xabc4('0x2f')]=_[_0xabc4('0x30')](_0x5dfb18[_0xabc4('0x2f')]);_0x3cb101[_0xabc4('0x31')]=_[_0xabc4('0x32')](_0x3cb101[_0xabc4('0x2e')],_0x3cb101[_0xabc4('0x2f')]);_0x5122b0[_0xabc4('0x34')]=_[_0xabc4('0x32')](_0x3cb101[_0xabc4('0x2e')],qs['fields'](_0x5dfb18['query'][_0xabc4('0x33')]));_0x5122b0[_0xabc4('0x34')]=_0x5122b0[_0xabc4('0x34')][_0xabc4('0x35')]?_0x5122b0[_0xabc4('0x34')]:_0x3cb101[_0xabc4('0x2e')];_0x5122b0[_0xabc4('0x38')]=qs[_0xabc4('0x39')](_0x5dfb18[_0xabc4('0x2f')][_0xabc4('0x39')]);_0x5122b0[_0xabc4('0x3a')]=qs['filters'](_['pick'](_0x5dfb18[_0xabc4('0x2f')],_0x3cb101[_0xabc4('0x31')]));if(_0x5dfb18[_0xabc4('0x2f')]['filter']){_0x5122b0['where']=_[_0xabc4('0x3d')](_0x5122b0[_0xabc4('0x3a')],{'$or':_[_0xabc4('0x28')](_0x5122b0[_0xabc4('0x34')],function(_0x333aa6){var _0x1e279c={};_0x1e279c[_0x333aa6]={'$like':'%'+_0x5dfb18[_0xabc4('0x2f')][_0xabc4('0x3c')]+'%'};return _0x1e279c;})});}_0x5122b0=_[_0xabc4('0x3d')]({},_0x5122b0,_0x5dfb18[_0xabc4('0x3e')]);return _0x19d6d1[_0xabc4('0x4d')](_0x5122b0);}})[_0xabc4('0x42')](function(_0x1b0a62){if(_0x1b0a62){_0x227696=_0x1b0a62[_0xabc4('0x35')];if(!_0x5dfb18[_0xabc4('0x2f')][_0xabc4('0x36')](_0xabc4('0x37'))){_0x5122b0[_0xabc4('0x1d')]=qs[_0xabc4('0x1d')](_0x5dfb18[_0xabc4('0x2f')][_0xabc4('0x1d')]);_0x5122b0['offset']=qs[_0xabc4('0x1a')](_0x5dfb18[_0xabc4('0x2f')]['offset']);}return _0x19d6d1['getFields'](_0x5122b0);}})['then'](function(_0x12402d){if(_0x12402d){return _0x12402d?{'count':_0x227696,'rows':_0x12402d}:null;}})['then'](respondWithResult(_0x34d38c,null))[_0xabc4('0x46')](handleError(_0x34d38c,null));};exports[_0xabc4('0x4e')]=function(_0x5b923e,_0x2e2b1c,_0x1d2d7b){var _0xf030b4={};var _0x2dd633={};var _0x563cc1;var _0x4bb79e;return db['ServicenowConfiguration'][_0xabc4('0x4b')]({'where':{'id':_0x5b923e[_0xabc4('0x44')]['id']}})[_0xabc4('0x42')](handleEntityNotFound(_0x2e2b1c,null))[_0xabc4('0x42')](function(_0x2196c7){if(_0x2196c7){_0x563cc1=_0x2196c7;_0x2dd633['model']=_[_0xabc4('0x30')](db['ServicenowField'][_0xabc4('0x2a')]);_0x2dd633[_0xabc4('0x2f')]=_[_0xabc4('0x30')](_0x5b923e[_0xabc4('0x2f')]);_0x2dd633['filters']=_['intersection'](_0x2dd633['model'],_0x2dd633[_0xabc4('0x2f')]);_0xf030b4[_0xabc4('0x34')]=_[_0xabc4('0x32')](_0x2dd633[_0xabc4('0x2e')],qs[_0xabc4('0x33')](_0x5b923e[_0xabc4('0x2f')][_0xabc4('0x33')]));_0xf030b4[_0xabc4('0x34')]=_0xf030b4['attributes']['length']?_0xf030b4['attributes']:_0x2dd633[_0xabc4('0x2e')];_0xf030b4['order']=qs[_0xabc4('0x39')](_0x5b923e['query'][_0xabc4('0x39')]);_0xf030b4['where']=qs[_0xabc4('0x31')](_[_0xabc4('0x3b')](_0x5b923e['query'],_0x2dd633[_0xabc4('0x31')]));if(_0x5b923e[_0xabc4('0x2f')]['filter']){_0xf030b4[_0xabc4('0x3a')]=_['merge'](_0xf030b4['where'],{'$or':_['map'](_0xf030b4[_0xabc4('0x34')],function(_0x17f614){var _0x3af7b4={};_0x3af7b4[_0x17f614]={'$like':'%'+_0x5b923e['query']['filter']+'%'};return _0x3af7b4;})});}_0xf030b4=_[_0xabc4('0x3d')]({},_0xf030b4,_0x5b923e[_0xabc4('0x3e')]);return _0x563cc1[_0xabc4('0x4e')](_0xf030b4);}})['then'](function(_0x19069d){if(_0x19069d){_0x4bb79e=_0x19069d[_0xabc4('0x35')];if(!_0x5b923e[_0xabc4('0x2f')][_0xabc4('0x36')]('nolimit')){_0xf030b4[_0xabc4('0x1d')]=qs[_0xabc4('0x1d')](_0x5b923e[_0xabc4('0x2f')][_0xabc4('0x1d')]);_0xf030b4['offset']=qs[_0xabc4('0x1a')](_0x5b923e[_0xabc4('0x2f')][_0xabc4('0x1a')]);}return _0x563cc1[_0xabc4('0x4e')](_0xf030b4);}})[_0xabc4('0x42')](function(_0x1723f3){if(_0x1723f3){return _0x1723f3?{'count':_0x4bb79e,'rows':_0x1723f3}:null;}})[_0xabc4('0x42')](respondWithResult(_0x2e2b1c,null))[_0xabc4('0x46')](handleError(_0x2e2b1c,null));};exports[_0xabc4('0x4f')]=function(_0x2a61fb,_0x1163e2,_0x2d988d){var _0x40b765={};var _0x57736b={};var _0x15d97a;var _0x152af8;return db[_0xabc4('0x29')][_0xabc4('0x4b')]({'where':{'id':_0x2a61fb[_0xabc4('0x44')]['id']}})[_0xabc4('0x42')](handleEntityNotFound(_0x1163e2,null))[_0xabc4('0x42')](function(_0x7cc6a1){if(_0x7cc6a1){_0x15d97a=_0x7cc6a1;_0x57736b[_0xabc4('0x2e')]=_[_0xabc4('0x30')](db[_0xabc4('0x4c')][_0xabc4('0x2a')]);_0x57736b[_0xabc4('0x2f')]=_[_0xabc4('0x30')](_0x2a61fb[_0xabc4('0x2f')]);_0x57736b[_0xabc4('0x31')]=_[_0xabc4('0x32')](_0x57736b['model'],_0x57736b[_0xabc4('0x2f')]);_0x40b765[_0xabc4('0x34')]=_[_0xabc4('0x32')](_0x57736b['model'],qs[_0xabc4('0x33')](_0x2a61fb['query']['fields']));_0x40b765[_0xabc4('0x34')]=_0x40b765[_0xabc4('0x34')]['length']?_0x40b765[_0xabc4('0x34')]:_0x57736b[_0xabc4('0x2e')];_0x40b765['order']=qs[_0xabc4('0x39')](_0x2a61fb[_0xabc4('0x2f')]['sort']);_0x40b765[_0xabc4('0x3a')]=qs['filters'](_[_0xabc4('0x3b')](_0x2a61fb['query'],_0x57736b[_0xabc4('0x31')]));if(_0x2a61fb['query']['filter']){_0x40b765['where']=_[_0xabc4('0x3d')](_0x40b765[_0xabc4('0x3a')],{'$or':_[_0xabc4('0x28')](_0x40b765[_0xabc4('0x34')],function(_0x2be955){var _0x150de3={};_0x150de3[_0x2be955]={'$like':'%'+_0x2a61fb[_0xabc4('0x2f')][_0xabc4('0x3c')]+'%'};return _0x150de3;})});}_0x40b765=_[_0xabc4('0x3d')]({},_0x40b765,_0x2a61fb[_0xabc4('0x3e')]);return _0x15d97a[_0xabc4('0x4f')](_0x40b765);}})[_0xabc4('0x42')](function(_0x543753){if(_0x543753){_0x152af8=_0x543753[_0xabc4('0x35')];if(!_0x2a61fb[_0xabc4('0x2f')][_0xabc4('0x36')](_0xabc4('0x37'))){_0x40b765[_0xabc4('0x1d')]=qs[_0xabc4('0x1d')](_0x2a61fb['query'][_0xabc4('0x1d')]);_0x40b765[_0xabc4('0x1a')]=qs[_0xabc4('0x1a')](_0x2a61fb['query']['offset']);}return _0x15d97a[_0xabc4('0x4f')](_0x40b765);}})[_0xabc4('0x42')](function(_0x31845f){if(_0x31845f){return _0x31845f?{'count':_0x152af8,'rows':_0x31845f}:null;}})[_0xabc4('0x42')](respondWithResult(_0x1163e2,null))['catch'](handleError(_0x1163e2,null));}; \ No newline at end of file +var _0xa8b1=['include','findAll','rows','catch','show','length','find','create','body','params','findOne','ServicenowField','getFields','getSubjects','nolimit','getDescriptions','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','ServicenowConfiguration'];(function(_0x297380,_0x133458){var _0x4fd815=function(_0x39b515){while(--_0x39b515){_0x297380['push'](_0x297380['shift']());}};_0x4fd815(++_0x133458);}(_0xa8b1,0x140));var _0x1a8b=function(_0x32a4e9,_0x34e0e9){_0x32a4e9=_0x32a4e9-0x0;var _0x4f9347=_0xa8b1[_0x32a4e9];return _0x4f9347;};'use strict';var emlformat=require(_0x1a8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1a8b('0x1'));var rp=require('request-promise');var moment=require(_0x1a8b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1a8b('0x3'));var util=require(_0x1a8b('0x4'));var path=require(_0x1a8b('0x5'));var sox=require(_0x1a8b('0x6'));var csv=require(_0x1a8b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a8b('0x8'));var _=require('lodash');var squel=require(_0x1a8b('0x9'));var crypto=require(_0x1a8b('0xa'));var jsforce=require(_0x1a8b('0xb'));var deskjs=require(_0x1a8b('0xc'));var toCsv=require(_0x1a8b('0x7'));var querystring=require(_0x1a8b('0xd'));var Papa=require('papaparse');var Redis=require(_0x1a8b('0xe'));var authService=require(_0x1a8b('0xf'));var qs=require(_0x1a8b('0x10'));var as=require(_0x1a8b('0x11'));var hardwareService=require(_0x1a8b('0x12'));var logger=require('../../config/logger')(_0x1a8b('0x13'));var utils=require(_0x1a8b('0x14'));var config=require(_0x1a8b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52aa27,_0xba6cf9){_0xba6cf9=_0xba6cf9||0xcc;return function(_0x338701){if(_0x338701){return _0x52aa27[_0x1a8b('0x16')](_0xba6cf9);}return _0x52aa27[_0x1a8b('0x17')](_0xba6cf9)[_0x1a8b('0x18')]();};}function respondWithResult(_0xfd8639,_0xa8327e){_0xa8327e=_0xa8327e||0xc8;return function(_0x18000d){if(_0x18000d){return _0xfd8639[_0x1a8b('0x17')](_0xa8327e)[_0x1a8b('0x19')](_0x18000d);}};}function respondWithFilteredResult(_0x1fe76f,_0x439e00){return function(_0x3006f3){if(_0x3006f3){var _0xec00b8=typeof _0x439e00[_0x1a8b('0x1a')]==='undefined'&&typeof _0x439e00['limit']===_0x1a8b('0x1b');var _0x26c57b=_0x3006f3['count'];var _0xd2d74e=_0xec00b8?0x0:_0x439e00['offset'];var _0x384952=_0xec00b8?_0x3006f3[_0x1a8b('0x1c')]:_0x439e00[_0x1a8b('0x1a')]+_0x439e00[_0x1a8b('0x1d')];var _0x398462;if(_0x384952>=_0x26c57b){_0x384952=_0x26c57b;_0x398462=0xc8;}else{_0x398462=0xce;}_0x1fe76f[_0x1a8b('0x17')](_0x398462);return _0x1fe76f['set']('Content-Range',_0xd2d74e+'-'+_0x384952+'/'+_0x26c57b)[_0x1a8b('0x19')](_0x3006f3);}return null;};}function patchUpdates(_0x42d08c){return function(_0x17b8e0){try{jsonpatch[_0x1a8b('0x1e')](_0x17b8e0,_0x42d08c,!![]);}catch(_0x59f76e){return BPromise[_0x1a8b('0x1f')](_0x59f76e);}return _0x17b8e0[_0x1a8b('0x20')]();};}function saveUpdates(_0x340df7,_0x73e997){return function(_0x3df2dc){if(_0x3df2dc){return _0x3df2dc[_0x1a8b('0x21')](_0x340df7)[_0x1a8b('0x22')](function(_0x598dd2){return _0x598dd2;});}return null;};}function removeEntity(_0x3bce7c,_0x341a58){return function(_0x29b9a9){if(_0x29b9a9){return _0x29b9a9[_0x1a8b('0x23')]()[_0x1a8b('0x22')](function(){_0x3bce7c[_0x1a8b('0x17')](0xcc)[_0x1a8b('0x18')]();});}};}function handleEntityNotFound(_0x17bc12,_0xb56a52){return function(_0x3db9dc){if(!_0x3db9dc){_0x17bc12[_0x1a8b('0x16')](0x194);}return _0x3db9dc;};}function handleError(_0x12defa,_0x528074){_0x528074=_0x528074||0x1f4;return function(_0x1eed1a){logger['error'](_0x1eed1a[_0x1a8b('0x24')]);if(_0x1eed1a[_0x1a8b('0x25')]){delete _0x1eed1a[_0x1a8b('0x25')];}_0x12defa[_0x1a8b('0x17')](_0x528074)['send'](_0x1eed1a);};}exports[_0x1a8b('0x26')]=function(_0x25ab01,_0x405503){var _0x2d97b3={},_0x2173cf={},_0x36a77f={'count':0x0,'rows':[]};var _0x35046d=_[_0x1a8b('0x27')](db['ServicenowConfiguration'][_0x1a8b('0x28')],function(_0x3afe39){return{'name':_0x3afe39['fieldName'],'type':_0x3afe39[_0x1a8b('0x29')][_0x1a8b('0x2a')]};});_0x2173cf[_0x1a8b('0x2b')]=_[_0x1a8b('0x27')](_0x35046d,_0x1a8b('0x25'));_0x2173cf[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x25ab01[_0x1a8b('0x2c')]);_0x2173cf['filters']=_['intersection'](_0x2173cf[_0x1a8b('0x2b')],_0x2173cf['query']);_0x2d97b3[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x2173cf[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x2d97b3[_0x1a8b('0x2e')]=_0x2d97b3[_0x1a8b('0x2e')]['length']?_0x2d97b3['attributes']:_0x2173cf[_0x1a8b('0x2b')];if(!_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x2d97b3[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x1d')]);_0x2d97b3['offset']=qs[_0x1a8b('0x1a')](_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}_0x2d97b3[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x25ab01[_0x1a8b('0x2c')]['sort']);_0x2d97b3[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x25ab01[_0x1a8b('0x2c')],_0x2173cf[_0x1a8b('0x35')]),_0x35046d);if(_0x25ab01[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x2d97b3[_0x1a8b('0x34')]=_['merge'](_0x2d97b3[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x35046d,function(_0x528f13){if(_0x528f13[_0x1a8b('0x29')]!==_0x1a8b('0x38')){var _0x363c86={};_0x363c86[_0x528f13[_0x1a8b('0x25')]]={'$like':'%'+_0x25ab01['query'][_0x1a8b('0x37')]+'%'};return _0x363c86;}})});}_0x2d97b3=_[_0x1a8b('0x39')]({},_0x2d97b3,_0x25ab01[_0x1a8b('0x3a')]);var _0x3c86e2={'where':_0x2d97b3[_0x1a8b('0x34')]};return db[_0x1a8b('0x3b')][_0x1a8b('0x1c')](_0x3c86e2)[_0x1a8b('0x22')](function(_0x5ac5b2){_0x36a77f[_0x1a8b('0x1c')]=_0x5ac5b2;if(_0x25ab01['query']['includeAll']){_0x2d97b3[_0x1a8b('0x3c')]=[{'all':!![]}];}return db[_0x1a8b('0x3b')][_0x1a8b('0x3d')](_0x2d97b3);})[_0x1a8b('0x22')](function(_0x2af47f){_0x36a77f[_0x1a8b('0x3e')]=_0x2af47f;return _0x36a77f;})[_0x1a8b('0x22')](respondWithFilteredResult(_0x405503,_0x2d97b3))[_0x1a8b('0x3f')](handleError(_0x405503,null));};exports[_0x1a8b('0x40')]=function(_0x9e53f5,_0x287383){var _0x29aa96={'raw':![],'where':{'id':_0x9e53f5['params']['id']}},_0x5d4ae5={};_0x5d4ae5[_0x1a8b('0x2b')]=_[_0x1a8b('0x2d')](db[_0x1a8b('0x3b')][_0x1a8b('0x28')]);_0x5d4ae5[_0x1a8b('0x2c')]=_['keys'](_0x9e53f5[_0x1a8b('0x2c')]);_0x5d4ae5['filters']=_[_0x1a8b('0x2f')](_0x5d4ae5[_0x1a8b('0x2b')],_0x5d4ae5[_0x1a8b('0x2c')]);_0x29aa96[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x5d4ae5[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x9e53f5[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x29aa96[_0x1a8b('0x2e')]=_0x29aa96[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x29aa96[_0x1a8b('0x2e')]:_0x5d4ae5[_0x1a8b('0x2b')];if(_0x9e53f5[_0x1a8b('0x2c')]['includeAll']){_0x29aa96['include']=[{'all':!![]}];}_0x29aa96=_[_0x1a8b('0x39')]({},_0x29aa96,_0x9e53f5['options']);return db[_0x1a8b('0x3b')][_0x1a8b('0x42')](_0x29aa96)[_0x1a8b('0x22')](handleEntityNotFound(_0x287383,null))[_0x1a8b('0x22')](respondWithResult(_0x287383,null))[_0x1a8b('0x3f')](handleError(_0x287383,null));};exports[_0x1a8b('0x43')]=function(_0x4831dc,_0x14f755){return db[_0x1a8b('0x3b')][_0x1a8b('0x43')](_0x4831dc[_0x1a8b('0x44')],{})[_0x1a8b('0x22')](respondWithResult(_0x14f755,0xc9))['catch'](handleError(_0x14f755,null));};exports[_0x1a8b('0x21')]=function(_0x4547f1,_0x21bc35){if(_0x4547f1[_0x1a8b('0x44')]['id']){delete _0x4547f1[_0x1a8b('0x44')]['id'];}return db[_0x1a8b('0x3b')][_0x1a8b('0x42')]({'where':{'id':_0x4547f1['params']['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x21bc35,null))[_0x1a8b('0x22')](saveUpdates(_0x4547f1['body'],null))[_0x1a8b('0x22')](respondWithResult(_0x21bc35,null))[_0x1a8b('0x3f')](handleError(_0x21bc35,null));};exports[_0x1a8b('0x23')]=function(_0x55e048,_0x634d9b){return db[_0x1a8b('0x3b')][_0x1a8b('0x42')]({'where':{'id':_0x55e048[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x634d9b,null))[_0x1a8b('0x22')](removeEntity(_0x634d9b,null))['catch'](handleError(_0x634d9b,null));};exports['getFields']=function(_0x566ce0,_0x59a6b7,_0xff34d4){var _0x45c33f={};var _0x3ba57d={};var _0x212aa0;var _0x2aa3fd;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x566ce0[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x59a6b7,null))[_0x1a8b('0x22')](function(_0x14c127){if(_0x14c127){_0x212aa0=_0x14c127;_0x3ba57d['model']=_[_0x1a8b('0x2d')](db[_0x1a8b('0x47')][_0x1a8b('0x28')]);_0x3ba57d['query']=_[_0x1a8b('0x2d')](_0x566ce0['query']);_0x3ba57d[_0x1a8b('0x35')]=_[_0x1a8b('0x2f')](_0x3ba57d[_0x1a8b('0x2b')],_0x3ba57d[_0x1a8b('0x2c')]);_0x45c33f[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x3ba57d[_0x1a8b('0x2b')],qs[_0x1a8b('0x30')](_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x30')]));_0x45c33f['attributes']=_0x45c33f[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x45c33f[_0x1a8b('0x2e')]:_0x3ba57d[_0x1a8b('0x2b')];_0x45c33f[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x566ce0['query'][_0x1a8b('0x33')]);_0x45c33f[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x566ce0[_0x1a8b('0x2c')],_0x3ba57d[_0x1a8b('0x35')]));if(_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x45c33f[_0x1a8b('0x34')]=_['merge'](_0x45c33f[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x45c33f[_0x1a8b('0x2e')],function(_0x18646c){var _0x2ada46={};_0x2ada46[_0x18646c]={'$like':'%'+_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x37')]+'%'};return _0x2ada46;})});}_0x45c33f=_[_0x1a8b('0x39')]({},_0x45c33f,_0x566ce0[_0x1a8b('0x3a')]);return _0x212aa0[_0x1a8b('0x48')](_0x45c33f);}})[_0x1a8b('0x22')](function(_0x3b5c41){if(_0x3b5c41){_0x2aa3fd=_0x3b5c41[_0x1a8b('0x41')];if(!_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x45c33f[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x566ce0['query'][_0x1a8b('0x1d')]);_0x45c33f[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x566ce0[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}return _0x212aa0[_0x1a8b('0x48')](_0x45c33f);}})[_0x1a8b('0x22')](function(_0x1616f4){if(_0x1616f4){return _0x1616f4?{'count':_0x2aa3fd,'rows':_0x1616f4}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x59a6b7,null))[_0x1a8b('0x3f')](handleError(_0x59a6b7,null));};exports[_0x1a8b('0x49')]=function(_0x423a25,_0x1674f1,_0x6e73c4){var _0x829a11={};var _0x4a8b6f={};var _0x516d24;var _0x311a8c;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x423a25[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x1674f1,null))['then'](function(_0x56bb5c){if(_0x56bb5c){_0x516d24=_0x56bb5c;_0x4a8b6f['model']=_[_0x1a8b('0x2d')](db[_0x1a8b('0x47')][_0x1a8b('0x28')]);_0x4a8b6f[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x423a25['query']);_0x4a8b6f[_0x1a8b('0x35')]=_[_0x1a8b('0x2f')](_0x4a8b6f[_0x1a8b('0x2b')],_0x4a8b6f[_0x1a8b('0x2c')]);_0x829a11[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x4a8b6f[_0x1a8b('0x2b')],qs['fields'](_0x423a25['query'][_0x1a8b('0x30')]));_0x829a11['attributes']=_0x829a11[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x829a11[_0x1a8b('0x2e')]:_0x4a8b6f[_0x1a8b('0x2b')];_0x829a11['order']=qs[_0x1a8b('0x33')](_0x423a25[_0x1a8b('0x2c')]['sort']);_0x829a11[_0x1a8b('0x34')]=qs['filters'](_[_0x1a8b('0x36')](_0x423a25[_0x1a8b('0x2c')],_0x4a8b6f[_0x1a8b('0x35')]));if(_0x423a25['query'][_0x1a8b('0x37')]){_0x829a11[_0x1a8b('0x34')]=_[_0x1a8b('0x39')](_0x829a11[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x829a11[_0x1a8b('0x2e')],function(_0x36a824){var _0x248fce={};_0x248fce[_0x36a824]={'$like':'%'+_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x37')]+'%'};return _0x248fce;})});}_0x829a11=_[_0x1a8b('0x39')]({},_0x829a11,_0x423a25['options']);return _0x516d24[_0x1a8b('0x49')](_0x829a11);}})['then'](function(_0x128a12){if(_0x128a12){_0x311a8c=_0x128a12['length'];if(!_0x423a25[_0x1a8b('0x2c')]['hasOwnProperty'](_0x1a8b('0x4a'))){_0x829a11[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x1d')]);_0x829a11['offset']=qs[_0x1a8b('0x1a')](_0x423a25[_0x1a8b('0x2c')][_0x1a8b('0x1a')]);}return _0x516d24[_0x1a8b('0x49')](_0x829a11);}})[_0x1a8b('0x22')](function(_0x120253){if(_0x120253){return _0x120253?{'count':_0x311a8c,'rows':_0x120253}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x1674f1,null))[_0x1a8b('0x3f')](handleError(_0x1674f1,null));};exports[_0x1a8b('0x4b')]=function(_0x129f59,_0x46a2f8,_0x504678){var _0x210a66={};var _0x5417b={};var _0x4dc7c6;var _0x2c0a95;return db[_0x1a8b('0x3b')][_0x1a8b('0x46')]({'where':{'id':_0x129f59[_0x1a8b('0x45')]['id']}})[_0x1a8b('0x22')](handleEntityNotFound(_0x46a2f8,null))['then'](function(_0xcdd414){if(_0xcdd414){_0x4dc7c6=_0xcdd414;_0x5417b['model']=_[_0x1a8b('0x2d')](db['ServicenowField'][_0x1a8b('0x28')]);_0x5417b[_0x1a8b('0x2c')]=_[_0x1a8b('0x2d')](_0x129f59[_0x1a8b('0x2c')]);_0x5417b[_0x1a8b('0x35')]=_['intersection'](_0x5417b['model'],_0x5417b[_0x1a8b('0x2c')]);_0x210a66[_0x1a8b('0x2e')]=_[_0x1a8b('0x2f')](_0x5417b[_0x1a8b('0x2b')],qs['fields'](_0x129f59[_0x1a8b('0x2c')]['fields']));_0x210a66['attributes']=_0x210a66[_0x1a8b('0x2e')][_0x1a8b('0x41')]?_0x210a66[_0x1a8b('0x2e')]:_0x5417b[_0x1a8b('0x2b')];_0x210a66[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x33')]);_0x210a66[_0x1a8b('0x34')]=qs[_0x1a8b('0x35')](_[_0x1a8b('0x36')](_0x129f59[_0x1a8b('0x2c')],_0x5417b[_0x1a8b('0x35')]));if(_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x37')]){_0x210a66[_0x1a8b('0x34')]=_['merge'](_0x210a66[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x210a66[_0x1a8b('0x2e')],function(_0x5602de){var _0xce3211={};_0xce3211[_0x5602de]={'$like':'%'+_0x129f59['query'][_0x1a8b('0x37')]+'%'};return _0xce3211;})});}_0x210a66=_[_0x1a8b('0x39')]({},_0x210a66,_0x129f59[_0x1a8b('0x3a')]);return _0x4dc7c6['getDescriptions'](_0x210a66);}})['then'](function(_0x5c2557){if(_0x5c2557){_0x2c0a95=_0x5c2557[_0x1a8b('0x41')];if(!_0x129f59[_0x1a8b('0x2c')][_0x1a8b('0x31')]('nolimit')){_0x210a66['limit']=qs[_0x1a8b('0x1d')](_0x129f59['query'][_0x1a8b('0x1d')]);_0x210a66[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x129f59[_0x1a8b('0x2c')]['offset']);}return _0x4dc7c6[_0x1a8b('0x4b')](_0x210a66);}})[_0x1a8b('0x22')](function(_0x1742e8){if(_0x1742e8){return _0x1742e8?{'count':_0x2c0a95,'rows':_0x1742e8}:null;}})[_0x1a8b('0x22')](respondWithResult(_0x46a2f8,null))['catch'](handleError(_0x46a2f8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9555676..f3c8379 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 _0x174b=['path','rimraf','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise'];(function(_0x147873,_0x43a761){var _0x192fee=function(_0x1e9ace){while(--_0x1e9ace){_0x147873['push'](_0x147873['shift']());}};_0x192fee(++_0x43a761);}(_0x174b,0x19d));var _0xb174=function(_0x46c5b3,_0x51a494){_0x46c5b3=_0x46c5b3-0x0;var _0x5cb24e=_0x174b[_0x46c5b3];return _0x5cb24e;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb174('0x1'));var moment=require(_0xb174('0x2'));var BPromise=require(_0xb174('0x3'));var rp=require(_0xb174('0x4'));var fs=require('fs');var path=require(_0xb174('0x5'));var rimraf=require(_0xb174('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xb174('0x7')]=function(_0x3e81c9,_0x326afc){return _0x3e81c9[_0xb174('0x8')](_0xb174('0x9'),attributes,{'tableName':_0xb174('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d06=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x915426,_0x1a0a05){var _0x1ab376=function(_0x5821ce){while(--_0x5821ce){_0x915426['push'](_0x915426['shift']());}};_0x1ab376(++_0x1a0a05);}(_0x7d06,0x158));var _0x67d0=function(_0x47a4eb,_0x1d950d){_0x47a4eb=_0x47a4eb-0x0;var _0x40209c=_0x7d06[_0x47a4eb];return _0x40209c;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var logger=require(_0x67d0('0x2'))(_0x67d0('0x3'));var moment=require(_0x67d0('0x4'));var BPromise=require('bluebird');var rp=require(_0x67d0('0x5'));var fs=require('fs');var path=require(_0x67d0('0x6'));var rimraf=require(_0x67d0('0x7'));var config=require('../../config/environment');var attributes=require(_0x67d0('0x8'));module['exports']=function(_0x1ba2b3,_0x1f4dc9){return _0x1ba2b3[_0x67d0('0x9')](_0x67d0('0xa'),attributes,{'tableName':_0x67d0('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 1988f9b..b82fd6d 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 _0x58a7=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x5ef375,_0x178e06){var _0x2eb66c=function(_0xdd5758){while(--_0xdd5758){_0x5ef375['push'](_0x5ef375['shift']());}};_0x2eb66c(++_0x178e06);}(_0x58a7,0x13a));var _0x758a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x58a7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x758a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x758a('0x1'));var rs=require(_0x758a('0x2'));var fs=require('fs');var Redis=require(_0x758a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x758a('0x4'));var logger=require('../../config/logger')(_0x758a('0x5'));var config=require(_0x758a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x758a('0x7')][_0x758a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf636,_0x45bbfa,_0x44e0a0){return new BPromise(function(_0x49b1b7,_0x3b61ed){return client[_0x758a('0x9')](_0x1bf636,_0x44e0a0)[_0x758a('0xa')](function(_0x2ca879){logger[_0x758a('0xb')](_0x758a('0xc'),_0x45bbfa,_0x758a('0xd'));logger[_0x758a('0xe')](_0x758a('0xf'),_0x45bbfa,_0x758a('0xd'),JSON[_0x758a('0x10')](_0x2ca879));if(_0x2ca879[_0x758a('0x11')]){if(_0x2ca879[_0x758a('0x11')]['code']===0x1f4){logger[_0x758a('0x11')](_0x758a('0xc'),_0x45bbfa,_0x2ca879[_0x758a('0x11')][_0x758a('0x12')]);return _0x3b61ed(_0x2ca879['error'][_0x758a('0x12')]);}logger[_0x758a('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x45bbfa,_0x2ca879['error']['message']);return _0x49b1b7(_0x2ca879[_0x758a('0x11')]['message']);}else{logger[_0x758a('0xb')](_0x758a('0xc'),_0x45bbfa,_0x758a('0xd'));_0x49b1b7(_0x2ca879[_0x758a('0x13')]['message']);}})[_0x758a('0x14')](function(_0x2d2306){logger[_0x758a('0x11')](_0x758a('0xc'),_0x45bbfa,_0x2d2306);_0x3b61ed(_0x2d2306);});});} \ No newline at end of file +var _0x0a29=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a29,0x134));var _0x90a2=function(_0x249daa,_0x2473a5){_0x249daa=_0x249daa-0x0;var _0x11a975=_0x0a29[_0x249daa];return _0x11a975;};'use strict';var _=require(_0x90a2('0x0'));var util=require(_0x90a2('0x1'));var moment=require(_0x90a2('0x2'));var BPromise=require(_0x90a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90a2('0x4'))['db'];var utils=require(_0x90a2('0x5'));var logger=require('../../config/logger')(_0x90a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x90a2('0x7'));var client=jayson[_0x90a2('0x8')][_0x90a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19249d,_0x47b296,_0xdd4426){return new BPromise(function(_0x3231ca,_0x4885b6){return client[_0x90a2('0xa')](_0x19249d,_0xdd4426)[_0x90a2('0xb')](function(_0x417d7d){logger[_0x90a2('0xc')](_0x90a2('0xd'),_0x47b296,'request\x20sent');logger[_0x90a2('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x47b296,_0x90a2('0xf'),JSON['stringify'](_0x417d7d));if(_0x417d7d['error']){if(_0x417d7d[_0x90a2('0x10')][_0x90a2('0x11')]===0x1f4){logger['error'](_0x90a2('0xd'),_0x47b296,_0x417d7d[_0x90a2('0x10')][_0x90a2('0x12')]);return _0x4885b6(_0x417d7d['error'][_0x90a2('0x12')]);}logger[_0x90a2('0x10')](_0x90a2('0xd'),_0x47b296,_0x417d7d['error'][_0x90a2('0x12')]);return _0x3231ca(_0x417d7d[_0x90a2('0x10')][_0x90a2('0x12')]);}else{logger[_0x90a2('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47b296,_0x90a2('0xf'));_0x3231ca(_0x417d7d['result'][_0x90a2('0x12')]);}})[_0x90a2('0x13')](function(_0xac4c87){logger[_0x90a2('0x10')](_0x90a2('0xd'),_0x47b296,_0xac4c87);_0x4885b6(_0xac4c87);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d9765b5..20eebe5 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 _0xb0bf=['./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xb0bf,0xb7));var _0xfb0b=function(_0x481761,_0x3a01d4){_0x481761=_0x481761-0x0;var _0x4531f6=_0xb0bf[_0x481761];return _0x4531f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb0b('0x0'));var timeout=require(_0xfb0b('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb0b('0x2'));var interaction=require(_0xfb0b('0x3'));var config=require('../../config/environment');var controller=require(_0xfb0b('0x4'));router[_0xfb0b('0x5')]('/',auth['isAuthenticated'](),controller[_0xfb0b('0x6')]);router[_0xfb0b('0x5')](_0xfb0b('0x7'),auth['isAuthenticated'](),controller[_0xfb0b('0x8')]);router[_0xfb0b('0x9')]('/',auth[_0xfb0b('0xa')](),controller[_0xfb0b('0xb')]);router[_0xfb0b('0xc')](_0xfb0b('0x7'),auth['isAuthenticated'](),controller[_0xfb0b('0xd')]);router[_0xfb0b('0xe')](_0xfb0b('0x7'),auth[_0xfb0b('0xa')](),controller[_0xfb0b('0xf')]);module[_0xfb0b('0x10')]=router; \ No newline at end of file +var _0x1627=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer'];(function(_0x515b25,_0x10d567){var _0x3e6450=function(_0x11ec7a){while(--_0x11ec7a){_0x515b25['push'](_0x515b25['shift']());}};_0x3e6450(++_0x10d567);}(_0x1627,0x142));var _0x7162=function(_0x395327,_0x3a7b63){_0x395327=_0x395327-0x0;var _0x2774b7=_0x1627[_0x395327];return _0x2774b7;};'use strict';var multer=require(_0x7162('0x0'));var util=require('util');var path=require(_0x7162('0x1'));var timeout=require(_0x7162('0x2'));var express=require(_0x7162('0x3'));var router=express['Router']();var fs_extra=require(_0x7162('0x4'));var auth=require(_0x7162('0x5'));var interaction=require(_0x7162('0x6'));var config=require(_0x7162('0x7'));var controller=require(_0x7162('0x8'));router[_0x7162('0x9')]('/',auth[_0x7162('0xa')](),controller[_0x7162('0xb')]);router['get'](_0x7162('0xc'),auth['isAuthenticated'](),controller[_0x7162('0xd')]);router[_0x7162('0xe')]('/',auth[_0x7162('0xa')](),controller[_0x7162('0xf')]);router['put'](_0x7162('0xc'),auth[_0x7162('0xa')](),controller[_0x7162('0x10')]);router[_0x7162('0x11')](_0x7162('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7162('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2c5ca77..8bda437 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 _0xc600=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x2175be,_0x489ae8){var _0xb1b24f=function(_0x2373b5){while(--_0x2373b5){_0x2175be['push'](_0x2175be['shift']());}};_0xb1b24f(++_0x489ae8);}(_0xc600,0xce));var _0x0c60=function(_0x23cd7d,_0x19ef58){_0x23cd7d=_0x23cd7d-0x0;var _0xc44d0d=_0xc600[_0x23cd7d];return _0xc44d0d;};'use strict';var Sequelize=require(_0x0c60('0x0'));module[_0x0c60('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0c60('0x2'),_0x0c60('0x3'),_0x0c60('0x4'),_0x0c60('0x5'),_0x0c60('0x6')),'defaultValue':_0x0c60('0x2')},'content':{'type':Sequelize[_0x0c60('0x7')]},'key':{'type':Sequelize[_0x0c60('0x7')]},'keyType':{'type':Sequelize[_0x0c60('0x8')](_0x0c60('0x2'),_0x0c60('0x3'),_0x0c60('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0c60('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0c60('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c60('0x7')]}}; \ No newline at end of file +var _0xacc2=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x54c1e5,_0xa82da4){var _0x1c0a1a=function(_0x5567f4){while(--_0x5567f4){_0x54c1e5['push'](_0x54c1e5['shift']());}};_0x1c0a1a(++_0xa82da4);}(_0xacc2,0x1ab));var _0x2acc=function(_0x18b549,_0x3504d4){_0x18b549=_0x18b549-0x0;var _0x57453b=_0xacc2[_0x18b549];return _0x57453b;};'use strict';var Sequelize=require('sequelize');module[_0x2acc('0x0')]={'type':{'type':Sequelize[_0x2acc('0x1')](_0x2acc('0x2'),_0x2acc('0x3'),_0x2acc('0x4'),_0x2acc('0x5'),'picklist'),'defaultValue':_0x2acc('0x2')},'content':{'type':Sequelize[_0x2acc('0x6')]},'key':{'type':Sequelize[_0x2acc('0x6')]},'keyType':{'type':Sequelize[_0x2acc('0x1')](_0x2acc('0x2'),_0x2acc('0x3'),_0x2acc('0x4'))},'keyContent':{'type':Sequelize[_0x2acc('0x6')]},'idField':{'type':Sequelize[_0x2acc('0x6')]},'nameField':{'type':Sequelize[_0x2acc('0x6')]},'customField':{'type':Sequelize[_0x2acc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ba1ed4d..a12065a 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 _0x752d=['includeAll','findAll','rows','catch','show','keys','include','merge','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','apply','save','update','destroy','then','end','error','stack','name','send','ServicenowField','rawAttributes','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0x752d,0x1bd));var _0xd752=function(_0x56c574,_0x1c028c){_0x56c574=_0x56c574-0x0;var _0x21d0f0=_0x752d[_0x56c574];return _0x21d0f0;};'use strict';var emlformat=require(_0xd752('0x0'));var rimraf=require(_0xd752('0x1'));var zipdir=require(_0xd752('0x2'));var jsonpatch=require(_0xd752('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd752('0x4'));var Mustache=require(_0xd752('0x5'));var util=require(_0xd752('0x6'));var path=require('path');var sox=require(_0xd752('0x7'));var csv=require('to-csv');var ejs=require(_0xd752('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd752('0x9'));var squel=require(_0xd752('0xa'));var crypto=require(_0xd752('0xb'));var jsforce=require(_0xd752('0xc'));var deskjs=require(_0xd752('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd752('0xe'));var Redis=require('ioredis');var authService=require(_0xd752('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd752('0x10'));var hardwareService=require(_0xd752('0x11'));var logger=require('../../config/logger')(_0xd752('0x12'));var utils=require(_0xd752('0x13'));var config=require(_0xd752('0x14'));var licenseUtil=require(_0xd752('0x15'));var db=require(_0xd752('0x16'))['db'];function respondWithStatusCode(_0x51cfee,_0x569923){_0x569923=_0x569923||0xcc;return function(_0x570a0a){if(_0x570a0a){return _0x51cfee[_0xd752('0x17')](_0x569923);}return _0x51cfee[_0xd752('0x18')](_0x569923)['end']();};}function respondWithResult(_0x1eed7e,_0x4e61a3){_0x4e61a3=_0x4e61a3||0xc8;return function(_0x5c3d67){if(_0x5c3d67){return _0x1eed7e['status'](_0x4e61a3)[_0xd752('0x19')](_0x5c3d67);}};}function respondWithFilteredResult(_0x3939d0,_0x5e9145){return function(_0x16da3e){if(_0x16da3e){var _0xdb8430=typeof _0x5e9145['offset']===_0xd752('0x1a')&&typeof _0x5e9145[_0xd752('0x1b')]===_0xd752('0x1a');var _0x917dde=_0x16da3e['count'];var _0x42dd56=_0xdb8430?0x0:_0x5e9145['offset'];var _0x1f90ca=_0xdb8430?_0x16da3e[_0xd752('0x1c')]:_0x5e9145['offset']+_0x5e9145['limit'];var _0x367855;if(_0x1f90ca>=_0x917dde){_0x1f90ca=_0x917dde;_0x367855=0xc8;}else{_0x367855=0xce;}_0x3939d0[_0xd752('0x18')](_0x367855);return _0x3939d0['set']('Content-Range',_0x42dd56+'-'+_0x1f90ca+'/'+_0x917dde)[_0xd752('0x19')](_0x16da3e);}return null;};}function patchUpdates(_0x3e01c8){return function(_0x326924){try{jsonpatch[_0xd752('0x1d')](_0x326924,_0x3e01c8,!![]);}catch(_0x1b8123){return BPromise['reject'](_0x1b8123);}return _0x326924[_0xd752('0x1e')]();};}function saveUpdates(_0x3f678d,_0x4e6caa){return function(_0x1fdaed){if(_0x1fdaed){return _0x1fdaed[_0xd752('0x1f')](_0x3f678d)['then'](function(_0x4772a8){return _0x4772a8;});}return null;};}function removeEntity(_0x3c86db,_0x333a1d){return function(_0x51844a){if(_0x51844a){return _0x51844a[_0xd752('0x20')]()[_0xd752('0x21')](function(){_0x3c86db[_0xd752('0x18')](0xcc)[_0xd752('0x22')]();});}};}function handleEntityNotFound(_0x369d56,_0x29e021){return function(_0x779771){if(!_0x779771){_0x369d56[_0xd752('0x17')](0x194);}return _0x779771;};}function handleError(_0x1716d0,_0x4d43ce){_0x4d43ce=_0x4d43ce||0x1f4;return function(_0x5111cc){logger[_0xd752('0x23')](_0x5111cc[_0xd752('0x24')]);if(_0x5111cc[_0xd752('0x25')]){delete _0x5111cc[_0xd752('0x25')];}_0x1716d0['status'](_0x4d43ce)[_0xd752('0x26')](_0x5111cc);};}exports['index']=function(_0x215d38,_0x502e5e){var _0x12c9cb={},_0x6184c3={},_0x1a3fb3={'count':0x0,'rows':[]};var _0x18bcb8=_['map'](db[_0xd752('0x27')][_0xd752('0x28')],function(_0x778a0a){return{'name':_0x778a0a['fieldName'],'type':_0x778a0a['type'][_0xd752('0x29')]};});_0x6184c3['model']=_[_0xd752('0x2a')](_0x18bcb8,_0xd752('0x25'));_0x6184c3['query']=_['keys'](_0x215d38[_0xd752('0x2b')]);_0x6184c3[_0xd752('0x2c')]=_[_0xd752('0x2d')](_0x6184c3[_0xd752('0x2e')],_0x6184c3[_0xd752('0x2b')]);_0x12c9cb['attributes']=_[_0xd752('0x2d')](_0x6184c3[_0xd752('0x2e')],qs['fields'](_0x215d38[_0xd752('0x2b')][_0xd752('0x2f')]));_0x12c9cb[_0xd752('0x30')]=_0x12c9cb['attributes'][_0xd752('0x31')]?_0x12c9cb[_0xd752('0x30')]:_0x6184c3[_0xd752('0x2e')];if(!_0x215d38[_0xd752('0x2b')][_0xd752('0x32')](_0xd752('0x33'))){_0x12c9cb[_0xd752('0x1b')]=qs['limit'](_0x215d38[_0xd752('0x2b')]['limit']);_0x12c9cb[_0xd752('0x34')]=qs[_0xd752('0x34')](_0x215d38[_0xd752('0x2b')][_0xd752('0x34')]);}_0x12c9cb[_0xd752('0x35')]=qs[_0xd752('0x36')](_0x215d38[_0xd752('0x2b')][_0xd752('0x36')]);_0x12c9cb[_0xd752('0x37')]=qs[_0xd752('0x2c')](_[_0xd752('0x38')](_0x215d38[_0xd752('0x2b')],_0x6184c3[_0xd752('0x2c')]),_0x18bcb8);if(_0x215d38[_0xd752('0x2b')][_0xd752('0x39')]){_0x12c9cb[_0xd752('0x37')]=_['merge'](_0x12c9cb[_0xd752('0x37')],{'$or':_['map'](_0x18bcb8,function(_0x46028f){if(_0x46028f[_0xd752('0x3a')]!=='VIRTUAL'){var _0x454b70={};_0x454b70[_0x46028f[_0xd752('0x25')]]={'$like':'%'+_0x215d38[_0xd752('0x2b')][_0xd752('0x39')]+'%'};return _0x454b70;}})});}_0x12c9cb=_['merge']({},_0x12c9cb,_0x215d38['options']);var _0x51fe2b={'where':_0x12c9cb[_0xd752('0x37')]};return db[_0xd752('0x27')][_0xd752('0x1c')](_0x51fe2b)['then'](function(_0x11692d){_0x1a3fb3[_0xd752('0x1c')]=_0x11692d;if(_0x215d38[_0xd752('0x2b')][_0xd752('0x3b')]){_0x12c9cb['include']=[{'all':!![]}];}return db[_0xd752('0x27')][_0xd752('0x3c')](_0x12c9cb);})[_0xd752('0x21')](function(_0x575825){_0x1a3fb3[_0xd752('0x3d')]=_0x575825;return _0x1a3fb3;})[_0xd752('0x21')](respondWithFilteredResult(_0x502e5e,_0x12c9cb))[_0xd752('0x3e')](handleError(_0x502e5e,null));};exports[_0xd752('0x3f')]=function(_0x15dd97,_0x142640){var _0x156cd1={'raw':!![],'where':{'id':_0x15dd97['params']['id']}},_0x4babbd={};_0x4babbd[_0xd752('0x2e')]=_[_0xd752('0x40')](db['ServicenowField']['rawAttributes']);_0x4babbd['query']=_['keys'](_0x15dd97[_0xd752('0x2b')]);_0x4babbd[_0xd752('0x2c')]=_[_0xd752('0x2d')](_0x4babbd[_0xd752('0x2e')],_0x4babbd[_0xd752('0x2b')]);_0x156cd1[_0xd752('0x30')]=_[_0xd752('0x2d')](_0x4babbd[_0xd752('0x2e')],qs['fields'](_0x15dd97[_0xd752('0x2b')]['fields']));_0x156cd1[_0xd752('0x30')]=_0x156cd1[_0xd752('0x30')][_0xd752('0x31')]?_0x156cd1[_0xd752('0x30')]:_0x4babbd[_0xd752('0x2e')];if(_0x15dd97[_0xd752('0x2b')][_0xd752('0x3b')]){_0x156cd1[_0xd752('0x41')]=[{'all':!![]}];}_0x156cd1=_[_0xd752('0x42')]({},_0x156cd1,_0x15dd97[_0xd752('0x43')]);return db[_0xd752('0x27')]['find'](_0x156cd1)['then'](handleEntityNotFound(_0x142640,null))[_0xd752('0x21')](respondWithResult(_0x142640,null))['catch'](handleError(_0x142640,null));};exports['create']=function(_0x5be048,_0x41087f){return db['ServicenowField'][_0xd752('0x44')](_0x5be048[_0xd752('0x45')],{})[_0xd752('0x21')](respondWithResult(_0x41087f,0xc9))['catch'](handleError(_0x41087f,null));};exports[_0xd752('0x1f')]=function(_0xfe0cf2,_0x1e2708){if(_0xfe0cf2['body']['id']){delete _0xfe0cf2[_0xd752('0x45')]['id'];}return db['ServicenowField'][_0xd752('0x46')]({'where':{'id':_0xfe0cf2[_0xd752('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e2708,null))['then'](saveUpdates(_0xfe0cf2[_0xd752('0x45')],null))[_0xd752('0x21')](respondWithResult(_0x1e2708,null))['catch'](handleError(_0x1e2708,null));};exports[_0xd752('0x20')]=function(_0x3ab62f,_0x4e8960){return db[_0xd752('0x27')]['find']({'where':{'id':_0x3ab62f[_0xd752('0x47')]['id']}})[_0xd752('0x21')](handleEntityNotFound(_0x4e8960,null))[_0xd752('0x21')](removeEntity(_0x4e8960,null))[_0xd752('0x3e')](handleError(_0x4e8960,null));}; \ No newline at end of file +var _0xbb89=['../../config/license/util','sendStatus','status','limit','undefined','count','offset','json','apply','reject','save','update','destroy','end','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x236023,_0xa7f6b6){var _0x5ef19f=function(_0x4e3dfa){while(--_0x4e3dfa){_0x236023['push'](_0x236023['shift']());}};_0x5ef19f(++_0xa7f6b6);}(_0xbb89,0x168));var _0x9bb8=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbb89[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9bb8('0x0'));var jsonpatch=require(_0x9bb8('0x1'));var rp=require('request-promise');var moment=require(_0x9bb8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9bb8('0x3'));var util=require(_0x9bb8('0x4'));var path=require(_0x9bb8('0x5'));var sox=require(_0x9bb8('0x6'));var csv=require(_0x9bb8('0x7'));var ejs=require(_0x9bb8('0x8'));var fs=require('fs');var fs_extra=require(_0x9bb8('0x9'));var _=require(_0x9bb8('0xa'));var squel=require(_0x9bb8('0xb'));var crypto=require(_0x9bb8('0xc'));var jsforce=require(_0x9bb8('0xd'));var deskjs=require(_0x9bb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9bb8('0xf'));var Papa=require(_0x9bb8('0x10'));var Redis=require('ioredis');var authService=require(_0x9bb8('0x11'));var qs=require(_0x9bb8('0x12'));var as=require(_0x9bb8('0x13'));var hardwareService=require(_0x9bb8('0x14'));var logger=require(_0x9bb8('0x15'))(_0x9bb8('0x16'));var utils=require(_0x9bb8('0x17'));var config=require(_0x9bb8('0x18'));var licenseUtil=require(_0x9bb8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a0b0a,_0x5c083b){_0x5c083b=_0x5c083b||0xcc;return function(_0x46ff07){if(_0x46ff07){return _0x9a0b0a[_0x9bb8('0x1a')](_0x5c083b);}return _0x9a0b0a[_0x9bb8('0x1b')](_0x5c083b)['end']();};}function respondWithResult(_0x2b227a,_0x39e6bc){_0x39e6bc=_0x39e6bc||0xc8;return function(_0x3d9491){if(_0x3d9491){return _0x2b227a[_0x9bb8('0x1b')](_0x39e6bc)['json'](_0x3d9491);}};}function respondWithFilteredResult(_0x49b2df,_0x215ee9){return function(_0x2e10cf){if(_0x2e10cf){var _0x51a711=typeof _0x215ee9['offset']==='undefined'&&typeof _0x215ee9[_0x9bb8('0x1c')]===_0x9bb8('0x1d');var _0x3ea294=_0x2e10cf[_0x9bb8('0x1e')];var _0x3f405f=_0x51a711?0x0:_0x215ee9['offset'];var _0x4194b8=_0x51a711?_0x2e10cf[_0x9bb8('0x1e')]:_0x215ee9[_0x9bb8('0x1f')]+_0x215ee9[_0x9bb8('0x1c')];var _0xcc0f36;if(_0x4194b8>=_0x3ea294){_0x4194b8=_0x3ea294;_0xcc0f36=0xc8;}else{_0xcc0f36=0xce;}_0x49b2df[_0x9bb8('0x1b')](_0xcc0f36);return _0x49b2df['set']('Content-Range',_0x3f405f+'-'+_0x4194b8+'/'+_0x3ea294)[_0x9bb8('0x20')](_0x2e10cf);}return null;};}function patchUpdates(_0x5df77f){return function(_0x5d1908){try{jsonpatch[_0x9bb8('0x21')](_0x5d1908,_0x5df77f,!![]);}catch(_0x178fdb){return BPromise[_0x9bb8('0x22')](_0x178fdb);}return _0x5d1908[_0x9bb8('0x23')]();};}function saveUpdates(_0x1ef849,_0x2a365c){return function(_0x488236){if(_0x488236){return _0x488236[_0x9bb8('0x24')](_0x1ef849)['then'](function(_0x576eca){return _0x576eca;});}return null;};}function removeEntity(_0x2cf285,_0x296554){return function(_0x50111c){if(_0x50111c){return _0x50111c[_0x9bb8('0x25')]()['then'](function(){_0x2cf285['status'](0xcc)[_0x9bb8('0x26')]();});}};}function handleEntityNotFound(_0x48abef,_0x1b3a89){return function(_0x14df19){if(!_0x14df19){_0x48abef[_0x9bb8('0x1a')](0x194);}return _0x14df19;};}function handleError(_0x3e74cc,_0x5048c9){_0x5048c9=_0x5048c9||0x1f4;return function(_0x437eee){logger[_0x9bb8('0x27')](_0x437eee[_0x9bb8('0x28')]);if(_0x437eee[_0x9bb8('0x29')]){delete _0x437eee[_0x9bb8('0x29')];}_0x3e74cc['status'](_0x5048c9)[_0x9bb8('0x2a')](_0x437eee);};}exports[_0x9bb8('0x2b')]=function(_0x46f5f9,_0xfdda80){var _0xebefe0={},_0x3eae6f={},_0x2066f3={'count':0x0,'rows':[]};var _0x4b7df2=_['map'](db[_0x9bb8('0x2c')]['rawAttributes'],function(_0x3d6511){return{'name':_0x3d6511[_0x9bb8('0x2d')],'type':_0x3d6511[_0x9bb8('0x2e')][_0x9bb8('0x2f')]};});_0x3eae6f[_0x9bb8('0x30')]=_[_0x9bb8('0x31')](_0x4b7df2,'name');_0x3eae6f[_0x9bb8('0x32')]=_[_0x9bb8('0x33')](_0x46f5f9['query']);_0x3eae6f['filters']=_[_0x9bb8('0x34')](_0x3eae6f['model'],_0x3eae6f[_0x9bb8('0x32')]);_0xebefe0[_0x9bb8('0x35')]=_[_0x9bb8('0x34')](_0x3eae6f[_0x9bb8('0x30')],qs[_0x9bb8('0x36')](_0x46f5f9[_0x9bb8('0x32')]['fields']));_0xebefe0[_0x9bb8('0x35')]=_0xebefe0[_0x9bb8('0x35')][_0x9bb8('0x37')]?_0xebefe0[_0x9bb8('0x35')]:_0x3eae6f[_0x9bb8('0x30')];if(!_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x38')](_0x9bb8('0x39'))){_0xebefe0['limit']=qs[_0x9bb8('0x1c')](_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x1c')]);_0xebefe0['offset']=qs[_0x9bb8('0x1f')](_0x46f5f9[_0x9bb8('0x32')]['offset']);}_0xebefe0[_0x9bb8('0x3a')]=qs[_0x9bb8('0x3b')](_0x46f5f9['query'][_0x9bb8('0x3b')]);_0xebefe0[_0x9bb8('0x3c')]=qs[_0x9bb8('0x3d')](_[_0x9bb8('0x3e')](_0x46f5f9[_0x9bb8('0x32')],_0x3eae6f[_0x9bb8('0x3d')]),_0x4b7df2);if(_0x46f5f9[_0x9bb8('0x32')]['filter']){_0xebefe0[_0x9bb8('0x3c')]=_[_0x9bb8('0x3f')](_0xebefe0[_0x9bb8('0x3c')],{'$or':_[_0x9bb8('0x31')](_0x4b7df2,function(_0xc85743){if(_0xc85743[_0x9bb8('0x2e')]!==_0x9bb8('0x40')){var _0x1c915d={};_0x1c915d[_0xc85743[_0x9bb8('0x29')]]={'$like':'%'+_0x46f5f9[_0x9bb8('0x32')][_0x9bb8('0x41')]+'%'};return _0x1c915d;}})});}_0xebefe0=_[_0x9bb8('0x3f')]({},_0xebefe0,_0x46f5f9[_0x9bb8('0x42')]);var _0x15b619={'where':_0xebefe0['where']};return db[_0x9bb8('0x2c')]['count'](_0x15b619)[_0x9bb8('0x43')](function(_0x346f5a){_0x2066f3[_0x9bb8('0x1e')]=_0x346f5a;if(_0x46f5f9['query'][_0x9bb8('0x44')]){_0xebefe0[_0x9bb8('0x45')]=[{'all':!![]}];}return db[_0x9bb8('0x2c')][_0x9bb8('0x46')](_0xebefe0);})['then'](function(_0x2a9867){_0x2066f3[_0x9bb8('0x47')]=_0x2a9867;return _0x2066f3;})['then'](respondWithFilteredResult(_0xfdda80,_0xebefe0))[_0x9bb8('0x48')](handleError(_0xfdda80,null));};exports['show']=function(_0x2b2046,_0x4a8165){var _0x3f8e6b={'raw':!![],'where':{'id':_0x2b2046[_0x9bb8('0x49')]['id']}},_0x579066={};_0x579066['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0x579066[_0x9bb8('0x32')]=_[_0x9bb8('0x33')](_0x2b2046['query']);_0x579066['filters']=_['intersection'](_0x579066[_0x9bb8('0x30')],_0x579066[_0x9bb8('0x32')]);_0x3f8e6b[_0x9bb8('0x35')]=_[_0x9bb8('0x34')](_0x579066[_0x9bb8('0x30')],qs[_0x9bb8('0x36')](_0x2b2046['query'][_0x9bb8('0x36')]));_0x3f8e6b[_0x9bb8('0x35')]=_0x3f8e6b['attributes'][_0x9bb8('0x37')]?_0x3f8e6b['attributes']:_0x579066[_0x9bb8('0x30')];if(_0x2b2046[_0x9bb8('0x32')][_0x9bb8('0x44')]){_0x3f8e6b[_0x9bb8('0x45')]=[{'all':!![]}];}_0x3f8e6b=_['merge']({},_0x3f8e6b,_0x2b2046[_0x9bb8('0x42')]);return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')](_0x3f8e6b)[_0x9bb8('0x43')](handleEntityNotFound(_0x4a8165,null))[_0x9bb8('0x43')](respondWithResult(_0x4a8165,null))['catch'](handleError(_0x4a8165,null));};exports[_0x9bb8('0x4b')]=function(_0x413ef9,_0x46cbd1){return db[_0x9bb8('0x2c')]['create'](_0x413ef9[_0x9bb8('0x4c')],{})[_0x9bb8('0x43')](respondWithResult(_0x46cbd1,0xc9))[_0x9bb8('0x48')](handleError(_0x46cbd1,null));};exports[_0x9bb8('0x24')]=function(_0x491b1b,_0x158d88){if(_0x491b1b[_0x9bb8('0x4c')]['id']){delete _0x491b1b[_0x9bb8('0x4c')]['id'];}return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')]({'where':{'id':_0x491b1b[_0x9bb8('0x49')]['id']}})['then'](handleEntityNotFound(_0x158d88,null))[_0x9bb8('0x43')](saveUpdates(_0x491b1b[_0x9bb8('0x4c')],null))['then'](respondWithResult(_0x158d88,null))[_0x9bb8('0x48')](handleError(_0x158d88,null));};exports[_0x9bb8('0x25')]=function(_0x48dc5c,_0x4f0702){return db[_0x9bb8('0x2c')][_0x9bb8('0x4a')]({'where':{'id':_0x48dc5c['params']['id']}})[_0x9bb8('0x43')](handleEntityNotFound(_0x4f0702,null))[_0x9bb8('0x43')](removeEntity(_0x4f0702,null))[_0x9bb8('0x48')](handleError(_0x4f0702,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9417a72..c7a24ad 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 _0x108c=['util','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','servicenow_unique_index','lodash'];(function(_0x992138,_0x4552ad){var _0x2339eb=function(_0x1f2029){while(--_0x1f2029){_0x992138['push'](_0x992138['shift']());}};_0x2339eb(++_0x4552ad);}(_0x108c,0x8b));var _0xc108=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x108c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc108('0x0'));var util=require(_0xc108('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc108('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc108('0x3'));var rimraf=require(_0xc108('0x4'));var config=require(_0xc108('0x5'));var attributes=require(_0xc108('0x6'));module['exports']=function(_0x4977d5,_0x3b9277){return _0x4977d5[_0xc108('0x7')]('ServicenowField',attributes,{'tableName':_0xc108('0x8'),'paranoid':![],'indexes':[{'name':_0xc108('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee6f=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','servicenow_unique_index'];(function(_0x441981,_0x12a3eb){var _0x19ce77=function(_0x26973d){while(--_0x26973d){_0x441981['push'](_0x441981['shift']());}};_0x19ce77(++_0x12a3eb);}(_0xee6f,0x17b));var _0xfee6=function(_0x460103,_0x5397b7){_0x460103=_0x460103-0x0;var _0x44499c=_0xee6f[_0x460103];return _0x44499c;};'use strict';var _=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var logger=require(_0xfee6('0x2'))(_0xfee6('0x3'));var moment=require(_0xfee6('0x4'));var BPromise=require(_0xfee6('0x5'));var rp=require(_0xfee6('0x6'));var fs=require('fs');var path=require(_0xfee6('0x7'));var rimraf=require(_0xfee6('0x8'));var config=require(_0xfee6('0x9'));var attributes=require('./intServicenowField.attributes');module[_0xfee6('0xa')]=function(_0x32266a,_0x543edf){return _0x32266a['define'](_0xfee6('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xfee6('0xc'),'fields':['idField',_0xfee6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index a64c370..d844781 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x52c538,_0x48f45a){var _0x33cb72=function(_0x337637){while(--_0x337637){_0x52c538['push'](_0x52c538['shift']());}};_0x33cb72(++_0x48f45a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3f08f8,_0x181c8e){var _0x304753=function(_0x426d12){while(--_0x426d12){_0x3f08f8['push'](_0x3f08f8['shift']());}};_0x304753(++_0x181c8e);}(_0xe706,0xa3));var _0x6e70=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xe706[_0x874cf1];return _0x233579;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e0c9a15..7db2573 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x51a20c,_0x348e15){var _0x280c64=function(_0x47db44){while(--_0x47db44){_0x51a20c['push'](_0x51a20c['shift']());}};_0x280c64(++_0x348e15);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x87ef,_0xc508da){var _0x2bc21d=function(_0x105b4a){while(--_0x105b4a){_0x87ef['push'](_0x87ef['shift']());}};_0x2bc21d(++_0xc508da);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 bbd8937..a360df9 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(_0xadc240,_0x119a22){var _0x5ce109=function(_0x3ae08f){while(--_0x3ae08f){_0xadc240['push'](_0xadc240['shift']());}};_0x5ce109(++_0x119a22);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x2e47ec,_0x2b412f){var _0xd88707=function(_0x3f531a){while(--_0x3f531a){_0x2e47ec['push'](_0x2e47ec['shift']());}};_0xd88707(++_0x2b412f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 0e1f082..bd3ec3a 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 _0x58a4=['show','params','length','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','created_by','description','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','catch'];(function(_0x4186fa,_0x26a01c){var _0x136990=function(_0x13324f){while(--_0x13324f){_0x4186fa['push'](_0x4186fa['shift']());}};_0x136990(++_0x26a01c);}(_0x58a4,0x196));var _0x458a=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x58a4[_0xbe6d5d];return _0x2cb584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x458a('0x0'));var zipdir=require(_0x458a('0x1'));var jsonpatch=require(_0x458a('0x2'));var rp=require('request-promise');var moment=require(_0x458a('0x3'));var BPromise=require(_0x458a('0x4'));var Mustache=require(_0x458a('0x5'));var util=require(_0x458a('0x6'));var path=require('path');var sox=require(_0x458a('0x7'));var csv=require(_0x458a('0x8'));var ejs=require(_0x458a('0x9'));var fs=require('fs');var fs_extra=require(_0x458a('0xa'));var _=require('lodash');var squel=require(_0x458a('0xb'));var crypto=require(_0x458a('0xc'));var jsforce=require(_0x458a('0xd'));var deskjs=require(_0x458a('0xe'));var toCsv=require(_0x458a('0x8'));var querystring=require(_0x458a('0xf'));var Papa=require(_0x458a('0x10'));var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x458a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x16'));var db=require(_0x458a('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x357dfd,_0x33fbe7){_0x33fbe7=_0x33fbe7||0xcc;return function(_0x4ea160){if(_0x4ea160){return _0x357dfd[_0x458a('0x18')](_0x33fbe7);}return _0x357dfd[_0x458a('0x19')](_0x33fbe7)[_0x458a('0x1a')]();};}function respondWithResult(_0x3f97eb,_0x3909dd){_0x3909dd=_0x3909dd||0xc8;return function(_0x432e9f){if(_0x432e9f){return _0x3f97eb['status'](_0x3909dd)[_0x458a('0x1b')](_0x432e9f);}};}function respondWithFilteredResult(_0x48eb95,_0x312085){return function(_0x172a84){if(_0x172a84){var _0x4edb57=typeof _0x312085[_0x458a('0x1c')]===_0x458a('0x1d')&&typeof _0x312085[_0x458a('0x1e')]==='undefined';var _0x40524b=_0x172a84[_0x458a('0x1f')];var _0x40d804=_0x4edb57?0x0:_0x312085[_0x458a('0x1c')];var _0x354e31=_0x4edb57?_0x172a84[_0x458a('0x1f')]:_0x312085['offset']+_0x312085[_0x458a('0x1e')];var _0x41a894;if(_0x354e31>=_0x40524b){_0x354e31=_0x40524b;_0x41a894=0xc8;}else{_0x41a894=0xce;}_0x48eb95['status'](_0x41a894);return _0x48eb95[_0x458a('0x20')](_0x458a('0x21'),_0x40d804+'-'+_0x354e31+'/'+_0x40524b)[_0x458a('0x1b')](_0x172a84);}return null;};}function patchUpdates(_0x15155e){return function(_0x2aecb1){try{jsonpatch['apply'](_0x2aecb1,_0x15155e,!![]);}catch(_0x350072){return BPromise[_0x458a('0x22')](_0x350072);}return _0x2aecb1[_0x458a('0x23')]();};}function saveUpdates(_0x46c6ff,_0x4a0a7b){return function(_0x252c9a){if(_0x252c9a){return _0x252c9a[_0x458a('0x24')](_0x46c6ff)['then'](function(_0x421c5e){return _0x421c5e;});}return null;};}function removeEntity(_0x1f943b,_0xf3dbb){return function(_0x3ea4cd){if(_0x3ea4cd){return _0x3ea4cd['destroy']()['then'](function(){_0x1f943b['status'](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x239821,_0x37a8fc){return function(_0xb18de7){if(!_0xb18de7){_0x239821[_0x458a('0x18')](0x194);}return _0xb18de7;};}function handleError(_0x5274cb,_0x22019a){_0x22019a=_0x22019a||0x1f4;return function(_0x27b02e){logger[_0x458a('0x25')](_0x27b02e[_0x458a('0x26')]);if(_0x27b02e['name']){delete _0x27b02e[_0x458a('0x27')];}_0x5274cb[_0x458a('0x19')](_0x22019a)[_0x458a('0x28')](_0x27b02e);};}exports[_0x458a('0x29')]=function(_0x156b66,_0x5429d9){var _0xd21328={},_0xab831d={},_0x415c8e={'count':0x0,'rows':[]};var _0x334bb3=_[_0x458a('0x2a')](db[_0x458a('0x2b')][_0x458a('0x2c')],function(_0x2b591e){return{'name':_0x2b591e[_0x458a('0x2d')],'type':_0x2b591e[_0x458a('0x2e')][_0x458a('0x2f')]};});_0xab831d[_0x458a('0x30')]=_[_0x458a('0x2a')](_0x334bb3,_0x458a('0x27'));_0xab831d[_0x458a('0x31')]=_[_0x458a('0x32')](_0x156b66[_0x458a('0x31')]);_0xab831d[_0x458a('0x33')]=_[_0x458a('0x34')](_0xab831d[_0x458a('0x30')],_0xab831d[_0x458a('0x31')]);_0xd21328[_0x458a('0x35')]=_[_0x458a('0x34')](_0xab831d[_0x458a('0x30')],qs[_0x458a('0x36')](_0x156b66[_0x458a('0x31')][_0x458a('0x36')]));_0xd21328[_0x458a('0x35')]=_0xd21328[_0x458a('0x35')]['length']?_0xd21328['attributes']:_0xab831d[_0x458a('0x30')];if(!_0x156b66['query'][_0x458a('0x37')](_0x458a('0x38'))){_0xd21328['limit']=qs[_0x458a('0x1e')](_0x156b66['query'][_0x458a('0x1e')]);_0xd21328['offset']=qs[_0x458a('0x1c')](_0x156b66[_0x458a('0x31')][_0x458a('0x1c')]);}_0xd21328[_0x458a('0x39')]=qs[_0x458a('0x3a')](_0x156b66[_0x458a('0x31')][_0x458a('0x3a')]);_0xd21328['where']=qs[_0x458a('0x33')](_[_0x458a('0x3b')](_0x156b66[_0x458a('0x31')],_0xab831d['filters']),_0x334bb3);if(_0x156b66[_0x458a('0x31')][_0x458a('0x3c')]){_0xd21328[_0x458a('0x3d')]=_[_0x458a('0x3e')](_0xd21328[_0x458a('0x3d')],{'$or':_[_0x458a('0x2a')](_0x334bb3,function(_0x46c2f6){if(_0x46c2f6[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x60dfc0={};_0x60dfc0[_0x46c2f6[_0x458a('0x27')]]={'$like':'%'+_0x156b66[_0x458a('0x31')]['filter']+'%'};return _0x60dfc0;}})});}_0xd21328=_['merge']({},_0xd21328,_0x156b66[_0x458a('0x40')]);var _0x4c2aba={'where':_0xd21328[_0x458a('0x3d')]};return db[_0x458a('0x2b')][_0x458a('0x1f')](_0x4c2aba)['then'](function(_0xb4d73d){_0x415c8e[_0x458a('0x1f')]=_0xb4d73d;if(_0x156b66[_0x458a('0x31')][_0x458a('0x41')]){_0xd21328[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x2b')][_0x458a('0x43')](_0xd21328);})['then'](function(_0x480ccf){_0x415c8e['rows']=_0x480ccf;return _0x415c8e;})[_0x458a('0x44')](respondWithFilteredResult(_0x5429d9,_0xd21328))[_0x458a('0x45')](handleError(_0x5429d9,null));};exports[_0x458a('0x46')]=function(_0x525776,_0x293923){var _0x16dc79={'raw':![],'where':{'id':_0x525776[_0x458a('0x47')]['id']}},_0x3d7033={};_0x3d7033['model']=_[_0x458a('0x32')](db['SugarcrmAccount'][_0x458a('0x2c')]);_0x3d7033[_0x458a('0x31')]=_['keys'](_0x525776['query']);_0x3d7033['filters']=_[_0x458a('0x34')](_0x3d7033[_0x458a('0x30')],_0x3d7033[_0x458a('0x31')]);_0x16dc79[_0x458a('0x35')]=_[_0x458a('0x34')](_0x3d7033[_0x458a('0x30')],qs[_0x458a('0x36')](_0x525776[_0x458a('0x31')][_0x458a('0x36')]));_0x16dc79[_0x458a('0x35')]=_0x16dc79[_0x458a('0x35')][_0x458a('0x48')]?_0x16dc79[_0x458a('0x35')]:_0x3d7033[_0x458a('0x30')];if(_0x525776[_0x458a('0x31')][_0x458a('0x41')]){_0x16dc79[_0x458a('0x42')]=[{'all':!![]}];}_0x16dc79=_[_0x458a('0x3e')]({},_0x16dc79,_0x525776[_0x458a('0x40')]);return db[_0x458a('0x2b')][_0x458a('0x49')](_0x16dc79)[_0x458a('0x44')](handleEntityNotFound(_0x293923,null))['then'](respondWithResult(_0x293923,null))[_0x458a('0x45')](handleError(_0x293923,null));};exports[_0x458a('0x4a')]=function(_0x51ffbc,_0x469724){return db[_0x458a('0x2b')][_0x458a('0x4a')](_0x51ffbc[_0x458a('0x4b')],{})[_0x458a('0x44')](respondWithResult(_0x469724,0xc9))[_0x458a('0x45')](handleError(_0x469724,null));};exports[_0x458a('0x24')]=function(_0x58e229,_0x1b7d63){if(_0x58e229[_0x458a('0x4b')]['id']){delete _0x58e229[_0x458a('0x4b')]['id'];}return db['SugarcrmAccount'][_0x458a('0x49')]({'where':{'id':_0x58e229[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b7d63,null))[_0x458a('0x44')](saveUpdates(_0x58e229['body'],null))['then'](respondWithResult(_0x1b7d63,null))[_0x458a('0x45')](handleError(_0x1b7d63,null));};exports[_0x458a('0x4c')]=function(_0xc97b5f,_0x41f9c6){return db[_0x458a('0x2b')]['find']({'where':{'id':_0xc97b5f[_0x458a('0x47')]['id']}})[_0x458a('0x44')](handleEntityNotFound(_0x41f9c6,null))[_0x458a('0x44')](removeEntity(_0x41f9c6,null))[_0x458a('0x45')](handleError(_0x41f9c6,null));};exports[_0x458a('0x4d')]=function(_0x4df6c2,_0x61c134,_0x34e6d8){var _0x52c750={};var _0x38be91={};var _0x1e0ca3;var _0x1d2ce4;return db[_0x458a('0x2b')][_0x458a('0x4e')]({'where':{'id':_0x4df6c2[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x61c134,null))[_0x458a('0x44')](function(_0x465243){if(_0x465243){_0x1e0ca3=_0x465243;_0x38be91['model']=_['keys'](db[_0x458a('0x4f')][_0x458a('0x2c')]);_0x38be91[_0x458a('0x31')]=_[_0x458a('0x32')](_0x4df6c2[_0x458a('0x31')]);_0x38be91[_0x458a('0x33')]=_['intersection'](_0x38be91[_0x458a('0x30')],_0x38be91[_0x458a('0x31')]);_0x52c750['attributes']=_[_0x458a('0x34')](_0x38be91[_0x458a('0x30')],qs[_0x458a('0x36')](_0x4df6c2[_0x458a('0x31')]['fields']));_0x52c750['attributes']=_0x52c750['attributes'][_0x458a('0x48')]?_0x52c750[_0x458a('0x35')]:_0x38be91['model'];_0x52c750[_0x458a('0x39')]=qs[_0x458a('0x3a')](_0x4df6c2[_0x458a('0x31')]['sort']);_0x52c750[_0x458a('0x3d')]=qs[_0x458a('0x33')](_[_0x458a('0x3b')](_0x4df6c2[_0x458a('0x31')],_0x38be91[_0x458a('0x33')]));if(_0x4df6c2[_0x458a('0x31')][_0x458a('0x3c')]){_0x52c750[_0x458a('0x3d')]=_[_0x458a('0x3e')](_0x52c750[_0x458a('0x3d')],{'$or':_['map'](_0x52c750[_0x458a('0x35')],function(_0x2a43f5){var _0x48d9ae={};_0x48d9ae[_0x2a43f5]={'$like':'%'+_0x4df6c2['query'][_0x458a('0x3c')]+'%'};return _0x48d9ae;})});}_0x52c750=_[_0x458a('0x3e')]({},_0x52c750,_0x4df6c2[_0x458a('0x40')]);return _0x1e0ca3[_0x458a('0x4d')](_0x52c750);}})[_0x458a('0x44')](function(_0x3890be){if(_0x3890be){_0x1d2ce4=_0x3890be[_0x458a('0x48')];if(!_0x4df6c2[_0x458a('0x31')][_0x458a('0x37')](_0x458a('0x38'))){_0x52c750[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x4df6c2[_0x458a('0x31')][_0x458a('0x1e')]);_0x52c750['offset']=qs[_0x458a('0x1c')](_0x4df6c2['query'][_0x458a('0x1c')]);}return _0x1e0ca3['getConfigurations'](_0x52c750);}})['then'](function(_0x4584f9){if(_0x4584f9){return _0x4584f9?{'count':_0x1d2ce4,'rows':_0x4584f9}:null;}})[_0x458a('0x44')](respondWithResult(_0x61c134,null))[_0x458a('0x45')](handleError(_0x61c134,null));};exports[_0x458a('0x50')]=function(_0x1e08f2,_0x55557b,_0x47724a){if(_0x1e08f2[_0x458a('0x4b')]['id']){delete _0x1e08f2[_0x458a('0x4b')]['id'];}return db[_0x458a('0x2b')]['findOne']({'where':{'id':_0x1e08f2['params']['id']}})['then'](handleEntityNotFound(_0x55557b,null))[_0x458a('0x44')](function(_0x530928){if(_0x530928){_0x1e08f2[_0x458a('0x4b')][_0x458a('0x51')]=_0x530928['id'];_0x1e08f2[_0x458a('0x4b')][_0x458a('0x52')]=integrations['getSubjects'](_0x1e08f2['body'][_0x458a('0x53')],_0x1e08f2[_0x458a('0x4b')][_0x458a('0x2e')]);_0x1e08f2[_0x458a('0x4b')]['Descriptions']=integrations[_0x458a('0x54')](_0x1e08f2[_0x458a('0x4b')][_0x458a('0x53')],_0x1e08f2[_0x458a('0x4b')]['type']);return db[_0x458a('0x4f')]['create'](_0x1e08f2[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x56')}]});}return null;})[_0x458a('0x44')](respondWithResult(_0x55557b,null))[_0x458a('0x45')](handleError(_0x55557b,null));};exports[_0x458a('0x57')]=function(_0x4ea096,_0x11dedb,_0x414e39){var _0x377c7d='';var _0x3ea53d=['id',_0x458a('0x27'),'assigned_user_id',_0x458a('0x58'),_0x458a('0x59'),'date_start','duration_hours','duration_minutes',_0x458a('0x5a'),'parent_type',_0x458a('0x5b'),_0x458a('0x5c')];return db[_0x458a('0x2b')][_0x458a('0x4e')]({'where':{'id':_0x4ea096[_0x458a('0x47')]['id']},'attributes':['id',_0x458a('0x5d'),_0x458a('0x5e'),_0x458a('0x5f')]})[_0x458a('0x44')](handleEntityNotFound(_0x11dedb,null))[_0x458a('0x44')](function(_0x3a9ffc){if(_0x3a9ffc){_0x377c7d=_0x3a9ffc[_0x458a('0x5f')];var _0x5cf49f=_0x377c7d['slice'](-0x1);if(_0x5cf49f==='/'){_0x377c7d=_0x377c7d[_0x458a('0x60')](0x0,_0x377c7d[_0x458a('0x61')](_0x5cf49f));}return rp({'method':_0x458a('0x62'),'uri':util['format'](_0x458a('0x63'),_0x377c7d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x458a('0x64'),'input_type':_0x458a('0x65'),'response_type':_0x458a('0x65'),'rest_data':JSON[_0x458a('0x66')]({'user_auth':{'user_name':_0x3a9ffc[_0x458a('0x5d')],'password':_0x3a9ffc['password'],'encryption':_0x458a('0x67')},'application':_0x458a('0x68')})}});}})[_0x458a('0x44')](function(_0x59a6f8){if(_0x59a6f8&&_0x59a6f8[_0x458a('0x27')]!==_0x458a('0x69')&&_0x59a6f8[_0x458a('0x27')]!==_0x458a('0x6a')){return rp({'method':_0x458a('0x62'),'uri':util['format'](_0x458a('0x63'),_0x377c7d,_0x458a('0x6b')),'json':!![],'form':{'method':_0x458a('0x6c'),'input_type':'JSON','response_type':_0x458a('0x65'),'rest_data':JSON[_0x458a('0x66')]({'session':_0x59a6f8['id'],'module_name':_0x458a('0x6d')})}})[_0x458a('0x44')](function(_0x2f1adb){if(_0x2f1adb){var _0x3f88ff=_[_0x458a('0x6e')](_0x2f1adb['module_fields']);_['remove'](_0x3f88ff,function(_0x7ed3a){return _0x3ea53d[_0x458a('0x6f')](_0x7ed3a[_0x458a('0x27')]);});return{'count':_0x3f88ff[_0x458a('0x48')],'rows':_['map'](_0x3f88ff,function(_0x38e40d){return{'id':_0x38e40d[_0x458a('0x27')],'name':_0x38e40d[_0x458a('0x70')],'custom':_[_0x458a('0x71')](_0x38e40d[_0x458a('0x27')],'_c')?!![]:![],'options':_0x38e40d['options']?_[_0x458a('0x2a')](_['values'](_0x38e40d[_0x458a('0x40')]),function(_0xc85e79){return{'name':_0xc85e79[_0x458a('0x72')],'value':_0xc85e79['name']};}):[]};})};}})[_0x458a('0x44')](respondWithResult(_0x11dedb,null))['catch'](function(_0x8fc92b){var _0x2d9518=_0x4ea096['query'][_0x458a('0x73')]?0x1f4:_0x8fc92b[_0x458a('0x74')]||0x1f4;logger[_0x458a('0x25')](_0x458a('0x75'),_0x458a('0x57'),_0x2d9518,JSON['stringify'](_0x8fc92b));delete _0x8fc92b[_0x458a('0x27')];if(_0x2d9518===0x191){_0x2d9518=0x190;}_0x11dedb[_0x458a('0x19')](_0x2d9518)['send'](_0x4ea096[_0x458a('0x31')][_0x458a('0x73')]?{'message':_0x458a('0x76'),'statusCode':_0x8fc92b[_0x458a('0x74')]}:_0x8fc92b);});}else{var _0x43305a=0x1f4;_0x11dedb[_0x458a('0x19')](_0x43305a)[_0x458a('0x28')]({'message':_0x458a('0x76'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6641=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','update','body','destroy','getConfigurations','findOne','keys','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','stringify','password','PLAIN','Invalid\x20Login','POST','/service/v4_1/rest.php','get_module_fields','JSON','Calls','includes','label','values','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','then','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type'];(function(_0x4f644c,_0x267433){var _0x5b1528=function(_0x1ccf08){while(--_0x1ccf08){_0x4f644c['push'](_0x4f644c['shift']());}};_0x5b1528(++_0x267433);}(_0x6641,0xc0));var _0x1664=function(_0x5a1667,_0x123ff4){_0x5a1667=_0x5a1667-0x0;var _0x127eaa=_0x6641[_0x5a1667];return _0x127eaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1664('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1664('0x1'));var moment=require(_0x1664('0x2'));var BPromise=require(_0x1664('0x3'));var Mustache=require('mustache');var util=require(_0x1664('0x4'));var path=require(_0x1664('0x5'));var sox=require('sox');var csv=require(_0x1664('0x6'));var ejs=require(_0x1664('0x7'));var fs=require('fs');var fs_extra=require(_0x1664('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1664('0x9'));var deskjs=require(_0x1664('0xa'));var toCsv=require(_0x1664('0x6'));var querystring=require(_0x1664('0xb'));var Papa=require(_0x1664('0xc'));var Redis=require('ioredis');var authService=require(_0x1664('0xd'));var qs=require(_0x1664('0xe'));var as=require(_0x1664('0xf'));var hardwareService=require(_0x1664('0x10'));var logger=require('../../config/logger')(_0x1664('0x11'));var utils=require(_0x1664('0x12'));var config=require(_0x1664('0x13'));var licenseUtil=require(_0x1664('0x14'));var db=require(_0x1664('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x25c6f2,_0x3fc7c1){_0x3fc7c1=_0x3fc7c1||0xcc;return function(_0x2d296d){if(_0x2d296d){return _0x25c6f2[_0x1664('0x16')](_0x3fc7c1);}return _0x25c6f2['status'](_0x3fc7c1)[_0x1664('0x17')]();};}function respondWithResult(_0x5d4f3b,_0xbb74c8){_0xbb74c8=_0xbb74c8||0xc8;return function(_0x168873){if(_0x168873){return _0x5d4f3b[_0x1664('0x18')](_0xbb74c8)[_0x1664('0x19')](_0x168873);}};}function respondWithFilteredResult(_0x13b242,_0x33d77c){return function(_0x42a4f0){if(_0x42a4f0){var _0x4d0752=typeof _0x33d77c[_0x1664('0x1a')]===_0x1664('0x1b')&&typeof _0x33d77c['limit']===_0x1664('0x1b');var _0x448a27=_0x42a4f0['count'];var _0x27f5ef=_0x4d0752?0x0:_0x33d77c[_0x1664('0x1a')];var _0x3e3b42=_0x4d0752?_0x42a4f0[_0x1664('0x1c')]:_0x33d77c['offset']+_0x33d77c[_0x1664('0x1d')];var _0x51531b;if(_0x3e3b42>=_0x448a27){_0x3e3b42=_0x448a27;_0x51531b=0xc8;}else{_0x51531b=0xce;}_0x13b242[_0x1664('0x18')](_0x51531b);return _0x13b242[_0x1664('0x1e')]('Content-Range',_0x27f5ef+'-'+_0x3e3b42+'/'+_0x448a27)[_0x1664('0x19')](_0x42a4f0);}return null;};}function patchUpdates(_0x224bce){return function(_0x372aa2){try{jsonpatch[_0x1664('0x1f')](_0x372aa2,_0x224bce,!![]);}catch(_0x3c6f5e){return BPromise['reject'](_0x3c6f5e);}return _0x372aa2[_0x1664('0x20')]();};}function saveUpdates(_0x4de688,_0x42e77c){return function(_0x4953d2){if(_0x4953d2){return _0x4953d2['update'](_0x4de688)[_0x1664('0x21')](function(_0x59b560){return _0x59b560;});}return null;};}function removeEntity(_0x2691ec,_0x299991){return function(_0x483365){if(_0x483365){return _0x483365['destroy']()['then'](function(){_0x2691ec[_0x1664('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4091d9,_0x13b241){return function(_0x840b86){if(!_0x840b86){_0x4091d9['sendStatus'](0x194);}return _0x840b86;};}function handleError(_0x30a5fb,_0x35b823){_0x35b823=_0x35b823||0x1f4;return function(_0x4e3d6f){logger['error'](_0x4e3d6f['stack']);if(_0x4e3d6f[_0x1664('0x22')]){delete _0x4e3d6f[_0x1664('0x22')];}_0x30a5fb[_0x1664('0x18')](_0x35b823)[_0x1664('0x23')](_0x4e3d6f);};}exports[_0x1664('0x24')]=function(_0x305b9b,_0x3969ea){var _0x440c33={},_0x14021f={},_0x5176b9={'count':0x0,'rows':[]};var _0x2225e6=_[_0x1664('0x25')](db[_0x1664('0x26')][_0x1664('0x27')],function(_0x458641){return{'name':_0x458641[_0x1664('0x28')],'type':_0x458641[_0x1664('0x29')][_0x1664('0x2a')]};});_0x14021f[_0x1664('0x2b')]=_[_0x1664('0x25')](_0x2225e6,_0x1664('0x22'));_0x14021f['query']=_['keys'](_0x305b9b[_0x1664('0x2c')]);_0x14021f[_0x1664('0x2d')]=_[_0x1664('0x2e')](_0x14021f[_0x1664('0x2b')],_0x14021f['query']);_0x440c33[_0x1664('0x2f')]=_[_0x1664('0x2e')](_0x14021f[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x305b9b[_0x1664('0x2c')][_0x1664('0x30')]));_0x440c33[_0x1664('0x2f')]=_0x440c33[_0x1664('0x2f')][_0x1664('0x31')]?_0x440c33[_0x1664('0x2f')]:_0x14021f['model'];if(!_0x305b9b[_0x1664('0x2c')][_0x1664('0x32')](_0x1664('0x33'))){_0x440c33['limit']=qs['limit'](_0x305b9b[_0x1664('0x2c')][_0x1664('0x1d')]);_0x440c33['offset']=qs['offset'](_0x305b9b[_0x1664('0x2c')][_0x1664('0x1a')]);}_0x440c33[_0x1664('0x34')]=qs['sort'](_0x305b9b['query'][_0x1664('0x35')]);_0x440c33[_0x1664('0x36')]=qs[_0x1664('0x2d')](_[_0x1664('0x37')](_0x305b9b['query'],_0x14021f['filters']),_0x2225e6);if(_0x305b9b['query'][_0x1664('0x38')]){_0x440c33[_0x1664('0x36')]=_[_0x1664('0x39')](_0x440c33[_0x1664('0x36')],{'$or':_[_0x1664('0x25')](_0x2225e6,function(_0x1014e6){if(_0x1014e6[_0x1664('0x29')]!==_0x1664('0x3a')){var _0x2ab113={};_0x2ab113[_0x1014e6[_0x1664('0x22')]]={'$like':'%'+_0x305b9b[_0x1664('0x2c')][_0x1664('0x38')]+'%'};return _0x2ab113;}})});}_0x440c33=_[_0x1664('0x39')]({},_0x440c33,_0x305b9b['options']);var _0x1b2406={'where':_0x440c33['where']};return db[_0x1664('0x26')][_0x1664('0x1c')](_0x1b2406)[_0x1664('0x21')](function(_0x57bcf6){_0x5176b9[_0x1664('0x1c')]=_0x57bcf6;if(_0x305b9b[_0x1664('0x2c')][_0x1664('0x3b')]){_0x440c33[_0x1664('0x3c')]=[{'all':!![]}];}return db[_0x1664('0x26')]['findAll'](_0x440c33);})[_0x1664('0x21')](function(_0x4501e5){_0x5176b9[_0x1664('0x3d')]=_0x4501e5;return _0x5176b9;})[_0x1664('0x21')](respondWithFilteredResult(_0x3969ea,_0x440c33))[_0x1664('0x3e')](handleError(_0x3969ea,null));};exports[_0x1664('0x3f')]=function(_0x4150c6,_0x1b39d6){var _0x37ed07={'raw':![],'where':{'id':_0x4150c6[_0x1664('0x40')]['id']}},_0x2bb50e={};_0x2bb50e[_0x1664('0x2b')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x2bb50e['query']=_['keys'](_0x4150c6['query']);_0x2bb50e[_0x1664('0x2d')]=_[_0x1664('0x2e')](_0x2bb50e[_0x1664('0x2b')],_0x2bb50e['query']);_0x37ed07[_0x1664('0x2f')]=_['intersection'](_0x2bb50e[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x4150c6[_0x1664('0x2c')]['fields']));_0x37ed07['attributes']=_0x37ed07[_0x1664('0x2f')][_0x1664('0x31')]?_0x37ed07['attributes']:_0x2bb50e[_0x1664('0x2b')];if(_0x4150c6[_0x1664('0x2c')]['includeAll']){_0x37ed07[_0x1664('0x3c')]=[{'all':!![]}];}_0x37ed07=_[_0x1664('0x39')]({},_0x37ed07,_0x4150c6[_0x1664('0x41')]);return db[_0x1664('0x26')][_0x1664('0x42')](_0x37ed07)[_0x1664('0x21')](handleEntityNotFound(_0x1b39d6,null))[_0x1664('0x21')](respondWithResult(_0x1b39d6,null))[_0x1664('0x3e')](handleError(_0x1b39d6,null));};exports[_0x1664('0x43')]=function(_0x5ccc68,_0x510dab){return db['SugarcrmAccount'][_0x1664('0x43')](_0x5ccc68['body'],{})[_0x1664('0x21')](respondWithResult(_0x510dab,0xc9))[_0x1664('0x3e')](handleError(_0x510dab,null));};exports[_0x1664('0x44')]=function(_0x2428fe,_0x144538){if(_0x2428fe[_0x1664('0x45')]['id']){delete _0x2428fe[_0x1664('0x45')]['id'];}return db[_0x1664('0x26')][_0x1664('0x42')]({'where':{'id':_0x2428fe['params']['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x144538,null))['then'](saveUpdates(_0x2428fe[_0x1664('0x45')],null))['then'](respondWithResult(_0x144538,null))[_0x1664('0x3e')](handleError(_0x144538,null));};exports[_0x1664('0x46')]=function(_0x365ef4,_0x5ecb09){return db['SugarcrmAccount'][_0x1664('0x42')]({'where':{'id':_0x365ef4[_0x1664('0x40')]['id']}})['then'](handleEntityNotFound(_0x5ecb09,null))[_0x1664('0x21')](removeEntity(_0x5ecb09,null))[_0x1664('0x3e')](handleError(_0x5ecb09,null));};exports[_0x1664('0x47')]=function(_0x1170b7,_0x5e7205,_0x3e9413){var _0x481647={};var _0x3e356c={};var _0x205ca0;var _0x4b824a;return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x1170b7[_0x1664('0x40')]['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x5e7205,null))['then'](function(_0x57ad54){if(_0x57ad54){_0x205ca0=_0x57ad54;_0x3e356c[_0x1664('0x2b')]=_[_0x1664('0x49')](db[_0x1664('0x4a')][_0x1664('0x27')]);_0x3e356c[_0x1664('0x2c')]=_[_0x1664('0x49')](_0x1170b7[_0x1664('0x2c')]);_0x3e356c[_0x1664('0x2d')]=_['intersection'](_0x3e356c[_0x1664('0x2b')],_0x3e356c['query']);_0x481647[_0x1664('0x2f')]=_[_0x1664('0x2e')](_0x3e356c[_0x1664('0x2b')],qs[_0x1664('0x30')](_0x1170b7[_0x1664('0x2c')][_0x1664('0x30')]));_0x481647[_0x1664('0x2f')]=_0x481647[_0x1664('0x2f')][_0x1664('0x31')]?_0x481647[_0x1664('0x2f')]:_0x3e356c[_0x1664('0x2b')];_0x481647[_0x1664('0x34')]=qs[_0x1664('0x35')](_0x1170b7['query'][_0x1664('0x35')]);_0x481647[_0x1664('0x36')]=qs[_0x1664('0x2d')](_[_0x1664('0x37')](_0x1170b7['query'],_0x3e356c[_0x1664('0x2d')]));if(_0x1170b7[_0x1664('0x2c')]['filter']){_0x481647[_0x1664('0x36')]=_[_0x1664('0x39')](_0x481647[_0x1664('0x36')],{'$or':_['map'](_0x481647[_0x1664('0x2f')],function(_0x27022b){var _0x153b14={};_0x153b14[_0x27022b]={'$like':'%'+_0x1170b7[_0x1664('0x2c')][_0x1664('0x38')]+'%'};return _0x153b14;})});}_0x481647=_[_0x1664('0x39')]({},_0x481647,_0x1170b7['options']);return _0x205ca0[_0x1664('0x47')](_0x481647);}})[_0x1664('0x21')](function(_0x5adf4f){if(_0x5adf4f){_0x4b824a=_0x5adf4f['length'];if(!_0x1170b7[_0x1664('0x2c')]['hasOwnProperty'](_0x1664('0x33'))){_0x481647[_0x1664('0x1d')]=qs[_0x1664('0x1d')](_0x1170b7[_0x1664('0x2c')][_0x1664('0x1d')]);_0x481647[_0x1664('0x1a')]=qs['offset'](_0x1170b7['query']['offset']);}return _0x205ca0[_0x1664('0x47')](_0x481647);}})['then'](function(_0x3db5bf){if(_0x3db5bf){return _0x3db5bf?{'count':_0x4b824a,'rows':_0x3db5bf}:null;}})['then'](respondWithResult(_0x5e7205,null))[_0x1664('0x3e')](handleError(_0x5e7205,null));};exports[_0x1664('0x4b')]=function(_0x105f63,_0x49c5e3,_0x102010){if(_0x105f63[_0x1664('0x45')]['id']){delete _0x105f63[_0x1664('0x45')]['id'];}return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x105f63[_0x1664('0x40')]['id']}})[_0x1664('0x21')](handleEntityNotFound(_0x49c5e3,null))[_0x1664('0x21')](function(_0x13e55e){if(_0x13e55e){_0x105f63[_0x1664('0x45')][_0x1664('0x4c')]=_0x13e55e['id'];_0x105f63[_0x1664('0x45')]['Subjects']=integrations[_0x1664('0x4d')](_0x105f63[_0x1664('0x45')][_0x1664('0x4e')],_0x105f63[_0x1664('0x45')]['type']);_0x105f63[_0x1664('0x45')][_0x1664('0x4f')]=integrations['getDescriptions'](_0x105f63[_0x1664('0x45')][_0x1664('0x4e')],_0x105f63[_0x1664('0x45')][_0x1664('0x29')]);return db[_0x1664('0x4a')][_0x1664('0x43')](_0x105f63[_0x1664('0x45')],{'include':[{'model':db['SugarcrmField'],'as':_0x1664('0x50')},{'model':db[_0x1664('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x49c5e3,null))[_0x1664('0x3e')](handleError(_0x49c5e3,null));};exports[_0x1664('0x52')]=function(_0x536919,_0x3c8695,_0xa24c68){var _0x252d5b='';var _0x36af7f=['id',_0x1664('0x22'),_0x1664('0x53'),'created_by',_0x1664('0x54'),_0x1664('0x55'),_0x1664('0x56'),'duration_minutes',_0x1664('0x57'),_0x1664('0x58'),_0x1664('0x59'),_0x1664('0x5a')];return db[_0x1664('0x26')][_0x1664('0x48')]({'where':{'id':_0x536919[_0x1664('0x40')]['id']},'attributes':['id',_0x1664('0x5b'),'password','remoteUri']})[_0x1664('0x21')](handleEntityNotFound(_0x3c8695,null))['then'](function(_0x5a9118){if(_0x5a9118){_0x252d5b=_0x5a9118[_0x1664('0x5c')];var _0x5caf3f=_0x252d5b[_0x1664('0x5d')](-0x1);if(_0x5caf3f==='/'){_0x252d5b=_0x252d5b[_0x1664('0x5e')](0x0,_0x252d5b[_0x1664('0x5f')](_0x5caf3f));}return rp({'method':'POST','uri':util[_0x1664('0x60')](_0x1664('0x61'),_0x252d5b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1664('0x62'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1664('0x63')]({'user_auth':{'user_name':_0x5a9118[_0x1664('0x5b')],'password':_0x5a9118[_0x1664('0x64')],'encryption':_0x1664('0x65')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x1664('0x21')](function(_0x5d0420){if(_0x5d0420&&_0x5d0420[_0x1664('0x22')]!==_0x1664('0x66')&&_0x5d0420[_0x1664('0x22')]!=='Password\x20Expired'){return rp({'method':_0x1664('0x67'),'uri':util[_0x1664('0x60')]('%s%s',_0x252d5b,_0x1664('0x68')),'json':!![],'form':{'method':_0x1664('0x69'),'input_type':_0x1664('0x6a'),'response_type':'JSON','rest_data':JSON[_0x1664('0x63')]({'session':_0x5d0420['id'],'module_name':_0x1664('0x6b')})}})[_0x1664('0x21')](function(_0x23ee37){if(_0x23ee37){var _0x53ec6f=_['values'](_0x23ee37['module_fields']);_['remove'](_0x53ec6f,function(_0x44af1e){return _0x36af7f[_0x1664('0x6c')](_0x44af1e[_0x1664('0x22')]);});return{'count':_0x53ec6f[_0x1664('0x31')],'rows':_[_0x1664('0x25')](_0x53ec6f,function(_0x2eb1b6){return{'id':_0x2eb1b6[_0x1664('0x22')],'name':_0x2eb1b6[_0x1664('0x6d')],'custom':_['endsWith'](_0x2eb1b6['name'],'_c')?!![]:![],'options':_0x2eb1b6['options']?_[_0x1664('0x25')](_[_0x1664('0x6e')](_0x2eb1b6['options']),function(_0x237e7c){return{'name':_0x237e7c[_0x1664('0x6f')],'value':_0x237e7c['name']};}):[]};})};}})[_0x1664('0x21')](respondWithResult(_0x3c8695,null))['catch'](function(_0x2054b5){var _0x3d3959=_0x536919[_0x1664('0x2c')][_0x1664('0x70')]?0x1f4:_0x2054b5[_0x1664('0x71')]||0x1f4;logger[_0x1664('0x72')](_0x1664('0x73'),_0x1664('0x52'),_0x3d3959,JSON[_0x1664('0x63')](_0x2054b5));delete _0x2054b5['name'];if(_0x3d3959===0x191){_0x3d3959=0x190;}_0x3c8695['status'](_0x3d3959)[_0x1664('0x23')](_0x536919[_0x1664('0x2c')][_0x1664('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2054b5[_0x1664('0x71')]}:_0x2054b5);});}else{var _0x261c3d=0x1f4;_0x3c8695['status'](_0x261c3d)[_0x1664('0x23')]({'message':_0x1664('0x74'),'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 5e4a8ef..eaf9b42 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 _0x4342=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','moment','bluebird','request-promise'];(function(_0x1182bd,_0x52ebf2){var _0x5c868b=function(_0x2c905f){while(--_0x2c905f){_0x1182bd['push'](_0x1182bd['shift']());}};_0x5c868b(++_0x52ebf2);}(_0x4342,0xe5));var _0x2434=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0x4342[_0x3feb8a];return _0x4523ca;};'use strict';var _=require(_0x2434('0x0'));var util=require(_0x2434('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2434('0x2'));var BPromise=require(_0x2434('0x3'));var rp=require(_0x2434('0x4'));var fs=require('fs');var path=require(_0x2434('0x5'));var rimraf=require(_0x2434('0x6'));var config=require(_0x2434('0x7'));var attributes=require(_0x2434('0x8'));var integrations=require(_0x2434('0x9'));module[_0x2434('0xa')]=function(_0xcc6d77,_0xd941cb){return _0xcc6d77[_0x2434('0xb')](_0x2434('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfecc=['exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x533176,_0xc60118){var _0x22ec6d=function(_0x17441d){while(--_0x17441d){_0x533176['push'](_0x533176['shift']());}};_0x22ec6d(++_0xc60118);}(_0xfecc,0x107));var _0xcfec=function(_0x11742c,_0x421caa){_0x11742c=_0x11742c-0x0;var _0x1dc91b=_0xfecc[_0x11742c];return _0x1dc91b;};'use strict';var _=require(_0xcfec('0x0'));var util=require(_0xcfec('0x1'));var logger=require(_0xcfec('0x2'))(_0xcfec('0x3'));var moment=require(_0xcfec('0x4'));var BPromise=require(_0xcfec('0x5'));var rp=require(_0xcfec('0x6'));var fs=require('fs');var path=require(_0xcfec('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcfec('0x8'));var integrations=require(_0xcfec('0x9'));module[_0xcfec('0xa')]=function(_0x2f84e9,_0x4c387e){return _0x2f84e9['define'](_0xcfec('0xb'),attributes,{'tableName':_0xcfec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index e058c22..89d2786 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 _0x2426=['message','result','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2242ec,_0x2f008e){var _0x13d590=function(_0x4905d1){while(--_0x4905d1){_0x2242ec['push'](_0x2242ec['shift']());}};_0x13d590(++_0x2f008e);}(_0x2426,0x130));var _0x6242=function(_0x36c2ed,_0x341389){_0x36c2ed=_0x36c2ed-0x0;var _0x113e70=_0x2426[_0x36c2ed];return _0x113e70;};'use strict';var _=require(_0x6242('0x0'));var util=require(_0x6242('0x1'));var moment=require(_0x6242('0x2'));var BPromise=require(_0x6242('0x3'));var rs=require(_0x6242('0x4'));var fs=require('fs');var Redis=require(_0x6242('0x5'));var db=require(_0x6242('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6242('0x7'));var config=require('../../config/environment');var jayson=require(_0x6242('0x8'));var client=jayson[_0x6242('0x9')][_0x6242('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43ba57,_0x19ed5d,_0x4ac7e7){return new BPromise(function(_0x36aeea,_0x4b0742){return client['request'](_0x43ba57,_0x4ac7e7)[_0x6242('0xb')](function(_0x4fb8f0){logger[_0x6242('0xc')](_0x6242('0xd'),_0x19ed5d,_0x6242('0xe'));logger[_0x6242('0xf')](_0x6242('0x10'),_0x19ed5d,_0x6242('0xe'),JSON[_0x6242('0x11')](_0x4fb8f0));if(_0x4fb8f0[_0x6242('0x12')]){if(_0x4fb8f0[_0x6242('0x12')][_0x6242('0x13')]===0x1f4){logger[_0x6242('0x12')](_0x6242('0xd'),_0x19ed5d,_0x4fb8f0[_0x6242('0x12')][_0x6242('0x14')]);return _0x4b0742(_0x4fb8f0[_0x6242('0x12')][_0x6242('0x14')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x19ed5d,_0x4fb8f0[_0x6242('0x12')][_0x6242('0x14')]);return _0x36aeea(_0x4fb8f0[_0x6242('0x12')][_0x6242('0x14')]);}else{logger[_0x6242('0xc')](_0x6242('0xd'),_0x19ed5d,_0x6242('0xe'));_0x36aeea(_0x4fb8f0[_0x6242('0x15')][_0x6242('0x14')]);}})['catch'](function(_0x342a70){logger[_0x6242('0x12')](_0x6242('0xd'),_0x19ed5d,_0x342a70);_0x4b0742(_0x342a70);});});}exports['GetSugarcrmAccount']=function(_0x466c24){var _0x257094=this;return new Promise(function(_0x63e340,_0x13f9e2){return db[_0x6242('0x16')][_0x6242('0x17')]({'raw':_0x466c24['options']?_0x466c24[_0x6242('0x18')][_0x6242('0x19')]===undefined?!![]:![]:!![],'where':_0x466c24['options']?_0x466c24[_0x6242('0x18')][_0x6242('0x1a')]||null:null,'attributes':_0x466c24['options']?_0x466c24['options'][_0x6242('0x1b')]||null:null,'limit':_0x466c24['options']?_0x466c24[_0x6242('0x18')][_0x6242('0x1c')]||null:null,'include':_0x466c24[_0x6242('0x18')]?_0x466c24[_0x6242('0x18')][_0x6242('0x1d')]?_[_0x6242('0x1e')](_0x466c24[_0x6242('0x18')][_0x6242('0x1d')],function(_0x2148c5){return{'model':db[_0x2148c5[_0x6242('0x1f')]],'as':_0x2148c5['as'],'attributes':_0x2148c5['attributes'],'include':_0x2148c5[_0x6242('0x1d')]?_[_0x6242('0x1e')](_0x2148c5[_0x6242('0x1d')],function(_0x1ed10b){return{'model':db[_0x1ed10b[_0x6242('0x1f')]],'as':_0x1ed10b['as'],'attributes':_0x1ed10b[_0x6242('0x1b')],'include':_0x1ed10b['include']?_[_0x6242('0x1e')](_0x1ed10b[_0x6242('0x1d')],function(_0x382fc8){return{'model':db[_0x382fc8[_0x6242('0x1f')]],'as':_0x382fc8['as'],'attributes':_0x382fc8[_0x6242('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x237ca2){logger[_0x6242('0xc')](_0x6242('0x20'),_0x466c24);logger[_0x6242('0xf')](_0x6242('0x20'),_0x466c24,JSON[_0x6242('0x11')](_0x237ca2));_0x63e340(_0x237ca2);})[_0x6242('0x21')](function(_0x15a50e){logger[_0x6242('0x12')](_0x6242('0x20'),_0x15a50e[_0x6242('0x14')],_0x466c24);_0x13f9e2(_0x257094['error'](0x1f4,_0x15a50e['message']));});});};exports[_0x6242('0x22')]=function(_0xb965d3){var _0xf29a6c=this;return new Promise(function(_0x3e6dff,_0x11d878){return db[_0x6242('0x16')][_0x6242('0x23')]({'raw':_0xb965d3[_0x6242('0x18')]?_0xb965d3[_0x6242('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xb965d3['options']?_0xb965d3[_0x6242('0x18')]['where']||null:null,'attributes':_0xb965d3[_0x6242('0x18')]?_0xb965d3['options']['attributes']||null:null,'include':_0xb965d3[_0x6242('0x18')]?_0xb965d3['options'][_0x6242('0x1d')]?_[_0x6242('0x1e')](_0xb965d3[_0x6242('0x18')][_0x6242('0x1d')],function(_0x10787f){return{'model':db[_0x10787f[_0x6242('0x1f')]],'as':_0x10787f['as'],'attributes':_0x10787f[_0x6242('0x1b')],'include':_0x10787f[_0x6242('0x1d')]?_[_0x6242('0x1e')](_0x10787f[_0x6242('0x1d')],function(_0x15ab19){return{'model':db[_0x15ab19[_0x6242('0x1f')]],'as':_0x15ab19['as'],'attributes':_0x15ab19[_0x6242('0x1b')],'include':_0x15ab19[_0x6242('0x1d')]?_[_0x6242('0x1e')](_0x15ab19['include'],function(_0x3acfde){return{'model':db[_0x3acfde[_0x6242('0x1f')]],'as':_0x3acfde['as'],'attributes':_0x3acfde['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x504e96){logger[_0x6242('0xc')](_0x6242('0x22'),_0xb965d3);logger[_0x6242('0xf')]('ShowSugarcrmAccount',_0xb965d3,JSON[_0x6242('0x11')](_0x504e96));_0x3e6dff(_0x504e96);})[_0x6242('0x21')](function(_0x352b01){logger['error'](_0x6242('0x22'),_0x352b01[_0x6242('0x14')],_0xb965d3);_0x11d878(_0xf29a6c[_0x6242('0x12')](0x1f4,_0x352b01[_0x6242('0x14')]));});});}; \ No newline at end of file +var _0x563e=['client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfd1bc5,_0x175155){var _0x17d0eb=function(_0x18afe4){while(--_0x18afe4){_0xfd1bc5['push'](_0xfd1bc5['shift']());}};_0x17d0eb(++_0x175155);}(_0x563e,0xeb));var _0xe563=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x563e[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0xe563('0x0'));var util=require('util');var moment=require(_0xe563('0x1'));var BPromise=require(_0xe563('0x2'));var rs=require(_0xe563('0x3'));var fs=require('fs');var Redis=require(_0xe563('0x4'));var db=require(_0xe563('0x5'))['db'];var utils=require(_0xe563('0x6'));var logger=require(_0xe563('0x7'))(_0xe563('0x8'));var config=require(_0xe563('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe563('0xa')][_0xe563('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574099,_0x1932a0,_0x3e5710){return new BPromise(function(_0x38964e,_0x13a012){return client['request'](_0x574099,_0x3e5710)['then'](function(_0xf09ec2){logger[_0xe563('0xc')](_0xe563('0xd'),_0x1932a0,_0xe563('0xe'));logger[_0xe563('0xf')](_0xe563('0x10'),_0x1932a0,_0xe563('0xe'),JSON['stringify'](_0xf09ec2));if(_0xf09ec2['error']){if(_0xf09ec2['error'][_0xe563('0x11')]===0x1f4){logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0xf09ec2[_0xe563('0x12')][_0xe563('0x13')]);return _0x13a012(_0xf09ec2[_0xe563('0x12')]['message']);}logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0xf09ec2[_0xe563('0x12')][_0xe563('0x13')]);return _0x38964e(_0xf09ec2[_0xe563('0x12')]['message']);}else{logger[_0xe563('0xc')](_0xe563('0xd'),_0x1932a0,_0xe563('0xe'));_0x38964e(_0xf09ec2[_0xe563('0x14')]['message']);}})[_0xe563('0x15')](function(_0x4f498f){logger[_0xe563('0x12')](_0xe563('0xd'),_0x1932a0,_0x4f498f);_0x13a012(_0x4f498f);});});}exports[_0xe563('0x16')]=function(_0x279ef0){var _0x2a4bf2=this;return new Promise(function(_0x26bf97,_0x46fbf0){return db[_0xe563('0x17')][_0xe563('0x18')]({'raw':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x279ef0[_0xe563('0x19')]?_0x279ef0['options'][_0xe563('0x1a')]||null:null,'attributes':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1b')]||null:null,'limit':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1c')]||null:null,'include':_0x279ef0[_0xe563('0x19')]?_0x279ef0[_0xe563('0x19')][_0xe563('0x1d')]?_[_0xe563('0x1e')](_0x279ef0[_0xe563('0x19')]['include'],function(_0x207ab8){return{'model':db[_0x207ab8[_0xe563('0x1f')]],'as':_0x207ab8['as'],'attributes':_0x207ab8['attributes'],'include':_0x207ab8[_0xe563('0x1d')]?_['map'](_0x207ab8[_0xe563('0x1d')],function(_0x3037fe){return{'model':db[_0x3037fe[_0xe563('0x1f')]],'as':_0x3037fe['as'],'attributes':_0x3037fe[_0xe563('0x1b')],'include':_0x3037fe[_0xe563('0x1d')]?_['map'](_0x3037fe['include'],function(_0x5cea20){return{'model':db[_0x5cea20[_0xe563('0x1f')]],'as':_0x5cea20['as'],'attributes':_0x5cea20['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38b852){logger[_0xe563('0xc')](_0xe563('0x16'),_0x279ef0);logger[_0xe563('0xf')](_0xe563('0x16'),_0x279ef0,JSON[_0xe563('0x20')](_0x38b852));_0x26bf97(_0x38b852);})[_0xe563('0x15')](function(_0x34e8a9){logger[_0xe563('0x12')](_0xe563('0x16'),_0x34e8a9[_0xe563('0x13')],_0x279ef0);_0x46fbf0(_0x2a4bf2['error'](0x1f4,_0x34e8a9[_0xe563('0x13')]));});});};exports[_0xe563('0x21')]=function(_0x431687){var _0x4c0875=this;return new Promise(function(_0x105f83,_0x5ea8eb){return db[_0xe563('0x17')]['find']({'raw':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')][_0xe563('0x1a')]||null:null,'attributes':_0x431687[_0xe563('0x19')]?_0x431687[_0xe563('0x19')][_0xe563('0x1b')]||null:null,'include':_0x431687['options']?_0x431687[_0xe563('0x19')][_0xe563('0x1d')]?_[_0xe563('0x1e')](_0x431687[_0xe563('0x19')][_0xe563('0x1d')],function(_0x1e6ef6){return{'model':db[_0x1e6ef6[_0xe563('0x1f')]],'as':_0x1e6ef6['as'],'attributes':_0x1e6ef6[_0xe563('0x1b')],'include':_0x1e6ef6['include']?_[_0xe563('0x1e')](_0x1e6ef6[_0xe563('0x1d')],function(_0x19fc37){return{'model':db[_0x19fc37[_0xe563('0x1f')]],'as':_0x19fc37['as'],'attributes':_0x19fc37[_0xe563('0x1b')],'include':_0x19fc37['include']?_[_0xe563('0x1e')](_0x19fc37[_0xe563('0x1d')],function(_0x5942b5){return{'model':db[_0x5942b5[_0xe563('0x1f')]],'as':_0x5942b5['as'],'attributes':_0x5942b5[_0xe563('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe563('0x22')](function(_0x22cfde){logger['info'](_0xe563('0x21'),_0x431687);logger[_0xe563('0xf')](_0xe563('0x21'),_0x431687,JSON[_0xe563('0x20')](_0x22cfde));_0x105f83(_0x22cfde);})[_0xe563('0x15')](function(_0x346654){logger[_0xe563('0x12')](_0xe563('0x21'),_0x346654[_0xe563('0x13')],_0x431687);_0x5ea8eb(_0x4c0875[_0xe563('0x12')](0x1f4,_0x346654[_0xe563('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 8e30f05..a6bd3dc 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 _0x42b2=['create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x197338,_0x2516a1){var _0x564c75=function(_0x1cc5b2){while(--_0x1cc5b2){_0x197338['push'](_0x197338['shift']());}};_0x564c75(++_0x2516a1);}(_0x42b2,0x1d3));var _0x242b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x42b2[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require(_0x242b('0x0'));var path=require(_0x242b('0x1'));var timeout=require(_0x242b('0x2'));var express=require(_0x242b('0x3'));var router=express['Router']();var fs_extra=require(_0x242b('0x4'));var auth=require(_0x242b('0x5'));var interaction=require(_0x242b('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x242b('0x7')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x9')]);router['get'](_0x242b('0xa'),auth['isAuthenticated'](),controller[_0x242b('0xb')]);router[_0x242b('0x7')](_0x242b('0xc'),auth[_0x242b('0x8')](),controller['getFields']);router[_0x242b('0x7')]('/:id/subjects',auth[_0x242b('0x8')](),controller[_0x242b('0xd')]);router[_0x242b('0x7')](_0x242b('0xe'),auth['isAuthenticated'](),controller[_0x242b('0xf')]);router['post']('/',auth[_0x242b('0x8')](),controller[_0x242b('0x10')]);router[_0x242b('0x11')](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0x12')]);router['delete'](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0x13')]);module[_0x242b('0x14')]=router; \ No newline at end of file +var _0x87d9=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','/:id','update','delete','destroy'];(function(_0x162305,_0xb6fe6f){var _0x366761=function(_0x4e6025){while(--_0x4e6025){_0x162305['push'](_0x162305['shift']());}};_0x366761(++_0xb6fe6f);}(_0x87d9,0x93));var _0x987d=function(_0x1c223c,_0x3cef2f){_0x1c223c=_0x1c223c-0x0;var _0x141766=_0x87d9[_0x1c223c];return _0x141766;};'use strict';var multer=require(_0x987d('0x0'));var util=require(_0x987d('0x1'));var path=require(_0x987d('0x2'));var timeout=require(_0x987d('0x3'));var express=require('express');var router=express[_0x987d('0x4')]();var fs_extra=require(_0x987d('0x5'));var auth=require(_0x987d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x987d('0x7'));router['get']('/',auth[_0x987d('0x8')](),controller[_0x987d('0x9')]);router[_0x987d('0xa')]('/:id',auth[_0x987d('0x8')](),controller[_0x987d('0xb')]);router[_0x987d('0xa')](_0x987d('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x987d('0xa')](_0x987d('0xd'),auth[_0x987d('0x8')](),controller[_0x987d('0xe')]);router[_0x987d('0xa')]('/:id/descriptions',auth[_0x987d('0x8')](),controller[_0x987d('0xf')]);router[_0x987d('0x10')]('/',auth[_0x987d('0x8')](),controller['create']);router['put'](_0x987d('0x11'),auth[_0x987d('0x8')](),controller[_0x987d('0x12')]);router[_0x987d('0x13')](_0x987d('0x11'),auth[_0x987d('0x8')](),controller[_0x987d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 87242a9..dd17bf2 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 _0xb81e=['sequelize','exports','STRING'];(function(_0x4556e2,_0x418392){var _0xd87738=function(_0x130328){while(--_0x130328){_0x4556e2['push'](_0x4556e2['shift']());}};_0xd87738(++_0x418392);}(_0xb81e,0x16b));var _0xeb81=function(_0xbd20e,_0x4761b3){_0xbd20e=_0xbd20e-0x0;var _0x3eab2c=_0xb81e[_0xbd20e];return _0x3eab2c;};'use strict';var Sequelize=require(_0xeb81('0x0'));module[_0xeb81('0x1')]={'name':{'type':Sequelize[_0xeb81('0x2')]},'description':{'type':Sequelize[_0xeb81('0x2')]}}; \ No newline at end of file +var _0xd293=['STRING','sequelize'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xd293,0xb1));var _0x3d29=function(_0x2830d8,_0x3f31f4){_0x2830d8=_0x2830d8-0x0;var _0x58541c=_0xd293[_0x2830d8];return _0x58541c;};'use strict';var Sequelize=require(_0x3d29('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d29('0x1')]},'description':{'type':Sequelize[_0x3d29('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 872104f..766ce1e 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 _0xf7f8=['update','then','end','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','model','keys','query','filters','attributes','fields','length','nolimit','order','where','pick','merge','filter','options','includeAll','rows','catch','show','params','rawAttributes','intersection','create','body','find','destroy','getFields','findOne','SugarcrmField','sort','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject'];(function(_0xe1d065,_0x39ab64){var _0x481700=function(_0x34947a){while(--_0x34947a){_0xe1d065['push'](_0xe1d065['shift']());}};_0x481700(++_0x39ab64);}(_0xf7f8,0x114));var _0x8f7f=function(_0x185364,_0x91746b){_0x185364=_0x185364-0x0;var _0x58a641=_0xf7f8[_0x185364];return _0x58a641;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f7f('0x0'));var zipdir=require(_0x8f7f('0x1'));var jsonpatch=require(_0x8f7f('0x2'));var rp=require(_0x8f7f('0x3'));var moment=require('moment');var BPromise=require(_0x8f7f('0x4'));var Mustache=require(_0x8f7f('0x5'));var util=require(_0x8f7f('0x6'));var path=require(_0x8f7f('0x7'));var sox=require(_0x8f7f('0x8'));var csv=require(_0x8f7f('0x9'));var ejs=require(_0x8f7f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f7f('0xb'));var squel=require(_0x8f7f('0xc'));var crypto=require('crypto');var jsforce=require(_0x8f7f('0xd'));var deskjs=require(_0x8f7f('0xe'));var toCsv=require(_0x8f7f('0x9'));var querystring=require(_0x8f7f('0xf'));var Papa=require(_0x8f7f('0x10'));var Redis=require(_0x8f7f('0x11'));var authService=require(_0x8f7f('0x12'));var qs=require(_0x8f7f('0x13'));var as=require(_0x8f7f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f7f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f7f('0x16'))['db'];function respondWithStatusCode(_0x3eae89,_0x54418a){_0x54418a=_0x54418a||0xcc;return function(_0x365b36){if(_0x365b36){return _0x3eae89['sendStatus'](_0x54418a);}return _0x3eae89[_0x8f7f('0x17')](_0x54418a)['end']();};}function respondWithResult(_0x50c84a,_0x387595){_0x387595=_0x387595||0xc8;return function(_0x14adfd){if(_0x14adfd){return _0x50c84a['status'](_0x387595)[_0x8f7f('0x18')](_0x14adfd);}};}function respondWithFilteredResult(_0x4d3a84,_0x86d1f0){return function(_0x437761){if(_0x437761){var _0x323bde=typeof _0x86d1f0['offset']===_0x8f7f('0x19')&&typeof _0x86d1f0[_0x8f7f('0x1a')]===_0x8f7f('0x19');var _0x762bc=_0x437761[_0x8f7f('0x1b')];var _0x24a939=_0x323bde?0x0:_0x86d1f0[_0x8f7f('0x1c')];var _0x12663a=_0x323bde?_0x437761[_0x8f7f('0x1b')]:_0x86d1f0[_0x8f7f('0x1c')]+_0x86d1f0[_0x8f7f('0x1a')];var _0x3b90e5;if(_0x12663a>=_0x762bc){_0x12663a=_0x762bc;_0x3b90e5=0xc8;}else{_0x3b90e5=0xce;}_0x4d3a84[_0x8f7f('0x17')](_0x3b90e5);return _0x4d3a84[_0x8f7f('0x1d')]('Content-Range',_0x24a939+'-'+_0x12663a+'/'+_0x762bc)[_0x8f7f('0x18')](_0x437761);}return null;};}function patchUpdates(_0x6713b1){return function(_0x21382c){try{jsonpatch[_0x8f7f('0x1e')](_0x21382c,_0x6713b1,!![]);}catch(_0x3ddd7b){return BPromise[_0x8f7f('0x1f')](_0x3ddd7b);}return _0x21382c['save']();};}function saveUpdates(_0x3c2259,_0x1e8559){return function(_0x31c1e5){if(_0x31c1e5){return _0x31c1e5[_0x8f7f('0x20')](_0x3c2259)[_0x8f7f('0x21')](function(_0x6b23cd){return _0x6b23cd;});}return null;};}function removeEntity(_0x308511,_0x153bb6){return function(_0x4ca556){if(_0x4ca556){return _0x4ca556['destroy']()[_0x8f7f('0x21')](function(){_0x308511[_0x8f7f('0x17')](0xcc)[_0x8f7f('0x22')]();});}};}function handleEntityNotFound(_0x1036dc,_0x810d1d){return function(_0x237a83){if(!_0x237a83){_0x1036dc[_0x8f7f('0x23')](0x194);}return _0x237a83;};}function handleError(_0x176e09,_0x294591){_0x294591=_0x294591||0x1f4;return function(_0x3cf682){logger[_0x8f7f('0x24')](_0x3cf682[_0x8f7f('0x25')]);if(_0x3cf682[_0x8f7f('0x26')]){delete _0x3cf682[_0x8f7f('0x26')];}_0x176e09[_0x8f7f('0x17')](_0x294591)['send'](_0x3cf682);};}exports[_0x8f7f('0x27')]=function(_0xcb192d,_0x570a9b){var _0x4acea6={},_0x2941d8={},_0x156419={'count':0x0,'rows':[]};var _0x292557=_[_0x8f7f('0x28')](db[_0x8f7f('0x29')]['rawAttributes'],function(_0x4c63b3){return{'name':_0x4c63b3[_0x8f7f('0x2a')],'type':_0x4c63b3[_0x8f7f('0x2b')][_0x8f7f('0x2c')]};});_0x2941d8[_0x8f7f('0x2d')]=_[_0x8f7f('0x28')](_0x292557,'name');_0x2941d8['query']=_[_0x8f7f('0x2e')](_0xcb192d[_0x8f7f('0x2f')]);_0x2941d8[_0x8f7f('0x30')]=_['intersection'](_0x2941d8[_0x8f7f('0x2d')],_0x2941d8[_0x8f7f('0x2f')]);_0x4acea6[_0x8f7f('0x31')]=_['intersection'](_0x2941d8[_0x8f7f('0x2d')],qs[_0x8f7f('0x32')](_0xcb192d[_0x8f7f('0x2f')]['fields']));_0x4acea6[_0x8f7f('0x31')]=_0x4acea6['attributes'][_0x8f7f('0x33')]?_0x4acea6['attributes']:_0x2941d8['model'];if(!_0xcb192d[_0x8f7f('0x2f')]['hasOwnProperty'](_0x8f7f('0x34'))){_0x4acea6[_0x8f7f('0x1a')]=qs[_0x8f7f('0x1a')](_0xcb192d[_0x8f7f('0x2f')][_0x8f7f('0x1a')]);_0x4acea6[_0x8f7f('0x1c')]=qs[_0x8f7f('0x1c')](_0xcb192d[_0x8f7f('0x2f')][_0x8f7f('0x1c')]);}_0x4acea6[_0x8f7f('0x35')]=qs['sort'](_0xcb192d[_0x8f7f('0x2f')]['sort']);_0x4acea6[_0x8f7f('0x36')]=qs['filters'](_[_0x8f7f('0x37')](_0xcb192d['query'],_0x2941d8['filters']),_0x292557);if(_0xcb192d[_0x8f7f('0x2f')]['filter']){_0x4acea6[_0x8f7f('0x36')]=_[_0x8f7f('0x38')](_0x4acea6['where'],{'$or':_[_0x8f7f('0x28')](_0x292557,function(_0x4ae801){if(_0x4ae801[_0x8f7f('0x2b')]!=='VIRTUAL'){var _0x4d4f5e={};_0x4d4f5e[_0x4ae801['name']]={'$like':'%'+_0xcb192d['query'][_0x8f7f('0x39')]+'%'};return _0x4d4f5e;}})});}_0x4acea6=_[_0x8f7f('0x38')]({},_0x4acea6,_0xcb192d[_0x8f7f('0x3a')]);var _0x1b424c={'where':_0x4acea6[_0x8f7f('0x36')]};return db['SugarcrmConfiguration'][_0x8f7f('0x1b')](_0x1b424c)[_0x8f7f('0x21')](function(_0x1487e0){_0x156419['count']=_0x1487e0;if(_0xcb192d[_0x8f7f('0x2f')][_0x8f7f('0x3b')]){_0x4acea6['include']=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x4acea6);})[_0x8f7f('0x21')](function(_0xb41f2b){_0x156419[_0x8f7f('0x3c')]=_0xb41f2b;return _0x156419;})[_0x8f7f('0x21')](respondWithFilteredResult(_0x570a9b,_0x4acea6))[_0x8f7f('0x3d')](handleError(_0x570a9b,null));};exports[_0x8f7f('0x3e')]=function(_0x14b28f,_0x335778){var _0x191d14={'raw':![],'where':{'id':_0x14b28f[_0x8f7f('0x3f')]['id']}},_0x20e672={};_0x20e672[_0x8f7f('0x2d')]=_[_0x8f7f('0x2e')](db['SugarcrmConfiguration'][_0x8f7f('0x40')]);_0x20e672[_0x8f7f('0x2f')]=_['keys'](_0x14b28f[_0x8f7f('0x2f')]);_0x20e672['filters']=_[_0x8f7f('0x41')](_0x20e672['model'],_0x20e672[_0x8f7f('0x2f')]);_0x191d14[_0x8f7f('0x31')]=_[_0x8f7f('0x41')](_0x20e672['model'],qs[_0x8f7f('0x32')](_0x14b28f[_0x8f7f('0x2f')][_0x8f7f('0x32')]));_0x191d14[_0x8f7f('0x31')]=_0x191d14[_0x8f7f('0x31')][_0x8f7f('0x33')]?_0x191d14[_0x8f7f('0x31')]:_0x20e672[_0x8f7f('0x2d')];if(_0x14b28f['query']['includeAll']){_0x191d14['include']=[{'all':!![]}];}_0x191d14=_[_0x8f7f('0x38')]({},_0x191d14,_0x14b28f[_0x8f7f('0x3a')]);return db[_0x8f7f('0x29')]['find'](_0x191d14)[_0x8f7f('0x21')](handleEntityNotFound(_0x335778,null))[_0x8f7f('0x21')](respondWithResult(_0x335778,null))[_0x8f7f('0x3d')](handleError(_0x335778,null));};exports[_0x8f7f('0x42')]=function(_0x59e0e6,_0x2dd098){return db['SugarcrmConfiguration'][_0x8f7f('0x42')](_0x59e0e6[_0x8f7f('0x43')],{})[_0x8f7f('0x21')](respondWithResult(_0x2dd098,0xc9))[_0x8f7f('0x3d')](handleError(_0x2dd098,null));};exports[_0x8f7f('0x20')]=function(_0x2a9a32,_0x4324e3){if(_0x2a9a32['body']['id']){delete _0x2a9a32[_0x8f7f('0x43')]['id'];}return db[_0x8f7f('0x29')][_0x8f7f('0x44')]({'where':{'id':_0x2a9a32[_0x8f7f('0x3f')]['id']}})[_0x8f7f('0x21')](handleEntityNotFound(_0x4324e3,null))[_0x8f7f('0x21')](saveUpdates(_0x2a9a32[_0x8f7f('0x43')],null))[_0x8f7f('0x21')](respondWithResult(_0x4324e3,null))['catch'](handleError(_0x4324e3,null));};exports[_0x8f7f('0x45')]=function(_0x2ecb10,_0x15fdfa){return db[_0x8f7f('0x29')]['find']({'where':{'id':_0x2ecb10[_0x8f7f('0x3f')]['id']}})[_0x8f7f('0x21')](handleEntityNotFound(_0x15fdfa,null))[_0x8f7f('0x21')](removeEntity(_0x15fdfa,null))[_0x8f7f('0x3d')](handleError(_0x15fdfa,null));};exports[_0x8f7f('0x46')]=function(_0x4ac42f,_0x5f1d55,_0x30704c){var _0x57c8c6={};var _0x12f1ac={};var _0x2893a8;var _0x4c5b21;return db[_0x8f7f('0x29')][_0x8f7f('0x47')]({'where':{'id':_0x4ac42f['params']['id']}})[_0x8f7f('0x21')](handleEntityNotFound(_0x5f1d55,null))[_0x8f7f('0x21')](function(_0x2ee698){if(_0x2ee698){_0x2893a8=_0x2ee698;_0x12f1ac[_0x8f7f('0x2d')]=_[_0x8f7f('0x2e')](db[_0x8f7f('0x48')]['rawAttributes']);_0x12f1ac['query']=_[_0x8f7f('0x2e')](_0x4ac42f[_0x8f7f('0x2f')]);_0x12f1ac['filters']=_[_0x8f7f('0x41')](_0x12f1ac[_0x8f7f('0x2d')],_0x12f1ac[_0x8f7f('0x2f')]);_0x57c8c6['attributes']=_['intersection'](_0x12f1ac[_0x8f7f('0x2d')],qs[_0x8f7f('0x32')](_0x4ac42f[_0x8f7f('0x2f')][_0x8f7f('0x32')]));_0x57c8c6[_0x8f7f('0x31')]=_0x57c8c6[_0x8f7f('0x31')][_0x8f7f('0x33')]?_0x57c8c6['attributes']:_0x12f1ac[_0x8f7f('0x2d')];_0x57c8c6[_0x8f7f('0x35')]=qs[_0x8f7f('0x49')](_0x4ac42f['query']['sort']);_0x57c8c6[_0x8f7f('0x36')]=qs['filters'](_[_0x8f7f('0x37')](_0x4ac42f[_0x8f7f('0x2f')],_0x12f1ac[_0x8f7f('0x30')]));if(_0x4ac42f[_0x8f7f('0x2f')][_0x8f7f('0x39')]){_0x57c8c6[_0x8f7f('0x36')]=_[_0x8f7f('0x38')](_0x57c8c6[_0x8f7f('0x36')],{'$or':_[_0x8f7f('0x28')](_0x57c8c6['attributes'],function(_0x334e6d){var _0x45cc60={};_0x45cc60[_0x334e6d]={'$like':'%'+_0x4ac42f[_0x8f7f('0x2f')]['filter']+'%'};return _0x45cc60;})});}_0x57c8c6=_[_0x8f7f('0x38')]({},_0x57c8c6,_0x4ac42f[_0x8f7f('0x3a')]);return _0x2893a8[_0x8f7f('0x46')](_0x57c8c6);}})[_0x8f7f('0x21')](function(_0x59ef1b){if(_0x59ef1b){_0x4c5b21=_0x59ef1b[_0x8f7f('0x33')];if(!_0x4ac42f[_0x8f7f('0x2f')][_0x8f7f('0x4a')](_0x8f7f('0x34'))){_0x57c8c6[_0x8f7f('0x1a')]=qs[_0x8f7f('0x1a')](_0x4ac42f[_0x8f7f('0x2f')][_0x8f7f('0x1a')]);_0x57c8c6[_0x8f7f('0x1c')]=qs[_0x8f7f('0x1c')](_0x4ac42f[_0x8f7f('0x2f')][_0x8f7f('0x1c')]);}return _0x2893a8[_0x8f7f('0x46')](_0x57c8c6);}})[_0x8f7f('0x21')](function(_0x57a717){if(_0x57a717){return _0x57a717?{'count':_0x4c5b21,'rows':_0x57a717}:null;}})[_0x8f7f('0x21')](respondWithResult(_0x5f1d55,null))[_0x8f7f('0x3d')](handleError(_0x5f1d55,null));};exports['getSubjects']=function(_0x5bb110,_0x33ec99,_0x359a2e){var _0x47cc49={};var _0x2d36a7={};var _0x48d206;var _0x556525;return db['SugarcrmConfiguration'][_0x8f7f('0x47')]({'where':{'id':_0x5bb110[_0x8f7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x33ec99,null))[_0x8f7f('0x21')](function(_0x19caad){if(_0x19caad){_0x48d206=_0x19caad;_0x2d36a7[_0x8f7f('0x2d')]=_[_0x8f7f('0x2e')](db[_0x8f7f('0x48')][_0x8f7f('0x40')]);_0x2d36a7[_0x8f7f('0x2f')]=_['keys'](_0x5bb110[_0x8f7f('0x2f')]);_0x2d36a7[_0x8f7f('0x30')]=_[_0x8f7f('0x41')](_0x2d36a7[_0x8f7f('0x2d')],_0x2d36a7['query']);_0x47cc49[_0x8f7f('0x31')]=_[_0x8f7f('0x41')](_0x2d36a7[_0x8f7f('0x2d')],qs[_0x8f7f('0x32')](_0x5bb110['query'][_0x8f7f('0x32')]));_0x47cc49[_0x8f7f('0x31')]=_0x47cc49['attributes']['length']?_0x47cc49[_0x8f7f('0x31')]:_0x2d36a7[_0x8f7f('0x2d')];_0x47cc49['order']=qs[_0x8f7f('0x49')](_0x5bb110[_0x8f7f('0x2f')]['sort']);_0x47cc49[_0x8f7f('0x36')]=qs[_0x8f7f('0x30')](_[_0x8f7f('0x37')](_0x5bb110['query'],_0x2d36a7[_0x8f7f('0x30')]));if(_0x5bb110[_0x8f7f('0x2f')][_0x8f7f('0x39')]){_0x47cc49[_0x8f7f('0x36')]=_['merge'](_0x47cc49['where'],{'$or':_[_0x8f7f('0x28')](_0x47cc49[_0x8f7f('0x31')],function(_0x35393d){var _0x3b5293={};_0x3b5293[_0x35393d]={'$like':'%'+_0x5bb110[_0x8f7f('0x2f')][_0x8f7f('0x39')]+'%'};return _0x3b5293;})});}_0x47cc49=_[_0x8f7f('0x38')]({},_0x47cc49,_0x5bb110[_0x8f7f('0x3a')]);return _0x48d206[_0x8f7f('0x4b')](_0x47cc49);}})[_0x8f7f('0x21')](function(_0x486440){if(_0x486440){_0x556525=_0x486440[_0x8f7f('0x33')];if(!_0x5bb110[_0x8f7f('0x2f')]['hasOwnProperty'](_0x8f7f('0x34'))){_0x47cc49[_0x8f7f('0x1a')]=qs[_0x8f7f('0x1a')](_0x5bb110[_0x8f7f('0x2f')]['limit']);_0x47cc49[_0x8f7f('0x1c')]=qs[_0x8f7f('0x1c')](_0x5bb110[_0x8f7f('0x2f')]['offset']);}return _0x48d206[_0x8f7f('0x4b')](_0x47cc49);}})[_0x8f7f('0x21')](function(_0x5c6729){if(_0x5c6729){return _0x5c6729?{'count':_0x556525,'rows':_0x5c6729}:null;}})[_0x8f7f('0x21')](respondWithResult(_0x33ec99,null))[_0x8f7f('0x3d')](handleError(_0x33ec99,null));};exports[_0x8f7f('0x4c')]=function(_0x5b8211,_0x20c362,_0xa01f24){var _0xab49b7={};var _0x2d718e={};var _0xbe4e54;var _0xe9ff46;return db[_0x8f7f('0x29')][_0x8f7f('0x47')]({'where':{'id':_0x5b8211[_0x8f7f('0x3f')]['id']}})[_0x8f7f('0x21')](handleEntityNotFound(_0x20c362,null))[_0x8f7f('0x21')](function(_0x221460){if(_0x221460){_0xbe4e54=_0x221460;_0x2d718e[_0x8f7f('0x2d')]=_[_0x8f7f('0x2e')](db['SugarcrmField'][_0x8f7f('0x40')]);_0x2d718e[_0x8f7f('0x2f')]=_[_0x8f7f('0x2e')](_0x5b8211[_0x8f7f('0x2f')]);_0x2d718e[_0x8f7f('0x30')]=_['intersection'](_0x2d718e[_0x8f7f('0x2d')],_0x2d718e[_0x8f7f('0x2f')]);_0xab49b7[_0x8f7f('0x31')]=_['intersection'](_0x2d718e[_0x8f7f('0x2d')],qs[_0x8f7f('0x32')](_0x5b8211[_0x8f7f('0x2f')][_0x8f7f('0x32')]));_0xab49b7[_0x8f7f('0x31')]=_0xab49b7[_0x8f7f('0x31')][_0x8f7f('0x33')]?_0xab49b7[_0x8f7f('0x31')]:_0x2d718e[_0x8f7f('0x2d')];_0xab49b7['order']=qs['sort'](_0x5b8211[_0x8f7f('0x2f')][_0x8f7f('0x49')]);_0xab49b7[_0x8f7f('0x36')]=qs[_0x8f7f('0x30')](_[_0x8f7f('0x37')](_0x5b8211['query'],_0x2d718e[_0x8f7f('0x30')]));if(_0x5b8211[_0x8f7f('0x2f')][_0x8f7f('0x39')]){_0xab49b7['where']=_[_0x8f7f('0x38')](_0xab49b7[_0x8f7f('0x36')],{'$or':_[_0x8f7f('0x28')](_0xab49b7[_0x8f7f('0x31')],function(_0x164493){var _0x95969b={};_0x95969b[_0x164493]={'$like':'%'+_0x5b8211[_0x8f7f('0x2f')]['filter']+'%'};return _0x95969b;})});}_0xab49b7=_[_0x8f7f('0x38')]({},_0xab49b7,_0x5b8211[_0x8f7f('0x3a')]);return _0xbe4e54['getDescriptions'](_0xab49b7);}})['then'](function(_0x5236f2){if(_0x5236f2){_0xe9ff46=_0x5236f2[_0x8f7f('0x33')];if(!_0x5b8211['query'][_0x8f7f('0x4a')](_0x8f7f('0x34'))){_0xab49b7[_0x8f7f('0x1a')]=qs[_0x8f7f('0x1a')](_0x5b8211[_0x8f7f('0x2f')]['limit']);_0xab49b7['offset']=qs[_0x8f7f('0x1c')](_0x5b8211[_0x8f7f('0x2f')][_0x8f7f('0x1c')]);}return _0xbe4e54[_0x8f7f('0x4c')](_0xab49b7);}})[_0x8f7f('0x21')](function(_0x367f70){if(_0x367f70){return _0x367f70?{'count':_0xe9ff46,'rows':_0x367f70}:null;}})[_0x8f7f('0x21')](respondWithResult(_0x20c362,null))[_0x8f7f('0x3d')](handleError(_0x20c362,null));}; \ No newline at end of file +var _0xb85d=['type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SugarcrmConfiguration','include','rows','catch','params','rawAttributes','includeAll','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','fieldName'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xb85d,0x19e));var _0xdb85=function(_0x5071dc,_0x1f2cee){_0x5071dc=_0x5071dc-0x0;var _0x12d1d7=_0xb85d[_0x5071dc];return _0x12d1d7;};'use strict';var emlformat=require(_0xdb85('0x0'));var rimraf=require(_0xdb85('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb85('0x2'));var rp=require('request-promise');var moment=require(_0xdb85('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdb85('0x4'));var util=require(_0xdb85('0x5'));var path=require(_0xdb85('0x6'));var sox=require(_0xdb85('0x7'));var csv=require('to-csv');var ejs=require(_0xdb85('0x8'));var fs=require('fs');var fs_extra=require(_0xdb85('0x9'));var _=require(_0xdb85('0xa'));var squel=require(_0xdb85('0xb'));var crypto=require('crypto');var jsforce=require(_0xdb85('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb85('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb85('0xe'));var authService=require(_0xdb85('0xf'));var qs=require(_0xdb85('0x10'));var as=require(_0xdb85('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb85('0x12'))(_0xdb85('0x13'));var utils=require('../../config/utils');var config=require(_0xdb85('0x14'));var licenseUtil=require(_0xdb85('0x15'));var db=require(_0xdb85('0x16'))['db'];function respondWithStatusCode(_0x2f18a0,_0x18aa9b){_0x18aa9b=_0x18aa9b||0xcc;return function(_0x3e6c47){if(_0x3e6c47){return _0x2f18a0['sendStatus'](_0x18aa9b);}return _0x2f18a0[_0xdb85('0x17')](_0x18aa9b)[_0xdb85('0x18')]();};}function respondWithResult(_0x3f506d,_0x51b5fe){_0x51b5fe=_0x51b5fe||0xc8;return function(_0x35e5ba){if(_0x35e5ba){return _0x3f506d['status'](_0x51b5fe)['json'](_0x35e5ba);}};}function respondWithFilteredResult(_0x10f4ff,_0x1669aa){return function(_0x2bc238){if(_0x2bc238){var _0x4bdeb4=typeof _0x1669aa[_0xdb85('0x19')]===_0xdb85('0x1a')&&typeof _0x1669aa[_0xdb85('0x1b')]===_0xdb85('0x1a');var _0x188b4b=_0x2bc238[_0xdb85('0x1c')];var _0x3e7501=_0x4bdeb4?0x0:_0x1669aa[_0xdb85('0x19')];var _0x38002c=_0x4bdeb4?_0x2bc238[_0xdb85('0x1c')]:_0x1669aa['offset']+_0x1669aa['limit'];var _0x32cdeb;if(_0x38002c>=_0x188b4b){_0x38002c=_0x188b4b;_0x32cdeb=0xc8;}else{_0x32cdeb=0xce;}_0x10f4ff[_0xdb85('0x17')](_0x32cdeb);return _0x10f4ff['set']('Content-Range',_0x3e7501+'-'+_0x38002c+'/'+_0x188b4b)[_0xdb85('0x1d')](_0x2bc238);}return null;};}function patchUpdates(_0xfcbe46){return function(_0x25f50b){try{jsonpatch[_0xdb85('0x1e')](_0x25f50b,_0xfcbe46,!![]);}catch(_0x5aba63){return BPromise[_0xdb85('0x1f')](_0x5aba63);}return _0x25f50b[_0xdb85('0x20')]();};}function saveUpdates(_0x24995c,_0x583eba){return function(_0x298f29){if(_0x298f29){return _0x298f29[_0xdb85('0x21')](_0x24995c)[_0xdb85('0x22')](function(_0x3d4722){return _0x3d4722;});}return null;};}function removeEntity(_0x1b15ca,_0xb87f03){return function(_0x4079b5){if(_0x4079b5){return _0x4079b5[_0xdb85('0x23')]()['then'](function(){_0x1b15ca[_0xdb85('0x17')](0xcc)[_0xdb85('0x18')]();});}};}function handleEntityNotFound(_0x31d9b7,_0x49ebef){return function(_0x490a75){if(!_0x490a75){_0x31d9b7[_0xdb85('0x24')](0x194);}return _0x490a75;};}function handleError(_0x34d609,_0x3aaf79){_0x3aaf79=_0x3aaf79||0x1f4;return function(_0x54da7a){logger['error'](_0x54da7a['stack']);if(_0x54da7a[_0xdb85('0x25')]){delete _0x54da7a[_0xdb85('0x25')];}_0x34d609['status'](_0x3aaf79)[_0xdb85('0x26')](_0x54da7a);};}exports[_0xdb85('0x27')]=function(_0x121e93,_0x596070){var _0xa70a63={},_0x4959cd={},_0x147cfb={'count':0x0,'rows':[]};var _0xcece5d=_[_0xdb85('0x28')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x21f86f){return{'name':_0x21f86f[_0xdb85('0x29')],'type':_0x21f86f[_0xdb85('0x2a')]['key']};});_0x4959cd[_0xdb85('0x2b')]=_[_0xdb85('0x28')](_0xcece5d,_0xdb85('0x25'));_0x4959cd[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x121e93['query']);_0x4959cd[_0xdb85('0x2e')]=_['intersection'](_0x4959cd['model'],_0x4959cd[_0xdb85('0x2c')]);_0xa70a63[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x4959cd[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x121e93['query'][_0xdb85('0x31')]));_0xa70a63[_0xdb85('0x2f')]=_0xa70a63[_0xdb85('0x2f')][_0xdb85('0x32')]?_0xa70a63[_0xdb85('0x2f')]:_0x4959cd[_0xdb85('0x2b')];if(!_0x121e93[_0xdb85('0x2c')]['hasOwnProperty'](_0xdb85('0x33'))){_0xa70a63[_0xdb85('0x1b')]=qs['limit'](_0x121e93[_0xdb85('0x2c')]['limit']);_0xa70a63[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x121e93[_0xdb85('0x2c')][_0xdb85('0x19')]);}_0xa70a63[_0xdb85('0x34')]=qs[_0xdb85('0x35')](_0x121e93[_0xdb85('0x2c')]['sort']);_0xa70a63[_0xdb85('0x36')]=qs[_0xdb85('0x2e')](_['pick'](_0x121e93['query'],_0x4959cd[_0xdb85('0x2e')]),_0xcece5d);if(_0x121e93['query'][_0xdb85('0x37')]){_0xa70a63['where']=_['merge'](_0xa70a63[_0xdb85('0x36')],{'$or':_[_0xdb85('0x28')](_0xcece5d,function(_0x9acf6e){if(_0x9acf6e[_0xdb85('0x2a')]!==_0xdb85('0x38')){var _0x17a7b9={};_0x17a7b9[_0x9acf6e['name']]={'$like':'%'+_0x121e93[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x17a7b9;}})});}_0xa70a63=_[_0xdb85('0x39')]({},_0xa70a63,_0x121e93[_0xdb85('0x3a')]);var _0x2a3c27={'where':_0xa70a63['where']};return db[_0xdb85('0x3b')][_0xdb85('0x1c')](_0x2a3c27)[_0xdb85('0x22')](function(_0x30589a){_0x147cfb['count']=_0x30589a;if(_0x121e93['query']['includeAll']){_0xa70a63[_0xdb85('0x3c')]=[{'all':!![]}];}return db[_0xdb85('0x3b')]['findAll'](_0xa70a63);})[_0xdb85('0x22')](function(_0x1418d2){_0x147cfb[_0xdb85('0x3d')]=_0x1418d2;return _0x147cfb;})[_0xdb85('0x22')](respondWithFilteredResult(_0x596070,_0xa70a63))[_0xdb85('0x3e')](handleError(_0x596070,null));};exports['show']=function(_0x329bea,_0xa59771){var _0x43ac10={'raw':![],'where':{'id':_0x329bea[_0xdb85('0x3f')]['id']}},_0x38c5f9={};_0x38c5f9[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db['SugarcrmConfiguration'][_0xdb85('0x40')]);_0x38c5f9['query']=_[_0xdb85('0x2d')](_0x329bea[_0xdb85('0x2c')]);_0x38c5f9[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x38c5f9[_0xdb85('0x2b')],_0x38c5f9[_0xdb85('0x2c')]);_0x43ac10['attributes']=_[_0xdb85('0x30')](_0x38c5f9[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x329bea[_0xdb85('0x2c')][_0xdb85('0x31')]));_0x43ac10[_0xdb85('0x2f')]=_0x43ac10['attributes'][_0xdb85('0x32')]?_0x43ac10[_0xdb85('0x2f')]:_0x38c5f9['model'];if(_0x329bea[_0xdb85('0x2c')][_0xdb85('0x41')]){_0x43ac10[_0xdb85('0x3c')]=[{'all':!![]}];}_0x43ac10=_[_0xdb85('0x39')]({},_0x43ac10,_0x329bea[_0xdb85('0x3a')]);return db[_0xdb85('0x3b')][_0xdb85('0x42')](_0x43ac10)[_0xdb85('0x22')](handleEntityNotFound(_0xa59771,null))[_0xdb85('0x22')](respondWithResult(_0xa59771,null))[_0xdb85('0x3e')](handleError(_0xa59771,null));};exports['create']=function(_0x2f5532,_0x148f50){return db[_0xdb85('0x3b')][_0xdb85('0x43')](_0x2f5532[_0xdb85('0x44')],{})[_0xdb85('0x22')](respondWithResult(_0x148f50,0xc9))[_0xdb85('0x3e')](handleError(_0x148f50,null));};exports[_0xdb85('0x21')]=function(_0x24e568,_0xef2017){if(_0x24e568['body']['id']){delete _0x24e568[_0xdb85('0x44')]['id'];}return db[_0xdb85('0x3b')][_0xdb85('0x42')]({'where':{'id':_0x24e568[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0xef2017,null))[_0xdb85('0x22')](saveUpdates(_0x24e568[_0xdb85('0x44')],null))[_0xdb85('0x22')](respondWithResult(_0xef2017,null))[_0xdb85('0x3e')](handleError(_0xef2017,null));};exports[_0xdb85('0x23')]=function(_0xf8962d,_0x57a77c){return db[_0xdb85('0x3b')][_0xdb85('0x42')]({'where':{'id':_0xf8962d[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0x57a77c,null))[_0xdb85('0x22')](removeEntity(_0x57a77c,null))[_0xdb85('0x3e')](handleError(_0x57a77c,null));};exports[_0xdb85('0x45')]=function(_0x187c4c,_0x5e1dc0,_0x503a18){var _0x42d053={};var _0x309eb8={};var _0x24fc54;var _0xf06e5d;return db['SugarcrmConfiguration'][_0xdb85('0x46')]({'where':{'id':_0x187c4c[_0xdb85('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5e1dc0,null))[_0xdb85('0x22')](function(_0x5353bd){if(_0x5353bd){_0x24fc54=_0x5353bd;_0x309eb8[_0xdb85('0x2b')]=_['keys'](db[_0xdb85('0x47')][_0xdb85('0x40')]);_0x309eb8[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x187c4c[_0xdb85('0x2c')]);_0x309eb8[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x309eb8['model'],_0x309eb8[_0xdb85('0x2c')]);_0x42d053[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x309eb8[_0xdb85('0x2b')],qs[_0xdb85('0x31')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x31')]));_0x42d053[_0xdb85('0x2f')]=_0x42d053['attributes']['length']?_0x42d053[_0xdb85('0x2f')]:_0x309eb8[_0xdb85('0x2b')];_0x42d053['order']=qs['sort'](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x35')]);_0x42d053[_0xdb85('0x36')]=qs['filters'](_[_0xdb85('0x48')](_0x187c4c[_0xdb85('0x2c')],_0x309eb8['filters']));if(_0x187c4c[_0xdb85('0x2c')]['filter']){_0x42d053['where']=_[_0xdb85('0x39')](_0x42d053[_0xdb85('0x36')],{'$or':_['map'](_0x42d053['attributes'],function(_0x59bc2c){var _0x2540ca={};_0x2540ca[_0x59bc2c]={'$like':'%'+_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x2540ca;})});}_0x42d053=_[_0xdb85('0x39')]({},_0x42d053,_0x187c4c['options']);return _0x24fc54[_0xdb85('0x45')](_0x42d053);}})['then'](function(_0x110fba){if(_0x110fba){_0xf06e5d=_0x110fba[_0xdb85('0x32')];if(!_0x187c4c[_0xdb85('0x2c')]['hasOwnProperty'](_0xdb85('0x33'))){_0x42d053[_0xdb85('0x1b')]=qs[_0xdb85('0x1b')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x1b')]);_0x42d053[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x187c4c[_0xdb85('0x2c')][_0xdb85('0x19')]);}return _0x24fc54[_0xdb85('0x45')](_0x42d053);}})[_0xdb85('0x22')](function(_0x197fd2){if(_0x197fd2){return _0x197fd2?{'count':_0xf06e5d,'rows':_0x197fd2}:null;}})[_0xdb85('0x22')](respondWithResult(_0x5e1dc0,null))['catch'](handleError(_0x5e1dc0,null));};exports['getSubjects']=function(_0x23fb80,_0x3112e4,_0xa02d0a){var _0x1341cd={};var _0xe77516={};var _0x5ec64e;var _0x4f21c8;return db[_0xdb85('0x3b')][_0xdb85('0x46')]({'where':{'id':_0x23fb80[_0xdb85('0x3f')]['id']}})[_0xdb85('0x22')](handleEntityNotFound(_0x3112e4,null))[_0xdb85('0x22')](function(_0x1df534){if(_0x1df534){_0x5ec64e=_0x1df534;_0xe77516[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db['SugarcrmField'][_0xdb85('0x40')]);_0xe77516[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x23fb80[_0xdb85('0x2c')]);_0xe77516[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0xe77516[_0xdb85('0x2b')],_0xe77516[_0xdb85('0x2c')]);_0x1341cd['attributes']=_[_0xdb85('0x30')](_0xe77516[_0xdb85('0x2b')],qs['fields'](_0x23fb80['query'][_0xdb85('0x31')]));_0x1341cd['attributes']=_0x1341cd[_0xdb85('0x2f')]['length']?_0x1341cd[_0xdb85('0x2f')]:_0xe77516[_0xdb85('0x2b')];_0x1341cd[_0xdb85('0x34')]=qs[_0xdb85('0x35')](_0x23fb80['query'][_0xdb85('0x35')]);_0x1341cd['where']=qs['filters'](_[_0xdb85('0x48')](_0x23fb80[_0xdb85('0x2c')],_0xe77516[_0xdb85('0x2e')]));if(_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x37')]){_0x1341cd['where']=_['merge'](_0x1341cd[_0xdb85('0x36')],{'$or':_[_0xdb85('0x28')](_0x1341cd[_0xdb85('0x2f')],function(_0x5b8514){var _0x1f619d={};_0x1f619d[_0x5b8514]={'$like':'%'+_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x1f619d;})});}_0x1341cd=_['merge']({},_0x1341cd,_0x23fb80['options']);return _0x5ec64e[_0xdb85('0x49')](_0x1341cd);}})['then'](function(_0x4b75dd){if(_0x4b75dd){_0x4f21c8=_0x4b75dd[_0xdb85('0x32')];if(!_0x23fb80[_0xdb85('0x2c')][_0xdb85('0x4a')](_0xdb85('0x33'))){_0x1341cd[_0xdb85('0x1b')]=qs[_0xdb85('0x1b')](_0x23fb80['query'][_0xdb85('0x1b')]);_0x1341cd[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x23fb80['query'][_0xdb85('0x19')]);}return _0x5ec64e[_0xdb85('0x49')](_0x1341cd);}})[_0xdb85('0x22')](function(_0x4446d5){if(_0x4446d5){return _0x4446d5?{'count':_0x4f21c8,'rows':_0x4446d5}:null;}})[_0xdb85('0x22')](respondWithResult(_0x3112e4,null))['catch'](handleError(_0x3112e4,null));};exports[_0xdb85('0x4b')]=function(_0x28a0ff,_0x75c16f,_0x5ef73f){var _0x2f827d={};var _0x2ab1e2={};var _0x1171ae;var _0x3ec255;return db[_0xdb85('0x3b')][_0xdb85('0x46')]({'where':{'id':_0x28a0ff[_0xdb85('0x3f')]['id']}})['then'](handleEntityNotFound(_0x75c16f,null))[_0xdb85('0x22')](function(_0x2c53dd){if(_0x2c53dd){_0x1171ae=_0x2c53dd;_0x2ab1e2[_0xdb85('0x2b')]=_[_0xdb85('0x2d')](db[_0xdb85('0x47')]['rawAttributes']);_0x2ab1e2[_0xdb85('0x2c')]=_[_0xdb85('0x2d')](_0x28a0ff[_0xdb85('0x2c')]);_0x2ab1e2[_0xdb85('0x2e')]=_[_0xdb85('0x30')](_0x2ab1e2[_0xdb85('0x2b')],_0x2ab1e2[_0xdb85('0x2c')]);_0x2f827d[_0xdb85('0x2f')]=_[_0xdb85('0x30')](_0x2ab1e2['model'],qs[_0xdb85('0x31')](_0x28a0ff['query'][_0xdb85('0x31')]));_0x2f827d[_0xdb85('0x2f')]=_0x2f827d['attributes']['length']?_0x2f827d[_0xdb85('0x2f')]:_0x2ab1e2[_0xdb85('0x2b')];_0x2f827d['order']=qs[_0xdb85('0x35')](_0x28a0ff['query'][_0xdb85('0x35')]);_0x2f827d[_0xdb85('0x36')]=qs[_0xdb85('0x2e')](_[_0xdb85('0x48')](_0x28a0ff[_0xdb85('0x2c')],_0x2ab1e2[_0xdb85('0x2e')]));if(_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x37')]){_0x2f827d[_0xdb85('0x36')]=_[_0xdb85('0x39')](_0x2f827d['where'],{'$or':_[_0xdb85('0x28')](_0x2f827d[_0xdb85('0x2f')],function(_0x2b7946){var _0x38399d={};_0x38399d[_0x2b7946]={'$like':'%'+_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x37')]+'%'};return _0x38399d;})});}_0x2f827d=_[_0xdb85('0x39')]({},_0x2f827d,_0x28a0ff[_0xdb85('0x3a')]);return _0x1171ae[_0xdb85('0x4b')](_0x2f827d);}})[_0xdb85('0x22')](function(_0xf2e962){if(_0xf2e962){_0x3ec255=_0xf2e962['length'];if(!_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x4a')](_0xdb85('0x33'))){_0x2f827d[_0xdb85('0x1b')]=qs['limit'](_0x28a0ff[_0xdb85('0x2c')][_0xdb85('0x1b')]);_0x2f827d[_0xdb85('0x19')]=qs[_0xdb85('0x19')](_0x28a0ff['query']['offset']);}return _0x1171ae[_0xdb85('0x4b')](_0x2f827d);}})['then'](function(_0x21b2ca){if(_0x21b2ca){return _0x21b2ca?{'count':_0x3ec255,'rows':_0x21b2ca}:null;}})[_0xdb85('0x22')](respondWithResult(_0x75c16f,null))[_0xdb85('0x3e')](handleError(_0x75c16f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 27a5019..cd3733c 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 _0xc35b=['int_sugarcrm_configurations','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x286395,_0x688a1){var _0x184ce8=function(_0x4e29d3){while(--_0x4e29d3){_0x286395['push'](_0x286395['shift']());}};_0x184ce8(++_0x688a1);}(_0xc35b,0xb5));var _0xbc35=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xc35b[_0xc6be3a];return _0x56a310;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc35('0x0'))(_0xbc35('0x1'));var moment=require(_0xbc35('0x2'));var BPromise=require(_0xbc35('0x3'));var rp=require(_0xbc35('0x4'));var fs=require('fs');var path=require(_0xbc35('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc35('0x6'));module['exports']=function(_0x388193,_0xe72df2){return _0x388193[_0xbc35('0x7')](_0xbc35('0x8'),attributes,{'tableName':_0xbc35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6d0=['rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4de31f,_0x5118c4){var _0x2477d3=function(_0x324ab2){while(--_0x324ab2){_0x4de31f['push'](_0x4de31f['shift']());}};_0x2477d3(++_0x5118c4);}(_0xa6d0,0x158));var _0x0a6d=function(_0x55785f,_0x5c0475){_0x55785f=_0x55785f-0x0;var _0x30c4aa=_0xa6d0[_0x55785f];return _0x30c4aa;};'use strict';var _=require(_0x0a6d('0x0'));var util=require('util');var logger=require(_0x0a6d('0x1'))(_0x0a6d('0x2'));var moment=require(_0x0a6d('0x3'));var BPromise=require(_0x0a6d('0x4'));var rp=require(_0x0a6d('0x5'));var fs=require('fs');var path=require(_0x0a6d('0x6'));var rimraf=require(_0x0a6d('0x7'));var config=require(_0x0a6d('0x8'));var attributes=require(_0x0a6d('0x9'));module[_0x0a6d('0xa')]=function(_0x17fdba,_0x357d34){return _0x17fdba[_0x0a6d('0xb')](_0x0a6d('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index c21ad35..dafac4c 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 _0x3bed=['http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49ca95,_0x50c62b){var _0x4699f9=function(_0x5a27a0){while(--_0x5a27a0){_0x49ca95['push'](_0x49ca95['shift']());}};_0x4699f9(++_0x50c62b);}(_0x3bed,0x1ee));var _0xd3be=function(_0x5ead2c,_0x17e317){_0x5ead2c=_0x5ead2c-0x0;var _0x56c52e=_0x3bed[_0x5ead2c];return _0x56c52e;};'use strict';var _=require(_0xd3be('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd3be('0x1'));var rs=require(_0xd3be('0x2'));var fs=require('fs');var Redis=require(_0xd3be('0x3'));var db=require(_0xd3be('0x4'))['db'];var utils=require(_0xd3be('0x5'));var logger=require(_0xd3be('0x6'))(_0xd3be('0x7'));var config=require(_0xd3be('0x8'));var jayson=require(_0xd3be('0x9'));var client=jayson['client'][_0xd3be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c365e,_0x2ca8aa,_0x1c37a6){return new BPromise(function(_0x46002a,_0x2744b6){return client['request'](_0x4c365e,_0x1c37a6)[_0xd3be('0xb')](function(_0x2151af){logger[_0xd3be('0xc')](_0xd3be('0xd'),_0x2ca8aa,_0xd3be('0xe'));logger[_0xd3be('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2ca8aa,'request\x20sent',JSON[_0xd3be('0x10')](_0x2151af));if(_0x2151af[_0xd3be('0x11')]){if(_0x2151af[_0xd3be('0x11')][_0xd3be('0x12')]===0x1f4){logger[_0xd3be('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ca8aa,_0x2151af[_0xd3be('0x11')][_0xd3be('0x13')]);return _0x2744b6(_0x2151af[_0xd3be('0x11')]['message']);}logger[_0xd3be('0x11')](_0xd3be('0xd'),_0x2ca8aa,_0x2151af[_0xd3be('0x11')]['message']);return _0x46002a(_0x2151af[_0xd3be('0x11')][_0xd3be('0x13')]);}else{logger[_0xd3be('0xc')](_0xd3be('0xd'),_0x2ca8aa,'request\x20sent');_0x46002a(_0x2151af['result'][_0xd3be('0x13')]);}})[_0xd3be('0x14')](function(_0x13df16){logger[_0xd3be('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ca8aa,_0x13df16);_0x2744b6(_0x13df16);});});} \ No newline at end of file +var _0x33c5=['jayson/promise','client','http','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x57fe10,_0xc39128){var _0x183c17=function(_0x5bb8bb){while(--_0x5bb8bb){_0x57fe10['push'](_0x57fe10['shift']());}};_0x183c17(++_0xc39128);}(_0x33c5,0x1ae));var _0x533c=function(_0x3a723e,_0x59d99a){_0x3a723e=_0x3a723e-0x0;var _0x3e9c03=_0x33c5[_0x3a723e];return _0x3e9c03;};'use strict';var _=require(_0x533c('0x0'));var util=require('util');var moment=require(_0x533c('0x1'));var BPromise=require(_0x533c('0x2'));var rs=require(_0x533c('0x3'));var fs=require('fs');var Redis=require(_0x533c('0x4'));var db=require(_0x533c('0x5'))['db'];var utils=require(_0x533c('0x6'));var logger=require(_0x533c('0x7'))(_0x533c('0x8'));var config=require(_0x533c('0x9'));var jayson=require(_0x533c('0xa'));var client=jayson[_0x533c('0xb')][_0x533c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57c886,_0x18f9b4,_0x4c6999){return new BPromise(function(_0x14c331,_0x56caea){return client['request'](_0x57c886,_0x4c6999)['then'](function(_0xde2bcb){logger['info'](_0x533c('0xd'),_0x18f9b4,_0x533c('0xe'));logger['debug'](_0x533c('0xf'),_0x18f9b4,'request\x20sent',JSON[_0x533c('0x10')](_0xde2bcb));if(_0xde2bcb[_0x533c('0x11')]){if(_0xde2bcb[_0x533c('0x11')][_0x533c('0x12')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x18f9b4,_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);return _0x56caea(_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);}logger['error'](_0x533c('0xd'),_0x18f9b4,_0xde2bcb[_0x533c('0x11')][_0x533c('0x13')]);return _0x14c331(_0xde2bcb['error'][_0x533c('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x18f9b4,_0x533c('0xe'));_0x14c331(_0xde2bcb[_0x533c('0x14')][_0x533c('0x13')]);}})[_0x533c('0x15')](function(_0x2770d2){logger[_0x533c('0x11')](_0x533c('0xd'),_0x18f9b4,_0x2770d2);_0x56caea(_0x2770d2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index c44576f..08954f1 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 _0xe981=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1a39ae,_0x2b75e3){var _0x2f7245=function(_0x19c06c){while(--_0x19c06c){_0x1a39ae['push'](_0x1a39ae['shift']());}};_0x2f7245(++_0x2b75e3);}(_0xe981,0x198));var _0x1e98=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xe981[_0x40d8d7];return _0x3454cc;};'use strict';var multer=require(_0x1e98('0x0'));var util=require(_0x1e98('0x1'));var path=require(_0x1e98('0x2'));var timeout=require(_0x1e98('0x3'));var express=require('express');var router=express[_0x1e98('0x4')]();var fs_extra=require(_0x1e98('0x5'));var auth=require(_0x1e98('0x6'));var interaction=require(_0x1e98('0x7'));var config=require(_0x1e98('0x8'));var controller=require(_0x1e98('0x9'));router[_0x1e98('0xa')]('/',auth[_0x1e98('0xb')](),controller['index']);router[_0x1e98('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1e98('0xc')]);router[_0x1e98('0xd')]('/',auth[_0x1e98('0xb')](),controller['create']);router[_0x1e98('0xe')](_0x1e98('0xf'),auth['isAuthenticated'](),controller[_0x1e98('0x10')]);router['delete'](_0x1e98('0xf'),auth[_0x1e98('0xb')](),controller[_0x1e98('0x11')]);module['exports']=router; \ No newline at end of file +var _0xae6c=['./intSugarcrmField.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcc919e,_0xaf01e){var _0x8317c3=function(_0x24c189){while(--_0x24c189){_0xcc919e['push'](_0xcc919e['shift']());}};_0x8317c3(++_0xaf01e);}(_0xae6c,0xc9));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xcae6('0x0'));var path=require(_0xcae6('0x1'));var timeout=require(_0xcae6('0x2'));var express=require(_0xcae6('0x3'));var router=express[_0xcae6('0x4')]();var fs_extra=require(_0xcae6('0x5'));var auth=require(_0xcae6('0x6'));var interaction=require(_0xcae6('0x7'));var config=require(_0xcae6('0x8'));var controller=require(_0xcae6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xcae6('0xa')]);router['get'](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0xd')]);router[_0xcae6('0xe')]('/',auth['isAuthenticated'](),controller[_0xcae6('0xf')]);router[_0xcae6('0x10')](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0x11')]);router[_0xcae6('0x12')](_0xcae6('0xb'),auth[_0xcae6('0xc')](),controller[_0xcae6('0x13')]);module[_0xcae6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6b5b5d8..52f578c 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 _0x4263=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x38ff3c,_0x53525b){var _0x339faa=function(_0xdbc4ac){while(--_0xdbc4ac){_0x38ff3c['push'](_0x38ff3c['shift']());}};_0x339faa(++_0x53525b);}(_0x4263,0x1c5));var _0x3426=function(_0x14d62b,_0x4b9fd4){_0x14d62b=_0x14d62b-0x0;var _0x323a4e=_0x4263[_0x14d62b];return _0x323a4e;};'use strict';var Sequelize=require(_0x3426('0x0'));module[_0x3426('0x1')]={'type':{'type':Sequelize[_0x3426('0x2')]('string',_0x3426('0x3'),'customVariable',_0x3426('0x4'),_0x3426('0x5')),'defaultValue':_0x3426('0x6')},'content':{'type':Sequelize[_0x3426('0x7')]},'key':{'type':Sequelize[_0x3426('0x7')]},'keyType':{'type':Sequelize[_0x3426('0x2')]('string',_0x3426('0x3'),_0x3426('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3426('0x7')]},'nameField':{'type':Sequelize[_0x3426('0x7')]},'customField':{'type':Sequelize[_0x3426('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3426('0x7')]}}; \ No newline at end of file +var _0xa532=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x4ed77e,_0x1fd527){var _0x35c245=function(_0x45e988){while(--_0x45e988){_0x4ed77e['push'](_0x4ed77e['shift']());}};_0x35c245(++_0x1fd527);}(_0xa532,0x64));var _0x2a53=function(_0x494dab,_0x24a6c5){_0x494dab=_0x494dab-0x0;var _0x2c9e47=_0xa532[_0x494dab];return _0x2c9e47;};'use strict';var Sequelize=require(_0x2a53('0x0'));module[_0x2a53('0x1')]={'type':{'type':Sequelize[_0x2a53('0x2')](_0x2a53('0x3'),_0x2a53('0x4'),'customVariable',_0x2a53('0x5'),_0x2a53('0x6')),'defaultValue':_0x2a53('0x3')},'content':{'type':Sequelize[_0x2a53('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2a53('0x3'),_0x2a53('0x4'),_0x2a53('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2a53('0x7')]},'nameField':{'type':Sequelize[_0x2a53('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a53('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4717b5e..ec338ad 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 _0xe281=['reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status','end','json','undefined','offset','count','limit','set','apply'];(function(_0xadc6d5,_0x406c40){var _0x500fae=function(_0x10b90b){while(--_0x10b90b){_0xadc6d5['push'](_0xadc6d5['shift']());}};_0x500fae(++_0x406c40);}(_0xe281,0xb8));var _0x1e28=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe281[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e28('0x0'));var jsonpatch=require(_0x1e28('0x1'));var rp=require(_0x1e28('0x2'));var moment=require(_0x1e28('0x3'));var BPromise=require(_0x1e28('0x4'));var Mustache=require('mustache');var util=require(_0x1e28('0x5'));var path=require(_0x1e28('0x6'));var sox=require(_0x1e28('0x7'));var csv=require(_0x1e28('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e28('0x9'));var _=require('lodash');var squel=require(_0x1e28('0xa'));var crypto=require(_0x1e28('0xb'));var jsforce=require(_0x1e28('0xc'));var deskjs=require(_0x1e28('0xd'));var toCsv=require(_0x1e28('0x8'));var querystring=require(_0x1e28('0xe'));var Papa=require(_0x1e28('0xf'));var Redis=require(_0x1e28('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1e28('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e28('0x12'))('api');var utils=require(_0x1e28('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b1d9c,_0x1e6b65){_0x1e6b65=_0x1e6b65||0xcc;return function(_0x9742a7){if(_0x9742a7){return _0x5b1d9c['sendStatus'](_0x1e6b65);}return _0x5b1d9c[_0x1e28('0x14')](_0x1e6b65)[_0x1e28('0x15')]();};}function respondWithResult(_0x4a6537,_0x45362b){_0x45362b=_0x45362b||0xc8;return function(_0x2bd7fe){if(_0x2bd7fe){return _0x4a6537[_0x1e28('0x14')](_0x45362b)[_0x1e28('0x16')](_0x2bd7fe);}};}function respondWithFilteredResult(_0x2b06a0,_0xffef51){return function(_0x15d752){if(_0x15d752){var _0x25cc58=typeof _0xffef51['offset']==='undefined'&&typeof _0xffef51['limit']===_0x1e28('0x17');var _0x166df2=_0x15d752['count'];var _0x35155b=_0x25cc58?0x0:_0xffef51[_0x1e28('0x18')];var _0x57fc87=_0x25cc58?_0x15d752[_0x1e28('0x19')]:_0xffef51[_0x1e28('0x18')]+_0xffef51[_0x1e28('0x1a')];var _0x43ef70;if(_0x57fc87>=_0x166df2){_0x57fc87=_0x166df2;_0x43ef70=0xc8;}else{_0x43ef70=0xce;}_0x2b06a0[_0x1e28('0x14')](_0x43ef70);return _0x2b06a0[_0x1e28('0x1b')]('Content-Range',_0x35155b+'-'+_0x57fc87+'/'+_0x166df2)[_0x1e28('0x16')](_0x15d752);}return null;};}function patchUpdates(_0x37f705){return function(_0x2be9a0){try{jsonpatch[_0x1e28('0x1c')](_0x2be9a0,_0x37f705,!![]);}catch(_0x22933d){return BPromise[_0x1e28('0x1d')](_0x22933d);}return _0x2be9a0[_0x1e28('0x1e')]();};}function saveUpdates(_0x4a1db6,_0x2c4315){return function(_0x4e9d54){if(_0x4e9d54){return _0x4e9d54[_0x1e28('0x1f')](_0x4a1db6)[_0x1e28('0x20')](function(_0x25dd04){return _0x25dd04;});}return null;};}function removeEntity(_0x40e6aa,_0x16924a){return function(_0x771204){if(_0x771204){return _0x771204['destroy']()[_0x1e28('0x20')](function(){_0x40e6aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46098b,_0x3dc6d8){return function(_0x160830){if(!_0x160830){_0x46098b[_0x1e28('0x21')](0x194);}return _0x160830;};}function handleError(_0x242411,_0x2181dc){_0x2181dc=_0x2181dc||0x1f4;return function(_0x1b452e){logger[_0x1e28('0x22')](_0x1b452e[_0x1e28('0x23')]);if(_0x1b452e[_0x1e28('0x24')]){delete _0x1b452e[_0x1e28('0x24')];}_0x242411['status'](_0x2181dc)[_0x1e28('0x25')](_0x1b452e);};}exports[_0x1e28('0x26')]=function(_0x2eddea,_0x49106e){var _0x5eb351={},_0x3ad261={},_0x453904={'count':0x0,'rows':[]};var _0x245a60=_[_0x1e28('0x27')](db['SugarcrmField']['rawAttributes'],function(_0x489eb3){return{'name':_0x489eb3[_0x1e28('0x28')],'type':_0x489eb3[_0x1e28('0x29')][_0x1e28('0x2a')]};});_0x3ad261[_0x1e28('0x2b')]=_['map'](_0x245a60,'name');_0x3ad261[_0x1e28('0x2c')]=_['keys'](_0x2eddea['query']);_0x3ad261['filters']=_[_0x1e28('0x2d')](_0x3ad261['model'],_0x3ad261[_0x1e28('0x2c')]);_0x5eb351[_0x1e28('0x2e')]=_[_0x1e28('0x2d')](_0x3ad261[_0x1e28('0x2b')],qs['fields'](_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x2f')]));_0x5eb351[_0x1e28('0x2e')]=_0x5eb351[_0x1e28('0x2e')][_0x1e28('0x30')]?_0x5eb351[_0x1e28('0x2e')]:_0x3ad261[_0x1e28('0x2b')];if(!_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x31')]('nolimit')){_0x5eb351[_0x1e28('0x1a')]=qs['limit'](_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x1a')]);_0x5eb351['offset']=qs['offset'](_0x2eddea[_0x1e28('0x2c')]['offset']);}_0x5eb351[_0x1e28('0x32')]=qs[_0x1e28('0x33')](_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x33')]);_0x5eb351[_0x1e28('0x34')]=qs[_0x1e28('0x35')](_[_0x1e28('0x36')](_0x2eddea[_0x1e28('0x2c')],_0x3ad261['filters']),_0x245a60);if(_0x2eddea[_0x1e28('0x2c')]['filter']){_0x5eb351[_0x1e28('0x34')]=_['merge'](_0x5eb351['where'],{'$or':_['map'](_0x245a60,function(_0xc914ba){if(_0xc914ba[_0x1e28('0x29')]!=='VIRTUAL'){var _0x54888a={};_0x54888a[_0xc914ba['name']]={'$like':'%'+_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x37')]+'%'};return _0x54888a;}})});}_0x5eb351=_['merge']({},_0x5eb351,_0x2eddea[_0x1e28('0x38')]);var _0x2c1e6e={'where':_0x5eb351[_0x1e28('0x34')]};return db[_0x1e28('0x39')]['count'](_0x2c1e6e)[_0x1e28('0x20')](function(_0x3a258c){_0x453904['count']=_0x3a258c;if(_0x2eddea[_0x1e28('0x2c')][_0x1e28('0x3a')]){_0x5eb351[_0x1e28('0x3b')]=[{'all':!![]}];}return db[_0x1e28('0x39')][_0x1e28('0x3c')](_0x5eb351);})['then'](function(_0x394213){_0x453904[_0x1e28('0x3d')]=_0x394213;return _0x453904;})[_0x1e28('0x20')](respondWithFilteredResult(_0x49106e,_0x5eb351))[_0x1e28('0x3e')](handleError(_0x49106e,null));};exports[_0x1e28('0x3f')]=function(_0x54a04d,_0x3e3d2e){var _0x1401f2={'raw':!![],'where':{'id':_0x54a04d[_0x1e28('0x40')]['id']}},_0x41bbd5={};_0x41bbd5[_0x1e28('0x2b')]=_[_0x1e28('0x41')](db[_0x1e28('0x39')]['rawAttributes']);_0x41bbd5['query']=_[_0x1e28('0x41')](_0x54a04d['query']);_0x41bbd5[_0x1e28('0x35')]=_[_0x1e28('0x2d')](_0x41bbd5[_0x1e28('0x2b')],_0x41bbd5[_0x1e28('0x2c')]);_0x1401f2[_0x1e28('0x2e')]=_[_0x1e28('0x2d')](_0x41bbd5[_0x1e28('0x2b')],qs[_0x1e28('0x2f')](_0x54a04d[_0x1e28('0x2c')][_0x1e28('0x2f')]));_0x1401f2['attributes']=_0x1401f2[_0x1e28('0x2e')][_0x1e28('0x30')]?_0x1401f2[_0x1e28('0x2e')]:_0x41bbd5['model'];if(_0x54a04d['query'][_0x1e28('0x3a')]){_0x1401f2[_0x1e28('0x3b')]=[{'all':!![]}];}_0x1401f2=_[_0x1e28('0x42')]({},_0x1401f2,_0x54a04d[_0x1e28('0x38')]);return db[_0x1e28('0x39')][_0x1e28('0x43')](_0x1401f2)[_0x1e28('0x20')](handleEntityNotFound(_0x3e3d2e,null))[_0x1e28('0x20')](respondWithResult(_0x3e3d2e,null))[_0x1e28('0x3e')](handleError(_0x3e3d2e,null));};exports[_0x1e28('0x44')]=function(_0x2bf516,_0x551718){return db[_0x1e28('0x39')]['create'](_0x2bf516[_0x1e28('0x45')],{})['then'](respondWithResult(_0x551718,0xc9))[_0x1e28('0x3e')](handleError(_0x551718,null));};exports[_0x1e28('0x1f')]=function(_0x2f18ac,_0x143b31){if(_0x2f18ac[_0x1e28('0x45')]['id']){delete _0x2f18ac[_0x1e28('0x45')]['id'];}return db[_0x1e28('0x39')][_0x1e28('0x43')]({'where':{'id':_0x2f18ac['params']['id']}})[_0x1e28('0x20')](handleEntityNotFound(_0x143b31,null))[_0x1e28('0x20')](saveUpdates(_0x2f18ac[_0x1e28('0x45')],null))['then'](respondWithResult(_0x143b31,null))[_0x1e28('0x3e')](handleError(_0x143b31,null));};exports[_0x1e28('0x46')]=function(_0x442f6b,_0x2799ba){return db[_0x1e28('0x39')][_0x1e28('0x43')]({'where':{'id':_0x442f6b[_0x1e28('0x40')]['id']}})['then'](handleEntityNotFound(_0x2799ba,null))[_0x1e28('0x20')](removeEntity(_0x2799ba,null))[_0x1e28('0x3e')](handleError(_0x2799ba,null));}; \ No newline at end of file +var _0x36c7=['apply','reject','save','update','then','sendStatus','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/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'];(function(_0x2fe952,_0xa77e25){var _0x28c7cd=function(_0x45025b){while(--_0x45025b){_0x2fe952['push'](_0x2fe952['shift']());}};_0x28c7cd(++_0xa77e25);}(_0x36c7,0x174));var _0x736c=function(_0x183dd6,_0x488036){_0x183dd6=_0x183dd6-0x0;var _0x4b3be2=_0x36c7[_0x183dd6];return _0x4b3be2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x736c('0x0'));var zipdir=require(_0x736c('0x1'));var jsonpatch=require(_0x736c('0x2'));var rp=require(_0x736c('0x3'));var moment=require(_0x736c('0x4'));var BPromise=require(_0x736c('0x5'));var Mustache=require(_0x736c('0x6'));var util=require(_0x736c('0x7'));var path=require(_0x736c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x736c('0x9'));var fs=require('fs');var fs_extra=require(_0x736c('0xa'));var _=require(_0x736c('0xb'));var squel=require(_0x736c('0xc'));var crypto=require(_0x736c('0xd'));var jsforce=require(_0x736c('0xe'));var deskjs=require(_0x736c('0xf'));var toCsv=require(_0x736c('0x10'));var querystring=require(_0x736c('0x11'));var Papa=require(_0x736c('0x12'));var Redis=require(_0x736c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x736c('0x14'));var as=require(_0x736c('0x15'));var hardwareService=require(_0x736c('0x16'));var logger=require(_0x736c('0x17'))(_0x736c('0x18'));var utils=require(_0x736c('0x19'));var config=require(_0x736c('0x1a'));var licenseUtil=require(_0x736c('0x1b'));var db=require(_0x736c('0x1c'))['db'];function respondWithStatusCode(_0x502d22,_0x33e974){_0x33e974=_0x33e974||0xcc;return function(_0x4f72d1){if(_0x4f72d1){return _0x502d22['sendStatus'](_0x33e974);}return _0x502d22[_0x736c('0x1d')](_0x33e974)[_0x736c('0x1e')]();};}function respondWithResult(_0x5e7ed3,_0x1f3413){_0x1f3413=_0x1f3413||0xc8;return function(_0x46cbfe){if(_0x46cbfe){return _0x5e7ed3['status'](_0x1f3413)[_0x736c('0x1f')](_0x46cbfe);}};}function respondWithFilteredResult(_0x43b01a,_0x17471e){return function(_0x58cf08){if(_0x58cf08){var _0x5a92d5=typeof _0x17471e[_0x736c('0x20')]===_0x736c('0x21')&&typeof _0x17471e[_0x736c('0x22')]===_0x736c('0x21');var _0x3d7c94=_0x58cf08[_0x736c('0x23')];var _0x435ca2=_0x5a92d5?0x0:_0x17471e[_0x736c('0x20')];var _0xde2263=_0x5a92d5?_0x58cf08[_0x736c('0x23')]:_0x17471e[_0x736c('0x20')]+_0x17471e[_0x736c('0x22')];var _0x254fdb;if(_0xde2263>=_0x3d7c94){_0xde2263=_0x3d7c94;_0x254fdb=0xc8;}else{_0x254fdb=0xce;}_0x43b01a[_0x736c('0x1d')](_0x254fdb);return _0x43b01a[_0x736c('0x24')](_0x736c('0x25'),_0x435ca2+'-'+_0xde2263+'/'+_0x3d7c94)[_0x736c('0x1f')](_0x58cf08);}return null;};}function patchUpdates(_0x192f7a){return function(_0x326de2){try{jsonpatch[_0x736c('0x26')](_0x326de2,_0x192f7a,!![]);}catch(_0x1696ee){return BPromise[_0x736c('0x27')](_0x1696ee);}return _0x326de2[_0x736c('0x28')]();};}function saveUpdates(_0x46f614,_0x3aec24){return function(_0x51e363){if(_0x51e363){return _0x51e363[_0x736c('0x29')](_0x46f614)['then'](function(_0x3b8ad5){return _0x3b8ad5;});}return null;};}function removeEntity(_0x3b1d0a,_0x156aa4){return function(_0x17e169){if(_0x17e169){return _0x17e169['destroy']()[_0x736c('0x2a')](function(){_0x3b1d0a[_0x736c('0x1d')](0xcc)[_0x736c('0x1e')]();});}};}function handleEntityNotFound(_0x106590,_0x4b6749){return function(_0x4f2e05){if(!_0x4f2e05){_0x106590[_0x736c('0x2b')](0x194);}return _0x4f2e05;};}function handleError(_0x25081b,_0x24d882){_0x24d882=_0x24d882||0x1f4;return function(_0x37c178){logger[_0x736c('0x2c')](_0x37c178['stack']);if(_0x37c178['name']){delete _0x37c178[_0x736c('0x2d')];}_0x25081b['status'](_0x24d882)[_0x736c('0x2e')](_0x37c178);};}exports[_0x736c('0x2f')]=function(_0x168675,_0x3e2184){var _0x4f52b4={},_0x46bdeb={},_0x327b1c={'count':0x0,'rows':[]};var _0x57c3c8=_[_0x736c('0x30')](db[_0x736c('0x31')][_0x736c('0x32')],function(_0xde1ca2){return{'name':_0xde1ca2[_0x736c('0x33')],'type':_0xde1ca2[_0x736c('0x34')][_0x736c('0x35')]};});_0x46bdeb[_0x736c('0x36')]=_[_0x736c('0x30')](_0x57c3c8,_0x736c('0x2d'));_0x46bdeb['query']=_['keys'](_0x168675[_0x736c('0x37')]);_0x46bdeb['filters']=_['intersection'](_0x46bdeb[_0x736c('0x36')],_0x46bdeb['query']);_0x4f52b4[_0x736c('0x38')]=_[_0x736c('0x39')](_0x46bdeb['model'],qs[_0x736c('0x3a')](_0x168675['query']['fields']));_0x4f52b4[_0x736c('0x38')]=_0x4f52b4[_0x736c('0x38')][_0x736c('0x3b')]?_0x4f52b4[_0x736c('0x38')]:_0x46bdeb[_0x736c('0x36')];if(!_0x168675['query'][_0x736c('0x3c')](_0x736c('0x3d'))){_0x4f52b4[_0x736c('0x22')]=qs[_0x736c('0x22')](_0x168675[_0x736c('0x37')][_0x736c('0x22')]);_0x4f52b4[_0x736c('0x20')]=qs[_0x736c('0x20')](_0x168675[_0x736c('0x37')]['offset']);}_0x4f52b4[_0x736c('0x3e')]=qs[_0x736c('0x3f')](_0x168675['query'][_0x736c('0x3f')]);_0x4f52b4['where']=qs[_0x736c('0x40')](_[_0x736c('0x41')](_0x168675['query'],_0x46bdeb[_0x736c('0x40')]),_0x57c3c8);if(_0x168675['query'][_0x736c('0x42')]){_0x4f52b4['where']=_[_0x736c('0x43')](_0x4f52b4[_0x736c('0x44')],{'$or':_['map'](_0x57c3c8,function(_0x3fef0c){if(_0x3fef0c[_0x736c('0x34')]!=='VIRTUAL'){var _0x522d6b={};_0x522d6b[_0x3fef0c['name']]={'$like':'%'+_0x168675['query'][_0x736c('0x42')]+'%'};return _0x522d6b;}})});}_0x4f52b4=_[_0x736c('0x43')]({},_0x4f52b4,_0x168675[_0x736c('0x45')]);var _0x48083d={'where':_0x4f52b4[_0x736c('0x44')]};return db[_0x736c('0x31')][_0x736c('0x23')](_0x48083d)['then'](function(_0x4fe51d){_0x327b1c[_0x736c('0x23')]=_0x4fe51d;if(_0x168675['query'][_0x736c('0x46')]){_0x4f52b4[_0x736c('0x47')]=[{'all':!![]}];}return db['SugarcrmField'][_0x736c('0x48')](_0x4f52b4);})['then'](function(_0x190881){_0x327b1c[_0x736c('0x49')]=_0x190881;return _0x327b1c;})[_0x736c('0x2a')](respondWithFilteredResult(_0x3e2184,_0x4f52b4))['catch'](handleError(_0x3e2184,null));};exports[_0x736c('0x4a')]=function(_0x21f9a9,_0xc04f8e){var _0x1bf897={'raw':!![],'where':{'id':_0x21f9a9[_0x736c('0x4b')]['id']}},_0xa1df2b={};_0xa1df2b[_0x736c('0x36')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0xa1df2b['query']=_[_0x736c('0x4c')](_0x21f9a9[_0x736c('0x37')]);_0xa1df2b['filters']=_[_0x736c('0x39')](_0xa1df2b['model'],_0xa1df2b[_0x736c('0x37')]);_0x1bf897['attributes']=_[_0x736c('0x39')](_0xa1df2b['model'],qs['fields'](_0x21f9a9[_0x736c('0x37')][_0x736c('0x3a')]));_0x1bf897['attributes']=_0x1bf897[_0x736c('0x38')]['length']?_0x1bf897[_0x736c('0x38')]:_0xa1df2b[_0x736c('0x36')];if(_0x21f9a9[_0x736c('0x37')]['includeAll']){_0x1bf897[_0x736c('0x47')]=[{'all':!![]}];}_0x1bf897=_[_0x736c('0x43')]({},_0x1bf897,_0x21f9a9['options']);return db[_0x736c('0x31')][_0x736c('0x4d')](_0x1bf897)[_0x736c('0x2a')](handleEntityNotFound(_0xc04f8e,null))['then'](respondWithResult(_0xc04f8e,null))[_0x736c('0x4e')](handleError(_0xc04f8e,null));};exports[_0x736c('0x4f')]=function(_0x454aa8,_0x57e61b){return db[_0x736c('0x31')][_0x736c('0x4f')](_0x454aa8[_0x736c('0x50')],{})['then'](respondWithResult(_0x57e61b,0xc9))[_0x736c('0x4e')](handleError(_0x57e61b,null));};exports[_0x736c('0x29')]=function(_0x5642f7,_0x4628b5){if(_0x5642f7[_0x736c('0x50')]['id']){delete _0x5642f7[_0x736c('0x50')]['id'];}return db[_0x736c('0x31')][_0x736c('0x4d')]({'where':{'id':_0x5642f7[_0x736c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4628b5,null))[_0x736c('0x2a')](saveUpdates(_0x5642f7[_0x736c('0x50')],null))[_0x736c('0x2a')](respondWithResult(_0x4628b5,null))[_0x736c('0x4e')](handleError(_0x4628b5,null));};exports[_0x736c('0x51')]=function(_0x432754,_0x6082b3){return db[_0x736c('0x31')][_0x736c('0x4d')]({'where':{'id':_0x432754[_0x736c('0x4b')]['id']}})[_0x736c('0x2a')](handleEntityNotFound(_0x6082b3,null))['then'](removeEntity(_0x6082b3,null))['catch'](handleError(_0x6082b3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d6da852..b7fedb5 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 _0x8395=['define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x142ec2,_0x5bb03d){var _0x45ef4e=function(_0x4bc513){while(--_0x4bc513){_0x142ec2['push'](_0x142ec2['shift']());}};_0x45ef4e(++_0x5bb03d);}(_0x8395,0x12b));var _0x5839=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x8395[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x5839('0x0'));var util=require(_0x5839('0x1'));var logger=require(_0x5839('0x2'))(_0x5839('0x3'));var moment=require(_0x5839('0x4'));var BPromise=require(_0x5839('0x5'));var rp=require(_0x5839('0x6'));var fs=require('fs');var path=require(_0x5839('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x5839('0x8')]=function(_0x569b5f,_0x532c51){return _0x569b5f[_0x5839('0x9')](_0x5839('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x5839('0xb'),'fields':[_0x5839('0xc'),_0x5839('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b7a=['api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','sugarcrm_unique_index','idField','lodash','util','../../config/logger'];(function(_0x53b266,_0x249cf9){var _0x58bf1d=function(_0x981885){while(--_0x981885){_0x53b266['push'](_0x53b266['shift']());}};_0x58bf1d(++_0x249cf9);}(_0x2b7a,0xe7));var _0xa2b7=function(_0x18b584,_0x38af55){_0x18b584=_0x18b584-0x0;var _0x59b826=_0x2b7a[_0x18b584];return _0x59b826;};'use strict';var _=require(_0xa2b7('0x0'));var util=require(_0xa2b7('0x1'));var logger=require(_0xa2b7('0x2'))(_0xa2b7('0x3'));var moment=require(_0xa2b7('0x4'));var BPromise=require(_0xa2b7('0x5'));var rp=require(_0xa2b7('0x6'));var fs=require('fs');var path=require(_0xa2b7('0x7'));var rimraf=require(_0xa2b7('0x8'));var config=require('../../config/environment');var attributes=require(_0xa2b7('0x9'));module['exports']=function(_0x5d0cd7,_0x102872){return _0x5d0cd7[_0xa2b7('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xa2b7('0xb'),'fields':[_0xa2b7('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index bfbf11c..c489d1e 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 _0x0f67=['http','request','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise'];(function(_0x5d0818,_0x188411){var _0x37fcdb=function(_0x10c95a){while(--_0x10c95a){_0x5d0818['push'](_0x5d0818['shift']());}};_0x37fcdb(++_0x188411);}(_0x0f67,0x1d5));var _0x70f6=function(_0x34081f,_0x4d7dff){_0x34081f=_0x34081f-0x0;var _0x2dd7b8=_0x0f67[_0x34081f];return _0x2dd7b8;};'use strict';var _=require(_0x70f6('0x0'));var util=require(_0x70f6('0x1'));var moment=require(_0x70f6('0x2'));var BPromise=require(_0x70f6('0x3'));var rs=require(_0x70f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x70f6('0x6'));var client=jayson['client'][_0x70f6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2757a7,_0x50796a,_0x5e8ca9){return new BPromise(function(_0x595d57,_0x24454b){return client[_0x70f6('0x8')](_0x2757a7,_0x5e8ca9)['then'](function(_0x1487b6){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x50796a,_0x70f6('0x9'));logger['debug'](_0x70f6('0xa'),_0x50796a,_0x70f6('0x9'),JSON['stringify'](_0x1487b6));if(_0x1487b6['error']){if(_0x1487b6[_0x70f6('0xb')]['code']===0x1f4){logger[_0x70f6('0xb')](_0x70f6('0xc'),_0x50796a,_0x1487b6[_0x70f6('0xb')][_0x70f6('0xd')]);return _0x24454b(_0x1487b6[_0x70f6('0xb')][_0x70f6('0xd')]);}logger[_0x70f6('0xb')](_0x70f6('0xc'),_0x50796a,_0x1487b6[_0x70f6('0xb')][_0x70f6('0xd')]);return _0x595d57(_0x1487b6['error'][_0x70f6('0xd')]);}else{logger[_0x70f6('0xe')](_0x70f6('0xc'),_0x50796a,_0x70f6('0x9'));_0x595d57(_0x1487b6[_0x70f6('0xf')][_0x70f6('0xd')]);}})[_0x70f6('0x10')](function(_0x61b2d2){logger[_0x70f6('0xb')](_0x70f6('0xc'),_0x50796a,_0x61b2d2);_0x24454b(_0x61b2d2);});});} \ No newline at end of file +var _0xa6e6=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0xa6e6,0x74));var _0x6a6e=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xa6e6[_0x2a67fe];return _0x57e726;};'use strict';var _=require(_0x6a6e('0x0'));var util=require(_0x6a6e('0x1'));var moment=require(_0x6a6e('0x2'));var BPromise=require(_0x6a6e('0x3'));var rs=require(_0x6a6e('0x4'));var fs=require('fs');var Redis=require(_0x6a6e('0x5'));var db=require(_0x6a6e('0x6'))['db'];var utils=require(_0x6a6e('0x7'));var logger=require(_0x6a6e('0x8'))('rpc');var config=require(_0x6a6e('0x9'));var jayson=require(_0x6a6e('0xa'));var client=jayson[_0x6a6e('0xb')][_0x6a6e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x368b99,_0x2bbc7b,_0x16bc94){return new BPromise(function(_0x15fdd9,_0x400320){return client[_0x6a6e('0xd')](_0x368b99,_0x16bc94)[_0x6a6e('0xe')](function(_0x45327d){logger['info'](_0x6a6e('0xf'),_0x2bbc7b,_0x6a6e('0x10'));logger['debug'](_0x6a6e('0x11'),_0x2bbc7b,_0x6a6e('0x10'),JSON[_0x6a6e('0x12')](_0x45327d));if(_0x45327d[_0x6a6e('0x13')]){if(_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x14')]===0x1f4){logger['error'](_0x6a6e('0xf'),_0x2bbc7b,_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x15')]);return _0x400320(_0x45327d['error'][_0x6a6e('0x15')]);}logger[_0x6a6e('0x13')](_0x6a6e('0xf'),_0x2bbc7b,_0x45327d[_0x6a6e('0x13')][_0x6a6e('0x15')]);return _0x15fdd9(_0x45327d[_0x6a6e('0x13')]['message']);}else{logger[_0x6a6e('0x16')]('SugarcrmField,\x20%s,\x20%s',_0x2bbc7b,'request\x20sent');_0x15fdd9(_0x45327d[_0x6a6e('0x17')][_0x6a6e('0x15')]);}})[_0x6a6e('0x18')](function(_0x48c8f0){logger['error'](_0x6a6e('0xf'),_0x2bbc7b,_0x48c8f0);_0x400320(_0x48c8f0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 22f60b3..0cb0ff1 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 _0x89b2=['addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','isAuthenticated','getConfigurations','/:id/fields','post','create'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0x89b2,0xc6));var _0x289b=function(_0x4287cb,_0xe75c02){_0x4287cb=_0x4287cb-0x0;var _0x2b5fd3=_0x89b2[_0x4287cb];return _0x2b5fd3;};'use strict';var multer=require(_0x289b('0x0'));var util=require(_0x289b('0x1'));var path=require(_0x289b('0x2'));var timeout=require(_0x289b('0x3'));var express=require(_0x289b('0x4'));var router=express[_0x289b('0x5')]();var fs_extra=require(_0x289b('0x6'));var auth=require(_0x289b('0x7'));var interaction=require(_0x289b('0x8'));var config=require(_0x289b('0x9'));var controller=require(_0x289b('0xa'));router[_0x289b('0xb')]('/',auth['isAuthenticated'](),controller[_0x289b('0xc')]);router['get']('/:id',auth[_0x289b('0xd')](),controller['show']);router['get']('/:id/configurations',auth[_0x289b('0xd')](),controller[_0x289b('0xe')]);router[_0x289b('0xb')](_0x289b('0xf'),auth[_0x289b('0xd')](),controller['getFields']);router[_0x289b('0x10')]('/',auth['isAuthenticated'](),controller[_0x289b('0x11')]);router['post']('/:id/configurations',auth[_0x289b('0xd')](),controller[_0x289b('0x12')]);router['put'](_0x289b('0x13'),auth['isAuthenticated'](),controller[_0x289b('0x14')]);router[_0x289b('0x15')](_0x289b('0x13'),auth[_0x289b('0xd')](),controller[_0x289b('0x16')]);module[_0x289b('0x17')]=router; \ No newline at end of file +var _0x0627=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0627,0x1d8));var _0x7062=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x0627[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x7062('0x0'));var util=require(_0x7062('0x1'));var path=require(_0x7062('0x2'));var timeout=require(_0x7062('0x3'));var express=require(_0x7062('0x4'));var router=express[_0x7062('0x5')]();var fs_extra=require(_0x7062('0x6'));var auth=require(_0x7062('0x7'));var interaction=require(_0x7062('0x8'));var config=require(_0x7062('0x9'));var controller=require(_0x7062('0xa'));router['get']('/',auth[_0x7062('0xb')](),controller[_0x7062('0xc')]);router[_0x7062('0xd')](_0x7062('0xe'),auth[_0x7062('0xb')](),controller['show']);router[_0x7062('0xd')]('/:id/configurations',auth[_0x7062('0xb')](),controller[_0x7062('0xf')]);router['get']('/:id/fields',auth[_0x7062('0xb')](),controller[_0x7062('0x10')]);router[_0x7062('0x11')]('/',auth['isAuthenticated'](),controller[_0x7062('0x12')]);router[_0x7062('0x11')](_0x7062('0x13'),auth[_0x7062('0xb')](),controller[_0x7062('0x14')]);router[_0x7062('0x15')](_0x7062('0xe'),auth[_0x7062('0xb')](),controller[_0x7062('0x16')]);router[_0x7062('0x17')]('/:id',auth[_0x7062('0xb')](),controller['destroy']);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 c673ba6..32d208f 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 _0xf1f4=['STRING','sequelize','exports'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0xf1f4,0xbe));var _0x4f1f=function(_0x9bed95,_0x1a4d25){_0x9bed95=_0x9bed95-0x0;var _0x5e02e2=_0xf1f4[_0x9bed95];return _0x5e02e2;};'use strict';var Sequelize=require(_0x4f1f('0x0'));module[_0x4f1f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4f1f('0x2')]},'username':{'type':Sequelize[_0x4f1f('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4f1f('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x4f1f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4f1f('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1ef3=['sequelize','exports','STRING'];(function(_0x117bfa,_0x41278d){var _0x16b0c2=function(_0x509b30){while(--_0x509b30){_0x117bfa['push'](_0x117bfa['shift']());}};_0x16b0c2(++_0x41278d);}(_0x1ef3,0xa2));var _0x31ef=function(_0x4d4844,_0x1cd43f){_0x4d4844=_0x4d4844-0x0;var _0x4706d1=_0x1ef3[_0x4d4844];return _0x4706d1;};'use strict';var Sequelize=require(_0x31ef('0x0'));module[_0x31ef('0x1')]={'name':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x31ef('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x31ef('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 29ddde9..b16ea47 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 _0x1bb8=['AccountId','getSubjects','channel','VtigerConfiguration','create','VtigerField','Subjects','md5','getFields','username','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerAccount','then','includeAll','include','rows','catch','show','params','length','find','body','getConfigurations','findOne'];(function(_0x3bc72d,_0x5aaa33){var _0x3b7fbf=function(_0x106a76){while(--_0x106a76){_0x3bc72d['push'](_0x3bc72d['shift']());}};_0x3b7fbf(++_0x5aaa33);}(_0x1bb8,0x11e));var _0x81bb=function(_0x1c3513,_0x5da79f){_0x1c3513=_0x1c3513-0x0;var _0x162992=_0x1bb8[_0x1c3513];return _0x162992;};'use strict';var emlformat=require(_0x81bb('0x0'));var rimraf=require(_0x81bb('0x1'));var zipdir=require(_0x81bb('0x2'));var jsonpatch=require(_0x81bb('0x3'));var rp=require(_0x81bb('0x4'));var moment=require(_0x81bb('0x5'));var BPromise=require(_0x81bb('0x6'));var Mustache=require('mustache');var util=require(_0x81bb('0x7'));var path=require(_0x81bb('0x8'));var sox=require(_0x81bb('0x9'));var csv=require(_0x81bb('0xa'));var ejs=require(_0x81bb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x81bb('0xc'));var squel=require(_0x81bb('0xd'));var crypto=require(_0x81bb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x81bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x81bb('0x10'));var Papa=require(_0x81bb('0x11'));var Redis=require(_0x81bb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x81bb('0x13'));var as=require(_0x81bb('0x14'));var hardwareService=require(_0x81bb('0x15'));var logger=require(_0x81bb('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x81bb('0x17'));var db=require(_0x81bb('0x18'))['db'];var integrations=require(_0x81bb('0x19'));function respondWithStatusCode(_0x25ae76,_0x41e871){_0x41e871=_0x41e871||0xcc;return function(_0x4d8e74){if(_0x4d8e74){return _0x25ae76[_0x81bb('0x1a')](_0x41e871);}return _0x25ae76[_0x81bb('0x1b')](_0x41e871)[_0x81bb('0x1c')]();};}function respondWithResult(_0x153fd5,_0x8e13e2){_0x8e13e2=_0x8e13e2||0xc8;return function(_0x25e4f1){if(_0x25e4f1){return _0x153fd5[_0x81bb('0x1b')](_0x8e13e2)['json'](_0x25e4f1);}};}function respondWithFilteredResult(_0x5e539c,_0x1592a2){return function(_0x452a9d){if(_0x452a9d){var _0x22985e=typeof _0x1592a2['offset']===_0x81bb('0x1d')&&typeof _0x1592a2[_0x81bb('0x1e')]===_0x81bb('0x1d');var _0x23abc8=_0x452a9d['count'];var _0x3073b8=_0x22985e?0x0:_0x1592a2[_0x81bb('0x1f')];var _0x4c4fa2=_0x22985e?_0x452a9d[_0x81bb('0x20')]:_0x1592a2[_0x81bb('0x1f')]+_0x1592a2[_0x81bb('0x1e')];var _0xdbdda9;if(_0x4c4fa2>=_0x23abc8){_0x4c4fa2=_0x23abc8;_0xdbdda9=0xc8;}else{_0xdbdda9=0xce;}_0x5e539c[_0x81bb('0x1b')](_0xdbdda9);return _0x5e539c[_0x81bb('0x21')](_0x81bb('0x22'),_0x3073b8+'-'+_0x4c4fa2+'/'+_0x23abc8)[_0x81bb('0x23')](_0x452a9d);}return null;};}function patchUpdates(_0x360541){return function(_0x3d778d){try{jsonpatch[_0x81bb('0x24')](_0x3d778d,_0x360541,!![]);}catch(_0x280aae){return BPromise[_0x81bb('0x25')](_0x280aae);}return _0x3d778d[_0x81bb('0x26')]();};}function saveUpdates(_0x5c5cc9,_0x48302c){return function(_0x387fae){if(_0x387fae){return _0x387fae[_0x81bb('0x27')](_0x5c5cc9)['then'](function(_0x79f9e7){return _0x79f9e7;});}return null;};}function removeEntity(_0x23a004,_0x462aef){return function(_0xff5fab){if(_0xff5fab){return _0xff5fab[_0x81bb('0x28')]()['then'](function(){_0x23a004[_0x81bb('0x1b')](0xcc)[_0x81bb('0x1c')]();});}};}function handleEntityNotFound(_0x3834e2,_0x3398c8){return function(_0x2fa3c3){if(!_0x2fa3c3){_0x3834e2['sendStatus'](0x194);}return _0x2fa3c3;};}function handleError(_0x4a33cf,_0x1f295e){_0x1f295e=_0x1f295e||0x1f4;return function(_0x265906){logger[_0x81bb('0x29')](_0x265906[_0x81bb('0x2a')]);if(_0x265906[_0x81bb('0x2b')]){delete _0x265906[_0x81bb('0x2b')];}_0x4a33cf[_0x81bb('0x1b')](_0x1f295e)[_0x81bb('0x2c')](_0x265906);};}exports[_0x81bb('0x2d')]=function(_0x1e9383,_0xae967b){var _0x1d2b02={},_0x23815b={},_0xc99f={'count':0x0,'rows':[]};var _0x4f9678=_['map'](db['VtigerAccount'][_0x81bb('0x2e')],function(_0x24ab34){return{'name':_0x24ab34[_0x81bb('0x2f')],'type':_0x24ab34['type']['key']};});_0x23815b[_0x81bb('0x30')]=_[_0x81bb('0x31')](_0x4f9678,_0x81bb('0x2b'));_0x23815b[_0x81bb('0x32')]=_[_0x81bb('0x33')](_0x1e9383[_0x81bb('0x32')]);_0x23815b[_0x81bb('0x34')]=_[_0x81bb('0x35')](_0x23815b['model'],_0x23815b[_0x81bb('0x32')]);_0x1d2b02['attributes']=_[_0x81bb('0x35')](_0x23815b[_0x81bb('0x30')],qs[_0x81bb('0x36')](_0x1e9383[_0x81bb('0x32')]['fields']));_0x1d2b02[_0x81bb('0x37')]=_0x1d2b02[_0x81bb('0x37')]['length']?_0x1d2b02[_0x81bb('0x37')]:_0x23815b[_0x81bb('0x30')];if(!_0x1e9383[_0x81bb('0x32')][_0x81bb('0x38')](_0x81bb('0x39'))){_0x1d2b02[_0x81bb('0x1e')]=qs[_0x81bb('0x1e')](_0x1e9383[_0x81bb('0x32')]['limit']);_0x1d2b02[_0x81bb('0x1f')]=qs[_0x81bb('0x1f')](_0x1e9383[_0x81bb('0x32')][_0x81bb('0x1f')]);}_0x1d2b02[_0x81bb('0x3a')]=qs['sort'](_0x1e9383['query'][_0x81bb('0x3b')]);_0x1d2b02[_0x81bb('0x3c')]=qs[_0x81bb('0x34')](_[_0x81bb('0x3d')](_0x1e9383[_0x81bb('0x32')],_0x23815b[_0x81bb('0x34')]),_0x4f9678);if(_0x1e9383[_0x81bb('0x32')][_0x81bb('0x3e')]){_0x1d2b02[_0x81bb('0x3c')]=_[_0x81bb('0x3f')](_0x1d2b02[_0x81bb('0x3c')],{'$or':_[_0x81bb('0x31')](_0x4f9678,function(_0x4a434e){if(_0x4a434e[_0x81bb('0x40')]!==_0x81bb('0x41')){var _0x474071={};_0x474071[_0x4a434e[_0x81bb('0x2b')]]={'$like':'%'+_0x1e9383[_0x81bb('0x32')][_0x81bb('0x3e')]+'%'};return _0x474071;}})});}_0x1d2b02=_[_0x81bb('0x3f')]({},_0x1d2b02,_0x1e9383[_0x81bb('0x42')]);var _0x383c80={'where':_0x1d2b02[_0x81bb('0x3c')]};return db[_0x81bb('0x43')]['count'](_0x383c80)[_0x81bb('0x44')](function(_0x53e8f9){_0xc99f[_0x81bb('0x20')]=_0x53e8f9;if(_0x1e9383[_0x81bb('0x32')][_0x81bb('0x45')]){_0x1d2b02[_0x81bb('0x46')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x1d2b02);})['then'](function(_0x3ae72d){_0xc99f[_0x81bb('0x47')]=_0x3ae72d;return _0xc99f;})[_0x81bb('0x44')](respondWithFilteredResult(_0xae967b,_0x1d2b02))[_0x81bb('0x48')](handleError(_0xae967b,null));};exports[_0x81bb('0x49')]=function(_0x2ef8ff,_0x21e80c){var _0x359a28={'raw':![],'where':{'id':_0x2ef8ff[_0x81bb('0x4a')]['id']}},_0x57b3e2={};_0x57b3e2[_0x81bb('0x30')]=_['keys'](db[_0x81bb('0x43')][_0x81bb('0x2e')]);_0x57b3e2[_0x81bb('0x32')]=_['keys'](_0x2ef8ff['query']);_0x57b3e2[_0x81bb('0x34')]=_[_0x81bb('0x35')](_0x57b3e2[_0x81bb('0x30')],_0x57b3e2['query']);_0x359a28[_0x81bb('0x37')]=_[_0x81bb('0x35')](_0x57b3e2[_0x81bb('0x30')],qs[_0x81bb('0x36')](_0x2ef8ff[_0x81bb('0x32')][_0x81bb('0x36')]));_0x359a28[_0x81bb('0x37')]=_0x359a28['attributes'][_0x81bb('0x4b')]?_0x359a28[_0x81bb('0x37')]:_0x57b3e2[_0x81bb('0x30')];if(_0x2ef8ff[_0x81bb('0x32')][_0x81bb('0x45')]){_0x359a28['include']=[{'all':!![]}];}_0x359a28=_['merge']({},_0x359a28,_0x2ef8ff[_0x81bb('0x42')]);return db[_0x81bb('0x43')][_0x81bb('0x4c')](_0x359a28)[_0x81bb('0x44')](handleEntityNotFound(_0x21e80c,null))[_0x81bb('0x44')](respondWithResult(_0x21e80c,null))['catch'](handleError(_0x21e80c,null));};exports['create']=function(_0x52fbd1,_0x4bc5e1){return db['VtigerAccount']['create'](_0x52fbd1[_0x81bb('0x4d')],{})[_0x81bb('0x44')](respondWithResult(_0x4bc5e1,0xc9))[_0x81bb('0x48')](handleError(_0x4bc5e1,null));};exports[_0x81bb('0x27')]=function(_0x432472,_0x50d5a8){if(_0x432472[_0x81bb('0x4d')]['id']){delete _0x432472[_0x81bb('0x4d')]['id'];}return db[_0x81bb('0x43')][_0x81bb('0x4c')]({'where':{'id':_0x432472[_0x81bb('0x4a')]['id']}})[_0x81bb('0x44')](handleEntityNotFound(_0x50d5a8,null))[_0x81bb('0x44')](saveUpdates(_0x432472[_0x81bb('0x4d')],null))[_0x81bb('0x44')](respondWithResult(_0x50d5a8,null))[_0x81bb('0x48')](handleError(_0x50d5a8,null));};exports[_0x81bb('0x28')]=function(_0x55581d,_0xd757d1){return db[_0x81bb('0x43')][_0x81bb('0x4c')]({'where':{'id':_0x55581d[_0x81bb('0x4a')]['id']}})[_0x81bb('0x44')](handleEntityNotFound(_0xd757d1,null))[_0x81bb('0x44')](removeEntity(_0xd757d1,null))['catch'](handleError(_0xd757d1,null));};exports[_0x81bb('0x4e')]=function(_0x578c18,_0x2a2cd6,_0x2763b3){var _0x5aa739={};var _0x327e4c={};var _0x19e083;var _0x5d897a;return db[_0x81bb('0x43')][_0x81bb('0x4f')]({'where':{'id':_0x578c18[_0x81bb('0x4a')]['id']}})[_0x81bb('0x44')](handleEntityNotFound(_0x2a2cd6,null))['then'](function(_0x12270f){if(_0x12270f){_0x19e083=_0x12270f;_0x327e4c[_0x81bb('0x30')]=_[_0x81bb('0x33')](db['VtigerConfiguration'][_0x81bb('0x2e')]);_0x327e4c['query']=_[_0x81bb('0x33')](_0x578c18[_0x81bb('0x32')]);_0x327e4c[_0x81bb('0x34')]=_[_0x81bb('0x35')](_0x327e4c[_0x81bb('0x30')],_0x327e4c[_0x81bb('0x32')]);_0x5aa739[_0x81bb('0x37')]=_[_0x81bb('0x35')](_0x327e4c[_0x81bb('0x30')],qs['fields'](_0x578c18[_0x81bb('0x32')]['fields']));_0x5aa739[_0x81bb('0x37')]=_0x5aa739[_0x81bb('0x37')][_0x81bb('0x4b')]?_0x5aa739[_0x81bb('0x37')]:_0x327e4c[_0x81bb('0x30')];_0x5aa739[_0x81bb('0x3a')]=qs[_0x81bb('0x3b')](_0x578c18[_0x81bb('0x32')][_0x81bb('0x3b')]);_0x5aa739[_0x81bb('0x3c')]=qs[_0x81bb('0x34')](_[_0x81bb('0x3d')](_0x578c18[_0x81bb('0x32')],_0x327e4c['filters']));if(_0x578c18[_0x81bb('0x32')][_0x81bb('0x3e')]){_0x5aa739['where']=_[_0x81bb('0x3f')](_0x5aa739[_0x81bb('0x3c')],{'$or':_['map'](_0x5aa739[_0x81bb('0x37')],function(_0x1a73bd){var _0x2870b7={};_0x2870b7[_0x1a73bd]={'$like':'%'+_0x578c18['query'][_0x81bb('0x3e')]+'%'};return _0x2870b7;})});}_0x5aa739=_[_0x81bb('0x3f')]({},_0x5aa739,_0x578c18[_0x81bb('0x42')]);return _0x19e083[_0x81bb('0x4e')](_0x5aa739);}})['then'](function(_0x480ba8){if(_0x480ba8){_0x5d897a=_0x480ba8[_0x81bb('0x4b')];if(!_0x578c18[_0x81bb('0x32')][_0x81bb('0x38')](_0x81bb('0x39'))){_0x5aa739[_0x81bb('0x1e')]=qs[_0x81bb('0x1e')](_0x578c18[_0x81bb('0x32')][_0x81bb('0x1e')]);_0x5aa739[_0x81bb('0x1f')]=qs[_0x81bb('0x1f')](_0x578c18[_0x81bb('0x32')][_0x81bb('0x1f')]);}return _0x19e083['getConfigurations'](_0x5aa739);}})['then'](function(_0x3c51b3){if(_0x3c51b3){return _0x3c51b3?{'count':_0x5d897a,'rows':_0x3c51b3}:null;}})[_0x81bb('0x44')](respondWithResult(_0x2a2cd6,null))['catch'](handleError(_0x2a2cd6,null));};exports['addConfiguration']=function(_0x130ffd,_0x37bcd8,_0x257ba3){if(_0x130ffd[_0x81bb('0x4d')]['id']){delete _0x130ffd[_0x81bb('0x4d')]['id'];}return db['VtigerAccount'][_0x81bb('0x4f')]({'where':{'id':_0x130ffd[_0x81bb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x37bcd8,null))['then'](function(_0x4314f2){if(_0x4314f2){_0x130ffd[_0x81bb('0x4d')][_0x81bb('0x50')]=_0x4314f2['id'];_0x130ffd['body']['Subjects']=integrations[_0x81bb('0x51')](_0x130ffd['body'][_0x81bb('0x52')],_0x130ffd['body'][_0x81bb('0x40')]);_0x130ffd[_0x81bb('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x130ffd[_0x81bb('0x4d')][_0x81bb('0x52')],_0x130ffd['body'][_0x81bb('0x40')]);return db[_0x81bb('0x53')][_0x81bb('0x54')](_0x130ffd['body'],{'include':[{'model':db[_0x81bb('0x55')],'as':_0x81bb('0x56')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x81bb('0x44')](respondWithResult(_0x37bcd8,null))[_0x81bb('0x48')](handleError(_0x37bcd8,null));};var md5=require(_0x81bb('0x57'));exports[_0x81bb('0x58')]=function(_0x5eac0e,_0x235218,_0x5bf366){var _0x5db02c=null;var _0x25626c=null;var _0x22e001=null;var _0x14e1c6=null;var _0x1548c2='';return db[_0x81bb('0x43')][_0x81bb('0x4f')]({'where':{'id':_0x5eac0e[_0x81bb('0x4a')]['id']},'attributes':['id',_0x81bb('0x2b'),_0x81bb('0x59'),'description','moduleName',_0x81bb('0x5a'),_0x81bb('0x5b'),_0x81bb('0x5c')]})[_0x81bb('0x44')](handleEntityNotFound(_0x235218,null))[_0x81bb('0x44')](function(_0x2f1e0b){if(_0x2f1e0b){_0x5db02c=_0x2f1e0b['username'];_0x25626c=_0x2f1e0b[_0x81bb('0x5c')];_0x22e001=_0x2f1e0b[_0x81bb('0x5d')];_0x1548c2=_0x2f1e0b[_0x81bb('0x5a')];var _0x4e6d11=_0x1548c2[_0x81bb('0x5e')](-0x1);if(_0x4e6d11==='/'){_0x1548c2=_0x1548c2['substring'](0x0,_0x1548c2[_0x81bb('0x5f')](_0x4e6d11));}_0x14e1c6=util[_0x81bb('0x60')](_0x81bb('0x61'),_0x1548c2);var _0x596994={'method':_0x81bb('0x62'),'uri':_0x14e1c6,'qs':{'operation':'getchallenge','username':_0x2f1e0b[_0x81bb('0x59')]},'json':!![]};return rp(_0x596994);}})['then'](function(_0x365d22){if(_0x365d22[_0x81bb('0x63')]){var _0x7378e={'method':_0x81bb('0x64'),'uri':_0x14e1c6,'form':{'operation':_0x81bb('0x65'),'username':_0x5db02c,'accessKey':md5(_0x365d22[_0x81bb('0x66')][_0x81bb('0x67')]+_0x25626c)},'json':!![]};return rp(_0x7378e);}})[_0x81bb('0x44')](function(_0x52bfe5){if(_0x52bfe5[_0x81bb('0x63')]){var _0x980972={'method':_0x81bb('0x62'),'uri':_0x14e1c6,'qs':{'operation':_0x81bb('0x68'),'username':_0x5db02c,'sessionName':_0x52bfe5[_0x81bb('0x66')][_0x81bb('0x69')],'elementType':_0x22e001},'json':!![]};return rp(_0x980972);}})['then'](function(_0x1e147d){if(_0x1e147d['success']){var _0x3125b1=[_0x81bb('0x6a'),_0x81bb('0x6b'),'owner'];_[_0x81bb('0x6c')](_0x1e147d[_0x81bb('0x66')][_0x81bb('0x36')],function(_0x26defb){return _0x3125b1[_0x81bb('0x6d')](_0x26defb[_0x81bb('0x40')][_0x81bb('0x2b')]);});_[_0x81bb('0x6c')](_0x1e147d[_0x81bb('0x66')][_0x81bb('0x36')],function(_0x3c060d){return _0x3c060d[_0x81bb('0x6e')]===_0x81bb('0x6f');});return{'count':_0x1e147d[_0x81bb('0x66')][_0x81bb('0x36')][_0x81bb('0x4b')],'rows':_[_0x81bb('0x31')](_0x1e147d[_0x81bb('0x66')][_0x81bb('0x36')],function(_0x49c330){return{'id':_0x49c330[_0x81bb('0x2b')],'name':_0x49c330[_0x81bb('0x70')],'custom':_[_0x81bb('0x71')](_0x49c330['name'],'cf_')?!![]:![],'options':_0x49c330[_0x81bb('0x40')][_0x81bb('0x2b')]===_0x81bb('0x72')&&_0x49c330['type'][_0x81bb('0x73')][_0x81bb('0x4b')]>0x0?_[_0x81bb('0x31')](_0x49c330[_0x81bb('0x40')]['picklistValues'],function(_0x24ace8){return{'name':_0x24ace8[_0x81bb('0x70')],'value':_0x24ace8[_0x81bb('0x74')]};}):[]};})};}})[_0x81bb('0x44')](respondWithResult(_0x235218,null))[_0x81bb('0x48')](function(_0x55e48a){console[_0x81bb('0x75')](_0x81bb('0x76')+_0x55e48a);var _0x55b35a=_0x5eac0e[_0x81bb('0x32')]['test']?0x1f4:_0x55e48a[_0x81bb('0x77')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x81bb('0x58'),_0x55b35a,JSON[_0x81bb('0x78')](_0x55e48a));delete _0x55e48a[_0x81bb('0x2b')];if(_0x55b35a===0x191){_0x55b35a=0x190;}_0x235218['status'](_0x55b35a)[_0x81bb('0x2c')](_0x5eac0e[_0x81bb('0x32')][_0x81bb('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x55e48a[_0x81bb('0x77')]}:_0x55e48a);});}; \ No newline at end of file +var _0xbc13=['slice','substring','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','remove','editable','false','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','end','error','stack','name','index','map','VtigerAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','update','destroy','params','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username'];(function(_0x93cead,_0x5ba4c1){var _0x1f33e0=function(_0x3aa131){while(--_0x3aa131){_0x93cead['push'](_0x93cead['shift']());}};_0x1f33e0(++_0x5ba4c1);}(_0xbc13,0x10c));var _0x3bc1=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xbc13[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bc1('0x0'));var zipdir=require(_0x3bc1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3bc1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bc1('0x3'));var util=require(_0x3bc1('0x4'));var path=require(_0x3bc1('0x5'));var sox=require(_0x3bc1('0x6'));var csv=require(_0x3bc1('0x7'));var ejs=require(_0x3bc1('0x8'));var fs=require('fs');var fs_extra=require(_0x3bc1('0x9'));var _=require(_0x3bc1('0xa'));var squel=require(_0x3bc1('0xb'));var crypto=require(_0x3bc1('0xc'));var jsforce=require(_0x3bc1('0xd'));var deskjs=require(_0x3bc1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3bc1('0xf'));var Papa=require(_0x3bc1('0x10'));var Redis=require(_0x3bc1('0x11'));var authService=require(_0x3bc1('0x12'));var qs=require(_0x3bc1('0x13'));var as=require(_0x3bc1('0x14'));var hardwareService=require(_0x3bc1('0x15'));var logger=require(_0x3bc1('0x16'))(_0x3bc1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3bc1('0x18'));function respondWithStatusCode(_0x20b9ce,_0x1bdcb6){_0x1bdcb6=_0x1bdcb6||0xcc;return function(_0x2084d1){if(_0x2084d1){return _0x20b9ce[_0x3bc1('0x19')](_0x1bdcb6);}return _0x20b9ce[_0x3bc1('0x1a')](_0x1bdcb6)['end']();};}function respondWithResult(_0x5ec3f3,_0x3402fd){_0x3402fd=_0x3402fd||0xc8;return function(_0x2e1bbc){if(_0x2e1bbc){return _0x5ec3f3['status'](_0x3402fd)['json'](_0x2e1bbc);}};}function respondWithFilteredResult(_0x318d16,_0x4d92b6){return function(_0xc0f8cd){if(_0xc0f8cd){var _0x4ec317=typeof _0x4d92b6[_0x3bc1('0x1b')]==='undefined'&&typeof _0x4d92b6['limit']===_0x3bc1('0x1c');var _0x74c982=_0xc0f8cd[_0x3bc1('0x1d')];var _0x5e5699=_0x4ec317?0x0:_0x4d92b6[_0x3bc1('0x1b')];var _0x147df9=_0x4ec317?_0xc0f8cd[_0x3bc1('0x1d')]:_0x4d92b6[_0x3bc1('0x1b')]+_0x4d92b6[_0x3bc1('0x1e')];var _0x2837c2;if(_0x147df9>=_0x74c982){_0x147df9=_0x74c982;_0x2837c2=0xc8;}else{_0x2837c2=0xce;}_0x318d16[_0x3bc1('0x1a')](_0x2837c2);return _0x318d16[_0x3bc1('0x1f')](_0x3bc1('0x20'),_0x5e5699+'-'+_0x147df9+'/'+_0x74c982)[_0x3bc1('0x21')](_0xc0f8cd);}return null;};}function patchUpdates(_0x44ca79){return function(_0x5e4f66){try{jsonpatch[_0x3bc1('0x22')](_0x5e4f66,_0x44ca79,!![]);}catch(_0x759bbf){return BPromise[_0x3bc1('0x23')](_0x759bbf);}return _0x5e4f66[_0x3bc1('0x24')]();};}function saveUpdates(_0x157cd5,_0x4795ed){return function(_0x20353c){if(_0x20353c){return _0x20353c['update'](_0x157cd5)['then'](function(_0x368687){return _0x368687;});}return null;};}function removeEntity(_0x9599a4,_0x384d79){return function(_0x395461){if(_0x395461){return _0x395461['destroy']()['then'](function(){_0x9599a4[_0x3bc1('0x1a')](0xcc)[_0x3bc1('0x25')]();});}};}function handleEntityNotFound(_0x2d2491,_0x159d0b){return function(_0x418f13){if(!_0x418f13){_0x2d2491[_0x3bc1('0x19')](0x194);}return _0x418f13;};}function handleError(_0x9c1d63,_0x60310){_0x60310=_0x60310||0x1f4;return function(_0xeecddc){logger[_0x3bc1('0x26')](_0xeecddc[_0x3bc1('0x27')]);if(_0xeecddc[_0x3bc1('0x28')]){delete _0xeecddc[_0x3bc1('0x28')];}_0x9c1d63['status'](_0x60310)['send'](_0xeecddc);};}exports[_0x3bc1('0x29')]=function(_0x5c5866,_0x589583){var _0x44a96e={},_0x2d19a6={},_0x2cda2f={'count':0x0,'rows':[]};var _0x3067ff=_[_0x3bc1('0x2a')](db[_0x3bc1('0x2b')]['rawAttributes'],function(_0x3f13ee){return{'name':_0x3f13ee[_0x3bc1('0x2c')],'type':_0x3f13ee[_0x3bc1('0x2d')]['key']};});_0x2d19a6[_0x3bc1('0x2e')]=_[_0x3bc1('0x2a')](_0x3067ff,_0x3bc1('0x28'));_0x2d19a6['query']=_[_0x3bc1('0x2f')](_0x5c5866[_0x3bc1('0x30')]);_0x2d19a6[_0x3bc1('0x31')]=_[_0x3bc1('0x32')](_0x2d19a6[_0x3bc1('0x2e')],_0x2d19a6[_0x3bc1('0x30')]);_0x44a96e[_0x3bc1('0x33')]=_[_0x3bc1('0x32')](_0x2d19a6[_0x3bc1('0x2e')],qs['fields'](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x34')]));_0x44a96e['attributes']=_0x44a96e[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0x44a96e['attributes']:_0x2d19a6['model'];if(!_0x5c5866[_0x3bc1('0x30')]['hasOwnProperty'](_0x3bc1('0x36'))){_0x44a96e[_0x3bc1('0x1e')]=qs['limit'](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x1e')]);_0x44a96e[_0x3bc1('0x1b')]=qs[_0x3bc1('0x1b')](_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x1b')]);}_0x44a96e[_0x3bc1('0x37')]=qs[_0x3bc1('0x38')](_0x5c5866[_0x3bc1('0x30')]['sort']);_0x44a96e[_0x3bc1('0x39')]=qs[_0x3bc1('0x31')](_[_0x3bc1('0x3a')](_0x5c5866['query'],_0x2d19a6[_0x3bc1('0x31')]),_0x3067ff);if(_0x5c5866[_0x3bc1('0x30')]['filter']){_0x44a96e[_0x3bc1('0x39')]=_['merge'](_0x44a96e[_0x3bc1('0x39')],{'$or':_[_0x3bc1('0x2a')](_0x3067ff,function(_0x2e446d){if(_0x2e446d[_0x3bc1('0x2d')]!==_0x3bc1('0x3b')){var _0x1a859d={};_0x1a859d[_0x2e446d[_0x3bc1('0x28')]]={'$like':'%'+_0x5c5866['query'][_0x3bc1('0x3c')]+'%'};return _0x1a859d;}})});}_0x44a96e=_[_0x3bc1('0x3d')]({},_0x44a96e,_0x5c5866[_0x3bc1('0x3e')]);var _0x59bda8={'where':_0x44a96e[_0x3bc1('0x39')]};return db[_0x3bc1('0x2b')][_0x3bc1('0x1d')](_0x59bda8)[_0x3bc1('0x3f')](function(_0x57f5b0){_0x2cda2f[_0x3bc1('0x1d')]=_0x57f5b0;if(_0x5c5866[_0x3bc1('0x30')][_0x3bc1('0x40')]){_0x44a96e[_0x3bc1('0x41')]=[{'all':!![]}];}return db[_0x3bc1('0x2b')][_0x3bc1('0x42')](_0x44a96e);})[_0x3bc1('0x3f')](function(_0x2ed08f){_0x2cda2f[_0x3bc1('0x43')]=_0x2ed08f;return _0x2cda2f;})[_0x3bc1('0x3f')](respondWithFilteredResult(_0x589583,_0x44a96e))[_0x3bc1('0x44')](handleError(_0x589583,null));};exports[_0x3bc1('0x45')]=function(_0x37d10b,_0x44556a){var _0xaf3d2f={'raw':![],'where':{'id':_0x37d10b['params']['id']}},_0x4d9323={};_0x4d9323['model']=_[_0x3bc1('0x2f')](db[_0x3bc1('0x2b')][_0x3bc1('0x46')]);_0x4d9323[_0x3bc1('0x30')]=_[_0x3bc1('0x2f')](_0x37d10b[_0x3bc1('0x30')]);_0x4d9323[_0x3bc1('0x31')]=_['intersection'](_0x4d9323[_0x3bc1('0x2e')],_0x4d9323[_0x3bc1('0x30')]);_0xaf3d2f[_0x3bc1('0x33')]=_['intersection'](_0x4d9323[_0x3bc1('0x2e')],qs[_0x3bc1('0x34')](_0x37d10b[_0x3bc1('0x30')][_0x3bc1('0x34')]));_0xaf3d2f[_0x3bc1('0x33')]=_0xaf3d2f[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0xaf3d2f[_0x3bc1('0x33')]:_0x4d9323[_0x3bc1('0x2e')];if(_0x37d10b[_0x3bc1('0x30')][_0x3bc1('0x40')]){_0xaf3d2f[_0x3bc1('0x41')]=[{'all':!![]}];}_0xaf3d2f=_[_0x3bc1('0x3d')]({},_0xaf3d2f,_0x37d10b[_0x3bc1('0x3e')]);return db[_0x3bc1('0x2b')][_0x3bc1('0x47')](_0xaf3d2f)['then'](handleEntityNotFound(_0x44556a,null))['then'](respondWithResult(_0x44556a,null))[_0x3bc1('0x44')](handleError(_0x44556a,null));};exports['create']=function(_0x54e9c9,_0x3e0b13){return db[_0x3bc1('0x2b')]['create'](_0x54e9c9[_0x3bc1('0x48')],{})['then'](respondWithResult(_0x3e0b13,0xc9))['catch'](handleError(_0x3e0b13,null));};exports[_0x3bc1('0x49')]=function(_0x43dc08,_0x46d914){if(_0x43dc08[_0x3bc1('0x48')]['id']){delete _0x43dc08[_0x3bc1('0x48')]['id'];}return db[_0x3bc1('0x2b')]['find']({'where':{'id':_0x43dc08['params']['id']}})['then'](handleEntityNotFound(_0x46d914,null))[_0x3bc1('0x3f')](saveUpdates(_0x43dc08[_0x3bc1('0x48')],null))['then'](respondWithResult(_0x46d914,null))[_0x3bc1('0x44')](handleError(_0x46d914,null));};exports[_0x3bc1('0x4a')]=function(_0x209a4f,_0x270481){return db['VtigerAccount'][_0x3bc1('0x47')]({'where':{'id':_0x209a4f[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x270481,null))[_0x3bc1('0x3f')](removeEntity(_0x270481,null))[_0x3bc1('0x44')](handleError(_0x270481,null));};exports[_0x3bc1('0x4c')]=function(_0x28eb83,_0x50705b,_0xa57a66){var _0x4a0e85={};var _0x5996ca={};var _0x4295ee;var _0x12597e;return db[_0x3bc1('0x2b')][_0x3bc1('0x4d')]({'where':{'id':_0x28eb83[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x50705b,null))[_0x3bc1('0x3f')](function(_0x6ca17b){if(_0x6ca17b){_0x4295ee=_0x6ca17b;_0x5996ca[_0x3bc1('0x2e')]=_[_0x3bc1('0x2f')](db[_0x3bc1('0x4e')]['rawAttributes']);_0x5996ca['query']=_[_0x3bc1('0x2f')](_0x28eb83[_0x3bc1('0x30')]);_0x5996ca[_0x3bc1('0x31')]=_[_0x3bc1('0x32')](_0x5996ca[_0x3bc1('0x2e')],_0x5996ca[_0x3bc1('0x30')]);_0x4a0e85[_0x3bc1('0x33')]=_[_0x3bc1('0x32')](_0x5996ca[_0x3bc1('0x2e')],qs[_0x3bc1('0x34')](_0x28eb83[_0x3bc1('0x30')]['fields']));_0x4a0e85[_0x3bc1('0x33')]=_0x4a0e85[_0x3bc1('0x33')][_0x3bc1('0x35')]?_0x4a0e85[_0x3bc1('0x33')]:_0x5996ca[_0x3bc1('0x2e')];_0x4a0e85[_0x3bc1('0x37')]=qs[_0x3bc1('0x38')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x38')]);_0x4a0e85[_0x3bc1('0x39')]=qs[_0x3bc1('0x31')](_[_0x3bc1('0x3a')](_0x28eb83[_0x3bc1('0x30')],_0x5996ca[_0x3bc1('0x31')]));if(_0x28eb83['query'][_0x3bc1('0x3c')]){_0x4a0e85[_0x3bc1('0x39')]=_[_0x3bc1('0x3d')](_0x4a0e85[_0x3bc1('0x39')],{'$or':_[_0x3bc1('0x2a')](_0x4a0e85[_0x3bc1('0x33')],function(_0x5613bd){var _0x4efe15={};_0x4efe15[_0x5613bd]={'$like':'%'+_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x3c')]+'%'};return _0x4efe15;})});}_0x4a0e85=_[_0x3bc1('0x3d')]({},_0x4a0e85,_0x28eb83[_0x3bc1('0x3e')]);return _0x4295ee[_0x3bc1('0x4c')](_0x4a0e85);}})[_0x3bc1('0x3f')](function(_0x46f693){if(_0x46f693){_0x12597e=_0x46f693[_0x3bc1('0x35')];if(!_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x4f')](_0x3bc1('0x36'))){_0x4a0e85[_0x3bc1('0x1e')]=qs[_0x3bc1('0x1e')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x1e')]);_0x4a0e85['offset']=qs[_0x3bc1('0x1b')](_0x28eb83[_0x3bc1('0x30')][_0x3bc1('0x1b')]);}return _0x4295ee[_0x3bc1('0x4c')](_0x4a0e85);}})[_0x3bc1('0x3f')](function(_0x1b6653){if(_0x1b6653){return _0x1b6653?{'count':_0x12597e,'rows':_0x1b6653}:null;}})['then'](respondWithResult(_0x50705b,null))['catch'](handleError(_0x50705b,null));};exports[_0x3bc1('0x50')]=function(_0x259510,_0x230439,_0xec0eaa){if(_0x259510[_0x3bc1('0x48')]['id']){delete _0x259510[_0x3bc1('0x48')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x259510[_0x3bc1('0x4b')]['id']}})[_0x3bc1('0x3f')](handleEntityNotFound(_0x230439,null))['then'](function(_0x489043){if(_0x489043){_0x259510['body'][_0x3bc1('0x51')]=_0x489043['id'];_0x259510[_0x3bc1('0x48')][_0x3bc1('0x52')]=integrations['getSubjects'](_0x259510[_0x3bc1('0x48')][_0x3bc1('0x53')],_0x259510[_0x3bc1('0x48')][_0x3bc1('0x2d')]);_0x259510[_0x3bc1('0x48')][_0x3bc1('0x54')]=integrations[_0x3bc1('0x55')](_0x259510['body'][_0x3bc1('0x53')],_0x259510['body']['type']);return db['VtigerConfiguration']['create'](_0x259510[_0x3bc1('0x48')],{'include':[{'model':db[_0x3bc1('0x56')],'as':_0x3bc1('0x52')},{'model':db[_0x3bc1('0x56')],'as':_0x3bc1('0x54')}]});}return null;})[_0x3bc1('0x3f')](respondWithResult(_0x230439,null))[_0x3bc1('0x44')](handleError(_0x230439,null));};var md5=require(_0x3bc1('0x57'));exports[_0x3bc1('0x58')]=function(_0x357b5b,_0x10f555,_0x535b0e){var _0x1517c2=null;var _0x258cec=null;var _0x16bd98=null;var _0x19b4f9=null;var _0x5af13c='';return db[_0x3bc1('0x2b')]['findOne']({'where':{'id':_0x357b5b['params']['id']},'attributes':['id',_0x3bc1('0x28'),'username',_0x3bc1('0x59'),_0x3bc1('0x5a'),_0x3bc1('0x5b'),_0x3bc1('0x5c'),_0x3bc1('0x5d')]})['then'](handleEntityNotFound(_0x10f555,null))['then'](function(_0x253733){if(_0x253733){_0x1517c2=_0x253733[_0x3bc1('0x5e')];_0x258cec=_0x253733[_0x3bc1('0x5d')];_0x16bd98=_0x253733[_0x3bc1('0x5a')];_0x5af13c=_0x253733[_0x3bc1('0x5b')];var _0x19115b=_0x5af13c[_0x3bc1('0x5f')](-0x1);if(_0x19115b==='/'){_0x5af13c=_0x5af13c[_0x3bc1('0x60')](0x0,_0x5af13c['lastIndexOf'](_0x19115b));}_0x19b4f9=util['format']('%s/webservice.php',_0x5af13c);var _0x4f3d69={'method':_0x3bc1('0x61'),'uri':_0x19b4f9,'qs':{'operation':_0x3bc1('0x62'),'username':_0x253733[_0x3bc1('0x5e')]},'json':!![]};return rp(_0x4f3d69);}})[_0x3bc1('0x3f')](function(_0x2c2bd4){if(_0x2c2bd4[_0x3bc1('0x63')]){var _0x2e3f88={'method':_0x3bc1('0x64'),'uri':_0x19b4f9,'form':{'operation':_0x3bc1('0x65'),'username':_0x1517c2,'accessKey':md5(_0x2c2bd4[_0x3bc1('0x66')][_0x3bc1('0x67')]+_0x258cec)},'json':!![]};return rp(_0x2e3f88);}})['then'](function(_0x13b051){if(_0x13b051[_0x3bc1('0x63')]){var _0x4b9f55={'method':_0x3bc1('0x61'),'uri':_0x19b4f9,'qs':{'operation':_0x3bc1('0x68'),'username':_0x1517c2,'sessionName':_0x13b051[_0x3bc1('0x66')][_0x3bc1('0x69')],'elementType':_0x16bd98},'json':!![]};return rp(_0x4b9f55);}})[_0x3bc1('0x3f')](function(_0x378177){if(_0x378177[_0x3bc1('0x63')]){var _0x5cefc2=[_0x3bc1('0x6a'),'reference',_0x3bc1('0x6b')];_['remove'](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x5ee7b3){return _0x5cefc2['includes'](_0x5ee7b3[_0x3bc1('0x2d')][_0x3bc1('0x28')]);});_[_0x3bc1('0x6c')](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x143c6c){return _0x143c6c[_0x3bc1('0x6d')]===_0x3bc1('0x6e');});return{'count':_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')]['length'],'rows':_[_0x3bc1('0x2a')](_0x378177[_0x3bc1('0x66')][_0x3bc1('0x34')],function(_0x21b14a){return{'id':_0x21b14a['name'],'name':_0x21b14a['label'],'custom':_['startsWith'](_0x21b14a[_0x3bc1('0x28')],_0x3bc1('0x6f'))?!![]:![],'options':_0x21b14a[_0x3bc1('0x2d')]['name']===_0x3bc1('0x70')&&_0x21b14a['type'][_0x3bc1('0x71')][_0x3bc1('0x35')]>0x0?_['map'](_0x21b14a['type'][_0x3bc1('0x71')],function(_0x1dfeb4){return{'name':_0x1dfeb4['label'],'value':_0x1dfeb4[_0x3bc1('0x72')]};}):[]};})};}})[_0x3bc1('0x3f')](respondWithResult(_0x10f555,null))['catch'](function(_0x313d58){console['log'](_0x3bc1('0x73')+_0x313d58);var _0x1133cd=_0x357b5b[_0x3bc1('0x30')][_0x3bc1('0x74')]?0x1f4:_0x313d58['statusCode']||0x1f4;logger[_0x3bc1('0x26')](_0x3bc1('0x75'),_0x3bc1('0x58'),_0x1133cd,JSON[_0x3bc1('0x76')](_0x313d58));delete _0x313d58[_0x3bc1('0x28')];if(_0x1133cd===0x191){_0x1133cd=0x190;}_0x10f555[_0x3bc1('0x1a')](_0x1133cd)[_0x3bc1('0x77')](_0x357b5b['query'][_0x3bc1('0x74')]?{'message':_0x3bc1('0x78'),'statusCode':_0x313d58['statusCode']}:_0x313d58);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 233ee82..17abb23 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 _0xac51=['util','../../config/logger','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','exports','VtigerAccount','lodash'];(function(_0x13e7c2,_0x23d0a5){var _0x3087f0=function(_0x8629f0){while(--_0x8629f0){_0x13e7c2['push'](_0x13e7c2['shift']());}};_0x3087f0(++_0x23d0a5);}(_0xac51,0xc7));var _0x1ac5=function(_0x3c1d67,_0x1cc41a){_0x3c1d67=_0x3c1d67-0x0;var _0x32383a=_0xac51[_0x3c1d67];return _0x32383a;};'use strict';var _=require(_0x1ac5('0x0'));var util=require(_0x1ac5('0x1'));var logger=require(_0x1ac5('0x2'))('api');var moment=require(_0x1ac5('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ac5('0x4'));var fs=require('fs');var path=require(_0x1ac5('0x5'));var rimraf=require(_0x1ac5('0x6'));var config=require('../../config/environment');var attributes=require(_0x1ac5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1ac5('0x8')]=function(_0x3a981d,_0x58e914){return _0x3a981d['define'](_0x1ac5('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf606=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x487ab4,_0x1e24e8){var _0x3bef77=function(_0x5ce664){while(--_0x5ce664){_0x487ab4['push'](_0x487ab4['shift']());}};_0x3bef77(++_0x1e24e8);}(_0xf606,0x169));var _0x6f60=function(_0x131eea,_0x12987f){_0x131eea=_0x131eea-0x0;var _0x203e86=_0xf606[_0x131eea];return _0x203e86;};'use strict';var _=require(_0x6f60('0x0'));var util=require(_0x6f60('0x1'));var logger=require(_0x6f60('0x2'))(_0x6f60('0x3'));var moment=require(_0x6f60('0x4'));var BPromise=require(_0x6f60('0x5'));var rp=require(_0x6f60('0x6'));var fs=require('fs');var path=require(_0x6f60('0x7'));var rimraf=require('rimraf');var config=require(_0x6f60('0x8'));var attributes=require(_0x6f60('0x9'));var integrations=require(_0x6f60('0xa'));module[_0x6f60('0xb')]=function(_0x4ceb97,_0x1ec34f){return _0x4ceb97[_0x6f60('0xc')]('VtigerAccount',attributes,{'tableName':_0x6f60('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1bdf5b4..efd7fe3 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','message','catch','VtigerAccount','findAll','options','raw','limit','include','model','attributes','map','then','GetVtigerAccount','stringify','ShowVtigerAccount'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5eb8,0xb0));var _0x85eb=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0x5eb8[_0x18e52b];return _0x3d3062;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetVtigerAccount']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetVtigerAccount',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowVtigerAccount',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0x087b=['find','where','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','limit','map','include','model','GetVtigerAccount','catch','ShowVtigerAccount'];(function(_0x2ec3aa,_0x29bd65){var _0x284ab2=function(_0x41bf34){while(--_0x41bf34){_0x2ec3aa['push'](_0x2ec3aa['shift']());}};_0x284ab2(++_0x29bd65);}(_0x087b,0x11a));var _0xb087=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x087b[_0x580647];return _0x5f0792;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['GetVtigerAccount']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['VtigerAccount'][_0xb087('0x16')]({'raw':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0x330005['options']?_0x330005['options']['where']||null:null,'attributes':_0x330005['options']?_0x330005[_0xb087('0x17')][_0xb087('0x19')]||null:null,'limit':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')][_0xb087('0x1a')]||null:null,'include':_0x330005[_0xb087('0x17')]?_0x330005[_0xb087('0x17')]['include']?_[_0xb087('0x1b')](_0x330005[_0xb087('0x17')][_0xb087('0x1c')],function(_0x1cfb3e){return{'model':db[_0x1cfb3e[_0xb087('0x1d')]],'as':_0x1cfb3e['as'],'attributes':_0x1cfb3e['attributes'],'include':_0x1cfb3e[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x1cfb3e['include'],function(_0x5a2dc6){return{'model':db[_0x5a2dc6['model']],'as':_0x5a2dc6['as'],'attributes':_0x5a2dc6['attributes'],'include':_0x5a2dc6['include']?_[_0xb087('0x1b')](_0x5a2dc6[_0xb087('0x1c')],function(_0x1d124f){return{'model':db[_0x1d124f[_0xb087('0x1d')]],'as':_0x1d124f['as'],'attributes':_0x1d124f[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0xf3f41f){logger[_0xb087('0xd')](_0xb087('0x1e'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x1e'),_0x330005,JSON[_0xb087('0x11')](_0xf3f41f));_0x17200d(_0xf3f41f);})[_0xb087('0x1f')](function(_0x263259){logger['error'](_0xb087('0x1e'),_0x263259[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x263259[_0xb087('0x14')]));});});};exports[_0xb087('0x20')]=function(_0xa6d90c){var _0x2e1c57=this;return new Promise(function(_0x13fb2f,_0x53a535){return db['VtigerAccount'][_0xb087('0x21')]({'raw':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c['options'][_0xb087('0x18')]===undefined?!![]:![]:!![],'where':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x22')]||null:null,'attributes':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x19')]||null:null,'include':_0xa6d90c[_0xb087('0x17')]?_0xa6d90c[_0xb087('0x17')][_0xb087('0x1c')]?_[_0xb087('0x1b')](_0xa6d90c[_0xb087('0x17')]['include'],function(_0x3bec03){return{'model':db[_0x3bec03['model']],'as':_0x3bec03['as'],'attributes':_0x3bec03[_0xb087('0x19')],'include':_0x3bec03[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x3bec03[_0xb087('0x1c')],function(_0x13cb5d){return{'model':db[_0x13cb5d[_0xb087('0x1d')]],'as':_0x13cb5d['as'],'attributes':_0x13cb5d[_0xb087('0x19')],'include':_0x13cb5d[_0xb087('0x1c')]?_[_0xb087('0x1b')](_0x13cb5d['include'],function(_0x5814c2){return{'model':db[_0x5814c2[_0xb087('0x1d')]],'as':_0x5814c2['as'],'attributes':_0x5814c2[_0xb087('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb087('0xc')](function(_0x2d2902){logger[_0xb087('0xd')]('ShowVtigerAccount',_0xa6d90c);logger[_0xb087('0xf')](_0xb087('0x20'),_0xa6d90c,JSON['stringify'](_0x2d2902));_0x13fb2f(_0x2d2902);})['catch'](function(_0x1726c2){logger[_0xb087('0x12')](_0xb087('0x20'),_0x1726c2['message'],_0xa6d90c);_0x53a535(_0x2e1c57[_0xb087('0x12')](0x1f4,_0x1726c2[_0xb087('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6479dcc..5e19392 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 _0x8468=['fs-extra','./intVtigerConfiguration.controller','index','/:id','isAuthenticated','show','get','getSubjects','/:id/descriptions','getDescriptions','post','put','exports','multer','connect-timeout','express','Router'];(function(_0x527466,_0x5a1947){var _0x354527=function(_0x53c061){while(--_0x53c061){_0x527466['push'](_0x527466['shift']());}};_0x354527(++_0x5a1947);}(_0x8468,0x73));var _0x8846=function(_0x161c86,_0x1b865b){_0x161c86=_0x161c86-0x0;var _0x215b67=_0x8468[_0x161c86];return _0x215b67;};'use strict';var multer=require(_0x8846('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8846('0x1'));var express=require(_0x8846('0x2'));var router=express[_0x8846('0x3')]();var fs_extra=require(_0x8846('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8846('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8846('0x6')]);router['get'](_0x8846('0x7'),auth[_0x8846('0x8')](),controller[_0x8846('0x9')]);router[_0x8846('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x8846('0xa')]('/:id/subjects',auth[_0x8846('0x8')](),controller[_0x8846('0xb')]);router[_0x8846('0xa')](_0x8846('0xc'),auth['isAuthenticated'](),controller[_0x8846('0xd')]);router[_0x8846('0xe')]('/',auth[_0x8846('0x8')](),controller['create']);router[_0x8846('0xf')](_0x8846('0x7'),auth[_0x8846('0x8')](),controller['update']);router['delete'](_0x8846('0x7'),auth[_0x8846('0x8')](),controller['destroy']);module[_0x8846('0x10')]=router; \ No newline at end of file +var _0xf8a7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','multer','util','path'];(function(_0x41e880,_0x40d287){var _0x4bf20f=function(_0x1c47a0){while(--_0x1c47a0){_0x41e880['push'](_0x41e880['shift']());}};_0x4bf20f(++_0x40d287);}(_0xf8a7,0xba));var _0x7f8a=function(_0x24da02,_0x5a90e0){_0x24da02=_0x24da02-0x0;var _0x44b2dd=_0xf8a7[_0x24da02];return _0x44b2dd;};'use strict';var multer=require(_0x7f8a('0x0'));var util=require(_0x7f8a('0x1'));var path=require(_0x7f8a('0x2'));var timeout=require(_0x7f8a('0x3'));var express=require(_0x7f8a('0x4'));var router=express[_0x7f8a('0x5')]();var fs_extra=require(_0x7f8a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7f8a('0x7'));var config=require('../../config/environment');var controller=require(_0x7f8a('0x8'));router[_0x7f8a('0x9')]('/',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0xb')]);router[_0x7f8a('0x9')](_0x7f8a('0xc'),auth['isAuthenticated'](),controller[_0x7f8a('0xd')]);router[_0x7f8a('0x9')](_0x7f8a('0xe'),auth['isAuthenticated'](),controller[_0x7f8a('0xf')]);router[_0x7f8a('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7f8a('0x10')]);router[_0x7f8a('0x9')]('/:id/descriptions',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0x11')]);router[_0x7f8a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7f8a('0x13')]('/:id',auth[_0x7f8a('0xa')](),controller[_0x7f8a('0x14')]);router['delete'](_0x7f8a('0xc'),auth[_0x7f8a('0xa')](),controller['destroy']);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 7fe47b0..b2c1fad 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 _0xe1f4=['STRING','sequelize','exports'];(function(_0x2f9858,_0xfb457a){var _0x3abb02=function(_0x34df23){while(--_0x34df23){_0x2f9858['push'](_0x2f9858['shift']());}};_0x3abb02(++_0xfb457a);}(_0xe1f4,0x9a));var _0x4e1f=function(_0x22bdf2,_0x4e7984){_0x22bdf2=_0x22bdf2-0x0;var _0x9a94b0=_0xe1f4[_0x22bdf2];return _0x9a94b0;};'use strict';var Sequelize=require(_0x4e1f('0x0'));module[_0x4e1f('0x1')]={'name':{'type':Sequelize[_0x4e1f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6ca=['STRING'];(function(_0x1d0eda,_0x21b537){var _0x2f8ac1=function(_0x34e393){while(--_0x34e393){_0x1d0eda['push'](_0x1d0eda['shift']());}};_0x2f8ac1(++_0x21b537);}(_0xf6ca,0x128));var _0xaf6c=function(_0x207b82,_0x3dd70e){_0x207b82=_0x207b82-0x0;var _0x35afe4=_0xf6ca[_0x207b82];return _0x35afe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaf6c('0x0')]},'description':{'type':Sequelize[_0xaf6c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2369316..fbadc74 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 _0x51b9=['send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x51b9,0x11b));var _0x951b=function(_0x4abfcd,_0x346eb7){_0x4abfcd=_0x4abfcd-0x0;var _0xb01833=_0x51b9[_0x4abfcd];return _0xb01833;};'use strict';var emlformat=require(_0x951b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x951b('0x1'));var rp=require(_0x951b('0x2'));var moment=require(_0x951b('0x3'));var BPromise=require(_0x951b('0x4'));var Mustache=require(_0x951b('0x5'));var util=require(_0x951b('0x6'));var path=require(_0x951b('0x7'));var sox=require(_0x951b('0x8'));var csv=require(_0x951b('0x9'));var ejs=require(_0x951b('0xa'));var fs=require('fs');var fs_extra=require(_0x951b('0xb'));var _=require(_0x951b('0xc'));var squel=require(_0x951b('0xd'));var crypto=require(_0x951b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x951b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x951b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x951b('0x11'));var hardwareService=require(_0x951b('0x12'));var logger=require('../../config/logger')(_0x951b('0x13'));var utils=require('../../config/utils');var config=require(_0x951b('0x14'));var licenseUtil=require(_0x951b('0x15'));var db=require(_0x951b('0x16'))['db'];function respondWithStatusCode(_0x4dddc9,_0x15c7ad){_0x15c7ad=_0x15c7ad||0xcc;return function(_0x49ffb0){if(_0x49ffb0){return _0x4dddc9[_0x951b('0x17')](_0x15c7ad);}return _0x4dddc9['status'](_0x15c7ad)[_0x951b('0x18')]();};}function respondWithResult(_0x53c07e,_0x286c11){_0x286c11=_0x286c11||0xc8;return function(_0x11f2c){if(_0x11f2c){return _0x53c07e[_0x951b('0x19')](_0x286c11)[_0x951b('0x1a')](_0x11f2c);}};}function respondWithFilteredResult(_0x5cc55a,_0x53ff4e){return function(_0x1e262f){if(_0x1e262f){var _0x4f77bd=typeof _0x53ff4e[_0x951b('0x1b')]===_0x951b('0x1c')&&typeof _0x53ff4e['limit']===_0x951b('0x1c');var _0x3fc620=_0x1e262f[_0x951b('0x1d')];var _0x49f5af=_0x4f77bd?0x0:_0x53ff4e[_0x951b('0x1b')];var _0x7f4d9e=_0x4f77bd?_0x1e262f['count']:_0x53ff4e['offset']+_0x53ff4e[_0x951b('0x1e')];var _0x48e869;if(_0x7f4d9e>=_0x3fc620){_0x7f4d9e=_0x3fc620;_0x48e869=0xc8;}else{_0x48e869=0xce;}_0x5cc55a['status'](_0x48e869);return _0x5cc55a[_0x951b('0x1f')](_0x951b('0x20'),_0x49f5af+'-'+_0x7f4d9e+'/'+_0x3fc620)[_0x951b('0x1a')](_0x1e262f);}return null;};}function patchUpdates(_0xde8ede){return function(_0xb66652){try{jsonpatch[_0x951b('0x21')](_0xb66652,_0xde8ede,!![]);}catch(_0x4a4e30){return BPromise['reject'](_0x4a4e30);}return _0xb66652[_0x951b('0x22')]();};}function saveUpdates(_0x134e6c,_0x4ebd8c){return function(_0x362d2c){if(_0x362d2c){return _0x362d2c[_0x951b('0x23')](_0x134e6c)[_0x951b('0x24')](function(_0x5e9397){return _0x5e9397;});}return null;};}function removeEntity(_0x118834,_0x50a0d5){return function(_0x5cd3aa){if(_0x5cd3aa){return _0x5cd3aa[_0x951b('0x25')]()['then'](function(){_0x118834[_0x951b('0x19')](0xcc)[_0x951b('0x18')]();});}};}function handleEntityNotFound(_0x37b1ad,_0x28ac29){return function(_0x1a1b51){if(!_0x1a1b51){_0x37b1ad[_0x951b('0x17')](0x194);}return _0x1a1b51;};}function handleError(_0x8791d3,_0x4c611d){_0x4c611d=_0x4c611d||0x1f4;return function(_0x2d3022){logger[_0x951b('0x26')](_0x2d3022[_0x951b('0x27')]);if(_0x2d3022['name']){delete _0x2d3022[_0x951b('0x28')];}_0x8791d3[_0x951b('0x19')](_0x4c611d)[_0x951b('0x29')](_0x2d3022);};}exports[_0x951b('0x2a')]=function(_0x70d32d,_0x704b14){var _0x174f1d={},_0x3b199d={},_0x376299={'count':0x0,'rows':[]};var _0x2d8087=_[_0x951b('0x2b')](db[_0x951b('0x2c')]['rawAttributes'],function(_0x3668cd){return{'name':_0x3668cd[_0x951b('0x2d')],'type':_0x3668cd[_0x951b('0x2e')][_0x951b('0x2f')]};});_0x3b199d[_0x951b('0x30')]=_['map'](_0x2d8087,'name');_0x3b199d[_0x951b('0x31')]=_[_0x951b('0x32')](_0x70d32d['query']);_0x3b199d['filters']=_[_0x951b('0x33')](_0x3b199d['model'],_0x3b199d[_0x951b('0x31')]);_0x174f1d[_0x951b('0x34')]=_['intersection'](_0x3b199d[_0x951b('0x30')],qs[_0x951b('0x35')](_0x70d32d[_0x951b('0x31')][_0x951b('0x35')]));_0x174f1d['attributes']=_0x174f1d[_0x951b('0x34')][_0x951b('0x36')]?_0x174f1d[_0x951b('0x34')]:_0x3b199d[_0x951b('0x30')];if(!_0x70d32d[_0x951b('0x31')]['hasOwnProperty'](_0x951b('0x37'))){_0x174f1d[_0x951b('0x1e')]=qs[_0x951b('0x1e')](_0x70d32d[_0x951b('0x31')]['limit']);_0x174f1d[_0x951b('0x1b')]=qs[_0x951b('0x1b')](_0x70d32d[_0x951b('0x31')]['offset']);}_0x174f1d[_0x951b('0x38')]=qs[_0x951b('0x39')](_0x70d32d[_0x951b('0x31')][_0x951b('0x39')]);_0x174f1d[_0x951b('0x3a')]=qs[_0x951b('0x3b')](_[_0x951b('0x3c')](_0x70d32d['query'],_0x3b199d[_0x951b('0x3b')]),_0x2d8087);if(_0x70d32d[_0x951b('0x31')]['filter']){_0x174f1d[_0x951b('0x3a')]=_[_0x951b('0x3d')](_0x174f1d[_0x951b('0x3a')],{'$or':_[_0x951b('0x2b')](_0x2d8087,function(_0x4b4327){if(_0x4b4327[_0x951b('0x2e')]!==_0x951b('0x3e')){var _0x3ea89c={};_0x3ea89c[_0x4b4327[_0x951b('0x28')]]={'$like':'%'+_0x70d32d[_0x951b('0x31')][_0x951b('0x3f')]+'%'};return _0x3ea89c;}})});}_0x174f1d=_['merge']({},_0x174f1d,_0x70d32d[_0x951b('0x40')]);var _0x5e887d={'where':_0x174f1d[_0x951b('0x3a')]};return db[_0x951b('0x2c')][_0x951b('0x1d')](_0x5e887d)[_0x951b('0x24')](function(_0xa6c9d5){_0x376299['count']=_0xa6c9d5;if(_0x70d32d['query'][_0x951b('0x41')]){_0x174f1d[_0x951b('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x951b('0x43')](_0x174f1d);})[_0x951b('0x24')](function(_0x5f3455){_0x376299['rows']=_0x5f3455;return _0x376299;})[_0x951b('0x24')](respondWithFilteredResult(_0x704b14,_0x174f1d))[_0x951b('0x44')](handleError(_0x704b14,null));};exports[_0x951b('0x45')]=function(_0x4c004a,_0x45f102){var _0x2dafcf={'raw':![],'where':{'id':_0x4c004a[_0x951b('0x46')]['id']}},_0x2c4f4b={};_0x2c4f4b[_0x951b('0x30')]=_[_0x951b('0x32')](db[_0x951b('0x2c')][_0x951b('0x47')]);_0x2c4f4b[_0x951b('0x31')]=_[_0x951b('0x32')](_0x4c004a[_0x951b('0x31')]);_0x2c4f4b[_0x951b('0x3b')]=_['intersection'](_0x2c4f4b['model'],_0x2c4f4b[_0x951b('0x31')]);_0x2dafcf['attributes']=_['intersection'](_0x2c4f4b['model'],qs[_0x951b('0x35')](_0x4c004a[_0x951b('0x31')]['fields']));_0x2dafcf[_0x951b('0x34')]=_0x2dafcf['attributes']['length']?_0x2dafcf[_0x951b('0x34')]:_0x2c4f4b[_0x951b('0x30')];if(_0x4c004a['query']['includeAll']){_0x2dafcf['include']=[{'all':!![]}];}_0x2dafcf=_[_0x951b('0x3d')]({},_0x2dafcf,_0x4c004a[_0x951b('0x40')]);return db[_0x951b('0x2c')][_0x951b('0x48')](_0x2dafcf)[_0x951b('0x24')](handleEntityNotFound(_0x45f102,null))[_0x951b('0x24')](respondWithResult(_0x45f102,null))[_0x951b('0x44')](handleError(_0x45f102,null));};exports[_0x951b('0x49')]=function(_0x12258f,_0x5eb99f){return db['VtigerConfiguration'][_0x951b('0x49')](_0x12258f[_0x951b('0x4a')],{})[_0x951b('0x24')](respondWithResult(_0x5eb99f,0xc9))[_0x951b('0x44')](handleError(_0x5eb99f,null));};exports[_0x951b('0x23')]=function(_0x4829de,_0xaaa2f8){if(_0x4829de[_0x951b('0x4a')]['id']){delete _0x4829de['body']['id'];}return db[_0x951b('0x2c')]['find']({'where':{'id':_0x4829de[_0x951b('0x46')]['id']}})['then'](handleEntityNotFound(_0xaaa2f8,null))[_0x951b('0x24')](saveUpdates(_0x4829de[_0x951b('0x4a')],null))[_0x951b('0x24')](respondWithResult(_0xaaa2f8,null))[_0x951b('0x44')](handleError(_0xaaa2f8,null));};exports[_0x951b('0x25')]=function(_0x3eb2a4,_0x3c8b90){return db[_0x951b('0x2c')][_0x951b('0x48')]({'where':{'id':_0x3eb2a4['params']['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x3c8b90,null))[_0x951b('0x24')](removeEntity(_0x3c8b90,null))[_0x951b('0x44')](handleError(_0x3c8b90,null));};exports[_0x951b('0x4b')]=function(_0x2eeb88,_0x165fcc,_0x333352){var _0x20225d={};var _0x4738fc={};var _0x4599a1;var _0x4bacec;return db['VtigerConfiguration'][_0x951b('0x4c')]({'where':{'id':_0x2eeb88['params']['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x165fcc,null))[_0x951b('0x24')](function(_0x57b765){if(_0x57b765){_0x4599a1=_0x57b765;_0x4738fc[_0x951b('0x30')]=_[_0x951b('0x32')](db[_0x951b('0x4d')][_0x951b('0x47')]);_0x4738fc[_0x951b('0x31')]=_['keys'](_0x2eeb88[_0x951b('0x31')]);_0x4738fc[_0x951b('0x3b')]=_[_0x951b('0x33')](_0x4738fc[_0x951b('0x30')],_0x4738fc[_0x951b('0x31')]);_0x20225d['attributes']=_[_0x951b('0x33')](_0x4738fc['model'],qs[_0x951b('0x35')](_0x2eeb88[_0x951b('0x31')][_0x951b('0x35')]));_0x20225d[_0x951b('0x34')]=_0x20225d[_0x951b('0x34')]['length']?_0x20225d[_0x951b('0x34')]:_0x4738fc[_0x951b('0x30')];_0x20225d[_0x951b('0x38')]=qs[_0x951b('0x39')](_0x2eeb88[_0x951b('0x31')][_0x951b('0x39')]);_0x20225d[_0x951b('0x3a')]=qs[_0x951b('0x3b')](_[_0x951b('0x3c')](_0x2eeb88[_0x951b('0x31')],_0x4738fc['filters']));if(_0x2eeb88[_0x951b('0x31')][_0x951b('0x3f')]){_0x20225d[_0x951b('0x3a')]=_['merge'](_0x20225d[_0x951b('0x3a')],{'$or':_['map'](_0x20225d[_0x951b('0x34')],function(_0x2b1440){var _0x2f75d5={};_0x2f75d5[_0x2b1440]={'$like':'%'+_0x2eeb88[_0x951b('0x31')]['filter']+'%'};return _0x2f75d5;})});}_0x20225d=_['merge']({},_0x20225d,_0x2eeb88[_0x951b('0x40')]);return _0x4599a1[_0x951b('0x4b')](_0x20225d);}})[_0x951b('0x24')](function(_0x350fdc){if(_0x350fdc){_0x4bacec=_0x350fdc[_0x951b('0x36')];if(!_0x2eeb88[_0x951b('0x31')][_0x951b('0x4e')](_0x951b('0x37'))){_0x20225d[_0x951b('0x1e')]=qs['limit'](_0x2eeb88[_0x951b('0x31')][_0x951b('0x1e')]);_0x20225d[_0x951b('0x1b')]=qs[_0x951b('0x1b')](_0x2eeb88['query'][_0x951b('0x1b')]);}return _0x4599a1[_0x951b('0x4b')](_0x20225d);}})['then'](function(_0x23c927){if(_0x23c927){return _0x23c927?{'count':_0x4bacec,'rows':_0x23c927}:null;}})['then'](respondWithResult(_0x165fcc,null))[_0x951b('0x44')](handleError(_0x165fcc,null));};exports[_0x951b('0x4f')]=function(_0x32bf38,_0x2c0ebf,_0x31c657){var _0x4c492b={};var _0x57e4bf={};var _0x2a117b;var _0x1595d4;return db[_0x951b('0x2c')]['findOne']({'where':{'id':_0x32bf38[_0x951b('0x46')]['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x2c0ebf,null))[_0x951b('0x24')](function(_0x5299a1){if(_0x5299a1){_0x2a117b=_0x5299a1;_0x57e4bf[_0x951b('0x30')]=_[_0x951b('0x32')](db[_0x951b('0x4d')][_0x951b('0x47')]);_0x57e4bf[_0x951b('0x31')]=_['keys'](_0x32bf38[_0x951b('0x31')]);_0x57e4bf[_0x951b('0x3b')]=_[_0x951b('0x33')](_0x57e4bf['model'],_0x57e4bf[_0x951b('0x31')]);_0x4c492b[_0x951b('0x34')]=_[_0x951b('0x33')](_0x57e4bf[_0x951b('0x30')],qs[_0x951b('0x35')](_0x32bf38[_0x951b('0x31')][_0x951b('0x35')]));_0x4c492b[_0x951b('0x34')]=_0x4c492b[_0x951b('0x34')][_0x951b('0x36')]?_0x4c492b[_0x951b('0x34')]:_0x57e4bf[_0x951b('0x30')];_0x4c492b[_0x951b('0x38')]=qs['sort'](_0x32bf38[_0x951b('0x31')]['sort']);_0x4c492b['where']=qs[_0x951b('0x3b')](_['pick'](_0x32bf38[_0x951b('0x31')],_0x57e4bf[_0x951b('0x3b')]));if(_0x32bf38[_0x951b('0x31')]['filter']){_0x4c492b['where']=_[_0x951b('0x3d')](_0x4c492b[_0x951b('0x3a')],{'$or':_['map'](_0x4c492b['attributes'],function(_0x3184e1){var _0x4b7f64={};_0x4b7f64[_0x3184e1]={'$like':'%'+_0x32bf38[_0x951b('0x31')]['filter']+'%'};return _0x4b7f64;})});}_0x4c492b=_[_0x951b('0x3d')]({},_0x4c492b,_0x32bf38[_0x951b('0x40')]);return _0x2a117b[_0x951b('0x4f')](_0x4c492b);}})[_0x951b('0x24')](function(_0x4249b9){if(_0x4249b9){_0x1595d4=_0x4249b9[_0x951b('0x36')];if(!_0x32bf38['query']['hasOwnProperty']('nolimit')){_0x4c492b[_0x951b('0x1e')]=qs[_0x951b('0x1e')](_0x32bf38[_0x951b('0x31')]['limit']);_0x4c492b[_0x951b('0x1b')]=qs['offset'](_0x32bf38['query'][_0x951b('0x1b')]);}return _0x2a117b[_0x951b('0x4f')](_0x4c492b);}})[_0x951b('0x24')](function(_0xaa65f9){if(_0xaa65f9){return _0xaa65f9?{'count':_0x1595d4,'rows':_0xaa65f9}:null;}})[_0x951b('0x24')](respondWithResult(_0x2c0ebf,null))['catch'](handleError(_0x2c0ebf,null));};exports[_0x951b('0x50')]=function(_0x3955fc,_0x84b263,_0x554775){var _0x5f138b={};var _0x46dcf8={};var _0x49e7a7;var _0x5255a4;return db[_0x951b('0x2c')]['findOne']({'where':{'id':_0x3955fc['params']['id']}})[_0x951b('0x24')](handleEntityNotFound(_0x84b263,null))[_0x951b('0x24')](function(_0x333fe7){if(_0x333fe7){_0x49e7a7=_0x333fe7;_0x46dcf8[_0x951b('0x30')]=_[_0x951b('0x32')](db[_0x951b('0x4d')]['rawAttributes']);_0x46dcf8[_0x951b('0x31')]=_[_0x951b('0x32')](_0x3955fc['query']);_0x46dcf8[_0x951b('0x3b')]=_['intersection'](_0x46dcf8[_0x951b('0x30')],_0x46dcf8[_0x951b('0x31')]);_0x5f138b['attributes']=_[_0x951b('0x33')](_0x46dcf8['model'],qs[_0x951b('0x35')](_0x3955fc[_0x951b('0x31')][_0x951b('0x35')]));_0x5f138b['attributes']=_0x5f138b['attributes'][_0x951b('0x36')]?_0x5f138b[_0x951b('0x34')]:_0x46dcf8[_0x951b('0x30')];_0x5f138b[_0x951b('0x38')]=qs[_0x951b('0x39')](_0x3955fc[_0x951b('0x31')]['sort']);_0x5f138b[_0x951b('0x3a')]=qs[_0x951b('0x3b')](_[_0x951b('0x3c')](_0x3955fc[_0x951b('0x31')],_0x46dcf8[_0x951b('0x3b')]));if(_0x3955fc[_0x951b('0x31')][_0x951b('0x3f')]){_0x5f138b[_0x951b('0x3a')]=_['merge'](_0x5f138b['where'],{'$or':_[_0x951b('0x2b')](_0x5f138b['attributes'],function(_0x3f338d){var _0x5ada01={};_0x5ada01[_0x3f338d]={'$like':'%'+_0x3955fc['query'][_0x951b('0x3f')]+'%'};return _0x5ada01;})});}_0x5f138b=_[_0x951b('0x3d')]({},_0x5f138b,_0x3955fc['options']);return _0x49e7a7[_0x951b('0x50')](_0x5f138b);}})['then'](function(_0xf416c4){if(_0xf416c4){_0x5255a4=_0xf416c4['length'];if(!_0x3955fc['query'][_0x951b('0x4e')](_0x951b('0x37'))){_0x5f138b['limit']=qs['limit'](_0x3955fc[_0x951b('0x31')][_0x951b('0x1e')]);_0x5f138b[_0x951b('0x1b')]=qs[_0x951b('0x1b')](_0x3955fc['query'][_0x951b('0x1b')]);}return _0x49e7a7[_0x951b('0x50')](_0x5f138b);}})[_0x951b('0x24')](function(_0x4afd74){if(_0x4afd74){return _0x4afd74?{'count':_0x5255a4,'rows':_0x4afd74}:null;}})['then'](respondWithResult(_0x84b263,null))['catch'](handleError(_0x84b263,null));}; \ No newline at end of file +var _0x175f=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getFields','VtigerField','order','findOne','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','key','map','query'];(function(_0xfd5ec6,_0x3c1203){var _0x4c585c=function(_0x1081c2){while(--_0x1081c2){_0xfd5ec6['push'](_0xfd5ec6['shift']());}};_0x4c585c(++_0x3c1203);}(_0x175f,0x1ab));var _0xf175=function(_0x30bc61,_0xb834ed){_0x30bc61=_0x30bc61-0x0;var _0x214191=_0x175f[_0x30bc61];return _0x214191;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf175('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf175('0x1'));var rp=require(_0xf175('0x2'));var moment=require('moment');var BPromise=require(_0xf175('0x3'));var Mustache=require(_0xf175('0x4'));var util=require(_0xf175('0x5'));var path=require(_0xf175('0x6'));var sox=require(_0xf175('0x7'));var csv=require(_0xf175('0x8'));var ejs=require(_0xf175('0x9'));var fs=require('fs');var fs_extra=require(_0xf175('0xa'));var _=require(_0xf175('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf175('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf175('0x8'));var querystring=require('querystring');var Papa=require(_0xf175('0xd'));var Redis=require(_0xf175('0xe'));var authService=require(_0xf175('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf175('0x10'));var logger=require(_0xf175('0x11'))('api');var utils=require(_0xf175('0x12'));var config=require(_0xf175('0x13'));var licenseUtil=require(_0xf175('0x14'));var db=require(_0xf175('0x15'))['db'];function respondWithStatusCode(_0x243176,_0x16295b){_0x16295b=_0x16295b||0xcc;return function(_0x542259){if(_0x542259){return _0x243176[_0xf175('0x16')](_0x16295b);}return _0x243176['status'](_0x16295b)[_0xf175('0x17')]();};}function respondWithResult(_0x7aeef9,_0xe80c6f){_0xe80c6f=_0xe80c6f||0xc8;return function(_0x66a11d){if(_0x66a11d){return _0x7aeef9[_0xf175('0x18')](_0xe80c6f)[_0xf175('0x19')](_0x66a11d);}};}function respondWithFilteredResult(_0x4fa1e9,_0x3bf953){return function(_0x83a11d){if(_0x83a11d){var _0x1a2798=typeof _0x3bf953['offset']==='undefined'&&typeof _0x3bf953[_0xf175('0x1a')]===_0xf175('0x1b');var _0x48a38a=_0x83a11d[_0xf175('0x1c')];var _0x4d2247=_0x1a2798?0x0:_0x3bf953[_0xf175('0x1d')];var _0x25cac8=_0x1a2798?_0x83a11d[_0xf175('0x1c')]:_0x3bf953[_0xf175('0x1d')]+_0x3bf953['limit'];var _0x25866b;if(_0x25cac8>=_0x48a38a){_0x25cac8=_0x48a38a;_0x25866b=0xc8;}else{_0x25866b=0xce;}_0x4fa1e9[_0xf175('0x18')](_0x25866b);return _0x4fa1e9[_0xf175('0x1e')](_0xf175('0x1f'),_0x4d2247+'-'+_0x25cac8+'/'+_0x48a38a)[_0xf175('0x19')](_0x83a11d);}return null;};}function patchUpdates(_0x37e6f5){return function(_0x2dbba6){try{jsonpatch[_0xf175('0x20')](_0x2dbba6,_0x37e6f5,!![]);}catch(_0x2069d2){return BPromise[_0xf175('0x21')](_0x2069d2);}return _0x2dbba6['save']();};}function saveUpdates(_0x599318,_0x6572d6){return function(_0xd3fa8c){if(_0xd3fa8c){return _0xd3fa8c['update'](_0x599318)[_0xf175('0x22')](function(_0x32cde2){return _0x32cde2;});}return null;};}function removeEntity(_0x2635b7,_0x55f4d5){return function(_0x2b4abf){if(_0x2b4abf){return _0x2b4abf[_0xf175('0x23')]()[_0xf175('0x22')](function(){_0x2635b7[_0xf175('0x18')](0xcc)[_0xf175('0x17')]();});}};}function handleEntityNotFound(_0x51f388,_0x256863){return function(_0x940f4d){if(!_0x940f4d){_0x51f388[_0xf175('0x16')](0x194);}return _0x940f4d;};}function handleError(_0x5c99b5,_0x5152a2){_0x5152a2=_0x5152a2||0x1f4;return function(_0x2cc47b){logger[_0xf175('0x24')](_0x2cc47b[_0xf175('0x25')]);if(_0x2cc47b[_0xf175('0x26')]){delete _0x2cc47b[_0xf175('0x26')];}_0x5c99b5[_0xf175('0x18')](_0x5152a2)[_0xf175('0x27')](_0x2cc47b);};}exports[_0xf175('0x28')]=function(_0xed036f,_0x33b281){var _0x3cfe5d={},_0x597c83={},_0xe1e09b={'count':0x0,'rows':[]};var _0x4d6c52=_['map'](db[_0xf175('0x29')][_0xf175('0x2a')],function(_0x5d75d9){return{'name':_0x5d75d9[_0xf175('0x2b')],'type':_0x5d75d9['type'][_0xf175('0x2c')]};});_0x597c83['model']=_[_0xf175('0x2d')](_0x4d6c52,_0xf175('0x26'));_0x597c83[_0xf175('0x2e')]=_['keys'](_0xed036f[_0xf175('0x2e')]);_0x597c83['filters']=_['intersection'](_0x597c83['model'],_0x597c83[_0xf175('0x2e')]);_0x3cfe5d['attributes']=_[_0xf175('0x2f')](_0x597c83[_0xf175('0x30')],qs[_0xf175('0x31')](_0xed036f['query'][_0xf175('0x31')]));_0x3cfe5d['attributes']=_0x3cfe5d[_0xf175('0x32')][_0xf175('0x33')]?_0x3cfe5d[_0xf175('0x32')]:_0x597c83[_0xf175('0x30')];if(!_0xed036f['query'][_0xf175('0x34')](_0xf175('0x35'))){_0x3cfe5d[_0xf175('0x1a')]=qs[_0xf175('0x1a')](_0xed036f[_0xf175('0x2e')][_0xf175('0x1a')]);_0x3cfe5d[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0xed036f[_0xf175('0x2e')]['offset']);}_0x3cfe5d['order']=qs[_0xf175('0x36')](_0xed036f[_0xf175('0x2e')][_0xf175('0x36')]);_0x3cfe5d[_0xf175('0x37')]=qs['filters'](_[_0xf175('0x38')](_0xed036f[_0xf175('0x2e')],_0x597c83[_0xf175('0x39')]),_0x4d6c52);if(_0xed036f[_0xf175('0x2e')][_0xf175('0x3a')]){_0x3cfe5d[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x3cfe5d['where'],{'$or':_[_0xf175('0x2d')](_0x4d6c52,function(_0x577857){if(_0x577857[_0xf175('0x3c')]!=='VIRTUAL'){var _0x2eff90={};_0x2eff90[_0x577857[_0xf175('0x26')]]={'$like':'%'+_0xed036f[_0xf175('0x2e')]['filter']+'%'};return _0x2eff90;}})});}_0x3cfe5d=_['merge']({},_0x3cfe5d,_0xed036f[_0xf175('0x3d')]);var _0xc94abc={'where':_0x3cfe5d[_0xf175('0x37')]};return db['VtigerConfiguration'][_0xf175('0x1c')](_0xc94abc)[_0xf175('0x22')](function(_0x43004a){_0xe1e09b['count']=_0x43004a;if(_0xed036f[_0xf175('0x2e')]['includeAll']){_0x3cfe5d[_0xf175('0x3e')]=[{'all':!![]}];}return db[_0xf175('0x29')][_0xf175('0x3f')](_0x3cfe5d);})[_0xf175('0x22')](function(_0x8d2be1){_0xe1e09b[_0xf175('0x40')]=_0x8d2be1;return _0xe1e09b;})['then'](respondWithFilteredResult(_0x33b281,_0x3cfe5d))[_0xf175('0x41')](handleError(_0x33b281,null));};exports[_0xf175('0x42')]=function(_0x4cf345,_0xf9a12f){var _0x3483ba={'raw':![],'where':{'id':_0x4cf345[_0xf175('0x43')]['id']}},_0x20e76e={};_0x20e76e[_0xf175('0x30')]=_[_0xf175('0x44')](db[_0xf175('0x29')][_0xf175('0x2a')]);_0x20e76e[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x4cf345[_0xf175('0x2e')]);_0x20e76e[_0xf175('0x39')]=_['intersection'](_0x20e76e[_0xf175('0x30')],_0x20e76e[_0xf175('0x2e')]);_0x3483ba[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x20e76e[_0xf175('0x30')],qs[_0xf175('0x31')](_0x4cf345['query'][_0xf175('0x31')]));_0x3483ba[_0xf175('0x32')]=_0x3483ba[_0xf175('0x32')][_0xf175('0x33')]?_0x3483ba[_0xf175('0x32')]:_0x20e76e[_0xf175('0x30')];if(_0x4cf345[_0xf175('0x2e')][_0xf175('0x45')]){_0x3483ba[_0xf175('0x3e')]=[{'all':!![]}];}_0x3483ba=_[_0xf175('0x3b')]({},_0x3483ba,_0x4cf345[_0xf175('0x3d')]);return db[_0xf175('0x29')][_0xf175('0x46')](_0x3483ba)['then'](handleEntityNotFound(_0xf9a12f,null))[_0xf175('0x22')](respondWithResult(_0xf9a12f,null))['catch'](handleError(_0xf9a12f,null));};exports['create']=function(_0x569177,_0x225ddf){return db[_0xf175('0x29')][_0xf175('0x47')](_0x569177[_0xf175('0x48')],{})[_0xf175('0x22')](respondWithResult(_0x225ddf,0xc9))[_0xf175('0x41')](handleError(_0x225ddf,null));};exports['update']=function(_0x583a9b,_0x1e77fd){if(_0x583a9b['body']['id']){delete _0x583a9b[_0xf175('0x48')]['id'];}return db[_0xf175('0x29')][_0xf175('0x46')]({'where':{'id':_0x583a9b['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x1e77fd,null))[_0xf175('0x22')](saveUpdates(_0x583a9b['body'],null))[_0xf175('0x22')](respondWithResult(_0x1e77fd,null))[_0xf175('0x41')](handleError(_0x1e77fd,null));};exports[_0xf175('0x23')]=function(_0x491ebf,_0x1526ec){return db[_0xf175('0x29')]['find']({'where':{'id':_0x491ebf[_0xf175('0x43')]['id']}})['then'](handleEntityNotFound(_0x1526ec,null))[_0xf175('0x22')](removeEntity(_0x1526ec,null))['catch'](handleError(_0x1526ec,null));};exports[_0xf175('0x49')]=function(_0x185c72,_0x26a161,_0x1b1d42){var _0x1d889f={};var _0x4992ce={};var _0x555781;var _0x5d539b;return db[_0xf175('0x29')]['findOne']({'where':{'id':_0x185c72['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x26a161,null))['then'](function(_0x41fe78){if(_0x41fe78){_0x555781=_0x41fe78;_0x4992ce[_0xf175('0x30')]=_['keys'](db[_0xf175('0x4a')]['rawAttributes']);_0x4992ce['query']=_[_0xf175('0x44')](_0x185c72['query']);_0x4992ce[_0xf175('0x39')]=_[_0xf175('0x2f')](_0x4992ce[_0xf175('0x30')],_0x4992ce[_0xf175('0x2e')]);_0x1d889f[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x4992ce['model'],qs[_0xf175('0x31')](_0x185c72['query'][_0xf175('0x31')]));_0x1d889f[_0xf175('0x32')]=_0x1d889f[_0xf175('0x32')]['length']?_0x1d889f[_0xf175('0x32')]:_0x4992ce[_0xf175('0x30')];_0x1d889f[_0xf175('0x4b')]=qs['sort'](_0x185c72[_0xf175('0x2e')][_0xf175('0x36')]);_0x1d889f['where']=qs['filters'](_['pick'](_0x185c72[_0xf175('0x2e')],_0x4992ce[_0xf175('0x39')]));if(_0x185c72[_0xf175('0x2e')][_0xf175('0x3a')]){_0x1d889f[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x1d889f[_0xf175('0x37')],{'$or':_['map'](_0x1d889f[_0xf175('0x32')],function(_0x3e37d3){var _0x20ba9a={};_0x20ba9a[_0x3e37d3]={'$like':'%'+_0x185c72['query'][_0xf175('0x3a')]+'%'};return _0x20ba9a;})});}_0x1d889f=_[_0xf175('0x3b')]({},_0x1d889f,_0x185c72[_0xf175('0x3d')]);return _0x555781['getFields'](_0x1d889f);}})['then'](function(_0x5cd856){if(_0x5cd856){_0x5d539b=_0x5cd856[_0xf175('0x33')];if(!_0x185c72[_0xf175('0x2e')][_0xf175('0x34')]('nolimit')){_0x1d889f['limit']=qs['limit'](_0x185c72[_0xf175('0x2e')][_0xf175('0x1a')]);_0x1d889f[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0x185c72['query'][_0xf175('0x1d')]);}return _0x555781[_0xf175('0x49')](_0x1d889f);}})[_0xf175('0x22')](function(_0xfabf6f){if(_0xfabf6f){return _0xfabf6f?{'count':_0x5d539b,'rows':_0xfabf6f}:null;}})[_0xf175('0x22')](respondWithResult(_0x26a161,null))[_0xf175('0x41')](handleError(_0x26a161,null));};exports['getSubjects']=function(_0x38a00e,_0x354b1d,_0x1c8a88){var _0x4bc39e={};var _0x53ed5b={};var _0x2d0f94;var _0x1fc2ef;return db['VtigerConfiguration'][_0xf175('0x4c')]({'where':{'id':_0x38a00e[_0xf175('0x43')]['id']}})['then'](handleEntityNotFound(_0x354b1d,null))['then'](function(_0x2adb12){if(_0x2adb12){_0x2d0f94=_0x2adb12;_0x53ed5b[_0xf175('0x30')]=_[_0xf175('0x44')](db[_0xf175('0x4a')][_0xf175('0x2a')]);_0x53ed5b[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x38a00e[_0xf175('0x2e')]);_0x53ed5b['filters']=_[_0xf175('0x2f')](_0x53ed5b[_0xf175('0x30')],_0x53ed5b[_0xf175('0x2e')]);_0x4bc39e[_0xf175('0x32')]=_[_0xf175('0x2f')](_0x53ed5b['model'],qs[_0xf175('0x31')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x31')]));_0x4bc39e[_0xf175('0x32')]=_0x4bc39e[_0xf175('0x32')][_0xf175('0x33')]?_0x4bc39e[_0xf175('0x32')]:_0x53ed5b[_0xf175('0x30')];_0x4bc39e[_0xf175('0x4b')]=qs[_0xf175('0x36')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x36')]);_0x4bc39e[_0xf175('0x37')]=qs[_0xf175('0x39')](_[_0xf175('0x38')](_0x38a00e[_0xf175('0x2e')],_0x53ed5b[_0xf175('0x39')]));if(_0x38a00e['query'][_0xf175('0x3a')]){_0x4bc39e[_0xf175('0x37')]=_[_0xf175('0x3b')](_0x4bc39e[_0xf175('0x37')],{'$or':_[_0xf175('0x2d')](_0x4bc39e['attributes'],function(_0x513c85){var _0x56795b={};_0x56795b[_0x513c85]={'$like':'%'+_0x38a00e[_0xf175('0x2e')][_0xf175('0x3a')]+'%'};return _0x56795b;})});}_0x4bc39e=_[_0xf175('0x3b')]({},_0x4bc39e,_0x38a00e[_0xf175('0x3d')]);return _0x2d0f94[_0xf175('0x4d')](_0x4bc39e);}})[_0xf175('0x22')](function(_0x371bdd){if(_0x371bdd){_0x1fc2ef=_0x371bdd[_0xf175('0x33')];if(!_0x38a00e[_0xf175('0x2e')]['hasOwnProperty'](_0xf175('0x35'))){_0x4bc39e['limit']=qs[_0xf175('0x1a')](_0x38a00e[_0xf175('0x2e')][_0xf175('0x1a')]);_0x4bc39e[_0xf175('0x1d')]=qs[_0xf175('0x1d')](_0x38a00e[_0xf175('0x2e')]['offset']);}return _0x2d0f94['getSubjects'](_0x4bc39e);}})[_0xf175('0x22')](function(_0x1a298c){if(_0x1a298c){return _0x1a298c?{'count':_0x1fc2ef,'rows':_0x1a298c}:null;}})[_0xf175('0x22')](respondWithResult(_0x354b1d,null))[_0xf175('0x41')](handleError(_0x354b1d,null));};exports[_0xf175('0x4e')]=function(_0x83e134,_0x5e8372,_0x2c0f87){var _0x2caaac={};var _0x322e65={};var _0x1ecd2b;var _0x3a1566;return db[_0xf175('0x29')][_0xf175('0x4c')]({'where':{'id':_0x83e134['params']['id']}})[_0xf175('0x22')](handleEntityNotFound(_0x5e8372,null))[_0xf175('0x22')](function(_0x29d65a){if(_0x29d65a){_0x1ecd2b=_0x29d65a;_0x322e65['model']=_['keys'](db[_0xf175('0x4a')][_0xf175('0x2a')]);_0x322e65[_0xf175('0x2e')]=_[_0xf175('0x44')](_0x83e134['query']);_0x322e65[_0xf175('0x39')]=_[_0xf175('0x2f')](_0x322e65[_0xf175('0x30')],_0x322e65[_0xf175('0x2e')]);_0x2caaac[_0xf175('0x32')]=_['intersection'](_0x322e65[_0xf175('0x30')],qs[_0xf175('0x31')](_0x83e134[_0xf175('0x2e')][_0xf175('0x31')]));_0x2caaac['attributes']=_0x2caaac[_0xf175('0x32')][_0xf175('0x33')]?_0x2caaac[_0xf175('0x32')]:_0x322e65[_0xf175('0x30')];_0x2caaac[_0xf175('0x4b')]=qs[_0xf175('0x36')](_0x83e134['query'][_0xf175('0x36')]);_0x2caaac[_0xf175('0x37')]=qs['filters'](_[_0xf175('0x38')](_0x83e134[_0xf175('0x2e')],_0x322e65[_0xf175('0x39')]));if(_0x83e134['query'][_0xf175('0x3a')]){_0x2caaac['where']=_[_0xf175('0x3b')](_0x2caaac[_0xf175('0x37')],{'$or':_[_0xf175('0x2d')](_0x2caaac[_0xf175('0x32')],function(_0x3e15b7){var _0x3393f8={};_0x3393f8[_0x3e15b7]={'$like':'%'+_0x83e134[_0xf175('0x2e')][_0xf175('0x3a')]+'%'};return _0x3393f8;})});}_0x2caaac=_['merge']({},_0x2caaac,_0x83e134[_0xf175('0x3d')]);return _0x1ecd2b[_0xf175('0x4e')](_0x2caaac);}})[_0xf175('0x22')](function(_0x2ee39b){if(_0x2ee39b){_0x3a1566=_0x2ee39b[_0xf175('0x33')];if(!_0x83e134[_0xf175('0x2e')][_0xf175('0x34')]('nolimit')){_0x2caaac[_0xf175('0x1a')]=qs[_0xf175('0x1a')](_0x83e134[_0xf175('0x2e')][_0xf175('0x1a')]);_0x2caaac[_0xf175('0x1d')]=qs['offset'](_0x83e134[_0xf175('0x2e')][_0xf175('0x1d')]);}return _0x1ecd2b[_0xf175('0x4e')](_0x2caaac);}})['then'](function(_0x1cd420){if(_0x1cd420){return _0x1cd420?{'count':_0x3a1566,'rows':_0x1cd420}:null;}})[_0xf175('0x22')](respondWithResult(_0x5e8372,null))[_0xf175('0x41')](handleError(_0x5e8372,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 78d6834..4757210 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 _0x57b8=['rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x3d3702,_0x4a2c98){var _0x542d17=function(_0x15c134){while(--_0x15c134){_0x3d3702['push'](_0x3d3702['shift']());}};_0x542d17(++_0x4a2c98);}(_0x57b8,0x1b6));var _0x857b=function(_0x41ce9a,_0x1cf4e3){_0x41ce9a=_0x41ce9a-0x0;var _0x113662=_0x57b8[_0x41ce9a];return _0x113662;};'use strict';var _=require(_0x857b('0x0'));var util=require(_0x857b('0x1'));var logger=require(_0x857b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x857b('0x3'));var rp=require(_0x857b('0x4'));var fs=require('fs');var path=require(_0x857b('0x5'));var rimraf=require(_0x857b('0x6'));var config=require(_0x857b('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x857b('0x8')]=function(_0x408502,_0x31d046){return _0x408502[_0x857b('0x9')](_0x857b('0xa'),attributes,{'tableName':_0x857b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13ce=['int_vtiger_configurations','util','api','moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x1d79f5,_0x3b2216){var _0x2bf37f=function(_0x2bbd7c){while(--_0x2bbd7c){_0x1d79f5['push'](_0x1d79f5['shift']());}};_0x2bf37f(++_0x3b2216);}(_0x13ce,0x1d7));var _0xe13c=function(_0x2500da,_0x135e4a){_0x2500da=_0x2500da-0x0;var _0x4221e2=_0x13ce[_0x2500da];return _0x4221e2;};'use strict';var _=require('lodash');var util=require(_0xe13c('0x0'));var logger=require('../../config/logger')(_0xe13c('0x1'));var moment=require(_0xe13c('0x2'));var BPromise=require('bluebird');var rp=require(_0xe13c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe13c('0x4'));var config=require(_0xe13c('0x5'));var attributes=require(_0xe13c('0x6'));module['exports']=function(_0x987fad,_0x48d7bb){return _0x987fad[_0xe13c('0x7')](_0xe13c('0x8'),attributes,{'tableName':_0xe13c('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 2d3422a..72262ff 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 _0x0e72=['rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c5679,_0x3a94ff){var _0x3596ca=function(_0x3b269f){while(--_0x3b269f){_0x3c5679['push'](_0x3c5679['shift']());}};_0x3596ca(++_0x3a94ff);}(_0x0e72,0x196));var _0x20e7=function(_0x16a65f,_0x55705d){_0x16a65f=_0x16a65f-0x0;var _0x58f581=_0x0e72[_0x16a65f];return _0x58f581;};'use strict';var _=require(_0x20e7('0x0'));var util=require(_0x20e7('0x1'));var moment=require(_0x20e7('0x2'));var BPromise=require(_0x20e7('0x3'));var rs=require(_0x20e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20e7('0x5'))['db'];var utils=require(_0x20e7('0x6'));var logger=require(_0x20e7('0x7'))(_0x20e7('0x8'));var config=require(_0x20e7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x20e7('0xa')][_0x20e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x104145,_0x49537c,_0x1fcb07){return new BPromise(function(_0xbab49,_0x507201){return client[_0x20e7('0xc')](_0x104145,_0x1fcb07)[_0x20e7('0xd')](function(_0x2489d6){logger[_0x20e7('0xe')](_0x20e7('0xf'),_0x49537c,_0x20e7('0x10'));logger[_0x20e7('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x49537c,_0x20e7('0x10'),JSON[_0x20e7('0x12')](_0x2489d6));if(_0x2489d6['error']){if(_0x2489d6[_0x20e7('0x13')][_0x20e7('0x14')]===0x1f4){logger[_0x20e7('0x13')](_0x20e7('0xf'),_0x49537c,_0x2489d6['error'][_0x20e7('0x15')]);return _0x507201(_0x2489d6['error']['message']);}logger[_0x20e7('0x13')](_0x20e7('0xf'),_0x49537c,_0x2489d6['error'][_0x20e7('0x15')]);return _0xbab49(_0x2489d6['error']['message']);}else{logger[_0x20e7('0xe')](_0x20e7('0xf'),_0x49537c,_0x20e7('0x10'));_0xbab49(_0x2489d6['result']['message']);}})[_0x20e7('0x16')](function(_0x1ebd62){logger[_0x20e7('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x49537c,_0x1ebd62);_0x507201(_0x1ebd62);});});} \ No newline at end of file +var _0x33d8=['debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3439db,_0x454f6){var _0x361d47=function(_0x1e76d9){while(--_0x1e76d9){_0x3439db['push'](_0x3439db['shift']());}};_0x361d47(++_0x454f6);}(_0x33d8,0xb9));var _0x833d=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x33d8[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x833d('0x0'));var util=require(_0x833d('0x1'));var moment=require(_0x833d('0x2'));var BPromise=require(_0x833d('0x3'));var rs=require(_0x833d('0x4'));var fs=require('fs');var Redis=require(_0x833d('0x5'));var db=require(_0x833d('0x6'))['db'];var utils=require(_0x833d('0x7'));var logger=require('../../config/logger')(_0x833d('0x8'));var config=require(_0x833d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x833d('0xa')][_0x833d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b7df1,_0x11b526,_0x27ea35){return new BPromise(function(_0x303598,_0x2ff084){return client['request'](_0x5b7df1,_0x27ea35)[_0x833d('0xc')](function(_0x4a007d){logger['info'](_0x833d('0xd'),_0x11b526,_0x833d('0xe'));logger[_0x833d('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x11b526,_0x833d('0xe'),JSON[_0x833d('0x10')](_0x4a007d));if(_0x4a007d['error']){if(_0x4a007d[_0x833d('0x11')]['code']===0x1f4){logger[_0x833d('0x11')](_0x833d('0xd'),_0x11b526,_0x4a007d[_0x833d('0x11')]['message']);return _0x2ff084(_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);}logger[_0x833d('0x11')](_0x833d('0xd'),_0x11b526,_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);return _0x303598(_0x4a007d[_0x833d('0x11')][_0x833d('0x12')]);}else{logger['info'](_0x833d('0xd'),_0x11b526,_0x833d('0xe'));_0x303598(_0x4a007d['result'][_0x833d('0x12')]);}})[_0x833d('0x13')](function(_0x57d4b7){logger['error'](_0x833d('0xd'),_0x11b526,_0x57d4b7);_0x2ff084(_0x57d4b7);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e0ae87c..4298b9f 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 _0x7264=['put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x3b8731,_0x4f74a2){var _0x55035d=function(_0x4d9906){while(--_0x4d9906){_0x3b8731['push'](_0x3b8731['shift']());}};_0x55035d(++_0x4f74a2);}(_0x7264,0x113));var _0x4726=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7264[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x4726('0x0'));var util=require(_0x4726('0x1'));var path=require(_0x4726('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4726('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4726('0x4'));var config=require('../../config/environment');var controller=require(_0x4726('0x5'));router[_0x4726('0x6')]('/',auth[_0x4726('0x7')](),controller[_0x4726('0x8')]);router[_0x4726('0x6')](_0x4726('0x9'),auth[_0x4726('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4726('0xa')](_0x4726('0x9'),auth[_0x4726('0x7')](),controller[_0x4726('0xb')]);router[_0x4726('0xc')](_0x4726('0x9'),auth[_0x4726('0x7')](),controller[_0x4726('0xd')]);module[_0x4726('0xe')]=router; \ No newline at end of file +var _0x9c45=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','path','Router'];(function(_0x20a510,_0x1c8846){var _0x12994a=function(_0x3a74d0){while(--_0x3a74d0){_0x20a510['push'](_0x20a510['shift']());}};_0x12994a(++_0x1c8846);}(_0x9c45,0x108));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x59c4('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59c4('0x1')]();var fs_extra=require(_0x59c4('0x2'));var auth=require(_0x59c4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x59c4('0x4'));var controller=require('./intVtigerField.controller');router[_0x59c4('0x5')]('/',auth[_0x59c4('0x6')](),controller[_0x59c4('0x7')]);router[_0x59c4('0x5')](_0x59c4('0x8'),auth['isAuthenticated'](),controller[_0x59c4('0x9')]);router['post']('/',auth[_0x59c4('0x6')](),controller['create']);router['put']('/:id',auth[_0x59c4('0x6')](),controller[_0x59c4('0xa')]);router[_0x59c4('0xb')](_0x59c4('0x8'),auth['isAuthenticated'](),controller[_0x59c4('0xc')]);module[_0x59c4('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index dd6771f..29e61b6 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 _0x845d=['variable','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0xa11d21,_0x52af5d){var _0x4b8669=function(_0x4ab74b){while(--_0x4ab74b){_0xa11d21['push'](_0xa11d21['shift']());}};_0x4b8669(++_0x52af5d);}(_0x845d,0x1e9));var _0xd845=function(_0x4bf49c,_0x186312){_0x4bf49c=_0x4bf49c-0x0;var _0x1ae972=_0x845d[_0x4bf49c];return _0x1ae972;};'use strict';var Sequelize=require(_0xd845('0x0'));module[_0xd845('0x1')]={'type':{'type':Sequelize[_0xd845('0x2')](_0xd845('0x3'),'variable',_0xd845('0x4'),_0xd845('0x5'),'picklist'),'defaultValue':_0xd845('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd845('0x2')](_0xd845('0x3'),_0xd845('0x6'),_0xd845('0x4'))},'keyContent':{'type':Sequelize[_0xd845('0x7')]},'idField':{'type':Sequelize[_0xd845('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd845('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd845('0x7')]}}; \ No newline at end of file +var _0x4527=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0xe9ec20,_0x4d6a00){var _0x46a5bd=function(_0x4c95f5){while(--_0x4c95f5){_0xe9ec20['push'](_0xe9ec20['shift']());}};_0x46a5bd(++_0x4d6a00);}(_0x4527,0x88));var _0x7452=function(_0x429fca,_0x54efd5){_0x429fca=_0x429fca-0x0;var _0x3e136e=_0x4527[_0x429fca];return _0x3e136e;};'use strict';var Sequelize=require(_0x7452('0x0'));module['exports']={'type':{'type':Sequelize[_0x7452('0x1')]('string',_0x7452('0x2'),_0x7452('0x3'),_0x7452('0x4'),_0x7452('0x5')),'defaultValue':_0x7452('0x6')},'content':{'type':Sequelize[_0x7452('0x7')]},'key':{'type':Sequelize[_0x7452('0x7')]},'keyType':{'type':Sequelize[_0x7452('0x1')](_0x7452('0x6'),_0x7452('0x2'),_0x7452('0x3'))},'keyContent':{'type':Sequelize[_0x7452('0x7')]},'idField':{'type':Sequelize[_0x7452('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7452('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7452('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ccec704..cda862d 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 _0x097e=['model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','VtigerField','rows','catch','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','type'];(function(_0x129f29,_0xfe0fb7){var _0x479419=function(_0x165a32){while(--_0x165a32){_0x129f29['push'](_0x129f29['shift']());}};_0x479419(++_0xfe0fb7);}(_0x097e,0x12f));var _0xe097=function(_0x31b4eb,_0x5dc8b0){_0x31b4eb=_0x31b4eb-0x0;var _0x47478d=_0x097e[_0x31b4eb];return _0x47478d;};'use strict';var emlformat=require(_0xe097('0x0'));var rimraf=require(_0xe097('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe097('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe097('0x3'));var Mustache=require(_0xe097('0x4'));var util=require(_0xe097('0x5'));var path=require('path');var sox=require(_0xe097('0x6'));var csv=require(_0xe097('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe097('0x8'));var _=require(_0xe097('0x9'));var squel=require(_0xe097('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe097('0xb'));var toCsv=require(_0xe097('0x7'));var querystring=require(_0xe097('0xc'));var Papa=require(_0xe097('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe097('0xe'));var as=require(_0xe097('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe097('0x10'))('api');var utils=require(_0xe097('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe097('0x12'));var db=require(_0xe097('0x13'))['db'];function respondWithStatusCode(_0x7ffe67,_0x511fcf){_0x511fcf=_0x511fcf||0xcc;return function(_0x405c24){if(_0x405c24){return _0x7ffe67[_0xe097('0x14')](_0x511fcf);}return _0x7ffe67['status'](_0x511fcf)[_0xe097('0x15')]();};}function respondWithResult(_0x32b97b,_0x591040){_0x591040=_0x591040||0xc8;return function(_0x11ae93){if(_0x11ae93){return _0x32b97b[_0xe097('0x16')](_0x591040)[_0xe097('0x17')](_0x11ae93);}};}function respondWithFilteredResult(_0x42fa11,_0x1c77f9){return function(_0x1e71dd){if(_0x1e71dd){var _0x3e9e71=typeof _0x1c77f9['offset']===_0xe097('0x18')&&typeof _0x1c77f9[_0xe097('0x19')]===_0xe097('0x18');var _0x2c6e26=_0x1e71dd['count'];var _0x2937a4=_0x3e9e71?0x0:_0x1c77f9['offset'];var _0x5c4970=_0x3e9e71?_0x1e71dd[_0xe097('0x1a')]:_0x1c77f9[_0xe097('0x1b')]+_0x1c77f9[_0xe097('0x19')];var _0x2ec0a2;if(_0x5c4970>=_0x2c6e26){_0x5c4970=_0x2c6e26;_0x2ec0a2=0xc8;}else{_0x2ec0a2=0xce;}_0x42fa11[_0xe097('0x16')](_0x2ec0a2);return _0x42fa11[_0xe097('0x1c')](_0xe097('0x1d'),_0x2937a4+'-'+_0x5c4970+'/'+_0x2c6e26)[_0xe097('0x17')](_0x1e71dd);}return null;};}function patchUpdates(_0x4fe046){return function(_0x1edcf6){try{jsonpatch[_0xe097('0x1e')](_0x1edcf6,_0x4fe046,!![]);}catch(_0x6a44e){return BPromise[_0xe097('0x1f')](_0x6a44e);}return _0x1edcf6[_0xe097('0x20')]();};}function saveUpdates(_0x43b419,_0x5028c9){return function(_0x3f5778){if(_0x3f5778){return _0x3f5778[_0xe097('0x21')](_0x43b419)[_0xe097('0x22')](function(_0x35f5fe){return _0x35f5fe;});}return null;};}function removeEntity(_0x1e70c8,_0x3e7918){return function(_0x5a7169){if(_0x5a7169){return _0x5a7169['destroy']()[_0xe097('0x22')](function(){_0x1e70c8[_0xe097('0x16')](0xcc)[_0xe097('0x15')]();});}};}function handleEntityNotFound(_0x35b8d0,_0x52b1eb){return function(_0x2c5101){if(!_0x2c5101){_0x35b8d0[_0xe097('0x14')](0x194);}return _0x2c5101;};}function handleError(_0x33f8d9,_0x1ec9dc){_0x1ec9dc=_0x1ec9dc||0x1f4;return function(_0x346e26){logger[_0xe097('0x23')](_0x346e26[_0xe097('0x24')]);if(_0x346e26[_0xe097('0x25')]){delete _0x346e26[_0xe097('0x25')];}_0x33f8d9[_0xe097('0x16')](_0x1ec9dc)[_0xe097('0x26')](_0x346e26);};}exports['index']=function(_0x55cadf,_0x3f9eb5){var _0x126ac5={},_0x2e3d4a={},_0x5ecea6={'count':0x0,'rows':[]};var _0x449db1=_['map'](db['VtigerField'][_0xe097('0x27')],function(_0x4ab996){return{'name':_0x4ab996[_0xe097('0x28')],'type':_0x4ab996[_0xe097('0x29')]['key']};});_0x2e3d4a[_0xe097('0x2a')]=_[_0xe097('0x2b')](_0x449db1,_0xe097('0x25'));_0x2e3d4a[_0xe097('0x2c')]=_[_0xe097('0x2d')](_0x55cadf[_0xe097('0x2c')]);_0x2e3d4a[_0xe097('0x2e')]=_[_0xe097('0x2f')](_0x2e3d4a['model'],_0x2e3d4a['query']);_0x126ac5['attributes']=_[_0xe097('0x2f')](_0x2e3d4a[_0xe097('0x2a')],qs['fields'](_0x55cadf[_0xe097('0x2c')][_0xe097('0x30')]));_0x126ac5[_0xe097('0x31')]=_0x126ac5[_0xe097('0x31')][_0xe097('0x32')]?_0x126ac5[_0xe097('0x31')]:_0x2e3d4a[_0xe097('0x2a')];if(!_0x55cadf['query'][_0xe097('0x33')]('nolimit')){_0x126ac5['limit']=qs[_0xe097('0x19')](_0x55cadf['query'][_0xe097('0x19')]);_0x126ac5[_0xe097('0x1b')]=qs['offset'](_0x55cadf['query']['offset']);}_0x126ac5[_0xe097('0x34')]=qs[_0xe097('0x35')](_0x55cadf['query'][_0xe097('0x35')]);_0x126ac5['where']=qs[_0xe097('0x2e')](_[_0xe097('0x36')](_0x55cadf['query'],_0x2e3d4a['filters']),_0x449db1);if(_0x55cadf[_0xe097('0x2c')]['filter']){_0x126ac5[_0xe097('0x37')]=_['merge'](_0x126ac5['where'],{'$or':_[_0xe097('0x2b')](_0x449db1,function(_0x4a3954){if(_0x4a3954[_0xe097('0x29')]!==_0xe097('0x38')){var _0x11e627={};_0x11e627[_0x4a3954['name']]={'$like':'%'+_0x55cadf[_0xe097('0x2c')][_0xe097('0x39')]+'%'};return _0x11e627;}})});}_0x126ac5=_[_0xe097('0x3a')]({},_0x126ac5,_0x55cadf['options']);var _0x74f9ba={'where':_0x126ac5['where']};return db['VtigerField'][_0xe097('0x1a')](_0x74f9ba)[_0xe097('0x22')](function(_0x4075f1){_0x5ecea6[_0xe097('0x1a')]=_0x4075f1;if(_0x55cadf['query'][_0xe097('0x3b')]){_0x126ac5[_0xe097('0x3c')]=[{'all':!![]}];}return db[_0xe097('0x3d')]['findAll'](_0x126ac5);})[_0xe097('0x22')](function(_0xcfe74f){_0x5ecea6[_0xe097('0x3e')]=_0xcfe74f;return _0x5ecea6;})[_0xe097('0x22')](respondWithFilteredResult(_0x3f9eb5,_0x126ac5))[_0xe097('0x3f')](handleError(_0x3f9eb5,null));};exports['show']=function(_0x5da93f,_0x553452){var _0x32dbcf={'raw':!![],'where':{'id':_0x5da93f[_0xe097('0x40')]['id']}},_0x2b4f7b={};_0x2b4f7b[_0xe097('0x2a')]=_[_0xe097('0x2d')](db['VtigerField'][_0xe097('0x27')]);_0x2b4f7b['query']=_[_0xe097('0x2d')](_0x5da93f['query']);_0x2b4f7b[_0xe097('0x2e')]=_[_0xe097('0x2f')](_0x2b4f7b['model'],_0x2b4f7b[_0xe097('0x2c')]);_0x32dbcf[_0xe097('0x31')]=_[_0xe097('0x2f')](_0x2b4f7b['model'],qs['fields'](_0x5da93f[_0xe097('0x2c')][_0xe097('0x30')]));_0x32dbcf['attributes']=_0x32dbcf['attributes'][_0xe097('0x32')]?_0x32dbcf['attributes']:_0x2b4f7b['model'];if(_0x5da93f[_0xe097('0x2c')][_0xe097('0x3b')]){_0x32dbcf[_0xe097('0x3c')]=[{'all':!![]}];}_0x32dbcf=_[_0xe097('0x3a')]({},_0x32dbcf,_0x5da93f[_0xe097('0x41')]);return db['VtigerField'][_0xe097('0x42')](_0x32dbcf)[_0xe097('0x22')](handleEntityNotFound(_0x553452,null))[_0xe097('0x22')](respondWithResult(_0x553452,null))[_0xe097('0x3f')](handleError(_0x553452,null));};exports['create']=function(_0x6f01bc,_0x2baa0f){return db['VtigerField'][_0xe097('0x43')](_0x6f01bc[_0xe097('0x44')],{})[_0xe097('0x22')](respondWithResult(_0x2baa0f,0xc9))[_0xe097('0x3f')](handleError(_0x2baa0f,null));};exports['update']=function(_0x45b0db,_0x1ea8cc){if(_0x45b0db[_0xe097('0x44')]['id']){delete _0x45b0db[_0xe097('0x44')]['id'];}return db[_0xe097('0x3d')][_0xe097('0x42')]({'where':{'id':_0x45b0db[_0xe097('0x40')]['id']}})[_0xe097('0x22')](handleEntityNotFound(_0x1ea8cc,null))[_0xe097('0x22')](saveUpdates(_0x45b0db[_0xe097('0x44')],null))[_0xe097('0x22')](respondWithResult(_0x1ea8cc,null))[_0xe097('0x3f')](handleError(_0x1ea8cc,null));};exports['destroy']=function(_0x50d1fb,_0x5672e7){return db['VtigerField']['find']({'where':{'id':_0x50d1fb[_0xe097('0x40')]['id']}})[_0xe097('0x22')](handleEntityNotFound(_0x5672e7,null))['then'](removeEntity(_0x5672e7,null))[_0xe097('0x3f')](handleError(_0x5672e7,null));}; \ No newline at end of file +var _0xd31d=['merge','type','options','includeAll','include','VtigerField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where'];(function(_0x3ec487,_0x17ae54){var _0x91d6a9=function(_0x3c2424){while(--_0x3c2424){_0x3ec487['push'](_0x3ec487['shift']());}};_0x91d6a9(++_0x17ae54);}(_0xd31d,0x92));var _0xdd31=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xd31d[_0x50aa2e];return _0x5e07f0;};'use strict';var emlformat=require(_0xdd31('0x0'));var rimraf=require(_0xdd31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd31('0x2'));var BPromise=require(_0xdd31('0x3'));var Mustache=require('mustache');var util=require(_0xdd31('0x4'));var path=require(_0xdd31('0x5'));var sox=require(_0xdd31('0x6'));var csv=require(_0xdd31('0x7'));var ejs=require(_0xdd31('0x8'));var fs=require('fs');var fs_extra=require(_0xdd31('0x9'));var _=require(_0xdd31('0xa'));var squel=require(_0xdd31('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd31('0xc'));var toCsv=require(_0xdd31('0x7'));var querystring=require(_0xdd31('0xd'));var Papa=require('papaparse');var Redis=require(_0xdd31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd31('0xf'));var as=require(_0xdd31('0x10'));var hardwareService=require(_0xdd31('0x11'));var logger=require('../../config/logger')(_0xdd31('0x12'));var utils=require('../../config/utils');var config=require(_0xdd31('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd31('0x14'))['db'];function respondWithStatusCode(_0x47527e,_0x2cad0f){_0x2cad0f=_0x2cad0f||0xcc;return function(_0xa3ebc9){if(_0xa3ebc9){return _0x47527e['sendStatus'](_0x2cad0f);}return _0x47527e[_0xdd31('0x15')](_0x2cad0f)[_0xdd31('0x16')]();};}function respondWithResult(_0x3f96ac,_0x922b8e){_0x922b8e=_0x922b8e||0xc8;return function(_0x217a1e){if(_0x217a1e){return _0x3f96ac['status'](_0x922b8e)[_0xdd31('0x17')](_0x217a1e);}};}function respondWithFilteredResult(_0x29030a,_0x190cf9){return function(_0x4e89b2){if(_0x4e89b2){var _0x39cdcc=typeof _0x190cf9[_0xdd31('0x18')]==='undefined'&&typeof _0x190cf9[_0xdd31('0x19')]==='undefined';var _0x3e6964=_0x4e89b2[_0xdd31('0x1a')];var _0x1e292e=_0x39cdcc?0x0:_0x190cf9['offset'];var _0x2cbd68=_0x39cdcc?_0x4e89b2[_0xdd31('0x1a')]:_0x190cf9['offset']+_0x190cf9[_0xdd31('0x19')];var _0x18e31d;if(_0x2cbd68>=_0x3e6964){_0x2cbd68=_0x3e6964;_0x18e31d=0xc8;}else{_0x18e31d=0xce;}_0x29030a['status'](_0x18e31d);return _0x29030a[_0xdd31('0x1b')]('Content-Range',_0x1e292e+'-'+_0x2cbd68+'/'+_0x3e6964)[_0xdd31('0x17')](_0x4e89b2);}return null;};}function patchUpdates(_0x5abd8f){return function(_0x2f191e){try{jsonpatch[_0xdd31('0x1c')](_0x2f191e,_0x5abd8f,!![]);}catch(_0x3638d2){return BPromise['reject'](_0x3638d2);}return _0x2f191e[_0xdd31('0x1d')]();};}function saveUpdates(_0x2b5786,_0x14effb){return function(_0x575f45){if(_0x575f45){return _0x575f45[_0xdd31('0x1e')](_0x2b5786)[_0xdd31('0x1f')](function(_0x5cc405){return _0x5cc405;});}return null;};}function removeEntity(_0x39c70a,_0x35b549){return function(_0x39f238){if(_0x39f238){return _0x39f238[_0xdd31('0x20')]()[_0xdd31('0x1f')](function(){_0x39c70a[_0xdd31('0x15')](0xcc)[_0xdd31('0x16')]();});}};}function handleEntityNotFound(_0x2e75b1,_0x5389a3){return function(_0x64f99f){if(!_0x64f99f){_0x2e75b1['sendStatus'](0x194);}return _0x64f99f;};}function handleError(_0x5dd1de,_0x2f4955){_0x2f4955=_0x2f4955||0x1f4;return function(_0x4ba571){logger['error'](_0x4ba571['stack']);if(_0x4ba571[_0xdd31('0x21')]){delete _0x4ba571[_0xdd31('0x21')];}_0x5dd1de[_0xdd31('0x15')](_0x2f4955)[_0xdd31('0x22')](_0x4ba571);};}exports[_0xdd31('0x23')]=function(_0x228e9f,_0x3e6a5b){var _0xa8a295={},_0x7b0c67={},_0x423906={'count':0x0,'rows':[]};var _0x32cc21=_['map'](db['VtigerField'][_0xdd31('0x24')],function(_0x274263){return{'name':_0x274263[_0xdd31('0x25')],'type':_0x274263['type'][_0xdd31('0x26')]};});_0x7b0c67['model']=_[_0xdd31('0x27')](_0x32cc21,_0xdd31('0x21'));_0x7b0c67[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x228e9f[_0xdd31('0x28')]);_0x7b0c67[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x7b0c67[_0xdd31('0x2c')],_0x7b0c67[_0xdd31('0x28')]);_0xa8a295['attributes']=_['intersection'](_0x7b0c67['model'],qs[_0xdd31('0x2d')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2d')]));_0xa8a295[_0xdd31('0x2e')]=_0xa8a295[_0xdd31('0x2e')]['length']?_0xa8a295[_0xdd31('0x2e')]:_0x7b0c67['model'];if(!_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2f')]('nolimit')){_0xa8a295['limit']=qs[_0xdd31('0x19')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x19')]);_0xa8a295[_0xdd31('0x18')]=qs[_0xdd31('0x18')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x18')]);}_0xa8a295['order']=qs[_0xdd31('0x30')](_0x228e9f[_0xdd31('0x28')]['sort']);_0xa8a295['where']=qs[_0xdd31('0x2a')](_[_0xdd31('0x31')](_0x228e9f[_0xdd31('0x28')],_0x7b0c67['filters']),_0x32cc21);if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]){_0xa8a295[_0xdd31('0x33')]=_[_0xdd31('0x34')](_0xa8a295[_0xdd31('0x33')],{'$or':_['map'](_0x32cc21,function(_0x2da21e){if(_0x2da21e[_0xdd31('0x35')]!=='VIRTUAL'){var _0x60d7d7={};_0x60d7d7[_0x2da21e[_0xdd31('0x21')]]={'$like':'%'+_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]+'%'};return _0x60d7d7;}})});}_0xa8a295=_[_0xdd31('0x34')]({},_0xa8a295,_0x228e9f[_0xdd31('0x36')]);var _0x34fec0={'where':_0xa8a295[_0xdd31('0x33')]};return db['VtigerField'][_0xdd31('0x1a')](_0x34fec0)[_0xdd31('0x1f')](function(_0x87d336){_0x423906[_0xdd31('0x1a')]=_0x87d336;if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x37')]){_0xa8a295[_0xdd31('0x38')]=[{'all':!![]}];}return db[_0xdd31('0x39')][_0xdd31('0x3a')](_0xa8a295);})[_0xdd31('0x1f')](function(_0x35eb77){_0x423906[_0xdd31('0x3b')]=_0x35eb77;return _0x423906;})[_0xdd31('0x1f')](respondWithFilteredResult(_0x3e6a5b,_0xa8a295))[_0xdd31('0x3c')](handleError(_0x3e6a5b,null));};exports[_0xdd31('0x3d')]=function(_0x22ed7f,_0x62119a){var _0x188b10={'raw':!![],'where':{'id':_0x22ed7f[_0xdd31('0x3e')]['id']}},_0x36e0d7={};_0x36e0d7['model']=_[_0xdd31('0x29')](db[_0xdd31('0x39')][_0xdd31('0x24')]);_0x36e0d7[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x22ed7f[_0xdd31('0x28')]);_0x36e0d7[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],_0x36e0d7[_0xdd31('0x28')]);_0x188b10[_0xdd31('0x2e')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],qs['fields'](_0x22ed7f[_0xdd31('0x28')]['fields']));_0x188b10[_0xdd31('0x2e')]=_0x188b10[_0xdd31('0x2e')]['length']?_0x188b10['attributes']:_0x36e0d7['model'];if(_0x22ed7f['query'][_0xdd31('0x37')]){_0x188b10[_0xdd31('0x38')]=[{'all':!![]}];}_0x188b10=_[_0xdd31('0x34')]({},_0x188b10,_0x22ed7f[_0xdd31('0x36')]);return db[_0xdd31('0x39')][_0xdd31('0x3f')](_0x188b10)[_0xdd31('0x1f')](handleEntityNotFound(_0x62119a,null))[_0xdd31('0x1f')](respondWithResult(_0x62119a,null))[_0xdd31('0x3c')](handleError(_0x62119a,null));};exports[_0xdd31('0x40')]=function(_0x1b9ce4,_0x11011a){return db[_0xdd31('0x39')]['create'](_0x1b9ce4[_0xdd31('0x41')],{})[_0xdd31('0x1f')](respondWithResult(_0x11011a,0xc9))[_0xdd31('0x3c')](handleError(_0x11011a,null));};exports[_0xdd31('0x1e')]=function(_0x319038,_0x4a16e2){if(_0x319038[_0xdd31('0x41')]['id']){delete _0x319038[_0xdd31('0x41')]['id'];}return db[_0xdd31('0x39')]['find']({'where':{'id':_0x319038[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x4a16e2,null))[_0xdd31('0x1f')](saveUpdates(_0x319038[_0xdd31('0x41')],null))[_0xdd31('0x1f')](respondWithResult(_0x4a16e2,null))['catch'](handleError(_0x4a16e2,null));};exports[_0xdd31('0x20')]=function(_0x104e4d,_0x562dd7){return db[_0xdd31('0x39')][_0xdd31('0x3f')]({'where':{'id':_0x104e4d[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x562dd7,null))['then'](removeEntity(_0x562dd7,null))[_0xdd31('0x3c')](handleError(_0x562dd7,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c910d78..3256f29 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 _0x0253=['VtigerField','int_vtiger_fields','vtiger_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x0253,0xf3));var _0x3025=function(_0x4bffbb,_0x146485){_0x4bffbb=_0x4bffbb-0x0;var _0xdace2c=_0x0253[_0x4bffbb];return _0xdace2c;};'use strict';var _=require('lodash');var util=require(_0x3025('0x0'));var logger=require(_0x3025('0x1'))(_0x3025('0x2'));var moment=require(_0x3025('0x3'));var BPromise=require(_0x3025('0x4'));var rp=require(_0x3025('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3025('0x6'));var attributes=require('./intVtigerField.attributes');module[_0x3025('0x7')]=function(_0x267543,_0x2065ea){return _0x267543[_0x3025('0x8')](_0x3025('0x9'),attributes,{'tableName':_0x3025('0xa'),'paranoid':![],'indexes':[{'name':_0x3025('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f68=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','api','moment'];(function(_0x505d6c,_0x5681cc){var _0x115f2e=function(_0x2dda68){while(--_0x2dda68){_0x505d6c['push'](_0x505d6c['shift']());}};_0x115f2e(++_0x5681cc);}(_0x3f68,0x7c));var _0x83f6=function(_0x196c1f,_0x181785){_0x196c1f=_0x196c1f-0x0;var _0x14ff24=_0x3f68[_0x196c1f];return _0x14ff24;};'use strict';var _=require(_0x83f6('0x0'));var util=require(_0x83f6('0x1'));var logger=require('../../config/logger')(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var BPromise=require(_0x83f6('0x4'));var rp=require(_0x83f6('0x5'));var fs=require('fs');var path=require(_0x83f6('0x6'));var rimraf=require(_0x83f6('0x7'));var config=require(_0x83f6('0x8'));var attributes=require(_0x83f6('0x9'));module[_0x83f6('0xa')]=function(_0x3e1dbd,_0x4777d4){return _0x3e1dbd[_0x83f6('0xb')](_0x83f6('0xc'),attributes,{'tableName':_0x83f6('0xd'),'paranoid':![],'indexes':[{'name':_0x83f6('0xe'),'fields':[_0x83f6('0xf'),'FieldId'],'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 2bead31..0ceee07 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 _0xee9e=['error','code','message','request\x20sent','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','stringify'];(function(_0x438085,_0x974579){var _0xc74410=function(_0x5b92fd){while(--_0x5b92fd){_0x438085['push'](_0x438085['shift']());}};_0xc74410(++_0x974579);}(_0xee9e,0x1ba));var _0xeee9=function(_0xaaf09c,_0x186e47){_0xaaf09c=_0xaaf09c-0x0;var _0x15f6f1=_0xee9e[_0xaaf09c];return _0x15f6f1;};'use strict';var _=require('lodash');var util=require(_0xeee9('0x0'));var moment=require('moment');var BPromise=require(_0xeee9('0x1'));var rs=require(_0xeee9('0x2'));var fs=require('fs');var Redis=require(_0xeee9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeee9('0x4'));var logger=require('../../config/logger')(_0xeee9('0x5'));var config=require('../../config/environment');var jayson=require(_0xeee9('0x6'));var client=jayson[_0xeee9('0x7')][_0xeee9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe41,_0x2102c8,_0x2692cc){return new BPromise(function(_0x3ac241,_0x4a3a0f){return client[_0xeee9('0x9')](_0x3ebe41,_0x2692cc)[_0xeee9('0xa')](function(_0x53ce4e){logger[_0xeee9('0xb')](_0xeee9('0xc'),_0x2102c8,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x2102c8,'request\x20sent',JSON[_0xeee9('0xd')](_0x53ce4e));if(_0x53ce4e[_0xeee9('0xe')]){if(_0x53ce4e[_0xeee9('0xe')][_0xeee9('0xf')]===0x1f4){logger[_0xeee9('0xe')]('VtigerField,\x20%s,\x20%s',_0x2102c8,_0x53ce4e['error'][_0xeee9('0x10')]);return _0x4a3a0f(_0x53ce4e['error'][_0xeee9('0x10')]);}logger[_0xeee9('0xe')]('VtigerField,\x20%s,\x20%s',_0x2102c8,_0x53ce4e[_0xeee9('0xe')][_0xeee9('0x10')]);return _0x3ac241(_0x53ce4e[_0xeee9('0xe')][_0xeee9('0x10')]);}else{logger[_0xeee9('0xb')](_0xeee9('0xc'),_0x2102c8,_0xeee9('0x11'));_0x3ac241(_0x53ce4e['result']['message']);}})[_0xeee9('0x12')](function(_0x47673e){logger[_0xeee9('0xe')](_0xeee9('0xc'),_0x2102c8,_0x47673e);_0x4a3a0f(_0x47673e);});});} \ No newline at end of file +var _0xf6ec=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x55e677,_0x4a1157){var _0x5d0798=function(_0x65a609){while(--_0x65a609){_0x55e677['push'](_0x55e677['shift']());}};_0x5d0798(++_0x4a1157);}(_0xf6ec,0x198));var _0xcf6e=function(_0x24aefa,_0x473eef){_0x24aefa=_0x24aefa-0x0;var _0x51ccaa=_0xf6ec[_0x24aefa];return _0x51ccaa;};'use strict';var _=require('lodash');var util=require(_0xcf6e('0x0'));var moment=require(_0xcf6e('0x1'));var BPromise=require(_0xcf6e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf6e('0x3'));var db=require(_0xcf6e('0x4'))['db'];var utils=require(_0xcf6e('0x5'));var logger=require(_0xcf6e('0x6'))(_0xcf6e('0x7'));var config=require(_0xcf6e('0x8'));var jayson=require(_0xcf6e('0x9'));var client=jayson[_0xcf6e('0xa')][_0xcf6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d212,_0x48b426,_0x3c8df1){return new BPromise(function(_0x36a925,_0x191531){return client['request'](_0x15d212,_0x3c8df1)[_0xcf6e('0xc')](function(_0x24b15a){logger['info'](_0xcf6e('0xd'),_0x48b426,_0xcf6e('0xe'));logger[_0xcf6e('0xf')](_0xcf6e('0x10'),_0x48b426,'request\x20sent',JSON[_0xcf6e('0x11')](_0x24b15a));if(_0x24b15a[_0xcf6e('0x12')]){if(_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x13')]===0x1f4){logger['error'](_0xcf6e('0xd'),_0x48b426,_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x14')]);return _0x191531(_0x24b15a[_0xcf6e('0x12')]['message']);}logger[_0xcf6e('0x12')](_0xcf6e('0xd'),_0x48b426,_0x24b15a[_0xcf6e('0x12')][_0xcf6e('0x14')]);return _0x36a925(_0x24b15a['error'][_0xcf6e('0x14')]);}else{logger[_0xcf6e('0x15')](_0xcf6e('0xd'),_0x48b426,_0xcf6e('0xe'));_0x36a925(_0x24b15a[_0xcf6e('0x16')]['message']);}})[_0xcf6e('0x17')](function(_0x475837){logger[_0xcf6e('0x12')](_0xcf6e('0xd'),_0x48b426,_0x475837);_0x191531(_0x475837);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0e6a735..c38348c 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 _0x7436=['getConfigurations','/:id/fields','getFields','post','update','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations'];(function(_0x39d855,_0x4d1fb2){var _0x5f5d03=function(_0x1ebb09){while(--_0x1ebb09){_0x39d855['push'](_0x39d855['shift']());}};_0x5f5d03(++_0x4d1fb2);}(_0x7436,0x1ab));var _0x6743=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x7436[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0x6743('0x0'));var util=require(_0x6743('0x1'));var path=require('path');var timeout=require(_0x6743('0x2'));var express=require(_0x6743('0x3'));var router=express[_0x6743('0x4')]();var fs_extra=require(_0x6743('0x5'));var auth=require(_0x6743('0x6'));var interaction=require(_0x6743('0x7'));var config=require('../../config/environment');var controller=require(_0x6743('0x8'));router[_0x6743('0x9')]('/',auth['isAuthenticated'](),controller[_0x6743('0xa')]);router[_0x6743('0x9')]('/:id',auth[_0x6743('0xb')](),controller[_0x6743('0xc')]);router[_0x6743('0x9')](_0x6743('0xd'),auth[_0x6743('0xb')](),controller[_0x6743('0xe')]);router[_0x6743('0x9')](_0x6743('0xf'),auth[_0x6743('0xb')](),controller[_0x6743('0x10')]);router[_0x6743('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6743('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0x6743('0xb')](),controller[_0x6743('0x12')]);router['delete'](_0x6743('0x13'),auth[_0x6743('0xb')](),controller[_0x6743('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2013=['express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer','path'];(function(_0x44e201,_0x2477f9){var _0xb720a9=function(_0x52c73f){while(--_0x52c73f){_0x44e201['push'](_0x44e201['shift']());}};_0xb720a9(++_0x2477f9);}(_0x2013,0xae));var _0x3201=function(_0x4b8018,_0x2bff47){_0x4b8018=_0x4b8018-0x0;var _0x18bde6=_0x2013[_0x4b8018];return _0x18bde6;};'use strict';var multer=require(_0x3201('0x0'));var util=require('util');var path=require(_0x3201('0x1'));var timeout=require('connect-timeout');var express=require(_0x3201('0x2'));var router=express['Router']();var fs_extra=require(_0x3201('0x3'));var auth=require(_0x3201('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3201('0x5'));var controller=require(_0x3201('0x6'));router['get']('/',auth[_0x3201('0x7')](),controller[_0x3201('0x8')]);router[_0x3201('0x9')](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0xb')]);router[_0x3201('0x9')](_0x3201('0xc'),auth[_0x3201('0x7')](),controller[_0x3201('0xd')]);router[_0x3201('0x9')](_0x3201('0xe'),auth['isAuthenticated'](),controller[_0x3201('0xf')]);router[_0x3201('0x10')]('/',auth[_0x3201('0x7')](),controller[_0x3201('0x11')]);router['post'](_0x3201('0xc'),auth[_0x3201('0x7')](),controller[_0x3201('0x12')]);router['put'](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0x13')]);router['delete'](_0x3201('0xa'),auth[_0x3201('0x7')](),controller[_0x3201('0x14')]);module[_0x3201('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 25a871a..4cfe0d2 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 _0xacd6=['remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xacd6,0xef));var _0x6acd=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0xacd6[_0x189d3c];return _0x485959;};'use strict';var Sequelize=require(_0x6acd('0x0'));module[_0x6acd('0x1')]={'name':{'type':Sequelize[_0x6acd('0x2')]},'description':{'type':Sequelize[_0x6acd('0x2')]},'username':{'type':Sequelize[_0x6acd('0x2')],'unique':_0x6acd('0x3')},'password':{'type':Sequelize[_0x6acd('0x2')]},'token':{'type':Sequelize[_0x6acd('0x2')]},'remoteUri':{'type':Sequelize[_0x6acd('0x2')],'unique':_0x6acd('0x4')},'authType':{'type':Sequelize[_0x6acd('0x5')](_0x6acd('0x6'),'token'),'defaultValue':_0x6acd('0x6')},'serverUrl':{'type':Sequelize[_0x6acd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6acd('0x5')](_0x6acd('0x7'),_0x6acd('0x8')),'defaultValue':_0x6acd('0x7')}}; \ No newline at end of file +var _0x4325=['token','password','newTab','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3e8710,_0x30b866){var _0x13ec9c=function(_0x5420d0){while(--_0x5420d0){_0x3e8710['push'](_0x3e8710['shift']());}};_0x13ec9c(++_0x30b866);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x4')},'authType':{'type':Sequelize[_0x5432('0x5')]('password',_0x5432('0x6')),'defaultValue':_0x5432('0x7')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5432('0x5')]('integrationTab',_0x5432('0x8')),'defaultValue':_0x5432('0x9')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 85fd5a5..cbe235f 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 _0xae60=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','sort','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x242dd7,_0x3d81d9){var _0x30ae03=function(_0x545519){while(--_0x545519){_0x242dd7['push'](_0x242dd7['shift']());}};_0x30ae03(++_0x3d81d9);}(_0xae60,0x1c7));var _0x0ae6=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xae60[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0ae6('0x0'));var rimraf=require(_0x0ae6('0x1'));var zipdir=require(_0x0ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ae6('0x3'));var moment=require(_0x0ae6('0x4'));var BPromise=require(_0x0ae6('0x5'));var Mustache=require('mustache');var util=require(_0x0ae6('0x6'));var path=require(_0x0ae6('0x7'));var sox=require('sox');var csv=require(_0x0ae6('0x8'));var ejs=require(_0x0ae6('0x9'));var fs=require('fs');var fs_extra=require(_0x0ae6('0xa'));var _=require(_0x0ae6('0xb'));var squel=require(_0x0ae6('0xc'));var crypto=require(_0x0ae6('0xd'));var jsforce=require(_0x0ae6('0xe'));var deskjs=require(_0x0ae6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0ae6('0x10'));var Papa=require(_0x0ae6('0x11'));var Redis=require(_0x0ae6('0x12'));var authService=require(_0x0ae6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0ae6('0x14'));var hardwareService=require(_0x0ae6('0x15'));var logger=require(_0x0ae6('0x16'))(_0x0ae6('0x17'));var utils=require(_0x0ae6('0x18'));var config=require(_0x0ae6('0x19'));var licenseUtil=require(_0x0ae6('0x1a'));var db=require(_0x0ae6('0x1b'))['db'];var integrations=require(_0x0ae6('0x1c'));function respondWithStatusCode(_0x30f8f9,_0x1aefd5){_0x1aefd5=_0x1aefd5||0xcc;return function(_0xf86cad){if(_0xf86cad){return _0x30f8f9[_0x0ae6('0x1d')](_0x1aefd5);}return _0x30f8f9[_0x0ae6('0x1e')](_0x1aefd5)['end']();};}function respondWithResult(_0x3809c6,_0x10c3bc){_0x10c3bc=_0x10c3bc||0xc8;return function(_0x1c997a){if(_0x1c997a){return _0x3809c6[_0x0ae6('0x1e')](_0x10c3bc)[_0x0ae6('0x1f')](_0x1c997a);}};}function respondWithFilteredResult(_0x3a1e26,_0x151144){return function(_0x3b64ac){if(_0x3b64ac){var _0xa797bb=typeof _0x151144[_0x0ae6('0x20')]===_0x0ae6('0x21')&&typeof _0x151144[_0x0ae6('0x22')]===_0x0ae6('0x21');var _0xd0362c=_0x3b64ac[_0x0ae6('0x23')];var _0x3f5c41=_0xa797bb?0x0:_0x151144[_0x0ae6('0x20')];var _0x1735ba=_0xa797bb?_0x3b64ac[_0x0ae6('0x23')]:_0x151144[_0x0ae6('0x20')]+_0x151144[_0x0ae6('0x22')];var _0x191eaf;if(_0x1735ba>=_0xd0362c){_0x1735ba=_0xd0362c;_0x191eaf=0xc8;}else{_0x191eaf=0xce;}_0x3a1e26['status'](_0x191eaf);return _0x3a1e26[_0x0ae6('0x24')](_0x0ae6('0x25'),_0x3f5c41+'-'+_0x1735ba+'/'+_0xd0362c)[_0x0ae6('0x1f')](_0x3b64ac);}return null;};}function patchUpdates(_0x1027c2){return function(_0x9c4075){try{jsonpatch[_0x0ae6('0x26')](_0x9c4075,_0x1027c2,!![]);}catch(_0x210ca4){return BPromise[_0x0ae6('0x27')](_0x210ca4);}return _0x9c4075['save']();};}function saveUpdates(_0x39b22e,_0x2a6484){return function(_0x2e86e8){if(_0x2e86e8){return _0x2e86e8[_0x0ae6('0x28')](_0x39b22e)[_0x0ae6('0x29')](function(_0x4eba72){return _0x4eba72;});}return null;};}function removeEntity(_0x296a9d,_0x4e1242){return function(_0xccd1c5){if(_0xccd1c5){return _0xccd1c5[_0x0ae6('0x2a')]()[_0x0ae6('0x29')](function(){_0x296a9d[_0x0ae6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3630e6,_0x2dcdb7){return function(_0x519f17){if(!_0x519f17){_0x3630e6['sendStatus'](0x194);}return _0x519f17;};}function handleError(_0x44eb95,_0x3255a7){_0x3255a7=_0x3255a7||0x1f4;return function(_0x17360e){logger['error'](_0x17360e[_0x0ae6('0x2b')]);if(_0x17360e[_0x0ae6('0x2c')]){delete _0x17360e[_0x0ae6('0x2c')];}_0x44eb95['status'](_0x3255a7)[_0x0ae6('0x2d')](_0x17360e);};}exports[_0x0ae6('0x2e')]=function(_0x449c33,_0x232fbd){var _0x14eed5={},_0x257af5={},_0x4fc7bd={'count':0x0,'rows':[]};var _0x5b2ad6=_[_0x0ae6('0x2f')](db[_0x0ae6('0x30')]['rawAttributes'],function(_0x4a06f1){return{'name':_0x4a06f1[_0x0ae6('0x31')],'type':_0x4a06f1[_0x0ae6('0x32')][_0x0ae6('0x33')]};});_0x257af5[_0x0ae6('0x34')]=_['map'](_0x5b2ad6,_0x0ae6('0x2c'));_0x257af5[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x449c33['query']);_0x257af5[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],_0x257af5[_0x0ae6('0x35')]);_0x14eed5[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x257af5[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x14eed5['attributes']=_0x14eed5[_0x0ae6('0x39')][_0x0ae6('0x3b')]?_0x14eed5['attributes']:_0x257af5[_0x0ae6('0x34')];if(!_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3c')]('nolimit')){_0x14eed5[_0x0ae6('0x22')]=qs['limit'](_0x449c33['query'][_0x0ae6('0x22')]);_0x14eed5[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x20')]);}_0x14eed5['order']=qs['sort'](_0x449c33[_0x0ae6('0x35')]['sort']);_0x14eed5[_0x0ae6('0x3d')]=qs['filters'](_[_0x0ae6('0x3e')](_0x449c33['query'],_0x257af5[_0x0ae6('0x37')]),_0x5b2ad6);if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x14eed5[_0x0ae6('0x3d')]=_['merge'](_0x14eed5['where'],{'$or':_[_0x0ae6('0x2f')](_0x5b2ad6,function(_0x34b547){if(_0x34b547[_0x0ae6('0x32')]!=='VIRTUAL'){var _0xaeb354={};_0xaeb354[_0x34b547['name']]={'$like':'%'+_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x3f')]+'%'};return _0xaeb354;}})});}_0x14eed5=_[_0x0ae6('0x40')]({},_0x14eed5,_0x449c33[_0x0ae6('0x41')]);var _0x450f00={'where':_0x14eed5[_0x0ae6('0x3d')]};return db['ZendeskAccount'][_0x0ae6('0x23')](_0x450f00)[_0x0ae6('0x29')](function(_0x24d9ec){_0x4fc7bd[_0x0ae6('0x23')]=_0x24d9ec;if(_0x449c33[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0x14eed5[_0x0ae6('0x43')]=[{'all':!![]}];}return db[_0x0ae6('0x30')]['findAll'](_0x14eed5);})[_0x0ae6('0x29')](function(_0xba3183){_0x4fc7bd[_0x0ae6('0x44')]=_0xba3183;return _0x4fc7bd;})[_0x0ae6('0x29')](respondWithFilteredResult(_0x232fbd,_0x14eed5))[_0x0ae6('0x45')](handleError(_0x232fbd,null));};exports[_0x0ae6('0x46')]=function(_0x24c021,_0x21431e){var _0xb38cbb={'raw':![],'where':{'id':_0x24c021[_0x0ae6('0x47')]['id']}},_0x156841={};_0x156841[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x30')][_0x0ae6('0x48')]);_0x156841[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x24c021[_0x0ae6('0x35')]);_0x156841['filters']=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],_0x156841[_0x0ae6('0x35')]);_0xb38cbb[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x156841[_0x0ae6('0x34')],qs['fields'](_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0xb38cbb[_0x0ae6('0x39')]=_0xb38cbb[_0x0ae6('0x39')]['length']?_0xb38cbb['attributes']:_0x156841['model'];if(_0x24c021[_0x0ae6('0x35')][_0x0ae6('0x42')]){_0xb38cbb[_0x0ae6('0x43')]=[{'all':!![]}];}_0xb38cbb=_['merge']({},_0xb38cbb,_0x24c021[_0x0ae6('0x41')]);return db[_0x0ae6('0x30')]['find'](_0xb38cbb)[_0x0ae6('0x29')](handleEntityNotFound(_0x21431e,null))[_0x0ae6('0x29')](respondWithResult(_0x21431e,null))['catch'](handleError(_0x21431e,null));};exports[_0x0ae6('0x49')]=function(_0x3d1e75,_0x587ab4){return db[_0x0ae6('0x30')][_0x0ae6('0x49')](_0x3d1e75[_0x0ae6('0x4a')],{})['then'](respondWithResult(_0x587ab4,0xc9))[_0x0ae6('0x45')](handleError(_0x587ab4,null));};exports[_0x0ae6('0x28')]=function(_0x46075a,_0x3b1af0){if(_0x46075a[_0x0ae6('0x4a')]['id']){delete _0x46075a[_0x0ae6('0x4a')]['id'];}return db[_0x0ae6('0x30')]['find']({'where':{'id':_0x46075a['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x3b1af0,null))[_0x0ae6('0x29')](saveUpdates(_0x46075a[_0x0ae6('0x4a')],null))['then'](respondWithResult(_0x3b1af0,null))[_0x0ae6('0x45')](handleError(_0x3b1af0,null));};exports['destroy']=function(_0x582a5e,_0x23454a){return db[_0x0ae6('0x30')][_0x0ae6('0x4b')]({'where':{'id':_0x582a5e['params']['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x23454a,null))[_0x0ae6('0x29')](removeEntity(_0x23454a,null))[_0x0ae6('0x45')](handleError(_0x23454a,null));};exports[_0x0ae6('0x4c')]=function(_0x173acd,_0x2e5ea6,_0x9a64b8){var _0x36be39={};var _0x102573={};var _0x117d24;var _0x1cc515;return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x173acd[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x2e5ea6,null))['then'](function(_0x4cbe19){if(_0x4cbe19){_0x117d24=_0x4cbe19;_0x102573[_0x0ae6('0x34')]=_[_0x0ae6('0x36')](db[_0x0ae6('0x4e')][_0x0ae6('0x48')]);_0x102573[_0x0ae6('0x35')]=_[_0x0ae6('0x36')](_0x173acd[_0x0ae6('0x35')]);_0x102573[_0x0ae6('0x37')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],_0x102573[_0x0ae6('0x35')]);_0x36be39[_0x0ae6('0x39')]=_[_0x0ae6('0x38')](_0x102573[_0x0ae6('0x34')],qs[_0x0ae6('0x3a')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3a')]));_0x36be39[_0x0ae6('0x39')]=_0x36be39['attributes'][_0x0ae6('0x3b')]?_0x36be39[_0x0ae6('0x39')]:_0x102573[_0x0ae6('0x34')];_0x36be39[_0x0ae6('0x4f')]=qs[_0x0ae6('0x50')](_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x50')]);_0x36be39[_0x0ae6('0x3d')]=qs[_0x0ae6('0x37')](_[_0x0ae6('0x3e')](_0x173acd['query'],_0x102573[_0x0ae6('0x37')]));if(_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3f')]){_0x36be39[_0x0ae6('0x3d')]=_[_0x0ae6('0x40')](_0x36be39[_0x0ae6('0x3d')],{'$or':_[_0x0ae6('0x2f')](_0x36be39[_0x0ae6('0x39')],function(_0x1cbada){var _0x59acf0={};_0x59acf0[_0x1cbada]={'$like':'%'+_0x173acd['query'][_0x0ae6('0x3f')]+'%'};return _0x59acf0;})});}_0x36be39=_[_0x0ae6('0x40')]({},_0x36be39,_0x173acd['options']);return _0x117d24['getConfigurations'](_0x36be39);}})[_0x0ae6('0x29')](function(_0x160dcf){if(_0x160dcf){_0x1cc515=_0x160dcf[_0x0ae6('0x3b')];if(!_0x173acd[_0x0ae6('0x35')][_0x0ae6('0x3c')](_0x0ae6('0x51'))){_0x36be39[_0x0ae6('0x22')]=qs['limit'](_0x173acd[_0x0ae6('0x35')]['limit']);_0x36be39[_0x0ae6('0x20')]=qs[_0x0ae6('0x20')](_0x173acd['query'][_0x0ae6('0x20')]);}return _0x117d24[_0x0ae6('0x4c')](_0x36be39);}})[_0x0ae6('0x29')](function(_0x593667){if(_0x593667){return _0x593667?{'count':_0x1cc515,'rows':_0x593667}:null;}})[_0x0ae6('0x29')](respondWithResult(_0x2e5ea6,null))['catch'](handleError(_0x2e5ea6,null));};exports[_0x0ae6('0x52')]=function(_0x2e0a75,_0x19f63f,_0x12c43d){if(_0x2e0a75['body']['id']){delete _0x2e0a75['body']['id'];}return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x2e0a75[_0x0ae6('0x47')]['id']}})[_0x0ae6('0x29')](handleEntityNotFound(_0x19f63f,null))[_0x0ae6('0x29')](function(_0x2d9f33){if(_0x2d9f33){_0x2e0a75['body']['AccountId']=_0x2d9f33['id'];_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x53')]=integrations[_0x0ae6('0x54')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);_0x2e0a75[_0x0ae6('0x4a')]['Descriptions']=integrations[_0x0ae6('0x56')](_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x55')],_0x2e0a75[_0x0ae6('0x4a')][_0x0ae6('0x32')]);return db[_0x0ae6('0x4e')]['create'](_0x2e0a75['body'],{'include':[{'model':db[_0x0ae6('0x57')],'as':_0x0ae6('0x53')},{'model':db['ZendeskField'],'as':_0x0ae6('0x58')}]});}return null;})[_0x0ae6('0x29')](respondWithResult(_0x19f63f,null))[_0x0ae6('0x45')](handleError(_0x19f63f,null));};exports[_0x0ae6('0x59')]=function(_0x5cd03b,_0x2d9ec4,_0x243e86){var _0x42470='';return db[_0x0ae6('0x30')][_0x0ae6('0x4d')]({'where':{'id':_0x5cd03b[_0x0ae6('0x47')]['id']},'attributes':['id',_0x0ae6('0x5a'),_0x0ae6('0x5b'),'token',_0x0ae6('0x5c'),_0x0ae6('0x5d')]})[_0x0ae6('0x29')](handleEntityNotFound(_0x2d9ec4,null))[_0x0ae6('0x29')](function(_0x206021){if(_0x206021){_0x42470=_0x206021[_0x0ae6('0x5d')];var _0x20032f=_0x42470[_0x0ae6('0x5e')](-0x1);if(_0x20032f==='/'){_0x42470=_0x42470[_0x0ae6('0x5f')](0x0,_0x42470[_0x0ae6('0x60')](_0x20032f));}var _0x3db11f={'method':_0x0ae6('0x61'),'uri':util[_0x0ae6('0x62')](_0x0ae6('0x63'),_0x42470,_0x0ae6('0x64')),'json':!![]};switch(_0x206021[_0x0ae6('0x5c')]){case _0x0ae6('0x5b'):_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')]('%s:%s',_0x206021[_0x0ae6('0x5a')],_0x206021[_0x0ae6('0x5b')]))[_0x0ae6('0x67')](_0x0ae6('0x68')))};break;case'token':_0x3db11f[_0x0ae6('0x65')]={'Authorization':util[_0x0ae6('0x62')](_0x0ae6('0x66'),new Buffer(util[_0x0ae6('0x62')](_0x0ae6('0x69'),_0x206021[_0x0ae6('0x5a')],_0x206021['token']))[_0x0ae6('0x67')]('base64'))};break;default:throw new db[(_0x0ae6('0x6a'))][(_0x0ae6('0x6b'))](_0x0ae6('0x6c'));}return rp(_0x3db11f);}})[_0x0ae6('0x29')](function(_0x1f0b9e){if(_0x1f0b9e){var _0x15003f=[_0x0ae6('0x6d'),'description','group',_0x0ae6('0x6e')];_[_0x0ae6('0x6f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x104625){return _0x15003f['includes'](_0x104625[_0x0ae6('0x32')]);});return{'count':_0x1f0b9e[_0x0ae6('0x64')]['length'],'rows':_[_0x0ae6('0x2f')](_0x1f0b9e[_0x0ae6('0x64')],function(_0x1af034){return{'id':_0x1af034['id'],'name':_0x1af034[_0x0ae6('0x70')]>0x7?_0x1af034[_0x0ae6('0x71')]:_0x1af034[_0x0ae6('0x32')],'custom':_0x1af034['position']>0x7?!![]:![],'options':_0x1af034['system_field_options']?_0x1af034['system_field_options']:_0x1af034[_0x0ae6('0x72')]?_0x1af034['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x2d9ec4,null))['catch'](function(_0x58517f){var _0xc69e9d=_0x5cd03b['query'][_0x0ae6('0x73')]?0x1f4:_0x58517f['statusCode']||0x1f4;logger[_0x0ae6('0x74')](_0x0ae6('0x75'),_0x0ae6('0x59'),_0xc69e9d,JSON[_0x0ae6('0x76')](_0x58517f));delete _0x58517f[_0x0ae6('0x2c')];if(_0xc69e9d===0x191){_0xc69e9d=0x190;}_0x2d9ec4['status'](_0xc69e9d)[_0x0ae6('0x2d')](_0x5cd03b[_0x0ae6('0x35')][_0x0ae6('0x73')]?{'message':_0x0ae6('0x77'),'statusCode':_0x58517f[_0x0ae6('0x78')]}:_0x58517f);});}; \ No newline at end of file +var _0x69d3=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','findAll','rows','show','keys','find','catch','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','remoteUri','slice','lastIndexOf','format','ticket_fields','authType','password','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','Unknown\x20authentication\x20type','subject','description','assignee','remove','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x3f9b9e,_0x209ec4){var _0x4d4270=function(_0x396fbd){while(--_0x396fbd){_0x3f9b9e['push'](_0x3f9b9e['shift']());}};_0x4d4270(++_0x209ec4);}(_0x69d3,0xda));var _0x369d=function(_0x506211,_0x5d9f77){_0x506211=_0x506211-0x0;var _0x3da272=_0x69d3[_0x506211];return _0x3da272;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];var integrations=require(_0x369d('0x17'));function respondWithStatusCode(_0x52c126,_0x15b417){_0x15b417=_0x15b417||0xcc;return function(_0x9d016){if(_0x9d016){return _0x52c126[_0x369d('0x18')](_0x15b417);}return _0x52c126[_0x369d('0x19')](_0x15b417)[_0x369d('0x1a')]();};}function respondWithResult(_0x539536,_0x5cd4c3){_0x5cd4c3=_0x5cd4c3||0xc8;return function(_0x5485a1){if(_0x5485a1){return _0x539536[_0x369d('0x19')](_0x5cd4c3)[_0x369d('0x1b')](_0x5485a1);}};}function respondWithFilteredResult(_0x389c43,_0x5b4f55){return function(_0x2c1a4a){if(_0x2c1a4a){var _0x29c1fe=typeof _0x5b4f55[_0x369d('0x1c')]==='undefined'&&typeof _0x5b4f55[_0x369d('0x1d')]===_0x369d('0x1e');var _0x4ea6c2=_0x2c1a4a['count'];var _0x597b67=_0x29c1fe?0x0:_0x5b4f55[_0x369d('0x1c')];var _0x4494b3=_0x29c1fe?_0x2c1a4a[_0x369d('0x1f')]:_0x5b4f55['offset']+_0x5b4f55[_0x369d('0x1d')];var _0x24dfff;if(_0x4494b3>=_0x4ea6c2){_0x4494b3=_0x4ea6c2;_0x24dfff=0xc8;}else{_0x24dfff=0xce;}_0x389c43[_0x369d('0x19')](_0x24dfff);return _0x389c43[_0x369d('0x20')](_0x369d('0x21'),_0x597b67+'-'+_0x4494b3+'/'+_0x4ea6c2)['json'](_0x2c1a4a);}return null;};}function patchUpdates(_0x5c9fdd){return function(_0x448e6e){try{jsonpatch[_0x369d('0x22')](_0x448e6e,_0x5c9fdd,!![]);}catch(_0x11ac1d){return BPromise[_0x369d('0x23')](_0x11ac1d);}return _0x448e6e[_0x369d('0x24')]();};}function saveUpdates(_0x15fbef,_0x1b262a){return function(_0x54a42e){if(_0x54a42e){return _0x54a42e['update'](_0x15fbef)[_0x369d('0x25')](function(_0xed16e){return _0xed16e;});}return null;};}function removeEntity(_0xf7bc3a,_0xcae58){return function(_0x30e7c5){if(_0x30e7c5){return _0x30e7c5[_0x369d('0x26')]()[_0x369d('0x25')](function(){_0xf7bc3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16145e,_0x46de2b){return function(_0x15cd81){if(!_0x15cd81){_0x16145e[_0x369d('0x18')](0x194);}return _0x15cd81;};}function handleError(_0x8aa521,_0x41e0cf){_0x41e0cf=_0x41e0cf||0x1f4;return function(_0x8090b0){logger['error'](_0x8090b0[_0x369d('0x27')]);if(_0x8090b0[_0x369d('0x28')]){delete _0x8090b0[_0x369d('0x28')];}_0x8aa521[_0x369d('0x19')](_0x41e0cf)[_0x369d('0x29')](_0x8090b0);};}exports[_0x369d('0x2a')]=function(_0x3d1ce0,_0x4d42ea){var _0x157291={},_0x56efb1={},_0x57b94c={'count':0x0,'rows':[]};var _0x38feda=_[_0x369d('0x2b')](db['ZendeskAccount'][_0x369d('0x2c')],function(_0x5a14ce){return{'name':_0x5a14ce[_0x369d('0x2d')],'type':_0x5a14ce[_0x369d('0x2e')][_0x369d('0x2f')]};});_0x56efb1[_0x369d('0x30')]=_[_0x369d('0x2b')](_0x38feda,_0x369d('0x28'));_0x56efb1[_0x369d('0x31')]=_['keys'](_0x3d1ce0[_0x369d('0x31')]);_0x56efb1[_0x369d('0x32')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],_0x56efb1[_0x369d('0x31')]);_0x157291[_0x369d('0x34')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],qs['fields'](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x35')]));_0x157291[_0x369d('0x34')]=_0x157291[_0x369d('0x34')][_0x369d('0x36')]?_0x157291['attributes']:_0x56efb1[_0x369d('0x30')];if(!_0x3d1ce0[_0x369d('0x31')][_0x369d('0x37')](_0x369d('0x38'))){_0x157291[_0x369d('0x1d')]=qs[_0x369d('0x1d')](_0x3d1ce0['query'][_0x369d('0x1d')]);_0x157291[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x1c')]);}_0x157291[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3a')]);_0x157291[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x3d1ce0[_0x369d('0x31')],_0x56efb1[_0x369d('0x32')]),_0x38feda);if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3d')]){_0x157291[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x157291[_0x369d('0x3b')],{'$or':_[_0x369d('0x2b')](_0x38feda,function(_0x10c5b6){if(_0x10c5b6[_0x369d('0x2e')]!==_0x369d('0x3f')){var _0xd58366={};_0xd58366[_0x10c5b6['name']]={'$like':'%'+_0x3d1ce0['query'][_0x369d('0x3d')]+'%'};return _0xd58366;}})});}_0x157291=_[_0x369d('0x3e')]({},_0x157291,_0x3d1ce0[_0x369d('0x40')]);var _0x401bc7={'where':_0x157291[_0x369d('0x3b')]};return db[_0x369d('0x41')][_0x369d('0x1f')](_0x401bc7)[_0x369d('0x25')](function(_0x46c940){_0x57b94c['count']=_0x46c940;if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x42')]){_0x157291[_0x369d('0x43')]=[{'all':!![]}];}return db[_0x369d('0x41')][_0x369d('0x44')](_0x157291);})[_0x369d('0x25')](function(_0x28803c){_0x57b94c[_0x369d('0x45')]=_0x28803c;return _0x57b94c;})['then'](respondWithFilteredResult(_0x4d42ea,_0x157291))['catch'](handleError(_0x4d42ea,null));};exports[_0x369d('0x46')]=function(_0x3222ce,_0x30909a){var _0x4dad71={'raw':![],'where':{'id':_0x3222ce['params']['id']}},_0x4d07ac={};_0x4d07ac[_0x369d('0x30')]=_[_0x369d('0x47')](db['ZendeskAccount'][_0x369d('0x2c')]);_0x4d07ac[_0x369d('0x31')]=_[_0x369d('0x47')](_0x3222ce[_0x369d('0x31')]);_0x4d07ac['filters']=_[_0x369d('0x33')](_0x4d07ac['model'],_0x4d07ac[_0x369d('0x31')]);_0x4dad71['attributes']=_[_0x369d('0x33')](_0x4d07ac[_0x369d('0x30')],qs[_0x369d('0x35')](_0x3222ce['query']['fields']));_0x4dad71[_0x369d('0x34')]=_0x4dad71[_0x369d('0x34')][_0x369d('0x36')]?_0x4dad71['attributes']:_0x4d07ac[_0x369d('0x30')];if(_0x3222ce[_0x369d('0x31')][_0x369d('0x42')]){_0x4dad71[_0x369d('0x43')]=[{'all':!![]}];}_0x4dad71=_[_0x369d('0x3e')]({},_0x4dad71,_0x3222ce[_0x369d('0x40')]);return db[_0x369d('0x41')][_0x369d('0x48')](_0x4dad71)[_0x369d('0x25')](handleEntityNotFound(_0x30909a,null))['then'](respondWithResult(_0x30909a,null))[_0x369d('0x49')](handleError(_0x30909a,null));};exports[_0x369d('0x4a')]=function(_0xcc1465,_0x257c3d){return db[_0x369d('0x41')][_0x369d('0x4a')](_0xcc1465['body'],{})[_0x369d('0x25')](respondWithResult(_0x257c3d,0xc9))[_0x369d('0x49')](handleError(_0x257c3d,null));};exports[_0x369d('0x4b')]=function(_0x44a357,_0x1b04d9){if(_0x44a357[_0x369d('0x4c')]['id']){delete _0x44a357[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x48')]({'where':{'id':_0x44a357[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1b04d9,null))[_0x369d('0x25')](saveUpdates(_0x44a357['body'],null))[_0x369d('0x25')](respondWithResult(_0x1b04d9,null))[_0x369d('0x49')](handleError(_0x1b04d9,null));};exports[_0x369d('0x26')]=function(_0x85edd6,_0x648a0d){return db['ZendeskAccount'][_0x369d('0x48')]({'where':{'id':_0x85edd6['params']['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x648a0d,null))[_0x369d('0x25')](removeEntity(_0x648a0d,null))[_0x369d('0x49')](handleError(_0x648a0d,null));};exports[_0x369d('0x4e')]=function(_0x46c62c,_0x1bd31c,_0x22e2d4){var _0x418cab={};var _0x1cdeca={};var _0x9f1544;var _0x4d582a;return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x46c62c[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1bd31c,null))[_0x369d('0x25')](function(_0x347df4){if(_0x347df4){_0x9f1544=_0x347df4;_0x1cdeca['model']=_['keys'](db[_0x369d('0x50')][_0x369d('0x2c')]);_0x1cdeca['query']=_[_0x369d('0x47')](_0x46c62c['query']);_0x1cdeca[_0x369d('0x32')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],_0x1cdeca['query']);_0x418cab[_0x369d('0x34')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],qs[_0x369d('0x35')](_0x46c62c['query']['fields']));_0x418cab[_0x369d('0x34')]=_0x418cab[_0x369d('0x34')][_0x369d('0x36')]?_0x418cab['attributes']:_0x1cdeca[_0x369d('0x30')];_0x418cab[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x46c62c['query']['sort']);_0x418cab[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x46c62c[_0x369d('0x31')],_0x1cdeca['filters']));if(_0x46c62c[_0x369d('0x31')][_0x369d('0x3d')]){_0x418cab[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x418cab[_0x369d('0x3b')],{'$or':_['map'](_0x418cab[_0x369d('0x34')],function(_0x304a9e){var _0x28b752={};_0x28b752[_0x304a9e]={'$like':'%'+_0x46c62c['query'][_0x369d('0x3d')]+'%'};return _0x28b752;})});}_0x418cab=_['merge']({},_0x418cab,_0x46c62c[_0x369d('0x40')]);return _0x9f1544['getConfigurations'](_0x418cab);}})['then'](function(_0x5f440e){if(_0x5f440e){_0x4d582a=_0x5f440e['length'];if(!_0x46c62c[_0x369d('0x31')]['hasOwnProperty'](_0x369d('0x38'))){_0x418cab['limit']=qs[_0x369d('0x1d')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1d')]);_0x418cab['offset']=qs[_0x369d('0x1c')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1c')]);}return _0x9f1544[_0x369d('0x4e')](_0x418cab);}})[_0x369d('0x25')](function(_0xe63e0f){if(_0xe63e0f){return _0xe63e0f?{'count':_0x4d582a,'rows':_0xe63e0f}:null;}})['then'](respondWithResult(_0x1bd31c,null))[_0x369d('0x49')](handleError(_0x1bd31c,null));};exports['addConfiguration']=function(_0x5706be,_0x56c98e,_0x36e990){if(_0x5706be[_0x369d('0x4c')]['id']){delete _0x5706be[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x4f')]({'where':{'id':_0x5706be[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x56c98e,null))[_0x369d('0x25')](function(_0x1c9683){if(_0x1c9683){_0x5706be[_0x369d('0x4c')][_0x369d('0x51')]=_0x1c9683['id'];_0x5706be[_0x369d('0x4c')][_0x369d('0x52')]=integrations[_0x369d('0x53')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be['body'][_0x369d('0x2e')]);_0x5706be['body'][_0x369d('0x55')]=integrations[_0x369d('0x56')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be[_0x369d('0x4c')]['type']);return db[_0x369d('0x50')]['create'](_0x5706be['body'],{'include':[{'model':db[_0x369d('0x57')],'as':_0x369d('0x52')},{'model':db[_0x369d('0x57')],'as':_0x369d('0x55')}]});}return null;})[_0x369d('0x25')](respondWithResult(_0x56c98e,null))[_0x369d('0x49')](handleError(_0x56c98e,null));};exports[_0x369d('0x58')]=function(_0x11ac7d,_0x55a811,_0x461782){var _0x24e70d='';return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x11ac7d[_0x369d('0x4d')]['id']},'attributes':['id',_0x369d('0x59'),'password',_0x369d('0x5a'),'authType',_0x369d('0x5b')]})[_0x369d('0x25')](handleEntityNotFound(_0x55a811,null))[_0x369d('0x25')](function(_0x369199){if(_0x369199){_0x24e70d=_0x369199[_0x369d('0x5b')];var _0x1a9a01=_0x24e70d[_0x369d('0x5c')](-0x1);if(_0x1a9a01==='/'){_0x24e70d=_0x24e70d['substring'](0x0,_0x24e70d[_0x369d('0x5d')](_0x1a9a01));}var _0x7e8d08={'method':'GET','uri':util[_0x369d('0x5e')]('%s/%s',_0x24e70d,_0x369d('0x5f')),'json':!![]};switch(_0x369199[_0x369d('0x60')]){case _0x369d('0x61'):_0x7e8d08['headers']={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x63'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x61')]))['toString'](_0x369d('0x64')))};break;case _0x369d('0x5a'):_0x7e8d08[_0x369d('0x65')]={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x66'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x5a')]))[_0x369d('0x67')](_0x369d('0x64')))};break;default:throw new db['Sequelize']['ValidationError'](_0x369d('0x68'));}return rp(_0x7e8d08);}})[_0x369d('0x25')](function(_0x2307fc){if(_0x2307fc){var _0x11b348=[_0x369d('0x69'),_0x369d('0x6a'),'group',_0x369d('0x6b')];_[_0x369d('0x6c')](_0x2307fc['ticket_fields'],function(_0x6c8235){return _0x11b348['includes'](_0x6c8235[_0x369d('0x2e')]);});return{'count':_0x2307fc['ticket_fields'][_0x369d('0x36')],'rows':_[_0x369d('0x2b')](_0x2307fc['ticket_fields'],function(_0x4148a9){return{'id':_0x4148a9['id'],'name':_0x4148a9['position']>0x7?_0x4148a9[_0x369d('0x6d')]:_0x4148a9['type'],'custom':_0x4148a9['position']>0x7?!![]:![],'options':_0x4148a9[_0x369d('0x6e')]?_0x4148a9[_0x369d('0x6e')]:_0x4148a9[_0x369d('0x6f')]?_0x4148a9[_0x369d('0x6f')]:[]};})};}})[_0x369d('0x25')](respondWithResult(_0x55a811,null))['catch'](function(_0x28ec32){var _0xaff7cc=_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?0x1f4:_0x28ec32[_0x369d('0x71')]||0x1f4;logger[_0x369d('0x72')](_0x369d('0x73'),_0x369d('0x58'),_0xaff7cc,JSON[_0x369d('0x74')](_0x28ec32));delete _0x28ec32['name'];if(_0xaff7cc===0x191){_0xaff7cc=0x190;}_0x55a811[_0x369d('0x19')](_0xaff7cc)[_0x369d('0x29')](_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x28ec32[_0x369d('0x71')]}:_0x28ec32);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 85a2626..f39c3af 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 _0x7a48=['bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment'];(function(_0x1b7ea6,_0x195a62){var _0x4fcea6=function(_0x29ace1){while(--_0x29ace1){_0x1b7ea6['push'](_0x1b7ea6['shift']());}};_0x4fcea6(++_0x195a62);}(_0x7a48,0x127));var _0x87a4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7a48[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x87a4('0x0'));var util=require(_0x87a4('0x1'));var logger=require('../../config/logger')(_0x87a4('0x2'));var moment=require(_0x87a4('0x3'));var BPromise=require(_0x87a4('0x4'));var rp=require(_0x87a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x87a4('0x6'));var config=require(_0x87a4('0x7'));var attributes=require(_0x87a4('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x87a4('0x9')]=function(_0x33878a,_0xabbb3c){return _0x33878a[_0x87a4('0xa')](_0x87a4('0xb'),attributes,{'tableName':_0x87a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d8=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x38d8,0xa2));var _0x838d=function(_0x3b29d5,_0x12faa2){_0x3b29d5=_0x3b29d5-0x0;var _0x20b96d=_0x38d8[_0x3b29d5];return _0x20b96d;};'use strict';var _=require(_0x838d('0x0'));var util=require(_0x838d('0x1'));var logger=require(_0x838d('0x2'))(_0x838d('0x3'));var moment=require('moment');var BPromise=require(_0x838d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x838d('0x5'));var rimraf=require('rimraf');var config=require(_0x838d('0x6'));var attributes=require(_0x838d('0x7'));var integrations=require(_0x838d('0x8'));module[_0x838d('0x9')]=function(_0x237db4,_0x43ff3c){return _0x237db4[_0x838d('0xa')](_0x838d('0xb'),attributes,{'tableName':_0x838d('0xc'),'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 b4038fd..6d75417 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 _0xfa3a=['code','message','info','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5a7da7,_0x4f132a){var _0x14459e=function(_0x4daa47){while(--_0x4daa47){_0x5a7da7['push'](_0x5a7da7['shift']());}};_0x14459e(++_0x4f132a);}(_0xfa3a,0xa6));var _0xafa3=function(_0x11bdad,_0x1e1e51){_0x11bdad=_0x11bdad-0x0;var _0x577fdd=_0xfa3a[_0x11bdad];return _0x577fdd;};'use strict';var _=require(_0xafa3('0x0'));var util=require(_0xafa3('0x1'));var moment=require(_0xafa3('0x2'));var BPromise=require(_0xafa3('0x3'));var rs=require(_0xafa3('0x4'));var fs=require('fs');var Redis=require(_0xafa3('0x5'));var db=require(_0xafa3('0x6'))['db'];var utils=require(_0xafa3('0x7'));var logger=require('../../config/logger')(_0xafa3('0x8'));var config=require(_0xafa3('0x9'));var jayson=require(_0xafa3('0xa'));var client=jayson[_0xafa3('0xb')][_0xafa3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cc2fd,_0xc17786,_0x5297a6){return new BPromise(function(_0x22f539,_0x4413c7){return client[_0xafa3('0xd')](_0x1cc2fd,_0x5297a6)['then'](function(_0xdc97b4){logger['info'](_0xafa3('0xe'),_0xc17786,_0xafa3('0xf'));logger['debug'](_0xafa3('0x10'),_0xc17786,_0xafa3('0xf'),JSON[_0xafa3('0x11')](_0xdc97b4));if(_0xdc97b4[_0xafa3('0x12')]){if(_0xdc97b4[_0xafa3('0x12')][_0xafa3('0x13')]===0x1f4){logger[_0xafa3('0x12')](_0xafa3('0xe'),_0xc17786,_0xdc97b4[_0xafa3('0x12')]['message']);return _0x4413c7(_0xdc97b4[_0xafa3('0x12')]['message']);}logger[_0xafa3('0x12')](_0xafa3('0xe'),_0xc17786,_0xdc97b4[_0xafa3('0x12')][_0xafa3('0x14')]);return _0x22f539(_0xdc97b4[_0xafa3('0x12')]['message']);}else{logger[_0xafa3('0x15')](_0xafa3('0xe'),_0xc17786,_0xafa3('0xf'));_0x22f539(_0xdc97b4['result'][_0xafa3('0x14')]);}})[_0xafa3('0x16')](function(_0x591073){logger[_0xafa3('0x12')](_0xafa3('0xe'),_0xc17786,_0x591073);_0x4413c7(_0x591073);});});}exports[_0xafa3('0x17')]=function(_0x193fe8){var _0x4c84fc=this;return new Promise(function(_0x5b2cef,_0x4fcefc){return db[_0xafa3('0x18')][_0xafa3('0x19')]({'raw':_0x193fe8['options']?_0x193fe8[_0xafa3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x193fe8[_0xafa3('0x1a')]?_0x193fe8[_0xafa3('0x1a')][_0xafa3('0x1b')]||null:null,'attributes':_0x193fe8[_0xafa3('0x1a')]?_0x193fe8[_0xafa3('0x1a')][_0xafa3('0x1c')]||null:null,'limit':_0x193fe8['options']?_0x193fe8[_0xafa3('0x1a')][_0xafa3('0x1d')]||null:null,'include':_0x193fe8['options']?_0x193fe8['options'][_0xafa3('0x1e')]?_[_0xafa3('0x1f')](_0x193fe8['options'][_0xafa3('0x1e')],function(_0x47f2e2){return{'model':db[_0x47f2e2[_0xafa3('0x20')]],'as':_0x47f2e2['as'],'attributes':_0x47f2e2['attributes'],'include':_0x47f2e2[_0xafa3('0x1e')]?_['map'](_0x47f2e2[_0xafa3('0x1e')],function(_0x4c799c){return{'model':db[_0x4c799c[_0xafa3('0x20')]],'as':_0x4c799c['as'],'attributes':_0x4c799c[_0xafa3('0x1c')],'include':_0x4c799c['include']?_[_0xafa3('0x1f')](_0x4c799c[_0xafa3('0x1e')],function(_0x2b9f9e){return{'model':db[_0x2b9f9e[_0xafa3('0x20')]],'as':_0x2b9f9e['as'],'attributes':_0x2b9f9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xafa3('0x21')](function(_0x53adce){logger[_0xafa3('0x15')](_0xafa3('0x17'),_0x193fe8);logger[_0xafa3('0x22')](_0xafa3('0x17'),_0x193fe8,JSON['stringify'](_0x53adce));_0x5b2cef(_0x53adce);})['catch'](function(_0x17a92c){logger[_0xafa3('0x12')](_0xafa3('0x17'),_0x17a92c[_0xafa3('0x14')],_0x193fe8);_0x4fcefc(_0x4c84fc[_0xafa3('0x12')](0x1f4,_0x17a92c['message']));});});};exports[_0xafa3('0x23')]=function(_0x4e757e){var _0x1a42aa=this;return new Promise(function(_0x21097c,_0x32b059){return db[_0xafa3('0x18')][_0xafa3('0x24')]({'raw':_0x4e757e[_0xafa3('0x1a')]?_0x4e757e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4e757e[_0xafa3('0x1a')]?_0x4e757e[_0xafa3('0x1a')][_0xafa3('0x1b')]||null:null,'attributes':_0x4e757e['options']?_0x4e757e[_0xafa3('0x1a')][_0xafa3('0x1c')]||null:null,'include':_0x4e757e[_0xafa3('0x1a')]?_0x4e757e[_0xafa3('0x1a')]['include']?_[_0xafa3('0x1f')](_0x4e757e[_0xafa3('0x1a')][_0xafa3('0x1e')],function(_0x1c6d41){return{'model':db[_0x1c6d41[_0xafa3('0x20')]],'as':_0x1c6d41['as'],'attributes':_0x1c6d41['attributes'],'include':_0x1c6d41[_0xafa3('0x1e')]?_[_0xafa3('0x1f')](_0x1c6d41[_0xafa3('0x1e')],function(_0x4dc03){return{'model':db[_0x4dc03[_0xafa3('0x20')]],'as':_0x4dc03['as'],'attributes':_0x4dc03['attributes'],'include':_0x4dc03[_0xafa3('0x1e')]?_[_0xafa3('0x1f')](_0x4dc03[_0xafa3('0x1e')],function(_0x50c6bb){return{'model':db[_0x50c6bb[_0xafa3('0x20')]],'as':_0x50c6bb['as'],'attributes':_0x50c6bb[_0xafa3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xafa3('0x21')](function(_0x3d1a66){logger[_0xafa3('0x15')](_0xafa3('0x23'),_0x4e757e);logger[_0xafa3('0x22')]('ShowZendeskAccount',_0x4e757e,JSON[_0xafa3('0x11')](_0x3d1a66));_0x21097c(_0x3d1a66);})[_0xafa3('0x16')](function(_0x2d226b){logger[_0xafa3('0x12')](_0xafa3('0x23'),_0x2d226b['message'],_0x4e757e);_0x32b059(_0x1a42aa[_0xafa3('0x12')](0x1f4,_0x2d226b[_0xafa3('0x14')]));});});}; \ No newline at end of file +var _0xb962=['http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','findAll','options','where','attributes','limit','include','model','map','catch','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f2dfc,_0x2cda88){var _0x125bdf=function(_0x47dcc7){while(--_0x47dcc7){_0x2f2dfc['push'](_0x2f2dfc['shift']());}};_0x125bdf(++_0x2cda88);}(_0xb962,0x88));var _0x2b96=function(_0x372e33,_0x385d5f){_0x372e33=_0x372e33-0x0;var _0x55e3aa=_0xb962[_0x372e33];return _0x55e3aa;};'use strict';var _=require(_0x2b96('0x0'));var util=require(_0x2b96('0x1'));var moment=require(_0x2b96('0x2'));var BPromise=require(_0x2b96('0x3'));var rs=require(_0x2b96('0x4'));var fs=require('fs');var Redis=require(_0x2b96('0x5'));var db=require(_0x2b96('0x6'))['db'];var utils=require(_0x2b96('0x7'));var logger=require(_0x2b96('0x8'))(_0x2b96('0x9'));var config=require(_0x2b96('0xa'));var jayson=require(_0x2b96('0xb'));var client=jayson['client'][_0x2b96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x557574,_0x4abd05,_0x213b19){return new BPromise(function(_0x579cb6,_0xb9828a){return client[_0x2b96('0xd')](_0x557574,_0x213b19)[_0x2b96('0xe')](function(_0x428ade){logger[_0x2b96('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x4abd05,'request\x20sent');logger[_0x2b96('0x10')](_0x2b96('0x11'),_0x4abd05,_0x2b96('0x12'),JSON[_0x2b96('0x13')](_0x428ade));if(_0x428ade[_0x2b96('0x14')]){if(_0x428ade['error'][_0x2b96('0x15')]===0x1f4){logger[_0x2b96('0x14')](_0x2b96('0x16'),_0x4abd05,_0x428ade[_0x2b96('0x14')]['message']);return _0xb9828a(_0x428ade[_0x2b96('0x14')]['message']);}logger[_0x2b96('0x14')](_0x2b96('0x16'),_0x4abd05,_0x428ade['error'][_0x2b96('0x17')]);return _0x579cb6(_0x428ade['error']['message']);}else{logger[_0x2b96('0xf')](_0x2b96('0x16'),_0x4abd05,'request\x20sent');_0x579cb6(_0x428ade[_0x2b96('0x18')][_0x2b96('0x17')]);}})['catch'](function(_0x375025){logger[_0x2b96('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x4abd05,_0x375025);_0xb9828a(_0x375025);});});}exports[_0x2b96('0x19')]=function(_0x476c5c){var _0x1ee528=this;return new Promise(function(_0x1f553d,_0x3e6cd5){return db['ZendeskAccount'][_0x2b96('0x1a')]({'raw':_0x476c5c[_0x2b96('0x1b')]?_0x476c5c[_0x2b96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x476c5c['options']?_0x476c5c['options'][_0x2b96('0x1c')]||null:null,'attributes':_0x476c5c['options']?_0x476c5c['options'][_0x2b96('0x1d')]||null:null,'limit':_0x476c5c['options']?_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1e')]||null:null,'include':_0x476c5c[_0x2b96('0x1b')]?_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1f')]?_['map'](_0x476c5c[_0x2b96('0x1b')][_0x2b96('0x1f')],function(_0x528f56){return{'model':db[_0x528f56[_0x2b96('0x20')]],'as':_0x528f56['as'],'attributes':_0x528f56[_0x2b96('0x1d')],'include':_0x528f56[_0x2b96('0x1f')]?_['map'](_0x528f56['include'],function(_0x3f14f5){return{'model':db[_0x3f14f5['model']],'as':_0x3f14f5['as'],'attributes':_0x3f14f5['attributes'],'include':_0x3f14f5[_0x2b96('0x1f')]?_[_0x2b96('0x21')](_0x3f14f5[_0x2b96('0x1f')],function(_0xd3b8d5){return{'model':db[_0xd3b8d5[_0x2b96('0x20')]],'as':_0xd3b8d5['as'],'attributes':_0xd3b8d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b96('0xe')](function(_0x520bcd){logger[_0x2b96('0xf')](_0x2b96('0x19'),_0x476c5c);logger['debug']('GetZendeskAccount',_0x476c5c,JSON['stringify'](_0x520bcd));_0x1f553d(_0x520bcd);})[_0x2b96('0x22')](function(_0x38cf31){logger[_0x2b96('0x14')](_0x2b96('0x19'),_0x38cf31[_0x2b96('0x17')],_0x476c5c);_0x3e6cd5(_0x1ee528['error'](0x1f4,_0x38cf31[_0x2b96('0x17')]));});});};exports[_0x2b96('0x23')]=function(_0x58405e){var _0x2b24a3=this;return new Promise(function(_0x556872,_0x20724c){return db['ZendeskAccount'][_0x2b96('0x24')]({'raw':_0x58405e['options']?_0x58405e[_0x2b96('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x58405e[_0x2b96('0x1b')]?_0x58405e[_0x2b96('0x1b')][_0x2b96('0x1c')]||null:null,'attributes':_0x58405e['options']?_0x58405e[_0x2b96('0x1b')][_0x2b96('0x1d')]||null:null,'include':_0x58405e['options']?_0x58405e['options']['include']?_[_0x2b96('0x21')](_0x58405e[_0x2b96('0x1b')]['include'],function(_0x43c39e){return{'model':db[_0x43c39e['model']],'as':_0x43c39e['as'],'attributes':_0x43c39e[_0x2b96('0x1d')],'include':_0x43c39e[_0x2b96('0x1f')]?_[_0x2b96('0x21')](_0x43c39e[_0x2b96('0x1f')],function(_0x1200f3){return{'model':db[_0x1200f3[_0x2b96('0x20')]],'as':_0x1200f3['as'],'attributes':_0x1200f3['attributes'],'include':_0x1200f3['include']?_[_0x2b96('0x21')](_0x1200f3[_0x2b96('0x1f')],function(_0x2501fd){return{'model':db[_0x2501fd[_0x2b96('0x20')]],'as':_0x2501fd['as'],'attributes':_0x2501fd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52c739){logger[_0x2b96('0xf')](_0x2b96('0x23'),_0x58405e);logger['debug'](_0x2b96('0x23'),_0x58405e,JSON[_0x2b96('0x13')](_0x52c739));_0x556872(_0x52c739);})['catch'](function(_0x189111){logger['error']('ShowZendeskAccount',_0x189111[_0x2b96('0x17')],_0x58405e);_0x20724c(_0x2b24a3[_0x2b96('0x14')](0x1f4,_0x189111[_0x2b96('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8b383ac..000dd29 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 _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xb688,0xcf));var _0x8b68=function(_0x35c0a3,_0x1955c1){_0x35c0a3=_0x35c0a3-0x0;var _0x53fd66=_0xb688[_0x35c0a3];return _0x53fd66;};'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('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0xe12ca,_0x3a8e29){var _0x5ac9a8=function(_0x321b68){while(--_0x321b68){_0xe12ca['push'](_0xe12ca['shift']());}};_0x5ac9a8(++_0x3a8e29);}(_0xb10b,0x12a));var _0xbb10=function(_0x17bfa4,_0x3eb5f7){_0x17bfa4=_0x17bfa4-0x0;var _0x3d9ca8=_0xb10b[_0x17bfa4];return _0x3d9ca8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e1e00a7..59f7706 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 _0x2e25=['STRING'];(function(_0x5b028c,_0x23dfd5){var _0x209095=function(_0x118807){while(--_0x118807){_0x5b028c['push'](_0x5b028c['shift']());}};_0x209095(++_0x23dfd5);}(_0x2e25,0x1b5));var _0x52e2=function(_0x1e3b99,_0x2b6c9b){_0x1e3b99=_0x1e3b99-0x0;var _0x50729e=_0x2e25[_0x1e3b99];return _0x50729e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x52e2('0x0')]},'description':{'type':Sequelize[_0x52e2('0x0')]}}; \ No newline at end of file +var _0x3989=['sequelize','exports','STRING'];(function(_0x20f50d,_0x47e70d){var _0x2385d9=function(_0x5e97bd){while(--_0x5e97bd){_0x20f50d['push'](_0x20f50d['shift']());}};_0x2385d9(++_0x47e70d);}(_0x3989,0x1bf));var _0x9398=function(_0x3f2bb6,_0x34f81a){_0x3f2bb6=_0x3f2bb6-0x0;var _0x3cdb6f=_0x3989[_0x3f2bb6];return _0x3cdb6f;};'use strict';var Sequelize=require(_0x9398('0x0'));module[_0x9398('0x1')]={'name':{'type':Sequelize[_0x9398('0x2')]},'description':{'type':Sequelize[_0x9398('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6206a06..274e786 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 _0xa7cb=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','ZendeskConfiguration','options','find','create','body','findOne','ZendeskField','rawAttributes','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','status','send','map','fieldName','type','key','query','filters','intersection','model'];(function(_0x1c441b,_0x113389){var _0x50b12c=function(_0x45f70a){while(--_0x45f70a){_0x1c441b['push'](_0x1c441b['shift']());}};_0x50b12c(++_0x113389);}(_0xa7cb,0x76));var _0xba7c=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0xa7cb[_0x255c48];return _0xaebda3;};'use strict';var emlformat=require(_0xba7c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba7c('0x1'));var rp=require(_0xba7c('0x2'));var moment=require(_0xba7c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xba7c('0x4'));var util=require(_0xba7c('0x5'));var path=require(_0xba7c('0x6'));var sox=require(_0xba7c('0x7'));var csv=require(_0xba7c('0x8'));var ejs=require(_0xba7c('0x9'));var fs=require('fs');var fs_extra=require(_0xba7c('0xa'));var _=require(_0xba7c('0xb'));var squel=require(_0xba7c('0xc'));var crypto=require('crypto');var jsforce=require(_0xba7c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xba7c('0x8'));var querystring=require('querystring');var Papa=require(_0xba7c('0xe'));var Redis=require(_0xba7c('0xf'));var authService=require(_0xba7c('0x10'));var qs=require(_0xba7c('0x11'));var as=require(_0xba7c('0x12'));var hardwareService=require(_0xba7c('0x13'));var logger=require(_0xba7c('0x14'))(_0xba7c('0x15'));var utils=require('../../config/utils');var config=require(_0xba7c('0x16'));var licenseUtil=require(_0xba7c('0x17'));var db=require(_0xba7c('0x18'))['db'];function respondWithStatusCode(_0x3fe8a6,_0x5e5df8){_0x5e5df8=_0x5e5df8||0xcc;return function(_0x40c9db){if(_0x40c9db){return _0x3fe8a6[_0xba7c('0x19')](_0x5e5df8);}return _0x3fe8a6['status'](_0x5e5df8)[_0xba7c('0x1a')]();};}function respondWithResult(_0x2779b3,_0x3dd949){_0x3dd949=_0x3dd949||0xc8;return function(_0x588273){if(_0x588273){return _0x2779b3['status'](_0x3dd949)[_0xba7c('0x1b')](_0x588273);}};}function respondWithFilteredResult(_0x3d39f2,_0x3b2040){return function(_0xa15f9b){if(_0xa15f9b){var _0x2eda45=typeof _0x3b2040[_0xba7c('0x1c')]===_0xba7c('0x1d')&&typeof _0x3b2040['limit']===_0xba7c('0x1d');var _0x128544=_0xa15f9b['count'];var _0x15360b=_0x2eda45?0x0:_0x3b2040[_0xba7c('0x1c')];var _0xd883c7=_0x2eda45?_0xa15f9b[_0xba7c('0x1e')]:_0x3b2040[_0xba7c('0x1c')]+_0x3b2040[_0xba7c('0x1f')];var _0x6cf6fa;if(_0xd883c7>=_0x128544){_0xd883c7=_0x128544;_0x6cf6fa=0xc8;}else{_0x6cf6fa=0xce;}_0x3d39f2['status'](_0x6cf6fa);return _0x3d39f2[_0xba7c('0x20')](_0xba7c('0x21'),_0x15360b+'-'+_0xd883c7+'/'+_0x128544)[_0xba7c('0x1b')](_0xa15f9b);}return null;};}function patchUpdates(_0x140df0){return function(_0x124113){try{jsonpatch[_0xba7c('0x22')](_0x124113,_0x140df0,!![]);}catch(_0x3af773){return BPromise[_0xba7c('0x23')](_0x3af773);}return _0x124113[_0xba7c('0x24')]();};}function saveUpdates(_0x480817,_0x26e58){return function(_0x355d43){if(_0x355d43){return _0x355d43[_0xba7c('0x25')](_0x480817)[_0xba7c('0x26')](function(_0x1c0c02){return _0x1c0c02;});}return null;};}function removeEntity(_0x36d45b,_0x2b44be){return function(_0x4457d8){if(_0x4457d8){return _0x4457d8[_0xba7c('0x27')]()[_0xba7c('0x26')](function(){_0x36d45b['status'](0xcc)[_0xba7c('0x1a')]();});}};}function handleEntityNotFound(_0xe8ca79,_0x127ed0){return function(_0x553a58){if(!_0x553a58){_0xe8ca79[_0xba7c('0x19')](0x194);}return _0x553a58;};}function handleError(_0x51908a,_0x4bf35f){_0x4bf35f=_0x4bf35f||0x1f4;return function(_0x12f103){logger[_0xba7c('0x28')](_0x12f103['stack']);if(_0x12f103[_0xba7c('0x29')]){delete _0x12f103[_0xba7c('0x29')];}_0x51908a[_0xba7c('0x2a')](_0x4bf35f)[_0xba7c('0x2b')](_0x12f103);};}exports['index']=function(_0x82c7f5,_0x64dda7){var _0x26d328={},_0x4ae7d2={},_0x4b902b={'count':0x0,'rows':[]};var _0x5a1c48=_[_0xba7c('0x2c')](db['ZendeskConfiguration']['rawAttributes'],function(_0x47c761){return{'name':_0x47c761[_0xba7c('0x2d')],'type':_0x47c761[_0xba7c('0x2e')][_0xba7c('0x2f')]};});_0x4ae7d2['model']=_[_0xba7c('0x2c')](_0x5a1c48,_0xba7c('0x29'));_0x4ae7d2[_0xba7c('0x30')]=_['keys'](_0x82c7f5[_0xba7c('0x30')]);_0x4ae7d2[_0xba7c('0x31')]=_[_0xba7c('0x32')](_0x4ae7d2['model'],_0x4ae7d2[_0xba7c('0x30')]);_0x26d328['attributes']=_[_0xba7c('0x32')](_0x4ae7d2[_0xba7c('0x33')],qs[_0xba7c('0x34')](_0x82c7f5[_0xba7c('0x30')]['fields']));_0x26d328[_0xba7c('0x35')]=_0x26d328[_0xba7c('0x35')][_0xba7c('0x36')]?_0x26d328[_0xba7c('0x35')]:_0x4ae7d2[_0xba7c('0x33')];if(!_0x82c7f5[_0xba7c('0x30')][_0xba7c('0x37')](_0xba7c('0x38'))){_0x26d328[_0xba7c('0x1f')]=qs[_0xba7c('0x1f')](_0x82c7f5[_0xba7c('0x30')][_0xba7c('0x1f')]);_0x26d328['offset']=qs['offset'](_0x82c7f5['query'][_0xba7c('0x1c')]);}_0x26d328[_0xba7c('0x39')]=qs[_0xba7c('0x3a')](_0x82c7f5['query'][_0xba7c('0x3a')]);_0x26d328['where']=qs[_0xba7c('0x31')](_[_0xba7c('0x3b')](_0x82c7f5[_0xba7c('0x30')],_0x4ae7d2[_0xba7c('0x31')]),_0x5a1c48);if(_0x82c7f5[_0xba7c('0x30')][_0xba7c('0x3c')]){_0x26d328[_0xba7c('0x3d')]=_[_0xba7c('0x3e')](_0x26d328[_0xba7c('0x3d')],{'$or':_[_0xba7c('0x2c')](_0x5a1c48,function(_0x190055){if(_0x190055[_0xba7c('0x2e')]!==_0xba7c('0x3f')){var _0xdb3fbf={};_0xdb3fbf[_0x190055[_0xba7c('0x29')]]={'$like':'%'+_0x82c7f5[_0xba7c('0x30')][_0xba7c('0x3c')]+'%'};return _0xdb3fbf;}})});}_0x26d328=_[_0xba7c('0x3e')]({},_0x26d328,_0x82c7f5['options']);var _0x5c14cb={'where':_0x26d328[_0xba7c('0x3d')]};return db['ZendeskConfiguration'][_0xba7c('0x1e')](_0x5c14cb)[_0xba7c('0x26')](function(_0x52be7a){_0x4b902b['count']=_0x52be7a;if(_0x82c7f5[_0xba7c('0x30')][_0xba7c('0x40')]){_0x26d328[_0xba7c('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xba7c('0x42')](_0x26d328);})[_0xba7c('0x26')](function(_0x44a37f){_0x4b902b['rows']=_0x44a37f;return _0x4b902b;})['then'](respondWithFilteredResult(_0x64dda7,_0x26d328))[_0xba7c('0x43')](handleError(_0x64dda7,null));};exports[_0xba7c('0x44')]=function(_0x21b939,_0x2ef074){var _0x319ffe={'raw':![],'where':{'id':_0x21b939[_0xba7c('0x45')]['id']}},_0x38e97b={};_0x38e97b[_0xba7c('0x33')]=_[_0xba7c('0x46')](db[_0xba7c('0x47')]['rawAttributes']);_0x38e97b[_0xba7c('0x30')]=_['keys'](_0x21b939[_0xba7c('0x30')]);_0x38e97b[_0xba7c('0x31')]=_[_0xba7c('0x32')](_0x38e97b[_0xba7c('0x33')],_0x38e97b['query']);_0x319ffe[_0xba7c('0x35')]=_[_0xba7c('0x32')](_0x38e97b[_0xba7c('0x33')],qs[_0xba7c('0x34')](_0x21b939[_0xba7c('0x30')][_0xba7c('0x34')]));_0x319ffe[_0xba7c('0x35')]=_0x319ffe[_0xba7c('0x35')]['length']?_0x319ffe[_0xba7c('0x35')]:_0x38e97b['model'];if(_0x21b939[_0xba7c('0x30')][_0xba7c('0x40')]){_0x319ffe[_0xba7c('0x41')]=[{'all':!![]}];}_0x319ffe=_[_0xba7c('0x3e')]({},_0x319ffe,_0x21b939[_0xba7c('0x48')]);return db['ZendeskConfiguration'][_0xba7c('0x49')](_0x319ffe)[_0xba7c('0x26')](handleEntityNotFound(_0x2ef074,null))[_0xba7c('0x26')](respondWithResult(_0x2ef074,null))['catch'](handleError(_0x2ef074,null));};exports['create']=function(_0x53dece,_0x446450){return db[_0xba7c('0x47')][_0xba7c('0x4a')](_0x53dece[_0xba7c('0x4b')],{})[_0xba7c('0x26')](respondWithResult(_0x446450,0xc9))['catch'](handleError(_0x446450,null));};exports[_0xba7c('0x25')]=function(_0x135168,_0x5824ab){if(_0x135168[_0xba7c('0x4b')]['id']){delete _0x135168[_0xba7c('0x4b')]['id'];}return db[_0xba7c('0x47')][_0xba7c('0x49')]({'where':{'id':_0x135168[_0xba7c('0x45')]['id']}})[_0xba7c('0x26')](handleEntityNotFound(_0x5824ab,null))[_0xba7c('0x26')](saveUpdates(_0x135168[_0xba7c('0x4b')],null))[_0xba7c('0x26')](respondWithResult(_0x5824ab,null))['catch'](handleError(_0x5824ab,null));};exports[_0xba7c('0x27')]=function(_0x253ed3,_0x35a5f2){return db[_0xba7c('0x47')]['find']({'where':{'id':_0x253ed3['params']['id']}})[_0xba7c('0x26')](handleEntityNotFound(_0x35a5f2,null))[_0xba7c('0x26')](removeEntity(_0x35a5f2,null))[_0xba7c('0x43')](handleError(_0x35a5f2,null));};exports['getFields']=function(_0x28f9c1,_0x4fd0f4,_0x568e6a){var _0x14df3c={};var _0x3e14b8={};var _0x1ac2cb;var _0x44f5ba;return db[_0xba7c('0x47')][_0xba7c('0x4c')]({'where':{'id':_0x28f9c1['params']['id']}})[_0xba7c('0x26')](handleEntityNotFound(_0x4fd0f4,null))[_0xba7c('0x26')](function(_0x591156){if(_0x591156){_0x1ac2cb=_0x591156;_0x3e14b8[_0xba7c('0x33')]=_[_0xba7c('0x46')](db[_0xba7c('0x4d')][_0xba7c('0x4e')]);_0x3e14b8[_0xba7c('0x30')]=_[_0xba7c('0x46')](_0x28f9c1[_0xba7c('0x30')]);_0x3e14b8[_0xba7c('0x31')]=_[_0xba7c('0x32')](_0x3e14b8[_0xba7c('0x33')],_0x3e14b8['query']);_0x14df3c[_0xba7c('0x35')]=_['intersection'](_0x3e14b8['model'],qs['fields'](_0x28f9c1[_0xba7c('0x30')][_0xba7c('0x34')]));_0x14df3c[_0xba7c('0x35')]=_0x14df3c['attributes'][_0xba7c('0x36')]?_0x14df3c[_0xba7c('0x35')]:_0x3e14b8[_0xba7c('0x33')];_0x14df3c[_0xba7c('0x39')]=qs[_0xba7c('0x3a')](_0x28f9c1[_0xba7c('0x30')][_0xba7c('0x3a')]);_0x14df3c[_0xba7c('0x3d')]=qs[_0xba7c('0x31')](_['pick'](_0x28f9c1[_0xba7c('0x30')],_0x3e14b8['filters']));if(_0x28f9c1[_0xba7c('0x30')][_0xba7c('0x3c')]){_0x14df3c[_0xba7c('0x3d')]=_[_0xba7c('0x3e')](_0x14df3c[_0xba7c('0x3d')],{'$or':_[_0xba7c('0x2c')](_0x14df3c['attributes'],function(_0x8e4514){var _0x39ac04={};_0x39ac04[_0x8e4514]={'$like':'%'+_0x28f9c1[_0xba7c('0x30')]['filter']+'%'};return _0x39ac04;})});}_0x14df3c=_[_0xba7c('0x3e')]({},_0x14df3c,_0x28f9c1['options']);return _0x1ac2cb[_0xba7c('0x4f')](_0x14df3c);}})[_0xba7c('0x26')](function(_0x28aa3f){if(_0x28aa3f){_0x44f5ba=_0x28aa3f[_0xba7c('0x36')];if(!_0x28f9c1[_0xba7c('0x30')]['hasOwnProperty'](_0xba7c('0x38'))){_0x14df3c['limit']=qs[_0xba7c('0x1f')](_0x28f9c1[_0xba7c('0x30')][_0xba7c('0x1f')]);_0x14df3c[_0xba7c('0x1c')]=qs['offset'](_0x28f9c1[_0xba7c('0x30')]['offset']);}return _0x1ac2cb[_0xba7c('0x4f')](_0x14df3c);}})[_0xba7c('0x26')](function(_0x24a0ee){if(_0x24a0ee){return _0x24a0ee?{'count':_0x44f5ba,'rows':_0x24a0ee}:null;}})[_0xba7c('0x26')](respondWithResult(_0x4fd0f4,null))['catch'](handleError(_0x4fd0f4,null));};exports[_0xba7c('0x50')]=function(_0x941a49,_0x581f39,_0x1e5e12){var _0x57f579={};var _0x28cc78={};var _0xf98930;var _0xea235a;return db['ZendeskConfiguration'][_0xba7c('0x4c')]({'where':{'id':_0x941a49[_0xba7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x581f39,null))['then'](function(_0x484da0){if(_0x484da0){_0xf98930=_0x484da0;_0x28cc78[_0xba7c('0x33')]=_[_0xba7c('0x46')](db['ZendeskField'][_0xba7c('0x4e')]);_0x28cc78[_0xba7c('0x30')]=_['keys'](_0x941a49[_0xba7c('0x30')]);_0x28cc78[_0xba7c('0x31')]=_[_0xba7c('0x32')](_0x28cc78[_0xba7c('0x33')],_0x28cc78[_0xba7c('0x30')]);_0x57f579[_0xba7c('0x35')]=_[_0xba7c('0x32')](_0x28cc78[_0xba7c('0x33')],qs[_0xba7c('0x34')](_0x941a49[_0xba7c('0x30')][_0xba7c('0x34')]));_0x57f579[_0xba7c('0x35')]=_0x57f579['attributes']['length']?_0x57f579[_0xba7c('0x35')]:_0x28cc78[_0xba7c('0x33')];_0x57f579['order']=qs[_0xba7c('0x3a')](_0x941a49[_0xba7c('0x30')][_0xba7c('0x3a')]);_0x57f579['where']=qs['filters'](_[_0xba7c('0x3b')](_0x941a49['query'],_0x28cc78['filters']));if(_0x941a49['query']['filter']){_0x57f579[_0xba7c('0x3d')]=_['merge'](_0x57f579[_0xba7c('0x3d')],{'$or':_['map'](_0x57f579[_0xba7c('0x35')],function(_0x264f82){var _0x2777e4={};_0x2777e4[_0x264f82]={'$like':'%'+_0x941a49[_0xba7c('0x30')][_0xba7c('0x3c')]+'%'};return _0x2777e4;})});}_0x57f579=_[_0xba7c('0x3e')]({},_0x57f579,_0x941a49[_0xba7c('0x48')]);return _0xf98930['getSubjects'](_0x57f579);}})[_0xba7c('0x26')](function(_0x181409){if(_0x181409){_0xea235a=_0x181409['length'];if(!_0x941a49['query'][_0xba7c('0x37')](_0xba7c('0x38'))){_0x57f579[_0xba7c('0x1f')]=qs['limit'](_0x941a49[_0xba7c('0x30')][_0xba7c('0x1f')]);_0x57f579[_0xba7c('0x1c')]=qs[_0xba7c('0x1c')](_0x941a49[_0xba7c('0x30')]['offset']);}return _0xf98930[_0xba7c('0x50')](_0x57f579);}})[_0xba7c('0x26')](function(_0x3666e8){if(_0x3666e8){return _0x3666e8?{'count':_0xea235a,'rows':_0x3666e8}:null;}})['then'](respondWithResult(_0x581f39,null))['catch'](handleError(_0x581f39,null));};exports[_0xba7c('0x51')]=function(_0x2f46dc,_0x602461,_0x2c4d52){var _0x3d2b1c={};var _0x2fc119={};var _0x21849f;var _0xb5418c;return db[_0xba7c('0x47')][_0xba7c('0x4c')]({'where':{'id':_0x2f46dc[_0xba7c('0x45')]['id']}})[_0xba7c('0x26')](handleEntityNotFound(_0x602461,null))[_0xba7c('0x26')](function(_0x128308){if(_0x128308){_0x21849f=_0x128308;_0x2fc119['model']=_[_0xba7c('0x46')](db[_0xba7c('0x4d')]['rawAttributes']);_0x2fc119[_0xba7c('0x30')]=_[_0xba7c('0x46')](_0x2f46dc['query']);_0x2fc119[_0xba7c('0x31')]=_[_0xba7c('0x32')](_0x2fc119[_0xba7c('0x33')],_0x2fc119[_0xba7c('0x30')]);_0x3d2b1c['attributes']=_[_0xba7c('0x32')](_0x2fc119[_0xba7c('0x33')],qs[_0xba7c('0x34')](_0x2f46dc[_0xba7c('0x30')][_0xba7c('0x34')]));_0x3d2b1c[_0xba7c('0x35')]=_0x3d2b1c[_0xba7c('0x35')][_0xba7c('0x36')]?_0x3d2b1c['attributes']:_0x2fc119[_0xba7c('0x33')];_0x3d2b1c[_0xba7c('0x39')]=qs[_0xba7c('0x3a')](_0x2f46dc['query'][_0xba7c('0x3a')]);_0x3d2b1c[_0xba7c('0x3d')]=qs[_0xba7c('0x31')](_[_0xba7c('0x3b')](_0x2f46dc[_0xba7c('0x30')],_0x2fc119['filters']));if(_0x2f46dc['query'][_0xba7c('0x3c')]){_0x3d2b1c[_0xba7c('0x3d')]=_[_0xba7c('0x3e')](_0x3d2b1c['where'],{'$or':_['map'](_0x3d2b1c[_0xba7c('0x35')],function(_0x25e4e6){var _0x12adf1={};_0x12adf1[_0x25e4e6]={'$like':'%'+_0x2f46dc['query'][_0xba7c('0x3c')]+'%'};return _0x12adf1;})});}_0x3d2b1c=_[_0xba7c('0x3e')]({},_0x3d2b1c,_0x2f46dc[_0xba7c('0x48')]);return _0x21849f[_0xba7c('0x51')](_0x3d2b1c);}})[_0xba7c('0x26')](function(_0x1ddecf){if(_0x1ddecf){_0xb5418c=_0x1ddecf[_0xba7c('0x36')];if(!_0x2f46dc['query']['hasOwnProperty'](_0xba7c('0x38'))){_0x3d2b1c[_0xba7c('0x1f')]=qs[_0xba7c('0x1f')](_0x2f46dc[_0xba7c('0x30')][_0xba7c('0x1f')]);_0x3d2b1c[_0xba7c('0x1c')]=qs[_0xba7c('0x1c')](_0x2f46dc[_0xba7c('0x30')]['offset']);}return _0x21849f[_0xba7c('0x51')](_0x3d2b1c);}})['then'](function(_0x67621b){if(_0x67621b){return _0x67621b?{'count':_0xb5418c,'rows':_0x67621b}:null;}})[_0xba7c('0x26')](respondWithResult(_0x602461,null))[_0xba7c('0x43')](handleError(_0x602461,null));};exports[_0xba7c('0x52')]=function(_0x58805a,_0x88489,_0x3b9ded){var _0x4f1bdc={};var _0x44054d={};var _0x53b8ab;var _0x248f90;return db[_0xba7c('0x47')][_0xba7c('0x4c')]({'where':{'id':_0x58805a[_0xba7c('0x45')]['id']}})[_0xba7c('0x26')](handleEntityNotFound(_0x88489,null))[_0xba7c('0x26')](function(_0xa44f7a){if(_0xa44f7a){_0x53b8ab=_0xa44f7a;_0x44054d[_0xba7c('0x33')]=_[_0xba7c('0x46')](db['Tag'][_0xba7c('0x4e')]);_0x44054d[_0xba7c('0x30')]=_[_0xba7c('0x46')](_0x58805a[_0xba7c('0x30')]);_0x44054d['filters']=_['intersection'](_0x44054d[_0xba7c('0x33')],_0x44054d[_0xba7c('0x30')]);_0x4f1bdc[_0xba7c('0x35')]=_['intersection'](_0x44054d[_0xba7c('0x33')],qs[_0xba7c('0x34')](_0x58805a[_0xba7c('0x30')][_0xba7c('0x34')]));_0x4f1bdc['attributes']=_0x4f1bdc[_0xba7c('0x35')][_0xba7c('0x36')]?_0x4f1bdc['attributes']:_0x44054d[_0xba7c('0x33')];_0x4f1bdc['order']=qs[_0xba7c('0x3a')](_0x58805a['query'][_0xba7c('0x3a')]);_0x4f1bdc[_0xba7c('0x3d')]=qs['filters'](_[_0xba7c('0x3b')](_0x58805a[_0xba7c('0x30')],_0x44054d[_0xba7c('0x31')]));if(_0x58805a['query'][_0xba7c('0x3c')]){_0x4f1bdc[_0xba7c('0x3d')]=_[_0xba7c('0x3e')](_0x4f1bdc['where'],{'$or':_[_0xba7c('0x2c')](_0x4f1bdc[_0xba7c('0x35')],function(_0x287ad6){var _0x22008d={};_0x22008d[_0x287ad6]={'$like':'%'+_0x58805a[_0xba7c('0x30')][_0xba7c('0x3c')]+'%'};return _0x22008d;})});}_0x4f1bdc=_['merge']({},_0x4f1bdc,_0x58805a[_0xba7c('0x48')]);return _0x53b8ab[_0xba7c('0x52')](_0x4f1bdc);}})[_0xba7c('0x26')](function(_0x4bd755){if(_0x4bd755){_0x248f90=_0x4bd755['length'];if(!_0x58805a[_0xba7c('0x30')]['hasOwnProperty'](_0xba7c('0x38'))){_0x4f1bdc[_0xba7c('0x1f')]=qs['limit'](_0x58805a[_0xba7c('0x30')]['limit']);_0x4f1bdc[_0xba7c('0x1c')]=qs[_0xba7c('0x1c')](_0x58805a[_0xba7c('0x30')][_0xba7c('0x1c')]);}return _0x53b8ab[_0xba7c('0x52')](_0x4f1bdc);}})['then'](function(_0x460cc6){if(_0x460cc6){return _0x460cc6?{'count':_0x248f90,'rows':_0x460cc6}:null;}})[_0xba7c('0x26')](respondWithResult(_0x88489,null))[_0xba7c('0x43')](handleError(_0x88489,null));};exports['setTags']=function(_0x3ea79b,_0x537fab,_0x5ad9ac){if(_0x3ea79b[_0xba7c('0x4b')]['id']){delete _0x3ea79b[_0xba7c('0x4b')]['id'];}return db[_0xba7c('0x47')][_0xba7c('0x4c')]({'where':{'id':_0x3ea79b[_0xba7c('0x45')]['id']}})['then'](handleEntityNotFound(_0x537fab,null))[_0xba7c('0x26')](function(_0x49807f){if(_0x49807f){return _0x49807f[_0xba7c('0x53')](_0x3ea79b['body'][_0xba7c('0x54')]||[]);}return null;})['then'](respondWithResult(_0x537fab,null))[_0xba7c('0x43')](handleError(_0x537fab,null));}; \ No newline at end of file +var _0x9ecf=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','fields','include','find','catch','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2f152a,_0x7c71a5){var _0x4714ad=function(_0x1989f6){while(--_0x1989f6){_0x2f152a['push'](_0x2f152a['shift']());}};_0x4714ad(++_0x7c71a5);}(_0x9ecf,0x1aa));var _0xf9ec=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x9ecf[_0x17bb31];return _0x505c71;};'use strict';var emlformat=require(_0xf9ec('0x0'));var rimraf=require(_0xf9ec('0x1'));var zipdir=require(_0xf9ec('0x2'));var jsonpatch=require(_0xf9ec('0x3'));var rp=require(_0xf9ec('0x4'));var moment=require(_0xf9ec('0x5'));var BPromise=require(_0xf9ec('0x6'));var Mustache=require(_0xf9ec('0x7'));var util=require(_0xf9ec('0x8'));var path=require(_0xf9ec('0x9'));var sox=require(_0xf9ec('0xa'));var csv=require(_0xf9ec('0xb'));var ejs=require(_0xf9ec('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9ec('0xd'));var squel=require('squel');var crypto=require(_0xf9ec('0xe'));var jsforce=require(_0xf9ec('0xf'));var deskjs=require(_0xf9ec('0x10'));var toCsv=require(_0xf9ec('0xb'));var querystring=require(_0xf9ec('0x11'));var Papa=require(_0xf9ec('0x12'));var Redis=require('ioredis');var authService=require(_0xf9ec('0x13'));var qs=require(_0xf9ec('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9ec('0x15'));var logger=require(_0xf9ec('0x16'))(_0xf9ec('0x17'));var utils=require('../../config/utils');var config=require(_0xf9ec('0x18'));var licenseUtil=require(_0xf9ec('0x19'));var db=require(_0xf9ec('0x1a'))['db'];function respondWithStatusCode(_0x3e85ca,_0x3a8643){_0x3a8643=_0x3a8643||0xcc;return function(_0xd63a2c){if(_0xd63a2c){return _0x3e85ca[_0xf9ec('0x1b')](_0x3a8643);}return _0x3e85ca['status'](_0x3a8643)[_0xf9ec('0x1c')]();};}function respondWithResult(_0xc04772,_0xec7fc){_0xec7fc=_0xec7fc||0xc8;return function(_0x5bc0b2){if(_0x5bc0b2){return _0xc04772[_0xf9ec('0x1d')](_0xec7fc)[_0xf9ec('0x1e')](_0x5bc0b2);}};}function respondWithFilteredResult(_0x2b32f8,_0x8f3c86){return function(_0x333903){if(_0x333903){var _0x340afe=typeof _0x8f3c86[_0xf9ec('0x1f')]===_0xf9ec('0x20')&&typeof _0x8f3c86[_0xf9ec('0x21')]==='undefined';var _0x510b5e=_0x333903['count'];var _0x5f23f7=_0x340afe?0x0:_0x8f3c86['offset'];var _0x1f4e8d=_0x340afe?_0x333903[_0xf9ec('0x22')]:_0x8f3c86['offset']+_0x8f3c86[_0xf9ec('0x21')];var _0x223af6;if(_0x1f4e8d>=_0x510b5e){_0x1f4e8d=_0x510b5e;_0x223af6=0xc8;}else{_0x223af6=0xce;}_0x2b32f8['status'](_0x223af6);return _0x2b32f8[_0xf9ec('0x23')](_0xf9ec('0x24'),_0x5f23f7+'-'+_0x1f4e8d+'/'+_0x510b5e)[_0xf9ec('0x1e')](_0x333903);}return null;};}function patchUpdates(_0x39a402){return function(_0x1dacfc){try{jsonpatch[_0xf9ec('0x25')](_0x1dacfc,_0x39a402,!![]);}catch(_0x39bb6a){return BPromise[_0xf9ec('0x26')](_0x39bb6a);}return _0x1dacfc[_0xf9ec('0x27')]();};}function saveUpdates(_0x453e48,_0x4b04b0){return function(_0x2da7ca){if(_0x2da7ca){return _0x2da7ca[_0xf9ec('0x28')](_0x453e48)['then'](function(_0x3e7214){return _0x3e7214;});}return null;};}function removeEntity(_0x9c9da5,_0x1526ac){return function(_0x26bd56){if(_0x26bd56){return _0x26bd56[_0xf9ec('0x29')]()[_0xf9ec('0x2a')](function(){_0x9c9da5[_0xf9ec('0x1d')](0xcc)[_0xf9ec('0x1c')]();});}};}function handleEntityNotFound(_0x2a977b,_0x896d91){return function(_0x3554db){if(!_0x3554db){_0x2a977b[_0xf9ec('0x1b')](0x194);}return _0x3554db;};}function handleError(_0x3ca9bc,_0x286a9c){_0x286a9c=_0x286a9c||0x1f4;return function(_0x459087){logger[_0xf9ec('0x2b')](_0x459087[_0xf9ec('0x2c')]);if(_0x459087[_0xf9ec('0x2d')]){delete _0x459087[_0xf9ec('0x2d')];}_0x3ca9bc[_0xf9ec('0x1d')](_0x286a9c)[_0xf9ec('0x2e')](_0x459087);};}exports['index']=function(_0x3c6052,_0x55ca6a){var _0x315930={},_0x9c7d32={},_0x5209dc={'count':0x0,'rows':[]};var _0x35e2e9=_[_0xf9ec('0x2f')](db[_0xf9ec('0x30')][_0xf9ec('0x31')],function(_0x33fef9){return{'name':_0x33fef9[_0xf9ec('0x32')],'type':_0x33fef9[_0xf9ec('0x33')][_0xf9ec('0x34')]};});_0x9c7d32[_0xf9ec('0x35')]=_[_0xf9ec('0x2f')](_0x35e2e9,_0xf9ec('0x2d'));_0x9c7d32['query']=_[_0xf9ec('0x36')](_0x3c6052[_0xf9ec('0x37')]);_0x9c7d32[_0xf9ec('0x38')]=_['intersection'](_0x9c7d32[_0xf9ec('0x35')],_0x9c7d32[_0xf9ec('0x37')]);_0x315930[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x9c7d32['model'],qs['fields'](_0x3c6052[_0xf9ec('0x37')]['fields']));_0x315930['attributes']=_0x315930[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x315930[_0xf9ec('0x39')]:_0x9c7d32['model'];if(!_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x315930[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x3c6052[_0xf9ec('0x37')]['limit']);_0x315930[_0xf9ec('0x1f')]=qs['offset'](_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}_0x315930[_0xf9ec('0x3e')]=qs['sort'](_0x3c6052['query'][_0xf9ec('0x3f')]);_0x315930[_0xf9ec('0x40')]=qs[_0xf9ec('0x38')](_[_0xf9ec('0x41')](_0x3c6052[_0xf9ec('0x37')],_0x9c7d32[_0xf9ec('0x38')]),_0x35e2e9);if(_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x315930['where']=_[_0xf9ec('0x43')](_0x315930['where'],{'$or':_[_0xf9ec('0x2f')](_0x35e2e9,function(_0x90f401){if(_0x90f401[_0xf9ec('0x33')]!==_0xf9ec('0x44')){var _0xbffa82={};_0xbffa82[_0x90f401[_0xf9ec('0x2d')]]={'$like':'%'+_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0xbffa82;}})});}_0x315930=_[_0xf9ec('0x43')]({},_0x315930,_0x3c6052[_0xf9ec('0x45')]);var _0x20066a={'where':_0x315930[_0xf9ec('0x40')]};return db[_0xf9ec('0x30')][_0xf9ec('0x22')](_0x20066a)[_0xf9ec('0x2a')](function(_0xeba3e5){_0x5209dc[_0xf9ec('0x22')]=_0xeba3e5;if(_0x3c6052[_0xf9ec('0x37')][_0xf9ec('0x46')]){_0x315930['include']=[{'all':!![]}];}return db[_0xf9ec('0x30')]['findAll'](_0x315930);})[_0xf9ec('0x2a')](function(_0x64e1cd){_0x5209dc[_0xf9ec('0x47')]=_0x64e1cd;return _0x5209dc;})[_0xf9ec('0x2a')](respondWithFilteredResult(_0x55ca6a,_0x315930))['catch'](handleError(_0x55ca6a,null));};exports['show']=function(_0x1859e0,_0xc6c42b){var _0x2f5f62={'raw':![],'where':{'id':_0x1859e0[_0xf9ec('0x48')]['id']}},_0x5062e1={};_0x5062e1[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x30')][_0xf9ec('0x31')]);_0x5062e1[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x1859e0['query']);_0x5062e1[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x5062e1[_0xf9ec('0x35')],_0x5062e1['query']);_0x2f5f62[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x5062e1[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x1859e0[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x2f5f62[_0xf9ec('0x39')]=_0x2f5f62[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x2f5f62[_0xf9ec('0x39')]:_0x5062e1[_0xf9ec('0x35')];if(_0x1859e0[_0xf9ec('0x37')][_0xf9ec('0x46')]){_0x2f5f62[_0xf9ec('0x4a')]=[{'all':!![]}];}_0x2f5f62=_[_0xf9ec('0x43')]({},_0x2f5f62,_0x1859e0[_0xf9ec('0x45')]);return db['ZendeskConfiguration'][_0xf9ec('0x4b')](_0x2f5f62)[_0xf9ec('0x2a')](handleEntityNotFound(_0xc6c42b,null))[_0xf9ec('0x2a')](respondWithResult(_0xc6c42b,null))[_0xf9ec('0x4c')](handleError(_0xc6c42b,null));};exports['create']=function(_0x211c1c,_0x342190){return db[_0xf9ec('0x30')]['create'](_0x211c1c['body'],{})[_0xf9ec('0x2a')](respondWithResult(_0x342190,0xc9))[_0xf9ec('0x4c')](handleError(_0x342190,null));};exports[_0xf9ec('0x28')]=function(_0xeea8b2,_0x509c96){if(_0xeea8b2[_0xf9ec('0x4d')]['id']){delete _0xeea8b2[_0xf9ec('0x4d')]['id'];}return db[_0xf9ec('0x30')]['find']({'where':{'id':_0xeea8b2[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x509c96,null))[_0xf9ec('0x2a')](saveUpdates(_0xeea8b2[_0xf9ec('0x4d')],null))[_0xf9ec('0x2a')](respondWithResult(_0x509c96,null))['catch'](handleError(_0x509c96,null));};exports['destroy']=function(_0x1e1230,_0x254b9a){return db[_0xf9ec('0x30')]['find']({'where':{'id':_0x1e1230[_0xf9ec('0x48')]['id']}})['then'](handleEntityNotFound(_0x254b9a,null))['then'](removeEntity(_0x254b9a,null))[_0xf9ec('0x4c')](handleError(_0x254b9a,null));};exports[_0xf9ec('0x4e')]=function(_0x33a4d7,_0x41a0c8,_0x5e763e){var _0x1a1eea={};var _0x550e0b={};var _0x5d5747;var _0x554bab;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x33a4d7[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x41a0c8,null))[_0xf9ec('0x2a')](function(_0x5554eb){if(_0x5554eb){_0x5d5747=_0x5554eb;_0x550e0b[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x50')][_0xf9ec('0x31')]);_0x550e0b[_0xf9ec('0x37')]=_['keys'](_0x33a4d7[_0xf9ec('0x37')]);_0x550e0b['filters']=_['intersection'](_0x550e0b[_0xf9ec('0x35')],_0x550e0b['query']);_0x1a1eea[_0xf9ec('0x39')]=_[_0xf9ec('0x3a')](_0x550e0b['model'],qs['fields'](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x1a1eea[_0xf9ec('0x39')]=_0x1a1eea['attributes'][_0xf9ec('0x3b')]?_0x1a1eea[_0xf9ec('0x39')]:_0x550e0b[_0xf9ec('0x35')];_0x1a1eea[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x1a1eea['where']=qs[_0xf9ec('0x38')](_['pick'](_0x33a4d7[_0xf9ec('0x37')],_0x550e0b[_0xf9ec('0x38')]));if(_0x33a4d7['query'][_0xf9ec('0x42')]){_0x1a1eea[_0xf9ec('0x40')]=_['merge'](_0x1a1eea[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x1a1eea[_0xf9ec('0x39')],function(_0x5cf122){var _0x87793e={};_0x87793e[_0x5cf122]={'$like':'%'+_0x33a4d7[_0xf9ec('0x37')]['filter']+'%'};return _0x87793e;})});}_0x1a1eea=_[_0xf9ec('0x43')]({},_0x1a1eea,_0x33a4d7[_0xf9ec('0x45')]);return _0x5d5747[_0xf9ec('0x4e')](_0x1a1eea);}})['then'](function(_0xa8d223){if(_0xa8d223){_0x554bab=_0xa8d223[_0xf9ec('0x3b')];if(!_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x1a1eea['limit']=qs[_0xf9ec('0x21')](_0x33a4d7[_0xf9ec('0x37')]['limit']);_0x1a1eea[_0xf9ec('0x1f')]=qs[_0xf9ec('0x1f')](_0x33a4d7[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0x5d5747[_0xf9ec('0x4e')](_0x1a1eea);}})[_0xf9ec('0x2a')](function(_0x369460){if(_0x369460){return _0x369460?{'count':_0x554bab,'rows':_0x369460}:null;}})[_0xf9ec('0x2a')](respondWithResult(_0x41a0c8,null))[_0xf9ec('0x4c')](handleError(_0x41a0c8,null));};exports[_0xf9ec('0x51')]=function(_0x18687e,_0x21d032,_0x4586d4){var _0x16e36d={};var _0x1c87ae={};var _0x11a187;var _0x1ce18e;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x18687e[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x21d032,null))[_0xf9ec('0x2a')](function(_0x2f5424){if(_0x2f5424){_0x11a187=_0x2f5424;_0x1c87ae[_0xf9ec('0x35')]=_['keys'](db['ZendeskField'][_0xf9ec('0x31')]);_0x1c87ae['query']=_[_0xf9ec('0x36')](_0x18687e[_0xf9ec('0x37')]);_0x1c87ae['filters']=_[_0xf9ec('0x3a')](_0x1c87ae[_0xf9ec('0x35')],_0x1c87ae[_0xf9ec('0x37')]);_0x16e36d['attributes']=_['intersection'](_0x1c87ae[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x16e36d['attributes']=_0x16e36d[_0xf9ec('0x39')]['length']?_0x16e36d[_0xf9ec('0x39')]:_0x1c87ae['model'];_0x16e36d[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x16e36d['where']=qs['filters'](_[_0xf9ec('0x41')](_0x18687e[_0xf9ec('0x37')],_0x1c87ae['filters']));if(_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x16e36d[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0x16e36d[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x16e36d[_0xf9ec('0x39')],function(_0x3403a3){var _0x4c1297={};_0x4c1297[_0x3403a3]={'$like':'%'+_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0x4c1297;})});}_0x16e36d=_[_0xf9ec('0x43')]({},_0x16e36d,_0x18687e[_0xf9ec('0x45')]);return _0x11a187[_0xf9ec('0x51')](_0x16e36d);}})[_0xf9ec('0x2a')](function(_0x44288d){if(_0x44288d){_0x1ce18e=_0x44288d[_0xf9ec('0x3b')];if(!_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x16e36d[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x18687e['query'][_0xf9ec('0x21')]);_0x16e36d[_0xf9ec('0x1f')]=qs[_0xf9ec('0x1f')](_0x18687e[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0x11a187[_0xf9ec('0x51')](_0x16e36d);}})[_0xf9ec('0x2a')](function(_0x584fef){if(_0x584fef){return _0x584fef?{'count':_0x1ce18e,'rows':_0x584fef}:null;}})['then'](respondWithResult(_0x21d032,null))[_0xf9ec('0x4c')](handleError(_0x21d032,null));};exports[_0xf9ec('0x52')]=function(_0x49c18e,_0x4bab0c,_0xb07632){var _0xf902c1={};var _0x14283c={};var _0xb1657d;var _0x1eae6a;return db[_0xf9ec('0x30')][_0xf9ec('0x4f')]({'where':{'id':_0x49c18e[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x4bab0c,null))[_0xf9ec('0x2a')](function(_0x4657d7){if(_0x4657d7){_0xb1657d=_0x4657d7;_0x14283c[_0xf9ec('0x35')]=_[_0xf9ec('0x36')](db[_0xf9ec('0x50')][_0xf9ec('0x31')]);_0x14283c[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x49c18e[_0xf9ec('0x37')]);_0x14283c[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x14283c[_0xf9ec('0x35')],_0x14283c[_0xf9ec('0x37')]);_0xf902c1[_0xf9ec('0x39')]=_['intersection'](_0x14283c[_0xf9ec('0x35')],qs[_0xf9ec('0x49')](_0x49c18e['query'][_0xf9ec('0x49')]));_0xf902c1['attributes']=_0xf902c1[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0xf902c1['attributes']:_0x14283c['model'];_0xf902c1[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x49c18e['query']['sort']);_0xf902c1[_0xf9ec('0x40')]=qs['filters'](_[_0xf9ec('0x41')](_0x49c18e['query'],_0x14283c['filters']));if(_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0xf902c1[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0xf902c1['where'],{'$or':_[_0xf9ec('0x2f')](_0xf902c1[_0xf9ec('0x39')],function(_0x1faa80){var _0x4346cf={};_0x4346cf[_0x1faa80]={'$like':'%'+_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x42')]+'%'};return _0x4346cf;})});}_0xf902c1=_['merge']({},_0xf902c1,_0x49c18e[_0xf9ec('0x45')]);return _0xb1657d[_0xf9ec('0x52')](_0xf902c1);}})[_0xf9ec('0x2a')](function(_0x245f21){if(_0x245f21){_0x1eae6a=_0x245f21[_0xf9ec('0x3b')];if(!_0x49c18e['query'][_0xf9ec('0x3c')]('nolimit')){_0xf902c1[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x21')]);_0xf902c1['offset']=qs['offset'](_0x49c18e[_0xf9ec('0x37')][_0xf9ec('0x1f')]);}return _0xb1657d[_0xf9ec('0x52')](_0xf902c1);}})[_0xf9ec('0x2a')](function(_0x50a3e4){if(_0x50a3e4){return _0x50a3e4?{'count':_0x1eae6a,'rows':_0x50a3e4}:null;}})[_0xf9ec('0x2a')](respondWithResult(_0x4bab0c,null))[_0xf9ec('0x4c')](handleError(_0x4bab0c,null));};exports[_0xf9ec('0x53')]=function(_0x4a81b5,_0x4ed127,_0x137710){var _0x3fd194={};var _0x3f4a94={};var _0x1d545b;var _0x4e328a;return db['ZendeskConfiguration'][_0xf9ec('0x4f')]({'where':{'id':_0x4a81b5[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x4ed127,null))[_0xf9ec('0x2a')](function(_0x1496bb){if(_0x1496bb){_0x1d545b=_0x1496bb;_0x3f4a94['model']=_[_0xf9ec('0x36')](db['Tag'][_0xf9ec('0x31')]);_0x3f4a94[_0xf9ec('0x37')]=_[_0xf9ec('0x36')](_0x4a81b5[_0xf9ec('0x37')]);_0x3f4a94[_0xf9ec('0x38')]=_[_0xf9ec('0x3a')](_0x3f4a94[_0xf9ec('0x35')],_0x3f4a94[_0xf9ec('0x37')]);_0x3fd194['attributes']=_[_0xf9ec('0x3a')](_0x3f4a94[_0xf9ec('0x35')],qs['fields'](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x49')]));_0x3fd194['attributes']=_0x3fd194[_0xf9ec('0x39')][_0xf9ec('0x3b')]?_0x3fd194[_0xf9ec('0x39')]:_0x3f4a94[_0xf9ec('0x35')];_0x3fd194[_0xf9ec('0x3e')]=qs[_0xf9ec('0x3f')](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x3f')]);_0x3fd194[_0xf9ec('0x40')]=qs[_0xf9ec('0x38')](_['pick'](_0x4a81b5['query'],_0x3f4a94[_0xf9ec('0x38')]));if(_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x42')]){_0x3fd194[_0xf9ec('0x40')]=_[_0xf9ec('0x43')](_0x3fd194[_0xf9ec('0x40')],{'$or':_[_0xf9ec('0x2f')](_0x3fd194['attributes'],function(_0x12752d){var _0x5c32e4={};_0x5c32e4[_0x12752d]={'$like':'%'+_0x4a81b5['query'][_0xf9ec('0x42')]+'%'};return _0x5c32e4;})});}_0x3fd194=_[_0xf9ec('0x43')]({},_0x3fd194,_0x4a81b5['options']);return _0x1d545b[_0xf9ec('0x53')](_0x3fd194);}})[_0xf9ec('0x2a')](function(_0x512d9d){if(_0x512d9d){_0x4e328a=_0x512d9d[_0xf9ec('0x3b')];if(!_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x3c')](_0xf9ec('0x3d'))){_0x3fd194[_0xf9ec('0x21')]=qs[_0xf9ec('0x21')](_0x4a81b5[_0xf9ec('0x37')][_0xf9ec('0x21')]);_0x3fd194['offset']=qs[_0xf9ec('0x1f')](_0x4a81b5['query'][_0xf9ec('0x1f')]);}return _0x1d545b[_0xf9ec('0x53')](_0x3fd194);}})[_0xf9ec('0x2a')](function(_0x1601e8){if(_0x1601e8){return _0x1601e8?{'count':_0x4e328a,'rows':_0x1601e8}:null;}})['then'](respondWithResult(_0x4ed127,null))[_0xf9ec('0x4c')](handleError(_0x4ed127,null));};exports['setTags']=function(_0x19ac86,_0x864057,_0x4d65ea){if(_0x19ac86[_0xf9ec('0x4d')]['id']){delete _0x19ac86[_0xf9ec('0x4d')]['id'];}return db['ZendeskConfiguration'][_0xf9ec('0x4f')]({'where':{'id':_0x19ac86[_0xf9ec('0x48')]['id']}})[_0xf9ec('0x2a')](handleEntityNotFound(_0x864057,null))[_0xf9ec('0x2a')](function(_0x570f04){if(_0x570f04){return _0x570f04[_0xf9ec('0x54')](_0x19ac86[_0xf9ec('0x4d')][_0xf9ec('0x55')]||[]);}return null;})[_0xf9ec('0x2a')](respondWithResult(_0x864057,null))[_0xf9ec('0x4c')](handleError(_0x864057,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 19a7870..9c8945f 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 _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x0972,0x64));var _0x2097=function(_0x5c0368,_0x2cf974){_0x5c0368=_0x5c0368-0x0;var _0x2155e9=_0x0972[_0x5c0368];return _0x2155e9;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2097('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2032=['int_zendesk_configurations','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x374afb,_0x390b4a){var _0x65888c=function(_0x323f80){while(--_0x323f80){_0x374afb['push'](_0x374afb['shift']());}};_0x65888c(++_0x390b4a);}(_0x2032,0xd9));var _0x2203=function(_0x3edb1c,_0x290fa1){_0x3edb1c=_0x3edb1c-0x0;var _0x298453=_0x2032[_0x3edb1c];return _0x298453;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var logger=require(_0x2203('0x1'))(_0x2203('0x2'));var moment=require('moment');var BPromise=require(_0x2203('0x3'));var rp=require(_0x2203('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var attributes=require(_0x2203('0x7'));module[_0x2203('0x8')]=function(_0x3f7ba1,_0x13367a){return _0x3f7ba1[_0x2203('0x9')](_0x2203('0xa'),attributes,{'tableName':_0x2203('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index c014afe..293f6bc 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 _0x9d1c=['client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cbe26,_0x3c27c8){var _0x1a7a4f=function(_0x19d27d){while(--_0x19d27d){_0x4cbe26['push'](_0x4cbe26['shift']());}};_0x1a7a4f(++_0x3c27c8);}(_0x9d1c,0x109));var _0xc9d1=function(_0x3807bf,_0x1c44e8){_0x3807bf=_0x3807bf-0x0;var _0xcf9a97=_0x9d1c[_0x3807bf];return _0xcf9a97;};'use strict';var _=require(_0xc9d1('0x0'));var util=require('util');var moment=require(_0xc9d1('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9d1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9d1('0x3'));var logger=require(_0xc9d1('0x4'))(_0xc9d1('0x5'));var config=require(_0xc9d1('0x6'));var jayson=require(_0xc9d1('0x7'));var client=jayson[_0xc9d1('0x8')][_0xc9d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c7ab5,_0x54f23f,_0x5b1fac){return new BPromise(function(_0xa9fed9,_0x3a0602){return client[_0xc9d1('0xa')](_0x2c7ab5,_0x5b1fac)[_0xc9d1('0xb')](function(_0x2a672f){logger['info'](_0xc9d1('0xc'),_0x54f23f,_0xc9d1('0xd'));logger[_0xc9d1('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54f23f,'request\x20sent',JSON[_0xc9d1('0xf')](_0x2a672f));if(_0x2a672f['error']){if(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x11')]===0x1f4){logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);return _0x3a0602(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);}logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);return _0xa9fed9(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);}else{logger[_0xc9d1('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54f23f,_0xc9d1('0xd'));_0xa9fed9(_0x2a672f['result']['message']);}})[_0xc9d1('0x14')](function(_0x1e89b4){logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x1e89b4);_0x3a0602(_0x1e89b4);});});} \ No newline at end of file +var _0xbc18=['message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x7c2965,_0x508b8c){var _0xfbcfb1=function(_0x573621){while(--_0x573621){_0x7c2965['push'](_0x7c2965['shift']());}};_0xfbcfb1(++_0x508b8c);}(_0xbc18,0x86));var _0x8bc1=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xbc18[_0x3dc538];return _0x72c2fd;};'use strict';var _=require('lodash');var util=require(_0x8bc1('0x0'));var moment=require('moment');var BPromise=require(_0x8bc1('0x1'));var rs=require(_0x8bc1('0x2'));var fs=require('fs');var Redis=require(_0x8bc1('0x3'));var db=require(_0x8bc1('0x4'))['db'];var utils=require(_0x8bc1('0x5'));var logger=require(_0x8bc1('0x6'))(_0x8bc1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8bc1('0x8')][_0x8bc1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3923,_0x5a112b,_0x549f01){return new BPromise(function(_0x2e4dce,_0x3067fd){return client[_0x8bc1('0xa')](_0xf3923,_0x549f01)[_0x8bc1('0xb')](function(_0x2705cb){logger[_0x8bc1('0xc')](_0x8bc1('0xd'),_0x5a112b,_0x8bc1('0xe'));logger[_0x8bc1('0xf')](_0x8bc1('0x10'),_0x5a112b,'request\x20sent',JSON[_0x8bc1('0x11')](_0x2705cb));if(_0x2705cb[_0x8bc1('0x12')]){if(_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x13')]===0x1f4){logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x2705cb[_0x8bc1('0x12')]['message']);return _0x3067fd(_0x2705cb[_0x8bc1('0x12')]['message']);}logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x14')]);return _0x2e4dce(_0x2705cb[_0x8bc1('0x12')][_0x8bc1('0x14')]);}else{logger[_0x8bc1('0xc')](_0x8bc1('0xd'),_0x5a112b,'request\x20sent');_0x2e4dce(_0x2705cb['result'][_0x8bc1('0x14')]);}})[_0x8bc1('0x15')](function(_0x249088){logger[_0x8bc1('0x12')](_0x8bc1('0xd'),_0x5a112b,_0x249088);_0x3067fd(_0x249088);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ecadaac..be385f5 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 _0xdbb2=['show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id'];(function(_0x3d20d0,_0x4d679f){var _0x3d32fc=function(_0x3a8774){while(--_0x3a8774){_0x3d20d0['push'](_0x3d20d0['shift']());}};_0x3d32fc(++_0x4d679f);}(_0xdbb2,0x125));var _0x2dbb=function(_0x6aaa69,_0x4457b5){_0x6aaa69=_0x6aaa69-0x0;var _0x25359f=_0xdbb2[_0x6aaa69];return _0x25359f;};'use strict';var multer=require(_0x2dbb('0x0'));var util=require(_0x2dbb('0x1'));var path=require(_0x2dbb('0x2'));var timeout=require(_0x2dbb('0x3'));var express=require(_0x2dbb('0x4'));var router=express[_0x2dbb('0x5')]();var fs_extra=require(_0x2dbb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2dbb('0x7'));var config=require(_0x2dbb('0x8'));var controller=require(_0x2dbb('0x9'));router[_0x2dbb('0xa')]('/',auth[_0x2dbb('0xb')](),controller['index']);router[_0x2dbb('0xa')](_0x2dbb('0xc'),auth[_0x2dbb('0xb')](),controller[_0x2dbb('0xd')]);router[_0x2dbb('0xe')]('/',auth[_0x2dbb('0xb')](),controller['create']);router[_0x2dbb('0xf')](_0x2dbb('0xc'),auth[_0x2dbb('0xb')](),controller[_0x2dbb('0x10')]);router['delete'](_0x2dbb('0xc'),auth[_0x2dbb('0xb')](),controller[_0x2dbb('0x11')]);module['exports']=router; \ No newline at end of file +var _0x11d5=['express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','path'];(function(_0x11536c,_0x5dd752){var _0x14cb23=function(_0x171a9c){while(--_0x171a9c){_0x11536c['push'](_0x11536c['shift']());}};_0x14cb23(++_0x5dd752);}(_0x11d5,0xde));var _0x511d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x11d5[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x511d('0x0'));var util=require('util');var path=require(_0x511d('0x1'));var timeout=require('connect-timeout');var express=require(_0x511d('0x2'));var router=express[_0x511d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x511d('0x4'));var interaction=require(_0x511d('0x5'));var config=require('../../config/environment');var controller=require(_0x511d('0x6'));router[_0x511d('0x7')]('/',auth[_0x511d('0x8')](),controller['index']);router[_0x511d('0x7')](_0x511d('0x9'),auth[_0x511d('0x8')](),controller[_0x511d('0xa')]);router[_0x511d('0xb')]('/',auth[_0x511d('0x8')](),controller['create']);router['put'](_0x511d('0x9'),auth[_0x511d('0x8')](),controller[_0x511d('0xc')]);router[_0x511d('0xd')]('/:id',auth[_0x511d('0x8')](),controller[_0x511d('0xe')]);module[_0x511d('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 79fab29..85037b2 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 _0x2834=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x50d435,_0x21f980){var _0x3267ae=function(_0x56e018){while(--_0x56e018){_0x50d435['push'](_0x50d435['shift']());}};_0x3267ae(++_0x21f980);}(_0x2834,0xf8));var _0x4283=function(_0x45a194,_0x7c0bf7){_0x45a194=_0x45a194-0x0;var _0x2d2220=_0x2834[_0x45a194];return _0x2d2220;};'use strict';var Sequelize=require('sequelize');module[_0x4283('0x0')]={'type':{'type':Sequelize[_0x4283('0x1')](_0x4283('0x2'),_0x4283('0x3'),_0x4283('0x4'),_0x4283('0x5'),'picklist'),'defaultValue':_0x4283('0x2')},'content':{'type':Sequelize[_0x4283('0x6')]},'key':{'type':Sequelize[_0x4283('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x4283('0x3'),_0x4283('0x4'))},'keyContent':{'type':Sequelize[_0x4283('0x6')]},'idField':{'type':Sequelize[_0x4283('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4283('0x6')]}}; \ No newline at end of file +var _0x6700=['variable','keyValue','picklist','string','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x6700,0x167));var _0x0670=function(_0x3ecb48,_0x5631bf){_0x3ecb48=_0x3ecb48-0x0;var _0x2f14fa=_0x6700[_0x3ecb48];return _0x2f14fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x0670('0x0')]('string',_0x0670('0x1'),'customVariable',_0x0670('0x2'),_0x0670('0x3')),'defaultValue':_0x0670('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0670('0x5')]},'keyType':{'type':Sequelize[_0x0670('0x0')](_0x0670('0x4'),_0x0670('0x1'),_0x0670('0x6'))},'keyContent':{'type':Sequelize[_0x0670('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0670('0x5')]},'customField':{'type':Sequelize[_0x0670('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0670('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 22213dd..e6cfd57 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 _0x101a=['request-promise','moment','bluebird','mustache','util','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/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','create','body','find','zip-dir','fast-json-patch'];(function(_0x29c80b,_0x473d30){var _0x4640b4=function(_0x281a22){while(--_0x281a22){_0x29c80b['push'](_0x29c80b['shift']());}};_0x4640b4(++_0x473d30);}(_0x101a,0x11a));var _0xa101=function(_0x14c240,_0x33f160){_0x14c240=_0x14c240-0x0;var _0xe1e4b5=_0x101a[_0x14c240];return _0xe1e4b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa101('0x0'));var jsonpatch=require(_0xa101('0x1'));var rp=require(_0xa101('0x2'));var moment=require(_0xa101('0x3'));var BPromise=require(_0xa101('0x4'));var Mustache=require(_0xa101('0x5'));var util=require(_0xa101('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa101('0x7'));var ejs=require(_0xa101('0x8'));var fs=require('fs');var fs_extra=require(_0xa101('0x9'));var _=require('lodash');var squel=require(_0xa101('0xa'));var crypto=require('crypto');var jsforce=require(_0xa101('0xb'));var deskjs=require(_0xa101('0xc'));var toCsv=require(_0xa101('0x7'));var querystring=require(_0xa101('0xd'));var Papa=require(_0xa101('0xe'));var Redis=require(_0xa101('0xf'));var authService=require(_0xa101('0x10'));var qs=require(_0xa101('0x11'));var as=require(_0xa101('0x12'));var hardwareService=require(_0xa101('0x13'));var logger=require(_0xa101('0x14'))(_0xa101('0x15'));var utils=require(_0xa101('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa101('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aac38,_0x261070){_0x261070=_0x261070||0xcc;return function(_0x35fddf){if(_0x35fddf){return _0x5aac38[_0xa101('0x18')](_0x261070);}return _0x5aac38[_0xa101('0x19')](_0x261070)['end']();};}function respondWithResult(_0x1bd9db,_0x5a16a0){_0x5a16a0=_0x5a16a0||0xc8;return function(_0x25f5de){if(_0x25f5de){return _0x1bd9db[_0xa101('0x19')](_0x5a16a0)[_0xa101('0x1a')](_0x25f5de);}};}function respondWithFilteredResult(_0x4c49b5,_0x4c9074){return function(_0x38575e){if(_0x38575e){var _0x4af614=typeof _0x4c9074[_0xa101('0x1b')]===_0xa101('0x1c')&&typeof _0x4c9074[_0xa101('0x1d')]==='undefined';var _0x5521a1=_0x38575e[_0xa101('0x1e')];var _0x339161=_0x4af614?0x0:_0x4c9074[_0xa101('0x1b')];var _0x40d98a=_0x4af614?_0x38575e[_0xa101('0x1e')]:_0x4c9074[_0xa101('0x1b')]+_0x4c9074[_0xa101('0x1d')];var _0x281838;if(_0x40d98a>=_0x5521a1){_0x40d98a=_0x5521a1;_0x281838=0xc8;}else{_0x281838=0xce;}_0x4c49b5[_0xa101('0x19')](_0x281838);return _0x4c49b5['set']('Content-Range',_0x339161+'-'+_0x40d98a+'/'+_0x5521a1)['json'](_0x38575e);}return null;};}function patchUpdates(_0x39b2d9){return function(_0x13858e){try{jsonpatch['apply'](_0x13858e,_0x39b2d9,!![]);}catch(_0x3168b6){return BPromise['reject'](_0x3168b6);}return _0x13858e['save']();};}function saveUpdates(_0x2da999,_0x47b684){return function(_0xa3ec1d){if(_0xa3ec1d){return _0xa3ec1d[_0xa101('0x1f')](_0x2da999)['then'](function(_0x41e6d8){return _0x41e6d8;});}return null;};}function removeEntity(_0x541562,_0xa065d4){return function(_0x198a50){if(_0x198a50){return _0x198a50[_0xa101('0x20')]()[_0xa101('0x21')](function(){_0x541562[_0xa101('0x19')](0xcc)[_0xa101('0x22')]();});}};}function handleEntityNotFound(_0x37432d,_0x4032fd){return function(_0x16680e){if(!_0x16680e){_0x37432d[_0xa101('0x18')](0x194);}return _0x16680e;};}function handleError(_0x5c24ea,_0x34a54b){_0x34a54b=_0x34a54b||0x1f4;return function(_0x1f6e9d){logger['error'](_0x1f6e9d['stack']);if(_0x1f6e9d['name']){delete _0x1f6e9d[_0xa101('0x23')];}_0x5c24ea[_0xa101('0x19')](_0x34a54b)[_0xa101('0x24')](_0x1f6e9d);};}exports[_0xa101('0x25')]=function(_0x1ecec4,_0x21941a){var _0x5537c4={},_0x156662={},_0x3cc385={'count':0x0,'rows':[]};var _0x1d2a1d=_[_0xa101('0x26')](db['ZendeskField'][_0xa101('0x27')],function(_0xb6bc07){return{'name':_0xb6bc07[_0xa101('0x28')],'type':_0xb6bc07[_0xa101('0x29')][_0xa101('0x2a')]};});_0x156662['model']=_[_0xa101('0x26')](_0x1d2a1d,_0xa101('0x23'));_0x156662[_0xa101('0x2b')]=_[_0xa101('0x2c')](_0x1ecec4[_0xa101('0x2b')]);_0x156662[_0xa101('0x2d')]=_[_0xa101('0x2e')](_0x156662[_0xa101('0x2f')],_0x156662[_0xa101('0x2b')]);_0x5537c4['attributes']=_[_0xa101('0x2e')](_0x156662[_0xa101('0x2f')],qs[_0xa101('0x30')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x30')]));_0x5537c4[_0xa101('0x31')]=_0x5537c4[_0xa101('0x31')][_0xa101('0x32')]?_0x5537c4[_0xa101('0x31')]:_0x156662['model'];if(!_0x1ecec4[_0xa101('0x2b')][_0xa101('0x33')](_0xa101('0x34'))){_0x5537c4[_0xa101('0x1d')]=qs['limit'](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x1d')]);_0x5537c4['offset']=qs[_0xa101('0x1b')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x1b')]);}_0x5537c4[_0xa101('0x35')]=qs[_0xa101('0x36')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x36')]);_0x5537c4[_0xa101('0x37')]=qs[_0xa101('0x2d')](_['pick'](_0x1ecec4[_0xa101('0x2b')],_0x156662['filters']),_0x1d2a1d);if(_0x1ecec4[_0xa101('0x2b')]['filter']){_0x5537c4[_0xa101('0x37')]=_['merge'](_0x5537c4[_0xa101('0x37')],{'$or':_[_0xa101('0x26')](_0x1d2a1d,function(_0x526294){if(_0x526294['type']!==_0xa101('0x38')){var _0xaa04a2={};_0xaa04a2[_0x526294[_0xa101('0x23')]]={'$like':'%'+_0x1ecec4['query'][_0xa101('0x39')]+'%'};return _0xaa04a2;}})});}_0x5537c4=_[_0xa101('0x3a')]({},_0x5537c4,_0x1ecec4[_0xa101('0x3b')]);var _0x91c81b={'where':_0x5537c4[_0xa101('0x37')]};return db[_0xa101('0x3c')][_0xa101('0x1e')](_0x91c81b)['then'](function(_0x470971){_0x3cc385[_0xa101('0x1e')]=_0x470971;if(_0x1ecec4['query'][_0xa101('0x3d')]){_0x5537c4[_0xa101('0x3e')]=[{'all':!![]}];}return db[_0xa101('0x3c')][_0xa101('0x3f')](_0x5537c4);})[_0xa101('0x21')](function(_0x1d7ef1){_0x3cc385[_0xa101('0x40')]=_0x1d7ef1;return _0x3cc385;})[_0xa101('0x21')](respondWithFilteredResult(_0x21941a,_0x5537c4))[_0xa101('0x41')](handleError(_0x21941a,null));};exports[_0xa101('0x42')]=function(_0x28bdee,_0x42b4f5){var _0x35c68e={'raw':!![],'where':{'id':_0x28bdee[_0xa101('0x43')]['id']}},_0x569a79={};_0x569a79[_0xa101('0x2f')]=_[_0xa101('0x2c')](db[_0xa101('0x3c')]['rawAttributes']);_0x569a79['query']=_['keys'](_0x28bdee['query']);_0x569a79[_0xa101('0x2d')]=_[_0xa101('0x2e')](_0x569a79[_0xa101('0x2f')],_0x569a79[_0xa101('0x2b')]);_0x35c68e[_0xa101('0x31')]=_['intersection'](_0x569a79[_0xa101('0x2f')],qs[_0xa101('0x30')](_0x28bdee[_0xa101('0x2b')][_0xa101('0x30')]));_0x35c68e[_0xa101('0x31')]=_0x35c68e[_0xa101('0x31')][_0xa101('0x32')]?_0x35c68e[_0xa101('0x31')]:_0x569a79['model'];if(_0x28bdee[_0xa101('0x2b')]['includeAll']){_0x35c68e[_0xa101('0x3e')]=[{'all':!![]}];}_0x35c68e=_[_0xa101('0x3a')]({},_0x35c68e,_0x28bdee[_0xa101('0x3b')]);return db[_0xa101('0x3c')]['find'](_0x35c68e)[_0xa101('0x21')](handleEntityNotFound(_0x42b4f5,null))[_0xa101('0x21')](respondWithResult(_0x42b4f5,null))[_0xa101('0x41')](handleError(_0x42b4f5,null));};exports[_0xa101('0x44')]=function(_0x42e4a2,_0x5b9ef0){return db[_0xa101('0x3c')][_0xa101('0x44')](_0x42e4a2[_0xa101('0x45')],{})[_0xa101('0x21')](respondWithResult(_0x5b9ef0,0xc9))[_0xa101('0x41')](handleError(_0x5b9ef0,null));};exports[_0xa101('0x1f')]=function(_0x15385f,_0x50fcbb){if(_0x15385f[_0xa101('0x45')]['id']){delete _0x15385f['body']['id'];}return db['ZendeskField'][_0xa101('0x46')]({'where':{'id':_0x15385f[_0xa101('0x43')]['id']}})[_0xa101('0x21')](handleEntityNotFound(_0x50fcbb,null))[_0xa101('0x21')](saveUpdates(_0x15385f[_0xa101('0x45')],null))['then'](respondWithResult(_0x50fcbb,null))[_0xa101('0x41')](handleError(_0x50fcbb,null));};exports[_0xa101('0x20')]=function(_0x319d2d,_0x531efd){return db[_0xa101('0x3c')][_0xa101('0x46')]({'where':{'id':_0x319d2d[_0xa101('0x43')]['id']}})[_0xa101('0x21')](handleEntityNotFound(_0x531efd,null))[_0xa101('0x21')](removeEntity(_0x531efd,null))['catch'](handleError(_0x531efd,null));}; \ No newline at end of file +var _0xfa5d=['limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskField','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','include','catch','show','includeAll','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count'];(function(_0x18c84a,_0x58670b){var _0x1b6f46=function(_0x491d2a){while(--_0x491d2a){_0x18c84a['push'](_0x18c84a['shift']());}};_0x1b6f46(++_0x58670b);}(_0xfa5d,0x152));var _0xdfa5=function(_0x4d8217,_0x43f574){_0x4d8217=_0x4d8217-0x0;var _0x129569=_0xfa5d[_0x4d8217];return _0x129569;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfa5('0x0'));var zipdir=require(_0xdfa5('0x1'));var jsonpatch=require(_0xdfa5('0x2'));var rp=require(_0xdfa5('0x3'));var moment=require(_0xdfa5('0x4'));var BPromise=require(_0xdfa5('0x5'));var Mustache=require(_0xdfa5('0x6'));var util=require(_0xdfa5('0x7'));var path=require(_0xdfa5('0x8'));var sox=require(_0xdfa5('0x9'));var csv=require(_0xdfa5('0xa'));var ejs=require(_0xdfa5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfa5('0xc'));var squel=require(_0xdfa5('0xd'));var crypto=require(_0xdfa5('0xe'));var jsforce=require(_0xdfa5('0xf'));var deskjs=require(_0xdfa5('0x10'));var toCsv=require('to-csv');var querystring=require(_0xdfa5('0x11'));var Papa=require(_0xdfa5('0x12'));var Redis=require(_0xdfa5('0x13'));var authService=require(_0xdfa5('0x14'));var qs=require(_0xdfa5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfa5('0x16'));var logger=require('../../config/logger')(_0xdfa5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfa5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2917e9,_0x4dc7cd){_0x4dc7cd=_0x4dc7cd||0xcc;return function(_0x5cc173){if(_0x5cc173){return _0x2917e9[_0xdfa5('0x19')](_0x4dc7cd);}return _0x2917e9['status'](_0x4dc7cd)[_0xdfa5('0x1a')]();};}function respondWithResult(_0x29d498,_0x1ee4f7){_0x1ee4f7=_0x1ee4f7||0xc8;return function(_0x3ab2fa){if(_0x3ab2fa){return _0x29d498[_0xdfa5('0x1b')](_0x1ee4f7)[_0xdfa5('0x1c')](_0x3ab2fa);}};}function respondWithFilteredResult(_0x30f0ca,_0x49cf70){return function(_0x36b338){if(_0x36b338){var _0x3143b8=typeof _0x49cf70[_0xdfa5('0x1d')]===_0xdfa5('0x1e')&&typeof _0x49cf70['limit']==='undefined';var _0x42c9da=_0x36b338[_0xdfa5('0x1f')];var _0x5b8810=_0x3143b8?0x0:_0x49cf70[_0xdfa5('0x1d')];var _0x1d5c47=_0x3143b8?_0x36b338['count']:_0x49cf70['offset']+_0x49cf70[_0xdfa5('0x20')];var _0x303283;if(_0x1d5c47>=_0x42c9da){_0x1d5c47=_0x42c9da;_0x303283=0xc8;}else{_0x303283=0xce;}_0x30f0ca[_0xdfa5('0x1b')](_0x303283);return _0x30f0ca[_0xdfa5('0x21')](_0xdfa5('0x22'),_0x5b8810+'-'+_0x1d5c47+'/'+_0x42c9da)[_0xdfa5('0x1c')](_0x36b338);}return null;};}function patchUpdates(_0xd67f72){return function(_0x138736){try{jsonpatch[_0xdfa5('0x23')](_0x138736,_0xd67f72,!![]);}catch(_0xc164ea){return BPromise[_0xdfa5('0x24')](_0xc164ea);}return _0x138736[_0xdfa5('0x25')]();};}function saveUpdates(_0x1f6c19,_0x21a441){return function(_0x3cff05){if(_0x3cff05){return _0x3cff05['update'](_0x1f6c19)[_0xdfa5('0x26')](function(_0x244eb5){return _0x244eb5;});}return null;};}function removeEntity(_0x19826a,_0x1b9d6d){return function(_0x4d5b66){if(_0x4d5b66){return _0x4d5b66[_0xdfa5('0x27')]()[_0xdfa5('0x26')](function(){_0x19826a[_0xdfa5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0ca9,_0x1a4873){return function(_0x3ba123){if(!_0x3ba123){_0x4d0ca9[_0xdfa5('0x19')](0x194);}return _0x3ba123;};}function handleError(_0xb41eef,_0x5ca104){_0x5ca104=_0x5ca104||0x1f4;return function(_0xdbb720){logger[_0xdfa5('0x28')](_0xdbb720[_0xdfa5('0x29')]);if(_0xdbb720[_0xdfa5('0x2a')]){delete _0xdbb720[_0xdfa5('0x2a')];}_0xb41eef[_0xdfa5('0x1b')](_0x5ca104)[_0xdfa5('0x2b')](_0xdbb720);};}exports[_0xdfa5('0x2c')]=function(_0x4d49a9,_0x320256){var _0x23429f={},_0x55fdf6={},_0x48e28a={'count':0x0,'rows':[]};var _0x5c6e6e=_[_0xdfa5('0x2d')](db[_0xdfa5('0x2e')]['rawAttributes'],function(_0x54114c){return{'name':_0x54114c[_0xdfa5('0x2f')],'type':_0x54114c['type'][_0xdfa5('0x30')]};});_0x55fdf6[_0xdfa5('0x31')]=_[_0xdfa5('0x2d')](_0x5c6e6e,_0xdfa5('0x2a'));_0x55fdf6['query']=_[_0xdfa5('0x32')](_0x4d49a9[_0xdfa5('0x33')]);_0x55fdf6[_0xdfa5('0x34')]=_[_0xdfa5('0x35')](_0x55fdf6[_0xdfa5('0x31')],_0x55fdf6['query']);_0x23429f[_0xdfa5('0x36')]=_[_0xdfa5('0x35')](_0x55fdf6[_0xdfa5('0x31')],qs[_0xdfa5('0x37')](_0x4d49a9[_0xdfa5('0x33')]['fields']));_0x23429f[_0xdfa5('0x36')]=_0x23429f[_0xdfa5('0x36')][_0xdfa5('0x38')]?_0x23429f[_0xdfa5('0x36')]:_0x55fdf6[_0xdfa5('0x31')];if(!_0x4d49a9[_0xdfa5('0x33')]['hasOwnProperty']('nolimit')){_0x23429f[_0xdfa5('0x20')]=qs[_0xdfa5('0x20')](_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x20')]);_0x23429f[_0xdfa5('0x1d')]=qs[_0xdfa5('0x1d')](_0x4d49a9['query'][_0xdfa5('0x1d')]);}_0x23429f['order']=qs['sort'](_0x4d49a9['query'][_0xdfa5('0x39')]);_0x23429f[_0xdfa5('0x3a')]=qs[_0xdfa5('0x34')](_[_0xdfa5('0x3b')](_0x4d49a9[_0xdfa5('0x33')],_0x55fdf6[_0xdfa5('0x34')]),_0x5c6e6e);if(_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x3c')]){_0x23429f['where']=_[_0xdfa5('0x3d')](_0x23429f[_0xdfa5('0x3a')],{'$or':_[_0xdfa5('0x2d')](_0x5c6e6e,function(_0x51809b){if(_0x51809b[_0xdfa5('0x3e')]!==_0xdfa5('0x3f')){var _0x1c158a={};_0x1c158a[_0x51809b[_0xdfa5('0x2a')]]={'$like':'%'+_0x4d49a9[_0xdfa5('0x33')][_0xdfa5('0x3c')]+'%'};return _0x1c158a;}})});}_0x23429f=_[_0xdfa5('0x3d')]({},_0x23429f,_0x4d49a9[_0xdfa5('0x40')]);var _0x5a754d={'where':_0x23429f[_0xdfa5('0x3a')]};return db[_0xdfa5('0x2e')][_0xdfa5('0x1f')](_0x5a754d)[_0xdfa5('0x26')](function(_0x11a0ee){_0x48e28a[_0xdfa5('0x1f')]=_0x11a0ee;if(_0x4d49a9[_0xdfa5('0x33')]['includeAll']){_0x23429f[_0xdfa5('0x41')]=[{'all':!![]}];}return db[_0xdfa5('0x2e')]['findAll'](_0x23429f);})[_0xdfa5('0x26')](function(_0x265863){_0x48e28a['rows']=_0x265863;return _0x48e28a;})[_0xdfa5('0x26')](respondWithFilteredResult(_0x320256,_0x23429f))[_0xdfa5('0x42')](handleError(_0x320256,null));};exports[_0xdfa5('0x43')]=function(_0x3b00f0,_0x143a30){var _0x229e8d={'raw':!![],'where':{'id':_0x3b00f0['params']['id']}},_0xb1c9bc={};_0xb1c9bc[_0xdfa5('0x31')]=_[_0xdfa5('0x32')](db[_0xdfa5('0x2e')]['rawAttributes']);_0xb1c9bc['query']=_[_0xdfa5('0x32')](_0x3b00f0[_0xdfa5('0x33')]);_0xb1c9bc[_0xdfa5('0x34')]=_[_0xdfa5('0x35')](_0xb1c9bc[_0xdfa5('0x31')],_0xb1c9bc[_0xdfa5('0x33')]);_0x229e8d[_0xdfa5('0x36')]=_[_0xdfa5('0x35')](_0xb1c9bc[_0xdfa5('0x31')],qs[_0xdfa5('0x37')](_0x3b00f0[_0xdfa5('0x33')][_0xdfa5('0x37')]));_0x229e8d[_0xdfa5('0x36')]=_0x229e8d['attributes'][_0xdfa5('0x38')]?_0x229e8d[_0xdfa5('0x36')]:_0xb1c9bc[_0xdfa5('0x31')];if(_0x3b00f0['query'][_0xdfa5('0x44')]){_0x229e8d['include']=[{'all':!![]}];}_0x229e8d=_[_0xdfa5('0x3d')]({},_0x229e8d,_0x3b00f0[_0xdfa5('0x40')]);return db[_0xdfa5('0x2e')][_0xdfa5('0x45')](_0x229e8d)[_0xdfa5('0x26')](handleEntityNotFound(_0x143a30,null))[_0xdfa5('0x26')](respondWithResult(_0x143a30,null))[_0xdfa5('0x42')](handleError(_0x143a30,null));};exports[_0xdfa5('0x46')]=function(_0x2ccee5,_0x41c416){return db['ZendeskField']['create'](_0x2ccee5[_0xdfa5('0x47')],{})[_0xdfa5('0x26')](respondWithResult(_0x41c416,0xc9))[_0xdfa5('0x42')](handleError(_0x41c416,null));};exports[_0xdfa5('0x48')]=function(_0x2d9ea1,_0x43d3b4){if(_0x2d9ea1[_0xdfa5('0x47')]['id']){delete _0x2d9ea1['body']['id'];}return db[_0xdfa5('0x2e')][_0xdfa5('0x45')]({'where':{'id':_0x2d9ea1[_0xdfa5('0x49')]['id']}})[_0xdfa5('0x26')](handleEntityNotFound(_0x43d3b4,null))['then'](saveUpdates(_0x2d9ea1[_0xdfa5('0x47')],null))[_0xdfa5('0x26')](respondWithResult(_0x43d3b4,null))[_0xdfa5('0x42')](handleError(_0x43d3b4,null));};exports['destroy']=function(_0xfc7ef5,_0x4d1b18){return db[_0xdfa5('0x2e')][_0xdfa5('0x45')]({'where':{'id':_0xfc7ef5[_0xdfa5('0x49')]['id']}})[_0xdfa5('0x26')](handleEntityNotFound(_0x4d1b18,null))[_0xdfa5('0x26')](removeEntity(_0x4d1b18,null))[_0xdfa5('0x42')](handleError(_0x4d1b18,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 80098c4..db9d8a2 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 _0xd202=['bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd202,0xce));var _0x2d20=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd202[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var logger=require(_0x2d20('0x2'))(_0x2d20('0x3'));var moment=require('moment');var BPromise=require(_0x2d20('0x4'));var rp=require(_0x2d20('0x5'));var fs=require('fs');var path=require(_0x2d20('0x6'));var rimraf=require('rimraf');var config=require(_0x2d20('0x7'));var attributes=require(_0x2d20('0x8'));module[_0x2d20('0x9')]=function(_0x17ea21,_0x4009d8){return _0x17ea21['define'](_0x2d20('0xa'),attributes,{'tableName':_0x2d20('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2d20('0xc'),_0x2d20('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59b0=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x59b0,0x114));var _0x059b=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0x59b0[_0x4ebdf4];return _0x18d1c1;};'use strict';var _=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var logger=require(_0x059b('0x2'))(_0x059b('0x3'));var moment=require('moment');var BPromise=require(_0x059b('0x4'));var rp=require(_0x059b('0x5'));var fs=require('fs');var path=require(_0x059b('0x6'));var rimraf=require(_0x059b('0x7'));var config=require(_0x059b('0x8'));var attributes=require(_0x059b('0x9'));module['exports']=function(_0x3812cd,_0x122f08){return _0x3812cd['define']('ZendeskField',attributes,{'tableName':_0x059b('0xa'),'paranoid':![],'indexes':[{'name':_0x059b('0xb'),'fields':[_0x059b('0xc'),_0x059b('0xd')],'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 e987eb8..5a79568 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 _0x25c1=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x72e08e,_0x5bc441){var _0x477837=function(_0x58c62b){while(--_0x58c62b){_0x72e08e['push'](_0x72e08e['shift']());}};_0x477837(++_0x5bc441);}(_0x25c1,0x17b));var _0x125c=function(_0x4947f4,_0x4096b8){_0x4947f4=_0x4947f4-0x0;var _0x5972ca=_0x25c1[_0x4947f4];return _0x5972ca;};'use strict';var _=require(_0x125c('0x0'));var util=require('util');var moment=require(_0x125c('0x1'));var BPromise=require(_0x125c('0x2'));var rs=require(_0x125c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x125c('0x4'))['db'];var utils=require(_0x125c('0x5'));var logger=require(_0x125c('0x6'))(_0x125c('0x7'));var config=require(_0x125c('0x8'));var jayson=require(_0x125c('0x9'));var client=jayson[_0x125c('0xa')][_0x125c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eb1f6,_0x6444ff,_0x39724a){return new BPromise(function(_0x5a0e29,_0x33c68f){return client[_0x125c('0xc')](_0x2eb1f6,_0x39724a)[_0x125c('0xd')](function(_0x93829a){logger[_0x125c('0xe')](_0x125c('0xf'),_0x6444ff,_0x125c('0x10'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x6444ff,'request\x20sent',JSON[_0x125c('0x11')](_0x93829a));if(_0x93829a['error']){if(_0x93829a[_0x125c('0x12')][_0x125c('0x13')]===0x1f4){logger[_0x125c('0x12')](_0x125c('0xf'),_0x6444ff,_0x93829a[_0x125c('0x12')][_0x125c('0x14')]);return _0x33c68f(_0x93829a['error'][_0x125c('0x14')]);}logger['error'](_0x125c('0xf'),_0x6444ff,_0x93829a[_0x125c('0x12')][_0x125c('0x14')]);return _0x5a0e29(_0x93829a[_0x125c('0x12')][_0x125c('0x14')]);}else{logger[_0x125c('0xe')](_0x125c('0xf'),_0x6444ff,_0x125c('0x10'));_0x5a0e29(_0x93829a[_0x125c('0x15')][_0x125c('0x14')]);}})[_0x125c('0x16')](function(_0x86be27){logger[_0x125c('0x12')](_0x125c('0xf'),_0x6444ff,_0x86be27);_0x33c68f(_0x86be27);});});} \ No newline at end of file +var _0xa255=['request','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x43ff49,_0x1efbd2){var _0x125785=function(_0x2479d6){while(--_0x2479d6){_0x43ff49['push'](_0x43ff49['shift']());}};_0x125785(++_0x1efbd2);}(_0xa255,0x109));var _0x5a25=function(_0x6fa74c,_0x1ebc8b){_0x6fa74c=_0x6fa74c-0x0;var _0x22d795=_0xa255[_0x6fa74c];return _0x22d795;};'use strict';var _=require('lodash');var util=require(_0x5a25('0x0'));var moment=require(_0x5a25('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a25('0x2'))['db'];var utils=require(_0x5a25('0x3'));var logger=require(_0x5a25('0x4'))(_0x5a25('0x5'));var config=require(_0x5a25('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f68ca,_0x5bc02a,_0x5231e9){return new BPromise(function(_0x171236,_0x304bc6){return client[_0x5a25('0x7')](_0x1f68ca,_0x5231e9)['then'](function(_0x6a0ebe){logger[_0x5a25('0x8')](_0x5a25('0x9'),_0x5bc02a,'request\x20sent');logger[_0x5a25('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x5bc02a,_0x5a25('0xb'),JSON[_0x5a25('0xc')](_0x6a0ebe));if(_0x6a0ebe[_0x5a25('0xd')]){if(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xe')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5bc02a,_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);return _0x304bc6(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);}logger[_0x5a25('0xd')]('ZendeskField,\x20%s,\x20%s',_0x5bc02a,_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);return _0x171236(_0x6a0ebe[_0x5a25('0xd')][_0x5a25('0xf')]);}else{logger['info'](_0x5a25('0x9'),_0x5bc02a,_0x5a25('0xb'));_0x171236(_0x6a0ebe['result'][_0x5a25('0xf')]);}})[_0x5a25('0x10')](function(_0x1022d6){logger[_0x5a25('0xd')](_0x5a25('0x9'),_0x5bc02a,_0x1022d6);_0x304bc6(_0x1022d6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a1163ed..d8d15fc 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 _0x9bc8=['show','/:id/configurations','getConfigurations','post','create','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x9bc8,0x81));var _0x89bc=function(_0x4e6e89,_0x1d8e3d){_0x4e6e89=_0x4e6e89-0x0;var _0x23e4ce=_0x9bc8[_0x4e6e89];return _0x23e4ce;};'use strict';var multer=require(_0x89bc('0x0'));var util=require(_0x89bc('0x1'));var path=require('path');var timeout=require(_0x89bc('0x2'));var express=require('express');var router=express[_0x89bc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x89bc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x89bc('0x5'));var controller=require(_0x89bc('0x6'));router[_0x89bc('0x7')]('/',auth[_0x89bc('0x8')](),controller[_0x89bc('0x9')]);router[_0x89bc('0x7')](_0x89bc('0xa'),auth[_0x89bc('0x8')](),controller[_0x89bc('0xb')]);router[_0x89bc('0x7')](_0x89bc('0xc'),auth[_0x89bc('0x8')](),controller[_0x89bc('0xd')]);router[_0x89bc('0x7')]('/:id/fields',auth[_0x89bc('0x8')](),controller['getFields']);router[_0x89bc('0xe')]('/',auth['isAuthenticated'](),controller[_0x89bc('0xf')]);router[_0x89bc('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x89bc('0x10')]);router['put'](_0x89bc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x89bc('0x11')](_0x89bc('0xa'),auth[_0x89bc('0x8')](),controller[_0x89bc('0x12')]);module[_0x89bc('0x13')]=router; \ No newline at end of file +var _0x0ef7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x34eebc,_0x3b84f9){var _0x2cda7a=function(_0xedc345){while(--_0xedc345){_0x34eebc['push'](_0x34eebc['shift']());}};_0x2cda7a(++_0x3b84f9);}(_0x0ef7,0x115));var _0x70ef=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x0ef7[_0x26da89];return _0xc95b7b;};'use strict';var multer=require(_0x70ef('0x0'));var util=require(_0x70ef('0x1'));var path=require(_0x70ef('0x2'));var timeout=require('connect-timeout');var express=require(_0x70ef('0x3'));var router=express[_0x70ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70ef('0x5'));var interaction=require(_0x70ef('0x6'));var config=require('../../config/environment');var controller=require(_0x70ef('0x7'));router['get']('/',auth[_0x70ef('0x8')](),controller['index']);router[_0x70ef('0x9')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller['show']);router['get'](_0x70ef('0xb'),auth[_0x70ef('0x8')](),controller[_0x70ef('0xc')]);router[_0x70ef('0x9')](_0x70ef('0xd'),auth[_0x70ef('0x8')](),controller[_0x70ef('0xe')]);router[_0x70ef('0xf')]('/',auth[_0x70ef('0x8')](),controller[_0x70ef('0x10')]);router['post']('/:id/configurations',auth[_0x70ef('0x8')](),controller[_0x70ef('0x11')]);router[_0x70ef('0x12')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller[_0x70ef('0x13')]);router[_0x70ef('0x14')](_0x70ef('0xa'),auth[_0x70ef('0x8')](),controller[_0x70ef('0x15')]);module[_0x70ef('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e5982e3..97ac50a 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14d=['exports','STRING','sequelize'];(function(_0xeda482,_0x107734){var _0x129f50=function(_0x402cb0){while(--_0x402cb0){_0xeda482['push'](_0xeda482['shift']());}};_0x129f50(++_0x107734);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING'];(function(_0x5c30cf,_0x4fdde2){var _0x2e0e21=function(_0x3d4e9e){while(--_0x3d4e9e){_0x5c30cf['push'](_0x5c30cf['shift']());}};_0x2e0e21(++_0x4fdde2);}(_0x9f62,0x154));var _0x29f6=function(_0x220e40,_0x34bddc){_0x220e40=_0x220e40-0x0;var _0x5cc1f3=_0x9f62[_0x220e40];return _0x5cc1f3;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 5a2c6af..adcaccd 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 _0xe157=['save','update','destroy','end','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','getConfigurations','findOne','params','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','code','host','serverUrl','slice','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','test','statusCode','getFields','stringify','zip-dir','fast-json-patch','request-promise','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xe157,0xd8));var _0x7e15=function(_0x461c6c,_0xf3e8d2){_0x461c6c=_0x461c6c-0x0;var _0x4d0d7a=_0xe157[_0x461c6c];return _0x4d0d7a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7e15('0x0'));var jsonpatch=require(_0x7e15('0x1'));var rp=require(_0x7e15('0x2'));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(_0x7e15('0x3'));var ejs=require(_0x7e15('0x4'));var fs=require('fs');var fs_extra=require(_0x7e15('0x5'));var _=require('lodash');var squel=require(_0x7e15('0x6'));var crypto=require(_0x7e15('0x7'));var jsforce=require(_0x7e15('0x8'));var deskjs=require(_0x7e15('0x9'));var toCsv=require(_0x7e15('0x3'));var querystring=require('querystring');var Papa=require(_0x7e15('0xa'));var Redis=require(_0x7e15('0xb'));var authService=require(_0x7e15('0xc'));var qs=require(_0x7e15('0xd'));var as=require(_0x7e15('0xe'));var hardwareService=require(_0x7e15('0xf'));var logger=require(_0x7e15('0x10'))(_0x7e15('0x11'));var utils=require(_0x7e15('0x12'));var config=require(_0x7e15('0x13'));var licenseUtil=require(_0x7e15('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7e15('0x15'));function respondWithStatusCode(_0x59a080,_0x387ee4){_0x387ee4=_0x387ee4||0xcc;return function(_0x13b9fc){if(_0x13b9fc){return _0x59a080[_0x7e15('0x16')](_0x387ee4);}return _0x59a080['status'](_0x387ee4)['end']();};}function respondWithResult(_0x1c07e7,_0x217027){_0x217027=_0x217027||0xc8;return function(_0x1a3099){if(_0x1a3099){return _0x1c07e7[_0x7e15('0x17')](_0x217027)[_0x7e15('0x18')](_0x1a3099);}};}function respondWithFilteredResult(_0x3ca814,_0x54ed93){return function(_0x2ff13c){if(_0x2ff13c){var _0xfd48ca=typeof _0x54ed93[_0x7e15('0x19')]===_0x7e15('0x1a')&&typeof _0x54ed93[_0x7e15('0x1b')]==='undefined';var _0x12e9c6=_0x2ff13c[_0x7e15('0x1c')];var _0x25090a=_0xfd48ca?0x0:_0x54ed93[_0x7e15('0x19')];var _0xe36240=_0xfd48ca?_0x2ff13c[_0x7e15('0x1c')]:_0x54ed93[_0x7e15('0x19')]+_0x54ed93[_0x7e15('0x1b')];var _0x176405;if(_0xe36240>=_0x12e9c6){_0xe36240=_0x12e9c6;_0x176405=0xc8;}else{_0x176405=0xce;}_0x3ca814[_0x7e15('0x17')](_0x176405);return _0x3ca814['set'](_0x7e15('0x1d'),_0x25090a+'-'+_0xe36240+'/'+_0x12e9c6)[_0x7e15('0x18')](_0x2ff13c);}return null;};}function patchUpdates(_0x24c721){return function(_0x4a071b){try{jsonpatch[_0x7e15('0x1e')](_0x4a071b,_0x24c721,!![]);}catch(_0x4ef8c1){return BPromise[_0x7e15('0x1f')](_0x4ef8c1);}return _0x4a071b[_0x7e15('0x20')]();};}function saveUpdates(_0x13319a,_0x6b7e0a){return function(_0x1a7f25){if(_0x1a7f25){return _0x1a7f25[_0x7e15('0x21')](_0x13319a)['then'](function(_0xa52664){return _0xa52664;});}return null;};}function removeEntity(_0xcece3f,_0x50c3ed){return function(_0x5be565){if(_0x5be565){return _0x5be565[_0x7e15('0x22')]()['then'](function(){_0xcece3f['status'](0xcc)[_0x7e15('0x23')]();});}};}function handleEntityNotFound(_0x14f0fd,_0x3e9db0){return function(_0x3a1e77){if(!_0x3a1e77){_0x14f0fd[_0x7e15('0x16')](0x194);}return _0x3a1e77;};}function handleError(_0x576a8c,_0x44d0f9){_0x44d0f9=_0x44d0f9||0x1f4;return function(_0x1be782){logger[_0x7e15('0x24')](_0x1be782[_0x7e15('0x25')]);if(_0x1be782[_0x7e15('0x26')]){delete _0x1be782['name'];}_0x576a8c[_0x7e15('0x17')](_0x44d0f9)[_0x7e15('0x27')](_0x1be782);};}exports[_0x7e15('0x28')]=function(_0x41b8c0,_0x2ee85f){var _0x25d55f={},_0x48a76c={},_0x4c5813={'count':0x0,'rows':[]};var _0x4aa3df=_[_0x7e15('0x29')](db[_0x7e15('0x2a')]['rawAttributes'],function(_0x588c83){return{'name':_0x588c83[_0x7e15('0x2b')],'type':_0x588c83[_0x7e15('0x2c')][_0x7e15('0x2d')]};});_0x48a76c['model']=_[_0x7e15('0x29')](_0x4aa3df,'name');_0x48a76c[_0x7e15('0x2e')]=_[_0x7e15('0x2f')](_0x41b8c0[_0x7e15('0x2e')]);_0x48a76c[_0x7e15('0x30')]=_[_0x7e15('0x31')](_0x48a76c[_0x7e15('0x32')],_0x48a76c[_0x7e15('0x2e')]);_0x25d55f[_0x7e15('0x33')]=_[_0x7e15('0x31')](_0x48a76c[_0x7e15('0x32')],qs[_0x7e15('0x34')](_0x41b8c0[_0x7e15('0x2e')]['fields']));_0x25d55f[_0x7e15('0x33')]=_0x25d55f[_0x7e15('0x33')][_0x7e15('0x35')]?_0x25d55f['attributes']:_0x48a76c[_0x7e15('0x32')];if(!_0x41b8c0[_0x7e15('0x2e')][_0x7e15('0x36')](_0x7e15('0x37'))){_0x25d55f['limit']=qs[_0x7e15('0x1b')](_0x41b8c0['query']['limit']);_0x25d55f[_0x7e15('0x19')]=qs['offset'](_0x41b8c0[_0x7e15('0x2e')]['offset']);}_0x25d55f[_0x7e15('0x38')]=qs['sort'](_0x41b8c0[_0x7e15('0x2e')][_0x7e15('0x39')]);_0x25d55f[_0x7e15('0x3a')]=qs[_0x7e15('0x30')](_[_0x7e15('0x3b')](_0x41b8c0['query'],_0x48a76c['filters']),_0x4aa3df);if(_0x41b8c0[_0x7e15('0x2e')][_0x7e15('0x3c')]){_0x25d55f[_0x7e15('0x3a')]=_[_0x7e15('0x3d')](_0x25d55f[_0x7e15('0x3a')],{'$or':_[_0x7e15('0x29')](_0x4aa3df,function(_0x598542){if(_0x598542[_0x7e15('0x2c')]!==_0x7e15('0x3e')){var _0x3457ec={};_0x3457ec[_0x598542[_0x7e15('0x26')]]={'$like':'%'+_0x41b8c0[_0x7e15('0x2e')]['filter']+'%'};return _0x3457ec;}})});}_0x25d55f=_[_0x7e15('0x3d')]({},_0x25d55f,_0x41b8c0[_0x7e15('0x3f')]);var _0x4a21f4={'where':_0x25d55f[_0x7e15('0x3a')]};return db[_0x7e15('0x2a')]['count'](_0x4a21f4)[_0x7e15('0x40')](function(_0x32bf4b){_0x4c5813[_0x7e15('0x1c')]=_0x32bf4b;if(_0x41b8c0[_0x7e15('0x2e')][_0x7e15('0x41')]){_0x25d55f[_0x7e15('0x42')]=[{'all':!![]}];}return db[_0x7e15('0x2a')][_0x7e15('0x43')](_0x25d55f);})[_0x7e15('0x40')](function(_0x1d3309){_0x4c5813[_0x7e15('0x44')]=_0x1d3309;return _0x4c5813;})[_0x7e15('0x40')](respondWithFilteredResult(_0x2ee85f,_0x25d55f))[_0x7e15('0x45')](handleError(_0x2ee85f,null));};exports['show']=function(_0x28f032,_0x1494fa){var _0x294dd6={'raw':![],'where':{'id':_0x28f032['params']['id']}},_0x56faaf={};_0x56faaf[_0x7e15('0x32')]=_[_0x7e15('0x2f')](db['ZohoAccount'][_0x7e15('0x46')]);_0x56faaf[_0x7e15('0x2e')]=_[_0x7e15('0x2f')](_0x28f032[_0x7e15('0x2e')]);_0x56faaf[_0x7e15('0x30')]=_[_0x7e15('0x31')](_0x56faaf[_0x7e15('0x32')],_0x56faaf['query']);_0x294dd6[_0x7e15('0x33')]=_[_0x7e15('0x31')](_0x56faaf[_0x7e15('0x32')],qs[_0x7e15('0x34')](_0x28f032[_0x7e15('0x2e')][_0x7e15('0x34')]));_0x294dd6[_0x7e15('0x33')]=_0x294dd6[_0x7e15('0x33')][_0x7e15('0x35')]?_0x294dd6['attributes']:_0x56faaf['model'];if(_0x28f032[_0x7e15('0x2e')][_0x7e15('0x41')]){_0x294dd6[_0x7e15('0x42')]=[{'all':!![]}];}_0x294dd6=_[_0x7e15('0x3d')]({},_0x294dd6,_0x28f032[_0x7e15('0x3f')]);return db['ZohoAccount'][_0x7e15('0x47')](_0x294dd6)[_0x7e15('0x40')](handleEntityNotFound(_0x1494fa,null))[_0x7e15('0x40')](respondWithResult(_0x1494fa,null))[_0x7e15('0x45')](handleError(_0x1494fa,null));};exports[_0x7e15('0x48')]=function(_0x168ecc,_0x532fd7){return db[_0x7e15('0x2a')][_0x7e15('0x48')](_0x168ecc['body'],{})[_0x7e15('0x40')](respondWithResult(_0x532fd7,0xc9))['catch'](handleError(_0x532fd7,null));};exports[_0x7e15('0x21')]=function(_0x3f398b,_0x23b4d2){if(_0x3f398b['body']['id']){delete _0x3f398b['body']['id'];}return db[_0x7e15('0x2a')][_0x7e15('0x47')]({'where':{'id':_0x3f398b['params']['id']}})[_0x7e15('0x40')](handleEntityNotFound(_0x23b4d2,null))[_0x7e15('0x40')](saveUpdates(_0x3f398b[_0x7e15('0x49')],null))['then'](respondWithResult(_0x23b4d2,null))[_0x7e15('0x45')](handleError(_0x23b4d2,null));};exports[_0x7e15('0x22')]=function(_0x458f07,_0xc6ab79){return db[_0x7e15('0x2a')]['find']({'where':{'id':_0x458f07['params']['id']}})[_0x7e15('0x40')](handleEntityNotFound(_0xc6ab79,null))[_0x7e15('0x40')](removeEntity(_0xc6ab79,null))['catch'](handleError(_0xc6ab79,null));};exports[_0x7e15('0x4a')]=function(_0x5287a8,_0x54582e,_0x44f37d){var _0x512e12={};var _0x2ab93d={};var _0x48f27c;var _0x383fbb;return db['ZohoAccount'][_0x7e15('0x4b')]({'where':{'id':_0x5287a8[_0x7e15('0x4c')]['id']}})[_0x7e15('0x40')](handleEntityNotFound(_0x54582e,null))[_0x7e15('0x40')](function(_0x262021){if(_0x262021){_0x48f27c=_0x262021;_0x2ab93d[_0x7e15('0x32')]=_[_0x7e15('0x2f')](db[_0x7e15('0x4d')]['rawAttributes']);_0x2ab93d[_0x7e15('0x2e')]=_['keys'](_0x5287a8[_0x7e15('0x2e')]);_0x2ab93d[_0x7e15('0x30')]=_['intersection'](_0x2ab93d[_0x7e15('0x32')],_0x2ab93d[_0x7e15('0x2e')]);_0x512e12[_0x7e15('0x33')]=_[_0x7e15('0x31')](_0x2ab93d['model'],qs['fields'](_0x5287a8[_0x7e15('0x2e')][_0x7e15('0x34')]));_0x512e12[_0x7e15('0x33')]=_0x512e12[_0x7e15('0x33')][_0x7e15('0x35')]?_0x512e12[_0x7e15('0x33')]:_0x2ab93d['model'];_0x512e12[_0x7e15('0x38')]=qs[_0x7e15('0x39')](_0x5287a8[_0x7e15('0x2e')]['sort']);_0x512e12['where']=qs[_0x7e15('0x30')](_[_0x7e15('0x3b')](_0x5287a8[_0x7e15('0x2e')],_0x2ab93d[_0x7e15('0x30')]));if(_0x5287a8['query'][_0x7e15('0x3c')]){_0x512e12['where']=_[_0x7e15('0x3d')](_0x512e12[_0x7e15('0x3a')],{'$or':_[_0x7e15('0x29')](_0x512e12[_0x7e15('0x33')],function(_0x2f636c){var _0x197c45={};_0x197c45[_0x2f636c]={'$like':'%'+_0x5287a8['query'][_0x7e15('0x3c')]+'%'};return _0x197c45;})});}_0x512e12=_[_0x7e15('0x3d')]({},_0x512e12,_0x5287a8[_0x7e15('0x3f')]);return _0x48f27c['getConfigurations'](_0x512e12);}})[_0x7e15('0x40')](function(_0x295dc6){if(_0x295dc6){_0x383fbb=_0x295dc6[_0x7e15('0x35')];if(!_0x5287a8['query']['hasOwnProperty'](_0x7e15('0x37'))){_0x512e12[_0x7e15('0x1b')]=qs[_0x7e15('0x1b')](_0x5287a8[_0x7e15('0x2e')]['limit']);_0x512e12[_0x7e15('0x19')]=qs['offset'](_0x5287a8[_0x7e15('0x2e')][_0x7e15('0x19')]);}return _0x48f27c['getConfigurations'](_0x512e12);}})[_0x7e15('0x40')](function(_0x561c82){if(_0x561c82){return _0x561c82?{'count':_0x383fbb,'rows':_0x561c82}:null;}})[_0x7e15('0x40')](respondWithResult(_0x54582e,null))[_0x7e15('0x45')](handleError(_0x54582e,null));};exports[_0x7e15('0x4e')]=function(_0x54e5d7,_0x21d1f8,_0x2babd5){if(_0x54e5d7[_0x7e15('0x49')]['id']){delete _0x54e5d7[_0x7e15('0x49')]['id'];}return db[_0x7e15('0x2a')][_0x7e15('0x4b')]({'where':{'id':_0x54e5d7['params']['id']}})['then'](handleEntityNotFound(_0x21d1f8,null))['then'](function(_0x4fad84){if(_0x4fad84){_0x54e5d7[_0x7e15('0x49')]['AccountId']=_0x4fad84['id'];_0x54e5d7[_0x7e15('0x49')][_0x7e15('0x4f')]=integrations[_0x7e15('0x50')](_0x54e5d7['body'][_0x7e15('0x51')],_0x54e5d7['body'][_0x7e15('0x2c')]);_0x54e5d7[_0x7e15('0x49')][_0x7e15('0x52')]=integrations[_0x7e15('0x53')](_0x54e5d7[_0x7e15('0x49')][_0x7e15('0x51')],_0x54e5d7[_0x7e15('0x49')][_0x7e15('0x2c')]);return db[_0x7e15('0x4d')][_0x7e15('0x48')](_0x54e5d7[_0x7e15('0x49')],{'include':[{'model':db[_0x7e15('0x54')],'as':_0x7e15('0x4f')},{'model':db['ZohoField'],'as':_0x7e15('0x52')}]});}return null;})['then'](respondWithResult(_0x21d1f8,null))[_0x7e15('0x45')](handleError(_0x21d1f8,null));};function getAccessToken(_0x507066){return new Promise(function(_0x5379b1,_0x3a4c73){var _0x3b7fe1;switch(_0x507066[_0x7e15('0x55')]){case'US':_0x3b7fe1='https://accounts.zoho.com';break;case'AU':_0x3b7fe1='https://accounts.zoho.com.au';break;case'EU':_0x3b7fe1=_0x7e15('0x56');break;case'IN':_0x3b7fe1='https://accounts.zoho.in';break;case'CN':_0x3b7fe1='https://accounts.zoho.com.cn';break;default:_0x3b7fe1='https://accounts.zoho.eu';break;}var _0x5ebcc4={'method':_0x7e15('0x57'),'uri':_0x3b7fe1+_0x7e15('0x58'),'qs':{'refresh_token':_0x507066[_0x7e15('0x59')],'client_id':_0x507066[_0x7e15('0x5a')],'client_secret':_0x507066[_0x7e15('0x5b')],'grant_type':_0x7e15('0x5c')},'json':!![]};return rp(_0x5ebcc4)[_0x7e15('0x40')](function(_0x57d6b0){if(_0x57d6b0[_0x7e15('0x5d')]){_0x5379b1(_0x57d6b0[_0x7e15('0x5d')]);}else{_0x3a4c73(_0x7e15('0x5e'));}})['catch'](function(_0x33f654){_0x3a4c73(_0x33f654);});});}exports['getFields']=function(_0x39762a,_0xa8eebd,_0x47f812){var _0x36e868,_0x377f68,_0x2ea88c,_0x57139d,_0x4e3c47;return db[_0x7e15('0x2a')][_0x7e15('0x4b')]({'where':{'id':_0x39762a[_0x7e15('0x4c')]['id']},'attributes':['id','host','zone',_0x7e15('0x5a'),_0x7e15('0x5b'),'serverUrl',_0x7e15('0x5f'),'refreshToken']})[_0x7e15('0x40')](handleEntityNotFound(_0xa8eebd,null))['then'](function(_0x2493ea){_0x4e3c47=_0x2493ea;_0x36e868=_0x4e3c47[_0x7e15('0x60')];_0x377f68=_0x36e868==='zoho.eu'?'eu':'com';_0x2ea88c=_0x4e3c47[_0x7e15('0x61')];var _0x4694e1=_0x2ea88c[_0x7e15('0x62')](-0x1);if(_0x4694e1==='/'||_0x4694e1==='\x5c'||_0x4694e1===':'){_0x2ea88c=_0x2ea88c['substring'](0x0,_0x2ea88c[_0x7e15('0x63')](_0x4694e1));}if(!_0x4e3c47[_0x7e15('0x59')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4e3c47);})[_0x7e15('0x40')](function(_0x521c57){if(_0x521c57){return rp({'method':_0x7e15('0x64'),'uri':util[_0x7e15('0x65')](_0x7e15('0x66'),_0x377f68),'qs':{'module':_0x7e15('0x67')},'headers':{'Authorization':_0x7e15('0x68')+_0x521c57},'json':!![]});}})[_0x7e15('0x40')](function(_0x503655){if(_0x503655){if(_0x503655[_0x7e15('0x69')]&&_0x503655['response']['error']){throw new Error(_0x503655[_0x7e15('0x69')]['error'][_0x7e15('0x6a')]);}var _0x419847=[];var _0x56c1b4=[];var _0x380cf4=[_0x7e15('0x6b'),'Subject','Description',_0x7e15('0x6c'),_0x7e15('0x6d'),_0x7e15('0x6e'),_0x7e15('0x6f'),_0x7e15('0x70')];_0x56c1b4=_['remove'](_0x503655[_0x7e15('0x34')],function(_0x5c7e41){return _0x380cf4[_0x7e15('0x71')](_0x5c7e41[_0x7e15('0x72')]);});for(var _0x34b25d=0x0;_0x34b25d<_0x56c1b4['length'];_0x34b25d++){if(_0x56c1b4[_0x34b25d][_0x7e15('0x73')]===![]){_0x419847[_0x7e15('0x74')]({'id':_0x56c1b4[_0x34b25d]['id'],'name':_0x56c1b4[_0x34b25d][_0x7e15('0x75')],'custom':_0x56c1b4[_0x34b25d][_0x7e15('0x76')],'options':_0x56c1b4[_0x34b25d][_0x7e15('0x77')]==='picklist'&&_0x56c1b4[_0x34b25d]['pick_list_values']['length']>-0x1?_['map'](_0x56c1b4[_0x34b25d]['pick_list_values'],function(_0x115afb){return{'name':_0x115afb,'value':_0x115afb};}):[]});}}return{'count':_0x419847[_0x7e15('0x35')],'rows':_0x419847};}else{return{'count':0x0,'rows':[]};}})[_0x7e15('0x40')](respondWithResult(_0xa8eebd,null))[_0x7e15('0x45')](function(_0x4f7f97){var _0x4f4889=_0x39762a[_0x7e15('0x2e')][_0x7e15('0x78')]?0x1f4:_0x4f7f97[_0x7e15('0x79')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x7e15('0x7a'),_0x4f4889,JSON[_0x7e15('0x7b')](_0x4f7f97));delete _0x4f7f97[_0x7e15('0x26')];if(_0x4f4889===0x191){_0x4f4889=0x190;}_0xa8eebd[_0x7e15('0x17')](_0x4f4889)[_0x7e15('0x27')](_0x39762a['query'][_0x7e15('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x4f7f97[_0x7e15('0x79')]}:_0x4f7f97);});}; \ No newline at end of file +var _0xc7df=['Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','../../components/integrations/configuration','sendStatus','status','offset','limit','count','set','Content-Range','reject','save','update','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','then','includeAll','findAll','rows','show','options','find','catch','create','body','params','keys','ZohoConfiguration','nolimit','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0xc7df,0xa1));var _0xfc7d=function(_0x3a3525,_0x20bccf){_0x3a3525=_0x3a3525-0x0;var _0x54f07f=_0xc7df[_0x3a3525];return _0x54f07f;};'use strict';var emlformat=require(_0xfc7d('0x0'));var rimraf=require(_0xfc7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc7d('0x2'));var rp=require('request-promise');var moment=require(_0xfc7d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfc7d('0x4'));var util=require(_0xfc7d('0x5'));var path=require(_0xfc7d('0x6'));var sox=require(_0xfc7d('0x7'));var csv=require('to-csv');var ejs=require(_0xfc7d('0x8'));var fs=require('fs');var fs_extra=require(_0xfc7d('0x9'));var _=require(_0xfc7d('0xa'));var squel=require(_0xfc7d('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc7d('0xc'));var deskjs=require(_0xfc7d('0xd'));var toCsv=require(_0xfc7d('0xe'));var querystring=require(_0xfc7d('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc7d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc7d('0x11'));var as=require(_0xfc7d('0x12'));var hardwareService=require(_0xfc7d('0x13'));var logger=require(_0xfc7d('0x14'))('api');var utils=require(_0xfc7d('0x15'));var config=require(_0xfc7d('0x16'));var licenseUtil=require(_0xfc7d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfc7d('0x18'));function respondWithStatusCode(_0x26a747,_0xe86c0){_0xe86c0=_0xe86c0||0xcc;return function(_0x2844e1){if(_0x2844e1){return _0x26a747[_0xfc7d('0x19')](_0xe86c0);}return _0x26a747['status'](_0xe86c0)['end']();};}function respondWithResult(_0x53b2b1,_0x31e6d2){_0x31e6d2=_0x31e6d2||0xc8;return function(_0x36cff2){if(_0x36cff2){return _0x53b2b1[_0xfc7d('0x1a')](_0x31e6d2)['json'](_0x36cff2);}};}function respondWithFilteredResult(_0x1a72d5,_0x280c38){return function(_0x2f627d){if(_0x2f627d){var _0x249155=typeof _0x280c38[_0xfc7d('0x1b')]==='undefined'&&typeof _0x280c38[_0xfc7d('0x1c')]==='undefined';var _0x1bd213=_0x2f627d[_0xfc7d('0x1d')];var _0x5b7c93=_0x249155?0x0:_0x280c38['offset'];var _0x3491be=_0x249155?_0x2f627d[_0xfc7d('0x1d')]:_0x280c38[_0xfc7d('0x1b')]+_0x280c38[_0xfc7d('0x1c')];var _0x24ba4a;if(_0x3491be>=_0x1bd213){_0x3491be=_0x1bd213;_0x24ba4a=0xc8;}else{_0x24ba4a=0xce;}_0x1a72d5[_0xfc7d('0x1a')](_0x24ba4a);return _0x1a72d5[_0xfc7d('0x1e')](_0xfc7d('0x1f'),_0x5b7c93+'-'+_0x3491be+'/'+_0x1bd213)['json'](_0x2f627d);}return null;};}function patchUpdates(_0x5c866b){return function(_0x30105a){try{jsonpatch['apply'](_0x30105a,_0x5c866b,!![]);}catch(_0x3d2eed){return BPromise[_0xfc7d('0x20')](_0x3d2eed);}return _0x30105a[_0xfc7d('0x21')]();};}function saveUpdates(_0x38dbe8,_0x5e5cce){return function(_0x11e0b7){if(_0x11e0b7){return _0x11e0b7[_0xfc7d('0x22')](_0x38dbe8)['then'](function(_0x2d10b9){return _0x2d10b9;});}return null;};}function removeEntity(_0x19681f,_0x1aee66){return function(_0x1120fa){if(_0x1120fa){return _0x1120fa[_0xfc7d('0x23')]()['then'](function(){_0x19681f['status'](0xcc)[_0xfc7d('0x24')]();});}};}function handleEntityNotFound(_0x253506,_0x30f9f9){return function(_0x5e4b4b){if(!_0x5e4b4b){_0x253506[_0xfc7d('0x19')](0x194);}return _0x5e4b4b;};}function handleError(_0x355d83,_0x9b8ea8){_0x9b8ea8=_0x9b8ea8||0x1f4;return function(_0x3cb5dc){logger[_0xfc7d('0x25')](_0x3cb5dc[_0xfc7d('0x26')]);if(_0x3cb5dc[_0xfc7d('0x27')]){delete _0x3cb5dc[_0xfc7d('0x27')];}_0x355d83[_0xfc7d('0x1a')](_0x9b8ea8)[_0xfc7d('0x28')](_0x3cb5dc);};}exports[_0xfc7d('0x29')]=function(_0x1dbbea,_0x151495){var _0x3b6fbb={},_0x421c4a={},_0x340064={'count':0x0,'rows':[]};var _0x6d6b92=_[_0xfc7d('0x2a')](db[_0xfc7d('0x2b')][_0xfc7d('0x2c')],function(_0x3257b5){return{'name':_0x3257b5[_0xfc7d('0x2d')],'type':_0x3257b5[_0xfc7d('0x2e')][_0xfc7d('0x2f')]};});_0x421c4a[_0xfc7d('0x30')]=_[_0xfc7d('0x2a')](_0x6d6b92,'name');_0x421c4a['query']=_['keys'](_0x1dbbea['query']);_0x421c4a[_0xfc7d('0x31')]=_[_0xfc7d('0x32')](_0x421c4a['model'],_0x421c4a['query']);_0x3b6fbb['attributes']=_[_0xfc7d('0x32')](_0x421c4a[_0xfc7d('0x30')],qs['fields'](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x34')]));_0x3b6fbb[_0xfc7d('0x35')]=_0x3b6fbb[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x3b6fbb['attributes']:_0x421c4a[_0xfc7d('0x30')];if(!_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x37')]('nolimit')){_0x3b6fbb[_0xfc7d('0x1c')]=qs[_0xfc7d('0x1c')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x1c')]);_0x3b6fbb[_0xfc7d('0x1b')]=qs[_0xfc7d('0x1b')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x1b')]);}_0x3b6fbb[_0xfc7d('0x38')]=qs[_0xfc7d('0x39')](_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x39')]);_0x3b6fbb[_0xfc7d('0x3a')]=qs['filters'](_[_0xfc7d('0x3b')](_0x1dbbea['query'],_0x421c4a[_0xfc7d('0x31')]),_0x6d6b92);if(_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3c')]){_0x3b6fbb[_0xfc7d('0x3a')]=_[_0xfc7d('0x3d')](_0x3b6fbb[_0xfc7d('0x3a')],{'$or':_[_0xfc7d('0x2a')](_0x6d6b92,function(_0x203243){if(_0x203243['type']!=='VIRTUAL'){var _0x5efe03={};_0x5efe03[_0x203243['name']]={'$like':'%'+_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3c')]+'%'};return _0x5efe03;}})});}_0x3b6fbb=_[_0xfc7d('0x3d')]({},_0x3b6fbb,_0x1dbbea['options']);var _0x593230={'where':_0x3b6fbb[_0xfc7d('0x3a')]};return db[_0xfc7d('0x2b')][_0xfc7d('0x1d')](_0x593230)[_0xfc7d('0x3e')](function(_0x76677a){_0x340064[_0xfc7d('0x1d')]=_0x76677a;if(_0x1dbbea[_0xfc7d('0x33')][_0xfc7d('0x3f')]){_0x3b6fbb['include']=[{'all':!![]}];}return db[_0xfc7d('0x2b')][_0xfc7d('0x40')](_0x3b6fbb);})[_0xfc7d('0x3e')](function(_0x14f2b0){_0x340064[_0xfc7d('0x41')]=_0x14f2b0;return _0x340064;})[_0xfc7d('0x3e')](respondWithFilteredResult(_0x151495,_0x3b6fbb))['catch'](handleError(_0x151495,null));};exports[_0xfc7d('0x42')]=function(_0x2b0b7b,_0x2cfe90){var _0x457583={'raw':![],'where':{'id':_0x2b0b7b['params']['id']}},_0x3cf67a={};_0x3cf67a[_0xfc7d('0x30')]=_['keys'](db[_0xfc7d('0x2b')][_0xfc7d('0x2c')]);_0x3cf67a[_0xfc7d('0x33')]=_['keys'](_0x2b0b7b[_0xfc7d('0x33')]);_0x3cf67a[_0xfc7d('0x31')]=_[_0xfc7d('0x32')](_0x3cf67a[_0xfc7d('0x30')],_0x3cf67a[_0xfc7d('0x33')]);_0x457583['attributes']=_[_0xfc7d('0x32')](_0x3cf67a[_0xfc7d('0x30')],qs[_0xfc7d('0x34')](_0x2b0b7b[_0xfc7d('0x33')]['fields']));_0x457583[_0xfc7d('0x35')]=_0x457583[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x457583[_0xfc7d('0x35')]:_0x3cf67a[_0xfc7d('0x30')];if(_0x2b0b7b['query']['includeAll']){_0x457583['include']=[{'all':!![]}];}_0x457583=_[_0xfc7d('0x3d')]({},_0x457583,_0x2b0b7b[_0xfc7d('0x43')]);return db[_0xfc7d('0x2b')][_0xfc7d('0x44')](_0x457583)[_0xfc7d('0x3e')](handleEntityNotFound(_0x2cfe90,null))['then'](respondWithResult(_0x2cfe90,null))[_0xfc7d('0x45')](handleError(_0x2cfe90,null));};exports[_0xfc7d('0x46')]=function(_0xe3fcfe,_0x5e7701){return db[_0xfc7d('0x2b')][_0xfc7d('0x46')](_0xe3fcfe[_0xfc7d('0x47')],{})[_0xfc7d('0x3e')](respondWithResult(_0x5e7701,0xc9))['catch'](handleError(_0x5e7701,null));};exports['update']=function(_0x75c3d1,_0x5d3f32){if(_0x75c3d1[_0xfc7d('0x47')]['id']){delete _0x75c3d1[_0xfc7d('0x47')]['id'];}return db[_0xfc7d('0x2b')]['find']({'where':{'id':_0x75c3d1[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x5d3f32,null))[_0xfc7d('0x3e')](saveUpdates(_0x75c3d1[_0xfc7d('0x47')],null))[_0xfc7d('0x3e')](respondWithResult(_0x5d3f32,null))[_0xfc7d('0x45')](handleError(_0x5d3f32,null));};exports['destroy']=function(_0x5b2f57,_0x4a104f){return db[_0xfc7d('0x2b')][_0xfc7d('0x44')]({'where':{'id':_0x5b2f57[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x4a104f,null))[_0xfc7d('0x3e')](removeEntity(_0x4a104f,null))[_0xfc7d('0x45')](handleError(_0x4a104f,null));};exports['getConfigurations']=function(_0x36fe41,_0x542d79,_0x610137){var _0x49e317={};var _0x26109b={};var _0x6a283d;var _0x486add;return db[_0xfc7d('0x2b')]['findOne']({'where':{'id':_0x36fe41[_0xfc7d('0x48')]['id']}})[_0xfc7d('0x3e')](handleEntityNotFound(_0x542d79,null))[_0xfc7d('0x3e')](function(_0x5d1e1a){if(_0x5d1e1a){_0x6a283d=_0x5d1e1a;_0x26109b[_0xfc7d('0x30')]=_[_0xfc7d('0x49')](db[_0xfc7d('0x4a')][_0xfc7d('0x2c')]);_0x26109b['query']=_['keys'](_0x36fe41[_0xfc7d('0x33')]);_0x26109b[_0xfc7d('0x31')]=_['intersection'](_0x26109b[_0xfc7d('0x30')],_0x26109b[_0xfc7d('0x33')]);_0x49e317[_0xfc7d('0x35')]=_[_0xfc7d('0x32')](_0x26109b[_0xfc7d('0x30')],qs[_0xfc7d('0x34')](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x34')]));_0x49e317[_0xfc7d('0x35')]=_0x49e317[_0xfc7d('0x35')][_0xfc7d('0x36')]?_0x49e317[_0xfc7d('0x35')]:_0x26109b[_0xfc7d('0x30')];_0x49e317['order']=qs['sort'](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x39')]);_0x49e317[_0xfc7d('0x3a')]=qs[_0xfc7d('0x31')](_[_0xfc7d('0x3b')](_0x36fe41[_0xfc7d('0x33')],_0x26109b[_0xfc7d('0x31')]));if(_0x36fe41['query']['filter']){_0x49e317[_0xfc7d('0x3a')]=_['merge'](_0x49e317[_0xfc7d('0x3a')],{'$or':_['map'](_0x49e317[_0xfc7d('0x35')],function(_0x8742be){var _0x3e0b1a={};_0x3e0b1a[_0x8742be]={'$like':'%'+_0x36fe41['query'][_0xfc7d('0x3c')]+'%'};return _0x3e0b1a;})});}_0x49e317=_[_0xfc7d('0x3d')]({},_0x49e317,_0x36fe41['options']);return _0x6a283d['getConfigurations'](_0x49e317);}})['then'](function(_0xc717e4){if(_0xc717e4){_0x486add=_0xc717e4[_0xfc7d('0x36')];if(!_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x37')](_0xfc7d('0x4b'))){_0x49e317['limit']=qs[_0xfc7d('0x1c')](_0x36fe41[_0xfc7d('0x33')][_0xfc7d('0x1c')]);_0x49e317[_0xfc7d('0x1b')]=qs[_0xfc7d('0x1b')](_0x36fe41[_0xfc7d('0x33')]['offset']);}return _0x6a283d[_0xfc7d('0x4c')](_0x49e317);}})[_0xfc7d('0x3e')](function(_0x4764d9){if(_0x4764d9){return _0x4764d9?{'count':_0x486add,'rows':_0x4764d9}:null;}})['then'](respondWithResult(_0x542d79,null))[_0xfc7d('0x45')](handleError(_0x542d79,null));};exports[_0xfc7d('0x4d')]=function(_0x482452,_0x211e0e,_0x222f51){if(_0x482452[_0xfc7d('0x47')]['id']){delete _0x482452[_0xfc7d('0x47')]['id'];}return db['ZohoAccount'][_0xfc7d('0x4e')]({'where':{'id':_0x482452['params']['id']}})['then'](handleEntityNotFound(_0x211e0e,null))['then'](function(_0x198a4d){if(_0x198a4d){_0x482452[_0xfc7d('0x47')]['AccountId']=_0x198a4d['id'];_0x482452[_0xfc7d('0x47')][_0xfc7d('0x4f')]=integrations[_0xfc7d('0x50')](_0x482452[_0xfc7d('0x47')][_0xfc7d('0x51')],_0x482452[_0xfc7d('0x47')]['type']);_0x482452['body'][_0xfc7d('0x52')]=integrations['getDescriptions'](_0x482452[_0xfc7d('0x47')][_0xfc7d('0x51')],_0x482452[_0xfc7d('0x47')][_0xfc7d('0x2e')]);return db[_0xfc7d('0x4a')][_0xfc7d('0x46')](_0x482452[_0xfc7d('0x47')],{'include':[{'model':db[_0xfc7d('0x53')],'as':_0xfc7d('0x4f')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xfc7d('0x3e')](respondWithResult(_0x211e0e,null))[_0xfc7d('0x45')](handleError(_0x211e0e,null));};function getAccessToken(_0x58a682){return new Promise(function(_0x436f82,_0x52014e){var _0x8a5ee0;switch(_0x58a682[_0xfc7d('0x54')]){case'US':_0x8a5ee0=_0xfc7d('0x55');break;case'AU':_0x8a5ee0='https://accounts.zoho.com.au';break;case'EU':_0x8a5ee0=_0xfc7d('0x56');break;case'IN':_0x8a5ee0='https://accounts.zoho.in';break;case'CN':_0x8a5ee0=_0xfc7d('0x57');break;default:_0x8a5ee0=_0xfc7d('0x56');break;}var _0x3129cf={'method':_0xfc7d('0x58'),'uri':_0x8a5ee0+_0xfc7d('0x59'),'qs':{'refresh_token':_0x58a682[_0xfc7d('0x5a')],'client_id':_0x58a682[_0xfc7d('0x5b')],'client_secret':_0x58a682[_0xfc7d('0x5c')],'grant_type':_0xfc7d('0x5d')},'json':!![]};return rp(_0x3129cf)[_0xfc7d('0x3e')](function(_0x4c014d){if(_0x4c014d[_0xfc7d('0x5e')]){_0x436f82(_0x4c014d[_0xfc7d('0x5e')]);}else{_0x52014e(_0xfc7d('0x5f'));}})[_0xfc7d('0x45')](function(_0x23f50a){_0x52014e(_0x23f50a);});});}exports['getFields']=function(_0x7d6af0,_0x147d2d,_0x2b8e7b){var _0x4a2dcc,_0xa8076,_0x476341,_0x147e0a,_0xa23325;return db[_0xfc7d('0x2b')][_0xfc7d('0x4e')]({'where':{'id':_0x7d6af0['params']['id']},'attributes':['id',_0xfc7d('0x60'),'zone',_0xfc7d('0x5b'),_0xfc7d('0x5c'),_0xfc7d('0x61'),_0xfc7d('0x62'),_0xfc7d('0x5a')]})[_0xfc7d('0x3e')](handleEntityNotFound(_0x147d2d,null))[_0xfc7d('0x3e')](function(_0x1c1783){_0xa23325=_0x1c1783;_0x4a2dcc=_0xa23325[_0xfc7d('0x60')];_0xa8076=_0x4a2dcc===_0xfc7d('0x63')?'eu':'com';_0x476341=_0xa23325[_0xfc7d('0x61')];var _0x1bc7d3=_0x476341[_0xfc7d('0x64')](-0x1);if(_0x1bc7d3==='/'||_0x1bc7d3==='\x5c'||_0x1bc7d3===':'){_0x476341=_0x476341[_0xfc7d('0x65')](0x0,_0x476341['lastIndexOf'](_0x1bc7d3));}if(!_0xa23325[_0xfc7d('0x5a')]){throw new Error(_0xfc7d('0x66'));}return getAccessToken(_0xa23325);})[_0xfc7d('0x3e')](function(_0x33e1a5){if(_0x33e1a5){return rp({'method':_0xfc7d('0x67'),'uri':util[_0xfc7d('0x68')](_0xfc7d('0x69'),_0xa8076),'qs':{'module':'Calls'},'headers':{'Authorization':_0xfc7d('0x6a')+_0x33e1a5},'json':!![]});}})[_0xfc7d('0x3e')](function(_0x29f1b5){if(_0x29f1b5){if(_0x29f1b5[_0xfc7d('0x6b')]&&_0x29f1b5[_0xfc7d('0x6b')][_0xfc7d('0x25')]){throw new Error(_0x29f1b5['response'][_0xfc7d('0x25')][_0xfc7d('0x6c')]);}var _0x4e7a2f=[];var _0x4871fb=[];var _0x870851=['Owner',_0xfc7d('0x6d'),_0xfc7d('0x6e'),_0xfc7d('0x6f'),_0xfc7d('0x70'),'Call_Result','Call_Start_Time',_0xfc7d('0x71')];_0x4871fb=_[_0xfc7d('0x72')](_0x29f1b5['fields'],function(_0x1488ce){return _0x870851[_0xfc7d('0x73')](_0x1488ce[_0xfc7d('0x74')]);});for(var _0x5d8096=0x0;_0x5d8096<_0x4871fb[_0xfc7d('0x36')];_0x5d8096++){if(_0x4871fb[_0x5d8096]['system_mandatory']===![]){_0x4e7a2f[_0xfc7d('0x75')]({'id':_0x4871fb[_0x5d8096]['id'],'name':_0x4871fb[_0x5d8096][_0xfc7d('0x76')],'custom':_0x4871fb[_0x5d8096][_0xfc7d('0x77')],'options':_0x4871fb[_0x5d8096][_0xfc7d('0x78')]===_0xfc7d('0x79')&&_0x4871fb[_0x5d8096][_0xfc7d('0x7a')][_0xfc7d('0x36')]>-0x1?_['map'](_0x4871fb[_0x5d8096]['pick_list_values'],function(_0x38288e){return{'name':_0x38288e,'value':_0x38288e};}):[]});}}return{'count':_0x4e7a2f['length'],'rows':_0x4e7a2f};}else{return{'count':0x0,'rows':[]};}})[_0xfc7d('0x3e')](respondWithResult(_0x147d2d,null))['catch'](function(_0x34b3fb){var _0x46f380=_0x7d6af0['query']['test']?0x1f4:_0x34b3fb[_0xfc7d('0x7b')]||0x1f4;logger[_0xfc7d('0x25')](_0xfc7d('0x7c'),_0xfc7d('0x7d'),_0x46f380,JSON['stringify'](_0x34b3fb));delete _0x34b3fb[_0xfc7d('0x27')];if(_0x46f380===0x191){_0x46f380=0x190;}_0x147d2d['status'](_0x46f380)['send'](_0x7d6af0[_0xfc7d('0x33')][_0xfc7d('0x7e')]?{'message':_0xfc7d('0x7f'),'statusCode':_0x34b3fb[_0xfc7d('0x7b')]}:_0x34b3fb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index bb3a382..2e2221c 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 _0xaedb=['path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','host','substring','https://accounts.zoho.in','POST','then','info','lodash','../../config/logger','moment','bluebird'];(function(_0x52ba6e,_0x403b56){var _0x5aef7c=function(_0x22a2cb){while(--_0x22a2cb){_0x52ba6e['push'](_0x52ba6e['shift']());}};_0x5aef7c(++_0x403b56);}(_0xaedb,0xfe));var _0xbaed=function(_0x339a28,_0x26eec4){_0x339a28=_0x339a28-0x0;var _0x4fcf88=_0xaedb[_0x339a28];return _0x4fcf88;};'use strict';var _=require(_0xbaed('0x0'));var util=require('util');var logger=require(_0xbaed('0x1'))('api');var moment=require(_0xbaed('0x2'));var BPromise=require(_0xbaed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbaed('0x4'));var rimraf=require(_0xbaed('0x5'));var config=require(_0xbaed('0x6'));var attributes=require(_0xbaed('0x7'));var integrations=require(_0xbaed('0x8'));module[_0xbaed('0x9')]=function(_0x2e09fd,_0x3b2594){return _0x2e09fd[_0xbaed('0xa')](_0xbaed('0xb'),attributes,{'tableName':_0xbaed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35b433,_0x2169aa,_0x288f0a){if(_0x35b433[_0xbaed('0xd')](_0xbaed('0xe'))||_0x35b433['changed']('serverUrl')||_0x35b433[_0xbaed('0xd')](_0xbaed('0xf'))||_0x35b433[_0xbaed('0xd')](_0xbaed('0x10'))||_0x35b433[_0xbaed('0xd')](_0xbaed('0x11'))||_0x35b433[_0xbaed('0xd')]('host')){var _0x4779b9,_0x2c6045;_0x4779b9=_0x35b433['serverUrl'];var _0x19079e=_0x4779b9[_0xbaed('0x12')](-0x1);if(_0x19079e==='/'||_0x19079e==='\x5c'||_0x19079e===':'){_0x4779b9=_0x4779b9['substring'](0x0,_0x4779b9['lastIndexOf'](_0x19079e));}switch(_0x35b433[_0xbaed('0xe')]){case'US':_0x2c6045=_0xbaed('0x13');break;case'AU':_0x2c6045=_0xbaed('0x14');break;case'IN':_0x2c6045='https://accounts.zoho.in';break;case'CN':_0x2c6045=_0xbaed('0x15');break;default:_0x2c6045=_0xbaed('0x16');break;}var _0x430943={'method':'POST','uri':_0x2c6045+_0xbaed('0x17'),'form':{'grant_type':_0xbaed('0x18'),'client_id':_0x35b433[_0xbaed('0xf')],'client_secret':_0x35b433['clientSecret'],'redirect_uri':_0x35b433[_0xbaed('0x19')],'code':_0x35b433['code']},'headers':{'Content-Type':_0xbaed('0x1a')}};return rp(_0x430943)['then'](function(_0x4ad58e){var _0x36ab3c=JSON[_0xbaed('0x1b')](_0x4ad58e);if(_0x36ab3c[_0xbaed('0x1c')]){_0x35b433[_0xbaed('0x1d')]=_0x36ab3c[_0xbaed('0x1c')];logger['info'](util['format'](_0xbaed('0x1e'),_0x35b433[_0xbaed('0x1f')],_0x35b433['id']));}else{logger[_0xbaed('0x20')](util[_0xbaed('0x21')](_0xbaed('0x22'),_0x35b433[_0xbaed('0x1f')],_0x35b433['id']),util['inspect'](_0x36ab3c,{'showHidden':![],'depth':null}));}return _0x288f0a(null,_0x2169aa);})[_0xbaed('0x23')](function(_0x3e68bb){logger[_0xbaed('0x20')](util[_0xbaed('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x35b433[_0xbaed('0x1f')],_0x35b433['id']),util[_0xbaed('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x288f0a(_0x3e68bb);});}else{return _0x288f0a(null,_0x2169aa);}},'beforeUpdate':function(_0x567895,_0x3f9380,_0x3e323d){if(_0x567895[_0xbaed('0xd')]('zone')||_0x567895[_0xbaed('0xd')](_0xbaed('0x19'))||_0x567895[_0xbaed('0xd')](_0xbaed('0xf'))||_0x567895[_0xbaed('0xd')](_0xbaed('0x10'))||_0x567895[_0xbaed('0xd')](_0xbaed('0x11'))||_0x567895[_0xbaed('0xd')](_0xbaed('0x25'))){var _0x22142e,_0x1efed7;_0x22142e=_0x567895[_0xbaed('0x19')];var _0x1f5f32=_0x22142e[_0xbaed('0x12')](-0x1);if(_0x1f5f32==='/'||_0x1f5f32==='\x5c'||_0x1f5f32===':'){_0x22142e=_0x22142e[_0xbaed('0x26')](0x0,_0x22142e['lastIndexOf'](_0x1f5f32));}switch(_0x567895[_0xbaed('0xe')]){case'US':_0x1efed7=_0xbaed('0x13');break;case'AU':_0x1efed7=_0xbaed('0x14');break;case'IN':_0x1efed7=_0xbaed('0x27');break;case'CN':_0x1efed7=_0xbaed('0x15');break;default:_0x1efed7=_0xbaed('0x16');break;}var _0x302508={'method':_0xbaed('0x28'),'uri':_0x1efed7+_0xbaed('0x17'),'form':{'grant_type':_0xbaed('0x18'),'client_id':_0x567895[_0xbaed('0xf')],'client_secret':_0x567895[_0xbaed('0x10')],'redirect_uri':_0x567895[_0xbaed('0x19')],'code':_0x567895[_0xbaed('0x11')]},'headers':{'Content-Type':_0xbaed('0x1a')}};return rp(_0x302508)[_0xbaed('0x29')](function(_0x3bf334){var _0x38e985=JSON[_0xbaed('0x1b')](_0x3bf334);if(_0x38e985['refresh_token']){_0x567895['refreshToken']=_0x38e985[_0xbaed('0x1c')];logger[_0xbaed('0x2a')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x567895[_0xbaed('0x1f')],_0x567895['id']));}else{logger[_0xbaed('0x20')](util[_0xbaed('0x21')](_0xbaed('0x22'),_0x567895[_0xbaed('0x1f')],_0x567895['id']),util[_0xbaed('0x24')](_0x38e985,{'showHidden':![],'depth':null}));}return _0x3e323d(null,_0x3f9380);})[_0xbaed('0x23')](function(_0x237e2e){logger['error'](util['format'](_0xbaed('0x22'),_0x567895['name'],_0x567895['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3e323d(_0x237e2e);});}else{return _0x3e323d(null,_0x3f9380);}}}});}; \ No newline at end of file +var _0xe91b=['info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','/oauth/v2/token','refreshToken','catch','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x49cf09,_0x389ba2){var _0x5b2014=function(_0x2961b5){while(--_0x2961b5){_0x49cf09['push'](_0x49cf09['shift']());}};_0x5b2014(++_0x389ba2);}(_0xe91b,0x15b));var _0xbe91=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xe91b[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xbe91('0x0'));var util=require(_0xbe91('0x1'));var logger=require(_0xbe91('0x2'))('api');var moment=require(_0xbe91('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe91('0x4'));var config=require(_0xbe91('0x5'));var attributes=require(_0xbe91('0x6'));var integrations=require(_0xbe91('0x7'));module[_0xbe91('0x8')]=function(_0x1e9912,_0x240cd1){return _0x1e9912[_0xbe91('0x9')](_0xbe91('0xa'),attributes,{'tableName':_0xbe91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1655c9,_0x20396b,_0x475333){if(_0x1655c9[_0xbe91('0xc')](_0xbe91('0xd'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0xe'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0xf'))||_0x1655c9[_0xbe91('0xc')](_0xbe91('0x10'))||_0x1655c9[_0xbe91('0xc')]('code')||_0x1655c9[_0xbe91('0xc')](_0xbe91('0x11'))){var _0x863ea9,_0xed150c;_0x863ea9=_0x1655c9['serverUrl'];var _0xa01185=_0x863ea9['slice'](-0x1);if(_0xa01185==='/'||_0xa01185==='\x5c'||_0xa01185===':'){_0x863ea9=_0x863ea9[_0xbe91('0x12')](0x0,_0x863ea9[_0xbe91('0x13')](_0xa01185));}switch(_0x1655c9[_0xbe91('0xd')]){case'US':_0xed150c=_0xbe91('0x14');break;case'AU':_0xed150c=_0xbe91('0x15');break;case'IN':_0xed150c=_0xbe91('0x16');break;case'CN':_0xed150c=_0xbe91('0x17');break;default:_0xed150c=_0xbe91('0x18');break;}var _0x18f322={'method':'POST','uri':_0xed150c+'/oauth/v2/token','form':{'grant_type':_0xbe91('0x19'),'client_id':_0x1655c9['clientId'],'client_secret':_0x1655c9[_0xbe91('0x10')],'redirect_uri':_0x1655c9[_0xbe91('0xe')],'code':_0x1655c9[_0xbe91('0x1a')]},'headers':{'Content-Type':_0xbe91('0x1b')}};return rp(_0x18f322)[_0xbe91('0x1c')](function(_0x2ec244){var _0xe68c2d=JSON[_0xbe91('0x1d')](_0x2ec244);if(_0xe68c2d['refresh_token']){_0x1655c9['refreshToken']=_0xe68c2d[_0xbe91('0x1e')];logger[_0xbe91('0x1f')](util['format'](_0xbe91('0x20'),_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']));}else{logger[_0xbe91('0x22')](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']),util['inspect'](_0xe68c2d,{'showHidden':![],'depth':null}));}return _0x475333(null,_0x20396b);})['catch'](function(_0x57c5dd){logger[_0xbe91('0x22')](util[_0xbe91('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1655c9[_0xbe91('0x21')],_0x1655c9['id']),util[_0xbe91('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x475333(_0x57c5dd);});}else{return _0x475333(null,_0x20396b);}},'beforeUpdate':function(_0x141596,_0xc433f6,_0x25cc96){if(_0x141596[_0xbe91('0xc')](_0xbe91('0xd'))||_0x141596[_0xbe91('0xc')]('serverUrl')||_0x141596[_0xbe91('0xc')](_0xbe91('0xf'))||_0x141596[_0xbe91('0xc')](_0xbe91('0x10'))||_0x141596['changed'](_0xbe91('0x1a'))||_0x141596[_0xbe91('0xc')](_0xbe91('0x11'))){var _0x2daba6,_0x2fe8ac;_0x2daba6=_0x141596[_0xbe91('0xe')];var _0x267fa4=_0x2daba6[_0xbe91('0x26')](-0x1);if(_0x267fa4==='/'||_0x267fa4==='\x5c'||_0x267fa4===':'){_0x2daba6=_0x2daba6[_0xbe91('0x12')](0x0,_0x2daba6[_0xbe91('0x13')](_0x267fa4));}switch(_0x141596[_0xbe91('0xd')]){case'US':_0x2fe8ac='https://accounts.zoho.com';break;case'AU':_0x2fe8ac='https://accounts.zoho.com.au';break;case'IN':_0x2fe8ac=_0xbe91('0x16');break;case'CN':_0x2fe8ac=_0xbe91('0x17');break;default:_0x2fe8ac=_0xbe91('0x18');break;}var _0x370dd2={'method':'POST','uri':_0x2fe8ac+_0xbe91('0x27'),'form':{'grant_type':_0xbe91('0x19'),'client_id':_0x141596[_0xbe91('0xf')],'client_secret':_0x141596['clientSecret'],'redirect_uri':_0x141596[_0xbe91('0xe')],'code':_0x141596[_0xbe91('0x1a')]},'headers':{'Content-Type':_0xbe91('0x1b')}};return rp(_0x370dd2)['then'](function(_0x580722){var _0x3294d7=JSON[_0xbe91('0x1d')](_0x580722);if(_0x3294d7[_0xbe91('0x1e')]){_0x141596[_0xbe91('0x28')]=_0x3294d7[_0xbe91('0x1e')];logger[_0xbe91('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x141596[_0xbe91('0x21')],_0x141596['id']));}else{logger['error'](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x141596[_0xbe91('0x21')],_0x141596['id']),util[_0xbe91('0x25')](_0x3294d7,{'showHidden':![],'depth':null}));}return _0x25cc96(null,_0xc433f6);})[_0xbe91('0x29')](function(_0x1262eb){logger[_0xbe91('0x22')](util[_0xbe91('0x23')](_0xbe91('0x24'),_0x141596[_0xbe91('0x21')],_0x141596['id']),util[_0xbe91('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x25cc96(_0x1262eb);});}else{return _0x25cc96(null,_0xc433f6);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b0efe99..fb67a34 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 _0xa3eb=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowZohoAccount','find','lodash'];(function(_0x3a7a40,_0x516256){var _0x3a6454=function(_0x42b31d){while(--_0x42b31d){_0x3a7a40['push'](_0x3a7a40['shift']());}};_0x3a6454(++_0x516256);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa3eb[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x3'));var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require(_0xba3e('0x5'))['db'];var utils=require(_0xba3e('0x6'));var logger=require(_0xba3e('0x7'))(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var jayson=require(_0xba3e('0xa'));var client=jayson[_0xba3e('0xb')][_0xba3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf24b63,_0x426127,_0x3d1403){return new BPromise(function(_0xd7ea8d,_0x2e8339){return client[_0xba3e('0xd')](_0xf24b63,_0x3d1403)[_0xba3e('0xe')](function(_0x1722bc){logger[_0xba3e('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x426127,_0xba3e('0x10'));logger[_0xba3e('0x11')](_0xba3e('0x12'),_0x426127,'request\x20sent',JSON[_0xba3e('0x13')](_0x1722bc));if(_0x1722bc[_0xba3e('0x14')]){if(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x15')]===0x1f4){logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);return _0x2e8339(_0x1722bc['error']['message']);}logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')]['message']);return _0xd7ea8d(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);}else{logger['info'](_0xba3e('0x16'),_0x426127,_0xba3e('0x10'));_0xd7ea8d(_0x1722bc[_0xba3e('0x18')]['message']);}})['catch'](function(_0x3e0b33){logger['error'](_0xba3e('0x16'),_0x426127,_0x3e0b33);_0x2e8339(_0x3e0b33);});});}exports[_0xba3e('0x19')]=function(_0x37c8c9){var _0x37b74b=this;return new Promise(function(_0x241606,_0xca50ea){return db[_0xba3e('0x1a')][_0xba3e('0x1b')]({'raw':_0x37c8c9['options']?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['attributes']||null:null,'limit':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['limit']||null:null,'include':_0x37c8c9['options']?_0x37c8c9['options'][_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x37c8c9['options'][_0xba3e('0x1f')],function(_0x570fc9){return{'model':db[_0x570fc9[_0xba3e('0x21')]],'as':_0x570fc9['as'],'attributes':_0x570fc9[_0xba3e('0x22')],'include':_0x570fc9[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x570fc9[_0xba3e('0x1f')],function(_0x4190ab){return{'model':db[_0x4190ab[_0xba3e('0x21')]],'as':_0x4190ab['as'],'attributes':_0x4190ab[_0xba3e('0x22')],'include':_0x4190ab[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x4190ab[_0xba3e('0x1f')],function(_0xbb2a3c){return{'model':db[_0xbb2a3c['model']],'as':_0xbb2a3c['as'],'attributes':_0xbb2a3c[_0xba3e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x303e30){logger['info'](_0xba3e('0x19'),_0x37c8c9);logger['debug']('GetZohoAccount',_0x37c8c9,JSON[_0xba3e('0x13')](_0x303e30));_0x241606(_0x303e30);})[_0xba3e('0x23')](function(_0x26a025){logger['error'](_0xba3e('0x19'),_0x26a025[_0xba3e('0x17')],_0x37c8c9);_0xca50ea(_0x37b74b[_0xba3e('0x14')](0x1f4,_0x26a025[_0xba3e('0x17')]));});});};exports[_0xba3e('0x24')]=function(_0x21055e){var _0x1cef69=this;return new Promise(function(_0x6f0abb,_0x266041){return db[_0xba3e('0x1a')][_0xba3e('0x25')]({'raw':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x21055e['options']?_0x21055e[_0xba3e('0x1c')]['attributes']||null:null,'include':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['include']?_[_0xba3e('0x20')](_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1f')],function(_0x11d5f5){return{'model':db[_0x11d5f5['model']],'as':_0x11d5f5['as'],'attributes':_0x11d5f5[_0xba3e('0x22')],'include':_0x11d5f5['include']?_['map'](_0x11d5f5['include'],function(_0x2ff97f){return{'model':db[_0x2ff97f['model']],'as':_0x2ff97f['as'],'attributes':_0x2ff97f[_0xba3e('0x22')],'include':_0x2ff97f['include']?_['map'](_0x2ff97f['include'],function(_0x273eb8){return{'model':db[_0x273eb8['model']],'as':_0x273eb8['as'],'attributes':_0x273eb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x68fe9){logger[_0xba3e('0xf')]('ShowZohoAccount',_0x21055e);logger[_0xba3e('0x11')](_0xba3e('0x24'),_0x21055e,JSON['stringify'](_0x68fe9));_0x6f0abb(_0x68fe9);})[_0xba3e('0x23')](function(_0x32c49a){logger[_0xba3e('0x14')](_0xba3e('0x24'),_0x32c49a[_0xba3e('0x17')],_0x21055e);_0x266041(_0x1cef69[_0xba3e('0x14')](0x1f4,_0x32c49a[_0xba3e('0x17')]));});});}; \ No newline at end of file +var _0x89fb=['ZohoAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','include','map','model','attributes','then','GetZohoAccount','ShowZohoAccount'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x89fb,0x14b));var _0xb89f=function(_0x1d7cd6,_0x4a1836){_0x1d7cd6=_0x1d7cd6-0x0;var _0x2675cf=_0x89fb[_0x1d7cd6];return _0x2675cf;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var moment=require(_0xb89f('0x1'));var BPromise=require(_0xb89f('0x2'));var rs=require(_0xb89f('0x3'));var fs=require('fs');var Redis=require(_0xb89f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb89f('0x5'));var logger=require(_0xb89f('0x6'))(_0xb89f('0x7'));var config=require(_0xb89f('0x8'));var jayson=require(_0xb89f('0x9'));var client=jayson['client'][_0xb89f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b467c,_0x334236,_0x537685){return new BPromise(function(_0x3c0105,_0x95385){return client[_0xb89f('0xb')](_0x5b467c,_0x537685)['then'](function(_0x18f75f){logger[_0xb89f('0xc')](_0xb89f('0xd'),_0x334236,_0xb89f('0xe'));logger[_0xb89f('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x334236,'request\x20sent',JSON[_0xb89f('0x10')](_0x18f75f));if(_0x18f75f[_0xb89f('0x11')]){if(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x12')]===0x1f4){logger[_0xb89f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x334236,_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);return _0x95385(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);}logger[_0xb89f('0x11')](_0xb89f('0xd'),_0x334236,_0x18f75f['error'][_0xb89f('0x13')]);return _0x3c0105(_0x18f75f[_0xb89f('0x11')][_0xb89f('0x13')]);}else{logger[_0xb89f('0xc')](_0xb89f('0xd'),_0x334236,_0xb89f('0xe'));_0x3c0105(_0x18f75f[_0xb89f('0x14')]['message']);}})[_0xb89f('0x15')](function(_0xfc48d){logger[_0xb89f('0x11')](_0xb89f('0xd'),_0x334236,_0xfc48d);_0x95385(_0xfc48d);});});}exports['GetZohoAccount']=function(_0x55c865){var _0x77a882=this;return new Promise(function(_0x3004b7,_0xc35f8){return db['ZohoAccount']['findAll']({'raw':_0x55c865[_0xb89f('0x16')]?_0x55c865[_0xb89f('0x16')][_0xb89f('0x17')]===undefined?!![]:![]:!![],'where':_0x55c865[_0xb89f('0x16')]?_0x55c865[_0xb89f('0x16')][_0xb89f('0x18')]||null:null,'attributes':_0x55c865[_0xb89f('0x16')]?_0x55c865['options']['attributes']||null:null,'limit':_0x55c865['options']?_0x55c865['options']['limit']||null:null,'include':_0x55c865[_0xb89f('0x16')]?_0x55c865['options'][_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x55c865[_0xb89f('0x16')][_0xb89f('0x19')],function(_0x19b881){return{'model':db[_0x19b881[_0xb89f('0x1b')]],'as':_0x19b881['as'],'attributes':_0x19b881['attributes'],'include':_0x19b881[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x19b881[_0xb89f('0x19')],function(_0x3b3829){return{'model':db[_0x3b3829[_0xb89f('0x1b')]],'as':_0x3b3829['as'],'attributes':_0x3b3829[_0xb89f('0x1c')],'include':_0x3b3829[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x3b3829['include'],function(_0x20b2b7){return{'model':db[_0x20b2b7[_0xb89f('0x1b')]],'as':_0x20b2b7['as'],'attributes':_0x20b2b7[_0xb89f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb89f('0x1d')](function(_0x1defa1){logger[_0xb89f('0xc')]('GetZohoAccount',_0x55c865);logger[_0xb89f('0xf')](_0xb89f('0x1e'),_0x55c865,JSON[_0xb89f('0x10')](_0x1defa1));_0x3004b7(_0x1defa1);})[_0xb89f('0x15')](function(_0x4eb8da){logger['error']('GetZohoAccount',_0x4eb8da[_0xb89f('0x13')],_0x55c865);_0xc35f8(_0x77a882[_0xb89f('0x11')](0x1f4,_0x4eb8da[_0xb89f('0x13')]));});});};exports[_0xb89f('0x1f')]=function(_0x283091){var _0x69713a=this;return new Promise(function(_0x215925,_0xfeaac7){return db[_0xb89f('0x20')]['find']({'raw':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')][_0xb89f('0x18')]||null:null,'attributes':_0x283091[_0xb89f('0x16')]?_0x283091['options'][_0xb89f('0x1c')]||null:null,'include':_0x283091[_0xb89f('0x16')]?_0x283091[_0xb89f('0x16')][_0xb89f('0x19')]?_['map'](_0x283091[_0xb89f('0x16')]['include'],function(_0x19d655){return{'model':db[_0x19d655[_0xb89f('0x1b')]],'as':_0x19d655['as'],'attributes':_0x19d655[_0xb89f('0x1c')],'include':_0x19d655['include']?_[_0xb89f('0x1a')](_0x19d655[_0xb89f('0x19')],function(_0x4539b8){return{'model':db[_0x4539b8['model']],'as':_0x4539b8['as'],'attributes':_0x4539b8[_0xb89f('0x1c')],'include':_0x4539b8[_0xb89f('0x19')]?_[_0xb89f('0x1a')](_0x4539b8[_0xb89f('0x19')],function(_0x2444d7){return{'model':db[_0x2444d7[_0xb89f('0x1b')]],'as':_0x2444d7['as'],'attributes':_0x2444d7[_0xb89f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb3c552){logger[_0xb89f('0xc')](_0xb89f('0x1f'),_0x283091);logger[_0xb89f('0xf')]('ShowZohoAccount',_0x283091,JSON[_0xb89f('0x10')](_0xb3c552));_0x215925(_0xb3c552);})['catch'](function(_0x388606){logger[_0xb89f('0x11')]('ShowZohoAccount',_0x388606[_0xb89f('0x13')],_0x283091);_0xfeaac7(_0x69713a[_0xb89f('0x11')](0x1f4,_0x388606[_0xb89f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index de0248d..341e5a8 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 _0xe9fe=['getSubjects','/:id/descriptions','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields'];(function(_0x37d86b,_0x4a4334){var _0x14847d=function(_0x591420){while(--_0x591420){_0x37d86b['push'](_0x37d86b['shift']());}};_0x14847d(++_0x4a4334);}(_0xe9fe,0x18e));var _0xee9f=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0xe9fe[_0xa8b370];return _0x643e37;};'use strict';var multer=require(_0xee9f('0x0'));var util=require(_0xee9f('0x1'));var path=require(_0xee9f('0x2'));var timeout=require(_0xee9f('0x3'));var express=require('express');var router=express[_0xee9f('0x4')]();var fs_extra=require(_0xee9f('0x5'));var auth=require(_0xee9f('0x6'));var interaction=require(_0xee9f('0x7'));var config=require(_0xee9f('0x8'));var controller=require(_0xee9f('0x9'));router[_0xee9f('0xa')]('/',auth[_0xee9f('0xb')](),controller[_0xee9f('0xc')]);router[_0xee9f('0xa')]('/:id',auth[_0xee9f('0xb')](),controller[_0xee9f('0xd')]);router[_0xee9f('0xa')](_0xee9f('0xe'),auth[_0xee9f('0xb')](),controller[_0xee9f('0xf')]);router['get']('/:id/subjects',auth[_0xee9f('0xb')](),controller[_0xee9f('0x10')]);router[_0xee9f('0xa')](_0xee9f('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xee9f('0xb')](),controller[_0xee9f('0x12')]);router[_0xee9f('0x13')](_0xee9f('0x14'),auth[_0xee9f('0xb')](),controller[_0xee9f('0x15')]);router['delete'](_0xee9f('0x14'),auth[_0xee9f('0xb')](),controller[_0xee9f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5fa0=['getSubjects','/:id/descriptions','post','create','put','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects'];(function(_0x364d6e,_0x34ea10){var _0x50018b=function(_0x2b3e5e){while(--_0x2b3e5e){_0x364d6e['push'](_0x364d6e['shift']());}};_0x50018b(++_0x34ea10);}(_0x5fa0,0xeb));var _0x05fa=function(_0x1508e2,_0x4b4f39){_0x1508e2=_0x1508e2-0x0;var _0x70a75c=_0x5fa0[_0x1508e2];return _0x70a75c;};'use strict';var multer=require('multer');var util=require(_0x05fa('0x0'));var path=require(_0x05fa('0x1'));var timeout=require(_0x05fa('0x2'));var express=require('express');var router=express[_0x05fa('0x3')]();var fs_extra=require(_0x05fa('0x4'));var auth=require(_0x05fa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x05fa('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x05fa('0x7')]('/',auth[_0x05fa('0x8')](),controller[_0x05fa('0x9')]);router[_0x05fa('0x7')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['show']);router[_0x05fa('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x05fa('0xb'),auth['isAuthenticated'](),controller[_0x05fa('0xc')]);router[_0x05fa('0x7')](_0x05fa('0xd'),auth[_0x05fa('0x8')](),controller['getDescriptions']);router[_0x05fa('0xe')]('/',auth[_0x05fa('0x8')](),controller[_0x05fa('0xf')]);router[_0x05fa('0x10')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['update']);router[_0x05fa('0x11')](_0x05fa('0xa'),auth[_0x05fa('0x8')](),controller['destroy']);module[_0x05fa('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 9547ac8..bb4434d 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 _0x2271=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x2f8773,_0x5c4cbf){var _0x4a42f8=function(_0x2d120f){while(--_0x2d120f){_0x2f8773['push'](_0x2f8773['shift']());}};_0x4a42f8(++_0x5c4cbf);}(_0x2271,0x133));var _0x1227=function(_0x25c016,_0x22dfe5){_0x25c016=_0x25c016-0x0;var _0x15b8ee=_0x2271[_0x25c016];return _0x15b8ee;};'use strict';var Sequelize=require(_0x1227('0x0'));module['exports']={'name':{'type':Sequelize[_0x1227('0x1')]},'moduleCreate':{'type':Sequelize[_0x1227('0x2')](_0x1227('0x3'),_0x1227('0x4'),_0x1227('0x5')),'defaultValue':_0x1227('0x3')},'moduleSearch':{'type':Sequelize[_0x1227('0x2')](_0x1227('0x6'),_0x1227('0x4'),_0x1227('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x1227('0x1')]}}; \ No newline at end of file +var _0x02ee=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x2e32a5,_0xc5e0e4){var _0xeaf48a=function(_0x2a0592){while(--_0x2a0592){_0x2e32a5['push'](_0x2e32a5['shift']());}};_0xeaf48a(++_0xc5e0e4);}(_0x02ee,0x72));var _0xe02e=function(_0x1952c6,_0x1089d2){_0x1952c6=_0x1952c6-0x0;var _0x1c520b=_0x02ee[_0x1952c6];return _0x1c520b;};'use strict';var Sequelize=require(_0xe02e('0x0'));module[_0xe02e('0x1')]={'name':{'type':Sequelize[_0xe02e('0x2')]},'moduleCreate':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x4'),_0xe02e('0x5'),_0xe02e('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe02e('0x3')](_0xe02e('0x7'),_0xe02e('0x5'),'lead'),'defaultValue':_0xe02e('0x7')},'description':{'type':Sequelize[_0xe02e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 8ed09e1..437e1a2 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 _0xe7b6=['rimraf','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','create','update','body','find','keys','ZohoField','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions'];(function(_0x2c98db,_0x19a9e6){var _0x1b2142=function(_0xbea8d7){while(--_0xbea8d7){_0x2c98db['push'](_0x2c98db['shift']());}};_0x1b2142(++_0x19a9e6);}(_0xe7b6,0x13c));var _0x6e7b=function(_0x39848b,_0xe50afc){_0x39848b=_0x39848b-0x0;var _0x660163=_0xe7b6[_0x39848b];return _0x660163;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e7b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e7b('0x1'));var rp=require(_0x6e7b('0x2'));var moment=require(_0x6e7b('0x3'));var BPromise=require(_0x6e7b('0x4'));var Mustache=require(_0x6e7b('0x5'));var util=require(_0x6e7b('0x6'));var path=require('path');var sox=require(_0x6e7b('0x7'));var csv=require(_0x6e7b('0x8'));var ejs=require(_0x6e7b('0x9'));var fs=require('fs');var fs_extra=require(_0x6e7b('0xa'));var _=require(_0x6e7b('0xb'));var squel=require(_0x6e7b('0xc'));var crypto=require(_0x6e7b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6e7b('0xe'));var toCsv=require(_0x6e7b('0x8'));var querystring=require(_0x6e7b('0xf'));var Papa=require(_0x6e7b('0x10'));var Redis=require(_0x6e7b('0x11'));var authService=require(_0x6e7b('0x12'));var qs=require(_0x6e7b('0x13'));var as=require(_0x6e7b('0x14'));var hardwareService=require(_0x6e7b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6e7b('0x16'));var licenseUtil=require(_0x6e7b('0x17'));var db=require(_0x6e7b('0x18'))['db'];function respondWithStatusCode(_0x52230b,_0x22b733){_0x22b733=_0x22b733||0xcc;return function(_0x246404){if(_0x246404){return _0x52230b[_0x6e7b('0x19')](_0x22b733);}return _0x52230b[_0x6e7b('0x1a')](_0x22b733)[_0x6e7b('0x1b')]();};}function respondWithResult(_0x12c662,_0x4b0aad){_0x4b0aad=_0x4b0aad||0xc8;return function(_0x724593){if(_0x724593){return _0x12c662[_0x6e7b('0x1a')](_0x4b0aad)[_0x6e7b('0x1c')](_0x724593);}};}function respondWithFilteredResult(_0x179572,_0x8b2c1c){return function(_0x8c5571){if(_0x8c5571){var _0x2c7d13=typeof _0x8b2c1c[_0x6e7b('0x1d')]===_0x6e7b('0x1e')&&typeof _0x8b2c1c[_0x6e7b('0x1f')]===_0x6e7b('0x1e');var _0x228f75=_0x8c5571[_0x6e7b('0x20')];var _0x30985d=_0x2c7d13?0x0:_0x8b2c1c[_0x6e7b('0x1d')];var _0x2600ad=_0x2c7d13?_0x8c5571['count']:_0x8b2c1c[_0x6e7b('0x1d')]+_0x8b2c1c[_0x6e7b('0x1f')];var _0xbeedd2;if(_0x2600ad>=_0x228f75){_0x2600ad=_0x228f75;_0xbeedd2=0xc8;}else{_0xbeedd2=0xce;}_0x179572['status'](_0xbeedd2);return _0x179572[_0x6e7b('0x21')](_0x6e7b('0x22'),_0x30985d+'-'+_0x2600ad+'/'+_0x228f75)['json'](_0x8c5571);}return null;};}function patchUpdates(_0x5707cf){return function(_0x59f71d){try{jsonpatch[_0x6e7b('0x23')](_0x59f71d,_0x5707cf,!![]);}catch(_0x527698){return BPromise['reject'](_0x527698);}return _0x59f71d[_0x6e7b('0x24')]();};}function saveUpdates(_0xc4395,_0x3bebc7){return function(_0x15fa31){if(_0x15fa31){return _0x15fa31['update'](_0xc4395)[_0x6e7b('0x25')](function(_0x3b20fa){return _0x3b20fa;});}return null;};}function removeEntity(_0x4ec5be,_0x2497d0){return function(_0x35024e){if(_0x35024e){return _0x35024e[_0x6e7b('0x26')]()[_0x6e7b('0x25')](function(){_0x4ec5be[_0x6e7b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47fb31,_0x1bb8ad){return function(_0x598086){if(!_0x598086){_0x47fb31['sendStatus'](0x194);}return _0x598086;};}function handleError(_0x426dfa,_0x50c5c6){_0x50c5c6=_0x50c5c6||0x1f4;return function(_0x5aac73){logger['error'](_0x5aac73[_0x6e7b('0x27')]);if(_0x5aac73[_0x6e7b('0x28')]){delete _0x5aac73['name'];}_0x426dfa[_0x6e7b('0x1a')](_0x50c5c6)['send'](_0x5aac73);};}exports[_0x6e7b('0x29')]=function(_0x5788e8,_0x4a7174){var _0x5b6d21={},_0x128702={},_0xe00cc3={'count':0x0,'rows':[]};var _0x18c0fc=_[_0x6e7b('0x2a')](db[_0x6e7b('0x2b')][_0x6e7b('0x2c')],function(_0x443a20){return{'name':_0x443a20['fieldName'],'type':_0x443a20[_0x6e7b('0x2d')][_0x6e7b('0x2e')]};});_0x128702[_0x6e7b('0x2f')]=_[_0x6e7b('0x2a')](_0x18c0fc,_0x6e7b('0x28'));_0x128702[_0x6e7b('0x30')]=_['keys'](_0x5788e8['query']);_0x128702[_0x6e7b('0x31')]=_[_0x6e7b('0x32')](_0x128702['model'],_0x128702[_0x6e7b('0x30')]);_0x5b6d21[_0x6e7b('0x33')]=_[_0x6e7b('0x32')](_0x128702[_0x6e7b('0x2f')],qs[_0x6e7b('0x34')](_0x5788e8[_0x6e7b('0x30')][_0x6e7b('0x34')]));_0x5b6d21['attributes']=_0x5b6d21['attributes']['length']?_0x5b6d21[_0x6e7b('0x33')]:_0x128702['model'];if(!_0x5788e8['query']['hasOwnProperty'](_0x6e7b('0x35'))){_0x5b6d21[_0x6e7b('0x1f')]=qs[_0x6e7b('0x1f')](_0x5788e8[_0x6e7b('0x30')][_0x6e7b('0x1f')]);_0x5b6d21[_0x6e7b('0x1d')]=qs[_0x6e7b('0x1d')](_0x5788e8['query']['offset']);}_0x5b6d21[_0x6e7b('0x36')]=qs[_0x6e7b('0x37')](_0x5788e8[_0x6e7b('0x30')][_0x6e7b('0x37')]);_0x5b6d21[_0x6e7b('0x38')]=qs['filters'](_[_0x6e7b('0x39')](_0x5788e8[_0x6e7b('0x30')],_0x128702[_0x6e7b('0x31')]),_0x18c0fc);if(_0x5788e8[_0x6e7b('0x30')][_0x6e7b('0x3a')]){_0x5b6d21[_0x6e7b('0x38')]=_[_0x6e7b('0x3b')](_0x5b6d21[_0x6e7b('0x38')],{'$or':_[_0x6e7b('0x2a')](_0x18c0fc,function(_0x296dd4){if(_0x296dd4[_0x6e7b('0x2d')]!==_0x6e7b('0x3c')){var _0x1d1d17={};_0x1d1d17[_0x296dd4['name']]={'$like':'%'+_0x5788e8[_0x6e7b('0x30')][_0x6e7b('0x3a')]+'%'};return _0x1d1d17;}})});}_0x5b6d21=_['merge']({},_0x5b6d21,_0x5788e8[_0x6e7b('0x3d')]);var _0x19bcc1={'where':_0x5b6d21[_0x6e7b('0x38')]};return db[_0x6e7b('0x2b')][_0x6e7b('0x20')](_0x19bcc1)[_0x6e7b('0x25')](function(_0x5f05fb){_0xe00cc3[_0x6e7b('0x20')]=_0x5f05fb;if(_0x5788e8[_0x6e7b('0x30')]['includeAll']){_0x5b6d21[_0x6e7b('0x3e')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5b6d21);})[_0x6e7b('0x25')](function(_0x472ec4){_0xe00cc3[_0x6e7b('0x3f')]=_0x472ec4;return _0xe00cc3;})[_0x6e7b('0x25')](respondWithFilteredResult(_0x4a7174,_0x5b6d21))[_0x6e7b('0x40')](handleError(_0x4a7174,null));};exports[_0x6e7b('0x41')]=function(_0x2dad51,_0x1d9dca){var _0x29d9d2={'raw':![],'where':{'id':_0x2dad51[_0x6e7b('0x42')]['id']}},_0xfb2557={};_0xfb2557[_0x6e7b('0x2f')]=_['keys'](db[_0x6e7b('0x2b')][_0x6e7b('0x2c')]);_0xfb2557[_0x6e7b('0x30')]=_['keys'](_0x2dad51['query']);_0xfb2557[_0x6e7b('0x31')]=_['intersection'](_0xfb2557[_0x6e7b('0x2f')],_0xfb2557[_0x6e7b('0x30')]);_0x29d9d2[_0x6e7b('0x33')]=_[_0x6e7b('0x32')](_0xfb2557[_0x6e7b('0x2f')],qs['fields'](_0x2dad51[_0x6e7b('0x30')][_0x6e7b('0x34')]));_0x29d9d2[_0x6e7b('0x33')]=_0x29d9d2[_0x6e7b('0x33')][_0x6e7b('0x43')]?_0x29d9d2['attributes']:_0xfb2557['model'];if(_0x2dad51[_0x6e7b('0x30')]['includeAll']){_0x29d9d2[_0x6e7b('0x3e')]=[{'all':!![]}];}_0x29d9d2=_[_0x6e7b('0x3b')]({},_0x29d9d2,_0x2dad51['options']);return db[_0x6e7b('0x2b')]['find'](_0x29d9d2)[_0x6e7b('0x25')](handleEntityNotFound(_0x1d9dca,null))[_0x6e7b('0x25')](respondWithResult(_0x1d9dca,null))[_0x6e7b('0x40')](handleError(_0x1d9dca,null));};exports[_0x6e7b('0x44')]=function(_0x1a97ad,_0x290599){return db[_0x6e7b('0x2b')][_0x6e7b('0x44')](_0x1a97ad['body'],{})[_0x6e7b('0x25')](respondWithResult(_0x290599,0xc9))[_0x6e7b('0x40')](handleError(_0x290599,null));};exports[_0x6e7b('0x45')]=function(_0x219cf7,_0x2ab8f5){if(_0x219cf7[_0x6e7b('0x46')]['id']){delete _0x219cf7[_0x6e7b('0x46')]['id'];}return db[_0x6e7b('0x2b')]['find']({'where':{'id':_0x219cf7['params']['id']}})[_0x6e7b('0x25')](handleEntityNotFound(_0x2ab8f5,null))['then'](saveUpdates(_0x219cf7['body'],null))[_0x6e7b('0x25')](respondWithResult(_0x2ab8f5,null))[_0x6e7b('0x40')](handleError(_0x2ab8f5,null));};exports[_0x6e7b('0x26')]=function(_0x2c2f07,_0x3b52c0){return db[_0x6e7b('0x2b')][_0x6e7b('0x47')]({'where':{'id':_0x2c2f07[_0x6e7b('0x42')]['id']}})[_0x6e7b('0x25')](handleEntityNotFound(_0x3b52c0,null))[_0x6e7b('0x25')](removeEntity(_0x3b52c0,null))[_0x6e7b('0x40')](handleError(_0x3b52c0,null));};exports['getFields']=function(_0x218fd9,_0x22a1b6,_0x7d397f){var _0x14eb7a={};var _0x483236={};var _0x308aca;var _0x5db388;return db[_0x6e7b('0x2b')]['findOne']({'where':{'id':_0x218fd9[_0x6e7b('0x42')]['id']}})[_0x6e7b('0x25')](handleEntityNotFound(_0x22a1b6,null))[_0x6e7b('0x25')](function(_0x211adf){if(_0x211adf){_0x308aca=_0x211adf;_0x483236[_0x6e7b('0x2f')]=_[_0x6e7b('0x48')](db[_0x6e7b('0x49')][_0x6e7b('0x2c')]);_0x483236[_0x6e7b('0x30')]=_[_0x6e7b('0x48')](_0x218fd9[_0x6e7b('0x30')]);_0x483236[_0x6e7b('0x31')]=_[_0x6e7b('0x32')](_0x483236[_0x6e7b('0x2f')],_0x483236[_0x6e7b('0x30')]);_0x14eb7a[_0x6e7b('0x33')]=_[_0x6e7b('0x32')](_0x483236[_0x6e7b('0x2f')],qs[_0x6e7b('0x34')](_0x218fd9[_0x6e7b('0x30')]['fields']));_0x14eb7a[_0x6e7b('0x33')]=_0x14eb7a[_0x6e7b('0x33')][_0x6e7b('0x43')]?_0x14eb7a['attributes']:_0x483236['model'];_0x14eb7a[_0x6e7b('0x36')]=qs['sort'](_0x218fd9['query'][_0x6e7b('0x37')]);_0x14eb7a[_0x6e7b('0x38')]=qs[_0x6e7b('0x31')](_[_0x6e7b('0x39')](_0x218fd9[_0x6e7b('0x30')],_0x483236['filters']));if(_0x218fd9[_0x6e7b('0x30')]['filter']){_0x14eb7a[_0x6e7b('0x38')]=_[_0x6e7b('0x3b')](_0x14eb7a[_0x6e7b('0x38')],{'$or':_['map'](_0x14eb7a['attributes'],function(_0x1b98f0){var _0x76d7bb={};_0x76d7bb[_0x1b98f0]={'$like':'%'+_0x218fd9[_0x6e7b('0x30')][_0x6e7b('0x3a')]+'%'};return _0x76d7bb;})});}_0x14eb7a=_['merge']({},_0x14eb7a,_0x218fd9[_0x6e7b('0x3d')]);return _0x308aca[_0x6e7b('0x4a')](_0x14eb7a);}})[_0x6e7b('0x25')](function(_0x1e5018){if(_0x1e5018){_0x5db388=_0x1e5018[_0x6e7b('0x43')];if(!_0x218fd9[_0x6e7b('0x30')][_0x6e7b('0x4b')](_0x6e7b('0x35'))){_0x14eb7a[_0x6e7b('0x1f')]=qs['limit'](_0x218fd9['query'][_0x6e7b('0x1f')]);_0x14eb7a[_0x6e7b('0x1d')]=qs[_0x6e7b('0x1d')](_0x218fd9[_0x6e7b('0x30')][_0x6e7b('0x1d')]);}return _0x308aca['getFields'](_0x14eb7a);}})['then'](function(_0x233524){if(_0x233524){return _0x233524?{'count':_0x5db388,'rows':_0x233524}:null;}})[_0x6e7b('0x25')](respondWithResult(_0x22a1b6,null))[_0x6e7b('0x40')](handleError(_0x22a1b6,null));};exports[_0x6e7b('0x4c')]=function(_0x1f2b6d,_0x561f40,_0x40eac1){var _0x3451fa={};var _0x27e806={};var _0x3a4236;var _0x23aa7f;return db[_0x6e7b('0x2b')][_0x6e7b('0x4d')]({'where':{'id':_0x1f2b6d[_0x6e7b('0x42')]['id']}})[_0x6e7b('0x25')](handleEntityNotFound(_0x561f40,null))[_0x6e7b('0x25')](function(_0x437991){if(_0x437991){_0x3a4236=_0x437991;_0x27e806[_0x6e7b('0x2f')]=_['keys'](db[_0x6e7b('0x49')][_0x6e7b('0x2c')]);_0x27e806['query']=_[_0x6e7b('0x48')](_0x1f2b6d[_0x6e7b('0x30')]);_0x27e806[_0x6e7b('0x31')]=_[_0x6e7b('0x32')](_0x27e806['model'],_0x27e806[_0x6e7b('0x30')]);_0x3451fa[_0x6e7b('0x33')]=_[_0x6e7b('0x32')](_0x27e806[_0x6e7b('0x2f')],qs[_0x6e7b('0x34')](_0x1f2b6d[_0x6e7b('0x30')][_0x6e7b('0x34')]));_0x3451fa[_0x6e7b('0x33')]=_0x3451fa[_0x6e7b('0x33')][_0x6e7b('0x43')]?_0x3451fa[_0x6e7b('0x33')]:_0x27e806[_0x6e7b('0x2f')];_0x3451fa['order']=qs[_0x6e7b('0x37')](_0x1f2b6d[_0x6e7b('0x30')]['sort']);_0x3451fa[_0x6e7b('0x38')]=qs[_0x6e7b('0x31')](_[_0x6e7b('0x39')](_0x1f2b6d[_0x6e7b('0x30')],_0x27e806[_0x6e7b('0x31')]));if(_0x1f2b6d[_0x6e7b('0x30')][_0x6e7b('0x3a')]){_0x3451fa[_0x6e7b('0x38')]=_[_0x6e7b('0x3b')](_0x3451fa[_0x6e7b('0x38')],{'$or':_[_0x6e7b('0x2a')](_0x3451fa[_0x6e7b('0x33')],function(_0x29822a){var _0x151bd6={};_0x151bd6[_0x29822a]={'$like':'%'+_0x1f2b6d[_0x6e7b('0x30')]['filter']+'%'};return _0x151bd6;})});}_0x3451fa=_['merge']({},_0x3451fa,_0x1f2b6d[_0x6e7b('0x3d')]);return _0x3a4236['getSubjects'](_0x3451fa);}})[_0x6e7b('0x25')](function(_0x347474){if(_0x347474){_0x23aa7f=_0x347474[_0x6e7b('0x43')];if(!_0x1f2b6d[_0x6e7b('0x30')][_0x6e7b('0x4b')](_0x6e7b('0x35'))){_0x3451fa[_0x6e7b('0x1f')]=qs[_0x6e7b('0x1f')](_0x1f2b6d['query'][_0x6e7b('0x1f')]);_0x3451fa[_0x6e7b('0x1d')]=qs[_0x6e7b('0x1d')](_0x1f2b6d[_0x6e7b('0x30')][_0x6e7b('0x1d')]);}return _0x3a4236[_0x6e7b('0x4c')](_0x3451fa);}})[_0x6e7b('0x25')](function(_0x5ba25f){if(_0x5ba25f){return _0x5ba25f?{'count':_0x23aa7f,'rows':_0x5ba25f}:null;}})[_0x6e7b('0x25')](respondWithResult(_0x561f40,null))[_0x6e7b('0x40')](handleError(_0x561f40,null));};exports['getDescriptions']=function(_0x510fe9,_0x4fa767,_0x137de6){var _0x425910={};var _0x5f4286={};var _0x29efd8;var _0x3a806d;return db[_0x6e7b('0x2b')][_0x6e7b('0x4d')]({'where':{'id':_0x510fe9['params']['id']}})['then'](handleEntityNotFound(_0x4fa767,null))[_0x6e7b('0x25')](function(_0x34968e){if(_0x34968e){_0x29efd8=_0x34968e;_0x5f4286[_0x6e7b('0x2f')]=_[_0x6e7b('0x48')](db[_0x6e7b('0x49')]['rawAttributes']);_0x5f4286[_0x6e7b('0x30')]=_[_0x6e7b('0x48')](_0x510fe9[_0x6e7b('0x30')]);_0x5f4286[_0x6e7b('0x31')]=_[_0x6e7b('0x32')](_0x5f4286['model'],_0x5f4286[_0x6e7b('0x30')]);_0x425910[_0x6e7b('0x33')]=_[_0x6e7b('0x32')](_0x5f4286[_0x6e7b('0x2f')],qs[_0x6e7b('0x34')](_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x34')]));_0x425910[_0x6e7b('0x33')]=_0x425910[_0x6e7b('0x33')][_0x6e7b('0x43')]?_0x425910['attributes']:_0x5f4286['model'];_0x425910['order']=qs[_0x6e7b('0x37')](_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x37')]);_0x425910[_0x6e7b('0x38')]=qs[_0x6e7b('0x31')](_['pick'](_0x510fe9[_0x6e7b('0x30')],_0x5f4286[_0x6e7b('0x31')]));if(_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x3a')]){_0x425910[_0x6e7b('0x38')]=_['merge'](_0x425910[_0x6e7b('0x38')],{'$or':_['map'](_0x425910[_0x6e7b('0x33')],function(_0x4041c4){var _0x2f1fb4={};_0x2f1fb4[_0x4041c4]={'$like':'%'+_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x3a')]+'%'};return _0x2f1fb4;})});}_0x425910=_[_0x6e7b('0x3b')]({},_0x425910,_0x510fe9[_0x6e7b('0x3d')]);return _0x29efd8[_0x6e7b('0x4e')](_0x425910);}})[_0x6e7b('0x25')](function(_0x4e235d){if(_0x4e235d){_0x3a806d=_0x4e235d['length'];if(!_0x510fe9['query'][_0x6e7b('0x4b')](_0x6e7b('0x35'))){_0x425910[_0x6e7b('0x1f')]=qs[_0x6e7b('0x1f')](_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x1f')]);_0x425910[_0x6e7b('0x1d')]=qs[_0x6e7b('0x1d')](_0x510fe9[_0x6e7b('0x30')][_0x6e7b('0x1d')]);}return _0x29efd8[_0x6e7b('0x4e')](_0x425910);}})['then'](function(_0x5d9aeb){if(_0x5d9aeb){return _0x5d9aeb?{'count':_0x3a806d,'rows':_0x5d9aeb}:null;}})['then'](respondWithResult(_0x4fa767,null))[_0x6e7b('0x40')](handleError(_0x4fa767,null));}; \ No newline at end of file +var _0xb5ad=['../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','map','ZohoConfiguration','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','getFields','findOne','options','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xb5ad,0x1c5));var _0xdb5a=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0xb5ad[_0x3fb9dd];return _0x20136a;};'use strict';var emlformat=require(_0xdb5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb5a('0x1'));var jsonpatch=require(_0xdb5a('0x2'));var rp=require('request-promise');var moment=require(_0xdb5a('0x3'));var BPromise=require(_0xdb5a('0x4'));var Mustache=require(_0xdb5a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdb5a('0x6'));var csv=require(_0xdb5a('0x7'));var ejs=require(_0xdb5a('0x8'));var fs=require('fs');var fs_extra=require(_0xdb5a('0x9'));var _=require('lodash');var squel=require(_0xdb5a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdb5a('0xb'));var deskjs=require(_0xdb5a('0xc'));var toCsv=require(_0xdb5a('0x7'));var querystring=require('querystring');var Papa=require(_0xdb5a('0xd'));var Redis=require(_0xdb5a('0xe'));var authService=require(_0xdb5a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb5a('0x10'));var logger=require(_0xdb5a('0x11'))(_0xdb5a('0x12'));var utils=require(_0xdb5a('0x13'));var config=require(_0xdb5a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb5a('0x15'))['db'];function respondWithStatusCode(_0x37110c,_0x49a2a6){_0x49a2a6=_0x49a2a6||0xcc;return function(_0x3fc2b6){if(_0x3fc2b6){return _0x37110c[_0xdb5a('0x16')](_0x49a2a6);}return _0x37110c[_0xdb5a('0x17')](_0x49a2a6)['end']();};}function respondWithResult(_0x278f0a,_0x484122){_0x484122=_0x484122||0xc8;return function(_0x527ff2){if(_0x527ff2){return _0x278f0a[_0xdb5a('0x17')](_0x484122)['json'](_0x527ff2);}};}function respondWithFilteredResult(_0x11e51a,_0x232b80){return function(_0x5e97ca){if(_0x5e97ca){var _0x7d4077=typeof _0x232b80['offset']===_0xdb5a('0x18')&&typeof _0x232b80[_0xdb5a('0x19')]===_0xdb5a('0x18');var _0x1b6c27=_0x5e97ca[_0xdb5a('0x1a')];var _0xda7a71=_0x7d4077?0x0:_0x232b80[_0xdb5a('0x1b')];var _0xed7175=_0x7d4077?_0x5e97ca['count']:_0x232b80[_0xdb5a('0x1b')]+_0x232b80['limit'];var _0x193ce8;if(_0xed7175>=_0x1b6c27){_0xed7175=_0x1b6c27;_0x193ce8=0xc8;}else{_0x193ce8=0xce;}_0x11e51a['status'](_0x193ce8);return _0x11e51a[_0xdb5a('0x1c')](_0xdb5a('0x1d'),_0xda7a71+'-'+_0xed7175+'/'+_0x1b6c27)[_0xdb5a('0x1e')](_0x5e97ca);}return null;};}function patchUpdates(_0x1d3e92){return function(_0x455c2e){try{jsonpatch['apply'](_0x455c2e,_0x1d3e92,!![]);}catch(_0x1869d4){return BPromise[_0xdb5a('0x1f')](_0x1869d4);}return _0x455c2e[_0xdb5a('0x20')]();};}function saveUpdates(_0x4c459c,_0x163ab5){return function(_0x4b0a99){if(_0x4b0a99){return _0x4b0a99['update'](_0x4c459c)[_0xdb5a('0x21')](function(_0x5beb53){return _0x5beb53;});}return null;};}function removeEntity(_0x3edede,_0x5343e0){return function(_0x3052c8){if(_0x3052c8){return _0x3052c8[_0xdb5a('0x22')]()[_0xdb5a('0x21')](function(){_0x3edede[_0xdb5a('0x17')](0xcc)[_0xdb5a('0x23')]();});}};}function handleEntityNotFound(_0x4a5bf4,_0x2a4b8b){return function(_0x1c8aba){if(!_0x1c8aba){_0x4a5bf4[_0xdb5a('0x16')](0x194);}return _0x1c8aba;};}function handleError(_0x34b355,_0x4740d2){_0x4740d2=_0x4740d2||0x1f4;return function(_0x2609ed){logger[_0xdb5a('0x24')](_0x2609ed[_0xdb5a('0x25')]);if(_0x2609ed[_0xdb5a('0x26')]){delete _0x2609ed['name'];}_0x34b355['status'](_0x4740d2)['send'](_0x2609ed);};}exports['index']=function(_0x5d1f5d,_0x27e0c9){var _0xfc8955={},_0xaa97aa={},_0x29f79c={'count':0x0,'rows':[]};var _0x5c20fd=_[_0xdb5a('0x27')](db[_0xdb5a('0x28')]['rawAttributes'],function(_0x3b7afa){return{'name':_0x3b7afa[_0xdb5a('0x29')],'type':_0x3b7afa['type'][_0xdb5a('0x2a')]};});_0xaa97aa['model']=_[_0xdb5a('0x27')](_0x5c20fd,_0xdb5a('0x26'));_0xaa97aa[_0xdb5a('0x2b')]=_[_0xdb5a('0x2c')](_0x5d1f5d[_0xdb5a('0x2b')]);_0xaa97aa['filters']=_['intersection'](_0xaa97aa[_0xdb5a('0x2d')],_0xaa97aa[_0xdb5a('0x2b')]);_0xfc8955['attributes']=_[_0xdb5a('0x2e')](_0xaa97aa[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0xfc8955[_0xdb5a('0x30')]=_0xfc8955[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0xfc8955[_0xdb5a('0x30')]:_0xaa97aa[_0xdb5a('0x2d')];if(!_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0xfc8955[_0xdb5a('0x19')]=qs[_0xdb5a('0x19')](_0x5d1f5d[_0xdb5a('0x2b')]['limit']);_0xfc8955[_0xdb5a('0x1b')]=qs[_0xdb5a('0x1b')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x1b')]);}_0xfc8955[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x35')]);_0xfc8955[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x5d1f5d[_0xdb5a('0x2b')],_0xaa97aa['filters']),_0x5c20fd);if(_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0xfc8955[_0xdb5a('0x36')]=_[_0xdb5a('0x3a')](_0xfc8955[_0xdb5a('0x36')],{'$or':_[_0xdb5a('0x27')](_0x5c20fd,function(_0x58d61e){if(_0x58d61e[_0xdb5a('0x3b')]!==_0xdb5a('0x3c')){var _0x16391f={};_0x16391f[_0x58d61e[_0xdb5a('0x26')]]={'$like':'%'+_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x16391f;}})});}_0xfc8955=_[_0xdb5a('0x3a')]({},_0xfc8955,_0x5d1f5d['options']);var _0x373429={'where':_0xfc8955[_0xdb5a('0x36')]};return db[_0xdb5a('0x28')][_0xdb5a('0x1a')](_0x373429)['then'](function(_0x3b34a7){_0x29f79c[_0xdb5a('0x1a')]=_0x3b34a7;if(_0x5d1f5d[_0xdb5a('0x2b')][_0xdb5a('0x3d')]){_0xfc8955['include']=[{'all':!![]}];}return db[_0xdb5a('0x28')][_0xdb5a('0x3e')](_0xfc8955);})[_0xdb5a('0x21')](function(_0x5c577c){_0x29f79c[_0xdb5a('0x3f')]=_0x5c577c;return _0x29f79c;})[_0xdb5a('0x21')](respondWithFilteredResult(_0x27e0c9,_0xfc8955))[_0xdb5a('0x40')](handleError(_0x27e0c9,null));};exports[_0xdb5a('0x41')]=function(_0x365fda,_0x31e0e8){var _0xf8ada6={'raw':![],'where':{'id':_0x365fda['params']['id']}},_0x27bb57={};_0x27bb57[_0xdb5a('0x2d')]=_[_0xdb5a('0x2c')](db['ZohoConfiguration'][_0xdb5a('0x42')]);_0x27bb57[_0xdb5a('0x2b')]=_['keys'](_0x365fda[_0xdb5a('0x2b')]);_0x27bb57[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x27bb57[_0xdb5a('0x2d')],_0x27bb57['query']);_0xf8ada6[_0xdb5a('0x30')]=_['intersection'](_0x27bb57['model'],qs[_0xdb5a('0x2f')](_0x365fda[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0xf8ada6['attributes']=_0xf8ada6[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0xf8ada6['attributes']:_0x27bb57[_0xdb5a('0x2d')];if(_0x365fda[_0xdb5a('0x2b')]['includeAll']){_0xf8ada6[_0xdb5a('0x43')]=[{'all':!![]}];}_0xf8ada6=_[_0xdb5a('0x3a')]({},_0xf8ada6,_0x365fda['options']);return db['ZohoConfiguration'][_0xdb5a('0x44')](_0xf8ada6)[_0xdb5a('0x21')](handleEntityNotFound(_0x31e0e8,null))[_0xdb5a('0x21')](respondWithResult(_0x31e0e8,null))[_0xdb5a('0x40')](handleError(_0x31e0e8,null));};exports[_0xdb5a('0x45')]=function(_0x2c8579,_0x191e8f){return db[_0xdb5a('0x28')][_0xdb5a('0x45')](_0x2c8579[_0xdb5a('0x46')],{})[_0xdb5a('0x21')](respondWithResult(_0x191e8f,0xc9))[_0xdb5a('0x40')](handleError(_0x191e8f,null));};exports[_0xdb5a('0x47')]=function(_0x36a15d,_0x5dc9eb){if(_0x36a15d[_0xdb5a('0x46')]['id']){delete _0x36a15d['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x36a15d[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x5dc9eb,null))['then'](saveUpdates(_0x36a15d['body'],null))[_0xdb5a('0x21')](respondWithResult(_0x5dc9eb,null))[_0xdb5a('0x40')](handleError(_0x5dc9eb,null));};exports[_0xdb5a('0x22')]=function(_0xc263a7,_0x2de265){return db[_0xdb5a('0x28')][_0xdb5a('0x44')]({'where':{'id':_0xc263a7[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x2de265,null))[_0xdb5a('0x21')](removeEntity(_0x2de265,null))[_0xdb5a('0x40')](handleError(_0x2de265,null));};exports[_0xdb5a('0x49')]=function(_0x2a42d3,_0x1cfb0e,_0x11192f){var _0x36a2e2={};var _0x1c77f1={};var _0x72face;var _0x16ebe5;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x2a42d3[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x1cfb0e,null))['then'](function(_0x42cf2c){if(_0x42cf2c){_0x72face=_0x42cf2c;_0x1c77f1['model']=_[_0xdb5a('0x2c')](db['ZohoField'][_0xdb5a('0x42')]);_0x1c77f1[_0xdb5a('0x2b')]=_['keys'](_0x2a42d3[_0xdb5a('0x2b')]);_0x1c77f1[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x1c77f1[_0xdb5a('0x2d')],_0x1c77f1[_0xdb5a('0x2b')]);_0x36a2e2['attributes']=_[_0xdb5a('0x2e')](_0x1c77f1[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0x36a2e2[_0xdb5a('0x30')]=_0x36a2e2[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0x36a2e2['attributes']:_0x1c77f1[_0xdb5a('0x2d')];_0x36a2e2[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x2a42d3['query'][_0xdb5a('0x35')]);_0x36a2e2[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_['pick'](_0x2a42d3[_0xdb5a('0x2b')],_0x1c77f1['filters']));if(_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0x36a2e2[_0xdb5a('0x36')]=_['merge'](_0x36a2e2[_0xdb5a('0x36')],{'$or':_[_0xdb5a('0x27')](_0x36a2e2[_0xdb5a('0x30')],function(_0x25f02a){var _0x3ba9b1={};_0x3ba9b1[_0x25f02a]={'$like':'%'+_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x3ba9b1;})});}_0x36a2e2=_[_0xdb5a('0x3a')]({},_0x36a2e2,_0x2a42d3[_0xdb5a('0x4b')]);return _0x72face['getFields'](_0x36a2e2);}})[_0xdb5a('0x21')](function(_0x4e74e2){if(_0x4e74e2){_0x16ebe5=_0x4e74e2[_0xdb5a('0x31')];if(!_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x32')]('nolimit')){_0x36a2e2['limit']=qs[_0xdb5a('0x19')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x36a2e2[_0xdb5a('0x1b')]=qs[_0xdb5a('0x1b')](_0x2a42d3[_0xdb5a('0x2b')][_0xdb5a('0x1b')]);}return _0x72face[_0xdb5a('0x49')](_0x36a2e2);}})[_0xdb5a('0x21')](function(_0x215181){if(_0x215181){return _0x215181?{'count':_0x16ebe5,'rows':_0x215181}:null;}})[_0xdb5a('0x21')](respondWithResult(_0x1cfb0e,null))[_0xdb5a('0x40')](handleError(_0x1cfb0e,null));};exports['getSubjects']=function(_0x1a2853,_0x5510db,_0x963ea7){var _0x473e83={};var _0x92127d={};var _0x1d9ccd;var _0x10a925;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x1a2853[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x5510db,null))[_0xdb5a('0x21')](function(_0x51c65b){if(_0x51c65b){_0x1d9ccd=_0x51c65b;_0x92127d['model']=_[_0xdb5a('0x2c')](db[_0xdb5a('0x4c')][_0xdb5a('0x42')]);_0x92127d[_0xdb5a('0x2b')]=_['keys'](_0x1a2853[_0xdb5a('0x2b')]);_0x92127d['filters']=_[_0xdb5a('0x2e')](_0x92127d[_0xdb5a('0x2d')],_0x92127d[_0xdb5a('0x2b')]);_0x473e83[_0xdb5a('0x30')]=_[_0xdb5a('0x2e')](_0x92127d[_0xdb5a('0x2d')],qs['fields'](_0x1a2853[_0xdb5a('0x2b')]['fields']));_0x473e83['attributes']=_0x473e83[_0xdb5a('0x30')][_0xdb5a('0x31')]?_0x473e83[_0xdb5a('0x30')]:_0x92127d[_0xdb5a('0x2d')];_0x473e83['order']=qs[_0xdb5a('0x35')](_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x35')]);_0x473e83[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x1a2853[_0xdb5a('0x2b')],_0x92127d[_0xdb5a('0x37')]));if(_0x1a2853[_0xdb5a('0x2b')]['filter']){_0x473e83['where']=_[_0xdb5a('0x3a')](_0x473e83[_0xdb5a('0x36')],{'$or':_['map'](_0x473e83[_0xdb5a('0x30')],function(_0x2a3d3a){var _0x496969={};_0x496969[_0x2a3d3a]={'$like':'%'+_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x39')]+'%'};return _0x496969;})});}_0x473e83=_['merge']({},_0x473e83,_0x1a2853[_0xdb5a('0x4b')]);return _0x1d9ccd[_0xdb5a('0x4d')](_0x473e83);}})['then'](function(_0x224814){if(_0x224814){_0x10a925=_0x224814[_0xdb5a('0x31')];if(!_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0x473e83[_0xdb5a('0x19')]=qs[_0xdb5a('0x19')](_0x1a2853[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x473e83['offset']=qs[_0xdb5a('0x1b')](_0x1a2853['query']['offset']);}return _0x1d9ccd[_0xdb5a('0x4d')](_0x473e83);}})[_0xdb5a('0x21')](function(_0x3970a3){if(_0x3970a3){return _0x3970a3?{'count':_0x10a925,'rows':_0x3970a3}:null;}})['then'](respondWithResult(_0x5510db,null))[_0xdb5a('0x40')](handleError(_0x5510db,null));};exports[_0xdb5a('0x4e')]=function(_0x54166a,_0x3cf7fb,_0xba5238){var _0x524b3d={};var _0x214e2b={};var _0x11836b;var _0x559de4;return db[_0xdb5a('0x28')][_0xdb5a('0x4a')]({'where':{'id':_0x54166a[_0xdb5a('0x48')]['id']}})[_0xdb5a('0x21')](handleEntityNotFound(_0x3cf7fb,null))[_0xdb5a('0x21')](function(_0x500ce8){if(_0x500ce8){_0x11836b=_0x500ce8;_0x214e2b[_0xdb5a('0x2d')]=_['keys'](db[_0xdb5a('0x4c')][_0xdb5a('0x42')]);_0x214e2b[_0xdb5a('0x2b')]=_[_0xdb5a('0x2c')](_0x54166a['query']);_0x214e2b[_0xdb5a('0x37')]=_[_0xdb5a('0x2e')](_0x214e2b[_0xdb5a('0x2d')],_0x214e2b[_0xdb5a('0x2b')]);_0x524b3d[_0xdb5a('0x30')]=_[_0xdb5a('0x2e')](_0x214e2b[_0xdb5a('0x2d')],qs[_0xdb5a('0x2f')](_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x2f')]));_0x524b3d[_0xdb5a('0x30')]=_0x524b3d[_0xdb5a('0x30')]['length']?_0x524b3d['attributes']:_0x214e2b[_0xdb5a('0x2d')];_0x524b3d[_0xdb5a('0x34')]=qs[_0xdb5a('0x35')](_0x54166a['query'][_0xdb5a('0x35')]);_0x524b3d[_0xdb5a('0x36')]=qs[_0xdb5a('0x37')](_[_0xdb5a('0x38')](_0x54166a['query'],_0x214e2b['filters']));if(_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x39')]){_0x524b3d[_0xdb5a('0x36')]=_[_0xdb5a('0x3a')](_0x524b3d[_0xdb5a('0x36')],{'$or':_['map'](_0x524b3d[_0xdb5a('0x30')],function(_0x540758){var _0x57213a={};_0x57213a[_0x540758]={'$like':'%'+_0x54166a[_0xdb5a('0x2b')]['filter']+'%'};return _0x57213a;})});}_0x524b3d=_[_0xdb5a('0x3a')]({},_0x524b3d,_0x54166a[_0xdb5a('0x4b')]);return _0x11836b[_0xdb5a('0x4e')](_0x524b3d);}})[_0xdb5a('0x21')](function(_0xcea06d){if(_0xcea06d){_0x559de4=_0xcea06d['length'];if(!_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x32')](_0xdb5a('0x33'))){_0x524b3d['limit']=qs[_0xdb5a('0x19')](_0x54166a[_0xdb5a('0x2b')][_0xdb5a('0x19')]);_0x524b3d[_0xdb5a('0x1b')]=qs['offset'](_0x54166a['query'][_0xdb5a('0x1b')]);}return _0x11836b[_0xdb5a('0x4e')](_0x524b3d);}})[_0xdb5a('0x21')](function(_0x266e28){if(_0x266e28){return _0x266e28?{'count':_0x559de4,'rows':_0x266e28}:null;}})['then'](respondWithResult(_0x3cf7fb,null))['catch'](handleError(_0x3cf7fb,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 04067d4..cac200f 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 _0x2676=['bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x2676,0x1e2));var _0x6267=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x2676[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require(_0x6267('0x0'));var logger=require(_0x6267('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6267('0x2'));var rp=require(_0x6267('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6267('0x4'));var config=require(_0x6267('0x5'));var attributes=require(_0x6267('0x6'));module[_0x6267('0x7')]=function(_0x4b8a84,_0x515407){return _0x4b8a84[_0x6267('0x8')](_0x6267('0x9'),attributes,{'tableName':_0x6267('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd3=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./intZohoConfiguration.attributes','define'];(function(_0x1097b1,_0x511954){var _0x3b19c2=function(_0x45d930){while(--_0x45d930){_0x1097b1['push'](_0x1097b1['shift']());}};_0x3b19c2(++_0x511954);}(_0x7bd3,0x188));var _0x37bd=function(_0x228c0f,_0x2548ac){_0x228c0f=_0x228c0f-0x0;var _0x11a414=_0x7bd3[_0x228c0f];return _0x11a414;};'use strict';var _=require(_0x37bd('0x0'));var util=require(_0x37bd('0x1'));var logger=require(_0x37bd('0x2'))('api');var moment=require(_0x37bd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x37bd('0x4'));var config=require(_0x37bd('0x5'));var attributes=require(_0x37bd('0x6'));module['exports']=function(_0x256055,_0x5cdab9){return _0x256055[_0x37bd('0x7')](_0x37bd('0x8'),attributes,{'tableName':_0x37bd('0x9'),'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 0312ab6..f413491 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 _0xfb74=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x4e13f8,_0x5b6c97){var _0x1125e5=function(_0x4d22be){while(--_0x4d22be){_0x4e13f8['push'](_0x4e13f8['shift']());}};_0x1125e5(++_0x5b6c97);}(_0xfb74,0x145));var _0x4fb7=function(_0xb39122,_0x1c4f04){_0xb39122=_0xb39122-0x0;var _0x4126c7=_0xfb74[_0xb39122];return _0x4126c7;};'use strict';var _=require(_0x4fb7('0x0'));var util=require(_0x4fb7('0x1'));var moment=require(_0x4fb7('0x2'));var BPromise=require(_0x4fb7('0x3'));var rs=require(_0x4fb7('0x4'));var fs=require('fs');var Redis=require(_0x4fb7('0x5'));var db=require(_0x4fb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fb7('0x7'))('rpc');var config=require(_0x4fb7('0x8'));var jayson=require(_0x4fb7('0x9'));var client=jayson['client'][_0x4fb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27ddd4,_0x59cbaa,_0x53551f){return new BPromise(function(_0x52a8f4,_0x24ad20){return client[_0x4fb7('0xb')](_0x27ddd4,_0x53551f)[_0x4fb7('0xc')](function(_0x5d1568){logger[_0x4fb7('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x59cbaa,_0x4fb7('0xe'));logger[_0x4fb7('0xf')](_0x4fb7('0x10'),_0x59cbaa,'request\x20sent',JSON[_0x4fb7('0x11')](_0x5d1568));if(_0x5d1568['error']){if(_0x5d1568[_0x4fb7('0x12')]['code']===0x1f4){logger[_0x4fb7('0x12')](_0x4fb7('0x13'),_0x59cbaa,_0x5d1568[_0x4fb7('0x12')]['message']);return _0x24ad20(_0x5d1568[_0x4fb7('0x12')][_0x4fb7('0x14')]);}logger[_0x4fb7('0x12')](_0x4fb7('0x13'),_0x59cbaa,_0x5d1568[_0x4fb7('0x12')]['message']);return _0x52a8f4(_0x5d1568['error']['message']);}else{logger[_0x4fb7('0xd')](_0x4fb7('0x13'),_0x59cbaa,'request\x20sent');_0x52a8f4(_0x5d1568[_0x4fb7('0x15')]['message']);}})[_0x4fb7('0x16')](function(_0x2d9fb0){logger[_0x4fb7('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x59cbaa,_0x2d9fb0);_0x24ad20(_0x2d9fb0);});});} \ No newline at end of file +var _0x957e=['info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x8fc830,_0x1e96ae){var _0x529d46=function(_0x34c4e7){while(--_0x34c4e7){_0x8fc830['push'](_0x8fc830['shift']());}};_0x529d46(++_0x1e96ae);}(_0x957e,0x6e));var _0xe957=function(_0x4cde9e,_0x57150a){_0x4cde9e=_0x4cde9e-0x0;var _0x38df0c=_0x957e[_0x4cde9e];return _0x38df0c;};'use strict';var _=require(_0xe957('0x0'));var util=require('util');var moment=require(_0xe957('0x1'));var BPromise=require(_0xe957('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe957('0x3'))['db'];var utils=require(_0xe957('0x4'));var logger=require('../../config/logger')(_0xe957('0x5'));var config=require(_0xe957('0x6'));var jayson=require(_0xe957('0x7'));var client=jayson['client'][_0xe957('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x486c25,_0x2371a0,_0x249917){return new BPromise(function(_0x57a196,_0xf230da){return client['request'](_0x486c25,_0x249917)[_0xe957('0x9')](function(_0x276de4){logger[_0xe957('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x2371a0,_0xe957('0xb'));logger[_0xe957('0xc')](_0xe957('0xd'),_0x2371a0,_0xe957('0xb'),JSON[_0xe957('0xe')](_0x276de4));if(_0x276de4['error']){if(_0x276de4[_0xe957('0xf')][_0xe957('0x10')]===0x1f4){logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);return _0xf230da(_0x276de4['error'][_0xe957('0x12')]);}logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);return _0x57a196(_0x276de4[_0xe957('0xf')][_0xe957('0x12')]);}else{logger[_0xe957('0xa')](_0xe957('0x11'),_0x2371a0,_0xe957('0xb'));_0x57a196(_0x276de4[_0xe957('0x13')][_0xe957('0x12')]);}})['catch'](function(_0xb28244){logger[_0xe957('0xf')](_0xe957('0x11'),_0x2371a0,_0xb28244);_0xf230da(_0xb28244);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0f9f25c..0d72598 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 _0x5959=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id','show','update','delete'];(function(_0x4b93db,_0x14d415){var _0x195194=function(_0x5eb6c0){while(--_0x5eb6c0){_0x4b93db['push'](_0x4b93db['shift']());}};_0x195194(++_0x14d415);}(_0x5959,0x17c));var _0x9595=function(_0x16a496,_0x2380e2){_0x16a496=_0x16a496-0x0;var _0x5d2c35=_0x5959[_0x16a496];return _0x5d2c35;};'use strict';var multer=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var path=require(_0x9595('0x2'));var timeout=require('connect-timeout');var express=require(_0x9595('0x3'));var router=express[_0x9595('0x4')]();var fs_extra=require(_0x9595('0x5'));var auth=require(_0x9595('0x6'));var interaction=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var controller=require(_0x9595('0x9'));router['get']('/',auth[_0x9595('0xa')](),controller[_0x9595('0xb')]);router['get'](_0x9595('0xc'),auth[_0x9595('0xa')](),controller[_0x9595('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9595('0xc'),auth[_0x9595('0xa')](),controller[_0x9595('0xe')]);router[_0x9595('0xf')](_0x9595('0xc'),auth[_0x9595('0xa')](),controller[_0x9595('0x10')]);module[_0x9595('0x11')]=router; \ No newline at end of file +var _0xf42a=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5d154b,_0x2bb108){var _0x59ced6=function(_0x26b7ff){while(--_0x26b7ff){_0x5d154b['push'](_0x5d154b['shift']());}};_0x59ced6(++_0x2bb108);}(_0xf42a,0xab));var _0xaf42=function(_0x4b98eb,_0x36d2bd){_0x4b98eb=_0x4b98eb-0x0;var _0x224a29=_0xf42a[_0x4b98eb];return _0x224a29;};'use strict';var multer=require(_0xaf42('0x0'));var util=require('util');var path=require(_0xaf42('0x1'));var timeout=require(_0xaf42('0x2'));var express=require('express');var router=express[_0xaf42('0x3')]();var fs_extra=require(_0xaf42('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaf42('0x5'));var controller=require(_0xaf42('0x6'));router['get']('/',auth[_0xaf42('0x7')](),controller[_0xaf42('0x8')]);router[_0xaf42('0x9')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0xb')]);router[_0xaf42('0xc')]('/',auth[_0xaf42('0x7')](),controller[_0xaf42('0xd')]);router[_0xaf42('0xe')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0xf')]);router[_0xaf42('0x10')](_0xaf42('0xa'),auth[_0xaf42('0x7')](),controller[_0xaf42('0x11')]);module[_0xaf42('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 28089a2..d2c35c5 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 _0xa8e6=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x44d3f3,_0x324aca){var _0x369743=function(_0x39f0a7){while(--_0x39f0a7){_0x44d3f3['push'](_0x44d3f3['shift']());}};_0x369743(++_0x324aca);}(_0xa8e6,0x19f));var _0x6a8e=function(_0x534185,_0x1e880f){_0x534185=_0x534185-0x0;var _0xd10ee2=_0xa8e6[_0x534185];return _0xd10ee2;};'use strict';var Sequelize=require(_0x6a8e('0x0'));module[_0x6a8e('0x1')]={'type':{'type':Sequelize[_0x6a8e('0x2')](_0x6a8e('0x3'),'variable',_0x6a8e('0x4'),_0x6a8e('0x5'),_0x6a8e('0x6')),'defaultValue':_0x6a8e('0x3')},'content':{'type':Sequelize[_0x6a8e('0x7')]},'key':{'type':Sequelize[_0x6a8e('0x7')]},'keyType':{'type':Sequelize[_0x6a8e('0x2')](_0x6a8e('0x3'),_0x6a8e('0x8'),_0x6a8e('0x4'))},'keyContent':{'type':Sequelize[_0x6a8e('0x7')]},'idField':{'type':Sequelize[_0x6a8e('0x7')]},'nameField':{'type':Sequelize[_0x6a8e('0x7')]},'customField':{'type':Sequelize[_0x6a8e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a8e('0x7')]}}; \ No newline at end of file +var _0xa550=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x13b3f2,_0x1f230e){var _0x476495=function(_0x34670c){while(--_0x34670c){_0x13b3f2['push'](_0x13b3f2['shift']());}};_0x476495(++_0x1f230e);}(_0xa550,0x170));var _0x0a55=function(_0x53c8c7,_0x348f83){_0x53c8c7=_0x53c8c7-0x0;var _0x4f9626=_0xa550[_0x53c8c7];return _0x4f9626;};'use strict';var Sequelize=require(_0x0a55('0x0'));module['exports']={'type':{'type':Sequelize[_0x0a55('0x1')](_0x0a55('0x2'),_0x0a55('0x3'),_0x0a55('0x4'),_0x0a55('0x5'),'picklist'),'defaultValue':_0x0a55('0x2')},'content':{'type':Sequelize[_0x0a55('0x6')]},'key':{'type':Sequelize[_0x0a55('0x6')]},'keyType':{'type':Sequelize[_0x0a55('0x1')](_0x0a55('0x2'),_0x0a55('0x3'),_0x0a55('0x4'))},'keyContent':{'type':Sequelize[_0x0a55('0x6')]},'idField':{'type':Sequelize[_0x0a55('0x6')]},'nameField':{'type':Sequelize[_0x0a55('0x6')]},'customField':{'type':Sequelize[_0x0a55('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 61b749e..a96aa66 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 _0x8383=['catch','keys','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ZohoField','includeAll','include','findAll','rows'];(function(_0x1cd8d9,_0x4928b4){var _0x4a81e7=function(_0x146a81){while(--_0x146a81){_0x1cd8d9['push'](_0x1cd8d9['shift']());}};_0x4a81e7(++_0x4928b4);}(_0x8383,0x98));var _0x3838=function(_0x328700,_0x3e953f){_0x328700=_0x328700-0x0;var _0x54c15a=_0x8383[_0x328700];return _0x54c15a;};'use strict';var emlformat=require(_0x3838('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3838('0x1'));var rp=require(_0x3838('0x2'));var moment=require(_0x3838('0x3'));var BPromise=require(_0x3838('0x4'));var Mustache=require(_0x3838('0x5'));var util=require(_0x3838('0x6'));var path=require(_0x3838('0x7'));var sox=require(_0x3838('0x8'));var csv=require(_0x3838('0x9'));var ejs=require(_0x3838('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3838('0xb'));var squel=require(_0x3838('0xc'));var crypto=require('crypto');var jsforce=require(_0x3838('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3838('0x9'));var querystring=require(_0x3838('0xe'));var Papa=require(_0x3838('0xf'));var Redis=require('ioredis');var authService=require(_0x3838('0x10'));var qs=require(_0x3838('0x11'));var as=require(_0x3838('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3838('0x13'))(_0x3838('0x14'));var utils=require(_0x3838('0x15'));var config=require(_0x3838('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3838('0x17'))['db'];function respondWithStatusCode(_0x276d98,_0x21f2c0){_0x21f2c0=_0x21f2c0||0xcc;return function(_0x56e009){if(_0x56e009){return _0x276d98[_0x3838('0x18')](_0x21f2c0);}return _0x276d98['status'](_0x21f2c0)[_0x3838('0x19')]();};}function respondWithResult(_0x2cfc06,_0x104adf){_0x104adf=_0x104adf||0xc8;return function(_0x17e0c4){if(_0x17e0c4){return _0x2cfc06[_0x3838('0x1a')](_0x104adf)['json'](_0x17e0c4);}};}function respondWithFilteredResult(_0x284ec1,_0xb4bf82){return function(_0x396b2d){if(_0x396b2d){var _0x2d81b2=typeof _0xb4bf82[_0x3838('0x1b')]==='undefined'&&typeof _0xb4bf82[_0x3838('0x1c')]===_0x3838('0x1d');var _0x29e617=_0x396b2d['count'];var _0x45aa66=_0x2d81b2?0x0:_0xb4bf82[_0x3838('0x1b')];var _0x4a9a7a=_0x2d81b2?_0x396b2d[_0x3838('0x1e')]:_0xb4bf82[_0x3838('0x1b')]+_0xb4bf82['limit'];var _0x313a90;if(_0x4a9a7a>=_0x29e617){_0x4a9a7a=_0x29e617;_0x313a90=0xc8;}else{_0x313a90=0xce;}_0x284ec1['status'](_0x313a90);return _0x284ec1[_0x3838('0x1f')](_0x3838('0x20'),_0x45aa66+'-'+_0x4a9a7a+'/'+_0x29e617)[_0x3838('0x21')](_0x396b2d);}return null;};}function patchUpdates(_0x2f9965){return function(_0x31a4b8){try{jsonpatch['apply'](_0x31a4b8,_0x2f9965,!![]);}catch(_0x5d7dd0){return BPromise[_0x3838('0x22')](_0x5d7dd0);}return _0x31a4b8['save']();};}function saveUpdates(_0x211fa7,_0x220fdd){return function(_0x200e51){if(_0x200e51){return _0x200e51[_0x3838('0x23')](_0x211fa7)[_0x3838('0x24')](function(_0x30e98f){return _0x30e98f;});}return null;};}function removeEntity(_0xbd0fd1,_0x1e8d61){return function(_0x525b21){if(_0x525b21){return _0x525b21[_0x3838('0x25')]()['then'](function(){_0xbd0fd1[_0x3838('0x1a')](0xcc)[_0x3838('0x19')]();});}};}function handleEntityNotFound(_0x55eaa5,_0x45c723){return function(_0x265099){if(!_0x265099){_0x55eaa5['sendStatus'](0x194);}return _0x265099;};}function handleError(_0x12cf42,_0x30af15){_0x30af15=_0x30af15||0x1f4;return function(_0x537f85){logger[_0x3838('0x26')](_0x537f85['stack']);if(_0x537f85[_0x3838('0x27')]){delete _0x537f85['name'];}_0x12cf42['status'](_0x30af15)[_0x3838('0x28')](_0x537f85);};}exports[_0x3838('0x29')]=function(_0x41bb45,_0x21b3e5){var _0x22ee47={},_0x4b6519={},_0x1baf56={'count':0x0,'rows':[]};var _0x429da4=_[_0x3838('0x2a')](db['ZohoField'][_0x3838('0x2b')],function(_0x5ee2d8){return{'name':_0x5ee2d8[_0x3838('0x2c')],'type':_0x5ee2d8['type'][_0x3838('0x2d')]};});_0x4b6519[_0x3838('0x2e')]=_['map'](_0x429da4,_0x3838('0x27'));_0x4b6519['query']=_['keys'](_0x41bb45[_0x3838('0x2f')]);_0x4b6519[_0x3838('0x30')]=_['intersection'](_0x4b6519['model'],_0x4b6519[_0x3838('0x2f')]);_0x22ee47['attributes']=_[_0x3838('0x31')](_0x4b6519[_0x3838('0x2e')],qs[_0x3838('0x32')](_0x41bb45[_0x3838('0x2f')][_0x3838('0x32')]));_0x22ee47[_0x3838('0x33')]=_0x22ee47['attributes'][_0x3838('0x34')]?_0x22ee47[_0x3838('0x33')]:_0x4b6519[_0x3838('0x2e')];if(!_0x41bb45[_0x3838('0x2f')][_0x3838('0x35')](_0x3838('0x36'))){_0x22ee47[_0x3838('0x1c')]=qs[_0x3838('0x1c')](_0x41bb45[_0x3838('0x2f')][_0x3838('0x1c')]);_0x22ee47[_0x3838('0x1b')]=qs['offset'](_0x41bb45[_0x3838('0x2f')][_0x3838('0x1b')]);}_0x22ee47[_0x3838('0x37')]=qs[_0x3838('0x38')](_0x41bb45['query'][_0x3838('0x38')]);_0x22ee47[_0x3838('0x39')]=qs[_0x3838('0x30')](_[_0x3838('0x3a')](_0x41bb45['query'],_0x4b6519[_0x3838('0x30')]),_0x429da4);if(_0x41bb45[_0x3838('0x2f')][_0x3838('0x3b')]){_0x22ee47[_0x3838('0x39')]=_['merge'](_0x22ee47[_0x3838('0x39')],{'$or':_[_0x3838('0x2a')](_0x429da4,function(_0x28c0ba){if(_0x28c0ba['type']!=='VIRTUAL'){var _0x403078={};_0x403078[_0x28c0ba[_0x3838('0x27')]]={'$like':'%'+_0x41bb45[_0x3838('0x2f')][_0x3838('0x3b')]+'%'};return _0x403078;}})});}_0x22ee47=_[_0x3838('0x3c')]({},_0x22ee47,_0x41bb45[_0x3838('0x3d')]);var _0x29c159={'where':_0x22ee47[_0x3838('0x39')]};return db[_0x3838('0x3e')]['count'](_0x29c159)[_0x3838('0x24')](function(_0x303d26){_0x1baf56[_0x3838('0x1e')]=_0x303d26;if(_0x41bb45[_0x3838('0x2f')][_0x3838('0x3f')]){_0x22ee47[_0x3838('0x40')]=[{'all':!![]}];}return db[_0x3838('0x3e')][_0x3838('0x41')](_0x22ee47);})['then'](function(_0x2bbd18){_0x1baf56[_0x3838('0x42')]=_0x2bbd18;return _0x1baf56;})['then'](respondWithFilteredResult(_0x21b3e5,_0x22ee47))[_0x3838('0x43')](handleError(_0x21b3e5,null));};exports['show']=function(_0x27e830,_0x4e8e9b){var _0x5595f9={'raw':!![],'where':{'id':_0x27e830['params']['id']}},_0x55af4f={};_0x55af4f[_0x3838('0x2e')]=_[_0x3838('0x44')](db[_0x3838('0x3e')][_0x3838('0x2b')]);_0x55af4f['query']=_[_0x3838('0x44')](_0x27e830[_0x3838('0x2f')]);_0x55af4f[_0x3838('0x30')]=_[_0x3838('0x31')](_0x55af4f[_0x3838('0x2e')],_0x55af4f[_0x3838('0x2f')]);_0x5595f9[_0x3838('0x33')]=_[_0x3838('0x31')](_0x55af4f[_0x3838('0x2e')],qs[_0x3838('0x32')](_0x27e830['query'][_0x3838('0x32')]));_0x5595f9[_0x3838('0x33')]=_0x5595f9[_0x3838('0x33')][_0x3838('0x34')]?_0x5595f9[_0x3838('0x33')]:_0x55af4f[_0x3838('0x2e')];if(_0x27e830[_0x3838('0x2f')]['includeAll']){_0x5595f9[_0x3838('0x40')]=[{'all':!![]}];}_0x5595f9=_['merge']({},_0x5595f9,_0x27e830['options']);return db[_0x3838('0x3e')][_0x3838('0x45')](_0x5595f9)[_0x3838('0x24')](handleEntityNotFound(_0x4e8e9b,null))['then'](respondWithResult(_0x4e8e9b,null))[_0x3838('0x43')](handleError(_0x4e8e9b,null));};exports['create']=function(_0x1c4f00,_0x3f52fd){return db[_0x3838('0x3e')][_0x3838('0x46')](_0x1c4f00[_0x3838('0x47')],{})[_0x3838('0x24')](respondWithResult(_0x3f52fd,0xc9))[_0x3838('0x43')](handleError(_0x3f52fd,null));};exports[_0x3838('0x23')]=function(_0x415af0,_0x18b817){if(_0x415af0['body']['id']){delete _0x415af0['body']['id'];}return db['ZohoField'][_0x3838('0x45')]({'where':{'id':_0x415af0[_0x3838('0x48')]['id']}})[_0x3838('0x24')](handleEntityNotFound(_0x18b817,null))[_0x3838('0x24')](saveUpdates(_0x415af0[_0x3838('0x47')],null))[_0x3838('0x24')](respondWithResult(_0x18b817,null))[_0x3838('0x43')](handleError(_0x18b817,null));};exports[_0x3838('0x25')]=function(_0x1992a6,_0x359a68){return db[_0x3838('0x3e')][_0x3838('0x45')]({'where':{'id':_0x1992a6[_0x3838('0x48')]['id']}})[_0x3838('0x24')](handleEntityNotFound(_0x359a68,null))[_0x3838('0x24')](removeEntity(_0x359a68,null))[_0x3838('0x43')](handleError(_0x359a68,null));}; \ No newline at end of file +var _0x9285=['../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','end','error','stack','send','index','map','ZohoField','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x9285,0x1a0));var _0x5928=function(_0x4681a9,_0x3ca309){_0x4681a9=_0x4681a9-0x0;var _0x37077c=_0x9285[_0x4681a9];return _0x37077c;};'use strict';var emlformat=require(_0x5928('0x0'));var rimraf=require(_0x5928('0x1'));var zipdir=require(_0x5928('0x2'));var jsonpatch=require(_0x5928('0x3'));var rp=require(_0x5928('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5928('0x5'));var util=require(_0x5928('0x6'));var path=require(_0x5928('0x7'));var sox=require(_0x5928('0x8'));var csv=require(_0x5928('0x9'));var ejs=require(_0x5928('0xa'));var fs=require('fs');var fs_extra=require(_0x5928('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5928('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5928('0xd'));var Papa=require(_0x5928('0xe'));var Redis=require(_0x5928('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5928('0x10'));var as=require(_0x5928('0x11'));var hardwareService=require(_0x5928('0x12'));var logger=require(_0x5928('0x13'))(_0x5928('0x14'));var utils=require(_0x5928('0x15'));var config=require(_0x5928('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5928('0x17'))['db'];function respondWithStatusCode(_0x29d94f,_0x2d82c8){_0x2d82c8=_0x2d82c8||0xcc;return function(_0x929fa2){if(_0x929fa2){return _0x29d94f[_0x5928('0x18')](_0x2d82c8);}return _0x29d94f[_0x5928('0x19')](_0x2d82c8)['end']();};}function respondWithResult(_0xcf24db,_0x258567){_0x258567=_0x258567||0xc8;return function(_0x335ec0){if(_0x335ec0){return _0xcf24db[_0x5928('0x19')](_0x258567)['json'](_0x335ec0);}};}function respondWithFilteredResult(_0x5ac86e,_0xf1c25a){return function(_0x5001c5){if(_0x5001c5){var _0x24ded1=typeof _0xf1c25a[_0x5928('0x1a')]==='undefined'&&typeof _0xf1c25a[_0x5928('0x1b')]===_0x5928('0x1c');var _0x367c68=_0x5001c5[_0x5928('0x1d')];var _0x40e3cf=_0x24ded1?0x0:_0xf1c25a[_0x5928('0x1a')];var _0x15ee9b=_0x24ded1?_0x5001c5[_0x5928('0x1d')]:_0xf1c25a['offset']+_0xf1c25a[_0x5928('0x1b')];var _0x3dc093;if(_0x15ee9b>=_0x367c68){_0x15ee9b=_0x367c68;_0x3dc093=0xc8;}else{_0x3dc093=0xce;}_0x5ac86e['status'](_0x3dc093);return _0x5ac86e[_0x5928('0x1e')]('Content-Range',_0x40e3cf+'-'+_0x15ee9b+'/'+_0x367c68)[_0x5928('0x1f')](_0x5001c5);}return null;};}function patchUpdates(_0x2d0a99){return function(_0x3f1d97){try{jsonpatch[_0x5928('0x20')](_0x3f1d97,_0x2d0a99,!![]);}catch(_0x63b707){return BPromise[_0x5928('0x21')](_0x63b707);}return _0x3f1d97[_0x5928('0x22')]();};}function saveUpdates(_0x2e6819,_0x75529d){return function(_0x2f766e){if(_0x2f766e){return _0x2f766e[_0x5928('0x23')](_0x2e6819)[_0x5928('0x24')](function(_0x25cef9){return _0x25cef9;});}return null;};}function removeEntity(_0x290baa,_0x830f49){return function(_0x13ba88){if(_0x13ba88){return _0x13ba88['destroy']()['then'](function(){_0x290baa[_0x5928('0x19')](0xcc)[_0x5928('0x25')]();});}};}function handleEntityNotFound(_0x33ea06,_0x4e80d5){return function(_0x3ff7a6){if(!_0x3ff7a6){_0x33ea06[_0x5928('0x18')](0x194);}return _0x3ff7a6;};}function handleError(_0x4fbf7d,_0x5ba05e){_0x5ba05e=_0x5ba05e||0x1f4;return function(_0x220d33){logger[_0x5928('0x26')](_0x220d33[_0x5928('0x27')]);if(_0x220d33['name']){delete _0x220d33['name'];}_0x4fbf7d['status'](_0x5ba05e)[_0x5928('0x28')](_0x220d33);};}exports[_0x5928('0x29')]=function(_0x42f1c2,_0x37dbb2){var _0x5593ed={},_0x3c03fa={},_0x341c0f={'count':0x0,'rows':[]};var _0x20ec18=_[_0x5928('0x2a')](db[_0x5928('0x2b')][_0x5928('0x2c')],function(_0x194262){return{'name':_0x194262[_0x5928('0x2d')],'type':_0x194262[_0x5928('0x2e')]['key']};});_0x3c03fa['model']=_[_0x5928('0x2a')](_0x20ec18,_0x5928('0x2f'));_0x3c03fa[_0x5928('0x30')]=_[_0x5928('0x31')](_0x42f1c2[_0x5928('0x30')]);_0x3c03fa[_0x5928('0x32')]=_[_0x5928('0x33')](_0x3c03fa[_0x5928('0x34')],_0x3c03fa[_0x5928('0x30')]);_0x5593ed['attributes']=_['intersection'](_0x3c03fa[_0x5928('0x34')],qs[_0x5928('0x35')](_0x42f1c2[_0x5928('0x30')][_0x5928('0x35')]));_0x5593ed[_0x5928('0x36')]=_0x5593ed[_0x5928('0x36')][_0x5928('0x37')]?_0x5593ed[_0x5928('0x36')]:_0x3c03fa[_0x5928('0x34')];if(!_0x42f1c2[_0x5928('0x30')][_0x5928('0x38')]('nolimit')){_0x5593ed[_0x5928('0x1b')]=qs[_0x5928('0x1b')](_0x42f1c2[_0x5928('0x30')]['limit']);_0x5593ed[_0x5928('0x1a')]=qs[_0x5928('0x1a')](_0x42f1c2['query'][_0x5928('0x1a')]);}_0x5593ed['order']=qs[_0x5928('0x39')](_0x42f1c2['query'][_0x5928('0x39')]);_0x5593ed[_0x5928('0x3a')]=qs[_0x5928('0x32')](_[_0x5928('0x3b')](_0x42f1c2[_0x5928('0x30')],_0x3c03fa['filters']),_0x20ec18);if(_0x42f1c2[_0x5928('0x30')]['filter']){_0x5593ed[_0x5928('0x3a')]=_[_0x5928('0x3c')](_0x5593ed[_0x5928('0x3a')],{'$or':_['map'](_0x20ec18,function(_0x2a6589){if(_0x2a6589['type']!==_0x5928('0x3d')){var _0x36973e={};_0x36973e[_0x2a6589[_0x5928('0x2f')]]={'$like':'%'+_0x42f1c2[_0x5928('0x30')]['filter']+'%'};return _0x36973e;}})});}_0x5593ed=_[_0x5928('0x3c')]({},_0x5593ed,_0x42f1c2[_0x5928('0x3e')]);var _0x175590={'where':_0x5593ed[_0x5928('0x3a')]};return db[_0x5928('0x2b')][_0x5928('0x1d')](_0x175590)[_0x5928('0x24')](function(_0x13c4b0){_0x341c0f[_0x5928('0x1d')]=_0x13c4b0;if(_0x42f1c2[_0x5928('0x30')][_0x5928('0x3f')]){_0x5593ed[_0x5928('0x40')]=[{'all':!![]}];}return db[_0x5928('0x2b')]['findAll'](_0x5593ed);})['then'](function(_0x206bed){_0x341c0f[_0x5928('0x41')]=_0x206bed;return _0x341c0f;})['then'](respondWithFilteredResult(_0x37dbb2,_0x5593ed))[_0x5928('0x42')](handleError(_0x37dbb2,null));};exports[_0x5928('0x43')]=function(_0x46a141,_0x424187){var _0x187096={'raw':!![],'where':{'id':_0x46a141[_0x5928('0x44')]['id']}},_0x4d1164={};_0x4d1164['model']=_[_0x5928('0x31')](db['ZohoField']['rawAttributes']);_0x4d1164['query']=_[_0x5928('0x31')](_0x46a141[_0x5928('0x30')]);_0x4d1164[_0x5928('0x32')]=_[_0x5928('0x33')](_0x4d1164[_0x5928('0x34')],_0x4d1164['query']);_0x187096[_0x5928('0x36')]=_['intersection'](_0x4d1164['model'],qs[_0x5928('0x35')](_0x46a141['query'][_0x5928('0x35')]));_0x187096[_0x5928('0x36')]=_0x187096[_0x5928('0x36')][_0x5928('0x37')]?_0x187096[_0x5928('0x36')]:_0x4d1164[_0x5928('0x34')];if(_0x46a141[_0x5928('0x30')]['includeAll']){_0x187096[_0x5928('0x40')]=[{'all':!![]}];}_0x187096=_[_0x5928('0x3c')]({},_0x187096,_0x46a141[_0x5928('0x3e')]);return db[_0x5928('0x2b')][_0x5928('0x45')](_0x187096)[_0x5928('0x24')](handleEntityNotFound(_0x424187,null))[_0x5928('0x24')](respondWithResult(_0x424187,null))[_0x5928('0x42')](handleError(_0x424187,null));};exports[_0x5928('0x46')]=function(_0x47fdaf,_0x3cd938){return db[_0x5928('0x2b')][_0x5928('0x46')](_0x47fdaf[_0x5928('0x47')],{})[_0x5928('0x24')](respondWithResult(_0x3cd938,0xc9))[_0x5928('0x42')](handleError(_0x3cd938,null));};exports[_0x5928('0x23')]=function(_0x371dd5,_0x52df87){if(_0x371dd5['body']['id']){delete _0x371dd5[_0x5928('0x47')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x371dd5['params']['id']}})[_0x5928('0x24')](handleEntityNotFound(_0x52df87,null))[_0x5928('0x24')](saveUpdates(_0x371dd5[_0x5928('0x47')],null))[_0x5928('0x24')](respondWithResult(_0x52df87,null))[_0x5928('0x42')](handleError(_0x52df87,null));};exports[_0x5928('0x48')]=function(_0x5d6a20,_0x59cd5d){return db[_0x5928('0x2b')]['find']({'where':{'id':_0x5d6a20[_0x5928('0x44')]['id']}})[_0x5928('0x24')](handleEntityNotFound(_0x59cd5d,null))['then'](removeEntity(_0x59cd5d,null))[_0x5928('0x42')](handleError(_0x59cd5d,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index aa63c18..c9d3ce3 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 _0x7880=['define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x3e37f5,_0x1774ce){var _0x46fb62=function(_0x538e5c){while(--_0x538e5c){_0x3e37f5['push'](_0x3e37f5['shift']());}};_0x46fb62(++_0x1774ce);}(_0x7880,0x1f4));var _0x0788=function(_0x3e95a8,_0xa7af87){_0x3e95a8=_0x3e95a8-0x0;var _0x1d8724=_0x7880[_0x3e95a8];return _0x1d8724;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));module[_0x0788('0x9')]=function(_0x262f5c,_0x775629){return _0x262f5c[_0x0788('0xa')](_0x0788('0xb'),attributes,{'tableName':_0x0788('0xc'),'paranoid':![],'indexes':[{'name':_0x0788('0xd'),'fields':['idField',_0x0788('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1a37,0xb4));var _0x71a3=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1a37[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','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 ae4a23b..c0c9838 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 _0xe166=['stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x23f0e1,_0x11d94b){var _0x257f0d=function(_0xab63c7){while(--_0xab63c7){_0x23f0e1['push'](_0x23f0e1['shift']());}};_0x257f0d(++_0x11d94b);}(_0xe166,0x173));var _0x6e16=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe166[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x6e16('0x0'));var util=require(_0x6e16('0x1'));var moment=require(_0x6e16('0x2'));var BPromise=require(_0x6e16('0x3'));var rs=require(_0x6e16('0x4'));var fs=require('fs');var Redis=require(_0x6e16('0x5'));var db=require(_0x6e16('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e16('0x7'))(_0x6e16('0x8'));var config=require(_0x6e16('0x9'));var jayson=require(_0x6e16('0xa'));var client=jayson[_0x6e16('0xb')][_0x6e16('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x235a70,_0x31c055,_0x1709b6){return new BPromise(function(_0x3478fd,_0xf8c3f7){return client[_0x6e16('0xd')](_0x235a70,_0x1709b6)[_0x6e16('0xe')](function(_0x35fa35){logger[_0x6e16('0xf')]('ZohoField,\x20%s,\x20%s',_0x31c055,_0x6e16('0x10'));logger[_0x6e16('0x11')](_0x6e16('0x12'),_0x31c055,'request\x20sent',JSON[_0x6e16('0x13')](_0x35fa35));if(_0x35fa35['error']){if(_0x35fa35[_0x6e16('0x14')][_0x6e16('0x15')]===0x1f4){logger[_0x6e16('0x14')](_0x6e16('0x16'),_0x31c055,_0x35fa35[_0x6e16('0x14')][_0x6e16('0x17')]);return _0xf8c3f7(_0x35fa35['error'][_0x6e16('0x17')]);}logger[_0x6e16('0x14')](_0x6e16('0x16'),_0x31c055,_0x35fa35[_0x6e16('0x14')][_0x6e16('0x17')]);return _0x3478fd(_0x35fa35[_0x6e16('0x14')]['message']);}else{logger['info'](_0x6e16('0x16'),_0x31c055,'request\x20sent');_0x3478fd(_0x35fa35[_0x6e16('0x18')][_0x6e16('0x17')]);}})[_0x6e16('0x19')](function(_0x3c1f60){logger[_0x6e16('0x14')](_0x6e16('0x16'),_0x31c055,_0x3c1f60);_0xf8c3f7(_0x3c1f60);});});} \ No newline at end of file +var _0xb462=['request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x2ac756,_0x33408b){var _0xa621fb=function(_0x5a316f){while(--_0x5a316f){_0x2ac756['push'](_0x2ac756['shift']());}};_0xa621fb(++_0x33408b);}(_0xb462,0x85));var _0x2b46=function(_0x4dafbb,_0xd041a3){_0x4dafbb=_0x4dafbb-0x0;var _0x600535=_0xb462[_0x4dafbb];return _0x600535;};'use strict';var _=require('lodash');var util=require(_0x2b46('0x0'));var moment=require(_0x2b46('0x1'));var BPromise=require(_0x2b46('0x2'));var rs=require(_0x2b46('0x3'));var fs=require('fs');var Redis=require(_0x2b46('0x4'));var db=require(_0x2b46('0x5'))['db'];var utils=require(_0x2b46('0x6'));var logger=require(_0x2b46('0x7'))(_0x2b46('0x8'));var config=require(_0x2b46('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2979a0,_0x326b48,_0x340dea){return new BPromise(function(_0x3b0772,_0x33db0c){return client[_0x2b46('0xb')](_0x2979a0,_0x340dea)[_0x2b46('0xc')](function(_0x3102ad){logger[_0x2b46('0xd')](_0x2b46('0xe'),_0x326b48,'request\x20sent');logger[_0x2b46('0xf')](_0x2b46('0x10'),_0x326b48,_0x2b46('0x11'),JSON[_0x2b46('0x12')](_0x3102ad));if(_0x3102ad[_0x2b46('0x13')]){if(_0x3102ad['error'][_0x2b46('0x14')]===0x1f4){logger[_0x2b46('0x13')](_0x2b46('0xe'),_0x326b48,_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);return _0x33db0c(_0x3102ad['error'][_0x2b46('0x15')]);}logger['error'](_0x2b46('0xe'),_0x326b48,_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);return _0x3b0772(_0x3102ad[_0x2b46('0x13')][_0x2b46('0x15')]);}else{logger[_0x2b46('0xd')](_0x2b46('0xe'),_0x326b48,_0x2b46('0x11'));_0x3b0772(_0x3102ad[_0x2b46('0x16')][_0x2b46('0x15')]);}})[_0x2b46('0x17')](function(_0x2433f7){logger[_0x2b46('0x13')](_0x2b46('0xe'),_0x326b48,_0x2433f7);_0x33db0c(_0x2433f7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 1f932d6..7497051 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(_0x105ede,_0x6ecf){var _0x4993fb=function(_0x568cba){while(--_0x568cba){_0x105ede['push'](_0x105ede['shift']());}};_0x4993fb(++_0x6ecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x149a2a,_0x2dfe35){var _0x3697b1=function(_0x5a14d1){while(--_0x5a14d1){_0x149a2a['push'](_0x149a2a['shift']());}};_0x3697b1(++_0x2dfe35);}(_0xe706,0xa3));var _0x6e70=function(_0x13d9ac,_0x193a78){_0x13d9ac=_0x13d9ac-0x0;var _0x348a17=_0xe706[_0x13d9ac];return _0x348a17;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8467791..0ab6524 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 _0xb9b8=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xb9b8,0x1d0));var _0x8b9b=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb9b8[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0x8b9b('0x0'));module[_0x8b9b('0x1')]={'name':{'type':Sequelize[_0x8b9b('0x2')],'allowNull':![],'unique':_0x8b9b('0x3')},'version':{'type':Sequelize[_0x8b9b('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x8b9b('0x4')},'filename':{'type':Sequelize[_0x8b9b('0x2')]},'path':{'type':Sequelize[_0x8b9b('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x8b9b('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x8b9b('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x8b9b('0x2')],'unique':_0x8b9b('0x6')},'description':{'type':Sequelize[_0x8b9b('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8b9b('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x83d6=['sequelize','exports','STRING','unique_name_and_version','INTEGER','state'];(function(_0x32c3b2,_0x66618d){var _0x964579=function(_0x4c841b){while(--_0x4c841b){_0x32c3b2['push'](_0x32c3b2['shift']());}};_0x964579(++_0x66618d);}(_0x83d6,0xd8));var _0x683d=function(_0x33adc6,_0x1c1471){_0x33adc6=_0x33adc6-0x0;var _0x140078=_0x83d6[_0x33adc6];return _0x140078;};'use strict';var Sequelize=require(_0x683d('0x0'));module[_0x683d('0x1')]={'name':{'type':Sequelize[_0x683d('0x2')],'allowNull':![],'unique':_0x683d('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x683d('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x683d('0x2')]},'size':{'type':Sequelize[_0x683d('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x683d('0x2')]},'logo':{'type':Sequelize[_0x683d('0x2')]},'state':{'type':Sequelize[_0x683d('0x2')],'unique':_0x683d('0x5')},'description':{'type':Sequelize[_0x683d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x683d('0x2')]},'link':{'type':Sequelize[_0x683d('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 5a2d711..5d72c05 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 _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1261,0x144));var _0x1126=function(_0x3edb26,_0x9613b4){_0x3edb26=_0x3edb26-0x0;var _0x4ad9f5=_0x1261[_0x3edb26];return _0x4ad9f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file +var _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x1a37,0xb4));var _0x71a3=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x1a37[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c76e2e0..fd4dbd0 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 _0x9e1a=['Integration','integrations','lodash','api','moment','bluebird','request-promise','rimraf','./integration.attributes','exports','define'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0x9e1a,0x14c));var _0xa9e1=function(_0x19a8d9,_0x50b678){_0x19a8d9=_0x19a8d9-0x0;var _0x5302ac=_0x9e1a[_0x19a8d9];return _0x5302ac;};'use strict';var _=require(_0xa9e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa9e1('0x1'));var moment=require(_0xa9e1('0x2'));var BPromise=require(_0xa9e1('0x3'));var rp=require(_0xa9e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9e1('0x5'));var config=require('../../config/environment');var attributes=require(_0xa9e1('0x6'));module[_0xa9e1('0x7')]=function(_0x54ebdb,_0x20f70e){return _0x54ebdb[_0xa9e1('0x8')](_0xa9e1('0x9'),attributes,{'tableName':_0xa9e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61b=['exports','define','Integration','integrations','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x178bb6,_0x1fe40c){var _0x43961b=function(_0xb35f7f){while(--_0xb35f7f){_0x178bb6['push'](_0x178bb6['shift']());}};_0x43961b(++_0x1fe40c);}(_0xe61b,0x138));var _0xbe61=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0xe61b[_0x337a10];return _0x575f98;};'use strict';var _=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var logger=require(_0xbe61('0x2'))(_0xbe61('0x3'));var moment=require('moment');var BPromise=require(_0xbe61('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbe61('0x5'));var config=require(_0xbe61('0x6'));var attributes=require('./integration.attributes');module[_0xbe61('0x7')]=function(_0x49d9ea,_0x45fb65){return _0x49d9ea[_0xbe61('0x8')](_0xbe61('0x9'),attributes,{'tableName':_0xbe61('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 042b7ef..cce3e50 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x545ccb,_0x429b4d){var _0x43034f=function(_0x236b6d){while(--_0x236b6d){_0x545ccb['push'](_0x545ccb['shift']());}};_0x43034f(++_0x429b4d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x55f982,_0x3a4992){var _0x4db75b=function(_0x20a0cd){while(--_0x20a0cd){_0x55f982['push'](_0x55f982['shift']());}};_0x4db75b(++_0x3a4992);}(_0x66fa,0x117));var _0xa66f=function(_0x4da32c,_0x19a52e){_0x4da32c=_0x4da32c-0x0;var _0x24369d=_0x66fa[_0x4da32c];return _0x24369d;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b6f0983..eb9bb22 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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2ceb4d,_0x559824){var _0x402678=function(_0x2a0244){while(--_0x2a0244){_0x2ceb4d['push'](_0x2ceb4d['shift']());}};_0x402678(++_0x559824);}(_0x57ca,0x108));var _0xa57c=function(_0xd6a8f5,_0x3c2585){_0xd6a8f5=_0xd6a8f5-0x0;var _0x11a5a9=_0x57ca[_0xd6a8f5];return _0x11a5a9;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0xda2d=['show','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xda2d,0x102));var _0xdda2=function(_0x44cc2e,_0x103603){_0x44cc2e=_0x44cc2e-0x0;var _0x55cd93=_0xda2d[_0x44cc2e];return _0x55cd93;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0x7')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xc')]);router['post']('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')](_0xdda2('0xf'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d5b465d..dcf7ccb 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 _0xe4a3=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xe4a3,0xed));var _0x3e4a=function(_0x5ed45,_0x3db138){_0x5ed45=_0x5ed45-0x0;var _0x2ff437=_0xe4a3[_0x5ed45];return _0x2ff437;};'use strict';var Sequelize=require(_0x3e4a('0x0'));module[_0x3e4a('0x1')]={'integration':{'type':Sequelize[_0x3e4a('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x3e4a('0x2')]},'ticketId':{'type':Sequelize[_0x3e4a('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3e4a('0x2')]},'uniqueid':{'type':Sequelize[_0x3e4a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3e4a('0x2')]},'queue':{'type':Sequelize[_0x3e4a('0x2')]},'interface':{'type':Sequelize[_0x3e4a('0x2')]},'membername':{'type':Sequelize[_0x3e4a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3e4a('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3e4a('0x3')]},'holdtime':{'type':Sequelize[_0x3e4a('0x4')]},'agentcomplete':{'type':Sequelize[_0x3e4a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3e4a('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3e4a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x3e4a('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3e4a('0x3')]},'agentdump':{'type':Sequelize[_0x3e4a('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3e4a('0x3')]},'lastevent':{'type':Sequelize[_0x3e4a('0x2')]},'channel':{'type':Sequelize[_0x3e4a('0x2')]},'channelstate':{'type':Sequelize[_0x3e4a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x3e4a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3e4a('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e4a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3e4a('0x2')]},'context':{'type':Sequelize[_0x3e4a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e4a('0x2')]},'destchannel':{'type':Sequelize[_0x3e4a('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3e4a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3e4a('0x2')]},'destcalleridname':{'type':Sequelize[_0x3e4a('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x3e4a('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3e4a('0x2')]},'destcontext':{'type':Sequelize[_0x3e4a('0x2')]},'destexten':{'type':Sequelize[_0x3e4a('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3e4a('0x2')]},'messageId':{'type':Sequelize[_0x3e4a('0x2')]},'inReplyTo':{'type':Sequelize[_0x3e4a('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3e4a('0x2')]},'to':{'type':Sequelize[_0x3e4a('0x2')]},'cc':{'type':Sequelize[_0x3e4a('0x2')]},'attachment':{'type':Sequelize[_0x3e4a('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x3e4a('0x6')]},'status':{'type':Sequelize[_0x3e4a('0x7')]('SENT',_0x3e4a('0x8'),_0x3e4a('0x9'),_0x3e4a('0xa'))},'url':{'type':Sequelize[_0x3e4a('0x2')]},'app':{'type':Sequelize[_0x3e4a('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x3e4a('0x4')]}}; \ No newline at end of file +var _0x7f02=['BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x21f405,_0x316de9){var _0x57f6aa=function(_0x584316){while(--_0x584316){_0x21f405['push'](_0x21f405['shift']());}};_0x57f6aa(++_0x316de9);}(_0x7f02,0x1a8));var _0x27f0=function(_0x36eafc,_0x23fc6e){_0x36eafc=_0x36eafc-0x0;var _0x412f49=_0x7f02[_0x36eafc];return _0x412f49;};'use strict';var Sequelize=require(_0x27f0('0x0'));module[_0x27f0('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x27f0('0x2')]},'exitStatus':{'type':Sequelize[_0x27f0('0x2')]},'ticketId':{'type':Sequelize[_0x27f0('0x2')]},'integrationId':{'type':Sequelize[_0x27f0('0x3')]},'contacts':{'type':Sequelize[_0x27f0('0x2')]},'uniqueid':{'type':Sequelize[_0x27f0('0x2')]},'calleridnum':{'type':Sequelize[_0x27f0('0x2')]},'calleridname':{'type':Sequelize[_0x27f0('0x2')]},'queue':{'type':Sequelize[_0x27f0('0x2')]},'interface':{'type':Sequelize[_0x27f0('0x2')]},'membername':{'type':Sequelize[_0x27f0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x27f0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x27f0('0x4')]},'holdtime':{'type':Sequelize[_0x27f0('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x27f0('0x3')]},'agentacw':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x27f0('0x3')]},'reason':{'type':Sequelize[_0x27f0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x27f0('0x4')]},'agentdump':{'type':Sequelize[_0x27f0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x27f0('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x27f0('0x2')]},'channelstate':{'type':Sequelize[_0x27f0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x27f0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x27f0('0x2')]},'connectedlinename':{'type':Sequelize[_0x27f0('0x2')]},'language':{'type':Sequelize[_0x27f0('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x27f0('0x2')]},'exten':{'type':Sequelize[_0x27f0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x27f0('0x2')]},'destchannelstate':{'type':Sequelize[_0x27f0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x27f0('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x27f0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x27f0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x27f0('0x2')]},'destaccountcode':{'type':Sequelize[_0x27f0('0x2')]},'destcontext':{'type':Sequelize[_0x27f0('0x2')]},'destexten':{'type':Sequelize[_0x27f0('0x2')]},'destpriority':{'type':Sequelize[_0x27f0('0x2')]},'destuniqueid':{'type':Sequelize[_0x27f0('0x2')]},'messageId':{'type':Sequelize[_0x27f0('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x27f0('0x2')]},'from':{'type':Sequelize[_0x27f0('0x2')]},'to':{'type':Sequelize[_0x27f0('0x2')]},'cc':{'type':Sequelize[_0x27f0('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x27f0('0x6')]},'text':{'type':Sequelize[_0x27f0('0x6')]},'status':{'type':Sequelize[_0x27f0('0x7')]('SENT',_0x27f0('0x8'),_0x27f0('0x9'),_0x27f0('0xa'))},'url':{'type':Sequelize[_0x27f0('0x2')]},'app':{'type':Sequelize[_0x27f0('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x27f0('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 95714d6..3ebb041 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 _0x29ac=['end','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','params','find','create','body','catch','describe','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x59e68e,_0x1f5682){var _0x52fda0=function(_0x2a182d){while(--_0x2a182d){_0x59e68e['push'](_0x59e68e['shift']());}};_0x52fda0(++_0x1f5682);}(_0x29ac,0x1db));var _0xc29a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x29ac[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xc29a('0x0'));var rimraf=require(_0xc29a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc29a('0x2'));var rp=require(_0xc29a('0x3'));var moment=require('moment');var BPromise=require(_0xc29a('0x4'));var Mustache=require(_0xc29a('0x5'));var util=require('util');var path=require(_0xc29a('0x6'));var sox=require(_0xc29a('0x7'));var csv=require(_0xc29a('0x8'));var ejs=require(_0xc29a('0x9'));var fs=require('fs');var fs_extra=require(_0xc29a('0xa'));var _=require(_0xc29a('0xb'));var squel=require(_0xc29a('0xc'));var crypto=require(_0xc29a('0xd'));var jsforce=require(_0xc29a('0xe'));var deskjs=require(_0xc29a('0xf'));var toCsv=require(_0xc29a('0x8'));var querystring=require(_0xc29a('0x10'));var Papa=require(_0xc29a('0x11'));var Redis=require(_0xc29a('0x12'));var authService=require(_0xc29a('0x13'));var qs=require(_0xc29a('0x14'));var as=require(_0xc29a('0x15'));var hardwareService=require(_0xc29a('0x16'));var logger=require(_0xc29a('0x17'))(_0xc29a('0x18'));var utils=require('../../config/utils');var config=require(_0xc29a('0x19'));var licenseUtil=require(_0xc29a('0x1a'));var db=require(_0xc29a('0x1b'))['db'];function respondWithStatusCode(_0x365dc6,_0x1a406a){_0x1a406a=_0x1a406a||0xcc;return function(_0x5727e2){if(_0x5727e2){return _0x365dc6['sendStatus'](_0x1a406a);}return _0x365dc6[_0xc29a('0x1c')](_0x1a406a)[_0xc29a('0x1d')]();};}function respondWithResult(_0x2bd082,_0x3a76e5){_0x3a76e5=_0x3a76e5||0xc8;return function(_0x19ed0c){if(_0x19ed0c){return _0x2bd082[_0xc29a('0x1c')](_0x3a76e5)['json'](_0x19ed0c);}};}function respondWithFilteredResult(_0x57ef11,_0x277b5e){return function(_0xf29729){if(_0xf29729){var _0x255e39=typeof _0x277b5e[_0xc29a('0x1e')]===_0xc29a('0x1f')&&typeof _0x277b5e['limit']===_0xc29a('0x1f');var _0x1d128d=_0xf29729['count'];var _0x51c757=_0x255e39?0x0:_0x277b5e['offset'];var _0x42c4d0=_0x255e39?_0xf29729[_0xc29a('0x20')]:_0x277b5e[_0xc29a('0x1e')]+_0x277b5e['limit'];var _0x5779aa;if(_0x42c4d0>=_0x1d128d){_0x42c4d0=_0x1d128d;_0x5779aa=0xc8;}else{_0x5779aa=0xce;}_0x57ef11[_0xc29a('0x1c')](_0x5779aa);return _0x57ef11[_0xc29a('0x21')](_0xc29a('0x22'),_0x51c757+'-'+_0x42c4d0+'/'+_0x1d128d)[_0xc29a('0x23')](_0xf29729);}return null;};}function patchUpdates(_0x45e6ac){return function(_0x2df75a){try{jsonpatch['apply'](_0x2df75a,_0x45e6ac,!![]);}catch(_0x5892bd){return BPromise[_0xc29a('0x24')](_0x5892bd);}return _0x2df75a['save']();};}function saveUpdates(_0x5a2b64,_0x3f33e1){return function(_0x5258ab){if(_0x5258ab){return _0x5258ab[_0xc29a('0x25')](_0x5a2b64)[_0xc29a('0x26')](function(_0x3324a7){return _0x3324a7;});}return null;};}function removeEntity(_0xe6adb8,_0x538e67){return function(_0x472bf5){if(_0x472bf5){return _0x472bf5[_0xc29a('0x27')]()[_0xc29a('0x26')](function(){_0xe6adb8[_0xc29a('0x1c')](0xcc)[_0xc29a('0x1d')]();});}};}function handleEntityNotFound(_0x20cfea,_0x5ed79a){return function(_0x58adc2){if(!_0x58adc2){_0x20cfea['sendStatus'](0x194);}return _0x58adc2;};}function handleError(_0x934ce6,_0x57965e){_0x57965e=_0x57965e||0x1f4;return function(_0x27ac50){logger[_0xc29a('0x28')](_0x27ac50[_0xc29a('0x29')]);if(_0x27ac50[_0xc29a('0x2a')]){delete _0x27ac50[_0xc29a('0x2a')];}_0x934ce6['status'](_0x57965e)[_0xc29a('0x2b')](_0x27ac50);};}exports['index']=function(_0x33b5bf,_0x25baf4){var _0x143e39={},_0x3af8f5={},_0x59578c={'count':0x0,'rows':[]};var _0x555948=_['map'](db[_0xc29a('0x2c')][_0xc29a('0x2d')],function(_0x456387){return{'name':_0x456387[_0xc29a('0x2e')],'type':_0x456387[_0xc29a('0x2f')]['key']};});_0x3af8f5[_0xc29a('0x30')]=_['map'](_0x555948,'name');_0x3af8f5[_0xc29a('0x31')]=_[_0xc29a('0x32')](_0x33b5bf['query']);_0x3af8f5[_0xc29a('0x33')]=_[_0xc29a('0x34')](_0x3af8f5[_0xc29a('0x30')],_0x3af8f5[_0xc29a('0x31')]);_0x143e39[_0xc29a('0x35')]=_[_0xc29a('0x34')](_0x3af8f5[_0xc29a('0x30')],qs['fields'](_0x33b5bf[_0xc29a('0x31')][_0xc29a('0x36')]));_0x143e39[_0xc29a('0x35')]=_0x143e39['attributes']['length']?_0x143e39[_0xc29a('0x35')]:_0x3af8f5[_0xc29a('0x30')];if(!_0x33b5bf[_0xc29a('0x31')]['hasOwnProperty']('nolimit')){_0x143e39['limit']=qs[_0xc29a('0x37')](_0x33b5bf[_0xc29a('0x31')][_0xc29a('0x37')]);_0x143e39['offset']=qs[_0xc29a('0x1e')](_0x33b5bf[_0xc29a('0x31')]['offset']);}_0x143e39[_0xc29a('0x38')]=qs[_0xc29a('0x39')](_0x33b5bf['query'][_0xc29a('0x39')]);_0x143e39[_0xc29a('0x3a')]=qs[_0xc29a('0x33')](_[_0xc29a('0x3b')](_0x33b5bf[_0xc29a('0x31')],_0x3af8f5['filters']),_0x555948);if(_0x33b5bf[_0xc29a('0x31')]['filter']){_0x143e39['where']=_[_0xc29a('0x3c')](_0x143e39[_0xc29a('0x3a')],{'$or':_['map'](_0x555948,function(_0x4dba3c){if(_0x4dba3c[_0xc29a('0x2f')]!=='VIRTUAL'){var _0x33d1b7={};_0x33d1b7[_0x4dba3c[_0xc29a('0x2a')]]={'$like':'%'+_0x33b5bf[_0xc29a('0x31')][_0xc29a('0x3d')]+'%'};return _0x33d1b7;}})});}_0x143e39=_['merge']({},_0x143e39,_0x33b5bf[_0xc29a('0x3e')]);var _0x1f9bfe={'where':_0x143e39[_0xc29a('0x3a')]};return db[_0xc29a('0x2c')][_0xc29a('0x20')](_0x1f9bfe)[_0xc29a('0x26')](function(_0x5c652d){_0x59578c['count']=_0x5c652d;if(_0x33b5bf[_0xc29a('0x31')][_0xc29a('0x3f')]){_0x143e39[_0xc29a('0x40')]=[{'all':!![]}];}return db[_0xc29a('0x2c')]['findAll'](_0x143e39);})['then'](function(_0x3ffa38){_0x59578c[_0xc29a('0x41')]=_0x3ffa38;return _0x59578c;})[_0xc29a('0x26')](respondWithFilteredResult(_0x25baf4,_0x143e39))['catch'](handleError(_0x25baf4,null));};exports['show']=function(_0x46519d,_0x187465){var _0x536172={'raw':![],'where':{'id':_0x46519d[_0xc29a('0x42')]['id']}},_0x41414b={};_0x41414b[_0xc29a('0x30')]=_['keys'](db[_0xc29a('0x2c')][_0xc29a('0x2d')]);_0x41414b[_0xc29a('0x31')]=_['keys'](_0x46519d[_0xc29a('0x31')]);_0x41414b[_0xc29a('0x33')]=_[_0xc29a('0x34')](_0x41414b[_0xc29a('0x30')],_0x41414b[_0xc29a('0x31')]);_0x536172[_0xc29a('0x35')]=_[_0xc29a('0x34')](_0x41414b[_0xc29a('0x30')],qs[_0xc29a('0x36')](_0x46519d['query']['fields']));_0x536172[_0xc29a('0x35')]=_0x536172[_0xc29a('0x35')]['length']?_0x536172['attributes']:_0x41414b[_0xc29a('0x30')];if(_0x46519d[_0xc29a('0x31')][_0xc29a('0x3f')]){_0x536172[_0xc29a('0x40')]=[{'all':!![]}];}_0x536172=_['merge']({},_0x536172,_0x46519d[_0xc29a('0x3e')]);return db[_0xc29a('0x2c')][_0xc29a('0x43')](_0x536172)[_0xc29a('0x26')](handleEntityNotFound(_0x187465,null))[_0xc29a('0x26')](respondWithResult(_0x187465,null))['catch'](handleError(_0x187465,null));};exports[_0xc29a('0x44')]=function(_0x49caf9,_0x3bb31f){return db[_0xc29a('0x2c')][_0xc29a('0x44')](_0x49caf9[_0xc29a('0x45')],{})['then'](respondWithResult(_0x3bb31f,0xc9))[_0xc29a('0x46')](handleError(_0x3bb31f,null));};exports[_0xc29a('0x25')]=function(_0x21b9a8,_0xae5d5c){if(_0x21b9a8[_0xc29a('0x45')]['id']){delete _0x21b9a8[_0xc29a('0x45')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x21b9a8['params']['id']}})[_0xc29a('0x26')](handleEntityNotFound(_0xae5d5c,null))[_0xc29a('0x26')](saveUpdates(_0x21b9a8[_0xc29a('0x45')],null))[_0xc29a('0x26')](respondWithResult(_0xae5d5c,null))[_0xc29a('0x46')](handleError(_0xae5d5c,null));};exports[_0xc29a('0x27')]=function(_0x4b3ab2,_0x12406f){return db[_0xc29a('0x2c')]['find']({'where':{'id':_0x4b3ab2[_0xc29a('0x42')]['id']}})[_0xc29a('0x26')](handleEntityNotFound(_0x12406f,null))[_0xc29a('0x26')](removeEntity(_0x12406f,null))[_0xc29a('0x46')](handleError(_0x12406f,null));};exports[_0xc29a('0x47')]=function(_0x345ab4,_0x6b5465){return db[_0xc29a('0x2c')][_0xc29a('0x47')]()[_0xc29a('0x26')](respondWithResult(_0x6b5465,null))[_0xc29a('0x46')](handleError(_0x6b5465,null));}; \ No newline at end of file +var _0xd39b=['filter','where','merge','VIRTUAL','options','findAll','catch','params','rawAttributes','length','includeAll','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','filters'];(function(_0x712903,_0x999dad){var _0x474a06=function(_0x1932d7){while(--_0x1932d7){_0x712903['push'](_0x712903['shift']());}};_0x474a06(++_0x999dad);}(_0xd39b,0x138));var _0xbd39=function(_0x462ab0,_0x545049){_0x462ab0=_0x462ab0-0x0;var _0x161360=_0xd39b[_0x462ab0];return _0x161360;};'use strict';var emlformat=require(_0xbd39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd39('0x1'));var jsonpatch=require(_0xbd39('0x2'));var rp=require('request-promise');var moment=require(_0xbd39('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbd39('0x4'));var util=require(_0xbd39('0x5'));var path=require(_0xbd39('0x6'));var sox=require(_0xbd39('0x7'));var csv=require(_0xbd39('0x8'));var ejs=require(_0xbd39('0x9'));var fs=require('fs');var fs_extra=require(_0xbd39('0xa'));var _=require(_0xbd39('0xb'));var squel=require('squel');var crypto=require(_0xbd39('0xc'));var jsforce=require(_0xbd39('0xd'));var deskjs=require(_0xbd39('0xe'));var toCsv=require(_0xbd39('0x8'));var querystring=require(_0xbd39('0xf'));var Papa=require(_0xbd39('0x10'));var Redis=require('ioredis');var authService=require(_0xbd39('0x11'));var qs=require(_0xbd39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd39('0x13'));var logger=require('../../config/logger')(_0xbd39('0x14'));var utils=require(_0xbd39('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbd39('0x16'));var db=require(_0xbd39('0x17'))['db'];function respondWithStatusCode(_0x48c075,_0xd83a1){_0xd83a1=_0xd83a1||0xcc;return function(_0x1c55f8){if(_0x1c55f8){return _0x48c075[_0xbd39('0x18')](_0xd83a1);}return _0x48c075['status'](_0xd83a1)[_0xbd39('0x19')]();};}function respondWithResult(_0x86189f,_0x44da6f){_0x44da6f=_0x44da6f||0xc8;return function(_0x2cc36e){if(_0x2cc36e){return _0x86189f[_0xbd39('0x1a')](_0x44da6f)[_0xbd39('0x1b')](_0x2cc36e);}};}function respondWithFilteredResult(_0x3dfaa2,_0x23ccc7){return function(_0x307d38){if(_0x307d38){var _0x5d8ccc=typeof _0x23ccc7[_0xbd39('0x1c')]==='undefined'&&typeof _0x23ccc7[_0xbd39('0x1d')]===_0xbd39('0x1e');var _0x398c4d=_0x307d38[_0xbd39('0x1f')];var _0x3eef06=_0x5d8ccc?0x0:_0x23ccc7[_0xbd39('0x1c')];var _0x19268d=_0x5d8ccc?_0x307d38['count']:_0x23ccc7[_0xbd39('0x1c')]+_0x23ccc7['limit'];var _0x37b1a4;if(_0x19268d>=_0x398c4d){_0x19268d=_0x398c4d;_0x37b1a4=0xc8;}else{_0x37b1a4=0xce;}_0x3dfaa2[_0xbd39('0x1a')](_0x37b1a4);return _0x3dfaa2[_0xbd39('0x20')](_0xbd39('0x21'),_0x3eef06+'-'+_0x19268d+'/'+_0x398c4d)[_0xbd39('0x1b')](_0x307d38);}return null;};}function patchUpdates(_0xf8fa27){return function(_0x98140d){try{jsonpatch[_0xbd39('0x22')](_0x98140d,_0xf8fa27,!![]);}catch(_0x31cde8){return BPromise[_0xbd39('0x23')](_0x31cde8);}return _0x98140d[_0xbd39('0x24')]();};}function saveUpdates(_0x4aa0c7,_0x1a6755){return function(_0x4d67a1){if(_0x4d67a1){return _0x4d67a1[_0xbd39('0x25')](_0x4aa0c7)[_0xbd39('0x26')](function(_0x2b27af){return _0x2b27af;});}return null;};}function removeEntity(_0x395d8e,_0x3830cf){return function(_0x3ed11d){if(_0x3ed11d){return _0x3ed11d['destroy']()[_0xbd39('0x26')](function(){_0x395d8e[_0xbd39('0x1a')](0xcc)[_0xbd39('0x19')]();});}};}function handleEntityNotFound(_0x3acd27,_0x1d7e1f){return function(_0x17bb2e){if(!_0x17bb2e){_0x3acd27['sendStatus'](0x194);}return _0x17bb2e;};}function handleError(_0x4ca097,_0x45f754){_0x45f754=_0x45f754||0x1f4;return function(_0x1b4eb1){logger[_0xbd39('0x27')](_0x1b4eb1[_0xbd39('0x28')]);if(_0x1b4eb1['name']){delete _0x1b4eb1[_0xbd39('0x29')];}_0x4ca097[_0xbd39('0x1a')](_0x45f754)[_0xbd39('0x2a')](_0x1b4eb1);};}exports[_0xbd39('0x2b')]=function(_0x1228f3,_0x15f251){var _0x26c20a={},_0x3891d6={},_0x5b026f={'count':0x0,'rows':[]};var _0x30a7d4=_[_0xbd39('0x2c')](db[_0xbd39('0x2d')]['rawAttributes'],function(_0x20dd0f){return{'name':_0x20dd0f[_0xbd39('0x2e')],'type':_0x20dd0f[_0xbd39('0x2f')][_0xbd39('0x30')]};});_0x3891d6[_0xbd39('0x31')]=_[_0xbd39('0x2c')](_0x30a7d4,_0xbd39('0x29'));_0x3891d6[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x1228f3[_0xbd39('0x32')]);_0x3891d6['filters']=_[_0xbd39('0x34')](_0x3891d6[_0xbd39('0x31')],_0x3891d6[_0xbd39('0x32')]);_0x26c20a[_0xbd39('0x35')]=_[_0xbd39('0x34')](_0x3891d6['model'],qs[_0xbd39('0x36')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x36')]));_0x26c20a['attributes']=_0x26c20a['attributes']['length']?_0x26c20a['attributes']:_0x3891d6['model'];if(!_0x1228f3[_0xbd39('0x32')]['hasOwnProperty']('nolimit')){_0x26c20a['limit']=qs[_0xbd39('0x1d')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x1d')]);_0x26c20a[_0xbd39('0x1c')]=qs[_0xbd39('0x1c')](_0x1228f3[_0xbd39('0x32')][_0xbd39('0x1c')]);}_0x26c20a[_0xbd39('0x37')]=qs[_0xbd39('0x38')](_0x1228f3[_0xbd39('0x32')]['sort']);_0x26c20a['where']=qs['filters'](_['pick'](_0x1228f3[_0xbd39('0x32')],_0x3891d6[_0xbd39('0x39')]),_0x30a7d4);if(_0x1228f3[_0xbd39('0x32')][_0xbd39('0x3a')]){_0x26c20a[_0xbd39('0x3b')]=_[_0xbd39('0x3c')](_0x26c20a[_0xbd39('0x3b')],{'$or':_[_0xbd39('0x2c')](_0x30a7d4,function(_0x361e31){if(_0x361e31[_0xbd39('0x2f')]!==_0xbd39('0x3d')){var _0x41fdc7={};_0x41fdc7[_0x361e31[_0xbd39('0x29')]]={'$like':'%'+_0x1228f3[_0xbd39('0x32')][_0xbd39('0x3a')]+'%'};return _0x41fdc7;}})});}_0x26c20a=_['merge']({},_0x26c20a,_0x1228f3[_0xbd39('0x3e')]);var _0x5e2c07={'where':_0x26c20a[_0xbd39('0x3b')]};return db[_0xbd39('0x2d')]['count'](_0x5e2c07)[_0xbd39('0x26')](function(_0x27711c){_0x5b026f[_0xbd39('0x1f')]=_0x27711c;if(_0x1228f3[_0xbd39('0x32')]['includeAll']){_0x26c20a['include']=[{'all':!![]}];}return db[_0xbd39('0x2d')][_0xbd39('0x3f')](_0x26c20a);})[_0xbd39('0x26')](function(_0x1bebfc){_0x5b026f['rows']=_0x1bebfc;return _0x5b026f;})['then'](respondWithFilteredResult(_0x15f251,_0x26c20a))[_0xbd39('0x40')](handleError(_0x15f251,null));};exports['show']=function(_0x4750e4,_0x12d63d){var _0x95ce0d={'raw':![],'where':{'id':_0x4750e4[_0xbd39('0x41')]['id']}},_0x475272={};_0x475272[_0xbd39('0x31')]=_[_0xbd39('0x33')](db[_0xbd39('0x2d')][_0xbd39('0x42')]);_0x475272[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x4750e4['query']);_0x475272[_0xbd39('0x39')]=_['intersection'](_0x475272[_0xbd39('0x31')],_0x475272[_0xbd39('0x32')]);_0x95ce0d[_0xbd39('0x35')]=_['intersection'](_0x475272['model'],qs[_0xbd39('0x36')](_0x4750e4[_0xbd39('0x32')][_0xbd39('0x36')]));_0x95ce0d[_0xbd39('0x35')]=_0x95ce0d[_0xbd39('0x35')][_0xbd39('0x43')]?_0x95ce0d[_0xbd39('0x35')]:_0x475272[_0xbd39('0x31')];if(_0x4750e4[_0xbd39('0x32')][_0xbd39('0x44')]){_0x95ce0d['include']=[{'all':!![]}];}_0x95ce0d=_['merge']({},_0x95ce0d,_0x4750e4[_0xbd39('0x3e')]);return db[_0xbd39('0x2d')][_0xbd39('0x45')](_0x95ce0d)[_0xbd39('0x26')](handleEntityNotFound(_0x12d63d,null))[_0xbd39('0x26')](respondWithResult(_0x12d63d,null))['catch'](handleError(_0x12d63d,null));};exports[_0xbd39('0x46')]=function(_0x3f42c1,_0x435186){return db[_0xbd39('0x2d')][_0xbd39('0x46')](_0x3f42c1[_0xbd39('0x47')],{})[_0xbd39('0x26')](respondWithResult(_0x435186,0xc9))[_0xbd39('0x40')](handleError(_0x435186,null));};exports[_0xbd39('0x25')]=function(_0x3e1e05,_0xe07f0f){if(_0x3e1e05['body']['id']){delete _0x3e1e05['body']['id'];}return db[_0xbd39('0x2d')][_0xbd39('0x45')]({'where':{'id':_0x3e1e05[_0xbd39('0x41')]['id']}})[_0xbd39('0x26')](handleEntityNotFound(_0xe07f0f,null))['then'](saveUpdates(_0x3e1e05['body'],null))[_0xbd39('0x26')](respondWithResult(_0xe07f0f,null))[_0xbd39('0x40')](handleError(_0xe07f0f,null));};exports[_0xbd39('0x48')]=function(_0x31ebd0,_0x59a11c){return db[_0xbd39('0x2d')][_0xbd39('0x45')]({'where':{'id':_0x31ebd0['params']['id']}})[_0xbd39('0x26')](handleEntityNotFound(_0x59a11c,null))['then'](removeEntity(_0x59a11c,null))[_0xbd39('0x40')](handleError(_0x59a11c,null));};exports[_0xbd39('0x49')]=function(_0x132016,_0xc8dfd9){return db['IntegrationReport'][_0xbd39('0x49')]()[_0xbd39('0x26')](respondWithResult(_0xc8dfd9,null))[_0xbd39('0x40')](handleError(_0xc8dfd9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index f1c4866..be54c0d 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 _0x8841=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_integration'];(function(_0x31f6da,_0x378140){var _0x5dc7e4=function(_0x5981fc){while(--_0x5981fc){_0x31f6da['push'](_0x31f6da['shift']());}};_0x5dc7e4(++_0x378140);}(_0x8841,0x197));var _0x1884=function(_0x31e0f2,_0x1689ad){_0x31e0f2=_0x31e0f2-0x0;var _0xcfd6a1=_0x8841[_0x31e0f2];return _0xcfd6a1;};'use strict';var _=require(_0x1884('0x0'));var util=require('util');var logger=require(_0x1884('0x1'))('api');var moment=require(_0x1884('0x2'));var BPromise=require(_0x1884('0x3'));var rp=require(_0x1884('0x4'));var fs=require('fs');var path=require(_0x1884('0x5'));var rimraf=require(_0x1884('0x6'));var config=require(_0x1884('0x7'));var attributes=require('./integrationReport.attributes');module[_0x1884('0x8')]=function(_0x1e7dbc,_0x263f74){return _0x1e7dbc[_0x1884('0x9')]('IntegrationReport',attributes,{'tableName':_0x1884('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x535a=['../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x30fc6d,_0x1ccd9f){var _0x538a68=function(_0x367108){while(--_0x367108){_0x30fc6d['push'](_0x30fc6d['shift']());}};_0x538a68(++_0x1ccd9f);}(_0x535a,0x131));var _0xa535=function(_0x44bd70,_0x5a2f80){_0x44bd70=_0x44bd70-0x0;var _0xf09da9=_0x535a[_0x44bd70];return _0xf09da9;};'use strict';var _=require(_0xa535('0x0'));var util=require('util');var logger=require(_0xa535('0x1'))('api');var moment=require(_0xa535('0x2'));var BPromise=require(_0xa535('0x3'));var rp=require(_0xa535('0x4'));var fs=require('fs');var path=require(_0xa535('0x5'));var rimraf=require(_0xa535('0x6'));var config=require(_0xa535('0x7'));var attributes=require(_0xa535('0x8'));module[_0xa535('0x9')]=function(_0x554025,_0x13b0cb){return _0x554025[_0xa535('0xa')]('IntegrationReport',attributes,{'tableName':_0xa535('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index b6dad13..6e91ef3 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x83e551,_0x55a6bd){var _0x299bf6=function(_0x31744b){while(--_0x31744b){_0x83e551['push'](_0x83e551['shift']());}};_0x299bf6(++_0x55a6bd);}(_0xdb28,0x106));var _0x8db2=function(_0x2f1975,_0x1b9280){_0x2f1975=_0x2f1975-0x0;var _0x2b02c9=_0xdb28[_0x2f1975];return _0x2b02c9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x687b,0x14a));var _0xb687=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x687b[_0x3def1b];return _0x57340e;};'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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9109e66..3277896 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 _0xc76e=['isAuthenticated','index','get','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./interval.controller'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc76e,0x10c));var _0xec76=function(_0x15734c,_0x336997){_0x15734c=_0x15734c-0x0;var _0x1b7cbb=_0xc76e[_0x15734c];return _0x1b7cbb;};'use strict';var multer=require(_0xec76('0x0'));var util=require(_0xec76('0x1'));var path=require(_0xec76('0x2'));var timeout=require(_0xec76('0x3'));var express=require(_0xec76('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xec76('0x5'));var interaction=require(_0xec76('0x6'));var config=require('../../config/environment');var controller=require(_0xec76('0x7'));router['get']('/',auth[_0xec76('0x8')](),controller[_0xec76('0x9')]);router[_0xec76('0xa')](_0xec76('0xb'),auth[_0xec76('0x8')](),controller[_0xec76('0xc')]);router[_0xec76('0xa')](_0xec76('0xd'),auth[_0xec76('0x8')](),controller['getIntervals']);router[_0xec76('0xe')]('/',auth[_0xec76('0x8')](),controller['create']);router[_0xec76('0xe')](_0xec76('0xd'),auth['isAuthenticated'](),controller[_0xec76('0xf')]);router[_0xec76('0xe')](_0xec76('0x10'),auth[_0xec76('0x8')](),controller[_0xec76('0x11')]);router[_0xec76('0x12')](_0xec76('0xb'),auth[_0xec76('0x8')](),controller[_0xec76('0x13')]);router[_0xec76('0x14')](_0xec76('0xb'),auth[_0xec76('0x8')](),controller[_0xec76('0x15')]);module[_0xec76('0x16')]=router; \ No newline at end of file +var _0xf961=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete'];(function(_0x523ac4,_0x2c000f){var _0x289043=function(_0x595145){while(--_0x595145){_0x523ac4['push'](_0x523ac4['shift']());}};_0x289043(++_0x2c000f);}(_0xf961,0x1cf));var _0x1f96=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xf961[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var path=require(_0x1f96('0x2'));var timeout=require(_0x1f96('0x3'));var express=require('express');var router=express[_0x1f96('0x4')]();var fs_extra=require(_0x1f96('0x5'));var auth=require(_0x1f96('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f96('0x7'));var controller=require(_0x1f96('0x8'));router[_0x1f96('0x9')]('/',auth['isAuthenticated'](),controller[_0x1f96('0xa')]);router['get'](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0xd')]);router[_0x1f96('0x9')](_0x1f96('0xe'),auth[_0x1f96('0xc')](),controller['getIntervals']);router['post']('/',auth[_0x1f96('0xc')](),controller['create']);router[_0x1f96('0xf')](_0x1f96('0xe'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x10')]);router['post'](_0x1f96('0x11'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x12')]);router['put'](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller[_0x1f96('0x13')]);router[_0x1f96('0x14')](_0x1f96('0xb'),auth[_0x1f96('0xc')](),controller['destroy']);module[_0x1f96('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 8fe1b89..c5226c2 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 _0xf847=['exports','STRING','sequelize'];(function(_0x2808d0,_0x221a9f){var _0x3aef7c=function(_0x331dc1){while(--_0x331dc1){_0x2808d0['push'](_0x2808d0['shift']());}};_0x3aef7c(++_0x221a9f);}(_0xf847,0x92));var _0x7f84=function(_0x2afcae,_0x2630ef){_0x2afcae=_0x2afcae-0x0;var _0x349051=_0xf847[_0x2afcae];return _0x349051;};'use strict';var Sequelize=require(_0x7f84('0x0'));module[_0x7f84('0x1')]={'name':{'type':Sequelize[_0x7f84('0x2')]},'description':{'type':Sequelize[_0x7f84('0x2')]},'interval':{'type':Sequelize[_0x7f84('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xe37e=['sequelize','exports','STRING'];(function(_0xa73937,_0x29f9ce){var _0x2bbe3e=function(_0x48ed73){while(--_0x48ed73){_0xa73937['push'](_0xa73937['shift']());}};_0x2bbe3e(++_0x29f9ce);}(_0xe37e,0x8a));var _0xee37=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xe37e[_0x1f9f37];return _0x21c080;};'use strict';var Sequelize=require(_0xee37('0x0'));module[_0xee37('0x1')]={'name':{'type':Sequelize[_0xee37('0x2')]},'description':{'type':Sequelize[_0xee37('0x2')]},'interval':{'type':Sequelize[_0xee37('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 df9e29e..0bdce6f 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 _0x5047=['filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','params','keys','length','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','findOne','rawAttributes','hasOwnProperty','addIntervals','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','update','destroy','Intervals','then','name','send','index','map','Interval','fieldName','type','key','query'];(function(_0x32ea77,_0x400110){var _0x1c4b8e=function(_0x3c56e4){while(--_0x3c56e4){_0x32ea77['push'](_0x32ea77['shift']());}};_0x1c4b8e(++_0x400110);}(_0x5047,0xce));var _0x7504=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5047[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7504('0x0'));var rimraf=require(_0x7504('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7504('0x2'));var rp=require(_0x7504('0x3'));var moment=require(_0x7504('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7504('0x5'));var path=require('path');var sox=require(_0x7504('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7504('0x7'));var squel=require(_0x7504('0x8'));var crypto=require('crypto');var jsforce=require(_0x7504('0x9'));var deskjs=require(_0x7504('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7504('0xb'));var Papa=require(_0x7504('0xc'));var Redis=require('ioredis');var authService=require(_0x7504('0xd'));var qs=require(_0x7504('0xe'));var as=require(_0x7504('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7504('0x10'))(_0x7504('0x11'));var utils=require('../../config/utils');var config=require(_0x7504('0x12'));var licenseUtil=require(_0x7504('0x13'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2befb4,_0x1a4d04){_0x1a4d04=_0x1a4d04||0xcc;return function(_0x10eb6b){if(_0x10eb6b){return _0x2befb4['sendStatus'](_0x1a4d04);}return _0x2befb4[_0x7504('0x14')](_0x1a4d04)[_0x7504('0x15')]();};}function respondWithResult(_0x2cd4ef,_0x9672c9){_0x9672c9=_0x9672c9||0xc8;return function(_0x3bbdcf){if(_0x3bbdcf){return _0x2cd4ef[_0x7504('0x14')](_0x9672c9)[_0x7504('0x16')](_0x3bbdcf);}};}function respondWithFilteredResult(_0x390bee,_0x4afb2e){return function(_0x2a52bd){if(_0x2a52bd){var _0x42391d=typeof _0x4afb2e['offset']===_0x7504('0x17')&&typeof _0x4afb2e[_0x7504('0x18')]==='undefined';var _0x418dd2=_0x2a52bd[_0x7504('0x19')];var _0x4b03d5=_0x42391d?0x0:_0x4afb2e[_0x7504('0x1a')];var _0x520fa7=_0x42391d?_0x2a52bd[_0x7504('0x19')]:_0x4afb2e[_0x7504('0x1a')]+_0x4afb2e[_0x7504('0x18')];var _0x3d69a7;if(_0x520fa7>=_0x418dd2){_0x520fa7=_0x418dd2;_0x3d69a7=0xc8;}else{_0x3d69a7=0xce;}_0x390bee[_0x7504('0x14')](_0x3d69a7);return _0x390bee[_0x7504('0x1b')]('Content-Range',_0x4b03d5+'-'+_0x520fa7+'/'+_0x418dd2)[_0x7504('0x16')](_0x2a52bd);}return null;};}function patchUpdates(_0x24141d){return function(_0x1fb81c){try{jsonpatch[_0x7504('0x1c')](_0x1fb81c,_0x24141d,!![]);}catch(_0x15ef08){return BPromise[_0x7504('0x1d')](_0x15ef08);}return _0x1fb81c['save']();};}function saveUpdates(_0x2c68ba,_0x407e81){return function(_0x160a29){if(_0x160a29){return _0x160a29[_0x7504('0x1e')](_0x2c68ba)['then'](function(_0xfa1694){return _0xfa1694;});}return null;};}function removeEntity(_0x34b77e,_0x22c4f1){return function(_0x59e381){if(_0x59e381){return _0x59e381[_0x7504('0x1f')]()['then'](function(){var _0x3750ce=_0x59e381['get']({'plain':!![]});var _0x561540=_0x7504('0x20');return db['UserProfileResource'][_0x7504('0x1f')]({'where':{'type':_0x561540,'resourceId':_0x3750ce['id']}})[_0x7504('0x21')](function(){return _0x59e381;});})[_0x7504('0x21')](function(){_0x34b77e[_0x7504('0x14')](0xcc)[_0x7504('0x15')]();});}};}function handleEntityNotFound(_0x13ef32,_0x4015db){return function(_0x913ced){if(!_0x913ced){_0x13ef32['sendStatus'](0x194);}return _0x913ced;};}function handleError(_0x3f2567,_0x4d4b60){_0x4d4b60=_0x4d4b60||0x1f4;return function(_0xf0b998){logger['error'](_0xf0b998['stack']);if(_0xf0b998[_0x7504('0x22')]){delete _0xf0b998['name'];}_0x3f2567['status'](_0x4d4b60)[_0x7504('0x23')](_0xf0b998);};}exports[_0x7504('0x24')]=function(_0x31b522,_0x5de210){var _0x1bf019={},_0x17cafb={},_0xfe5129={'count':0x0,'rows':[]};var _0x246771=_[_0x7504('0x25')](db[_0x7504('0x26')]['rawAttributes'],function(_0x5ebd58){return{'name':_0x5ebd58[_0x7504('0x27')],'type':_0x5ebd58[_0x7504('0x28')][_0x7504('0x29')]};});_0x17cafb['model']=_['map'](_0x246771,'name');_0x17cafb['query']=_['keys'](_0x31b522[_0x7504('0x2a')]);_0x17cafb[_0x7504('0x2b')]=_[_0x7504('0x2c')](_0x17cafb[_0x7504('0x2d')],_0x17cafb[_0x7504('0x2a')]);_0x1bf019[_0x7504('0x2e')]=_[_0x7504('0x2c')](_0x17cafb[_0x7504('0x2d')],qs[_0x7504('0x2f')](_0x31b522[_0x7504('0x2a')][_0x7504('0x2f')]));_0x1bf019['attributes']=_0x1bf019[_0x7504('0x2e')]['length']?_0x1bf019[_0x7504('0x2e')]:_0x17cafb[_0x7504('0x2d')];if(!_0x31b522['query']['hasOwnProperty'](_0x7504('0x30'))){_0x1bf019[_0x7504('0x18')]=qs[_0x7504('0x18')](_0x31b522['query']['limit']);_0x1bf019[_0x7504('0x1a')]=qs[_0x7504('0x1a')](_0x31b522[_0x7504('0x2a')][_0x7504('0x1a')]);}_0x1bf019[_0x7504('0x31')]=qs[_0x7504('0x32')](_0x31b522[_0x7504('0x2a')]['sort']);_0x1bf019['where']=qs[_0x7504('0x2b')](_[_0x7504('0x33')](_0x31b522[_0x7504('0x2a')],_0x17cafb[_0x7504('0x2b')]),_0x246771);if(_0x31b522[_0x7504('0x2a')][_0x7504('0x34')]){_0x1bf019[_0x7504('0x35')]=_[_0x7504('0x36')](_0x1bf019[_0x7504('0x35')],{'$or':_['map'](_0x246771,function(_0x1e19df){if(_0x1e19df[_0x7504('0x28')]!==_0x7504('0x37')){var _0x10435a={};_0x10435a[_0x1e19df[_0x7504('0x22')]]={'$like':'%'+_0x31b522[_0x7504('0x2a')]['filter']+'%'};return _0x10435a;}})});}_0x1bf019=_[_0x7504('0x36')]({},_0x1bf019,_0x31b522['options']);var _0x1a708f={'where':_0x1bf019['where']};return db[_0x7504('0x26')]['count'](_0x1a708f)['then'](function(_0x304846){_0xfe5129[_0x7504('0x19')]=_0x304846;if(_0x31b522[_0x7504('0x2a')][_0x7504('0x38')]){_0x1bf019['include']=[{'all':!![]}];}return db[_0x7504('0x26')]['findAll'](_0x1bf019);})['then'](function(_0x84fd3c){_0xfe5129[_0x7504('0x39')]=_0x84fd3c;return _0xfe5129;})[_0x7504('0x21')](respondWithFilteredResult(_0x5de210,_0x1bf019))['catch'](handleError(_0x5de210,null));};exports[_0x7504('0x3a')]=function(_0x30e438,_0x1e19e0){var _0x1cd4d1={'raw':!![],'where':{'id':_0x30e438[_0x7504('0x3b')]['id']}},_0xdcbb8b={};_0xdcbb8b['model']=_[_0x7504('0x3c')](db[_0x7504('0x26')]['rawAttributes']);_0xdcbb8b['query']=_[_0x7504('0x3c')](_0x30e438['query']);_0xdcbb8b[_0x7504('0x2b')]=_['intersection'](_0xdcbb8b[_0x7504('0x2d')],_0xdcbb8b[_0x7504('0x2a')]);_0x1cd4d1['attributes']=_['intersection'](_0xdcbb8b[_0x7504('0x2d')],qs['fields'](_0x30e438[_0x7504('0x2a')][_0x7504('0x2f')]));_0x1cd4d1['attributes']=_0x1cd4d1[_0x7504('0x2e')][_0x7504('0x3d')]?_0x1cd4d1[_0x7504('0x2e')]:_0xdcbb8b[_0x7504('0x2d')];if(_0x30e438[_0x7504('0x2a')][_0x7504('0x38')]){_0x1cd4d1['include']=[{'all':!![]}];}_0x1cd4d1=_['merge']({},_0x1cd4d1,_0x30e438[_0x7504('0x3e')]);return db[_0x7504('0x26')]['find'](_0x1cd4d1)['then'](handleEntityNotFound(_0x1e19e0,null))[_0x7504('0x21')](respondWithResult(_0x1e19e0,null))[_0x7504('0x3f')](handleError(_0x1e19e0,null));};exports[_0x7504('0x40')]=function(_0x3b2f15,_0x3e8083){return db[_0x7504('0x26')][_0x7504('0x40')](_0x3b2f15[_0x7504('0x41')],{})[_0x7504('0x21')](function(_0x24725b){var _0x195e28=_0x3b2f15[_0x7504('0x42')][_0x7504('0x43')]({'plain':!![]});if(!_0x195e28)throw new Error(_0x7504('0x44'));if(_0x195e28[_0x7504('0x45')]===_0x7504('0x42')){var _0x18f2bb=_0x24725b[_0x7504('0x43')]({'plain':!![]});var _0x297422=_0x7504('0x20');return db[_0x7504('0x46')]['find']({'where':{'name':_0x297422,'userProfileId':_0x195e28['userProfileId']},'raw':!![]})[_0x7504('0x21')](function(_0x157176){if(_0x157176&&_0x157176[_0x7504('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x18f2bb['name'],'resourceId':_0x18f2bb['id'],'type':_0x157176[_0x7504('0x22')],'sectionId':_0x157176['id']},{})['then'](function(){return _0x24725b;});}else{return _0x24725b;}})[_0x7504('0x3f')](function(_0x4de121){logger[_0x7504('0x48')](_0x7504('0x49'),_0x4de121);throw _0x4de121;});}return _0x24725b;})['then'](respondWithResult(_0x3e8083,0xc9))[_0x7504('0x3f')](handleError(_0x3e8083,null));};exports[_0x7504('0x1e')]=function(_0x1fa5d2,_0x5ed8d1){if(_0x1fa5d2['body']['id']){delete _0x1fa5d2[_0x7504('0x41')]['id'];}return db[_0x7504('0x26')][_0x7504('0x4a')]({'where':{'id':_0x1fa5d2[_0x7504('0x3b')]['id']}})[_0x7504('0x21')](handleEntityNotFound(_0x5ed8d1,null))[_0x7504('0x21')](saveUpdates(_0x1fa5d2[_0x7504('0x41')],null))[_0x7504('0x21')](respondWithResult(_0x5ed8d1,null))[_0x7504('0x3f')](handleError(_0x5ed8d1,null));};exports[_0x7504('0x1f')]=function(_0x132d5e,_0xd20501){return db[_0x7504('0x26')][_0x7504('0x4a')]({'where':{'id':_0x132d5e['params']['id']}})[_0x7504('0x21')](handleEntityNotFound(_0xd20501,null))['then'](removeEntity(_0xd20501,null))[_0x7504('0x3f')](handleError(_0xd20501,null));};exports[_0x7504('0x4b')]=function(_0x35e0d9,_0x545e09,_0x296760){if(_0x35e0d9[_0x7504('0x41')]['id']){delete _0x35e0d9[_0x7504('0x41')]['id'];}return db['Interval'][_0x7504('0x4a')]({'where':{'id':_0x35e0d9['params']['id']}})['then'](handleEntityNotFound(_0x545e09,null))[_0x7504('0x21')](function(_0x2522c3){if(_0x2522c3){_0x35e0d9[_0x7504('0x41')][_0x7504('0x4c')]=_0x2522c3['id'];return db[_0x7504('0x26')]['create'](_0x35e0d9['body']);}})[_0x7504('0x21')](respondWithResult(_0x545e09,null))[_0x7504('0x3f')](handleError(_0x545e09,null));};exports[_0x7504('0x4d')]=function(_0x2bcea1,_0x27ef23,_0x4d8461){var _0x5b3c1f={};var _0x1c58dc={};var _0xf99903;var _0x3169f4;return db[_0x7504('0x26')][_0x7504('0x4e')]({'where':{'id':_0x2bcea1['params']['id']}})[_0x7504('0x21')](handleEntityNotFound(_0x27ef23,null))['then'](function(_0x29023e){if(_0x29023e){_0xf99903=_0x29023e;_0x1c58dc['model']=_['keys'](db[_0x7504('0x26')][_0x7504('0x4f')]);_0x1c58dc[_0x7504('0x2a')]=_[_0x7504('0x3c')](_0x2bcea1[_0x7504('0x2a')]);_0x1c58dc[_0x7504('0x2b')]=_['intersection'](_0x1c58dc[_0x7504('0x2d')],_0x1c58dc[_0x7504('0x2a')]);_0x5b3c1f[_0x7504('0x2e')]=_['intersection'](_0x1c58dc['model'],qs[_0x7504('0x2f')](_0x2bcea1[_0x7504('0x2a')][_0x7504('0x2f')]));_0x5b3c1f[_0x7504('0x2e')]=_0x5b3c1f[_0x7504('0x2e')]['length']?_0x5b3c1f[_0x7504('0x2e')]:_0x1c58dc[_0x7504('0x2d')];_0x5b3c1f[_0x7504('0x31')]=qs[_0x7504('0x32')](_0x2bcea1[_0x7504('0x2a')][_0x7504('0x32')]);_0x5b3c1f[_0x7504('0x35')]=qs[_0x7504('0x2b')](_[_0x7504('0x33')](_0x2bcea1['query'],_0x1c58dc[_0x7504('0x2b')]));if(_0x2bcea1[_0x7504('0x2a')][_0x7504('0x34')]){_0x5b3c1f[_0x7504('0x35')]=_[_0x7504('0x36')](_0x5b3c1f[_0x7504('0x35')],{'$or':_['map'](_0x5b3c1f[_0x7504('0x2e')],function(_0x35b44a){var _0x30e987={};_0x30e987[_0x35b44a]={'$like':'%'+_0x2bcea1[_0x7504('0x2a')]['filter']+'%'};return _0x30e987;})});}_0x5b3c1f=_[_0x7504('0x36')]({},_0x5b3c1f,_0x2bcea1['options']);return _0xf99903[_0x7504('0x4d')](_0x5b3c1f);}})[_0x7504('0x21')](function(_0x23db39){if(_0x23db39){_0x3169f4=_0x23db39[_0x7504('0x3d')];if(!_0x2bcea1[_0x7504('0x2a')][_0x7504('0x50')](_0x7504('0x30'))){_0x5b3c1f[_0x7504('0x18')]=qs[_0x7504('0x18')](_0x2bcea1[_0x7504('0x2a')][_0x7504('0x18')]);_0x5b3c1f[_0x7504('0x1a')]=qs['offset'](_0x2bcea1[_0x7504('0x2a')][_0x7504('0x1a')]);}return _0xf99903['getIntervals'](_0x5b3c1f);}})[_0x7504('0x21')](function(_0x46d836){if(_0x46d836){return _0x46d836?{'count':_0x3169f4,'rows':_0x46d836}:null;}})[_0x7504('0x21')](respondWithResult(_0x27ef23,null))[_0x7504('0x3f')](handleError(_0x27ef23,null));};exports[_0x7504('0x51')]=function(_0x42f018,_0x39f443,_0x13d37c){return db[_0x7504('0x26')][_0x7504('0x4e')]({'where':{'id':_0x42f018[_0x7504('0x3b')]['id']}})[_0x7504('0x21')](handleEntityNotFound(_0x39f443,null))[_0x7504('0x21')](function(_0xa911a4){if(_0xa911a4){return db['sequelize']['transaction'](function(_0x594e6c){return db[_0x7504('0x26')][_0x7504('0x1f')]({'where':{'IntervalId':_0x42f018['params']['id']},'transaction':_0x594e6c})[_0x7504('0x21')](function(_0x496b9f){var _0x4f558d=_['map'](_0x42f018[_0x7504('0x41')],function(_0x383aac){delete _0x383aac['id'];_0x383aac[_0x7504('0x4c')]=_0x42f018[_0x7504('0x3b')]['id'];return _0x383aac;});return db[_0x7504('0x26')][_0x7504('0x52')](_0x4f558d,{'transaction':_0x594e6c});});})['then'](function(){return db[_0x7504('0x26')]['findAll']({'where':{'IntervalId':_0x42f018[_0x7504('0x3b')]['id']}});});}})[_0x7504('0x21')](respondWithResult(_0x39f443,null))[_0x7504('0x3f')](handleError(_0x39f443,null));}; \ No newline at end of file +var _0xa8c2=['path','sox','to-csv','ejs','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','Intervals','error','stack','name','send','index','map','Interval','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','update','body','params','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x5a36e1,_0x3f552b){var _0x284436=function(_0x5b56b4){while(--_0x5b56b4){_0x5a36e1['push'](_0x5a36e1['shift']());}};_0x284436(++_0x3f552b);}(_0xa8c2,0xff));var _0x2a8c=function(_0x463a03,_0x13914f){_0x463a03=_0x463a03-0x0;var _0x5baa30=_0xa8c2[_0x463a03];return _0x5baa30;};'use strict';var emlformat=require(_0x2a8c('0x0'));var rimraf=require(_0x2a8c('0x1'));var zipdir=require(_0x2a8c('0x2'));var jsonpatch=require(_0x2a8c('0x3'));var rp=require(_0x2a8c('0x4'));var moment=require(_0x2a8c('0x5'));var BPromise=require(_0x2a8c('0x6'));var Mustache=require(_0x2a8c('0x7'));var util=require(_0x2a8c('0x8'));var path=require(_0x2a8c('0x9'));var sox=require(_0x2a8c('0xa'));var csv=require(_0x2a8c('0xb'));var ejs=require(_0x2a8c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a8c('0xd'));var squel=require(_0x2a8c('0xe'));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(_0x2a8c('0xf'));var Redis=require(_0x2a8c('0x10'));var authService=require(_0x2a8c('0x11'));var qs=require(_0x2a8c('0x12'));var as=require(_0x2a8c('0x13'));var hardwareService=require(_0x2a8c('0x14'));var logger=require(_0x2a8c('0x15'))('api');var utils=require(_0x2a8c('0x16'));var config=require(_0x2a8c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x41a415,_0x3faaaf){_0x3faaaf=_0x3faaaf||0xcc;return function(_0xfe5d42){if(_0xfe5d42){return _0x41a415[_0x2a8c('0x18')](_0x3faaaf);}return _0x41a415[_0x2a8c('0x19')](_0x3faaaf)[_0x2a8c('0x1a')]();};}function respondWithResult(_0x485299,_0x5ef278){_0x5ef278=_0x5ef278||0xc8;return function(_0xcf7ba4){if(_0xcf7ba4){return _0x485299[_0x2a8c('0x19')](_0x5ef278)[_0x2a8c('0x1b')](_0xcf7ba4);}};}function respondWithFilteredResult(_0x373360,_0x5019a2){return function(_0x3e9e40){if(_0x3e9e40){var _0x385531=typeof _0x5019a2[_0x2a8c('0x1c')]===_0x2a8c('0x1d')&&typeof _0x5019a2['limit']==='undefined';var _0x1d7c2c=_0x3e9e40[_0x2a8c('0x1e')];var _0x5b49d3=_0x385531?0x0:_0x5019a2[_0x2a8c('0x1c')];var _0x2adbaf=_0x385531?_0x3e9e40[_0x2a8c('0x1e')]:_0x5019a2['offset']+_0x5019a2[_0x2a8c('0x1f')];var _0x3ad641;if(_0x2adbaf>=_0x1d7c2c){_0x2adbaf=_0x1d7c2c;_0x3ad641=0xc8;}else{_0x3ad641=0xce;}_0x373360[_0x2a8c('0x19')](_0x3ad641);return _0x373360[_0x2a8c('0x20')](_0x2a8c('0x21'),_0x5b49d3+'-'+_0x2adbaf+'/'+_0x1d7c2c)[_0x2a8c('0x1b')](_0x3e9e40);}return null;};}function patchUpdates(_0x4c5c96){return function(_0x386457){try{jsonpatch[_0x2a8c('0x22')](_0x386457,_0x4c5c96,!![]);}catch(_0x53261d){return BPromise['reject'](_0x53261d);}return _0x386457[_0x2a8c('0x23')]();};}function saveUpdates(_0x349501,_0x5ac2ff){return function(_0x346251){if(_0x346251){return _0x346251['update'](_0x349501)[_0x2a8c('0x24')](function(_0x1ee313){return _0x1ee313;});}return null;};}function removeEntity(_0x4f59c4,_0x453ecb){return function(_0x2c9b1a){if(_0x2c9b1a){return _0x2c9b1a[_0x2a8c('0x25')]()[_0x2a8c('0x24')](function(){var _0x1d4fb2=_0x2c9b1a[_0x2a8c('0x26')]({'plain':!![]});var _0x4136de=_0x2a8c('0x27');return db['UserProfileResource'][_0x2a8c('0x25')]({'where':{'type':_0x4136de,'resourceId':_0x1d4fb2['id']}})[_0x2a8c('0x24')](function(){return _0x2c9b1a;});})[_0x2a8c('0x24')](function(){_0x4f59c4['status'](0xcc)[_0x2a8c('0x1a')]();});}};}function handleEntityNotFound(_0x352560,_0x548aeb){return function(_0x257206){if(!_0x257206){_0x352560[_0x2a8c('0x18')](0x194);}return _0x257206;};}function handleError(_0xe24de7,_0x23f087){_0x23f087=_0x23f087||0x1f4;return function(_0x4cd18f){logger[_0x2a8c('0x28')](_0x4cd18f[_0x2a8c('0x29')]);if(_0x4cd18f[_0x2a8c('0x2a')]){delete _0x4cd18f[_0x2a8c('0x2a')];}_0xe24de7['status'](_0x23f087)[_0x2a8c('0x2b')](_0x4cd18f);};}exports[_0x2a8c('0x2c')]=function(_0x32630d,_0x2b46ce){var _0x24a843={},_0x27bc62={},_0x5a99b4={'count':0x0,'rows':[]};var _0x3d9cfc=_[_0x2a8c('0x2d')](db[_0x2a8c('0x2e')]['rawAttributes'],function(_0x4acf21){return{'name':_0x4acf21[_0x2a8c('0x2f')],'type':_0x4acf21[_0x2a8c('0x30')]['key']};});_0x27bc62[_0x2a8c('0x31')]=_[_0x2a8c('0x2d')](_0x3d9cfc,_0x2a8c('0x2a'));_0x27bc62['query']=_[_0x2a8c('0x32')](_0x32630d[_0x2a8c('0x33')]);_0x27bc62[_0x2a8c('0x34')]=_['intersection'](_0x27bc62[_0x2a8c('0x31')],_0x27bc62[_0x2a8c('0x33')]);_0x24a843[_0x2a8c('0x35')]=_[_0x2a8c('0x36')](_0x27bc62[_0x2a8c('0x31')],qs['fields'](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0x24a843[_0x2a8c('0x35')]=_0x24a843[_0x2a8c('0x35')][_0x2a8c('0x38')]?_0x24a843[_0x2a8c('0x35')]:_0x27bc62['model'];if(!_0x32630d['query'][_0x2a8c('0x39')](_0x2a8c('0x3a'))){_0x24a843[_0x2a8c('0x1f')]=qs['limit'](_0x32630d[_0x2a8c('0x33')]['limit']);_0x24a843['offset']=qs[_0x2a8c('0x1c')](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x1c')]);}_0x24a843[_0x2a8c('0x3b')]=qs['sort'](_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x3c')]);_0x24a843[_0x2a8c('0x3d')]=qs['filters'](_[_0x2a8c('0x3e')](_0x32630d[_0x2a8c('0x33')],_0x27bc62['filters']),_0x3d9cfc);if(_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x3f')]){_0x24a843[_0x2a8c('0x3d')]=_[_0x2a8c('0x40')](_0x24a843[_0x2a8c('0x3d')],{'$or':_[_0x2a8c('0x2d')](_0x3d9cfc,function(_0x41a513){if(_0x41a513[_0x2a8c('0x30')]!==_0x2a8c('0x41')){var _0x9191ca={};_0x9191ca[_0x41a513[_0x2a8c('0x2a')]]={'$like':'%'+_0x32630d['query'][_0x2a8c('0x3f')]+'%'};return _0x9191ca;}})});}_0x24a843=_['merge']({},_0x24a843,_0x32630d[_0x2a8c('0x42')]);var _0x359770={'where':_0x24a843[_0x2a8c('0x3d')]};return db[_0x2a8c('0x2e')]['count'](_0x359770)[_0x2a8c('0x24')](function(_0x212e68){_0x5a99b4[_0x2a8c('0x1e')]=_0x212e68;if(_0x32630d[_0x2a8c('0x33')][_0x2a8c('0x43')]){_0x24a843[_0x2a8c('0x44')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x24a843);})[_0x2a8c('0x24')](function(_0x3e77db){_0x5a99b4[_0x2a8c('0x45')]=_0x3e77db;return _0x5a99b4;})[_0x2a8c('0x24')](respondWithFilteredResult(_0x2b46ce,_0x24a843))['catch'](handleError(_0x2b46ce,null));};exports['show']=function(_0x17bbe8,_0x1d3d9e){var _0xdc5639={'raw':!![],'where':{'id':_0x17bbe8['params']['id']}},_0x48e16c={};_0x48e16c[_0x2a8c('0x31')]=_[_0x2a8c('0x32')](db[_0x2a8c('0x2e')][_0x2a8c('0x46')]);_0x48e16c[_0x2a8c('0x33')]=_[_0x2a8c('0x32')](_0x17bbe8[_0x2a8c('0x33')]);_0x48e16c[_0x2a8c('0x34')]=_[_0x2a8c('0x36')](_0x48e16c['model'],_0x48e16c['query']);_0xdc5639[_0x2a8c('0x35')]=_['intersection'](_0x48e16c[_0x2a8c('0x31')],qs[_0x2a8c('0x37')](_0x17bbe8[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0xdc5639[_0x2a8c('0x35')]=_0xdc5639['attributes']['length']?_0xdc5639[_0x2a8c('0x35')]:_0x48e16c[_0x2a8c('0x31')];if(_0x17bbe8[_0x2a8c('0x33')][_0x2a8c('0x43')]){_0xdc5639[_0x2a8c('0x44')]=[{'all':!![]}];}_0xdc5639=_[_0x2a8c('0x40')]({},_0xdc5639,_0x17bbe8[_0x2a8c('0x42')]);return db[_0x2a8c('0x2e')][_0x2a8c('0x47')](_0xdc5639)[_0x2a8c('0x24')](handleEntityNotFound(_0x1d3d9e,null))[_0x2a8c('0x24')](respondWithResult(_0x1d3d9e,null))[_0x2a8c('0x48')](handleError(_0x1d3d9e,null));};exports[_0x2a8c('0x49')]=function(_0x42d782,_0x1e74d6){return db[_0x2a8c('0x2e')][_0x2a8c('0x49')](_0x42d782['body'],{})['then'](function(_0xfee574){var _0x507bef=_0x42d782[_0x2a8c('0x4a')][_0x2a8c('0x26')]({'plain':!![]});if(!_0x507bef)throw new Error(_0x2a8c('0x4b'));if(_0x507bef['role']==='user'){var _0x5f1e1a=_0xfee574[_0x2a8c('0x26')]({'plain':!![]});var _0x5b6e88=_0x2a8c('0x27');return db['UserProfileSection'][_0x2a8c('0x47')]({'where':{'name':_0x5b6e88,'userProfileId':_0x507bef['userProfileId']},'raw':!![]})[_0x2a8c('0x24')](function(_0x49ccdb){if(_0x49ccdb&&_0x49ccdb['autoAssociation']===0x0){return db[_0x2a8c('0x4c')]['create']({'name':_0x5f1e1a['name'],'resourceId':_0x5f1e1a['id'],'type':_0x49ccdb['name'],'sectionId':_0x49ccdb['id']},{})['then'](function(){return _0xfee574;});}else{return _0xfee574;}})[_0x2a8c('0x48')](function(_0x1f0cfc){logger[_0x2a8c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0cfc);throw _0x1f0cfc;});}return _0xfee574;})['then'](respondWithResult(_0x1e74d6,0xc9))[_0x2a8c('0x48')](handleError(_0x1e74d6,null));};exports[_0x2a8c('0x4d')]=function(_0x44aba5,_0x23d096){if(_0x44aba5[_0x2a8c('0x4e')]['id']){delete _0x44aba5['body']['id'];}return db[_0x2a8c('0x2e')][_0x2a8c('0x47')]({'where':{'id':_0x44aba5[_0x2a8c('0x4f')]['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x23d096,null))[_0x2a8c('0x24')](saveUpdates(_0x44aba5[_0x2a8c('0x4e')],null))[_0x2a8c('0x24')](respondWithResult(_0x23d096,null))['catch'](handleError(_0x23d096,null));};exports[_0x2a8c('0x25')]=function(_0x31808d,_0x3e90bc){return db[_0x2a8c('0x2e')][_0x2a8c('0x47')]({'where':{'id':_0x31808d[_0x2a8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3e90bc,null))['then'](removeEntity(_0x3e90bc,null))['catch'](handleError(_0x3e90bc,null));};exports[_0x2a8c('0x50')]=function(_0x485159,_0x57f702,_0x23b07a){if(_0x485159[_0x2a8c('0x4e')]['id']){delete _0x485159[_0x2a8c('0x4e')]['id'];}return db['Interval']['find']({'where':{'id':_0x485159['params']['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x57f702,null))[_0x2a8c('0x24')](function(_0x299b7f){if(_0x299b7f){_0x485159['body']['IntervalId']=_0x299b7f['id'];return db[_0x2a8c('0x2e')]['create'](_0x485159[_0x2a8c('0x4e')]);}})[_0x2a8c('0x24')](respondWithResult(_0x57f702,null))[_0x2a8c('0x48')](handleError(_0x57f702,null));};exports[_0x2a8c('0x51')]=function(_0x5a33db,_0x6636ea,_0xfda042){var _0x2df024={};var _0x490a57={};var _0x32019c;var _0x4f0f87;return db[_0x2a8c('0x2e')][_0x2a8c('0x52')]({'where':{'id':_0x5a33db[_0x2a8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6636ea,null))[_0x2a8c('0x24')](function(_0x17839d){if(_0x17839d){_0x32019c=_0x17839d;_0x490a57[_0x2a8c('0x31')]=_[_0x2a8c('0x32')](db[_0x2a8c('0x2e')][_0x2a8c('0x46')]);_0x490a57['query']=_['keys'](_0x5a33db[_0x2a8c('0x33')]);_0x490a57['filters']=_['intersection'](_0x490a57[_0x2a8c('0x31')],_0x490a57[_0x2a8c('0x33')]);_0x2df024[_0x2a8c('0x35')]=_[_0x2a8c('0x36')](_0x490a57['model'],qs[_0x2a8c('0x37')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x37')]));_0x2df024[_0x2a8c('0x35')]=_0x2df024[_0x2a8c('0x35')][_0x2a8c('0x38')]?_0x2df024[_0x2a8c('0x35')]:_0x490a57[_0x2a8c('0x31')];_0x2df024[_0x2a8c('0x3b')]=qs[_0x2a8c('0x3c')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x3c')]);_0x2df024[_0x2a8c('0x3d')]=qs['filters'](_['pick'](_0x5a33db[_0x2a8c('0x33')],_0x490a57[_0x2a8c('0x34')]));if(_0x5a33db['query'][_0x2a8c('0x3f')]){_0x2df024['where']=_[_0x2a8c('0x40')](_0x2df024[_0x2a8c('0x3d')],{'$or':_[_0x2a8c('0x2d')](_0x2df024[_0x2a8c('0x35')],function(_0xd6e6bf){var _0x2e6347={};_0x2e6347[_0xd6e6bf]={'$like':'%'+_0x5a33db['query'][_0x2a8c('0x3f')]+'%'};return _0x2e6347;})});}_0x2df024=_['merge']({},_0x2df024,_0x5a33db[_0x2a8c('0x42')]);return _0x32019c[_0x2a8c('0x51')](_0x2df024);}})['then'](function(_0xc06154){if(_0xc06154){_0x4f0f87=_0xc06154['length'];if(!_0x5a33db['query']['hasOwnProperty'](_0x2a8c('0x3a'))){_0x2df024[_0x2a8c('0x1f')]=qs[_0x2a8c('0x1f')](_0x5a33db['query']['limit']);_0x2df024['offset']=qs[_0x2a8c('0x1c')](_0x5a33db[_0x2a8c('0x33')][_0x2a8c('0x1c')]);}return _0x32019c['getIntervals'](_0x2df024);}})[_0x2a8c('0x24')](function(_0x3ef560){if(_0x3ef560){return _0x3ef560?{'count':_0x4f0f87,'rows':_0x3ef560}:null;}})[_0x2a8c('0x24')](respondWithResult(_0x6636ea,null))[_0x2a8c('0x48')](handleError(_0x6636ea,null));};exports['addIntervals']=function(_0x4f879f,_0x16a5a5,_0x2d773b){return db[_0x2a8c('0x2e')][_0x2a8c('0x52')]({'where':{'id':_0x4f879f['params']['id']}})[_0x2a8c('0x24')](handleEntityNotFound(_0x16a5a5,null))['then'](function(_0x7c2502){if(_0x7c2502){return db[_0x2a8c('0x53')][_0x2a8c('0x54')](function(_0x3b8320){return db['Interval']['destroy']({'where':{'IntervalId':_0x4f879f['params']['id']},'transaction':_0x3b8320})['then'](function(_0x58c305){var _0x29ae77=_[_0x2a8c('0x2d')](_0x4f879f[_0x2a8c('0x4e')],function(_0x206a00){delete _0x206a00['id'];_0x206a00[_0x2a8c('0x55')]=_0x4f879f[_0x2a8c('0x4f')]['id'];return _0x206a00;});return db['Interval'][_0x2a8c('0x56')](_0x29ae77,{'transaction':_0x3b8320});});})['then'](function(){return db[_0x2a8c('0x2e')][_0x2a8c('0x57')]({'where':{'IntervalId':_0x4f879f[_0x2a8c('0x4f')]['id']}});});}})[_0x2a8c('0x24')](respondWithResult(_0x16a5a5,null))[_0x2a8c('0x48')](handleError(_0x16a5a5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a4c0bc6..a5b5b4d 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 _0x3de6=['rimraf','../../components/extensions/rewrite','exports','define','Interval','rewrite','util','../../config/logger','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3de6,0x141));var _0x63de=function(_0x97da2d,_0x15a2ef){_0x97da2d=_0x97da2d-0x0;var _0x518de6=_0x3de6[_0x97da2d];return _0x518de6;};'use strict';var _=require('lodash');var util=require(_0x63de('0x0'));var logger=require(_0x63de('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x63de('0x2'));var rimraf=require(_0x63de('0x3'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x63de('0x4'));module[_0x63de('0x5')]=function(_0x4a8e17,_0x2b4f4b){return _0x4a8e17[_0x63de('0x6')](_0x63de('0x7'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50353f,_0x17beb9){extensions['rewrite'](_0x4a8e17,_0x50353f);},'afterBulkCreate':function(_0x40a328,_0x497124,_0x2557e3){_0x2557e3();extensions['rewrite'](_0x4a8e17,_0x40a328[0x0]);},'afterUpdate':function(_0x3c2cab,_0x3cdf04){extensions[_0x63de('0x8')](_0x4a8e17,_0x3c2cab);},'afterDestroy':function(_0x2bf4d2,_0x5a7ab8){extensions['rewrite'](_0x4a8e17,_0x2bf4d2);}}});}; \ No newline at end of file +var _0x36f2=['rewrite','lodash','../../config/logger','moment','path','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x36f2,0x9b));var _0x236f=function(_0x335687,_0xf33653){_0x335687=_0x335687-0x0;var _0x330d7e=_0x36f2[_0x335687];return _0x330d7e;};'use strict';var _=require(_0x236f('0x0'));var util=require('util');var logger=require(_0x236f('0x1'))('api');var moment=require(_0x236f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x236f('0x3'));var rimraf=require(_0x236f('0x4'));var config=require('../../config/environment');var attributes=require(_0x236f('0x5'));var extensions=require(_0x236f('0x6'));module[_0x236f('0x7')]=function(_0x546eae,_0x562f7c){return _0x546eae['define'](_0x236f('0x8'),attributes,{'tableName':_0x236f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20daee,_0xffd2b7){extensions[_0x236f('0xa')](_0x546eae,_0x20daee);},'afterBulkCreate':function(_0x2e7b4b,_0x16ce6c,_0x508d79){_0x508d79();extensions[_0x236f('0xa')](_0x546eae,_0x2e7b4b[0x0]);},'afterUpdate':function(_0x39b69b,_0x480f58){extensions[_0x236f('0xa')](_0x546eae,_0x39b69b);},'afterDestroy':function(_0x3bb719,_0x583b4a){extensions[_0x236f('0xa')](_0x546eae,_0x3bb719);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8539b9c..64d9ddc 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(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a3fe403..824cfb0 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0xa4daf9,_0x3bc711){var _0xc0465=function(_0x23237d){while(--_0x23237d){_0xa4daf9['push'](_0xa4daf9['shift']());}};_0xc0465(++_0x3bc711);}(_0xadb5,0xad));var _0x5adb=function(_0x17ba74,_0x267ce5){_0x17ba74=_0x17ba74-0x0;var _0x3c28b5=_0xadb5[_0x17ba74];return _0x3c28b5;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x3a5f51,_0x48a740){var _0x5d5d86=function(_0x151f4b){while(--_0x151f4b){_0x3a5f51['push'](_0x3a5f51['shift']());}};_0x5d5d86(++_0x48a740);}(_0xdb28,0x106));var _0x8db2=function(_0x45913d,_0x5668fe){_0x45913d=_0x45913d-0x0;var _0xcca703=_0xdb28[_0x45913d];return _0xcca703;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7eb94aa..d2c0751 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 _0xedcf=['track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','customfield_11503','customfield_11504','customfield_10102'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0xedcf,0x191));var _0xfedc=function(_0x18f284,_0x57ee39){_0x18f284=_0x18f284-0x0;var _0x4402a4=_0xedcf[_0x18f284];return _0x4402a4;};'use strict';var BPromise=require(_0xfedc('0x0'));var https=require('https');var logger=require(_0xfedc('0x1'))(_0xfedc('0x2'));var USERNAME=_0xfedc('0x3');var PASSWORD=_0xfedc('0x4');function openIssue(_0xc89f8d,_0x18ff33){var _0x2714f1={'fields':{'project':{'key':_0xc89f8d[_0xfedc('0x5')]||_0xfedc('0x6')},'summary':(_0xc89f8d[_0xfedc('0x7')]||_0xfedc('0x8'))+_0xfedc('0x9')+_0xc89f8d['ip'],'description':_0xc89f8d[_0xfedc('0xa')]||JSON[_0xfedc('0xb')](_0xc89f8d),'issuetype':{'name':_0xc89f8d['issuetype']||_0xfedc('0xc')}}};_0x2714f1['fields'][_0xfedc('0xd')]=_0xc89f8d[_0xfedc('0xe')];_0x2714f1['fields'][_0xfedc('0xf')]=_0xc89f8d[_0xfedc('0x10')];_0x2714f1[_0xfedc('0x11')][_0xfedc('0x12')]=_0xc89f8d['newToken'];_0x2714f1['fields'][_0xfedc('0x13')]=_0xc89f8d['name'];_0x2714f1[_0xfedc('0x11')][_0xfedc('0x14')]=_0xc89f8d['reason'];_0x2714f1['fields'][_0xfedc('0x15')]=_0xc89f8d['ip'];var _0x5c5b7b={'host':_0xfedc('0x16'),'port':0x1bb,'path':_0xfedc('0x17'),'method':_0xfedc('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xfedc('0x19'),'Authorization':_0xfedc('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xfedc('0x1b')]('base64')}};var _0x5ac9c3=JSON['stringify'](_0x2714f1);var _0x464f63=https[_0xfedc('0x1c')](_0x5c5b7b,function(_0x16b236){_0x16b236[_0xfedc('0x1d')](_0xfedc('0x1e'));var _0x103896='';_0x16b236['on']('data',function(_0x24279b){_0x103896+=_0x24279b;});_0x16b236['on'](_0xfedc('0x1f'),function(){if(_0x18ff33){return _0x18ff33[_0xfedc('0x20')](_0x16b236[_0xfedc('0x21')])[_0xfedc('0x22')](JSON[_0xfedc('0x23')](_0x103896));}});});_0x464f63['on'](_0xfedc('0x24'),function(_0x102914){if(_0x18ff33){return _0x18ff33[_0xfedc('0x20')](0x1f4)[_0xfedc('0x22')]({'errors':[{'message':_0xfedc('0x25'),'type':_0xfedc('0x26')}]});}});_0x464f63[_0xfedc('0x27')](_0x5ac9c3);_0x464f63[_0xfedc('0x1f')]();}exports[_0xfedc('0x28')]=openIssue;exports[_0xfedc('0x29')]=function(_0x3c6c13,_0x4f1c00){_0x3c6c13[_0xfedc('0x2a')]['ip']=_0x3c6c13['headers'][_0xfedc('0x2b')]||_0x3c6c13[_0xfedc('0x2c')][_0xfedc('0x2d')]||_0x3c6c13[_0xfedc('0x2e')]['remoteAddress']||_0x3c6c13[_0xfedc('0x2c')][_0xfedc('0x2e')][_0xfedc('0x2d')];return openIssue(_0x3c6c13[_0xfedc('0x2a')],_0x4f1c00);}; \ No newline at end of file +var _0x6d40=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','setEncoding','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','https','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x383ef6,_0x36d43e){var _0x3dd3a9=function(_0x16933c){while(--_0x16933c){_0x383ef6['push'](_0x383ef6['shift']());}};_0x3dd3a9(++_0x36d43e);}(_0x6d40,0x97));var _0x06d4=function(_0x14871e,_0x247791){_0x14871e=_0x14871e-0x0;var _0x538226=_0x6d40[_0x14871e];return _0x538226;};'use strict';var BPromise=require('bluebird');var https=require(_0x06d4('0x0'));var logger=require('../../config/logger')(_0x06d4('0x1'));var USERNAME=_0x06d4('0x2');var PASSWORD=_0x06d4('0x3');function openIssue(_0x24a096,_0x46ac9c){var _0x1be6f5={'fields':{'project':{'key':_0x24a096[_0x06d4('0x4')]||_0x06d4('0x5')},'summary':(_0x24a096[_0x06d4('0x6')]||_0x06d4('0x7'))+_0x06d4('0x8')+_0x24a096['ip'],'description':_0x24a096[_0x06d4('0x9')]||JSON[_0x06d4('0xa')](_0x24a096),'issuetype':{'name':_0x24a096[_0x06d4('0xb')]||_0x06d4('0xc')}}};_0x1be6f5[_0x06d4('0xd')]['customfield_11500']=_0x24a096['email'];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0xe')]=_0x24a096[_0x06d4('0xf')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x10')]=_0x24a096[_0x06d4('0x11')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x12')]=_0x24a096[_0x06d4('0x13')];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x14')]=_0x24a096['reason'];_0x1be6f5[_0x06d4('0xd')][_0x06d4('0x15')]=_0x24a096['ip'];var _0x25301d={'host':_0x06d4('0x16'),'port':0x1bb,'path':_0x06d4('0x17'),'method':_0x06d4('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x06d4('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x06d4('0x1a')]('base64')}};var _0x4c19c6=JSON[_0x06d4('0xa')](_0x1be6f5);var _0x4378e9=https['request'](_0x25301d,function(_0x43aa57){_0x43aa57[_0x06d4('0x1b')]('utf8');var _0x5e8c07='';_0x43aa57['on'](_0x06d4('0x1c'),function(_0x1dc438){_0x5e8c07+=_0x1dc438;});_0x43aa57['on'](_0x06d4('0x1d'),function(){if(_0x46ac9c){return _0x46ac9c[_0x06d4('0x1e')](_0x43aa57[_0x06d4('0x1f')])[_0x06d4('0x20')](JSON[_0x06d4('0x21')](_0x5e8c07));}});});_0x4378e9['on']('error',function(_0x31275d){if(_0x46ac9c){return _0x46ac9c[_0x06d4('0x1e')](0x1f4)[_0x06d4('0x20')]({'errors':[{'message':_0x06d4('0x22'),'type':_0x06d4('0x23')}]});}});_0x4378e9['write'](_0x4c19c6);_0x4378e9['end']();}exports[_0x06d4('0x24')]=openIssue;exports[_0x06d4('0x25')]=function(_0x39a90c,_0xb10981){_0x39a90c[_0x06d4('0x26')]['ip']=_0x39a90c['headers'][_0x06d4('0x27')]||_0x39a90c[_0x06d4('0x28')]['remoteAddress']||_0x39a90c[_0x06d4('0x29')][_0x06d4('0x2a')]||_0x39a90c[_0x06d4('0x28')]['socket'][_0x06d4('0x2a')];return openIssue(_0x39a90c[_0x06d4('0x26')],_0xb10981);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c6c2270..78049b5 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x45552e,_0x11eaf8){_0x45552e=_0x45552e-0x0;var _0x53a45e=_0x17ba[_0x45552e];return _0x53a45e;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40ff79,_0x578a04){var _0x32234c=function(_0x1012fa){while(--_0x1012fa){_0x40ff79['push'](_0x40ff79['shift']());}};_0x32234c(++_0x578a04);}(_0x1339,0x1ed));var _0x9133=function(_0x84729e,_0x556434){_0x84729e=_0x84729e-0x0;var _0x33c775=_0x1339[_0x84729e];return _0x33c775;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('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 ccd7dc4..4e018db 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x80d539,_0x57ef44){_0x80d539=_0x80d539-0x0;var _0x4f0123=_0x7a54[_0x80d539];return _0x4f0123;};'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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x43454,_0x884929){_0x43454=_0x43454-0x0;var _0x556b04=_0x7a54[_0x43454];return _0x556b04;};'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 e1f8040..e0847e8 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 _0xdc97=['api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','JscriptyAnswerReport','include','rows','catch','params','rawAttributes','includeAll','find','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5820e8,_0x53e5b3){var _0x12e9cf=function(_0x5641c4){while(--_0x5641c4){_0x5820e8['push'](_0x5820e8['shift']());}};_0x12e9cf(++_0x53e5b3);}(_0xdc97,0x13b));var _0x7dc9=function(_0x391f5c,_0x50dc18){_0x391f5c=_0x391f5c-0x0;var _0x2b6b7f=_0xdc97[_0x391f5c];return _0x2b6b7f;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['map'](_0x14083d,_0x7dc9('0x24'));_0x1fcf0e[_0x7dc9('0x28')]=_[_0x7dc9('0x29')](_0x450124[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x2a')]=_[_0x7dc9('0x2b')](_0x1fcf0e['model'],_0x1fcf0e['query']);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e['model'],qs[_0x7dc9('0x2c')](_0x450124[_0x7dc9('0x28')][_0x7dc9('0x2c')]));_0x229f8e[_0x7dc9('0x2d')]=_0x229f8e[_0x7dc9('0x2d')][_0x7dc9('0x2e')]?_0x229f8e[_0x7dc9('0x2d')]:_0x1fcf0e[_0x7dc9('0x2f')];if(!_0x450124['query'][_0x7dc9('0x30')]('nolimit')){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124[_0x7dc9('0x28')][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query'][_0x7dc9('0x18')]);}_0x229f8e['order']=qs['sort'](_0x450124[_0x7dc9('0x28')][_0x7dc9('0x31')]);_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x2a')](_['pick'](_0x450124[_0x7dc9('0x28')],_0x1fcf0e[_0x7dc9('0x2a')]),_0x14083d);if(_0x450124[_0x7dc9('0x28')][_0x7dc9('0x33')]){_0x229f8e[_0x7dc9('0x32')]=_[_0x7dc9('0x34')](_0x229f8e[_0x7dc9('0x32')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x166906){if(_0x166906[_0x7dc9('0x35')]!==_0x7dc9('0x36')){var _0x3a8d80={};_0x3a8d80[_0x166906['name']]={'$like':'%'+_0x450124[_0x7dc9('0x28')][_0x7dc9('0x33')]+'%'};return _0x3a8d80;}})});}_0x229f8e=_[_0x7dc9('0x34')]({},_0x229f8e,_0x450124[_0x7dc9('0x37')]);var _0x4bcdce={'where':_0x229f8e[_0x7dc9('0x32')]};return db[_0x7dc9('0x38')][_0x7dc9('0x1b')](_0x4bcdce)[_0x7dc9('0x21')](function(_0x295853){_0x3c4379[_0x7dc9('0x1b')]=_0x295853;if(_0x450124['query']['includeAll']){_0x229f8e[_0x7dc9('0x39')]=[{'all':!![]}];}return db[_0x7dc9('0x38')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x4a37ec){_0x3c4379[_0x7dc9('0x3a')]=_0x4a37ec;return _0x3c4379;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3b')](handleError(_0x236d42,null));};exports['show']=function(_0x1d5671,_0x1df27f){var _0x1929b6={'raw':!![],'where':{'id':_0x1d5671[_0x7dc9('0x3c')]['id']}},_0x95513c={};_0x95513c[_0x7dc9('0x2f')]=_[_0x7dc9('0x29')](db['JscriptyAnswerReport'][_0x7dc9('0x3d')]);_0x95513c['query']=_['keys'](_0x1d5671[_0x7dc9('0x28')]);_0x95513c[_0x7dc9('0x2a')]=_[_0x7dc9('0x2b')](_0x95513c[_0x7dc9('0x2f')],_0x95513c[_0x7dc9('0x28')]);_0x1929b6[_0x7dc9('0x2d')]=_[_0x7dc9('0x2b')](_0x95513c[_0x7dc9('0x2f')],qs[_0x7dc9('0x2c')](_0x1d5671['query'][_0x7dc9('0x2c')]));_0x1929b6[_0x7dc9('0x2d')]=_0x1929b6[_0x7dc9('0x2d')][_0x7dc9('0x2e')]?_0x1929b6[_0x7dc9('0x2d')]:_0x95513c[_0x7dc9('0x2f')];if(_0x1d5671['query'][_0x7dc9('0x3e')]){_0x1929b6[_0x7dc9('0x39')]=[{'all':!![]}];}_0x1929b6=_['merge']({},_0x1929b6,_0x1d5671[_0x7dc9('0x37')]);return db[_0x7dc9('0x38')][_0x7dc9('0x3f')](_0x1929b6)['then'](handleEntityNotFound(_0x1df27f,null))[_0x7dc9('0x21')](respondWithResult(_0x1df27f,null))['catch'](handleError(_0x1df27f,null));};exports['create']=function(_0x303795,_0x30a315){return db[_0x7dc9('0x38')]['create'](_0x303795['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x30a315,0xc9))['catch'](handleError(_0x30a315,null));};exports[_0x7dc9('0x20')]=function(_0x4ab558,_0x5e2d59){if(_0x4ab558[_0x7dc9('0x40')]['id']){delete _0x4ab558[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x38')][_0x7dc9('0x3f')]({'where':{'id':_0x4ab558[_0x7dc9('0x3c')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x5e2d59,null))[_0x7dc9('0x21')](saveUpdates(_0x4ab558[_0x7dc9('0x40')],null))[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,null))[_0x7dc9('0x3b')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x41')]=function(_0x13580b,_0x1658c0){return db['JscriptyAnswerReport'][_0x7dc9('0x3f')]({'where':{'id':_0x13580b['params']['id']}})['then'](handleEntityNotFound(_0x1658c0,null))[_0x7dc9('0x21')](removeEntity(_0x1658c0,null))[_0x7dc9('0x3b')](handleError(_0x1658c0,null));};exports[_0x7dc9('0x42')]=function(_0x3902aa,_0x346d27){return db['JscriptyAnswerReport'][_0x7dc9('0x42')]()[_0x7dc9('0x21')](respondWithResult(_0x346d27,null))[_0x7dc9('0x3b')](handleError(_0x346d27,null));}; \ No newline at end of file +var _0x29b1=['where','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x29b1,0x13b));var _0x129b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x29b1[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x129b('0x0'));var jsonpatch=require(_0x129b('0x1'));var rp=require(_0x129b('0x2'));var moment=require(_0x129b('0x3'));var BPromise=require(_0x129b('0x4'));var Mustache=require(_0x129b('0x5'));var util=require(_0x129b('0x6'));var path=require(_0x129b('0x7'));var sox=require(_0x129b('0x8'));var csv=require(_0x129b('0x9'));var ejs=require(_0x129b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x129b('0xb'));var squel=require('squel');var crypto=require(_0x129b('0xc'));var jsforce=require(_0x129b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x129b('0xe'));var Papa=require('papaparse');var Redis=require(_0x129b('0xf'));var authService=require(_0x129b('0x10'));var qs=require(_0x129b('0x11'));var as=require(_0x129b('0x12'));var hardwareService=require(_0x129b('0x13'));var logger=require(_0x129b('0x14'))('api');var utils=require(_0x129b('0x15'));var config=require(_0x129b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x129b('0x17'))['db'];function respondWithStatusCode(_0x1e5102,_0x4b8f35){_0x4b8f35=_0x4b8f35||0xcc;return function(_0x3cf7c5){if(_0x3cf7c5){return _0x1e5102[_0x129b('0x18')](_0x4b8f35);}return _0x1e5102[_0x129b('0x19')](_0x4b8f35)[_0x129b('0x1a')]();};}function respondWithResult(_0x379cd1,_0x4f3ff3){_0x4f3ff3=_0x4f3ff3||0xc8;return function(_0x94390d){if(_0x94390d){return _0x379cd1[_0x129b('0x19')](_0x4f3ff3)[_0x129b('0x1b')](_0x94390d);}};}function respondWithFilteredResult(_0x4edd0e,_0x139d4b){return function(_0x30beb8){if(_0x30beb8){var _0x5b49a8=typeof _0x139d4b[_0x129b('0x1c')]==='undefined'&&typeof _0x139d4b[_0x129b('0x1d')]===_0x129b('0x1e');var _0x1ba4c7=_0x30beb8[_0x129b('0x1f')];var _0x463095=_0x5b49a8?0x0:_0x139d4b[_0x129b('0x1c')];var _0x5d704e=_0x5b49a8?_0x30beb8[_0x129b('0x1f')]:_0x139d4b[_0x129b('0x1c')]+_0x139d4b['limit'];var _0x12899c;if(_0x5d704e>=_0x1ba4c7){_0x5d704e=_0x1ba4c7;_0x12899c=0xc8;}else{_0x12899c=0xce;}_0x4edd0e[_0x129b('0x19')](_0x12899c);return _0x4edd0e[_0x129b('0x20')](_0x129b('0x21'),_0x463095+'-'+_0x5d704e+'/'+_0x1ba4c7)[_0x129b('0x1b')](_0x30beb8);}return null;};}function patchUpdates(_0x1062ab){return function(_0x54c15b){try{jsonpatch[_0x129b('0x22')](_0x54c15b,_0x1062ab,!![]);}catch(_0x352dd4){return BPromise['reject'](_0x352dd4);}return _0x54c15b[_0x129b('0x23')]();};}function saveUpdates(_0x4ecb00,_0x352e71){return function(_0x575a01){if(_0x575a01){return _0x575a01[_0x129b('0x24')](_0x4ecb00)['then'](function(_0x26d9d5){return _0x26d9d5;});}return null;};}function removeEntity(_0x11f11c,_0x1c3022){return function(_0x5bae73){if(_0x5bae73){return _0x5bae73[_0x129b('0x25')]()[_0x129b('0x26')](function(){_0x11f11c[_0x129b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59819b,_0x458f11){return function(_0x168beb){if(!_0x168beb){_0x59819b['sendStatus'](0x194);}return _0x168beb;};}function handleError(_0x2aeaee,_0x17b6f4){_0x17b6f4=_0x17b6f4||0x1f4;return function(_0x245abd){logger[_0x129b('0x27')](_0x245abd[_0x129b('0x28')]);if(_0x245abd[_0x129b('0x29')]){delete _0x245abd[_0x129b('0x29')];}_0x2aeaee[_0x129b('0x19')](_0x17b6f4)[_0x129b('0x2a')](_0x245abd);};}exports[_0x129b('0x2b')]=function(_0x3979eb,_0xf262aa){var _0x15cf9b={},_0x1cbac9={},_0x424f90={'count':0x0,'rows':[]};var _0x1747c0=_['map'](db[_0x129b('0x2c')][_0x129b('0x2d')],function(_0x5c2b10){return{'name':_0x5c2b10[_0x129b('0x2e')],'type':_0x5c2b10[_0x129b('0x2f')]['key']};});_0x1cbac9['model']=_[_0x129b('0x30')](_0x1747c0,'name');_0x1cbac9[_0x129b('0x31')]=_[_0x129b('0x32')](_0x3979eb[_0x129b('0x31')]);_0x1cbac9[_0x129b('0x33')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],_0x1cbac9[_0x129b('0x31')]);_0x15cf9b[_0x129b('0x36')]=_[_0x129b('0x34')](_0x1cbac9[_0x129b('0x35')],qs[_0x129b('0x37')](_0x3979eb['query']['fields']));_0x15cf9b[_0x129b('0x36')]=_0x15cf9b[_0x129b('0x36')]['length']?_0x15cf9b[_0x129b('0x36')]:_0x1cbac9[_0x129b('0x35')];if(!_0x3979eb['query']['hasOwnProperty']('nolimit')){_0x15cf9b[_0x129b('0x1d')]=qs[_0x129b('0x1d')](_0x3979eb[_0x129b('0x31')]['limit']);_0x15cf9b['offset']=qs[_0x129b('0x1c')](_0x3979eb[_0x129b('0x31')][_0x129b('0x1c')]);}_0x15cf9b[_0x129b('0x38')]=qs[_0x129b('0x39')](_0x3979eb[_0x129b('0x31')][_0x129b('0x39')]);_0x15cf9b['where']=qs[_0x129b('0x33')](_[_0x129b('0x3a')](_0x3979eb[_0x129b('0x31')],_0x1cbac9[_0x129b('0x33')]),_0x1747c0);if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]){_0x15cf9b[_0x129b('0x3c')]=_[_0x129b('0x3d')](_0x15cf9b[_0x129b('0x3c')],{'$or':_[_0x129b('0x30')](_0x1747c0,function(_0x3d92f8){if(_0x3d92f8[_0x129b('0x2f')]!=='VIRTUAL'){var _0xabc270={};_0xabc270[_0x3d92f8[_0x129b('0x29')]]={'$like':'%'+_0x3979eb[_0x129b('0x31')][_0x129b('0x3b')]+'%'};return _0xabc270;}})});}_0x15cf9b=_['merge']({},_0x15cf9b,_0x3979eb[_0x129b('0x3e')]);var _0x503b07={'where':_0x15cf9b[_0x129b('0x3c')]};return db[_0x129b('0x2c')][_0x129b('0x1f')](_0x503b07)[_0x129b('0x26')](function(_0x348e06){_0x424f90[_0x129b('0x1f')]=_0x348e06;if(_0x3979eb[_0x129b('0x31')][_0x129b('0x3f')]){_0x15cf9b['include']=[{'all':!![]}];}return db[_0x129b('0x2c')][_0x129b('0x40')](_0x15cf9b);})[_0x129b('0x26')](function(_0x49bdce){_0x424f90[_0x129b('0x41')]=_0x49bdce;return _0x424f90;})[_0x129b('0x26')](respondWithFilteredResult(_0xf262aa,_0x15cf9b))[_0x129b('0x42')](handleError(_0xf262aa,null));};exports[_0x129b('0x43')]=function(_0x33c741,_0x14810f){var _0x5273c6={'raw':!![],'where':{'id':_0x33c741[_0x129b('0x44')]['id']}},_0x4b5b8d={};_0x4b5b8d[_0x129b('0x35')]=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x4b5b8d[_0x129b('0x31')]=_['keys'](_0x33c741['query']);_0x4b5b8d[_0x129b('0x33')]=_[_0x129b('0x34')](_0x4b5b8d['model'],_0x4b5b8d[_0x129b('0x31')]);_0x5273c6['attributes']=_[_0x129b('0x34')](_0x4b5b8d['model'],qs['fields'](_0x33c741[_0x129b('0x31')][_0x129b('0x37')]));_0x5273c6[_0x129b('0x36')]=_0x5273c6[_0x129b('0x36')][_0x129b('0x45')]?_0x5273c6['attributes']:_0x4b5b8d[_0x129b('0x35')];if(_0x33c741['query'][_0x129b('0x3f')]){_0x5273c6[_0x129b('0x46')]=[{'all':!![]}];}_0x5273c6=_[_0x129b('0x3d')]({},_0x5273c6,_0x33c741[_0x129b('0x3e')]);return db[_0x129b('0x2c')]['find'](_0x5273c6)[_0x129b('0x26')](handleEntityNotFound(_0x14810f,null))['then'](respondWithResult(_0x14810f,null))[_0x129b('0x42')](handleError(_0x14810f,null));};exports[_0x129b('0x47')]=function(_0xa0244d,_0x2f034e){return db[_0x129b('0x2c')][_0x129b('0x47')](_0xa0244d[_0x129b('0x48')],{})['then'](respondWithResult(_0x2f034e,0xc9))['catch'](handleError(_0x2f034e,null));};exports[_0x129b('0x24')]=function(_0x29bbcc,_0x1989f6){if(_0x29bbcc[_0x129b('0x48')]['id']){delete _0x29bbcc[_0x129b('0x48')]['id'];}return db[_0x129b('0x2c')][_0x129b('0x49')]({'where':{'id':_0x29bbcc[_0x129b('0x44')]['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x1989f6,null))['then'](saveUpdates(_0x29bbcc[_0x129b('0x48')],null))[_0x129b('0x26')](respondWithResult(_0x1989f6,null))['catch'](handleError(_0x1989f6,null));};exports[_0x129b('0x25')]=function(_0x2105c2,_0x173263){return db[_0x129b('0x2c')]['find']({'where':{'id':_0x2105c2['params']['id']}})[_0x129b('0x26')](handleEntityNotFound(_0x173263,null))[_0x129b('0x26')](removeEntity(_0x173263,null))[_0x129b('0x42')](handleError(_0x173263,null));};exports[_0x129b('0x4a')]=function(_0x22560b,_0x4317d1){return db[_0x129b('0x2c')][_0x129b('0x4a')]()[_0x129b('0x26')](respondWithResult(_0x4317d1,null))[_0x129b('0x42')](handleError(_0x4317d1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index be3f7ea..14fe8bc 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 _0xf55b=['bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xf55b,0x1ca));var _0xbf55=function(_0x1c47db,_0x3cf40b){_0x1c47db=_0x1c47db-0x0;var _0x36c734=_0xf55b[_0x1c47db];return _0x36c734;};'use strict';var _=require(_0xbf55('0x0'));var util=require(_0xbf55('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf55('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf55('0x3'));var config=require(_0xbf55('0x4'));var attributes=require(_0xbf55('0x5'));module[_0xbf55('0x6')]=function(_0x3372ae,_0x5d7219){return _0x3372ae[_0xbf55('0x7')](_0xbf55('0x8'),attributes,{'tableName':_0xbf55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x305e=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','lodash','api','moment','bluebird'];(function(_0x3b172e,_0x51c2e0){var _0x2e1b79=function(_0x5c8948){while(--_0x5c8948){_0x3b172e['push'](_0x3b172e['shift']());}};_0x2e1b79(++_0x51c2e0);}(_0x305e,0x9c));var _0xe305=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x305e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe305('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe305('0x1'));var moment=require(_0xe305('0x2'));var BPromise=require(_0xe305('0x3'));var rp=require(_0xe305('0x4'));var fs=require('fs');var path=require(_0xe305('0x5'));var rimraf=require(_0xe305('0x6'));var config=require(_0xe305('0x7'));var attributes=require(_0xe305('0x8'));module[_0xe305('0x9')]=function(_0x5536b3,_0x507ee6){return _0x5536b3['define']('JscriptyAnswerReport',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 c139504..1e7386a 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 _0x0426=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0xc44fd9,_0x2a2d4d){var _0x18a969=function(_0x5a7dd8){while(--_0x5a7dd8){_0xc44fd9['push'](_0xc44fd9['shift']());}};_0x18a969(++_0x2a2d4d);}(_0x0426,0x1d5));var _0x6042=function(_0x57fbf3,_0x450361){_0x57fbf3=_0x57fbf3-0x0;var _0x99aa2b=_0x0426[_0x57fbf3];return _0x99aa2b;};'use strict';var _=require(_0x6042('0x0'));var util=require(_0x6042('0x1'));var moment=require(_0x6042('0x2'));var BPromise=require('bluebird');var rs=require(_0x6042('0x3'));var fs=require('fs');var Redis=require(_0x6042('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6042('0x5'));var logger=require(_0x6042('0x6'))(_0x6042('0x7'));var config=require(_0x6042('0x8'));var jayson=require(_0x6042('0x9'));var client=jayson[_0x6042('0xa')][_0x6042('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x438e13,_0x50c796,_0x5ec376){return new BPromise(function(_0x542b32,_0x54958a){return client[_0x6042('0xc')](_0x438e13,_0x5ec376)[_0x6042('0xd')](function(_0x29ef8e){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x50c796,_0x6042('0xe'));logger[_0x6042('0xf')](_0x6042('0x10'),_0x50c796,'request\x20sent',JSON[_0x6042('0x11')](_0x29ef8e));if(_0x29ef8e['error']){if(_0x29ef8e['error'][_0x6042('0x12')]===0x1f4){logger[_0x6042('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x50c796,_0x29ef8e[_0x6042('0x13')]['message']);return _0x54958a(_0x29ef8e['error']['message']);}logger[_0x6042('0x13')](_0x6042('0x14'),_0x50c796,_0x29ef8e[_0x6042('0x13')][_0x6042('0x15')]);return _0x542b32(_0x29ef8e[_0x6042('0x13')][_0x6042('0x15')]);}else{logger[_0x6042('0x16')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x50c796,_0x6042('0xe'));_0x542b32(_0x29ef8e[_0x6042('0x17')]['message']);}})[_0x6042('0x18')](function(_0x22bc20){logger[_0x6042('0x13')](_0x6042('0x14'),_0x50c796,_0x22bc20);_0x54958a(_0x22bc20);});});} \ No newline at end of file +var _0x1b27=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b27,0xa3));var _0x71b2=function(_0x5e74d4,_0x102665){_0x5e74d4=_0x5e74d4-0x0;var _0x4ecc82=_0x1b27[_0x5e74d4];return _0x4ecc82;};'use strict';var _=require(_0x71b2('0x0'));var util=require(_0x71b2('0x1'));var moment=require('moment');var BPromise=require(_0x71b2('0x2'));var rs=require(_0x71b2('0x3'));var fs=require('fs');var Redis=require(_0x71b2('0x4'));var db=require(_0x71b2('0x5'))['db'];var utils=require(_0x71b2('0x6'));var logger=require(_0x71b2('0x7'))(_0x71b2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71b2('0x9')][_0x71b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406d17,_0x8fc6a0,_0xda57c5){return new BPromise(function(_0xfae2db,_0xac65d6){return client['request'](_0x406d17,_0xda57c5)[_0x71b2('0xb')](function(_0x321b2a){logger[_0x71b2('0xc')](_0x71b2('0xd'),_0x8fc6a0,_0x71b2('0xe'));logger[_0x71b2('0xf')](_0x71b2('0x10'),_0x8fc6a0,'request\x20sent',JSON[_0x71b2('0x11')](_0x321b2a));if(_0x321b2a[_0x71b2('0x12')]){if(_0x321b2a[_0x71b2('0x12')][_0x71b2('0x13')]===0x1f4){logger['error'](_0x71b2('0xd'),_0x8fc6a0,_0x321b2a['error'][_0x71b2('0x14')]);return _0xac65d6(_0x321b2a[_0x71b2('0x12')][_0x71b2('0x14')]);}logger[_0x71b2('0x12')](_0x71b2('0xd'),_0x8fc6a0,_0x321b2a['error'][_0x71b2('0x14')]);return _0xfae2db(_0x321b2a['error'][_0x71b2('0x14')]);}else{logger[_0x71b2('0xc')](_0x71b2('0xd'),_0x8fc6a0,_0x71b2('0xe'));_0xfae2db(_0x321b2a[_0x71b2('0x15')][_0x71b2('0x14')]);}})[_0x71b2('0x16')](function(_0x2f3421){logger[_0x71b2('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8fc6a0,_0x2f3421);_0xac65d6(_0x2f3421);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 989677d..7fb9059 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 _0x40bd=['fs-extra','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x437546,_0x334f47){var _0x36b04f=function(_0x1d580a){while(--_0x1d580a){_0x437546['push'](_0x437546['shift']());}};_0x36b04f(++_0x334f47);}(_0x40bd,0x1be));var _0xd40b=function(_0x1a95ff,_0x1efcb9){_0x1a95ff=_0x1a95ff-0x0;var _0x2bbddd=_0x40bd[_0x1a95ff];return _0x2bbddd;};'use strict';var multer=require(_0xd40b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd40b('0x1'));var express=require(_0xd40b('0x2'));var router=express[_0xd40b('0x3')]();var fs_extra=require(_0xd40b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd40b('0x5'));var config=require('../../config/environment');var controller=require(_0xd40b('0x6'));router[_0xd40b('0x7')]('/',auth[_0xd40b('0x8')](),controller['index']);router[_0xd40b('0x7')](_0xd40b('0x9'),auth['isAuthenticated'](),controller[_0xd40b('0xa')]);router[_0xd40b('0x7')](_0xd40b('0xb'),auth['isAuthenticated'](),controller[_0xd40b('0xc')]);router['get'](_0xd40b('0xd'),auth['isAuthenticated'](),controller[_0xd40b('0xe')]);router[_0xd40b('0x7')](_0xd40b('0xf'),auth[_0xd40b('0x8')](),timeout(_0xd40b('0x10')),controller[_0xd40b('0x11')]);router[_0xd40b('0x12')]('/',auth[_0xd40b('0x8')](),controller[_0xd40b('0x13')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0xd40b('0x14')]);router[_0xd40b('0x15')](_0xd40b('0x9'),auth[_0xd40b('0x8')](),controller['update']);router[_0xd40b('0x16')](_0xd40b('0x9'),auth[_0xd40b('0x8')](),controller[_0xd40b('0x17')]);module[_0xd40b('0x18')]=router; \ No newline at end of file +var _0x941d=['getSessions','getAnswers','/:id/summary','30s','post','/:id/clone','clone','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions'];(function(_0x270406,_0x29a99a){var _0x45aff6=function(_0x2a129e){while(--_0x2a129e){_0x270406['push'](_0x270406['shift']());}};_0x45aff6(++_0x29a99a);}(_0x941d,0xc1));var _0xd941=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x941d[_0x45bcb1];return _0x4bd6a3;};'use strict';var multer=require('multer');var util=require(_0xd941('0x0'));var path=require(_0xd941('0x1'));var timeout=require(_0xd941('0x2'));var express=require(_0xd941('0x3'));var router=express[_0xd941('0x4')]();var fs_extra=require(_0xd941('0x5'));var auth=require(_0xd941('0x6'));var interaction=require(_0xd941('0x7'));var config=require(_0xd941('0x8'));var controller=require(_0xd941('0x9'));router[_0xd941('0xa')]('/',auth[_0xd941('0xb')](),controller[_0xd941('0xc')]);router[_0xd941('0xa')](_0xd941('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd941('0xe'),auth[_0xd941('0xb')](),controller[_0xd941('0xf')]);router[_0xd941('0xa')]('/:id/answers',auth[_0xd941('0xb')](),controller[_0xd941('0x10')]);router[_0xd941('0xa')](_0xd941('0x11'),auth['isAuthenticated'](),timeout(_0xd941('0x12')),controller['getSummary']);router[_0xd941('0x13')]('/',auth[_0xd941('0xb')](),controller['create']);router[_0xd941('0x13')](_0xd941('0x14'),auth[_0xd941('0xb')](),controller[_0xd941('0x15')]);router['put'](_0xd941('0xd'),auth[_0xd941('0xb')](),controller[_0xd941('0x16')]);router[_0xd941('0x17')](_0xd941('0xd'),auth[_0xd941('0xb')](),controller[_0xd941('0x18')]);module[_0xd941('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index bfd248e..b7a1475 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 _0xc6ce=['isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long'];(function(_0x6369c0,_0xddda65){var _0x439f90=function(_0x334a5c){while(--_0x334a5c){_0x6369c0['push'](_0x6369c0['shift']());}};_0x439f90(++_0xddda65);}(_0xc6ce,0x15d));var _0xec6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc6ce[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xec6c('0x0'));var _=require(_0xec6c('0x1'));var util=require(_0xec6c('0x2'));module[_0xec6c('0x3')]={'name':{'type':Sequelize[_0xec6c('0x4')],'unique':_0xec6c('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xec6c('0x6')](_0xec6c('0x7')),'set':function(_0x3c115b){if(_[_0xec6c('0x8')](_0x3c115b)){this[_0xec6c('0x9')](_0xec6c('0xa'),JSON[_0xec6c('0xb')](_0x3c115b));}else if(_[_0xec6c('0xc')](_0x3c115b)){this['setDataValue']('formData',_0x3c115b);}else{this[_0xec6c('0x9')](_0xec6c('0xa'),util['format'](_0xec6c('0xd'),this['getDataValue']('name')||'',this[_0xec6c('0xe')](_0xec6c('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xec6c('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xec6c('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x892d=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','long','setDataValue','formData','stringify','isString'];(function(_0x1ce64b,_0x39f8c3){var _0x10cf3d=function(_0x372a7b){while(--_0x372a7b){_0x1ce64b['push'](_0x1ce64b['shift']());}};_0x10cf3d(++_0x39f8c3);}(_0x892d,0x16d));var _0xd892=function(_0x2fdaa5,_0x4c8149){_0x2fdaa5=_0x2fdaa5-0x0;var _0x34a511=_0x892d[_0x2fdaa5];return _0x34a511;};'use strict';var Sequelize=require(_0xd892('0x0'));var _=require(_0xd892('0x1'));var util=require(_0xd892('0x2'));module['exports']={'name':{'type':Sequelize[_0xd892('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd892('0x3')]},'formData':{'type':Sequelize[_0xd892('0x4')](_0xd892('0x5')),'set':function(_0x593b3b){if(_['isObjectLike'](_0x593b3b)){this[_0xd892('0x6')](_0xd892('0x7'),JSON[_0xd892('0x8')](_0x593b3b));}else if(_[_0xd892('0x9')](_0x593b3b)){this[_0xd892('0x6')](_0xd892('0x7'),_0x593b3b);}else{this['setDataValue'](_0xd892('0x7'),util[_0xd892('0xa')](_0xd892('0xb'),this['getDataValue']('name')||'',this[_0xd892('0xc')](_0xd892('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd892('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd892('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 7841481..01a62cd 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 _0xdabc=['indexOf','toString','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','status','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','JscriptyProject','rows','params','intersection','includeAll','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','role','getSessions','JscriptySessionReport','order','ProjectId','getAnswers','findOne','JscriptyAnswerReport','findAll','number','fromCharCode'];(function(_0x1f9e17,_0x127015){var _0x4fda50=function(_0x5c8ad4){while(--_0x5c8ad4){_0x1f9e17['push'](_0x1f9e17['shift']());}};_0x4fda50(++_0x127015);}(_0xdabc,0x16b));var _0xcdab=function(_0x3ebe6b,_0x50bbf7){_0x3ebe6b=_0x3ebe6b-0x0;var _0x334cfc=_0xdabc[_0x3ebe6b];return _0x334cfc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdab('0x0'));var zipdir=require(_0xcdab('0x1'));var jsonpatch=require(_0xcdab('0x2'));var rp=require('request-promise');var moment=require(_0xcdab('0x3'));var BPromise=require(_0xcdab('0x4'));var Mustache=require(_0xcdab('0x5'));var util=require(_0xcdab('0x6'));var path=require(_0xcdab('0x7'));var sox=require(_0xcdab('0x8'));var csv=require(_0xcdab('0x9'));var ejs=require(_0xcdab('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdab('0xb'));var squel=require(_0xcdab('0xc'));var crypto=require(_0xcdab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcdab('0xe'));var toCsv=require(_0xcdab('0x9'));var querystring=require(_0xcdab('0xf'));var Papa=require('papaparse');var Redis=require(_0xcdab('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcdab('0x11'));var as=require(_0xcdab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdab('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcdab('0x14'))['db'];function respondWithStatusCode(_0x414b10,_0xd7644a){_0xd7644a=_0xd7644a||0xcc;return function(_0xc6048d){if(_0xc6048d){return _0x414b10[_0xcdab('0x15')](_0xd7644a);}return _0x414b10['status'](_0xd7644a)['end']();};}function respondWithResult(_0x39a5ae,_0x30a596){_0x30a596=_0x30a596||0xc8;return function(_0x516186){if(_0x516186){return _0x39a5ae['status'](_0x30a596)['json'](_0x516186);}};}function respondWithFilteredResult(_0x22fa04,_0x31ba87){return function(_0x29c14c){if(_0x29c14c){var _0x12ea56=typeof _0x31ba87[_0xcdab('0x16')]===_0xcdab('0x17')&&typeof _0x31ba87['limit']==='undefined';var _0x2c099d=_0x29c14c[_0xcdab('0x18')];var _0x5e21e6=_0x12ea56?0x0:_0x31ba87[_0xcdab('0x16')];var _0xd529a=_0x12ea56?_0x29c14c['count']:_0x31ba87['offset']+_0x31ba87[_0xcdab('0x19')];var _0x536d2d;if(_0xd529a>=_0x2c099d){_0xd529a=_0x2c099d;_0x536d2d=0xc8;}else{_0x536d2d=0xce;}_0x22fa04['status'](_0x536d2d);return _0x22fa04[_0xcdab('0x1a')](_0xcdab('0x1b'),_0x5e21e6+'-'+_0xd529a+'/'+_0x2c099d)[_0xcdab('0x1c')](_0x29c14c);}return null;};}function patchUpdates(_0x43dd38){return function(_0x3479ee){try{jsonpatch['apply'](_0x3479ee,_0x43dd38,!![]);}catch(_0x32d72f){return BPromise[_0xcdab('0x1d')](_0x32d72f);}return _0x3479ee[_0xcdab('0x1e')]();};}function saveUpdates(_0x1b4126,_0x3c2d36){return function(_0x547832){if(_0x547832){return _0x547832[_0xcdab('0x1f')](_0x1b4126)[_0xcdab('0x20')](function(_0x2b9556){return _0x2b9556;});}return null;};}function removeEntity(_0x3999f0,_0x2abb32){return function(_0x3bb70a){if(_0x3bb70a){return _0x3bb70a[_0xcdab('0x21')]()[_0xcdab('0x20')](function(){var _0x3cb8bf=_0x3bb70a[_0xcdab('0x22')]({'plain':!![]});var _0x5dc824=_0xcdab('0x23');return db['UserProfileResource'][_0xcdab('0x21')]({'where':{'type':_0x5dc824,'resourceId':_0x3cb8bf['id']}})[_0xcdab('0x20')](function(){return _0x3bb70a;});})[_0xcdab('0x20')](function(){_0x3999f0[_0xcdab('0x24')](0xcc)[_0xcdab('0x25')]();});}};}function handleEntityNotFound(_0x5ca8c7,_0x3061ac){return function(_0x1b280d){if(!_0x1b280d){_0x5ca8c7[_0xcdab('0x15')](0x194);}return _0x1b280d;};}function handleError(_0x17efdb,_0x4e902c){_0x4e902c=_0x4e902c||0x1f4;return function(_0x1bd3c5){logger[_0xcdab('0x26')](_0x1bd3c5[_0xcdab('0x27')]);if(_0x1bd3c5[_0xcdab('0x28')]){delete _0x1bd3c5[_0xcdab('0x28')];}_0x17efdb[_0xcdab('0x24')](_0x4e902c)[_0xcdab('0x29')](_0x1bd3c5);};}exports['index']=function(_0x47441e,_0x401766){var _0x387846={},_0x278683={},_0x41aae1={'count':0x0,'rows':[]};var _0x4f258d=_[_0xcdab('0x2a')](db['JscriptyProject'][_0xcdab('0x2b')],function(_0x46b4b6){return{'name':_0x46b4b6[_0xcdab('0x2c')],'type':_0x46b4b6['type'][_0xcdab('0x2d')]};});_0x278683['model']=_[_0xcdab('0x2a')](_0x4f258d,_0xcdab('0x28'));_0x278683[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x47441e[_0xcdab('0x2e')]);_0x278683[_0xcdab('0x30')]=_['intersection'](_0x278683[_0xcdab('0x31')],_0x278683[_0xcdab('0x2e')]);_0x387846[_0xcdab('0x32')]=_['intersection'](_0x278683['model'],qs[_0xcdab('0x33')](_0x47441e[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x387846[_0xcdab('0x32')]=_0x387846['attributes'][_0xcdab('0x34')]?_0x387846[_0xcdab('0x32')]:_0x278683[_0xcdab('0x31')];if(!_0x47441e[_0xcdab('0x2e')][_0xcdab('0x35')](_0xcdab('0x36'))){_0x387846['limit']=qs['limit'](_0x47441e[_0xcdab('0x2e')]['limit']);_0x387846[_0xcdab('0x16')]=qs[_0xcdab('0x16')](_0x47441e[_0xcdab('0x2e')]['offset']);}_0x387846['order']=qs[_0xcdab('0x37')](_0x47441e[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x387846[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_[_0xcdab('0x39')](_0x47441e[_0xcdab('0x2e')],_0x278683[_0xcdab('0x30')]),_0x4f258d);if(_0x47441e['query'][_0xcdab('0x3a')]){_0x387846[_0xcdab('0x38')]=_[_0xcdab('0x3b')](_0x387846[_0xcdab('0x38')],{'$or':_['map'](_0x4f258d,function(_0x41b425){if(_0x41b425['type']!=='VIRTUAL'){var _0x1c644a={};_0x1c644a[_0x41b425[_0xcdab('0x28')]]={'$like':'%'+_0x47441e[_0xcdab('0x2e')]['filter']+'%'};return _0x1c644a;}})});}_0x387846=_[_0xcdab('0x3b')]({},_0x387846,_0x47441e[_0xcdab('0x3c')]);var _0x18afa1={'where':_0x387846[_0xcdab('0x38')]};return db['JscriptyProject'][_0xcdab('0x18')](_0x18afa1)['then'](function(_0x22b710){_0x41aae1[_0xcdab('0x18')]=_0x22b710;if(_0x47441e[_0xcdab('0x2e')]['includeAll']){_0x387846['include']=[{'all':!![]}];}return db[_0xcdab('0x3d')]['findAll'](_0x387846);})[_0xcdab('0x20')](function(_0x21b678){_0x41aae1[_0xcdab('0x3e')]=_0x21b678;return _0x41aae1;})[_0xcdab('0x20')](respondWithFilteredResult(_0x401766,_0x387846))['catch'](handleError(_0x401766,null));};exports['show']=function(_0x286867,_0x2fc565){var _0x432092={'raw':![],'where':{'id':_0x286867[_0xcdab('0x3f')]['id']}},_0x10d0bd={};_0x10d0bd[_0xcdab('0x31')]=_['keys'](db[_0xcdab('0x3d')][_0xcdab('0x2b')]);_0x10d0bd[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x286867[_0xcdab('0x2e')]);_0x10d0bd[_0xcdab('0x30')]=_[_0xcdab('0x40')](_0x10d0bd[_0xcdab('0x31')],_0x10d0bd[_0xcdab('0x2e')]);_0x432092['attributes']=_[_0xcdab('0x40')](_0x10d0bd[_0xcdab('0x31')],qs['fields'](_0x286867[_0xcdab('0x2e')]['fields']));_0x432092[_0xcdab('0x32')]=_0x432092[_0xcdab('0x32')][_0xcdab('0x34')]?_0x432092[_0xcdab('0x32')]:_0x10d0bd['model'];if(_0x286867[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x432092[_0xcdab('0x42')]=[{'all':!![]}];}_0x432092=_['merge']({},_0x432092,_0x286867[_0xcdab('0x3c')]);return db[_0xcdab('0x3d')][_0xcdab('0x43')](_0x432092)[_0xcdab('0x20')](handleEntityNotFound(_0x2fc565,null))['then'](respondWithResult(_0x2fc565,null))[_0xcdab('0x44')](handleError(_0x2fc565,null));};exports[_0xcdab('0x45')]=function(_0x55032c,_0x303a25){return db[_0xcdab('0x3d')]['create'](_0x55032c[_0xcdab('0x46')],{})['then'](function(_0x88b8db){var _0x53eb2b=_0x55032c[_0xcdab('0x47')]['get']({'plain':!![]});if(!_0x53eb2b)throw new Error(_0xcdab('0x48'));if(_0x53eb2b['role']===_0xcdab('0x47')){var _0x56d737=_0x88b8db['get']({'plain':!![]});var _0x197bb0=_0xcdab('0x23');return db[_0xcdab('0x49')][_0xcdab('0x43')]({'where':{'name':_0x197bb0,'userProfileId':_0x53eb2b[_0xcdab('0x4a')]},'raw':!![]})[_0xcdab('0x20')](function(_0x358c65){if(_0x358c65&&_0x358c65[_0xcdab('0x4b')]===0x0){return db[_0xcdab('0x4c')][_0xcdab('0x45')]({'name':_0x56d737[_0xcdab('0x28')],'resourceId':_0x56d737['id'],'type':_0x358c65[_0xcdab('0x28')],'sectionId':_0x358c65['id']},{})['then'](function(){return _0x88b8db;});}else{return _0x88b8db;}})[_0xcdab('0x44')](function(_0x533574){logger[_0xcdab('0x26')](_0xcdab('0x4d'),_0x533574);throw _0x533574;});}return _0x88b8db;})[_0xcdab('0x20')](respondWithResult(_0x303a25,0xc9))[_0xcdab('0x44')](handleError(_0x303a25,null));};exports[_0xcdab('0x4e')]=function(_0x23a013,_0x5c29a7){var _0x41c1a2={'where':{'id':_0x23a013['params']['id']}},_0x18aa2a={};_0x18aa2a['model']=_[_0xcdab('0x2f')](db[_0xcdab('0x3d')][_0xcdab('0x2b')]);_0x41c1a2['attributes']=_[_0xcdab('0x40')](_0x18aa2a[_0xcdab('0x31')],qs['fields'](_0x23a013[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x41c1a2[_0xcdab('0x32')]=_0x41c1a2[_0xcdab('0x32')][_0xcdab('0x34')]?_0x41c1a2[_0xcdab('0x32')]:_0x18aa2a[_0xcdab('0x31')];if(_0x23a013[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x41c1a2['include']=[{'all':!![]}];}_0x41c1a2=_[_0xcdab('0x3b')]({},_0x41c1a2,_0x23a013[_0xcdab('0x3c')]);return db[_0xcdab('0x3d')][_0xcdab('0x43')](_0x41c1a2)[_0xcdab('0x20')](handleEntityNotFound(_0x5c29a7,null))[_0xcdab('0x20')](function(_0x8dc584){if(_0x8dc584){var _0x4d2dc1=_0x8dc584[_0xcdab('0x22')]({'plain':!![]});_0x4d2dc1=qs['omit'](_0x4d2dc1,['id',_0xcdab('0x4f'),'updatedAt']);_0x23a013[_0xcdab('0x46')]=_[_0xcdab('0x50')](_0x23a013['body'],['id','createdAt',_0xcdab('0x51')]);return db[_0xcdab('0x3d')][_0xcdab('0x45')](_[_0xcdab('0x3b')](_0x4d2dc1,_0x23a013[_0xcdab('0x46')]),{'include':_0x23a013[_0xcdab('0x2e')][_0xcdab('0x41')]?[{'all':!![]}]:undefined})[_0xcdab('0x20')](function(_0x23e685){var _0x31f288=_0x23a013[_0xcdab('0x47')][_0xcdab('0x22')]({'plain':!![]});if(!_0x31f288)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31f288[_0xcdab('0x52')]===_0xcdab('0x47')){var _0x4f08b0=_0x23e685[_0xcdab('0x22')]({'plain':!![]});var _0x423a88=_0xcdab('0x23');return db[_0xcdab('0x49')][_0xcdab('0x43')]({'where':{'name':_0x423a88,'userProfileId':_0x31f288['userProfileId']},'raw':!![]})['then'](function(_0x1e9cd9){if(_0x1e9cd9&&_0x1e9cd9[_0xcdab('0x4b')]===0x0){return db[_0xcdab('0x4c')][_0xcdab('0x45')]({'name':_0x4f08b0[_0xcdab('0x28')],'resourceId':_0x4f08b0['id'],'type':_0x1e9cd9[_0xcdab('0x28')],'sectionId':_0x1e9cd9['id']},{})[_0xcdab('0x20')](function(){return _0x23e685;});}else{return _0x23e685;}})[_0xcdab('0x44')](function(_0xaa4065){logger[_0xcdab('0x26')](_0xcdab('0x4d'),_0xaa4065);throw _0xaa4065;});}return _0x23e685;});}})[_0xcdab('0x20')](respondWithResult(_0x5c29a7,0xc9))['catch'](handleError(_0x5c29a7,null));};exports[_0xcdab('0x1f')]=function(_0x40fb8e,_0x1a08bf){if(_0x40fb8e[_0xcdab('0x46')]['id']){delete _0x40fb8e[_0xcdab('0x46')]['id'];}return db[_0xcdab('0x3d')]['find']({'where':{'id':_0x40fb8e[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x1a08bf,null))[_0xcdab('0x20')](saveUpdates(_0x40fb8e['body'],null))[_0xcdab('0x20')](respondWithResult(_0x1a08bf,null))[_0xcdab('0x44')](handleError(_0x1a08bf,null));};exports[_0xcdab('0x21')]=function(_0x4af13f,_0x55ee0b){return db[_0xcdab('0x3d')]['find']({'where':{'id':_0x4af13f[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x55ee0b,null))[_0xcdab('0x20')](removeEntity(_0x55ee0b,null))[_0xcdab('0x44')](handleError(_0x55ee0b,null));};exports[_0xcdab('0x53')]=function(_0x18b3ba,_0x567e90,_0x1ae695){var _0x4a9bac={'raw':!![],'where':{}};var _0x1a362d={};var _0x5d0a1d={'count':0x0,'rows':[]};return db[_0xcdab('0x3d')]['findOne']({'where':{'id':_0x18b3ba[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x567e90,null))[_0xcdab('0x20')](function(_0x13eacf){if(_0x13eacf){_0x1a362d['model']=_[_0xcdab('0x2f')](db[_0xcdab('0x54')][_0xcdab('0x2b')]);_0x1a362d[_0xcdab('0x2e')]=_[_0xcdab('0x2f')](_0x18b3ba[_0xcdab('0x2e')]);_0x1a362d[_0xcdab('0x30')]=_['intersection'](_0x1a362d[_0xcdab('0x31')],_0x1a362d[_0xcdab('0x2e')]);_0x4a9bac[_0xcdab('0x32')]=_[_0xcdab('0x40')](_0x1a362d[_0xcdab('0x31')],qs['fields'](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x4a9bac[_0xcdab('0x32')]=_0x4a9bac[_0xcdab('0x32')]['length']?_0x4a9bac[_0xcdab('0x32')]:_0x1a362d[_0xcdab('0x31')];if(!_0x18b3ba[_0xcdab('0x2e')]['hasOwnProperty'](_0xcdab('0x36'))){_0x4a9bac[_0xcdab('0x19')]=qs['limit'](_0x18b3ba['query']['limit']);_0x4a9bac['offset']=qs[_0xcdab('0x16')](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x16')]);}_0x4a9bac[_0xcdab('0x55')]=qs[_0xcdab('0x37')](_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x4a9bac[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_['pick'](_0x18b3ba[_0xcdab('0x2e')],_0x1a362d[_0xcdab('0x30')]));_0x4a9bac[_0xcdab('0x38')][_0xcdab('0x56')]=_0x13eacf['id'];if(_0x18b3ba[_0xcdab('0x2e')]['filter']){_0x4a9bac[_0xcdab('0x38')]=_['merge'](_0x4a9bac[_0xcdab('0x38')],{'$or':_['map'](_0x4a9bac[_0xcdab('0x32')],function(_0x4cccec){var _0x44f5ed={};_0x44f5ed[_0x4cccec]={'$like':'%'+_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x3a')]+'%'};return _0x44f5ed;})});}_0x4a9bac=_[_0xcdab('0x3b')]({},_0x4a9bac,_0x18b3ba[_0xcdab('0x3c')]);return db['JscriptySessionReport']['count']({'where':_0x4a9bac['where']})['then'](function(_0x3a199d){_0x5d0a1d[_0xcdab('0x18')]=_0x3a199d;if(_0x18b3ba[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x4a9bac[_0xcdab('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4a9bac);})[_0xcdab('0x20')](function(_0x204273){_0x5d0a1d[_0xcdab('0x3e')]=_0x204273;return _0x5d0a1d;});}})[_0xcdab('0x20')](respondWithFilteredResult(_0x567e90,_0x4a9bac))[_0xcdab('0x44')](handleError(_0x567e90,null));};exports[_0xcdab('0x57')]=function(_0x1df5df,_0x1feac9,_0x45229d){var _0x5dd1ab={'raw':!![],'where':{}};var _0x49fd95={};var _0x2dfb9d={'count':0x0,'rows':[]};return db[_0xcdab('0x3d')][_0xcdab('0x58')]({'where':{'id':_0x1df5df[_0xcdab('0x3f')]['id']}})[_0xcdab('0x20')](handleEntityNotFound(_0x1feac9,null))[_0xcdab('0x20')](function(_0x512bb9){if(_0x512bb9){_0x49fd95[_0xcdab('0x31')]=_['keys'](db['JscriptyAnswerReport'][_0xcdab('0x2b')]);_0x49fd95[_0xcdab('0x2e')]=_['keys'](_0x1df5df['query']);_0x49fd95[_0xcdab('0x30')]=_[_0xcdab('0x40')](_0x49fd95[_0xcdab('0x31')],_0x49fd95[_0xcdab('0x2e')]);_0x5dd1ab[_0xcdab('0x32')]=_['intersection'](_0x49fd95[_0xcdab('0x31')],qs[_0xcdab('0x33')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x33')]));_0x5dd1ab[_0xcdab('0x32')]=_0x5dd1ab[_0xcdab('0x32')][_0xcdab('0x34')]?_0x5dd1ab[_0xcdab('0x32')]:_0x49fd95[_0xcdab('0x31')];if(!_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x35')]('nolimit')){_0x5dd1ab['limit']=qs[_0xcdab('0x19')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x19')]);_0x5dd1ab[_0xcdab('0x16')]=qs['offset'](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x16')]);}_0x5dd1ab['order']=qs[_0xcdab('0x37')](_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x37')]);_0x5dd1ab[_0xcdab('0x38')]=qs[_0xcdab('0x30')](_[_0xcdab('0x39')](_0x1df5df[_0xcdab('0x2e')],_0x49fd95['filters']));_0x5dd1ab[_0xcdab('0x38')][_0xcdab('0x56')]=_0x512bb9['id'];if(_0x1df5df['query'][_0xcdab('0x3a')]){_0x5dd1ab[_0xcdab('0x38')]=_['merge'](_0x5dd1ab[_0xcdab('0x38')],{'$or':_[_0xcdab('0x2a')](_0x5dd1ab['attributes'],function(_0x339d98){var _0x4c0d53={};_0x4c0d53[_0x339d98]={'$like':'%'+_0x1df5df['query'][_0xcdab('0x3a')]+'%'};return _0x4c0d53;})});}_0x5dd1ab=_[_0xcdab('0x3b')]({},_0x5dd1ab,_0x1df5df[_0xcdab('0x3c')]);return db['JscriptyAnswerReport'][_0xcdab('0x18')]({'where':_0x5dd1ab[_0xcdab('0x38')]})['then'](function(_0x571405){_0x2dfb9d[_0xcdab('0x18')]=_0x571405;if(_0x1df5df[_0xcdab('0x2e')][_0xcdab('0x41')]){_0x5dd1ab[_0xcdab('0x42')]=[{'all':!![]}];}return db[_0xcdab('0x59')][_0xcdab('0x5a')](_0x5dd1ab);})[_0xcdab('0x20')](function(_0x4791c3){_0x2dfb9d[_0xcdab('0x3e')]=_0x4791c3;return _0x2dfb9d;});}})['then'](respondWithFilteredResult(_0x1feac9,_0x5dd1ab))[_0xcdab('0x44')](handleError(_0x1feac9,null));};function char(_0x128259){return _0xcdab('0x5b')===typeof _0x128259?String[_0xcdab('0x5c')]['apply'](null,arguments):_0x128259;}function needsEncapsulation(_0x5f5b4d){return!!_0x5f5b4d&&(_0x5f5b4d['toString']()[_0xcdab('0x5d')](char(0xd))>=0x0||_0x5f5b4d['toString']()[_0xcdab('0x5d')](char(0xa))>=0x0||_0x5f5b4d[_0xcdab('0x5e')]()[_0xcdab('0x5d')](char(0x2c))>=0x0||_0x5f5b4d[_0xcdab('0x5e')]()[_0xcdab('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x5c8b30){var _0x3fa63a=char(0x22),_0x52b6d9='\x5c'+char(0x22),_0x2005cd=_0x5c8b30['toString']()[_0xcdab('0x5f')](new RegExp(_0x3fa63a,'g'),_0x52b6d9);return _0x3fa63a+_0x2005cd+_0x3fa63a;}exports[_0xcdab('0x60')]=function(_0x566b8b,_0x48ab55,_0x406e43){var _0x4b9e2b,_0x1b5fdd;var _0x5c7cfc={'where':{'ProjectId':_0x566b8b[_0xcdab('0x3f')]['id']}};if(_0x566b8b[_0xcdab('0x2e')]['startTime']){_0x5c7cfc[_0xcdab('0x38')]['starttime']=JSON[_0xcdab('0x61')](_0x566b8b[_0xcdab('0x2e')]['startTime']);}return db['JscriptySessionReport'][_0xcdab('0x5a')](_0x5c7cfc)['then'](handleEntityNotFound(_0x48ab55,null))['then'](function(_0x25a546){if(_0x25a546){_0x4b9e2b=_0x25a546;return db[_0xcdab('0x62')][_0xcdab('0x5a')]({'where':{'SessionId':{'$in':_[_0xcdab('0x2a')](_0x4b9e2b,'id')},'ProjectId':_0x566b8b['params']['id']},'order':_0xcdab('0x63')});}})['then'](handleEntityNotFound(_0x48ab55,null))['then'](function(_0x3bddf7){if(_0x3bddf7){_0x1b5fdd=_0x3bddf7;var _0x1b83be={};for(var _0x2aad99=0x0,_0x182fd5=_0x1b5fdd[_0xcdab('0x34')];_0x2aad99<_0x182fd5;_0x2aad99++){if(!_0x1b83be[_0xcdab('0x35')](_0x1b5fdd[_0x2aad99][_0xcdab('0x64')])){_0x1b83be[_0x1b5fdd[_0x2aad99][_0xcdab('0x64')]]=needsEncapsulation(_0x1b5fdd[_0x2aad99][_0xcdab('0x65')])?encapsulate(_0x1b5fdd[_0x2aad99][_0xcdab('0x65')]):_0x1b5fdd[_0x2aad99][_0xcdab('0x65')];}}var _0x3cbea1=[],_0x244cf3={};for(var _0x1556c1=0x0,_0x462ae8=_0x4b9e2b[_0xcdab('0x34')];_0x1556c1<_0x462ae8;_0x1556c1++){_0x244cf3={'ProjectId':_0x566b8b[_0xcdab('0x3f')]['id'],'SessionId':_0x4b9e2b[_0x1556c1]['id'],'StartTime':moment(_0x4b9e2b[_0x1556c1][_0xcdab('0x66')])[_0xcdab('0x67')](_0xcdab('0x68'))};for(var _0x503098=0x0,_0x332448=_0x1b5fdd['length'];_0x503098<_0x332448;_0x503098++){if(_0x1b5fdd[_0x503098][_0xcdab('0x69')]==_0x4b9e2b[_0x1556c1]['id']&&_0x1b83be['hasOwnProperty'](_0x1b5fdd[_0x503098]['questionId'])){_0x244cf3[_0x1b83be[_0x1b5fdd[_0x503098][_0xcdab('0x64')]]]=_0x1b5fdd[_0x503098][_0xcdab('0x6a')];}}for(var _0x529caa in _0x1b83be){if(!_0x244cf3[_0xcdab('0x35')](_0x1b83be[_0x529caa])){_0x244cf3[_0x1b83be[_0x529caa]]=null;}}_0x3cbea1[_0xcdab('0x6b')](_0x244cf3);}return _0x3cbea1;}})[_0xcdab('0x20')](function(_0x1789b9){if(!_[_0xcdab('0x6c')](_0x1789b9)){var _0x20e4d9=toCsv(_0x1789b9);var _0x1ebc4f=Date['now']();fs['writeFileSync'](util[_0xcdab('0x67')](_0xcdab('0x6d'),_0x566b8b['params']['id'],_0x1ebc4f),_0x20e4d9);_0x48ab55[_0xcdab('0x6e')](_0xcdab('0x6f'),'attachment;\x20filename='+util[_0xcdab('0x67')](_0xcdab('0x70'),_0x566b8b[_0xcdab('0x3f')]['id'],_0x1ebc4f));_0x48ab55['setHeader'](_0xcdab('0x71'),'text/csv');return _0x48ab55['download'](util[_0xcdab('0x67')](_0xcdab('0x6d'),_0x566b8b[_0xcdab('0x3f')]['id'],_0x1ebc4f));}else{return _0x48ab55[_0xcdab('0x15')](0xcc);}})[_0xcdab('0x44')](handleError(_0x48ab55,null));}; \ No newline at end of file +var _0xdc7b=['undefined','limit','count','offset','set','reject','save','then','destroy','Projects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','params','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','filter','findAll','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','apply','indexOf','toString','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x45fca1,_0x4786c7){var _0x3e3cf1=function(_0x13be67){while(--_0x13be67){_0x45fca1['push'](_0x45fca1['shift']());}};_0x3e3cf1(++_0x4786c7);}(_0xdc7b,0x153));var _0xbdc7=function(_0x2d3fa2,_0x2a2b3e){_0x2d3fa2=_0x2d3fa2-0x0;var _0x5bb642=_0xdc7b[_0x2d3fa2];return _0x5bb642;};'use strict';var emlformat=require(_0xbdc7('0x0'));var rimraf=require(_0xbdc7('0x1'));var zipdir=require(_0xbdc7('0x2'));var jsonpatch=require(_0xbdc7('0x3'));var rp=require(_0xbdc7('0x4'));var moment=require(_0xbdc7('0x5'));var BPromise=require(_0xbdc7('0x6'));var Mustache=require('mustache');var util=require(_0xbdc7('0x7'));var path=require(_0xbdc7('0x8'));var sox=require(_0xbdc7('0x9'));var csv=require('to-csv');var ejs=require(_0xbdc7('0xa'));var fs=require('fs');var fs_extra=require(_0xbdc7('0xb'));var _=require(_0xbdc7('0xc'));var squel=require(_0xbdc7('0xd'));var crypto=require(_0xbdc7('0xe'));var jsforce=require(_0xbdc7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdc7('0x10'));var querystring=require(_0xbdc7('0x11'));var Papa=require(_0xbdc7('0x12'));var Redis=require(_0xbdc7('0x13'));var authService=require(_0xbdc7('0x14'));var qs=require(_0xbdc7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdc7('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xbdc7('0x17'));var config=require(_0xbdc7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdc7('0x19'))['db'];function respondWithStatusCode(_0x564745,_0x35c48b){_0x35c48b=_0x35c48b||0xcc;return function(_0x375900){if(_0x375900){return _0x564745[_0xbdc7('0x1a')](_0x35c48b);}return _0x564745[_0xbdc7('0x1b')](_0x35c48b)[_0xbdc7('0x1c')]();};}function respondWithResult(_0x18daec,_0x589967){_0x589967=_0x589967||0xc8;return function(_0x3045f3){if(_0x3045f3){return _0x18daec[_0xbdc7('0x1b')](_0x589967)[_0xbdc7('0x1d')](_0x3045f3);}};}function respondWithFilteredResult(_0x267145,_0x440282){return function(_0x35630a){if(_0x35630a){var _0x286a38=typeof _0x440282['offset']===_0xbdc7('0x1e')&&typeof _0x440282[_0xbdc7('0x1f')]===_0xbdc7('0x1e');var _0x4a1e1c=_0x35630a[_0xbdc7('0x20')];var _0x5677f9=_0x286a38?0x0:_0x440282[_0xbdc7('0x21')];var _0x5aa1bd=_0x286a38?_0x35630a['count']:_0x440282[_0xbdc7('0x21')]+_0x440282[_0xbdc7('0x1f')];var _0x55cfcc;if(_0x5aa1bd>=_0x4a1e1c){_0x5aa1bd=_0x4a1e1c;_0x55cfcc=0xc8;}else{_0x55cfcc=0xce;}_0x267145[_0xbdc7('0x1b')](_0x55cfcc);return _0x267145[_0xbdc7('0x22')]('Content-Range',_0x5677f9+'-'+_0x5aa1bd+'/'+_0x4a1e1c)['json'](_0x35630a);}return null;};}function patchUpdates(_0x56b9cc){return function(_0x554d54){try{jsonpatch['apply'](_0x554d54,_0x56b9cc,!![]);}catch(_0x322d28){return BPromise[_0xbdc7('0x23')](_0x322d28);}return _0x554d54[_0xbdc7('0x24')]();};}function saveUpdates(_0x4af89e,_0x5d6d2e){return function(_0x46640f){if(_0x46640f){return _0x46640f['update'](_0x4af89e)[_0xbdc7('0x25')](function(_0xa8d731){return _0xa8d731;});}return null;};}function removeEntity(_0x49d8e8,_0x224c4e){return function(_0x38d068){if(_0x38d068){return _0x38d068[_0xbdc7('0x26')]()[_0xbdc7('0x25')](function(){var _0x53a6e7=_0x38d068['get']({'plain':!![]});var _0x44f825=_0xbdc7('0x27');return db[_0xbdc7('0x28')][_0xbdc7('0x26')]({'where':{'type':_0x44f825,'resourceId':_0x53a6e7['id']}})[_0xbdc7('0x25')](function(){return _0x38d068;});})[_0xbdc7('0x25')](function(){_0x49d8e8[_0xbdc7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b0487,_0x207ee3){return function(_0x4d70ef){if(!_0x4d70ef){_0x2b0487[_0xbdc7('0x1a')](0x194);}return _0x4d70ef;};}function handleError(_0x401b46,_0x949cb0){_0x949cb0=_0x949cb0||0x1f4;return function(_0x2435fc){logger[_0xbdc7('0x29')](_0x2435fc[_0xbdc7('0x2a')]);if(_0x2435fc[_0xbdc7('0x2b')]){delete _0x2435fc[_0xbdc7('0x2b')];}_0x401b46[_0xbdc7('0x1b')](_0x949cb0)[_0xbdc7('0x2c')](_0x2435fc);};}exports[_0xbdc7('0x2d')]=function(_0x2ff8e3,_0x52e8b2){var _0x50e7fd={},_0x48c5d6={},_0x305e09={'count':0x0,'rows':[]};var _0x3955ff=_[_0xbdc7('0x2e')](db['JscriptyProject'][_0xbdc7('0x2f')],function(_0x4cad94){return{'name':_0x4cad94[_0xbdc7('0x30')],'type':_0x4cad94[_0xbdc7('0x31')][_0xbdc7('0x32')]};});_0x48c5d6['model']=_[_0xbdc7('0x2e')](_0x3955ff,_0xbdc7('0x2b'));_0x48c5d6[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x2ff8e3['query']);_0x48c5d6[_0xbdc7('0x35')]=_[_0xbdc7('0x36')](_0x48c5d6[_0xbdc7('0x37')],_0x48c5d6[_0xbdc7('0x33')]);_0x50e7fd[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x48c5d6[_0xbdc7('0x37')],qs[_0xbdc7('0x39')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x50e7fd[_0xbdc7('0x38')]=_0x50e7fd[_0xbdc7('0x38')][_0xbdc7('0x3a')]?_0x50e7fd['attributes']:_0x48c5d6['model'];if(!_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x3b')]('nolimit')){_0x50e7fd[_0xbdc7('0x1f')]=qs[_0xbdc7('0x1f')](_0x2ff8e3['query'][_0xbdc7('0x1f')]);_0x50e7fd[_0xbdc7('0x21')]=qs[_0xbdc7('0x21')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x21')]);}_0x50e7fd['order']=qs[_0xbdc7('0x3c')](_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x50e7fd[_0xbdc7('0x3d')]=qs[_0xbdc7('0x35')](_[_0xbdc7('0x3e')](_0x2ff8e3['query'],_0x48c5d6[_0xbdc7('0x35')]),_0x3955ff);if(_0x2ff8e3[_0xbdc7('0x33')]['filter']){_0x50e7fd[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x50e7fd[_0xbdc7('0x3d')],{'$or':_[_0xbdc7('0x2e')](_0x3955ff,function(_0x1db908){if(_0x1db908['type']!==_0xbdc7('0x40')){var _0x24abc9={};_0x24abc9[_0x1db908[_0xbdc7('0x2b')]]={'$like':'%'+_0x2ff8e3[_0xbdc7('0x33')]['filter']+'%'};return _0x24abc9;}})});}_0x50e7fd=_[_0xbdc7('0x3f')]({},_0x50e7fd,_0x2ff8e3[_0xbdc7('0x41')]);var _0x106540={'where':_0x50e7fd[_0xbdc7('0x3d')]};return db[_0xbdc7('0x42')][_0xbdc7('0x20')](_0x106540)[_0xbdc7('0x25')](function(_0x3b401a){_0x305e09[_0xbdc7('0x20')]=_0x3b401a;if(_0x2ff8e3[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x50e7fd[_0xbdc7('0x44')]=[{'all':!![]}];}return db[_0xbdc7('0x42')]['findAll'](_0x50e7fd);})[_0xbdc7('0x25')](function(_0xfc6a6f){_0x305e09[_0xbdc7('0x45')]=_0xfc6a6f;return _0x305e09;})['then'](respondWithFilteredResult(_0x52e8b2,_0x50e7fd))[_0xbdc7('0x46')](handleError(_0x52e8b2,null));};exports[_0xbdc7('0x47')]=function(_0x3fcb3d,_0x50db61){var _0x14584c={'raw':![],'where':{'id':_0x3fcb3d['params']['id']}},_0x14a1be={};_0x14a1be['model']=_[_0xbdc7('0x34')](db['JscriptyProject'][_0xbdc7('0x2f')]);_0x14a1be[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x3fcb3d[_0xbdc7('0x33')]);_0x14a1be[_0xbdc7('0x35')]=_['intersection'](_0x14a1be[_0xbdc7('0x37')],_0x14a1be[_0xbdc7('0x33')]);_0x14584c[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x14a1be[_0xbdc7('0x37')],qs['fields'](_0x3fcb3d['query'][_0xbdc7('0x39')]));_0x14584c[_0xbdc7('0x38')]=_0x14584c['attributes']['length']?_0x14584c[_0xbdc7('0x38')]:_0x14a1be[_0xbdc7('0x37')];if(_0x3fcb3d[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x14584c[_0xbdc7('0x44')]=[{'all':!![]}];}_0x14584c=_['merge']({},_0x14584c,_0x3fcb3d[_0xbdc7('0x41')]);return db[_0xbdc7('0x42')][_0xbdc7('0x48')](_0x14584c)[_0xbdc7('0x25')](handleEntityNotFound(_0x50db61,null))['then'](respondWithResult(_0x50db61,null))['catch'](handleError(_0x50db61,null));};exports['create']=function(_0x32e8ce,_0x1966ca){return db[_0xbdc7('0x42')][_0xbdc7('0x49')](_0x32e8ce[_0xbdc7('0x4a')],{})[_0xbdc7('0x25')](function(_0x4694f5){var _0x29d81b=_0x32e8ce[_0xbdc7('0x4b')][_0xbdc7('0x4c')]({'plain':!![]});if(!_0x29d81b)throw new Error(_0xbdc7('0x4d'));if(_0x29d81b[_0xbdc7('0x4e')]===_0xbdc7('0x4b')){var _0x37fe46=_0x4694f5[_0xbdc7('0x4c')]({'plain':!![]});var _0x18ebda=_0xbdc7('0x27');return db['UserProfileSection'][_0xbdc7('0x48')]({'where':{'name':_0x18ebda,'userProfileId':_0x29d81b['userProfileId']},'raw':!![]})['then'](function(_0x3d72b2){if(_0x3d72b2&&_0x3d72b2['autoAssociation']===0x0){return db[_0xbdc7('0x28')]['create']({'name':_0x37fe46[_0xbdc7('0x2b')],'resourceId':_0x37fe46['id'],'type':_0x3d72b2[_0xbdc7('0x2b')],'sectionId':_0x3d72b2['id']},{})[_0xbdc7('0x25')](function(){return _0x4694f5;});}else{return _0x4694f5;}})[_0xbdc7('0x46')](function(_0x1e6b79){logger[_0xbdc7('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e6b79);throw _0x1e6b79;});}return _0x4694f5;})[_0xbdc7('0x25')](respondWithResult(_0x1966ca,0xc9))['catch'](handleError(_0x1966ca,null));};exports['clone']=function(_0x15fa91,_0x554b68){var _0x267161={'where':{'id':_0x15fa91[_0xbdc7('0x4f')]['id']}},_0x4817c0={};_0x4817c0[_0xbdc7('0x37')]=_[_0xbdc7('0x34')](db[_0xbdc7('0x42')][_0xbdc7('0x2f')]);_0x267161[_0xbdc7('0x38')]=_['intersection'](_0x4817c0[_0xbdc7('0x37')],qs[_0xbdc7('0x39')](_0x15fa91[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x267161['attributes']=_0x267161[_0xbdc7('0x38')][_0xbdc7('0x3a')]?_0x267161[_0xbdc7('0x38')]:_0x4817c0[_0xbdc7('0x37')];if(_0x15fa91[_0xbdc7('0x33')][_0xbdc7('0x43')]){_0x267161[_0xbdc7('0x44')]=[{'all':!![]}];}_0x267161=_[_0xbdc7('0x3f')]({},_0x267161,_0x15fa91[_0xbdc7('0x41')]);return db[_0xbdc7('0x42')]['find'](_0x267161)['then'](handleEntityNotFound(_0x554b68,null))['then'](function(_0x31d64b){if(_0x31d64b){var _0x34d8fe=_0x31d64b[_0xbdc7('0x4c')]({'plain':!![]});_0x34d8fe=qs[_0xbdc7('0x50')](_0x34d8fe,['id',_0xbdc7('0x51'),_0xbdc7('0x52')]);_0x15fa91[_0xbdc7('0x4a')]=_['omit'](_0x15fa91[_0xbdc7('0x4a')],['id',_0xbdc7('0x51'),_0xbdc7('0x52')]);return db[_0xbdc7('0x42')][_0xbdc7('0x49')](_['merge'](_0x34d8fe,_0x15fa91['body']),{'include':_0x15fa91[_0xbdc7('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3283bd){var _0x1d6e17=_0x15fa91[_0xbdc7('0x4b')][_0xbdc7('0x4c')]({'plain':!![]});if(!_0x1d6e17)throw new Error(_0xbdc7('0x4d'));if(_0x1d6e17[_0xbdc7('0x4e')]===_0xbdc7('0x4b')){var _0x552118=_0x3283bd['get']({'plain':!![]});var _0x7dcf9c='Projects';return db['UserProfileSection'][_0xbdc7('0x48')]({'where':{'name':_0x7dcf9c,'userProfileId':_0x1d6e17[_0xbdc7('0x53')]},'raw':!![]})['then'](function(_0x572d83){if(_0x572d83&&_0x572d83[_0xbdc7('0x54')]===0x0){return db['UserProfileResource'][_0xbdc7('0x49')]({'name':_0x552118[_0xbdc7('0x2b')],'resourceId':_0x552118['id'],'type':_0x572d83['name'],'sectionId':_0x572d83['id']},{})[_0xbdc7('0x25')](function(){return _0x3283bd;});}else{return _0x3283bd;}})[_0xbdc7('0x46')](function(_0x47a11e){logger[_0xbdc7('0x29')](_0xbdc7('0x55'),_0x47a11e);throw _0x47a11e;});}return _0x3283bd;});}})[_0xbdc7('0x25')](respondWithResult(_0x554b68,0xc9))[_0xbdc7('0x46')](handleError(_0x554b68,null));};exports[_0xbdc7('0x56')]=function(_0x4813e4,_0x29b681){if(_0x4813e4['body']['id']){delete _0x4813e4[_0xbdc7('0x4a')]['id'];}return db[_0xbdc7('0x42')][_0xbdc7('0x48')]({'where':{'id':_0x4813e4[_0xbdc7('0x4f')]['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x29b681,null))[_0xbdc7('0x25')](saveUpdates(_0x4813e4['body'],null))[_0xbdc7('0x25')](respondWithResult(_0x29b681,null))['catch'](handleError(_0x29b681,null));};exports[_0xbdc7('0x26')]=function(_0x41f7b7,_0x374f1c){return db[_0xbdc7('0x42')][_0xbdc7('0x48')]({'where':{'id':_0x41f7b7['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x374f1c,null))[_0xbdc7('0x25')](removeEntity(_0x374f1c,null))[_0xbdc7('0x46')](handleError(_0x374f1c,null));};exports[_0xbdc7('0x57')]=function(_0x6d3020,_0xecbe2a,_0x3d4573){var _0x13aa7c={'raw':!![],'where':{}};var _0x3c8129={};var _0x1348ca={'count':0x0,'rows':[]};return db[_0xbdc7('0x42')][_0xbdc7('0x58')]({'where':{'id':_0x6d3020['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0xecbe2a,null))[_0xbdc7('0x25')](function(_0x667026){if(_0x667026){_0x3c8129['model']=_[_0xbdc7('0x34')](db[_0xbdc7('0x59')][_0xbdc7('0x2f')]);_0x3c8129[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x6d3020[_0xbdc7('0x33')]);_0x3c8129[_0xbdc7('0x35')]=_['intersection'](_0x3c8129[_0xbdc7('0x37')],_0x3c8129[_0xbdc7('0x33')]);_0x13aa7c['attributes']=_[_0xbdc7('0x36')](_0x3c8129['model'],qs['fields'](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x13aa7c[_0xbdc7('0x38')]=_0x13aa7c['attributes'][_0xbdc7('0x3a')]?_0x13aa7c[_0xbdc7('0x38')]:_0x3c8129[_0xbdc7('0x37')];if(!_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x3b')](_0xbdc7('0x5a'))){_0x13aa7c[_0xbdc7('0x1f')]=qs['limit'](_0x6d3020[_0xbdc7('0x33')]['limit']);_0x13aa7c[_0xbdc7('0x21')]=qs[_0xbdc7('0x21')](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x21')]);}_0x13aa7c['order']=qs['sort'](_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x13aa7c[_0xbdc7('0x3d')]=qs[_0xbdc7('0x35')](_[_0xbdc7('0x3e')](_0x6d3020[_0xbdc7('0x33')],_0x3c8129[_0xbdc7('0x35')]));_0x13aa7c[_0xbdc7('0x3d')][_0xbdc7('0x5b')]=_0x667026['id'];if(_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x5c')]){_0x13aa7c[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x13aa7c[_0xbdc7('0x3d')],{'$or':_['map'](_0x13aa7c[_0xbdc7('0x38')],function(_0x19039e){var _0x4a444d={};_0x4a444d[_0x19039e]={'$like':'%'+_0x6d3020[_0xbdc7('0x33')][_0xbdc7('0x5c')]+'%'};return _0x4a444d;})});}_0x13aa7c=_[_0xbdc7('0x3f')]({},_0x13aa7c,_0x6d3020[_0xbdc7('0x41')]);return db['JscriptySessionReport']['count']({'where':_0x13aa7c['where']})[_0xbdc7('0x25')](function(_0x1c446e){_0x1348ca[_0xbdc7('0x20')]=_0x1c446e;if(_0x6d3020['query'][_0xbdc7('0x43')]){_0x13aa7c['include']=[{'all':!![]}];}return db[_0xbdc7('0x59')][_0xbdc7('0x5d')](_0x13aa7c);})['then'](function(_0xbe1fd1){_0x1348ca[_0xbdc7('0x45')]=_0xbe1fd1;return _0x1348ca;});}})['then'](respondWithFilteredResult(_0xecbe2a,_0x13aa7c))[_0xbdc7('0x46')](handleError(_0xecbe2a,null));};exports[_0xbdc7('0x5e')]=function(_0x38a948,_0x10f6b3,_0x1e58b0){var _0x532d10={'raw':!![],'where':{}};var _0x217428={};var _0xac1669={'count':0x0,'rows':[]};return db[_0xbdc7('0x42')][_0xbdc7('0x58')]({'where':{'id':_0x38a948['params']['id']}})[_0xbdc7('0x25')](handleEntityNotFound(_0x10f6b3,null))['then'](function(_0x5da124){if(_0x5da124){_0x217428['model']=_[_0xbdc7('0x34')](db[_0xbdc7('0x5f')][_0xbdc7('0x2f')]);_0x217428[_0xbdc7('0x33')]=_[_0xbdc7('0x34')](_0x38a948[_0xbdc7('0x33')]);_0x217428[_0xbdc7('0x35')]=_[_0xbdc7('0x36')](_0x217428[_0xbdc7('0x37')],_0x217428[_0xbdc7('0x33')]);_0x532d10[_0xbdc7('0x38')]=_[_0xbdc7('0x36')](_0x217428['model'],qs[_0xbdc7('0x39')](_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x39')]));_0x532d10['attributes']=_0x532d10['attributes'][_0xbdc7('0x3a')]?_0x532d10[_0xbdc7('0x38')]:_0x217428[_0xbdc7('0x37')];if(!_0x38a948['query']['hasOwnProperty']('nolimit')){_0x532d10[_0xbdc7('0x1f')]=qs[_0xbdc7('0x1f')](_0x38a948[_0xbdc7('0x33')]['limit']);_0x532d10[_0xbdc7('0x21')]=qs['offset'](_0x38a948['query'][_0xbdc7('0x21')]);}_0x532d10[_0xbdc7('0x60')]=qs[_0xbdc7('0x3c')](_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x3c')]);_0x532d10[_0xbdc7('0x3d')]=qs['filters'](_[_0xbdc7('0x3e')](_0x38a948['query'],_0x217428['filters']));_0x532d10[_0xbdc7('0x3d')]['ProjectId']=_0x5da124['id'];if(_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x5c')]){_0x532d10[_0xbdc7('0x3d')]=_[_0xbdc7('0x3f')](_0x532d10[_0xbdc7('0x3d')],{'$or':_['map'](_0x532d10['attributes'],function(_0x341026){var _0x2a6917={};_0x2a6917[_0x341026]={'$like':'%'+_0x38a948[_0xbdc7('0x33')][_0xbdc7('0x5c')]+'%'};return _0x2a6917;})});}_0x532d10=_[_0xbdc7('0x3f')]({},_0x532d10,_0x38a948['options']);return db[_0xbdc7('0x5f')][_0xbdc7('0x20')]({'where':_0x532d10[_0xbdc7('0x3d')]})[_0xbdc7('0x25')](function(_0x300649){_0xac1669['count']=_0x300649;if(_0x38a948[_0xbdc7('0x33')]['includeAll']){_0x532d10['include']=[{'all':!![]}];}return db[_0xbdc7('0x5f')][_0xbdc7('0x5d')](_0x532d10);})[_0xbdc7('0x25')](function(_0x2cdf92){_0xac1669['rows']=_0x2cdf92;return _0xac1669;});}})[_0xbdc7('0x25')](respondWithFilteredResult(_0x10f6b3,_0x532d10))[_0xbdc7('0x46')](handleError(_0x10f6b3,null));};function char(_0x2f19f5){return _0xbdc7('0x61')===typeof _0x2f19f5?String[_0xbdc7('0x62')][_0xbdc7('0x63')](null,arguments):_0x2f19f5;}function needsEncapsulation(_0x158371){return!!_0x158371&&(_0x158371['toString']()[_0xbdc7('0x64')](char(0xd))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0xa))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0x2c))>=0x0||_0x158371[_0xbdc7('0x65')]()[_0xbdc7('0x64')](char(0x22))>=0x0);}function encapsulate(_0x24afac){var _0x264db8=char(0x22),_0x26f46d='\x5c'+char(0x22),_0x51b3f3=_0x24afac['toString']()['replace'](new RegExp(_0x264db8,'g'),_0x26f46d);return _0x264db8+_0x51b3f3+_0x264db8;}exports[_0xbdc7('0x66')]=function(_0x52c1af,_0x531c55,_0x1e3f1e){var _0x48c6fa,_0x161fcb;var _0x57c5b3={'where':{'ProjectId':_0x52c1af[_0xbdc7('0x4f')]['id']}};if(_0x52c1af[_0xbdc7('0x33')][_0xbdc7('0x67')]){_0x57c5b3[_0xbdc7('0x3d')][_0xbdc7('0x68')]=JSON[_0xbdc7('0x69')](_0x52c1af['query'][_0xbdc7('0x67')]);}return db[_0xbdc7('0x59')][_0xbdc7('0x5d')](_0x57c5b3)[_0xbdc7('0x25')](handleEntityNotFound(_0x531c55,null))['then'](function(_0x54f71e){if(_0x54f71e){_0x48c6fa=_0x54f71e;return db[_0xbdc7('0x6a')]['findAll']({'where':{'SessionId':{'$in':_[_0xbdc7('0x2e')](_0x48c6fa,'id')},'ProjectId':_0x52c1af[_0xbdc7('0x4f')]['id']},'order':_0xbdc7('0x6b')});}})[_0xbdc7('0x25')](handleEntityNotFound(_0x531c55,null))[_0xbdc7('0x25')](function(_0x3ca971){if(_0x3ca971){_0x161fcb=_0x3ca971;var _0x3fa74c={};for(var _0x176cbd=0x0,_0x107ab6=_0x161fcb[_0xbdc7('0x3a')];_0x176cbd<_0x107ab6;_0x176cbd++){if(!_0x3fa74c['hasOwnProperty'](_0x161fcb[_0x176cbd][_0xbdc7('0x6c')])){_0x3fa74c[_0x161fcb[_0x176cbd]['questionId']]=needsEncapsulation(_0x161fcb[_0x176cbd][_0xbdc7('0x6d')])?encapsulate(_0x161fcb[_0x176cbd][_0xbdc7('0x6d')]):_0x161fcb[_0x176cbd][_0xbdc7('0x6d')];}}var _0x1eba43=[],_0x34dae2={};for(var _0x25ad79=0x0,_0x5f047e=_0x48c6fa['length'];_0x25ad79<_0x5f047e;_0x25ad79++){_0x34dae2={'ProjectId':_0x52c1af['params']['id'],'SessionId':_0x48c6fa[_0x25ad79]['id'],'StartTime':moment(_0x48c6fa[_0x25ad79]['starttime'])['format'](_0xbdc7('0x6e'))};for(var _0x479ece=0x0,_0x50e1b3=_0x161fcb[_0xbdc7('0x3a')];_0x479ece<_0x50e1b3;_0x479ece++){if(_0x161fcb[_0x479ece][_0xbdc7('0x6f')]==_0x48c6fa[_0x25ad79]['id']&&_0x3fa74c[_0xbdc7('0x3b')](_0x161fcb[_0x479ece][_0xbdc7('0x6c')])){_0x34dae2[_0x3fa74c[_0x161fcb[_0x479ece][_0xbdc7('0x6c')]]]=_0x161fcb[_0x479ece][_0xbdc7('0x70')];}}for(var _0xe95a03 in _0x3fa74c){if(!_0x34dae2[_0xbdc7('0x3b')](_0x3fa74c[_0xe95a03])){_0x34dae2[_0x3fa74c[_0xe95a03]]=null;}}_0x1eba43[_0xbdc7('0x71')](_0x34dae2);}return _0x1eba43;}})['then'](function(_0x3df11a){if(!_[_0xbdc7('0x72')](_0x3df11a)){var _0x2ca6b6=toCsv(_0x3df11a);var _0x2f5be7=Date['now']();fs[_0xbdc7('0x73')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7),_0x2ca6b6);_0x531c55[_0xbdc7('0x74')](_0xbdc7('0x75'),_0xbdc7('0x76')+util[_0xbdc7('0x77')]('Jscripty_Project_%d_Summary_%s.csv',_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7));_0x531c55['setHeader'](_0xbdc7('0x78'),'text/csv');return _0x531c55[_0xbdc7('0x79')](util[_0xbdc7('0x77')](_0xbdc7('0x7a'),_0x52c1af[_0xbdc7('0x4f')]['id'],_0x2f5be7));}else{return _0x531c55[_0xbdc7('0x1a')](0xcc);}})[_0xbdc7('0x46')](handleError(_0x531c55,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 24ff758..67c3ffc 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 _0x3c17=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x4f225e,_0x1d7f61){var _0x5cb8bf=function(_0x4fade3){while(--_0x4fade3){_0x4f225e['push'](_0x4f225e['shift']());}};_0x5cb8bf(++_0x1d7f61);}(_0x3c17,0x1a1));var _0x73c1=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3c17[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x73c1('0x0'));var util=require('util');var logger=require(_0x73c1('0x1'))('api');var moment=require(_0x73c1('0x2'));var BPromise=require(_0x73c1('0x3'));var rp=require(_0x73c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var attributes=require(_0x73c1('0x7'));module[_0x73c1('0x8')]=function(_0x48c943,_0x382f82){return _0x48c943['define'](_0x73c1('0x9'),attributes,{'tableName':_0x73c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash'];(function(_0x49d1d9,_0x1f4f66){var _0x4ccb55=function(_0x144a5e){while(--_0x144a5e){_0x49d1d9['push'](_0x49d1d9['shift']());}};_0x4ccb55(++_0x1f4f66);}(_0x5162,0x103));var _0x2516=function(_0x4eeca4,_0x5901c9){_0x4eeca4=_0x4eeca4-0x0;var _0x430031=_0x5162[_0x4eeca4];return _0x430031;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('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 529c79e..82b20d4 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x92777e,_0x2ebd65){var _0x15cd23=function(_0x1ef8f4){while(--_0x1ef8f4){_0x92777e['push'](_0x92777e['shift']());}};_0x15cd23(++_0x2ebd65);}(_0x54ef,0x112));var _0xf54e=function(_0x2ee218,_0x5e8ccf){_0x2ee218=_0x2ee218-0x0;var _0x401344=_0x54ef[_0x2ee218];return _0x401344;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0xf4eb,0xec));var _0xbf4e=function(_0x23a7ef,_0x2ed832){_0x23a7ef=_0x23a7ef-0x0;var _0x2e333b=_0xf4eb[_0x23a7ef];return _0x2e333b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 749c54b..f5f3745 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 _0x1971=['isAuthenticated','get','/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x2f00c1,_0x2d7fcf){var _0x1ceb17=function(_0x51608e){while(--_0x51608e){_0x2f00c1['push'](_0x2f00c1['shift']());}};_0x1ceb17(++_0x2d7fcf);}(_0x1971,0x15b));var _0x1197=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x1971[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x1197('0x0'));var util=require(_0x1197('0x1'));var path=require(_0x1197('0x2'));var timeout=require(_0x1197('0x3'));var express=require(_0x1197('0x4'));var router=express[_0x1197('0x5')]();var fs_extra=require(_0x1197('0x6'));var auth=require(_0x1197('0x7'));var interaction=require(_0x1197('0x8'));var config=require('../../config/environment');var controller=require(_0x1197('0x9'));router['get']('/',auth[_0x1197('0xa')](),controller['index']);router[_0x1197('0xb')](_0x1197('0xc'),auth['isAuthenticated'](),controller[_0x1197('0xd')]);router[_0x1197('0xb')]('/:id',auth[_0x1197('0xa')](),controller[_0x1197('0xe')]);router[_0x1197('0xf')]('/',auth[_0x1197('0xa')](),controller[_0x1197('0x10')]);router['put'](_0x1197('0x11'),auth['isAuthenticated'](),controller[_0x1197('0x12')]);router[_0x1197('0x13')](_0x1197('0x11'),auth[_0x1197('0xa')](),controller[_0x1197('0x14')]);module['exports']=router; \ No newline at end of file +var _0x319c=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','get','/describe','isAuthenticated','/:id','show','create','put'];(function(_0x506ff5,_0x16d10f){var _0x2bd51b=function(_0x1a7f2b){while(--_0x1a7f2b){_0x506ff5['push'](_0x506ff5['shift']());}};_0x2bd51b(++_0x16d10f);}(_0x319c,0x164));var _0xc319=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x319c[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xc319('0x0'));var util=require(_0xc319('0x1'));var path=require('path');var timeout=require(_0xc319('0x2'));var express=require('express');var router=express[_0xc319('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc319('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xc319('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc319('0x5')](_0xc319('0x6'),auth[_0xc319('0x7')](),controller['describe']);router[_0xc319('0x5')](_0xc319('0x8'),auth[_0xc319('0x7')](),controller[_0xc319('0x9')]);router['post']('/',auth[_0xc319('0x7')](),controller[_0xc319('0xa')]);router[_0xc319('0xb')](_0xc319('0x8'),auth['isAuthenticated'](),controller[_0xc319('0xc')]);router[_0xc319('0xd')](_0xc319('0x8'),auth['isAuthenticated'](),controller[_0xc319('0xe')]);module[_0xc319('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4cef373..9a231bf 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x508bb5,_0x3b1a19){_0x508bb5=_0x508bb5-0x0;var _0x4ec63c=_0x7a54[_0x508bb5];return _0x4ec63c;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x47dace,_0x11ed9c){_0x47dace=_0x47dace-0x0;var _0x286a39=_0x7a54[_0x47dace];return _0x286a39;};'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 a2ae021..206fe8c 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 _0x3fe0=['stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','to-csv','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','sendStatus','status','json','offset','undefined','Content-Range','apply','reject','save','then','end','error'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x3fe0,0x77));var _0x03fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3fe0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x03fe('0x0'));var rimraf=require(_0x03fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03fe('0x2'));var moment=require('moment');var BPromise=require(_0x03fe('0x3'));var Mustache=require(_0x03fe('0x4'));var util=require(_0x03fe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x03fe('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03fe('0x7'));var _=require('lodash');var squel=require(_0x03fe('0x8'));var crypto=require(_0x03fe('0x9'));var jsforce=require(_0x03fe('0xa'));var deskjs=require(_0x03fe('0xb'));var toCsv=require(_0x03fe('0x6'));var querystring=require(_0x03fe('0xc'));var Papa=require(_0x03fe('0xd'));var Redis=require(_0x03fe('0xe'));var authService=require(_0x03fe('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x03fe('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03fe('0x11'))(_0x03fe('0x12'));var utils=require(_0x03fe('0x13'));var config=require(_0x03fe('0x14'));var licenseUtil=require(_0x03fe('0x15'));var db=require(_0x03fe('0x16'))['db'];function respondWithStatusCode(_0x4b0939,_0x5197b4){_0x5197b4=_0x5197b4||0xcc;return function(_0x29aa34){if(_0x29aa34){return _0x4b0939[_0x03fe('0x17')](_0x5197b4);}return _0x4b0939[_0x03fe('0x18')](_0x5197b4)['end']();};}function respondWithResult(_0x41b776,_0x3ef371){_0x3ef371=_0x3ef371||0xc8;return function(_0x49eab9){if(_0x49eab9){return _0x41b776['status'](_0x3ef371)[_0x03fe('0x19')](_0x49eab9);}};}function respondWithFilteredResult(_0x3184b3,_0x3fbc6e){return function(_0x3adb9f){if(_0x3adb9f){var _0x313830=typeof _0x3fbc6e[_0x03fe('0x1a')]==='undefined'&&typeof _0x3fbc6e['limit']===_0x03fe('0x1b');var _0x325e8c=_0x3adb9f['count'];var _0x3f4070=_0x313830?0x0:_0x3fbc6e[_0x03fe('0x1a')];var _0x335363=_0x313830?_0x3adb9f['count']:_0x3fbc6e[_0x03fe('0x1a')]+_0x3fbc6e['limit'];var _0x1f748a;if(_0x335363>=_0x325e8c){_0x335363=_0x325e8c;_0x1f748a=0xc8;}else{_0x1f748a=0xce;}_0x3184b3[_0x03fe('0x18')](_0x1f748a);return _0x3184b3['set'](_0x03fe('0x1c'),_0x3f4070+'-'+_0x335363+'/'+_0x325e8c)['json'](_0x3adb9f);}return null;};}function patchUpdates(_0x5e532f){return function(_0x32449e){try{jsonpatch[_0x03fe('0x1d')](_0x32449e,_0x5e532f,!![]);}catch(_0x1525fe){return BPromise[_0x03fe('0x1e')](_0x1525fe);}return _0x32449e[_0x03fe('0x1f')]();};}function saveUpdates(_0x1643c6,_0x2f7032){return function(_0x167f84){if(_0x167f84){return _0x167f84['update'](_0x1643c6)[_0x03fe('0x20')](function(_0x256829){return _0x256829;});}return null;};}function removeEntity(_0x22977d,_0x101304){return function(_0x355f7b){if(_0x355f7b){return _0x355f7b['destroy']()['then'](function(){_0x22977d[_0x03fe('0x18')](0xcc)[_0x03fe('0x21')]();});}};}function handleEntityNotFound(_0x57b4ca,_0x327a48){return function(_0x5774ef){if(!_0x5774ef){_0x57b4ca[_0x03fe('0x17')](0x194);}return _0x5774ef;};}function handleError(_0x961410,_0x27c09a){_0x27c09a=_0x27c09a||0x1f4;return function(_0x5af892){logger[_0x03fe('0x22')](_0x5af892[_0x03fe('0x23')]);if(_0x5af892[_0x03fe('0x24')]){delete _0x5af892[_0x03fe('0x24')];}_0x961410['status'](_0x27c09a)[_0x03fe('0x25')](_0x5af892);};}exports[_0x03fe('0x26')]=function(_0x3ea2b6,_0x4fa061){var _0x2f9ca7={},_0x1e4e2b={},_0x45f664={'count':0x0,'rows':[]};var _0x69c373=_[_0x03fe('0x27')](db['JscriptyQuestionReport'][_0x03fe('0x28')],function(_0x298039){return{'name':_0x298039[_0x03fe('0x29')],'type':_0x298039[_0x03fe('0x2a')][_0x03fe('0x2b')]};});_0x1e4e2b['model']=_[_0x03fe('0x27')](_0x69c373,_0x03fe('0x24'));_0x1e4e2b['query']=_['keys'](_0x3ea2b6[_0x03fe('0x2c')]);_0x1e4e2b[_0x03fe('0x2d')]=_[_0x03fe('0x2e')](_0x1e4e2b[_0x03fe('0x2f')],_0x1e4e2b['query']);_0x2f9ca7[_0x03fe('0x30')]=_['intersection'](_0x1e4e2b['model'],qs['fields'](_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x31')]));_0x2f9ca7[_0x03fe('0x30')]=_0x2f9ca7[_0x03fe('0x30')][_0x03fe('0x32')]?_0x2f9ca7[_0x03fe('0x30')]:_0x1e4e2b[_0x03fe('0x2f')];if(!_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x33')](_0x03fe('0x34'))){_0x2f9ca7['limit']=qs[_0x03fe('0x35')](_0x3ea2b6[_0x03fe('0x2c')]['limit']);_0x2f9ca7[_0x03fe('0x1a')]=qs['offset'](_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x1a')]);}_0x2f9ca7[_0x03fe('0x36')]=qs[_0x03fe('0x37')](_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x37')]);_0x2f9ca7['where']=qs[_0x03fe('0x2d')](_[_0x03fe('0x38')](_0x3ea2b6[_0x03fe('0x2c')],_0x1e4e2b[_0x03fe('0x2d')]),_0x69c373);if(_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x39')]){_0x2f9ca7[_0x03fe('0x3a')]=_[_0x03fe('0x3b')](_0x2f9ca7[_0x03fe('0x3a')],{'$or':_['map'](_0x69c373,function(_0xac72e6){if(_0xac72e6[_0x03fe('0x2a')]!==_0x03fe('0x3c')){var _0x52ae66={};_0x52ae66[_0xac72e6[_0x03fe('0x24')]]={'$like':'%'+_0x3ea2b6['query'][_0x03fe('0x39')]+'%'};return _0x52ae66;}})});}_0x2f9ca7=_[_0x03fe('0x3b')]({},_0x2f9ca7,_0x3ea2b6[_0x03fe('0x3d')]);var _0x44b0fe={'where':_0x2f9ca7[_0x03fe('0x3a')]};return db[_0x03fe('0x3e')][_0x03fe('0x3f')](_0x44b0fe)[_0x03fe('0x20')](function(_0x5f13c2){_0x45f664[_0x03fe('0x3f')]=_0x5f13c2;if(_0x3ea2b6[_0x03fe('0x2c')][_0x03fe('0x40')]){_0x2f9ca7['include']=[{'all':!![]}];}return db[_0x03fe('0x3e')][_0x03fe('0x41')](_0x2f9ca7);})[_0x03fe('0x20')](function(_0xce0807){_0x45f664[_0x03fe('0x42')]=_0xce0807;return _0x45f664;})[_0x03fe('0x20')](respondWithFilteredResult(_0x4fa061,_0x2f9ca7))[_0x03fe('0x43')](handleError(_0x4fa061,null));};exports[_0x03fe('0x44')]=function(_0x4b6635,_0x5ef85a){var _0x2d303b={'raw':!![],'where':{'id':_0x4b6635[_0x03fe('0x45')]['id']}},_0x58d693={};_0x58d693[_0x03fe('0x2f')]=_[_0x03fe('0x46')](db[_0x03fe('0x3e')]['rawAttributes']);_0x58d693[_0x03fe('0x2c')]=_[_0x03fe('0x46')](_0x4b6635[_0x03fe('0x2c')]);_0x58d693[_0x03fe('0x2d')]=_[_0x03fe('0x2e')](_0x58d693[_0x03fe('0x2f')],_0x58d693[_0x03fe('0x2c')]);_0x2d303b[_0x03fe('0x30')]=_[_0x03fe('0x2e')](_0x58d693[_0x03fe('0x2f')],qs[_0x03fe('0x31')](_0x4b6635['query']['fields']));_0x2d303b['attributes']=_0x2d303b[_0x03fe('0x30')][_0x03fe('0x32')]?_0x2d303b['attributes']:_0x58d693[_0x03fe('0x2f')];if(_0x4b6635[_0x03fe('0x2c')][_0x03fe('0x40')]){_0x2d303b[_0x03fe('0x47')]=[{'all':!![]}];}_0x2d303b=_['merge']({},_0x2d303b,_0x4b6635[_0x03fe('0x3d')]);return db[_0x03fe('0x3e')][_0x03fe('0x48')](_0x2d303b)[_0x03fe('0x20')](handleEntityNotFound(_0x5ef85a,null))['then'](respondWithResult(_0x5ef85a,null))[_0x03fe('0x43')](handleError(_0x5ef85a,null));};exports[_0x03fe('0x49')]=function(_0x58a3b5,_0xd90b23){return db['JscriptyQuestionReport'][_0x03fe('0x49')](_0x58a3b5['body'],{})[_0x03fe('0x20')](respondWithResult(_0xd90b23,0xc9))[_0x03fe('0x43')](handleError(_0xd90b23,null));};exports['update']=function(_0x1e05f9,_0x1d36be){if(_0x1e05f9['body']['id']){delete _0x1e05f9[_0x03fe('0x4a')]['id'];}return db[_0x03fe('0x3e')][_0x03fe('0x48')]({'where':{'id':_0x1e05f9[_0x03fe('0x45')]['id']}})[_0x03fe('0x20')](handleEntityNotFound(_0x1d36be,null))[_0x03fe('0x20')](saveUpdates(_0x1e05f9['body'],null))[_0x03fe('0x20')](respondWithResult(_0x1d36be,null))['catch'](handleError(_0x1d36be,null));};exports[_0x03fe('0x4b')]=function(_0x1f3d36,_0x831dee){return db[_0x03fe('0x3e')]['find']({'where':{'id':_0x1f3d36[_0x03fe('0x45')]['id']}})[_0x03fe('0x20')](handleEntityNotFound(_0x831dee,null))[_0x03fe('0x20')](removeEntity(_0x831dee,null))[_0x03fe('0x43')](handleError(_0x831dee,null));};exports[_0x03fe('0x4c')]=function(_0x580c20,_0x4d8a2f){return db[_0x03fe('0x3e')][_0x03fe('0x4c')]()[_0x03fe('0x20')](respondWithResult(_0x4d8a2f,null))[_0x03fe('0x43')](handleError(_0x4d8a2f,null));}; \ No newline at end of file +var _0x874b=['body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','limit','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create'];(function(_0x14a258,_0x29fedd){var _0x54030c=function(_0x156a82){while(--_0x156a82){_0x14a258['push'](_0x14a258['shift']());}};_0x54030c(++_0x29fedd);}(_0x874b,0x17a));var _0xb874=function(_0x5612f0,_0x227259){_0x5612f0=_0x5612f0-0x0;var _0x57cfb2=_0x874b[_0x5612f0];return _0x57cfb2;};'use strict';var emlformat=require(_0xb874('0x0'));var rimraf=require(_0xb874('0x1'));var zipdir=require(_0xb874('0x2'));var jsonpatch=require(_0xb874('0x3'));var rp=require(_0xb874('0x4'));var moment=require(_0xb874('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb874('0x6'));var util=require(_0xb874('0x7'));var path=require(_0xb874('0x8'));var sox=require(_0xb874('0x9'));var csv=require(_0xb874('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb874('0xb'));var squel=require(_0xb874('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb874('0xd'));var toCsv=require(_0xb874('0xa'));var querystring=require(_0xb874('0xe'));var Papa=require(_0xb874('0xf'));var Redis=require(_0xb874('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb874('0x11'));var as=require(_0xb874('0x12'));var hardwareService=require(_0xb874('0x13'));var logger=require(_0xb874('0x14'))(_0xb874('0x15'));var utils=require(_0xb874('0x16'));var config=require(_0xb874('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd311,_0xfe10fa){_0xfe10fa=_0xfe10fa||0xcc;return function(_0x35b52f){if(_0x35b52f){return _0x1bd311[_0xb874('0x18')](_0xfe10fa);}return _0x1bd311[_0xb874('0x19')](_0xfe10fa)['end']();};}function respondWithResult(_0x50185d,_0x3cd661){_0x3cd661=_0x3cd661||0xc8;return function(_0x9e801a){if(_0x9e801a){return _0x50185d['status'](_0x3cd661)[_0xb874('0x1a')](_0x9e801a);}};}function respondWithFilteredResult(_0x235479,_0x72a5f1){return function(_0x9e06fa){if(_0x9e06fa){var _0x240585=typeof _0x72a5f1['offset']===_0xb874('0x1b')&&typeof _0x72a5f1['limit']===_0xb874('0x1b');var _0x92871=_0x9e06fa[_0xb874('0x1c')];var _0x2f664b=_0x240585?0x0:_0x72a5f1[_0xb874('0x1d')];var _0x147ed0=_0x240585?_0x9e06fa['count']:_0x72a5f1[_0xb874('0x1d')]+_0x72a5f1[_0xb874('0x1e')];var _0x19d253;if(_0x147ed0>=_0x92871){_0x147ed0=_0x92871;_0x19d253=0xc8;}else{_0x19d253=0xce;}_0x235479[_0xb874('0x19')](_0x19d253);return _0x235479['set']('Content-Range',_0x2f664b+'-'+_0x147ed0+'/'+_0x92871)['json'](_0x9e06fa);}return null;};}function patchUpdates(_0x48cbf2){return function(_0x2e5cf1){try{jsonpatch[_0xb874('0x1f')](_0x2e5cf1,_0x48cbf2,!![]);}catch(_0x632b2a){return BPromise[_0xb874('0x20')](_0x632b2a);}return _0x2e5cf1[_0xb874('0x21')]();};}function saveUpdates(_0x4db1b5,_0x35560a){return function(_0x53b7ad){if(_0x53b7ad){return _0x53b7ad[_0xb874('0x22')](_0x4db1b5)['then'](function(_0x569b6c){return _0x569b6c;});}return null;};}function removeEntity(_0x4fa3c2,_0x176966){return function(_0x4eb1f9){if(_0x4eb1f9){return _0x4eb1f9[_0xb874('0x23')]()['then'](function(){_0x4fa3c2[_0xb874('0x19')](0xcc)[_0xb874('0x24')]();});}};}function handleEntityNotFound(_0x259435,_0x3897f5){return function(_0x1525b4){if(!_0x1525b4){_0x259435['sendStatus'](0x194);}return _0x1525b4;};}function handleError(_0xab853,_0x1ffbe5){_0x1ffbe5=_0x1ffbe5||0x1f4;return function(_0x492791){logger[_0xb874('0x25')](_0x492791[_0xb874('0x26')]);if(_0x492791[_0xb874('0x27')]){delete _0x492791[_0xb874('0x27')];}_0xab853[_0xb874('0x19')](_0x1ffbe5)[_0xb874('0x28')](_0x492791);};}exports[_0xb874('0x29')]=function(_0xcca92d,_0x5ca831){var _0x2dd57c={},_0xd605a4={},_0x5b5c30={'count':0x0,'rows':[]};var _0x4f584e=_[_0xb874('0x2a')](db[_0xb874('0x2b')]['rawAttributes'],function(_0x213068){return{'name':_0x213068[_0xb874('0x2c')],'type':_0x213068[_0xb874('0x2d')][_0xb874('0x2e')]};});_0xd605a4[_0xb874('0x2f')]=_[_0xb874('0x2a')](_0x4f584e,_0xb874('0x27'));_0xd605a4[_0xb874('0x30')]=_['keys'](_0xcca92d[_0xb874('0x30')]);_0xd605a4[_0xb874('0x31')]=_[_0xb874('0x32')](_0xd605a4['model'],_0xd605a4[_0xb874('0x30')]);_0x2dd57c[_0xb874('0x33')]=_[_0xb874('0x32')](_0xd605a4[_0xb874('0x2f')],qs[_0xb874('0x34')](_0xcca92d[_0xb874('0x30')][_0xb874('0x34')]));_0x2dd57c[_0xb874('0x33')]=_0x2dd57c['attributes'][_0xb874('0x35')]?_0x2dd57c[_0xb874('0x33')]:_0xd605a4['model'];if(!_0xcca92d[_0xb874('0x30')]['hasOwnProperty'](_0xb874('0x36'))){_0x2dd57c[_0xb874('0x1e')]=qs[_0xb874('0x1e')](_0xcca92d[_0xb874('0x30')][_0xb874('0x1e')]);_0x2dd57c[_0xb874('0x1d')]=qs['offset'](_0xcca92d[_0xb874('0x30')][_0xb874('0x1d')]);}_0x2dd57c[_0xb874('0x37')]=qs[_0xb874('0x38')](_0xcca92d[_0xb874('0x30')]['sort']);_0x2dd57c[_0xb874('0x39')]=qs['filters'](_[_0xb874('0x3a')](_0xcca92d['query'],_0xd605a4[_0xb874('0x31')]),_0x4f584e);if(_0xcca92d[_0xb874('0x30')][_0xb874('0x3b')]){_0x2dd57c[_0xb874('0x39')]=_[_0xb874('0x3c')](_0x2dd57c['where'],{'$or':_[_0xb874('0x2a')](_0x4f584e,function(_0x28f16f){if(_0x28f16f['type']!=='VIRTUAL'){var _0x1fa1ea={};_0x1fa1ea[_0x28f16f[_0xb874('0x27')]]={'$like':'%'+_0xcca92d[_0xb874('0x30')]['filter']+'%'};return _0x1fa1ea;}})});}_0x2dd57c=_[_0xb874('0x3c')]({},_0x2dd57c,_0xcca92d[_0xb874('0x3d')]);var _0x52193d={'where':_0x2dd57c['where']};return db[_0xb874('0x2b')][_0xb874('0x1c')](_0x52193d)[_0xb874('0x3e')](function(_0x51d30d){_0x5b5c30[_0xb874('0x1c')]=_0x51d30d;if(_0xcca92d[_0xb874('0x30')][_0xb874('0x3f')]){_0x2dd57c[_0xb874('0x40')]=[{'all':!![]}];}return db[_0xb874('0x2b')][_0xb874('0x41')](_0x2dd57c);})[_0xb874('0x3e')](function(_0x253181){_0x5b5c30[_0xb874('0x42')]=_0x253181;return _0x5b5c30;})['then'](respondWithFilteredResult(_0x5ca831,_0x2dd57c))[_0xb874('0x43')](handleError(_0x5ca831,null));};exports['show']=function(_0x160ae3,_0x2360cb){var _0x48779f={'raw':!![],'where':{'id':_0x160ae3[_0xb874('0x44')]['id']}},_0x198847={};_0x198847['model']=_[_0xb874('0x45')](db['JscriptyQuestionReport'][_0xb874('0x46')]);_0x198847[_0xb874('0x30')]=_[_0xb874('0x45')](_0x160ae3[_0xb874('0x30')]);_0x198847[_0xb874('0x31')]=_['intersection'](_0x198847['model'],_0x198847['query']);_0x48779f[_0xb874('0x33')]=_[_0xb874('0x32')](_0x198847[_0xb874('0x2f')],qs[_0xb874('0x34')](_0x160ae3[_0xb874('0x30')][_0xb874('0x34')]));_0x48779f[_0xb874('0x33')]=_0x48779f[_0xb874('0x33')]['length']?_0x48779f[_0xb874('0x33')]:_0x198847[_0xb874('0x2f')];if(_0x160ae3[_0xb874('0x30')][_0xb874('0x3f')]){_0x48779f['include']=[{'all':!![]}];}_0x48779f=_[_0xb874('0x3c')]({},_0x48779f,_0x160ae3[_0xb874('0x3d')]);return db[_0xb874('0x2b')]['find'](_0x48779f)[_0xb874('0x3e')](handleEntityNotFound(_0x2360cb,null))[_0xb874('0x3e')](respondWithResult(_0x2360cb,null))['catch'](handleError(_0x2360cb,null));};exports[_0xb874('0x47')]=function(_0x5c24b5,_0x316f51){return db[_0xb874('0x2b')]['create'](_0x5c24b5[_0xb874('0x48')],{})[_0xb874('0x3e')](respondWithResult(_0x316f51,0xc9))[_0xb874('0x43')](handleError(_0x316f51,null));};exports[_0xb874('0x22')]=function(_0x1fbd4b,_0x15e09a){if(_0x1fbd4b[_0xb874('0x48')]['id']){delete _0x1fbd4b['body']['id'];}return db[_0xb874('0x2b')][_0xb874('0x49')]({'where':{'id':_0x1fbd4b[_0xb874('0x44')]['id']}})['then'](handleEntityNotFound(_0x15e09a,null))[_0xb874('0x3e')](saveUpdates(_0x1fbd4b[_0xb874('0x48')],null))[_0xb874('0x3e')](respondWithResult(_0x15e09a,null))[_0xb874('0x43')](handleError(_0x15e09a,null));};exports[_0xb874('0x23')]=function(_0x2acdbb,_0x4aa994){return db['JscriptyQuestionReport'][_0xb874('0x49')]({'where':{'id':_0x2acdbb[_0xb874('0x44')]['id']}})[_0xb874('0x3e')](handleEntityNotFound(_0x4aa994,null))[_0xb874('0x3e')](removeEntity(_0x4aa994,null))[_0xb874('0x43')](handleError(_0x4aa994,null));};exports[_0xb874('0x4a')]=function(_0x5b0e5d,_0xe071e6){return db[_0xb874('0x2b')]['describe']()[_0xb874('0x3e')](respondWithResult(_0xe071e6,null))[_0xb874('0x43')](handleError(_0xe071e6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 941dd30..f7fe949 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 _0xd839=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment'];(function(_0x1b2e6e,_0x357a7d){var _0x5c4235=function(_0x8f7cd4){while(--_0x8f7cd4){_0x1b2e6e['push'](_0x1b2e6e['shift']());}};_0x5c4235(++_0x357a7d);}(_0xd839,0x1be));var _0x9d83=function(_0x37b3c4,_0x40209a){_0x37b3c4=_0x37b3c4-0x0;var _0x226127=_0xd839[_0x37b3c4];return _0x226127;};'use strict';var _=require(_0x9d83('0x0'));var util=require(_0x9d83('0x1'));var logger=require(_0x9d83('0x2'))(_0x9d83('0x3'));var moment=require(_0x9d83('0x4'));var BPromise=require('bluebird');var rp=require(_0x9d83('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d83('0x6'));var config=require(_0x9d83('0x7'));var attributes=require(_0x9d83('0x8'));module['exports']=function(_0x50076c,_0x58eabd){return _0x50076c[_0x9d83('0x9')](_0x9d83('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c5a=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x271c9c,_0x50a3e8){var _0xfa67ee=function(_0x55d9e3){while(--_0x55d9e3){_0x271c9c['push'](_0x271c9c['shift']());}};_0xfa67ee(++_0x50a3e8);}(_0x3c5a,0x117));var _0xa3c5=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x3c5a[_0x4667b2];return _0x1070f2;};'use strict';var _=require(_0xa3c5('0x0'));var util=require(_0xa3c5('0x1'));var logger=require('../../config/logger')(_0xa3c5('0x2'));var moment=require(_0xa3c5('0x3'));var BPromise=require(_0xa3c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3c5('0x5'));var rimraf=require(_0xa3c5('0x6'));var config=require(_0xa3c5('0x7'));var attributes=require(_0xa3c5('0x8'));module[_0xa3c5('0x9')]=function(_0x2778e8,_0x183f40){return _0x2778e8[_0xa3c5('0xa')](_0xa3c5('0xb'),attributes,{'tableName':_0xa3c5('0xc'),'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 3ce27e7..f02f77e 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 _0x5035=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x32e3aa,_0x21067d){var _0x5ee287=function(_0x5a3947){while(--_0x5a3947){_0x32e3aa['push'](_0x32e3aa['shift']());}};_0x5ee287(++_0x21067d);}(_0x5035,0xaf));var _0x5503=function(_0x1cbb34,_0x476d2b){_0x1cbb34=_0x1cbb34-0x0;var _0x3f82f7=_0x5035[_0x1cbb34];return _0x3f82f7;};'use strict';var _=require(_0x5503('0x0'));var util=require(_0x5503('0x1'));var moment=require(_0x5503('0x2'));var BPromise=require('bluebird');var rs=require(_0x5503('0x3'));var fs=require('fs');var Redis=require(_0x5503('0x4'));var db=require(_0x5503('0x5'))['db'];var utils=require(_0x5503('0x6'));var logger=require(_0x5503('0x7'))(_0x5503('0x8'));var config=require(_0x5503('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5503('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6e3195,_0x1cdee6,_0x165f60){return new BPromise(function(_0x56bd5e,_0x478d22){return client[_0x5503('0xb')](_0x6e3195,_0x165f60)[_0x5503('0xc')](function(_0x5d81b7){logger[_0x5503('0xd')](_0x5503('0xe'),_0x1cdee6,_0x5503('0xf'));logger['debug'](_0x5503('0x10'),_0x1cdee6,_0x5503('0xf'),JSON[_0x5503('0x11')](_0x5d81b7));if(_0x5d81b7['error']){if(_0x5d81b7[_0x5503('0x12')][_0x5503('0x13')]===0x1f4){logger[_0x5503('0x12')](_0x5503('0xe'),_0x1cdee6,_0x5d81b7['error'][_0x5503('0x14')]);return _0x478d22(_0x5d81b7[_0x5503('0x12')][_0x5503('0x14')]);}logger[_0x5503('0x12')](_0x5503('0xe'),_0x1cdee6,_0x5d81b7[_0x5503('0x12')][_0x5503('0x14')]);return _0x56bd5e(_0x5d81b7[_0x5503('0x12')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1cdee6,'request\x20sent');_0x56bd5e(_0x5d81b7['result']['message']);}})[_0x5503('0x15')](function(_0x1b4cf9){logger[_0x5503('0x12')](_0x5503('0xe'),_0x1cdee6,_0x1b4cf9);_0x478d22(_0x1b4cf9);});});} \ No newline at end of file +var _0x39d4=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39d4,0xa0));var _0x439d=function(_0x38a4fc,_0x4f8fdf){_0x38a4fc=_0x38a4fc-0x0;var _0x8a6951=_0x39d4[_0x38a4fc];return _0x8a6951;};'use strict';var _=require(_0x439d('0x0'));var util=require(_0x439d('0x1'));var moment=require(_0x439d('0x2'));var BPromise=require(_0x439d('0x3'));var rs=require(_0x439d('0x4'));var fs=require('fs');var Redis=require(_0x439d('0x5'));var db=require(_0x439d('0x6'))['db'];var utils=require(_0x439d('0x7'));var logger=require('../../config/logger')(_0x439d('0x8'));var config=require(_0x439d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x439d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd6bd,_0xe44256,_0x570a47){return new BPromise(function(_0x47f1fa,_0x3ff171){return client[_0x439d('0xb')](_0x2dd6bd,_0x570a47)[_0x439d('0xc')](function(_0x47a769){logger[_0x439d('0xd')](_0x439d('0xe'),_0xe44256,_0x439d('0xf'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0xe44256,_0x439d('0xf'),JSON[_0x439d('0x10')](_0x47a769));if(_0x47a769[_0x439d('0x11')]){if(_0x47a769['error'][_0x439d('0x12')]===0x1f4){logger['error'](_0x439d('0xe'),_0xe44256,_0x47a769[_0x439d('0x11')]['message']);return _0x3ff171(_0x47a769['error']['message']);}logger[_0x439d('0x11')](_0x439d('0xe'),_0xe44256,_0x47a769[_0x439d('0x11')][_0x439d('0x13')]);return _0x47f1fa(_0x47a769[_0x439d('0x11')]['message']);}else{logger[_0x439d('0xd')](_0x439d('0xe'),_0xe44256,'request\x20sent');_0x47f1fa(_0x47a769[_0x439d('0x14')][_0x439d('0x13')]);}})[_0x439d('0x15')](function(_0x44f3d){logger['error'](_0x439d('0xe'),_0xe44256,_0x44f3d);_0x3ff171(_0x44f3d);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 45fe9e9..35834cf 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 _0x5c72=['/:id','show','/:id/questions','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x5c72,0xee));var _0x25c7=function(_0x83ee0a,_0x44947d){_0x83ee0a=_0x83ee0a-0x0;var _0x5dc29f=_0x5c72[_0x83ee0a];return _0x5dc29f;};'use strict';var multer=require(_0x25c7('0x0'));var util=require(_0x25c7('0x1'));var path=require(_0x25c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x25c7('0x3'));var router=express[_0x25c7('0x4')]();var fs_extra=require(_0x25c7('0x5'));var auth=require(_0x25c7('0x6'));var interaction=require(_0x25c7('0x7'));var config=require(_0x25c7('0x8'));var controller=require(_0x25c7('0x9'));router[_0x25c7('0xa')]('/',auth['isAuthenticated'](),controller[_0x25c7('0xb')]);router[_0x25c7('0xa')](_0x25c7('0xc'),auth[_0x25c7('0xd')](),controller[_0x25c7('0xe')]);router['get'](_0x25c7('0xf'),auth[_0x25c7('0xd')](),controller[_0x25c7('0x10')]);router['get'](_0x25c7('0x11'),auth[_0x25c7('0xd')](),controller['getQuestions']);router['post']('/',auth[_0x25c7('0xd')](),controller[_0x25c7('0x12')]);router[_0x25c7('0x13')](_0x25c7('0xf'),auth[_0x25c7('0xd')](),controller['update']);router[_0x25c7('0x14')](_0x25c7('0xf'),auth[_0x25c7('0xd')](),controller[_0x25c7('0x15')]);module[_0x25c7('0x16')]=router; \ No newline at end of file +var _0x9a68=['create','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','getQuestions','post'];(function(_0x3a63a2,_0x239997){var _0x1be579=function(_0x3d363c){while(--_0x3d363c){_0x3a63a2['push'](_0x3a63a2['shift']());}};_0x1be579(++_0x239997);}(_0x9a68,0x156));var _0x89a6=function(_0x54cc7e,_0x493400){_0x54cc7e=_0x54cc7e-0x0;var _0x5bb3a1=_0x9a68[_0x54cc7e];return _0x5bb3a1;};'use strict';var multer=require('multer');var util=require(_0x89a6('0x0'));var path=require('path');var timeout=require(_0x89a6('0x1'));var express=require(_0x89a6('0x2'));var router=express[_0x89a6('0x3')]();var fs_extra=require(_0x89a6('0x4'));var auth=require(_0x89a6('0x5'));var interaction=require(_0x89a6('0x6'));var config=require(_0x89a6('0x7'));var controller=require(_0x89a6('0x8'));router[_0x89a6('0x9')]('/',auth[_0x89a6('0xa')](),controller[_0x89a6('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x89a6('0xc')]);router[_0x89a6('0x9')]('/:id',auth[_0x89a6('0xa')](),controller['show']);router[_0x89a6('0x9')]('/:id/questions',auth[_0x89a6('0xa')](),controller[_0x89a6('0xd')]);router[_0x89a6('0xe')]('/',auth['isAuthenticated'](),controller[_0x89a6('0xf')]);router['put']('/:id',auth[_0x89a6('0xa')](),controller[_0x89a6('0x10')]);router[_0x89a6('0x11')](_0x89a6('0x12'),auth[_0x89a6('0xa')](),controller[_0x89a6('0x13')]);module[_0x89a6('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 19e760f..8ec815d 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 _0x50a3=['YYYY-MM-DD\x20HH:mm:ss','STRING','DATE','setDataValue','starttime','format'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x50a3,0x1d6));var _0x350a=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x50a3[_0x585d81];return _0x1aca0d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x350a('0x0')],'set':function(_0x16cfd8){this[_0x350a('0x1')](_0x350a('0x2'),_0x16cfd8);this['setDataValue']('endtime',moment()[_0x350a('0x3')](_0x350a('0x4')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x350a('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x350a('0x5')]},'uniqueid':{'type':Sequelize[_0x350a('0x5')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5a2f=['STRING','moment','sequelize','DATE','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x400c46,_0x15ce88){var _0x415d73=function(_0x5a2795){while(--_0x5a2795){_0x400c46['push'](_0x400c46['shift']());}};_0x415d73(++_0x15ce88);}(_0x5a2f,0x9b));var _0xf5a2=function(_0x1667d1,_0x36f7b3){_0x1667d1=_0x1667d1-0x0;var _0x56f5b3=_0x5a2f[_0x1667d1];return _0x56f5b3;};'use strict';var moment=require(_0xf5a2('0x0'));var Sequelize=require(_0xf5a2('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xf5a2('0x2')],'set':function(_0x14e987){this['setDataValue'](_0xf5a2('0x3'),_0x14e987);this['setDataValue'](_0xf5a2('0x4'),moment()['format'](_0xf5a2('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf5a2('0x6')]},'projectname':{'type':Sequelize[_0xf5a2('0x6')]},'queue':{'type':Sequelize[_0xf5a2('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf5a2('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4ff9817..3565077 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 _0xe620=['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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','filter','where','merge','includeAll','findAll','rows','show','params','keys','include','options','catch','create','body','find','describe','findOne','JscriptyQuestionReport','length','order','sort','pick','SessionId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x432c72,_0x2fef01){var _0x32c7f2=function(_0x309a08){while(--_0x309a08){_0x432c72['push'](_0x432c72['shift']());}};_0x32c7f2(++_0x2fef01);}(_0xe620,0x141));var _0x0e62=function(_0x634e3d,_0x1cab83){_0x634e3d=_0x634e3d-0x0;var _0x29fdfc=_0xe620[_0x634e3d];return _0x29fdfc;};'use strict';var emlformat=require(_0x0e62('0x0'));var rimraf=require(_0x0e62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e62('0x2'));var rp=require(_0x0e62('0x3'));var moment=require('moment');var BPromise=require(_0x0e62('0x4'));var Mustache=require(_0x0e62('0x5'));var util=require('util');var path=require(_0x0e62('0x6'));var sox=require('sox');var csv=require(_0x0e62('0x7'));var ejs=require(_0x0e62('0x8'));var fs=require('fs');var fs_extra=require(_0x0e62('0x9'));var _=require(_0x0e62('0xa'));var squel=require(_0x0e62('0xb'));var crypto=require(_0x0e62('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0e62('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e62('0xe'));var Redis=require(_0x0e62('0xf'));var authService=require(_0x0e62('0x10'));var qs=require(_0x0e62('0x11'));var as=require(_0x0e62('0x12'));var hardwareService=require(_0x0e62('0x13'));var logger=require(_0x0e62('0x14'))(_0x0e62('0x15'));var utils=require(_0x0e62('0x16'));var config=require(_0x0e62('0x17'));var licenseUtil=require(_0x0e62('0x18'));var db=require(_0x0e62('0x19'))['db'];function respondWithStatusCode(_0x2774c7,_0x4cd9a8){_0x4cd9a8=_0x4cd9a8||0xcc;return function(_0xccc1d0){if(_0xccc1d0){return _0x2774c7['sendStatus'](_0x4cd9a8);}return _0x2774c7['status'](_0x4cd9a8)[_0x0e62('0x1a')]();};}function respondWithResult(_0x49ce38,_0x2d9ea1){_0x2d9ea1=_0x2d9ea1||0xc8;return function(_0x3a99f2){if(_0x3a99f2){return _0x49ce38[_0x0e62('0x1b')](_0x2d9ea1)[_0x0e62('0x1c')](_0x3a99f2);}};}function respondWithFilteredResult(_0x34f25a,_0xf8fcf3){return function(_0x163449){if(_0x163449){var _0x45c857=typeof _0xf8fcf3['offset']===_0x0e62('0x1d')&&typeof _0xf8fcf3[_0x0e62('0x1e')]===_0x0e62('0x1d');var _0x3f70d9=_0x163449[_0x0e62('0x1f')];var _0x15fada=_0x45c857?0x0:_0xf8fcf3[_0x0e62('0x20')];var _0x25d77c=_0x45c857?_0x163449[_0x0e62('0x1f')]:_0xf8fcf3[_0x0e62('0x20')]+_0xf8fcf3[_0x0e62('0x1e')];var _0x37e738;if(_0x25d77c>=_0x3f70d9){_0x25d77c=_0x3f70d9;_0x37e738=0xc8;}else{_0x37e738=0xce;}_0x34f25a[_0x0e62('0x1b')](_0x37e738);return _0x34f25a[_0x0e62('0x21')](_0x0e62('0x22'),_0x15fada+'-'+_0x25d77c+'/'+_0x3f70d9)[_0x0e62('0x1c')](_0x163449);}return null;};}function patchUpdates(_0x586f67){return function(_0x353fa4){try{jsonpatch[_0x0e62('0x23')](_0x353fa4,_0x586f67,!![]);}catch(_0x3c427d){return BPromise[_0x0e62('0x24')](_0x3c427d);}return _0x353fa4[_0x0e62('0x25')]();};}function saveUpdates(_0x3d3b17,_0x2012e8){return function(_0x443b2e){if(_0x443b2e){return _0x443b2e[_0x0e62('0x26')](_0x3d3b17)['then'](function(_0x2ce87b){return _0x2ce87b;});}return null;};}function removeEntity(_0x1a453d,_0x4b7b8b){return function(_0x3c0637){if(_0x3c0637){return _0x3c0637[_0x0e62('0x27')]()[_0x0e62('0x28')](function(){_0x1a453d[_0x0e62('0x1b')](0xcc)[_0x0e62('0x1a')]();});}};}function handleEntityNotFound(_0x5a030c,_0x191068){return function(_0x1f23bb){if(!_0x1f23bb){_0x5a030c[_0x0e62('0x29')](0x194);}return _0x1f23bb;};}function handleError(_0x53726d,_0x11162d){_0x11162d=_0x11162d||0x1f4;return function(_0x5573d2){logger[_0x0e62('0x2a')](_0x5573d2[_0x0e62('0x2b')]);if(_0x5573d2[_0x0e62('0x2c')]){delete _0x5573d2[_0x0e62('0x2c')];}_0x53726d[_0x0e62('0x1b')](_0x11162d)[_0x0e62('0x2d')](_0x5573d2);};}exports[_0x0e62('0x2e')]=function(_0x5bb0a5,_0x1aea19){var _0x349d50={},_0x30f6db={},_0x3c16ed={'count':0x0,'rows':[]};var _0x2ffc0e=_[_0x0e62('0x2f')](db[_0x0e62('0x30')][_0x0e62('0x31')],function(_0x216b3b){return{'name':_0x216b3b[_0x0e62('0x32')],'type':_0x216b3b[_0x0e62('0x33')][_0x0e62('0x34')]};});_0x30f6db['model']=_[_0x0e62('0x2f')](_0x2ffc0e,_0x0e62('0x2c'));_0x30f6db[_0x0e62('0x35')]=_['keys'](_0x5bb0a5[_0x0e62('0x35')]);_0x30f6db[_0x0e62('0x36')]=_['intersection'](_0x30f6db[_0x0e62('0x37')],_0x30f6db['query']);_0x349d50[_0x0e62('0x38')]=_[_0x0e62('0x39')](_0x30f6db[_0x0e62('0x37')],qs[_0x0e62('0x3a')](_0x5bb0a5[_0x0e62('0x35')]['fields']));_0x349d50['attributes']=_0x349d50['attributes']['length']?_0x349d50[_0x0e62('0x38')]:_0x30f6db[_0x0e62('0x37')];if(!_0x5bb0a5[_0x0e62('0x35')][_0x0e62('0x3b')]('nolimit')){_0x349d50['limit']=qs[_0x0e62('0x1e')](_0x5bb0a5['query'][_0x0e62('0x1e')]);_0x349d50[_0x0e62('0x20')]=qs[_0x0e62('0x20')](_0x5bb0a5[_0x0e62('0x35')][_0x0e62('0x20')]);}_0x349d50['order']=qs['sort'](_0x5bb0a5['query']['sort']);_0x349d50['where']=qs[_0x0e62('0x36')](_['pick'](_0x5bb0a5['query'],_0x30f6db[_0x0e62('0x36')]),_0x2ffc0e);if(_0x5bb0a5['query'][_0x0e62('0x3c')]){_0x349d50[_0x0e62('0x3d')]=_[_0x0e62('0x3e')](_0x349d50[_0x0e62('0x3d')],{'$or':_[_0x0e62('0x2f')](_0x2ffc0e,function(_0x483298){if(_0x483298[_0x0e62('0x33')]!=='VIRTUAL'){var _0x544181={};_0x544181[_0x483298[_0x0e62('0x2c')]]={'$like':'%'+_0x5bb0a5[_0x0e62('0x35')][_0x0e62('0x3c')]+'%'};return _0x544181;}})});}_0x349d50=_[_0x0e62('0x3e')]({},_0x349d50,_0x5bb0a5['options']);var _0x125277={'where':_0x349d50[_0x0e62('0x3d')]};return db[_0x0e62('0x30')]['count'](_0x125277)[_0x0e62('0x28')](function(_0x48a882){_0x3c16ed['count']=_0x48a882;if(_0x5bb0a5['query'][_0x0e62('0x3f')]){_0x349d50['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0e62('0x40')](_0x349d50);})['then'](function(_0x5f0e71){_0x3c16ed[_0x0e62('0x41')]=_0x5f0e71;return _0x3c16ed;})[_0x0e62('0x28')](respondWithFilteredResult(_0x1aea19,_0x349d50))['catch'](handleError(_0x1aea19,null));};exports[_0x0e62('0x42')]=function(_0x18595b,_0x586b5c){var _0x614a7={'raw':!![],'where':{'id':_0x18595b[_0x0e62('0x43')]['id']}},_0x3a1cd6={};_0x3a1cd6[_0x0e62('0x37')]=_[_0x0e62('0x44')](db[_0x0e62('0x30')][_0x0e62('0x31')]);_0x3a1cd6['query']=_[_0x0e62('0x44')](_0x18595b[_0x0e62('0x35')]);_0x3a1cd6['filters']=_[_0x0e62('0x39')](_0x3a1cd6[_0x0e62('0x37')],_0x3a1cd6['query']);_0x614a7['attributes']=_[_0x0e62('0x39')](_0x3a1cd6['model'],qs['fields'](_0x18595b[_0x0e62('0x35')][_0x0e62('0x3a')]));_0x614a7[_0x0e62('0x38')]=_0x614a7[_0x0e62('0x38')]['length']?_0x614a7[_0x0e62('0x38')]:_0x3a1cd6[_0x0e62('0x37')];if(_0x18595b[_0x0e62('0x35')][_0x0e62('0x3f')]){_0x614a7[_0x0e62('0x45')]=[{'all':!![]}];}_0x614a7=_['merge']({},_0x614a7,_0x18595b[_0x0e62('0x46')]);return db[_0x0e62('0x30')]['find'](_0x614a7)[_0x0e62('0x28')](handleEntityNotFound(_0x586b5c,null))[_0x0e62('0x28')](respondWithResult(_0x586b5c,null))[_0x0e62('0x47')](handleError(_0x586b5c,null));};exports[_0x0e62('0x48')]=function(_0x550703,_0x3becc9){return db[_0x0e62('0x30')]['create'](_0x550703['body'],{})[_0x0e62('0x28')](respondWithResult(_0x3becc9,0xc9))[_0x0e62('0x47')](handleError(_0x3becc9,null));};exports[_0x0e62('0x26')]=function(_0x10b47c,_0x4f9b5d){if(_0x10b47c[_0x0e62('0x49')]['id']){delete _0x10b47c[_0x0e62('0x49')]['id'];}return db[_0x0e62('0x30')][_0x0e62('0x4a')]({'where':{'id':_0x10b47c['params']['id']}})[_0x0e62('0x28')](handleEntityNotFound(_0x4f9b5d,null))[_0x0e62('0x28')](saveUpdates(_0x10b47c[_0x0e62('0x49')],null))['then'](respondWithResult(_0x4f9b5d,null))[_0x0e62('0x47')](handleError(_0x4f9b5d,null));};exports[_0x0e62('0x27')]=function(_0x34e815,_0x1e42e3){return db[_0x0e62('0x30')][_0x0e62('0x4a')]({'where':{'id':_0x34e815[_0x0e62('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e42e3,null))[_0x0e62('0x28')](removeEntity(_0x1e42e3,null))[_0x0e62('0x47')](handleError(_0x1e42e3,null));};exports[_0x0e62('0x4b')]=function(_0x2e8227,_0x2bda37){return db[_0x0e62('0x30')]['describe']()['then'](respondWithResult(_0x2bda37,null))[_0x0e62('0x47')](handleError(_0x2bda37,null));};exports['getQuestions']=function(_0x30bad0,_0x572074,_0x27d11d){var _0x1c6248={'raw':!![],'where':{}};var _0x152429={};var _0x503860={'count':0x0,'rows':[]};return db[_0x0e62('0x30')][_0x0e62('0x4c')]({'where':{'id':_0x30bad0[_0x0e62('0x43')]['id']}})[_0x0e62('0x28')](handleEntityNotFound(_0x572074,null))[_0x0e62('0x28')](function(_0x71eb7d){if(_0x71eb7d){_0x152429[_0x0e62('0x37')]=_[_0x0e62('0x44')](db[_0x0e62('0x4d')]['rawAttributes']);_0x152429[_0x0e62('0x35')]=_['keys'](_0x30bad0[_0x0e62('0x35')]);_0x152429[_0x0e62('0x36')]=_[_0x0e62('0x39')](_0x152429['model'],_0x152429[_0x0e62('0x35')]);_0x1c6248[_0x0e62('0x38')]=_[_0x0e62('0x39')](_0x152429[_0x0e62('0x37')],qs[_0x0e62('0x3a')](_0x30bad0[_0x0e62('0x35')][_0x0e62('0x3a')]));_0x1c6248['attributes']=_0x1c6248['attributes'][_0x0e62('0x4e')]?_0x1c6248[_0x0e62('0x38')]:_0x152429[_0x0e62('0x37')];if(!_0x30bad0['query'][_0x0e62('0x3b')]('nolimit')){_0x1c6248[_0x0e62('0x1e')]=qs[_0x0e62('0x1e')](_0x30bad0['query']['limit']);_0x1c6248[_0x0e62('0x20')]=qs[_0x0e62('0x20')](_0x30bad0[_0x0e62('0x35')]['offset']);}_0x1c6248[_0x0e62('0x4f')]=qs[_0x0e62('0x50')](_0x30bad0[_0x0e62('0x35')][_0x0e62('0x50')]);_0x1c6248[_0x0e62('0x3d')]=qs[_0x0e62('0x36')](_[_0x0e62('0x51')](_0x30bad0[_0x0e62('0x35')],_0x152429[_0x0e62('0x36')]));_0x1c6248[_0x0e62('0x3d')][_0x0e62('0x52')]=_0x71eb7d['id'];if(_0x30bad0['query'][_0x0e62('0x3c')]){_0x1c6248['where']=_[_0x0e62('0x3e')](_0x1c6248[_0x0e62('0x3d')],{'$or':_[_0x0e62('0x2f')](_0x1c6248[_0x0e62('0x38')],function(_0x2d79cc){var _0x185a59={};_0x185a59[_0x2d79cc]={'$like':'%'+_0x30bad0['query'][_0x0e62('0x3c')]+'%'};return _0x185a59;})});}_0x1c6248=_[_0x0e62('0x3e')]({},_0x1c6248,_0x30bad0[_0x0e62('0x46')]);return db['JscriptyQuestionReport'][_0x0e62('0x1f')]({'where':_0x1c6248['where']})[_0x0e62('0x28')](function(_0xf160d){_0x503860[_0x0e62('0x1f')]=_0xf160d;if(_0x30bad0[_0x0e62('0x35')][_0x0e62('0x3f')]){_0x1c6248[_0x0e62('0x45')]=[{'all':!![]}];}return db[_0x0e62('0x4d')][_0x0e62('0x40')](_0x1c6248);})[_0x0e62('0x28')](function(_0x22831e){_0x503860[_0x0e62('0x41')]=_0x22831e;return _0x503860;});}})[_0x0e62('0x28')](respondWithFilteredResult(_0x572074,_0x1c6248))[_0x0e62('0x47')](handleError(_0x572074,null));}; \ No newline at end of file +var _0x1520=['end','json','offset','limit','count','set','save','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptySessionReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','update','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x9e575,_0x5894d4){var _0x522277=function(_0x1f5458){while(--_0x1f5458){_0x9e575['push'](_0x9e575['shift']());}};_0x522277(++_0x5894d4);}(_0x1520,0x128));var _0x0152=function(_0x2216f9,_0x3615dd){_0x2216f9=_0x2216f9-0x0;var _0x570c68=_0x1520[_0x2216f9];return _0x570c68;};'use strict';var emlformat=require(_0x0152('0x0'));var rimraf=require(_0x0152('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0152('0x2'));var rp=require(_0x0152('0x3'));var moment=require(_0x0152('0x4'));var BPromise=require(_0x0152('0x5'));var Mustache=require(_0x0152('0x6'));var util=require(_0x0152('0x7'));var path=require(_0x0152('0x8'));var sox=require(_0x0152('0x9'));var csv=require(_0x0152('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0152('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0152('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0152('0xd'));var toCsv=require(_0x0152('0xa'));var querystring=require(_0x0152('0xe'));var Papa=require(_0x0152('0xf'));var Redis=require(_0x0152('0x10'));var authService=require(_0x0152('0x11'));var qs=require(_0x0152('0x12'));var as=require(_0x0152('0x13'));var hardwareService=require(_0x0152('0x14'));var logger=require(_0x0152('0x15'))('api');var utils=require(_0x0152('0x16'));var config=require(_0x0152('0x17'));var licenseUtil=require(_0x0152('0x18'));var db=require(_0x0152('0x19'))['db'];function respondWithStatusCode(_0x2ead17,_0x2dc49e){_0x2dc49e=_0x2dc49e||0xcc;return function(_0x9be0ac){if(_0x9be0ac){return _0x2ead17[_0x0152('0x1a')](_0x2dc49e);}return _0x2ead17[_0x0152('0x1b')](_0x2dc49e)[_0x0152('0x1c')]();};}function respondWithResult(_0x355ce7,_0x2afd47){_0x2afd47=_0x2afd47||0xc8;return function(_0x47dd5f){if(_0x47dd5f){return _0x355ce7[_0x0152('0x1b')](_0x2afd47)[_0x0152('0x1d')](_0x47dd5f);}};}function respondWithFilteredResult(_0x56043e,_0x2cbfcd){return function(_0x42730b){if(_0x42730b){var _0x45870e=typeof _0x2cbfcd[_0x0152('0x1e')]==='undefined'&&typeof _0x2cbfcd[_0x0152('0x1f')]==='undefined';var _0xbb956e=_0x42730b[_0x0152('0x20')];var _0x2c8427=_0x45870e?0x0:_0x2cbfcd[_0x0152('0x1e')];var _0xbd3e7d=_0x45870e?_0x42730b[_0x0152('0x20')]:_0x2cbfcd[_0x0152('0x1e')]+_0x2cbfcd['limit'];var _0x55be72;if(_0xbd3e7d>=_0xbb956e){_0xbd3e7d=_0xbb956e;_0x55be72=0xc8;}else{_0x55be72=0xce;}_0x56043e['status'](_0x55be72);return _0x56043e[_0x0152('0x21')]('Content-Range',_0x2c8427+'-'+_0xbd3e7d+'/'+_0xbb956e)[_0x0152('0x1d')](_0x42730b);}return null;};}function patchUpdates(_0x194101){return function(_0x329df5){try{jsonpatch['apply'](_0x329df5,_0x194101,!![]);}catch(_0x1f52f8){return BPromise['reject'](_0x1f52f8);}return _0x329df5[_0x0152('0x22')]();};}function saveUpdates(_0xb513c2,_0xa4c584){return function(_0x31068d){if(_0x31068d){return _0x31068d['update'](_0xb513c2)[_0x0152('0x23')](function(_0x38dba4){return _0x38dba4;});}return null;};}function removeEntity(_0x3c9436,_0x5f3dde){return function(_0x9403ee){if(_0x9403ee){return _0x9403ee[_0x0152('0x24')]()[_0x0152('0x23')](function(){_0x3c9436[_0x0152('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c31b,_0x1fc804){return function(_0x4a4112){if(!_0x4a4112){_0x26c31b[_0x0152('0x1a')](0x194);}return _0x4a4112;};}function handleError(_0x44b62c,_0xcec826){_0xcec826=_0xcec826||0x1f4;return function(_0x7b214c){logger['error'](_0x7b214c[_0x0152('0x25')]);if(_0x7b214c['name']){delete _0x7b214c[_0x0152('0x26')];}_0x44b62c[_0x0152('0x1b')](_0xcec826)[_0x0152('0x27')](_0x7b214c);};}exports[_0x0152('0x28')]=function(_0x14b977,_0x4f2e15){var _0x5a4140={},_0x548210={},_0x2db10a={'count':0x0,'rows':[]};var _0x5406ed=_[_0x0152('0x29')](db['JscriptySessionReport']['rawAttributes'],function(_0x5687c0){return{'name':_0x5687c0[_0x0152('0x2a')],'type':_0x5687c0[_0x0152('0x2b')][_0x0152('0x2c')]};});_0x548210[_0x0152('0x2d')]=_[_0x0152('0x29')](_0x5406ed,_0x0152('0x26'));_0x548210[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x14b977[_0x0152('0x2e')]);_0x548210[_0x0152('0x30')]=_[_0x0152('0x31')](_0x548210[_0x0152('0x2d')],_0x548210[_0x0152('0x2e')]);_0x5a4140[_0x0152('0x32')]=_[_0x0152('0x31')](_0x548210[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x14b977[_0x0152('0x2e')][_0x0152('0x33')]));_0x5a4140[_0x0152('0x32')]=_0x5a4140[_0x0152('0x32')][_0x0152('0x34')]?_0x5a4140['attributes']:_0x548210[_0x0152('0x2d')];if(!_0x14b977[_0x0152('0x2e')][_0x0152('0x35')](_0x0152('0x36'))){_0x5a4140['limit']=qs['limit'](_0x14b977[_0x0152('0x2e')][_0x0152('0x1f')]);_0x5a4140['offset']=qs[_0x0152('0x1e')](_0x14b977['query'][_0x0152('0x1e')]);}_0x5a4140[_0x0152('0x37')]=qs[_0x0152('0x38')](_0x14b977[_0x0152('0x2e')]['sort']);_0x5a4140[_0x0152('0x39')]=qs[_0x0152('0x30')](_[_0x0152('0x3a')](_0x14b977[_0x0152('0x2e')],_0x548210[_0x0152('0x30')]),_0x5406ed);if(_0x14b977[_0x0152('0x2e')][_0x0152('0x3b')]){_0x5a4140[_0x0152('0x39')]=_[_0x0152('0x3c')](_0x5a4140[_0x0152('0x39')],{'$or':_[_0x0152('0x29')](_0x5406ed,function(_0x3d351c){if(_0x3d351c[_0x0152('0x2b')]!==_0x0152('0x3d')){var _0x329fe4={};_0x329fe4[_0x3d351c[_0x0152('0x26')]]={'$like':'%'+_0x14b977['query'][_0x0152('0x3b')]+'%'};return _0x329fe4;}})});}_0x5a4140=_[_0x0152('0x3c')]({},_0x5a4140,_0x14b977['options']);var _0x189a5e={'where':_0x5a4140[_0x0152('0x39')]};return db[_0x0152('0x3e')][_0x0152('0x20')](_0x189a5e)[_0x0152('0x23')](function(_0x205768){_0x2db10a[_0x0152('0x20')]=_0x205768;if(_0x14b977[_0x0152('0x2e')][_0x0152('0x3f')]){_0x5a4140['include']=[{'all':!![]}];}return db[_0x0152('0x3e')][_0x0152('0x40')](_0x5a4140);})['then'](function(_0x4ad5b4){_0x2db10a[_0x0152('0x41')]=_0x4ad5b4;return _0x2db10a;})[_0x0152('0x23')](respondWithFilteredResult(_0x4f2e15,_0x5a4140))[_0x0152('0x42')](handleError(_0x4f2e15,null));};exports[_0x0152('0x43')]=function(_0x46a6f9,_0x1e491e){var _0x406fd7={'raw':!![],'where':{'id':_0x46a6f9[_0x0152('0x44')]['id']}},_0x5822c3={};_0x5822c3[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x3e')][_0x0152('0x45')]);_0x5822c3[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x46a6f9['query']);_0x5822c3[_0x0152('0x30')]=_[_0x0152('0x31')](_0x5822c3['model'],_0x5822c3['query']);_0x406fd7[_0x0152('0x32')]=_[_0x0152('0x31')](_0x5822c3[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x46a6f9[_0x0152('0x2e')][_0x0152('0x33')]));_0x406fd7[_0x0152('0x32')]=_0x406fd7['attributes']['length']?_0x406fd7[_0x0152('0x32')]:_0x5822c3[_0x0152('0x2d')];if(_0x46a6f9[_0x0152('0x2e')]['includeAll']){_0x406fd7[_0x0152('0x46')]=[{'all':!![]}];}_0x406fd7=_[_0x0152('0x3c')]({},_0x406fd7,_0x46a6f9[_0x0152('0x47')]);return db[_0x0152('0x3e')][_0x0152('0x48')](_0x406fd7)['then'](handleEntityNotFound(_0x1e491e,null))[_0x0152('0x23')](respondWithResult(_0x1e491e,null))[_0x0152('0x42')](handleError(_0x1e491e,null));};exports[_0x0152('0x49')]=function(_0x1aa86d,_0x29f607){return db['JscriptySessionReport'][_0x0152('0x49')](_0x1aa86d['body'],{})['then'](respondWithResult(_0x29f607,0xc9))[_0x0152('0x42')](handleError(_0x29f607,null));};exports[_0x0152('0x4a')]=function(_0x4707f3,_0x263fa3){if(_0x4707f3[_0x0152('0x4b')]['id']){delete _0x4707f3[_0x0152('0x4b')]['id'];}return db['JscriptySessionReport'][_0x0152('0x48')]({'where':{'id':_0x4707f3[_0x0152('0x44')]['id']}})[_0x0152('0x23')](handleEntityNotFound(_0x263fa3,null))[_0x0152('0x23')](saveUpdates(_0x4707f3['body'],null))['then'](respondWithResult(_0x263fa3,null))['catch'](handleError(_0x263fa3,null));};exports['destroy']=function(_0x1c8c4e,_0x33b1ef){return db[_0x0152('0x3e')][_0x0152('0x48')]({'where':{'id':_0x1c8c4e['params']['id']}})[_0x0152('0x23')](handleEntityNotFound(_0x33b1ef,null))[_0x0152('0x23')](removeEntity(_0x33b1ef,null))[_0x0152('0x42')](handleError(_0x33b1ef,null));};exports[_0x0152('0x4c')]=function(_0x17eabc,_0x439a09){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x439a09,null))[_0x0152('0x42')](handleError(_0x439a09,null));};exports[_0x0152('0x4d')]=function(_0x502e73,_0x3d591f,_0x59e557){var _0x3d60dd={'raw':!![],'where':{}};var _0x3ca8dd={};var _0x2cf659={'count':0x0,'rows':[]};return db[_0x0152('0x3e')][_0x0152('0x4e')]({'where':{'id':_0x502e73[_0x0152('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d591f,null))[_0x0152('0x23')](function(_0x217d60){if(_0x217d60){_0x3ca8dd[_0x0152('0x2d')]=_[_0x0152('0x2f')](db[_0x0152('0x4f')]['rawAttributes']);_0x3ca8dd[_0x0152('0x2e')]=_[_0x0152('0x2f')](_0x502e73['query']);_0x3ca8dd['filters']=_[_0x0152('0x31')](_0x3ca8dd['model'],_0x3ca8dd['query']);_0x3d60dd['attributes']=_[_0x0152('0x31')](_0x3ca8dd[_0x0152('0x2d')],qs[_0x0152('0x33')](_0x502e73[_0x0152('0x2e')]['fields']));_0x3d60dd[_0x0152('0x32')]=_0x3d60dd[_0x0152('0x32')][_0x0152('0x34')]?_0x3d60dd[_0x0152('0x32')]:_0x3ca8dd[_0x0152('0x2d')];if(!_0x502e73[_0x0152('0x2e')]['hasOwnProperty'](_0x0152('0x36'))){_0x3d60dd[_0x0152('0x1f')]=qs['limit'](_0x502e73[_0x0152('0x2e')][_0x0152('0x1f')]);_0x3d60dd[_0x0152('0x1e')]=qs[_0x0152('0x1e')](_0x502e73[_0x0152('0x2e')][_0x0152('0x1e')]);}_0x3d60dd[_0x0152('0x37')]=qs[_0x0152('0x38')](_0x502e73[_0x0152('0x2e')]['sort']);_0x3d60dd[_0x0152('0x39')]=qs[_0x0152('0x30')](_[_0x0152('0x3a')](_0x502e73['query'],_0x3ca8dd['filters']));_0x3d60dd['where'][_0x0152('0x50')]=_0x217d60['id'];if(_0x502e73[_0x0152('0x2e')][_0x0152('0x3b')]){_0x3d60dd['where']=_['merge'](_0x3d60dd['where'],{'$or':_[_0x0152('0x29')](_0x3d60dd[_0x0152('0x32')],function(_0xec4a6a){var _0x127b1d={};_0x127b1d[_0xec4a6a]={'$like':'%'+_0x502e73[_0x0152('0x2e')][_0x0152('0x3b')]+'%'};return _0x127b1d;})});}_0x3d60dd=_[_0x0152('0x3c')]({},_0x3d60dd,_0x502e73['options']);return db[_0x0152('0x4f')][_0x0152('0x20')]({'where':_0x3d60dd[_0x0152('0x39')]})[_0x0152('0x23')](function(_0x407131){_0x2cf659[_0x0152('0x20')]=_0x407131;if(_0x502e73['query'][_0x0152('0x3f')]){_0x3d60dd[_0x0152('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3d60dd);})[_0x0152('0x23')](function(_0x4a60f2){_0x2cf659[_0x0152('0x41')]=_0x4a60f2;return _0x2cf659;});}})[_0x0152('0x23')](respondWithFilteredResult(_0x3d591f,_0x3d60dd))[_0x0152('0x42')](handleError(_0x3d591f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0a93e4f..48d9334 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 _0xf072=['path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','moment','request-promise'];(function(_0xca64d5,_0x347b69){var _0x99ff05=function(_0x4a464a){while(--_0x4a464a){_0xca64d5['push'](_0xca64d5['shift']());}};_0x99ff05(++_0x347b69);}(_0xf072,0x1cf));var _0x2f07=function(_0x6d6825,_0x1e6bad){_0x6d6825=_0x6d6825-0x0;var _0x445dff=_0xf072[_0x6d6825];return _0x445dff;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var logger=require(_0x2f07('0x2'))('api');var moment=require(_0x2f07('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f07('0x4'));var fs=require('fs');var path=require(_0x2f07('0x5'));var rimraf=require(_0x2f07('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f07('0x7'));module[_0x2f07('0x8')]=function(_0x3643bb,_0x2e6422){return _0x3643bb[_0x2f07('0x9')](_0x2f07('0xa'),attributes,{'tableName':_0x2f07('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x30920a,_0x29e5b3){var _0x37fa1c=function(_0x3476d2){while(--_0x3476d2){_0x30920a['push'](_0x30920a['shift']());}};_0x37fa1c(++_0x29e5b3);}(_0x7bd0,0x111));var _0x07bd=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x7bd0[_0x591cfd];return _0x4d0100;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));module[_0x07bd('0xa')]=function(_0x313548,_0x3e8349){return _0x313548[_0x07bd('0xb')](_0x07bd('0xc'),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 55c13a7..304c79a 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 _0x77e6=['client','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x10585d,_0x520162){var _0x43cfa8=function(_0xc2ca1d){while(--_0xc2ca1d){_0x10585d['push'](_0x10585d['shift']());}};_0x43cfa8(++_0x520162);}(_0x77e6,0x1a6));var _0x677e=function(_0x2e40d5,_0x3b4761){_0x2e40d5=_0x2e40d5-0x0;var _0x1ebb5a=_0x77e6[_0x2e40d5];return _0x1ebb5a;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file +var _0x32b6=['JscriptySessionReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code'];(function(_0x4f2498,_0x6428e1){var _0xe9a958=function(_0x174154){while(--_0x174154){_0x4f2498['push'](_0x4f2498['shift']());}};_0xe9a958(++_0x6428e1);}(_0x32b6,0x1d1));var _0x632b=function(_0x3737cb,_0x5a639f){_0x3737cb=_0x3737cb-0x0;var _0x3564be=_0x32b6[_0x3737cb];return _0x3564be;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 0246c9f..ac5ae6a 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 _0x8fde=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path','express'];(function(_0x4ce960,_0x4258e9){var _0x43a9d1=function(_0xc221e3){while(--_0xc221e3){_0x4ce960['push'](_0x4ce960['shift']());}};_0x43a9d1(++_0x4258e9);}(_0x8fde,0x1ac));var _0xe8fd=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8fde[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var path=require(_0xe8fd('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8fd('0x3'));var router=express[_0xe8fd('0x4')]();var fs_extra=require(_0xe8fd('0x5'));var auth=require(_0xe8fd('0x6'));var interaction=require(_0xe8fd('0x7'));var config=require('../../config/environment');var controller=require(_0xe8fd('0x8'));router[_0xe8fd('0x9')]('/',controller[_0xe8fd('0xa')]);router[_0xe8fd('0xb')](_0xe8fd('0xc'),auth[_0xe8fd('0xd')](),controller[_0xe8fd('0xe')]);router['get']('/download_log_file',auth[_0xe8fd('0xd')](),controller['downloadLogFile']);module[_0xe8fd('0xf')]=router; \ No newline at end of file +var _0x10b8=['../../config/environment','get','index','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','path','Router','fs-extra'];(function(_0x23363a,_0x10f9c3){var _0x40b369=function(_0x109f13){while(--_0x109f13){_0x23363a['push'](_0x23363a['shift']());}};_0x40b369(++_0x10f9c3);}(_0x10b8,0x1b6));var _0x810b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x10b8[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x810b('0x0'));var util=require('util');var path=require(_0x810b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x810b('0x2')]();var fs_extra=require(_0x810b('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x810b('0x4'));var controller=require('./license.controller');router[_0x810b('0x5')]('/',controller[_0x810b('0x6')]);router[_0x810b('0x7')](_0x810b('0x8'),auth[_0x810b('0x9')](),controller[_0x810b('0xa')]);router[_0x810b('0x5')](_0x810b('0xb'),auth[_0x810b('0x9')](),controller['downloadLogFile']);module[_0x810b('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7736302..5cf56cd 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 _0xe897=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xe897,0x123));var _0x7e89=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xe897[_0x261b8a];return _0x3455e8;};'use strict';var Sequelize=require(_0x7e89('0x0'));module[_0x7e89('0x1')]={'license':{'type':Sequelize[_0x7e89('0x2')]},'data1':{'type':Sequelize[_0x7e89('0x3')]},'data2':{'type':Sequelize[_0x7e89('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x7e89('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5292=['sequelize','TEXT','STRING'];(function(_0x25f797,_0x449916){var _0x157fdd=function(_0x329fe1){while(--_0x329fe1){_0x25f797['push'](_0x25f797['shift']());}};_0x157fdd(++_0x449916);}(_0x5292,0x9c));var _0x2529=function(_0x42c5a2,_0x38a2b9){_0x42c5a2=_0x42c5a2-0x0;var _0xbaf6e1=_0x5292[_0x42c5a2];return _0xbaf6e1;};'use strict';var Sequelize=require(_0x2529('0x0'));module['exports']={'license':{'type':Sequelize[_0x2529('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2529('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a3e5e0f..f1b89be 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 _0x6c63=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','destroy','then','error','stack','name','../../config/license/util','index','model','keys','rawAttributes','query','attributes','intersection','fields','length','merge','getLicense','catch','update','body','find','params','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x3b8155,_0x149298){var _0x4003ef=function(_0x15fdd0){while(--_0x15fdd0){_0x3b8155['push'](_0x3b8155['shift']());}};_0x4003ef(++_0x149298);}(_0x6c63,0x7b));var _0x36c6=function(_0x18a708,_0x5da6de){_0x18a708=_0x18a708-0x0;var _0x4303e8=_0x6c63[_0x18a708];return _0x4303e8;};'use strict';var emlformat=require(_0x36c6('0x0'));var rimraf=require(_0x36c6('0x1'));var zipdir=require(_0x36c6('0x2'));var jsonpatch=require(_0x36c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x36c6('0x4'));var Mustache=require(_0x36c6('0x5'));var util=require('util');var path=require(_0x36c6('0x6'));var sox=require('sox');var csv=require(_0x36c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36c6('0x8'));var _=require(_0x36c6('0x9'));var squel=require('squel');var crypto=require(_0x36c6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x36c6('0xb'));var toCsv=require(_0x36c6('0x7'));var querystring=require(_0x36c6('0xc'));var Papa=require(_0x36c6('0xd'));var Redis=require('ioredis');var authService=require(_0x36c6('0xe'));var qs=require(_0x36c6('0xf'));var as=require(_0x36c6('0x10'));var hardwareService=require(_0x36c6('0x11'));var logger=require('../../config/logger')(_0x36c6('0x12'));var utils=require(_0x36c6('0x13'));var config=require(_0x36c6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x36c6('0x15'))['db'];function respondWithStatusCode(_0x2dac60,_0x8f5c6d){_0x8f5c6d=_0x8f5c6d||0xcc;return function(_0x4a2ddf){if(_0x4a2ddf){return _0x2dac60[_0x36c6('0x16')](_0x8f5c6d);}return _0x2dac60['status'](_0x8f5c6d)[_0x36c6('0x17')]();};}function respondWithResult(_0x1a9cd1,_0x425eaa){_0x425eaa=_0x425eaa||0xc8;return function(_0x34ce72){if(_0x34ce72){return _0x1a9cd1['status'](_0x425eaa)[_0x36c6('0x18')](_0x34ce72);}};}function respondWithFilteredResult(_0x4ab226,_0x4ae9f3){return function(_0x37af82){if(_0x37af82){var _0x542196=typeof _0x4ae9f3[_0x36c6('0x19')]===_0x36c6('0x1a')&&typeof _0x4ae9f3[_0x36c6('0x1b')]===_0x36c6('0x1a');var _0x4999da=_0x37af82[_0x36c6('0x1c')];var _0x41b9c4=_0x542196?0x0:_0x4ae9f3[_0x36c6('0x19')];var _0x5243c5=_0x542196?_0x37af82[_0x36c6('0x1c')]:_0x4ae9f3['offset']+_0x4ae9f3[_0x36c6('0x1b')];var _0x2af2f8;if(_0x5243c5>=_0x4999da){_0x5243c5=_0x4999da;_0x2af2f8=0xc8;}else{_0x2af2f8=0xce;}_0x4ab226[_0x36c6('0x1d')](_0x2af2f8);return _0x4ab226['set'](_0x36c6('0x1e'),_0x41b9c4+'-'+_0x5243c5+'/'+_0x4999da)[_0x36c6('0x18')](_0x37af82);}return null;};}function patchUpdates(_0x4dc690){return function(_0xda142a){try{jsonpatch['apply'](_0xda142a,_0x4dc690,!![]);}catch(_0x2c54fc){return BPromise[_0x36c6('0x1f')](_0x2c54fc);}return _0xda142a['save']();};}function saveUpdates(_0x2c8f5b,_0x4241e2){return function(_0x29e117){if(_0x29e117){return _0x29e117['update'](_0x2c8f5b)['then'](function(_0x2a8270){return _0x2a8270;});}return null;};}function removeEntity(_0x5525a0,_0x3ae945){return function(_0x41aa16){if(_0x41aa16){return _0x41aa16[_0x36c6('0x20')]()[_0x36c6('0x21')](function(){_0x5525a0[_0x36c6('0x1d')](0xcc)[_0x36c6('0x17')]();});}};}function handleEntityNotFound(_0x48d864,_0x5082d0){return function(_0x50c95e){if(!_0x50c95e){_0x48d864[_0x36c6('0x16')](0x194);}return _0x50c95e;};}function handleError(_0x13568f,_0x3ccf9f){_0x3ccf9f=_0x3ccf9f||0x1f4;return function(_0x44d0d0){logger[_0x36c6('0x22')](_0x44d0d0[_0x36c6('0x23')]);if(_0x44d0d0[_0x36c6('0x24')]){delete _0x44d0d0[_0x36c6('0x24')];}_0x13568f[_0x36c6('0x1d')](_0x3ccf9f)['send'](_0x44d0d0);};}var utilLicense=require(_0x36c6('0x25'));exports[_0x36c6('0x26')]=function(_0x3a38b6,_0x2e1e26){var _0x2a9e7e={'raw':!![],'where':{'id':0x1}},_0x239895={};_0x239895[_0x36c6('0x27')]=_[_0x36c6('0x28')](db['License'][_0x36c6('0x29')]);_0x239895['query']=_['keys'](_0x3a38b6['query']);_0x239895['filters']=_['intersection'](_0x239895[_0x36c6('0x27')],_0x239895[_0x36c6('0x2a')]);_0x2a9e7e[_0x36c6('0x2b')]=_[_0x36c6('0x2c')](_0x239895[_0x36c6('0x27')],qs[_0x36c6('0x2d')](_0x3a38b6[_0x36c6('0x2a')][_0x36c6('0x2d')]));_0x2a9e7e[_0x36c6('0x2b')]=_0x2a9e7e[_0x36c6('0x2b')][_0x36c6('0x2e')]?_0x2a9e7e[_0x36c6('0x2b')]:_0x239895['model'];_0x2a9e7e=_[_0x36c6('0x2f')]({},_0x2a9e7e,_0x3a38b6['options']);return utilLicense[_0x36c6('0x30')](_0x2a9e7e)[_0x36c6('0x21')](respondWithResult(_0x2e1e26,null))[_0x36c6('0x31')](handleError(_0x2e1e26,null));};exports[_0x36c6('0x32')]=function(_0x17693e,_0x4eb0d4){if(_0x17693e[_0x36c6('0x33')]['id']){delete _0x17693e['body']['id'];}return db['License'][_0x36c6('0x34')]({'where':{'id':_0x17693e[_0x36c6('0x35')]['id']}})['then'](handleEntityNotFound(_0x4eb0d4,null))['then'](function(_0x34667d){var _0x2d43d5=_0x34667d[_0x36c6('0x36')]({'plain':!![]});return utilLicense[_0x36c6('0x37')](_0x2d43d5,_0x17693e[_0x36c6('0x33')][_0x36c6('0x38')]);})[_0x36c6('0x21')](function(_0x5370d6){if(!_0x5370d6[_0x36c6('0x39')]){return saveUpdates(_0x17693e['body'],null);}return _0x5370d6;})[_0x36c6('0x21')](respondWithResult(_0x4eb0d4,null))[_0x36c6('0x31')](handleError(_0x4eb0d4,null));};exports['downloadLogFile']=function(_0x54d6db,_0x1e1729){var _0x2beea9=_0x36c6('0x3a');var _0x3efe4c=path[_0x36c6('0x3b')](_0x36c6('0x3c'),_0x36c6('0x3d'),_0x36c6('0x3e'),_0x2beea9);_0x1e1729[_0x36c6('0x3f')]('Content-disposition',_0x36c6('0x40')+_0x2beea9);_0x1e1729[_0x36c6('0x41')](_0x36c6('0x42'),'text/plain');_0x1e1729[_0x36c6('0x43')](_0x3efe4c);}; \ No newline at end of file +var _0x68bd=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','license-info.log','join','/var','Content-disposition','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x68bd,0x182));var _0xd68b=function(_0x25390b,_0x1771ca){_0x25390b=_0x25390b-0x0;var _0x490180=_0x68bd[_0x25390b];return _0x490180;};'use strict';var emlformat=require(_0xd68b('0x0'));var rimraf=require(_0xd68b('0x1'));var zipdir=require(_0xd68b('0x2'));var jsonpatch=require(_0xd68b('0x3'));var rp=require(_0xd68b('0x4'));var moment=require('moment');var BPromise=require(_0xd68b('0x5'));var Mustache=require(_0xd68b('0x6'));var util=require('util');var path=require(_0xd68b('0x7'));var sox=require(_0xd68b('0x8'));var csv=require(_0xd68b('0x9'));var ejs=require(_0xd68b('0xa'));var fs=require('fs');var fs_extra=require(_0xd68b('0xb'));var _=require(_0xd68b('0xc'));var squel=require(_0xd68b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd68b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd68b('0x9'));var querystring=require(_0xd68b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd68b('0x10'));var authService=require(_0xd68b('0x11'));var qs=require(_0xd68b('0x12'));var as=require(_0xd68b('0x13'));var hardwareService=require(_0xd68b('0x14'));var logger=require(_0xd68b('0x15'))('api');var utils=require(_0xd68b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd68b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c804a,_0x38b8f3){_0x38b8f3=_0x38b8f3||0xcc;return function(_0x2ac7d6){if(_0x2ac7d6){return _0x5c804a[_0xd68b('0x18')](_0x38b8f3);}return _0x5c804a['status'](_0x38b8f3)[_0xd68b('0x19')]();};}function respondWithResult(_0x40d684,_0x796d6){_0x796d6=_0x796d6||0xc8;return function(_0x33ab53){if(_0x33ab53){return _0x40d684['status'](_0x796d6)[_0xd68b('0x1a')](_0x33ab53);}};}function respondWithFilteredResult(_0x7a4e3a,_0x3652c6){return function(_0xaf6faa){if(_0xaf6faa){var _0x392422=typeof _0x3652c6[_0xd68b('0x1b')]===_0xd68b('0x1c')&&typeof _0x3652c6[_0xd68b('0x1d')]==='undefined';var _0x453904=_0xaf6faa[_0xd68b('0x1e')];var _0xd94580=_0x392422?0x0:_0x3652c6[_0xd68b('0x1b')];var _0x8e2a14=_0x392422?_0xaf6faa[_0xd68b('0x1e')]:_0x3652c6['offset']+_0x3652c6[_0xd68b('0x1d')];var _0x7add2;if(_0x8e2a14>=_0x453904){_0x8e2a14=_0x453904;_0x7add2=0xc8;}else{_0x7add2=0xce;}_0x7a4e3a[_0xd68b('0x1f')](_0x7add2);return _0x7a4e3a[_0xd68b('0x20')](_0xd68b('0x21'),_0xd94580+'-'+_0x8e2a14+'/'+_0x453904)['json'](_0xaf6faa);}return null;};}function patchUpdates(_0x154d95){return function(_0x86d1a){try{jsonpatch[_0xd68b('0x22')](_0x86d1a,_0x154d95,!![]);}catch(_0x57e285){return BPromise['reject'](_0x57e285);}return _0x86d1a[_0xd68b('0x23')]();};}function saveUpdates(_0xceba03,_0x21442b){return function(_0x466382){if(_0x466382){return _0x466382[_0xd68b('0x24')](_0xceba03)[_0xd68b('0x25')](function(_0x5de3a6){return _0x5de3a6;});}return null;};}function removeEntity(_0x169e06,_0xf0d810){return function(_0x3b0f2a){if(_0x3b0f2a){return _0x3b0f2a[_0xd68b('0x26')]()[_0xd68b('0x25')](function(){_0x169e06[_0xd68b('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4357d0,_0x2f8dbd){return function(_0x1c62eb){if(!_0x1c62eb){_0x4357d0['sendStatus'](0x194);}return _0x1c62eb;};}function handleError(_0x3f6adf,_0x121ac0){_0x121ac0=_0x121ac0||0x1f4;return function(_0x127eda){logger['error'](_0x127eda['stack']);if(_0x127eda[_0xd68b('0x27')]){delete _0x127eda[_0xd68b('0x27')];}_0x3f6adf[_0xd68b('0x1f')](_0x121ac0)[_0xd68b('0x28')](_0x127eda);};}var utilLicense=require('../../config/license/util');exports[_0xd68b('0x29')]=function(_0xd971f7,_0x20e373){var _0x135f03={'raw':!![],'where':{'id':0x1}},_0x32de24={};_0x32de24[_0xd68b('0x2a')]=_[_0xd68b('0x2b')](db[_0xd68b('0x2c')][_0xd68b('0x2d')]);_0x32de24[_0xd68b('0x2e')]=_[_0xd68b('0x2b')](_0xd971f7[_0xd68b('0x2e')]);_0x32de24[_0xd68b('0x2f')]=_[_0xd68b('0x30')](_0x32de24[_0xd68b('0x2a')],_0x32de24[_0xd68b('0x2e')]);_0x135f03[_0xd68b('0x31')]=_[_0xd68b('0x30')](_0x32de24['model'],qs[_0xd68b('0x32')](_0xd971f7[_0xd68b('0x2e')]['fields']));_0x135f03[_0xd68b('0x31')]=_0x135f03[_0xd68b('0x31')][_0xd68b('0x33')]?_0x135f03[_0xd68b('0x31')]:_0x32de24[_0xd68b('0x2a')];_0x135f03=_[_0xd68b('0x34')]({},_0x135f03,_0xd971f7[_0xd68b('0x35')]);return utilLicense[_0xd68b('0x36')](_0x135f03)[_0xd68b('0x25')](respondWithResult(_0x20e373,null))[_0xd68b('0x37')](handleError(_0x20e373,null));};exports[_0xd68b('0x24')]=function(_0x152886,_0x25f0f3){if(_0x152886[_0xd68b('0x38')]['id']){delete _0x152886['body']['id'];}return db[_0xd68b('0x2c')][_0xd68b('0x39')]({'where':{'id':_0x152886['params']['id']}})[_0xd68b('0x25')](handleEntityNotFound(_0x25f0f3,null))[_0xd68b('0x25')](function(_0x46f649){var _0x1d98e2=_0x46f649[_0xd68b('0x3a')]({'plain':!![]});return utilLicense[_0xd68b('0x3b')](_0x1d98e2,_0x152886['body']['key']);})[_0xd68b('0x25')](function(_0x58f04b){if(!_0x58f04b['demo']){return saveUpdates(_0x152886[_0xd68b('0x38')],null);}return _0x58f04b;})[_0xd68b('0x25')](respondWithResult(_0x25f0f3,null))[_0xd68b('0x37')](handleError(_0x25f0f3,null));};exports['downloadLogFile']=function(_0x38b204,_0x37d953){var _0x525cf3=_0xd68b('0x3c');var _0x1a4c20=path[_0xd68b('0x3d')](_0xd68b('0x3e'),'log','xcally',_0x525cf3);_0x37d953['setHeader'](_0xd68b('0x3f'),'attachment;\x20filename='+_0x525cf3);_0x37d953[_0xd68b('0x20')](_0xd68b('0x40'),_0xd68b('0x41'));_0x37d953[_0xd68b('0x42')](_0x1a4c20);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a8f95ef..d757dc2 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 _0x92ad=['rimraf','../../config/environment','exports','define','License','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2f591c,_0x35103b){var _0x542c19=function(_0x1c226a){while(--_0x1c226a){_0x2f591c['push'](_0x2f591c['shift']());}};_0x542c19(++_0x35103b);}(_0x92ad,0x1d3));var _0xd92a=function(_0x42f394,_0x36f2a0){_0x42f394=_0x42f394-0x0;var _0x59d5b1=_0x92ad[_0x42f394];return _0x59d5b1;};'use strict';var _=require(_0xd92a('0x0'));var util=require(_0xd92a('0x1'));var logger=require(_0xd92a('0x2'))('api');var moment=require(_0xd92a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd92a('0x4'));var fs=require('fs');var path=require(_0xd92a('0x5'));var rimraf=require(_0xd92a('0x6'));var config=require(_0xd92a('0x7'));var attributes=require('./license.attributes');module[_0xd92a('0x8')]=function(_0x201860,_0x3f1b48){return _0x201860[_0xd92a('0x9')](_0xd92a('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf32=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','License','license'];(function(_0x50b3f3,_0x1824d2){var _0x14774a=function(_0x1cf14a){while(--_0x1cf14a){_0x50b3f3['push'](_0x50b3f3['shift']());}};_0x14774a(++_0x1824d2);}(_0xdf32,0x1a4));var _0x2df3=function(_0x2dca4b,_0x39971f){_0x2dca4b=_0x2dca4b-0x0;var _0x6ef9a4=_0xdf32[_0x2dca4b];return _0x6ef9a4;};'use strict';var _=require(_0x2df3('0x0'));var util=require('util');var logger=require(_0x2df3('0x1'))(_0x2df3('0x2'));var moment=require(_0x2df3('0x3'));var BPromise=require(_0x2df3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2df3('0x5'));var rimraf=require(_0x2df3('0x6'));var config=require(_0x2df3('0x7'));var attributes=require('./license.attributes');module[_0x2df3('0x8')]=function(_0xc56994,_0x35301d){return _0xc56994[_0x2df3('0x9')](_0x2df3('0xa'),attributes,{'tableName':_0x2df3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 6f78f32..adb4e28 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 _0x7e0a=['request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info'];(function(_0x1c4fa8,_0x10c2cd){var _0x5502cc=function(_0x49505a){while(--_0x49505a){_0x1c4fa8['push'](_0x1c4fa8['shift']());}};_0x5502cc(++_0x10c2cd);}(_0x7e0a,0x152));var _0xa7e0=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x7e0a[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xa7e0('0x0'));var util=require(_0xa7e0('0x1'));var moment=require(_0xa7e0('0x2'));var BPromise=require(_0xa7e0('0x3'));var rs=require(_0xa7e0('0x4'));var fs=require('fs');var Redis=require(_0xa7e0('0x5'));var db=require(_0xa7e0('0x6'))['db'];var utils=require(_0xa7e0('0x7'));var logger=require(_0xa7e0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa7e0('0x9'));var client=jayson['client'][_0xa7e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b0121,_0x101460,_0x46f866){return new BPromise(function(_0xde6e12,_0x56bc75){return client[_0xa7e0('0xb')](_0x1b0121,_0x46f866)[_0xa7e0('0xc')](function(_0x2ea329){logger[_0xa7e0('0xd')]('License,\x20%s,\x20%s',_0x101460,_0xa7e0('0xe'));logger['debug'](_0xa7e0('0xf'),_0x101460,_0xa7e0('0xe'),JSON[_0xa7e0('0x10')](_0x2ea329));if(_0x2ea329[_0xa7e0('0x11')]){if(_0x2ea329[_0xa7e0('0x11')][_0xa7e0('0x12')]===0x1f4){logger[_0xa7e0('0x11')](_0xa7e0('0x13'),_0x101460,_0x2ea329[_0xa7e0('0x11')][_0xa7e0('0x14')]);return _0x56bc75(_0x2ea329[_0xa7e0('0x11')][_0xa7e0('0x14')]);}logger[_0xa7e0('0x11')](_0xa7e0('0x13'),_0x101460,_0x2ea329['error']['message']);return _0xde6e12(_0x2ea329[_0xa7e0('0x11')][_0xa7e0('0x14')]);}else{logger[_0xa7e0('0xd')](_0xa7e0('0x13'),_0x101460,_0xa7e0('0xe'));_0xde6e12(_0x2ea329[_0xa7e0('0x15')][_0xa7e0('0x14')]);}})['catch'](function(_0x124f62){logger[_0xa7e0('0x11')](_0xa7e0('0x13'),_0x101460,_0x124f62);_0x56bc75(_0x124f62);});});} \ No newline at end of file +var _0xae1f=['info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then'];(function(_0x2b62c8,_0x36c80b){var _0x569ebb=function(_0x1f2f37){while(--_0x1f2f37){_0x2b62c8['push'](_0x2b62c8['shift']());}};_0x569ebb(++_0x36c80b);}(_0xae1f,0x15f));var _0xfae1=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xae1f[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0xfae1('0x0'));var util=require(_0xfae1('0x1'));var moment=require(_0xfae1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfae1('0x3'));var db=require(_0xfae1('0x4'))['db'];var utils=require(_0xfae1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfae1('0x6'));var client=jayson[_0xfae1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425165,_0x4eced4,_0x33b40e){return new BPromise(function(_0x25684d,_0x53350e){return client[_0xfae1('0x8')](_0x425165,_0x33b40e)[_0xfae1('0x9')](function(_0x53145f){logger[_0xfae1('0xa')](_0xfae1('0xb'),_0x4eced4,_0xfae1('0xc'));logger[_0xfae1('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'),JSON[_0xfae1('0xe')](_0x53145f));if(_0x53145f[_0xfae1('0xf')]){if(_0x53145f[_0xfae1('0xf')][_0xfae1('0x10')]===0x1f4){logger[_0xfae1('0xf')]('License,\x20%s,\x20%s',_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x53350e(_0x53145f['error']['message']);}logger[_0xfae1('0xf')](_0xfae1('0xb'),_0x4eced4,_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);return _0x25684d(_0x53145f[_0xfae1('0xf')][_0xfae1('0x11')]);}else{logger['info']('License,\x20%s,\x20%s',_0x4eced4,_0xfae1('0xc'));_0x25684d(_0x53145f['result'][_0xfae1('0x11')]);}})[_0xfae1('0x12')](function(_0x33c2ed){logger['error'](_0xfae1('0xb'),_0x4eced4,_0x33c2ed);_0x53350e(_0x33c2ed);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d516d99..691e193 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 _0x99c4=['/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','/:id/canned_answers','addAnswer','create','addApplications','/:id/send','send','put','/:id','update','delete','removeDispositions','removeImap','removeSmtp','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','show'];(function(_0x4de069,_0x3d9be2){var _0x3b4ee1=function(_0x52e667){while(--_0x52e667){_0x4de069['push'](_0x4de069['shift']());}};_0x3b4ee1(++_0x3d9be2);}(_0x99c4,0x7f));var _0x499c=function(_0x4393cb,_0x3ad9a5){_0x4393cb=_0x4393cb-0x0;var _0x5822dc=_0x99c4[_0x4393cb];return _0x5822dc;};'use strict';var multer=require(_0x499c('0x0'));var util=require('util');var path=require(_0x499c('0x1'));var timeout=require(_0x499c('0x2'));var express=require(_0x499c('0x3'));var router=express[_0x499c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x499c('0x5'));var interaction=require(_0x499c('0x6'));var config=require(_0x499c('0x7'));var controller=require(_0x499c('0x8'));router[_0x499c('0x9')]('/',auth[_0x499c('0xa')](),controller[_0x499c('0xb')]);router[_0x499c('0x9')]('/describe',auth[_0x499c('0xa')](),controller[_0x499c('0xc')]);router[_0x499c('0x9')]('/:id',auth[_0x499c('0xa')](),controller[_0x499c('0xd')]);router[_0x499c('0x9')](_0x499c('0xe'),auth[_0x499c('0xa')](),controller[_0x499c('0xf')]);router[_0x499c('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x499c('0x10')]);router[_0x499c('0x9')](_0x499c('0x11'),auth[_0x499c('0xa')](),controller[_0x499c('0x12')]);router[_0x499c('0x9')](_0x499c('0x13'),auth[_0x499c('0xa')](),controller[_0x499c('0x14')]);router[_0x499c('0x9')](_0x499c('0x15'),auth[_0x499c('0xa')](),controller[_0x499c('0x16')]);router[_0x499c('0x9')](_0x499c('0x17'),auth[_0x499c('0xa')](),controller[_0x499c('0x18')]);router[_0x499c('0x9')](_0x499c('0x19'),auth[_0x499c('0xa')](),controller[_0x499c('0x1a')]);router['get'](_0x499c('0x1b'),auth[_0x499c('0xa')](),controller[_0x499c('0x1c')]);router[_0x499c('0x9')](_0x499c('0x1d'),auth[_0x499c('0xa')](),controller['getAgents']);router[_0x499c('0x1e')]('/:id/dispositions',auth[_0x499c('0xa')](),controller[_0x499c('0x1f')]);router['post'](_0x499c('0x20'),auth[_0x499c('0xa')](),controller[_0x499c('0x21')]);router[_0x499c('0x1e')]('/',auth[_0x499c('0xa')](),controller[_0x499c('0x22')]);router[_0x499c('0x1e')](_0x499c('0x11'),auth[_0x499c('0xa')](),controller['addImap']);router[_0x499c('0x1e')](_0x499c('0x13'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x499c('0x1e')](_0x499c('0x15'),auth[_0x499c('0xa')](),controller['addInteraction']);router[_0x499c('0x1e')](_0x499c('0x17'),auth[_0x499c('0xa')](),controller[_0x499c('0x23')]);router[_0x499c('0x1e')](_0x499c('0x24'),auth[_0x499c('0xa')](),controller[_0x499c('0x25')]);router[_0x499c('0x1e')]('/:id/users',auth[_0x499c('0xa')](),controller['addAgents']);router[_0x499c('0x26')](_0x499c('0x27'),auth[_0x499c('0xa')](),controller[_0x499c('0x28')]);router[_0x499c('0x29')]('/:id/dispositions',auth[_0x499c('0xa')](),controller[_0x499c('0x2a')]);router['delete'](_0x499c('0x20'),auth[_0x499c('0xa')](),controller['removeAnswers']);router[_0x499c('0x29')]('/:id/in_servers',auth[_0x499c('0xa')](),controller[_0x499c('0x2b')]);router[_0x499c('0x29')]('/:id/out_servers',auth[_0x499c('0xa')](),controller[_0x499c('0x2c')]);router[_0x499c('0x29')]('/:id',auth[_0x499c('0xa')](),controller[_0x499c('0x2d')]);router[_0x499c('0x29')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x499c('0x2e')]=router; \ No newline at end of file +var _0x4040=['index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addAnswer','addImap','addSmtp','addInteraction','/:id/send','/:id/users','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x4980de,_0x30abca){var _0x637c8a=function(_0x2c6385){while(--_0x2c6385){_0x4980de['push'](_0x4980de['shift']());}};_0x637c8a(++_0x30abca);}(_0x4040,0xac));var _0x0404=function(_0x194612,_0x2ef463){_0x194612=_0x194612-0x0;var _0x659aba=_0x4040[_0x194612];return _0x659aba;};'use strict';var multer=require(_0x0404('0x0'));var util=require('util');var path=require(_0x0404('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0404('0x2')]();var fs_extra=require(_0x0404('0x3'));var auth=require(_0x0404('0x4'));var interaction=require(_0x0404('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x0404('0x6')]('/',auth[_0x0404('0x7')](),controller[_0x0404('0x8')]);router[_0x0404('0x6')](_0x0404('0x9'),auth['isAuthenticated'](),controller[_0x0404('0xa')]);router[_0x0404('0x6')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller['show']);router[_0x0404('0x6')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller[_0x0404('0xd')]);router[_0x0404('0x6')](_0x0404('0xe'),auth['isAuthenticated'](),controller[_0x0404('0xf')]);router[_0x0404('0x6')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller['getImap']);router[_0x0404('0x6')](_0x0404('0x11'),auth[_0x0404('0x7')](),controller[_0x0404('0x12')]);router[_0x0404('0x6')](_0x0404('0x13'),auth['isAuthenticated'](),controller[_0x0404('0x14')]);router[_0x0404('0x6')](_0x0404('0x15'),auth[_0x0404('0x7')](),controller[_0x0404('0x16')]);router[_0x0404('0x6')](_0x0404('0x17'),auth[_0x0404('0x7')](),controller[_0x0404('0x18')]);router[_0x0404('0x6')](_0x0404('0x19'),auth[_0x0404('0x7')](),controller[_0x0404('0x1a')]);router[_0x0404('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x0404('0x1b')]);router[_0x0404('0x1c')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x0404('0x7')](),controller[_0x0404('0x1d')]);router[_0x0404('0x1c')]('/',auth[_0x0404('0x7')](),controller['create']);router[_0x0404('0x1c')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller[_0x0404('0x1e')]);router[_0x0404('0x1c')](_0x0404('0x11'),auth['isAuthenticated'](),controller[_0x0404('0x1f')]);router[_0x0404('0x1c')](_0x0404('0x13'),auth[_0x0404('0x7')](),controller[_0x0404('0x20')]);router[_0x0404('0x1c')](_0x0404('0x15'),auth[_0x0404('0x7')](),controller['addApplications']);router[_0x0404('0x1c')](_0x0404('0x21'),auth[_0x0404('0x7')](),controller['send']);router[_0x0404('0x1c')](_0x0404('0x22'),auth[_0x0404('0x7')](),controller[_0x0404('0x23')]);router[_0x0404('0x24')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller[_0x0404('0x25')]);router[_0x0404('0x26')](_0x0404('0xc'),auth[_0x0404('0x7')](),controller['removeDispositions']);router[_0x0404('0x26')](_0x0404('0xe'),auth[_0x0404('0x7')](),controller[_0x0404('0x27')]);router[_0x0404('0x26')](_0x0404('0x10'),auth[_0x0404('0x7')](),controller[_0x0404('0x28')]);router[_0x0404('0x26')]('/:id/out_servers',auth[_0x0404('0x7')](),controller[_0x0404('0x29')]);router[_0x0404('0x26')](_0x0404('0xb'),auth[_0x0404('0x7')](),controller[_0x0404('0x2a')]);router[_0x0404('0x26')]('/:id/users',auth[_0x0404('0x7')](),controller[_0x0404('0x2b')]);module[_0x0404('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d228092..29bb8a2 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 _0xc707=['BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','provider','custom','getDataValue','sequelize','STRING'];(function(_0x3a3031,_0x2a2c96){var _0x546e72=function(_0x168797){while(--_0x168797){_0x3a3031['push'](_0x3a3031['shift']());}};_0x546e72(++_0x2a2c96);}(_0xc707,0x10c));var _0x7c70=function(_0x29d4b5,_0x1913e2){_0x29d4b5=_0x29d4b5-0x0;var _0x3fbb01=_0xc707[_0x29d4b5];return _0x3fbb01;};'use strict';var Sequelize=require(_0x7c70('0x0'));module['exports']={'description':{'type':Sequelize[_0x7c70('0x1')]},'name':{'type':Sequelize[_0x7c70('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x7c70('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7c70('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7c70('0x3')]},'markAsUnread':{'type':Sequelize[_0x7c70('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7c70('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7c70('0x4')](0x2)[_0x7c70('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7c70('0x3')],'defaultValue':function(){return _0x7c70('0x6');}},'notificationSound':{'type':Sequelize[_0x7c70('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7c70('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c70('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c70('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x7c70('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7c70('0x2')],'defaultValue':![],'comment':_0x7c70('0x8'),'set':function(_0x1ba201){if(!_0x1ba201)this[_0x7c70('0x9')](_0x7c70('0xa'),null);this[_0x7c70('0x9')](_0x7c70('0xb'),_0x1ba201);}},'provider':{'type':Sequelize['ENUM'](_0x7c70('0xc'),_0x7c70('0xd'),'yahoo',_0x7c70('0xe')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x7c70('0xf')))return _0x7c70('0x10');return this[_0x7c70('0x11')](_0x7c70('0xf'));},'set':function(_0x21554f){if(_0x21554f===_0x7c70('0x10'))_0x21554f=null;return this[_0x7c70('0x9')]('provider',_0x21554f);}}}; \ No newline at end of file +var _0x0f00=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','yahoo','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x3e72ff,_0x5d03d){var _0x48efd2=function(_0x259239){while(--_0x259239){_0x3e72ff['push'](_0x3e72ff['shift']());}};_0x48efd2(++_0x5d03d);}(_0x0f00,0x1d2));var _0x00f0=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x0f00[_0x368fb9];return _0x4892fb;};'use strict';var Sequelize=require(_0x00f0('0x0'));module[_0x00f0('0x1')]={'description':{'type':Sequelize[_0x00f0('0x2')]},'name':{'type':Sequelize[_0x00f0('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x00f0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x00f0('0x2')],'allowNull':![],'defaultValue':_0x00f0('0x4')},'fontSize':{'type':Sequelize[_0x00f0('0x5')](0x2)[_0x00f0('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x00f0('0x7')],'defaultValue':function(){return _0x00f0('0x8');}},'notificationSound':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x00f0('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x00f0('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x00f0('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x00f0('0x3')],'defaultValue':![],'comment':_0x00f0('0xa'),'set':function(_0x58ee90){if(!_0x58ee90)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x00f0('0xb')]('mandatoryDisposition',_0x58ee90);}},'provider':{'type':Sequelize[_0x00f0('0xc')](_0x00f0('0xd'),_0x00f0('0xe'),_0x00f0('0xf'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x00f0('0x10')]('provider'))return _0x00f0('0x11');return this[_0x00f0('0x10')](_0x00f0('0x12'));},'set':function(_0x299127){if(_0x299127===_0x00f0('0x11'))_0x299127=null;return this['setDataValue'](_0x00f0('0x12'),_0x299127);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index cf5ee5e..77a4f55 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 _0x650c=['getSmtpOptions','SendMail','List','messageId','subject','attach','out','Interaction','Messages','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','UserProfileResource','destroy','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','map','MailAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','Pause','mandatoryDispositionPause','keys','body','provider','custom','find','params','MailServerOut','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','hasOwnProperty','order','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','CloudProvider','from','%s\x20<%s>','attachments','join','root','basename'];(function(_0x419785,_0xf6f426){var _0x324ae1=function(_0x4eb655){while(--_0x4eb655){_0x419785['push'](_0x419785['shift']());}};_0x324ae1(++_0xf6f426);}(_0x650c,0x193));var _0xc650=function(_0x59342f,_0x270240){_0x59342f=_0x59342f-0x0;var _0x1cbda4=_0x650c[_0x59342f];return _0x1cbda4;};'use strict';var moment=require(_0xc650('0x0'));var BPromise=require('bluebird');var util=require(_0xc650('0x1'));var path=require(_0xc650('0x2'));var _=require(_0xc650('0x3'));var juice=require(_0xc650('0x4'));var Redis=require('ioredis');var qs=require(_0xc650('0x5'));var logger=require(_0xc650('0x6'))(_0xc650('0x7'));var config=require(_0xc650('0x8'));var db=require('../../mysqldb')['db'];config[_0xc650('0x9')]=_[_0xc650('0xa')](config[_0xc650('0x9')],{'host':_0xc650('0xb'),'port':0x18eb});var socket=require(_0xc650('0xc'))(new Redis(config[_0xc650('0x9')]));require(_0xc650('0xd'))[_0xc650('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc650('0xf')][_0xc650('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x284650,_0x43cb77,_0x2c49d5,_0x19d9c8){return new BPromise(function(_0x1778a2,_0x2df4b8){var _0x5399cf=_0x19d9c8||client;return _0x5399cf[_0xc650('0x11')](_0x284650,_0x2c49d5)['then'](function(_0x1e7f30){logger[_0xc650('0x12')](_0xc650('0x13'),_0x43cb77,_0xc650('0x14'));logger[_0xc650('0x15')](_0xc650('0x16'),_0x43cb77,_0xc650('0x14'),JSON[_0xc650('0x17')](_0x1e7f30));if(_0x1e7f30[_0xc650('0x18')]){if(_0x1e7f30[_0xc650('0x18')][_0xc650('0x19')]===0x1f4){logger[_0xc650('0x18')](_0xc650('0x13'),_0x43cb77,_0x1e7f30['error']['message']);return _0x2df4b8(_0x1e7f30[_0xc650('0x18')][_0xc650('0x1a')]);}logger[_0xc650('0x18')]('MailAccount,\x20%s,\x20%s',_0x43cb77,_0x1e7f30['error'][_0xc650('0x1a')]);return _0x1778a2(_0x1e7f30['error'][_0xc650('0x1a')]);}else{logger[_0xc650('0x12')](_0xc650('0x13'),_0x43cb77,'request\x20sent');_0x1778a2(_0x1e7f30[_0xc650('0x1b')][_0xc650('0x1a')]);}})[_0xc650('0x1c')](function(_0x5ddc36){logger[_0xc650('0x18')](_0xc650('0x13'),_0x43cb77,_0x5ddc36);_0x2df4b8(_0x5ddc36);});});}function respondWithStatusCode(_0x3848fa,_0x317996){_0x317996=_0x317996||0xcc;return function(_0x2dc3e1){if(_0x2dc3e1){return _0x3848fa[_0xc650('0x1d')](_0x317996);}return _0x3848fa['status'](_0x317996)[_0xc650('0x1e')]();};}function respondWithResult(_0x2c21a4,_0x1c0ec9){_0x1c0ec9=_0x1c0ec9||0xc8;return function(_0x432841){if(_0x432841){return _0x2c21a4[_0xc650('0x1f')](_0x1c0ec9)[_0xc650('0x20')](_0x432841);}};}function respondWithFilteredResult(_0x248592,_0x3e610e){return function(_0x3a4bad){if(_0x3a4bad){var _0x4696f0=typeof _0x3e610e[_0xc650('0x21')]===_0xc650('0x22')&&typeof _0x3e610e[_0xc650('0x23')]==='undefined';var _0x43b04d=_0x3a4bad['count'];var _0x42f894=_0x4696f0?0x0:_0x3e610e['offset'];var _0x530223=_0x4696f0?_0x3a4bad[_0xc650('0x24')]:_0x3e610e[_0xc650('0x21')]+_0x3e610e[_0xc650('0x23')];var _0x27eebb;if(_0x530223>=_0x43b04d){_0x530223=_0x43b04d;_0x27eebb=0xc8;}else{_0x27eebb=0xce;}_0x248592[_0xc650('0x1f')](_0x27eebb);return _0x248592[_0xc650('0x25')](_0xc650('0x26'),_0x42f894+'-'+_0x530223+'/'+_0x43b04d)[_0xc650('0x20')](_0x3a4bad);}return null;};}function saveUpdates(_0x4b11e2){return function(_0x32e32f){if(_0x32e32f){return _0x32e32f[_0xc650('0x27')](_0x4b11e2)['then'](function(_0x3d3d4b){return _0x3d3d4b;});}return null;};}function removeEntity(_0x50cf4d){return function(_0x58c561){if(_0x58c561){return _0x58c561['destroy']()[_0xc650('0x28')](function(){var _0x1d778c=_0x58c561[_0xc650('0x29')]({'plain':!![]});var _0x2619bc='MailAccounts';return db[_0xc650('0x2a')][_0xc650('0x2b')]({'where':{'type':_0x2619bc,'resourceId':_0x1d778c['id']}})['then'](function(){return _0x58c561;});})['then'](function(){_0x50cf4d[_0xc650('0x1f')](0xcc)[_0xc650('0x1e')]();});}};}function handleEntityNotFound(_0x421117){return function(_0x40119f){if(!_0x40119f){_0x421117[_0xc650('0x1d')](0x194);}return _0x40119f;};}function handleError(_0x3104c6,_0x46059b){_0x46059b=_0x46059b||0x1f4;return function(_0x513de1){logger[_0xc650('0x18')](_0x513de1['stack']);if(_0x513de1[_0xc650('0x2c')]){delete _0x513de1[_0xc650('0x2c')];}_0x3104c6['status'](_0x46059b)[_0xc650('0x2d')](_0x513de1);};}function getImapHost(_0x384f3a){switch(_0x384f3a){case'gmail':return _0xc650('0x2e');case _0xc650('0x2f'):return _0xc650('0x30');case _0xc650('0x31'):return _0xc650('0x32');case _0xc650('0x33'):return _0xc650('0x34');}throw new Error(_0xc650('0x35'),_0x384f3a);}function getSmtpHost(_0x4c04a6){switch(_0x4c04a6){case _0xc650('0x36'):return _0xc650('0x37');case'yahoo':return _0xc650('0x38');case'hotmail':return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0xc650('0x35'),_0x4c04a6);}function getAuthenticationOptions(_0x21782c,_0x104430){var _0xe5a091={};var _0x3f377e={};if(_0x21782c){_0xe5a091['user']=_0x3f377e[_0xc650('0x39')]=_0x104430[_0xc650('0x3a')];_0xe5a091[_0xc650('0x3b')]=_0x3f377e[_0xc650('0x3c')]=_0x104430[_0xc650('0x3b')];if(_0x104430['modernAuthentication']){_0xe5a091[_0xc650('0x3d')]=_0x3f377e['modernAuthentication']=!![];_0xe5a091['CloudProviderId']=_0x3f377e[_0xc650('0x3e')]=_0x104430[_0xc650('0x3e')];_0xe5a091[_0xc650('0x3b')]=_0x3f377e[_0xc650('0x3c')]=null;}else{_0xe5a091[_0xc650('0x3e')]=_0x3f377e[_0xc650('0x3e')]=null;}_0xe5a091[_0xc650('0x3f')]=getImapHost(_0x21782c);_0xe5a091[_0xc650('0x40')]=0x3e1;_0x3f377e['host']=getSmtpHost(_0x21782c);_0x3f377e[_0xc650('0x40')]=0x24b;_0x3f377e[_0xc650('0x41')]=![];_0xe5a091[_0xc650('0x42')]=_0x3f377e[_0xc650('0x42')]=null;}else{if(_0x104430[_0xc650('0x43')]){_0xe5a091[_0xc650('0x39')]=_0x3f377e[_0xc650('0x39')]=_0x104430[_0xc650('0x3a')];_0xe5a091['password']=_0x3f377e[_0xc650('0x3c')]=_0x104430[_0xc650('0x3b')];}else{_0xe5a091[_0xc650('0x43')]=_0x3f377e[_0xc650('0x43')]=![];_0xe5a091['user']=_0x3f377e['user']=null;_0xe5a091['password']=_0x3f377e[_0xc650('0x3c')]=null;}_0xe5a091['host']=_0x104430['Imap'][_0xc650('0x3f')];_0xe5a091['port']=_0x104430[_0xc650('0x44')]['port'];_0x3f377e[_0xc650('0x3f')]=_0x104430[_0xc650('0x45')][_0xc650('0x3f')];_0x3f377e[_0xc650('0x40')]=_0x104430[_0xc650('0x45')][_0xc650('0x40')];}return{'Imap':_0xe5a091,'Smtp':_0x3f377e};}exports[_0xc650('0x46')]=function(_0x45ecb6,_0x151432){var _0x51acf4={'include':[{'model':db[_0xc650('0x47')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xc650('0x45')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4244c7={},_0x1588d1={'count':0x0,'rows':[]};var _0x5a9b95=_[_0xc650('0x48')](db[_0xc650('0x49')][_0xc650('0x4a')],function(_0x1724e3){return{'name':_0x1724e3[_0xc650('0x4b')],'type':_0x1724e3[_0xc650('0x4c')][_0xc650('0x4d')]};});_0x4244c7[_0xc650('0x4e')]=_[_0xc650('0x48')](_0x5a9b95,'name');_0x4244c7[_0xc650('0x4f')]=_['keys'](_0x45ecb6[_0xc650('0x4f')]);_0x4244c7['filters']=_['intersection'](_0x4244c7[_0xc650('0x4e')],_0x4244c7['query']);_0x51acf4[_0xc650('0x50')]=_[_0xc650('0x51')](_0x4244c7[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x45ecb6['query'][_0xc650('0x52')]));_0x51acf4[_0xc650('0x50')]=_0x51acf4[_0xc650('0x50')][_0xc650('0x53')]?_0x51acf4[_0xc650('0x50')]:_0x4244c7[_0xc650('0x4e')];if(!_0x45ecb6['query']['hasOwnProperty'](_0xc650('0x54'))){_0x51acf4[_0xc650('0x23')]=qs['limit'](_0x45ecb6['query'][_0xc650('0x23')]);_0x51acf4[_0xc650('0x21')]=qs[_0xc650('0x21')](_0x45ecb6[_0xc650('0x4f')][_0xc650('0x21')]);}_0x51acf4['order']=qs[_0xc650('0x55')](_0x45ecb6[_0xc650('0x4f')][_0xc650('0x55')]);_0x51acf4[_0xc650('0x56')]=qs['filters'](_[_0xc650('0x57')](_0x45ecb6[_0xc650('0x4f')],_0x4244c7[_0xc650('0x58')]),_0x5a9b95);if(_0x45ecb6[_0xc650('0x4f')]['filter']){_0x51acf4[_0xc650('0x56')]=_[_0xc650('0x59')](_0x51acf4[_0xc650('0x56')],{'$or':_[_0xc650('0x48')](_0x5a9b95,function(_0x561219){if(_0x561219[_0xc650('0x4c')]!==_0xc650('0x5a')){var _0xc6421a={};_0xc6421a[_0x561219[_0xc650('0x2c')]]={'$like':'%'+_0x45ecb6[_0xc650('0x4f')][_0xc650('0x5b')]+'%'};return _0xc6421a;}})});}_0x51acf4=_[_0xc650('0x59')]({},_0x51acf4,_0x45ecb6[_0xc650('0x5c')]);var _0x337d7d={'where':_0x51acf4[_0xc650('0x56')]};return db['MailAccount']['count'](_0x337d7d)[_0xc650('0x28')](function(_0x4b28ab){_0x1588d1[_0xc650('0x24')]=_0x4b28ab;if(_0x45ecb6['query'][_0xc650('0x5d')]){_0x51acf4[_0xc650('0x5e')]=[{'all':!![]}];}return db['MailAccount'][_0xc650('0x5f')](_0x51acf4);})[_0xc650('0x28')](function(_0x23c2c2){_0x1588d1['rows']=_0x23c2c2;return _0x1588d1;})[_0xc650('0x28')](respondWithFilteredResult(_0x151432,_0x51acf4))[_0xc650('0x1c')](handleError(_0x151432,null));};exports['show']=function(_0x14d60c,_0x2394ba){var _0x399d76={'raw':![],'where':{'id':_0x14d60c['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xc650('0x44')},{'model':db['MailServerOut'],'as':_0xc650('0x45')},{'model':db[_0xc650('0x60')],'as':_0xc650('0x61')}]},_0x53b0ff={};_0x53b0ff[_0xc650('0x4e')]=_[_0xc650('0x62')](db['MailAccount'][_0xc650('0x4a')]);_0x53b0ff[_0xc650('0x4f')]=_['keys'](_0x14d60c[_0xc650('0x4f')]);_0x53b0ff[_0xc650('0x58')]=_['intersection'](_0x53b0ff['model'],_0x53b0ff[_0xc650('0x4f')]);_0x399d76['attributes']=_[_0xc650('0x51')](_0x53b0ff[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x14d60c[_0xc650('0x4f')]['fields']));_0x399d76[_0xc650('0x50')]=_0x399d76['attributes']['length']?_0x399d76[_0xc650('0x50')]:_0x53b0ff[_0xc650('0x4e')];if(_0x14d60c[_0xc650('0x4f')][_0xc650('0x5d')]){_0x399d76['include']=[{'all':!![]}];}_0x399d76=_['merge']({},_0x399d76,_0x14d60c[_0xc650('0x5c')]);return db[_0xc650('0x49')]['find'](_0x399d76)['then'](handleEntityNotFound(_0x2394ba,null))[_0xc650('0x28')](respondWithResult(_0x2394ba,null))['catch'](handleError(_0x2394ba,null));};exports[_0xc650('0x27')]=function(_0x1b29b9,_0x5e5c05){if(_0x1b29b9[_0xc650('0x63')]['id']){delete _0x1b29b9[_0xc650('0x63')]['id'];}var _0x112a6a=_0x1b29b9['body'][_0xc650('0x64')]===_0xc650('0x65')?null:_0x1b29b9[_0xc650('0x63')][_0xc650('0x64')];var _0x4d81a2=_0x1b29b9[_0xc650('0x63')][_0xc650('0x44')]||{};var _0x53eee7=_0x1b29b9[_0xc650('0x63')][_0xc650('0x45')]||{};if(_0x112a6a){_0x4d81a2[_0xc650('0x3f')]=getImapHost(_0x112a6a);_0x4d81a2['port']=0x3e1;_0x53eee7[_0xc650('0x3f')]=getSmtpHost(_0x112a6a);_0x53eee7[_0xc650('0x40')]=0x24b;_0x53eee7['secure']=![];}if(_0x53eee7[_0xc650('0x3d')]){_0x53eee7['secure']=![];}else{_0x53eee7['CloudProviderId']=null;}if(!_0x4d81a2[_0xc650('0x3d')])_0x4d81a2[_0xc650('0x3e')]=null;_0x1b29b9[_0xc650('0x63')][_0xc650('0x44')]=_0x4d81a2;_0x1b29b9[_0xc650('0x63')][_0xc650('0x45')]=_0x53eee7;return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x1b29b9[_0xc650('0x67')]['id']},'include':[{'model':db[_0xc650('0x47')],'as':_0xc650('0x44')},{'model':db[_0xc650('0x68')],'as':_0xc650('0x45')},{'model':db[_0xc650('0x60')],'as':_0xc650('0x61')}]})[_0xc650('0x28')](handleEntityNotFound(_0x5e5c05,null))[_0xc650('0x28')](function(_0xca75b3){if(!_0xca75b3)throw new Error(_0xc650('0x69'));if(_0xca75b3[_0xc650('0x42')])delete _0x1b29b9['body'][_0xc650('0x44')];return _0xca75b3;})['then'](saveUpdates(_0x1b29b9['body'],null))[_0xc650('0x28')](function(_0xfe3f01){if(!_0x1b29b9['body'][_0xc650('0x44')])return _0xfe3f01;return db['MailServerIn'][_0xc650('0x27')](_0x1b29b9[_0xc650('0x63')][_0xc650('0x44')],{'where':{'MailAccountId':_0xfe3f01['id']}})['then'](function(){return _0xfe3f01;});})[_0xc650('0x28')](function(_0x7d7ac6){if(!_0x1b29b9[_0xc650('0x63')][_0xc650('0x45')])return _0x7d7ac6;return db[_0xc650('0x68')][_0xc650('0x27')](_0x1b29b9[_0xc650('0x63')][_0xc650('0x45')],{'where':{'MailAccountId':_0x7d7ac6['id']}})[_0xc650('0x28')](function(){return _0x7d7ac6;});})['then'](respondWithResult(_0x5e5c05,null))[_0xc650('0x1c')](handleError(_0x5e5c05,null));};exports['describe']=function(_0x1a4bfa,_0x159d9b){return db[_0xc650('0x49')]['describe']()[_0xc650('0x28')](respondWithResult(_0x159d9b,null))[_0xc650('0x1c')](handleError(_0x159d9b,null));};exports[_0xc650('0x6a')]=function(_0x43073c,_0x55f9ca){if(_0x43073c['body']['id']){delete _0x43073c[_0xc650('0x63')]['id'];}return db[_0xc650('0x49')]['find']({'where':{'id':_0x43073c['params']['id']}})['then'](handleEntityNotFound(_0x55f9ca,null))[_0xc650('0x28')](function(_0x1f551b){if(_0x1f551b){_0x43073c['body'][_0xc650('0x6b')]=_0x1f551b['id'];return db['Disposition'][_0xc650('0x6c')](_0x43073c[_0xc650('0x63')]);}})[_0xc650('0x28')](respondWithResult(_0x55f9ca,null))[_0xc650('0x1c')](handleError(_0x55f9ca,null));};exports[_0xc650('0x6d')]=function(_0x2cc2af,_0x13ed37){var _0x49a654={'raw':![],'where':{}};var _0x1fecf0={};var _0x2d8b6b={'count':0x0,'rows':[]};return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x2cc2af['params']['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x13ed37,null))[_0xc650('0x28')](function(_0x330148){if(_0x330148){_0x1fecf0[_0xc650('0x4e')]=_['keys'](db[_0xc650('0x6f')][_0xc650('0x4a')]);_0x1fecf0[_0xc650('0x4f')]=_['keys'](_0x2cc2af['query']);_0x1fecf0[_0xc650('0x58')]=_['intersection'](_0x1fecf0[_0xc650('0x4e')],_0x1fecf0[_0xc650('0x4f')]);_0x49a654[_0xc650('0x50')]=_[_0xc650('0x51')](_0x1fecf0[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x2cc2af['query'][_0xc650('0x52')]));_0x49a654['attributes']=_0x49a654['attributes'][_0xc650('0x53')]?_0x49a654[_0xc650('0x50')]:_0x1fecf0[_0xc650('0x4e')];if(!_0x2cc2af[_0xc650('0x4f')][_0xc650('0x70')]('nolimit')){_0x49a654[_0xc650('0x23')]=qs[_0xc650('0x23')](_0x2cc2af[_0xc650('0x4f')]['limit']);_0x49a654[_0xc650('0x21')]=qs[_0xc650('0x21')](_0x2cc2af[_0xc650('0x4f')][_0xc650('0x21')]);}_0x49a654[_0xc650('0x71')]=qs[_0xc650('0x55')](_0x2cc2af[_0xc650('0x4f')][_0xc650('0x55')]);_0x49a654['where']=qs[_0xc650('0x58')](_[_0xc650('0x57')](_0x2cc2af[_0xc650('0x4f')],_0x1fecf0[_0xc650('0x58')]));_0x49a654[_0xc650('0x56')][_0xc650('0x6b')]=_0x330148['id'];if(_0x2cc2af['query'][_0xc650('0x5b')]){_0x49a654['where']=_[_0xc650('0x59')](_0x49a654[_0xc650('0x56')],{'$or':_[_0xc650('0x48')](_0x49a654[_0xc650('0x50')],function(_0x48a0d5){var _0x433795={};_0x433795[_0x48a0d5]={'$like':'%'+_0x2cc2af['query']['filter']+'%'};return _0x433795;})});}_0x49a654=_[_0xc650('0x59')]({},_0x49a654,_0x2cc2af[_0xc650('0x5c')]);return db[_0xc650('0x6f')][_0xc650('0x24')]({'where':_0x49a654[_0xc650('0x56')]})[_0xc650('0x28')](function(_0xe49224){_0x2d8b6b[_0xc650('0x24')]=_0xe49224;if(_0x2cc2af[_0xc650('0x4f')]['includeAll']){_0x49a654[_0xc650('0x5e')]=[{'all':!![]}];}return db[_0xc650('0x6f')]['findAll'](_0x49a654);})[_0xc650('0x28')](function(_0x281aa9){_0x2d8b6b[_0xc650('0x72')]=_0x281aa9;return _0x2d8b6b;});}})[_0xc650('0x28')](respondWithFilteredResult(_0x13ed37,_0x49a654))['catch'](handleError(_0x13ed37,null));};exports[_0xc650('0x73')]=function(_0x2ca8b5,_0x54803b){return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x2ca8b5[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x54803b,null))[_0xc650('0x28')](function(_0x158c50){if(_0x158c50){return _0x158c50[_0xc650('0x73')](_0x2ca8b5[_0xc650('0x4f')][_0xc650('0x74')]);}})['then'](respondWithStatusCode(_0x54803b,null))[_0xc650('0x1c')](handleError(_0x54803b,null));};exports[_0xc650('0x75')]=function(_0x24cdc3,_0x2359ae){if(_0x24cdc3['body']['id']){delete _0x24cdc3[_0xc650('0x63')]['id'];}return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x24cdc3[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x2359ae,null))['then'](function(_0x44c97a){if(_0x44c97a){_0x24cdc3[_0xc650('0x63')][_0xc650('0x6b')]=_0x44c97a['id'];return db['CannedAnswer'][_0xc650('0x6c')](_0x24cdc3[_0xc650('0x63')]);}})[_0xc650('0x28')](respondWithResult(_0x2359ae,null))[_0xc650('0x1c')](handleError(_0x2359ae,null));};exports[_0xc650('0x76')]=function(_0x2d500c,_0x4712ba){var _0x57117b={'raw':![],'where':{}};var _0x24cba5={};var _0x610df7={'count':0x0,'rows':[]};return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x2d500c[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x4712ba,null))[_0xc650('0x28')](function(_0x5b2fea){if(_0x5b2fea){_0x24cba5[_0xc650('0x4e')]=_[_0xc650('0x62')](db[_0xc650('0x77')][_0xc650('0x4a')]);_0x24cba5[_0xc650('0x4f')]=_['keys'](_0x2d500c['query']);_0x24cba5[_0xc650('0x58')]=_[_0xc650('0x51')](_0x24cba5[_0xc650('0x4e')],_0x24cba5[_0xc650('0x4f')]);_0x57117b[_0xc650('0x50')]=_[_0xc650('0x51')](_0x24cba5[_0xc650('0x4e')],qs['fields'](_0x2d500c[_0xc650('0x4f')]['fields']));_0x57117b[_0xc650('0x50')]=_0x57117b['attributes'][_0xc650('0x53')]?_0x57117b[_0xc650('0x50')]:_0x24cba5[_0xc650('0x4e')];if(!_0x2d500c[_0xc650('0x4f')][_0xc650('0x70')](_0xc650('0x54'))){_0x57117b[_0xc650('0x23')]=qs[_0xc650('0x23')](_0x2d500c[_0xc650('0x4f')]['limit']);_0x57117b['offset']=qs[_0xc650('0x21')](_0x2d500c[_0xc650('0x4f')][_0xc650('0x21')]);}_0x57117b[_0xc650('0x71')]=qs[_0xc650('0x55')](_0x2d500c['query']['sort']);_0x57117b[_0xc650('0x56')]=qs[_0xc650('0x58')](_[_0xc650('0x57')](_0x2d500c['query'],_0x24cba5[_0xc650('0x58')]));_0x57117b[_0xc650('0x56')][_0xc650('0x6b')]=_0x5b2fea['id'];if(_0x2d500c[_0xc650('0x4f')][_0xc650('0x5b')]){_0x57117b[_0xc650('0x56')]=_[_0xc650('0x59')](_0x57117b[_0xc650('0x56')],{'$or':_[_0xc650('0x48')](_0x57117b['attributes'],function(_0x5111c5){var _0x555275={};_0x555275[_0x5111c5]={'$like':'%'+_0x2d500c[_0xc650('0x4f')][_0xc650('0x5b')]+'%'};return _0x555275;})});}_0x57117b=_[_0xc650('0x59')]({},_0x57117b,_0x2d500c[_0xc650('0x5c')]);return db[_0xc650('0x77')][_0xc650('0x24')]({'where':_0x57117b[_0xc650('0x56')]})[_0xc650('0x28')](function(_0x482749){_0x610df7[_0xc650('0x24')]=_0x482749;if(_0x2d500c[_0xc650('0x4f')][_0xc650('0x5d')]){_0x57117b[_0xc650('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc650('0x5f')](_0x57117b);})['then'](function(_0x3b017f){_0x610df7[_0xc650('0x72')]=_0x3b017f;return _0x610df7;});}})[_0xc650('0x28')](respondWithFilteredResult(_0x4712ba,_0x57117b))[_0xc650('0x1c')](handleError(_0x4712ba,null));};exports[_0xc650('0x78')]=function(_0x2edcb0,_0x78445c){return db[_0xc650('0x49')]['find']({'where':{'id':_0x2edcb0['params']['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x78445c,null))[_0xc650('0x28')](function(_0x341d2f){if(_0x341d2f){return _0x341d2f[_0xc650('0x78')](_0x2edcb0[_0xc650('0x4f')][_0xc650('0x74')]);}})[_0xc650('0x28')](respondWithStatusCode(_0x78445c,null))[_0xc650('0x1c')](handleError(_0x78445c,null));};exports[_0xc650('0x6c')]=function(_0x6f4f00,_0x51e138){var _0x1c3081={'name':_0x6f4f00[_0xc650('0x63')][_0xc650('0x2c')],'key':_0x6f4f00[_0xc650('0x63')][_0xc650('0x4d')],'provider':_0x6f4f00['body'][_0xc650('0x64')]===_0xc650('0x65')?null:_0x6f4f00[_0xc650('0x63')][_0xc650('0x64')],'email':_0x6f4f00[_0xc650('0x63')][_0xc650('0x79')],'ListId':_0x6f4f00[_0xc650('0x63')][_0xc650('0x7a')],'active':!_[_0xc650('0x7b')](_0x6f4f00[_0xc650('0x63')][_0xc650('0x7c')])?_0x6f4f00[_0xc650('0x63')][_0xc650('0x7c')]:!![],'description':_0x6f4f00['body']['description']||null};var _0x2a088f=getAuthenticationOptions(_0x1c3081[_0xc650('0x64')],_0x6f4f00[_0xc650('0x63')]);_0x1c3081[_0xc650('0x44')]=_0x2a088f[_0xc650('0x44')];_0x1c3081[_0xc650('0x45')]=_0x2a088f[_0xc650('0x45')];return db[_0xc650('0x49')][_0xc650('0x6c')](_0x1c3081,{'include':[{'model':db[_0xc650('0x68')],'as':_0xc650('0x45')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xc650('0x28')](function(_0x53cc73){var _0x48ac96=_0x6f4f00[_0xc650('0x39')][_0xc650('0x29')]({'plain':!![]});if(!_0x48ac96)throw new Error(_0xc650('0x7d'));if(_0x48ac96['role']===_0xc650('0x39')){var _0x5e8f02=_0x53cc73['get']({'plain':!![]});return db['UserProfileSection'][_0xc650('0x66')]({'where':{'name':_0xc650('0x7e'),'userProfileId':_0x48ac96['userProfileId']},'raw':!![]})[_0xc650('0x28')](function(_0x378bd2){if(_0x378bd2&&_0x378bd2[_0xc650('0x7f')]===0x0){return db[_0xc650('0x2a')][_0xc650('0x6c')]({'name':_0x5e8f02['name'],'resourceId':_0x5e8f02['id'],'type':_0x378bd2[_0xc650('0x2c')],'sectionId':_0x378bd2['id']},{})[_0xc650('0x28')](function(){return _0x53cc73;});}else{return _0x53cc73;}})[_0xc650('0x1c')](function(_0x25e759){logger[_0xc650('0x18')](_0xc650('0x80'),_0x25e759);throw _0x25e759;});}return _0x53cc73;})[_0xc650('0x28')](respondWithResult(_0x51e138,0xc9))[_0xc650('0x1c')](handleError(_0x51e138,null));};exports[_0xc650('0x81')]=function(_0x3b0c33,_0x18e210){return db[_0xc650('0x49')]['findOne']({'where':{'id':_0x3b0c33[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x18e210,null))[_0xc650('0x28')](function(_0x242634){if(_0x242634){return _0x242634[_0xc650('0x81')]();}return null;})[_0xc650('0x28')](respondWithResult(_0x18e210,null))['catch'](handleError(_0x18e210,null));};exports[_0xc650('0x82')]=function(_0x22e19f,_0x47fbea){if(_0x22e19f['body']['id']){delete _0x22e19f[_0xc650('0x63')]['id'];}return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x22e19f['params']['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x47fbea,null))[_0xc650('0x28')](function(_0x43e88e){if(_0x43e88e){_0x22e19f[_0xc650('0x63')]['MailAccountId']=_0x43e88e['id'];return db[_0xc650('0x47')]['create'](_0x22e19f[_0xc650('0x63')]);}})['then'](respondWithResult(_0x47fbea,null))[_0xc650('0x1c')](handleError(_0x47fbea,null));};exports[_0xc650('0x83')]=function(_0x4675b9,_0x19a7cf){return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x4675b9[_0xc650('0x67')]['id']}})['then'](handleEntityNotFound(_0x19a7cf,null))[_0xc650('0x28')](function(_0x564cea){if(_0x564cea){return _0x564cea[_0xc650('0x84')](null);}return null;})[_0xc650('0x28')](respondWithStatusCode(_0x19a7cf,null))[_0xc650('0x1c')](handleError(_0x19a7cf,null));};exports[_0xc650('0x85')]=function(_0x5b2f94,_0x31dca2){return db[_0xc650('0x49')]['findOne']({'where':{'id':_0x5b2f94[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x31dca2,null))['then'](function(_0xc7a467){if(_0xc7a467){return _0xc7a467[_0xc650('0x85')]();}return null;})['then'](respondWithResult(_0x31dca2,null))[_0xc650('0x1c')](handleError(_0x31dca2,null));};exports[_0xc650('0x86')]=function(_0x1855fa,_0x4ca5a8){if(_0x1855fa[_0xc650('0x63')]['id']){delete _0x1855fa[_0xc650('0x63')]['id'];}return db['MailAccount'][_0xc650('0x66')]({'where':{'id':_0x1855fa[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x4ca5a8,null))[_0xc650('0x28')](function(_0x588b21){if(_0x588b21){_0x1855fa[_0xc650('0x63')][_0xc650('0x6b')]=_0x588b21['id'];return db['MailServerOut'][_0xc650('0x6c')](_0x1855fa[_0xc650('0x63')]);}})[_0xc650('0x28')](respondWithResult(_0x4ca5a8,null))[_0xc650('0x1c')](handleError(_0x4ca5a8,null));};exports[_0xc650('0x87')]=function(_0x58dd16,_0x51a1d4){return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x58dd16['params']['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x51a1d4,null))[_0xc650('0x28')](function(_0x3997e2){if(_0x3997e2){return _0x3997e2[_0xc650('0x88')](null);}return null;})[_0xc650('0x28')](respondWithStatusCode(_0x51a1d4,null))[_0xc650('0x1c')](handleError(_0x51a1d4,null));};exports[_0xc650('0x89')]=function(_0x406537,_0x9467c3){return db[_0xc650('0x8a')][_0xc650('0x66')]({'where':{'id':_0x406537[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x9467c3,null))[_0xc650('0x28')](function(_0x4a59a6){if(_0x4a59a6){return _0x4a59a6[_0xc650('0x89')](_0x406537['body'][_0xc650('0x74')],_[_0xc650('0x8b')](_0x406537[_0xc650('0x63')],['ids','id'])||{});}})[_0xc650('0x28')](respondWithResult(_0x9467c3,null))['catch'](handleError(_0x9467c3,null));};exports[_0xc650('0x8c')]=function(_0x164f23,_0x2a5075){var _0x39662f={'raw':![],'where':{}};var _0x2a5a12={};var _0x4edca9={'count':0x0,'rows':[]};return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x164f23[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x2a5075,null))[_0xc650('0x28')](function(_0x598ffe){if(_0x598ffe){_0x2a5a12[_0xc650('0x4e')]=_[_0xc650('0x62')](db['MailInteraction'][_0xc650('0x4a')]);_0x2a5a12[_0xc650('0x4f')]=_[_0xc650('0x62')](_0x164f23[_0xc650('0x4f')]);_0x2a5a12['filters']=_[_0xc650('0x51')](_0x2a5a12[_0xc650('0x4e')],_0x2a5a12[_0xc650('0x4f')]);_0x39662f[_0xc650('0x50')]=_[_0xc650('0x51')](_0x2a5a12[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x164f23[_0xc650('0x4f')][_0xc650('0x52')]));_0x39662f[_0xc650('0x50')]=_0x39662f[_0xc650('0x50')][_0xc650('0x53')]?_0x39662f[_0xc650('0x50')]:_0x2a5a12[_0xc650('0x4e')];if(!_0x164f23[_0xc650('0x4f')]['hasOwnProperty'](_0xc650('0x54'))){_0x39662f[_0xc650('0x23')]=qs['limit'](_0x164f23[_0xc650('0x4f')][_0xc650('0x23')]);_0x39662f['offset']=qs[_0xc650('0x21')](_0x164f23['query'][_0xc650('0x21')]);}_0x39662f[_0xc650('0x71')]=qs[_0xc650('0x55')](_0x164f23[_0xc650('0x4f')]['sort']);_0x39662f['where']=qs[_0xc650('0x58')](_[_0xc650('0x57')](_0x164f23[_0xc650('0x4f')],_0x2a5a12['filters']));_0x39662f[_0xc650('0x56')][_0xc650('0x6b')]=_0x598ffe['id'];if(_0x164f23[_0xc650('0x4f')][_0xc650('0x5b')]){_0x39662f[_0xc650('0x56')]=_['merge'](_0x39662f[_0xc650('0x56')],{'$or':_['map'](_0x39662f['attributes'],function(_0x16a5a9){var _0x2de895={};_0x2de895[_0x16a5a9]={'$like':'%'+_0x164f23[_0xc650('0x4f')][_0xc650('0x5b')]+'%'};return _0x2de895;})});}_0x39662f=_[_0xc650('0x59')]({},_0x39662f,_0x164f23[_0xc650('0x5c')]);return db[_0xc650('0x8a')][_0xc650('0x24')]({'where':_0x39662f[_0xc650('0x56')]})[_0xc650('0x28')](function(_0x1cb316){_0x4edca9['count']=_0x1cb316;if(_0x164f23[_0xc650('0x4f')]['includeAll']){_0x39662f['include']=[{'model':db[_0xc650('0x8d')],'as':_0xc650('0x8e'),'required':![]},{'model':db[_0xc650('0x8f')],'as':_0xc650('0x90'),'attributes':[_0xc650('0x2c'),_0xc650('0x91'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc650('0x92'),'attributes':['id',_0xc650('0x2c'),_0xc650('0x93')],'where':_0x164f23[_0xc650('0x4f')]['tag']?{'id':_0x164f23['query'][_0xc650('0x94')]}:undefined,'required':_0x164f23['query'][_0xc650('0x94')]?!![]:![]}];}return db[_0xc650('0x8a')][_0xc650('0x5f')](_0x39662f);})[_0xc650('0x28')](function(_0x40209a){_0x4edca9[_0xc650('0x72')]=_0x40209a;return _0x4edca9;});}})['then'](respondWithFilteredResult(_0x2a5075,_0x39662f))[_0xc650('0x1c')](handleError(_0x2a5075,null));};exports[_0xc650('0x95')]=function addApplications(_0x4b132,_0x24f6e2){var _0x4e1c22=_0x4b132[_0xc650('0x67')]['id'];var _0x28046a=_0x4b132[_0xc650('0x63')];var _0x240bc3=0xc8;var _0x33d4b0=null;return db[_0xc650('0x96')][_0xc650('0x97')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xc650('0x98')]},function(_0x284efe){return db['MailAccount'][_0xc650('0x6e')]({'where':{'id':_0x4e1c22},'transaction':_0x284efe})[_0xc650('0x28')](function(_0x35f9c3){if(_0x35f9c3){return db[_0xc650('0x99')]['destroy']({'where':{'MailAccountId':_0x4e1c22},'transaction':_0x284efe})['then'](function(){var _0x2f4811=_[_0xc650('0x48')](_0x28046a,function(_0x21e6c3){_0x21e6c3[_0xc650('0x6b')]=_0x4e1c22;return _0x21e6c3;});return db[_0xc650('0x99')][_0xc650('0x9a')](_0x2f4811,{'transaction':_0x284efe});});}else{_0x240bc3=0x194;_0x33d4b0=[];}});})[_0xc650('0x28')](function(){if(_0x240bc3!==0x194){return db['MailApplication'][_0xc650('0x9b')]({'where':{'MailAccountId':_0x4e1c22},'order':_0xc650('0x9c')})['then'](function(_0x129869){_0x33d4b0=_0x129869;});}})[_0xc650('0x1c')](function(_0x4941b4){_0x240bc3=0x1f4;logger[_0xc650('0x18')](_0x4941b4[_0xc650('0x9d')]);if(_0x4941b4[_0xc650('0x2c')]){delete _0x4941b4['name'];}_0x33d4b0=_0x4941b4;})[_0xc650('0x9e')](function(){if(_0x33d4b0===null){_0x24f6e2['sendStatus'](_0x240bc3);}else{if(_0x240bc3===0x1f4){_0x24f6e2[_0xc650('0x1f')](_0x240bc3)[_0xc650('0x2d')](_0x33d4b0);}else{_0x24f6e2[_0xc650('0x1f')](_0x240bc3)[_0xc650('0x20')](_0x33d4b0);}}});};exports['getApplications']=function(_0x371782,_0x3b1e5f){var _0x45d47d={};var _0x3a08a1={};var _0x345737;var _0x236edb;return db['MailAccount'][_0xc650('0x6e')]({'where':{'id':_0x371782[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x3b1e5f,null))[_0xc650('0x28')](function(_0x261ec5){if(_0x261ec5){_0x345737=_0x261ec5;_0x3a08a1[_0xc650('0x4e')]=_[_0xc650('0x62')](db[_0xc650('0x99')][_0xc650('0x4a')]);_0x3a08a1[_0xc650('0x4f')]=_['keys'](_0x371782[_0xc650('0x4f')]);_0x3a08a1[_0xc650('0x58')]=_[_0xc650('0x51')](_0x3a08a1[_0xc650('0x4e')],_0x3a08a1['query']);_0x45d47d[_0xc650('0x50')]=_[_0xc650('0x51')](_0x3a08a1[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x371782[_0xc650('0x4f')][_0xc650('0x52')]));_0x45d47d[_0xc650('0x50')]=_0x45d47d[_0xc650('0x50')][_0xc650('0x53')]?_0x45d47d[_0xc650('0x50')]:_0x3a08a1[_0xc650('0x4e')];_0x45d47d[_0xc650('0x71')]=qs[_0xc650('0x55')](_0x371782[_0xc650('0x4f')][_0xc650('0x55')]);_0x45d47d[_0xc650('0x56')]=qs[_0xc650('0x58')](_[_0xc650('0x57')](_0x371782['query'],_0x3a08a1['filters']));if(_0x371782['query'][_0xc650('0x5b')]){_0x45d47d[_0xc650('0x56')]=_[_0xc650('0x59')](_0x45d47d[_0xc650('0x56')],{'$or':_[_0xc650('0x48')](_0x45d47d[_0xc650('0x50')],function(_0x428280){var _0x51b403={};_0x51b403[_0x428280]={'$like':'%'+_0x371782['query'][_0xc650('0x5b')]+'%'};return _0x51b403;})});}_0x45d47d=_['merge']({},_0x45d47d,_0x371782['options']);return _0x345737[_0xc650('0x9f')](_0x45d47d);}})[_0xc650('0x28')](function(_0x1be631){if(_0x1be631){_0x236edb=_0x1be631[_0xc650('0x53')];if(!_0x371782[_0xc650('0x4f')][_0xc650('0x70')](_0xc650('0x54'))){_0x45d47d[_0xc650('0x23')]=qs['limit'](_0x371782[_0xc650('0x4f')][_0xc650('0x23')]);_0x45d47d[_0xc650('0x21')]=qs[_0xc650('0x21')](_0x371782['query'][_0xc650('0x21')]);}return _0x345737[_0xc650('0x9f')](_0x45d47d);}})[_0xc650('0x28')](function(_0x466fac){if(_0x466fac){return _0x466fac?{'count':_0x236edb,'rows':_0x466fac}:null;}})[_0xc650('0x28')](respondWithResult(_0x3b1e5f,null))['catch'](handleError(_0x3b1e5f,null));};exports[_0xc650('0xa0')]=function(_0x495566,_0x53b016){var _0x18b397={'raw':!![],'where':{}};var _0x57e2a5={};var _0x50a4e2={'count':0x0,'rows':[]};return db[_0xc650('0x49')][_0xc650('0x6e')]({'where':{'id':_0x495566[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x53b016,null))[_0xc650('0x28')](function(_0x483e20){if(_0x483e20){_0x57e2a5[_0xc650('0x4e')]=_['keys'](db[_0xc650('0xa1')][_0xc650('0x4a')]);_0x57e2a5[_0xc650('0x4f')]=_[_0xc650('0x62')](_0x495566[_0xc650('0x4f')]);_0x57e2a5['filters']=_['intersection'](_0x57e2a5[_0xc650('0x4e')],_0x57e2a5['query']);_0x18b397[_0xc650('0x50')]=_[_0xc650('0x51')](_0x57e2a5[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x495566[_0xc650('0x4f')]['fields']));_0x18b397['attributes']=_0x18b397[_0xc650('0x50')][_0xc650('0x53')]?_0x18b397['attributes']:_0x57e2a5[_0xc650('0x4e')];if(!_0x495566['query']['hasOwnProperty'](_0xc650('0x54'))){_0x18b397['limit']=qs['limit'](_0x495566[_0xc650('0x4f')]['limit']);_0x18b397['offset']=qs[_0xc650('0x21')](_0x495566[_0xc650('0x4f')][_0xc650('0x21')]);}_0x18b397[_0xc650('0x71')]=qs['sort'](_0x495566[_0xc650('0x4f')]['sort']);_0x18b397[_0xc650('0x56')]=qs['filters'](_['pick'](_0x495566[_0xc650('0x4f')],_0x57e2a5[_0xc650('0x58')]));_0x18b397[_0xc650('0x56')]['MailAccountId']=_0x483e20['id'];if(_0x495566[_0xc650('0x4f')][_0xc650('0x5b')]){_0x18b397[_0xc650('0x56')]=_[_0xc650('0x59')](_0x18b397[_0xc650('0x56')],{'$or':_['map'](_0x18b397[_0xc650('0x50')],function(_0x4b8985){var _0x44aaab={};_0x44aaab[_0x4b8985]={'$like':'%'+_0x495566[_0xc650('0x4f')][_0xc650('0x5b')]+'%'};return _0x44aaab;})});}if(_0x495566['query'][_0xc650('0xa2')]){var _0x8010ee=_0x495566[_0xc650('0x4f')][_0xc650('0xa2')][_0xc650('0xa3')](',');var _0x4a6d24={};_0x4a6d24[_0x8010ee[0x0]]={'$gte':moment(_0x8010ee[0x1])[_0xc650('0xa4')](_0xc650('0xa5'))};_0x18b397[_0xc650('0x56')]=_['merge'](_0x18b397[_0xc650('0x56')],_0x4a6d24);}_0x18b397=_[_0xc650('0x59')]({},_0x18b397,_0x495566['options']);return db[_0xc650('0xa1')][_0xc650('0x24')]({'where':_0x18b397[_0xc650('0x56')]})['then'](function(_0x59e228){_0x50a4e2[_0xc650('0x24')]=_0x59e228;if(_0x495566[_0xc650('0x4f')][_0xc650('0x5d')]){_0x18b397[_0xc650('0x5e')]=[{'all':!![]}];}return db[_0xc650('0xa1')][_0xc650('0x5f')](_0x18b397);})[_0xc650('0x28')](function(_0x217a6c){if(_0x495566[_0xc650('0x4f')]['inlineCss']==='true'){for(var _0x28067b=0x0;_0x28067b<_0x217a6c[_0xc650('0x53')];_0x28067b++){_0x217a6c[_0x28067b][_0xc650('0x63')]=juice(_0x217a6c[_0x28067b][_0xc650('0x63')]);}}_0x50a4e2[_0xc650('0x72')]=_0x217a6c;return _0x50a4e2;});}})['then'](respondWithFilteredResult(_0x53b016,_0x18b397))[_0xc650('0x1c')](handleError(_0x53b016,null));};exports[_0xc650('0x2d')]=function(_0x99347b,_0x5d2e79){var _0x4f4bfb,_0x1dd79f={},_0x3252f6;if(_0x99347b[_0xc650('0x63')]['to']){_0x3252f6=_0x99347b[_0xc650('0x63')]['to'][_0xc650('0xa3')](',')[0x0];}return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x99347b['params']['id']},'include':[{'model':db[_0xc650('0xa6')],'as':'List','include':[{'model':db[_0xc650('0x8d')],'as':_0xc650('0xa7'),'where':{'email':_0x3252f6},'limit':0x1,'order':[[_0xc650('0xa8'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xc650('0x45'),'raw':!![],'include':[{'model':db[_0xc650('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0xc650('0x28')](handleEntityNotFound(_0x5d2e79,null))['then'](function(_0xce6da7){if(!_0xce6da7)return;_0x4f4bfb=_0xce6da7;if(!_0xce6da7[_0xc650('0x45')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x99347b[_0xc650('0x63')][_0xc650('0xaa')])){_0x99347b[_0xc650('0x63')]['from']=util[_0xc650('0xa4')](_0xc650('0xab'),_0xce6da7[_0xc650('0x2c')],_0xce6da7[_0xc650('0x79')]||_0xce6da7[_0xc650('0x45')]['user']);}if(_0x99347b['body']['attachments']&&_0x99347b[_0xc650('0x63')][_0xc650('0xac')][_0xc650('0x53')]){for(var _0x539c97=0x0;_0x539c97<_0x99347b[_0xc650('0x63')][_0xc650('0xac')][_0xc650('0x53')];_0x539c97+=0x1){_0x99347b[_0xc650('0x63')][_0xc650('0xac')][_0x539c97]={'filename':_0x99347b[_0xc650('0x63')]['attachments'][_0x539c97]['name'],'path':path[_0xc650('0xad')](config[_0xc650('0xae')],'server/files/attachments',_0x99347b[_0xc650('0x63')][_0xc650('0xac')][_0x539c97][_0xc650('0xaf')])};}}var _0x1632b4=_0xce6da7[_0xc650('0xb0')]();return respondWithRpcPromise(_0xc650('0xb1'),'sendMail',{'account':_0x1632b4,'message':_0x99347b[_0xc650('0x63')]});})[_0xc650('0x28')](function(_0x44c74a){if(!_0x44c74a)return;_0x1dd79f=_0x44c74a;if(!_0x4f4bfb[_0xc650('0xb2')])throw new Error('List\x20not\x20found');if(_0x4f4bfb[_0xc650('0xb2')]['Contacts'][_0xc650('0x53')])return _0x4f4bfb['List']['Contacts'][0x0];return db['CmContact']['create'](_[_0xc650('0xa')](_0x99347b[_0xc650('0x63')],{'firstName':_0x99347b['body']['to'],'email':_0x99347b[_0xc650('0x63')]['to'],'phone':_0x99347b[_0xc650('0x63')]['to'],'ListId':_0x4f4bfb[_0xc650('0x7a')]}));})[_0xc650('0x28')](function(_0x354c9e){if(!_0x354c9e)return;var _0xc3b9f0={'UserId':_0x99347b['user']['id'],'ContactId':_0x354c9e['id'],'MailAccountId':_0x4f4bfb['id'],'inReplyTo':_0x1dd79f[_0xc650('0xb3')],'to':_0x99347b[_0xc650('0x63')]['from'],'cc':_0x99347b[_0xc650('0x63')]['cc'],'subject':_0x99347b[_0xc650('0x63')][_0xc650('0xb4')],'attach':_0x99347b[_0xc650('0x63')][_0xc650('0xb5')],'firstMsgDirection':_0xc650('0xb6'),'lastMsgAt':moment()[_0xc650('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0xc650('0x59')](_0x99347b['body'],{'messageId':_0x1dd79f[_0xc650('0xb3')],'sentAt':moment()[_0xc650('0xa4')](_0xc650('0xa5')),'read':!![],'MailAccountId':_0x4f4bfb['id'],'UserId':_0x99347b[_0xc650('0x39')]['id'],'ContactId':_0x354c9e['id']})]};if(_0x99347b[_0xc650('0x63')][_0xc650('0xb7')]){_0xc3b9f0=_[_0xc650('0x59')](_0xc3b9f0,_0x99347b[_0xc650('0x63')][_0xc650('0xb7')]);}return db[_0xc650('0x8a')][_0xc650('0x6c')](_0xc3b9f0,{'include':[{'model':db[_0xc650('0xa1')],'as':_0xc650('0xb8')}]});})[_0xc650('0x28')](respondWithResult(_0x5d2e79,null))['catch'](handleError(_0x5d2e79,null));};exports['verifySmtp']=function(_0x376206,_0x13ebea){return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x376206['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0xc650('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc650('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x13ebea,null))['then'](function(_0x1e88f3){if(!_0x1e88f3[_0xc650('0x45')])return;var _0x1a5a9a=_0x1e88f3[_0xc650('0xb0')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x1a5a9a});})['then'](respondWithResult(_0x13ebea,null))[_0xc650('0x1c')](handleError(_0x13ebea,null));};exports[_0xc650('0x2b')]=function(_0x165ccc,_0x2fd57a){return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x165ccc[_0xc650('0x67')]['id']}})['then'](handleEntityNotFound(_0x2fd57a,null))[_0xc650('0x28')](function(_0x31ef2c){if(_0x31ef2c&&_0x31ef2c[_0xc650('0x42')]){throw new db['Sequelize'][(_0xc650('0xb9'))](_0xc650('0xba'));}return _0x31ef2c;})['then'](removeEntity(_0x2fd57a,null))['catch'](handleError(_0x2fd57a,null));};exports[_0xc650('0xbb')]=function(_0x248b86,_0x36907b){return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x248b86['params']['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x36907b,null))[_0xc650('0x28')](function(_0x1dd7e3){if(_0x1dd7e3){return _0x1dd7e3[_0xc650('0xbb')](_0x248b86['body']['ids'],_[_0xc650('0x8b')](_0x248b86[_0xc650('0x63')],['ids','id'])||{})['spread'](function(_0xc01da8){for(var _0x208abc=0x0;_0x208abc<_0x248b86['body']['ids'][_0xc650('0x53')];_0x208abc+=0x1){socket['emit'](_0xc650('0xbc'),{'UserId':Number(_0x248b86[_0xc650('0x63')][_0xc650('0x74')][_0x208abc]),'MailAccountId':Number(_0x248b86[_0xc650('0x67')]['id'])});}return _0xc01da8;});}})['then'](respondWithResult(_0x36907b,null))[_0xc650('0x1c')](handleError(_0x36907b,null));};exports[_0xc650('0xbd')]=function(_0x212dd0,_0x2eb0c3){return db[_0xc650('0x49')][_0xc650('0x66')]({'where':{'id':_0x212dd0[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x2eb0c3,null))[_0xc650('0x28')](function(_0x456eab){if(_0x456eab){return _0x456eab[_0xc650('0xbd')](_0x212dd0[_0xc650('0x4f')][_0xc650('0x74')])[_0xc650('0x28')](function(){if(_[_0xc650('0xbe')](_0x212dd0[_0xc650('0x4f')][_0xc650('0x74')])){for(var _0x5cc703=0x0;_0x5cc703<_0x212dd0[_0xc650('0x4f')][_0xc650('0x74')][_0xc650('0x53')];_0x5cc703+=0x1){socket[_0xc650('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x212dd0[_0xc650('0x4f')][_0xc650('0x74')][_0x5cc703]),'MailAccountId':Number(_0x212dd0[_0xc650('0x67')]['id'])});}}else{socket[_0xc650('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x212dd0[_0xc650('0x4f')][_0xc650('0x74')]),'MailAccountId':Number(_0x212dd0[_0xc650('0x67')]['id'])});}});}})[_0xc650('0x28')](respondWithStatusCode(_0x2eb0c3,null))[_0xc650('0x1c')](handleError(_0x2eb0c3,null));};exports[_0xc650('0xc0')]=function(_0x5b0943,_0x3e8b60){var _0x7146a2={};var _0x18dae7={};var _0x480c18;var _0x45d997;return db[_0xc650('0x49')]['findOne']({'where':{'id':_0x5b0943[_0xc650('0x67')]['id']}})[_0xc650('0x28')](handleEntityNotFound(_0x3e8b60,null))[_0xc650('0x28')](function(_0xc8c9c6){if(_0xc8c9c6){_0x480c18=_0xc8c9c6;_0x18dae7[_0xc650('0x4e')]=_[_0xc650('0x62')](db[_0xc650('0x8f')][_0xc650('0x4a')]);_0x18dae7[_0xc650('0x4f')]=_['keys'](_0x5b0943[_0xc650('0x4f')]);_0x18dae7[_0xc650('0x58')]=_[_0xc650('0x51')](_0x18dae7[_0xc650('0x4e')],_0x18dae7[_0xc650('0x4f')]);_0x7146a2['attributes']=_[_0xc650('0x51')](_0x18dae7[_0xc650('0x4e')],qs[_0xc650('0x52')](_0x5b0943[_0xc650('0x4f')][_0xc650('0x52')]));_0x7146a2['attributes']=_0x7146a2[_0xc650('0x50')][_0xc650('0x53')]?_0x7146a2[_0xc650('0x50')]:_0x18dae7[_0xc650('0x4e')];_0x7146a2[_0xc650('0x71')]=qs[_0xc650('0x55')](_0x5b0943[_0xc650('0x4f')][_0xc650('0x55')]);_0x7146a2[_0xc650('0x56')]=qs[_0xc650('0x58')](_[_0xc650('0x57')](_0x5b0943['query'],_0x18dae7[_0xc650('0x58')]));if(_0x5b0943[_0xc650('0x4f')][_0xc650('0x5b')]){_0x7146a2[_0xc650('0x56')]=_[_0xc650('0x59')](_0x7146a2['where'],{'$or':_['map'](_0x7146a2['attributes'],function(_0x3e5791){var _0x6de046={};_0x6de046[_0x3e5791]={'$like':'%'+_0x5b0943['query'][_0xc650('0x5b')]+'%'};return _0x6de046;})});}_0x7146a2=_[_0xc650('0x59')]({},_0x7146a2,_0x5b0943['options']);return _0x480c18[_0xc650('0xc0')](_0x7146a2);}})[_0xc650('0x28')](function(_0x5f01e4){if(_0x5f01e4){_0x45d997=_0x5f01e4[_0xc650('0x53')];if(!_0x5b0943['query'][_0xc650('0x70')](_0xc650('0x54'))){_0x7146a2['limit']=qs[_0xc650('0x23')](_0x5b0943['query'][_0xc650('0x23')]);_0x7146a2[_0xc650('0x21')]=qs[_0xc650('0x21')](_0x5b0943[_0xc650('0x4f')]['offset']);}return _0x480c18[_0xc650('0xc0')](_0x7146a2);}})[_0xc650('0x28')](function(_0x3b0a47){if(_0x3b0a47){return _0x3b0a47?{'count':_0x45d997,'rows':_0x3b0a47}:null;}})[_0xc650('0x28')](respondWithResult(_0x3e8b60,null))[_0xc650('0x1c')](handleError(_0x3e8b60,null));}; \ No newline at end of file +var _0x3e09=['error','code','message','catch','status','end','offset','undefined','limit','count','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','name','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','yahoo','hotmail','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','MailAccount','include','rows','show','keys','includeAll','options','body','provider','custom','find','params','Mail\x20Account\x20not\x20found','service','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','ListId','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','List','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','CmContact','defaults','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s'];(function(_0x487b09,_0x349b11){var _0x28830b=function(_0x51705f){while(--_0x51705f){_0x487b09['push'](_0x487b09['shift']());}};_0x28830b(++_0x349b11);}(_0x3e09,0xae));var _0x93e0=function(_0x5da54c,_0x520452){_0x5da54c=_0x5da54c-0x0;var _0x1246b0=_0x3e09[_0x5da54c];return _0x1246b0;};'use strict';var moment=require('moment');var BPromise=require(_0x93e0('0x0'));var util=require(_0x93e0('0x1'));var path=require(_0x93e0('0x2'));var _=require(_0x93e0('0x3'));var juice=require(_0x93e0('0x4'));var Redis=require(_0x93e0('0x5'));var qs=require(_0x93e0('0x6'));var logger=require('../../config/logger')(_0x93e0('0x7'));var config=require(_0x93e0('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x93e0('0x9')],{'host':_0x93e0('0xa'),'port':0x18eb});var socket=require(_0x93e0('0xb'))(new Redis(config[_0x93e0('0x9')]));require(_0x93e0('0xc'))[_0x93e0('0xd')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x93e0('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x42bf00,_0x27a8dd,_0x165025,_0x24088b){return new BPromise(function(_0x416528,_0x1e10ab){var _0x4a71f9=_0x24088b||client;return _0x4a71f9[_0x93e0('0xf')](_0x42bf00,_0x165025)[_0x93e0('0x10')](function(_0x208355){logger[_0x93e0('0x11')](_0x93e0('0x12'),_0x27a8dd,_0x93e0('0x13'));logger[_0x93e0('0x14')](_0x93e0('0x15'),_0x27a8dd,_0x93e0('0x13'),JSON['stringify'](_0x208355));if(_0x208355[_0x93e0('0x16')]){if(_0x208355['error'][_0x93e0('0x17')]===0x1f4){logger[_0x93e0('0x16')](_0x93e0('0x12'),_0x27a8dd,_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);return _0x1e10ab(_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);}logger[_0x93e0('0x16')](_0x93e0('0x12'),_0x27a8dd,_0x208355[_0x93e0('0x16')]['message']);return _0x416528(_0x208355[_0x93e0('0x16')][_0x93e0('0x18')]);}else{logger[_0x93e0('0x11')](_0x93e0('0x12'),_0x27a8dd,_0x93e0('0x13'));_0x416528(_0x208355['result'][_0x93e0('0x18')]);}})[_0x93e0('0x19')](function(_0x2b1d24){logger[_0x93e0('0x16')]('MailAccount,\x20%s,\x20%s',_0x27a8dd,_0x2b1d24);_0x1e10ab(_0x2b1d24);});});}function respondWithStatusCode(_0x5b7301,_0x368361){_0x368361=_0x368361||0xcc;return function(_0x348450){if(_0x348450){return _0x5b7301['sendStatus'](_0x368361);}return _0x5b7301[_0x93e0('0x1a')](_0x368361)[_0x93e0('0x1b')]();};}function respondWithResult(_0x487b69,_0x19f1df){_0x19f1df=_0x19f1df||0xc8;return function(_0x562c1f){if(_0x562c1f){return _0x487b69[_0x93e0('0x1a')](_0x19f1df)['json'](_0x562c1f);}};}function respondWithFilteredResult(_0x3c3205,_0x4b349a){return function(_0x144f8c){if(_0x144f8c){var _0x4929e6=typeof _0x4b349a[_0x93e0('0x1c')]===_0x93e0('0x1d')&&typeof _0x4b349a[_0x93e0('0x1e')]==='undefined';var _0x543f2f=_0x144f8c[_0x93e0('0x1f')];var _0x29fe3e=_0x4929e6?0x0:_0x4b349a[_0x93e0('0x1c')];var _0x5c6888=_0x4929e6?_0x144f8c[_0x93e0('0x1f')]:_0x4b349a[_0x93e0('0x1c')]+_0x4b349a[_0x93e0('0x1e')];var _0x32dd3f;if(_0x5c6888>=_0x543f2f){_0x5c6888=_0x543f2f;_0x32dd3f=0xc8;}else{_0x32dd3f=0xce;}_0x3c3205[_0x93e0('0x1a')](_0x32dd3f);return _0x3c3205['set'](_0x93e0('0x20'),_0x29fe3e+'-'+_0x5c6888+'/'+_0x543f2f)[_0x93e0('0x21')](_0x144f8c);}return null;};}function saveUpdates(_0x137e3e){return function(_0x5e128d){if(_0x5e128d){return _0x5e128d[_0x93e0('0x22')](_0x137e3e)[_0x93e0('0x10')](function(_0x2007a0){return _0x2007a0;});}return null;};}function removeEntity(_0x1d6245){return function(_0x3a6261){if(_0x3a6261){return _0x3a6261['destroy']()['then'](function(){var _0x4641c8=_0x3a6261[_0x93e0('0x23')]({'plain':!![]});var _0x554d33=_0x93e0('0x24');return db[_0x93e0('0x25')][_0x93e0('0x26')]({'where':{'type':_0x554d33,'resourceId':_0x4641c8['id']}})['then'](function(){return _0x3a6261;});})['then'](function(){_0x1d6245[_0x93e0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a30e1){return function(_0xff0ec7){if(!_0xff0ec7){_0x5a30e1['sendStatus'](0x194);}return _0xff0ec7;};}function handleError(_0x5017ce,_0x2124fb){_0x2124fb=_0x2124fb||0x1f4;return function(_0x35fb15){logger[_0x93e0('0x16')](_0x35fb15['stack']);if(_0x35fb15[_0x93e0('0x27')]){delete _0x35fb15[_0x93e0('0x27')];}_0x5017ce[_0x93e0('0x1a')](_0x2124fb)['send'](_0x35fb15);};}function getImapHost(_0x5bdfe3){switch(_0x5bdfe3){case _0x93e0('0x28'):return _0x93e0('0x29');case'yahoo':return _0x93e0('0x2a');case'hotmail':return _0x93e0('0x2b');case'outlook365':return _0x93e0('0x2c');}throw new Error(_0x93e0('0x2d'),_0x5bdfe3);}function getSmtpHost(_0x5f13e7){switch(_0x5f13e7){case'gmail':return'smtp.gmail.com';case _0x93e0('0x2e'):return'smtp.mail.yahoo.com';case _0x93e0('0x2f'):return'smtp-mail.outlook.com';case _0x93e0('0x30'):return'smtp.office365.com';}throw new Error(_0x93e0('0x2d'),_0x5f13e7);}function getAuthenticationOptions(_0x204d13,_0x2966b0){var _0x3ea000={};var _0x3fd131={};if(_0x204d13){_0x3ea000[_0x93e0('0x31')]=_0x3fd131[_0x93e0('0x31')]=_0x2966b0[_0x93e0('0x32')];_0x3ea000[_0x93e0('0x33')]=_0x3fd131[_0x93e0('0x34')]=_0x2966b0['password'];if(_0x2966b0[_0x93e0('0x35')]){_0x3ea000[_0x93e0('0x35')]=_0x3fd131[_0x93e0('0x35')]=!![];_0x3ea000[_0x93e0('0x36')]=_0x3fd131[_0x93e0('0x36')]=_0x2966b0[_0x93e0('0x36')];_0x3ea000['password']=_0x3fd131[_0x93e0('0x34')]=null;}else{_0x3ea000[_0x93e0('0x36')]=_0x3fd131[_0x93e0('0x36')]=null;}_0x3ea000[_0x93e0('0x37')]=getImapHost(_0x204d13);_0x3ea000['port']=0x3e1;_0x3fd131[_0x93e0('0x37')]=getSmtpHost(_0x204d13);_0x3fd131[_0x93e0('0x38')]=0x24b;_0x3fd131[_0x93e0('0x39')]=![];_0x3ea000['service']=_0x3fd131['service']=null;}else{if(_0x2966b0[_0x93e0('0x3a')]){_0x3ea000['user']=_0x3fd131[_0x93e0('0x31')]=_0x2966b0[_0x93e0('0x32')];_0x3ea000[_0x93e0('0x33')]=_0x3fd131[_0x93e0('0x34')]=_0x2966b0[_0x93e0('0x33')];}else{_0x3ea000[_0x93e0('0x3a')]=_0x3fd131['authentication']=![];_0x3ea000[_0x93e0('0x31')]=_0x3fd131[_0x93e0('0x31')]=null;_0x3ea000[_0x93e0('0x33')]=_0x3fd131['pass']=null;}_0x3ea000[_0x93e0('0x37')]=_0x2966b0[_0x93e0('0x3b')][_0x93e0('0x37')];_0x3ea000[_0x93e0('0x38')]=_0x2966b0[_0x93e0('0x3b')][_0x93e0('0x38')];_0x3fd131[_0x93e0('0x37')]=_0x2966b0['Smtp'][_0x93e0('0x37')];_0x3fd131[_0x93e0('0x38')]=_0x2966b0[_0x93e0('0x3c')][_0x93e0('0x38')];}return{'Imap':_0x3ea000,'Smtp':_0x3fd131};}exports[_0x93e0('0x3d')]=function(_0x3732d3,_0x354117){var _0x4a8e0e={'include':[{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x40')],'as':_0x93e0('0x41')}]},_0x5575fa={},_0x24ba85={'count':0x0,'rows':[]};var _0x12f03f=_[_0x93e0('0x42')](db['MailAccount'][_0x93e0('0x43')],function(_0x5bf9ec){return{'name':_0x5bf9ec[_0x93e0('0x44')],'type':_0x5bf9ec[_0x93e0('0x45')][_0x93e0('0x46')]};});_0x5575fa['model']=_['map'](_0x12f03f,'name');_0x5575fa[_0x93e0('0x47')]=_['keys'](_0x3732d3['query']);_0x5575fa[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x5575fa['model'],_0x5575fa[_0x93e0('0x47')]);_0x4a8e0e[_0x93e0('0x4a')]=_['intersection'](_0x5575fa[_0x93e0('0x4b')],qs['fields'](_0x3732d3['query'][_0x93e0('0x4c')]));_0x4a8e0e[_0x93e0('0x4a')]=_0x4a8e0e[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x4a8e0e[_0x93e0('0x4a')]:_0x5575fa[_0x93e0('0x4b')];if(!_0x3732d3[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x4a8e0e['limit']=qs[_0x93e0('0x1e')](_0x3732d3[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x4a8e0e[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x3732d3['query']['offset']);}_0x4a8e0e[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x3732d3['query'][_0x93e0('0x51')]);_0x4a8e0e[_0x93e0('0x52')]=qs['filters'](_[_0x93e0('0x53')](_0x3732d3[_0x93e0('0x47')],_0x5575fa[_0x93e0('0x48')]),_0x12f03f);if(_0x3732d3['query']['filter']){_0x4a8e0e[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x4a8e0e[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x12f03f,function(_0x367fd6){if(_0x367fd6['type']!=='VIRTUAL'){var _0x557f98={};_0x557f98[_0x367fd6[_0x93e0('0x27')]]={'$like':'%'+_0x3732d3[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x557f98;}})});}_0x4a8e0e=_[_0x93e0('0x54')]({},_0x4a8e0e,_0x3732d3['options']);var _0x35b1b8={'where':_0x4a8e0e['where']};return db[_0x93e0('0x56')]['count'](_0x35b1b8)[_0x93e0('0x10')](function(_0x9dd908){_0x24ba85[_0x93e0('0x1f')]=_0x9dd908;if(_0x3732d3['query']['includeAll']){_0x4a8e0e[_0x93e0('0x57')]=[{'all':!![]}];}return db[_0x93e0('0x56')]['findAll'](_0x4a8e0e);})[_0x93e0('0x10')](function(_0x14931c){_0x24ba85[_0x93e0('0x58')]=_0x14931c;return _0x24ba85;})['then'](respondWithFilteredResult(_0x354117,_0x4a8e0e))[_0x93e0('0x19')](handleError(_0x354117,null));};exports[_0x93e0('0x59')]=function(_0x47809a,_0x5624fe){var _0x17b308={'raw':![],'where':{'id':_0x47809a['params']['id']},'include':[{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':'Smtp'},{'model':db[_0x93e0('0x40')],'as':'mandatoryDispositionPause'}]},_0x24e23e={};_0x24e23e[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x56')][_0x93e0('0x43')]);_0x24e23e['query']=_['keys'](_0x47809a[_0x93e0('0x47')]);_0x24e23e[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x24e23e['model'],_0x24e23e[_0x93e0('0x47')]);_0x17b308['attributes']=_[_0x93e0('0x49')](_0x24e23e[_0x93e0('0x4b')],qs['fields'](_0x47809a[_0x93e0('0x47')]['fields']));_0x17b308['attributes']=_0x17b308[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x17b308[_0x93e0('0x4a')]:_0x24e23e[_0x93e0('0x4b')];if(_0x47809a[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x17b308['include']=[{'all':!![]}];}_0x17b308=_[_0x93e0('0x54')]({},_0x17b308,_0x47809a[_0x93e0('0x5c')]);return db['MailAccount']['find'](_0x17b308)[_0x93e0('0x10')](handleEntityNotFound(_0x5624fe,null))['then'](respondWithResult(_0x5624fe,null))[_0x93e0('0x19')](handleError(_0x5624fe,null));};exports[_0x93e0('0x22')]=function(_0x39193f,_0x15623e){if(_0x39193f[_0x93e0('0x5d')]['id']){delete _0x39193f[_0x93e0('0x5d')]['id'];}var _0x447b9a=_0x39193f[_0x93e0('0x5d')][_0x93e0('0x5e')]===_0x93e0('0x5f')?null:_0x39193f[_0x93e0('0x5d')][_0x93e0('0x5e')];var _0x49ca13=_0x39193f[_0x93e0('0x5d')]['Imap']||{};var _0x18eabd=_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')]||{};if(_0x447b9a){_0x49ca13['host']=getImapHost(_0x447b9a);_0x49ca13['port']=0x3e1;_0x18eabd[_0x93e0('0x37')]=getSmtpHost(_0x447b9a);_0x18eabd[_0x93e0('0x38')]=0x24b;_0x18eabd[_0x93e0('0x39')]=![];}if(_0x18eabd['modernAuthentication']){_0x18eabd[_0x93e0('0x39')]=![];}else{_0x18eabd[_0x93e0('0x36')]=null;}if(!_0x49ca13[_0x93e0('0x35')])_0x49ca13[_0x93e0('0x36')]=null;_0x39193f['body'][_0x93e0('0x3b')]=_0x49ca13;_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')]=_0x18eabd;return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x39193f[_0x93e0('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x93e0('0x3b')},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x40')],'as':_0x93e0('0x41')}]})[_0x93e0('0x10')](handleEntityNotFound(_0x15623e,null))[_0x93e0('0x10')](function(_0xdeb97e){if(!_0xdeb97e)throw new Error(_0x93e0('0x62'));if(_0xdeb97e[_0x93e0('0x63')])delete _0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')];return _0xdeb97e;})[_0x93e0('0x10')](saveUpdates(_0x39193f[_0x93e0('0x5d')],null))[_0x93e0('0x10')](function(_0x3aa248){if(!_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')])return _0x3aa248;return db[_0x93e0('0x3e')][_0x93e0('0x22')](_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3b')],{'where':{'MailAccountId':_0x3aa248['id']}})[_0x93e0('0x10')](function(){return _0x3aa248;});})[_0x93e0('0x10')](function(_0x4d899d){if(!_0x39193f[_0x93e0('0x5d')]['Smtp'])return _0x4d899d;return db[_0x93e0('0x3f')][_0x93e0('0x22')](_0x39193f[_0x93e0('0x5d')][_0x93e0('0x3c')],{'where':{'MailAccountId':_0x4d899d['id']}})[_0x93e0('0x10')](function(){return _0x4d899d;});})[_0x93e0('0x10')](respondWithResult(_0x15623e,null))['catch'](handleError(_0x15623e,null));};exports[_0x93e0('0x64')]=function(_0x203790,_0x461b83){return db[_0x93e0('0x56')]['describe']()['then'](respondWithResult(_0x461b83,null))[_0x93e0('0x19')](handleError(_0x461b83,null));};exports[_0x93e0('0x65')]=function(_0x25462c,_0xa5796b){if(_0x25462c['body']['id']){delete _0x25462c[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x25462c[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0xa5796b,null))['then'](function(_0x4d3b96){if(_0x4d3b96){_0x25462c[_0x93e0('0x5d')][_0x93e0('0x66')]=_0x4d3b96['id'];return db[_0x93e0('0x67')][_0x93e0('0x68')](_0x25462c['body']);}})[_0x93e0('0x10')](respondWithResult(_0xa5796b,null))[_0x93e0('0x19')](handleError(_0xa5796b,null));};exports[_0x93e0('0x69')]=function(_0x10cf94,_0x4c9577){var _0x19652b={'raw':![],'where':{}};var _0x4b62f3={};var _0x32977b={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x10cf94[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4c9577,null))[_0x93e0('0x10')](function(_0x48f01f){if(_0x48f01f){_0x4b62f3[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x67')][_0x93e0('0x43')]);_0x4b62f3[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x10cf94[_0x93e0('0x47')]);_0x4b62f3[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x4b62f3[_0x93e0('0x4b')],_0x4b62f3[_0x93e0('0x47')]);_0x19652b[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x4b62f3['model'],qs['fields'](_0x10cf94[_0x93e0('0x47')]['fields']));_0x19652b[_0x93e0('0x4a')]=_0x19652b[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x19652b['attributes']:_0x4b62f3['model'];if(!_0x10cf94['query'][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x19652b['limit']=qs[_0x93e0('0x1e')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x19652b['offset']=qs[_0x93e0('0x1c')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x19652b['order']=qs[_0x93e0('0x51')](_0x10cf94[_0x93e0('0x47')][_0x93e0('0x51')]);_0x19652b[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_['pick'](_0x10cf94['query'],_0x4b62f3['filters']));_0x19652b[_0x93e0('0x52')]['MailAccountId']=_0x48f01f['id'];if(_0x10cf94['query'][_0x93e0('0x55')]){_0x19652b[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x19652b['where'],{'$or':_['map'](_0x19652b[_0x93e0('0x4a')],function(_0x43324b){var _0x5d8c64={};_0x5d8c64[_0x43324b]={'$like':'%'+_0x10cf94['query'][_0x93e0('0x55')]+'%'};return _0x5d8c64;})});}_0x19652b=_[_0x93e0('0x54')]({},_0x19652b,_0x10cf94[_0x93e0('0x5c')]);return db[_0x93e0('0x67')]['count']({'where':_0x19652b[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x1e54f7){_0x32977b[_0x93e0('0x1f')]=_0x1e54f7;if(_0x10cf94[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x19652b[_0x93e0('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x93e0('0x6b')](_0x19652b);})['then'](function(_0x326826){_0x32977b[_0x93e0('0x58')]=_0x326826;return _0x32977b;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x4c9577,_0x19652b))['catch'](handleError(_0x4c9577,null));};exports[_0x93e0('0x6c')]=function(_0x2966e3,_0x3edec8){return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x2966e3['params']['id']}})['then'](handleEntityNotFound(_0x3edec8,null))['then'](function(_0x3eb0a2){if(_0x3eb0a2){return _0x3eb0a2[_0x93e0('0x6c')](_0x2966e3[_0x93e0('0x47')]['ids']);}})[_0x93e0('0x10')](respondWithStatusCode(_0x3edec8,null))[_0x93e0('0x19')](handleError(_0x3edec8,null));};exports[_0x93e0('0x6d')]=function(_0x3cb3b7,_0x2699d6){if(_0x3cb3b7[_0x93e0('0x5d')]['id']){delete _0x3cb3b7[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x3cb3b7[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x2699d6,null))[_0x93e0('0x10')](function(_0x4c4eb8){if(_0x4c4eb8){_0x3cb3b7[_0x93e0('0x5d')]['MailAccountId']=_0x4c4eb8['id'];return db[_0x93e0('0x6e')]['create'](_0x3cb3b7['body']);}})[_0x93e0('0x10')](respondWithResult(_0x2699d6,null))[_0x93e0('0x19')](handleError(_0x2699d6,null));};exports[_0x93e0('0x6f')]=function(_0x5f19af,_0x3a6ea1){var _0x5189b4={'raw':![],'where':{}};var _0x2367f6={};var _0x16679a={'count':0x0,'rows':[]};return db['MailAccount'][_0x93e0('0x6a')]({'where':{'id':_0x5f19af[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x3a6ea1,null))[_0x93e0('0x10')](function(_0x152fb6){if(_0x152fb6){_0x2367f6[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x6e')]['rawAttributes']);_0x2367f6['query']=_[_0x93e0('0x5a')](_0x5f19af[_0x93e0('0x47')]);_0x2367f6['filters']=_[_0x93e0('0x49')](_0x2367f6[_0x93e0('0x4b')],_0x2367f6[_0x93e0('0x47')]);_0x5189b4[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x2367f6[_0x93e0('0x4b')],qs[_0x93e0('0x4c')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x5189b4[_0x93e0('0x4a')]=_0x5189b4[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x5189b4[_0x93e0('0x4a')]:_0x2367f6[_0x93e0('0x4b')];if(!_0x5f19af[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x5189b4['limit']=qs[_0x93e0('0x1e')](_0x5f19af[_0x93e0('0x47')]['limit']);_0x5189b4[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x5189b4['order']=qs[_0x93e0('0x51')](_0x5f19af[_0x93e0('0x47')][_0x93e0('0x51')]);_0x5189b4['where']=qs[_0x93e0('0x48')](_[_0x93e0('0x53')](_0x5f19af[_0x93e0('0x47')],_0x2367f6[_0x93e0('0x48')]));_0x5189b4[_0x93e0('0x52')][_0x93e0('0x66')]=_0x152fb6['id'];if(_0x5f19af[_0x93e0('0x47')][_0x93e0('0x55')]){_0x5189b4[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x5189b4[_0x93e0('0x52')],{'$or':_['map'](_0x5189b4[_0x93e0('0x4a')],function(_0x23979b){var _0x105db3={};_0x105db3[_0x23979b]={'$like':'%'+_0x5f19af[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x105db3;})});}_0x5189b4=_['merge']({},_0x5189b4,_0x5f19af[_0x93e0('0x5c')]);return db['CannedAnswer'][_0x93e0('0x1f')]({'where':_0x5189b4[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x1a67f2){_0x16679a[_0x93e0('0x1f')]=_0x1a67f2;if(_0x5f19af['query'][_0x93e0('0x5b')]){_0x5189b4['include']=[{'all':!![]}];}return db[_0x93e0('0x6e')][_0x93e0('0x6b')](_0x5189b4);})[_0x93e0('0x10')](function(_0x1774eb){_0x16679a[_0x93e0('0x58')]=_0x1774eb;return _0x16679a;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x3a6ea1,_0x5189b4))[_0x93e0('0x19')](handleError(_0x3a6ea1,null));};exports[_0x93e0('0x70')]=function(_0x112f10,_0x1a2d3e){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x112f10[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x1a2d3e,null))[_0x93e0('0x10')](function(_0x4bfb8c){if(_0x4bfb8c){return _0x4bfb8c[_0x93e0('0x70')](_0x112f10[_0x93e0('0x47')][_0x93e0('0x71')]);}})['then'](respondWithStatusCode(_0x1a2d3e,null))[_0x93e0('0x19')](handleError(_0x1a2d3e,null));};exports[_0x93e0('0x68')]=function(_0x57ed61,_0x1e81ba){var _0x601ef5={'name':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x27')],'key':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x46')],'provider':_0x57ed61[_0x93e0('0x5d')]['provider']===_0x93e0('0x5f')?null:_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x5e')],'email':_0x57ed61['body'][_0x93e0('0x72')],'ListId':_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x73')],'active':!_[_0x93e0('0x74')](_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x75')])?_0x57ed61[_0x93e0('0x5d')][_0x93e0('0x75')]:!![],'description':_0x57ed61['body'][_0x93e0('0x76')]||null};var _0x2a15e5=getAuthenticationOptions(_0x601ef5[_0x93e0('0x5e')],_0x57ed61[_0x93e0('0x5d')]);_0x601ef5['Imap']=_0x2a15e5[_0x93e0('0x3b')];_0x601ef5[_0x93e0('0x3c')]=_0x2a15e5[_0x93e0('0x3c')];return db[_0x93e0('0x56')][_0x93e0('0x68')](_0x601ef5,{'include':[{'model':db['MailServerOut'],'as':_0x93e0('0x3c')},{'model':db[_0x93e0('0x3e')],'as':_0x93e0('0x3b')}]})[_0x93e0('0x10')](function(_0x3f1d94){var _0x5ae4a4=_0x57ed61[_0x93e0('0x31')][_0x93e0('0x23')]({'plain':!![]});if(!_0x5ae4a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ae4a4[_0x93e0('0x77')]==='user'){var _0xb50267=_0x3f1d94['get']({'plain':!![]});return db[_0x93e0('0x78')]['find']({'where':{'name':_0x93e0('0x24'),'userProfileId':_0x5ae4a4[_0x93e0('0x79')]},'raw':!![]})[_0x93e0('0x10')](function(_0x57d3c2){if(_0x57d3c2&&_0x57d3c2[_0x93e0('0x7a')]===0x0){return db[_0x93e0('0x25')]['create']({'name':_0xb50267[_0x93e0('0x27')],'resourceId':_0xb50267['id'],'type':_0x57d3c2[_0x93e0('0x27')],'sectionId':_0x57d3c2['id']},{})[_0x93e0('0x10')](function(){return _0x3f1d94;});}else{return _0x3f1d94;}})[_0x93e0('0x19')](function(_0x38d6ae){logger[_0x93e0('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38d6ae);throw _0x38d6ae;});}return _0x3f1d94;})[_0x93e0('0x10')](respondWithResult(_0x1e81ba,0xc9))[_0x93e0('0x19')](handleError(_0x1e81ba,null));};exports[_0x93e0('0x7b')]=function(_0x20aa5f,_0x4e1a4d){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x20aa5f[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0x4e1a4d,null))['then'](function(_0xafdfd0){if(_0xafdfd0){return _0xafdfd0['getImap']();}return null;})[_0x93e0('0x10')](respondWithResult(_0x4e1a4d,null))[_0x93e0('0x19')](handleError(_0x4e1a4d,null));};exports[_0x93e0('0x7c')]=function(_0x4ae304,_0x87d557){if(_0x4ae304[_0x93e0('0x5d')]['id']){delete _0x4ae304[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x4ae304[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x87d557,null))[_0x93e0('0x10')](function(_0x5a393f){if(_0x5a393f){_0x4ae304[_0x93e0('0x5d')]['MailAccountId']=_0x5a393f['id'];return db[_0x93e0('0x3e')][_0x93e0('0x68')](_0x4ae304[_0x93e0('0x5d')]);}})[_0x93e0('0x10')](respondWithResult(_0x87d557,null))[_0x93e0('0x19')](handleError(_0x87d557,null));};exports[_0x93e0('0x7d')]=function(_0x241f6e,_0x3099dd){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x241f6e[_0x93e0('0x61')]['id']}})['then'](handleEntityNotFound(_0x3099dd,null))[_0x93e0('0x10')](function(_0x18d7fc){if(_0x18d7fc){return _0x18d7fc[_0x93e0('0x7e')](null);}return null;})[_0x93e0('0x10')](respondWithStatusCode(_0x3099dd,null))[_0x93e0('0x19')](handleError(_0x3099dd,null));};exports[_0x93e0('0x7f')]=function(_0x3456db,_0x51bb3d){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x3456db['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x51bb3d,null))['then'](function(_0x271828){if(_0x271828){return _0x271828['getSmtp']();}return null;})[_0x93e0('0x10')](respondWithResult(_0x51bb3d,null))[_0x93e0('0x19')](handleError(_0x51bb3d,null));};exports[_0x93e0('0x80')]=function(_0x23c0bd,_0x3b24c7){if(_0x23c0bd[_0x93e0('0x5d')]['id']){delete _0x23c0bd[_0x93e0('0x5d')]['id'];}return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x23c0bd[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x3b24c7,null))[_0x93e0('0x10')](function(_0x5d3f09){if(_0x5d3f09){_0x23c0bd['body'][_0x93e0('0x66')]=_0x5d3f09['id'];return db['MailServerOut'][_0x93e0('0x68')](_0x23c0bd[_0x93e0('0x5d')]);}})[_0x93e0('0x10')](respondWithResult(_0x3b24c7,null))[_0x93e0('0x19')](handleError(_0x3b24c7,null));};exports[_0x93e0('0x81')]=function(_0x26a2ca,_0x4829ab){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x26a2ca['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4829ab,null))[_0x93e0('0x10')](function(_0x4feb31){if(_0x4feb31){return _0x4feb31[_0x93e0('0x82')](null);}return null;})[_0x93e0('0x10')](respondWithStatusCode(_0x4829ab,null))[_0x93e0('0x19')](handleError(_0x4829ab,null));};exports[_0x93e0('0x83')]=function(_0x2c5a9d,_0x1d1ee3){return db[_0x93e0('0x84')]['find']({'where':{'id':_0x2c5a9d[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x1d1ee3,null))[_0x93e0('0x10')](function(_0x244a35){if(_0x244a35){return _0x244a35[_0x93e0('0x83')](_0x2c5a9d[_0x93e0('0x5d')][_0x93e0('0x71')],_[_0x93e0('0x85')](_0x2c5a9d[_0x93e0('0x5d')],['ids','id'])||{});}})[_0x93e0('0x10')](respondWithResult(_0x1d1ee3,null))[_0x93e0('0x19')](handleError(_0x1d1ee3,null));};exports[_0x93e0('0x86')]=function(_0x37f1bf,_0x23e334){var _0x188868={'raw':![],'where':{}};var _0x3c1a0d={};var _0x479f24={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x37f1bf[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x23e334,null))[_0x93e0('0x10')](function(_0x326141){if(_0x326141){_0x3c1a0d[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x84')]['rawAttributes']);_0x3c1a0d[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x37f1bf[_0x93e0('0x47')]);_0x3c1a0d[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x3c1a0d[_0x93e0('0x4b')],_0x3c1a0d[_0x93e0('0x47')]);_0x188868['attributes']=_[_0x93e0('0x49')](_0x3c1a0d['model'],qs['fields'](_0x37f1bf['query'][_0x93e0('0x4c')]));_0x188868[_0x93e0('0x4a')]=_0x188868[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x188868[_0x93e0('0x4a')]:_0x3c1a0d[_0x93e0('0x4b')];if(!_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x188868[_0x93e0('0x1e')]=qs['limit'](_0x37f1bf['query'][_0x93e0('0x1e')]);_0x188868[_0x93e0('0x1c')]=qs[_0x93e0('0x1c')](_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x1c')]);}_0x188868[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x51')]);_0x188868['where']=qs['filters'](_[_0x93e0('0x53')](_0x37f1bf[_0x93e0('0x47')],_0x3c1a0d['filters']));_0x188868[_0x93e0('0x52')][_0x93e0('0x66')]=_0x326141['id'];if(_0x37f1bf['query']['filter']){_0x188868['where']=_[_0x93e0('0x54')](_0x188868[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x188868[_0x93e0('0x4a')],function(_0x1f64e7){var _0x40aa81={};_0x40aa81[_0x1f64e7]={'$like':'%'+_0x37f1bf['query'][_0x93e0('0x55')]+'%'};return _0x40aa81;})});}_0x188868=_[_0x93e0('0x54')]({},_0x188868,_0x37f1bf['options']);return db[_0x93e0('0x84')][_0x93e0('0x1f')]({'where':_0x188868[_0x93e0('0x52')]})[_0x93e0('0x10')](function(_0x500ece){_0x479f24[_0x93e0('0x1f')]=_0x500ece;if(_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x188868[_0x93e0('0x57')]=[{'model':db['CmContact'],'as':_0x93e0('0x87'),'required':![]},{'model':db[_0x93e0('0x88')],'as':_0x93e0('0x89'),'attributes':['name',_0x93e0('0x8a'),_0x93e0('0x8b')],'required':![]},{'model':db[_0x93e0('0x8c')],'as':_0x93e0('0x8d'),'attributes':['id','name',_0x93e0('0x8e')],'where':_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x8f')]?{'id':_0x37f1bf[_0x93e0('0x47')][_0x93e0('0x8f')]}:undefined,'required':_0x37f1bf['query'][_0x93e0('0x8f')]?!![]:![]}];}return db[_0x93e0('0x84')][_0x93e0('0x6b')](_0x188868);})['then'](function(_0x510ad7){_0x479f24[_0x93e0('0x58')]=_0x510ad7;return _0x479f24;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x23e334,_0x188868))['catch'](handleError(_0x23e334,null));};exports[_0x93e0('0x90')]=function addApplications(_0x3cab7d,_0x962e08){var _0x4cb4d6=_0x3cab7d['params']['id'];var _0x1f51d3=_0x3cab7d['body'];var _0x4b2064=0xc8;var _0x5759a5=null;return db[_0x93e0('0x91')]['transaction']({'isolationLevel':db[_0x93e0('0x91')][_0x93e0('0x92')][_0x93e0('0x93')][_0x93e0('0x94')]},function(_0x3bf5a5){return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x4cb4d6},'transaction':_0x3bf5a5})[_0x93e0('0x10')](function(_0x1009d8){if(_0x1009d8){return db[_0x93e0('0x95')][_0x93e0('0x26')]({'where':{'MailAccountId':_0x4cb4d6},'transaction':_0x3bf5a5})[_0x93e0('0x10')](function(){var _0x55524a=_[_0x93e0('0x42')](_0x1f51d3,function(_0x22a071){_0x22a071[_0x93e0('0x66')]=_0x4cb4d6;return _0x22a071;});return db[_0x93e0('0x95')][_0x93e0('0x96')](_0x55524a,{'transaction':_0x3bf5a5});});}else{_0x4b2064=0x194;_0x5759a5=[];}});})['then'](function(){if(_0x4b2064!==0x194){return db[_0x93e0('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x4cb4d6},'order':_0x93e0('0x97')})[_0x93e0('0x10')](function(_0x52e325){_0x5759a5=_0x52e325;});}})[_0x93e0('0x19')](function(_0x28243d){_0x4b2064=0x1f4;logger[_0x93e0('0x16')](_0x28243d[_0x93e0('0x98')]);if(_0x28243d[_0x93e0('0x27')]){delete _0x28243d[_0x93e0('0x27')];}_0x5759a5=_0x28243d;})['finally'](function(){if(_0x5759a5===null){_0x962e08['sendStatus'](_0x4b2064);}else{if(_0x4b2064===0x1f4){_0x962e08[_0x93e0('0x1a')](_0x4b2064)[_0x93e0('0x99')](_0x5759a5);}else{_0x962e08[_0x93e0('0x1a')](_0x4b2064)[_0x93e0('0x21')](_0x5759a5);}}});};exports['getApplications']=function(_0x2f23a2,_0x15eb1f){var _0x1c041a={};var _0x5b4159={};var _0x1c6fe2;var _0x39da90;return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x2f23a2[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x15eb1f,null))[_0x93e0('0x10')](function(_0x8d6226){if(_0x8d6226){_0x1c6fe2=_0x8d6226;_0x5b4159[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x95')][_0x93e0('0x43')]);_0x5b4159[_0x93e0('0x47')]=_['keys'](_0x2f23a2[_0x93e0('0x47')]);_0x5b4159[_0x93e0('0x48')]=_[_0x93e0('0x49')](_0x5b4159[_0x93e0('0x4b')],_0x5b4159[_0x93e0('0x47')]);_0x1c041a['attributes']=_['intersection'](_0x5b4159[_0x93e0('0x4b')],qs['fields'](_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x1c041a[_0x93e0('0x4a')]=_0x1c041a[_0x93e0('0x4a')][_0x93e0('0x4d')]?_0x1c041a[_0x93e0('0x4a')]:_0x5b4159['model'];_0x1c041a[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x2f23a2['query'][_0x93e0('0x51')]);_0x1c041a[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_[_0x93e0('0x53')](_0x2f23a2[_0x93e0('0x47')],_0x5b4159[_0x93e0('0x48')]));if(_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x55')]){_0x1c041a[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x1c041a['where'],{'$or':_[_0x93e0('0x42')](_0x1c041a[_0x93e0('0x4a')],function(_0x147248){var _0x1c5210={};_0x1c5210[_0x147248]={'$like':'%'+_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x1c5210;})});}_0x1c041a=_['merge']({},_0x1c041a,_0x2f23a2[_0x93e0('0x5c')]);return _0x1c6fe2[_0x93e0('0x9a')](_0x1c041a);}})['then'](function(_0x203af7){if(_0x203af7){_0x39da90=_0x203af7[_0x93e0('0x4d')];if(!_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x1c041a[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x2f23a2[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x1c041a['offset']=qs['offset'](_0x2f23a2[_0x93e0('0x47')]['offset']);}return _0x1c6fe2['getApplications'](_0x1c041a);}})[_0x93e0('0x10')](function(_0xcadc23){if(_0xcadc23){return _0xcadc23?{'count':_0x39da90,'rows':_0xcadc23}:null;}})[_0x93e0('0x10')](respondWithResult(_0x15eb1f,null))[_0x93e0('0x19')](handleError(_0x15eb1f,null));};exports[_0x93e0('0x9b')]=function(_0x111ed9,_0x12e83c){var _0x214cee={'raw':!![],'where':{}};var _0x220b9f={};var _0xd39822={'count':0x0,'rows':[]};return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x111ed9['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x12e83c,null))[_0x93e0('0x10')](function(_0x5c4cdb){if(_0x5c4cdb){_0x220b9f[_0x93e0('0x4b')]=_['keys'](db[_0x93e0('0x9c')]['rawAttributes']);_0x220b9f[_0x93e0('0x47')]=_['keys'](_0x111ed9['query']);_0x220b9f['filters']=_[_0x93e0('0x49')](_0x220b9f[_0x93e0('0x4b')],_0x220b9f[_0x93e0('0x47')]);_0x214cee[_0x93e0('0x4a')]=_[_0x93e0('0x49')](_0x220b9f[_0x93e0('0x4b')],qs[_0x93e0('0x4c')](_0x111ed9[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x214cee[_0x93e0('0x4a')]=_0x214cee['attributes'][_0x93e0('0x4d')]?_0x214cee['attributes']:_0x220b9f[_0x93e0('0x4b')];if(!_0x111ed9['query'][_0x93e0('0x4e')](_0x93e0('0x4f'))){_0x214cee[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x111ed9[_0x93e0('0x47')][_0x93e0('0x1e')]);_0x214cee['offset']=qs[_0x93e0('0x1c')](_0x111ed9[_0x93e0('0x47')]['offset']);}_0x214cee['order']=qs[_0x93e0('0x51')](_0x111ed9[_0x93e0('0x47')]['sort']);_0x214cee[_0x93e0('0x52')]=qs['filters'](_[_0x93e0('0x53')](_0x111ed9[_0x93e0('0x47')],_0x220b9f[_0x93e0('0x48')]));_0x214cee[_0x93e0('0x52')]['MailAccountId']=_0x5c4cdb['id'];if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x55')]){_0x214cee['where']=_['merge'](_0x214cee[_0x93e0('0x52')],{'$or':_[_0x93e0('0x42')](_0x214cee['attributes'],function(_0x3bc80b){var _0x3eff24={};_0x3eff24[_0x3bc80b]={'$like':'%'+_0x111ed9[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x3eff24;})});}if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x9d')]){var _0x2dd363=_0x111ed9['query'][_0x93e0('0x9d')][_0x93e0('0x9e')](',');var _0x2a7535={};_0x2a7535[_0x2dd363[0x0]]={'$gte':moment(_0x2dd363[0x1])[_0x93e0('0x9f')](_0x93e0('0xa0'))};_0x214cee['where']=_[_0x93e0('0x54')](_0x214cee[_0x93e0('0x52')],_0x2a7535);}_0x214cee=_[_0x93e0('0x54')]({},_0x214cee,_0x111ed9['options']);return db[_0x93e0('0x9c')][_0x93e0('0x1f')]({'where':_0x214cee[_0x93e0('0x52')]})['then'](function(_0x7edfce){_0xd39822[_0x93e0('0x1f')]=_0x7edfce;if(_0x111ed9[_0x93e0('0x47')][_0x93e0('0x5b')]){_0x214cee[_0x93e0('0x57')]=[{'all':!![]}];}return db[_0x93e0('0x9c')][_0x93e0('0x6b')](_0x214cee);})[_0x93e0('0x10')](function(_0x18f4fb){if(_0x111ed9[_0x93e0('0x47')]['inlineCss']===_0x93e0('0xa1')){for(var _0x289787=0x0;_0x289787<_0x18f4fb[_0x93e0('0x4d')];_0x289787++){_0x18f4fb[_0x289787][_0x93e0('0x5d')]=juice(_0x18f4fb[_0x289787][_0x93e0('0x5d')]);}}_0xd39822['rows']=_0x18f4fb;return _0xd39822;});}})[_0x93e0('0x10')](respondWithFilteredResult(_0x12e83c,_0x214cee))['catch'](handleError(_0x12e83c,null));};exports[_0x93e0('0x99')]=function(_0x168071,_0xe3529a){var _0x1ff737,_0x2c273f={},_0x4f279e;if(_0x168071[_0x93e0('0x5d')]['to']){_0x4f279e=_0x168071[_0x93e0('0x5d')]['to']['split'](',')[0x0];}return db['MailAccount'][_0x93e0('0x60')]({'where':{'id':_0x168071[_0x93e0('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x93e0('0xa2'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x4f279e},'limit':0x1,'order':[[_0x93e0('0xa3'),'DESC']]}]},{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c'),'raw':!![],'include':[{'model':db[_0x93e0('0xa4')],'as':_0x93e0('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xe3529a,null))['then'](function(_0x187c7a){if(!_0x187c7a)return;_0x1ff737=_0x187c7a;if(!_0x187c7a['Smtp'])throw new Error(_0x93e0('0xa5'));if(_[_0x93e0('0x74')](_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')])){_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')]=util[_0x93e0('0x9f')](_0x93e0('0xa7'),_0x187c7a['name'],_0x187c7a[_0x93e0('0x72')]||_0x187c7a[_0x93e0('0x3c')][_0x93e0('0x31')]);}if(_0x168071[_0x93e0('0x5d')]['attachments']&&_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x93e0('0x4d')]){for(var _0x9c9070=0x0;_0x9c9070<_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x93e0('0x4d')];_0x9c9070+=0x1){_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x9c9070]={'filename':_0x168071['body']['attachments'][_0x9c9070][_0x93e0('0x27')],'path':path[_0x93e0('0xa9')](config[_0x93e0('0xaa')],'server/files/attachments',_0x168071[_0x93e0('0x5d')][_0x93e0('0xa8')][_0x9c9070][_0x93e0('0xab')])};}}var _0x46ee3b=_0x187c7a[_0x93e0('0xac')]();return respondWithRpcPromise(_0x93e0('0xad'),_0x93e0('0xae'),{'account':_0x46ee3b,'message':_0x168071['body']});})[_0x93e0('0x10')](function(_0x34c9a8){if(!_0x34c9a8)return;_0x2c273f=_0x34c9a8;if(!_0x1ff737[_0x93e0('0xa2')])throw new Error(_0x93e0('0xaf'));if(_0x1ff737[_0x93e0('0xa2')][_0x93e0('0xb0')][_0x93e0('0x4d')])return _0x1ff737[_0x93e0('0xa2')][_0x93e0('0xb0')][0x0];return db[_0x93e0('0xb1')][_0x93e0('0x68')](_[_0x93e0('0xb2')](_0x168071[_0x93e0('0x5d')],{'firstName':_0x168071[_0x93e0('0x5d')]['to'],'email':_0x168071[_0x93e0('0x5d')]['to'],'phone':_0x168071[_0x93e0('0x5d')]['to'],'ListId':_0x1ff737[_0x93e0('0x73')]}));})[_0x93e0('0x10')](function(_0x113cc6){if(!_0x113cc6)return;var _0x3fbb35={'UserId':_0x168071['user']['id'],'ContactId':_0x113cc6['id'],'MailAccountId':_0x1ff737['id'],'inReplyTo':_0x2c273f[_0x93e0('0xb3')],'to':_0x168071[_0x93e0('0x5d')][_0x93e0('0xa6')],'cc':_0x168071[_0x93e0('0x5d')]['cc'],'subject':_0x168071['body'][_0x93e0('0xb4')],'attach':_0x168071[_0x93e0('0x5d')][_0x93e0('0xb5')],'firstMsgDirection':_0x93e0('0xb6'),'lastMsgAt':moment()[_0x93e0('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x93e0('0xb6'),'Messages':[_[_0x93e0('0x54')](_0x168071[_0x93e0('0x5d')],{'messageId':_0x2c273f[_0x93e0('0xb3')],'sentAt':moment()[_0x93e0('0x9f')](_0x93e0('0xa0')),'read':!![],'MailAccountId':_0x1ff737['id'],'UserId':_0x168071[_0x93e0('0x31')]['id'],'ContactId':_0x113cc6['id']})]};if(_0x168071['body'][_0x93e0('0xb7')]){_0x3fbb35=_[_0x93e0('0x54')](_0x3fbb35,_0x168071[_0x93e0('0x5d')][_0x93e0('0xb7')]);}return db[_0x93e0('0x84')][_0x93e0('0x68')](_0x3fbb35,{'include':[{'model':db[_0x93e0('0x9c')],'as':'Messages'}]});})[_0x93e0('0x10')](respondWithResult(_0xe3529a,null))['catch'](handleError(_0xe3529a,null));};exports[_0x93e0('0xb8')]=function(_0x1c0055,_0x4db3d9){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x1c0055[_0x93e0('0x61')]['id']},'include':[{'model':db[_0x93e0('0x3f')],'as':_0x93e0('0x3c'),'raw':!![],'include':[{'model':db[_0x93e0('0xa4')],'as':_0x93e0('0xa4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4db3d9,null))[_0x93e0('0x10')](function(_0x4752e1){if(!_0x4752e1[_0x93e0('0x3c')])return;var _0x4fd3bf=_0x4752e1[_0x93e0('0xac')]();return respondWithRpcPromise(_0x93e0('0xb9'),_0x93e0('0xb8'),{'account':_0x4fd3bf});})[_0x93e0('0x10')](respondWithResult(_0x4db3d9,null))[_0x93e0('0x19')](handleError(_0x4db3d9,null));};exports[_0x93e0('0x26')]=function(_0x4b6a02,_0x4e1267){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x4b6a02[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x4e1267,null))[_0x93e0('0x10')](function(_0x1b35ec){if(_0x1b35ec&&_0x1b35ec[_0x93e0('0x63')]){throw new db[(_0x93e0('0xba'))]['ValidationError'](_0x93e0('0xbb'));}return _0x1b35ec;})[_0x93e0('0x10')](removeEntity(_0x4e1267,null))['catch'](handleError(_0x4e1267,null));};exports[_0x93e0('0xbc')]=function(_0x5d2306,_0x585339){return db['MailAccount']['find']({'where':{'id':_0x5d2306[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x585339,null))[_0x93e0('0x10')](function(_0x389481){if(_0x389481){return _0x389481[_0x93e0('0xbc')](_0x5d2306[_0x93e0('0x5d')][_0x93e0('0x71')],_[_0x93e0('0x85')](_0x5d2306['body'],[_0x93e0('0x71'),'id'])||{})[_0x93e0('0xbd')](function(_0x1f312b){for(var _0x4e314d=0x0;_0x4e314d<_0x5d2306[_0x93e0('0x5d')]['ids'][_0x93e0('0x4d')];_0x4e314d+=0x1){socket['emit'](_0x93e0('0xbe'),{'UserId':Number(_0x5d2306['body'][_0x93e0('0x71')][_0x4e314d]),'MailAccountId':Number(_0x5d2306['params']['id'])});}return _0x1f312b;});}})[_0x93e0('0x10')](respondWithResult(_0x585339,null))[_0x93e0('0x19')](handleError(_0x585339,null));};exports[_0x93e0('0xbf')]=function(_0x1212ff,_0x5b06fb){return db[_0x93e0('0x56')][_0x93e0('0x60')]({'where':{'id':_0x1212ff['params']['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x5b06fb,null))[_0x93e0('0x10')](function(_0x2a78dd){if(_0x2a78dd){return _0x2a78dd[_0x93e0('0xbf')](_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')])[_0x93e0('0x10')](function(){if(_[_0x93e0('0xc0')](_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')])){for(var _0x10bc8f=0x0;_0x10bc8f<_0x1212ff['query'][_0x93e0('0x71')]['length'];_0x10bc8f+=0x1){socket[_0x93e0('0xc1')](_0x93e0('0xc2'),{'UserId':Number(_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')][_0x10bc8f]),'MailAccountId':Number(_0x1212ff['params']['id'])});}}else{socket[_0x93e0('0xc1')]('userMailAccount:remove',{'UserId':Number(_0x1212ff[_0x93e0('0x47')][_0x93e0('0x71')]),'MailAccountId':Number(_0x1212ff[_0x93e0('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b06fb,null))[_0x93e0('0x19')](handleError(_0x5b06fb,null));};exports[_0x93e0('0xc3')]=function(_0x5fae6f,_0x584e74){var _0x536366={};var _0x237ae1={};var _0x204da1;var _0x22492b;return db[_0x93e0('0x56')][_0x93e0('0x6a')]({'where':{'id':_0x5fae6f[_0x93e0('0x61')]['id']}})[_0x93e0('0x10')](handleEntityNotFound(_0x584e74,null))[_0x93e0('0x10')](function(_0x1069af){if(_0x1069af){_0x204da1=_0x1069af;_0x237ae1[_0x93e0('0x4b')]=_[_0x93e0('0x5a')](db[_0x93e0('0x88')][_0x93e0('0x43')]);_0x237ae1[_0x93e0('0x47')]=_[_0x93e0('0x5a')](_0x5fae6f['query']);_0x237ae1[_0x93e0('0x48')]=_['intersection'](_0x237ae1[_0x93e0('0x4b')],_0x237ae1[_0x93e0('0x47')]);_0x536366[_0x93e0('0x4a')]=_['intersection'](_0x237ae1['model'],qs[_0x93e0('0x4c')](_0x5fae6f[_0x93e0('0x47')][_0x93e0('0x4c')]));_0x536366[_0x93e0('0x4a')]=_0x536366[_0x93e0('0x4a')]['length']?_0x536366[_0x93e0('0x4a')]:_0x237ae1[_0x93e0('0x4b')];_0x536366[_0x93e0('0x50')]=qs[_0x93e0('0x51')](_0x5fae6f['query'][_0x93e0('0x51')]);_0x536366[_0x93e0('0x52')]=qs[_0x93e0('0x48')](_['pick'](_0x5fae6f[_0x93e0('0x47')],_0x237ae1[_0x93e0('0x48')]));if(_0x5fae6f[_0x93e0('0x47')]['filter']){_0x536366[_0x93e0('0x52')]=_[_0x93e0('0x54')](_0x536366['where'],{'$or':_[_0x93e0('0x42')](_0x536366[_0x93e0('0x4a')],function(_0x3a61fa){var _0x1ec062={};_0x1ec062[_0x3a61fa]={'$like':'%'+_0x5fae6f[_0x93e0('0x47')][_0x93e0('0x55')]+'%'};return _0x1ec062;})});}_0x536366=_[_0x93e0('0x54')]({},_0x536366,_0x5fae6f['options']);return _0x204da1[_0x93e0('0xc3')](_0x536366);}})[_0x93e0('0x10')](function(_0x5c619c){if(_0x5c619c){_0x22492b=_0x5c619c['length'];if(!_0x5fae6f['query']['hasOwnProperty'](_0x93e0('0x4f'))){_0x536366[_0x93e0('0x1e')]=qs[_0x93e0('0x1e')](_0x5fae6f['query'][_0x93e0('0x1e')]);_0x536366['offset']=qs[_0x93e0('0x1c')](_0x5fae6f[_0x93e0('0x47')]['offset']);}return _0x204da1[_0x93e0('0xc3')](_0x536366);}})[_0x93e0('0x10')](function(_0x15e8df){if(_0x15e8df){return _0x15e8df?{'count':_0x22492b,'rows':_0x15e8df}:null;}})[_0x93e0('0x10')](respondWithResult(_0x584e74,null))[_0x93e0('0x19')](handleError(_0x584e74,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 51f6025..a6baf0f 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 _0x22ca=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x50cec2,_0x124b8e){var _0xddf22a=function(_0x54fae0){while(--_0x54fae0){_0x50cec2['push'](_0x50cec2['shift']());}};_0xddf22a(++_0x124b8e);}(_0x22ca,0x1d9));var _0xa22c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x22ca[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa22c('0x0'));var MailAccount=require(_0xa22c('0x1'))['db'][_0xa22c('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa22c('0x3')](0x0);var events={'afterCreate':_0xa22c('0x4'),'afterUpdate':_0xa22c('0x5'),'afterDestroy':_0xa22c('0x6')};function emitEvent(_0x915971){return function(_0x3de354,_0xae9f6c,_0x212156){MailAccountEvents['emit'](_0x915971+':'+_0x3de354['id'],_0x3de354);MailAccountEvents['emit'](_0x915971,_0x3de354);_0x212156(null);};}for(var e in events){if(events[_0xa22c('0x7')](e)){var event=events[e];MailAccount[_0xa22c('0x8')](e,emitEvent(event));}}module[_0xa22c('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x7da6=['save','update','emit','hook','MailAccount','setMaxListeners'];(function(_0x35f5bb,_0x354149){var _0xf8d19e=function(_0x391754){while(--_0x391754){_0x35f5bb['push'](_0x35f5bb['shift']());}};_0xf8d19e(++_0x354149);}(_0x7da6,0x124));var _0x67da=function(_0x2dacca,_0x3b55a5){_0x2dacca=_0x2dacca-0x0;var _0x4e8745=_0x7da6[_0x2dacca];return _0x4e8745;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x67da('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x67da('0x1')](0x0);var events={'afterCreate':_0x67da('0x2'),'afterUpdate':_0x67da('0x3'),'afterDestroy':'remove'};function emitEvent(_0x42a2f3){return function(_0x282a52,_0x37ef9d,_0x2d4937){MailAccountEvents[_0x67da('0x4')](_0x42a2f3+':'+_0x282a52['id'],_0x282a52);MailAccountEvents[_0x67da('0x4')](_0x42a2f3,_0x282a52);_0x2d4937(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x67da('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c8cd8e0..0dfe0b5 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 _0xa09b=['service','provider','Smtp','host','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xa09b,0x1e1));var _0xba09=function(_0x2b8a92,_0x192f64){_0x2b8a92=_0x2b8a92-0x0;var _0x31f0da=_0xa09b[_0x2b8a92];return _0x31f0da;};'use strict';var attributes=require(_0xba09('0x0'));module[_0xba09('0x1')]=function(_0x220130){return _0x220130[_0xba09('0x2')](_0xba09('0x3'),attributes,{'tableName':_0xba09('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5262c8=this;var _0x1c799b={'id':_0x5262c8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5262c8['provider']!=='custom'){_0x1c799b[_0xba09('0x5')]=_0x5262c8[_0xba09('0x6')];}else{_0x1c799b['host']=_0x5262c8[_0xba09('0x7')][_0xba09('0x8')];_0x1c799b['port']=_0x5262c8['Smtp']['port'];_0x1c799b[_0xba09('0x9')]=_0x5262c8['Smtp'][_0xba09('0x9')];}if(_0x5262c8['Smtp'][_0xba09('0xa')]){if(_0x5262c8[_0xba09('0x7')][_0xba09('0xb')]){if(!_0x5262c8[_0xba09('0x7')][_0xba09('0xc')])throw new Error(_0xba09('0xd'));_0x1c799b[_0xba09('0xe')]={'type':_0xba09('0xf'),'user':_0x5262c8[_0xba09('0x7')][_0xba09('0x10')],'accessToken':_0x5262c8['Smtp'][_0xba09('0xc')][_0xba09('0x11')]};}else{_0x1c799b[_0xba09('0xe')]={'user':_0x5262c8[_0xba09('0x7')][_0xba09('0x10')],'pass':_0x5262c8[_0xba09('0x7')]['pass']};}}return _0x1c799b;}}});}; \ No newline at end of file +var _0x63ac=['auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','provider','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x29ba9d,_0x14b57a){var _0x1685e3=function(_0x37d763){while(--_0x37d763){_0x29ba9d['push'](_0x29ba9d['shift']());}};_0x1685e3(++_0x14b57a);}(_0x63ac,0x196));var _0xc63a=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x63ac[_0x18aaaf];return _0x52d892;};'use strict';var attributes=require(_0xc63a('0x0'));module[_0xc63a('0x1')]=function(_0x1b2e8c){return _0x1b2e8c[_0xc63a('0x2')](_0xc63a('0x3'),attributes,{'tableName':_0xc63a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2db7c8=this;var _0x3510ad={'id':_0x2db7c8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2db7c8['provider']!==_0xc63a('0x5')){_0x3510ad[_0xc63a('0x6')]=_0x2db7c8[_0xc63a('0x7')];}else{_0x3510ad['host']=_0x2db7c8['Smtp']['host'];_0x3510ad['port']=_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x9')];_0x3510ad[_0xc63a('0xa')]=_0x2db7c8[_0xc63a('0x8')][_0xc63a('0xa')];}if(_0x2db7c8['Smtp'][_0xc63a('0xb')]){if(_0x2db7c8['Smtp'][_0xc63a('0xc')]){if(!_0x2db7c8['Smtp']['CloudProvider'])throw new Error(_0xc63a('0xd'));_0x3510ad[_0xc63a('0xe')]={'type':_0xc63a('0xf'),'user':_0x2db7c8['Smtp'][_0xc63a('0x10')],'accessToken':_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x11')][_0xc63a('0x12')]};}else{_0x3510ad[_0xc63a('0xe')]={'user':_0x2db7c8['Smtp'][_0xc63a('0x10')],'pass':_0x2db7c8[_0xc63a('0x8')][_0xc63a('0x13')]};}}return _0x3510ad;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f8fc61c..975e459 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 _0x6d38=['result','catch','findAll','options','raw','attributes','limit','map','include','model','then','GetMailAccount','debug','ShowMailAccount','find','smtp','setDataValue','smtpOptions','body','mail','difference','rawAttributes','CompanyId','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','getSmtpOptions','list','applications','orderBy','autoclose','push','length','close','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var moment=require(_0x86d3('0x0'));var BPromise=require(_0x86d3('0x1'));var rs=require(_0x86d3('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x86d3('0x3'))('rpc');var config=require(_0x86d3('0x4'));var jayson=require(_0x86d3('0x5'));var client=jayson[_0x86d3('0x6')]['http']({'port':0x232c});config[_0x86d3('0x7')]=_[_0x86d3('0x8')](config[_0x86d3('0x7')],{'host':_0x86d3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86d3('0xa'))[_0x86d3('0xb')](socket);function respondWithRpcPromise(_0xf273f5,_0x499640,_0x4a277e){return new BPromise(function(_0x3ed317,_0x555e6d){return client['request'](_0xf273f5,_0x4a277e)['then'](function(_0x4300e2){logger[_0x86d3('0xc')]('MailAccount,\x20%s,\x20%s',_0x499640,_0x86d3('0xd'));logger['debug'](_0x86d3('0xe'),_0x499640,_0x86d3('0xd'),JSON[_0x86d3('0xf')](_0x4300e2));if(_0x4300e2[_0x86d3('0x10')]){if(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x11')]===0x1f4){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2['error'][_0x86d3('0x13')]);return _0x555e6d(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);}logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);return _0x3ed317(_0x4300e2[_0x86d3('0x10')]['message']);}else{logger[_0x86d3('0xc')](_0x86d3('0x12'),_0x499640,_0x86d3('0xd'));_0x3ed317(_0x4300e2[_0x86d3('0x14')][_0x86d3('0x13')]);}})[_0x86d3('0x15')](function(_0x33e459){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x33e459);_0x555e6d(_0x33e459);});});}exports['GetMailAccount']=function(_0x191ba5){var _0x57c340=this;return new Promise(function(_0x6ced9e,_0x5c4d55){return db['MailAccount'][_0x86d3('0x16')]({'raw':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x18')]===undefined?!![]:![]:!![],'where':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')]['where']||null:null,'attributes':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'limit':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x1a')]||null:null,'include':_0x191ba5[_0x86d3('0x17')]?_0x191ba5['options']['include']?_[_0x86d3('0x1b')](_0x191ba5['options'][_0x86d3('0x1c')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x1d')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x19')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x1c')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x19')],'include':_0x611764['include']?_[_0x86d3('0x1b')](_0x611764[_0x86d3('0x1c')],function(_0x287b96){return{'model':db[_0x287b96[_0x86d3('0x1d')]],'as':_0x287b96['as'],'attributes':_0x287b96[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x1f203e){logger[_0x86d3('0xc')](_0x86d3('0x1f'),_0x191ba5);logger[_0x86d3('0x20')](_0x86d3('0x1f'),_0x191ba5,JSON[_0x86d3('0xf')](_0x1f203e));_0x6ced9e(_0x1f203e);})[_0x86d3('0x15')](function(_0x28c25e){logger['error'](_0x86d3('0x1f'),_0x28c25e[_0x86d3('0x13')],_0x191ba5);_0x5c4d55(_0x57c340[_0x86d3('0x10')](0x1f4,_0x28c25e[_0x86d3('0x13')]));});});};exports[_0x86d3('0x21')]=function(_0x245e39){var _0x4a5ff0=this;return new Promise(function(_0xba2f49,_0x5c71df){return db['MailAccount'][_0x86d3('0x22')]({'raw':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['where']||null:null,'attributes':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'include':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x245e39[_0x86d3('0x17')]['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x19')],'include':_0x4cdf45['include']?_[_0x86d3('0x1b')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x1d')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x19')],'include':_0x366943[_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x366943[_0x86d3('0x1c')],function(_0x2d15b9){return{'model':db[_0x2d15b9['model']],'as':_0x2d15b9['as'],'attributes':_0x2d15b9[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x5e2519){if(_0x245e39[_0x86d3('0x17')][_0x86d3('0x23')]===!![])_0x5e2519[_0x86d3('0x24')](_0x86d3('0x25'),_0x5e2519['getSmtpOptions']());logger[_0x86d3('0xc')](_0x86d3('0x21'),_0x245e39);logger[_0x86d3('0x20')]('ShowMailAccount',_0x245e39,JSON[_0x86d3('0xf')](_0x5e2519));_0xba2f49(_0x5e2519);})[_0x86d3('0x15')](function(_0x1a1c06){logger[_0x86d3('0x10')](_0x86d3('0x21'),_0x1a1c06[_0x86d3('0x13')],_0x245e39);_0x5c71df(_0x4a5ff0[_0x86d3('0x10')](0x1f4,_0x1a1c06[_0x86d3('0x13')]));});});};exports['NotifyMailAccount']=function(_0x22bc98){var _0x470978=this;return new Promise(function(_0x2bdc67,_0x461052){var _0x5ebb4d={'body':_0x22bc98[_0x86d3('0x26')],'channel':_0x86d3('0x27')};var _0x6f72be=_[_0x86d3('0x28')](_['keys'](db['CmContact'][_0x86d3('0x29')]),['createdAt','updatedAt',_0x86d3('0x2a'),_0x86d3('0x2b')]);var _0x43490a=![];if(_0x22bc98[_0x86d3('0x26')]['id']){delete _0x22bc98[_0x86d3('0x26')]['id'];}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x86d3('0x2d')](_0x22bc98[_0x86d3('0x26')]['body'])||_0x22bc98[_0x86d3('0x26')][_0x86d3('0x26')]===''){return _0x461052(_0x470978['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x2f')+_0x6f72be));}if(!_[_0x86d3('0x30')](_0x6f72be,_0x22bc98[_0x86d3('0x26')]['mapKey'])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x31')+_0x6f72be));}var _0x5d9dad={};_0x5d9dad[_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')]]=_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')];return db[_0x86d3('0x32')][_0x86d3('0x22')]({'where':{'id':_0x22bc98['account']['id']},'include':[{'model':db[_0x86d3('0x33')],'as':_0x86d3('0x34'),'include':[{'model':db['CmContact'],'as':_0x86d3('0x35'),'where':_0x5d9dad,'limit':0x1,'order':[[_0x86d3('0x36'),_0x86d3('0x37')]]}]},{'model':db[_0x86d3('0x38')],'as':_0x86d3('0x39')},{'model':db['MailServerOut'],'as':_0x86d3('0x3a'),'include':[{'model':db[_0x86d3('0x3b')],'as':_0x86d3('0x3b')}]}]})[_0x86d3('0x1e')](function(_0x369b75){if(_0x369b75&&_0x369b75[_0x86d3('0x34')]){var _0x1a4345=_0x369b75[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x1a4345,[_0x86d3('0x39'),_0x86d3('0x34')]);_0x5ebb4d['account'][_0x86d3('0x25')]=_0x369b75[_0x86d3('0x3f')]();_0x5ebb4d['applications']=_0x1a4345[_0x86d3('0x39')];_0x5ebb4d[_0x86d3('0x40')]=_0x1a4345[_0x86d3('0x34')];_0x5ebb4d[_0x86d3('0x41')]=_[_0x86d3('0x42')](_0x5ebb4d[_0x86d3('0x41')],['priority'],['asc']);if(_0x5ebb4d['account']&&_0x5ebb4d['account'][_0x86d3('0x43')]){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x44')]({'id':0x0,'priority':_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x45')]+0x1,'app':_0x86d3('0x46'),'appdata':_0x86d3('0x43'),'interval':'*,*,*,*'});}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')]){delete _0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')];}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x34')]){delete _0x5ebb4d[_0x86d3('0x3d')]['List'];}if(_0x1a4345[_0x86d3('0x34')]['Contacts'][_0x86d3('0x45')]){return _0x1a4345[_0x86d3('0x34')][_0x86d3('0x35')][0x0];}var _0x3ffd22=_[_0x86d3('0x8')](_0x22bc98['body'],{'firstName':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')],'ListId':_0x1a4345[_0x86d3('0x2b')]});_0x3ffd22[_0x22bc98['body']['mapKey']]=_0x22bc98['body'][_0x86d3('0x2c')];return db['CmContact'][_0x86d3('0x47')](_0x3ffd22);}else{throw new Error(_0x86d3('0x48'));}})[_0x86d3('0x1e')](function(_0x319ea0){_0x5ebb4d['contact']=_0x319ea0;if(_0x319ea0){if(!_0x22bc98['body']['message'][_0x86d3('0x49')]){_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')]=rs[_0x86d3('0x4a')]()+'\x20'+_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')];}var _0x5123fd={'ContactId':_0x319ea0['id'],'MailAccountId':_0x22bc98[_0x86d3('0x3d')]['id'],'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98['body'][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98['body'][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x86d3('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x22bc98['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x86d3('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x4f')]}}]})[_0x86d3('0x1e')](function(_0xa48003){if(_0xa48003){return[_0xa48003,![]];}return db['MailInteraction']['create'](_0x5123fd)[_0x86d3('0x1e')](function(_0xf2c179){return[_0xf2c179,!![]];});});}else{throw new Error(_0x86d3('0x50'));}})[_0x86d3('0x51')](function(_0x22d8eb,_0x1952af){if(_0x22d8eb){_0x43490a=_0x1952af;if(!_0x1952af){return _0x22d8eb[_0x86d3('0x52')]({'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22d8eb['attach']?_0x22d8eb[_0x86d3('0x4c')]:_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'substatus':null,'substatusAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgDirection':'in'});}else{return _0x22d8eb;}}})['then'](function(_0x41d448){_0x5ebb4d['interaction']=_0x41d448[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x55')][_0x86d3('0x56')]=_0x43490a;return db[_0x86d3('0x57')][_0x86d3('0x47')]({'body':_0x22bc98['body'][_0x86d3('0x26')],'MailAccountId':_0x22bc98['account']['id'],'MailInteractionId':_0x41d448['id'],'direction':'in','ContactId':_0x5ebb4d[_0x86d3('0x58')]['id'],'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')],'from':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['to'],'cc':_0x22bc98[_0x86d3('0x26')]['message']['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'Attachments':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attachments'],'originTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x59')],'originCc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5a')],'bcc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5b')],'ChatWebsiteId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5c')]||null,'originChannel':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['originChannel']||_0x86d3('0x5d'),'ChatOfflineMessageId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x86d3('0x5f')}]});})[_0x86d3('0x1e')](function(_0x1a97f3){_0x5ebb4d[_0x86d3('0x13')]=_0x1a97f3;if(_0x5ebb4d['interaction']['UserId']){return db[_0x86d3('0x60')]['find']({'attributes':['id',_0x86d3('0x61')],'where':{'id':_0x5ebb4d['interaction']['UserId']}})[_0x86d3('0x1e')](function(_0x28bd40){if(_0x28bd40){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x62')]({'id':0x0,'priority':0x0,'app':_0x86d3('0x63'),'appdata':_0x28bd40['name']+','+(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x86d3('0x65'),_0x86d3('0x66'),_0x5ebb4d);});}return respondWithRpcPromise('Start',_0x86d3('0x66'),_0x5ebb4d);})['then'](function(_0x1867fc){_0x2bdc67(_0x1867fc);})['catch'](function(_0x5bb2e5){_0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x5bb2e5['message']));});});}; \ No newline at end of file +var _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 96f6c49..b72cea8 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 _0x558c=['removeListener','length','mailAccount:','remove','update'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x558c,0xbc));var _0xc558=function(_0x30c0c4,_0x338b20){_0x30c0c4=_0x30c0c4-0x0;var _0xc673ff=_0x558c[_0x30c0c4];return _0xc673ff;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0xc558('0x0'),_0xc558('0x1')];function createListener(_0x8bf40f,_0x16f024){return function(_0x26fea1){_0x16f024['emit'](_0x8bf40f,_0x26fea1);};}function removeListener(_0x20f2d4,_0x489421){return function(){MailAccountEvents[_0xc558('0x2')](_0x20f2d4,_0x489421);};}exports['register']=function(_0x437a21){for(var _0x457e4b=0x0,_0xe438fd=events[_0xc558('0x3')];_0x457e4b<_0xe438fd;_0x457e4b++){var _0x1f9f16=events[_0x457e4b];var _0x20e813=createListener(_0xc558('0x4')+_0x1f9f16,_0x437a21);MailAccountEvents['on'](_0x1f9f16,_0x20e813);}}; \ No newline at end of file +var _0xb77e=['./mailAccount.events','save','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb77e,0x1e6));var _0xeb77=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb77e[_0x24237f];return _0x48298e;};'use strict';var MailAccountEvents=require(_0xeb77('0x0'));var events=[_0xeb77('0x1'),_0xeb77('0x2'),_0xeb77('0x3')];function createListener(_0x1ae2d5,_0x6264ba){return function(_0x3b4cf5){_0x6264ba[_0xeb77('0x4')](_0x1ae2d5,_0x3b4cf5);};}function removeListener(_0x3ba434,_0x2618c2){return function(){MailAccountEvents[_0xeb77('0x5')](_0x3ba434,_0x2618c2);};}exports[_0xeb77('0x6')]=function(_0x6b6538){for(var _0x1301d2=0x0,_0x5135ae=events[_0xeb77('0x7')];_0x1301d2<_0x5135ae;_0x1301d2++){var _0x45dd88=events[_0x1301d2];var _0x1f5824=createListener(_0xeb77('0x8')+_0x45dd88,_0x6b6538);MailAccountEvents['on'](_0x45dd88,_0x1f5824);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 277bfd2..706ea6a 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 _0xffff=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffff,0x10a));var _0xffff=function(_0xeea203,_0x3ef746){_0xeea203=_0xeea203-0x0;var _0x443429=_0xffff[_0xeea203];return _0x443429;};'use strict';var multer=require(_0xffff('0x0'));var util=require(_0xffff('0x1'));var path=require(_0xffff('0x2'));var timeout=require(_0xffff('0x3'));var express=require(_0xffff('0x4'));var router=express[_0xffff('0x5')]();var fs_extra=require(_0xffff('0x6'));var auth=require(_0xffff('0x7'));var interaction=require(_0xffff('0x8'));var config=require('../../config/environment');var controller=require(_0xffff('0x9'));router[_0xffff('0xa')](_0xffff('0xb'),auth[_0xffff('0xc')](),controller[_0xffff('0xd')]);router[_0xffff('0xe')](_0xffff('0xb'),auth[_0xffff('0xc')](),controller[_0xffff('0xf')]);router[_0xffff('0x10')](_0xffff('0xb'),auth[_0xffff('0xc')](),controller[_0xffff('0x11')]);module[_0xffff('0x12')]=router; \ No newline at end of file +var _0xb2ea=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show','update','delete','exports'];(function(_0xbe61db,_0x512e66){var _0x2550bf=function(_0x4127ec){while(--_0x4127ec){_0xbe61db['push'](_0xbe61db['shift']());}};_0x2550bf(++_0x512e66);}(_0xb2ea,0x188));var _0xab2e=function(_0x16ec9d,_0x36ac5d){_0x16ec9d=_0x16ec9d-0x0;var _0x1e98b=_0xb2ea[_0x16ec9d];return _0x1e98b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab2e('0x0'));var timeout=require(_0xab2e('0x1'));var express=require('express');var router=express[_0xab2e('0x2')]();var fs_extra=require(_0xab2e('0x3'));var auth=require(_0xab2e('0x4'));var interaction=require(_0xab2e('0x5'));var config=require(_0xab2e('0x6'));var controller=require(_0xab2e('0x7'));router[_0xab2e('0x8')](_0xab2e('0x9'),auth['isAuthenticated'](),controller[_0xab2e('0xa')]);router['put'](_0xab2e('0x9'),auth['isAuthenticated'](),controller[_0xab2e('0xb')]);router[_0xab2e('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xab2e('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ff76a79..edf23b5 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 _0x33b3=['TEXT','sequelize','INTEGER','STRING','noop'];(function(_0x39f0c5,_0xe8eda0){var _0x31ecaf=function(_0x541252){while(--_0x541252){_0x39f0c5['push'](_0x39f0c5['shift']());}};_0x31ecaf(++_0xe8eda0);}(_0x33b3,0x137));var _0x333b=function(_0x163b80,_0x27ac34){_0x163b80=_0x163b80-0x0;var _0x29319a=_0x33b3[_0x163b80];return _0x29319a;};'use strict';var Sequelize=require(_0x333b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x333b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x333b('0x2')],'allowNull':![],'defaultValue':_0x333b('0x3')},'appdata':{'type':Sequelize[_0x333b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x333b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa3aa=['INTEGER','STRING','TEXT','sequelize'];(function(_0x53d267,_0x3cfbc2){var _0x3f46c0=function(_0x12d321){while(--_0x12d321){_0x53d267['push'](_0x53d267['shift']());}};_0x3f46c0(++_0x3cfbc2);}(_0xa3aa,0x1bb));var _0xaa3a=function(_0x52c864,_0x314587){_0x52c864=_0x52c864-0x0;var _0x1637ae=_0xa3aa[_0x52c864];return _0x1637ae;};'use strict';var Sequelize=require(_0xaa3a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaa3a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaa3a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xaa3a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xaa3a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 22eff10..9a2e576 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x3f0c87,_0xb7b369){var _0x2445b1=function(_0x5030e9){while(--_0x5030e9){_0x3f0c87['push'](_0x3f0c87['shift']());}};_0x2445b1(++_0xb7b369);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x5274b8,_0x492cfb){var _0x1a4b00=function(_0x22bffd){while(--_0x22bffd){_0x5274b8['push'](_0x5274b8['shift']());}};_0x1a4b00(++_0x492cfb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3576a8,_0x2a096e){_0x3576a8=_0x3576a8-0x0;var _0x49d6c7=_0xf4eb[_0x3576a8];return _0x49d6c7;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index eea535e..51b38b6 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 _0x54e9=['./mailApplication.attributes','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38cf75,_0x2aa799){var _0x222b18=function(_0x3a11b9){while(--_0x3a11b9){_0x38cf75['push'](_0x38cf75['shift']());}};_0x222b18(++_0x2aa799);}(_0x54e9,0x1a6));var _0x954e=function(_0x213d00,_0x2c4ac9){_0x213d00=_0x213d00-0x0;var _0x21946f=_0x54e9[_0x213d00];return _0x21946f;};'use strict';var _=require('lodash');var util=require(_0x954e('0x0'));var logger=require(_0x954e('0x1'))(_0x954e('0x2'));var moment=require('moment');var BPromise=require(_0x954e('0x3'));var rp=require(_0x954e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x954e('0x5'));var config=require(_0x954e('0x6'));var attributes=require(_0x954e('0x7'));module['exports']=function(_0x168143,_0x119b3a){return _0x168143[_0x954e('0x8')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x954e('0x9'),'collate':_0x954e('0xa')});}; \ No newline at end of file +var _0x5a11=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0xc99b49,_0x490bc3){var _0x597097=function(_0x28cb5c){while(--_0x28cb5c){_0xc99b49['push'](_0xc99b49['shift']());}};_0x597097(++_0x490bc3);}(_0x5a11,0xec));var _0x15a1=function(_0x16fc46,_0x55190d){_0x16fc46=_0x16fc46-0x0;var _0x20b456=_0x5a11[_0x16fc46];return _0x20b456;};'use strict';var _=require('lodash');var util=require(_0x15a1('0x0'));var logger=require('../../config/logger')(_0x15a1('0x1'));var moment=require(_0x15a1('0x2'));var BPromise=require(_0x15a1('0x3'));var rp=require(_0x15a1('0x4'));var fs=require('fs');var path=require(_0x15a1('0x5'));var rimraf=require(_0x15a1('0x6'));var config=require('../../config/environment');var attributes=require(_0x15a1('0x7'));module[_0x15a1('0x8')]=function(_0xbf73ce,_0x5c8fe9){return _0xbf73ce['define'](_0x15a1('0x9'),attributes,{'tableName':_0x15a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x15a1('0xb'),'collate':_0x15a1('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 0f8147a..bbe9fa1 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 _0x8fc7=['request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailApplication','update','body','raw','options','where','limit','lodash','util','bluebird','randomstring','../../config/logger','jayson/promise'];(function(_0x434784,_0x732cb2){var _0x4f5803=function(_0x47126f){while(--_0x47126f){_0x434784['push'](_0x434784['shift']());}};_0x4f5803(++_0x732cb2);}(_0x8fc7,0x126));var _0x78fc=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x8fc7[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x78fc('0x0'));var util=require(_0x78fc('0x1'));var moment=require('moment');var BPromise=require(_0x78fc('0x2'));var rs=require(_0x78fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x78fc('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x78fc('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce055,_0x156912,_0x1f4a04){return new BPromise(function(_0xd170db,_0x3c49e0){return client[_0x78fc('0x6')](_0x2ce055,_0x1f4a04)[_0x78fc('0x7')](function(_0x37faf8){logger[_0x78fc('0x8')](_0x78fc('0x9'),_0x156912,'request\x20sent');logger[_0x78fc('0xa')](_0x78fc('0xb'),_0x156912,_0x78fc('0xc'),JSON['stringify'](_0x37faf8));if(_0x37faf8[_0x78fc('0xd')]){if(_0x37faf8[_0x78fc('0xd')][_0x78fc('0xe')]===0x1f4){logger['error'](_0x78fc('0x9'),_0x156912,_0x37faf8[_0x78fc('0xd')]['message']);return _0x3c49e0(_0x37faf8[_0x78fc('0xd')]['message']);}logger[_0x78fc('0xd')](_0x78fc('0x9'),_0x156912,_0x37faf8[_0x78fc('0xd')][_0x78fc('0xf')]);return _0xd170db(_0x37faf8['error'][_0x78fc('0xf')]);}else{logger[_0x78fc('0x8')](_0x78fc('0x9'),_0x156912,_0x78fc('0xc'));_0xd170db(_0x37faf8[_0x78fc('0x10')][_0x78fc('0xf')]);}})[_0x78fc('0x11')](function(_0x190547){logger[_0x78fc('0xd')](_0x78fc('0x9'),_0x156912,_0x190547);_0x3c49e0(_0x190547);});});}exports[_0x78fc('0x12')]=function(_0x856581){var _0x4471f1=this;return new Promise(function(_0x211c08,_0xc2ebb){return db['MailApplication'][_0x78fc('0x13')](_0x856581[_0x78fc('0x14')],{'raw':_0x856581['options']?_0x856581['options'][_0x78fc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x856581[_0x78fc('0x16')]?_0x856581['options'][_0x78fc('0x17')]||null:null,'attributes':_0x856581[_0x78fc('0x16')]?_0x856581[_0x78fc('0x16')]['attributes']||null:null,'limit':_0x856581[_0x78fc('0x16')]?_0x856581['options'][_0x78fc('0x18')]||null:null})[_0x78fc('0x7')](function(_0x505c84){logger[_0x78fc('0x8')]('UpdateMailApplication',_0x856581);logger['debug']('UpdateMailApplication',_0x856581,JSON['stringify'](_0x505c84));_0x211c08(_0x505c84);})[_0x78fc('0x11')](function(_0xf1c64b){logger[_0x78fc('0xd')]('UpdateMailApplication',_0xf1c64b[_0x78fc('0xf')],_0x856581);_0xc2ebb(_0x4471f1[_0x78fc('0xd')](0x1f4,_0xf1c64b['message']));});});}; \ No newline at end of file +var _0xca71=['../../config/logger','rpc','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53c8c7,_0x348f83){var _0x4f9626=function(_0x25c457){while(--_0x25c457){_0x53c8c7['push'](_0x53c8c7['shift']());}};_0x4f9626(++_0x348f83);}(_0xca71,0x164));var _0x1ca7=function(_0x4e1ef7,_0x349fa5){_0x4e1ef7=_0x4e1ef7-0x0;var _0x20f191=_0xca71[_0x4e1ef7];return _0x20f191;};'use strict';var _=require('lodash');var util=require(_0x1ca7('0x0'));var moment=require(_0x1ca7('0x1'));var BPromise=require(_0x1ca7('0x2'));var rs=require(_0x1ca7('0x3'));var fs=require('fs');var Redis=require(_0x1ca7('0x4'));var db=require(_0x1ca7('0x5'))['db'];var utils=require(_0x1ca7('0x6'));var logger=require(_0x1ca7('0x7'))(_0x1ca7('0x8'));var config=require('../../config/environment');var jayson=require(_0x1ca7('0x9'));var client=jayson[_0x1ca7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57b5a4,_0x58dafb,_0x36bfe3){return new BPromise(function(_0x721bf9,_0x1a6e7d){return client[_0x1ca7('0xb')](_0x57b5a4,_0x36bfe3)[_0x1ca7('0xc')](function(_0x36abad){logger['info'](_0x1ca7('0xd'),_0x58dafb,'request\x20sent');logger[_0x1ca7('0xe')](_0x1ca7('0xf'),_0x58dafb,_0x1ca7('0x10'),JSON[_0x1ca7('0x11')](_0x36abad));if(_0x36abad[_0x1ca7('0x12')]){if(_0x36abad['error'][_0x1ca7('0x13')]===0x1f4){logger['error'](_0x1ca7('0xd'),_0x58dafb,_0x36abad['error']['message']);return _0x1a6e7d(_0x36abad['error'][_0x1ca7('0x14')]);}logger[_0x1ca7('0x12')]('MailApplication,\x20%s,\x20%s',_0x58dafb,_0x36abad['error']['message']);return _0x721bf9(_0x36abad[_0x1ca7('0x12')][_0x1ca7('0x14')]);}else{logger['info'](_0x1ca7('0xd'),_0x58dafb,_0x1ca7('0x10'));_0x721bf9(_0x36abad[_0x1ca7('0x15')][_0x1ca7('0x14')]);}})[_0x1ca7('0x16')](function(_0x15b429){logger[_0x1ca7('0x12')]('MailApplication,\x20%s,\x20%s',_0x58dafb,_0x15b429);_0x1a6e7d(_0x15b429);});});}exports[_0x1ca7('0x17')]=function(_0x330d06){var _0x4fbca8=this;return new Promise(function(_0x281f8e,_0x275daa){return db[_0x1ca7('0x18')][_0x1ca7('0x19')](_0x330d06[_0x1ca7('0x1a')],{'raw':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1d')]||null:null,'attributes':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1e')]||null:null,'limit':_0x330d06[_0x1ca7('0x1b')]?_0x330d06[_0x1ca7('0x1b')][_0x1ca7('0x1f')]||null:null})[_0x1ca7('0xc')](function(_0x22c48d){logger[_0x1ca7('0x20')]('UpdateMailApplication',_0x330d06);logger[_0x1ca7('0xe')](_0x1ca7('0x17'),_0x330d06,JSON['stringify'](_0x22c48d));_0x281f8e(_0x22c48d);})['catch'](function(_0x23cd80){logger['error'](_0x1ca7('0x17'),_0x23cd80['message'],_0x330d06);_0x275daa(_0x4fbca8[_0x1ca7('0x12')](0x1f4,_0x23cd80['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f1cd406..d550831 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 _0xd203=['exports','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x5512a8,_0x2e39cf){var _0x3010ba=function(_0x37b1a3){while(--_0x37b1a3){_0x5512a8['push'](_0x5512a8['shift']());}};_0x3010ba(++_0x2e39cf);}(_0xd203,0x12a));var _0x3d20=function(_0x30f4a2,_0x2741d4){_0x30f4a2=_0x30f4a2-0x0;var _0x9cf3e7=_0xd203[_0x30f4a2];return _0x9cf3e7;};'use strict';var express=require(_0x3d20('0x0'));var router=express['Router']();var auth=require(_0x3d20('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x3d20('0x2'));router[_0x3d20('0x3')]('/',auth[_0x3d20('0x4')](),controller[_0x3d20('0x5')]);router[_0x3d20('0x3')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3d20('0x3')](_0x3d20('0x6'),auth[_0x3d20('0x4')](),controller[_0x3d20('0x7')]);router[_0x3d20('0x3')]('/:id/messages',auth[_0x3d20('0x4')](),controller[_0x3d20('0x8')]);router[_0x3d20('0x3')](_0x3d20('0x9'),auth[_0x3d20('0x4')](),controller[_0x3d20('0xa')]);router['post']('/',auth[_0x3d20('0x4')](),controller[_0x3d20('0xb')]);router[_0x3d20('0xc')](_0x3d20('0xd'),auth[_0x3d20('0x4')](),controller['addMessage']);router[_0x3d20('0xc')](_0x3d20('0xe'),auth[_0x3d20('0x4')](),interaction[_0x3d20('0xf')]('mail',_0x3d20('0x10')),controller[_0x3d20('0x11')]);router[_0x3d20('0x12')](_0x3d20('0x6'),auth[_0x3d20('0x4')](),interaction[_0x3d20('0xf')](_0x3d20('0x13'),_0x3d20('0x14')),controller[_0x3d20('0x15')]);router[_0x3d20('0x16')](_0x3d20('0x6'),auth[_0x3d20('0x4')](),interaction[_0x3d20('0xf')]('mail',_0x3d20('0x17')),controller[_0x3d20('0x18')]);router[_0x3d20('0x16')](_0x3d20('0xe'),auth[_0x3d20('0x4')](),controller[_0x3d20('0x19')]);module[_0x3d20('0x1a')]=router; \ No newline at end of file +var _0x943a=['index','describe','show','/:id/messages','getMessages','download','post','create','mailinteraction:addtags','/:id','tracked','mail','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0x558d34,_0x29a338){var _0x4d99c2=function(_0x1ccd48){while(--_0x1ccd48){_0x558d34['push'](_0x558d34['shift']());}};_0x4d99c2(++_0x29a338);}(_0x943a,0x85));var _0xa943=function(_0x288076,_0x415fbf){_0x288076=_0x288076-0x0;var _0x50444b=_0x943a[_0x288076];return _0x50444b;};'use strict';var express=require(_0xa943('0x0'));var router=express[_0xa943('0x1')]();var auth=require(_0xa943('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xa943('0x3')]('/',auth[_0xa943('0x4')](),controller[_0xa943('0x5')]);router[_0xa943('0x3')]('/describe',auth[_0xa943('0x4')](),controller[_0xa943('0x6')]);router[_0xa943('0x3')]('/:id',auth[_0xa943('0x4')](),controller[_0xa943('0x7')]);router[_0xa943('0x3')](_0xa943('0x8'),auth[_0xa943('0x4')](),controller[_0xa943('0x9')]);router[_0xa943('0x3')]('/:id/download',auth[_0xa943('0x4')](),controller[_0xa943('0xa')]);router[_0xa943('0xb')]('/',auth[_0xa943('0x4')](),controller[_0xa943('0xc')]);router[_0xa943('0xb')]('/:id/messages',auth[_0xa943('0x4')](),controller['addMessage']);router[_0xa943('0xb')]('/:id/tags',auth[_0xa943('0x4')](),interaction['tracked']('mail',_0xa943('0xd')),controller['addTags']);router['put'](_0xa943('0xe'),auth[_0xa943('0x4')](),interaction[_0xa943('0xf')](_0xa943('0x10'),'mailinteraction:update'),controller[_0xa943('0x11')]);router[_0xa943('0x12')](_0xa943('0xe'),auth[_0xa943('0x4')](),interaction[_0xa943('0xf')](_0xa943('0x10'),_0xa943('0x13')),controller[_0xa943('0x14')]);router['delete'](_0xa943('0x15'),auth[_0xa943('0x4')](),controller['removeTags']);module[_0xa943('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d33e32a..b042ba9 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 _0xc01b=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x32b4ea,_0x2a5d47){var _0x473238=function(_0x2123bf){while(--_0x2123bf){_0x32b4ea['push'](_0x32b4ea['shift']());}};_0x473238(++_0x2a5d47);}(_0xc01b,0x74));var _0xbc01=function(_0xb38858,_0x4c15d0){_0xb38858=_0xb38858-0x0;var _0x1cd6a6=_0xc01b[_0xb38858];return _0x1cd6a6;};'use strict';var Sequelize=require(_0xbc01('0x0'));var iconv=require(_0xbc01('0x1'));module[_0xbc01('0x2')]={'closed':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbc01('0x4')]},'disposition':{'type':Sequelize[_0xbc01('0x5')]},'secondDisposition':{'type':Sequelize[_0xbc01('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbc01('0x5')]},'inReplyTo':{'type':Sequelize[_0xbc01('0x5')](0x1fe)},'to':{'type':Sequelize[_0xbc01('0x5')]},'cc':{'type':Sequelize[_0xbc01('0x6')](_0xbc01('0x7'))},'subject':{'type':Sequelize[_0xbc01('0x6')]()},'attach':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbc01('0x4')]},'substatus':{'type':Sequelize[_0xbc01('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xbc01('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbc01('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbc01('0x8')]('in',_0xbc01('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a02=['sequelize','exports','STRING','BOOLEAN','DATE','ENUM','out'];(function(_0x7ae0d1,_0x5ce7d8){var _0x5427f4=function(_0x570b4e){while(--_0x570b4e){_0x7ae0d1['push'](_0x7ae0d1['shift']());}};_0x5427f4(++_0x5ce7d8);}(_0x9a02,0x1a4));var _0x29a0=function(_0x22a6d3,_0x64b4){_0x22a6d3=_0x22a6d3-0x0;var _0x586afe=_0x9a02[_0x22a6d3];return _0x586afe;};'use strict';var Sequelize=require(_0x29a0('0x0'));var iconv=require('iconv');module[_0x29a0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x29a0('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x29a0('0x2')]},'note':{'type':Sequelize[_0x29a0('0x2')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x29a0('0x2')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x29a0('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x29a0('0x4')]},'substatus':{'type':Sequelize[_0x29a0('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x29a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x29a0('0x5')]('in',_0x29a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x29a0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x29a0('0x5')]('in',_0x29a0('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x29a0('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e0a947a..dbad0ab 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 _0x53ec=['u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','MailAccountId','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','getFullTextValue','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)','DESC','t.id\x20IN\x20?','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.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.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','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','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','keys','include','body','describe','addMessage','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','inlineCss','true','addTags','setTags','ids','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','Users','map','fullname','TagIds','forEach','push','MailMessage','findOne','plainBody','-id','trimStart','catch','waiting','talking','unmanaged','closed','UserId','answered','index','MailInteraction','rawAttributes','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users'];(function(_0x4b7bb7,_0x39f014){var _0x19a88e=function(_0x53acc9){while(--_0x53acc9){_0x4b7bb7['push'](_0x4b7bb7['shift']());}};_0x19a88e(++_0x39f014);}(_0x53ec,0x192));var _0xc53e=function(_0x17e75e,_0x24753e){_0x17e75e=_0x17e75e-0x0;var _0x25f451=_0x53ec[_0x17e75e];return _0x25f451;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var moment=require(_0xc53e('0x3'));var BPromise=require(_0xc53e('0x4'));var util=require(_0xc53e('0x5'));var path=require('path');var fs=require('fs');var _=require(_0xc53e('0x6'));var squel=require('squel');var juice=require(_0xc53e('0x7'));var Redis=require(_0xc53e('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0xc53e('0x9'));var logger=require('../../config/logger')(_0xc53e('0xa'));var config=require(_0xc53e('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc53e('0xc'));config[_0xc53e('0xd')]=_[_0xc53e('0xe')](config[_0xc53e('0xd')],{'host':_0xc53e('0xf'),'port':0x18eb});var socket=require(_0xc53e('0x10'))(new Redis(config[_0xc53e('0xd')]));require(_0xc53e('0x11'))[_0xc53e('0x12')](socket);function respondWithStatusCode(_0x4b7cfa,_0x57e818){_0x57e818=_0x57e818||0xcc;return function(_0x35128a){if(_0x35128a){return _0x4b7cfa['sendStatus'](_0x57e818);}return _0x4b7cfa['status'](_0x57e818)[_0xc53e('0x13')]();};}function respondWithResult(_0x9ffbcb,_0x863fa){_0x863fa=_0x863fa||0xc8;return function(_0x4203aa){if(_0x4203aa){return _0x9ffbcb['status'](_0x863fa)['json'](_0x4203aa);}};}function respondWithFilteredResult(_0x1c06cd,_0x19a772){return function(_0x7cd798){if(_0x7cd798){var _0x3d2e17=typeof _0x19a772[_0xc53e('0x14')]===_0xc53e('0x15')&&typeof _0x19a772[_0xc53e('0x16')]===_0xc53e('0x15');var _0x455e4d=_0x7cd798[_0xc53e('0x17')];var _0x5b0a88=_0x3d2e17?0x0:_0x19a772[_0xc53e('0x14')];var _0x191567=_0x3d2e17?_0x7cd798[_0xc53e('0x17')]:_0x19a772[_0xc53e('0x14')]+_0x19a772[_0xc53e('0x16')];var _0x270c78;if(_0x191567>=_0x455e4d){_0x191567=_0x455e4d;_0x270c78=0xc8;}else{_0x270c78=0xce;}_0x1c06cd[_0xc53e('0x18')](_0x270c78);return _0x1c06cd[_0xc53e('0x19')](_0xc53e('0x1a'),_0x5b0a88+'-'+_0x191567+'/'+_0x455e4d)['json'](_0x7cd798);}return null;};}function saveUpdates(_0x546fab){return function(_0x35b7b2){if(_0x35b7b2){return _0x35b7b2[_0xc53e('0x1b')](_0x546fab)[_0xc53e('0x1c')](function(_0x2e85df){return _0x2e85df;});}return null;};}function removeEntity(_0x20066e){return function(_0x2cfe2b){if(_0x2cfe2b){return _0x2cfe2b[_0xc53e('0x1d')]()[_0xc53e('0x1c')](function(){_0x20066e[_0xc53e('0x18')](0xcc)[_0xc53e('0x13')]();});}};}function handleEntityNotFound(_0x17d825){return function(_0x44fd93){if(!_0x44fd93){_0x17d825[_0xc53e('0x1e')](0x194);}return _0x44fd93;};}function handleError(_0x4fb695,_0x47cfdd){_0x47cfdd=_0x47cfdd||0x1f4;return function(_0x531ede){logger[_0xc53e('0x1f')](_0x531ede[_0xc53e('0x20')]);if(_0x531ede[_0xc53e('0x21')]){delete _0x531ede[_0xc53e('0x21')];}_0x4fb695[_0xc53e('0x18')](_0x47cfdd)['send'](_0x531ede);};}function getInteractionUsers(_0x5e5377,_0xe06e42){return new BPromise(function(_0x496167,_0x1ae55e){try{if(_0xe06e42[_0x5e5377['id']]){_0x5e5377[_0xc53e('0x22')]=_[_0xc53e('0x23')](_0xe06e42[_0x5e5377['id']],function(_0x1166e6){return{'id':_0x1166e6['id'],'fullname':_0x1166e6[_0xc53e('0x24')]};});}}catch(_0x4df8cf){_0x1ae55e(_0x4df8cf);}_0x496167(_0x5e5377);});}function getInteractionTags(_0x398e7a,_0x4b9f6a){return new BPromise(function(_0x4d9a68,_0x5c65d3){try{if(_0x398e7a[_0xc53e('0x25')]){_0x398e7a['Tags']=[];_0x398e7a[_0xc53e('0x25')]['split'](',')[_0xc53e('0x26')](function(_0x5112d2){_0x398e7a['Tags'][_0xc53e('0x27')](_0x4b9f6a[_0x5112d2]);});}delete _0x398e7a[_0xc53e('0x25')];}catch(_0x42dec1){_0x5c65d3(_0x42dec1);}_0x4d9a68(_0x398e7a);});}function getLastMessageText(_0x2fa20b){return new BPromise(function(_0x6415f6,_0xf97d78){return db[_0xc53e('0x28')][_0xc53e('0x29')]({'where':{'$and':[{'MailInteractionId':_0x2fa20b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc53e('0x2a')],'order':_0xc53e('0x2b'),'raw':!![]})[_0xc53e('0x1c')](function(_0x56206b){if(_0x56206b&&_0x56206b[_0xc53e('0x2a')]){_0x2fa20b['lastMsgText']=_[_0xc53e('0x2c')](_0x56206b[_0xc53e('0x2a')]);}_0x6415f6(_0x2fa20b);})['catch'](function(_0x5a64e2){_0xf97d78(_0x5a64e2);});});}function updateMailInteraction(_0x3cd8a1,_0x42efad,_0x3f4547,_0x30d037){return new BPromise(function(_0x1b95c2,_0x45fedc){return getInteractionUsers(_0x3cd8a1,_0x3f4547)[_0xc53e('0x1c')](function(_0x168d25){return getInteractionTags(_0x168d25,_0x42efad);})['then'](function(_0x24e9e5){return getStateInteraction(_0x24e9e5);})[_0xc53e('0x1c')](function(_0x19020b){if(_0x30d037){_0x1b95c2(getLastMessageText(_0x19020b));}else{_0x1b95c2(_0x19020b);}})[_0xc53e('0x2d')](function(_0x1eca5b){_0x45fedc(_0x1eca5b);});});}function getStateInteraction(_0x12b32c){return new BPromise(function(_0x1920c8){_0x12b32c[_0xc53e('0x2e')]=0x0;_0x12b32c[_0xc53e('0x2f')]=0x0;_0x12b32c['answered']=0x0;_0x12b32c[_0xc53e('0x30')]=0x0;_0x12b32c['total']=0x0;if(!_0x12b32c[_0xc53e('0x31')]&&!_0x12b32c[_0xc53e('0x32')]){_0x12b32c['waiting']+=0x1;}if(!_0x12b32c[_0xc53e('0x31')]&&_0x12b32c[_0xc53e('0x32')]){_0x12b32c[_0xc53e('0x2f')]+=0x1;if(_0x12b32c['waiting']){_0x12b32c[_0xc53e('0x2e')]-=0x1;}}if(_0x12b32c[_0xc53e('0x31')]&&_0x12b32c[_0xc53e('0x32')]){_0x12b32c[_0xc53e('0x33')]+=0x1;if(_0x12b32c[_0xc53e('0x2f')]){_0x12b32c[_0xc53e('0x2f')]-=0x1;}}if(_0x12b32c[_0xc53e('0x31')]&&!_0x12b32c['UserId']){_0x12b32c[_0xc53e('0x30')]+=0x1;if(_0x12b32c[_0xc53e('0x2e')]){_0x12b32c[_0xc53e('0x2e')]-=0x1;}}_0x12b32c['total']+=0x1;_0x1920c8(_0x12b32c);});}exports[_0xc53e('0x34')]=function(_0x5e8ab7,_0xaa00cd){var _0x15052d={},_0x40c4f5={},_0xad1232={'count':0x0,'rows':[]};var _0x3036e7=_['map'](db[_0xc53e('0x35')][_0xc53e('0x36')],function(_0x4a5529){return{'name':_0x4a5529['fieldName'],'type':_0x4a5529['type']['key']};});_0x40c4f5[_0xc53e('0x37')]=_[_0xc53e('0x23')](_0x3036e7,'name');_0x40c4f5[_0xc53e('0x38')]=_['keys'](_0x5e8ab7['query']);_0x40c4f5['filters']=_[_0xc53e('0x39')](_0x40c4f5['model'],_0x40c4f5['query']);_0x15052d[_0xc53e('0x3a')]=_['intersection'](_0x40c4f5[_0xc53e('0x37')],qs[_0xc53e('0x3b')](_0x5e8ab7['query'][_0xc53e('0x3b')]));_0x15052d[_0xc53e('0x3a')]=_0x15052d['attributes'][_0xc53e('0x3c')]?_0x15052d['attributes']:_0x40c4f5['model'];if(!_0x5e8ab7['query']['hasOwnProperty'](_0xc53e('0x3d'))){_0x15052d[_0xc53e('0x16')]=qs[_0xc53e('0x16')](_0x5e8ab7['query'][_0xc53e('0x16')]);_0x15052d[_0xc53e('0x14')]=qs['offset'](_0x5e8ab7['query'][_0xc53e('0x14')]);}_0x15052d[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x5e8ab7['query'][_0xc53e('0x3f')]);_0x15052d[_0xc53e('0x40')]=qs[_0xc53e('0x41')](_[_0xc53e('0x42')](_0x5e8ab7[_0xc53e('0x38')],_0x40c4f5[_0xc53e('0x41')]),_0x3036e7);var _0x372ce6=[];var _0x49b2e8=squel[_0xc53e('0x43')]()[_0xc53e('0x44')]('id')[_0xc53e('0x44')]('name')[_0xc53e('0x44')](_0xc53e('0x45'))[_0xc53e('0x46')](_0xc53e('0x47'));var _0xa7d256=squel[_0xc53e('0x43')]()['field'](_0xc53e('0x48'))[_0xc53e('0x44')](_0xc53e('0x49'))['field'](_0xc53e('0x4a'))[_0xc53e('0x46')](_0xc53e('0x4b'),'ui')[_0xc53e('0x4c')](_0xc53e('0x4d'),'u',_0xc53e('0x4e'));var _0x1a5a8f=squel[_0xc53e('0x43')]()[_0xc53e('0x46')](_0xc53e('0x4f'),'i')['left_join'](_0xc53e('0x50'),'c',_0xc53e('0x51'))[_0xc53e('0x4c')](_0xc53e('0x4d'),'o',_0xc53e('0x52'))['left_join']('mail_accounts','a',_0xc53e('0x53'))['left_join'](_0xc53e('0x54'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc53e('0x4c')](_0xc53e('0x55'),'it',_0xc53e('0x56'))['left_join'](_0xc53e('0x47'),'t',_0xc53e('0x57'));var _0x395913=squel['expr']();var _0x2f7df2=[];var _0x501f0a=squel[_0xc53e('0x58')]();var _0x3f1ca5;if(_0x5e8ab7['query'][_0xc53e('0x59')]){_0x3f1ca5=as[_0xc53e('0x5a')](_0x5e8ab7['query'][_0xc53e('0x59')]);var _0x36d321=_0x3f1ca5[_0xc53e('0x5b')];for(var _0x1ff92d=0x0;_0x1ff92d<_0x3f1ca5[_0xc53e('0x5c')][_0xc53e('0x3c')];_0x1ff92d++){var _0x27b6d4=_0x3f1ca5[_0xc53e('0x5c')][_0x1ff92d];var _0x8e5630='i';var _0x219ed4=_[_0xc53e('0x5d')](_0x3036e7,['name',_0x27b6d4[_0xc53e('0x44')]]);if(!_0x219ed4){switch(_0x27b6d4['field']){case _0xc53e('0x5e'):if(_0x27b6d4['value']==0x1){_0x1a5a8f[_0xc53e('0x5f')]('`'+_0x27b6d4[_0xc53e('0x44')]+'`\x20=\x200');}else{_0x1a5a8f[_0xc53e('0x5f')]('`'+_0x27b6d4[_0xc53e('0x44')]+_0xc53e('0x60'));}break;case _0xc53e('0x61'):if(_0x27b6d4['operator']===_0xc53e('0x62')){if(_0x27b6d4[_0xc53e('0x63')]['split']('\x20')['length']>0x1){_0x395913[_0x36d321](_0xc53e('0x64'),qs['getFullTextValue'](_0x27b6d4['value']),null);}else{var _0x57c822='%'+_0x27b6d4[_0xc53e('0x63')]+'%';_0x395913[_0x36d321]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x57c822,_0x57c822,_0x57c822);}}else{_0x219ed4=_[_0xc53e('0x5d')](_0x3036e7,['name',_0xc53e('0x65')]);_0x27b6d4[_0xc53e('0x44')]=_0xc53e('0x65');_0x40c8ba=as[_0xc53e('0x66')](_0x8e5630,_0x219ed4[_0xc53e('0x67')],_0x27b6d4);_0x395913[_0x36d321](_0x40c8ba['text'],_0x40c8ba['value'][_0xc53e('0x68')],_0x40c8ba[_0xc53e('0x63')][_0xc53e('0x13')]);}break;case _0xc53e('0x69'):var _0x11278d=_0x27b6d4[_0xc53e('0x63')][_0xc53e('0x6a')](',')[_0xc53e('0x23')](function(_0x13bf71){return Number(_0x13bf71);});_0x11278d[_0xc53e('0x26')](function(_0x30333b){_0x501f0a['or'](_0xc53e('0x6b'),'%,'+_0x30333b+',%');});_0x2f7df2=_[_0xc53e('0x6c')](_0x2f7df2,_0x11278d);break;case'User':if(_0x27b6d4[_0xc53e('0x6d')]==='$substring'){_0x395913[_0x36d321](_0xc53e('0x6e'),'%'+_0x27b6d4[_0xc53e('0x63')]+'%',null);}else{_0x219ed4=_[_0xc53e('0x5d')](_0x3036e7,[_0xc53e('0x21'),_0xc53e('0x32')]);_0x27b6d4[_0xc53e('0x44')]=_0xc53e('0x32');_0x40c8ba=as[_0xc53e('0x66')](_0x8e5630,_0x219ed4['type'],_0x27b6d4);_0x395913[_0x36d321](_0x40c8ba['text'],_0x40c8ba['value'][_0xc53e('0x68')],_0x40c8ba[_0xc53e('0x63')][_0xc53e('0x13')]);}break;case _0xc53e('0x2a'):_0x40c8ba=as[_0xc53e('0x66')]('me',null,_0x27b6d4);_0x395913[_0x36d321](_0x40c8ba[_0xc53e('0x6f')],_0x40c8ba[_0xc53e('0x63')]['start'],_0x40c8ba['value']['end']);break;}}else{var _0x40c8ba=as[_0xc53e('0x66')](_0x8e5630,_0x219ed4['type'],_0x27b6d4);_0x395913[_0x36d321](_0x40c8ba[_0xc53e('0x6f')],_0x40c8ba[_0xc53e('0x63')][_0xc53e('0x68')],_0x40c8ba[_0xc53e('0x63')][_0xc53e('0x13')]);}}}else{var _0x20cb31=_(_0x5e8ab7['query'])['keys']()[_0xc53e('0x23')](function(_0xb7391){return _[_0xc53e('0x70')](_0x3036e7,[_0xc53e('0x21'),_0xb7391])?_0xb7391:undefined;})[_0xc53e('0x71')]()[_0xc53e('0x63')]();if(!_['isEmpty'](_0x20cb31)){_0x20cb31[_0xc53e('0x26')](function(_0x15f6cb){if(_0x15f6cb===_0xc53e('0x72')){_0x1a5a8f[_0xc53e('0x40')]('i.MailAccountId\x20IN\x20?',[][_0xc53e('0x73')](_0x5e8ab7[_0xc53e('0x38')][_0x15f6cb]));}else if(_0x15f6cb===_0xc53e('0x74')){var _0x22f311=JSON[_0xc53e('0x75')](_0x5e8ab7[_0xc53e('0x38')][_0x15f6cb])['$gte'];var _0x1020a0=JSON[_0xc53e('0x75')](_0x5e8ab7[_0xc53e('0x38')][_0x15f6cb])[_0xc53e('0x76')];_0x1a5a8f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x22f311,_0x1020a0);}else{if(_0x5e8ab7[_0xc53e('0x38')][_0x15f6cb]===_0xc53e('0x77')){_0x1a5a8f[_0xc53e('0x40')]('i.'+_0x15f6cb+_0xc53e('0x78'));}else{_0x1a5a8f['where']('i.'+_0x15f6cb+_0xc53e('0x79'),_0x5e8ab7['query'][_0x15f6cb]);}}});}if(_0x5e8ab7[_0xc53e('0x38')]['read']){if(_0x5e8ab7[_0xc53e('0x38')]['read']==0x1){_0x1a5a8f[_0xc53e('0x5f')](_0xc53e('0x7a'));}else{_0x1a5a8f['having'](_0xc53e('0x7b'));}}if(_0x5e8ab7[_0xc53e('0x38')]['tag']){_0x2f7df2=_['isArray'](_0x5e8ab7[_0xc53e('0x38')][_0xc53e('0x7c')])?_0x5e8ab7['query']['tag']:new Array(_0x5e8ab7[_0xc53e('0x38')]['tag']);_0x2f7df2[_0xc53e('0x26')](function(_0x5bfdbb){_0x501f0a['or'](_0xc53e('0x6b'),'%,'+_0x5bfdbb+',%');});}if(_0x5e8ab7[_0xc53e('0x38')][_0xc53e('0x7d')]){var _0x388874=_0x5e8ab7[_0xc53e('0x38')][_0xc53e('0x7d')][_0xc53e('0x7e')]('\x5c','\x5c\x5c')[_0xc53e('0x7e')](/'/g,'\x27\x27');if(qs[_0xc53e('0x7f')](_0x388874)){_0x395913['or'](_0xc53e('0x80'),_0x388874+'%');}else if(qs['isEmail'](_0x388874)){_0x395913['or'](_0xc53e('0x81'),_0x388874+'%');}else{_0x395913['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc53e('0x82')](_0x388874))['or'](_0xc53e('0x83'),qs[_0xc53e('0x82')](_0x388874));}}}_0x1a5a8f[_0xc53e('0x40')](_0x395913);_0x1a5a8f[_0xc53e('0x84')](_0xc53e('0x85'));var _0x1e3499={'type':db[_0xc53e('0x86')][_0xc53e('0x87')][_0xc53e('0x88')],'raw':!![]};var _0x5deb38=_0x1a5a8f[_0xc53e('0x89')]();_0x5deb38['field'](_0xc53e('0x85'));_0x5deb38[_0xc53e('0x44')](_0xc53e('0x8a'),'unreadMessages');if(_0x15052d[_0xc53e('0x3e')]){_0x15052d[_0xc53e('0x3e')][_0xc53e('0x26')](function(_0xec3738){var _0x3a84a2=_0xec3738[0x0]==='contactName'?_0xec3738[0x0]:'i.'+_0xec3738[0x0];_0x1a5a8f[_0xc53e('0x3e')](_0x3a84a2,_0xec3738[0x1]===_0xc53e('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x2f7df2)){_0x1a5a8f[_0xc53e('0x5f')](_0x501f0a);_0x5deb38[_0xc53e('0x40')](_0xc53e('0x8c'),_0x2f7df2);}BPromise['resolve']()[_0xc53e('0x1c')](function(){if(!_0x3f1ca5){if(_0x5e8ab7[_0xc53e('0x38')]['MailAccountId'])return;_0x5deb38[_0xc53e('0x40')](_0xc53e('0x8d'));_0x1a5a8f['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5e8ab7[_0xc53e('0x8e')]['role']!==_0xc53e('0x8f'))return;return _0x5e8ab7[_0xc53e('0x8e')][_0xc53e('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0xea93fa){if(_[_0xc53e('0x91')](_0xea93fa)){_0x5deb38[_0xc53e('0x40')]('i.MailAccountId\x20IS\x20NULL');_0x1a5a8f[_0xc53e('0x40')](_0xc53e('0x92'));}else{_0x5deb38[_0xc53e('0x40')](_0xc53e('0x93'),_[_0xc53e('0x23')](_0xea93fa,'id'));_0x1a5a8f['where'](_0xc53e('0x93'),_[_0xc53e('0x23')](_0xea93fa,'id'));}});})[_0xc53e('0x1c')](function(){if(_0x5e8ab7[_0xc53e('0x8e')][_0xc53e('0x94')]===_0xc53e('0x8f')&&!_0x3f1ca5&&!_0x5e8ab7[_0xc53e('0x38')][_0xc53e('0x72')])return[];return db[_0xc53e('0x95')]['query'](_0x5deb38[_0xc53e('0x96')](),_0x1e3499);})[_0xc53e('0x1c')](function(_0x1c06bc){_0xad1232[_0xc53e('0x17')]=_0x1c06bc[_0xc53e('0x3c')];if(_0xad1232[_0xc53e('0x17')]===0x0)return[];return db[_0xc53e('0x95')][_0xc53e('0x38')](_0x49b2e8[_0xc53e('0x96')](),_0x1e3499)['then'](function(_0x3a54ef){_0x372ce6=_[_0xc53e('0x97')](_0x3a54ef,'id');_0x1e3499=_[_0xc53e('0x98')](_0x1e3499,{'model':db[_0xc53e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e8ab7['query'][_0xc53e('0x3b')]){_0x15052d[_0xc53e('0x3a')][_0xc53e('0x26')](function(_0x92c9bc){_0x1a5a8f['field']('i.'+_0x92c9bc);});}else{_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0x8a'),_0xc53e('0x5e'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0x99'),_0xc53e('0x9a'));_0x1a5a8f[_0xc53e('0x44')]('a.mandatoryDisposition',_0xc53e('0x9b'));_0x1a5a8f['field'](_0xc53e('0x9c'),_0xc53e('0x9d'));_0x1a5a8f[_0xc53e('0x44')]('i.id');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0x9e'));_0x1a5a8f[_0xc53e('0x44')]('i.updatedAt');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0x9f'));_0x1a5a8f[_0xc53e('0x44')]('i.closedAt');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa0'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa1'));_0x1a5a8f[_0xc53e('0x44')]('i.lastMsgDirection');_0x1a5a8f['field']('i.subject');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa2'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa3'));_0x1a5a8f['field'](_0xc53e('0xa4'));_0x1a5a8f['field'](_0xc53e('0xa5'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa6'));_0x1a5a8f[_0xc53e('0x44')]('i.ContactId');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa7'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa8'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xa9'),_0xc53e('0xaa'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xab'),_0xc53e('0xac'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xad'),_0xc53e('0xae'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xaf'),_0xc53e('0xb0'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xb1'),_0xc53e('0xb2'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xb3'),_0xc53e('0xb4'));_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xb5'),_0xc53e('0xb6'));_0x1a5a8f['field'](_0xc53e('0xb7'),'Owner.internal');_0x1a5a8f[_0xc53e('0x44')](_0xc53e('0xb8'),'TagIds');}if(_0x15052d[_0xc53e('0x16')])_0x1a5a8f[_0xc53e('0x16')](_0x15052d[_0xc53e('0x16')]);if(_0x15052d[_0xc53e('0x14')])_0x1a5a8f[_0xc53e('0x14')](_0x15052d[_0xc53e('0x14')]);return db[_0xc53e('0x95')][_0xc53e('0x38')](_0x1a5a8f[_0xc53e('0x96')](),_0x1e3499);})['then'](function(_0x37c8e6){if(_0x37c8e6['length']>0x0)_0xa7d256[_0xc53e('0x40')](_0xc53e('0xb9'),_[_0xc53e('0x23')](_0x37c8e6,'id'));return db[_0xc53e('0x95')][_0xc53e('0x38')](_0xa7d256[_0xc53e('0x96')](),_0x1e3499)[_0xc53e('0x1c')](function(_0x38dae0){var _0x42a005=_[_0xc53e('0xba')](_0x38dae0,_0xc53e('0xbb'));var _0xa5a39d=[];return db[_0xc53e('0xbc')]['findOne']({'attributes':[_0xc53e('0xbd')],'raw':!![]})['then'](function(_0x2f7842){var _0x251dea=_0x2f7842[_0xc53e('0xbd')];_0x37c8e6[_0xc53e('0x26')](function(_0x5a2a2f){_0xa5a39d['push'](updateMailInteraction(_0x5a2a2f,_0x372ce6,_0x42a005,_0x251dea));});return BPromise[_0xc53e('0xbe')](_0xa5a39d);});});});})[_0xc53e('0x1c')](function(_0x349308){_0xad1232[_0xc53e('0xbf')]=_0x349308;return _0xad1232;})['then'](respondWithFilteredResult(_0xaa00cd,_0x15052d))['catch'](handleError(_0xaa00cd,null));};exports[_0xc53e('0xc0')]=function(_0x162568,_0x5be038){var _0x3628c3={'raw':![],'where':{'id':_0x162568[_0xc53e('0xc1')]['id']}},_0x2faa4e={};_0x2faa4e['model']=_[_0xc53e('0xc2')](db[_0xc53e('0x35')][_0xc53e('0x36')]);_0x2faa4e[_0xc53e('0x38')]=_[_0xc53e('0xc2')](_0x162568['query']);_0x2faa4e[_0xc53e('0x41')]=_[_0xc53e('0x39')](_0x2faa4e[_0xc53e('0x37')],_0x2faa4e[_0xc53e('0x38')]);_0x3628c3[_0xc53e('0x3a')]=_[_0xc53e('0x39')](_0x2faa4e[_0xc53e('0x37')],qs[_0xc53e('0x3b')](_0x162568[_0xc53e('0x38')][_0xc53e('0x3b')]));_0x3628c3[_0xc53e('0x3a')]=_0x3628c3[_0xc53e('0x3a')][_0xc53e('0x3c')]?_0x3628c3['attributes']:_0x2faa4e[_0xc53e('0x37')];if(_0x162568[_0xc53e('0x38')]['includeAll']){_0x3628c3[_0xc53e('0xc3')]=[{'all':!![]}];}_0x3628c3=_['merge']({},_0x3628c3,_0x162568['options']);return db[_0xc53e('0x35')]['find'](_0x3628c3)[_0xc53e('0x1c')](handleEntityNotFound(_0x5be038,null))['then'](respondWithResult(_0x5be038,null))[_0xc53e('0x2d')](handleError(_0x5be038,null));};exports['create']=function(_0x457aac,_0x376d94){return db[_0xc53e('0x35')]['create'](_0x457aac[_0xc53e('0xc4')],{})['then'](respondWithResult(_0x376d94,0xc9))[_0xc53e('0x2d')](handleError(_0x376d94,null));};exports[_0xc53e('0x1b')]=function(_0x1c3cb2,_0x1fd95d){if(_0x1c3cb2[_0xc53e('0xc4')]['id']){delete _0x1c3cb2[_0xc53e('0xc4')]['id'];}return db[_0xc53e('0x35')][_0xc53e('0x5d')]({'where':{'id':_0x1c3cb2[_0xc53e('0xc1')]['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x1fd95d,null))['then'](saveUpdates(_0x1c3cb2['body'],null))[_0xc53e('0x1c')](respondWithResult(_0x1fd95d,null))['catch'](handleError(_0x1fd95d,null));};exports[_0xc53e('0x1d')]=function(_0xbc960,_0x14baae){return db[_0xc53e('0x35')][_0xc53e('0x5d')]({'where':{'id':_0xbc960[_0xc53e('0xc1')]['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x14baae,null))[_0xc53e('0x1c')](removeEntity(_0x14baae,null))['catch'](handleError(_0x14baae,null));};exports[_0xc53e('0xc5')]=function(_0x4e46bf,_0x34cb12){return db[_0xc53e('0x35')][_0xc53e('0xc5')]()[_0xc53e('0x1c')](respondWithResult(_0x34cb12,null))[_0xc53e('0x2d')](handleError(_0x34cb12,null));};exports[_0xc53e('0xc6')]=function(_0x227e0c,_0x4c0802){return db[_0xc53e('0x28')][_0xc53e('0x5d')]({'where':{'id':_0x227e0c[_0xc53e('0xc1')]['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x4c0802,null))[_0xc53e('0x1c')](function(_0x590fb6){if(_0x590fb6){return _0x590fb6[_0xc53e('0xc6')](_0x227e0c[_0xc53e('0xc4')]['ids'],_['omit'](_0x227e0c[_0xc53e('0xc4')],['ids','id'])||{});}})[_0xc53e('0x1c')](respondWithResult(_0x4c0802,null))[_0xc53e('0x2d')](handleError(_0x4c0802,null));};exports['getMessages']=function(_0x4dc196,_0x258eea){var _0x4e23d8={'raw':![],'where':{}};var _0x204208={};var _0x4d43e1={'count':0x0,'rows':[]};return db[_0xc53e('0x35')][_0xc53e('0x29')]({'where':{'id':_0x4dc196[_0xc53e('0xc1')]['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x258eea,null))[_0xc53e('0x1c')](function(_0x49bbc9){if(_0x49bbc9){_0x204208[_0xc53e('0x37')]=_['keys'](db['MailMessage'][_0xc53e('0x36')]);_0x204208[_0xc53e('0x38')]=_[_0xc53e('0xc2')](_0x4dc196[_0xc53e('0x38')]);_0x204208[_0xc53e('0x41')]=_[_0xc53e('0x39')](_0x204208[_0xc53e('0x37')],_0x204208[_0xc53e('0x38')]);_0x4e23d8[_0xc53e('0x3a')]=_[_0xc53e('0x39')](_0x204208[_0xc53e('0x37')],qs[_0xc53e('0x3b')](_0x4dc196['query'][_0xc53e('0x3b')]));_0x4e23d8[_0xc53e('0x3a')]=_0x4e23d8[_0xc53e('0x3a')][_0xc53e('0x3c')]?_0x4e23d8[_0xc53e('0x3a')]:_0x204208['model'];if(!_0x4dc196['query'][_0xc53e('0xc7')](_0xc53e('0x3d'))){_0x4e23d8[_0xc53e('0x16')]=qs[_0xc53e('0x16')](_0x4dc196[_0xc53e('0x38')][_0xc53e('0x16')]);_0x4e23d8[_0xc53e('0x14')]=qs[_0xc53e('0x14')](_0x4dc196[_0xc53e('0x38')][_0xc53e('0x14')]);}_0x4e23d8[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x4dc196[_0xc53e('0x38')]['sort']);_0x4e23d8[_0xc53e('0x40')]=qs[_0xc53e('0x41')](_['pick'](_0x4dc196[_0xc53e('0x38')],_0x204208[_0xc53e('0x41')]));_0x4e23d8[_0xc53e('0x40')]['MailInteractionId']=_0x49bbc9['id'];if(_0x4dc196['query'][_0xc53e('0x7d')]){_0x4e23d8[_0xc53e('0x40')]=_[_0xc53e('0x98')](_0x4e23d8[_0xc53e('0x40')],{'$or':_['map'](_0x4e23d8[_0xc53e('0x3a')],function(_0x8be8f5){var _0xbcbbc5={};_0xbcbbc5[_0x8be8f5]={'$like':'%'+_0x4dc196['query']['filter']+'%'};return _0xbcbbc5;})});}if(_0x4dc196[_0xc53e('0x38')][_0xc53e('0xc8')]){var _0x186a02=_0x4dc196['query'][_0xc53e('0xc8')][_0xc53e('0x6a')](',');var _0x4ae803={};_0x4ae803[_0x186a02[0x0]]={'$gte':moment(_0x186a02[0x1])[_0xc53e('0xc9')](_0xc53e('0xca'))};_0x4e23d8[_0xc53e('0x40')]=_[_0xc53e('0x98')](_0x4e23d8[_0xc53e('0x40')],_0x4ae803);}_0x4e23d8=_['merge']({},_0x4e23d8,_0x4dc196[_0xc53e('0xcb')]);return db[_0xc53e('0x28')][_0xc53e('0x17')]({'where':_0x4e23d8['where']})['then'](function(_0x10f044){_0x4d43e1[_0xc53e('0x17')]=_0x10f044;if(_0x4dc196[_0xc53e('0x38')][_0xc53e('0xcc')]){_0x4e23d8[_0xc53e('0xc3')]=[{'all':!![]}];}return db['MailMessage'][_0xc53e('0xcd')](_0x4e23d8);})['then'](function(_0x22ee61){if(_0x4dc196[_0xc53e('0x38')][_0xc53e('0xce')]===_0xc53e('0xcf')){for(var _0x3b6672=0x0;_0x3b6672<_0x22ee61[_0xc53e('0x3c')];_0x3b6672++){_0x22ee61[_0x3b6672][_0xc53e('0xc4')]=juice(_0x22ee61[_0x3b6672][_0xc53e('0xc4')]);}}_0x4d43e1[_0xc53e('0xbf')]=_0x22ee61;return _0x4d43e1;});}})['then'](respondWithFilteredResult(_0x258eea,_0x4e23d8))[_0xc53e('0x2d')](handleError(_0x258eea,null));};exports[_0xc53e('0xd0')]=function(_0x456563,_0x19957d){return db[_0xc53e('0x35')][_0xc53e('0x5d')]({'where':{'id':_0x456563['params']['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x19957d,null))[_0xc53e('0x1c')](function(_0x3db2cd){if(_0x3db2cd){return _0x3db2cd[_0xc53e('0xd1')](_0x456563[_0xc53e('0xc4')][_0xc53e('0xd2')],_[_0xc53e('0xd3')](_0x456563[_0xc53e('0xc4')],['ids','id'])||{})[_0xc53e('0xd4')](function(){return db['Tag'][_0xc53e('0xcd')]({'attributes':['id',_0xc53e('0x21'),_0xc53e('0x45')],'where':{'id':_0x456563[_0xc53e('0xc4')]['ids']}});})[_0xc53e('0x1c')](function(_0x266956){socket[_0xc53e('0xd5')](_0xc53e('0xd6'),{'id':Number(_0x456563[_0xc53e('0xc1')]['id']),'tags':_0x266956||[]});return{'id':Number(_0x456563[_0xc53e('0xc1')]['id']),'tags':_0x266956||[]};});}})[_0xc53e('0x1c')](respondWithResult(_0x19957d,null))[_0xc53e('0x2d')](handleError(_0x19957d,null));};exports[_0xc53e('0xd7')]=function(_0x14e64c,_0x1d6421){return db[_0xc53e('0x35')][_0xc53e('0x5d')]({'where':{'id':_0x14e64c[_0xc53e('0xc1')]['id']}})[_0xc53e('0x1c')](handleEntityNotFound(_0x1d6421,null))[_0xc53e('0x1c')](function(_0x2085b0){if(_0x2085b0){return _0x2085b0[_0xc53e('0xd7')](_0x14e64c['query']['ids']);}})[_0xc53e('0x1c')](respondWithStatusCode(_0x1d6421,null))[_0xc53e('0x2d')](handleError(_0x1d6421,null));};exports[_0xc53e('0xd8')]=function(_0x1d5e24,_0x1ee499){var _0x2767e3=moment()[_0xc53e('0xd9')]()[_0xc53e('0x96')]();var _0x3613d7=path[_0xc53e('0xda')](config[_0xc53e('0xdb')],'server',_0xc53e('0xdc'),'tmp');var _0x41b78c=path[_0xc53e('0xda')](config[_0xc53e('0xdb')],'server',_0xc53e('0xdc'),_0xc53e('0xdd'));var _0xbca6e4=path[_0xc53e('0xda')](_0x3613d7,_0x2767e3);var _0x121214=util[_0xc53e('0xc9')](_0xc53e('0xde'),_0x1d5e24['params']['id'],_0x2767e3);var _0x3a1978=path[_0xc53e('0xda')](_0x3613d7,_0x121214);var _0xaaf0c8=[];if(_0x1d5e24[_0xc53e('0x38')][_0xc53e('0xdd')]){_0xaaf0c8['push']({'model':db[_0xc53e('0xdf')],'as':_0xc53e('0xe0'),'raw':!![]});}var _0x53853a=[{'model':db[_0xc53e('0x28')],'as':_0xc53e('0xe1'),'attributes':['id','body',_0xc53e('0x46'),'to','cc',_0xc53e('0xe2'),_0xc53e('0xe3'),_0xc53e('0x74')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0xaaf0c8}];return db[_0xc53e('0x35')][_0xc53e('0x5d')]({'where':{'id':_0x1d5e24['params']['id']},'include':_0x53853a})[_0xc53e('0x1c')](handleEntityNotFound(_0x1ee499,null))[_0xc53e('0x1c')](function(_0x503976){if(_0x503976&&_0x503976[_0xc53e('0xe1')]){var _0x41e169=_0x503976[_0xc53e('0xe4')]({'plain':!![]});fs[_0xc53e('0xe5')](_0xbca6e4);return BPromise[_0xc53e('0xe6')](_0x41e169[_0xc53e('0xe1')],function(_0x1535bd,_0xb94a71){var _0xbcbe2e={'from':_0x1535bd['from'],'to':_0x1535bd['to'],'subject':_0x1535bd[_0xc53e('0xe3')],'html':htmlEntities[_0xc53e('0xe7')](_0x1535bd[_0xc53e('0xc4')]),'headers':{'Date':moment(_0x1535bd['createdAt'])[_0xc53e('0xc9')](_0xc53e('0xe8'))},'attachments':[]};if(_0x1535bd['cc']){_0xbcbe2e['headers']['Cc']=_0x1535bd['cc'];}if(_0x1535bd[_0xc53e('0xe2')]){_0xbcbe2e[_0xc53e('0xe9')][_0xc53e('0xea')]=_0x1535bd[_0xc53e('0xe2')];}return new BPromise(function(_0x19c9f0,_0x258b57){if(_0x1535bd['Attachments']){for(var _0x3b7fdc=0x0;_0x3b7fdc<_0x1535bd['Attachments']['length'];_0x3b7fdc++){var _0x109a05=_0x1535bd[_0xc53e('0xe0')][_0x3b7fdc];var _0x5672e2=path[_0xc53e('0xda')](_0x41b78c,_0x109a05['basename']);if(fs[_0xc53e('0xeb')](_0x5672e2)){_0xbcbe2e[_0xc53e('0xdd')]['push']({'name':_0x109a05[_0xc53e('0x21')],'contentType':_0x109a05[_0xc53e('0x67')],'data':fs['readFileSync'](_0x5672e2)});}}}emlformat[_0xc53e('0xec')](_0xbcbe2e,function(_0x3abb4e,_0x94f8d4){if(_0x3abb4e)return _0x258b57(_0x3abb4e);fs[_0xc53e('0xed')](path[_0xc53e('0xda')](_0xbca6e4,util[_0xc53e('0xc9')](_0xc53e('0xee'),_0xb94a71)),_0x94f8d4);return _0x19c9f0(_0x94f8d4);});});})[_0xc53e('0x1c')](function(){return new BPromise(function(_0x5c10ad,_0x5cae03){zipdir(_0xbca6e4,{'saveTo':_0x3a1978},function(_0x5ec237,_0x4a9220){if(_0x5ec237)return _0x5cae03(_0x5ec237);return _0x5c10ad(_0x4a9220);});})[_0xc53e('0x1c')](function(){return new BPromise(function(_0x3f2db3,_0x3580ee){rimraf(_0xbca6e4,function(_0x1f5769){if(_0x1f5769)_0x3580ee(_0x1f5769);return _0x3f2db3();});});})['then'](function(){return _0x1ee499[_0xc53e('0xd8')](_0x3a1978,_0x121214,function(_0x3dd6b0){if(!_0x3dd6b0)fs[_0xc53e('0xef')](_0x3a1978);});});});}else{return _0x1ee499[_0xc53e('0x1e')](0xc8);}})['catch'](handleError(_0x1ee499,null));}; \ No newline at end of file +var _0x6b1b=['unix','join','root','files','tmp','transcript-%d-%s.zip','attachments','Attachment','bcc','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','sendStatus','rimraf','zip-dir','moment','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','html-entities','redis','socket.io-emitter','status','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','split','push','MailMessage','out','plainBody','-id','trimStart','catch','waiting','talking','answered','UserId','closed','unmanaged','total','index','map','MailInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','tools_tags','select','u.fullname','ui.MailInteractionId','from','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','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','forEach','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','end','some','compact','isEmpty','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','findOne','enableEmailPreview','all','rows','params','include','options','create','body','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','true','addTags','setTags','spread','removeTags','download'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x6b1b[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6b1('0x0'));var zipdir=require(_0xb6b1('0x1'));var moment=require(_0xb6b1('0x2'));var BPromise=require('bluebird');var util=require(_0xb6b1('0x3'));var path=require(_0xb6b1('0x4'));var fs=require('fs');var _=require(_0xb6b1('0x5'));var squel=require(_0xb6b1('0x6'));var juice=require(_0xb6b1('0x7'));var Redis=require(_0xb6b1('0x8'));var qs=require(_0xb6b1('0x9'));var as=require(_0xb6b1('0xa'));var logger=require(_0xb6b1('0xb'))(_0xb6b1('0xc'));var config=require(_0xb6b1('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xb6b1('0xe'));config['redis']=_['defaults'](config[_0xb6b1('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6b1('0x10'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x593218,_0x1f8f10){_0x1f8f10=_0x1f8f10||0xcc;return function(_0x1cec84){if(_0x1cec84){return _0x593218['sendStatus'](_0x1f8f10);}return _0x593218[_0xb6b1('0x11')](_0x1f8f10)['end']();};}function respondWithResult(_0x5c5837,_0x406dce){_0x406dce=_0x406dce||0xc8;return function(_0x2e5256){if(_0x2e5256){return _0x5c5837[_0xb6b1('0x11')](_0x406dce)[_0xb6b1('0x12')](_0x2e5256);}};}function respondWithFilteredResult(_0x23881d,_0x18f6b5){return function(_0x360fc7){if(_0x360fc7){var _0x429d0d=typeof _0x18f6b5[_0xb6b1('0x13')]===_0xb6b1('0x14')&&typeof _0x18f6b5[_0xb6b1('0x15')]===_0xb6b1('0x14');var _0x4f770a=_0x360fc7['count'];var _0x513207=_0x429d0d?0x0:_0x18f6b5['offset'];var _0xee229d=_0x429d0d?_0x360fc7[_0xb6b1('0x16')]:_0x18f6b5[_0xb6b1('0x13')]+_0x18f6b5[_0xb6b1('0x15')];var _0x32e395;if(_0xee229d>=_0x4f770a){_0xee229d=_0x4f770a;_0x32e395=0xc8;}else{_0x32e395=0xce;}_0x23881d[_0xb6b1('0x11')](_0x32e395);return _0x23881d['set']('Content-Range',_0x513207+'-'+_0xee229d+'/'+_0x4f770a)[_0xb6b1('0x12')](_0x360fc7);}return null;};}function saveUpdates(_0x15456d){return function(_0x16d969){if(_0x16d969){return _0x16d969[_0xb6b1('0x17')](_0x15456d)[_0xb6b1('0x18')](function(_0x3fc9b1){return _0x3fc9b1;});}return null;};}function removeEntity(_0x5ba14d){return function(_0x4e132a){if(_0x4e132a){return _0x4e132a[_0xb6b1('0x19')]()[_0xb6b1('0x18')](function(){_0x5ba14d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc247a){return function(_0x5c8529){if(!_0x5c8529){_0xfc247a['sendStatus'](0x194);}return _0x5c8529;};}function handleError(_0x232157,_0x2086ea){_0x2086ea=_0x2086ea||0x1f4;return function(_0x36ac63){logger[_0xb6b1('0x1a')](_0x36ac63[_0xb6b1('0x1b')]);if(_0x36ac63[_0xb6b1('0x1c')]){delete _0x36ac63[_0xb6b1('0x1c')];}_0x232157[_0xb6b1('0x11')](_0x2086ea)[_0xb6b1('0x1d')](_0x36ac63);};}function getInteractionUsers(_0x20066f,_0x5069cd){return new BPromise(function(_0x214cd0,_0x4f1e2e){try{if(_0x5069cd[_0x20066f['id']]){_0x20066f[_0xb6b1('0x1e')]=_['map'](_0x5069cd[_0x20066f['id']],function(_0xdbcb77){return{'id':_0xdbcb77['id'],'fullname':_0xdbcb77['fullname']};});}}catch(_0x35a567){_0x4f1e2e(_0x35a567);}_0x214cd0(_0x20066f);});}function getInteractionTags(_0x387603,_0xac4256){return new BPromise(function(_0x178401,_0x13e841){try{if(_0x387603[_0xb6b1('0x1f')]){_0x387603[_0xb6b1('0x20')]=[];_0x387603[_0xb6b1('0x1f')][_0xb6b1('0x21')](',')['forEach'](function(_0xf40426){_0x387603['Tags'][_0xb6b1('0x22')](_0xac4256[_0xf40426]);});}delete _0x387603[_0xb6b1('0x1f')];}catch(_0x367d66){_0x13e841(_0x367d66);}_0x178401(_0x387603);});}function getLastMessageText(_0x3f8849){return new BPromise(function(_0x136fe5,_0x12f369){return db[_0xb6b1('0x23')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3f8849['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb6b1('0x24')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb6b1('0x25')],'order':_0xb6b1('0x26'),'raw':!![]})['then'](function(_0x22beb9){if(_0x22beb9&&_0x22beb9[_0xb6b1('0x25')]){_0x3f8849['lastMsgText']=_[_0xb6b1('0x27')](_0x22beb9[_0xb6b1('0x25')]);}_0x136fe5(_0x3f8849);})[_0xb6b1('0x28')](function(_0x21bfac){_0x12f369(_0x21bfac);});});}function updateMailInteraction(_0x3ead6b,_0x326c5f,_0x4d29e4,_0x3cca75){return new BPromise(function(_0xff1d43,_0x4abe40){return getInteractionUsers(_0x3ead6b,_0x4d29e4)[_0xb6b1('0x18')](function(_0x4e11a1){return getInteractionTags(_0x4e11a1,_0x326c5f);})[_0xb6b1('0x18')](function(_0x242ec3){return getStateInteraction(_0x242ec3);})[_0xb6b1('0x18')](function(_0x4cad81){if(_0x3cca75){_0xff1d43(getLastMessageText(_0x4cad81));}else{_0xff1d43(_0x4cad81);}})[_0xb6b1('0x28')](function(_0x2dd9e2){_0x4abe40(_0x2dd9e2);});});}function getStateInteraction(_0x59efdc){return new BPromise(function(_0x203d8e){_0x59efdc[_0xb6b1('0x29')]=0x0;_0x59efdc[_0xb6b1('0x2a')]=0x0;_0x59efdc[_0xb6b1('0x2b')]=0x0;_0x59efdc['unmanaged']=0x0;_0x59efdc['total']=0x0;if(!_0x59efdc['closed']&&!_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x29')]+=0x1;}if(!_0x59efdc[_0xb6b1('0x2d')]&&_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2a')]+=0x1;if(_0x59efdc[_0xb6b1('0x29')]){_0x59efdc[_0xb6b1('0x29')]-=0x1;}}if(_0x59efdc[_0xb6b1('0x2d')]&&_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2b')]+=0x1;if(_0x59efdc[_0xb6b1('0x2a')]){_0x59efdc[_0xb6b1('0x2a')]-=0x1;}}if(_0x59efdc['closed']&&!_0x59efdc[_0xb6b1('0x2c')]){_0x59efdc[_0xb6b1('0x2e')]+=0x1;if(_0x59efdc[_0xb6b1('0x29')]){_0x59efdc[_0xb6b1('0x29')]-=0x1;}}_0x59efdc[_0xb6b1('0x2f')]+=0x1;_0x203d8e(_0x59efdc);});}exports[_0xb6b1('0x30')]=function(_0xfe126,_0x3df192){var _0x33dc30={},_0x276801={},_0x44a61a={'count':0x0,'rows':[]};var _0x56470a=_[_0xb6b1('0x31')](db[_0xb6b1('0x32')][_0xb6b1('0x33')],function(_0x2d6b2b){return{'name':_0x2d6b2b[_0xb6b1('0x34')],'type':_0x2d6b2b[_0xb6b1('0x35')][_0xb6b1('0x36')]};});_0x276801[_0xb6b1('0x37')]=_['map'](_0x56470a,'name');_0x276801[_0xb6b1('0x38')]=_[_0xb6b1('0x39')](_0xfe126[_0xb6b1('0x38')]);_0x276801['filters']=_[_0xb6b1('0x3a')](_0x276801[_0xb6b1('0x37')],_0x276801[_0xb6b1('0x38')]);_0x33dc30[_0xb6b1('0x3b')]=_[_0xb6b1('0x3a')](_0x276801[_0xb6b1('0x37')],qs[_0xb6b1('0x3c')](_0xfe126[_0xb6b1('0x38')]['fields']));_0x33dc30[_0xb6b1('0x3b')]=_0x33dc30['attributes'][_0xb6b1('0x3d')]?_0x33dc30[_0xb6b1('0x3b')]:_0x276801[_0xb6b1('0x37')];if(!_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x3e')](_0xb6b1('0x3f'))){_0x33dc30['limit']=qs[_0xb6b1('0x15')](_0xfe126[_0xb6b1('0x38')]['limit']);_0x33dc30[_0xb6b1('0x13')]=qs['offset'](_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x13')]);}_0x33dc30[_0xb6b1('0x40')]=qs[_0xb6b1('0x41')](_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x41')]);_0x33dc30[_0xb6b1('0x42')]=qs[_0xb6b1('0x43')](_[_0xb6b1('0x44')](_0xfe126['query'],_0x276801['filters']),_0x56470a);var _0x3826bd=[];var _0x2c00fb=squel['select']()[_0xb6b1('0x45')]('id')[_0xb6b1('0x45')](_0xb6b1('0x1c'))[_0xb6b1('0x45')](_0xb6b1('0x46'))['from'](_0xb6b1('0x47'));var _0x1f4881=squel[_0xb6b1('0x48')]()[_0xb6b1('0x45')]('u.id')['field'](_0xb6b1('0x49'))['field'](_0xb6b1('0x4a'))[_0xb6b1('0x4b')]('user_has_mail_interactions','ui')[_0xb6b1('0x4c')]('users','u',_0xb6b1('0x4d'));var _0x7d4763=squel[_0xb6b1('0x48')]()[_0xb6b1('0x4b')](_0xb6b1('0x4e'),'i')[_0xb6b1('0x4c')](_0xb6b1('0x4f'),'c',_0xb6b1('0x50'))[_0xb6b1('0x4c')](_0xb6b1('0x51'),'o','o.id\x20=\x20i.UserId')[_0xb6b1('0x4c')](_0xb6b1('0x52'),'a',_0xb6b1('0x53'))[_0xb6b1('0x4c')](_0xb6b1('0x54'),'me',_0xb6b1('0x55'))[_0xb6b1('0x4c')](_0xb6b1('0x56'),'it',_0xb6b1('0x57'))['left_join'](_0xb6b1('0x47'),'t','t.id\x20=\x20it.TagId');var _0x5adb1c=squel[_0xb6b1('0x58')]();var _0x2123f5=[];var _0x5be7bf=squel[_0xb6b1('0x58')]();var _0x323231;if(_0xfe126[_0xb6b1('0x38')]['search']){_0x323231=as[_0xb6b1('0x59')](_0xfe126['query']['search']);var _0x239de5=_0x323231[_0xb6b1('0x5a')];for(var _0x49eaf4=0x0;_0x49eaf4<_0x323231['conditions']['length'];_0x49eaf4++){var _0x2e7af7=_0x323231['conditions'][_0x49eaf4];var _0x54c88f='i';var _0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0x2e7af7[_0xb6b1('0x45')]]);if(!_0x47e64e){switch(_0x2e7af7[_0xb6b1('0x45')]){case _0xb6b1('0x5c'):if(_0x2e7af7[_0xb6b1('0x5d')]==0x1){_0x7d4763['having']('`'+_0x2e7af7[_0xb6b1('0x45')]+_0xb6b1('0x5e'));}else{_0x7d4763['having']('`'+_0x2e7af7['field']+_0xb6b1('0x5f'));}break;case _0xb6b1('0x60'):if(_0x2e7af7['operator']==='$substring'){if(_0x2e7af7[_0xb6b1('0x5d')]['split']('\x20')[_0xb6b1('0x3d')]>0x1){_0x5adb1c[_0x239de5](_0xb6b1('0x61'),qs['getFullTextValue'](_0x2e7af7[_0xb6b1('0x5d')]),null);}else{var _0x30f8e5='%'+_0x2e7af7[_0xb6b1('0x5d')]+'%';_0x5adb1c[_0x239de5](_0xb6b1('0x62'),_0x30f8e5,_0x30f8e5,_0x30f8e5);}}else{_0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0xb6b1('0x63')]);_0x2e7af7[_0xb6b1('0x45')]=_0xb6b1('0x63');_0x55f565=as[_0xb6b1('0x64')](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')]['end']);}break;case _0xb6b1('0x67'):var _0xce50c3=_0x2e7af7[_0xb6b1('0x5d')][_0xb6b1('0x21')](',')[_0xb6b1('0x31')](function(_0x676c89){return Number(_0x676c89);});_0xce50c3[_0xb6b1('0x68')](function(_0x4e34ef){_0x5be7bf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e34ef+',%');});_0x2123f5=_[_0xb6b1('0x69')](_0x2123f5,_0xce50c3);break;case'User':if(_0x2e7af7[_0xb6b1('0x6a')]===_0xb6b1('0x6b')){_0x5adb1c[_0x239de5](_0xb6b1('0x6c'),'%'+_0x2e7af7['value']+'%',null);}else{_0x47e64e=_[_0xb6b1('0x5b')](_0x56470a,[_0xb6b1('0x1c'),_0xb6b1('0x2c')]);_0x2e7af7[_0xb6b1('0x45')]=_0xb6b1('0x2c');_0x55f565=as['buildExpression'](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x6d')]);}break;case _0xb6b1('0x25'):_0x55f565=as[_0xb6b1('0x64')]('me',null,_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x6d')]);break;}}else{var _0x55f565=as[_0xb6b1('0x64')](_0x54c88f,_0x47e64e['type'],_0x2e7af7);_0x5adb1c[_0x239de5](_0x55f565[_0xb6b1('0x65')],_0x55f565[_0xb6b1('0x5d')][_0xb6b1('0x66')],_0x55f565['value'][_0xb6b1('0x6d')]);}}}else{var _0x4c795a=_(_0xfe126['query'])[_0xb6b1('0x39')]()['map'](function(_0x462175){return _[_0xb6b1('0x6e')](_0x56470a,['name',_0x462175])?_0x462175:undefined;})[_0xb6b1('0x6f')]()['value']();if(!_[_0xb6b1('0x70')](_0x4c795a)){_0x4c795a[_0xb6b1('0x68')](function(_0x2b280e){if(_0x2b280e==='MailAccountId'){_0x7d4763[_0xb6b1('0x42')]('i.MailAccountId\x20IN\x20?',[][_0xb6b1('0x71')](_0xfe126[_0xb6b1('0x38')][_0x2b280e]));}else if(_0x2b280e===_0xb6b1('0x72')){var _0xa740a5=JSON['parse'](_0xfe126[_0xb6b1('0x38')][_0x2b280e])[_0xb6b1('0x73')];var _0x3e663d=JSON[_0xb6b1('0x74')](_0xfe126[_0xb6b1('0x38')][_0x2b280e])[_0xb6b1('0x75')];_0x7d4763['where'](_0xb6b1('0x76'),_0xa740a5,_0x3e663d);}else{if(_0xfe126[_0xb6b1('0x38')][_0x2b280e]===_0xb6b1('0x77')){_0x7d4763[_0xb6b1('0x42')]('i.'+_0x2b280e+'\x20IS\x20NULL');}else{_0x7d4763[_0xb6b1('0x42')]('i.'+_0x2b280e+_0xb6b1('0x78'),_0xfe126['query'][_0x2b280e]);}}});}if(_0xfe126['query']['read']){if(_0xfe126['query'][_0xb6b1('0x79')]==0x1){_0x7d4763[_0xb6b1('0x7a')](_0xb6b1('0x7b'));}else{_0x7d4763[_0xb6b1('0x7a')](_0xb6b1('0x7c'));}}if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7d')]){_0x2123f5=_['isArray'](_0xfe126[_0xb6b1('0x38')]['tag'])?_0xfe126['query'][_0xb6b1('0x7d')]:new Array(_0xfe126[_0xb6b1('0x38')]['tag']);_0x2123f5[_0xb6b1('0x68')](function(_0x394b82){_0x5be7bf['or'](_0xb6b1('0x7e'),'%,'+_0x394b82+',%');});}if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7f')]){var _0x5516c7=_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x7f')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xb6b1('0x80')](_0x5516c7)){_0x5adb1c['or'](_0xb6b1('0x81'),_0x5516c7+'%');}else if(qs[_0xb6b1('0x82')](_0x5516c7)){_0x5adb1c['or'](_0xb6b1('0x83'),_0x5516c7+'%');}else{_0x5adb1c['or'](_0xb6b1('0x84'),qs[_0xb6b1('0x85')](_0x5516c7))['or'](_0xb6b1('0x86'),qs[_0xb6b1('0x85')](_0x5516c7));}}}_0x7d4763[_0xb6b1('0x42')](_0x5adb1c);_0x7d4763['group'](_0xb6b1('0x87'));var _0x57fd39={'type':db[_0xb6b1('0x88')][_0xb6b1('0x89')][_0xb6b1('0x8a')],'raw':!![]};var _0x500945=_0x7d4763[_0xb6b1('0x8b')]();_0x500945[_0xb6b1('0x45')]('i.id');_0x500945[_0xb6b1('0x45')](_0xb6b1('0x8c'),'unreadMessages');if(_0x33dc30[_0xb6b1('0x40')]){_0x33dc30['order'][_0xb6b1('0x68')](function(_0x58da6c){var _0x300508=_0x58da6c[0x0]===_0xb6b1('0x8d')?_0x58da6c[0x0]:'i.'+_0x58da6c[0x0];_0x7d4763[_0xb6b1('0x40')](_0x300508,_0x58da6c[0x1]===_0xb6b1('0x8e')?![]:!![]);});}if(!_[_0xb6b1('0x70')](_0x2123f5)){_0x7d4763['having'](_0x5be7bf);_0x500945[_0xb6b1('0x42')](_0xb6b1('0x8f'),_0x2123f5);}BPromise[_0xb6b1('0x90')]()[_0xb6b1('0x18')](function(){if(!_0x323231){if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x91')])return;_0x500945[_0xb6b1('0x42')](_0xb6b1('0x92'));_0x7d4763[_0xb6b1('0x42')](_0xb6b1('0x92'));return;}if(_0xfe126[_0xb6b1('0x93')][_0xb6b1('0x94')]!=='agent')return;return _0xfe126[_0xb6b1('0x93')][_0xb6b1('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22ebac){if(_[_0xb6b1('0x70')](_0x22ebac)){_0x500945['where'](_0xb6b1('0x96'));_0x7d4763['where'](_0xb6b1('0x96'));}else{_0x500945['where'](_0xb6b1('0x97'),_['map'](_0x22ebac,'id'));_0x7d4763['where'](_0xb6b1('0x97'),_[_0xb6b1('0x31')](_0x22ebac,'id'));}});})['then'](function(){if(_0xfe126[_0xb6b1('0x93')][_0xb6b1('0x94')]===_0xb6b1('0x98')&&!_0x323231&&!_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x91')])return[];return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x500945[_0xb6b1('0x9a')](),_0x57fd39);})[_0xb6b1('0x18')](function(_0x267c1d){_0x44a61a[_0xb6b1('0x16')]=_0x267c1d[_0xb6b1('0x3d')];if(_0x44a61a['count']===0x0)return[];return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x2c00fb[_0xb6b1('0x9a')](),_0x57fd39)[_0xb6b1('0x18')](function(_0x489898){_0x3826bd=_[_0xb6b1('0x9b')](_0x489898,'id');_0x57fd39=_[_0xb6b1('0x9c')](_0x57fd39,{'model':db[_0xb6b1('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfe126[_0xb6b1('0x38')][_0xb6b1('0x3c')]){_0x33dc30[_0xb6b1('0x3b')]['forEach'](function(_0x3954dd){_0x7d4763[_0xb6b1('0x45')]('i.'+_0x3954dd);});}else{_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x8c'),_0xb6b1('0x5c'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x9d'),_0xb6b1('0x9e'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x9f'),_0xb6b1('0xa0'));_0x7d4763[_0xb6b1('0x45')]('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',_0xb6b1('0x8d'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0x87'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa1'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa2'));_0x7d4763[_0xb6b1('0x45')]('i.closed');_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa3'));_0x7d4763[_0xb6b1('0x45')]('i.attach');_0x7d4763[_0xb6b1('0x45')]('i.lastMsgAt');_0x7d4763['field'](_0xb6b1('0xa4'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa5'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa6'));_0x7d4763[_0xb6b1('0x45')]('i.secondDisposition');_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa7'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xa8'));_0x7d4763['field']('i.to');_0x7d4763[_0xb6b1('0x45')]('i.ContactId');_0x7d4763[_0xb6b1('0x45')]('i.MailAccountId');_0x7d4763[_0xb6b1('0x45')]('i.UserId');_0x7d4763['field'](_0xb6b1('0xa9'),_0xb6b1('0xaa'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xab'),_0xb6b1('0xac'));_0x7d4763['field'](_0xb6b1('0xad'),_0xb6b1('0xae'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xaf'),'Contact.phone');_0x7d4763[_0xb6b1('0x45')]('c.mobile',_0xb6b1('0xb0'));_0x7d4763['field'](_0xb6b1('0xb1'),'Contact.fax');_0x7d4763['field']('o.fullname','Owner.fullname');_0x7d4763[_0xb6b1('0x45')]('o.internal',_0xb6b1('0xb2'));_0x7d4763[_0xb6b1('0x45')](_0xb6b1('0xb3'),_0xb6b1('0x1f'));}if(_0x33dc30['limit'])_0x7d4763[_0xb6b1('0x15')](_0x33dc30[_0xb6b1('0x15')]);if(_0x33dc30['offset'])_0x7d4763['offset'](_0x33dc30['offset']);return db[_0xb6b1('0x99')]['query'](_0x7d4763[_0xb6b1('0x9a')](),_0x57fd39);})['then'](function(_0x3173d2){if(_0x3173d2['length']>0x0)_0x1f4881[_0xb6b1('0x42')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x3173d2,'id'));return db[_0xb6b1('0x99')][_0xb6b1('0x38')](_0x1f4881[_0xb6b1('0x9a')](),_0x57fd39)[_0xb6b1('0x18')](function(_0xb25776){var _0x2ca465=_['groupBy'](_0xb25776,_0xb6b1('0xb4'));var _0x1dcf93=[];return db['Setting'][_0xb6b1('0xb5')]({'attributes':[_0xb6b1('0xb6')],'raw':!![]})[_0xb6b1('0x18')](function(_0x5236a3){var _0x36f39e=_0x5236a3[_0xb6b1('0xb6')];_0x3173d2[_0xb6b1('0x68')](function(_0x2579c2){_0x1dcf93[_0xb6b1('0x22')](updateMailInteraction(_0x2579c2,_0x3826bd,_0x2ca465,_0x36f39e));});return BPromise[_0xb6b1('0xb7')](_0x1dcf93);});});});})[_0xb6b1('0x18')](function(_0x24c4db){_0x44a61a[_0xb6b1('0xb8')]=_0x24c4db;return _0x44a61a;})[_0xb6b1('0x18')](respondWithFilteredResult(_0x3df192,_0x33dc30))[_0xb6b1('0x28')](handleError(_0x3df192,null));};exports['show']=function(_0x59b19f,_0x54fb1e){var _0x160166={'raw':![],'where':{'id':_0x59b19f[_0xb6b1('0xb9')]['id']}},_0x535d47={};_0x535d47[_0xb6b1('0x37')]=_[_0xb6b1('0x39')](db[_0xb6b1('0x32')]['rawAttributes']);_0x535d47[_0xb6b1('0x38')]=_['keys'](_0x59b19f['query']);_0x535d47['filters']=_[_0xb6b1('0x3a')](_0x535d47[_0xb6b1('0x37')],_0x535d47[_0xb6b1('0x38')]);_0x160166[_0xb6b1('0x3b')]=_[_0xb6b1('0x3a')](_0x535d47[_0xb6b1('0x37')],qs[_0xb6b1('0x3c')](_0x59b19f['query']['fields']));_0x160166[_0xb6b1('0x3b')]=_0x160166['attributes'][_0xb6b1('0x3d')]?_0x160166['attributes']:_0x535d47['model'];if(_0x59b19f['query']['includeAll']){_0x160166[_0xb6b1('0xba')]=[{'all':!![]}];}_0x160166=_[_0xb6b1('0x9c')]({},_0x160166,_0x59b19f[_0xb6b1('0xbb')]);return db[_0xb6b1('0x32')][_0xb6b1('0x5b')](_0x160166)['then'](handleEntityNotFound(_0x54fb1e,null))[_0xb6b1('0x18')](respondWithResult(_0x54fb1e,null))['catch'](handleError(_0x54fb1e,null));};exports[_0xb6b1('0xbc')]=function(_0x28b252,_0x235ae7){return db[_0xb6b1('0x32')][_0xb6b1('0xbc')](_0x28b252[_0xb6b1('0xbd')],{})[_0xb6b1('0x18')](respondWithResult(_0x235ae7,0xc9))[_0xb6b1('0x28')](handleError(_0x235ae7,null));};exports[_0xb6b1('0x17')]=function(_0x49bbbb,_0x193c0a){if(_0x49bbbb[_0xb6b1('0xbd')]['id']){delete _0x49bbbb[_0xb6b1('0xbd')]['id'];}return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x49bbbb[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x193c0a,null))[_0xb6b1('0x18')](saveUpdates(_0x49bbbb['body'],null))['then'](respondWithResult(_0x193c0a,null))['catch'](handleError(_0x193c0a,null));};exports[_0xb6b1('0x19')]=function(_0x271599,_0x2a9fe9){return db['MailInteraction']['find']({'where':{'id':_0x271599['params']['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x2a9fe9,null))['then'](removeEntity(_0x2a9fe9,null))[_0xb6b1('0x28')](handleError(_0x2a9fe9,null));};exports[_0xb6b1('0xbe')]=function(_0x434c1c,_0x4ac5ed){return db[_0xb6b1('0x32')]['describe']()[_0xb6b1('0x18')](respondWithResult(_0x4ac5ed,null))[_0xb6b1('0x28')](handleError(_0x4ac5ed,null));};exports[_0xb6b1('0xbf')]=function(_0x840ed1,_0x5576bf){return db[_0xb6b1('0x23')][_0xb6b1('0x5b')]({'where':{'id':_0x840ed1[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x5576bf,null))['then'](function(_0x1f27b6){if(_0x1f27b6){return _0x1f27b6[_0xb6b1('0xbf')](_0x840ed1['body'][_0xb6b1('0xc0')],_[_0xb6b1('0xc1')](_0x840ed1[_0xb6b1('0xbd')],['ids','id'])||{});}})[_0xb6b1('0x18')](respondWithResult(_0x5576bf,null))[_0xb6b1('0x28')](handleError(_0x5576bf,null));};exports[_0xb6b1('0xc2')]=function(_0x2e95ca,_0x257e05){var _0xa31640={'raw':![],'where':{}};var _0x1bf97a={};var _0x58244e={'count':0x0,'rows':[]};return db[_0xb6b1('0x32')][_0xb6b1('0xb5')]({'where':{'id':_0x2e95ca['params']['id']}})['then'](handleEntityNotFound(_0x257e05,null))[_0xb6b1('0x18')](function(_0x2d3ce6){if(_0x2d3ce6){_0x1bf97a[_0xb6b1('0x37')]=_['keys'](db[_0xb6b1('0x23')]['rawAttributes']);_0x1bf97a[_0xb6b1('0x38')]=_['keys'](_0x2e95ca[_0xb6b1('0x38')]);_0x1bf97a[_0xb6b1('0x43')]=_[_0xb6b1('0x3a')](_0x1bf97a[_0xb6b1('0x37')],_0x1bf97a[_0xb6b1('0x38')]);_0xa31640[_0xb6b1('0x3b')]=_['intersection'](_0x1bf97a['model'],qs[_0xb6b1('0x3c')](_0x2e95ca[_0xb6b1('0x38')]['fields']));_0xa31640[_0xb6b1('0x3b')]=_0xa31640[_0xb6b1('0x3b')][_0xb6b1('0x3d')]?_0xa31640[_0xb6b1('0x3b')]:_0x1bf97a[_0xb6b1('0x37')];if(!_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x3e')](_0xb6b1('0x3f'))){_0xa31640[_0xb6b1('0x15')]=qs[_0xb6b1('0x15')](_0x2e95ca['query'][_0xb6b1('0x15')]);_0xa31640[_0xb6b1('0x13')]=qs['offset'](_0x2e95ca[_0xb6b1('0x38')]['offset']);}_0xa31640[_0xb6b1('0x40')]=qs[_0xb6b1('0x41')](_0x2e95ca['query'][_0xb6b1('0x41')]);_0xa31640['where']=qs['filters'](_['pick'](_0x2e95ca[_0xb6b1('0x38')],_0x1bf97a['filters']));_0xa31640[_0xb6b1('0x42')][_0xb6b1('0xb4')]=_0x2d3ce6['id'];if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x7f')]){_0xa31640['where']=_[_0xb6b1('0x9c')](_0xa31640[_0xb6b1('0x42')],{'$or':_[_0xb6b1('0x31')](_0xa31640['attributes'],function(_0x1e2137){var _0x2b6ddf={};_0x2b6ddf[_0x1e2137]={'$like':'%'+_0x2e95ca[_0xb6b1('0x38')]['filter']+'%'};return _0x2b6ddf;})});}if(_0x2e95ca['query'][_0xb6b1('0x73')]){var _0x50406d=_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0x73')]['split'](',');var _0x555aa2={};_0x555aa2[_0x50406d[0x0]]={'$gte':moment(_0x50406d[0x1])[_0xb6b1('0xc3')](_0xb6b1('0xc4'))};_0xa31640[_0xb6b1('0x42')]=_[_0xb6b1('0x9c')](_0xa31640[_0xb6b1('0x42')],_0x555aa2);}_0xa31640=_[_0xb6b1('0x9c')]({},_0xa31640,_0x2e95ca[_0xb6b1('0xbb')]);return db[_0xb6b1('0x23')][_0xb6b1('0x16')]({'where':_0xa31640[_0xb6b1('0x42')]})[_0xb6b1('0x18')](function(_0x173eee){_0x58244e['count']=_0x173eee;if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0xc5')]){_0xa31640[_0xb6b1('0xba')]=[{'all':!![]}];}return db['MailMessage'][_0xb6b1('0xc6')](_0xa31640);})[_0xb6b1('0x18')](function(_0x564a97){if(_0x2e95ca[_0xb6b1('0x38')][_0xb6b1('0xc7')]===_0xb6b1('0xc8')){for(var _0x588be2=0x0;_0x588be2<_0x564a97['length'];_0x588be2++){_0x564a97[_0x588be2][_0xb6b1('0xbd')]=juice(_0x564a97[_0x588be2][_0xb6b1('0xbd')]);}}_0x58244e[_0xb6b1('0xb8')]=_0x564a97;return _0x58244e;});}})['then'](respondWithFilteredResult(_0x257e05,_0xa31640))['catch'](handleError(_0x257e05,null));};exports[_0xb6b1('0xc9')]=function(_0x129648,_0x9131e9){return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x129648['params']['id']}})['then'](handleEntityNotFound(_0x9131e9,null))[_0xb6b1('0x18')](function(_0x1f5381){if(_0x1f5381){return _0x1f5381[_0xb6b1('0xca')](_0x129648[_0xb6b1('0xbd')][_0xb6b1('0xc0')],_[_0xb6b1('0xc1')](_0x129648[_0xb6b1('0xbd')],['ids','id'])||{})[_0xb6b1('0xcb')](function(){return db[_0xb6b1('0x67')][_0xb6b1('0xc6')]({'attributes':['id',_0xb6b1('0x1c'),_0xb6b1('0x46')],'where':{'id':_0x129648[_0xb6b1('0xbd')][_0xb6b1('0xc0')]}});})['then'](function(_0x5813e4){socket['emit']('mailInteractionTags:save',{'id':Number(_0x129648[_0xb6b1('0xb9')]['id']),'tags':_0x5813e4||[]});return{'id':Number(_0x129648['params']['id']),'tags':_0x5813e4||[]};});}})['then'](respondWithResult(_0x9131e9,null))[_0xb6b1('0x28')](handleError(_0x9131e9,null));};exports['removeTags']=function(_0xd0eaa4,_0x51a36a){return db[_0xb6b1('0x32')]['find']({'where':{'id':_0xd0eaa4[_0xb6b1('0xb9')]['id']}})[_0xb6b1('0x18')](handleEntityNotFound(_0x51a36a,null))[_0xb6b1('0x18')](function(_0x3d081e){if(_0x3d081e){return _0x3d081e[_0xb6b1('0xcc')](_0xd0eaa4['query']['ids']);}})['then'](respondWithStatusCode(_0x51a36a,null))[_0xb6b1('0x28')](handleError(_0x51a36a,null));};exports[_0xb6b1('0xcd')]=function(_0x1bc26b,_0x286c65){var _0x24a136=moment()[_0xb6b1('0xce')]()[_0xb6b1('0x9a')]();var _0x4a7c67=path[_0xb6b1('0xcf')](config[_0xb6b1('0xd0')],'server',_0xb6b1('0xd1'),_0xb6b1('0xd2'));var _0x56b5c7=path[_0xb6b1('0xcf')](config[_0xb6b1('0xd0')],'server',_0xb6b1('0xd1'),'attachments');var _0x18be57=path[_0xb6b1('0xcf')](_0x4a7c67,_0x24a136);var _0x5b9247=util[_0xb6b1('0xc3')](_0xb6b1('0xd3'),_0x1bc26b[_0xb6b1('0xb9')]['id'],_0x24a136);var _0x1ffd3b=path[_0xb6b1('0xcf')](_0x4a7c67,_0x5b9247);var _0x6dec10=[];if(_0x1bc26b[_0xb6b1('0x38')][_0xb6b1('0xd4')]){_0x6dec10[_0xb6b1('0x22')]({'model':db[_0xb6b1('0xd5')],'as':'Attachments','raw':!![]});}var _0xb2e401=[{'model':db[_0xb6b1('0x23')],'as':'Messages','attributes':['id','body',_0xb6b1('0x4b'),'to','cc',_0xb6b1('0xd6'),_0xb6b1('0xd7'),'createdAt'],'where':{'secret':![]},'order':qs[_0xb6b1('0x41')]('id'),'include':_0x6dec10}];return db[_0xb6b1('0x32')][_0xb6b1('0x5b')]({'where':{'id':_0x1bc26b[_0xb6b1('0xb9')]['id']},'include':_0xb2e401})['then'](handleEntityNotFound(_0x286c65,null))['then'](function(_0x737fa0){if(_0x737fa0&&_0x737fa0[_0xb6b1('0xd8')]){var _0x288f12=_0x737fa0[_0xb6b1('0xd9')]({'plain':!![]});fs[_0xb6b1('0xda')](_0x18be57);return BPromise[_0xb6b1('0xdb')](_0x288f12[_0xb6b1('0xd8')],function(_0x570d67,_0x409aad){var _0x2ab39a={'from':_0x570d67[_0xb6b1('0x4b')],'to':_0x570d67['to'],'subject':_0x570d67[_0xb6b1('0xd7')],'html':htmlEntities['decode'](_0x570d67[_0xb6b1('0xbd')]),'headers':{'Date':moment(_0x570d67[_0xb6b1('0x72')])[_0xb6b1('0xc3')](_0xb6b1('0xdc'))},'attachments':[]};if(_0x570d67['cc']){_0x2ab39a['headers']['Cc']=_0x570d67['cc'];}if(_0x570d67[_0xb6b1('0xd6')]){_0x2ab39a[_0xb6b1('0xdd')][_0xb6b1('0xde')]=_0x570d67[_0xb6b1('0xd6')];}return new BPromise(function(_0x3cdd09,_0x37a71b){if(_0x570d67['Attachments']){for(var _0x8486dc=0x0;_0x8486dc<_0x570d67[_0xb6b1('0xdf')][_0xb6b1('0x3d')];_0x8486dc++){var _0x18c0fa=_0x570d67[_0xb6b1('0xdf')][_0x8486dc];var _0x20eeed=path[_0xb6b1('0xcf')](_0x56b5c7,_0x18c0fa[_0xb6b1('0xe0')]);if(fs[_0xb6b1('0xe1')](_0x20eeed)){_0x2ab39a[_0xb6b1('0xd4')][_0xb6b1('0x22')]({'name':_0x18c0fa['name'],'contentType':_0x18c0fa['type'],'data':fs[_0xb6b1('0xe2')](_0x20eeed)});}}}emlformat[_0xb6b1('0xe3')](_0x2ab39a,function(_0x2d8d1f,_0x25a2c4){if(_0x2d8d1f)return _0x37a71b(_0x2d8d1f);fs['writeFileSync'](path['join'](_0x18be57,util['format'](_0xb6b1('0xe4'),_0x409aad)),_0x25a2c4);return _0x3cdd09(_0x25a2c4);});});})['then'](function(){return new BPromise(function(_0x2f2ba2,_0x2414dc){zipdir(_0x18be57,{'saveTo':_0x1ffd3b},function(_0xf8e6b0,_0x2151a9){if(_0xf8e6b0)return _0x2414dc(_0xf8e6b0);return _0x2f2ba2(_0x2151a9);});})['then'](function(){return new BPromise(function(_0x530a16,_0x142d71){rimraf(_0x18be57,function(_0x1085c5){if(_0x1085c5)_0x142d71(_0x1085c5);return _0x530a16();});});})['then'](function(){return _0x286c65[_0xb6b1('0xcd')](_0x1ffd3b,_0x5b9247,function(_0x4c166f){if(!_0x4c166f)fs[_0xb6b1('0xe5')](_0x1ffd3b);});});});}else{return _0x286c65[_0xb6b1('0xe6')](0xc8);}})['catch'](handleError(_0x286c65,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 20f4c57..349b8d3 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 _0x18d8=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x18d8,0xe2));var _0x818d=function(_0x2ce26c,_0x263db1){_0x2ce26c=_0x2ce26c-0x0;var _0x290b9d=_0x18d8[_0x2ce26c];return _0x290b9d;};'use strict';var EventEmitter=require(_0x818d('0x0'));var MailInteraction=require(_0x818d('0x1'))['db'][_0x818d('0x2')];var MailMessage=require(_0x818d('0x1'))['db'][_0x818d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x818d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x818d('0x5'),'afterDestroy':_0x818d('0x6')};function emitEvent(_0x568c85){return function(_0x3c2811,_0xbeb919,_0x30a820){_0x3c2811[_0x818d('0x7')]({'attributes':['id'],'raw':!![]})[_0x818d('0x8')](function(_0x12d6a2){_0x3c2811['setDataValue'](_0x818d('0x9'),_0x12d6a2[_0x818d('0xa')](function(_0x15a0a0){return{'id':_0x15a0a0['id']};}));return MailMessage[_0x818d('0xb')]({'where':{'MailInteractionId':_0x3c2811['id'],'direction':'in','read':![]},'raw':!![]});})[_0x818d('0x8')](function(_0x2fc0ab){_0x3c2811[_0x818d('0xc')](_0x818d('0xd'),_0x2fc0ab[_0x818d('0xe')]);MailInteractionEvents[_0x818d('0xf')](_0x568c85+':'+_0x3c2811['id'],_0x3c2811);MailInteractionEvents[_0x818d('0xf')](_0x568c85,_0x3c2811);_0x30a820(null);})[_0x818d('0x10')](_0x30a820(null));};}for(var e in events){if(events[_0x818d('0x11')](e)){var event=events[e];MailInteraction[_0x818d('0x12')](e,emitEvent(event));}}module[_0x818d('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0x443d=['setMaxListeners','save','update','getUsers','Users','findAll','then','length','emit','catch','hook','exports','../../mysqldb','MailInteraction','MailMessage'];(function(_0x5df59f,_0xf11a72){var _0x190e3b=function(_0x2b983e){while(--_0x2b983e){_0x5df59f['push'](_0x5df59f['shift']());}};_0x190e3b(++_0xf11a72);}(_0x443d,0x165));var _0xd443=function(_0x44502b,_0x13fd65){_0x44502b=_0x44502b-0x0;var _0x3073fb=_0x443d[_0x44502b];return _0x3073fb;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xd443('0x0'))['db'][_0xd443('0x1')];var MailMessage=require(_0xd443('0x0'))['db'][_0xd443('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd443('0x3')](0x0);var events={'afterCreate':_0xd443('0x4'),'afterUpdate':_0xd443('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4cc0ac){return function(_0x19cf44,_0x453282,_0x31ed99){_0x19cf44[_0xd443('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e1c2d){_0x19cf44['setDataValue'](_0xd443('0x7'),_0x5e1c2d['map'](function(_0x5d0d8c){return{'id':_0x5d0d8c['id']};}));return MailMessage[_0xd443('0x8')]({'where':{'MailInteractionId':_0x19cf44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd443('0x9')](function(_0x394a45){_0x19cf44['setDataValue']('unreadMessages',_0x394a45[_0xd443('0xa')]);MailInteractionEvents[_0xd443('0xb')](_0x4cc0ac+':'+_0x19cf44['id'],_0x19cf44);MailInteractionEvents[_0xd443('0xb')](_0x4cc0ac,_0x19cf44);_0x31ed99(null);})[_0xd443('0xc')](_0x31ed99(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xd443('0xd')](e,emitEvent(event));}}module[_0xd443('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d1a2203..3ad8193 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 _0x6540=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','closed','models','get','MailMessage','update','then','catch'];(function(_0x4738cd,_0x1d14bd){var _0x37ac0c=function(_0x392d2e){while(--_0x392d2e){_0x4738cd['push'](_0x4738cd['shift']());}};_0x37ac0c(++_0x1d14bd);}(_0x6540,0x14b));var _0x0654=function(_0x359222,_0x5c441c){_0x359222=_0x359222-0x0;var _0x471a01=_0x6540[_0x359222];return _0x471a01;};'use strict';var _=require(_0x0654('0x0'));var util=require(_0x0654('0x1'));var logger=require('../../config/logger')(_0x0654('0x2'));var moment=require(_0x0654('0x3'));var BPromise=require(_0x0654('0x4'));var rp=require(_0x0654('0x5'));var fs=require('fs');var path=require(_0x0654('0x6'));var rimraf=require(_0x0654('0x7'));var config=require(_0x0654('0x8'));var attributes=require(_0x0654('0x9'));module[_0x0654('0xa')]=function(_0x38a475,_0x434e62){return _0x38a475[_0x0654('0xb')]('MailInteraction',attributes,{'tableName':_0x0654('0xc'),'paranoid':![],'indexes':[{'name':_0x0654('0xd'),'fields':[_0x0654('0xe'),'to'],'type':_0x0654('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18ca7d,_0x2c10c8,_0x31726d){if(_0x18ca7d['substatus']){_0x18ca7d[_0x0654('0x10')]=moment()[_0x0654('0x11')](_0x0654('0x12'));}if(_0x18ca7d['closed']){_0x18ca7d[_0x0654('0x13')]=moment()[_0x0654('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x31726d(null,_0x2c10c8);},'beforeUpdate':function(_0x22ea21,_0x850c99,_0x39363a){if(_0x22ea21[_0x0654('0x14')](_0x0654('0x15'))){_0x22ea21[_0x0654('0x10')]=_0x22ea21[_0x0654('0x15')]?moment()['format'](_0x0654('0x12')):null;}if(_0x22ea21['changed'](_0x0654('0x16'))){_0x22ea21[_0x0654('0x13')]=moment()['format'](_0x0654('0x12'));_0x22ea21['substatus']=null;_0x22ea21[_0x0654('0x10')]=null;}_0x39363a(null,_0x22ea21);},'afterUpdate':function(_0xd78312,_0x553e45,_0x24ae9f){var _0x5a7f63=_0x38a475[_0x0654('0x17')];var _0x1267c1=_0xd78312[_0x0654('0x18')]({'plain':!![]});if(_0x1267c1['closed']){return _0x5a7f63[_0x0654('0x19')][_0x0654('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x1267c1['id']}})[_0x0654('0x1b')](function(){_0x24ae9f();})[_0x0654('0x1c')](function(_0x8fc38c){_0x24ae9f(_0x8fc38c);});}else{_0x24ae9f();}}},'charset':'utf8mb4','collate':_0x0654('0x1d')});}; \ No newline at end of file +var _0xeedf=['changed','closedAt','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x329da2,_0x29d437){var _0x13d546=function(_0x217567){while(--_0x217567){_0x329da2['push'](_0x329da2['shift']());}};_0x13d546(++_0x29d437);}(_0xeedf,0xf1));var _0xfeed=function(_0x4a3526,_0x17ddd1){_0x4a3526=_0x4a3526-0x0;var _0x8f5716=_0xeedf[_0x4a3526];return _0x8f5716;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require('../../config/logger')(_0xfeed('0x2'));var moment=require(_0xfeed('0x3'));var BPromise=require(_0xfeed('0x4'));var rp=require(_0xfeed('0x5'));var fs=require('fs');var path=require(_0xfeed('0x6'));var rimraf=require('rimraf');var config=require(_0xfeed('0x7'));var attributes=require(_0xfeed('0x8'));module[_0xfeed('0x9')]=function(_0x33c6cb,_0x285c83){return _0x33c6cb[_0xfeed('0xa')](_0xfeed('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xfeed('0xc'),'fields':[_0xfeed('0xd'),'to'],'type':_0xfeed('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc69969,_0x19cb6b,_0x2afcf3){if(_0xc69969[_0xfeed('0xf')]){_0xc69969[_0xfeed('0x10')]=moment()[_0xfeed('0x11')](_0xfeed('0x12'));}if(_0xc69969[_0xfeed('0x13')]){_0xc69969['closedAt']=moment()[_0xfeed('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2afcf3(null,_0x19cb6b);},'beforeUpdate':function(_0x2364c8,_0x4a63b7,_0x1f1c25){if(_0x2364c8['changed'](_0xfeed('0xf'))){_0x2364c8[_0xfeed('0x10')]=_0x2364c8[_0xfeed('0xf')]?moment()[_0xfeed('0x11')](_0xfeed('0x12')):null;}if(_0x2364c8[_0xfeed('0x14')]('closed')){_0x2364c8[_0xfeed('0x15')]=moment()['format'](_0xfeed('0x12'));_0x2364c8[_0xfeed('0xf')]=null;_0x2364c8[_0xfeed('0x10')]=null;}_0x1f1c25(null,_0x2364c8);},'afterUpdate':function(_0x2ddb86,_0x5aef2b,_0x2f2a98){var _0x41657f=_0x33c6cb[_0xfeed('0x16')];var _0x35c177=_0x2ddb86['get']({'plain':!![]});if(_0x35c177[_0xfeed('0x13')]){return _0x41657f[_0xfeed('0x17')][_0xfeed('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x35c177['id']}})[_0xfeed('0x19')](function(){_0x2f2a98();})[_0xfeed('0x1a')](function(_0x1a3660){_0x2f2a98(_0x1a3660);});}else{_0x2f2a98();}}},'charset':_0xfeed('0x1b'),'collate':_0xfeed('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cf90d6b..5fc85a7 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 _0x0909=['body','options','raw','attributes','limit','AddTagsToMailInteraction','find','where','addTags','omit','ids','spread','AddTags','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update'];(function(_0x34e030,_0x57c46d){var _0x1a6406=function(_0x74f5ca){while(--_0x74f5ca){_0x34e030['push'](_0x34e030['shift']());}};_0x1a6406(++_0x57c46d);}(_0x0909,0x1e6));var _0x9090=function(_0x42aa78,_0x3a6165){_0x42aa78=_0x42aa78-0x0;var _0x1709c3=_0x0909[_0x42aa78];return _0x1709c3;};'use strict';var _=require('lodash');var util=require(_0x9090('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9090('0x1'));var fs=require('fs');var Redis=require(_0x9090('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9090('0x3'));var logger=require(_0x9090('0x4'))(_0x9090('0x5'));var config=require('../../config/environment');var jayson=require(_0x9090('0x6'));var client=jayson[_0x9090('0x7')][_0x9090('0x8')]({'port':0x232a});config[_0x9090('0x9')]=_[_0x9090('0xa')](config['redis'],{'host':_0x9090('0xb'),'port':0x18eb});var socket=require(_0x9090('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x9090('0xd')](socket);function respondWithRpcPromise(_0x1fa1c5,_0x5d7905,_0x453873){return new BPromise(function(_0x55ddf1,_0x58e141){return client[_0x9090('0xe')](_0x1fa1c5,_0x453873)[_0x9090('0xf')](function(_0x587fd4){logger[_0x9090('0x10')](_0x9090('0x11'),_0x5d7905,_0x9090('0x12'));logger[_0x9090('0x13')](_0x9090('0x14'),_0x5d7905,_0x9090('0x12'),JSON[_0x9090('0x15')](_0x587fd4));if(_0x587fd4[_0x9090('0x16')]){if(_0x587fd4[_0x9090('0x16')][_0x9090('0x17')]===0x1f4){logger['error'](_0x9090('0x11'),_0x5d7905,_0x587fd4['error'][_0x9090('0x18')]);return _0x58e141(_0x587fd4[_0x9090('0x16')][_0x9090('0x18')]);}logger[_0x9090('0x16')](_0x9090('0x11'),_0x5d7905,_0x587fd4[_0x9090('0x16')][_0x9090('0x18')]);return _0x55ddf1(_0x587fd4[_0x9090('0x16')]['message']);}else{logger[_0x9090('0x10')]('MailInteraction,\x20%s,\x20%s',_0x5d7905,_0x9090('0x12'));_0x55ddf1(_0x587fd4[_0x9090('0x19')][_0x9090('0x18')]);}})[_0x9090('0x1a')](function(_0x350b9b){logger['error'](_0x9090('0x11'),_0x5d7905,_0x350b9b);_0x58e141(_0x350b9b);});});}exports[_0x9090('0x1b')]=function(_0x1c9ebc){var _0x169966=this;return new Promise(function(_0x1398d0,_0x576d9b){return db[_0x9090('0x1c')][_0x9090('0x1d')](_0x1c9ebc[_0x9090('0x1e')],{'raw':_0x1c9ebc[_0x9090('0x1f')]?_0x1c9ebc['options'][_0x9090('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9ebc['options']?_0x1c9ebc[_0x9090('0x1f')]['where']||null:null,'attributes':_0x1c9ebc[_0x9090('0x1f')]?_0x1c9ebc[_0x9090('0x1f')][_0x9090('0x21')]||null:null,'limit':_0x1c9ebc['options']?_0x1c9ebc[_0x9090('0x1f')][_0x9090('0x22')]||null:null})['then'](function(_0x46f5cf){logger[_0x9090('0x10')](_0x9090('0x1b'),_0x1c9ebc);logger[_0x9090('0x13')](_0x9090('0x1b'),_0x1c9ebc,JSON['stringify'](_0x46f5cf));_0x1398d0(_0x46f5cf);})[_0x9090('0x1a')](function(_0x164f95){logger[_0x9090('0x16')](_0x9090('0x1b'),_0x164f95['message'],_0x1c9ebc);_0x576d9b(_0x169966['error'](0x1f4,_0x164f95[_0x9090('0x18')]));});});};exports[_0x9090('0x23')]=function(_0x5bb53a){return new Promise(function(_0x64bcbb,_0x128086){return db[_0x9090('0x1c')][_0x9090('0x24')]({'where':_0x5bb53a[_0x9090('0x1f')]?_0x5bb53a[_0x9090('0x1f')][_0x9090('0x25')]||null:null})[_0x9090('0xf')](function(_0x407ff4){if(_0x407ff4){return _0x407ff4[_0x9090('0x26')](_0x5bb53a[_0x9090('0x1e')]['ids'],_[_0x9090('0x27')](_0x5bb53a[_0x9090('0x1e')],[_0x9090('0x28'),'id'])||{});}})[_0x9090('0x29')](function(_0x181953){logger[_0x9090('0x10')](_0x9090('0x2a'),_0x5bb53a);logger[_0x9090('0x13')](_0x9090('0x2a'),_0x5bb53a,JSON['stringify'](_0x181953));_0x64bcbb(_0x181953);})[_0x9090('0x1a')](function(_0x3d2232){logger[_0x9090('0x16')](_0x9090('0x2a'),_0x3d2232[_0x9090('0x18')],_0x5bb53a);_0x128086(_this[_0x9090('0x16')](0x1f4,_0x3d2232[_0x9090('0x18')]));});});}; \ No newline at end of file +var _0x664d=['redis','localhost','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateMailInteraction','MailInteraction','body','raw','options','where','attributes','limit','info','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x43eafd,_0x4084ad){var _0x32a874=function(_0x117b83){while(--_0x117b83){_0x43eafd['push'](_0x43eafd['shift']());}};_0x32a874(++_0x4084ad);}(_0x664d,0x1c2));var _0xd664=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x664d[_0x503cd5];return _0x1fdf1e;};'use strict';var _=require(_0xd664('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd664('0x1'));var rs=require(_0xd664('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd664('0x3'))['db'];var utils=require(_0xd664('0x4'));var logger=require(_0xd664('0x5'))(_0xd664('0x6'));var config=require(_0xd664('0x7'));var jayson=require(_0xd664('0x8'));var client=jayson[_0xd664('0x9')][_0xd664('0xa')]({'port':0x232a});config['redis']=_[_0xd664('0xb')](config[_0xd664('0xc')],{'host':_0xd664('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd664('0xc')]));require('./mailInteraction.socket')[_0xd664('0xe')](socket);function respondWithRpcPromise(_0x4db279,_0x2c0f2f,_0x51062c){return new BPromise(function(_0x4ef6b4,_0x218fb8){return client[_0xd664('0xf')](_0x4db279,_0x51062c)[_0xd664('0x10')](function(_0xe34a62){logger['info'](_0xd664('0x11'),_0x2c0f2f,_0xd664('0x12'));logger[_0xd664('0x13')](_0xd664('0x14'),_0x2c0f2f,_0xd664('0x12'),JSON['stringify'](_0xe34a62));if(_0xe34a62[_0xd664('0x15')]){if(_0xe34a62[_0xd664('0x15')]['code']===0x1f4){logger[_0xd664('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2c0f2f,_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);return _0x218fb8(_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);}logger[_0xd664('0x15')](_0xd664('0x11'),_0x2c0f2f,_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);return _0x4ef6b4(_0xe34a62[_0xd664('0x15')][_0xd664('0x16')]);}else{logger['info'](_0xd664('0x11'),_0x2c0f2f,'request\x20sent');_0x4ef6b4(_0xe34a62[_0xd664('0x17')]['message']);}})[_0xd664('0x18')](function(_0x489c54){logger[_0xd664('0x15')]('MailInteraction,\x20%s,\x20%s',_0x2c0f2f,_0x489c54);_0x218fb8(_0x489c54);});});}exports[_0xd664('0x19')]=function(_0x45c6f0){var _0x1d1ba0=this;return new Promise(function(_0xff5f0a,_0x28975c){return db[_0xd664('0x1a')]['update'](_0x45c6f0[_0xd664('0x1b')],{'raw':_0x45c6f0['options']?_0x45c6f0['options'][_0xd664('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x1e')]||null:null,'attributes':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x1f')]||null:null,'limit':_0x45c6f0[_0xd664('0x1d')]?_0x45c6f0[_0xd664('0x1d')][_0xd664('0x20')]||null:null})[_0xd664('0x10')](function(_0x31de20){logger[_0xd664('0x21')](_0xd664('0x19'),_0x45c6f0);logger[_0xd664('0x13')](_0xd664('0x19'),_0x45c6f0,JSON[_0xd664('0x22')](_0x31de20));_0xff5f0a(_0x31de20);})[_0xd664('0x18')](function(_0x39446d){logger[_0xd664('0x15')](_0xd664('0x19'),_0x39446d['message'],_0x45c6f0);_0x28975c(_0x1d1ba0[_0xd664('0x15')](0x1f4,_0x39446d[_0xd664('0x16')]));});});};exports[_0xd664('0x23')]=function(_0x1816ab){return new Promise(function(_0xe49cd4,_0x2d4553){return db[_0xd664('0x1a')][_0xd664('0x24')]({'where':_0x1816ab['options']?_0x1816ab[_0xd664('0x1d')][_0xd664('0x1e')]||null:null})[_0xd664('0x10')](function(_0x449fe8){if(_0x449fe8){return _0x449fe8[_0xd664('0x25')](_0x1816ab[_0xd664('0x1b')][_0xd664('0x26')],_[_0xd664('0x27')](_0x1816ab[_0xd664('0x1b')],[_0xd664('0x26'),'id'])||{});}})[_0xd664('0x28')](function(_0x1a4d92){logger[_0xd664('0x21')](_0xd664('0x29'),_0x1816ab);logger[_0xd664('0x13')]('AddTags',_0x1816ab,JSON[_0xd664('0x22')](_0x1a4d92));_0xe49cd4(_0x1a4d92);})['catch'](function(_0x2dadb9){logger[_0xd664('0x15')]('AddTags',_0x2dadb9[_0xd664('0x16')],_0x1816ab);_0x2d4553(_this[_0xd664('0x15')](0x1f4,_0x2dadb9[_0xd664('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 59ddd2a..11d0710 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 _0x5d85=['./mailInteraction.events','save','remove','update','emit','removeListener','length','mailInteraction:'];(function(_0x469678,_0x1d1a31){var _0x3bd31c=function(_0x310f6f){while(--_0x310f6f){_0x469678['push'](_0x469678['shift']());}};_0x3bd31c(++_0x1d1a31);}(_0x5d85,0x170));var _0x55d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d85[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0x55d8('0x0'));var events=[_0x55d8('0x1'),_0x55d8('0x2'),_0x55d8('0x3')];function createListener(_0x50617f,_0x1f0718){return function(_0x40ad0a){_0x1f0718[_0x55d8('0x4')](_0x50617f,_0x40ad0a);};}function removeListener(_0x4bd6ce,_0x327469){return function(){MailInteractionEvents[_0x55d8('0x5')](_0x4bd6ce,_0x327469);};}exports['register']=function(_0x3724c9){for(var _0x3a55c8=0x0,_0x487572=events[_0x55d8('0x6')];_0x3a55c8<_0x487572;_0x3a55c8++){var _0x529d30=events[_0x3a55c8];var _0x4dd0d1=createListener(_0x55d8('0x7')+_0x529d30,_0x3724c9);MailInteractionEvents['on'](_0x529d30,_0x4dd0d1);}}; \ No newline at end of file +var _0x32e1=['mailInteraction:','./mailInteraction.events','remove','update','register'];(function(_0x14fe9f,_0x37e6f2){var _0x4cef94=function(_0x29e569){while(--_0x29e569){_0x14fe9f['push'](_0x14fe9f['shift']());}};_0x4cef94(++_0x37e6f2);}(_0x32e1,0xf6));var _0x132e=function(_0x4910f7,_0x48d0b4){_0x4910f7=_0x4910f7-0x0;var _0x550ee2=_0x32e1[_0x4910f7];return _0x550ee2;};'use strict';var MailInteractionEvents=require(_0x132e('0x0'));var events=['save',_0x132e('0x1'),_0x132e('0x2')];function createListener(_0x2c9149,_0x939d7c){return function(_0x54e209){_0x939d7c['emit'](_0x2c9149,_0x54e209);};}function removeListener(_0x1a0ebc,_0x451af1){return function(){MailInteractionEvents['removeListener'](_0x1a0ebc,_0x451af1);};}exports[_0x132e('0x3')]=function(_0x4c2903){for(var _0x11b3b4=0x0,_0x59ca39=events['length'];_0x11b3b4<_0x59ca39;_0x11b3b4++){var _0x371610=events[_0x11b3b4];var _0x43e068=createListener(_0x132e('0x4')+_0x371610,_0x4c2903);MailInteractionEvents['on'](_0x371610,_0x43e068);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2e53622..13b89c2 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 _0xb7f1=['/:id','show','/:id/download','post','mail','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','path','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe'];(function(_0x31a023,_0x2de5ef){var _0x547f52=function(_0x514587){while(--_0x514587){_0x31a023['push'](_0x31a023['shift']());}};_0x547f52(++_0x2de5ef);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x3fe103,_0x3cc565){_0x3fe103=_0x3fe103-0x0;var _0x1530e8=_0xb7f1[_0x3fe103];return _0x1530e8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b7f('0x0'));var timeout=require(_0x1b7f('0x1'));var express=require(_0x1b7f('0x2'));var router=express['Router']();var fs_extra=require(_0x1b7f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b7f('0x4'));var controller=require(_0x1b7f('0x5'));router['get']('/',auth[_0x1b7f('0x6')](),controller[_0x1b7f('0x7')]);router[_0x1b7f('0x8')](_0x1b7f('0x9'),auth[_0x1b7f('0x6')](),controller['describe']);router[_0x1b7f('0x8')](_0x1b7f('0xa'),auth[_0x1b7f('0x6')](),controller[_0x1b7f('0xb')]);router[_0x1b7f('0x8')](_0x1b7f('0xc'),auth[_0x1b7f('0x6')](),controller['download']);router[_0x1b7f('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x1b7f('0xe'),_0x1b7f('0xf')),controller[_0x1b7f('0x10')]);router[_0x1b7f('0x11')](_0x1b7f('0xa'),auth[_0x1b7f('0x6')](),controller['update']);router[_0x1b7f('0x11')](_0x1b7f('0x12'),auth[_0x1b7f('0x6')](),controller[_0x1b7f('0x13')]);router[_0x1b7f('0x11')](_0x1b7f('0x14'),auth[_0x1b7f('0x6')](),controller[_0x1b7f('0x15')]);router['delete']('/:id',auth[_0x1b7f('0x6')](),controller[_0x1b7f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x8ec7=['tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x8ec7[_0x4207f4];return _0x29a621;};'use strict';var multer=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var path=require('path');var timeout=require(_0x78ec('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x78ec('0x3'));var auth=require(_0x78ec('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78ec('0x5'));var controller=require(_0x78ec('0x6'));router[_0x78ec('0x7')]('/',auth[_0x78ec('0x8')](),controller[_0x78ec('0x9')]);router['get'](_0x78ec('0xa'),auth['isAuthenticated'](),controller[_0x78ec('0xb')]);router[_0x78ec('0x7')](_0x78ec('0xc'),auth['isAuthenticated'](),controller[_0x78ec('0xd')]);router[_0x78ec('0x7')](_0x78ec('0xe'),auth[_0x78ec('0x8')](),controller[_0x78ec('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x78ec('0x10')](_0x78ec('0x11'),_0x78ec('0x12')),controller['create']);router[_0x78ec('0x13')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x14')]);router[_0x78ec('0x13')](_0x78ec('0x15'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x16')]);router[_0x78ec('0x13')](_0x78ec('0x17'),auth[_0x78ec('0x8')](),controller['reject']);router[_0x78ec('0x18')](_0x78ec('0xc'),auth[_0x78ec('0x8')](),controller[_0x78ec('0x19')]);module[_0x78ec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1ebda04..95abb11 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 _0xf210=['lodash','TEXT','long','ENUM','out','STRING','DATE','BOOLEAN','Email','sequelize'];(function(_0x23e456,_0x482ae1){var _0x353cde=function(_0x30eae1){while(--_0x30eae1){_0x23e456['push'](_0x23e456['shift']());}};_0x353cde(++_0x482ae1);}(_0xf210,0x1d5));var _0x0f21=function(_0x532162,_0x5967f0){_0x532162=_0x532162-0x0;var _0x39c063=_0xf210[_0x532162];return _0x39c063;};'use strict';var Sequelize=require(_0x0f21('0x0'));var _=require(_0x0f21('0x1'));module['exports']={'body':{'type':Sequelize[_0x0f21('0x2')](_0x0f21('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0f21('0x4')]('in',_0x0f21('0x5')),'defaultValue':_0x0f21('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0f21('0x6')](0x1fe)},'from':{'type':Sequelize[_0x0f21('0x6')]},'to':{'type':Sequelize[_0x0f21('0x2')](_0x0f21('0x3'))},'cc':{'type':Sequelize[_0x0f21('0x2')](_0x0f21('0x3'))},'bcc':{'type':Sequelize[_0x0f21('0x2')](_0x0f21('0x3'))},'subject':{'type':Sequelize[_0x0f21('0x2')]},'sentAt':{'type':Sequelize[_0x0f21('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0f21('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0f21('0x7')]},'originTo':{'type':Sequelize[_0x0f21('0x2')]('long')},'originCc':{'type':Sequelize[_0x0f21('0x2')](_0x0f21('0x3'))},'originChannel':{'type':Sequelize[_0x0f21('0x4')](_0x0f21('0x9'),'Chat'),'defaultValue':_0x0f21('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0xfc73=['Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','DATE','INTEGER','ENUM'];(function(_0x38c8d7,_0x5370c7){var _0x5c5521=function(_0xad3828){while(--_0xad3828){_0x38c8d7['push'](_0x38c8d7['shift']());}};_0x5c5521(++_0x5370c7);}(_0xfc73,0x160));var _0x3fc7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfc73[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x3fc7('0x0'));var _=require(_0x3fc7('0x1'));module[_0x3fc7('0x2')]={'body':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x5'))},'read':{'type':Sequelize[_0x3fc7('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3fc7('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3fc7('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3fc7('0x8')]},'to':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3fc7('0x3')]},'sentAt':{'type':Sequelize[_0x3fc7('0x9')]},'attach':{'type':Sequelize[_0x3fc7('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3fc7('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3fc7('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x3fc7('0x4'))},'originCc':{'type':Sequelize[_0x3fc7('0x3')](_0x3fc7('0x4'))},'originChannel':{'type':Sequelize[_0x3fc7('0xb')](_0x3fc7('0xc'),_0x3fc7('0xd')),'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 686cc78..e3bdada 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 _0x8669=['from','bcc','subject','Attachment','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','push','readFileSync','writeFileSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','filters','options','body','find','destroy','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE: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','SELECT','contact','User','fullname','manual','interface','channel','accept','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','email','internal','SIP/%s','motionChannel','reject','fromString','rejectmessage','download','unix','toString','files','tmp','server'];(function(_0x1e5df0,_0x1aa134){var _0x564e0c=function(_0x4270a8){while(--_0x4270a8){_0x1e5df0['push'](_0x1e5df0['shift']());}};_0x564e0c(++_0x1aa134);}(_0x8669,0xb4));var _0x9866=function(_0x127731,_0xe9b93f){_0x127731=_0x127731-0x0;var _0x1d8cfb=_0x8669[_0x127731];return _0x1d8cfb;};'use strict';var emlformat=require(_0x9866('0x0'));var moment=require(_0x9866('0x1'));var BPromise=require(_0x9866('0x2'));var util=require(_0x9866('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x9866('0x4'));var Redis=require(_0x9866('0x5'));var htmlToText=require(_0x9866('0x6'));var qs=require(_0x9866('0x7'));var logger=require(_0x9866('0x8'))(_0x9866('0x9'));var interaction_log=require(_0x9866('0x8'))('mail-interactions');var config=require(_0x9866('0xa'));var db=require(_0x9866('0xb'))['db'];config[_0x9866('0xc')]=_[_0x9866('0xd')](config[_0x9866('0xc')],{'host':_0x9866('0xe'),'port':0x18eb});var socket=require(_0x9866('0xf'))(new Redis(config[_0x9866('0xc')]));var htmlEntities=require(_0x9866('0x10'));require(_0x9866('0x11'))[_0x9866('0x12')](socket);var jayson=require(_0x9866('0x13'));var client=jayson[_0x9866('0x14')][_0x9866('0x15')]({'port':0x232c});var client9003=jayson['client'][_0x9866('0x15')]({'port':0x232b});var client9002=jayson[_0x9866('0x14')][_0x9866('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4bedb3,_0x204e39,_0x915d77,_0x256a97){return new BPromise(function(_0x35098d,_0x475058){var _0x27e411=_0x256a97||client;return _0x27e411[_0x9866('0x16')](_0x4bedb3,_0x915d77)['then'](function(_0x14bd44){logger[_0x9866('0x17')]('MailMessage,\x20%s,\x20%s',_0x204e39,_0x9866('0x18'));logger[_0x9866('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x204e39,'request\x20sent',JSON[_0x9866('0x1a')](_0x14bd44));if(_0x14bd44[_0x9866('0x1b')]){if(_0x14bd44['error'][_0x9866('0x1c')]===0x1f4){logger[_0x9866('0x1b')](_0x9866('0x1d'),_0x204e39,_0x14bd44[_0x9866('0x1b')][_0x9866('0x1e')]);return _0x475058(_0x14bd44[_0x9866('0x1b')][_0x9866('0x1e')]);}logger[_0x9866('0x1b')](_0x9866('0x1d'),_0x204e39,_0x14bd44[_0x9866('0x1b')][_0x9866('0x1e')]);return _0x35098d(_0x14bd44['error'][_0x9866('0x1e')]);}else{logger[_0x9866('0x17')](_0x9866('0x1d'),_0x204e39,'request\x20sent');_0x35098d(_0x14bd44[_0x9866('0x1f')][_0x9866('0x1e')]);}})[_0x9866('0x20')](function(_0x18dd41){logger[_0x9866('0x1b')]('MailMessage,\x20%s,\x20%s',_0x204e39,_0x18dd41);_0x475058(_0x18dd41);});});}function respondWithResult(_0x35c908,_0x16cdae){_0x16cdae=_0x16cdae||0xc8;return function(_0xff7061){if(_0xff7061){return _0x35c908[_0x9866('0x21')](_0x16cdae)[_0x9866('0x22')](_0xff7061);}};}function respondWithFilteredResult(_0xc60683,_0x19285a){return function(_0x3d95c3){if(_0x3d95c3){var _0x141a83=typeof _0x19285a[_0x9866('0x23')]===_0x9866('0x24')&&typeof _0x19285a['limit']===_0x9866('0x24');var _0x40a12e=_0x3d95c3[_0x9866('0x25')];var _0x5dd2fc=_0x141a83?0x0:_0x19285a[_0x9866('0x23')];var _0x3c5a83=_0x141a83?_0x3d95c3['count']:_0x19285a[_0x9866('0x23')]+_0x19285a[_0x9866('0x26')];var _0x1abc47;if(_0x3c5a83>=_0x40a12e){_0x3c5a83=_0x40a12e;_0x1abc47=0xc8;}else{_0x1abc47=0xce;}_0xc60683['status'](_0x1abc47);return _0xc60683[_0x9866('0x27')](_0x9866('0x28'),_0x5dd2fc+'-'+_0x3c5a83+'/'+_0x40a12e)[_0x9866('0x22')](_0x3d95c3);}return null;};}function saveUpdates(_0x3e6e98){return function(_0x240de3){if(_0x240de3){return _0x240de3[_0x9866('0x29')](_0x3e6e98)[_0x9866('0x2a')](function(_0x2673c7){return _0x2673c7;});}return null;};}function removeEntity(_0x1c2485){return function(_0x282dc4){if(_0x282dc4){return _0x282dc4['destroy']()[_0x9866('0x2a')](function(){_0x1c2485['status'](0xcc)[_0x9866('0x2b')]();});}};}function handleEntityNotFound(_0x5474ce){return function(_0x2da74f){if(!_0x2da74f){_0x5474ce[_0x9866('0x2c')](0x194);}return _0x2da74f;};}function handleError(_0x304093,_0x36f235){_0x36f235=_0x36f235||0x1f4;return function(_0x26d0fd){logger['error'](_0x26d0fd[_0x9866('0x2d')]);if(_0x26d0fd['name']){delete _0x26d0fd[_0x9866('0x2e')];}_0x304093[_0x9866('0x21')](_0x36f235)['send'](_0x26d0fd);};}exports[_0x9866('0x2f')]=function(_0x36396c,_0x2128e8){var _0x11d24b={},_0x3862ae={},_0x33c376={'count':0x0,'rows':[]};var _0x113d02=_[_0x9866('0x30')](db[_0x9866('0x31')][_0x9866('0x32')],function(_0x53511d){return{'name':_0x53511d[_0x9866('0x33')],'type':_0x53511d[_0x9866('0x34')][_0x9866('0x35')]};});_0x3862ae[_0x9866('0x36')]=_['map'](_0x113d02,_0x9866('0x2e'));_0x3862ae['query']=_[_0x9866('0x37')](_0x36396c[_0x9866('0x38')]);_0x3862ae['filters']=_[_0x9866('0x39')](_0x3862ae['model'],_0x3862ae[_0x9866('0x38')]);_0x11d24b[_0x9866('0x3a')]=_[_0x9866('0x39')](_0x3862ae[_0x9866('0x36')],qs['fields'](_0x36396c[_0x9866('0x38')][_0x9866('0x3b')]));_0x11d24b[_0x9866('0x3a')]=_0x11d24b[_0x9866('0x3a')][_0x9866('0x3c')]?_0x11d24b[_0x9866('0x3a')]:_0x3862ae[_0x9866('0x36')];if(!_0x36396c[_0x9866('0x38')][_0x9866('0x3d')](_0x9866('0x3e'))){_0x11d24b['limit']=qs['limit'](_0x36396c[_0x9866('0x38')][_0x9866('0x26')]);_0x11d24b[_0x9866('0x23')]=qs[_0x9866('0x23')](_0x36396c[_0x9866('0x38')]['offset']);}_0x11d24b[_0x9866('0x3f')]=qs[_0x9866('0x40')](_0x36396c[_0x9866('0x38')][_0x9866('0x40')]);_0x11d24b[_0x9866('0x41')]=qs['filters'](_[_0x9866('0x42')](_0x36396c[_0x9866('0x38')],_0x3862ae['filters']),_0x113d02);if(_0x36396c[_0x9866('0x38')][_0x9866('0x43')]){_0x11d24b[_0x9866('0x41')]=_[_0x9866('0x44')](_0x11d24b[_0x9866('0x41')],{'$or':_[_0x9866('0x30')](_0x113d02,function(_0x51ff05){if(_0x51ff05['type']!==_0x9866('0x45')){var _0x1e6071={};_0x1e6071[_0x51ff05[_0x9866('0x2e')]]={'$like':'%'+_0x36396c[_0x9866('0x38')]['filter']+'%'};return _0x1e6071;}})});}_0x11d24b=_[_0x9866('0x44')]({},_0x11d24b,_0x36396c['options']);var _0x309b6c={'where':_0x11d24b['where']};return db['MailMessage'][_0x9866('0x25')](_0x309b6c)[_0x9866('0x2a')](function(_0x5ddfa1){_0x33c376[_0x9866('0x25')]=_0x5ddfa1;if(_0x36396c[_0x9866('0x38')][_0x9866('0x46')]){_0x11d24b[_0x9866('0x47')]=[{'all':!![]}];}return db[_0x9866('0x31')][_0x9866('0x48')](_0x11d24b);})[_0x9866('0x2a')](function(_0x17775f){_0x33c376[_0x9866('0x49')]=_0x17775f;return _0x33c376;})[_0x9866('0x2a')](respondWithFilteredResult(_0x2128e8,_0x11d24b))['catch'](handleError(_0x2128e8,null));};exports[_0x9866('0x4a')]=function(_0x53b32f,_0x438587){var _0x2a4a08={'raw':!![],'where':{'id':_0x53b32f[_0x9866('0x4b')]['id']}},_0x402d6f={};_0x402d6f[_0x9866('0x36')]=_[_0x9866('0x37')](db[_0x9866('0x31')][_0x9866('0x32')]);_0x402d6f[_0x9866('0x38')]=_[_0x9866('0x37')](_0x53b32f[_0x9866('0x38')]);_0x402d6f[_0x9866('0x4c')]=_[_0x9866('0x39')](_0x402d6f[_0x9866('0x36')],_0x402d6f[_0x9866('0x38')]);_0x2a4a08[_0x9866('0x3a')]=_[_0x9866('0x39')](_0x402d6f[_0x9866('0x36')],qs[_0x9866('0x3b')](_0x53b32f[_0x9866('0x38')]['fields']));_0x2a4a08[_0x9866('0x3a')]=_0x2a4a08[_0x9866('0x3a')][_0x9866('0x3c')]?_0x2a4a08[_0x9866('0x3a')]:_0x402d6f[_0x9866('0x36')];if(_0x53b32f[_0x9866('0x38')][_0x9866('0x46')]){_0x2a4a08[_0x9866('0x47')]=[{'all':!![]}];}_0x2a4a08=_[_0x9866('0x44')]({},_0x2a4a08,_0x53b32f[_0x9866('0x4d')]);return db[_0x9866('0x31')]['find'](_0x2a4a08)[_0x9866('0x2a')](handleEntityNotFound(_0x438587,null))[_0x9866('0x2a')](respondWithResult(_0x438587,null))[_0x9866('0x20')](handleError(_0x438587,null));};exports['update']=function(_0x387b12,_0x6377a4){if(_0x387b12[_0x9866('0x4e')]['id']){delete _0x387b12['body']['id'];}return db[_0x9866('0x31')][_0x9866('0x4f')]({'where':{'id':_0x387b12['params']['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x6377a4,null))[_0x9866('0x2a')](saveUpdates(_0x387b12[_0x9866('0x4e')],null))[_0x9866('0x2a')](respondWithResult(_0x6377a4,null))['catch'](handleError(_0x6377a4,null));};exports[_0x9866('0x50')]=function(_0xc0d4ba,_0x150d39){return db[_0x9866('0x31')]['find']({'where':{'id':_0xc0d4ba[_0x9866('0x4b')]['id']}})[_0x9866('0x2a')](handleEntityNotFound(_0x150d39,null))['then'](removeEntity(_0x150d39,null))[_0x9866('0x20')](handleError(_0x150d39,null));};exports[_0x9866('0x51')]=function(_0x5949bd,_0x46c0b8){return db[_0x9866('0x31')]['describe']()['then'](respondWithResult(_0x46c0b8,null))['catch'](handleError(_0x46c0b8,null));};exports[_0x9866('0x52')]=function(_0x3cd362,_0x19214d){return db[_0x9866('0x31')][_0x9866('0x52')](_0x3cd362[_0x9866('0x4e')])[_0x9866('0x2a')](function(_0x12a3a0){if(_0x12a3a0){if(_0x12a3a0[_0x9866('0x53')]===_0x9866('0x54')&&!_0x12a3a0[_0x9866('0x55')]){var _0x5a36d3,_0x3811d0,_0x3d1931;if(_0x3cd362[_0x9866('0x4e')]['to']){_0x3811d0=_0x3cd362['body']['to']['split'](',')[0x0];}return db[_0x9866('0x56')][_0x9866('0x57')]({'where':{'id':_0x12a3a0[_0x9866('0x58')]},'include':[{'model':db[_0x9866('0x59')],'as':'List','include':[{'model':db[_0x9866('0x5a')],'as':'Contacts','where':{'email':_0x3811d0},'limit':0x1,'order':[[_0x9866('0x5b'),_0x9866('0x5c')]]}]},{'model':db[_0x9866('0x5d')],'as':_0x9866('0x5e'),'raw':!![],'include':[{'model':db[_0x9866('0x5f')],'as':'CloudProvider','raw':!![]}]}]})[_0x9866('0x2a')](function(_0x338d4b){_0x5a36d3=_0x338d4b;if(!_0x5a36d3||!_0x5a36d3[_0x9866('0x5e')])return;var _0x54401d=_0x5a36d3[_0x9866('0x60')]();if(_0x3cd362[_0x9866('0x4e')][_0x9866('0x61')]&&_0x3cd362[_0x9866('0x4e')][_0x9866('0x61')][_0x9866('0x3c')]){for(var _0x129369=0x0;_0x129369<_0x3cd362[_0x9866('0x4e')][_0x9866('0x61')][_0x9866('0x3c')];_0x129369+=0x1){_0x3cd362['body'][_0x9866('0x61')][_0x129369]={'filename':_0x3cd362[_0x9866('0x4e')]['attachments'][_0x129369][_0x9866('0x2e')],'path':path[_0x9866('0x62')](config[_0x9866('0x63')],_0x9866('0x64'),_0x3cd362['body']['attachments'][_0x129369][_0x9866('0x65')])};}}_0x3d1931={'account':_0x54401d,'message':_0x3cd362[_0x9866('0x4e')]};return;})[_0x9866('0x2a')](function(){if(_0x5a36d3[_0x9866('0x66')]){if(_0x5a36d3[_0x9866('0x66')][_0x9866('0x67')][_0x9866('0x3c')]){return _0x5a36d3[_0x9866('0x66')][_0x9866('0x67')][0x0];}else{return db[_0x9866('0x5a')]['create'](_[_0x9866('0xd')](_0x3cd362[_0x9866('0x4e')],{'firstName':_0x3cd362[_0x9866('0x4e')]['to'],'email':_0x3cd362[_0x9866('0x4e')]['to'],'phone':_0x3cd362['body']['to'],'ListId':_0x5a36d3[_0x9866('0x68')]}));}}else{throw new Error(_0x9866('0x69'));}})[_0x9866('0x2a')](function(){if(_0x3d1931){return respondWithRpcPromise(_0x9866('0x6a'),_0x9866('0x6b'),_0x3d1931,client9003)['then'](function(_0x3a7999){return _0x12a3a0['update']({'read':!![],'messageId':_0x3a7999[_0x9866('0x6c')],'sentAt':moment()[_0x9866('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x9866('0x20')](function(_0x41654f){logger[_0x9866('0x1b')]('%s',JSON[_0x9866('0x1a')](_0x41654f));return _0x12a3a0;});}return _0x12a3a0;});}return _0x12a3a0;}})[_0x9866('0x2a')](respondWithResult(_0x19214d,0xc9))[_0x9866('0x20')](handleError(_0x19214d,null));};exports['accept']=function(_0x1a499f,_0x215406){var _0x1eb8fc={'agent':{},'channel':_0x9866('0x6e')};if(_0x1a499f[_0x9866('0x4e')]['id']){delete _0x1a499f['body']['id'];}_0x1a499f[_0x9866('0x4e')][_0x9866('0x6f')]=!![];_0x1a499f[_0x9866('0x4e')][_0x9866('0x70')]=moment()[_0x9866('0x6d')](_0x9866('0x71'));_0x1a499f[_0x9866('0x4e')]['UserId']=_0x1a499f['body'][_0x9866('0x72')]||_0x1a499f[_0x9866('0x73')]['id'];_0x1eb8fc[_0x9866('0x74')]['id']=_0x1a499f['body'][_0x9866('0x72')];return db['MailMessage'][_0x9866('0x4f')]({'where':{'id':_0x1a499f[_0x9866('0x4b')]['id'],'UserId':null}})[_0x9866('0x2a')](handleEntityNotFound(_0x215406,null))[_0x9866('0x2a')](saveUpdates(_0x1a499f[_0x9866('0x4e')],null))[_0x9866('0x2a')](function(_0x387725){if(_0x387725){_0x1eb8fc['message']=_0x387725[_0x9866('0x75')]({'plain':!![]});return db[_0x9866('0x76')][_0x9866('0x4f')]({'where':{'id':_0x387725[_0x9866('0x77')]}});}return null;})['then'](handleEntityNotFound(_0x215406,null))[_0x9866('0x2a')](function(_0x12aa41){if(_0x12aa41){return _0x12aa41[_0x9866('0x29')]({'UserId':_0x1a499f[_0x9866('0x4e')][_0x9866('0x72')],'read1stAt':_[_0x9866('0x78')](_0x12aa41[_0x9866('0x79')])?moment()[_0x9866('0x6d')](_0x9866('0x71')):undefined});}return null;})[_0x9866('0x2a')](function(_0x7d6480){if(_0x7d6480){_0x1eb8fc[_0x9866('0x7a')]=_0x7d6480[_0x9866('0x75')]({'plain':!![]});interaction_log[_0x9866('0x17')](_0x9866('0x7b'),_0x1a499f[_0x9866('0x73')]['id'],_0x1a499f[_0x9866('0x73')]['name'],_0x1a499f[_0x9866('0x73')][_0x9866('0x7c')],_0x1eb8fc[_0x9866('0x7a')]['id'],_0x1a499f[_0x9866('0x4e')]?JSON['stringify'](_0x1a499f['body']):_0x9866('0x7d'));return respondWithRpcPromise(_0x9866('0x7e'),'acceptMessage',_0x1eb8fc);}return null;})[_0x9866('0x2a')](function(_0xf48680){var _0x368317=_0x9866('0x7f')+_0xf48680['message'][_0x9866('0x80')];return db[_0x9866('0x81')][_0x9866('0x38')](_0x368317,{'type':db['Sequelize']['QueryTypes'][_0x9866('0x82')],'raw':!![]})[_0x9866('0x2a')](function(_0x6b119){return _0x6b119;});})[_0x9866('0x2a')](function(_0x8d0b2a){if(_0x8d0b2a){_0x1eb8fc[_0x9866('0x1e')][_0x9866('0x83')]=_0x8d0b2a[0x0];if(!_0x1a499f[_0x9866('0x4e')]['UserId'])return;return db[_0x9866('0x84')][_0x9866('0x4f')]({'where':{'id':_0x1a499f[_0x9866('0x4e')][_0x9866('0x72')],'role':_0x9866('0x74')},'attributes':['id',_0x9866('0x2e'),_0x9866('0x85'),'email','internal'],'raw':!![]});}return null;})[_0x9866('0x2a')](function(_0x3c52c9){if(!_0x3c52c9)return null;_0x1eb8fc[_0x9866('0x1e')][_0x9866('0x74')]=_0x3c52c9;return _0x1eb8fc;})[_0x9866('0x2a')](function(_0x1ff844){if(_0x1ff844){if(_0x1a499f[_0x9866('0x4e')][_0x9866('0x86')]){_0x1eb8fc[_0x9866('0x1e')][_0x9866('0x87')]=util['format']('SIP/%s',_0x1a499f[_0x9866('0x73')][_0x9866('0x2e')]);_0x1eb8fc[_0x9866('0x1e')]['channel']=_0x1eb8fc[_0x9866('0x88')];_0x1eb8fc[_0x9866('0x1e')]['motionChannel']=_0x1eb8fc[_0x9866('0x88')];_0x1eb8fc[_0x9866('0x1e')]['event']=_0x9866('0x89');_0x1eb8fc[_0x9866('0x1e')][_0x9866('0x4e')]=htmlToText['fromString'](_0x1eb8fc[_0x9866('0x1e')]['body']);return respondWithRpcPromise('EventManager',_0x9866('0x8a'),{'event':_0x9866('0x8b'),'message':_0x1eb8fc[_0x9866('0x1e')]},client9002)[_0x9866('0x2a')](function(){return _0x1eb8fc;});}return _0x1eb8fc;}return null;})[_0x9866('0x2a')](respondWithResult(_0x215406,null))[_0x9866('0x20')](handleError(_0x215406,null));};exports['reject']=function(_0x5cab81,_0x47cffb){var _0x132181={'agent':{},'channel':_0x9866('0x6e')};if(_0x5cab81[_0x9866('0x4e')]['id']){delete _0x5cab81[_0x9866('0x4e')]['id'];}_0x5cab81[_0x9866('0x4e')]['UserId']=_0x5cab81[_0x9866('0x4e')]['UserId']||_0x5cab81[_0x9866('0x73')]['id'];_0x132181[_0x9866('0x74')]['id']=_0x5cab81[_0x9866('0x4e')][_0x9866('0x72')];return db[_0x9866('0x31')][_0x9866('0x4f')]({'where':{'id':_0x5cab81[_0x9866('0x4b')]['id'],'UserId':null}})[_0x9866('0x2a')](handleEntityNotFound(_0x47cffb,null))[_0x9866('0x2a')](function(_0x2cf080){if(_0x2cf080){_0x132181[_0x9866('0x1e')]=_0x2cf080['get']({'plain':!![]});return db['MailInteraction'][_0x9866('0x4f')]({'where':{'id':_0x2cf080['MailInteractionId']}});}return null;})[_0x9866('0x2a')](handleEntityNotFound(_0x47cffb,null))[_0x9866('0x2a')](function(_0x50a694){if(_0x50a694){_0x132181['interaction']=_0x50a694['get']({'plain':!![]});interaction_log[_0x9866('0x17')](_0x9866('0x8c'),_0x5cab81[_0x9866('0x73')]['id'],_0x5cab81[_0x9866('0x73')]['name'],_0x5cab81[_0x9866('0x73')][_0x9866('0x7c')],_0x132181[_0x9866('0x7a')]['id'],_0x5cab81[_0x9866('0x4e')]?JSON['stringify'](_0x5cab81['body']):_0x9866('0x7d'));return respondWithRpcPromise('RejectMessage',_0x9866('0x8d'),_0x132181);}return null;})['then'](function(_0x1b511a){var _0x34a545=_0x9866('0x7f')+_0x1b511a['message']['ContactId'];return db['sequelize'][_0x9866('0x38')](_0x34a545,{'type':db[_0x9866('0x8e')]['QueryTypes'][_0x9866('0x82')],'raw':!![]})[_0x9866('0x2a')](function(_0x1d69c5){return _0x1d69c5;});})[_0x9866('0x2a')](function(_0x31b896){if(_0x31b896){_0x132181['message'][_0x9866('0x83')]=_0x31b896[0x0];if(!_0x5cab81[_0x9866('0x4e')][_0x9866('0x72')])return;return db[_0x9866('0x84')][_0x9866('0x4f')]({'where':{'id':_0x5cab81['body']['UserId'],'role':'agent'},'attributes':['id',_0x9866('0x2e'),_0x9866('0x85'),_0x9866('0x8f'),_0x9866('0x90')],'raw':!![]});}return null;})[_0x9866('0x2a')](function(_0x3bd032){if(!_0x3bd032)return null;_0x132181[_0x9866('0x1e')]['agent']=_0x3bd032;return _0x132181;})[_0x9866('0x2a')](function(_0x14dde3){if(_0x14dde3){_0x14dde3['message']['interface']=util[_0x9866('0x6d')](_0x9866('0x91'),_0x5cab81[_0x9866('0x73')]['name']);_0x14dde3[_0x9866('0x1e')][_0x9866('0x88')]=_0x132181[_0x9866('0x88')];_0x14dde3[_0x9866('0x1e')][_0x9866('0x92')]=_0x132181[_0x9866('0x88')];_0x14dde3[_0x9866('0x1e')]['event']=_0x9866('0x93');_0x14dde3[_0x9866('0x1e')]['body']=htmlToText[_0x9866('0x94')](_0x132181[_0x9866('0x1e')][_0x9866('0x4e')]);respondWithRpcPromise('EventManager',_0x9866('0x8a'),{'event':_0x9866('0x95'),'message':_0x14dde3[_0x9866('0x1e')]},client9002);return _0x132181;}return null;})[_0x9866('0x2a')](respondWithResult(_0x47cffb,null))['catch'](handleError(_0x47cffb,null));};exports[_0x9866('0x96')]=function(_0x6089f9,_0xa19d94){var _0x276c51=moment()[_0x9866('0x97')]()[_0x9866('0x98')]();var _0x1e8282=path[_0x9866('0x62')](config[_0x9866('0x63')],'server',_0x9866('0x99'),_0x9866('0x9a'));var _0x1548f1=path[_0x9866('0x62')](config['root'],_0x9866('0x9b'),_0x9866('0x99'),_0x9866('0x61'));var _0x1d39e8=util[_0x9866('0x6d')]('message-%s.eml',_0x276c51);return db[_0x9866('0x31')][_0x9866('0x4f')]({'where':{'id':_0x6089f9['params']['id']},'attributes':['id',_0x9866('0x4e'),_0x9866('0x9c'),'to','cc',_0x9866('0x9d'),_0x9866('0x9e'),'createdAt'],'include':_0x6089f9['query'][_0x9866('0x61')]?[{'model':db[_0x9866('0x9f')],'as':'Attachments'}]:undefined})[_0x9866('0x2a')](handleEntityNotFound(_0xa19d94,null))['then'](function(_0xd6683e){if(_0xd6683e){var _0x24cb44=_0xd6683e;var _0x29056e={'from':_0x24cb44[_0x9866('0x9c')],'to':_0x24cb44['to'],'subject':_0x24cb44[_0x9866('0x9e')],'html':htmlEntities[_0x9866('0xa0')](_0x24cb44[_0x9866('0x4e')]),'headers':{'Date':moment(_0x24cb44[_0x9866('0xa1')])[_0x9866('0x6d')](_0x9866('0xa2'))},'attachments':[]};if(_0xd6683e['cc']){_0x29056e[_0x9866('0xa3')]['Cc']=_0xd6683e['cc'];}if(_0xd6683e[_0x9866('0x9d')]){_0x29056e[_0x9866('0xa3')]['Bcc']=_0xd6683e[_0x9866('0x9d')];}return new BPromise(function(_0x2a3688,_0x5c5680){if(_0xd6683e[_0x9866('0xa4')]){for(var _0x529f92=0x0;_0x529f92<_0xd6683e[_0x9866('0xa4')]['length'];_0x529f92++){var _0x53356c=_0xd6683e[_0x9866('0xa4')][_0x529f92];var _0x596105=path[_0x9866('0x62')](_0x1548f1,_0x53356c[_0x9866('0x65')]);if(fs['existsSync'](_0x596105)){_0x29056e[_0x9866('0x61')][_0x9866('0xa5')]({'name':_0x53356c[_0x9866('0x2e')],'contentType':_0x53356c[_0x9866('0x34')],'data':fs[_0x9866('0xa6')](_0x596105)});}}}emlformat['build'](_0x29056e,function(_0xe2f837,_0x28a510){if(_0xe2f837)return _0x5c5680(_0xe2f837);fs[_0x9866('0xa7')](path['join'](_0x1e8282,_0x1d39e8),_0x28a510);return _0x2a3688(_0x28a510);});});}})[_0x9866('0x2a')](function(_0x27ed6f){if(_0x27ed6f){return _0xa19d94[_0x9866('0x96')](path[_0x9866('0x62')](_0x1e8282,_0x1d39e8),_0x1d39e8,function(_0x54e23c){if(!_0x54e23c)fs['unlinkSync'](path[_0x9866('0x62')](_0x1e8282,_0x1d39e8));});}})[_0x9866('0x20')](handleError(_0xa19d94,null));}; \ No newline at end of file +var _0xdd38=['rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','update','body','find','describe','create','direction','out','secret','split','MailAccountId','CmList','List','updatedAt','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','CmContact','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','MailInteractionId','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','interaction','fullname','event'];(function(_0x5b089b,_0x575be6){var _0x56d66c=function(_0x438842){while(--_0x438842){_0x5b089b['push'](_0x5b089b['shift']());}};_0x56d66c(++_0x575be6);}(_0xdd38,0x14b));var _0x8dd3=function(_0x442a5d,_0x2a6745){_0x442a5d=_0x442a5d-0x0;var _0x51d134=_0xdd38[_0x442a5d];return _0x51d134;};'use strict';var emlformat=require(_0x8dd3('0x0'));var moment=require(_0x8dd3('0x1'));var BPromise=require(_0x8dd3('0x2'));var util=require(_0x8dd3('0x3'));var path=require(_0x8dd3('0x4'));var fs=require('fs');var _=require(_0x8dd3('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x8dd3('0x6'));var qs=require(_0x8dd3('0x7'));var logger=require(_0x8dd3('0x8'))(_0x8dd3('0x9'));var interaction_log=require(_0x8dd3('0x8'))(_0x8dd3('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8dd3('0xb')](config['redis'],{'host':_0x8dd3('0xc'),'port':0x18eb});var socket=require(_0x8dd3('0xd'))(new Redis(config[_0x8dd3('0xe')]));var htmlEntities=require('html-entities');require(_0x8dd3('0xf'))['register'](socket);var jayson=require(_0x8dd3('0x10'));var client=jayson['client'][_0x8dd3('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x8dd3('0x11')]({'port':0x232b});var client9002=jayson[_0x8dd3('0x12')][_0x8dd3('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x3a84d2,_0x579f93,_0x113787,_0x34acc5){return new BPromise(function(_0x192f08,_0x40bcc5){var _0x135165=_0x34acc5||client;return _0x135165['request'](_0x3a84d2,_0x113787)[_0x8dd3('0x13')](function(_0x1906b9){logger[_0x8dd3('0x14')](_0x8dd3('0x15'),_0x579f93,'request\x20sent');logger[_0x8dd3('0x16')](_0x8dd3('0x17'),_0x579f93,_0x8dd3('0x18'),JSON[_0x8dd3('0x19')](_0x1906b9));if(_0x1906b9[_0x8dd3('0x1a')]){if(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1b')]===0x1f4){logger[_0x8dd3('0x1a')](_0x8dd3('0x15'),_0x579f93,_0x1906b9['error'][_0x8dd3('0x1c')]);return _0x40bcc5(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1c')]);}logger[_0x8dd3('0x1a')]('MailMessage,\x20%s,\x20%s',_0x579f93,_0x1906b9[_0x8dd3('0x1a')]['message']);return _0x192f08(_0x1906b9[_0x8dd3('0x1a')][_0x8dd3('0x1c')]);}else{logger['info'](_0x8dd3('0x15'),_0x579f93,_0x8dd3('0x18'));_0x192f08(_0x1906b9[_0x8dd3('0x1d')][_0x8dd3('0x1c')]);}})[_0x8dd3('0x1e')](function(_0x4a6fbf){logger[_0x8dd3('0x1a')](_0x8dd3('0x15'),_0x579f93,_0x4a6fbf);_0x40bcc5(_0x4a6fbf);});});}function respondWithResult(_0xbf37d6,_0x151a1c){_0x151a1c=_0x151a1c||0xc8;return function(_0x1da3e6){if(_0x1da3e6){return _0xbf37d6['status'](_0x151a1c)[_0x8dd3('0x1f')](_0x1da3e6);}};}function respondWithFilteredResult(_0x262495,_0x54217e){return function(_0x1a0f62){if(_0x1a0f62){var _0x222491=typeof _0x54217e[_0x8dd3('0x20')]===_0x8dd3('0x21')&&typeof _0x54217e[_0x8dd3('0x22')]===_0x8dd3('0x21');var _0x55c234=_0x1a0f62[_0x8dd3('0x23')];var _0x2c6004=_0x222491?0x0:_0x54217e[_0x8dd3('0x20')];var _0x32ef34=_0x222491?_0x1a0f62[_0x8dd3('0x23')]:_0x54217e[_0x8dd3('0x20')]+_0x54217e[_0x8dd3('0x22')];var _0x1ba35c;if(_0x32ef34>=_0x55c234){_0x32ef34=_0x55c234;_0x1ba35c=0xc8;}else{_0x1ba35c=0xce;}_0x262495[_0x8dd3('0x24')](_0x1ba35c);return _0x262495[_0x8dd3('0x25')](_0x8dd3('0x26'),_0x2c6004+'-'+_0x32ef34+'/'+_0x55c234)['json'](_0x1a0f62);}return null;};}function saveUpdates(_0x5eea37){return function(_0xecf159){if(_0xecf159){return _0xecf159['update'](_0x5eea37)['then'](function(_0x31a90d){return _0x31a90d;});}return null;};}function removeEntity(_0x1e73fa){return function(_0xb91a1e){if(_0xb91a1e){return _0xb91a1e[_0x8dd3('0x27')]()[_0x8dd3('0x13')](function(){_0x1e73fa[_0x8dd3('0x24')](0xcc)[_0x8dd3('0x28')]();});}};}function handleEntityNotFound(_0x2aa3c2){return function(_0x1072df){if(!_0x1072df){_0x2aa3c2[_0x8dd3('0x29')](0x194);}return _0x1072df;};}function handleError(_0x158c55,_0x1d38f0){_0x1d38f0=_0x1d38f0||0x1f4;return function(_0x37fae3){logger[_0x8dd3('0x1a')](_0x37fae3[_0x8dd3('0x2a')]);if(_0x37fae3[_0x8dd3('0x2b')]){delete _0x37fae3[_0x8dd3('0x2b')];}_0x158c55['status'](_0x1d38f0)[_0x8dd3('0x2c')](_0x37fae3);};}exports[_0x8dd3('0x2d')]=function(_0x46c051,_0x157ace){var _0x721fd0={},_0x95ca0e={},_0x30cd61={'count':0x0,'rows':[]};var _0x332cf3=_[_0x8dd3('0x2e')](db[_0x8dd3('0x2f')]['rawAttributes'],function(_0x55ec5b){return{'name':_0x55ec5b[_0x8dd3('0x30')],'type':_0x55ec5b[_0x8dd3('0x31')]['key']};});_0x95ca0e[_0x8dd3('0x32')]=_['map'](_0x332cf3,_0x8dd3('0x2b'));_0x95ca0e[_0x8dd3('0x33')]=_[_0x8dd3('0x34')](_0x46c051[_0x8dd3('0x33')]);_0x95ca0e[_0x8dd3('0x35')]=_[_0x8dd3('0x36')](_0x95ca0e['model'],_0x95ca0e[_0x8dd3('0x33')]);_0x721fd0['attributes']=_[_0x8dd3('0x36')](_0x95ca0e[_0x8dd3('0x32')],qs[_0x8dd3('0x37')](_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x37')]));_0x721fd0[_0x8dd3('0x38')]=_0x721fd0[_0x8dd3('0x38')][_0x8dd3('0x39')]?_0x721fd0[_0x8dd3('0x38')]:_0x95ca0e['model'];if(!_0x46c051['query']['hasOwnProperty'](_0x8dd3('0x3a'))){_0x721fd0['limit']=qs[_0x8dd3('0x22')](_0x46c051['query'][_0x8dd3('0x22')]);_0x721fd0[_0x8dd3('0x20')]=qs['offset'](_0x46c051[_0x8dd3('0x33')]['offset']);}_0x721fd0[_0x8dd3('0x3b')]=qs[_0x8dd3('0x3c')](_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3c')]);_0x721fd0[_0x8dd3('0x3d')]=qs[_0x8dd3('0x35')](_['pick'](_0x46c051[_0x8dd3('0x33')],_0x95ca0e[_0x8dd3('0x35')]),_0x332cf3);if(_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3e')]){_0x721fd0[_0x8dd3('0x3d')]=_['merge'](_0x721fd0[_0x8dd3('0x3d')],{'$or':_['map'](_0x332cf3,function(_0x2ade2c){if(_0x2ade2c[_0x8dd3('0x31')]!=='VIRTUAL'){var _0x58e86b={};_0x58e86b[_0x2ade2c[_0x8dd3('0x2b')]]={'$like':'%'+_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3e')]+'%'};return _0x58e86b;}})});}_0x721fd0=_['merge']({},_0x721fd0,_0x46c051['options']);var _0x57c7ef={'where':_0x721fd0[_0x8dd3('0x3d')]};return db[_0x8dd3('0x2f')][_0x8dd3('0x23')](_0x57c7ef)['then'](function(_0x3682a2){_0x30cd61[_0x8dd3('0x23')]=_0x3682a2;if(_0x46c051[_0x8dd3('0x33')][_0x8dd3('0x3f')]){_0x721fd0[_0x8dd3('0x40')]=[{'all':!![]}];}return db[_0x8dd3('0x2f')][_0x8dd3('0x41')](_0x721fd0);})['then'](function(_0x5c13d8){_0x30cd61[_0x8dd3('0x42')]=_0x5c13d8;return _0x30cd61;})['then'](respondWithFilteredResult(_0x157ace,_0x721fd0))['catch'](handleError(_0x157ace,null));};exports[_0x8dd3('0x43')]=function(_0x3034b9,_0x17e6a4){var _0x52e3eb={'raw':!![],'where':{'id':_0x3034b9[_0x8dd3('0x44')]['id']}},_0x50e1c9={};_0x50e1c9[_0x8dd3('0x32')]=_[_0x8dd3('0x34')](db[_0x8dd3('0x2f')][_0x8dd3('0x45')]);_0x50e1c9[_0x8dd3('0x33')]=_[_0x8dd3('0x34')](_0x3034b9[_0x8dd3('0x33')]);_0x50e1c9[_0x8dd3('0x35')]=_['intersection'](_0x50e1c9[_0x8dd3('0x32')],_0x50e1c9[_0x8dd3('0x33')]);_0x52e3eb[_0x8dd3('0x38')]=_[_0x8dd3('0x36')](_0x50e1c9['model'],qs['fields'](_0x3034b9['query'][_0x8dd3('0x37')]));_0x52e3eb[_0x8dd3('0x38')]=_0x52e3eb[_0x8dd3('0x38')]['length']?_0x52e3eb[_0x8dd3('0x38')]:_0x50e1c9['model'];if(_0x3034b9[_0x8dd3('0x33')][_0x8dd3('0x3f')]){_0x52e3eb[_0x8dd3('0x40')]=[{'all':!![]}];}_0x52e3eb=_['merge']({},_0x52e3eb,_0x3034b9[_0x8dd3('0x46')]);return db[_0x8dd3('0x2f')]['find'](_0x52e3eb)[_0x8dd3('0x13')](handleEntityNotFound(_0x17e6a4,null))[_0x8dd3('0x13')](respondWithResult(_0x17e6a4,null))['catch'](handleError(_0x17e6a4,null));};exports[_0x8dd3('0x47')]=function(_0x39500d,_0x434d4f){if(_0x39500d[_0x8dd3('0x48')]['id']){delete _0x39500d[_0x8dd3('0x48')]['id'];}return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x39500d['params']['id']}})[_0x8dd3('0x13')](handleEntityNotFound(_0x434d4f,null))[_0x8dd3('0x13')](saveUpdates(_0x39500d[_0x8dd3('0x48')],null))['then'](respondWithResult(_0x434d4f,null))['catch'](handleError(_0x434d4f,null));};exports[_0x8dd3('0x27')]=function(_0x36d560,_0x4107f0){return db['MailMessage'][_0x8dd3('0x49')]({'where':{'id':_0x36d560[_0x8dd3('0x44')]['id']}})[_0x8dd3('0x13')](handleEntityNotFound(_0x4107f0,null))['then'](removeEntity(_0x4107f0,null))[_0x8dd3('0x1e')](handleError(_0x4107f0,null));};exports[_0x8dd3('0x4a')]=function(_0x4c0c92,_0x4a55a2){return db['MailMessage'][_0x8dd3('0x4a')]()[_0x8dd3('0x13')](respondWithResult(_0x4a55a2,null))['catch'](handleError(_0x4a55a2,null));};exports[_0x8dd3('0x4b')]=function(_0x1c01ad,_0x149e65){return db[_0x8dd3('0x2f')][_0x8dd3('0x4b')](_0x1c01ad[_0x8dd3('0x48')])[_0x8dd3('0x13')](function(_0x515650){if(_0x515650){if(_0x515650[_0x8dd3('0x4c')]===_0x8dd3('0x4d')&&!_0x515650[_0x8dd3('0x4e')]){var _0x26207d,_0x2561e7,_0x585670;if(_0x1c01ad[_0x8dd3('0x48')]['to']){_0x2561e7=_0x1c01ad[_0x8dd3('0x48')]['to'][_0x8dd3('0x4f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x515650[_0x8dd3('0x50')]},'include':[{'model':db[_0x8dd3('0x51')],'as':_0x8dd3('0x52'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x2561e7},'limit':0x1,'order':[[_0x8dd3('0x53'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8dd3('0x54')],'as':_0x8dd3('0x54'),'raw':!![]}]}]})[_0x8dd3('0x13')](function(_0x534155){_0x26207d=_0x534155;if(!_0x26207d||!_0x26207d[_0x8dd3('0x55')])return;var _0x25248c=_0x26207d[_0x8dd3('0x56')]();if(_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')]&&_0x1c01ad['body'][_0x8dd3('0x57')]['length']){for(var _0x2bd061=0x0;_0x2bd061<_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x8dd3('0x39')];_0x2bd061+=0x1){_0x1c01ad['body'][_0x8dd3('0x57')][_0x2bd061]={'filename':_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x2bd061][_0x8dd3('0x2b')],'path':path[_0x8dd3('0x58')](config[_0x8dd3('0x59')],_0x8dd3('0x5a'),_0x1c01ad[_0x8dd3('0x48')][_0x8dd3('0x57')][_0x2bd061][_0x8dd3('0x5b')])};}}_0x585670={'account':_0x25248c,'message':_0x1c01ad[_0x8dd3('0x48')]};return;})['then'](function(){if(_0x26207d[_0x8dd3('0x52')]){if(_0x26207d[_0x8dd3('0x52')][_0x8dd3('0x5c')][_0x8dd3('0x39')]){return _0x26207d['List'][_0x8dd3('0x5c')][0x0];}else{return db[_0x8dd3('0x5d')][_0x8dd3('0x4b')](_[_0x8dd3('0xb')](_0x1c01ad[_0x8dd3('0x48')],{'firstName':_0x1c01ad[_0x8dd3('0x48')]['to'],'email':_0x1c01ad[_0x8dd3('0x48')]['to'],'phone':_0x1c01ad['body']['to'],'ListId':_0x26207d['ListId']}));}}else{throw new Error(_0x8dd3('0x5e'));}})[_0x8dd3('0x13')](function(){if(_0x585670){return respondWithRpcPromise(_0x8dd3('0x5f'),_0x8dd3('0x60'),_0x585670,client9003)['then'](function(_0x57be28){return _0x515650[_0x8dd3('0x47')]({'read':!![],'messageId':_0x57be28['messageId'],'sentAt':moment()[_0x8dd3('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8dd3('0x1e')](function(_0x3b35f2){logger['error']('%s',JSON['stringify'](_0x3b35f2));return _0x515650;});}return _0x515650;});}return _0x515650;}})[_0x8dd3('0x13')](respondWithResult(_0x149e65,0xc9))[_0x8dd3('0x1e')](handleError(_0x149e65,null));};exports[_0x8dd3('0x62')]=function(_0x64a837,_0x4a3fc2){var _0x25fced={'agent':{},'channel':_0x8dd3('0x63')};if(_0x64a837[_0x8dd3('0x48')]['id']){delete _0x64a837['body']['id'];}_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x64')]=!![];_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x65')]=moment()[_0x8dd3('0x61')](_0x8dd3('0x66'));_0x64a837[_0x8dd3('0x48')]['UserId']=_0x64a837['body'][_0x8dd3('0x67')]||_0x64a837['user']['id'];_0x25fced['agent']['id']=_0x64a837[_0x8dd3('0x48')]['UserId'];return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x64a837[_0x8dd3('0x44')]['id'],'UserId':null}})[_0x8dd3('0x13')](handleEntityNotFound(_0x4a3fc2,null))['then'](saveUpdates(_0x64a837[_0x8dd3('0x48')],null))['then'](function(_0x38f3af){if(_0x38f3af){_0x25fced[_0x8dd3('0x1c')]=_0x38f3af[_0x8dd3('0x68')]({'plain':!![]});return db[_0x8dd3('0x69')]['find']({'where':{'id':_0x38f3af[_0x8dd3('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x4a3fc2,null))[_0x8dd3('0x13')](function(_0x1a98c3){if(_0x1a98c3){return _0x1a98c3[_0x8dd3('0x47')]({'UserId':_0x64a837[_0x8dd3('0x48')]['UserId'],'read1stAt':_[_0x8dd3('0x6b')](_0x1a98c3['read1stAt'])?moment()[_0x8dd3('0x61')](_0x8dd3('0x66')):undefined});}return null;})[_0x8dd3('0x13')](function(_0x567841){if(_0x567841){_0x25fced['interaction']=_0x567841[_0x8dd3('0x68')]({'plain':!![]});interaction_log['info'](_0x8dd3('0x6c'),_0x64a837[_0x8dd3('0x6d')]['id'],_0x64a837['user'][_0x8dd3('0x2b')],_0x64a837['user'][_0x8dd3('0x6e')],_0x25fced['interaction']['id'],_0x64a837[_0x8dd3('0x48')]?JSON[_0x8dd3('0x19')](_0x64a837[_0x8dd3('0x48')]):_0x8dd3('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x8dd3('0x70'),_0x25fced);}return null;})[_0x8dd3('0x13')](function(_0x1241a7){var _0xfb9be4=_0x8dd3('0x71')+_0x1241a7[_0x8dd3('0x1c')][_0x8dd3('0x72')];return db[_0x8dd3('0x73')][_0x8dd3('0x33')](_0xfb9be4,{'type':db[_0x8dd3('0x74')][_0x8dd3('0x75')][_0x8dd3('0x76')],'raw':!![]})[_0x8dd3('0x13')](function(_0x4d26c9){return _0x4d26c9;});})[_0x8dd3('0x13')](function(_0x4a10b8){if(_0x4a10b8){_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x77')]=_0x4a10b8[0x0];if(!_0x64a837[_0x8dd3('0x48')][_0x8dd3('0x67')])return;return db[_0x8dd3('0x78')][_0x8dd3('0x49')]({'where':{'id':_0x64a837['body'][_0x8dd3('0x67')],'role':'agent'},'attributes':['id','name','fullname',_0x8dd3('0x79'),_0x8dd3('0x7a')],'raw':!![]});}return null;})[_0x8dd3('0x13')](function(_0x2de897){if(!_0x2de897)return null;_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7b')]=_0x2de897;return _0x25fced;})[_0x8dd3('0x13')](function(_0x37bb74){if(_0x37bb74){if(_0x64a837[_0x8dd3('0x48')]['manual']){_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7c')]=util['format'](_0x8dd3('0x7d'),_0x64a837[_0x8dd3('0x6d')][_0x8dd3('0x2b')]);_0x25fced['message'][_0x8dd3('0x7e')]=_0x25fced['channel'];_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x7f')]=_0x25fced[_0x8dd3('0x7e')];_0x25fced[_0x8dd3('0x1c')]['event']=_0x8dd3('0x62');_0x25fced[_0x8dd3('0x1c')][_0x8dd3('0x48')]=htmlToText['fromString'](_0x25fced['message'][_0x8dd3('0x48')]);return respondWithRpcPromise(_0x8dd3('0x80'),_0x8dd3('0x80'),{'event':_0x8dd3('0x81'),'message':_0x25fced['message']},client9002)['then'](function(){return _0x25fced;});}return _0x25fced;}return null;})[_0x8dd3('0x13')](respondWithResult(_0x4a3fc2,null))['catch'](handleError(_0x4a3fc2,null));};exports[_0x8dd3('0x82')]=function(_0xe13262,_0x2acaa0){var _0x1794c6={'agent':{},'channel':'mail'};if(_0xe13262[_0x8dd3('0x48')]['id']){delete _0xe13262[_0x8dd3('0x48')]['id'];}_0xe13262[_0x8dd3('0x48')]['UserId']=_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')]||_0xe13262['user']['id'];_0x1794c6['agent']['id']=_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')];return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0xe13262['params']['id'],'UserId':null}})[_0x8dd3('0x13')](handleEntityNotFound(_0x2acaa0,null))[_0x8dd3('0x13')](function(_0x570eaa){if(_0x570eaa){_0x1794c6[_0x8dd3('0x1c')]=_0x570eaa[_0x8dd3('0x68')]({'plain':!![]});return db[_0x8dd3('0x69')][_0x8dd3('0x49')]({'where':{'id':_0x570eaa['MailInteractionId']}});}return null;})[_0x8dd3('0x13')](handleEntityNotFound(_0x2acaa0,null))[_0x8dd3('0x13')](function(_0x3da548){if(_0x3da548){_0x1794c6[_0x8dd3('0x83')]=_0x3da548['get']({'plain':!![]});interaction_log[_0x8dd3('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe13262[_0x8dd3('0x6d')]['id'],_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x2b')],_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x6e')],_0x1794c6[_0x8dd3('0x83')]['id'],_0xe13262['body']?JSON[_0x8dd3('0x19')](_0xe13262[_0x8dd3('0x48')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1794c6);}return null;})[_0x8dd3('0x13')](function(_0x2fa5e7){var _0x2e773=_0x8dd3('0x71')+_0x2fa5e7['message'][_0x8dd3('0x72')];return db['sequelize']['query'](_0x2e773,{'type':db[_0x8dd3('0x74')][_0x8dd3('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x2add34){return _0x2add34;});})[_0x8dd3('0x13')](function(_0x5507d1){if(_0x5507d1){_0x1794c6[_0x8dd3('0x1c')]['contact']=_0x5507d1[0x0];if(!_0xe13262['body'][_0x8dd3('0x67')])return;return db[_0x8dd3('0x78')]['find']({'where':{'id':_0xe13262[_0x8dd3('0x48')][_0x8dd3('0x67')],'role':_0x8dd3('0x7b')},'attributes':['id',_0x8dd3('0x2b'),_0x8dd3('0x84'),_0x8dd3('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2cf271){if(!_0x2cf271)return null;_0x1794c6['message']['agent']=_0x2cf271;return _0x1794c6;})[_0x8dd3('0x13')](function(_0x1a770a){if(_0x1a770a){_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7c')]=util['format']('SIP/%s',_0xe13262[_0x8dd3('0x6d')][_0x8dd3('0x2b')]);_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7e')]=_0x1794c6['channel'];_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x7f')]=_0x1794c6[_0x8dd3('0x7e')];_0x1a770a[_0x8dd3('0x1c')][_0x8dd3('0x85')]=_0x8dd3('0x82');_0x1a770a['message'][_0x8dd3('0x48')]=htmlToText['fromString'](_0x1794c6['message']['body']);respondWithRpcPromise('EventManager',_0x8dd3('0x80'),{'event':_0x8dd3('0x86'),'message':_0x1a770a['message']},client9002);return _0x1794c6;}return null;})['then'](respondWithResult(_0x2acaa0,null))['catch'](handleError(_0x2acaa0,null));};exports[_0x8dd3('0x87')]=function(_0x5d63d0,_0x16c954){var _0x1757ce=moment()[_0x8dd3('0x88')]()[_0x8dd3('0x89')]();var _0x709e19=path[_0x8dd3('0x58')](config[_0x8dd3('0x59')],_0x8dd3('0x8a'),_0x8dd3('0x8b'),_0x8dd3('0x8c'));var _0x17cc10=path[_0x8dd3('0x58')](config['root'],'server',_0x8dd3('0x8b'),_0x8dd3('0x57'));var _0x461cec=util['format'](_0x8dd3('0x8d'),_0x1757ce);return db[_0x8dd3('0x2f')][_0x8dd3('0x49')]({'where':{'id':_0x5d63d0[_0x8dd3('0x44')]['id']},'attributes':['id',_0x8dd3('0x48'),_0x8dd3('0x8e'),'to','cc','bcc',_0x8dd3('0x8f'),_0x8dd3('0x90')],'include':_0x5d63d0['query']['attachments']?[{'model':db[_0x8dd3('0x91')],'as':_0x8dd3('0x92')}]:undefined})[_0x8dd3('0x13')](handleEntityNotFound(_0x16c954,null))[_0x8dd3('0x13')](function(_0x32c2d4){if(_0x32c2d4){var _0x2260af=_0x32c2d4;var _0x4be074={'from':_0x2260af[_0x8dd3('0x8e')],'to':_0x2260af['to'],'subject':_0x2260af[_0x8dd3('0x8f')],'html':htmlEntities[_0x8dd3('0x93')](_0x2260af['body']),'headers':{'Date':moment(_0x2260af[_0x8dd3('0x90')])[_0x8dd3('0x61')](_0x8dd3('0x94'))},'attachments':[]};if(_0x32c2d4['cc']){_0x4be074[_0x8dd3('0x95')]['Cc']=_0x32c2d4['cc'];}if(_0x32c2d4[_0x8dd3('0x96')]){_0x4be074[_0x8dd3('0x95')][_0x8dd3('0x97')]=_0x32c2d4[_0x8dd3('0x96')];}return new BPromise(function(_0x805227,_0x3bd858){if(_0x32c2d4[_0x8dd3('0x92')]){for(var _0xfced46=0x0;_0xfced46<_0x32c2d4['Attachments'][_0x8dd3('0x39')];_0xfced46++){var _0x26ee54=_0x32c2d4['Attachments'][_0xfced46];var _0x2b6f0f=path['join'](_0x17cc10,_0x26ee54['basename']);if(fs['existsSync'](_0x2b6f0f)){_0x4be074['attachments'][_0x8dd3('0x98')]({'name':_0x26ee54['name'],'contentType':_0x26ee54[_0x8dd3('0x31')],'data':fs['readFileSync'](_0x2b6f0f)});}}}emlformat[_0x8dd3('0x99')](_0x4be074,function(_0x10283f,_0x1885d8){if(_0x10283f)return _0x3bd858(_0x10283f);fs['writeFileSync'](path['join'](_0x709e19,_0x461cec),_0x1885d8);return _0x805227(_0x1885d8);});});}})[_0x8dd3('0x13')](function(_0x51a00a){if(_0x51a00a){return _0x16c954['download'](path[_0x8dd3('0x58')](_0x709e19,_0x461cec),_0x461cec,function(_0x54dd74){if(!_0x54dd74)fs[_0x8dd3('0x9a')](path[_0x8dd3('0x58')](_0x709e19,_0x461cec));});}})[_0x8dd3('0x1e')](handleError(_0x16c954,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 84609d1..afca908 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 _0x9363=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x5d2a31,_0x4920fb){var _0x577a7e=function(_0x164c39){while(--_0x164c39){_0x5d2a31['push'](_0x5d2a31['shift']());}};_0x577a7e(++_0x4920fb);}(_0x9363,0xdc));var _0x3936=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x9363[_0x1529a3];return _0x1a0d4b;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3936('0x0')](0x0);var events={'afterCreate':_0x3936('0x1'),'afterUpdate':_0x3936('0x2'),'afterDestroy':_0x3936('0x3')};function emitEvent(_0xb2748f){return function(_0x466fc7,_0x5761cc,_0x210b20){MailMessageEvents[_0x3936('0x4')](_0xb2748f+':'+_0x466fc7['id'],_0x466fc7);MailMessageEvents[_0x3936('0x4')](_0xb2748f,_0x466fc7);_0x210b20(null);};}for(var e in events){if(events[_0x3936('0x5')](e)){var event=events[e];MailMessage[_0x3936('0x6')](e,emitEvent(event));}}module[_0x3936('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x63c4=['update','remove','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x63c4,0x134));var _0x463c=function(_0x1325d9,_0x5222ed){_0x1325d9=_0x1325d9-0x0;var _0x4f4e4a=_0x63c4[_0x1325d9];return _0x4f4e4a;};'use strict';var EventEmitter=require(_0x463c('0x0'));var MailMessage=require(_0x463c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x463c('0x2')](0x0);var events={'afterCreate':_0x463c('0x3'),'afterUpdate':_0x463c('0x4'),'afterDestroy':_0x463c('0x5')};function emitEvent(_0x32db58){return function(_0x57037f,_0x141f89,_0x3826c0){MailMessageEvents['emit'](_0x32db58+':'+_0x57037f['id'],_0x57037f);MailMessageEvents['emit'](_0x32db58,_0x57037f);_0x3826c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x463c('0x6')](e,emitEvent(event));}}module[_0x463c('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 14d73d7..c39a3cf 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 _0x9eed=['get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','html-to-text','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString'];(function(_0x102fd7,_0x1edca5){var _0x10116a=function(_0x270aaf){while(--_0x270aaf){_0x102fd7['push'](_0x102fd7['shift']());}};_0x10116a(++_0x1edca5);}(_0x9eed,0x1ed));var _0xd9ee=function(_0x4998be,_0x5d473c){_0x4998be=_0x4998be-0x0;var _0x22a62b=_0x9eed[_0x4998be];return _0x22a62b;};'use strict';var _=require(_0xd9ee('0x0'));var util=require(_0xd9ee('0x1'));var logger=require(_0xd9ee('0x2'))(_0xd9ee('0x3'));var moment=require(_0xd9ee('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xd9ee('0x5'));var fs=require('fs');var path=require(_0xd9ee('0x6'));var rimraf=require(_0xd9ee('0x7'));var config=require('../../config/environment');var attributes=require(_0xd9ee('0x8'));module['exports']=function(_0x47fe69,_0x26544b){return _0x47fe69[_0xd9ee('0x9')](_0xd9ee('0xa'),attributes,{'tableName':_0xd9ee('0xb'),'paranoid':![],'indexes':[{'name':_0xd9ee('0xc'),'fields':[_0xd9ee('0xc')]},{'name':_0xd9ee('0xd'),'fields':[_0xd9ee('0xe'),_0xd9ee('0xf')],'type':_0xd9ee('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ad562,_0x58c7fb,_0x53c291){if(_0x3ad562[_0xd9ee('0x11')]){_0x3ad562[_0xd9ee('0xe')]=htmlToText[_0xd9ee('0x12')](_0x3ad562['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x53c291(null,_0x58c7fb);},'afterCreate':function(_0x505f68,_0x539b51,_0x224581){var _0x19bc47=_0x47fe69['models'];var _0x5b2120=_0x505f68[_0xd9ee('0x13')]({'plain':!![]});if(_0x5b2120[_0xd9ee('0x14')][_0xd9ee('0x15')]()==='in'||_0x5b2120[_0xd9ee('0x14')][_0xd9ee('0x15')]()===_0xd9ee('0x16')&&!_0x5b2120[_0xd9ee('0x17')]&&!_[_0xd9ee('0x18')](_0x5b2120['UserId'])){_0x19bc47[_0xd9ee('0x19')][_0xd9ee('0x1a')]({'where':{'id':_0x5b2120['MailInteractionId']}})[_0xd9ee('0x1b')](function(_0x1fcc91){if(_0x1fcc91){_0x1fcc91['update']({'lastMsgAt':_0x5b2120[_0xd9ee('0x1c')],'lastMsgDirection':_0x5b2120[_0xd9ee('0x14')][_0xd9ee('0x15')]()});}})[_0xd9ee('0x1d')](function(_0x35d903){console[_0xd9ee('0x1e')](_0x35d903);});}_0x224581();}},'charset':_0xd9ee('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8bfa=['messageId','fti_mail_messages','plainBody','subject','body','models','get','direction','toLowerCase','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','define'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x8bfa,0xee));var _0xa8bf=function(_0x31c5fd,_0x33131f){_0x31c5fd=_0x31c5fd-0x0;var _0x3799ab=_0x8bfa[_0x31c5fd];return _0x3799ab;};'use strict';var _=require(_0xa8bf('0x0'));var util=require('util');var logger=require(_0xa8bf('0x1'))('api');var moment=require(_0xa8bf('0x2'));var BPromise=require(_0xa8bf('0x3'));var rp=require(_0xa8bf('0x4'));var htmlToText=require(_0xa8bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8bf('0x6'));var config=require(_0xa8bf('0x7'));var attributes=require('./mailMessage.attributes');module[_0xa8bf('0x8')]=function(_0x5b4c92,_0x256902){return _0x5b4c92[_0xa8bf('0x9')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xa8bf('0xa'),'fields':[_0xa8bf('0xa')]},{'name':_0xa8bf('0xb'),'fields':[_0xa8bf('0xc'),_0xa8bf('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4316ba,_0x85489d,_0x528efc){if(_0x4316ba[_0xa8bf('0xe')]){_0x4316ba[_0xa8bf('0xc')]=htmlToText['fromString'](_0x4316ba['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x528efc(null,_0x85489d);},'afterCreate':function(_0x1ccce0,_0x5a2eaf,_0x2baa0e){var _0x3b9f1c=_0x5b4c92[_0xa8bf('0xf')];var _0x2033e2=_0x1ccce0[_0xa8bf('0x10')]({'plain':!![]});if(_0x2033e2[_0xa8bf('0x11')]['toLowerCase']()==='in'||_0x2033e2[_0xa8bf('0x11')][_0xa8bf('0x12')]()==='out'&&!_0x2033e2['secret']&&!_[_0xa8bf('0x13')](_0x2033e2[_0xa8bf('0x14')])){_0x3b9f1c[_0xa8bf('0x15')][_0xa8bf('0x16')]({'where':{'id':_0x2033e2[_0xa8bf('0x17')]}})[_0xa8bf('0x18')](function(_0x525d06){if(_0x525d06){_0x525d06[_0xa8bf('0x19')]({'lastMsgAt':_0x2033e2[_0xa8bf('0x1a')],'lastMsgDirection':_0x2033e2[_0xa8bf('0x11')][_0xa8bf('0x12')]()});}})[_0xa8bf('0x1b')](function(_0x2e4751){console[_0xa8bf('0x1c')](_0x2e4751);});}_0x2baa0e();}},'charset':_0xa8bf('0x1d'),'collate':_0xa8bf('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 94e01cd..e8c49e1 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 _0x8f4c=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x2ebfdb,_0x3cad62){_0x2ebfdb=_0x2ebfdb-0x0;var _0x4430ef=_0x8f4c[_0x2ebfdb];return _0x4430ef;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc8f4('0xa')](config['redis'],{'host':_0xc8f4('0xb'),'port':0x18eb});var socket=require(_0xc8f4('0xc'))(new Redis(config[_0xc8f4('0xd')]));require(_0xc8f4('0xe'))[_0xc8f4('0xf')](socket);function respondWithRpcPromise(_0x599de3,_0x38c41b,_0x191b92){return new BPromise(function(_0x2fba62,_0x3a2f8a){return client['request'](_0x599de3,_0x191b92)[_0xc8f4('0x10')](function(_0x52c699){logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));logger[_0xc8f4('0x14')](_0xc8f4('0x15'),_0x38c41b,'request\x20sent',JSON[_0xc8f4('0x16')](_0x52c699));if(_0x52c699[_0xc8f4('0x17')]){if(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x18')]===0x1f4){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x3a2f8a(_0x52c699[_0xc8f4('0x17')][_0xc8f4('0x19')]);}logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x52c699['error'][_0xc8f4('0x19')]);return _0x2fba62(_0x52c699['error']['message']);}else{logger[_0xc8f4('0x11')](_0xc8f4('0x12'),_0x38c41b,_0xc8f4('0x13'));_0x2fba62(_0x52c699[_0xc8f4('0x1a')][_0xc8f4('0x19')]);}})[_0xc8f4('0x1b')](function(_0x2459ac){logger[_0xc8f4('0x17')](_0xc8f4('0x12'),_0x38c41b,_0x2459ac);_0x3a2f8a(_0x2459ac);});});}exports[_0xc8f4('0x1c')]=function(_0x3cd90c){var _0x3126e5=this;return new Promise(function(_0x22236c,_0x5f3264){return db[_0xc8f4('0x1d')][_0xc8f4('0x1e')](_0x3cd90c[_0xc8f4('0x1f')],{'raw':_0x3cd90c[_0xc8f4('0x20')]?_0x3cd90c[_0xc8f4('0x20')][_0xc8f4('0x21')]===undefined?!![]:![]:!![]})[_0xc8f4('0x10')](function(_0x43eb57){logger['info'](_0xc8f4('0x1c'),_0x3cd90c);logger[_0xc8f4('0x14')](_0xc8f4('0x1c'),_0x3cd90c,JSON[_0xc8f4('0x16')](_0x43eb57));_0x22236c(_0x43eb57);})['catch'](function(_0x39174f){logger['error'](_0xc8f4('0x1c'),_0x39174f['message'],_0x3cd90c);_0x5f3264(_0x3126e5[_0xc8f4('0x17')](0x1f4,_0x39174f[_0xc8f4('0x19')]));});});}; \ No newline at end of file +var _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x3e058f,_0x31faee){var _0x12b162=function(_0x1730e3){while(--_0x1730e3){_0x3e058f['push'](_0x3e058f['shift']());}};_0x12b162(++_0x31faee);}(_0xd943,0x15d));var _0x3d94=function(_0x55e70f,_0x10d1a5){_0x55e70f=_0x55e70f-0x0;var _0x312170=_0xd943[_0x55e70f];return _0x312170;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 811577f..0b0a3cd 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 _0x883e=['length','./mailMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x191acf,_0x22f288){var _0x1cba40=function(_0x57f47b){while(--_0x57f47b){_0x191acf['push'](_0x191acf['shift']());}};_0x1cba40(++_0x22f288);}(_0x883e,0xf9));var _0xe883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883e[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0xe883('0x0'));var events=[_0xe883('0x1'),_0xe883('0x2'),_0xe883('0x3')];function createListener(_0x38e1b1,_0x2b9987){return function(_0x270af9){_0x2b9987[_0xe883('0x4')](_0x38e1b1,_0x270af9);};}function removeListener(_0x1fee56,_0x1dbb17){return function(){MailMessageEvents[_0xe883('0x5')](_0x1fee56,_0x1dbb17);};}exports[_0xe883('0x6')]=function(_0x132675){for(var _0xf3dffd=0x0,_0x3eae71=events[_0xe883('0x7')];_0xf3dffd<_0x3eae71;_0xf3dffd++){var _0x1c6bc0=events[_0xf3dffd];var _0x3a1e9c=createListener('mailMessage:'+_0x1c6bc0,_0x132675);MailMessageEvents['on'](_0x1c6bc0,_0x3a1e9c);}}; \ No newline at end of file +var _0xaab2=['removeListener','register','length','mailMessage:','remove','update','emit'];(function(_0x551bd4,_0xd75ce6){var _0x5152e4=function(_0x5aa3e3){while(--_0x5aa3e3){_0x551bd4['push'](_0x551bd4['shift']());}};_0x5152e4(++_0xd75ce6);}(_0xaab2,0x15b));var _0x2aab=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xaab2[_0x23e7c1];return _0x1add43;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x2aab('0x0'),_0x2aab('0x1')];function createListener(_0x38f809,_0x53d6c7){return function(_0x8ed68d){_0x53d6c7[_0x2aab('0x2')](_0x38f809,_0x8ed68d);};}function removeListener(_0x1adc6a,_0x4ffb8b){return function(){MailMessageEvents[_0x2aab('0x3')](_0x1adc6a,_0x4ffb8b);};}exports[_0x2aab('0x4')]=function(_0x42b48f){for(var _0x19984a=0x0,_0x1c567d=events[_0x2aab('0x5')];_0x19984a<_0x1c567d;_0x19984a++){var _0x105bfd=events[_0x19984a];var _0x370b2b=createListener(_0x2aab('0x6')+_0x105bfd,_0x42b48f);MailMessageEvents['on'](_0x105bfd,_0x370b2b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 9b6c28e..f1522d9 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 _0xeebc=['getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeebc,0x167));var _0xceeb=function(_0x4ae221,_0x455d3d){_0x4ae221=_0x4ae221-0x0;var _0x5c3110=_0xeebc[_0x4ae221];return _0x5c3110;};'use strict';var multer=require('multer');var util=require(_0xceeb('0x0'));var path=require(_0xceeb('0x1'));var timeout=require(_0xceeb('0x2'));var express=require(_0xceeb('0x3'));var router=express[_0xceeb('0x4')]();var fs_extra=require(_0xceeb('0x5'));var auth=require(_0xceeb('0x6'));var interaction=require(_0xceeb('0x7'));var config=require(_0xceeb('0x8'));var controller=require('./mailQueue.controller');router[_0xceeb('0x9')]('/',auth[_0xceeb('0xa')](),controller[_0xceeb('0xb')]);router[_0xceeb('0x9')](_0xceeb('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xceeb('0xd'),auth['isAuthenticated'](),controller[_0xceeb('0xe')]);router['get'](_0xceeb('0xf'),auth[_0xceeb('0xa')](),controller[_0xceeb('0x10')]);router[_0xceeb('0x9')](_0xceeb('0x11'),auth[_0xceeb('0xa')](),controller[_0xceeb('0x12')]);router['get'](_0xceeb('0x13'),auth[_0xceeb('0xa')](),controller[_0xceeb('0x14')]);router[_0xceeb('0x15')]('/',auth[_0xceeb('0xa')](),controller['create']);router[_0xceeb('0x15')]('/:id/teams',auth[_0xceeb('0xa')](),controller[_0xceeb('0x16')]);router[_0xceeb('0x15')](_0xceeb('0x13'),auth[_0xceeb('0xa')](),controller['addAgents']);router[_0xceeb('0x17')](_0xceeb('0xd'),auth['isAuthenticated'](),controller[_0xceeb('0x18')]);router[_0xceeb('0x19')](_0xceeb('0xd'),auth[_0xceeb('0xa')](),controller['destroy']);router[_0xceeb('0x19')](_0xceeb('0x11'),auth[_0xceeb('0xa')](),controller[_0xceeb('0x1a')]);router['delete'](_0xceeb('0x13'),auth[_0xceeb('0xa')](),controller[_0xceeb('0x1b')]);module[_0xceeb('0x1c')]=router; \ No newline at end of file +var _0x36cb=['./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1109db,_0x5c6dc7){var _0x27d529=function(_0x558547){while(--_0x558547){_0x1109db['push'](_0x1109db['shift']());}};_0x27d529(++_0x5c6dc7);}(_0x36cb,0x122));var _0xb36c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x36cb[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xb36c('0x0'));var util=require(_0xb36c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb36c('0x2'));var router=express[_0xb36c('0x3')]();var fs_extra=require(_0xb36c('0x4'));var auth=require(_0xb36c('0x5'));var interaction=require(_0xb36c('0x6'));var config=require('../../config/environment');var controller=require(_0xb36c('0x7'));router[_0xb36c('0x8')]('/',auth['isAuthenticated'](),controller[_0xb36c('0x9')]);router[_0xb36c('0x8')](_0xb36c('0xa'),auth[_0xb36c('0xb')](),controller['describe']);router['get'](_0xb36c('0xc'),auth['isAuthenticated'](),controller[_0xb36c('0xd')]);router['get']('/:id/members',auth[_0xb36c('0xb')](),controller['getMembers']);router[_0xb36c('0x8')](_0xb36c('0xe'),auth['isAuthenticated'](),controller[_0xb36c('0xf')]);router[_0xb36c('0x8')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller[_0xb36c('0x11')]);router[_0xb36c('0x12')]('/',auth[_0xb36c('0xb')](),controller[_0xb36c('0x13')]);router[_0xb36c('0x12')](_0xb36c('0xe'),auth['isAuthenticated'](),controller[_0xb36c('0x14')]);router[_0xb36c('0x12')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller[_0xb36c('0x15')]);router[_0xb36c('0x16')](_0xb36c('0xc'),auth['isAuthenticated'](),controller[_0xb36c('0x17')]);router[_0xb36c('0x18')](_0xb36c('0xc'),auth[_0xb36c('0xb')](),controller['destroy']);router[_0xb36c('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb36c('0x19')]);router[_0xb36c('0x18')](_0xb36c('0x10'),auth[_0xb36c('0xb')](),controller['removeAgents']);module[_0xb36c('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 fc4a015..0b51e13 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 _0x1b7d=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x4fcf24,_0x5ea682){var _0x4cdb38=function(_0x4c3a47){while(--_0x4c3a47){_0x4fcf24['push'](_0x4fcf24['shift']());}};_0x4cdb38(++_0x5ea682);}(_0x1b7d,0x15f));var _0xd1b7=function(_0x4f420c,_0x41e9b4){_0x4f420c=_0x4f420c-0x0;var _0x283911=_0x1b7d[_0x4f420c];return _0x283911;};'use strict';var Sequelize=require(_0xd1b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1b7('0x1')],'unique':_0xd1b7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd1b7('0x1')]},'timeout':{'type':Sequelize[_0xd1b7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd1b7('0x4'),_0xd1b7('0x5'),_0xd1b7('0x6'))}}; \ No newline at end of file +var _0xd0a7=['exports','STRING','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3afa4f,_0x4dcf8f){var _0x42c8f2=function(_0x17fc4c){while(--_0x17fc4c){_0x3afa4f['push'](_0x3afa4f['shift']());}};_0x42c8f2(++_0x4dcf8f);}(_0xd0a7,0xfc));var _0x7d0a=function(_0x12bd20,_0x13b239){_0x12bd20=_0x12bd20-0x0;var _0x1dc219=_0xd0a7[_0x12bd20];return _0x1dc219;};'use strict';var Sequelize=require('sequelize');module[_0x7d0a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d0a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d0a('0x2')](_0x7d0a('0x3'),_0x7d0a('0x4'),_0x7d0a('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1c419a5..ddc63b2 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 _0xd1d7=['mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','Agents','voicePause','interface','sequelize','addTeams','each','forEach','userMailQueue:save','removeTeams','ids','field','from','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','transaction','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','rawAttributes','MailQueueId','User','findAndCountAll','UserId','agent'];(function(_0x26d3e6,_0x57a2db){var _0x402704=function(_0x5afe22){while(--_0x5afe22){_0x26d3e6['push'](_0x26d3e6['shift']());}};_0x402704(++_0x57a2db);}(_0xd1d7,0x144));var _0x7d1d=function(_0x5f3598,_0x3c58cf){_0x5f3598=_0x5f3598-0x0;var _0x3dd441=_0xd1d7[_0x5f3598];return _0x3dd441;};'use strict';var emlformat=require(_0x7d1d('0x0'));var rimraf=require(_0x7d1d('0x1'));var zipdir=require(_0x7d1d('0x2'));var jsonpatch=require(_0x7d1d('0x3'));var rp=require(_0x7d1d('0x4'));var moment=require(_0x7d1d('0x5'));var BPromise=require(_0x7d1d('0x6'));var Mustache=require('mustache');var util=require(_0x7d1d('0x7'));var path=require(_0x7d1d('0x8'));var sox=require(_0x7d1d('0x9'));var csv=require('to-csv');var ejs=require(_0x7d1d('0xa'));var fs=require('fs');var fs_extra=require(_0x7d1d('0xb'));var _=require(_0x7d1d('0xc'));var squel=require(_0x7d1d('0xd'));var crypto=require(_0x7d1d('0xe'));var jsforce=require(_0x7d1d('0xf'));var deskjs=require(_0x7d1d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d1d('0x11'));var Redis=require(_0x7d1d('0x12'));var authService=require(_0x7d1d('0x13'));var qs=require(_0x7d1d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d1d('0x15'));var logger=require(_0x7d1d('0x16'))(_0x7d1d('0x17'));var utils=require(_0x7d1d('0x18'));var config=require(_0x7d1d('0x19'));var licenseUtil=require(_0x7d1d('0x1a'));var db=require(_0x7d1d('0x1b'))['db'];config[_0x7d1d('0x1c')]=_[_0x7d1d('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7d1d('0x1e'))[_0x7d1d('0x1f')](socket);function respondWithStatusCode(_0x23e394,_0x560df6){_0x560df6=_0x560df6||0xcc;return function(_0x48ee8b){if(_0x48ee8b){return _0x23e394[_0x7d1d('0x20')](_0x560df6);}return _0x23e394[_0x7d1d('0x21')](_0x560df6)[_0x7d1d('0x22')]();};}function respondWithResult(_0x4776f3,_0xc6f9c6){_0xc6f9c6=_0xc6f9c6||0xc8;return function(_0x24c033){if(_0x24c033){return _0x4776f3[_0x7d1d('0x21')](_0xc6f9c6)[_0x7d1d('0x23')](_0x24c033);}};}function respondWithFilteredResult(_0x332ceb,_0x18315d){return function(_0x103e4a){if(_0x103e4a){var _0x4ad117=typeof _0x18315d[_0x7d1d('0x24')]==='undefined'&&typeof _0x18315d['limit']===_0x7d1d('0x25');var _0x5ac8d7=_0x103e4a['count'];var _0x3e2d17=_0x4ad117?0x0:_0x18315d[_0x7d1d('0x24')];var _0x3c210b=_0x4ad117?_0x103e4a[_0x7d1d('0x26')]:_0x18315d[_0x7d1d('0x24')]+_0x18315d['limit'];var _0xc3fc71;if(_0x3c210b>=_0x5ac8d7){_0x3c210b=_0x5ac8d7;_0xc3fc71=0xc8;}else{_0xc3fc71=0xce;}_0x332ceb['status'](_0xc3fc71);return _0x332ceb[_0x7d1d('0x27')](_0x7d1d('0x28'),_0x3e2d17+'-'+_0x3c210b+'/'+_0x5ac8d7)['json'](_0x103e4a);}return null;};}function patchUpdates(_0xecf2b7){return function(_0x6c7073){try{jsonpatch[_0x7d1d('0x29')](_0x6c7073,_0xecf2b7,!![]);}catch(_0x11a214){return BPromise[_0x7d1d('0x2a')](_0x11a214);}return _0x6c7073[_0x7d1d('0x2b')]();};}function saveUpdates(_0x240a82,_0x4689da){return function(_0x204be7){if(_0x204be7){return _0x204be7[_0x7d1d('0x2c')](_0x240a82)[_0x7d1d('0x2d')](function(_0x390e22){return _0x390e22;});}return null;};}function removeEntity(_0x10be3d,_0x37ad70){return function(_0x5482a9){if(_0x5482a9){return _0x5482a9[_0x7d1d('0x2e')]()['then'](function(){var _0x3088db=_0x5482a9[_0x7d1d('0x2f')]({'plain':!![]});var _0x1fe626=_0x7d1d('0x30');return db[_0x7d1d('0x31')][_0x7d1d('0x2e')]({'where':{'type':_0x1fe626,'resourceId':_0x3088db['id']}})[_0x7d1d('0x2d')](function(){return _0x5482a9;});})[_0x7d1d('0x2d')](function(){_0x10be3d[_0x7d1d('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe21bcf,_0x4ce74a){return function(_0x49b122){if(!_0x49b122){_0xe21bcf[_0x7d1d('0x20')](0x194);}return _0x49b122;};}function handleError(_0x44000d,_0x543209){_0x543209=_0x543209||0x1f4;return function(_0x222d0a){logger['error'](_0x222d0a[_0x7d1d('0x32')]);if(_0x222d0a['name']){delete _0x222d0a[_0x7d1d('0x33')];}_0x44000d[_0x7d1d('0x21')](_0x543209)[_0x7d1d('0x34')](_0x222d0a);};}exports[_0x7d1d('0x35')]=function(_0x149c86,_0x2e568e){var _0x2c59c2={},_0x2f8f3e={},_0x41c245={'count':0x0,'rows':[]};var _0x289c31=_[_0x7d1d('0x36')](db[_0x7d1d('0x37')]['rawAttributes'],function(_0x1f84fa){return{'name':_0x1f84fa['fieldName'],'type':_0x1f84fa['type']['key']};});_0x2f8f3e[_0x7d1d('0x38')]=_[_0x7d1d('0x36')](_0x289c31,_0x7d1d('0x33'));_0x2f8f3e[_0x7d1d('0x39')]=_[_0x7d1d('0x3a')](_0x149c86[_0x7d1d('0x39')]);_0x2f8f3e[_0x7d1d('0x3b')]=_[_0x7d1d('0x3c')](_0x2f8f3e['model'],_0x2f8f3e['query']);_0x2c59c2[_0x7d1d('0x3d')]=_[_0x7d1d('0x3c')](_0x2f8f3e[_0x7d1d('0x38')],qs[_0x7d1d('0x3e')](_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x3e')]));_0x2c59c2['attributes']=_0x2c59c2[_0x7d1d('0x3d')][_0x7d1d('0x3f')]?_0x2c59c2[_0x7d1d('0x3d')]:_0x2f8f3e[_0x7d1d('0x38')];if(!_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x40')](_0x7d1d('0x41'))){_0x2c59c2['limit']=qs[_0x7d1d('0x42')](_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x42')]);_0x2c59c2[_0x7d1d('0x24')]=qs['offset'](_0x149c86[_0x7d1d('0x39')]['offset']);}_0x2c59c2[_0x7d1d('0x43')]=qs[_0x7d1d('0x44')](_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x44')]);_0x2c59c2[_0x7d1d('0x45')]=qs['filters'](_[_0x7d1d('0x46')](_0x149c86[_0x7d1d('0x39')],_0x2f8f3e['filters']),_0x289c31);if(_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x47')]){_0x2c59c2[_0x7d1d('0x45')]=_['merge'](_0x2c59c2[_0x7d1d('0x45')],{'$or':_[_0x7d1d('0x36')](_0x289c31,function(_0x192a2d){if(_0x192a2d['type']!==_0x7d1d('0x48')){var _0x4ff36a={};_0x4ff36a[_0x192a2d[_0x7d1d('0x33')]]={'$like':'%'+_0x149c86[_0x7d1d('0x39')][_0x7d1d('0x47')]+'%'};return _0x4ff36a;}})});}_0x2c59c2=_[_0x7d1d('0x49')]({},_0x2c59c2,_0x149c86[_0x7d1d('0x4a')]);var _0x1bbfca={'where':_0x2c59c2['where']};return db[_0x7d1d('0x37')][_0x7d1d('0x26')](_0x1bbfca)[_0x7d1d('0x2d')](function(_0x37b66b){_0x41c245[_0x7d1d('0x26')]=_0x37b66b;if(_0x149c86[_0x7d1d('0x39')]['includeAll']){_0x2c59c2[_0x7d1d('0x4b')]=[{'all':!![]}];}return db[_0x7d1d('0x37')][_0x7d1d('0x4c')](_0x2c59c2);})[_0x7d1d('0x2d')](function(_0xd04a9b){_0x41c245[_0x7d1d('0x4d')]=_0xd04a9b;return _0x41c245;})['then'](respondWithFilteredResult(_0x2e568e,_0x2c59c2))[_0x7d1d('0x4e')](handleError(_0x2e568e,null));};exports[_0x7d1d('0x4f')]=function(_0x3332f1,_0x536c17){var _0x3caa25={'raw':!![],'where':{'id':_0x3332f1[_0x7d1d('0x50')]['id']}},_0x181794={};_0x181794['model']=_[_0x7d1d('0x3a')](db['MailQueue']['rawAttributes']);_0x181794[_0x7d1d('0x39')]=_[_0x7d1d('0x3a')](_0x3332f1['query']);_0x181794[_0x7d1d('0x3b')]=_[_0x7d1d('0x3c')](_0x181794['model'],_0x181794[_0x7d1d('0x39')]);_0x3caa25[_0x7d1d('0x3d')]=_[_0x7d1d('0x3c')](_0x181794[_0x7d1d('0x38')],qs[_0x7d1d('0x3e')](_0x3332f1[_0x7d1d('0x39')][_0x7d1d('0x3e')]));_0x3caa25[_0x7d1d('0x3d')]=_0x3caa25['attributes'][_0x7d1d('0x3f')]?_0x3caa25[_0x7d1d('0x3d')]:_0x181794[_0x7d1d('0x38')];if(_0x3332f1[_0x7d1d('0x39')][_0x7d1d('0x51')]){_0x3caa25['include']=[{'all':!![]}];}_0x3caa25=_[_0x7d1d('0x49')]({},_0x3caa25,_0x3332f1[_0x7d1d('0x4a')]);return db[_0x7d1d('0x37')][_0x7d1d('0x52')](_0x3caa25)['then'](handleEntityNotFound(_0x536c17,null))[_0x7d1d('0x2d')](respondWithResult(_0x536c17,null))[_0x7d1d('0x4e')](handleError(_0x536c17,null));};exports['create']=function(_0x1fe7b1,_0x14aeaa){return db['MailQueue'][_0x7d1d('0x53')](_0x1fe7b1[_0x7d1d('0x54')],{})[_0x7d1d('0x2d')](function(_0xb68403){var _0x4fa45d=_0x1fe7b1[_0x7d1d('0x55')][_0x7d1d('0x2f')]({'plain':!![]});if(!_0x4fa45d)throw new Error(_0x7d1d('0x56'));if(_0x4fa45d[_0x7d1d('0x57')]===_0x7d1d('0x55')){var _0x4eeece=_0xb68403['get']({'plain':!![]});var _0x5f101a=_0x7d1d('0x30');return db[_0x7d1d('0x58')]['find']({'where':{'name':_0x5f101a,'userProfileId':_0x4fa45d[_0x7d1d('0x59')]},'raw':!![]})[_0x7d1d('0x2d')](function(_0x5395f3){if(_0x5395f3&&_0x5395f3[_0x7d1d('0x5a')]===0x0){return db[_0x7d1d('0x31')][_0x7d1d('0x53')]({'name':_0x4eeece['name'],'resourceId':_0x4eeece['id'],'type':_0x5395f3['name'],'sectionId':_0x5395f3['id']},{})[_0x7d1d('0x2d')](function(){return _0xb68403;});}else{return _0xb68403;}})['catch'](function(_0x140c8a){logger[_0x7d1d('0x5b')](_0x7d1d('0x5c'),_0x140c8a);throw _0x140c8a;});}return _0xb68403;})[_0x7d1d('0x2d')](respondWithResult(_0x14aeaa,0xc9))[_0x7d1d('0x4e')](handleError(_0x14aeaa,null));};exports[_0x7d1d('0x2c')]=function(_0x3fafe7,_0x226f8c){if(_0x3fafe7[_0x7d1d('0x54')]['id']){delete _0x3fafe7[_0x7d1d('0x54')]['id'];}return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0x3fafe7[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](handleEntityNotFound(_0x226f8c,null))['then'](saveUpdates(_0x3fafe7[_0x7d1d('0x54')],null))[_0x7d1d('0x2d')](respondWithResult(_0x226f8c,null))[_0x7d1d('0x4e')](handleError(_0x226f8c,null));};exports[_0x7d1d('0x2e')]=function(_0x203ddd,_0x8bcca){return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0x203ddd[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](handleEntityNotFound(_0x8bcca,null))['then'](removeEntity(_0x8bcca,null))['catch'](handleError(_0x8bcca,null));};exports['describe']=function(_0x8dece9,_0x1f3f7f){return db['MailQueue'][_0x7d1d('0x5d')]()['then'](respondWithResult(_0x1f3f7f,null))[_0x7d1d('0x4e')](handleError(_0x1f3f7f,null));};exports[_0x7d1d('0x5e')]=function(_0x6fb8c3,_0x161d52,_0x27a1dd){var _0x346693={'raw':!![],'where':{}},_0x186640={},_0x6cb0cf;return db['MailQueue']['findOne']({'where':{'id':_0x6fb8c3[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](handleEntityNotFound(_0x161d52,null))['then'](function(_0x2500ea){if(_0x2500ea){_0x6cb0cf=_0x2500ea[_0x7d1d('0x2f')]({'plain':!![]});_0x186640['model']=_[_0x7d1d('0x3a')](db[_0x7d1d('0x5f')][_0x7d1d('0x60')]);_0x186640[_0x7d1d('0x39')]=_[_0x7d1d('0x3a')](_0x6fb8c3[_0x7d1d('0x39')]);_0x186640[_0x7d1d('0x3b')]=_[_0x7d1d('0x3c')](_0x186640[_0x7d1d('0x38')],_0x186640[_0x7d1d('0x39')]);_0x346693[_0x7d1d('0x3d')]=_['intersection'](_0x186640[_0x7d1d('0x38')],qs[_0x7d1d('0x3e')](_0x6fb8c3[_0x7d1d('0x39')][_0x7d1d('0x3e')]));_0x346693[_0x7d1d('0x3d')]=_0x346693[_0x7d1d('0x3d')][_0x7d1d('0x3f')]?_0x346693[_0x7d1d('0x3d')]:_0x186640[_0x7d1d('0x38')];if(!_0x6fb8c3[_0x7d1d('0x39')][_0x7d1d('0x40')]('nolimit')){_0x346693[_0x7d1d('0x42')]=qs[_0x7d1d('0x42')](_0x6fb8c3[_0x7d1d('0x39')]['limit']);_0x346693[_0x7d1d('0x24')]=qs['offset'](_0x6fb8c3[_0x7d1d('0x39')]['offset']);}_0x346693[_0x7d1d('0x43')]=qs[_0x7d1d('0x44')](_0x6fb8c3[_0x7d1d('0x39')][_0x7d1d('0x44')]);_0x346693['where']=qs['filters'](_[_0x7d1d('0x46')](_0x6fb8c3[_0x7d1d('0x39')],_0x186640['filters']));_0x346693[_0x7d1d('0x45')][_0x7d1d('0x61')]=_0x2500ea['id'];if(_0x6fb8c3['query'][_0x7d1d('0x47')]){_0x346693[_0x7d1d('0x45')]=_[_0x7d1d('0x49')](_0x346693[_0x7d1d('0x45')],{'$or':_[_0x7d1d('0x36')](_0x346693[_0x7d1d('0x3d')],function(_0x335aa0){var _0x225aa0={};_0x225aa0[_0x335aa0]={'$like':'%'+_0x6fb8c3['query']['filter']+'%'};return _0x225aa0;})});}_0x346693=_[_0x7d1d('0x49')]({},_0x346693,_0x6fb8c3['options']);return db['UserMailQueue'][_0x7d1d('0x4c')](_0x346693);}})['then'](function(_0x3822c1){if(_0x3822c1){return db[_0x7d1d('0x62')][_0x7d1d('0x63')]({'where':{'id':_[_0x7d1d('0x36')](_0x3822c1,_0x7d1d('0x64')),'role':_0x7d1d('0x65')},'attributes':['id',_0x7d1d('0x33'),_0x7d1d('0x66'),'updatedAt',_0x7d1d('0x67')]});}})['then'](function(_0x2b5bee){if(_0x2b5bee){return{'count':_0x2b5bee[_0x7d1d('0x26')],'rows':_[_0x7d1d('0x36')](_0x2b5bee[_0x7d1d('0x4d')],function(_0x1423f2){return{'membername':_0x1423f2[_0x7d1d('0x33')],'UserId':_0x1423f2['id'],'queue_name':_0x6cb0cf[_0x7d1d('0x33')],'MailQueueId':_0x6cb0cf['id'],'interface':util[_0x7d1d('0x68')](_0x7d1d('0x69'),_0x7d1d('0x6a'),_0x1423f2[_0x7d1d('0x33')]),'penalty':0x0,'paused':_0x1423f2[_0x7d1d('0x66')],'createdAt':_0x1423f2['createdAt'],'updatedAt':_0x1423f2[_0x7d1d('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x161d52,_0x346693))[_0x7d1d('0x4e')](handleError(_0x161d52,null));};exports[_0x7d1d('0x6c')]=function(_0xbc17e9,_0x55bd4f,_0x767ff7){var _0x3cff5c={};var _0x532d86={};var _0x299c4b;var _0xc6e81e;return db['MailQueue'][_0x7d1d('0x6d')]({'where':{'id':_0xbc17e9[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](handleEntityNotFound(_0x55bd4f,null))['then'](function(_0x55b895){if(_0x55b895){_0x299c4b=_0x55b895;_0x532d86[_0x7d1d('0x38')]=_[_0x7d1d('0x3a')](db[_0x7d1d('0x6e')]['rawAttributes']);_0x532d86[_0x7d1d('0x39')]=_[_0x7d1d('0x3a')](_0xbc17e9[_0x7d1d('0x39')]);_0x532d86[_0x7d1d('0x3b')]=_[_0x7d1d('0x3c')](_0x532d86[_0x7d1d('0x38')],_0x532d86['query']);_0x3cff5c[_0x7d1d('0x3d')]=_[_0x7d1d('0x3c')](_0x532d86['model'],qs[_0x7d1d('0x3e')](_0xbc17e9['query']['fields']));_0x3cff5c['attributes']=_0x3cff5c[_0x7d1d('0x3d')][_0x7d1d('0x3f')]?_0x3cff5c[_0x7d1d('0x3d')]:_0x532d86[_0x7d1d('0x38')];_0x3cff5c['order']=qs[_0x7d1d('0x44')](_0xbc17e9[_0x7d1d('0x39')][_0x7d1d('0x44')]);_0x3cff5c[_0x7d1d('0x45')]=qs['filters'](_[_0x7d1d('0x46')](_0xbc17e9[_0x7d1d('0x39')],_0x532d86[_0x7d1d('0x3b')]));if(_0xbc17e9[_0x7d1d('0x39')]['filter']){_0x3cff5c[_0x7d1d('0x45')]=_[_0x7d1d('0x49')](_0x3cff5c[_0x7d1d('0x45')],{'$or':_['map'](_0x3cff5c[_0x7d1d('0x3d')],function(_0x247ba0){var _0x33f044={};_0x33f044[_0x247ba0]={'$like':'%'+_0xbc17e9[_0x7d1d('0x39')][_0x7d1d('0x47')]+'%'};return _0x33f044;})});}_0x3cff5c=_[_0x7d1d('0x49')]({},_0x3cff5c,_0xbc17e9[_0x7d1d('0x4a')]);return _0x299c4b[_0x7d1d('0x6c')](_0x3cff5c);}})[_0x7d1d('0x2d')](function(_0x4050b9){if(_0x4050b9){_0xc6e81e=_0x4050b9[_0x7d1d('0x3f')];if(!_0xbc17e9[_0x7d1d('0x39')][_0x7d1d('0x40')](_0x7d1d('0x41'))){_0x3cff5c[_0x7d1d('0x42')]=qs[_0x7d1d('0x42')](_0xbc17e9[_0x7d1d('0x39')][_0x7d1d('0x42')]);_0x3cff5c['offset']=qs[_0x7d1d('0x24')](_0xbc17e9[_0x7d1d('0x39')]['offset']);}return _0x299c4b[_0x7d1d('0x6c')](_0x3cff5c);}})['then'](function(_0xf14d0c){if(_0xf14d0c){return _0xf14d0c?{'count':_0xc6e81e,'rows':_0xf14d0c}:null;}})[_0x7d1d('0x2d')](respondWithResult(_0x55bd4f,null))['catch'](handleError(_0x55bd4f,null));};exports['addTeams']=function(_0x1a8f68,_0x1ddd51,_0x243201){var _0x6d9fb9=_0x1a8f68[_0x7d1d('0x54')]['ids'];return db['Team'][_0x7d1d('0x4c')]({'where':{'id':_0x6d9fb9},'attributes':['id'],'include':[{'model':db[_0x7d1d('0x62')],'as':_0x7d1d('0x6f'),'attributes':['id',_0x7d1d('0x33'),'online',_0x7d1d('0x70'),_0x7d1d('0x71')],'raw':!![]}]})['then'](function(_0x3ef9ce){if(_0x3ef9ce){var _0x35fd18=_['flatMap'](_0x3ef9ce,function(_0x365c71){var _0x50cf93=_0x365c71['get']({'plain':!![]});return _0x50cf93['Agents'];});return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0x1a8f68['params']['id']}})[_0x7d1d('0x2d')](function(_0x1c058c){return db[_0x7d1d('0x72')]['transaction'](function(_0x5abd33){return _0x1c058c[_0x7d1d('0x73')](_0x6d9fb9,{'transaction':_0x5abd33})[_0x7d1d('0x2d')](function(){return BPromise[_0x7d1d('0x74')](_0x35fd18,function(_0x2ba5e3){return db[_0x7d1d('0x5f')]['findOrCreate']({'where':{'UserId':_0x2ba5e3['id'],'MailQueueId':_0x1a8f68[_0x7d1d('0x50')]['id']},'transaction':_0x5abd33});});})[_0x7d1d('0x2d')](function(){_0x35fd18[_0x7d1d('0x75')](function(_0x333a4b){socket['emit'](_0x7d1d('0x76'),{'UserId':_0x333a4b['id'],'MailQueueId':_0x1c058c['id']});});});});});}})[_0x7d1d('0x2d')](respondWithStatusCode(_0x1ddd51,null))[_0x7d1d('0x4e')](handleError(_0x1ddd51,null));};exports[_0x7d1d('0x77')]=function(_0x409383,_0x48d8ff,_0x69a29d){return db['Team'][_0x7d1d('0x4c')]({'where':{'id':_0x409383[_0x7d1d('0x39')][_0x7d1d('0x78')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7d1d('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x7d1d('0x2d')](handleEntityNotFound(_0x48d8ff,null))[_0x7d1d('0x2d')](function(_0x203f17){var _0x367838=_['map'](_0x203f17,'id');var _0x32d298=[];var _0x5f1683=[];var _0x4995b7=squel['select']();_0x4995b7[_0x7d1d('0x79')]('tq.TeamId')[_0x7d1d('0x7a')](_0x7d1d('0x7b'),'tq')['join']('user_has_teams','ut',_0x7d1d('0x7c'))[_0x7d1d('0x45')](_0x7d1d('0x7d'),_0x409383[_0x7d1d('0x50')]['id']);for(var _0x1a66bd=0x0;_0x1a66bd<_0x203f17[_0x7d1d('0x3f')];_0x1a66bd+=0x1){let _0x5d0180=_0x203f17[_0x1a66bd];for(var _0x4a8961=0x0;_0x4a8961<_0x5d0180['Agents']['length'];_0x4a8961+=0x1){let _0x288aaf=_0x5d0180['Agents'][_0x4a8961];var _0x16b628=_0x4995b7[_0x7d1d('0x7e')]();_0x16b628['where'](_0x7d1d('0x7f'),_0x288aaf['id']);_0x5f1683[_0x7d1d('0x80')](db['sequelize'][_0x7d1d('0x39')](_0x16b628['toString'](),{'type':db['sequelize']['QueryTypes'][_0x7d1d('0x81')]})['then'](function(_0x176c0e){if(_0x176c0e[_0x7d1d('0x3f')]===0x1){return _0x288aaf['id'];}else{var _0x12e274=_['every'](_[_0x7d1d('0x36')](_0x176c0e,_0x7d1d('0x82')),function(_0x32ae69){return _[_0x7d1d('0x83')](_0x367838,_0x32ae69);});if(_0x12e274){return _0x288aaf['id'];}}}));}}return BPromise['all'](_0x5f1683)[_0x7d1d('0x2d')](function(_0x244902){_0x32d298=_(_0x32d298)['union'](_0x244902)['compact']()['value']();return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0x409383[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](function(_0x113abc){return db[_0x7d1d('0x72')][_0x7d1d('0x84')](function(_0xdfaa3d){return _0x113abc[_0x7d1d('0x77')](_0x409383[_0x7d1d('0x39')]['ids'],{'transaction':_0xdfaa3d})['then'](function(){if(!_[_0x7d1d('0x85')](_0x32d298)){return _0x113abc['removeAgents'](_0x32d298,{'transaction':_0xdfaa3d});}})[_0x7d1d('0x2d')](function(){_0x32d298[_0x7d1d('0x75')](function(_0x36723a){socket['emit'](_0x7d1d('0x86'),{'UserId':_0x36723a,'MailQueueId':_0x113abc['id']});});});});});});})[_0x7d1d('0x2d')](respondWithStatusCode(_0x48d8ff,null))[_0x7d1d('0x4e')](handleError(_0x48d8ff,null));};exports[_0x7d1d('0x87')]=function(_0xb2f3e7,_0x205db0,_0x42371f){return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0xb2f3e7[_0x7d1d('0x50')]['id']}})['then'](handleEntityNotFound(_0x205db0,null))[_0x7d1d('0x2d')](function(_0x3e174d){if(_0x3e174d){return _0x3e174d[_0x7d1d('0x87')](_0xb2f3e7['body'][_0x7d1d('0x78')],_[_0x7d1d('0x88')](_0xb2f3e7['body'],['ids','id'])||{})[_0x7d1d('0x89')](function(_0x56ceac){for(var _0x301d04=0x0;_0x301d04<_0xb2f3e7[_0x7d1d('0x54')][_0x7d1d('0x78')][_0x7d1d('0x3f')];_0x301d04+=0x1){socket['emit'](_0x7d1d('0x76'),{'UserId':Number(_0xb2f3e7[_0x7d1d('0x54')]['ids'][_0x301d04]),'MailQueueId':Number(_0xb2f3e7[_0x7d1d('0x50')]['id'])});}return _0x56ceac;});}})[_0x7d1d('0x2d')](respondWithResult(_0x205db0,null))[_0x7d1d('0x4e')](handleError(_0x205db0,null));};exports[_0x7d1d('0x8a')]=function(_0x45c69a,_0x3afb5c,_0x4cda04){return db[_0x7d1d('0x37')][_0x7d1d('0x52')]({'where':{'id':_0x45c69a[_0x7d1d('0x50')]['id']}})['then'](handleEntityNotFound(_0x3afb5c,null))[_0x7d1d('0x2d')](function(_0x3bbfc5){if(_0x3bbfc5){return _0x3bbfc5['removeAgents'](_0x45c69a[_0x7d1d('0x39')][_0x7d1d('0x78')])[_0x7d1d('0x2d')](function(){if(_[_0x7d1d('0x8b')](_0x45c69a[_0x7d1d('0x39')][_0x7d1d('0x78')])){for(var _0x31dd98=0x0;_0x31dd98<_0x45c69a[_0x7d1d('0x39')]['ids']['length'];_0x31dd98+=0x1){socket[_0x7d1d('0x8c')]('userMailQueue:remove',{'UserId':Number(_0x45c69a[_0x7d1d('0x39')][_0x7d1d('0x78')][_0x31dd98]),'MailQueueId':Number(_0x45c69a[_0x7d1d('0x50')]['id'])});}}else{socket[_0x7d1d('0x8c')](_0x7d1d('0x86'),{'UserId':Number(_0x45c69a[_0x7d1d('0x39')][_0x7d1d('0x78')]),'MailQueueId':Number(_0x45c69a['params']['id'])});}});}})[_0x7d1d('0x2d')](respondWithStatusCode(_0x3afb5c,null))[_0x7d1d('0x4e')](handleError(_0x3afb5c,null));};exports[_0x7d1d('0x8d')]=function(_0x5335c1,_0x3aa040,_0x324d4b){var _0xd7ca0a={};var _0x4b6252={};var _0x5bc7c0;var _0x6e19f;return db['MailQueue'][_0x7d1d('0x6d')]({'where':{'id':_0x5335c1[_0x7d1d('0x50')]['id']}})[_0x7d1d('0x2d')](handleEntityNotFound(_0x3aa040,null))[_0x7d1d('0x2d')](function(_0x3e831d){if(_0x3e831d){_0x5bc7c0=_0x3e831d;_0x4b6252['model']=_[_0x7d1d('0x3a')](db[_0x7d1d('0x62')][_0x7d1d('0x60')]);_0x4b6252[_0x7d1d('0x39')]=_[_0x7d1d('0x3a')](_0x5335c1[_0x7d1d('0x39')]);_0x4b6252[_0x7d1d('0x3b')]=_['intersection'](_0x4b6252[_0x7d1d('0x38')],_0x4b6252[_0x7d1d('0x39')]);_0xd7ca0a[_0x7d1d('0x3d')]=_['intersection'](_0x4b6252['model'],qs[_0x7d1d('0x3e')](_0x5335c1[_0x7d1d('0x39')]['fields']));_0xd7ca0a[_0x7d1d('0x3d')]=_0xd7ca0a[_0x7d1d('0x3d')][_0x7d1d('0x3f')]?_0xd7ca0a[_0x7d1d('0x3d')]:_0x4b6252['model'];_0xd7ca0a[_0x7d1d('0x43')]=qs['sort'](_0x5335c1[_0x7d1d('0x39')]['sort']);_0xd7ca0a['where']=qs[_0x7d1d('0x3b')](_['pick'](_0x5335c1['query'],_0x4b6252[_0x7d1d('0x3b')]));if(_0x5335c1[_0x7d1d('0x39')][_0x7d1d('0x47')]){_0xd7ca0a[_0x7d1d('0x45')]=_['merge'](_0xd7ca0a[_0x7d1d('0x45')],{'$or':_[_0x7d1d('0x36')](_0xd7ca0a[_0x7d1d('0x3d')],function(_0x2727db){var _0x4e54c4={};_0x4e54c4[_0x2727db]={'$like':'%'+_0x5335c1['query'][_0x7d1d('0x47')]+'%'};return _0x4e54c4;})});}_0xd7ca0a=_[_0x7d1d('0x49')]({},_0xd7ca0a,_0x5335c1[_0x7d1d('0x4a')]);return _0x5bc7c0[_0x7d1d('0x8d')](_0xd7ca0a);}})[_0x7d1d('0x2d')](function(_0x182a4b){if(_0x182a4b){_0x6e19f=_0x182a4b['length'];if(!_0x5335c1[_0x7d1d('0x39')][_0x7d1d('0x40')](_0x7d1d('0x41'))){_0xd7ca0a[_0x7d1d('0x42')]=qs[_0x7d1d('0x42')](_0x5335c1[_0x7d1d('0x39')]['limit']);_0xd7ca0a[_0x7d1d('0x24')]=qs[_0x7d1d('0x24')](_0x5335c1[_0x7d1d('0x39')]['offset']);}return _0x5bc7c0[_0x7d1d('0x8d')](_0xd7ca0a);}})[_0x7d1d('0x2d')](function(_0x52317a){if(_0x52317a){return _0x52317a?{'count':_0x6e19f,'rows':_0x52317a}:null;}})[_0x7d1d('0x2d')](respondWithResult(_0x3aa040,null))[_0x7d1d('0x4e')](handleError(_0x3aa040,null));}; \ No newline at end of file +var _0xbccf=['params','rawAttributes','length','MailQueue','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','flatMap','sequelize','forEach','emit','removeTeams','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','all','union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','./mailQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x33f366,_0x131b8b){var _0x249aa5=function(_0x2b3e91){while(--_0x2b3e91){_0x33f366['push'](_0x33f366['shift']());}};_0x249aa5(++_0x131b8b);}(_0xbccf,0x1d2));var _0xfbcc=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0xbccf[_0x623e7];return _0x121131;};'use strict';var emlformat=require(_0xfbcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbcc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbcc('0x2'));var moment=require(_0xfbcc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbcc('0x4'));var path=require(_0xfbcc('0x5'));var sox=require(_0xfbcc('0x6'));var csv=require(_0xfbcc('0x7'));var ejs=require(_0xfbcc('0x8'));var fs=require('fs');var fs_extra=require(_0xfbcc('0x9'));var _=require(_0xfbcc('0xa'));var squel=require(_0xfbcc('0xb'));var crypto=require(_0xfbcc('0xc'));var jsforce=require(_0xfbcc('0xd'));var deskjs=require(_0xfbcc('0xe'));var toCsv=require(_0xfbcc('0x7'));var querystring=require(_0xfbcc('0xf'));var Papa=require(_0xfbcc('0x10'));var Redis=require(_0xfbcc('0x11'));var authService=require(_0xfbcc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfbcc('0x13'));var hardwareService=require(_0xfbcc('0x14'));var logger=require('../../config/logger')(_0xfbcc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfbcc('0x16'));var db=require(_0xfbcc('0x17'))['db'];config[_0xfbcc('0x18')]=_['defaults'](config[_0xfbcc('0x18')],{'host':_0xfbcc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbcc('0x18')]));require(_0xfbcc('0x1a'))[_0xfbcc('0x1b')](socket);function respondWithStatusCode(_0x42aa92,_0x4d3d5e){_0x4d3d5e=_0x4d3d5e||0xcc;return function(_0xc2e8f8){if(_0xc2e8f8){return _0x42aa92['sendStatus'](_0x4d3d5e);}return _0x42aa92[_0xfbcc('0x1c')](_0x4d3d5e)[_0xfbcc('0x1d')]();};}function respondWithResult(_0x356c05,_0x4e4dd0){_0x4e4dd0=_0x4e4dd0||0xc8;return function(_0x4ef826){if(_0x4ef826){return _0x356c05[_0xfbcc('0x1c')](_0x4e4dd0)[_0xfbcc('0x1e')](_0x4ef826);}};}function respondWithFilteredResult(_0x21f910,_0x3fbaa7){return function(_0x3fe600){if(_0x3fe600){var _0x5d6fcf=typeof _0x3fbaa7[_0xfbcc('0x1f')]===_0xfbcc('0x20')&&typeof _0x3fbaa7[_0xfbcc('0x21')]===_0xfbcc('0x20');var _0x23f0e0=_0x3fe600[_0xfbcc('0x22')];var _0x11cf3d=_0x5d6fcf?0x0:_0x3fbaa7['offset'];var _0x481e6f=_0x5d6fcf?_0x3fe600['count']:_0x3fbaa7['offset']+_0x3fbaa7['limit'];var _0x2c1f80;if(_0x481e6f>=_0x23f0e0){_0x481e6f=_0x23f0e0;_0x2c1f80=0xc8;}else{_0x2c1f80=0xce;}_0x21f910[_0xfbcc('0x1c')](_0x2c1f80);return _0x21f910[_0xfbcc('0x23')](_0xfbcc('0x24'),_0x11cf3d+'-'+_0x481e6f+'/'+_0x23f0e0)[_0xfbcc('0x1e')](_0x3fe600);}return null;};}function patchUpdates(_0x5c9ff4){return function(_0xf5bfd3){try{jsonpatch[_0xfbcc('0x25')](_0xf5bfd3,_0x5c9ff4,!![]);}catch(_0x2c3228){return BPromise['reject'](_0x2c3228);}return _0xf5bfd3[_0xfbcc('0x26')]();};}function saveUpdates(_0x384443,_0x206969){return function(_0x2d6b0c){if(_0x2d6b0c){return _0x2d6b0c[_0xfbcc('0x27')](_0x384443)[_0xfbcc('0x28')](function(_0x56b1fd){return _0x56b1fd;});}return null;};}function removeEntity(_0x48025d,_0xc29958){return function(_0x5cb3e0){if(_0x5cb3e0){return _0x5cb3e0[_0xfbcc('0x29')]()[_0xfbcc('0x28')](function(){var _0x479b0b=_0x5cb3e0[_0xfbcc('0x2a')]({'plain':!![]});var _0x574e63=_0xfbcc('0x2b');return db[_0xfbcc('0x2c')][_0xfbcc('0x29')]({'where':{'type':_0x574e63,'resourceId':_0x479b0b['id']}})[_0xfbcc('0x28')](function(){return _0x5cb3e0;});})[_0xfbcc('0x28')](function(){_0x48025d[_0xfbcc('0x1c')](0xcc)[_0xfbcc('0x1d')]();});}};}function handleEntityNotFound(_0x3bfe8e,_0x31328f){return function(_0x4835cc){if(!_0x4835cc){_0x3bfe8e[_0xfbcc('0x2d')](0x194);}return _0x4835cc;};}function handleError(_0x4af4af,_0x487fea){_0x487fea=_0x487fea||0x1f4;return function(_0x5a9a0a){logger[_0xfbcc('0x2e')](_0x5a9a0a['stack']);if(_0x5a9a0a[_0xfbcc('0x2f')]){delete _0x5a9a0a['name'];}_0x4af4af[_0xfbcc('0x1c')](_0x487fea)[_0xfbcc('0x30')](_0x5a9a0a);};}exports[_0xfbcc('0x31')]=function(_0x511405,_0x4822b6){var _0x4c3fbe={},_0x3ecd37={},_0x3e9a82={'count':0x0,'rows':[]};var _0x417af4=_[_0xfbcc('0x32')](db['MailQueue']['rawAttributes'],function(_0x10363e){return{'name':_0x10363e['fieldName'],'type':_0x10363e[_0xfbcc('0x33')][_0xfbcc('0x34')]};});_0x3ecd37[_0xfbcc('0x35')]=_[_0xfbcc('0x32')](_0x417af4,_0xfbcc('0x2f'));_0x3ecd37[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x511405['query']);_0x3ecd37[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x3ecd37['model'],_0x3ecd37['query']);_0x4c3fbe['attributes']=_['intersection'](_0x3ecd37['model'],qs['fields'](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x4c3fbe[_0xfbcc('0x3b')]=_0x4c3fbe[_0xfbcc('0x3b')]['length']?_0x4c3fbe[_0xfbcc('0x3b')]:_0x3ecd37[_0xfbcc('0x35')];if(!_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3c')]('nolimit')){_0x4c3fbe[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x511405['query'][_0xfbcc('0x21')]);_0x4c3fbe[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}_0x4c3fbe[_0xfbcc('0x3d')]=qs[_0xfbcc('0x3e')](_0x511405[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x4c3fbe[_0xfbcc('0x3f')]=qs[_0xfbcc('0x38')](_[_0xfbcc('0x40')](_0x511405['query'],_0x3ecd37[_0xfbcc('0x38')]),_0x417af4);if(_0x511405[_0xfbcc('0x36')]['filter']){_0x4c3fbe[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x4c3fbe['where'],{'$or':_['map'](_0x417af4,function(_0x3d936b){if(_0x3d936b[_0xfbcc('0x33')]!==_0xfbcc('0x42')){var _0x2e8165={};_0x2e8165[_0x3d936b['name']]={'$like':'%'+_0x511405['query']['filter']+'%'};return _0x2e8165;}})});}_0x4c3fbe=_['merge']({},_0x4c3fbe,_0x511405[_0xfbcc('0x43')]);var _0x37e3ee={'where':_0x4c3fbe[_0xfbcc('0x3f')]};return db['MailQueue'][_0xfbcc('0x22')](_0x37e3ee)[_0xfbcc('0x28')](function(_0x6430bc){_0x3e9a82[_0xfbcc('0x22')]=_0x6430bc;if(_0x511405[_0xfbcc('0x36')][_0xfbcc('0x44')]){_0x4c3fbe[_0xfbcc('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xfbcc('0x46')](_0x4c3fbe);})['then'](function(_0x196409){_0x3e9a82[_0xfbcc('0x47')]=_0x196409;return _0x3e9a82;})['then'](respondWithFilteredResult(_0x4822b6,_0x4c3fbe))[_0xfbcc('0x48')](handleError(_0x4822b6,null));};exports[_0xfbcc('0x49')]=function(_0x216a06,_0x47cc23){var _0x302939={'raw':!![],'where':{'id':_0x216a06[_0xfbcc('0x4a')]['id']}},_0x263822={};_0x263822[_0xfbcc('0x35')]=_['keys'](db['MailQueue'][_0xfbcc('0x4b')]);_0x263822[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x216a06[_0xfbcc('0x36')]);_0x263822[_0xfbcc('0x38')]=_['intersection'](_0x263822[_0xfbcc('0x35')],_0x263822[_0xfbcc('0x36')]);_0x302939[_0xfbcc('0x3b')]=_['intersection'](_0x263822['model'],qs['fields'](_0x216a06[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x302939[_0xfbcc('0x3b')]=_0x302939[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x302939['attributes']:_0x263822[_0xfbcc('0x35')];if(_0x216a06['query'][_0xfbcc('0x44')]){_0x302939[_0xfbcc('0x45')]=[{'all':!![]}];}_0x302939=_[_0xfbcc('0x41')]({},_0x302939,_0x216a06[_0xfbcc('0x43')]);return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')](_0x302939)[_0xfbcc('0x28')](handleEntityNotFound(_0x47cc23,null))[_0xfbcc('0x28')](respondWithResult(_0x47cc23,null))['catch'](handleError(_0x47cc23,null));};exports[_0xfbcc('0x4f')]=function(_0x44f724,_0x319383){return db[_0xfbcc('0x4d')][_0xfbcc('0x4f')](_0x44f724[_0xfbcc('0x50')],{})[_0xfbcc('0x28')](function(_0x690224){var _0x44fed0=_0x44f724[_0xfbcc('0x51')][_0xfbcc('0x2a')]({'plain':!![]});if(!_0x44fed0)throw new Error(_0xfbcc('0x52'));if(_0x44fed0['role']===_0xfbcc('0x51')){var _0x148c46=_0x690224[_0xfbcc('0x2a')]({'plain':!![]});var _0x18e27a=_0xfbcc('0x2b');return db[_0xfbcc('0x53')][_0xfbcc('0x4e')]({'where':{'name':_0x18e27a,'userProfileId':_0x44fed0['userProfileId']},'raw':!![]})[_0xfbcc('0x28')](function(_0x594e59){if(_0x594e59&&_0x594e59[_0xfbcc('0x54')]===0x0){return db[_0xfbcc('0x2c')][_0xfbcc('0x4f')]({'name':_0x148c46['name'],'resourceId':_0x148c46['id'],'type':_0x594e59[_0xfbcc('0x2f')],'sectionId':_0x594e59['id']},{})['then'](function(){return _0x690224;});}else{return _0x690224;}})[_0xfbcc('0x48')](function(_0x44a430){logger[_0xfbcc('0x2e')](_0xfbcc('0x55'),_0x44a430);throw _0x44a430;});}return _0x690224;})[_0xfbcc('0x28')](respondWithResult(_0x319383,0xc9))[_0xfbcc('0x48')](handleError(_0x319383,null));};exports[_0xfbcc('0x27')]=function(_0x701a9,_0xfc3aab){if(_0x701a9[_0xfbcc('0x50')]['id']){delete _0x701a9[_0xfbcc('0x50')]['id'];}return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x701a9['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0xfc3aab,null))['then'](saveUpdates(_0x701a9[_0xfbcc('0x50')],null))['then'](respondWithResult(_0xfc3aab,null))[_0xfbcc('0x48')](handleError(_0xfc3aab,null));};exports[_0xfbcc('0x29')]=function(_0x783ce0,_0x5a25e6){return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x783ce0[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x5a25e6,null))[_0xfbcc('0x28')](removeEntity(_0x5a25e6,null))['catch'](handleError(_0x5a25e6,null));};exports[_0xfbcc('0x56')]=function(_0x11fe1f,_0x52a2db){return db['MailQueue'][_0xfbcc('0x56')]()[_0xfbcc('0x28')](respondWithResult(_0x52a2db,null))[_0xfbcc('0x48')](handleError(_0x52a2db,null));};exports['getMembers']=function(_0x55b094,_0x45ec01,_0x64a6d8){var _0x479a2d={'raw':!![],'where':{}},_0x5b87f3={},_0x3197b1;return db[_0xfbcc('0x4d')]['findOne']({'where':{'id':_0x55b094[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x45ec01,null))['then'](function(_0x25245c){if(_0x25245c){_0x3197b1=_0x25245c[_0xfbcc('0x2a')]({'plain':!![]});_0x5b87f3[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db[_0xfbcc('0x57')][_0xfbcc('0x4b')]);_0x5b87f3[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x55b094['query']);_0x5b87f3[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x5b87f3[_0xfbcc('0x35')],_0x5b87f3[_0xfbcc('0x36')]);_0x479a2d[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x5b87f3[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x55b094['query']['fields']));_0x479a2d[_0xfbcc('0x3b')]=_0x479a2d[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x479a2d[_0xfbcc('0x3b')]:_0x5b87f3['model'];if(!_0x55b094['query'][_0xfbcc('0x3c')](_0xfbcc('0x58'))){_0x479a2d[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x21')]);_0x479a2d[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}_0x479a2d[_0xfbcc('0x3d')]=qs[_0xfbcc('0x3e')](_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x479a2d[_0xfbcc('0x3f')]=qs['filters'](_['pick'](_0x55b094['query'],_0x5b87f3[_0xfbcc('0x38')]));_0x479a2d[_0xfbcc('0x3f')][_0xfbcc('0x59')]=_0x25245c['id'];if(_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x5a')]){_0x479a2d['where']=_[_0xfbcc('0x41')](_0x479a2d[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x479a2d[_0xfbcc('0x3b')],function(_0x3c5f67){var _0x2f1afb={};_0x2f1afb[_0x3c5f67]={'$like':'%'+_0x55b094[_0xfbcc('0x36')][_0xfbcc('0x5a')]+'%'};return _0x2f1afb;})});}_0x479a2d=_[_0xfbcc('0x41')]({},_0x479a2d,_0x55b094[_0xfbcc('0x43')]);return db[_0xfbcc('0x57')][_0xfbcc('0x46')](_0x479a2d);}})['then'](function(_0x325914){if(_0x325914){return db[_0xfbcc('0x5b')][_0xfbcc('0x5c')]({'where':{'id':_[_0xfbcc('0x32')](_0x325914,_0xfbcc('0x5d')),'role':'agent'},'attributes':['id','name',_0xfbcc('0x5e'),'updatedAt',_0xfbcc('0x5f')]});}})[_0xfbcc('0x28')](function(_0x4bb34b){if(_0x4bb34b){return{'count':_0x4bb34b['count'],'rows':_[_0xfbcc('0x32')](_0x4bb34b[_0xfbcc('0x47')],function(_0x30116e){return{'membername':_0x30116e['name'],'UserId':_0x30116e['id'],'queue_name':_0x3197b1['name'],'MailQueueId':_0x3197b1['id'],'interface':util[_0xfbcc('0x60')]('%s/%s',_0xfbcc('0x61'),_0x30116e[_0xfbcc('0x2f')]),'penalty':0x0,'paused':_0x30116e[_0xfbcc('0x5e')],'createdAt':_0x30116e[_0xfbcc('0x5f')],'updatedAt':_0x30116e[_0xfbcc('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x45ec01,_0x479a2d))[_0xfbcc('0x48')](handleError(_0x45ec01,null));};exports[_0xfbcc('0x63')]=function(_0x2efd37,_0xe8e81a,_0x495a0d){var _0x168e66={};var _0x5954e4={};var _0x2e6a15;var _0x371702;return db[_0xfbcc('0x4d')][_0xfbcc('0x64')]({'where':{'id':_0x2efd37['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0xe8e81a,null))[_0xfbcc('0x28')](function(_0x2ba93c){if(_0x2ba93c){_0x2e6a15=_0x2ba93c;_0x5954e4[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db[_0xfbcc('0x65')]['rawAttributes']);_0x5954e4[_0xfbcc('0x36')]=_[_0xfbcc('0x37')](_0x2efd37['query']);_0x5954e4[_0xfbcc('0x38')]=_['intersection'](_0x5954e4[_0xfbcc('0x35')],_0x5954e4[_0xfbcc('0x36')]);_0x168e66[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x5954e4[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x2efd37[_0xfbcc('0x36')][_0xfbcc('0x3a')]));_0x168e66[_0xfbcc('0x3b')]=_0x168e66[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x168e66[_0xfbcc('0x3b')]:_0x5954e4[_0xfbcc('0x35')];_0x168e66['order']=qs[_0xfbcc('0x3e')](_0x2efd37['query'][_0xfbcc('0x3e')]);_0x168e66[_0xfbcc('0x3f')]=qs['filters'](_[_0xfbcc('0x40')](_0x2efd37['query'],_0x5954e4[_0xfbcc('0x38')]));if(_0x2efd37[_0xfbcc('0x36')]['filter']){_0x168e66[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x168e66[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x168e66[_0xfbcc('0x3b')],function(_0x11095b){var _0x49a93b={};_0x49a93b[_0x11095b]={'$like':'%'+_0x2efd37['query']['filter']+'%'};return _0x49a93b;})});}_0x168e66=_[_0xfbcc('0x41')]({},_0x168e66,_0x2efd37['options']);return _0x2e6a15['getTeams'](_0x168e66);}})[_0xfbcc('0x28')](function(_0x8daad5){if(_0x8daad5){_0x371702=_0x8daad5[_0xfbcc('0x4c')];if(!_0x2efd37[_0xfbcc('0x36')]['hasOwnProperty'](_0xfbcc('0x58'))){_0x168e66[_0xfbcc('0x21')]=qs['limit'](_0x2efd37[_0xfbcc('0x36')]['limit']);_0x168e66['offset']=qs[_0xfbcc('0x1f')](_0x2efd37[_0xfbcc('0x36')][_0xfbcc('0x1f')]);}return _0x2e6a15[_0xfbcc('0x63')](_0x168e66);}})[_0xfbcc('0x28')](function(_0xd18b5e){if(_0xd18b5e){return _0xd18b5e?{'count':_0x371702,'rows':_0xd18b5e}:null;}})[_0xfbcc('0x28')](respondWithResult(_0xe8e81a,null))[_0xfbcc('0x48')](handleError(_0xe8e81a,null));};exports[_0xfbcc('0x66')]=function(_0x54c24c,_0x52c823,_0x126085){var _0x13b221=_0x54c24c[_0xfbcc('0x50')][_0xfbcc('0x67')];return db['Team']['findAll']({'where':{'id':_0x13b221},'attributes':['id'],'include':[{'model':db[_0xfbcc('0x5b')],'as':_0xfbcc('0x68'),'attributes':['id',_0xfbcc('0x2f'),'online',_0xfbcc('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x3e944c){if(_0x3e944c){var _0x52ff21=_[_0xfbcc('0x6a')](_0x3e944c,function(_0x323f6d){var _0x49f286=_0x323f6d[_0xfbcc('0x2a')]({'plain':!![]});return _0x49f286['Agents'];});return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x54c24c[_0xfbcc('0x4a')]['id']}})['then'](function(_0x2f68d6){return db[_0xfbcc('0x6b')]['transaction'](function(_0x16302a){return _0x2f68d6[_0xfbcc('0x66')](_0x13b221,{'transaction':_0x16302a})['then'](function(){return BPromise['each'](_0x52ff21,function(_0x266fa2){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x266fa2['id'],'MailQueueId':_0x54c24c[_0xfbcc('0x4a')]['id']},'transaction':_0x16302a});});})[_0xfbcc('0x28')](function(){_0x52ff21[_0xfbcc('0x6c')](function(_0x489560){socket[_0xfbcc('0x6d')]('userMailQueue:save',{'UserId':_0x489560['id'],'MailQueueId':_0x2f68d6['id']});});});});});}})[_0xfbcc('0x28')](respondWithStatusCode(_0x52c823,null))[_0xfbcc('0x48')](handleError(_0x52c823,null));};exports[_0xfbcc('0x6e')]=function(_0x490c8c,_0x477a0b,_0x15ec98){return db[_0xfbcc('0x65')][_0xfbcc('0x46')]({'where':{'id':_0x490c8c[_0xfbcc('0x36')][_0xfbcc('0x67')]},'attributes':['id'],'include':[{'model':db[_0xfbcc('0x5b')],'as':_0xfbcc('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfbcc('0x28')](handleEntityNotFound(_0x477a0b,null))[_0xfbcc('0x28')](function(_0x4ab631){var _0x59b80f=_['map'](_0x4ab631,'id');var _0x1dac6a=[];var _0x3adc2d=[];var _0x44f007=squel['select']();_0x44f007['field'](_0xfbcc('0x6f'))['from'](_0xfbcc('0x70'),'tq')[_0xfbcc('0x71')](_0xfbcc('0x72'),'ut',_0xfbcc('0x73'))[_0xfbcc('0x3f')](_0xfbcc('0x74'),_0x490c8c[_0xfbcc('0x4a')]['id']);for(var _0x27f4a0=0x0;_0x27f4a0<_0x4ab631[_0xfbcc('0x4c')];_0x27f4a0+=0x1){let _0x4f6f35=_0x4ab631[_0x27f4a0];for(var _0x4d86ad=0x0;_0x4d86ad<_0x4f6f35['Agents'][_0xfbcc('0x4c')];_0x4d86ad+=0x1){let _0x1c02dd=_0x4f6f35[_0xfbcc('0x68')][_0x4d86ad];var _0x330bde=_0x44f007[_0xfbcc('0x75')]();_0x330bde[_0xfbcc('0x3f')](_0xfbcc('0x76'),_0x1c02dd['id']);_0x3adc2d['push'](db[_0xfbcc('0x6b')][_0xfbcc('0x36')](_0x330bde[_0xfbcc('0x77')](),{'type':db['sequelize']['QueryTypes'][_0xfbcc('0x78')]})[_0xfbcc('0x28')](function(_0x176a6e){if(_0x176a6e[_0xfbcc('0x4c')]===0x1){return _0x1c02dd['id'];}else{var _0x3cb709=_['every'](_[_0xfbcc('0x32')](_0x176a6e,_0xfbcc('0x79')),function(_0x478a74){return _['includes'](_0x59b80f,_0x478a74);});if(_0x3cb709){return _0x1c02dd['id'];}}}));}}return BPromise[_0xfbcc('0x7a')](_0x3adc2d)[_0xfbcc('0x28')](function(_0x283fe6){_0x1dac6a=_(_0x1dac6a)[_0xfbcc('0x7b')](_0x283fe6)[_0xfbcc('0x7c')]()[_0xfbcc('0x7d')]();return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x490c8c[_0xfbcc('0x4a')]['id']}})['then'](function(_0x297b2a){return db[_0xfbcc('0x6b')][_0xfbcc('0x7e')](function(_0x85d2a3){return _0x297b2a['removeTeams'](_0x490c8c[_0xfbcc('0x36')]['ids'],{'transaction':_0x85d2a3})['then'](function(){if(!_['isEmpty'](_0x1dac6a)){return _0x297b2a[_0xfbcc('0x7f')](_0x1dac6a,{'transaction':_0x85d2a3});}})[_0xfbcc('0x28')](function(){_0x1dac6a[_0xfbcc('0x6c')](function(_0x5c81e7){socket['emit'](_0xfbcc('0x80'),{'UserId':_0x5c81e7,'MailQueueId':_0x297b2a['id']});});});});});});})[_0xfbcc('0x28')](respondWithStatusCode(_0x477a0b,null))[_0xfbcc('0x48')](handleError(_0x477a0b,null));};exports[_0xfbcc('0x81')]=function(_0x1d82bb,_0x4c33b0,_0x4db2d5){return db['MailQueue'][_0xfbcc('0x4e')]({'where':{'id':_0x1d82bb['params']['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x4c33b0,null))[_0xfbcc('0x28')](function(_0x22ba57){if(_0x22ba57){return _0x22ba57['addAgents'](_0x1d82bb[_0xfbcc('0x50')][_0xfbcc('0x67')],_[_0xfbcc('0x82')](_0x1d82bb[_0xfbcc('0x50')],[_0xfbcc('0x67'),'id'])||{})[_0xfbcc('0x83')](function(_0xf59f1e){for(var _0x5007e7=0x0;_0x5007e7<_0x1d82bb['body']['ids'][_0xfbcc('0x4c')];_0x5007e7+=0x1){socket[_0xfbcc('0x6d')](_0xfbcc('0x84'),{'UserId':Number(_0x1d82bb[_0xfbcc('0x50')][_0xfbcc('0x67')][_0x5007e7]),'MailQueueId':Number(_0x1d82bb[_0xfbcc('0x4a')]['id'])});}return _0xf59f1e;});}})[_0xfbcc('0x28')](respondWithResult(_0x4c33b0,null))[_0xfbcc('0x48')](handleError(_0x4c33b0,null));};exports['removeAgents']=function(_0x3be525,_0x15ca54,_0x1b61ab){return db[_0xfbcc('0x4d')][_0xfbcc('0x4e')]({'where':{'id':_0x3be525[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x15ca54,null))[_0xfbcc('0x28')](function(_0x2a4063){if(_0x2a4063){return _0x2a4063[_0xfbcc('0x7f')](_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')])['then'](function(){if(_[_0xfbcc('0x85')](_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')])){for(var _0x8ce0e6=0x0;_0x8ce0e6<_0x3be525[_0xfbcc('0x36')][_0xfbcc('0x67')][_0xfbcc('0x4c')];_0x8ce0e6+=0x1){socket[_0xfbcc('0x6d')](_0xfbcc('0x80'),{'UserId':Number(_0x3be525['query']['ids'][_0x8ce0e6]),'MailQueueId':Number(_0x3be525[_0xfbcc('0x4a')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3be525['query'][_0xfbcc('0x67')]),'MailQueueId':Number(_0x3be525[_0xfbcc('0x4a')]['id'])});}});}})[_0xfbcc('0x28')](respondWithStatusCode(_0x15ca54,null))[_0xfbcc('0x48')](handleError(_0x15ca54,null));};exports['getAgents']=function(_0x3ef7ed,_0x32846c,_0x21806b){var _0x262053={};var _0x387d19={};var _0xa96a7c;var _0x3566f2;return db[_0xfbcc('0x4d')][_0xfbcc('0x64')]({'where':{'id':_0x3ef7ed[_0xfbcc('0x4a')]['id']}})[_0xfbcc('0x28')](handleEntityNotFound(_0x32846c,null))[_0xfbcc('0x28')](function(_0x36c36e){if(_0x36c36e){_0xa96a7c=_0x36c36e;_0x387d19[_0xfbcc('0x35')]=_[_0xfbcc('0x37')](db['User']['rawAttributes']);_0x387d19['query']=_[_0xfbcc('0x37')](_0x3ef7ed[_0xfbcc('0x36')]);_0x387d19[_0xfbcc('0x38')]=_[_0xfbcc('0x39')](_0x387d19[_0xfbcc('0x35')],_0x387d19[_0xfbcc('0x36')]);_0x262053[_0xfbcc('0x3b')]=_[_0xfbcc('0x39')](_0x387d19[_0xfbcc('0x35')],qs[_0xfbcc('0x3a')](_0x3ef7ed['query'][_0xfbcc('0x3a')]));_0x262053[_0xfbcc('0x3b')]=_0x262053[_0xfbcc('0x3b')][_0xfbcc('0x4c')]?_0x262053[_0xfbcc('0x3b')]:_0x387d19[_0xfbcc('0x35')];_0x262053['order']=qs[_0xfbcc('0x3e')](_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x3e')]);_0x262053[_0xfbcc('0x3f')]=qs[_0xfbcc('0x38')](_[_0xfbcc('0x40')](_0x3ef7ed[_0xfbcc('0x36')],_0x387d19['filters']));if(_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x5a')]){_0x262053[_0xfbcc('0x3f')]=_[_0xfbcc('0x41')](_0x262053[_0xfbcc('0x3f')],{'$or':_[_0xfbcc('0x32')](_0x262053[_0xfbcc('0x3b')],function(_0x97e3e7){var _0x591e6c={};_0x591e6c[_0x97e3e7]={'$like':'%'+_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x5a')]+'%'};return _0x591e6c;})});}_0x262053=_[_0xfbcc('0x41')]({},_0x262053,_0x3ef7ed[_0xfbcc('0x43')]);return _0xa96a7c['getAgents'](_0x262053);}})[_0xfbcc('0x28')](function(_0x5df623){if(_0x5df623){_0x3566f2=_0x5df623['length'];if(!_0x3ef7ed[_0xfbcc('0x36')][_0xfbcc('0x3c')](_0xfbcc('0x58'))){_0x262053[_0xfbcc('0x21')]=qs[_0xfbcc('0x21')](_0x3ef7ed[_0xfbcc('0x36')]['limit']);_0x262053[_0xfbcc('0x1f')]=qs[_0xfbcc('0x1f')](_0x3ef7ed['query'][_0xfbcc('0x1f')]);}return _0xa96a7c[_0xfbcc('0x86')](_0x262053);}})[_0xfbcc('0x28')](function(_0x62da34){if(_0x62da34){return _0x62da34?{'count':_0x3566f2,'rows':_0x62da34}:null;}})[_0xfbcc('0x28')](respondWithResult(_0x32846c,null))[_0xfbcc('0x48')](handleError(_0x32846c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5006c2b..6c2d705 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 _0x25e2=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x184ae7,_0x193dda){var _0x47b27c=function(_0x2f0f01){while(--_0x2f0f01){_0x184ae7['push'](_0x184ae7['shift']());}};_0x47b27c(++_0x193dda);}(_0x25e2,0x11e));var _0x225e=function(_0x213cf9,_0x2a149a){_0x213cf9=_0x213cf9-0x0;var _0x4eb6ad=_0x25e2[_0x213cf9];return _0x4eb6ad;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x225e('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x225e('0x1')](0x0);var events={'afterCreate':_0x225e('0x2'),'afterUpdate':_0x225e('0x3'),'afterDestroy':_0x225e('0x4')};function emitEvent(_0x34d3ba){return function(_0x2a27be,_0x4dc23a,_0x103791){MailQueueEvents[_0x225e('0x5')](_0x34d3ba+':'+_0x2a27be['id'],_0x2a27be);MailQueueEvents[_0x225e('0x5')](_0x34d3ba,_0x2a27be);_0x103791(null);};}for(var e in events){if(events[_0x225e('0x6')](e)){var event=events[e];MailQueue[_0x225e('0x7')](e,emitEvent(event));}}module[_0x225e('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x2ddf=['MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x476852,_0x2a66c0){var _0x5ce4e5=function(_0x5c8258){while(--_0x5c8258){_0x476852['push'](_0x476852['shift']());}};_0x5ce4e5(++_0x2a66c0);}(_0x2ddf,0x18a));var _0xf2dd=function(_0x1586da,_0x4d4ce0){_0x1586da=_0x1586da-0x0;var _0x190021=_0x2ddf[_0x1586da];return _0x190021;};'use strict';var EventEmitter=require(_0xf2dd('0x0'));var MailQueue=require(_0xf2dd('0x1'))['db'][_0xf2dd('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xf2dd('0x3')](0x0);var events={'afterCreate':_0xf2dd('0x4'),'afterUpdate':_0xf2dd('0x5'),'afterDestroy':_0xf2dd('0x6')};function emitEvent(_0x29240d){return function(_0x494c9a,_0x4f6b07,_0xbb331f){MailQueueEvents[_0xf2dd('0x7')](_0x29240d+':'+_0x494c9a['id'],_0x494c9a);MailQueueEvents[_0xf2dd('0x7')](_0x29240d,_0x494c9a);_0xbb331f(null);};}for(var e in events){if(events[_0xf2dd('0x8')](e)){var event=events[e];MailQueue[_0xf2dd('0x9')](e,emitEvent(event));}}module[_0xf2dd('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4447cea..5363df5 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 _0x6dc1=['api','moment','request-promise','path','../../config/environment','exports','define','lodash','../../config/logger'];(function(_0x57efb2,_0x3207b0){var _0xdae42c=function(_0x5049af){while(--_0x5049af){_0x57efb2['push'](_0x57efb2['shift']());}};_0xdae42c(++_0x3207b0);}(_0x6dc1,0x11e));var _0x16dc=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x6dc1[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x16dc('0x0'));var util=require('util');var logger=require(_0x16dc('0x1'))(_0x16dc('0x2'));var moment=require(_0x16dc('0x3'));var BPromise=require('bluebird');var rp=require(_0x16dc('0x4'));var fs=require('fs');var path=require(_0x16dc('0x5'));var rimraf=require('rimraf');var config=require(_0x16dc('0x6'));var attributes=require('./mailQueue.attributes');module[_0x16dc('0x7')]=function(_0x3e3a6d,_0x222488){return _0x3e3a6d[_0x16dc('0x8')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a45=['exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x2eda7f,_0x2ce49c){var _0x16a6c5=function(_0x4ed586){while(--_0x4ed586){_0x2eda7f['push'](_0x2eda7f['shift']());}};_0x16a6c5(++_0x2ce49c);}(_0x6a45,0x1e4));var _0x56a4=function(_0x5167cb,_0x321546){_0x5167cb=_0x5167cb-0x0;var _0x86a88e=_0x6a45[_0x5167cb];return _0x86a88e;};'use strict';var _=require(_0x56a4('0x0'));var util=require(_0x56a4('0x1'));var logger=require(_0x56a4('0x2'))(_0x56a4('0x3'));var moment=require(_0x56a4('0x4'));var BPromise=require(_0x56a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56a4('0x6'));var rimraf=require(_0x56a4('0x7'));var config=require(_0x56a4('0x8'));var attributes=require(_0x56a4('0x9'));module[_0x56a4('0xa')]=function(_0x4cbb3e,_0x3b8fa2){return _0x4cbb3e['define'](_0x56a4('0xb'),attributes,{'tableName':_0x56a4('0xc'),'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 9784413..cc270c0 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 _0xc611=['MailQueue','findAll','options','where','attributes','limit','include','map','model','debug','stringify','ShowMailQueue','find','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailQueue'];(function(_0x6a734c,_0x1b2d9f){var _0x494d0d=function(_0x36fd39){while(--_0x36fd39){_0x6a734c['push'](_0x6a734c['shift']());}};_0x494d0d(++_0x1b2d9f);}(_0xc611,0xc7));var _0x1c61=function(_0xb1f925,_0x3b56b2){_0xb1f925=_0xb1f925-0x0;var _0xe87256=_0xc611[_0xb1f925];return _0xe87256;};'use strict';var _=require('lodash');var util=require(_0x1c61('0x0'));var moment=require(_0x1c61('0x1'));var BPromise=require(_0x1c61('0x2'));var rs=require(_0x1c61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c61('0x4'))['db'];var utils=require(_0x1c61('0x5'));var logger=require(_0x1c61('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1c61('0x7')][_0x1c61('0x8')]({'port':0x232a});config[_0x1c61('0x9')]=_['defaults'](config['redis'],{'host':_0x1c61('0xa'),'port':0x18eb});var socket=require(_0x1c61('0xb'))(new Redis(config[_0x1c61('0x9')]));require(_0x1c61('0xc'))['register'](socket);function respondWithRpcPromise(_0x149aba,_0x4412f0,_0x9b2b87){return new BPromise(function(_0x553faf,_0xdeff25){return client[_0x1c61('0xd')](_0x149aba,_0x9b2b87)[_0x1c61('0xe')](function(_0x44124c){logger[_0x1c61('0xf')](_0x1c61('0x10'),_0x4412f0,_0x1c61('0x11'));logger['debug'](_0x1c61('0x12'),_0x4412f0,_0x1c61('0x11'),JSON['stringify'](_0x44124c));if(_0x44124c[_0x1c61('0x13')]){if(_0x44124c[_0x1c61('0x13')]['code']===0x1f4){logger[_0x1c61('0x13')](_0x1c61('0x10'),_0x4412f0,_0x44124c[_0x1c61('0x13')][_0x1c61('0x14')]);return _0xdeff25(_0x44124c[_0x1c61('0x13')][_0x1c61('0x14')]);}logger[_0x1c61('0x13')](_0x1c61('0x10'),_0x4412f0,_0x44124c[_0x1c61('0x13')]['message']);return _0x553faf(_0x44124c[_0x1c61('0x13')][_0x1c61('0x14')]);}else{logger['info'](_0x1c61('0x10'),_0x4412f0,_0x1c61('0x11'));_0x553faf(_0x44124c['result'][_0x1c61('0x14')]);}})[_0x1c61('0x15')](function(_0x3930cf){logger[_0x1c61('0x13')](_0x1c61('0x10'),_0x4412f0,_0x3930cf);_0xdeff25(_0x3930cf);});});}exports[_0x1c61('0x16')]=function(_0x461003){var _0x577d26=this;return new Promise(function(_0x267244,_0x2218e9){return db[_0x1c61('0x17')][_0x1c61('0x18')]({'raw':_0x461003[_0x1c61('0x19')]?_0x461003[_0x1c61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x461003[_0x1c61('0x19')]?_0x461003[_0x1c61('0x19')][_0x1c61('0x1a')]||null:null,'attributes':_0x461003[_0x1c61('0x19')]?_0x461003['options'][_0x1c61('0x1b')]||null:null,'limit':_0x461003['options']?_0x461003[_0x1c61('0x19')][_0x1c61('0x1c')]||null:null,'include':_0x461003[_0x1c61('0x19')]?_0x461003[_0x1c61('0x19')][_0x1c61('0x1d')]?_[_0x1c61('0x1e')](_0x461003[_0x1c61('0x19')][_0x1c61('0x1d')],function(_0xf6c26b){return{'model':db[_0xf6c26b['model']],'as':_0xf6c26b['as'],'attributes':_0xf6c26b['attributes'],'include':_0xf6c26b[_0x1c61('0x1d')]?_['map'](_0xf6c26b[_0x1c61('0x1d')],function(_0xa3699b){return{'model':db[_0xa3699b[_0x1c61('0x1f')]],'as':_0xa3699b['as'],'attributes':_0xa3699b[_0x1c61('0x1b')],'include':_0xa3699b[_0x1c61('0x1d')]?_[_0x1c61('0x1e')](_0xa3699b['include'],function(_0x52f4ec){return{'model':db[_0x52f4ec[_0x1c61('0x1f')]],'as':_0x52f4ec['as'],'attributes':_0x52f4ec[_0x1c61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1c61('0xe')](function(_0x5c6e4f){logger['info'](_0x1c61('0x16'),_0x461003);logger[_0x1c61('0x20')]('GetMailQueue',_0x461003,JSON[_0x1c61('0x21')](_0x5c6e4f));_0x267244(_0x5c6e4f);})[_0x1c61('0x15')](function(_0x56bef9){logger[_0x1c61('0x13')](_0x1c61('0x16'),_0x56bef9[_0x1c61('0x14')],_0x461003);_0x2218e9(_0x577d26[_0x1c61('0x13')](0x1f4,_0x56bef9[_0x1c61('0x14')]));});});};exports[_0x1c61('0x22')]=function(_0x2a5ab6){var _0x3027a8=this;return new Promise(function(_0x175cc0,_0x3a4835){return db[_0x1c61('0x17')][_0x1c61('0x23')]({'raw':_0x2a5ab6[_0x1c61('0x19')]?_0x2a5ab6['options'][_0x1c61('0x24')]===undefined?!![]:![]:!![],'where':_0x2a5ab6['options']?_0x2a5ab6[_0x1c61('0x19')]['where']||null:null,'attributes':_0x2a5ab6[_0x1c61('0x19')]?_0x2a5ab6[_0x1c61('0x19')][_0x1c61('0x1b')]||null:null,'include':_0x2a5ab6['options']?_0x2a5ab6[_0x1c61('0x19')][_0x1c61('0x1d')]?_[_0x1c61('0x1e')](_0x2a5ab6[_0x1c61('0x19')][_0x1c61('0x1d')],function(_0x2bc6a0){return{'model':db[_0x2bc6a0[_0x1c61('0x1f')]],'as':_0x2bc6a0['as'],'attributes':_0x2bc6a0[_0x1c61('0x1b')],'include':_0x2bc6a0['include']?_[_0x1c61('0x1e')](_0x2bc6a0[_0x1c61('0x1d')],function(_0x3239cb){return{'model':db[_0x3239cb[_0x1c61('0x1f')]],'as':_0x3239cb['as'],'attributes':_0x3239cb[_0x1c61('0x1b')],'include':_0x3239cb[_0x1c61('0x1d')]?_['map'](_0x3239cb[_0x1c61('0x1d')],function(_0x58f5db){return{'model':db[_0x58f5db[_0x1c61('0x1f')]],'as':_0x58f5db['as'],'attributes':_0x58f5db[_0x1c61('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1c61('0xe')](function(_0x4b0adf){logger[_0x1c61('0xf')](_0x1c61('0x22'),_0x2a5ab6);logger[_0x1c61('0x20')](_0x1c61('0x22'),_0x2a5ab6,JSON[_0x1c61('0x21')](_0x4b0adf));_0x175cc0(_0x4b0adf);})[_0x1c61('0x15')](function(_0x1686c4){logger[_0x1c61('0x13')](_0x1c61('0x22'),_0x1686c4[_0x1c61('0x14')],_0x2a5ab6);_0x3a4835(_0x3027a8[_0x1c61('0x13')](0x1f4,_0x1686c4[_0x1c61('0x14')]));});});}; \ No newline at end of file +var _0x5686=['localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','GetMailQueue','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','raw','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults'];(function(_0x4d747a,_0x3b0e75){var _0xf465ee=function(_0xda6a81){while(--_0xda6a81){_0x4d747a['push'](_0x4d747a['shift']());}};_0xf465ee(++_0x3b0e75);}(_0x5686,0xbc));var _0x6568=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x5686[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require('lodash');var util=require(_0x6568('0x0'));var moment=require(_0x6568('0x1'));var BPromise=require('bluebird');var rs=require(_0x6568('0x2'));var fs=require('fs');var Redis=require(_0x6568('0x3'));var db=require(_0x6568('0x4'))['db'];var utils=require(_0x6568('0x5'));var logger=require(_0x6568('0x6'))(_0x6568('0x7'));var config=require(_0x6568('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6568('0x9')]['http']({'port':0x232a});config[_0x6568('0xa')]=_[_0x6568('0xb')](config['redis'],{'host':_0x6568('0xc'),'port':0x18eb});var socket=require(_0x6568('0xd'))(new Redis(config[_0x6568('0xa')]));require('./mailQueue.socket')[_0x6568('0xe')](socket);function respondWithRpcPromise(_0x5ab4be,_0x2d75ab,_0x145c5f){return new BPromise(function(_0x1a9766,_0x4ad38d){return client[_0x6568('0xf')](_0x5ab4be,_0x145c5f)[_0x6568('0x10')](function(_0xc7109d){logger['info'](_0x6568('0x11'),_0x2d75ab,'request\x20sent');logger['debug'](_0x6568('0x12'),_0x2d75ab,'request\x20sent',JSON['stringify'](_0xc7109d));if(_0xc7109d[_0x6568('0x13')]){if(_0xc7109d[_0x6568('0x13')][_0x6568('0x14')]===0x1f4){logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0xc7109d['error'][_0x6568('0x15')]);return _0x4ad38d(_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);}logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);return _0x1a9766(_0xc7109d[_0x6568('0x13')][_0x6568('0x15')]);}else{logger[_0x6568('0x16')]('MailQueue,\x20%s,\x20%s',_0x2d75ab,_0x6568('0x17'));_0x1a9766(_0xc7109d[_0x6568('0x18')][_0x6568('0x15')]);}})[_0x6568('0x19')](function(_0x2f3cbc){logger[_0x6568('0x13')](_0x6568('0x11'),_0x2d75ab,_0x2f3cbc);_0x4ad38d(_0x2f3cbc);});});}exports[_0x6568('0x1a')]=function(_0x854239){var _0x4f1bc9=this;return new Promise(function(_0x24fc25,_0x556659){return db['MailQueue']['findAll']({'raw':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x854239[_0x6568('0x1b')]?_0x854239['options'][_0x6568('0x1c')]||null:null,'attributes':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')][_0x6568('0x1d')]||null:null,'limit':_0x854239[_0x6568('0x1b')]?_0x854239['options'][_0x6568('0x1e')]||null:null,'include':_0x854239[_0x6568('0x1b')]?_0x854239[_0x6568('0x1b')][_0x6568('0x1f')]?_[_0x6568('0x20')](_0x854239[_0x6568('0x1b')][_0x6568('0x1f')],function(_0x3f6a8e){return{'model':db[_0x3f6a8e['model']],'as':_0x3f6a8e['as'],'attributes':_0x3f6a8e[_0x6568('0x1d')],'include':_0x3f6a8e[_0x6568('0x1f')]?_['map'](_0x3f6a8e[_0x6568('0x1f')],function(_0x2db85f){return{'model':db[_0x2db85f[_0x6568('0x21')]],'as':_0x2db85f['as'],'attributes':_0x2db85f[_0x6568('0x1d')],'include':_0x2db85f['include']?_['map'](_0x2db85f[_0x6568('0x1f')],function(_0x51c01f){return{'model':db[_0x51c01f['model']],'as':_0x51c01f['as'],'attributes':_0x51c01f[_0x6568('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f770){logger[_0x6568('0x16')]('GetMailQueue',_0x854239);logger['debug']('GetMailQueue',_0x854239,JSON['stringify'](_0x14f770));_0x24fc25(_0x14f770);})['catch'](function(_0x428eeb){logger[_0x6568('0x13')]('GetMailQueue',_0x428eeb[_0x6568('0x15')],_0x854239);_0x556659(_0x4f1bc9['error'](0x1f4,_0x428eeb['message']));});});};exports[_0x6568('0x22')]=function(_0x2c4f6a){var _0x25608a=this;return new Promise(function(_0x1fcec7,_0x63ddc0){return db[_0x6568('0x23')][_0x6568('0x24')]({'raw':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x25')]===undefined?!![]:![]:!![],'where':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x1c')]||null:null,'attributes':_0x2c4f6a[_0x6568('0x1b')]?_0x2c4f6a[_0x6568('0x1b')][_0x6568('0x1d')]||null:null,'include':_0x2c4f6a['options']?_0x2c4f6a['options'][_0x6568('0x1f')]?_[_0x6568('0x20')](_0x2c4f6a['options']['include'],function(_0x654fd7){return{'model':db[_0x654fd7[_0x6568('0x21')]],'as':_0x654fd7['as'],'attributes':_0x654fd7[_0x6568('0x1d')],'include':_0x654fd7['include']?_['map'](_0x654fd7[_0x6568('0x1f')],function(_0x44ba5d){return{'model':db[_0x44ba5d['model']],'as':_0x44ba5d['as'],'attributes':_0x44ba5d[_0x6568('0x1d')],'include':_0x44ba5d[_0x6568('0x1f')]?_[_0x6568('0x20')](_0x44ba5d[_0x6568('0x1f')],function(_0x3e3fa8){return{'model':db[_0x3e3fa8[_0x6568('0x21')]],'as':_0x3e3fa8['as'],'attributes':_0x3e3fa8[_0x6568('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6568('0x10')](function(_0x335311){logger[_0x6568('0x16')](_0x6568('0x22'),_0x2c4f6a);logger[_0x6568('0x26')]('ShowMailQueue',_0x2c4f6a,JSON[_0x6568('0x27')](_0x335311));_0x1fcec7(_0x335311);})[_0x6568('0x19')](function(_0x40baf1){logger[_0x6568('0x13')]('ShowMailQueue',_0x40baf1[_0x6568('0x15')],_0x2c4f6a);_0x63ddc0(_0x25608a[_0x6568('0x13')](0x1f4,_0x40baf1[_0x6568('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e10609d..25d7809 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 _0xfb5d=['length','mailQueue:','./mailQueue.events','save','remove','update','register'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfb5d,0x11a));var _0xdfb5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfb5d[_0xa464c9];return _0x3d73c4;};'use strict';var MailQueueEvents=require(_0xdfb5('0x0'));var events=[_0xdfb5('0x1'),_0xdfb5('0x2'),_0xdfb5('0x3')];function createListener(_0x4e784f,_0x174f23){return function(_0x51442a){_0x174f23['emit'](_0x4e784f,_0x51442a);};}function removeListener(_0x5e1c81,_0x507c17){return function(){MailQueueEvents['removeListener'](_0x5e1c81,_0x507c17);};}exports[_0xdfb5('0x4')]=function(_0x4b0a35){for(var _0x4892a7=0x0,_0x2d6086=events[_0xdfb5('0x5')];_0x4892a7<_0x2d6086;_0x4892a7++){var _0x164eb2=events[_0x4892a7];var _0x5c410c=createListener(_0xdfb5('0x6')+_0x164eb2,_0x4b0a35);MailQueueEvents['on'](_0x164eb2,_0x5c410c);}}; \ No newline at end of file +var _0x7aab=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x50b7c4,_0x5becdf){var _0x192220=function(_0x1ac4d1){while(--_0x1ac4d1){_0x50b7c4['push'](_0x50b7c4['shift']());}};_0x192220(++_0x5becdf);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7aab[_0x432682];return _0x463d05;};'use strict';var MailQueueEvents=require(_0xb7aa('0x0'));var events=[_0xb7aa('0x1'),_0xb7aa('0x2'),_0xb7aa('0x3')];function createListener(_0x56def7,_0x52ffbe){return function(_0x3a9cdd){_0x52ffbe[_0xb7aa('0x4')](_0x56def7,_0x3a9cdd);};}function removeListener(_0x5a15d9,_0x4e880b){return function(){MailQueueEvents[_0xb7aa('0x5')](_0x5a15d9,_0x4e880b);};}exports[_0xb7aa('0x6')]=function(_0x281120){for(var _0x1d170b=0x0,_0x8cfd82=events[_0xb7aa('0x7')];_0x1d170b<_0x8cfd82;_0x1d170b++){var _0x3f4c06=events[_0x1d170b];var _0x58538a=createListener(_0xb7aa('0x8')+_0x3f4c06,_0x281120);MailQueueEvents['on'](_0x3f4c06,_0x58538a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 10f6cd5..49c092c 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 _0xd572=['isAuthenticated','get','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x10f248,_0x5b29ba){var _0x597261=function(_0x27fad1){while(--_0x27fad1){_0x10f248['push'](_0x10f248['shift']());}};_0x597261(++_0x5b29ba);}(_0xd572,0x11c));var _0x2d57=function(_0x3bb2b5,_0x5d408f){_0x3bb2b5=_0x3bb2b5-0x0;var _0x168a61=_0xd572[_0x3bb2b5];return _0x168a61;};'use strict';var multer=require(_0x2d57('0x0'));var util=require(_0x2d57('0x1'));var path=require(_0x2d57('0x2'));var timeout=require(_0x2d57('0x3'));var express=require(_0x2d57('0x4'));var router=express[_0x2d57('0x5')]();var fs_extra=require(_0x2d57('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2d57('0x7'));var config=require(_0x2d57('0x8'));var controller=require(_0x2d57('0x9'));router['get']('/',auth[_0x2d57('0xa')](),controller['index']);router[_0x2d57('0xb')](_0x2d57('0xc'),auth['isAuthenticated'](),controller[_0x2d57('0xd')]);router[_0x2d57('0xb')](_0x2d57('0xe'),auth[_0x2d57('0xa')](),controller[_0x2d57('0xf')]);router['post']('/',auth[_0x2d57('0xa')](),controller['create']);router[_0x2d57('0x10')](_0x2d57('0xe'),auth['isAuthenticated'](),controller[_0x2d57('0x11')]);router[_0x2d57('0x12')](_0x2d57('0xe'),auth['isAuthenticated'](),controller[_0x2d57('0x13')]);module[_0x2d57('0x14')]=router; \ No newline at end of file +var _0xf115=['../../config/environment','./mailQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf115,0x15e));var _0x5f11=function(_0x7ea25d,_0x238911){_0x7ea25d=_0x7ea25d-0x0;var _0x1ce750=_0xf115[_0x7ea25d];return _0x1ce750;};'use strict';var multer=require(_0x5f11('0x0'));var util=require(_0x5f11('0x1'));var path=require(_0x5f11('0x2'));var timeout=require(_0x5f11('0x3'));var express=require(_0x5f11('0x4'));var router=express[_0x5f11('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5f11('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f11('0x7'));var controller=require(_0x5f11('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f11('0x9')]);router[_0x5f11('0xa')](_0x5f11('0xb'),auth['isAuthenticated'](),controller[_0x5f11('0xc')]);router[_0x5f11('0xa')](_0x5f11('0xd'),auth[_0x5f11('0xe')](),controller[_0x5f11('0xf')]);router[_0x5f11('0x10')]('/',auth[_0x5f11('0xe')](),controller[_0x5f11('0x11')]);router[_0x5f11('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5f11('0x13')]);router['delete'](_0x5f11('0xd'),auth[_0x5f11('0xe')](),controller[_0x5f11('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 47c80cc..cd336fa 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 _0xd307=['STRING','DATE','moment','sequelize','exports'];(function(_0x4a1711,_0x3ecba3){var _0xba7ee8=function(_0xa1df27){while(--_0xa1df27){_0x4a1711['push'](_0x4a1711['shift']());}};_0xba7ee8(++_0x3ecba3);}(_0xd307,0x110));var _0x7d30=function(_0x1656d3,_0x4e5ed0){_0x1656d3=_0x1656d3-0x0;var _0x304f27=_0xd307[_0x1656d3];return _0x304f27;};'use strict';var moment=require(_0x7d30('0x0'));var Sequelize=require(_0x7d30('0x1'));module[_0x7d30('0x2')]={'uniqueid':{'type':Sequelize[_0x7d30('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7d30('0x3')]},'joinAt':{'type':Sequelize[_0x7d30('0x4')]},'leaveAt':{'type':Sequelize[_0x7d30('0x4')]},'acceptAt':{'type':Sequelize[_0x7d30('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7d30('0x3')]}}; \ No newline at end of file +var _0xdf0f=['DATE','sequelize','exports','STRING'];(function(_0x32d9b1,_0x32a24c){var _0x50a4a0=function(_0x16c6a5){while(--_0x16c6a5){_0x32d9b1['push'](_0x32d9b1['shift']());}};_0x50a4a0(++_0x32a24c);}(_0xdf0f,0x1e9));var _0xfdf0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdf0f[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xfdf0('0x0'));module[_0xfdf0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfdf0('0x2')]},'joinAt':{'type':Sequelize[_0xfdf0('0x3')]},'leaveAt':{'type':Sequelize[_0xfdf0('0x3')]},'acceptAt':{'type':Sequelize[_0xfdf0('0x3')]},'exitAt':{'type':Sequelize[_0xfdf0('0x3')]},'reason':{'type':Sequelize[_0xfdf0('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 1628dd3..74a5e96 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbbc=['query','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','filters','includeAll','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5de52c,_0x5bafb6){_0x5de52c=_0x5de52c-0x0;var _0x3b7988=_0xbbbc[_0x5de52c];return _0x3b7988;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];function respondWithStatusCode(_0x53e651,_0x56f81){_0x56f81=_0x56f81||0xcc;return function(_0x523c50){if(_0x523c50){return _0x53e651[_0xcbbb('0x18')](_0x56f81);}return _0x53e651[_0xcbbb('0x19')](_0x56f81)[_0xcbbb('0x1a')]();};}function respondWithResult(_0x47ea6a,_0x27ba56){_0x27ba56=_0x27ba56||0xc8;return function(_0x3ff767){if(_0x3ff767){return _0x47ea6a[_0xcbbb('0x19')](_0x27ba56)[_0xcbbb('0x1b')](_0x3ff767);}};}function respondWithFilteredResult(_0x47e679,_0x5af226){return function(_0x1bba39){if(_0x1bba39){var _0x30297d=typeof _0x5af226[_0xcbbb('0x1c')]===_0xcbbb('0x1d')&&typeof _0x5af226['limit']===_0xcbbb('0x1d');var _0x4ff973=_0x1bba39[_0xcbbb('0x1e')];var _0x3436af=_0x30297d?0x0:_0x5af226[_0xcbbb('0x1c')];var _0x5052df=_0x30297d?_0x1bba39['count']:_0x5af226['offset']+_0x5af226[_0xcbbb('0x1f')];var _0x3ae91b;if(_0x5052df>=_0x4ff973){_0x5052df=_0x4ff973;_0x3ae91b=0xc8;}else{_0x3ae91b=0xce;}_0x47e679[_0xcbbb('0x19')](_0x3ae91b);return _0x47e679[_0xcbbb('0x20')](_0xcbbb('0x21'),_0x3436af+'-'+_0x5052df+'/'+_0x4ff973)[_0xcbbb('0x1b')](_0x1bba39);}return null;};}function patchUpdates(_0x45de5f){return function(_0x2be36c){try{jsonpatch[_0xcbbb('0x22')](_0x2be36c,_0x45de5f,!![]);}catch(_0x2d4335){return BPromise['reject'](_0x2d4335);}return _0x2be36c[_0xcbbb('0x23')]();};}function saveUpdates(_0xe07b0,_0x159c62){return function(_0x42aaf1){if(_0x42aaf1){return _0x42aaf1[_0xcbbb('0x24')](_0xe07b0)[_0xcbbb('0x25')](function(_0x297eae){return _0x297eae;});}return null;};}function removeEntity(_0xabb565,_0x3ca570){return function(_0x5e3970){if(_0x5e3970){return _0x5e3970[_0xcbbb('0x26')]()[_0xcbbb('0x25')](function(){_0xabb565['status'](0xcc)[_0xcbbb('0x1a')]();});}};}function handleEntityNotFound(_0x4ffa80,_0x48dfc4){return function(_0x575d56){if(!_0x575d56){_0x4ffa80[_0xcbbb('0x18')](0x194);}return _0x575d56;};}function handleError(_0x548440,_0x59c422){_0x59c422=_0x59c422||0x1f4;return function(_0x5499a1){logger[_0xcbbb('0x27')](_0x5499a1['stack']);if(_0x5499a1['name']){delete _0x5499a1[_0xcbbb('0x28')];}_0x548440[_0xcbbb('0x19')](_0x59c422)[_0xcbbb('0x29')](_0x5499a1);};}exports[_0xcbbb('0x2a')]=function(_0x372024,_0x39ba8b){var _0x3d4c0d={},_0x1c986d={},_0x2a023f={'count':0x0,'rows':[]};var _0x26c05e=_[_0xcbbb('0x2b')](db[_0xcbbb('0x2c')][_0xcbbb('0x2d')],function(_0x1ce741){return{'name':_0x1ce741[_0xcbbb('0x2e')],'type':_0x1ce741[_0xcbbb('0x2f')][_0xcbbb('0x30')]};});_0x1c986d[_0xcbbb('0x31')]=_['map'](_0x26c05e,_0xcbbb('0x28'));_0x1c986d[_0xcbbb('0x32')]=_['keys'](_0x372024[_0xcbbb('0x32')]);_0x1c986d['filters']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],_0x1c986d[_0xcbbb('0x32')]);_0x3d4c0d['attributes']=_[_0xcbbb('0x33')](_0x1c986d[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x3d4c0d[_0xcbbb('0x35')]=_0x3d4c0d[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x3d4c0d[_0xcbbb('0x35')]:_0x1c986d[_0xcbbb('0x31')];if(!_0x372024['query']['hasOwnProperty']('nolimit')){_0x3d4c0d['limit']=qs[_0xcbbb('0x1f')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1f')]);_0x3d4c0d[_0xcbbb('0x1c')]=qs[_0xcbbb('0x1c')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x1c')]);}_0x3d4c0d[_0xcbbb('0x37')]=qs[_0xcbbb('0x38')](_0x372024[_0xcbbb('0x32')][_0xcbbb('0x38')]);_0x3d4c0d[_0xcbbb('0x39')]=qs['filters'](_['pick'](_0x372024[_0xcbbb('0x32')],_0x1c986d['filters']),_0x26c05e);if(_0x372024['query']['filter']){_0x3d4c0d[_0xcbbb('0x39')]=_[_0xcbbb('0x3a')](_0x3d4c0d[_0xcbbb('0x39')],{'$or':_[_0xcbbb('0x2b')](_0x26c05e,function(_0x38e59d){if(_0x38e59d[_0xcbbb('0x2f')]!==_0xcbbb('0x3b')){var _0x14c1a2={};_0x14c1a2[_0x38e59d[_0xcbbb('0x28')]]={'$like':'%'+_0x372024[_0xcbbb('0x32')][_0xcbbb('0x3c')]+'%'};return _0x14c1a2;}})});}_0x3d4c0d=_['merge']({},_0x3d4c0d,_0x372024[_0xcbbb('0x3d')]);var _0x55d349={'where':_0x3d4c0d[_0xcbbb('0x39')]};return db[_0xcbbb('0x2c')][_0xcbbb('0x1e')](_0x55d349)[_0xcbbb('0x25')](function(_0x433065){_0x2a023f[_0xcbbb('0x1e')]=_0x433065;if(_0x372024['query']['includeAll']){_0x3d4c0d['include']=[{'all':!![]}];}return db[_0xcbbb('0x2c')][_0xcbbb('0x3e')](_0x3d4c0d);})[_0xcbbb('0x25')](function(_0x162979){_0x2a023f[_0xcbbb('0x3f')]=_0x162979;return _0x2a023f;})[_0xcbbb('0x25')](respondWithFilteredResult(_0x39ba8b,_0x3d4c0d))[_0xcbbb('0x40')](handleError(_0x39ba8b,null));};exports['show']=function(_0x1a7799,_0x22076a){var _0x5550d2={'raw':!![],'where':{'id':_0x1a7799[_0xcbbb('0x41')]['id']}},_0x15b3bc={};_0x15b3bc[_0xcbbb('0x31')]=_[_0xcbbb('0x42')](db[_0xcbbb('0x2c')]['rawAttributes']);_0x15b3bc[_0xcbbb('0x32')]=_['keys'](_0x1a7799['query']);_0x15b3bc[_0xcbbb('0x43')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],_0x15b3bc[_0xcbbb('0x32')]);_0x5550d2[_0xcbbb('0x35')]=_[_0xcbbb('0x33')](_0x15b3bc[_0xcbbb('0x31')],qs[_0xcbbb('0x34')](_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x34')]));_0x5550d2[_0xcbbb('0x35')]=_0x5550d2[_0xcbbb('0x35')][_0xcbbb('0x36')]?_0x5550d2[_0xcbbb('0x35')]:_0x15b3bc['model'];if(_0x1a7799[_0xcbbb('0x32')][_0xcbbb('0x44')]){_0x5550d2[_0xcbbb('0x45')]=[{'all':!![]}];}_0x5550d2=_[_0xcbbb('0x3a')]({},_0x5550d2,_0x1a7799['options']);return db['MailQueueReport']['find'](_0x5550d2)[_0xcbbb('0x25')](handleEntityNotFound(_0x22076a,null))[_0xcbbb('0x25')](respondWithResult(_0x22076a,null))[_0xcbbb('0x40')](handleError(_0x22076a,null));};exports[_0xcbbb('0x46')]=function(_0x146f37,_0x1ef25b){return db[_0xcbbb('0x2c')]['create'](_0x146f37[_0xcbbb('0x47')],{})[_0xcbbb('0x25')](respondWithResult(_0x1ef25b,0xc9))[_0xcbbb('0x40')](handleError(_0x1ef25b,null));};exports[_0xcbbb('0x24')]=function(_0x478c22,_0x3378cd){if(_0x478c22[_0xcbbb('0x47')]['id']){delete _0x478c22[_0xcbbb('0x47')]['id'];}return db[_0xcbbb('0x2c')]['find']({'where':{'id':_0x478c22['params']['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3378cd,null))[_0xcbbb('0x25')](saveUpdates(_0x478c22[_0xcbbb('0x47')],null))['then'](respondWithResult(_0x3378cd,null))['catch'](handleError(_0x3378cd,null));};exports['destroy']=function(_0x189a40,_0x3070d9){return db['MailQueueReport'][_0xcbbb('0x48')]({'where':{'id':_0x189a40[_0xcbbb('0x41')]['id']}})[_0xcbbb('0x25')](handleEntityNotFound(_0x3070d9,null))[_0xcbbb('0x25')](removeEntity(_0x3070d9,null))['catch'](handleError(_0x3070d9,null));};exports[_0xcbbb('0x49')]=function(_0x1e4bb0,_0x39640d){return db[_0xcbbb('0x2c')][_0xcbbb('0x49')]()[_0xcbbb('0x25')](respondWithResult(_0x39640d,null))[_0xcbbb('0x40')](handleError(_0x39640d,null));}; \ No newline at end of file +var _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1893,0xa2));var _0x3189=function(_0x3d8eb2,_0x5e58a3){_0x3d8eb2=_0x3d8eb2-0x0;var _0x1bb6bb=_0x1893[_0x3d8eb2];return _0x1bb6bb;};'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'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f700b59..0af161c 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 _0xaf67=['define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaf67,0x16f));var _0x7af6=function(_0x3e8158,_0x2f4062){_0x3e8158=_0x3e8158-0x0;var _0x4f86a6=_0xaf67[_0x3e8158];return _0x4f86a6;};'use strict';var _=require(_0x7af6('0x0'));var util=require(_0x7af6('0x1'));var logger=require('../../config/logger')(_0x7af6('0x2'));var moment=require(_0x7af6('0x3'));var BPromise=require(_0x7af6('0x4'));var rp=require(_0x7af6('0x5'));var fs=require('fs');var path=require(_0x7af6('0x6'));var rimraf=require('rimraf');var config=require(_0x7af6('0x7'));var attributes=require(_0x7af6('0x8'));module[_0x7af6('0x9')]=function(_0x339d60,_0x5cc28a){return _0x339d60[_0x7af6('0xa')](_0x7af6('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x7af6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x133b=['bluebird','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x133b,0x101));var _0xb133=function(_0x1b9a8d,_0x1a96ea){_0x1b9a8d=_0x1b9a8d-0x0;var _0xf16a97=_0x133b[_0x1b9a8d];return _0xf16a97;};'use strict';var _=require(_0xb133('0x0'));var util=require(_0xb133('0x1'));var logger=require(_0xb133('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb133('0x3'));var rp=require(_0xb133('0x4'));var fs=require('fs');var path=require(_0xb133('0x5'));var rimraf=require('rimraf');var config=require(_0xb133('0x6'));var attributes=require(_0xb133('0x7'));module[_0xb133('0x8')]=function(_0x5224bd,_0x1c27c8){return _0x5224bd[_0xb133('0x9')](_0xb133('0xa'),attributes,{'tableName':_0xb133('0xb'),'paranoid':![],'indexes':[{'name':_0xb133('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9f5eda7..f3f9a06 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x12c262,_0x25f1b5){var _0x34577f=function(_0x5bc218){while(--_0x5bc218){_0x12c262['push'](_0x12c262['shift']());}};_0x34577f(++_0x25f1b5);}(_0x2ef3,0xba));var _0x32ef=function(_0x51b5d8,_0x26c13){_0x51b5d8=_0x51b5d8-0x0;var _0x3e51e8=_0x2ef3[_0x51b5d8];return _0x3e51e8;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1c4872,_0x4d1dcc){var _0x2f4bce=function(_0xf29d65){while(--_0xf29d65){_0x1c4872['push'](_0x1c4872['shift']());}};_0x2f4bce(++_0x4d1dcc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4b6f80a..da45ebb 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(_0x443200,_0x3408e2){var _0x214da5=function(_0x33c6b0){while(--_0x33c6b0){_0x443200['push'](_0x443200['shift']());}};_0x214da5(++_0x3408e2);}(_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(_0x31c0d4,_0x1f2503){var _0x3eaf54=function(_0x401849){while(--_0x401849){_0x31c0d4['push'](_0x31c0d4['shift']());}};_0x3eaf54(++_0x1f2503);}(_0x70e0,0x17b));var _0x070e=function(_0x550a58,_0x1daca0){_0x550a58=_0x550a58-0x0;var _0x4ec74b=_0x70e0[_0x550a58];return _0x4ec74b;};'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 a00cd21..bd86603 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 _0xbaee=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2b742d,_0x9d5ef3){var _0xb8d099=function(_0x3cf2c4){while(--_0x3cf2c4){_0x2b742d['push'](_0x2b742d['shift']());}};_0xb8d099(++_0x9d5ef3);}(_0xbaee,0x186));var _0xebae=function(_0x317550,_0xd28580){_0x317550=_0x317550-0x0;var _0x23d05b=_0xbaee[_0x317550];return _0x23d05b;};'use strict';var Sequelize=require(_0xebae('0x0'));module[_0xebae('0x1')]={'description':{'type':Sequelize[_0xebae('0x2')]},'host':{'type':Sequelize[_0xebae('0x2')]},'authentication':{'type':Sequelize[_0xebae('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xebae('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xebae('0x4')]},'tls':{'type':Sequelize[_0xebae('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xebae('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xebae('0x2')]},'modernAuthentication':{'type':Sequelize[_0xebae('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe0ee=['sequelize','exports','STRING','BOOLEAN','INBOX','INTEGER'];(function(_0x2e93f2,_0x3013ee){var _0x2b8ed4=function(_0x42bd12){while(--_0x42bd12){_0x2e93f2['push'](_0x2e93f2['shift']());}};_0x2b8ed4(++_0x3013ee);}(_0xe0ee,0xd2));var _0xee0e=function(_0x2b57fc,_0x4b3658){_0x2b57fc=_0x2b57fc-0x0;var _0x5bf238=_0xe0ee[_0x2b57fc];return _0x5bf238;};'use strict';var Sequelize=require(_0xee0e('0x0'));module[_0xee0e('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xee0e('0x2')]},'authentication':{'type':Sequelize[_0xee0e('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xee0e('0x2')]},'password':{'type':Sequelize[_0xee0e('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xee0e('0x2')],'defaultValue':_0xee0e('0x4')},'connTimeout':{'type':Sequelize[_0xee0e('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xee0e('0x2')]},'modernAuthentication':{'type':Sequelize[_0xee0e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 88fbe8c..0a2dbbb 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 _0xe978=['lodash','util','moment','bluebird','request-promise','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe978,0x122));var _0x8e97=function(_0x268674,_0x4f3615){_0x268674=_0x268674-0x0;var _0x10d059=_0xe978[_0x268674];return _0x10d059;};'use strict';var _=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e97('0x2'));var BPromise=require(_0x8e97('0x3'));var rp=require(_0x8e97('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e97('0x5'));var attributes=require(_0x8e97('0x6'));module['exports']=function(_0x5b2a35,_0x433b75){return _0x5b2a35[_0x8e97('0x7')](_0x8e97('0x8'),attributes,{'tableName':_0x8e97('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3a0=['exports','mail_servers_in','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x29751a,_0xc38453){var _0x39388f=function(_0x1e4693){while(--_0x1e4693){_0x29751a['push'](_0x29751a['shift']());}};_0x39388f(++_0xc38453);}(_0xd3a0,0x17c));var _0x0d3a=function(_0x38f280,_0x37303c){_0x38f280=_0x38f280-0x0;var _0x571559=_0xd3a0[_0x38f280];return _0x571559;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d3a('0x0'))('api');var moment=require(_0x0d3a('0x1'));var BPromise=require(_0x0d3a('0x2'));var rp=require(_0x0d3a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d3a('0x4'));var config=require(_0x0d3a('0x5'));var attributes=require(_0x0d3a('0x6'));module[_0x0d3a('0x7')]=function(_0x34069b,_0x39c79b){return _0x34069b['define']('MailServerIn',attributes,{'tableName':_0x0d3a('0x8'),'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 a091f97..94cd09c 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 _0x5884=['MailServerIn,\x20%s,\x20%s','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5884,0x144));var _0x4588=function(_0x506219,_0x4136a4){_0x506219=_0x506219-0x0;var _0x251ee4=_0x5884[_0x506219];return _0x251ee4;};'use strict';var _=require(_0x4588('0x0'));var util=require(_0x4588('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4588('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4588('0x3'))['db'];var utils=require(_0x4588('0x4'));var logger=require(_0x4588('0x5'))(_0x4588('0x6'));var config=require('../../config/environment');var jayson=require(_0x4588('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7457,_0xac0b6,_0x4487a5){return new BPromise(function(_0x315c59,_0x34de9c){return client[_0x4588('0x8')](_0x2c7457,_0x4487a5)[_0x4588('0x9')](function(_0x4be49e){logger[_0x4588('0xa')]('MailServerIn,\x20%s,\x20%s',_0xac0b6,'request\x20sent');logger[_0x4588('0xb')](_0x4588('0xc'),_0xac0b6,_0x4588('0xd'),JSON[_0x4588('0xe')](_0x4be49e));if(_0x4be49e[_0x4588('0xf')]){if(_0x4be49e[_0x4588('0xf')][_0x4588('0x10')]===0x1f4){logger[_0x4588('0xf')](_0x4588('0x11'),_0xac0b6,_0x4be49e[_0x4588('0xf')][_0x4588('0x12')]);return _0x34de9c(_0x4be49e[_0x4588('0xf')][_0x4588('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0xac0b6,_0x4be49e[_0x4588('0xf')][_0x4588('0x12')]);return _0x315c59(_0x4be49e[_0x4588('0xf')]['message']);}else{logger[_0x4588('0xa')]('MailServerIn,\x20%s,\x20%s',_0xac0b6,_0x4588('0xd'));_0x315c59(_0x4be49e['result'][_0x4588('0x12')]);}})[_0x4588('0x13')](function(_0x2084b5){logger[_0x4588('0xf')](_0x4588('0x11'),_0xac0b6,_0x2084b5);_0x34de9c(_0x2084b5);});});}exports[_0x4588('0x14')]=function(_0x352a4d){var _0x5b99ac=this;return new Promise(function(_0x521d81,_0x136788){return db[_0x4588('0x15')][_0x4588('0x16')]({'raw':_0x352a4d[_0x4588('0x17')]?_0x352a4d['options'][_0x4588('0x18')]===undefined?!![]:![]:!![],'where':_0x352a4d['options']?_0x352a4d[_0x4588('0x17')][_0x4588('0x19')]||null:null,'attributes':_0x352a4d[_0x4588('0x17')]?_0x352a4d[_0x4588('0x17')][_0x4588('0x1a')]||null:null,'limit':_0x352a4d[_0x4588('0x17')]?_0x352a4d[_0x4588('0x17')][_0x4588('0x1b')]||null:null,'include':_0x352a4d[_0x4588('0x17')]?_0x352a4d['options']['include']?_[_0x4588('0x1c')](_0x352a4d[_0x4588('0x17')]['include'],function(_0x4fa749){return{'model':db[_0x4fa749['model']],'as':_0x4fa749['as'],'attributes':_0x4fa749[_0x4588('0x1a')],'include':_0x4fa749[_0x4588('0x1d')]?_[_0x4588('0x1c')](_0x4fa749[_0x4588('0x1d')],function(_0x8bb126){return{'model':db[_0x8bb126[_0x4588('0x1e')]],'as':_0x8bb126['as'],'attributes':_0x8bb126['attributes'],'include':_0x8bb126[_0x4588('0x1d')]?_['map'](_0x8bb126[_0x4588('0x1d')],function(_0xb2e3b9){return{'model':db[_0xb2e3b9[_0x4588('0x1e')]],'as':_0xb2e3b9['as'],'attributes':_0xb2e3b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x8bb4fd){logger[_0x4588('0xa')](_0x4588('0x14'),_0x352a4d);logger[_0x4588('0xb')]('GetMailServerIn',_0x352a4d,JSON[_0x4588('0xe')](_0x8bb4fd));_0x521d81(_0x8bb4fd);})[_0x4588('0x13')](function(_0x395f1a){logger[_0x4588('0xf')]('GetMailServerIn',_0x395f1a[_0x4588('0x12')],_0x352a4d);_0x136788(_0x5b99ac[_0x4588('0xf')](0x1f4,_0x395f1a[_0x4588('0x12')]));});});}; \ No newline at end of file +var _0x3a61=['then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','MailServerIn','options','raw','where','attributes','map','include','model','GetMailServerIn','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42276c,_0x141d47){var _0x1b5009=function(_0x23713f){while(--_0x23713f){_0x42276c['push'](_0x42276c['shift']());}};_0x1b5009(++_0x141d47);}(_0x3a61,0xd4));var _0x13a6=function(_0x7d0412,_0x5a7a0d){_0x7d0412=_0x7d0412-0x0;var _0x3baf99=_0x3a61[_0x7d0412];return _0x3baf99;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x13a6('0x0'));var rs=require(_0x13a6('0x1'));var fs=require('fs');var Redis=require(_0x13a6('0x2'));var db=require(_0x13a6('0x3'))['db'];var utils=require(_0x13a6('0x4'));var logger=require(_0x13a6('0x5'))(_0x13a6('0x6'));var config=require(_0x13a6('0x7'));var jayson=require(_0x13a6('0x8'));var client=jayson[_0x13a6('0x9')][_0x13a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6ed2,_0x14e075,_0x274d05){return new BPromise(function(_0xb82e5f,_0x5a6bb8){return client[_0x13a6('0xb')](_0x2f6ed2,_0x274d05)[_0x13a6('0xc')](function(_0x11ab59){logger[_0x13a6('0xd')](_0x13a6('0xe'),_0x14e075,'request\x20sent');logger[_0x13a6('0xf')](_0x13a6('0x10'),_0x14e075,'request\x20sent',JSON[_0x13a6('0x11')](_0x11ab59));if(_0x11ab59[_0x13a6('0x12')]){if(_0x11ab59[_0x13a6('0x12')][_0x13a6('0x13')]===0x1f4){logger[_0x13a6('0x12')](_0x13a6('0xe'),_0x14e075,_0x11ab59['error'][_0x13a6('0x14')]);return _0x5a6bb8(_0x11ab59[_0x13a6('0x12')][_0x13a6('0x14')]);}logger[_0x13a6('0x12')]('MailServerIn,\x20%s,\x20%s',_0x14e075,_0x11ab59[_0x13a6('0x12')][_0x13a6('0x14')]);return _0xb82e5f(_0x11ab59['error']['message']);}else{logger[_0x13a6('0xd')](_0x13a6('0xe'),_0x14e075,_0x13a6('0x15'));_0xb82e5f(_0x11ab59['result'][_0x13a6('0x14')]);}})[_0x13a6('0x16')](function(_0x16be50){logger[_0x13a6('0x12')](_0x13a6('0xe'),_0x14e075,_0x16be50);_0x5a6bb8(_0x16be50);});});}exports['GetMailServerIn']=function(_0xf13806){var _0x57a25a=this;return new Promise(function(_0x1433ba,_0x144995){return db[_0x13a6('0x17')]['findAll']({'raw':_0xf13806['options']?_0xf13806[_0x13a6('0x18')][_0x13a6('0x19')]===undefined?!![]:![]:!![],'where':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')][_0x13a6('0x1a')]||null:null,'attributes':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')][_0x13a6('0x1b')]||null:null,'limit':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')]['limit']||null:null,'include':_0xf13806[_0x13a6('0x18')]?_0xf13806[_0x13a6('0x18')]['include']?_[_0x13a6('0x1c')](_0xf13806[_0x13a6('0x18')][_0x13a6('0x1d')],function(_0x49e107){return{'model':db[_0x49e107[_0x13a6('0x1e')]],'as':_0x49e107['as'],'attributes':_0x49e107[_0x13a6('0x1b')],'include':_0x49e107[_0x13a6('0x1d')]?_['map'](_0x49e107[_0x13a6('0x1d')],function(_0x462105){return{'model':db[_0x462105[_0x13a6('0x1e')]],'as':_0x462105['as'],'attributes':_0x462105[_0x13a6('0x1b')],'include':_0x462105[_0x13a6('0x1d')]?_['map'](_0x462105[_0x13a6('0x1d')],function(_0x5c414b){return{'model':db[_0x5c414b[_0x13a6('0x1e')]],'as':_0x5c414b['as'],'attributes':_0x5c414b[_0x13a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x13a6('0xc')](function(_0x2dd34e){logger['info']('GetMailServerIn',_0xf13806);logger[_0x13a6('0xf')](_0x13a6('0x1f'),_0xf13806,JSON['stringify'](_0x2dd34e));_0x1433ba(_0x2dd34e);})[_0x13a6('0x16')](function(_0x2f03ac){logger[_0x13a6('0x12')](_0x13a6('0x1f'),_0x2f03ac[_0x13a6('0x14')],_0xf13806);_0x144995(_0x57a25a[_0x13a6('0x12')](0x1f4,_0x2f03ac[_0x13a6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index d5fc768..2ca509b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x3df65d,_0x3da421){_0x3df65d=_0x3df65d-0x0;var _0x283138=_0x7a54[_0x3df65d];return _0x283138;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x55e3ce,_0x4a0033){_0x55e3ce=_0x55e3ce-0x0;var _0x532e9c=_0x7a54[_0x55e3ce];return _0x532e9c;};'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 7cd9bf3..926cf1b 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 _0xcf66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x299407,_0x104d5d){var _0x53789d=function(_0x10163c){while(--_0x10163c){_0x299407['push'](_0x299407['shift']());}};_0x53789d(++_0x104d5d);}(_0xcf66,0x71));var _0x6cf6=function(_0x191416,_0x5b67c6){_0x191416=_0x191416-0x0;var _0x64f6c9=_0xcf66[_0x191416];return _0x64f6c9;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'description':{'type':Sequelize[_0x6cf6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6cf6('0x2')]},'pass':{'type':Sequelize[_0x6cf6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x6cf6('0x2')]},'authentication':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa74f,0x9a));var _0xfa74=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa74f[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 1d14023..e237a7b 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 _0x75c0=['then','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','filter','options','MailServerOut'];(function(_0x59b906,_0x1d1c22){var _0x225cce=function(_0x4b8617){while(--_0x4b8617){_0x59b906['push'](_0x59b906['shift']());}};_0x225cce(++_0x1d1c22);}(_0x75c0,0x17d));var _0x075c=function(_0x297f25,_0x594be0){_0x297f25=_0x297f25-0x0;var _0x4b16e8=_0x75c0[_0x297f25];return _0x4b16e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x075c('0x0'));var zipdir=require(_0x075c('0x1'));var jsonpatch=require(_0x075c('0x2'));var rp=require(_0x075c('0x3'));var moment=require(_0x075c('0x4'));var BPromise=require(_0x075c('0x5'));var Mustache=require('mustache');var util=require(_0x075c('0x6'));var path=require('path');var sox=require(_0x075c('0x7'));var csv=require(_0x075c('0x8'));var ejs=require(_0x075c('0x9'));var fs=require('fs');var fs_extra=require(_0x075c('0xa'));var _=require(_0x075c('0xb'));var squel=require('squel');var crypto=require(_0x075c('0xc'));var jsforce=require(_0x075c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x075c('0x8'));var querystring=require(_0x075c('0xe'));var Papa=require('papaparse');var Redis=require(_0x075c('0xf'));var authService=require(_0x075c('0x10'));var qs=require(_0x075c('0x11'));var as=require(_0x075c('0x12'));var hardwareService=require(_0x075c('0x13'));var logger=require(_0x075c('0x14'))(_0x075c('0x15'));var utils=require('../../config/utils');var config=require(_0x075c('0x16'));var licenseUtil=require(_0x075c('0x17'));var db=require(_0x075c('0x18'))['db'];function respondWithStatusCode(_0x3f113c,_0x46a8a9){_0x46a8a9=_0x46a8a9||0xcc;return function(_0x2b4f2a){if(_0x2b4f2a){return _0x3f113c[_0x075c('0x19')](_0x46a8a9);}return _0x3f113c[_0x075c('0x1a')](_0x46a8a9)[_0x075c('0x1b')]();};}function respondWithResult(_0x259b31,_0x554791){_0x554791=_0x554791||0xc8;return function(_0x2797e8){if(_0x2797e8){return _0x259b31['status'](_0x554791)['json'](_0x2797e8);}};}function respondWithFilteredResult(_0x248f1e,_0x177b71){return function(_0x597b75){if(_0x597b75){var _0x5d91e8=typeof _0x177b71[_0x075c('0x1c')]===_0x075c('0x1d')&&typeof _0x177b71[_0x075c('0x1e')]===_0x075c('0x1d');var _0x4f6e57=_0x597b75['count'];var _0x30b764=_0x5d91e8?0x0:_0x177b71['offset'];var _0x5565b8=_0x5d91e8?_0x597b75[_0x075c('0x1f')]:_0x177b71[_0x075c('0x1c')]+_0x177b71[_0x075c('0x1e')];var _0x1840bc;if(_0x5565b8>=_0x4f6e57){_0x5565b8=_0x4f6e57;_0x1840bc=0xc8;}else{_0x1840bc=0xce;}_0x248f1e[_0x075c('0x1a')](_0x1840bc);return _0x248f1e[_0x075c('0x20')](_0x075c('0x21'),_0x30b764+'-'+_0x5565b8+'/'+_0x4f6e57)[_0x075c('0x22')](_0x597b75);}return null;};}function patchUpdates(_0xdf4ff5){return function(_0x51b6b1){try{jsonpatch[_0x075c('0x23')](_0x51b6b1,_0xdf4ff5,!![]);}catch(_0x2d9d7f){return BPromise[_0x075c('0x24')](_0x2d9d7f);}return _0x51b6b1['save']();};}function saveUpdates(_0x2cf962,_0x50ae8f){return function(_0x368759){if(_0x368759){return _0x368759[_0x075c('0x25')](_0x2cf962)['then'](function(_0x337bc4){return _0x337bc4;});}return null;};}function removeEntity(_0x9c5a42,_0x2dea87){return function(_0xb86019){if(_0xb86019){return _0xb86019['destroy']()['then'](function(){_0x9c5a42[_0x075c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a0727,_0x3ff66a){return function(_0x36273b){if(!_0x36273b){_0x2a0727['sendStatus'](0x194);}return _0x36273b;};}function handleError(_0x12f5ac,_0x242815){_0x242815=_0x242815||0x1f4;return function(_0x1ccd67){logger[_0x075c('0x26')](_0x1ccd67[_0x075c('0x27')]);if(_0x1ccd67['name']){delete _0x1ccd67[_0x075c('0x28')];}_0x12f5ac[_0x075c('0x1a')](_0x242815)['send'](_0x1ccd67);};}exports[_0x075c('0x29')]=function(_0x38e3d4,_0x9bd8f){var _0x58eecd={},_0x28da94={},_0x436c53={'count':0x0,'rows':[]};var _0x31c104=_[_0x075c('0x2a')](db['MailServerOut'][_0x075c('0x2b')],function(_0x2b0af9){return{'name':_0x2b0af9[_0x075c('0x2c')],'type':_0x2b0af9[_0x075c('0x2d')][_0x075c('0x2e')]};});_0x28da94[_0x075c('0x2f')]=_['map'](_0x31c104,_0x075c('0x28'));_0x28da94['query']=_[_0x075c('0x30')](_0x38e3d4['query']);_0x28da94[_0x075c('0x31')]=_['intersection'](_0x28da94[_0x075c('0x2f')],_0x28da94[_0x075c('0x32')]);_0x58eecd['attributes']=_[_0x075c('0x33')](_0x28da94[_0x075c('0x2f')],qs[_0x075c('0x34')](_0x38e3d4[_0x075c('0x32')]['fields']));_0x58eecd[_0x075c('0x35')]=_0x58eecd['attributes'][_0x075c('0x36')]?_0x58eecd[_0x075c('0x35')]:_0x28da94[_0x075c('0x2f')];if(!_0x38e3d4[_0x075c('0x32')]['hasOwnProperty'](_0x075c('0x37'))){_0x58eecd[_0x075c('0x1e')]=qs[_0x075c('0x1e')](_0x38e3d4['query'][_0x075c('0x1e')]);_0x58eecd[_0x075c('0x1c')]=qs[_0x075c('0x1c')](_0x38e3d4[_0x075c('0x32')][_0x075c('0x1c')]);}_0x58eecd['order']=qs[_0x075c('0x38')](_0x38e3d4[_0x075c('0x32')]['sort']);_0x58eecd[_0x075c('0x39')]=qs[_0x075c('0x31')](_[_0x075c('0x3a')](_0x38e3d4['query'],_0x28da94[_0x075c('0x31')]),_0x31c104);if(_0x38e3d4[_0x075c('0x32')]['filter']){_0x58eecd[_0x075c('0x39')]=_[_0x075c('0x3b')](_0x58eecd['where'],{'$or':_['map'](_0x31c104,function(_0x3e0efb){if(_0x3e0efb[_0x075c('0x2d')]!=='VIRTUAL'){var _0x600fb8={};_0x600fb8[_0x3e0efb['name']]={'$like':'%'+_0x38e3d4[_0x075c('0x32')][_0x075c('0x3c')]+'%'};return _0x600fb8;}})});}_0x58eecd=_[_0x075c('0x3b')]({},_0x58eecd,_0x38e3d4[_0x075c('0x3d')]);var _0x2408ee={'where':_0x58eecd[_0x075c('0x39')]};return db[_0x075c('0x3e')][_0x075c('0x1f')](_0x2408ee)[_0x075c('0x3f')](function(_0xf6acb9){_0x436c53[_0x075c('0x1f')]=_0xf6acb9;if(_0x38e3d4[_0x075c('0x32')][_0x075c('0x40')]){_0x58eecd[_0x075c('0x41')]=[{'all':!![]}];}return db[_0x075c('0x3e')][_0x075c('0x42')](_0x58eecd);})['then'](function(_0x240d65){_0x436c53[_0x075c('0x43')]=_0x240d65;return _0x436c53;})[_0x075c('0x3f')](respondWithFilteredResult(_0x9bd8f,_0x58eecd))['catch'](handleError(_0x9bd8f,null));};exports['show']=function(_0x4c3bc0,_0x354b78){var _0x3178c3={'raw':!![],'where':{'id':_0x4c3bc0[_0x075c('0x44')]['id']}},_0x130177={};_0x130177[_0x075c('0x2f')]=_[_0x075c('0x30')](db[_0x075c('0x3e')]['rawAttributes']);_0x130177[_0x075c('0x32')]=_['keys'](_0x4c3bc0[_0x075c('0x32')]);_0x130177[_0x075c('0x31')]=_['intersection'](_0x130177[_0x075c('0x2f')],_0x130177[_0x075c('0x32')]);_0x3178c3[_0x075c('0x35')]=_[_0x075c('0x33')](_0x130177['model'],qs[_0x075c('0x34')](_0x4c3bc0[_0x075c('0x32')][_0x075c('0x34')]));_0x3178c3['attributes']=_0x3178c3[_0x075c('0x35')][_0x075c('0x36')]?_0x3178c3[_0x075c('0x35')]:_0x130177[_0x075c('0x2f')];if(_0x4c3bc0[_0x075c('0x32')]['includeAll']){_0x3178c3[_0x075c('0x41')]=[{'all':!![]}];}_0x3178c3=_['merge']({},_0x3178c3,_0x4c3bc0[_0x075c('0x3d')]);return db[_0x075c('0x3e')][_0x075c('0x45')](_0x3178c3)[_0x075c('0x3f')](handleEntityNotFound(_0x354b78,null))[_0x075c('0x3f')](respondWithResult(_0x354b78,null))['catch'](handleError(_0x354b78,null));};exports[_0x075c('0x46')]=function(_0x422e6f,_0x2c9892){return db[_0x075c('0x3e')][_0x075c('0x46')](_0x422e6f[_0x075c('0x47')],{})['then'](respondWithResult(_0x2c9892,0xc9))[_0x075c('0x48')](handleError(_0x2c9892,null));};exports[_0x075c('0x25')]=function(_0x472bd9,_0x1c49bc){if(_0x472bd9[_0x075c('0x47')]['id']){delete _0x472bd9[_0x075c('0x47')]['id'];}return db['MailServerOut'][_0x075c('0x45')]({'where':{'id':_0x472bd9[_0x075c('0x44')]['id']}})[_0x075c('0x3f')](handleEntityNotFound(_0x1c49bc,null))['then'](saveUpdates(_0x472bd9['body'],null))['then'](respondWithResult(_0x1c49bc,null))[_0x075c('0x48')](handleError(_0x1c49bc,null));};exports[_0x075c('0x49')]=function(_0x358946,_0x467f48){return db['MailServerOut']['find']({'where':{'id':_0x358946[_0x075c('0x44')]['id']}})['then'](handleEntityNotFound(_0x467f48,null))['then'](removeEntity(_0x467f48,null))[_0x075c('0x48')](handleError(_0x467f48,null));}; \ No newline at end of file +var _0xca6f=['reject','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','apply'];(function(_0x4bd183,_0x50b95f){var _0x3c8071=function(_0x1e46c3){while(--_0x1e46c3){_0x4bd183['push'](_0x4bd183['shift']());}};_0x3c8071(++_0x50b95f);}(_0xca6f,0x151));var _0xfca6=function(_0x59250d,_0x3faa07){_0x59250d=_0x59250d-0x0;var _0x7635eb=_0xca6f[_0x59250d];return _0x7635eb;};'use strict';var emlformat=require(_0xfca6('0x0'));var rimraf=require(_0xfca6('0x1'));var zipdir=require(_0xfca6('0x2'));var jsonpatch=require(_0xfca6('0x3'));var rp=require(_0xfca6('0x4'));var moment=require(_0xfca6('0x5'));var BPromise=require(_0xfca6('0x6'));var Mustache=require(_0xfca6('0x7'));var util=require(_0xfca6('0x8'));var path=require(_0xfca6('0x9'));var sox=require(_0xfca6('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfca6('0xb'));var _=require(_0xfca6('0xc'));var squel=require('squel');var crypto=require(_0xfca6('0xd'));var jsforce=require(_0xfca6('0xe'));var deskjs=require(_0xfca6('0xf'));var toCsv=require(_0xfca6('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfca6('0x11'));var qs=require(_0xfca6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfca6('0x13'))(_0xfca6('0x14'));var utils=require(_0xfca6('0x15'));var config=require(_0xfca6('0x16'));var licenseUtil=require(_0xfca6('0x17'));var db=require(_0xfca6('0x18'))['db'];function respondWithStatusCode(_0x43981b,_0xc9fb13){_0xc9fb13=_0xc9fb13||0xcc;return function(_0x474fed){if(_0x474fed){return _0x43981b['sendStatus'](_0xc9fb13);}return _0x43981b[_0xfca6('0x19')](_0xc9fb13)[_0xfca6('0x1a')]();};}function respondWithResult(_0x360d4b,_0x26f425){_0x26f425=_0x26f425||0xc8;return function(_0x47a15c){if(_0x47a15c){return _0x360d4b[_0xfca6('0x19')](_0x26f425)[_0xfca6('0x1b')](_0x47a15c);}};}function respondWithFilteredResult(_0x13cea0,_0x5dba8a){return function(_0x3cd763){if(_0x3cd763){var _0xb849e9=typeof _0x5dba8a[_0xfca6('0x1c')]==='undefined'&&typeof _0x5dba8a[_0xfca6('0x1d')]===_0xfca6('0x1e');var _0x19ba94=_0x3cd763[_0xfca6('0x1f')];var _0x2d2063=_0xb849e9?0x0:_0x5dba8a['offset'];var _0x349489=_0xb849e9?_0x3cd763[_0xfca6('0x1f')]:_0x5dba8a[_0xfca6('0x1c')]+_0x5dba8a[_0xfca6('0x1d')];var _0x308c8b;if(_0x349489>=_0x19ba94){_0x349489=_0x19ba94;_0x308c8b=0xc8;}else{_0x308c8b=0xce;}_0x13cea0[_0xfca6('0x19')](_0x308c8b);return _0x13cea0['set']('Content-Range',_0x2d2063+'-'+_0x349489+'/'+_0x19ba94)['json'](_0x3cd763);}return null;};}function patchUpdates(_0x35cf2c){return function(_0x46694e){try{jsonpatch[_0xfca6('0x20')](_0x46694e,_0x35cf2c,!![]);}catch(_0x1d7cd4){return BPromise[_0xfca6('0x21')](_0x1d7cd4);}return _0x46694e['save']();};}function saveUpdates(_0x58cdfa,_0x30ffcd){return function(_0x592eb5){if(_0x592eb5){return _0x592eb5[_0xfca6('0x22')](_0x58cdfa)[_0xfca6('0x23')](function(_0x435a32){return _0x435a32;});}return null;};}function removeEntity(_0x361811,_0x408899){return function(_0x534c0d){if(_0x534c0d){return _0x534c0d[_0xfca6('0x24')]()[_0xfca6('0x23')](function(){_0x361811[_0xfca6('0x19')](0xcc)[_0xfca6('0x1a')]();});}};}function handleEntityNotFound(_0x3b9a86,_0x26b299){return function(_0x42c26d){if(!_0x42c26d){_0x3b9a86[_0xfca6('0x25')](0x194);}return _0x42c26d;};}function handleError(_0x47e8bc,_0x5171d9){_0x5171d9=_0x5171d9||0x1f4;return function(_0x19d610){logger[_0xfca6('0x26')](_0x19d610['stack']);if(_0x19d610['name']){delete _0x19d610[_0xfca6('0x27')];}_0x47e8bc[_0xfca6('0x19')](_0x5171d9)[_0xfca6('0x28')](_0x19d610);};}exports[_0xfca6('0x29')]=function(_0x22b25e,_0x5b6cf7){var _0x3d1766={},_0x12c0fe={},_0x500c38={'count':0x0,'rows':[]};var _0x1bc67c=_['map'](db['MailServerOut'][_0xfca6('0x2a')],function(_0x3751eb){return{'name':_0x3751eb[_0xfca6('0x2b')],'type':_0x3751eb[_0xfca6('0x2c')][_0xfca6('0x2d')]};});_0x12c0fe[_0xfca6('0x2e')]=_['map'](_0x1bc67c,'name');_0x12c0fe[_0xfca6('0x2f')]=_[_0xfca6('0x30')](_0x22b25e[_0xfca6('0x2f')]);_0x12c0fe[_0xfca6('0x31')]=_[_0xfca6('0x32')](_0x12c0fe[_0xfca6('0x2e')],_0x12c0fe[_0xfca6('0x2f')]);_0x3d1766[_0xfca6('0x33')]=_[_0xfca6('0x32')](_0x12c0fe[_0xfca6('0x2e')],qs['fields'](_0x22b25e['query']['fields']));_0x3d1766[_0xfca6('0x33')]=_0x3d1766[_0xfca6('0x33')]['length']?_0x3d1766[_0xfca6('0x33')]:_0x12c0fe[_0xfca6('0x2e')];if(!_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x34')](_0xfca6('0x35'))){_0x3d1766[_0xfca6('0x1d')]=qs[_0xfca6('0x1d')](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x1d')]);_0x3d1766[_0xfca6('0x1c')]=qs['offset'](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x1c')]);}_0x3d1766[_0xfca6('0x36')]=qs['sort'](_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x37')]);_0x3d1766['where']=qs[_0xfca6('0x31')](_[_0xfca6('0x38')](_0x22b25e[_0xfca6('0x2f')],_0x12c0fe[_0xfca6('0x31')]),_0x1bc67c);if(_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x39')]){_0x3d1766[_0xfca6('0x3a')]=_[_0xfca6('0x3b')](_0x3d1766[_0xfca6('0x3a')],{'$or':_['map'](_0x1bc67c,function(_0x47e424){if(_0x47e424['type']!==_0xfca6('0x3c')){var _0x376f5b={};_0x376f5b[_0x47e424[_0xfca6('0x27')]]={'$like':'%'+_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x39')]+'%'};return _0x376f5b;}})});}_0x3d1766=_['merge']({},_0x3d1766,_0x22b25e[_0xfca6('0x3d')]);var _0x2b465b={'where':_0x3d1766[_0xfca6('0x3a')]};return db[_0xfca6('0x3e')]['count'](_0x2b465b)['then'](function(_0x84c3fd){_0x500c38[_0xfca6('0x1f')]=_0x84c3fd;if(_0x22b25e[_0xfca6('0x2f')][_0xfca6('0x3f')]){_0x3d1766[_0xfca6('0x40')]=[{'all':!![]}];}return db[_0xfca6('0x3e')][_0xfca6('0x41')](_0x3d1766);})['then'](function(_0x3c6cd0){_0x500c38[_0xfca6('0x42')]=_0x3c6cd0;return _0x500c38;})[_0xfca6('0x23')](respondWithFilteredResult(_0x5b6cf7,_0x3d1766))[_0xfca6('0x43')](handleError(_0x5b6cf7,null));};exports['show']=function(_0x1008e6,_0x2618cc){var _0xa2410b={'raw':!![],'where':{'id':_0x1008e6[_0xfca6('0x44')]['id']}},_0x206129={};_0x206129[_0xfca6('0x2e')]=_['keys'](db[_0xfca6('0x3e')]['rawAttributes']);_0x206129[_0xfca6('0x2f')]=_[_0xfca6('0x30')](_0x1008e6[_0xfca6('0x2f')]);_0x206129[_0xfca6('0x31')]=_[_0xfca6('0x32')](_0x206129['model'],_0x206129[_0xfca6('0x2f')]);_0xa2410b[_0xfca6('0x33')]=_[_0xfca6('0x32')](_0x206129[_0xfca6('0x2e')],qs[_0xfca6('0x45')](_0x1008e6[_0xfca6('0x2f')][_0xfca6('0x45')]));_0xa2410b[_0xfca6('0x33')]=_0xa2410b[_0xfca6('0x33')][_0xfca6('0x46')]?_0xa2410b['attributes']:_0x206129[_0xfca6('0x2e')];if(_0x1008e6[_0xfca6('0x2f')][_0xfca6('0x3f')]){_0xa2410b[_0xfca6('0x40')]=[{'all':!![]}];}_0xa2410b=_[_0xfca6('0x3b')]({},_0xa2410b,_0x1008e6['options']);return db[_0xfca6('0x3e')][_0xfca6('0x47')](_0xa2410b)['then'](handleEntityNotFound(_0x2618cc,null))[_0xfca6('0x23')](respondWithResult(_0x2618cc,null))['catch'](handleError(_0x2618cc,null));};exports[_0xfca6('0x48')]=function(_0x3146ce,_0x4b89fe){return db[_0xfca6('0x3e')]['create'](_0x3146ce['body'],{})['then'](respondWithResult(_0x4b89fe,0xc9))[_0xfca6('0x43')](handleError(_0x4b89fe,null));};exports['update']=function(_0x53c74f,_0x4d84cb){if(_0x53c74f['body']['id']){delete _0x53c74f[_0xfca6('0x49')]['id'];}return db[_0xfca6('0x3e')][_0xfca6('0x47')]({'where':{'id':_0x53c74f[_0xfca6('0x44')]['id']}})[_0xfca6('0x23')](handleEntityNotFound(_0x4d84cb,null))['then'](saveUpdates(_0x53c74f[_0xfca6('0x49')],null))[_0xfca6('0x23')](respondWithResult(_0x4d84cb,null))[_0xfca6('0x43')](handleError(_0x4d84cb,null));};exports[_0xfca6('0x24')]=function(_0x30fd29,_0x551b33){return db[_0xfca6('0x3e')][_0xfca6('0x47')]({'where':{'id':_0x30fd29[_0xfca6('0x44')]['id']}})[_0xfca6('0x23')](handleEntityNotFound(_0x551b33,null))['then'](removeEntity(_0x551b33,null))[_0xfca6('0x43')](handleError(_0x551b33,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 42c0c4e..5ed33df 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 _0x51ec=['mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports','define'];(function(_0x1fdcfe,_0x4ef2a9){var _0xaaf833=function(_0x3731b8){while(--_0x3731b8){_0x1fdcfe['push'](_0x1fdcfe['shift']());}};_0xaaf833(++_0x4ef2a9);}(_0x51ec,0x175));var _0xc51e=function(_0x5a74cb,_0x36217c){_0x5a74cb=_0x5a74cb-0x0;var _0x563740=_0x51ec[_0x5a74cb];return _0x563740;};'use strict';var _=require(_0xc51e('0x0'));var util=require(_0xc51e('0x1'));var logger=require(_0xc51e('0x2'))(_0xc51e('0x3'));var moment=require(_0xc51e('0x4'));var BPromise=require(_0xc51e('0x5'));var rp=require(_0xc51e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc51e('0x7'));var config=require('../../config/environment');var attributes=require(_0xc51e('0x8'));module[_0xc51e('0x9')]=function(_0x4fe63d,_0x29bb9b){return _0x4fe63d[_0xc51e('0xa')]('MailServerOut',attributes,{'tableName':_0xc51e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7912=['define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailServerOut.attributes','exports'];(function(_0x3373b7,_0x19160d){var _0x50e444=function(_0x2f7c9f){while(--_0x2f7c9f){_0x3373b7['push'](_0x3373b7['shift']());}};_0x50e444(++_0x19160d);}(_0x7912,0xdf));var _0x2791=function(_0x13e5b4,_0x350cbd){_0x13e5b4=_0x13e5b4-0x0;var _0x13605a=_0x7912[_0x13e5b4];return _0x13605a;};'use strict';var _=require(_0x2791('0x0'));var util=require(_0x2791('0x1'));var logger=require(_0x2791('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2791('0x3'));var rp=require(_0x2791('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2791('0x5'));var config=require('../../config/environment');var attributes=require(_0x2791('0x6'));module[_0x2791('0x7')]=function(_0x413703,_0x3de711){return _0x413703[_0x2791('0x8')](_0x2791('0x9'),attributes,{'tableName':_0x2791('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 bc09813..6b6524e 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x1e3a4c,_0x308c94){_0x1e3a4c=_0x1e3a4c-0x0;var _0x1c2ab5=_0x7a54[_0x1e3a4c];return _0x1c2ab5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x12566c,_0x2668c4){var _0x2034c9=function(_0x5b2133){while(--_0x5b2133){_0x12566c['push'](_0x12566c['shift']());}};_0x2034c9(++_0x2668c4);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'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')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 313b57d..7fafb7b 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 _0x1b5c=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','put'];(function(_0x347862,_0x339566){var _0x2ec88b=function(_0x290bdc){while(--_0x290bdc){_0x347862['push'](_0x347862['shift']());}};_0x2ec88b(++_0x339566);}(_0x1b5c,0x88));var _0xc1b5=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x1b5c[_0x33154d];return _0x3b2f03;};'use strict';var multer=require(_0xc1b5('0x0'));var util=require(_0xc1b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1b5('0x2'));var router=express[_0xc1b5('0x3')]();var fs_extra=require(_0xc1b5('0x4'));var auth=require(_0xc1b5('0x5'));var interaction=require(_0xc1b5('0x6'));var config=require(_0xc1b5('0x7'));var controller=require(_0xc1b5('0x8'));router['get']('/',auth[_0xc1b5('0x9')](),controller[_0xc1b5('0xa')]);router['get'](_0xc1b5('0xb'),auth[_0xc1b5('0x9')](),controller['describe']);router[_0xc1b5('0xc')](_0xc1b5('0xd'),auth[_0xc1b5('0x9')](),controller[_0xc1b5('0xe')]);router[_0xc1b5('0xf')]('/',auth[_0xc1b5('0x9')](),controller[_0xc1b5('0x10')]);router[_0xc1b5('0x11')]('/:id',auth[_0xc1b5('0x9')](),controller[_0xc1b5('0x12')]);router[_0xc1b5('0x13')](_0xc1b5('0xd'),auth[_0xc1b5('0x9')](),controller[_0xc1b5('0x14')]);module[_0xc1b5('0x15')]=router; \ No newline at end of file +var _0xd529=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x56407c,_0x3f9ca7){var _0x3edf9a=function(_0x50a620){while(--_0x50a620){_0x56407c['push'](_0x56407c['shift']());}};_0x3edf9a(++_0x3f9ca7);}(_0xd529,0xb5));var _0x9d52=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd529[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var path=require(_0x9d52('0x2'));var timeout=require(_0x9d52('0x3'));var express=require(_0x9d52('0x4'));var router=express[_0x9d52('0x5')]();var fs_extra=require(_0x9d52('0x6'));var auth=require(_0x9d52('0x7'));var interaction=require(_0x9d52('0x8'));var config=require(_0x9d52('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9d52('0xa')](),controller['index']);router[_0x9d52('0xb')](_0x9d52('0xc'),auth[_0x9d52('0xa')](),controller[_0x9d52('0xd')]);router[_0x9d52('0xb')]('/:id',auth[_0x9d52('0xa')](),controller[_0x9d52('0xe')]);router[_0x9d52('0xf')]('/',auth['isAuthenticated'](),controller[_0x9d52('0x10')]);router[_0x9d52('0x11')]('/:id',auth[_0x9d52('0xa')](),controller[_0x9d52('0x12')]);router[_0x9d52('0x13')](_0x9d52('0x14'),auth['isAuthenticated'](),controller[_0x9d52('0x15')]);module[_0x9d52('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index dbd76e3..e8a87c3 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 _0x31f0=['STRING','sequelize'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x31f0,0xb7));var _0x031f=function(_0x5e6014,_0x30e88e){_0x5e6014=_0x5e6014-0x0;var _0x4cd604=_0x31f0[_0x5e6014];return _0x4cd604;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x031f('0x1')]}}; \ No newline at end of file +var _0xfc65=['STRING','sequelize','name'];(function(_0xa8d305,_0x2119a5){var _0x28b365=function(_0x5f2ec4){while(--_0x5f2ec4){_0xa8d305['push'](_0xa8d305['shift']());}};_0x28b365(++_0x2119a5);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x1b0eb4,_0x3ec80c){_0x1b0eb4=_0x1b0eb4-0x0;var _0x5c57f4=_0xfc65[_0x1b0eb4];return _0x5c57f4;};'use strict';var Sequelize=require(_0x5fc6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5fc6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fc6('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f5a7cd0..364ebb1 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 _0x2900=['keys','filters','attributes','intersection','fields','length','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','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','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','key','model','query'];(function(_0x173524,_0x31af0d){var _0x114809=function(_0x1a3555){while(--_0x1a3555){_0x173524['push'](_0x173524['shift']());}};_0x114809(++_0x31af0d);}(_0x2900,0x13c));var _0x0290=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x2900[_0x1e6e4e];return _0x3d746b;};'use strict';var emlformat=require(_0x0290('0x0'));var rimraf=require(_0x0290('0x1'));var zipdir=require(_0x0290('0x2'));var jsonpatch=require(_0x0290('0x3'));var rp=require('request-promise');var moment=require(_0x0290('0x4'));var BPromise=require(_0x0290('0x5'));var Mustache=require('mustache');var util=require(_0x0290('0x6'));var path=require(_0x0290('0x7'));var sox=require('sox');var csv=require(_0x0290('0x8'));var ejs=require(_0x0290('0x9'));var fs=require('fs');var fs_extra=require(_0x0290('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0290('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0290('0x8'));var querystring=require(_0x0290('0xc'));var Papa=require(_0x0290('0xd'));var Redis=require(_0x0290('0xe'));var authService=require(_0x0290('0xf'));var qs=require(_0x0290('0x10'));var as=require(_0x0290('0x11'));var hardwareService=require(_0x0290('0x12'));var logger=require(_0x0290('0x13'))(_0x0290('0x14'));var utils=require(_0x0290('0x15'));var config=require(_0x0290('0x16'));var licenseUtil=require(_0x0290('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7fc4,_0x273ec0){_0x273ec0=_0x273ec0||0xcc;return function(_0x5bd122){if(_0x5bd122){return _0x2b7fc4[_0x0290('0x18')](_0x273ec0);}return _0x2b7fc4['status'](_0x273ec0)[_0x0290('0x19')]();};}function respondWithResult(_0xc388e9,_0x5ed533){_0x5ed533=_0x5ed533||0xc8;return function(_0x26118f){if(_0x26118f){return _0xc388e9[_0x0290('0x1a')](_0x5ed533)['json'](_0x26118f);}};}function respondWithFilteredResult(_0x53e374,_0x58ac58){return function(_0xfb8ee4){if(_0xfb8ee4){var _0x20bf6f=typeof _0x58ac58[_0x0290('0x1b')]==='undefined'&&typeof _0x58ac58[_0x0290('0x1c')]===_0x0290('0x1d');var _0x519d84=_0xfb8ee4['count'];var _0x4a5748=_0x20bf6f?0x0:_0x58ac58[_0x0290('0x1b')];var _0x34c800=_0x20bf6f?_0xfb8ee4[_0x0290('0x1e')]:_0x58ac58[_0x0290('0x1b')]+_0x58ac58['limit'];var _0x520781;if(_0x34c800>=_0x519d84){_0x34c800=_0x519d84;_0x520781=0xc8;}else{_0x520781=0xce;}_0x53e374[_0x0290('0x1a')](_0x520781);return _0x53e374[_0x0290('0x1f')](_0x0290('0x20'),_0x4a5748+'-'+_0x34c800+'/'+_0x519d84)[_0x0290('0x21')](_0xfb8ee4);}return null;};}function patchUpdates(_0x29b5f9){return function(_0x3e023d){try{jsonpatch[_0x0290('0x22')](_0x3e023d,_0x29b5f9,!![]);}catch(_0x2fe982){return BPromise['reject'](_0x2fe982);}return _0x3e023d[_0x0290('0x23')]();};}function saveUpdates(_0x3ff477,_0x46a334){return function(_0x77ea5f){if(_0x77ea5f){return _0x77ea5f[_0x0290('0x24')](_0x3ff477)[_0x0290('0x25')](function(_0x45b511){return _0x45b511;});}return null;};}function removeEntity(_0x2b58d9,_0x10f212){return function(_0x18843c){if(_0x18843c){return _0x18843c[_0x0290('0x26')]()[_0x0290('0x25')](function(){_0x2b58d9['status'](0xcc)[_0x0290('0x19')]();});}};}function handleEntityNotFound(_0xe9921b,_0x4d38a5){return function(_0x39aa39){if(!_0x39aa39){_0xe9921b[_0x0290('0x18')](0x194);}return _0x39aa39;};}function handleError(_0x54c6c3,_0x55aa43){_0x55aa43=_0x55aa43||0x1f4;return function(_0x1441c7){logger[_0x0290('0x27')](_0x1441c7[_0x0290('0x28')]);if(_0x1441c7[_0x0290('0x29')]){delete _0x1441c7['name'];}_0x54c6c3[_0x0290('0x1a')](_0x55aa43)[_0x0290('0x2a')](_0x1441c7);};}exports[_0x0290('0x2b')]=function(_0x3ad735,_0x352974){var _0x532887={},_0x48f51b={},_0x2b5c74={'count':0x0,'rows':[]};var _0xe3f662=_[_0x0290('0x2c')](db[_0x0290('0x2d')]['rawAttributes'],function(_0x476e30){return{'name':_0x476e30['fieldName'],'type':_0x476e30['type'][_0x0290('0x2e')]};});_0x48f51b[_0x0290('0x2f')]=_[_0x0290('0x2c')](_0xe3f662,_0x0290('0x29'));_0x48f51b[_0x0290('0x30')]=_[_0x0290('0x31')](_0x3ad735['query']);_0x48f51b[_0x0290('0x32')]=_['intersection'](_0x48f51b[_0x0290('0x2f')],_0x48f51b['query']);_0x532887[_0x0290('0x33')]=_[_0x0290('0x34')](_0x48f51b[_0x0290('0x2f')],qs[_0x0290('0x35')](_0x3ad735[_0x0290('0x30')][_0x0290('0x35')]));_0x532887[_0x0290('0x33')]=_0x532887['attributes'][_0x0290('0x36')]?_0x532887[_0x0290('0x33')]:_0x48f51b[_0x0290('0x2f')];if(!_0x3ad735[_0x0290('0x30')]['hasOwnProperty'](_0x0290('0x37'))){_0x532887[_0x0290('0x1c')]=qs['limit'](_0x3ad735[_0x0290('0x30')][_0x0290('0x1c')]);_0x532887[_0x0290('0x1b')]=qs[_0x0290('0x1b')](_0x3ad735['query']['offset']);}_0x532887[_0x0290('0x38')]=qs['sort'](_0x3ad735['query']['sort']);_0x532887[_0x0290('0x39')]=qs[_0x0290('0x32')](_['pick'](_0x3ad735[_0x0290('0x30')],_0x48f51b[_0x0290('0x32')]),_0xe3f662);if(_0x3ad735[_0x0290('0x30')][_0x0290('0x3a')]){_0x532887['where']=_[_0x0290('0x3b')](_0x532887[_0x0290('0x39')],{'$or':_[_0x0290('0x2c')](_0xe3f662,function(_0x575e91){if(_0x575e91[_0x0290('0x3c')]!==_0x0290('0x3d')){var _0x127f23={};_0x127f23[_0x575e91[_0x0290('0x29')]]={'$like':'%'+_0x3ad735[_0x0290('0x30')]['filter']+'%'};return _0x127f23;}})});}_0x532887=_[_0x0290('0x3b')]({},_0x532887,_0x3ad735[_0x0290('0x3e')]);var _0x1c35bd={'where':_0x532887['where']};return db[_0x0290('0x2d')][_0x0290('0x1e')](_0x1c35bd)[_0x0290('0x25')](function(_0x15458d){_0x2b5c74[_0x0290('0x1e')]=_0x15458d;if(_0x3ad735[_0x0290('0x30')][_0x0290('0x3f')]){_0x532887[_0x0290('0x40')]=[{'all':!![]}];}return db['MailSubstatus'][_0x0290('0x41')](_0x532887);})['then'](function(_0x876a06){_0x2b5c74['rows']=_0x876a06;return _0x2b5c74;})['then'](respondWithFilteredResult(_0x352974,_0x532887))[_0x0290('0x42')](handleError(_0x352974,null));};exports['show']=function(_0x3e4048,_0x298eca){var _0x4b5a36={'raw':!![],'where':{'id':_0x3e4048[_0x0290('0x43')]['id']}},_0x53264e={};_0x53264e[_0x0290('0x2f')]=_[_0x0290('0x31')](db[_0x0290('0x2d')][_0x0290('0x44')]);_0x53264e[_0x0290('0x30')]=_[_0x0290('0x31')](_0x3e4048[_0x0290('0x30')]);_0x53264e[_0x0290('0x32')]=_[_0x0290('0x34')](_0x53264e['model'],_0x53264e['query']);_0x4b5a36['attributes']=_[_0x0290('0x34')](_0x53264e[_0x0290('0x2f')],qs[_0x0290('0x35')](_0x3e4048[_0x0290('0x30')][_0x0290('0x35')]));_0x4b5a36[_0x0290('0x33')]=_0x4b5a36[_0x0290('0x33')][_0x0290('0x36')]?_0x4b5a36[_0x0290('0x33')]:_0x53264e[_0x0290('0x2f')];if(_0x3e4048[_0x0290('0x30')][_0x0290('0x3f')]){_0x4b5a36['include']=[{'all':!![]}];}_0x4b5a36=_[_0x0290('0x3b')]({},_0x4b5a36,_0x3e4048['options']);return db[_0x0290('0x2d')][_0x0290('0x45')](_0x4b5a36)[_0x0290('0x25')](handleEntityNotFound(_0x298eca,null))[_0x0290('0x25')](respondWithResult(_0x298eca,null))[_0x0290('0x42')](handleError(_0x298eca,null));};exports[_0x0290('0x46')]=function(_0x1eb410,_0x2a06b3){return db[_0x0290('0x2d')][_0x0290('0x46')](_0x1eb410[_0x0290('0x47')],{})[_0x0290('0x25')](respondWithResult(_0x2a06b3,0xc9))['catch'](handleError(_0x2a06b3,null));};exports['update']=function(_0x28dbd3,_0x1219f3){if(_0x28dbd3[_0x0290('0x47')]['id']){delete _0x28dbd3['body']['id'];}return db[_0x0290('0x2d')][_0x0290('0x45')]({'where':{'id':_0x28dbd3['params']['id']}})[_0x0290('0x25')](handleEntityNotFound(_0x1219f3,null))[_0x0290('0x25')](saveUpdates(_0x28dbd3['body'],null))['then'](respondWithResult(_0x1219f3,null))[_0x0290('0x42')](handleError(_0x1219f3,null));};exports[_0x0290('0x26')]=function(_0x2416f5,_0x41649d){return db[_0x0290('0x2d')][_0x0290('0x45')]({'where':{'id':_0x2416f5[_0x0290('0x43')]['id']}})['then'](handleEntityNotFound(_0x41649d,null))[_0x0290('0x25')](removeEntity(_0x41649d,null))[_0x0290('0x42')](handleError(_0x41649d,null));};exports[_0x0290('0x48')]=function(_0x440e9a,_0x500f54){return db[_0x0290('0x2d')][_0x0290('0x48')]()['then'](respondWithResult(_0x500f54,null))['catch'](handleError(_0x500f54,null));}; \ No newline at end of file +var _0x29a7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','MailSubstatus','findAll','rows','show','params','rawAttributes','keys','include','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3695df,_0x22c52b){var _0x4d0f16=function(_0x3f15dd){while(--_0x3f15dd){_0x3695df['push'](_0x3695df['shift']());}};_0x4d0f16(++_0x22c52b);}(_0x29a7,0x1af));var _0x729a=function(_0x239e78,_0x2e5e3){_0x239e78=_0x239e78-0x0;var _0x46d5e4=_0x29a7[_0x239e78];return _0x46d5e4;};'use strict';var emlformat=require(_0x729a('0x0'));var rimraf=require(_0x729a('0x1'));var zipdir=require(_0x729a('0x2'));var jsonpatch=require(_0x729a('0x3'));var rp=require(_0x729a('0x4'));var moment=require(_0x729a('0x5'));var BPromise=require(_0x729a('0x6'));var Mustache=require(_0x729a('0x7'));var util=require(_0x729a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x729a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x729a('0xa'));var _=require(_0x729a('0xb'));var squel=require(_0x729a('0xc'));var crypto=require(_0x729a('0xd'));var jsforce=require(_0x729a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x729a('0x9'));var querystring=require(_0x729a('0xf'));var Papa=require(_0x729a('0x10'));var Redis=require(_0x729a('0x11'));var authService=require(_0x729a('0x12'));var qs=require(_0x729a('0x13'));var as=require(_0x729a('0x14'));var hardwareService=require(_0x729a('0x15'));var logger=require(_0x729a('0x16'))('api');var utils=require(_0x729a('0x17'));var config=require(_0x729a('0x18'));var licenseUtil=require(_0x729a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa2a0d4,_0x1f96d0){_0x1f96d0=_0x1f96d0||0xcc;return function(_0x41958c){if(_0x41958c){return _0xa2a0d4[_0x729a('0x1a')](_0x1f96d0);}return _0xa2a0d4['status'](_0x1f96d0)['end']();};}function respondWithResult(_0x259442,_0x511cc9){_0x511cc9=_0x511cc9||0xc8;return function(_0x3aa2a7){if(_0x3aa2a7){return _0x259442[_0x729a('0x1b')](_0x511cc9)[_0x729a('0x1c')](_0x3aa2a7);}};}function respondWithFilteredResult(_0x531c42,_0x237b13){return function(_0x55e735){if(_0x55e735){var _0x3783c2=typeof _0x237b13['offset']===_0x729a('0x1d')&&typeof _0x237b13[_0x729a('0x1e')]===_0x729a('0x1d');var _0x121a82=_0x55e735[_0x729a('0x1f')];var _0x5de22e=_0x3783c2?0x0:_0x237b13[_0x729a('0x20')];var _0x369c97=_0x3783c2?_0x55e735[_0x729a('0x1f')]:_0x237b13[_0x729a('0x20')]+_0x237b13[_0x729a('0x1e')];var _0x229622;if(_0x369c97>=_0x121a82){_0x369c97=_0x121a82;_0x229622=0xc8;}else{_0x229622=0xce;}_0x531c42[_0x729a('0x1b')](_0x229622);return _0x531c42[_0x729a('0x21')](_0x729a('0x22'),_0x5de22e+'-'+_0x369c97+'/'+_0x121a82)[_0x729a('0x1c')](_0x55e735);}return null;};}function patchUpdates(_0x372727){return function(_0x16fb93){try{jsonpatch[_0x729a('0x23')](_0x16fb93,_0x372727,!![]);}catch(_0x2262b1){return BPromise[_0x729a('0x24')](_0x2262b1);}return _0x16fb93['save']();};}function saveUpdates(_0x5e09cc,_0x3a28db){return function(_0x248294){if(_0x248294){return _0x248294[_0x729a('0x25')](_0x5e09cc)[_0x729a('0x26')](function(_0x137241){return _0x137241;});}return null;};}function removeEntity(_0x145b9a,_0x46a2c2){return function(_0xc8a8d1){if(_0xc8a8d1){return _0xc8a8d1[_0x729a('0x27')]()['then'](function(){_0x145b9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x373cb0,_0x20407c){return function(_0x5ea2a6){if(!_0x5ea2a6){_0x373cb0[_0x729a('0x1a')](0x194);}return _0x5ea2a6;};}function handleError(_0x5889e4,_0x41ceb0){_0x41ceb0=_0x41ceb0||0x1f4;return function(_0x2bdd91){logger[_0x729a('0x28')](_0x2bdd91[_0x729a('0x29')]);if(_0x2bdd91['name']){delete _0x2bdd91[_0x729a('0x2a')];}_0x5889e4[_0x729a('0x1b')](_0x41ceb0)[_0x729a('0x2b')](_0x2bdd91);};}exports['index']=function(_0x6a1e4d,_0x46a53f){var _0x4bf151={},_0x5dd096={},_0xa240d2={'count':0x0,'rows':[]};var _0x3b10cc=_[_0x729a('0x2c')](db['MailSubstatus']['rawAttributes'],function(_0x35d82c){return{'name':_0x35d82c[_0x729a('0x2d')],'type':_0x35d82c[_0x729a('0x2e')][_0x729a('0x2f')]};});_0x5dd096[_0x729a('0x30')]=_[_0x729a('0x2c')](_0x3b10cc,_0x729a('0x2a'));_0x5dd096[_0x729a('0x31')]=_['keys'](_0x6a1e4d[_0x729a('0x31')]);_0x5dd096[_0x729a('0x32')]=_[_0x729a('0x33')](_0x5dd096[_0x729a('0x30')],_0x5dd096[_0x729a('0x31')]);_0x4bf151[_0x729a('0x34')]=_[_0x729a('0x33')](_0x5dd096[_0x729a('0x30')],qs[_0x729a('0x35')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x35')]));_0x4bf151[_0x729a('0x34')]=_0x4bf151[_0x729a('0x34')][_0x729a('0x36')]?_0x4bf151['attributes']:_0x5dd096[_0x729a('0x30')];if(!_0x6a1e4d['query']['hasOwnProperty'](_0x729a('0x37'))){_0x4bf151['limit']=qs[_0x729a('0x1e')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x1e')]);_0x4bf151[_0x729a('0x20')]=qs[_0x729a('0x20')](_0x6a1e4d[_0x729a('0x31')]['offset']);}_0x4bf151[_0x729a('0x38')]=qs[_0x729a('0x39')](_0x6a1e4d[_0x729a('0x31')][_0x729a('0x39')]);_0x4bf151[_0x729a('0x3a')]=qs[_0x729a('0x32')](_[_0x729a('0x3b')](_0x6a1e4d[_0x729a('0x31')],_0x5dd096['filters']),_0x3b10cc);if(_0x6a1e4d[_0x729a('0x31')]['filter']){_0x4bf151['where']=_['merge'](_0x4bf151[_0x729a('0x3a')],{'$or':_[_0x729a('0x2c')](_0x3b10cc,function(_0xfa2b43){if(_0xfa2b43[_0x729a('0x2e')]!=='VIRTUAL'){var _0xc27947={};_0xc27947[_0xfa2b43[_0x729a('0x2a')]]={'$like':'%'+_0x6a1e4d[_0x729a('0x31')][_0x729a('0x3c')]+'%'};return _0xc27947;}})});}_0x4bf151=_[_0x729a('0x3d')]({},_0x4bf151,_0x6a1e4d[_0x729a('0x3e')]);var _0xb6dd16={'where':_0x4bf151[_0x729a('0x3a')]};return db[_0x729a('0x3f')][_0x729a('0x1f')](_0xb6dd16)[_0x729a('0x26')](function(_0x20e767){_0xa240d2[_0x729a('0x1f')]=_0x20e767;if(_0x6a1e4d['query']['includeAll']){_0x4bf151['include']=[{'all':!![]}];}return db[_0x729a('0x3f')][_0x729a('0x40')](_0x4bf151);})['then'](function(_0xa18d8d){_0xa240d2[_0x729a('0x41')]=_0xa18d8d;return _0xa240d2;})['then'](respondWithFilteredResult(_0x46a53f,_0x4bf151))['catch'](handleError(_0x46a53f,null));};exports[_0x729a('0x42')]=function(_0x2d4b4e,_0x1f1188){var _0x108b17={'raw':!![],'where':{'id':_0x2d4b4e[_0x729a('0x43')]['id']}},_0x2066af={};_0x2066af[_0x729a('0x30')]=_['keys'](db['MailSubstatus'][_0x729a('0x44')]);_0x2066af[_0x729a('0x31')]=_[_0x729a('0x45')](_0x2d4b4e[_0x729a('0x31')]);_0x2066af[_0x729a('0x32')]=_[_0x729a('0x33')](_0x2066af[_0x729a('0x30')],_0x2066af[_0x729a('0x31')]);_0x108b17[_0x729a('0x34')]=_[_0x729a('0x33')](_0x2066af['model'],qs['fields'](_0x2d4b4e[_0x729a('0x31')][_0x729a('0x35')]));_0x108b17['attributes']=_0x108b17[_0x729a('0x34')]['length']?_0x108b17[_0x729a('0x34')]:_0x2066af[_0x729a('0x30')];if(_0x2d4b4e['query']['includeAll']){_0x108b17[_0x729a('0x46')]=[{'all':!![]}];}_0x108b17=_['merge']({},_0x108b17,_0x2d4b4e[_0x729a('0x3e')]);return db[_0x729a('0x3f')]['find'](_0x108b17)[_0x729a('0x26')](handleEntityNotFound(_0x1f1188,null))[_0x729a('0x26')](respondWithResult(_0x1f1188,null))[_0x729a('0x47')](handleError(_0x1f1188,null));};exports[_0x729a('0x48')]=function(_0x46a926,_0x1b9b26){return db[_0x729a('0x3f')][_0x729a('0x48')](_0x46a926[_0x729a('0x49')],{})[_0x729a('0x26')](respondWithResult(_0x1b9b26,0xc9))[_0x729a('0x47')](handleError(_0x1b9b26,null));};exports[_0x729a('0x25')]=function(_0x4c9d09,_0x4ada1d){if(_0x4c9d09[_0x729a('0x49')]['id']){delete _0x4c9d09[_0x729a('0x49')]['id'];}return db[_0x729a('0x3f')]['find']({'where':{'id':_0x4c9d09['params']['id']}})[_0x729a('0x26')](handleEntityNotFound(_0x4ada1d,null))[_0x729a('0x26')](saveUpdates(_0x4c9d09[_0x729a('0x49')],null))['then'](respondWithResult(_0x4ada1d,null))['catch'](handleError(_0x4ada1d,null));};exports[_0x729a('0x27')]=function(_0x677646,_0x5d3c58){return db[_0x729a('0x3f')]['find']({'where':{'id':_0x677646[_0x729a('0x43')]['id']}})[_0x729a('0x26')](handleEntityNotFound(_0x5d3c58,null))[_0x729a('0x26')](removeEntity(_0x5d3c58,null))[_0x729a('0x47')](handleError(_0x5d3c58,null));};exports[_0x729a('0x4a')]=function(_0x8702ed,_0x34ad6a){return db['MailSubstatus'][_0x729a('0x4a')]()['then'](respondWithResult(_0x34ad6a,null))[_0x729a('0x47')](handleError(_0x34ad6a,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index ba27003..1621003 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 _0xe0e6=['hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','update','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe0e6,0x1a7));var _0x6e0e=function(_0x32c97a,_0x29b6fc){_0x32c97a=_0x32c97a-0x0;var _0x5de34d=_0xe0e6[_0x32c97a];return _0x5de34d;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x6e0e('0x0'))['db'][_0x6e0e('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x6e0e('0x2')};function emitEvent(_0x3eac31){return function(_0x19a8b1,_0x5546a3,_0xdfe364){MailSubstatusEvents[_0x6e0e('0x3')](_0x3eac31+':'+_0x19a8b1['id'],_0x19a8b1);MailSubstatusEvents['emit'](_0x3eac31,_0x19a8b1);_0xdfe364(null);};}for(var e in events){if(events[_0x6e0e('0x4')](e)){var event=events[e];MailSubstatus[_0x6e0e('0x5')](e,emitEvent(event));}}module[_0x6e0e('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x3ff9=['hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3ff9,0x12a));var _0x93ff=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3ff9[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require(_0x93ff('0x0'));var MailSubstatus=require(_0x93ff('0x1'))['db'][_0x93ff('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x93ff('0x3')](0x0);var events={'afterUpdate':_0x93ff('0x4')};function emitEvent(_0x430c49){return function(_0x2c6a29,_0x5b6ef9,_0x46ab64){MailSubstatusEvents[_0x93ff('0x5')](_0x430c49+':'+_0x2c6a29['id'],_0x2c6a29);MailSubstatusEvents[_0x93ff('0x5')](_0x430c49,_0x2c6a29);_0x46ab64(null);};}for(var e in events){if(events[_0x93ff('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x93ff('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d12214a..e560e87 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 _0xf5a2=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf5a2,0xb0));var _0x2f5a=function(_0x2d2fe7,_0xfe1ead){_0x2d2fe7=_0x2d2fe7-0x0;var _0x73a810=_0xf5a2[_0x2d2fe7];return _0x73a810;};'use strict';var attributes=require(_0x2f5a('0x0'));module[_0x2f5a('0x1')]=function(_0x5d7759){var _0x34d7be=_0x5d7759['models'];return _0x5d7759[_0x2f5a('0x2')](_0x2f5a('0x3'),attributes,{'tableName':_0x2f5a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1bf6e0,_0x161098,_0x332c70){return _0x34d7be[_0x2f5a('0x5')][_0x2f5a('0x6')]({'value':_0x1bf6e0['name']},{'where':{'field':_0x2f5a('0x7'),'value':_0x1bf6e0[_0x2f5a('0x8')][_0x2f5a('0x9')]}})['then'](function(){_0x332c70();})[_0x2f5a('0xa')](function(_0x293eaa){_0x332c70(_0x293eaa);});}}});}; \ No newline at end of file +var _0xe29b=['mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define'];(function(_0x10a3ed,_0x26b0ff){var _0x42aa8a=function(_0xa3fdf7){while(--_0xa3fdf7){_0x10a3ed['push'](_0x10a3ed['shift']());}};_0x42aa8a(++_0x26b0ff);}(_0xe29b,0x81));var _0xbe29=function(_0xcdae05,_0x403d48){_0xcdae05=_0xcdae05-0x0;var _0xc2b40e=_0xe29b[_0xcdae05];return _0xc2b40e;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xbe29('0x0')]=function(_0x3071af){var _0x31bc53=_0x3071af[_0xbe29('0x1')];return _0x3071af[_0xbe29('0x2')]('MailSubstatus',attributes,{'tableName':_0xbe29('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1dfdfe,_0x1e9b48,_0x5dbac4){return _0x31bc53[_0xbe29('0x4')][_0xbe29('0x5')]({'value':_0x1dfdfe[_0xbe29('0x6')]},{'where':{'field':_0xbe29('0x7'),'value':_0x1dfdfe[_0xbe29('0x8')][_0xbe29('0x6')]}})[_0xbe29('0x9')](function(){_0x5dbac4();})[_0xbe29('0xa')](function(_0x594618){_0x5dbac4(_0x594618);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e9cf56d..266cda4 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 _0xee49=['MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee49,0xe1));var _0x9ee4=function(_0x1393ff,_0x23ffbc){_0x1393ff=_0x1393ff-0x0;var _0x35baf3=_0xee49[_0x1393ff];return _0x35baf3;};'use strict';var _=require(_0x9ee4('0x0'));var util=require(_0x9ee4('0x1'));var moment=require('moment');var BPromise=require(_0x9ee4('0x2'));var rs=require(_0x9ee4('0x3'));var fs=require('fs');var Redis=require(_0x9ee4('0x4'));var db=require(_0x9ee4('0x5'))['db'];var utils=require(_0x9ee4('0x6'));var logger=require(_0x9ee4('0x7'))('rpc');var config=require(_0x9ee4('0x8'));var jayson=require(_0x9ee4('0x9'));var client=jayson[_0x9ee4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43fbaa,_0x3aa8fc,_0x105f25){return new BPromise(function(_0x549dc3,_0x940c36){return client['request'](_0x43fbaa,_0x105f25)[_0x9ee4('0xb')](function(_0x43114e){logger[_0x9ee4('0xc')](_0x9ee4('0xd'),_0x3aa8fc,_0x9ee4('0xe'));logger['debug'](_0x9ee4('0xf'),_0x3aa8fc,_0x9ee4('0xe'),JSON['stringify'](_0x43114e));if(_0x43114e[_0x9ee4('0x10')]){if(_0x43114e[_0x9ee4('0x10')][_0x9ee4('0x11')]===0x1f4){logger['error'](_0x9ee4('0xd'),_0x3aa8fc,_0x43114e['error'][_0x9ee4('0x12')]);return _0x940c36(_0x43114e[_0x9ee4('0x10')]['message']);}logger[_0x9ee4('0x10')](_0x9ee4('0xd'),_0x3aa8fc,_0x43114e[_0x9ee4('0x10')][_0x9ee4('0x12')]);return _0x549dc3(_0x43114e[_0x9ee4('0x10')]['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x3aa8fc,'request\x20sent');_0x549dc3(_0x43114e[_0x9ee4('0x13')][_0x9ee4('0x12')]);}})['catch'](function(_0x3f67ea){logger[_0x9ee4('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3aa8fc,_0x3f67ea);_0x940c36(_0x3f67ea);});});} \ No newline at end of file +var _0xf989=['http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x5df85e,_0x329160){var _0x179af6=function(_0x368078){while(--_0x368078){_0x5df85e['push'](_0x5df85e['shift']());}};_0x179af6(++_0x329160);}(_0xf989,0x133));var _0x9f98=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0xf989[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0x9f98('0x0'));var util=require('util');var moment=require(_0x9f98('0x1'));var BPromise=require(_0x9f98('0x2'));var rs=require(_0x9f98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f98('0x5'))(_0x9f98('0x6'));var config=require('../../config/environment');var jayson=require(_0x9f98('0x7'));var client=jayson['client'][_0x9f98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x158ad7,_0x5dc167,_0x5961b3){return new BPromise(function(_0x4d7e2a,_0x13ebbe){return client[_0x9f98('0x9')](_0x158ad7,_0x5961b3)[_0x9f98('0xa')](function(_0xb505c1){logger[_0x9f98('0xb')](_0x9f98('0xc'),_0x5dc167,_0x9f98('0xd'));logger[_0x9f98('0xe')](_0x9f98('0xf'),_0x5dc167,_0x9f98('0xd'),JSON[_0x9f98('0x10')](_0xb505c1));if(_0xb505c1[_0x9f98('0x11')]){if(_0xb505c1[_0x9f98('0x11')][_0x9f98('0x12')]===0x1f4){logger[_0x9f98('0x11')](_0x9f98('0xc'),_0x5dc167,_0xb505c1[_0x9f98('0x11')][_0x9f98('0x13')]);return _0x13ebbe(_0xb505c1['error'][_0x9f98('0x13')]);}logger[_0x9f98('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5dc167,_0xb505c1[_0x9f98('0x11')][_0x9f98('0x13')]);return _0x4d7e2a(_0xb505c1['error']['message']);}else{logger[_0x9f98('0xb')](_0x9f98('0xc'),_0x5dc167,_0x9f98('0xd'));_0x4d7e2a(_0xb505c1['result'][_0x9f98('0x13')]);}})[_0x9f98('0x14')](function(_0x3c1c8e){logger[_0x9f98('0x11')](_0x9f98('0xc'),_0x5dc167,_0x3c1c8e);_0x13ebbe(_0x3c1c8e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0ffc39c..06f00ab 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 _0xaa42=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x4a1a17,_0x6d9b5a){var _0x534940=function(_0x20662d){while(--_0x20662d){_0x4a1a17['push'](_0x4a1a17['shift']());}};_0x534940(++_0x6d9b5a);}(_0xaa42,0xc5));var _0x2aa4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xaa42[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require(_0x2aa4('0x0'));var path=require(_0x2aa4('0x1'));var timeout=require(_0x2aa4('0x2'));var express=require(_0x2aa4('0x3'));var router=express[_0x2aa4('0x4')]();var fs_extra=require(_0x2aa4('0x5'));var auth=require(_0x2aa4('0x6'));var interaction=require(_0x2aa4('0x7'));var config=require(_0x2aa4('0x8'));var controller=require(_0x2aa4('0x9'));router[_0x2aa4('0xa')]('/',auth[_0x2aa4('0xb')](),controller['index']);router[_0x2aa4('0xa')](_0x2aa4('0xc'),auth['isAuthenticated'](),controller[_0x2aa4('0xd')]);router[_0x2aa4('0xa')](_0x2aa4('0xe'),auth[_0x2aa4('0xb')](),controller[_0x2aa4('0xf')]);router[_0x2aa4('0x10')]('/',auth[_0x2aa4('0xb')](),controller[_0x2aa4('0x11')]);router[_0x2aa4('0x12')](_0x2aa4('0xe'),auth[_0x2aa4('0xb')](),controller[_0x2aa4('0x13')]);router[_0x2aa4('0x14')](_0x2aa4('0xe'),auth[_0x2aa4('0xb')](),controller[_0x2aa4('0x15')]);module[_0x2aa4('0x16')]=router; \ No newline at end of file +var _0x3f69=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./mailTransferReport.controller','get'];(function(_0x4a9324,_0xf840ed){var _0x2c45f5=function(_0xfbf347){while(--_0xfbf347){_0x4a9324['push'](_0x4a9324['shift']());}};_0x2c45f5(++_0xf840ed);}(_0x3f69,0x161));var _0x93f6=function(_0x286b50,_0x26fefc){_0x286b50=_0x286b50-0x0;var _0x23a90d=_0x3f69[_0x286b50];return _0x23a90d;};'use strict';var multer=require(_0x93f6('0x0'));var util=require('util');var path=require(_0x93f6('0x1'));var timeout=require(_0x93f6('0x2'));var express=require('express');var router=express[_0x93f6('0x3')]();var fs_extra=require(_0x93f6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x93f6('0x5'));var controller=require(_0x93f6('0x6'));router[_0x93f6('0x7')]('/',auth[_0x93f6('0x8')](),controller[_0x93f6('0x9')]);router[_0x93f6('0x7')](_0x93f6('0xa'),auth[_0x93f6('0x8')](),controller[_0x93f6('0xb')]);router[_0x93f6('0x7')]('/:id',auth[_0x93f6('0x8')](),controller[_0x93f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x93f6('0xd')]);router[_0x93f6('0xe')](_0x93f6('0xf'),auth['isAuthenticated'](),controller[_0x93f6('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x93f6('0x11')]);module[_0x93f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 15479e5..5904829 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x546125,_0xfa3bf){var _0x77b546=function(_0x475555){while(--_0x475555){_0x546125['push'](_0x546125['shift']());}};_0x77b546(++_0xfa3bf);}(_0x54ef,0x112));var _0xf54e=function(_0x20fbea,_0x560c0c){_0x20fbea=_0x20fbea-0x0;var _0x4e9b9d=_0x54ef[_0x20fbea];return _0x4e9b9d;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x431d4d,_0x216f4b){var _0x21a1b4=function(_0x56c2ac){while(--_0x56c2ac){_0x431d4d['push'](_0x431d4d['shift']());}};_0x21a1b4(++_0x216f4b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 47fa4b6..09a0b10 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 _0xebf9=['json','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','MailTransferReport','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range'];(function(_0x249363,_0x2d028c){var _0x37502c=function(_0x24d031){while(--_0x24d031){_0x249363['push'](_0x249363['shift']());}};_0x37502c(++_0x2d028c);}(_0xebf9,0x75));var _0x9ebf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xebf9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9ebf('0x0'));var rimraf=require(_0x9ebf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ebf('0x2'));var rp=require(_0x9ebf('0x3'));var moment=require('moment');var BPromise=require(_0x9ebf('0x4'));var Mustache=require(_0x9ebf('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9ebf('0x6'));var csv=require(_0x9ebf('0x7'));var ejs=require(_0x9ebf('0x8'));var fs=require('fs');var fs_extra=require(_0x9ebf('0x9'));var _=require(_0x9ebf('0xa'));var squel=require('squel');var crypto=require(_0x9ebf('0xb'));var jsforce=require(_0x9ebf('0xc'));var deskjs=require(_0x9ebf('0xd'));var toCsv=require(_0x9ebf('0x7'));var querystring=require(_0x9ebf('0xe'));var Papa=require('papaparse');var Redis=require(_0x9ebf('0xf'));var authService=require(_0x9ebf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9ebf('0x11'));var hardwareService=require(_0x9ebf('0x12'));var logger=require(_0x9ebf('0x13'))(_0x9ebf('0x14'));var utils=require(_0x9ebf('0x15'));var config=require(_0x9ebf('0x16'));var licenseUtil=require(_0x9ebf('0x17'));var db=require(_0x9ebf('0x18'))['db'];function respondWithStatusCode(_0x1aef64,_0x3a7f2d){_0x3a7f2d=_0x3a7f2d||0xcc;return function(_0x471ea0){if(_0x471ea0){return _0x1aef64[_0x9ebf('0x19')](_0x3a7f2d);}return _0x1aef64[_0x9ebf('0x1a')](_0x3a7f2d)['end']();};}function respondWithResult(_0x36d665,_0x128158){_0x128158=_0x128158||0xc8;return function(_0x2c5224){if(_0x2c5224){return _0x36d665['status'](_0x128158)['json'](_0x2c5224);}};}function respondWithFilteredResult(_0x598138,_0x235d3a){return function(_0x4a84a8){if(_0x4a84a8){var _0x39c740=typeof _0x235d3a[_0x9ebf('0x1b')]===_0x9ebf('0x1c')&&typeof _0x235d3a['limit']===_0x9ebf('0x1c');var _0xaea407=_0x4a84a8[_0x9ebf('0x1d')];var _0x358e1b=_0x39c740?0x0:_0x235d3a[_0x9ebf('0x1b')];var _0x801a14=_0x39c740?_0x4a84a8['count']:_0x235d3a['offset']+_0x235d3a[_0x9ebf('0x1e')];var _0x464b4e;if(_0x801a14>=_0xaea407){_0x801a14=_0xaea407;_0x464b4e=0xc8;}else{_0x464b4e=0xce;}_0x598138[_0x9ebf('0x1a')](_0x464b4e);return _0x598138[_0x9ebf('0x1f')](_0x9ebf('0x20'),_0x358e1b+'-'+_0x801a14+'/'+_0xaea407)[_0x9ebf('0x21')](_0x4a84a8);}return null;};}function patchUpdates(_0x120177){return function(_0x3db351){try{jsonpatch[_0x9ebf('0x22')](_0x3db351,_0x120177,!![]);}catch(_0x5dac44){return BPromise[_0x9ebf('0x23')](_0x5dac44);}return _0x3db351[_0x9ebf('0x24')]();};}function saveUpdates(_0x5a785c,_0x15991f){return function(_0x595e49){if(_0x595e49){return _0x595e49[_0x9ebf('0x25')](_0x5a785c)['then'](function(_0x3460a3){return _0x3460a3;});}return null;};}function removeEntity(_0x493451,_0xc50793){return function(_0x55ecc1){if(_0x55ecc1){return _0x55ecc1['destroy']()[_0x9ebf('0x26')](function(){_0x493451['status'](0xcc)[_0x9ebf('0x27')]();});}};}function handleEntityNotFound(_0x5ed6bb,_0x21a450){return function(_0x741567){if(!_0x741567){_0x5ed6bb[_0x9ebf('0x19')](0x194);}return _0x741567;};}function handleError(_0x327ce1,_0x4d9af8){_0x4d9af8=_0x4d9af8||0x1f4;return function(_0x2a7e58){logger[_0x9ebf('0x28')](_0x2a7e58[_0x9ebf('0x29')]);if(_0x2a7e58[_0x9ebf('0x2a')]){delete _0x2a7e58['name'];}_0x327ce1[_0x9ebf('0x1a')](_0x4d9af8)[_0x9ebf('0x2b')](_0x2a7e58);};}exports[_0x9ebf('0x2c')]=function(_0x1b9323,_0x5669a0){var _0x1c3f5b={},_0x3071e7={},_0x3616b5={'count':0x0,'rows':[]};var _0x251fbe=_[_0x9ebf('0x2d')](db['MailTransferReport'][_0x9ebf('0x2e')],function(_0x507e59){return{'name':_0x507e59[_0x9ebf('0x2f')],'type':_0x507e59[_0x9ebf('0x30')][_0x9ebf('0x31')]};});_0x3071e7[_0x9ebf('0x32')]=_[_0x9ebf('0x2d')](_0x251fbe,_0x9ebf('0x2a'));_0x3071e7['query']=_[_0x9ebf('0x33')](_0x1b9323[_0x9ebf('0x34')]);_0x3071e7[_0x9ebf('0x35')]=_['intersection'](_0x3071e7[_0x9ebf('0x32')],_0x3071e7[_0x9ebf('0x34')]);_0x1c3f5b['attributes']=_[_0x9ebf('0x36')](_0x3071e7[_0x9ebf('0x32')],qs['fields'](_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x37')]));_0x1c3f5b[_0x9ebf('0x38')]=_0x1c3f5b['attributes'][_0x9ebf('0x39')]?_0x1c3f5b['attributes']:_0x3071e7[_0x9ebf('0x32')];if(!_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x3a')](_0x9ebf('0x3b'))){_0x1c3f5b[_0x9ebf('0x1e')]=qs[_0x9ebf('0x1e')](_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x1e')]);_0x1c3f5b[_0x9ebf('0x1b')]=qs[_0x9ebf('0x1b')](_0x1b9323[_0x9ebf('0x34')]['offset']);}_0x1c3f5b['order']=qs[_0x9ebf('0x3c')](_0x1b9323[_0x9ebf('0x34')]['sort']);_0x1c3f5b[_0x9ebf('0x3d')]=qs[_0x9ebf('0x35')](_['pick'](_0x1b9323[_0x9ebf('0x34')],_0x3071e7[_0x9ebf('0x35')]),_0x251fbe);if(_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x3e')]){_0x1c3f5b['where']=_[_0x9ebf('0x3f')](_0x1c3f5b[_0x9ebf('0x3d')],{'$or':_[_0x9ebf('0x2d')](_0x251fbe,function(_0x1fe45e){if(_0x1fe45e['type']!=='VIRTUAL'){var _0x7d5559={};_0x7d5559[_0x1fe45e[_0x9ebf('0x2a')]]={'$like':'%'+_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x3e')]+'%'};return _0x7d5559;}})});}_0x1c3f5b=_[_0x9ebf('0x3f')]({},_0x1c3f5b,_0x1b9323['options']);var _0xbddade={'where':_0x1c3f5b[_0x9ebf('0x3d')]};return db['MailTransferReport'][_0x9ebf('0x1d')](_0xbddade)[_0x9ebf('0x26')](function(_0x28b60e){_0x3616b5[_0x9ebf('0x1d')]=_0x28b60e;if(_0x1b9323[_0x9ebf('0x34')][_0x9ebf('0x40')]){_0x1c3f5b[_0x9ebf('0x41')]=[{'all':!![]}];}return db[_0x9ebf('0x42')]['findAll'](_0x1c3f5b);})[_0x9ebf('0x26')](function(_0x476651){_0x3616b5[_0x9ebf('0x43')]=_0x476651;return _0x3616b5;})['then'](respondWithFilteredResult(_0x5669a0,_0x1c3f5b))[_0x9ebf('0x44')](handleError(_0x5669a0,null));};exports[_0x9ebf('0x45')]=function(_0x37b94d,_0x31fa42){var _0x356fd4={'raw':!![],'where':{'id':_0x37b94d[_0x9ebf('0x46')]['id']}},_0xc1a0f9={};_0xc1a0f9['model']=_[_0x9ebf('0x33')](db['MailTransferReport'][_0x9ebf('0x2e')]);_0xc1a0f9[_0x9ebf('0x34')]=_[_0x9ebf('0x33')](_0x37b94d['query']);_0xc1a0f9[_0x9ebf('0x35')]=_[_0x9ebf('0x36')](_0xc1a0f9[_0x9ebf('0x32')],_0xc1a0f9[_0x9ebf('0x34')]);_0x356fd4[_0x9ebf('0x38')]=_[_0x9ebf('0x36')](_0xc1a0f9[_0x9ebf('0x32')],qs[_0x9ebf('0x37')](_0x37b94d['query'][_0x9ebf('0x37')]));_0x356fd4[_0x9ebf('0x38')]=_0x356fd4[_0x9ebf('0x38')]['length']?_0x356fd4[_0x9ebf('0x38')]:_0xc1a0f9['model'];if(_0x37b94d[_0x9ebf('0x34')][_0x9ebf('0x40')]){_0x356fd4[_0x9ebf('0x41')]=[{'all':!![]}];}_0x356fd4=_[_0x9ebf('0x3f')]({},_0x356fd4,_0x37b94d['options']);return db[_0x9ebf('0x42')][_0x9ebf('0x47')](_0x356fd4)[_0x9ebf('0x26')](handleEntityNotFound(_0x31fa42,null))[_0x9ebf('0x26')](respondWithResult(_0x31fa42,null))[_0x9ebf('0x44')](handleError(_0x31fa42,null));};exports[_0x9ebf('0x48')]=function(_0x157b7d,_0x47a9e7){return db[_0x9ebf('0x42')][_0x9ebf('0x48')](_0x157b7d[_0x9ebf('0x49')],{})['then'](respondWithResult(_0x47a9e7,0xc9))[_0x9ebf('0x44')](handleError(_0x47a9e7,null));};exports[_0x9ebf('0x25')]=function(_0x5cd4cf,_0x535b61){if(_0x5cd4cf[_0x9ebf('0x49')]['id']){delete _0x5cd4cf[_0x9ebf('0x49')]['id'];}return db['MailTransferReport'][_0x9ebf('0x47')]({'where':{'id':_0x5cd4cf[_0x9ebf('0x46')]['id']}})['then'](handleEntityNotFound(_0x535b61,null))[_0x9ebf('0x26')](saveUpdates(_0x5cd4cf['body'],null))[_0x9ebf('0x26')](respondWithResult(_0x535b61,null))['catch'](handleError(_0x535b61,null));};exports['destroy']=function(_0x5cd805,_0x406806){return db['MailTransferReport']['find']({'where':{'id':_0x5cd805[_0x9ebf('0x46')]['id']}})['then'](handleEntityNotFound(_0x406806,null))[_0x9ebf('0x26')](removeEntity(_0x406806,null))['catch'](handleError(_0x406806,null));};exports[_0x9ebf('0x4a')]=function(_0x33a2b1,_0x5c4dde){return db['MailTransferReport'][_0x9ebf('0x4a')]()[_0x9ebf('0x26')](respondWithResult(_0x5c4dde,null))[_0x9ebf('0x44')](handleError(_0x5c4dde,null));}; \ No newline at end of file +var _0x5ca7=['then','error','stack','name','index','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','MailTransferReport','includeAll','show','rawAttributes','options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','update','destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x5ca7,0x103));var _0x75ca=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x5ca7[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0x75ca('0x0'));var rimraf=require(_0x75ca('0x1'));var zipdir=require(_0x75ca('0x2'));var jsonpatch=require(_0x75ca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75ca('0x4'));var Mustache=require(_0x75ca('0x5'));var util=require('util');var path=require(_0x75ca('0x6'));var sox=require(_0x75ca('0x7'));var csv=require('to-csv');var ejs=require(_0x75ca('0x8'));var fs=require('fs');var fs_extra=require(_0x75ca('0x9'));var _=require(_0x75ca('0xa'));var squel=require(_0x75ca('0xb'));var crypto=require(_0x75ca('0xc'));var jsforce=require(_0x75ca('0xd'));var deskjs=require(_0x75ca('0xe'));var toCsv=require(_0x75ca('0xf'));var querystring=require(_0x75ca('0x10'));var Papa=require('papaparse');var Redis=require(_0x75ca('0x11'));var authService=require(_0x75ca('0x12'));var qs=require(_0x75ca('0x13'));var as=require(_0x75ca('0x14'));var hardwareService=require(_0x75ca('0x15'));var logger=require(_0x75ca('0x16'))(_0x75ca('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x75ca('0x18'))['db'];function respondWithStatusCode(_0x1160ab,_0x58fe77){_0x58fe77=_0x58fe77||0xcc;return function(_0x6bdd1f){if(_0x6bdd1f){return _0x1160ab[_0x75ca('0x19')](_0x58fe77);}return _0x1160ab[_0x75ca('0x1a')](_0x58fe77)[_0x75ca('0x1b')]();};}function respondWithResult(_0x476299,_0xbf0a22){_0xbf0a22=_0xbf0a22||0xc8;return function(_0x13f02a){if(_0x13f02a){return _0x476299[_0x75ca('0x1a')](_0xbf0a22)[_0x75ca('0x1c')](_0x13f02a);}};}function respondWithFilteredResult(_0x2dbd65,_0x31cde5){return function(_0x3d605f){if(_0x3d605f){var _0x13fb99=typeof _0x31cde5['offset']===_0x75ca('0x1d')&&typeof _0x31cde5['limit']==='undefined';var _0x4154cb=_0x3d605f[_0x75ca('0x1e')];var _0x4c9f5a=_0x13fb99?0x0:_0x31cde5[_0x75ca('0x1f')];var _0x357cc1=_0x13fb99?_0x3d605f[_0x75ca('0x1e')]:_0x31cde5[_0x75ca('0x1f')]+_0x31cde5[_0x75ca('0x20')];var _0x37cdab;if(_0x357cc1>=_0x4154cb){_0x357cc1=_0x4154cb;_0x37cdab=0xc8;}else{_0x37cdab=0xce;}_0x2dbd65[_0x75ca('0x1a')](_0x37cdab);return _0x2dbd65['set']('Content-Range',_0x4c9f5a+'-'+_0x357cc1+'/'+_0x4154cb)[_0x75ca('0x1c')](_0x3d605f);}return null;};}function patchUpdates(_0x4a9462){return function(_0x430be6){try{jsonpatch[_0x75ca('0x21')](_0x430be6,_0x4a9462,!![]);}catch(_0xfa2db6){return BPromise[_0x75ca('0x22')](_0xfa2db6);}return _0x430be6['save']();};}function saveUpdates(_0x206ca2,_0x2ebb6d){return function(_0x2815e0){if(_0x2815e0){return _0x2815e0[_0x75ca('0x23')](_0x206ca2)['then'](function(_0xcbed87){return _0xcbed87;});}return null;};}function removeEntity(_0x56f6a5,_0x41313c){return function(_0xcb520f){if(_0xcb520f){return _0xcb520f[_0x75ca('0x24')]()[_0x75ca('0x25')](function(){_0x56f6a5[_0x75ca('0x1a')](0xcc)[_0x75ca('0x1b')]();});}};}function handleEntityNotFound(_0x1cd998,_0x374b2d){return function(_0x1adba6){if(!_0x1adba6){_0x1cd998[_0x75ca('0x19')](0x194);}return _0x1adba6;};}function handleError(_0x119111,_0x16982b){_0x16982b=_0x16982b||0x1f4;return function(_0x59e2f9){logger[_0x75ca('0x26')](_0x59e2f9[_0x75ca('0x27')]);if(_0x59e2f9[_0x75ca('0x28')]){delete _0x59e2f9['name'];}_0x119111[_0x75ca('0x1a')](_0x16982b)['send'](_0x59e2f9);};}exports[_0x75ca('0x29')]=function(_0x15039a,_0x45f2f2){var _0x4b3299={},_0x52876e={},_0x4c912c={'count':0x0,'rows':[]};var _0x3bd581=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x3d579c){return{'name':_0x3d579c[_0x75ca('0x2a')],'type':_0x3d579c[_0x75ca('0x2b')][_0x75ca('0x2c')]};});_0x52876e['model']=_['map'](_0x3bd581,_0x75ca('0x28'));_0x52876e[_0x75ca('0x2d')]=_[_0x75ca('0x2e')](_0x15039a[_0x75ca('0x2d')]);_0x52876e['filters']=_[_0x75ca('0x2f')](_0x52876e[_0x75ca('0x30')],_0x52876e[_0x75ca('0x2d')]);_0x4b3299[_0x75ca('0x31')]=_[_0x75ca('0x2f')](_0x52876e[_0x75ca('0x30')],qs[_0x75ca('0x32')](_0x15039a[_0x75ca('0x2d')][_0x75ca('0x32')]));_0x4b3299[_0x75ca('0x31')]=_0x4b3299[_0x75ca('0x31')][_0x75ca('0x33')]?_0x4b3299[_0x75ca('0x31')]:_0x52876e[_0x75ca('0x30')];if(!_0x15039a[_0x75ca('0x2d')][_0x75ca('0x34')](_0x75ca('0x35'))){_0x4b3299[_0x75ca('0x20')]=qs['limit'](_0x15039a[_0x75ca('0x2d')][_0x75ca('0x20')]);_0x4b3299['offset']=qs[_0x75ca('0x1f')](_0x15039a['query'][_0x75ca('0x1f')]);}_0x4b3299[_0x75ca('0x36')]=qs[_0x75ca('0x37')](_0x15039a[_0x75ca('0x2d')]['sort']);_0x4b3299[_0x75ca('0x38')]=qs[_0x75ca('0x39')](_[_0x75ca('0x3a')](_0x15039a['query'],_0x52876e[_0x75ca('0x39')]),_0x3bd581);if(_0x15039a[_0x75ca('0x2d')]['filter']){_0x4b3299['where']=_['merge'](_0x4b3299[_0x75ca('0x38')],{'$or':_[_0x75ca('0x3b')](_0x3bd581,function(_0x277d54){if(_0x277d54['type']!==_0x75ca('0x3c')){var _0x53d463={};_0x53d463[_0x277d54[_0x75ca('0x28')]]={'$like':'%'+_0x15039a[_0x75ca('0x2d')][_0x75ca('0x3d')]+'%'};return _0x53d463;}})});}_0x4b3299=_[_0x75ca('0x3e')]({},_0x4b3299,_0x15039a['options']);var _0x1dc5ca={'where':_0x4b3299['where']};return db[_0x75ca('0x3f')]['count'](_0x1dc5ca)[_0x75ca('0x25')](function(_0x2912c5){_0x4c912c[_0x75ca('0x1e')]=_0x2912c5;if(_0x15039a[_0x75ca('0x2d')][_0x75ca('0x40')]){_0x4b3299['include']=[{'all':!![]}];}return db[_0x75ca('0x3f')]['findAll'](_0x4b3299);})['then'](function(_0x28fb89){_0x4c912c['rows']=_0x28fb89;return _0x4c912c;})[_0x75ca('0x25')](respondWithFilteredResult(_0x45f2f2,_0x4b3299))['catch'](handleError(_0x45f2f2,null));};exports[_0x75ca('0x41')]=function(_0x1b2ed1,_0x4e7c29){var _0x5669f9={'raw':!![],'where':{'id':_0x1b2ed1['params']['id']}},_0x461ded={};_0x461ded['model']=_[_0x75ca('0x2e')](db[_0x75ca('0x3f')][_0x75ca('0x42')]);_0x461ded[_0x75ca('0x2d')]=_['keys'](_0x1b2ed1['query']);_0x461ded[_0x75ca('0x39')]=_[_0x75ca('0x2f')](_0x461ded[_0x75ca('0x30')],_0x461ded['query']);_0x5669f9['attributes']=_['intersection'](_0x461ded[_0x75ca('0x30')],qs[_0x75ca('0x32')](_0x1b2ed1['query'][_0x75ca('0x32')]));_0x5669f9['attributes']=_0x5669f9[_0x75ca('0x31')][_0x75ca('0x33')]?_0x5669f9[_0x75ca('0x31')]:_0x461ded[_0x75ca('0x30')];if(_0x1b2ed1['query'][_0x75ca('0x40')]){_0x5669f9['include']=[{'all':!![]}];}_0x5669f9=_['merge']({},_0x5669f9,_0x1b2ed1[_0x75ca('0x43')]);return db[_0x75ca('0x3f')][_0x75ca('0x44')](_0x5669f9)['then'](handleEntityNotFound(_0x4e7c29,null))[_0x75ca('0x25')](respondWithResult(_0x4e7c29,null))[_0x75ca('0x45')](handleError(_0x4e7c29,null));};exports[_0x75ca('0x46')]=function(_0x4dd6d1,_0x15143e){return db['MailTransferReport']['create'](_0x4dd6d1['body'],{})[_0x75ca('0x25')](respondWithResult(_0x15143e,0xc9))[_0x75ca('0x45')](handleError(_0x15143e,null));};exports['update']=function(_0x1d085b,_0x3fdef4){if(_0x1d085b[_0x75ca('0x47')]['id']){delete _0x1d085b[_0x75ca('0x47')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x1d085b[_0x75ca('0x48')]['id']}})[_0x75ca('0x25')](handleEntityNotFound(_0x3fdef4,null))[_0x75ca('0x25')](saveUpdates(_0x1d085b[_0x75ca('0x47')],null))['then'](respondWithResult(_0x3fdef4,null))[_0x75ca('0x45')](handleError(_0x3fdef4,null));};exports['destroy']=function(_0x476f90,_0x1619aa){return db[_0x75ca('0x3f')][_0x75ca('0x44')]({'where':{'id':_0x476f90[_0x75ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1619aa,null))['then'](removeEntity(_0x1619aa,null))[_0x75ca('0x45')](handleError(_0x1619aa,null));};exports[_0x75ca('0x49')]=function(_0x5417b4,_0x24e764){return db[_0x75ca('0x3f')][_0x75ca('0x49')]()[_0x75ca('0x25')](respondWithResult(_0x24e764,null))[_0x75ca('0x45')](handleError(_0x24e764,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 68bf27a..dcbb0b4 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 _0x684d=['api','bluebird','path','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x684d,0x174));var _0xd684=function(_0x1dc4ea,_0x2f946d){_0x1dc4ea=_0x1dc4ea-0x0;var _0x4d8d81=_0x684d[_0x1dc4ea];return _0x4d8d81;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var logger=require(_0xd684('0x1'))(_0xd684('0x2'));var moment=require('moment');var BPromise=require(_0xd684('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd684('0x4'));var rimraf=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var attributes=require('./mailTransferReport.attributes');module[_0xd684('0x7')]=function(_0x5f50ac,_0x3bf907){return _0x5f50ac['define'](_0xd684('0x8'),attributes,{'tableName':_0xd684('0x9'),'paranoid':![],'indexes':[{'name':_0xd684('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x897d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x49a5f6,_0x2eea42){var _0x22fe92=function(_0x4ed337){while(--_0x4ed337){_0x49a5f6['push'](_0x49a5f6['shift']());}};_0x22fe92(++_0x2eea42);}(_0x897d,0x80));var _0xd897=function(_0x57687e,_0x2520d6){_0x57687e=_0x57687e-0x0;var _0x2f4497=_0x897d[_0x57687e];return _0x2f4497;};'use strict';var _=require(_0xd897('0x0'));var util=require(_0xd897('0x1'));var logger=require(_0xd897('0x2'))(_0xd897('0x3'));var moment=require(_0xd897('0x4'));var BPromise=require(_0xd897('0x5'));var rp=require(_0xd897('0x6'));var fs=require('fs');var path=require(_0xd897('0x7'));var rimraf=require(_0xd897('0x8'));var config=require(_0xd897('0x9'));var attributes=require(_0xd897('0xa'));module[_0xd897('0xb')]=function(_0x3e1cc5,_0x386bc2){return _0x3e1cc5[_0xd897('0xc')](_0xd897('0xd'),attributes,{'tableName':_0xd897('0xe'),'paranoid':![],'indexes':[{'name':_0xd897('0xf'),'fields':[_0xd897('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 129ed41..8dcc365 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 _0xc24f=['randomstring','../../config/utils','../../config/environment','jayson/promise','http','info','request\x20sent','debug','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x2d6fdb,_0x1c8f67){var _0x42a6e1=function(_0x5dc7b2){while(--_0x5dc7b2){_0x2d6fdb['push'](_0x2d6fdb['shift']());}};_0x42a6e1(++_0x1c8f67);}(_0xc24f,0x184));var _0xfc24=function(_0x15ab62,_0x3facd8){_0x15ab62=_0x15ab62-0x0;var _0x161be8=_0xc24f[_0x15ab62];return _0x161be8;};'use strict';var _=require(_0xfc24('0x0'));var util=require('util');var moment=require(_0xfc24('0x1'));var BPromise=require(_0xfc24('0x2'));var rs=require(_0xfc24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfc24('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc24('0x5'));var jayson=require(_0xfc24('0x6'));var client=jayson['client'][_0xfc24('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5460d8,_0x11dd13,_0x496e0e){return new BPromise(function(_0x51ed90,_0x22a7de){return client['request'](_0x5460d8,_0x496e0e)['then'](function(_0xbfdb14){logger[_0xfc24('0x8')]('MailTransferReport,\x20%s,\x20%s',_0x11dd13,_0xfc24('0x9'));logger[_0xfc24('0xa')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x11dd13,_0xfc24('0x9'),JSON['stringify'](_0xbfdb14));if(_0xbfdb14['error']){if(_0xbfdb14[_0xfc24('0xb')][_0xfc24('0xc')]===0x1f4){logger[_0xfc24('0xb')](_0xfc24('0xd'),_0x11dd13,_0xbfdb14[_0xfc24('0xb')][_0xfc24('0xe')]);return _0x22a7de(_0xbfdb14['error'][_0xfc24('0xe')]);}logger['error'](_0xfc24('0xd'),_0x11dd13,_0xbfdb14[_0xfc24('0xb')]['message']);return _0x51ed90(_0xbfdb14[_0xfc24('0xb')][_0xfc24('0xe')]);}else{logger['info'](_0xfc24('0xd'),_0x11dd13,_0xfc24('0x9'));_0x51ed90(_0xbfdb14[_0xfc24('0xf')][_0xfc24('0xe')]);}})[_0xfc24('0x10')](function(_0x249ef0){logger[_0xfc24('0xb')](_0xfc24('0xd'),_0x11dd13,_0x249ef0);_0x22a7de(_0x249ef0);});});} \ No newline at end of file +var _0x4260=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x4260,0xa2));var _0x0426=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x4260[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0426('0x0'));var util=require(_0x0426('0x1'));var moment=require(_0x0426('0x2'));var BPromise=require(_0x0426('0x3'));var rs=require(_0x0426('0x4'));var fs=require('fs');var Redis=require(_0x0426('0x5'));var db=require(_0x0426('0x6'))['db'];var utils=require(_0x0426('0x7'));var logger=require(_0x0426('0x8'))(_0x0426('0x9'));var config=require(_0x0426('0xa'));var jayson=require(_0x0426('0xb'));var client=jayson['client'][_0x0426('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d51e1,_0x48b14c,_0x50af26){return new BPromise(function(_0x576927,_0x5e74d8){return client[_0x0426('0xd')](_0x2d51e1,_0x50af26)[_0x0426('0xe')](function(_0x3a25bc){logger[_0x0426('0xf')](_0x0426('0x10'),_0x48b14c,_0x0426('0x11'));logger[_0x0426('0x12')](_0x0426('0x13'),_0x48b14c,_0x0426('0x11'),JSON[_0x0426('0x14')](_0x3a25bc));if(_0x3a25bc[_0x0426('0x15')]){if(_0x3a25bc[_0x0426('0x15')][_0x0426('0x16')]===0x1f4){logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x3a25bc[_0x0426('0x15')]['message']);return _0x5e74d8(_0x3a25bc['error'][_0x0426('0x17')]);}logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x3a25bc[_0x0426('0x15')][_0x0426('0x17')]);return _0x576927(_0x3a25bc[_0x0426('0x15')]['message']);}else{logger[_0x0426('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x48b14c,'request\x20sent');_0x576927(_0x3a25bc[_0x0426('0x18')][_0x0426('0x17')]);}})['catch'](function(_0x517315){logger[_0x0426('0x15')](_0x0426('0x10'),_0x48b14c,_0x517315);_0x5e74d8(_0x517315);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 71f9eca..aee726f 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 _0x641f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0xc1ede1,_0x27c567){var _0x36f293=function(_0x1fe28c){while(--_0x1fe28c){_0xc1ede1['push'](_0xc1ede1['shift']());}};_0x36f293(++_0x27c567);}(_0x641f,0xba));var _0xf641=function(_0x4b010a,_0x3f6824){_0x4b010a=_0x4b010a-0x0;var _0x5d5084=_0x641f[_0x4b010a];return _0x5d5084;};'use strict';var multer=require(_0xf641('0x0'));var util=require(_0xf641('0x1'));var path=require('path');var timeout=require(_0xf641('0x2'));var express=require(_0xf641('0x3'));var router=express[_0xf641('0x4')]();var fs_extra=require(_0xf641('0x5'));var auth=require(_0xf641('0x6'));var interaction=require(_0xf641('0x7'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xf641('0x8')]('/',auth[_0xf641('0x9')](),controller['index']);router[_0xf641('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf641('0xa')]);router[_0xf641('0x8')](_0xf641('0xb'),auth[_0xf641('0x9')](),controller[_0xf641('0xc')]);router[_0xf641('0xd')]('/',auth[_0xf641('0x9')](),controller['create']);router[_0xf641('0xe')](_0xf641('0xb'),auth[_0xf641('0x9')](),controller[_0xf641('0xf')]);router[_0xf641('0x10')](_0xf641('0xb'),auth['isAuthenticated'](),controller[_0xf641('0x11')]);module[_0xf641('0x12')]=router; \ No newline at end of file +var _0x4b66=['describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x40e87a,_0x430f27){var _0x217ab6=function(_0x5926a1){while(--_0x5926a1){_0x40e87a['push'](_0x40e87a['shift']());}};_0x217ab6(++_0x430f27);}(_0x4b66,0xb1));var _0x64b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4b66[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x64b6('0x0'));var util=require('util');var path=require(_0x64b6('0x1'));var timeout=require(_0x64b6('0x2'));var express=require(_0x64b6('0x3'));var router=express[_0x64b6('0x4')]();var fs_extra=require(_0x64b6('0x5'));var auth=require(_0x64b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x64b6('0x7'));var controller=require('./memberReport.controller');router[_0x64b6('0x8')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0xa')]);router[_0x64b6('0x8')](_0x64b6('0xb'),auth[_0x64b6('0x9')](),controller[_0x64b6('0xc')]);router['get'](_0x64b6('0xd'),auth['isAuthenticated'](),controller[_0x64b6('0xe')]);router[_0x64b6('0xf')]('/',auth[_0x64b6('0x9')](),controller[_0x64b6('0x10')]);router[_0x64b6('0x11')](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0x12')]);router[_0x64b6('0x13')](_0x64b6('0xd'),auth[_0x64b6('0x9')](),controller[_0x64b6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 2f7da80..6b0bc2e 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 _0x61de=['talk:[start]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','exitAt'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x61de,0xdf));var _0xe61d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x61de[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe61d('0x0'));module[_0xe61d('0x1')]={'channel':{'type':Sequelize[_0xe61d('0x2')]},'membername':{'type':Sequelize[_0xe61d('0x2')]},'interface':{'type':Sequelize[_0xe61d('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xe61d('0x3'),'comment':_0xe61d('0x4')},'duration':{'type':Sequelize[_0xe61d('0x5')]},'enterAt':{'type':Sequelize[_0xe61d('0x6')]},'exitAt':{'type':Sequelize[_0xe61d('0x6')],'set':function(_0x325862){var _0x56a923=moment(_0x325862);var _0x14fe40=moment(this['getDataValue'](_0xe61d('0x7')));var _0x246c5e=_0x56a923[_0xe61d('0x8')](_0x14fe40,_0xe61d('0x9'));this['setDataValue'](_0xe61d('0xa'),_0x325862);this['setDataValue']('duration',_0x246c5e>=0x0?_0x246c5e:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xe61d('0x2')],'comment':_0xe61d('0xb')},'data3':{'type':Sequelize[_0xe61d('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe61d('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xe61d('0x2')],'comment':_0xe61d('0xc')},'role':{'type':Sequelize[_0xe61d('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe61d('0x2')]}}; \ No newline at end of file +var _0x30bb=['enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x30bb,0xe7));var _0xb30b=function(_0xb2f9fc,_0x57920){_0xb2f9fc=_0xb2f9fc-0x0;var _0x371b0b=_0x30bb[_0xb2f9fc];return _0x371b0b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb30b('0x0'));module[_0xb30b('0x1')]={'channel':{'type':Sequelize[_0xb30b('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb30b('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xb30b('0x3'),'comment':_0xb30b('0x4')},'duration':{'type':Sequelize[_0xb30b('0x5')]},'enterAt':{'type':Sequelize[_0xb30b('0x6')]},'exitAt':{'type':Sequelize[_0xb30b('0x6')],'set':function(_0xc75c6c){var _0x2e6a31=moment(_0xc75c6c);var _0x37d650=moment(this['getDataValue'](_0xb30b('0x7')));var _0x36cf3a=_0x2e6a31[_0xb30b('0x8')](_0x37d650,_0xb30b('0x9'));this[_0xb30b('0xa')](_0xb30b('0xb'),_0xc75c6c);this[_0xb30b('0xa')](_0xb30b('0xc'),_0x36cf3a>=0x0?_0x36cf3a:null);}},'data1':{'type':Sequelize[_0xb30b('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xd')},'data3':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xe')},'data4':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0xf')},'data5':{'type':Sequelize[_0xb30b('0x2')],'comment':_0xb30b('0x10')},'role':{'type':Sequelize[_0xb30b('0x2')]},'internal':{'type':Sequelize[_0xb30b('0x5')]},'uniqueid':{'type':Sequelize[_0xb30b('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index db86168..981783c 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedd9,0xfc));var _0x9edd=function(_0x127e64,_0x45ce7a){_0x127e64=_0x127e64-0x0;var _0x43a2e8=_0xedd9[_0x127e64];return _0x43a2e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x37964c,_0x5367fe){var _0x44fc6a=function(_0x5a9f6b){while(--_0x5a9f6b){_0x37964c['push'](_0x37964c['shift']());}};_0x44fc6a(++_0x5367fe);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index eb49126..a113df5 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 _0x811b=['lodash','api','moment','path','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface'];(function(_0x35fade,_0x481e69){var _0x3d925f=function(_0x29fe57){while(--_0x29fe57){_0x35fade['push'](_0x35fade['shift']());}};_0x3d925f(++_0x481e69);}(_0x811b,0xb0));var _0xb811=function(_0xc2e46e,_0x3b979c){_0xc2e46e=_0xc2e46e-0x0;var _0x1a355d=_0x811b[_0xc2e46e];return _0x1a355d;};'use strict';var _=require(_0xb811('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb811('0x1'));var moment=require(_0xb811('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb811('0x3'));var rimraf=require('rimraf');var config=require(_0xb811('0x4'));var attributes=require(_0xb811('0x5'));module['exports']=function(_0x4ff0a6,_0x636de4){return _0x4ff0a6[_0xb811('0x6')](_0xb811('0x7'),attributes,{'tableName':_0xb811('0x8'),'paranoid':![],'indexes':[{'name':_0xb811('0x9'),'fields':['membername',_0xb811('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa62=['report_member','membername_interface','membername','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MemberReport'];(function(_0x5d60e5,_0xd497ca){var _0x23f7a9=function(_0x597ba4){while(--_0x597ba4){_0x5d60e5['push'](_0x5d60e5['shift']());}};_0x23f7a9(++_0xd497ca);}(_0xfa62,0x120));var _0x2fa6=function(_0xeec067,_0x52520f){_0xeec067=_0xeec067-0x0;var _0x1cc162=_0xfa62[_0xeec067];return _0x1cc162;};'use strict';var _=require(_0x2fa6('0x0'));var util=require(_0x2fa6('0x1'));var logger=require('../../config/logger')(_0x2fa6('0x2'));var moment=require(_0x2fa6('0x3'));var BPromise=require(_0x2fa6('0x4'));var rp=require(_0x2fa6('0x5'));var fs=require('fs');var path=require(_0x2fa6('0x6'));var rimraf=require(_0x2fa6('0x7'));var config=require(_0x2fa6('0x8'));var attributes=require('./memberReport.attributes');module[_0x2fa6('0x9')]=function(_0x32d21c,_0x33fcc2){return _0x32d21c[_0x2fa6('0xa')](_0x2fa6('0xb'),attributes,{'tableName':_0x2fa6('0xc'),'paranoid':![],'indexes':[{'name':_0x2fa6('0xd'),'fields':[_0x2fa6('0xe'),'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 0c04933..2b25158 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 _0x26d1=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','MemberReport,\x20%s,\x20%s','message','GetMemberReport','options','raw','attributes','limit','include','map','model','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','where','lodash','moment'];(function(_0x32e115,_0x4066d4){var _0x9eae14=function(_0xd4ee2e){while(--_0xd4ee2e){_0x32e115['push'](_0x32e115['shift']());}};_0x9eae14(++_0x4066d4);}(_0x26d1,0x8e));var _0x126d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x26d1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var moment=require(_0x126d('0x1'));var BPromise=require(_0x126d('0x2'));var rs=require(_0x126d('0x3'));var fs=require('fs');var Redis=require(_0x126d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x126d('0x5'))('rpc');var config=require(_0x126d('0x6'));var jayson=require(_0x126d('0x7'));var client=jayson[_0x126d('0x8')][_0x126d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4dfc,_0x4e5e87,_0x2e668c){return new BPromise(function(_0x25ccc2,_0x7d6e4c){return client[_0x126d('0xa')](_0x2b4dfc,_0x2e668c)[_0x126d('0xb')](function(_0x1cf6fb){logger[_0x126d('0xc')]('MemberReport,\x20%s,\x20%s',_0x4e5e87,_0x126d('0xd'));logger[_0x126d('0xe')](_0x126d('0xf'),_0x4e5e87,_0x126d('0xd'),JSON[_0x126d('0x10')](_0x1cf6fb));if(_0x1cf6fb['error']){if(_0x1cf6fb[_0x126d('0x11')]['code']===0x1f4){logger[_0x126d('0x11')](_0x126d('0x12'),_0x4e5e87,_0x1cf6fb[_0x126d('0x11')]['message']);return _0x7d6e4c(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}logger[_0x126d('0x11')]('MemberReport,\x20%s,\x20%s',_0x4e5e87,_0x1cf6fb['error'][_0x126d('0x13')]);return _0x25ccc2(_0x1cf6fb[_0x126d('0x11')][_0x126d('0x13')]);}else{logger[_0x126d('0xc')](_0x126d('0x12'),_0x4e5e87,_0x126d('0xd'));_0x25ccc2(_0x1cf6fb['result'][_0x126d('0x13')]);}})['catch'](function(_0x352d72){logger['error'](_0x126d('0x12'),_0x4e5e87,_0x352d72);_0x7d6e4c(_0x352d72);});});}exports[_0x126d('0x14')]=function(_0x55aa9d){var _0x263ac3=this;return new Promise(function(_0x52d014,_0x100c4d){return db['MemberReport']['findAll']({'raw':_0x55aa9d['options']?_0x55aa9d[_0x126d('0x15')][_0x126d('0x16')]===undefined?!![]:![]:!![],'where':_0x55aa9d[_0x126d('0x15')]?_0x55aa9d[_0x126d('0x15')]['where']||null:null,'attributes':_0x55aa9d[_0x126d('0x15')]?_0x55aa9d[_0x126d('0x15')][_0x126d('0x17')]||null:null,'limit':_0x55aa9d['options']?_0x55aa9d['options'][_0x126d('0x18')]||null:null,'include':_0x55aa9d[_0x126d('0x15')]?_0x55aa9d['options'][_0x126d('0x19')]?_[_0x126d('0x1a')](_0x55aa9d[_0x126d('0x15')][_0x126d('0x19')],function(_0x4fd847){return{'model':db[_0x4fd847[_0x126d('0x1b')]],'as':_0x4fd847['as'],'attributes':_0x4fd847[_0x126d('0x17')],'include':_0x4fd847[_0x126d('0x19')]?_[_0x126d('0x1a')](_0x4fd847[_0x126d('0x19')],function(_0x2b1734){return{'model':db[_0x2b1734['model']],'as':_0x2b1734['as'],'attributes':_0x2b1734['attributes'],'include':_0x2b1734[_0x126d('0x19')]?_['map'](_0x2b1734['include'],function(_0x269588){return{'model':db[_0x269588[_0x126d('0x1b')]],'as':_0x269588['as'],'attributes':_0x269588[_0x126d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x126d('0xb')](function(_0xaf0d5a){logger[_0x126d('0xc')](_0x126d('0x14'),_0x55aa9d);logger[_0x126d('0xe')](_0x126d('0x14'),_0x55aa9d,JSON[_0x126d('0x10')](_0xaf0d5a));_0x52d014(_0xaf0d5a);})[_0x126d('0x1c')](function(_0x12e553){logger['error'](_0x126d('0x14'),_0x12e553[_0x126d('0x13')],_0x55aa9d);_0x100c4d(_0x263ac3[_0x126d('0x11')](0x1f4,_0x12e553[_0x126d('0x13')]));});});};exports[_0x126d('0x1d')]=function(_0x34dca2){var _0x1f760f=this;return new Promise(function(_0x38048f,_0x5c88a0){return db[_0x126d('0x1e')][_0x126d('0x1f')](_0x34dca2[_0x126d('0x20')],{'raw':_0x34dca2[_0x126d('0x15')]?_0x34dca2[_0x126d('0x15')][_0x126d('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x37b9ec){logger[_0x126d('0xc')](_0x126d('0x1d'),_0x34dca2);logger[_0x126d('0xe')](_0x126d('0x1d'),_0x34dca2,JSON['stringify'](_0x37b9ec));_0x38048f(_0x37b9ec);})[_0x126d('0x1c')](function(_0xed9030){logger['error'](_0x126d('0x1d'),_0xed9030[_0x126d('0x13')],_0x34dca2);_0x5c88a0(_0x1f760f[_0x126d('0x11')](0x1f4,_0xed9030[_0x126d('0x13')]));});});};exports[_0x126d('0x21')]=function(_0x112c0a){var _0x2cf5e9=this;return new Promise(function(_0x4f32ac,_0x4e19ee){return db[_0x126d('0x1e')][_0x126d('0x22')](_0x112c0a[_0x126d('0x20')],{'raw':_0x112c0a[_0x126d('0x15')]?_0x112c0a['options'][_0x126d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112c0a[_0x126d('0x15')]?_0x112c0a[_0x126d('0x15')][_0x126d('0x23')]||null:null,'attributes':_0x112c0a[_0x126d('0x15')]?_0x112c0a[_0x126d('0x15')]['attributes']||null:null,'limit':_0x112c0a[_0x126d('0x15')]?_0x112c0a[_0x126d('0x15')][_0x126d('0x18')]||null:null})[_0x126d('0xb')](function(_0x1c2bd3){logger[_0x126d('0xc')]('UpdateMemberReport',_0x112c0a);logger[_0x126d('0xe')](_0x126d('0x21'),_0x112c0a,JSON[_0x126d('0x10')](_0x1c2bd3));_0x4f32ac(_0x1c2bd3);})[_0x126d('0x1c')](function(_0x2b7f16){logger['error'](_0x126d('0x21'),_0x2b7f16[_0x126d('0x13')],_0x112c0a);_0x4e19ee(_0x2cf5e9['error'](0x1f4,_0x2b7f16[_0x126d('0x13')]));});});}; \ No newline at end of file +var _0x66c7=['then','create','body','CreateMemberReport','UpdateMemberReport','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model'];(function(_0x2c1980,_0x9da7c3){var _0x3bf0bb=function(_0x43dba7){while(--_0x43dba7){_0x2c1980['push'](_0x2c1980['shift']());}};_0x3bf0bb(++_0x9da7c3);}(_0x66c7,0x15c));var _0x766c=function(_0x365c7f,_0xa99915){_0x365c7f=_0x365c7f-0x0;var _0x4a697e=_0x66c7[_0x365c7f];return _0x4a697e;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rs=require(_0x766c('0x3'));var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require(_0x766c('0x5'))['db'];var utils=require(_0x766c('0x6'));var logger=require(_0x766c('0x7'))(_0x766c('0x8'));var config=require('../../config/environment');var jayson=require(_0x766c('0x9'));var client=jayson[_0x766c('0xa')][_0x766c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0b5f7,_0x46d290,_0x3c4683){return new BPromise(function(_0x22a524,_0x4488b8){return client['request'](_0xb0b5f7,_0x3c4683)['then'](function(_0x141744){logger[_0x766c('0xc')](_0x766c('0xd'),_0x46d290,'request\x20sent');logger[_0x766c('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x46d290,_0x766c('0xf'),JSON[_0x766c('0x10')](_0x141744));if(_0x141744[_0x766c('0x11')]){if(_0x141744[_0x766c('0x11')][_0x766c('0x12')]===0x1f4){logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x4488b8(_0x141744[_0x766c('0x11')][_0x766c('0x13')]);}logger[_0x766c('0x11')](_0x766c('0xd'),_0x46d290,_0x141744[_0x766c('0x11')][_0x766c('0x13')]);return _0x22a524(_0x141744['error']['message']);}else{logger['info'](_0x766c('0xd'),_0x46d290,_0x766c('0xf'));_0x22a524(_0x141744[_0x766c('0x14')][_0x766c('0x13')]);}})[_0x766c('0x15')](function(_0x357602){logger['error']('MemberReport,\x20%s,\x20%s',_0x46d290,_0x357602);_0x4488b8(_0x357602);});});}exports[_0x766c('0x16')]=function(_0x23c566){var _0x105f60=this;return new Promise(function(_0x47c887,_0x2cd2e7){return db[_0x766c('0x17')][_0x766c('0x18')]({'raw':_0x23c566['options']?_0x23c566['options']['raw']===undefined?!![]:![]:!![],'where':_0x23c566[_0x766c('0x19')]?_0x23c566['options'][_0x766c('0x1a')]||null:null,'attributes':_0x23c566[_0x766c('0x19')]?_0x23c566['options']['attributes']||null:null,'limit':_0x23c566[_0x766c('0x19')]?_0x23c566[_0x766c('0x19')][_0x766c('0x1b')]||null:null,'include':_0x23c566['options']?_0x23c566[_0x766c('0x19')][_0x766c('0x1c')]?_['map'](_0x23c566['options']['include'],function(_0x43d91f){return{'model':db[_0x43d91f['model']],'as':_0x43d91f['as'],'attributes':_0x43d91f[_0x766c('0x1d')],'include':_0x43d91f[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x43d91f['include'],function(_0x44659e){return{'model':db[_0x44659e[_0x766c('0x1f')]],'as':_0x44659e['as'],'attributes':_0x44659e[_0x766c('0x1d')],'include':_0x44659e[_0x766c('0x1c')]?_[_0x766c('0x1e')](_0x44659e[_0x766c('0x1c')],function(_0x5ad1d6){return{'model':db[_0x5ad1d6[_0x766c('0x1f')]],'as':_0x5ad1d6['as'],'attributes':_0x5ad1d6[_0x766c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x766c('0x20')](function(_0x3a6757){logger[_0x766c('0xc')]('GetMemberReport',_0x23c566);logger['debug'](_0x766c('0x16'),_0x23c566,JSON[_0x766c('0x10')](_0x3a6757));_0x47c887(_0x3a6757);})[_0x766c('0x15')](function(_0x549dde){logger[_0x766c('0x11')](_0x766c('0x16'),_0x549dde['message'],_0x23c566);_0x2cd2e7(_0x105f60[_0x766c('0x11')](0x1f4,_0x549dde['message']));});});};exports['CreateMemberReport']=function(_0x3a4561){var _0x10421d=this;return new Promise(function(_0x1eac49,_0x5b94cf){return db[_0x766c('0x17')][_0x766c('0x21')](_0x3a4561[_0x766c('0x22')],{'raw':_0x3a4561[_0x766c('0x19')]?_0x3a4561[_0x766c('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4659cc){logger[_0x766c('0xc')](_0x766c('0x23'),_0x3a4561);logger[_0x766c('0xe')](_0x766c('0x23'),_0x3a4561,JSON['stringify'](_0x4659cc));_0x1eac49(_0x4659cc);})[_0x766c('0x15')](function(_0x40c43a){logger[_0x766c('0x11')]('CreateMemberReport',_0x40c43a[_0x766c('0x13')],_0x3a4561);_0x5b94cf(_0x10421d['error'](0x1f4,_0x40c43a['message']));});});};exports[_0x766c('0x24')]=function(_0x4e5eec){var _0x26bd0b=this;return new Promise(function(_0x182a81,_0x2f96e3){return db[_0x766c('0x17')]['update'](_0x4e5eec['body'],{'raw':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1a')]||null:null,'attributes':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1d')]||null:null,'limit':_0x4e5eec[_0x766c('0x19')]?_0x4e5eec[_0x766c('0x19')][_0x766c('0x1b')]||null:null})[_0x766c('0x20')](function(_0x4b2b06){logger[_0x766c('0xc')]('UpdateMemberReport',_0x4e5eec);logger[_0x766c('0xe')]('UpdateMemberReport',_0x4e5eec,JSON[_0x766c('0x10')](_0x4b2b06));_0x182a81(_0x4b2b06);})[_0x766c('0x15')](function(_0x4832da){logger[_0x766c('0x11')](_0x766c('0x24'),_0x4832da['message'],_0x4e5eec);_0x2f96e3(_0x26bd0b[_0x766c('0x11')](0x1f4,_0x4832da['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index cdcf7fd..61982d9 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 _0x077e=['../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x32c20a,_0x4e6a4b){var _0x1fcc55=function(_0x4ac557){while(--_0x4ac557){_0x32c20a['push'](_0x32c20a['shift']());}};_0x1fcc55(++_0x4e6a4b);}(_0x077e,0x14a));var _0xe077=function(_0x3df30a,_0x469c8a){_0x3df30a=_0x3df30a-0x0;var _0x1ad138=_0x077e[_0x3df30a];return _0x1ad138;};'use strict';var multer=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var path=require(_0xe077('0x2'));var timeout=require(_0xe077('0x3'));var express=require('express');var router=express[_0xe077('0x4')]();var fs_extra=require(_0xe077('0x5'));var auth=require(_0xe077('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe077('0x7'));var controller=require(_0xe077('0x8'));router[_0xe077('0x9')]('/',controller[_0xe077('0xa')]);module[_0xe077('0xb')]=router; \ No newline at end of file +var _0x855d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','exports'];(function(_0x2a8f60,_0x130679){var _0x383a17=function(_0x16437a){while(--_0x16437a){_0x2a8f60['push'](_0x2a8f60['shift']());}};_0x383a17(++_0x130679);}(_0x855d,0x64));var _0xd855=function(_0x73640f,_0x1ed619){_0x73640f=_0x73640f-0x0;var _0x22feea=_0x855d[_0x73640f];return _0x22feea;};'use strict';var multer=require(_0xd855('0x0'));var util=require(_0xd855('0x1'));var path=require(_0xd855('0x2'));var timeout=require(_0xd855('0x3'));var express=require(_0xd855('0x4'));var router=express[_0xd855('0x5')]();var fs_extra=require(_0xd855('0x6'));var auth=require(_0xd855('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd855('0x8'));var controller=require('./migration.controller');router['get']('/',controller['index']);module[_0xd855('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 3741d56..03d92d8 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 _0x8e2f=['STRING','version','sequelize','exports'];(function(_0x3f046a,_0x2015d0){var _0x1f0e0b=function(_0x168552){while(--_0x168552){_0x3f046a['push'](_0x3f046a['shift']());}};_0x1f0e0b(++_0x2015d0);}(_0x8e2f,0xfa));var _0xf8e2=function(_0x22f306,_0x2caec5){_0x22f306=_0x22f306-0x0;var _0xb246a1=_0x8e2f[_0x22f306];return _0xb246a1;};'use strict';var Sequelize=require(_0xf8e2('0x0'));module[_0xf8e2('0x1')]={'version':{'type':Sequelize[_0xf8e2('0x2')],'unique':_0xf8e2('0x3')}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize['STRING'],'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 78e619a..7b3bb85 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 _0xbaa6=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','stack','name','map','Migration','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','then','includeAll','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0xbaa6,0xef));var _0x6baa=function(_0x1ff804,_0x263135){_0x1ff804=_0x1ff804-0x0;var _0x3454b8=_0xbaa6[_0x1ff804];return _0x3454b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6baa('0x0'));var zipdir=require(_0x6baa('0x1'));var jsonpatch=require(_0x6baa('0x2'));var rp=require(_0x6baa('0x3'));var moment=require(_0x6baa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6baa('0x5'));var util=require(_0x6baa('0x6'));var path=require(_0x6baa('0x7'));var sox=require(_0x6baa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6baa('0x9'));var _=require(_0x6baa('0xa'));var squel=require(_0x6baa('0xb'));var crypto=require(_0x6baa('0xc'));var jsforce=require(_0x6baa('0xd'));var deskjs=require(_0x6baa('0xe'));var toCsv=require(_0x6baa('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6baa('0x10'));var authService=require(_0x6baa('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6baa('0x12'));var hardwareService=require(_0x6baa('0x13'));var logger=require('../../config/logger')(_0x6baa('0x14'));var utils=require('../../config/utils');var config=require(_0x6baa('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33ef1b,_0x2a240c){_0x2a240c=_0x2a240c||0xcc;return function(_0x229f2b){if(_0x229f2b){return _0x33ef1b[_0x6baa('0x16')](_0x2a240c);}return _0x33ef1b[_0x6baa('0x17')](_0x2a240c)[_0x6baa('0x18')]();};}function respondWithResult(_0x42d7cf,_0x40bd31){_0x40bd31=_0x40bd31||0xc8;return function(_0x328826){if(_0x328826){return _0x42d7cf[_0x6baa('0x17')](_0x40bd31)['json'](_0x328826);}};}function respondWithFilteredResult(_0x1461c0,_0x27fd81){return function(_0x5d34d7){if(_0x5d34d7){var _0x55afac=typeof _0x27fd81['offset']===_0x6baa('0x19')&&typeof _0x27fd81['limit']===_0x6baa('0x19');var _0x42df1c=_0x5d34d7[_0x6baa('0x1a')];var _0x4426b9=_0x55afac?0x0:_0x27fd81[_0x6baa('0x1b')];var _0xc24014=_0x55afac?_0x5d34d7[_0x6baa('0x1a')]:_0x27fd81[_0x6baa('0x1b')]+_0x27fd81[_0x6baa('0x1c')];var _0x23faf1;if(_0xc24014>=_0x42df1c){_0xc24014=_0x42df1c;_0x23faf1=0xc8;}else{_0x23faf1=0xce;}_0x1461c0['status'](_0x23faf1);return _0x1461c0['set'](_0x6baa('0x1d'),_0x4426b9+'-'+_0xc24014+'/'+_0x42df1c)[_0x6baa('0x1e')](_0x5d34d7);}return null;};}function patchUpdates(_0x14e691){return function(_0x5ae49e){try{jsonpatch[_0x6baa('0x1f')](_0x5ae49e,_0x14e691,!![]);}catch(_0x5936f1){return BPromise[_0x6baa('0x20')](_0x5936f1);}return _0x5ae49e[_0x6baa('0x21')]();};}function saveUpdates(_0x1f4d3e,_0x11101f){return function(_0x40fab4){if(_0x40fab4){return _0x40fab4['update'](_0x1f4d3e)['then'](function(_0x24dfe4){return _0x24dfe4;});}return null;};}function removeEntity(_0x7630c6,_0x3c0edc){return function(_0x6b51a2){if(_0x6b51a2){return _0x6b51a2['destroy']()['then'](function(){_0x7630c6[_0x6baa('0x17')](0xcc)[_0x6baa('0x18')]();});}};}function handleEntityNotFound(_0x2cfbef,_0x859a79){return function(_0x41ebfb){if(!_0x41ebfb){_0x2cfbef[_0x6baa('0x16')](0x194);}return _0x41ebfb;};}function handleError(_0x48d872,_0x4ab28f){_0x4ab28f=_0x4ab28f||0x1f4;return function(_0x3065f9){logger['error'](_0x3065f9[_0x6baa('0x22')]);if(_0x3065f9[_0x6baa('0x23')]){delete _0x3065f9[_0x6baa('0x23')];}_0x48d872[_0x6baa('0x17')](_0x4ab28f)['send'](_0x3065f9);};}exports['index']=function(_0x23c463,_0x400362){var _0x291ae8={},_0x206004={},_0x264056={'count':0x0,'rows':[]};var _0x523cbe=_[_0x6baa('0x24')](db[_0x6baa('0x25')]['rawAttributes'],function(_0x50f809){return{'name':_0x50f809[_0x6baa('0x26')],'type':_0x50f809[_0x6baa('0x27')][_0x6baa('0x28')]};});_0x206004['model']=_[_0x6baa('0x24')](_0x523cbe,_0x6baa('0x23'));_0x206004[_0x6baa('0x29')]=_[_0x6baa('0x2a')](_0x23c463[_0x6baa('0x29')]);_0x206004['filters']=_['intersection'](_0x206004[_0x6baa('0x2b')],_0x206004[_0x6baa('0x29')]);_0x291ae8[_0x6baa('0x2c')]=_[_0x6baa('0x2d')](_0x206004[_0x6baa('0x2b')],qs['fields'](_0x23c463[_0x6baa('0x29')][_0x6baa('0x2e')]));_0x291ae8['attributes']=_0x291ae8[_0x6baa('0x2c')][_0x6baa('0x2f')]?_0x291ae8[_0x6baa('0x2c')]:_0x206004[_0x6baa('0x2b')];if(!_0x23c463['query'][_0x6baa('0x30')]('nolimit')){_0x291ae8[_0x6baa('0x1c')]=qs['limit'](_0x23c463[_0x6baa('0x29')][_0x6baa('0x1c')]);_0x291ae8[_0x6baa('0x1b')]=qs['offset'](_0x23c463[_0x6baa('0x29')][_0x6baa('0x1b')]);}_0x291ae8[_0x6baa('0x31')]=qs[_0x6baa('0x32')](_0x23c463[_0x6baa('0x29')][_0x6baa('0x32')]);_0x291ae8[_0x6baa('0x33')]=qs[_0x6baa('0x34')](_[_0x6baa('0x35')](_0x23c463[_0x6baa('0x29')],_0x206004['filters']),_0x523cbe);if(_0x23c463[_0x6baa('0x29')]['filter']){_0x291ae8['where']=_[_0x6baa('0x36')](_0x291ae8['where'],{'$or':_[_0x6baa('0x24')](_0x523cbe,function(_0x249433){if(_0x249433['type']!==_0x6baa('0x37')){var _0x113334={};_0x113334[_0x249433[_0x6baa('0x23')]]={'$like':'%'+_0x23c463[_0x6baa('0x29')]['filter']+'%'};return _0x113334;}})});}_0x291ae8=_[_0x6baa('0x36')]({},_0x291ae8,_0x23c463[_0x6baa('0x38')]);var _0x449f12={'where':_0x291ae8[_0x6baa('0x33')]};return db[_0x6baa('0x25')]['count'](_0x449f12)[_0x6baa('0x39')](function(_0x320164){_0x264056[_0x6baa('0x1a')]=_0x320164;if(_0x23c463[_0x6baa('0x29')][_0x6baa('0x3a')]){_0x291ae8[_0x6baa('0x3b')]=[{'all':!![]}];}return db[_0x6baa('0x25')]['findAll'](_0x291ae8);})[_0x6baa('0x39')](function(_0x2ecae2){_0x264056[_0x6baa('0x3c')]=_0x2ecae2;return _0x264056;})[_0x6baa('0x39')](respondWithFilteredResult(_0x400362,_0x291ae8))[_0x6baa('0x3d')](handleError(_0x400362,null));}; \ No newline at end of file +var _0xdbdc=['fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Migration','fieldName','key','query','keys','filters','intersection','attributes','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x166e1d,_0x43130b){var _0x4efcf2=function(_0x374bd5){while(--_0x374bd5){_0x166e1d['push'](_0x166e1d['shift']());}};_0x4efcf2(++_0x43130b);}(_0xdbdc,0xfb));var _0xcdbd=function(_0x32721f,_0x48b061){_0x32721f=_0x32721f-0x0;var _0x328750=_0xdbdc[_0x32721f];return _0x328750;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdbd('0x0'));var zipdir=require(_0xcdbd('0x1'));var jsonpatch=require(_0xcdbd('0x2'));var rp=require(_0xcdbd('0x3'));var moment=require(_0xcdbd('0x4'));var BPromise=require(_0xcdbd('0x5'));var Mustache=require(_0xcdbd('0x6'));var util=require(_0xcdbd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xcdbd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdbd('0x9'));var _=require(_0xcdbd('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcdbd('0xb'));var deskjs=require(_0xcdbd('0xc'));var toCsv=require(_0xcdbd('0x8'));var querystring=require(_0xcdbd('0xd'));var Papa=require(_0xcdbd('0xe'));var Redis=require('ioredis');var authService=require(_0xcdbd('0xf'));var qs=require(_0xcdbd('0x10'));var as=require(_0xcdbd('0x11'));var hardwareService=require(_0xcdbd('0x12'));var logger=require(_0xcdbd('0x13'))('api');var utils=require(_0xcdbd('0x14'));var config=require(_0xcdbd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdbd('0x16'))['db'];function respondWithStatusCode(_0x4d20fb,_0x2cc616){_0x2cc616=_0x2cc616||0xcc;return function(_0x3cba8e){if(_0x3cba8e){return _0x4d20fb[_0xcdbd('0x17')](_0x2cc616);}return _0x4d20fb[_0xcdbd('0x18')](_0x2cc616)[_0xcdbd('0x19')]();};}function respondWithResult(_0x3ff830,_0x24e0ea){_0x24e0ea=_0x24e0ea||0xc8;return function(_0x14ad7d){if(_0x14ad7d){return _0x3ff830[_0xcdbd('0x18')](_0x24e0ea)[_0xcdbd('0x1a')](_0x14ad7d);}};}function respondWithFilteredResult(_0x21f472,_0x26bc0b){return function(_0x3f3258){if(_0x3f3258){var _0x4fe5c4=typeof _0x26bc0b['offset']===_0xcdbd('0x1b')&&typeof _0x26bc0b[_0xcdbd('0x1c')]===_0xcdbd('0x1b');var _0x52d3a2=_0x3f3258[_0xcdbd('0x1d')];var _0x2f9fda=_0x4fe5c4?0x0:_0x26bc0b[_0xcdbd('0x1e')];var _0x1c9d6c=_0x4fe5c4?_0x3f3258['count']:_0x26bc0b[_0xcdbd('0x1e')]+_0x26bc0b[_0xcdbd('0x1c')];var _0x3f7ae1;if(_0x1c9d6c>=_0x52d3a2){_0x1c9d6c=_0x52d3a2;_0x3f7ae1=0xc8;}else{_0x3f7ae1=0xce;}_0x21f472[_0xcdbd('0x18')](_0x3f7ae1);return _0x21f472['set'](_0xcdbd('0x1f'),_0x2f9fda+'-'+_0x1c9d6c+'/'+_0x52d3a2)[_0xcdbd('0x1a')](_0x3f3258);}return null;};}function patchUpdates(_0x4ff100){return function(_0x199d93){try{jsonpatch[_0xcdbd('0x20')](_0x199d93,_0x4ff100,!![]);}catch(_0x43e754){return BPromise[_0xcdbd('0x21')](_0x43e754);}return _0x199d93[_0xcdbd('0x22')]();};}function saveUpdates(_0x3bea4b,_0xfc86ca){return function(_0x16234b){if(_0x16234b){return _0x16234b[_0xcdbd('0x23')](_0x3bea4b)[_0xcdbd('0x24')](function(_0x20a84e){return _0x20a84e;});}return null;};}function removeEntity(_0x4fe57d,_0x946476){return function(_0x5b9f43){if(_0x5b9f43){return _0x5b9f43[_0xcdbd('0x25')]()[_0xcdbd('0x24')](function(){_0x4fe57d[_0xcdbd('0x18')](0xcc)[_0xcdbd('0x19')]();});}};}function handleEntityNotFound(_0x2e95c5,_0x48dda3){return function(_0x1ec07c){if(!_0x1ec07c){_0x2e95c5[_0xcdbd('0x17')](0x194);}return _0x1ec07c;};}function handleError(_0x491cb6,_0x2395f8){_0x2395f8=_0x2395f8||0x1f4;return function(_0x57767f){logger[_0xcdbd('0x26')](_0x57767f[_0xcdbd('0x27')]);if(_0x57767f[_0xcdbd('0x28')]){delete _0x57767f[_0xcdbd('0x28')];}_0x491cb6[_0xcdbd('0x18')](_0x2395f8)[_0xcdbd('0x29')](_0x57767f);};}exports['index']=function(_0x26685b,_0x32237a){var _0x3242a5={},_0xc04e2={},_0x44b179={'count':0x0,'rows':[]};var _0x31c418=_['map'](db[_0xcdbd('0x2a')]['rawAttributes'],function(_0x493e01){return{'name':_0x493e01[_0xcdbd('0x2b')],'type':_0x493e01['type'][_0xcdbd('0x2c')]};});_0xc04e2['model']=_['map'](_0x31c418,_0xcdbd('0x28'));_0xc04e2[_0xcdbd('0x2d')]=_[_0xcdbd('0x2e')](_0x26685b[_0xcdbd('0x2d')]);_0xc04e2[_0xcdbd('0x2f')]=_[_0xcdbd('0x30')](_0xc04e2['model'],_0xc04e2['query']);_0x3242a5[_0xcdbd('0x31')]=_['intersection'](_0xc04e2['model'],qs['fields'](_0x26685b['query']['fields']));_0x3242a5[_0xcdbd('0x31')]=_0x3242a5[_0xcdbd('0x31')][_0xcdbd('0x32')]?_0x3242a5['attributes']:_0xc04e2[_0xcdbd('0x33')];if(!_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x34')]('nolimit')){_0x3242a5[_0xcdbd('0x1c')]=qs[_0xcdbd('0x1c')](_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x1c')]);_0x3242a5[_0xcdbd('0x1e')]=qs['offset'](_0x26685b['query'][_0xcdbd('0x1e')]);}_0x3242a5[_0xcdbd('0x35')]=qs[_0xcdbd('0x36')](_0x26685b['query']['sort']);_0x3242a5[_0xcdbd('0x37')]=qs['filters'](_[_0xcdbd('0x38')](_0x26685b[_0xcdbd('0x2d')],_0xc04e2[_0xcdbd('0x2f')]),_0x31c418);if(_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x39')]){_0x3242a5[_0xcdbd('0x37')]=_[_0xcdbd('0x3a')](_0x3242a5['where'],{'$or':_[_0xcdbd('0x3b')](_0x31c418,function(_0x2b8ed3){if(_0x2b8ed3['type']!==_0xcdbd('0x3c')){var _0x28b425={};_0x28b425[_0x2b8ed3['name']]={'$like':'%'+_0x26685b[_0xcdbd('0x2d')][_0xcdbd('0x39')]+'%'};return _0x28b425;}})});}_0x3242a5=_[_0xcdbd('0x3a')]({},_0x3242a5,_0x26685b[_0xcdbd('0x3d')]);var _0x289091={'where':_0x3242a5['where']};return db[_0xcdbd('0x2a')]['count'](_0x289091)[_0xcdbd('0x24')](function(_0xcebdf){_0x44b179[_0xcdbd('0x1d')]=_0xcebdf;if(_0x26685b[_0xcdbd('0x2d')]['includeAll']){_0x3242a5[_0xcdbd('0x3e')]=[{'all':!![]}];}return db[_0xcdbd('0x2a')]['findAll'](_0x3242a5);})[_0xcdbd('0x24')](function(_0x1b8bc8){_0x44b179[_0xcdbd('0x3f')]=_0x1b8bc8;return _0x44b179;})[_0xcdbd('0x24')](respondWithFilteredResult(_0x32237a,_0x3242a5))[_0xcdbd('0x40')](handleError(_0x32237a,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e0e1166..c54e426 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 _0x6891=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x38c838,_0x5c7f39){var _0x3accb0=function(_0x295955){while(--_0x295955){_0x38c838['push'](_0x38c838['shift']());}};_0x3accb0(++_0x5c7f39);}(_0x6891,0x138));var _0x1689=function(_0x204047,_0x2df7af){_0x204047=_0x204047-0x0;var _0x5956d2=_0x6891[_0x204047];return _0x5956d2;};'use strict';var _=require(_0x1689('0x0'));var util=require(_0x1689('0x1'));var logger=require(_0x1689('0x2'))(_0x1689('0x3'));var moment=require(_0x1689('0x4'));var BPromise=require(_0x1689('0x5'));var rp=require(_0x1689('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1689('0x7'));var config=require(_0x1689('0x8'));var attributes=require(_0x1689('0x9'));module[_0x1689('0xa')]=function(_0x354f65,_0x1ebdfb){return _0x354f65['define'](_0x1689('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x452c=['migrations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x464665,_0x4330d5){var _0x2c2e07=function(_0xd9b40f){while(--_0xd9b40f){_0x464665['push'](_0x464665['shift']());}};_0x2c2e07(++_0x4330d5);}(_0x452c,0x1d7));var _0xc452=function(_0x2a45a1,_0x25b9f5){_0x2a45a1=_0x2a45a1-0x0;var _0x2c1643=_0x452c[_0x2a45a1];return _0x2c1643;};'use strict';var _=require(_0xc452('0x0'));var util=require('util');var logger=require(_0xc452('0x1'))(_0xc452('0x2'));var moment=require(_0xc452('0x3'));var BPromise=require(_0xc452('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc452('0x5'));var config=require(_0xc452('0x6'));var attributes=require(_0xc452('0x7'));module[_0xc452('0x8')]=function(_0x40b11c,_0x310d4b){return _0x40b11c['define']('Migration',attributes,{'tableName':_0xc452('0x9'),'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 0e70ff0..51cf7f6 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 _0x9086=['debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0xedf780,_0x131582){var _0x15503e=function(_0x51339e){while(--_0x51339e){_0xedf780['push'](_0xedf780['shift']());}};_0x15503e(++_0x131582);}(_0x9086,0x10b));var _0x6908=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x9086[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var moment=require('moment');var BPromise=require(_0x6908('0x2'));var rs=require(_0x6908('0x3'));var fs=require('fs');var Redis=require(_0x6908('0x4'));var db=require(_0x6908('0x5'))['db'];var utils=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('rpc');var config=require(_0x6908('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff0,_0xd81571,_0x2049a1){return new BPromise(function(_0x2ce577,_0x56df93){return client[_0x6908('0xa')](_0x4e8ff0,_0x2049a1)['then'](function(_0x1efa71){logger['info'](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));logger[_0x6908('0xd')](_0x6908('0xe'),_0xd81571,_0x6908('0xc'),JSON['stringify'](_0x1efa71));if(_0x1efa71[_0x6908('0xf')]){if(_0x1efa71[_0x6908('0xf')][_0x6908('0x10')]===0x1f4){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);return _0x56df93(_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);}logger['error'](_0x6908('0xb'),_0xd81571,_0x1efa71['error'][_0x6908('0x11')]);return _0x2ce577(_0x1efa71[_0x6908('0xf')]['message']);}else{logger[_0x6908('0x12')](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));_0x2ce577(_0x1efa71[_0x6908('0x13')][_0x6908('0x11')]);}})['catch'](function(_0x538ad1){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x538ad1);_0x56df93(_0x538ad1);});});} \ No newline at end of file +var _0x2285=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4a9771,_0x52429b){var _0x52e0ed=function(_0x5485c0){while(--_0x5485c0){_0x4a9771['push'](_0x4a9771['shift']());}};_0x52e0ed(++_0x52429b);}(_0x2285,0x177));var _0x5228=function(_0x156fd2,_0x41694a){_0x156fd2=_0x156fd2-0x0;var _0x471889=_0x2285[_0x156fd2];return _0x471889;};'use strict';var _=require('lodash');var util=require(_0x5228('0x0'));var moment=require(_0x5228('0x1'));var BPromise=require(_0x5228('0x2'));var rs=require(_0x5228('0x3'));var fs=require('fs');var Redis=require(_0x5228('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5228('0x5'));var logger=require(_0x5228('0x6'))('rpc');var config=require(_0x5228('0x7'));var jayson=require(_0x5228('0x8'));var client=jayson[_0x5228('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b2db,_0x156977,_0x192393){return new BPromise(function(_0x322b86,_0x81c9c6){return client[_0x5228('0xa')](_0x18b2db,_0x192393)[_0x5228('0xb')](function(_0xbd1b8d){logger[_0x5228('0xc')](_0x5228('0xd'),_0x156977,'request\x20sent');logger[_0x5228('0xe')](_0x5228('0xf'),_0x156977,_0x5228('0x10'),JSON[_0x5228('0x11')](_0xbd1b8d));if(_0xbd1b8d['error']){if(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x13')]===0x1f4){logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d['error'][_0x5228('0x14')]);return _0x81c9c6(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}logger[_0x5228('0x12')](_0x5228('0xd'),_0x156977,_0xbd1b8d[_0x5228('0x12')]['message']);return _0x322b86(_0xbd1b8d[_0x5228('0x12')][_0x5228('0x14')]);}else{logger['info'](_0x5228('0xd'),_0x156977,_0x5228('0x10'));_0x322b86(_0xbd1b8d['result'][_0x5228('0x14')]);}})[_0x5228('0x15')](function(_0x1c4121){logger[_0x5228('0x12')]('Migration,\x20%s,\x20%s',_0x156977,_0x1c4121);_0x81c9c6(_0x1c4121);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 684f700..86e8af6 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 _0xd781=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./network.controller','index','get','/:id','isAuthenticated','show'];(function(_0x4bff82,_0xd0c27c){var _0x51d695=function(_0x371e87){while(--_0x371e87){_0x4bff82['push'](_0x4bff82['shift']());}};_0x51d695(++_0xd0c27c);}(_0xd781,0x1bb));var _0x1d78=function(_0x2c8a9a,_0x3ba988){_0x2c8a9a=_0x2c8a9a-0x0;var _0x1aff3a=_0xd781[_0x2c8a9a];return _0x1aff3a;};'use strict';var multer=require(_0x1d78('0x0'));var util=require(_0x1d78('0x1'));var path=require(_0x1d78('0x2'));var timeout=require(_0x1d78('0x3'));var express=require('express');var router=express[_0x1d78('0x4')]();var fs_extra=require(_0x1d78('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1d78('0x6'));var controller=require(_0x1d78('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d78('0x8')]);router[_0x1d78('0x9')](_0x1d78('0xa'),auth[_0x1d78('0xb')](),controller[_0x1d78('0xc')]);router[_0x1d78('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d78('0xe')](_0x1d78('0xa'),auth[_0x1d78('0xb')](),controller[_0x1d78('0xf')]);router[_0x1d78('0x10')](_0x1d78('0xa'),auth[_0x1d78('0xb')](),controller[_0x1d78('0x11')]);module[_0x1d78('0x12')]=router; \ No newline at end of file +var _0xa428=['/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','index'];(function(_0x5cb9c9,_0x273265){var _0x53d63b=function(_0x333212){while(--_0x333212){_0x5cb9c9['push'](_0x5cb9c9['shift']());}};_0x53d63b(++_0x273265);}(_0xa428,0xd8));var _0x8a42=function(_0x3509b8,_0x38f51c){_0x3509b8=_0x3509b8-0x0;var _0x24239c=_0xa428[_0x3509b8];return _0x24239c;};'use strict';var multer=require(_0x8a42('0x0'));var util=require('util');var path=require(_0x8a42('0x1'));var timeout=require(_0x8a42('0x2'));var express=require(_0x8a42('0x3'));var router=express[_0x8a42('0x4')]();var fs_extra=require(_0x8a42('0x5'));var auth=require(_0x8a42('0x6'));var interaction=require(_0x8a42('0x7'));var config=require('../../config/environment');var controller=require(_0x8a42('0x8'));router[_0x8a42('0x9')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xb')]);router['get'](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['show']);router[_0x8a42('0xd')]('/',auth[_0x8a42('0xa')](),controller[_0x8a42('0xe')]);router[_0x8a42('0xf')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller[_0x8a42('0x10')]);router[_0x8a42('0x11')](_0x8a42('0xc'),auth[_0x8a42('0xa')](),controller['destroy']);module[_0x8a42('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d3723c0..a1968dc 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 _0x222e=['STRING','sequelize','exports','ENUM','stun','turn'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x222e,0x103));var _0xe222=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x222e[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xe222('0x0'));module[_0xe222('0x1')]={'type':{'type':Sequelize[_0xe222('0x2')]('localnet','externip',_0xe222('0x3'),_0xe222('0x4'))},'value':{'type':Sequelize[_0xe222('0x5')]},'username':{'type':Sequelize[_0xe222('0x5')]},'password':{'type':Sequelize[_0xe222('0x5')]}}; \ No newline at end of file +var _0x2fef=['externip','turn','STRING','sequelize','ENUM'];(function(_0x341d8d,_0x5622ed){var _0x11b9cd=function(_0x458ca3){while(--_0x458ca3){_0x341d8d['push'](_0x341d8d['shift']());}};_0x11b9cd(++_0x5622ed);}(_0x2fef,0x94));var _0xf2fe=function(_0x47bcee,_0x5c0311){_0x47bcee=_0x47bcee-0x0;var _0x4b88a8=_0x2fef[_0x47bcee];return _0x4b88a8;};'use strict';var Sequelize=require(_0xf2fe('0x0'));module['exports']={'type':{'type':Sequelize[_0xf2fe('0x1')]('localnet',_0xf2fe('0x2'),'stun',_0xf2fe('0x3'))},'value':{'type':Sequelize[_0xf2fe('0x4')]},'username':{'type':Sequelize[_0xf2fe('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 89cea1d..85bac32 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 _0x5539=['map','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','nolimit','sort','where','filter','type','VIRTUAL','merge','options','Network','include','rows','catch','show','length','create','sequelize','body','findAll','toUpperCase','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','writeFileSync','Reload','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','params','STUN','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','format','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','name','index'];(function(_0x5eaf6f,_0x436307){var _0xe040c1=function(_0xe909f1){while(--_0xe909f1){_0x5eaf6f['push'](_0x5eaf6f['shift']());}};_0xe040c1(++_0x436307);}(_0x5539,0x9c));var _0x9553=function(_0xe6f241,_0x1b250f){_0xe6f241=_0xe6f241-0x0;var _0x502653=_0x5539[_0xe6f241];return _0x502653;};'use strict';var emlformat=require(_0x9553('0x0'));var rimraf=require(_0x9553('0x1'));var zipdir=require(_0x9553('0x2'));var jsonpatch=require(_0x9553('0x3'));var rp=require('request-promise');var moment=require(_0x9553('0x4'));var BPromise=require(_0x9553('0x5'));var Mustache=require(_0x9553('0x6'));var util=require(_0x9553('0x7'));var path=require(_0x9553('0x8'));var sox=require(_0x9553('0x9'));var csv=require(_0x9553('0xa'));var ejs=require(_0x9553('0xb'));var fs=require('fs');var fs_extra=require(_0x9553('0xc'));var _=require(_0x9553('0xd'));var squel=require(_0x9553('0xe'));var crypto=require(_0x9553('0xf'));var jsforce=require(_0x9553('0x10'));var deskjs=require(_0x9553('0x11'));var toCsv=require(_0x9553('0xa'));var querystring=require(_0x9553('0x12'));var Papa=require(_0x9553('0x13'));var Redis=require('ioredis');var authService=require(_0x9553('0x14'));var qs=require(_0x9553('0x15'));var as=require(_0x9553('0x16'));var hardwareService=require(_0x9553('0x17'));var logger=require(_0x9553('0x18'))(_0x9553('0x19'));var utils=require('../../config/utils');var config=require(_0x9553('0x1a'));var licenseUtil=require(_0x9553('0x1b'));var db=require(_0x9553('0x1c'))['db'];var jayson=require(_0x9553('0x1d'));var client=jayson[_0x9553('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392c50,_0x140071,_0x2a3eeb,_0x3ac2c2){return new BPromise(function(_0x220b82,_0x204ea2){var _0x159f6c=_0x3ac2c2||client;return _0x159f6c[_0x9553('0x1f')](_0x392c50,_0x2a3eeb)[_0x9553('0x20')](function(_0x16df43){logger[_0x9553('0x21')](_0x9553('0x22'),_0x140071,_0x9553('0x23'));logger[_0x9553('0x24')](_0x9553('0x25'),_0x140071,_0x9553('0x23'),JSON['stringify'](_0x16df43));if(_0x16df43['error']){if(_0x16df43[_0x9553('0x26')][_0x9553('0x27')]===0x1f4){logger[_0x9553('0x26')](_0x9553('0x22'),_0x140071,_0x16df43['error'][_0x9553('0x28')]);return _0x204ea2(_0x16df43[_0x9553('0x26')]['message']);}logger[_0x9553('0x26')](_0x9553('0x22'),_0x140071,_0x16df43[_0x9553('0x26')]['message']);return _0x220b82(_0x16df43[_0x9553('0x26')][_0x9553('0x28')]);}else{logger[_0x9553('0x21')]('Network,\x20%s,\x20%s',_0x140071,_0x9553('0x23'));_0x220b82(_0x16df43[_0x9553('0x29')][_0x9553('0x28')]);}})['catch'](function(_0x5def0c){logger['error'](_0x9553('0x22'),_0x140071,_0x5def0c);_0x204ea2(_0x5def0c);});});}function respondWithStatusCode(_0x244895,_0x121543){_0x121543=_0x121543||0xcc;return function(_0x3c2159){if(_0x3c2159){return _0x244895[_0x9553('0x2a')](_0x121543);}return _0x244895[_0x9553('0x2b')](_0x121543)[_0x9553('0x2c')]();};}function respondWithResult(_0x531815,_0x354768){_0x354768=_0x354768||0xc8;return function(_0x244f49){if(_0x244f49){return _0x531815[_0x9553('0x2b')](_0x354768)[_0x9553('0x2d')](_0x244f49);}};}function respondWithFilteredResult(_0x4ce996,_0x4181d0){return function(_0x4cc9d0){if(_0x4cc9d0){var _0x42112f=typeof _0x4181d0[_0x9553('0x2e')]===_0x9553('0x2f')&&typeof _0x4181d0[_0x9553('0x30')]===_0x9553('0x2f');var _0x285654=_0x4cc9d0[_0x9553('0x31')];var _0x13f827=_0x42112f?0x0:_0x4181d0[_0x9553('0x2e')];var _0x339233=_0x42112f?_0x4cc9d0[_0x9553('0x31')]:_0x4181d0[_0x9553('0x2e')]+_0x4181d0['limit'];var _0x1c67d8;if(_0x339233>=_0x285654){_0x339233=_0x285654;_0x1c67d8=0xc8;}else{_0x1c67d8=0xce;}_0x4ce996[_0x9553('0x2b')](_0x1c67d8);return _0x4ce996[_0x9553('0x32')]('Content-Range',_0x13f827+'-'+_0x339233+'/'+_0x285654)[_0x9553('0x2d')](_0x4cc9d0);}return null;};}function patchUpdates(_0x3997ff){return function(_0x4268c5){try{jsonpatch[_0x9553('0x33')](_0x4268c5,_0x3997ff,!![]);}catch(_0xe32d6){return BPromise['reject'](_0xe32d6);}return _0x4268c5['save']();};}function saveUpdates(_0x34e731,_0x54de17){return function(_0x2da194){if(_0x2da194){return _0x2da194['update'](_0x34e731)[_0x9553('0x20')](function(_0x24823d){return _0x24823d;});}return null;};}function removeEntity(_0x23a81c,_0x39b194){return function(_0x3926d2){if(_0x3926d2){return _0x3926d2['destroy']()[_0x9553('0x20')](function(){_0x23a81c[_0x9553('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d03e6,_0x2cc93c){return function(_0x4b4c82){if(!_0x4b4c82){_0x3d03e6[_0x9553('0x2a')](0x194);}return _0x4b4c82;};}function handleError(_0x90e255,_0x4904f6){_0x4904f6=_0x4904f6||0x1f4;return function(_0x334f42){logger[_0x9553('0x26')](_0x334f42['stack']);if(_0x334f42[_0x9553('0x34')]){delete _0x334f42[_0x9553('0x34')];}_0x90e255[_0x9553('0x2b')](_0x4904f6)['send'](_0x334f42);};}exports[_0x9553('0x35')]=function(_0x1f1b6b,_0x211cb8){var _0x385e1c={},_0x2841a5={},_0x2368b0={'count':0x0,'rows':[]};var _0x25f86f=_[_0x9553('0x36')](db['Network'][_0x9553('0x37')],function(_0x1bc258){return{'name':_0x1bc258[_0x9553('0x38')],'type':_0x1bc258['type']['key']};});_0x2841a5[_0x9553('0x39')]=_[_0x9553('0x36')](_0x25f86f,_0x9553('0x34'));_0x2841a5['query']=_[_0x9553('0x3a')](_0x1f1b6b['query']);_0x2841a5[_0x9553('0x3b')]=_['intersection'](_0x2841a5['model'],_0x2841a5[_0x9553('0x3c')]);_0x385e1c[_0x9553('0x3d')]=_[_0x9553('0x3e')](_0x2841a5[_0x9553('0x39')],qs[_0x9553('0x3f')](_0x1f1b6b[_0x9553('0x3c')][_0x9553('0x3f')]));_0x385e1c['attributes']=_0x385e1c['attributes']['length']?_0x385e1c['attributes']:_0x2841a5[_0x9553('0x39')];if(!_0x1f1b6b[_0x9553('0x3c')]['hasOwnProperty'](_0x9553('0x40'))){_0x385e1c[_0x9553('0x30')]=qs[_0x9553('0x30')](_0x1f1b6b['query'][_0x9553('0x30')]);_0x385e1c[_0x9553('0x2e')]=qs['offset'](_0x1f1b6b[_0x9553('0x3c')][_0x9553('0x2e')]);}_0x385e1c['order']=qs[_0x9553('0x41')](_0x1f1b6b['query']['sort']);_0x385e1c[_0x9553('0x42')]=qs[_0x9553('0x3b')](_['pick'](_0x1f1b6b[_0x9553('0x3c')],_0x2841a5['filters']),_0x25f86f);if(_0x1f1b6b[_0x9553('0x3c')][_0x9553('0x43')]){_0x385e1c[_0x9553('0x42')]=_['merge'](_0x385e1c['where'],{'$or':_['map'](_0x25f86f,function(_0x5385b7){if(_0x5385b7[_0x9553('0x44')]!==_0x9553('0x45')){var _0x59443c={};_0x59443c[_0x5385b7[_0x9553('0x34')]]={'$like':'%'+_0x1f1b6b[_0x9553('0x3c')][_0x9553('0x43')]+'%'};return _0x59443c;}})});}_0x385e1c=_[_0x9553('0x46')]({},_0x385e1c,_0x1f1b6b[_0x9553('0x47')]);var _0x303f0e={'where':_0x385e1c['where']};return db[_0x9553('0x48')][_0x9553('0x31')](_0x303f0e)['then'](function(_0x2fbcb7){_0x2368b0['count']=_0x2fbcb7;if(_0x1f1b6b[_0x9553('0x3c')]['includeAll']){_0x385e1c[_0x9553('0x49')]=[{'all':!![]}];}return db['Network']['findAll'](_0x385e1c);})['then'](function(_0x5d6741){_0x2368b0[_0x9553('0x4a')]=_0x5d6741;return _0x2368b0;})[_0x9553('0x20')](respondWithFilteredResult(_0x211cb8,_0x385e1c))[_0x9553('0x4b')](handleError(_0x211cb8,null));};exports[_0x9553('0x4c')]=function(_0x1d2803,_0x220dab){var _0x2fd6b7={'raw':!![],'where':{'id':_0x1d2803['params']['id']}},_0x1c688e={};_0x1c688e[_0x9553('0x39')]=_[_0x9553('0x3a')](db[_0x9553('0x48')][_0x9553('0x37')]);_0x1c688e[_0x9553('0x3c')]=_[_0x9553('0x3a')](_0x1d2803[_0x9553('0x3c')]);_0x1c688e[_0x9553('0x3b')]=_[_0x9553('0x3e')](_0x1c688e['model'],_0x1c688e['query']);_0x2fd6b7['attributes']=_[_0x9553('0x3e')](_0x1c688e[_0x9553('0x39')],qs[_0x9553('0x3f')](_0x1d2803['query'][_0x9553('0x3f')]));_0x2fd6b7['attributes']=_0x2fd6b7[_0x9553('0x3d')][_0x9553('0x4d')]?_0x2fd6b7['attributes']:_0x1c688e[_0x9553('0x39')];if(_0x1d2803['query']['includeAll']){_0x2fd6b7[_0x9553('0x49')]=[{'all':!![]}];}_0x2fd6b7=_[_0x9553('0x46')]({},_0x2fd6b7,_0x1d2803[_0x9553('0x47')]);return db[_0x9553('0x48')]['find'](_0x2fd6b7)['then'](handleEntityNotFound(_0x220dab,null))[_0x9553('0x20')](respondWithResult(_0x220dab,null))['catch'](handleError(_0x220dab,null));};exports[_0x9553('0x4e')]=function(_0x166a9e,_0x5b429a,_0xcc916d){var _0x47fd7b;return db[_0x9553('0x4f')]['transaction'](function(_0x7db8a){return db['Network'][_0x9553('0x4e')](_0x166a9e[_0x9553('0x50')],{'raw':!![]})[_0x9553('0x20')](function(_0x1fc618){_0x47fd7b=_0x1fc618;return db[_0x9553('0x48')][_0x9553('0x51')]({'where':{'type':_0x166a9e[_0x9553('0x50')][_0x9553('0x44')]},'raw':!![]});})[_0x9553('0x20')](function(_0x49f039){if(_0x47fd7b[_0x9553('0x44')][_0x9553('0x52')]()=='STUN'){var _0x3e6360=fs['readFileSync'](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x55')),_0x9553('0x56'));var _0x3ce5ed=ejs['render'](_0x3e6360,{'networks':_0x49f039||[]});fs['writeFileSync'](_0x9553('0x57'),_0x3ce5ed);return respondWithRpcPromise('Reload',_0x9553('0x4e'),{'module':'res_stun_monitor.so'});}else if(_0x47fd7b['type'][_0x9553('0x52')]()==_0x9553('0x58')){var _0x580b23=fs[_0x9553('0x59')](path['join'](config[_0x9553('0x54')],_0x9553('0x5a')),_0x9553('0x56'));var _0x2326bc=ejs[_0x9553('0x5b')](_0x580b23,{'networks':_0x49f039||[]});fs[_0x9553('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x2326bc);return respondWithRpcPromise(_0x9553('0x5d'),'create',{'module':'res_stun_monitor.so'});}else{var _0x32e8c7=fs[_0x9553('0x59')](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x5e')),_0x9553('0x56'));var _0x392dd5=ejs[_0x9553('0x5b')](_0x32e8c7,{'networks':_0x49f039||[]});fs[_0x9553('0x5c')](util['format'](_0x9553('0x5f'),_0x166a9e[_0x9553('0x50')][_0x9553('0x44')][_0x9553('0x60')]()),_0x392dd5);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}return null;})[_0x9553('0x20')](function(){return _0x47fd7b;});})[_0x9553('0x20')](respondWithResult(_0x5b429a,0xc9))[_0x9553('0x4b')](handleError(_0x5b429a,null));};exports[_0x9553('0x61')]=function(_0x3ff9f4,_0x3c7e68,_0x120055){var _0x504b48;return db[_0x9553('0x4f')]['transaction'](function(_0x517f03){return db[_0x9553('0x48')]['find']({'where':{'id':_0x3ff9f4[_0x9553('0x62')]['id']}})[_0x9553('0x20')](handleEntityNotFound(_0x3c7e68,null))[_0x9553('0x20')](saveUpdates(_0x3ff9f4[_0x9553('0x50')],null))[_0x9553('0x20')](function(_0x31aa88){if(_0x31aa88){_0x504b48=_0x31aa88;return db['Network']['findAll']({'where':{'type':_0x504b48[_0x9553('0x44')]},'raw':!![]});}return null;})[_0x9553('0x20')](function(_0x80c3c3){if(_0x504b48[_0x9553('0x44')][_0x9553('0x52')]()==_0x9553('0x63')){var _0x4051f1=fs[_0x9553('0x59')](path[_0x9553('0x53')](config['root'],_0x9553('0x55')),_0x9553('0x56'));var _0x2ba761=ejs[_0x9553('0x5b')](_0x4051f1,{'networks':_0x80c3c3||[]});fs[_0x9553('0x5c')](_0x9553('0x57'),_0x2ba761);return respondWithRpcPromise(_0x9553('0x5d'),'update',{'module':_0x9553('0x64')});}else if(_0x504b48['type'][_0x9553('0x52')]()=='TURN'){var _0x232505=fs[_0x9553('0x59')](path[_0x9553('0x53')](config['root'],_0x9553('0x5a')),_0x9553('0x56'));var _0x5951a8=ejs[_0x9553('0x5b')](_0x232505,{'networks':_0x80c3c3||[]});fs['writeFileSync'](_0x9553('0x65'),_0x5951a8);return respondWithRpcPromise(_0x9553('0x5d'),_0x9553('0x61'),{'module':_0x9553('0x64')});}else{var _0x57c8fe=fs[_0x9553('0x59')](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x5e')),'utf8');var _0x4a51d7=ejs['render'](_0x57c8fe,{'networks':_0x80c3c3||[]});fs[_0x9553('0x5c')](util[_0x9553('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ff9f4[_0x9553('0x50')][_0x9553('0x44')][_0x9553('0x60')]()),_0x4a51d7);return respondWithRpcPromise(_0x9553('0x5d'),_0x9553('0x61'),{'module':'chan_sip.so'});}return null;})[_0x9553('0x20')](function(_0x539133){if(_0x539133){return _0x504b48;}return null;});})[_0x9553('0x20')](respondWithResult(_0x3c7e68,null))[_0x9553('0x4b')](handleError(_0x3c7e68,null));};exports[_0x9553('0x67')]=function(_0x167aa4,_0x3eb1e0,_0x31d3dc){var _0x50ac5d;return db[_0x9553('0x48')][_0x9553('0x68')]({'where':{'id':_0x167aa4[_0x9553('0x62')]['id']}})[_0x9553('0x20')](function(_0x21b697){_0x50ac5d=_0x21b697;return _0x21b697;})['then'](handleEntityNotFound(_0x3eb1e0,null))['then'](removeEntity(_0x3eb1e0,null))[_0x9553('0x20')](function(){if(_0x50ac5d){return db[_0x9553('0x48')]['findAll']({'where':{'type':_0x50ac5d[_0x9553('0x44')]},'raw':!![]});}})['then'](function(_0x4d4e4a){if(_0x50ac5d[_0x9553('0x44')][_0x9553('0x52')]()==_0x9553('0x63')){var _0x195829=fs[_0x9553('0x59')](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x55')),_0x9553('0x56'));var _0x59a6fb=ejs[_0x9553('0x5b')](_0x195829,{'networks':_0x4d4e4a||[]});fs[_0x9553('0x5c')](_0x9553('0x57'),_0x59a6fb);return respondWithRpcPromise(_0x9553('0x5d'),_0x9553('0x67'),{'module':_0x9553('0x64')});}else if(_0x50ac5d[_0x9553('0x44')]['toUpperCase']()==_0x9553('0x58')){var _0x3b2f34=fs[_0x9553('0x59')](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x5a')),'utf8');var _0x3d8a7f=ejs[_0x9553('0x5b')](_0x3b2f34,{'networks':_0x4d4e4a||[]});fs[_0x9553('0x5c')](_0x9553('0x65'),_0x3d8a7f);return respondWithRpcPromise(_0x9553('0x5d'),_0x9553('0x67'),{'module':'res_stun_monitor.so'});}else{var _0x30907a=fs[_0x9553('0x59')](path[_0x9553('0x53')](config[_0x9553('0x54')],_0x9553('0x5e')),'utf8');var _0x536631=ejs[_0x9553('0x5b')](_0x30907a,{'networks':_0x4d4e4a||[]});fs[_0x9553('0x5c')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x167aa4['body']['type'][_0x9553('0x60')]()),_0x536631);return respondWithRpcPromise(_0x9553('0x5d'),_0x9553('0x67'),{'module':'chan_sip.so'});}return null;})[_0x9553('0x4b')](handleError(_0x3eb1e0,null));}; \ No newline at end of file +var _0x389e=['error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','Network','include','findAll','rows','params','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','toLowerCase','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','server/files/templates/turn_multiple.ejs','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','code'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x389e,0x188));var _0xe389=function(_0x739550,_0x57aa93){_0x739550=_0x739550-0x0;var _0x5c17ef=_0x389e[_0x739550];return _0x5c17ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe389('0x0'));var rp=require(_0xe389('0x1'));var moment=require('moment');var BPromise=require(_0xe389('0x2'));var Mustache=require(_0xe389('0x3'));var util=require(_0xe389('0x4'));var path=require(_0xe389('0x5'));var sox=require(_0xe389('0x6'));var csv=require(_0xe389('0x7'));var ejs=require(_0xe389('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe389('0x9'));var squel=require(_0xe389('0xa'));var crypto=require(_0xe389('0xb'));var jsforce=require(_0xe389('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe389('0x7'));var querystring=require(_0xe389('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe389('0xe'));var qs=require(_0xe389('0xf'));var as=require(_0xe389('0x10'));var hardwareService=require(_0xe389('0x11'));var logger=require(_0xe389('0x12'))(_0xe389('0x13'));var utils=require(_0xe389('0x14'));var config=require(_0xe389('0x15'));var licenseUtil=require(_0xe389('0x16'));var db=require(_0xe389('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe389('0x18')][_0xe389('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2672c0,_0x5487cb,_0x5a7df4,_0x5b4580){return new BPromise(function(_0x389e29,_0x587d75){var _0x5661c8=_0x5b4580||client;return _0x5661c8[_0xe389('0x1a')](_0x2672c0,_0x5a7df4)[_0xe389('0x1b')](function(_0x67a626){logger[_0xe389('0x1c')](_0xe389('0x1d'),_0x5487cb,_0xe389('0x1e'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x5487cb,_0xe389('0x1e'),JSON['stringify'](_0x67a626));if(_0x67a626['error']){if(_0x67a626['error'][_0xe389('0x1f')]===0x1f4){logger['error'](_0xe389('0x1d'),_0x5487cb,_0x67a626[_0xe389('0x20')][_0xe389('0x21')]);return _0x587d75(_0x67a626[_0xe389('0x20')][_0xe389('0x21')]);}logger['error'](_0xe389('0x1d'),_0x5487cb,_0x67a626['error'][_0xe389('0x21')]);return _0x389e29(_0x67a626['error'][_0xe389('0x21')]);}else{logger['info'](_0xe389('0x1d'),_0x5487cb,_0xe389('0x1e'));_0x389e29(_0x67a626[_0xe389('0x22')][_0xe389('0x21')]);}})[_0xe389('0x23')](function(_0x4cc220){logger[_0xe389('0x20')]('Network,\x20%s,\x20%s',_0x5487cb,_0x4cc220);_0x587d75(_0x4cc220);});});}function respondWithStatusCode(_0x38d9d5,_0x462a71){_0x462a71=_0x462a71||0xcc;return function(_0x2a39aa){if(_0x2a39aa){return _0x38d9d5[_0xe389('0x24')](_0x462a71);}return _0x38d9d5[_0xe389('0x25')](_0x462a71)[_0xe389('0x26')]();};}function respondWithResult(_0x38d311,_0xe2465f){_0xe2465f=_0xe2465f||0xc8;return function(_0x566016){if(_0x566016){return _0x38d311[_0xe389('0x25')](_0xe2465f)[_0xe389('0x27')](_0x566016);}};}function respondWithFilteredResult(_0x2f9512,_0x100f12){return function(_0x5a9ce1){if(_0x5a9ce1){var _0x31571a=typeof _0x100f12['offset']===_0xe389('0x28')&&typeof _0x100f12['limit']==='undefined';var _0x20a9cc=_0x5a9ce1[_0xe389('0x29')];var _0x50dbef=_0x31571a?0x0:_0x100f12['offset'];var _0x367043=_0x31571a?_0x5a9ce1[_0xe389('0x29')]:_0x100f12[_0xe389('0x2a')]+_0x100f12['limit'];var _0x5bf7b2;if(_0x367043>=_0x20a9cc){_0x367043=_0x20a9cc;_0x5bf7b2=0xc8;}else{_0x5bf7b2=0xce;}_0x2f9512['status'](_0x5bf7b2);return _0x2f9512['set'](_0xe389('0x2b'),_0x50dbef+'-'+_0x367043+'/'+_0x20a9cc)['json'](_0x5a9ce1);}return null;};}function patchUpdates(_0x2906a0){return function(_0x47e669){try{jsonpatch[_0xe389('0x2c')](_0x47e669,_0x2906a0,!![]);}catch(_0x266fa0){return BPromise[_0xe389('0x2d')](_0x266fa0);}return _0x47e669[_0xe389('0x2e')]();};}function saveUpdates(_0x40d90a,_0x391563){return function(_0x137edf){if(_0x137edf){return _0x137edf[_0xe389('0x2f')](_0x40d90a)['then'](function(_0xac88bf){return _0xac88bf;});}return null;};}function removeEntity(_0x278ee3,_0x10a229){return function(_0x520300){if(_0x520300){return _0x520300['destroy']()[_0xe389('0x1b')](function(){_0x278ee3[_0xe389('0x25')](0xcc)[_0xe389('0x26')]();});}};}function handleEntityNotFound(_0x375e63,_0x26d920){return function(_0x266624){if(!_0x266624){_0x375e63['sendStatus'](0x194);}return _0x266624;};}function handleError(_0x3dbba7,_0x273ad8){_0x273ad8=_0x273ad8||0x1f4;return function(_0x44c469){logger[_0xe389('0x20')](_0x44c469[_0xe389('0x30')]);if(_0x44c469[_0xe389('0x31')]){delete _0x44c469[_0xe389('0x31')];}_0x3dbba7[_0xe389('0x25')](_0x273ad8)[_0xe389('0x32')](_0x44c469);};}exports[_0xe389('0x33')]=function(_0x295090,_0x57aa95){var _0x3995e8={},_0x13a496={},_0x29e766={'count':0x0,'rows':[]};var _0x310a05=_[_0xe389('0x34')](db['Network'][_0xe389('0x35')],function(_0x326798){return{'name':_0x326798['fieldName'],'type':_0x326798['type'][_0xe389('0x36')]};});_0x13a496[_0xe389('0x37')]=_[_0xe389('0x34')](_0x310a05,_0xe389('0x31'));_0x13a496[_0xe389('0x38')]=_[_0xe389('0x39')](_0x295090[_0xe389('0x38')]);_0x13a496[_0xe389('0x3a')]=_[_0xe389('0x3b')](_0x13a496[_0xe389('0x37')],_0x13a496[_0xe389('0x38')]);_0x3995e8[_0xe389('0x3c')]=_[_0xe389('0x3b')](_0x13a496['model'],qs['fields'](_0x295090['query'][_0xe389('0x3d')]));_0x3995e8['attributes']=_0x3995e8[_0xe389('0x3c')][_0xe389('0x3e')]?_0x3995e8[_0xe389('0x3c')]:_0x13a496[_0xe389('0x37')];if(!_0x295090[_0xe389('0x38')]['hasOwnProperty'](_0xe389('0x3f'))){_0x3995e8[_0xe389('0x40')]=qs[_0xe389('0x40')](_0x295090[_0xe389('0x38')][_0xe389('0x40')]);_0x3995e8[_0xe389('0x2a')]=qs[_0xe389('0x2a')](_0x295090[_0xe389('0x38')][_0xe389('0x2a')]);}_0x3995e8[_0xe389('0x41')]=qs[_0xe389('0x42')](_0x295090['query'][_0xe389('0x42')]);_0x3995e8['where']=qs[_0xe389('0x3a')](_[_0xe389('0x43')](_0x295090[_0xe389('0x38')],_0x13a496[_0xe389('0x3a')]),_0x310a05);if(_0x295090[_0xe389('0x38')][_0xe389('0x44')]){_0x3995e8[_0xe389('0x45')]=_['merge'](_0x3995e8[_0xe389('0x45')],{'$or':_[_0xe389('0x34')](_0x310a05,function(_0x4c7073){if(_0x4c7073[_0xe389('0x46')]!==_0xe389('0x47')){var _0xd1e819={};_0xd1e819[_0x4c7073[_0xe389('0x31')]]={'$like':'%'+_0x295090['query'][_0xe389('0x44')]+'%'};return _0xd1e819;}})});}_0x3995e8=_[_0xe389('0x48')]({},_0x3995e8,_0x295090[_0xe389('0x49')]);var _0x5d5335={'where':_0x3995e8['where']};return db[_0xe389('0x4a')][_0xe389('0x29')](_0x5d5335)[_0xe389('0x1b')](function(_0x29f0ea){_0x29e766['count']=_0x29f0ea;if(_0x295090[_0xe389('0x38')]['includeAll']){_0x3995e8[_0xe389('0x4b')]=[{'all':!![]}];}return db[_0xe389('0x4a')][_0xe389('0x4c')](_0x3995e8);})['then'](function(_0x19cd99){_0x29e766[_0xe389('0x4d')]=_0x19cd99;return _0x29e766;})[_0xe389('0x1b')](respondWithFilteredResult(_0x57aa95,_0x3995e8))['catch'](handleError(_0x57aa95,null));};exports['show']=function(_0x14026f,_0x19cebf){var _0x2ee5b3={'raw':!![],'where':{'id':_0x14026f[_0xe389('0x4e')]['id']}},_0xbcf9ef={};_0xbcf9ef['model']=_['keys'](db[_0xe389('0x4a')][_0xe389('0x35')]);_0xbcf9ef[_0xe389('0x38')]=_[_0xe389('0x39')](_0x14026f['query']);_0xbcf9ef['filters']=_[_0xe389('0x3b')](_0xbcf9ef['model'],_0xbcf9ef[_0xe389('0x38')]);_0x2ee5b3[_0xe389('0x3c')]=_['intersection'](_0xbcf9ef[_0xe389('0x37')],qs[_0xe389('0x3d')](_0x14026f[_0xe389('0x38')][_0xe389('0x3d')]));_0x2ee5b3[_0xe389('0x3c')]=_0x2ee5b3[_0xe389('0x3c')][_0xe389('0x3e')]?_0x2ee5b3[_0xe389('0x3c')]:_0xbcf9ef[_0xe389('0x37')];if(_0x14026f[_0xe389('0x38')][_0xe389('0x4f')]){_0x2ee5b3[_0xe389('0x4b')]=[{'all':!![]}];}_0x2ee5b3=_['merge']({},_0x2ee5b3,_0x14026f['options']);return db[_0xe389('0x4a')][_0xe389('0x50')](_0x2ee5b3)[_0xe389('0x1b')](handleEntityNotFound(_0x19cebf,null))['then'](respondWithResult(_0x19cebf,null))[_0xe389('0x23')](handleError(_0x19cebf,null));};exports[_0xe389('0x51')]=function(_0x4e56e8,_0x3d5fb5,_0x419ffd){var _0x3525a7;return db[_0xe389('0x52')][_0xe389('0x53')](function(_0x48a629){return db[_0xe389('0x4a')][_0xe389('0x51')](_0x4e56e8['body'],{'raw':!![]})['then'](function(_0x501341){_0x3525a7=_0x501341;return db[_0xe389('0x4a')]['findAll']({'where':{'type':_0x4e56e8[_0xe389('0x54')]['type']},'raw':!![]});})[_0xe389('0x1b')](function(_0x438439){if(_0x3525a7['type'][_0xe389('0x55')]()==_0xe389('0x56')){var _0x107940=fs[_0xe389('0x57')](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x5a')),'utf8');var _0x3262ab=ejs[_0xe389('0x5b')](_0x107940,{'networks':_0x438439||[]});fs[_0xe389('0x5c')](_0xe389('0x5d'),_0x3262ab);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':'res_stun_monitor.so'});}else if(_0x3525a7[_0xe389('0x46')][_0xe389('0x55')]()==_0xe389('0x5f')){var _0x3077f9=fs[_0xe389('0x57')](path['join'](config[_0xe389('0x59')],'server/files/templates/turn_multiple.ejs'),_0xe389('0x60'));var _0x48f4cd=ejs[_0xe389('0x5b')](_0x3077f9,{'networks':_0x438439||[]});fs['writeFileSync'](_0xe389('0x61'),_0x48f4cd);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':_0xe389('0x62')});}else{var _0x2f659f=fs[_0xe389('0x57')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xe389('0x60'));var _0x34dec8=ejs['render'](_0x2f659f,{'networks':_0x438439||[]});fs[_0xe389('0x5c')](util[_0xe389('0x63')]('/etc/asterisk/sip_xcally_%s.conf',_0x4e56e8[_0xe389('0x54')]['type'][_0xe389('0x64')]()),_0x34dec8);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x51'),{'module':'chan_sip.so'});}return null;})[_0xe389('0x1b')](function(){return _0x3525a7;});})['then'](respondWithResult(_0x3d5fb5,0xc9))[_0xe389('0x23')](handleError(_0x3d5fb5,null));};exports[_0xe389('0x2f')]=function(_0x4c1302,_0x5b6142,_0x1bace4){var _0x3cb9cf;return db['sequelize'][_0xe389('0x53')](function(_0xea942b){return db[_0xe389('0x4a')][_0xe389('0x50')]({'where':{'id':_0x4c1302[_0xe389('0x4e')]['id']}})[_0xe389('0x1b')](handleEntityNotFound(_0x5b6142,null))['then'](saveUpdates(_0x4c1302[_0xe389('0x54')],null))[_0xe389('0x1b')](function(_0x11fec9){if(_0x11fec9){_0x3cb9cf=_0x11fec9;return db[_0xe389('0x4a')][_0xe389('0x4c')]({'where':{'type':_0x3cb9cf[_0xe389('0x46')]},'raw':!![]});}return null;})['then'](function(_0x3fdc55){if(_0x3cb9cf[_0xe389('0x46')][_0xe389('0x55')]()=='STUN'){var _0x28eb9a=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],_0xe389('0x5a')),_0xe389('0x60'));var _0x4dcd0b=ejs[_0xe389('0x5b')](_0x28eb9a,{'networks':_0x3fdc55||[]});fs[_0xe389('0x5c')](_0xe389('0x5d'),_0x4dcd0b);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x2f'),{'module':_0xe389('0x62')});}else if(_0x3cb9cf[_0xe389('0x46')][_0xe389('0x55')]()=='TURN'){var _0x2b7e56=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe389('0x60'));var _0x1b19c9=ejs[_0xe389('0x5b')](_0x2b7e56,{'networks':_0x3fdc55||[]});fs[_0xe389('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x1b19c9);return respondWithRpcPromise('Reload',_0xe389('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x4e3ae8=fs[_0xe389('0x57')](path[_0xe389('0x58')](config['root'],_0xe389('0x65')),_0xe389('0x60'));var _0x4c262c=ejs['render'](_0x4e3ae8,{'networks':_0x3fdc55||[]});fs['writeFileSync'](util[_0xe389('0x63')](_0xe389('0x66'),_0x4c1302[_0xe389('0x54')][_0xe389('0x46')][_0xe389('0x64')]()),_0x4c262c);return respondWithRpcPromise('Reload',_0xe389('0x2f'),{'module':_0xe389('0x67')});}return null;})[_0xe389('0x1b')](function(_0x3f9acb){if(_0x3f9acb){return _0x3cb9cf;}return null;});})[_0xe389('0x1b')](respondWithResult(_0x5b6142,null))[_0xe389('0x23')](handleError(_0x5b6142,null));};exports[_0xe389('0x68')]=function(_0x138363,_0x5955ee,_0x57d6ec){var _0xf56aa9;return db[_0xe389('0x4a')][_0xe389('0x50')]({'where':{'id':_0x138363[_0xe389('0x4e')]['id']}})[_0xe389('0x1b')](function(_0x5eaa25){_0xf56aa9=_0x5eaa25;return _0x5eaa25;})[_0xe389('0x1b')](handleEntityNotFound(_0x5955ee,null))[_0xe389('0x1b')](removeEntity(_0x5955ee,null))[_0xe389('0x1b')](function(){if(_0xf56aa9){return db['Network'][_0xe389('0x4c')]({'where':{'type':_0xf56aa9['type']},'raw':!![]});}})[_0xe389('0x1b')](function(_0x409407){if(_0xf56aa9[_0xe389('0x46')][_0xe389('0x55')]()==_0xe389('0x56')){var _0x731f30=fs[_0xe389('0x57')](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x5a')),_0xe389('0x60'));var _0x17e844=ejs['render'](_0x731f30,{'networks':_0x409407||[]});fs['writeFileSync'](_0xe389('0x5d'),_0x17e844);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x68'),{'module':_0xe389('0x62')});}else if(_0xf56aa9['type']['toUpperCase']()==_0xe389('0x5f')){var _0x28209f=fs['readFileSync'](path[_0xe389('0x58')](config['root'],_0xe389('0x69')),_0xe389('0x60'));var _0x4d916d=ejs[_0xe389('0x5b')](_0x28209f,{'networks':_0x409407||[]});fs[_0xe389('0x5c')](_0xe389('0x61'),_0x4d916d);return respondWithRpcPromise(_0xe389('0x5e'),'destroy',{'module':_0xe389('0x62')});}else{var _0x234f10=fs['readFileSync'](path[_0xe389('0x58')](config[_0xe389('0x59')],_0xe389('0x65')),'utf8');var _0x4e0db7=ejs['render'](_0x234f10,{'networks':_0x409407||[]});fs['writeFileSync'](util[_0xe389('0x63')](_0xe389('0x66'),_0x138363[_0xe389('0x54')]['type'][_0xe389('0x64')]()),_0x4e0db7);return respondWithRpcPromise(_0xe389('0x5e'),_0xe389('0x68'),{'module':'chan_sip.so'});}return null;})[_0xe389('0x23')](handleError(_0x5955ee,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e011ca8..e5c2a53 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 _0x593e=['path','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc07630,_0x34b57a){var _0x44b1d0=function(_0x46034e){while(--_0x46034e){_0xc07630['push'](_0xc07630['shift']());}};_0x44b1d0(++_0x34b57a);}(_0x593e,0xcb));var _0xe593=function(_0x1f8912,_0x3310fc){_0x1f8912=_0x1f8912-0x0;var _0x285374=_0x593e[_0x1f8912];return _0x285374;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var rp=require(_0xe593('0x6'));var fs=require('fs');var path=require(_0xe593('0x7'));var rimraf=require('rimraf');var config=require(_0xe593('0x8'));var attributes=require(_0xe593('0x9'));module[_0xe593('0xa')]=function(_0x1e50d3,_0x3b7082){return _0x1e50d3[_0xe593('0xb')](_0xe593('0xc'),attributes,{'tableName':_0xe593('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeffd=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','../../config/logger','api','moment','bluebird'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xeffd,0x6b));var _0xdeff=function(_0xcf42b6,_0x567c7f){_0xcf42b6=_0xcf42b6-0x0;var _0x546b5c=_0xeffd[_0xcf42b6];return _0x546b5c;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var logger=require(_0xdeff('0x1'))(_0xdeff('0x2'));var moment=require(_0xdeff('0x3'));var BPromise=require(_0xdeff('0x4'));var rp=require(_0xdeff('0x5'));var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require(_0xdeff('0x7'));var config=require(_0xdeff('0x8'));var attributes=require(_0xdeff('0x9'));module[_0xdeff('0xa')]=function(_0x1ed641,_0x132631){return _0x1ed641[_0xdeff('0xb')](_0xdeff('0xc'),attributes,{'tableName':_0xdeff('0xd'),'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 0f00a72..8296b42 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1a99bb,_0x40c375){var _0x1dce49=function(_0x137b85){while(--_0x137b85){_0x1a99bb['push'](_0x1a99bb['shift']());}};_0x1dce49(++_0x40c375);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f170f,_0x9d40fd){var _0x5cb738=function(_0x19b08c){while(--_0x19b08c){_0x4f170f['push'](_0x4f170f['shift']());}};_0x5cb738(++_0x9d40fd);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 01da052..9f8d3e3 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 _0x820d=['post','addDisposition','addAnswer','/:id/notify','addApplications','send','put','update','destroy','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create'];(function(_0x14e244,_0x1e1445){var _0xeaa5b6=function(_0x571563){while(--_0x571563){_0x14e244['push'](_0x14e244['shift']());}};_0xeaa5b6(++_0x1e1445);}(_0x820d,0x9d));var _0xd820=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x820d[_0x34021d];return _0x16597b;};'use strict';var multer=require('multer');var util=require(_0xd820('0x0'));var path=require(_0xd820('0x1'));var timeout=require(_0xd820('0x2'));var express=require(_0xd820('0x3'));var router=express['Router']();var fs_extra=require(_0xd820('0x4'));var auth=require(_0xd820('0x5'));var interaction=require(_0xd820('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0xd820('0x7')]('/',auth[_0xd820('0x8')](),controller[_0xd820('0x9')]);router[_0xd820('0x7')](_0xd820('0xa'),auth[_0xd820('0x8')](),controller['describe']);router[_0xd820('0x7')](_0xd820('0xb'),auth[_0xd820('0x8')](),controller[_0xd820('0xc')]);router['get'](_0xd820('0xd'),auth[_0xd820('0x8')](),controller['getDispositions']);router[_0xd820('0x7')](_0xd820('0xe'),auth[_0xd820('0x8')](),controller[_0xd820('0xf')]);router[_0xd820('0x7')](_0xd820('0x10'),auth[_0xd820('0x8')](),controller[_0xd820('0x11')]);router['get'](_0xd820('0x12'),auth[_0xd820('0x8')](),controller[_0xd820('0x13')]);router['get'](_0xd820('0x14'),auth['isAuthenticated'](),controller[_0xd820('0x15')]);router['post']('/',auth[_0xd820('0x8')](),controller[_0xd820('0x16')]);router[_0xd820('0x17')]('/:id/dispositions',auth[_0xd820('0x8')](),controller[_0xd820('0x18')]);router[_0xd820('0x17')](_0xd820('0xe'),auth[_0xd820('0x8')](),controller[_0xd820('0x19')]);router[_0xd820('0x17')](_0xd820('0x1a'),controller['notify']);router[_0xd820('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0xd820('0x1b')]);router[_0xd820('0x17')](_0xd820('0x14'),auth[_0xd820('0x8')](),controller['addAgents']);router[_0xd820('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xd820('0x1c')]);router[_0xd820('0x1d')](_0xd820('0xb'),auth['isAuthenticated'](),controller[_0xd820('0x1e')]);router['delete'](_0xd820('0xb'),auth[_0xd820('0x8')](),controller[_0xd820('0x1f')]);router[_0xd820('0x20')]('/:id/dispositions',auth[_0xd820('0x8')](),controller[_0xd820('0x21')]);router[_0xd820('0x20')](_0xd820('0xe'),auth[_0xd820('0x8')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xd820('0x8')](),controller[_0xd820('0x22')]);module[_0xd820('0x23')]=router; \ No newline at end of file +var _0xa331=['destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','send','update'];(function(_0x519ed8,_0x5c9e9e){var _0x4f174e=function(_0xa58da6){while(--_0xa58da6){_0x519ed8['push'](_0x519ed8['shift']());}};_0x4f174e(++_0x5c9e9e);}(_0xa331,0x13e));var _0x1a33=function(_0x5d8b12,_0x5799d4){_0x5d8b12=_0x5d8b12-0x0;var _0x4f08a0=_0xa331[_0x5d8b12];return _0x4f08a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a33('0x0'));var timeout=require(_0x1a33('0x1'));var express=require(_0x1a33('0x2'));var router=express[_0x1a33('0x3')]();var fs_extra=require(_0x1a33('0x4'));var auth=require(_0x1a33('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a33('0x6'));var controller=require(_0x1a33('0x7'));router[_0x1a33('0x8')]('/',auth['isAuthenticated'](),controller[_0x1a33('0x9')]);router[_0x1a33('0x8')](_0x1a33('0xa'),auth['isAuthenticated'](),controller[_0x1a33('0xb')]);router['get'](_0x1a33('0xc'),auth[_0x1a33('0xd')](),controller[_0x1a33('0xe')]);router[_0x1a33('0x8')](_0x1a33('0xf'),auth['isAuthenticated'](),controller[_0x1a33('0x10')]);router[_0x1a33('0x8')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x12')]);router[_0x1a33('0x8')](_0x1a33('0x13'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x14')]);router[_0x1a33('0x8')](_0x1a33('0x15'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x16')]);router[_0x1a33('0x8')](_0x1a33('0x17'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x18')]);router[_0x1a33('0x19')]('/',auth[_0x1a33('0xd')](),controller[_0x1a33('0x1a')]);router[_0x1a33('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1a33('0x19')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x1b')]);router['post'](_0x1a33('0x1c'),controller[_0x1a33('0x1d')]);router[_0x1a33('0x19')](_0x1a33('0x13'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x1e')]);router[_0x1a33('0x19')](_0x1a33('0x17'),auth[_0x1a33('0xd')](),controller['addAgents']);router[_0x1a33('0x19')]('/:id/send',auth[_0x1a33('0xd')](),controller[_0x1a33('0x1f')]);router['put'](_0x1a33('0xc'),auth['isAuthenticated'](),controller[_0x1a33('0x20')]);router['delete'](_0x1a33('0xc'),auth['isAuthenticated'](),controller[_0x1a33('0x21')]);router[_0x1a33('0x22')](_0x1a33('0xf'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x23')]);router[_0x1a33('0x22')](_0x1a33('0x11'),auth[_0x1a33('0xd')](),controller[_0x1a33('0x24')]);router[_0x1a33('0x22')](_0x1a33('0x17'),auth['isAuthenticated'](),controller[_0x1a33('0x25')]);module[_0x1a33('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ca9b9af..1f6264c 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 _0x7ba9=['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','randomstring','exports','STRING','name','generate'];(function(_0x143b8a,_0x227d4c){var _0x4e8ccd=function(_0x555559){while(--_0x555559){_0x143b8a['push'](_0x143b8a['shift']());}};_0x4e8ccd(++_0x227d4c);}(_0x7ba9,0xd3));var _0x97ba=function(_0x540c49,_0x3e88d9){_0x540c49=_0x540c49-0x0;var _0x390f69=_0x7ba9[_0x540c49];return _0x390f69;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x97ba('0x0'));module[_0x97ba('0x1')]={'name':{'type':Sequelize[_0x97ba('0x2')],'unique':_0x97ba('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x97ba('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x97ba('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x97ba('0x5');}},'notificationSound':{'type':Sequelize[_0x97ba('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x97ba('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x97ba('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x97ba('0x2')]},'queueTransfer':{'type':Sequelize[_0x97ba('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x97ba('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x97ba('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x97ba('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x97ba('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x97ba('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x97ba('0x6')],'defaultValue':![],'comment':_0x97ba('0x9'),'set':function(_0x5c71e7){if(!_0x5c71e7)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x97ba('0xa')](_0x97ba('0xb'),_0x5c71e7);}}}; \ No newline at end of file +var _0xd160=['name','STRING','generate','TEXT','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xd160,0x117));var _0x0d16=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0xd160[_0x12d951];return _0x44de17;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0d16('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d16('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x0d16('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0d16('0x3')]();}},'replyUri':{'type':Sequelize[_0x0d16('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0d16('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0d16('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0d16('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0d16('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0d16('0x5')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x267b7b){if(!_0x267b7b)this[_0x0d16('0x7')](_0x0d16('0x8'),null);this[_0x0d16('0x7')](_0x0d16('0x9'),_0x267b7b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 29b96b8..1275433 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 _0xfd27=['READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','fullname','Tag','Tags','color','addAgents','omit','emit','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','mandatoryDispositionPause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','getDispositions','findOne','Disposition','filter','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','include','removeAnswers','notify','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','list','applications','orderBy','priority','asc','account','defaults','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','contact','messageId','interaction','created','length','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','ISOLATION_LEVELS'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xfd27,0xd5));var _0x7fd2=function(_0x59de17,_0x3644de){_0x59de17=_0x59de17-0x0;var _0x18e42c=_0xfd27[_0x59de17];return _0x18e42c;};'use strict';var emlformat=require(_0x7fd2('0x0'));var rimraf=require(_0x7fd2('0x1'));var zipdir=require(_0x7fd2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fd2('0x3'));var moment=require(_0x7fd2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7fd2('0x5'));var util=require('util');var path=require(_0x7fd2('0x6'));var sox=require(_0x7fd2('0x7'));var csv=require(_0x7fd2('0x8'));var ejs=require(_0x7fd2('0x9'));var fs=require('fs');var fs_extra=require(_0x7fd2('0xa'));var _=require(_0x7fd2('0xb'));var squel=require('squel');var crypto=require(_0x7fd2('0xc'));var jsforce=require(_0x7fd2('0xd'));var deskjs=require(_0x7fd2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7fd2('0xf'));var Papa=require(_0x7fd2('0x10'));var Redis=require(_0x7fd2('0x11'));var authService=require(_0x7fd2('0x12'));var qs=require(_0x7fd2('0x13'));var as=require(_0x7fd2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fd2('0x15'))('api');var utils=require(_0x7fd2('0x16'));var config=require(_0x7fd2('0x17'));var licenseUtil=require(_0x7fd2('0x18'));var db=require(_0x7fd2('0x19'))['db'];config[_0x7fd2('0x1a')]=_['defaults'](config[_0x7fd2('0x1a')],{'host':_0x7fd2('0x1b'),'port':0x18eb});var socket=require(_0x7fd2('0x1c'))(new Redis(config[_0x7fd2('0x1a')]));require(_0x7fd2('0x1d'))[_0x7fd2('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7fd2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45784c,_0x598b06,_0x166849,_0x11fa01){return new BPromise(function(_0x4e3dc5,_0x587a33){var _0x261348=_0x11fa01||client;return _0x261348['request'](_0x45784c,_0x166849)['then'](function(_0x3ba69f){logger['info'](_0x7fd2('0x20'),_0x598b06,_0x7fd2('0x21'));logger[_0x7fd2('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x598b06,_0x7fd2('0x21'),JSON[_0x7fd2('0x23')](_0x3ba69f));if(_0x3ba69f[_0x7fd2('0x24')]){if(_0x3ba69f[_0x7fd2('0x24')][_0x7fd2('0x25')]===0x1f4){logger[_0x7fd2('0x24')](_0x7fd2('0x20'),_0x598b06,_0x3ba69f[_0x7fd2('0x24')][_0x7fd2('0x26')]);return _0x587a33(_0x3ba69f[_0x7fd2('0x24')][_0x7fd2('0x26')]);}logger[_0x7fd2('0x24')](_0x7fd2('0x20'),_0x598b06,_0x3ba69f['error'][_0x7fd2('0x26')]);return _0x4e3dc5(_0x3ba69f['error'][_0x7fd2('0x26')]);}else{logger[_0x7fd2('0x27')](_0x7fd2('0x20'),_0x598b06,_0x7fd2('0x21'));_0x4e3dc5(_0x3ba69f[_0x7fd2('0x28')][_0x7fd2('0x26')]);}})[_0x7fd2('0x29')](function(_0x3640ee){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x598b06,_0x3640ee);_0x587a33(_0x3640ee);});});}function respondWithStatusCode(_0x7b7239,_0x68ca70){_0x68ca70=_0x68ca70||0xcc;return function(_0x4139e1){if(_0x4139e1){return _0x7b7239[_0x7fd2('0x2a')](_0x68ca70);}return _0x7b7239[_0x7fd2('0x2b')](_0x68ca70)[_0x7fd2('0x2c')]();};}function respondWithResult(_0x2c90ae,_0x465bd9){_0x465bd9=_0x465bd9||0xc8;return function(_0x5996aa){if(_0x5996aa){return _0x2c90ae[_0x7fd2('0x2b')](_0x465bd9)[_0x7fd2('0x2d')](_0x5996aa);}};}function respondWithFilteredResult(_0x3f87b1,_0x50212f){return function(_0x43af3b){if(_0x43af3b){var _0x4e724c=typeof _0x50212f[_0x7fd2('0x2e')]===_0x7fd2('0x2f')&&typeof _0x50212f['limit']===_0x7fd2('0x2f');var _0x268097=_0x43af3b[_0x7fd2('0x30')];var _0xf429a=_0x4e724c?0x0:_0x50212f[_0x7fd2('0x2e')];var _0x3f3416=_0x4e724c?_0x43af3b[_0x7fd2('0x30')]:_0x50212f['offset']+_0x50212f[_0x7fd2('0x31')];var _0x291b0d;if(_0x3f3416>=_0x268097){_0x3f3416=_0x268097;_0x291b0d=0xc8;}else{_0x291b0d=0xce;}_0x3f87b1['status'](_0x291b0d);return _0x3f87b1[_0x7fd2('0x32')](_0x7fd2('0x33'),_0xf429a+'-'+_0x3f3416+'/'+_0x268097)[_0x7fd2('0x2d')](_0x43af3b);}return null;};}function patchUpdates(_0x57f96b){return function(_0x43a04e){try{jsonpatch[_0x7fd2('0x34')](_0x43a04e,_0x57f96b,!![]);}catch(_0x1fb8d2){return BPromise['reject'](_0x1fb8d2);}return _0x43a04e[_0x7fd2('0x35')]();};}function saveUpdates(_0xf60dad,_0x5dc4fe){return function(_0x430d5b){if(_0x430d5b){return _0x430d5b[_0x7fd2('0x36')](_0xf60dad)[_0x7fd2('0x37')](function(_0xc02b0e){return _0xc02b0e;});}return null;};}function removeEntity(_0x2db486,_0x3ad107){return function(_0x4d5175){if(_0x4d5175){return _0x4d5175['destroy']()['then'](function(){var _0x38397b=_0x4d5175[_0x7fd2('0x38')]({'plain':!![]});var _0xb5bfb3='OpenchannelAccounts';return db[_0x7fd2('0x39')][_0x7fd2('0x3a')]({'where':{'type':_0xb5bfb3,'resourceId':_0x38397b['id']}})[_0x7fd2('0x37')](function(){return _0x4d5175;});})[_0x7fd2('0x37')](function(){_0x2db486[_0x7fd2('0x2b')](0xcc)[_0x7fd2('0x2c')]();});}};}function handleEntityNotFound(_0x1a6244,_0x351e71){return function(_0x55dd3f){if(!_0x55dd3f){_0x1a6244[_0x7fd2('0x2a')](0x194);}return _0x55dd3f;};}function handleError(_0x4dd44c,_0x42b725){_0x42b725=_0x42b725||0x1f4;return function(_0x1baa8e){logger[_0x7fd2('0x24')](_0x1baa8e[_0x7fd2('0x3b')]);if(_0x1baa8e[_0x7fd2('0x3c')]){delete _0x1baa8e[_0x7fd2('0x3c')];}_0x4dd44c[_0x7fd2('0x2b')](_0x42b725)[_0x7fd2('0x3d')](_0x1baa8e);};}exports[_0x7fd2('0x3e')]=function(_0x5e354f,_0x196192){var _0x5379bc={'include':[{'model':db[_0x7fd2('0x3f')],'as':'mandatoryDispositionPause'}]},_0x94680d={},_0x52d2de={'count':0x0,'rows':[]};var _0x2e4c7c=_[_0x7fd2('0x40')](db[_0x7fd2('0x41')][_0x7fd2('0x42')],function(_0x10eaf6){return{'name':_0x10eaf6[_0x7fd2('0x43')],'type':_0x10eaf6[_0x7fd2('0x44')][_0x7fd2('0x45')]};});_0x94680d[_0x7fd2('0x46')]=_['map'](_0x2e4c7c,'name');_0x94680d[_0x7fd2('0x47')]=_[_0x7fd2('0x48')](_0x5e354f[_0x7fd2('0x47')]);_0x94680d[_0x7fd2('0x49')]=_[_0x7fd2('0x4a')](_0x94680d[_0x7fd2('0x46')],_0x94680d['query']);_0x5379bc['attributes']=_[_0x7fd2('0x4a')](_0x94680d[_0x7fd2('0x46')],qs['fields'](_0x5e354f['query'][_0x7fd2('0x4b')]));_0x5379bc[_0x7fd2('0x4c')]=_0x5379bc[_0x7fd2('0x4c')]['length']?_0x5379bc[_0x7fd2('0x4c')]:_0x94680d[_0x7fd2('0x46')];if(!_0x5e354f[_0x7fd2('0x47')][_0x7fd2('0x4d')](_0x7fd2('0x4e'))){_0x5379bc[_0x7fd2('0x31')]=qs['limit'](_0x5e354f['query'][_0x7fd2('0x31')]);_0x5379bc['offset']=qs[_0x7fd2('0x2e')](_0x5e354f[_0x7fd2('0x47')]['offset']);}_0x5379bc[_0x7fd2('0x4f')]=qs[_0x7fd2('0x50')](_0x5e354f['query'][_0x7fd2('0x50')]);_0x5379bc['where']=qs[_0x7fd2('0x49')](_['pick'](_0x5e354f[_0x7fd2('0x47')],_0x94680d[_0x7fd2('0x49')]),_0x2e4c7c);if(_0x5e354f['query']['filter']){_0x5379bc[_0x7fd2('0x51')]=_[_0x7fd2('0x52')](_0x5379bc[_0x7fd2('0x51')],{'$or':_[_0x7fd2('0x40')](_0x2e4c7c,function(_0x46e99d){if(_0x46e99d[_0x7fd2('0x44')]!==_0x7fd2('0x53')){var _0x5862c2={};_0x5862c2[_0x46e99d[_0x7fd2('0x3c')]]={'$like':'%'+_0x5e354f[_0x7fd2('0x47')]['filter']+'%'};return _0x5862c2;}})});}_0x5379bc=_[_0x7fd2('0x52')]({},_0x5379bc,_0x5e354f['options']);var _0x13dcdc={'where':_0x5379bc[_0x7fd2('0x51')]};return db[_0x7fd2('0x41')]['count'](_0x13dcdc)[_0x7fd2('0x37')](function(_0x41b9ab){_0x52d2de[_0x7fd2('0x30')]=_0x41b9ab;if(_0x5e354f['query'][_0x7fd2('0x54')]){_0x5379bc['include']=[{'all':!![]}];}return db[_0x7fd2('0x41')][_0x7fd2('0x55')](_0x5379bc);})['then'](function(_0x481215){_0x52d2de[_0x7fd2('0x56')]=_0x481215;return _0x52d2de;})[_0x7fd2('0x37')](respondWithFilteredResult(_0x196192,_0x5379bc))['catch'](handleError(_0x196192,null));};exports[_0x7fd2('0x57')]=function(_0x2a5097,_0x22420f){var _0x394a2a={'raw':![],'where':{'id':_0x2a5097[_0x7fd2('0x58')]['id']},'include':[{'model':db[_0x7fd2('0x3f')],'as':_0x7fd2('0x59')}]},_0xf9b71d={};_0xf9b71d['model']=_[_0x7fd2('0x48')](db['OpenchannelAccount'][_0x7fd2('0x42')]);_0xf9b71d[_0x7fd2('0x47')]=_[_0x7fd2('0x48')](_0x2a5097[_0x7fd2('0x47')]);_0xf9b71d['filters']=_[_0x7fd2('0x4a')](_0xf9b71d['model'],_0xf9b71d['query']);_0x394a2a['attributes']=_[_0x7fd2('0x4a')](_0xf9b71d[_0x7fd2('0x46')],qs['fields'](_0x2a5097[_0x7fd2('0x47')]['fields']));_0x394a2a['attributes']=_0x394a2a[_0x7fd2('0x4c')]['length']?_0x394a2a[_0x7fd2('0x4c')]:_0xf9b71d[_0x7fd2('0x46')];if(_0x2a5097[_0x7fd2('0x47')]['includeAll']){_0x394a2a['include']=[{'all':!![]}];}_0x394a2a=_[_0x7fd2('0x52')]({},_0x394a2a,_0x2a5097['options']);return db[_0x7fd2('0x41')]['find'](_0x394a2a)[_0x7fd2('0x37')](handleEntityNotFound(_0x22420f,null))[_0x7fd2('0x37')](respondWithResult(_0x22420f,null))['catch'](handleError(_0x22420f,null));};exports['create']=function(_0x53f0aa,_0x536c72){return db['OpenchannelAccount'][_0x7fd2('0x5a')](_0x53f0aa[_0x7fd2('0x5b')],{})[_0x7fd2('0x37')](function(_0x178735){var _0x3efa03=_0x53f0aa['user']['get']({'plain':!![]});if(!_0x3efa03)throw new Error(_0x7fd2('0x5c'));if(_0x3efa03[_0x7fd2('0x5d')]===_0x7fd2('0x5e')){var _0x3fcb80=_0x178735[_0x7fd2('0x38')]({'plain':!![]});var _0x5ab825='OpenchannelAccounts';return db[_0x7fd2('0x5f')][_0x7fd2('0x60')]({'where':{'name':_0x5ab825,'userProfileId':_0x3efa03[_0x7fd2('0x61')]},'raw':!![]})[_0x7fd2('0x37')](function(_0x4e6f62){if(_0x4e6f62&&_0x4e6f62['autoAssociation']===0x0){return db[_0x7fd2('0x39')][_0x7fd2('0x5a')]({'name':_0x3fcb80[_0x7fd2('0x3c')],'resourceId':_0x3fcb80['id'],'type':_0x4e6f62[_0x7fd2('0x3c')],'sectionId':_0x4e6f62['id']},{})[_0x7fd2('0x37')](function(){return _0x178735;});}else{return _0x178735;}})[_0x7fd2('0x29')](function(_0x3dd30d){logger[_0x7fd2('0x24')](_0x7fd2('0x62'),_0x3dd30d);throw _0x3dd30d;});}return _0x178735;})[_0x7fd2('0x37')](respondWithResult(_0x536c72,0xc9))[_0x7fd2('0x29')](handleError(_0x536c72,null));};exports[_0x7fd2('0x36')]=function(_0x2f5ef3,_0x5bd0d1){if(_0x2f5ef3[_0x7fd2('0x5b')]['id']){delete _0x2f5ef3['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2f5ef3[_0x7fd2('0x58')]['id']},'include':[{'model':db[_0x7fd2('0x3f')],'as':_0x7fd2('0x59')}]})['then'](handleEntityNotFound(_0x5bd0d1,null))[_0x7fd2('0x37')](saveUpdates(_0x2f5ef3['body'],null))[_0x7fd2('0x37')](respondWithResult(_0x5bd0d1,null))[_0x7fd2('0x29')](handleError(_0x5bd0d1,null));};exports[_0x7fd2('0x3a')]=function(_0x31fc3d,_0x5d7748){return db[_0x7fd2('0x41')]['find']({'where':{'id':_0x31fc3d[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x5d7748,null))['then'](removeEntity(_0x5d7748,null))[_0x7fd2('0x29')](handleError(_0x5d7748,null));};exports[_0x7fd2('0x63')]=function(_0x268cd9,_0x509703){return db[_0x7fd2('0x41')][_0x7fd2('0x63')]()[_0x7fd2('0x37')](respondWithResult(_0x509703,null))['catch'](handleError(_0x509703,null));};exports['addDisposition']=function(_0x2c1056,_0x19c8a6,_0x1c8fc4){if(_0x2c1056[_0x7fd2('0x5b')]['id']){delete _0x2c1056[_0x7fd2('0x5b')]['id'];}return db['OpenchannelAccount'][_0x7fd2('0x60')]({'where':{'id':_0x2c1056['params']['id']}})['then'](handleEntityNotFound(_0x19c8a6,null))[_0x7fd2('0x37')](function(_0x1eb6e0){if(_0x1eb6e0){_0x2c1056[_0x7fd2('0x5b')][_0x7fd2('0x64')]=_0x1eb6e0['id'];return db['Disposition'][_0x7fd2('0x5a')](_0x2c1056['body']);}})[_0x7fd2('0x37')](respondWithResult(_0x19c8a6,null))[_0x7fd2('0x29')](handleError(_0x19c8a6,null));};exports[_0x7fd2('0x65')]=function(_0x2bd98d,_0x299a8b,_0x201e8f){var _0x33a325={'raw':![],'where':{}};var _0x2f8b30={};var _0x317d0b={'count':0x0,'rows':[]};return db[_0x7fd2('0x41')][_0x7fd2('0x66')]({'where':{'id':_0x2bd98d[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x299a8b,null))['then'](function(_0x3d2fc8){if(_0x3d2fc8){_0x2f8b30[_0x7fd2('0x46')]=_[_0x7fd2('0x48')](db[_0x7fd2('0x67')][_0x7fd2('0x42')]);_0x2f8b30[_0x7fd2('0x47')]=_[_0x7fd2('0x48')](_0x2bd98d[_0x7fd2('0x47')]);_0x2f8b30[_0x7fd2('0x49')]=_[_0x7fd2('0x4a')](_0x2f8b30[_0x7fd2('0x46')],_0x2f8b30[_0x7fd2('0x47')]);_0x33a325['attributes']=_[_0x7fd2('0x4a')](_0x2f8b30[_0x7fd2('0x46')],qs[_0x7fd2('0x4b')](_0x2bd98d['query']['fields']));_0x33a325[_0x7fd2('0x4c')]=_0x33a325['attributes']['length']?_0x33a325['attributes']:_0x2f8b30[_0x7fd2('0x46')];if(!_0x2bd98d[_0x7fd2('0x47')][_0x7fd2('0x4d')]('nolimit')){_0x33a325['limit']=qs['limit'](_0x2bd98d[_0x7fd2('0x47')][_0x7fd2('0x31')]);_0x33a325[_0x7fd2('0x2e')]=qs['offset'](_0x2bd98d[_0x7fd2('0x47')][_0x7fd2('0x2e')]);}_0x33a325[_0x7fd2('0x4f')]=qs[_0x7fd2('0x50')](_0x2bd98d['query'][_0x7fd2('0x50')]);_0x33a325[_0x7fd2('0x51')]=qs['filters'](_['pick'](_0x2bd98d[_0x7fd2('0x47')],_0x2f8b30[_0x7fd2('0x49')]));_0x33a325[_0x7fd2('0x51')][_0x7fd2('0x64')]=_0x3d2fc8['id'];if(_0x2bd98d[_0x7fd2('0x47')]['filter']){_0x33a325[_0x7fd2('0x51')]=_[_0x7fd2('0x52')](_0x33a325[_0x7fd2('0x51')],{'$or':_[_0x7fd2('0x40')](_0x33a325[_0x7fd2('0x4c')],function(_0x27cbdf){var _0x5c05d9={};_0x5c05d9[_0x27cbdf]={'$like':'%'+_0x2bd98d[_0x7fd2('0x47')][_0x7fd2('0x68')]+'%'};return _0x5c05d9;})});}_0x33a325=_[_0x7fd2('0x52')]({},_0x33a325,_0x2bd98d[_0x7fd2('0x69')]);return db[_0x7fd2('0x67')][_0x7fd2('0x30')]({'where':_0x33a325[_0x7fd2('0x51')]})[_0x7fd2('0x37')](function(_0x1f41aa){_0x317d0b[_0x7fd2('0x30')]=_0x1f41aa;if(_0x2bd98d[_0x7fd2('0x47')]['includeAll']){_0x33a325['include']=[{'all':!![]}];}return db[_0x7fd2('0x67')][_0x7fd2('0x55')](_0x33a325);})[_0x7fd2('0x37')](function(_0x1bdd46){_0x317d0b[_0x7fd2('0x56')]=_0x1bdd46;return _0x317d0b;});}})['then'](respondWithFilteredResult(_0x299a8b,_0x33a325))[_0x7fd2('0x29')](handleError(_0x299a8b,null));};exports[_0x7fd2('0x6a')]=function(_0x14a38b,_0x106d09,_0x4a11cc){return db[_0x7fd2('0x41')][_0x7fd2('0x60')]({'where':{'id':_0x14a38b[_0x7fd2('0x58')]['id']}})['then'](handleEntityNotFound(_0x106d09,null))[_0x7fd2('0x37')](function(_0x3049b6){if(_0x3049b6){return _0x3049b6[_0x7fd2('0x6a')](_0x14a38b[_0x7fd2('0x47')][_0x7fd2('0x6b')]);}})[_0x7fd2('0x37')](respondWithStatusCode(_0x106d09,null))[_0x7fd2('0x29')](handleError(_0x106d09,null));};exports[_0x7fd2('0x6c')]=function(_0x52de1,_0x5945ad,_0x1065c5){if(_0x52de1[_0x7fd2('0x5b')]['id']){delete _0x52de1[_0x7fd2('0x5b')]['id'];}return db[_0x7fd2('0x41')]['find']({'where':{'id':_0x52de1['params']['id']}})['then'](handleEntityNotFound(_0x5945ad,null))[_0x7fd2('0x37')](function(_0x4385ec){if(_0x4385ec){_0x52de1[_0x7fd2('0x5b')][_0x7fd2('0x64')]=_0x4385ec['id'];return db['CannedAnswer'][_0x7fd2('0x5a')](_0x52de1[_0x7fd2('0x5b')]);}})[_0x7fd2('0x37')](respondWithResult(_0x5945ad,null))[_0x7fd2('0x29')](handleError(_0x5945ad,null));};exports[_0x7fd2('0x6d')]=function(_0x2e612e,_0x548fb8,_0x527ad9){var _0x14b634={'raw':![],'where':{}};var _0x284735={};var _0x5cf808={'count':0x0,'rows':[]};return db[_0x7fd2('0x41')]['findOne']({'where':{'id':_0x2e612e[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x548fb8,null))[_0x7fd2('0x37')](function(_0x4c9a66){if(_0x4c9a66){_0x284735[_0x7fd2('0x46')]=_[_0x7fd2('0x48')](db[_0x7fd2('0x6e')]['rawAttributes']);_0x284735[_0x7fd2('0x47')]=_['keys'](_0x2e612e[_0x7fd2('0x47')]);_0x284735[_0x7fd2('0x49')]=_[_0x7fd2('0x4a')](_0x284735[_0x7fd2('0x46')],_0x284735[_0x7fd2('0x47')]);_0x14b634[_0x7fd2('0x4c')]=_[_0x7fd2('0x4a')](_0x284735['model'],qs[_0x7fd2('0x4b')](_0x2e612e[_0x7fd2('0x47')]['fields']));_0x14b634[_0x7fd2('0x4c')]=_0x14b634[_0x7fd2('0x4c')]['length']?_0x14b634['attributes']:_0x284735[_0x7fd2('0x46')];if(!_0x2e612e[_0x7fd2('0x47')][_0x7fd2('0x4d')](_0x7fd2('0x4e'))){_0x14b634[_0x7fd2('0x31')]=qs['limit'](_0x2e612e[_0x7fd2('0x47')][_0x7fd2('0x31')]);_0x14b634[_0x7fd2('0x2e')]=qs[_0x7fd2('0x2e')](_0x2e612e[_0x7fd2('0x47')][_0x7fd2('0x2e')]);}_0x14b634[_0x7fd2('0x4f')]=qs[_0x7fd2('0x50')](_0x2e612e[_0x7fd2('0x47')]['sort']);_0x14b634['where']=qs[_0x7fd2('0x49')](_[_0x7fd2('0x6f')](_0x2e612e[_0x7fd2('0x47')],_0x284735[_0x7fd2('0x49')]));_0x14b634[_0x7fd2('0x51')]['OpenchannelAccountId']=_0x4c9a66['id'];if(_0x2e612e[_0x7fd2('0x47')][_0x7fd2('0x68')]){_0x14b634['where']=_[_0x7fd2('0x52')](_0x14b634[_0x7fd2('0x51')],{'$or':_[_0x7fd2('0x40')](_0x14b634[_0x7fd2('0x4c')],function(_0x5bfb5b){var _0xd75962={};_0xd75962[_0x5bfb5b]={'$like':'%'+_0x2e612e[_0x7fd2('0x47')]['filter']+'%'};return _0xd75962;})});}_0x14b634=_[_0x7fd2('0x52')]({},_0x14b634,_0x2e612e[_0x7fd2('0x69')]);return db[_0x7fd2('0x6e')][_0x7fd2('0x30')]({'where':_0x14b634[_0x7fd2('0x51')]})['then'](function(_0x2478e8){_0x5cf808[_0x7fd2('0x30')]=_0x2478e8;if(_0x2e612e[_0x7fd2('0x47')][_0x7fd2('0x54')]){_0x14b634[_0x7fd2('0x70')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7fd2('0x55')](_0x14b634);})[_0x7fd2('0x37')](function(_0x1d6d65){_0x5cf808[_0x7fd2('0x56')]=_0x1d6d65;return _0x5cf808;});}})[_0x7fd2('0x37')](respondWithFilteredResult(_0x548fb8,_0x14b634))[_0x7fd2('0x29')](handleError(_0x548fb8,null));};exports[_0x7fd2('0x71')]=function(_0x3ce4f1,_0x16c8ca,_0x160068){return db[_0x7fd2('0x41')][_0x7fd2('0x60')]({'where':{'id':_0x3ce4f1['params']['id']}})['then'](handleEntityNotFound(_0x16c8ca,null))[_0x7fd2('0x37')](function(_0x2e6bcc){if(_0x2e6bcc){return _0x2e6bcc[_0x7fd2('0x71')](_0x3ce4f1[_0x7fd2('0x47')][_0x7fd2('0x6b')]);}})[_0x7fd2('0x37')](respondWithStatusCode(_0x16c8ca,null))['catch'](handleError(_0x16c8ca,null));};exports[_0x7fd2('0x72')]=function(_0xb2dc7e,_0x26ad8f,_0x6405fb){var _0x50e6a2={'body':_0xb2dc7e[_0x7fd2('0x5b')],'channel':'openchannel'};var _0x4bfd2c=[];var _0x13fbfc=[];var _0x2c1c83={};var _0x3dc46b=![];return db[_0x7fd2('0x73')][_0x7fd2('0x63')]()['then'](function(_0x1e1df4){if(!_0x1e1df4){throw new db[(_0x7fd2('0x74'))][(_0x7fd2('0x75'))]('no\x20available\x20attributes');}_0x4bfd2c=_[_0x7fd2('0x76')](_[_0x7fd2('0x48')](_0x1e1df4),['createdAt',_0x7fd2('0x77')]);_0x13fbfc=_[_0x7fd2('0x76')](_['keys'](_0x1e1df4),[_0x7fd2('0x78'),_0x7fd2('0x77'),'CompanyId',_0x7fd2('0x79')]);if(_0xb2dc7e[_0x7fd2('0x5b')]['id']){delete _0xb2dc7e[_0x7fd2('0x5b')]['id'];}if(_[_0x7fd2('0x7a')](_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x7b')])){throw new db[(_0x7fd2('0x74'))][(_0x7fd2('0x75'))]('from\x20is\x20mandatory');}if(_[_0x7fd2('0x7a')](_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x5b')])||_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x5b')]===''){throw new db[(_0x7fd2('0x74'))][(_0x7fd2('0x75'))](_0x7fd2('0x7c'));}if(_[_0x7fd2('0x7a')](_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x7d')])){throw new db[(_0x7fd2('0x74'))][(_0x7fd2('0x75'))](_0x7fd2('0x7e')+_0x13fbfc);}if(!_[_0x7fd2('0x7f')](_0x13fbfc,_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x7d')])){throw new db[(_0x7fd2('0x74'))][(_0x7fd2('0x75'))](_0x7fd2('0x80')+_0x13fbfc);}_0x2c1c83[_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x7d')]]=_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x7b')];})[_0x7fd2('0x37')](function(){return db[_0x7fd2('0x41')][_0x7fd2('0x60')]({'where':{'id':_0xb2dc7e[_0x7fd2('0x58')]['id']},'include':[{'model':db[_0x7fd2('0x81')],'as':_0x7fd2('0x82'),'include':[{'model':db['CmContact'],'as':_0x7fd2('0x83'),'where':_0x2c1c83,'limit':0x1,'order':[[_0x7fd2('0x77'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x7fd2('0x37')](handleEntityNotFound(_0x26ad8f,null))[_0x7fd2('0x37')](function(_0x335882){if(_0x335882&&_0x335882[_0x7fd2('0x82')]){_0x50e6a2['account']=_0x335882;_0x50e6a2['applications']=_0x335882[_0x7fd2('0x84')];_0x50e6a2[_0x7fd2('0x85')]=_0x335882[_0x7fd2('0x82')];_0x50e6a2[_0x7fd2('0x86')]=_[_0x7fd2('0x87')](_0x50e6a2[_0x7fd2('0x86')],[_0x7fd2('0x88')],[_0x7fd2('0x89')]);if(_0x50e6a2['account'][_0x7fd2('0x84')]){delete _0x50e6a2[_0x7fd2('0x8a')][_0x7fd2('0x84')];}if(_0x50e6a2[_0x7fd2('0x8a')][_0x7fd2('0x82')]&&_0x50e6a2[_0x7fd2('0x8a')][_0x7fd2('0x82')]['Contacts']['length']){return _0x50e6a2[_0x7fd2('0x8a')][_0x7fd2('0x82')][_0x7fd2('0x83')][0x0];}var _0x4eef1b=_[_0x7fd2('0x8b')](_0xb2dc7e['body'],{'firstName':_0xb2dc7e[_0x7fd2('0x5b')]['from'],'ListId':_0x335882[_0x7fd2('0x79')]});_0x4eef1b[_0xb2dc7e['body'][_0x7fd2('0x7d')]]=_0xb2dc7e[_0x7fd2('0x5b')]['from'];return db[_0x7fd2('0x73')][_0x7fd2('0x5a')](_0x4eef1b,{'fields':_0x4bfd2c,'raw':!![]});}})['then'](handleEntityNotFound(_0x26ad8f,null))['then'](function(_0x2dd2a1){_0x50e6a2['contact']=_0x2dd2a1;if(_0x2dd2a1){var _0x3069ae={'ContactId':_0x2dd2a1['id'],'OpenchannelAccountId':_0xb2dc7e['params']['id'],'from':(_0x2dd2a1['firstName']||'')+'\x20'+(_0x2dd2a1[_0x7fd2('0x8c')]||'')};var _0x3425c0={'OpenchannelAccountId':_0xb2dc7e[_0x7fd2('0x58')]['id'],'closed':![]};if(_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x8d')]){_0x3425c0[_0x7fd2('0x8d')]=_0xb2dc7e['body'][_0x7fd2('0x8d')];return db[_0x7fd2('0x8e')]['find']({'where':_0x3425c0})['then'](function(_0x31497e){if(_0x31497e){return[_0x31497e,![]];}_0x3069ae[_0x7fd2('0x8d')]=_0xb2dc7e[_0x7fd2('0x5b')]['threadId'];_0x3069ae[_0x7fd2('0x8f')]=_0xb2dc7e['body']['externalUrl'];return db[_0x7fd2('0x8e')]['create'](_0x3069ae)[_0x7fd2('0x37')](function(_0x27daa5){return[_0x27daa5,!![]];});});}else{_0x3425c0[_0x7fd2('0x8d')]=null;}_0x3425c0[_0x7fd2('0x90')]=_0x2dd2a1['id'];return db[_0x7fd2('0x8e')][_0x7fd2('0x60')]({'where':_0x3425c0})[_0x7fd2('0x37')](function(_0x138e87){if(_0x138e87){return[_0x138e87,![]];}return db[_0x7fd2('0x8e')][_0x7fd2('0x5a')](_0x3069ae)[_0x7fd2('0x37')](function(_0x3bc113){return[_0x3bc113,!![]];});});}})[_0x7fd2('0x91')](function(_0x34eeb8,_0x2ab295){if(_0x34eeb8){_0x3dc46b=_0x2ab295;if(!_0x2ab295){var _0x45586f={'from':(_0x50e6a2['contact'][_0x7fd2('0x92')]||'')+'\x20'+(_0x50e6a2[_0x7fd2('0x93')][_0x7fd2('0x8c')]||'')};if(_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x8d')]&&_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x94')]&&_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x8d')]!=_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x94')]){_0x45586f[_0x7fd2('0x8d')]=_0xb2dc7e['body'][_0x7fd2('0x94')];}return _0x34eeb8[_0x7fd2('0x36')](_0x45586f);}else{return _0x34eeb8;}}})[_0x7fd2('0x37')](function(_0x268c47){_0x50e6a2[_0x7fd2('0x95')]=_0x268c47['get']({'plain':!![]});_0x50e6a2[_0x7fd2('0x95')][_0x7fd2('0x96')]=_0x3dc46b;if(_0x50e6a2[_0x7fd2('0x95')][_0x7fd2('0x96')]){if(_0x50e6a2[_0x7fd2('0x8a')]['autoclose']){_0x50e6a2[_0x7fd2('0x86')]['push']({'id':0x0,'priority':_0x50e6a2[_0x7fd2('0x86')][_0x7fd2('0x97')]+0x1,'app':_0x7fd2('0x98'),'appdata':_0x7fd2('0x99'),'interval':_0x7fd2('0x9a')});}}return db[_0x7fd2('0x9b')][_0x7fd2('0x5a')]({'body':_0xb2dc7e['body'][_0x7fd2('0x5b')],'OpenchannelAccountId':_0xb2dc7e[_0x7fd2('0x58')]['id'],'OpenchannelInteractionId':_0x268c47['id'],'direction':'in','ContactId':_0x50e6a2[_0x7fd2('0x93')]['id'],'AttachmentId':_0xb2dc7e[_0x7fd2('0x5b')][_0x7fd2('0x9c')]});})['then'](function(_0x6adc25){_0x50e6a2[_0x7fd2('0x26')]=_0x6adc25;if(_0x50e6a2['interaction'][_0x7fd2('0x9d')]){return db['User'][_0x7fd2('0x60')]({'attributes':['id',_0x7fd2('0x3c')],'where':{'id':_0x50e6a2[_0x7fd2('0x95')]['UserId']}})[_0x7fd2('0x37')](function(_0x76b21d){if(_0x76b21d){_0x50e6a2[_0x7fd2('0x86')][_0x7fd2('0x9e')]({'id':0x0,'priority':0x0,'app':_0x7fd2('0x9f'),'appdata':_0x76b21d['name']+','+(_0x50e6a2[_0x7fd2('0x8a')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x50e6a2[_0x7fd2('0xa0')]=![];}return respondWithRpcPromise(_0x7fd2('0xa1'),_0x7fd2('0xa2'),_0x50e6a2);});}return respondWithRpcPromise('Start',_0x7fd2('0xa2'),_0x50e6a2);})['then'](function(_0x2ae09c){respondWithRpcPromise(_0x7fd2('0xa3'),_0x7fd2('0xa3'),{'event':'notify','message':_0x2ae09c},client9002);return _0x2ae09c;})[_0x7fd2('0x37')](respondWithResult(_0x26ad8f,null))['catch'](handleError(_0x26ad8f,null));};exports['addApplications']=function(_0x78a2ca,_0x39557e){var _0x516fcd=_0x78a2ca[_0x7fd2('0x58')]['id'];var _0x36c1f8=_0x78a2ca['body'];var _0x523634=0xc8;var _0x517aad=null;return db[_0x7fd2('0xa4')][_0x7fd2('0xa5')]({'isolationLevel':db['sequelize']['Transaction'][_0x7fd2('0xa6')][_0x7fd2('0xa7')]},function(_0x866b25){return db[_0x7fd2('0x41')]['findOne']({'where':{'id':_0x516fcd},'transaction':_0x866b25})['then'](function(_0x28537d){if(_0x28537d){return db[_0x7fd2('0xa8')][_0x7fd2('0x3a')]({'where':{'OpenchannelAccountId':_0x516fcd},'transaction':_0x866b25})[_0x7fd2('0x37')](function(){var _0x5f16d3=_[_0x7fd2('0x40')](_0x36c1f8,function(_0x497f2d){_0x497f2d[_0x7fd2('0x64')]=_0x516fcd;return _0x497f2d;});return db[_0x7fd2('0xa8')][_0x7fd2('0xa9')](_0x5f16d3,{'transaction':_0x866b25});});}else{_0x523634=0x194;_0x517aad=[];}});})[_0x7fd2('0x37')](function(){if(_0x523634!==0x194){return db[_0x7fd2('0xa8')][_0x7fd2('0xaa')]({'where':{'OpenchannelAccountId':_0x516fcd},'order':_0x7fd2('0x88')})['then'](function(_0x50eb34){_0x517aad=_0x50eb34;});}})[_0x7fd2('0x29')](function(_0x2f5b0d){_0x523634=0x1f4;logger['error'](_0x2f5b0d[_0x7fd2('0x3b')]);if(_0x2f5b0d['name']){delete _0x2f5b0d['name'];}_0x517aad=_0x2f5b0d;})['finally'](function(){if(_0x517aad===null){_0x39557e[_0x7fd2('0x2a')](_0x523634);}else{if(_0x523634===0x1f4){_0x39557e[_0x7fd2('0x2b')](_0x523634)['send'](_0x517aad);}else{_0x39557e['status'](_0x523634)[_0x7fd2('0x2d')](_0x517aad);}}});};exports['getApplications']=function(_0x1163a4,_0x1be3bd,_0x2238bf){var _0x3f6194={};var _0x4338de={};var _0x299b53;var _0x42244d;return db[_0x7fd2('0x41')]['findOne']({'where':{'id':_0x1163a4[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x1be3bd,null))[_0x7fd2('0x37')](function(_0x25cde9){if(_0x25cde9){_0x299b53=_0x25cde9;_0x4338de[_0x7fd2('0x46')]=_[_0x7fd2('0x48')](db['OpenchannelApplication']['rawAttributes']);_0x4338de['query']=_[_0x7fd2('0x48')](_0x1163a4[_0x7fd2('0x47')]);_0x4338de[_0x7fd2('0x49')]=_[_0x7fd2('0x4a')](_0x4338de[_0x7fd2('0x46')],_0x4338de[_0x7fd2('0x47')]);_0x3f6194['attributes']=_[_0x7fd2('0x4a')](_0x4338de[_0x7fd2('0x46')],qs[_0x7fd2('0x4b')](_0x1163a4[_0x7fd2('0x47')][_0x7fd2('0x4b')]));_0x3f6194[_0x7fd2('0x4c')]=_0x3f6194[_0x7fd2('0x4c')]['length']?_0x3f6194[_0x7fd2('0x4c')]:_0x4338de[_0x7fd2('0x46')];_0x3f6194['order']=qs['sort'](_0x1163a4[_0x7fd2('0x47')][_0x7fd2('0x50')]);_0x3f6194[_0x7fd2('0x51')]=qs[_0x7fd2('0x49')](_[_0x7fd2('0x6f')](_0x1163a4[_0x7fd2('0x47')],_0x4338de[_0x7fd2('0x49')]));if(_0x1163a4['query'][_0x7fd2('0x68')]){_0x3f6194[_0x7fd2('0x51')]=_[_0x7fd2('0x52')](_0x3f6194['where'],{'$or':_['map'](_0x3f6194['attributes'],function(_0x743dd4){var _0x24021f={};_0x24021f[_0x743dd4]={'$like':'%'+_0x1163a4[_0x7fd2('0x47')][_0x7fd2('0x68')]+'%'};return _0x24021f;})});}_0x3f6194=_[_0x7fd2('0x52')]({},_0x3f6194,_0x1163a4[_0x7fd2('0x69')]);return _0x299b53['getApplications'](_0x3f6194);}})['then'](function(_0x9eb936){if(_0x9eb936){_0x42244d=_0x9eb936[_0x7fd2('0x97')];if(!_0x1163a4['query']['hasOwnProperty'](_0x7fd2('0x4e'))){_0x3f6194[_0x7fd2('0x31')]=qs[_0x7fd2('0x31')](_0x1163a4['query']['limit']);_0x3f6194['offset']=qs[_0x7fd2('0x2e')](_0x1163a4[_0x7fd2('0x47')][_0x7fd2('0x2e')]);}return _0x299b53[_0x7fd2('0xab')](_0x3f6194);}})[_0x7fd2('0x37')](function(_0x43258b){if(_0x43258b){return _0x43258b?{'count':_0x42244d,'rows':_0x43258b}:null;}})['then'](respondWithResult(_0x1be3bd,null))[_0x7fd2('0x29')](handleError(_0x1be3bd,null));};exports['getInteractions']=function(_0x4fe15f,_0x5d4b97,_0xef93a7){var _0x4e7517={'raw':![],'where':{}};var _0x3520a2={};var _0x29af21={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7fd2('0x66')]({'where':{'id':_0x4fe15f[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x5d4b97,null))[_0x7fd2('0x37')](function(_0x3b03f2){if(_0x3b03f2){_0x3520a2[_0x7fd2('0x46')]=_[_0x7fd2('0x48')](db['OpenchannelInteraction'][_0x7fd2('0x42')]);_0x3520a2[_0x7fd2('0x47')]=_[_0x7fd2('0x48')](_0x4fe15f[_0x7fd2('0x47')]);_0x3520a2['filters']=_['intersection'](_0x3520a2[_0x7fd2('0x46')],_0x3520a2['query']);_0x4e7517[_0x7fd2('0x4c')]=_[_0x7fd2('0x4a')](_0x3520a2[_0x7fd2('0x46')],qs['fields'](_0x4fe15f[_0x7fd2('0x47')]['fields']));_0x4e7517[_0x7fd2('0x4c')]=_0x4e7517[_0x7fd2('0x4c')][_0x7fd2('0x97')]?_0x4e7517[_0x7fd2('0x4c')]:_0x3520a2[_0x7fd2('0x46')];if(!_0x4fe15f['query'][_0x7fd2('0x4d')]('nolimit')){_0x4e7517['limit']=qs[_0x7fd2('0x31')](_0x4fe15f[_0x7fd2('0x47')][_0x7fd2('0x31')]);_0x4e7517[_0x7fd2('0x2e')]=qs[_0x7fd2('0x2e')](_0x4fe15f[_0x7fd2('0x47')][_0x7fd2('0x2e')]);}_0x4e7517[_0x7fd2('0x4f')]=qs[_0x7fd2('0x50')](_0x4fe15f[_0x7fd2('0x47')][_0x7fd2('0x50')]);_0x4e7517[_0x7fd2('0x51')]=qs['filters'](_['pick'](_0x4fe15f[_0x7fd2('0x47')],_0x3520a2[_0x7fd2('0x49')]));_0x4e7517['where'][_0x7fd2('0x64')]=_0x3b03f2['id'];if(_0x4fe15f[_0x7fd2('0x47')][_0x7fd2('0x68')]){_0x4e7517[_0x7fd2('0x51')]=_[_0x7fd2('0x52')](_0x4e7517[_0x7fd2('0x51')],{'$or':_[_0x7fd2('0x40')](_0x4e7517['attributes'],function(_0x40c23f){var _0x3d4d4d={};_0x3d4d4d[_0x40c23f]={'$like':'%'+_0x4fe15f['query'][_0x7fd2('0x68')]+'%'};return _0x3d4d4d;})});}_0x4e7517=_[_0x7fd2('0x52')]({},_0x4e7517,_0x4fe15f[_0x7fd2('0x69')]);return db[_0x7fd2('0x8e')][_0x7fd2('0x30')]({'where':_0x4e7517['where']})[_0x7fd2('0x37')](function(_0x12b832){_0x29af21[_0x7fd2('0x30')]=_0x12b832;if(_0x4fe15f['query'][_0x7fd2('0x54')]){_0x4e7517[_0x7fd2('0x70')]=[{'model':db[_0x7fd2('0x73')],'as':_0x7fd2('0xac'),'required':![]},{'model':db[_0x7fd2('0xad')],'as':_0x7fd2('0xae'),'attributes':['name',_0x7fd2('0xaf'),'internal'],'required':![]},{'model':db[_0x7fd2('0xb0')],'as':_0x7fd2('0xb1'),'attributes':['id',_0x7fd2('0x3c'),_0x7fd2('0xb2')],'where':_0x4fe15f[_0x7fd2('0x47')]['tag']?{'id':_0x4fe15f['query']['tag']}:undefined,'required':_0x4fe15f[_0x7fd2('0x47')]['tag']?!![]:![]}];}return db[_0x7fd2('0x8e')][_0x7fd2('0x55')](_0x4e7517);})[_0x7fd2('0x37')](function(_0x1956a7){_0x29af21['rows']=_0x1956a7;return _0x29af21;});}})['then'](respondWithFilteredResult(_0x5d4b97,_0x4e7517))[_0x7fd2('0x29')](handleError(_0x5d4b97,null));};exports[_0x7fd2('0xb3')]=function(_0x397e5e,_0x4f0fa8,_0x2f25a3){return db[_0x7fd2('0x41')]['find']({'where':{'id':_0x397e5e[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x4f0fa8,null))['then'](function(_0x42a759){if(_0x42a759){return _0x42a759['addAgents'](_0x397e5e[_0x7fd2('0x5b')]['ids'],_[_0x7fd2('0xb4')](_0x397e5e[_0x7fd2('0x5b')],['ids','id'])||{})['spread'](function(_0x32d448){for(var _0x3eb206=0x0;_0x3eb206<_0x397e5e[_0x7fd2('0x5b')][_0x7fd2('0x6b')][_0x7fd2('0x97')];_0x3eb206+=0x1){socket[_0x7fd2('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x397e5e[_0x7fd2('0x5b')][_0x7fd2('0x6b')][_0x3eb206]),'OpenchannelAccountId':Number(_0x397e5e[_0x7fd2('0x58')]['id'])});}return _0x32d448;});}})['then'](respondWithResult(_0x4f0fa8,null))['catch'](handleError(_0x4f0fa8,null));};exports['removeAgents']=function(_0x4836e8,_0x5de8cd,_0x43ffea){return db[_0x7fd2('0x41')][_0x7fd2('0x60')]({'where':{'id':_0x4836e8[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x5de8cd,null))[_0x7fd2('0x37')](function(_0x4fadfe){if(_0x4fadfe){return _0x4fadfe['removeAgents'](_0x4836e8['query'][_0x7fd2('0x6b')])[_0x7fd2('0x37')](function(){if(_[_0x7fd2('0xb6')](_0x4836e8['query'][_0x7fd2('0x6b')])){for(var _0x3714f3=0x0;_0x3714f3<_0x4836e8[_0x7fd2('0x47')][_0x7fd2('0x6b')]['length'];_0x3714f3+=0x1){socket['emit'](_0x7fd2('0xb7'),{'UserId':Number(_0x4836e8[_0x7fd2('0x47')][_0x7fd2('0x6b')][_0x3714f3]),'OpenchannelAccountId':Number(_0x4836e8['params']['id'])});}}else{socket[_0x7fd2('0xb5')](_0x7fd2('0xb7'),{'UserId':Number(_0x4836e8[_0x7fd2('0x47')][_0x7fd2('0x6b')]),'OpenchannelAccountId':Number(_0x4836e8['params']['id'])});}});}})[_0x7fd2('0x37')](respondWithStatusCode(_0x5de8cd,null))[_0x7fd2('0x29')](handleError(_0x5de8cd,null));};exports[_0x7fd2('0xb8')]=function(_0x316ed1,_0x2846fd,_0x335739){var _0x44921c={};var _0x1985d5={};var _0x31fa85;var _0x4194b1;return db[_0x7fd2('0x41')]['findOne']({'where':{'id':_0x316ed1['params']['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x2846fd,null))[_0x7fd2('0x37')](function(_0x4220fe){if(_0x4220fe){_0x31fa85=_0x4220fe;_0x1985d5['model']=_[_0x7fd2('0x48')](db[_0x7fd2('0xad')][_0x7fd2('0x42')]);_0x1985d5[_0x7fd2('0x47')]=_[_0x7fd2('0x48')](_0x316ed1[_0x7fd2('0x47')]);_0x1985d5[_0x7fd2('0x49')]=_[_0x7fd2('0x4a')](_0x1985d5[_0x7fd2('0x46')],_0x1985d5[_0x7fd2('0x47')]);_0x44921c[_0x7fd2('0x4c')]=_[_0x7fd2('0x4a')](_0x1985d5[_0x7fd2('0x46')],qs['fields'](_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x4b')]));_0x44921c['attributes']=_0x44921c[_0x7fd2('0x4c')][_0x7fd2('0x97')]?_0x44921c[_0x7fd2('0x4c')]:_0x1985d5[_0x7fd2('0x46')];_0x44921c['order']=qs[_0x7fd2('0x50')](_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x50')]);_0x44921c['where']=qs[_0x7fd2('0x49')](_[_0x7fd2('0x6f')](_0x316ed1['query'],_0x1985d5[_0x7fd2('0x49')]));if(_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x68')]){_0x44921c['where']=_[_0x7fd2('0x52')](_0x44921c['where'],{'$or':_[_0x7fd2('0x40')](_0x44921c[_0x7fd2('0x4c')],function(_0x415b56){var _0x5d765a={};_0x5d765a[_0x415b56]={'$like':'%'+_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x68')]+'%'};return _0x5d765a;})});}_0x44921c=_[_0x7fd2('0x52')]({},_0x44921c,_0x316ed1[_0x7fd2('0x69')]);return _0x31fa85[_0x7fd2('0xb8')](_0x44921c);}})[_0x7fd2('0x37')](function(_0x4cb4ee){if(_0x4cb4ee){_0x4194b1=_0x4cb4ee[_0x7fd2('0x97')];if(!_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x4d')](_0x7fd2('0x4e'))){_0x44921c[_0x7fd2('0x31')]=qs[_0x7fd2('0x31')](_0x316ed1['query'][_0x7fd2('0x31')]);_0x44921c[_0x7fd2('0x2e')]=qs['offset'](_0x316ed1[_0x7fd2('0x47')][_0x7fd2('0x2e')]);}return _0x31fa85[_0x7fd2('0xb8')](_0x44921c);}})[_0x7fd2('0x37')](function(_0xdb8d66){if(_0xdb8d66){return _0xdb8d66?{'count':_0x4194b1,'rows':_0xdb8d66}:null;}})['then'](respondWithResult(_0x2846fd,null))[_0x7fd2('0x29')](handleError(_0x2846fd,null));};exports[_0x7fd2('0x3d')]=function(_0x2b8fc8,_0x536d4c,_0x3b30d9){var _0x4ba913,_0x331eb3,_0x29eee3;if(_[_0x7fd2('0x7a')](_0x2b8fc8[_0x7fd2('0x5b')][_0x7fd2('0x5b')])||_0x2b8fc8[_0x7fd2('0x5b')][_0x7fd2('0x5b')]===''){throw new db[(_0x7fd2('0x74'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7fd2('0x7a')](_0x2b8fc8['body']['to'])){}_0x4ba913=_0x2b8fc8[_0x7fd2('0x5b')]['to'];return db[_0x7fd2('0x41')][_0x7fd2('0x66')]({'where':{'id':_0x2b8fc8[_0x7fd2('0x58')]['id']}})[_0x7fd2('0x37')](handleEntityNotFound(_0x536d4c,null))[_0x7fd2('0x37')](function(_0x10134d){if(_0x10134d){return db[_0x7fd2('0x41')][_0x7fd2('0x60')]({'where':{'id':_0x10134d['id']},'include':[{'model':db[_0x7fd2('0x81')],'as':_0x7fd2('0x82'),'include':[{'model':db['CmContact'],'as':_0x7fd2('0x83'),'where':{[_0x10134d['mapKey']]:_0x4ba913},'limit':0x1,'order':[[_0x7fd2('0x77'),_0x7fd2('0xb9')]]}]}]})[_0x7fd2('0x37')](handleEntityNotFound(_0x536d4c,null))['then'](function(_0x342a43){if(_0x342a43&&_0x342a43[_0x7fd2('0x82')]){_0x331eb3=_0x342a43[_0x7fd2('0x38')]({'plain':!![]});if(_0x331eb3['List']&&_0x331eb3[_0x7fd2('0x82')]['Contacts'][_0x7fd2('0x97')]){return _0x331eb3[_0x7fd2('0x82')][_0x7fd2('0x83')][0x0];}return db[_0x7fd2('0x73')][_0x7fd2('0x5a')](_[_0x7fd2('0x8b')](_0x2b8fc8['body'],{'firstName':_0x4ba913,[_0x342a43[_0x7fd2('0x7d')]]:_0x4ba913,'phone':_0x4ba913,'ListId':_0x331eb3[_0x7fd2('0x79')]}));}})[_0x7fd2('0x37')](handleEntityNotFound(_0x536d4c,null))[_0x7fd2('0x37')](function(_0x5d595f){if(_0x5d595f){_0x29eee3=_0x5d595f;return db[_0x7fd2('0x8e')]['find']({'where':{'ContactId':_0x29eee3['id'],'closed':![],'OpenchannelAccountId':_0x331eb3['id']}})[_0x7fd2('0x37')](function(_0x21cb5e){if(_0x21cb5e){return[_0x21cb5e,![]];}return db['OpenchannelInteraction'][_0x7fd2('0x5a')]({'UserId':_0x2b8fc8['user']['id'],'ContactId':_0x29eee3['id'],'OpenchannelAccountId':_0x331eb3['id'],'lastMsgDirection':_0x7fd2('0xba'),'Messages':[_[_0x7fd2('0x52')](_0x2b8fc8[_0x7fd2('0x5b')],{'read':![],'body':_0x2b8fc8[_0x7fd2('0x5b')][_0x7fd2('0x5b')],'OpenchannelAccountId':_0x331eb3['id'],'UserId':_0x2b8fc8[_0x7fd2('0x5e')]['id'],'ContactId':_0x29eee3['id']})]},{'include':[{'model':db[_0x7fd2('0x9b')],'as':_0x7fd2('0xbb')}]})[_0x7fd2('0x37')](function(_0x38d45c){return[_0x38d45c,!![]];});});}})[_0x7fd2('0x91')](function(_0x5a72fa,_0x5eb0f6){if(_0x5eb0f6){return _0x5a72fa;}return db[_0x7fd2('0x9b')][_0x7fd2('0x5a')](_[_0x7fd2('0x52')](_0x2b8fc8[_0x7fd2('0x5b')],{'read':![],'body':_0x2b8fc8['body']['body'],'OpenchannelAccountId':_0x331eb3['id'],'OpenchannelInteractionId':_0x5a72fa['id'],'UserId':_0x2b8fc8[_0x7fd2('0x5e')]['id'],'ContactId':_0x29eee3['id']}))['then'](function(_0x23b3b5){_0x5a72fa[_0x7fd2('0xbc')][_0x7fd2('0xbb')]=[];_0x5a72fa[_0x7fd2('0xbc')][_0x7fd2('0xbb')][_0x7fd2('0xbd')](_0x23b3b5['dataValues']);return _0x5a72fa;});});}})[_0x7fd2('0x37')](respondWithResult(_0x536d4c,null))[_0x7fd2('0x29')](handleError(_0x536d4c,null));}; \ No newline at end of file +var _0xbc70=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','then','get','UserProfileResource','destroy','name','index','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','OpenchannelAccountId','getDispositions','findOne','rawAttributes','options','Disposition','removeDispositions','ids','getAnswers','CannedAnswer','length','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','OpenchannelApplication','Applications','list','applications','priority','asc','account','ListId','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','stack','finally','sendStatus','send','getApplications','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','eml-format','rimraf'];(function(_0x4a0058,_0x413446){var _0x1e0db0=function(_0x37e952){while(--_0x37e952){_0x4a0058['push'](_0x4a0058['shift']());}};_0x1e0db0(++_0x413446);}(_0xbc70,0xbc));var _0x0bc7=function(_0x361009,_0x33a618){_0x361009=_0x361009-0x0;var _0x53ec33=_0xbc70[_0x361009];return _0x53ec33;};'use strict';var emlformat=require(_0x0bc7('0x0'));var rimraf=require(_0x0bc7('0x1'));var zipdir=require(_0x0bc7('0x2'));var jsonpatch=require(_0x0bc7('0x3'));var rp=require(_0x0bc7('0x4'));var moment=require('moment');var BPromise=require(_0x0bc7('0x5'));var Mustache=require(_0x0bc7('0x6'));var util=require(_0x0bc7('0x7'));var path=require(_0x0bc7('0x8'));var sox=require(_0x0bc7('0x9'));var csv=require('to-csv');var ejs=require(_0x0bc7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0bc7('0xb'));var deskjs=require(_0x0bc7('0xc'));var toCsv=require(_0x0bc7('0xd'));var querystring=require(_0x0bc7('0xe'));var Papa=require(_0x0bc7('0xf'));var Redis=require(_0x0bc7('0x10'));var authService=require(_0x0bc7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0bc7('0x12'));var hardwareService=require(_0x0bc7('0x13'));var logger=require(_0x0bc7('0x14'))('api');var utils=require(_0x0bc7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0bc7('0x16'));var db=require('../../mysqldb')['db'];config[_0x0bc7('0x17')]=_[_0x0bc7('0x18')](config[_0x0bc7('0x17')],{'host':_0x0bc7('0x19'),'port':0x18eb});var socket=require(_0x0bc7('0x1a'))(new Redis(config['redis']));require(_0x0bc7('0x1b'))[_0x0bc7('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0bc7('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47ed3e,_0x4b157e,_0x4e54fe,_0x42592b){return new BPromise(function(_0xcf6d81,_0x311c1d){var _0x536df7=_0x42592b||client;return _0x536df7['request'](_0x47ed3e,_0x4e54fe)['then'](function(_0x52b1e2){logger[_0x0bc7('0x1e')](_0x0bc7('0x1f'),_0x4b157e,'request\x20sent');logger[_0x0bc7('0x20')](_0x0bc7('0x21'),_0x4b157e,'request\x20sent',JSON[_0x0bc7('0x22')](_0x52b1e2));if(_0x52b1e2[_0x0bc7('0x23')]){if(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x24')]===0x1f4){logger[_0x0bc7('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b157e,_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);return _0x311c1d(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);}logger[_0x0bc7('0x23')](_0x0bc7('0x1f'),_0x4b157e,_0x52b1e2['error'][_0x0bc7('0x25')]);return _0xcf6d81(_0x52b1e2[_0x0bc7('0x23')][_0x0bc7('0x25')]);}else{logger['info'](_0x0bc7('0x1f'),_0x4b157e,_0x0bc7('0x26'));_0xcf6d81(_0x52b1e2[_0x0bc7('0x27')][_0x0bc7('0x25')]);}})[_0x0bc7('0x28')](function(_0x1497f4){logger[_0x0bc7('0x23')](_0x0bc7('0x1f'),_0x4b157e,_0x1497f4);_0x311c1d(_0x1497f4);});});}function respondWithStatusCode(_0x4295f5,_0x5028c1){_0x5028c1=_0x5028c1||0xcc;return function(_0x4fc777){if(_0x4fc777){return _0x4295f5['sendStatus'](_0x5028c1);}return _0x4295f5['status'](_0x5028c1)[_0x0bc7('0x29')]();};}function respondWithResult(_0x55e354,_0x3ef3ea){_0x3ef3ea=_0x3ef3ea||0xc8;return function(_0x5745ab){if(_0x5745ab){return _0x55e354[_0x0bc7('0x2a')](_0x3ef3ea)[_0x0bc7('0x2b')](_0x5745ab);}};}function respondWithFilteredResult(_0x5dedf6,_0x14bab6){return function(_0x41c3aa){if(_0x41c3aa){var _0x439378=typeof _0x14bab6[_0x0bc7('0x2c')]===_0x0bc7('0x2d')&&typeof _0x14bab6['limit']===_0x0bc7('0x2d');var _0x5a7249=_0x41c3aa['count'];var _0x5aa9cc=_0x439378?0x0:_0x14bab6[_0x0bc7('0x2c')];var _0x334dbe=_0x439378?_0x41c3aa[_0x0bc7('0x2e')]:_0x14bab6[_0x0bc7('0x2c')]+_0x14bab6[_0x0bc7('0x2f')];var _0x358d9e;if(_0x334dbe>=_0x5a7249){_0x334dbe=_0x5a7249;_0x358d9e=0xc8;}else{_0x358d9e=0xce;}_0x5dedf6[_0x0bc7('0x2a')](_0x358d9e);return _0x5dedf6[_0x0bc7('0x30')](_0x0bc7('0x31'),_0x5aa9cc+'-'+_0x334dbe+'/'+_0x5a7249)[_0x0bc7('0x2b')](_0x41c3aa);}return null;};}function patchUpdates(_0x195ac0){return function(_0x23039c){try{jsonpatch['apply'](_0x23039c,_0x195ac0,!![]);}catch(_0x4d66d3){return BPromise[_0x0bc7('0x32')](_0x4d66d3);}return _0x23039c['save']();};}function saveUpdates(_0x5896cc,_0x4586f5){return function(_0xfb41ac){if(_0xfb41ac){return _0xfb41ac['update'](_0x5896cc)[_0x0bc7('0x33')](function(_0x1cd001){return _0x1cd001;});}return null;};}function removeEntity(_0x512c1d,_0x4f2acf){return function(_0x3380d9){if(_0x3380d9){return _0x3380d9['destroy']()[_0x0bc7('0x33')](function(){var _0x3e9ba8=_0x3380d9[_0x0bc7('0x34')]({'plain':!![]});var _0x4198ce='OpenchannelAccounts';return db[_0x0bc7('0x35')][_0x0bc7('0x36')]({'where':{'type':_0x4198ce,'resourceId':_0x3e9ba8['id']}})[_0x0bc7('0x33')](function(){return _0x3380d9;});})[_0x0bc7('0x33')](function(){_0x512c1d[_0x0bc7('0x2a')](0xcc)[_0x0bc7('0x29')]();});}};}function handleEntityNotFound(_0x594c8e,_0x4fabee){return function(_0x38b132){if(!_0x38b132){_0x594c8e['sendStatus'](0x194);}return _0x38b132;};}function handleError(_0x5c0e40,_0x26d7b9){_0x26d7b9=_0x26d7b9||0x1f4;return function(_0x1e46cb){logger[_0x0bc7('0x23')](_0x1e46cb['stack']);if(_0x1e46cb[_0x0bc7('0x37')]){delete _0x1e46cb[_0x0bc7('0x37')];}_0x5c0e40[_0x0bc7('0x2a')](_0x26d7b9)['send'](_0x1e46cb);};}exports[_0x0bc7('0x38')]=function(_0x310787,_0x5bdf00){var _0x579ba6={'include':[{'model':db['Pause'],'as':_0x0bc7('0x39')}]},_0x38b567={},_0x23eb8f={'count':0x0,'rows':[]};var _0x19e859=_[_0x0bc7('0x3a')](db[_0x0bc7('0x3b')]['rawAttributes'],function(_0x25dab1){return{'name':_0x25dab1['fieldName'],'type':_0x25dab1[_0x0bc7('0x3c')][_0x0bc7('0x3d')]};});_0x38b567[_0x0bc7('0x3e')]=_[_0x0bc7('0x3a')](_0x19e859,_0x0bc7('0x37'));_0x38b567['query']=_[_0x0bc7('0x3f')](_0x310787[_0x0bc7('0x40')]);_0x38b567[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x38b567['model'],_0x38b567['query']);_0x579ba6[_0x0bc7('0x43')]=_[_0x0bc7('0x42')](_0x38b567[_0x0bc7('0x3e')],qs[_0x0bc7('0x44')](_0x310787['query']['fields']));_0x579ba6[_0x0bc7('0x43')]=_0x579ba6[_0x0bc7('0x43')]['length']?_0x579ba6[_0x0bc7('0x43')]:_0x38b567[_0x0bc7('0x3e')];if(!_0x310787['query'][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x579ba6[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x310787['query']['limit']);_0x579ba6[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x310787['query'][_0x0bc7('0x2c')]);}_0x579ba6[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0x310787[_0x0bc7('0x40')][_0x0bc7('0x48')]);_0x579ba6[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x310787['query'],_0x38b567['filters']),_0x19e859);if(_0x310787['query'][_0x0bc7('0x4b')]){_0x579ba6[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x579ba6[_0x0bc7('0x49')],{'$or':_[_0x0bc7('0x3a')](_0x19e859,function(_0x433577){if(_0x433577['type']!==_0x0bc7('0x4d')){var _0x95e572={};_0x95e572[_0x433577[_0x0bc7('0x37')]]={'$like':'%'+_0x310787[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x95e572;}})});}_0x579ba6=_[_0x0bc7('0x4c')]({},_0x579ba6,_0x310787['options']);var _0x5a51f7={'where':_0x579ba6['where']};return db[_0x0bc7('0x3b')][_0x0bc7('0x2e')](_0x5a51f7)[_0x0bc7('0x33')](function(_0x4c5c54){_0x23eb8f['count']=_0x4c5c54;if(_0x310787[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x579ba6[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x3b')][_0x0bc7('0x50')](_0x579ba6);})[_0x0bc7('0x33')](function(_0x4c215a){_0x23eb8f[_0x0bc7('0x51')]=_0x4c215a;return _0x23eb8f;})[_0x0bc7('0x33')](respondWithFilteredResult(_0x5bdf00,_0x579ba6))['catch'](handleError(_0x5bdf00,null));};exports[_0x0bc7('0x52')]=function(_0xa85efb,_0x42a3ec){var _0x2326c6={'raw':![],'where':{'id':_0xa85efb[_0x0bc7('0x53')]['id']},'include':[{'model':db[_0x0bc7('0x54')],'as':_0x0bc7('0x39')}]},_0x8d8a8f={};_0x8d8a8f['model']=_['keys'](db[_0x0bc7('0x3b')]['rawAttributes']);_0x8d8a8f[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0xa85efb[_0x0bc7('0x40')]);_0x8d8a8f[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x8d8a8f[_0x0bc7('0x3e')],_0x8d8a8f[_0x0bc7('0x40')]);_0x2326c6[_0x0bc7('0x43')]=_['intersection'](_0x8d8a8f['model'],qs[_0x0bc7('0x44')](_0xa85efb[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x2326c6[_0x0bc7('0x43')]=_0x2326c6[_0x0bc7('0x43')]['length']?_0x2326c6['attributes']:_0x8d8a8f[_0x0bc7('0x3e')];if(_0xa85efb[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x2326c6[_0x0bc7('0x4f')]=[{'all':!![]}];}_0x2326c6=_['merge']({},_0x2326c6,_0xa85efb['options']);return db['OpenchannelAccount'][_0x0bc7('0x55')](_0x2326c6)[_0x0bc7('0x33')](handleEntityNotFound(_0x42a3ec,null))[_0x0bc7('0x33')](respondWithResult(_0x42a3ec,null))[_0x0bc7('0x28')](handleError(_0x42a3ec,null));};exports['create']=function(_0x465853,_0x48fb64){return db[_0x0bc7('0x3b')]['create'](_0x465853[_0x0bc7('0x56')],{})[_0x0bc7('0x33')](function(_0x146898){var _0x4b4725=_0x465853[_0x0bc7('0x57')][_0x0bc7('0x34')]({'plain':!![]});if(!_0x4b4725)throw new Error(_0x0bc7('0x58'));if(_0x4b4725['role']===_0x0bc7('0x57')){var _0x32a24a=_0x146898[_0x0bc7('0x34')]({'plain':!![]});var _0x3be2b5=_0x0bc7('0x59');return db['UserProfileSection'][_0x0bc7('0x55')]({'where':{'name':_0x3be2b5,'userProfileId':_0x4b4725[_0x0bc7('0x5a')]},'raw':!![]})[_0x0bc7('0x33')](function(_0x24c16d){if(_0x24c16d&&_0x24c16d[_0x0bc7('0x5b')]===0x0){return db[_0x0bc7('0x35')][_0x0bc7('0x5c')]({'name':_0x32a24a[_0x0bc7('0x37')],'resourceId':_0x32a24a['id'],'type':_0x24c16d[_0x0bc7('0x37')],'sectionId':_0x24c16d['id']},{})['then'](function(){return _0x146898;});}else{return _0x146898;}})[_0x0bc7('0x28')](function(_0x2879fe){logger[_0x0bc7('0x23')](_0x0bc7('0x5d'),_0x2879fe);throw _0x2879fe;});}return _0x146898;})[_0x0bc7('0x33')](respondWithResult(_0x48fb64,0xc9))['catch'](handleError(_0x48fb64,null));};exports[_0x0bc7('0x5e')]=function(_0x4aac07,_0x2f893c){if(_0x4aac07[_0x0bc7('0x56')]['id']){delete _0x4aac07['body']['id'];}return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x4aac07['params']['id']},'include':[{'model':db[_0x0bc7('0x54')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2f893c,null))[_0x0bc7('0x33')](saveUpdates(_0x4aac07['body'],null))['then'](respondWithResult(_0x2f893c,null))[_0x0bc7('0x28')](handleError(_0x2f893c,null));};exports[_0x0bc7('0x36')]=function(_0x14d12f,_0x25fbd1){return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x14d12f['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x25fbd1,null))[_0x0bc7('0x33')](removeEntity(_0x25fbd1,null))[_0x0bc7('0x28')](handleError(_0x25fbd1,null));};exports[_0x0bc7('0x5f')]=function(_0x25820e,_0x18739c){return db[_0x0bc7('0x3b')][_0x0bc7('0x5f')]()[_0x0bc7('0x33')](respondWithResult(_0x18739c,null))[_0x0bc7('0x28')](handleError(_0x18739c,null));};exports['addDisposition']=function(_0x160742,_0x71d418,_0x3d946d){if(_0x160742['body']['id']){delete _0x160742[_0x0bc7('0x56')]['id'];}return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0x160742[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x71d418,null))[_0x0bc7('0x33')](function(_0x718c4f){if(_0x718c4f){_0x160742[_0x0bc7('0x56')][_0x0bc7('0x60')]=_0x718c4f['id'];return db['Disposition'][_0x0bc7('0x5c')](_0x160742[_0x0bc7('0x56')]);}})[_0x0bc7('0x33')](respondWithResult(_0x71d418,null))[_0x0bc7('0x28')](handleError(_0x71d418,null));};exports[_0x0bc7('0x61')]=function(_0x1e95cc,_0x339604,_0xa01c75){var _0x9ae3eb={'raw':![],'where':{}};var _0x1ded20={};var _0x327098={'count':0x0,'rows':[]};return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x1e95cc['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x339604,null))['then'](function(_0x3ab928){if(_0x3ab928){_0x1ded20['model']=_['keys'](db['Disposition'][_0x0bc7('0x63')]);_0x1ded20['query']=_[_0x0bc7('0x3f')](_0x1e95cc[_0x0bc7('0x40')]);_0x1ded20[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x1ded20['model'],_0x1ded20['query']);_0x9ae3eb['attributes']=_[_0x0bc7('0x42')](_0x1ded20[_0x0bc7('0x3e')],qs['fields'](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x9ae3eb[_0x0bc7('0x43')]=_0x9ae3eb[_0x0bc7('0x43')]['length']?_0x9ae3eb['attributes']:_0x1ded20[_0x0bc7('0x3e')];if(!_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x9ae3eb[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x9ae3eb[_0x0bc7('0x2c')]=qs['offset'](_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x2c')]);}_0x9ae3eb[_0x0bc7('0x47')]=qs['sort'](_0x1e95cc[_0x0bc7('0x40')]['sort']);_0x9ae3eb[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x1e95cc[_0x0bc7('0x40')],_0x1ded20['filters']));_0x9ae3eb[_0x0bc7('0x49')]['OpenchannelAccountId']=_0x3ab928['id'];if(_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x9ae3eb[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x9ae3eb['where'],{'$or':_[_0x0bc7('0x3a')](_0x9ae3eb[_0x0bc7('0x43')],function(_0x5893e9){var _0x56b194={};_0x56b194[_0x5893e9]={'$like':'%'+_0x1e95cc[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x56b194;})});}_0x9ae3eb=_[_0x0bc7('0x4c')]({},_0x9ae3eb,_0x1e95cc[_0x0bc7('0x64')]);return db['Disposition'][_0x0bc7('0x2e')]({'where':_0x9ae3eb[_0x0bc7('0x49')]})[_0x0bc7('0x33')](function(_0x4a2c68){_0x327098['count']=_0x4a2c68;if(_0x1e95cc['query']['includeAll']){_0x9ae3eb[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x65')][_0x0bc7('0x50')](_0x9ae3eb);})[_0x0bc7('0x33')](function(_0x2293d6){_0x327098[_0x0bc7('0x51')]=_0x2293d6;return _0x327098;});}})['then'](respondWithFilteredResult(_0x339604,_0x9ae3eb))[_0x0bc7('0x28')](handleError(_0x339604,null));};exports['removeDispositions']=function(_0x4788b3,_0x241bef,_0x5e16eb){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x4788b3[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x241bef,null))[_0x0bc7('0x33')](function(_0x45251f){if(_0x45251f){return _0x45251f[_0x0bc7('0x66')](_0x4788b3[_0x0bc7('0x40')][_0x0bc7('0x67')]);}})['then'](respondWithStatusCode(_0x241bef,null))[_0x0bc7('0x28')](handleError(_0x241bef,null));};exports['addAnswer']=function(_0x30091f,_0x2facd4,_0x29ccd2){if(_0x30091f[_0x0bc7('0x56')]['id']){delete _0x30091f[_0x0bc7('0x56')]['id'];}return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x30091f['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x2facd4,null))[_0x0bc7('0x33')](function(_0x1f1a23){if(_0x1f1a23){_0x30091f[_0x0bc7('0x56')]['OpenchannelAccountId']=_0x1f1a23['id'];return db['CannedAnswer']['create'](_0x30091f[_0x0bc7('0x56')]);}})[_0x0bc7('0x33')](respondWithResult(_0x2facd4,null))[_0x0bc7('0x28')](handleError(_0x2facd4,null));};exports[_0x0bc7('0x68')]=function(_0xd1db45,_0x1c41fd,_0x515689){var _0x396d27={'raw':![],'where':{}};var _0x471705={};var _0x2694d1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0xd1db45[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x1c41fd,null))['then'](function(_0xa4156){if(_0xa4156){_0x471705['model']=_[_0x0bc7('0x3f')](db[_0x0bc7('0x69')]['rawAttributes']);_0x471705['query']=_[_0x0bc7('0x3f')](_0xd1db45['query']);_0x471705[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x471705['model'],_0x471705[_0x0bc7('0x40')]);_0x396d27[_0x0bc7('0x43')]=_[_0x0bc7('0x42')](_0x471705['model'],qs[_0x0bc7('0x44')](_0xd1db45[_0x0bc7('0x40')]['fields']));_0x396d27['attributes']=_0x396d27[_0x0bc7('0x43')][_0x0bc7('0x6a')]?_0x396d27['attributes']:_0x471705[_0x0bc7('0x3e')];if(!_0xd1db45[_0x0bc7('0x40')]['hasOwnProperty']('nolimit')){_0x396d27['limit']=qs[_0x0bc7('0x2f')](_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x396d27[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0xd1db45['query'][_0x0bc7('0x2c')]);}_0x396d27[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x48')]);_0x396d27[_0x0bc7('0x49')]=qs['filters'](_[_0x0bc7('0x4a')](_0xd1db45[_0x0bc7('0x40')],_0x471705[_0x0bc7('0x41')]));_0x396d27[_0x0bc7('0x49')][_0x0bc7('0x60')]=_0xa4156['id'];if(_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x396d27['where']=_['merge'](_0x396d27['where'],{'$or':_['map'](_0x396d27['attributes'],function(_0x248ead){var _0x2fa836={};_0x2fa836[_0x248ead]={'$like':'%'+_0xd1db45['query'][_0x0bc7('0x4b')]+'%'};return _0x2fa836;})});}_0x396d27=_[_0x0bc7('0x4c')]({},_0x396d27,_0xd1db45[_0x0bc7('0x64')]);return db['CannedAnswer'][_0x0bc7('0x2e')]({'where':_0x396d27['where']})[_0x0bc7('0x33')](function(_0x5bcf5d){_0x2694d1[_0x0bc7('0x2e')]=_0x5bcf5d;if(_0xd1db45[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x396d27[_0x0bc7('0x4f')]=[{'all':!![]}];}return db[_0x0bc7('0x69')][_0x0bc7('0x50')](_0x396d27);})[_0x0bc7('0x33')](function(_0xc4df7e){_0x2694d1[_0x0bc7('0x51')]=_0xc4df7e;return _0x2694d1;});}})[_0x0bc7('0x33')](respondWithFilteredResult(_0x1c41fd,_0x396d27))[_0x0bc7('0x28')](handleError(_0x1c41fd,null));};exports['removeAnswers']=function(_0x723663,_0x62931d,_0x4d151a){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x723663[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x62931d,null))[_0x0bc7('0x33')](function(_0x35d1c4){if(_0x35d1c4){return _0x35d1c4[_0x0bc7('0x6b')](_0x723663['query'][_0x0bc7('0x67')]);}})[_0x0bc7('0x33')](respondWithStatusCode(_0x62931d,null))[_0x0bc7('0x28')](handleError(_0x62931d,null));};exports['notify']=function(_0xd4556c,_0x523d04,_0x5f0155){var _0x540e46={'body':_0xd4556c['body'],'channel':'openchannel'};var _0x3c054c=[];var _0x28ec9c=[];var _0x2aa7da={};var _0x109d8e=![];return db[_0x0bc7('0x6c')]['describe']()[_0x0bc7('0x33')](function(_0x50f513){if(!_0x50f513){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x6f'));}_0x3c054c=_[_0x0bc7('0x70')](_[_0x0bc7('0x3f')](_0x50f513),[_0x0bc7('0x71'),_0x0bc7('0x72')]);_0x28ec9c=_['difference'](_[_0x0bc7('0x3f')](_0x50f513),[_0x0bc7('0x71'),_0x0bc7('0x72'),_0x0bc7('0x73'),'ListId']);if(_0xd4556c[_0x0bc7('0x56')]['id']){delete _0xd4556c['body']['id'];}if(_[_0x0bc7('0x74')](_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')])){throw new db[(_0x0bc7('0x6d'))]['ValidationError'](_0x0bc7('0x76'));}if(_[_0x0bc7('0x74')](_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x56')])||_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x56')]===''){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x77'));}if(_[_0x0bc7('0x74')](_0xd4556c['body'][_0x0bc7('0x78')])){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x79')+_0x28ec9c);}if(!_[_0x0bc7('0x7a')](_0x28ec9c,_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')])){throw new db[(_0x0bc7('0x6d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x28ec9c);}_0x2aa7da[_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')]]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')];})['then'](function(){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0xd4556c[_0x0bc7('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x0bc7('0x7b'),'include':[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0x7c'),'where':_0x2aa7da,'limit':0x1,'order':[[_0x0bc7('0x72'),'DESC']]}]},{'model':db[_0x0bc7('0x7d')],'as':_0x0bc7('0x7e')}]});})[_0x0bc7('0x33')](handleEntityNotFound(_0x523d04,null))[_0x0bc7('0x33')](function(_0x3459f8){if(_0x3459f8&&_0x3459f8[_0x0bc7('0x7b')]){_0x540e46['account']=_0x3459f8;_0x540e46['applications']=_0x3459f8['Applications'];_0x540e46[_0x0bc7('0x7f')]=_0x3459f8[_0x0bc7('0x7b')];_0x540e46[_0x0bc7('0x80')]=_['orderBy'](_0x540e46[_0x0bc7('0x80')],[_0x0bc7('0x81')],[_0x0bc7('0x82')]);if(_0x540e46['account'][_0x0bc7('0x7e')]){delete _0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7e')];}if(_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')]&&_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')][_0x0bc7('0x7c')][_0x0bc7('0x6a')]){return _0x540e46[_0x0bc7('0x83')][_0x0bc7('0x7b')][_0x0bc7('0x7c')][0x0];}var _0x53333a=_['defaults'](_0xd4556c[_0x0bc7('0x56')],{'firstName':_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')],'ListId':_0x3459f8[_0x0bc7('0x84')]});_0x53333a[_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x78')]]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x75')];return db['CmContact'][_0x0bc7('0x5c')](_0x53333a,{'fields':_0x3c054c,'raw':!![]});}})[_0x0bc7('0x33')](handleEntityNotFound(_0x523d04,null))['then'](function(_0x4ad035){_0x540e46['contact']=_0x4ad035;if(_0x4ad035){var _0x2e845f={'ContactId':_0x4ad035['id'],'OpenchannelAccountId':_0xd4556c['params']['id'],'from':(_0x4ad035[_0x0bc7('0x85')]||'')+'\x20'+(_0x4ad035['lastName']||'')};var _0x1b2ccb={'OpenchannelAccountId':_0xd4556c[_0x0bc7('0x53')]['id'],'closed':![]};if(_0xd4556c['body']['threadId']){_0x1b2ccb[_0x0bc7('0x86')]=_0xd4556c[_0x0bc7('0x56')]['threadId'];return db[_0x0bc7('0x87')][_0x0bc7('0x55')]({'where':_0x1b2ccb})['then'](function(_0x35fe07){if(_0x35fe07){return[_0x35fe07,![]];}_0x2e845f[_0x0bc7('0x86')]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')];_0x2e845f[_0x0bc7('0x88')]=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x88')];return db[_0x0bc7('0x87')]['create'](_0x2e845f)[_0x0bc7('0x33')](function(_0x4af37a){return[_0x4af37a,!![]];});});}else{_0x1b2ccb[_0x0bc7('0x86')]=null;}_0x1b2ccb[_0x0bc7('0x89')]=_0x4ad035['id'];return db[_0x0bc7('0x87')]['find']({'where':_0x1b2ccb})[_0x0bc7('0x33')](function(_0x3b1e72){if(_0x3b1e72){return[_0x3b1e72,![]];}return db[_0x0bc7('0x87')][_0x0bc7('0x5c')](_0x2e845f)['then'](function(_0x4f9912){return[_0x4f9912,!![]];});});}})[_0x0bc7('0x8a')](function(_0x1e1203,_0x314d88){if(_0x1e1203){_0x109d8e=_0x314d88;if(!_0x314d88){var _0x4d3ad6={'from':(_0x540e46[_0x0bc7('0x8b')][_0x0bc7('0x85')]||'')+'\x20'+(_0x540e46[_0x0bc7('0x8b')][_0x0bc7('0x8c')]||'')};if(_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')]&&_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x8d')]&&_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x86')]!=_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x8d')]){_0x4d3ad6['threadId']=_0xd4556c['body'][_0x0bc7('0x8d')];}return _0x1e1203[_0x0bc7('0x5e')](_0x4d3ad6);}else{return _0x1e1203;}}})[_0x0bc7('0x33')](function(_0x30d145){_0x540e46[_0x0bc7('0x8e')]=_0x30d145[_0x0bc7('0x34')]({'plain':!![]});_0x540e46[_0x0bc7('0x8e')]['created']=_0x109d8e;if(_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x8f')]){if(_0x540e46[_0x0bc7('0x83')][_0x0bc7('0x90')]){_0x540e46[_0x0bc7('0x80')][_0x0bc7('0x91')]({'id':0x0,'priority':_0x540e46[_0x0bc7('0x80')][_0x0bc7('0x6a')]+0x1,'app':_0x0bc7('0x92'),'appdata':_0x0bc7('0x93'),'interval':_0x0bc7('0x94')});}}return db[_0x0bc7('0x95')]['create']({'body':_0xd4556c[_0x0bc7('0x56')]['body'],'OpenchannelAccountId':_0xd4556c[_0x0bc7('0x53')]['id'],'OpenchannelInteractionId':_0x30d145['id'],'direction':'in','ContactId':_0x540e46[_0x0bc7('0x8b')]['id'],'AttachmentId':_0xd4556c[_0x0bc7('0x56')][_0x0bc7('0x96')]});})[_0x0bc7('0x33')](function(_0x26dffb){_0x540e46[_0x0bc7('0x25')]=_0x26dffb;if(_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x97')]){return db[_0x0bc7('0x98')]['find']({'attributes':['id','name'],'where':{'id':_0x540e46[_0x0bc7('0x8e')][_0x0bc7('0x97')]}})[_0x0bc7('0x33')](function(_0x4fc985){if(_0x4fc985){_0x540e46['applications'][_0x0bc7('0x99')]({'id':0x0,'priority':0x0,'app':_0x0bc7('0x9a'),'appdata':_0x4fc985[_0x0bc7('0x37')]+','+(_0x540e46['account'][_0x0bc7('0x9b')]||0xa),'interval':_0x0bc7('0x94')});_0x540e46[_0x0bc7('0x9c')]=![];}return respondWithRpcPromise('Start','startRouting',_0x540e46);});}return respondWithRpcPromise(_0x0bc7('0x9d'),_0x0bc7('0x9e'),_0x540e46);})[_0x0bc7('0x33')](function(_0x35ade6){respondWithRpcPromise('EventManager',_0x0bc7('0x9f'),{'event':_0x0bc7('0xa0'),'message':_0x35ade6},client9002);return _0x35ade6;})[_0x0bc7('0x33')](respondWithResult(_0x523d04,null))[_0x0bc7('0x28')](handleError(_0x523d04,null));};exports[_0x0bc7('0xa1')]=function(_0x4c9fec,_0x56dcef){var _0x385699=_0x4c9fec[_0x0bc7('0x53')]['id'];var _0x5e7251=_0x4c9fec[_0x0bc7('0x56')];var _0x491142=0xc8;var _0xe45ed7=null;return db[_0x0bc7('0xa2')][_0x0bc7('0xa3')]({'isolationLevel':db['sequelize'][_0x0bc7('0xa4')][_0x0bc7('0xa5')][_0x0bc7('0xa6')]},function(_0x152b70){return db[_0x0bc7('0x3b')]['findOne']({'where':{'id':_0x385699},'transaction':_0x152b70})[_0x0bc7('0x33')](function(_0x5eb47f){if(_0x5eb47f){return db[_0x0bc7('0x7d')]['destroy']({'where':{'OpenchannelAccountId':_0x385699},'transaction':_0x152b70})[_0x0bc7('0x33')](function(){var _0x4d8284=_[_0x0bc7('0x3a')](_0x5e7251,function(_0x210f23){_0x210f23[_0x0bc7('0x60')]=_0x385699;return _0x210f23;});return db[_0x0bc7('0x7d')]['bulkCreate'](_0x4d8284,{'transaction':_0x152b70});});}else{_0x491142=0x194;_0xe45ed7=[];}});})[_0x0bc7('0x33')](function(){if(_0x491142!==0x194){return db[_0x0bc7('0x7d')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x385699},'order':_0x0bc7('0x81')})[_0x0bc7('0x33')](function(_0x54d0cd){_0xe45ed7=_0x54d0cd;});}})['catch'](function(_0x4fcd40){_0x491142=0x1f4;logger[_0x0bc7('0x23')](_0x4fcd40[_0x0bc7('0xa7')]);if(_0x4fcd40[_0x0bc7('0x37')]){delete _0x4fcd40[_0x0bc7('0x37')];}_0xe45ed7=_0x4fcd40;})[_0x0bc7('0xa8')](function(){if(_0xe45ed7===null){_0x56dcef[_0x0bc7('0xa9')](_0x491142);}else{if(_0x491142===0x1f4){_0x56dcef[_0x0bc7('0x2a')](_0x491142)[_0x0bc7('0xaa')](_0xe45ed7);}else{_0x56dcef[_0x0bc7('0x2a')](_0x491142)['json'](_0xe45ed7);}}});};exports['getApplications']=function(_0x235759,_0x2dea19,_0x8fc146){var _0x77a17e={};var _0x269ec6={};var _0x32583f;var _0x49f8ae;return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x235759[_0x0bc7('0x53')]['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0x2dea19,null))[_0x0bc7('0x33')](function(_0x3fd5ba){if(_0x3fd5ba){_0x32583f=_0x3fd5ba;_0x269ec6[_0x0bc7('0x3e')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x269ec6['query']=_[_0x0bc7('0x3f')](_0x235759[_0x0bc7('0x40')]);_0x269ec6[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x269ec6[_0x0bc7('0x3e')],_0x269ec6['query']);_0x77a17e['attributes']=_[_0x0bc7('0x42')](_0x269ec6['model'],qs[_0x0bc7('0x44')](_0x235759['query'][_0x0bc7('0x44')]));_0x77a17e['attributes']=_0x77a17e['attributes'][_0x0bc7('0x6a')]?_0x77a17e['attributes']:_0x269ec6[_0x0bc7('0x3e')];_0x77a17e['order']=qs['sort'](_0x235759['query'][_0x0bc7('0x48')]);_0x77a17e[_0x0bc7('0x49')]=qs['filters'](_[_0x0bc7('0x4a')](_0x235759[_0x0bc7('0x40')],_0x269ec6['filters']));if(_0x235759[_0x0bc7('0x40')][_0x0bc7('0x4b')]){_0x77a17e[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x77a17e[_0x0bc7('0x49')],{'$or':_[_0x0bc7('0x3a')](_0x77a17e[_0x0bc7('0x43')],function(_0x48c789){var _0x35945b={};_0x35945b[_0x48c789]={'$like':'%'+_0x235759[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x35945b;})});}_0x77a17e=_[_0x0bc7('0x4c')]({},_0x77a17e,_0x235759[_0x0bc7('0x64')]);return _0x32583f['getApplications'](_0x77a17e);}})[_0x0bc7('0x33')](function(_0x351cc1){if(_0x351cc1){_0x49f8ae=_0x351cc1[_0x0bc7('0x6a')];if(!_0x235759[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x77a17e['limit']=qs[_0x0bc7('0x2f')](_0x235759[_0x0bc7('0x40')]['limit']);_0x77a17e[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x235759[_0x0bc7('0x40')][_0x0bc7('0x2c')]);}return _0x32583f[_0x0bc7('0xab')](_0x77a17e);}})['then'](function(_0x947274){if(_0x947274){return _0x947274?{'count':_0x49f8ae,'rows':_0x947274}:null;}})[_0x0bc7('0x33')](respondWithResult(_0x2dea19,null))['catch'](handleError(_0x2dea19,null));};exports['getInteractions']=function(_0x129a8b,_0x1f0c26,_0x3e5b83){var _0x545498={'raw':![],'where':{}};var _0x2351ae={};var _0x1bb5be={'count':0x0,'rows':[]};return db[_0x0bc7('0x3b')][_0x0bc7('0x62')]({'where':{'id':_0x129a8b[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f0c26,null))[_0x0bc7('0x33')](function(_0x114ebb){if(_0x114ebb){_0x2351ae[_0x0bc7('0x3e')]=_[_0x0bc7('0x3f')](db[_0x0bc7('0x87')]['rawAttributes']);_0x2351ae[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0x129a8b[_0x0bc7('0x40')]);_0x2351ae[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x2351ae[_0x0bc7('0x3e')],_0x2351ae[_0x0bc7('0x40')]);_0x545498[_0x0bc7('0x43')]=_['intersection'](_0x2351ae[_0x0bc7('0x3e')],qs['fields'](_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x545498['attributes']=_0x545498[_0x0bc7('0x43')]['length']?_0x545498[_0x0bc7('0x43')]:_0x2351ae[_0x0bc7('0x3e')];if(!_0x129a8b['query'][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x545498[_0x0bc7('0x2f')]=qs['limit'](_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x545498['offset']=qs[_0x0bc7('0x2c')](_0x129a8b['query'][_0x0bc7('0x2c')]);}_0x545498['order']=qs[_0x0bc7('0x48')](_0x129a8b['query']['sort']);_0x545498[_0x0bc7('0x49')]=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x129a8b[_0x0bc7('0x40')],_0x2351ae[_0x0bc7('0x41')]));_0x545498[_0x0bc7('0x49')][_0x0bc7('0x60')]=_0x114ebb['id'];if(_0x129a8b[_0x0bc7('0x40')]['filter']){_0x545498[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x545498['where'],{'$or':_['map'](_0x545498[_0x0bc7('0x43')],function(_0x5b8985){var _0x2a6a22={};_0x2a6a22[_0x5b8985]={'$like':'%'+_0x129a8b[_0x0bc7('0x40')]['filter']+'%'};return _0x2a6a22;})});}_0x545498=_[_0x0bc7('0x4c')]({},_0x545498,_0x129a8b['options']);return db[_0x0bc7('0x87')][_0x0bc7('0x2e')]({'where':_0x545498['where']})[_0x0bc7('0x33')](function(_0x13f343){_0x1bb5be[_0x0bc7('0x2e')]=_0x13f343;if(_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0x4e')]){_0x545498['include']=[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0xac'),'required':![]},{'model':db[_0x0bc7('0x98')],'as':_0x0bc7('0xad'),'attributes':[_0x0bc7('0x37'),_0x0bc7('0xae'),_0x0bc7('0xaf')],'required':![]},{'model':db[_0x0bc7('0xb0')],'as':_0x0bc7('0xb1'),'attributes':['id','name','color'],'where':_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0xb2')]?{'id':_0x129a8b[_0x0bc7('0x40')][_0x0bc7('0xb2')]}:undefined,'required':_0x129a8b[_0x0bc7('0x40')]['tag']?!![]:![]}];}return db[_0x0bc7('0x87')][_0x0bc7('0x50')](_0x545498);})[_0x0bc7('0x33')](function(_0x2437c0){_0x1bb5be[_0x0bc7('0x51')]=_0x2437c0;return _0x1bb5be;});}})['then'](respondWithFilteredResult(_0x1f0c26,_0x545498))['catch'](handleError(_0x1f0c26,null));};exports[_0x0bc7('0xb3')]=function(_0xeaf929,_0x5dfd9f,_0x259b4f){return db['OpenchannelAccount'][_0x0bc7('0x55')]({'where':{'id':_0xeaf929[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x5dfd9f,null))[_0x0bc7('0x33')](function(_0x3adebf){if(_0x3adebf){return _0x3adebf['addAgents'](_0xeaf929[_0x0bc7('0x56')][_0x0bc7('0x67')],_[_0x0bc7('0xb4')](_0xeaf929[_0x0bc7('0x56')],[_0x0bc7('0x67'),'id'])||{})['spread'](function(_0x445996){for(var _0x50dc66=0x0;_0x50dc66<_0xeaf929['body'][_0x0bc7('0x67')][_0x0bc7('0x6a')];_0x50dc66+=0x1){socket[_0x0bc7('0xb5')](_0x0bc7('0xb6'),{'UserId':Number(_0xeaf929[_0x0bc7('0x56')][_0x0bc7('0x67')][_0x50dc66]),'OpenchannelAccountId':Number(_0xeaf929[_0x0bc7('0x53')]['id'])});}return _0x445996;});}})[_0x0bc7('0x33')](respondWithResult(_0x5dfd9f,null))['catch'](handleError(_0x5dfd9f,null));};exports['removeAgents']=function(_0x1013c3,_0x15fb2e,_0x39b80e){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0x1013c3['params']['id']}})['then'](handleEntityNotFound(_0x15fb2e,null))[_0x0bc7('0x33')](function(_0x616eb2){if(_0x616eb2){return _0x616eb2[_0x0bc7('0xb7')](_0x1013c3['query'][_0x0bc7('0x67')])['then'](function(){if(_['isArray'](_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')])){for(var _0x22b255=0x0;_0x22b255<_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')][_0x0bc7('0x6a')];_0x22b255+=0x1){socket[_0x0bc7('0xb5')](_0x0bc7('0xb8'),{'UserId':Number(_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')][_0x22b255]),'OpenchannelAccountId':Number(_0x1013c3[_0x0bc7('0x53')]['id'])});}}else{socket['emit'](_0x0bc7('0xb8'),{'UserId':Number(_0x1013c3[_0x0bc7('0x40')][_0x0bc7('0x67')]),'OpenchannelAccountId':Number(_0x1013c3[_0x0bc7('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x15fb2e,null))[_0x0bc7('0x28')](handleError(_0x15fb2e,null));};exports['getAgents']=function(_0x21824c,_0x16ed19,_0x2b4e0f){var _0x3a8f3e={};var _0x88feac={};var _0x5b0a74;var _0x314d33;return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0x21824c[_0x0bc7('0x53')]['id']}})['then'](handleEntityNotFound(_0x16ed19,null))[_0x0bc7('0x33')](function(_0x42e045){if(_0x42e045){_0x5b0a74=_0x42e045;_0x88feac[_0x0bc7('0x3e')]=_[_0x0bc7('0x3f')](db[_0x0bc7('0x98')][_0x0bc7('0x63')]);_0x88feac[_0x0bc7('0x40')]=_[_0x0bc7('0x3f')](_0x21824c[_0x0bc7('0x40')]);_0x88feac[_0x0bc7('0x41')]=_[_0x0bc7('0x42')](_0x88feac[_0x0bc7('0x3e')],_0x88feac[_0x0bc7('0x40')]);_0x3a8f3e[_0x0bc7('0x43')]=_['intersection'](_0x88feac[_0x0bc7('0x3e')],qs[_0x0bc7('0x44')](_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x44')]));_0x3a8f3e[_0x0bc7('0x43')]=_0x3a8f3e[_0x0bc7('0x43')][_0x0bc7('0x6a')]?_0x3a8f3e['attributes']:_0x88feac[_0x0bc7('0x3e')];_0x3a8f3e[_0x0bc7('0x47')]=qs[_0x0bc7('0x48')](_0x21824c['query'][_0x0bc7('0x48')]);_0x3a8f3e['where']=qs[_0x0bc7('0x41')](_[_0x0bc7('0x4a')](_0x21824c[_0x0bc7('0x40')],_0x88feac['filters']));if(_0x21824c[_0x0bc7('0x40')]['filter']){_0x3a8f3e[_0x0bc7('0x49')]=_[_0x0bc7('0x4c')](_0x3a8f3e['where'],{'$or':_[_0x0bc7('0x3a')](_0x3a8f3e[_0x0bc7('0x43')],function(_0x1ffa3a){var _0x198791={};_0x198791[_0x1ffa3a]={'$like':'%'+_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x4b')]+'%'};return _0x198791;})});}_0x3a8f3e=_[_0x0bc7('0x4c')]({},_0x3a8f3e,_0x21824c[_0x0bc7('0x64')]);return _0x5b0a74['getAgents'](_0x3a8f3e);}})[_0x0bc7('0x33')](function(_0x11c597){if(_0x11c597){_0x314d33=_0x11c597[_0x0bc7('0x6a')];if(!_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x45')](_0x0bc7('0x46'))){_0x3a8f3e[_0x0bc7('0x2f')]=qs[_0x0bc7('0x2f')](_0x21824c[_0x0bc7('0x40')][_0x0bc7('0x2f')]);_0x3a8f3e[_0x0bc7('0x2c')]=qs[_0x0bc7('0x2c')](_0x21824c['query']['offset']);}return _0x5b0a74[_0x0bc7('0xb9')](_0x3a8f3e);}})['then'](function(_0xa2509d){if(_0xa2509d){return _0xa2509d?{'count':_0x314d33,'rows':_0xa2509d}:null;}})['then'](respondWithResult(_0x16ed19,null))[_0x0bc7('0x28')](handleError(_0x16ed19,null));};exports['send']=function(_0x14d76c,_0xd60f10,_0x3cd451){var _0x4a0b50,_0x3f0be6,_0x19bd8b;if(_['isNil'](_0x14d76c['body']['body'])||_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')]===''){throw new db[(_0x0bc7('0x6d'))][(_0x0bc7('0x6e'))](_0x0bc7('0x77'));}if(_[_0x0bc7('0x74')](_0x14d76c[_0x0bc7('0x56')]['to'])){}_0x4a0b50=_0x14d76c['body']['to'];return db['OpenchannelAccount'][_0x0bc7('0x62')]({'where':{'id':_0x14d76c['params']['id']}})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))['then'](function(_0xbf9599){if(_0xbf9599){return db[_0x0bc7('0x3b')][_0x0bc7('0x55')]({'where':{'id':_0xbf9599['id']},'include':[{'model':db[_0x0bc7('0xba')],'as':_0x0bc7('0x7b'),'include':[{'model':db[_0x0bc7('0x6c')],'as':_0x0bc7('0x7c'),'where':{[_0xbf9599[_0x0bc7('0x78')]]:_0x4a0b50},'limit':0x1,'order':[[_0x0bc7('0x72'),'DESC']]}]}]})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))[_0x0bc7('0x33')](function(_0x4ffb42){if(_0x4ffb42&&_0x4ffb42[_0x0bc7('0x7b')]){_0x3f0be6=_0x4ffb42[_0x0bc7('0x34')]({'plain':!![]});if(_0x3f0be6[_0x0bc7('0x7b')]&&_0x3f0be6[_0x0bc7('0x7b')][_0x0bc7('0x7c')][_0x0bc7('0x6a')]){return _0x3f0be6[_0x0bc7('0x7b')]['Contacts'][0x0];}return db[_0x0bc7('0x6c')][_0x0bc7('0x5c')](_[_0x0bc7('0x18')](_0x14d76c[_0x0bc7('0x56')],{'firstName':_0x4a0b50,[_0x4ffb42['mapKey']]:_0x4a0b50,'phone':_0x4a0b50,'ListId':_0x3f0be6['ListId']}));}})[_0x0bc7('0x33')](handleEntityNotFound(_0xd60f10,null))[_0x0bc7('0x33')](function(_0x38794d){if(_0x38794d){_0x19bd8b=_0x38794d;return db[_0x0bc7('0x87')][_0x0bc7('0x55')]({'where':{'ContactId':_0x19bd8b['id'],'closed':![],'OpenchannelAccountId':_0x3f0be6['id']}})[_0x0bc7('0x33')](function(_0x578fb8){if(_0x578fb8){return[_0x578fb8,![]];}return db[_0x0bc7('0x87')][_0x0bc7('0x5c')]({'UserId':_0x14d76c['user']['id'],'ContactId':_0x19bd8b['id'],'OpenchannelAccountId':_0x3f0be6['id'],'lastMsgDirection':_0x0bc7('0xbb'),'Messages':[_[_0x0bc7('0x4c')](_0x14d76c[_0x0bc7('0x56')],{'read':![],'body':_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')],'OpenchannelAccountId':_0x3f0be6['id'],'UserId':_0x14d76c[_0x0bc7('0x57')]['id'],'ContactId':_0x19bd8b['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x0bc7('0xbc')}]})[_0x0bc7('0x33')](function(_0x45cfd1){return[_0x45cfd1,!![]];});});}})[_0x0bc7('0x8a')](function(_0x529614,_0xd139ac){if(_0xd139ac){return _0x529614;}return db[_0x0bc7('0x95')][_0x0bc7('0x5c')](_[_0x0bc7('0x4c')](_0x14d76c[_0x0bc7('0x56')],{'read':![],'body':_0x14d76c[_0x0bc7('0x56')][_0x0bc7('0x56')],'OpenchannelAccountId':_0x3f0be6['id'],'OpenchannelInteractionId':_0x529614['id'],'UserId':_0x14d76c[_0x0bc7('0x57')]['id'],'ContactId':_0x19bd8b['id']}))['then'](function(_0x2cc445){_0x529614[_0x0bc7('0xbd')][_0x0bc7('0xbc')]=[];_0x529614['dataValues'][_0x0bc7('0xbc')][_0x0bc7('0x91')](_0x2cc445[_0x0bc7('0xbd')]);return _0x529614;});});}})[_0x0bc7('0x33')](respondWithResult(_0xd60f10,null))[_0x0bc7('0x28')](handleError(_0xd60f10,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index c63642c..a61fe20 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 _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x5e70b8,_0x57d5b3){var _0x32dff3=function(_0x479ca3){while(--_0x479ca3){_0x5e70b8['push'](_0x5e70b8['shift']());}};_0x32dff3(++_0x57d5b3);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var OpenchannelAccount=require(_0xc6e6('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x23c5a8,_0x231dcd){var _0x3ba1b0=function(_0x1985e6){while(--_0x1985e6){_0x23c5a8['push'](_0x23c5a8['shift']());}};_0x3ba1b0(++_0x231dcd);}(_0xf109,0xce));var _0x9f10=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xf109[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('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 314bf72..7aa0556 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(_0x3da759,_0x19bece){var _0xcfb14d=function(_0x1a9882){while(--_0x1a9882){_0x3da759['push'](_0x3da759['shift']());}};_0xcfb14d(++_0x19bece);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x3e6c38,_0x6eabbd){var _0x3c488c=function(_0x5a376b){while(--_0x5a376b){_0x3e6c38['push'](_0x3e6c38['shift']());}};_0x3c488c(++_0x6eabbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 918b012..a87f23e 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 _0xd87e=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x2105ae,_0x48f4b2){var _0x47c002=function(_0x179079){while(--_0x179079){_0x2105ae['push'](_0x2105ae['shift']());}};_0x47c002(++_0x48f4b2);}(_0xd87e,0x1bf));var _0xed87=function(_0x3f817e,_0x538f27){_0x3f817e=_0x3f817e-0x0;var _0x3c5602=_0xd87e[_0x3f817e];return _0x3c5602;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});config['redis']=_[_0xed87('0x9')](config[_0xed87('0xa')],{'host':_0xed87('0xb'),'port':0x18eb});var socket=require(_0xed87('0xc'))(new Redis(config['redis']));require(_0xed87('0xd'))[_0xed87('0xe')](socket);function respondWithRpcPromise(_0x21d399,_0x3c9a3c,_0x1eeadf){return new BPromise(function(_0x1f1150,_0x293db4){return client['request'](_0x21d399,_0x1eeadf)[_0xed87('0xf')](function(_0xf104cb){logger['info'](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x3c9a3c,_0xed87('0x11'),JSON[_0xed87('0x12')](_0xf104cb));if(_0xf104cb[_0xed87('0x13')]){if(_0xf104cb[_0xed87('0x13')][_0xed87('0x14')]===0x1f4){logger[_0xed87('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x293db4(_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);}logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0xf104cb[_0xed87('0x13')][_0xed87('0x15')]);return _0x1f1150(_0xf104cb[_0xed87('0x13')]['message']);}else{logger[_0xed87('0x16')](_0xed87('0x10'),_0x3c9a3c,_0xed87('0x11'));_0x1f1150(_0xf104cb[_0xed87('0x17')]['message']);}})[_0xed87('0x18')](function(_0x473f00){logger[_0xed87('0x13')](_0xed87('0x10'),_0x3c9a3c,_0x473f00);_0x293db4(_0x473f00);});});} \ No newline at end of file +var _0x1339=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info'];(function(_0x4b15a4,_0x4241fe){var _0x40a783=function(_0x1f3de1){while(--_0x1f3de1){_0x4b15a4['push'](_0x4b15a4['shift']());}};_0x40a783(++_0x4241fe);}(_0x1339,0x1ed));var _0x9133=function(_0x3280a3,_0x156983){_0x3280a3=_0x3280a3-0x0;var _0x3d673a=_0x1339[_0x3280a3];return _0x3d673a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});config['redis']=_[_0x9133('0xb')](config[_0x9133('0xc')],{'host':_0x9133('0xd'),'port':0x18eb});var socket=require(_0x9133('0xe'))(new Redis(config[_0x9133('0xc')]));require(_0x9133('0xf'))[_0x9133('0x10')](socket);function respondWithRpcPromise(_0x245134,_0x10a9e4,_0xd588c){return new BPromise(function(_0x4c4517,_0x3f9650){return client[_0x9133('0x11')](_0x245134,_0xd588c)[_0x9133('0x12')](function(_0x452481){logger[_0x9133('0x13')](_0x9133('0x14'),_0x10a9e4,'request\x20sent');logger[_0x9133('0x15')](_0x9133('0x16'),_0x10a9e4,'request\x20sent',JSON['stringify'](_0x452481));if(_0x452481[_0x9133('0x17')]){if(_0x452481['error'][_0x9133('0x18')]===0x1f4){logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481[_0x9133('0x17')][_0x9133('0x19')]);return _0x3f9650(_0x452481[_0x9133('0x17')]['message']);}logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481['error'][_0x9133('0x19')]);return _0x4c4517(_0x452481[_0x9133('0x17')][_0x9133('0x19')]);}else{logger[_0x9133('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x9133('0x1a'));_0x4c4517(_0x452481['result'][_0x9133('0x19')]);}})['catch'](function(_0x115ee8){logger[_0x9133('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x115ee8);_0x3f9650(_0x115ee8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7c249e4..34f2186 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 _0x803f=['length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','register'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x803f,0x64));var _0xf803=function(_0x23bcab,_0x2cf9f9){_0x23bcab=_0x23bcab-0x0;var _0x51c292=_0x803f[_0x23bcab];return _0x51c292;};'use strict';var OpenchannelAccountEvents=require(_0xf803('0x0'));var events=['save',_0xf803('0x1'),_0xf803('0x2')];function createListener(_0x4ce875,_0x1a8691){return function(_0x43fb3b){_0x1a8691[_0xf803('0x3')](_0x4ce875,_0x43fb3b);};}function removeListener(_0x6baafe,_0x5c2cd6){return function(){OpenchannelAccountEvents['removeListener'](_0x6baafe,_0x5c2cd6);};}exports[_0xf803('0x4')]=function(_0x2ba12f){for(var _0x1d3a79=0x0,_0x584b2d=events[_0xf803('0x5')];_0x1d3a79<_0x584b2d;_0x1d3a79++){var _0x47128f=events[_0x1d3a79];var _0x587319=createListener(_0xf803('0x6')+_0x47128f,_0x2ba12f);OpenchannelAccountEvents['on'](_0x47128f,_0x587319);}}; \ No newline at end of file +var _0xa4db=['removeListener','length','openchannelAccount:','update','emit'];(function(_0x2c7c98,_0x23ca3c){var _0x1e267f=function(_0xefc0a1){while(--_0xefc0a1){_0x2c7c98['push'](_0x2c7c98['shift']());}};_0x1e267f(++_0x23ca3c);}(_0xa4db,0x139));var _0xba4d=function(_0x3f1c20,_0x3d22f3){_0x3f1c20=_0x3f1c20-0x0;var _0xd18fa8=_0xa4db[_0x3f1c20];return _0xd18fa8;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xba4d('0x0')];function createListener(_0x46aae0,_0x22432c){return function(_0x1f3b60){_0x22432c[_0xba4d('0x1')](_0x46aae0,_0x1f3b60);};}function removeListener(_0x158edc,_0x5870ff){return function(){OpenchannelAccountEvents[_0xba4d('0x2')](_0x158edc,_0x5870ff);};}exports['register']=function(_0x1c798c){for(var _0x1b1d52=0x0,_0x325531=events[_0xba4d('0x3')];_0x1b1d52<_0x325531;_0x1b1d52++){var _0x2c8823=events[_0x1b1d52];var _0xdfc6bf=createListener(_0xba4d('0x4')+_0x2c8823,_0x1c798c);OpenchannelAccountEvents['on'](_0x2c8823,_0xdfc6bf);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index aa5ab94..1feec93 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 _0x3869=['fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','create','destroy','exports','multer','util','path','express'];(function(_0x3dd531,_0xedaa84){var _0x299141=function(_0x2ca740){while(--_0x2ca740){_0x3dd531['push'](_0x3dd531['shift']());}};_0x299141(++_0xedaa84);}(_0x3869,0x1a0));var _0x9386=function(_0x357c26,_0x599bdc){_0x357c26=_0x357c26-0x0;var _0x2aaa44=_0x3869[_0x357c26];return _0x2aaa44;};'use strict';var multer=require(_0x9386('0x0'));var util=require(_0x9386('0x1'));var path=require(_0x9386('0x2'));var timeout=require('connect-timeout');var express=require(_0x9386('0x3'));var router=express['Router']();var fs_extra=require(_0x9386('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9386('0x5'));var controller=require('./openchannelApplication.controller');router[_0x9386('0x6')]('/',auth['isAuthenticated'](),controller[_0x9386('0x7')]);router[_0x9386('0x6')](_0x9386('0x8'),auth[_0x9386('0x9')](),controller[_0x9386('0xa')]);router['post']('/',auth[_0x9386('0x9')](),controller[_0x9386('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x9386('0x9')](),controller[_0x9386('0xc')]);module[_0x9386('0xd')]=router; \ No newline at end of file +var _0xe50c=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0xc1c2aa,_0x18a034){var _0x5813ee=function(_0xea3fc3){while(--_0xea3fc3){_0xc1c2aa['push'](_0xc1c2aa['shift']());}};_0x5813ee(++_0x18a034);}(_0xe50c,0x6b));var _0xce50=function(_0x43c02a,_0x46213e){_0x43c02a=_0x43c02a-0x0;var _0x3c54ed=_0xe50c[_0x43c02a];return _0x3c54ed;};'use strict';var multer=require(_0xce50('0x0'));var util=require(_0xce50('0x1'));var path=require(_0xce50('0x2'));var timeout=require(_0xce50('0x3'));var express=require(_0xce50('0x4'));var router=express[_0xce50('0x5')]();var fs_extra=require(_0xce50('0x6'));var auth=require(_0xce50('0x7'));var interaction=require(_0xce50('0x8'));var config=require(_0xce50('0x9'));var controller=require(_0xce50('0xa'));router[_0xce50('0xb')]('/',auth[_0xce50('0xc')](),controller[_0xce50('0xd')]);router[_0xce50('0xb')](_0xce50('0xe'),auth['isAuthenticated'](),controller[_0xce50('0xf')]);router['post']('/',auth[_0xce50('0xc')](),controller[_0xce50('0x10')]);router[_0xce50('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xce50('0x12')]);router[_0xce50('0x13')](_0xce50('0xe'),auth[_0xce50('0xc')](),controller['destroy']);module[_0xce50('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7506e07..846b5e3 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 _0x520f=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x1d7d68,_0x4a407d){var _0x456c44=function(_0x348a5a){while(--_0x348a5a){_0x1d7d68['push'](_0x1d7d68['shift']());}};_0x456c44(++_0x4a407d);}(_0x520f,0x93));var _0xf520=function(_0x3058bc,_0x391ddb){_0x3058bc=_0x3058bc-0x0;var _0x586a60=_0x520f[_0x3058bc];return _0x586a60;};'use strict';var Sequelize=require(_0xf520('0x0'));module[_0xf520('0x1')]={'priority':{'type':Sequelize[_0xf520('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf520('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf520('0x4')]()},'description':{'type':Sequelize[_0xf520('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1b0b=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x1b0b,0x129));var _0xb1b0=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x1b0b[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module[_0xb1b0('0x0')]={'priority':{'type':Sequelize[_0xb1b0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb1b0('0x2')],'allowNull':![],'defaultValue':_0xb1b0('0x3')},'appdata':{'type':Sequelize[_0xb1b0('0x4')]()},'description':{'type':Sequelize[_0xb1b0('0x2')]},'interval':{'type':Sequelize[_0xb1b0('0x2')],'defaultValue':_0xb1b0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6f19bdc..ff66c94 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 _0xf7db=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf7db,0xa5));var _0xbf7d=function(_0x192850,_0x4171b0){_0x192850=_0x192850-0x0;var _0x5001f7=_0xf7db[_0x192850];return _0x5001f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf7d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf7d('0x1'));var rp=require(_0xbf7d('0x2'));var moment=require(_0xbf7d('0x3'));var BPromise=require(_0xbf7d('0x4'));var Mustache=require(_0xbf7d('0x5'));var util=require('util');var path=require(_0xbf7d('0x6'));var sox=require('sox');var csv=require(_0xbf7d('0x7'));var ejs=require(_0xbf7d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbf7d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf7d('0x7'));var querystring=require(_0xbf7d('0xa'));var Papa=require('papaparse');var Redis=require(_0xbf7d('0xb'));var authService=require(_0xbf7d('0xc'));var qs=require(_0xbf7d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf7d('0xe'));var logger=require(_0xbf7d('0xf'))('api');var utils=require(_0xbf7d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xbf7d('0x11'));var db=require(_0xbf7d('0x12'))['db'];function respondWithStatusCode(_0x307d54,_0x2b72c1){_0x2b72c1=_0x2b72c1||0xcc;return function(_0x15075f){if(_0x15075f){return _0x307d54[_0xbf7d('0x13')](_0x2b72c1);}return _0x307d54[_0xbf7d('0x14')](_0x2b72c1)[_0xbf7d('0x15')]();};}function respondWithResult(_0x1d63bf,_0x3e40cc){_0x3e40cc=_0x3e40cc||0xc8;return function(_0x1798bb){if(_0x1798bb){return _0x1d63bf[_0xbf7d('0x14')](_0x3e40cc)[_0xbf7d('0x16')](_0x1798bb);}};}function respondWithFilteredResult(_0x312fb5,_0x4f8021){return function(_0x3de921){if(_0x3de921){var _0x4611cb=typeof _0x4f8021[_0xbf7d('0x17')]==='undefined'&&typeof _0x4f8021[_0xbf7d('0x18')]===_0xbf7d('0x19');var _0x402c2e=_0x3de921[_0xbf7d('0x1a')];var _0x45847f=_0x4611cb?0x0:_0x4f8021[_0xbf7d('0x17')];var _0x5e207c=_0x4611cb?_0x3de921[_0xbf7d('0x1a')]:_0x4f8021[_0xbf7d('0x17')]+_0x4f8021[_0xbf7d('0x18')];var _0x54eae3;if(_0x5e207c>=_0x402c2e){_0x5e207c=_0x402c2e;_0x54eae3=0xc8;}else{_0x54eae3=0xce;}_0x312fb5[_0xbf7d('0x14')](_0x54eae3);return _0x312fb5[_0xbf7d('0x1b')]('Content-Range',_0x45847f+'-'+_0x5e207c+'/'+_0x402c2e)[_0xbf7d('0x16')](_0x3de921);}return null;};}function patchUpdates(_0xa8710c){return function(_0x110e34){try{jsonpatch[_0xbf7d('0x1c')](_0x110e34,_0xa8710c,!![]);}catch(_0x266511){return BPromise[_0xbf7d('0x1d')](_0x266511);}return _0x110e34[_0xbf7d('0x1e')]();};}function saveUpdates(_0xdf699f,_0x17add9){return function(_0x47f606){if(_0x47f606){return _0x47f606[_0xbf7d('0x1f')](_0xdf699f)[_0xbf7d('0x20')](function(_0x108fc1){return _0x108fc1;});}return null;};}function removeEntity(_0x44dab2,_0x1b948a){return function(_0x597d24){if(_0x597d24){return _0x597d24[_0xbf7d('0x21')]()[_0xbf7d('0x20')](function(){_0x44dab2[_0xbf7d('0x14')](0xcc)[_0xbf7d('0x15')]();});}};}function handleEntityNotFound(_0x4b47e2,_0x253ba8){return function(_0x38640a){if(!_0x38640a){_0x4b47e2[_0xbf7d('0x13')](0x194);}return _0x38640a;};}function handleError(_0x130c08,_0x5d8842){_0x5d8842=_0x5d8842||0x1f4;return function(_0x28c482){logger['error'](_0x28c482[_0xbf7d('0x22')]);if(_0x28c482[_0xbf7d('0x23')]){delete _0x28c482[_0xbf7d('0x23')];}_0x130c08['status'](_0x5d8842)[_0xbf7d('0x24')](_0x28c482);};}exports[_0xbf7d('0x25')]=function(_0x366c85,_0x3fe5bd){var _0x3057f6={},_0x58ff05={},_0x418ca3={'count':0x0,'rows':[]};var _0x1caed9=_[_0xbf7d('0x26')](db[_0xbf7d('0x27')][_0xbf7d('0x28')],function(_0x4686a6){return{'name':_0x4686a6['fieldName'],'type':_0x4686a6[_0xbf7d('0x29')][_0xbf7d('0x2a')]};});_0x58ff05[_0xbf7d('0x2b')]=_[_0xbf7d('0x26')](_0x1caed9,'name');_0x58ff05[_0xbf7d('0x2c')]=_['keys'](_0x366c85[_0xbf7d('0x2c')]);_0x58ff05['filters']=_[_0xbf7d('0x2d')](_0x58ff05['model'],_0x58ff05[_0xbf7d('0x2c')]);_0x3057f6[_0xbf7d('0x2e')]=_[_0xbf7d('0x2d')](_0x58ff05[_0xbf7d('0x2b')],qs[_0xbf7d('0x2f')](_0x366c85[_0xbf7d('0x2c')][_0xbf7d('0x2f')]));_0x3057f6[_0xbf7d('0x2e')]=_0x3057f6['attributes'][_0xbf7d('0x30')]?_0x3057f6[_0xbf7d('0x2e')]:_0x58ff05['model'];if(!_0x366c85[_0xbf7d('0x2c')][_0xbf7d('0x31')](_0xbf7d('0x32'))){_0x3057f6[_0xbf7d('0x18')]=qs[_0xbf7d('0x18')](_0x366c85[_0xbf7d('0x2c')]['limit']);_0x3057f6['offset']=qs[_0xbf7d('0x17')](_0x366c85[_0xbf7d('0x2c')][_0xbf7d('0x17')]);}_0x3057f6['order']=qs['sort'](_0x366c85[_0xbf7d('0x2c')][_0xbf7d('0x33')]);_0x3057f6['where']=qs[_0xbf7d('0x34')](_[_0xbf7d('0x35')](_0x366c85['query'],_0x58ff05[_0xbf7d('0x34')]),_0x1caed9);if(_0x366c85[_0xbf7d('0x2c')][_0xbf7d('0x36')]){_0x3057f6[_0xbf7d('0x37')]=_['merge'](_0x3057f6[_0xbf7d('0x37')],{'$or':_[_0xbf7d('0x26')](_0x1caed9,function(_0x4da796){if(_0x4da796[_0xbf7d('0x29')]!==_0xbf7d('0x38')){var _0x5e0f9a={};_0x5e0f9a[_0x4da796[_0xbf7d('0x23')]]={'$like':'%'+_0x366c85[_0xbf7d('0x2c')]['filter']+'%'};return _0x5e0f9a;}})});}_0x3057f6=_[_0xbf7d('0x39')]({},_0x3057f6,_0x366c85[_0xbf7d('0x3a')]);var _0x29f758={'where':_0x3057f6[_0xbf7d('0x37')]};return db[_0xbf7d('0x27')][_0xbf7d('0x1a')](_0x29f758)[_0xbf7d('0x20')](function(_0x19f1a1){_0x418ca3[_0xbf7d('0x1a')]=_0x19f1a1;if(_0x366c85['query'][_0xbf7d('0x3b')]){_0x3057f6[_0xbf7d('0x3c')]=[{'all':!![]}];}return db[_0xbf7d('0x27')][_0xbf7d('0x3d')](_0x3057f6);})[_0xbf7d('0x20')](function(_0x59832a){_0x418ca3[_0xbf7d('0x3e')]=_0x59832a;return _0x418ca3;})[_0xbf7d('0x20')](respondWithFilteredResult(_0x3fe5bd,_0x3057f6))[_0xbf7d('0x3f')](handleError(_0x3fe5bd,null));};exports['show']=function(_0x18b5f9,_0x24240c){var _0x1ea962={'raw':!![],'where':{'id':_0x18b5f9[_0xbf7d('0x40')]['id']}},_0x1e6a76={};_0x1e6a76[_0xbf7d('0x2b')]=_[_0xbf7d('0x41')](db[_0xbf7d('0x27')][_0xbf7d('0x28')]);_0x1e6a76['query']=_[_0xbf7d('0x41')](_0x18b5f9['query']);_0x1e6a76['filters']=_[_0xbf7d('0x2d')](_0x1e6a76['model'],_0x1e6a76[_0xbf7d('0x2c')]);_0x1ea962[_0xbf7d('0x2e')]=_['intersection'](_0x1e6a76[_0xbf7d('0x2b')],qs[_0xbf7d('0x2f')](_0x18b5f9[_0xbf7d('0x2c')][_0xbf7d('0x2f')]));_0x1ea962[_0xbf7d('0x2e')]=_0x1ea962[_0xbf7d('0x2e')][_0xbf7d('0x30')]?_0x1ea962[_0xbf7d('0x2e')]:_0x1e6a76[_0xbf7d('0x2b')];if(_0x18b5f9['query'][_0xbf7d('0x3b')]){_0x1ea962[_0xbf7d('0x3c')]=[{'all':!![]}];}_0x1ea962=_[_0xbf7d('0x39')]({},_0x1ea962,_0x18b5f9[_0xbf7d('0x3a')]);return db[_0xbf7d('0x27')][_0xbf7d('0x42')](_0x1ea962)[_0xbf7d('0x20')](handleEntityNotFound(_0x24240c,null))[_0xbf7d('0x20')](respondWithResult(_0x24240c,null))[_0xbf7d('0x3f')](handleError(_0x24240c,null));};exports['create']=function(_0x4b83f4,_0x16bbc1){return db[_0xbf7d('0x27')][_0xbf7d('0x43')](_0x4b83f4[_0xbf7d('0x44')],{})[_0xbf7d('0x20')](respondWithResult(_0x16bbc1,0xc9))['catch'](handleError(_0x16bbc1,null));};exports[_0xbf7d('0x1f')]=function(_0x1162ef,_0xc90e60){if(_0x1162ef[_0xbf7d('0x44')]['id']){delete _0x1162ef[_0xbf7d('0x44')]['id'];}return db[_0xbf7d('0x27')][_0xbf7d('0x42')]({'where':{'id':_0x1162ef[_0xbf7d('0x40')]['id']}})[_0xbf7d('0x20')](handleEntityNotFound(_0xc90e60,null))['then'](saveUpdates(_0x1162ef['body'],null))['then'](respondWithResult(_0xc90e60,null))[_0xbf7d('0x3f')](handleError(_0xc90e60,null));};exports[_0xbf7d('0x21')]=function(_0x573574,_0x18f566){return db[_0xbf7d('0x27')][_0xbf7d('0x42')]({'where':{'id':_0x573574[_0xbf7d('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f566,null))[_0xbf7d('0x20')](removeEntity(_0x18f566,null))[_0xbf7d('0x3f')](handleError(_0x18f566,null));}; \ No newline at end of file +var _0x42e2=['send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','params','rimraf','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x42e2,0x147));var _0x242e=function(_0x17eb97,_0x4ac748){_0x17eb97=_0x17eb97-0x0;var _0x8c569f=_0x42e2[_0x17eb97];return _0x8c569f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x242e('0x0'));var zipdir=require(_0x242e('0x1'));var jsonpatch=require(_0x242e('0x2'));var rp=require(_0x242e('0x3'));var moment=require(_0x242e('0x4'));var BPromise=require(_0x242e('0x5'));var Mustache=require('mustache');var util=require(_0x242e('0x6'));var path=require(_0x242e('0x7'));var sox=require(_0x242e('0x8'));var csv=require(_0x242e('0x9'));var ejs=require(_0x242e('0xa'));var fs=require('fs');var fs_extra=require(_0x242e('0xb'));var _=require('lodash');var squel=require(_0x242e('0xc'));var crypto=require(_0x242e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x242e('0x9'));var querystring=require(_0x242e('0xe'));var Papa=require('papaparse');var Redis=require(_0x242e('0xf'));var authService=require(_0x242e('0x10'));var qs=require(_0x242e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x242e('0x12'))(_0x242e('0x13'));var utils=require(_0x242e('0x14'));var config=require(_0x242e('0x15'));var licenseUtil=require(_0x242e('0x16'));var db=require(_0x242e('0x17'))['db'];function respondWithStatusCode(_0x20fba4,_0x357e56){_0x357e56=_0x357e56||0xcc;return function(_0x5003fb){if(_0x5003fb){return _0x20fba4[_0x242e('0x18')](_0x357e56);}return _0x20fba4[_0x242e('0x19')](_0x357e56)['end']();};}function respondWithResult(_0x36fd82,_0x3cf9ce){_0x3cf9ce=_0x3cf9ce||0xc8;return function(_0x4c23da){if(_0x4c23da){return _0x36fd82[_0x242e('0x19')](_0x3cf9ce)['json'](_0x4c23da);}};}function respondWithFilteredResult(_0x55b1c4,_0x7fca36){return function(_0x5228f9){if(_0x5228f9){var _0xe21ad8=typeof _0x7fca36['offset']===_0x242e('0x1a')&&typeof _0x7fca36[_0x242e('0x1b')]==='undefined';var _0x252c0a=_0x5228f9['count'];var _0x6af7bf=_0xe21ad8?0x0:_0x7fca36[_0x242e('0x1c')];var _0x2eff15=_0xe21ad8?_0x5228f9[_0x242e('0x1d')]:_0x7fca36[_0x242e('0x1c')]+_0x7fca36[_0x242e('0x1b')];var _0x31b7c3;if(_0x2eff15>=_0x252c0a){_0x2eff15=_0x252c0a;_0x31b7c3=0xc8;}else{_0x31b7c3=0xce;}_0x55b1c4[_0x242e('0x19')](_0x31b7c3);return _0x55b1c4[_0x242e('0x1e')](_0x242e('0x1f'),_0x6af7bf+'-'+_0x2eff15+'/'+_0x252c0a)[_0x242e('0x20')](_0x5228f9);}return null;};}function patchUpdates(_0x55480f){return function(_0x16bb60){try{jsonpatch[_0x242e('0x21')](_0x16bb60,_0x55480f,!![]);}catch(_0x382425){return BPromise[_0x242e('0x22')](_0x382425);}return _0x16bb60[_0x242e('0x23')]();};}function saveUpdates(_0x3d45fc,_0x1a17d1){return function(_0x51081c){if(_0x51081c){return _0x51081c[_0x242e('0x24')](_0x3d45fc)[_0x242e('0x25')](function(_0x468702){return _0x468702;});}return null;};}function removeEntity(_0x524a70,_0x4f5197){return function(_0x43c427){if(_0x43c427){return _0x43c427[_0x242e('0x26')]()[_0x242e('0x25')](function(){_0x524a70[_0x242e('0x19')](0xcc)[_0x242e('0x27')]();});}};}function handleEntityNotFound(_0x1d7427,_0x4b8076){return function(_0x29c2dd){if(!_0x29c2dd){_0x1d7427[_0x242e('0x18')](0x194);}return _0x29c2dd;};}function handleError(_0x1517a2,_0x589481){_0x589481=_0x589481||0x1f4;return function(_0x4ed15b){logger[_0x242e('0x28')](_0x4ed15b[_0x242e('0x29')]);if(_0x4ed15b[_0x242e('0x2a')]){delete _0x4ed15b['name'];}_0x1517a2[_0x242e('0x19')](_0x589481)[_0x242e('0x2b')](_0x4ed15b);};}exports[_0x242e('0x2c')]=function(_0x14ac93,_0x2515ad){var _0xc86779={},_0x46031e={},_0x1e38fb={'count':0x0,'rows':[]};var _0x58afc5=_[_0x242e('0x2d')](db[_0x242e('0x2e')][_0x242e('0x2f')],function(_0x375d62){return{'name':_0x375d62[_0x242e('0x30')],'type':_0x375d62[_0x242e('0x31')]['key']};});_0x46031e[_0x242e('0x32')]=_['map'](_0x58afc5,'name');_0x46031e[_0x242e('0x33')]=_['keys'](_0x14ac93[_0x242e('0x33')]);_0x46031e[_0x242e('0x34')]=_[_0x242e('0x35')](_0x46031e[_0x242e('0x32')],_0x46031e[_0x242e('0x33')]);_0xc86779[_0x242e('0x36')]=_[_0x242e('0x35')](_0x46031e[_0x242e('0x32')],qs[_0x242e('0x37')](_0x14ac93[_0x242e('0x33')]['fields']));_0xc86779[_0x242e('0x36')]=_0xc86779['attributes'][_0x242e('0x38')]?_0xc86779[_0x242e('0x36')]:_0x46031e[_0x242e('0x32')];if(!_0x14ac93[_0x242e('0x33')][_0x242e('0x39')]('nolimit')){_0xc86779[_0x242e('0x1b')]=qs['limit'](_0x14ac93[_0x242e('0x33')][_0x242e('0x1b')]);_0xc86779[_0x242e('0x1c')]=qs[_0x242e('0x1c')](_0x14ac93[_0x242e('0x33')][_0x242e('0x1c')]);}_0xc86779['order']=qs[_0x242e('0x3a')](_0x14ac93[_0x242e('0x33')][_0x242e('0x3a')]);_0xc86779[_0x242e('0x3b')]=qs[_0x242e('0x34')](_['pick'](_0x14ac93['query'],_0x46031e[_0x242e('0x34')]),_0x58afc5);if(_0x14ac93[_0x242e('0x33')][_0x242e('0x3c')]){_0xc86779[_0x242e('0x3b')]=_[_0x242e('0x3d')](_0xc86779[_0x242e('0x3b')],{'$or':_[_0x242e('0x2d')](_0x58afc5,function(_0x138207){if(_0x138207[_0x242e('0x31')]!==_0x242e('0x3e')){var _0x26898e={};_0x26898e[_0x138207[_0x242e('0x2a')]]={'$like':'%'+_0x14ac93[_0x242e('0x33')][_0x242e('0x3c')]+'%'};return _0x26898e;}})});}_0xc86779=_[_0x242e('0x3d')]({},_0xc86779,_0x14ac93[_0x242e('0x3f')]);var _0x1105a4={'where':_0xc86779['where']};return db[_0x242e('0x2e')][_0x242e('0x1d')](_0x1105a4)['then'](function(_0x4c1c0c){_0x1e38fb[_0x242e('0x1d')]=_0x4c1c0c;if(_0x14ac93[_0x242e('0x33')]['includeAll']){_0xc86779[_0x242e('0x40')]=[{'all':!![]}];}return db[_0x242e('0x2e')][_0x242e('0x41')](_0xc86779);})[_0x242e('0x25')](function(_0xa6ebee){_0x1e38fb[_0x242e('0x42')]=_0xa6ebee;return _0x1e38fb;})['then'](respondWithFilteredResult(_0x2515ad,_0xc86779))[_0x242e('0x43')](handleError(_0x2515ad,null));};exports[_0x242e('0x44')]=function(_0x4d4cfe,_0x499fed){var _0x48ff2f={'raw':!![],'where':{'id':_0x4d4cfe['params']['id']}},_0x50e47a={};_0x50e47a[_0x242e('0x32')]=_[_0x242e('0x45')](db['OpenchannelApplication'][_0x242e('0x2f')]);_0x50e47a[_0x242e('0x33')]=_[_0x242e('0x45')](_0x4d4cfe[_0x242e('0x33')]);_0x50e47a['filters']=_[_0x242e('0x35')](_0x50e47a[_0x242e('0x32')],_0x50e47a[_0x242e('0x33')]);_0x48ff2f['attributes']=_[_0x242e('0x35')](_0x50e47a[_0x242e('0x32')],qs['fields'](_0x4d4cfe[_0x242e('0x33')]['fields']));_0x48ff2f[_0x242e('0x36')]=_0x48ff2f[_0x242e('0x36')][_0x242e('0x38')]?_0x48ff2f[_0x242e('0x36')]:_0x50e47a[_0x242e('0x32')];if(_0x4d4cfe[_0x242e('0x33')]['includeAll']){_0x48ff2f['include']=[{'all':!![]}];}_0x48ff2f=_[_0x242e('0x3d')]({},_0x48ff2f,_0x4d4cfe[_0x242e('0x3f')]);return db['OpenchannelApplication'][_0x242e('0x46')](_0x48ff2f)['then'](handleEntityNotFound(_0x499fed,null))['then'](respondWithResult(_0x499fed,null))['catch'](handleError(_0x499fed,null));};exports[_0x242e('0x47')]=function(_0x5f47e3,_0x4bd53a){return db[_0x242e('0x2e')]['create'](_0x5f47e3['body'],{})[_0x242e('0x25')](respondWithResult(_0x4bd53a,0xc9))[_0x242e('0x43')](handleError(_0x4bd53a,null));};exports[_0x242e('0x24')]=function(_0x18590a,_0x50430e){if(_0x18590a[_0x242e('0x48')]['id']){delete _0x18590a['body']['id'];}return db[_0x242e('0x2e')][_0x242e('0x46')]({'where':{'id':_0x18590a[_0x242e('0x49')]['id']}})['then'](handleEntityNotFound(_0x50430e,null))[_0x242e('0x25')](saveUpdates(_0x18590a[_0x242e('0x48')],null))[_0x242e('0x25')](respondWithResult(_0x50430e,null))[_0x242e('0x43')](handleError(_0x50430e,null));};exports[_0x242e('0x26')]=function(_0x27dc6a,_0x18c875){return db['OpenchannelApplication']['find']({'where':{'id':_0x27dc6a[_0x242e('0x49')]['id']}})['then'](handleEntityNotFound(_0x18c875,null))[_0x242e('0x25')](removeEntity(_0x18c875,null))[_0x242e('0x43')](handleError(_0x18c875,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a7eaf62..805ceee 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 _0x22df=['exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9b383e,_0x1e89f2){var _0x213cfc=function(_0x3fc450){while(--_0x3fc450){_0x9b383e['push'](_0x9b383e['shift']());}};_0x213cfc(++_0x1e89f2);}(_0x22df,0xbb));var _0xf22d=function(_0x20af9b,_0x83bd64){_0x20af9b=_0x20af9b-0x0;var _0x325c9d=_0x22df[_0x20af9b];return _0x325c9d;};'use strict';var _=require('lodash');var util=require(_0xf22d('0x0'));var logger=require(_0xf22d('0x1'))(_0xf22d('0x2'));var moment=require(_0xf22d('0x3'));var BPromise=require(_0xf22d('0x4'));var rp=require(_0xf22d('0x5'));var fs=require('fs');var path=require(_0xf22d('0x6'));var rimraf=require(_0xf22d('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xf22d('0x8')]=function(_0x4b3d2c,_0x55a496){return _0x4b3d2c[_0xf22d('0x9')](_0xf22d('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf22d('0xb'),'collate':_0xf22d('0xc')});}; \ No newline at end of file +var _0xf5f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5ee562,_0x427582){var _0x15110d=function(_0x29a89d){while(--_0x29a89d){_0x5ee562['push'](_0x5ee562['shift']());}};_0x15110d(++_0x427582);}(_0xf5f4,0x186));var _0x4f5f=function(_0x46fb8a,_0x25c3b8){_0x46fb8a=_0x46fb8a-0x0;var _0x5b10d7=_0xf5f4[_0x46fb8a];return _0x5b10d7;};'use strict';var _=require(_0x4f5f('0x0'));var util=require(_0x4f5f('0x1'));var logger=require(_0x4f5f('0x2'))(_0x4f5f('0x3'));var moment=require(_0x4f5f('0x4'));var BPromise=require(_0x4f5f('0x5'));var rp=require(_0x4f5f('0x6'));var fs=require('fs');var path=require(_0x4f5f('0x7'));var rimraf=require(_0x4f5f('0x8'));var config=require(_0x4f5f('0x9'));var attributes=require(_0x4f5f('0xa'));module['exports']=function(_0x45a31a,_0x52994f){return _0x45a31a[_0x4f5f('0xb')](_0x4f5f('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4f5f('0xd'),'collate':_0x4f5f('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 27de185..38c07c5 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 _0x47c3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit','info','debug','lodash'];(function(_0x3d0d75,_0x3f3ef4){var _0x279f25=function(_0x46c50f){while(--_0x46c50f){_0x3d0d75['push'](_0x3d0d75['shift']());}};_0x279f25(++_0x3f3ef4);}(_0x47c3,0xca));var _0x347c=function(_0x1d5f4d,_0x49545c){_0x1d5f4d=_0x1d5f4d-0x0;var _0x1345df=_0x47c3[_0x1d5f4d];return _0x1345df;};'use strict';var _=require(_0x347c('0x0'));var util=require(_0x347c('0x1'));var moment=require(_0x347c('0x2'));var BPromise=require(_0x347c('0x3'));var rs=require(_0x347c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x347c('0x5'))['db'];var utils=require(_0x347c('0x6'));var logger=require(_0x347c('0x7'))('rpc');var config=require(_0x347c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x181564,_0x1cc6fb,_0x2c9ed0){return new BPromise(function(_0x2f664b,_0x1b9f05){return client[_0x347c('0x9')](_0x181564,_0x2c9ed0)[_0x347c('0xa')](function(_0x38f830){logger['info'](_0x347c('0xb'),_0x1cc6fb,_0x347c('0xc'));logger['debug'](_0x347c('0xd'),_0x1cc6fb,_0x347c('0xc'),JSON['stringify'](_0x38f830));if(_0x38f830[_0x347c('0xe')]){if(_0x38f830[_0x347c('0xe')][_0x347c('0xf')]===0x1f4){logger[_0x347c('0xe')](_0x347c('0xb'),_0x1cc6fb,_0x38f830[_0x347c('0xe')]['message']);return _0x1b9f05(_0x38f830[_0x347c('0xe')][_0x347c('0x10')]);}logger[_0x347c('0xe')](_0x347c('0xb'),_0x1cc6fb,_0x38f830['error']['message']);return _0x2f664b(_0x38f830['error']['message']);}else{logger['info'](_0x347c('0xb'),_0x1cc6fb,_0x347c('0xc'));_0x2f664b(_0x38f830[_0x347c('0x11')][_0x347c('0x10')]);}})[_0x347c('0x12')](function(_0x3a8f3c){logger[_0x347c('0xe')](_0x347c('0xb'),_0x1cc6fb,_0x3a8f3c);_0x1b9f05(_0x3a8f3c);});});}exports[_0x347c('0x13')]=function(_0x5b6997){var _0x42ded8=this;return new Promise(function(_0x46b240,_0x43b1c3){return db[_0x347c('0x14')]['update'](_0x5b6997[_0x347c('0x15')],{'raw':_0x5b6997['options']?_0x5b6997[_0x347c('0x16')][_0x347c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6997[_0x347c('0x16')]?_0x5b6997['options'][_0x347c('0x18')]||null:null,'attributes':_0x5b6997[_0x347c('0x16')]?_0x5b6997[_0x347c('0x16')][_0x347c('0x19')]||null:null,'limit':_0x5b6997[_0x347c('0x16')]?_0x5b6997[_0x347c('0x16')][_0x347c('0x1a')]||null:null})[_0x347c('0xa')](function(_0x394c9b){logger[_0x347c('0x1b')](_0x347c('0x13'),_0x5b6997);logger[_0x347c('0x1c')](_0x347c('0x13'),_0x5b6997,JSON['stringify'](_0x394c9b));_0x46b240(_0x394c9b);})['catch'](function(_0x4ebc79){logger[_0x347c('0xe')](_0x347c('0x13'),_0x4ebc79[_0x347c('0x10')],_0x5b6997);_0x43b1c3(_0x42ded8['error'](0x1f4,_0x4ebc79[_0x347c('0x10')]));});});}; \ No newline at end of file +var _0x15aa=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','OpenchannelApplication','update','body','options','raw','attributes','limit','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a760,_0x4e820b){var _0x5b53e8=function(_0x46acd5){while(--_0x46acd5){_0x20a760['push'](_0x20a760['shift']());}};_0x5b53e8(++_0x4e820b);}(_0x15aa,0xd9));var _0xa15a=function(_0x1d2c4b,_0x23167a){_0x1d2c4b=_0x1d2c4b-0x0;var _0x414687=_0x15aa[_0x1d2c4b];return _0x414687;};'use strict';var _=require(_0xa15a('0x0'));var util=require(_0xa15a('0x1'));var moment=require(_0xa15a('0x2'));var BPromise=require(_0xa15a('0x3'));var rs=require(_0xa15a('0x4'));var fs=require('fs');var Redis=require(_0xa15a('0x5'));var db=require(_0xa15a('0x6'))['db'];var utils=require(_0xa15a('0x7'));var logger=require(_0xa15a('0x8'))(_0xa15a('0x9'));var config=require('../../config/environment');var jayson=require(_0xa15a('0xa'));var client=jayson['client'][_0xa15a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5121cf,_0x3cecdf,_0x5b4124){return new BPromise(function(_0x1c1779,_0x41b80d){return client[_0xa15a('0xc')](_0x5121cf,_0x5b4124)['then'](function(_0x4be82b){logger[_0xa15a('0xd')](_0xa15a('0xe'),_0x3cecdf,_0xa15a('0xf'));logger[_0xa15a('0x10')](_0xa15a('0x11'),_0x3cecdf,'request\x20sent',JSON[_0xa15a('0x12')](_0x4be82b));if(_0x4be82b[_0xa15a('0x13')]){if(_0x4be82b[_0xa15a('0x13')][_0xa15a('0x14')]===0x1f4){logger['error'](_0xa15a('0xe'),_0x3cecdf,_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);return _0x41b80d(_0x4be82b['error'][_0xa15a('0x15')]);}logger[_0xa15a('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x3cecdf,_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);return _0x1c1779(_0x4be82b[_0xa15a('0x13')][_0xa15a('0x15')]);}else{logger[_0xa15a('0xd')](_0xa15a('0xe'),_0x3cecdf,'request\x20sent');_0x1c1779(_0x4be82b['result']['message']);}})[_0xa15a('0x16')](function(_0x8025a8){logger['error'](_0xa15a('0xe'),_0x3cecdf,_0x8025a8);_0x41b80d(_0x8025a8);});});}exports['UpdateOpenchannelApplication']=function(_0x1e16ce){var _0x4ccd0e=this;return new Promise(function(_0x3379b2,_0x241e21){return db[_0xa15a('0x17')][_0xa15a('0x18')](_0x1e16ce[_0xa15a('0x19')],{'raw':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce[_0xa15a('0x1a')][_0xa15a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce['options']['where']||null:null,'attributes':_0x1e16ce['options']?_0x1e16ce['options'][_0xa15a('0x1c')]||null:null,'limit':_0x1e16ce[_0xa15a('0x1a')]?_0x1e16ce['options'][_0xa15a('0x1d')]||null:null})[_0xa15a('0x1e')](function(_0x45c7f7){logger[_0xa15a('0xd')](_0xa15a('0x1f'),_0x1e16ce);logger[_0xa15a('0x10')](_0xa15a('0x1f'),_0x1e16ce,JSON[_0xa15a('0x12')](_0x45c7f7));_0x3379b2(_0x45c7f7);})[_0xa15a('0x16')](function(_0x530871){logger[_0xa15a('0x13')](_0xa15a('0x1f'),_0x530871[_0xa15a('0x15')],_0x1e16ce);_0x241e21(_0x4ccd0e[_0xa15a('0x13')](0x1f4,_0x530871[_0xa15a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ee36920..df7d202 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 _0x9752=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','describe','/:id/messages','/:id/download','isAuthenticated','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x4f680c,_0x292aba){var _0x5326b2=function(_0xaccea0){while(--_0xaccea0){_0x4f680c['push'](_0x4f680c['shift']());}};_0x5326b2(++_0x292aba);}(_0x9752,0x1a5));var _0x2975=function(_0x163137,_0x1683be){_0x163137=_0x163137-0x0;var _0x12bc6d=_0x9752[_0x163137];return _0x12bc6d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2975('0x0'));var timeout=require(_0x2975('0x1'));var express=require('express');var router=express[_0x2975('0x2')]();var fs_extra=require(_0x2975('0x3'));var auth=require(_0x2975('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2975('0x5'));var controller=require(_0x2975('0x6'));router[_0x2975('0x7')]('/',auth['isAuthenticated'](),controller[_0x2975('0x8')]);router[_0x2975('0x7')](_0x2975('0x9'),auth['isAuthenticated'](),controller[_0x2975('0xa')]);router[_0x2975('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x2975('0xb'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2975('0x7')](_0x2975('0xc'),auth[_0x2975('0xd')](),controller[_0x2975('0xe')]);router['post']('/',auth[_0x2975('0xd')](),controller[_0x2975('0xf')]);router[_0x2975('0x10')]('/:id/messages',auth[_0x2975('0xd')](),controller[_0x2975('0x11')]);router['post'](_0x2975('0x12'),auth[_0x2975('0xd')](),interaction[_0x2975('0x13')](_0x2975('0x14'),_0x2975('0x15')),controller[_0x2975('0x16')]);router['put'](_0x2975('0x17'),auth[_0x2975('0xd')](),interaction[_0x2975('0x13')](_0x2975('0x14'),'openchannelinteraction:update'),controller[_0x2975('0x18')]);router[_0x2975('0x19')](_0x2975('0x17'),auth['isAuthenticated'](),interaction[_0x2975('0x13')]('openchannel',_0x2975('0x1a')),controller[_0x2975('0x1b')]);router[_0x2975('0x19')]('/:id/tags',auth[_0x2975('0xd')](),controller[_0x2975('0x1c')]);module[_0x2975('0x1d')]=router; \ No newline at end of file +var _0x4f05=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannel'];(function(_0x193659,_0x386ff5){var _0x538a71=function(_0x49ca36){while(--_0x49ca36){_0x193659['push'](_0x193659['shift']());}};_0x538a71(++_0x386ff5);}(_0x4f05,0x1f4));var _0x54f0=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x4f05[_0xa8883];return _0x479426;};'use strict';var multer=require(_0x54f0('0x0'));var util=require(_0x54f0('0x1'));var path=require(_0x54f0('0x2'));var timeout=require(_0x54f0('0x3'));var express=require(_0x54f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54f0('0x5'));var interaction=require(_0x54f0('0x6'));var config=require(_0x54f0('0x7'));var controller=require(_0x54f0('0x8'));router[_0x54f0('0x9')]('/',auth[_0x54f0('0xa')](),controller['index']);router[_0x54f0('0x9')](_0x54f0('0xb'),auth['isAuthenticated'](),controller[_0x54f0('0xc')]);router[_0x54f0('0x9')](_0x54f0('0xd'),auth[_0x54f0('0xa')](),controller[_0x54f0('0xe')]);router['get'](_0x54f0('0xf'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x10')]);router[_0x54f0('0x9')](_0x54f0('0x11'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x12')]);router[_0x54f0('0x13')]('/',auth[_0x54f0('0xa')](),controller['create']);router[_0x54f0('0x13')](_0x54f0('0xf'),auth[_0x54f0('0xa')](),controller[_0x54f0('0x14')]);router['post'](_0x54f0('0x15'),auth[_0x54f0('0xa')](),interaction['tracked']('openchannel',_0x54f0('0x16')),controller[_0x54f0('0x17')]);router[_0x54f0('0x18')]('/:id',auth[_0x54f0('0xa')](),interaction[_0x54f0('0x19')](_0x54f0('0x1a'),'openchannelinteraction:update'),controller[_0x54f0('0x1b')]);router[_0x54f0('0x1c')]('/:id',auth[_0x54f0('0xa')](),interaction[_0x54f0('0x19')](_0x54f0('0x1a'),'openchannelinteraction:destroy'),controller[_0x54f0('0x1d')]);router[_0x54f0('0x1c')](_0x54f0('0x15'),auth[_0x54f0('0xa')](),controller['removeTags']);module[_0x54f0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b291469..e71c5d3 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 _0x6183=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x2ac09d,_0x4799e9){var _0x406b47=function(_0x5632bb){while(--_0x5632bb){_0x2ac09d['push'](_0x2ac09d['shift']());}};_0x406b47(++_0x4799e9);}(_0x6183,0x19b));var _0x3618=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x6183[_0x533e4e];return _0x1f14bb;};'use strict';var Sequelize=require('sequelize');module[_0x3618('0x0')]={'closed':{'type':Sequelize[_0x3618('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3618('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3618('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3618('0x3')]},'note':{'type':Sequelize[_0x3618('0x3')]},'read1stAt':{'type':Sequelize[_0x3618('0x2')]},'threadId':{'type':Sequelize[_0x3618('0x3')]},'externalUrl':{'type':Sequelize[_0x3618('0x3')]},'lastMsgAt':{'type':Sequelize[_0x3618('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3618('0x4')]('in',_0x3618('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3618('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd405=['out','BOOLEAN','STRING','DATE'];(function(_0x541d97,_0x2b12cd){var _0x56dd51=function(_0x17fb8b){while(--_0x17fb8b){_0x541d97['push'](_0x541d97['shift']());}};_0x56dd51(++_0x2b12cd);}(_0xd405,0x1d2));var _0x5d40=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xd405[_0x3f8a03];return _0x147fb2;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5d40('0x0')]},'secondDisposition':{'type':Sequelize[_0x5d40('0x0')]},'thirdDisposition':{'type':Sequelize[_0x5d40('0x0')]},'note':{'type':Sequelize[_0x5d40('0x0')]},'read1stAt':{'type':Sequelize[_0x5d40('0x1')]},'threadId':{'type':Sequelize[_0x5d40('0x0')]},'externalUrl':{'type':Sequelize[_0x5d40('0x0')]},'lastMsgAt':{'type':Sequelize[_0x5d40('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5d40('0x2')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x5d40('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 44e7b4d..f04de8d 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 _0xf21c=['socket.io-emitter','./openchannelInteraction.socket','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','name','map','fullname','TagIds','forEach','Tags','push','then','catch','answered','unmanaged','closed','UserId','talking','waiting','total','index','OpenchannelInteraction','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','field','color','from','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','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?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','unreadMessages','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','contactName','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','show','params','include','options','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit','findOne','rawAttributes','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','emit','openchannelInteractionTags:save','unix','join','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','N.A.','closedAt','threadId','Public','Private','basename','existsSync','pipe','out','lastName','renderFile','root','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x27f941,_0x5bc3ca){var _0x556660=function(_0x367d81){while(--_0x367d81){_0x27f941['push'](_0x27f941['shift']());}};_0x556660(++_0x5bc3ca);}(_0xf21c,0x1bf));var _0xcf21=function(_0x1927dc,_0x235225){_0x1927dc=_0x1927dc-0x0;var _0x4882dc=_0xf21c[_0x1927dc];return _0x4882dc;};'use strict';var emlformat=require(_0xcf21('0x0'));var rimraf=require(_0xcf21('0x1'));var zipdir=require(_0xcf21('0x2'));var jsonpatch=require(_0xcf21('0x3'));var rp=require(_0xcf21('0x4'));var moment=require(_0xcf21('0x5'));var BPromise=require(_0xcf21('0x6'));var Mustache=require(_0xcf21('0x7'));var util=require(_0xcf21('0x8'));var path=require('path');var sox=require(_0xcf21('0x9'));var csv=require(_0xcf21('0xa'));var ejs=require(_0xcf21('0xb'));var fs=require('fs');var fs_extra=require(_0xcf21('0xc'));var _=require(_0xcf21('0xd'));var squel=require(_0xcf21('0xe'));var crypto=require('crypto');var jsforce=require(_0xcf21('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcf21('0xa'));var querystring=require(_0xcf21('0x10'));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 pdf=require('../../components/export/pdf');var hardwareService=require(_0xcf21('0x11'));var logger=require(_0xcf21('0x12'))(_0xcf21('0x13'));var utils=require(_0xcf21('0x14'));var config=require(_0xcf21('0x15'));var licenseUtil=require(_0xcf21('0x16'));var db=require(_0xcf21('0x17'))['db'];config[_0xcf21('0x18')]=_[_0xcf21('0x19')](config['redis'],{'host':_0xcf21('0x1a'),'port':0x18eb});var socket=require(_0xcf21('0x1b'))(new Redis(config[_0xcf21('0x18')]));require(_0xcf21('0x1c'))['register'](socket);function respondWithStatusCode(_0x3843d5,_0x49e939){_0x49e939=_0x49e939||0xcc;return function(_0x16394f){if(_0x16394f){return _0x3843d5['sendStatus'](_0x49e939);}return _0x3843d5['status'](_0x49e939)[_0xcf21('0x1d')]();};}function respondWithResult(_0x5b22fd,_0x4437aa){_0x4437aa=_0x4437aa||0xc8;return function(_0xa6a939){if(_0xa6a939){return _0x5b22fd[_0xcf21('0x1e')](_0x4437aa)[_0xcf21('0x1f')](_0xa6a939);}};}function respondWithFilteredResult(_0x467227,_0x5727e2){return function(_0x41e068){if(_0x41e068){var _0x4d7957=typeof _0x5727e2['offset']===_0xcf21('0x20')&&typeof _0x5727e2['limit']===_0xcf21('0x20');var _0x55249b=_0x41e068[_0xcf21('0x21')];var _0x62fafc=_0x4d7957?0x0:_0x5727e2['offset'];var _0x1561ad=_0x4d7957?_0x41e068[_0xcf21('0x21')]:_0x5727e2[_0xcf21('0x22')]+_0x5727e2[_0xcf21('0x23')];var _0x1a8850;if(_0x1561ad>=_0x55249b){_0x1561ad=_0x55249b;_0x1a8850=0xc8;}else{_0x1a8850=0xce;}_0x467227[_0xcf21('0x1e')](_0x1a8850);return _0x467227[_0xcf21('0x24')](_0xcf21('0x25'),_0x62fafc+'-'+_0x1561ad+'/'+_0x55249b)[_0xcf21('0x1f')](_0x41e068);}return null;};}function patchUpdates(_0x1beee8){return function(_0x59d6c4){try{jsonpatch[_0xcf21('0x26')](_0x59d6c4,_0x1beee8,!![]);}catch(_0x22d2c7){return BPromise[_0xcf21('0x27')](_0x22d2c7);}return _0x59d6c4[_0xcf21('0x28')]();};}function saveUpdates(_0x3c7578,_0x23cc23){return function(_0x594ae7){if(_0x594ae7){return _0x594ae7[_0xcf21('0x29')](_0x3c7578)['then'](function(_0xc015a7){return _0xc015a7;});}return null;};}function removeEntity(_0x1559c5,_0x330630){return function(_0xec8306){if(_0xec8306){return _0xec8306['destroy']()['then'](function(){_0x1559c5['status'](0xcc)[_0xcf21('0x1d')]();});}};}function handleEntityNotFound(_0xe69640,_0x4e9846){return function(_0x126e76){if(!_0x126e76){_0xe69640[_0xcf21('0x2a')](0x194);}return _0x126e76;};}function handleError(_0x16ce63,_0x102f31){_0x102f31=_0x102f31||0x1f4;return function(_0x4d78df){logger['error'](_0x4d78df['stack']);if(_0x4d78df[_0xcf21('0x2b')]){delete _0x4d78df[_0xcf21('0x2b')];}_0x16ce63['status'](_0x102f31)['send'](_0x4d78df);};}function getInteractionUsers(_0x4487f9,_0x5b5bc0){return new BPromise(function(_0x3390bb,_0x1408a4){try{if(_0x5b5bc0[_0x4487f9['id']]){_0x4487f9['Users']=_[_0xcf21('0x2c')](_0x5b5bc0[_0x4487f9['id']],function(_0x1ddfba){return{'id':_0x1ddfba['id'],'fullname':_0x1ddfba[_0xcf21('0x2d')]};});}}catch(_0x39d143){_0x1408a4(_0x39d143);}_0x3390bb(_0x4487f9);});}function getInteractionTags(_0x327995,_0x21e487){return new BPromise(function(_0xf14783,_0x42f239){try{if(_0x327995[_0xcf21('0x2e')]){_0x327995['Tags']=[];_0x327995[_0xcf21('0x2e')]['split'](',')[_0xcf21('0x2f')](function(_0x207dc7){_0x327995[_0xcf21('0x30')][_0xcf21('0x31')](_0x21e487[_0x207dc7]);});}delete _0x327995[_0xcf21('0x2e')];}catch(_0x34c280){_0x42f239(_0x34c280);}_0xf14783(_0x327995);});}function updateOpenchannelInteraction(_0x28646d,_0x1482b8,_0x4b1ad7){return new BPromise(function(_0x4a83cc,_0x539102){return getInteractionUsers(_0x28646d,_0x4b1ad7)[_0xcf21('0x32')](function(_0x17044){return getInteractionTags(_0x17044,_0x1482b8);})[_0xcf21('0x32')](function(_0x19291b){return getStateInteraction(_0x19291b);})['then'](function(_0x5933f3){_0x4a83cc(_0x5933f3);})[_0xcf21('0x33')](function(_0x36ec4a){_0x539102(_0x36ec4a);});});}function getStateInteraction(_0x4f18fa){return new BPromise(function(_0x343485){_0x4f18fa['waiting']=0x0;_0x4f18fa['talking']=0x0;_0x4f18fa[_0xcf21('0x34')]=0x0;_0x4f18fa[_0xcf21('0x35')]=0x0;_0x4f18fa['total']=0x0;if(!_0x4f18fa[_0xcf21('0x36')]&&!_0x4f18fa[_0xcf21('0x37')]){_0x4f18fa['waiting']+=0x1;}if(!_0x4f18fa['closed']&&_0x4f18fa[_0xcf21('0x37')]){_0x4f18fa[_0xcf21('0x38')]+=0x1;if(_0x4f18fa[_0xcf21('0x39')]){_0x4f18fa[_0xcf21('0x39')]-=0x1;}}if(_0x4f18fa[_0xcf21('0x36')]&&_0x4f18fa['UserId']){_0x4f18fa[_0xcf21('0x34')]+=0x1;if(_0x4f18fa['talking']){_0x4f18fa[_0xcf21('0x38')]-=0x1;}}if(_0x4f18fa[_0xcf21('0x36')]&&!_0x4f18fa[_0xcf21('0x37')]){_0x4f18fa[_0xcf21('0x35')]+=0x1;if(_0x4f18fa[_0xcf21('0x39')]){_0x4f18fa[_0xcf21('0x39')]-=0x1;}}_0x4f18fa[_0xcf21('0x3a')]+=0x1;_0x343485(_0x4f18fa);});}exports[_0xcf21('0x3b')]=function(_0x2d18cd,_0x40d0b6){var _0x47cd02={},_0x501865={},_0x388e26={'count':0x0,'rows':[]};var _0x58a00f=_[_0xcf21('0x2c')](db[_0xcf21('0x3c')]['rawAttributes'],function(_0x5cce79){return{'name':_0x5cce79[_0xcf21('0x3d')],'type':_0x5cce79[_0xcf21('0x3e')]['key']};});_0x501865[_0xcf21('0x3f')]=_[_0xcf21('0x2c')](_0x58a00f,_0xcf21('0x2b'));_0x501865['query']=_[_0xcf21('0x40')](_0x2d18cd[_0xcf21('0x41')]);_0x501865[_0xcf21('0x42')]=_['intersection'](_0x501865[_0xcf21('0x3f')],_0x501865['query']);_0x47cd02[_0xcf21('0x43')]=_[_0xcf21('0x44')](_0x501865[_0xcf21('0x3f')],qs[_0xcf21('0x45')](_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x45')]));_0x47cd02['attributes']=_0x47cd02[_0xcf21('0x43')][_0xcf21('0x46')]?_0x47cd02['attributes']:_0x501865[_0xcf21('0x3f')];if(!_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x47')](_0xcf21('0x48'))){_0x47cd02[_0xcf21('0x23')]=qs['limit'](_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x23')]);_0x47cd02[_0xcf21('0x22')]=qs[_0xcf21('0x22')](_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x22')]);}_0x47cd02[_0xcf21('0x49')]=qs['sort'](_0x2d18cd[_0xcf21('0x41')]['sort']);_0x47cd02[_0xcf21('0x4a')]=qs[_0xcf21('0x42')](_[_0xcf21('0x4b')](_0x2d18cd[_0xcf21('0x41')],_0x501865['filters']),_0x58a00f);var _0xfe7539=[];var _0x39b5b4=squel['select']()[_0xcf21('0x4c')]('id')[_0xcf21('0x4c')]('name')[_0xcf21('0x4c')](_0xcf21('0x4d'))[_0xcf21('0x4e')]('tools_tags');var _0x2197a1=squel[_0xcf21('0x4f')]()[_0xcf21('0x4c')](_0xcf21('0x50'))['field'](_0xcf21('0x51'))[_0xcf21('0x4c')](_0xcf21('0x52'))[_0xcf21('0x4e')](_0xcf21('0x53'),'ui')['left_join'](_0xcf21('0x54'),'u',_0xcf21('0x55'));var _0x5b1b11=squel[_0xcf21('0x4f')]()[_0xcf21('0x4e')](_0xcf21('0x56'),'i')[_0xcf21('0x57')]('cm_contacts','c',_0xcf21('0x58'))[_0xcf21('0x57')]('users','o',_0xcf21('0x59'))['left_join'](_0xcf21('0x5a'),'a',_0xcf21('0x5b'))[_0xcf21('0x57')]('openchannel_messages','me',_0xcf21('0x5c'))['left_join'](_0xcf21('0x5d'),'it',_0xcf21('0x5e'))[_0xcf21('0x57')](_0xcf21('0x5f'),'t',_0xcf21('0x60'));var _0x4e99ee=squel[_0xcf21('0x61')]();var _0x58474b=[];var _0x2b54d5=squel[_0xcf21('0x61')]();var _0x360960;if(_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x62')]){_0x360960=as['parseSearch'](_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x62')]);var _0x4c4bf3=_0x360960[_0xcf21('0x63')];for(var _0x286bc0=0x0;_0x286bc0<_0x360960[_0xcf21('0x64')][_0xcf21('0x46')];_0x286bc0++){var _0x195e12=_0x360960[_0xcf21('0x64')][_0x286bc0];var _0x487097='i';var _0x451483=_['find'](_0x58a00f,[_0xcf21('0x2b'),_0x195e12[_0xcf21('0x4c')]]);if(!_0x451483){switch(_0x195e12[_0xcf21('0x4c')]){case'unreadMessages':if(_0x195e12['value']==0x1){_0x5b1b11['having']('`'+_0x195e12['field']+_0xcf21('0x65'));}else{_0x5b1b11['having']('`'+_0x195e12[_0xcf21('0x4c')]+_0xcf21('0x66'));}break;case _0xcf21('0x67'):if(_0x195e12[_0xcf21('0x68')]===_0xcf21('0x69')){if(_0x195e12['value'][_0xcf21('0x6a')]('\x20')[_0xcf21('0x46')]>0x1){_0x4e99ee[_0x4c4bf3](_0xcf21('0x6b'),qs[_0xcf21('0x6c')](_0x195e12[_0xcf21('0x6d')]),null);}else{var _0x3342b7='%'+_0x195e12[_0xcf21('0x6d')]+'%';_0x4e99ee[_0x4c4bf3](_0xcf21('0x6e'),_0x3342b7,_0x3342b7,_0x3342b7);}}else{_0x451483=_[_0xcf21('0x6f')](_0x58a00f,[_0xcf21('0x2b'),_0xcf21('0x70')]);_0x195e12[_0xcf21('0x4c')]='ContactId';_0xcbe347=as[_0xcf21('0x71')](_0x487097,_0x451483[_0xcf21('0x3e')],_0x195e12);_0x4e99ee[_0x4c4bf3](_0xcbe347[_0xcf21('0x72')],_0xcbe347[_0xcf21('0x6d')][_0xcf21('0x73')],_0xcbe347[_0xcf21('0x6d')]['end']);}break;case _0xcf21('0x74'):var _0x53ad42=_0x195e12[_0xcf21('0x6d')][_0xcf21('0x6a')](',')['map'](function(_0x22632a){return Number(_0x22632a);});_0x53ad42[_0xcf21('0x2f')](function(_0x1a3dde){_0x2b54d5['or'](_0xcf21('0x75'),'%,'+_0x1a3dde+',%');});_0x58474b=_[_0xcf21('0x76')](_0x58474b,_0x53ad42);break;case _0xcf21('0x77'):if(_0x195e12['operator']==='$substring'){_0x4e99ee[_0x4c4bf3](_0xcf21('0x78'),'%'+_0x195e12[_0xcf21('0x6d')]+'%',null);}else{_0x451483=_[_0xcf21('0x6f')](_0x58a00f,[_0xcf21('0x2b'),_0xcf21('0x37')]);_0x195e12[_0xcf21('0x4c')]=_0xcf21('0x37');_0xcbe347=as['buildExpression'](_0x487097,_0x451483[_0xcf21('0x3e')],_0x195e12);_0x4e99ee[_0x4c4bf3](_0xcbe347[_0xcf21('0x72')],_0xcbe347[_0xcf21('0x6d')][_0xcf21('0x73')],_0xcbe347['value'][_0xcf21('0x1d')]);}break;case'body':_0xcbe347=as[_0xcf21('0x71')]('me',null,_0x195e12);_0x4e99ee[_0x4c4bf3](_0xcbe347[_0xcf21('0x72')],_0xcbe347[_0xcf21('0x6d')][_0xcf21('0x73')],_0xcbe347[_0xcf21('0x6d')][_0xcf21('0x1d')]);break;}}else{var _0xcbe347=as['buildExpression'](_0x487097,_0x451483[_0xcf21('0x3e')],_0x195e12);_0x4e99ee[_0x4c4bf3](_0xcbe347[_0xcf21('0x72')],_0xcbe347['value'][_0xcf21('0x73')],_0xcbe347[_0xcf21('0x6d')][_0xcf21('0x1d')]);}}}else{var _0x196d80=_(_0x2d18cd[_0xcf21('0x41')])[_0xcf21('0x40')]()[_0xcf21('0x2c')](function(_0x4f8df3){return _[_0xcf21('0x79')](_0x58a00f,['name',_0x4f8df3])?_0x4f8df3:undefined;})['compact']()[_0xcf21('0x6d')]();if(!_[_0xcf21('0x7a')](_0x196d80)){_0x196d80[_0xcf21('0x2f')](function(_0x215c9e){if(_0x215c9e===_0xcf21('0x7b')){_0x5b1b11[_0xcf21('0x4a')](_0xcf21('0x7c'),[]['concat'](_0x2d18cd[_0xcf21('0x41')][_0x215c9e]));}else if(_0x215c9e===_0xcf21('0x7d')){var _0xa4d0bc=JSON[_0xcf21('0x7e')](_0x2d18cd[_0xcf21('0x41')][_0x215c9e])[_0xcf21('0x7f')];var _0x4bd2c2=JSON[_0xcf21('0x7e')](_0x2d18cd[_0xcf21('0x41')][_0x215c9e])[_0xcf21('0x80')];_0x5b1b11[_0xcf21('0x4a')](_0xcf21('0x81'),_0xa4d0bc,_0x4bd2c2);}else{if(_0x2d18cd[_0xcf21('0x41')][_0x215c9e]==='null'){_0x5b1b11[_0xcf21('0x4a')]('i.'+_0x215c9e+'\x20IS\x20NULL');}else{_0x5b1b11[_0xcf21('0x4a')]('i.'+_0x215c9e+_0xcf21('0x82'),_0x2d18cd[_0xcf21('0x41')][_0x215c9e]);}}});}if(_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x83')]){if(_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x83')]==0x1){_0x5b1b11['having'](_0xcf21('0x84'));}else{_0x5b1b11[_0xcf21('0x85')](_0xcf21('0x86'));}}if(_0x2d18cd[_0xcf21('0x41')]['tag']){_0x58474b=_['isArray'](_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x87')])?_0x2d18cd['query'][_0xcf21('0x87')]:new Array(_0x2d18cd['query'][_0xcf21('0x87')]);_0x58474b[_0xcf21('0x2f')](function(_0xf49a44){_0x2b54d5['or'](_0xcf21('0x75'),'%,'+_0xf49a44+',%');});}if(_0x2d18cd['query'][_0xcf21('0x88')]){var _0x13186a=_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x88')][_0xcf21('0x89')]('\x5c','\x5c\x5c')[_0xcf21('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x13186a)){_0x4e99ee['or'](_0xcf21('0x8a'),_0x13186a+'%');}else{_0x4e99ee['or'](_0xcf21('0x8b'),qs[_0xcf21('0x6c')](_0x13186a))['or'](_0xcf21('0x8c'),_0x13186a+'%')['or'](_0xcf21('0x8d'),_0x13186a+'%');}}}_0x5b1b11[_0xcf21('0x4a')](_0x4e99ee);_0x5b1b11['group'](_0xcf21('0x8e'));var _0x449642={'type':db['Sequelize'][_0xcf21('0x8f')]['SELECT'],'raw':!![]};var _0x1bc67a=_0x5b1b11['clone']();_0x1bc67a[_0xcf21('0x4c')](_0xcf21('0x8e'));_0x1bc67a[_0xcf21('0x4c')](_0xcf21('0x90'),'unreadMessages');if(_0x47cd02[_0xcf21('0x49')]){_0x47cd02[_0xcf21('0x49')][_0xcf21('0x2f')](function(_0x25543c){var _0x5631f8=_0x25543c[0x0]==='contactName'?_0x25543c[0x0]:'i.'+_0x25543c[0x0];_0x5b1b11['order'](_0x5631f8,_0x25543c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcf21('0x7a')](_0x58474b)){_0x5b1b11[_0xcf21('0x85')](_0x2b54d5);_0x1bc67a[_0xcf21('0x4a')](_0xcf21('0x91'),_0x58474b);}BPromise['resolve']()['then'](function(){if(!_0x360960){if(_0x2d18cd[_0xcf21('0x41')]['OpenchannelAccountId'])return;_0x1bc67a[_0xcf21('0x4a')](_0xcf21('0x92'));_0x5b1b11[_0xcf21('0x4a')](_0xcf21('0x92'));return;}if(_0x2d18cd[_0xcf21('0x93')][_0xcf21('0x94')]!==_0xcf21('0x95'))return;return _0x2d18cd[_0xcf21('0x93')][_0xcf21('0x96')]({'attributes':['id'],'raw':!![]})[_0xcf21('0x32')](function(_0x478522){if(_[_0xcf21('0x7a')](_0x478522)){_0x1bc67a['where'](_0xcf21('0x97'));_0x5b1b11[_0xcf21('0x4a')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x1bc67a[_0xcf21('0x4a')](_0xcf21('0x7c'),_['map'](_0x478522,'id'));_0x5b1b11[_0xcf21('0x4a')](_0xcf21('0x7c'),_[_0xcf21('0x2c')](_0x478522,'id'));}});})[_0xcf21('0x32')](function(){if(_0x2d18cd['user']['role']===_0xcf21('0x95')&&!_0x360960&&!_0x2d18cd['query']['OpenchannelAccountId'])return[];return db[_0xcf21('0x98')][_0xcf21('0x41')](_0x1bc67a[_0xcf21('0x99')](),_0x449642);})[_0xcf21('0x32')](function(_0x54e9a6){_0x388e26[_0xcf21('0x21')]=_0x54e9a6[_0xcf21('0x46')];if(_0x388e26['count']===0x0)return[];return db[_0xcf21('0x98')][_0xcf21('0x41')](_0x39b5b4[_0xcf21('0x99')](),_0x449642)['then'](function(_0x4ca2a9){_0xfe7539=_['keyBy'](_0x4ca2a9,'id');_0x449642=_[_0xcf21('0x9a')](_0x449642,{'model':db[_0xcf21('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d18cd[_0xcf21('0x41')][_0xcf21('0x45')]){_0x47cd02['attributes'][_0xcf21('0x2f')](function(_0x519bb7){_0x5b1b11['field']('i.'+_0x519bb7);});}else{_0x5b1b11[_0xcf21('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcf21('0x9b'));_0x5b1b11['field'](_0xcf21('0x9c'),_0xcf21('0x9d'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0x9e'),_0xcf21('0x9f'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xa0'),_0xcf21('0xa1'));_0x5b1b11['field'](_0xcf21('0xa2'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xa3'),_0xcf21('0xa4'));_0x5b1b11['field']('c.lastName',_0xcf21('0xa5'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xa6'),_0xcf21('0xa7'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xa8'),_0xcf21('0xa9'));_0x5b1b11['field'](_0xcf21('0xaa'),_0xcf21('0xab'));_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xac'),'Contact.fax');_0x5b1b11[_0xcf21('0x4c')](_0xcf21('0xad'),_0xcf21('0xae'));_0x5b1b11[_0xcf21('0x4c')]('o.internal','Owner.internal');_0x5b1b11['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x47cd02[_0xcf21('0x23')])_0x5b1b11['limit'](_0x47cd02[_0xcf21('0x23')]);if(_0x47cd02['offset'])_0x5b1b11[_0xcf21('0x22')](_0x47cd02['offset']);return db[_0xcf21('0x98')][_0xcf21('0x41')](_0x5b1b11[_0xcf21('0x99')](),_0x449642);})[_0xcf21('0x32')](function(_0xa834bd){if(_0xa834bd[_0xcf21('0x46')]>0x0)_0x2197a1[_0xcf21('0x4a')](_0xcf21('0xaf'),_[_0xcf21('0x2c')](_0xa834bd,'id'));return db[_0xcf21('0x98')][_0xcf21('0x41')](_0x2197a1[_0xcf21('0x99')](),_0x449642)[_0xcf21('0x32')](function(_0x571870){var _0x17bd13=_[_0xcf21('0xb0')](_0x571870,_0xcf21('0xb1'));var _0x23e04f=[];_0xa834bd['forEach'](function(_0x4e56f1){_0x23e04f[_0xcf21('0x31')](updateOpenchannelInteraction(_0x4e56f1,_0xfe7539,_0x17bd13));});return BPromise[_0xcf21('0xb2')](_0x23e04f);});});})[_0xcf21('0x32')](function(_0x2250db){_0x388e26['rows']=_0x2250db;return _0x388e26;})[_0xcf21('0x32')](respondWithFilteredResult(_0x40d0b6,_0x47cd02))[_0xcf21('0x33')](handleError(_0x40d0b6,null));};exports[_0xcf21('0xb3')]=function(_0x1f53ba,_0x1db826){var _0x4cee33={};if(_0x1f53ba[_0xcf21('0x41')]['type']&&_0x1f53ba[_0xcf21('0x41')]['type']===_0xcf21('0x4e')){_0x4cee33[_0xcf21('0x4e')]=_0x1f53ba[_0xcf21('0xb4')]['id'];}else{_0x4cee33['id']=_0x1f53ba[_0xcf21('0xb4')]['id'];}var _0x2e4c2d={'raw':![],'where':_0x4cee33},_0x148405={};_0x148405[_0xcf21('0x3f')]=_[_0xcf21('0x40')](db['OpenchannelInteraction']['rawAttributes']);_0x148405['query']=_[_0xcf21('0x40')](_0x1f53ba[_0xcf21('0x41')]);_0x148405[_0xcf21('0x42')]=_[_0xcf21('0x44')](_0x148405[_0xcf21('0x3f')],_0x148405[_0xcf21('0x41')]);_0x2e4c2d[_0xcf21('0x43')]=_[_0xcf21('0x44')](_0x148405[_0xcf21('0x3f')],qs[_0xcf21('0x45')](_0x1f53ba['query']['fields']));_0x2e4c2d[_0xcf21('0x43')]=_0x2e4c2d[_0xcf21('0x43')][_0xcf21('0x46')]?_0x2e4c2d['attributes']:_0x148405['model'];if(_0x1f53ba[_0xcf21('0x41')]['includeAll']){_0x2e4c2d[_0xcf21('0xb5')]=[{'all':!![]}];}_0x2e4c2d=_[_0xcf21('0x9a')]({},_0x2e4c2d,_0x1f53ba[_0xcf21('0xb6')]);return db['OpenchannelInteraction'][_0xcf21('0x6f')](_0x2e4c2d)['then'](handleEntityNotFound(_0x1db826,null))[_0xcf21('0x32')](respondWithResult(_0x1db826,null))[_0xcf21('0x33')](handleError(_0x1db826,null));};exports['create']=function(_0x4a488d,_0x5d7222){return db['OpenchannelInteraction']['create'](_0x4a488d['body'],{})[_0xcf21('0x32')](respondWithResult(_0x5d7222,0xc9))[_0xcf21('0x33')](handleError(_0x5d7222,null));};exports['update']=function(_0x5b5e37,_0x243652){if(_0x5b5e37[_0xcf21('0xb7')]['id']){delete _0x5b5e37['body']['id'];}return db[_0xcf21('0x3c')][_0xcf21('0x6f')]({'where':{'id':_0x5b5e37[_0xcf21('0xb4')]['id']}})[_0xcf21('0x32')](handleEntityNotFound(_0x243652,null))[_0xcf21('0x32')](saveUpdates(_0x5b5e37[_0xcf21('0xb7')],null))[_0xcf21('0x32')](respondWithResult(_0x243652,null))[_0xcf21('0x33')](handleError(_0x243652,null));};exports[_0xcf21('0xb8')]=function(_0x27cb0d,_0xf0b577){return db[_0xcf21('0x3c')][_0xcf21('0x6f')]({'where':{'id':_0x27cb0d['params']['id']}})[_0xcf21('0x32')](handleEntityNotFound(_0xf0b577,null))['then'](removeEntity(_0xf0b577,null))['catch'](handleError(_0xf0b577,null));};exports[_0xcf21('0xb9')]=function(_0x1f825f,_0x93aa62){return db[_0xcf21('0x3c')][_0xcf21('0xb9')]()[_0xcf21('0x32')](respondWithResult(_0x93aa62,null))[_0xcf21('0x33')](handleError(_0x93aa62,null));};exports[_0xcf21('0xba')]=function(_0x5582e0,_0x7f0707,_0x380e90){return db[_0xcf21('0xbb')][_0xcf21('0x6f')]({'where':{'id':_0x5582e0[_0xcf21('0xb4')]['id']}})[_0xcf21('0x32')](handleEntityNotFound(_0x7f0707,null))[_0xcf21('0x32')](function(_0x388f74){if(_0x388f74){return _0x388f74[_0xcf21('0xba')](_0x5582e0[_0xcf21('0xb7')][_0xcf21('0xbc')],_[_0xcf21('0xbd')](_0x5582e0[_0xcf21('0xb7')],[_0xcf21('0xbc'),'id'])||{});}})[_0xcf21('0x32')](respondWithResult(_0x7f0707,null))[_0xcf21('0x33')](handleError(_0x7f0707,null));};exports['getMessages']=function(_0x5b31ba,_0x3bf729,_0x1e7644){var _0x5d7848={'raw':![],'where':{}};var _0x18b3e2={};var _0x48b223={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xcf21('0xbe')]({'where':{'id':_0x5b31ba[_0xcf21('0xb4')]['id']}})[_0xcf21('0x32')](handleEntityNotFound(_0x3bf729,null))['then'](function(_0x2609b9){if(_0x2609b9){_0x18b3e2[_0xcf21('0x3f')]=_[_0xcf21('0x40')](db[_0xcf21('0xbb')][_0xcf21('0xbf')]);_0x18b3e2[_0xcf21('0x41')]=_[_0xcf21('0x40')](_0x5b31ba[_0xcf21('0x41')]);_0x18b3e2[_0xcf21('0x42')]=_[_0xcf21('0x44')](_0x18b3e2[_0xcf21('0x3f')],_0x18b3e2[_0xcf21('0x41')]);_0x5d7848['attributes']=_['intersection'](_0x18b3e2[_0xcf21('0x3f')],qs[_0xcf21('0x45')](_0x5b31ba[_0xcf21('0x41')]['fields']));_0x5d7848[_0xcf21('0x43')]=_0x5d7848[_0xcf21('0x43')]['length']?_0x5d7848[_0xcf21('0x43')]:_0x18b3e2[_0xcf21('0x3f')];if(!_0x5b31ba[_0xcf21('0x41')]['hasOwnProperty']('nolimit')){_0x5d7848[_0xcf21('0x23')]=qs['limit'](_0x5b31ba['query'][_0xcf21('0x23')]);_0x5d7848[_0xcf21('0x22')]=qs[_0xcf21('0x22')](_0x5b31ba[_0xcf21('0x41')]['offset']);}_0x5d7848[_0xcf21('0x49')]=qs['sort'](_0x5b31ba[_0xcf21('0x41')][_0xcf21('0xc0')]);_0x5d7848[_0xcf21('0x4a')]=qs['filters'](_['pick'](_0x5b31ba[_0xcf21('0x41')],_0x18b3e2[_0xcf21('0x42')]));_0x5d7848[_0xcf21('0x4a')]['OpenchannelInteractionId']=_0x2609b9['id'];if(_0x5b31ba['query'][_0xcf21('0x88')]){_0x5d7848[_0xcf21('0x4a')]=_[_0xcf21('0x9a')](_0x5d7848['where'],{'$or':_[_0xcf21('0x2c')](_0x5d7848['attributes'],function(_0x45b457){var _0x5a59c0={};_0x5a59c0[_0x45b457]={'$like':'%'+_0x5b31ba['query'][_0xcf21('0x88')]+'%'};return _0x5a59c0;})});}if(_0x5b31ba['query'][_0xcf21('0x7f')]){var _0x140e91=_0x5b31ba[_0xcf21('0x41')][_0xcf21('0x7f')]['split'](',');var _0x42af45={};_0x42af45[_0x140e91[0x0]]={'$gte':moment(_0x140e91[0x1])[_0xcf21('0xc1')](_0xcf21('0xc2'))};_0x5d7848[_0xcf21('0x4a')]=_['merge'](_0x5d7848[_0xcf21('0x4a')],_0x42af45);}_0x5d7848=_[_0xcf21('0x9a')]({},_0x5d7848,_0x5b31ba[_0xcf21('0xb6')]);return db[_0xcf21('0xbb')]['count']({'where':_0x5d7848[_0xcf21('0x4a')]})[_0xcf21('0x32')](function(_0x236ad8){_0x48b223[_0xcf21('0x21')]=_0x236ad8;if(_0x5b31ba[_0xcf21('0x41')]['includeAll']){_0x5d7848[_0xcf21('0xb5')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcf21('0xc3')](_0x5d7848);})[_0xcf21('0x32')](function(_0x5d4e76){_0x48b223[_0xcf21('0xc4')]=_0x5d4e76;return _0x48b223;});}})['then'](respondWithFilteredResult(_0x3bf729,_0x5d7848))[_0xcf21('0x33')](handleError(_0x3bf729,null));};exports['addTags']=function(_0x3fb070,_0x1448e4,_0x5a6dd7){return db[_0xcf21('0x3c')][_0xcf21('0x6f')]({'where':{'id':_0x3fb070['params']['id']}})['then'](handleEntityNotFound(_0x1448e4,null))[_0xcf21('0x32')](function(_0x1aa80f){if(_0x1aa80f){return _0x1aa80f[_0xcf21('0xc5')](_0x3fb070['body'][_0xcf21('0xbc')],_[_0xcf21('0xbd')](_0x3fb070[_0xcf21('0xb7')],[_0xcf21('0xbc'),'id'])||{})['spread'](function(){return db[_0xcf21('0x74')][_0xcf21('0xc3')]({'attributes':['id',_0xcf21('0x2b'),_0xcf21('0x4d')],'where':{'id':_0x3fb070[_0xcf21('0xb7')][_0xcf21('0xbc')]}});})[_0xcf21('0x32')](function(_0x2e5ecf){socket[_0xcf21('0xc6')](_0xcf21('0xc7'),{'id':Number(_0x3fb070['params']['id']),'tags':_0x2e5ecf||[]});return{'id':Number(_0x3fb070[_0xcf21('0xb4')]['id']),'tags':_0x2e5ecf||[]};});}})[_0xcf21('0x32')](respondWithResult(_0x1448e4,null))[_0xcf21('0x33')](handleError(_0x1448e4,null));};exports['removeTags']=function(_0x581efb,_0x369612,_0xa61cd4){return db[_0xcf21('0x3c')]['find']({'where':{'id':_0x581efb['params']['id']}})[_0xcf21('0x32')](handleEntityNotFound(_0x369612,null))[_0xcf21('0x32')](function(_0x5227f9){if(_0x5227f9){return _0x5227f9['removeTags'](_0x581efb[_0xcf21('0x41')][_0xcf21('0xbc')]);}})[_0xcf21('0x32')](respondWithStatusCode(_0x369612,null))[_0xcf21('0x33')](handleError(_0x369612,null));};exports['download']=function(_0x152144,_0x42c6c7){var _0x537870=moment()[_0xcf21('0xc8')]()[_0xcf21('0x99')]();var _0x3e5c35=path[_0xcf21('0xc9')](config['root'],_0xcf21('0xca'),_0xcf21('0xcb'),'tmp');var _0x3754bf=path[_0xcf21('0xc9')](config['root'],_0xcf21('0xca'),_0xcf21('0xcb'),_0xcf21('0xcc'));var _0x372a01=path[_0xcf21('0xc9')](_0x3e5c35,_0x537870);var _0x43b2f8=util['format'](_0xcf21('0xcd'),_0x152144[_0xcf21('0xb4')]['id'],_0x537870);var _0x5d64d2=path['join'](_0x3e5c35,_0x43b2f8);var _0xd84171=[];_0xd84171['push']({'model':db['User'],'as':_0xcf21('0x77'),'attributes':['id',_0xcf21('0x2d')],'raw':!![]});_0xd84171['push']({'model':db[_0xcf21('0xce')],'as':_0xcf21('0x67'),'attributes':['id',_0xcf21('0xcf'),'lastName'],'raw':!![]});if(_0x152144[_0xcf21('0x41')][_0xcf21('0xcc')]){_0xd84171['push']({'model':db[_0xcf21('0xd0')],'as':_0xcf21('0xd0'),'raw':!![]});}var _0x48b3e0=[{'model':db[_0xcf21('0xbb')],'as':_0xcf21('0xd1'),'attributes':['id',_0xcf21('0xb7'),_0xcf21('0x7d'),_0xcf21('0xd2'),_0xcf21('0xd3'),'read'],'include':_0xd84171}];_0x48b3e0[_0xcf21('0x31')]({'model':db[_0xcf21('0xd4')],'as':_0xcf21('0xd5'),'attributes':['id',_0xcf21('0x2b')]});_0x48b3e0[_0xcf21('0x31')]({'model':db[_0xcf21('0x77')],'as':_0xcf21('0xd6'),'attributes':['id',_0xcf21('0x2d')]});return db[_0xcf21('0x3c')]['find']({'where':{'id':_0x152144[_0xcf21('0xb4')]['id']},'include':_0x48b3e0})[_0xcf21('0x32')](handleEntityNotFound(_0x42c6c7,null))[_0xcf21('0x32')](function(_0x3da087){if(_0x3da087){var _0xa21e63=_0x3da087[_0xcf21('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x372a01);var _0x1a716f={'channel':'Openchannel','account':_0xa21e63[_0xcf21('0xd5')][_0xcf21('0x2b')],'agent':_0xa21e63[_0xcf21('0xd6')]?_0xa21e63[_0xcf21('0xd6')][_0xcf21('0x2d')]:_0xcf21('0xd8'),'createdAt':moment(_0xa21e63[_0xcf21('0x7d')])['format'](_0xcf21('0xc2'))['toString'](),'closedAt':_0xa21e63[_0xcf21('0x36')]?moment(_0xa21e63[_0xcf21('0xd9')])[_0xcf21('0xc1')](_0xcf21('0xc2'))['toString']():'','disposition':_0xa21e63['disposition'],'visibility':_0xa21e63[_0xcf21('0xda')]?_0xcf21('0xdb'):_0xcf21('0xdc'),'messages':_(_0xa21e63[_0xcf21('0xd1')])[_0xcf21('0x88')]({'secret':![]})['map'](function(_0x332089){if(_0x332089['Attachment']){var _0x1a812c=path['join'](_0x3754bf,_0x332089['Attachment'][_0xcf21('0xdd')]);if(fs[_0xcf21('0xde')](_0x1a812c)){fs['createReadStream'](_0x1a812c)[_0xcf21('0xdf')](fs['createWriteStream'](path['join'](_0x372a01,_0x332089[_0xcf21('0xd0')][_0xcf21('0xdd')])));}}return{'date':moment(_0x332089[_0xcf21('0x7d')])[_0xcf21('0xc1')](_0xcf21('0xc2'))[_0xcf21('0x99')](),'sender':_0x332089[_0xcf21('0xd2')]===_0xcf21('0xe0')?_0x332089[_0xcf21('0x77')]?_0x332089[_0xcf21('0x77')][_0xcf21('0x2d')]:'System':_0x332089[_0xcf21('0x67')]['firstName']+(_0x332089[_0xcf21('0x67')]['lastName']?'\x20'+_0x332089[_0xcf21('0x67')][_0xcf21('0xe1')]:''),'body':_0x332089[_0xcf21('0xd0')]?_0x332089[_0xcf21('0xd0')][_0xcf21('0xdd')]:_0x332089['body'],'direction':_0x332089[_0xcf21('0xd2')]===_0xcf21('0xe0')?'A':'C','secret':_0x332089[_0xcf21('0xd3')],'read':_0x332089[_0xcf21('0x83')],'attachment':_0x332089[_0xcf21('0xd0')]};})[_0xcf21('0x6d')]()};return ejs[_0xcf21('0xe2')](path[_0xcf21('0xc9')](config[_0xcf21('0xe3')],_0xcf21('0xca'),_0xcf21('0xe4'),_0xcf21('0xe5')),{'interaction':_0x1a716f})[_0xcf21('0x32')](function(_0x576ceb){var _0x1ce288=path[_0xcf21('0xc9')](_0x372a01,_0xcf21('0xe6')+_0xa21e63['id']+'-'+_0x537870+_0xcf21('0xe7'));var _0x53386d={'path':_0x1ce288,'channel':_0xcf21('0xe8'),'interactionId':_0xa21e63['id']};return pdf[_0xcf21('0xe9')](_0x576ceb,_0x53386d);})['then'](function(){return new BPromise(function(_0x489fe2,_0x4cfdf1){zipdir(_0x372a01,{'saveTo':_0x5d64d2},function(_0xbfa170,_0x5c16b1){if(_0xbfa170)return _0x4cfdf1(_0xbfa170);return _0x489fe2(_0x5c16b1);});})[_0xcf21('0x32')](function(){return new BPromise(function(_0x974a4a,_0x1e9f39){rimraf(_0x372a01,function(_0x34fa4c){if(_0x34fa4c)_0x1e9f39(_0x34fa4c);return _0x974a4a();});});})[_0xcf21('0x32')](function(){return _0x42c6c7['download'](_0x5d64d2,_0x43b2f8,function(_0x172ee0){if(_0x172ee0){console[_0xcf21('0xea')](_0xcf21('0xeb'),_0x172ee0);}else{fs[_0xcf21('0xec')](_0x5d64d2);}});});});}else{return _0x42c6c7[_0xcf21('0x2a')](0xc8);}})[_0xcf21('0x33')](handleError(_0x42c6c7,null));}; \ No newline at end of file +var _0x1636=['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','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','sequelize','toString','a.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.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','catch','show','params','keys','includeAll','include','merge','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','findAll','rows','addTags','setTags','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Private','Messages','basename','existsSync','createReadStream','pipe','System','out','secret','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','Users','map','fullname','TagIds','split','forEach','Tags','push','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_openchannel_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.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x1e0566,_0x376824){var _0x16b3a6=function(_0x57b815){while(--_0x57b815){_0x1e0566['push'](_0x1e0566['shift']());}};_0x16b3a6(++_0x376824);}(_0x1636,0x186));var _0x6163=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1636[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x6163('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6163('0x1'));var rp=require(_0x6163('0x2'));var moment=require(_0x6163('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6163('0x4'));var path=require(_0x6163('0x5'));var sox=require(_0x6163('0x6'));var csv=require(_0x6163('0x7'));var ejs=require(_0x6163('0x8'));var fs=require('fs');var fs_extra=require(_0x6163('0x9'));var _=require(_0x6163('0xa'));var squel=require(_0x6163('0xb'));var crypto=require(_0x6163('0xc'));var jsforce=require(_0x6163('0xd'));var deskjs=require(_0x6163('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6163('0xf'));var Papa=require(_0x6163('0x10'));var Redis=require(_0x6163('0x11'));var authService=require(_0x6163('0x12'));var qs=require(_0x6163('0x13'));var as=require(_0x6163('0x14'));var pdf=require(_0x6163('0x15'));var hardwareService=require(_0x6163('0x16'));var logger=require(_0x6163('0x17'))(_0x6163('0x18'));var utils=require('../../config/utils');var config=require(_0x6163('0x19'));var licenseUtil=require(_0x6163('0x1a'));var db=require(_0x6163('0x1b'))['db'];config[_0x6163('0x1c')]=_[_0x6163('0x1d')](config[_0x6163('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6163('0x1e'))(new Redis(config[_0x6163('0x1c')]));require('./openchannelInteraction.socket')[_0x6163('0x1f')](socket);function respondWithStatusCode(_0x19990c,_0x28bdd1){_0x28bdd1=_0x28bdd1||0xcc;return function(_0x44097c){if(_0x44097c){return _0x19990c[_0x6163('0x20')](_0x28bdd1);}return _0x19990c[_0x6163('0x21')](_0x28bdd1)[_0x6163('0x22')]();};}function respondWithResult(_0x17131e,_0x5d6354){_0x5d6354=_0x5d6354||0xc8;return function(_0x29f5b6){if(_0x29f5b6){return _0x17131e[_0x6163('0x21')](_0x5d6354)[_0x6163('0x23')](_0x29f5b6);}};}function respondWithFilteredResult(_0x325cba,_0x560851){return function(_0x42cfb0){if(_0x42cfb0){var _0x14b9ae=typeof _0x560851[_0x6163('0x24')]===_0x6163('0x25')&&typeof _0x560851[_0x6163('0x26')]===_0x6163('0x25');var _0x86d983=_0x42cfb0[_0x6163('0x27')];var _0x34b470=_0x14b9ae?0x0:_0x560851[_0x6163('0x24')];var _0x35e3f3=_0x14b9ae?_0x42cfb0[_0x6163('0x27')]:_0x560851[_0x6163('0x24')]+_0x560851[_0x6163('0x26')];var _0x39298c;if(_0x35e3f3>=_0x86d983){_0x35e3f3=_0x86d983;_0x39298c=0xc8;}else{_0x39298c=0xce;}_0x325cba[_0x6163('0x21')](_0x39298c);return _0x325cba[_0x6163('0x28')](_0x6163('0x29'),_0x34b470+'-'+_0x35e3f3+'/'+_0x86d983)[_0x6163('0x23')](_0x42cfb0);}return null;};}function patchUpdates(_0x3b8121){return function(_0x31326b){try{jsonpatch[_0x6163('0x2a')](_0x31326b,_0x3b8121,!![]);}catch(_0x125fc9){return BPromise[_0x6163('0x2b')](_0x125fc9);}return _0x31326b[_0x6163('0x2c')]();};}function saveUpdates(_0x48cda9,_0x500fd0){return function(_0x1c7c0b){if(_0x1c7c0b){return _0x1c7c0b['update'](_0x48cda9)[_0x6163('0x2d')](function(_0x227d67){return _0x227d67;});}return null;};}function removeEntity(_0x3d425b,_0xa552b2){return function(_0x5aa78f){if(_0x5aa78f){return _0x5aa78f[_0x6163('0x2e')]()[_0x6163('0x2d')](function(){_0x3d425b[_0x6163('0x21')](0xcc)[_0x6163('0x22')]();});}};}function handleEntityNotFound(_0x5dce29,_0x2d2677){return function(_0x27088e){if(!_0x27088e){_0x5dce29[_0x6163('0x20')](0x194);}return _0x27088e;};}function handleError(_0xf5a7e6,_0x29f5be){_0x29f5be=_0x29f5be||0x1f4;return function(_0x8c4445){logger[_0x6163('0x2f')](_0x8c4445[_0x6163('0x30')]);if(_0x8c4445['name']){delete _0x8c4445['name'];}_0xf5a7e6[_0x6163('0x21')](_0x29f5be)[_0x6163('0x31')](_0x8c4445);};}function getInteractionUsers(_0x5d7765,_0x4eac8c){return new BPromise(function(_0x2055d0,_0x3896e8){try{if(_0x4eac8c[_0x5d7765['id']]){_0x5d7765[_0x6163('0x32')]=_[_0x6163('0x33')](_0x4eac8c[_0x5d7765['id']],function(_0x172b98){return{'id':_0x172b98['id'],'fullname':_0x172b98[_0x6163('0x34')]};});}}catch(_0x36a117){_0x3896e8(_0x36a117);}_0x2055d0(_0x5d7765);});}function getInteractionTags(_0x5af67c,_0x5d781a){return new BPromise(function(_0x1bbb9a,_0x5cca2c){try{if(_0x5af67c[_0x6163('0x35')]){_0x5af67c['Tags']=[];_0x5af67c['TagIds'][_0x6163('0x36')](',')[_0x6163('0x37')](function(_0x2043b4){_0x5af67c[_0x6163('0x38')][_0x6163('0x39')](_0x5d781a[_0x2043b4]);});}delete _0x5af67c[_0x6163('0x35')];}catch(_0x4d5609){_0x5cca2c(_0x4d5609);}_0x1bbb9a(_0x5af67c);});}function updateOpenchannelInteraction(_0xa1d397,_0x3a4301,_0x3e62e4){return new BPromise(function(_0x488a7e,_0x46bc83){return getInteractionUsers(_0xa1d397,_0x3e62e4)['then'](function(_0x447c41){return getInteractionTags(_0x447c41,_0x3a4301);})[_0x6163('0x2d')](function(_0x2de9b4){return getStateInteraction(_0x2de9b4);})['then'](function(_0x193df5){_0x488a7e(_0x193df5);})['catch'](function(_0x41e720){_0x46bc83(_0x41e720);});});}function getStateInteraction(_0x2eacb0){return new BPromise(function(_0x3ceb53){_0x2eacb0[_0x6163('0x3a')]=0x0;_0x2eacb0[_0x6163('0x3b')]=0x0;_0x2eacb0[_0x6163('0x3c')]=0x0;_0x2eacb0[_0x6163('0x3d')]=0x0;_0x2eacb0[_0x6163('0x3e')]=0x0;if(!_0x2eacb0[_0x6163('0x3f')]&&!_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3a')]+=0x1;}if(!_0x2eacb0[_0x6163('0x3f')]&&_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3b')]+=0x1;if(_0x2eacb0[_0x6163('0x3a')]){_0x2eacb0['waiting']-=0x1;}}if(_0x2eacb0[_0x6163('0x3f')]&&_0x2eacb0['UserId']){_0x2eacb0[_0x6163('0x3c')]+=0x1;if(_0x2eacb0[_0x6163('0x3b')]){_0x2eacb0[_0x6163('0x3b')]-=0x1;}}if(_0x2eacb0[_0x6163('0x3f')]&&!_0x2eacb0[_0x6163('0x40')]){_0x2eacb0[_0x6163('0x3d')]+=0x1;if(_0x2eacb0[_0x6163('0x3a')]){_0x2eacb0[_0x6163('0x3a')]-=0x1;}}_0x2eacb0[_0x6163('0x3e')]+=0x1;_0x3ceb53(_0x2eacb0);});}exports[_0x6163('0x41')]=function(_0x35bf22,_0x460744){var _0xea7b21={},_0x293928={},_0x144d2b={'count':0x0,'rows':[]};var _0x544409=_[_0x6163('0x33')](db[_0x6163('0x42')][_0x6163('0x43')],function(_0x429d0e){return{'name':_0x429d0e['fieldName'],'type':_0x429d0e[_0x6163('0x44')][_0x6163('0x45')]};});_0x293928[_0x6163('0x46')]=_['map'](_0x544409,_0x6163('0x47'));_0x293928[_0x6163('0x48')]=_['keys'](_0x35bf22['query']);_0x293928['filters']=_[_0x6163('0x49')](_0x293928['model'],_0x293928[_0x6163('0x48')]);_0xea7b21[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x293928[_0x6163('0x46')],qs[_0x6163('0x4b')](_0x35bf22['query'][_0x6163('0x4b')]));_0xea7b21['attributes']=_0xea7b21[_0x6163('0x4a')][_0x6163('0x4c')]?_0xea7b21[_0x6163('0x4a')]:_0x293928[_0x6163('0x46')];if(!_0x35bf22[_0x6163('0x48')][_0x6163('0x4d')]('nolimit')){_0xea7b21[_0x6163('0x26')]=qs[_0x6163('0x26')](_0x35bf22['query'][_0x6163('0x26')]);_0xea7b21['offset']=qs[_0x6163('0x24')](_0x35bf22[_0x6163('0x48')][_0x6163('0x24')]);}_0xea7b21['order']=qs['sort'](_0x35bf22[_0x6163('0x48')][_0x6163('0x4e')]);_0xea7b21['where']=qs[_0x6163('0x4f')](_[_0x6163('0x50')](_0x35bf22[_0x6163('0x48')],_0x293928[_0x6163('0x4f')]),_0x544409);var _0x5224f2=[];var _0x2063a5=squel[_0x6163('0x51')]()[_0x6163('0x52')]('id')[_0x6163('0x52')](_0x6163('0x47'))[_0x6163('0x52')]('color')[_0x6163('0x53')](_0x6163('0x54'));var _0xddeaf=squel[_0x6163('0x51')]()[_0x6163('0x52')](_0x6163('0x55'))[_0x6163('0x52')](_0x6163('0x56'))[_0x6163('0x52')]('ui.OpenchannelInteractionId')[_0x6163('0x53')](_0x6163('0x57'),'ui')[_0x6163('0x58')](_0x6163('0x59'),'u',_0x6163('0x5a'));var _0x2d9d6b=squel['select']()[_0x6163('0x53')]('openchannel_interactions','i')[_0x6163('0x58')](_0x6163('0x5b'),'c',_0x6163('0x5c'))[_0x6163('0x58')](_0x6163('0x59'),'o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x6163('0x5d'))[_0x6163('0x58')](_0x6163('0x5e'),'me',_0x6163('0x5f'))[_0x6163('0x58')](_0x6163('0x60'),'it',_0x6163('0x61'))['left_join'](_0x6163('0x54'),'t','t.id\x20=\x20it.TagId');var _0x4c32d8=squel[_0x6163('0x62')]();var _0x995bbd=[];var _0x371d18=squel['expr']();var _0x6a880c;if(_0x35bf22[_0x6163('0x48')][_0x6163('0x63')]){_0x6a880c=as[_0x6163('0x64')](_0x35bf22[_0x6163('0x48')][_0x6163('0x63')]);var _0x1f7352=_0x6a880c[_0x6163('0x65')];for(var _0xe5022c=0x0;_0xe5022c<_0x6a880c[_0x6163('0x66')]['length'];_0xe5022c++){var _0x3cdbf7=_0x6a880c[_0x6163('0x66')][_0xe5022c];var _0x5d64e3='i';var _0x4cdbac=_[_0x6163('0x67')](_0x544409,[_0x6163('0x47'),_0x3cdbf7[_0x6163('0x52')]]);if(!_0x4cdbac){switch(_0x3cdbf7[_0x6163('0x52')]){case'unreadMessages':if(_0x3cdbf7[_0x6163('0x68')]==0x1){_0x2d9d6b[_0x6163('0x69')]('`'+_0x3cdbf7[_0x6163('0x52')]+'`\x20=\x200');}else{_0x2d9d6b[_0x6163('0x69')]('`'+_0x3cdbf7[_0x6163('0x52')]+_0x6163('0x6a'));}break;case _0x6163('0x6b'):if(_0x3cdbf7[_0x6163('0x6c')]===_0x6163('0x6d')){if(_0x3cdbf7[_0x6163('0x68')]['split']('\x20')['length']>0x1){_0x4c32d8[_0x1f7352](_0x6163('0x6e'),qs['getFullTextValue'](_0x3cdbf7['value']),null);}else{var _0x3a29dc='%'+_0x3cdbf7[_0x6163('0x68')]+'%';_0x4c32d8[_0x1f7352](_0x6163('0x6f'),_0x3a29dc,_0x3a29dc,_0x3a29dc);}}else{_0x4cdbac=_['find'](_0x544409,[_0x6163('0x47'),_0x6163('0x70')]);_0x3cdbf7[_0x6163('0x52')]=_0x6163('0x70');_0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168['value'][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')][_0x6163('0x22')]);}break;case _0x6163('0x74'):var _0x2f2467=_0x3cdbf7[_0x6163('0x68')][_0x6163('0x36')](',')[_0x6163('0x33')](function(_0x57243d){return Number(_0x57243d);});_0x2f2467[_0x6163('0x37')](function(_0x299ece){_0x371d18['or'](_0x6163('0x75'),'%,'+_0x299ece+',%');});_0x995bbd=_['union'](_0x995bbd,_0x2f2467);break;case _0x6163('0x76'):if(_0x3cdbf7[_0x6163('0x6c')]===_0x6163('0x6d')){_0x4c32d8[_0x1f7352](_0x6163('0x77'),'%'+_0x3cdbf7[_0x6163('0x68')]+'%',null);}else{_0x4cdbac=_[_0x6163('0x67')](_0x544409,[_0x6163('0x47'),'UserId']);_0x3cdbf7[_0x6163('0x52')]=_0x6163('0x40');_0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168[_0x6163('0x68')][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')][_0x6163('0x22')]);}break;case'body':_0x1b3168=as[_0x6163('0x71')]('me',null,_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168['value'][_0x6163('0x73')],_0x1b3168[_0x6163('0x68')]['end']);break;}}else{var _0x1b3168=as[_0x6163('0x71')](_0x5d64e3,_0x4cdbac[_0x6163('0x44')],_0x3cdbf7);_0x4c32d8[_0x1f7352](_0x1b3168[_0x6163('0x72')],_0x1b3168[_0x6163('0x68')][_0x6163('0x73')],_0x1b3168['value'][_0x6163('0x22')]);}}}else{var _0x4e8874=_(_0x35bf22[_0x6163('0x48')])['keys']()[_0x6163('0x33')](function(_0x138693){return _[_0x6163('0x78')](_0x544409,[_0x6163('0x47'),_0x138693])?_0x138693:undefined;})[_0x6163('0x79')]()['value']();if(!_[_0x6163('0x7a')](_0x4e8874)){_0x4e8874[_0x6163('0x37')](function(_0x29e10d){if(_0x29e10d==='OpenchannelAccountId'){_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x7c'),[]['concat'](_0x35bf22[_0x6163('0x48')][_0x29e10d]));}else if(_0x29e10d===_0x6163('0x7d')){var _0x34e737=JSON[_0x6163('0x7e')](_0x35bf22[_0x6163('0x48')][_0x29e10d])[_0x6163('0x7f')];var _0x5c0289=JSON[_0x6163('0x7e')](_0x35bf22[_0x6163('0x48')][_0x29e10d])[_0x6163('0x80')];_0x2d9d6b['where'](_0x6163('0x81'),_0x34e737,_0x5c0289);}else{if(_0x35bf22[_0x6163('0x48')][_0x29e10d]===_0x6163('0x82')){_0x2d9d6b['where']('i.'+_0x29e10d+_0x6163('0x83'));}else{_0x2d9d6b[_0x6163('0x7b')]('i.'+_0x29e10d+_0x6163('0x84'),_0x35bf22[_0x6163('0x48')][_0x29e10d]);}}});}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x85')]){if(_0x35bf22[_0x6163('0x48')][_0x6163('0x85')]==0x1){_0x2d9d6b[_0x6163('0x69')](_0x6163('0x86'));}else{_0x2d9d6b[_0x6163('0x69')](_0x6163('0x87'));}}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x88')]){_0x995bbd=_[_0x6163('0x89')](_0x35bf22[_0x6163('0x48')][_0x6163('0x88')])?_0x35bf22[_0x6163('0x48')][_0x6163('0x88')]:new Array(_0x35bf22['query'][_0x6163('0x88')]);_0x995bbd[_0x6163('0x37')](function(_0x41387b){_0x371d18['or'](_0x6163('0x75'),'%,'+_0x41387b+',%');});}if(_0x35bf22[_0x6163('0x48')][_0x6163('0x8a')]){var _0x44e675=_0x35bf22[_0x6163('0x48')][_0x6163('0x8a')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6163('0x8b')](_0x44e675)){_0x4c32d8['or'](_0x6163('0x8c'),_0x44e675+'%');}else{_0x4c32d8['or'](_0x6163('0x8d'),qs['getFullTextValue'](_0x44e675))['or'](_0x6163('0x8e'),_0x44e675+'%')['or'](_0x6163('0x8f'),_0x44e675+'%');}}}_0x2d9d6b[_0x6163('0x7b')](_0x4c32d8);_0x2d9d6b['group'](_0x6163('0x90'));var _0x1866d1={'type':db[_0x6163('0x91')][_0x6163('0x92')][_0x6163('0x93')],'raw':!![]};var _0x4292b8=_0x2d9d6b[_0x6163('0x94')]();_0x4292b8['field'](_0x6163('0x90'));_0x4292b8['field'](_0x6163('0x95'),'unreadMessages');if(_0xea7b21[_0x6163('0x96')]){_0xea7b21['order'][_0x6163('0x37')](function(_0x2c045a){var _0x3f26bd=_0x2c045a[0x0]===_0x6163('0x97')?_0x2c045a[0x0]:'i.'+_0x2c045a[0x0];_0x2d9d6b[_0x6163('0x96')](_0x3f26bd,_0x2c045a[0x1]===_0x6163('0x98')?![]:!![]);});}if(!_['isEmpty'](_0x995bbd)){_0x2d9d6b['having'](_0x371d18);_0x4292b8[_0x6163('0x7b')](_0x6163('0x99'),_0x995bbd);}BPromise[_0x6163('0x9a')]()[_0x6163('0x2d')](function(){if(!_0x6a880c){if(_0x35bf22[_0x6163('0x48')][_0x6163('0x9b')])return;_0x4292b8[_0x6163('0x7b')](_0x6163('0x9c'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x9c'));return;}if(_0x35bf22['user']['role']!==_0x6163('0x9d'))return;return _0x35bf22['user'][_0x6163('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x49451c){if(_[_0x6163('0x7a')](_0x49451c)){_0x4292b8[_0x6163('0x7b')](_0x6163('0x9f'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x9f'));}else{_0x4292b8[_0x6163('0x7b')](_0x6163('0x7c'),_['map'](_0x49451c,'id'));_0x2d9d6b[_0x6163('0x7b')](_0x6163('0x7c'),_[_0x6163('0x33')](_0x49451c,'id'));}});})[_0x6163('0x2d')](function(){if(_0x35bf22[_0x6163('0xa0')]['role']===_0x6163('0x9d')&&!_0x6a880c&&!_0x35bf22[_0x6163('0x48')]['OpenchannelAccountId'])return[];return db[_0x6163('0xa1')][_0x6163('0x48')](_0x4292b8[_0x6163('0xa2')](),_0x1866d1);})[_0x6163('0x2d')](function(_0x4e81ae){_0x144d2b['count']=_0x4e81ae[_0x6163('0x4c')];if(_0x144d2b[_0x6163('0x27')]===0x0)return[];return db[_0x6163('0xa1')][_0x6163('0x48')](_0x2063a5['toString'](),_0x1866d1)[_0x6163('0x2d')](function(_0x6892d8){_0x5224f2=_['keyBy'](_0x6892d8,'id');_0x1866d1=_['merge'](_0x1866d1,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35bf22[_0x6163('0x48')][_0x6163('0x4b')]){_0xea7b21[_0x6163('0x4a')][_0x6163('0x37')](function(_0x36ce3c){_0x2d9d6b[_0x6163('0x52')]('i.'+_0x36ce3c);});}else{_0x2d9d6b[_0x6163('0x52')](_0x6163('0x95'),'unreadMessages');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa3'),'Account.key');_0x2d9d6b['field'](_0x6163('0xa4'),_0x6163('0xa5'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa6'),_0x6163('0x97'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa7'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa8'),'Contact.firstName');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xa9'),'Contact.lastName');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xaa'),_0x6163('0xab'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xac'),'Contact.phone');_0x2d9d6b[_0x6163('0x52')]('c.mobile',_0x6163('0xad'));_0x2d9d6b['field'](_0x6163('0xae'),_0x6163('0xaf'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb0'),_0x6163('0xb1'));_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb2'),'Owner.internal');_0x2d9d6b[_0x6163('0x52')](_0x6163('0xb3'),_0x6163('0x35'));}if(_0xea7b21[_0x6163('0x26')])_0x2d9d6b['limit'](_0xea7b21['limit']);if(_0xea7b21['offset'])_0x2d9d6b[_0x6163('0x24')](_0xea7b21['offset']);return db[_0x6163('0xa1')][_0x6163('0x48')](_0x2d9d6b['toString'](),_0x1866d1);})['then'](function(_0x104cc1){if(_0x104cc1[_0x6163('0x4c')]>0x0)_0xddeaf[_0x6163('0x7b')](_0x6163('0xb4'),_['map'](_0x104cc1,'id'));return db[_0x6163('0xa1')][_0x6163('0x48')](_0xddeaf[_0x6163('0xa2')](),_0x1866d1)[_0x6163('0x2d')](function(_0x2e195c){var _0x2d36bc=_[_0x6163('0xb5')](_0x2e195c,_0x6163('0xb6'));var _0x2f1d96=[];_0x104cc1[_0x6163('0x37')](function(_0x3139f1){_0x2f1d96['push'](updateOpenchannelInteraction(_0x3139f1,_0x5224f2,_0x2d36bc));});return BPromise[_0x6163('0xb7')](_0x2f1d96);});});})[_0x6163('0x2d')](function(_0x47e866){_0x144d2b['rows']=_0x47e866;return _0x144d2b;})[_0x6163('0x2d')](respondWithFilteredResult(_0x460744,_0xea7b21))[_0x6163('0xb8')](handleError(_0x460744,null));};exports[_0x6163('0xb9')]=function(_0x335879,_0x1009f3){var _0x30c05a={};if(_0x335879[_0x6163('0x48')][_0x6163('0x44')]&&_0x335879['query'][_0x6163('0x44')]===_0x6163('0x53')){_0x30c05a[_0x6163('0x53')]=_0x335879[_0x6163('0xba')]['id'];}else{_0x30c05a['id']=_0x335879['params']['id'];}var _0x5e2008={'raw':![],'where':_0x30c05a},_0x37dd9a={};_0x37dd9a['model']=_[_0x6163('0xbb')](db[_0x6163('0x42')][_0x6163('0x43')]);_0x37dd9a[_0x6163('0x48')]=_[_0x6163('0xbb')](_0x335879[_0x6163('0x48')]);_0x37dd9a[_0x6163('0x4f')]=_['intersection'](_0x37dd9a[_0x6163('0x46')],_0x37dd9a['query']);_0x5e2008[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x37dd9a[_0x6163('0x46')],qs['fields'](_0x335879[_0x6163('0x48')][_0x6163('0x4b')]));_0x5e2008[_0x6163('0x4a')]=_0x5e2008[_0x6163('0x4a')][_0x6163('0x4c')]?_0x5e2008[_0x6163('0x4a')]:_0x37dd9a[_0x6163('0x46')];if(_0x335879['query'][_0x6163('0xbc')]){_0x5e2008[_0x6163('0xbd')]=[{'all':!![]}];}_0x5e2008=_[_0x6163('0xbe')]({},_0x5e2008,_0x335879[_0x6163('0xbf')]);return db[_0x6163('0x42')][_0x6163('0x67')](_0x5e2008)[_0x6163('0x2d')](handleEntityNotFound(_0x1009f3,null))[_0x6163('0x2d')](respondWithResult(_0x1009f3,null))[_0x6163('0xb8')](handleError(_0x1009f3,null));};exports[_0x6163('0xc0')]=function(_0x407d2c,_0x5ef281){return db[_0x6163('0x42')][_0x6163('0xc0')](_0x407d2c[_0x6163('0xc1')],{})['then'](respondWithResult(_0x5ef281,0xc9))[_0x6163('0xb8')](handleError(_0x5ef281,null));};exports[_0x6163('0xc2')]=function(_0x3a76a8,_0x52adfd){if(_0x3a76a8['body']['id']){delete _0x3a76a8[_0x6163('0xc1')]['id'];}return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x3a76a8[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x52adfd,null))['then'](saveUpdates(_0x3a76a8[_0x6163('0xc1')],null))[_0x6163('0x2d')](respondWithResult(_0x52adfd,null))[_0x6163('0xb8')](handleError(_0x52adfd,null));};exports[_0x6163('0x2e')]=function(_0xd6c3b7,_0x667d){return db['OpenchannelInteraction']['find']({'where':{'id':_0xd6c3b7['params']['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x667d,null))['then'](removeEntity(_0x667d,null))['catch'](handleError(_0x667d,null));};exports['describe']=function(_0x11fd33,_0xee4223){return db['OpenchannelInteraction'][_0x6163('0xc3')]()[_0x6163('0x2d')](respondWithResult(_0xee4223,null))[_0x6163('0xb8')](handleError(_0xee4223,null));};exports[_0x6163('0xc4')]=function(_0x3aceb9,_0x246998,_0x3e48df){return db[_0x6163('0xc5')][_0x6163('0x67')]({'where':{'id':_0x3aceb9[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x246998,null))[_0x6163('0x2d')](function(_0x128ba4){if(_0x128ba4){return _0x128ba4[_0x6163('0xc4')](_0x3aceb9[_0x6163('0xc1')][_0x6163('0xc6')],_[_0x6163('0xc7')](_0x3aceb9[_0x6163('0xc1')],['ids','id'])||{});}})[_0x6163('0x2d')](respondWithResult(_0x246998,null))[_0x6163('0xb8')](handleError(_0x246998,null));};exports[_0x6163('0xc8')]=function(_0x43d124,_0x31a002,_0x40aca1){var _0x690f6e={'raw':![],'where':{}};var _0x31e789={};var _0x1946b1={'count':0x0,'rows':[]};return db[_0x6163('0x42')][_0x6163('0xc9')]({'where':{'id':_0x43d124['params']['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x31a002,null))[_0x6163('0x2d')](function(_0x11eabb){if(_0x11eabb){_0x31e789[_0x6163('0x46')]=_[_0x6163('0xbb')](db[_0x6163('0xc5')][_0x6163('0x43')]);_0x31e789[_0x6163('0x48')]=_['keys'](_0x43d124[_0x6163('0x48')]);_0x31e789['filters']=_[_0x6163('0x49')](_0x31e789[_0x6163('0x46')],_0x31e789[_0x6163('0x48')]);_0x690f6e[_0x6163('0x4a')]=_[_0x6163('0x49')](_0x31e789[_0x6163('0x46')],qs[_0x6163('0x4b')](_0x43d124[_0x6163('0x48')][_0x6163('0x4b')]));_0x690f6e['attributes']=_0x690f6e[_0x6163('0x4a')][_0x6163('0x4c')]?_0x690f6e[_0x6163('0x4a')]:_0x31e789[_0x6163('0x46')];if(!_0x43d124[_0x6163('0x48')][_0x6163('0x4d')](_0x6163('0xca'))){_0x690f6e[_0x6163('0x26')]=qs[_0x6163('0x26')](_0x43d124[_0x6163('0x48')][_0x6163('0x26')]);_0x690f6e[_0x6163('0x24')]=qs[_0x6163('0x24')](_0x43d124['query']['offset']);}_0x690f6e[_0x6163('0x96')]=qs[_0x6163('0x4e')](_0x43d124[_0x6163('0x48')][_0x6163('0x4e')]);_0x690f6e['where']=qs['filters'](_[_0x6163('0x50')](_0x43d124[_0x6163('0x48')],_0x31e789[_0x6163('0x4f')]));_0x690f6e['where']['OpenchannelInteractionId']=_0x11eabb['id'];if(_0x43d124[_0x6163('0x48')][_0x6163('0x8a')]){_0x690f6e[_0x6163('0x7b')]=_[_0x6163('0xbe')](_0x690f6e[_0x6163('0x7b')],{'$or':_[_0x6163('0x33')](_0x690f6e[_0x6163('0x4a')],function(_0x653592){var _0x50eefe={};_0x50eefe[_0x653592]={'$like':'%'+_0x43d124['query'][_0x6163('0x8a')]+'%'};return _0x50eefe;})});}if(_0x43d124[_0x6163('0x48')][_0x6163('0x7f')]){var _0x55868c=_0x43d124[_0x6163('0x48')][_0x6163('0x7f')]['split'](',');var _0x85f4ae={};_0x85f4ae[_0x55868c[0x0]]={'$gte':moment(_0x55868c[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x690f6e[_0x6163('0x7b')]=_[_0x6163('0xbe')](_0x690f6e[_0x6163('0x7b')],_0x85f4ae);}_0x690f6e=_[_0x6163('0xbe')]({},_0x690f6e,_0x43d124[_0x6163('0xbf')]);return db[_0x6163('0xc5')][_0x6163('0x27')]({'where':_0x690f6e['where']})[_0x6163('0x2d')](function(_0x406012){_0x1946b1[_0x6163('0x27')]=_0x406012;if(_0x43d124[_0x6163('0x48')][_0x6163('0xbc')]){_0x690f6e['include']=[{'all':!![]}];}return db[_0x6163('0xc5')][_0x6163('0xcb')](_0x690f6e);})[_0x6163('0x2d')](function(_0x10c9c9){_0x1946b1[_0x6163('0xcc')]=_0x10c9c9;return _0x1946b1;});}})['then'](respondWithFilteredResult(_0x31a002,_0x690f6e))['catch'](handleError(_0x31a002,null));};exports[_0x6163('0xcd')]=function(_0x1536b7,_0x41fffa,_0x386aa0){return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x1536b7[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x41fffa,null))[_0x6163('0x2d')](function(_0x1902c4){if(_0x1902c4){return _0x1902c4[_0x6163('0xce')](_0x1536b7['body'][_0x6163('0xc6')],_['omit'](_0x1536b7[_0x6163('0xc1')],[_0x6163('0xc6'),'id'])||{})['spread'](function(){return db[_0x6163('0x74')]['findAll']({'attributes':['id',_0x6163('0x47'),_0x6163('0xcf')],'where':{'id':_0x1536b7['body'][_0x6163('0xc6')]}});})[_0x6163('0x2d')](function(_0x4af184){socket[_0x6163('0xd0')](_0x6163('0xd1'),{'id':Number(_0x1536b7[_0x6163('0xba')]['id']),'tags':_0x4af184||[]});return{'id':Number(_0x1536b7[_0x6163('0xba')]['id']),'tags':_0x4af184||[]};});}})[_0x6163('0x2d')](respondWithResult(_0x41fffa,null))[_0x6163('0xb8')](handleError(_0x41fffa,null));};exports[_0x6163('0xd2')]=function(_0xd2e9fd,_0x224416,_0x50ec25){return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0xd2e9fd[_0x6163('0xba')]['id']}})[_0x6163('0x2d')](handleEntityNotFound(_0x224416,null))['then'](function(_0x526839){if(_0x526839){return _0x526839['removeTags'](_0xd2e9fd[_0x6163('0x48')]['ids']);}})[_0x6163('0x2d')](respondWithStatusCode(_0x224416,null))[_0x6163('0xb8')](handleError(_0x224416,null));};exports[_0x6163('0xd3')]=function(_0x188d5c,_0x45511f){var _0x2ac3d4=moment()[_0x6163('0xd4')]()[_0x6163('0xa2')]();var _0x5044a1=path[_0x6163('0xd5')](config[_0x6163('0xd6')],'server','files','tmp');var _0x1d7e93=path[_0x6163('0xd5')](config[_0x6163('0xd6')],_0x6163('0xd7'),_0x6163('0xd8'),_0x6163('0xd9'));var _0x3f4547=path[_0x6163('0xd5')](_0x5044a1,_0x2ac3d4);var _0x5dcb0f=util['format'](_0x6163('0xda'),_0x188d5c[_0x6163('0xba')]['id'],_0x2ac3d4);var _0x2d190e=path[_0x6163('0xd5')](_0x5044a1,_0x5dcb0f);var _0x218ed9=[];_0x218ed9['push']({'model':db[_0x6163('0x76')],'as':'User','attributes':['id',_0x6163('0x34')],'raw':!![]});_0x218ed9[_0x6163('0x39')]({'model':db['CmContact'],'as':_0x6163('0x6b'),'attributes':['id',_0x6163('0xdb'),_0x6163('0xdc')],'raw':!![]});if(_0x188d5c[_0x6163('0x48')][_0x6163('0xd9')]){_0x218ed9[_0x6163('0x39')]({'model':db[_0x6163('0xdd')],'as':'Attachment','raw':!![]});}var _0x39cdfe=[{'model':db[_0x6163('0xc5')],'as':'Messages','attributes':['id','body','createdAt',_0x6163('0xde'),'secret',_0x6163('0x85')],'include':_0x218ed9}];_0x39cdfe[_0x6163('0x39')]({'model':db[_0x6163('0xdf')],'as':_0x6163('0xe0'),'attributes':['id',_0x6163('0x47')]});_0x39cdfe['push']({'model':db['User'],'as':_0x6163('0xe1'),'attributes':['id',_0x6163('0x34')]});return db[_0x6163('0x42')][_0x6163('0x67')]({'where':{'id':_0x188d5c[_0x6163('0xba')]['id']},'include':_0x39cdfe})['then'](handleEntityNotFound(_0x45511f,null))['then'](function(_0x57a69c){if(_0x57a69c){var _0x5dde94=_0x57a69c[_0x6163('0xe2')]({'plain':!![]});fs[_0x6163('0xe3')](_0x3f4547);var _0x4c5f59={'channel':'Openchannel','account':_0x5dde94['Account']['name'],'agent':_0x5dde94[_0x6163('0xe1')]?_0x5dde94['Owner']['fullname']:_0x6163('0xe4'),'createdAt':moment(_0x5dde94[_0x6163('0x7d')])[_0x6163('0xe5')](_0x6163('0xe6'))[_0x6163('0xa2')](),'closedAt':_0x5dde94[_0x6163('0x3f')]?moment(_0x5dde94[_0x6163('0xe7')])[_0x6163('0xe5')](_0x6163('0xe6'))[_0x6163('0xa2')]():'','disposition':_0x5dde94[_0x6163('0xe8')],'visibility':_0x5dde94[_0x6163('0xe9')]?'Public':_0x6163('0xea'),'messages':_(_0x5dde94[_0x6163('0xeb')])[_0x6163('0x8a')]({'secret':![]})[_0x6163('0x33')](function(_0x4e1c0f){if(_0x4e1c0f[_0x6163('0xdd')]){var _0x514cd2=path[_0x6163('0xd5')](_0x1d7e93,_0x4e1c0f[_0x6163('0xdd')][_0x6163('0xec')]);if(fs[_0x6163('0xed')](_0x514cd2)){fs[_0x6163('0xee')](_0x514cd2)[_0x6163('0xef')](fs['createWriteStream'](path[_0x6163('0xd5')](_0x3f4547,_0x4e1c0f[_0x6163('0xdd')][_0x6163('0xec')])));}}return{'date':moment(_0x4e1c0f[_0x6163('0x7d')])['format'](_0x6163('0xe6'))[_0x6163('0xa2')](),'sender':_0x4e1c0f[_0x6163('0xde')]==='out'?_0x4e1c0f['User']?_0x4e1c0f[_0x6163('0x76')][_0x6163('0x34')]:_0x6163('0xf0'):_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdb')]+(_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdc')]?'\x20'+_0x4e1c0f[_0x6163('0x6b')][_0x6163('0xdc')]:''),'body':_0x4e1c0f[_0x6163('0xdd')]?_0x4e1c0f['Attachment'][_0x6163('0xec')]:_0x4e1c0f[_0x6163('0xc1')],'direction':_0x4e1c0f[_0x6163('0xde')]===_0x6163('0xf1')?'A':'C','secret':_0x4e1c0f[_0x6163('0xf2')],'read':_0x4e1c0f['read'],'attachment':_0x4e1c0f['Attachment']};})[_0x6163('0x68')]()};return ejs['renderFile'](path[_0x6163('0xd5')](config[_0x6163('0xd6')],'server',_0x6163('0xf3'),_0x6163('0xf4')),{'interaction':_0x4c5f59})[_0x6163('0x2d')](function(_0x31bb03){var _0x49ed3d=path['join'](_0x3f4547,_0x6163('0xf5')+_0x5dde94['id']+'-'+_0x2ac3d4+_0x6163('0xf6'));var _0x4e80d8={'path':_0x49ed3d,'channel':_0x6163('0xf7'),'interactionId':_0x5dde94['id']};return pdf['createPdfFromHTML'](_0x31bb03,_0x4e80d8);})[_0x6163('0x2d')](function(){return new BPromise(function(_0x1080f9,_0x477b60){zipdir(_0x3f4547,{'saveTo':_0x2d190e},function(_0x2dc716,_0x53d66c){if(_0x2dc716)return _0x477b60(_0x2dc716);return _0x1080f9(_0x53d66c);});})[_0x6163('0x2d')](function(){return new BPromise(function(_0x35e555,_0x459234){rimraf(_0x3f4547,function(_0x1f6b5d){if(_0x1f6b5d)_0x459234(_0x1f6b5d);return _0x35e555();});});})[_0x6163('0x2d')](function(){return _0x45511f['download'](_0x2d190e,_0x5dcb0f,function(_0x2b134a){if(_0x2b134a){console[_0x6163('0xf8')](_0x6163('0xf9'),_0x2b134a);}else{fs[_0x6163('0xfa')](_0x2d190e);}});});});}else{return _0x45511f[_0x6163('0x20')](0xc8);}})[_0x6163('0xb8')](handleError(_0x45511f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 4c80543..12353f6 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 _0xc841=['hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','Users','findAll','unreadMessages','length','emit'];(function(_0x85087d,_0x5d221f){var _0x38474a=function(_0x4cf251){while(--_0x4cf251){_0x85087d['push'](_0x85087d['shift']());}};_0x38474a(++_0x5d221f);}(_0xc841,0x179));var _0x1c84=function(_0x54c719,_0x560130){_0x54c719=_0x54c719-0x0;var _0x51b674=_0xc841[_0x54c719];return _0x51b674;};'use strict';var EventEmitter=require(_0x1c84('0x0'));var OpenchannelInteraction=require(_0x1c84('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x1c84('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1c84('0x3')](0x0);var events={'afterCreate':_0x1c84('0x4'),'afterUpdate':_0x1c84('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d3f9){return function(_0x1a3f2d,_0x4e1200,_0x32240b){_0x1a3f2d[_0x1c84('0x6')]({'attributes':['id'],'raw':!![]})[_0x1c84('0x7')](function(_0x4bd0be){_0x1a3f2d['setDataValue'](_0x1c84('0x8'),_0x4bd0be['map'](function(_0x213434){return{'id':_0x213434['id']};}));return OpenchannelMessage[_0x1c84('0x9')]({'where':{'OpenchannelInteractionId':_0x1a3f2d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c84('0x7')](function(_0x1d2406){_0x1a3f2d['setDataValue'](_0x1c84('0xa'),_0x1d2406[_0x1c84('0xb')]);OpenchannelInteractionEvents[_0x1c84('0xc')](_0x41d3f9+':'+_0x1a3f2d['id'],_0x1a3f2d);OpenchannelInteractionEvents[_0x1c84('0xc')](_0x41d3f9,_0x1a3f2d);_0x32240b(null);})['catch'](_0x32240b(null));};}for(var e in events){if(events[_0x1c84('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x1c84('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xbf07=['events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf07,0x17a));var _0x7bf0=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xbf07[_0x504df1];return _0x1063b5;};'use strict';var EventEmitter=require(_0x7bf0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x7bf0('0x1')];var OpenchannelMessage=require(_0x7bf0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7bf0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7bf0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21f58c){return function(_0x1c7d51,_0x4503e0,_0x563ccc){_0x1c7d51[_0x7bf0('0x5')]({'attributes':['id'],'raw':!![]})[_0x7bf0('0x6')](function(_0x2ba82b){_0x1c7d51[_0x7bf0('0x7')](_0x7bf0('0x8'),_0x2ba82b[_0x7bf0('0x9')](function(_0x1fffbd){return{'id':_0x1fffbd['id']};}));return OpenchannelMessage[_0x7bf0('0xa')]({'where':{'OpenchannelInteractionId':_0x1c7d51['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7bf0('0x6')](function(_0x59cdc1){_0x1c7d51[_0x7bf0('0x7')](_0x7bf0('0xb'),_0x59cdc1[_0x7bf0('0xc')]);OpenchannelInteractionEvents[_0x7bf0('0xd')](_0x21f58c+':'+_0x1c7d51['id'],_0x1c7d51);OpenchannelInteractionEvents[_0x7bf0('0xd')](_0x21f58c,_0x1c7d51);_0x563ccc(null);})[_0x7bf0('0xe')](_0x563ccc(null));};}for(var e in events){if(events[_0x7bf0('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x7bf0('0x10')](e,emitEvent(event));}}module[_0x7bf0('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index e277846..bbd5cc3 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 _0x50b2=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions'];(function(_0x3dfc81,_0x3cd309){var _0x12e65c=function(_0x447fff){while(--_0x447fff){_0x3dfc81['push'](_0x3dfc81['shift']());}};_0x12e65c(++_0x3cd309);}(_0x50b2,0x9d));var _0x250b=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0x50b2[_0x2dd6b1];return _0x494306;};'use strict';var _=require('lodash');var util=require(_0x250b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x250b('0x1'));var BPromise=require(_0x250b('0x2'));var rp=require(_0x250b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x250b('0x4'));var attributes=require(_0x250b('0x5'));module['exports']=function(_0x366242,_0x80961f){return _0x366242[_0x250b('0x6')]('OpenchannelInteraction',attributes,{'tableName':_0x250b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x250b('0x8'),'collate':_0x250b('0x9'),'hooks':{'beforeUpdate':function(_0x21c835,_0x72935c,_0x2efa57){if(_0x21c835[_0x250b('0xa')](_0x250b('0xb'))){_0x21c835[_0x250b('0xc')]=moment()[_0x250b('0xd')](_0x250b('0xe'));}_0x2efa57(null,_0x21c835);}}});}; \ No newline at end of file +var _0x7bb9=['OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird','path','./openchannelInteraction.attributes','exports','define'];(function(_0x3e308a,_0x445fea){var _0x836ce6=function(_0x765f81){while(--_0x765f81){_0x3e308a['push'](_0x3e308a['shift']());}};_0x836ce6(++_0x445fea);}(_0x7bb9,0x158));var _0x97bb=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7bb9[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x97bb('0x0'));var util=require('util');var logger=require(_0x97bb('0x1'))(_0x97bb('0x2'));var moment=require('moment');var BPromise=require(_0x97bb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97bb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97bb('0x5'));module[_0x97bb('0x6')]=function(_0xee1968,_0x4b71f4){return _0xee1968[_0x97bb('0x7')](_0x97bb('0x8'),attributes,{'tableName':_0x97bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97bb('0xa'),'collate':_0x97bb('0xb'),'hooks':{'beforeUpdate':function(_0x1ba081,_0x417e5e,_0x3285ff){if(_0x1ba081[_0x97bb('0xc')](_0x97bb('0xd'))){_0x1ba081['closedAt']=moment()[_0x97bb('0xe')](_0x97bb('0xf'));}_0x3285ff(null,_0x1ba081);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a75ee01..6112140 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 _0x610b=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','request','then','request\x20sent'];(function(_0x1a343c,_0x2b5378){var _0x440d4c=function(_0x275cbc){while(--_0x275cbc){_0x1a343c['push'](_0x1a343c['shift']());}};_0x440d4c(++_0x2b5378);}(_0x610b,0x1e5));var _0xb610=function(_0x53d384,_0x99e6a0){_0x53d384=_0x53d384-0x0;var _0x182c9a=_0x610b[_0x53d384];return _0x182c9a;};'use strict';var _=require(_0xb610('0x0'));var util=require(_0xb610('0x1'));var moment=require(_0xb610('0x2'));var BPromise=require(_0xb610('0x3'));var rs=require(_0xb610('0x4'));var fs=require('fs');var Redis=require(_0xb610('0x5'));var db=require(_0xb610('0x6'))['db'];var utils=require(_0xb610('0x7'));var logger=require(_0xb610('0x8'))('rpc');var config=require(_0xb610('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb610('0xa')][_0xb610('0xb')]({'port':0x232a});config[_0xb610('0xc')]=_[_0xb610('0xd')](config[_0xb610('0xc')],{'host':_0xb610('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb610('0xc')]));require('./openchannelInteraction.socket')[_0xb610('0xf')](socket);function respondWithRpcPromise(_0x1ea7a4,_0x1e6ae9,_0x4112c6){return new BPromise(function(_0x2d8307,_0x5f1178){return client[_0xb610('0x10')](_0x1ea7a4,_0x4112c6)[_0xb610('0x11')](function(_0x2e1dad){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1e6ae9,_0xb610('0x12'));logger[_0xb610('0x13')](_0xb610('0x14'),_0x1e6ae9,'request\x20sent',JSON[_0xb610('0x15')](_0x2e1dad));if(_0x2e1dad[_0xb610('0x16')]){if(_0x2e1dad[_0xb610('0x16')][_0xb610('0x17')]===0x1f4){logger[_0xb610('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1e6ae9,_0x2e1dad[_0xb610('0x16')]['message']);return _0x5f1178(_0x2e1dad[_0xb610('0x16')][_0xb610('0x18')]);}logger[_0xb610('0x16')](_0xb610('0x19'),_0x1e6ae9,_0x2e1dad[_0xb610('0x16')]['message']);return _0x2d8307(_0x2e1dad[_0xb610('0x16')][_0xb610('0x18')]);}else{logger[_0xb610('0x1a')](_0xb610('0x19'),_0x1e6ae9,_0xb610('0x12'));_0x2d8307(_0x2e1dad['result'][_0xb610('0x18')]);}})[_0xb610('0x1b')](function(_0x2c23e5){logger[_0xb610('0x16')](_0xb610('0x19'),_0x1e6ae9,_0x2c23e5);_0x5f1178(_0x2c23e5);});});}exports[_0xb610('0x1c')]=function(_0x253a20){var _0x215661=this;return new Promise(function(_0x16e17c,_0x270c73){return db['OpenchannelInteraction'][_0xb610('0x1d')](_0x253a20[_0xb610('0x1e')],{'raw':_0x253a20[_0xb610('0x1f')]?_0x253a20[_0xb610('0x1f')][_0xb610('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x253a20[_0xb610('0x1f')]?_0x253a20[_0xb610('0x1f')][_0xb610('0x21')]||null:null,'attributes':_0x253a20[_0xb610('0x1f')]?_0x253a20[_0xb610('0x1f')][_0xb610('0x22')]||null:null,'limit':_0x253a20[_0xb610('0x1f')]?_0x253a20[_0xb610('0x1f')]['limit']||null:null})[_0xb610('0x11')](function(_0x25acb7){logger[_0xb610('0x1a')](_0xb610('0x1c'),_0x253a20);logger[_0xb610('0x13')](_0xb610('0x1c'),_0x253a20,JSON[_0xb610('0x15')](_0x25acb7));_0x16e17c(_0x25acb7);})['catch'](function(_0x32f5dc){logger[_0xb610('0x16')](_0xb610('0x1c'),_0x32f5dc[_0xb610('0x18')],_0x253a20);_0x270c73(_0x215661[_0xb610('0x16')](0x1f4,_0x32f5dc[_0xb610('0x18')]));});});};exports[_0xb610('0x23')]=function(_0x53a5ac){return new Promise(function(_0x2390d2,_0x362586){return db['OpenchannelInteraction'][_0xb610('0x24')]({'where':_0x53a5ac[_0xb610('0x1f')]?_0x53a5ac[_0xb610('0x1f')]['where']||null:null})['then'](function(_0x50b10e){if(_0x50b10e){return _0x50b10e[_0xb610('0x25')](_0x53a5ac[_0xb610('0x1e')][_0xb610('0x26')],_[_0xb610('0x27')](_0x53a5ac[_0xb610('0x1e')],[_0xb610('0x26'),'id'])||{});}})[_0xb610('0x28')](function(_0x2560f2){logger['info'](_0xb610('0x29'),_0x53a5ac);logger[_0xb610('0x13')](_0xb610('0x29'),_0x53a5ac,JSON[_0xb610('0x15')](_0x2560f2));_0x2390d2(_0x2560f2);})['catch'](function(_0x50fee7){logger[_0xb610('0x16')](_0xb610('0x29'),_0x50fee7[_0xb610('0x18')],_0x53a5ac);_0x362586(_this[_0xb610('0x16')](0x1f4,_0x50fee7[_0xb610('0x18')]));});});}; \ No newline at end of file +var _0xf944=['body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','then','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0x1e1232,_0x575d4b){var _0x10d42d=function(_0x5a6c00){while(--_0x5a6c00){_0x1e1232['push'](_0x1e1232['shift']());}};_0x10d42d(++_0x575d4b);}(_0xf944,0xb5));var _0x4f94=function(_0x4ba2e1,_0x36efae){_0x4ba2e1=_0x4ba2e1-0x0;var _0x28ae3f=_0xf944[_0x4ba2e1];return _0x28ae3f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f94('0x0'));var BPromise=require(_0x4f94('0x1'));var rs=require(_0x4f94('0x2'));var fs=require('fs');var Redis=require(_0x4f94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f94('0x4'));var logger=require(_0x4f94('0x5'))(_0x4f94('0x6'));var config=require(_0x4f94('0x7'));var jayson=require(_0x4f94('0x8'));var client=jayson[_0x4f94('0x9')][_0x4f94('0xa')]({'port':0x232a});config[_0x4f94('0xb')]=_['defaults'](config[_0x4f94('0xb')],{'host':_0x4f94('0xc'),'port':0x18eb});var socket=require(_0x4f94('0xd'))(new Redis(config['redis']));require(_0x4f94('0xe'))[_0x4f94('0xf')](socket);function respondWithRpcPromise(_0x3a7bf7,_0x5c5005,_0x27b3d5){return new BPromise(function(_0x26a798,_0x59ea17){return client['request'](_0x3a7bf7,_0x27b3d5)['then'](function(_0x23e951){logger[_0x4f94('0x10')](_0x4f94('0x11'),_0x5c5005,_0x4f94('0x12'));logger[_0x4f94('0x13')](_0x4f94('0x14'),_0x5c5005,'request\x20sent',JSON[_0x4f94('0x15')](_0x23e951));if(_0x23e951[_0x4f94('0x16')]){if(_0x23e951[_0x4f94('0x16')]['code']===0x1f4){logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x23e951[_0x4f94('0x16')][_0x4f94('0x17')]);return _0x59ea17(_0x23e951[_0x4f94('0x16')][_0x4f94('0x17')]);}logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x23e951[_0x4f94('0x16')]['message']);return _0x26a798(_0x23e951['error'][_0x4f94('0x17')]);}else{logger[_0x4f94('0x10')](_0x4f94('0x11'),_0x5c5005,_0x4f94('0x12'));_0x26a798(_0x23e951[_0x4f94('0x18')][_0x4f94('0x17')]);}})[_0x4f94('0x19')](function(_0x58e552){logger[_0x4f94('0x16')](_0x4f94('0x11'),_0x5c5005,_0x58e552);_0x59ea17(_0x58e552);});});}exports[_0x4f94('0x1a')]=function(_0x3ad7dc){var _0x26a46d=this;return new Promise(function(_0x470121,_0x716135){return db[_0x4f94('0x1b')][_0x4f94('0x1c')](_0x3ad7dc[_0x4f94('0x1d')],{'raw':_0x3ad7dc['options']?_0x3ad7dc[_0x4f94('0x1e')][_0x4f94('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc['options'][_0x4f94('0x20')]||null:null,'attributes':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc[_0x4f94('0x1e')][_0x4f94('0x21')]||null:null,'limit':_0x3ad7dc[_0x4f94('0x1e')]?_0x3ad7dc[_0x4f94('0x1e')]['limit']||null:null})['then'](function(_0x52a8a4){logger['info'](_0x4f94('0x1a'),_0x3ad7dc);logger['debug']('UpdateOpenchannelInteraction',_0x3ad7dc,JSON[_0x4f94('0x15')](_0x52a8a4));_0x470121(_0x52a8a4);})['catch'](function(_0x2dd9a8){logger[_0x4f94('0x16')](_0x4f94('0x1a'),_0x2dd9a8[_0x4f94('0x17')],_0x3ad7dc);_0x716135(_0x26a46d['error'](0x1f4,_0x2dd9a8[_0x4f94('0x17')]));});});};exports[_0x4f94('0x22')]=function(_0x356db6){return new Promise(function(_0x1a3f41,_0x2f23e4){return db[_0x4f94('0x1b')][_0x4f94('0x23')]({'where':_0x356db6['options']?_0x356db6[_0x4f94('0x1e')][_0x4f94('0x20')]||null:null})[_0x4f94('0x24')](function(_0xc5678e){if(_0xc5678e){return _0xc5678e[_0x4f94('0x25')](_0x356db6[_0x4f94('0x1d')][_0x4f94('0x26')],_[_0x4f94('0x27')](_0x356db6['body'],['ids','id'])||{});}})[_0x4f94('0x28')](function(_0x326567){logger['info']('AddTags',_0x356db6);logger[_0x4f94('0x13')](_0x4f94('0x29'),_0x356db6,JSON[_0x4f94('0x15')](_0x326567));_0x1a3f41(_0x326567);})[_0x4f94('0x19')](function(_0x5bac6c){logger[_0x4f94('0x16')](_0x4f94('0x29'),_0x5bac6c[_0x4f94('0x17')],_0x356db6);_0x2f23e4(_this[_0x4f94('0x16')](0x1f4,_0x5bac6c[_0x4f94('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 9f295bc..b2b4711 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 _0x1e29=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0x5f336d,_0x48a2b4){var _0x70a621=function(_0x40ba39){while(--_0x40ba39){_0x5f336d['push'](_0x5f336d['shift']());}};_0x70a621(++_0x48a2b4);}(_0x1e29,0x1ef));var _0x91e2=function(_0x57ed1a,_0x2cfdfb){_0x57ed1a=_0x57ed1a-0x0;var _0x298148=_0x1e29[_0x57ed1a];return _0x298148;};'use strict';var OpenchannelInteractionEvents=require(_0x91e2('0x0'));var events=[_0x91e2('0x1'),_0x91e2('0x2'),_0x91e2('0x3')];function createListener(_0x5db8eb,_0x4fdfd5){return function(_0x1d61a9){_0x4fdfd5[_0x91e2('0x4')](_0x5db8eb,_0x1d61a9);};}function removeListener(_0x5285f7,_0xa923a7){return function(){OpenchannelInteractionEvents[_0x91e2('0x5')](_0x5285f7,_0xa923a7);};}exports[_0x91e2('0x6')]=function(_0x79ff85){for(var _0xa83dd4=0x0,_0x42e748=events[_0x91e2('0x7')];_0xa83dd4<_0x42e748;_0xa83dd4++){var _0x1624b2=events[_0xa83dd4];var _0x375e1c=createListener(_0x91e2('0x8')+_0x1624b2,_0x79ff85);OpenchannelInteractionEvents['on'](_0x1624b2,_0x375e1c);}}; \ No newline at end of file +var _0x95fe=['length','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x95fe,0x182));var _0xe95f=function(_0x3bbe4b,_0x35f067){_0x3bbe4b=_0x3bbe4b-0x0;var _0x402d37=_0x95fe[_0x3bbe4b];return _0x402d37;};'use strict';var OpenchannelInteractionEvents=require(_0xe95f('0x0'));var events=[_0xe95f('0x1'),_0xe95f('0x2'),_0xe95f('0x3')];function createListener(_0x1e3413,_0x15f59a){return function(_0x1ab791){_0x15f59a[_0xe95f('0x4')](_0x1e3413,_0x1ab791);};}function removeListener(_0x5ecbd6,_0x13d267){return function(){OpenchannelInteractionEvents[_0xe95f('0x5')](_0x5ecbd6,_0x13d267);};}exports['register']=function(_0x308687){for(var _0x266c28=0x0,_0x45c993=events[_0xe95f('0x6')];_0x266c28<_0x45c993;_0x266c28++){var _0x3da690=events[_0x266c28];var _0x34a3ea=createListener('openchannelInteraction:'+_0x3da690,_0x308687);OpenchannelInteractionEvents['on'](_0x3da690,_0x34a3ea);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f26f175..07bcbc8 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x546e60,_0x1121bf){var _0x316f25=function(_0x57c12b){while(--_0x57c12b){_0x546e60['push'](_0x546e60['shift']());}};_0x316f25(++_0x1121bf);}(_0xe706,0xa3));var _0x6e70=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0xe706[_0x4ec42];return _0x385e11;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2c6c95,_0x3e88d6){var _0x109f35=function(_0x1f02e3){while(--_0x1f02e3){_0x2c6c95['push'](_0x2c6c95['shift']());}};_0x109f35(++_0x3e88d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0dc0345..9958bf8 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 _0x94e6=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0xa91b77,_0x3601e3){var _0x2e0999=function(_0x35881d){while(--_0x35881d){_0xa91b77['push'](_0xa91b77['shift']());}};_0x2e0999(++_0x3601e3);}(_0x94e6,0x194));var _0x694e=function(_0x2df6a5,_0x3d85f0){_0x2df6a5=_0x2df6a5-0x0;var _0x2750ff=_0x94e6[_0x2df6a5];return _0x2750ff;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'body':{'type':Sequelize[_0x694e('0x1')](_0x694e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x694e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x694e('0x4')]('in',_0x694e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x694e('0x6')]},'providerName':{'type':Sequelize[_0x694e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xb03e=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3cd0dc,_0x5c0e3a){var _0x5dce1a=function(_0x2471d0){while(--_0x2471d0){_0x3cd0dc['push'](_0x3cd0dc['shift']());}};_0x5dce1a(++_0x5c0e3a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4a2499,_0x2917ed){_0x4a2499=_0x4a2499-0x0;var _0x439cd4=_0xb03e[_0x4a2499];return _0x439cd4;};'use strict';var Sequelize=require('sequelize');module[_0xeb03('0x0')]={'body':{'type':Sequelize[_0xeb03('0x1')](_0xeb03('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeb03('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb03('0x4')]('in',_0xeb03('0x5')),'defaultValue':_0xeb03('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb03('0x6')]},'providerName':{'type':Sequelize[_0xeb03('0x7')]},'providerResponse':{'type':Sequelize[_0xeb03('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d5b6a8b..ee12a52 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 _0x1419=['accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','role','stringify','rejectMessage','email','reject','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','status','json','limit','undefined','count','offset','apply','update','then','destroy','end','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','describe','openchannel-interactions'];(function(_0x10e409,_0x2627a2){var _0x4a4dcc=function(_0x499773){while(--_0x499773){_0x10e409['push'](_0x10e409['shift']());}};_0x4a4dcc(++_0x2627a2);}(_0x1419,0x127));var _0x9141=function(_0xf6b22c,_0xf4f75a){_0xf6b22c=_0xf6b22c-0x0;var _0xfe37c0=_0x1419[_0xf6b22c];return _0xfe37c0;};'use strict';var emlformat=require(_0x9141('0x0'));var rimraf=require(_0x9141('0x1'));var zipdir=require(_0x9141('0x2'));var jsonpatch=require(_0x9141('0x3'));var rp=require(_0x9141('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9141('0x5'));var util=require(_0x9141('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9141('0x7'));var ejs=require(_0x9141('0x8'));var fs=require('fs');var fs_extra=require(_0x9141('0x9'));var _=require(_0x9141('0xa'));var squel=require(_0x9141('0xb'));var crypto=require(_0x9141('0xc'));var jsforce=require(_0x9141('0xd'));var deskjs=require(_0x9141('0xe'));var toCsv=require(_0x9141('0x7'));var querystring=require(_0x9141('0xf'));var Papa=require('papaparse');var Redis=require(_0x9141('0x10'));var authService=require(_0x9141('0x11'));var qs=require(_0x9141('0x12'));var as=require(_0x9141('0x13'));var hardwareService=require(_0x9141('0x14'));var logger=require(_0x9141('0x15'))(_0x9141('0x16'));var utils=require(_0x9141('0x17'));var config=require(_0x9141('0x18'));var licenseUtil=require(_0x9141('0x19'));var db=require('../../mysqldb')['db'];config[_0x9141('0x1a')]=_[_0x9141('0x1b')](config[_0x9141('0x1a')],{'host':_0x9141('0x1c'),'port':0x18eb});var socket=require(_0x9141('0x1d'))(new Redis(config[_0x9141('0x1a')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x9141('0x1e'));var client=jayson[_0x9141('0x1f')][_0x9141('0x20')]({'port':0x232c});var client9002=jayson[_0x9141('0x1f')][_0x9141('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x17f52e,_0x7aa7f8,_0x610168,_0x2d2db9){return new BPromise(function(_0x48c575,_0x1cff83){var _0x3b2e99=_0x2d2db9||client;return _0x3b2e99['request'](_0x17f52e,_0x610168)['then'](function(_0x160b5c){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x7aa7f8,'request\x20sent');logger['debug'](_0x9141('0x21'),_0x7aa7f8,'request\x20sent',JSON['stringify'](_0x160b5c));if(_0x160b5c[_0x9141('0x22')]){if(_0x160b5c['error'][_0x9141('0x23')]===0x1f4){logger[_0x9141('0x22')](_0x9141('0x24'),_0x7aa7f8,_0x160b5c['error'][_0x9141('0x25')]);return _0x1cff83(_0x160b5c['error']['message']);}logger[_0x9141('0x22')](_0x9141('0x24'),_0x7aa7f8,_0x160b5c[_0x9141('0x22')][_0x9141('0x25')]);return _0x48c575(_0x160b5c[_0x9141('0x22')][_0x9141('0x25')]);}else{logger[_0x9141('0x26')](_0x9141('0x24'),_0x7aa7f8,_0x9141('0x27'));_0x48c575(_0x160b5c[_0x9141('0x28')][_0x9141('0x25')]);}})[_0x9141('0x29')](function(_0x41dd18){logger[_0x9141('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x7aa7f8,_0x41dd18);_0x1cff83(_0x41dd18);});});}function respondWithStatusCode(_0x3a5266,_0x1a6112){_0x1a6112=_0x1a6112||0xcc;return function(_0x13ccea){if(_0x13ccea){return _0x3a5266[_0x9141('0x2a')](_0x1a6112);}return _0x3a5266['status'](_0x1a6112)['end']();};}function respondWithResult(_0x2374ad,_0xd1d009){_0xd1d009=_0xd1d009||0xc8;return function(_0x5a142d){if(_0x5a142d){return _0x2374ad[_0x9141('0x2b')](_0xd1d009)[_0x9141('0x2c')](_0x5a142d);}};}function respondWithFilteredResult(_0xa53403,_0x57238b){return function(_0x113e22){if(_0x113e22){var _0x275c50=typeof _0x57238b['offset']==='undefined'&&typeof _0x57238b[_0x9141('0x2d')]===_0x9141('0x2e');var _0x100bd9=_0x113e22[_0x9141('0x2f')];var _0x1e4f26=_0x275c50?0x0:_0x57238b[_0x9141('0x30')];var _0x4de563=_0x275c50?_0x113e22[_0x9141('0x2f')]:_0x57238b[_0x9141('0x30')]+_0x57238b[_0x9141('0x2d')];var _0xfb55af;if(_0x4de563>=_0x100bd9){_0x4de563=_0x100bd9;_0xfb55af=0xc8;}else{_0xfb55af=0xce;}_0xa53403[_0x9141('0x2b')](_0xfb55af);return _0xa53403['set']('Content-Range',_0x1e4f26+'-'+_0x4de563+'/'+_0x100bd9)[_0x9141('0x2c')](_0x113e22);}return null;};}function patchUpdates(_0x5a0334){return function(_0x4b66e2){try{jsonpatch[_0x9141('0x31')](_0x4b66e2,_0x5a0334,!![]);}catch(_0x2e6ee9){return BPromise['reject'](_0x2e6ee9);}return _0x4b66e2['save']();};}function saveUpdates(_0x1f4f1,_0x297b49){return function(_0x5cabc9){if(_0x5cabc9){return _0x5cabc9[_0x9141('0x32')](_0x1f4f1)[_0x9141('0x33')](function(_0x388601){return _0x388601;});}return null;};}function removeEntity(_0x40755d,_0x258f5c){return function(_0x2ebea6){if(_0x2ebea6){return _0x2ebea6[_0x9141('0x34')]()[_0x9141('0x33')](function(){_0x40755d[_0x9141('0x2b')](0xcc)[_0x9141('0x35')]();});}};}function handleEntityNotFound(_0x3fa2a0,_0x2969ea){return function(_0x214642){if(!_0x214642){_0x3fa2a0[_0x9141('0x2a')](0x194);}return _0x214642;};}function handleError(_0x47fb5c,_0x462a18){_0x462a18=_0x462a18||0x1f4;return function(_0x34e4f7){logger['error'](_0x34e4f7[_0x9141('0x36')]);if(_0x34e4f7[_0x9141('0x37')]){delete _0x34e4f7[_0x9141('0x37')];}_0x47fb5c['status'](_0x462a18)[_0x9141('0x38')](_0x34e4f7);};}exports[_0x9141('0x39')]=function(_0x3f0053,_0x125fab){var _0x271a19={},_0x3008b7={},_0x362287={'count':0x0,'rows':[]};var _0x49fb97=_[_0x9141('0x3a')](db[_0x9141('0x3b')]['rawAttributes'],function(_0x5560d1){return{'name':_0x5560d1[_0x9141('0x3c')],'type':_0x5560d1[_0x9141('0x3d')][_0x9141('0x3e')]};});_0x3008b7['model']=_[_0x9141('0x3a')](_0x49fb97,_0x9141('0x37'));_0x3008b7[_0x9141('0x3f')]=_[_0x9141('0x40')](_0x3f0053[_0x9141('0x3f')]);_0x3008b7[_0x9141('0x41')]=_[_0x9141('0x42')](_0x3008b7[_0x9141('0x43')],_0x3008b7[_0x9141('0x3f')]);_0x271a19[_0x9141('0x44')]=_['intersection'](_0x3008b7[_0x9141('0x43')],qs[_0x9141('0x45')](_0x3f0053[_0x9141('0x3f')][_0x9141('0x45')]));_0x271a19[_0x9141('0x44')]=_0x271a19[_0x9141('0x44')][_0x9141('0x46')]?_0x271a19[_0x9141('0x44')]:_0x3008b7[_0x9141('0x43')];if(!_0x3f0053[_0x9141('0x3f')][_0x9141('0x47')]('nolimit')){_0x271a19[_0x9141('0x2d')]=qs[_0x9141('0x2d')](_0x3f0053[_0x9141('0x3f')][_0x9141('0x2d')]);_0x271a19['offset']=qs[_0x9141('0x30')](_0x3f0053[_0x9141('0x3f')][_0x9141('0x30')]);}_0x271a19[_0x9141('0x48')]=qs['sort'](_0x3f0053[_0x9141('0x3f')][_0x9141('0x49')]);_0x271a19[_0x9141('0x4a')]=qs['filters'](_[_0x9141('0x4b')](_0x3f0053[_0x9141('0x3f')],_0x3008b7['filters']),_0x49fb97);if(_0x3f0053['query'][_0x9141('0x4c')]){_0x271a19['where']=_[_0x9141('0x4d')](_0x271a19['where'],{'$or':_[_0x9141('0x3a')](_0x49fb97,function(_0x507d81){if(_0x507d81['type']!==_0x9141('0x4e')){var _0x1046cc={};_0x1046cc[_0x507d81[_0x9141('0x37')]]={'$like':'%'+_0x3f0053[_0x9141('0x3f')][_0x9141('0x4c')]+'%'};return _0x1046cc;}})});}_0x271a19=_[_0x9141('0x4d')]({},_0x271a19,_0x3f0053[_0x9141('0x4f')]);var _0x67aa4e={'where':_0x271a19[_0x9141('0x4a')]};return db[_0x9141('0x3b')]['count'](_0x67aa4e)[_0x9141('0x33')](function(_0x3c7b22){_0x362287['count']=_0x3c7b22;if(_0x3f0053['query'][_0x9141('0x50')]){_0x271a19[_0x9141('0x51')]=[{'all':!![]}];}return db[_0x9141('0x3b')][_0x9141('0x52')](_0x271a19);})['then'](function(_0x21491c){_0x362287['rows']=_0x21491c;return _0x362287;})[_0x9141('0x33')](respondWithFilteredResult(_0x125fab,_0x271a19))[_0x9141('0x29')](handleError(_0x125fab,null));};exports[_0x9141('0x53')]=function(_0x271258,_0xc70a2f){var _0x57fcf7={'raw':!![],'where':{'id':_0x271258[_0x9141('0x54')]['id']}},_0x1e6822={};_0x1e6822[_0x9141('0x43')]=_[_0x9141('0x40')](db[_0x9141('0x3b')]['rawAttributes']);_0x1e6822[_0x9141('0x3f')]=_['keys'](_0x271258['query']);_0x1e6822['filters']=_[_0x9141('0x42')](_0x1e6822['model'],_0x1e6822[_0x9141('0x3f')]);_0x57fcf7[_0x9141('0x44')]=_['intersection'](_0x1e6822['model'],qs[_0x9141('0x45')](_0x271258['query'][_0x9141('0x45')]));_0x57fcf7[_0x9141('0x44')]=_0x57fcf7[_0x9141('0x44')][_0x9141('0x46')]?_0x57fcf7[_0x9141('0x44')]:_0x1e6822[_0x9141('0x43')];if(_0x271258['query'][_0x9141('0x50')]){_0x57fcf7[_0x9141('0x51')]=[{'all':!![]}];}_0x57fcf7=_['merge']({},_0x57fcf7,_0x271258[_0x9141('0x4f')]);return db[_0x9141('0x3b')]['find'](_0x57fcf7)[_0x9141('0x33')](handleEntityNotFound(_0xc70a2f,null))[_0x9141('0x33')](respondWithResult(_0xc70a2f,null))[_0x9141('0x29')](handleError(_0xc70a2f,null));};exports[_0x9141('0x55')]=function(_0x251f42,_0x4afa10){return db[_0x9141('0x3b')][_0x9141('0x55')](_0x251f42[_0x9141('0x56')],{})[_0x9141('0x33')](respondWithResult(_0x4afa10,0xc9))['catch'](handleError(_0x4afa10,null));};exports[_0x9141('0x32')]=function(_0x31995a,_0x17470d){if(_0x31995a['body']['id']){delete _0x31995a['body']['id'];}return db[_0x9141('0x3b')]['find']({'where':{'id':_0x31995a[_0x9141('0x54')]['id']}})[_0x9141('0x33')](handleEntityNotFound(_0x17470d,null))[_0x9141('0x33')](saveUpdates(_0x31995a[_0x9141('0x56')],null))['then'](respondWithResult(_0x17470d,null))['catch'](handleError(_0x17470d,null));};exports[_0x9141('0x34')]=function(_0x24c54a,_0x2c5867){return db[_0x9141('0x3b')]['find']({'where':{'id':_0x24c54a['params']['id']}})[_0x9141('0x33')](handleEntityNotFound(_0x2c5867,null))[_0x9141('0x33')](removeEntity(_0x2c5867,null))[_0x9141('0x29')](handleError(_0x2c5867,null));};exports[_0x9141('0x57')]=function(_0x48efcb,_0x144984){return db[_0x9141('0x3b')][_0x9141('0x57')]()[_0x9141('0x33')](respondWithResult(_0x144984,null))['catch'](handleError(_0x144984,null));};var interaction_log=require(_0x9141('0x15'))(_0x9141('0x58'));exports[_0x9141('0x59')]=function(_0x2f7403,_0x1ac412,_0x50c302){var _0xe6ec29={'agent':{},'channel':_0x9141('0x5a')};if(_0x2f7403['body']['id']){delete _0x2f7403['body']['id'];}_0x2f7403[_0x9141('0x56')][_0x9141('0x5b')]=!![];_0x2f7403[_0x9141('0x56')][_0x9141('0x5c')]=moment()[_0x9141('0x5d')](_0x9141('0x5e'));_0x2f7403['body'][_0x9141('0x5f')]=_0x2f7403[_0x9141('0x56')][_0x9141('0x5f')]||_0x2f7403[_0x9141('0x60')]['id'];_0xe6ec29['agent']['id']=_0x2f7403[_0x9141('0x56')][_0x9141('0x5f')];return db[_0x9141('0x3b')][_0x9141('0x61')]({'where':{'id':_0x2f7403[_0x9141('0x54')]['id'],'UserId':null}})[_0x9141('0x33')](handleEntityNotFound(_0x1ac412,null))[_0x9141('0x33')](saveUpdates(_0x2f7403['body'],null))[_0x9141('0x33')](function(_0x52a10e){if(_0x52a10e){_0xe6ec29[_0x9141('0x25')]=_0x52a10e[_0x9141('0x62')]({'plain':!![]});return db[_0x9141('0x63')][_0x9141('0x61')]({'where':{'id':_0x52a10e[_0x9141('0x64')]}});}return null;})[_0x9141('0x33')](handleEntityNotFound(_0x1ac412,null))[_0x9141('0x33')](function(_0x2565b0){if(_0x2565b0){return _0x2565b0['update']({'UserId':_0x2f7403[_0x9141('0x56')][_0x9141('0x5f')],'read1stAt':_[_0x9141('0x65')](_0x2565b0['read1stAt'])?moment()[_0x9141('0x5d')](_0x9141('0x5e')):undefined});}return null;})[_0x9141('0x33')](function(_0x2f33b8){if(_0x2f33b8){_0xe6ec29[_0x9141('0x66')]=_0x2f33b8['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f7403[_0x9141('0x60')]['id'],_0x2f7403[_0x9141('0x60')][_0x9141('0x37')],_0x2f7403[_0x9141('0x60')]['role'],_0xe6ec29[_0x9141('0x66')]['id'],_0x2f7403[_0x9141('0x56')]?JSON['stringify'](_0x2f7403[_0x9141('0x56')]):_0x9141('0x67'));return respondWithRpcPromise(_0x9141('0x68'),_0x9141('0x69'),_0xe6ec29);}return null;})[_0x9141('0x33')](function(_0x12c152){var _0x210f2b=_0x9141('0x6a')+_0x12c152[_0x9141('0x25')][_0x9141('0x6b')];return db[_0x9141('0x6c')][_0x9141('0x3f')](_0x210f2b,{'type':db[_0x9141('0x6d')][_0x9141('0x6e')][_0x9141('0x6f')],'raw':!![]})['then'](function(_0xf6cf8f){return _0xf6cf8f;});})[_0x9141('0x33')](function(_0x6f227a){if(_0x6f227a){_0xe6ec29[_0x9141('0x25')][_0x9141('0x70')]=_0x6f227a[0x0];if(!_0x2f7403['body'][_0x9141('0x5f')])return;return db[_0x9141('0x71')][_0x9141('0x61')]({'where':{'id':_0x2f7403[_0x9141('0x56')][_0x9141('0x5f')],'role':_0x9141('0x72')},'attributes':['id',_0x9141('0x37'),_0x9141('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x9141('0x33')](function(_0x382d59){if(!_0x382d59)return null;_0xe6ec29[_0x9141('0x25')][_0x9141('0x72')]=_0x382d59;return _0xe6ec29;})[_0x9141('0x33')](function(_0x507a06){if(_0x507a06){if(_0x2f7403['body']['manual']){_0xe6ec29['message'][_0x9141('0x74')]=util[_0x9141('0x5d')](_0x9141('0x75'),_0x2f7403[_0x9141('0x60')][_0x9141('0x37')]);_0xe6ec29[_0x9141('0x25')][_0x9141('0x76')]=_0xe6ec29[_0x9141('0x76')];_0xe6ec29[_0x9141('0x25')][_0x9141('0x77')]=_0xe6ec29['channel'];_0xe6ec29['message'][_0x9141('0x78')]='accept';return respondWithRpcPromise(_0x9141('0x79'),_0x9141('0x79'),{'event':_0x9141('0x7a'),'message':_0xe6ec29[_0x9141('0x25')]},client9002)['then'](function(){return _0xe6ec29;});}return _0xe6ec29;}return null;})[_0x9141('0x33')](respondWithResult(_0x1ac412,null))[_0x9141('0x29')](handleError(_0x1ac412,null));};var interaction_log=require(_0x9141('0x15'))('openchannel-interactions');exports['reject']=function(_0x28f38c,_0x48ff41,_0x598501){var _0x58af57={'agent':{},'channel':_0x9141('0x5a')};if(_0x28f38c[_0x9141('0x56')]['id']){delete _0x28f38c[_0x9141('0x56')]['id'];}_0x28f38c[_0x9141('0x56')][_0x9141('0x5f')]=_0x28f38c[_0x9141('0x56')][_0x9141('0x5f')]||_0x28f38c['user']['id'];_0x58af57[_0x9141('0x72')]['id']=_0x28f38c[_0x9141('0x56')]['UserId'];return db[_0x9141('0x3b')][_0x9141('0x61')]({'where':{'id':_0x28f38c[_0x9141('0x54')]['id'],'UserId':null}})[_0x9141('0x33')](handleEntityNotFound(_0x48ff41,null))[_0x9141('0x33')](function(_0x82312b){if(_0x82312b){_0x58af57[_0x9141('0x25')]=_0x82312b[_0x9141('0x62')]({'plain':!![]});return db[_0x9141('0x63')][_0x9141('0x61')]({'where':{'id':_0x82312b['OpenchannelInteractionId']}});}return null;})[_0x9141('0x33')](handleEntityNotFound(_0x48ff41,null))[_0x9141('0x33')](function(_0x4d78df){if(_0x4d78df){_0x58af57[_0x9141('0x66')]=_0x4d78df['get']({'plain':!![]});interaction_log[_0x9141('0x26')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28f38c[_0x9141('0x60')]['id'],_0x28f38c[_0x9141('0x60')][_0x9141('0x37')],_0x28f38c[_0x9141('0x60')][_0x9141('0x7b')],_0x58af57[_0x9141('0x66')]['id'],_0x28f38c['body']?JSON[_0x9141('0x7c')](_0x28f38c['body']):_0x9141('0x67'));return respondWithRpcPromise('RejectMessage',_0x9141('0x7d'),_0x58af57);}return null;})[_0x9141('0x33')](function(_0x272b5a){var _0x5a5a93=_0x9141('0x6a')+_0x272b5a[_0x9141('0x25')][_0x9141('0x6b')];return db[_0x9141('0x6c')][_0x9141('0x3f')](_0x5a5a93,{'type':db[_0x9141('0x6d')]['QueryTypes'][_0x9141('0x6f')],'raw':!![]})[_0x9141('0x33')](function(_0x7afc5){return _0x7afc5;});})[_0x9141('0x33')](function(_0x44f95b){if(_0x44f95b){_0x58af57[_0x9141('0x25')][_0x9141('0x70')]=_0x44f95b[0x0];if(!_0x28f38c[_0x9141('0x56')][_0x9141('0x5f')])return;return db[_0x9141('0x71')][_0x9141('0x61')]({'where':{'id':_0x28f38c[_0x9141('0x56')][_0x9141('0x5f')],'role':_0x9141('0x72')},'attributes':['id','name',_0x9141('0x73'),_0x9141('0x7e'),'internal'],'raw':!![]});}return null;})[_0x9141('0x33')](function(_0x4303b9){if(!_0x4303b9)return null;_0x58af57['message'][_0x9141('0x72')]=_0x4303b9;return _0x58af57;})[_0x9141('0x33')](function(_0x5d5993){if(_0x5d5993){_0x5d5993['message'][_0x9141('0x74')]=util[_0x9141('0x5d')](_0x9141('0x75'),_0x28f38c[_0x9141('0x60')][_0x9141('0x37')]);_0x5d5993[_0x9141('0x25')][_0x9141('0x76')]=_0x58af57['channel'];_0x5d5993[_0x9141('0x25')]['motionChannel']=_0x58af57[_0x9141('0x76')];_0x5d5993[_0x9141('0x25')][_0x9141('0x78')]=_0x9141('0x7f');respondWithRpcPromise(_0x9141('0x79'),'EventManager',{'event':'rejectmessage','message':_0x5d5993['message']},client9002);return _0x58af57;}return null;})[_0x9141('0x33')](respondWithResult(_0x48ff41,null))[_0x9141('0x29')](handleError(_0x48ff41,null));}; \ No newline at end of file +var _0xf1c7=['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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','body','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','rejectmessage','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x912b06,_0x44db09){var _0x1d0f68=function(_0x56b7c3){while(--_0x56b7c3){_0x912b06['push'](_0x912b06['shift']());}};_0x1d0f68(++_0x44db09);}(_0xf1c7,0x193));var _0x7f1c=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xf1c7[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require(_0x7f1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f1c('0x2'));var moment=require(_0x7f1c('0x3'));var BPromise=require(_0x7f1c('0x4'));var Mustache=require(_0x7f1c('0x5'));var util=require(_0x7f1c('0x6'));var path=require(_0x7f1c('0x7'));var sox=require(_0x7f1c('0x8'));var csv=require(_0x7f1c('0x9'));var ejs=require(_0x7f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f1c('0xb'));var crypto=require(_0x7f1c('0xc'));var jsforce=require(_0x7f1c('0xd'));var deskjs=require(_0x7f1c('0xe'));var toCsv=require(_0x7f1c('0x9'));var querystring=require(_0x7f1c('0xf'));var Papa=require(_0x7f1c('0x10'));var Redis=require(_0x7f1c('0x11'));var authService=require(_0x7f1c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f1c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f1c('0x14'))(_0x7f1c('0x15'));var utils=require(_0x7f1c('0x16'));var config=require(_0x7f1c('0x17'));var licenseUtil=require(_0x7f1c('0x18'));var db=require(_0x7f1c('0x19'))['db'];config[_0x7f1c('0x1a')]=_[_0x7f1c('0x1b')](config[_0x7f1c('0x1a')],{'host':_0x7f1c('0x1c'),'port':0x18eb});var socket=require(_0x7f1c('0x1d'))(new Redis(config[_0x7f1c('0x1a')]));require(_0x7f1c('0x1e'))[_0x7f1c('0x1f')](socket);var jayson=require(_0x7f1c('0x20'));var client=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232c});var client9002=jayson[_0x7f1c('0x21')][_0x7f1c('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x10a02b,_0x4b8aa7,_0x4d439b,_0xa67dbf){return new BPromise(function(_0x6c36f4,_0x1d18c3){var _0x13b849=_0xa67dbf||client;return _0x13b849[_0x7f1c('0x23')](_0x10a02b,_0x4d439b)[_0x7f1c('0x24')](function(_0x455827){logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,_0x7f1c('0x27'));logger[_0x7f1c('0x28')](_0x7f1c('0x29'),_0x4b8aa7,_0x7f1c('0x27'),JSON[_0x7f1c('0x2a')](_0x455827));if(_0x455827[_0x7f1c('0x2b')]){if(_0x455827['error'][_0x7f1c('0x2c')]===0x1f4){logger[_0x7f1c('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x1d18c3(_0x455827[_0x7f1c('0x2b')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x4b8aa7,_0x455827[_0x7f1c('0x2b')][_0x7f1c('0x2d')]);return _0x6c36f4(_0x455827[_0x7f1c('0x2b')]['message']);}else{logger[_0x7f1c('0x25')](_0x7f1c('0x26'),_0x4b8aa7,'request\x20sent');_0x6c36f4(_0x455827[_0x7f1c('0x2e')][_0x7f1c('0x2d')]);}})[_0x7f1c('0x2f')](function(_0x57506e){logger[_0x7f1c('0x2b')](_0x7f1c('0x26'),_0x4b8aa7,_0x57506e);_0x1d18c3(_0x57506e);});});}function respondWithStatusCode(_0x252692,_0x57b2a8){_0x57b2a8=_0x57b2a8||0xcc;return function(_0x2e4001){if(_0x2e4001){return _0x252692[_0x7f1c('0x30')](_0x57b2a8);}return _0x252692[_0x7f1c('0x31')](_0x57b2a8)[_0x7f1c('0x32')]();};}function respondWithResult(_0x42208a,_0x34f9f9){_0x34f9f9=_0x34f9f9||0xc8;return function(_0x548f65){if(_0x548f65){return _0x42208a[_0x7f1c('0x31')](_0x34f9f9)[_0x7f1c('0x33')](_0x548f65);}};}function respondWithFilteredResult(_0x12ec44,_0x50d3ca){return function(_0x1b24e0){if(_0x1b24e0){var _0xa6316f=typeof _0x50d3ca[_0x7f1c('0x34')]===_0x7f1c('0x35')&&typeof _0x50d3ca['limit']==='undefined';var _0x34af6b=_0x1b24e0[_0x7f1c('0x36')];var _0x24a1a2=_0xa6316f?0x0:_0x50d3ca[_0x7f1c('0x34')];var _0x28729b=_0xa6316f?_0x1b24e0[_0x7f1c('0x36')]:_0x50d3ca[_0x7f1c('0x34')]+_0x50d3ca[_0x7f1c('0x37')];var _0x669d30;if(_0x28729b>=_0x34af6b){_0x28729b=_0x34af6b;_0x669d30=0xc8;}else{_0x669d30=0xce;}_0x12ec44[_0x7f1c('0x31')](_0x669d30);return _0x12ec44[_0x7f1c('0x38')](_0x7f1c('0x39'),_0x24a1a2+'-'+_0x28729b+'/'+_0x34af6b)[_0x7f1c('0x33')](_0x1b24e0);}return null;};}function patchUpdates(_0x4313ba){return function(_0xb14245){try{jsonpatch[_0x7f1c('0x3a')](_0xb14245,_0x4313ba,!![]);}catch(_0xc757f9){return BPromise[_0x7f1c('0x3b')](_0xc757f9);}return _0xb14245[_0x7f1c('0x3c')]();};}function saveUpdates(_0x2452d4,_0x596983){return function(_0x156055){if(_0x156055){return _0x156055[_0x7f1c('0x3d')](_0x2452d4)['then'](function(_0x78f131){return _0x78f131;});}return null;};}function removeEntity(_0x1b65b6,_0x301c23){return function(_0x3a4501){if(_0x3a4501){return _0x3a4501[_0x7f1c('0x3e')]()['then'](function(){_0x1b65b6[_0x7f1c('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ed8e,_0x85abc3){return function(_0x1313e8){if(!_0x1313e8){_0x45ed8e[_0x7f1c('0x30')](0x194);}return _0x1313e8;};}function handleError(_0x48646b,_0x5c2cc1){_0x5c2cc1=_0x5c2cc1||0x1f4;return function(_0x10780e){logger[_0x7f1c('0x2b')](_0x10780e[_0x7f1c('0x3f')]);if(_0x10780e[_0x7f1c('0x40')]){delete _0x10780e[_0x7f1c('0x40')];}_0x48646b[_0x7f1c('0x31')](_0x5c2cc1)['send'](_0x10780e);};}exports['index']=function(_0x40dcfa,_0x55af70){var _0x498f32={},_0xa532ac={},_0x2cc17c={'count':0x0,'rows':[]};var _0x480b1a=_[_0x7f1c('0x41')](db[_0x7f1c('0x42')][_0x7f1c('0x43')],function(_0x2ddc4f){return{'name':_0x2ddc4f[_0x7f1c('0x44')],'type':_0x2ddc4f['type'][_0x7f1c('0x45')]};});_0xa532ac[_0x7f1c('0x46')]=_[_0x7f1c('0x41')](_0x480b1a,_0x7f1c('0x40'));_0xa532ac[_0x7f1c('0x47')]=_[_0x7f1c('0x48')](_0x40dcfa['query']);_0xa532ac[_0x7f1c('0x49')]=_[_0x7f1c('0x4a')](_0xa532ac['model'],_0xa532ac[_0x7f1c('0x47')]);_0x498f32['attributes']=_[_0x7f1c('0x4a')](_0xa532ac[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x40dcfa[_0x7f1c('0x47')]['fields']));_0x498f32[_0x7f1c('0x4c')]=_0x498f32[_0x7f1c('0x4c')][_0x7f1c('0x4d')]?_0x498f32[_0x7f1c('0x4c')]:_0xa532ac[_0x7f1c('0x46')];if(!_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x4e')]('nolimit')){_0x498f32[_0x7f1c('0x37')]=qs[_0x7f1c('0x37')](_0x40dcfa['query'][_0x7f1c('0x37')]);_0x498f32['offset']=qs[_0x7f1c('0x34')](_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x34')]);}_0x498f32[_0x7f1c('0x4f')]=qs['sort'](_0x40dcfa['query']['sort']);_0x498f32['where']=qs[_0x7f1c('0x49')](_[_0x7f1c('0x50')](_0x40dcfa[_0x7f1c('0x47')],_0xa532ac[_0x7f1c('0x49')]),_0x480b1a);if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]){_0x498f32[_0x7f1c('0x52')]=_[_0x7f1c('0x53')](_0x498f32[_0x7f1c('0x52')],{'$or':_[_0x7f1c('0x41')](_0x480b1a,function(_0x5f44b8){if(_0x5f44b8[_0x7f1c('0x54')]!==_0x7f1c('0x55')){var _0x3f549a={};_0x3f549a[_0x5f44b8[_0x7f1c('0x40')]]={'$like':'%'+_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x51')]+'%'};return _0x3f549a;}})});}_0x498f32=_[_0x7f1c('0x53')]({},_0x498f32,_0x40dcfa['options']);var _0x2d8da4={'where':_0x498f32['where']};return db[_0x7f1c('0x42')]['count'](_0x2d8da4)[_0x7f1c('0x24')](function(_0x197435){_0x2cc17c[_0x7f1c('0x36')]=_0x197435;if(_0x40dcfa[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x498f32['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7f1c('0x57')](_0x498f32);})['then'](function(_0x430396){_0x2cc17c[_0x7f1c('0x58')]=_0x430396;return _0x2cc17c;})[_0x7f1c('0x24')](respondWithFilteredResult(_0x55af70,_0x498f32))['catch'](handleError(_0x55af70,null));};exports[_0x7f1c('0x59')]=function(_0x430bf6,_0x1ac7dc){var _0x13c2a5={'raw':!![],'where':{'id':_0x430bf6[_0x7f1c('0x5a')]['id']}},_0x40ad34={};_0x40ad34[_0x7f1c('0x46')]=_[_0x7f1c('0x48')](db['OpenchannelMessage'][_0x7f1c('0x43')]);_0x40ad34['query']=_[_0x7f1c('0x48')](_0x430bf6[_0x7f1c('0x47')]);_0x40ad34[_0x7f1c('0x49')]=_['intersection'](_0x40ad34[_0x7f1c('0x46')],_0x40ad34['query']);_0x13c2a5[_0x7f1c('0x4c')]=_[_0x7f1c('0x4a')](_0x40ad34[_0x7f1c('0x46')],qs[_0x7f1c('0x4b')](_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x4b')]));_0x13c2a5[_0x7f1c('0x4c')]=_0x13c2a5[_0x7f1c('0x4c')]['length']?_0x13c2a5[_0x7f1c('0x4c')]:_0x40ad34[_0x7f1c('0x46')];if(_0x430bf6[_0x7f1c('0x47')][_0x7f1c('0x56')]){_0x13c2a5[_0x7f1c('0x5b')]=[{'all':!![]}];}_0x13c2a5=_['merge']({},_0x13c2a5,_0x430bf6[_0x7f1c('0x5c')]);return db[_0x7f1c('0x42')][_0x7f1c('0x5d')](_0x13c2a5)['then'](handleEntityNotFound(_0x1ac7dc,null))[_0x7f1c('0x24')](respondWithResult(_0x1ac7dc,null))[_0x7f1c('0x2f')](handleError(_0x1ac7dc,null));};exports[_0x7f1c('0x5e')]=function(_0x589e93,_0x3de937){return db['OpenchannelMessage'][_0x7f1c('0x5e')](_0x589e93[_0x7f1c('0x5f')],{})[_0x7f1c('0x24')](respondWithResult(_0x3de937,0xc9))[_0x7f1c('0x2f')](handleError(_0x3de937,null));};exports[_0x7f1c('0x3d')]=function(_0x402315,_0x4a36bc){if(_0x402315[_0x7f1c('0x5f')]['id']){delete _0x402315['body']['id'];}return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x402315['params']['id']}})['then'](handleEntityNotFound(_0x4a36bc,null))[_0x7f1c('0x24')](saveUpdates(_0x402315[_0x7f1c('0x5f')],null))['then'](respondWithResult(_0x4a36bc,null))[_0x7f1c('0x2f')](handleError(_0x4a36bc,null));};exports[_0x7f1c('0x3e')]=function(_0x386ab8,_0x4f8420){return db[_0x7f1c('0x42')][_0x7f1c('0x5d')]({'where':{'id':_0x386ab8[_0x7f1c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4f8420,null))['then'](removeEntity(_0x4f8420,null))['catch'](handleError(_0x4f8420,null));};exports[_0x7f1c('0x60')]=function(_0x196748,_0x4b4cbb){return db[_0x7f1c('0x42')][_0x7f1c('0x60')]()[_0x7f1c('0x24')](respondWithResult(_0x4b4cbb,null))[_0x7f1c('0x2f')](handleError(_0x4b4cbb,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x7f1c('0x61')]=function(_0xfc0f28,_0x21cd7a,_0x425a8c){var _0x3ae378={'agent':{},'channel':'openchannel'};if(_0xfc0f28[_0x7f1c('0x5f')]['id']){delete _0xfc0f28[_0x7f1c('0x5f')]['id'];}_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x62')]=!![];_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x63')]=moment()['format'](_0x7f1c('0x64'));_0xfc0f28['body'][_0x7f1c('0x65')]=_0xfc0f28[_0x7f1c('0x5f')]['UserId']||_0xfc0f28[_0x7f1c('0x66')]['id'];_0x3ae378[_0x7f1c('0x67')]['id']=_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db[_0x7f1c('0x42')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x21cd7a,null))[_0x7f1c('0x24')](saveUpdates(_0xfc0f28['body'],null))[_0x7f1c('0x24')](function(_0xb6bf4a){if(_0xb6bf4a){_0x3ae378[_0x7f1c('0x2d')]=_0xb6bf4a[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0xb6bf4a[_0x7f1c('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x21cd7a,null))['then'](function(_0x2fc3c6){if(_0x2fc3c6){return _0x2fc3c6[_0x7f1c('0x3d')]({'UserId':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'read1stAt':_[_0x7f1c('0x6b')](_0x2fc3c6[_0x7f1c('0x6c')])?moment()[_0x7f1c('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x7f1c('0x24')](function(_0x5aba2c){if(_0x5aba2c){_0x3ae378[_0x7f1c('0x6e')]=_0x5aba2c[_0x7f1c('0x68')]({'plain':!![]});interaction_log['info'](_0x7f1c('0x6f'),_0xfc0f28[_0x7f1c('0x66')]['id'],_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')],_0xfc0f28['user'][_0x7f1c('0x70')],_0x3ae378[_0x7f1c('0x6e')]['id'],_0xfc0f28[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0xfc0f28[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise('AcceptMessage',_0x7f1c('0x72'),_0x3ae378);}return null;})['then'](function(_0x5b492b){var _0x2b8a57=_0x7f1c('0x73')+_0x5b492b[_0x7f1c('0x2d')][_0x7f1c('0x74')];return db[_0x7f1c('0x75')][_0x7f1c('0x47')](_0x2b8a57,{'type':db['Sequelize'][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})[_0x7f1c('0x24')](function(_0x146f92){return _0x146f92;});})[_0x7f1c('0x24')](function(_0x2bab6d){if(_0x2bab6d){_0x3ae378['message'][_0x7f1c('0x78')]=_0x2bab6d[0x0];if(!_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0xfc0f28[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id',_0x7f1c('0x40'),_0x7f1c('0x7a'),_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x4128c7){if(!_0x4128c7)return null;_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x67')]=_0x4128c7;return _0x3ae378;})['then'](function(_0x52fa68){if(_0x52fa68){if(_0xfc0f28[_0x7f1c('0x5f')]['manual']){_0x3ae378['message'][_0x7f1c('0x7d')]=util[_0x7f1c('0x6d')](_0x7f1c('0x7e'),_0xfc0f28[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378['message'][_0x7f1c('0x80')]=_0x3ae378[_0x7f1c('0x7f')];_0x3ae378[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x61');return respondWithRpcPromise(_0x7f1c('0x82'),_0x7f1c('0x82'),{'event':_0x7f1c('0x83'),'message':_0x3ae378['message']},client9002)[_0x7f1c('0x24')](function(){return _0x3ae378;});}return _0x3ae378;}return null;})[_0x7f1c('0x24')](respondWithResult(_0x21cd7a,null))[_0x7f1c('0x2f')](handleError(_0x21cd7a,null));};var interaction_log=require(_0x7f1c('0x14'))(_0x7f1c('0x84'));exports[_0x7f1c('0x3b')]=function(_0x5032e4,_0x3ebdc0,_0x140989){var _0x3003b6={'agent':{},'channel':'openchannel'};if(_0x5032e4['body']['id']){delete _0x5032e4[_0x7f1c('0x5f')]['id'];}_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')]||_0x5032e4[_0x7f1c('0x66')]['id'];_0x3003b6[_0x7f1c('0x67')]['id']=_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')];return db['OpenchannelMessage'][_0x7f1c('0x5d')]({'where':{'id':_0x5032e4[_0x7f1c('0x5a')]['id'],'UserId':null}})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x1c0ac2){if(_0x1c0ac2){_0x3003b6[_0x7f1c('0x2d')]=_0x1c0ac2[_0x7f1c('0x68')]({'plain':!![]});return db[_0x7f1c('0x69')][_0x7f1c('0x5d')]({'where':{'id':_0x1c0ac2['OpenchannelInteractionId']}});}return null;})[_0x7f1c('0x24')](handleEntityNotFound(_0x3ebdc0,null))[_0x7f1c('0x24')](function(_0x19c43b){if(_0x19c43b){_0x3003b6[_0x7f1c('0x6e')]=_0x19c43b[_0x7f1c('0x68')]({'plain':!![]});interaction_log[_0x7f1c('0x25')](_0x7f1c('0x85'),_0x5032e4[_0x7f1c('0x66')]['id'],_0x5032e4[_0x7f1c('0x66')]['name'],_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x70')],_0x3003b6[_0x7f1c('0x6e')]['id'],_0x5032e4[_0x7f1c('0x5f')]?JSON[_0x7f1c('0x2a')](_0x5032e4[_0x7f1c('0x5f')]):_0x7f1c('0x71'));return respondWithRpcPromise(_0x7f1c('0x86'),_0x7f1c('0x87'),_0x3003b6);}return null;})[_0x7f1c('0x24')](function(_0x33f1aa){var _0x53fb5f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x33f1aa['message'][_0x7f1c('0x74')];return db[_0x7f1c('0x75')]['query'](_0x53fb5f,{'type':db[_0x7f1c('0x88')][_0x7f1c('0x76')][_0x7f1c('0x77')],'raw':!![]})['then'](function(_0x4a869b){return _0x4a869b;});})[_0x7f1c('0x24')](function(_0x3a609c){if(_0x3a609c){_0x3003b6['message']['contact']=_0x3a609c[0x0];if(!_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')])return;return db[_0x7f1c('0x79')]['find']({'where':{'id':_0x5032e4[_0x7f1c('0x5f')][_0x7f1c('0x65')],'role':_0x7f1c('0x67')},'attributes':['id','name','fullname',_0x7f1c('0x7b'),_0x7f1c('0x7c')],'raw':!![]});}return null;})[_0x7f1c('0x24')](function(_0x33374f){if(!_0x33374f)return null;_0x3003b6['message'][_0x7f1c('0x67')]=_0x33374f;return _0x3003b6;})[_0x7f1c('0x24')](function(_0x2b78c8){if(_0x2b78c8){_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7d')]=util['format'](_0x7f1c('0x7e'),_0x5032e4[_0x7f1c('0x66')][_0x7f1c('0x40')]);_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x7f')]=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8['message']['motionChannel']=_0x3003b6[_0x7f1c('0x7f')];_0x2b78c8[_0x7f1c('0x2d')][_0x7f1c('0x81')]=_0x7f1c('0x3b');respondWithRpcPromise('EventManager',_0x7f1c('0x82'),{'event':_0x7f1c('0x89'),'message':_0x2b78c8[_0x7f1c('0x2d')]},client9002);return _0x3003b6;}return null;})['then'](respondWithResult(_0x3ebdc0,null))['catch'](handleError(_0x3ebdc0,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b54537b..432d21c 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 _0xa839=['hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit'];(function(_0x409b74,_0x31080b){var _0x18a6eb=function(_0x2b3af2){while(--_0x2b3af2){_0x409b74['push'](_0x409b74['shift']());}};_0x18a6eb(++_0x31080b);}(_0xa839,0x9a));var _0x9a83=function(_0x52659b,_0x312242){_0x52659b=_0x52659b-0x0;var _0x3c81f9=_0xa839[_0x52659b];return _0x3c81f9;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x9a83('0x0'))['db'][_0x9a83('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9a83('0x2')](0x0);var events={'afterCreate':_0x9a83('0x3'),'afterUpdate':_0x9a83('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43424e){return function(_0x35c465,_0x3f5834,_0x3b38b8){OpenchannelMessageEvents[_0x9a83('0x5')](_0x43424e+':'+_0x35c465['id'],_0x35c465);OpenchannelMessageEvents[_0x9a83('0x5')](_0x43424e,_0x35c465);_0x3b38b8(null);};}for(var e in events){if(events[_0x9a83('0x6')](e)){var event=events[e];OpenchannelMessage[_0x9a83('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xffc6=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x4fc6cc,_0x75064a){var _0xf6a592=function(_0x296507){while(--_0x296507){_0x4fc6cc['push'](_0x4fc6cc['shift']());}};_0xf6a592(++_0x75064a);}(_0xffc6,0x88));var _0x6ffc=function(_0xf858d,_0x5867e5){_0xf858d=_0xf858d-0x0;var _0x473f59=_0xffc6[_0xf858d];return _0x473f59;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6ffc('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6ffc('0x1')](0x0);var events={'afterCreate':_0x6ffc('0x2'),'afterUpdate':_0x6ffc('0x3'),'afterDestroy':_0x6ffc('0x4')};function emitEvent(_0x2ef012){return function(_0x5d42ab,_0xf50d97,_0x1b1aff){OpenchannelMessageEvents['emit'](_0x2ef012+':'+_0x5d42ab['id'],_0x5d42ab);OpenchannelMessageEvents[_0x6ffc('0x5')](_0x2ef012,_0x5d42ab);_0x1b1aff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x6ffc('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 28eb987..2eff737 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','direction','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci'];(function(_0x15dbbe,_0x10a1ca){var _0x3e9cf4=function(_0xfd6085){while(--_0xfd6085){_0x15dbbe['push'](_0x15dbbe['shift']());}};_0x3e9cf4(++_0x10a1ca);}(_0x8f4c,0x113));var _0xc8f4=function(_0x4c2e88,_0x5bfd5a){_0x4c2e88=_0x4c2e88-0x0;var _0x1f60a3=_0x8f4c[_0x4c2e88];return _0x1f60a3;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xc8f4('0xb'),'fields':[_0xc8f4('0xc')],'type':_0xc8f4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39ed63,_0x34f05f,_0x599de3){var _0x38c41b=_0x5208da[_0xc8f4('0xe')];var _0x2fba62=_0x39ed63[_0xc8f4('0xf')]({'plain':!![]});if(_0x2fba62['direction'][_0xc8f4('0x10')]()==='in'||_0x2fba62['direction'][_0xc8f4('0x10')]()===_0xc8f4('0x11')&&!_0x2fba62[_0xc8f4('0x12')]&&!_[_0xc8f4('0x13')](_0x2fba62[_0xc8f4('0x14')])){_0x38c41b['OpenchannelInteraction'][_0xc8f4('0x15')]({'where':{'id':_0x2fba62[_0xc8f4('0x16')]}})[_0xc8f4('0x17')](function(_0x14bc11){if(_0x14bc11){_0x14bc11[_0xc8f4('0x18')]({'lastMsgAt':_0x2fba62[_0xc8f4('0x19')],'lastMsgDirection':_0x2fba62['direction'][_0xc8f4('0x10')]()});}})[_0xc8f4('0x1a')](function(_0x1518a6){console[_0xc8f4('0x1b')](_0x1518a6);});}if(_0x2fba62[_0xc8f4('0x1c')]==='out'&&!_0x2fba62[_0xc8f4('0x12')]){var _0x4d2b77;_0x38c41b['CmContact'][_0xc8f4('0x1d')]()[_0xc8f4('0x17')](function(_0x108076){return _0x38c41b[_0xc8f4('0x1e')][_0xc8f4('0x1f')]({'where':{'id':_0x2fba62[_0xc8f4('0x20')]},'include':[{'model':_0x38c41b[_0xc8f4('0x21')],'as':_0xc8f4('0x22'),'where':{'id':_0x2fba62[_0xc8f4('0x16')]},'limit':0x1,'include':[{'model':_0x38c41b[_0xc8f4('0x23')],'as':_0xc8f4('0x24'),'attributes':_[_0xc8f4('0x25')](_0x108076)}]}]});})[_0xc8f4('0x17')](function(_0x5f3264){_0x4d2b77=_0x5f3264[_0xc8f4('0xf')]({'plain':!![]});if(_0x4d2b77&&_0x4d2b77[_0xc8f4('0x26')]){logger[_0xc8f4('0x27')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x2b'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x4d2b77['Interactions']&&_0x4d2b77[_0xc8f4('0x22')][_0xc8f4('0x2c')]){_0x2fba62[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x4d2b77['Interactions'][0x0],_0xc8f4('0x24'));_0x2fba62['Contact']=_0x4d2b77[_0xc8f4('0x22')][0x0]['Contact'];}var _0x34f05f={'method':_0xc8f4('0x2f'),'uri':encodeURI(_0x4d2b77['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34f05f[_0xc8f4('0x30')]){case _0xc8f4('0x31'):_0x34f05f['qs']=_0x2fba62;break;case _0xc8f4('0x2f'):_0x34f05f[_0xc8f4('0xc')]=_0x2fba62;break;}return rp(_0x34f05f)['then'](function(_0x3db490){logger[_0xc8f4('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x32'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x3db490[_0xc8f4('0xc')][_0xc8f4('0x33')]&&_0x3db490['body'][_0xc8f4('0x33')]!=_0x2fba62[_0xc8f4('0x2d')][_0xc8f4('0x33')]){return _0x38c41b['OpenchannelInteraction'][_0xc8f4('0x18')]({'threadId':_0x3db490[_0xc8f4('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x2fba62['Interaction']['id']}});}else{return;}})['then'](function(){return _0x39ed63[_0xc8f4('0x18')]({'read':!![]});})[_0xc8f4('0x1a')](function(_0x2e9a2a){logger[_0xc8f4('0x1b')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x34')](_0x2e9a2a,{'showHidden':![],'depth':null}));_0x599de3();});}else{_0x599de3();}})[_0xc8f4('0x35')](function(){_0x599de3();});}else{_0x599de3();}}},'charset':'utf8mb4','collate':_0xc8f4('0x36')});}; \ No newline at end of file +var _0x7916=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','method','GET','POST','body','threadId','error','afterCreate','inspect','finally'];(function(_0x1eee9d,_0x300701){var _0xa9267b=function(_0x57700f){while(--_0x57700f){_0x1eee9d['push'](_0x1eee9d['shift']());}};_0xa9267b(++_0x300701);}(_0x7916,0x128));var _0x6791=function(_0x1f858a,_0xff7047){_0x1f858a=_0x1f858a-0x0;var _0x3e3b18=_0x7916[_0x1f858a];return _0x3e3b18;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6791('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a9915,_0x198a64,_0x579950){var _0xbc3bc6=_0x3ca328[_0x6791('0xa')];var _0x2aeae9=_0x2a9915['get']({'plain':!![]});if(_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()==='in'||_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()===_0x6791('0xd')&&!_0x2aeae9[_0x6791('0xe')]&&!_[_0x6791('0xf')](_0x2aeae9[_0x6791('0x10')])){_0xbc3bc6[_0x6791('0x11')][_0x6791('0x12')]({'where':{'id':_0x2aeae9[_0x6791('0x13')]}})['then'](function(_0x4b1719){if(_0x4b1719){_0x4b1719[_0x6791('0x14')]({'lastMsgAt':_0x2aeae9['createdAt'],'lastMsgDirection':_0x2aeae9[_0x6791('0xb')]['toLowerCase']()});}})[_0x6791('0x15')](function(_0x163898){console['error'](_0x163898);});}if(_0x2aeae9[_0x6791('0xb')]==='out'&&!_0x2aeae9[_0x6791('0xe')]){var _0x150d1f;_0xbc3bc6['CmContact'][_0x6791('0x16')]()[_0x6791('0x17')](function(_0x5bec14){return _0xbc3bc6[_0x6791('0x18')]['find']({'where':{'id':_0x2aeae9[_0x6791('0x19')]},'include':[{'model':_0xbc3bc6[_0x6791('0x11')],'as':_0x6791('0x1a'),'where':{'id':_0x2aeae9[_0x6791('0x13')]},'limit':0x1,'include':[{'model':_0xbc3bc6[_0x6791('0x1b')],'as':_0x6791('0x1c'),'attributes':_[_0x6791('0x1d')](_0x5bec14)}]}]});})['then'](function(_0x4a2922){_0x150d1f=_0x4a2922[_0x6791('0x1e')]({'plain':!![]});if(_0x150d1f&&_0x150d1f['replyUri']){logger[_0x6791('0x1f')](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')](_0x6791('0x22'),_0x2aeae9['id'],_0x150d1f[_0x6791('0x23')]));if(_0x150d1f[_0x6791('0x1a')]&&_0x150d1f['Interactions'][_0x6791('0x24')]){_0x2aeae9[_0x6791('0x25')]=_['omit'](_0x150d1f['Interactions'][0x0],'Contact');_0x2aeae9[_0x6791('0x1c')]=_0x150d1f['Interactions'][0x0][_0x6791('0x1c')];}var _0x198a64={'method':'POST','uri':encodeURI(_0x150d1f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x198a64[_0x6791('0x26')]){case _0x6791('0x27'):_0x198a64['qs']=_0x2aeae9;break;case _0x6791('0x28'):_0x198a64['body']=_0x2aeae9;break;}return rp(_0x198a64)[_0x6791('0x17')](function(_0x30cc17){logger['info'](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2aeae9['id'],_0x150d1f['replyUri']));if(_0x30cc17[_0x6791('0x29')]['threadId']&&_0x30cc17[_0x6791('0x29')][_0x6791('0x2a')]!=_0x2aeae9['Interaction'][_0x6791('0x2a')]){return _0xbc3bc6[_0x6791('0x11')][_0x6791('0x14')]({'threadId':_0x30cc17[_0x6791('0x29')]['threadId']},{'logging':!![],'where':{'id':_0x2aeae9['Interaction']['id']}});}else{return;}})[_0x6791('0x17')](function(){return _0x2a9915['update']({'read':!![]});})[_0x6791('0x15')](function(_0x338d09){logger[_0x6791('0x2b')](_0x6791('0x20'),_0x6791('0x2c'),util[_0x6791('0x2d')](_0x338d09,{'showHidden':![],'depth':null}));_0x579950();});}else{_0x579950();}})[_0x6791('0x2e')](function(){_0x579950();});}else{_0x579950();}}},'charset':_0x6791('0x2f'),'collate':_0x6791('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 5d2ee8a..0c11b01 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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21a69e,_0x2cc6f6){var _0x108b13=function(_0x5b96a9){while(--_0x5b96a9){_0x21a69e['push'](_0x21a69e['shift']());}};_0x108b13(++_0x2cc6f6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x599d3f,_0x157b5c){_0x599d3f=_0x599d3f-0x0;var _0x39648a=_0x5f2f[_0x599d3f];return _0x39648a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x236d0d,_0x285c99){var _0x443710=function(_0x56134a){while(--_0x56134a){_0x236d0d['push'](_0x236d0d['shift']());}};_0x443710(++_0x285c99);}(_0x1261,0x144));var _0x1126=function(_0x188bfe,_0x2517cc){_0x188bfe=_0x188bfe-0x0;var _0x1a9efa=_0x1261[_0x188bfe];return _0x1a9efa;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b15fe1a..168304d 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 _0x6fc4=['length','openchannelMessage:','./openchannelMessage.events','save','removeListener','register'];(function(_0x443246,_0x199405){var _0xf91625=function(_0x6c01ff){while(--_0x6c01ff){_0x443246['push'](_0x443246['shift']());}};_0xf91625(++_0x199405);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x2dd752,_0x59b4fc){_0x2dd752=_0x2dd752-0x0;var _0x297823=_0x6fc4[_0x2dd752];return _0x297823;};'use strict';var OpenchannelMessageEvents=require(_0x46fc('0x0'));var events=[_0x46fc('0x1'),'remove','update'];function createListener(_0xab7c91,_0x5caf97){return function(_0x47e69d){_0x5caf97['emit'](_0xab7c91,_0x47e69d);};}function removeListener(_0x34e479,_0x27d5dd){return function(){OpenchannelMessageEvents[_0x46fc('0x2')](_0x34e479,_0x27d5dd);};}exports[_0x46fc('0x3')]=function(_0x3f4e43){for(var _0x7656d9=0x0,_0x3c4f75=events[_0x46fc('0x4')];_0x7656d9<_0x3c4f75;_0x7656d9++){var _0x5ca981=events[_0x7656d9];var _0x4a7762=createListener(_0x46fc('0x5')+_0x5ca981,_0x3f4e43);OpenchannelMessageEvents['on'](_0x5ca981,_0x4a7762);}}; \ No newline at end of file +var _0x4df9=['save','emit','removeListener','register','openchannelMessage:'];(function(_0x4e3f6d,_0x1cfa54){var _0x5e6a4e=function(_0x3f5a55){while(--_0x3f5a55){_0x4e3f6d['push'](_0x4e3f6d['shift']());}};_0x5e6a4e(++_0x1cfa54);}(_0x4df9,0x19a));var _0x94df=function(_0x2b4d29,_0x46315d){_0x2b4d29=_0x2b4d29-0x0;var _0x2df09e=_0x4df9[_0x2b4d29];return _0x2df09e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x94df('0x0'),'remove','update'];function createListener(_0x83b699,_0x5ef440){return function(_0x33e81e){_0x5ef440[_0x94df('0x1')](_0x83b699,_0x33e81e);};}function removeListener(_0x412711,_0x1a7447){return function(){OpenchannelMessageEvents[_0x94df('0x2')](_0x412711,_0x1a7447);};}exports[_0x94df('0x3')]=function(_0x3a7718){for(var _0x5bd414=0x0,_0x47a5e3=events['length'];_0x5bd414<_0x47a5e3;_0x5bd414++){var _0x45a573=events[_0x5bd414];var _0x5e7d79=createListener(_0x94df('0x4')+_0x45a573,_0x3a7718);OpenchannelMessageEvents['on'](_0x45a573,_0x5e7d79);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 00eb172..cb063ee 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 _0x0784=['/describe','describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','addTeams','put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x223734,_0x15c460){var _0x2705e4=function(_0x623605){while(--_0x623605){_0x223734['push'](_0x223734['shift']());}};_0x2705e4(++_0x15c460);}(_0x0784,0x10b));var _0x4078=function(_0x208954,_0x43f876){_0x208954=_0x208954-0x0;var _0x2c0173=_0x0784[_0x208954];return _0x2c0173;};'use strict';var multer=require(_0x4078('0x0'));var util=require('util');var path=require(_0x4078('0x1'));var timeout=require(_0x4078('0x2'));var express=require(_0x4078('0x3'));var router=express[_0x4078('0x4')]();var fs_extra=require(_0x4078('0x5'));var auth=require(_0x4078('0x6'));var interaction=require(_0x4078('0x7'));var config=require(_0x4078('0x8'));var controller=require(_0x4078('0x9'));router[_0x4078('0xa')]('/',auth[_0x4078('0xb')](),controller[_0x4078('0xc')]);router[_0x4078('0xa')](_0x4078('0xd'),auth['isAuthenticated'](),controller[_0x4078('0xe')]);router['get'](_0x4078('0xf'),auth[_0x4078('0xb')](),controller['show']);router['get'](_0x4078('0x10'),auth[_0x4078('0xb')](),controller['getMembers']);router[_0x4078('0xa')](_0x4078('0x11'),auth[_0x4078('0xb')](),controller['getTeams']);router[_0x4078('0xa')](_0x4078('0x12'),auth[_0x4078('0xb')](),controller[_0x4078('0x13')]);router[_0x4078('0x14')]('/',auth[_0x4078('0xb')](),controller['create']);router[_0x4078('0x14')](_0x4078('0x11'),auth['isAuthenticated'](),controller[_0x4078('0x15')]);router['post'](_0x4078('0x12'),auth[_0x4078('0xb')](),controller['addAgents']);router[_0x4078('0x16')](_0x4078('0xf'),auth['isAuthenticated'](),controller[_0x4078('0x17')]);router[_0x4078('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x4078('0x19')]);router[_0x4078('0x18')](_0x4078('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4078('0x18')](_0x4078('0x12'),auth['isAuthenticated'](),controller[_0x4078('0x1a')]);module[_0x4078('0x1b')]=router; \ No newline at end of file +var _0xf014=['/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id/members','getMembers'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf014,0xd5));var _0x4f01=function(_0x480eff,_0x541555){_0x480eff=_0x480eff-0x0;var _0x5c8aeb=_0xf014[_0x480eff];return _0x5c8aeb;};'use strict';var multer=require('multer');var util=require(_0x4f01('0x0'));var path=require(_0x4f01('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f01('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f01('0x3'));var interaction=require(_0x4f01('0x4'));var config=require(_0x4f01('0x5'));var controller=require(_0x4f01('0x6'));router[_0x4f01('0x7')]('/',auth[_0x4f01('0x8')](),controller['index']);router[_0x4f01('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4f01('0x9')]);router[_0x4f01('0x7')]('/:id',auth[_0x4f01('0x8')](),controller['show']);router[_0x4f01('0x7')](_0x4f01('0xa'),auth[_0x4f01('0x8')](),controller[_0x4f01('0xb')]);router[_0x4f01('0x7')]('/:id/teams',auth[_0x4f01('0x8')](),controller['getTeams']);router[_0x4f01('0x7')](_0x4f01('0xc'),auth['isAuthenticated'](),controller[_0x4f01('0xd')]);router[_0x4f01('0xe')]('/',auth[_0x4f01('0x8')](),controller[_0x4f01('0xf')]);router['post'](_0x4f01('0x10'),auth[_0x4f01('0x8')](),controller['addTeams']);router['post'](_0x4f01('0xc'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x11')]);router[_0x4f01('0x12')](_0x4f01('0x13'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x14')]);router[_0x4f01('0x15')](_0x4f01('0x13'),auth[_0x4f01('0x8')](),controller[_0x4f01('0x16')]);router[_0x4f01('0x15')](_0x4f01('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4f01('0x15')]('/:id/users',auth[_0x4f01('0x8')](),controller[_0x4f01('0x17')]);module[_0x4f01('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 38f4dbd..c1619b2 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 _0xc536=['name','INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3cb164,_0x2d0b41){var _0x419efd=function(_0x4b9bc9){while(--_0x4b9bc9){_0x3cb164['push'](_0x3cb164['shift']());}};_0x419efd(++_0x2d0b41);}(_0xc536,0xcf));var _0x6c53=function(_0xc76d58,_0x367ff9){_0xc76d58=_0xc76d58-0x0;var _0x482224=_0xc536[_0xc76d58];return _0x482224;};'use strict';var Sequelize=require(_0x6c53('0x0'));module[_0x6c53('0x1')]={'name':{'type':Sequelize[_0x6c53('0x2')],'unique':_0x6c53('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6c53('0x2')]},'timeout':{'type':Sequelize[_0x6c53('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6c53('0x5'),'beepall',_0x6c53('0x6'))}}; \ No newline at end of file +var _0xbdc8=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x16d6a2,_0x266958){var _0x681283=function(_0xb758fd){while(--_0xb758fd){_0x16d6a2['push'](_0x16d6a2['shift']());}};_0x681283(++_0x266958);}(_0xbdc8,0xc1));var _0x8bdc=function(_0x1cbdef,_0x5ac27a){_0x1cbdef=_0x1cbdef-0x0;var _0x3bb22e=_0xbdc8[_0x1cbdef];return _0x3bb22e;};'use strict';var Sequelize=require(_0x8bdc('0x0'));module[_0x8bdc('0x1')]={'name':{'type':Sequelize[_0x8bdc('0x2')],'unique':_0x8bdc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8bdc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8bdc('0x4')]('rrmemory',_0x8bdc('0x5'),_0x8bdc('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 74104dd..5a90c0a 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 _0x074e=['transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','json','offset','undefined','count','limit','status','set','reject','save','update','then','destroy','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','OpenchannelQueue','findAll','catch','show','params','keys','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x074e,0x13b));var _0xe074=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x074e[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require(_0xe074('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe074('0x1'));var rp=require(_0xe074('0x2'));var moment=require(_0xe074('0x3'));var BPromise=require(_0xe074('0x4'));var Mustache=require('mustache');var util=require(_0xe074('0x5'));var path=require('path');var sox=require(_0xe074('0x6'));var csv=require(_0xe074('0x7'));var ejs=require(_0xe074('0x8'));var fs=require('fs');var fs_extra=require(_0xe074('0x9'));var _=require(_0xe074('0xa'));var squel=require(_0xe074('0xb'));var crypto=require(_0xe074('0xc'));var jsforce=require(_0xe074('0xd'));var deskjs=require(_0xe074('0xe'));var toCsv=require(_0xe074('0x7'));var querystring=require(_0xe074('0xf'));var Papa=require('papaparse');var Redis=require(_0xe074('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe074('0x11'));var as=require(_0xe074('0x12'));var hardwareService=require(_0xe074('0x13'));var logger=require(_0xe074('0x14'))(_0xe074('0x15'));var utils=require(_0xe074('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe074('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe074('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xe074('0x19'))(new Redis(config[_0xe074('0x18')]));require(_0xe074('0x1a'))[_0xe074('0x1b')](socket);function respondWithStatusCode(_0x8ad43d,_0x286bf8){_0x286bf8=_0x286bf8||0xcc;return function(_0x87c111){if(_0x87c111){return _0x8ad43d[_0xe074('0x1c')](_0x286bf8);}return _0x8ad43d['status'](_0x286bf8)[_0xe074('0x1d')]();};}function respondWithResult(_0x401941,_0x57a013){_0x57a013=_0x57a013||0xc8;return function(_0x3f04c8){if(_0x3f04c8){return _0x401941['status'](_0x57a013)[_0xe074('0x1e')](_0x3f04c8);}};}function respondWithFilteredResult(_0x4f98b1,_0x329aa3){return function(_0x18080d){if(_0x18080d){var _0x4081b4=typeof _0x329aa3[_0xe074('0x1f')]==='undefined'&&typeof _0x329aa3['limit']===_0xe074('0x20');var _0x1054f8=_0x18080d[_0xe074('0x21')];var _0x2f7d06=_0x4081b4?0x0:_0x329aa3[_0xe074('0x1f')];var _0x31065c=_0x4081b4?_0x18080d['count']:_0x329aa3['offset']+_0x329aa3[_0xe074('0x22')];var _0x110f01;if(_0x31065c>=_0x1054f8){_0x31065c=_0x1054f8;_0x110f01=0xc8;}else{_0x110f01=0xce;}_0x4f98b1[_0xe074('0x23')](_0x110f01);return _0x4f98b1[_0xe074('0x24')]('Content-Range',_0x2f7d06+'-'+_0x31065c+'/'+_0x1054f8)[_0xe074('0x1e')](_0x18080d);}return null;};}function patchUpdates(_0x4f92d0){return function(_0x1a1d46){try{jsonpatch['apply'](_0x1a1d46,_0x4f92d0,!![]);}catch(_0x3933ec){return BPromise[_0xe074('0x25')](_0x3933ec);}return _0x1a1d46[_0xe074('0x26')]();};}function saveUpdates(_0xcf36f4,_0x1b74ff){return function(_0x25708a){if(_0x25708a){return _0x25708a[_0xe074('0x27')](_0xcf36f4)[_0xe074('0x28')](function(_0x38208b){return _0x38208b;});}return null;};}function removeEntity(_0x615373,_0x212f6a){return function(_0x2b3580){if(_0x2b3580){return _0x2b3580[_0xe074('0x29')]()[_0xe074('0x28')](function(){var _0xef74b=_0x2b3580['get']({'plain':!![]});var _0x29cf5f='OpenchannelQueues';return db[_0xe074('0x2a')]['destroy']({'where':{'type':_0x29cf5f,'resourceId':_0xef74b['id']}})[_0xe074('0x28')](function(){return _0x2b3580;});})[_0xe074('0x28')](function(){_0x615373[_0xe074('0x23')](0xcc)[_0xe074('0x1d')]();});}};}function handleEntityNotFound(_0x5bc0e6,_0x1353ef){return function(_0x3c942e){if(!_0x3c942e){_0x5bc0e6[_0xe074('0x1c')](0x194);}return _0x3c942e;};}function handleError(_0x11bf1f,_0x2be2cf){_0x2be2cf=_0x2be2cf||0x1f4;return function(_0x421073){logger[_0xe074('0x2b')](_0x421073['stack']);if(_0x421073[_0xe074('0x2c')]){delete _0x421073[_0xe074('0x2c')];}_0x11bf1f['status'](_0x2be2cf)['send'](_0x421073);};}exports[_0xe074('0x2d')]=function(_0x313dd0,_0x1cf392){var _0x1398da={},_0xea1aaa={},_0x154d9c={'count':0x0,'rows':[]};var _0x2c9fe5=_[_0xe074('0x2e')](db['OpenchannelQueue'][_0xe074('0x2f')],function(_0x5aa972){return{'name':_0x5aa972[_0xe074('0x30')],'type':_0x5aa972[_0xe074('0x31')][_0xe074('0x32')]};});_0xea1aaa['model']=_['map'](_0x2c9fe5,_0xe074('0x2c'));_0xea1aaa[_0xe074('0x33')]=_['keys'](_0x313dd0[_0xe074('0x33')]);_0xea1aaa[_0xe074('0x34')]=_[_0xe074('0x35')](_0xea1aaa[_0xe074('0x36')],_0xea1aaa['query']);_0x1398da[_0xe074('0x37')]=_['intersection'](_0xea1aaa[_0xe074('0x36')],qs[_0xe074('0x38')](_0x313dd0[_0xe074('0x33')][_0xe074('0x38')]));_0x1398da[_0xe074('0x37')]=_0x1398da[_0xe074('0x37')]['length']?_0x1398da[_0xe074('0x37')]:_0xea1aaa[_0xe074('0x36')];if(!_0x313dd0[_0xe074('0x33')][_0xe074('0x39')](_0xe074('0x3a'))){_0x1398da[_0xe074('0x22')]=qs['limit'](_0x313dd0['query']['limit']);_0x1398da['offset']=qs['offset'](_0x313dd0[_0xe074('0x33')]['offset']);}_0x1398da[_0xe074('0x3b')]=qs[_0xe074('0x3c')](_0x313dd0[_0xe074('0x33')]['sort']);_0x1398da['where']=qs[_0xe074('0x34')](_['pick'](_0x313dd0['query'],_0xea1aaa['filters']),_0x2c9fe5);if(_0x313dd0[_0xe074('0x33')][_0xe074('0x3d')]){_0x1398da[_0xe074('0x3e')]=_[_0xe074('0x3f')](_0x1398da[_0xe074('0x3e')],{'$or':_['map'](_0x2c9fe5,function(_0xc05e9e){if(_0xc05e9e[_0xe074('0x31')]!==_0xe074('0x40')){var _0x2fc9f9={};_0x2fc9f9[_0xc05e9e[_0xe074('0x2c')]]={'$like':'%'+_0x313dd0['query'][_0xe074('0x3d')]+'%'};return _0x2fc9f9;}})});}_0x1398da=_[_0xe074('0x3f')]({},_0x1398da,_0x313dd0[_0xe074('0x41')]);var _0x5de993={'where':_0x1398da[_0xe074('0x3e')]};return db['OpenchannelQueue'][_0xe074('0x21')](_0x5de993)['then'](function(_0x1f081f){_0x154d9c['count']=_0x1f081f;if(_0x313dd0[_0xe074('0x33')][_0xe074('0x42')]){_0x1398da['include']=[{'all':!![]}];}return db[_0xe074('0x43')][_0xe074('0x44')](_0x1398da);})[_0xe074('0x28')](function(_0x5675f0){_0x154d9c['rows']=_0x5675f0;return _0x154d9c;})['then'](respondWithFilteredResult(_0x1cf392,_0x1398da))[_0xe074('0x45')](handleError(_0x1cf392,null));};exports[_0xe074('0x46')]=function(_0x56ae9d,_0x2e2ed1){var _0x4deb79={'raw':!![],'where':{'id':_0x56ae9d[_0xe074('0x47')]['id']}},_0x26b854={};_0x26b854['model']=_[_0xe074('0x48')](db[_0xe074('0x43')][_0xe074('0x2f')]);_0x26b854[_0xe074('0x33')]=_[_0xe074('0x48')](_0x56ae9d[_0xe074('0x33')]);_0x26b854[_0xe074('0x34')]=_['intersection'](_0x26b854[_0xe074('0x36')],_0x26b854[_0xe074('0x33')]);_0x4deb79[_0xe074('0x37')]=_[_0xe074('0x35')](_0x26b854[_0xe074('0x36')],qs[_0xe074('0x38')](_0x56ae9d[_0xe074('0x33')][_0xe074('0x38')]));_0x4deb79[_0xe074('0x37')]=_0x4deb79[_0xe074('0x37')][_0xe074('0x49')]?_0x4deb79[_0xe074('0x37')]:_0x26b854[_0xe074('0x36')];if(_0x56ae9d[_0xe074('0x33')][_0xe074('0x42')]){_0x4deb79[_0xe074('0x4a')]=[{'all':!![]}];}_0x4deb79=_['merge']({},_0x4deb79,_0x56ae9d['options']);return db[_0xe074('0x43')][_0xe074('0x4b')](_0x4deb79)[_0xe074('0x28')](handleEntityNotFound(_0x2e2ed1,null))[_0xe074('0x28')](respondWithResult(_0x2e2ed1,null))[_0xe074('0x45')](handleError(_0x2e2ed1,null));};exports['create']=function(_0x189302,_0x520229){return db['OpenchannelQueue'][_0xe074('0x4c')](_0x189302[_0xe074('0x4d')],{})['then'](function(_0x5d203f){var _0x3d4781=_0x189302['user'][_0xe074('0x4e')]({'plain':!![]});if(!_0x3d4781)throw new Error(_0xe074('0x4f'));if(_0x3d4781['role']==='user'){var _0x5e4e4d=_0x5d203f['get']({'plain':!![]});var _0x4f79f1=_0xe074('0x50');return db[_0xe074('0x51')][_0xe074('0x4b')]({'where':{'name':_0x4f79f1,'userProfileId':_0x3d4781[_0xe074('0x52')]},'raw':!![]})[_0xe074('0x28')](function(_0xfd2349){if(_0xfd2349&&_0xfd2349['autoAssociation']===0x0){return db[_0xe074('0x2a')][_0xe074('0x4c')]({'name':_0x5e4e4d['name'],'resourceId':_0x5e4e4d['id'],'type':_0xfd2349[_0xe074('0x2c')],'sectionId':_0xfd2349['id']},{})[_0xe074('0x28')](function(){return _0x5d203f;});}else{return _0x5d203f;}})[_0xe074('0x45')](function(_0x2abdc0){logger[_0xe074('0x2b')](_0xe074('0x53'),_0x2abdc0);throw _0x2abdc0;});}return _0x5d203f;})[_0xe074('0x28')](respondWithResult(_0x520229,0xc9))['catch'](handleError(_0x520229,null));};exports[_0xe074('0x27')]=function(_0x37538f,_0x3ec799){if(_0x37538f[_0xe074('0x4d')]['id']){delete _0x37538f[_0xe074('0x4d')]['id'];}return db[_0xe074('0x43')][_0xe074('0x4b')]({'where':{'id':_0x37538f[_0xe074('0x47')]['id']}})[_0xe074('0x28')](handleEntityNotFound(_0x3ec799,null))[_0xe074('0x28')](saveUpdates(_0x37538f[_0xe074('0x4d')],null))[_0xe074('0x28')](respondWithResult(_0x3ec799,null))[_0xe074('0x45')](handleError(_0x3ec799,null));};exports[_0xe074('0x29')]=function(_0x40ca30,_0x378acf){return db[_0xe074('0x43')]['find']({'where':{'id':_0x40ca30[_0xe074('0x47')]['id']}})['then'](handleEntityNotFound(_0x378acf,null))[_0xe074('0x28')](removeEntity(_0x378acf,null))['catch'](handleError(_0x378acf,null));};exports[_0xe074('0x54')]=function(_0x42798f,_0x318376){return db[_0xe074('0x43')][_0xe074('0x54')]()[_0xe074('0x28')](respondWithResult(_0x318376,null))[_0xe074('0x45')](handleError(_0x318376,null));};exports['getMembers']=function(_0x35dbd9,_0x4d7367,_0x231595){var _0x2e3332={'raw':!![],'where':{}},_0x3d5f90={},_0x1e0030;return db[_0xe074('0x43')][_0xe074('0x55')]({'where':{'id':_0x35dbd9[_0xe074('0x47')]['id']}})[_0xe074('0x28')](handleEntityNotFound(_0x4d7367,null))[_0xe074('0x28')](function(_0x22c2d5){if(_0x22c2d5){_0x1e0030=_0x22c2d5[_0xe074('0x4e')]({'plain':!![]});_0x3d5f90['model']=_[_0xe074('0x48')](db['UserOpenchannelQueue'][_0xe074('0x2f')]);_0x3d5f90['query']=_[_0xe074('0x48')](_0x35dbd9[_0xe074('0x33')]);_0x3d5f90[_0xe074('0x34')]=_['intersection'](_0x3d5f90[_0xe074('0x36')],_0x3d5f90[_0xe074('0x33')]);_0x2e3332[_0xe074('0x37')]=_[_0xe074('0x35')](_0x3d5f90[_0xe074('0x36')],qs['fields'](_0x35dbd9[_0xe074('0x33')][_0xe074('0x38')]));_0x2e3332[_0xe074('0x37')]=_0x2e3332[_0xe074('0x37')][_0xe074('0x49')]?_0x2e3332[_0xe074('0x37')]:_0x3d5f90[_0xe074('0x36')];if(!_0x35dbd9[_0xe074('0x33')]['hasOwnProperty'](_0xe074('0x3a'))){_0x2e3332[_0xe074('0x22')]=qs[_0xe074('0x22')](_0x35dbd9[_0xe074('0x33')]['limit']);_0x2e3332[_0xe074('0x1f')]=qs[_0xe074('0x1f')](_0x35dbd9[_0xe074('0x33')][_0xe074('0x1f')]);}_0x2e3332[_0xe074('0x3b')]=qs[_0xe074('0x3c')](_0x35dbd9[_0xe074('0x33')][_0xe074('0x3c')]);_0x2e3332[_0xe074('0x3e')]=qs[_0xe074('0x34')](_['pick'](_0x35dbd9[_0xe074('0x33')],_0x3d5f90[_0xe074('0x34')]));_0x2e3332[_0xe074('0x3e')]['OpenchannelQueueId']=_0x22c2d5['id'];if(_0x35dbd9[_0xe074('0x33')][_0xe074('0x3d')]){_0x2e3332[_0xe074('0x3e')]=_[_0xe074('0x3f')](_0x2e3332[_0xe074('0x3e')],{'$or':_[_0xe074('0x2e')](_0x2e3332[_0xe074('0x37')],function(_0x2e6544){var _0x13db34={};_0x13db34[_0x2e6544]={'$like':'%'+_0x35dbd9[_0xe074('0x33')][_0xe074('0x3d')]+'%'};return _0x13db34;})});}_0x2e3332=_[_0xe074('0x3f')]({},_0x2e3332,_0x35dbd9['options']);return db[_0xe074('0x56')]['findAll'](_0x2e3332);}})[_0xe074('0x28')](function(_0x35f0c7){if(_0x35f0c7){return db[_0xe074('0x57')][_0xe074('0x58')]({'where':{'id':_['map'](_0x35f0c7,_0xe074('0x59')),'role':'agent'},'attributes':['id',_0xe074('0x2c'),_0xe074('0x5a'),_0xe074('0x5b'),_0xe074('0x5c')]});}})[_0xe074('0x28')](function(_0x3c8ca1){if(_0x3c8ca1){return{'count':_0x3c8ca1[_0xe074('0x21')],'rows':_[_0xe074('0x2e')](_0x3c8ca1[_0xe074('0x5d')],function(_0x77a006){return{'membername':_0x77a006[_0xe074('0x2c')],'UserId':_0x77a006['id'],'queue_name':_0x1e0030['name'],'OpenchannelQueueId':_0x1e0030['id'],'interface':util[_0xe074('0x5e')](_0xe074('0x5f'),'SIP',_0x77a006[_0xe074('0x2c')]),'penalty':0x0,'paused':_0x77a006[_0xe074('0x5a')],'createdAt':_0x77a006[_0xe074('0x5c')],'updatedAt':_0x77a006[_0xe074('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe074('0x28')](respondWithFilteredResult(_0x4d7367,_0x2e3332))['catch'](handleError(_0x4d7367,null));};exports['getTeams']=function(_0x54b07b,_0x2f2778,_0x10f2a0){var _0x160542={};var _0x4f035f={};var _0x27962e;var _0x3cc6da;return db['OpenchannelQueue'][_0xe074('0x55')]({'where':{'id':_0x54b07b[_0xe074('0x47')]['id']}})[_0xe074('0x28')](handleEntityNotFound(_0x2f2778,null))[_0xe074('0x28')](function(_0x22edc1){if(_0x22edc1){_0x27962e=_0x22edc1;_0x4f035f[_0xe074('0x36')]=_[_0xe074('0x48')](db[_0xe074('0x60')][_0xe074('0x2f')]);_0x4f035f[_0xe074('0x33')]=_[_0xe074('0x48')](_0x54b07b[_0xe074('0x33')]);_0x4f035f[_0xe074('0x34')]=_[_0xe074('0x35')](_0x4f035f['model'],_0x4f035f[_0xe074('0x33')]);_0x160542['attributes']=_[_0xe074('0x35')](_0x4f035f[_0xe074('0x36')],qs[_0xe074('0x38')](_0x54b07b[_0xe074('0x33')][_0xe074('0x38')]));_0x160542[_0xe074('0x37')]=_0x160542['attributes'][_0xe074('0x49')]?_0x160542['attributes']:_0x4f035f['model'];_0x160542['order']=qs[_0xe074('0x3c')](_0x54b07b[_0xe074('0x33')][_0xe074('0x3c')]);_0x160542[_0xe074('0x3e')]=qs[_0xe074('0x34')](_['pick'](_0x54b07b[_0xe074('0x33')],_0x4f035f[_0xe074('0x34')]));if(_0x54b07b[_0xe074('0x33')][_0xe074('0x3d')]){_0x160542['where']=_[_0xe074('0x3f')](_0x160542[_0xe074('0x3e')],{'$or':_['map'](_0x160542[_0xe074('0x37')],function(_0x1fa1e5){var _0x4cbfb7={};_0x4cbfb7[_0x1fa1e5]={'$like':'%'+_0x54b07b[_0xe074('0x33')][_0xe074('0x3d')]+'%'};return _0x4cbfb7;})});}_0x160542=_[_0xe074('0x3f')]({},_0x160542,_0x54b07b[_0xe074('0x41')]);return _0x27962e[_0xe074('0x61')](_0x160542);}})[_0xe074('0x28')](function(_0x27fdba){if(_0x27fdba){_0x3cc6da=_0x27fdba[_0xe074('0x49')];if(!_0x54b07b[_0xe074('0x33')][_0xe074('0x39')]('nolimit')){_0x160542[_0xe074('0x22')]=qs[_0xe074('0x22')](_0x54b07b[_0xe074('0x33')]['limit']);_0x160542[_0xe074('0x1f')]=qs['offset'](_0x54b07b[_0xe074('0x33')][_0xe074('0x1f')]);}return _0x27962e[_0xe074('0x61')](_0x160542);}})[_0xe074('0x28')](function(_0x327a1a){if(_0x327a1a){return _0x327a1a?{'count':_0x3cc6da,'rows':_0x327a1a}:null;}})['then'](respondWithResult(_0x2f2778,null))[_0xe074('0x45')](handleError(_0x2f2778,null));};exports[_0xe074('0x62')]=function(_0x45e6ba,_0x35e813,_0x167a89){var _0x15ca16=_0x45e6ba[_0xe074('0x4d')]['ids'];return db[_0xe074('0x60')][_0xe074('0x44')]({'where':{'id':_0x15ca16},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe074('0x63'),'attributes':['id',_0xe074('0x2c'),_0xe074('0x64'),_0xe074('0x65'),_0xe074('0x66')],'raw':!![]}]})[_0xe074('0x28')](function(_0xea7227){if(_0xea7227){var _0x113bb5=_[_0xe074('0x67')](_0xea7227,function(_0x29e8f6){var _0x234474=_0x29e8f6[_0xe074('0x4e')]({'plain':!![]});return _0x234474[_0xe074('0x63')];});return db[_0xe074('0x43')][_0xe074('0x4b')]({'where':{'id':_0x45e6ba[_0xe074('0x47')]['id']}})[_0xe074('0x28')](function(_0x55d102){return db[_0xe074('0x68')][_0xe074('0x69')](function(_0x126fd3){return _0x55d102['addTeams'](_0x15ca16,{'transaction':_0x126fd3})[_0xe074('0x28')](function(){return BPromise[_0xe074('0x6a')](_0x113bb5,function(_0x2212b2){return db[_0xe074('0x56')][_0xe074('0x6b')]({'where':{'UserId':_0x2212b2['id'],'OpenchannelQueueId':_0x45e6ba[_0xe074('0x47')]['id']},'transaction':_0x126fd3});});})[_0xe074('0x28')](function(){_0x113bb5[_0xe074('0x6c')](function(_0x1d4e54){socket[_0xe074('0x6d')](_0xe074('0x6e'),{'UserId':_0x1d4e54['id'],'OpenchannelQueueId':_0x55d102['id']});});});});});}})[_0xe074('0x28')](respondWithStatusCode(_0x35e813,null))[_0xe074('0x45')](handleError(_0x35e813,null));};exports[_0xe074('0x6f')]=function(_0x44550a,_0x3a0100,_0x5d157d){return db[_0xe074('0x60')][_0xe074('0x44')]({'where':{'id':_0x44550a['query'][_0xe074('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe074('0x28')](handleEntityNotFound(_0x3a0100,null))[_0xe074('0x28')](function(_0x16cbf7){var _0x417361=_['map'](_0x16cbf7,'id');var _0x2e60ce=[];var _0x2d3abc=[];var _0x12e448=squel[_0xe074('0x71')]();_0x12e448[_0xe074('0x72')](_0xe074('0x73'))[_0xe074('0x74')](_0xe074('0x75'),'tq')['join'](_0xe074('0x76'),'ut',_0xe074('0x77'))[_0xe074('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x44550a[_0xe074('0x47')]['id']);for(var _0x118d52=0x0;_0x118d52<_0x16cbf7[_0xe074('0x49')];_0x118d52+=0x1){let _0x5601d1=_0x16cbf7[_0x118d52];for(var _0x36c6fc=0x0;_0x36c6fc<_0x5601d1[_0xe074('0x63')][_0xe074('0x49')];_0x36c6fc+=0x1){let _0x57d339=_0x5601d1[_0xe074('0x63')][_0x36c6fc];var _0x2d0f5a=_0x12e448[_0xe074('0x78')]();_0x2d0f5a[_0xe074('0x3e')](_0xe074('0x79'),_0x57d339['id']);_0x2d3abc[_0xe074('0x7a')](db[_0xe074('0x68')]['query'](_0x2d0f5a[_0xe074('0x7b')](),{'type':db[_0xe074('0x68')]['QueryTypes'][_0xe074('0x7c')]})[_0xe074('0x28')](function(_0x32b631){if(_0x32b631['length']===0x1){return _0x57d339['id'];}else{var _0x31a9f5=_[_0xe074('0x7d')](_[_0xe074('0x2e')](_0x32b631,_0xe074('0x7e')),function(_0x321da3){return _[_0xe074('0x7f')](_0x417361,_0x321da3);});if(_0x31a9f5){return _0x57d339['id'];}}}));}}return BPromise[_0xe074('0x80')](_0x2d3abc)[_0xe074('0x28')](function(_0x3e9e5f){_0x2e60ce=_(_0x2e60ce)[_0xe074('0x81')](_0x3e9e5f)['compact']()[_0xe074('0x82')]();return db[_0xe074('0x43')][_0xe074('0x4b')]({'where':{'id':_0x44550a[_0xe074('0x47')]['id']}})[_0xe074('0x28')](function(_0x657cac){return db[_0xe074('0x68')]['transaction'](function(_0x462870){return _0x657cac[_0xe074('0x6f')](_0x44550a[_0xe074('0x33')][_0xe074('0x70')],{'transaction':_0x462870})[_0xe074('0x28')](function(){if(!_[_0xe074('0x83')](_0x2e60ce)){return _0x657cac[_0xe074('0x84')](_0x2e60ce,{'transaction':_0x462870});}})[_0xe074('0x28')](function(){_0x2e60ce[_0xe074('0x6c')](function(_0x1d454b){socket[_0xe074('0x6d')](_0xe074('0x85'),{'UserId':_0x1d454b,'OpenchannelQueueId':_0x657cac['id']});});});});});});})[_0xe074('0x28')](respondWithStatusCode(_0x3a0100,null))[_0xe074('0x45')](handleError(_0x3a0100,null));};exports[_0xe074('0x86')]=function(_0x4e4e32,_0x2a106f,_0x7f233c){return db[_0xe074('0x43')][_0xe074('0x4b')]({'where':{'id':_0x4e4e32[_0xe074('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a106f,null))['then'](function(_0x3a9d40){if(_0x3a9d40){return _0x3a9d40[_0xe074('0x86')](_0x4e4e32['body'][_0xe074('0x70')],_[_0xe074('0x87')](_0x4e4e32[_0xe074('0x4d')],[_0xe074('0x70'),'id'])||{})[_0xe074('0x88')](function(_0x278b28){for(var _0x2b1169=0x0;_0x2b1169<_0x4e4e32[_0xe074('0x4d')][_0xe074('0x70')][_0xe074('0x49')];_0x2b1169+=0x1){socket[_0xe074('0x6d')]('userOpenchannelQueue:save',{'UserId':Number(_0x4e4e32['body'][_0xe074('0x70')][_0x2b1169]),'OpenchannelQueueId':Number(_0x4e4e32[_0xe074('0x47')]['id'])});}return _0x278b28;});}})[_0xe074('0x28')](respondWithResult(_0x2a106f,null))[_0xe074('0x45')](handleError(_0x2a106f,null));};exports[_0xe074('0x84')]=function(_0x295fda,_0x5da4df,_0x3498ed){return db[_0xe074('0x43')][_0xe074('0x4b')]({'where':{'id':_0x295fda[_0xe074('0x47')]['id']}})[_0xe074('0x28')](handleEntityNotFound(_0x5da4df,null))[_0xe074('0x28')](function(_0x2f2bdb){if(_0x2f2bdb){return _0x2f2bdb['removeAgents'](_0x295fda['query'][_0xe074('0x70')])['then'](function(){if(_[_0xe074('0x89')](_0x295fda[_0xe074('0x33')][_0xe074('0x70')])){for(var _0x31ddea=0x0;_0x31ddea<_0x295fda[_0xe074('0x33')][_0xe074('0x70')][_0xe074('0x49')];_0x31ddea+=0x1){socket[_0xe074('0x6d')](_0xe074('0x85'),{'UserId':Number(_0x295fda[_0xe074('0x33')]['ids'][_0x31ddea]),'OpenchannelQueueId':Number(_0x295fda['params']['id'])});}}else{socket['emit'](_0xe074('0x85'),{'UserId':Number(_0x295fda[_0xe074('0x33')][_0xe074('0x70')]),'OpenchannelQueueId':Number(_0x295fda[_0xe074('0x47')]['id'])});}});}})[_0xe074('0x28')](respondWithStatusCode(_0x5da4df,null))['catch'](handleError(_0x5da4df,null));};exports[_0xe074('0x8a')]=function(_0x242498,_0x1846e3,_0x13f585){var _0x218325={};var _0x490a29={};var _0x3b3afe;var _0x1dca89;return db[_0xe074('0x43')][_0xe074('0x55')]({'where':{'id':_0x242498[_0xe074('0x47')]['id']}})['then'](handleEntityNotFound(_0x1846e3,null))['then'](function(_0x116b20){if(_0x116b20){_0x3b3afe=_0x116b20;_0x490a29['model']=_['keys'](db[_0xe074('0x57')][_0xe074('0x2f')]);_0x490a29['query']=_[_0xe074('0x48')](_0x242498[_0xe074('0x33')]);_0x490a29[_0xe074('0x34')]=_['intersection'](_0x490a29[_0xe074('0x36')],_0x490a29[_0xe074('0x33')]);_0x218325[_0xe074('0x37')]=_['intersection'](_0x490a29[_0xe074('0x36')],qs[_0xe074('0x38')](_0x242498[_0xe074('0x33')]['fields']));_0x218325['attributes']=_0x218325[_0xe074('0x37')][_0xe074('0x49')]?_0x218325[_0xe074('0x37')]:_0x490a29[_0xe074('0x36')];_0x218325['order']=qs[_0xe074('0x3c')](_0x242498[_0xe074('0x33')][_0xe074('0x3c')]);_0x218325[_0xe074('0x3e')]=qs[_0xe074('0x34')](_[_0xe074('0x8b')](_0x242498[_0xe074('0x33')],_0x490a29[_0xe074('0x34')]));if(_0x242498[_0xe074('0x33')][_0xe074('0x3d')]){_0x218325[_0xe074('0x3e')]=_[_0xe074('0x3f')](_0x218325[_0xe074('0x3e')],{'$or':_['map'](_0x218325[_0xe074('0x37')],function(_0x5cadee){var _0x466af9={};_0x466af9[_0x5cadee]={'$like':'%'+_0x242498['query'][_0xe074('0x3d')]+'%'};return _0x466af9;})});}_0x218325=_[_0xe074('0x3f')]({},_0x218325,_0x242498[_0xe074('0x41')]);return _0x3b3afe['getAgents'](_0x218325);}})[_0xe074('0x28')](function(_0x3bc5d7){if(_0x3bc5d7){_0x1dca89=_0x3bc5d7[_0xe074('0x49')];if(!_0x242498['query'][_0xe074('0x39')](_0xe074('0x3a'))){_0x218325[_0xe074('0x22')]=qs[_0xe074('0x22')](_0x242498[_0xe074('0x33')][_0xe074('0x22')]);_0x218325['offset']=qs['offset'](_0x242498['query'][_0xe074('0x1f')]);}return _0x3b3afe[_0xe074('0x8a')](_0x218325);}})['then'](function(_0x1bc61f){if(_0x1bc61f){return _0x1bc61f?{'count':_0x1dca89,'rows':_0x1bc61f}:null;}})[_0xe074('0x28')](respondWithResult(_0x1846e3,null))[_0xe074('0x45')](handleError(_0x1846e3,null));}; \ No newline at end of file +var _0xd62a=['Team','addTeams','ids','Agents','online','interface','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','includeAll','include','rows','show','keys','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','getTeams'];(function(_0x1e432a,_0x57b467){var _0x4f17a0=function(_0x5111e3){while(--_0x5111e3){_0x1e432a['push'](_0x1e432a['shift']());}};_0x4f17a0(++_0x57b467);}(_0xd62a,0xb0));var _0xad62=function(_0x2f81e9,_0x4c2a9f){_0x2f81e9=_0x2f81e9-0x0;var _0x224d61=_0xd62a[_0x2f81e9];return _0x224d61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xad62('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad62('0x1'));var moment=require(_0xad62('0x2'));var BPromise=require(_0xad62('0x3'));var Mustache=require(_0xad62('0x4'));var util=require(_0xad62('0x5'));var path=require(_0xad62('0x6'));var sox=require('sox');var csv=require(_0xad62('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad62('0x8'));var _=require(_0xad62('0x9'));var squel=require('squel');var crypto=require(_0xad62('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xad62('0xb'));var toCsv=require('to-csv');var querystring=require(_0xad62('0xc'));var Papa=require('papaparse');var Redis=require(_0xad62('0xd'));var authService=require(_0xad62('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xad62('0xf'));var hardwareService=require(_0xad62('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xad62('0x11'));var config=require(_0xad62('0x12'));var licenseUtil=require(_0xad62('0x13'));var db=require(_0xad62('0x14'))['db'];config[_0xad62('0x15')]=_[_0xad62('0x16')](config['redis'],{'host':_0xad62('0x17'),'port':0x18eb});var socket=require(_0xad62('0x18'))(new Redis(config[_0xad62('0x15')]));require(_0xad62('0x19'))[_0xad62('0x1a')](socket);function respondWithStatusCode(_0x3a0d10,_0x1fbbaa){_0x1fbbaa=_0x1fbbaa||0xcc;return function(_0xf9a18){if(_0xf9a18){return _0x3a0d10[_0xad62('0x1b')](_0x1fbbaa);}return _0x3a0d10['status'](_0x1fbbaa)[_0xad62('0x1c')]();};}function respondWithResult(_0x43c1b8,_0x1d361a){_0x1d361a=_0x1d361a||0xc8;return function(_0x3caa4a){if(_0x3caa4a){return _0x43c1b8[_0xad62('0x1d')](_0x1d361a)[_0xad62('0x1e')](_0x3caa4a);}};}function respondWithFilteredResult(_0x2b720f,_0x57bd16){return function(_0xa6d55f){if(_0xa6d55f){var _0x128b8f=typeof _0x57bd16[_0xad62('0x1f')]==='undefined'&&typeof _0x57bd16[_0xad62('0x20')]===_0xad62('0x21');var _0x52be5d=_0xa6d55f[_0xad62('0x22')];var _0x17b943=_0x128b8f?0x0:_0x57bd16[_0xad62('0x1f')];var _0x32ef0e=_0x128b8f?_0xa6d55f['count']:_0x57bd16[_0xad62('0x1f')]+_0x57bd16[_0xad62('0x20')];var _0x54cd93;if(_0x32ef0e>=_0x52be5d){_0x32ef0e=_0x52be5d;_0x54cd93=0xc8;}else{_0x54cd93=0xce;}_0x2b720f[_0xad62('0x1d')](_0x54cd93);return _0x2b720f[_0xad62('0x23')]('Content-Range',_0x17b943+'-'+_0x32ef0e+'/'+_0x52be5d)['json'](_0xa6d55f);}return null;};}function patchUpdates(_0x534a47){return function(_0x405504){try{jsonpatch[_0xad62('0x24')](_0x405504,_0x534a47,!![]);}catch(_0x192532){return BPromise[_0xad62('0x25')](_0x192532);}return _0x405504[_0xad62('0x26')]();};}function saveUpdates(_0x39426b,_0x47f9b4){return function(_0x3ae993){if(_0x3ae993){return _0x3ae993[_0xad62('0x27')](_0x39426b)[_0xad62('0x28')](function(_0x4371c2){return _0x4371c2;});}return null;};}function removeEntity(_0x182132,_0x36593b){return function(_0x5e2baf){if(_0x5e2baf){return _0x5e2baf[_0xad62('0x29')]()['then'](function(){var _0x440b3c=_0x5e2baf['get']({'plain':!![]});var _0x266d30=_0xad62('0x2a');return db[_0xad62('0x2b')][_0xad62('0x29')]({'where':{'type':_0x266d30,'resourceId':_0x440b3c['id']}})['then'](function(){return _0x5e2baf;});})[_0xad62('0x28')](function(){_0x182132['status'](0xcc)[_0xad62('0x1c')]();});}};}function handleEntityNotFound(_0x15ead2,_0x1c1e9f){return function(_0x4874e8){if(!_0x4874e8){_0x15ead2[_0xad62('0x1b')](0x194);}return _0x4874e8;};}function handleError(_0x25576b,_0x101242){_0x101242=_0x101242||0x1f4;return function(_0x32999a){logger[_0xad62('0x2c')](_0x32999a[_0xad62('0x2d')]);if(_0x32999a[_0xad62('0x2e')]){delete _0x32999a[_0xad62('0x2e')];}_0x25576b[_0xad62('0x1d')](_0x101242)[_0xad62('0x2f')](_0x32999a);};}exports[_0xad62('0x30')]=function(_0x565c11,_0x4e09af){var _0x527d57={},_0x35ad64={},_0xe5c4b={'count':0x0,'rows':[]};var _0x1435c9=_[_0xad62('0x31')](db[_0xad62('0x32')][_0xad62('0x33')],function(_0xf18200){return{'name':_0xf18200[_0xad62('0x34')],'type':_0xf18200[_0xad62('0x35')][_0xad62('0x36')]};});_0x35ad64['model']=_['map'](_0x1435c9,'name');_0x35ad64[_0xad62('0x37')]=_['keys'](_0x565c11['query']);_0x35ad64[_0xad62('0x38')]=_[_0xad62('0x39')](_0x35ad64[_0xad62('0x3a')],_0x35ad64['query']);_0x527d57[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x35ad64[_0xad62('0x3a')],qs[_0xad62('0x3c')](_0x565c11[_0xad62('0x37')][_0xad62('0x3c')]));_0x527d57[_0xad62('0x3b')]=_0x527d57['attributes'][_0xad62('0x3d')]?_0x527d57[_0xad62('0x3b')]:_0x35ad64[_0xad62('0x3a')];if(!_0x565c11['query']['hasOwnProperty']('nolimit')){_0x527d57[_0xad62('0x20')]=qs['limit'](_0x565c11[_0xad62('0x37')][_0xad62('0x20')]);_0x527d57[_0xad62('0x1f')]=qs['offset'](_0x565c11[_0xad62('0x37')][_0xad62('0x1f')]);}_0x527d57['order']=qs['sort'](_0x565c11[_0xad62('0x37')][_0xad62('0x3e')]);_0x527d57[_0xad62('0x3f')]=qs[_0xad62('0x38')](_[_0xad62('0x40')](_0x565c11[_0xad62('0x37')],_0x35ad64[_0xad62('0x38')]),_0x1435c9);if(_0x565c11['query'][_0xad62('0x41')]){_0x527d57[_0xad62('0x3f')]=_['merge'](_0x527d57[_0xad62('0x3f')],{'$or':_['map'](_0x1435c9,function(_0x238c81){if(_0x238c81[_0xad62('0x35')]!=='VIRTUAL'){var _0x5d3754={};_0x5d3754[_0x238c81[_0xad62('0x2e')]]={'$like':'%'+_0x565c11[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x5d3754;}})});}_0x527d57=_[_0xad62('0x42')]({},_0x527d57,_0x565c11['options']);var _0x5cd037={'where':_0x527d57[_0xad62('0x3f')]};return db[_0xad62('0x32')][_0xad62('0x22')](_0x5cd037)[_0xad62('0x28')](function(_0x5b3646){_0xe5c4b[_0xad62('0x22')]=_0x5b3646;if(_0x565c11['query'][_0xad62('0x43')]){_0x527d57[_0xad62('0x44')]=[{'all':!![]}];}return db[_0xad62('0x32')]['findAll'](_0x527d57);})[_0xad62('0x28')](function(_0x3c2660){_0xe5c4b[_0xad62('0x45')]=_0x3c2660;return _0xe5c4b;})['then'](respondWithFilteredResult(_0x4e09af,_0x527d57))['catch'](handleError(_0x4e09af,null));};exports[_0xad62('0x46')]=function(_0x52978e,_0x66cba8){var _0x401197={'raw':!![],'where':{'id':_0x52978e['params']['id']}},_0x59292f={};_0x59292f[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x32')][_0xad62('0x33')]);_0x59292f[_0xad62('0x37')]=_['keys'](_0x52978e['query']);_0x59292f['filters']=_[_0xad62('0x39')](_0x59292f[_0xad62('0x3a')],_0x59292f[_0xad62('0x37')]);_0x401197[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x59292f['model'],qs[_0xad62('0x3c')](_0x52978e['query'][_0xad62('0x3c')]));_0x401197[_0xad62('0x3b')]=_0x401197[_0xad62('0x3b')][_0xad62('0x3d')]?_0x401197[_0xad62('0x3b')]:_0x59292f['model'];if(_0x52978e[_0xad62('0x37')][_0xad62('0x43')]){_0x401197[_0xad62('0x44')]=[{'all':!![]}];}_0x401197=_[_0xad62('0x42')]({},_0x401197,_0x52978e[_0xad62('0x48')]);return db[_0xad62('0x32')][_0xad62('0x49')](_0x401197)[_0xad62('0x28')](handleEntityNotFound(_0x66cba8,null))[_0xad62('0x28')](respondWithResult(_0x66cba8,null))[_0xad62('0x4a')](handleError(_0x66cba8,null));};exports[_0xad62('0x4b')]=function(_0x2cc6ef,_0x3f3a54){return db[_0xad62('0x32')][_0xad62('0x4b')](_0x2cc6ef[_0xad62('0x4c')],{})[_0xad62('0x28')](function(_0x22be71){var _0x1bd995=_0x2cc6ef[_0xad62('0x4d')][_0xad62('0x4e')]({'plain':!![]});if(!_0x1bd995)throw new Error(_0xad62('0x4f'));if(_0x1bd995['role']===_0xad62('0x4d')){var _0x467506=_0x22be71[_0xad62('0x4e')]({'plain':!![]});var _0x4f3875=_0xad62('0x2a');return db[_0xad62('0x50')][_0xad62('0x49')]({'where':{'name':_0x4f3875,'userProfileId':_0x1bd995[_0xad62('0x51')]},'raw':!![]})[_0xad62('0x28')](function(_0x540c9b){if(_0x540c9b&&_0x540c9b[_0xad62('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x467506[_0xad62('0x2e')],'resourceId':_0x467506['id'],'type':_0x540c9b['name'],'sectionId':_0x540c9b['id']},{})['then'](function(){return _0x22be71;});}else{return _0x22be71;}})[_0xad62('0x4a')](function(_0x159e76){logger[_0xad62('0x2c')](_0xad62('0x53'),_0x159e76);throw _0x159e76;});}return _0x22be71;})[_0xad62('0x28')](respondWithResult(_0x3f3a54,0xc9))[_0xad62('0x4a')](handleError(_0x3f3a54,null));};exports[_0xad62('0x27')]=function(_0x47ca98,_0x5e3687){if(_0x47ca98[_0xad62('0x4c')]['id']){delete _0x47ca98[_0xad62('0x4c')]['id'];}return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0x47ca98['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x5e3687,null))[_0xad62('0x28')](saveUpdates(_0x47ca98['body'],null))[_0xad62('0x28')](respondWithResult(_0x5e3687,null))[_0xad62('0x4a')](handleError(_0x5e3687,null));};exports[_0xad62('0x29')]=function(_0x3007cc,_0x43d1ae){return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0x3007cc[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x43d1ae,null))['then'](removeEntity(_0x43d1ae,null))[_0xad62('0x4a')](handleError(_0x43d1ae,null));};exports['describe']=function(_0xf34c7f,_0x51d767){return db[_0xad62('0x32')][_0xad62('0x55')]()[_0xad62('0x28')](respondWithResult(_0x51d767,null))[_0xad62('0x4a')](handleError(_0x51d767,null));};exports['getMembers']=function(_0x520242,_0x2b3383,_0x138ceb){var _0x4b046e={'raw':!![],'where':{}},_0x41af8f={},_0x91a7fc;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x520242['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x2b3383,null))[_0xad62('0x28')](function(_0x18aa9a){if(_0x18aa9a){_0x91a7fc=_0x18aa9a['get']({'plain':!![]});_0x41af8f[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x57')]['rawAttributes']);_0x41af8f[_0xad62('0x37')]=_[_0xad62('0x47')](_0x520242[_0xad62('0x37')]);_0x41af8f[_0xad62('0x38')]=_[_0xad62('0x39')](_0x41af8f[_0xad62('0x3a')],_0x41af8f[_0xad62('0x37')]);_0x4b046e[_0xad62('0x3b')]=_['intersection'](_0x41af8f['model'],qs['fields'](_0x520242['query']['fields']));_0x4b046e['attributes']=_0x4b046e['attributes'][_0xad62('0x3d')]?_0x4b046e[_0xad62('0x3b')]:_0x41af8f['model'];if(!_0x520242[_0xad62('0x37')][_0xad62('0x58')](_0xad62('0x59'))){_0x4b046e[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x520242['query'][_0xad62('0x20')]);_0x4b046e[_0xad62('0x1f')]=qs[_0xad62('0x1f')](_0x520242[_0xad62('0x37')][_0xad62('0x1f')]);}_0x4b046e[_0xad62('0x5a')]=qs['sort'](_0x520242[_0xad62('0x37')]['sort']);_0x4b046e[_0xad62('0x3f')]=qs[_0xad62('0x38')](_[_0xad62('0x40')](_0x520242[_0xad62('0x37')],_0x41af8f[_0xad62('0x38')]));_0x4b046e[_0xad62('0x3f')][_0xad62('0x5b')]=_0x18aa9a['id'];if(_0x520242[_0xad62('0x37')][_0xad62('0x41')]){_0x4b046e[_0xad62('0x3f')]=_[_0xad62('0x42')](_0x4b046e['where'],{'$or':_[_0xad62('0x31')](_0x4b046e[_0xad62('0x3b')],function(_0x2fc96a){var _0x432f2f={};_0x432f2f[_0x2fc96a]={'$like':'%'+_0x520242[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x432f2f;})});}_0x4b046e=_[_0xad62('0x42')]({},_0x4b046e,_0x520242[_0xad62('0x48')]);return db[_0xad62('0x57')][_0xad62('0x5c')](_0x4b046e);}})[_0xad62('0x28')](function(_0xa776d0){if(_0xa776d0){return db[_0xad62('0x5d')][_0xad62('0x5e')]({'where':{'id':_['map'](_0xa776d0,_0xad62('0x5f')),'role':_0xad62('0x60')},'attributes':['id',_0xad62('0x2e'),'openchannelPause',_0xad62('0x61'),'createdAt']});}})[_0xad62('0x28')](function(_0x5333fe){if(_0x5333fe){return{'count':_0x5333fe['count'],'rows':_[_0xad62('0x31')](_0x5333fe[_0xad62('0x45')],function(_0x3c0d25){return{'membername':_0x3c0d25[_0xad62('0x2e')],'UserId':_0x3c0d25['id'],'queue_name':_0x91a7fc[_0xad62('0x2e')],'OpenchannelQueueId':_0x91a7fc['id'],'interface':util[_0xad62('0x62')](_0xad62('0x63'),_0xad62('0x64'),_0x3c0d25['name']),'penalty':0x0,'paused':_0x3c0d25['openchannelPause'],'createdAt':_0x3c0d25['createdAt'],'updatedAt':_0x3c0d25[_0xad62('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad62('0x28')](respondWithFilteredResult(_0x2b3383,_0x4b046e))[_0xad62('0x4a')](handleError(_0x2b3383,null));};exports[_0xad62('0x65')]=function(_0x3b885d,_0x2742fe,_0x5123b9){var _0x2b71dc={};var _0x52c805={};var _0x5850a1;var _0x16c3c6;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x3b885d[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x2742fe,null))[_0xad62('0x28')](function(_0x4d8a2e){if(_0x4d8a2e){_0x5850a1=_0x4d8a2e;_0x52c805[_0xad62('0x3a')]=_[_0xad62('0x47')](db[_0xad62('0x66')][_0xad62('0x33')]);_0x52c805[_0xad62('0x37')]=_['keys'](_0x3b885d[_0xad62('0x37')]);_0x52c805[_0xad62('0x38')]=_[_0xad62('0x39')](_0x52c805['model'],_0x52c805[_0xad62('0x37')]);_0x2b71dc[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x52c805[_0xad62('0x3a')],qs[_0xad62('0x3c')](_0x3b885d[_0xad62('0x37')]['fields']));_0x2b71dc['attributes']=_0x2b71dc[_0xad62('0x3b')][_0xad62('0x3d')]?_0x2b71dc['attributes']:_0x52c805[_0xad62('0x3a')];_0x2b71dc[_0xad62('0x5a')]=qs['sort'](_0x3b885d['query'][_0xad62('0x3e')]);_0x2b71dc[_0xad62('0x3f')]=qs['filters'](_[_0xad62('0x40')](_0x3b885d[_0xad62('0x37')],_0x52c805[_0xad62('0x38')]));if(_0x3b885d[_0xad62('0x37')][_0xad62('0x41')]){_0x2b71dc[_0xad62('0x3f')]=_['merge'](_0x2b71dc['where'],{'$or':_[_0xad62('0x31')](_0x2b71dc[_0xad62('0x3b')],function(_0x21b617){var _0x501a1c={};_0x501a1c[_0x21b617]={'$like':'%'+_0x3b885d[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x501a1c;})});}_0x2b71dc=_[_0xad62('0x42')]({},_0x2b71dc,_0x3b885d[_0xad62('0x48')]);return _0x5850a1[_0xad62('0x65')](_0x2b71dc);}})[_0xad62('0x28')](function(_0x364887){if(_0x364887){_0x16c3c6=_0x364887[_0xad62('0x3d')];if(!_0x3b885d[_0xad62('0x37')]['hasOwnProperty'](_0xad62('0x59'))){_0x2b71dc[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x3b885d[_0xad62('0x37')][_0xad62('0x20')]);_0x2b71dc[_0xad62('0x1f')]=qs['offset'](_0x3b885d[_0xad62('0x37')]['offset']);}return _0x5850a1[_0xad62('0x65')](_0x2b71dc);}})[_0xad62('0x28')](function(_0x4972b0){if(_0x4972b0){return _0x4972b0?{'count':_0x16c3c6,'rows':_0x4972b0}:null;}})[_0xad62('0x28')](respondWithResult(_0x2742fe,null))[_0xad62('0x4a')](handleError(_0x2742fe,null));};exports[_0xad62('0x67')]=function(_0x21dbfe,_0x16dd9a,_0x1fd269){var _0x257998=_0x21dbfe[_0xad62('0x4c')][_0xad62('0x68')];return db[_0xad62('0x66')][_0xad62('0x5c')]({'where':{'id':_0x257998},'attributes':['id'],'include':[{'model':db['User'],'as':_0xad62('0x69'),'attributes':['id','name',_0xad62('0x6a'),'voicePause',_0xad62('0x6b')],'raw':!![]}]})[_0xad62('0x28')](function(_0x16fa3d){if(_0x16fa3d){var _0x45b9b7=_['flatMap'](_0x16fa3d,function(_0x17feb2){var _0x34dd8b=_0x17feb2[_0xad62('0x4e')]({'plain':!![]});return _0x34dd8b[_0xad62('0x69')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x21dbfe[_0xad62('0x54')]['id']}})[_0xad62('0x28')](function(_0x1f0d14){return db['sequelize'][_0xad62('0x6c')](function(_0xf5f71e){return _0x1f0d14[_0xad62('0x67')](_0x257998,{'transaction':_0xf5f71e})[_0xad62('0x28')](function(){return BPromise[_0xad62('0x6d')](_0x45b9b7,function(_0x4519ba){return db[_0xad62('0x57')]['findOrCreate']({'where':{'UserId':_0x4519ba['id'],'OpenchannelQueueId':_0x21dbfe[_0xad62('0x54')]['id']},'transaction':_0xf5f71e});});})[_0xad62('0x28')](function(){_0x45b9b7[_0xad62('0x6e')](function(_0x527f9a){socket[_0xad62('0x6f')](_0xad62('0x70'),{'UserId':_0x527f9a['id'],'OpenchannelQueueId':_0x1f0d14['id']});});});});});}})['then'](respondWithStatusCode(_0x16dd9a,null))[_0xad62('0x4a')](handleError(_0x16dd9a,null));};exports[_0xad62('0x71')]=function(_0x57e451,_0x4bf010,_0x3f8451){return db[_0xad62('0x66')][_0xad62('0x5c')]({'where':{'id':_0x57e451[_0xad62('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xad62('0x5d')],'as':_0xad62('0x69'),'attributes':['id'],'raw':!![]}]})[_0xad62('0x28')](handleEntityNotFound(_0x4bf010,null))[_0xad62('0x28')](function(_0x5086f1){var _0x2cb8ed=_[_0xad62('0x31')](_0x5086f1,'id');var _0x1096eb=[];var _0x141d0b=[];var _0x359848=squel[_0xad62('0x72')]();_0x359848[_0xad62('0x73')](_0xad62('0x74'))['from'](_0xad62('0x75'),'tq')[_0xad62('0x76')](_0xad62('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xad62('0x3f')](_0xad62('0x78'),_0x57e451[_0xad62('0x54')]['id']);for(var _0x2277f0=0x0;_0x2277f0<_0x5086f1[_0xad62('0x3d')];_0x2277f0+=0x1){let _0x4d0569=_0x5086f1[_0x2277f0];for(var _0x23ada4=0x0;_0x23ada4<_0x4d0569[_0xad62('0x69')]['length'];_0x23ada4+=0x1){let _0x1e196b=_0x4d0569[_0xad62('0x69')][_0x23ada4];var _0x58ff2b=_0x359848[_0xad62('0x79')]();_0x58ff2b[_0xad62('0x3f')]('ut.UserId\x20=\x20?',_0x1e196b['id']);_0x141d0b[_0xad62('0x7a')](db[_0xad62('0x7b')][_0xad62('0x37')](_0x58ff2b['toString'](),{'type':db[_0xad62('0x7b')][_0xad62('0x7c')][_0xad62('0x7d')]})[_0xad62('0x28')](function(_0x595d68){if(_0x595d68[_0xad62('0x3d')]===0x1){return _0x1e196b['id'];}else{var _0x476f4f=_[_0xad62('0x7e')](_[_0xad62('0x31')](_0x595d68,_0xad62('0x7f')),function(_0x50703b){return _[_0xad62('0x80')](_0x2cb8ed,_0x50703b);});if(_0x476f4f){return _0x1e196b['id'];}}}));}}return BPromise[_0xad62('0x81')](_0x141d0b)[_0xad62('0x28')](function(_0x59520b){_0x1096eb=_(_0x1096eb)[_0xad62('0x82')](_0x59520b)[_0xad62('0x83')]()['value']();return db[_0xad62('0x32')]['find']({'where':{'id':_0x57e451['params']['id']}})[_0xad62('0x28')](function(_0x2c7482){return db[_0xad62('0x7b')]['transaction'](function(_0x3ace4e){return _0x2c7482['removeTeams'](_0x57e451[_0xad62('0x37')]['ids'],{'transaction':_0x3ace4e})[_0xad62('0x28')](function(){if(!_['isEmpty'](_0x1096eb)){return _0x2c7482['removeAgents'](_0x1096eb,{'transaction':_0x3ace4e});}})[_0xad62('0x28')](function(){_0x1096eb[_0xad62('0x6e')](function(_0x27d506){socket[_0xad62('0x6f')](_0xad62('0x84'),{'UserId':_0x27d506,'OpenchannelQueueId':_0x2c7482['id']});});});});});});})[_0xad62('0x28')](respondWithStatusCode(_0x4bf010,null))[_0xad62('0x4a')](handleError(_0x4bf010,null));};exports[_0xad62('0x85')]=function(_0x4bb860,_0x383ab9,_0x446da6){return db['OpenchannelQueue'][_0xad62('0x49')]({'where':{'id':_0x4bb860['params']['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x383ab9,null))[_0xad62('0x28')](function(_0x44af8a){if(_0x44af8a){return _0x44af8a[_0xad62('0x85')](_0x4bb860[_0xad62('0x4c')][_0xad62('0x68')],_[_0xad62('0x86')](_0x4bb860[_0xad62('0x4c')],[_0xad62('0x68'),'id'])||{})[_0xad62('0x87')](function(_0x2f5ac0){for(var _0x18abab=0x0;_0x18abab<_0x4bb860[_0xad62('0x4c')][_0xad62('0x68')][_0xad62('0x3d')];_0x18abab+=0x1){socket[_0xad62('0x6f')](_0xad62('0x70'),{'UserId':Number(_0x4bb860[_0xad62('0x4c')]['ids'][_0x18abab]),'OpenchannelQueueId':Number(_0x4bb860[_0xad62('0x54')]['id'])});}return _0x2f5ac0;});}})[_0xad62('0x28')](respondWithResult(_0x383ab9,null))[_0xad62('0x4a')](handleError(_0x383ab9,null));};exports[_0xad62('0x88')]=function(_0xdb126f,_0xe0c37a,_0x26215c){return db[_0xad62('0x32')][_0xad62('0x49')]({'where':{'id':_0xdb126f[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0xe0c37a,null))['then'](function(_0x1303f6){if(_0x1303f6){return _0x1303f6[_0xad62('0x88')](_0xdb126f[_0xad62('0x37')][_0xad62('0x68')])[_0xad62('0x28')](function(){if(_[_0xad62('0x89')](_0xdb126f[_0xad62('0x37')][_0xad62('0x68')])){for(var _0x2901fe=0x0;_0x2901fe<_0xdb126f[_0xad62('0x37')][_0xad62('0x68')][_0xad62('0x3d')];_0x2901fe+=0x1){socket['emit'](_0xad62('0x84'),{'UserId':Number(_0xdb126f[_0xad62('0x37')][_0xad62('0x68')][_0x2901fe]),'OpenchannelQueueId':Number(_0xdb126f[_0xad62('0x54')]['id'])});}}else{socket[_0xad62('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0xdb126f[_0xad62('0x37')][_0xad62('0x68')]),'OpenchannelQueueId':Number(_0xdb126f['params']['id'])});}});}})[_0xad62('0x28')](respondWithStatusCode(_0xe0c37a,null))[_0xad62('0x4a')](handleError(_0xe0c37a,null));};exports[_0xad62('0x8a')]=function(_0x19bbd8,_0x12dcda,_0x482497){var _0x26a1c4={};var _0x617886={};var _0x1c00ee;var _0x401644;return db[_0xad62('0x32')][_0xad62('0x56')]({'where':{'id':_0x19bbd8[_0xad62('0x54')]['id']}})[_0xad62('0x28')](handleEntityNotFound(_0x12dcda,null))[_0xad62('0x28')](function(_0x3d4b00){if(_0x3d4b00){_0x1c00ee=_0x3d4b00;_0x617886[_0xad62('0x3a')]=_[_0xad62('0x47')](db['User'][_0xad62('0x33')]);_0x617886[_0xad62('0x37')]=_['keys'](_0x19bbd8[_0xad62('0x37')]);_0x617886[_0xad62('0x38')]=_['intersection'](_0x617886[_0xad62('0x3a')],_0x617886[_0xad62('0x37')]);_0x26a1c4[_0xad62('0x3b')]=_[_0xad62('0x39')](_0x617886[_0xad62('0x3a')],qs['fields'](_0x19bbd8['query'][_0xad62('0x3c')]));_0x26a1c4['attributes']=_0x26a1c4[_0xad62('0x3b')][_0xad62('0x3d')]?_0x26a1c4[_0xad62('0x3b')]:_0x617886[_0xad62('0x3a')];_0x26a1c4[_0xad62('0x5a')]=qs[_0xad62('0x3e')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x3e')]);_0x26a1c4[_0xad62('0x3f')]=qs[_0xad62('0x38')](_['pick'](_0x19bbd8[_0xad62('0x37')],_0x617886[_0xad62('0x38')]));if(_0x19bbd8[_0xad62('0x37')]['filter']){_0x26a1c4[_0xad62('0x3f')]=_[_0xad62('0x42')](_0x26a1c4[_0xad62('0x3f')],{'$or':_['map'](_0x26a1c4[_0xad62('0x3b')],function(_0x10924a){var _0x53958d={};_0x53958d[_0x10924a]={'$like':'%'+_0x19bbd8[_0xad62('0x37')][_0xad62('0x41')]+'%'};return _0x53958d;})});}_0x26a1c4=_[_0xad62('0x42')]({},_0x26a1c4,_0x19bbd8[_0xad62('0x48')]);return _0x1c00ee[_0xad62('0x8a')](_0x26a1c4);}})[_0xad62('0x28')](function(_0xaef603){if(_0xaef603){_0x401644=_0xaef603[_0xad62('0x3d')];if(!_0x19bbd8[_0xad62('0x37')][_0xad62('0x58')](_0xad62('0x59'))){_0x26a1c4[_0xad62('0x20')]=qs[_0xad62('0x20')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x20')]);_0x26a1c4[_0xad62('0x1f')]=qs[_0xad62('0x1f')](_0x19bbd8[_0xad62('0x37')][_0xad62('0x1f')]);}return _0x1c00ee[_0xad62('0x8a')](_0x26a1c4);}})['then'](function(_0x23d082){if(_0x23d082){return _0x23d082?{'count':_0x401644,'rows':_0x23d082}:null;}})[_0xad62('0x28')](respondWithResult(_0x12dcda,null))['catch'](handleError(_0x12dcda,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8499d3a..4420260 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 _0x3935=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x9a85cd,_0x51e751){var _0x15b2f8=function(_0x1aeb20){while(--_0x1aeb20){_0x9a85cd['push'](_0x9a85cd['shift']());}};_0x15b2f8(++_0x51e751);}(_0x3935,0x167));var _0x5393=function(_0x29aca7,_0x21c650){_0x29aca7=_0x29aca7-0x0;var _0x1db0a0=_0x3935[_0x29aca7];return _0x1db0a0;};'use strict';var EventEmitter=require(_0x5393('0x0'));var OpenchannelQueue=require(_0x5393('0x1'))['db'][_0x5393('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5393('0x3')](0x0);var events={'afterCreate':_0x5393('0x4'),'afterUpdate':_0x5393('0x5'),'afterDestroy':_0x5393('0x6')};function emitEvent(_0x579edb){return function(_0x51841f,_0x27f6cb,_0x17c429){OpenchannelQueueEvents[_0x5393('0x7')](_0x579edb+':'+_0x51841f['id'],_0x51841f);OpenchannelQueueEvents[_0x5393('0x7')](_0x579edb,_0x51841f);_0x17c429(null);};}for(var e in events){if(events[_0x5393('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5393('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1eb4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x1eb4,0xca));var _0x41eb=function(_0x1d9789,_0x102519){_0x1d9789=_0x1d9789-0x0;var _0x2fb74b=_0x1eb4[_0x1d9789];return _0x2fb74b;};'use strict';var EventEmitter=require(_0x41eb('0x0'));var OpenchannelQueue=require(_0x41eb('0x1'))['db'][_0x41eb('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x41eb('0x3')](0x0);var events={'afterCreate':_0x41eb('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x88ac82){return function(_0x1730b5,_0x398a84,_0x5da94b){OpenchannelQueueEvents[_0x41eb('0x5')](_0x88ac82+':'+_0x1730b5['id'],_0x1730b5);OpenchannelQueueEvents[_0x41eb('0x5')](_0x88ac82,_0x1730b5);_0x5da94b(null);};}for(var e in events){if(events[_0x41eb('0x6')](e)){var event=events[e];OpenchannelQueue[_0x41eb('0x7')](e,emitEvent(event));}}module[_0x41eb('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 90bd57c..70ec1f9 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 _0x2f05=['exports','define','OpenchannelQueue','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2f05,0x168));var _0x52f0=function(_0x2a82b3,_0x33137a){_0x2a82b3=_0x2a82b3-0x0;var _0x6bdd9f=_0x2f05[_0x2a82b3];return _0x6bdd9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52f0('0x0'))('api');var moment=require(_0x52f0('0x1'));var BPromise=require('bluebird');var rp=require(_0x52f0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52f0('0x3'));var attributes=require('./openchannelQueue.attributes');module[_0x52f0('0x4')]=function(_0x389c88,_0x285a33){return _0x389c88[_0x52f0('0x5')](_0x52f0('0x6'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fe=['openchannel_queues','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','OpenchannelQueue'];(function(_0x52ad93,_0x1422c1){var _0x7f4ff8=function(_0x593ddd){while(--_0x593ddd){_0x52ad93['push'](_0x52ad93['shift']());}};_0x7f4ff8(++_0x1422c1);}(_0xd8fe,0x155));var _0xed8f=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd8fe[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xed8f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xed8f('0x1'));var BPromise=require(_0xed8f('0x2'));var rp=require(_0xed8f('0x3'));var fs=require('fs');var path=require(_0xed8f('0x4'));var rimraf=require(_0xed8f('0x5'));var config=require(_0xed8f('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0xed8f('0x7')]=function(_0x501afb,_0xffc79){return _0x501afb['define'](_0xed8f('0x8'),attributes,{'tableName':_0xed8f('0x9'),'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 10f3383..6ec4cb8 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 _0x314c=['GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','map','model','attributes','include','info','ShowOpenchannelQueue','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x314c,0x156));var _0xc314=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x314c[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc314('0x0'));var BPromise=require(_0xc314('0x1'));var rs=require(_0xc314('0x2'));var fs=require('fs');var Redis=require(_0xc314('0x3'));var db=require(_0xc314('0x4'))['db'];var utils=require(_0xc314('0x5'));var logger=require(_0xc314('0x6'))(_0xc314('0x7'));var config=require(_0xc314('0x8'));var jayson=require(_0xc314('0x9'));var client=jayson[_0xc314('0xa')][_0xc314('0xb')]({'port':0x232a});config[_0xc314('0xc')]=_[_0xc314('0xd')](config[_0xc314('0xc')],{'host':_0xc314('0xe'),'port':0x18eb});var socket=require(_0xc314('0xf'))(new Redis(config[_0xc314('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3f84da,_0x476966,_0x9abac1){return new BPromise(function(_0x462fc0,_0x16b002){return client['request'](_0x3f84da,_0x9abac1)[_0xc314('0x10')](function(_0x74b4da){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x476966,'request\x20sent');logger[_0xc314('0x11')](_0xc314('0x12'),_0x476966,_0xc314('0x13'),JSON[_0xc314('0x14')](_0x74b4da));if(_0x74b4da[_0xc314('0x15')]){if(_0x74b4da[_0xc314('0x15')][_0xc314('0x16')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x476966,_0x74b4da[_0xc314('0x15')][_0xc314('0x17')]);return _0x16b002(_0x74b4da[_0xc314('0x15')][_0xc314('0x17')]);}logger[_0xc314('0x15')](_0xc314('0x18'),_0x476966,_0x74b4da[_0xc314('0x15')][_0xc314('0x17')]);return _0x462fc0(_0x74b4da[_0xc314('0x15')][_0xc314('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x476966,'request\x20sent');_0x462fc0(_0x74b4da[_0xc314('0x19')]['message']);}})[_0xc314('0x1a')](function(_0x536b5b){logger[_0xc314('0x15')](_0xc314('0x18'),_0x476966,_0x536b5b);_0x16b002(_0x536b5b);});});}exports[_0xc314('0x1b')]=function(_0x1342c3){var _0x1142d0=this;return new Promise(function(_0x189a9d,_0x20cf21){return db[_0xc314('0x1c')][_0xc314('0x1d')]({'raw':_0x1342c3[_0xc314('0x1e')]?_0x1342c3['options']['raw']===undefined?!![]:![]:!![],'where':_0x1342c3[_0xc314('0x1e')]?_0x1342c3[_0xc314('0x1e')][_0xc314('0x1f')]||null:null,'attributes':_0x1342c3[_0xc314('0x1e')]?_0x1342c3[_0xc314('0x1e')]['attributes']||null:null,'limit':_0x1342c3['options']?_0x1342c3[_0xc314('0x1e')][_0xc314('0x20')]||null:null,'include':_0x1342c3[_0xc314('0x1e')]?_0x1342c3[_0xc314('0x1e')]['include']?_[_0xc314('0x21')](_0x1342c3[_0xc314('0x1e')]['include'],function(_0x491d82){return{'model':db[_0x491d82[_0xc314('0x22')]],'as':_0x491d82['as'],'attributes':_0x491d82[_0xc314('0x23')],'include':_0x491d82[_0xc314('0x24')]?_['map'](_0x491d82[_0xc314('0x24')],function(_0x55a948){return{'model':db[_0x55a948[_0xc314('0x22')]],'as':_0x55a948['as'],'attributes':_0x55a948[_0xc314('0x23')],'include':_0x55a948[_0xc314('0x24')]?_[_0xc314('0x21')](_0x55a948[_0xc314('0x24')],function(_0x5772ee){return{'model':db[_0x5772ee['model']],'as':_0x5772ee['as'],'attributes':_0x5772ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xc314('0x10')](function(_0x5d0554){logger[_0xc314('0x25')]('GetOpenchannelQueue',_0x1342c3);logger[_0xc314('0x11')](_0xc314('0x1b'),_0x1342c3,JSON[_0xc314('0x14')](_0x5d0554));_0x189a9d(_0x5d0554);})[_0xc314('0x1a')](function(_0x4b97ae){logger[_0xc314('0x15')](_0xc314('0x1b'),_0x4b97ae[_0xc314('0x17')],_0x1342c3);_0x20cf21(_0x1142d0['error'](0x1f4,_0x4b97ae[_0xc314('0x17')]));});});};exports[_0xc314('0x26')]=function(_0x359704){var _0x16434f=this;return new Promise(function(_0x3fe3f7,_0x13ec79){return db['OpenchannelQueue'][_0xc314('0x27')]({'raw':_0x359704['options']?_0x359704[_0xc314('0x1e')][_0xc314('0x28')]===undefined?!![]:![]:!![],'where':_0x359704['options']?_0x359704['options'][_0xc314('0x1f')]||null:null,'attributes':_0x359704[_0xc314('0x1e')]?_0x359704['options'][_0xc314('0x23')]||null:null,'include':_0x359704[_0xc314('0x1e')]?_0x359704[_0xc314('0x1e')][_0xc314('0x24')]?_[_0xc314('0x21')](_0x359704['options']['include'],function(_0x49fe51){return{'model':db[_0x49fe51[_0xc314('0x22')]],'as':_0x49fe51['as'],'attributes':_0x49fe51[_0xc314('0x23')],'include':_0x49fe51[_0xc314('0x24')]?_[_0xc314('0x21')](_0x49fe51[_0xc314('0x24')],function(_0x3b930d){return{'model':db[_0x3b930d[_0xc314('0x22')]],'as':_0x3b930d['as'],'attributes':_0x3b930d['attributes'],'include':_0x3b930d['include']?_[_0xc314('0x21')](_0x3b930d[_0xc314('0x24')],function(_0x549ccf){return{'model':db[_0x549ccf[_0xc314('0x22')]],'as':_0x549ccf['as'],'attributes':_0x549ccf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40a508){logger[_0xc314('0x25')]('ShowOpenchannelQueue',_0x359704);logger['debug'](_0xc314('0x26'),_0x359704,JSON['stringify'](_0x40a508));_0x3fe3f7(_0x40a508);})[_0xc314('0x1a')](function(_0x4abf6c){logger['error']('ShowOpenchannelQueue',_0x4abf6c[_0xc314('0x17')],_0x359704);_0x13ec79(_0x16434f[_0xc314('0x15')](0x1f4,_0x4abf6c['message']));});});}; \ No newline at end of file +var _0xd230=['redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','limit','include','model','attributes','map','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd230,0xe5));var _0x0d23=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xd230[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0x0d23('0x0'));var util=require(_0x0d23('0x1'));var moment=require(_0x0d23('0x2'));var BPromise=require(_0x0d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d23('0x4'));var db=require(_0x0d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d23('0x6'))('rpc');var config=require(_0x0d23('0x7'));var jayson=require(_0x0d23('0x8'));var client=jayson[_0x0d23('0x9')][_0x0d23('0xa')]({'port':0x232a});config[_0x0d23('0xb')]=_[_0x0d23('0xc')](config[_0x0d23('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d23('0xb')]));require(_0x0d23('0xd'))[_0x0d23('0xe')](socket);function respondWithRpcPromise(_0x254264,_0x551e72,_0x44a92b){return new BPromise(function(_0x46eaa4,_0x59da92){return client[_0x0d23('0xf')](_0x254264,_0x44a92b)[_0x0d23('0x10')](function(_0x4edcb8){logger[_0x0d23('0x11')](_0x0d23('0x12'),_0x551e72,_0x0d23('0x13'));logger['debug'](_0x0d23('0x14'),_0x551e72,'request\x20sent',JSON[_0x0d23('0x15')](_0x4edcb8));if(_0x4edcb8['error']){if(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x17')]===0x1f4){logger[_0x0d23('0x16')](_0x0d23('0x12'),_0x551e72,_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);return _0x59da92(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x551e72,_0x4edcb8[_0x0d23('0x16')]['message']);return _0x46eaa4(_0x4edcb8[_0x0d23('0x16')][_0x0d23('0x18')]);}else{logger[_0x0d23('0x11')](_0x0d23('0x12'),_0x551e72,_0x0d23('0x13'));_0x46eaa4(_0x4edcb8[_0x0d23('0x19')][_0x0d23('0x18')]);}})['catch'](function(_0x23347f){logger[_0x0d23('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x551e72,_0x23347f);_0x59da92(_0x23347f);});});}exports[_0x0d23('0x1a')]=function(_0x5d741b){var _0x5c9410=this;return new Promise(function(_0x2301c4,_0x4e7ecc){return db[_0x0d23('0x1b')][_0x0d23('0x1c')]({'raw':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b[_0x0d23('0x1d')][_0x0d23('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d741b['options']?_0x5d741b[_0x0d23('0x1d')]['where']||null:null,'attributes':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b[_0x0d23('0x1d')]['attributes']||null:null,'limit':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b['options'][_0x0d23('0x1f')]||null:null,'include':_0x5d741b[_0x0d23('0x1d')]?_0x5d741b['options'][_0x0d23('0x20')]?_['map'](_0x5d741b[_0x0d23('0x1d')]['include'],function(_0x2b207d){return{'model':db[_0x2b207d['model']],'as':_0x2b207d['as'],'attributes':_0x2b207d['attributes'],'include':_0x2b207d['include']?_['map'](_0x2b207d[_0x0d23('0x20')],function(_0x5ccff5){return{'model':db[_0x5ccff5[_0x0d23('0x21')]],'as':_0x5ccff5['as'],'attributes':_0x5ccff5[_0x0d23('0x22')],'include':_0x5ccff5['include']?_[_0x0d23('0x23')](_0x5ccff5[_0x0d23('0x20')],function(_0x309ffb){return{'model':db[_0x309ffb[_0x0d23('0x21')]],'as':_0x309ffb['as'],'attributes':_0x309ffb[_0x0d23('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d23('0x10')](function(_0x342864){logger[_0x0d23('0x11')]('GetOpenchannelQueue',_0x5d741b);logger['debug'](_0x0d23('0x1a'),_0x5d741b,JSON[_0x0d23('0x15')](_0x342864));_0x2301c4(_0x342864);})[_0x0d23('0x24')](function(_0x2725a5){logger['error'](_0x0d23('0x1a'),_0x2725a5[_0x0d23('0x18')],_0x5d741b);_0x4e7ecc(_0x5c9410[_0x0d23('0x16')](0x1f4,_0x2725a5[_0x0d23('0x18')]));});});};exports[_0x0d23('0x25')]=function(_0x30aa81){var _0x308c27=this;return new Promise(function(_0x43cb82,_0x31f127){return db[_0x0d23('0x1b')][_0x0d23('0x26')]({'raw':_0x30aa81['options']?_0x30aa81['options'][_0x0d23('0x1e')]===undefined?!![]:![]:!![],'where':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x27')]||null:null,'attributes':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x22')]||null:null,'include':_0x30aa81[_0x0d23('0x1d')]?_0x30aa81['options'][_0x0d23('0x20')]?_[_0x0d23('0x23')](_0x30aa81[_0x0d23('0x1d')][_0x0d23('0x20')],function(_0x59e5d2){return{'model':db[_0x59e5d2[_0x0d23('0x21')]],'as':_0x59e5d2['as'],'attributes':_0x59e5d2[_0x0d23('0x22')],'include':_0x59e5d2['include']?_[_0x0d23('0x23')](_0x59e5d2[_0x0d23('0x20')],function(_0x346fc3){return{'model':db[_0x346fc3[_0x0d23('0x21')]],'as':_0x346fc3['as'],'attributes':_0x346fc3[_0x0d23('0x22')],'include':_0x346fc3[_0x0d23('0x20')]?_[_0x0d23('0x23')](_0x346fc3[_0x0d23('0x20')],function(_0x1c4df9){return{'model':db[_0x1c4df9[_0x0d23('0x21')]],'as':_0x1c4df9['as'],'attributes':_0x1c4df9[_0x0d23('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0d23('0x10')](function(_0x13de58){logger['info'](_0x0d23('0x25'),_0x30aa81);logger['debug'](_0x0d23('0x25'),_0x30aa81,JSON['stringify'](_0x13de58));_0x43cb82(_0x13de58);})[_0x0d23('0x24')](function(_0x5c12ed){logger[_0x0d23('0x16')]('ShowOpenchannelQueue',_0x5c12ed['message'],_0x30aa81);_0x31f127(_0x308c27[_0x0d23('0x16')](0x1f4,_0x5c12ed[_0x0d23('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 223d08a..e89c261 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 _0x896d=['save','remove','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x3439ea,_0x3c68ba){var _0x3900a3=function(_0x38f9a5){while(--_0x38f9a5){_0x3439ea['push'](_0x3439ea['shift']());}};_0x3900a3(++_0x3c68ba);}(_0x896d,0x1b5));var _0xd896=function(_0x5efb3c,_0x852a5a){_0x5efb3c=_0x5efb3c-0x0;var _0x349be3=_0x896d[_0x5efb3c];return _0x349be3;};'use strict';var OpenchannelQueueEvents=require(_0xd896('0x0'));var events=[_0xd896('0x1'),_0xd896('0x2'),'update'];function createListener(_0x59bb20,_0x41e674){return function(_0x1e2239){_0x41e674['emit'](_0x59bb20,_0x1e2239);};}function removeListener(_0x52610c,_0x49b232){return function(){OpenchannelQueueEvents['removeListener'](_0x52610c,_0x49b232);};}exports[_0xd896('0x3')]=function(_0x1698b9){for(var _0x1944b1=0x0,_0x2c9058=events[_0xd896('0x4')];_0x1944b1<_0x2c9058;_0x1944b1++){var _0x504206=events[_0x1944b1];var _0x3db5ae=createListener(_0xd896('0x5')+_0x504206,_0x1698b9);OpenchannelQueueEvents['on'](_0x504206,_0x3db5ae);}}; \ No newline at end of file +var _0xabf3=['remove','emit','removeListener','register','openchannelQueue:','save'];(function(_0x3b3179,_0xe4c588){var _0x381214=function(_0x22d3c5){while(--_0x22d3c5){_0x3b3179['push'](_0x3b3179['shift']());}};_0x381214(++_0xe4c588);}(_0xabf3,0x191));var _0x3abf=function(_0x1bd483,_0x5e2fd8){_0x1bd483=_0x1bd483-0x0;var _0x5a392a=_0xabf3[_0x1bd483];return _0x5a392a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x3abf('0x0'),_0x3abf('0x1'),'update'];function createListener(_0x552c36,_0x3d7696){return function(_0x1b98f1){_0x3d7696[_0x3abf('0x2')](_0x552c36,_0x1b98f1);};}function removeListener(_0x4c7d82,_0x4a29de){return function(){OpenchannelQueueEvents[_0x3abf('0x3')](_0x4c7d82,_0x4a29de);};}exports[_0x3abf('0x4')]=function(_0x3eb062){for(var _0x3a4630=0x0,_0xb8fb93=events['length'];_0x3a4630<_0xb8fb93;_0x3a4630++){var _0x102d37=events[_0x3a4630];var _0x262e73=createListener(_0x3abf('0x5')+_0x102d37,_0x3eb062);OpenchannelQueueEvents['on'](_0x102d37,_0x262e73);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d3a8d17..782b80f 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 _0xbe1d=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x4ecdb6,_0x5b3bb4){var _0x22b179=function(_0x298f40){while(--_0x298f40){_0x4ecdb6['push'](_0x4ecdb6['shift']());}};_0x22b179(++_0x5b3bb4);}(_0xbe1d,0xbe));var _0xdbe1=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0xbe1d[_0x2493f7];return _0x594ab2;};'use strict';var multer=require(_0xdbe1('0x0'));var util=require(_0xdbe1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdbe1('0x2'));var router=express['Router']();var fs_extra=require(_0xdbe1('0x3'));var auth=require(_0xdbe1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdbe1('0x5'));var controller=require(_0xdbe1('0x6'));router[_0xdbe1('0x7')]('/',auth[_0xdbe1('0x8')](),controller[_0xdbe1('0x9')]);router[_0xdbe1('0x7')]('/describe',auth[_0xdbe1('0x8')](),controller['describe']);router[_0xdbe1('0x7')](_0xdbe1('0xa'),auth[_0xdbe1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdbe1('0xa'),auth[_0xdbe1('0x8')](),controller[_0xdbe1('0xb')]);router[_0xdbe1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xdbe1('0xd')]);module[_0xdbe1('0xe')]=router; \ No newline at end of file +var _0x744d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','connect-timeout','Router'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0x744d,0x1ec));var _0xd744=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x744d[_0x59d0cc];return _0x2ae79f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd744('0x0'));var express=require('express');var router=express[_0xd744('0x1')]();var fs_extra=require(_0xd744('0x2'));var auth=require(_0xd744('0x3'));var interaction=require(_0xd744('0x4'));var config=require(_0xd744('0x5'));var controller=require(_0xd744('0x6'));router[_0xd744('0x7')]('/',auth[_0xd744('0x8')](),controller[_0xd744('0x9')]);router[_0xd744('0x7')](_0xd744('0xa'),auth['isAuthenticated'](),controller[_0xd744('0xb')]);router['get'](_0xd744('0xc'),auth[_0xd744('0x8')](),controller[_0xd744('0xd')]);router[_0xd744('0xe')]('/',auth[_0xd744('0x8')](),controller[_0xd744('0xf')]);router['put'](_0xd744('0xc'),auth[_0xd744('0x8')](),controller[_0xd744('0x10')]);router[_0xd744('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd744('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 5633ffd..b415e44 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 _0x86c9=['DATE','exports','STRING'];(function(_0xe64715,_0x57444a){var _0x2525e6=function(_0x24707d){while(--_0x24707d){_0xe64715['push'](_0xe64715['shift']());}};_0x2525e6(++_0x57444a);}(_0x86c9,0x100));var _0x986c=function(_0x450b1c,_0x32ec74){_0x450b1c=_0x450b1c-0x0;var _0x25e755=_0x86c9[_0x450b1c];return _0x25e755;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x986c('0x0')]={'uniqueid':{'type':Sequelize[_0x986c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x986c('0x1')]},'joinAt':{'type':Sequelize[_0x986c('0x2')]},'leaveAt':{'type':Sequelize[_0x986c('0x2')]},'acceptAt':{'type':Sequelize[_0x986c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x986c('0x1')]}}; \ No newline at end of file +var _0x7bbe=['exports','STRING','DATE','moment','sequelize'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x7bbe,0x80));var _0xe7bb=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x7bbe[_0x349148];return _0x2f2b0f;};'use strict';var moment=require(_0xe7bb('0x0'));var Sequelize=require(_0xe7bb('0x1'));module[_0xe7bb('0x2')]={'uniqueid':{'type':Sequelize[_0xe7bb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe7bb('0x3')]},'joinAt':{'type':Sequelize[_0xe7bb('0x4')]},'leaveAt':{'type':Sequelize[_0xe7bb('0x4')]},'acceptAt':{'type':Sequelize[_0xe7bb('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xe7bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 504942a..a2c5c10 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 _0xe92a=['send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe92a,0x1dc));var _0xae92=function(_0x4338ea,_0x25a290){_0x4338ea=_0x4338ea-0x0;var _0x662e09=_0xe92a[_0x4338ea];return _0x662e09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae92('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae92('0x1'));var rp=require('request-promise');var moment=require(_0xae92('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xae92('0x3'));var util=require(_0xae92('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xae92('0x5'));var ejs=require(_0xae92('0x6'));var fs=require('fs');var fs_extra=require(_0xae92('0x7'));var _=require('lodash');var squel=require(_0xae92('0x8'));var crypto=require('crypto');var jsforce=require(_0xae92('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xae92('0x5'));var querystring=require(_0xae92('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae92('0xb'));var qs=require(_0xae92('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae92('0xd'));var logger=require(_0xae92('0xe'))('api');var utils=require(_0xae92('0xf'));var config=require(_0xae92('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xae92('0x11'))['db'];function respondWithStatusCode(_0x3bf68f,_0x124f93){_0x124f93=_0x124f93||0xcc;return function(_0x2ec69e){if(_0x2ec69e){return _0x3bf68f[_0xae92('0x12')](_0x124f93);}return _0x3bf68f[_0xae92('0x13')](_0x124f93)[_0xae92('0x14')]();};}function respondWithResult(_0x9f80bb,_0x134e41){_0x134e41=_0x134e41||0xc8;return function(_0x41d0b2){if(_0x41d0b2){return _0x9f80bb[_0xae92('0x13')](_0x134e41)[_0xae92('0x15')](_0x41d0b2);}};}function respondWithFilteredResult(_0xa56077,_0x4a9dde){return function(_0xd7462d){if(_0xd7462d){var _0x177896=typeof _0x4a9dde[_0xae92('0x16')]===_0xae92('0x17')&&typeof _0x4a9dde[_0xae92('0x18')]==='undefined';var _0x2abbdb=_0xd7462d[_0xae92('0x19')];var _0x133493=_0x177896?0x0:_0x4a9dde[_0xae92('0x16')];var _0x198a25=_0x177896?_0xd7462d[_0xae92('0x19')]:_0x4a9dde[_0xae92('0x16')]+_0x4a9dde[_0xae92('0x18')];var _0xc6bb1b;if(_0x198a25>=_0x2abbdb){_0x198a25=_0x2abbdb;_0xc6bb1b=0xc8;}else{_0xc6bb1b=0xce;}_0xa56077['status'](_0xc6bb1b);return _0xa56077[_0xae92('0x1a')](_0xae92('0x1b'),_0x133493+'-'+_0x198a25+'/'+_0x2abbdb)['json'](_0xd7462d);}return null;};}function patchUpdates(_0x5a6a90){return function(_0x417903){try{jsonpatch[_0xae92('0x1c')](_0x417903,_0x5a6a90,!![]);}catch(_0x1e3418){return BPromise[_0xae92('0x1d')](_0x1e3418);}return _0x417903['save']();};}function saveUpdates(_0x336e8f,_0x1e7672){return function(_0x3f10b4){if(_0x3f10b4){return _0x3f10b4[_0xae92('0x1e')](_0x336e8f)['then'](function(_0xb5ef1e){return _0xb5ef1e;});}return null;};}function removeEntity(_0x4d4307,_0x5d291b){return function(_0x673e87){if(_0x673e87){return _0x673e87['destroy']()[_0xae92('0x1f')](function(){_0x4d4307['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1802de,_0x229a68){return function(_0x57e19a){if(!_0x57e19a){_0x1802de[_0xae92('0x12')](0x194);}return _0x57e19a;};}function handleError(_0x32fd71,_0x1122e3){_0x1122e3=_0x1122e3||0x1f4;return function(_0x3c0e66){logger[_0xae92('0x20')](_0x3c0e66[_0xae92('0x21')]);if(_0x3c0e66[_0xae92('0x22')]){delete _0x3c0e66[_0xae92('0x22')];}_0x32fd71[_0xae92('0x13')](_0x1122e3)[_0xae92('0x23')](_0x3c0e66);};}exports[_0xae92('0x24')]=function(_0x3c2aa6,_0x20896c){var _0x45a6cd={},_0x11f27a={},_0x4b4890={'count':0x0,'rows':[]};var _0x19ca18=_[_0xae92('0x25')](db[_0xae92('0x26')][_0xae92('0x27')],function(_0xc5be5e){return{'name':_0xc5be5e[_0xae92('0x28')],'type':_0xc5be5e[_0xae92('0x29')][_0xae92('0x2a')]};});_0x11f27a['model']=_['map'](_0x19ca18,'name');_0x11f27a[_0xae92('0x2b')]=_[_0xae92('0x2c')](_0x3c2aa6['query']);_0x11f27a[_0xae92('0x2d')]=_[_0xae92('0x2e')](_0x11f27a[_0xae92('0x2f')],_0x11f27a[_0xae92('0x2b')]);_0x45a6cd[_0xae92('0x30')]=_['intersection'](_0x11f27a[_0xae92('0x2f')],qs[_0xae92('0x31')](_0x3c2aa6['query']['fields']));_0x45a6cd[_0xae92('0x30')]=_0x45a6cd['attributes'][_0xae92('0x32')]?_0x45a6cd[_0xae92('0x30')]:_0x11f27a[_0xae92('0x2f')];if(!_0x3c2aa6[_0xae92('0x2b')][_0xae92('0x33')](_0xae92('0x34'))){_0x45a6cd[_0xae92('0x18')]=qs[_0xae92('0x18')](_0x3c2aa6[_0xae92('0x2b')]['limit']);_0x45a6cd[_0xae92('0x16')]=qs['offset'](_0x3c2aa6[_0xae92('0x2b')]['offset']);}_0x45a6cd[_0xae92('0x35')]=qs[_0xae92('0x36')](_0x3c2aa6[_0xae92('0x2b')][_0xae92('0x36')]);_0x45a6cd[_0xae92('0x37')]=qs[_0xae92('0x2d')](_[_0xae92('0x38')](_0x3c2aa6['query'],_0x11f27a[_0xae92('0x2d')]),_0x19ca18);if(_0x3c2aa6[_0xae92('0x2b')][_0xae92('0x39')]){_0x45a6cd[_0xae92('0x37')]=_[_0xae92('0x3a')](_0x45a6cd[_0xae92('0x37')],{'$or':_['map'](_0x19ca18,function(_0x3cc79a){if(_0x3cc79a['type']!==_0xae92('0x3b')){var _0x1226e6={};_0x1226e6[_0x3cc79a[_0xae92('0x22')]]={'$like':'%'+_0x3c2aa6['query'][_0xae92('0x39')]+'%'};return _0x1226e6;}})});}_0x45a6cd=_[_0xae92('0x3a')]({},_0x45a6cd,_0x3c2aa6[_0xae92('0x3c')]);var _0xb35758={'where':_0x45a6cd[_0xae92('0x37')]};return db['OpenchannelQueueReport']['count'](_0xb35758)[_0xae92('0x1f')](function(_0x1bcd84){_0x4b4890[_0xae92('0x19')]=_0x1bcd84;if(_0x3c2aa6[_0xae92('0x2b')][_0xae92('0x3d')]){_0x45a6cd['include']=[{'all':!![]}];}return db[_0xae92('0x26')][_0xae92('0x3e')](_0x45a6cd);})[_0xae92('0x1f')](function(_0x3e6910){_0x4b4890[_0xae92('0x3f')]=_0x3e6910;return _0x4b4890;})[_0xae92('0x1f')](respondWithFilteredResult(_0x20896c,_0x45a6cd))[_0xae92('0x40')](handleError(_0x20896c,null));};exports[_0xae92('0x41')]=function(_0x33627e,_0x521397){var _0x44dd12={'raw':!![],'where':{'id':_0x33627e[_0xae92('0x42')]['id']}},_0x4b67e0={};_0x4b67e0[_0xae92('0x2f')]=_[_0xae92('0x2c')](db[_0xae92('0x26')][_0xae92('0x27')]);_0x4b67e0[_0xae92('0x2b')]=_[_0xae92('0x2c')](_0x33627e['query']);_0x4b67e0[_0xae92('0x2d')]=_[_0xae92('0x2e')](_0x4b67e0[_0xae92('0x2f')],_0x4b67e0[_0xae92('0x2b')]);_0x44dd12[_0xae92('0x30')]=_[_0xae92('0x2e')](_0x4b67e0[_0xae92('0x2f')],qs[_0xae92('0x31')](_0x33627e[_0xae92('0x2b')][_0xae92('0x31')]));_0x44dd12['attributes']=_0x44dd12[_0xae92('0x30')]['length']?_0x44dd12[_0xae92('0x30')]:_0x4b67e0['model'];if(_0x33627e[_0xae92('0x2b')]['includeAll']){_0x44dd12[_0xae92('0x43')]=[{'all':!![]}];}_0x44dd12=_[_0xae92('0x3a')]({},_0x44dd12,_0x33627e[_0xae92('0x3c')]);return db[_0xae92('0x26')][_0xae92('0x44')](_0x44dd12)[_0xae92('0x1f')](handleEntityNotFound(_0x521397,null))[_0xae92('0x1f')](respondWithResult(_0x521397,null))[_0xae92('0x40')](handleError(_0x521397,null));};exports[_0xae92('0x45')]=function(_0x5bceed,_0xfacdc7){return db['OpenchannelQueueReport'][_0xae92('0x45')](_0x5bceed[_0xae92('0x46')],{})[_0xae92('0x1f')](respondWithResult(_0xfacdc7,0xc9))[_0xae92('0x40')](handleError(_0xfacdc7,null));};exports[_0xae92('0x1e')]=function(_0x3463f0,_0x5dd8a9){if(_0x3463f0['body']['id']){delete _0x3463f0[_0xae92('0x46')]['id'];}return db[_0xae92('0x26')]['find']({'where':{'id':_0x3463f0[_0xae92('0x42')]['id']}})[_0xae92('0x1f')](handleEntityNotFound(_0x5dd8a9,null))[_0xae92('0x1f')](saveUpdates(_0x3463f0['body'],null))['then'](respondWithResult(_0x5dd8a9,null))[_0xae92('0x40')](handleError(_0x5dd8a9,null));};exports[_0xae92('0x47')]=function(_0x42ec5f,_0x53ebe1){return db['OpenchannelQueueReport'][_0xae92('0x44')]({'where':{'id':_0x42ec5f[_0xae92('0x42')]['id']}})[_0xae92('0x1f')](handleEntityNotFound(_0x53ebe1,null))[_0xae92('0x1f')](removeEntity(_0x53ebe1,null))[_0xae92('0x40')](handleError(_0x53ebe1,null));};exports[_0xae92('0x48')]=function(_0x452442,_0x48b5a5){return db[_0xae92('0x26')][_0xae92('0x48')]()[_0xae92('0x1f')](respondWithResult(_0x48b5a5,null))[_0xae92('0x40')](handleError(_0x48b5a5,null));}; \ No newline at end of file +var _0xfd45=['rawAttributes','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','OpenchannelQueueReport'];(function(_0x476df5,_0x2dbbd6){var _0x41d2b7=function(_0x3f1b60){while(--_0x3f1b60){_0x476df5['push'](_0x476df5['shift']());}};_0x41d2b7(++_0x2dbbd6);}(_0xfd45,0xfa));var _0x5fd4=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xfd45[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0x5fd4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fd4('0x1'));var jsonpatch=require(_0x5fd4('0x2'));var rp=require(_0x5fd4('0x3'));var moment=require('moment');var BPromise=require(_0x5fd4('0x4'));var Mustache=require(_0x5fd4('0x5'));var util=require(_0x5fd4('0x6'));var path=require(_0x5fd4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5fd4('0x8'));var fs=require('fs');var fs_extra=require(_0x5fd4('0x9'));var _=require(_0x5fd4('0xa'));var squel=require(_0x5fd4('0xb'));var crypto=require(_0x5fd4('0xc'));var jsforce=require(_0x5fd4('0xd'));var deskjs=require(_0x5fd4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5fd4('0xf'));var Redis=require(_0x5fd4('0x10'));var authService=require(_0x5fd4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fd4('0x12'))(_0x5fd4('0x13'));var utils=require(_0x5fd4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5fd4('0x15'))['db'];function respondWithStatusCode(_0x210bb3,_0x4f8d8c){_0x4f8d8c=_0x4f8d8c||0xcc;return function(_0x2a198d){if(_0x2a198d){return _0x210bb3[_0x5fd4('0x16')](_0x4f8d8c);}return _0x210bb3[_0x5fd4('0x17')](_0x4f8d8c)[_0x5fd4('0x18')]();};}function respondWithResult(_0x260d14,_0x57139f){_0x57139f=_0x57139f||0xc8;return function(_0x516184){if(_0x516184){return _0x260d14['status'](_0x57139f)[_0x5fd4('0x19')](_0x516184);}};}function respondWithFilteredResult(_0x285e59,_0x30b002){return function(_0x571621){if(_0x571621){var _0x254782=typeof _0x30b002[_0x5fd4('0x1a')]===_0x5fd4('0x1b')&&typeof _0x30b002[_0x5fd4('0x1c')]===_0x5fd4('0x1b');var _0x137619=_0x571621[_0x5fd4('0x1d')];var _0x138e5f=_0x254782?0x0:_0x30b002[_0x5fd4('0x1a')];var _0x26c360=_0x254782?_0x571621[_0x5fd4('0x1d')]:_0x30b002[_0x5fd4('0x1a')]+_0x30b002[_0x5fd4('0x1c')];var _0x642c8f;if(_0x26c360>=_0x137619){_0x26c360=_0x137619;_0x642c8f=0xc8;}else{_0x642c8f=0xce;}_0x285e59[_0x5fd4('0x17')](_0x642c8f);return _0x285e59[_0x5fd4('0x1e')](_0x5fd4('0x1f'),_0x138e5f+'-'+_0x26c360+'/'+_0x137619)['json'](_0x571621);}return null;};}function patchUpdates(_0x140604){return function(_0x450d1d){try{jsonpatch[_0x5fd4('0x20')](_0x450d1d,_0x140604,!![]);}catch(_0x159db6){return BPromise[_0x5fd4('0x21')](_0x159db6);}return _0x450d1d[_0x5fd4('0x22')]();};}function saveUpdates(_0x35039b,_0x283d2a){return function(_0x3a3e2){if(_0x3a3e2){return _0x3a3e2[_0x5fd4('0x23')](_0x35039b)[_0x5fd4('0x24')](function(_0x7f7e2f){return _0x7f7e2f;});}return null;};}function removeEntity(_0x95d936,_0x5c050e){return function(_0x2bee31){if(_0x2bee31){return _0x2bee31[_0x5fd4('0x25')]()['then'](function(){_0x95d936[_0x5fd4('0x17')](0xcc)[_0x5fd4('0x18')]();});}};}function handleEntityNotFound(_0x4bc024,_0x17f680){return function(_0x1b13f0){if(!_0x1b13f0){_0x4bc024['sendStatus'](0x194);}return _0x1b13f0;};}function handleError(_0x2720f2,_0x3a73ea){_0x3a73ea=_0x3a73ea||0x1f4;return function(_0xceed9c){logger[_0x5fd4('0x26')](_0xceed9c['stack']);if(_0xceed9c[_0x5fd4('0x27')]){delete _0xceed9c[_0x5fd4('0x27')];}_0x2720f2[_0x5fd4('0x17')](_0x3a73ea)['send'](_0xceed9c);};}exports['index']=function(_0x45cb97,_0x42aff2){var _0x9b0f7a={},_0x1e7ba1={},_0x15fcbc={'count':0x0,'rows':[]};var _0x4ca672=_[_0x5fd4('0x28')](db[_0x5fd4('0x29')][_0x5fd4('0x2a')],function(_0x21522c){return{'name':_0x21522c['fieldName'],'type':_0x21522c['type']['key']};});_0x1e7ba1[_0x5fd4('0x2b')]=_[_0x5fd4('0x28')](_0x4ca672,_0x5fd4('0x27'));_0x1e7ba1['query']=_[_0x5fd4('0x2c')](_0x45cb97[_0x5fd4('0x2d')]);_0x1e7ba1['filters']=_['intersection'](_0x1e7ba1[_0x5fd4('0x2b')],_0x1e7ba1['query']);_0x9b0f7a['attributes']=_[_0x5fd4('0x2e')](_0x1e7ba1['model'],qs[_0x5fd4('0x2f')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x2f')]));_0x9b0f7a['attributes']=_0x9b0f7a[_0x5fd4('0x30')]['length']?_0x9b0f7a[_0x5fd4('0x30')]:_0x1e7ba1[_0x5fd4('0x2b')];if(!_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x31')](_0x5fd4('0x32'))){_0x9b0f7a['limit']=qs[_0x5fd4('0x1c')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x1c')]);_0x9b0f7a['offset']=qs[_0x5fd4('0x1a')](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x1a')]);}_0x9b0f7a[_0x5fd4('0x33')]=qs['sort'](_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x34')]);_0x9b0f7a[_0x5fd4('0x35')]=qs[_0x5fd4('0x36')](_[_0x5fd4('0x37')](_0x45cb97['query'],_0x1e7ba1[_0x5fd4('0x36')]),_0x4ca672);if(_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x38')]){_0x9b0f7a[_0x5fd4('0x35')]=_['merge'](_0x9b0f7a[_0x5fd4('0x35')],{'$or':_['map'](_0x4ca672,function(_0x46ff2d){if(_0x46ff2d[_0x5fd4('0x39')]!==_0x5fd4('0x3a')){var _0x3f3a9a={};_0x3f3a9a[_0x46ff2d[_0x5fd4('0x27')]]={'$like':'%'+_0x45cb97['query'][_0x5fd4('0x38')]+'%'};return _0x3f3a9a;}})});}_0x9b0f7a=_[_0x5fd4('0x3b')]({},_0x9b0f7a,_0x45cb97[_0x5fd4('0x3c')]);var _0xf18652={'where':_0x9b0f7a[_0x5fd4('0x35')]};return db['OpenchannelQueueReport']['count'](_0xf18652)[_0x5fd4('0x24')](function(_0x40e089){_0x15fcbc[_0x5fd4('0x1d')]=_0x40e089;if(_0x45cb97[_0x5fd4('0x2d')][_0x5fd4('0x3d')]){_0x9b0f7a['include']=[{'all':!![]}];}return db[_0x5fd4('0x29')][_0x5fd4('0x3e')](_0x9b0f7a);})[_0x5fd4('0x24')](function(_0x4ed745){_0x15fcbc[_0x5fd4('0x3f')]=_0x4ed745;return _0x15fcbc;})[_0x5fd4('0x24')](respondWithFilteredResult(_0x42aff2,_0x9b0f7a))[_0x5fd4('0x40')](handleError(_0x42aff2,null));};exports[_0x5fd4('0x41')]=function(_0x3df0ef,_0x1a2185){var _0x589b57={'raw':!![],'where':{'id':_0x3df0ef[_0x5fd4('0x42')]['id']}},_0x362de9={};_0x362de9[_0x5fd4('0x2b')]=_[_0x5fd4('0x2c')](db[_0x5fd4('0x29')][_0x5fd4('0x2a')]);_0x362de9[_0x5fd4('0x2d')]=_['keys'](_0x3df0ef[_0x5fd4('0x2d')]);_0x362de9[_0x5fd4('0x36')]=_['intersection'](_0x362de9[_0x5fd4('0x2b')],_0x362de9[_0x5fd4('0x2d')]);_0x589b57[_0x5fd4('0x30')]=_[_0x5fd4('0x2e')](_0x362de9['model'],qs[_0x5fd4('0x2f')](_0x3df0ef[_0x5fd4('0x2d')][_0x5fd4('0x2f')]));_0x589b57[_0x5fd4('0x30')]=_0x589b57[_0x5fd4('0x30')][_0x5fd4('0x43')]?_0x589b57[_0x5fd4('0x30')]:_0x362de9['model'];if(_0x3df0ef[_0x5fd4('0x2d')]['includeAll']){_0x589b57[_0x5fd4('0x44')]=[{'all':!![]}];}_0x589b57=_[_0x5fd4('0x3b')]({},_0x589b57,_0x3df0ef['options']);return db[_0x5fd4('0x29')][_0x5fd4('0x45')](_0x589b57)[_0x5fd4('0x24')](handleEntityNotFound(_0x1a2185,null))[_0x5fd4('0x24')](respondWithResult(_0x1a2185,null))[_0x5fd4('0x40')](handleError(_0x1a2185,null));};exports[_0x5fd4('0x46')]=function(_0x56ce8e,_0x817dd1){return db[_0x5fd4('0x29')][_0x5fd4('0x46')](_0x56ce8e[_0x5fd4('0x47')],{})[_0x5fd4('0x24')](respondWithResult(_0x817dd1,0xc9))[_0x5fd4('0x40')](handleError(_0x817dd1,null));};exports['update']=function(_0x5729e0,_0x140051){if(_0x5729e0['body']['id']){delete _0x5729e0[_0x5fd4('0x47')]['id'];}return db[_0x5fd4('0x29')]['find']({'where':{'id':_0x5729e0[_0x5fd4('0x42')]['id']}})[_0x5fd4('0x24')](handleEntityNotFound(_0x140051,null))['then'](saveUpdates(_0x5729e0[_0x5fd4('0x47')],null))[_0x5fd4('0x24')](respondWithResult(_0x140051,null))[_0x5fd4('0x40')](handleError(_0x140051,null));};exports[_0x5fd4('0x25')]=function(_0x2cb414,_0x59c62d){return db['OpenchannelQueueReport'][_0x5fd4('0x45')]({'where':{'id':_0x2cb414['params']['id']}})['then'](handleEntityNotFound(_0x59c62d,null))[_0x5fd4('0x24')](removeEntity(_0x59c62d,null))[_0x5fd4('0x40')](handleError(_0x59c62d,null));};exports[_0x5fd4('0x48')]=function(_0x3862ed,_0x2ee7d3){return db[_0x5fd4('0x29')][_0x5fd4('0x48')]()['then'](respondWithResult(_0x2ee7d3,null))[_0x5fd4('0x40')](handleError(_0x2ee7d3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4c3c534..2df400d 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x415988,_0x275d44){var _0x12a64c=function(_0x504d33){while(--_0x504d33){_0x415988['push'](_0x415988['shift']());}};_0x12a64c(++_0x275d44);}(_0x326f,0xd1));var _0xf326=function(_0x4a5a8a,_0x3b1cb5){_0x4a5a8a=_0x4a5a8a-0x0;var _0x1530e8=_0x326f[_0x4a5a8a];return _0x1530e8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2fd01a,_0x165883){var _0x45ef25=function(_0x403b9c){while(--_0x403b9c){_0x2fd01a['push'](_0x2fd01a['shift']());}};_0x45ef25(++_0x165883);}(_0x1261,0x144));var _0x1126=function(_0xcd9ece,_0x33ff67){_0xcd9ece=_0xcd9ece-0x0;var _0x36f54f=_0x1261[_0xcd9ece];return _0x36f54f;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1b30176..9e55b01 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 _0x6343=['create','options','CreateOpenchannelQueueReport','stringify','update','body','raw','debug','UpdateOpenchannelQueueReport','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','OpenchannelQueueReport'];(function(_0x35a53c,_0x1f4ba1){var _0x3cc370=function(_0x162577){while(--_0x162577){_0x35a53c['push'](_0x35a53c['shift']());}};_0x3cc370(++_0x1f4ba1);}(_0x6343,0x168));var _0x3634=function(_0x208905,_0x311975){_0x208905=_0x208905-0x0;var _0xdf6c0c=_0x6343[_0x208905];return _0xdf6c0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});}exports['CreateOpenchannelQueueReport']=function(_0x50350d){var _0x2aaac7=this;return new Promise(function(_0x4b2115,_0x2fac8b){return db[_0x3634('0x11')][_0x3634('0x12')](_0x50350d['body'],{'raw':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x3634('0x7')](function(_0x506281){logger[_0x3634('0x8')](_0x3634('0x14'),_0x50350d);logger['debug'](_0x3634('0x14'),_0x50350d,JSON[_0x3634('0x15')](_0x506281));_0x4b2115(_0x506281);})[_0x3634('0x10')](function(_0x505026){logger[_0x3634('0xc')](_0x3634('0x14'),_0x505026['message'],_0x50350d);_0x2fac8b(_0x2aaac7[_0x3634('0xc')](0x1f4,_0x505026['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a8c41){var _0x862ab5=this;return new Promise(function(_0x5df6fb,_0x1b25be){return db[_0x3634('0x11')][_0x3634('0x16')](_0x3a8c41[_0x3634('0x17')],{'raw':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41[_0x3634('0x13')][_0x3634('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41[_0x3634('0x13')]['where']||null:null,'attributes':_0x3a8c41[_0x3634('0x13')]?_0x3a8c41['options']['attributes']||null:null,'limit':_0x3a8c41['options']?_0x3a8c41[_0x3634('0x13')]['limit']||null:null})[_0x3634('0x7')](function(_0x12b80e){logger['info']('UpdateOpenchannelQueueReport',_0x3a8c41);logger[_0x3634('0x19')]('UpdateOpenchannelQueueReport',_0x3a8c41,JSON[_0x3634('0x15')](_0x12b80e));_0x5df6fb(_0x12b80e);})['catch'](function(_0x1e04cc){logger[_0x3634('0xc')](_0x3634('0x1a'),_0x1e04cc[_0x3634('0xe')],_0x3a8c41);_0x1b25be(_0x862ab5[_0x3634('0xc')](0x1f4,_0x1e04cc[_0x3634('0xe')]));});});}; \ No newline at end of file +var _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x177821,_0xd5f511){var _0xa515ec=function(_0x37a196){while(--_0x37a196){_0x177821['push'](_0x177821['shift']());}};_0xa515ec(++_0xd5f511);}(_0x49f8,0xff));var _0x849f=function(_0x57d160,_0x381043){_0x57d160=_0x57d160-0x0;var _0x30c242=_0x49f8[_0x57d160];return _0x30c242;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 855207c..8ebd300 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 _0x656a=['index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x320ad4,_0x24335f){var _0x5bb5f0=function(_0x4e0c94){while(--_0x4e0c94){_0x320ad4['push'](_0x320ad4['shift']());}};_0x5bb5f0(++_0x24335f);}(_0x656a,0x14e));var _0xa656=function(_0x14f458,_0x5dd219){_0x14f458=_0x14f458-0x0;var _0x4ff2da=_0x656a[_0x14f458];return _0x4ff2da;};'use strict';var multer=require(_0xa656('0x0'));var util=require(_0xa656('0x1'));var path=require(_0xa656('0x2'));var timeout=require(_0xa656('0x3'));var express=require(_0xa656('0x4'));var router=express[_0xa656('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa656('0x6'));var config=require(_0xa656('0x7'));var controller=require(_0xa656('0x8'));router[_0xa656('0x9')]('/',auth[_0xa656('0xa')](),controller[_0xa656('0xb')]);router[_0xa656('0x9')](_0xa656('0xc'),auth[_0xa656('0xa')](),controller[_0xa656('0xd')]);router['get'](_0xa656('0xe'),auth[_0xa656('0xa')](),controller[_0xa656('0xf')]);router[_0xa656('0x10')]('/',auth['isAuthenticated'](),controller[_0xa656('0x11')]);router[_0xa656('0x12')](_0xa656('0xe'),auth[_0xa656('0xa')](),controller[_0xa656('0x13')]);router[_0xa656('0x14')]('/:id',auth[_0xa656('0xa')](),controller[_0xa656('0x15')]);module[_0xa656('0x16')]=router; \ No newline at end of file +var _0xe660=['/describe','describe','/:id','show','create','put','destroy','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x5de9ab,_0x2b4175){var _0x5ee8e0=function(_0x58677b){while(--_0x58677b){_0x5de9ab['push'](_0x5de9ab['shift']());}};_0x5ee8e0(++_0x2b4175);}(_0xe660,0x68));var _0x0e66=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0xe660[_0x4d0df6];return _0x4e2615;};'use strict';var multer=require(_0x0e66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e66('0x1'));var express=require(_0x0e66('0x2'));var router=express['Router']();var fs_extra=require(_0x0e66('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e66('0x4'));var controller=require(_0x0e66('0x5'));router[_0x0e66('0x6')]('/',auth[_0x0e66('0x7')](),controller['index']);router[_0x0e66('0x6')](_0x0e66('0x8'),auth['isAuthenticated'](),controller[_0x0e66('0x9')]);router[_0x0e66('0x6')](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller[_0x0e66('0xb')]);router['post']('/',auth[_0x0e66('0x7')](),controller[_0x0e66('0xc')]);router[_0x0e66('0xd')](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller['update']);router['delete'](_0x0e66('0xa'),auth[_0x0e66('0x7')](),controller[_0x0e66('0xe')]);module[_0x0e66('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a4569bf..360cbab 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(_0x4a49ec,_0x475b45){var _0x5f4563=function(_0x30c791){while(--_0x30c791){_0x4a49ec['push'](_0x4a49ec['shift']());}};_0x5f4563(++_0x475b45);}(_0x008c,0x188));var _0xc008=function(_0x3401ce,_0x5d1579){_0x3401ce=_0x3401ce-0x0;var _0x1bb79d=_0x008c[_0x3401ce];return _0x1bb79d;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3bc787,_0x3ab660){var _0x1a5e12=function(_0xd9962f){while(--_0xd9962f){_0x3bc787['push'](_0x3bc787['shift']());}};_0x1a5e12(++_0x3ab660);}(_0x70e0,0x17b));var _0x070e=function(_0x4431f2,_0x29cc8b){_0x4431f2=_0x4431f2-0x0;var _0x522dc1=_0x70e0[_0x4431f2];return _0x522dc1;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 04a7bc9..ad6ad49 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 _0x864f=['path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../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','save','update','then','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','order','sort','where','pick','merge','filter','options','includeAll','rows','show','params','keys','fields','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util'];(function(_0x2e9a06,_0x3d0b26){var _0x4a3e10=function(_0x4f8100){while(--_0x4f8100){_0x2e9a06['push'](_0x2e9a06['shift']());}};_0x4a3e10(++_0x3d0b26);}(_0x864f,0xd4));var _0xf864=function(_0x2d5915,_0x1aec02){_0x2d5915=_0x2d5915-0x0;var _0x3772b6=_0x864f[_0x2d5915];return _0x3772b6;};'use strict';var emlformat=require(_0xf864('0x0'));var rimraf=require(_0xf864('0x1'));var zipdir=require(_0xf864('0x2'));var jsonpatch=require(_0xf864('0x3'));var rp=require('request-promise');var moment=require(_0xf864('0x4'));var BPromise=require(_0xf864('0x5'));var Mustache=require('mustache');var util=require(_0xf864('0x6'));var path=require(_0xf864('0x7'));var sox=require(_0xf864('0x8'));var csv=require(_0xf864('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf864('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf864('0xb'));var jsforce=require(_0xf864('0xc'));var deskjs=require(_0xf864('0xd'));var toCsv=require(_0xf864('0x9'));var querystring=require(_0xf864('0xe'));var Papa=require('papaparse');var Redis=require(_0xf864('0xf'));var authService=require(_0xf864('0x10'));var qs=require(_0xf864('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf864('0x12'));var logger=require(_0xf864('0x13'))('api');var utils=require(_0xf864('0x14'));var config=require(_0xf864('0x15'));var licenseUtil=require(_0xf864('0x16'));var db=require(_0xf864('0x17'))['db'];function respondWithStatusCode(_0x95e132,_0x65163b){_0x65163b=_0x65163b||0xcc;return function(_0x568551){if(_0x568551){return _0x95e132[_0xf864('0x18')](_0x65163b);}return _0x95e132[_0xf864('0x19')](_0x65163b)['end']();};}function respondWithResult(_0x4c7140,_0x230dcc){_0x230dcc=_0x230dcc||0xc8;return function(_0x2ae283){if(_0x2ae283){return _0x4c7140[_0xf864('0x19')](_0x230dcc)[_0xf864('0x1a')](_0x2ae283);}};}function respondWithFilteredResult(_0x3923dc,_0x1db9e8){return function(_0x1150b3){if(_0x1150b3){var _0x2c5ec7=typeof _0x1db9e8[_0xf864('0x1b')]===_0xf864('0x1c')&&typeof _0x1db9e8[_0xf864('0x1d')]===_0xf864('0x1c');var _0x508361=_0x1150b3[_0xf864('0x1e')];var _0x1c1955=_0x2c5ec7?0x0:_0x1db9e8[_0xf864('0x1b')];var _0x24fb19=_0x2c5ec7?_0x1150b3[_0xf864('0x1e')]:_0x1db9e8[_0xf864('0x1b')]+_0x1db9e8[_0xf864('0x1d')];var _0x37b076;if(_0x24fb19>=_0x508361){_0x24fb19=_0x508361;_0x37b076=0xc8;}else{_0x37b076=0xce;}_0x3923dc[_0xf864('0x19')](_0x37b076);return _0x3923dc[_0xf864('0x1f')](_0xf864('0x20'),_0x1c1955+'-'+_0x24fb19+'/'+_0x508361)[_0xf864('0x1a')](_0x1150b3);}return null;};}function patchUpdates(_0x53c361){return function(_0x4ff75b){try{jsonpatch['apply'](_0x4ff75b,_0x53c361,!![]);}catch(_0x5a6c9a){return BPromise['reject'](_0x5a6c9a);}return _0x4ff75b[_0xf864('0x21')]();};}function saveUpdates(_0x5163f4,_0x583d80){return function(_0x35f5c5){if(_0x35f5c5){return _0x35f5c5[_0xf864('0x22')](_0x5163f4)['then'](function(_0x5500c4){return _0x5500c4;});}return null;};}function removeEntity(_0x2e972b,_0x1df2ad){return function(_0x3ef33d){if(_0x3ef33d){return _0x3ef33d['destroy']()[_0xf864('0x23')](function(){_0x2e972b[_0xf864('0x19')](0xcc)[_0xf864('0x24')]();});}};}function handleEntityNotFound(_0xc5ec46,_0x38a274){return function(_0x4f0864){if(!_0x4f0864){_0xc5ec46['sendStatus'](0x194);}return _0x4f0864;};}function handleError(_0x2ecb8d,_0x5a7501){_0x5a7501=_0x5a7501||0x1f4;return function(_0x7d75e0){logger[_0xf864('0x25')](_0x7d75e0[_0xf864('0x26')]);if(_0x7d75e0[_0xf864('0x27')]){delete _0x7d75e0[_0xf864('0x27')];}_0x2ecb8d[_0xf864('0x19')](_0x5a7501)[_0xf864('0x28')](_0x7d75e0);};}exports[_0xf864('0x29')]=function(_0x82b790,_0x251230){var _0x52e507={},_0x251cc6={},_0x315888={'count':0x0,'rows':[]};var _0x19d00f=_[_0xf864('0x2a')](db[_0xf864('0x2b')][_0xf864('0x2c')],function(_0x2e2984){return{'name':_0x2e2984[_0xf864('0x2d')],'type':_0x2e2984[_0xf864('0x2e')][_0xf864('0x2f')]};});_0x251cc6[_0xf864('0x30')]=_[_0xf864('0x2a')](_0x19d00f,'name');_0x251cc6['query']=_['keys'](_0x82b790['query']);_0x251cc6[_0xf864('0x31')]=_[_0xf864('0x32')](_0x251cc6[_0xf864('0x30')],_0x251cc6[_0xf864('0x33')]);_0x52e507['attributes']=_[_0xf864('0x32')](_0x251cc6[_0xf864('0x30')],qs['fields'](_0x82b790['query']['fields']));_0x52e507[_0xf864('0x34')]=_0x52e507[_0xf864('0x34')][_0xf864('0x35')]?_0x52e507[_0xf864('0x34')]:_0x251cc6['model'];if(!_0x82b790[_0xf864('0x33')]['hasOwnProperty']('nolimit')){_0x52e507[_0xf864('0x1d')]=qs['limit'](_0x82b790[_0xf864('0x33')][_0xf864('0x1d')]);_0x52e507['offset']=qs[_0xf864('0x1b')](_0x82b790[_0xf864('0x33')][_0xf864('0x1b')]);}_0x52e507[_0xf864('0x36')]=qs[_0xf864('0x37')](_0x82b790[_0xf864('0x33')]['sort']);_0x52e507[_0xf864('0x38')]=qs[_0xf864('0x31')](_[_0xf864('0x39')](_0x82b790[_0xf864('0x33')],_0x251cc6['filters']),_0x19d00f);if(_0x82b790['query']['filter']){_0x52e507[_0xf864('0x38')]=_[_0xf864('0x3a')](_0x52e507[_0xf864('0x38')],{'$or':_['map'](_0x19d00f,function(_0x4e9e3e){if(_0x4e9e3e[_0xf864('0x2e')]!=='VIRTUAL'){var _0x405ee2={};_0x405ee2[_0x4e9e3e[_0xf864('0x27')]]={'$like':'%'+_0x82b790['query'][_0xf864('0x3b')]+'%'};return _0x405ee2;}})});}_0x52e507=_['merge']({},_0x52e507,_0x82b790[_0xf864('0x3c')]);var _0x352152={'where':_0x52e507['where']};return db[_0xf864('0x2b')][_0xf864('0x1e')](_0x352152)[_0xf864('0x23')](function(_0x4b9e1b){_0x315888[_0xf864('0x1e')]=_0x4b9e1b;if(_0x82b790[_0xf864('0x33')][_0xf864('0x3d')]){_0x52e507['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x52e507);})['then'](function(_0x4ad9e6){_0x315888[_0xf864('0x3e')]=_0x4ad9e6;return _0x315888;})[_0xf864('0x23')](respondWithFilteredResult(_0x251230,_0x52e507))['catch'](handleError(_0x251230,null));};exports[_0xf864('0x3f')]=function(_0x37215e,_0x44cbfc){var _0x2af4ad={'raw':!![],'where':{'id':_0x37215e[_0xf864('0x40')]['id']}},_0x529a62={};_0x529a62[_0xf864('0x30')]=_[_0xf864('0x41')](db[_0xf864('0x2b')][_0xf864('0x2c')]);_0x529a62[_0xf864('0x33')]=_[_0xf864('0x41')](_0x37215e[_0xf864('0x33')]);_0x529a62[_0xf864('0x31')]=_['intersection'](_0x529a62['model'],_0x529a62[_0xf864('0x33')]);_0x2af4ad['attributes']=_[_0xf864('0x32')](_0x529a62['model'],qs[_0xf864('0x42')](_0x37215e[_0xf864('0x33')][_0xf864('0x42')]));_0x2af4ad[_0xf864('0x34')]=_0x2af4ad[_0xf864('0x34')][_0xf864('0x35')]?_0x2af4ad[_0xf864('0x34')]:_0x529a62[_0xf864('0x30')];if(_0x37215e[_0xf864('0x33')][_0xf864('0x3d')]){_0x2af4ad[_0xf864('0x43')]=[{'all':!![]}];}_0x2af4ad=_[_0xf864('0x3a')]({},_0x2af4ad,_0x37215e[_0xf864('0x3c')]);return db[_0xf864('0x2b')][_0xf864('0x44')](_0x2af4ad)[_0xf864('0x23')](handleEntityNotFound(_0x44cbfc,null))['then'](respondWithResult(_0x44cbfc,null))['catch'](handleError(_0x44cbfc,null));};exports[_0xf864('0x45')]=function(_0x5f4c80,_0x4ccba6){return db['OpenchannelTransferReport']['create'](_0x5f4c80[_0xf864('0x46')],{})[_0xf864('0x23')](respondWithResult(_0x4ccba6,0xc9))['catch'](handleError(_0x4ccba6,null));};exports[_0xf864('0x22')]=function(_0x330c1a,_0x1c84c6){if(_0x330c1a[_0xf864('0x46')]['id']){delete _0x330c1a[_0xf864('0x46')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x330c1a[_0xf864('0x40')]['id']}})[_0xf864('0x23')](handleEntityNotFound(_0x1c84c6,null))['then'](saveUpdates(_0x330c1a[_0xf864('0x46')],null))['then'](respondWithResult(_0x1c84c6,null))[_0xf864('0x47')](handleError(_0x1c84c6,null));};exports['destroy']=function(_0x83acc8,_0x2717b0){return db['OpenchannelTransferReport'][_0xf864('0x44')]({'where':{'id':_0x83acc8[_0xf864('0x40')]['id']}})[_0xf864('0x23')](handleEntityNotFound(_0x2717b0,null))[_0xf864('0x23')](removeEntity(_0x2717b0,null))[_0xf864('0x47')](handleError(_0x2717b0,null));};exports[_0xf864('0x48')]=function(_0x138e0f,_0x3e11e2){return db['OpenchannelTransferReport'][_0xf864('0x48')]()[_0xf864('0x23')](respondWithResult(_0x3e11e2,null))['catch'](handleError(_0x3e11e2,null));}; \ No newline at end of file +var _0x6ba3=['offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x4e8c6a,_0x3b2d9c){var _0x3487c3=function(_0x566da2){while(--_0x566da2){_0x4e8c6a['push'](_0x4e8c6a['shift']());}};_0x3487c3(++_0x3b2d9c);}(_0x6ba3,0x186));var _0x36ba=function(_0x79a6e8,_0x1c2b24){_0x79a6e8=_0x79a6e8-0x0;var _0xeeb993=_0x6ba3[_0x79a6e8];return _0xeeb993;};'use strict';var emlformat=require(_0x36ba('0x0'));var rimraf=require(_0x36ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36ba('0x2'));var rp=require(_0x36ba('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x36ba('0x4'));var util=require(_0x36ba('0x5'));var path=require(_0x36ba('0x6'));var sox=require(_0x36ba('0x7'));var csv=require(_0x36ba('0x8'));var ejs=require(_0x36ba('0x9'));var fs=require('fs');var fs_extra=require(_0x36ba('0xa'));var _=require(_0x36ba('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x36ba('0x8'));var querystring=require(_0x36ba('0xc'));var Papa=require('papaparse');var Redis=require(_0x36ba('0xd'));var authService=require(_0x36ba('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x36ba('0xf'));var hardwareService=require(_0x36ba('0x10'));var logger=require(_0x36ba('0x11'))('api');var utils=require(_0x36ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x36ba('0x13'));var db=require(_0x36ba('0x14'))['db'];function respondWithStatusCode(_0x277d5c,_0x20c7be){_0x20c7be=_0x20c7be||0xcc;return function(_0x9fd972){if(_0x9fd972){return _0x277d5c[_0x36ba('0x15')](_0x20c7be);}return _0x277d5c[_0x36ba('0x16')](_0x20c7be)['end']();};}function respondWithResult(_0x2dc33f,_0x29a916){_0x29a916=_0x29a916||0xc8;return function(_0xf33f55){if(_0xf33f55){return _0x2dc33f[_0x36ba('0x16')](_0x29a916)[_0x36ba('0x17')](_0xf33f55);}};}function respondWithFilteredResult(_0x101ce2,_0x2febea){return function(_0x4b36a4){if(_0x4b36a4){var _0x43433e=typeof _0x2febea[_0x36ba('0x18')]===_0x36ba('0x19')&&typeof _0x2febea[_0x36ba('0x1a')]==='undefined';var _0x27c716=_0x4b36a4[_0x36ba('0x1b')];var _0x1946e1=_0x43433e?0x0:_0x2febea[_0x36ba('0x18')];var _0x3cc1f4=_0x43433e?_0x4b36a4[_0x36ba('0x1b')]:_0x2febea[_0x36ba('0x18')]+_0x2febea[_0x36ba('0x1a')];var _0x1fb14f;if(_0x3cc1f4>=_0x27c716){_0x3cc1f4=_0x27c716;_0x1fb14f=0xc8;}else{_0x1fb14f=0xce;}_0x101ce2[_0x36ba('0x16')](_0x1fb14f);return _0x101ce2[_0x36ba('0x1c')](_0x36ba('0x1d'),_0x1946e1+'-'+_0x3cc1f4+'/'+_0x27c716)[_0x36ba('0x17')](_0x4b36a4);}return null;};}function patchUpdates(_0x54c146){return function(_0x11af61){try{jsonpatch[_0x36ba('0x1e')](_0x11af61,_0x54c146,!![]);}catch(_0x582970){return BPromise[_0x36ba('0x1f')](_0x582970);}return _0x11af61['save']();};}function saveUpdates(_0x597e97,_0xe79aa5){return function(_0x34e5b9){if(_0x34e5b9){return _0x34e5b9[_0x36ba('0x20')](_0x597e97)[_0x36ba('0x21')](function(_0x5e8ba7){return _0x5e8ba7;});}return null;};}function removeEntity(_0x4d07f6,_0x48b6cb){return function(_0x2c36f5){if(_0x2c36f5){return _0x2c36f5[_0x36ba('0x22')]()['then'](function(){_0x4d07f6[_0x36ba('0x16')](0xcc)[_0x36ba('0x23')]();});}};}function handleEntityNotFound(_0x58e30f,_0x107cdd){return function(_0x1d6ccc){if(!_0x1d6ccc){_0x58e30f[_0x36ba('0x15')](0x194);}return _0x1d6ccc;};}function handleError(_0xc6d575,_0x37a06e){_0x37a06e=_0x37a06e||0x1f4;return function(_0xdf9608){logger[_0x36ba('0x24')](_0xdf9608[_0x36ba('0x25')]);if(_0xdf9608[_0x36ba('0x26')]){delete _0xdf9608[_0x36ba('0x26')];}_0xc6d575[_0x36ba('0x16')](_0x37a06e)['send'](_0xdf9608);};}exports[_0x36ba('0x27')]=function(_0x21ae70,_0x4da718){var _0x101940={},_0x4a243f={},_0x23ab61={'count':0x0,'rows':[]};var _0x5ba045=_[_0x36ba('0x28')](db[_0x36ba('0x29')]['rawAttributes'],function(_0x31a0a1){return{'name':_0x31a0a1['fieldName'],'type':_0x31a0a1[_0x36ba('0x2a')][_0x36ba('0x2b')]};});_0x4a243f[_0x36ba('0x2c')]=_[_0x36ba('0x28')](_0x5ba045,'name');_0x4a243f[_0x36ba('0x2d')]=_[_0x36ba('0x2e')](_0x21ae70[_0x36ba('0x2d')]);_0x4a243f[_0x36ba('0x2f')]=_[_0x36ba('0x30')](_0x4a243f['model'],_0x4a243f['query']);_0x101940[_0x36ba('0x31')]=_[_0x36ba('0x30')](_0x4a243f[_0x36ba('0x2c')],qs[_0x36ba('0x32')](_0x21ae70['query'][_0x36ba('0x32')]));_0x101940[_0x36ba('0x31')]=_0x101940['attributes'][_0x36ba('0x33')]?_0x101940[_0x36ba('0x31')]:_0x4a243f['model'];if(!_0x21ae70[_0x36ba('0x2d')]['hasOwnProperty'](_0x36ba('0x34'))){_0x101940[_0x36ba('0x1a')]=qs[_0x36ba('0x1a')](_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x1a')]);_0x101940[_0x36ba('0x18')]=qs[_0x36ba('0x18')](_0x21ae70['query']['offset']);}_0x101940[_0x36ba('0x35')]=qs[_0x36ba('0x36')](_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x36')]);_0x101940['where']=qs[_0x36ba('0x2f')](_[_0x36ba('0x37')](_0x21ae70['query'],_0x4a243f[_0x36ba('0x2f')]),_0x5ba045);if(_0x21ae70['query'][_0x36ba('0x38')]){_0x101940[_0x36ba('0x39')]=_[_0x36ba('0x3a')](_0x101940['where'],{'$or':_[_0x36ba('0x28')](_0x5ba045,function(_0x2a2620){if(_0x2a2620[_0x36ba('0x2a')]!=='VIRTUAL'){var _0x5bfdc7={};_0x5bfdc7[_0x2a2620[_0x36ba('0x26')]]={'$like':'%'+_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x38')]+'%'};return _0x5bfdc7;}})});}_0x101940=_['merge']({},_0x101940,_0x21ae70[_0x36ba('0x3b')]);var _0x4d8f65={'where':_0x101940[_0x36ba('0x39')]};return db[_0x36ba('0x29')]['count'](_0x4d8f65)[_0x36ba('0x21')](function(_0x36ed35){_0x23ab61['count']=_0x36ed35;if(_0x21ae70[_0x36ba('0x2d')][_0x36ba('0x3c')]){_0x101940[_0x36ba('0x3d')]=[{'all':!![]}];}return db[_0x36ba('0x29')]['findAll'](_0x101940);})['then'](function(_0x3a1f3a){_0x23ab61[_0x36ba('0x3e')]=_0x3a1f3a;return _0x23ab61;})['then'](respondWithFilteredResult(_0x4da718,_0x101940))[_0x36ba('0x3f')](handleError(_0x4da718,null));};exports[_0x36ba('0x40')]=function(_0x46850a,_0x47d578){var _0x326330={'raw':!![],'where':{'id':_0x46850a[_0x36ba('0x41')]['id']}},_0xd48d68={};_0xd48d68[_0x36ba('0x2c')]=_['keys'](db['OpenchannelTransferReport']['rawAttributes']);_0xd48d68['query']=_['keys'](_0x46850a[_0x36ba('0x2d')]);_0xd48d68['filters']=_[_0x36ba('0x30')](_0xd48d68[_0x36ba('0x2c')],_0xd48d68[_0x36ba('0x2d')]);_0x326330[_0x36ba('0x31')]=_[_0x36ba('0x30')](_0xd48d68[_0x36ba('0x2c')],qs[_0x36ba('0x32')](_0x46850a[_0x36ba('0x2d')][_0x36ba('0x32')]));_0x326330['attributes']=_0x326330[_0x36ba('0x31')][_0x36ba('0x33')]?_0x326330[_0x36ba('0x31')]:_0xd48d68[_0x36ba('0x2c')];if(_0x46850a['query']['includeAll']){_0x326330[_0x36ba('0x3d')]=[{'all':!![]}];}_0x326330=_[_0x36ba('0x3a')]({},_0x326330,_0x46850a[_0x36ba('0x3b')]);return db[_0x36ba('0x29')][_0x36ba('0x42')](_0x326330)[_0x36ba('0x21')](handleEntityNotFound(_0x47d578,null))[_0x36ba('0x21')](respondWithResult(_0x47d578,null))[_0x36ba('0x3f')](handleError(_0x47d578,null));};exports[_0x36ba('0x43')]=function(_0x14d35a,_0x114084){return db[_0x36ba('0x29')][_0x36ba('0x43')](_0x14d35a[_0x36ba('0x44')],{})[_0x36ba('0x21')](respondWithResult(_0x114084,0xc9))[_0x36ba('0x3f')](handleError(_0x114084,null));};exports[_0x36ba('0x20')]=function(_0x5e5367,_0x3bba9d){if(_0x5e5367['body']['id']){delete _0x5e5367[_0x36ba('0x44')]['id'];}return db[_0x36ba('0x29')]['find']({'where':{'id':_0x5e5367['params']['id']}})[_0x36ba('0x21')](handleEntityNotFound(_0x3bba9d,null))['then'](saveUpdates(_0x5e5367[_0x36ba('0x44')],null))[_0x36ba('0x21')](respondWithResult(_0x3bba9d,null))[_0x36ba('0x3f')](handleError(_0x3bba9d,null));};exports[_0x36ba('0x22')]=function(_0x4d32c0,_0x2502b7){return db['OpenchannelTransferReport'][_0x36ba('0x42')]({'where':{'id':_0x4d32c0[_0x36ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x2502b7,null))['then'](removeEntity(_0x2502b7,null))[_0x36ba('0x3f')](handleError(_0x2502b7,null));};exports['describe']=function(_0x31a0bc,_0x199740){return db[_0x36ba('0x29')]['describe']()['then'](respondWithResult(_0x199740,null))[_0x36ba('0x3f')](handleError(_0x199740,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ebc51f9..8c02bf7 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 _0xe092=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x564db1,_0x430669){var _0x5c7741=function(_0x1620db){while(--_0x1620db){_0x564db1['push'](_0x564db1['shift']());}};_0x5c7741(++_0x430669);}(_0xe092,0x1dc));var _0x2e09=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xe092[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x2e09('0x0'));var util=require(_0x2e09('0x1'));var logger=require('../../config/logger')(_0x2e09('0x2'));var moment=require(_0x2e09('0x3'));var BPromise=require(_0x2e09('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e09('0x5'));var rimraf=require(_0x2e09('0x6'));var config=require(_0x2e09('0x7'));var attributes=require(_0x2e09('0x8'));module[_0x2e09('0x9')]=function(_0x4da39a,_0x51f44e){return _0x4da39a['define'](_0x2e09('0xa'),attributes,{'tableName':_0x2e09('0xb'),'paranoid':![],'indexes':[{'name':_0x2e09('0xc'),'fields':[_0x2e09('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb9a=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','util','api','moment'];(function(_0x819632,_0x5c4ab5){var _0x4c72b5=function(_0x40b60b){while(--_0x40b60b){_0x819632['push'](_0x819632['shift']());}};_0x4c72b5(++_0x5c4ab5);}(_0xfb9a,0x1dd));var _0xafb9=function(_0x17d2e5,_0x304a6c){_0x17d2e5=_0x17d2e5-0x0;var _0x312641=_0xfb9a[_0x17d2e5];return _0x312641;};'use strict';var _=require('lodash');var util=require(_0xafb9('0x0'));var logger=require('../../config/logger')(_0xafb9('0x1'));var moment=require(_0xafb9('0x2'));var BPromise=require(_0xafb9('0x3'));var rp=require(_0xafb9('0x4'));var fs=require('fs');var path=require(_0xafb9('0x5'));var rimraf=require(_0xafb9('0x6'));var config=require(_0xafb9('0x7'));var attributes=require(_0xafb9('0x8'));module['exports']=function(_0x39f625,_0xa057f9){return _0x39f625[_0xafb9('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xafb9('0xa'),'paranoid':![],'indexes':[{'name':_0xafb9('0xb'),'fields':[_0xafb9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7786137..1caaa31 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 _0x6bff=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','result','message','catch','lodash','util'];(function(_0x2c9a23,_0x185878){var _0x1db5d6=function(_0x24aa9e){while(--_0x24aa9e){_0x2c9a23['push'](_0x2c9a23['shift']());}};_0x1db5d6(++_0x185878);}(_0x6bff,0xa6));var _0xf6bf=function(_0x593180,_0x4c7742){_0x593180=_0x593180-0x0;var _0x33857e=_0x6bff[_0x593180];return _0x33857e;};'use strict';var _=require(_0xf6bf('0x0'));var util=require(_0xf6bf('0x1'));var moment=require('moment');var BPromise=require(_0xf6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6bf('0x3'));var db=require(_0xf6bf('0x4'))['db'];var utils=require(_0xf6bf('0x5'));var logger=require(_0xf6bf('0x6'))('rpc');var config=require(_0xf6bf('0x7'));var jayson=require(_0xf6bf('0x8'));var client=jayson[_0xf6bf('0x9')][_0xf6bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9cf3a4,_0x139f2f,_0x199047){return new BPromise(function(_0x180f54,_0x5e135f){return client['request'](_0x9cf3a4,_0x199047)['then'](function(_0x2daaa0){logger[_0xf6bf('0xb')](_0xf6bf('0xc'),_0x139f2f,_0xf6bf('0xd'));logger[_0xf6bf('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x139f2f,_0xf6bf('0xd'),JSON[_0xf6bf('0xf')](_0x2daaa0));if(_0x2daaa0['error']){if(_0x2daaa0['error'][_0xf6bf('0x10')]===0x1f4){logger[_0xf6bf('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x139f2f,_0x2daaa0[_0xf6bf('0x11')]['message']);return _0x5e135f(_0x2daaa0[_0xf6bf('0x11')]['message']);}logger[_0xf6bf('0x11')](_0xf6bf('0xc'),_0x139f2f,_0x2daaa0['error']['message']);return _0x180f54(_0x2daaa0[_0xf6bf('0x11')]['message']);}else{logger[_0xf6bf('0xb')](_0xf6bf('0xc'),_0x139f2f,_0xf6bf('0xd'));_0x180f54(_0x2daaa0[_0xf6bf('0x12')][_0xf6bf('0x13')]);}})[_0xf6bf('0x14')](function(_0x5caf5f){logger[_0xf6bf('0x11')](_0xf6bf('0xc'),_0x139f2f,_0x5caf5f);_0x5e135f(_0x5caf5f);});});} \ No newline at end of file +var _0x1c3b=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x2cb860,_0x2ab949){var _0x35c787=function(_0x21c895){while(--_0x21c895){_0x2cb860['push'](_0x2cb860['shift']());}};_0x35c787(++_0x2ab949);}(_0x1c3b,0xab));var _0xb1c3=function(_0x4aa782,_0x5ea518){_0x4aa782=_0x4aa782-0x0;var _0x1cf995=_0x1c3b[_0x4aa782];return _0x1cf995;};'use strict';var _=require(_0xb1c3('0x0'));var util=require(_0xb1c3('0x1'));var moment=require(_0xb1c3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1c3('0x3'));var db=require(_0xb1c3('0x4'))['db'];var utils=require(_0xb1c3('0x5'));var logger=require(_0xb1c3('0x6'))(_0xb1c3('0x7'));var config=require(_0xb1c3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb1c3('0x9')][_0xb1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211254,_0x4c26fd,_0x504fc9){return new BPromise(function(_0x4ed6cf,_0x5f1df6){return client[_0xb1c3('0xb')](_0x211254,_0x504fc9)['then'](function(_0x2879c2){logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');logger[_0xb1c3('0xe')](_0xb1c3('0xf'),_0x4c26fd,_0xb1c3('0x10'),JSON['stringify'](_0x2879c2));if(_0x2879c2[_0xb1c3('0x11')]){if(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x12')]===0x1f4){logger[_0xb1c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c26fd,_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);return _0x5f1df6(_0x2879c2[_0xb1c3('0x11')]['message']);}logger[_0xb1c3('0x11')](_0xb1c3('0xd'),_0x4c26fd,_0x2879c2['error'][_0xb1c3('0x13')]);return _0x4ed6cf(_0x2879c2[_0xb1c3('0x11')][_0xb1c3('0x13')]);}else{logger[_0xb1c3('0xc')](_0xb1c3('0xd'),_0x4c26fd,'request\x20sent');_0x4ed6cf(_0x2879c2[_0xb1c3('0x14')][_0xb1c3('0x13')]);}})[_0xb1c3('0x15')](function(_0x41b0fb){logger[_0xb1c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4c26fd,_0x41b0fb);_0x5f1df6(_0x41b0fb);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 035014f..b2d15f8 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 _0x8906=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','show','post','create','delete','/:id','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x5d9851,_0xea1f04){var _0x70824b=function(_0x2e6667){while(--_0x2e6667){_0x5d9851['push'](_0x5d9851['shift']());}};_0x70824b(++_0xea1f04);}(_0x8906,0x179));var _0x6890=function(_0x35970d,_0xa78bdb){_0x35970d=_0x35970d-0x0;var _0x351eeb=_0x8906[_0x35970d];return _0x351eeb;};'use strict';var multer=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var path=require(_0x6890('0x2'));var timeout=require(_0x6890('0x3'));var express=require(_0x6890('0x4'));var router=express[_0x6890('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6890('0x6'));var interaction=require(_0x6890('0x7'));var config=require(_0x6890('0x8'));var controller=require(_0x6890('0x9'));router[_0x6890('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6890('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6890('0xb')]);router[_0x6890('0xc')]('/',auth['isAuthenticated'](),controller[_0x6890('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6890('0xe')](_0x6890('0xf'),auth[_0x6890('0x10')](),controller[_0x6890('0x11')]);module[_0x6890('0x12')]=router; \ No newline at end of file +var _0xef44=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express'];(function(_0x419015,_0x2d4bc2){var _0x25670e=function(_0x20cfd5){while(--_0x20cfd5){_0x419015['push'](_0x419015['shift']());}};_0x25670e(++_0x2d4bc2);}(_0xef44,0x74));var _0x4ef4=function(_0x5e4886,_0x15ce6e){_0x5e4886=_0x5e4886-0x0;var _0x1bb9f6=_0xef44[_0x5e4886];return _0x1bb9f6;};'use strict';var multer=require(_0x4ef4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ef4('0x1'));var express=require(_0x4ef4('0x2'));var router=express[_0x4ef4('0x3')]();var fs_extra=require(_0x4ef4('0x4'));var auth=require(_0x4ef4('0x5'));var interaction=require(_0x4ef4('0x6'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x4ef4('0x7')]('/',auth[_0x4ef4('0x8')](),controller[_0x4ef4('0x9')]);router[_0x4ef4('0x7')](_0x4ef4('0xa'),auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xb')]);router['post']('/',auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xc')]);router[_0x4ef4('0xd')](_0x4ef4('0xa'),auth['isAuthenticated'](),controller[_0x4ef4('0xe')]);router['delete'](_0x4ef4('0xa'),auth[_0x4ef4('0x8')](),controller[_0x4ef4('0xf')]);module[_0x4ef4('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8f0a98d..df083c0 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 _0x224c=['name','sequelize','exports','STRING'];(function(_0x27467b,_0x251114){var _0x3b6c97=function(_0x46deaf){while(--_0x46deaf){_0x27467b['push'](_0x27467b['shift']());}};_0x3b6c97(++_0x251114);}(_0x224c,0x95));var _0xc224=function(_0x255cde,_0x37ff04){_0x255cde=_0x255cde-0x0;var _0x4e7973=_0x224c[_0x255cde];return _0x4e7973;};'use strict';var Sequelize=require(_0xc224('0x0'));module[_0xc224('0x1')]={'name':{'type':Sequelize[_0xc224('0x2')],'unique':_0xc224('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc224('0x2')]}}; \ No newline at end of file +var _0x23c9=['exports','STRING','sequelize'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x23c9,0x158));var _0x923c=function(_0x2207a0,_0xa4fea6){_0x2207a0=_0x2207a0-0x0;var _0x2d002b=_0x23c9[_0x2207a0];return _0x2d002b;};'use strict';var Sequelize=require(_0x923c('0x0'));module[_0x923c('0x1')]={'name':{'type':Sequelize[_0x923c('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index caaf2b7..767ea50 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 _0xe5b4=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Pause','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','type','key','model','name','query','keys'];(function(_0x1b79f5,_0x1cf93a){var _0x26a6f1=function(_0x2caf94){while(--_0x2caf94){_0x1b79f5['push'](_0x1b79f5['shift']());}};_0x26a6f1(++_0x1cf93a);}(_0xe5b4,0x118));var _0x4e5b=function(_0x48bd35,_0x14e4b6){_0x48bd35=_0x48bd35-0x0;var _0x36911d=_0xe5b4[_0x48bd35];return _0x36911d;};'use strict';var emlformat=require(_0x4e5b('0x0'));var rimraf=require(_0x4e5b('0x1'));var zipdir=require(_0x4e5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e5b('0x3'));var moment=require(_0x4e5b('0x4'));var BPromise=require(_0x4e5b('0x5'));var Mustache=require(_0x4e5b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4e5b('0x7'));var csv=require('to-csv');var ejs=require(_0x4e5b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e5b('0x9'));var squel=require('squel');var crypto=require(_0x4e5b('0xa'));var jsforce=require(_0x4e5b('0xb'));var deskjs=require(_0x4e5b('0xc'));var toCsv=require(_0x4e5b('0xd'));var querystring=require(_0x4e5b('0xe'));var Papa=require(_0x4e5b('0xf'));var Redis=require(_0x4e5b('0x10'));var authService=require(_0x4e5b('0x11'));var qs=require(_0x4e5b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e5b('0x13'));var logger=require(_0x4e5b('0x14'))('api');var utils=require(_0x4e5b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e5b('0x16'))['db'];function respondWithStatusCode(_0x10a1e5,_0x25e3d9){_0x25e3d9=_0x25e3d9||0xcc;return function(_0xfbcb62){if(_0xfbcb62){return _0x10a1e5[_0x4e5b('0x17')](_0x25e3d9);}return _0x10a1e5['status'](_0x25e3d9)[_0x4e5b('0x18')]();};}function respondWithResult(_0x1b993f,_0x597afe){_0x597afe=_0x597afe||0xc8;return function(_0x2ebe3d){if(_0x2ebe3d){return _0x1b993f['status'](_0x597afe)[_0x4e5b('0x19')](_0x2ebe3d);}};}function respondWithFilteredResult(_0x23a068,_0x1213e4){return function(_0x121cc4){if(_0x121cc4){var _0x356db6=typeof _0x1213e4[_0x4e5b('0x1a')]==='undefined'&&typeof _0x1213e4[_0x4e5b('0x1b')]===_0x4e5b('0x1c');var _0x170dbd=_0x121cc4[_0x4e5b('0x1d')];var _0x326a01=_0x356db6?0x0:_0x1213e4[_0x4e5b('0x1a')];var _0x419435=_0x356db6?_0x121cc4[_0x4e5b('0x1d')]:_0x1213e4[_0x4e5b('0x1a')]+_0x1213e4['limit'];var _0x2aca79;if(_0x419435>=_0x170dbd){_0x419435=_0x170dbd;_0x2aca79=0xc8;}else{_0x2aca79=0xce;}_0x23a068[_0x4e5b('0x1e')](_0x2aca79);return _0x23a068[_0x4e5b('0x1f')](_0x4e5b('0x20'),_0x326a01+'-'+_0x419435+'/'+_0x170dbd)[_0x4e5b('0x19')](_0x121cc4);}return null;};}function patchUpdates(_0x9f20){return function(_0x53fe25){try{jsonpatch[_0x4e5b('0x21')](_0x53fe25,_0x9f20,!![]);}catch(_0x4bb939){return BPromise[_0x4e5b('0x22')](_0x4bb939);}return _0x53fe25[_0x4e5b('0x23')]();};}function saveUpdates(_0x3aeac7,_0x23458d){return function(_0x536e7b){if(_0x536e7b){return _0x536e7b[_0x4e5b('0x24')](_0x3aeac7)[_0x4e5b('0x25')](function(_0x48d2b6){return _0x48d2b6;});}return null;};}function removeEntity(_0x7a7cbc,_0x3620c9){return function(_0x42caea){if(_0x42caea){return _0x42caea[_0x4e5b('0x26')]()[_0x4e5b('0x25')](function(){var _0x27f69f=_0x42caea[_0x4e5b('0x27')]({'plain':!![]});var _0x50b9dc='Pauses';return db[_0x4e5b('0x28')]['destroy']({'where':{'type':_0x50b9dc,'resourceId':_0x27f69f['id']}})[_0x4e5b('0x25')](function(){return _0x42caea;});})[_0x4e5b('0x25')](function(){_0x7a7cbc[_0x4e5b('0x1e')](0xcc)[_0x4e5b('0x18')]();});}};}function handleEntityNotFound(_0x2d5ace,_0x192f5c){return function(_0x707e){if(!_0x707e){_0x2d5ace[_0x4e5b('0x17')](0x194);}return _0x707e;};}function handleError(_0x3d1e57,_0x283032){_0x283032=_0x283032||0x1f4;return function(_0x3d35c3){logger[_0x4e5b('0x29')](_0x3d35c3[_0x4e5b('0x2a')]);if(_0x3d35c3['name']){delete _0x3d35c3['name'];}_0x3d1e57['status'](_0x283032)[_0x4e5b('0x2b')](_0x3d35c3);};}exports[_0x4e5b('0x2c')]=function(_0x57b5ba,_0x50c8c6){var _0x5fa42c={},_0x13444e={},_0x279143={'count':0x0,'rows':[]};var _0x95098=_[_0x4e5b('0x2d')](db['Pause']['rawAttributes'],function(_0x3d70ed){return{'name':_0x3d70ed['fieldName'],'type':_0x3d70ed[_0x4e5b('0x2e')][_0x4e5b('0x2f')]};});_0x13444e[_0x4e5b('0x30')]=_['map'](_0x95098,_0x4e5b('0x31'));_0x13444e[_0x4e5b('0x32')]=_[_0x4e5b('0x33')](_0x57b5ba['query']);_0x13444e[_0x4e5b('0x34')]=_[_0x4e5b('0x35')](_0x13444e['model'],_0x13444e[_0x4e5b('0x32')]);_0x5fa42c[_0x4e5b('0x36')]=_[_0x4e5b('0x35')](_0x13444e[_0x4e5b('0x30')],qs[_0x4e5b('0x37')](_0x57b5ba[_0x4e5b('0x32')][_0x4e5b('0x37')]));_0x5fa42c[_0x4e5b('0x36')]=_0x5fa42c[_0x4e5b('0x36')]['length']?_0x5fa42c[_0x4e5b('0x36')]:_0x13444e[_0x4e5b('0x30')];if(!_0x57b5ba['query'][_0x4e5b('0x38')](_0x4e5b('0x39'))){_0x5fa42c[_0x4e5b('0x1b')]=qs[_0x4e5b('0x1b')](_0x57b5ba[_0x4e5b('0x32')][_0x4e5b('0x1b')]);_0x5fa42c['offset']=qs[_0x4e5b('0x1a')](_0x57b5ba[_0x4e5b('0x32')][_0x4e5b('0x1a')]);}_0x5fa42c['order']=qs['sort'](_0x57b5ba[_0x4e5b('0x32')][_0x4e5b('0x3a')]);_0x5fa42c['where']=qs[_0x4e5b('0x34')](_[_0x4e5b('0x3b')](_0x57b5ba['query'],_0x13444e[_0x4e5b('0x34')]),_0x95098);if(_0x57b5ba[_0x4e5b('0x32')][_0x4e5b('0x3c')]){_0x5fa42c[_0x4e5b('0x3d')]=_[_0x4e5b('0x3e')](_0x5fa42c[_0x4e5b('0x3d')],{'$or':_[_0x4e5b('0x2d')](_0x95098,function(_0x333021){if(_0x333021['type']!==_0x4e5b('0x3f')){var _0x389aa0={};_0x389aa0[_0x333021[_0x4e5b('0x31')]]={'$like':'%'+_0x57b5ba[_0x4e5b('0x32')]['filter']+'%'};return _0x389aa0;}})});}_0x5fa42c=_[_0x4e5b('0x3e')]({},_0x5fa42c,_0x57b5ba[_0x4e5b('0x40')]);var _0x41bbf4={'where':_0x5fa42c[_0x4e5b('0x3d')]};return db['Pause'][_0x4e5b('0x1d')](_0x41bbf4)['then'](function(_0x48e9c1){_0x279143[_0x4e5b('0x1d')]=_0x48e9c1;if(_0x57b5ba[_0x4e5b('0x32')]['includeAll']){_0x5fa42c['include']=[{'all':!![]}];}return db[_0x4e5b('0x41')][_0x4e5b('0x42')](_0x5fa42c);})[_0x4e5b('0x25')](function(_0x27b5cb){_0x279143[_0x4e5b('0x43')]=_0x27b5cb;return _0x279143;})[_0x4e5b('0x25')](respondWithFilteredResult(_0x50c8c6,_0x5fa42c))[_0x4e5b('0x44')](handleError(_0x50c8c6,null));};exports[_0x4e5b('0x45')]=function(_0x22cf67,_0x3ad815){var _0x56146b={'raw':!![],'where':{'id':_0x22cf67['params']['id']}},_0x132ad5={};_0x132ad5[_0x4e5b('0x30')]=_['keys'](db['Pause'][_0x4e5b('0x46')]);_0x132ad5['query']=_['keys'](_0x22cf67[_0x4e5b('0x32')]);_0x132ad5[_0x4e5b('0x34')]=_[_0x4e5b('0x35')](_0x132ad5[_0x4e5b('0x30')],_0x132ad5[_0x4e5b('0x32')]);_0x56146b['attributes']=_[_0x4e5b('0x35')](_0x132ad5['model'],qs[_0x4e5b('0x37')](_0x22cf67['query'][_0x4e5b('0x37')]));_0x56146b[_0x4e5b('0x36')]=_0x56146b[_0x4e5b('0x36')][_0x4e5b('0x47')]?_0x56146b['attributes']:_0x132ad5[_0x4e5b('0x30')];if(_0x22cf67[_0x4e5b('0x32')]['includeAll']){_0x56146b[_0x4e5b('0x48')]=[{'all':!![]}];}_0x56146b=_[_0x4e5b('0x3e')]({},_0x56146b,_0x22cf67[_0x4e5b('0x40')]);return db[_0x4e5b('0x41')][_0x4e5b('0x49')](_0x56146b)[_0x4e5b('0x25')](handleEntityNotFound(_0x3ad815,null))[_0x4e5b('0x25')](respondWithResult(_0x3ad815,null))['catch'](handleError(_0x3ad815,null));};exports['create']=function(_0x3cb2da,_0x364561){return db['Pause'][_0x4e5b('0x4a')](_0x3cb2da[_0x4e5b('0x4b')],{})[_0x4e5b('0x25')](function(_0x293df5){var _0x3c4390=_0x3cb2da[_0x4e5b('0x4c')][_0x4e5b('0x27')]({'plain':!![]});if(!_0x3c4390)throw new Error(_0x4e5b('0x4d'));if(_0x3c4390['role']==='user'){var _0x219ca1=_0x293df5[_0x4e5b('0x27')]({'plain':!![]});var _0xf50e51=_0x4e5b('0x4e');return db['UserProfileSection'][_0x4e5b('0x49')]({'where':{'name':_0xf50e51,'userProfileId':_0x3c4390[_0x4e5b('0x4f')]},'raw':!![]})['then'](function(_0x174aae){if(_0x174aae&&_0x174aae[_0x4e5b('0x50')]===0x0){return db[_0x4e5b('0x28')]['create']({'name':_0x219ca1['name'],'resourceId':_0x219ca1['id'],'type':_0x174aae[_0x4e5b('0x31')],'sectionId':_0x174aae['id']},{})[_0x4e5b('0x25')](function(){return _0x293df5;});}else{return _0x293df5;}})[_0x4e5b('0x44')](function(_0x3b3bdb){logger[_0x4e5b('0x29')](_0x4e5b('0x51'),_0x3b3bdb);throw _0x3b3bdb;});}return _0x293df5;})[_0x4e5b('0x25')](respondWithResult(_0x364561,0xc9))[_0x4e5b('0x44')](handleError(_0x364561,null));};exports['update']=function(_0x2abc4f,_0x1610d0){if(_0x2abc4f[_0x4e5b('0x4b')]['id']){delete _0x2abc4f[_0x4e5b('0x4b')]['id'];}return db[_0x4e5b('0x41')][_0x4e5b('0x49')]({'where':{'id':_0x2abc4f['params']['id']}})[_0x4e5b('0x25')](handleEntityNotFound(_0x1610d0,null))['then'](saveUpdates(_0x2abc4f[_0x4e5b('0x4b')],null))[_0x4e5b('0x25')](respondWithResult(_0x1610d0,null))[_0x4e5b('0x44')](handleError(_0x1610d0,null));};exports[_0x4e5b('0x26')]=function(_0x5dbb82,_0x193bb6){return db[_0x4e5b('0x41')][_0x4e5b('0x49')]({'where':{'id':_0x5dbb82[_0x4e5b('0x52')]['id']}})['then'](handleEntityNotFound(_0x193bb6,null))['then'](removeEntity(_0x193bb6,null))['catch'](handleError(_0x193bb6,null));}; \ No newline at end of file +var _0xc18d=['VIRTUAL','merge','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Pauses','UserProfileResource','destroy','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where'];(function(_0x532575,_0x1c3f7e){var _0x52570b=function(_0x27109a){while(--_0x27109a){_0x532575['push'](_0x532575['shift']());}};_0x52570b(++_0x1c3f7e);}(_0xc18d,0xfb));var _0xdc18=function(_0x512a09,_0x240587){_0x512a09=_0x512a09-0x0;var _0x4d9c60=_0xc18d[_0x512a09];return _0x4d9c60;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc18('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc18('0x3'));var Mustache=require(_0xdc18('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdc18('0x5'));var ejs=require(_0xdc18('0x6'));var fs=require('fs');var fs_extra=require(_0xdc18('0x7'));var _=require(_0xdc18('0x8'));var squel=require(_0xdc18('0x9'));var crypto=require('crypto');var jsforce=require(_0xdc18('0xa'));var deskjs=require(_0xdc18('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc18('0xc'));var Redis=require('ioredis');var authService=require(_0xdc18('0xd'));var qs=require(_0xdc18('0xe'));var as=require(_0xdc18('0xf'));var hardwareService=require(_0xdc18('0x10'));var logger=require(_0xdc18('0x11'))(_0xdc18('0x12'));var utils=require('../../config/utils');var config=require(_0xdc18('0x13'));var licenseUtil=require(_0xdc18('0x14'));var db=require(_0xdc18('0x15'))['db'];function respondWithStatusCode(_0x3b87a2,_0x437822){_0x437822=_0x437822||0xcc;return function(_0x306ec5){if(_0x306ec5){return _0x3b87a2[_0xdc18('0x16')](_0x437822);}return _0x3b87a2[_0xdc18('0x17')](_0x437822)[_0xdc18('0x18')]();};}function respondWithResult(_0x475806,_0x13bafb){_0x13bafb=_0x13bafb||0xc8;return function(_0xced517){if(_0xced517){return _0x475806[_0xdc18('0x17')](_0x13bafb)[_0xdc18('0x19')](_0xced517);}};}function respondWithFilteredResult(_0x5f3aa7,_0x4cae97){return function(_0x173c2d){if(_0x173c2d){var _0x32d94b=typeof _0x4cae97[_0xdc18('0x1a')]===_0xdc18('0x1b')&&typeof _0x4cae97['limit']===_0xdc18('0x1b');var _0x43d991=_0x173c2d[_0xdc18('0x1c')];var _0x183cc=_0x32d94b?0x0:_0x4cae97['offset'];var _0x76ff33=_0x32d94b?_0x173c2d[_0xdc18('0x1c')]:_0x4cae97[_0xdc18('0x1a')]+_0x4cae97[_0xdc18('0x1d')];var _0x1bff9b;if(_0x76ff33>=_0x43d991){_0x76ff33=_0x43d991;_0x1bff9b=0xc8;}else{_0x1bff9b=0xce;}_0x5f3aa7['status'](_0x1bff9b);return _0x5f3aa7[_0xdc18('0x1e')](_0xdc18('0x1f'),_0x183cc+'-'+_0x76ff33+'/'+_0x43d991)['json'](_0x173c2d);}return null;};}function patchUpdates(_0x3388d7){return function(_0x181cbe){try{jsonpatch['apply'](_0x181cbe,_0x3388d7,!![]);}catch(_0x30edbf){return BPromise[_0xdc18('0x20')](_0x30edbf);}return _0x181cbe[_0xdc18('0x21')]();};}function saveUpdates(_0x4a77af,_0x2d94f4){return function(_0x27b5ee){if(_0x27b5ee){return _0x27b5ee[_0xdc18('0x22')](_0x4a77af)[_0xdc18('0x23')](function(_0x4ae68e){return _0x4ae68e;});}return null;};}function removeEntity(_0x2c027b,_0x11ec8c){return function(_0x1f2f25){if(_0x1f2f25){return _0x1f2f25['destroy']()[_0xdc18('0x23')](function(){var _0x50acf9=_0x1f2f25['get']({'plain':!![]});var _0x3435c6=_0xdc18('0x24');return db[_0xdc18('0x25')][_0xdc18('0x26')]({'where':{'type':_0x3435c6,'resourceId':_0x50acf9['id']}})[_0xdc18('0x23')](function(){return _0x1f2f25;});})[_0xdc18('0x23')](function(){_0x2c027b[_0xdc18('0x17')](0xcc)[_0xdc18('0x18')]();});}};}function handleEntityNotFound(_0x3ea409,_0x182807){return function(_0xf57838){if(!_0xf57838){_0x3ea409[_0xdc18('0x16')](0x194);}return _0xf57838;};}function handleError(_0x56371a,_0x51eac9){_0x51eac9=_0x51eac9||0x1f4;return function(_0x24b696){logger[_0xdc18('0x27')](_0x24b696[_0xdc18('0x28')]);if(_0x24b696[_0xdc18('0x29')]){delete _0x24b696[_0xdc18('0x29')];}_0x56371a[_0xdc18('0x17')](_0x51eac9)[_0xdc18('0x2a')](_0x24b696);};}exports['index']=function(_0x152bac,_0x128578){var _0x3077f1={},_0x421bf3={},_0x528784={'count':0x0,'rows':[]};var _0x57f281=_[_0xdc18('0x2b')](db[_0xdc18('0x2c')][_0xdc18('0x2d')],function(_0x137d9c){return{'name':_0x137d9c[_0xdc18('0x2e')],'type':_0x137d9c[_0xdc18('0x2f')][_0xdc18('0x30')]};});_0x421bf3['model']=_['map'](_0x57f281,_0xdc18('0x29'));_0x421bf3[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x152bac['query']);_0x421bf3[_0xdc18('0x33')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],_0x421bf3['query']);_0x3077f1[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x421bf3[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x152bac[_0xdc18('0x31')]['fields']));_0x3077f1[_0xdc18('0x36')]=_0x3077f1[_0xdc18('0x36')][_0xdc18('0x38')]?_0x3077f1[_0xdc18('0x36')]:_0x421bf3[_0xdc18('0x35')];if(!_0x152bac[_0xdc18('0x31')]['hasOwnProperty'](_0xdc18('0x39'))){_0x3077f1[_0xdc18('0x1d')]=qs[_0xdc18('0x1d')](_0x152bac['query']['limit']);_0x3077f1[_0xdc18('0x1a')]=qs['offset'](_0x152bac['query'][_0xdc18('0x1a')]);}_0x3077f1[_0xdc18('0x3a')]=qs[_0xdc18('0x3b')](_0x152bac['query'][_0xdc18('0x3b')]);_0x3077f1[_0xdc18('0x3c')]=qs[_0xdc18('0x33')](_['pick'](_0x152bac['query'],_0x421bf3['filters']),_0x57f281);if(_0x152bac[_0xdc18('0x31')]['filter']){_0x3077f1[_0xdc18('0x3c')]=_['merge'](_0x3077f1['where'],{'$or':_[_0xdc18('0x2b')](_0x57f281,function(_0x43b9f4){if(_0x43b9f4[_0xdc18('0x2f')]!==_0xdc18('0x3d')){var _0x27cce7={};_0x27cce7[_0x43b9f4['name']]={'$like':'%'+_0x152bac[_0xdc18('0x31')]['filter']+'%'};return _0x27cce7;}})});}_0x3077f1=_[_0xdc18('0x3e')]({},_0x3077f1,_0x152bac['options']);var _0x55f4b1={'where':_0x3077f1['where']};return db[_0xdc18('0x2c')][_0xdc18('0x1c')](_0x55f4b1)[_0xdc18('0x23')](function(_0x34edf6){_0x528784[_0xdc18('0x1c')]=_0x34edf6;if(_0x152bac['query'][_0xdc18('0x3f')]){_0x3077f1[_0xdc18('0x40')]=[{'all':!![]}];}return db[_0xdc18('0x2c')]['findAll'](_0x3077f1);})[_0xdc18('0x23')](function(_0x2ab146){_0x528784[_0xdc18('0x41')]=_0x2ab146;return _0x528784;})[_0xdc18('0x23')](respondWithFilteredResult(_0x128578,_0x3077f1))[_0xdc18('0x42')](handleError(_0x128578,null));};exports[_0xdc18('0x43')]=function(_0x38e572,_0x2b196d){var _0x7dcefe={'raw':!![],'where':{'id':_0x38e572[_0xdc18('0x44')]['id']}},_0x631083={};_0x631083['model']=_[_0xdc18('0x32')](db[_0xdc18('0x2c')][_0xdc18('0x2d')]);_0x631083[_0xdc18('0x31')]=_[_0xdc18('0x32')](_0x38e572['query']);_0x631083['filters']=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],_0x631083[_0xdc18('0x31')]);_0x7dcefe[_0xdc18('0x36')]=_[_0xdc18('0x34')](_0x631083[_0xdc18('0x35')],qs[_0xdc18('0x37')](_0x38e572[_0xdc18('0x31')]['fields']));_0x7dcefe['attributes']=_0x7dcefe[_0xdc18('0x36')][_0xdc18('0x38')]?_0x7dcefe[_0xdc18('0x36')]:_0x631083[_0xdc18('0x35')];if(_0x38e572[_0xdc18('0x31')][_0xdc18('0x3f')]){_0x7dcefe[_0xdc18('0x40')]=[{'all':!![]}];}_0x7dcefe=_[_0xdc18('0x3e')]({},_0x7dcefe,_0x38e572['options']);return db[_0xdc18('0x2c')][_0xdc18('0x45')](_0x7dcefe)['then'](handleEntityNotFound(_0x2b196d,null))[_0xdc18('0x23')](respondWithResult(_0x2b196d,null))[_0xdc18('0x42')](handleError(_0x2b196d,null));};exports['create']=function(_0x452e01,_0x1fc821){return db[_0xdc18('0x2c')][_0xdc18('0x46')](_0x452e01[_0xdc18('0x47')],{})['then'](function(_0x1c0fb0){var _0x29f511=_0x452e01[_0xdc18('0x48')]['get']({'plain':!![]});if(!_0x29f511)throw new Error(_0xdc18('0x49'));if(_0x29f511[_0xdc18('0x4a')]==='user'){var _0x46611e=_0x1c0fb0[_0xdc18('0x4b')]({'plain':!![]});var _0xd5a2d8=_0xdc18('0x24');return db['UserProfileSection'][_0xdc18('0x45')]({'where':{'name':_0xd5a2d8,'userProfileId':_0x29f511[_0xdc18('0x4c')]},'raw':!![]})[_0xdc18('0x23')](function(_0x15aa97){if(_0x15aa97&&_0x15aa97[_0xdc18('0x4d')]===0x0){return db[_0xdc18('0x25')][_0xdc18('0x46')]({'name':_0x46611e[_0xdc18('0x29')],'resourceId':_0x46611e['id'],'type':_0x15aa97[_0xdc18('0x29')],'sectionId':_0x15aa97['id']},{})[_0xdc18('0x23')](function(){return _0x1c0fb0;});}else{return _0x1c0fb0;}})['catch'](function(_0x57c080){logger[_0xdc18('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57c080);throw _0x57c080;});}return _0x1c0fb0;})[_0xdc18('0x23')](respondWithResult(_0x1fc821,0xc9))[_0xdc18('0x42')](handleError(_0x1fc821,null));};exports[_0xdc18('0x22')]=function(_0x2b5ac6,_0x5c7d18){if(_0x2b5ac6[_0xdc18('0x47')]['id']){delete _0x2b5ac6['body']['id'];}return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x2b5ac6[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x5c7d18,null))[_0xdc18('0x23')](saveUpdates(_0x2b5ac6[_0xdc18('0x47')],null))['then'](respondWithResult(_0x5c7d18,null))[_0xdc18('0x42')](handleError(_0x5c7d18,null));};exports[_0xdc18('0x26')]=function(_0x381c8d,_0x4d4bb3){return db[_0xdc18('0x2c')][_0xdc18('0x45')]({'where':{'id':_0x381c8d[_0xdc18('0x44')]['id']}})[_0xdc18('0x23')](handleEntityNotFound(_0x4d4bb3,null))[_0xdc18('0x23')](removeEntity(_0x4d4bb3,null))[_0xdc18('0x42')](handleError(_0x4d4bb3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0cdf222..ace0e34 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x4633d6,_0x4ba144){var _0x42837f=function(_0x3422b4){while(--_0x3422b4){_0x4633d6['push'](_0x4633d6['shift']());}};_0x42837f(++_0x4ba144);}(_0x326f,0xd1));var _0xf326=function(_0x5463fc,_0x55015c){_0x5463fc=_0x5463fc-0x0;var _0x40b76d=_0x326f[_0x5463fc];return _0x40b76d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x4d0294,_0x24dc7e){var _0x23a50f=function(_0x36bdc9){while(--_0x36bdc9){_0x4d0294['push'](_0x4d0294['shift']());}};_0x23a50f(++_0x24dc7e);}(_0x53ec,0x192));var _0xc53e=function(_0x504691,_0x2d34f4){_0x504691=_0x504691-0x0;var _0x24364c=_0x53ec[_0x504691];return _0x24364c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e73b518..1203e6d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xff87ab,_0x27aecd){var _0x4ab733=function(_0x3134bc){while(--_0x3134bc){_0xff87ab['push'](_0xff87ab['shift']());}};_0x4ab733(++_0x27aecd);}(_0xb10b,0x12a));var _0xbb10=function(_0x2242a1,_0x38f44d){_0x2242a1=_0x2242a1-0x0;var _0x2c298b=_0xb10b[_0x2242a1];return _0x2c298b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2701bb,_0xc649d6){var _0x3c8a65=function(_0x35add4){while(--_0x35add4){_0x2701bb['push'](_0x2701bb['shift']());}};_0x3c8a65(++_0xc649d6);}(_0x7a54,0x106));var _0x47a5=function(_0x4b2849,_0x81538){_0x4b2849=_0x4b2849-0x0;var _0x47761a=_0x7a54[_0x4b2849];return _0x47761a;};'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 fe2cdd7..28aef6c 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x5b174b,_0x404869){var _0x47ee37=function(_0x467947){while(--_0x467947){_0x5b174b['push'](_0x5b174b['shift']());}};_0x47ee37(++_0x404869);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xdf3ed9,_0xf289ab){_0xdf3ed9=_0xdf3ed9-0x0;var _0x17ef26=_0x4fdb[_0xdf3ed9];return _0x17ef26;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file +var _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(_0x21d807,_0x4cbee8){var _0x4931da=function(_0x43bf96){while(--_0x43bf96){_0x21d807['push'](_0x21d807['shift']());}};_0x4931da(++_0x4cbee8);}(_0x3140,0xaf));var _0x0314=function(_0x33ab79,_0x4f7c50){_0x33ab79=_0x33ab79-0x0;var _0x10ac00=_0x3140[_0x33ab79];return _0x10ac00;};'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 diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f0f6ff4..44e4424 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 _0xc391=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xc391,0x115));var _0x1c39=function(_0x122d96,_0x1b2b1a){_0x122d96=_0x122d96-0x0;var _0x118404=_0xc391[_0x122d96];return _0x118404;};'use strict';var Sequelize=require(_0x1c39('0x0'));module[_0x1c39('0x1')]={'name':{'type':Sequelize[_0x1c39('0x2')]},'type':{'type':Sequelize[_0x1c39('0x3')]('html',_0x1c39('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x1c39('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x1c39('0x6')},'active':{'type':Sequelize[_0x1c39('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1c39('0x3')](_0x1c39('0x8'),_0x1c39('0x9'),_0x1c39('0xa'),_0x1c39('0xb')),'defaultValue':_0x1c39('0xa'),'comment':_0x1c39('0xc')},'icon':{'type':Sequelize[_0x1c39('0x2')]},'adminUrl':{'type':Sequelize[_0x1c39('0x2')]},'agentUrl':{'type':Sequelize[_0x1c39('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1c39('0x2')]}}; \ No newline at end of file +var _0x3f4f=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script','TEXT'];(function(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x3f4f,0x156));var _0xf3f4=function(_0x3dcf1c,_0x15f972){_0x3dcf1c=_0x3dcf1c-0x0;var _0x40fa4e=_0x3f4f[_0x3dcf1c];return _0x40fa4e;};'use strict';var Sequelize=require(_0xf3f4('0x0'));module[_0xf3f4('0x1')]={'name':{'type':Sequelize[_0xf3f4('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf3f4('0x3'),_0xf3f4('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xf3f4('0x5')]},'path':{'type':Sequelize[_0xf3f4('0x2')],'comment':_0xf3f4('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xf3f4('0x7'),_0xf3f4('0x8'),_0xf3f4('0x9'),_0xf3f4('0xa')),'defaultValue':_0xf3f4('0x9'),'comment':_0xf3f4('0xb')},'icon':{'type':Sequelize[_0xf3f4('0x2')]},'adminUrl':{'type':Sequelize[_0xf3f4('0x2')]},'agentUrl':{'type':Sequelize[_0xf3f4('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf3f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c687716..e9d9dc0 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 _0x3124=['userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','method','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','Plugin','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','download','find','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','version','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body'];(function(_0x16f77c,_0x5256b1){var _0x78986e=function(_0x10430){while(--_0x10430){_0x16f77c['push'](_0x16f77c['shift']());}};_0x78986e(++_0x5256b1);}(_0x3124,0xc8));var _0x4312=function(_0x4fc7b6,_0x52b545){_0x4fc7b6=_0x4fc7b6-0x0;var _0xaf122d=_0x3124[_0x4fc7b6];return _0xaf122d;};'use strict';var emlformat=require(_0x4312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4312('0x1'));var jsonpatch=require(_0x4312('0x2'));var rp=require('request-promise');var moment=require(_0x4312('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4312('0x4'));var util=require(_0x4312('0x5'));var path=require('path');var sox=require(_0x4312('0x6'));var csv=require('to-csv');var ejs=require(_0x4312('0x7'));var fs=require('fs');var fs_extra=require(_0x4312('0x8'));var _=require('lodash');var squel=require(_0x4312('0x9'));var crypto=require(_0x4312('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4312('0xb'));var toCsv=require(_0x4312('0xc'));var querystring=require('querystring');var Papa=require(_0x4312('0xd'));var extract=require(_0x4312('0xe'));var rimraf=require(_0x4312('0xf'));var archiver=require(_0x4312('0x10'));var Redis=require(_0x4312('0x11'));var authService=require(_0x4312('0x12'));var qs=require(_0x4312('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4312('0x14'));var logger=require('../../config/logger')(_0x4312('0x15'));var utils=require('../../config/utils');var config=require(_0x4312('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4312('0x17')]=_[_0x4312('0x18')](config[_0x4312('0x17')],{'host':_0x4312('0x19'),'port':0x18eb});var socket=require(_0x4312('0x1a'))(new Redis(config[_0x4312('0x17')]));require('./plugin.socket')[_0x4312('0x1b')](socket);function respondWithStatusCode(_0x9e127b,_0x287d44){_0x287d44=_0x287d44||0xcc;return function(_0x422858){if(_0x422858){return _0x9e127b[_0x4312('0x1c')](_0x287d44);}return _0x9e127b[_0x4312('0x1d')](_0x287d44)[_0x4312('0x1e')]();};}function respondWithResult(_0x580603,_0x25c939){_0x25c939=_0x25c939||0xc8;return function(_0x3e1e6e){if(_0x3e1e6e){return _0x580603['status'](_0x25c939)['json'](_0x3e1e6e);}};}function respondWithFilteredResult(_0x2c6353,_0x11cfa7){return function(_0x1f69f0){if(_0x1f69f0){var _0x4ad6ca=typeof _0x11cfa7[_0x4312('0x1f')]===_0x4312('0x20')&&typeof _0x11cfa7[_0x4312('0x21')]===_0x4312('0x20');var _0x42e285=_0x1f69f0[_0x4312('0x22')];var _0x3beccc=_0x4ad6ca?0x0:_0x11cfa7['offset'];var _0x37ef2e=_0x4ad6ca?_0x1f69f0[_0x4312('0x22')]:_0x11cfa7[_0x4312('0x1f')]+_0x11cfa7['limit'];var _0x6e4544;if(_0x37ef2e>=_0x42e285){_0x37ef2e=_0x42e285;_0x6e4544=0xc8;}else{_0x6e4544=0xce;}_0x2c6353[_0x4312('0x1d')](_0x6e4544);return _0x2c6353[_0x4312('0x23')](_0x4312('0x24'),_0x3beccc+'-'+_0x37ef2e+'/'+_0x42e285)[_0x4312('0x25')](_0x1f69f0);}return null;};}function patchUpdates(_0x42ac19){return function(_0x68f3d9){try{jsonpatch[_0x4312('0x26')](_0x68f3d9,_0x42ac19,!![]);}catch(_0x2c70d9){return BPromise['reject'](_0x2c70d9);}return _0x68f3d9[_0x4312('0x27')]();};}function saveUpdates(_0x3f37a1,_0x23e43b){return function(_0x2bb65b){if(_0x2bb65b){return _0x2bb65b[_0x4312('0x28')](_0x3f37a1)[_0x4312('0x29')](function(_0x18ca68){return _0x18ca68;});}return null;};}function removeEntity(_0x2a30ae,_0x2e17c6){return function(_0x56163e){if(_0x56163e){return _0x56163e[_0x4312('0x2a')]()[_0x4312('0x29')](function(){var _0x22a271=_0x56163e[_0x4312('0x2b')]({'plain':!![]});var _0x2eae61=_0x4312('0x2c');return db[_0x4312('0x2d')][_0x4312('0x2a')]({'where':{'type':_0x2eae61,'resourceId':_0x22a271['id']}})[_0x4312('0x29')](function(){return _0x56163e;});})[_0x4312('0x29')](function(){_0x2a30ae[_0x4312('0x1d')](0xcc)[_0x4312('0x1e')]();});}};}function handleEntityNotFound(_0x1a87b8,_0x48f70e){return function(_0x218007){if(!_0x218007){_0x1a87b8[_0x4312('0x1c')](0x194);}return _0x218007;};}function handleError(_0x47f204,_0x13c92b){_0x13c92b=_0x13c92b||0x1f4;return function(_0x5d28b6){logger[_0x4312('0x2e')](_0x5d28b6[_0x4312('0x2f')]);if(_0x5d28b6[_0x4312('0x30')]){delete _0x5d28b6[_0x4312('0x30')];}_0x47f204['status'](_0x13c92b)[_0x4312('0x31')](_0x5d28b6);};}exports['index']=function(_0xdf18cd,_0x1398d8){var _0xc1a307={},_0x32c0d7={},_0x1dd060={'count':0x0,'rows':[]};var _0x5bc571=_[_0x4312('0x32')](db[_0x4312('0x33')]['rawAttributes'],function(_0x26a6bf){return{'name':_0x26a6bf['fieldName'],'type':_0x26a6bf[_0x4312('0x34')]['key']};});_0x32c0d7[_0x4312('0x35')]=_[_0x4312('0x32')](_0x5bc571,'name');_0x32c0d7[_0x4312('0x36')]=_['keys'](_0xdf18cd[_0x4312('0x36')]);_0x32c0d7[_0x4312('0x37')]=_[_0x4312('0x38')](_0x32c0d7[_0x4312('0x35')],_0x32c0d7[_0x4312('0x36')]);_0xc1a307['attributes']=_[_0x4312('0x38')](_0x32c0d7[_0x4312('0x35')],qs[_0x4312('0x39')](_0xdf18cd['query'][_0x4312('0x39')]));_0xc1a307['attributes']=_0xc1a307[_0x4312('0x3a')][_0x4312('0x3b')]?_0xc1a307[_0x4312('0x3a')]:_0x32c0d7[_0x4312('0x35')];if(!_0xdf18cd['query'][_0x4312('0x3c')](_0x4312('0x3d'))){_0xc1a307['limit']=qs['limit'](_0xdf18cd[_0x4312('0x36')][_0x4312('0x21')]);_0xc1a307[_0x4312('0x1f')]=qs[_0x4312('0x1f')](_0xdf18cd['query'][_0x4312('0x1f')]);}_0xc1a307[_0x4312('0x3e')]=qs[_0x4312('0x3f')](_0xdf18cd[_0x4312('0x36')]['sort']);_0xc1a307[_0x4312('0x40')]=qs['filters'](_['pick'](_0xdf18cd['query'],_0x32c0d7['filters']),_0x5bc571);if(_0xdf18cd[_0x4312('0x36')][_0x4312('0x41')]){_0xc1a307[_0x4312('0x40')]=_[_0x4312('0x42')](_0xc1a307[_0x4312('0x40')],{'$or':_[_0x4312('0x32')](_0x5bc571,function(_0xe2130e){if(_0xe2130e[_0x4312('0x34')]!==_0x4312('0x43')){var _0x5b2ed1={};_0x5b2ed1[_0xe2130e[_0x4312('0x30')]]={'$like':'%'+_0xdf18cd[_0x4312('0x36')][_0x4312('0x41')]+'%'};return _0x5b2ed1;}})});}_0xc1a307=_[_0x4312('0x42')]({},_0xc1a307,_0xdf18cd[_0x4312('0x44')]);var _0x3cfaa5={'where':_0xc1a307[_0x4312('0x40')]};return db[_0x4312('0x33')][_0x4312('0x22')](_0x3cfaa5)[_0x4312('0x29')](function(_0xb46ba5){_0x1dd060[_0x4312('0x22')]=_0xb46ba5;if(_0xdf18cd[_0x4312('0x36')][_0x4312('0x45')]){_0xc1a307[_0x4312('0x46')]=[{'all':!![]}];}return db[_0x4312('0x33')][_0x4312('0x47')](_0xc1a307);})[_0x4312('0x29')](function(_0x34c2c1){_0x1dd060[_0x4312('0x48')]=_0x34c2c1;return _0x1dd060;})[_0x4312('0x29')](respondWithFilteredResult(_0x1398d8,_0xc1a307))[_0x4312('0x49')](handleError(_0x1398d8,null));};exports[_0x4312('0x4a')]=function(_0x2c1aff,_0x1e2a9b){var _0x331be5={'raw':!![],'where':{'id':_0x2c1aff[_0x4312('0x4b')]['id']}},_0x3dbd39={};_0x3dbd39[_0x4312('0x35')]=_[_0x4312('0x4c')](db[_0x4312('0x33')][_0x4312('0x4d')]);_0x3dbd39[_0x4312('0x36')]=_['keys'](_0x2c1aff[_0x4312('0x36')]);_0x3dbd39['filters']=_[_0x4312('0x38')](_0x3dbd39[_0x4312('0x35')],_0x3dbd39[_0x4312('0x36')]);_0x331be5[_0x4312('0x3a')]=_[_0x4312('0x38')](_0x3dbd39[_0x4312('0x35')],qs[_0x4312('0x39')](_0x2c1aff[_0x4312('0x36')][_0x4312('0x39')]));_0x331be5[_0x4312('0x3a')]=_0x331be5['attributes'][_0x4312('0x3b')]?_0x331be5[_0x4312('0x3a')]:_0x3dbd39[_0x4312('0x35')];if(_0x2c1aff[_0x4312('0x36')][_0x4312('0x45')]){_0x331be5[_0x4312('0x46')]=[{'all':!![]}];}_0x331be5=_[_0x4312('0x42')]({},_0x331be5,_0x2c1aff['options']);return db[_0x4312('0x33')]['find'](_0x331be5)[_0x4312('0x29')](handleEntityNotFound(_0x1e2a9b,null))['then'](respondWithResult(_0x1e2a9b,null))['catch'](handleError(_0x1e2a9b,null));};exports[_0x4312('0x4e')]=function(_0x2fea2d,_0x47a99f,_0x37992e){return db[_0x4312('0x33')][_0x4312('0x4f')]({'where':{'id':_0x2fea2d[_0x4312('0x4b')]['id']},'attributes':[_0x4312('0x30'),_0x4312('0x50')],'raw':!![]})[_0x4312('0x29')](handleEntityNotFound(_0x47a99f,null))[_0x4312('0x29')](function(_0x204776){if(_0x204776){var _0x58ade7=path[_0x4312('0x51')](config[_0x4312('0x52')],_0x4312('0x53'),util[_0x4312('0x54')](_0x4312('0x55'),path[_0x4312('0x56')](_0x204776[_0x4312('0x50')])));var _0x5022e7=fs[_0x4312('0x57')](_0x58ade7);var _0x580c8a=archiver(_0x4312('0x58'),{'zlib':{'level':0x9}});_0x580c8a['on'](_0x4312('0x59'),function(_0x7a79a0){if(_0x7a79a0['code']===_0x4312('0x5a')){logger['error'](_0x7a79a0);}else{throw new db['Sequelize'][(_0x4312('0x5b'))](_0x4312('0x5c'));}});_0x580c8a['on'](_0x4312('0x2e'),function(_0x216a11){throw new db['Sequelize'][(_0x4312('0x5b'))](_0x4312('0x5c'));});_0x580c8a[_0x4312('0x5d')](_0x5022e7);_0x580c8a[_0x4312('0x5e')](_0x4312('0x5f'),{'cwd':path[_0x4312('0x51')](config['root'],'server/files/plugins',path[_0x4312('0x60')](_0x204776[_0x4312('0x50')])),'ignore':[path[_0x4312('0x51')](path['basename'](_0x204776['path']),_0x4312('0x61')),path[_0x4312('0x51')](path[_0x4312('0x56')](_0x204776[_0x4312('0x50')]),_0x4312('0x62'))],'nodir':!![]})[_0x4312('0x63')]();_0x5022e7['on'](_0x4312('0x64'),function(){if(!fs['existsSync'](_0x58ade7)){throw new db['Sequelize'][(_0x4312('0x5b'))](_0x4312('0x65'));}return _0x47a99f[_0x4312('0x4e')](_0x58ade7,util[_0x4312('0x54')](_0x4312('0x55'),path['basename'](_0x204776[_0x4312('0x50')])),function(_0xfb9aa6){if(_0xfb9aa6){throw new db[(_0x4312('0x66'))][(_0x4312('0x5b'))](_0x4312('0x67'));}fs[_0x4312('0x68')](_0x58ade7);logger[_0x4312('0x69')]('Download\x20completed');logger[_0x4312('0x69')](_0x4312('0x6a'));});});}return null;})[_0x4312('0x49')](handleError(_0x47a99f,null));};exports[_0x4312('0x6b')]=function(_0x1f779b,_0x214114,_0x2a9258){var _0xa034e3=path[_0x4312('0x56')](_0x1f779b[_0x4312('0x6c')][_0x4312('0x6d')],path[_0x4312('0x6e')](_0x1f779b['file']['filename']));var _0x18aa5f=path[_0x4312('0x51')](config[_0x4312('0x52')],_0x4312('0x53'),_0x1f779b[_0x4312('0x6c')]['filename']);var _0x383d85=path[_0x4312('0x51')](config[_0x4312('0x52')],_0x4312('0x53'),_0xa034e3);logger[_0x4312('0x69')](_0x4312('0x6f'),_0x18aa5f);logger['info'](_0x4312('0x70'),_0x383d85);try{fs['chmodSync'](_0x18aa5f,parseInt('0777',0x8));extract(_0x18aa5f,{'dir':_0x383d85},function(_0x69eff6){if(_0x69eff6){logger[_0x4312('0x2e')](_0x69eff6);handleError(_0x69eff6,!![]);};var _0x1894f6=fs[_0x4312('0x71')](_0x383d85);if(_0x1894f6['length']>0x1){removeReferences(_0x18aa5f,_0x383d85);logger[_0x4312('0x2e')](_0x4312('0x72'));return _0x2a9258(new Error(_0x4312('0x72')));}var _0x587094=fs[_0x4312('0x73')](path[_0x4312('0x51')](_0x383d85,_0x1894f6[0x0]));if(_0x587094[_0x4312('0x74')]()){removeReferences(_0x18aa5f,_0x383d85);logger['error'](_0x4312('0x72'));return _0x2a9258(new Error(_0x4312('0x72')));}if(_0x587094[_0x4312('0x75')]()){var _0x2a81e8=fs[_0x4312('0x71')](path[_0x4312('0x51')](_0x383d85,_0x1894f6[0x0]));if(_0x2a81e8['length']===0x0){removeReferences(_0x18aa5f,_0x383d85);logger[_0x4312('0x2e')]('Invalid\x20plugin\x20structure');return _0x2a9258(new Error(_0x4312('0x72')));}var _0x2747ad=_0x2a81e8[_0x4312('0x76')](function(_0x2b3ed9){return _0x2b3ed9===_0x4312('0x77');});if(!_0x2747ad){return _0x2a9258(new Error('Plugin\x20manifest\x20missing'));}var _0x2a8e48=fs[_0x4312('0x78')](path[_0x4312('0x51')](_0x383d85,_0x1894f6[0x0],_0x4312('0x77')));var _0x566932=JSON[_0x4312('0x79')](_0x2a8e48);if('undefined'==typeof _0x566932['name']){return _0x2a9258(new Error(_0x4312('0x7a')));}if('undefined'==typeof _0x566932[_0x4312('0x34')]){return _0x2a9258(new Error(_0x4312('0x7b')));}if('undefined'==typeof _0x566932['version']){return _0x2a9258(new Error(_0x4312('0x7c')));}if(_0x4312('0x20')==typeof _0x566932['parameters']){return _0x2a9258(new Error(_0x4312('0x7d')));}if(_0x566932['type']==='html'){if(_0x4312('0x20')==typeof _0x566932['parameters'][_0x4312('0x7e')]){return _0x2a9258(new Error(_0x4312('0x7f')));}if(_0x4312('0x20')==typeof _0x566932[_0x4312('0x80')][_0x4312('0x7e')]['admin']&&_0x4312('0x20')==typeof _0x566932[_0x4312('0x80')][_0x4312('0x7e')][_0x4312('0x81')]){return _0x2a9258(new Error(_0x4312('0x82')));}}else if(_0x566932[_0x4312('0x34')]===_0x4312('0x83')){if(_0x4312('0x20')==typeof _0x566932[_0x4312('0x80')][_0x4312('0x84')]){return _0x2a9258(new Error(_0x4312('0x85')));}if(_0x4312('0x20')==typeof _0x566932[_0x4312('0x80')][_0x4312('0x86')]){return _0x2a9258(new Error(_0x4312('0x87')));}}else{return _0x2a9258(new Error(_0x4312('0x88')));}var _0x4eef7c=_0x566932['name'];var _0x520fe0=_0x566932[_0x4312('0x89')];var _0x3cf3db=_0x566932[_0x4312('0x34')];var _0x28dcdf=_0x566932['sidebar']?_0x566932['sidebar']:_0x4312('0x8a');var _0x19a7f9=_0x566932[_0x4312('0x8b')]?_0x566932[_0x4312('0x8b')]:_0x4312('0x8c');var _0x2d91d2='';var _0x3d8fe2='';var _0x323f8a='';var _0x5660bb='';var _0x14bb73=_0x566932[_0x4312('0x8d')];if(_0x3cf3db===_0x4312('0x8e')){if(_0x4312('0x20')!=typeof _0x566932[_0x4312('0x80')][_0x4312('0x7e')][_0x4312('0x8f')]){var _0x57cbaa=_0x566932[_0x4312('0x80')][_0x4312('0x7e')][_0x4312('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x4312('0x90')](_0x57cbaa)){_0x2d91d2=path[_0x4312('0x51')](_0x4312('0x91'),_0xa034e3,_0x1894f6[0x0],_0x57cbaa);}else{_0x2d91d2=_0x57cbaa;}}else{logger[_0x4312('0x69')](_0x4312('0x92'));}if(_0x4312('0x20')!=typeof _0x566932[_0x4312('0x80')][_0x4312('0x7e')][_0x4312('0x81')]){var _0x19dd4e=_0x566932['parameters'][_0x4312('0x7e')][_0x4312('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4312('0x90')](_0x19dd4e)){_0x3d8fe2=path['join'](_0x4312('0x91'),_0xa034e3,_0x1894f6[0x0],_0x19dd4e);}else{_0x3d8fe2=_0x19dd4e;}}else{logger[_0x4312('0x69')](_0x4312('0x93'));}}else if(_0x3cf3db===_0x4312('0x83')){_0x323f8a=_0x566932[_0x4312('0x80')]['scriptName'];_0x5660bb=_0x566932[_0x4312('0x80')][_0x4312('0x86')];if(_0x4312('0x20')!=typeof _0x566932['parameters'][_0x4312('0x7e')]){if(_0x4312('0x20')!=typeof _0x566932[_0x4312('0x80')][_0x4312('0x7e')][_0x4312('0x8f')]){var _0x57cbaa=_0x566932[_0x4312('0x80')]['views'][_0x4312('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x4312('0x90')](_0x57cbaa)){_0x2d91d2=path[_0x4312('0x51')](_0x4312('0x91'),_0xa034e3,_0x1894f6[0x0],_0x57cbaa);}else{_0x2d91d2=_0x57cbaa;}}if('undefined'!=typeof _0x566932[_0x4312('0x80')]['views'][_0x4312('0x81')]){var _0x19dd4e=_0x566932[_0x4312('0x80')]['views'][_0x4312('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x4312('0x90')](_0x19dd4e)){_0x3d8fe2=path[_0x4312('0x51')](_0x4312('0x91'),_0xa034e3,_0x1894f6[0x0],_0x19dd4e);}else{_0x3d8fe2=_0x19dd4e;}}}}var _0x2667c6={'name':_0x4eef7c,'description':_0x520fe0,'path':path[_0x4312('0x51')](_0xa034e3,_0x1894f6[0x0]),'type':_0x3cf3db,'sidebar':_0x28dcdf,'icon':_0x19a7f9,'adminUrl':_0x2d91d2,'agentUrl':_0x3d8fe2,'scriptName':_0x323f8a,'scriptPath':_0x5660bb,'version':_0x14bb73};removeReferences(_0x18aa5f,null);return db[_0x4312('0x33')][_0x4312('0x94')](_0x2667c6)[_0x4312('0x29')](function(_0x6f55cd){var _0xc17321={'role':_0x1f779b[_0x4312('0x95')]['role'],'userProfileId':_0x1f779b[_0x4312('0x95')][_0x4312('0x96')]};if(!_0xc17321)throw new Error(_0x4312('0x97'));if(_0xc17321[_0x4312('0x98')]===_0x4312('0x99')){var _0x4de078=_0x6f55cd['get']({'plain':!![]});return db[_0x4312('0x9a')][_0x4312('0x4f')]({'where':{'name':_0x4312('0x2c'),'userProfileId':_0xc17321[_0x4312('0x96')]},'raw':!![]})[_0x4312('0x29')](function(_0x33069a){if(_0x33069a&&_0x33069a[_0x4312('0x9b')]===0x0){return db['UserProfileResource'][_0x4312('0x94')]({'name':_0x4de078['name'],'resourceId':_0x4de078['id'],'type':_0x33069a[_0x4312('0x30')],'sectionId':_0x33069a['id']},{})[_0x4312('0x29')](function(){return _0x6f55cd;});}else{return _0x6f55cd;}})[_0x4312('0x49')](function(_0x513cfe){logger[_0x4312('0x2e')](_0x4312('0x9c'),_0x513cfe);throw _0x513cfe;});}return _0x6f55cd;})[_0x4312('0x29')](respondWithResult(_0x214114,null))[_0x4312('0x49')](handleError(_0x214114,null));}});}catch(_0x45000d){_0x214114[_0x4312('0x1d')](0x1f4)[_0x4312('0x31')](_0x45000d);}};function removeReferences(_0xb121a7,_0x9dceeb){try{if(_0xb121a7){fs[_0x4312('0x68')](_0xb121a7);logger[_0x4312('0x69')](_0x4312('0x9d'));}if(_0x9dceeb){rimraf(_0x9dceeb,function(){});logger[_0x4312('0x69')](_0x4312('0x9e'));}}catch(_0x42cd95){logger[_0x4312('0x2e')](_0x42cd95);}}exports[_0x4312('0x28')]=function(_0x4f165e,_0x4d17c7,_0x5a5b48){return db[_0x4312('0x33')][_0x4312('0x4f')]({'where':{'id':_0x4f165e[_0x4312('0x4b')]['id']}})[_0x4312('0x29')](handleEntityNotFound(_0x4d17c7,null))[_0x4312('0x29')](saveUpdates(_0x4f165e[_0x4312('0x95')],null))[_0x4312('0x29')](respondWithResult(_0x4d17c7,null))[_0x4312('0x49')](handleError(_0x4d17c7,null));};exports[_0x4312('0x9f')]=function(_0x5c1b45,_0x47469c,_0x4ef2fa){return db['Plugin'][_0x4312('0x4f')]({'where':{'id':_0x5c1b45[_0x4312('0x4b')]['id']}})['then'](function(_0x111f8c){if(_0x111f8c){return _0x111f8c[_0x4312('0x2a')]();}})[_0x4312('0x29')](function(_0x49c7a2){rimraf(path[_0x4312('0x51')](config['root'],_0x4312('0x53'),path[_0x4312('0x60')](_0x49c7a2[_0x4312('0x50')])),function(){});return _0x49c7a2;})['then'](handleEntityNotFound(_0x47469c,null))[_0x4312('0x29')](respondWithStatusCode(_0x47469c,null))[_0x4312('0x49')](handleError(_0x47469c,null));};exports[_0x4312('0xa0')]=function(_0x42ffe3,_0x5df972,_0x3060fb){return BPromise[_0x4312('0xa1')]()[_0x4312('0x29')](function(){if(!_0x42ffe3[_0x4312('0x36')][_0x4312('0x50')]){throw new Error(_0x4312('0xa2'));}if(!_0x42ffe3['query']['port']){throw new Error(_0x4312('0xa3'));}var _0x2ca9f1=_0x42ffe3['query'][_0x4312('0xa4')]?_0x42ffe3[_0x4312('0x36')][_0x4312('0xa4')]+':'+_0x42ffe3[_0x4312('0x36')]['port']:_0x4312('0xa5')+_0x42ffe3[_0x4312('0x36')][_0x4312('0xa6')];var _0x51fa5f=_0x42ffe3[_0x4312('0x36')][_0x4312('0x25')]?_0x42ffe3['query']['json']:!![];var _0x2f3876=_0x42ffe3[_0x4312('0x36')][_0x4312('0xa7')]?_0x42ffe3[_0x4312('0x36')][_0x4312('0xa7')]:null;var _0x580b63={'method':_0x42ffe3['method'],'uri':util[_0x4312('0x54')](_0x4312('0xa8'),_0x2ca9f1,_0x42ffe3['query'][_0x4312('0x50')]),'json':_0x51fa5f,'resolveWithFullResponse':!![],'encoding':_0x2f3876,'qs':_0x42ffe3[_0x4312('0x36')]};if(_0x42ffe3[_0x4312('0xa9')]){_0x580b63[_0x4312('0xa9')]=_0x42ffe3['headers'];if(_0x580b63[_0x4312('0xa9')][_0x4312('0xaa')]){delete _0x580b63[_0x4312('0xa9')][_0x4312('0xaa')];}}if(_0x580b63[_0x4312('0xa9')][_0x4312('0xab')]){delete _0x580b63[_0x4312('0xa9')]['content-type'];}return rp(_0x580b63);})['then'](function(_0x4c7985){if(_0x4c7985){_0x5df972[_0x4312('0x23')](_0x4c7985['headers']);logger[_0x4312('0x69')](_0x4c7985['body']);if(_['endsWith'](_0x42ffe3['query'][_0x4312('0x50')],'download')&&_0x4c7985['statusCode']==0x1f4){return _0x5df972[_0x4312('0x1c')](_0x4c7985[_0x4312('0xac')]);}else{return _0x5df972[_0x4312('0x1d')](_0x4c7985['statusCode'])[_0x4312('0x31')](_0x4c7985[_0x4312('0x95')]);}}else{return _0x5df972[_0x4312('0x1c')](0xc8);}})[_0x4312('0x49')](handleError(_0x5df972,null));};exports[_0x4312('0xad')]=function(_0x31c277,_0x1e8da1,_0x39a96a){return BPromise[_0x4312('0xa1')]()[_0x4312('0x29')](function(){if(!_0x31c277[_0x4312('0x36')][_0x4312('0x50')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x31c277[_0x4312('0x36')][_0x4312('0xa6')]){throw new Error(_0x4312('0xa3'));}var _0x44e24a=_0x31c277[_0x4312('0x36')][_0x4312('0xa4')]?_0x31c277[_0x4312('0x36')][_0x4312('0xa4')]+':'+_0x31c277[_0x4312('0x36')][_0x4312('0xa6')]:_0x4312('0xa5')+_0x31c277['query'][_0x4312('0xa6')];var _0x2181db=_0x31c277[_0x4312('0x36')][_0x4312('0x25')]?_0x31c277['query'][_0x4312('0x25')]:!![];var _0x240068=_0x31c277['query'][_0x4312('0xa7')]?_0x31c277['query'][_0x4312('0xa7')]:null;var _0xbca596={'method':_0x31c277[_0x4312('0xae')],'uri':util[_0x4312('0x54')](_0x4312('0xa8'),_0x44e24a,_0x31c277[_0x4312('0x36')][_0x4312('0x50')]),'json':_0x2181db,'resolveWithFullResponse':!![],'encoding':_0x240068,'body':_0x31c277[_0x4312('0x95')]};if(_0x31c277[_0x4312('0xa9')]){_0xbca596[_0x4312('0xa9')]=_0x31c277['headers'];if(_0xbca596[_0x4312('0xa9')][_0x4312('0xaa')]){delete _0xbca596[_0x4312('0xa9')]['content-length'];}}if(_0xbca596['headers']['content-type']){delete _0xbca596[_0x4312('0xa9')][_0x4312('0xab')];}return rp(_0xbca596);})[_0x4312('0x29')](function(_0x52e9e3){if(_0x52e9e3){_0x1e8da1[_0x4312('0x23')](_0x52e9e3[_0x4312('0xa9')]);logger[_0x4312('0x69')](_0x52e9e3[_0x4312('0x95')]);return _0x1e8da1['status'](_0x52e9e3[_0x4312('0xac')])[_0x4312('0x31')](_0x52e9e3['body']);}else{return _0x1e8da1[_0x4312('0x1c')](0xc8);}})['catch'](handleError(_0x1e8da1,null));}; \ No newline at end of file +var _0xce62=['length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','download','join','root','format','%s.zip','basename','createWriteStream','ENOENT','error','Sequelize','Error','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','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','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','content-length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','archiver','../../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','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','Plugins','UserProfileResource','stack','send','index','map','Plugin','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xce62,0x1c4));var _0x2ce6=function(_0x44a089,_0xd0230b){_0x44a089=_0x44a089-0x0;var _0x1d5b2a=_0xce62[_0x44a089];return _0x1d5b2a;};'use strict';var emlformat=require(_0x2ce6('0x0'));var rimraf=require(_0x2ce6('0x1'));var zipdir=require(_0x2ce6('0x2'));var jsonpatch=require(_0x2ce6('0x3'));var rp=require(_0x2ce6('0x4'));var moment=require(_0x2ce6('0x5'));var BPromise=require(_0x2ce6('0x6'));var Mustache=require(_0x2ce6('0x7'));var util=require(_0x2ce6('0x8'));var path=require(_0x2ce6('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ce6('0xa'));var _=require(_0x2ce6('0xb'));var squel=require(_0x2ce6('0xc'));var crypto=require(_0x2ce6('0xd'));var jsforce=require(_0x2ce6('0xe'));var deskjs=require(_0x2ce6('0xf'));var toCsv=require(_0x2ce6('0x10'));var querystring=require('querystring');var Papa=require(_0x2ce6('0x11'));var extract=require('extract-zip');var rimraf=require(_0x2ce6('0x1'));var archiver=require(_0x2ce6('0x12'));var Redis=require('ioredis');var authService=require(_0x2ce6('0x13'));var qs=require(_0x2ce6('0x14'));var as=require(_0x2ce6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ce6('0x16'))(_0x2ce6('0x17'));var utils=require(_0x2ce6('0x18'));var config=require(_0x2ce6('0x19'));var licenseUtil=require(_0x2ce6('0x1a'));var db=require('../../mysqldb')['db'];config[_0x2ce6('0x1b')]=_[_0x2ce6('0x1c')](config['redis'],{'host':_0x2ce6('0x1d'),'port':0x18eb});var socket=require(_0x2ce6('0x1e'))(new Redis(config[_0x2ce6('0x1b')]));require('./plugin.socket')[_0x2ce6('0x1f')](socket);function respondWithStatusCode(_0x333454,_0xc9dbb6){_0xc9dbb6=_0xc9dbb6||0xcc;return function(_0x1d73ed){if(_0x1d73ed){return _0x333454[_0x2ce6('0x20')](_0xc9dbb6);}return _0x333454[_0x2ce6('0x21')](_0xc9dbb6)[_0x2ce6('0x22')]();};}function respondWithResult(_0x23fedd,_0xcd8085){_0xcd8085=_0xcd8085||0xc8;return function(_0x3392a8){if(_0x3392a8){return _0x23fedd['status'](_0xcd8085)[_0x2ce6('0x23')](_0x3392a8);}};}function respondWithFilteredResult(_0x17be09,_0x578f54){return function(_0x35aa84){if(_0x35aa84){var _0x241a6c=typeof _0x578f54[_0x2ce6('0x24')]===_0x2ce6('0x25')&&typeof _0x578f54[_0x2ce6('0x26')]===_0x2ce6('0x25');var _0x2fe77e=_0x35aa84[_0x2ce6('0x27')];var _0x407f2f=_0x241a6c?0x0:_0x578f54['offset'];var _0x5561cc=_0x241a6c?_0x35aa84['count']:_0x578f54[_0x2ce6('0x24')]+_0x578f54[_0x2ce6('0x26')];var _0x4cbee4;if(_0x5561cc>=_0x2fe77e){_0x5561cc=_0x2fe77e;_0x4cbee4=0xc8;}else{_0x4cbee4=0xce;}_0x17be09[_0x2ce6('0x21')](_0x4cbee4);return _0x17be09[_0x2ce6('0x28')](_0x2ce6('0x29'),_0x407f2f+'-'+_0x5561cc+'/'+_0x2fe77e)[_0x2ce6('0x23')](_0x35aa84);}return null;};}function patchUpdates(_0x320b7a){return function(_0x4df0f5){try{jsonpatch[_0x2ce6('0x2a')](_0x4df0f5,_0x320b7a,!![]);}catch(_0x4130f0){return BPromise[_0x2ce6('0x2b')](_0x4130f0);}return _0x4df0f5['save']();};}function saveUpdates(_0x286b89,_0x2ad4ad){return function(_0xeb3e64){if(_0xeb3e64){return _0xeb3e64['update'](_0x286b89)[_0x2ce6('0x2c')](function(_0x2b94d6){return _0x2b94d6;});}return null;};}function removeEntity(_0x3e9594,_0x5b2649){return function(_0x2f1318){if(_0x2f1318){return _0x2f1318[_0x2ce6('0x2d')]()['then'](function(){var _0x46ac83=_0x2f1318['get']({'plain':!![]});var _0x8cc26c=_0x2ce6('0x2e');return db[_0x2ce6('0x2f')]['destroy']({'where':{'type':_0x8cc26c,'resourceId':_0x46ac83['id']}})[_0x2ce6('0x2c')](function(){return _0x2f1318;});})[_0x2ce6('0x2c')](function(){_0x3e9594[_0x2ce6('0x21')](0xcc)[_0x2ce6('0x22')]();});}};}function handleEntityNotFound(_0xd27a58,_0xe7cc0){return function(_0x49bd18){if(!_0x49bd18){_0xd27a58[_0x2ce6('0x20')](0x194);}return _0x49bd18;};}function handleError(_0x56a5f3,_0x12140c){_0x12140c=_0x12140c||0x1f4;return function(_0x20f8a4){logger['error'](_0x20f8a4[_0x2ce6('0x30')]);if(_0x20f8a4['name']){delete _0x20f8a4['name'];}_0x56a5f3[_0x2ce6('0x21')](_0x12140c)[_0x2ce6('0x31')](_0x20f8a4);};}exports[_0x2ce6('0x32')]=function(_0x43aba7,_0x3c9542){var _0x4ce51c={},_0xfe9af={},_0x1896eb={'count':0x0,'rows':[]};var _0x2cbc34=_[_0x2ce6('0x33')](db[_0x2ce6('0x34')][_0x2ce6('0x35')],function(_0x2076e3){return{'name':_0x2076e3[_0x2ce6('0x36')],'type':_0x2076e3[_0x2ce6('0x37')]['key']};});_0xfe9af[_0x2ce6('0x38')]=_[_0x2ce6('0x33')](_0x2cbc34,_0x2ce6('0x39'));_0xfe9af['query']=_[_0x2ce6('0x3a')](_0x43aba7[_0x2ce6('0x3b')]);_0xfe9af[_0x2ce6('0x3c')]=_[_0x2ce6('0x3d')](_0xfe9af['model'],_0xfe9af[_0x2ce6('0x3b')]);_0x4ce51c[_0x2ce6('0x3e')]=_['intersection'](_0xfe9af[_0x2ce6('0x38')],qs[_0x2ce6('0x3f')](_0x43aba7[_0x2ce6('0x3b')]['fields']));_0x4ce51c['attributes']=_0x4ce51c[_0x2ce6('0x3e')][_0x2ce6('0x40')]?_0x4ce51c[_0x2ce6('0x3e')]:_0xfe9af[_0x2ce6('0x38')];if(!_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x41')]('nolimit')){_0x4ce51c[_0x2ce6('0x26')]=qs[_0x2ce6('0x26')](_0x43aba7[_0x2ce6('0x3b')]['limit']);_0x4ce51c[_0x2ce6('0x24')]=qs[_0x2ce6('0x24')](_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x24')]);}_0x4ce51c[_0x2ce6('0x42')]=qs[_0x2ce6('0x43')](_0x43aba7[_0x2ce6('0x3b')][_0x2ce6('0x43')]);_0x4ce51c[_0x2ce6('0x44')]=qs['filters'](_['pick'](_0x43aba7['query'],_0xfe9af[_0x2ce6('0x3c')]),_0x2cbc34);if(_0x43aba7[_0x2ce6('0x3b')]['filter']){_0x4ce51c['where']=_[_0x2ce6('0x45')](_0x4ce51c['where'],{'$or':_[_0x2ce6('0x33')](_0x2cbc34,function(_0x28a136){if(_0x28a136['type']!==_0x2ce6('0x46')){var _0x183c29={};_0x183c29[_0x28a136[_0x2ce6('0x39')]]={'$like':'%'+_0x43aba7[_0x2ce6('0x3b')]['filter']+'%'};return _0x183c29;}})});}_0x4ce51c=_[_0x2ce6('0x45')]({},_0x4ce51c,_0x43aba7[_0x2ce6('0x47')]);var _0x2f429b={'where':_0x4ce51c['where']};return db[_0x2ce6('0x34')][_0x2ce6('0x27')](_0x2f429b)[_0x2ce6('0x2c')](function(_0x437b7f){_0x1896eb[_0x2ce6('0x27')]=_0x437b7f;if(_0x43aba7['query'][_0x2ce6('0x48')]){_0x4ce51c[_0x2ce6('0x49')]=[{'all':!![]}];}return db[_0x2ce6('0x34')]['findAll'](_0x4ce51c);})[_0x2ce6('0x2c')](function(_0x19a9fe){_0x1896eb[_0x2ce6('0x4a')]=_0x19a9fe;return _0x1896eb;})[_0x2ce6('0x2c')](respondWithFilteredResult(_0x3c9542,_0x4ce51c))['catch'](handleError(_0x3c9542,null));};exports[_0x2ce6('0x4b')]=function(_0x5c65ab,_0x14a7bb){var _0x260f9c={'raw':!![],'where':{'id':_0x5c65ab[_0x2ce6('0x4c')]['id']}},_0x342fc6={};_0x342fc6[_0x2ce6('0x38')]=_[_0x2ce6('0x3a')](db[_0x2ce6('0x34')][_0x2ce6('0x35')]);_0x342fc6[_0x2ce6('0x3b')]=_[_0x2ce6('0x3a')](_0x5c65ab[_0x2ce6('0x3b')]);_0x342fc6[_0x2ce6('0x3c')]=_[_0x2ce6('0x3d')](_0x342fc6['model'],_0x342fc6[_0x2ce6('0x3b')]);_0x260f9c[_0x2ce6('0x3e')]=_[_0x2ce6('0x3d')](_0x342fc6[_0x2ce6('0x38')],qs[_0x2ce6('0x3f')](_0x5c65ab[_0x2ce6('0x3b')][_0x2ce6('0x3f')]));_0x260f9c[_0x2ce6('0x3e')]=_0x260f9c[_0x2ce6('0x3e')][_0x2ce6('0x40')]?_0x260f9c['attributes']:_0x342fc6[_0x2ce6('0x38')];if(_0x5c65ab['query'][_0x2ce6('0x48')]){_0x260f9c[_0x2ce6('0x49')]=[{'all':!![]}];}_0x260f9c=_[_0x2ce6('0x45')]({},_0x260f9c,_0x5c65ab[_0x2ce6('0x47')]);return db['Plugin'][_0x2ce6('0x4d')](_0x260f9c)[_0x2ce6('0x2c')](handleEntityNotFound(_0x14a7bb,null))['then'](respondWithResult(_0x14a7bb,null))['catch'](handleError(_0x14a7bb,null));};exports[_0x2ce6('0x4e')]=function(_0x3a565f,_0x2360e2,_0x54cfd8){return db[_0x2ce6('0x34')][_0x2ce6('0x4d')]({'where':{'id':_0x3a565f[_0x2ce6('0x4c')]['id']},'attributes':[_0x2ce6('0x39'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x2360e2,null))[_0x2ce6('0x2c')](function(_0x24f860){if(_0x24f860){var _0x6db771=path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],'server/files/plugins',util[_0x2ce6('0x51')](_0x2ce6('0x52'),path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')])));var _0x51a4a1=fs[_0x2ce6('0x54')](_0x6db771);var _0x2955e5=archiver('zip',{'zlib':{'level':0x9}});_0x2955e5['on']('warning',function(_0x2c7524){if(_0x2c7524['code']===_0x2ce6('0x55')){logger[_0x2ce6('0x56')](_0x2c7524);}else{throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x2955e5['on'](_0x2ce6('0x56'),function(_0x5554b3){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2955e5[_0x2ce6('0x59')](_0x51a4a1);_0x2955e5[_0x2ce6('0x5a')](_0x2ce6('0x5b'),{'cwd':path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],_0x2ce6('0x5c'),path[_0x2ce6('0x5d')](_0x24f860[_0x2ce6('0x9')])),'ignore':[path[_0x2ce6('0x4f')](path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')]),_0x2ce6('0x5e')),path[_0x2ce6('0x4f')](path['basename'](_0x24f860[_0x2ce6('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x2ce6('0x5f')]();_0x51a4a1['on'](_0x2ce6('0x60'),function(){if(!fs[_0x2ce6('0x61')](_0x6db771)){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))](_0x2ce6('0x62'));}return _0x2360e2['download'](_0x6db771,util[_0x2ce6('0x51')]('%s.zip',path[_0x2ce6('0x53')](_0x24f860[_0x2ce6('0x9')])),function(_0xdf2b27){if(_0xdf2b27){throw new db[(_0x2ce6('0x57'))][(_0x2ce6('0x58'))](_0x2ce6('0x63'));}fs[_0x2ce6('0x64')](_0x6db771);logger[_0x2ce6('0x65')](_0x2ce6('0x66'));logger[_0x2ce6('0x65')](_0x2ce6('0x67'));});});}return null;})[_0x2ce6('0x68')](handleError(_0x2360e2,null));};exports[_0x2ce6('0x69')]=function(_0x251fe7,_0x14e5af,_0x372f6f){var _0x1c5f38=path[_0x2ce6('0x53')](_0x251fe7[_0x2ce6('0x6a')]['filename'],path[_0x2ce6('0x6b')](_0x251fe7[_0x2ce6('0x6a')][_0x2ce6('0x6c')]));var _0x4a0b0f=path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],'server/files/plugins',_0x251fe7[_0x2ce6('0x6a')][_0x2ce6('0x6c')]);var _0x27ef82=path[_0x2ce6('0x4f')](config['root'],_0x2ce6('0x5c'),_0x1c5f38);logger[_0x2ce6('0x65')](_0x2ce6('0x6d'),_0x4a0b0f);logger['info'](_0x2ce6('0x6e'),_0x27ef82);try{fs[_0x2ce6('0x6f')](_0x4a0b0f,parseInt(_0x2ce6('0x70'),0x8));extract(_0x4a0b0f,{'dir':_0x27ef82},function(_0x5944f){if(_0x5944f){logger[_0x2ce6('0x56')](_0x5944f);handleError(_0x5944f,!![]);};var _0x5ae98c=fs[_0x2ce6('0x71')](_0x27ef82);if(_0x5ae98c['length']>0x1){removeReferences(_0x4a0b0f,_0x27ef82);logger[_0x2ce6('0x56')](_0x2ce6('0x72'));return _0x372f6f(new Error(_0x2ce6('0x72')));}var _0x5ef5ea=fs[_0x2ce6('0x73')](path['join'](_0x27ef82,_0x5ae98c[0x0]));if(_0x5ef5ea['isFile']()){removeReferences(_0x4a0b0f,_0x27ef82);logger['error'](_0x2ce6('0x72'));return _0x372f6f(new Error(_0x2ce6('0x72')));}if(_0x5ef5ea['isDirectory']()){var _0x4d629b=fs['readdirSync'](path[_0x2ce6('0x4f')](_0x27ef82,_0x5ae98c[0x0]));if(_0x4d629b[_0x2ce6('0x40')]===0x0){removeReferences(_0x4a0b0f,_0x27ef82);logger[_0x2ce6('0x56')](_0x2ce6('0x72'));return _0x372f6f(new Error('Invalid\x20plugin\x20structure'));}var _0x4ca202=_0x4d629b[_0x2ce6('0x74')](function(_0x1ac9f2){return _0x1ac9f2==='manifest.json';});if(!_0x4ca202){return _0x372f6f(new Error(_0x2ce6('0x75')));}var _0x536d7f=fs[_0x2ce6('0x76')](path[_0x2ce6('0x4f')](_0x27ef82,_0x5ae98c[0x0],_0x2ce6('0x77')));var _0x49eea1=JSON[_0x2ce6('0x78')](_0x536d7f);if(_0x2ce6('0x25')==typeof _0x49eea1['name']){return _0x372f6f(new Error(_0x2ce6('0x79')));}if('undefined'==typeof _0x49eea1['type']){return _0x372f6f(new Error(_0x2ce6('0x7a')));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7b')]){return _0x372f6f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x49eea1[_0x2ce6('0x7c')]){return _0x372f6f(new Error(_0x2ce6('0x7d')));}if(_0x49eea1[_0x2ce6('0x37')]===_0x2ce6('0x7e')){if(_0x2ce6('0x25')==typeof _0x49eea1['parameters']['views']){return _0x372f6f(new Error(_0x2ce6('0x7f')));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x81')]&&_0x2ce6('0x25')==typeof _0x49eea1['parameters'][_0x2ce6('0x80')]['agent']){return _0x372f6f(new Error(_0x2ce6('0x82')));}}else if(_0x49eea1[_0x2ce6('0x37')]===_0x2ce6('0x83')){if(_0x2ce6('0x25')==typeof _0x49eea1['parameters'][_0x2ce6('0x84')]){return _0x372f6f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x2ce6('0x25')==typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x85')]){return _0x372f6f(new Error(_0x2ce6('0x86')));}}else{return _0x372f6f(new Error(_0x2ce6('0x87')));}var _0x73fdf6=_0x49eea1[_0x2ce6('0x39')];var _0x40bab5=_0x49eea1['description'];var _0x1bc057=_0x49eea1[_0x2ce6('0x37')];var _0xfafcbe=_0x49eea1[_0x2ce6('0x88')]?_0x49eea1[_0x2ce6('0x88')]:_0x2ce6('0x89');var _0x2f6fa9=_0x49eea1['icon']?_0x49eea1[_0x2ce6('0x8a')]:_0x2ce6('0x8b');var _0x11cf3f='';var _0x4fbf8e='';var _0x554c4f='';var _0x30c507='';var _0x4ab2fc=_0x49eea1[_0x2ce6('0x7b')];if(_0x1bc057===_0x2ce6('0x7e')){if('undefined'!=typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')]['admin']){var _0x5357d9=_0x49eea1[_0x2ce6('0x7c')]['views'][_0x2ce6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x5357d9)){_0x11cf3f=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x5357d9);}else{_0x11cf3f=_0x5357d9;}}else{logger[_0x2ce6('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x2ce6('0x25')!=typeof _0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')]){var _0x152104=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x152104)){_0x4fbf8e=path[_0x2ce6('0x4f')]('plugins',_0x1c5f38,_0x5ae98c[0x0],_0x152104);}else{_0x4fbf8e=_0x152104;}}else{logger[_0x2ce6('0x65')](_0x2ce6('0x8f'));}}else if(_0x1bc057==='script'){_0x554c4f=_0x49eea1['parameters'][_0x2ce6('0x84')];_0x30c507=_0x49eea1['parameters'][_0x2ce6('0x85')];if('undefined'!=typeof _0x49eea1['parameters'][_0x2ce6('0x80')]){if(_0x2ce6('0x25')!=typeof _0x49eea1['parameters'][_0x2ce6('0x80')][_0x2ce6('0x81')]){var _0x5357d9=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x5357d9)){_0x11cf3f=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x5357d9);}else{_0x11cf3f=_0x5357d9;}}if(_0x2ce6('0x25')!=typeof _0x49eea1[_0x2ce6('0x7c')]['views'][_0x2ce6('0x8e')]){var _0x152104=_0x49eea1[_0x2ce6('0x7c')][_0x2ce6('0x80')][_0x2ce6('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x2ce6('0x8c')](_0x152104)){_0x4fbf8e=path[_0x2ce6('0x4f')](_0x2ce6('0x8d'),_0x1c5f38,_0x5ae98c[0x0],_0x152104);}else{_0x4fbf8e=_0x152104;}}}}var _0x1c29b4={'name':_0x73fdf6,'description':_0x40bab5,'path':path[_0x2ce6('0x4f')](_0x1c5f38,_0x5ae98c[0x0]),'type':_0x1bc057,'sidebar':_0xfafcbe,'icon':_0x2f6fa9,'adminUrl':_0x11cf3f,'agentUrl':_0x4fbf8e,'scriptName':_0x554c4f,'scriptPath':_0x30c507,'version':_0x4ab2fc};removeReferences(_0x4a0b0f,null);return db[_0x2ce6('0x34')][_0x2ce6('0x90')](_0x1c29b4)[_0x2ce6('0x2c')](function(_0x1299e7){var _0x392dcb={'role':_0x251fe7['body'][_0x2ce6('0x91')],'userProfileId':_0x251fe7[_0x2ce6('0x92')][_0x2ce6('0x93')]};if(!_0x392dcb)throw new Error(_0x2ce6('0x94'));if(_0x392dcb[_0x2ce6('0x91')]===_0x2ce6('0x95')){var _0x4175b9=_0x1299e7[_0x2ce6('0x96')]({'plain':!![]});return db[_0x2ce6('0x97')][_0x2ce6('0x4d')]({'where':{'name':_0x2ce6('0x2e'),'userProfileId':_0x392dcb[_0x2ce6('0x93')]},'raw':!![]})['then'](function(_0x533cc4){if(_0x533cc4&&_0x533cc4[_0x2ce6('0x98')]===0x0){return db[_0x2ce6('0x2f')][_0x2ce6('0x90')]({'name':_0x4175b9[_0x2ce6('0x39')],'resourceId':_0x4175b9['id'],'type':_0x533cc4[_0x2ce6('0x39')],'sectionId':_0x533cc4['id']},{})[_0x2ce6('0x2c')](function(){return _0x1299e7;});}else{return _0x1299e7;}})['catch'](function(_0x1d265b){logger[_0x2ce6('0x56')](_0x2ce6('0x99'),_0x1d265b);throw _0x1d265b;});}return _0x1299e7;})[_0x2ce6('0x2c')](respondWithResult(_0x14e5af,null))[_0x2ce6('0x68')](handleError(_0x14e5af,null));}});}catch(_0x56cb24){_0x14e5af[_0x2ce6('0x21')](0x1f4)[_0x2ce6('0x31')](_0x56cb24);}};function removeReferences(_0x95dbea,_0x48d6a8){try{if(_0x95dbea){fs[_0x2ce6('0x64')](_0x95dbea);logger[_0x2ce6('0x65')]('Zip\x20archive\x20removed');}if(_0x48d6a8){rimraf(_0x48d6a8,function(){});logger['info'](_0x2ce6('0x9a'));}}catch(_0x51a112){logger[_0x2ce6('0x56')](_0x51a112);}}exports[_0x2ce6('0x9b')]=function(_0x178ad0,_0xc977c9,_0x151175){return db[_0x2ce6('0x34')]['find']({'where':{'id':_0x178ad0[_0x2ce6('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc977c9,null))[_0x2ce6('0x2c')](saveUpdates(_0x178ad0[_0x2ce6('0x92')],null))[_0x2ce6('0x2c')](respondWithResult(_0xc977c9,null))[_0x2ce6('0x68')](handleError(_0xc977c9,null));};exports[_0x2ce6('0x9c')]=function(_0x31d8f5,_0x3aaf86,_0x2da94a){return db[_0x2ce6('0x34')][_0x2ce6('0x4d')]({'where':{'id':_0x31d8f5[_0x2ce6('0x4c')]['id']}})[_0x2ce6('0x2c')](function(_0x16b23e){if(_0x16b23e){return _0x16b23e['destroy']();}})[_0x2ce6('0x2c')](function(_0x20d4bd){rimraf(path[_0x2ce6('0x4f')](config[_0x2ce6('0x50')],_0x2ce6('0x5c'),path[_0x2ce6('0x5d')](_0x20d4bd[_0x2ce6('0x9')])),function(){});return _0x20d4bd;})[_0x2ce6('0x2c')](handleEntityNotFound(_0x3aaf86,null))['then'](respondWithStatusCode(_0x3aaf86,null))[_0x2ce6('0x68')](handleError(_0x3aaf86,null));};exports['webhookGet']=function(_0x45a919,_0x5916ca,_0x50f604){return BPromise['resolve']()[_0x2ce6('0x2c')](function(){if(!_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9')]){throw new Error(_0x2ce6('0x9d'));}if(!_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x524880=_0x45a919['query'][_0x2ce6('0x9f')]?_0x45a919[_0x2ce6('0x3b')]['hostname']+':'+_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')]:'http://localhost:'+_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x9e')];var _0x21377a=_0x45a919['query'][_0x2ce6('0x23')]?_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0x23')]:!![];var _0x408128=_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0xa0')]?_0x45a919[_0x2ce6('0x3b')][_0x2ce6('0xa0')]:null;var _0x1bd143={'method':_0x45a919[_0x2ce6('0xa1')],'uri':util['format'](_0x2ce6('0xa2'),_0x524880,_0x45a919[_0x2ce6('0x3b')]['path']),'json':_0x21377a,'resolveWithFullResponse':!![],'encoding':_0x408128,'qs':_0x45a919['query']};if(_0x45a919[_0x2ce6('0xa3')]){_0x1bd143['headers']=_0x45a919[_0x2ce6('0xa3')];if(_0x1bd143['headers']['content-length']){delete _0x1bd143[_0x2ce6('0xa3')]['content-length'];}}if(_0x1bd143['headers'][_0x2ce6('0xa4')]){delete _0x1bd143['headers'][_0x2ce6('0xa4')];}return rp(_0x1bd143);})[_0x2ce6('0x2c')](function(_0x577fd3){if(_0x577fd3){_0x5916ca['set'](_0x577fd3[_0x2ce6('0xa3')]);logger[_0x2ce6('0x65')](_0x577fd3[_0x2ce6('0x92')]);if(_[_0x2ce6('0xa5')](_0x45a919['query'][_0x2ce6('0x9')],_0x2ce6('0x4e'))&&_0x577fd3[_0x2ce6('0xa6')]==0x1f4){return _0x5916ca[_0x2ce6('0x20')](_0x577fd3[_0x2ce6('0xa6')]);}else{return _0x5916ca[_0x2ce6('0x21')](_0x577fd3[_0x2ce6('0xa6')])[_0x2ce6('0x31')](_0x577fd3[_0x2ce6('0x92')]);}}else{return _0x5916ca[_0x2ce6('0x20')](0xc8);}})[_0x2ce6('0x68')](handleError(_0x5916ca,null));};exports[_0x2ce6('0xa7')]=function(_0x3151db,_0xc53e62,_0x2e2439){return BPromise[_0x2ce6('0xa8')]()[_0x2ce6('0x2c')](function(){if(!_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9')]){throw new Error(_0x2ce6('0x9d'));}if(!_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')]){throw new Error(_0x2ce6('0xa9'));}var _0x5ebaf1=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9f')]?_0x3151db['query']['hostname']+':'+_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')]:_0x2ce6('0xaa')+_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x9e')];var _0x5845a4=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0x23')]?_0x3151db['query'][_0x2ce6('0x23')]:!![];var _0x4fcac=_0x3151db[_0x2ce6('0x3b')][_0x2ce6('0xa0')]?_0x3151db['query']['encoding']:null;var _0x5a820d={'method':_0x3151db['method'],'uri':util[_0x2ce6('0x51')](_0x2ce6('0xa2'),_0x5ebaf1,_0x3151db['query'][_0x2ce6('0x9')]),'json':_0x5845a4,'resolveWithFullResponse':!![],'encoding':_0x4fcac,'body':_0x3151db[_0x2ce6('0x92')]};if(_0x3151db['headers']){_0x5a820d[_0x2ce6('0xa3')]=_0x3151db[_0x2ce6('0xa3')];if(_0x5a820d['headers'][_0x2ce6('0xab')]){delete _0x5a820d['headers'][_0x2ce6('0xab')];}}if(_0x5a820d['headers'][_0x2ce6('0xa4')]){delete _0x5a820d[_0x2ce6('0xa3')]['content-type'];}return rp(_0x5a820d);})[_0x2ce6('0x2c')](function(_0x37899a){if(_0x37899a){_0xc53e62[_0x2ce6('0x28')](_0x37899a[_0x2ce6('0xa3')]);logger['info'](_0x37899a['body']);return _0xc53e62[_0x2ce6('0x21')](_0x37899a['statusCode'])[_0x2ce6('0x31')](_0x37899a[_0x2ce6('0x92')]);}else{return _0xc53e62['sendStatus'](0xc8);}})[_0x2ce6('0x68')](handleError(_0xc53e62,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f51f3b1..448d728 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 _0x5d17=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5d17,0x114));var _0x75d1=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0x5d17[_0x2211b2];return _0x1ff209;};'use strict';var EventEmitter=require(_0x75d1('0x0'));var Plugin=require(_0x75d1('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75d1('0x2'),'afterUpdate':_0x75d1('0x3'),'afterDestroy':_0x75d1('0x4')};function emitEvent(_0x5b3267){return function(_0x177460,_0x45d03a,_0x387e35){PluginEvents[_0x75d1('0x5')](_0x5b3267+':'+_0x177460['id'],_0x177460);PluginEvents['emit'](_0x5b3267,_0x177460);_0x387e35(null);};}for(var e in events){if(events[_0x75d1('0x6')](e)){var event=events[e];Plugin[_0x75d1('0x7')](e,emitEvent(event));}}module[_0x75d1('0x8')]=PluginEvents; \ No newline at end of file +var _0x0d4d=['events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2e91d2,_0xe35e8a){var _0x25a889=function(_0x4e0d32){while(--_0x4e0d32){_0x2e91d2['push'](_0x2e91d2['shift']());}};_0x25a889(++_0xe35e8a);}(_0x0d4d,0x132));var _0xd0d4=function(_0x3dc84d,_0x2e77f7){_0x3dc84d=_0x3dc84d-0x0;var _0x467050=_0x0d4d[_0x3dc84d];return _0x467050;};'use strict';var EventEmitter=require(_0xd0d4('0x0'));var Plugin=require(_0xd0d4('0x1'))['db'][_0xd0d4('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd0d4('0x3')](0x0);var events={'afterCreate':_0xd0d4('0x4'),'afterUpdate':_0xd0d4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x984664){return function(_0x58909f,_0x2e99ee,_0x3787f4){PluginEvents['emit'](_0x984664+':'+_0x58909f['id'],_0x58909f);PluginEvents[_0xd0d4('0x6')](_0x984664,_0x58909f);_0x3787f4(null);};}for(var e in events){if(events[_0xd0d4('0x7')](e)){var event=events[e];Plugin[_0xd0d4('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 5165a4a..bfaa156 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 _0xc29c=['bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','define','plugins','util','api'];(function(_0x432838,_0x3840bd){var _0xbab9e8=function(_0x45f227){while(--_0x45f227){_0x432838['push'](_0x432838['shift']());}};_0xbab9e8(++_0x3840bd);}(_0xc29c,0x1ae));var _0xcc29=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0xc29c[_0x2e914];return _0x936e45;};'use strict';var _=require('lodash');var util=require(_0xcc29('0x0'));var logger=require('../../config/logger')(_0xcc29('0x1'));var moment=require('moment');var BPromise=require(_0xcc29('0x2'));var rp=require(_0xcc29('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc29('0x4'));var config=require(_0xcc29('0x5'));var attributes=require(_0xcc29('0x6'));module['exports']=function(_0x299a21,_0x5b7c51){return _0x299a21[_0xcc29('0x7')]('Plugin',attributes,{'tableName':_0xcc29('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f1=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x45e911,_0x517109){var _0x5df6b1=function(_0xa72468){while(--_0xa72468){_0x45e911['push'](_0x45e911['shift']());}};_0x5df6b1(++_0x517109);}(_0xb2f1,0x115));var _0x1b2f=function(_0x296c52,_0x1b48c4){_0x296c52=_0x296c52-0x0;var _0x2564e8=_0xb2f1[_0x296c52];return _0x2564e8;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require(_0x1b2f('0x2'))(_0x1b2f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require(_0x1b2f('0x6'));var config=require(_0x1b2f('0x7'));var attributes=require(_0x1b2f('0x8'));module[_0x1b2f('0x9')]=function(_0x7425f9,_0x37f00c){return _0x7425f9[_0x1b2f('0xa')](_0x1b2f('0xb'),attributes,{'tableName':_0x1b2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index c50d341..c2f9e52 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 _0x835a=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','create','body','options','raw','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s'];(function(_0x17df98,_0x531ddc){var _0x18ad2c=function(_0x4c0f73){while(--_0x4c0f73){_0x17df98['push'](_0x17df98['shift']());}};_0x18ad2c(++_0x531ddc);}(_0x835a,0x8d));var _0xa835=function(_0x1600b5,_0x111517){_0x1600b5=_0x1600b5-0x0;var _0x611c48=_0x835a[_0x1600b5];return _0x611c48;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa835('0x0'));var BPromise=require(_0xa835('0x1'));var rs=require(_0xa835('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa835('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa835('0x4'));var config=require(_0xa835('0x5'));var jayson=require(_0xa835('0x6'));var client=jayson[_0xa835('0x7')][_0xa835('0x8')]({'port':0x232a});config[_0xa835('0x9')]=_[_0xa835('0xa')](config['redis'],{'host':_0xa835('0xb'),'port':0x18eb});var socket=require(_0xa835('0xc'))(new Redis(config['redis']));require(_0xa835('0xd'))[_0xa835('0xe')](socket);function respondWithRpcPromise(_0x4c993f,_0x1bc927,_0x9107b7){return new BPromise(function(_0x2d4bca,_0x1d1df4){return client[_0xa835('0xf')](_0x4c993f,_0x9107b7)[_0xa835('0x10')](function(_0x3d2cc8){logger[_0xa835('0x11')](_0xa835('0x12'),_0x1bc927,_0xa835('0x13'));logger[_0xa835('0x14')](_0xa835('0x15'),_0x1bc927,_0xa835('0x13'),JSON['stringify'](_0x3d2cc8));if(_0x3d2cc8[_0xa835('0x16')]){if(_0x3d2cc8[_0xa835('0x16')][_0xa835('0x17')]===0x1f4){logger[_0xa835('0x16')](_0xa835('0x12'),_0x1bc927,_0x3d2cc8[_0xa835('0x16')][_0xa835('0x18')]);return _0x1d1df4(_0x3d2cc8[_0xa835('0x16')]['message']);}logger[_0xa835('0x16')]('Plugin,\x20%s,\x20%s',_0x1bc927,_0x3d2cc8['error']['message']);return _0x2d4bca(_0x3d2cc8[_0xa835('0x16')]['message']);}else{logger[_0xa835('0x11')](_0xa835('0x12'),_0x1bc927,_0xa835('0x13'));_0x2d4bca(_0x3d2cc8[_0xa835('0x19')][_0xa835('0x18')]);}})[_0xa835('0x1a')](function(_0x3b645d){logger[_0xa835('0x16')]('Plugin,\x20%s,\x20%s',_0x1bc927,_0x3b645d);_0x1d1df4(_0x3b645d);});});}exports[_0xa835('0x1b')]=function(_0x76311a){var _0x4f00ce=this;return new Promise(function(_0x1f51c7,_0x51ed3f){return db['Plugin'][_0xa835('0x1c')](_0x76311a[_0xa835('0x1d')],{'raw':_0x76311a[_0xa835('0x1e')]?_0x76311a[_0xa835('0x1e')][_0xa835('0x1f')]===undefined?!![]:![]:!![]})[_0xa835('0x10')](function(_0x583309){logger[_0xa835('0x11')](_0xa835('0x1b'),_0x76311a);logger[_0xa835('0x14')](_0xa835('0x1b'),_0x76311a,JSON['stringify'](_0x583309));_0x1f51c7(_0x583309);})[_0xa835('0x1a')](function(_0x2749f8){logger[_0xa835('0x16')](_0xa835('0x1b'),_0x2749f8[_0xa835('0x18')],_0x76311a);_0x51ed3f(_0x4f00ce[_0xa835('0x16')](0x1f4,_0x2749f8[_0xa835('0x18')]));});});}; \ No newline at end of file +var _0xd2fc=['then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreatePlugin','Plugin','create','body','options','info','stringify','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2fc,0xf8));var _0xcd2f=function(_0x219fa8,_0x186320){_0x219fa8=_0x219fa8-0x0;var _0x352d42=_0xd2fc[_0x219fa8];return _0x352d42;};'use strict';var _=require('lodash');var util=require(_0xcd2f('0x0'));var moment=require('moment');var BPromise=require(_0xcd2f('0x1'));var rs=require(_0xcd2f('0x2'));var fs=require('fs');var Redis=require(_0xcd2f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcd2f('0x4'))('rpc');var config=require(_0xcd2f('0x5'));var jayson=require(_0xcd2f('0x6'));var client=jayson[_0xcd2f('0x7')]['http']({'port':0x232a});config[_0xcd2f('0x8')]=_[_0xcd2f('0x9')](config['redis'],{'host':_0xcd2f('0xa'),'port':0x18eb});var socket=require(_0xcd2f('0xb'))(new Redis(config[_0xcd2f('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x59fb7f,_0x154225,_0x52aea2){return new BPromise(function(_0x1209be,_0x12375b){return client[_0xcd2f('0xc')](_0x59fb7f,_0x52aea2)[_0xcd2f('0xd')](function(_0x560f2c){logger['info'](_0xcd2f('0xe'),_0x154225,'request\x20sent');logger[_0xcd2f('0xf')](_0xcd2f('0x10'),_0x154225,'request\x20sent',JSON['stringify'](_0x560f2c));if(_0x560f2c['error']){if(_0x560f2c[_0xcd2f('0x11')]['code']===0x1f4){logger['error'](_0xcd2f('0xe'),_0x154225,_0x560f2c['error'][_0xcd2f('0x12')]);return _0x12375b(_0x560f2c[_0xcd2f('0x11')][_0xcd2f('0x12')]);}logger[_0xcd2f('0x11')](_0xcd2f('0xe'),_0x154225,_0x560f2c['error']['message']);return _0x1209be(_0x560f2c[_0xcd2f('0x11')]['message']);}else{logger['info'](_0xcd2f('0xe'),_0x154225,_0xcd2f('0x13'));_0x1209be(_0x560f2c[_0xcd2f('0x14')][_0xcd2f('0x12')]);}})[_0xcd2f('0x15')](function(_0x5450c4){logger[_0xcd2f('0x11')]('Plugin,\x20%s,\x20%s',_0x154225,_0x5450c4);_0x12375b(_0x5450c4);});});}exports[_0xcd2f('0x16')]=function(_0x4a948f){var _0x3888ac=this;return new Promise(function(_0x122af5,_0x487723){return db[_0xcd2f('0x17')][_0xcd2f('0x18')](_0x4a948f[_0xcd2f('0x19')],{'raw':_0x4a948f[_0xcd2f('0x1a')]?_0x4a948f[_0xcd2f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcd2f('0xd')](function(_0x145297){logger[_0xcd2f('0x1b')]('CreatePlugin',_0x4a948f);logger[_0xcd2f('0xf')](_0xcd2f('0x16'),_0x4a948f,JSON[_0xcd2f('0x1c')](_0x145297));_0x122af5(_0x145297);})[_0xcd2f('0x15')](function(_0xfc15b9){logger[_0xcd2f('0x11')]('CreatePlugin',_0xfc15b9[_0xcd2f('0x12')],_0x4a948f);_0x487723(_0x3888ac[_0xcd2f('0x11')](0x1f4,_0xfc15b9[_0xcd2f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 177568b..66ffcf9 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 _0xd7fb=['emit','register','length','./plugin.events','remove'];(function(_0x4565e7,_0x6446e3){var _0x14fd0a=function(_0x2ba136){while(--_0x2ba136){_0x4565e7['push'](_0x4565e7['shift']());}};_0x14fd0a(++_0x6446e3);}(_0xd7fb,0x10c));var _0xbd7f=function(_0x153338,_0x324298){_0x153338=_0x153338-0x0;var _0x517d70=_0xd7fb[_0x153338];return _0x517d70;};'use strict';var PluginEvents=require(_0xbd7f('0x0'));var events=['save',_0xbd7f('0x1'),'update'];function createListener(_0x4ddce9,_0x767deb){return function(_0x176c85){_0x767deb[_0xbd7f('0x2')](_0x4ddce9,_0x176c85);};}function removeListener(_0x37c911,_0x325ce2){return function(){PluginEvents['removeListener'](_0x37c911,_0x325ce2);};}exports[_0xbd7f('0x3')]=function(_0x37e99c){for(var _0x437d24=0x0,_0x5682f3=events[_0xbd7f('0x4')];_0x437d24<_0x5682f3;_0x437d24++){var _0x4ccb74=events[_0x437d24];var _0x346f41=createListener('plugin:'+_0x4ccb74,_0x37e99c);PluginEvents['on'](_0x4ccb74,_0x346f41);}}; \ No newline at end of file +var _0xf2fc=['remove','emit','removeListener','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2fc,0x100));var _0xcf2f=function(_0x2bd8a6,_0x5b9211){_0x2bd8a6=_0x2bd8a6-0x0;var _0x1e037a=_0xf2fc[_0x2bd8a6];return _0x1e037a;};'use strict';var PluginEvents=require(_0xcf2f('0x0'));var events=[_0xcf2f('0x1'),_0xcf2f('0x2'),'update'];function createListener(_0x47d963,_0x5f59ab){return function(_0x218397){_0x5f59ab[_0xcf2f('0x3')](_0x47d963,_0x218397);};}function removeListener(_0x37598d,_0x15a35e){return function(){PluginEvents[_0xcf2f('0x4')](_0x37598d,_0x15a35e);};}exports['register']=function(_0x2ef44e){for(var _0x2c5042=0x0,_0x41eeb2=events['length'];_0x2c5042<_0x41eeb2;_0x2c5042++){var _0x5220b6=events[_0x2c5042];var _0xf96abc=createListener(_0xcf2f('0x5')+_0x5220b6,_0x2ef44e);PluginEvents['on'](_0x5220b6,_0xf96abc);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1388454..85811df 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(_0x138574,_0x30b93d){var _0x4d720b=function(_0x3215d2){while(--_0x3215d2){_0x138574['push'](_0x138574['shift']());}};_0x4d720b(++_0x30b93d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x2f2089,_0x5f2982){var _0x348830=function(_0x5de729){while(--_0x5de729){_0x2f2089['push'](_0x2f2089['shift']());}};_0x348830(++_0x5f2982);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 5c34884..2d03fbe 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 _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x41bb,0xc5));var _0xb41b=function(_0x18e223,_0x339fd3){_0x18e223=_0x18e223-0x0;var _0x488099=_0x41bb[_0x18e223];return _0x488099;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file +var _0x55e0=['hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','exec','bluebird','sendStatus','json','error','name','status','send','info','index','then','reject','express','motion2','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55e0,0xdc));var _0x055e=function(_0x2a510b,_0x5db1ec){_0x2a510b=_0x2a510b-0x0;var _0xae024d=_0x55e0[_0x2a510b];return _0xae024d;};'use strict';var _=require(_0x055e('0x0'));var pm2=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var path=require('path');var exec=require('child_process')[_0x055e('0x4')];var BPromise=require(_0x055e('0x5'));function handleEntityNotFound(_0x33cd7b,_0x2773e4){return function(_0x157473){if(!_0x157473){_0x33cd7b[_0x055e('0x6')](0x194);;}return _0x157473;};}function respondWithResult(_0x490ee1,_0x5239f6){_0x5239f6=_0x5239f6||0xc8;return function(_0x4384ff){if(_0x4384ff){return _0x490ee1['status'](_0x5239f6)[_0x055e('0x7')](_0x4384ff);}return null;};}function handleError(_0x3c4cf,_0x376618){_0x376618=_0x376618||0x1f4;return function(_0x230c32){logger[_0x055e('0x8')](_0x230c32['stack']);if(_0x230c32[_0x055e('0x9')]){delete _0x230c32[_0x055e('0x9')];}_0x3c4cf[_0x055e('0xa')](_0x376618)[_0x055e('0xb')](_0x230c32);};}function execChildProcess(){return new BPromise(function(_0x238068,_0x5237d9){exec('npm\x20install',function(_0x187cce,_0x51c524,_0x3c44b2){logger[_0x055e('0xc')](_0x51c524);logger[_0x055e('0xc')](_0x3c44b2);if(_0x187cce){logger[_0x055e('0x8')](_0x187cce);return _0x5237d9(_0x187cce);}return _0x238068(_0x51c524);});});}exports[_0x055e('0xd')]=function(_0x31c649,_0x236a2b){return pm2['list']()[_0x055e('0xe')](function(_0xb80d83){if(_0xb80d83){var _0x3cfd14=_[_0x055e('0xf')](_0xb80d83,function(_0x222817){return _0x222817['name']===_0x055e('0x10')||_0x222817[_0x055e('0x9')]===_0x055e('0x11');});return{'rows':_0x3cfd14,'count':_0x3cfd14['length']};}return null;})[_0x055e('0xe')](respondWithResult(_0x236a2b,null))[_0x055e('0x12')](handleError(_0x236a2b,null));};exports[_0x055e('0x13')]=function(_0x2bad86,_0x2cc84e){return pm2['describe'](_0x2bad86[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x2cc84e,null))[_0x055e('0xe')](handleEntityNotFound(_0x2cc84e,null))[_0x055e('0x12')](handleError(_0x2cc84e,null));};exports['create']=function(_0x4004ce,_0x3cdd68){if(_0x4004ce['body'][_0x055e('0x9')]&&_0x4004ce[_0x055e('0x15')][_0x055e('0x16')]){var _0x124d86=path[_0x055e('0x17')](__dirname,_0x055e('0x18'),_0x4004ce['body'][_0x055e('0x16')]);var _0x2f0346=process[_0x055e('0x19')]();process['chdir'](path[_0x055e('0x1a')](_0x124d86));return execChildProcess()[_0x055e('0xe')](function(_0x32c64e){process[_0x055e('0x1b')](_0x2f0346);return pm2['start']({'name':_0x4004ce[_0x055e('0x15')]['name'],'script':_0x124d86});})[_0x055e('0xe')](function(_0x42a6aa){pm2[_0x055e('0x1c')]();return _0x42a6aa[0x0];})[_0x055e('0xe')](respondWithResult(_0x3cdd68,0xc9))[_0x055e('0x12')](handleError(_0x3cdd68,null));}else{return _0x3cdd68[_0x055e('0xa')](0x1f4)['send']({'message':_0x055e('0x1d')});}};exports[_0x055e('0x1e')]=function(_0x2a82f8,_0x4b5891){if(_0x2a82f8[_0x055e('0x15')]['id']){delete _0x2a82f8[_0x055e('0x15')]['id'];}var _0x42f2df={'online':_0x055e('0x1f'),'stopped':'stop'};if(_0x42f2df[_0x055e('0x20')](_0x2a82f8['body'][_0x055e('0xa')])){return pm2[_0x42f2df[_0x2a82f8[_0x055e('0x15')][_0x055e('0xa')]]](_0x2a82f8[_0x055e('0x14')]['id'])[_0x055e('0xe')](respondWithResult(_0x4b5891,0xc8))['catch'](handleError(_0x4b5891,null));}else{return _0x4b5891[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':_0x055e('0x21')});}};exports[_0x055e('0x22')]=function(_0x36abb2,_0x225c88){if(_0x36abb2[_0x055e('0x15')]['id']){delete _0x36abb2[_0x055e('0x15')]['id'];}if(_0x36abb2['params']['id']){return pm2[_0x055e('0x23')](_0x36abb2[_0x055e('0x14')]['id'])['then'](function(_0xd9298d){pm2[_0x055e('0x1c')]();return _0xd9298d[0x0];})[_0x055e('0xe')](respondWithResult(_0x225c88,null))[_0x055e('0x12')](handleError(_0x225c88,null));}else{return _0x225c88[_0x055e('0xa')](0x1f4)[_0x055e('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 63f15c1..e0e1342 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 _0xeb58=['get','isAuthenticated','getAgents','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb58,0x1dd));var _0x8eb5=function(_0x12d350,_0x530e50){_0x12d350=_0x12d350-0x0;var _0x57108a=_0xeb58[_0x12d350];return _0x57108a;};'use strict';var express=require(_0x8eb5('0x0'));var router=express[_0x8eb5('0x1')]();var auth=require(_0x8eb5('0x2'));var controller=require('./realtime.controller');router[_0x8eb5('0x3')]('/agents',auth[_0x8eb5('0x4')](),controller[_0x8eb5('0x5')]);router['get']('/queues',auth[_0x8eb5('0x4')](),controller[_0x8eb5('0x6')]);module[_0x8eb5('0x7')]=router; \ No newline at end of file +var _0xb5b4=['isAuthenticated','getAgents','get','getQueues','exports','../../components/auth/service','./realtime.controller'];(function(_0x419ca1,_0x40738b){var _0x5dac91=function(_0x4019c5){while(--_0x4019c5){_0x419ca1['push'](_0x419ca1['shift']());}};_0x5dac91(++_0x40738b);}(_0xb5b4,0x98));var _0x4b5b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb5b4[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4b5b('0x0'));var controller=require(_0x4b5b('0x1'));router['get']('/agents',auth[_0x4b5b('0x2')](),controller[_0x4b5b('0x3')]);router[_0x4b5b('0x4')]('/queues',auth['isAuthenticated'](),controller[_0x4b5b('0x5')]);module[_0x4b5b('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 08ac5e9..c23b60e 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 _0xfaff=['chatCapacity','mailCapacity','faxCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','channel','query','globalQueueFilter','fieldName','type','key','role','agent','isEmpty','where','user','userProfileId','nolimit','UserProfile','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','rawAttributes','getOptions','QueueCampaigns','util','lodash','jayson/promise','../../config/logger','api','../../mysqldb','client','http','offset','limit','undefined','count','status','Content-Range','json','error','stack','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','voice','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','paused','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','loggedInDb','waiting','talking','outbound','find','pick','filter','length','busy','some','connectedlinenum','getMembers','UserId','accountcode','online','agents','User','Queue','Pause','findAll','QueueId','unknown','ringing','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','voiceStatus','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','isArray','findOne','all','flatten','uniq','fields','globalStatus','order','startsWith','DESC','ASC','sort','getAgents','userpic','lastLoginAt','pauseType','lastPauseAt','whatsappPause','faxPause'];(function(_0x394739,_0x19ce1e){var _0x48d11e=function(_0x570c40){while(--_0x570c40){_0x394739['push'](_0x394739['shift']());}};_0x48d11e(++_0x19ce1e);}(_0xfaff,0x173));var _0xffaf=function(_0xd180a1,_0x4f4ca1){_0xd180a1=_0xd180a1-0x0;var _0x349c05=_0xfaff[_0xd180a1];return _0x349c05;};'use strict';var util=require(_0xffaf('0x0'));var _=require(_0xffaf('0x1'));var jayson=require(_0xffaf('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xffaf('0x3'))(_0xffaf('0x4'));var db=require(_0xffaf('0x5'))['db'];var amiClient=jayson[_0xffaf('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0xffaf('0x6')][_0xffaf('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x43e774,_0x5662d1){return function(_0x55a923){if(_0x55a923){var _0x2cf7ae=typeof _0x5662d1[_0xffaf('0x8')]==='undefined'&&typeof _0x5662d1[_0xffaf('0x9')]===_0xffaf('0xa');var _0x2657a1=_0x55a923[_0xffaf('0xb')];var _0x36d787=_0x2cf7ae?0x0:_0x5662d1['offset'];var _0x4a9ab3=_0x2cf7ae?_0x55a923[_0xffaf('0xb')]:_0x5662d1[_0xffaf('0x8')]+_0x5662d1['limit'];var _0x361e50;if(_0x4a9ab3>=_0x2657a1){_0x4a9ab3=_0x2657a1;_0x361e50=0xc8;}else{_0x361e50=0xce;}_0x43e774[_0xffaf('0xc')](_0x361e50);return _0x43e774['set'](_0xffaf('0xd'),_0x36d787+'-'+_0x4a9ab3+'/'+_0x2657a1)[_0xffaf('0xe')](_0x55a923);}return null;};}function handleError(_0x13c67c,_0x3b2876){_0x3b2876=_0x3b2876||0x1f4;return function(_0x4ccc80){logger[_0xffaf('0xf')](_0x4ccc80[_0xffaf('0x10')]);if(_0x4ccc80['name']){delete _0x4ccc80[_0xffaf('0x11')];}_0x13c67c[_0xffaf('0xc')](_0x3b2876)[_0xffaf('0x12')](_0x4ccc80);};}function getRealtimeAgents(){return new Promise(function(_0x4cb300,_0x1a149a){return amiClient[_0xffaf('0x13')]('Agents',{})[_0xffaf('0x14')](function(_0x23b8da){if(_0x23b8da[_0xffaf('0xf')])throw new Error(_0xffaf('0x15'));var _0x15ee9e=_0x23b8da[_0xffaf('0x16')];return routingClient['request'](_0xffaf('0x17'),{})[_0xffaf('0x14')](function(_0x569415){if(_0x569415['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x5a46c6=_0x569415[_0xffaf('0x16')];return _0x4cb300(_[_0xffaf('0x18')]({},_0x15ee9e,_0x5a46c6));});})[_0xffaf('0x19')](function(_0x4062f9){_0x1a149a(_0x4062f9);});});}function getRealtimeQueues(_0x1dbefd,_0x218cd8){return new Promise(function(_0xfd4db8,_0x691113){var _0x7416e4=_0x218cd8===_0xffaf('0x1a')?amiClient:routingClient;return _0x7416e4['request'](_[_0xffaf('0x1b')](_0x218cd8)+_0xffaf('0x1c'),_0x1dbefd)[_0xffaf('0x14')](function(_0x4beb53){if(_0x4beb53[_0xffaf('0xf')])throw new Error(util[_0xffaf('0x1d')](_0xffaf('0x1e'),_0x218cd8));return _0xfd4db8(_0x4beb53['result']);})['catch'](function(_0x56c754){_0x691113(_0x56c754);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3b2ac4,_0x3ee05b){return amiClient[_0xffaf('0x13')](_0xffaf('0x1f'),{})[_0xffaf('0x14')](function(_0x5e940b){if(_0x5e940b[_0xffaf('0xf')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x3b2ac4(_0x5e940b[_0xffaf('0x16')]);})[_0xffaf('0x19')](function(_0x21bd0b){_0x3ee05b(_0x21bd0b);});});}function initializeQueues(_0x4394b7,_0x266c73,_0x32dc1c,_0x1b8cc4){var _0x103fbe=[_0xffaf('0x20'),_0xffaf('0x21'),'waiting','talking',_0xffaf('0x22')];if(_0x32dc1c==='voice'&&_0x1b8cc4==='outbound'){_0x103fbe[_0xffaf('0x23')](_0xffaf('0x24'),_0xffaf('0x25'),_0xffaf('0x26'),_0xffaf('0x27'),_0xffaf('0x28'),_0xffaf('0x29'),'startPredictive',_0xffaf('0x2a'),_0xffaf('0x2b'),_0xffaf('0x2c'),_0xffaf('0x2d'),_0xffaf('0x2e'),_0xffaf('0x2f'),_0xffaf('0x30'),_0xffaf('0x31'),_0xffaf('0x32'),_0xffaf('0x33'),_0xffaf('0x34'),_0xffaf('0x35'),_0xffaf('0x36'),_0xffaf('0x37'),'predictiveIntervalAvgTalktime');}return _0x4394b7[_0xffaf('0x38')](function(_0x53b630){var _0x5551aa=_0x53b630[_0xffaf('0x39')]({'plain':!![]});_0x5551aa['agents']=[];_0x5551aa[_0xffaf('0x22')]=0x0;_0x5551aa[_0xffaf('0x3a')]=0x0;_0x5551aa[_0xffaf('0x20')]=0x0;_0x5551aa['available']=0x0;_0x5551aa[_0xffaf('0x3b')]=0x0;if(_0x32dc1c===_0xffaf('0x1a')){_0x5551aa[_0xffaf('0x3c')]=0x0;_0x5551aa['busy']=0x0;if(_0x1b8cc4===_0xffaf('0x3d')){_0x5551aa[_0xffaf('0x24')]=0x0;_0x5551aa[_0xffaf('0x25')]=0x0;}}var _0x148948=_[_0xffaf('0x3e')](_0x266c73,['id',_0x5551aa['id']]);if(_0x148948)_['merge'](_0x5551aa,_[_0xffaf('0x3f')](_0x148948,_0x103fbe));return _0x5551aa;});}function updateAgentVoiceStatus(_0x541bef,_0xd72e28,_0x2804ce){var _0x23b260=_[_0xffaf('0x40')](_0x2804ce,['queue',_0xd72e28[_0xffaf('0x11')]]);if(_0x23b260[_0xffaf('0x41')]===0x0)return _0x541bef[_0xffaf('0x42')]=!![];if(_[_0xffaf('0x43')](_0x23b260,[_0xffaf('0x44'),_0x541bef['internal']['toString']()]))return _0x541bef[_0xffaf('0x3c')]=!![];if(!_0x541bef['talking'])return _0x541bef['busy']=!![];}function getVoiceQueueAgents(_0x4ca184,_0x4c4d5c,_0x562b60,_0x24026f){var _0x513ab8=_[_0xffaf('0x3e')](_0x4c4d5c,['id',_0x4ca184['id']]);if(!_0x513ab8)return _0x4ca184;return _0x513ab8[_0xffaf('0x45')]({'raw':!![]})[_0xffaf('0x14')](function(_0x2201bb){for(var _0x2f1ce2=0x0;_0x2f1ce2<_0x2201bb['length'];_0x2f1ce2++){var _0x5747f0=_['find'](_0x562b60,['id',_0x2201bb[_0x2f1ce2][_0xffaf('0x46')]]);if(!_0x5747f0){_0x5747f0={'id':_0x2201bb[_0x2f1ce2][_0xffaf('0x46')],'name':_0x2201bb[_0x2f1ce2][_0xffaf('0x46')],'accountcode':'','online':![]};}var _0x4b76bb={'id':_0x5747f0['id'],'name':_0x5747f0[_0xffaf('0x11')],'internal':_0x5747f0[_0xffaf('0x47')],'online':Boolean(_0x5747f0[_0xffaf('0x48')]),'paused':Boolean(_0x2201bb[_0x2f1ce2]['paused'])};if(_0x5747f0['voiceStatus']===_0xffaf('0x3c'))updateAgentVoiceStatus(_0x4b76bb,_0x4ca184,_0x24026f);if(_0x4b76bb[_0xffaf('0x48')])_0x4ca184[_0xffaf('0x3a')]++;if(_0x4b76bb[_0xffaf('0x42')])_0x4ca184[_0xffaf('0x42')]++;if(_0x4b76bb[_0xffaf('0x22')]&&!_0x4b76bb['busy']&&!_0x4b76bb['talking'])_0x4ca184[_0xffaf('0x22')]++;_0x4ca184[_0xffaf('0x49')][_0xffaf('0x23')](_0x4b76bb);}return _0x4ca184;});}function getQueueAgents(_0x58576c,_0xb221b3,_0x5a10bf){var _0x49e644=_0xffaf('0x4a')+_[_0xffaf('0x1b')](_0x5a10bf)+_0xffaf('0x4b');var _0x581516=_0x5a10bf+_0xffaf('0x4c');return db[_0x49e644][_0xffaf('0x4d')]({'where':{[_[_0xffaf('0x1b')](_0x5a10bf)+_0xffaf('0x4e')]:_0x58576c['id']},'raw':!![]})[_0xffaf('0x14')](function(_0x174555){for(var _0x21c8e0=0x0;_0x21c8e0<_0x174555[_0xffaf('0x41')];_0x21c8e0++){var _0xd59bf2=_[_0xffaf('0x3e')](_0xb221b3,['id',_0x174555[_0x21c8e0][_0xffaf('0x46')]]);if(!_0xd59bf2){_0xd59bf2={'id':_0x174555[_0x21c8e0][_0xffaf('0x46')],'name':_0x174555[_0x21c8e0]['UserId'],'online':![],['pauseField']:![]};}var _0x23979f={'id':_0xd59bf2['id'],'name':_0xd59bf2[_0xffaf('0x11')],'online':Boolean(_0xd59bf2[_0xffaf('0x48')]),'paused':Boolean(_0xd59bf2[_0x581516])};if(_0x23979f[_0xffaf('0x48')])_0x58576c['loggedInDb']++;_0x58576c['agents'][_0xffaf('0x23')](_0x23979f);}return _0x58576c;});}function isIdle(_0x122e14){return _0x122e14==='idle'||_0x122e14===_0xffaf('0x4f')||_0x122e14==='unavailable'||_0x122e14===_0xffaf('0x50')||_[_0xffaf('0x51')](_0x122e14);}function isAgentPaused(_0x2c79c4,_0x4f8595){var _0x3443fe=[_0x2c79c4[_0xffaf('0x52')],_0x2c79c4['faxPause'],_0x2c79c4[_0xffaf('0x53')],_0x2c79c4[_0xffaf('0x54')],_0x2c79c4[_0xffaf('0x55')],_0x2c79c4[_0xffaf('0x56')],_0x2c79c4['whatsappPause']];if(!_0x4f8595)return _[_0xffaf('0x57')](_0x3443fe);var _0x15eb8f=_[_0xffaf('0x40')](_0x3443fe);return _0x15eb8f[_0xffaf('0x41')]>0x0&&_0x15eb8f[_0xffaf('0x41')]<_0x3443fe['length']?!![]:![];}function isAgentIdle(_0x39550b){if(_0x39550b[_0xffaf('0x58')]!==_0xffaf('0x59')&&_0x39550b['voicePause']){_0x39550b[_0xffaf('0x58')]=_0xffaf('0x5a');return![];}return _['every']([_0x39550b[_0xffaf('0x5b')],_0x39550b[_0xffaf('0x5c')],_0x39550b[_0xffaf('0x5d')],_0x39550b[_0xffaf('0x5e')],_0x39550b['smsStatus'],_0x39550b[_0xffaf('0x58')],_0x39550b[_0xffaf('0x5f')]],isIdle);}function getAgentStatus(_0x17716c){var _0x2dd47d=_0xffaf('0x4f');if(isAgentPaused(_0x17716c))_0x2dd47d=_0xffaf('0x5a');else if(isAgentPaused(_0x17716c,!![]))_0x2dd47d=_0xffaf('0x60');else if(isAgentIdle(_0x17716c))_0x2dd47d=_0xffaf('0x59');else _0x2dd47d=_0xffaf('0x42');return _0x2dd47d;}function validateChannel(_0x6f73a6){var _0x3b90c5=[_0xffaf('0x61'),_0xffaf('0x62'),_0xffaf('0x63'),_0xffaf('0x64'),_0xffaf('0x65'),_0xffaf('0x66'),_0xffaf('0x1a')];if(!_[_0xffaf('0x67')](_0x3b90c5,_0x6f73a6[_0xffaf('0x68')]()))throw new Error('Invalid\x20channel');return _0x6f73a6[_0xffaf('0x68')]();}function getFilteredAgentIds(_0x6eed2a,_0x4d4af8){var _0x2b5b76=_[_0xffaf('0x69')](_0x6eed2a)?_0x6eed2a:[_0x6eed2a];var _0x129809=_[_0xffaf('0x38')](_0x2b5b76,function(_0x30fad7){return db[_0x4d4af8][_0xffaf('0x6a')]({'where':{'name':_0x30fad7}})[_0xffaf('0x14')](function(_0x1e0900){if(!_0x1e0900)return[];return _0x1e0900['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xffaf('0x6b')](_0x129809)[_0xffaf('0x14')](function(_0x1c7a60){var _0x2a8a0f=_(_0x1c7a60)[_0xffaf('0x6c')]()[_0xffaf('0x38')]('id')[_0xffaf('0x6d')]()['value']();return _0x2a8a0f;});}function getUpdatedSortOptions(_0x41631b){var _0x37274b={'fields':[],'order':null};var _0x223358=_0x41631b['split'](',');_0x37274b[_0xffaf('0x6e')]=_['filter'](_0x223358,function(_0x2e03cf){if(!_0x2e03cf[_0xffaf('0x67')](_0xffaf('0x6f')))return!![];_0x37274b[_0xffaf('0x70')]=_[_0xffaf('0x71')](_0x2e03cf,'-')?_0xffaf('0x72'):_0xffaf('0x73');return![];});return _0x37274b;}function orderAgentsByStatus(_0x89f3b0,_0x1664eb){return _0x89f3b0[_0xffaf('0x74')](function(_0x5e0965,_0x3ad689){if(_0x5e0965['globalStatus']===_0x3ad689[_0xffaf('0x6f')]&&_0x5e0965[_0xffaf('0x6f')]===_0xffaf('0x5a')){if(_0x1664eb===_0xffaf('0x72'))return(_0x5e0965['pauseType']||'')<(_0x3ad689['pauseType']||'')?0x1:-0x1;return _0x5e0965['pauseType']<_0x3ad689['pauseType']?-0x1:0x1;}else{if(_0x1664eb==='DESC')return _0x5e0965[_0xffaf('0x6f')]<_0x3ad689[_0xffaf('0x6f')]?0x1:-0x1;return _0x5e0965[_0xffaf('0x6f')]<_0x3ad689[_0xffaf('0x6f')]?-0x1:0x1;}});}exports[_0xffaf('0x75')]=function(_0x5dd05e,_0x44c987){var _0x211c53={'count':0x0,'rows':[]},_0x3b3897={},_0x2e6adc,_0x236ac0,_0x58044d,_0x30e7e3,_0x55ec90=[_0xffaf('0x76'),_0xffaf('0x48'),_0xffaf('0x77'),'lastPauseAt',_0xffaf('0x78'),_0xffaf('0x79'),'internal','address',_0xffaf('0x52'),_0xffaf('0x54'),'mailPause',_0xffaf('0x55'),_0xffaf('0x7a'),_0xffaf('0x7b'),_0xffaf('0x56'),_0xffaf('0x7c'),'openchannelCapacity',_0xffaf('0x7d'),'smsCapacity','whatsappCapacity',_0xffaf('0x7e'),'chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity',_0xffaf('0x7f'),_0xffaf('0x5b'),'openchannelStatus',_0xffaf('0x5d'),_0xffaf('0x80'),_0xffaf('0x5f'),'faxStatus',_0xffaf('0x58'),_0xffaf('0x81'),_0xffaf('0x82'),_0xffaf('0x83'),_0xffaf('0x84'),_0xffaf('0x85'),_0xffaf('0x86'),_0xffaf('0x87'),_0xffaf('0x88'),_0xffaf('0x89'),_0xffaf('0x8a'),_0xffaf('0x8b'),_0xffaf('0x8c'),_0xffaf('0x8d')],_0x443250=[_0xffaf('0x52'),'openchannelPause',_0xffaf('0x53'),'smsPause',_0xffaf('0x7a'),_0xffaf('0x7b'),_0xffaf('0x56'),_0xffaf('0x48')];Promise[_0xffaf('0x8e')]()[_0xffaf('0x14')](function(){if(_0x5dd05e['query'][_0xffaf('0x8f')])_0x2e6adc=validateChannel(_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x8f')]);if(!_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x74')]||!_0x5dd05e[_0xffaf('0x90')]['sort']['includes'](_0xffaf('0x6f')))return;var _0x517baf=getUpdatedSortOptions(_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x74')]);_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x74')]=_0x517baf[_0xffaf('0x6e')]['join'](',');_0x236ac0=_0x517baf['order'];})[_0xffaf('0x14')](function(){if(!_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x91')])return[];var _0x1a4f4b=_[_0xffaf('0x1b')](_0x2e6adc)+'Queue';return getFilteredAgentIds(_0x5dd05e[_0xffaf('0x90')]['globalQueueFilter'],_0x1a4f4b);})['then'](function(_0x2d128f){var _0x336e3f=_[_0xffaf('0x38')](db[_0xffaf('0x4a')]['rawAttributes'],function(_0x57c9a9){return{'name':_0x57c9a9[_0xffaf('0x92')],'type':_0x57c9a9[_0xffaf('0x93')][_0xffaf('0x94')]};});_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x95')]=_0xffaf('0x96');_0x5dd05e['query'][_0xffaf('0x48')]=!![];_0x3b3897=qs['getOptions'](_0x336e3f,_0x5dd05e);_0x3b3897['raw']=!![];if(!_[_0xffaf('0x97')](_0x2d128f)){_0x3b3897[_0xffaf('0x98')]=_[_0xffaf('0x18')](_0x3b3897[_0xffaf('0x98')],{'$and':[{'id':{'$in':_0x2d128f}}]});}else if(!_[_0xffaf('0x97')](_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x91')])){return _0x211c53;}if(_0x5dd05e[_0xffaf('0x99')][_0xffaf('0x95')]===_0xffaf('0x99')){var _0x567b59={'params':{'id':_0x5dd05e[_0xffaf('0x99')][_0xffaf('0x9a')]},'query':{'section':_0xffaf('0x17'),'role':_0xffaf('0x96'),'online':!![],'nolimit':_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x9b')],'sort':_0x5dd05e['query'][_0xffaf('0x74')],'filter':_0x5dd05e[_0xffaf('0x90')][_0xffaf('0x40')],'raw':!![],'ids':_0x2d128f}};return db[_0xffaf('0x9c')]['getResources'](_0x567b59);}return db[_0xffaf('0x4a')][_0xffaf('0x9d')](_0x3b3897);})[_0xffaf('0x14')](function(_0x55a4ee){_0x211c53[_0xffaf('0xb')]=_0x55a4ee[_0xffaf('0xb')];_0x58044d=_0x55a4ee[_0xffaf('0x9e')];return getRealtimeAgents();})[_0xffaf('0x14')](function(_0x53b2fe){_0x30e7e3=_0x53b2fe[_0xffaf('0x9e')];return _0x58044d[_0xffaf('0x38')](function(_0x4e487c){var _0x301ad6=_[_0xffaf('0x3e')](_0x30e7e3,['id',_0x4e487c['id']]);if(_0x301ad6)_[_0xffaf('0x18')](_0x4e487c,_[_0xffaf('0x3f')](_[_0xffaf('0x9f')](_0x301ad6,_0x443250),_0x55ec90));_0x4e487c[_0xffaf('0x6f')]=getAgentStatus(_0x4e487c);return _0x4e487c;});})[_0xffaf('0x14')](function(_0x5a9336){var _0x5b4b0d;if(_0x5dd05e[_0xffaf('0x90')][_0xffaf('0xa0')]){_0x5b4b0d=_[_0xffaf('0x40')](_0x5a9336,[_0xffaf('0x6f'),_0x5dd05e['query']['globalStatusFilter']]);if(_0x5dd05e[_0xffaf('0x90')][_0xffaf('0xa1')]){_0x5b4b0d=_[_0xffaf('0x40')](_0x5b4b0d,['pauseType',_0x5dd05e[_0xffaf('0x90')]['pauseTypeFilter']]);}}if(_0x5b4b0d)_0x5a9336=_0x5b4b0d;if(!_0x236ac0)return _0x5a9336;return orderAgentsByStatus(_0x5a9336,_0x236ac0);})[_0xffaf('0x14')](function(_0x307db7){_0x211c53[_0xffaf('0x9e')]=_0x307db7;return _0x211c53;})[_0xffaf('0x14')](respondWithFilteredResult(_0x44c987,_0x3b3897))[_0xffaf('0x19')](handleError(_0x44c987,null));};exports['getQueues']=function(_0x18a658,_0x3bc389){var _0x18b04c={'count':0x0,'rows':[]},_0x24fcd5={},_0x30f16d,_0x393b18,_0x4621d6,_0x327c77,_0x4f74c3;Promise[_0xffaf('0x8e')]()[_0xffaf('0x14')](function(){if(_0x18a658[_0xffaf('0x90')][_0xffaf('0x8f')])_0x30f16d=validateChannel(_0x18a658['query']['channel']);var _0x3bb230=_[_0xffaf('0x1b')](_0x30f16d)+'Queue';var _0xd1c0d0=_['map'](db[_0x3bb230][_0xffaf('0xa2')],function(_0x3a67ba){return{'name':_0x3a67ba['fieldName'],'type':_0x3a67ba[_0xffaf('0x93')][_0xffaf('0x94')]};});_0x24fcd5=qs[_0xffaf('0xa3')](_0xd1c0d0,_0x18a658);if(_0x18a658[_0xffaf('0x99')][_0xffaf('0x95')]==='user'){var _0xef657c={'params':{'id':_0x18a658[_0xffaf('0x99')]['userProfileId']},'query':{'section':_0x30f16d===_0xffaf('0x1a')&&_0x18a658[_0xffaf('0x90')]['type']==='outbound'?_0xffaf('0xa4'):_[_0xffaf('0x1b')](_0x30f16d)+_0xffaf('0x1c'),'type':_0x18a658[_0xffaf('0x90')]['type'],'nolimit':!![],'sort':_0xffaf('0x11'),'filter':_0x18a658['query'][_0xffaf('0x40')]}};return db[_0xffaf('0x9c')]['getResources'](_0xef657c);}return db[_0x3bb230]['findAndCountAll'](_0x24fcd5);})[_0xffaf('0x14')](function(_0x2ee527){_0x18b04c[_0xffaf('0xb')]=_0x2ee527[_0xffaf('0xb')];_0x393b18=_0x2ee527[_0xffaf('0x9e')];return getRealtimeQueues(_0x18a658,_0x30f16d);})[_0xffaf('0x14')](function(_0x404504){_0x327c77=_0x404504[_0xffaf('0x9e')];return getRealtimeAgents();})[_0xffaf('0x14')](function(_0x7c2736){_0x4621d6=_0x7c2736[_0xffaf('0x9e')];if(_0x30f16d!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xffaf('0x14')](function(_0x4b00fa){_0x4f74c3=_0x4b00fa?_0x4b00fa[_0xffaf('0x9e')]:[];return initializeQueues(_0x393b18,_0x327c77,_0x30f16d,_0x18a658['query'][_0xffaf('0x93')]);})['then'](function(_0x271cbc){var _0x1eac74=_0x271cbc[_0xffaf('0x38')](function(_0x3b26be){if(_0x30f16d==='voice')return getVoiceQueueAgents(_0x3b26be,_0x393b18,_0x4621d6,_0x4f74c3);else return getQueueAgents(_0x3b26be,_0x4621d6,_0x30f16d);});return Promise[_0xffaf('0x6b')](_0x1eac74);})['then'](function(_0x25ae70){_0x18b04c[_0xffaf('0x9e')]=_0x25ae70;return _0x18b04c;})[_0xffaf('0x14')](respondWithFilteredResult(_0x3bc389,_0x24fcd5))['catch'](handleError(_0x3bc389,null));}; \ No newline at end of file +var _0x44ee=['Queue','globalQueueFilter','fieldName','key','agent','getOptions','isEmpty','where','role','user','userProfileId','nolimit','UserProfile','omit','globalStatusFilter','pauseTypeFilter','rawAttributes','QueueCampaigns','getResources','findAndCountAll','rows','type','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','count','limit','status','set','Content-Range','stack','name','send','error','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','outbound','push','originated','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','loggedInDb','available','voice','pTalking','find','pick','filter','queue','length','busy','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','paused','voiceStatus','agents','User','Pause','findAll','idle','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','*pause','mail','sms','toLowerCase','Invalid\x20channel','isArray','getAgents','all','flatten','value','split','fields','includes','globalStatus','order','startsWith','DESC','pauseType','lastPauseAt','chatPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','routealias','resolve','channel','query','sort','join'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x44ee,0x1e7));var _0xe44e=function(_0x561d9b,_0x1a7508){_0x561d9b=_0x561d9b-0x0;var _0xf0b943=_0x44ee[_0x561d9b];return _0xf0b943;};'use strict';var util=require(_0xe44e('0x0'));var _=require(_0xe44e('0x1'));var jayson=require(_0xe44e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe44e('0x3'))(_0xe44e('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xe44e('0x5')][_0xe44e('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xe44e('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2ef89f,_0x17a048){return function(_0x2668e0){if(_0x2668e0){var _0x3b56a9=typeof _0x17a048[_0xe44e('0x7')]===_0xe44e('0x8')&&typeof _0x17a048['limit']===_0xe44e('0x8');var _0x2fb2ec=_0x2668e0[_0xe44e('0x9')];var _0xd777d9=_0x3b56a9?0x0:_0x17a048[_0xe44e('0x7')];var _0x44612c=_0x3b56a9?_0x2668e0[_0xe44e('0x9')]:_0x17a048[_0xe44e('0x7')]+_0x17a048[_0xe44e('0xa')];var _0x527196;if(_0x44612c>=_0x2fb2ec){_0x44612c=_0x2fb2ec;_0x527196=0xc8;}else{_0x527196=0xce;}_0x2ef89f[_0xe44e('0xb')](_0x527196);return _0x2ef89f[_0xe44e('0xc')](_0xe44e('0xd'),_0xd777d9+'-'+_0x44612c+'/'+_0x2fb2ec)['json'](_0x2668e0);}return null;};}function handleError(_0xf9f195,_0x3fd0e6){_0x3fd0e6=_0x3fd0e6||0x1f4;return function(_0x537d55){logger['error'](_0x537d55[_0xe44e('0xe')]);if(_0x537d55[_0xe44e('0xf')]){delete _0x537d55['name'];}_0xf9f195[_0xe44e('0xb')](_0x3fd0e6)[_0xe44e('0x10')](_0x537d55);};}function getRealtimeAgents(){return new Promise(function(_0x2eaf54,_0x2a8a1b){return amiClient['request']('Agents',{})['then'](function(_0x4de300){if(_0x4de300[_0xe44e('0x11')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x15224d=_0x4de300[_0xe44e('0x12')];return routingClient[_0xe44e('0x13')](_0xe44e('0x14'),{})['then'](function(_0x15c5b3){if(_0x15c5b3[_0xe44e('0x11')])throw new Error(_0xe44e('0x15'));var _0xf7ee03=_0x15c5b3['result'];return _0x2eaf54(_[_0xe44e('0x16')]({},_0x15224d,_0xf7ee03));});})['catch'](function(_0x16f4b0){_0x2a8a1b(_0x16f4b0);});});}function getRealtimeQueues(_0x4b8401,_0x13e488){return new Promise(function(_0x470bcd,_0x136d4a){var _0x52febd=_0x13e488==='voice'?amiClient:routingClient;return _0x52febd[_0xe44e('0x13')](_[_0xe44e('0x17')](_0x13e488)+_0xe44e('0x18'),_0x4b8401)[_0xe44e('0x19')](function(_0x54da33){if(_0x54da33[_0xe44e('0x11')])throw new Error(util[_0xe44e('0x1a')](_0xe44e('0x1b'),_0x13e488));return _0x470bcd(_0x54da33[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x23fc47){_0x136d4a(_0x23fc47);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x13e84f,_0x19e5d1){return amiClient[_0xe44e('0x13')](_0xe44e('0x1d'),{})[_0xe44e('0x19')](function(_0x296cef){if(_0x296cef[_0xe44e('0x11')])throw new Error(_0xe44e('0x1e'));return _0x13e84f(_0x296cef[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x50b4b2){_0x19e5d1(_0x50b4b2);});});}function initializeQueues(_0x5b3b3a,_0x4769f8,_0x5b7f8d,_0x3f545f){var _0x5c2d83=[_0xe44e('0x1f'),'available',_0xe44e('0x20'),_0xe44e('0x21'),'paused'];if(_0x5b7f8d==='voice'&&_0x3f545f===_0xe44e('0x22')){_0x5c2d83[_0xe44e('0x23')]('pTalking',_0xe44e('0x24'),'message','dialActive','dialMethod',_0xe44e('0x25'),'startPredictive',_0xe44e('0x26'),'erlangCalls',_0xe44e('0x27'),_0xe44e('0x28'),_0xe44e('0x29'),_0xe44e('0x2a'),'dialPredictiveIntervalMaxThreshold',_0xe44e('0x2b'),_0xe44e('0x2c'),'predictiveIntervalTotalCalls',_0xe44e('0x2d'),_0xe44e('0x2e'),_0xe44e('0x2f'),_0xe44e('0x30'),'predictiveIntervalAvgTalktime');}return _0x5b3b3a[_0xe44e('0x31')](function(_0x3b3a27){var _0xef6488=_0x3b3a27['get']({'plain':!![]});_0xef6488['agents']=[];_0xef6488['paused']=0x0;_0xef6488[_0xe44e('0x32')]=0x0;_0xef6488['loggedIn']=0x0;_0xef6488[_0xe44e('0x33')]=0x0;_0xef6488['waiting']=0x0;if(_0x5b7f8d===_0xe44e('0x34')){_0xef6488[_0xe44e('0x21')]=0x0;_0xef6488['busy']=0x0;if(_0x3f545f===_0xe44e('0x22')){_0xef6488[_0xe44e('0x35')]=0x0;_0xef6488[_0xe44e('0x24')]=0x0;}}var _0x5a07c8=_[_0xe44e('0x36')](_0x4769f8,['id',_0xef6488['id']]);if(_0x5a07c8)_[_0xe44e('0x16')](_0xef6488,_[_0xe44e('0x37')](_0x5a07c8,_0x5c2d83));return _0xef6488;});}function updateAgentVoiceStatus(_0x14fbc3,_0x2331be,_0x1373a9){var _0x4bcb2b=_[_0xe44e('0x38')](_0x1373a9,[_0xe44e('0x39'),_0x2331be[_0xe44e('0xf')]]);if(_0x4bcb2b[_0xe44e('0x3a')]===0x0)return _0x14fbc3[_0xe44e('0x3b')]=!![];if(_['some'](_0x4bcb2b,[_0xe44e('0x3c'),_0x14fbc3[_0xe44e('0x3d')][_0xe44e('0x3e')]()]))return _0x14fbc3[_0xe44e('0x21')]=!![];if(!_0x14fbc3['talking'])return _0x14fbc3[_0xe44e('0x3b')]=!![];}function getVoiceQueueAgents(_0x43b8bc,_0x8a151a,_0x4eb566,_0x33242d){var _0xb5ca79=_[_0xe44e('0x36')](_0x8a151a,['id',_0x43b8bc['id']]);if(!_0xb5ca79)return _0x43b8bc;return _0xb5ca79[_0xe44e('0x3f')]({'raw':!![]})['then'](function(_0xaaec59){for(var _0xe2caa6=0x0;_0xe2caa6<_0xaaec59[_0xe44e('0x3a')];_0xe2caa6++){var _0x3bf4d2=_[_0xe44e('0x36')](_0x4eb566,['id',_0xaaec59[_0xe2caa6]['UserId']]);if(!_0x3bf4d2){_0x3bf4d2={'id':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'name':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'accountcode':'','online':![]};}var _0x1c1b8f={'id':_0x3bf4d2['id'],'name':_0x3bf4d2[_0xe44e('0xf')],'internal':_0x3bf4d2[_0xe44e('0x41')],'online':Boolean(_0x3bf4d2[_0xe44e('0x42')]),'paused':Boolean(_0xaaec59[_0xe2caa6][_0xe44e('0x43')])};if(_0x3bf4d2[_0xe44e('0x44')]===_0xe44e('0x21'))updateAgentVoiceStatus(_0x1c1b8f,_0x43b8bc,_0x33242d);if(_0x1c1b8f['online'])_0x43b8bc['loggedInDb']++;if(_0x1c1b8f['busy'])_0x43b8bc[_0xe44e('0x3b')]++;if(_0x1c1b8f[_0xe44e('0x43')]&&!_0x1c1b8f[_0xe44e('0x3b')]&&!_0x1c1b8f[_0xe44e('0x21')])_0x43b8bc[_0xe44e('0x43')]++;_0x43b8bc[_0xe44e('0x45')][_0xe44e('0x23')](_0x1c1b8f);}return _0x43b8bc;});}function getQueueAgents(_0x58eabb,_0x452e2d,_0x4e8c52){var _0x1065fb=_0xe44e('0x46')+_[_0xe44e('0x17')](_0x4e8c52)+'Queue';var _0x331364=_0x4e8c52+_0xe44e('0x47');return db[_0x1065fb][_0xe44e('0x48')]({'where':{[_[_0xe44e('0x17')](_0x4e8c52)+'QueueId']:_0x58eabb['id']},'raw':!![]})[_0xe44e('0x19')](function(_0x547758){for(var _0xc417e5=0x0;_0xc417e5<_0x547758[_0xe44e('0x3a')];_0xc417e5++){var _0x31ea27=_[_0xe44e('0x36')](_0x452e2d,['id',_0x547758[_0xc417e5][_0xe44e('0x40')]]);if(!_0x31ea27){_0x31ea27={'id':_0x547758[_0xc417e5][_0xe44e('0x40')],'name':_0x547758[_0xc417e5][_0xe44e('0x40')],'online':![],['pauseField']:![]};}var _0x50f930={'id':_0x31ea27['id'],'name':_0x31ea27['name'],'online':Boolean(_0x31ea27['online']),'paused':Boolean(_0x31ea27[_0x331364])};if(_0x50f930['online'])_0x58eabb[_0xe44e('0x32')]++;_0x58eabb[_0xe44e('0x45')]['push'](_0x50f930);}return _0x58eabb;});}function isIdle(_0x2e10cd){return _0x2e10cd===_0xe44e('0x49')||_0x2e10cd===_0xe44e('0x4a')||_0x2e10cd===_0xe44e('0x4b')||_0x2e10cd===_0xe44e('0x4c')||_[_0xe44e('0x4d')](_0x2e10cd);}function isAgentPaused(_0x10e765,_0x4c8451){var _0x2e8ea7=[_0x10e765['chatPause'],_0x10e765[_0xe44e('0x4e')],_0x10e765[_0xe44e('0x4f')],_0x10e765[_0xe44e('0x50')],_0x10e765[_0xe44e('0x51')],_0x10e765[_0xe44e('0x52')],_0x10e765[_0xe44e('0x53')]];if(!_0x4c8451)return _[_0xe44e('0x54')](_0x2e8ea7);var _0x5f4d49=_[_0xe44e('0x38')](_0x2e8ea7);return _0x5f4d49[_0xe44e('0x3a')]>0x0&&_0x5f4d49[_0xe44e('0x3a')]<_0x2e8ea7[_0xe44e('0x3a')]?!![]:![];}function isAgentIdle(_0x32d1dc){if(_0x32d1dc[_0xe44e('0x44')]!==_0xe44e('0x49')&&_0x32d1dc['voicePause']){_0x32d1dc['voiceStatus']=_0xe44e('0x55');return![];}return _[_0xe44e('0x54')]([_0x32d1dc[_0xe44e('0x56')],_0x32d1dc[_0xe44e('0x57')],_0x32d1dc[_0xe44e('0x58')],_0x32d1dc[_0xe44e('0x59')],_0x32d1dc['smsStatus'],_0x32d1dc[_0xe44e('0x44')],_0x32d1dc['whatsappStatus']],isIdle);}function getAgentStatus(_0x4b081a){var _0x1a342f=_0xe44e('0x4a');if(isAgentPaused(_0x4b081a))_0x1a342f=_0xe44e('0x55');else if(isAgentPaused(_0x4b081a,!![]))_0x1a342f=_0xe44e('0x5a');else if(isAgentIdle(_0x4b081a))_0x1a342f=_0xe44e('0x49');else _0x1a342f='busy';return _0x1a342f;}function validateChannel(_0x55cb0c){var _0x2dc163=[_0xe44e('0x5b'),'chat',_0xe44e('0x5c'),'openchannel','fax','whatsapp',_0xe44e('0x34')];if(!_['includes'](_0x2dc163,_0x55cb0c[_0xe44e('0x5d')]()))throw new Error(_0xe44e('0x5e'));return _0x55cb0c['toLowerCase']();}function getFilteredAgentIds(_0x14c262,_0x31364c){var _0x344788=_[_0xe44e('0x5f')](_0x14c262)?_0x14c262:[_0x14c262];var _0x258137=_[_0xe44e('0x31')](_0x344788,function(_0x131dff){return db[_0x31364c]['findOne']({'where':{'name':_0x131dff}})['then'](function(_0x5739aa){if(!_0x5739aa)return[];return _0x5739aa[_0xe44e('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe44e('0x61')](_0x258137)[_0xe44e('0x19')](function(_0x2346cb){var _0x1dd9a8=_(_0x2346cb)[_0xe44e('0x62')]()[_0xe44e('0x31')]('id')['uniq']()[_0xe44e('0x63')]();return _0x1dd9a8;});}function getUpdatedSortOptions(_0x3801b8){var _0x332cdf={'fields':[],'order':null};var _0x46082e=_0x3801b8[_0xe44e('0x64')](',');_0x332cdf[_0xe44e('0x65')]=_[_0xe44e('0x38')](_0x46082e,function(_0x5dfbe1){if(!_0x5dfbe1[_0xe44e('0x66')](_0xe44e('0x67')))return!![];_0x332cdf[_0xe44e('0x68')]=_[_0xe44e('0x69')](_0x5dfbe1,'-')?_0xe44e('0x6a'):'ASC';return![];});return _0x332cdf;}function orderAgentsByStatus(_0x5531dc,_0x5a039b){return _0x5531dc['sort'](function(_0x1ab6ae,_0x11ee7b){if(_0x1ab6ae[_0xe44e('0x67')]===_0x11ee7b[_0xe44e('0x67')]&&_0x1ab6ae[_0xe44e('0x67')]===_0xe44e('0x55')){if(_0x5a039b===_0xe44e('0x6a'))return(_0x1ab6ae['pauseType']||'')<(_0x11ee7b[_0xe44e('0x6b')]||'')?0x1:-0x1;return _0x1ab6ae['pauseType']<_0x11ee7b['pauseType']?-0x1:0x1;}else{if(_0x5a039b===_0xe44e('0x6a'))return _0x1ab6ae['globalStatus']<_0x11ee7b[_0xe44e('0x67')]?0x1:-0x1;return _0x1ab6ae[_0xe44e('0x67')]<_0x11ee7b[_0xe44e('0x67')]?-0x1:0x1;}});}exports[_0xe44e('0x60')]=function(_0x14dbdc,_0x5463fe){var _0x88ea1b={'count':0x0,'rows':[]},_0x5c080c={},_0xd11c1f,_0x1e815e,_0x4ab16b,_0x1a03f0,_0x2dae0f=['userpic',_0xe44e('0x42'),'lastLoginAt','lastPauseAt',_0xe44e('0x6b'),_0xe44e('0x6c'),_0xe44e('0x3d'),'address',_0xe44e('0x6d'),_0xe44e('0x50'),_0xe44e('0x4f'),_0xe44e('0x51'),'whatsappPause',_0xe44e('0x4e'),'voicePause',_0xe44e('0x6e'),_0xe44e('0x6f'),'mailCapacity',_0xe44e('0x70'),_0xe44e('0x71'),_0xe44e('0x72'),'chatCurrentCapacity',_0xe44e('0x73'),_0xe44e('0x74'),_0xe44e('0x75'),_0xe44e('0x76'),'faxCurrentCapacity',_0xe44e('0x56'),_0xe44e('0x59'),'mailStatus',_0xe44e('0x77'),_0xe44e('0x78'),'faxStatus','voiceStatus',_0xe44e('0x79'),_0xe44e('0x7a'),_0xe44e('0x7b'),'smsStatusTime',_0xe44e('0x7c'),'faxStatusTime',_0xe44e('0x7d'),_0xe44e('0x39'),_0xe44e('0x7e'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xe44e('0x7f')],_0x71d430=[_0xe44e('0x6d'),_0xe44e('0x50'),'mailPause',_0xe44e('0x51'),_0xe44e('0x53'),_0xe44e('0x4e'),_0xe44e('0x52'),'online'];Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x14dbdc['query']['channel'])_0xd11c1f=validateChannel(_0x14dbdc['query'][_0xe44e('0x81')]);if(!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]||!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')][_0xe44e('0x66')](_0xe44e('0x67')))return;var _0x26eea4=getUpdatedSortOptions(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]);_0x14dbdc['query'][_0xe44e('0x83')]=_0x26eea4[_0xe44e('0x65')][_0xe44e('0x84')](',');_0x1e815e=_0x26eea4[_0xe44e('0x68')];})[_0xe44e('0x19')](function(){if(!_0x14dbdc[_0xe44e('0x82')]['globalQueueFilter'])return[];var _0x2e68f9=_[_0xe44e('0x17')](_0xd11c1f)+_0xe44e('0x85');return getFilteredAgentIds(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')],_0x2e68f9);})[_0xe44e('0x19')](function(_0x256849){var _0x4bd192=_[_0xe44e('0x31')](db[_0xe44e('0x46')]['rawAttributes'],function(_0x396157){return{'name':_0x396157[_0xe44e('0x87')],'type':_0x396157['type'][_0xe44e('0x88')]};});_0x14dbdc[_0xe44e('0x82')]['role']=_0xe44e('0x89');_0x14dbdc['query'][_0xe44e('0x42')]=!![];_0x5c080c=qs[_0xe44e('0x8a')](_0x4bd192,_0x14dbdc);_0x5c080c['raw']=!![];if(!_[_0xe44e('0x8b')](_0x256849)){_0x5c080c['where']=_[_0xe44e('0x16')](_0x5c080c[_0xe44e('0x8c')],{'$and':[{'id':{'$in':_0x256849}}]});}else if(!_[_0xe44e('0x8b')](_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')])){return _0x88ea1b;}if(_0x14dbdc['user'][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x2bc678={'params':{'id':_0x14dbdc['user'][_0xe44e('0x8f')]},'query':{'section':'Agents','role':_0xe44e('0x89'),'online':!![],'nolimit':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x90')],'sort':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')],'filter':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x38')],'raw':!![],'ids':_0x256849}};return db[_0xe44e('0x91')]['getResources'](_0x2bc678);}return db[_0xe44e('0x46')]['findAndCountAll'](_0x5c080c);})[_0xe44e('0x19')](function(_0x3f0d22){_0x88ea1b[_0xe44e('0x9')]=_0x3f0d22[_0xe44e('0x9')];_0x4ab16b=_0x3f0d22['rows'];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0xc22968){_0x1a03f0=_0xc22968['rows'];return _0x4ab16b[_0xe44e('0x31')](function(_0x40f2b8){var _0x4ceed1=_[_0xe44e('0x36')](_0x1a03f0,['id',_0x40f2b8['id']]);if(_0x4ceed1)_['merge'](_0x40f2b8,_['pick'](_[_0xe44e('0x92')](_0x4ceed1,_0x71d430),_0x2dae0f));_0x40f2b8[_0xe44e('0x67')]=getAgentStatus(_0x40f2b8);return _0x40f2b8;});})[_0xe44e('0x19')](function(_0x154fa3){var _0x58b5e7;if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]){_0x58b5e7=_[_0xe44e('0x38')](_0x154fa3,[_0xe44e('0x67'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]]);if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]){_0x58b5e7=_['filter'](_0x58b5e7,[_0xe44e('0x6b'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]]);}}if(_0x58b5e7)_0x154fa3=_0x58b5e7;if(!_0x1e815e)return _0x154fa3;return orderAgentsByStatus(_0x154fa3,_0x1e815e);})[_0xe44e('0x19')](function(_0x9a7f69){_0x88ea1b['rows']=_0x9a7f69;return _0x88ea1b;})['then'](respondWithFilteredResult(_0x5463fe,_0x5c080c))['catch'](handleError(_0x5463fe,null));};exports['getQueues']=function(_0x2b22a6,_0x452e0c){var _0x468ee2={'count':0x0,'rows':[]},_0x322d64={},_0x231030,_0x41865e,_0x148e40,_0x44ed9a,_0x251a92;Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x81')])_0x231030=validateChannel(_0x2b22a6['query'][_0xe44e('0x81')]);var _0x4f126c=_[_0xe44e('0x17')](_0x231030)+_0xe44e('0x85');var _0xf89534=_[_0xe44e('0x31')](db[_0x4f126c][_0xe44e('0x95')],function(_0x20655b){return{'name':_0x20655b[_0xe44e('0x87')],'type':_0x20655b['type'][_0xe44e('0x88')]};});_0x322d64=qs[_0xe44e('0x8a')](_0xf89534,_0x2b22a6);if(_0x2b22a6[_0xe44e('0x8e')][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x4d8417={'params':{'id':_0x2b22a6[_0xe44e('0x8e')]['userProfileId']},'query':{'section':_0x231030==='voice'&&_0x2b22a6[_0xe44e('0x82')]['type']===_0xe44e('0x22')?_0xe44e('0x96'):_[_0xe44e('0x17')](_0x231030)+'Queues','type':_0x2b22a6[_0xe44e('0x82')]['type'],'nolimit':!![],'sort':'name','filter':_0x2b22a6[_0xe44e('0x82')]['filter']}};return db['UserProfile'][_0xe44e('0x97')](_0x4d8417);}return db[_0x4f126c][_0xe44e('0x98')](_0x322d64);})[_0xe44e('0x19')](function(_0x447214){_0x468ee2[_0xe44e('0x9')]=_0x447214[_0xe44e('0x9')];_0x41865e=_0x447214[_0xe44e('0x99')];return getRealtimeQueues(_0x2b22a6,_0x231030);})[_0xe44e('0x19')](function(_0x56ce4e){_0x44ed9a=_0x56ce4e[_0xe44e('0x99')];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0x2dfd4c){_0x148e40=_0x2dfd4c[_0xe44e('0x99')];if(_0x231030!=_0xe44e('0x34'))return;return getRealtimeVoiceQueueChannels();})[_0xe44e('0x19')](function(_0x4f22f8){_0x251a92=_0x4f22f8?_0x4f22f8['rows']:[];return initializeQueues(_0x41865e,_0x44ed9a,_0x231030,_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x9a')]);})[_0xe44e('0x19')](function(_0x4bae17){var _0x3ece2d=_0x4bae17['map'](function(_0x343963){if(_0x231030===_0xe44e('0x34'))return getVoiceQueueAgents(_0x343963,_0x41865e,_0x148e40,_0x251a92);else return getQueueAgents(_0x343963,_0x148e40,_0x231030);});return Promise[_0xe44e('0x61')](_0x3ece2d);})['then'](function(_0x261860){_0x468ee2[_0xe44e('0x99')]=_0x261860;return _0x468ee2;})[_0xe44e('0x19')](respondWithFilteredResult(_0x452e0c,_0x322d64))[_0xe44e('0x1c')](handleError(_0x452e0c,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index cf1f4bc..2da9b6d 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1bedef,_0x2742e6){var _0x4dcb08=function(_0x4dcb88){while(--_0x4dcb88){_0x1bedef['push'](_0x1bedef['shift']());}};_0x4dcb08(++_0x2742e6);}(_0x70e0,0x17b));var _0x070e=function(_0x5547c9,_0x19e469){_0x5547c9=_0x5547c9-0x0;var _0x288f81=_0x70e0[_0x5547c9];return _0x288f81;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4b1a76,_0x5d81b3){var _0xed86e1=function(_0x34d093){while(--_0x34d093){_0x4b1a76['push'](_0x4b1a76['shift']());}};_0xed86e1(++_0x5d81b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 23b2350..5ea0ad3 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 _0x27a8=['STRING','DATE','INTEGER'];(function(_0x9234eb,_0x114d75){var _0x214240=function(_0x293ceb){while(--_0x293ceb){_0x9234eb['push'](_0x9234eb['shift']());}};_0x214240(++_0x114d75);}(_0x27a8,0x170));var _0x827a=function(_0x2754c1,_0x4cc8d5){_0x2754c1=_0x2754c1-0x0;var _0x31e00a=_0x27a8[_0x2754c1];return _0x31e00a;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x827a('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x827a('0x1')]},'scheduledat':{'type':Sequelize[_0x827a('0x2')]},'uniqueid':{'type':Sequelize[_0x827a('0x1')]},'starttime':{'type':Sequelize[_0x827a('0x2')]},'responsetime':{'type':Sequelize[_0x827a('0x2')]},'ringtime':{'type':Sequelize[_0x827a('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x827a('0x1')]},'campaigntype':{'type':Sequelize[_0x827a('0x1')]},'membername':{'type':Sequelize[_0x827a('0x1')]}}; \ No newline at end of file +var _0xfdcd=['DATE','exports','INTEGER','STRING'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xdfdc('0x0')]={'state':{'type':Sequelize[_0xdfdc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdfdc('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xdfdc('0x2')]},'starttime':{'type':Sequelize[_0xdfdc('0x3')]},'responsetime':{'type':Sequelize[_0xdfdc('0x3')]},'ringtime':{'type':Sequelize[_0xdfdc('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdfdc('0x2')]},'campaigntype':{'type':Sequelize[_0xdfdc('0x2')]},'membername':{'type':Sequelize[_0xdfdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0d7eacb..93f61c2 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 _0x97ef=['ReportAgentPreview','report_agent_preview','lodash','util','api','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x2a275e,_0x5aa79b){var _0x2287fe=function(_0x2f2a70){while(--_0x2f2a70){_0x2a275e['push'](_0x2a275e['shift']());}};_0x2287fe(++_0x5aa79b);}(_0x97ef,0x16d));var _0xf97e=function(_0x2dea8d,_0x1c3075){_0x2dea8d=_0x2dea8d-0x0;var _0x34178e=_0x97ef[_0x2dea8d];return _0x34178e;};'use strict';var _=require(_0xf97e('0x0'));var util=require(_0xf97e('0x1'));var logger=require('../../config/logger')(_0xf97e('0x2'));var moment=require('moment');var BPromise=require(_0xf97e('0x3'));var rp=require(_0xf97e('0x4'));var fs=require('fs');var path=require(_0xf97e('0x5'));var rimraf=require('rimraf');var config=require(_0xf97e('0x6'));var attributes=require(_0xf97e('0x7'));module['exports']=function(_0x5e4697,_0x12d657){return _0x5e4697[_0xf97e('0x8')](_0xf97e('0x9'),attributes,{'tableName':_0xf97e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf33a=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f2a6d,_0x41b785){var _0x36f857=function(_0x1a18e5){while(--_0x1a18e5){_0x2f2a6d['push'](_0x2f2a6d['shift']());}};_0x36f857(++_0x41b785);}(_0xf33a,0x155));var _0xaf33=function(_0x36f5e4,_0x36f27c){_0x36f5e4=_0x36f5e4-0x0;var _0x17f908=_0xf33a[_0x36f5e4];return _0x17f908;};'use strict';var _=require(_0xaf33('0x0'));var util=require(_0xaf33('0x1'));var logger=require('../../config/logger')(_0xaf33('0x2'));var moment=require(_0xaf33('0x3'));var BPromise=require(_0xaf33('0x4'));var rp=require(_0xaf33('0x5'));var fs=require('fs');var path=require(_0xaf33('0x6'));var rimraf=require(_0xaf33('0x7'));var config=require(_0xaf33('0x8'));var attributes=require(_0xaf33('0x9'));module[_0xaf33('0xa')]=function(_0x271daa,_0x196cc7){return _0x271daa[_0xaf33('0xb')](_0xaf33('0xc'),attributes,{'tableName':_0xaf33('0xd'),'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 883d99e..f1daa0f 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 _0x07c3=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','raw','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xbc6f5e,_0x186e47){var _0xbff8ac=function(_0x2ff561){while(--_0x2ff561){_0xbc6f5e['push'](_0xbc6f5e['shift']());}};_0xbff8ac(++_0x186e47);}(_0x07c3,0x142));var _0x307c=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x07c3[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x307c('0x0'));var util=require(_0x307c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x307c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x307c('0x3'))['db'];var utils=require(_0x307c('0x4'));var logger=require(_0x307c('0x5'))(_0x307c('0x6'));var config=require(_0x307c('0x7'));var jayson=require(_0x307c('0x8'));var client=jayson[_0x307c('0x9')][_0x307c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x96c102,_0x140a18,_0x4a20bb){return new BPromise(function(_0x3486e4,_0x288cae){return client[_0x307c('0xb')](_0x96c102,_0x4a20bb)[_0x307c('0xc')](function(_0x17cfbf){logger[_0x307c('0xd')](_0x307c('0xe'),_0x140a18,_0x307c('0xf'));logger[_0x307c('0x10')](_0x307c('0x11'),_0x140a18,'request\x20sent',JSON[_0x307c('0x12')](_0x17cfbf));if(_0x17cfbf[_0x307c('0x13')]){if(_0x17cfbf[_0x307c('0x13')]['code']===0x1f4){logger[_0x307c('0x13')](_0x307c('0xe'),_0x140a18,_0x17cfbf[_0x307c('0x13')][_0x307c('0x14')]);return _0x288cae(_0x17cfbf[_0x307c('0x13')]['message']);}logger[_0x307c('0x13')](_0x307c('0xe'),_0x140a18,_0x17cfbf['error'][_0x307c('0x14')]);return _0x3486e4(_0x17cfbf[_0x307c('0x13')]['message']);}else{logger[_0x307c('0xd')](_0x307c('0xe'),_0x140a18,_0x307c('0xf'));_0x3486e4(_0x17cfbf[_0x307c('0x15')][_0x307c('0x14')]);}})[_0x307c('0x16')](function(_0x56cb90){logger[_0x307c('0x13')](_0x307c('0xe'),_0x140a18,_0x56cb90);_0x288cae(_0x56cb90);});});}exports[_0x307c('0x17')]=function(_0xd589b){var _0x4cff72=this;return new Promise(function(_0x4883f4,_0x2d6bdd){return db[_0x307c('0x18')][_0x307c('0x19')](_0xd589b[_0x307c('0x1a')],{'raw':_0xd589b['options']?_0xd589b['options'][_0x307c('0x1b')]===undefined?!![]:![]:!![]})[_0x307c('0xc')](function(_0x4683d1){logger[_0x307c('0xd')](_0x307c('0x17'),_0xd589b);logger[_0x307c('0x10')](_0x307c('0x17'),_0xd589b,JSON[_0x307c('0x12')](_0x4683d1));_0x4883f4(_0x4683d1);})[_0x307c('0x16')](function(_0x4be27d){logger[_0x307c('0x13')](_0x307c('0x17'),_0x4be27d[_0x307c('0x14')],_0xd589b);_0x2d6bdd(_0x4cff72['error'](0x1f4,_0x4be27d['message']));});});}; \ No newline at end of file +var _0xd876=['../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x330c71,_0x290139){var _0x1f5916=function(_0x3c2b8d){while(--_0x3c2b8d){_0x330c71['push'](_0x330c71['shift']());}};_0x1f5916(++_0x290139);}(_0xd876,0xff));var _0x6d87=function(_0x362e9f,_0x105264){_0x362e9f=_0x362e9f-0x0;var _0x13e5e6=_0xd876[_0x362e9f];return _0x13e5e6;};'use strict';var _=require(_0x6d87('0x0'));var util=require('util');var moment=require(_0x6d87('0x1'));var BPromise=require(_0x6d87('0x2'));var rs=require(_0x6d87('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d87('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d87('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d87('0x6')][_0x6d87('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15c0be,_0x65fa87,_0x1aa589){return new BPromise(function(_0x4c03e8,_0x9d6dc4){return client[_0x6d87('0x8')](_0x15c0be,_0x1aa589)[_0x6d87('0x9')](function(_0x5dd51d){logger[_0x6d87('0xa')](_0x6d87('0xb'),_0x65fa87,_0x6d87('0xc'));logger[_0x6d87('0xd')](_0x6d87('0xe'),_0x65fa87,_0x6d87('0xc'),JSON[_0x6d87('0xf')](_0x5dd51d));if(_0x5dd51d[_0x6d87('0x10')]){if(_0x5dd51d[_0x6d87('0x10')]['code']===0x1f4){logger['error'](_0x6d87('0xb'),_0x65fa87,_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);return _0x9d6dc4(_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);}logger[_0x6d87('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x65fa87,_0x5dd51d[_0x6d87('0x10')][_0x6d87('0x11')]);return _0x4c03e8(_0x5dd51d['error'][_0x6d87('0x11')]);}else{logger[_0x6d87('0xa')](_0x6d87('0xb'),_0x65fa87,_0x6d87('0xc'));_0x4c03e8(_0x5dd51d[_0x6d87('0x12')]['message']);}})[_0x6d87('0x13')](function(_0x4e30a2){logger['error'](_0x6d87('0xb'),_0x65fa87,_0x4e30a2);_0x9d6dc4(_0x4e30a2);});});}exports['CreateReportAgentPreview']=function(_0x28ef1e){var _0x1654ed=this;return new Promise(function(_0x34e77f,_0x29715c){return db[_0x6d87('0x14')][_0x6d87('0x15')](_0x28ef1e[_0x6d87('0x16')],{'raw':_0x28ef1e[_0x6d87('0x17')]?_0x28ef1e[_0x6d87('0x17')][_0x6d87('0x18')]===undefined?!![]:![]:!![]})[_0x6d87('0x9')](function(_0x1fa88d){logger[_0x6d87('0xa')](_0x6d87('0x19'),_0x28ef1e);logger[_0x6d87('0xd')]('CreateReportAgentPreview',_0x28ef1e,JSON['stringify'](_0x1fa88d));_0x34e77f(_0x1fa88d);})[_0x6d87('0x13')](function(_0x5362d4){logger[_0x6d87('0x10')](_0x6d87('0x19'),_0x5362d4[_0x6d87('0x11')],_0x28ef1e);_0x29715c(_0x1654ed[_0x6d87('0x10')](0x1f4,_0x5362d4['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 119e2bd..a2dcaea 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 _0x254c=['/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x254c,0x135));var _0xc254=function(_0x55ce0f,_0x3fdd8c){_0x55ce0f=_0x55ce0f-0x0;var _0x4e54a9=_0x254c[_0x55ce0f];return _0x4e54a9;};'use strict';var multer=require(_0xc254('0x0'));var util=require(_0xc254('0x1'));var path=require(_0xc254('0x2'));var express=require(_0xc254('0x3'));var router=express[_0xc254('0x4')]();var auth=require(_0xc254('0x5'));var controller=require(_0xc254('0x6'));router[_0xc254('0x7')]('/voice/channels',auth['isAuthenticated'](),controller[_0xc254('0x8')]);router[_0xc254('0x7')](_0xc254('0x9'),auth['isAuthenticated'](),controller[_0xc254('0xa')]);router[_0xc254('0x7')](_0xc254('0xb'),auth[_0xc254('0xc')](),controller[_0xc254('0xd')]);router[_0xc254('0x7')](_0xc254('0xe'),auth[_0xc254('0xc')](),controller['voiceQueues']);router[_0xc254('0x7')](_0xc254('0xf'),auth[_0xc254('0xc')](),controller['chatQueues']);router[_0xc254('0x7')](_0xc254('0x10'),auth[_0xc254('0xc')](),controller[_0xc254('0x11')]);router['get'](_0xc254('0x12'),auth[_0xc254('0xc')](),controller[_0xc254('0x13')]);router['get'](_0xc254('0x14'),auth[_0xc254('0xc')](),controller[_0xc254('0x15')]);router['get'](_0xc254('0x16'),auth[_0xc254('0xc')](),controller['smsQueues']);router[_0xc254('0x7')](_0xc254('0x17'),auth['isAuthenticated'](),controller['whatsappQueues']);router[_0xc254('0x7')](_0xc254('0x18'),auth[_0xc254('0xc')](),controller[_0xc254('0x19')]);router[_0xc254('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xc254('0x1a')]);router[_0xc254('0x7')](_0xc254('0x1b'),auth['isAuthenticated'](),controller[_0xc254('0x1c')]);router['get'](_0xc254('0x1d'),auth[_0xc254('0xc')](),controller[_0xc254('0x1e')]);router[_0xc254('0x7')](_0xc254('0x1f'),auth[_0xc254('0xc')](),controller[_0xc254('0x20')]);router[_0xc254('0x7')](_0xc254('0x21'),auth[_0xc254('0xc')](),controller['voiceQueuesChannelRedirect']);router['get'](_0xc254('0x22'),auth[_0xc254('0xc')](),controller['showVoiceQueues']);router[_0xc254('0x23')](_0xc254('0x22'),auth['isAuthenticated'](),controller[_0xc254('0x24')]);router[_0xc254('0x7')](_0xc254('0x25'),auth[_0xc254('0xc')](),controller[_0xc254('0x26')]);router[_0xc254('0x7')](_0xc254('0x27'),auth[_0xc254('0xc')](),controller[_0xc254('0x28')]);router[_0xc254('0x7')](_0xc254('0x29'),auth[_0xc254('0xc')](),controller['agents']);router[_0xc254('0x23')](_0xc254('0x2a'),auth[_0xc254('0xc')](),controller[_0xc254('0x2b')]);router[_0xc254('0x7')](_0xc254('0x2c'),auth['isAuthenticated'](),controller[_0xc254('0x2d')]);router[_0xc254('0x7')](_0xc254('0x2e'),auth['isAuthenticated'](),controller[_0xc254('0x2f')]);router[_0xc254('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0xc254('0x30')]);router[_0xc254('0x7')](_0xc254('0x31'),auth[_0xc254('0xc')](),controller['faxAccounts']);router['get'](_0xc254('0x32'),auth['isAuthenticated'](),controller[_0xc254('0x33')]);router['get'](_0xc254('0x34'),auth[_0xc254('0xc')](),controller[_0xc254('0x35')]);router[_0xc254('0x7')](_0xc254('0x36'),auth[_0xc254('0xc')](),controller[_0xc254('0x37')]);router[_0xc254('0x7')](_0xc254('0x38'),auth[_0xc254('0xc')](),controller[_0xc254('0x39')]);router[_0xc254('0x7')](_0xc254('0x3a'),auth[_0xc254('0xc')](),controller[_0xc254('0x3b')]);router[_0xc254('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0xc254('0xc')](),controller[_0xc254('0x3c')]);router[_0xc254('0x7')](_0xc254('0x3d'),auth['isAuthenticated'](),controller[_0xc254('0x3e')]);router[_0xc254('0x3f')](_0xc254('0x40'),auth['isAuthenticated'](),controller[_0xc254('0x41')](_0xc254('0x42')));router['get']('/mail/queues/:id',auth[_0xc254('0xc')](),controller[_0xc254('0x43')]);router['post'](_0xc254('0x44'),auth[_0xc254('0xc')](),controller[_0xc254('0x41')](_0xc254('0x45')));router[_0xc254('0x7')](_0xc254('0x46'),auth[_0xc254('0xc')](),controller[_0xc254('0x47')]);router[_0xc254('0x3f')](_0xc254('0x48'),auth['isAuthenticated'](),controller[_0xc254('0x41')](_0xc254('0x49')));router[_0xc254('0x7')]('/fax/queues/:id',auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xc254('0x3f')](_0xc254('0x4a'),auth['isAuthenticated'](),controller[_0xc254('0x41')](_0xc254('0x4b')));router['get'](_0xc254('0x4c'),auth[_0xc254('0xc')](),controller[_0xc254('0x4d')]);router[_0xc254('0x3f')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc254('0x41')]('sms'));router[_0xc254('0x3f')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc254('0x41')]('whatsapp'));router[_0xc254('0x7')](_0xc254('0x4e'),auth[_0xc254('0xc')](),controller[_0xc254('0x4f')]);router[_0xc254('0x7')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0xc254('0x50')]);router[_0xc254('0x3f')](_0xc254('0x51'),auth[_0xc254('0xc')](),controller['agentNotify']);module[_0xc254('0x52')]=router; \ No newline at end of file +var _0x3656=['util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','campaigns','faxAccounts','/chat/queues/waitinginteractions','/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','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','post','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3656,0x1a8));var _0x6365=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x3656[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x6365('0x0'));var util=require(_0x6365('0x1'));var path=require(_0x6365('0x2'));var express=require(_0x6365('0x3'));var router=express[_0x6365('0x4')]();var auth=require(_0x6365('0x5'));var controller=require(_0x6365('0x6'));router['get'](_0x6365('0x7'),auth[_0x6365('0x8')](),controller[_0x6365('0x9')]);router[_0x6365('0xa')](_0x6365('0xb'),auth[_0x6365('0x8')](),controller[_0x6365('0xc')]);router[_0x6365('0xa')](_0x6365('0xd'),auth[_0x6365('0x8')](),controller[_0x6365('0xe')]);router[_0x6365('0xa')](_0x6365('0xf'),auth[_0x6365('0x8')](),controller[_0x6365('0x10')]);router[_0x6365('0xa')]('/chat/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x11')]);router['get'](_0x6365('0x12'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x6365('0xa')](_0x6365('0x13'),auth[_0x6365('0x8')](),controller[_0x6365('0x14')]);router[_0x6365('0xa')]('/openchannel/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x15')]);router['get']('/sms/queues',auth[_0x6365('0x8')](),controller[_0x6365('0x16')]);router[_0x6365('0xa')](_0x6365('0x17'),auth[_0x6365('0x8')](),controller[_0x6365('0x18')]);router[_0x6365('0xa')](_0x6365('0x19'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x6365('0xa')](_0x6365('0x1a'),auth[_0x6365('0x8')](),controller[_0x6365('0x1b')]);router[_0x6365('0xa')](_0x6365('0x1c'),auth['isAuthenticated'](),controller[_0x6365('0x1d')]);router[_0x6365('0xa')](_0x6365('0x1e'),auth[_0x6365('0x8')](),controller[_0x6365('0x1f')]);router['get'](_0x6365('0x20'),auth[_0x6365('0x8')](),controller[_0x6365('0x21')]);router[_0x6365('0xa')](_0x6365('0x22'),auth[_0x6365('0x8')](),controller[_0x6365('0x23')]);router[_0x6365('0xa')](_0x6365('0x24'),auth[_0x6365('0x8')](),controller['showVoiceQueues']);router[_0x6365('0x25')](_0x6365('0x24'),auth[_0x6365('0x8')](),controller[_0x6365('0x26')]);router[_0x6365('0xa')](_0x6365('0x27'),auth[_0x6365('0x8')](),controller[_0x6365('0x28')]);router[_0x6365('0xa')](_0x6365('0x29'),auth['isAuthenticated'](),controller[_0x6365('0x2a')]);router['get'](_0x6365('0x2b'),auth[_0x6365('0x8')](),controller[_0x6365('0x2c')]);router['put']('/agents/:id/capacity',auth[_0x6365('0x8')](),controller[_0x6365('0x2d')]);router[_0x6365('0xa')](_0x6365('0x2e'),auth[_0x6365('0x8')](),controller[_0x6365('0x2f')]);router[_0x6365('0xa')]('/trunks',auth[_0x6365('0x8')](),controller['trunks']);router['get']('/campaigns',auth[_0x6365('0x8')](),controller[_0x6365('0x30')]);router['get']('/fax/accounts',auth[_0x6365('0x8')](),controller[_0x6365('0x31')]);router['get'](_0x6365('0x32'),auth[_0x6365('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x6365('0xa')](_0x6365('0x33'),auth['isAuthenticated'](),controller[_0x6365('0x34')]);router['get'](_0x6365('0x35'),auth[_0x6365('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x6365('0xa')]('/openchannel/queues/:id/waitinginteractions',auth[_0x6365('0x8')](),controller[_0x6365('0x36')]);router['get']('/sms/queues/waitinginteractions',auth[_0x6365('0x8')](),controller[_0x6365('0x37')]);router[_0x6365('0xa')](_0x6365('0x38'),auth[_0x6365('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x6365('0xa')](_0x6365('0x39'),auth[_0x6365('0x8')](),controller[_0x6365('0x3a')]);router['post'](_0x6365('0x3b'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x3d')));router[_0x6365('0xa')](_0x6365('0x3e'),auth[_0x6365('0x8')](),controller[_0x6365('0x3f')]);router['post'](_0x6365('0x40'),auth['isAuthenticated'](),controller[_0x6365('0x3c')](_0x6365('0x41')));router[_0x6365('0xa')](_0x6365('0x42'),auth[_0x6365('0x8')](),controller[_0x6365('0x43')]);router[_0x6365('0x44')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x6365('0x45')));router[_0x6365('0xa')](_0x6365('0x46'),auth[_0x6365('0x8')](),controller[_0x6365('0x47')]);router[_0x6365('0x44')](_0x6365('0x48'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x49')));router[_0x6365('0xa')](_0x6365('0x4a'),auth[_0x6365('0x8')](),controller[_0x6365('0x4b')]);router['post'](_0x6365('0x4c'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')]('sms'));router['post'](_0x6365('0x4d'),auth[_0x6365('0x8')](),controller[_0x6365('0x3c')](_0x6365('0x4e')));router[_0x6365('0xa')](_0x6365('0x4f'),auth[_0x6365('0x8')](),controller[_0x6365('0x50')]);router[_0x6365('0xa')](_0x6365('0x51'),auth[_0x6365('0x8')](),controller[_0x6365('0x52')]);router[_0x6365('0x44')]('/agents/:id/notify',auth[_0x6365('0x8')](),controller[_0x6365('0x53')]);module[_0x6365('0x54')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c476e04..804b204 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 _0x0e85=['util','../../mysqldb','client','http','request','error','code','message','status','json','sendStatus','stack','send','isNil','find','rows','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','catch','voiceQueues','VoiceQueues','query','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','name','hasOwnProperty','MemberReport','findAll','format','length','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','update','queue','From','QueueId','TransferReport','Start','queueTransferTimeout','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','\x20Message\x20not\x20found','MessageId','InteractionId','create','*,*,*,*','bluebird','moment'];(function(_0x54c081,_0x336a48){var _0x2a99dd=function(_0x2536bd){while(--_0x2536bd){_0x54c081['push'](_0x54c081['shift']());}};_0x2a99dd(++_0x336a48);}(_0x0e85,0x7c));var _0x50e8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x0e85[_0x1a72f3];return _0x57ef47;};'use strict';var BPromise=require(_0x50e8('0x0'));var moment=require(_0x50e8('0x1'));var _=require('lodash');var util=require(_0x50e8('0x2'));var db=require(_0x50e8('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x50e8('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x50e8('0x4')][_0x50e8('0x5')]({'port':0x232b});var routingClient=jayson[_0x50e8('0x4')][_0x50e8('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x5e8b01,_0x3ce904,_0x108edc){return new BPromise(function(_0x42665e,_0x988da0){var _0x1fafb0=_0x108edc?_0x108edc:amiClient;return _0x1fafb0[_0x50e8('0x6')](_0x5e8b01,_0x3ce904)['then'](function(_0x11717c){if(_0x11717c[_0x50e8('0x7')]){if(_0x11717c[_0x50e8('0x7')][_0x50e8('0x8')]===0x1f4){return _0x988da0(_0x11717c[_0x50e8('0x7')][_0x50e8('0x9')]);}return _0x42665e(_0x11717c[_0x50e8('0x7')][_0x50e8('0x9')]);}else{_0x42665e(_0x11717c['result']);}})['catch'](function(_0xfc6bb9){_0x988da0(_0xfc6bb9);});});}function respondWithResult(_0x24d381,_0x508377){_0x508377=_0x508377||0xc8;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0xa')](_0x508377)[_0x50e8('0xb')](_0x49e02f);}return _0x24d381[_0x50e8('0xc')](0x194);};}function handleError(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0x1f4;return function(_0x18596f){logger[_0x50e8('0x7')](_0x18596f[_0x50e8('0xd')]);if(_0x18596f['name']){delete _0x18596f['name'];}_0x473aa7[_0x50e8('0xa')](_0x54efd3)[_0x50e8('0xe')](_0x18596f);};}function findById(_0x40c184){return function(_0x291fb7){if(!_[_0x50e8('0xf')](_0x40c184)&&!_[_0x50e8('0xf')](_0x291fb7)&&!_['isNil'](_0x291fb7['rows'])){return _[_0x50e8('0x10')](_0x291fb7[_0x50e8('0x11')],function(_0x40d060){return _0x40d060['id']==_0x40c184;});}return null;};}exports[_0x50e8('0x12')]=function(_0x5dae4e,_0x90c54c){return respondWithRpcPromise(_0x50e8('0x13'),_0x5dae4e['query'])[_0x50e8('0x14')](respondWithResult(_0x90c54c,null))['catch'](handleError(_0x90c54c,null));};exports[_0x50e8('0x15')]=function(_0xe04a5c,_0xd263d){return respondWithRpcPromise(_0x50e8('0x16'),_[_0x50e8('0x17')](_0xe04a5c['query'],_0xe04a5c[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0xd263d,null))['catch'](handleError(_0xd263d,null));};exports[_0x50e8('0x19')]=function(_0x41500f,_0x5691b2){return respondWithRpcPromise(_0x50e8('0x1a'),_[_0x50e8('0x17')](_0x41500f['query'],_0x41500f['params']))['then'](respondWithResult(_0x5691b2,null))[_0x50e8('0x1b')](handleError(_0x5691b2,null));};exports[_0x50e8('0x1c')]=function(_0x124402,_0x371a1f){return respondWithRpcPromise(_0x50e8('0x1d'),_0x124402[_0x50e8('0x1e')])['then'](respondWithResult(_0x371a1f,null))[_0x50e8('0x1b')](handleError(_0x371a1f,null));};exports[_0x50e8('0x1f')]=function(_0x4b3a09,_0x177201){return respondWithRpcPromise(_0x50e8('0x1d'),_0x4b3a09[_0x50e8('0x1e')])[_0x50e8('0x14')](findById(_0x4b3a09['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x177201,null))['catch'](handleError(_0x177201,null));};exports[_0x50e8('0x20')]=function(_0x39c0c6,_0x42bbef){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x50e8('0x17')](_0x39c0c6[_0x50e8('0x21')],_0x39c0c6[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x42bbef,null))[_0x50e8('0x1b')](handleError(_0x42bbef,null));};exports[_0x50e8('0x22')]=function(_0x2c6fb3,_0x54d81d){return respondWithRpcPromise(_0x50e8('0x23'),_[_0x50e8('0x17')](_0x2c6fb3['query'],_0x2c6fb3['params']))[_0x50e8('0x14')](respondWithResult(_0x54d81d,null))[_0x50e8('0x1b')](handleError(_0x54d81d,null));};exports[_0x50e8('0x24')]=function(_0x47ace2,_0x594187){return respondWithRpcPromise(_0x50e8('0x25'),_0x47ace2[_0x50e8('0x1e')])['then'](respondWithResult(_0x594187,null))[_0x50e8('0x1b')](handleError(_0x594187,null));};exports[_0x50e8('0x26')]=function(_0x38df5a,_0x40e09d){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x50e8('0x17')](_0x38df5a['query'],_0x38df5a[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x40e09d,null))[_0x50e8('0x1b')](handleError(_0x40e09d,null));};exports['voiceQueuesChannelHangup']=function(_0x306816,_0x40f566){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x50e8('0x17')](_0x306816[_0x50e8('0x1e')],_0x306816[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x40f566,null))['catch'](handleError(_0x40f566,null));};exports[_0x50e8('0x27')]=function(_0x40dbe8,_0x24d3ea){return respondWithRpcPromise(_0x50e8('0x28'),_['merge'](_0x40dbe8[_0x50e8('0x1e')],_0x40dbe8[_0x50e8('0x18')]))[_0x50e8('0x14')](respondWithResult(_0x24d3ea,null))['catch'](handleError(_0x24d3ea,null));};exports['outbound']=function(_0x5dff99,_0xd39553){return respondWithRpcPromise(_0x50e8('0x29'),_0x5dff99[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0xd39553,null))[_0x50e8('0x1b')](handleError(_0xd39553,null));};exports[_0x50e8('0x2a')]=function(_0xb566c2,_0x40b57c){return respondWithRpcPromise(_0x50e8('0x2b'),_0xb566c2[_0x50e8('0x1e')])['then'](respondWithResult(_0x40b57c,null))[_0x50e8('0x1b')](handleError(_0x40b57c,null));};exports[_0x50e8('0x2c')]=function(_0x2379cf,_0x2bf413){var _0x5dbbe1;return respondWithRpcPromise(_0x50e8('0x2d'),_0x2379cf[_0x50e8('0x1e')])[_0x50e8('0x14')](function(_0x169b4f){_0x5dbbe1=_0x169b4f;return respondWithRpcPromise(_0x50e8('0x2d'),_0x2379cf['query'],routingClient);})['then'](function(_0x81e6f3){return _[_0x50e8('0x17')]({},_0x81e6f3,_0x5dbbe1);})['then'](respondWithResult(_0x2bf413,null))[_0x50e8('0x1b')](handleError(_0x2bf413,null));};exports[_0x50e8('0x2e')]=function(_0x3db1ab,_0x3179a0){if(_0x3db1ab[_0x50e8('0x21')]&&_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')]&&_0x3db1ab[_0x50e8('0x30')]&&_0x3db1ab['user'][_0x50e8('0x31')]){for(var _0x44e0ca in _0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')]){if(_0x3db1ab['body'][_0x50e8('0x2f')][_0x50e8('0x32')](_0x44e0ca)){db[_0x50e8('0x33')][_0x50e8('0x34')]({'where':{'channel':_0x44e0ca,'membername':_0x3db1ab['user'][_0x50e8('0x31')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3db1ab['body']['interaction'][_0x44e0ca]&&_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca]['length']?{'$notIn':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca]}:{'$ne':null}}})[_0x50e8('0x14')](function(_0x6e37ad){var _0x387481=moment()[_0x50e8('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x16fdf6=0x0,_0x596f62=_0x6e37ad[_0x50e8('0x36')];_0x16fdf6<_0x596f62;_0x16fdf6+=0x1){_0x6e37ad[_0x16fdf6][_0x50e8('0x37')]({'exitAt':_0x387481});}});for(var _0x537762=0x0;_0x537762<_0x3db1ab[_0x50e8('0x21')]['interaction'][_0x44e0ca][_0x50e8('0x36')];_0x537762+=0x1){db[_0x50e8('0x33')][_0x50e8('0x38')]({'where':{'channel':_0x44e0ca,'membername':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x31')],'type':_0x50e8('0x39'),'uniqueid':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x2f')][_0x44e0ca][_0x537762],'exitAt':null},'defaults':{'channel':_0x44e0ca,'membername':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x31')],'interface':_[_0x50e8('0xf')](_0x3db1ab['user'][_0x50e8('0x3a')])?util[_0x50e8('0x35')]('SIP/%s',_0x3db1ab[_0x50e8('0x30')]['name']):_0x3db1ab[_0x50e8('0x30')]['interface'],'type':_0x50e8('0x39'),'enterAt':moment()[_0x50e8('0x35')](_0x50e8('0x3b')),'role':_0x50e8('0x3c'),'internal':_0x3db1ab[_0x50e8('0x30')][_0x50e8('0x3d')],'uniqueid':_0x3db1ab[_0x50e8('0x21')]['interaction'][_0x44e0ca][_0x537762]}});}}}}return respondWithRpcPromise(_0x50e8('0x3e'),{'id':_0x3db1ab[_0x50e8('0x18')]['id'],'capacity':_0x3db1ab[_0x50e8('0x21')][_0x50e8('0x3f')]},routingClient)[_0x50e8('0x14')](respondWithResult(_0x3179a0,null))[_0x50e8('0x1b')](handleError(_0x3179a0,null));};exports['telephones']=function(_0x5122a2,_0x250b28){return respondWithRpcPromise(_0x50e8('0x40'),_0x5122a2[_0x50e8('0x1e')])['then'](respondWithResult(_0x250b28,null))[_0x50e8('0x1b')](handleError(_0x250b28,null));};exports[_0x50e8('0x41')]=function(_0x3476c5,_0x15db71){return respondWithRpcPromise(_0x50e8('0x42'),_0x3476c5[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0x15db71,null))['catch'](handleError(_0x15db71,null));};exports['campaigns']=function(_0x55083e,_0x2b54ad){return respondWithRpcPromise(_0x50e8('0x43'),_0x55083e[_0x50e8('0x1e')])[_0x50e8('0x14')](respondWithResult(_0x2b54ad,null))[_0x50e8('0x1b')](handleError(_0x2b54ad,null));};exports[_0x50e8('0x44')]=function(_0x566723,_0x2f2154){return respondWithRpcPromise(_0x50e8('0x45'),_0x566723[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x2f2154,null))['catch'](handleError(_0x2f2154,null));};exports[_0x50e8('0x46')]=function(_0xf773fd,_0x373b41){return respondWithRpcPromise(_0x50e8('0x45'),_0xf773fd[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0xf773fd['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x373b41,null))['catch'](handleError(_0x373b41,null));};exports['mailQueues']=function(_0x5af2a4,_0x23216a){return respondWithRpcPromise('MailQueues',_0x5af2a4[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x23216a,null))[_0x50e8('0x1b')](handleError(_0x23216a,null));};exports[_0x50e8('0x47')]=function(_0x279cf4,_0x12224d){return respondWithRpcPromise(_0x50e8('0x48'),_0x279cf4['query'],routingClient)[_0x50e8('0x14')](findById(_0x279cf4[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x12224d,null))['catch'](handleError(_0x12224d,null));};exports['mailAccounts']=function(_0x53dcdc,_0x3d7311){return respondWithRpcPromise(_0x50e8('0x49'),_0x53dcdc[_0x50e8('0x1e')],mailClient)[_0x50e8('0x14')](respondWithResult(_0x3d7311,null))[_0x50e8('0x1b')](handleError(_0x3d7311,null));};exports[_0x50e8('0x4a')]=function(_0x583d6a,_0x42c2d0){return respondWithRpcPromise('OpenchannelQueues',_0x583d6a[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x42c2d0,null))['catch'](handleError(_0x42c2d0,null));};exports['showOpenchannelQueues']=function(_0x51775a,_0x2eed72){return respondWithRpcPromise(_0x50e8('0x4b'),_0x51775a['query'],routingClient)[_0x50e8('0x14')](findById(_0x51775a[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x2eed72,null))[_0x50e8('0x1b')](handleError(_0x2eed72,null));};exports[_0x50e8('0x4c')]=function(_0x47b428,_0x125e92){return respondWithRpcPromise(_0x50e8('0x4d'),_0x47b428[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x125e92,null))['catch'](handleError(_0x125e92,null));};exports[_0x50e8('0x4e')]=function(_0x44e9a2,_0xd21879){return respondWithRpcPromise(_0x50e8('0x4d'),_0x44e9a2[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0x44e9a2['params']['id']))['then'](respondWithResult(_0xd21879,null))[_0x50e8('0x1b')](handleError(_0xd21879,null));};exports['whatsappQueues']=function(_0x1fc530,_0x36a288){return respondWithRpcPromise('WhatsappQueues',_0x1fc530[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x36a288,null))['catch'](handleError(_0x36a288,null));};exports['showWhatsappQueues']=function(_0x22b6f3,_0x2d4fe8){return respondWithRpcPromise(_0x50e8('0x4f'),_0x22b6f3[_0x50e8('0x1e')],routingClient)['then'](findById(_0x22b6f3['params']['id']))[_0x50e8('0x14')](respondWithResult(_0x2d4fe8,null))[_0x50e8('0x1b')](handleError(_0x2d4fe8,null));};exports[_0x50e8('0x50')]=function(_0x3ac7cc,_0x20c5e8){return respondWithRpcPromise(_0x50e8('0x51'),_0x3ac7cc[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](respondWithResult(_0x20c5e8,null))[_0x50e8('0x1b')](handleError(_0x20c5e8,null));};exports[_0x50e8('0x52')]=function(_0x109920,_0x38b535){return respondWithRpcPromise(_0x50e8('0x51'),_0x109920[_0x50e8('0x1e')],routingClient)[_0x50e8('0x14')](findById(_0x109920[_0x50e8('0x18')]['id']))[_0x50e8('0x14')](respondWithResult(_0x38b535,null))[_0x50e8('0x1b')](handleError(_0x38b535,null));};exports['faxAccounts']=function(_0x35a382,_0x474978){return respondWithRpcPromise(_0x50e8('0x53'),_0x35a382[_0x50e8('0x1e')])['then'](respondWithResult(_0x474978,null))[_0x50e8('0x1b')](handleError(_0x474978,null));};exports[_0x50e8('0x54')]=function(_0x26c505,_0x161a07){return respondWithRpcPromise(_0x50e8('0x55'),_0x26c505[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x161a07,null))[_0x50e8('0x1b')](handleError(_0x161a07,null));};exports[_0x50e8('0x56')]=function(_0x19e44c,_0x13667e){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x19e44c[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x13667e,null))[_0x50e8('0x1b')](handleError(_0x13667e,null));};exports[_0x50e8('0x57')]=function(_0x365c9e,_0x1637b2){return respondWithRpcPromise(_0x50e8('0x58'),_0x365c9e['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x1637b2,null))[_0x50e8('0x1b')](handleError(_0x1637b2,null));};exports[_0x50e8('0x59')]=function(_0x309015,_0x3a3820){return respondWithRpcPromise(_0x50e8('0x58'),_0x309015['query'],routingClient)[_0x50e8('0x14')](function(_0x1cc566){if(_0x309015['query'][_0x50e8('0x5a')]!==undefined){var _0x2fc1b6=_(_0x1cc566['rows'])[_0x50e8('0x5b')]([_0x309015['query'][_0x50e8('0x5a')],_0x309015[_0x50e8('0x18')]['id']])['map'](_0x50e8('0x5c'))[_0x50e8('0x5d')]()[_0x50e8('0x5e')]();return _0x1cc566[_0x50e8('0x11')]['filter'](function(_0xf21b2f){return _0x2fc1b6['indexOf'](_0xf21b2f[_0x50e8('0x5c')])>-0x1;});}else{return _0x1cc566[_0x50e8('0x11')]['filter'](function(_0x68342){return _0x68342[_0x50e8('0x5c')]===parseInt(_0x309015[_0x50e8('0x18')]['id']);});}})[_0x50e8('0x14')](respondWithResult(_0x3a3820,null))[_0x50e8('0x1b')](handleError(_0x3a3820,null));};exports[_0x50e8('0x5f')]=function(_0x2c85a6,_0x410e7b){return respondWithRpcPromise(_0x50e8('0x60'),_0x2c85a6['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x410e7b,null))[_0x50e8('0x1b')](handleError(_0x410e7b,null));};exports[_0x50e8('0x61')]=function(_0x5a79c4,_0x7d64e0){return respondWithRpcPromise(_0x50e8('0x62'),_0x5a79c4[_0x50e8('0x1e')],routingClient)['then'](respondWithResult(_0x7d64e0,null))['catch'](handleError(_0x7d64e0,null));};exports[_0x50e8('0x63')]=function(_0x440fc7,_0x5d922b){return respondWithRpcPromise(_0x50e8('0x64'),_0x440fc7['query'],routingClient)[_0x50e8('0x14')](respondWithResult(_0x5d922b,null))[_0x50e8('0x1b')](handleError(_0x5d922b,null));};exports[_0x50e8('0x65')]=function(_0x157b27){return function(_0x49828b,_0x22d2e){var _0x4ac008,_0x29af7b;var _0x51ea2a=_['capitalize'](_0x157b27);var _0x368d17=_0x157b27===_0x50e8('0x66')?'Website':_0x50e8('0x67');return db[_0x51ea2a+'Queue'][_0x50e8('0x68')]({'raw':!![],'where':{'id':_0x49828b['params']['id']}})['then'](function(_0x27dae3){if(_[_0x50e8('0xf')](_0x27dae3)){throw new Error(_0x51ea2a+_0x50e8('0x69'));}_0x4ac008=_0x27dae3;return db[_0x51ea2a+_0x50e8('0x6a')]['findOne']({'where':{'id':_0x49828b[_0x50e8('0x21')]['messageId']},'include':[{'model':db[_0x51ea2a+'Interaction'],'as':_0x50e8('0x6b')},{'model':db[_0x51ea2a+_0x368d17],'as':_0x50e8('0x67')}]});})[_0x50e8('0x14')](function(_0x50d925){if(_['isNil'](_0x50d925)){throw new Error(_0x51ea2a+'\x20Message\x20not\x20found');}_0x29af7b=_0x50d925;return _0x50d925[_0x50e8('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x50e8('0x14')](function(){var _0x1decc9={'uniqueid':_0x157b27+'.'+_0x29af7b['id']+'.'+_0x29af7b[_0x50e8('0x6b')]['id'],'FromUserId':_0x49828b[_0x50e8('0x30')]['id'],'type':_0x50e8('0x6d')};_0x1decc9[_0x51ea2a+'MessageId']=_0x29af7b['id'];_0x1decc9[_0x51ea2a+'InteractionId']=_0x29af7b[_0x50e8('0x6b')]['id'];_0x1decc9[_0x50e8('0x6e')+_0x51ea2a+_0x368d17+'Id']=_0x29af7b[_0x50e8('0x67')]['id'];_0x1decc9['To'+_0x51ea2a+_0x50e8('0x6f')]=_0x4ac008['id'];return db[_0x51ea2a+_0x50e8('0x70')]['create'](_0x1decc9);})[_0x50e8('0x14')](function(){return respondWithRpcPromise(_0x50e8('0x71'),{'channel':_0x157b27,'interaction':_0x29af7b[_0x50e8('0x6b')],'message':_0x29af7b,'account':_0x29af7b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4ac008[_0x50e8('0x31')]+','+(_0x29af7b[_0x50e8('0x67')][_0x50e8('0x72')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x50e8('0x14')](respondWithResult(_0x22d2e,null))[_0x50e8('0x1b')](handleError(_0x22d2e,null));};};exports['agentNotify']=function(_0x29e664,_0x52929f){var _0x306fc0,_0x1e38ea;if(_[_0x50e8('0xf')](_0x29e664[_0x50e8('0x21')][_0x50e8('0x73')])){throw new Error(_0x50e8('0x74'));}var _0x1c4f8f=_0x29e664[_0x50e8('0x21')][_0x50e8('0x73')];var _0x5b4032=_[_0x50e8('0x75')](_0x1c4f8f);var _0x4e431e=_0x1c4f8f===_0x50e8('0x66')?_0x50e8('0x76'):_0x50e8('0x67');return db[_0x50e8('0x77')][_0x50e8('0x68')]({'raw':!![],'where':{'id':_0x29e664[_0x50e8('0x18')]['id'],'role':'agent'}})[_0x50e8('0x14')](function(_0xe57ebc){if(_[_0x50e8('0xf')](_0xe57ebc)){throw new Error(_0x50e8('0x78'));}_0x306fc0=_0xe57ebc;return db[_0x5b4032+_0x50e8('0x6a')][_0x50e8('0x68')]({'where':{'id':_0x29e664[_0x50e8('0x21')]['messageId']},'include':[{'model':db[_0x5b4032+_0x50e8('0x6b')],'as':_0x50e8('0x6b')},{'model':db[_0x5b4032+_0x4e431e],'as':_0x50e8('0x67')}]});})[_0x50e8('0x14')](function(_0x28ce03){if(_[_0x50e8('0xf')](_0x28ce03)){throw new Error(_0x5b4032+_0x50e8('0x79'));}_0x1e38ea=_0x28ce03;return _0x28ce03[_0x50e8('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4e67ca={'uniqueid':_0x1c4f8f+'.'+_0x1e38ea['id']+'.'+_0x1e38ea['Interaction']['id'],'FromUserId':_0x29e664[_0x50e8('0x30')]['id'],'type':'queue','ToUserId':_0x306fc0['id']};_0x4e67ca[_0x5b4032+_0x50e8('0x7a')]=_0x1e38ea['id'];_0x4e67ca[_0x5b4032+_0x50e8('0x7b')]=_0x1e38ea[_0x50e8('0x6b')]['id'];_0x4e67ca[_0x50e8('0x6e')+_0x5b4032+_0x4e431e+'Id']=_0x1e38ea[_0x50e8('0x67')]['id'];return db[_0x5b4032+_0x50e8('0x70')][_0x50e8('0x7c')](_0x4e67ca);})[_0x50e8('0x14')](function(){return respondWithRpcPromise(_0x50e8('0x71'),{'channel':_0x1c4f8f,'interaction':_0x1e38ea[_0x50e8('0x6b')],'message':_0x1e38ea,'account':_0x1e38ea[_0x50e8('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x306fc0[_0x50e8('0x31')]+','+(_0x1e38ea[_0x50e8('0x67')]['agentTransferTimeout']||0x12c),'interval':_0x50e8('0x7d')}]},routingClient);})[_0x50e8('0x14')](respondWithResult(_0x52929f,null))[_0x50e8('0x1b')](handleError(_0x52929f,null));}; \ No newline at end of file +var _0x207c=['moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','then','error','code','result','status','json','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','interaction','user','hasOwnProperty','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','interface','agent','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','value','filter','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','queue','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','MessageId','From','*,*,*,*'];(function(_0x30060e,_0x2fdd81){var _0xbd2f83=function(_0x49e5a1){while(--_0x49e5a1){_0x30060e['push'](_0x30060e['shift']());}};_0xbd2f83(++_0x2fdd81);}(_0x207c,0x1e8));var _0xc207=function(_0x5ad0c6,_0x56ee17){_0x5ad0c6=_0x5ad0c6-0x0;var _0x167958=_0x207c[_0x5ad0c6];return _0x167958;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc207('0x0'));var _=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var db=require(_0xc207('0x3'))['db'];var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var jayson=require(_0xc207('0x6'));var amiClient=jayson['client'][_0xc207('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson['client'][_0xc207('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){var _0x3c579f=_0x59ff6f?_0x59ff6f:amiClient;return _0x3c579f['request'](_0x314561,_0x3395e4)[_0xc207('0x8')](function(_0x817576){if(_0x817576[_0xc207('0x9')]){if(_0x817576[_0xc207('0x9')][_0xc207('0xa')]===0x1f4){return _0xad159b(_0x817576[_0xc207('0x9')]['message']);}return _0x25cb97(_0x817576['error']['message']);}else{_0x25cb97(_0x817576[_0xc207('0xb')]);}})['catch'](function(_0x2741f3){_0xad159b(_0x2741f3);});});}function respondWithResult(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xc8;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0xc')](_0x59d401)[_0xc207('0xd')](_0x3e1108);}return _0x2782ce[_0xc207('0xe')](0x194);};}function handleError(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0x1f4;return function(_0xc62672){logger[_0xc207('0x9')](_0xc62672[_0xc207('0xf')]);if(_0xc62672[_0xc207('0x10')]){delete _0xc62672['name'];}_0xe993a0['status'](_0x51e967)['send'](_0xc62672);};}function findById(_0x1cebfa){return function(_0x6e793d){if(!_[_0xc207('0x11')](_0x1cebfa)&&!_[_0xc207('0x11')](_0x6e793d)&&!_['isNil'](_0x6e793d[_0xc207('0x12')])){return _[_0xc207('0x13')](_0x6e793d[_0xc207('0x12')],function(_0x5f288e){return _0x5f288e['id']==_0x1cebfa;});}return null;};}exports[_0xc207('0x14')]=function(_0x488cc0,_0x42c8ba){return respondWithRpcPromise(_0xc207('0x15'),_0x488cc0[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x42c8ba,null))[_0xc207('0x17')](handleError(_0x42c8ba,null));};exports[_0xc207('0x18')]=function(_0x35c0b0,_0x464dea){return respondWithRpcPromise(_0xc207('0x19'),_[_0xc207('0x1a')](_0x35c0b0[_0xc207('0x16')],_0x35c0b0[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x464dea,null))['catch'](handleError(_0x464dea,null));};exports[_0xc207('0x1c')]=function(_0x5cda23,_0x2e89c5){return respondWithRpcPromise(_0xc207('0x1d'),_[_0xc207('0x1a')](_0x5cda23[_0xc207('0x16')],_0x5cda23[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x2e89c5,null))[_0xc207('0x17')](handleError(_0x2e89c5,null));};exports[_0xc207('0x1e')]=function(_0xa52138,_0x2385f7){return respondWithRpcPromise(_0xc207('0x1f'),_0xa52138[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x2385f7,null))[_0xc207('0x17')](handleError(_0x2385f7,null));};exports[_0xc207('0x20')]=function(_0x56a066,_0x1e1440){return respondWithRpcPromise('VoiceQueues',_0x56a066['query'])[_0xc207('0x8')](findById(_0x56a066[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x1e1440,null))[_0xc207('0x17')](handleError(_0x1e1440,null));};exports[_0xc207('0x21')]=function(_0x478af7,_0xe5e848){return respondWithRpcPromise(_0xc207('0x22'),_[_0xc207('0x1a')](_0x478af7[_0xc207('0x23')],_0x478af7[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0xe5e848,null))[_0xc207('0x17')](handleError(_0xe5e848,null));};exports[_0xc207('0x24')]=function(_0xc6a7ce,_0x3f79e8){return respondWithRpcPromise(_0xc207('0x25'),_[_0xc207('0x1a')](_0xc6a7ce[_0xc207('0x16')],_0xc6a7ce['params']))[_0xc207('0x8')](respondWithResult(_0x3f79e8,null))[_0xc207('0x17')](handleError(_0x3f79e8,null));};exports[_0xc207('0x26')]=function(_0x448df1,_0x24df00){return respondWithRpcPromise(_0xc207('0x27'),_0x448df1['query'])[_0xc207('0x8')](respondWithResult(_0x24df00,null))[_0xc207('0x17')](handleError(_0x24df00,null));};exports[_0xc207('0x28')]=function(_0x1d12fa,_0x58e906){return respondWithRpcPromise(_0xc207('0x29'),_[_0xc207('0x1a')](_0x1d12fa[_0xc207('0x16')],_0x1d12fa[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x58e906,null))[_0xc207('0x17')](handleError(_0x58e906,null));};exports[_0xc207('0x2a')]=function(_0x458de9,_0x586776){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x458de9[_0xc207('0x16')],_0x458de9[_0xc207('0x1b')]))[_0xc207('0x8')](respondWithResult(_0x586776,null))[_0xc207('0x17')](handleError(_0x586776,null));};exports['voiceQueuesChannelRedirect']=function(_0x3bfbf4,_0x433c0f){return respondWithRpcPromise(_0xc207('0x2b'),_[_0xc207('0x1a')](_0x3bfbf4[_0xc207('0x16')],_0x3bfbf4['params']))[_0xc207('0x8')](respondWithResult(_0x433c0f,null))[_0xc207('0x17')](handleError(_0x433c0f,null));};exports['outbound']=function(_0x21dd42,_0x49bada){return respondWithRpcPromise(_0xc207('0x2c'),_0x21dd42[_0xc207('0x16')])['then'](respondWithResult(_0x49bada,null))[_0xc207('0x17')](handleError(_0x49bada,null));};exports[_0xc207('0x2d')]=function(_0x3313b1,_0x502dde){return respondWithRpcPromise('OutboundChannels',_0x3313b1[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x502dde,null))[_0xc207('0x17')](handleError(_0x502dde,null));};exports[_0xc207('0x2e')]=function(_0x4c3e29,_0x3a6f45){var _0x47cdc4;return respondWithRpcPromise('Agents',_0x4c3e29['query'])['then'](function(_0x20cb64){_0x47cdc4=_0x20cb64;return respondWithRpcPromise(_0xc207('0x2f'),_0x4c3e29[_0xc207('0x16')],routingClient);})['then'](function(_0x1dd71e){return _[_0xc207('0x1a')]({},_0x1dd71e,_0x47cdc4);})[_0xc207('0x8')](respondWithResult(_0x3a6f45,null))[_0xc207('0x17')](handleError(_0x3a6f45,null));};exports['agentCapacity']=function(_0x47d43a,_0x223349){if(_0x47d43a[_0xc207('0x23')]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')]&&_0x47d43a['user']&&_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]){for(var _0x3a935a in _0x47d43a[_0xc207('0x23')][_0xc207('0x30')]){if(_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0xc207('0x32')](_0x3a935a)){db[_0xc207('0x33')]['findAll']({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a]&&_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')]?{'$notIn':_0x47d43a['body'][_0xc207('0x30')][_0x3a935a]}:{'$ne':null}}})[_0xc207('0x8')](function(_0x17da25){var _0x5b50cf=moment()[_0xc207('0x35')](_0xc207('0x36'));for(var _0x2967ad=0x0,_0x45536e=_0x17da25['length'];_0x2967ad<_0x45536e;_0x2967ad+=0x1){_0x17da25[_0x2967ad]['updateAttributes']({'exitAt':_0x5b50cf});}});for(var _0x11ce5a=0x0;_0x11ce5a<_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0xc207('0x34')];_0x11ce5a+=0x1){db[_0xc207('0x33')][_0xc207('0x37')]({'where':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')][_0xc207('0x10')],'type':_0xc207('0x38'),'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a],'exitAt':null},'defaults':{'channel':_0x3a935a,'membername':_0x47d43a[_0xc207('0x31')]['name'],'interface':_['isNil'](_0x47d43a[_0xc207('0x31')][_0xc207('0x39')])?util[_0xc207('0x35')]('SIP/%s',_0x47d43a[_0xc207('0x31')][_0xc207('0x10')]):_0x47d43a[_0xc207('0x31')][_0xc207('0x39')],'type':'INTERACTION','enterAt':moment()[_0xc207('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc207('0x3a'),'internal':_0x47d43a['user']['internal'],'uniqueid':_0x47d43a[_0xc207('0x23')][_0xc207('0x30')][_0x3a935a][_0x11ce5a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x47d43a['params']['id'],'capacity':_0x47d43a['body'][_0xc207('0x3b')]},routingClient)[_0xc207('0x8')](respondWithResult(_0x223349,null))[_0xc207('0x17')](handleError(_0x223349,null));};exports[_0xc207('0x3c')]=function(_0x173acf,_0x35e967){return respondWithRpcPromise(_0xc207('0x3d'),_0x173acf[_0xc207('0x16')])['then'](respondWithResult(_0x35e967,null))[_0xc207('0x17')](handleError(_0x35e967,null));};exports[_0xc207('0x3e')]=function(_0x5aedd3,_0x55e0c5){return respondWithRpcPromise(_0xc207('0x3f'),_0x5aedd3['query'])['then'](respondWithResult(_0x55e0c5,null))[_0xc207('0x17')](handleError(_0x55e0c5,null));};exports[_0xc207('0x40')]=function(_0x356c8c,_0x3b2448){return respondWithRpcPromise(_0xc207('0x41'),_0x356c8c[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x3b2448,null))[_0xc207('0x17')](handleError(_0x3b2448,null));};exports[_0xc207('0x42')]=function(_0x278717,_0x2fcfee){return respondWithRpcPromise('ChatQueues',_0x278717['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x2fcfee,null))[_0xc207('0x17')](handleError(_0x2fcfee,null));};exports[_0xc207('0x43')]=function(_0x313580,_0xaff7a0){return respondWithRpcPromise(_0xc207('0x44'),_0x313580[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x313580[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0xaff7a0,null))[_0xc207('0x17')](handleError(_0xaff7a0,null));};exports[_0xc207('0x45')]=function(_0x19637d,_0x6d387e){return respondWithRpcPromise('MailQueues',_0x19637d[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x6d387e,null))[_0xc207('0x17')](handleError(_0x6d387e,null));};exports[_0xc207('0x46')]=function(_0x464263,_0x45ad58){return respondWithRpcPromise(_0xc207('0x47'),_0x464263['query'],routingClient)[_0xc207('0x8')](findById(_0x464263[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x45ad58,null))[_0xc207('0x17')](handleError(_0x45ad58,null));};exports['mailAccounts']=function(_0xc7812,_0x4f4b58){return respondWithRpcPromise('MailAccounts',_0xc7812[_0xc207('0x16')],mailClient)[_0xc207('0x8')](respondWithResult(_0x4f4b58,null))[_0xc207('0x17')](handleError(_0x4f4b58,null));};exports[_0xc207('0x48')]=function(_0x441d5f,_0x3b1b4c){return respondWithRpcPromise(_0xc207('0x49'),_0x441d5f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3b1b4c,null))[_0xc207('0x17')](handleError(_0x3b1b4c,null));};exports[_0xc207('0x4a')]=function(_0x2f97bf,_0x416e85){return respondWithRpcPromise(_0xc207('0x49'),_0x2f97bf[_0xc207('0x16')],routingClient)['then'](findById(_0x2f97bf[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x416e85,null))[_0xc207('0x17')](handleError(_0x416e85,null));};exports[_0xc207('0x4b')]=function(_0x2ade23,_0x52dec1){return respondWithRpcPromise('SmsQueues',_0x2ade23[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x52dec1,null))[_0xc207('0x17')](handleError(_0x52dec1,null));};exports['showSmsQueues']=function(_0x31182c,_0x1cefa3){return respondWithRpcPromise(_0xc207('0x4c'),_0x31182c['query'],routingClient)['then'](findById(_0x31182c[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x1cefa3,null))[_0xc207('0x17')](handleError(_0x1cefa3,null));};exports[_0xc207('0x4d')]=function(_0x3cca53,_0x4b197){return respondWithRpcPromise(_0xc207('0x4e'),_0x3cca53[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x4b197,null))[_0xc207('0x17')](handleError(_0x4b197,null));};exports['showWhatsappQueues']=function(_0x289f7c,_0x85ecad){return respondWithRpcPromise(_0xc207('0x4e'),_0x289f7c[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x289f7c[_0xc207('0x1b')]['id']))[_0xc207('0x8')](respondWithResult(_0x85ecad,null))[_0xc207('0x17')](handleError(_0x85ecad,null));};exports[_0xc207('0x4f')]=function(_0x28f467,_0x203686){return respondWithRpcPromise('FaxQueues',_0x28f467[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x203686,null))[_0xc207('0x17')](handleError(_0x203686,null));};exports[_0xc207('0x50')]=function(_0x584a40,_0x586c41){return respondWithRpcPromise(_0xc207('0x51'),_0x584a40[_0xc207('0x16')],routingClient)[_0xc207('0x8')](findById(_0x584a40[_0xc207('0x1b')]['id']))['then'](respondWithResult(_0x586c41,null))[_0xc207('0x17')](handleError(_0x586c41,null));};exports[_0xc207('0x52')]=function(_0x440fc2,_0x5a04d5){return respondWithRpcPromise(_0xc207('0x53'),_0x440fc2[_0xc207('0x16')])[_0xc207('0x8')](respondWithResult(_0x5a04d5,null))['catch'](handleError(_0x5a04d5,null));};exports[_0xc207('0x54')]=function(_0x488c1f,_0x1290e4){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x488c1f[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x1290e4,null))['catch'](handleError(_0x1290e4,null));};exports[_0xc207('0x55')]=function(_0x4c0ef0,_0x446fe8){return respondWithRpcPromise(_0xc207('0x56'),_0x4c0ef0[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x446fe8,null))[_0xc207('0x17')](handleError(_0x446fe8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b9342,_0x3d1659){return respondWithRpcPromise(_0xc207('0x57'),_0x4b9342['query'],routingClient)[_0xc207('0x8')](respondWithResult(_0x3d1659,null))[_0xc207('0x17')](handleError(_0x3d1659,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x10ab93,_0x13954e){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x10ab93[_0xc207('0x16')],routingClient)[_0xc207('0x8')](function(_0x3748de){if(_0x10ab93[_0xc207('0x16')][_0xc207('0x58')]!==undefined){var _0xef037c=_(_0x3748de['rows'])['filter']([_0x10ab93[_0xc207('0x16')][_0xc207('0x58')],_0x10ab93[_0xc207('0x1b')]['id']])[_0xc207('0x59')](_0xc207('0x5a'))['uniq']()[_0xc207('0x5b')]();return _0x3748de['rows'][_0xc207('0x5c')](function(_0x97f43){return _0xef037c[_0xc207('0x5d')](_0x97f43[_0xc207('0x5a')])>-0x1;});}else{return _0x3748de[_0xc207('0x12')][_0xc207('0x5c')](function(_0x49ebe1){return _0x49ebe1[_0xc207('0x5a')]===parseInt(_0x10ab93[_0xc207('0x1b')]['id']);});}})['then'](respondWithResult(_0x13954e,null))[_0xc207('0x17')](handleError(_0x13954e,null));};exports[_0xc207('0x5e')]=function(_0x36e8b1,_0x3cb12d){return respondWithRpcPromise(_0xc207('0x5f'),_0x36e8b1[_0xc207('0x16')],routingClient)[_0xc207('0x8')](respondWithResult(_0x3cb12d,null))[_0xc207('0x17')](handleError(_0x3cb12d,null));};exports[_0xc207('0x60')]=function(_0x281c71,_0x473560){return respondWithRpcPromise(_0xc207('0x61'),_0x281c71[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x473560,null))[_0xc207('0x17')](handleError(_0x473560,null));};exports[_0xc207('0x62')]=function(_0x2f4efd,_0x266e65){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2f4efd[_0xc207('0x16')],routingClient)['then'](respondWithResult(_0x266e65,null))[_0xc207('0x17')](handleError(_0x266e65,null));};exports['queueNotify']=function(_0x53cb21){return function(_0x2967e6,_0x220293){var _0x383f83,_0x3adfeb;var _0x20089a=_[_0xc207('0x63')](_0x53cb21);var _0x51b775=_0x53cb21===_0xc207('0x64')?'Website':_0xc207('0x65');return db[_0x20089a+_0xc207('0x66')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x2967e6[_0xc207('0x1b')]['id']}})['then'](function(_0x25731c){if(_[_0xc207('0x11')](_0x25731c)){throw new Error(_0x20089a+'\x20Queue\x20not\x20found');}_0x383f83=_0x25731c;return db[_0x20089a+_0xc207('0x68')][_0xc207('0x67')]({'where':{'id':_0x2967e6[_0xc207('0x23')][_0xc207('0x69')]},'include':[{'model':db[_0x20089a+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x20089a+_0x51b775],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x297ee0){if(_['isNil'](_0x297ee0)){throw new Error(_0x20089a+'\x20Message\x20not\x20found');}_0x3adfeb=_0x297ee0;return _0x297ee0['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x273b30={'uniqueid':_0x53cb21+'.'+_0x3adfeb['id']+'.'+_0x3adfeb[_0xc207('0x6a')]['id'],'FromUserId':_0x2967e6[_0xc207('0x31')]['id'],'type':_0xc207('0x6b')};_0x273b30[_0x20089a+'MessageId']=_0x3adfeb['id'];_0x273b30[_0x20089a+'InteractionId']=_0x3adfeb[_0xc207('0x6a')]['id'];_0x273b30['From'+_0x20089a+_0x51b775+'Id']=_0x3adfeb['Account']['id'];_0x273b30['To'+_0x20089a+_0xc207('0x6c')]=_0x383f83['id'];return db[_0x20089a+_0xc207('0x6d')][_0xc207('0x6e')](_0x273b30);})[_0xc207('0x8')](function(){return respondWithRpcPromise(_0xc207('0x6f'),{'channel':_0x53cb21,'interaction':_0x3adfeb['Interaction'],'message':_0x3adfeb,'account':_0x3adfeb[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x383f83[_0xc207('0x10')]+','+(_0x3adfeb[_0xc207('0x65')][_0xc207('0x70')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x220293,null))[_0xc207('0x17')](handleError(_0x220293,null));};};exports[_0xc207('0x71')]=function(_0x1841a4,_0x7d4f9c){var _0x4e5b1c,_0x4d05e5;if(_[_0xc207('0x11')](_0x1841a4['body'][_0xc207('0x72')])){throw new Error(_0xc207('0x73'));}var _0x211884=_0x1841a4[_0xc207('0x23')][_0xc207('0x72')];var _0x5a7bc9=_[_0xc207('0x63')](_0x211884);var _0x328016=_0x211884===_0xc207('0x64')?_0xc207('0x74'):_0xc207('0x65');return db[_0xc207('0x75')][_0xc207('0x67')]({'raw':!![],'where':{'id':_0x1841a4[_0xc207('0x1b')]['id'],'role':_0xc207('0x3a')}})[_0xc207('0x8')](function(_0x48213b){if(_[_0xc207('0x11')](_0x48213b)){throw new Error('Agent\x20not\x20found');}_0x4e5b1c=_0x48213b;return db[_0x5a7bc9+'Message'][_0xc207('0x67')]({'where':{'id':_0x1841a4[_0xc207('0x23')]['messageId']},'include':[{'model':db[_0x5a7bc9+'Interaction'],'as':_0xc207('0x6a')},{'model':db[_0x5a7bc9+_0x328016],'as':_0xc207('0x65')}]});})[_0xc207('0x8')](function(_0x41b655){if(_['isNil'](_0x41b655)){throw new Error(_0x5a7bc9+_0xc207('0x76'));}_0x4d05e5=_0x41b655;return _0x41b655['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xc207('0x8')](function(){var _0x1c7886={'uniqueid':_0x211884+'.'+_0x4d05e5['id']+'.'+_0x4d05e5[_0xc207('0x6a')]['id'],'FromUserId':_0x1841a4[_0xc207('0x31')]['id'],'type':_0xc207('0x6b'),'ToUserId':_0x4e5b1c['id']};_0x1c7886[_0x5a7bc9+_0xc207('0x77')]=_0x4d05e5['id'];_0x1c7886[_0x5a7bc9+'InteractionId']=_0x4d05e5[_0xc207('0x6a')]['id'];_0x1c7886[_0xc207('0x78')+_0x5a7bc9+_0x328016+'Id']=_0x4d05e5['Account']['id'];return db[_0x5a7bc9+'TransferReport']['create'](_0x1c7886);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x211884,'interaction':_0x4d05e5[_0xc207('0x6a')],'message':_0x4d05e5,'account':_0x4d05e5[_0xc207('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xc207('0x3a'),'appdata':_0x4e5b1c['name']+','+(_0x4d05e5[_0xc207('0x65')]['agentTransferTimeout']||0x12c),'interval':_0xc207('0x79')}]},routingClient);})[_0xc207('0x8')](respondWithResult(_0x7d4f9c,null))[_0xc207('0x17')](handleError(_0x7d4f9c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3809e7c..13c5cf3 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 _0x238d=['/:id/run','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id'];(function(_0x493b70,_0x168e73){var _0x4c2355=function(_0x1e0247){while(--_0x1e0247){_0x493b70['push'](_0x493b70['shift']());}};_0x4c2355(++_0x168e73);}(_0x238d,0x1a9));var _0xd238=function(_0x56a929,_0x546531){_0x56a929=_0x56a929-0x0;var _0x5d2004=_0x238d[_0x56a929];return _0x5d2004;};'use strict';var multer=require(_0xd238('0x0'));var util=require(_0xd238('0x1'));var path=require(_0xd238('0x2'));var timeout=require(_0xd238('0x3'));var express=require(_0xd238('0x4'));var router=express[_0xd238('0x5')]();var fs_extra=require(_0xd238('0x6'));var auth=require(_0xd238('0x7'));var interaction=require(_0xd238('0x8'));var config=require(_0xd238('0x9'));var controller=require(_0xd238('0xa'));router['get']('/',auth[_0xd238('0xb')](),controller[_0xd238('0xc')]);router[_0xd238('0xd')](_0xd238('0xe'),auth[_0xd238('0xb')](),controller['show']);router['get'](_0xd238('0xf'),auth[_0xd238('0xb')](),controller['run']);router[_0xd238('0x10')]('/',auth[_0xd238('0xb')](),controller[_0xd238('0x11')]);router[_0xd238('0x12')]('/:id',auth[_0xd238('0xb')](),controller[_0xd238('0x13')]);router['delete'](_0xd238('0xe'),auth[_0xd238('0xb')](),controller[_0xd238('0x14')]);module[_0xd238('0x15')]=router; \ No newline at end of file +var _0xf6c6=['run','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','show','/:id/run'];(function(_0x2216c3,_0x42e341){var _0x56fd3d=function(_0x5ac34d){while(--_0x5ac34d){_0x2216c3['push'](_0x2216c3['shift']());}};_0x56fd3d(++_0x42e341);}(_0xf6c6,0x1e8));var _0x6f6c=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xf6c6[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var path=require(_0x6f6c('0x2'));var timeout=require(_0x6f6c('0x3'));var express=require(_0x6f6c('0x4'));var router=express[_0x6f6c('0x5')]();var fs_extra=require(_0x6f6c('0x6'));var auth=require(_0x6f6c('0x7'));var interaction=require(_0x6f6c('0x8'));var config=require(_0x6f6c('0x9'));var controller=require(_0x6f6c('0xa'));router['get']('/',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0xc')]);router[_0x6f6c('0xd')]('/:id',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0xe')]);router[_0x6f6c('0xd')](_0x6f6c('0xf'),auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x10')]);router['post']('/',auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x11')]);router[_0x6f6c('0x12')](_0x6f6c('0x13'),auth['isAuthenticated'](),controller[_0x6f6c('0x14')]);router[_0x6f6c('0x15')](_0x6f6c('0x13'),auth[_0x6f6c('0xb')](),controller[_0x6f6c('0x16')]);module[_0x6f6c('0x17')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 81c336e..cc2a3db 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 _0xf174=['TEXT','exports','STRING','INTEGER','ENUM','years','quarters','months','weeks','minutes','csv','pdf','custom','default','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf174,0x1a5));var _0x4f17=function(_0x20c432,_0x224c52){_0x20c432=_0x20c432-0x0;var _0x5b02e9=_0xf174[_0x20c432];return _0x5b02e9;};'use strict';var Sequelize=require('sequelize');module[_0x4f17('0x0')]={'name':{'type':Sequelize[_0x4f17('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4f17('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4f17('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4f17('0x2')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4f17('0x3')](_0x4f17('0x4'),_0x4f17('0x5'),_0x4f17('0x6'),_0x4f17('0x7'),'days','hours',_0x4f17('0x8')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x4f17('0x3')](_0x4f17('0x9'),_0x4f17('0xa'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x4f17('0x3')](_0x4f17('0xb'),_0x4f17('0xc')),'allowNull':![],'defaultValue':_0x4f17('0xb')},'sendMail':{'type':Sequelize[_0x4f17('0xd')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4f17('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x4f17('0xd')],'defaultValue':!![]}}; \ No newline at end of file +var _0x79e2=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','days','csv','pdf','xlsx','custom','default','TEXT','sequelize'];(function(_0x2435b8,_0x3bce09){var _0x2cfea0=function(_0x4d55e0){while(--_0x4d55e0){_0x2435b8['push'](_0x2435b8['shift']());}};_0x2cfea0(++_0x3bce09);}(_0x79e2,0x15f));var _0x279e=function(_0x446789,_0x40aa74){_0x446789=_0x446789-0x0;var _0x534e45=_0x79e2[_0x446789];return _0x534e45;};'use strict';var Sequelize=require(_0x279e('0x0'));module[_0x279e('0x1')]={'name':{'type':Sequelize[_0x279e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x279e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x279e('0x4')},'startAt':{'type':Sequelize[_0x279e('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x279e('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x279e('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x279e('0x7')]('years',_0x279e('0x8'),'months','weeks',_0x279e('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0x279e('0x9')},'output':{'type':Sequelize['ENUM'](_0x279e('0xa'),_0x279e('0xb'),_0x279e('0xc')),'allowNull':![],'defaultValue':_0x279e('0xa')},'type':{'type':Sequelize[_0x279e('0x7')](_0x279e('0xd'),_0x279e('0xe')),'allowNull':![],'defaultValue':_0x279e('0xd')},'sendMail':{'type':Sequelize[_0x279e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x279e('0x2')]},'cc':{'type':Sequelize[_0x279e('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index da673b0..d6470fa 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 _0x08dd=['length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','run','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x3f36f9,_0x4dd9ef){var _0x26c06b=function(_0x1ac062){while(--_0x1ac062){_0x3f36f9['push'](_0x3f36f9['shift']());}};_0x26c06b(++_0x4dd9ef);}(_0x08dd,0x106));var _0xd08d=function(_0xb1ef48,_0x30273d){_0xb1ef48=_0xb1ef48-0x0;var _0x5e4137=_0x08dd[_0xb1ef48];return _0x5e4137;};'use strict';var emlformat=require(_0xd08d('0x0'));var rimraf=require(_0xd08d('0x1'));var zipdir=require(_0xd08d('0x2'));var jsonpatch=require(_0xd08d('0x3'));var rp=require(_0xd08d('0x4'));var moment=require(_0xd08d('0x5'));var BPromise=require(_0xd08d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd08d('0x7'));var csv=require(_0xd08d('0x8'));var ejs=require(_0xd08d('0x9'));var fs=require('fs');var fs_extra=require(_0xd08d('0xa'));var _=require('lodash');var squel=require(_0xd08d('0xb'));var crypto=require(_0xd08d('0xc'));var jsforce=require(_0xd08d('0xd'));var deskjs=require(_0xd08d('0xe'));var toCsv=require(_0xd08d('0x8'));var querystring=require(_0xd08d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd08d('0x10'));var qs=require(_0xd08d('0x11'));var as=require(_0xd08d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd08d('0x13'))(_0xd08d('0x14'));var utils=require(_0xd08d('0x15'));var config=require(_0xd08d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x150a99,_0x5b59a0){_0x5b59a0=_0x5b59a0||0xcc;return function(_0x13e27d){if(_0x13e27d){return _0x150a99[_0xd08d('0x17')](_0x5b59a0);}return _0x150a99[_0xd08d('0x18')](_0x5b59a0)[_0xd08d('0x19')]();};}function respondWithResult(_0x54b0c8,_0x4027b0){_0x4027b0=_0x4027b0||0xc8;return function(_0x482602){if(_0x482602){return _0x54b0c8[_0xd08d('0x18')](_0x4027b0)['json'](_0x482602);}};}function respondWithFilteredResult(_0x4c468b,_0x534c27){return function(_0x57a32e){if(_0x57a32e){var _0x56f2d7=typeof _0x534c27['offset']===_0xd08d('0x1a')&&typeof _0x534c27['limit']==='undefined';var _0x32c485=_0x57a32e['count'];var _0x4e6bf3=_0x56f2d7?0x0:_0x534c27[_0xd08d('0x1b')];var _0x4139a3=_0x56f2d7?_0x57a32e[_0xd08d('0x1c')]:_0x534c27[_0xd08d('0x1b')]+_0x534c27[_0xd08d('0x1d')];var _0x92f5f9;if(_0x4139a3>=_0x32c485){_0x4139a3=_0x32c485;_0x92f5f9=0xc8;}else{_0x92f5f9=0xce;}_0x4c468b[_0xd08d('0x18')](_0x92f5f9);return _0x4c468b[_0xd08d('0x1e')](_0xd08d('0x1f'),_0x4e6bf3+'-'+_0x4139a3+'/'+_0x32c485)['json'](_0x57a32e);}return null;};}function patchUpdates(_0x521085){return function(_0x30605d){try{jsonpatch[_0xd08d('0x20')](_0x30605d,_0x521085,!![]);}catch(_0x2a1547){return BPromise['reject'](_0x2a1547);}return _0x30605d[_0xd08d('0x21')]();};}function saveUpdates(_0x3a6eb7,_0x4d089){return function(_0x5d81f9){if(_0x5d81f9){return _0x5d81f9[_0xd08d('0x22')](_0x3a6eb7)['then'](function(_0x4cbb0c){return _0x4cbb0c;});}return null;};}function removeEntity(_0x63a5db,_0x1f9bdf){return function(_0x46bfdd){if(_0x46bfdd){return _0x46bfdd[_0xd08d('0x23')]()[_0xd08d('0x24')](function(){var _0x3e741d=_0x46bfdd[_0xd08d('0x25')]({'plain':!![]});var _0x4985ff=_0xd08d('0x26');return db[_0xd08d('0x27')][_0xd08d('0x23')]({'where':{'type':_0x4985ff,'resourceId':_0x3e741d['id']}})['then'](function(){return _0x46bfdd;});})[_0xd08d('0x24')](function(){_0x63a5db[_0xd08d('0x18')](0xcc)[_0xd08d('0x19')]();});}};}function handleEntityNotFound(_0x58da7b,_0x44d38c){return function(_0x3ddb34){if(!_0x3ddb34){_0x58da7b['sendStatus'](0x194);}return _0x3ddb34;};}function handleError(_0x5f14c5,_0x1e4db6){_0x1e4db6=_0x1e4db6||0x1f4;return function(_0x1f02b4){logger[_0xd08d('0x28')](_0x1f02b4[_0xd08d('0x29')]);if(_0x1f02b4[_0xd08d('0x2a')]){delete _0x1f02b4[_0xd08d('0x2a')];}_0x5f14c5[_0xd08d('0x18')](_0x1e4db6)[_0xd08d('0x2b')](_0x1f02b4);};}exports['index']=function(_0x5ee450,_0x11d48d){var _0x400e2e={},_0x22b86c={},_0x5cd6c9={'count':0x0,'rows':[]};var _0x210b49=_[_0xd08d('0x2c')](db[_0xd08d('0x2d')]['rawAttributes'],function(_0x30e690){return{'name':_0x30e690['fieldName'],'type':_0x30e690[_0xd08d('0x2e')][_0xd08d('0x2f')]};});_0x22b86c[_0xd08d('0x30')]=_['map'](_0x210b49,_0xd08d('0x2a'));_0x22b86c[_0xd08d('0x31')]=_[_0xd08d('0x32')](_0x5ee450[_0xd08d('0x31')]);_0x22b86c['filters']=_['intersection'](_0x22b86c[_0xd08d('0x30')],_0x22b86c['query']);_0x400e2e['attributes']=_[_0xd08d('0x33')](_0x22b86c[_0xd08d('0x30')],qs[_0xd08d('0x34')](_0x5ee450['query'][_0xd08d('0x34')]));_0x400e2e[_0xd08d('0x35')]=_0x400e2e[_0xd08d('0x35')][_0xd08d('0x36')]?_0x400e2e['attributes']:_0x22b86c[_0xd08d('0x30')];if(!_0x5ee450[_0xd08d('0x31')][_0xd08d('0x37')](_0xd08d('0x38'))){_0x400e2e[_0xd08d('0x1d')]=qs[_0xd08d('0x1d')](_0x5ee450[_0xd08d('0x31')][_0xd08d('0x1d')]);_0x400e2e[_0xd08d('0x1b')]=qs[_0xd08d('0x1b')](_0x5ee450[_0xd08d('0x31')]['offset']);}_0x400e2e['order']=qs[_0xd08d('0x39')](_0x5ee450['query']['sort']);_0x400e2e[_0xd08d('0x3a')]=qs[_0xd08d('0x3b')](_[_0xd08d('0x3c')](_0x5ee450[_0xd08d('0x31')],_0x22b86c[_0xd08d('0x3b')]),_0x210b49);if(_0x5ee450['query'][_0xd08d('0x3d')]){_0x400e2e[_0xd08d('0x3a')]=_[_0xd08d('0x3e')](_0x400e2e[_0xd08d('0x3a')],{'$or':_[_0xd08d('0x2c')](_0x210b49,function(_0x39de38){if(_0x39de38[_0xd08d('0x2e')]!==_0xd08d('0x3f')){var _0x33c3e5={};_0x33c3e5[_0x39de38[_0xd08d('0x2a')]]={'$like':'%'+_0x5ee450[_0xd08d('0x31')]['filter']+'%'};return _0x33c3e5;}})});}_0x400e2e=_[_0xd08d('0x3e')]({},_0x400e2e,_0x5ee450[_0xd08d('0x40')]);var _0x640630={'where':_0x400e2e[_0xd08d('0x3a')]};return db[_0xd08d('0x2d')][_0xd08d('0x1c')](_0x640630)['then'](function(_0x2fdce0){_0x5cd6c9['count']=_0x2fdce0;if(_0x5ee450[_0xd08d('0x31')][_0xd08d('0x41')]){_0x400e2e['include']=[{'all':!![]}];}return db[_0xd08d('0x2d')][_0xd08d('0x42')](_0x400e2e);})[_0xd08d('0x24')](function(_0x1b7c41){_0x5cd6c9['rows']=_0x1b7c41;return _0x5cd6c9;})[_0xd08d('0x24')](respondWithFilteredResult(_0x11d48d,_0x400e2e))[_0xd08d('0x43')](handleError(_0x11d48d,null));};exports['show']=function(_0x4f9455,_0x864102){var _0x49ffe5={'raw':![],'where':{'id':_0x4f9455['params']['id']}},_0x847541={};_0x847541[_0xd08d('0x30')]=_['keys'](db[_0xd08d('0x2d')][_0xd08d('0x44')]);_0x847541['query']=_[_0xd08d('0x32')](_0x4f9455[_0xd08d('0x31')]);_0x847541[_0xd08d('0x3b')]=_[_0xd08d('0x33')](_0x847541[_0xd08d('0x30')],_0x847541[_0xd08d('0x31')]);_0x49ffe5[_0xd08d('0x35')]=_[_0xd08d('0x33')](_0x847541[_0xd08d('0x30')],qs[_0xd08d('0x34')](_0x4f9455['query']['fields']));_0x49ffe5[_0xd08d('0x35')]=_0x49ffe5['attributes'][_0xd08d('0x36')]?_0x49ffe5[_0xd08d('0x35')]:_0x847541[_0xd08d('0x30')];if(_0x4f9455['query'][_0xd08d('0x41')]){_0x49ffe5[_0xd08d('0x45')]=[{'all':!![]}];}_0x49ffe5=_[_0xd08d('0x3e')]({},_0x49ffe5,_0x4f9455['options']);return db[_0xd08d('0x2d')][_0xd08d('0x46')](_0x49ffe5)[_0xd08d('0x24')](handleEntityNotFound(_0x864102,null))[_0xd08d('0x24')](respondWithResult(_0x864102,null))['catch'](handleError(_0x864102,null));};exports[_0xd08d('0x47')]=function(_0x43fec8,_0x48fce3){return db[_0xd08d('0x2d')][_0xd08d('0x47')](_0x43fec8['body'],{})[_0xd08d('0x24')](function(_0x34d750){var _0x5e5f93=_0x43fec8[_0xd08d('0x48')]['get']({'plain':!![]});if(!_0x5e5f93)throw new Error(_0xd08d('0x49'));if(_0x5e5f93[_0xd08d('0x4a')]==='user'){var _0x1a50f0=_0x34d750['get']({'plain':!![]});var _0x6d3d4b='Scheduler';return db['UserProfileSection'][_0xd08d('0x46')]({'where':{'name':_0x6d3d4b,'userProfileId':_0x5e5f93['userProfileId']},'raw':!![]})['then'](function(_0x250d46){if(_0x250d46&&_0x250d46[_0xd08d('0x4b')]===0x0){return db[_0xd08d('0x27')][_0xd08d('0x47')]({'name':_0x1a50f0[_0xd08d('0x2a')],'resourceId':_0x1a50f0['id'],'type':_0x250d46[_0xd08d('0x2a')],'sectionId':_0x250d46['id']},{})['then'](function(){return _0x34d750;});}else{return _0x34d750;}})[_0xd08d('0x43')](function(_0x2043e7){logger[_0xd08d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2043e7);throw _0x2043e7;});}return _0x34d750;})['then'](respondWithResult(_0x48fce3,0xc9))[_0xd08d('0x43')](handleError(_0x48fce3,null));};exports['update']=function(_0x49b317,_0x4df02b){if(_0x49b317[_0xd08d('0x4c')]['id']){delete _0x49b317[_0xd08d('0x4c')]['id'];}return db['Schedule'][_0xd08d('0x46')]({'where':{'id':_0x49b317['params']['id']}})['then'](handleEntityNotFound(_0x4df02b,null))[_0xd08d('0x24')](saveUpdates(_0x49b317[_0xd08d('0x4c')],null))[_0xd08d('0x24')](respondWithResult(_0x4df02b,null))[_0xd08d('0x43')](handleError(_0x4df02b,null));};exports[_0xd08d('0x23')]=function(_0x5444b1,_0x5c1784){return db['Schedule'][_0xd08d('0x46')]({'where':{'id':_0x5444b1['params']['id']}})['then'](handleEntityNotFound(_0x5c1784,null))[_0xd08d('0x24')](removeEntity(_0x5c1784,null))['catch'](handleError(_0x5c1784,null));};exports[_0xd08d('0x4d')]=function(_0x1e0d38,_0x13702a,_0x51c35e){var _0xb326a9=require('../../config/schedule');return db[_0xd08d('0x2d')][_0xd08d('0x46')]({'where':{'id':_0x1e0d38[_0xd08d('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x13702a,null))[_0xd08d('0x24')](function(){_0xb326a9['run'](_0x1e0d38[_0xd08d('0x4e')]['id']);})['then'](respondWithStatusCode(_0x13702a,null))[_0xd08d('0x43')](handleError(_0x13702a,null));}; \ No newline at end of file +var _0xa40e=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','name','index','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','Schedule','includeAll','findAll','catch','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5d72e1,_0x38740a){var _0x2f973e=function(_0x18c34d){while(--_0x18c34d){_0x5d72e1['push'](_0x5d72e1['shift']());}};_0x2f973e(++_0x38740a);}(_0xa40e,0xe5));var _0xea40=function(_0x2765b1,_0x3b47a4){_0x2765b1=_0x2765b1-0x0;var _0x761c6e=_0xa40e[_0x2765b1];return _0x761c6e;};'use strict';var emlformat=require(_0xea40('0x0'));var rimraf=require(_0xea40('0x1'));var zipdir=require(_0xea40('0x2'));var jsonpatch=require(_0xea40('0x3'));var rp=require(_0xea40('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xea40('0x5'));var sox=require(_0xea40('0x6'));var csv=require(_0xea40('0x7'));var ejs=require(_0xea40('0x8'));var fs=require('fs');var fs_extra=require(_0xea40('0x9'));var _=require(_0xea40('0xa'));var squel=require(_0xea40('0xb'));var crypto=require(_0xea40('0xc'));var jsforce=require(_0xea40('0xd'));var deskjs=require(_0xea40('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea40('0xf'));var Papa=require(_0xea40('0x10'));var Redis=require(_0xea40('0x11'));var authService=require(_0xea40('0x12'));var qs=require(_0xea40('0x13'));var as=require(_0xea40('0x14'));var hardwareService=require(_0xea40('0x15'));var logger=require('../../config/logger')(_0xea40('0x16'));var utils=require(_0xea40('0x17'));var config=require(_0xea40('0x18'));var licenseUtil=require(_0xea40('0x19'));var db=require(_0xea40('0x1a'))['db'];function respondWithStatusCode(_0x5d35db,_0x1faccc){_0x1faccc=_0x1faccc||0xcc;return function(_0x5a3b3d){if(_0x5a3b3d){return _0x5d35db[_0xea40('0x1b')](_0x1faccc);}return _0x5d35db['status'](_0x1faccc)[_0xea40('0x1c')]();};}function respondWithResult(_0x30da77,_0x17eb4a){_0x17eb4a=_0x17eb4a||0xc8;return function(_0x4be284){if(_0x4be284){return _0x30da77[_0xea40('0x1d')](_0x17eb4a)[_0xea40('0x1e')](_0x4be284);}};}function respondWithFilteredResult(_0x43fc94,_0x59969e){return function(_0x3d8389){if(_0x3d8389){var _0x45052f=typeof _0x59969e[_0xea40('0x1f')]==='undefined'&&typeof _0x59969e[_0xea40('0x20')]===_0xea40('0x21');var _0x54973f=_0x3d8389[_0xea40('0x22')];var _0x31e16d=_0x45052f?0x0:_0x59969e[_0xea40('0x1f')];var _0x502fa4=_0x45052f?_0x3d8389[_0xea40('0x22')]:_0x59969e[_0xea40('0x1f')]+_0x59969e[_0xea40('0x20')];var _0x1a2caa;if(_0x502fa4>=_0x54973f){_0x502fa4=_0x54973f;_0x1a2caa=0xc8;}else{_0x1a2caa=0xce;}_0x43fc94['status'](_0x1a2caa);return _0x43fc94[_0xea40('0x23')](_0xea40('0x24'),_0x31e16d+'-'+_0x502fa4+'/'+_0x54973f)['json'](_0x3d8389);}return null;};}function patchUpdates(_0x1f48f6){return function(_0x33335f){try{jsonpatch[_0xea40('0x25')](_0x33335f,_0x1f48f6,!![]);}catch(_0x32f09d){return BPromise[_0xea40('0x26')](_0x32f09d);}return _0x33335f[_0xea40('0x27')]();};}function saveUpdates(_0xd0d5c0,_0xfd8aef){return function(_0x552d9b){if(_0x552d9b){return _0x552d9b[_0xea40('0x28')](_0xd0d5c0)[_0xea40('0x29')](function(_0x2d8fa1){return _0x2d8fa1;});}return null;};}function removeEntity(_0x5a593d,_0x27d951){return function(_0x331d9a){if(_0x331d9a){return _0x331d9a['destroy']()[_0xea40('0x29')](function(){var _0x3f448a=_0x331d9a[_0xea40('0x2a')]({'plain':!![]});var _0x2fdb2a=_0xea40('0x2b');return db[_0xea40('0x2c')][_0xea40('0x2d')]({'where':{'type':_0x2fdb2a,'resourceId':_0x3f448a['id']}})[_0xea40('0x29')](function(){return _0x331d9a;});})[_0xea40('0x29')](function(){_0x5a593d[_0xea40('0x1d')](0xcc)[_0xea40('0x1c')]();});}};}function handleEntityNotFound(_0x4631e3,_0x2c2954){return function(_0x104fb0){if(!_0x104fb0){_0x4631e3[_0xea40('0x1b')](0x194);}return _0x104fb0;};}function handleError(_0x92d542,_0x12abbb){_0x12abbb=_0x12abbb||0x1f4;return function(_0x362e2f){logger[_0xea40('0x2e')](_0x362e2f['stack']);if(_0x362e2f[_0xea40('0x2f')]){delete _0x362e2f[_0xea40('0x2f')];}_0x92d542[_0xea40('0x1d')](_0x12abbb)['send'](_0x362e2f);};}exports[_0xea40('0x30')]=function(_0x160ab0,_0x310135){var _0x5eddca={},_0x127503={},_0x2e4c1a={'count':0x0,'rows':[]};var _0x37e0bf=_['map'](db['Schedule'][_0xea40('0x31')],function(_0x1a808f){return{'name':_0x1a808f[_0xea40('0x32')],'type':_0x1a808f[_0xea40('0x33')][_0xea40('0x34')]};});_0x127503['model']=_['map'](_0x37e0bf,'name');_0x127503[_0xea40('0x35')]=_[_0xea40('0x36')](_0x160ab0[_0xea40('0x35')]);_0x127503[_0xea40('0x37')]=_['intersection'](_0x127503[_0xea40('0x38')],_0x127503[_0xea40('0x35')]);_0x5eddca['attributes']=_[_0xea40('0x39')](_0x127503['model'],qs['fields'](_0x160ab0[_0xea40('0x35')][_0xea40('0x3a')]));_0x5eddca[_0xea40('0x3b')]=_0x5eddca[_0xea40('0x3b')]['length']?_0x5eddca['attributes']:_0x127503['model'];if(!_0x160ab0['query'][_0xea40('0x3c')](_0xea40('0x3d'))){_0x5eddca[_0xea40('0x20')]=qs[_0xea40('0x20')](_0x160ab0['query']['limit']);_0x5eddca[_0xea40('0x1f')]=qs['offset'](_0x160ab0[_0xea40('0x35')][_0xea40('0x1f')]);}_0x5eddca['order']=qs[_0xea40('0x3e')](_0x160ab0[_0xea40('0x35')][_0xea40('0x3e')]);_0x5eddca[_0xea40('0x3f')]=qs[_0xea40('0x37')](_[_0xea40('0x40')](_0x160ab0[_0xea40('0x35')],_0x127503['filters']),_0x37e0bf);if(_0x160ab0[_0xea40('0x35')][_0xea40('0x41')]){_0x5eddca['where']=_[_0xea40('0x42')](_0x5eddca[_0xea40('0x3f')],{'$or':_[_0xea40('0x43')](_0x37e0bf,function(_0x18bbc1){if(_0x18bbc1[_0xea40('0x33')]!=='VIRTUAL'){var _0x59b044={};_0x59b044[_0x18bbc1[_0xea40('0x2f')]]={'$like':'%'+_0x160ab0['query'][_0xea40('0x41')]+'%'};return _0x59b044;}})});}_0x5eddca=_[_0xea40('0x42')]({},_0x5eddca,_0x160ab0[_0xea40('0x44')]);var _0x373f82={'where':_0x5eddca[_0xea40('0x3f')]};return db[_0xea40('0x45')][_0xea40('0x22')](_0x373f82)[_0xea40('0x29')](function(_0x1fc3d8){_0x2e4c1a[_0xea40('0x22')]=_0x1fc3d8;if(_0x160ab0[_0xea40('0x35')][_0xea40('0x46')]){_0x5eddca['include']=[{'all':!![]}];}return db['Schedule'][_0xea40('0x47')](_0x5eddca);})[_0xea40('0x29')](function(_0x3001c9){_0x2e4c1a['rows']=_0x3001c9;return _0x2e4c1a;})[_0xea40('0x29')](respondWithFilteredResult(_0x310135,_0x5eddca))[_0xea40('0x48')](handleError(_0x310135,null));};exports['show']=function(_0x18bdd0,_0xd035a1){var _0x197bf4={'raw':![],'where':{'id':_0x18bdd0[_0xea40('0x49')]['id']}},_0x35c34f={};_0x35c34f[_0xea40('0x38')]=_[_0xea40('0x36')](db[_0xea40('0x45')][_0xea40('0x31')]);_0x35c34f['query']=_[_0xea40('0x36')](_0x18bdd0['query']);_0x35c34f[_0xea40('0x37')]=_['intersection'](_0x35c34f[_0xea40('0x38')],_0x35c34f[_0xea40('0x35')]);_0x197bf4['attributes']=_[_0xea40('0x39')](_0x35c34f[_0xea40('0x38')],qs[_0xea40('0x3a')](_0x18bdd0[_0xea40('0x35')][_0xea40('0x3a')]));_0x197bf4[_0xea40('0x3b')]=_0x197bf4[_0xea40('0x3b')][_0xea40('0x4a')]?_0x197bf4[_0xea40('0x3b')]:_0x35c34f[_0xea40('0x38')];if(_0x18bdd0[_0xea40('0x35')][_0xea40('0x46')]){_0x197bf4[_0xea40('0x4b')]=[{'all':!![]}];}_0x197bf4=_[_0xea40('0x42')]({},_0x197bf4,_0x18bdd0['options']);return db[_0xea40('0x45')][_0xea40('0x4c')](_0x197bf4)[_0xea40('0x29')](handleEntityNotFound(_0xd035a1,null))['then'](respondWithResult(_0xd035a1,null))[_0xea40('0x48')](handleError(_0xd035a1,null));};exports[_0xea40('0x4d')]=function(_0x4c4efd,_0x7cd543){return db[_0xea40('0x45')]['create'](_0x4c4efd[_0xea40('0x4e')],{})[_0xea40('0x29')](function(_0x4de1fa){var _0x4e0606=_0x4c4efd['user'][_0xea40('0x2a')]({'plain':!![]});if(!_0x4e0606)throw new Error(_0xea40('0x4f'));if(_0x4e0606['role']==='user'){var _0x1ae597=_0x4de1fa[_0xea40('0x2a')]({'plain':!![]});var _0xdca0c0=_0xea40('0x2b');return db['UserProfileSection'][_0xea40('0x4c')]({'where':{'name':_0xdca0c0,'userProfileId':_0x4e0606[_0xea40('0x50')]},'raw':!![]})['then'](function(_0x555d27){if(_0x555d27&&_0x555d27[_0xea40('0x51')]===0x0){return db[_0xea40('0x2c')][_0xea40('0x4d')]({'name':_0x1ae597[_0xea40('0x2f')],'resourceId':_0x1ae597['id'],'type':_0x555d27[_0xea40('0x2f')],'sectionId':_0x555d27['id']},{})[_0xea40('0x29')](function(){return _0x4de1fa;});}else{return _0x4de1fa;}})[_0xea40('0x48')](function(_0x29dce1){logger[_0xea40('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29dce1);throw _0x29dce1;});}return _0x4de1fa;})[_0xea40('0x29')](respondWithResult(_0x7cd543,0xc9))['catch'](handleError(_0x7cd543,null));};exports[_0xea40('0x28')]=function(_0x5f5285,_0x385c3e){if(_0x5f5285['body']['id']){delete _0x5f5285['body']['id'];}return db[_0xea40('0x45')][_0xea40('0x4c')]({'where':{'id':_0x5f5285['params']['id']}})[_0xea40('0x29')](handleEntityNotFound(_0x385c3e,null))[_0xea40('0x29')](saveUpdates(_0x5f5285[_0xea40('0x4e')],null))['then'](respondWithResult(_0x385c3e,null))[_0xea40('0x48')](handleError(_0x385c3e,null));};exports[_0xea40('0x2d')]=function(_0x10e92d,_0x201d69){return db['Schedule'][_0xea40('0x4c')]({'where':{'id':_0x10e92d['params']['id']}})[_0xea40('0x29')](handleEntityNotFound(_0x201d69,null))['then'](removeEntity(_0x201d69,null))[_0xea40('0x48')](handleError(_0x201d69,null));};exports[_0xea40('0x52')]=function(_0x5ed23c,_0xbc1902,_0x43d996){var _0x9c48fe=require('../../config/schedule');return db[_0xea40('0x45')][_0xea40('0x4c')]({'where':{'id':_0x5ed23c[_0xea40('0x49')]['id']},'raw':!![]})[_0xea40('0x29')](handleEntityNotFound(_0xbc1902,null))[_0xea40('0x29')](function(){_0x9c48fe[_0xea40('0x52')](_0x5ed23c[_0xea40('0x49')]['id']);})[_0xea40('0x29')](respondWithStatusCode(_0xbc1902,null))[_0xea40('0x48')](handleError(_0xbc1902,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ccda83d..973c70f 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 _0x791d=['tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','define','Schedule'];(function(_0x55a51b,_0x500b24){var _0x5cbc49=function(_0x1b446e){while(--_0x1b446e){_0x55a51b['push'](_0x55a51b['shift']());}};_0x5cbc49(++_0x500b24);}(_0x791d,0x1d5));var _0xd791=function(_0x9a1d92,_0x44c833){_0x9a1d92=_0x9a1d92-0x0;var _0x11d775=_0x791d[_0x9a1d92];return _0x11d775;};'use strict';var _=require(_0xd791('0x0'));var util=require('util');var logger=require(_0xd791('0x1'))(_0xd791('0x2'));var moment=require(_0xd791('0x3'));var BPromise=require(_0xd791('0x4'));var rp=require(_0xd791('0x5'));var fs=require('fs');var path=require(_0xd791('0x6'));var rimraf=require('rimraf');var config=require(_0xd791('0x7'));var attributes=require(_0xd791('0x8'));module['exports']=function(_0x2b1c97,_0x2602af){return _0x2b1c97[_0xd791('0x9')](_0xd791('0xa'),attributes,{'tableName':_0xd791('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc268=['Schedule','util','../../config/logger','moment','bluebird','request-promise','path','./schedule.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc268,0x1b9));var _0x8c26=function(_0x29237b,_0xaba533){_0x29237b=_0x29237b-0x0;var _0x4bc5f0=_0xc268[_0x29237b];return _0x4bc5f0;};'use strict';var _=require('lodash');var util=require(_0x8c26('0x0'));var logger=require(_0x8c26('0x1'))('api');var moment=require(_0x8c26('0x2'));var BPromise=require(_0x8c26('0x3'));var rp=require(_0x8c26('0x4'));var fs=require('fs');var path=require(_0x8c26('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8c26('0x6'));module[_0x8c26('0x7')]=function(_0x4ffae8,_0x2c8837){return _0x4ffae8[_0x8c26('0x8')](_0x8c26('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 16e84da..ad3ccf0 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 _0x7803=['result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5f0a85,_0x517151){var _0x3ccda7=function(_0x37edce){while(--_0x37edce){_0x5f0a85['push'](_0x5f0a85['shift']());}};_0x3ccda7(++_0x517151);}(_0x7803,0x178));var _0x3780=function(_0x4374c7,_0x551652){_0x4374c7=_0x4374c7-0x0;var _0x24f414=_0x7803[_0x4374c7];return _0x24f414;};'use strict';var _=require(_0x3780('0x0'));var util=require(_0x3780('0x1'));var moment=require(_0x3780('0x2'));var BPromise=require(_0x3780('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3780('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3780('0x5'));var config=require(_0x3780('0x6'));var jayson=require(_0x3780('0x7'));var client=jayson['client'][_0x3780('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bd68d,_0x535b10,_0x15e584){return new BPromise(function(_0x202e89,_0x91c277){return client[_0x3780('0x9')](_0x3bd68d,_0x15e584)[_0x3780('0xa')](function(_0x32d6e2){logger['info'](_0x3780('0xb'),_0x535b10,_0x3780('0xc'));logger[_0x3780('0xd')](_0x3780('0xe'),_0x535b10,_0x3780('0xc'),JSON[_0x3780('0xf')](_0x32d6e2));if(_0x32d6e2[_0x3780('0x10')]){if(_0x32d6e2[_0x3780('0x10')][_0x3780('0x11')]===0x1f4){logger[_0x3780('0x10')]('Schedule,\x20%s,\x20%s',_0x535b10,_0x32d6e2['error'][_0x3780('0x12')]);return _0x91c277(_0x32d6e2['error'][_0x3780('0x12')]);}logger[_0x3780('0x10')]('Schedule,\x20%s,\x20%s',_0x535b10,_0x32d6e2[_0x3780('0x10')][_0x3780('0x12')]);return _0x202e89(_0x32d6e2['error']['message']);}else{logger[_0x3780('0x13')](_0x3780('0xb'),_0x535b10,_0x3780('0xc'));_0x202e89(_0x32d6e2[_0x3780('0x14')][_0x3780('0x12')]);}})[_0x3780('0x15')](function(_0x521d5f){logger[_0x3780('0x10')](_0x3780('0xb'),_0x535b10,_0x521d5f);_0x91c277(_0x521d5f);});});} \ No newline at end of file +var _0x5299=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5299,0x13c));var _0x9529=function(_0x33d755,_0x1411ad){_0x33d755=_0x33d755-0x0;var _0x1307a6=_0x5299[_0x33d755];return _0x1307a6;};'use strict';var _=require(_0x9529('0x0'));var util=require('util');var moment=require(_0x9529('0x1'));var BPromise=require(_0x9529('0x2'));var rs=require(_0x9529('0x3'));var fs=require('fs');var Redis=require(_0x9529('0x4'));var db=require(_0x9529('0x5'))['db'];var utils=require(_0x9529('0x6'));var logger=require('../../config/logger')(_0x9529('0x7'));var config=require(_0x9529('0x8'));var jayson=require(_0x9529('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cecbc,_0x628f40,_0x4b0b75){return new BPromise(function(_0x45bef5,_0x2868b7){return client[_0x9529('0xa')](_0x5cecbc,_0x4b0b75)['then'](function(_0x28af04){logger[_0x9529('0xb')](_0x9529('0xc'),_0x628f40,_0x9529('0xd'));logger[_0x9529('0xe')](_0x9529('0xf'),_0x628f40,'request\x20sent',JSON[_0x9529('0x10')](_0x28af04));if(_0x28af04[_0x9529('0x11')]){if(_0x28af04['error'][_0x9529('0x12')]===0x1f4){logger[_0x9529('0x11')]('Schedule,\x20%s,\x20%s',_0x628f40,_0x28af04['error'][_0x9529('0x13')]);return _0x2868b7(_0x28af04[_0x9529('0x11')][_0x9529('0x13')]);}logger['error'](_0x9529('0xc'),_0x628f40,_0x28af04[_0x9529('0x11')]['message']);return _0x45bef5(_0x28af04[_0x9529('0x11')]['message']);}else{logger[_0x9529('0xb')](_0x9529('0xc'),_0x628f40,'request\x20sent');_0x45bef5(_0x28af04['result']['message']);}})[_0x9529('0x14')](function(_0x15fa50){logger[_0x9529('0x11')](_0x9529('0xc'),_0x628f40,_0x15fa50);_0x2868b7(_0x15fa50);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index dc5bd62..2707616 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 _0x9f67=['../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','create','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xd68747,_0x480080){var _0x227c9b=function(_0x4b8ad2){while(--_0x4b8ad2){_0xd68747['push'](_0xd68747['shift']());}};_0x227c9b(++_0x480080);}(_0x9f67,0xea));var _0x79f6=function(_0x590725,_0x884a7d){_0x590725=_0x590725-0x0;var _0x1ff90f=_0x9f67[_0x590725];return _0x1ff90f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79f6('0x0'));var timeout=require(_0x79f6('0x1'));var express=require(_0x79f6('0x2'));var router=express[_0x79f6('0x3')]();var fs_extra=require(_0x79f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x79f6('0x5'));var config=require(_0x79f6('0x6'));var controller=require(_0x79f6('0x7'));router[_0x79f6('0x8')]('/',auth[_0x79f6('0x9')](),controller[_0x79f6('0xa')]);router['get'](_0x79f6('0xb'),auth[_0x79f6('0x9')](),controller[_0x79f6('0xc')]);router['get'](_0x79f6('0xd'),auth[_0x79f6('0x9')](),controller[_0x79f6('0xe')]);router[_0x79f6('0x8')](_0x79f6('0xf'),auth[_0x79f6('0x9')](),controller['download']);router[_0x79f6('0x10')]('/',auth[_0x79f6('0x9')](),controller[_0x79f6('0x11')]);router['put']('/:id',auth[_0x79f6('0x9')](),controller[_0x79f6('0x12')]);router['delete'](_0x79f6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x79f6('0x13')]=router; \ No newline at end of file +var _0x8f3b=['isAuthenticated','post','put','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','show','/:id/download'];(function(_0x5dbe34,_0x17081c){var _0xd9592b=function(_0x52164e){while(--_0x52164e){_0x5dbe34['push'](_0x5dbe34['shift']());}};_0xd9592b(++_0x17081c);}(_0x8f3b,0x1d9));var _0xb8f3=function(_0x201515,_0x202dc4){_0x201515=_0x201515-0x0;var _0x3163ae=_0x8f3b[_0x201515];return _0x3163ae;};'use strict';var multer=require(_0xb8f3('0x0'));var util=require('util');var path=require(_0xb8f3('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8f3('0x2'));var router=express[_0xb8f3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb8f3('0x4'));var config=require(_0xb8f3('0x5'));var controller=require('./screenRecording.controller');router[_0xb8f3('0x6')]('/',auth['isAuthenticated'](),controller[_0xb8f3('0x7')]);router['get'](_0xb8f3('0x8'),auth['isAuthenticated'](),controller[_0xb8f3('0x9')]);router[_0xb8f3('0x6')](_0xb8f3('0xa'),auth['isAuthenticated'](),controller[_0xb8f3('0xb')]);router['get'](_0xb8f3('0xc'),auth[_0xb8f3('0xd')](),controller['download']);router[_0xb8f3('0xe')]('/',auth[_0xb8f3('0xd')](),controller['create']);router[_0xb8f3('0xf')]('/:id',auth[_0xb8f3('0xd')](),controller['update']);router[_0xb8f3('0x10')](_0xb8f3('0xa'),auth['isAuthenticated'](),controller[_0xb8f3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6e8607b..a8b21af 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 _0xca6e=['startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER'];(function(_0x4ebc7b,_0x255c0d){var _0x52a271=function(_0x2dbaaa){while(--_0x2dbaaa){_0x4ebc7b['push'](_0x4ebc7b['shift']());}};_0x52a271(++_0x255c0d);}(_0xca6e,0x1c1));var _0xeca6=function(_0x3f5954,_0x2d7584){_0x3f5954=_0x3f5954-0x0;var _0x4cf1b5=_0xca6e[_0x3f5954];return _0x4cf1b5;};'use strict';var Sequelize=require(_0xeca6('0x0'));var moment=require(_0xeca6('0x1'));var path=require(_0xeca6('0x2'));var config=require(_0xeca6('0x3'));module[_0xeca6('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xeca6('0x5')](_0xeca6('0x6'))?path['extname'](this[_0xeca6('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xeca6('0x7')]},'channel':{'type':Sequelize[_0xeca6('0x7')]},'value':{'type':Sequelize[_0xeca6('0x7')],'set':function(_0x5bec20){var _0x2ea018=_0x5bec20['replace'](/\\/g,'/');this[_0xeca6('0x8')](_0xeca6('0x6'),_0x2ea018);}},'rating':{'type':Sequelize[_0xeca6('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xeca6('0x9')],'set':function(_0xb5853c){this['setDataValue'](_0xeca6('0xa'),moment()[_0xeca6('0xb')](_0xb5853c,'ms'));this[_0xeca6('0x8')](_0xeca6('0xc'),moment());this[_0xeca6('0x8')]('duration',_0xb5853c);}},'startedAt':{'type':Sequelize[_0xeca6('0xd')],'get':function(){return moment(this[_0xeca6('0x5')](_0xeca6('0xa')))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xeca6('0xc')))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xeca6('0x5')]('createdAt'))[_0xeca6('0xe')](_0xeca6('0xf'))[_0xeca6('0x10')]();}},'updatedAt':{'type':Sequelize[_0xeca6('0xd')],'get':function(){return moment(this[_0xeca6('0x5')]('updatedAt'))[_0xeca6('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xeca6('0x10')]();}}}; \ No newline at end of file +var _0xf811=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x554d7e,_0x2a7c4a){var _0x58fb7c=function(_0xc52bb4){while(--_0xc52bb4){_0x554d7e['push'](_0x554d7e['shift']());}};_0x58fb7c(++_0x2a7c4a);}(_0xf811,0x6f));var _0x1f81=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xf811[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x1f81('0x0'));var moment=require(_0x1f81('0x1'));var path=require(_0x1f81('0x2'));var config=require(_0x1f81('0x3'));module[_0x1f81('0x4')]={'format':{'type':Sequelize[_0x1f81('0x5')],'get':function(){return this[_0x1f81('0x6')](_0x1f81('0x7'))?path[_0x1f81('0x8')](this[_0x1f81('0x6')](_0x1f81('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x1f81('0x9')]},'channel':{'type':Sequelize[_0x1f81('0x9')]},'value':{'type':Sequelize[_0x1f81('0x9')],'set':function(_0x57c512){var _0x2238b2=_0x57c512[_0x1f81('0xa')](/\\/g,'/');this[_0x1f81('0xb')]('value',_0x2238b2);}},'rating':{'type':Sequelize[_0x1f81('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1f81('0xc')],'set':function(_0x4af394){this[_0x1f81('0xb')]('startedAt',moment()[_0x1f81('0xd')](_0x4af394,'ms'));this[_0x1f81('0xb')](_0x1f81('0xe'),moment());this[_0x1f81('0xb')](_0x1f81('0xf'),_0x4af394);}},'startedAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0x11')))[_0x1f81('0x12')](_0x1f81('0x13'))[_0x1f81('0x14')]();}},'closedAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0xe')))[_0x1f81('0x12')](_0x1f81('0x13'))['toString']();}},'createdAt':{'type':Sequelize[_0x1f81('0x10')],'get':function(){return moment(this[_0x1f81('0x6')]('createdAt'))['format'](_0x1f81('0x13'))[_0x1f81('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x1f81('0x6')](_0x1f81('0x15')))[_0x1f81('0x12')](_0x1f81('0x13'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 78d0ada..b5626cd 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(_0x725fa4,_0x448022){var _0x3f4258=function(_0x28ac81){while(--_0x28ac81){_0x725fa4['push'](_0x725fa4['shift']());}};_0x3f4258(++_0x448022);}(_0x038b,0x114));var _0xb038=function(_0x1339e3,_0x4d5a8d){_0x1339e3=_0x1339e3-0x0;var _0x41a541=_0x038b[_0x1339e3];return _0x41a541;};'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 _0x2d17=['apply','then','error','name','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','catch','show','find','create','body','update','duration','closedAt','value','params','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ValidationError','filename','download','extname','unlink','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range'];(function(_0xb2790f,_0x366410){var _0x3205de=function(_0x26d1c3){while(--_0x26d1c3){_0xb2790f['push'](_0xb2790f['shift']());}};_0x3205de(++_0x366410);}(_0x2d17,0x17e));var _0x72d1=function(_0x36eeda,_0xdb6d82){_0x36eeda=_0x36eeda-0x0;var _0x13d187=_0x2d17[_0x36eeda];return _0x13d187;};'use strict';var emlformat=require(_0x72d1('0x0'));var rimraf=require(_0x72d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72d1('0x2'));var rp=require(_0x72d1('0x3'));var moment=require('moment');var BPromise=require(_0x72d1('0x4'));var Mustache=require(_0x72d1('0x5'));var util=require('util');var path=require(_0x72d1('0x6'));var sox=require('sox');var csv=require(_0x72d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72d1('0x8'));var _=require(_0x72d1('0x9'));var squel=require('squel');var crypto=require(_0x72d1('0xa'));var jsforce=require(_0x72d1('0xb'));var deskjs=require(_0x72d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72d1('0xd'));var Papa=require(_0x72d1('0xe'));var Redis=require(_0x72d1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x72d1('0x10'));var as=require(_0x72d1('0x11'));var hardwareService=require(_0x72d1('0x12'));var logger=require(_0x72d1('0x13'))(_0x72d1('0x14'));var utils=require(_0x72d1('0x15'));var config=require(_0x72d1('0x16'));var licenseUtil=require(_0x72d1('0x17'));var db=require(_0x72d1('0x18'))['db'];function respondWithStatusCode(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xcc;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0x19')](_0x5ad4df);}return _0x2f5a78[_0x72d1('0x1a')](_0x5ad4df)[_0x72d1('0x1b')]();};}function respondWithResult(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0xc8;return function(_0x143718){if(_0x143718){return _0x22ac6f[_0x72d1('0x1a')](_0x685a27)[_0x72d1('0x1c')](_0x143718);}};}function respondWithFilteredResult(_0x3f190f,_0x21c85e){return function(_0x23a238){if(_0x23a238){var _0x8d458=typeof _0x21c85e['offset']===_0x72d1('0x1d')&&typeof _0x21c85e['limit']===_0x72d1('0x1d');var _0x2c9851=_0x23a238['count'];var _0x1061b7=_0x8d458?0x0:_0x21c85e[_0x72d1('0x1e')];var _0x1ca18d=_0x8d458?_0x23a238['count']:_0x21c85e['offset']+_0x21c85e[_0x72d1('0x1f')];var _0x10d464;if(_0x1ca18d>=_0x2c9851){_0x1ca18d=_0x2c9851;_0x10d464=0xc8;}else{_0x10d464=0xce;}_0x3f190f[_0x72d1('0x1a')](_0x10d464);return _0x3f190f[_0x72d1('0x20')](_0x72d1('0x21'),_0x1061b7+'-'+_0x1ca18d+'/'+_0x2c9851)[_0x72d1('0x1c')](_0x23a238);}return null;};}function patchUpdates(_0x1e2411){return function(_0x5c7982){try{jsonpatch[_0x72d1('0x22')](_0x5c7982,_0x1e2411,!![]);}catch(_0x56e8d3){return BPromise['reject'](_0x56e8d3);}return _0x5c7982['save']();};}function saveUpdates(_0x585243,_0x445985){return function(_0x374602){if(_0x374602){return _0x374602['update'](_0x585243)[_0x72d1('0x23')](function(_0x256dc1){return _0x256dc1;});}return null;};}function removeEntity(_0x492086,_0x1431ee){return function(_0x26fa35){if(_0x26fa35){return _0x26fa35['destroy']()['then'](function(){_0x492086[_0x72d1('0x1a')](0xcc)[_0x72d1('0x1b')]();});}};}function handleEntityNotFound(_0x2f661,_0x2f879f){return function(_0xdf6a69){if(!_0xdf6a69){_0x2f661[_0x72d1('0x19')](0x194);}return _0xdf6a69;};}function handleError(_0x163bec,_0x589f7c){_0x589f7c=_0x589f7c||0x1f4;return function(_0x57ec9e){logger[_0x72d1('0x24')](_0x57ec9e['stack']);if(_0x57ec9e[_0x72d1('0x25')]){delete _0x57ec9e[_0x72d1('0x25')];}_0x163bec[_0x72d1('0x1a')](_0x589f7c)['send'](_0x57ec9e);};}exports[_0x72d1('0x26')]=function(_0x4c4c41,_0x707cd0){var _0x20055f={},_0x32588f={},_0x2cc0c8={'count':0x0,'rows':[]};var _0x51242b=_[_0x72d1('0x27')](db['ScreenRecording'][_0x72d1('0x28')],function(_0x32dc5e){return{'name':_0x32dc5e['fieldName'],'type':_0x32dc5e[_0x72d1('0x29')][_0x72d1('0x2a')]};});_0x32588f[_0x72d1('0x2b')]=_[_0x72d1('0x2c')](_[_0x72d1('0x27')](_0x51242b,'name'),[_0x72d1('0x2d')]);_0x32588f[_0x72d1('0x2e')]=_[_0x72d1('0x2f')](_0x4c4c41['query']);_0x32588f[_0x72d1('0x30')]=_[_0x72d1('0x31')](_0x32588f['model'],_0x32588f[_0x72d1('0x2e')]);_0x20055f[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x32588f['model'],qs[_0x72d1('0x33')](_0x4c4c41['query'][_0x72d1('0x33')]));_0x20055f[_0x72d1('0x32')]=_0x20055f[_0x72d1('0x32')][_0x72d1('0x34')]?_0x20055f[_0x72d1('0x32')]:_0x32588f[_0x72d1('0x2b')];if(!_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x35')](_0x72d1('0x36'))){_0x20055f[_0x72d1('0x1f')]=qs[_0x72d1('0x1f')](_0x4c4c41['query'][_0x72d1('0x1f')]);_0x20055f[_0x72d1('0x1e')]=qs[_0x72d1('0x1e')](_0x4c4c41[_0x72d1('0x2e')]['offset']);}_0x20055f[_0x72d1('0x37')]=qs[_0x72d1('0x38')](_0x4c4c41[_0x72d1('0x2e')]['sort']);_0x20055f[_0x72d1('0x39')]=qs[_0x72d1('0x30')](_[_0x72d1('0x3a')](_0x4c4c41['query'],_0x32588f[_0x72d1('0x30')]),_0x51242b);if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]){_0x20055f['where']=_[_0x72d1('0x3c')](_0x20055f[_0x72d1('0x39')],{'$or':_[_0x72d1('0x27')](_0x51242b,function(_0x14cb3d){if(_0x14cb3d[_0x72d1('0x29')]!==_0x72d1('0x3d')){var _0xd7ec0f={};_0xd7ec0f[_0x14cb3d['name']]={'$like':'%'+_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x3b')]+'%'};return _0xd7ec0f;}})});}_0x20055f=_[_0x72d1('0x3c')]({},_0x20055f,_0x4c4c41[_0x72d1('0x3e')]);var _0x20fb2f={'where':_0x20055f[_0x72d1('0x39')]};return db[_0x72d1('0x3f')][_0x72d1('0x40')](_0x20fb2f)['then'](function(_0x44d5b2){_0x2cc0c8[_0x72d1('0x40')]=_0x44d5b2;if(_0x4c4c41[_0x72d1('0x2e')][_0x72d1('0x41')]){_0x20055f[_0x72d1('0x42')]=[{'all':!![]}];}return db[_0x72d1('0x3f')][_0x72d1('0x43')](_0x20055f);})[_0x72d1('0x23')](function(_0x5620f0){_0x2cc0c8['rows']=_0x5620f0;return _0x2cc0c8;})[_0x72d1('0x23')](respondWithFilteredResult(_0x707cd0,_0x20055f))[_0x72d1('0x44')](handleError(_0x707cd0,null));};exports[_0x72d1('0x45')]=function(_0x21d361,_0x5a6bc4){var _0x3fe286={'raw':![],'where':{'id':_0x21d361['params']['id']}},_0x3e80e0={};_0x3e80e0[_0x72d1('0x2b')]=_['keys'](db[_0x72d1('0x3f')][_0x72d1('0x28')]);_0x3e80e0['query']=_[_0x72d1('0x2f')](_0x21d361['query']);_0x3e80e0['filters']=_['intersection'](_0x3e80e0[_0x72d1('0x2b')],_0x3e80e0['query']);_0x3fe286[_0x72d1('0x32')]=_[_0x72d1('0x31')](_0x3e80e0[_0x72d1('0x2b')],qs['fields'](_0x21d361['query'][_0x72d1('0x33')]));_0x3fe286['attributes']=_0x3fe286['attributes'][_0x72d1('0x34')]?_0x3fe286[_0x72d1('0x32')]:_0x3e80e0[_0x72d1('0x2b')];if(_0x21d361['query']['includeAll']){_0x3fe286['include']=[{'all':!![]}];}_0x3fe286=_['merge']({},_0x3fe286,_0x21d361[_0x72d1('0x3e')]);return db[_0x72d1('0x3f')][_0x72d1('0x46')](_0x3fe286)[_0x72d1('0x23')](handleEntityNotFound(_0x5a6bc4,null))[_0x72d1('0x23')](respondWithResult(_0x5a6bc4,null))[_0x72d1('0x44')](handleError(_0x5a6bc4,null));};exports[_0x72d1('0x47')]=function(_0x5924c,_0x1e2c11){return db['ScreenRecording'][_0x72d1('0x47')](_0x5924c[_0x72d1('0x48')],{})[_0x72d1('0x23')](respondWithResult(_0x1e2c11,0xc9))['catch'](handleError(_0x1e2c11,null));};exports[_0x72d1('0x49')]=function(_0x29c88f,_0x12ad75){if(_0x29c88f['body']['id']){delete _0x29c88f[_0x72d1('0x48')]['id'];}delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4a')];delete _0x29c88f[_0x72d1('0x48')]['createdAt'];delete _0x29c88f['body'][_0x72d1('0x4b')];delete _0x29c88f[_0x72d1('0x48')][_0x72d1('0x4c')];return db['ScreenRecording'][_0x72d1('0x46')]({'where':{'id':_0x29c88f[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](handleEntityNotFound(_0x12ad75,null))[_0x72d1('0x23')](saveUpdates(_0x29c88f[_0x72d1('0x48')],null))[_0x72d1('0x23')](respondWithResult(_0x12ad75,null))[_0x72d1('0x44')](handleError(_0x12ad75,null));};exports[_0x72d1('0x4e')]=function(_0x12870c,_0x18f986){return db[_0x72d1('0x3f')]['describe']()[_0x72d1('0x23')](respondWithResult(_0x18f986,null))['catch'](handleError(_0x18f986,null));};exports['download']=function(_0x356196,_0x5f2bba,_0x3c880e){var _0x7e401b=require(_0x72d1('0x4f'));var _0x162248=![];var _0x473a7b={};if(_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]&&_0x356196[_0x72d1('0x2e')][_0x72d1('0x29')]===_0x72d1('0x50')){_0x473a7b[_0x72d1('0x50')]=_0x356196['params']['id'];}else{_0x473a7b['id']=_0x356196[_0x72d1('0x4d')]['id'];}return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':_0x473a7b,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5f2bba,null))[_0x72d1('0x23')](function(_0x140f0b){if(_0x140f0b){var _0x16e9e7=path[_0x72d1('0x51')](config[_0x72d1('0x52')],'server/files/screen_recordings',_0x140f0b[_0x72d1('0x4c')]);var _0x48f4a7=util[_0x72d1('0x2d')](_0x72d1('0x53'),_0x16e9e7);if(fs[_0x72d1('0x54')](_0x48f4a7)){_0x162248=!![];return _0x7e401b[_0x72d1('0x55')](_0x48f4a7,_0x16e9e7,config[_0x72d1('0x56')][_0x72d1('0x57')])[_0x72d1('0x23')](function(){return _0x140f0b;});}return _0x140f0b;}})[_0x72d1('0x23')](function(_0x384f0a){if(_0x384f0a){var _0x3a2dfe=path[_0x72d1('0x51')](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x384f0a[_0x72d1('0x4c')]);if(!fs[_0x72d1('0x54')](_0x3a2dfe)){throw new db[(_0x72d1('0x59'))][(_0x72d1('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x384f0a[_0x72d1('0x5b')]){return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,_0x384f0a[_0x72d1('0x5b')]+path[_0x72d1('0x5d')](_0x3a2dfe),function(){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}else{return _0x5f2bba[_0x72d1('0x5c')](_0x3a2dfe,function(_0x4e2d85){if(_0x162248){fs[_0x72d1('0x5e')](_0x3a2dfe);}});}}})[_0x72d1('0x44')](function(_0xb05cd9){if(_0xb05cd9['message']==='ScreenRecording\x20not\x20found'){_0x5f2bba[_0x72d1('0x1a')](0x194)['send'](_0x72d1('0x5f'));}else{return handleError(_0x5f2bba,null);}});};exports[_0x72d1('0x60')]=function(_0x201810,_0x41525c){return db[_0x72d1('0x3f')][_0x72d1('0x46')]({'where':{'id':_0x201810[_0x72d1('0x4d')]['id']}})[_0x72d1('0x23')](function(_0x28e42b){if(_['isNil'](_0x28e42b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x28e42b;})[_0x72d1('0x23')](function(_0x1d44f0){var _0x1bd80b=path['join'](config[_0x72d1('0x52')],_0x72d1('0x58'),_0x1d44f0['value']);logger[_0x72d1('0x61')](_0x72d1('0x62'),_0x1bd80b);if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs[_0x72d1('0x54')](_0x1bd80b)){logger[_0x72d1('0x61')](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}_0x1bd80b=_0x1bd80b+_0x72d1('0x67');if(!_[_0x72d1('0x63')](_0x1d44f0[_0x72d1('0x4c')])&&fs['existsSync'](_0x1bd80b)){logger['info'](_0x72d1('0x64')+_0x1bd80b+_0x72d1('0x65'));fs[_0x72d1('0x66')](_0x1bd80b);}return _0x1d44f0;})[_0x72d1('0x23')](function(_0x2ae8c9){if(!_0x2ae8c9)throw new InternalError();return _0x2ae8c9[_0x72d1('0x60')]();})[_0x72d1('0x23')](function(){_0x41525c[_0x72d1('0x1a')](0xcc)['end']();})[_0x72d1('0x44')](handleError(_0x41525c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b73d693..0d4e155 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 _0x5aef=['ScreenRecording','screen_recordings','interactionid','util','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define'];(function(_0x5d43f5,_0x8c9030){var _0x453144=function(_0x3d6f93){while(--_0x3d6f93){_0x5d43f5['push'](_0x5d43f5['shift']());}};_0x453144(++_0x8c9030);}(_0x5aef,0x1d7));var _0xf5ae=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x5aef[_0x441f7a];return _0x4821da;};'use strict';var _=require('lodash');var util=require(_0xf5ae('0x0'));var logger=require('../../config/logger')(_0xf5ae('0x1'));var moment=require(_0xf5ae('0x2'));var BPromise=require(_0xf5ae('0x3'));var rp=require(_0xf5ae('0x4'));var fs=require('fs');var path=require(_0xf5ae('0x5'));var rimraf=require(_0xf5ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5ae('0x7'));module[_0xf5ae('0x8')]=function(_0x209dde,_0x43d8d9){return _0x209dde[_0xf5ae('0x9')](_0xf5ae('0xa'),attributes,{'tableName':_0xf5ae('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xf5ae('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ac=['screen_recordings','interactionid','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x48fa03,_0x279271){var _0x14742d=function(_0x2d585){while(--_0x2d585){_0x48fa03['push'](_0x48fa03['shift']());}};_0x14742d(++_0x279271);}(_0xc4ac,0x1a2));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc4a('0x0'));var util=require('util');var logger=require(_0xcc4a('0x1'))(_0xcc4a('0x2'));var moment=require('moment');var BPromise=require(_0xcc4a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc4a('0x4'));var rimraf=require(_0xcc4a('0x5'));var config=require(_0xcc4a('0x6'));var attributes=require(_0xcc4a('0x7'));module[_0xcc4a('0x8')]=function(_0x4eb3c8,_0x1ae799){return _0x4eb3c8[_0xcc4a('0x9')](_0xcc4a('0xa'),attributes,{'tableName':_0xcc4a('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcc4a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 73a2a4b..60bac54 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 _0x69bf=['http','request','info','request\x20sent','debug','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x353471,_0x19f123){var _0x584806=function(_0x3c8352){while(--_0x3c8352){_0x353471['push'](_0x353471['shift']());}};_0x584806(++_0x19f123);}(_0x69bf,0x76));var _0xf69b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x69bf[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf69b('0x0'));var moment=require('moment');var BPromise=require(_0xf69b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf69b('0x2'));var db=require(_0xf69b('0x3'))['db'];var utils=require(_0xf69b('0x4'));var logger=require('../../config/logger')(_0xf69b('0x5'));var config=require('../../config/environment');var jayson=require(_0xf69b('0x6'));var client=jayson[_0xf69b('0x7')][_0xf69b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x262b8e,_0x5d9096,_0x33b4df){return new BPromise(function(_0x47a023,_0x31e5ad){return client[_0xf69b('0x9')](_0x262b8e,_0x33b4df)['then'](function(_0x3a5409){logger[_0xf69b('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x5d9096,_0xf69b('0xb'));logger[_0xf69b('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x5d9096,'request\x20sent',JSON[_0xf69b('0xd')](_0x3a5409));if(_0x3a5409[_0xf69b('0xe')]){if(_0x3a5409[_0xf69b('0xe')]['code']===0x1f4){logger['error'](_0xf69b('0xf'),_0x5d9096,_0x3a5409['error'][_0xf69b('0x10')]);return _0x31e5ad(_0x3a5409[_0xf69b('0xe')]['message']);}logger[_0xf69b('0xe')](_0xf69b('0xf'),_0x5d9096,_0x3a5409['error']['message']);return _0x47a023(_0x3a5409['error'][_0xf69b('0x10')]);}else{logger[_0xf69b('0xa')](_0xf69b('0xf'),_0x5d9096,_0xf69b('0xb'));_0x47a023(_0x3a5409[_0xf69b('0x11')][_0xf69b('0x10')]);}})['catch'](function(_0x1bb63a){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5d9096,_0x1bb63a);_0x31e5ad(_0x1bb63a);});});} \ No newline at end of file +var _0x9769=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x9769,0x178));var _0x9976=function(_0x329823,_0x3a7e22){_0x329823=_0x329823-0x0;var _0x592d5a=_0x9769[_0x329823];return _0x592d5a;};'use strict';var _=require(_0x9976('0x0'));var util=require(_0x9976('0x1'));var moment=require(_0x9976('0x2'));var BPromise=require(_0x9976('0x3'));var rs=require(_0x9976('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9976('0x5'));var logger=require(_0x9976('0x6'))(_0x9976('0x7'));var config=require(_0x9976('0x8'));var jayson=require(_0x9976('0x9'));var client=jayson[_0x9976('0xa')][_0x9976('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401833,_0x599dcf,_0x10b12e){return new BPromise(function(_0x1b4606,_0x2cc536){return client[_0x9976('0xc')](_0x401833,_0x10b12e)[_0x9976('0xd')](function(_0x49d4b4){logger['info'](_0x9976('0xe'),_0x599dcf,'request\x20sent');logger[_0x9976('0xf')](_0x9976('0x10'),_0x599dcf,_0x9976('0x11'),JSON[_0x9976('0x12')](_0x49d4b4));if(_0x49d4b4[_0x9976('0x13')]){if(_0x49d4b4[_0x9976('0x13')][_0x9976('0x14')]===0x1f4){logger['error'](_0x9976('0xe'),_0x599dcf,_0x49d4b4[_0x9976('0x13')]['message']);return _0x2cc536(_0x49d4b4[_0x9976('0x13')][_0x9976('0x15')]);}logger[_0x9976('0x13')](_0x9976('0xe'),_0x599dcf,_0x49d4b4[_0x9976('0x13')]['message']);return _0x1b4606(_0x49d4b4[_0x9976('0x13')][_0x9976('0x15')]);}else{logger[_0x9976('0x16')](_0x9976('0xe'),_0x599dcf,_0x9976('0x11'));_0x1b4606(_0x49d4b4[_0x9976('0x17')]['message']);}})[_0x9976('0x18')](function(_0x25b34c){logger[_0x9976('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x599dcf,_0x25b34c);_0x2cc536(_0x25b34c);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 10934f2..52c93a7 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 _0x352c=['logologin','format','preferred','favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','join','server/files/images/logos/','%s%s','extname','originalname','post','/:id/logo','single','file','root'];(function(_0x1d03cb,_0x57d8b){var _0x1aae10=function(_0x10bef1){while(--_0x10bef1){_0x1d03cb['push'](_0x1d03cb['shift']());}};_0x1aae10(++_0x57d8b);}(_0x352c,0x10a));var _0xc352=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x352c[_0x12ddb2];return _0x10b6dd;};'use strict';var multer=require(_0xc352('0x0'));var util=require(_0xc352('0x1'));var path=require(_0xc352('0x2'));var timeout=require(_0xc352('0x3'));var express=require(_0xc352('0x4'));var router=express[_0xc352('0x5')]();var fs_extra=require(_0xc352('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc352('0x7'));var controller=require(_0xc352('0x8'));router[_0xc352('0x9')]('/',auth[_0xc352('0xa')](),controller[_0xc352('0xb')]);router[_0xc352('0x9')]('/now',controller['getDate']);router['get'](_0xc352('0xc'),controller[_0xc352('0xd')]);router[_0xc352('0x9')]('/:id/logo',controller['getLogo']);router[_0xc352('0x9')](_0xc352('0xe'),controller[_0xc352('0xf')]);router[_0xc352('0x9')]('/:id/gdpr',controller[_0xc352('0x10')]);router[_0xc352('0x9')](_0xc352('0x11'),controller[_0xc352('0x12')]);router[_0xc352('0x9')](_0xc352('0x13'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19ee3e,_0x148eca,_0x3d3bc2){_0x3d3bc2(null,path[_0xc352('0x14')](config['root'],_0xc352('0x15')));},'filename':function(_0x272d70,_0x2abd7b,_0x17ef4e){_0x17ef4e(null,util['format'](_0xc352('0x16'),'logo',path[_0xc352('0x17')](_0x2abd7b[_0xc352('0x18')])));}})});router[_0xc352('0x19')](_0xc352('0x1a'),upload[_0xc352('0x1b')](_0xc352('0x1c')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x437d9d,_0x48bdfc,_0x57f933){_0x57f933(null,path['join'](config[_0xc352('0x1d')],'server/files/images/logos/'));},'filename':function(_0x564041,_0x43b247,_0x5702a7){_0x5702a7(null,util['format'](_0xc352('0x16'),_0xc352('0x1e'),path[_0xc352('0x17')](_0x43b247[_0xc352('0x18')])));}})});router[_0xc352('0x19')](_0xc352('0xe'),upload[_0xc352('0x1b')](_0xc352('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4de184,_0xed3007,_0x1105db){_0x1105db(null,path['join'](config[_0xc352('0x1d')],_0xc352('0x15')));},'filename':function(_0x397e21,_0x10b958,_0x3b7573){_0x3b7573(null,util[_0xc352('0x1f')](_0xc352('0x16'),_0xc352('0x20'),path[_0xc352('0x17')](_0x10b958[_0xc352('0x18')])));}})});router[_0xc352('0x19')](_0xc352('0x11'),upload[_0xc352('0x1b')](_0xc352('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x530516,_0x2ddf60,_0x2b5a6b){_0x2b5a6b(null,path[_0xc352('0x14')](config[_0xc352('0x1d')],_0xc352('0x15')));},'filename':function(_0x4f5576,_0xc1a005,_0x2aa9e2){_0x2aa9e2(null,util['format'](_0xc352('0x16'),_0xc352('0x21'),path[_0xc352('0x17')](_0xc1a005[_0xc352('0x18')])));}})});router[_0xc352('0x19')](_0xc352('0x13'),upload[_0xc352('0x1b')](_0xc352('0x1c')),controller[_0xc352('0x22')]);router[_0xc352('0x23')](_0xc352('0xc'),auth[_0xc352('0xa')](),controller[_0xc352('0x24')]);module['exports']=router; \ No newline at end of file +var _0xd38b=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','server/files/images/logos/','%s%s','logo','extname','single','addLogo','root','logologin','post','file','addLogoLogin','format','originalname','favicon','addFavicon','put','update'];(function(_0x48348e,_0x3c50c9){var _0x10b100=function(_0x43a84d){while(--_0x43a84d){_0x48348e['push'](_0x48348e['shift']());}};_0x10b100(++_0x3c50c9);}(_0xd38b,0x17b));var _0xbd38=function(_0x310ee0,_0x1c5d46){_0x310ee0=_0x310ee0-0x0;var _0x2aae43=_0xd38b[_0x310ee0];return _0x2aae43;};'use strict';var multer=require(_0xbd38('0x0'));var util=require(_0xbd38('0x1'));var path=require(_0xbd38('0x2'));var timeout=require(_0xbd38('0x3'));var express=require('express');var router=express[_0xbd38('0x4')]();var fs_extra=require(_0xbd38('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd38('0x6'));var controller=require(_0xbd38('0x7'));router[_0xbd38('0x8')]('/',auth[_0xbd38('0x9')](),controller[_0xbd38('0xa')]);router[_0xbd38('0x8')](_0xbd38('0xb'),controller[_0xbd38('0xc')]);router['get'](_0xbd38('0xd'),controller[_0xbd38('0xe')]);router[_0xbd38('0x8')]('/:id/logo',controller['getLogo']);router[_0xbd38('0x8')](_0xbd38('0xf'),controller[_0xbd38('0x10')]);router[_0xbd38('0x8')](_0xbd38('0x11'),controller[_0xbd38('0x12')]);router[_0xbd38('0x8')](_0xbd38('0x13'),controller[_0xbd38('0x14')]);router[_0xbd38('0x8')](_0xbd38('0x15'),controller['getFavicon']);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x402576,_0x19425b,_0x170123){_0x170123(null,path[_0xbd38('0x17')](config['root'],_0xbd38('0x18')));},'filename':function(_0x235132,_0x2bad31,_0x38c758){_0x38c758(null,util['format'](_0xbd38('0x19'),_0xbd38('0x1a'),path[_0xbd38('0x1b')](_0x2bad31['originalname'])));}})});router['post']('/:id/logo',upload[_0xbd38('0x1c')]('file'),controller[_0xbd38('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x153604,_0x24156c,_0x53952c){_0x53952c(null,path['join'](config[_0xbd38('0x1e')],'server/files/images/logos/'));},'filename':function(_0x2341b4,_0x2fa358,_0x52c872){_0x52c872(null,util['format'](_0xbd38('0x19'),_0xbd38('0x1f'),path[_0xbd38('0x1b')](_0x2fa358['originalname'])));}})});router[_0xbd38('0x20')](_0xbd38('0xf'),upload[_0xbd38('0x1c')](_0xbd38('0x21')),controller[_0xbd38('0x22')]);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x48afea,_0x4ca80e,_0x2d39cc){_0x2d39cc(null,path['join'](config['root'],_0xbd38('0x18')));},'filename':function(_0x506de2,_0x5d453d,_0x928c9c){_0x928c9c(null,util[_0xbd38('0x23')](_0xbd38('0x19'),'preferred',path[_0xbd38('0x1b')](_0x5d453d[_0xbd38('0x24')])));}})});router['post'](_0xbd38('0x13'),upload[_0xbd38('0x1c')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xbd38('0x16')]({'destination':function(_0x55569d,_0x56d396,_0x4fd557){_0x4fd557(null,path[_0xbd38('0x17')](config[_0xbd38('0x1e')],_0xbd38('0x18')));},'filename':function(_0x49f9ba,_0x2de3a5,_0x39d7fb){_0x39d7fb(null,util[_0xbd38('0x23')](_0xbd38('0x19'),_0xbd38('0x25'),path[_0xbd38('0x1b')](_0x2de3a5['originalname'])));}})});router['post'](_0xbd38('0x15'),upload[_0xbd38('0x1c')](_0xbd38('0x21')),controller[_0xbd38('0x26')]);router[_0xbd38('0x27')](_0xbd38('0xd'),auth['isAuthenticated'](),controller[_0xbd38('0x28')]);module[_0xbd38('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 1c89592..f3ea09c 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 _0x8c7a=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','min_internal','min_mailbox','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x24d2a6,_0x5d7a02){_0x24d2a6=_0x24d2a6-0x0;var _0x544b31=_0x8c7a[_0x24d2a6];return _0x544b31;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xa8c7('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xa8c7('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa8c7('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xa8c7('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xa8c7('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xa8c7('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xa8c7('0x4')]},'turnusername':{'type':Sequelize[_0xa8c7('0x4')]},'turnpassword':{'type':Sequelize[_0xa8c7('0x4')]},'pageTitle':{'type':Sequelize[_0xa8c7('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa8c7('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xa8c7('0x4')],'defaultValue':_0xa8c7('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xa8c7('0x4')],'defaultValue':_0xa8c7('0x7')},'chatTimeout':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa8c7('0x4')]},'defaultPreferred':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa8c7('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa8c7('0x4')]},'defaultFavicon':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa8c7('0x3')]},'transcribeRegion':{'type':Sequelize[_0xa8c7('0x4')]},'sentiment':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xa8c7('0x4')]},'language':{'type':Sequelize[_0xa8c7('0x4')]},'bucket':{'type':Sequelize[_0xa8c7('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xa8c7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa8c7('0x3')](0x2)[_0xa8c7('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa8c7('0x3')](0x2)[_0xa8c7('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa8c7('0x3')](0x2)[_0xa8c7('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa8c7('0x3')],'defaultValue':0x14}}; \ No newline at end of file +var _0x3166=['min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3166,0xbb));var _0x6316=function(_0x51ae4c,_0x4a2be1){_0x51ae4c=_0x51ae4c-0x0;var _0x88a396=_0x3166[_0x51ae4c];return _0x88a396;};'use strict';var Sequelize=require('sequelize');module[_0x6316('0x0')]={'min_internal':{'type':Sequelize[_0x6316('0x1')](0xb),'unique':_0x6316('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x6316('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6316('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x6316('0x4')},'logo':{'type':Sequelize[_0x6316('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6316('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6316('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6316('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x6316('0x5')]},'turnpassword':{'type':Sequelize[_0x6316('0x5')]},'pageTitle':{'type':Sequelize[_0x6316('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6316('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6316('0x5')],'defaultValue':_0x6316('0x7')},'enableEmailPreview':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6316('0x5')],'defaultValue':_0x6316('0x8')},'chatTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6316('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6316('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6316('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6316('0x1')]},'sentimentRegion':{'type':Sequelize[_0x6316('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6316('0x1')](0x2)[_0x6316('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6316('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x6316('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x6316('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6316('0x1')],'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 3c4a1fd..f1aaee9 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 _0x76bb=['sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','undefined','limit','count','Content-Range','json','apply','reject','update','then','status','stack','name','send','index','map','Setting','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','length','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','toLower','root','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','favicon','defaultLogo','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','getLicense','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x76bb,0x16a));var _0xb76b=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x76bb[_0x3b0c9d];return _0xcfc8d7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb76b('0x0'));var zipdir=require(_0xb76b('0x1'));var jsonpatch=require(_0xb76b('0x2'));var rp=require(_0xb76b('0x3'));var moment=require('moment');var BPromise=require(_0xb76b('0x4'));var Mustache=require(_0xb76b('0x5'));var util=require('util');var path=require(_0xb76b('0x6'));var sox=require(_0xb76b('0x7'));var csv=require('to-csv');var ejs=require(_0xb76b('0x8'));var fs=require('fs');var fs_extra=require(_0xb76b('0x9'));var _=require(_0xb76b('0xa'));var squel=require(_0xb76b('0xb'));var crypto=require(_0xb76b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb76b('0xd'));var toCsv=require(_0xb76b('0xe'));var querystring=require(_0xb76b('0xf'));var Papa=require(_0xb76b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb76b('0x11'));var as=require(_0xb76b('0x12'));var hardwareService=require(_0xb76b('0x13'));var logger=require(_0xb76b('0x14'))(_0xb76b('0x15'));var utils=require(_0xb76b('0x16'));var config=require(_0xb76b('0x17'));var licenseUtil=require(_0xb76b('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb76b('0x19'));var client=jayson['client'][_0xb76b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3f8bc7,_0x29d479,_0x5c2db5,_0x4e715c){return new BPromise(function(_0x10a6aa,_0x16d909){var _0x58ce24=_0x4e715c||client;return _0x58ce24[_0xb76b('0x1b')](_0x3f8bc7,_0x5c2db5)['then'](function(_0x2b4590){logger[_0xb76b('0x1c')](_0xb76b('0x1d'),_0x29d479,_0xb76b('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x29d479,_0xb76b('0x1e'),JSON[_0xb76b('0x1f')](_0x2b4590));if(_0x2b4590['error']){if(_0x2b4590[_0xb76b('0x20')][_0xb76b('0x21')]===0x1f4){logger[_0xb76b('0x20')](_0xb76b('0x1d'),_0x29d479,_0x2b4590[_0xb76b('0x20')][_0xb76b('0x22')]);return _0x16d909(_0x2b4590[_0xb76b('0x20')]['message']);}logger['error'](_0xb76b('0x1d'),_0x29d479,_0x2b4590[_0xb76b('0x20')][_0xb76b('0x22')]);return _0x10a6aa(_0x2b4590[_0xb76b('0x20')][_0xb76b('0x22')]);}else{logger['info'](_0xb76b('0x1d'),_0x29d479,'request\x20sent');_0x10a6aa(_0x2b4590[_0xb76b('0x23')][_0xb76b('0x22')]);}})[_0xb76b('0x24')](function(_0x3e299a){logger['error'](_0xb76b('0x1d'),_0x29d479,_0x3e299a);_0x16d909(_0x3e299a);});});}function respondWithStatusCode(_0x2b4f3f,_0x75cd9c){_0x75cd9c=_0x75cd9c||0xcc;return function(_0x1c8a54){if(_0x1c8a54){return _0x2b4f3f[_0xb76b('0x25')](_0x75cd9c);}return _0x2b4f3f['status'](_0x75cd9c)[_0xb76b('0x26')]();};}function respondWithResult(_0x44ec61,_0x56704b){_0x56704b=_0x56704b||0xc8;return function(_0x2569dc){if(_0x2569dc){return _0x44ec61['status'](_0x56704b)['json'](_0x2569dc);}};}function respondWithFilteredResult(_0x1dbeb5,_0x2d872b){return function(_0xb90480){if(_0xb90480){var _0x23df6d=typeof _0x2d872b['offset']===_0xb76b('0x27')&&typeof _0x2d872b[_0xb76b('0x28')]===_0xb76b('0x27');var _0x3badb4=_0xb90480[_0xb76b('0x29')];var _0x1cf72b=_0x23df6d?0x0:_0x2d872b['offset'];var _0x2c4fda=_0x23df6d?_0xb90480['count']:_0x2d872b['offset']+_0x2d872b[_0xb76b('0x28')];var _0x3b83e2;if(_0x2c4fda>=_0x3badb4){_0x2c4fda=_0x3badb4;_0x3b83e2=0xc8;}else{_0x3b83e2=0xce;}_0x1dbeb5['status'](_0x3b83e2);return _0x1dbeb5['set'](_0xb76b('0x2a'),_0x1cf72b+'-'+_0x2c4fda+'/'+_0x3badb4)[_0xb76b('0x2b')](_0xb90480);}return null;};}function patchUpdates(_0x4e94af){return function(_0x2a60db){try{jsonpatch[_0xb76b('0x2c')](_0x2a60db,_0x4e94af,!![]);}catch(_0x248dc7){return BPromise[_0xb76b('0x2d')](_0x248dc7);}return _0x2a60db['save']();};}function saveUpdates(_0x3425bd,_0x36e586){return function(_0x2a3c00){if(_0x2a3c00){return _0x2a3c00[_0xb76b('0x2e')](_0x3425bd)['then'](function(_0x5aec6b){return _0x5aec6b;});}return null;};}function removeEntity(_0xad0b72,_0x4db2b1){return function(_0x44d2ee){if(_0x44d2ee){return _0x44d2ee['destroy']()[_0xb76b('0x2f')](function(){_0xad0b72[_0xb76b('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x209f9e,_0x3854f1){return function(_0x631104){if(!_0x631104){_0x209f9e[_0xb76b('0x25')](0x194);}return _0x631104;};}function handleError(_0x409420,_0x22447f){_0x22447f=_0x22447f||0x1f4;return function(_0x36e797){logger[_0xb76b('0x20')](_0x36e797[_0xb76b('0x31')]);if(_0x36e797[_0xb76b('0x32')]){delete _0x36e797[_0xb76b('0x32')];}_0x409420['status'](_0x22447f)[_0xb76b('0x33')](_0x36e797);};}exports[_0xb76b('0x34')]=function(_0x2e4610,_0x434ecd){var _0x3e6e76={},_0x193cbf={},_0x214887={'count':0x0,'rows':[]};var _0x58860e=_[_0xb76b('0x35')](db[_0xb76b('0x36')][_0xb76b('0x37')],function(_0x88cfbb){return{'name':_0x88cfbb['fieldName'],'type':_0x88cfbb['type'][_0xb76b('0x38')]};});_0x193cbf[_0xb76b('0x39')]=_[_0xb76b('0x35')](_0x58860e,_0xb76b('0x32'));_0x193cbf[_0xb76b('0x3a')]=_[_0xb76b('0x3b')](_0x2e4610[_0xb76b('0x3a')]);_0x193cbf[_0xb76b('0x3c')]=_[_0xb76b('0x3d')](_0x193cbf[_0xb76b('0x39')],_0x193cbf[_0xb76b('0x3a')]);_0x3e6e76[_0xb76b('0x3e')]=_[_0xb76b('0x3d')](_0x193cbf['model'],qs[_0xb76b('0x3f')](_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x3f')]));_0x3e6e76['attributes']=_0x3e6e76[_0xb76b('0x3e')]['length']?_0x3e6e76[_0xb76b('0x3e')]:_0x193cbf['model'];if(!_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x40')](_0xb76b('0x41'))){_0x3e6e76[_0xb76b('0x28')]=qs['limit'](_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x28')]);_0x3e6e76[_0xb76b('0x42')]=qs[_0xb76b('0x42')](_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x42')]);}_0x3e6e76[_0xb76b('0x43')]=qs['sort'](_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x44')]);_0x3e6e76['where']=qs['filters'](_[_0xb76b('0x45')](_0x2e4610[_0xb76b('0x3a')],_0x193cbf[_0xb76b('0x3c')]),_0x58860e);if(_0x2e4610[_0xb76b('0x3a')]['filter']){_0x3e6e76[_0xb76b('0x46')]=_[_0xb76b('0x47')](_0x3e6e76[_0xb76b('0x46')],{'$or':_[_0xb76b('0x35')](_0x58860e,function(_0x10d6b0){if(_0x10d6b0['type']!==_0xb76b('0x48')){var _0x470559={};_0x470559[_0x10d6b0[_0xb76b('0x32')]]={'$like':'%'+_0x2e4610['query'][_0xb76b('0x49')]+'%'};return _0x470559;}})});}_0x3e6e76=_[_0xb76b('0x47')]({},_0x3e6e76,_0x2e4610[_0xb76b('0x4a')]);var _0x6cc793={'where':_0x3e6e76[_0xb76b('0x46')]};return db[_0xb76b('0x36')]['count'](_0x6cc793)[_0xb76b('0x2f')](function(_0x5eed9f){_0x214887[_0xb76b('0x29')]=_0x5eed9f;if(_0x2e4610[_0xb76b('0x3a')][_0xb76b('0x4b')]){_0x3e6e76['include']=[{'all':!![]}];}return db[_0xb76b('0x36')][_0xb76b('0x4c')](_0x3e6e76);})['then'](function(_0x342387){_0x214887[_0xb76b('0x4d')]=_0x342387;return _0x214887;})[_0xb76b('0x2f')](respondWithFilteredResult(_0x434ecd,_0x3e6e76))[_0xb76b('0x24')](handleError(_0x434ecd,null));};exports[_0xb76b('0x4e')]=function(_0x3c6e95,_0x19a953){var _0xb28a18={'raw':![],'where':{'id':_0x3c6e95[_0xb76b('0x4f')]['id']}},_0x192555={};_0x192555[_0xb76b('0x39')]=_[_0xb76b('0x3b')](db[_0xb76b('0x36')]['rawAttributes']);_0x192555[_0xb76b('0x3a')]=_[_0xb76b('0x3b')](_0x3c6e95[_0xb76b('0x3a')]);_0x192555[_0xb76b('0x3c')]=_['intersection'](_0x192555[_0xb76b('0x39')],_0x192555[_0xb76b('0x3a')]);_0xb28a18['attributes']=_[_0xb76b('0x3d')](_0x192555[_0xb76b('0x39')],qs[_0xb76b('0x3f')](_0x3c6e95['query']['fields']));_0xb28a18[_0xb76b('0x3e')]=_0xb28a18[_0xb76b('0x3e')][_0xb76b('0x50')]?_0xb28a18[_0xb76b('0x3e')]:_0x192555[_0xb76b('0x39')];if(_0x3c6e95[_0xb76b('0x3a')][_0xb76b('0x4b')]){_0xb28a18['include']=[{'all':!![]}];}_0xb28a18=_[_0xb76b('0x47')]({},_0xb28a18,_0x3c6e95[_0xb76b('0x4a')]);return db[_0xb76b('0x36')][_0xb76b('0x51')](_0xb28a18)[_0xb76b('0x2f')](handleEntityNotFound(_0x19a953,null))[_0xb76b('0x2f')](respondWithResult(_0x19a953,null))['catch'](handleError(_0x19a953,null));};exports[_0xb76b('0x2e')]=function(_0xb2827b,_0x34232b){if(_0xb2827b['body']['id']){delete _0xb2827b[_0xb76b('0x52')]['id'];}return db[_0xb76b('0x36')][_0xb76b('0x51')]({'where':{'id':_0xb2827b[_0xb76b('0x4f')]['id']}})[_0xb76b('0x2f')](handleEntityNotFound(_0x34232b,null))[_0xb76b('0x2f')](saveUpdates(_0xb2827b[_0xb76b('0x52')],null))[_0xb76b('0x2f')](respondWithResult(_0x34232b,null))[_0xb76b('0x24')](handleError(_0x34232b,null));};exports[_0xb76b('0x53')]=function(_0x30ac4d,_0x13fb41,_0x3f68d9){if(_0x30ac4d[_0xb76b('0x54')]&&_0x30ac4d[_0xb76b('0x54')][_0xb76b('0x55')]){_0x30ac4d[_0xb76b('0x52')][_0xb76b('0x56')]=_0x30ac4d[_0xb76b('0x54')]['filename'];}return db[_0xb76b('0x36')]['find']({'where':{'id':_0x30ac4d[_0xb76b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13fb41,null))[_0xb76b('0x2f')](saveUpdates(_0x30ac4d[_0xb76b('0x52')],null))[_0xb76b('0x2f')](respondWithResult(_0x13fb41,null))[_0xb76b('0x24')](handleError(_0x13fb41,null));};exports[_0xb76b('0x57')]=function(_0x3d23f1,_0x1f76cf,_0x5eb1bf){if(_0x3d23f1[_0xb76b('0x54')]&&_0x3d23f1['file'][_0xb76b('0x55')]){_0x3d23f1[_0xb76b('0x52')][_0xb76b('0x58')]=_0x3d23f1[_0xb76b('0x54')][_0xb76b('0x55')];}return db['Setting'][_0xb76b('0x51')]({'where':{'id':_0x3d23f1[_0xb76b('0x4f')]['id']}})[_0xb76b('0x2f')](handleEntityNotFound(_0x1f76cf,null))[_0xb76b('0x2f')](saveUpdates(_0x3d23f1[_0xb76b('0x52')],null))[_0xb76b('0x2f')](respondWithResult(_0x1f76cf,null))[_0xb76b('0x24')](handleError(_0x1f76cf,null));};var utilLicense=require(_0xb76b('0x18'));exports['getLogo']=function(_0x1ed970,_0x38e85c,_0x23f00c){var _0x34d954=_0xb76b('0x59');var _0x45b7bb={'custom':![]};return utilLicense['getLicense']()[_0xb76b('0x2f')](function(_0x1bee4f){if(_0x1bee4f){_0x45b7bb=_0x1bee4f;}return db[_0xb76b('0x36')][_0xb76b('0x51')]({'where':{'id':_0x1ed970[_0xb76b('0x4f')]['id']},'attributes':[_0xb76b('0x56'),_0xb76b('0x58'),_0xb76b('0x5a'),'favicon','defaultLogo',_0xb76b('0x5b'),_0xb76b('0x5c'),_0xb76b('0x5d')],'raw':!![]});})[_0xb76b('0x2f')](handleEntityNotFound(_0x38e85c,null))[_0xb76b('0x2f')](function(_0x37cac8){if(_0x37cac8){var _0x3002f8=_0x37cac8[_0xb76b('0x56')]&&fs[_0xb76b('0x5e')](path['join'](config['root'],_0x34d954,_[_0xb76b('0x5f')](_0x37cac8[_0xb76b('0x56')])))?path['join'](config[_0xb76b('0x60')],_0x34d954,_['toLower'](_0x37cac8[_0xb76b('0x56')])):path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x34d954,_['toLower'](_0xb76b('0x62')));var _0xf925a4=_0xb76b('0x63')+_[_0xb76b('0x64')]('logo');if(_0x37cac8[_0xf925a4]||!_0x45b7bb[_0xb76b('0x65')]){_0x3002f8=path['join'](config[_0xb76b('0x60')],_0x34d954,_[_0xb76b('0x5f')](_0xb76b('0x62')));}if(!fs[_0xb76b('0x5e')](_0x3002f8)){throw new db[(_0xb76b('0x66'))][(_0xb76b('0x67'))](_[_0xb76b('0x64')](_0xb76b('0x56'))+'\x20not\x20found');}return _0x38e85c[_0xb76b('0x68')](_0x3002f8);}})[_0xb76b('0x24')](handleError(_0x38e85c,null));};var utilLicense=require(_0xb76b('0x18'));exports[_0xb76b('0x69')]=function(_0x2dc879,_0x301104,_0x1fe5f5){var _0x41a023=_0xb76b('0x59');var _0x26acd1={'custom':![]};return utilLicense['getLicense']()[_0xb76b('0x2f')](function(_0xa61dfb){if(_0xa61dfb){_0x26acd1=_0xa61dfb;}return db[_0xb76b('0x36')][_0xb76b('0x51')]({'where':{'id':_0x2dc879[_0xb76b('0x4f')]['id']},'attributes':[_0xb76b('0x56'),_0xb76b('0x58'),_0xb76b('0x5a'),_0xb76b('0x6a'),_0xb76b('0x6b'),_0xb76b('0x5b'),_0xb76b('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x301104,null))[_0xb76b('0x2f')](function(_0x1ef12f){if(_0x1ef12f){var _0x7fa7c3=_0x1ef12f['loginLogo']&&fs['existsSync'](path['join'](config['root'],_0x41a023,_[_0xb76b('0x5f')](_0x1ef12f[_0xb76b('0x58')])))?path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x41a023,_['toLower'](_0x1ef12f[_0xb76b('0x58')])):path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x41a023,_[_0xb76b('0x5f')](_0xb76b('0x6c')));var _0x4d50f2='default'+_[_0xb76b('0x64')](_0xb76b('0x58'));if(_0x1ef12f[_0x4d50f2]||!_0x26acd1['custom']){_0x7fa7c3=path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x41a023,_['toLower'](_0xb76b('0x6c')));}if(!fs[_0xb76b('0x5e')](_0x7fa7c3)){throw new db[(_0xb76b('0x66'))][(_0xb76b('0x67'))](_[_0xb76b('0x64')](_0xb76b('0x58'))+_0xb76b('0x6d'));}return _0x301104[_0xb76b('0x68')](_0x7fa7c3);}})[_0xb76b('0x24')](handleError(_0x301104,null));};exports[_0xb76b('0x6e')]=function(_0x4049fa,_0x204f2f){return db['Setting'][_0xb76b('0x51')]({'where':{'id':_0x4049fa['params']['id']},'attributes':['securePassword']})[_0xb76b('0x2f')](respondWithResult(_0x204f2f,null))[_0xb76b('0x24')](handleError(_0x204f2f,null));};exports[_0xb76b('0x6f')]=function(_0x316cd3,_0x28a8ee,_0x37e856){if(_0x316cd3[_0xb76b('0x54')]&&_0x316cd3[_0xb76b('0x54')][_0xb76b('0x55')]){_0x316cd3[_0xb76b('0x52')]['preferred']=_0x316cd3[_0xb76b('0x54')][_0xb76b('0x55')];}return db['Setting']['find']({'where':{'id':_0x316cd3[_0xb76b('0x4f')]['id']}})[_0xb76b('0x2f')](handleEntityNotFound(_0x28a8ee,null))['then'](saveUpdates(_0x316cd3[_0xb76b('0x52')],null))[_0xb76b('0x2f')](respondWithResult(_0x28a8ee,null))['catch'](handleError(_0x28a8ee,null));};var utilLicense=require(_0xb76b('0x18'));exports[_0xb76b('0x70')]=function(_0x4e1f86,_0x2ebf7e,_0xb5f22d){var _0x201e97='server/files/images/logos';var _0x1f5521={'custom':![]};return utilLicense['getLicense']()[_0xb76b('0x2f')](function(_0x5ef48d){if(_0x5ef48d){_0x1f5521=_0x5ef48d;}return db['Setting'][_0xb76b('0x51')]({'where':{'id':_0x4e1f86['params']['id']},'attributes':[_0xb76b('0x56'),'loginLogo',_0xb76b('0x5a'),_0xb76b('0x6a'),_0xb76b('0x6b'),_0xb76b('0x5b'),'defaultPreferred',_0xb76b('0x5d')],'raw':!![]});})[_0xb76b('0x2f')](handleEntityNotFound(_0x2ebf7e,null))[_0xb76b('0x2f')](function(_0x31045e){if(_0x31045e){var _0x1cca62=_0x31045e['preferred']&&fs[_0xb76b('0x5e')](path['join'](config[_0xb76b('0x60')],_0x201e97,_[_0xb76b('0x5f')](_0x31045e[_0xb76b('0x5a')])))?path['join'](config[_0xb76b('0x60')],_0x201e97,_[_0xb76b('0x5f')](_0x31045e[_0xb76b('0x5a')])):path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x201e97,_['toLower'](_0xb76b('0x71')));var _0x487802=_0xb76b('0x63')+_['upperFirst'](_0xb76b('0x5a'));if(_0x31045e[_0x487802]||!_0x1f5521[_0xb76b('0x65')]||!_0x1f5521['preferred']){_0x1cca62=path['join'](config['root'],_0x201e97,_[_0xb76b('0x5f')]('default_preferred.png'));}if(!fs[_0xb76b('0x5e')](_0x1cca62)){throw new db[(_0xb76b('0x66'))][(_0xb76b('0x67'))](_[_0xb76b('0x64')](_0xb76b('0x5a'))+_0xb76b('0x6d'));}return _0x2ebf7e[_0xb76b('0x68')](_0x1cca62);}})['catch'](handleError(_0x2ebf7e,null));};exports[_0xb76b('0x72')]=function(_0x1724b5,_0x4e0b08,_0x4d6aaa){if(_0x1724b5[_0xb76b('0x54')]&&_0x1724b5['file'][_0xb76b('0x55')]){_0x1724b5[_0xb76b('0x52')][_0xb76b('0x6a')]=_0x1724b5[_0xb76b('0x54')]['filename'];}return db[_0xb76b('0x36')][_0xb76b('0x51')]({'where':{'id':_0x1724b5[_0xb76b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4e0b08,null))['then'](saveUpdates(_0x1724b5[_0xb76b('0x52')],null))[_0xb76b('0x2f')](respondWithResult(_0x4e0b08,null))[_0xb76b('0x24')](handleError(_0x4e0b08,null));};var utilLicense=require(_0xb76b('0x18'));exports[_0xb76b('0x73')]=function(_0x56ec4d,_0x24b544,_0x298c60){var _0x5d4549=_0xb76b('0x59');var _0x4be6a4={'custom':![]};return utilLicense[_0xb76b('0x74')]()[_0xb76b('0x2f')](function(_0x425902){if(_0x425902){_0x4be6a4=_0x425902;}return db[_0xb76b('0x36')][_0xb76b('0x51')]({'where':{'id':_0x56ec4d[_0xb76b('0x4f')]['id']},'attributes':['logo','loginLogo','preferred',_0xb76b('0x6a'),_0xb76b('0x6b'),'defaultLoginLogo','defaultPreferred',_0xb76b('0x5d')],'raw':!![]});})[_0xb76b('0x2f')](handleEntityNotFound(_0x24b544,null))[_0xb76b('0x2f')](function(_0x5143e6){if(_0x5143e6){var _0x42843a=_0x5143e6['favicon']&&fs[_0xb76b('0x5e')](path['join'](config[_0xb76b('0x60')],_0x5d4549,_[_0xb76b('0x5f')](_0x5143e6[_0xb76b('0x6a')])))?path[_0xb76b('0x61')](config['root'],_0x5d4549,_[_0xb76b('0x5f')](_0x5143e6[_0xb76b('0x6a')])):path[_0xb76b('0x61')](config[_0xb76b('0x60')],_0x5d4549,_['toLower'](_0xb76b('0x75')));var _0x3cdd3a=_0xb76b('0x63')+_[_0xb76b('0x64')](_0xb76b('0x6a'));if(_0x5143e6[_0x3cdd3a]||!_0x4be6a4[_0xb76b('0x65')]){_0x42843a=path[_0xb76b('0x61')](config['root'],_0x5d4549,_[_0xb76b('0x5f')](_0xb76b('0x75')));}if(!fs['existsSync'](_0x42843a)){throw new db[(_0xb76b('0x66'))][(_0xb76b('0x67'))](_[_0xb76b('0x64')](_0xb76b('0x6a'))+_0xb76b('0x6d'));}return _0x24b544[_0xb76b('0x68')](_0x42843a);}})[_0xb76b('0x24')](handleError(_0x24b544,null));};exports[_0xb76b('0x76')]=function(_0x101fb3,_0x394bf0){var _0x35d729={'offset':moment()['utcOffset']()};_0x35d729[_0xb76b('0x77')]=moment()[_0xb76b('0x78')](_0x35d729[_0xb76b('0x42')])[_0xb76b('0x79')](_0xb76b('0x7a'));return _0x394bf0[_0xb76b('0x30')](0xc8)['send'](_0x35d729);}; \ No newline at end of file +var _0xe79a=['fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','undefined','offset','count','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','then','includeAll','include','show','params','find','body','addLogo','file','loginLogo','filename','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','join','root','default_logo.svg','default','upperFirst','custom','toLower','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','defaultPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe79a,0x70));var _0xae79=function(_0x5c7939,_0x22f61e){_0x5c7939=_0x5c7939-0x0;var _0x5bcfbc=_0xe79a[_0x5c7939];return _0x5bcfbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae79('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae79('0x1'));var moment=require(_0xae79('0x2'));var BPromise=require(_0xae79('0x3'));var Mustache=require(_0xae79('0x4'));var util=require('util');var path=require(_0xae79('0x5'));var sox=require(_0xae79('0x6'));var csv=require(_0xae79('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae79('0x8'));var _=require(_0xae79('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xae79('0xa'));var deskjs=require(_0xae79('0xb'));var toCsv=require('to-csv');var querystring=require(_0xae79('0xc'));var Papa=require('papaparse');var Redis=require(_0xae79('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae79('0xe'));var hardwareService=require(_0xae79('0xf'));var logger=require(_0xae79('0x10'))('api');var utils=require(_0xae79('0x11'));var config=require(_0xae79('0x12'));var licenseUtil=require(_0xae79('0x13'));var db=require(_0xae79('0x14'))['db'];var jayson=require(_0xae79('0x15'));var client=jayson[_0xae79('0x16')][_0xae79('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x12c634,_0x15ed35,_0x471fbf,_0x478937){return new BPromise(function(_0xdbae20,_0x456180){var _0x34fc00=_0x478937||client;return _0x34fc00[_0xae79('0x18')](_0x12c634,_0x471fbf)['then'](function(_0x4e4615){logger[_0xae79('0x19')](_0xae79('0x1a'),_0x15ed35,'request\x20sent');logger[_0xae79('0x1b')]('Setting,\x20%s,\x20%s,\x20%s',_0x15ed35,_0xae79('0x1c'),JSON[_0xae79('0x1d')](_0x4e4615));if(_0x4e4615[_0xae79('0x1e')]){if(_0x4e4615[_0xae79('0x1e')][_0xae79('0x1f')]===0x1f4){logger['error'](_0xae79('0x1a'),_0x15ed35,_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);return _0x456180(_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);}logger[_0xae79('0x1e')]('Setting,\x20%s,\x20%s',_0x15ed35,_0x4e4615[_0xae79('0x1e')][_0xae79('0x20')]);return _0xdbae20(_0x4e4615[_0xae79('0x1e')]['message']);}else{logger[_0xae79('0x19')](_0xae79('0x1a'),_0x15ed35,'request\x20sent');_0xdbae20(_0x4e4615[_0xae79('0x21')][_0xae79('0x20')]);}})[_0xae79('0x22')](function(_0x3f8409){logger['error'](_0xae79('0x1a'),_0x15ed35,_0x3f8409);_0x456180(_0x3f8409);});});}function respondWithStatusCode(_0x33f0c5,_0x49c55e){_0x49c55e=_0x49c55e||0xcc;return function(_0x5d4a57){if(_0x5d4a57){return _0x33f0c5[_0xae79('0x23')](_0x49c55e);}return _0x33f0c5[_0xae79('0x24')](_0x49c55e)['end']();};}function respondWithResult(_0x1e5101,_0x6a289b){_0x6a289b=_0x6a289b||0xc8;return function(_0x819255){if(_0x819255){return _0x1e5101[_0xae79('0x24')](_0x6a289b)['json'](_0x819255);}};}function respondWithFilteredResult(_0x1e8618,_0x504d65){return function(_0x3ee7ea){if(_0x3ee7ea){var _0x505b85=typeof _0x504d65['offset']===_0xae79('0x25')&&typeof _0x504d65['limit']===_0xae79('0x25');var _0x1d86be=_0x3ee7ea['count'];var _0x55731c=_0x505b85?0x0:_0x504d65[_0xae79('0x26')];var _0x5b43cd=_0x505b85?_0x3ee7ea[_0xae79('0x27')]:_0x504d65[_0xae79('0x26')]+_0x504d65[_0xae79('0x28')];var _0x3a3e68;if(_0x5b43cd>=_0x1d86be){_0x5b43cd=_0x1d86be;_0x3a3e68=0xc8;}else{_0x3a3e68=0xce;}_0x1e8618['status'](_0x3a3e68);return _0x1e8618['set'](_0xae79('0x29'),_0x55731c+'-'+_0x5b43cd+'/'+_0x1d86be)['json'](_0x3ee7ea);}return null;};}function patchUpdates(_0x4693be){return function(_0x34596b){try{jsonpatch[_0xae79('0x2a')](_0x34596b,_0x4693be,!![]);}catch(_0x271a78){return BPromise[_0xae79('0x2b')](_0x271a78);}return _0x34596b[_0xae79('0x2c')]();};}function saveUpdates(_0x49bd6c,_0xb91d40){return function(_0x34aacf){if(_0x34aacf){return _0x34aacf[_0xae79('0x2d')](_0x49bd6c)['then'](function(_0x1aa76a){return _0x1aa76a;});}return null;};}function removeEntity(_0x40b461,_0x44f0dd){return function(_0x13ee06){if(_0x13ee06){return _0x13ee06[_0xae79('0x2e')]()['then'](function(){_0x40b461[_0xae79('0x24')](0xcc)[_0xae79('0x2f')]();});}};}function handleEntityNotFound(_0x71fabd,_0x59a276){return function(_0x5bc86d){if(!_0x5bc86d){_0x71fabd[_0xae79('0x23')](0x194);}return _0x5bc86d;};}function handleError(_0x9b7026,_0x44c270){_0x44c270=_0x44c270||0x1f4;return function(_0x5a3ff8){logger[_0xae79('0x1e')](_0x5a3ff8[_0xae79('0x30')]);if(_0x5a3ff8['name']){delete _0x5a3ff8[_0xae79('0x31')];}_0x9b7026[_0xae79('0x24')](_0x44c270)[_0xae79('0x32')](_0x5a3ff8);};}exports['index']=function(_0x273396,_0x2b5e69){var _0x17c3a5={},_0x388c5f={},_0x3e4db2={'count':0x0,'rows':[]};var _0x5d4cc9=_[_0xae79('0x33')](db[_0xae79('0x34')][_0xae79('0x35')],function(_0x22b342){return{'name':_0x22b342['fieldName'],'type':_0x22b342[_0xae79('0x36')][_0xae79('0x37')]};});_0x388c5f[_0xae79('0x38')]=_['map'](_0x5d4cc9,_0xae79('0x31'));_0x388c5f[_0xae79('0x39')]=_[_0xae79('0x3a')](_0x273396['query']);_0x388c5f[_0xae79('0x3b')]=_[_0xae79('0x3c')](_0x388c5f['model'],_0x388c5f[_0xae79('0x39')]);_0x17c3a5[_0xae79('0x3d')]=_[_0xae79('0x3c')](_0x388c5f['model'],qs[_0xae79('0x3e')](_0x273396[_0xae79('0x39')][_0xae79('0x3e')]));_0x17c3a5[_0xae79('0x3d')]=_0x17c3a5[_0xae79('0x3d')][_0xae79('0x3f')]?_0x17c3a5[_0xae79('0x3d')]:_0x388c5f[_0xae79('0x38')];if(!_0x273396['query'][_0xae79('0x40')]('nolimit')){_0x17c3a5[_0xae79('0x28')]=qs[_0xae79('0x28')](_0x273396[_0xae79('0x39')][_0xae79('0x28')]);_0x17c3a5[_0xae79('0x26')]=qs[_0xae79('0x26')](_0x273396['query'][_0xae79('0x26')]);}_0x17c3a5[_0xae79('0x41')]=qs[_0xae79('0x42')](_0x273396['query'][_0xae79('0x42')]);_0x17c3a5['where']=qs[_0xae79('0x3b')](_[_0xae79('0x43')](_0x273396[_0xae79('0x39')],_0x388c5f[_0xae79('0x3b')]),_0x5d4cc9);if(_0x273396[_0xae79('0x39')]['filter']){_0x17c3a5[_0xae79('0x44')]=_[_0xae79('0x45')](_0x17c3a5[_0xae79('0x44')],{'$or':_[_0xae79('0x33')](_0x5d4cc9,function(_0x1f66db){if(_0x1f66db[_0xae79('0x36')]!=='VIRTUAL'){var _0x2615fd={};_0x2615fd[_0x1f66db['name']]={'$like':'%'+_0x273396[_0xae79('0x39')][_0xae79('0x46')]+'%'};return _0x2615fd;}})});}_0x17c3a5=_['merge']({},_0x17c3a5,_0x273396[_0xae79('0x47')]);var _0x1fe151={'where':_0x17c3a5['where']};return db['Setting'][_0xae79('0x27')](_0x1fe151)[_0xae79('0x48')](function(_0x545ce2){_0x3e4db2['count']=_0x545ce2;if(_0x273396[_0xae79('0x39')][_0xae79('0x49')]){_0x17c3a5[_0xae79('0x4a')]=[{'all':!![]}];}return db[_0xae79('0x34')]['findAll'](_0x17c3a5);})['then'](function(_0x596a2b){_0x3e4db2['rows']=_0x596a2b;return _0x3e4db2;})[_0xae79('0x48')](respondWithFilteredResult(_0x2b5e69,_0x17c3a5))[_0xae79('0x22')](handleError(_0x2b5e69,null));};exports[_0xae79('0x4b')]=function(_0x2ca8b1,_0x166192){var _0x34f1b4={'raw':![],'where':{'id':_0x2ca8b1[_0xae79('0x4c')]['id']}},_0x2cea67={};_0x2cea67['model']=_[_0xae79('0x3a')](db[_0xae79('0x34')][_0xae79('0x35')]);_0x2cea67[_0xae79('0x39')]=_[_0xae79('0x3a')](_0x2ca8b1[_0xae79('0x39')]);_0x2cea67['filters']=_[_0xae79('0x3c')](_0x2cea67[_0xae79('0x38')],_0x2cea67[_0xae79('0x39')]);_0x34f1b4[_0xae79('0x3d')]=_['intersection'](_0x2cea67['model'],qs[_0xae79('0x3e')](_0x2ca8b1[_0xae79('0x39')]['fields']));_0x34f1b4[_0xae79('0x3d')]=_0x34f1b4['attributes'][_0xae79('0x3f')]?_0x34f1b4[_0xae79('0x3d')]:_0x2cea67[_0xae79('0x38')];if(_0x2ca8b1[_0xae79('0x39')]['includeAll']){_0x34f1b4[_0xae79('0x4a')]=[{'all':!![]}];}_0x34f1b4=_[_0xae79('0x45')]({},_0x34f1b4,_0x2ca8b1['options']);return db[_0xae79('0x34')][_0xae79('0x4d')](_0x34f1b4)[_0xae79('0x48')](handleEntityNotFound(_0x166192,null))[_0xae79('0x48')](respondWithResult(_0x166192,null))['catch'](handleError(_0x166192,null));};exports[_0xae79('0x2d')]=function(_0x2b5bcc,_0xc98b31){if(_0x2b5bcc['body']['id']){delete _0x2b5bcc[_0xae79('0x4e')]['id'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x2b5bcc[_0xae79('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc98b31,null))['then'](saveUpdates(_0x2b5bcc['body'],null))[_0xae79('0x48')](respondWithResult(_0xc98b31,null))['catch'](handleError(_0xc98b31,null));};exports[_0xae79('0x4f')]=function(_0xfa8720,_0x35e691,_0x3ec4f4){if(_0xfa8720['file']&&_0xfa8720[_0xae79('0x50')]['filename']){_0xfa8720[_0xae79('0x4e')]['logo']=_0xfa8720[_0xae79('0x50')]['filename'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0xfa8720['params']['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x35e691,null))[_0xae79('0x48')](saveUpdates(_0xfa8720['body'],null))['then'](respondWithResult(_0x35e691,null))[_0xae79('0x22')](handleError(_0x35e691,null));};exports['addLogoLogin']=function(_0x29ce2e,_0x35d684,_0x54f392){if(_0x29ce2e['file']&&_0x29ce2e[_0xae79('0x50')]['filename']){_0x29ce2e[_0xae79('0x4e')][_0xae79('0x51')]=_0x29ce2e[_0xae79('0x50')][_0xae79('0x52')];}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x29ce2e[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x35d684,null))[_0xae79('0x48')](saveUpdates(_0x29ce2e[_0xae79('0x4e')],null))['then'](respondWithResult(_0x35d684,null))['catch'](handleError(_0x35d684,null));};var utilLicense=require('../../config/license/util');exports[_0xae79('0x53')]=function(_0x250b3a,_0x503414,_0x5e1f78){var _0x10ad25=_0xae79('0x54');var _0x533bb4={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x5da8f5){if(_0x5da8f5){_0x533bb4=_0x5da8f5;}return db['Setting']['find']({'where':{'id':_0x250b3a[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),_0xae79('0x57'),_0xae79('0x58'),_0xae79('0x59'),_0xae79('0x5a'),'defaultPreferred',_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x503414,null))[_0xae79('0x48')](function(_0x132f09){if(_0x132f09){var _0x47b289=_0x132f09[_0xae79('0x56')]&&fs['existsSync'](path[_0xae79('0x5c')](config['root'],_0x10ad25,_['toLower'](_0x132f09[_0xae79('0x56')])))?path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x10ad25,_['toLower'](_0x132f09[_0xae79('0x56')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x10ad25,_['toLower'](_0xae79('0x5e')));var _0x4259ac=_0xae79('0x5f')+_[_0xae79('0x60')](_0xae79('0x56'));if(_0x132f09[_0x4259ac]||!_0x533bb4[_0xae79('0x61')]){_0x47b289=path['join'](config['root'],_0x10ad25,_[_0xae79('0x62')]('default_logo.svg'));}if(!fs[_0xae79('0x63')](_0x47b289)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_[_0xae79('0x60')]('logo')+_0xae79('0x66'));}return _0x503414[_0xae79('0x67')](_0x47b289);}})['catch'](handleError(_0x503414,null));};var utilLicense=require(_0xae79('0x13'));exports[_0xae79('0x68')]=function(_0x5cf266,_0x29f568,_0x2c91a6){var _0xdeab6b='server/files/images/logos';var _0x4f59ad={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x1f015e){if(_0x1f015e){_0x4f59ad=_0x1f015e;}return db[_0xae79('0x34')]['find']({'where':{'id':_0x5cf266[_0xae79('0x4c')]['id']},'attributes':['logo',_0xae79('0x51'),_0xae79('0x57'),'favicon',_0xae79('0x59'),_0xae79('0x5a'),'defaultPreferred',_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x29f568,null))[_0xae79('0x48')](function(_0x46a4bd){if(_0x46a4bd){var _0x11dd2d=_0x46a4bd[_0xae79('0x51')]&&fs[_0xae79('0x63')](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0x46a4bd[_0xae79('0x51')])))?path[_0xae79('0x5c')](config['root'],_0xdeab6b,_['toLower'](_0x46a4bd[_0xae79('0x51')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0xae79('0x69')));var _0x104c3a='default'+_['upperFirst'](_0xae79('0x51'));if(_0x46a4bd[_0x104c3a]||!_0x4f59ad[_0xae79('0x61')]){_0x11dd2d=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0xdeab6b,_[_0xae79('0x62')](_0xae79('0x69')));}if(!fs[_0xae79('0x63')](_0x11dd2d)){throw new db['Sequelize'][(_0xae79('0x65'))](_[_0xae79('0x60')](_0xae79('0x51'))+_0xae79('0x66'));}return _0x29f568[_0xae79('0x67')](_0x11dd2d);}})[_0xae79('0x22')](handleError(_0x29f568,null));};exports[_0xae79('0x6a')]=function(_0x493fbc,_0x4ae4d0){return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x493fbc[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x6b')]})[_0xae79('0x48')](respondWithResult(_0x4ae4d0,null))[_0xae79('0x22')](handleError(_0x4ae4d0,null));};exports[_0xae79('0x6c')]=function(_0x37a7e2,_0x42ed0f,_0x538569){if(_0x37a7e2[_0xae79('0x50')]&&_0x37a7e2['file'][_0xae79('0x52')]){_0x37a7e2[_0xae79('0x4e')][_0xae79('0x57')]=_0x37a7e2[_0xae79('0x50')]['filename'];}return db['Setting'][_0xae79('0x4d')]({'where':{'id':_0x37a7e2[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0x42ed0f,null))['then'](saveUpdates(_0x37a7e2[_0xae79('0x4e')],null))[_0xae79('0x48')](respondWithResult(_0x42ed0f,null))[_0xae79('0x22')](handleError(_0x42ed0f,null));};var utilLicense=require('../../config/license/util');exports[_0xae79('0x6d')]=function(_0x378791,_0x2b7eea,_0x707284){var _0x4eda97=_0xae79('0x54');var _0xfee3a6={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x1dee24){if(_0x1dee24){_0xfee3a6=_0x1dee24;}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x378791[_0xae79('0x4c')]['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),'preferred',_0xae79('0x58'),'defaultLogo','defaultLoginLogo',_0xae79('0x6e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2b7eea,null))[_0xae79('0x48')](function(_0x7c0e4b){if(_0x7c0e4b){var _0x26a535=_0x7c0e4b[_0xae79('0x57')]&&fs['existsSync'](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0x7c0e4b['preferred'])))?path['join'](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0x7c0e4b[_0xae79('0x57')])):path['join'](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0xae79('0x6f')));var _0x5f0369='default'+_[_0xae79('0x60')](_0xae79('0x57'));if(_0x7c0e4b[_0x5f0369]||!_0xfee3a6[_0xae79('0x61')]||!_0xfee3a6['preferred']){_0x26a535=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x4eda97,_[_0xae79('0x62')](_0xae79('0x6f')));}if(!fs['existsSync'](_0x26a535)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_['upperFirst'](_0xae79('0x57'))+_0xae79('0x66'));}return _0x2b7eea[_0xae79('0x67')](_0x26a535);}})['catch'](handleError(_0x2b7eea,null));};exports[_0xae79('0x70')]=function(_0x2cb87c,_0xd3170f,_0x23167b){if(_0x2cb87c[_0xae79('0x50')]&&_0x2cb87c[_0xae79('0x50')]['filename']){_0x2cb87c[_0xae79('0x4e')]['favicon']=_0x2cb87c[_0xae79('0x50')][_0xae79('0x52')];}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x2cb87c[_0xae79('0x4c')]['id']}})[_0xae79('0x48')](handleEntityNotFound(_0xd3170f,null))[_0xae79('0x48')](saveUpdates(_0x2cb87c[_0xae79('0x4e')],null))[_0xae79('0x48')](respondWithResult(_0xd3170f,null))[_0xae79('0x22')](handleError(_0xd3170f,null));};var utilLicense=require(_0xae79('0x13'));exports[_0xae79('0x71')]=function(_0x2d13c1,_0x1b4b19,_0x1281c5){var _0x5bc8ad=_0xae79('0x54');var _0x4d6ef0={'custom':![]};return utilLicense[_0xae79('0x55')]()[_0xae79('0x48')](function(_0x5957f0){if(_0x5957f0){_0x4d6ef0=_0x5957f0;}return db[_0xae79('0x34')][_0xae79('0x4d')]({'where':{'id':_0x2d13c1['params']['id']},'attributes':[_0xae79('0x56'),_0xae79('0x51'),_0xae79('0x57'),_0xae79('0x58'),_0xae79('0x59'),_0xae79('0x5a'),_0xae79('0x6e'),_0xae79('0x5b')],'raw':!![]});})[_0xae79('0x48')](handleEntityNotFound(_0x1b4b19,null))[_0xae79('0x48')](function(_0x57312b){if(_0x57312b){var _0x51d4a9=_0x57312b[_0xae79('0x58')]&&fs['existsSync'](path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')](_0x57312b[_0xae79('0x58')])))?path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')](_0x57312b[_0xae79('0x58')])):path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_['toLower'](_0xae79('0x72')));var _0x42b9ed=_0xae79('0x5f')+_[_0xae79('0x60')]('favicon');if(_0x57312b[_0x42b9ed]||!_0x4d6ef0[_0xae79('0x61')]){_0x51d4a9=path[_0xae79('0x5c')](config[_0xae79('0x5d')],_0x5bc8ad,_[_0xae79('0x62')]('default_favicon.ico'));}if(!fs['existsSync'](_0x51d4a9)){throw new db[(_0xae79('0x64'))][(_0xae79('0x65'))](_[_0xae79('0x60')](_0xae79('0x58'))+'\x20not\x20found');}return _0x1b4b19['download'](_0x51d4a9);}})[_0xae79('0x22')](handleError(_0x1b4b19,null));};exports[_0xae79('0x73')]=function(_0x473431,_0x5eeaa1){var _0x2e571b={'offset':moment()['utcOffset']()};_0x2e571b[_0xae79('0x74')]=moment()[_0xae79('0x75')](_0x2e571b[_0xae79('0x26')])[_0xae79('0x76')](_0xae79('0x77'));return _0x5eeaa1[_0xae79('0x24')](0xc8)[_0xae79('0x32')](_0x2e571b);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f186a45..2df6fa0 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x14e529,_0x17f55d){var _0x3ee718=function(_0x338b15){while(--_0x338b15){_0x14e529['push'](_0x14e529['shift']());}};_0x3ee718(++_0x17f55d);}(_0xedd9,0xfc));var _0x9edd=function(_0x44bda8,_0x1728d6){_0x44bda8=_0x44bda8-0x0;var _0x326d63=_0xedd9[_0x44bda8];return _0x326d63;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index aac7308..d081b2c 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 _0x91fc=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x40341a,_0x12c198){var _0x42ffad=function(_0x341ddf){while(--_0x341ddf){_0x40341a['push'](_0x40341a['shift']());}};_0x42ffad(++_0x12c198);}(_0x91fc,0xb3));var _0xc91f=function(_0x1c3e47,_0xa2a3ad){_0x1c3e47=_0x1c3e47-0x0;var _0x57e88e=_0x91fc[_0x1c3e47];return _0x57e88e;};'use strict';var _=require(_0xc91f('0x0'));var util=require(_0xc91f('0x1'));var moment=require(_0xc91f('0x2'));var BPromise=require(_0xc91f('0x3'));var rs=require(_0xc91f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc91f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc91f('0x6'))('rpc');var config=require(_0xc91f('0x7'));var jayson=require(_0xc91f('0x8'));var client=jayson[_0xc91f('0x9')][_0xc91f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b60eb,_0x43f2ae,_0x1442f0){return new BPromise(function(_0x125d85,_0x4c146e){return client[_0xc91f('0xb')](_0x2b60eb,_0x1442f0)[_0xc91f('0xc')](function(_0x129e84){logger[_0xc91f('0xd')](_0xc91f('0xe'),_0x43f2ae,_0xc91f('0xf'));logger[_0xc91f('0x10')](_0xc91f('0x11'),_0x43f2ae,'request\x20sent',JSON[_0xc91f('0x12')](_0x129e84));if(_0x129e84[_0xc91f('0x13')]){if(_0x129e84[_0xc91f('0x13')][_0xc91f('0x14')]===0x1f4){logger['error'](_0xc91f('0xe'),_0x43f2ae,_0x129e84[_0xc91f('0x13')][_0xc91f('0x15')]);return _0x4c146e(_0x129e84[_0xc91f('0x13')][_0xc91f('0x15')]);}logger[_0xc91f('0x13')]('Setting,\x20%s,\x20%s',_0x43f2ae,_0x129e84['error'][_0xc91f('0x15')]);return _0x125d85(_0x129e84[_0xc91f('0x13')][_0xc91f('0x15')]);}else{logger['info'](_0xc91f('0xe'),_0x43f2ae,_0xc91f('0xf'));_0x125d85(_0x129e84['result']['message']);}})[_0xc91f('0x16')](function(_0xd32c81){logger[_0xc91f('0x13')](_0xc91f('0xe'),_0x43f2ae,_0xd32c81);_0x4c146e(_0xd32c81);});});}exports[_0xc91f('0x17')]=function(_0x4ebf91){var _0x430c2b=this;return new Promise(function(_0x59c193,_0x58040f){return db['Setting'][_0xc91f('0x18')]({'raw':_0x4ebf91[_0xc91f('0x19')]?_0x4ebf91['options'][_0xc91f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ebf91[_0xc91f('0x19')]?_0x4ebf91[_0xc91f('0x19')][_0xc91f('0x1b')]||null:null,'attributes':_0x4ebf91[_0xc91f('0x19')]?_0x4ebf91[_0xc91f('0x19')][_0xc91f('0x1c')]||null:null,'include':_0x4ebf91['options']?_0x4ebf91[_0xc91f('0x19')][_0xc91f('0x1d')]?_['map'](_0x4ebf91[_0xc91f('0x19')][_0xc91f('0x1d')],function(_0x575b7b){return{'model':db[_0x575b7b['model']],'as':_0x575b7b['as'],'attributes':_0x575b7b['attributes'],'include':_0x575b7b[_0xc91f('0x1d')]?_[_0xc91f('0x1e')](_0x575b7b[_0xc91f('0x1d')],function(_0x585904){return{'model':db[_0x585904[_0xc91f('0x1f')]],'as':_0x585904['as'],'attributes':_0x585904['attributes'],'include':_0x585904['include']?_[_0xc91f('0x1e')](_0x585904[_0xc91f('0x1d')],function(_0x54044f){return{'model':db[_0x54044f[_0xc91f('0x1f')]],'as':_0x54044f['as'],'attributes':_0x54044f[_0xc91f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc91f('0xc')](function(_0x46e9aa){logger[_0xc91f('0xd')](_0xc91f('0x17'),_0x4ebf91);logger[_0xc91f('0x10')](_0xc91f('0x17'),_0x4ebf91,JSON[_0xc91f('0x12')](_0x46e9aa));_0x59c193(_0x46e9aa);})[_0xc91f('0x16')](function(_0x215b04){logger[_0xc91f('0x13')]('ShowSetting',_0x215b04['message'],_0x4ebf91);_0x58040f(_0x430c2b[_0xc91f('0x13')](0x1f4,_0x215b04['message']));});});}; \ No newline at end of file +var _0x9413=['Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x35f9c4,_0x511cbd){var _0x40e2ea=function(_0x4e1ab4){while(--_0x4e1ab4){_0x35f9c4['push'](_0x35f9c4['shift']());}};_0x40e2ea(++_0x511cbd);}(_0x9413,0x15c));var _0x3941=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x9413[_0x673722];return _0x21249c;};'use strict';var _=require(_0x3941('0x0'));var util=require(_0x3941('0x1'));var moment=require(_0x3941('0x2'));var BPromise=require(_0x3941('0x3'));var rs=require(_0x3941('0x4'));var fs=require('fs');var Redis=require(_0x3941('0x5'));var db=require(_0x3941('0x6'))['db'];var utils=require(_0x3941('0x7'));var logger=require('../../config/logger')(_0x3941('0x8'));var config=require(_0x3941('0x9'));var jayson=require(_0x3941('0xa'));var client=jayson[_0x3941('0xb')][_0x3941('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6cbef4,_0x540ce1,_0x504508){return new BPromise(function(_0x1ebd19,_0x529080){return client[_0x3941('0xd')](_0x6cbef4,_0x504508)['then'](function(_0x4b674d){logger[_0x3941('0xe')](_0x3941('0xf'),_0x540ce1,'request\x20sent');logger[_0x3941('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x540ce1,_0x3941('0x11'),JSON[_0x3941('0x12')](_0x4b674d));if(_0x4b674d['error']){if(_0x4b674d[_0x3941('0x13')][_0x3941('0x14')]===0x1f4){logger[_0x3941('0x13')](_0x3941('0xf'),_0x540ce1,_0x4b674d['error'][_0x3941('0x15')]);return _0x529080(_0x4b674d[_0x3941('0x13')][_0x3941('0x15')]);}logger[_0x3941('0x13')](_0x3941('0xf'),_0x540ce1,_0x4b674d[_0x3941('0x13')][_0x3941('0x15')]);return _0x1ebd19(_0x4b674d['error']['message']);}else{logger[_0x3941('0xe')]('Setting,\x20%s,\x20%s',_0x540ce1,_0x3941('0x11'));_0x1ebd19(_0x4b674d['result'][_0x3941('0x15')]);}})[_0x3941('0x16')](function(_0x17e261){logger['error'](_0x3941('0xf'),_0x540ce1,_0x17e261);_0x529080(_0x17e261);});});}exports[_0x3941('0x17')]=function(_0x68e75e){var _0x9bdbab=this;return new Promise(function(_0x102de0,_0x3239a0){return db[_0x3941('0x18')][_0x3941('0x19')]({'raw':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1b')]===undefined?!![]:![]:!![],'where':_0x68e75e[_0x3941('0x1a')]?_0x68e75e['options'][_0x3941('0x1c')]||null:null,'attributes':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1d')]||null:null,'include':_0x68e75e[_0x3941('0x1a')]?_0x68e75e[_0x3941('0x1a')][_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x68e75e[_0x3941('0x1a')]['include'],function(_0x431039){return{'model':db[_0x431039[_0x3941('0x20')]],'as':_0x431039['as'],'attributes':_0x431039['attributes'],'include':_0x431039[_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x431039['include'],function(_0x5b643c){return{'model':db[_0x5b643c[_0x3941('0x20')]],'as':_0x5b643c['as'],'attributes':_0x5b643c[_0x3941('0x1d')],'include':_0x5b643c[_0x3941('0x1e')]?_[_0x3941('0x1f')](_0x5b643c[_0x3941('0x1e')],function(_0x894d4c){return{'model':db[_0x894d4c[_0x3941('0x20')]],'as':_0x894d4c['as'],'attributes':_0x894d4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b44){logger[_0x3941('0xe')](_0x3941('0x17'),_0x68e75e);logger['debug']('ShowSetting',_0x68e75e,JSON['stringify'](_0x46b44));_0x102de0(_0x46b44);})['catch'](function(_0x16fe71){logger[_0x3941('0x13')](_0x3941('0x17'),_0x16fe71[_0x3941('0x15')],_0x68e75e);_0x3239a0(_0x9bdbab[_0x3941('0x13')](0x1f4,_0x16fe71[_0x3941('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 251d1f8..54a9189 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf494,0x1c6));var _0x4f49=function(_0x2175a3,_0x426e08){_0x2175a3=_0x2175a3-0x0;var _0x3d308b=_0xf494[_0x2175a3];return _0x3d308b;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x54332e,_0x286092){var _0x44d685=function(_0x17a296){while(--_0x17a296){_0x54332e['push'](_0x54332e['shift']());}};_0x44d685(++_0x286092);}(_0x5fab,0x177));var _0xb5fa=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0x5fab[_0x54d5c8];return _0x525e2e;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 7e3227f..43bf465 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 _0x4c46=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1f36a5,_0x42653e){var _0x47899d=function(_0x516c88){while(--_0x516c88){_0x1f36a5['push'](_0x1f36a5['shift']());}};_0x47899d(++_0x42653e);}(_0x4c46,0xc9));var _0x64c4=function(_0x51ff17,_0x2321ec){_0x51ff17=_0x51ff17-0x0;var _0x1d7f4a=_0x4c46[_0x51ff17];return _0x1d7f4a;};'use strict';var Sequelize=require(_0x64c4('0x0'));var rs=require(_0x64c4('0x1'));module[_0x64c4('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x64c4('0x3')],'defaultValue':function(){return rs[_0x64c4('0x4')]();}},'phone':{'type':Sequelize[_0x64c4('0x3')]},'type':{'type':Sequelize[_0x64c4('0x5')](_0x64c4('0x6'),_0x64c4('0x7'),'connectel','clicksend','plivo','clickatell',_0x64c4('0x8'),'csc',_0x64c4('0x9'),_0x64c4('0xa'))},'accountSid':{'type':Sequelize[_0x64c4('0x3')]},'authId':{'type':Sequelize[_0x64c4('0x3')]},'authToken':{'type':Sequelize[_0x64c4('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x64c4('0x3')]},'password':{'type':Sequelize[_0x64c4('0x3')]},'apiKey':{'type':Sequelize[_0x64c4('0x3')]},'applicationId':{'type':Sequelize[_0x64c4('0x3')]},'accountId':{'type':Sequelize[_0x64c4('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x64c4('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x64c4('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x64c4('0xc');}},'notificationSound':{'type':Sequelize[_0x64c4('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x64c4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x64c4('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x64c4('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x64c4('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x64c4('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x64c4('0xb')],'defaultValue':![],'comment':_0x64c4('0xe'),'set':function(_0x3b8539){if(!_0x3b8539)this[_0x64c4('0xf')](_0x64c4('0x10'),null);this[_0x64c4('0xf')](_0x64c4('0x11'),_0x3b8539);}}}; \ No newline at end of file +var _0xf7d9=['skebby','connectel','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','ENUM','twilio'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xf7d9,0x66));var _0x9f7d=function(_0xf3e9f1,_0x5a3f6f){_0xf3e9f1=_0xf3e9f1-0x0;var _0x13b584=_0xf7d9[_0xf3e9f1];return _0x13b584;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9f7d('0x0'));module[_0x9f7d('0x1')]={'name':{'type':Sequelize[_0x9f7d('0x2')],'unique':_0x9f7d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x9f7d('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9f7d('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9f7d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9f7d('0x2')]},'type':{'type':Sequelize[_0x9f7d('0x4')](_0x9f7d('0x5'),_0x9f7d('0x6'),_0x9f7d('0x7'),'clicksend','plivo',_0x9f7d('0x8'),'bandwidth',_0x9f7d('0x9'),_0x9f7d('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x9f7d('0x2')]},'authId':{'type':Sequelize[_0x9f7d('0x2')]},'authToken':{'type':Sequelize[_0x9f7d('0x2')]},'smsMethod':{'type':Sequelize[_0x9f7d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9f7d('0x2')]},'password':{'type':Sequelize[_0x9f7d('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x9f7d('0x2')]},'accountId':{'type':Sequelize[_0x9f7d('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x9f7d('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9f7d('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9f7d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9f7d('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x9f7d('0xb')],'defaultValue':![],'comment':_0x9f7d('0xf'),'set':function(_0x10ee2d){if(!_0x10ee2d)this[_0x9f7d('0x10')](_0x9f7d('0x11'),null);this['setDataValue']('mandatoryDisposition',_0x10ee2d);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 99626aa..9b08fcd 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 _0xaf9e=['statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','pick','where','merge','filter','options','SmsAccount','includeAll','include','rows','show','params','Pause','find','create','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','rawAttributes','sort','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','From','Body','messageId','MessageSid','skebby','from','sender','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','unshift','agent','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','clickatell','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xaf9e,0xf6));var _0xeaf9=function(_0x16f9be,_0x533f56){_0x16f9be=_0x16f9be-0x0;var _0x53706f=_0xaf9e[_0x16f9be];return _0x53706f;};'use strict';var emlformat=require(_0xeaf9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeaf9('0x1'));var rp=require(_0xeaf9('0x2'));var moment=require(_0xeaf9('0x3'));var BPromise=require(_0xeaf9('0x4'));var Mustache=require(_0xeaf9('0x5'));var util=require(_0xeaf9('0x6'));var path=require(_0xeaf9('0x7'));var sox=require(_0xeaf9('0x8'));var csv=require(_0xeaf9('0x9'));var ejs=require(_0xeaf9('0xa'));var fs=require('fs');var fs_extra=require(_0xeaf9('0xb'));var _=require(_0xeaf9('0xc'));var squel=require('squel');var crypto=require(_0xeaf9('0xd'));var jsforce=require(_0xeaf9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeaf9('0x9'));var querystring=require('querystring');var Papa=require(_0xeaf9('0xf'));var Redis=require(_0xeaf9('0x10'));var authService=require(_0xeaf9('0x11'));var qs=require(_0xeaf9('0x12'));var as=require(_0xeaf9('0x13'));var hardwareService=require(_0xeaf9('0x14'));var logger=require('../../config/logger')(_0xeaf9('0x15'));var utils=require(_0xeaf9('0x16'));var config=require(_0xeaf9('0x17'));var licenseUtil=require(_0xeaf9('0x18'));var db=require(_0xeaf9('0x19'))['db'];config[_0xeaf9('0x1a')]=_[_0xeaf9('0x1b')](config[_0xeaf9('0x1a')],{'host':_0xeaf9('0x1c'),'port':0x18eb});var socket=require(_0xeaf9('0x1d'))(new Redis(config['redis']));require(_0xeaf9('0x1e'))[_0xeaf9('0x1f')](socket);var jayson=require(_0xeaf9('0x20'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1cd1e2,_0x2369a3,_0x26e8c8,_0x45e811){return new BPromise(function(_0xd46ad9,_0x50c16c){var _0xcaa6da=_0x45e811||client;return _0xcaa6da[_0xeaf9('0x21')](_0x1cd1e2,_0x26e8c8)[_0xeaf9('0x22')](function(_0x3fad38){logger[_0xeaf9('0x23')]('SmsAccount,\x20%s,\x20%s',_0x2369a3,_0xeaf9('0x24'));logger[_0xeaf9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2369a3,_0xeaf9('0x24'),JSON[_0xeaf9('0x26')](_0x3fad38));if(_0x3fad38[_0xeaf9('0x27')]){if(_0x3fad38[_0xeaf9('0x27')][_0xeaf9('0x28')]===0x1f4){logger[_0xeaf9('0x27')](_0xeaf9('0x29'),_0x2369a3,_0x3fad38[_0xeaf9('0x27')][_0xeaf9('0x2a')]);return _0x50c16c(_0x3fad38['error']['message']);}logger['error'](_0xeaf9('0x29'),_0x2369a3,_0x3fad38[_0xeaf9('0x27')][_0xeaf9('0x2a')]);return _0xd46ad9(_0x3fad38[_0xeaf9('0x27')][_0xeaf9('0x2a')]);}else{logger['info'](_0xeaf9('0x29'),_0x2369a3,_0xeaf9('0x24'));_0xd46ad9(_0x3fad38[_0xeaf9('0x2b')][_0xeaf9('0x2a')]);}})[_0xeaf9('0x2c')](function(_0x426132){logger[_0xeaf9('0x27')](_0xeaf9('0x29'),_0x2369a3,_0x426132);_0x50c16c(_0x426132);});});}function respondWithStatusCode(_0xe20d4c,_0x2faae7){_0x2faae7=_0x2faae7||0xcc;return function(_0x39a4a4){if(_0x39a4a4){return _0xe20d4c[_0xeaf9('0x2d')](_0x2faae7);}return _0xe20d4c[_0xeaf9('0x2e')](_0x2faae7)[_0xeaf9('0x2f')]();};}function respondWithResult(_0x5115cd,_0x59e574){_0x59e574=_0x59e574||0xc8;return function(_0xcc159a){if(_0xcc159a){return _0x5115cd[_0xeaf9('0x2e')](_0x59e574)['json'](_0xcc159a);}};}function respondWithFilteredResult(_0x5d4fc7,_0xc64d8b){return function(_0x35da7f){if(_0x35da7f){var _0x425080=typeof _0xc64d8b['offset']===_0xeaf9('0x30')&&typeof _0xc64d8b['limit']===_0xeaf9('0x30');var _0xd38e35=_0x35da7f[_0xeaf9('0x31')];var _0x56fcc5=_0x425080?0x0:_0xc64d8b[_0xeaf9('0x32')];var _0x9b27c1=_0x425080?_0x35da7f[_0xeaf9('0x31')]:_0xc64d8b[_0xeaf9('0x32')]+_0xc64d8b['limit'];var _0xb5d6f6;if(_0x9b27c1>=_0xd38e35){_0x9b27c1=_0xd38e35;_0xb5d6f6=0xc8;}else{_0xb5d6f6=0xce;}_0x5d4fc7[_0xeaf9('0x2e')](_0xb5d6f6);return _0x5d4fc7[_0xeaf9('0x33')]('Content-Range',_0x56fcc5+'-'+_0x9b27c1+'/'+_0xd38e35)[_0xeaf9('0x34')](_0x35da7f);}return null;};}function patchUpdates(_0x2f8acf){return function(_0x14ed71){try{jsonpatch[_0xeaf9('0x35')](_0x14ed71,_0x2f8acf,!![]);}catch(_0xf71c22){return BPromise[_0xeaf9('0x36')](_0xf71c22);}return _0x14ed71['save']();};}function saveUpdates(_0x3fa079,_0x1de3a2){return function(_0x529364){if(_0x529364){return _0x529364[_0xeaf9('0x37')](_0x3fa079)[_0xeaf9('0x22')](function(_0x488fa8){return _0x488fa8;});}return null;};}function removeEntity(_0x4b14e4,_0x1c3459){return function(_0x2341fb){if(_0x2341fb){return _0x2341fb[_0xeaf9('0x38')]()['then'](function(){var _0x579c9b=_0x2341fb['get']({'plain':!![]});var _0x2f6a0b=_0xeaf9('0x39');return db[_0xeaf9('0x3a')][_0xeaf9('0x38')]({'where':{'type':_0x2f6a0b,'resourceId':_0x579c9b['id']}})[_0xeaf9('0x22')](function(){return _0x2341fb;});})[_0xeaf9('0x22')](function(){_0x4b14e4[_0xeaf9('0x2e')](0xcc)[_0xeaf9('0x2f')]();});}};}function handleEntityNotFound(_0xe74081,_0x21a55c){return function(_0x23bcae){if(!_0x23bcae){_0xe74081[_0xeaf9('0x2d')](0x194);}return _0x23bcae;};}function handleError(_0x270c7c,_0x430e87){_0x430e87=_0x430e87||0x1f4;return function(_0x5206ab){logger[_0xeaf9('0x27')](_0x5206ab[_0xeaf9('0x3b')]);if(_0x5206ab['name']){delete _0x5206ab[_0xeaf9('0x3c')];}_0x270c7c['status'](_0x430e87)[_0xeaf9('0x3d')](_0x5206ab);};}exports[_0xeaf9('0x3e')]=function(_0x4d36cc,_0x54771f){var _0x281a67={'include':[{'model':db['Pause'],'as':_0xeaf9('0x3f')}]},_0x2c0204={},_0x4bdcfd={'count':0x0,'rows':[]};var _0x3e430c=_[_0xeaf9('0x40')](db['SmsAccount']['rawAttributes'],function(_0x2237c8){return{'name':_0x2237c8['fieldName'],'type':_0x2237c8[_0xeaf9('0x41')][_0xeaf9('0x42')]};});_0x2c0204['model']=_['map'](_0x3e430c,'name');_0x2c0204[_0xeaf9('0x43')]=_[_0xeaf9('0x44')](_0x4d36cc[_0xeaf9('0x43')]);_0x2c0204[_0xeaf9('0x45')]=_[_0xeaf9('0x46')](_0x2c0204['model'],_0x2c0204[_0xeaf9('0x43')]);_0x281a67[_0xeaf9('0x47')]=_['intersection'](_0x2c0204['model'],qs[_0xeaf9('0x48')](_0x4d36cc[_0xeaf9('0x43')]['fields']));_0x281a67['attributes']=_0x281a67['attributes'][_0xeaf9('0x49')]?_0x281a67['attributes']:_0x2c0204[_0xeaf9('0x4a')];if(!_0x4d36cc[_0xeaf9('0x43')][_0xeaf9('0x4b')](_0xeaf9('0x4c'))){_0x281a67[_0xeaf9('0x4d')]=qs[_0xeaf9('0x4d')](_0x4d36cc['query'][_0xeaf9('0x4d')]);_0x281a67[_0xeaf9('0x32')]=qs['offset'](_0x4d36cc[_0xeaf9('0x43')][_0xeaf9('0x32')]);}_0x281a67[_0xeaf9('0x4e')]=qs['sort'](_0x4d36cc[_0xeaf9('0x43')]['sort']);_0x281a67['where']=qs[_0xeaf9('0x45')](_[_0xeaf9('0x4f')](_0x4d36cc[_0xeaf9('0x43')],_0x2c0204['filters']),_0x3e430c);if(_0x4d36cc[_0xeaf9('0x43')]['filter']){_0x281a67[_0xeaf9('0x50')]=_[_0xeaf9('0x51')](_0x281a67['where'],{'$or':_[_0xeaf9('0x40')](_0x3e430c,function(_0x4d9932){if(_0x4d9932[_0xeaf9('0x41')]!=='VIRTUAL'){var _0x1637fd={};_0x1637fd[_0x4d9932[_0xeaf9('0x3c')]]={'$like':'%'+_0x4d36cc[_0xeaf9('0x43')][_0xeaf9('0x52')]+'%'};return _0x1637fd;}})});}_0x281a67=_['merge']({},_0x281a67,_0x4d36cc[_0xeaf9('0x53')]);var _0x10ad12={'where':_0x281a67['where']};return db[_0xeaf9('0x54')]['count'](_0x10ad12)['then'](function(_0x1e4f10){_0x4bdcfd[_0xeaf9('0x31')]=_0x1e4f10;if(_0x4d36cc['query'][_0xeaf9('0x55')]){_0x281a67[_0xeaf9('0x56')]=[{'all':!![]}];}return db[_0xeaf9('0x54')]['findAll'](_0x281a67);})[_0xeaf9('0x22')](function(_0x44ed98){_0x4bdcfd[_0xeaf9('0x57')]=_0x44ed98;return _0x4bdcfd;})[_0xeaf9('0x22')](respondWithFilteredResult(_0x54771f,_0x281a67))[_0xeaf9('0x2c')](handleError(_0x54771f,null));};exports[_0xeaf9('0x58')]=function(_0x2a2265,_0x296ad2){var _0x4d9cde={'raw':![],'where':{'id':_0x2a2265[_0xeaf9('0x59')]['id']},'include':[{'model':db[_0xeaf9('0x5a')],'as':'mandatoryDispositionPause'}]},_0x57509c={};_0x57509c[_0xeaf9('0x4a')]=_[_0xeaf9('0x44')](db[_0xeaf9('0x54')]['rawAttributes']);_0x57509c['query']=_[_0xeaf9('0x44')](_0x2a2265[_0xeaf9('0x43')]);_0x57509c[_0xeaf9('0x45')]=_[_0xeaf9('0x46')](_0x57509c[_0xeaf9('0x4a')],_0x57509c[_0xeaf9('0x43')]);_0x4d9cde[_0xeaf9('0x47')]=_['intersection'](_0x57509c['model'],qs[_0xeaf9('0x48')](_0x2a2265[_0xeaf9('0x43')]['fields']));_0x4d9cde[_0xeaf9('0x47')]=_0x4d9cde['attributes']['length']?_0x4d9cde[_0xeaf9('0x47')]:_0x57509c['model'];if(_0x2a2265['query']['includeAll']){_0x4d9cde[_0xeaf9('0x56')]=[{'all':!![]}];}_0x4d9cde=_[_0xeaf9('0x51')]({},_0x4d9cde,_0x2a2265[_0xeaf9('0x53')]);return db['SmsAccount'][_0xeaf9('0x5b')](_0x4d9cde)[_0xeaf9('0x22')](handleEntityNotFound(_0x296ad2,null))[_0xeaf9('0x22')](respondWithResult(_0x296ad2,null))[_0xeaf9('0x2c')](handleError(_0x296ad2,null));};exports[_0xeaf9('0x5c')]=function(_0x524a50,_0xcf9b82){return db[_0xeaf9('0x54')][_0xeaf9('0x5c')](_0x524a50['body'],{})[_0xeaf9('0x22')](function(_0x11613c){var _0x2220d2=_0x524a50[_0xeaf9('0x5d')][_0xeaf9('0x5e')]({'plain':!![]});if(!_0x2220d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2220d2[_0xeaf9('0x5f')]===_0xeaf9('0x5d')){var _0x2b6ec5=_0x11613c[_0xeaf9('0x5e')]({'plain':!![]});var _0x249794='SmsAccounts';return db[_0xeaf9('0x60')][_0xeaf9('0x5b')]({'where':{'name':_0x249794,'userProfileId':_0x2220d2['userProfileId']},'raw':!![]})['then'](function(_0x3efec5){if(_0x3efec5&&_0x3efec5[_0xeaf9('0x61')]===0x0){return db[_0xeaf9('0x3a')]['create']({'name':_0x2b6ec5[_0xeaf9('0x3c')],'resourceId':_0x2b6ec5['id'],'type':_0x3efec5['name'],'sectionId':_0x3efec5['id']},{})['then'](function(){return _0x11613c;});}else{return _0x11613c;}})[_0xeaf9('0x2c')](function(_0xfaaf04){logger['error'](_0xeaf9('0x62'),_0xfaaf04);throw _0xfaaf04;});}return _0x11613c;})['then'](respondWithResult(_0xcf9b82,0xc9))['catch'](handleError(_0xcf9b82,null));};exports[_0xeaf9('0x37')]=function(_0x5e1192,_0x1dfb28){if(_0x5e1192['body']['id']){delete _0x5e1192[_0xeaf9('0x63')]['id'];}return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x5e1192['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xeaf9('0x22')](handleEntityNotFound(_0x1dfb28,null))[_0xeaf9('0x22')](saveUpdates(_0x5e1192['body'],null))[_0xeaf9('0x22')](respondWithResult(_0x1dfb28,null))[_0xeaf9('0x2c')](handleError(_0x1dfb28,null));};exports['destroy']=function(_0x55bbbf,_0x1e7a66){return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x55bbbf[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x1e7a66,null))['then'](removeEntity(_0x1e7a66,null))[_0xeaf9('0x2c')](handleError(_0x1e7a66,null));};exports['describe']=function(_0xf6755d,_0x3104f6){return db[_0xeaf9('0x54')][_0xeaf9('0x64')]()[_0xeaf9('0x22')](respondWithResult(_0x3104f6,null))[_0xeaf9('0x2c')](handleError(_0x3104f6,null));};exports[_0xeaf9('0x65')]=function(_0x21c62d,_0x19378f,_0x255afb){if(_0x21c62d[_0xeaf9('0x63')]['id']){delete _0x21c62d[_0xeaf9('0x63')]['id'];}return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x21c62d[_0xeaf9('0x59')]['id']}})['then'](handleEntityNotFound(_0x19378f,null))[_0xeaf9('0x22')](function(_0x5b965b){if(_0x5b965b){_0x21c62d[_0xeaf9('0x63')][_0xeaf9('0x66')]=_0x5b965b['id'];return db['Disposition'][_0xeaf9('0x5c')](_0x21c62d[_0xeaf9('0x63')]);}})[_0xeaf9('0x22')](respondWithResult(_0x19378f,null))[_0xeaf9('0x2c')](handleError(_0x19378f,null));};exports[_0xeaf9('0x67')]=function(_0x1f2586,_0x1c80a7,_0x2287c6){var _0x5df70d={'raw':![],'where':{}};var _0x1e662a={};var _0x590e3e={'count':0x0,'rows':[]};return db[_0xeaf9('0x54')][_0xeaf9('0x68')]({'where':{'id':_0x1f2586[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x1c80a7,null))[_0xeaf9('0x22')](function(_0x354eb1){if(_0x354eb1){_0x1e662a[_0xeaf9('0x4a')]=_['keys'](db[_0xeaf9('0x69')][_0xeaf9('0x6a')]);_0x1e662a[_0xeaf9('0x43')]=_[_0xeaf9('0x44')](_0x1f2586['query']);_0x1e662a['filters']=_[_0xeaf9('0x46')](_0x1e662a['model'],_0x1e662a['query']);_0x5df70d[_0xeaf9('0x47')]=_[_0xeaf9('0x46')](_0x1e662a[_0xeaf9('0x4a')],qs['fields'](_0x1f2586[_0xeaf9('0x43')]['fields']));_0x5df70d[_0xeaf9('0x47')]=_0x5df70d[_0xeaf9('0x47')][_0xeaf9('0x49')]?_0x5df70d[_0xeaf9('0x47')]:_0x1e662a['model'];if(!_0x1f2586[_0xeaf9('0x43')][_0xeaf9('0x4b')]('nolimit')){_0x5df70d['limit']=qs[_0xeaf9('0x4d')](_0x1f2586[_0xeaf9('0x43')][_0xeaf9('0x4d')]);_0x5df70d[_0xeaf9('0x32')]=qs[_0xeaf9('0x32')](_0x1f2586['query'][_0xeaf9('0x32')]);}_0x5df70d['order']=qs['sort'](_0x1f2586[_0xeaf9('0x43')][_0xeaf9('0x6b')]);_0x5df70d[_0xeaf9('0x50')]=qs[_0xeaf9('0x45')](_[_0xeaf9('0x4f')](_0x1f2586['query'],_0x1e662a[_0xeaf9('0x45')]));_0x5df70d[_0xeaf9('0x50')]['SmsAccountId']=_0x354eb1['id'];if(_0x1f2586[_0xeaf9('0x43')][_0xeaf9('0x52')]){_0x5df70d[_0xeaf9('0x50')]=_[_0xeaf9('0x51')](_0x5df70d[_0xeaf9('0x50')],{'$or':_['map'](_0x5df70d[_0xeaf9('0x47')],function(_0x1dd9b1){var _0x541f91={};_0x541f91[_0x1dd9b1]={'$like':'%'+_0x1f2586[_0xeaf9('0x43')][_0xeaf9('0x52')]+'%'};return _0x541f91;})});}_0x5df70d=_[_0xeaf9('0x51')]({},_0x5df70d,_0x1f2586['options']);return db[_0xeaf9('0x69')][_0xeaf9('0x31')]({'where':_0x5df70d[_0xeaf9('0x50')]})[_0xeaf9('0x22')](function(_0x5aa746){_0x590e3e[_0xeaf9('0x31')]=_0x5aa746;if(_0x1f2586[_0xeaf9('0x43')]['includeAll']){_0x5df70d[_0xeaf9('0x56')]=[{'all':!![]}];}return db[_0xeaf9('0x69')][_0xeaf9('0x6c')](_0x5df70d);})[_0xeaf9('0x22')](function(_0x2fa565){_0x590e3e[_0xeaf9('0x57')]=_0x2fa565;return _0x590e3e;});}})['then'](respondWithFilteredResult(_0x1c80a7,_0x5df70d))[_0xeaf9('0x2c')](handleError(_0x1c80a7,null));};exports[_0xeaf9('0x6d')]=function(_0x11fd9d,_0x55d84f,_0x2a1e90){return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x11fd9d[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x55d84f,null))[_0xeaf9('0x22')](function(_0x4f6fea){if(_0x4f6fea){return _0x4f6fea[_0xeaf9('0x6d')](_0x11fd9d[_0xeaf9('0x43')][_0xeaf9('0x6e')]);}})[_0xeaf9('0x22')](respondWithStatusCode(_0x55d84f,null))['catch'](handleError(_0x55d84f,null));};exports[_0xeaf9('0x6f')]=function(_0x2f5d18,_0x1ad516,_0x372f2b){if(_0x2f5d18[_0xeaf9('0x63')]['id']){delete _0x2f5d18[_0xeaf9('0x63')]['id'];}return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x2f5d18[_0xeaf9('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ad516,null))['then'](function(_0x2e6ec6){if(_0x2e6ec6){_0x2f5d18['body']['SmsAccountId']=_0x2e6ec6['id'];return db[_0xeaf9('0x70')]['create'](_0x2f5d18[_0xeaf9('0x63')]);}})[_0xeaf9('0x22')](respondWithResult(_0x1ad516,null))['catch'](handleError(_0x1ad516,null));};exports[_0xeaf9('0x71')]=function(_0x15f8e3,_0xce72b1,_0x45e8ea){var _0x4bf03f={'raw':![],'where':{}};var _0x49b162={};var _0x11a1b7={'count':0x0,'rows':[]};return db['SmsAccount'][_0xeaf9('0x68')]({'where':{'id':_0x15f8e3[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0xce72b1,null))[_0xeaf9('0x22')](function(_0x16bdd5){if(_0x16bdd5){_0x49b162['model']=_[_0xeaf9('0x44')](db['CannedAnswer'][_0xeaf9('0x6a')]);_0x49b162['query']=_['keys'](_0x15f8e3['query']);_0x49b162[_0xeaf9('0x45')]=_[_0xeaf9('0x46')](_0x49b162['model'],_0x49b162[_0xeaf9('0x43')]);_0x4bf03f['attributes']=_[_0xeaf9('0x46')](_0x49b162[_0xeaf9('0x4a')],qs[_0xeaf9('0x48')](_0x15f8e3[_0xeaf9('0x43')]['fields']));_0x4bf03f['attributes']=_0x4bf03f['attributes'][_0xeaf9('0x49')]?_0x4bf03f[_0xeaf9('0x47')]:_0x49b162[_0xeaf9('0x4a')];if(!_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x4b')](_0xeaf9('0x4c'))){_0x4bf03f[_0xeaf9('0x4d')]=qs['limit'](_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x4d')]);_0x4bf03f['offset']=qs['offset'](_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x32')]);}_0x4bf03f[_0xeaf9('0x4e')]=qs['sort'](_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x6b')]);_0x4bf03f[_0xeaf9('0x50')]=qs[_0xeaf9('0x45')](_[_0xeaf9('0x4f')](_0x15f8e3[_0xeaf9('0x43')],_0x49b162[_0xeaf9('0x45')]));_0x4bf03f[_0xeaf9('0x50')]['SmsAccountId']=_0x16bdd5['id'];if(_0x15f8e3['query']['filter']){_0x4bf03f['where']=_['merge'](_0x4bf03f[_0xeaf9('0x50')],{'$or':_[_0xeaf9('0x40')](_0x4bf03f[_0xeaf9('0x47')],function(_0x530c47){var _0x5808aa={};_0x5808aa[_0x530c47]={'$like':'%'+_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x52')]+'%'};return _0x5808aa;})});}_0x4bf03f=_[_0xeaf9('0x51')]({},_0x4bf03f,_0x15f8e3[_0xeaf9('0x53')]);return db['CannedAnswer'][_0xeaf9('0x31')]({'where':_0x4bf03f[_0xeaf9('0x50')]})[_0xeaf9('0x22')](function(_0x3cd485){_0x11a1b7[_0xeaf9('0x31')]=_0x3cd485;if(_0x15f8e3[_0xeaf9('0x43')][_0xeaf9('0x55')]){_0x4bf03f[_0xeaf9('0x56')]=[{'all':!![]}];}return db[_0xeaf9('0x70')][_0xeaf9('0x6c')](_0x4bf03f);})[_0xeaf9('0x22')](function(_0x20125c){_0x11a1b7['rows']=_0x20125c;return _0x11a1b7;});}})[_0xeaf9('0x22')](respondWithFilteredResult(_0xce72b1,_0x4bf03f))[_0xeaf9('0x2c')](handleError(_0xce72b1,null));};exports[_0xeaf9('0x72')]=function(_0x4d5340,_0x389e10,_0x510893){return db['SmsAccount'][_0xeaf9('0x5b')]({'where':{'id':_0x4d5340['params']['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x389e10,null))[_0xeaf9('0x22')](function(_0x47ce3c){if(_0x47ce3c){return _0x47ce3c[_0xeaf9('0x72')](_0x4d5340[_0xeaf9('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x389e10,null))[_0xeaf9('0x2c')](handleError(_0x389e10,null));};exports[_0xeaf9('0x73')]=function(_0x45272a,_0x48f789,_0x1dc012){var _0x54a4ec={'channel':_0xeaf9('0x74')};var _0xbab89f=[];var _0x1595fd=[];var _0x501ab4={};return db['SmsAccount']['find']({'where':{'id':_0x45272a[_0xeaf9('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xeaf9('0x75')}]})[_0xeaf9('0x22')](handleEntityNotFound(_0x48f789,null))[_0xeaf9('0x22')](function(_0x1959d4){_0x54a4ec['account']=_0x1959d4;_0x54a4ec['applications']=_[_0xeaf9('0x76')](_0x1959d4[_0xeaf9('0x75')],['priority'],[_0xeaf9('0x77')]);if(_0x54a4ec[_0xeaf9('0x78')][_0xeaf9('0x75')]){delete _0x54a4ec[_0xeaf9('0x78')][_0xeaf9('0x75')];}return db[_0xeaf9('0x79')]['describe']();})[_0xeaf9('0x22')](function(_0x43d822){if(!_0x43d822){throw new db[(_0xeaf9('0x7a'))][(_0xeaf9('0x7b'))](_0xeaf9('0x7c'));}_0xbab89f=_[_0xeaf9('0x7d')](_[_0xeaf9('0x44')](_0x43d822),[_0xeaf9('0x7e'),_0xeaf9('0x7f')]);_0x1595fd=_[_0xeaf9('0x7d')](_[_0xeaf9('0x44')](_0x43d822),['createdAt','updatedAt','CompanyId',_0xeaf9('0x80')]);_0x54a4ec[_0xeaf9('0x63')]={'mapKey':'mobile'};if(_0x54a4ec[_0xeaf9('0x78')]['type']){switch(_0x54a4ec[_0xeaf9('0x78')][_0xeaf9('0x41')]){case _0xeaf9('0x81'):_0x54a4ec[_0xeaf9('0x63')]['from']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x82')];_0x54a4ec['body'][_0xeaf9('0x63')]=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x83')];_0x54a4ec['body'][_0xeaf9('0x84')]=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x85')];break;case _0xeaf9('0x86'):_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]='+'+_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x88')];_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x63')]=_0x45272a[_0xeaf9('0x63')]['text'];break;case _0xeaf9('0x89'):_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]=_0x45272a['body'][_0xeaf9('0x87')];_0x54a4ec[_0xeaf9('0x63')]['body']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x2a')];break;case'clicksend':_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]=_0x45272a['body']['from'];_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x63')]=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x63')];_0x54a4ec[_0xeaf9('0x63')]['messageId']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x8a')];break;case _0xeaf9('0x8b'):_0x54a4ec['body'][_0xeaf9('0x87')]=_0x45272a['body'][_0xeaf9('0x82')];_0x54a4ec['body'][_0xeaf9('0x63')]=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x8c')];_0x54a4ec[_0xeaf9('0x63')]['messageId']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x8d')];break;case _0xeaf9('0x8e'):_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]='+'+_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x8f')][0x0][_0xeaf9('0x87')];_0x54a4ec[_0xeaf9('0x63')]['body']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x8f')][0x0][_0xeaf9('0x90')];_0x54a4ec['body'][_0xeaf9('0x84')]=_0x45272a['body'][_0xeaf9('0x8f')][0x0][_0xeaf9('0x84')];break;case _0xeaf9('0x91'):_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]=_0x45272a['body'][_0xeaf9('0x92')];_0x54a4ec['body'][_0xeaf9('0x63')]=_0x45272a['body'][_0xeaf9('0x93')]['message'];break;case'clickatell':_0x54a4ec[_0xeaf9('0x63')]['from']=_0x45272a[_0xeaf9('0x63')][_0xeaf9('0x94')];_0x54a4ec['body'][_0xeaf9('0x63')]=_0x45272a[_0xeaf9('0x63')]['text'];_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x84')]=_0x45272a['body'][_0xeaf9('0x95')];break;case _0xeaf9('0x96'):_0x54a4ec[_0xeaf9('0x63')]['messageId']=_0x45272a['body'][0x0][_0xeaf9('0x2a')]['id'];_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')]=_0x45272a['body'][0x0][_0xeaf9('0x2a')][_0xeaf9('0x87')];_0x54a4ec['body']['body']=_0x45272a[_0xeaf9('0x63')][0x0][_0xeaf9('0x2a')][_0xeaf9('0x90')];break;case'intelepeer':_0x54a4ec[_0xeaf9('0x63')]['from']=_0x45272a['body']['from'];_0x54a4ec[_0xeaf9('0x63')]['body']=_0x45272a[_0xeaf9('0x63')]['message'];_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x84')]=_0x45272a['body'][_0xeaf9('0x97')];break;}}if(_0x54a4ec[_0xeaf9('0x63')]['id']){delete _0x54a4ec[_0xeaf9('0x63')]['id'];}if(_[_0xeaf9('0x98')](_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')])){throw new db[(_0xeaf9('0x7a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xeaf9('0x98')](_0x54a4ec['body'][_0xeaf9('0x63')])||_0x54a4ec[_0xeaf9('0x63')]['body']===''){throw new db[(_0xeaf9('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeaf9('0x98')](_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x99')])){throw new db[(_0xeaf9('0x7a'))][(_0xeaf9('0x7b'))](_0xeaf9('0x9a')+_0x1595fd);}if(!_[_0xeaf9('0x9b')](_0x1595fd,_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x99')])){throw new db[(_0xeaf9('0x7a'))][(_0xeaf9('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1595fd);}_0x501ab4[_0x54a4ec[_0xeaf9('0x63')]['mapKey']]=_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')];return db[_0xeaf9('0x9c')]['find']({'where':{'id':_0x54a4ec[_0xeaf9('0x78')][_0xeaf9('0x80')]},'include':[{'model':db[_0xeaf9('0x79')],'as':_0xeaf9('0x9d'),'where':_0x501ab4,'limit':0x1,'order':[[_0xeaf9('0x7f'),_0xeaf9('0x9e')]]}]});})[_0xeaf9('0x22')](handleEntityNotFound(_0x48f789,null))[_0xeaf9('0x22')](function(_0x1d49df){if(_0x1d49df){_0x54a4ec[_0xeaf9('0x9f')]=_['omit'](_0x1d49df,['Contacts']);if(_0x1d49df['Contacts'][_0xeaf9('0x49')]){return _0x1d49df[_0xeaf9('0x9d')][0x0];}var _0x3f3c79=_[_0xeaf9('0x1b')](_0x54a4ec[_0xeaf9('0x63')],{'firstName':_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')],'ListId':_0x1d49df['id']});_0x3f3c79[_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x99')]]=_0x54a4ec[_0xeaf9('0x63')]['from'];return db[_0xeaf9('0x79')][_0xeaf9('0x5c')](_0x3f3c79,{'fields':_0xbab89f,'raw':!![]});}})[_0xeaf9('0x22')](handleEntityNotFound(_0x48f789,null))[_0xeaf9('0x22')](function(_0x56c854){if(_0x56c854){_0x54a4ec[_0xeaf9('0xa0')]=_0x56c854;var _0x25637e={'ContactId':_0x56c854['id'],'phone':_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')],'SmsAccountId':_0x45272a['params']['id']};var _0x79ef0a={'ContactId':_0x56c854['id'],'SmsAccountId':_0x45272a[_0xeaf9('0x59')]['id'],'closed':![]};return db[_0xeaf9('0xa1')]['find']({'where':_0x79ef0a})['then'](function(_0x4bfe01){if(_0x4bfe01){return[_0x4bfe01,![]];}return db['SmsInteraction'][_0xeaf9('0x5c')](_0x25637e)['then'](function(_0x59ca51){return[_0x59ca51,!![]];});});}})[_0xeaf9('0xa2')](function(_0x4527ce,_0x71ad6e){_0x54a4ec[_0xeaf9('0xa3')]=_0x4527ce[_0xeaf9('0x5e')]({'plain':!![]});_0x54a4ec['interaction']['created']=![];if(_0x71ad6e){if(_0x54a4ec['account'][_0xeaf9('0xa4')]){_0x54a4ec['applications'][_0xeaf9('0xa5')]({'id':0x0,'priority':_0x54a4ec[_0xeaf9('0xa6')][_0xeaf9('0x49')]+0x1,'app':_0xeaf9('0xa7'),'appdata':_0xeaf9('0xa8'),'interval':_0xeaf9('0xa9')});}_0x54a4ec[_0xeaf9('0xa3')]['created']=!![];}return db[_0xeaf9('0xaa')][_0xeaf9('0x5c')]({'phone':_0x54a4ec[_0xeaf9('0x63')][_0xeaf9('0x87')],'messageId':_0x54a4ec['body'][_0xeaf9('0x84')],'body':_0x54a4ec['body'][_0xeaf9('0x63')],'SmsAccountId':_0x45272a['params']['id'],'SmsInteractionId':_0x4527ce['id'],'direction':'in','ContactId':_0x4527ce[_0xeaf9('0xab')],'AttachmentId':_0x54a4ec['body']['AttachmentId']});})['then'](function(_0x56fca0){_0x54a4ec[_0xeaf9('0x2a')]=_0x56fca0;if(_0x54a4ec[_0xeaf9('0xa3')][_0xeaf9('0xac')]){return db[_0xeaf9('0xad')][_0xeaf9('0x5b')]({'attributes':['id',_0xeaf9('0x3c')],'where':{'id':_0x54a4ec[_0xeaf9('0xa3')][_0xeaf9('0xac')]}})[_0xeaf9('0x22')](function(_0x2dd97e){if(_0x2dd97e){_0x54a4ec['applications'][_0xeaf9('0xae')]({'id':0x0,'priority':0x0,'app':_0xeaf9('0xaf'),'appdata':_0x2dd97e['name']+','+(_0x54a4ec[_0xeaf9('0x78')]['waitForTheAssignedAgent']||0xa),'interval':_0xeaf9('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x54a4ec);});}return respondWithRpcPromise('Start',_0xeaf9('0xb0'),_0x54a4ec);})[_0xeaf9('0x22')](function(_0x4de8a0){if(_0x4de8a0){var _0x396706=0xc8;var _0x52a698='receiveMessage';logger[_0xeaf9('0x23')](_0xeaf9('0xb1'),_0x52a698,_0x396706,_0xeaf9('0xb2'));logger['debug'](_0xeaf9('0xb3'),_0x52a698,_0x396706,_0xeaf9('0xb2'),JSON[_0xeaf9('0x26')](_0x4de8a0));if(_0x54a4ec['account'][_0xeaf9('0x41')]===_0xeaf9('0x81')){return _0x48f789[_0xeaf9('0x2e')](_0x396706)[_0xeaf9('0x33')](_0xeaf9('0xb4'),_0xeaf9('0xb5'))[_0xeaf9('0x3d')](_0xeaf9('0xb6'));}else{return _0x48f789['status'](_0x396706)[_0xeaf9('0x34')](_0x4de8a0);}}})[_0xeaf9('0x2c')](handleError(_0x48f789,null));};exports['addApplications']=function(_0x4e7271,_0x24e165){var _0x74c094=_0x4e7271[_0xeaf9('0x59')]['id'];var _0x33fd6a=_0x4e7271[_0xeaf9('0x63')];var _0x3c0b8f=0xc8;var _0x4a6347=null;return db['sequelize'][_0xeaf9('0xb7')]({'isolationLevel':db['sequelize'][_0xeaf9('0xb8')][_0xeaf9('0xb9')][_0xeaf9('0xba')]},function(_0x120b10){return db[_0xeaf9('0x54')][_0xeaf9('0x68')]({'where':{'id':_0x74c094},'transaction':_0x120b10})[_0xeaf9('0x22')](function(_0x2050d7){if(_0x2050d7){return db[_0xeaf9('0xbb')][_0xeaf9('0x38')]({'where':{'SmsAccountId':_0x74c094},'transaction':_0x120b10})[_0xeaf9('0x22')](function(){var _0x4001ac=_[_0xeaf9('0x40')](_0x33fd6a,function(_0x26275d){_0x26275d[_0xeaf9('0x66')]=_0x74c094;return _0x26275d;});return db[_0xeaf9('0xbb')]['bulkCreate'](_0x4001ac,{'transaction':_0x120b10});});}else{_0x3c0b8f=0x194;_0x4a6347=[];}});})[_0xeaf9('0x22')](function(){if(_0x3c0b8f!==0x194){return db['SmsApplication'][_0xeaf9('0xbc')]({'where':{'SmsAccountId':_0x74c094},'order':_0xeaf9('0xbd')})[_0xeaf9('0x22')](function(_0x4d350d){_0x4a6347=_0x4d350d;});}})['catch'](function(_0x1b41f9){_0x3c0b8f=0x1f4;logger[_0xeaf9('0x27')](_0x1b41f9[_0xeaf9('0x3b')]);if(_0x1b41f9[_0xeaf9('0x3c')]){delete _0x1b41f9[_0xeaf9('0x3c')];}_0x4a6347=_0x1b41f9;})[_0xeaf9('0xbe')](function(){if(_0x4a6347===null){_0x24e165['sendStatus'](_0x3c0b8f);}else{if(_0x3c0b8f===0x1f4){_0x24e165[_0xeaf9('0x2e')](_0x3c0b8f)[_0xeaf9('0x3d')](_0x4a6347);}else{_0x24e165[_0xeaf9('0x2e')](_0x3c0b8f)[_0xeaf9('0x34')](_0x4a6347);}}});};exports['getApplications']=function(_0x44af0f,_0x1b2097,_0xe48055){var _0xc69d84={};var _0x41d6fe={};var _0x4be25a;var _0x2fad53;return db[_0xeaf9('0x54')][_0xeaf9('0x68')]({'where':{'id':_0x44af0f[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x1b2097,null))[_0xeaf9('0x22')](function(_0x4d757f){if(_0x4d757f){_0x4be25a=_0x4d757f;_0x41d6fe[_0xeaf9('0x4a')]=_['keys'](db[_0xeaf9('0xbb')]['rawAttributes']);_0x41d6fe[_0xeaf9('0x43')]=_[_0xeaf9('0x44')](_0x44af0f[_0xeaf9('0x43')]);_0x41d6fe[_0xeaf9('0x45')]=_['intersection'](_0x41d6fe[_0xeaf9('0x4a')],_0x41d6fe[_0xeaf9('0x43')]);_0xc69d84[_0xeaf9('0x47')]=_['intersection'](_0x41d6fe[_0xeaf9('0x4a')],qs['fields'](_0x44af0f['query'][_0xeaf9('0x48')]));_0xc69d84['attributes']=_0xc69d84[_0xeaf9('0x47')][_0xeaf9('0x49')]?_0xc69d84[_0xeaf9('0x47')]:_0x41d6fe[_0xeaf9('0x4a')];_0xc69d84['order']=qs[_0xeaf9('0x6b')](_0x44af0f[_0xeaf9('0x43')]['sort']);_0xc69d84['where']=qs['filters'](_['pick'](_0x44af0f[_0xeaf9('0x43')],_0x41d6fe[_0xeaf9('0x45')]));if(_0x44af0f[_0xeaf9('0x43')]['filter']){_0xc69d84[_0xeaf9('0x50')]=_['merge'](_0xc69d84[_0xeaf9('0x50')],{'$or':_['map'](_0xc69d84[_0xeaf9('0x47')],function(_0x1c4a0e){var _0x385a93={};_0x385a93[_0x1c4a0e]={'$like':'%'+_0x44af0f['query'][_0xeaf9('0x52')]+'%'};return _0x385a93;})});}_0xc69d84=_[_0xeaf9('0x51')]({},_0xc69d84,_0x44af0f[_0xeaf9('0x53')]);return _0x4be25a['getApplications'](_0xc69d84);}})[_0xeaf9('0x22')](function(_0x509ccb){if(_0x509ccb){_0x2fad53=_0x509ccb[_0xeaf9('0x49')];if(!_0x44af0f[_0xeaf9('0x43')][_0xeaf9('0x4b')](_0xeaf9('0x4c'))){_0xc69d84['limit']=qs[_0xeaf9('0x4d')](_0x44af0f[_0xeaf9('0x43')]['limit']);_0xc69d84[_0xeaf9('0x32')]=qs[_0xeaf9('0x32')](_0x44af0f[_0xeaf9('0x43')][_0xeaf9('0x32')]);}return _0x4be25a[_0xeaf9('0xbf')](_0xc69d84);}})[_0xeaf9('0x22')](function(_0x4f890b){if(_0x4f890b){return _0x4f890b?{'count':_0x2fad53,'rows':_0x4f890b}:null;}})[_0xeaf9('0x22')](respondWithResult(_0x1b2097,null))[_0xeaf9('0x2c')](handleError(_0x1b2097,null));};exports[_0xeaf9('0xc0')]=function(_0x43de75,_0x54ca87,_0x38c8a0){var _0x2c0dfe={'raw':![],'where':{}};var _0x25617c={};var _0x33a97a={'count':0x0,'rows':[]};return db[_0xeaf9('0x54')][_0xeaf9('0x68')]({'where':{'id':_0x43de75[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x54ca87,null))[_0xeaf9('0x22')](function(_0x37ae4d){if(_0x37ae4d){_0x25617c[_0xeaf9('0x4a')]=_[_0xeaf9('0x44')](db['SmsInteraction']['rawAttributes']);_0x25617c[_0xeaf9('0x43')]=_[_0xeaf9('0x44')](_0x43de75[_0xeaf9('0x43')]);_0x25617c['filters']=_[_0xeaf9('0x46')](_0x25617c[_0xeaf9('0x4a')],_0x25617c[_0xeaf9('0x43')]);_0x2c0dfe[_0xeaf9('0x47')]=_[_0xeaf9('0x46')](_0x25617c[_0xeaf9('0x4a')],qs[_0xeaf9('0x48')](_0x43de75[_0xeaf9('0x43')][_0xeaf9('0x48')]));_0x2c0dfe[_0xeaf9('0x47')]=_0x2c0dfe['attributes'][_0xeaf9('0x49')]?_0x2c0dfe[_0xeaf9('0x47')]:_0x25617c[_0xeaf9('0x4a')];if(!_0x43de75['query']['hasOwnProperty'](_0xeaf9('0x4c'))){_0x2c0dfe['limit']=qs[_0xeaf9('0x4d')](_0x43de75[_0xeaf9('0x43')][_0xeaf9('0x4d')]);_0x2c0dfe[_0xeaf9('0x32')]=qs[_0xeaf9('0x32')](_0x43de75[_0xeaf9('0x43')]['offset']);}_0x2c0dfe[_0xeaf9('0x4e')]=qs[_0xeaf9('0x6b')](_0x43de75[_0xeaf9('0x43')][_0xeaf9('0x6b')]);_0x2c0dfe[_0xeaf9('0x50')]=qs[_0xeaf9('0x45')](_[_0xeaf9('0x4f')](_0x43de75[_0xeaf9('0x43')],_0x25617c[_0xeaf9('0x45')]));_0x2c0dfe['where'][_0xeaf9('0x66')]=_0x37ae4d['id'];if(_0x43de75[_0xeaf9('0x43')]['filter']){_0x2c0dfe[_0xeaf9('0x50')]=_['merge'](_0x2c0dfe[_0xeaf9('0x50')],{'$or':_['map'](_0x2c0dfe['attributes'],function(_0x1b99b9){var _0x292d2a={};_0x292d2a[_0x1b99b9]={'$like':'%'+_0x43de75[_0xeaf9('0x43')][_0xeaf9('0x52')]+'%'};return _0x292d2a;})});}_0x2c0dfe=_[_0xeaf9('0x51')]({},_0x2c0dfe,_0x43de75['options']);return db[_0xeaf9('0xa1')]['count']({'where':_0x2c0dfe[_0xeaf9('0x50')]})[_0xeaf9('0x22')](function(_0x1aea70){_0x33a97a[_0xeaf9('0x31')]=_0x1aea70;if(_0x43de75[_0xeaf9('0x43')][_0xeaf9('0x55')]){_0x2c0dfe[_0xeaf9('0x56')]=[{'model':db['CmContact'],'as':_0xeaf9('0xc1'),'required':![]},{'model':db[_0xeaf9('0xad')],'as':_0xeaf9('0xc2'),'attributes':[_0xeaf9('0x3c'),_0xeaf9('0xc3'),_0xeaf9('0xc4')],'required':![]},{'model':db['Tag'],'as':_0xeaf9('0xc5'),'attributes':['id','name',_0xeaf9('0xc6')],'where':_0x43de75[_0xeaf9('0x43')][_0xeaf9('0xc7')]?{'id':_0x43de75[_0xeaf9('0x43')]['tag']}:undefined,'required':_0x43de75[_0xeaf9('0x43')][_0xeaf9('0xc7')]?!![]:![]}];}return db[_0xeaf9('0xa1')]['findAll'](_0x2c0dfe);})[_0xeaf9('0x22')](function(_0x3417ed){_0x33a97a['rows']=_0x3417ed;return _0x33a97a;});}})['then'](respondWithFilteredResult(_0x54ca87,_0x2c0dfe))[_0xeaf9('0x2c')](handleError(_0x54ca87,null));};exports[_0xeaf9('0x3d')]=function(_0x59f650,_0x312e79,_0x387805){var _0x1392cc,_0x16b026,_0x9d1728;if(_[_0xeaf9('0x98')](_0x59f650[_0xeaf9('0x63')][_0xeaf9('0x63')])||_0x59f650[_0xeaf9('0x63')][_0xeaf9('0x63')]===''){throw new db[(_0xeaf9('0x7a'))][(_0xeaf9('0x7b'))](_0xeaf9('0xc8'));}if(_['isNil'](_0x59f650[_0xeaf9('0x63')]['to'])){throw new db['Sequelize'][(_0xeaf9('0x7b'))](_0xeaf9('0xc9'));}_0x1392cc=_0x59f650[_0xeaf9('0x63')]['to'];return db[_0xeaf9('0x54')][_0xeaf9('0x5b')]({'where':{'id':_0x59f650['params']['id']},'include':[{'model':db[_0xeaf9('0x9c')],'as':_0xeaf9('0xca'),'include':[{'model':db[_0xeaf9('0x79')],'as':'Contacts','where':{'mobile':_0x1392cc},'limit':0x1,'order':[[_0xeaf9('0x7f'),_0xeaf9('0x9e')]]}]}]})[_0xeaf9('0x22')](handleEntityNotFound(_0x312e79,null))['then'](function(_0x853f87){if(_0x853f87&&_0x853f87[_0xeaf9('0xca')]){_0x16b026=_0x853f87['get']({'plain':!![]});if(_0x16b026['List']&&_0x16b026[_0xeaf9('0xca')][_0xeaf9('0x9d')][_0xeaf9('0x49')]){return _0x16b026[_0xeaf9('0xca')][_0xeaf9('0x9d')][0x0];}return db[_0xeaf9('0x79')][_0xeaf9('0x5c')](_[_0xeaf9('0x1b')](_0x59f650['body'],{'firstName':_0x1392cc,'mobile':_0x1392cc,'phone':_0x1392cc,'ListId':_0x16b026[_0xeaf9('0x80')]}));}})[_0xeaf9('0x22')](handleEntityNotFound(_0x312e79,null))['then'](function(_0x144b20){if(_0x144b20){_0x9d1728=_0x144b20;return db[_0xeaf9('0xa1')][_0xeaf9('0x5b')]({'where':{'ContactId':_0x9d1728['id'],'closed':![],'SmsAccountId':_0x16b026['id']}})['then'](function(_0x153ef2){if(_0x153ef2){return[_0x153ef2,![]];}return db[_0xeaf9('0xa1')][_0xeaf9('0x5c')]({'UserId':_0x59f650[_0xeaf9('0x5d')]['id'],'ContactId':_0x9d1728['id'],'SmsAccountId':_0x16b026['id'],'phone':_0x1392cc,'firstMsgDirection':_0xeaf9('0xcb'),'Messages':[_['merge'](_0x59f650[_0xeaf9('0x63')],{'read':![],'body':_0x59f650[_0xeaf9('0x63')][_0xeaf9('0x63')],'phone':_0x1392cc,'SmsAccountId':_0x16b026['id'],'UserId':_0x59f650[_0xeaf9('0x5d')]['id'],'ContactId':_0x9d1728['id']})]},{'include':[{'model':db[_0xeaf9('0xaa')],'as':_0xeaf9('0xcc')}]})['then'](function(_0x544193){return[_0x544193,!![]];});});}})[_0xeaf9('0xa2')](function(_0x2f7896,_0x2bd188){if(_0x2bd188){return _0x2f7896;}return db[_0xeaf9('0xaa')]['create'](_[_0xeaf9('0x51')](_0x59f650[_0xeaf9('0x63')],{'read':![],'body':_0x59f650['body'][_0xeaf9('0x63')],'phone':_0x1392cc,'SmsAccountId':_0x16b026['id'],'SmsInteractionId':_0x2f7896['id'],'UserId':_0x59f650['user']['id'],'ContactId':_0x9d1728['id']}))[_0xeaf9('0x22')](function(_0x9a03b3){_0x2f7896['dataValues'][_0xeaf9('0xcc')]=[];_0x2f7896[_0xeaf9('0xcd')][_0xeaf9('0xcc')][_0xeaf9('0xa5')](_0x9a03b3[_0xeaf9('0xcd')]);return _0x2f7896;});})[_0xeaf9('0x22')](respondWithResult(_0x312e79,null))[_0xeaf9('0x2c')](handleError(_0x312e79,null));};exports['status']=function(_0x15bc03,_0x1fe7a9,_0x1f521c){if(_0x15bc03['body']['id']){delete _0x15bc03['body']['id'];}var _0x54cd85,_0x5d7754,_0x61f3da;return db[_0xeaf9('0x54')][_0xeaf9('0x5b')]({'where':{'id':_0x15bc03[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x1fe7a9,null))[_0xeaf9('0x22')](function(_0x370782){if(_0x370782){_0x61f3da=_0x370782;logger['debug'](_0xeaf9('0xb1'),'status',_0xeaf9('0xce'),_0x370782['type'],util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));switch(_0x370782[_0xeaf9('0x41')]){case _0xeaf9('0x86'):if(_0x15bc03['body']['skebby_dispatch_id']&&_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x2e')]){_0x5d7754=_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x2e')];return db[_0xeaf9('0xaa')][_0xeaf9('0x5b')]({'where':{'messageId':_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0xd0')]}});}break;case _0xeaf9('0x89'):if(_0x15bc03['body'][_0xeaf9('0xd1')]&&_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0xd2')]){_0x5d7754=_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0xd2')];return db[_0xeaf9('0xaa')]['find']({'where':{'messageId':_0x15bc03['body'][_0xeaf9('0xd1')]}});}break;case _0xeaf9('0xd3'):if(_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x8a')]&&_0x15bc03[_0xeaf9('0x63')]['status_code']){_0x5d7754=_0x15bc03['body'][_0xeaf9('0xd4')];return db['SmsMessage'][_0xeaf9('0x5b')]({'where':{'messageId':_0x15bc03[_0xeaf9('0x63')]['message_id']}});}break;case _0xeaf9('0x8e'):var _0x22d058=_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x8f')][0x0];if(_0x22d058['messageId']&&_0x22d058[_0xeaf9('0x2e')][_0xeaf9('0xd5')]===_0xeaf9('0xd6')){_0x5d7754=_0x22d058[_0xeaf9('0x2e')]['groupName'];return db['SmsMessage'][_0xeaf9('0x5b')]({'where':{'messageId':_0x22d058[_0xeaf9('0x84')]}});}break;case _0xeaf9('0xd7'):if(_0x15bc03[_0xeaf9('0x63')]['messageId']&&_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x2e')]){_0x5d7754=_0x15bc03['body'][_0xeaf9('0x2e')];return db[_0xeaf9('0xaa')][_0xeaf9('0x5b')]({'where':{'messageId':_0x15bc03['body']['messageId']}});}break;case _0xeaf9('0x96'):if(_0x15bc03['body'][0x0][_0xeaf9('0x2a')]['id']){_0x5d7754=_0x15bc03['body'][0x0]['type'];return db[_0xeaf9('0xaa')][_0xeaf9('0x5b')]({'where':{'messageId':_0x15bc03['body'][0x0][_0xeaf9('0x2a')]['id']}});}break;case _0xeaf9('0xd8'):if(_0x15bc03['body'][_0xeaf9('0xd9')]&&_0x15bc03[_0xeaf9('0x63')]['status']){_0x5d7754=_0x15bc03['body'][_0xeaf9('0x2e')];return db[_0xeaf9('0xaa')][_0xeaf9('0x5b')]({'where':{'messageId':_0x15bc03['body'][_0xeaf9('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x1fe7a9,null))['then'](function(_0x3667f0){if(_0x3667f0){_0x54cd85=_0x3667f0;switch(_0x61f3da[_0xeaf9('0x41')]){case _0xeaf9('0x86'):if(_0x5d7754===_0xeaf9('0xd6')){return _0x54cd85[_0xeaf9('0x37')]({'read':!![]});}else{logger[_0xeaf9('0x27')](_0xeaf9('0xb1'),_0xeaf9('0x2e'),_0xeaf9('0x86'),util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case _0xeaf9('0x89'):if(_0x5d7754==='1'){return _0x54cd85[_0xeaf9('0x37')]({'read':!![]});}else{logger[_0xeaf9('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xeaf9('0x86'),util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0xda')]&&_0x5d7754>=0xc8&&_0x5d7754<=0xce){return _0x54cd85[_0xeaf9('0x37')]({'read':!![]});}else{logger[_0xeaf9('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xeaf9('0xd3'),util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xdf4729=_0x15bc03[_0xeaf9('0x63')][_0xeaf9('0x8f')][0x0];if(_0xdf4729[_0xeaf9('0x2e')]['groupName']===_0xeaf9('0xd6')){return _0x54cd85['update']({'read':!![]});}else{logger['error'](_0xeaf9('0xb1'),_0xeaf9('0x2e'),_0xeaf9('0x8e'),util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case _0xeaf9('0xd7'):if(_0x5d7754==_0xeaf9('0xdb')||_0x5d7754==_0xeaf9('0xdc')){return _0x54cd85['update']({'read':!![]});}else{logger[_0xeaf9('0x27')](_0xeaf9('0xb1'),_0xeaf9('0x2e'),'clickatell',util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case _0xeaf9('0x96'):if(_0x5d7754==_0xeaf9('0xdd')){return _0x54cd85[_0xeaf9('0x37')]({'read':!![]});}else{logger['error'](_0xeaf9('0xb1'),'status',_0xeaf9('0x96'),util[_0xeaf9('0xcf')](_0x15bc03[_0xeaf9('0x63')],{'showHidden':![],'depth':null}));}break;case _0xeaf9('0xd8'):if(_0x5d7754===_0xeaf9('0xde')||_0x5d7754===_0xeaf9('0xdf')){return _0x54cd85[_0xeaf9('0x37')]({'read':!![]});}else{logger[_0xeaf9('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeaf9('0x2e'),_0xeaf9('0xd8'),util[_0xeaf9('0xcf')](_0x15bc03['body'],{'showHidden':![],'depth':null}));}break;}return _0x54cd85;}})[_0xeaf9('0x22')](respondWithResult(_0x1fe7a9,null))['catch'](handleError(_0x1fe7a9,null));};exports[_0xeaf9('0xe0')]=function(_0x5577a2,_0x44d700,_0xb1d4e1){var _0x177baa,_0x366784,_0x58e9f4;return db[_0xeaf9('0x54')][_0xeaf9('0x5b')]({'where':{'id':_0x5577a2[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x44d700,null))[_0xeaf9('0x22')](function(_0x1c8fb7){if(_0x1c8fb7){_0x58e9f4=_0x1c8fb7;logger[_0xeaf9('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xeaf9('0x2e'),_0xeaf9('0xce'),_0x1c8fb7[_0xeaf9('0x41')],util[_0xeaf9('0xcf')](_0x5577a2[_0xeaf9('0x43')],{'showHidden':![],'depth':null}));switch(_0x1c8fb7[_0xeaf9('0x41')]){case _0xeaf9('0x91'):if(_0x5577a2[_0xeaf9('0x43')][_0xeaf9('0xe1')]&&_0x5577a2['query'][_0xeaf9('0xe2')]){_0x366784=_0x5577a2['query'][_0xeaf9('0xe2')];return db[_0xeaf9('0xaa')][_0xeaf9('0x5b')]({'where':{'messageId':_0x5577a2[_0xeaf9('0x43')][_0xeaf9('0xe1')]}});}break;}}})[_0xeaf9('0x22')](handleEntityNotFound(_0x44d700,null))['then'](function(_0x251dda){if(_0x251dda){_0x177baa=_0x251dda;switch(_0x58e9f4['type']){case _0xeaf9('0x91'):if(_0x366784==='2'||_0x366784==='6'){return _0x177baa[_0xeaf9('0x37')]({'read':!![]});}else{logger[_0xeaf9('0x27')](_0xeaf9('0xb1'),_0xeaf9('0x2e'),'csc',util[_0xeaf9('0xcf')](_0x5577a2[_0xeaf9('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x177baa;}})[_0xeaf9('0x22')](respondWithResult(_0x44d700,null))[_0xeaf9('0x2c')](handleError(_0x44d700,null));};exports['addAgents']=function(_0x5a6cb7,_0x2e5a29,_0x212143){return db[_0xeaf9('0x54')][_0xeaf9('0x5b')]({'where':{'id':_0x5a6cb7[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x2e5a29,null))['then'](function(_0x50ee91){if(_0x50ee91){return _0x50ee91[_0xeaf9('0xe3')](_0x5a6cb7[_0xeaf9('0x63')]['ids'],_[_0xeaf9('0xe4')](_0x5a6cb7[_0xeaf9('0x63')],['ids','id'])||{})[_0xeaf9('0xa2')](function(_0x326176){for(var _0x1e2da6=0x0;_0x1e2da6<_0x5a6cb7[_0xeaf9('0x63')][_0xeaf9('0x6e')][_0xeaf9('0x49')];_0x1e2da6+=0x1){socket[_0xeaf9('0xe5')](_0xeaf9('0xe6'),{'UserId':Number(_0x5a6cb7[_0xeaf9('0x63')][_0xeaf9('0x6e')][_0x1e2da6]),'SmsAccountId':Number(_0x5a6cb7[_0xeaf9('0x59')]['id'])});}return _0x326176;});}})[_0xeaf9('0x22')](respondWithResult(_0x2e5a29,null))[_0xeaf9('0x2c')](handleError(_0x2e5a29,null));};exports[_0xeaf9('0xe7')]=function(_0x29b118,_0x4ec05c,_0x49454c){return db[_0xeaf9('0x54')]['find']({'where':{'id':_0x29b118['params']['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x4ec05c,null))[_0xeaf9('0x22')](function(_0x2de83d){if(_0x2de83d){return _0x2de83d[_0xeaf9('0xe7')](_0x29b118['query']['ids'])[_0xeaf9('0x22')](function(){if(_[_0xeaf9('0xe8')](_0x29b118[_0xeaf9('0x43')][_0xeaf9('0x6e')])){for(var _0x54bf7d=0x0;_0x54bf7d<_0x29b118['query']['ids'][_0xeaf9('0x49')];_0x54bf7d+=0x1){socket[_0xeaf9('0xe5')](_0xeaf9('0xe9'),{'UserId':Number(_0x29b118[_0xeaf9('0x43')][_0xeaf9('0x6e')][_0x54bf7d]),'SmsAccountId':Number(_0x29b118['params']['id'])});}}else{socket[_0xeaf9('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x29b118[_0xeaf9('0x43')][_0xeaf9('0x6e')]),'SmsAccountId':Number(_0x29b118[_0xeaf9('0x59')]['id'])});}});}})[_0xeaf9('0x22')](respondWithStatusCode(_0x4ec05c,null))['catch'](handleError(_0x4ec05c,null));};exports[_0xeaf9('0xea')]=function(_0x22af22,_0x4a9fad,_0x4a8a24){var _0x2759fb={};var _0x5050ff={};var _0x224caa;var _0x4eaaf0;return db['SmsAccount'][_0xeaf9('0x68')]({'where':{'id':_0x22af22[_0xeaf9('0x59')]['id']}})[_0xeaf9('0x22')](handleEntityNotFound(_0x4a9fad,null))['then'](function(_0x50136c){if(_0x50136c){_0x224caa=_0x50136c;_0x5050ff[_0xeaf9('0x4a')]=_[_0xeaf9('0x44')](db['User'][_0xeaf9('0x6a')]);_0x5050ff[_0xeaf9('0x43')]=_[_0xeaf9('0x44')](_0x22af22[_0xeaf9('0x43')]);_0x5050ff['filters']=_[_0xeaf9('0x46')](_0x5050ff[_0xeaf9('0x4a')],_0x5050ff['query']);_0x2759fb[_0xeaf9('0x47')]=_[_0xeaf9('0x46')](_0x5050ff[_0xeaf9('0x4a')],qs['fields'](_0x22af22[_0xeaf9('0x43')][_0xeaf9('0x48')]));_0x2759fb[_0xeaf9('0x47')]=_0x2759fb[_0xeaf9('0x47')]['length']?_0x2759fb['attributes']:_0x5050ff['model'];_0x2759fb[_0xeaf9('0x4e')]=qs[_0xeaf9('0x6b')](_0x22af22[_0xeaf9('0x43')][_0xeaf9('0x6b')]);_0x2759fb[_0xeaf9('0x50')]=qs[_0xeaf9('0x45')](_[_0xeaf9('0x4f')](_0x22af22['query'],_0x5050ff[_0xeaf9('0x45')]));if(_0x22af22[_0xeaf9('0x43')]['filter']){_0x2759fb[_0xeaf9('0x50')]=_[_0xeaf9('0x51')](_0x2759fb['where'],{'$or':_[_0xeaf9('0x40')](_0x2759fb[_0xeaf9('0x47')],function(_0x368af7){var _0x484d78={};_0x484d78[_0x368af7]={'$like':'%'+_0x22af22[_0xeaf9('0x43')]['filter']+'%'};return _0x484d78;})});}_0x2759fb=_['merge']({},_0x2759fb,_0x22af22[_0xeaf9('0x53')]);return _0x224caa['getAgents'](_0x2759fb);}})[_0xeaf9('0x22')](function(_0x488a0a){if(_0x488a0a){_0x4eaaf0=_0x488a0a[_0xeaf9('0x49')];if(!_0x22af22[_0xeaf9('0x43')][_0xeaf9('0x4b')](_0xeaf9('0x4c'))){_0x2759fb[_0xeaf9('0x4d')]=qs[_0xeaf9('0x4d')](_0x22af22[_0xeaf9('0x43')][_0xeaf9('0x4d')]);_0x2759fb['offset']=qs[_0xeaf9('0x32')](_0x22af22[_0xeaf9('0x43')][_0xeaf9('0x32')]);}return _0x224caa[_0xeaf9('0xea')](_0x2759fb);}})[_0xeaf9('0x22')](function(_0x1d02f1){if(_0x1d02f1){return _0x1d02f1?{'count':_0x4eaaf0,'rows':_0x1d02f1}:null;}})['then'](respondWithResult(_0x4a9fad,null))[_0xeaf9('0x2c')](handleError(_0x4a9fad,null));}; \ No newline at end of file +var _0x681b=['no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','text','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','startRouting','Start','receiveMessage','entity\x20found','stringify','set','Content-Type','text/xml','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','fullname','internal','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','bandwidth','redif','error_code','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','get','SmsAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','Sequelize','ValidationError'];(function(_0x2ef740,_0x1c81be){var _0x50214b=function(_0x1b4413){while(--_0x1b4413){_0x2ef740['push'](_0x2ef740['shift']());}};_0x50214b(++_0x1c81be);}(_0x681b,0x6b));var _0xb681=function(_0x1e6a64,_0x1001d5){_0x1e6a64=_0x1e6a64-0x0;var _0x2fc43c=_0x681b[_0x1e6a64];return _0x2fc43c;};'use strict';var emlformat=require(_0xb681('0x0'));var rimraf=require(_0xb681('0x1'));var zipdir=require(_0xb681('0x2'));var jsonpatch=require(_0xb681('0x3'));var rp=require('request-promise');var moment=require(_0xb681('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb681('0x5'));var util=require(_0xb681('0x6'));var path=require(_0xb681('0x7'));var sox=require(_0xb681('0x8'));var csv=require(_0xb681('0x9'));var ejs=require(_0xb681('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb681('0xb'));var squel=require(_0xb681('0xc'));var crypto=require(_0xb681('0xd'));var jsforce=require(_0xb681('0xe'));var deskjs=require(_0xb681('0xf'));var toCsv=require(_0xb681('0x9'));var querystring=require('querystring');var Papa=require(_0xb681('0x10'));var Redis=require(_0xb681('0x11'));var authService=require(_0xb681('0x12'));var qs=require(_0xb681('0x13'));var as=require(_0xb681('0x14'));var hardwareService=require(_0xb681('0x15'));var logger=require(_0xb681('0x16'))(_0xb681('0x17'));var utils=require('../../config/utils');var config=require(_0xb681('0x18'));var licenseUtil=require(_0xb681('0x19'));var db=require(_0xb681('0x1a'))['db'];config[_0xb681('0x1b')]=_[_0xb681('0x1c')](config['redis'],{'host':_0xb681('0x1d'),'port':0x18eb});var socket=require(_0xb681('0x1e'))(new Redis(config[_0xb681('0x1b')]));require('./smsAccount.socket')[_0xb681('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb681('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x509163,_0x28a100,_0x1b697b,_0x3be0b7){return new BPromise(function(_0x41f90e,_0xc90e18){var _0x4339aa=_0x3be0b7||client;return _0x4339aa[_0xb681('0x21')](_0x509163,_0x1b697b)[_0xb681('0x22')](function(_0x422a08){logger[_0xb681('0x23')](_0xb681('0x24'),_0x28a100,'request\x20sent');logger[_0xb681('0x25')](_0xb681('0x26'),_0x28a100,_0xb681('0x27'),JSON['stringify'](_0x422a08));if(_0x422a08[_0xb681('0x28')]){if(_0x422a08['error'][_0xb681('0x29')]===0x1f4){logger[_0xb681('0x28')](_0xb681('0x24'),_0x28a100,_0x422a08[_0xb681('0x28')]['message']);return _0xc90e18(_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);}logger[_0xb681('0x28')]('SmsAccount,\x20%s,\x20%s',_0x28a100,_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);return _0x41f90e(_0x422a08[_0xb681('0x28')][_0xb681('0x2a')]);}else{logger[_0xb681('0x23')](_0xb681('0x24'),_0x28a100,_0xb681('0x27'));_0x41f90e(_0x422a08[_0xb681('0x2b')][_0xb681('0x2a')]);}})[_0xb681('0x2c')](function(_0x1b448c){logger[_0xb681('0x28')](_0xb681('0x24'),_0x28a100,_0x1b448c);_0xc90e18(_0x1b448c);});});}function respondWithStatusCode(_0x243c81,_0x4e866b){_0x4e866b=_0x4e866b||0xcc;return function(_0x445db6){if(_0x445db6){return _0x243c81[_0xb681('0x2d')](_0x4e866b);}return _0x243c81[_0xb681('0x2e')](_0x4e866b)[_0xb681('0x2f')]();};}function respondWithResult(_0x2026ad,_0x114cfd){_0x114cfd=_0x114cfd||0xc8;return function(_0x357006){if(_0x357006){return _0x2026ad['status'](_0x114cfd)[_0xb681('0x30')](_0x357006);}};}function respondWithFilteredResult(_0x37b715,_0x2b11d7){return function(_0x4d3bf3){if(_0x4d3bf3){var _0x290817=typeof _0x2b11d7[_0xb681('0x31')]==='undefined'&&typeof _0x2b11d7[_0xb681('0x32')]===_0xb681('0x33');var _0x40f4df=_0x4d3bf3[_0xb681('0x34')];var _0x37897d=_0x290817?0x0:_0x2b11d7[_0xb681('0x31')];var _0x39ecf0=_0x290817?_0x4d3bf3['count']:_0x2b11d7[_0xb681('0x31')]+_0x2b11d7['limit'];var _0x248b03;if(_0x39ecf0>=_0x40f4df){_0x39ecf0=_0x40f4df;_0x248b03=0xc8;}else{_0x248b03=0xce;}_0x37b715[_0xb681('0x2e')](_0x248b03);return _0x37b715['set'](_0xb681('0x35'),_0x37897d+'-'+_0x39ecf0+'/'+_0x40f4df)['json'](_0x4d3bf3);}return null;};}function patchUpdates(_0x223d4f){return function(_0x280dc6){try{jsonpatch[_0xb681('0x36')](_0x280dc6,_0x223d4f,!![]);}catch(_0x4603f6){return BPromise[_0xb681('0x37')](_0x4603f6);}return _0x280dc6['save']();};}function saveUpdates(_0x1820c8,_0x3cab01){return function(_0x209573){if(_0x209573){return _0x209573['update'](_0x1820c8)[_0xb681('0x22')](function(_0x272796){return _0x272796;});}return null;};}function removeEntity(_0x2e42d3,_0x41ee80){return function(_0x3c4e68){if(_0x3c4e68){return _0x3c4e68['destroy']()['then'](function(){var _0x9bb0db=_0x3c4e68[_0xb681('0x38')]({'plain':!![]});var _0x205ec7=_0xb681('0x39');return db[_0xb681('0x3a')][_0xb681('0x3b')]({'where':{'type':_0x205ec7,'resourceId':_0x9bb0db['id']}})['then'](function(){return _0x3c4e68;});})[_0xb681('0x22')](function(){_0x2e42d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2afc39,_0x38461d){return function(_0x4e526f){if(!_0x4e526f){_0x2afc39[_0xb681('0x2d')](0x194);}return _0x4e526f;};}function handleError(_0x30092d,_0x3a82a8){_0x3a82a8=_0x3a82a8||0x1f4;return function(_0x3c9d25){logger[_0xb681('0x28')](_0x3c9d25['stack']);if(_0x3c9d25[_0xb681('0x3c')]){delete _0x3c9d25[_0xb681('0x3c')];}_0x30092d[_0xb681('0x2e')](_0x3a82a8)[_0xb681('0x3d')](_0x3c9d25);};}exports['index']=function(_0x108fd9,_0x10f735){var _0x3c213a={'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]},_0x545915={},_0x1d5730={'count':0x0,'rows':[]};var _0x40de8d=_['map'](db[_0xb681('0x40')][_0xb681('0x41')],function(_0x240213){return{'name':_0x240213[_0xb681('0x42')],'type':_0x240213[_0xb681('0x43')][_0xb681('0x44')]};});_0x545915[_0xb681('0x45')]=_[_0xb681('0x46')](_0x40de8d,_0xb681('0x3c'));_0x545915[_0xb681('0x47')]=_[_0xb681('0x48')](_0x108fd9[_0xb681('0x47')]);_0x545915[_0xb681('0x49')]=_['intersection'](_0x545915[_0xb681('0x45')],_0x545915[_0xb681('0x47')]);_0x3c213a[_0xb681('0x4a')]=_['intersection'](_0x545915['model'],qs[_0xb681('0x4b')](_0x108fd9[_0xb681('0x47')]['fields']));_0x3c213a[_0xb681('0x4a')]=_0x3c213a[_0xb681('0x4a')][_0xb681('0x4c')]?_0x3c213a['attributes']:_0x545915['model'];if(!_0x108fd9[_0xb681('0x47')]['hasOwnProperty'](_0xb681('0x4d'))){_0x3c213a[_0xb681('0x32')]=qs['limit'](_0x108fd9['query'][_0xb681('0x32')]);_0x3c213a[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x108fd9[_0xb681('0x47')][_0xb681('0x31')]);}_0x3c213a[_0xb681('0x4e')]=qs[_0xb681('0x4f')](_0x108fd9['query'][_0xb681('0x4f')]);_0x3c213a[_0xb681('0x50')]=qs[_0xb681('0x49')](_[_0xb681('0x51')](_0x108fd9[_0xb681('0x47')],_0x545915[_0xb681('0x49')]),_0x40de8d);if(_0x108fd9[_0xb681('0x47')][_0xb681('0x52')]){_0x3c213a[_0xb681('0x50')]=_[_0xb681('0x53')](_0x3c213a[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x40de8d,function(_0x11475f){if(_0x11475f[_0xb681('0x43')]!==_0xb681('0x54')){var _0x416d53={};_0x416d53[_0x11475f[_0xb681('0x3c')]]={'$like':'%'+_0x108fd9['query'][_0xb681('0x52')]+'%'};return _0x416d53;}})});}_0x3c213a=_[_0xb681('0x53')]({},_0x3c213a,_0x108fd9['options']);var _0x20eac1={'where':_0x3c213a['where']};return db[_0xb681('0x40')][_0xb681('0x34')](_0x20eac1)[_0xb681('0x22')](function(_0x1d62c4){_0x1d5730[_0xb681('0x34')]=_0x1d62c4;if(_0x108fd9[_0xb681('0x47')][_0xb681('0x55')]){_0x3c213a[_0xb681('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0xb681('0x57')](_0x3c213a);})[_0xb681('0x22')](function(_0x166185){_0x1d5730[_0xb681('0x58')]=_0x166185;return _0x1d5730;})[_0xb681('0x22')](respondWithFilteredResult(_0x10f735,_0x3c213a))['catch'](handleError(_0x10f735,null));};exports[_0xb681('0x59')]=function(_0x23913d,_0x324ffe){var _0x38e9aa={'raw':![],'where':{'id':_0x23913d[_0xb681('0x5a')]['id']},'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]},_0x2cc525={};_0x2cc525[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0x40')][_0xb681('0x41')]);_0x2cc525[_0xb681('0x47')]=_[_0xb681('0x48')](_0x23913d['query']);_0x2cc525[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x2cc525['model'],_0x2cc525[_0xb681('0x47')]);_0x38e9aa[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x2cc525[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x23913d[_0xb681('0x47')][_0xb681('0x4b')]));_0x38e9aa[_0xb681('0x4a')]=_0x38e9aa[_0xb681('0x4a')][_0xb681('0x4c')]?_0x38e9aa['attributes']:_0x2cc525[_0xb681('0x45')];if(_0x23913d[_0xb681('0x47')][_0xb681('0x55')]){_0x38e9aa[_0xb681('0x56')]=[{'all':!![]}];}_0x38e9aa=_[_0xb681('0x53')]({},_0x38e9aa,_0x23913d[_0xb681('0x5c')]);return db[_0xb681('0x40')]['find'](_0x38e9aa)[_0xb681('0x22')](handleEntityNotFound(_0x324ffe,null))[_0xb681('0x22')](respondWithResult(_0x324ffe,null))[_0xb681('0x2c')](handleError(_0x324ffe,null));};exports['create']=function(_0x4b1d9c,_0x15fe4e){return db[_0xb681('0x40')][_0xb681('0x5d')](_0x4b1d9c[_0xb681('0x5e')],{})[_0xb681('0x22')](function(_0x136987){var _0x4ecb2e=_0x4b1d9c[_0xb681('0x5f')][_0xb681('0x38')]({'plain':!![]});if(!_0x4ecb2e)throw new Error(_0xb681('0x60'));if(_0x4ecb2e[_0xb681('0x61')]===_0xb681('0x5f')){var _0x4ac6cc=_0x136987['get']({'plain':!![]});var _0x1e4483=_0xb681('0x39');return db[_0xb681('0x62')][_0xb681('0x63')]({'where':{'name':_0x1e4483,'userProfileId':_0x4ecb2e[_0xb681('0x64')]},'raw':!![]})[_0xb681('0x22')](function(_0x46ecb2){if(_0x46ecb2&&_0x46ecb2[_0xb681('0x65')]===0x0){return db[_0xb681('0x3a')][_0xb681('0x5d')]({'name':_0x4ac6cc[_0xb681('0x3c')],'resourceId':_0x4ac6cc['id'],'type':_0x46ecb2[_0xb681('0x3c')],'sectionId':_0x46ecb2['id']},{})[_0xb681('0x22')](function(){return _0x136987;});}else{return _0x136987;}})[_0xb681('0x2c')](function(_0x5d19ee){logger[_0xb681('0x28')](_0xb681('0x66'),_0x5d19ee);throw _0x5d19ee;});}return _0x136987;})[_0xb681('0x22')](respondWithResult(_0x15fe4e,0xc9))['catch'](handleError(_0x15fe4e,null));};exports[_0xb681('0x67')]=function(_0x28c735,_0x34fc65){if(_0x28c735['body']['id']){delete _0x28c735[_0xb681('0x5e')]['id'];}return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x28c735[_0xb681('0x5a')]['id']},'include':[{'model':db[_0xb681('0x3e')],'as':_0xb681('0x3f')}]})[_0xb681('0x22')](handleEntityNotFound(_0x34fc65,null))[_0xb681('0x22')](saveUpdates(_0x28c735[_0xb681('0x5e')],null))[_0xb681('0x22')](respondWithResult(_0x34fc65,null))[_0xb681('0x2c')](handleError(_0x34fc65,null));};exports[_0xb681('0x3b')]=function(_0x31fa32,_0x2eb342){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x31fa32[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2eb342,null))[_0xb681('0x22')](removeEntity(_0x2eb342,null))[_0xb681('0x2c')](handleError(_0x2eb342,null));};exports['describe']=function(_0x592d54,_0x3232bb){return db[_0xb681('0x40')][_0xb681('0x68')]()[_0xb681('0x22')](respondWithResult(_0x3232bb,null))['catch'](handleError(_0x3232bb,null));};exports[_0xb681('0x69')]=function(_0x478de9,_0x2ec566,_0x423a5d){if(_0x478de9[_0xb681('0x5e')]['id']){delete _0x478de9[_0xb681('0x5e')]['id'];}return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x478de9[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2ec566,null))[_0xb681('0x22')](function(_0x38c8b8){if(_0x38c8b8){_0x478de9[_0xb681('0x5e')][_0xb681('0x6a')]=_0x38c8b8['id'];return db[_0xb681('0x6b')][_0xb681('0x5d')](_0x478de9[_0xb681('0x5e')]);}})[_0xb681('0x22')](respondWithResult(_0x2ec566,null))[_0xb681('0x2c')](handleError(_0x2ec566,null));};exports[_0xb681('0x6c')]=function(_0x52000f,_0x5e6b1a,_0x33acbb){var _0x122046={'raw':![],'where':{}};var _0x8ab275={};var _0x33d07c={'count':0x0,'rows':[]};return db[_0xb681('0x40')]['findOne']({'where':{'id':_0x52000f[_0xb681('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e6b1a,null))['then'](function(_0x5415cb){if(_0x5415cb){_0x8ab275[_0xb681('0x45')]=_['keys'](db[_0xb681('0x6b')][_0xb681('0x41')]);_0x8ab275[_0xb681('0x47')]=_['keys'](_0x52000f['query']);_0x8ab275[_0xb681('0x49')]=_['intersection'](_0x8ab275[_0xb681('0x45')],_0x8ab275[_0xb681('0x47')]);_0x122046[_0xb681('0x4a')]=_['intersection'](_0x8ab275[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x52000f[_0xb681('0x47')][_0xb681('0x4b')]));_0x122046['attributes']=_0x122046['attributes'][_0xb681('0x4c')]?_0x122046[_0xb681('0x4a')]:_0x8ab275[_0xb681('0x45')];if(!_0x52000f['query'][_0xb681('0x6d')](_0xb681('0x4d'))){_0x122046[_0xb681('0x32')]=qs['limit'](_0x52000f[_0xb681('0x47')][_0xb681('0x32')]);_0x122046[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x52000f[_0xb681('0x47')][_0xb681('0x31')]);}_0x122046['order']=qs[_0xb681('0x4f')](_0x52000f[_0xb681('0x47')][_0xb681('0x4f')]);_0x122046['where']=qs['filters'](_[_0xb681('0x51')](_0x52000f['query'],_0x8ab275[_0xb681('0x49')]));_0x122046[_0xb681('0x50')][_0xb681('0x6a')]=_0x5415cb['id'];if(_0x52000f[_0xb681('0x47')][_0xb681('0x52')]){_0x122046[_0xb681('0x50')]=_[_0xb681('0x53')](_0x122046[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x122046['attributes'],function(_0x3da1fd){var _0x5697f3={};_0x5697f3[_0x3da1fd]={'$like':'%'+_0x52000f[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x5697f3;})});}_0x122046=_[_0xb681('0x53')]({},_0x122046,_0x52000f[_0xb681('0x5c')]);return db[_0xb681('0x6b')]['count']({'where':_0x122046[_0xb681('0x50')]})[_0xb681('0x22')](function(_0x1efba8){_0x33d07c[_0xb681('0x34')]=_0x1efba8;if(_0x52000f['query'][_0xb681('0x55')]){_0x122046['include']=[{'all':!![]}];}return db[_0xb681('0x6b')][_0xb681('0x57')](_0x122046);})['then'](function(_0x17172f){_0x33d07c['rows']=_0x17172f;return _0x33d07c;});}})[_0xb681('0x22')](respondWithFilteredResult(_0x5e6b1a,_0x122046))[_0xb681('0x2c')](handleError(_0x5e6b1a,null));};exports[_0xb681('0x6e')]=function(_0x4d36d1,_0x2be5c1,_0x434bf2){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x4d36d1[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x2be5c1,null))[_0xb681('0x22')](function(_0x30c2e5){if(_0x30c2e5){return _0x30c2e5[_0xb681('0x6e')](_0x4d36d1[_0xb681('0x47')][_0xb681('0x6f')]);}})[_0xb681('0x22')](respondWithStatusCode(_0x2be5c1,null))[_0xb681('0x2c')](handleError(_0x2be5c1,null));};exports[_0xb681('0x70')]=function(_0x3bf323,_0x4b9a9e,_0x4e8caf){if(_0x3bf323[_0xb681('0x5e')]['id']){delete _0x3bf323[_0xb681('0x5e')]['id'];}return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x3bf323[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4b9a9e,null))[_0xb681('0x22')](function(_0x2aed49){if(_0x2aed49){_0x3bf323[_0xb681('0x5e')][_0xb681('0x6a')]=_0x2aed49['id'];return db['CannedAnswer'][_0xb681('0x5d')](_0x3bf323['body']);}})[_0xb681('0x22')](respondWithResult(_0x4b9a9e,null))[_0xb681('0x2c')](handleError(_0x4b9a9e,null));};exports[_0xb681('0x71')]=function(_0x2fa0c4,_0x3d53dc,_0x4d53bf){var _0x30f146={'raw':![],'where':{}};var _0x43d0a7={};var _0x2821ba={'count':0x0,'rows':[]};return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x2fa0c4[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x3d53dc,null))['then'](function(_0x2b3249){if(_0x2b3249){_0x43d0a7['model']=_[_0xb681('0x48')](db['CannedAnswer']['rawAttributes']);_0x43d0a7[_0xb681('0x47')]=_[_0xb681('0x48')](_0x2fa0c4[_0xb681('0x47')]);_0x43d0a7[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x43d0a7[_0xb681('0x45')],_0x43d0a7['query']);_0x30f146['attributes']=_[_0xb681('0x5b')](_0x43d0a7[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x4b')]));_0x30f146['attributes']=_0x30f146[_0xb681('0x4a')][_0xb681('0x4c')]?_0x30f146['attributes']:_0x43d0a7[_0xb681('0x45')];if(!_0x2fa0c4[_0xb681('0x47')][_0xb681('0x6d')]('nolimit')){_0x30f146[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x2fa0c4['query']['limit']);_0x30f146[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x31')]);}_0x30f146['order']=qs[_0xb681('0x4f')](_0x2fa0c4[_0xb681('0x47')][_0xb681('0x4f')]);_0x30f146[_0xb681('0x50')]=qs['filters'](_[_0xb681('0x51')](_0x2fa0c4[_0xb681('0x47')],_0x43d0a7['filters']));_0x30f146[_0xb681('0x50')][_0xb681('0x6a')]=_0x2b3249['id'];if(_0x2fa0c4[_0xb681('0x47')]['filter']){_0x30f146[_0xb681('0x50')]=_[_0xb681('0x53')](_0x30f146[_0xb681('0x50')],{'$or':_['map'](_0x30f146['attributes'],function(_0x11c34c){var _0x270bd9={};_0x270bd9[_0x11c34c]={'$like':'%'+_0x2fa0c4[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x270bd9;})});}_0x30f146=_[_0xb681('0x53')]({},_0x30f146,_0x2fa0c4['options']);return db[_0xb681('0x73')][_0xb681('0x34')]({'where':_0x30f146[_0xb681('0x50')]})[_0xb681('0x22')](function(_0x298de3){_0x2821ba[_0xb681('0x34')]=_0x298de3;if(_0x2fa0c4['query']['includeAll']){_0x30f146[_0xb681('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x30f146);})[_0xb681('0x22')](function(_0x1dbb77){_0x2821ba[_0xb681('0x58')]=_0x1dbb77;return _0x2821ba;});}})['then'](respondWithFilteredResult(_0x3d53dc,_0x30f146))[_0xb681('0x2c')](handleError(_0x3d53dc,null));};exports[_0xb681('0x74')]=function(_0x162ed8,_0x38bd11,_0x879b7d){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x162ed8['params']['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x38bd11,null))[_0xb681('0x22')](function(_0x1b07a6){if(_0x1b07a6){return _0x1b07a6[_0xb681('0x74')](_0x162ed8[_0xb681('0x47')][_0xb681('0x6f')]);}})[_0xb681('0x22')](respondWithStatusCode(_0x38bd11,null))[_0xb681('0x2c')](handleError(_0x38bd11,null));};exports['notify']=function(_0x42ee57,_0x432860,_0x1129ea){var _0x434275={'channel':_0xb681('0x75')};var _0x25f260=[];var _0x30719d=[];var _0x38ffcb={};return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x42ee57['params']['id']},'include':[{'model':db[_0xb681('0x76')],'as':'Applications'}]})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x438546){_0x434275[_0xb681('0x77')]=_0x438546;_0x434275[_0xb681('0x78')]=_[_0xb681('0x79')](_0x438546[_0xb681('0x7a')],[_0xb681('0x7b')],[_0xb681('0x7c')]);if(_0x434275[_0xb681('0x77')][_0xb681('0x7a')]){delete _0x434275[_0xb681('0x77')][_0xb681('0x7a')];}return db['CmContact'][_0xb681('0x68')]();})[_0xb681('0x22')](function(_0x1b4dd2){if(!_0x1b4dd2){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0x7f'));}_0x25f260=_[_0xb681('0x80')](_[_0xb681('0x48')](_0x1b4dd2),[_0xb681('0x81'),_0xb681('0x82')]);_0x30719d=_[_0xb681('0x80')](_[_0xb681('0x48')](_0x1b4dd2),[_0xb681('0x81'),_0xb681('0x82'),_0xb681('0x83'),_0xb681('0x84')]);_0x434275[_0xb681('0x5e')]={'mapKey':_0xb681('0x85')};if(_0x434275[_0xb681('0x77')][_0xb681('0x43')]){switch(_0x434275[_0xb681('0x77')][_0xb681('0x43')]){case _0xb681('0x86'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x88')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['Body'];_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x8a')];break;case _0xb681('0x8b'):_0x434275[_0xb681('0x5e')]['from']='+'+_0x42ee57['body'][_0xb681('0x8c')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['text'];break;case _0xb681('0x8d'):_0x434275[_0xb681('0x5e')]['from']=_0x42ee57[_0xb681('0x5e')]['from'];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x2a')];break;case _0xb681('0x8e'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')]['from'];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')]['body'];_0x434275[_0xb681('0x5e')]['messageId']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x8f')];break;case _0xb681('0x90'):_0x434275['body'][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x88')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body'][_0xb681('0x91')];_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57['body'][_0xb681('0x92')];break;case'infobip':_0x434275['body'][_0xb681('0x87')]='+'+_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0][_0xb681('0x87')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0]['text'];_0x434275[_0xb681('0x5e')]['messageId']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x93')][0x0][_0xb681('0x89')];break;case _0xb681('0x94'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x95')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57['body']['segmentedMessage'][_0xb681('0x2a')];break;case _0xb681('0x96'):_0x434275['body']['from']=_0x42ee57[_0xb681('0x5e')][_0xb681('0x97')];_0x434275['body']['body']=_0x42ee57[_0xb681('0x5e')]['text'];_0x434275['body']['messageId']=_0x42ee57[_0xb681('0x5e')]['replyMessageId'];break;case'bandwidth':_0x434275[_0xb681('0x5e')][_0xb681('0x89')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')]['id'];_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')][_0xb681('0x87')];_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]=_0x42ee57[_0xb681('0x5e')][0x0][_0xb681('0x2a')][_0xb681('0x98')];break;case _0xb681('0x99'):_0x434275[_0xb681('0x5e')][_0xb681('0x87')]=_0x42ee57[_0xb681('0x5e')][_0xb681('0x87')];_0x434275[_0xb681('0x5e')]['body']=_0x42ee57['body'][_0xb681('0x2a')];_0x434275['body'][_0xb681('0x89')]=_0x42ee57['body'][_0xb681('0x9a')];break;}}if(_0x434275[_0xb681('0x5e')]['id']){delete _0x434275['body']['id'];}if(_['isNil'](_0x434275[_0xb681('0x5e')][_0xb681('0x87')])){throw new db['Sequelize'][(_0xb681('0x7e'))](_0xb681('0x9b'));}if(_['isNil'](_0x434275[_0xb681('0x5e')]['body'])||_0x434275[_0xb681('0x5e')][_0xb681('0x5e')]===''){throw new db[(_0xb681('0x7d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb681('0x9c')](_0x434275[_0xb681('0x5e')][_0xb681('0x9d')])){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0x9e')+_0x30719d);}if(!_[_0xb681('0x9f')](_0x30719d,_0x434275[_0xb681('0x5e')][_0xb681('0x9d')])){throw new db[(_0xb681('0x7d'))][(_0xb681('0x7e'))](_0xb681('0xa0')+_0x30719d);}_0x38ffcb[_0x434275[_0xb681('0x5e')][_0xb681('0x9d')]]=_0x434275['body'][_0xb681('0x87')];return db[_0xb681('0xa1')]['find']({'where':{'id':_0x434275['account'][_0xb681('0x84')]},'include':[{'model':db[_0xb681('0xa2')],'as':_0xb681('0xa3'),'where':_0x38ffcb,'limit':0x1,'order':[[_0xb681('0x82'),'DESC']]}]});})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x463e54){if(_0x463e54){_0x434275[_0xb681('0xa4')]=_['omit'](_0x463e54,[_0xb681('0xa3')]);if(_0x463e54['Contacts'][_0xb681('0x4c')]){return _0x463e54[_0xb681('0xa3')][0x0];}var _0x5c352d=_['defaults'](_0x434275['body'],{'firstName':_0x434275['body'][_0xb681('0x87')],'ListId':_0x463e54['id']});_0x5c352d[_0x434275[_0xb681('0x5e')][_0xb681('0x9d')]]=_0x434275[_0xb681('0x5e')][_0xb681('0x87')];return db[_0xb681('0xa2')]['create'](_0x5c352d,{'fields':_0x25f260,'raw':!![]});}})[_0xb681('0x22')](handleEntityNotFound(_0x432860,null))[_0xb681('0x22')](function(_0x4fcace){if(_0x4fcace){_0x434275[_0xb681('0xa5')]=_0x4fcace;var _0x47e652={'ContactId':_0x4fcace['id'],'phone':_0x434275[_0xb681('0x5e')][_0xb681('0x87')],'SmsAccountId':_0x42ee57[_0xb681('0x5a')]['id']};var _0x4163b3={'ContactId':_0x4fcace['id'],'SmsAccountId':_0x42ee57['params']['id'],'closed':![]};return db[_0xb681('0xa6')][_0xb681('0x63')]({'where':_0x4163b3})[_0xb681('0x22')](function(_0x2cb638){if(_0x2cb638){return[_0x2cb638,![]];}return db['SmsInteraction']['create'](_0x47e652)['then'](function(_0x358ebc){return[_0x358ebc,!![]];});});}})[_0xb681('0xa7')](function(_0xfbea99,_0x467c74){_0x434275[_0xb681('0xa8')]=_0xfbea99[_0xb681('0x38')]({'plain':!![]});_0x434275[_0xb681('0xa8')][_0xb681('0xa9')]=![];if(_0x467c74){if(_0x434275[_0xb681('0x77')]['autoclose']){_0x434275['applications']['push']({'id':0x0,'priority':_0x434275[_0xb681('0x78')]['length']+0x1,'app':_0xb681('0xaa'),'appdata':_0xb681('0xab'),'interval':_0xb681('0xac')});}_0x434275[_0xb681('0xa8')][_0xb681('0xa9')]=!![];}return db['SmsMessage'][_0xb681('0x5d')]({'phone':_0x434275[_0xb681('0x5e')][_0xb681('0x87')],'messageId':_0x434275['body']['messageId'],'body':_0x434275[_0xb681('0x5e')][_0xb681('0x5e')],'SmsAccountId':_0x42ee57[_0xb681('0x5a')]['id'],'SmsInteractionId':_0xfbea99['id'],'direction':'in','ContactId':_0xfbea99['ContactId'],'AttachmentId':_0x434275[_0xb681('0x5e')][_0xb681('0xad')]});})[_0xb681('0x22')](function(_0x35571c){_0x434275[_0xb681('0x2a')]=_0x35571c;if(_0x434275['interaction']['UserId']){return db[_0xb681('0xae')]['find']({'attributes':['id',_0xb681('0x3c')],'where':{'id':_0x434275[_0xb681('0xa8')][_0xb681('0xaf')]}})['then'](function(_0x1d53fa){if(_0x1d53fa){_0x434275[_0xb681('0x78')][_0xb681('0xb0')]({'id':0x0,'priority':0x0,'app':_0xb681('0xb1'),'appdata':_0x1d53fa[_0xb681('0x3c')]+','+(_0x434275[_0xb681('0x77')]['waitForTheAssignedAgent']||0xa),'interval':_0xb681('0xac')});}return respondWithRpcPromise('Start',_0xb681('0xb2'),_0x434275);});}return respondWithRpcPromise(_0xb681('0xb3'),_0xb681('0xb2'),_0x434275);})['then'](function(_0x2321a7){if(_0x2321a7){var _0x1d0d66=0xc8;var _0x101003=_0xb681('0xb4');logger[_0xb681('0x23')](_0xb681('0x26'),_0x101003,_0x1d0d66,_0xb681('0xb5'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x101003,_0x1d0d66,_0xb681('0xb5'),JSON[_0xb681('0xb6')](_0x2321a7));if(_0x434275[_0xb681('0x77')][_0xb681('0x43')]===_0xb681('0x86')){return _0x432860[_0xb681('0x2e')](_0x1d0d66)[_0xb681('0xb7')](_0xb681('0xb8'),_0xb681('0xb9'))['send']('\x0a');}else{return _0x432860[_0xb681('0x2e')](_0x1d0d66)[_0xb681('0x30')](_0x2321a7);}}})['catch'](handleError(_0x432860,null));};exports[_0xb681('0xba')]=function(_0x1052a9,_0x28d868){var _0x48d15d=_0x1052a9[_0xb681('0x5a')]['id'];var _0x2a7974=_0x1052a9[_0xb681('0x5e')];var _0x509670=0xc8;var _0x397c74=null;return db[_0xb681('0xbb')][_0xb681('0xbc')]({'isolationLevel':db[_0xb681('0xbb')]['Transaction'][_0xb681('0xbd')]['READ_COMMITTED']},function(_0x57536c){return db[_0xb681('0x40')]['findOne']({'where':{'id':_0x48d15d},'transaction':_0x57536c})['then'](function(_0x211822){if(_0x211822){return db[_0xb681('0x76')][_0xb681('0x3b')]({'where':{'SmsAccountId':_0x48d15d},'transaction':_0x57536c})['then'](function(){var _0x3d4d8f=_[_0xb681('0x46')](_0x2a7974,function(_0xd91a39){_0xd91a39['SmsAccountId']=_0x48d15d;return _0xd91a39;});return db['SmsApplication'][_0xb681('0xbe')](_0x3d4d8f,{'transaction':_0x57536c});});}else{_0x509670=0x194;_0x397c74=[];}});})[_0xb681('0x22')](function(){if(_0x509670!==0x194){return db[_0xb681('0x76')][_0xb681('0xbf')]({'where':{'SmsAccountId':_0x48d15d},'order':_0xb681('0x7b')})[_0xb681('0x22')](function(_0x4d819e){_0x397c74=_0x4d819e;});}})[_0xb681('0x2c')](function(_0x51a3fa){_0x509670=0x1f4;logger[_0xb681('0x28')](_0x51a3fa[_0xb681('0xc0')]);if(_0x51a3fa['name']){delete _0x51a3fa[_0xb681('0x3c')];}_0x397c74=_0x51a3fa;})['finally'](function(){if(_0x397c74===null){_0x28d868[_0xb681('0x2d')](_0x509670);}else{if(_0x509670===0x1f4){_0x28d868[_0xb681('0x2e')](_0x509670)['send'](_0x397c74);}else{_0x28d868[_0xb681('0x2e')](_0x509670)[_0xb681('0x30')](_0x397c74);}}});};exports[_0xb681('0xc1')]=function(_0x3b65f5,_0x3c783e,_0x402432){var _0x10bee4={};var _0x51456a={};var _0x5877b8;var _0x4d1bdc;return db['SmsAccount'][_0xb681('0x72')]({'where':{'id':_0x3b65f5[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x3c783e,null))['then'](function(_0x2fb438){if(_0x2fb438){_0x5877b8=_0x2fb438;_0x51456a[_0xb681('0x45')]=_['keys'](db[_0xb681('0x76')][_0xb681('0x41')]);_0x51456a[_0xb681('0x47')]=_[_0xb681('0x48')](_0x3b65f5[_0xb681('0x47')]);_0x51456a[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x51456a[_0xb681('0x45')],_0x51456a[_0xb681('0x47')]);_0x10bee4['attributes']=_[_0xb681('0x5b')](_0x51456a[_0xb681('0x45')],qs['fields'](_0x3b65f5['query'][_0xb681('0x4b')]));_0x10bee4[_0xb681('0x4a')]=_0x10bee4[_0xb681('0x4a')]['length']?_0x10bee4[_0xb681('0x4a')]:_0x51456a['model'];_0x10bee4[_0xb681('0x4e')]=qs[_0xb681('0x4f')](_0x3b65f5[_0xb681('0x47')][_0xb681('0x4f')]);_0x10bee4['where']=qs[_0xb681('0x49')](_['pick'](_0x3b65f5[_0xb681('0x47')],_0x51456a['filters']));if(_0x3b65f5[_0xb681('0x47')][_0xb681('0x52')]){_0x10bee4[_0xb681('0x50')]=_[_0xb681('0x53')](_0x10bee4[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x10bee4['attributes'],function(_0x286bd0){var _0x54439d={};_0x54439d[_0x286bd0]={'$like':'%'+_0x3b65f5[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x54439d;})});}_0x10bee4=_[_0xb681('0x53')]({},_0x10bee4,_0x3b65f5[_0xb681('0x5c')]);return _0x5877b8[_0xb681('0xc1')](_0x10bee4);}})[_0xb681('0x22')](function(_0x4dc190){if(_0x4dc190){_0x4d1bdc=_0x4dc190['length'];if(!_0x3b65f5['query'][_0xb681('0x6d')](_0xb681('0x4d'))){_0x10bee4[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x3b65f5[_0xb681('0x47')]['limit']);_0x10bee4[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x3b65f5[_0xb681('0x47')][_0xb681('0x31')]);}return _0x5877b8[_0xb681('0xc1')](_0x10bee4);}})[_0xb681('0x22')](function(_0x4bf48b){if(_0x4bf48b){return _0x4bf48b?{'count':_0x4d1bdc,'rows':_0x4bf48b}:null;}})[_0xb681('0x22')](respondWithResult(_0x3c783e,null))[_0xb681('0x2c')](handleError(_0x3c783e,null));};exports[_0xb681('0xc2')]=function(_0x32c5ad,_0x585429,_0x555423){var _0x3bb675={'raw':![],'where':{}};var _0x18cf6e={};var _0x2d2ce8={'count':0x0,'rows':[]};return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x32c5ad[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x585429,null))[_0xb681('0x22')](function(_0x3fa6a1){if(_0x3fa6a1){_0x18cf6e[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0xa6')][_0xb681('0x41')]);_0x18cf6e['query']=_[_0xb681('0x48')](_0x32c5ad[_0xb681('0x47')]);_0x18cf6e[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x18cf6e[_0xb681('0x45')],_0x18cf6e[_0xb681('0x47')]);_0x3bb675[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x18cf6e[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x4b')]));_0x3bb675[_0xb681('0x4a')]=_0x3bb675['attributes']['length']?_0x3bb675['attributes']:_0x18cf6e[_0xb681('0x45')];if(!_0x32c5ad[_0xb681('0x47')][_0xb681('0x6d')](_0xb681('0x4d'))){_0x3bb675[_0xb681('0x32')]=qs[_0xb681('0x32')](_0x32c5ad[_0xb681('0x47')]['limit']);_0x3bb675[_0xb681('0x31')]=qs[_0xb681('0x31')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x31')]);}_0x3bb675['order']=qs[_0xb681('0x4f')](_0x32c5ad[_0xb681('0x47')][_0xb681('0x4f')]);_0x3bb675[_0xb681('0x50')]=qs['filters'](_[_0xb681('0x51')](_0x32c5ad[_0xb681('0x47')],_0x18cf6e[_0xb681('0x49')]));_0x3bb675['where'][_0xb681('0x6a')]=_0x3fa6a1['id'];if(_0x32c5ad[_0xb681('0x47')][_0xb681('0x52')]){_0x3bb675[_0xb681('0x50')]=_[_0xb681('0x53')](_0x3bb675[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x3bb675[_0xb681('0x4a')],function(_0x48fc4c){var _0x399b7f={};_0x399b7f[_0x48fc4c]={'$like':'%'+_0x32c5ad[_0xb681('0x47')]['filter']+'%'};return _0x399b7f;})});}_0x3bb675=_[_0xb681('0x53')]({},_0x3bb675,_0x32c5ad[_0xb681('0x5c')]);return db[_0xb681('0xa6')][_0xb681('0x34')]({'where':_0x3bb675[_0xb681('0x50')]})['then'](function(_0x556893){_0x2d2ce8['count']=_0x556893;if(_0x32c5ad['query']['includeAll']){_0x3bb675[_0xb681('0x56')]=[{'model':db[_0xb681('0xa2')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb681('0x3c'),_0xb681('0xc3'),_0xb681('0xc4')],'required':![]},{'model':db[_0xb681('0xc5')],'as':_0xb681('0xc6'),'attributes':['id',_0xb681('0x3c'),'color'],'where':_0x32c5ad[_0xb681('0x47')][_0xb681('0xc7')]?{'id':_0x32c5ad[_0xb681('0x47')][_0xb681('0xc7')]}:undefined,'required':_0x32c5ad['query'][_0xb681('0xc7')]?!![]:![]}];}return db[_0xb681('0xa6')][_0xb681('0x57')](_0x3bb675);})[_0xb681('0x22')](function(_0x53c21a){_0x2d2ce8[_0xb681('0x58')]=_0x53c21a;return _0x2d2ce8;});}})[_0xb681('0x22')](respondWithFilteredResult(_0x585429,_0x3bb675))[_0xb681('0x2c')](handleError(_0x585429,null));};exports[_0xb681('0x3d')]=function(_0x249328,_0x1ca1e2,_0x1517a1){var _0x59cee1,_0x4ec013,_0x45f9f6;if(_[_0xb681('0x9c')](_0x249328[_0xb681('0x5e')][_0xb681('0x5e')])||_0x249328[_0xb681('0x5e')][_0xb681('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0xb681('0xc8'));}if(_[_0xb681('0x9c')](_0x249328[_0xb681('0x5e')]['to'])){throw new db[(_0xb681('0x7d'))]['ValidationError'](_0xb681('0xc9'));}_0x59cee1=_0x249328['body']['to'];return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x249328[_0xb681('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb681('0xa2')],'as':_0xb681('0xa3'),'where':{'mobile':_0x59cee1},'limit':0x1,'order':[[_0xb681('0x82'),'DESC']]}]}]})[_0xb681('0x22')](handleEntityNotFound(_0x1ca1e2,null))['then'](function(_0x2fa4bc){if(_0x2fa4bc&&_0x2fa4bc[_0xb681('0xca')]){_0x4ec013=_0x2fa4bc[_0xb681('0x38')]({'plain':!![]});if(_0x4ec013[_0xb681('0xca')]&&_0x4ec013[_0xb681('0xca')][_0xb681('0xa3')][_0xb681('0x4c')]){return _0x4ec013['List'][_0xb681('0xa3')][0x0];}return db[_0xb681('0xa2')][_0xb681('0x5d')](_[_0xb681('0x1c')](_0x249328['body'],{'firstName':_0x59cee1,'mobile':_0x59cee1,'phone':_0x59cee1,'ListId':_0x4ec013[_0xb681('0x84')]}));}})[_0xb681('0x22')](handleEntityNotFound(_0x1ca1e2,null))[_0xb681('0x22')](function(_0x53721b){if(_0x53721b){_0x45f9f6=_0x53721b;return db[_0xb681('0xa6')][_0xb681('0x63')]({'where':{'ContactId':_0x45f9f6['id'],'closed':![],'SmsAccountId':_0x4ec013['id']}})[_0xb681('0x22')](function(_0xa5c21e){if(_0xa5c21e){return[_0xa5c21e,![]];}return db[_0xb681('0xa6')]['create']({'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id'],'SmsAccountId':_0x4ec013['id'],'phone':_0x59cee1,'firstMsgDirection':_0xb681('0xcb'),'Messages':[_['merge'](_0x249328['body'],{'read':![],'body':_0x249328[_0xb681('0x5e')]['body'],'phone':_0x59cee1,'SmsAccountId':_0x4ec013['id'],'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id']})]},{'include':[{'model':db[_0xb681('0xcc')],'as':_0xb681('0xcd')}]})[_0xb681('0x22')](function(_0x39b842){return[_0x39b842,!![]];});});}})['spread'](function(_0x17315d,_0x3f7faa){if(_0x3f7faa){return _0x17315d;}return db[_0xb681('0xcc')]['create'](_[_0xb681('0x53')](_0x249328[_0xb681('0x5e')],{'read':![],'body':_0x249328[_0xb681('0x5e')][_0xb681('0x5e')],'phone':_0x59cee1,'SmsAccountId':_0x4ec013['id'],'SmsInteractionId':_0x17315d['id'],'UserId':_0x249328[_0xb681('0x5f')]['id'],'ContactId':_0x45f9f6['id']}))[_0xb681('0x22')](function(_0x29c0ca){_0x17315d[_0xb681('0xce')]['Messages']=[];_0x17315d[_0xb681('0xce')][_0xb681('0xcd')][_0xb681('0xcf')](_0x29c0ca[_0xb681('0xce')]);return _0x17315d;});})['then'](respondWithResult(_0x1ca1e2,null))[_0xb681('0x2c')](handleError(_0x1ca1e2,null));};exports[_0xb681('0x2e')]=function(_0x25b40d,_0x4f05a2,_0x3197a2){if(_0x25b40d['body']['id']){delete _0x25b40d['body']['id'];}var _0x93fd66,_0x34c662,_0x5b068a;return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x25b40d[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4f05a2,null))[_0xb681('0x22')](function(_0x1bf22f){if(_0x1bf22f){_0x5b068a=_0x1bf22f;logger['debug'](_0xb681('0x26'),'status',_0xb681('0xd0'),_0x1bf22f[_0xb681('0x43')],util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));switch(_0x1bf22f['type']){case _0xb681('0x8b'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0xd2')]&&_0x25b40d['body'][_0xb681('0x2e')]){_0x34c662=_0x25b40d[_0xb681('0x5e')][_0xb681('0x2e')];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][_0xb681('0xd2')]}});}break;case _0xb681('0x8d'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0xd3')]&&_0x25b40d['body'][_0xb681('0xd4')]){_0x34c662=_0x25b40d[_0xb681('0x5e')][_0xb681('0xd4')];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d[_0xb681('0x5e')]['requestid']}});}break;case _0xb681('0x8e'):if(_0x25b40d[_0xb681('0x5e')][_0xb681('0x8f')]&&_0x25b40d[_0xb681('0x5e')][_0xb681('0xd5')]){_0x34c662=_0x25b40d['body']['status_code'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d[_0xb681('0x5e')]['message_id']}});}break;case _0xb681('0xd6'):var _0x324d23=_0x25b40d[_0xb681('0x5e')]['results'][0x0];if(_0x324d23[_0xb681('0x89')]&&_0x324d23[_0xb681('0x2e')][_0xb681('0xd7')]===_0xb681('0xd8')){_0x34c662=_0x324d23[_0xb681('0x2e')]['groupName'];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x324d23[_0xb681('0x89')]}});}break;case'clickatell':if(_0x25b40d[_0xb681('0x5e')][_0xb681('0x89')]&&_0x25b40d[_0xb681('0x5e')]['status']){_0x34c662=_0x25b40d[_0xb681('0x5e')]['status'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][_0xb681('0x89')]}});}break;case _0xb681('0xd9'):if(_0x25b40d['body'][0x0][_0xb681('0x2a')]['id']){_0x34c662=_0x25b40d[_0xb681('0x5e')][0x0]['type'];return db['SmsMessage'][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body'][0x0]['message']['id']}});}break;case _0xb681('0x99'):if(_0x25b40d['body'][_0xb681('0xda')]&&_0x25b40d[_0xb681('0x5e')][_0xb681('0x2e')]){_0x34c662=_0x25b40d[_0xb681('0x5e')]['status'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x25b40d['body']['redif']}});}break;}}})[_0xb681('0x22')](handleEntityNotFound(_0x4f05a2,null))[_0xb681('0x22')](function(_0x1cb7df){if(_0x1cb7df){_0x93fd66=_0x1cb7df;switch(_0x5b068a['type']){case _0xb681('0x8b'):if(_0x34c662===_0xb681('0xd8')){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger['error'](_0xb681('0x26'),_0xb681('0x2e'),'skebby',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case _0xb681('0x8d'):if(_0x34c662==='1'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x8b'),util['inspect'](_0x25b40d[_0xb681('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xb681('0x8e'):if(!_0x25b40d[_0xb681('0x5e')][_0xb681('0xdb')]&&_0x34c662>=0xc8&&_0x34c662<=0xce){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x8e'),util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1c2425=_0x25b40d[_0xb681('0x5e')]['results'][0x0];if(_0x1c2425[_0xb681('0x2e')][_0xb681('0xd7')]==='DELIVERED'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),'status','infobip',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x34c662=='DELIVERED_TO_GATEWAY'||_0x34c662=='RECEIVED_BY_RECIPIENT'){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x96'),util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;case _0xb681('0xd9'):if(_0x34c662==_0xb681('0xdc')){return _0x93fd66['update']({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),'status','bandwidth',util[_0xb681('0xd1')](_0x25b40d[_0xb681('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xb681('0x99'):if(_0x34c662===_0xb681('0xdd')||_0x34c662===_0xb681('0xde')){return _0x93fd66[_0xb681('0x67')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb681('0x2e'),'intelepeer',util[_0xb681('0xd1')](_0x25b40d['body'],{'showHidden':![],'depth':null}));}break;}return _0x93fd66;}})[_0xb681('0x22')](respondWithResult(_0x4f05a2,null))['catch'](handleError(_0x4f05a2,null));};exports[_0xb681('0xdf')]=function(_0x44b606,_0x177be8,_0x47d016){var _0x48a14e,_0x43d24d,_0x57f5e9;return db['SmsAccount'][_0xb681('0x63')]({'where':{'id':_0x44b606['params']['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x177be8,null))[_0xb681('0x22')](function(_0x123bdf){if(_0x123bdf){_0x57f5e9=_0x123bdf;logger['debug'](_0xb681('0x26'),'status',_0xb681('0xd0'),_0x123bdf['type'],util['inspect'](_0x44b606['query'],{'showHidden':![],'depth':null}));switch(_0x123bdf['type']){case _0xb681('0x94'):if(_0x44b606[_0xb681('0x47')][_0xb681('0xe0')]&&_0x44b606[_0xb681('0x47')][_0xb681('0xe1')]){_0x43d24d=_0x44b606[_0xb681('0x47')]['state'];return db[_0xb681('0xcc')][_0xb681('0x63')]({'where':{'messageId':_0x44b606[_0xb681('0x47')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x177be8,null))[_0xb681('0x22')](function(_0x32e33a){if(_0x32e33a){_0x48a14e=_0x32e33a;switch(_0x57f5e9[_0xb681('0x43')]){case _0xb681('0x94'):if(_0x43d24d==='2'||_0x43d24d==='6'){return _0x48a14e[_0xb681('0x67')]({'read':!![]});}else{logger[_0xb681('0x28')](_0xb681('0x26'),_0xb681('0x2e'),_0xb681('0x94'),util[_0xb681('0xd1')](_0x44b606[_0xb681('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x48a14e;}})[_0xb681('0x22')](respondWithResult(_0x177be8,null))[_0xb681('0x2c')](handleError(_0x177be8,null));};exports[_0xb681('0xe2')]=function(_0x5937f9,_0x3ee615,_0x38382f){return db[_0xb681('0x40')][_0xb681('0x63')]({'where':{'id':_0x5937f9[_0xb681('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ee615,null))[_0xb681('0x22')](function(_0x46372a){if(_0x46372a){return _0x46372a[_0xb681('0xe2')](_0x5937f9['body'][_0xb681('0x6f')],_[_0xb681('0xe3')](_0x5937f9['body'],['ids','id'])||{})[_0xb681('0xa7')](function(_0x3c326e){for(var _0x15d04e=0x0;_0x15d04e<_0x5937f9[_0xb681('0x5e')]['ids']['length'];_0x15d04e+=0x1){socket[_0xb681('0xe4')](_0xb681('0xe5'),{'UserId':Number(_0x5937f9[_0xb681('0x5e')][_0xb681('0x6f')][_0x15d04e]),'SmsAccountId':Number(_0x5937f9['params']['id'])});}return _0x3c326e;});}})[_0xb681('0x22')](respondWithResult(_0x3ee615,null))[_0xb681('0x2c')](handleError(_0x3ee615,null));};exports[_0xb681('0xe6')]=function(_0x2114e5,_0x560d1b,_0xda2040){return db['SmsAccount']['find']({'where':{'id':_0x2114e5[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x560d1b,null))[_0xb681('0x22')](function(_0xe11fe0){if(_0xe11fe0){return _0xe11fe0['removeAgents'](_0x2114e5[_0xb681('0x47')]['ids'])[_0xb681('0x22')](function(){if(_[_0xb681('0xe7')](_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')])){for(var _0x55ddf5=0x0;_0x55ddf5<_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')][_0xb681('0x4c')];_0x55ddf5+=0x1){socket['emit'](_0xb681('0xe8'),{'UserId':Number(_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')][_0x55ddf5]),'SmsAccountId':Number(_0x2114e5['params']['id'])});}}else{socket[_0xb681('0xe4')](_0xb681('0xe8'),{'UserId':Number(_0x2114e5[_0xb681('0x47')][_0xb681('0x6f')]),'SmsAccountId':Number(_0x2114e5[_0xb681('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x560d1b,null))[_0xb681('0x2c')](handleError(_0x560d1b,null));};exports[_0xb681('0xe9')]=function(_0x5416b1,_0x4691ab,_0x35187e){var _0x1f9bbe={};var _0x34f1b7={};var _0x4976b0;var _0x1da534;return db[_0xb681('0x40')][_0xb681('0x72')]({'where':{'id':_0x5416b1[_0xb681('0x5a')]['id']}})[_0xb681('0x22')](handleEntityNotFound(_0x4691ab,null))[_0xb681('0x22')](function(_0x5bc605){if(_0x5bc605){_0x4976b0=_0x5bc605;_0x34f1b7[_0xb681('0x45')]=_[_0xb681('0x48')](db[_0xb681('0xae')]['rawAttributes']);_0x34f1b7['query']=_[_0xb681('0x48')](_0x5416b1[_0xb681('0x47')]);_0x34f1b7[_0xb681('0x49')]=_[_0xb681('0x5b')](_0x34f1b7['model'],_0x34f1b7[_0xb681('0x47')]);_0x1f9bbe[_0xb681('0x4a')]=_[_0xb681('0x5b')](_0x34f1b7[_0xb681('0x45')],qs[_0xb681('0x4b')](_0x5416b1['query']['fields']));_0x1f9bbe[_0xb681('0x4a')]=_0x1f9bbe[_0xb681('0x4a')]['length']?_0x1f9bbe[_0xb681('0x4a')]:_0x34f1b7[_0xb681('0x45')];_0x1f9bbe['order']=qs[_0xb681('0x4f')](_0x5416b1['query'][_0xb681('0x4f')]);_0x1f9bbe['where']=qs[_0xb681('0x49')](_['pick'](_0x5416b1['query'],_0x34f1b7[_0xb681('0x49')]));if(_0x5416b1[_0xb681('0x47')][_0xb681('0x52')]){_0x1f9bbe[_0xb681('0x50')]=_[_0xb681('0x53')](_0x1f9bbe[_0xb681('0x50')],{'$or':_[_0xb681('0x46')](_0x1f9bbe[_0xb681('0x4a')],function(_0x10f1ea){var _0x43c3f9={};_0x43c3f9[_0x10f1ea]={'$like':'%'+_0x5416b1[_0xb681('0x47')][_0xb681('0x52')]+'%'};return _0x43c3f9;})});}_0x1f9bbe=_[_0xb681('0x53')]({},_0x1f9bbe,_0x5416b1['options']);return _0x4976b0[_0xb681('0xe9')](_0x1f9bbe);}})[_0xb681('0x22')](function(_0x306da9){if(_0x306da9){_0x1da534=_0x306da9[_0xb681('0x4c')];if(!_0x5416b1[_0xb681('0x47')][_0xb681('0x6d')](_0xb681('0x4d'))){_0x1f9bbe['limit']=qs[_0xb681('0x32')](_0x5416b1['query'][_0xb681('0x32')]);_0x1f9bbe[_0xb681('0x31')]=qs['offset'](_0x5416b1[_0xb681('0x47')]['offset']);}return _0x4976b0[_0xb681('0xe9')](_0x1f9bbe);}})[_0xb681('0x22')](function(_0x3e78a9){if(_0x3e78a9){return _0x3e78a9?{'count':_0x1da534,'rows':_0x3e78a9}:null;}})[_0xb681('0x22')](respondWithResult(_0x4691ab,null))[_0xb681('0x2c')](handleError(_0x4691ab,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 54768c4..a4a6812 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 _0xf662=['events','SmsAccount','update','remove','emit','hasOwnProperty','exports'];(function(_0xcafa2a,_0x2eccd9){var _0x35bd08=function(_0x4067ed){while(--_0x4067ed){_0xcafa2a['push'](_0xcafa2a['shift']());}};_0x35bd08(++_0x2eccd9);}(_0xf662,0x1dc));var _0x2f66=function(_0x1ec7b0,_0x2eb52a){_0x1ec7b0=_0x1ec7b0-0x0;var _0x5aff54=_0xf662[_0x1ec7b0];return _0x5aff54;};'use strict';var EventEmitter=require(_0x2f66('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x2f66('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f66('0x2'),'afterDestroy':_0x2f66('0x3')};function emitEvent(_0x40df02){return function(_0x3353b4,_0xb96bfd,_0x151ba0){SmsAccountEvents[_0x2f66('0x4')](_0x40df02+':'+_0x3353b4['id'],_0x3353b4);SmsAccountEvents['emit'](_0x40df02,_0x3353b4);_0x151ba0(null);};}for(var e in events){if(events[_0x2f66('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x2f66('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x0409=['hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','emit'];(function(_0x2f4069,_0x74eb6c){var _0x4e5d90=function(_0x56fedf){while(--_0x56fedf){_0x2f4069['push'](_0x2f4069['shift']());}};_0x4e5d90(++_0x74eb6c);}(_0x0409,0x15a));var _0x9040=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0409[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x9040('0x0'));var SmsAccount=require(_0x9040('0x1'))['db'][_0x9040('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9040('0x3')](0x0);var events={'afterCreate':_0x9040('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x326c20){return function(_0x4989e1,_0x5307c9,_0x4769d0){SmsAccountEvents[_0x9040('0x5')](_0x326c20+':'+_0x4989e1['id'],_0x4989e1);SmsAccountEvents['emit'](_0x326c20,_0x4989e1);_0x4769d0(null);};}for(var e in events){if(events[_0x9040('0x6')](e)){var event=events[e];SmsAccount[_0x9040('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 5bb20d2..d9770c6 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 _0xed5d=['exports','define','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes'];(function(_0x3a2a8f,_0x2997ff){var _0x9effdb=function(_0x19d033){while(--_0x19d033){_0x3a2a8f['push'](_0x3a2a8f['shift']());}};_0x9effdb(++_0x2997ff);}(_0xed5d,0x13b));var _0xded5=function(_0x3f1d0c,_0x26d60c){_0x3f1d0c=_0x3f1d0c-0x0;var _0x299d34=_0xed5d[_0x3f1d0c];return _0x299d34;};'use strict';var _=require(_0xded5('0x0'));var util=require(_0xded5('0x1'));var logger=require(_0xded5('0x2'))(_0xded5('0x3'));var moment=require(_0xded5('0x4'));var BPromise=require(_0xded5('0x5'));var rp=require(_0xded5('0x6'));var fs=require('fs');var path=require(_0xded5('0x7'));var rimraf=require(_0xded5('0x8'));var config=require('../../config/environment');var attributes=require(_0xded5('0x9'));module[_0xded5('0xa')]=function(_0x3a31b8,_0x489c19){return _0x3a31b8[_0xded5('0xb')]('SmsAccount',attributes,{'tableName':_0xded5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dfe=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x33bb09,_0x35efd8){var _0x38988a=function(_0xf40b78){while(--_0xf40b78){_0x33bb09['push'](_0x33bb09['shift']());}};_0x38988a(++_0x35efd8);}(_0x3dfe,0x148));var _0xe3df=function(_0x19d897,_0x340e2f){_0x19d897=_0x19d897-0x0;var _0x3f1083=_0x3dfe[_0x19d897];return _0x3f1083;};'use strict';var _=require(_0xe3df('0x0'));var util=require(_0xe3df('0x1'));var logger=require(_0xe3df('0x2'))(_0xe3df('0x3'));var moment=require('moment');var BPromise=require(_0xe3df('0x4'));var rp=require(_0xe3df('0x5'));var fs=require('fs');var path=require(_0xe3df('0x6'));var rimraf=require(_0xe3df('0x7'));var config=require(_0xe3df('0x8'));var attributes=require(_0xe3df('0x9'));module[_0xe3df('0xa')]=function(_0x152087,_0x181ba0){return _0x152087['define'](_0xe3df('0xb'),attributes,{'tableName':_0xe3df('0xc'),'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 5c28a1a..d0b9db3 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 _0xc235=['../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','SmsAccount','find','options','raw','map','include','model','attributes','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x13bdef,_0x55e116){var _0x391f96=function(_0x3c3e39){while(--_0x3c3e39){_0x13bdef['push'](_0x13bdef['shift']());}};_0x391f96(++_0x55e116);}(_0xc235,0x19e));var _0x5c23=function(_0x285fff,_0x4fb54f){_0x285fff=_0x285fff-0x0;var _0x44e78f=_0xc235[_0x285fff];return _0x44e78f;};'use strict';var _=require(_0x5c23('0x0'));var util=require(_0x5c23('0x1'));var moment=require(_0x5c23('0x2'));var BPromise=require(_0x5c23('0x3'));var rs=require(_0x5c23('0x4'));var fs=require('fs');var Redis=require(_0x5c23('0x5'));var db=require(_0x5c23('0x6'))['db'];var utils=require(_0x5c23('0x7'));var logger=require(_0x5c23('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c23('0x9')][_0x5c23('0xa')]({'port':0x232a});config[_0x5c23('0xb')]=_['defaults'](config[_0x5c23('0xb')],{'host':_0x5c23('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c23('0xb')]));require(_0x5c23('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f7c98,_0x14dc99,_0x52cc72){return new BPromise(function(_0x313d76,_0x44abb5){return client[_0x5c23('0xe')](_0x4f7c98,_0x52cc72)[_0x5c23('0xf')](function(_0x2b7a07){logger['info'](_0x5c23('0x10'),_0x14dc99,'request\x20sent');logger[_0x5c23('0x11')](_0x5c23('0x12'),_0x14dc99,_0x5c23('0x13'),JSON[_0x5c23('0x14')](_0x2b7a07));if(_0x2b7a07['error']){if(_0x2b7a07[_0x5c23('0x15')]['code']===0x1f4){logger[_0x5c23('0x15')](_0x5c23('0x10'),_0x14dc99,_0x2b7a07[_0x5c23('0x15')]['message']);return _0x44abb5(_0x2b7a07['error'][_0x5c23('0x16')]);}logger[_0x5c23('0x15')]('SmsAccount,\x20%s,\x20%s',_0x14dc99,_0x2b7a07[_0x5c23('0x15')][_0x5c23('0x16')]);return _0x313d76(_0x2b7a07[_0x5c23('0x15')][_0x5c23('0x16')]);}else{logger[_0x5c23('0x17')](_0x5c23('0x10'),_0x14dc99,_0x5c23('0x13'));_0x313d76(_0x2b7a07[_0x5c23('0x18')]['message']);}})[_0x5c23('0x19')](function(_0x125ad6){logger[_0x5c23('0x15')](_0x5c23('0x10'),_0x14dc99,_0x125ad6);_0x44abb5(_0x125ad6);});});}exports['ShowSmsAccount']=function(_0x4ffe91){var _0x3e6e61=this;return new Promise(function(_0x23244f,_0x55a212){return db[_0x5c23('0x1a')][_0x5c23('0x1b')]({'raw':_0x4ffe91[_0x5c23('0x1c')]?_0x4ffe91[_0x5c23('0x1c')][_0x5c23('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ffe91['options']?_0x4ffe91[_0x5c23('0x1c')]['where']||null:null,'attributes':_0x4ffe91[_0x5c23('0x1c')]?_0x4ffe91[_0x5c23('0x1c')]['attributes']||null:null,'include':_0x4ffe91[_0x5c23('0x1c')]?_0x4ffe91[_0x5c23('0x1c')]['include']?_[_0x5c23('0x1e')](_0x4ffe91['options'][_0x5c23('0x1f')],function(_0x2114d4){return{'model':db[_0x2114d4[_0x5c23('0x20')]],'as':_0x2114d4['as'],'attributes':_0x2114d4[_0x5c23('0x21')],'include':_0x2114d4[_0x5c23('0x1f')]?_[_0x5c23('0x1e')](_0x2114d4[_0x5c23('0x1f')],function(_0x5b8904){return{'model':db[_0x5b8904['model']],'as':_0x5b8904['as'],'attributes':_0x5b8904[_0x5c23('0x21')],'include':_0x5b8904['include']?_['map'](_0x5b8904[_0x5c23('0x1f')],function(_0x32deaf){return{'model':db[_0x32deaf[_0x5c23('0x20')]],'as':_0x32deaf['as'],'attributes':_0x32deaf[_0x5c23('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5c23('0xf')](function(_0x9f483e){logger[_0x5c23('0x17')](_0x5c23('0x22'),_0x4ffe91);logger[_0x5c23('0x11')](_0x5c23('0x22'),_0x4ffe91,JSON['stringify'](_0x9f483e));_0x23244f(_0x9f483e);})[_0x5c23('0x19')](function(_0x26f5df){logger[_0x5c23('0x15')](_0x5c23('0x22'),_0x26f5df[_0x5c23('0x16')],_0x4ffe91);_0x55a212(_0x3e6e61[_0x5c23('0x15')](0x1f4,_0x26f5df[_0x5c23('0x16')]));});});}; \ No newline at end of file +var _0xa6bf=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xa6bf,0x19b));var _0xfa6b=function(_0x14c076,_0x22a84c){_0x14c076=_0x14c076-0x0;var _0x423f1c=_0xa6bf[_0x14c076];return _0x423f1c;};'use strict';var _=require(_0xfa6b('0x0'));var util=require(_0xfa6b('0x1'));var moment=require('moment');var BPromise=require(_0xfa6b('0x2'));var rs=require(_0xfa6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa6b('0x4'))['db'];var utils=require(_0xfa6b('0x5'));var logger=require(_0xfa6b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfa6b('0x7'));var client=jayson[_0xfa6b('0x8')][_0xfa6b('0x9')]({'port':0x232a});config['redis']=_[_0xfa6b('0xa')](config[_0xfa6b('0xb')],{'host':_0xfa6b('0xc'),'port':0x18eb});var socket=require(_0xfa6b('0xd'))(new Redis(config[_0xfa6b('0xb')]));require(_0xfa6b('0xe'))[_0xfa6b('0xf')](socket);function respondWithRpcPromise(_0x11ee17,_0x22dc98,_0x19c5c9){return new BPromise(function(_0x760879,_0x206e70){return client[_0xfa6b('0x10')](_0x11ee17,_0x19c5c9)[_0xfa6b('0x11')](function(_0x2b5fb9){logger['info'](_0xfa6b('0x12'),_0x22dc98,_0xfa6b('0x13'));logger[_0xfa6b('0x14')](_0xfa6b('0x15'),_0x22dc98,_0xfa6b('0x13'),JSON[_0xfa6b('0x16')](_0x2b5fb9));if(_0x2b5fb9['error']){if(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x18')]===0x1f4){logger[_0xfa6b('0x17')](_0xfa6b('0x12'),_0x22dc98,_0x2b5fb9[_0xfa6b('0x17')]['message']);return _0x206e70(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x19')]);}logger['error'](_0xfa6b('0x12'),_0x22dc98,_0x2b5fb9[_0xfa6b('0x17')]['message']);return _0x760879(_0x2b5fb9[_0xfa6b('0x17')][_0xfa6b('0x19')]);}else{logger[_0xfa6b('0x1a')](_0xfa6b('0x12'),_0x22dc98,'request\x20sent');_0x760879(_0x2b5fb9['result'][_0xfa6b('0x19')]);}})['catch'](function(_0x1bfb34){logger[_0xfa6b('0x17')]('SmsAccount,\x20%s,\x20%s',_0x22dc98,_0x1bfb34);_0x206e70(_0x1bfb34);});});}exports[_0xfa6b('0x1b')]=function(_0x49cf7a){var _0x40ab04=this;return new Promise(function(_0x22e8df,_0x2e8818){return db[_0xfa6b('0x1c')]['find']({'raw':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a['options'][_0xfa6b('0x1e')]===undefined?!![]:![]:!![],'where':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x1f')]||null:null,'attributes':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x20')]||null:null,'include':_0x49cf7a[_0xfa6b('0x1d')]?_0x49cf7a[_0xfa6b('0x1d')][_0xfa6b('0x21')]?_[_0xfa6b('0x22')](_0x49cf7a['options']['include'],function(_0x36c06d){return{'model':db[_0x36c06d[_0xfa6b('0x23')]],'as':_0x36c06d['as'],'attributes':_0x36c06d['attributes'],'include':_0x36c06d[_0xfa6b('0x21')]?_[_0xfa6b('0x22')](_0x36c06d['include'],function(_0x4520ae){return{'model':db[_0x4520ae[_0xfa6b('0x23')]],'as':_0x4520ae['as'],'attributes':_0x4520ae[_0xfa6b('0x20')],'include':_0x4520ae[_0xfa6b('0x21')]?_['map'](_0x4520ae[_0xfa6b('0x21')],function(_0x4c5ef7){return{'model':db[_0x4c5ef7[_0xfa6b('0x23')]],'as':_0x4c5ef7['as'],'attributes':_0x4c5ef7[_0xfa6b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfa6b('0x11')](function(_0x2d50ea){logger[_0xfa6b('0x1a')]('ShowSmsAccount',_0x49cf7a);logger[_0xfa6b('0x14')](_0xfa6b('0x1b'),_0x49cf7a,JSON[_0xfa6b('0x16')](_0x2d50ea));_0x22e8df(_0x2d50ea);})['catch'](function(_0x43670f){logger[_0xfa6b('0x17')](_0xfa6b('0x1b'),_0x43670f[_0xfa6b('0x19')],_0x49cf7a);_0x2e8818(_0x40ab04[_0xfa6b('0x17')](0x1f4,_0x43670f[_0xfa6b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0134ace..661ac0e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 ff44ef4..d2f73b9 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11a6c2,_0x501fdf){var _0x46f007=function(_0x59104e){while(--_0x59104e){_0x11a6c2['push'](_0x11a6c2['shift']());}};_0x46f007(++_0x501fdf);}(_0x34e8,0x12c));var _0x834e=function(_0x5ac621,_0x107503){_0x5ac621=_0x5ac621-0x0;var _0x33e5bb=_0x34e8[_0x5ac621];return _0x33e5bb;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x9feaaa,_0x1ae043){var _0x4eeda5=function(_0x17ceeb){while(--_0x17ceeb){_0x9feaaa['push'](_0x9feaaa['shift']());}};_0x4eeda5(++_0x1ae043);}(_0x55ca,0x126));var _0xa55c=function(_0x4b4340,_0x295fc0){_0x4b4340=_0x4b4340-0x0;var _0x4cdb42=_0x55ca[_0x4b4340];return _0x4cdb42;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 61c1db2..ff4b65c 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 _0x1b95=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4fd12a,_0x21f8d7){var _0x590fb1=function(_0x5efd46){while(--_0x5efd46){_0x4fd12a['push'](_0x4fd12a['shift']());}};_0x590fb1(++_0x21f8d7);}(_0x1b95,0x15e));var _0x51b9=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x1b95[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0x51b9('0x0'));module[_0x51b9('0x1')]={'priority':{'type':Sequelize[_0x51b9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x51b9('0x3')],'allowNull':![],'defaultValue':_0x51b9('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':_0x51b9('0x5')}}; \ No newline at end of file +var _0x044b=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x2ea0f1,_0x2590d0){var _0x35cea7=function(_0x434226){while(--_0x434226){_0x2ea0f1['push'](_0x2ea0f1['shift']());}};_0x35cea7(++_0x2590d0);}(_0x044b,0x188));var _0xb044=function(_0x43a5f1,_0x3bdecc){_0x43a5f1=_0x43a5f1-0x0;var _0x46e6b8=_0x044b[_0x43a5f1];return _0x46e6b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb044('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb044('0x1')],'allowNull':![],'defaultValue':_0xb044('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb044('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0261a35..820ad17 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 _0xe0af=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1838b6,_0xc4f397){var _0x49854b=function(_0x261b58){while(--_0x261b58){_0x1838b6['push'](_0x1838b6['shift']());}};_0x49854b(++_0xc4f397);}(_0xe0af,0x88));var _0xfe0a=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0xe0af[_0x48961c];return _0x1d895d;};'use strict';var emlformat=require(_0xfe0a('0x0'));var rimraf=require(_0xfe0a('0x1'));var zipdir=require(_0xfe0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe0a('0x4'));var util=require(_0xfe0a('0x5'));var path=require('path');var sox=require(_0xfe0a('0x6'));var csv=require(_0xfe0a('0x7'));var ejs=require(_0xfe0a('0x8'));var fs=require('fs');var fs_extra=require(_0xfe0a('0x9'));var _=require(_0xfe0a('0xa'));var squel=require(_0xfe0a('0xb'));var crypto=require(_0xfe0a('0xc'));var jsforce=require(_0xfe0a('0xd'));var deskjs=require(_0xfe0a('0xe'));var toCsv=require(_0xfe0a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfe0a('0xf'));var as=require(_0xfe0a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe0a('0x11'))('api');var utils=require(_0xfe0a('0x12'));var config=require(_0xfe0a('0x13'));var licenseUtil=require(_0xfe0a('0x14'));var db=require(_0xfe0a('0x15'))['db'];function respondWithStatusCode(_0x43e940,_0x564f6e){_0x564f6e=_0x564f6e||0xcc;return function(_0x94dac8){if(_0x94dac8){return _0x43e940[_0xfe0a('0x16')](_0x564f6e);}return _0x43e940['status'](_0x564f6e)[_0xfe0a('0x17')]();};}function respondWithResult(_0xda2c00,_0x53e3ca){_0x53e3ca=_0x53e3ca||0xc8;return function(_0x271a14){if(_0x271a14){return _0xda2c00[_0xfe0a('0x18')](_0x53e3ca)[_0xfe0a('0x19')](_0x271a14);}};}function respondWithFilteredResult(_0x14ce7f,_0x1c6dfe){return function(_0xb96120){if(_0xb96120){var _0x55eec9=typeof _0x1c6dfe['offset']===_0xfe0a('0x1a')&&typeof _0x1c6dfe[_0xfe0a('0x1b')]===_0xfe0a('0x1a');var _0x79bdb6=_0xb96120['count'];var _0x4c7ae5=_0x55eec9?0x0:_0x1c6dfe[_0xfe0a('0x1c')];var _0x37fe4a=_0x55eec9?_0xb96120[_0xfe0a('0x1d')]:_0x1c6dfe[_0xfe0a('0x1c')]+_0x1c6dfe['limit'];var _0x412c30;if(_0x37fe4a>=_0x79bdb6){_0x37fe4a=_0x79bdb6;_0x412c30=0xc8;}else{_0x412c30=0xce;}_0x14ce7f['status'](_0x412c30);return _0x14ce7f[_0xfe0a('0x1e')](_0xfe0a('0x1f'),_0x4c7ae5+'-'+_0x37fe4a+'/'+_0x79bdb6)[_0xfe0a('0x19')](_0xb96120);}return null;};}function patchUpdates(_0x4c3f28){return function(_0x189bc9){try{jsonpatch[_0xfe0a('0x20')](_0x189bc9,_0x4c3f28,!![]);}catch(_0xfe03a3){return BPromise[_0xfe0a('0x21')](_0xfe03a3);}return _0x189bc9[_0xfe0a('0x22')]();};}function saveUpdates(_0x482c88,_0x4eee5a){return function(_0x5ccf24){if(_0x5ccf24){return _0x5ccf24[_0xfe0a('0x23')](_0x482c88)[_0xfe0a('0x24')](function(_0x31b18b){return _0x31b18b;});}return null;};}function removeEntity(_0x122d42,_0x4332df){return function(_0xf06115){if(_0xf06115){return _0xf06115[_0xfe0a('0x25')]()[_0xfe0a('0x24')](function(){_0x122d42[_0xfe0a('0x18')](0xcc)[_0xfe0a('0x17')]();});}};}function handleEntityNotFound(_0x5db3aa,_0x4eed72){return function(_0x2a4739){if(!_0x2a4739){_0x5db3aa[_0xfe0a('0x16')](0x194);}return _0x2a4739;};}function handleError(_0x219f83,_0x549ec2){_0x549ec2=_0x549ec2||0x1f4;return function(_0x1571d8){logger[_0xfe0a('0x26')](_0x1571d8[_0xfe0a('0x27')]);if(_0x1571d8[_0xfe0a('0x28')]){delete _0x1571d8[_0xfe0a('0x28')];}_0x219f83[_0xfe0a('0x18')](_0x549ec2)[_0xfe0a('0x29')](_0x1571d8);};}exports[_0xfe0a('0x2a')]=function(_0x282bdc,_0x3d4403){var _0x35f771={},_0x4db48f={},_0xe8fa25={'count':0x0,'rows':[]};var _0xc669fe=_[_0xfe0a('0x2b')](db[_0xfe0a('0x2c')][_0xfe0a('0x2d')],function(_0x56079c){return{'name':_0x56079c[_0xfe0a('0x2e')],'type':_0x56079c[_0xfe0a('0x2f')][_0xfe0a('0x30')]};});_0x4db48f[_0xfe0a('0x31')]=_[_0xfe0a('0x2b')](_0xc669fe,_0xfe0a('0x28'));_0x4db48f['query']=_[_0xfe0a('0x32')](_0x282bdc[_0xfe0a('0x33')]);_0x4db48f[_0xfe0a('0x34')]=_[_0xfe0a('0x35')](_0x4db48f[_0xfe0a('0x31')],_0x4db48f[_0xfe0a('0x33')]);_0x35f771['attributes']=_[_0xfe0a('0x35')](_0x4db48f[_0xfe0a('0x31')],qs[_0xfe0a('0x36')](_0x282bdc[_0xfe0a('0x33')][_0xfe0a('0x36')]));_0x35f771[_0xfe0a('0x37')]=_0x35f771[_0xfe0a('0x37')][_0xfe0a('0x38')]?_0x35f771[_0xfe0a('0x37')]:_0x4db48f[_0xfe0a('0x31')];if(!_0x282bdc['query'][_0xfe0a('0x39')](_0xfe0a('0x3a'))){_0x35f771['limit']=qs['limit'](_0x282bdc[_0xfe0a('0x33')][_0xfe0a('0x1b')]);_0x35f771[_0xfe0a('0x1c')]=qs['offset'](_0x282bdc['query'][_0xfe0a('0x1c')]);}_0x35f771[_0xfe0a('0x3b')]=qs[_0xfe0a('0x3c')](_0x282bdc[_0xfe0a('0x33')]['sort']);_0x35f771[_0xfe0a('0x3d')]=qs['filters'](_[_0xfe0a('0x3e')](_0x282bdc[_0xfe0a('0x33')],_0x4db48f['filters']),_0xc669fe);if(_0x282bdc['query']['filter']){_0x35f771[_0xfe0a('0x3d')]=_[_0xfe0a('0x3f')](_0x35f771['where'],{'$or':_[_0xfe0a('0x2b')](_0xc669fe,function(_0x1fbf70){if(_0x1fbf70[_0xfe0a('0x2f')]!==_0xfe0a('0x40')){var _0x6ef045={};_0x6ef045[_0x1fbf70[_0xfe0a('0x28')]]={'$like':'%'+_0x282bdc[_0xfe0a('0x33')][_0xfe0a('0x41')]+'%'};return _0x6ef045;}})});}_0x35f771=_[_0xfe0a('0x3f')]({},_0x35f771,_0x282bdc[_0xfe0a('0x42')]);var _0x31bace={'where':_0x35f771[_0xfe0a('0x3d')]};return db['SmsApplication'][_0xfe0a('0x1d')](_0x31bace)[_0xfe0a('0x24')](function(_0x279c6b){_0xe8fa25[_0xfe0a('0x1d')]=_0x279c6b;if(_0x282bdc[_0xfe0a('0x33')]['includeAll']){_0x35f771[_0xfe0a('0x43')]=[{'all':!![]}];}return db[_0xfe0a('0x2c')][_0xfe0a('0x44')](_0x35f771);})[_0xfe0a('0x24')](function(_0xcd1053){_0xe8fa25[_0xfe0a('0x45')]=_0xcd1053;return _0xe8fa25;})[_0xfe0a('0x24')](respondWithFilteredResult(_0x3d4403,_0x35f771))[_0xfe0a('0x46')](handleError(_0x3d4403,null));};exports[_0xfe0a('0x47')]=function(_0x1d2ef7,_0x187dc2){var _0x2aa654={'raw':!![],'where':{'id':_0x1d2ef7[_0xfe0a('0x48')]['id']}},_0x1e5def={};_0x1e5def[_0xfe0a('0x31')]=_[_0xfe0a('0x32')](db['SmsApplication'][_0xfe0a('0x2d')]);_0x1e5def[_0xfe0a('0x33')]=_[_0xfe0a('0x32')](_0x1d2ef7[_0xfe0a('0x33')]);_0x1e5def[_0xfe0a('0x34')]=_['intersection'](_0x1e5def[_0xfe0a('0x31')],_0x1e5def[_0xfe0a('0x33')]);_0x2aa654[_0xfe0a('0x37')]=_[_0xfe0a('0x35')](_0x1e5def[_0xfe0a('0x31')],qs['fields'](_0x1d2ef7[_0xfe0a('0x33')]['fields']));_0x2aa654[_0xfe0a('0x37')]=_0x2aa654[_0xfe0a('0x37')]['length']?_0x2aa654[_0xfe0a('0x37')]:_0x1e5def[_0xfe0a('0x31')];if(_0x1d2ef7['query'][_0xfe0a('0x49')]){_0x2aa654[_0xfe0a('0x43')]=[{'all':!![]}];}_0x2aa654=_[_0xfe0a('0x3f')]({},_0x2aa654,_0x1d2ef7[_0xfe0a('0x42')]);return db[_0xfe0a('0x2c')][_0xfe0a('0x4a')](_0x2aa654)[_0xfe0a('0x24')](handleEntityNotFound(_0x187dc2,null))[_0xfe0a('0x24')](respondWithResult(_0x187dc2,null))[_0xfe0a('0x46')](handleError(_0x187dc2,null));};exports[_0xfe0a('0x4b')]=function(_0x36d587,_0x5336f4){return db[_0xfe0a('0x2c')]['create'](_0x36d587[_0xfe0a('0x4c')],{})[_0xfe0a('0x24')](respondWithResult(_0x5336f4,0xc9))[_0xfe0a('0x46')](handleError(_0x5336f4,null));};exports[_0xfe0a('0x23')]=function(_0x3de96b,_0x510c44){if(_0x3de96b[_0xfe0a('0x4c')]['id']){delete _0x3de96b[_0xfe0a('0x4c')]['id'];}return db['SmsApplication'][_0xfe0a('0x4a')]({'where':{'id':_0x3de96b[_0xfe0a('0x48')]['id']}})[_0xfe0a('0x24')](handleEntityNotFound(_0x510c44,null))[_0xfe0a('0x24')](saveUpdates(_0x3de96b[_0xfe0a('0x4c')],null))[_0xfe0a('0x24')](respondWithResult(_0x510c44,null))['catch'](handleError(_0x510c44,null));};exports[_0xfe0a('0x25')]=function(_0x57469e,_0x311fa1){return db['SmsApplication'][_0xfe0a('0x4a')]({'where':{'id':_0x57469e[_0xfe0a('0x48')]['id']}})['then'](handleEntityNotFound(_0x311fa1,null))[_0xfe0a('0x24')](removeEntity(_0x311fa1,null))['catch'](handleError(_0x311fa1,null));}; \ No newline at end of file +var _0x0234=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','catch','show','find','create','body','params'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0234,0x12c));var _0x4023=function(_0x3a8114,_0x549ce8){_0x3a8114=_0x3a8114-0x0;var _0x4ebb2f=_0x0234[_0x3a8114];return _0x4ebb2f;};'use strict';var emlformat=require(_0x4023('0x0'));var rimraf=require(_0x4023('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4023('0x2'));var rp=require(_0x4023('0x3'));var moment=require(_0x4023('0x4'));var BPromise=require(_0x4023('0x5'));var Mustache=require(_0x4023('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4023('0x7'));var csv=require(_0x4023('0x8'));var ejs=require(_0x4023('0x9'));var fs=require('fs');var fs_extra=require(_0x4023('0xa'));var _=require(_0x4023('0xb'));var squel=require('squel');var crypto=require(_0x4023('0xc'));var jsforce=require(_0x4023('0xd'));var deskjs=require(_0x4023('0xe'));var toCsv=require(_0x4023('0x8'));var querystring=require(_0x4023('0xf'));var Papa=require('papaparse');var Redis=require(_0x4023('0x10'));var authService=require(_0x4023('0x11'));var qs=require(_0x4023('0x12'));var as=require(_0x4023('0x13'));var hardwareService=require(_0x4023('0x14'));var logger=require(_0x4023('0x15'))(_0x4023('0x16'));var utils=require(_0x4023('0x17'));var config=require(_0x4023('0x18'));var licenseUtil=require(_0x4023('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ffbcb,_0x32b31b){_0x32b31b=_0x32b31b||0xcc;return function(_0x2548ac){if(_0x2548ac){return _0x1ffbcb['sendStatus'](_0x32b31b);}return _0x1ffbcb[_0x4023('0x1a')](_0x32b31b)[_0x4023('0x1b')]();};}function respondWithResult(_0x1a6113,_0x348edc){_0x348edc=_0x348edc||0xc8;return function(_0x4c0224){if(_0x4c0224){return _0x1a6113[_0x4023('0x1a')](_0x348edc)[_0x4023('0x1c')](_0x4c0224);}};}function respondWithFilteredResult(_0x167665,_0x47d475){return function(_0xd7198){if(_0xd7198){var _0x5ea480=typeof _0x47d475[_0x4023('0x1d')]===_0x4023('0x1e')&&typeof _0x47d475[_0x4023('0x1f')]===_0x4023('0x1e');var _0xc41d6d=_0xd7198[_0x4023('0x20')];var _0x1a6fd4=_0x5ea480?0x0:_0x47d475[_0x4023('0x1d')];var _0x9114a=_0x5ea480?_0xd7198[_0x4023('0x20')]:_0x47d475[_0x4023('0x1d')]+_0x47d475['limit'];var _0x2c3896;if(_0x9114a>=_0xc41d6d){_0x9114a=_0xc41d6d;_0x2c3896=0xc8;}else{_0x2c3896=0xce;}_0x167665['status'](_0x2c3896);return _0x167665['set'](_0x4023('0x21'),_0x1a6fd4+'-'+_0x9114a+'/'+_0xc41d6d)[_0x4023('0x1c')](_0xd7198);}return null;};}function patchUpdates(_0x50b861){return function(_0x53efa9){try{jsonpatch[_0x4023('0x22')](_0x53efa9,_0x50b861,!![]);}catch(_0x54b51){return BPromise[_0x4023('0x23')](_0x54b51);}return _0x53efa9['save']();};}function saveUpdates(_0x46a95d,_0x264edd){return function(_0x2c9391){if(_0x2c9391){return _0x2c9391[_0x4023('0x24')](_0x46a95d)['then'](function(_0x52388d){return _0x52388d;});}return null;};}function removeEntity(_0x46e0ae,_0x373d33){return function(_0x3abc9b){if(_0x3abc9b){return _0x3abc9b[_0x4023('0x25')]()[_0x4023('0x26')](function(){_0x46e0ae[_0x4023('0x1a')](0xcc)[_0x4023('0x1b')]();});}};}function handleEntityNotFound(_0x127c19,_0x45ca09){return function(_0x33f3c8){if(!_0x33f3c8){_0x127c19[_0x4023('0x27')](0x194);}return _0x33f3c8;};}function handleError(_0x506c78,_0x3529a9){_0x3529a9=_0x3529a9||0x1f4;return function(_0x22b339){logger[_0x4023('0x28')](_0x22b339[_0x4023('0x29')]);if(_0x22b339[_0x4023('0x2a')]){delete _0x22b339[_0x4023('0x2a')];}_0x506c78[_0x4023('0x1a')](_0x3529a9)[_0x4023('0x2b')](_0x22b339);};}exports[_0x4023('0x2c')]=function(_0x2cbb5c,_0xd3ae08){var _0x205010={},_0x2d6fb6={},_0x59a35f={'count':0x0,'rows':[]};var _0x5c3cfc=_['map'](db[_0x4023('0x2d')][_0x4023('0x2e')],function(_0x280ad5){return{'name':_0x280ad5[_0x4023('0x2f')],'type':_0x280ad5[_0x4023('0x30')][_0x4023('0x31')]};});_0x2d6fb6[_0x4023('0x32')]=_['map'](_0x5c3cfc,_0x4023('0x2a'));_0x2d6fb6[_0x4023('0x33')]=_[_0x4023('0x34')](_0x2cbb5c[_0x4023('0x33')]);_0x2d6fb6[_0x4023('0x35')]=_[_0x4023('0x36')](_0x2d6fb6['model'],_0x2d6fb6[_0x4023('0x33')]);_0x205010[_0x4023('0x37')]=_[_0x4023('0x36')](_0x2d6fb6['model'],qs[_0x4023('0x38')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x38')]));_0x205010[_0x4023('0x37')]=_0x205010[_0x4023('0x37')][_0x4023('0x39')]?_0x205010[_0x4023('0x37')]:_0x2d6fb6[_0x4023('0x32')];if(!_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3a')](_0x4023('0x3b'))){_0x205010[_0x4023('0x1f')]=qs['limit'](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1f')]);_0x205010[_0x4023('0x1d')]=qs[_0x4023('0x1d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x1d')]);}_0x205010[_0x4023('0x3c')]=qs[_0x4023('0x3d')](_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3d')]);_0x205010[_0x4023('0x3e')]=qs[_0x4023('0x35')](_['pick'](_0x2cbb5c[_0x4023('0x33')],_0x2d6fb6[_0x4023('0x35')]),_0x5c3cfc);if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x3f')]){_0x205010[_0x4023('0x3e')]=_[_0x4023('0x40')](_0x205010['where'],{'$or':_[_0x4023('0x41')](_0x5c3cfc,function(_0x1c77d8){if(_0x1c77d8[_0x4023('0x30')]!==_0x4023('0x42')){var _0x4080c3={};_0x4080c3[_0x1c77d8['name']]={'$like':'%'+_0x2cbb5c[_0x4023('0x33')]['filter']+'%'};return _0x4080c3;}})});}_0x205010=_[_0x4023('0x40')]({},_0x205010,_0x2cbb5c['options']);var _0x57042d={'where':_0x205010['where']};return db[_0x4023('0x2d')][_0x4023('0x20')](_0x57042d)[_0x4023('0x26')](function(_0x3b7c39){_0x59a35f[_0x4023('0x20')]=_0x3b7c39;if(_0x2cbb5c[_0x4023('0x33')][_0x4023('0x43')]){_0x205010[_0x4023('0x44')]=[{'all':!![]}];}return db[_0x4023('0x2d')]['findAll'](_0x205010);})['then'](function(_0x43bc3d){_0x59a35f['rows']=_0x43bc3d;return _0x59a35f;})[_0x4023('0x26')](respondWithFilteredResult(_0xd3ae08,_0x205010))[_0x4023('0x45')](handleError(_0xd3ae08,null));};exports[_0x4023('0x46')]=function(_0x7aad79,_0x15306e){var _0x24acb3={'raw':!![],'where':{'id':_0x7aad79['params']['id']}},_0x538fa2={};_0x538fa2[_0x4023('0x32')]=_['keys'](db[_0x4023('0x2d')][_0x4023('0x2e')]);_0x538fa2[_0x4023('0x33')]=_['keys'](_0x7aad79[_0x4023('0x33')]);_0x538fa2[_0x4023('0x35')]=_[_0x4023('0x36')](_0x538fa2['model'],_0x538fa2[_0x4023('0x33')]);_0x24acb3[_0x4023('0x37')]=_[_0x4023('0x36')](_0x538fa2[_0x4023('0x32')],qs['fields'](_0x7aad79['query'][_0x4023('0x38')]));_0x24acb3[_0x4023('0x37')]=_0x24acb3['attributes'][_0x4023('0x39')]?_0x24acb3[_0x4023('0x37')]:_0x538fa2['model'];if(_0x7aad79[_0x4023('0x33')][_0x4023('0x43')]){_0x24acb3[_0x4023('0x44')]=[{'all':!![]}];}_0x24acb3=_['merge']({},_0x24acb3,_0x7aad79['options']);return db[_0x4023('0x2d')][_0x4023('0x47')](_0x24acb3)['then'](handleEntityNotFound(_0x15306e,null))[_0x4023('0x26')](respondWithResult(_0x15306e,null))[_0x4023('0x45')](handleError(_0x15306e,null));};exports[_0x4023('0x48')]=function(_0x2a42c1,_0x4ee6b2){return db[_0x4023('0x2d')][_0x4023('0x48')](_0x2a42c1['body'],{})[_0x4023('0x26')](respondWithResult(_0x4ee6b2,0xc9))[_0x4023('0x45')](handleError(_0x4ee6b2,null));};exports[_0x4023('0x24')]=function(_0x238951,_0x349c4d){if(_0x238951[_0x4023('0x49')]['id']){delete _0x238951[_0x4023('0x49')]['id'];}return db[_0x4023('0x2d')][_0x4023('0x47')]({'where':{'id':_0x238951[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x349c4d,null))[_0x4023('0x26')](saveUpdates(_0x238951['body'],null))['then'](respondWithResult(_0x349c4d,null))[_0x4023('0x45')](handleError(_0x349c4d,null));};exports['destroy']=function(_0x134f21,_0x30aa60){return db['SmsApplication']['find']({'where':{'id':_0x134f21[_0x4023('0x4a')]['id']}})[_0x4023('0x26')](handleEntityNotFound(_0x30aa60,null))[_0x4023('0x26')](removeEntity(_0x30aa60,null))[_0x4023('0x45')](handleError(_0x30aa60,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 8e306ad..1f15ea0 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 _0x2296=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x2aa18d,_0x367b3f){var _0x30c427=function(_0x482ae4){while(--_0x482ae4){_0x2aa18d['push'](_0x2aa18d['shift']());}};_0x30c427(++_0x367b3f);}(_0x2296,0x181));var _0x6229=function(_0x1d9616,_0xb3f3e6){_0x1d9616=_0x1d9616-0x0;var _0x59083e=_0x2296[_0x1d9616];return _0x59083e;};'use strict';var _=require('lodash');var util=require(_0x6229('0x0'));var logger=require(_0x6229('0x1'))(_0x6229('0x2'));var moment=require(_0x6229('0x3'));var BPromise=require(_0x6229('0x4'));var rp=require(_0x6229('0x5'));var fs=require('fs');var path=require(_0x6229('0x6'));var rimraf=require(_0x6229('0x7'));var config=require(_0x6229('0x8'));var attributes=require(_0x6229('0x9'));module[_0x6229('0xa')]=function(_0x5463ed,_0x4ca4f7){return _0x5463ed['define'](_0x6229('0xb'),attributes,{'tableName':_0x6229('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6229('0xd'),'collate':_0x6229('0xe')});}; \ No newline at end of file +var _0x52e1=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','../../config/logger','moment'];(function(_0x194cee,_0x5184f1){var _0x5954df=function(_0x41f3f1){while(--_0x41f3f1){_0x194cee['push'](_0x194cee['shift']());}};_0x5954df(++_0x5184f1);}(_0x52e1,0xb9));var _0x152e=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x52e1[_0x29975a];return _0x41bcac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x152e('0x0'))('api');var moment=require(_0x152e('0x1'));var BPromise=require('bluebird');var rp=require(_0x152e('0x2'));var fs=require('fs');var path=require(_0x152e('0x3'));var rimraf=require(_0x152e('0x4'));var config=require(_0x152e('0x5'));var attributes=require(_0x152e('0x6'));module[_0x152e('0x7')]=function(_0x2fb082,_0x2b3818){return _0x2fb082[_0x152e('0x8')](_0x152e('0x9'),attributes,{'tableName':_0x152e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index fb697ea..d2b614f 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 _0xf894=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x4f94eb,_0x27af5a){var _0x556912=function(_0x58ee93){while(--_0x58ee93){_0x4f94eb['push'](_0x4f94eb['shift']());}};_0x556912(++_0x27af5a);}(_0xf894,0xfd));var _0x4f89=function(_0x9b9c0c,_0x5579e7){_0x9b9c0c=_0x9b9c0c-0x0;var _0x3945b1=_0xf894[_0x9b9c0c];return _0x3945b1;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var moment=require(_0x4f89('0x2'));var BPromise=require(_0x4f89('0x3'));var rs=require(_0x4f89('0x4'));var fs=require('fs');var Redis=require(_0x4f89('0x5'));var db=require(_0x4f89('0x6'))['db'];var utils=require(_0x4f89('0x7'));var logger=require(_0x4f89('0x8'))(_0x4f89('0x9'));var config=require(_0x4f89('0xa'));var jayson=require(_0x4f89('0xb'));var client=jayson[_0x4f89('0xc')][_0x4f89('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x324870,_0x33920a,_0x39b492){return new BPromise(function(_0x188d3f,_0x5cb3a5){return client[_0x4f89('0xe')](_0x324870,_0x39b492)[_0x4f89('0xf')](function(_0x2eb8fe){logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));logger[_0x4f89('0x13')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x33920a,'request\x20sent',JSON['stringify'](_0x2eb8fe));if(_0x2eb8fe[_0x4f89('0x14')]){if(_0x2eb8fe[_0x4f89('0x14')]['code']===0x1f4){logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);return _0x5cb3a5(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}logger[_0x4f89('0x14')](_0x4f89('0x11'),_0x33920a,_0x2eb8fe[_0x4f89('0x14')]['message']);return _0x188d3f(_0x2eb8fe[_0x4f89('0x14')][_0x4f89('0x15')]);}else{logger[_0x4f89('0x10')](_0x4f89('0x11'),_0x33920a,_0x4f89('0x12'));_0x188d3f(_0x2eb8fe[_0x4f89('0x16')][_0x4f89('0x15')]);}})['catch'](function(_0x9c194){logger['error']('SmsApplication,\x20%s,\x20%s',_0x33920a,_0x9c194);_0x5cb3a5(_0x9c194);});});} \ No newline at end of file +var _0xe056=['code','message','info','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x17e498,_0x48989c){var _0x4cd515=function(_0x5a84c8){while(--_0x5a84c8){_0x17e498['push'](_0x17e498['shift']());}};_0x4cd515(++_0x48989c);}(_0xe056,0xdb));var _0x6e05=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xe056[_0x57e00e];return _0x415e60;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e05('0x0'));var BPromise=require(_0x6e05('0x1'));var rs=require(_0x6e05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e05('0x4'))(_0x6e05('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6e05('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x390bb6,_0x1c78eb,_0x5dacb2){return new BPromise(function(_0x1a54b7,_0x177b2c){return client[_0x6e05('0x7')](_0x390bb6,_0x5dacb2)[_0x6e05('0x8')](function(_0x13af56){logger['info'](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));logger[_0x6e05('0xb')](_0x6e05('0xc'),_0x1c78eb,_0x6e05('0xa'),JSON[_0x6e05('0xd')](_0x13af56));if(_0x13af56['error']){if(_0x13af56[_0x6e05('0xe')][_0x6e05('0xf')]===0x1f4){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x177b2c(_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);}logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x13af56[_0x6e05('0xe')][_0x6e05('0x10')]);return _0x1a54b7(_0x13af56['error']['message']);}else{logger[_0x6e05('0x11')](_0x6e05('0x9'),_0x1c78eb,_0x6e05('0xa'));_0x1a54b7(_0x13af56['result'][_0x6e05('0x10')]);}})['catch'](function(_0x3c3ef0){logger[_0x6e05('0xe')]('SmsApplication,\x20%s,\x20%s',_0x1c78eb,_0x3c3ef0);_0x177b2c(_0x3c3ef0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e2bc239..fae4755 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 _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x8def08,_0xb39edd){_0x8def08=_0x8def08-0x0;var _0x25a4bb=_0x757a[_0x8def08];return _0x25a4bb;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x4eca3d,_0xa3c2be){var _0x355f3f=function(_0x2ff4bb){while(--_0x2ff4bb){_0x4eca3d['push'](_0x4eca3d['shift']());}};_0x355f3f(++_0xa3c2be);}(_0x13f6,0x124));var _0x613f=function(_0x498925,_0x28ae72){_0x498925=_0x498925-0x0;var _0x2fbaf1=_0x13f6[_0x498925];return _0x2fbaf1;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 614165a..b01bf74 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 _0x4074=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x5a3e69,_0x346f71){var _0x27073b=function(_0x36283e){while(--_0x36283e){_0x5a3e69['push'](_0x5a3e69['shift']());}};_0x27073b(++_0x346f71);}(_0x4074,0xf0));var _0x4407=function(_0x242acc,_0x2a93ab){_0x242acc=_0x242acc-0x0;var _0x3ecae2=_0x4074[_0x242acc];return _0x3ecae2;};'use strict';var Sequelize=require(_0x4407('0x0'));var moment=require(_0x4407('0x1'));module[_0x4407('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4407('0x3')]},'disposition':{'type':Sequelize[_0x4407('0x4')]},'secondDisposition':{'type':Sequelize[_0x4407('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4407('0x4')]},'note':{'type':Sequelize[_0x4407('0x4')]},'phone':{'type':Sequelize[_0x4407('0x4')]},'read1stAt':{'type':Sequelize[_0x4407('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4407('0x5')]('in',_0x4407('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4407('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4407('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf6c1=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0xf7359d,_0x22411f){var _0x1e2429=function(_0x5cc9c5){while(--_0x5cc9c5){_0xf7359d['push'](_0xf7359d['shift']());}};_0x1e2429(++_0x22411f);}(_0xf6c1,0x99));var _0x1f6c=function(_0x29d4f5,_0x1d8d1b){_0x29d4f5=_0x29d4f5-0x0;var _0x343c1a=_0xf6c1[_0x29d4f5];return _0x343c1a;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1f6c('0x0')]={'closed':{'type':Sequelize[_0x1f6c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1f6c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1f6c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1f6c('0x3')]},'phone':{'type':Sequelize[_0x1f6c('0x3')]},'read1stAt':{'type':Sequelize[_0x1f6c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1f6c('0x4')]('in',_0x1f6c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f6c('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1f6c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f6c('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 803a25b..7c821fa 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 _0xfb0e=['reject','update','destroy','then','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','unmanaged','total','closed','UserId','answered','index','SmsInteraction','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','u.id\x20=\x20ui.UserId','select','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','sms_accounts','a.id\x20=\x20i.SmsAccountId','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','`\x20>\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','keys','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','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','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','unreadMessages','Account.key','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','c.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','rawAttributes','includeAll','options','catch','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','join','server','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','SmsAccount','Account','Owner','get','Sms','N.A.','closedAt','disposition','direction','out','System','secret','root','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfb0e,0xc1));var _0xefb0=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xfb0e[_0x56a871];return _0x124954;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefb0('0x0'));var zipdir=require(_0xefb0('0x1'));var jsonpatch=require(_0xefb0('0x2'));var rp=require(_0xefb0('0x3'));var moment=require('moment');var BPromise=require(_0xefb0('0x4'));var Mustache=require(_0xefb0('0x5'));var util=require(_0xefb0('0x6'));var path=require('path');var sox=require(_0xefb0('0x7'));var csv=require('to-csv');var ejs=require(_0xefb0('0x8'));var fs=require('fs');var fs_extra=require(_0xefb0('0x9'));var _=require(_0xefb0('0xa'));var squel=require(_0xefb0('0xb'));var crypto=require('crypto');var jsforce=require(_0xefb0('0xc'));var deskjs=require(_0xefb0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xefb0('0xe'));var Papa=require('papaparse');var Redis=require(_0xefb0('0xf'));var authService=require(_0xefb0('0x10'));var qs=require(_0xefb0('0x11'));var as=require(_0xefb0('0x12'));var pdf=require(_0xefb0('0x13'));var hardwareService=require(_0xefb0('0x14'));var logger=require(_0xefb0('0x15'))(_0xefb0('0x16'));var utils=require(_0xefb0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xefb0('0x18'));var db=require('../../mysqldb')['db'];config[_0xefb0('0x19')]=_[_0xefb0('0x1a')](config[_0xefb0('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xefb0('0x1b'))(new Redis(config[_0xefb0('0x19')]));require(_0xefb0('0x1c'))[_0xefb0('0x1d')](socket);function respondWithStatusCode(_0x173514,_0x150fbf){_0x150fbf=_0x150fbf||0xcc;return function(_0x9765c3){if(_0x9765c3){return _0x173514[_0xefb0('0x1e')](_0x150fbf);}return _0x173514['status'](_0x150fbf)[_0xefb0('0x1f')]();};}function respondWithResult(_0x2510a3,_0x2d2d6e){_0x2d2d6e=_0x2d2d6e||0xc8;return function(_0xc8d263){if(_0xc8d263){return _0x2510a3[_0xefb0('0x20')](_0x2d2d6e)[_0xefb0('0x21')](_0xc8d263);}};}function respondWithFilteredResult(_0x225d36,_0x2b7daa){return function(_0x3adead){if(_0x3adead){var _0x58226a=typeof _0x2b7daa[_0xefb0('0x22')]===_0xefb0('0x23')&&typeof _0x2b7daa['limit']===_0xefb0('0x23');var _0x22989f=_0x3adead[_0xefb0('0x24')];var _0x5acca9=_0x58226a?0x0:_0x2b7daa['offset'];var _0x4ef0fa=_0x58226a?_0x3adead[_0xefb0('0x24')]:_0x2b7daa[_0xefb0('0x22')]+_0x2b7daa[_0xefb0('0x25')];var _0x52bce0;if(_0x4ef0fa>=_0x22989f){_0x4ef0fa=_0x22989f;_0x52bce0=0xc8;}else{_0x52bce0=0xce;}_0x225d36[_0xefb0('0x20')](_0x52bce0);return _0x225d36['set'](_0xefb0('0x26'),_0x5acca9+'-'+_0x4ef0fa+'/'+_0x22989f)[_0xefb0('0x21')](_0x3adead);}return null;};}function patchUpdates(_0x19d013){return function(_0x150531){try{jsonpatch[_0xefb0('0x27')](_0x150531,_0x19d013,!![]);}catch(_0x153b14){return BPromise[_0xefb0('0x28')](_0x153b14);}return _0x150531['save']();};}function saveUpdates(_0x45c4c0,_0x5df26b){return function(_0x2782c8){if(_0x2782c8){return _0x2782c8[_0xefb0('0x29')](_0x45c4c0)['then'](function(_0x2da023){return _0x2da023;});}return null;};}function removeEntity(_0xd7964b,_0x25b50e){return function(_0x39fd15){if(_0x39fd15){return _0x39fd15[_0xefb0('0x2a')]()[_0xefb0('0x2b')](function(){_0xd7964b[_0xefb0('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x182cc1,_0x3eaeb0){return function(_0x550ac2){if(!_0x550ac2){_0x182cc1[_0xefb0('0x1e')](0x194);}return _0x550ac2;};}function handleError(_0x27b47e,_0x5e5352){_0x5e5352=_0x5e5352||0x1f4;return function(_0x1b78cc){logger[_0xefb0('0x2c')](_0x1b78cc[_0xefb0('0x2d')]);if(_0x1b78cc[_0xefb0('0x2e')]){delete _0x1b78cc['name'];}_0x27b47e['status'](_0x5e5352)['send'](_0x1b78cc);};}function getInteractionUsers(_0x5c7156,_0x2e59c8){return new BPromise(function(_0x214e7c,_0x36eb2b){try{if(_0x2e59c8[_0x5c7156['id']]){_0x5c7156[_0xefb0('0x2f')]=_[_0xefb0('0x30')](_0x2e59c8[_0x5c7156['id']],function(_0x40b8d8){return{'id':_0x40b8d8['id'],'fullname':_0x40b8d8[_0xefb0('0x31')]};});}}catch(_0x5efe90){_0x36eb2b(_0x5efe90);}_0x214e7c(_0x5c7156);});}function getInteractionTags(_0x3a5945,_0x1d90e9){return new BPromise(function(_0x475f1e,_0xa58994){try{if(_0x3a5945[_0xefb0('0x32')]){_0x3a5945[_0xefb0('0x33')]=[];_0x3a5945[_0xefb0('0x32')][_0xefb0('0x34')](',')[_0xefb0('0x35')](function(_0x1a3bbb){_0x3a5945[_0xefb0('0x33')][_0xefb0('0x36')](_0x1d90e9[_0x1a3bbb]);});}delete _0x3a5945[_0xefb0('0x32')];}catch(_0x523824){_0xa58994(_0x523824);}_0x475f1e(_0x3a5945);});}function updateSmsInteraction(_0x1ec5f4,_0x2586a0,_0x438713){return new BPromise(function(_0x284d48,_0x2ded27){return getInteractionUsers(_0x1ec5f4,_0x438713)['then'](function(_0x44130e){return getInteractionTags(_0x44130e,_0x2586a0);})['then'](function(_0x3b0a78){return getStateInteraction(_0x3b0a78);})[_0xefb0('0x2b')](function(_0x3ee26){_0x284d48(_0x3ee26);})['catch'](function(_0x5a485f){_0x2ded27(_0x5a485f);});});}function getStateInteraction(_0x48622d){return new BPromise(function(_0x3ccb9f){_0x48622d[_0xefb0('0x37')]=0x0;_0x48622d[_0xefb0('0x38')]=0x0;_0x48622d['answered']=0x0;_0x48622d[_0xefb0('0x39')]=0x0;_0x48622d[_0xefb0('0x3a')]=0x0;if(!_0x48622d[_0xefb0('0x3b')]&&!_0x48622d[_0xefb0('0x3c')]){_0x48622d['waiting']+=0x1;}if(!_0x48622d[_0xefb0('0x3b')]&&_0x48622d[_0xefb0('0x3c')]){_0x48622d[_0xefb0('0x38')]+=0x1;if(_0x48622d['waiting']){_0x48622d['waiting']-=0x1;}}if(_0x48622d[_0xefb0('0x3b')]&&_0x48622d[_0xefb0('0x3c')]){_0x48622d[_0xefb0('0x3d')]+=0x1;if(_0x48622d['talking']){_0x48622d[_0xefb0('0x38')]-=0x1;}}if(_0x48622d['closed']&&!_0x48622d['UserId']){_0x48622d[_0xefb0('0x39')]+=0x1;if(_0x48622d[_0xefb0('0x37')]){_0x48622d['waiting']-=0x1;}}_0x48622d[_0xefb0('0x3a')]+=0x1;_0x3ccb9f(_0x48622d);});}exports[_0xefb0('0x3e')]=function(_0x38e7ff,_0x2c7d04){var _0x4a0cc4={},_0x45c80b={},_0x799709={'count':0x0,'rows':[]};var _0x44bd50=_['map'](db[_0xefb0('0x3f')]['rawAttributes'],function(_0x225bfb){return{'name':_0x225bfb['fieldName'],'type':_0x225bfb[_0xefb0('0x40')][_0xefb0('0x41')]};});_0x45c80b[_0xefb0('0x42')]=_[_0xefb0('0x30')](_0x44bd50,'name');_0x45c80b[_0xefb0('0x43')]=_['keys'](_0x38e7ff[_0xefb0('0x43')]);_0x45c80b['filters']=_['intersection'](_0x45c80b[_0xefb0('0x42')],_0x45c80b[_0xefb0('0x43')]);_0x4a0cc4[_0xefb0('0x44')]=_[_0xefb0('0x45')](_0x45c80b['model'],qs[_0xefb0('0x46')](_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x46')]));_0x4a0cc4['attributes']=_0x4a0cc4['attributes'][_0xefb0('0x47')]?_0x4a0cc4[_0xefb0('0x44')]:_0x45c80b[_0xefb0('0x42')];if(!_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x48')](_0xefb0('0x49'))){_0x4a0cc4[_0xefb0('0x25')]=qs[_0xefb0('0x25')](_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x25')]);_0x4a0cc4[_0xefb0('0x22')]=qs[_0xefb0('0x22')](_0x38e7ff['query']['offset']);}_0x4a0cc4[_0xefb0('0x4a')]=qs[_0xefb0('0x4b')](_0x38e7ff['query'][_0xefb0('0x4b')]);_0x4a0cc4['where']=qs['filters'](_['pick'](_0x38e7ff[_0xefb0('0x43')],_0x45c80b[_0xefb0('0x4c')]),_0x44bd50);var _0x2779ca=[];var _0x1ee15b=squel['select']()[_0xefb0('0x4d')]('id')[_0xefb0('0x4d')](_0xefb0('0x2e'))[_0xefb0('0x4d')]('color')[_0xefb0('0x4e')](_0xefb0('0x4f'));var _0x5a9bf8=squel['select']()['field'](_0xefb0('0x50'))[_0xefb0('0x4d')](_0xefb0('0x51'))['field'](_0xefb0('0x52'))[_0xefb0('0x4e')](_0xefb0('0x53'),'ui')['left_join']('users','u',_0xefb0('0x54'));var _0x501c01=squel[_0xefb0('0x55')]()[_0xefb0('0x4e')](_0xefb0('0x56'),'i')['left_join'](_0xefb0('0x57'),'c',_0xefb0('0x58'))[_0xefb0('0x59')](_0xefb0('0x5a'),'o','o.id\x20=\x20i.UserId')[_0xefb0('0x59')](_0xefb0('0x5b'),'a',_0xefb0('0x5c'))[_0xefb0('0x59')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xefb0('0x59')]('sms_interaction_has_tags','it',_0xefb0('0x5d'))[_0xefb0('0x59')]('tools_tags','t',_0xefb0('0x5e'));var _0x24ecc6=squel['expr']();var _0x1c3497=[];var _0x3a2689=squel[_0xefb0('0x5f')]();var _0x3cfd6d;if(_0x38e7ff['query'][_0xefb0('0x60')]){_0x3cfd6d=as['parseSearch'](_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x60')]);var _0x17fe84=_0x3cfd6d[_0xefb0('0x61')];for(var _0x398e1a=0x0;_0x398e1a<_0x3cfd6d['conditions'][_0xefb0('0x47')];_0x398e1a++){var _0x342a8d=_0x3cfd6d[_0xefb0('0x62')][_0x398e1a];var _0x8b8f12='i';var _0x665745=_[_0xefb0('0x63')](_0x44bd50,['name',_0x342a8d['field']]);if(!_0x665745){switch(_0x342a8d[_0xefb0('0x4d')]){case'unreadMessages':if(_0x342a8d[_0xefb0('0x64')]==0x1){_0x501c01['having']('`'+_0x342a8d['field']+'`\x20=\x200');}else{_0x501c01['having']('`'+_0x342a8d[_0xefb0('0x4d')]+_0xefb0('0x65'));}break;case _0xefb0('0x66'):if(_0x342a8d[_0xefb0('0x67')]===_0xefb0('0x68')){if(_0x342a8d[_0xefb0('0x64')][_0xefb0('0x34')]('\x20')[_0xefb0('0x47')]>0x1){_0x24ecc6[_0x17fe84]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x342a8d['value']),null);}else{var _0x2ebd2c='%'+_0x342a8d['value']+'%';_0x24ecc6[_0x17fe84](_0xefb0('0x69'),_0x2ebd2c,_0x2ebd2c,_0x2ebd2c);}}else{_0x665745=_[_0xefb0('0x63')](_0x44bd50,[_0xefb0('0x2e'),'ContactId']);_0x342a8d[_0xefb0('0x4d')]=_0xefb0('0x6a');_0x4b11a6=as['buildExpression'](_0x8b8f12,_0x665745[_0xefb0('0x40')],_0x342a8d);_0x24ecc6[_0x17fe84](_0x4b11a6[_0xefb0('0x6b')],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x6c')],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x1f')]);}break;case _0xefb0('0x6d'):var _0x2d1471=_0x342a8d[_0xefb0('0x64')][_0xefb0('0x34')](',')[_0xefb0('0x30')](function(_0x1b317a){return Number(_0x1b317a);});_0x2d1471['forEach'](function(_0x5812c3){_0x3a2689['or'](_0xefb0('0x6e'),'%,'+_0x5812c3+',%');});_0x1c3497=_[_0xefb0('0x6f')](_0x1c3497,_0x2d1471);break;case _0xefb0('0x70'):if(_0x342a8d['operator']===_0xefb0('0x68')){_0x24ecc6[_0x17fe84]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x342a8d[_0xefb0('0x64')]+'%',null);}else{_0x665745=_[_0xefb0('0x63')](_0x44bd50,[_0xefb0('0x2e'),_0xefb0('0x3c')]);_0x342a8d[_0xefb0('0x4d')]=_0xefb0('0x3c');_0x4b11a6=as[_0xefb0('0x71')](_0x8b8f12,_0x665745[_0xefb0('0x40')],_0x342a8d);_0x24ecc6[_0x17fe84](_0x4b11a6[_0xefb0('0x6b')],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x6c')],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x1f')]);}break;case'body':_0x4b11a6=as[_0xefb0('0x71')]('me',null,_0x342a8d);_0x24ecc6[_0x17fe84](_0x4b11a6[_0xefb0('0x6b')],_0x4b11a6[_0xefb0('0x64')]['start'],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x1f')]);break;}}else{var _0x4b11a6=as['buildExpression'](_0x8b8f12,_0x665745[_0xefb0('0x40')],_0x342a8d);_0x24ecc6[_0x17fe84](_0x4b11a6[_0xefb0('0x6b')],_0x4b11a6[_0xefb0('0x64')][_0xefb0('0x6c')],_0x4b11a6['value'][_0xefb0('0x1f')]);}}}else{var _0x4adbd0=_(_0x38e7ff['query'])[_0xefb0('0x72')]()['map'](function(_0x489697){return _[_0xefb0('0x73')](_0x44bd50,['name',_0x489697])?_0x489697:undefined;})[_0xefb0('0x74')]()['value']();if(!_[_0xefb0('0x75')](_0x4adbd0)){_0x4adbd0[_0xefb0('0x35')](function(_0xdb08ff){if(_0xdb08ff===_0xefb0('0x76')){_0x501c01[_0xefb0('0x77')](_0xefb0('0x78'),[][_0xefb0('0x79')](_0x38e7ff[_0xefb0('0x43')][_0xdb08ff]));}else if(_0xdb08ff===_0xefb0('0x7a')){var _0x5ebba5=JSON[_0xefb0('0x7b')](_0x38e7ff[_0xefb0('0x43')][_0xdb08ff])[_0xefb0('0x7c')];var _0x38d6ab=JSON['parse'](_0x38e7ff[_0xefb0('0x43')][_0xdb08ff])[_0xefb0('0x7d')];_0x501c01['where'](_0xefb0('0x7e'),_0x5ebba5,_0x38d6ab);}else{if(_0x38e7ff[_0xefb0('0x43')][_0xdb08ff]===_0xefb0('0x7f')){_0x501c01[_0xefb0('0x77')]('i.'+_0xdb08ff+_0xefb0('0x80'));}else{_0x501c01[_0xefb0('0x77')]('i.'+_0xdb08ff+_0xefb0('0x81'),_0x38e7ff[_0xefb0('0x43')][_0xdb08ff]);}}});}if(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x82')]){if(_0x38e7ff[_0xefb0('0x43')]['read']==0x1){_0x501c01[_0xefb0('0x83')](_0xefb0('0x84'));}else{_0x501c01[_0xefb0('0x83')](_0xefb0('0x85'));}}if(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x86')]){_0x1c3497=_[_0xefb0('0x87')](_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x86')])?_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x86')]:new Array(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x86')]);_0x1c3497[_0xefb0('0x35')](function(_0x1b9a1e){_0x3a2689['or'](_0xefb0('0x6e'),'%,'+_0x1b9a1e+',%');});}if(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x88')]){var _0x3311f8=_0x38e7ff[_0xefb0('0x43')]['filter']['replace']('\x5c','\x5c\x5c')[_0xefb0('0x89')](/'/g,'\x27\x27');if(qs[_0xefb0('0x8a')](_0x3311f8)){_0x24ecc6['or'](_0xefb0('0x8b'),_0x3311f8+'%')['or'](_0xefb0('0x8c'),_0x3311f8+'%');}else{_0x24ecc6['or'](_0xefb0('0x8d'),qs['getFullTextValue'](_0x3311f8))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3311f8+'%');}}}_0x501c01['where'](_0x24ecc6);_0x501c01[_0xefb0('0x8e')](_0xefb0('0x8f'));var _0x3609ed={'type':db[_0xefb0('0x90')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1088ae=_0x501c01[_0xefb0('0x91')]();_0x1088ae['field'](_0xefb0('0x8f'));_0x1088ae['field'](_0xefb0('0x92'),'unreadMessages');if(_0x4a0cc4['order']){_0x4a0cc4[_0xefb0('0x4a')]['forEach'](function(_0x594836){var _0x1674f8=_0x594836[0x0]===_0xefb0('0x93')?_0x594836[0x0]:'i.'+_0x594836[0x0];_0x501c01['order'](_0x1674f8,_0x594836[0x1]===_0xefb0('0x94')?![]:!![]);});}if(!_[_0xefb0('0x75')](_0x1c3497)){_0x501c01[_0xefb0('0x83')](_0x3a2689);_0x1088ae[_0xefb0('0x77')](_0xefb0('0x95'),_0x1c3497);}BPromise[_0xefb0('0x96')]()['then'](function(){if(!_0x3cfd6d){if(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x76')])return;_0x1088ae[_0xefb0('0x77')](_0xefb0('0x97'));_0x501c01[_0xefb0('0x77')](_0xefb0('0x97'));return;}if(_0x38e7ff[_0xefb0('0x98')]['role']!==_0xefb0('0x99'))return;return _0x38e7ff[_0xefb0('0x98')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xefb0('0x2b')](function(_0x21c7c4){if(_[_0xefb0('0x75')](_0x21c7c4)){_0x1088ae[_0xefb0('0x77')]('i.SmsAccountId\x20IS\x20NULL');_0x501c01['where'](_0xefb0('0x9a'));}else{_0x1088ae[_0xefb0('0x77')](_0xefb0('0x78'),_['map'](_0x21c7c4,'id'));_0x501c01[_0xefb0('0x77')](_0xefb0('0x78'),_[_0xefb0('0x30')](_0x21c7c4,'id'));}});})[_0xefb0('0x2b')](function(){if(_0x38e7ff['user'][_0xefb0('0x9b')]===_0xefb0('0x99')&&!_0x3cfd6d&&!_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x76')])return[];return db[_0xefb0('0x9c')][_0xefb0('0x43')](_0x1088ae['toString'](),_0x3609ed);})['then'](function(_0x4ff12e){_0x799709[_0xefb0('0x24')]=_0x4ff12e['length'];if(_0x799709[_0xefb0('0x24')]===0x0)return[];return db[_0xefb0('0x9c')]['query'](_0x1ee15b[_0xefb0('0x9d')](),_0x3609ed)[_0xefb0('0x2b')](function(_0x4ae6c9){_0x2779ca=_[_0xefb0('0x9e')](_0x4ae6c9,'id');_0x3609ed=_[_0xefb0('0x9f')](_0x3609ed,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38e7ff[_0xefb0('0x43')][_0xefb0('0x46')]){_0x4a0cc4[_0xefb0('0x44')][_0xefb0('0x35')](function(_0x3f2a72){_0x501c01[_0xefb0('0x4d')]('i.'+_0x3f2a72);});}else{_0x501c01[_0xefb0('0x4d')](_0xefb0('0x92'),_0xefb0('0xa0'));_0x501c01[_0xefb0('0x4d')]('a.key',_0xefb0('0xa1'));_0x501c01[_0xefb0('0x4d')]('a.mandatoryDisposition',_0xefb0('0xa2'));_0x501c01[_0xefb0('0x4d')](_0xefb0('0xa3'),_0xefb0('0x93'));_0x501c01[_0xefb0('0x4d')](_0xefb0('0xa4'));_0x501c01[_0xefb0('0x4d')](_0xefb0('0xa5'),'Contact.firstName');_0x501c01['field'](_0xefb0('0xa6'),_0xefb0('0xa7'));_0x501c01[_0xefb0('0x4d')]('c.email',_0xefb0('0xa8'));_0x501c01['field'](_0xefb0('0xa9'),_0xefb0('0xaa'));_0x501c01['field'](_0xefb0('0xab'),'Contact.mobile');_0x501c01['field'](_0xefb0('0xac'),'Contact.fax');_0x501c01[_0xefb0('0x4d')](_0xefb0('0xad'),_0xefb0('0xae'));_0x501c01[_0xefb0('0x4d')]('o.internal','Owner.internal');_0x501c01[_0xefb0('0x4d')](_0xefb0('0xaf'),'TagIds');}if(_0x4a0cc4['limit'])_0x501c01[_0xefb0('0x25')](_0x4a0cc4['limit']);if(_0x4a0cc4[_0xefb0('0x22')])_0x501c01[_0xefb0('0x22')](_0x4a0cc4[_0xefb0('0x22')]);return db[_0xefb0('0x9c')][_0xefb0('0x43')](_0x501c01[_0xefb0('0x9d')](),_0x3609ed);})['then'](function(_0x251e8e){if(_0x251e8e[_0xefb0('0x47')]>0x0)_0x5a9bf8[_0xefb0('0x77')](_0xefb0('0xb0'),_[_0xefb0('0x30')](_0x251e8e,'id'));return db[_0xefb0('0x9c')][_0xefb0('0x43')](_0x5a9bf8[_0xefb0('0x9d')](),_0x3609ed)['then'](function(_0x3be925){var _0x134d5d=_[_0xefb0('0xb1')](_0x3be925,_0xefb0('0xb2'));var _0x541a65=[];_0x251e8e[_0xefb0('0x35')](function(_0x275d76){_0x541a65['push'](updateSmsInteraction(_0x275d76,_0x2779ca,_0x134d5d));});return BPromise['all'](_0x541a65);});});})[_0xefb0('0x2b')](function(_0x128c5f){_0x799709[_0xefb0('0xb3')]=_0x128c5f;return _0x799709;})[_0xefb0('0x2b')](respondWithFilteredResult(_0x2c7d04,_0x4a0cc4))['catch'](handleError(_0x2c7d04,null));};exports[_0xefb0('0xb4')]=function(_0x2a6e82,_0x45db){var _0x1f61df={'raw':![],'where':{'id':_0x2a6e82[_0xefb0('0xb5')]['id']}},_0x5a10c9={};_0x5a10c9['model']=_['keys'](db['SmsInteraction'][_0xefb0('0xb6')]);_0x5a10c9[_0xefb0('0x43')]=_[_0xefb0('0x72')](_0x2a6e82[_0xefb0('0x43')]);_0x5a10c9[_0xefb0('0x4c')]=_[_0xefb0('0x45')](_0x5a10c9[_0xefb0('0x42')],_0x5a10c9['query']);_0x1f61df[_0xefb0('0x44')]=_[_0xefb0('0x45')](_0x5a10c9['model'],qs['fields'](_0x2a6e82[_0xefb0('0x43')]['fields']));_0x1f61df[_0xefb0('0x44')]=_0x1f61df[_0xefb0('0x44')]['length']?_0x1f61df[_0xefb0('0x44')]:_0x5a10c9[_0xefb0('0x42')];if(_0x2a6e82[_0xefb0('0x43')][_0xefb0('0xb7')]){_0x1f61df['include']=[{'all':!![]}];}_0x1f61df=_['merge']({},_0x1f61df,_0x2a6e82[_0xefb0('0xb8')]);return db[_0xefb0('0x3f')]['find'](_0x1f61df)[_0xefb0('0x2b')](handleEntityNotFound(_0x45db,null))[_0xefb0('0x2b')](respondWithResult(_0x45db,null))[_0xefb0('0xb9')](handleError(_0x45db,null));};exports[_0xefb0('0xba')]=function(_0x7857d6,_0x2953fa){return db[_0xefb0('0x3f')][_0xefb0('0xba')](_0x7857d6[_0xefb0('0xbb')],{})[_0xefb0('0x2b')](respondWithResult(_0x2953fa,0xc9))['catch'](handleError(_0x2953fa,null));};exports['update']=function(_0x3635f2,_0x30acd8){if(_0x3635f2[_0xefb0('0xbb')]['id']){delete _0x3635f2['body']['id'];}return db[_0xefb0('0x3f')][_0xefb0('0x63')]({'where':{'id':_0x3635f2[_0xefb0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x30acd8,null))[_0xefb0('0x2b')](saveUpdates(_0x3635f2[_0xefb0('0xbb')],null))[_0xefb0('0x2b')](respondWithResult(_0x30acd8,null))[_0xefb0('0xb9')](handleError(_0x30acd8,null));};exports['destroy']=function(_0x195cf4,_0x1377fd){return db[_0xefb0('0x3f')][_0xefb0('0x63')]({'where':{'id':_0x195cf4[_0xefb0('0xb5')]['id']}})[_0xefb0('0x2b')](handleEntityNotFound(_0x1377fd,null))['then'](removeEntity(_0x1377fd,null))[_0xefb0('0xb9')](handleError(_0x1377fd,null));};exports['describe']=function(_0x108fa2,_0x462b4a){return db[_0xefb0('0x3f')][_0xefb0('0xbc')]()['then'](respondWithResult(_0x462b4a,null))[_0xefb0('0xb9')](handleError(_0x462b4a,null));};exports[_0xefb0('0xbd')]=function(_0x2fe5b0,_0x19e530,_0x2a8c46){return db[_0xefb0('0xbe')][_0xefb0('0x63')]({'where':{'id':_0x2fe5b0[_0xefb0('0xb5')]['id']}})['then'](handleEntityNotFound(_0x19e530,null))[_0xefb0('0x2b')](function(_0x2c67d2){if(_0x2c67d2){return _0x2c67d2[_0xefb0('0xbd')](_0x2fe5b0[_0xefb0('0xbb')][_0xefb0('0xbf')],_[_0xefb0('0xc0')](_0x2fe5b0[_0xefb0('0xbb')],['ids','id'])||{});}})[_0xefb0('0x2b')](respondWithResult(_0x19e530,null))['catch'](handleError(_0x19e530,null));};exports[_0xefb0('0xc1')]=function(_0x1fc6f6,_0x2ebb1d,_0x1f6caa){var _0x47b895={'raw':![],'where':{}};var _0x2f2dee={};var _0x5b59af={'count':0x0,'rows':[]};return db[_0xefb0('0x3f')]['findOne']({'where':{'id':_0x1fc6f6[_0xefb0('0xb5')]['id']}})[_0xefb0('0x2b')](handleEntityNotFound(_0x2ebb1d,null))[_0xefb0('0x2b')](function(_0x2d35d7){if(_0x2d35d7){_0x2f2dee[_0xefb0('0x42')]=_[_0xefb0('0x72')](db[_0xefb0('0xbe')][_0xefb0('0xb6')]);_0x2f2dee[_0xefb0('0x43')]=_[_0xefb0('0x72')](_0x1fc6f6[_0xefb0('0x43')]);_0x2f2dee[_0xefb0('0x4c')]=_[_0xefb0('0x45')](_0x2f2dee[_0xefb0('0x42')],_0x2f2dee[_0xefb0('0x43')]);_0x47b895[_0xefb0('0x44')]=_[_0xefb0('0x45')](_0x2f2dee[_0xefb0('0x42')],qs[_0xefb0('0x46')](_0x1fc6f6[_0xefb0('0x43')][_0xefb0('0x46')]));_0x47b895[_0xefb0('0x44')]=_0x47b895[_0xefb0('0x44')]['length']?_0x47b895[_0xefb0('0x44')]:_0x2f2dee[_0xefb0('0x42')];if(!_0x1fc6f6[_0xefb0('0x43')]['hasOwnProperty'](_0xefb0('0x49'))){_0x47b895[_0xefb0('0x25')]=qs[_0xefb0('0x25')](_0x1fc6f6['query']['limit']);_0x47b895['offset']=qs['offset'](_0x1fc6f6[_0xefb0('0x43')][_0xefb0('0x22')]);}_0x47b895[_0xefb0('0x4a')]=qs[_0xefb0('0x4b')](_0x1fc6f6[_0xefb0('0x43')][_0xefb0('0x4b')]);_0x47b895[_0xefb0('0x77')]=qs[_0xefb0('0x4c')](_[_0xefb0('0xc2')](_0x1fc6f6[_0xefb0('0x43')],_0x2f2dee[_0xefb0('0x4c')]));_0x47b895[_0xefb0('0x77')]['SmsInteractionId']=_0x2d35d7['id'];if(_0x1fc6f6[_0xefb0('0x43')]['filter']){_0x47b895['where']=_[_0xefb0('0x9f')](_0x47b895['where'],{'$or':_['map'](_0x47b895[_0xefb0('0x44')],function(_0x3a76ee){var _0x2a36c0={};_0x2a36c0[_0x3a76ee]={'$like':'%'+_0x1fc6f6[_0xefb0('0x43')]['filter']+'%'};return _0x2a36c0;})});}if(_0x1fc6f6['query'][_0xefb0('0x7c')]){var _0x53c89c=_0x1fc6f6[_0xefb0('0x43')][_0xefb0('0x7c')][_0xefb0('0x34')](',');var _0x4fa9db={};_0x4fa9db[_0x53c89c[0x0]]={'$gte':moment(_0x53c89c[0x1])[_0xefb0('0xc3')](_0xefb0('0xc4'))};_0x47b895[_0xefb0('0x77')]=_['merge'](_0x47b895[_0xefb0('0x77')],_0x4fa9db);}_0x47b895=_[_0xefb0('0x9f')]({},_0x47b895,_0x1fc6f6[_0xefb0('0xb8')]);return db[_0xefb0('0xbe')][_0xefb0('0x24')]({'where':_0x47b895[_0xefb0('0x77')]})[_0xefb0('0x2b')](function(_0x4d2783){_0x5b59af[_0xefb0('0x24')]=_0x4d2783;if(_0x1fc6f6[_0xefb0('0x43')][_0xefb0('0xb7')]){_0x47b895['include']=[{'all':!![]}];}return db['SmsMessage'][_0xefb0('0xc5')](_0x47b895);})[_0xefb0('0x2b')](function(_0x2d818c){_0x5b59af['rows']=_0x2d818c;return _0x5b59af;});}})[_0xefb0('0x2b')](respondWithFilteredResult(_0x2ebb1d,_0x47b895))[_0xefb0('0xb9')](handleError(_0x2ebb1d,null));};exports[_0xefb0('0xc6')]=function(_0x140a13,_0x1206e7,_0x187454){return db[_0xefb0('0x3f')][_0xefb0('0x63')]({'where':{'id':_0x140a13[_0xefb0('0xb5')]['id']}})[_0xefb0('0x2b')](handleEntityNotFound(_0x1206e7,null))[_0xefb0('0x2b')](function(_0x573ac2){if(_0x573ac2){return _0x573ac2[_0xefb0('0xc7')](_0x140a13[_0xefb0('0xbb')]['ids'],_['omit'](_0x140a13['body'],[_0xefb0('0xbf'),'id'])||{})[_0xefb0('0xc8')](function(){return db[_0xefb0('0x6d')][_0xefb0('0xc5')]({'attributes':['id',_0xefb0('0x2e'),_0xefb0('0xc9')],'where':{'id':_0x140a13[_0xefb0('0xbb')][_0xefb0('0xbf')]}});})[_0xefb0('0x2b')](function(_0x1d771a){socket[_0xefb0('0xca')]('smsInteractionTags:save',{'id':Number(_0x140a13[_0xefb0('0xb5')]['id']),'tags':_0x1d771a||[]});return{'id':Number(_0x140a13[_0xefb0('0xb5')]['id']),'tags':_0x1d771a||[]};});}})['then'](respondWithResult(_0x1206e7,null))['catch'](handleError(_0x1206e7,null));};exports[_0xefb0('0xcb')]=function(_0x576ee1,_0xbb3e5b,_0x4b48e2){return db['SmsInteraction'][_0xefb0('0x63')]({'where':{'id':_0x576ee1[_0xefb0('0xb5')]['id']}})[_0xefb0('0x2b')](handleEntityNotFound(_0xbb3e5b,null))[_0xefb0('0x2b')](function(_0x3531ea){if(_0x3531ea){return _0x3531ea[_0xefb0('0xcb')](_0x576ee1[_0xefb0('0x43')][_0xefb0('0xbf')]);}})['then'](respondWithStatusCode(_0xbb3e5b,null))[_0xefb0('0xb9')](handleError(_0xbb3e5b,null));};exports[_0xefb0('0xcc')]=function(_0x48aa77,_0x3925b0){var _0x5762f3=moment()[_0xefb0('0xcd')]()[_0xefb0('0x9d')]();var _0x477753=path[_0xefb0('0xce')](config['root'],'server','files','tmp');var _0x340281=path[_0xefb0('0xce')](config['root'],_0xefb0('0xcf'),'files',_0xefb0('0xd0'));var _0x1b57a2=path[_0xefb0('0xce')](_0x477753,_0x5762f3);var _0x434f73=util[_0xefb0('0xc3')](_0xefb0('0xd1'),_0x48aa77['params']['id'],_0x5762f3);var _0x43df91=path[_0xefb0('0xce')](_0x477753,_0x434f73);var _0x17a3db=[];_0x17a3db[_0xefb0('0x36')]({'model':db['User'],'as':_0xefb0('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x17a3db[_0xefb0('0x36')]({'model':db[_0xefb0('0xd2')],'as':'Contact','attributes':['id',_0xefb0('0xd3'),'lastName'],'raw':!![]});var _0x12ff7a=[{'model':db['SmsMessage'],'as':_0xefb0('0xd4'),'attributes':['id','body',_0xefb0('0x7a'),'direction','secret','read'],'include':_0x17a3db}];_0x12ff7a[_0xefb0('0x36')]({'model':db[_0xefb0('0xd5')],'as':_0xefb0('0xd6'),'attributes':['id','name']});_0x12ff7a[_0xefb0('0x36')]({'model':db[_0xefb0('0x70')],'as':_0xefb0('0xd7'),'attributes':['id','fullname']});return db[_0xefb0('0x3f')][_0xefb0('0x63')]({'where':{'id':_0x48aa77[_0xefb0('0xb5')]['id']},'include':_0x12ff7a})[_0xefb0('0x2b')](handleEntityNotFound(_0x3925b0,null))['then'](function(_0x3985f5){if(_0x3985f5){var _0x1bab0a=_0x3985f5[_0xefb0('0xd8')]({'plain':!![]});fs['mkdirSync'](_0x1b57a2);var _0x50e708={'channel':_0xefb0('0xd9'),'account':_0x1bab0a['Account'][_0xefb0('0x2e')],'agent':_0x1bab0a['Owner']?_0x1bab0a[_0xefb0('0xd7')][_0xefb0('0x31')]:_0xefb0('0xda'),'createdAt':moment(_0x1bab0a['createdAt'])[_0xefb0('0xc3')](_0xefb0('0xc4'))[_0xefb0('0x9d')](),'closedAt':_0x1bab0a['closed']?moment(_0x1bab0a[_0xefb0('0xdb')])[_0xefb0('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xefb0('0x9d')]():'','disposition':_0x1bab0a[_0xefb0('0xdc')],'messages':_(_0x1bab0a[_0xefb0('0xd4')])[_0xefb0('0x88')]({'secret':![]})[_0xefb0('0x30')](function(_0xe6a213){return{'date':moment(_0xe6a213['createdAt'])[_0xefb0('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xefb0('0x9d')](),'sender':_0xe6a213[_0xefb0('0xdd')]===_0xefb0('0xde')?_0xe6a213[_0xefb0('0x70')]?_0xe6a213[_0xefb0('0x70')][_0xefb0('0x31')]:_0xefb0('0xdf'):_0xe6a213[_0xefb0('0x66')]['firstName']+(_0xe6a213['Contact']['lastName']?'\x20'+_0xe6a213['Contact']['lastName']:''),'body':_0xe6a213[_0xefb0('0xbb')],'direction':_0xe6a213[_0xefb0('0xdd')]===_0xefb0('0xde')?'A':'C','secret':_0xe6a213[_0xefb0('0xe0')],'read':_0xe6a213[_0xefb0('0x82')]};})['value']()};return ejs['renderFile'](path[_0xefb0('0xce')](config[_0xefb0('0xe1')],'server','views',_0xefb0('0xe2')),{'interaction':_0x50e708})[_0xefb0('0x2b')](function(_0x49d0b9){var _0x138196=path[_0xefb0('0xce')](_0x1b57a2,_0xefb0('0xe3')+_0x1bab0a['id']+'-'+_0x5762f3+_0xefb0('0xe4'));var _0x3605db={'path':_0x138196,'channel':_0xefb0('0xd9'),'interactionId':_0x1bab0a['id']};return pdf[_0xefb0('0xe5')](_0x49d0b9,_0x3605db);})['then'](function(){return new BPromise(function(_0x14e2fd,_0x264716){zipdir(_0x1b57a2,{'saveTo':_0x43df91},function(_0x1fafa9,_0x16b0c4){if(_0x1fafa9)return _0x264716(_0x1fafa9);return _0x14e2fd(_0x16b0c4);});})[_0xefb0('0x2b')](function(){return new BPromise(function(_0x37294f,_0x1f2f22){rimraf(_0x1b57a2,function(_0x389956){if(_0x389956)_0x1f2f22(_0x389956);return _0x37294f();});});})['then'](function(){return _0x3925b0[_0xefb0('0xcc')](_0x43df91,_0x434f73,function(_0x2f6f85){if(_0x2f6f85){console[_0xefb0('0xe6')](_0xefb0('0xe7'),_0x2f6f85);}else{fs[_0xefb0('0xe8')](_0x43df91);}});});});}else{return _0x3925b0[_0xefb0('0x1e')](0xc8);}})['catch'](handleError(_0x3925b0,null));}; \ No newline at end of file +var _0xb3dc=['intersection','attributes','fields','length','nolimit','sort','where','pick','filters','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$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?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','text','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','c.firstName','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.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','params','rawAttributes','includeAll','include','options','create','body','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','findAll','rows','setTags','omit','spread','emit','smsInteractionTags:save','download','unix','join','files','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','direction','secret','SmsAccount','Owner','get','Sms','Account','N.A.','closedAt','disposition','out','System','renderFile','root','views','downloadInteraction.ejs','transcript-','err','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','stack','name','Users','map','TagIds','Tags','forEach','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','SmsInteraction','fieldName','type','key','model','query'];(function(_0x59fbb4,_0x4b63ee){var _0x19a8d8=function(_0x2847b8){while(--_0x2847b8){_0x59fbb4['push'](_0x59fbb4['shift']());}};_0x19a8d8(++_0x4b63ee);}(_0xb3dc,0xab));var _0xcb3d=function(_0x4607a4,_0x2cc9c9){_0x4607a4=_0x4607a4-0x0;var _0x1d7679=_0xb3dc[_0x4607a4];return _0x1d7679;};'use strict';var emlformat=require(_0xcb3d('0x0'));var rimraf=require(_0xcb3d('0x1'));var zipdir=require(_0xcb3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcb3d('0x3'));var BPromise=require(_0xcb3d('0x4'));var Mustache=require(_0xcb3d('0x5'));var util=require('util');var path=require(_0xcb3d('0x6'));var sox=require(_0xcb3d('0x7'));var csv=require(_0xcb3d('0x8'));var ejs=require(_0xcb3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcb3d('0xa'));var crypto=require(_0xcb3d('0xb'));var jsforce=require(_0xcb3d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcb3d('0xd'));var Papa=require(_0xcb3d('0xe'));var Redis=require(_0xcb3d('0xf'));var authService=require(_0xcb3d('0x10'));var qs=require(_0xcb3d('0x11'));var as=require(_0xcb3d('0x12'));var pdf=require(_0xcb3d('0x13'));var hardwareService=require(_0xcb3d('0x14'));var logger=require(_0xcb3d('0x15'))(_0xcb3d('0x16'));var utils=require(_0xcb3d('0x17'));var config=require(_0xcb3d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb3d('0x19'))['db'];config[_0xcb3d('0x1a')]=_[_0xcb3d('0x1b')](config[_0xcb3d('0x1a')],{'host':_0xcb3d('0x1c'),'port':0x18eb});var socket=require(_0xcb3d('0x1d'))(new Redis(config[_0xcb3d('0x1a')]));require(_0xcb3d('0x1e'))[_0xcb3d('0x1f')](socket);function respondWithStatusCode(_0x6abbc8,_0x5b36e8){_0x5b36e8=_0x5b36e8||0xcc;return function(_0x7b3a96){if(_0x7b3a96){return _0x6abbc8['sendStatus'](_0x5b36e8);}return _0x6abbc8[_0xcb3d('0x20')](_0x5b36e8)['end']();};}function respondWithResult(_0x49808b,_0x4c7037){_0x4c7037=_0x4c7037||0xc8;return function(_0x433ec2){if(_0x433ec2){return _0x49808b['status'](_0x4c7037)['json'](_0x433ec2);}};}function respondWithFilteredResult(_0x57d92a,_0x274b35){return function(_0x37ad9f){if(_0x37ad9f){var _0x242a1b=typeof _0x274b35[_0xcb3d('0x21')]===_0xcb3d('0x22')&&typeof _0x274b35[_0xcb3d('0x23')]===_0xcb3d('0x22');var _0x2acce1=_0x37ad9f['count'];var _0x5b47b1=_0x242a1b?0x0:_0x274b35['offset'];var _0x424cea=_0x242a1b?_0x37ad9f[_0xcb3d('0x24')]:_0x274b35['offset']+_0x274b35[_0xcb3d('0x23')];var _0x5e3186;if(_0x424cea>=_0x2acce1){_0x424cea=_0x2acce1;_0x5e3186=0xc8;}else{_0x5e3186=0xce;}_0x57d92a[_0xcb3d('0x20')](_0x5e3186);return _0x57d92a['set'](_0xcb3d('0x25'),_0x5b47b1+'-'+_0x424cea+'/'+_0x2acce1)[_0xcb3d('0x26')](_0x37ad9f);}return null;};}function patchUpdates(_0x3fde17){return function(_0x4d0fd7){try{jsonpatch[_0xcb3d('0x27')](_0x4d0fd7,_0x3fde17,!![]);}catch(_0x35429c){return BPromise['reject'](_0x35429c);}return _0x4d0fd7['save']();};}function saveUpdates(_0x4b3dc4,_0x2f97dd){return function(_0x177a12){if(_0x177a12){return _0x177a12[_0xcb3d('0x28')](_0x4b3dc4)[_0xcb3d('0x29')](function(_0x3419c8){return _0x3419c8;});}return null;};}function removeEntity(_0x56002a,_0x16738f){return function(_0x21f84f){if(_0x21f84f){return _0x21f84f[_0xcb3d('0x2a')]()['then'](function(){_0x56002a[_0xcb3d('0x20')](0xcc)[_0xcb3d('0x2b')]();});}};}function handleEntityNotFound(_0x21f128,_0x347eac){return function(_0x1e80f2){if(!_0x1e80f2){_0x21f128[_0xcb3d('0x2c')](0x194);}return _0x1e80f2;};}function handleError(_0x59cabd,_0x21749b){_0x21749b=_0x21749b||0x1f4;return function(_0x27cef2){logger[_0xcb3d('0x2d')](_0x27cef2[_0xcb3d('0x2e')]);if(_0x27cef2[_0xcb3d('0x2f')]){delete _0x27cef2[_0xcb3d('0x2f')];}_0x59cabd['status'](_0x21749b)['send'](_0x27cef2);};}function getInteractionUsers(_0x3a4884,_0x1d4014){return new BPromise(function(_0x42ccc1,_0xcc6fd4){try{if(_0x1d4014[_0x3a4884['id']]){_0x3a4884[_0xcb3d('0x30')]=_[_0xcb3d('0x31')](_0x1d4014[_0x3a4884['id']],function(_0x10203a){return{'id':_0x10203a['id'],'fullname':_0x10203a['fullname']};});}}catch(_0x303b63){_0xcc6fd4(_0x303b63);}_0x42ccc1(_0x3a4884);});}function getInteractionTags(_0x49e868,_0x68c5c3){return new BPromise(function(_0x231532,_0x2c0b5a){try{if(_0x49e868[_0xcb3d('0x32')]){_0x49e868[_0xcb3d('0x33')]=[];_0x49e868['TagIds']['split'](',')[_0xcb3d('0x34')](function(_0x4de29c){_0x49e868[_0xcb3d('0x33')]['push'](_0x68c5c3[_0x4de29c]);});}delete _0x49e868[_0xcb3d('0x32')];}catch(_0x44b3e9){_0x2c0b5a(_0x44b3e9);}_0x231532(_0x49e868);});}function updateSmsInteraction(_0x4134f7,_0x4780a2,_0x18a3bb){return new BPromise(function(_0x49104c,_0x159ba6){return getInteractionUsers(_0x4134f7,_0x18a3bb)['then'](function(_0xa630b){return getInteractionTags(_0xa630b,_0x4780a2);})[_0xcb3d('0x29')](function(_0x443420){return getStateInteraction(_0x443420);})[_0xcb3d('0x29')](function(_0x30716a){_0x49104c(_0x30716a);})[_0xcb3d('0x35')](function(_0x498a7d){_0x159ba6(_0x498a7d);});});}function getStateInteraction(_0x45466d){return new BPromise(function(_0x131ef9){_0x45466d[_0xcb3d('0x36')]=0x0;_0x45466d[_0xcb3d('0x37')]=0x0;_0x45466d[_0xcb3d('0x38')]=0x0;_0x45466d[_0xcb3d('0x39')]=0x0;_0x45466d['total']=0x0;if(!_0x45466d['closed']&&!_0x45466d['UserId']){_0x45466d[_0xcb3d('0x36')]+=0x1;}if(!_0x45466d[_0xcb3d('0x3a')]&&_0x45466d['UserId']){_0x45466d[_0xcb3d('0x37')]+=0x1;if(_0x45466d[_0xcb3d('0x36')]){_0x45466d['waiting']-=0x1;}}if(_0x45466d[_0xcb3d('0x3a')]&&_0x45466d[_0xcb3d('0x3b')]){_0x45466d[_0xcb3d('0x38')]+=0x1;if(_0x45466d[_0xcb3d('0x37')]){_0x45466d[_0xcb3d('0x37')]-=0x1;}}if(_0x45466d[_0xcb3d('0x3a')]&&!_0x45466d['UserId']){_0x45466d[_0xcb3d('0x39')]+=0x1;if(_0x45466d['waiting']){_0x45466d[_0xcb3d('0x36')]-=0x1;}}_0x45466d[_0xcb3d('0x3c')]+=0x1;_0x131ef9(_0x45466d);});}exports[_0xcb3d('0x3d')]=function(_0x12da25,_0x3b2f30){var _0x163f2d={},_0x5d5e7e={},_0x22dc29={'count':0x0,'rows':[]};var _0x6c5eac=_['map'](db[_0xcb3d('0x3e')]['rawAttributes'],function(_0x307528){return{'name':_0x307528[_0xcb3d('0x3f')],'type':_0x307528[_0xcb3d('0x40')][_0xcb3d('0x41')]};});_0x5d5e7e[_0xcb3d('0x42')]=_[_0xcb3d('0x31')](_0x6c5eac,_0xcb3d('0x2f'));_0x5d5e7e[_0xcb3d('0x43')]=_['keys'](_0x12da25[_0xcb3d('0x43')]);_0x5d5e7e['filters']=_[_0xcb3d('0x44')](_0x5d5e7e[_0xcb3d('0x42')],_0x5d5e7e[_0xcb3d('0x43')]);_0x163f2d[_0xcb3d('0x45')]=_[_0xcb3d('0x44')](_0x5d5e7e['model'],qs[_0xcb3d('0x46')](_0x12da25['query'][_0xcb3d('0x46')]));_0x163f2d[_0xcb3d('0x45')]=_0x163f2d[_0xcb3d('0x45')][_0xcb3d('0x47')]?_0x163f2d['attributes']:_0x5d5e7e[_0xcb3d('0x42')];if(!_0x12da25[_0xcb3d('0x43')]['hasOwnProperty'](_0xcb3d('0x48'))){_0x163f2d[_0xcb3d('0x23')]=qs[_0xcb3d('0x23')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x23')]);_0x163f2d[_0xcb3d('0x21')]=qs['offset'](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x21')]);}_0x163f2d['order']=qs[_0xcb3d('0x49')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x49')]);_0x163f2d[_0xcb3d('0x4a')]=qs['filters'](_[_0xcb3d('0x4b')](_0x12da25[_0xcb3d('0x43')],_0x5d5e7e[_0xcb3d('0x4c')]),_0x6c5eac);var _0x38c555=[];var _0x4cea0f=squel[_0xcb3d('0x4d')]()[_0xcb3d('0x4e')]('id')['field']('name')[_0xcb3d('0x4e')](_0xcb3d('0x4f'))['from'](_0xcb3d('0x50'));var _0x399a96=squel[_0xcb3d('0x4d')]()['field'](_0xcb3d('0x51'))[_0xcb3d('0x4e')](_0xcb3d('0x52'))['field'](_0xcb3d('0x53'))[_0xcb3d('0x54')](_0xcb3d('0x55'),'ui')[_0xcb3d('0x56')](_0xcb3d('0x57'),'u',_0xcb3d('0x58'));var _0x4f7419=squel[_0xcb3d('0x4d')]()[_0xcb3d('0x54')](_0xcb3d('0x59'),'i')[_0xcb3d('0x56')](_0xcb3d('0x5a'),'c',_0xcb3d('0x5b'))[_0xcb3d('0x56')](_0xcb3d('0x57'),'o',_0xcb3d('0x5c'))[_0xcb3d('0x56')]('sms_accounts','a',_0xcb3d('0x5d'))[_0xcb3d('0x56')]('sms_messages','me',_0xcb3d('0x5e'))[_0xcb3d('0x56')](_0xcb3d('0x5f'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xcb3d('0x50'),'t','t.id\x20=\x20it.TagId');var _0xb28e38=squel[_0xcb3d('0x60')]();var _0x2fca4d=[];var _0x38ea30=squel['expr']();var _0x4bcd56;if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x61')]){_0x4bcd56=as[_0xcb3d('0x62')](_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x61')]);var _0x59ada1=_0x4bcd56[_0xcb3d('0x63')];for(var _0x4ac205=0x0;_0x4ac205<_0x4bcd56[_0xcb3d('0x64')]['length'];_0x4ac205++){var _0x171776=_0x4bcd56['conditions'][_0x4ac205];var _0x35dcf7='i';var _0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0x171776[_0xcb3d('0x4e')]]);if(!_0x38c961){switch(_0x171776[_0xcb3d('0x4e')]){case _0xcb3d('0x66'):if(_0x171776[_0xcb3d('0x67')]==0x1){_0x4f7419[_0xcb3d('0x68')]('`'+_0x171776['field']+'`\x20=\x200');}else{_0x4f7419[_0xcb3d('0x68')]('`'+_0x171776['field']+_0xcb3d('0x69'));}break;case _0xcb3d('0x6a'):if(_0x171776[_0xcb3d('0x6b')]===_0xcb3d('0x6c')){if(_0x171776['value'][_0xcb3d('0x6d')]('\x20')[_0xcb3d('0x47')]>0x1){_0xb28e38[_0x59ada1](_0xcb3d('0x6e'),qs[_0xcb3d('0x6f')](_0x171776[_0xcb3d('0x67')]),null);}else{var _0x3f5323='%'+_0x171776[_0xcb3d('0x67')]+'%';_0xb28e38[_0x59ada1](_0xcb3d('0x70'),_0x3f5323,_0x3f5323,_0x3f5323);}}else{_0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0xcb3d('0x71')]);_0x171776['field']=_0xcb3d('0x71');_0x4bcdd0=as['buildExpression'](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0['text'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x72')],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);}break;case _0xcb3d('0x73'):var _0x21ace9=_0x171776['value'][_0xcb3d('0x6d')](',')[_0xcb3d('0x31')](function(_0x2f5b37){return Number(_0x2f5b37);});_0x21ace9[_0xcb3d('0x34')](function(_0x1bf9ec){_0x38ea30['or'](_0xcb3d('0x74'),'%,'+_0x1bf9ec+',%');});_0x2fca4d=_[_0xcb3d('0x75')](_0x2fca4d,_0x21ace9);break;case _0xcb3d('0x76'):if(_0x171776[_0xcb3d('0x6b')]===_0xcb3d('0x6c')){_0xb28e38[_0x59ada1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x171776[_0xcb3d('0x67')]+'%',null);}else{_0x38c961=_[_0xcb3d('0x65')](_0x6c5eac,[_0xcb3d('0x2f'),_0xcb3d('0x3b')]);_0x171776[_0xcb3d('0x4e')]=_0xcb3d('0x3b');_0x4bcdd0=as[_0xcb3d('0x77')](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')]['start'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);}break;case'body':_0x4bcdd0=as[_0xcb3d('0x77')]('me',null,_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')]['start'],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x2b')]);break;}}else{var _0x4bcdd0=as[_0xcb3d('0x77')](_0x35dcf7,_0x38c961[_0xcb3d('0x40')],_0x171776);_0xb28e38[_0x59ada1](_0x4bcdd0[_0xcb3d('0x78')],_0x4bcdd0[_0xcb3d('0x67')][_0xcb3d('0x72')],_0x4bcdd0[_0xcb3d('0x67')]['end']);}}}else{var _0x23f6de=_(_0x12da25['query'])[_0xcb3d('0x79')]()[_0xcb3d('0x31')](function(_0x126e6d){return _[_0xcb3d('0x7a')](_0x6c5eac,[_0xcb3d('0x2f'),_0x126e6d])?_0x126e6d:undefined;})['compact']()[_0xcb3d('0x67')]();if(!_[_0xcb3d('0x7b')](_0x23f6de)){_0x23f6de[_0xcb3d('0x34')](function(_0x86a6c){if(_0x86a6c===_0xcb3d('0x7c')){_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0x7d'),[][_0xcb3d('0x7e')](_0x12da25[_0xcb3d('0x43')][_0x86a6c]));}else if(_0x86a6c===_0xcb3d('0x7f')){var _0x3ac31f=JSON[_0xcb3d('0x80')](_0x12da25[_0xcb3d('0x43')][_0x86a6c])[_0xcb3d('0x81')];var _0x5d27fe=JSON[_0xcb3d('0x80')](_0x12da25[_0xcb3d('0x43')][_0x86a6c])[_0xcb3d('0x82')];_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0x83'),_0x3ac31f,_0x5d27fe);}else{if(_0x12da25[_0xcb3d('0x43')][_0x86a6c]===_0xcb3d('0x84')){_0x4f7419[_0xcb3d('0x4a')]('i.'+_0x86a6c+_0xcb3d('0x85'));}else{_0x4f7419[_0xcb3d('0x4a')]('i.'+_0x86a6c+_0xcb3d('0x86'),_0x12da25[_0xcb3d('0x43')][_0x86a6c]);}}});}if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x87')]){if(_0x12da25['query'][_0xcb3d('0x87')]==0x1){_0x4f7419['having'](_0xcb3d('0x88'));}else{_0x4f7419[_0xcb3d('0x68')](_0xcb3d('0x89'));}}if(_0x12da25['query'][_0xcb3d('0x8a')]){_0x2fca4d=_[_0xcb3d('0x8b')](_0x12da25[_0xcb3d('0x43')]['tag'])?_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8a')]:new Array(_0x12da25['query'][_0xcb3d('0x8a')]);_0x2fca4d[_0xcb3d('0x34')](function(_0x49c14f){_0x38ea30['or'](_0xcb3d('0x74'),'%,'+_0x49c14f+',%');});}if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8c')]){var _0x42808e=_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x8c')][_0xcb3d('0x8d')]('\x5c','\x5c\x5c')[_0xcb3d('0x8d')](/'/g,'\x27\x27');if(qs[_0xcb3d('0x8e')](_0x42808e)){_0xb28e38['or']('i.id\x20LIKE\x20?',_0x42808e+'%')['or'](_0xcb3d('0x8f'),_0x42808e+'%');}else{_0xb28e38['or'](_0xcb3d('0x90'),qs[_0xcb3d('0x6f')](_0x42808e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x42808e+'%');}}}_0x4f7419['where'](_0xb28e38);_0x4f7419[_0xcb3d('0x91')](_0xcb3d('0x92'));var _0x3871d0={'type':db[_0xcb3d('0x93')][_0xcb3d('0x94')][_0xcb3d('0x95')],'raw':!![]};var _0x1781f0=_0x4f7419[_0xcb3d('0x96')]();_0x1781f0['field'](_0xcb3d('0x92'));_0x1781f0[_0xcb3d('0x4e')](_0xcb3d('0x97'),_0xcb3d('0x66'));if(_0x163f2d[_0xcb3d('0x98')]){_0x163f2d[_0xcb3d('0x98')][_0xcb3d('0x34')](function(_0x2e851d){var _0x24d98e=_0x2e851d[0x0]==='contactName'?_0x2e851d[0x0]:'i.'+_0x2e851d[0x0];_0x4f7419[_0xcb3d('0x98')](_0x24d98e,_0x2e851d[0x1]===_0xcb3d('0x99')?![]:!![]);});}if(!_[_0xcb3d('0x7b')](_0x2fca4d)){_0x4f7419['having'](_0x38ea30);_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0x9a'),_0x2fca4d);}BPromise[_0xcb3d('0x9b')]()[_0xcb3d('0x29')](function(){if(!_0x4bcd56){if(_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x7c')])return;_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0x9c'));_0x4f7419['where'](_0xcb3d('0x9c'));return;}if(_0x12da25['user']['role']!==_0xcb3d('0x9d'))return;return _0x12da25[_0xcb3d('0x9e')][_0xcb3d('0x9f')]({'attributes':['id'],'raw':!![]})[_0xcb3d('0x29')](function(_0x4922c1){if(_[_0xcb3d('0x7b')](_0x4922c1)){_0x1781f0[_0xcb3d('0x4a')](_0xcb3d('0xa0'));_0x4f7419[_0xcb3d('0x4a')](_0xcb3d('0xa0'));}else{_0x1781f0['where'](_0xcb3d('0x7d'),_[_0xcb3d('0x31')](_0x4922c1,'id'));_0x4f7419['where']('i.SmsAccountId\x20IN\x20?',_[_0xcb3d('0x31')](_0x4922c1,'id'));}});})['then'](function(){if(_0x12da25[_0xcb3d('0x9e')]['role']===_0xcb3d('0x9d')&&!_0x4bcd56&&!_0x12da25[_0xcb3d('0x43')][_0xcb3d('0x7c')])return[];return db[_0xcb3d('0xa1')][_0xcb3d('0x43')](_0x1781f0[_0xcb3d('0xa2')](),_0x3871d0);})[_0xcb3d('0x29')](function(_0x1d2395){_0x22dc29[_0xcb3d('0x24')]=_0x1d2395[_0xcb3d('0x47')];if(_0x22dc29[_0xcb3d('0x24')]===0x0)return[];return db[_0xcb3d('0xa1')]['query'](_0x4cea0f[_0xcb3d('0xa2')](),_0x3871d0)[_0xcb3d('0x29')](function(_0x4cb8c3){_0x38c555=_[_0xcb3d('0xa3')](_0x4cb8c3,'id');_0x3871d0=_[_0xcb3d('0xa4')](_0x3871d0,{'model':db[_0xcb3d('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12da25['query'][_0xcb3d('0x46')]){_0x163f2d['attributes'][_0xcb3d('0x34')](function(_0x1d5cb4){_0x4f7419['field']('i.'+_0x1d5cb4);});}else{_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0x97'),_0xcb3d('0x66'));_0x4f7419['field'](_0xcb3d('0xa5'),_0xcb3d('0xa6'));_0x4f7419[_0xcb3d('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4f7419[_0xcb3d('0x4e')]('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','contactName');_0x4f7419[_0xcb3d('0x4e')]('i.*');_0x4f7419['field'](_0xcb3d('0xa7'),_0xcb3d('0xa8'));_0x4f7419['field'](_0xcb3d('0xa9'),'Contact.lastName');_0x4f7419['field'](_0xcb3d('0xaa'),_0xcb3d('0xab'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xac'),_0xcb3d('0xad'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xae'),'Contact.mobile');_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xaf'),_0xcb3d('0xb0'));_0x4f7419['field'](_0xcb3d('0xb1'),_0xcb3d('0xb2'));_0x4f7419[_0xcb3d('0x4e')](_0xcb3d('0xb3'),_0xcb3d('0xb4'));_0x4f7419[_0xcb3d('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcb3d('0x32'));}if(_0x163f2d[_0xcb3d('0x23')])_0x4f7419[_0xcb3d('0x23')](_0x163f2d['limit']);if(_0x163f2d[_0xcb3d('0x21')])_0x4f7419['offset'](_0x163f2d['offset']);return db['sequelize'][_0xcb3d('0x43')](_0x4f7419['toString'](),_0x3871d0);})[_0xcb3d('0x29')](function(_0x273150){if(_0x273150[_0xcb3d('0x47')]>0x0)_0x399a96[_0xcb3d('0x4a')](_0xcb3d('0xb5'),_[_0xcb3d('0x31')](_0x273150,'id'));return db[_0xcb3d('0xa1')][_0xcb3d('0x43')](_0x399a96['toString'](),_0x3871d0)['then'](function(_0x2ff16e){var _0x2d3884=_['groupBy'](_0x2ff16e,_0xcb3d('0xb6'));var _0x19b4af=[];_0x273150['forEach'](function(_0x3b72ef){_0x19b4af[_0xcb3d('0xb7')](updateSmsInteraction(_0x3b72ef,_0x38c555,_0x2d3884));});return BPromise[_0xcb3d('0xb8')](_0x19b4af);});});})[_0xcb3d('0x29')](function(_0xacd8db){_0x22dc29['rows']=_0xacd8db;return _0x22dc29;})['then'](respondWithFilteredResult(_0x3b2f30,_0x163f2d))[_0xcb3d('0x35')](handleError(_0x3b2f30,null));};exports['show']=function(_0x6d217f,_0x2b11cf){var _0x4f670b={'raw':![],'where':{'id':_0x6d217f[_0xcb3d('0xb9')]['id']}},_0x2d0c06={};_0x2d0c06[_0xcb3d('0x42')]=_[_0xcb3d('0x79')](db[_0xcb3d('0x3e')][_0xcb3d('0xba')]);_0x2d0c06[_0xcb3d('0x43')]=_[_0xcb3d('0x79')](_0x6d217f[_0xcb3d('0x43')]);_0x2d0c06[_0xcb3d('0x4c')]=_[_0xcb3d('0x44')](_0x2d0c06[_0xcb3d('0x42')],_0x2d0c06[_0xcb3d('0x43')]);_0x4f670b[_0xcb3d('0x45')]=_[_0xcb3d('0x44')](_0x2d0c06[_0xcb3d('0x42')],qs['fields'](_0x6d217f['query'][_0xcb3d('0x46')]));_0x4f670b['attributes']=_0x4f670b['attributes'][_0xcb3d('0x47')]?_0x4f670b[_0xcb3d('0x45')]:_0x2d0c06['model'];if(_0x6d217f[_0xcb3d('0x43')][_0xcb3d('0xbb')]){_0x4f670b[_0xcb3d('0xbc')]=[{'all':!![]}];}_0x4f670b=_[_0xcb3d('0xa4')]({},_0x4f670b,_0x6d217f[_0xcb3d('0xbd')]);return db['SmsInteraction']['find'](_0x4f670b)['then'](handleEntityNotFound(_0x2b11cf,null))['then'](respondWithResult(_0x2b11cf,null))[_0xcb3d('0x35')](handleError(_0x2b11cf,null));};exports[_0xcb3d('0xbe')]=function(_0x409ebc,_0x31085b){return db['SmsInteraction']['create'](_0x409ebc[_0xcb3d('0xbf')],{})[_0xcb3d('0x29')](respondWithResult(_0x31085b,0xc9))[_0xcb3d('0x35')](handleError(_0x31085b,null));};exports[_0xcb3d('0x28')]=function(_0x2a2470,_0xb1870c){if(_0x2a2470[_0xcb3d('0xbf')]['id']){delete _0x2a2470[_0xcb3d('0xbf')]['id'];}return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x2a2470[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0xb1870c,null))['then'](saveUpdates(_0x2a2470['body'],null))[_0xcb3d('0x29')](respondWithResult(_0xb1870c,null))[_0xcb3d('0x35')](handleError(_0xb1870c,null));};exports['destroy']=function(_0x37b5d7,_0x4e3e65){return db[_0xcb3d('0x3e')][_0xcb3d('0x65')]({'where':{'id':_0x37b5d7['params']['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x4e3e65,null))[_0xcb3d('0x29')](removeEntity(_0x4e3e65,null))[_0xcb3d('0x35')](handleError(_0x4e3e65,null));};exports['describe']=function(_0x10ba8f,_0x11610f){return db[_0xcb3d('0x3e')][_0xcb3d('0xc0')]()[_0xcb3d('0x29')](respondWithResult(_0x11610f,null))[_0xcb3d('0x35')](handleError(_0x11610f,null));};exports[_0xcb3d('0xc1')]=function(_0x5ddcab,_0x29f6dc,_0x1b59c5){return db['SmsMessage'][_0xcb3d('0x65')]({'where':{'id':_0x5ddcab[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x29f6dc,null))[_0xcb3d('0x29')](function(_0x3c116d){if(_0x3c116d){return _0x3c116d['addMessage'](_0x5ddcab['body'][_0xcb3d('0xc2')],_['omit'](_0x5ddcab[_0xcb3d('0xbf')],[_0xcb3d('0xc2'),'id'])||{});}})['then'](respondWithResult(_0x29f6dc,null))['catch'](handleError(_0x29f6dc,null));};exports[_0xcb3d('0xc3')]=function(_0x5a86d0,_0x310d3c,_0x3491a9){var _0x3986e6={'raw':![],'where':{}};var _0x14b9f3={};var _0x3c88cc={'count':0x0,'rows':[]};return db[_0xcb3d('0x3e')][_0xcb3d('0xc4')]({'where':{'id':_0x5a86d0[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x310d3c,null))[_0xcb3d('0x29')](function(_0x39f587){if(_0x39f587){_0x14b9f3[_0xcb3d('0x42')]=_['keys'](db['SmsMessage'][_0xcb3d('0xba')]);_0x14b9f3[_0xcb3d('0x43')]=_[_0xcb3d('0x79')](_0x5a86d0[_0xcb3d('0x43')]);_0x14b9f3[_0xcb3d('0x4c')]=_[_0xcb3d('0x44')](_0x14b9f3[_0xcb3d('0x42')],_0x14b9f3[_0xcb3d('0x43')]);_0x3986e6['attributes']=_['intersection'](_0x14b9f3[_0xcb3d('0x42')],qs[_0xcb3d('0x46')](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x46')]));_0x3986e6[_0xcb3d('0x45')]=_0x3986e6[_0xcb3d('0x45')][_0xcb3d('0x47')]?_0x3986e6[_0xcb3d('0x45')]:_0x14b9f3[_0xcb3d('0x42')];if(!_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0xc5')](_0xcb3d('0x48'))){_0x3986e6[_0xcb3d('0x23')]=qs['limit'](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x23')]);_0x3986e6[_0xcb3d('0x21')]=qs[_0xcb3d('0x21')](_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x21')]);}_0x3986e6[_0xcb3d('0x98')]=qs['sort'](_0x5a86d0['query']['sort']);_0x3986e6[_0xcb3d('0x4a')]=qs[_0xcb3d('0x4c')](_[_0xcb3d('0x4b')](_0x5a86d0['query'],_0x14b9f3[_0xcb3d('0x4c')]));_0x3986e6['where'][_0xcb3d('0xb6')]=_0x39f587['id'];if(_0x5a86d0[_0xcb3d('0x43')]['filter']){_0x3986e6['where']=_[_0xcb3d('0xa4')](_0x3986e6[_0xcb3d('0x4a')],{'$or':_[_0xcb3d('0x31')](_0x3986e6[_0xcb3d('0x45')],function(_0x2cc29d){var _0x10d345={};_0x10d345[_0x2cc29d]={'$like':'%'+_0x5a86d0[_0xcb3d('0x43')][_0xcb3d('0x8c')]+'%'};return _0x10d345;})});}if(_0x5a86d0['query'][_0xcb3d('0x81')]){var _0x727478=_0x5a86d0[_0xcb3d('0x43')]['$gte']['split'](',');var _0x44c297={};_0x44c297[_0x727478[0x0]]={'$gte':moment(_0x727478[0x1])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))};_0x3986e6['where']=_[_0xcb3d('0xa4')](_0x3986e6[_0xcb3d('0x4a')],_0x44c297);}_0x3986e6=_['merge']({},_0x3986e6,_0x5a86d0[_0xcb3d('0xbd')]);return db[_0xcb3d('0xc8')][_0xcb3d('0x24')]({'where':_0x3986e6[_0xcb3d('0x4a')]})[_0xcb3d('0x29')](function(_0x4095a9){_0x3c88cc[_0xcb3d('0x24')]=_0x4095a9;if(_0x5a86d0[_0xcb3d('0x43')]['includeAll']){_0x3986e6[_0xcb3d('0xbc')]=[{'all':!![]}];}return db[_0xcb3d('0xc8')][_0xcb3d('0xc9')](_0x3986e6);})['then'](function(_0x10aa49){_0x3c88cc[_0xcb3d('0xca')]=_0x10aa49;return _0x3c88cc;});}})[_0xcb3d('0x29')](respondWithFilteredResult(_0x310d3c,_0x3986e6))['catch'](handleError(_0x310d3c,null));};exports['addTags']=function(_0x1cabd8,_0x1ba650,_0x86fed1){return db[_0xcb3d('0x3e')][_0xcb3d('0x65')]({'where':{'id':_0x1cabd8[_0xcb3d('0xb9')]['id']}})[_0xcb3d('0x29')](handleEntityNotFound(_0x1ba650,null))[_0xcb3d('0x29')](function(_0x36dc72){if(_0x36dc72){return _0x36dc72[_0xcb3d('0xcb')](_0x1cabd8[_0xcb3d('0xbf')][_0xcb3d('0xc2')],_[_0xcb3d('0xcc')](_0x1cabd8['body'],[_0xcb3d('0xc2'),'id'])||{})[_0xcb3d('0xcd')](function(){return db[_0xcb3d('0x73')][_0xcb3d('0xc9')]({'attributes':['id',_0xcb3d('0x2f'),_0xcb3d('0x4f')],'where':{'id':_0x1cabd8[_0xcb3d('0xbf')][_0xcb3d('0xc2')]}});})[_0xcb3d('0x29')](function(_0x3c183e){socket[_0xcb3d('0xce')](_0xcb3d('0xcf'),{'id':Number(_0x1cabd8[_0xcb3d('0xb9')]['id']),'tags':_0x3c183e||[]});return{'id':Number(_0x1cabd8[_0xcb3d('0xb9')]['id']),'tags':_0x3c183e||[]};});}})[_0xcb3d('0x29')](respondWithResult(_0x1ba650,null))[_0xcb3d('0x35')](handleError(_0x1ba650,null));};exports['removeTags']=function(_0x525621,_0x563a7f,_0x4cd487){return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x525621[_0xcb3d('0xb9')]['id']}})['then'](handleEntityNotFound(_0x563a7f,null))[_0xcb3d('0x29')](function(_0x55cb3b){if(_0x55cb3b){return _0x55cb3b['removeTags'](_0x525621[_0xcb3d('0x43')]['ids']);}})[_0xcb3d('0x29')](respondWithStatusCode(_0x563a7f,null))[_0xcb3d('0x35')](handleError(_0x563a7f,null));};exports[_0xcb3d('0xd0')]=function(_0x113d3d,_0x46c97a){var _0x11af58=moment()[_0xcb3d('0xd1')]()[_0xcb3d('0xa2')]();var _0x5590f9=path[_0xcb3d('0xd2')](config['root'],'server',_0xcb3d('0xd3'),_0xcb3d('0xd4'));var _0x5772a6=path[_0xcb3d('0xd2')](config['root'],_0xcb3d('0xd5'),_0xcb3d('0xd3'),_0xcb3d('0xd6'));var _0x565eb7=path[_0xcb3d('0xd2')](_0x5590f9,_0x11af58);var _0x4ffbb6=util[_0xcb3d('0xc6')](_0xcb3d('0xd7'),_0x113d3d[_0xcb3d('0xb9')]['id'],_0x11af58);var _0x286b0c=path[_0xcb3d('0xd2')](_0x5590f9,_0x4ffbb6);var _0x2d2854=[];_0x2d2854[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0x76')],'as':'User','attributes':['id',_0xcb3d('0xd8')],'raw':!![]});_0x2d2854[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0xd9')],'as':_0xcb3d('0x6a'),'attributes':['id',_0xcb3d('0xda'),_0xcb3d('0xdb')],'raw':!![]});var _0x244402=[{'model':db[_0xcb3d('0xc8')],'as':'Messages','attributes':['id','body',_0xcb3d('0x7f'),_0xcb3d('0xdc'),_0xcb3d('0xdd'),_0xcb3d('0x87')],'include':_0x2d2854}];_0x244402[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0xde')],'as':'Account','attributes':['id',_0xcb3d('0x2f')]});_0x244402[_0xcb3d('0xb7')]({'model':db[_0xcb3d('0x76')],'as':_0xcb3d('0xdf'),'attributes':['id',_0xcb3d('0xd8')]});return db['SmsInteraction'][_0xcb3d('0x65')]({'where':{'id':_0x113d3d[_0xcb3d('0xb9')]['id']},'include':_0x244402})[_0xcb3d('0x29')](handleEntityNotFound(_0x46c97a,null))[_0xcb3d('0x29')](function(_0x15ffd6){if(_0x15ffd6){var _0x212fdf=_0x15ffd6[_0xcb3d('0xe0')]({'plain':!![]});fs['mkdirSync'](_0x565eb7);var _0x325df8={'channel':_0xcb3d('0xe1'),'account':_0x212fdf[_0xcb3d('0xe2')][_0xcb3d('0x2f')],'agent':_0x212fdf['Owner']?_0x212fdf[_0xcb3d('0xdf')][_0xcb3d('0xd8')]:_0xcb3d('0xe3'),'createdAt':moment(_0x212fdf[_0xcb3d('0x7f')])[_0xcb3d('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x212fdf['closed']?moment(_0x212fdf[_0xcb3d('0xe4')])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))['toString']():'','disposition':_0x212fdf[_0xcb3d('0xe5')],'messages':_(_0x212fdf['Messages'])[_0xcb3d('0x8c')]({'secret':![]})[_0xcb3d('0x31')](function(_0x2fa9ac){return{'date':moment(_0x2fa9ac[_0xcb3d('0x7f')])[_0xcb3d('0xc6')](_0xcb3d('0xc7'))[_0xcb3d('0xa2')](),'sender':_0x2fa9ac[_0xcb3d('0xdc')]===_0xcb3d('0xe6')?_0x2fa9ac[_0xcb3d('0x76')]?_0x2fa9ac[_0xcb3d('0x76')][_0xcb3d('0xd8')]:_0xcb3d('0xe7'):_0x2fa9ac['Contact'][_0xcb3d('0xda')]+(_0x2fa9ac[_0xcb3d('0x6a')][_0xcb3d('0xdb')]?'\x20'+_0x2fa9ac['Contact'][_0xcb3d('0xdb')]:''),'body':_0x2fa9ac[_0xcb3d('0xbf')],'direction':_0x2fa9ac[_0xcb3d('0xdc')]===_0xcb3d('0xe6')?'A':'C','secret':_0x2fa9ac['secret'],'read':_0x2fa9ac[_0xcb3d('0x87')]};})[_0xcb3d('0x67')]()};return ejs[_0xcb3d('0xe8')](path[_0xcb3d('0xd2')](config[_0xcb3d('0xe9')],_0xcb3d('0xd5'),_0xcb3d('0xea'),_0xcb3d('0xeb')),{'interaction':_0x325df8})[_0xcb3d('0x29')](function(_0x4ded2b){var _0x15e6c2=path[_0xcb3d('0xd2')](_0x565eb7,_0xcb3d('0xec')+_0x212fdf['id']+'-'+_0x11af58+'.pdf');var _0x57f9e6={'path':_0x15e6c2,'channel':_0xcb3d('0xe1'),'interactionId':_0x212fdf['id']};return pdf['createPdfFromHTML'](_0x4ded2b,_0x57f9e6);})[_0xcb3d('0x29')](function(){return new BPromise(function(_0x1fe7fa,_0x234aae){zipdir(_0x565eb7,{'saveTo':_0x286b0c},function(_0x3b59be,_0x44e684){if(_0x3b59be)return _0x234aae(_0x3b59be);return _0x1fe7fa(_0x44e684);});})[_0xcb3d('0x29')](function(){return new BPromise(function(_0x43410c,_0x59ea63){rimraf(_0x565eb7,function(_0x22f801){if(_0x22f801)_0x59ea63(_0x22f801);return _0x43410c();});});})[_0xcb3d('0x29')](function(){return _0x46c97a[_0xcb3d('0xd0')](_0x286b0c,_0x4ffbb6,function(_0x343889){if(_0x343889){console['log'](_0xcb3d('0xed'),_0x343889);}else{fs[_0xcb3d('0xee')](_0x286b0c);}});});});}else{return _0x46c97a[_0xcb3d('0x2c')](0xc8);}})[_0xcb3d('0x35')](handleError(_0x46c97a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a739bf2..f1b8765 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 _0x1a37=['events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','catch'];(function(_0x519e48,_0x59d01b){var _0x36b182=function(_0x18c713){while(--_0x18c713){_0x519e48['push'](_0x519e48['shift']());}};_0x36b182(++_0x59d01b);}(_0x1a37,0xb4));var _0x71a3=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x1a37[_0x1573ea];return _0x51c0e2;};'use strict';var EventEmitter=require(_0x71a3('0x0'));var SmsInteraction=require(_0x71a3('0x1'))['db'][_0x71a3('0x2')];var SmsMessage=require(_0x71a3('0x1'))['db'][_0x71a3('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x71a3('0x4')](0x0);var events={'afterCreate':_0x71a3('0x5'),'afterUpdate':_0x71a3('0x6'),'afterDestroy':_0x71a3('0x7')};function emitEvent(_0x100181){return function(_0x4af5b4,_0x11e8a8,_0x4f6b7a){_0x4af5b4[_0x71a3('0x8')]({'attributes':['id'],'raw':!![]})[_0x71a3('0x9')](function(_0x231ea7){_0x4af5b4[_0x71a3('0xa')]('Users',_0x231ea7['map'](function(_0x56c351){return{'id':_0x56c351['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x4af5b4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x71a3('0x9')](function(_0x18320a){_0x4af5b4[_0x71a3('0xa')](_0x71a3('0xb'),_0x18320a[_0x71a3('0xc')]);SmsInteractionEvents[_0x71a3('0xd')](_0x100181+':'+_0x4af5b4['id'],_0x4af5b4);SmsInteractionEvents[_0x71a3('0xd')](_0x100181,_0x4af5b4);_0x4f6b7a(null);})[_0x71a3('0xe')](_0x4f6b7a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x3b4e7b,_0x416d01){var _0xc353d2=function(_0x33696e){while(--_0x33696e){_0x3b4e7b['push'](_0x3b4e7b['shift']());}};_0xc353d2(++_0x416d01);}(_0x14a0,0x8e));var _0x014a=function(_0x4e7dd7,_0x3e7134){_0x4e7dd7=_0x4e7dd7-0x0;var _0x4f4461=_0x14a0[_0x4e7dd7];return _0x4f4461;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x014a('0x0'))['db'][_0x014a('0x1')];var SmsMessage=require(_0x014a('0x0'))['db'][_0x014a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x014a('0x3')](0x0);var events={'afterCreate':_0x014a('0x4'),'afterUpdate':_0x014a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a522){return function(_0x1730a5,_0x12e8da,_0x38a22c){_0x1730a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b8ce){_0x1730a5[_0x014a('0x6')](_0x014a('0x7'),_0x11b8ce['map'](function(_0x5d3d7f){return{'id':_0x5d3d7f['id']};}));return SmsMessage[_0x014a('0x8')]({'where':{'SmsInteractionId':_0x1730a5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x490ea2){_0x1730a5['setDataValue']('unreadMessages',_0x490ea2[_0x014a('0x9')]);SmsInteractionEvents['emit'](_0x57a522+':'+_0x1730a5['id'],_0x1730a5);SmsInteractionEvents[_0x014a('0xa')](_0x57a522,_0x1730a5);_0x38a22c(null);})[_0x014a('0xb')](_0x38a22c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x014a('0xc')](e,emitEvent(event));}}module[_0x014a('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index d1c2a12..b67674b 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 _0x500c=['exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes'];(function(_0x37fe9a,_0x5f4d04){var _0x49b067=function(_0x27ef13){while(--_0x27ef13){_0x37fe9a['push'](_0x37fe9a['shift']());}};_0x49b067(++_0x5f4d04);}(_0x500c,0x116));var _0xc500=function(_0x1fdfbf,_0x4e898a){_0x1fdfbf=_0x1fdfbf-0x0;var _0x24b341=_0x500c[_0x1fdfbf];return _0x24b341;};'use strict';var _=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var logger=require(_0xc500('0x2'))(_0xc500('0x3'));var moment=require(_0xc500('0x4'));var BPromise=require(_0xc500('0x5'));var rp=require(_0xc500('0x6'));var fs=require('fs');var path=require(_0xc500('0x7'));var rimraf=require(_0xc500('0x8'));var config=require('../../config/environment');var attributes=require(_0xc500('0x9'));module[_0xc500('0xa')]=function(_0x5d9a91,_0x1ee535){return _0x5d9a91[_0xc500('0xb')](_0xc500('0xc'),attributes,{'tableName':_0xc500('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5918c9,_0x5dcfb7,_0xe233fa){if(_0x5918c9[_0xc500('0xe')]('closed')){_0x5918c9[_0xc500('0xf')]=moment()[_0xc500('0x10')](_0xc500('0x11'));}_0xe233fa(null,_0x5918c9);}}});}; \ No newline at end of file +var _0xc1db=['bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x389601,_0x3cd181){var _0x475ed3=function(_0x265ed2){while(--_0x265ed2){_0x389601['push'](_0x389601['shift']());}};_0x475ed3(++_0x3cd181);}(_0xc1db,0xeb));var _0xbc1d=function(_0x11bf34,_0x4e3a4c){_0x11bf34=_0x11bf34-0x0;var _0x3edf9a=_0xc1db[_0x11bf34];return _0x3edf9a;};'use strict';var _=require(_0xbc1d('0x0'));var util=require(_0xbc1d('0x1'));var logger=require(_0xbc1d('0x2'))(_0xbc1d('0x3'));var moment=require(_0xbc1d('0x4'));var BPromise=require(_0xbc1d('0x5'));var rp=require(_0xbc1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc1d('0x7'));var config=require(_0xbc1d('0x8'));var attributes=require(_0xbc1d('0x9'));module['exports']=function(_0x2778f8,_0x4253e7){return _0x2778f8['define'](_0xbc1d('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdc2f76,_0x53dc61,_0x4ae66a){if(_0xdc2f76['changed'](_0xbc1d('0xb'))){_0xdc2f76[_0xbc1d('0xc')]=moment()[_0xbc1d('0xd')](_0xbc1d('0xe'));}_0x4ae66a(null,_0xdc2f76);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d3ec1a5..8aefb81 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 _0x0e40=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','find','ids','omit','body','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x0e40,0x19d));var _0x00e4=function(_0x15a5cc,_0x1507f4){_0x15a5cc=_0x15a5cc-0x0;var _0x53eb71=_0x0e40[_0x15a5cc];return _0x53eb71;};'use strict';var _=require(_0x00e4('0x0'));var util=require(_0x00e4('0x1'));var moment=require(_0x00e4('0x2'));var BPromise=require(_0x00e4('0x3'));var rs=require(_0x00e4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00e4('0x6'))(_0x00e4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00e4('0x8'));var client=jayson[_0x00e4('0x9')][_0x00e4('0xa')]({'port':0x232a});config[_0x00e4('0xb')]=_[_0x00e4('0xc')](config[_0x00e4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x00e4('0xd'))(new Redis(config[_0x00e4('0xb')]));require('./smsInteraction.socket')[_0x00e4('0xe')](socket);function respondWithRpcPromise(_0x313cc1,_0x3af70d,_0x281b11){return new BPromise(function(_0x15b981,_0x4a4471){return client['request'](_0x313cc1,_0x281b11)[_0x00e4('0xf')](function(_0x47dd05){logger[_0x00e4('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x3af70d,_0x00e4('0x11'));logger[_0x00e4('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3af70d,_0x00e4('0x11'),JSON[_0x00e4('0x13')](_0x47dd05));if(_0x47dd05[_0x00e4('0x14')]){if(_0x47dd05[_0x00e4('0x14')][_0x00e4('0x15')]===0x1f4){logger[_0x00e4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x3af70d,_0x47dd05['error']['message']);return _0x4a4471(_0x47dd05['error']['message']);}logger[_0x00e4('0x14')](_0x00e4('0x16'),_0x3af70d,_0x47dd05[_0x00e4('0x14')][_0x00e4('0x17')]);return _0x15b981(_0x47dd05[_0x00e4('0x14')]['message']);}else{logger[_0x00e4('0x10')](_0x00e4('0x16'),_0x3af70d,_0x00e4('0x11'));_0x15b981(_0x47dd05[_0x00e4('0x18')][_0x00e4('0x17')]);}})[_0x00e4('0x19')](function(_0x376dc9){logger[_0x00e4('0x14')](_0x00e4('0x16'),_0x3af70d,_0x376dc9);_0x4a4471(_0x376dc9);});});}exports[_0x00e4('0x1a')]=function(_0x2da5ac){var _0x9e1e46=this;return new Promise(function(_0xa93107,_0x25e8d3){return db[_0x00e4('0x1b')][_0x00e4('0x1c')](_0x2da5ac['body'],{'raw':_0x2da5ac[_0x00e4('0x1d')]?_0x2da5ac['options'][_0x00e4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2da5ac[_0x00e4('0x1d')]?_0x2da5ac[_0x00e4('0x1d')][_0x00e4('0x1f')]||null:null,'attributes':_0x2da5ac[_0x00e4('0x1d')]?_0x2da5ac[_0x00e4('0x1d')]['attributes']||null:null,'limit':_0x2da5ac[_0x00e4('0x1d')]?_0x2da5ac[_0x00e4('0x1d')]['limit']||null:null})['then'](function(_0x3f5878){logger[_0x00e4('0x10')]('UpdateSmsInteraction',_0x2da5ac);logger[_0x00e4('0x12')]('UpdateSmsInteraction',_0x2da5ac,JSON[_0x00e4('0x13')](_0x3f5878));_0xa93107(_0x3f5878);})[_0x00e4('0x19')](function(_0x24bccd){logger[_0x00e4('0x14')]('UpdateSmsInteraction',_0x24bccd[_0x00e4('0x17')],_0x2da5ac);_0x25e8d3(_0x9e1e46[_0x00e4('0x14')](0x1f4,_0x24bccd[_0x00e4('0x17')]));});});};exports['AddTagsToSmsInteraction']=function(_0x53eb76){return new Promise(function(_0x35065f,_0x3ff468){return db[_0x00e4('0x1b')][_0x00e4('0x20')]({'where':_0x53eb76[_0x00e4('0x1d')]?_0x53eb76[_0x00e4('0x1d')]['where']||null:null})[_0x00e4('0xf')](function(_0x1602c7){if(_0x1602c7){return _0x1602c7['addTags'](_0x53eb76['body'][_0x00e4('0x21')],_[_0x00e4('0x22')](_0x53eb76[_0x00e4('0x23')],[_0x00e4('0x21'),'id'])||{});}})[_0x00e4('0x24')](function(_0x251548){logger['info']('AddTags',_0x53eb76);logger[_0x00e4('0x12')](_0x00e4('0x25'),_0x53eb76,JSON[_0x00e4('0x13')](_0x251548));_0x35065f(_0x251548);})['catch'](function(_0x39f822){logger[_0x00e4('0x14')]('AddTags',_0x39f822[_0x00e4('0x17')],_0x53eb76);_0x3ff468(_this['error'](0x1f4,_0x39f822[_0x00e4('0x17')]));});});}; \ No newline at end of file +var _0x8e95=['options','raw','where','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','message','SmsInteraction,\x20%s,\x20%s','result','catch','SmsInteraction','update'];(function(_0xd89965,_0xb6c8b5){var _0x59bf32=function(_0x18139d){while(--_0x18139d){_0xd89965['push'](_0xd89965['shift']());}};_0x59bf32(++_0xb6c8b5);}(_0x8e95,0x87));var _0x58e9=function(_0x3e2c84,_0x450061){_0x3e2c84=_0x3e2c84-0x0;var _0x323105=_0x8e95[_0x3e2c84];return _0x323105;};'use strict';var _=require('lodash');var util=require(_0x58e9('0x0'));var moment=require(_0x58e9('0x1'));var BPromise=require(_0x58e9('0x2'));var rs=require(_0x58e9('0x3'));var fs=require('fs');var Redis=require(_0x58e9('0x4'));var db=require(_0x58e9('0x5'))['db'];var utils=require(_0x58e9('0x6'));var logger=require(_0x58e9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x58e9('0x8'));var client=jayson[_0x58e9('0x9')][_0x58e9('0xa')]({'port':0x232a});config[_0x58e9('0xb')]=_['defaults'](config[_0x58e9('0xb')],{'host':_0x58e9('0xc'),'port':0x18eb});var socket=require(_0x58e9('0xd'))(new Redis(config[_0x58e9('0xb')]));require(_0x58e9('0xe'))[_0x58e9('0xf')](socket);function respondWithRpcPromise(_0x232009,_0x13acd9,_0x258b8b){return new BPromise(function(_0x4e499e,_0x1b97ad){return client[_0x58e9('0x10')](_0x232009,_0x258b8b)[_0x58e9('0x11')](function(_0x3429ce){logger[_0x58e9('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x58e9('0x13'));logger[_0x58e9('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x13acd9,_0x58e9('0x13'),JSON[_0x58e9('0x15')](_0x3429ce));if(_0x3429ce['error']){if(_0x3429ce[_0x58e9('0x16')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);return _0x1b97ad(_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);}logger[_0x58e9('0x16')](_0x58e9('0x18'),_0x13acd9,_0x3429ce[_0x58e9('0x16')]['message']);return _0x4e499e(_0x3429ce[_0x58e9('0x16')][_0x58e9('0x17')]);}else{logger[_0x58e9('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,'request\x20sent');_0x4e499e(_0x3429ce[_0x58e9('0x19')][_0x58e9('0x17')]);}})[_0x58e9('0x1a')](function(_0x373547){logger[_0x58e9('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x13acd9,_0x373547);_0x1b97ad(_0x373547);});});}exports['UpdateSmsInteraction']=function(_0x1e844e){var _0x499d7a=this;return new Promise(function(_0xc6d88c,_0x54985f){return db[_0x58e9('0x1b')][_0x58e9('0x1c')](_0x1e844e['body'],{'raw':_0x1e844e[_0x58e9('0x1d')]?_0x1e844e[_0x58e9('0x1d')][_0x58e9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e844e[_0x58e9('0x1d')]?_0x1e844e['options'][_0x58e9('0x1f')]||null:null,'attributes':_0x1e844e['options']?_0x1e844e['options']['attributes']||null:null,'limit':_0x1e844e['options']?_0x1e844e[_0x58e9('0x1d')]['limit']||null:null})[_0x58e9('0x11')](function(_0x5dd3b4){logger['info'](_0x58e9('0x20'),_0x1e844e);logger[_0x58e9('0x14')](_0x58e9('0x20'),_0x1e844e,JSON[_0x58e9('0x15')](_0x5dd3b4));_0xc6d88c(_0x5dd3b4);})[_0x58e9('0x1a')](function(_0x2f997f){logger[_0x58e9('0x16')](_0x58e9('0x20'),_0x2f997f['message'],_0x1e844e);_0x54985f(_0x499d7a[_0x58e9('0x16')](0x1f4,_0x2f997f[_0x58e9('0x17')]));});});};exports[_0x58e9('0x21')]=function(_0x4c564b){return new Promise(function(_0x366b7c,_0x367ec3){return db[_0x58e9('0x1b')][_0x58e9('0x22')]({'where':_0x4c564b[_0x58e9('0x1d')]?_0x4c564b[_0x58e9('0x1d')]['where']||null:null})[_0x58e9('0x11')](function(_0x2a65fa){if(_0x2a65fa){return _0x2a65fa[_0x58e9('0x23')](_0x4c564b[_0x58e9('0x24')][_0x58e9('0x25')],_[_0x58e9('0x26')](_0x4c564b[_0x58e9('0x24')],[_0x58e9('0x25'),'id'])||{});}})[_0x58e9('0x27')](function(_0x472645){logger[_0x58e9('0x12')](_0x58e9('0x28'),_0x4c564b);logger[_0x58e9('0x14')](_0x58e9('0x28'),_0x4c564b,JSON[_0x58e9('0x15')](_0x472645));_0x366b7c(_0x472645);})[_0x58e9('0x1a')](function(_0x47f972){logger[_0x58e9('0x16')](_0x58e9('0x28'),_0x47f972[_0x58e9('0x17')],_0x4c564b);_0x367ec3(_this[_0x58e9('0x16')](0x1f4,_0x47f972[_0x58e9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0e91e79..3dc8acc 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 _0x8561=['register','./smsInteraction.events','save','remove','update','removeListener'];(function(_0x3e9650,_0x15c3d9){var _0x2921f7=function(_0x271dff){while(--_0x271dff){_0x3e9650['push'](_0x3e9650['shift']());}};_0x2921f7(++_0x15c3d9);}(_0x8561,0x85));var _0x1856=function(_0x285159,_0x434500){_0x285159=_0x285159-0x0;var _0x3ade27=_0x8561[_0x285159];return _0x3ade27;};'use strict';var SmsInteractionEvents=require(_0x1856('0x0'));var events=[_0x1856('0x1'),_0x1856('0x2'),_0x1856('0x3')];function createListener(_0x45eee9,_0x535bb7){return function(_0x53a69f){_0x535bb7['emit'](_0x45eee9,_0x53a69f);};}function removeListener(_0x448da2,_0x2b7ab7){return function(){SmsInteractionEvents[_0x1856('0x4')](_0x448da2,_0x2b7ab7);};}exports[_0x1856('0x5')]=function(_0x112fd7){for(var _0x14de85=0x0,_0x467327=events['length'];_0x14de85<_0x467327;_0x14de85++){var _0xd522e8=events[_0x14de85];var _0x4c470b=createListener('smsInteraction:'+_0xd522e8,_0x112fd7);SmsInteractionEvents['on'](_0xd522e8,_0x4c470b);}}; \ No newline at end of file +var _0x8f9c=['length','./smsInteraction.events','save','remove','update','emit','register'];(function(_0x584c46,_0x3b39d5){var _0x2cf98e=function(_0x328b70){while(--_0x328b70){_0x584c46['push'](_0x584c46['shift']());}};_0x2cf98e(++_0x3b39d5);}(_0x8f9c,0x189));var _0xc8f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f9c[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0xc8f9('0x0'));var events=[_0xc8f9('0x1'),_0xc8f9('0x2'),_0xc8f9('0x3')];function createListener(_0x9d1924,_0x297f61){return function(_0x3aed3e){_0x297f61[_0xc8f9('0x4')](_0x9d1924,_0x3aed3e);};}function removeListener(_0x1c9320,_0x339d04){return function(){SmsInteractionEvents['removeListener'](_0x1c9320,_0x339d04);};}exports[_0xc8f9('0x5')]=function(_0x3065e1){for(var _0x930b92=0x0,_0x17384a=events[_0xc8f9('0x6')];_0x930b92<_0x17384a;_0x930b92++){var _0xabe231=events[_0x930b92];var _0x5b4a3e=createListener('smsInteraction:'+_0xabe231,_0x3065e1);SmsInteractionEvents['on'](_0xabe231,_0x5b4a3e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 768d32f..98b8d8e 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 _0xd89b=['show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept','accept','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id'];(function(_0x29abfc,_0x514a72){var _0x44d4db=function(_0x37ed7e){while(--_0x37ed7e){_0x29abfc['push'](_0x29abfc['shift']());}};_0x44d4db(++_0x514a72);}(_0xd89b,0xca));var _0xbd89=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xd89b[_0x256b72];return _0x2183e3;};'use strict';var multer=require('multer');var util=require(_0xbd89('0x0'));var path=require(_0xbd89('0x1'));var timeout=require(_0xbd89('0x2'));var express=require(_0xbd89('0x3'));var router=express[_0xbd89('0x4')]();var fs_extra=require(_0xbd89('0x5'));var auth=require(_0xbd89('0x6'));var interaction=require(_0xbd89('0x7'));var config=require(_0xbd89('0x8'));var controller=require('./smsMessage.controller');router[_0xbd89('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbd89('0xa'),auth[_0xbd89('0xb')](),controller[_0xbd89('0xc')]);router[_0xbd89('0x9')](_0xbd89('0xd'),auth[_0xbd89('0xb')](),controller[_0xbd89('0xe')]);router[_0xbd89('0xf')]('/',auth['isAuthenticated'](),interaction[_0xbd89('0x10')](_0xbd89('0x11'),_0xbd89('0x12')),controller['create']);router['post'](_0xbd89('0x13'),controller[_0xbd89('0x14')]);router[_0xbd89('0x15')](_0xbd89('0xd'),auth[_0xbd89('0xb')](),controller['update']);router[_0xbd89('0x15')](_0xbd89('0x16'),auth[_0xbd89('0xb')](),controller[_0xbd89('0x17')]);router[_0xbd89('0x15')]('/:id/reject',auth[_0xbd89('0xb')](),controller['reject']);router[_0xbd89('0x18')](_0xbd89('0xd'),auth[_0xbd89('0xb')](),controller[_0xbd89('0x19')]);module[_0xbd89('0x1a')]=router; \ No newline at end of file +var _0xa3b9=['reject','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','smsmessage:create','post','status','put','update','accept','/:id/reject'];(function(_0xf6433f,_0x23cf95){var _0x5085bf=function(_0x3d69fd){while(--_0x3d69fd){_0xf6433f['push'](_0xf6433f['shift']());}};_0x5085bf(++_0x23cf95);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x60a3cc,_0x5cb5e4){_0x60a3cc=_0x60a3cc-0x0;var _0x57db5e=_0xa3b9[_0x60a3cc];return _0x57db5e;};'use strict';var multer=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var path=require(_0x9a3b('0x2'));var timeout=require(_0x9a3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a3b('0x4'));var auth=require(_0x9a3b('0x5'));var interaction=require(_0x9a3b('0x6'));var config=require(_0x9a3b('0x7'));var controller=require('./smsMessage.controller');router[_0x9a3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x9a3b('0x9')]);router[_0x9a3b('0x8')](_0x9a3b('0xa'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xc')]);router[_0x9a3b('0x8')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9a3b('0xf')]('sms',_0x9a3b('0x10')),controller['create']);router[_0x9a3b('0x11')]('/:id/status',controller[_0x9a3b('0x12')]);router[_0x9a3b('0x13')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x14')]);router['put']('/:id/accept',auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x15')]);router[_0x9a3b('0x13')](_0x9a3b('0x16'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0x17')]);router[_0x9a3b('0x18')](_0x9a3b('0xd'),auth[_0x9a3b('0xb')](),controller['destroy']);module[_0x9a3b('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f67fcea..9e6250a 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 _0x8be6=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0x8be6,0x1e9));var _0x68be=function(_0x121788,_0x129296){_0x121788=_0x121788-0x0;var _0x3fb645=_0x8be6[_0x121788];return _0x3fb645;};'use strict';var Sequelize=require(_0x68be('0x0'));module[_0x68be('0x1')]={'body':{'type':Sequelize[_0x68be('0x2')](_0x68be('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x68be('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x68be('0x5')]('in',_0x68be('0x6')),'defaultValue':_0x68be('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x68be('0x7')](0xbe)},'phone':{'type':Sequelize[_0x68be('0x7')]},'readAt':{'type':Sequelize[_0x68be('0x8')]},'secret':{'type':Sequelize[_0x68be('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x68be('0x7')]},'providerResponse':{'type':Sequelize[_0x68be('0x2')]}}; \ No newline at end of file +var _0xb459=['sequelize','exports','TEXT','medium','ENUM','out','STRING','BOOLEAN'];(function(_0x361ecd,_0x32451e){var _0x31942f=function(_0x4fe2b5){while(--_0x4fe2b5){_0x361ecd['push'](_0x361ecd['shift']());}};_0x31942f(++_0x32451e);}(_0xb459,0x178));var _0x9b45=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xb459[_0x1f5143];return _0x383a38;};'use strict';var Sequelize=require(_0x9b45('0x0'));module[_0x9b45('0x1')]={'body':{'type':Sequelize[_0x9b45('0x2')](_0x9b45('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9b45('0x4')]('in','out'),'defaultValue':_0x9b45('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9b45('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9b45('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9b45('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9b45('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9b94f86..6ab578e 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 _0xa5c9=['contact','User','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','results','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','show','merge','find','create','body','params','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','agent','fullname','email','internal','interface','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa5c9,0x143));var _0x9a5c=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xa5c9[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0x9a5c('0x0'));var rimraf=require(_0x9a5c('0x1'));var zipdir=require(_0x9a5c('0x2'));var jsonpatch=require(_0x9a5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a5c('0x4'));var Mustache=require(_0x9a5c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a5c('0x6'));var ejs=require(_0x9a5c('0x7'));var fs=require('fs');var fs_extra=require(_0x9a5c('0x8'));var _=require(_0x9a5c('0x9'));var squel=require('squel');var crypto=require(_0x9a5c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9a5c('0xb'));var toCsv=require(_0x9a5c('0x6'));var querystring=require('querystring');var Papa=require(_0x9a5c('0xc'));var Redis=require(_0x9a5c('0xd'));var authService=require(_0x9a5c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a5c('0xf'));var logger=require(_0x9a5c('0x10'))(_0x9a5c('0x11'));var utils=require(_0x9a5c('0x12'));var config=require(_0x9a5c('0x13'));var licenseUtil=require(_0x9a5c('0x14'));var db=require(_0x9a5c('0x15'))['db'];config[_0x9a5c('0x16')]=_[_0x9a5c('0x17')](config[_0x9a5c('0x16')],{'host':_0x9a5c('0x18'),'port':0x18eb});var socket=require(_0x9a5c('0x19'))(new Redis(config['redis']));require(_0x9a5c('0x1a'))[_0x9a5c('0x1b')](socket);var jayson=require(_0x9a5c('0x1c'));var client=jayson['client'][_0x9a5c('0x1d')]({'port':0x232c});var client9002=jayson[_0x9a5c('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16422d,_0x5ef98e,_0x350bd5,_0x507a12){return new BPromise(function(_0x29d3cd,_0x1e0c41){var _0x59e410=_0x507a12||client;return _0x59e410[_0x9a5c('0x1f')](_0x16422d,_0x350bd5)[_0x9a5c('0x20')](function(_0x39fbea){logger['info'](_0x9a5c('0x21'),_0x5ef98e,_0x9a5c('0x22'));logger[_0x9a5c('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5ef98e,_0x9a5c('0x22'),JSON[_0x9a5c('0x24')](_0x39fbea));if(_0x39fbea['error']){if(_0x39fbea[_0x9a5c('0x25')][_0x9a5c('0x26')]===0x1f4){logger[_0x9a5c('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5ef98e,_0x39fbea[_0x9a5c('0x25')][_0x9a5c('0x27')]);return _0x1e0c41(_0x39fbea['error'][_0x9a5c('0x27')]);}logger[_0x9a5c('0x25')]('SmsMessage,\x20%s,\x20%s',_0x5ef98e,_0x39fbea[_0x9a5c('0x25')][_0x9a5c('0x27')]);return _0x29d3cd(_0x39fbea[_0x9a5c('0x25')]['message']);}else{logger[_0x9a5c('0x28')](_0x9a5c('0x21'),_0x5ef98e,_0x9a5c('0x22'));_0x29d3cd(_0x39fbea[_0x9a5c('0x29')][_0x9a5c('0x27')]);}})[_0x9a5c('0x2a')](function(_0x47a13a){logger['error'](_0x9a5c('0x21'),_0x5ef98e,_0x47a13a);_0x1e0c41(_0x47a13a);});});}function respondWithStatusCode(_0x263a19,_0x10db7a){_0x10db7a=_0x10db7a||0xcc;return function(_0x3713fd){if(_0x3713fd){return _0x263a19['sendStatus'](_0x10db7a);}return _0x263a19[_0x9a5c('0x2b')](_0x10db7a)[_0x9a5c('0x2c')]();};}function respondWithResult(_0x3b5d9c,_0x4119f7){_0x4119f7=_0x4119f7||0xc8;return function(_0x439e6b){if(_0x439e6b){return _0x3b5d9c[_0x9a5c('0x2b')](_0x4119f7)[_0x9a5c('0x2d')](_0x439e6b);}};}function respondWithFilteredResult(_0x4146c9,_0x3d3356){return function(_0x4e6cee){if(_0x4e6cee){var _0x2bdb5b=typeof _0x3d3356['offset']==='undefined'&&typeof _0x3d3356['limit']===_0x9a5c('0x2e');var _0x190943=_0x4e6cee[_0x9a5c('0x2f')];var _0xb966ad=_0x2bdb5b?0x0:_0x3d3356[_0x9a5c('0x30')];var _0x35d472=_0x2bdb5b?_0x4e6cee['count']:_0x3d3356[_0x9a5c('0x30')]+_0x3d3356[_0x9a5c('0x31')];var _0x39344c;if(_0x35d472>=_0x190943){_0x35d472=_0x190943;_0x39344c=0xc8;}else{_0x39344c=0xce;}_0x4146c9['status'](_0x39344c);return _0x4146c9[_0x9a5c('0x32')](_0x9a5c('0x33'),_0xb966ad+'-'+_0x35d472+'/'+_0x190943)[_0x9a5c('0x2d')](_0x4e6cee);}return null;};}function patchUpdates(_0x29bb2b){return function(_0x47db46){try{jsonpatch[_0x9a5c('0x34')](_0x47db46,_0x29bb2b,!![]);}catch(_0x582754){return BPromise[_0x9a5c('0x35')](_0x582754);}return _0x47db46['save']();};}function saveUpdates(_0x234c32,_0x14dd33){return function(_0x2c9f35){if(_0x2c9f35){return _0x2c9f35[_0x9a5c('0x36')](_0x234c32)[_0x9a5c('0x20')](function(_0x3792eb){return _0x3792eb;});}return null;};}function removeEntity(_0x5695a5,_0x472fa3){return function(_0x350bd4){if(_0x350bd4){return _0x350bd4[_0x9a5c('0x37')]()[_0x9a5c('0x20')](function(){_0x5695a5['status'](0xcc)[_0x9a5c('0x2c')]();});}};}function handleEntityNotFound(_0xe3feef,_0x5f545c){return function(_0x2329ba){if(!_0x2329ba){_0xe3feef[_0x9a5c('0x38')](0x194);}return _0x2329ba;};}function handleError(_0x574dd1,_0x37146a){_0x37146a=_0x37146a||0x1f4;return function(_0x510262){logger[_0x9a5c('0x25')](_0x510262[_0x9a5c('0x39')]);if(_0x510262[_0x9a5c('0x3a')]){delete _0x510262[_0x9a5c('0x3a')];}_0x574dd1[_0x9a5c('0x2b')](_0x37146a)['send'](_0x510262);};}exports['index']=function(_0x5c4b29,_0x5e8935){var _0x350026={},_0x3523eb={},_0x28cfd2={'count':0x0,'rows':[]};var _0x2918d9=_[_0x9a5c('0x3b')](db[_0x9a5c('0x3c')][_0x9a5c('0x3d')],function(_0x24879e){return{'name':_0x24879e[_0x9a5c('0x3e')],'type':_0x24879e[_0x9a5c('0x3f')][_0x9a5c('0x40')]};});_0x3523eb['model']=_[_0x9a5c('0x3b')](_0x2918d9,_0x9a5c('0x3a'));_0x3523eb[_0x9a5c('0x41')]=_[_0x9a5c('0x42')](_0x5c4b29['query']);_0x3523eb[_0x9a5c('0x43')]=_[_0x9a5c('0x44')](_0x3523eb['model'],_0x3523eb[_0x9a5c('0x41')]);_0x350026[_0x9a5c('0x45')]=_[_0x9a5c('0x44')](_0x3523eb[_0x9a5c('0x46')],qs[_0x9a5c('0x47')](_0x5c4b29[_0x9a5c('0x41')][_0x9a5c('0x47')]));_0x350026[_0x9a5c('0x45')]=_0x350026[_0x9a5c('0x45')][_0x9a5c('0x48')]?_0x350026['attributes']:_0x3523eb['model'];if(!_0x5c4b29[_0x9a5c('0x41')][_0x9a5c('0x49')](_0x9a5c('0x4a'))){_0x350026[_0x9a5c('0x31')]=qs[_0x9a5c('0x31')](_0x5c4b29[_0x9a5c('0x41')][_0x9a5c('0x31')]);_0x350026[_0x9a5c('0x30')]=qs[_0x9a5c('0x30')](_0x5c4b29[_0x9a5c('0x41')][_0x9a5c('0x30')]);}_0x350026[_0x9a5c('0x4b')]=qs['sort'](_0x5c4b29['query'][_0x9a5c('0x4c')]);_0x350026[_0x9a5c('0x4d')]=qs['filters'](_[_0x9a5c('0x4e')](_0x5c4b29[_0x9a5c('0x41')],_0x3523eb['filters']),_0x2918d9);if(_0x5c4b29['query']['filter']){_0x350026[_0x9a5c('0x4d')]=_['merge'](_0x350026[_0x9a5c('0x4d')],{'$or':_[_0x9a5c('0x3b')](_0x2918d9,function(_0x57864e){if(_0x57864e[_0x9a5c('0x3f')]!==_0x9a5c('0x4f')){var _0x56ede0={};_0x56ede0[_0x57864e[_0x9a5c('0x3a')]]={'$like':'%'+_0x5c4b29[_0x9a5c('0x41')]['filter']+'%'};return _0x56ede0;}})});}_0x350026=_['merge']({},_0x350026,_0x5c4b29[_0x9a5c('0x50')]);var _0x27f89f={'where':_0x350026[_0x9a5c('0x4d')]};return db['SmsMessage'][_0x9a5c('0x2f')](_0x27f89f)[_0x9a5c('0x20')](function(_0x2733db){_0x28cfd2[_0x9a5c('0x2f')]=_0x2733db;if(_0x5c4b29['query'][_0x9a5c('0x51')]){_0x350026[_0x9a5c('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x9a5c('0x53')](_0x350026);})[_0x9a5c('0x20')](function(_0x2831dc){_0x28cfd2[_0x9a5c('0x54')]=_0x2831dc;return _0x28cfd2;})[_0x9a5c('0x20')](respondWithFilteredResult(_0x5e8935,_0x350026))[_0x9a5c('0x2a')](handleError(_0x5e8935,null));};exports[_0x9a5c('0x55')]=function(_0x5e0297,_0x2782c4){var _0x57f53a={'raw':!![],'where':{'id':_0x5e0297['params']['id']}},_0x199ee1={};_0x199ee1[_0x9a5c('0x46')]=_[_0x9a5c('0x42')](db['SmsMessage'][_0x9a5c('0x3d')]);_0x199ee1['query']=_['keys'](_0x5e0297[_0x9a5c('0x41')]);_0x199ee1[_0x9a5c('0x43')]=_[_0x9a5c('0x44')](_0x199ee1['model'],_0x199ee1[_0x9a5c('0x41')]);_0x57f53a[_0x9a5c('0x45')]=_[_0x9a5c('0x44')](_0x199ee1[_0x9a5c('0x46')],qs[_0x9a5c('0x47')](_0x5e0297[_0x9a5c('0x41')][_0x9a5c('0x47')]));_0x57f53a[_0x9a5c('0x45')]=_0x57f53a[_0x9a5c('0x45')][_0x9a5c('0x48')]?_0x57f53a['attributes']:_0x199ee1['model'];if(_0x5e0297[_0x9a5c('0x41')][_0x9a5c('0x51')]){_0x57f53a[_0x9a5c('0x52')]=[{'all':!![]}];}_0x57f53a=_[_0x9a5c('0x56')]({},_0x57f53a,_0x5e0297['options']);return db['SmsMessage'][_0x9a5c('0x57')](_0x57f53a)[_0x9a5c('0x20')](handleEntityNotFound(_0x2782c4,null))[_0x9a5c('0x20')](respondWithResult(_0x2782c4,null))[_0x9a5c('0x2a')](handleError(_0x2782c4,null));};exports['create']=function(_0x35ba8c,_0x22f70b){return db['SmsMessage'][_0x9a5c('0x58')](_0x35ba8c[_0x9a5c('0x59')],{})[_0x9a5c('0x20')](respondWithResult(_0x22f70b,0xc9))[_0x9a5c('0x2a')](handleError(_0x22f70b,null));};exports['update']=function(_0x539c49,_0x5176c3){if(_0x539c49[_0x9a5c('0x59')]['id']){delete _0x539c49[_0x9a5c('0x59')]['id'];}return db['SmsMessage'][_0x9a5c('0x57')]({'where':{'id':_0x539c49[_0x9a5c('0x5a')]['id']}})[_0x9a5c('0x20')](handleEntityNotFound(_0x5176c3,null))['then'](saveUpdates(_0x539c49[_0x9a5c('0x59')],null))[_0x9a5c('0x20')](respondWithResult(_0x5176c3,null))[_0x9a5c('0x2a')](handleError(_0x5176c3,null));};exports[_0x9a5c('0x37')]=function(_0x530706,_0x1f9873){return db['SmsMessage'][_0x9a5c('0x57')]({'where':{'id':_0x530706[_0x9a5c('0x5a')]['id']}})[_0x9a5c('0x20')](handleEntityNotFound(_0x1f9873,null))[_0x9a5c('0x20')](removeEntity(_0x1f9873,null))[_0x9a5c('0x2a')](handleError(_0x1f9873,null));};exports[_0x9a5c('0x5b')]=function(_0x54e7ec,_0x757886){return db[_0x9a5c('0x3c')][_0x9a5c('0x5b')]()[_0x9a5c('0x20')](respondWithResult(_0x757886,null))['catch'](handleError(_0x757886,null));};var interaction_log=require(_0x9a5c('0x10'))(_0x9a5c('0x5c'));exports[_0x9a5c('0x5d')]=function(_0x1dce3a,_0x2ff03f,_0x5d9cd2){var _0x80e8c4={'agent':{},'channel':_0x9a5c('0x5e')};if(_0x1dce3a[_0x9a5c('0x59')]['id']){delete _0x1dce3a[_0x9a5c('0x59')]['id'];}_0x1dce3a[_0x9a5c('0x59')][_0x9a5c('0x5f')]=!![];_0x1dce3a[_0x9a5c('0x59')][_0x9a5c('0x60')]=moment()['format'](_0x9a5c('0x61'));_0x1dce3a[_0x9a5c('0x59')]['UserId']=_0x1dce3a[_0x9a5c('0x59')]['UserId']||_0x1dce3a[_0x9a5c('0x62')]['id'];_0x80e8c4['agent']['id']=_0x1dce3a[_0x9a5c('0x59')][_0x9a5c('0x63')];return db['SmsMessage'][_0x9a5c('0x57')]({'where':{'id':_0x1dce3a[_0x9a5c('0x5a')]['id'],'UserId':null}})[_0x9a5c('0x20')](handleEntityNotFound(_0x2ff03f,null))[_0x9a5c('0x20')](saveUpdates(_0x1dce3a[_0x9a5c('0x59')],null))[_0x9a5c('0x20')](function(_0xfca83b){if(_0xfca83b){_0x80e8c4[_0x9a5c('0x27')]=_0xfca83b[_0x9a5c('0x64')]({'plain':!![]});return db[_0x9a5c('0x65')][_0x9a5c('0x57')]({'where':{'id':_0xfca83b[_0x9a5c('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2ff03f,null))[_0x9a5c('0x20')](function(_0x476ec2){if(_0x476ec2){return _0x476ec2[_0x9a5c('0x36')]({'UserId':_0x1dce3a[_0x9a5c('0x59')][_0x9a5c('0x63')],'read1stAt':_[_0x9a5c('0x67')](_0x476ec2[_0x9a5c('0x68')])?moment()[_0x9a5c('0x69')](_0x9a5c('0x61')):undefined});}return null;})[_0x9a5c('0x20')](function(_0x2d4d5c){if(_0x2d4d5c){_0x80e8c4[_0x9a5c('0x6a')]=_0x2d4d5c['get']({'plain':!![]});interaction_log[_0x9a5c('0x28')](_0x9a5c('0x6b'),_0x1dce3a['user']['id'],_0x1dce3a[_0x9a5c('0x62')]['name'],_0x1dce3a[_0x9a5c('0x62')][_0x9a5c('0x6c')],_0x80e8c4[_0x9a5c('0x6a')]['id'],_0x1dce3a[_0x9a5c('0x59')]?JSON[_0x9a5c('0x24')](_0x1dce3a['body']):_0x9a5c('0x6d'));return respondWithRpcPromise(_0x9a5c('0x6e'),_0x9a5c('0x6f'),_0x80e8c4);}return null;})[_0x9a5c('0x20')](function(_0x299c01){var _0x35892a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x299c01[_0x9a5c('0x27')][_0x9a5c('0x70')];return db[_0x9a5c('0x71')]['query'](_0x35892a,{'type':db[_0x9a5c('0x72')]['QueryTypes'][_0x9a5c('0x73')],'raw':!![]})['then'](function(_0x6d5edd){return _0x6d5edd;});})['then'](function(_0x423b93){if(_0x423b93){_0x80e8c4[_0x9a5c('0x27')]['contact']=_0x423b93[0x0];if(!_0x1dce3a[_0x9a5c('0x59')][_0x9a5c('0x63')])return;return db['User'][_0x9a5c('0x57')]({'where':{'id':_0x1dce3a[_0x9a5c('0x59')]['UserId'],'role':_0x9a5c('0x74')},'attributes':['id',_0x9a5c('0x3a'),_0x9a5c('0x75'),_0x9a5c('0x76'),_0x9a5c('0x77')],'raw':!![]});}return null;})[_0x9a5c('0x20')](function(_0x35f68c){if(!_0x35f68c)return null;_0x80e8c4[_0x9a5c('0x27')][_0x9a5c('0x74')]=_0x35f68c;return _0x80e8c4;})[_0x9a5c('0x20')](function(_0x25331f){if(_0x25331f){if(_0x1dce3a[_0x9a5c('0x59')]['manual']){_0x80e8c4[_0x9a5c('0x27')][_0x9a5c('0x78')]=util[_0x9a5c('0x69')](_0x9a5c('0x79'),_0x1dce3a[_0x9a5c('0x62')][_0x9a5c('0x3a')]);_0x80e8c4[_0x9a5c('0x27')][_0x9a5c('0x7a')]=_0x80e8c4[_0x9a5c('0x7a')];_0x80e8c4['message']['motionChannel']=_0x80e8c4[_0x9a5c('0x7a')];_0x80e8c4['message']['event']=_0x9a5c('0x5d');return respondWithRpcPromise(_0x9a5c('0x7b'),_0x9a5c('0x7b'),{'event':_0x9a5c('0x7c'),'message':_0x80e8c4[_0x9a5c('0x27')]},client9002)[_0x9a5c('0x20')](function(){return _0x80e8c4;});}return _0x80e8c4;}return null;})[_0x9a5c('0x20')](respondWithResult(_0x2ff03f,null))[_0x9a5c('0x2a')](handleError(_0x2ff03f,null));};var interaction_log=require(_0x9a5c('0x10'))(_0x9a5c('0x5c'));exports['reject']=function(_0x5dac8d,_0x1fb3ff,_0x10dfa3){var _0x289e2c={'agent':{},'channel':'sms'};if(_0x5dac8d[_0x9a5c('0x59')]['id']){delete _0x5dac8d[_0x9a5c('0x59')]['id'];}_0x5dac8d['body'][_0x9a5c('0x63')]=_0x5dac8d['body'][_0x9a5c('0x63')]||_0x5dac8d[_0x9a5c('0x62')]['id'];_0x289e2c['agent']['id']=_0x5dac8d[_0x9a5c('0x59')][_0x9a5c('0x63')];return db[_0x9a5c('0x3c')][_0x9a5c('0x57')]({'where':{'id':_0x5dac8d['params']['id'],'UserId':null}})[_0x9a5c('0x20')](handleEntityNotFound(_0x1fb3ff,null))[_0x9a5c('0x20')](function(_0x46e438){if(_0x46e438){_0x289e2c['message']=_0x46e438['get']({'plain':!![]});return db[_0x9a5c('0x65')]['find']({'where':{'id':_0x46e438['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1fb3ff,null))[_0x9a5c('0x20')](function(_0x293c43){if(_0x293c43){_0x289e2c[_0x9a5c('0x6a')]=_0x293c43[_0x9a5c('0x64')]({'plain':!![]});interaction_log[_0x9a5c('0x28')](_0x9a5c('0x7d'),_0x5dac8d[_0x9a5c('0x62')]['id'],_0x5dac8d[_0x9a5c('0x62')][_0x9a5c('0x3a')],_0x5dac8d[_0x9a5c('0x62')]['role'],_0x289e2c[_0x9a5c('0x6a')]['id'],_0x5dac8d[_0x9a5c('0x59')]?JSON[_0x9a5c('0x24')](_0x5dac8d['body']):'null');return respondWithRpcPromise(_0x9a5c('0x7e'),_0x9a5c('0x7f'),_0x289e2c);}return null;})[_0x9a5c('0x20')](function(_0x3eaa00){var _0x40c136=_0x9a5c('0x80')+_0x3eaa00[_0x9a5c('0x27')][_0x9a5c('0x70')];return db[_0x9a5c('0x71')]['query'](_0x40c136,{'type':db[_0x9a5c('0x72')][_0x9a5c('0x81')]['SELECT'],'raw':!![]})[_0x9a5c('0x20')](function(_0x2c2535){return _0x2c2535;});})[_0x9a5c('0x20')](function(_0x56b3e5){if(_0x56b3e5){_0x289e2c['message'][_0x9a5c('0x82')]=_0x56b3e5[0x0];if(!_0x5dac8d['body'][_0x9a5c('0x63')])return;return db[_0x9a5c('0x83')]['find']({'where':{'id':_0x5dac8d[_0x9a5c('0x59')][_0x9a5c('0x63')],'role':_0x9a5c('0x74')},'attributes':['id',_0x9a5c('0x3a'),_0x9a5c('0x75'),_0x9a5c('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x433f8a){if(!_0x433f8a)return null;_0x289e2c[_0x9a5c('0x27')]['agent']=_0x433f8a;return _0x289e2c;})[_0x9a5c('0x20')](function(_0x2ff2d0){if(_0x2ff2d0){_0x2ff2d0[_0x9a5c('0x27')][_0x9a5c('0x78')]=util[_0x9a5c('0x69')](_0x9a5c('0x79'),_0x5dac8d['user']['name']);_0x2ff2d0['message'][_0x9a5c('0x7a')]=_0x289e2c['channel'];_0x2ff2d0[_0x9a5c('0x27')][_0x9a5c('0x84')]=_0x289e2c[_0x9a5c('0x7a')];_0x2ff2d0[_0x9a5c('0x27')][_0x9a5c('0x85')]=_0x9a5c('0x35');respondWithRpcPromise(_0x9a5c('0x7b'),_0x9a5c('0x7b'),{'event':_0x9a5c('0x86'),'message':_0x2ff2d0[_0x9a5c('0x27')]},client9002);return _0x289e2c;}return null;})[_0x9a5c('0x20')](respondWithResult(_0x1fb3ff,null))[_0x9a5c('0x2a')](handleError(_0x1fb3ff,null));};exports[_0x9a5c('0x2b')]=function(_0x5a9cc3,_0x1776b3,_0x5909af){if(_0x5a9cc3[_0x9a5c('0x59')]['id']){delete _0x5a9cc3['body']['id'];}var _0x4ed020;return db[_0x9a5c('0x3c')][_0x9a5c('0x57')]({'where':{'id':_0x5a9cc3[_0x9a5c('0x5a')]['id']}})[_0x9a5c('0x20')](handleEntityNotFound(_0x1776b3,null))[_0x9a5c('0x20')](function(_0x46848a){if(_0x46848a){_0x4ed020=_0x46848a;return db[_0x9a5c('0x87')][_0x9a5c('0x57')]({'where':{'id':_0x46848a[_0x9a5c('0x88')]}});}})[_0x9a5c('0x20')](handleEntityNotFound(_0x1776b3,null))[_0x9a5c('0x20')](function(_0x5b260c){if(_0x5b260c){logger[_0x9a5c('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x9a5c('0x89'),_0x5b260c[_0x9a5c('0x3f')],util[_0x9a5c('0x8a')](_0x5a9cc3[_0x9a5c('0x59')],{'showHidden':![],'depth':null}));switch(_0x5b260c['type']){case _0x9a5c('0x8b'):if(_0x5a9cc3[_0x9a5c('0x59')][_0x9a5c('0x8c')]&&_0x5a9cc3[_0x9a5c('0x59')]['MessageSid']===_0x4ed020[_0x9a5c('0x8d')]){return _0x4ed020[_0x9a5c('0x36')]({'read':!![]});}else{logger[_0x9a5c('0x25')](_0x9a5c('0x8e'),_0x9a5c('0x2b'),_0x9a5c('0x8b'),util['inspect'](_0x5a9cc3[_0x9a5c('0x59')],{'showHidden':![],'depth':null}));}break;case _0x9a5c('0x8f'):if(_0x5a9cc3[_0x9a5c('0x59')][_0x9a5c('0x90')]&&_0x5a9cc3[_0x9a5c('0x59')][_0x9a5c('0x90')]===_0x4ed020[_0x9a5c('0x8d')]&&_[_0x9a5c('0x91')]([_0x9a5c('0x92'),'delivered'],_0x5a9cc3[_0x9a5c('0x59')][_0x9a5c('0x93')])>=0x0){return _0x4ed020[_0x9a5c('0x36')]({'read':!![]});}else{logger[_0x9a5c('0x25')](_0x9a5c('0x8e'),'status','plivio',util[_0x9a5c('0x8a')](_0x5a9cc3[_0x9a5c('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4235d4=_0x5a9cc3[_0x9a5c('0x59')][_0x9a5c('0x94')][0x0];if(_0x4235d4[_0x9a5c('0x2b')]['groupName']===_0x9a5c('0x95')){return _0x4ed020[_0x9a5c('0x36')]({'read':!![]});}else{logger['error'](_0x9a5c('0x8e'),_0x9a5c('0x2b'),_0x9a5c('0x96'),util['inspect'](_0x5a9cc3[_0x9a5c('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x4ed020;}})[_0x9a5c('0x20')](respondWithResult(_0x1776b3,null))[_0x9a5c('0x2a')](handleError(_0x1776b3,null));}; \ No newline at end of file +var _0xea21=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','includeAll','include','show','params','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse'];(function(_0x5b9284,_0x1b3159){var _0x44266b=function(_0x3ee7e7){while(--_0x3ee7e7){_0x5b9284['push'](_0x5b9284['shift']());}};_0x44266b(++_0x1b3159);}(_0xea21,0x80));var _0x1ea2=function(_0x314405,_0x232782){_0x314405=_0x314405-0x0;var _0x4cf6cc=_0xea21[_0x314405];return _0x4cf6cc;};'use strict';var emlformat=require(_0x1ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea2('0x1'));var jsonpatch=require(_0x1ea2('0x2'));var rp=require(_0x1ea2('0x3'));var moment=require('moment');var BPromise=require(_0x1ea2('0x4'));var Mustache=require('mustache');var util=require(_0x1ea2('0x5'));var path=require(_0x1ea2('0x6'));var sox=require(_0x1ea2('0x7'));var csv=require(_0x1ea2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ea2('0x9'));var _=require(_0x1ea2('0xa'));var squel=require(_0x1ea2('0xb'));var crypto=require(_0x1ea2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1ea2('0xd'));var toCsv=require(_0x1ea2('0x8'));var querystring=require('querystring');var Papa=require(_0x1ea2('0xe'));var Redis=require(_0x1ea2('0xf'));var authService=require(_0x1ea2('0x10'));var qs=require(_0x1ea2('0x11'));var as=require(_0x1ea2('0x12'));var hardwareService=require(_0x1ea2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1ea2('0x14'));var config=require(_0x1ea2('0x15'));var licenseUtil=require(_0x1ea2('0x16'));var db=require(_0x1ea2('0x17'))['db'];config[_0x1ea2('0x18')]=_[_0x1ea2('0x19')](config[_0x1ea2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ea2('0x1a'))(new Redis(config[_0x1ea2('0x18')]));require(_0x1ea2('0x1b'))['register'](socket);var jayson=require(_0x1ea2('0x1c'));var client=jayson[_0x1ea2('0x1d')][_0x1ea2('0x1e')]({'port':0x232c});var client9002=jayson[_0x1ea2('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2565,_0x372dc5,_0x27bb84,_0x14b984){return new BPromise(function(_0x28040b,_0x53965f){var _0x1d006b=_0x14b984||client;return _0x1d006b[_0x1ea2('0x1f')](_0x3f2565,_0x27bb84)[_0x1ea2('0x20')](function(_0x48a16e){logger[_0x1ea2('0x21')](_0x1ea2('0x22'),_0x372dc5,_0x1ea2('0x23'));logger['debug'](_0x1ea2('0x24'),_0x372dc5,_0x1ea2('0x23'),JSON[_0x1ea2('0x25')](_0x48a16e));if(_0x48a16e[_0x1ea2('0x26')]){if(_0x48a16e[_0x1ea2('0x26')]['code']===0x1f4){logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);return _0x53965f(_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);}logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x48a16e[_0x1ea2('0x26')]['message']);return _0x28040b(_0x48a16e[_0x1ea2('0x26')][_0x1ea2('0x27')]);}else{logger[_0x1ea2('0x21')](_0x1ea2('0x22'),_0x372dc5,'request\x20sent');_0x28040b(_0x48a16e['result'][_0x1ea2('0x27')]);}})[_0x1ea2('0x28')](function(_0x5a539b){logger[_0x1ea2('0x26')](_0x1ea2('0x22'),_0x372dc5,_0x5a539b);_0x53965f(_0x5a539b);});});}function respondWithStatusCode(_0x2dee14,_0x232d0e){_0x232d0e=_0x232d0e||0xcc;return function(_0x31b7a7){if(_0x31b7a7){return _0x2dee14[_0x1ea2('0x29')](_0x232d0e);}return _0x2dee14['status'](_0x232d0e)['end']();};}function respondWithResult(_0x366a83,_0x22ad41){_0x22ad41=_0x22ad41||0xc8;return function(_0x1a2699){if(_0x1a2699){return _0x366a83[_0x1ea2('0x2a')](_0x22ad41)[_0x1ea2('0x2b')](_0x1a2699);}};}function respondWithFilteredResult(_0x288b26,_0x53e48c){return function(_0x127d65){if(_0x127d65){var _0x492466=typeof _0x53e48c[_0x1ea2('0x2c')]===_0x1ea2('0x2d')&&typeof _0x53e48c[_0x1ea2('0x2e')]===_0x1ea2('0x2d');var _0x149251=_0x127d65[_0x1ea2('0x2f')];var _0x10dcf8=_0x492466?0x0:_0x53e48c[_0x1ea2('0x2c')];var _0x545ea5=_0x492466?_0x127d65['count']:_0x53e48c['offset']+_0x53e48c[_0x1ea2('0x2e')];var _0x53ee7f;if(_0x545ea5>=_0x149251){_0x545ea5=_0x149251;_0x53ee7f=0xc8;}else{_0x53ee7f=0xce;}_0x288b26[_0x1ea2('0x2a')](_0x53ee7f);return _0x288b26['set'](_0x1ea2('0x30'),_0x10dcf8+'-'+_0x545ea5+'/'+_0x149251)[_0x1ea2('0x2b')](_0x127d65);}return null;};}function patchUpdates(_0x24a1b4){return function(_0x2c081d){try{jsonpatch[_0x1ea2('0x31')](_0x2c081d,_0x24a1b4,!![]);}catch(_0x152e2b){return BPromise[_0x1ea2('0x32')](_0x152e2b);}return _0x2c081d['save']();};}function saveUpdates(_0xdbc11e,_0x39a07c){return function(_0x4eeb77){if(_0x4eeb77){return _0x4eeb77[_0x1ea2('0x33')](_0xdbc11e)[_0x1ea2('0x20')](function(_0x108b74){return _0x108b74;});}return null;};}function removeEntity(_0x3266a7,_0x3716ac){return function(_0x4b78bb){if(_0x4b78bb){return _0x4b78bb[_0x1ea2('0x34')]()['then'](function(){_0x3266a7[_0x1ea2('0x2a')](0xcc)[_0x1ea2('0x35')]();});}};}function handleEntityNotFound(_0x9a56ad,_0x38a0e9){return function(_0x2b825a){if(!_0x2b825a){_0x9a56ad[_0x1ea2('0x29')](0x194);}return _0x2b825a;};}function handleError(_0x134277,_0x6543f8){_0x6543f8=_0x6543f8||0x1f4;return function(_0x9e5ece){logger[_0x1ea2('0x26')](_0x9e5ece[_0x1ea2('0x36')]);if(_0x9e5ece[_0x1ea2('0x37')]){delete _0x9e5ece[_0x1ea2('0x37')];}_0x134277[_0x1ea2('0x2a')](_0x6543f8)[_0x1ea2('0x38')](_0x9e5ece);};}exports['index']=function(_0x4a4a4d,_0x411766){var _0x7acab0={},_0x3d241c={},_0x3c6ea5={'count':0x0,'rows':[]};var _0x4c189f=_[_0x1ea2('0x39')](db[_0x1ea2('0x3a')][_0x1ea2('0x3b')],function(_0x4cf0c8){return{'name':_0x4cf0c8[_0x1ea2('0x3c')],'type':_0x4cf0c8[_0x1ea2('0x3d')][_0x1ea2('0x3e')]};});_0x3d241c[_0x1ea2('0x3f')]=_['map'](_0x4c189f,'name');_0x3d241c['query']=_[_0x1ea2('0x40')](_0x4a4a4d[_0x1ea2('0x41')]);_0x3d241c[_0x1ea2('0x42')]=_[_0x1ea2('0x43')](_0x3d241c[_0x1ea2('0x3f')],_0x3d241c[_0x1ea2('0x41')]);_0x7acab0[_0x1ea2('0x44')]=_[_0x1ea2('0x43')](_0x3d241c[_0x1ea2('0x3f')],qs[_0x1ea2('0x45')](_0x4a4a4d['query'][_0x1ea2('0x45')]));_0x7acab0['attributes']=_0x7acab0[_0x1ea2('0x44')][_0x1ea2('0x46')]?_0x7acab0[_0x1ea2('0x44')]:_0x3d241c[_0x1ea2('0x3f')];if(!_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x47')]('nolimit')){_0x7acab0[_0x1ea2('0x2e')]=qs['limit'](_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x2e')]);_0x7acab0[_0x1ea2('0x2c')]=qs['offset'](_0x4a4a4d['query'][_0x1ea2('0x2c')]);}_0x7acab0[_0x1ea2('0x48')]=qs[_0x1ea2('0x49')](_0x4a4a4d[_0x1ea2('0x41')]['sort']);_0x7acab0['where']=qs['filters'](_[_0x1ea2('0x4a')](_0x4a4a4d['query'],_0x3d241c[_0x1ea2('0x42')]),_0x4c189f);if(_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4b')]){_0x7acab0['where']=_['merge'](_0x7acab0[_0x1ea2('0x4c')],{'$or':_['map'](_0x4c189f,function(_0x56fd1b){if(_0x56fd1b[_0x1ea2('0x3d')]!==_0x1ea2('0x4d')){var _0x3dd0da={};_0x3dd0da[_0x56fd1b[_0x1ea2('0x37')]]={'$like':'%'+_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4b')]+'%'};return _0x3dd0da;}})});}_0x7acab0=_['merge']({},_0x7acab0,_0x4a4a4d['options']);var _0x4e1a0e={'where':_0x7acab0['where']};return db['SmsMessage'][_0x1ea2('0x2f')](_0x4e1a0e)['then'](function(_0x2090da){_0x3c6ea5[_0x1ea2('0x2f')]=_0x2090da;if(_0x4a4a4d[_0x1ea2('0x41')][_0x1ea2('0x4e')]){_0x7acab0[_0x1ea2('0x4f')]=[{'all':!![]}];}return db[_0x1ea2('0x3a')]['findAll'](_0x7acab0);})[_0x1ea2('0x20')](function(_0xf025e5){_0x3c6ea5['rows']=_0xf025e5;return _0x3c6ea5;})[_0x1ea2('0x20')](respondWithFilteredResult(_0x411766,_0x7acab0))[_0x1ea2('0x28')](handleError(_0x411766,null));};exports[_0x1ea2('0x50')]=function(_0x17f675,_0x208cb6){var _0x5afd52={'raw':!![],'where':{'id':_0x17f675[_0x1ea2('0x51')]['id']}},_0x57e0f0={};_0x57e0f0[_0x1ea2('0x3f')]=_[_0x1ea2('0x40')](db[_0x1ea2('0x3a')]['rawAttributes']);_0x57e0f0['query']=_['keys'](_0x17f675[_0x1ea2('0x41')]);_0x57e0f0['filters']=_[_0x1ea2('0x43')](_0x57e0f0['model'],_0x57e0f0['query']);_0x5afd52[_0x1ea2('0x44')]=_['intersection'](_0x57e0f0[_0x1ea2('0x3f')],qs['fields'](_0x17f675[_0x1ea2('0x41')][_0x1ea2('0x45')]));_0x5afd52['attributes']=_0x5afd52['attributes'][_0x1ea2('0x46')]?_0x5afd52[_0x1ea2('0x44')]:_0x57e0f0[_0x1ea2('0x3f')];if(_0x17f675[_0x1ea2('0x41')][_0x1ea2('0x4e')]){_0x5afd52[_0x1ea2('0x4f')]=[{'all':!![]}];}_0x5afd52=_['merge']({},_0x5afd52,_0x17f675['options']);return db[_0x1ea2('0x3a')][_0x1ea2('0x52')](_0x5afd52)['then'](handleEntityNotFound(_0x208cb6,null))[_0x1ea2('0x20')](respondWithResult(_0x208cb6,null))[_0x1ea2('0x28')](handleError(_0x208cb6,null));};exports[_0x1ea2('0x53')]=function(_0x39daca,_0xf300e4){return db['SmsMessage'][_0x1ea2('0x53')](_0x39daca['body'],{})[_0x1ea2('0x20')](respondWithResult(_0xf300e4,0xc9))[_0x1ea2('0x28')](handleError(_0xf300e4,null));};exports[_0x1ea2('0x33')]=function(_0x246b44,_0x4dded6){if(_0x246b44[_0x1ea2('0x54')]['id']){delete _0x246b44['body']['id'];}return db['SmsMessage']['find']({'where':{'id':_0x246b44['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x4dded6,null))[_0x1ea2('0x20')](saveUpdates(_0x246b44[_0x1ea2('0x54')],null))['then'](respondWithResult(_0x4dded6,null))[_0x1ea2('0x28')](handleError(_0x4dded6,null));};exports[_0x1ea2('0x34')]=function(_0x1cd123,_0x7f7636){return db['SmsMessage'][_0x1ea2('0x52')]({'where':{'id':_0x1cd123['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x7f7636,null))['then'](removeEntity(_0x7f7636,null))[_0x1ea2('0x28')](handleError(_0x7f7636,null));};exports[_0x1ea2('0x55')]=function(_0x3e55cf,_0xee03ef){return db[_0x1ea2('0x3a')][_0x1ea2('0x55')]()[_0x1ea2('0x20')](respondWithResult(_0xee03ef,null))[_0x1ea2('0x28')](handleError(_0xee03ef,null));};var interaction_log=require('../../config/logger')(_0x1ea2('0x56'));exports['accept']=function(_0x1c3a82,_0x364a63,_0x59ae8d){var _0x20ce44={'agent':{},'channel':_0x1ea2('0x57')};if(_0x1c3a82[_0x1ea2('0x54')]['id']){delete _0x1c3a82['body']['id'];}_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x58')]=!![];_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x59')]=moment()[_0x1ea2('0x5a')](_0x1ea2('0x5b'));_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')]=_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')]||_0x1c3a82[_0x1ea2('0x5d')]['id'];_0x20ce44[_0x1ea2('0x5e')]['id']=_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')];return db[_0x1ea2('0x3a')]['find']({'where':{'id':_0x1c3a82[_0x1ea2('0x51')]['id'],'UserId':null}})[_0x1ea2('0x20')](handleEntityNotFound(_0x364a63,null))[_0x1ea2('0x20')](saveUpdates(_0x1c3a82[_0x1ea2('0x54')],null))[_0x1ea2('0x20')](function(_0x157ee8){if(_0x157ee8){_0x20ce44[_0x1ea2('0x27')]=_0x157ee8['get']({'plain':!![]});return db[_0x1ea2('0x5f')][_0x1ea2('0x52')]({'where':{'id':_0x157ee8[_0x1ea2('0x60')]}});}return null;})[_0x1ea2('0x20')](handleEntityNotFound(_0x364a63,null))[_0x1ea2('0x20')](function(_0x4fd0f4){if(_0x4fd0f4){return _0x4fd0f4[_0x1ea2('0x33')]({'UserId':_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')],'read1stAt':_[_0x1ea2('0x61')](_0x4fd0f4[_0x1ea2('0x62')])?moment()[_0x1ea2('0x5a')](_0x1ea2('0x5b')):undefined});}return null;})[_0x1ea2('0x20')](function(_0xcedbec){if(_0xcedbec){_0x20ce44[_0x1ea2('0x63')]=_0xcedbec['get']({'plain':!![]});interaction_log[_0x1ea2('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c3a82[_0x1ea2('0x5d')]['id'],_0x1c3a82[_0x1ea2('0x5d')][_0x1ea2('0x37')],_0x1c3a82['user'][_0x1ea2('0x64')],_0x20ce44[_0x1ea2('0x63')]['id'],_0x1c3a82[_0x1ea2('0x54')]?JSON[_0x1ea2('0x25')](_0x1c3a82['body']):_0x1ea2('0x65'));return respondWithRpcPromise(_0x1ea2('0x66'),_0x1ea2('0x67'),_0x20ce44);}return null;})[_0x1ea2('0x20')](function(_0x2488a1){var _0x4ba554='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2488a1['message'][_0x1ea2('0x68')];return db[_0x1ea2('0x69')]['query'](_0x4ba554,{'type':db[_0x1ea2('0x6a')][_0x1ea2('0x6b')][_0x1ea2('0x6c')],'raw':!![]})[_0x1ea2('0x20')](function(_0x2e50b5){return _0x2e50b5;});})[_0x1ea2('0x20')](function(_0x1eb347){if(_0x1eb347){_0x20ce44['message']['contact']=_0x1eb347[0x0];if(!_0x1c3a82[_0x1ea2('0x54')][_0x1ea2('0x5c')])return;return db['User'][_0x1ea2('0x52')]({'where':{'id':_0x1c3a82[_0x1ea2('0x54')]['UserId'],'role':_0x1ea2('0x5e')},'attributes':['id',_0x1ea2('0x37'),'fullname',_0x1ea2('0x6d'),_0x1ea2('0x6e')],'raw':!![]});}return null;})[_0x1ea2('0x20')](function(_0x547a65){if(!_0x547a65)return null;_0x20ce44['message'][_0x1ea2('0x5e')]=_0x547a65;return _0x20ce44;})['then'](function(_0x415555){if(_0x415555){if(_0x1c3a82['body']['manual']){_0x20ce44['message'][_0x1ea2('0x6f')]=util['format'](_0x1ea2('0x70'),_0x1c3a82[_0x1ea2('0x5d')][_0x1ea2('0x37')]);_0x20ce44[_0x1ea2('0x27')][_0x1ea2('0x71')]=_0x20ce44[_0x1ea2('0x71')];_0x20ce44['message'][_0x1ea2('0x72')]=_0x20ce44[_0x1ea2('0x71')];_0x20ce44[_0x1ea2('0x27')][_0x1ea2('0x73')]='accept';return respondWithRpcPromise(_0x1ea2('0x74'),_0x1ea2('0x74'),{'event':_0x1ea2('0x75'),'message':_0x20ce44[_0x1ea2('0x27')]},client9002)[_0x1ea2('0x20')](function(){return _0x20ce44;});}return _0x20ce44;}return null;})[_0x1ea2('0x20')](respondWithResult(_0x364a63,null))['catch'](handleError(_0x364a63,null));};var interaction_log=require(_0x1ea2('0x76'))(_0x1ea2('0x56'));exports[_0x1ea2('0x32')]=function(_0xe795a6,_0x4d996b,_0x19aa4c){var _0x4323cf={'agent':{},'channel':_0x1ea2('0x57')};if(_0xe795a6[_0x1ea2('0x54')]['id']){delete _0xe795a6[_0x1ea2('0x54')]['id'];}_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')]=_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')]||_0xe795a6['user']['id'];_0x4323cf['agent']['id']=_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')];return db[_0x1ea2('0x3a')][_0x1ea2('0x52')]({'where':{'id':_0xe795a6['params']['id'],'UserId':null}})[_0x1ea2('0x20')](handleEntityNotFound(_0x4d996b,null))[_0x1ea2('0x20')](function(_0x10dc58){if(_0x10dc58){_0x4323cf[_0x1ea2('0x27')]=_0x10dc58['get']({'plain':!![]});return db[_0x1ea2('0x5f')]['find']({'where':{'id':_0x10dc58[_0x1ea2('0x60')]}});}return null;})[_0x1ea2('0x20')](handleEntityNotFound(_0x4d996b,null))['then'](function(_0x5f43ab){if(_0x5f43ab){_0x4323cf[_0x1ea2('0x63')]=_0x5f43ab[_0x1ea2('0x77')]({'plain':!![]});interaction_log[_0x1ea2('0x21')](_0x1ea2('0x78'),_0xe795a6['user']['id'],_0xe795a6['user']['name'],_0xe795a6['user']['role'],_0x4323cf[_0x1ea2('0x63')]['id'],_0xe795a6['body']?JSON['stringify'](_0xe795a6[_0x1ea2('0x54')]):_0x1ea2('0x65'));return respondWithRpcPromise(_0x1ea2('0x79'),_0x1ea2('0x7a'),_0x4323cf);}return null;})[_0x1ea2('0x20')](function(_0x504610){var _0x5c4362=_0x1ea2('0x7b')+_0x504610[_0x1ea2('0x27')]['ContactId'];return db[_0x1ea2('0x69')][_0x1ea2('0x41')](_0x5c4362,{'type':db[_0x1ea2('0x6a')][_0x1ea2('0x6b')][_0x1ea2('0x6c')],'raw':!![]})[_0x1ea2('0x20')](function(_0x377d2b){return _0x377d2b;});})[_0x1ea2('0x20')](function(_0x2a03e5){if(_0x2a03e5){_0x4323cf[_0x1ea2('0x27')][_0x1ea2('0x7c')]=_0x2a03e5[0x0];if(!_0xe795a6['body']['UserId'])return;return db['User']['find']({'where':{'id':_0xe795a6[_0x1ea2('0x54')][_0x1ea2('0x5c')],'role':_0x1ea2('0x5e')},'attributes':['id',_0x1ea2('0x37'),'fullname',_0x1ea2('0x6d'),_0x1ea2('0x6e')],'raw':!![]});}return null;})[_0x1ea2('0x20')](function(_0x3d5982){if(!_0x3d5982)return null;_0x4323cf[_0x1ea2('0x27')][_0x1ea2('0x5e')]=_0x3d5982;return _0x4323cf;})['then'](function(_0x5a7d77){if(_0x5a7d77){_0x5a7d77['message'][_0x1ea2('0x6f')]=util['format'](_0x1ea2('0x70'),_0xe795a6[_0x1ea2('0x5d')][_0x1ea2('0x37')]);_0x5a7d77[_0x1ea2('0x27')]['channel']=_0x4323cf[_0x1ea2('0x71')];_0x5a7d77[_0x1ea2('0x27')][_0x1ea2('0x72')]=_0x4323cf[_0x1ea2('0x71')];_0x5a7d77[_0x1ea2('0x27')][_0x1ea2('0x73')]=_0x1ea2('0x32');respondWithRpcPromise(_0x1ea2('0x74'),_0x1ea2('0x74'),{'event':_0x1ea2('0x7d'),'message':_0x5a7d77[_0x1ea2('0x27')]},client9002);return _0x4323cf;}return null;})[_0x1ea2('0x20')](respondWithResult(_0x4d996b,null))[_0x1ea2('0x28')](handleError(_0x4d996b,null));};exports[_0x1ea2('0x2a')]=function(_0x225f86,_0x53fdb8,_0x40a341){if(_0x225f86['body']['id']){delete _0x225f86['body']['id'];}var _0xdd392f;return db[_0x1ea2('0x3a')][_0x1ea2('0x52')]({'where':{'id':_0x225f86['params']['id']}})[_0x1ea2('0x20')](handleEntityNotFound(_0x53fdb8,null))['then'](function(_0x2c4c63){if(_0x2c4c63){_0xdd392f=_0x2c4c63;return db[_0x1ea2('0x7e')][_0x1ea2('0x52')]({'where':{'id':_0x2c4c63[_0x1ea2('0x7f')]}});}})[_0x1ea2('0x20')](handleEntityNotFound(_0x53fdb8,null))['then'](function(_0x27a77a){if(_0x27a77a){logger['debug'](_0x1ea2('0x24'),'status',_0x1ea2('0x80'),_0x27a77a[_0x1ea2('0x3d')],util[_0x1ea2('0x81')](_0x225f86['body'],{'showHidden':![],'depth':null}));switch(_0x27a77a[_0x1ea2('0x3d')]){case'twilio':if(_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x82')]&&_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x82')]===_0xdd392f[_0x1ea2('0x83')]){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger['error'](_0x1ea2('0x84'),_0x1ea2('0x2a'),_0x1ea2('0x85'),util['inspect'](_0x225f86['body'],{'showHidden':![],'depth':null}));}break;case _0x1ea2('0x86'):if(_0x225f86['body'][_0x1ea2('0x87')]&&_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x87')]===_0xdd392f['messageId']&&_[_0x1ea2('0x88')]([_0x1ea2('0x89'),'delivered'],_0x225f86[_0x1ea2('0x54')][_0x1ea2('0x8a')])>=0x0){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger[_0x1ea2('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ea2('0x2a'),_0x1ea2('0x8b'),util[_0x1ea2('0x81')](_0x225f86[_0x1ea2('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1ea2('0x8c'):var _0x1f5cb3=_0x225f86[_0x1ea2('0x54')]['results'][0x0];if(_0x1f5cb3[_0x1ea2('0x2a')][_0x1ea2('0x8d')]===_0x1ea2('0x8e')){return _0xdd392f[_0x1ea2('0x33')]({'read':!![]});}else{logger[_0x1ea2('0x26')](_0x1ea2('0x84'),_0x1ea2('0x2a'),_0x1ea2('0x8c'),util[_0x1ea2('0x81')](_0x225f86[_0x1ea2('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xdd392f;}})['then'](respondWithResult(_0x53fdb8,null))[_0x1ea2('0x28')](handleError(_0x53fdb8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 92ab669..f9ef2d9 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 _0xd2c3=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2c3,0x173));var _0x3d2c=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xd2c3[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0x3d2c('0x0'));var SmsMessage=require(_0x3d2c('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3d2c('0x2')](0x0);var events={'afterCreate':_0x3d2c('0x3'),'afterUpdate':_0x3d2c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e8c9c){return function(_0x52a12f,_0x336079,_0x12ec1c){SmsMessageEvents[_0x3d2c('0x5')](_0x2e8c9c+':'+_0x52a12f['id'],_0x52a12f);SmsMessageEvents[_0x3d2c('0x5')](_0x2e8c9c,_0x52a12f);_0x12ec1c(null);};}for(var e in events){if(events[_0x3d2c('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x3d2c('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xcf14=['exports','events','../../mysqldb','save','remove','emit','hook'];(function(_0x4855a7,_0x133b87){var _0x2d3855=function(_0x89fbcb){while(--_0x89fbcb){_0x4855a7['push'](_0x4855a7['shift']());}};_0x2d3855(++_0x133b87);}(_0xcf14,0x12e));var _0x4cf1=function(_0x283006,_0x54f88d){_0x283006=_0x283006-0x0;var _0x162518=_0xcf14[_0x283006];return _0x162518;};'use strict';var EventEmitter=require(_0x4cf1('0x0'));var SmsMessage=require(_0x4cf1('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4cf1('0x2'),'afterUpdate':'update','afterDestroy':_0x4cf1('0x3')};function emitEvent(_0x53787f){return function(_0x4820b4,_0x12394d,_0x479c0f){SmsMessageEvents[_0x4cf1('0x4')](_0x53787f+':'+_0x4820b4['id'],_0x4820b4);SmsMessageEvents[_0x4cf1('0x4')](_0x53787f,_0x4820b4);_0x479c0f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x4cf1('0x5')](e,emitEvent(event));}}module[_0x4cf1('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d87f29e..213afe9 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 _0x1b44=['then','update','createdAt','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','&password=','GET','POST','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','http_code','data','head','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','/api/sms/messages/','application/json','Missing\x20parameters:\x20base_url','crypto','login','text','sort','length','apiKey','createHash','md5','digest','signature=','baseUrl','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','base64','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1b44,0x155));var _0x41b4=function(_0x213c73,_0x275b00){_0x213c73=_0x213c73-0x0;var _0x1615d0=_0x1b44[_0x213c73];return _0x1615d0;};'use strict';var _=require(_0x41b4('0x0'));var util=require(_0x41b4('0x1'));var logger=require('../../config/logger')(_0x41b4('0x2'));var moment=require(_0x41b4('0x3'));var BPromise=require(_0x41b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41b4('0x5'));var rimraf=require(_0x41b4('0x6'));var config=require(_0x41b4('0x7'));var attributes=require(_0x41b4('0x8'));module[_0x41b4('0x9')]=function(_0x68eb9e,_0x313869){return _0x68eb9e['define']('SmsMessage',attributes,{'tableName':_0x41b4('0xa'),'paranoid':![],'indexes':[{'name':_0x41b4('0xb'),'fields':['messageId']},{'name':_0x41b4('0xc'),'fields':[_0x41b4('0xd')],'type':_0x41b4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31a79f,_0x5e4f30,_0xf0402e){var _0x16615d=_0x68eb9e[_0x41b4('0xf')];var _0x55ca9c=_0x31a79f['get']({'plain':!![]});if(_0x55ca9c['direction'][_0x41b4('0x10')]()==='in'||_0x55ca9c[_0x41b4('0x11')][_0x41b4('0x10')]()===_0x41b4('0x12')&&!_0x55ca9c[_0x41b4('0x13')]&&!_['isNil'](_0x55ca9c[_0x41b4('0x14')])&&!_[_0x41b4('0x15')](_0x55ca9c[_0x41b4('0x16')])){_0x16615d[_0x41b4('0x17')][_0x41b4('0x18')]({'where':{'id':_0x55ca9c[_0x41b4('0x16')]}})[_0x41b4('0x19')](function(_0x191eed){if(_0x191eed){_0x191eed[_0x41b4('0x1a')]({'lastMsgAt':_0x55ca9c[_0x41b4('0x1b')],'lastMsgDirection':_0x55ca9c['direction'][_0x41b4('0x10')]()});}})['catch'](function(_0x3245d0){console['error'](_0x3245d0);});}if(_0x55ca9c[_0x41b4('0x11')]===_0x41b4('0x12')&&!_0x55ca9c[_0x41b4('0x13')]){var _0x78d447;_0x16615d[_0x41b4('0x1c')][_0x41b4('0x1d')]({'where':{'id':_0x55ca9c[_0x41b4('0x1e')]},'raw':!![]})[_0x41b4('0x19')](function(_0x1a6ae1){_0x78d447=_0x1a6ae1;if(_0x78d447&&_0x78d447[_0x41b4('0x1f')]){switch(_0x78d447[_0x41b4('0x1f')]){case _0x41b4('0x20'):var _0x3ef8a1=require('twilio');if(_0x78d447['accountSid']&&_0x78d447[_0x41b4('0x21')]&&_0x78d447[_0x41b4('0x22')]){var _0x295fe7=new _0x3ef8a1(_0x78d447[_0x41b4('0x23')],_0x78d447['authToken']);_0x295fe7[_0x41b4('0x24')][_0x41b4('0x25')]({'body':_0x55ca9c[_0x41b4('0xd')],'to':_0x55ca9c['phone'],'from':_0x78d447['phone'],'statusCallback':_0x78d447['remote']+'/api/sms/messages/'+_0x55ca9c['id']+_0x41b4('0x26')+_0x78d447[_0x41b4('0x27')]})[_0x41b4('0x19')](function(_0x4dd19d){if(_0x4dd19d[_0x41b4('0x28')]){return _0x31a79f[_0x41b4('0x1a')]({'messageId':_0x4dd19d[_0x41b4('0x28')]});}})[_0x41b4('0x29')](function(_0x1f7ef){logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x20'),util[_0x41b4('0x2d')](_0x1f7ef,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x41b4('0x2c'),_0x41b4('0x20'),_0x41b4('0x2e'));}break;case _0x41b4('0x2f'):var _0x512e67='https://api.skebby.it/API/v1.0/REST/';if(_0x78d447[_0x41b4('0x30')]&&_0x78d447[_0x41b4('0x31')]){var _0x578e96={'recipient':[_0x55ca9c[_0x41b4('0x22')]],'message':_0x55ca9c[_0x41b4('0xd')],'message_type':_0x78d447[_0x41b4('0x32')]};if(_0x78d447['smsMethod']&&_0x78d447[_0x41b4('0x32')]!=='SI'){_0x578e96[_0x41b4('0x33')]=_0x78d447[_0x41b4('0x22')];}var _0xee6ff7={'url':_0x512e67+'login?username='+_0x78d447[_0x41b4('0x30')]+_0x41b4('0x34')+_0x78d447['password'],'method':_0x41b4('0x35')};rp(_0xee6ff7)[_0x41b4('0x19')](function(_0x2005dd){var _0x3339b7=_0x2005dd['split'](';');var _0x2cf57a={'user_key':_0x3339b7[0x0],'session_key':_0x3339b7[0x1]};_0xee6ff7={'url':_0x512e67+'sms','method':_0x41b4('0x36'),'headers':{'user_key':_0x2cf57a['user_key'],'Session_key':_0x2cf57a[_0x41b4('0x37')]},'json':!![],'body':_0x578e96};return rp(_0xee6ff7);})['then'](function(_0x1457ff){if(_0x1457ff[_0x41b4('0x38')]>=0x1){var _0x396129={'messageId':_0x1457ff[_0x41b4('0x39')]};if(_0x78d447[_0x41b4('0x32')]!=='GP'||!_0x78d447['deliveryReport']){_0x396129[_0x41b4('0x3a')]=!![];}return _0x31a79f['update'](_0x396129);}else{return logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x2f'),util[_0x41b4('0x2d')](_0x1457ff,{'showHidden':![],'depth':null}));}})[_0x41b4('0x29')](function(_0x2fe0c8){return logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x2f'),util['inspect'](_0x2fe0c8,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x2f'),_0x41b4('0x3b'));}break;case _0x41b4('0x3c'):if(_0x78d447[_0x41b4('0x21')]){var _0xc60bed={'recipient':_0x55ca9c[_0x41b4('0x22')],'message':_0x55ca9c[_0x41b4('0xd')],'sender':_0x78d447[_0x41b4('0x3d')]||_0x78d447[_0x41b4('0x22')],'authorization':_0x78d447[_0x41b4('0x21')]};var _0x5e4f30={'method':_0x41b4('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xc60bed,'json':!![]};rp(_0x5e4f30)[_0x41b4('0x19')](function(_0x5c26a2){var _0x2d5de1={'messageId':_0x5c26a2[_0x41b4('0x3e')]};if(!_0x78d447[_0x41b4('0x3f')]){_0x2d5de1[_0x41b4('0x3a')]=!![];}return _0x31a79f['update'](_0x2d5de1);})[_0x41b4('0x29')](function(_0x2ff60b){logger[_0x41b4('0x2a')](_0x41b4('0x2b'),'afterCreate','connectel',util[_0x41b4('0x2d')](_0x2ff60b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x3c'),_0x41b4('0x40'));}break;case _0x41b4('0x41'):if(_0x78d447[_0x41b4('0x30')]&&_0x78d447[_0x41b4('0x31')]){var _0xc60bed={'messages':[{'source':_0x41b4('0x42'),'to':_0x55ca9c[_0x41b4('0x22')],'body':_0x55ca9c[_0x41b4('0xd')],'from':_0x78d447[_0x41b4('0x3d')]||_0x78d447[_0x41b4('0x22')]}]};var _0x470669=util[_0x41b4('0x43')](_0x41b4('0x44'),_0x78d447[_0x41b4('0x30')],_0x78d447['password']);var _0x5e4f30={'method':_0x41b4('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xc60bed,'headers':{'Authorization':util[_0x41b4('0x43')](_0x41b4('0x45'),new Buffer(_0x470669)['toString']('base64'))},'json':!![]};rp(_0x5e4f30)['then'](function(_0x3e08d1){if(_0x3e08d1[_0x41b4('0x46')]>=0xc8&&_0x3e08d1[_0x41b4('0x46')]<=0xce){if(_0x3e08d1[_0x41b4('0x47')]&&_0x3e08d1[_0x41b4('0x47')]['queued_count']>0x0){var _0x5eeb7b=_[_0x41b4('0x48')](_0x3e08d1[_0x41b4('0x47')][_0x41b4('0x24')]);var _0x280cf0={'messageId':_0x5eeb7b['message_id']};if(!_0x78d447[_0x41b4('0x3f')]){_0x280cf0['read']=!![];}return _0x31a79f['update'](_0x280cf0);}else{logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x41b4('0x2c'),'clickSend',util[_0x41b4('0x2d')](_0x3e08d1,{'showHidden':![],'depth':null}));}}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x49'),util[_0x41b4('0x2d')](_0x3e08d1,{'showHidden':![],'depth':null}));}})[_0x41b4('0x29')](function(_0x1683fe){logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x41b4('0x2c'),_0x41b4('0x49'),util[_0x41b4('0x2d')](_0x1683fe,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x41b4('0x4a'):if(_0x78d447[_0x41b4('0x4b')]&&_0x78d447[_0x41b4('0x21')]){var _0xc60bed={'dst':_0x55ca9c['phone'],'text':_0x55ca9c[_0x41b4('0xd')],'src':_0x78d447[_0x41b4('0x3d')]||_0x78d447['phone'],'url':_0x78d447[_0x41b4('0x4c')]+'/api/sms/messages/'+_0x55ca9c['id']+_0x41b4('0x26')+_0x78d447['token']};var _0x470669=util[_0x41b4('0x43')](_0x41b4('0x44'),_0x78d447['authId'],_0x78d447[_0x41b4('0x21')]);var _0x5e4f30={'method':_0x41b4('0x36'),'uri':util['format'](_0x41b4('0x4d'),_0x78d447['authId']),'body':_0xc60bed,'headers':{'Authorization':util[_0x41b4('0x43')]('Basic\x20%s',new Buffer(_0x470669)[_0x41b4('0x4e')]('base64'))},'json':!![]};rp(_0x5e4f30)[_0x41b4('0x19')](function(_0x570c75){var _0x52ddb9={'messageId':_0x570c75[_0x41b4('0x4f')][0x0]};return _0x31a79f[_0x41b4('0x1a')](_0x52ddb9);})['catch'](function(_0x310a1b){logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),'plivo',util[_0x41b4('0x2d')](_0x310a1b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),'plivo',_0x41b4('0x50'));}break;case _0x41b4('0x51'):if(_0x78d447['username']&&_0x78d447[_0x41b4('0x31')]){if(_0x78d447['baseUrl']){var _0xddb358={'method':'POST','uri':_0x78d447['baseUrl']+'/auth/1/session','body':{'username':_0x78d447[_0x41b4('0x30')],'password':_0x78d447[_0x41b4('0x31')]},'json':!![]};return rp(_0xddb358)['then'](function(_0x26cfc4){var _0xf1fdb6={'method':_0x41b4('0x36'),'uri':_0x78d447['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x78d447[_0x41b4('0x22')],'destinations':[{'to':_0x55ca9c['phone']}],'text':_0x55ca9c['body'],'notifyUrl':_0x78d447[_0x41b4('0x4c')]+_0x41b4('0x52')+_0x55ca9c['id']+_0x41b4('0x26')+_0x78d447['token'],'notifyContentType':_0x41b4('0x53'),'callbackData':_0x78d447[_0x41b4('0x22')]+';'+_0x55ca9c[_0x41b4('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x26cfc4[_0x41b4('0x27')]},'json':!![]};return rp(_0xf1fdb6)[_0x41b4('0x19')](function(_0x2df8cd){if(_0x2df8cd[_0x41b4('0x24')]){var _0x1c26c9={'messageId':_0x2df8cd[_0x41b4('0x24')][0x0][_0x41b4('0xb')]};if(!_0x78d447[_0x41b4('0x3f')]){_0x1c26c9['read']=!![];}return _0x31a79f[_0x41b4('0x1a')](_0x1c26c9);}else{return logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),'infobip',util['inspect'](_0x2df8cd,{'showHidden':![],'depth':null}));}});})[_0x41b4('0x29')](function(_0x12fc43){return logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),'infobip',util[_0x41b4('0x2d')](_0x12fc43,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x51'),_0x41b4('0x54'));}}else{logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x41b4('0x2c'),_0x41b4('0x51'),_0x41b4('0x3b'));}break;case'csc':var _0x34b1f3=require(_0x41b4('0x55'));if(_0x78d447['apiKey']){var _0x421f4f={};_0x421f4f[_0x41b4('0x56')]=_0x78d447[_0x41b4('0x30')];_0x421f4f[_0x41b4('0x22')]=_0x55ca9c[_0x41b4('0x22')];_0x421f4f['sender']=_0x78d447[_0x41b4('0x22')];_0x421f4f[_0x41b4('0x57')]=_0x55ca9c[_0x41b4('0xd')];_0x421f4f['timestamp']=+new Date();var _0x42bd0c='';var _0x532797='';var _0x1122fd=Object['keys'](_0x421f4f);_0x1122fd[_0x41b4('0x58')]();for(var _0x120843=0x0;_0x120843<_0x1122fd[_0x41b4('0x59')];_0x120843++){if(_0x42bd0c!=''){_0x42bd0c+='&';}_0x42bd0c+=_0x1122fd[_0x120843]+'='+encodeURIComponent(_0x421f4f[_0x1122fd[_0x120843]]);_0x532797+=_0x421f4f[_0x1122fd[_0x120843]];}_0x532797+=_0x78d447[_0x41b4('0x5a')];_0x532797=_0x34b1f3[_0x41b4('0x5b')](_0x41b4('0x5c'))[_0x41b4('0x1a')](_0x532797)[_0x41b4('0x5d')]('hex');if(_0x42bd0c!==''){_0x42bd0c+='&';}_0x42bd0c+=_0x41b4('0x5e')+_0x532797;var _0xee6ff7={'method':'GET','uri':_0x78d447[_0x41b4('0x5f')]+_0x41b4('0x60')+_0x42bd0c,'json':!![]};return rp(_0xee6ff7)[_0x41b4('0x19')](function(_0x11709c){var _0x2a3422=Object[_0x41b4('0x61')](_0x11709c);if(_0x11709c[_0x2a3422[0x0]][_0x41b4('0x2a')]&&parseInt(_0x11709c[_0x2a3422[0x0]][_0x41b4('0x2a')])===0x0){var _0x5ab2ef={'messageId':_0x11709c[_0x2a3422[0x0]][_0x41b4('0x62')]};if(!_0x78d447[_0x41b4('0x3f')]){_0x5ab2ef['read']=!![];}return _0x31a79f[_0x41b4('0x1a')](_0x5ab2ef);}else{return logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),'csc',util[_0x41b4('0x2d')](_0x11709c[_0x41b4('0x2a')],{'showHidden':![],'depth':null}));}})[_0x41b4('0x29')](function(_0xe256d0){return logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x63'),util['inspect'](_0xe256d0,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x63'),_0x41b4('0x64'));}break;case _0x41b4('0x65'):if(_0x78d447[_0x41b4('0x5a')]){var _0xd0c78b={'method':_0x41b4('0x36'),'uri':_0x41b4('0x66'),'headers':{'Authorization':_0x78d447[_0x41b4('0x5a')]},'body':{'content':_0x55ca9c[_0x41b4('0xd')],'to':[_0x55ca9c[_0x41b4('0x22')]],'from':_0x78d447[_0x41b4('0x22')],'binary':![],'clientMessageId':_0x41b4('0x67'),'charset':_0x41b4('0x68')},'json':!![]};rp(_0xd0c78b)[_0x41b4('0x19')](function(_0x503520){if(!_0x503520[_0x41b4('0x2a')]){var _0x2c7954={'messageId':_0x503520[_0x41b4('0x24')][0x0]['apiMessageId']};if(!_0x78d447[_0x41b4('0x3f')]){_0x2c7954[_0x41b4('0x3a')]=!![];}return _0x31a79f[_0x41b4('0x1a')](_0x2c7954);}else{return logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x41b4('0x2c'),_0x41b4('0x65'),util[_0x41b4('0x2d')](_0x503520['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c730a){return logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x65'),util[_0x41b4('0x2d')](_0x3c730a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x65'),_0x41b4('0x64'));}break;case _0x41b4('0x69'):if(_0x78d447['username']&&_0x78d447[_0x41b4('0x31')]){var _0x470669=util[_0x41b4('0x43')](_0x41b4('0x44'),_0x78d447['username'],_0x78d447[_0x41b4('0x31')]);var _0x5e4f30={'method':_0x41b4('0x36'),'uri':_0x41b4('0x6a')+_0x78d447[_0x41b4('0x6b')]+'/messages','body':{'to':[_0x55ca9c[_0x41b4('0x22')]],'text':_0x55ca9c[_0x41b4('0xd')],'from':_0x78d447[_0x41b4('0x22')],'applicationId':_0x78d447[_0x41b4('0x6c')]},'headers':{'Authorization':util[_0x41b4('0x43')](_0x41b4('0x45'),new Buffer(_0x470669)[_0x41b4('0x4e')](_0x41b4('0x6d')))},'json':!![]};rp(_0x5e4f30)[_0x41b4('0x19')](function(_0x256b68){if(_0x256b68['id']){var _0x4bbe0e={'messageId':_0x256b68['id']};return _0x31a79f[_0x41b4('0x1a')](_0x4bbe0e);}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),'afterCreate',_0x41b4('0x69'),util['inspect'](_0x256b68,{'showHidden':![],'depth':null}));}})[_0x41b4('0x29')](function(_0x55c53d){logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x69'),util[_0x41b4('0x2d')](_0x55c53d,{'showHidden':![],'depth':null}));});}else{logger[_0x41b4('0x2a')](_0x41b4('0x2b'),'afterCreate',_0x41b4('0x69'),_0x41b4('0x3b'));}break;case'intelepeer':if(_0x78d447[_0x41b4('0x5a')]){var _0xf4446a={};var _0xee6ff7={'method':_0x41b4('0x36'),'uri':_0x41b4('0x6e'),'headers':{'Authorization':_0x41b4('0x6f')+_0x78d447['apiKey'],'Content-Type':_0x41b4('0x53')},'body':{'from':_0x78d447[_0x41b4('0x22')],'to':_0x55ca9c['phone'],'text':_0x55ca9c['body']},'json':!![]};return rp(_0xee6ff7)[_0x41b4('0x19')](function(_0x1c649a){if(_0x1c649a[_0x41b4('0x70')]==0xca){_0xf4446a[_0x41b4('0x71')]=_0x1c649a;var _0x3be08f={'method':_0x41b4('0x36'),'uri':_0x41b4('0x72'),'headers':{'Authorization':_0x41b4('0x6f')+_0x78d447[_0x41b4('0x5a')],'Content-Type':_0x41b4('0x53')},'body':{'refid':_0xf4446a['message'][_0x41b4('0x73')]},'json':!![]};return rp(_0x3be08f)[_0x41b4('0x19')](function(_0x399f1e){_0xf4446a[_0x41b4('0x74')]=_0x399f1e;var _0x214e3b={'messageId':_0xf4446a[_0x41b4('0x71')]['refid'],'read':!![]};return _0x31a79f[_0x41b4('0x1a')](_0x214e3b);});}else{return logger[_0x41b4('0x2a')](_0x41b4('0x2b'),_0x41b4('0x2c'),_0x41b4('0x75'),util['inspect'](_0x1c649a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x12f207){return logger['error'](_0x41b4('0x2b'),_0x41b4('0x2c'),'intelepeer',util['inspect'](_0x12f207,{'showHidden':![],'depth':null}));});}else{return logger[_0x41b4('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x41b4('0x75'),_0x41b4('0x76'));}break;}}})[_0x41b4('0x77')](function(){_0xf0402e();});}else{_0xf0402e();}}},'charset':_0x41b4('0x78'),'collate':_0x41b4('0x79')});}; \ No newline at end of file +var _0xfced=['/messages','intelepeer','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','message','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','create','body','remote','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','phone','login?username=','&password=','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','messages','message_id','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','accountId'];(function(_0x1bbb30,_0x145f45){var _0x5955c2=function(_0x24ba7b){while(--_0x24ba7b){_0x1bbb30['push'](_0x1bbb30['shift']());}};_0x5955c2(++_0x145f45);}(_0xfced,0x1dc));var _0xdfce=function(_0xe07e35,_0x2a8935){_0xe07e35=_0xe07e35-0x0;var _0x2e5ae7=_0xfced[_0xe07e35];return _0x2e5ae7;};'use strict';var _=require(_0xdfce('0x0'));var util=require(_0xdfce('0x1'));var logger=require(_0xdfce('0x2'))(_0xdfce('0x3'));var moment=require(_0xdfce('0x4'));var BPromise=require(_0xdfce('0x5'));var rp=require(_0xdfce('0x6'));var fs=require('fs');var path=require(_0xdfce('0x7'));var rimraf=require('rimraf');var config=require(_0xdfce('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x5880ac,_0x563eaa){return _0x5880ac['define'](_0xdfce('0x9'),attributes,{'tableName':_0xdfce('0xa'),'paranoid':![],'indexes':[{'name':_0xdfce('0xb'),'fields':[_0xdfce('0xb')]},{'name':_0xdfce('0xc'),'fields':['body'],'type':_0xdfce('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x84510b,_0x3c53db,_0x246d97){var _0x1de9d2=_0x5880ac['models'];var _0x490f31=_0x84510b[_0xdfce('0xe')]({'plain':!![]});if(_0x490f31[_0xdfce('0xf')][_0xdfce('0x10')]()==='in'||_0x490f31[_0xdfce('0xf')][_0xdfce('0x10')]()===_0xdfce('0x11')&&!_0x490f31['secret']&&!_[_0xdfce('0x12')](_0x490f31[_0xdfce('0x13')])&&!_[_0xdfce('0x12')](_0x490f31[_0xdfce('0x14')])){_0x1de9d2['SmsInteraction'][_0xdfce('0x15')]({'where':{'id':_0x490f31['SmsInteractionId']}})[_0xdfce('0x16')](function(_0x13d5fe){if(_0x13d5fe){_0x13d5fe['update']({'lastMsgAt':_0x490f31[_0xdfce('0x17')],'lastMsgDirection':_0x490f31['direction']['toLowerCase']()});}})[_0xdfce('0x18')](function(_0x51153c){console[_0xdfce('0x19')](_0x51153c);});}if(_0x490f31[_0xdfce('0xf')]===_0xdfce('0x11')&&!_0x490f31[_0xdfce('0x1a')]){var _0x2c0e43;_0x1de9d2[_0xdfce('0x1b')][_0xdfce('0x1c')]({'where':{'id':_0x490f31[_0xdfce('0x1d')]},'raw':!![]})[_0xdfce('0x16')](function(_0x3bdf3a){_0x2c0e43=_0x3bdf3a;if(_0x2c0e43&&_0x2c0e43[_0xdfce('0x1e')]){switch(_0x2c0e43[_0xdfce('0x1e')]){case _0xdfce('0x1f'):var _0x4cbded=require('twilio');if(_0x2c0e43['accountSid']&&_0x2c0e43[_0xdfce('0x20')]&&_0x2c0e43['phone']){var _0x42f616=new _0x4cbded(_0x2c0e43['accountSid'],_0x2c0e43[_0xdfce('0x20')]);_0x42f616['messages'][_0xdfce('0x21')]({'body':_0x490f31[_0xdfce('0x22')],'to':_0x490f31['phone'],'from':_0x2c0e43['phone'],'statusCallback':_0x2c0e43[_0xdfce('0x23')]+'/api/sms/messages/'+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43[_0xdfce('0x25')]})[_0xdfce('0x16')](function(_0x42c409){if(_0x42c409[_0xdfce('0x26')]){return _0x84510b[_0xdfce('0x27')]({'messageId':_0x42c409[_0xdfce('0x26')]});}})['catch'](function(_0x24a79a){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x1f'),util[_0xdfce('0x29')](_0x24a79a,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdfce('0x2b'):var _0x2644a8=_0xdfce('0x2c');if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43[_0xdfce('0x2e')]){var _0xbd8363={'recipient':[_0x490f31['phone']],'message':_0x490f31['body'],'message_type':_0x2c0e43[_0xdfce('0x2f')]};if(_0x2c0e43[_0xdfce('0x2f')]&&_0x2c0e43[_0xdfce('0x2f')]!=='SI'){_0xbd8363[_0xdfce('0x30')]=_0x2c0e43[_0xdfce('0x31')];}var _0x496f43={'url':_0x2644a8+_0xdfce('0x32')+_0x2c0e43['username']+_0xdfce('0x33')+_0x2c0e43['password'],'method':'GET'};rp(_0x496f43)[_0xdfce('0x16')](function(_0x38b17b){var _0x4c147f=_0x38b17b['split'](';');var _0x1f93a1={'user_key':_0x4c147f[0x0],'session_key':_0x4c147f[0x1]};_0x496f43={'url':_0x2644a8+'sms','method':'POST','headers':{'user_key':_0x1f93a1['user_key'],'Session_key':_0x1f93a1[_0xdfce('0x34')]},'json':!![],'body':_0xbd8363};return rp(_0x496f43);})[_0xdfce('0x16')](function(_0x46f8f8){if(_0x46f8f8[_0xdfce('0x35')]>=0x1){var _0x54e023={'messageId':_0x46f8f8[_0xdfce('0x36')]};if(_0x2c0e43[_0xdfce('0x2f')]!=='GP'||!_0x2c0e43[_0xdfce('0x37')]){_0x54e023[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0x54e023);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x2b'),util[_0xdfce('0x29')](_0x46f8f8,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x9f9e10){return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x2b'),util[_0xdfce('0x29')](_0x9f9e10,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x2b'),_0xdfce('0x39'));}break;case'connectel':if(_0x2c0e43[_0xdfce('0x20')]){var _0x15deeb={'recipient':_0x490f31[_0xdfce('0x31')],'message':_0x490f31['body'],'sender':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')],'authorization':_0x2c0e43[_0xdfce('0x20')]};var _0x3c53db={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x3c'),'body':_0x15deeb,'json':!![]};rp(_0x3c53db)[_0xdfce('0x16')](function(_0x3d7607){var _0x50aaa3={'messageId':_0x3d7607['requestid']};if(!_0x2c0e43[_0xdfce('0x37')]){_0x50aaa3['read']=!![];}return _0x84510b[_0xdfce('0x27')](_0x50aaa3);})[_0xdfce('0x18')](function(_0x385dd0){logger['error'](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x3d'),util[_0xdfce('0x29')](_0x385dd0,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x3d'),_0xdfce('0x3e'));}break;case'clicksend':if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43['password']){var _0x15deeb={'messages':[{'source':_0xdfce('0x3f'),'to':_0x490f31[_0xdfce('0x31')],'body':_0x490f31[_0xdfce('0x22')],'from':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')]}]};var _0x56a391=util[_0xdfce('0x40')](_0xdfce('0x41'),_0x2c0e43[_0xdfce('0x2d')],_0x2c0e43[_0xdfce('0x2e')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x42'),'body':_0x15deeb,'headers':{'Authorization':util[_0xdfce('0x40')](_0xdfce('0x43'),new Buffer(_0x56a391)[_0xdfce('0x44')]('base64'))},'json':!![]};rp(_0x3c53db)['then'](function(_0x56f085){if(_0x56f085['http_code']>=0xc8&&_0x56f085[_0xdfce('0x45')]<=0xce){if(_0x56f085['data']&&_0x56f085[_0xdfce('0x46')]['queued_count']>0x0){var _0x1c09aa=_['head'](_0x56f085[_0xdfce('0x46')][_0xdfce('0x47')]);var _0xe974ef={'messageId':_0x1c09aa[_0xdfce('0x48')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0xe974ef[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0xe974ef);}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x49'),util['inspect'](_0x56f085,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xdfce('0x28'),'afterCreate','clickSend',util[_0xdfce('0x29')](_0x56f085,{'showHidden':![],'depth':null}));}})['catch'](function(_0x21fefd){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','clickSend',util['inspect'](_0x21fefd,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),_0xdfce('0x49'),_0xdfce('0x39'));}break;case _0xdfce('0x4a'):if(_0x2c0e43[_0xdfce('0x4b')]&&_0x2c0e43[_0xdfce('0x20')]){var _0x15deeb={'dst':_0x490f31[_0xdfce('0x31')],'text':_0x490f31[_0xdfce('0x22')],'src':_0x2c0e43[_0xdfce('0x3a')]||_0x2c0e43[_0xdfce('0x31')],'url':_0x2c0e43[_0xdfce('0x23')]+_0xdfce('0x4c')+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43[_0xdfce('0x25')]};var _0x56a391=util[_0xdfce('0x40')]('%s:%s',_0x2c0e43[_0xdfce('0x4b')],_0x2c0e43[_0xdfce('0x20')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':util[_0xdfce('0x40')](_0xdfce('0x4d'),_0x2c0e43[_0xdfce('0x4b')]),'body':_0x15deeb,'headers':{'Authorization':util[_0xdfce('0x40')](_0xdfce('0x43'),new Buffer(_0x56a391)[_0xdfce('0x44')](_0xdfce('0x4e')))},'json':!![]};rp(_0x3c53db)['then'](function(_0x1535be){var _0x147435={'messageId':_0x1535be['message_uuid'][0x0]};return _0x84510b[_0xdfce('0x27')](_0x147435);})[_0xdfce('0x18')](function(_0x4361ca){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x4a'),util['inspect'](_0x4361ca,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),_0xdfce('0x4a'),_0xdfce('0x4f'));}break;case _0xdfce('0x50'):if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43[_0xdfce('0x2e')]){if(_0x2c0e43['baseUrl']){var _0x5e8f5a={'method':_0xdfce('0x3b'),'uri':_0x2c0e43[_0xdfce('0x51')]+_0xdfce('0x52'),'body':{'username':_0x2c0e43[_0xdfce('0x2d')],'password':_0x2c0e43[_0xdfce('0x2e')]},'json':!![]};return rp(_0x5e8f5a)[_0xdfce('0x16')](function(_0x39aba8){var _0x2603fb={'method':_0xdfce('0x3b'),'uri':_0x2c0e43[_0xdfce('0x51')]+_0xdfce('0x53'),'body':{'messages':[{'from':_0x2c0e43['phone'],'destinations':[{'to':_0x490f31[_0xdfce('0x31')]}],'text':_0x490f31[_0xdfce('0x22')],'notifyUrl':_0x2c0e43[_0xdfce('0x23')]+_0xdfce('0x4c')+_0x490f31['id']+_0xdfce('0x24')+_0x2c0e43['token'],'notifyContentType':'application/json','callbackData':_0x2c0e43[_0xdfce('0x31')]+';'+_0x490f31['body']}]},'headers':{'Authorization':_0xdfce('0x54')+_0x39aba8[_0xdfce('0x25')]},'json':!![]};return rp(_0x2603fb)[_0xdfce('0x16')](function(_0x30aa4a){if(_0x30aa4a['messages']){var _0x416ee4={'messageId':_0x30aa4a[_0xdfce('0x47')][0x0][_0xdfce('0xb')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0x416ee4[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0x416ee4);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','infobip',util[_0xdfce('0x29')](_0x30aa4a,{'showHidden':![],'depth':null}));}});})[_0xdfce('0x18')](function(_0x4383a7){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x50'),util[_0xdfce('0x29')](_0x4383a7,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x50'),_0xdfce('0x55'));}}else{logger['error'](_0xdfce('0x28'),_0xdfce('0x2a'),'infobip',_0xdfce('0x39'));}break;case _0xdfce('0x56'):var _0x44fbd1=require(_0xdfce('0x57'));if(_0x2c0e43[_0xdfce('0x58')]){var _0x5c5ea5={};_0x5c5ea5[_0xdfce('0x59')]=_0x2c0e43[_0xdfce('0x2d')];_0x5c5ea5[_0xdfce('0x31')]=_0x490f31[_0xdfce('0x31')];_0x5c5ea5[_0xdfce('0x30')]=_0x2c0e43[_0xdfce('0x31')];_0x5c5ea5['text']=_0x490f31['body'];_0x5c5ea5[_0xdfce('0x5a')]=+new Date();var _0x298d75='';var _0x4e84d4='';var _0x316db9=Object[_0xdfce('0x5b')](_0x5c5ea5);_0x316db9[_0xdfce('0x5c')]();for(var _0x8abf53=0x0;_0x8abf53<_0x316db9['length'];_0x8abf53++){if(_0x298d75!=''){_0x298d75+='&';}_0x298d75+=_0x316db9[_0x8abf53]+'='+encodeURIComponent(_0x5c5ea5[_0x316db9[_0x8abf53]]);_0x4e84d4+=_0x5c5ea5[_0x316db9[_0x8abf53]];}_0x4e84d4+=_0x2c0e43['apiKey'];_0x4e84d4=_0x44fbd1[_0xdfce('0x5d')]('md5')['update'](_0x4e84d4)['digest'](_0xdfce('0x5e'));if(_0x298d75!==''){_0x298d75+='&';}_0x298d75+='signature='+_0x4e84d4;var _0x496f43={'method':'GET','uri':_0x2c0e43['baseUrl']+_0xdfce('0x5f')+_0x298d75,'json':!![]};return rp(_0x496f43)['then'](function(_0x55d4c8){var _0x31e2db=Object[_0xdfce('0x5b')](_0x55d4c8);if(_0x55d4c8[_0x31e2db[0x0]]['error']&&parseInt(_0x55d4c8[_0x31e2db[0x0]][_0xdfce('0x19')])===0x0){var _0x390c00={'messageId':_0x55d4c8[_0x31e2db[0x0]][_0xdfce('0x60')]};if(!_0x2c0e43[_0xdfce('0x37')]){_0x390c00[_0xdfce('0x38')]=!![];}return _0x84510b['update'](_0x390c00);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate','csc',util[_0xdfce('0x29')](_0x55d4c8[_0xdfce('0x19')],{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x98e185){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'csc',util['inspect'](_0x98e185,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x56'),_0xdfce('0x61'));}break;case _0xdfce('0x62'):if(_0x2c0e43['apiKey']){var _0x25cecc={'method':_0xdfce('0x3b'),'uri':_0xdfce('0x63'),'headers':{'Authorization':_0x2c0e43['apiKey']},'body':{'content':_0x490f31[_0xdfce('0x22')],'to':[_0x490f31[_0xdfce('0x31')]],'from':_0x2c0e43[_0xdfce('0x31')],'binary':![],'clientMessageId':'uuid','charset':_0xdfce('0x64')},'json':!![]};rp(_0x25cecc)[_0xdfce('0x16')](function(_0x5a3ec3){if(!_0x5a3ec3[_0xdfce('0x19')]){var _0xe54935={'messageId':_0x5a3ec3['messages'][0x0][_0xdfce('0x65')]};if(!_0x2c0e43['deliveryReport']){_0xe54935[_0xdfce('0x38')]=!![];}return _0x84510b[_0xdfce('0x27')](_0xe54935);}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'clickatell',util[_0xdfce('0x29')](_0x5a3ec3[_0xdfce('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3c98d9){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x62'),util['inspect'](_0x3c98d9,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x62'),_0xdfce('0x61'));}break;case _0xdfce('0x66'):if(_0x2c0e43[_0xdfce('0x2d')]&&_0x2c0e43['password']){var _0x56a391=util[_0xdfce('0x40')](_0xdfce('0x41'),_0x2c0e43['username'],_0x2c0e43[_0xdfce('0x2e')]);var _0x3c53db={'method':_0xdfce('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2c0e43[_0xdfce('0x67')]+_0xdfce('0x68'),'body':{'to':[_0x490f31[_0xdfce('0x31')]],'text':_0x490f31[_0xdfce('0x22')],'from':_0x2c0e43['phone'],'applicationId':_0x2c0e43['applicationId']},'headers':{'Authorization':util[_0xdfce('0x40')]('Basic\x20%s',new Buffer(_0x56a391)[_0xdfce('0x44')](_0xdfce('0x4e')))},'json':!![]};rp(_0x3c53db)[_0xdfce('0x16')](function(_0x4ab8f8){if(_0x4ab8f8['id']){var _0x2e5d1b={'messageId':_0x4ab8f8['id']};return _0x84510b['update'](_0x2e5d1b);}else{logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x66'),util[_0xdfce('0x29')](_0x4ab8f8,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x3ee20f){logger[_0xdfce('0x19')](_0xdfce('0x28'),'afterCreate',_0xdfce('0x66'),util[_0xdfce('0x29')](_0x3ee20f,{'showHidden':![],'depth':null}));});}else{logger[_0xdfce('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdfce('0x2a'),'bandwidth',_0xdfce('0x39'));}break;case _0xdfce('0x69'):if(_0x2c0e43['apiKey']){var _0x51ebf0={};var _0x496f43={'method':_0xdfce('0x3b'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2c0e43[_0xdfce('0x58')],'Content-Type':_0xdfce('0x6a')},'body':{'from':_0x2c0e43['phone'],'to':_0x490f31[_0xdfce('0x31')],'text':_0x490f31['body']},'json':!![]};return rp(_0x496f43)[_0xdfce('0x16')](function(_0x1b5fd2){if(_0x1b5fd2[_0xdfce('0x6b')]==0xca){_0x51ebf0['message']=_0x1b5fd2;var _0x1ccdec={'method':'POST','uri':_0xdfce('0x6c'),'headers':{'Authorization':_0xdfce('0x6d')+_0x2c0e43['apiKey'],'Content-Type':_0xdfce('0x6a')},'body':{'refid':_0x51ebf0['message'][_0xdfce('0x6e')]},'json':!![]};return rp(_0x1ccdec)['then'](function(_0x34a08c){_0x51ebf0[_0xdfce('0x6f')]=_0x34a08c;var _0x36a608={'messageId':_0x51ebf0[_0xdfce('0x70')]['refid'],'read':!![]};return _0x84510b[_0xdfce('0x27')](_0x36a608);});}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),'intelepeer',util[_0xdfce('0x29')](_0x1b5fd2,{'showHidden':![],'depth':null}));}})[_0xdfce('0x18')](function(_0x5112d5){return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x69'),util['inspect'](_0x5112d5,{'showHidden':![],'depth':null}));});}else{return logger[_0xdfce('0x19')](_0xdfce('0x28'),_0xdfce('0x2a'),_0xdfce('0x69'),_0xdfce('0x71'));}break;}}})[_0xdfce('0x72')](function(){_0x246d97();});}else{_0x246d97();}}},'charset':_0xdfce('0x73'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e3267f2..ce41e6f 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 _0x95ab=['error','code','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','request\x20sent','debug','stringify'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x95ab,0x1e9));var _0xb95a=function(_0x4101f4,_0x33aeed){_0x4101f4=_0x4101f4-0x0;var _0x3c07a5=_0x95ab[_0x4101f4];return _0x3c07a5;};'use strict';var _=require(_0xb95a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb95a('0x1'));var rs=require(_0xb95a('0x2'));var fs=require('fs');var Redis=require(_0xb95a('0x3'));var db=require(_0xb95a('0x4'))['db'];var utils=require(_0xb95a('0x5'));var logger=require(_0xb95a('0x6'))(_0xb95a('0x7'));var config=require(_0xb95a('0x8'));var jayson=require(_0xb95a('0x9'));var client=jayson[_0xb95a('0xa')][_0xb95a('0xb')]({'port':0x232a});config[_0xb95a('0xc')]=_[_0xb95a('0xd')](config[_0xb95a('0xc')],{'host':_0xb95a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb95a('0xf'))[_0xb95a('0x10')](socket);function respondWithRpcPromise(_0x5e5c70,_0xbfad2e,_0xcef509){return new BPromise(function(_0x4f00cc,_0x4c26f2){return client['request'](_0x5e5c70,_0xcef509)[_0xb95a('0x11')](function(_0x48b42a){logger['info']('SmsMessage,\x20%s,\x20%s',_0xbfad2e,_0xb95a('0x12'));logger[_0xb95a('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbfad2e,_0xb95a('0x12'),JSON[_0xb95a('0x14')](_0x48b42a));if(_0x48b42a[_0xb95a('0x15')]){if(_0x48b42a[_0xb95a('0x15')][_0xb95a('0x16')]===0x1f4){logger[_0xb95a('0x15')](_0xb95a('0x17'),_0xbfad2e,_0x48b42a[_0xb95a('0x15')][_0xb95a('0x18')]);return _0x4c26f2(_0x48b42a[_0xb95a('0x15')]['message']);}logger[_0xb95a('0x15')]('SmsMessage,\x20%s,\x20%s',_0xbfad2e,_0x48b42a['error'][_0xb95a('0x18')]);return _0x4f00cc(_0x48b42a[_0xb95a('0x15')][_0xb95a('0x18')]);}else{logger[_0xb95a('0x19')](_0xb95a('0x17'),_0xbfad2e,_0xb95a('0x12'));_0x4f00cc(_0x48b42a[_0xb95a('0x1a')][_0xb95a('0x18')]);}})[_0xb95a('0x1b')](function(_0x5c48aa){logger[_0xb95a('0x15')](_0xb95a('0x17'),_0xbfad2e,_0x5c48aa);_0x4c26f2(_0x5c48aa);});});}exports[_0xb95a('0x1c')]=function(_0x358a99){var _0x4694b8=this;return new Promise(function(_0x2f050e,_0x5139df){return db[_0xb95a('0x1d')][_0xb95a('0x1e')](_0x358a99[_0xb95a('0x1f')],{'raw':_0x358a99['options']?_0x358a99[_0xb95a('0x20')][_0xb95a('0x21')]===undefined?!![]:![]:!![]})[_0xb95a('0x11')](function(_0x45a2e8){logger[_0xb95a('0x19')](_0xb95a('0x1c'),_0x358a99);logger['debug'](_0xb95a('0x1c'),_0x358a99,JSON[_0xb95a('0x14')](_0x45a2e8));_0x2f050e(_0x45a2e8);})['catch'](function(_0x30d1bb){logger[_0xb95a('0x15')]('CreateSmsMessage',_0x30d1bb[_0xb95a('0x18')],_0x358a99);_0x5139df(_0x4694b8[_0xb95a('0x15')](0x1f4,_0x30d1bb[_0xb95a('0x18')]));});});}; \ No newline at end of file +var _0x9417=['./smsMessage.socket','register','request','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9417,0x1f3));var _0x7941=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x9417[_0x5c7525];return _0x2e2ec8;};'use strict';var _=require('lodash');var util=require(_0x7941('0x0'));var moment=require(_0x7941('0x1'));var BPromise=require(_0x7941('0x2'));var rs=require(_0x7941('0x3'));var fs=require('fs');var Redis=require(_0x7941('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7941('0x5'));var logger=require(_0x7941('0x6'))(_0x7941('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7941('0x8')][_0x7941('0x9')]({'port':0x232a});config[_0x7941('0xa')]=_[_0x7941('0xb')](config[_0x7941('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7941('0xc'))(new Redis(config[_0x7941('0xa')]));require(_0x7941('0xd'))[_0x7941('0xe')](socket);function respondWithRpcPromise(_0x2c3414,_0x35dc56,_0x5948dc){return new BPromise(function(_0x1de5a9,_0x3e7739){return client[_0x7941('0xf')](_0x2c3414,_0x5948dc)['then'](function(_0x478a87){logger['info']('SmsMessage,\x20%s,\x20%s',_0x35dc56,_0x7941('0x10'));logger[_0x7941('0x11')](_0x7941('0x12'),_0x35dc56,_0x7941('0x10'),JSON[_0x7941('0x13')](_0x478a87));if(_0x478a87[_0x7941('0x14')]){if(_0x478a87['error']['code']===0x1f4){logger['error'](_0x7941('0x15'),_0x35dc56,_0x478a87[_0x7941('0x14')][_0x7941('0x16')]);return _0x3e7739(_0x478a87[_0x7941('0x14')]['message']);}logger[_0x7941('0x14')](_0x7941('0x15'),_0x35dc56,_0x478a87[_0x7941('0x14')][_0x7941('0x16')]);return _0x1de5a9(_0x478a87[_0x7941('0x14')]['message']);}else{logger[_0x7941('0x17')](_0x7941('0x15'),_0x35dc56,_0x7941('0x10'));_0x1de5a9(_0x478a87[_0x7941('0x18')][_0x7941('0x16')]);}})[_0x7941('0x19')](function(_0x21f7dd){logger[_0x7941('0x14')]('SmsMessage,\x20%s,\x20%s',_0x35dc56,_0x21f7dd);_0x3e7739(_0x21f7dd);});});}exports[_0x7941('0x1a')]=function(_0xb402b5){var _0x434b7a=this;return new Promise(function(_0x4c4fa0,_0x1b2791){return db[_0x7941('0x1b')][_0x7941('0x1c')](_0xb402b5['body'],{'raw':_0xb402b5[_0x7941('0x1d')]?_0xb402b5[_0x7941('0x1d')][_0x7941('0x1e')]===undefined?!![]:![]:!![]})[_0x7941('0x1f')](function(_0x1ff6e1){logger[_0x7941('0x17')](_0x7941('0x1a'),_0xb402b5);logger[_0x7941('0x11')]('CreateSmsMessage',_0xb402b5,JSON[_0x7941('0x13')](_0x1ff6e1));_0x4c4fa0(_0x1ff6e1);})[_0x7941('0x19')](function(_0x30fa77){logger['error'](_0x7941('0x1a'),_0x30fa77[_0x7941('0x16')],_0xb402b5);_0x1b2791(_0x434b7a[_0x7941('0x14')](0x1f4,_0x30fa77[_0x7941('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8ba799b..fd8ff2b 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 _0x6ade=['smsMessage:','save','update','removeListener','length'];(function(_0x228b2d,_0x17a0da){var _0x421356=function(_0x317d17){while(--_0x317d17){_0x228b2d['push'](_0x228b2d['shift']());}};_0x421356(++_0x17a0da);}(_0x6ade,0x187));var _0xe6ad=function(_0x683914,_0x58098f){_0x683914=_0x683914-0x0;var _0x186574=_0x6ade[_0x683914];return _0x186574;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xe6ad('0x0'),'remove',_0xe6ad('0x1')];function createListener(_0x1f1591,_0x48e726){return function(_0x2da474){_0x48e726['emit'](_0x1f1591,_0x2da474);};}function removeListener(_0x1f1aa9,_0x558a54){return function(){SmsMessageEvents[_0xe6ad('0x2')](_0x1f1aa9,_0x558a54);};}exports['register']=function(_0x53eabb){for(var _0x54c885=0x0,_0x2d667e=events[_0xe6ad('0x3')];_0x54c885<_0x2d667e;_0x54c885++){var _0x3c83c7=events[_0x54c885];var _0x4eb618=createListener(_0xe6ad('0x4')+_0x3c83c7,_0x53eabb);SmsMessageEvents['on'](_0x3c83c7,_0x4eb618);}}; \ No newline at end of file +var _0x5814=['emit','register','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x5814,0xc1));var _0x4581=function(_0x41d773,_0x123757){_0x41d773=_0x41d773-0x0;var _0x3537b2=_0x5814[_0x41d773];return _0x3537b2;};'use strict';var SmsMessageEvents=require(_0x4581('0x0'));var events=[_0x4581('0x1'),'remove',_0x4581('0x2')];function createListener(_0x160da9,_0x392c9b){return function(_0x3a0ae1){_0x392c9b[_0x4581('0x3')](_0x160da9,_0x3a0ae1);};}function removeListener(_0x4ba910,_0x5cfa51){return function(){SmsMessageEvents['removeListener'](_0x4ba910,_0x5cfa51);};}exports[_0x4581('0x4')]=function(_0x49cabb){for(var _0x4fb15a=0x0,_0x49b2d6=events[_0x4581('0x5')];_0x4fb15a<_0x49b2d6;_0x4fb15a++){var _0x2cf524=events[_0x4fb15a];var _0x4d592f=createListener(_0x4581('0x6')+_0x2cf524,_0x49cabb);SmsMessageEvents['on'](_0x2cf524,_0x4d592f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b5934df..2fe6871 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 _0x113e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','/:id','destroy','delete','removeTeams','removeAgents'];(function(_0x23a006,_0x4d32ec){var _0x1457f6=function(_0x4892ff){while(--_0x4892ff){_0x23a006['push'](_0x23a006['shift']());}};_0x1457f6(++_0x4d32ec);}(_0x113e,0x1c3));var _0xe113=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x113e[_0x58e469];return _0x4c01c5;};'use strict';var multer=require('multer');var util=require(_0xe113('0x0'));var path=require(_0xe113('0x1'));var timeout=require(_0xe113('0x2'));var express=require(_0xe113('0x3'));var router=express[_0xe113('0x4')]();var fs_extra=require(_0xe113('0x5'));var auth=require(_0xe113('0x6'));var interaction=require(_0xe113('0x7'));var config=require('../../config/environment');var controller=require(_0xe113('0x8'));router[_0xe113('0x9')]('/',auth[_0xe113('0xa')](),controller[_0xe113('0xb')]);router['get'](_0xe113('0xc'),auth['isAuthenticated'](),controller[_0xe113('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe113('0xe')]);router[_0xe113('0x9')](_0xe113('0xf'),auth['isAuthenticated'](),controller[_0xe113('0x10')]);router[_0xe113('0x9')](_0xe113('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xe113('0x9')](_0xe113('0x12'),auth[_0xe113('0xa')](),controller[_0xe113('0x13')]);router[_0xe113('0x14')]('/',auth['isAuthenticated'](),controller[_0xe113('0x15')]);router['post'](_0xe113('0x11'),auth['isAuthenticated'](),controller[_0xe113('0x16')]);router[_0xe113('0x14')](_0xe113('0x12'),auth[_0xe113('0xa')](),controller['addAgents']);router[_0xe113('0x17')](_0xe113('0x18'),auth[_0xe113('0xa')](),controller['update']);router['delete']('/:id',auth[_0xe113('0xa')](),controller[_0xe113('0x19')]);router[_0xe113('0x1a')](_0xe113('0x11'),auth[_0xe113('0xa')](),controller[_0xe113('0x1b')]);router[_0xe113('0x1a')](_0xe113('0x12'),auth[_0xe113('0xa')](),controller[_0xe113('0x1c')]);module[_0xe113('0x1d')]=router; \ No newline at end of file +var _0xe233=['multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','exports'];(function(_0x55b04f,_0x59ef35){var _0x2de1a1=function(_0x4c0c3e){while(--_0x4c0c3e){_0x55b04f['push'](_0x55b04f['shift']());}};_0x2de1a1(++_0x59ef35);}(_0xe233,0x1e6));var _0x3e23=function(_0xee76bb,_0x583e9b){_0xee76bb=_0xee76bb-0x0;var _0x35a5c1=_0xe233[_0xee76bb];return _0x35a5c1;};'use strict';var multer=require(_0x3e23('0x0'));var util=require('util');var path=require(_0x3e23('0x1'));var timeout=require(_0x3e23('0x2'));var express=require(_0x3e23('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3e23('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3e23('0x5'));var controller=require(_0x3e23('0x6'));router[_0x3e23('0x7')]('/',auth[_0x3e23('0x8')](),controller[_0x3e23('0x9')]);router[_0x3e23('0x7')](_0x3e23('0xa'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xb')]);router['get'](_0x3e23('0xc'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xd')]);router[_0x3e23('0x7')](_0x3e23('0xe'),auth[_0x3e23('0x8')](),controller[_0x3e23('0xf')]);router[_0x3e23('0x7')](_0x3e23('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3e23('0x7')](_0x3e23('0x11'),auth['isAuthenticated'](),controller[_0x3e23('0x12')]);router[_0x3e23('0x13')]('/',auth[_0x3e23('0x8')](),controller[_0x3e23('0x14')]);router[_0x3e23('0x13')](_0x3e23('0x10'),auth[_0x3e23('0x8')](),controller[_0x3e23('0x15')]);router[_0x3e23('0x13')](_0x3e23('0x11'),auth['isAuthenticated'](),controller[_0x3e23('0x16')]);router[_0x3e23('0x17')]('/:id',auth[_0x3e23('0x8')](),controller['update']);router[_0x3e23('0x18')](_0x3e23('0xc'),auth['isAuthenticated'](),controller[_0x3e23('0x19')]);router['delete'](_0x3e23('0x10'),auth[_0x3e23('0x8')](),controller['removeTeams']);router[_0x3e23('0x18')](_0x3e23('0x11'),auth[_0x3e23('0x8')](),controller['removeAgents']);module[_0x3e23('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f4d19ba..f9232bc 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 _0x42aa=['beepall','roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory'];(function(_0x5b7a45,_0x4dec72){var _0x44ba91=function(_0x4e40fc){while(--_0x4e40fc){_0x5b7a45['push'](_0x5b7a45['shift']());}};_0x44ba91(++_0x4dec72);}(_0x42aa,0x19f));var _0xa42a=function(_0x5243c9,_0x3d5d5a){_0x5243c9=_0x5243c9-0x0;var _0x50d161=_0x42aa[_0x5243c9];return _0x50d161;};'use strict';var Sequelize=require(_0xa42a('0x0'));module['exports']={'name':{'type':Sequelize[_0xa42a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa42a('0x1')]},'timeout':{'type':Sequelize[_0xa42a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa42a('0x3')](_0xa42a('0x4'),_0xa42a('0x5'),_0xa42a('0x6'))}}; \ No newline at end of file +var _0x0bc2=['exports','STRING','ENUM','beepall','sequelize'];(function(_0x432d70,_0x19592b){var _0x2d35d6=function(_0x1610a4){while(--_0x1610a4){_0x432d70['push'](_0x432d70['shift']());}};_0x2d35d6(++_0x19592b);}(_0x0bc2,0x158));var _0x20bc=function(_0x3dfb0a,_0x4160a1){_0x3dfb0a=_0x3dfb0a-0x0;var _0x507eda=_0x0bc2[_0x3dfb0a];return _0x507eda;};'use strict';var Sequelize=require(_0x20bc('0x0'));module[_0x20bc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x20bc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20bc('0x3')]('rrmemory',_0x20bc('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index a519c4c..af93e00 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 _0xd23f=['sox','ejs','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','get','SmsQueues','UserProfileResource','destroy','then','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','findOne','UserSmsQueue','filters','SmsQueueId','User','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','transaction','findOrCreate','forEach','removeTeams','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','includes','all','union','compact','value','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','removeAgents','isArray','emit','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x52cf0c,_0x482d4f){var _0x41dd14=function(_0x441952){while(--_0x441952){_0x52cf0c['push'](_0x52cf0c['shift']());}};_0x41dd14(++_0x482d4f);}(_0xd23f,0x83));var _0xfd23=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xd23f[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfd23('0x0'));var jsonpatch=require(_0xfd23('0x1'));var rp=require(_0xfd23('0x2'));var moment=require(_0xfd23('0x3'));var BPromise=require(_0xfd23('0x4'));var Mustache=require('mustache');var util=require(_0xfd23('0x5'));var path=require(_0xfd23('0x6'));var sox=require(_0xfd23('0x7'));var csv=require('to-csv');var ejs=require(_0xfd23('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd23('0x9'));var squel=require(_0xfd23('0xa'));var crypto=require('crypto');var jsforce=require(_0xfd23('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfd23('0xc'));var querystring=require('querystring');var Papa=require(_0xfd23('0xd'));var Redis=require(_0xfd23('0xe'));var authService=require(_0xfd23('0xf'));var qs=require(_0xfd23('0x10'));var as=require(_0xfd23('0x11'));var hardwareService=require(_0xfd23('0x12'));var logger=require(_0xfd23('0x13'))('api');var utils=require(_0xfd23('0x14'));var config=require(_0xfd23('0x15'));var licenseUtil=require(_0xfd23('0x16'));var db=require(_0xfd23('0x17'))['db'];config[_0xfd23('0x18')]=_[_0xfd23('0x19')](config['redis'],{'host':_0xfd23('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfd23('0x1b'))[_0xfd23('0x1c')](socket);function respondWithStatusCode(_0x27ae42,_0x16ea1d){_0x16ea1d=_0x16ea1d||0xcc;return function(_0x2772fc){if(_0x2772fc){return _0x27ae42[_0xfd23('0x1d')](_0x16ea1d);}return _0x27ae42[_0xfd23('0x1e')](_0x16ea1d)[_0xfd23('0x1f')]();};}function respondWithResult(_0x213818,_0x4f1f98){_0x4f1f98=_0x4f1f98||0xc8;return function(_0x2b0e6c){if(_0x2b0e6c){return _0x213818[_0xfd23('0x1e')](_0x4f1f98)[_0xfd23('0x20')](_0x2b0e6c);}};}function respondWithFilteredResult(_0x22b9be,_0x3b344b){return function(_0x40dd05){if(_0x40dd05){var _0x51ec30=typeof _0x3b344b['offset']===_0xfd23('0x21')&&typeof _0x3b344b['limit']===_0xfd23('0x21');var _0x8c2140=_0x40dd05[_0xfd23('0x22')];var _0xdcc85c=_0x51ec30?0x0:_0x3b344b[_0xfd23('0x23')];var _0x387c7e=_0x51ec30?_0x40dd05[_0xfd23('0x22')]:_0x3b344b[_0xfd23('0x23')]+_0x3b344b[_0xfd23('0x24')];var _0x396900;if(_0x387c7e>=_0x8c2140){_0x387c7e=_0x8c2140;_0x396900=0xc8;}else{_0x396900=0xce;}_0x22b9be[_0xfd23('0x1e')](_0x396900);return _0x22b9be[_0xfd23('0x25')](_0xfd23('0x26'),_0xdcc85c+'-'+_0x387c7e+'/'+_0x8c2140)[_0xfd23('0x20')](_0x40dd05);}return null;};}function patchUpdates(_0x25848b){return function(_0x39fa1e){try{jsonpatch[_0xfd23('0x27')](_0x39fa1e,_0x25848b,!![]);}catch(_0x103848){return BPromise[_0xfd23('0x28')](_0x103848);}return _0x39fa1e[_0xfd23('0x29')]();};}function saveUpdates(_0xbb7934,_0x5dc512){return function(_0x2e8cf2){if(_0x2e8cf2){return _0x2e8cf2[_0xfd23('0x2a')](_0xbb7934)['then'](function(_0x53e476){return _0x53e476;});}return null;};}function removeEntity(_0x27917c,_0x2d306d){return function(_0x3541e1){if(_0x3541e1){return _0x3541e1['destroy']()['then'](function(){var _0x43b16f=_0x3541e1[_0xfd23('0x2b')]({'plain':!![]});var _0x2ae416=_0xfd23('0x2c');return db[_0xfd23('0x2d')][_0xfd23('0x2e')]({'where':{'type':_0x2ae416,'resourceId':_0x43b16f['id']}})[_0xfd23('0x2f')](function(){return _0x3541e1;});})[_0xfd23('0x2f')](function(){_0x27917c[_0xfd23('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462d48,_0x11cfd6){return function(_0x2819d1){if(!_0x2819d1){_0x462d48[_0xfd23('0x1d')](0x194);}return _0x2819d1;};}function handleError(_0x32b7e9,_0x482880){_0x482880=_0x482880||0x1f4;return function(_0x375288){logger[_0xfd23('0x30')](_0x375288[_0xfd23('0x31')]);if(_0x375288[_0xfd23('0x32')]){delete _0x375288['name'];}_0x32b7e9[_0xfd23('0x1e')](_0x482880)[_0xfd23('0x33')](_0x375288);};}exports[_0xfd23('0x34')]=function(_0x5580d0,_0x263983){var _0x259615={},_0x2175bd={},_0x40e1a6={'count':0x0,'rows':[]};var _0x5e231f=_['map'](db[_0xfd23('0x35')][_0xfd23('0x36')],function(_0x13ceef){return{'name':_0x13ceef[_0xfd23('0x37')],'type':_0x13ceef[_0xfd23('0x38')]['key']};});_0x2175bd[_0xfd23('0x39')]=_['map'](_0x5e231f,_0xfd23('0x32'));_0x2175bd[_0xfd23('0x3a')]=_[_0xfd23('0x3b')](_0x5580d0[_0xfd23('0x3a')]);_0x2175bd['filters']=_[_0xfd23('0x3c')](_0x2175bd['model'],_0x2175bd[_0xfd23('0x3a')]);_0x259615[_0xfd23('0x3d')]=_[_0xfd23('0x3c')](_0x2175bd['model'],qs['fields'](_0x5580d0['query'][_0xfd23('0x3e')]));_0x259615['attributes']=_0x259615[_0xfd23('0x3d')][_0xfd23('0x3f')]?_0x259615[_0xfd23('0x3d')]:_0x2175bd['model'];if(!_0x5580d0[_0xfd23('0x3a')][_0xfd23('0x40')](_0xfd23('0x41'))){_0x259615['limit']=qs[_0xfd23('0x24')](_0x5580d0[_0xfd23('0x3a')]['limit']);_0x259615[_0xfd23('0x23')]=qs[_0xfd23('0x23')](_0x5580d0['query'][_0xfd23('0x23')]);}_0x259615[_0xfd23('0x42')]=qs['sort'](_0x5580d0['query'][_0xfd23('0x43')]);_0x259615[_0xfd23('0x44')]=qs['filters'](_[_0xfd23('0x45')](_0x5580d0[_0xfd23('0x3a')],_0x2175bd['filters']),_0x5e231f);if(_0x5580d0[_0xfd23('0x3a')][_0xfd23('0x46')]){_0x259615[_0xfd23('0x44')]=_[_0xfd23('0x47')](_0x259615[_0xfd23('0x44')],{'$or':_[_0xfd23('0x48')](_0x5e231f,function(_0x55a4e6){if(_0x55a4e6[_0xfd23('0x38')]!=='VIRTUAL'){var _0x2b8071={};_0x2b8071[_0x55a4e6[_0xfd23('0x32')]]={'$like':'%'+_0x5580d0['query']['filter']+'%'};return _0x2b8071;}})});}_0x259615=_[_0xfd23('0x47')]({},_0x259615,_0x5580d0[_0xfd23('0x49')]);var _0x2c2492={'where':_0x259615[_0xfd23('0x44')]};return db['SmsQueue'][_0xfd23('0x22')](_0x2c2492)[_0xfd23('0x2f')](function(_0x3551a3){_0x40e1a6[_0xfd23('0x22')]=_0x3551a3;if(_0x5580d0[_0xfd23('0x3a')][_0xfd23('0x4a')]){_0x259615[_0xfd23('0x4b')]=[{'all':!![]}];}return db[_0xfd23('0x35')][_0xfd23('0x4c')](_0x259615);})[_0xfd23('0x2f')](function(_0x3c32b3){_0x40e1a6[_0xfd23('0x4d')]=_0x3c32b3;return _0x40e1a6;})[_0xfd23('0x2f')](respondWithFilteredResult(_0x263983,_0x259615))[_0xfd23('0x4e')](handleError(_0x263983,null));};exports[_0xfd23('0x4f')]=function(_0x2be6f9,_0x3df382){var _0x37f14b={'raw':!![],'where':{'id':_0x2be6f9[_0xfd23('0x50')]['id']}},_0x469067={};_0x469067[_0xfd23('0x39')]=_[_0xfd23('0x3b')](db[_0xfd23('0x35')][_0xfd23('0x36')]);_0x469067[_0xfd23('0x3a')]=_[_0xfd23('0x3b')](_0x2be6f9[_0xfd23('0x3a')]);_0x469067['filters']=_[_0xfd23('0x3c')](_0x469067['model'],_0x469067[_0xfd23('0x3a')]);_0x37f14b[_0xfd23('0x3d')]=_[_0xfd23('0x3c')](_0x469067[_0xfd23('0x39')],qs['fields'](_0x2be6f9[_0xfd23('0x3a')]['fields']));_0x37f14b[_0xfd23('0x3d')]=_0x37f14b[_0xfd23('0x3d')][_0xfd23('0x3f')]?_0x37f14b[_0xfd23('0x3d')]:_0x469067[_0xfd23('0x39')];if(_0x2be6f9[_0xfd23('0x3a')][_0xfd23('0x4a')]){_0x37f14b[_0xfd23('0x4b')]=[{'all':!![]}];}_0x37f14b=_[_0xfd23('0x47')]({},_0x37f14b,_0x2be6f9['options']);return db[_0xfd23('0x35')][_0xfd23('0x51')](_0x37f14b)['then'](handleEntityNotFound(_0x3df382,null))[_0xfd23('0x2f')](respondWithResult(_0x3df382,null))['catch'](handleError(_0x3df382,null));};exports[_0xfd23('0x52')]=function(_0x480b09,_0x436d10){return db['SmsQueue'][_0xfd23('0x52')](_0x480b09[_0xfd23('0x53')],{})[_0xfd23('0x2f')](function(_0x5ca70e){var _0x31dcfd=_0x480b09[_0xfd23('0x54')][_0xfd23('0x2b')]({'plain':!![]});if(!_0x31dcfd)throw new Error(_0xfd23('0x55'));if(_0x31dcfd[_0xfd23('0x56')]===_0xfd23('0x54')){var _0x4eb3c5=_0x5ca70e[_0xfd23('0x2b')]({'plain':!![]});var _0x55436c=_0xfd23('0x2c');return db[_0xfd23('0x57')][_0xfd23('0x51')]({'where':{'name':_0x55436c,'userProfileId':_0x31dcfd['userProfileId']},'raw':!![]})[_0xfd23('0x2f')](function(_0x5b4b1e){if(_0x5b4b1e&&_0x5b4b1e[_0xfd23('0x58')]===0x0){return db['UserProfileResource'][_0xfd23('0x52')]({'name':_0x4eb3c5['name'],'resourceId':_0x4eb3c5['id'],'type':_0x5b4b1e[_0xfd23('0x32')],'sectionId':_0x5b4b1e['id']},{})['then'](function(){return _0x5ca70e;});}else{return _0x5ca70e;}})[_0xfd23('0x4e')](function(_0x5a27c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a27c0);throw _0x5a27c0;});}return _0x5ca70e;})['then'](respondWithResult(_0x436d10,0xc9))['catch'](handleError(_0x436d10,null));};exports[_0xfd23('0x2a')]=function(_0x5e07bd,_0x53ca5b){if(_0x5e07bd[_0xfd23('0x53')]['id']){delete _0x5e07bd[_0xfd23('0x53')]['id'];}return db[_0xfd23('0x35')][_0xfd23('0x51')]({'where':{'id':_0x5e07bd[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](handleEntityNotFound(_0x53ca5b,null))[_0xfd23('0x2f')](saveUpdates(_0x5e07bd[_0xfd23('0x53')],null))[_0xfd23('0x2f')](respondWithResult(_0x53ca5b,null))[_0xfd23('0x4e')](handleError(_0x53ca5b,null));};exports[_0xfd23('0x2e')]=function(_0x500805,_0xf9a9b){return db[_0xfd23('0x35')][_0xfd23('0x51')]({'where':{'id':_0x500805[_0xfd23('0x50')]['id']}})['then'](handleEntityNotFound(_0xf9a9b,null))[_0xfd23('0x2f')](removeEntity(_0xf9a9b,null))['catch'](handleError(_0xf9a9b,null));};exports[_0xfd23('0x59')]=function(_0x136f34,_0x445f09){return db[_0xfd23('0x35')]['describe']()['then'](respondWithResult(_0x445f09,null))[_0xfd23('0x4e')](handleError(_0x445f09,null));};exports['getMembers']=function(_0x39014f,_0x4d48d7,_0x2a34aa){var _0x28f61e={'raw':!![],'where':{}},_0x1fa2d3={},_0x425057;return db[_0xfd23('0x35')][_0xfd23('0x5a')]({'where':{'id':_0x39014f[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](handleEntityNotFound(_0x4d48d7,null))[_0xfd23('0x2f')](function(_0x33a03f){if(_0x33a03f){_0x425057=_0x33a03f[_0xfd23('0x2b')]({'plain':!![]});_0x1fa2d3[_0xfd23('0x39')]=_[_0xfd23('0x3b')](db[_0xfd23('0x5b')][_0xfd23('0x36')]);_0x1fa2d3[_0xfd23('0x3a')]=_[_0xfd23('0x3b')](_0x39014f['query']);_0x1fa2d3[_0xfd23('0x5c')]=_['intersection'](_0x1fa2d3[_0xfd23('0x39')],_0x1fa2d3[_0xfd23('0x3a')]);_0x28f61e['attributes']=_['intersection'](_0x1fa2d3[_0xfd23('0x39')],qs[_0xfd23('0x3e')](_0x39014f['query']['fields']));_0x28f61e[_0xfd23('0x3d')]=_0x28f61e['attributes']['length']?_0x28f61e[_0xfd23('0x3d')]:_0x1fa2d3['model'];if(!_0x39014f[_0xfd23('0x3a')][_0xfd23('0x40')](_0xfd23('0x41'))){_0x28f61e[_0xfd23('0x24')]=qs[_0xfd23('0x24')](_0x39014f[_0xfd23('0x3a')][_0xfd23('0x24')]);_0x28f61e[_0xfd23('0x23')]=qs[_0xfd23('0x23')](_0x39014f[_0xfd23('0x3a')][_0xfd23('0x23')]);}_0x28f61e[_0xfd23('0x42')]=qs['sort'](_0x39014f[_0xfd23('0x3a')]['sort']);_0x28f61e[_0xfd23('0x44')]=qs[_0xfd23('0x5c')](_[_0xfd23('0x45')](_0x39014f[_0xfd23('0x3a')],_0x1fa2d3[_0xfd23('0x5c')]));_0x28f61e[_0xfd23('0x44')][_0xfd23('0x5d')]=_0x33a03f['id'];if(_0x39014f[_0xfd23('0x3a')][_0xfd23('0x46')]){_0x28f61e[_0xfd23('0x44')]=_[_0xfd23('0x47')](_0x28f61e['where'],{'$or':_[_0xfd23('0x48')](_0x28f61e[_0xfd23('0x3d')],function(_0x58cde8){var _0x150c55={};_0x150c55[_0x58cde8]={'$like':'%'+_0x39014f[_0xfd23('0x3a')][_0xfd23('0x46')]+'%'};return _0x150c55;})});}_0x28f61e=_['merge']({},_0x28f61e,_0x39014f['options']);return db[_0xfd23('0x5b')][_0xfd23('0x4c')](_0x28f61e);}})[_0xfd23('0x2f')](function(_0x501e0c){if(_0x501e0c){return db[_0xfd23('0x5e')]['findAndCountAll']({'where':{'id':_[_0xfd23('0x48')](_0x501e0c,'UserId'),'role':_0xfd23('0x5f')},'attributes':['id',_0xfd23('0x32'),_0xfd23('0x60'),_0xfd23('0x61'),_0xfd23('0x62')]});}})[_0xfd23('0x2f')](function(_0x1d923c){if(_0x1d923c){return{'count':_0x1d923c['count'],'rows':_[_0xfd23('0x48')](_0x1d923c[_0xfd23('0x4d')],function(_0x2e4837){return{'membername':_0x2e4837['name'],'UserId':_0x2e4837['id'],'queue_name':_0x425057[_0xfd23('0x32')],'SmsQueueId':_0x425057['id'],'interface':util[_0xfd23('0x63')](_0xfd23('0x64'),_0xfd23('0x65'),_0x2e4837['name']),'penalty':0x0,'paused':_0x2e4837['smsPause'],'createdAt':_0x2e4837['createdAt'],'updatedAt':_0x2e4837[_0xfd23('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd23('0x2f')](respondWithFilteredResult(_0x4d48d7,_0x28f61e))['catch'](handleError(_0x4d48d7,null));};exports[_0xfd23('0x66')]=function(_0x536069,_0x19e15b,_0x580a7e){var _0x1ccbef={};var _0x3ed69a={};var _0x37585e;var _0x4740c9;return db[_0xfd23('0x35')]['findOne']({'where':{'id':_0x536069[_0xfd23('0x50')]['id']}})['then'](handleEntityNotFound(_0x19e15b,null))[_0xfd23('0x2f')](function(_0x33c72e){if(_0x33c72e){_0x37585e=_0x33c72e;_0x3ed69a[_0xfd23('0x39')]=_[_0xfd23('0x3b')](db[_0xfd23('0x67')]['rawAttributes']);_0x3ed69a[_0xfd23('0x3a')]=_[_0xfd23('0x3b')](_0x536069[_0xfd23('0x3a')]);_0x3ed69a[_0xfd23('0x5c')]=_[_0xfd23('0x3c')](_0x3ed69a[_0xfd23('0x39')],_0x3ed69a[_0xfd23('0x3a')]);_0x1ccbef[_0xfd23('0x3d')]=_[_0xfd23('0x3c')](_0x3ed69a[_0xfd23('0x39')],qs['fields'](_0x536069[_0xfd23('0x3a')]['fields']));_0x1ccbef[_0xfd23('0x3d')]=_0x1ccbef[_0xfd23('0x3d')][_0xfd23('0x3f')]?_0x1ccbef[_0xfd23('0x3d')]:_0x3ed69a[_0xfd23('0x39')];_0x1ccbef[_0xfd23('0x42')]=qs['sort'](_0x536069[_0xfd23('0x3a')][_0xfd23('0x43')]);_0x1ccbef[_0xfd23('0x44')]=qs[_0xfd23('0x5c')](_[_0xfd23('0x45')](_0x536069[_0xfd23('0x3a')],_0x3ed69a[_0xfd23('0x5c')]));if(_0x536069['query'][_0xfd23('0x46')]){_0x1ccbef[_0xfd23('0x44')]=_['merge'](_0x1ccbef[_0xfd23('0x44')],{'$or':_[_0xfd23('0x48')](_0x1ccbef['attributes'],function(_0x498b36){var _0x452a54={};_0x452a54[_0x498b36]={'$like':'%'+_0x536069['query'][_0xfd23('0x46')]+'%'};return _0x452a54;})});}_0x1ccbef=_[_0xfd23('0x47')]({},_0x1ccbef,_0x536069['options']);return _0x37585e[_0xfd23('0x66')](_0x1ccbef);}})[_0xfd23('0x2f')](function(_0x42e0d2){if(_0x42e0d2){_0x4740c9=_0x42e0d2[_0xfd23('0x3f')];if(!_0x536069[_0xfd23('0x3a')]['hasOwnProperty'](_0xfd23('0x41'))){_0x1ccbef[_0xfd23('0x24')]=qs[_0xfd23('0x24')](_0x536069['query']['limit']);_0x1ccbef[_0xfd23('0x23')]=qs['offset'](_0x536069['query'][_0xfd23('0x23')]);}return _0x37585e[_0xfd23('0x66')](_0x1ccbef);}})[_0xfd23('0x2f')](function(_0xa5f9fd){if(_0xa5f9fd){return _0xa5f9fd?{'count':_0x4740c9,'rows':_0xa5f9fd}:null;}})['then'](respondWithResult(_0x19e15b,null))[_0xfd23('0x4e')](handleError(_0x19e15b,null));};exports[_0xfd23('0x68')]=function(_0x5177f1,_0x58f244,_0xc445){var _0x323323=_0x5177f1[_0xfd23('0x53')][_0xfd23('0x69')];return db[_0xfd23('0x67')]['findAll']({'where':{'id':_0x323323},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfd23('0x6a'),'attributes':['id',_0xfd23('0x32'),_0xfd23('0x6b'),'voicePause',_0xfd23('0x6c')],'raw':!![]}]})['then'](function(_0x42dd54){if(_0x42dd54){var _0x407be9=_['flatMap'](_0x42dd54,function(_0x3f4e0f){var _0x2d8115=_0x3f4e0f['get']({'plain':!![]});return _0x2d8115['Agents'];});return db[_0xfd23('0x35')][_0xfd23('0x51')]({'where':{'id':_0x5177f1[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](function(_0x164c97){return db['sequelize'][_0xfd23('0x6d')](function(_0x2e3487){return _0x164c97['addTeams'](_0x323323,{'transaction':_0x2e3487})[_0xfd23('0x2f')](function(){return BPromise['each'](_0x407be9,function(_0x6b784d){return db['UserSmsQueue'][_0xfd23('0x6e')]({'where':{'UserId':_0x6b784d['id'],'SmsQueueId':_0x5177f1[_0xfd23('0x50')]['id']},'transaction':_0x2e3487});});})[_0xfd23('0x2f')](function(){_0x407be9[_0xfd23('0x6f')](function(_0x53cfe3){socket['emit']('userSmsQueue:save',{'UserId':_0x53cfe3['id'],'SmsQueueId':_0x164c97['id']});});});});});}})['then'](respondWithStatusCode(_0x58f244,null))[_0xfd23('0x4e')](handleError(_0x58f244,null));};exports[_0xfd23('0x70')]=function(_0x3e88a6,_0x1e654d,_0x373f0f){return db[_0xfd23('0x67')][_0xfd23('0x4c')]({'where':{'id':_0x3e88a6[_0xfd23('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfd23('0x5e')],'as':_0xfd23('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xfd23('0x2f')](handleEntityNotFound(_0x1e654d,null))['then'](function(_0x190a7c){var _0x91ef99=_[_0xfd23('0x48')](_0x190a7c,'id');var _0x1497bf=[];var _0x2c48f7=[];var _0xf616f1=squel['select']();_0xf616f1['field']('tq.TeamId')[_0xfd23('0x71')](_0xfd23('0x72'),'tq')[_0xfd23('0x73')](_0xfd23('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xfd23('0x75'),_0x3e88a6[_0xfd23('0x50')]['id']);for(var _0x4fbeb3=0x0;_0x4fbeb3<_0x190a7c['length'];_0x4fbeb3+=0x1){let _0x55c79c=_0x190a7c[_0x4fbeb3];for(var _0x1ad841=0x0;_0x1ad841<_0x55c79c[_0xfd23('0x6a')][_0xfd23('0x3f')];_0x1ad841+=0x1){let _0x1f581a=_0x55c79c['Agents'][_0x1ad841];var _0x576bf6=_0xf616f1[_0xfd23('0x76')]();_0x576bf6[_0xfd23('0x44')](_0xfd23('0x77'),_0x1f581a['id']);_0x2c48f7[_0xfd23('0x78')](db[_0xfd23('0x79')][_0xfd23('0x3a')](_0x576bf6['toString'](),{'type':db[_0xfd23('0x79')][_0xfd23('0x7a')]['SELECT']})[_0xfd23('0x2f')](function(_0x58c84a){if(_0x58c84a[_0xfd23('0x3f')]===0x1){return _0x1f581a['id'];}else{var _0x3d25f2=_[_0xfd23('0x7b')](_['map'](_0x58c84a,'TeamId'),function(_0x181218){return _[_0xfd23('0x7c')](_0x91ef99,_0x181218);});if(_0x3d25f2){return _0x1f581a['id'];}}}));}}return BPromise[_0xfd23('0x7d')](_0x2c48f7)[_0xfd23('0x2f')](function(_0x14e8c5){_0x1497bf=_(_0x1497bf)[_0xfd23('0x7e')](_0x14e8c5)[_0xfd23('0x7f')]()[_0xfd23('0x80')]();return db[_0xfd23('0x35')][_0xfd23('0x51')]({'where':{'id':_0x3e88a6['params']['id']}})[_0xfd23('0x2f')](function(_0x14a549){return db[_0xfd23('0x79')][_0xfd23('0x6d')](function(_0x282a98){return _0x14a549[_0xfd23('0x70')](_0x3e88a6[_0xfd23('0x3a')][_0xfd23('0x69')],{'transaction':_0x282a98})['then'](function(){if(!_['isEmpty'](_0x1497bf)){return _0x14a549['removeAgents'](_0x1497bf,{'transaction':_0x282a98});}})[_0xfd23('0x2f')](function(){_0x1497bf[_0xfd23('0x6f')](function(_0x433513){socket['emit'](_0xfd23('0x81'),{'UserId':_0x433513,'SmsQueueId':_0x14a549['id']});});});});});});})[_0xfd23('0x2f')](respondWithStatusCode(_0x1e654d,null))['catch'](handleError(_0x1e654d,null));};exports[_0xfd23('0x82')]=function(_0x4527e3,_0x45a491,_0x41e338){return db['SmsQueue'][_0xfd23('0x51')]({'where':{'id':_0x4527e3[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](handleEntityNotFound(_0x45a491,null))[_0xfd23('0x2f')](function(_0xd45e92){if(_0xd45e92){return _0xd45e92[_0xfd23('0x82')](_0x4527e3[_0xfd23('0x53')][_0xfd23('0x69')],_[_0xfd23('0x83')](_0x4527e3[_0xfd23('0x53')],['ids','id'])||{})[_0xfd23('0x84')](function(_0x11538d){for(var _0x3759d4=0x0;_0x3759d4<_0x4527e3['body'][_0xfd23('0x69')]['length'];_0x3759d4+=0x1){socket['emit'](_0xfd23('0x85'),{'UserId':Number(_0x4527e3[_0xfd23('0x53')][_0xfd23('0x69')][_0x3759d4]),'SmsQueueId':Number(_0x4527e3[_0xfd23('0x50')]['id'])});}return _0x11538d;});}})[_0xfd23('0x2f')](respondWithResult(_0x45a491,null))['catch'](handleError(_0x45a491,null));};exports[_0xfd23('0x86')]=function(_0x4e89ff,_0x428089,_0x2d4d57){return db[_0xfd23('0x35')][_0xfd23('0x51')]({'where':{'id':_0x4e89ff[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](handleEntityNotFound(_0x428089,null))[_0xfd23('0x2f')](function(_0x53205c){if(_0x53205c){return _0x53205c[_0xfd23('0x86')](_0x4e89ff[_0xfd23('0x3a')]['ids'])[_0xfd23('0x2f')](function(){if(_[_0xfd23('0x87')](_0x4e89ff['query'][_0xfd23('0x69')])){for(var _0x4993b6=0x0;_0x4993b6<_0x4e89ff[_0xfd23('0x3a')][_0xfd23('0x69')][_0xfd23('0x3f')];_0x4993b6+=0x1){socket[_0xfd23('0x88')](_0xfd23('0x81'),{'UserId':Number(_0x4e89ff[_0xfd23('0x3a')]['ids'][_0x4993b6]),'SmsQueueId':Number(_0x4e89ff[_0xfd23('0x50')]['id'])});}}else{socket[_0xfd23('0x88')](_0xfd23('0x81'),{'UserId':Number(_0x4e89ff[_0xfd23('0x3a')][_0xfd23('0x69')]),'SmsQueueId':Number(_0x4e89ff[_0xfd23('0x50')]['id'])});}});}})[_0xfd23('0x2f')](respondWithStatusCode(_0x428089,null))['catch'](handleError(_0x428089,null));};exports[_0xfd23('0x89')]=function(_0xcb4704,_0x464f3b,_0x20e5a7){var _0x4da5f9={};var _0x1280a5={};var _0x226236;var _0x4e2f82;return db['SmsQueue']['findOne']({'where':{'id':_0xcb4704[_0xfd23('0x50')]['id']}})[_0xfd23('0x2f')](handleEntityNotFound(_0x464f3b,null))[_0xfd23('0x2f')](function(_0x249afa){if(_0x249afa){_0x226236=_0x249afa;_0x1280a5[_0xfd23('0x39')]=_[_0xfd23('0x3b')](db[_0xfd23('0x5e')][_0xfd23('0x36')]);_0x1280a5[_0xfd23('0x3a')]=_[_0xfd23('0x3b')](_0xcb4704[_0xfd23('0x3a')]);_0x1280a5[_0xfd23('0x5c')]=_[_0xfd23('0x3c')](_0x1280a5[_0xfd23('0x39')],_0x1280a5[_0xfd23('0x3a')]);_0x4da5f9[_0xfd23('0x3d')]=_[_0xfd23('0x3c')](_0x1280a5[_0xfd23('0x39')],qs['fields'](_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x3e')]));_0x4da5f9['attributes']=_0x4da5f9['attributes']['length']?_0x4da5f9['attributes']:_0x1280a5[_0xfd23('0x39')];_0x4da5f9[_0xfd23('0x42')]=qs[_0xfd23('0x43')](_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x43')]);_0x4da5f9[_0xfd23('0x44')]=qs[_0xfd23('0x5c')](_[_0xfd23('0x45')](_0xcb4704[_0xfd23('0x3a')],_0x1280a5[_0xfd23('0x5c')]));if(_0xcb4704[_0xfd23('0x3a')]['filter']){_0x4da5f9[_0xfd23('0x44')]=_[_0xfd23('0x47')](_0x4da5f9[_0xfd23('0x44')],{'$or':_[_0xfd23('0x48')](_0x4da5f9[_0xfd23('0x3d')],function(_0x16bfe6){var _0x397e19={};_0x397e19[_0x16bfe6]={'$like':'%'+_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x46')]+'%'};return _0x397e19;})});}_0x4da5f9=_['merge']({},_0x4da5f9,_0xcb4704[_0xfd23('0x49')]);return _0x226236[_0xfd23('0x89')](_0x4da5f9);}})[_0xfd23('0x2f')](function(_0xe2d3a9){if(_0xe2d3a9){_0x4e2f82=_0xe2d3a9['length'];if(!_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x40')](_0xfd23('0x41'))){_0x4da5f9[_0xfd23('0x24')]=qs[_0xfd23('0x24')](_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x24')]);_0x4da5f9['offset']=qs[_0xfd23('0x23')](_0xcb4704[_0xfd23('0x3a')][_0xfd23('0x23')]);}return _0x226236[_0xfd23('0x89')](_0x4da5f9);}})['then'](function(_0x1aa33e){if(_0x1aa33e){return _0x1aa33e?{'count':_0x4e2f82,'rows':_0x1aa33e}:null;}})[_0xfd23('0x2f')](respondWithResult(_0x464f3b,null))[_0xfd23('0x4e')](handleError(_0x464f3b,null));}; \ No newline at end of file +var _0x5430=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','SmsQueues','UserProfileResource','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','pick','addTeams','ids','Team','online','voicePause','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x5430,0x10c));var _0x0543=function(_0x226daf,_0x1dd1d8){_0x226daf=_0x226daf-0x0;var _0x510165=_0x5430[_0x226daf];return _0x510165;};'use strict';var emlformat=require(_0x0543('0x0'));var rimraf=require(_0x0543('0x1'));var zipdir=require(_0x0543('0x2'));var jsonpatch=require(_0x0543('0x3'));var rp=require(_0x0543('0x4'));var moment=require(_0x0543('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0543('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0543('0x7'));var ejs=require(_0x0543('0x8'));var fs=require('fs');var fs_extra=require(_0x0543('0x9'));var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x7'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];config[_0x0543('0x19')]=_[_0x0543('0x1a')](config[_0x0543('0x19')],{'host':_0x0543('0x1b'),'port':0x18eb});var socket=require(_0x0543('0x1c'))(new Redis(config[_0x0543('0x19')]));require('./smsQueue.socket')[_0x0543('0x1d')](socket);function respondWithStatusCode(_0x21e9ac,_0x4d2a27){_0x4d2a27=_0x4d2a27||0xcc;return function(_0x4c4763){if(_0x4c4763){return _0x21e9ac[_0x0543('0x1e')](_0x4d2a27);}return _0x21e9ac[_0x0543('0x1f')](_0x4d2a27)[_0x0543('0x20')]();};}function respondWithResult(_0x1cfadf,_0x38a32e){_0x38a32e=_0x38a32e||0xc8;return function(_0x50d504){if(_0x50d504){return _0x1cfadf[_0x0543('0x1f')](_0x38a32e)[_0x0543('0x21')](_0x50d504);}};}function respondWithFilteredResult(_0x2dd5cb,_0x25254e){return function(_0x20b396){if(_0x20b396){var _0x285080=typeof _0x25254e[_0x0543('0x22')]==='undefined'&&typeof _0x25254e[_0x0543('0x23')]==='undefined';var _0x50ea84=_0x20b396[_0x0543('0x24')];var _0x419913=_0x285080?0x0:_0x25254e[_0x0543('0x22')];var _0x52eb53=_0x285080?_0x20b396[_0x0543('0x24')]:_0x25254e['offset']+_0x25254e[_0x0543('0x23')];var _0x411ec2;if(_0x52eb53>=_0x50ea84){_0x52eb53=_0x50ea84;_0x411ec2=0xc8;}else{_0x411ec2=0xce;}_0x2dd5cb['status'](_0x411ec2);return _0x2dd5cb[_0x0543('0x25')](_0x0543('0x26'),_0x419913+'-'+_0x52eb53+'/'+_0x50ea84)[_0x0543('0x21')](_0x20b396);}return null;};}function patchUpdates(_0x110060){return function(_0x37347e){try{jsonpatch[_0x0543('0x27')](_0x37347e,_0x110060,!![]);}catch(_0x4adba7){return BPromise['reject'](_0x4adba7);}return _0x37347e['save']();};}function saveUpdates(_0xbfe5dc,_0x25b3a1){return function(_0x15ebeb){if(_0x15ebeb){return _0x15ebeb[_0x0543('0x28')](_0xbfe5dc)[_0x0543('0x29')](function(_0x26e500){return _0x26e500;});}return null;};}function removeEntity(_0x36d824,_0x17a3de){return function(_0x1fca8a){if(_0x1fca8a){return _0x1fca8a[_0x0543('0x2a')]()[_0x0543('0x29')](function(){var _0x21fc63=_0x1fca8a['get']({'plain':!![]});var _0x25e6f1=_0x0543('0x2b');return db[_0x0543('0x2c')]['destroy']({'where':{'type':_0x25e6f1,'resourceId':_0x21fc63['id']}})[_0x0543('0x29')](function(){return _0x1fca8a;});})[_0x0543('0x29')](function(){_0x36d824[_0x0543('0x1f')](0xcc)[_0x0543('0x20')]();});}};}function handleEntityNotFound(_0x5dd789,_0x1732be){return function(_0x10b9f3){if(!_0x10b9f3){_0x5dd789['sendStatus'](0x194);}return _0x10b9f3;};}function handleError(_0x576084,_0x3b71f0){_0x3b71f0=_0x3b71f0||0x1f4;return function(_0x16165c){logger['error'](_0x16165c[_0x0543('0x2d')]);if(_0x16165c[_0x0543('0x2e')]){delete _0x16165c[_0x0543('0x2e')];}_0x576084[_0x0543('0x1f')](_0x3b71f0)[_0x0543('0x2f')](_0x16165c);};}exports[_0x0543('0x30')]=function(_0x164bbf,_0x4f9b63){var _0x45ac71={},_0x4f6ded={},_0x2819b8={'count':0x0,'rows':[]};var _0x282787=_[_0x0543('0x31')](db[_0x0543('0x32')][_0x0543('0x33')],function(_0x57aaa2){return{'name':_0x57aaa2[_0x0543('0x34')],'type':_0x57aaa2['type'][_0x0543('0x35')]};});_0x4f6ded[_0x0543('0x36')]=_[_0x0543('0x31')](_0x282787,_0x0543('0x2e'));_0x4f6ded['query']=_[_0x0543('0x37')](_0x164bbf['query']);_0x4f6ded[_0x0543('0x38')]=_[_0x0543('0x39')](_0x4f6ded[_0x0543('0x36')],_0x4f6ded[_0x0543('0x3a')]);_0x45ac71[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x4f6ded[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x164bbf[_0x0543('0x3a')][_0x0543('0x3c')]));_0x45ac71['attributes']=_0x45ac71[_0x0543('0x3b')][_0x0543('0x3d')]?_0x45ac71['attributes']:_0x4f6ded[_0x0543('0x36')];if(!_0x164bbf['query'][_0x0543('0x3e')](_0x0543('0x3f'))){_0x45ac71['limit']=qs['limit'](_0x164bbf[_0x0543('0x3a')][_0x0543('0x23')]);_0x45ac71['offset']=qs[_0x0543('0x22')](_0x164bbf[_0x0543('0x3a')]['offset']);}_0x45ac71[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x164bbf[_0x0543('0x3a')][_0x0543('0x41')]);_0x45ac71[_0x0543('0x42')]=qs['filters'](_['pick'](_0x164bbf['query'],_0x4f6ded[_0x0543('0x38')]),_0x282787);if(_0x164bbf[_0x0543('0x3a')][_0x0543('0x43')]){_0x45ac71[_0x0543('0x42')]=_['merge'](_0x45ac71[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x282787,function(_0xe3936f){if(_0xe3936f[_0x0543('0x44')]!==_0x0543('0x45')){var _0x714fa8={};_0x714fa8[_0xe3936f[_0x0543('0x2e')]]={'$like':'%'+_0x164bbf['query'][_0x0543('0x43')]+'%'};return _0x714fa8;}})});}_0x45ac71=_[_0x0543('0x46')]({},_0x45ac71,_0x164bbf[_0x0543('0x47')]);var _0x1b38bc={'where':_0x45ac71[_0x0543('0x42')]};return db[_0x0543('0x32')]['count'](_0x1b38bc)['then'](function(_0x44116a){_0x2819b8[_0x0543('0x24')]=_0x44116a;if(_0x164bbf[_0x0543('0x3a')][_0x0543('0x48')]){_0x45ac71[_0x0543('0x49')]=[{'all':!![]}];}return db[_0x0543('0x32')][_0x0543('0x4a')](_0x45ac71);})[_0x0543('0x29')](function(_0x1df75e){_0x2819b8['rows']=_0x1df75e;return _0x2819b8;})['then'](respondWithFilteredResult(_0x4f9b63,_0x45ac71))[_0x0543('0x4b')](handleError(_0x4f9b63,null));};exports[_0x0543('0x4c')]=function(_0x5058f2,_0x48a18a){var _0x14d7b2={'raw':!![],'where':{'id':_0x5058f2['params']['id']}},_0x2e16c4={};_0x2e16c4[_0x0543('0x36')]=_['keys'](db[_0x0543('0x32')][_0x0543('0x33')]);_0x2e16c4['query']=_['keys'](_0x5058f2[_0x0543('0x3a')]);_0x2e16c4['filters']=_[_0x0543('0x39')](_0x2e16c4[_0x0543('0x36')],_0x2e16c4[_0x0543('0x3a')]);_0x14d7b2[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x2e16c4[_0x0543('0x36')],qs['fields'](_0x5058f2[_0x0543('0x3a')][_0x0543('0x3c')]));_0x14d7b2[_0x0543('0x3b')]=_0x14d7b2[_0x0543('0x3b')][_0x0543('0x3d')]?_0x14d7b2['attributes']:_0x2e16c4[_0x0543('0x36')];if(_0x5058f2['query'][_0x0543('0x48')]){_0x14d7b2[_0x0543('0x49')]=[{'all':!![]}];}_0x14d7b2=_[_0x0543('0x46')]({},_0x14d7b2,_0x5058f2[_0x0543('0x47')]);return db[_0x0543('0x32')][_0x0543('0x4d')](_0x14d7b2)['then'](handleEntityNotFound(_0x48a18a,null))['then'](respondWithResult(_0x48a18a,null))['catch'](handleError(_0x48a18a,null));};exports[_0x0543('0x4e')]=function(_0x2177b8,_0x4964ba){return db[_0x0543('0x32')][_0x0543('0x4e')](_0x2177b8[_0x0543('0x4f')],{})[_0x0543('0x29')](function(_0x90dd22){var _0x4038a6=_0x2177b8['user'][_0x0543('0x50')]({'plain':!![]});if(!_0x4038a6)throw new Error(_0x0543('0x51'));if(_0x4038a6[_0x0543('0x52')]===_0x0543('0x53')){var _0x2d36bf=_0x90dd22[_0x0543('0x50')]({'plain':!![]});var _0x265bc1=_0x0543('0x2b');return db[_0x0543('0x54')][_0x0543('0x4d')]({'where':{'name':_0x265bc1,'userProfileId':_0x4038a6[_0x0543('0x55')]},'raw':!![]})[_0x0543('0x29')](function(_0x222047){if(_0x222047&&_0x222047[_0x0543('0x56')]===0x0){return db['UserProfileResource'][_0x0543('0x4e')]({'name':_0x2d36bf[_0x0543('0x2e')],'resourceId':_0x2d36bf['id'],'type':_0x222047[_0x0543('0x2e')],'sectionId':_0x222047['id']},{})[_0x0543('0x29')](function(){return _0x90dd22;});}else{return _0x90dd22;}})[_0x0543('0x4b')](function(_0x2980ad){logger[_0x0543('0x57')](_0x0543('0x58'),_0x2980ad);throw _0x2980ad;});}return _0x90dd22;})[_0x0543('0x29')](respondWithResult(_0x4964ba,0xc9))[_0x0543('0x4b')](handleError(_0x4964ba,null));};exports[_0x0543('0x28')]=function(_0x100300,_0x8e8ac9){if(_0x100300[_0x0543('0x4f')]['id']){delete _0x100300[_0x0543('0x4f')]['id'];}return db['SmsQueue'][_0x0543('0x4d')]({'where':{'id':_0x100300[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x8e8ac9,null))[_0x0543('0x29')](saveUpdates(_0x100300[_0x0543('0x4f')],null))[_0x0543('0x29')](respondWithResult(_0x8e8ac9,null))['catch'](handleError(_0x8e8ac9,null));};exports[_0x0543('0x2a')]=function(_0x57165c,_0x294a38){return db['SmsQueue'][_0x0543('0x4d')]({'where':{'id':_0x57165c['params']['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x294a38,null))[_0x0543('0x29')](removeEntity(_0x294a38,null))[_0x0543('0x4b')](handleError(_0x294a38,null));};exports['describe']=function(_0x117466,_0x1a569b){return db[_0x0543('0x32')][_0x0543('0x5a')]()[_0x0543('0x29')](respondWithResult(_0x1a569b,null))[_0x0543('0x4b')](handleError(_0x1a569b,null));};exports[_0x0543('0x5b')]=function(_0x774cf7,_0x2bf1f9,_0x21ec88){var _0x8a3879={'raw':!![],'where':{}},_0x2ff23a={},_0x378566;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x774cf7['params']['id']}})['then'](handleEntityNotFound(_0x2bf1f9,null))[_0x0543('0x29')](function(_0x685f15){if(_0x685f15){_0x378566=_0x685f15[_0x0543('0x50')]({'plain':!![]});_0x2ff23a[_0x0543('0x36')]=_[_0x0543('0x37')](db[_0x0543('0x5d')][_0x0543('0x33')]);_0x2ff23a[_0x0543('0x3a')]=_[_0x0543('0x37')](_0x774cf7['query']);_0x2ff23a[_0x0543('0x38')]=_[_0x0543('0x39')](_0x2ff23a[_0x0543('0x36')],_0x2ff23a[_0x0543('0x3a')]);_0x8a3879['attributes']=_[_0x0543('0x39')](_0x2ff23a[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x774cf7['query']['fields']));_0x8a3879[_0x0543('0x3b')]=_0x8a3879[_0x0543('0x3b')][_0x0543('0x3d')]?_0x8a3879['attributes']:_0x2ff23a[_0x0543('0x36')];if(!_0x774cf7[_0x0543('0x3a')][_0x0543('0x3e')]('nolimit')){_0x8a3879[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x23')]);_0x8a3879[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x22')]);}_0x8a3879[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x774cf7[_0x0543('0x3a')][_0x0543('0x41')]);_0x8a3879[_0x0543('0x42')]=qs[_0x0543('0x38')](_['pick'](_0x774cf7['query'],_0x2ff23a[_0x0543('0x38')]));_0x8a3879[_0x0543('0x42')][_0x0543('0x5e')]=_0x685f15['id'];if(_0x774cf7[_0x0543('0x3a')]['filter']){_0x8a3879[_0x0543('0x42')]=_['merge'](_0x8a3879[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x8a3879[_0x0543('0x3b')],function(_0x5bd53d){var _0x5cb8ce={};_0x5cb8ce[_0x5bd53d]={'$like':'%'+_0x774cf7[_0x0543('0x3a')]['filter']+'%'};return _0x5cb8ce;})});}_0x8a3879=_['merge']({},_0x8a3879,_0x774cf7[_0x0543('0x47')]);return db[_0x0543('0x5d')][_0x0543('0x4a')](_0x8a3879);}})[_0x0543('0x29')](function(_0x338c62){if(_0x338c62){return db[_0x0543('0x5f')][_0x0543('0x60')]({'where':{'id':_[_0x0543('0x31')](_0x338c62,_0x0543('0x61')),'role':'agent'},'attributes':['id',_0x0543('0x2e'),_0x0543('0x62'),_0x0543('0x63'),_0x0543('0x64')]});}})[_0x0543('0x29')](function(_0x53f0f3){if(_0x53f0f3){return{'count':_0x53f0f3[_0x0543('0x24')],'rows':_['map'](_0x53f0f3[_0x0543('0x65')],function(_0x85a666){return{'membername':_0x85a666[_0x0543('0x2e')],'UserId':_0x85a666['id'],'queue_name':_0x378566[_0x0543('0x2e')],'SmsQueueId':_0x378566['id'],'interface':util['format'](_0x0543('0x66'),_0x0543('0x67'),_0x85a666[_0x0543('0x2e')]),'penalty':0x0,'paused':_0x85a666['smsPause'],'createdAt':_0x85a666[_0x0543('0x64')],'updatedAt':_0x85a666['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0543('0x29')](respondWithFilteredResult(_0x2bf1f9,_0x8a3879))[_0x0543('0x4b')](handleError(_0x2bf1f9,null));};exports[_0x0543('0x68')]=function(_0x916a51,_0x25aecd,_0x21c920){var _0x54f120={};var _0x59f214={};var _0x5e6a72;var _0x387334;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x916a51[_0x0543('0x59')]['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x25aecd,null))[_0x0543('0x29')](function(_0x15a605){if(_0x15a605){_0x5e6a72=_0x15a605;_0x59f214[_0x0543('0x36')]=_['keys'](db['Team'][_0x0543('0x33')]);_0x59f214[_0x0543('0x3a')]=_['keys'](_0x916a51[_0x0543('0x3a')]);_0x59f214['filters']=_[_0x0543('0x39')](_0x59f214[_0x0543('0x36')],_0x59f214[_0x0543('0x3a')]);_0x54f120[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x59f214['model'],qs[_0x0543('0x3c')](_0x916a51[_0x0543('0x3a')]['fields']));_0x54f120[_0x0543('0x3b')]=_0x54f120[_0x0543('0x3b')][_0x0543('0x3d')]?_0x54f120['attributes']:_0x59f214[_0x0543('0x36')];_0x54f120[_0x0543('0x40')]=qs[_0x0543('0x41')](_0x916a51['query'][_0x0543('0x41')]);_0x54f120[_0x0543('0x42')]=qs[_0x0543('0x38')](_[_0x0543('0x69')](_0x916a51['query'],_0x59f214[_0x0543('0x38')]));if(_0x916a51[_0x0543('0x3a')][_0x0543('0x43')]){_0x54f120[_0x0543('0x42')]=_[_0x0543('0x46')](_0x54f120[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x54f120[_0x0543('0x3b')],function(_0x420b02){var _0xa8ab55={};_0xa8ab55[_0x420b02]={'$like':'%'+_0x916a51[_0x0543('0x3a')][_0x0543('0x43')]+'%'};return _0xa8ab55;})});}_0x54f120=_[_0x0543('0x46')]({},_0x54f120,_0x916a51[_0x0543('0x47')]);return _0x5e6a72[_0x0543('0x68')](_0x54f120);}})[_0x0543('0x29')](function(_0x1bbba9){if(_0x1bbba9){_0x387334=_0x1bbba9['length'];if(!_0x916a51[_0x0543('0x3a')][_0x0543('0x3e')](_0x0543('0x3f'))){_0x54f120[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x916a51[_0x0543('0x3a')][_0x0543('0x23')]);_0x54f120[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x916a51[_0x0543('0x3a')][_0x0543('0x22')]);}return _0x5e6a72['getTeams'](_0x54f120);}})[_0x0543('0x29')](function(_0xe296e0){if(_0xe296e0){return _0xe296e0?{'count':_0x387334,'rows':_0xe296e0}:null;}})[_0x0543('0x29')](respondWithResult(_0x25aecd,null))['catch'](handleError(_0x25aecd,null));};exports[_0x0543('0x6a')]=function(_0x4d9d96,_0x47d08b,_0x46ab3c){var _0x587f56=_0x4d9d96[_0x0543('0x4f')][_0x0543('0x6b')];return db[_0x0543('0x6c')][_0x0543('0x4a')]({'where':{'id':_0x587f56},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0543('0x2e'),_0x0543('0x6d'),_0x0543('0x6e'),'interface'],'raw':!![]}]})[_0x0543('0x29')](function(_0xdfd945){if(_0xdfd945){var _0x4cf0ca=_[_0x0543('0x6f')](_0xdfd945,function(_0x146062){var _0x5979d4=_0x146062['get']({'plain':!![]});return _0x5979d4[_0x0543('0x70')];});return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x4d9d96['params']['id']}})[_0x0543('0x29')](function(_0x37f54b){return db[_0x0543('0x71')]['transaction'](function(_0x57d27a){return _0x37f54b[_0x0543('0x6a')](_0x587f56,{'transaction':_0x57d27a})[_0x0543('0x29')](function(){return BPromise[_0x0543('0x72')](_0x4cf0ca,function(_0x51c8ee){return db[_0x0543('0x5d')][_0x0543('0x73')]({'where':{'UserId':_0x51c8ee['id'],'SmsQueueId':_0x4d9d96[_0x0543('0x59')]['id']},'transaction':_0x57d27a});});})[_0x0543('0x29')](function(){_0x4cf0ca[_0x0543('0x74')](function(_0x2a024f){socket[_0x0543('0x75')](_0x0543('0x76'),{'UserId':_0x2a024f['id'],'SmsQueueId':_0x37f54b['id']});});});});});}})[_0x0543('0x29')](respondWithStatusCode(_0x47d08b,null))[_0x0543('0x4b')](handleError(_0x47d08b,null));};exports[_0x0543('0x77')]=function(_0xe38301,_0x243e3a,_0x3d9f3d){return db[_0x0543('0x6c')][_0x0543('0x4a')]({'where':{'id':_0xe38301[_0x0543('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0543('0x5f')],'as':_0x0543('0x70'),'attributes':['id'],'raw':!![]}]})[_0x0543('0x29')](handleEntityNotFound(_0x243e3a,null))[_0x0543('0x29')](function(_0x4f2319){var _0x3411c1=_[_0x0543('0x31')](_0x4f2319,'id');var _0xdd4d2d=[];var _0x11ec91=[];var _0x5eb668=squel[_0x0543('0x78')]();_0x5eb668[_0x0543('0x79')]('tq.TeamId')[_0x0543('0x7a')](_0x0543('0x7b'),'tq')[_0x0543('0x7c')](_0x0543('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0543('0x42')](_0x0543('0x7e'),_0xe38301[_0x0543('0x59')]['id']);for(var _0x24fca2=0x0;_0x24fca2<_0x4f2319[_0x0543('0x3d')];_0x24fca2+=0x1){let _0x57130c=_0x4f2319[_0x24fca2];for(var _0x25d634=0x0;_0x25d634<_0x57130c[_0x0543('0x70')]['length'];_0x25d634+=0x1){let _0x1407e0=_0x57130c['Agents'][_0x25d634];var _0x1db117=_0x5eb668[_0x0543('0x7f')]();_0x1db117[_0x0543('0x42')](_0x0543('0x80'),_0x1407e0['id']);_0x11ec91['push'](db[_0x0543('0x71')]['query'](_0x1db117[_0x0543('0x81')](),{'type':db[_0x0543('0x71')][_0x0543('0x82')][_0x0543('0x83')]})[_0x0543('0x29')](function(_0x343786){if(_0x343786[_0x0543('0x3d')]===0x1){return _0x1407e0['id'];}else{var _0x2d1390=_[_0x0543('0x84')](_[_0x0543('0x31')](_0x343786,_0x0543('0x85')),function(_0x57aa7e){return _[_0x0543('0x86')](_0x3411c1,_0x57aa7e);});if(_0x2d1390){return _0x1407e0['id'];}}}));}}return BPromise[_0x0543('0x87')](_0x11ec91)[_0x0543('0x29')](function(_0x508a19){_0xdd4d2d=_(_0xdd4d2d)[_0x0543('0x88')](_0x508a19)['compact']()['value']();return db[_0x0543('0x32')]['find']({'where':{'id':_0xe38301['params']['id']}})[_0x0543('0x29')](function(_0x3b6a72){return db[_0x0543('0x71')][_0x0543('0x89')](function(_0x389c0d){return _0x3b6a72[_0x0543('0x77')](_0xe38301['query']['ids'],{'transaction':_0x389c0d})['then'](function(){if(!_['isEmpty'](_0xdd4d2d)){return _0x3b6a72[_0x0543('0x8a')](_0xdd4d2d,{'transaction':_0x389c0d});}})[_0x0543('0x29')](function(){_0xdd4d2d[_0x0543('0x74')](function(_0x328526){socket['emit'](_0x0543('0x8b'),{'UserId':_0x328526,'SmsQueueId':_0x3b6a72['id']});});});});});});})[_0x0543('0x29')](respondWithStatusCode(_0x243e3a,null))[_0x0543('0x4b')](handleError(_0x243e3a,null));};exports[_0x0543('0x8c')]=function(_0x2a2e53,_0x2d9734,_0x2cead1){return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x2a2e53[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d9734,null))[_0x0543('0x29')](function(_0x9c8391){if(_0x9c8391){return _0x9c8391[_0x0543('0x8c')](_0x2a2e53[_0x0543('0x4f')][_0x0543('0x6b')],_[_0x0543('0x8d')](_0x2a2e53['body'],[_0x0543('0x6b'),'id'])||{})[_0x0543('0x8e')](function(_0x4ae078){for(var _0x47e524=0x0;_0x47e524<_0x2a2e53[_0x0543('0x4f')][_0x0543('0x6b')][_0x0543('0x3d')];_0x47e524+=0x1){socket['emit'](_0x0543('0x76'),{'UserId':Number(_0x2a2e53['body']['ids'][_0x47e524]),'SmsQueueId':Number(_0x2a2e53[_0x0543('0x59')]['id'])});}return _0x4ae078;});}})['then'](respondWithResult(_0x2d9734,null))[_0x0543('0x4b')](handleError(_0x2d9734,null));};exports[_0x0543('0x8a')]=function(_0x4dffcb,_0x347404,_0x55bd20){return db[_0x0543('0x32')][_0x0543('0x4d')]({'where':{'id':_0x4dffcb[_0x0543('0x59')]['id']}})['then'](handleEntityNotFound(_0x347404,null))[_0x0543('0x29')](function(_0x53ac8a){if(_0x53ac8a){return _0x53ac8a[_0x0543('0x8a')](_0x4dffcb[_0x0543('0x3a')]['ids'])[_0x0543('0x29')](function(){if(_[_0x0543('0x8f')](_0x4dffcb[_0x0543('0x3a')]['ids'])){for(var _0x4fd84c=0x0;_0x4fd84c<_0x4dffcb[_0x0543('0x3a')]['ids'][_0x0543('0x3d')];_0x4fd84c+=0x1){socket[_0x0543('0x75')](_0x0543('0x8b'),{'UserId':Number(_0x4dffcb[_0x0543('0x3a')]['ids'][_0x4fd84c]),'SmsQueueId':Number(_0x4dffcb[_0x0543('0x59')]['id'])});}}else{socket['emit'](_0x0543('0x8b'),{'UserId':Number(_0x4dffcb[_0x0543('0x3a')][_0x0543('0x6b')]),'SmsQueueId':Number(_0x4dffcb['params']['id'])});}});}})[_0x0543('0x29')](respondWithStatusCode(_0x347404,null))[_0x0543('0x4b')](handleError(_0x347404,null));};exports['getAgents']=function(_0x1f4c5b,_0x5574f5,_0x1c00f7){var _0x11337c={};var _0x40e16c={};var _0x3a4c40;var _0x547fd9;return db[_0x0543('0x32')][_0x0543('0x5c')]({'where':{'id':_0x1f4c5b[_0x0543('0x59')]['id']}})[_0x0543('0x29')](handleEntityNotFound(_0x5574f5,null))[_0x0543('0x29')](function(_0x50b193){if(_0x50b193){_0x3a4c40=_0x50b193;_0x40e16c[_0x0543('0x36')]=_[_0x0543('0x37')](db['User']['rawAttributes']);_0x40e16c[_0x0543('0x3a')]=_['keys'](_0x1f4c5b[_0x0543('0x3a')]);_0x40e16c[_0x0543('0x38')]=_[_0x0543('0x39')](_0x40e16c[_0x0543('0x36')],_0x40e16c['query']);_0x11337c[_0x0543('0x3b')]=_[_0x0543('0x39')](_0x40e16c[_0x0543('0x36')],qs[_0x0543('0x3c')](_0x1f4c5b['query']['fields']));_0x11337c['attributes']=_0x11337c[_0x0543('0x3b')]['length']?_0x11337c[_0x0543('0x3b')]:_0x40e16c[_0x0543('0x36')];_0x11337c[_0x0543('0x40')]=qs['sort'](_0x1f4c5b[_0x0543('0x3a')][_0x0543('0x41')]);_0x11337c[_0x0543('0x42')]=qs['filters'](_[_0x0543('0x69')](_0x1f4c5b[_0x0543('0x3a')],_0x40e16c[_0x0543('0x38')]));if(_0x1f4c5b[_0x0543('0x3a')]['filter']){_0x11337c[_0x0543('0x42')]=_['merge'](_0x11337c[_0x0543('0x42')],{'$or':_[_0x0543('0x31')](_0x11337c[_0x0543('0x3b')],function(_0x32020b){var _0x23b43c={};_0x23b43c[_0x32020b]={'$like':'%'+_0x1f4c5b[_0x0543('0x3a')]['filter']+'%'};return _0x23b43c;})});}_0x11337c=_['merge']({},_0x11337c,_0x1f4c5b[_0x0543('0x47')]);return _0x3a4c40[_0x0543('0x90')](_0x11337c);}})[_0x0543('0x29')](function(_0x31b03c){if(_0x31b03c){_0x547fd9=_0x31b03c[_0x0543('0x3d')];if(!_0x1f4c5b[_0x0543('0x3a')][_0x0543('0x3e')](_0x0543('0x3f'))){_0x11337c[_0x0543('0x23')]=qs[_0x0543('0x23')](_0x1f4c5b['query']['limit']);_0x11337c[_0x0543('0x22')]=qs[_0x0543('0x22')](_0x1f4c5b['query'][_0x0543('0x22')]);}return _0x3a4c40[_0x0543('0x90')](_0x11337c);}})[_0x0543('0x29')](function(_0x120148){if(_0x120148){return _0x120148?{'count':_0x547fd9,'rows':_0x120148}:null;}})['then'](respondWithResult(_0x5574f5,null))[_0x0543('0x4b')](handleError(_0x5574f5,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 73b7180..c933adc 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 _0x0970=['exports','events','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0970,0x69));var _0x0097=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0970[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x0097('0x0'));var SmsQueue=require(_0x0097('0x1'))['db'][_0x0097('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0097('0x3'),'afterUpdate':_0x0097('0x4'),'afterDestroy':_0x0097('0x5')};function emitEvent(_0x55b179){return function(_0x330bee,_0x2b3086,_0x299416){SmsQueueEvents[_0x0097('0x6')](_0x55b179+':'+_0x330bee['id'],_0x330bee);SmsQueueEvents[_0x0097('0x6')](_0x55b179,_0x330bee);_0x299416(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x0097('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x00bb=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x00bb,0x18c));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb00b('0x0'))['db'][_0xb00b('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb00b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb00b('0x3')};function emitEvent(_0x1ebb6e){return function(_0x236647,_0x275aa1,_0x28c330){SmsQueueEvents[_0xb00b('0x4')](_0x1ebb6e+':'+_0x236647['id'],_0x236647);SmsQueueEvents[_0xb00b('0x4')](_0x1ebb6e,_0x236647);_0x28c330(null);};}for(var e in events){if(events[_0xb00b('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xb00b('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 9403cf0..691690e 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 _0x5201=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5201,0x130));var _0x1520=function(_0x43fee0,_0x4fcaa8){_0x43fee0=_0x43fee0-0x0;var _0x5dbcbd=_0x5201[_0x43fee0];return _0x5dbcbd;};'use strict';var _=require(_0x1520('0x0'));var util=require(_0x1520('0x1'));var logger=require(_0x1520('0x2'))(_0x1520('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1520('0x4'));var fs=require('fs');var path=require(_0x1520('0x5'));var rimraf=require(_0x1520('0x6'));var config=require(_0x1520('0x7'));var attributes=require(_0x1520('0x8'));module[_0x1520('0x9')]=function(_0x51e25e,_0x33a4c1){return _0x51e25e[_0x1520('0xa')](_0x1520('0xb'),attributes,{'tableName':_0x1520('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3d4=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','path'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xe3d4,0x1c9));var _0x4e3d=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0xe3d4[_0x1b6ae1];return _0x5843a2;};'use strict';var _=require(_0x4e3d('0x0'));var util=require('util');var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require(_0x4e3d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e3d('0x4'));var rimraf=require('rimraf');var config=require(_0x4e3d('0x5'));var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x52e3e4,_0x4ea5ee){return _0x52e3e4[_0x4e3d('0x8')](_0x4e3d('0x9'),attributes,{'tableName':_0x4e3d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index e56627f..545a23f 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 _0x3d11=['then','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SmsQueue','findAll','options','raw','attributes','include','model','map','GetSmsQueue','ShowSmsQueue','find','where'];(function(_0x5c6be5,_0x3ff1d5){var _0x151348=function(_0x3df6c6){while(--_0x3df6c6){_0x5c6be5['push'](_0x5c6be5['shift']());}};_0x151348(++_0x3ff1d5);}(_0x3d11,0x121));var _0x13d1=function(_0x55ce44,_0x3b1bde){_0x55ce44=_0x55ce44-0x0;var _0x2b7884=_0x3d11[_0x55ce44];return _0x2b7884;};'use strict';var _=require('lodash');var util=require(_0x13d1('0x0'));var moment=require(_0x13d1('0x1'));var BPromise=require(_0x13d1('0x2'));var rs=require(_0x13d1('0x3'));var fs=require('fs');var Redis=require(_0x13d1('0x4'));var db=require(_0x13d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x13d1('0x6'))(_0x13d1('0x7'));var config=require(_0x13d1('0x8'));var jayson=require(_0x13d1('0x9'));var client=jayson['client'][_0x13d1('0xa')]({'port':0x232a});config[_0x13d1('0xb')]=_[_0x13d1('0xc')](config['redis'],{'host':_0x13d1('0xd'),'port':0x18eb});var socket=require(_0x13d1('0xe'))(new Redis(config[_0x13d1('0xb')]));require(_0x13d1('0xf'))[_0x13d1('0x10')](socket);function respondWithRpcPromise(_0x3b7fa0,_0x428b25,_0x3eabb3){return new BPromise(function(_0x55648e,_0x471dff){return client[_0x13d1('0x11')](_0x3b7fa0,_0x3eabb3)['then'](function(_0x2ffc24){logger['info'](_0x13d1('0x12'),_0x428b25,_0x13d1('0x13'));logger[_0x13d1('0x14')](_0x13d1('0x15'),_0x428b25,_0x13d1('0x13'),JSON[_0x13d1('0x16')](_0x2ffc24));if(_0x2ffc24['error']){if(_0x2ffc24[_0x13d1('0x17')]['code']===0x1f4){logger[_0x13d1('0x17')](_0x13d1('0x12'),_0x428b25,_0x2ffc24[_0x13d1('0x17')]['message']);return _0x471dff(_0x2ffc24[_0x13d1('0x17')][_0x13d1('0x18')]);}logger[_0x13d1('0x17')](_0x13d1('0x12'),_0x428b25,_0x2ffc24['error'][_0x13d1('0x18')]);return _0x55648e(_0x2ffc24[_0x13d1('0x17')][_0x13d1('0x18')]);}else{logger['info'](_0x13d1('0x12'),_0x428b25,_0x13d1('0x13'));_0x55648e(_0x2ffc24[_0x13d1('0x19')][_0x13d1('0x18')]);}})[_0x13d1('0x1a')](function(_0x392689){logger[_0x13d1('0x17')]('SmsQueue,\x20%s,\x20%s',_0x428b25,_0x392689);_0x471dff(_0x392689);});});}exports['GetSmsQueue']=function(_0x51b3ee){var _0x56aacf=this;return new Promise(function(_0x15ad12,_0x1e50af){return db[_0x13d1('0x1b')][_0x13d1('0x1c')]({'raw':_0x51b3ee[_0x13d1('0x1d')]?_0x51b3ee[_0x13d1('0x1d')][_0x13d1('0x1e')]===undefined?!![]:![]:!![],'where':_0x51b3ee[_0x13d1('0x1d')]?_0x51b3ee[_0x13d1('0x1d')]['where']||null:null,'attributes':_0x51b3ee['options']?_0x51b3ee['options'][_0x13d1('0x1f')]||null:null,'limit':_0x51b3ee[_0x13d1('0x1d')]?_0x51b3ee[_0x13d1('0x1d')]['limit']||null:null,'include':_0x51b3ee['options']?_0x51b3ee['options']['include']?_['map'](_0x51b3ee[_0x13d1('0x1d')][_0x13d1('0x20')],function(_0x439f2e){return{'model':db[_0x439f2e['model']],'as':_0x439f2e['as'],'attributes':_0x439f2e['attributes'],'include':_0x439f2e['include']?_['map'](_0x439f2e['include'],function(_0x50cf18){return{'model':db[_0x50cf18[_0x13d1('0x21')]],'as':_0x50cf18['as'],'attributes':_0x50cf18[_0x13d1('0x1f')],'include':_0x50cf18[_0x13d1('0x20')]?_[_0x13d1('0x22')](_0x50cf18[_0x13d1('0x20')],function(_0x51312e){return{'model':db[_0x51312e[_0x13d1('0x21')]],'as':_0x51312e['as'],'attributes':_0x51312e[_0x13d1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xab8c8b){logger['info'](_0x13d1('0x23'),_0x51b3ee);logger[_0x13d1('0x14')]('GetSmsQueue',_0x51b3ee,JSON[_0x13d1('0x16')](_0xab8c8b));_0x15ad12(_0xab8c8b);})[_0x13d1('0x1a')](function(_0x40b36a){logger[_0x13d1('0x17')](_0x13d1('0x23'),_0x40b36a[_0x13d1('0x18')],_0x51b3ee);_0x1e50af(_0x56aacf['error'](0x1f4,_0x40b36a['message']));});});};exports[_0x13d1('0x24')]=function(_0x45ab5c){var _0xce0e8f=this;return new Promise(function(_0x439d36,_0x5efc03){return db[_0x13d1('0x1b')][_0x13d1('0x25')]({'raw':_0x45ab5c[_0x13d1('0x1d')]?_0x45ab5c[_0x13d1('0x1d')][_0x13d1('0x1e')]===undefined?!![]:![]:!![],'where':_0x45ab5c[_0x13d1('0x1d')]?_0x45ab5c[_0x13d1('0x1d')][_0x13d1('0x26')]||null:null,'attributes':_0x45ab5c[_0x13d1('0x1d')]?_0x45ab5c['options']['attributes']||null:null,'include':_0x45ab5c[_0x13d1('0x1d')]?_0x45ab5c['options'][_0x13d1('0x20')]?_[_0x13d1('0x22')](_0x45ab5c[_0x13d1('0x1d')][_0x13d1('0x20')],function(_0x52dc9d){return{'model':db[_0x52dc9d[_0x13d1('0x21')]],'as':_0x52dc9d['as'],'attributes':_0x52dc9d[_0x13d1('0x1f')],'include':_0x52dc9d['include']?_[_0x13d1('0x22')](_0x52dc9d[_0x13d1('0x20')],function(_0x194a37){return{'model':db[_0x194a37[_0x13d1('0x21')]],'as':_0x194a37['as'],'attributes':_0x194a37['attributes'],'include':_0x194a37['include']?_[_0x13d1('0x22')](_0x194a37[_0x13d1('0x20')],function(_0x5c35ca){return{'model':db[_0x5c35ca[_0x13d1('0x21')]],'as':_0x5c35ca['as'],'attributes':_0x5c35ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x13d1('0x27')](function(_0x3ac242){logger[_0x13d1('0x28')]('ShowSmsQueue',_0x45ab5c);logger['debug']('ShowSmsQueue',_0x45ab5c,JSON[_0x13d1('0x16')](_0x3ac242));_0x439d36(_0x3ac242);})[_0x13d1('0x1a')](function(_0x258dfe){logger[_0x13d1('0x17')](_0x13d1('0x24'),_0x258dfe[_0x13d1('0x18')],_0x45ab5c);_0x5efc03(_0xce0e8f[_0x13d1('0x17')](0x1f4,_0x258dfe[_0x13d1('0x18')]));});});}; \ No newline at end of file +var _0x3cec=['include','map','model','GetSmsQueue','ShowSmsQueue','find','util','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit'];(function(_0x20861e,_0x548492){var _0x4f89f1=function(_0x5e3d57){while(--_0x5e3d57){_0x20861e['push'](_0x20861e['shift']());}};_0x4f89f1(++_0x548492);}(_0x3cec,0xb5));var _0xc3ce=function(_0x2e85e1,_0x42428c){_0x2e85e1=_0x2e85e1-0x0;var _0x49e5b2=_0x3cec[_0x2e85e1];return _0x49e5b2;};'use strict';var _=require('lodash');var util=require(_0xc3ce('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ce('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3ce('0x2'))('rpc');var config=require(_0xc3ce('0x3'));var jayson=require(_0xc3ce('0x4'));var client=jayson[_0xc3ce('0x5')][_0xc3ce('0x6')]({'port':0x232a});config[_0xc3ce('0x7')]=_[_0xc3ce('0x8')](config[_0xc3ce('0x7')],{'host':_0xc3ce('0x9'),'port':0x18eb});var socket=require(_0xc3ce('0xa'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5e9e23,_0x115462,_0x19d695){return new BPromise(function(_0x50e56b,_0x5cf90b){return client[_0xc3ce('0xb')](_0x5e9e23,_0x19d695)[_0xc3ce('0xc')](function(_0x185d0b){logger[_0xc3ce('0xd')](_0xc3ce('0xe'),_0x115462,_0xc3ce('0xf'));logger[_0xc3ce('0x10')](_0xc3ce('0x11'),_0x115462,'request\x20sent',JSON[_0xc3ce('0x12')](_0x185d0b));if(_0x185d0b[_0xc3ce('0x13')]){if(_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x14')]===0x1f4){logger[_0xc3ce('0x13')]('SmsQueue,\x20%s,\x20%s',_0x115462,_0x185d0b['error'][_0xc3ce('0x15')]);return _0x5cf90b(_0x185d0b[_0xc3ce('0x13')]['message']);}logger[_0xc3ce('0x13')](_0xc3ce('0xe'),_0x115462,_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x15')]);return _0x50e56b(_0x185d0b[_0xc3ce('0x13')][_0xc3ce('0x15')]);}else{logger[_0xc3ce('0xd')](_0xc3ce('0xe'),_0x115462,_0xc3ce('0xf'));_0x50e56b(_0x185d0b['result'][_0xc3ce('0x15')]);}})[_0xc3ce('0x16')](function(_0x448254){logger[_0xc3ce('0x13')]('SmsQueue,\x20%s,\x20%s',_0x115462,_0x448254);_0x5cf90b(_0x448254);});});}exports['GetSmsQueue']=function(_0x2a3ddf){var _0x2f4ad0=this;return new Promise(function(_0x1ec6c8,_0x43a703){return db['SmsQueue'][_0xc3ce('0x17')]({'raw':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x19')]===undefined?!![]:![]:!![],'where':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1a')]||null:null,'attributes':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1b')]||null:null,'limit':_0x2a3ddf['options']?_0x2a3ddf['options'][_0xc3ce('0x1c')]||null:null,'include':_0x2a3ddf[_0xc3ce('0x18')]?_0x2a3ddf[_0xc3ce('0x18')][_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x2a3ddf['options']['include'],function(_0x1236bd){return{'model':db[_0x1236bd[_0xc3ce('0x1f')]],'as':_0x1236bd['as'],'attributes':_0x1236bd[_0xc3ce('0x1b')],'include':_0x1236bd[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x1236bd[_0xc3ce('0x1d')],function(_0x27ea5b){return{'model':db[_0x27ea5b['model']],'as':_0x27ea5b['as'],'attributes':_0x27ea5b[_0xc3ce('0x1b')],'include':_0x27ea5b[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x27ea5b['include'],function(_0x27c43b){return{'model':db[_0x27c43b[_0xc3ce('0x1f')]],'as':_0x27c43b['as'],'attributes':_0x27c43b[_0xc3ce('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bfb09){logger[_0xc3ce('0xd')](_0xc3ce('0x20'),_0x2a3ddf);logger['debug'](_0xc3ce('0x20'),_0x2a3ddf,JSON[_0xc3ce('0x12')](_0x4bfb09));_0x1ec6c8(_0x4bfb09);})[_0xc3ce('0x16')](function(_0x2c4411){logger[_0xc3ce('0x13')](_0xc3ce('0x20'),_0x2c4411['message'],_0x2a3ddf);_0x43a703(_0x2f4ad0[_0xc3ce('0x13')](0x1f4,_0x2c4411[_0xc3ce('0x15')]));});});};exports[_0xc3ce('0x21')]=function(_0x331535){var _0x56e607=this;return new Promise(function(_0x109186,_0x3ed11c){return db['SmsQueue'][_0xc3ce('0x22')]({'raw':_0x331535['options']?_0x331535[_0xc3ce('0x18')][_0xc3ce('0x19')]===undefined?!![]:![]:!![],'where':_0x331535['options']?_0x331535[_0xc3ce('0x18')]['where']||null:null,'attributes':_0x331535[_0xc3ce('0x18')]?_0x331535[_0xc3ce('0x18')]['attributes']||null:null,'include':_0x331535[_0xc3ce('0x18')]?_0x331535[_0xc3ce('0x18')][_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x331535[_0xc3ce('0x18')][_0xc3ce('0x1d')],function(_0x5ad4df){return{'model':db[_0x5ad4df[_0xc3ce('0x1f')]],'as':_0x5ad4df['as'],'attributes':_0x5ad4df[_0xc3ce('0x1b')],'include':_0x5ad4df[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0x5ad4df[_0xc3ce('0x1d')],function(_0xa6a36c){return{'model':db[_0xa6a36c[_0xc3ce('0x1f')]],'as':_0xa6a36c['as'],'attributes':_0xa6a36c['attributes'],'include':_0xa6a36c[_0xc3ce('0x1d')]?_[_0xc3ce('0x1e')](_0xa6a36c['include'],function(_0xd45a65){return{'model':db[_0xd45a65[_0xc3ce('0x1f')]],'as':_0xd45a65['as'],'attributes':_0xd45a65[_0xc3ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc3ce('0xc')](function(_0x1594b2){logger['info'](_0xc3ce('0x21'),_0x331535);logger[_0xc3ce('0x10')](_0xc3ce('0x21'),_0x331535,JSON[_0xc3ce('0x12')](_0x1594b2));_0x109186(_0x1594b2);})[_0xc3ce('0x16')](function(_0x4d8ce8){logger[_0xc3ce('0x13')]('ShowSmsQueue',_0x4d8ce8[_0xc3ce('0x15')],_0x331535);_0x3ed11c(_0x56e607[_0xc3ce('0x13')](0x1f4,_0x4d8ce8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9a71922..47cff9f 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 _0xb52b=['remove','removeListener','register','smsQueue:','./smsQueue.events'];(function(_0x38d877,_0x322341){var _0x2217d7=function(_0x3c5c89){while(--_0x3c5c89){_0x38d877['push'](_0x38d877['shift']());}};_0x2217d7(++_0x322341);}(_0xb52b,0xfe));var _0xbb52=function(_0xd267e9,_0x172681){_0xd267e9=_0xd267e9-0x0;var _0x15a8a6=_0xb52b[_0xd267e9];return _0x15a8a6;};'use strict';var SmsQueueEvents=require(_0xbb52('0x0'));var events=['save',_0xbb52('0x1'),'update'];function createListener(_0x3a5ba7,_0x576d22){return function(_0x157a74){_0x576d22['emit'](_0x3a5ba7,_0x157a74);};}function removeListener(_0x462844,_0x28c9ea){return function(){SmsQueueEvents[_0xbb52('0x2')](_0x462844,_0x28c9ea);};}exports[_0xbb52('0x3')]=function(_0x439785){for(var _0x49309c=0x0,_0x5cc90c=events['length'];_0x49309c<_0x5cc90c;_0x49309c++){var _0x58c6e5=events[_0x49309c];var _0x44a4c8=createListener(_0xbb52('0x4')+_0x58c6e5,_0x439785);SmsQueueEvents['on'](_0x58c6e5,_0x44a4c8);}}; \ No newline at end of file +var _0xab9c=['emit','length','smsQueue:','./smsQueue.events'];(function(_0x21a1cc,_0x3d40c2){var _0xcb3ac=function(_0x21ec37){while(--_0x21ec37){_0x21a1cc['push'](_0x21a1cc['shift']());}};_0xcb3ac(++_0x3d40c2);}(_0xab9c,0x1df));var _0xcab9=function(_0x3e6875,_0x26164e){_0x3e6875=_0x3e6875-0x0;var _0x4605ea=_0xab9c[_0x3e6875];return _0x4605ea;};'use strict';var SmsQueueEvents=require(_0xcab9('0x0'));var events=['save','remove','update'];function createListener(_0x461ef0,_0x41d161){return function(_0x42f13f){_0x41d161[_0xcab9('0x1')](_0x461ef0,_0x42f13f);};}function removeListener(_0xde0453,_0xd4dc0b){return function(){SmsQueueEvents['removeListener'](_0xde0453,_0xd4dc0b);};}exports['register']=function(_0x5ca5f8){for(var _0x4f5a62=0x0,_0x36444c=events[_0xcab9('0x2')];_0x4f5a62<_0x36444c;_0x4f5a62++){var _0x51128e=events[_0x4f5a62];var _0x5d8ade=createListener(_0xcab9('0x3')+_0x51128e,_0x5ca5f8);SmsQueueEvents['on'](_0x51128e,_0x5d8ade);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 49f4ee0..9b4b6d7 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 _0x8e76=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8e76,0x78));var _0x68e7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8e76[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var path=require(_0x68e7('0x2'));var timeout=require(_0x68e7('0x3'));var express=require(_0x68e7('0x4'));var router=express[_0x68e7('0x5')]();var fs_extra=require(_0x68e7('0x6'));var auth=require(_0x68e7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x68e7('0x8'));var controller=require(_0x68e7('0x9'));router[_0x68e7('0xa')]('/',auth[_0x68e7('0xb')](),controller[_0x68e7('0xc')]);router['get'](_0x68e7('0xd'),auth[_0x68e7('0xb')](),controller['describe']);router[_0x68e7('0xa')](_0x68e7('0xe'),auth['isAuthenticated'](),controller[_0x68e7('0xf')]);router[_0x68e7('0x10')]('/',auth[_0x68e7('0xb')](),controller[_0x68e7('0x11')]);router[_0x68e7('0x12')](_0x68e7('0xe'),auth[_0x68e7('0xb')](),controller[_0x68e7('0x13')]);router[_0x68e7('0x14')]('/:id',auth[_0x68e7('0xb')](),controller[_0x68e7('0x15')]);module[_0x68e7('0x16')]=router; \ No newline at end of file +var _0x3079=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy'];(function(_0x16f498,_0xb3968d){var _0x15836f=function(_0x3d98aa){while(--_0x3d98aa){_0x16f498['push'](_0x16f498['shift']());}};_0x15836f(++_0xb3968d);}(_0x3079,0x110));var _0x9307=function(_0x54ee1f,_0x1f3d67){_0x54ee1f=_0x54ee1f-0x0;var _0x145070=_0x3079[_0x54ee1f];return _0x145070;};'use strict';var multer=require('multer');var util=require(_0x9307('0x0'));var path=require(_0x9307('0x1'));var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require(_0x9307('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x6'));router[_0x9307('0x7')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9307('0xa')]);router['get'](_0x9307('0xb'),auth[_0x9307('0x8')](),controller['show']);router[_0x9307('0xc')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0xd')]);router['put']('/:id',auth[_0x9307('0x8')](),controller[_0x9307('0xe')]);router[_0x9307('0xf')](_0x9307('0xb'),auth[_0x9307('0x8')](),controller[_0x9307('0x10')]);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 4101a0f..1937186 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 _0x4c85=['DATE','moment','exports','STRING'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x4c85,0xa5));var _0x54c8=function(_0x5d1c63,_0x1ad078){_0x5d1c63=_0x5d1c63-0x0;var _0x19817b=_0x4c85[_0x5d1c63];return _0x19817b;};'use strict';var moment=require(_0x54c8('0x0'));var Sequelize=require('sequelize');module[_0x54c8('0x1')]={'uniqueid':{'type':Sequelize[_0x54c8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x54c8('0x2')]},'joinAt':{'type':Sequelize[_0x54c8('0x3')]},'leaveAt':{'type':Sequelize[_0x54c8('0x3')]},'acceptAt':{'type':Sequelize[_0x54c8('0x3')]},'exitAt':{'type':Sequelize[_0x54c8('0x3')]},'reason':{'type':Sequelize[_0x54c8('0x2')]}}; \ No newline at end of file +var _0xe293=['exports','STRING','DATE','sequelize'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe293,0x117));var _0x3e29=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xe293[_0x2e50a2];return _0x47e5de;};'use strict';var moment=require('moment');var Sequelize=require(_0x3e29('0x0'));module[_0x3e29('0x1')]={'uniqueid':{'type':Sequelize[_0x3e29('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3e29('0x2')]},'joinAt':{'type':Sequelize[_0x3e29('0x3')]},'leaveAt':{'type':Sequelize[_0x3e29('0x3')]},'acceptAt':{'type':Sequelize[_0x3e29('0x3')]},'exitAt':{'type':Sequelize[_0x3e29('0x3')]},'reason':{'type':Sequelize[_0x3e29('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 3079f3b..313de32 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 _0xf533=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','send','index','map','SmsQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL'];(function(_0x378c87,_0x13c63e){var _0x5614a5=function(_0x56e1fb){while(--_0x56e1fb){_0x378c87['push'](_0x378c87['shift']());}};_0x5614a5(++_0x13c63e);}(_0xf533,0xa8));var _0x3f53=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xf533[_0x31a37b];return _0x49ae16;};'use strict';var emlformat=require(_0x3f53('0x0'));var rimraf=require(_0x3f53('0x1'));var zipdir=require(_0x3f53('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f53('0x3'));var moment=require('moment');var BPromise=require(_0x3f53('0x4'));var Mustache=require('mustache');var util=require(_0x3f53('0x5'));var path=require(_0x3f53('0x6'));var sox=require(_0x3f53('0x7'));var csv=require(_0x3f53('0x8'));var ejs=require(_0x3f53('0x9'));var fs=require('fs');var fs_extra=require(_0x3f53('0xa'));var _=require(_0x3f53('0xb'));var squel=require(_0x3f53('0xc'));var crypto=require(_0x3f53('0xd'));var jsforce=require(_0x3f53('0xe'));var deskjs=require(_0x3f53('0xf'));var toCsv=require(_0x3f53('0x8'));var querystring=require('querystring');var Papa=require(_0x3f53('0x10'));var Redis=require('ioredis');var authService=require(_0x3f53('0x11'));var qs=require(_0x3f53('0x12'));var as=require(_0x3f53('0x13'));var hardwareService=require(_0x3f53('0x14'));var logger=require(_0x3f53('0x15'))(_0x3f53('0x16'));var utils=require(_0x3f53('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f53('0x18'))['db'];function respondWithStatusCode(_0x3bc396,_0x2b232f){_0x2b232f=_0x2b232f||0xcc;return function(_0x33717e){if(_0x33717e){return _0x3bc396[_0x3f53('0x19')](_0x2b232f);}return _0x3bc396[_0x3f53('0x1a')](_0x2b232f)[_0x3f53('0x1b')]();};}function respondWithResult(_0x3aa92f,_0x42e19e){_0x42e19e=_0x42e19e||0xc8;return function(_0x4c478f){if(_0x4c478f){return _0x3aa92f[_0x3f53('0x1a')](_0x42e19e)[_0x3f53('0x1c')](_0x4c478f);}};}function respondWithFilteredResult(_0x54a3b4,_0x2dbd1f){return function(_0x4cd0e0){if(_0x4cd0e0){var _0x6d5c60=typeof _0x2dbd1f[_0x3f53('0x1d')]===_0x3f53('0x1e')&&typeof _0x2dbd1f[_0x3f53('0x1f')]==='undefined';var _0x5aa480=_0x4cd0e0[_0x3f53('0x20')];var _0x2ceb48=_0x6d5c60?0x0:_0x2dbd1f['offset'];var _0x3c92fe=_0x6d5c60?_0x4cd0e0[_0x3f53('0x20')]:_0x2dbd1f[_0x3f53('0x1d')]+_0x2dbd1f[_0x3f53('0x1f')];var _0x2061ce;if(_0x3c92fe>=_0x5aa480){_0x3c92fe=_0x5aa480;_0x2061ce=0xc8;}else{_0x2061ce=0xce;}_0x54a3b4[_0x3f53('0x1a')](_0x2061ce);return _0x54a3b4[_0x3f53('0x21')]('Content-Range',_0x2ceb48+'-'+_0x3c92fe+'/'+_0x5aa480)[_0x3f53('0x1c')](_0x4cd0e0);}return null;};}function patchUpdates(_0x3f59b5){return function(_0x46cb48){try{jsonpatch['apply'](_0x46cb48,_0x3f59b5,!![]);}catch(_0x1b9c06){return BPromise[_0x3f53('0x22')](_0x1b9c06);}return _0x46cb48[_0x3f53('0x23')]();};}function saveUpdates(_0x2d1b3e,_0x4b984b){return function(_0x3d7d62){if(_0x3d7d62){return _0x3d7d62['update'](_0x2d1b3e)[_0x3f53('0x24')](function(_0x12d417){return _0x12d417;});}return null;};}function removeEntity(_0x1a8f94,_0x421aff){return function(_0x1dec04){if(_0x1dec04){return _0x1dec04[_0x3f53('0x25')]()[_0x3f53('0x24')](function(){_0x1a8f94[_0x3f53('0x1a')](0xcc)[_0x3f53('0x1b')]();});}};}function handleEntityNotFound(_0x235faf,_0x5ce735){return function(_0x3612d3){if(!_0x3612d3){_0x235faf[_0x3f53('0x19')](0x194);}return _0x3612d3;};}function handleError(_0x19db38,_0x2b4bf9){_0x2b4bf9=_0x2b4bf9||0x1f4;return function(_0xd23501){logger[_0x3f53('0x26')](_0xd23501['stack']);if(_0xd23501[_0x3f53('0x27')]){delete _0xd23501[_0x3f53('0x27')];}_0x19db38[_0x3f53('0x1a')](_0x2b4bf9)[_0x3f53('0x28')](_0xd23501);};}exports[_0x3f53('0x29')]=function(_0x2ac747,_0x2e8018){var _0x16a945={},_0x1419c6={},_0x27e30d={'count':0x0,'rows':[]};var _0x4708ba=_[_0x3f53('0x2a')](db[_0x3f53('0x2b')]['rawAttributes'],function(_0xc50f9){return{'name':_0xc50f9[_0x3f53('0x2c')],'type':_0xc50f9['type'][_0x3f53('0x2d')]};});_0x1419c6[_0x3f53('0x2e')]=_[_0x3f53('0x2a')](_0x4708ba,_0x3f53('0x27'));_0x1419c6[_0x3f53('0x2f')]=_[_0x3f53('0x30')](_0x2ac747[_0x3f53('0x2f')]);_0x1419c6['filters']=_[_0x3f53('0x31')](_0x1419c6['model'],_0x1419c6[_0x3f53('0x2f')]);_0x16a945[_0x3f53('0x32')]=_[_0x3f53('0x31')](_0x1419c6[_0x3f53('0x2e')],qs[_0x3f53('0x33')](_0x2ac747[_0x3f53('0x2f')][_0x3f53('0x33')]));_0x16a945['attributes']=_0x16a945[_0x3f53('0x32')][_0x3f53('0x34')]?_0x16a945['attributes']:_0x1419c6['model'];if(!_0x2ac747[_0x3f53('0x2f')]['hasOwnProperty'](_0x3f53('0x35'))){_0x16a945[_0x3f53('0x1f')]=qs[_0x3f53('0x1f')](_0x2ac747['query']['limit']);_0x16a945['offset']=qs[_0x3f53('0x1d')](_0x2ac747['query'][_0x3f53('0x1d')]);}_0x16a945[_0x3f53('0x36')]=qs[_0x3f53('0x37')](_0x2ac747[_0x3f53('0x2f')][_0x3f53('0x37')]);_0x16a945[_0x3f53('0x38')]=qs['filters'](_[_0x3f53('0x39')](_0x2ac747[_0x3f53('0x2f')],_0x1419c6[_0x3f53('0x3a')]),_0x4708ba);if(_0x2ac747[_0x3f53('0x2f')][_0x3f53('0x3b')]){_0x16a945[_0x3f53('0x38')]=_[_0x3f53('0x3c')](_0x16a945[_0x3f53('0x38')],{'$or':_['map'](_0x4708ba,function(_0x8a4f66){if(_0x8a4f66[_0x3f53('0x3d')]!==_0x3f53('0x3e')){var _0x72a4f5={};_0x72a4f5[_0x8a4f66[_0x3f53('0x27')]]={'$like':'%'+_0x2ac747[_0x3f53('0x2f')][_0x3f53('0x3b')]+'%'};return _0x72a4f5;}})});}_0x16a945=_['merge']({},_0x16a945,_0x2ac747[_0x3f53('0x3f')]);var _0x5d3dd2={'where':_0x16a945[_0x3f53('0x38')]};return db[_0x3f53('0x2b')]['count'](_0x5d3dd2)[_0x3f53('0x24')](function(_0x53cd4b){_0x27e30d[_0x3f53('0x20')]=_0x53cd4b;if(_0x2ac747[_0x3f53('0x2f')][_0x3f53('0x40')]){_0x16a945['include']=[{'all':!![]}];}return db[_0x3f53('0x2b')][_0x3f53('0x41')](_0x16a945);})[_0x3f53('0x24')](function(_0x1d05e6){_0x27e30d[_0x3f53('0x42')]=_0x1d05e6;return _0x27e30d;})[_0x3f53('0x24')](respondWithFilteredResult(_0x2e8018,_0x16a945))[_0x3f53('0x43')](handleError(_0x2e8018,null));};exports[_0x3f53('0x44')]=function(_0x1ca2b2,_0x121225){var _0xdb0acd={'raw':!![],'where':{'id':_0x1ca2b2[_0x3f53('0x45')]['id']}},_0x4aaf1a={};_0x4aaf1a['model']=_['keys'](db[_0x3f53('0x2b')][_0x3f53('0x46')]);_0x4aaf1a[_0x3f53('0x2f')]=_['keys'](_0x1ca2b2['query']);_0x4aaf1a[_0x3f53('0x3a')]=_[_0x3f53('0x31')](_0x4aaf1a[_0x3f53('0x2e')],_0x4aaf1a[_0x3f53('0x2f')]);_0xdb0acd['attributes']=_[_0x3f53('0x31')](_0x4aaf1a['model'],qs[_0x3f53('0x33')](_0x1ca2b2[_0x3f53('0x2f')][_0x3f53('0x33')]));_0xdb0acd[_0x3f53('0x32')]=_0xdb0acd[_0x3f53('0x32')][_0x3f53('0x34')]?_0xdb0acd[_0x3f53('0x32')]:_0x4aaf1a[_0x3f53('0x2e')];if(_0x1ca2b2[_0x3f53('0x2f')]['includeAll']){_0xdb0acd[_0x3f53('0x47')]=[{'all':!![]}];}_0xdb0acd=_[_0x3f53('0x3c')]({},_0xdb0acd,_0x1ca2b2[_0x3f53('0x3f')]);return db[_0x3f53('0x2b')][_0x3f53('0x48')](_0xdb0acd)[_0x3f53('0x24')](handleEntityNotFound(_0x121225,null))[_0x3f53('0x24')](respondWithResult(_0x121225,null))[_0x3f53('0x43')](handleError(_0x121225,null));};exports['create']=function(_0x324b02,_0x528b51){return db['SmsQueueReport'][_0x3f53('0x49')](_0x324b02[_0x3f53('0x4a')],{})['then'](respondWithResult(_0x528b51,0xc9))[_0x3f53('0x43')](handleError(_0x528b51,null));};exports[_0x3f53('0x4b')]=function(_0x1d023f,_0x5d4d56){if(_0x1d023f[_0x3f53('0x4a')]['id']){delete _0x1d023f[_0x3f53('0x4a')]['id'];}return db[_0x3f53('0x2b')][_0x3f53('0x48')]({'where':{'id':_0x1d023f['params']['id']}})[_0x3f53('0x24')](handleEntityNotFound(_0x5d4d56,null))['then'](saveUpdates(_0x1d023f[_0x3f53('0x4a')],null))[_0x3f53('0x24')](respondWithResult(_0x5d4d56,null))['catch'](handleError(_0x5d4d56,null));};exports['destroy']=function(_0x20ea6b,_0x22750d){return db[_0x3f53('0x2b')][_0x3f53('0x48')]({'where':{'id':_0x20ea6b[_0x3f53('0x45')]['id']}})[_0x3f53('0x24')](handleEntityNotFound(_0x22750d,null))[_0x3f53('0x24')](removeEntity(_0x22750d,null))[_0x3f53('0x43')](handleError(_0x22750d,null));};exports['describe']=function(_0x8ce0cd,_0x13bb50){return db[_0x3f53('0x2b')][_0x3f53('0x4c')]()[_0x3f53('0x24')](respondWithResult(_0x13bb50,null))[_0x3f53('0x43')](handleError(_0x13bb50,null));}; \ No newline at end of file +var _0x0a3d=['util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0a3d,0x90));var _0xd0a3=function(_0x4637da,_0x1e95dc){_0x4637da=_0x4637da-0x0;var _0x5eb41a=_0x0a3d[_0x4637da];return _0x5eb41a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0a3('0x0'));var rp=require(_0xd0a3('0x1'));var moment=require(_0xd0a3('0x2'));var BPromise=require(_0xd0a3('0x3'));var Mustache=require('mustache');var util=require(_0xd0a3('0x4'));var path=require(_0xd0a3('0x5'));var sox=require('sox');var csv=require(_0xd0a3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0a3('0x7'));var squel=require(_0xd0a3('0x8'));var crypto=require(_0xd0a3('0x9'));var jsforce=require(_0xd0a3('0xa'));var deskjs=require(_0xd0a3('0xb'));var toCsv=require(_0xd0a3('0x6'));var querystring=require('querystring');var Papa=require(_0xd0a3('0xc'));var Redis=require(_0xd0a3('0xd'));var authService=require(_0xd0a3('0xe'));var qs=require(_0xd0a3('0xf'));var as=require(_0xd0a3('0x10'));var hardwareService=require(_0xd0a3('0x11'));var logger=require('../../config/logger')(_0xd0a3('0x12'));var utils=require('../../config/utils');var config=require(_0xd0a3('0x13'));var licenseUtil=require(_0xd0a3('0x14'));var db=require(_0xd0a3('0x15'))['db'];function respondWithStatusCode(_0x2b0e0c,_0x20cc64){_0x20cc64=_0x20cc64||0xcc;return function(_0xd264e3){if(_0xd264e3){return _0x2b0e0c[_0xd0a3('0x16')](_0x20cc64);}return _0x2b0e0c[_0xd0a3('0x17')](_0x20cc64)[_0xd0a3('0x18')]();};}function respondWithResult(_0x414ef7,_0x2d78bf){_0x2d78bf=_0x2d78bf||0xc8;return function(_0x11766a){if(_0x11766a){return _0x414ef7[_0xd0a3('0x17')](_0x2d78bf)[_0xd0a3('0x19')](_0x11766a);}};}function respondWithFilteredResult(_0x12b7f0,_0x262c97){return function(_0x3921fe){if(_0x3921fe){var _0x16f50c=typeof _0x262c97[_0xd0a3('0x1a')]===_0xd0a3('0x1b')&&typeof _0x262c97['limit']===_0xd0a3('0x1b');var _0x46a319=_0x3921fe[_0xd0a3('0x1c')];var _0x5d4277=_0x16f50c?0x0:_0x262c97[_0xd0a3('0x1a')];var _0x5dce17=_0x16f50c?_0x3921fe[_0xd0a3('0x1c')]:_0x262c97[_0xd0a3('0x1a')]+_0x262c97[_0xd0a3('0x1d')];var _0x9fc3be;if(_0x5dce17>=_0x46a319){_0x5dce17=_0x46a319;_0x9fc3be=0xc8;}else{_0x9fc3be=0xce;}_0x12b7f0[_0xd0a3('0x17')](_0x9fc3be);return _0x12b7f0['set'](_0xd0a3('0x1e'),_0x5d4277+'-'+_0x5dce17+'/'+_0x46a319)[_0xd0a3('0x19')](_0x3921fe);}return null;};}function patchUpdates(_0x33320b){return function(_0x228090){try{jsonpatch[_0xd0a3('0x1f')](_0x228090,_0x33320b,!![]);}catch(_0x16beb3){return BPromise[_0xd0a3('0x20')](_0x16beb3);}return _0x228090[_0xd0a3('0x21')]();};}function saveUpdates(_0x5500c0,_0x4adc83){return function(_0x2bec6e){if(_0x2bec6e){return _0x2bec6e['update'](_0x5500c0)[_0xd0a3('0x22')](function(_0x19ac4c){return _0x19ac4c;});}return null;};}function removeEntity(_0x175248,_0x1ffd4c){return function(_0x33759f){if(_0x33759f){return _0x33759f['destroy']()[_0xd0a3('0x22')](function(){_0x175248['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x196a5e,_0x32253d){return function(_0x43f346){if(!_0x43f346){_0x196a5e['sendStatus'](0x194);}return _0x43f346;};}function handleError(_0x4720ba,_0x48545){_0x48545=_0x48545||0x1f4;return function(_0x569f30){logger[_0xd0a3('0x23')](_0x569f30['stack']);if(_0x569f30[_0xd0a3('0x24')]){delete _0x569f30[_0xd0a3('0x24')];}_0x4720ba['status'](_0x48545)[_0xd0a3('0x25')](_0x569f30);};}exports[_0xd0a3('0x26')]=function(_0x15a3f0,_0x442161){var _0x1f0c02={},_0x183282={},_0x5a3426={'count':0x0,'rows':[]};var _0x1d1f3c=_[_0xd0a3('0x27')](db[_0xd0a3('0x28')][_0xd0a3('0x29')],function(_0x5a1921){return{'name':_0x5a1921[_0xd0a3('0x2a')],'type':_0x5a1921['type'][_0xd0a3('0x2b')]};});_0x183282[_0xd0a3('0x2c')]=_[_0xd0a3('0x27')](_0x1d1f3c,'name');_0x183282['query']=_[_0xd0a3('0x2d')](_0x15a3f0['query']);_0x183282[_0xd0a3('0x2e')]=_[_0xd0a3('0x2f')](_0x183282[_0xd0a3('0x2c')],_0x183282[_0xd0a3('0x30')]);_0x1f0c02[_0xd0a3('0x31')]=_[_0xd0a3('0x2f')](_0x183282[_0xd0a3('0x2c')],qs['fields'](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x32')]));_0x1f0c02[_0xd0a3('0x31')]=_0x1f0c02['attributes']['length']?_0x1f0c02['attributes']:_0x183282['model'];if(!_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x33')](_0xd0a3('0x34'))){_0x1f0c02['limit']=qs[_0xd0a3('0x1d')](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x1d')]);_0x1f0c02['offset']=qs[_0xd0a3('0x1a')](_0x15a3f0['query'][_0xd0a3('0x1a')]);}_0x1f0c02[_0xd0a3('0x35')]=qs[_0xd0a3('0x36')](_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x36')]);_0x1f0c02[_0xd0a3('0x37')]=qs[_0xd0a3('0x2e')](_[_0xd0a3('0x38')](_0x15a3f0[_0xd0a3('0x30')],_0x183282[_0xd0a3('0x2e')]),_0x1d1f3c);if(_0x15a3f0[_0xd0a3('0x30')]['filter']){_0x1f0c02['where']=_['merge'](_0x1f0c02['where'],{'$or':_[_0xd0a3('0x27')](_0x1d1f3c,function(_0x1af9cf){if(_0x1af9cf[_0xd0a3('0x39')]!==_0xd0a3('0x3a')){var _0x375c48={};_0x375c48[_0x1af9cf[_0xd0a3('0x24')]]={'$like':'%'+_0x15a3f0['query'][_0xd0a3('0x3b')]+'%'};return _0x375c48;}})});}_0x1f0c02=_['merge']({},_0x1f0c02,_0x15a3f0[_0xd0a3('0x3c')]);var _0x50ec68={'where':_0x1f0c02[_0xd0a3('0x37')]};return db[_0xd0a3('0x28')][_0xd0a3('0x1c')](_0x50ec68)[_0xd0a3('0x22')](function(_0x5ecdc8){_0x5a3426[_0xd0a3('0x1c')]=_0x5ecdc8;if(_0x15a3f0[_0xd0a3('0x30')][_0xd0a3('0x3d')]){_0x1f0c02[_0xd0a3('0x3e')]=[{'all':!![]}];}return db[_0xd0a3('0x28')][_0xd0a3('0x3f')](_0x1f0c02);})[_0xd0a3('0x22')](function(_0x1bb289){_0x5a3426[_0xd0a3('0x40')]=_0x1bb289;return _0x5a3426;})[_0xd0a3('0x22')](respondWithFilteredResult(_0x442161,_0x1f0c02))['catch'](handleError(_0x442161,null));};exports[_0xd0a3('0x41')]=function(_0x30ea61,_0x550a2a){var _0xcba251={'raw':!![],'where':{'id':_0x30ea61[_0xd0a3('0x42')]['id']}},_0x3e60ca={};_0x3e60ca['model']=_[_0xd0a3('0x2d')](db[_0xd0a3('0x28')][_0xd0a3('0x29')]);_0x3e60ca[_0xd0a3('0x30')]=_['keys'](_0x30ea61[_0xd0a3('0x30')]);_0x3e60ca[_0xd0a3('0x2e')]=_[_0xd0a3('0x2f')](_0x3e60ca[_0xd0a3('0x2c')],_0x3e60ca[_0xd0a3('0x30')]);_0xcba251[_0xd0a3('0x31')]=_[_0xd0a3('0x2f')](_0x3e60ca[_0xd0a3('0x2c')],qs['fields'](_0x30ea61[_0xd0a3('0x30')][_0xd0a3('0x32')]));_0xcba251[_0xd0a3('0x31')]=_0xcba251[_0xd0a3('0x31')]['length']?_0xcba251[_0xd0a3('0x31')]:_0x3e60ca[_0xd0a3('0x2c')];if(_0x30ea61['query'][_0xd0a3('0x3d')]){_0xcba251[_0xd0a3('0x3e')]=[{'all':!![]}];}_0xcba251=_[_0xd0a3('0x43')]({},_0xcba251,_0x30ea61[_0xd0a3('0x3c')]);return db[_0xd0a3('0x28')][_0xd0a3('0x44')](_0xcba251)[_0xd0a3('0x22')](handleEntityNotFound(_0x550a2a,null))[_0xd0a3('0x22')](respondWithResult(_0x550a2a,null))[_0xd0a3('0x45')](handleError(_0x550a2a,null));};exports[_0xd0a3('0x46')]=function(_0x3cb37d,_0x329e6b){return db[_0xd0a3('0x28')][_0xd0a3('0x46')](_0x3cb37d['body'],{})[_0xd0a3('0x22')](respondWithResult(_0x329e6b,0xc9))['catch'](handleError(_0x329e6b,null));};exports['update']=function(_0x34c589,_0x131c59){if(_0x34c589[_0xd0a3('0x47')]['id']){delete _0x34c589[_0xd0a3('0x47')]['id'];}return db[_0xd0a3('0x28')][_0xd0a3('0x44')]({'where':{'id':_0x34c589['params']['id']}})[_0xd0a3('0x22')](handleEntityNotFound(_0x131c59,null))['then'](saveUpdates(_0x34c589[_0xd0a3('0x47')],null))[_0xd0a3('0x22')](respondWithResult(_0x131c59,null))[_0xd0a3('0x45')](handleError(_0x131c59,null));};exports[_0xd0a3('0x48')]=function(_0x158e54,_0x5e3708){return db[_0xd0a3('0x28')][_0xd0a3('0x44')]({'where':{'id':_0x158e54[_0xd0a3('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e3708,null))['then'](removeEntity(_0x5e3708,null))[_0xd0a3('0x45')](handleError(_0x5e3708,null));};exports[_0xd0a3('0x49')]=function(_0x5b5293,_0x91681e){return db[_0xd0a3('0x28')][_0xd0a3('0x49')]()[_0xd0a3('0x22')](respondWithResult(_0x91681e,null))[_0xd0a3('0x45')](handleError(_0x91681e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 04d8b32..5c69843 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0xe706,0xa3));var _0x6e70=function(_0x23c2c3,_0x27ecc8){_0x23c2c3=_0x23c2c3-0x0;var _0x41e09f=_0xe706[_0x23c2c3];return _0x41e09f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x2664ab,_0x1fea26){var _0x30c72b=function(_0x1ff6d4){while(--_0x1ff6d4){_0x2664ab['push'](_0x2664ab['shift']());}};_0x30c72b(++_0x1fea26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d39787a..adcb9e1 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 _0x5199=['rpc','../../config/environment','client','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsQueueReport','create','body','raw','then','stringify','UpdateSmsQueueReport','SmsQueueReport','update','options','where','attributes','limit','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b1b22,_0x149522){var _0x6401e1=function(_0x5e9855){while(--_0x5e9855){_0x3b1b22['push'](_0x3b1b22['shift']());}};_0x6401e1(++_0x149522);}(_0x5199,0x165));var _0x9519=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x5199[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x9519('0x0'));var util=require('util');var moment=require(_0x9519('0x1'));var BPromise=require(_0x9519('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9519('0x3'))['db'];var utils=require(_0x9519('0x4'));var logger=require(_0x9519('0x5'))(_0x9519('0x6'));var config=require(_0x9519('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9519('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8303,_0x29ccb0,_0x1cb7b2){return new BPromise(function(_0x19978b,_0x51a991){return client[_0x9519('0x9')](_0x4e8303,_0x1cb7b2)['then'](function(_0x186ec3){logger[_0x9519('0xa')](_0x9519('0xb'),_0x29ccb0,'request\x20sent');logger[_0x9519('0xc')](_0x9519('0xd'),_0x29ccb0,_0x9519('0xe'),JSON['stringify'](_0x186ec3));if(_0x186ec3[_0x9519('0xf')]){if(_0x186ec3[_0x9519('0xf')][_0x9519('0x10')]===0x1f4){logger[_0x9519('0xf')](_0x9519('0xb'),_0x29ccb0,_0x186ec3[_0x9519('0xf')]['message']);return _0x51a991(_0x186ec3['error'][_0x9519('0x11')]);}logger[_0x9519('0xf')](_0x9519('0xb'),_0x29ccb0,_0x186ec3[_0x9519('0xf')][_0x9519('0x11')]);return _0x19978b(_0x186ec3[_0x9519('0xf')][_0x9519('0x11')]);}else{logger[_0x9519('0xa')](_0x9519('0xb'),_0x29ccb0,_0x9519('0xe'));_0x19978b(_0x186ec3[_0x9519('0x12')][_0x9519('0x11')]);}})[_0x9519('0x13')](function(_0x295301){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x29ccb0,_0x295301);_0x51a991(_0x295301);});});}exports[_0x9519('0x14')]=function(_0x54caf2){var _0x39cbed=this;return new Promise(function(_0x3dde2d,_0x20d058){return db['SmsQueueReport'][_0x9519('0x15')](_0x54caf2[_0x9519('0x16')],{'raw':_0x54caf2['options']?_0x54caf2['options'][_0x9519('0x17')]===undefined?!![]:![]:!![]})[_0x9519('0x18')](function(_0x10423a){logger[_0x9519('0xa')]('CreateSmsQueueReport',_0x54caf2);logger[_0x9519('0xc')](_0x9519('0x14'),_0x54caf2,JSON[_0x9519('0x19')](_0x10423a));_0x3dde2d(_0x10423a);})[_0x9519('0x13')](function(_0x21eb69){logger['error'](_0x9519('0x14'),_0x21eb69[_0x9519('0x11')],_0x54caf2);_0x20d058(_0x39cbed['error'](0x1f4,_0x21eb69[_0x9519('0x11')]));});});};exports[_0x9519('0x1a')]=function(_0x26d142){var _0x112910=this;return new Promise(function(_0x589924,_0x398505){return db[_0x9519('0x1b')][_0x9519('0x1c')](_0x26d142[_0x9519('0x16')],{'raw':_0x26d142[_0x9519('0x1d')]?_0x26d142['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26d142[_0x9519('0x1d')]?_0x26d142[_0x9519('0x1d')][_0x9519('0x1e')]||null:null,'attributes':_0x26d142['options']?_0x26d142['options'][_0x9519('0x1f')]||null:null,'limit':_0x26d142['options']?_0x26d142[_0x9519('0x1d')][_0x9519('0x20')]||null:null})[_0x9519('0x18')](function(_0x31d42d){logger['info']('UpdateSmsQueueReport',_0x26d142);logger['debug'](_0x9519('0x1a'),_0x26d142,JSON['stringify'](_0x31d42d));_0x589924(_0x31d42d);})['catch'](function(_0x2285af){logger['error']('UpdateSmsQueueReport',_0x2285af[_0x9519('0x11')],_0x26d142);_0x398505(_0x112910[_0x9519('0xf')](0x1f4,_0x2285af[_0x9519('0x11')]));});});}; \ No newline at end of file +var _0xe8f1=['ioredis','../../mysqldb','rpc','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueueReport','create','body','options','then','CreateSmsQueueReport','catch','UpdateSmsQueueReport','update','raw','where','attributes','limit','lodash','moment','randomstring'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xe8f1,0xdd));var _0x1e8f=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xe8f1[_0xe39824];return _0x4bc31e;};'use strict';var _=require(_0x1e8f('0x0'));var util=require('util');var moment=require(_0x1e8f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e8f('0x2'));var fs=require('fs');var Redis=require(_0x1e8f('0x3'));var db=require(_0x1e8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e8f('0x5'));var config=require('../../config/environment');var jayson=require(_0x1e8f('0x6'));var client=jayson[_0x1e8f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e503,_0xb43570,_0x475b08){return new BPromise(function(_0x8d65a3,_0xbf86f7){return client[_0x1e8f('0x8')](_0x33e503,_0x475b08)['then'](function(_0x11bfcc){logger[_0x1e8f('0x9')](_0x1e8f('0xa'),_0xb43570,_0x1e8f('0xb'));logger[_0x1e8f('0xc')](_0x1e8f('0xd'),_0xb43570,_0x1e8f('0xb'),JSON[_0x1e8f('0xe')](_0x11bfcc));if(_0x11bfcc[_0x1e8f('0xf')]){if(_0x11bfcc['error'][_0x1e8f('0x10')]===0x1f4){logger[_0x1e8f('0xf')](_0x1e8f('0xa'),_0xb43570,_0x11bfcc['error'][_0x1e8f('0x11')]);return _0xbf86f7(_0x11bfcc['error'][_0x1e8f('0x11')]);}logger[_0x1e8f('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xb43570,_0x11bfcc[_0x1e8f('0xf')]['message']);return _0x8d65a3(_0x11bfcc[_0x1e8f('0xf')]['message']);}else{logger['info'](_0x1e8f('0xa'),_0xb43570,_0x1e8f('0xb'));_0x8d65a3(_0x11bfcc[_0x1e8f('0x12')][_0x1e8f('0x11')]);}})['catch'](function(_0x416504){logger[_0x1e8f('0xf')](_0x1e8f('0xa'),_0xb43570,_0x416504);_0xbf86f7(_0x416504);});});}exports['CreateSmsQueueReport']=function(_0x5580ae){var _0xeded76=this;return new Promise(function(_0x4f38ff,_0x248c47){return db[_0x1e8f('0x13')][_0x1e8f('0x14')](_0x5580ae[_0x1e8f('0x15')],{'raw':_0x5580ae[_0x1e8f('0x16')]?_0x5580ae[_0x1e8f('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1e8f('0x17')](function(_0x4b9684){logger[_0x1e8f('0x9')](_0x1e8f('0x18'),_0x5580ae);logger[_0x1e8f('0xc')](_0x1e8f('0x18'),_0x5580ae,JSON['stringify'](_0x4b9684));_0x4f38ff(_0x4b9684);})[_0x1e8f('0x19')](function(_0x182c8a){logger[_0x1e8f('0xf')]('CreateSmsQueueReport',_0x182c8a[_0x1e8f('0x11')],_0x5580ae);_0x248c47(_0xeded76[_0x1e8f('0xf')](0x1f4,_0x182c8a['message']));});});};exports[_0x1e8f('0x1a')]=function(_0x589d89){var _0x3827f5=this;return new Promise(function(_0x406602,_0x3129c2){return db[_0x1e8f('0x13')][_0x1e8f('0x1b')](_0x589d89[_0x1e8f('0x15')],{'raw':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1d')]||null:null,'attributes':_0x589d89['options']?_0x589d89['options'][_0x1e8f('0x1e')]||null:null,'limit':_0x589d89[_0x1e8f('0x16')]?_0x589d89[_0x1e8f('0x16')][_0x1e8f('0x1f')]||null:null})[_0x1e8f('0x17')](function(_0x4ddba8){logger[_0x1e8f('0x9')](_0x1e8f('0x1a'),_0x589d89);logger[_0x1e8f('0xc')]('UpdateSmsQueueReport',_0x589d89,JSON[_0x1e8f('0xe')](_0x4ddba8));_0x406602(_0x4ddba8);})[_0x1e8f('0x19')](function(_0x3fe80f){logger[_0x1e8f('0xf')](_0x1e8f('0x1a'),_0x3fe80f[_0x1e8f('0x11')],_0x589d89);_0x3129c2(_0x3827f5['error'](0x1f4,_0x3fe80f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index eb49a9b..7ed51b2 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 _0xe132=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe132,0x162));var _0x2e13=function(_0x37167c,_0x3ad7f2){_0x37167c=_0x37167c-0x0;var _0xfbf094=_0xe132[_0x37167c];return _0xfbf094;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0xf')]);router[_0x2e13('0x10')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x11')]);router[_0x2e13('0x12')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);module[_0x2e13('0x14')]=router; \ No newline at end of file +var _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x104ac8,_0x106512){var _0x241cb6=function(_0x8d2c66){while(--_0x8d2c66){_0x104ac8['push'](_0x104ac8['shift']());}};_0x241cb6(++_0x106512);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xfd7b[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['get'](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x10')]);router[_0xbfd7('0x11')]('/',auth['isAuthenticated'](),controller[_0xbfd7('0x12')]);router[_0xbfd7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x14')]);router[_0xbfd7('0x15')](_0xbfd7('0xf'),auth[_0xbfd7('0xb')](),controller[_0xbfd7('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7e183d2..ab7d958 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x378aa0,_0x70a67f){var _0x5006db=function(_0x30b350){while(--_0x30b350){_0x378aa0['push'](_0x378aa0['shift']());}};_0x5006db(++_0x70a67f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xf3cd[_0x38854e];return _0x3f8415;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3ff310,_0x195f71){var _0x4f7909=function(_0x758292){while(--_0x758292){_0x3ff310['push'](_0x3ff310['shift']());}};_0x4f7909(++_0x195f71);}(_0x70e0,0x17b));var _0x070e=function(_0x1fad82,_0xb54ae9){_0x1fad82=_0x1fad82-0x0;var _0x2db911=_0x70e0[_0x1fad82];return _0x2db911;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 9ae28c4..3388ba6 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 _0x5232=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','include','SmsTransferReport','findAll','show','params','includeAll','options','catch','create','body','update','find'];(function(_0x1b1516,_0x17a510){var _0x14902e=function(_0x573007){while(--_0x573007){_0x1b1516['push'](_0x1b1516['shift']());}};_0x14902e(++_0x17a510);}(_0x5232,0x1c9));var _0x2523=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x5232[_0x5e7514];return _0x12f472;};'use strict';var emlformat=require(_0x2523('0x0'));var rimraf=require(_0x2523('0x1'));var zipdir=require(_0x2523('0x2'));var jsonpatch=require(_0x2523('0x3'));var rp=require(_0x2523('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2523('0x5'));var util=require(_0x2523('0x6'));var path=require('path');var sox=require(_0x2523('0x7'));var csv=require(_0x2523('0x8'));var ejs=require(_0x2523('0x9'));var fs=require('fs');var fs_extra=require(_0x2523('0xa'));var _=require(_0x2523('0xb'));var squel=require(_0x2523('0xc'));var crypto=require(_0x2523('0xd'));var jsforce=require(_0x2523('0xe'));var deskjs=require(_0x2523('0xf'));var toCsv=require(_0x2523('0x8'));var querystring=require(_0x2523('0x10'));var Papa=require(_0x2523('0x11'));var Redis=require('ioredis');var authService=require(_0x2523('0x12'));var qs=require(_0x2523('0x13'));var as=require(_0x2523('0x14'));var hardwareService=require(_0x2523('0x15'));var logger=require(_0x2523('0x16'))(_0x2523('0x17'));var utils=require('../../config/utils');var config=require(_0x2523('0x18'));var licenseUtil=require(_0x2523('0x19'));var db=require(_0x2523('0x1a'))['db'];function respondWithStatusCode(_0x99685a,_0x5176d5){_0x5176d5=_0x5176d5||0xcc;return function(_0x37f270){if(_0x37f270){return _0x99685a[_0x2523('0x1b')](_0x5176d5);}return _0x99685a['status'](_0x5176d5)[_0x2523('0x1c')]();};}function respondWithResult(_0x2cd6e1,_0xc9898b){_0xc9898b=_0xc9898b||0xc8;return function(_0xc09a01){if(_0xc09a01){return _0x2cd6e1['status'](_0xc9898b)[_0x2523('0x1d')](_0xc09a01);}};}function respondWithFilteredResult(_0x5974a6,_0x3f9b51){return function(_0x1ac5d3){if(_0x1ac5d3){var _0x173218=typeof _0x3f9b51[_0x2523('0x1e')]==='undefined'&&typeof _0x3f9b51[_0x2523('0x1f')]===_0x2523('0x20');var _0x108159=_0x1ac5d3[_0x2523('0x21')];var _0x1ce828=_0x173218?0x0:_0x3f9b51[_0x2523('0x1e')];var _0x4f2a85=_0x173218?_0x1ac5d3[_0x2523('0x21')]:_0x3f9b51[_0x2523('0x1e')]+_0x3f9b51['limit'];var _0x2819aa;if(_0x4f2a85>=_0x108159){_0x4f2a85=_0x108159;_0x2819aa=0xc8;}else{_0x2819aa=0xce;}_0x5974a6[_0x2523('0x22')](_0x2819aa);return _0x5974a6[_0x2523('0x23')](_0x2523('0x24'),_0x1ce828+'-'+_0x4f2a85+'/'+_0x108159)['json'](_0x1ac5d3);}return null;};}function patchUpdates(_0x4f94c9){return function(_0x4e9498){try{jsonpatch['apply'](_0x4e9498,_0x4f94c9,!![]);}catch(_0x1d52dc){return BPromise[_0x2523('0x25')](_0x1d52dc);}return _0x4e9498[_0x2523('0x26')]();};}function saveUpdates(_0x3baae5,_0x1c39d8){return function(_0x578a83){if(_0x578a83){return _0x578a83['update'](_0x3baae5)['then'](function(_0x50e34e){return _0x50e34e;});}return null;};}function removeEntity(_0x14a685,_0x4847c1){return function(_0x4fc304){if(_0x4fc304){return _0x4fc304['destroy']()[_0x2523('0x27')](function(){_0x14a685[_0x2523('0x22')](0xcc)[_0x2523('0x1c')]();});}};}function handleEntityNotFound(_0x393956,_0xd47858){return function(_0x5495f4){if(!_0x5495f4){_0x393956[_0x2523('0x1b')](0x194);}return _0x5495f4;};}function handleError(_0x45366f,_0x3a8b48){_0x3a8b48=_0x3a8b48||0x1f4;return function(_0x1a8b0c){logger[_0x2523('0x28')](_0x1a8b0c[_0x2523('0x29')]);if(_0x1a8b0c[_0x2523('0x2a')]){delete _0x1a8b0c[_0x2523('0x2a')];}_0x45366f[_0x2523('0x22')](_0x3a8b48)['send'](_0x1a8b0c);};}exports[_0x2523('0x2b')]=function(_0x1565a8,_0x53b772){var _0x304dd4={},_0x52b25d={},_0x4cb11f={'count':0x0,'rows':[]};var _0x5e0ada=_[_0x2523('0x2c')](db['SmsTransferReport'][_0x2523('0x2d')],function(_0x577c90){return{'name':_0x577c90[_0x2523('0x2e')],'type':_0x577c90[_0x2523('0x2f')]['key']};});_0x52b25d[_0x2523('0x30')]=_['map'](_0x5e0ada,_0x2523('0x2a'));_0x52b25d[_0x2523('0x31')]=_[_0x2523('0x32')](_0x1565a8[_0x2523('0x31')]);_0x52b25d[_0x2523('0x33')]=_[_0x2523('0x34')](_0x52b25d['model'],_0x52b25d[_0x2523('0x31')]);_0x304dd4[_0x2523('0x35')]=_[_0x2523('0x34')](_0x52b25d['model'],qs[_0x2523('0x36')](_0x1565a8['query'][_0x2523('0x36')]));_0x304dd4[_0x2523('0x35')]=_0x304dd4[_0x2523('0x35')][_0x2523('0x37')]?_0x304dd4[_0x2523('0x35')]:_0x52b25d[_0x2523('0x30')];if(!_0x1565a8[_0x2523('0x31')]['hasOwnProperty'](_0x2523('0x38'))){_0x304dd4[_0x2523('0x1f')]=qs[_0x2523('0x1f')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1f')]);_0x304dd4['offset']=qs[_0x2523('0x1e')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1e')]);}_0x304dd4[_0x2523('0x39')]=qs['sort'](_0x1565a8[_0x2523('0x31')]['sort']);_0x304dd4[_0x2523('0x3a')]=qs['filters'](_[_0x2523('0x3b')](_0x1565a8[_0x2523('0x31')],_0x52b25d[_0x2523('0x33')]),_0x5e0ada);if(_0x1565a8[_0x2523('0x31')][_0x2523('0x3c')]){_0x304dd4[_0x2523('0x3a')]=_[_0x2523('0x3d')](_0x304dd4[_0x2523('0x3a')],{'$or':_['map'](_0x5e0ada,function(_0x24aea8){if(_0x24aea8[_0x2523('0x2f')]!==_0x2523('0x3e')){var _0x2cd540={};_0x2cd540[_0x24aea8[_0x2523('0x2a')]]={'$like':'%'+_0x1565a8['query'][_0x2523('0x3c')]+'%'};return _0x2cd540;}})});}_0x304dd4=_[_0x2523('0x3d')]({},_0x304dd4,_0x1565a8['options']);var _0x4a5171={'where':_0x304dd4[_0x2523('0x3a')]};return db['SmsTransferReport'][_0x2523('0x21')](_0x4a5171)[_0x2523('0x27')](function(_0x200a6d){_0x4cb11f[_0x2523('0x21')]=_0x200a6d;if(_0x1565a8['query']['includeAll']){_0x304dd4[_0x2523('0x3f')]=[{'all':!![]}];}return db[_0x2523('0x40')][_0x2523('0x41')](_0x304dd4);})[_0x2523('0x27')](function(_0x14104c){_0x4cb11f['rows']=_0x14104c;return _0x4cb11f;})['then'](respondWithFilteredResult(_0x53b772,_0x304dd4))['catch'](handleError(_0x53b772,null));};exports[_0x2523('0x42')]=function(_0x19f453,_0xceff81){var _0x574e6e={'raw':!![],'where':{'id':_0x19f453[_0x2523('0x43')]['id']}},_0x24e0e1={};_0x24e0e1['model']=_[_0x2523('0x32')](db[_0x2523('0x40')][_0x2523('0x2d')]);_0x24e0e1[_0x2523('0x31')]=_[_0x2523('0x32')](_0x19f453['query']);_0x24e0e1[_0x2523('0x33')]=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],_0x24e0e1[_0x2523('0x31')]);_0x574e6e['attributes']=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],qs[_0x2523('0x36')](_0x19f453[_0x2523('0x31')]['fields']));_0x574e6e['attributes']=_0x574e6e[_0x2523('0x35')]['length']?_0x574e6e[_0x2523('0x35')]:_0x24e0e1[_0x2523('0x30')];if(_0x19f453[_0x2523('0x31')][_0x2523('0x44')]){_0x574e6e[_0x2523('0x3f')]=[{'all':!![]}];}_0x574e6e=_['merge']({},_0x574e6e,_0x19f453[_0x2523('0x45')]);return db[_0x2523('0x40')]['find'](_0x574e6e)[_0x2523('0x27')](handleEntityNotFound(_0xceff81,null))[_0x2523('0x27')](respondWithResult(_0xceff81,null))[_0x2523('0x46')](handleError(_0xceff81,null));};exports['create']=function(_0x337993,_0x1a1268){return db[_0x2523('0x40')][_0x2523('0x47')](_0x337993[_0x2523('0x48')],{})['then'](respondWithResult(_0x1a1268,0xc9))[_0x2523('0x46')](handleError(_0x1a1268,null));};exports[_0x2523('0x49')]=function(_0x4d0727,_0x569caa){if(_0x4d0727['body']['id']){delete _0x4d0727['body']['id'];}return db[_0x2523('0x40')][_0x2523('0x4a')]({'where':{'id':_0x4d0727[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x569caa,null))[_0x2523('0x27')](saveUpdates(_0x4d0727[_0x2523('0x48')],null))[_0x2523('0x27')](respondWithResult(_0x569caa,null))['catch'](handleError(_0x569caa,null));};exports['destroy']=function(_0x5ec3e2,_0x66d07c){return db[_0x2523('0x40')]['find']({'where':{'id':_0x5ec3e2[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x66d07c,null))[_0x2523('0x27')](removeEntity(_0x66d07c,null))['catch'](handleError(_0x66d07c,null));};exports[_0x2523('0x4b')]=function(_0x7de3e8,_0x22ad10){return db['SmsTransferReport']['describe']()[_0x2523('0x27')](respondWithResult(_0x22ad10,null))[_0x2523('0x46')](handleError(_0x22ad10,null));}; \ No newline at end of file +var _0x36d2=['filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','update','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','then','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x59f67c,_0x2330d3){var _0x2b8d8=function(_0x4570ca){while(--_0x4570ca){_0x59f67c['push'](_0x59f67c['shift']());}};_0x2b8d8(++_0x2330d3);}(_0x36d2,0xa2));var _0x236d=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x36d2[_0x277107];return _0x1da046;};'use strict';var emlformat=require(_0x236d('0x0'));var rimraf=require(_0x236d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x236d('0x2'));var moment=require(_0x236d('0x3'));var BPromise=require(_0x236d('0x4'));var Mustache=require(_0x236d('0x5'));var util=require('util');var path=require(_0x236d('0x6'));var sox=require(_0x236d('0x7'));var csv=require(_0x236d('0x8'));var ejs=require(_0x236d('0x9'));var fs=require('fs');var fs_extra=require(_0x236d('0xa'));var _=require(_0x236d('0xb'));var squel=require(_0x236d('0xc'));var crypto=require('crypto');var jsforce=require(_0x236d('0xd'));var deskjs=require(_0x236d('0xe'));var toCsv=require(_0x236d('0x8'));var querystring=require(_0x236d('0xf'));var Papa=require(_0x236d('0x10'));var Redis=require(_0x236d('0x11'));var authService=require(_0x236d('0x12'));var qs=require(_0x236d('0x13'));var as=require(_0x236d('0x14'));var hardwareService=require(_0x236d('0x15'));var logger=require(_0x236d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x236d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x236d('0x18'))['db'];function respondWithStatusCode(_0x232ec9,_0x2969f1){_0x2969f1=_0x2969f1||0xcc;return function(_0x1859d7){if(_0x1859d7){return _0x232ec9[_0x236d('0x19')](_0x2969f1);}return _0x232ec9[_0x236d('0x1a')](_0x2969f1)['end']();};}function respondWithResult(_0x417ee7,_0x23935a){_0x23935a=_0x23935a||0xc8;return function(_0x2c9580){if(_0x2c9580){return _0x417ee7[_0x236d('0x1a')](_0x23935a)[_0x236d('0x1b')](_0x2c9580);}};}function respondWithFilteredResult(_0x30ba50,_0x11cc7f){return function(_0x1ac2f0){if(_0x1ac2f0){var _0x41727e=typeof _0x11cc7f[_0x236d('0x1c')]===_0x236d('0x1d')&&typeof _0x11cc7f[_0x236d('0x1e')]===_0x236d('0x1d');var _0x285ead=_0x1ac2f0[_0x236d('0x1f')];var _0x3e06b9=_0x41727e?0x0:_0x11cc7f[_0x236d('0x1c')];var _0x59c80e=_0x41727e?_0x1ac2f0[_0x236d('0x1f')]:_0x11cc7f[_0x236d('0x1c')]+_0x11cc7f['limit'];var _0xe396cc;if(_0x59c80e>=_0x285ead){_0x59c80e=_0x285ead;_0xe396cc=0xc8;}else{_0xe396cc=0xce;}_0x30ba50[_0x236d('0x1a')](_0xe396cc);return _0x30ba50[_0x236d('0x20')]('Content-Range',_0x3e06b9+'-'+_0x59c80e+'/'+_0x285ead)[_0x236d('0x1b')](_0x1ac2f0);}return null;};}function patchUpdates(_0x4e2570){return function(_0x2256bf){try{jsonpatch[_0x236d('0x21')](_0x2256bf,_0x4e2570,!![]);}catch(_0x222c9){return BPromise[_0x236d('0x22')](_0x222c9);}return _0x2256bf['save']();};}function saveUpdates(_0x2a899d,_0x541945){return function(_0x2ca2c6){if(_0x2ca2c6){return _0x2ca2c6['update'](_0x2a899d)[_0x236d('0x23')](function(_0x1fce61){return _0x1fce61;});}return null;};}function removeEntity(_0x2abdd1,_0x33e934){return function(_0x581baf){if(_0x581baf){return _0x581baf['destroy']()[_0x236d('0x23')](function(){_0x2abdd1[_0x236d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb1c89,_0xa4663e){return function(_0x3b6708){if(!_0x3b6708){_0xfb1c89[_0x236d('0x19')](0x194);}return _0x3b6708;};}function handleError(_0x16547f,_0x529964){_0x529964=_0x529964||0x1f4;return function(_0x5ac4af){logger['error'](_0x5ac4af['stack']);if(_0x5ac4af['name']){delete _0x5ac4af[_0x236d('0x24')];}_0x16547f[_0x236d('0x1a')](_0x529964)[_0x236d('0x25')](_0x5ac4af);};}exports['index']=function(_0x50e7ab,_0x23c5c9){var _0x1e75a2={},_0x4fe897={},_0x4a3845={'count':0x0,'rows':[]};var _0x4283bb=_[_0x236d('0x26')](db[_0x236d('0x27')][_0x236d('0x28')],function(_0x2abec5){return{'name':_0x2abec5[_0x236d('0x29')],'type':_0x2abec5[_0x236d('0x2a')][_0x236d('0x2b')]};});_0x4fe897[_0x236d('0x2c')]=_[_0x236d('0x26')](_0x4283bb,_0x236d('0x24'));_0x4fe897[_0x236d('0x2d')]=_[_0x236d('0x2e')](_0x50e7ab[_0x236d('0x2d')]);_0x4fe897[_0x236d('0x2f')]=_[_0x236d('0x30')](_0x4fe897[_0x236d('0x2c')],_0x4fe897[_0x236d('0x2d')]);_0x1e75a2[_0x236d('0x31')]=_[_0x236d('0x30')](_0x4fe897[_0x236d('0x2c')],qs['fields'](_0x50e7ab[_0x236d('0x2d')][_0x236d('0x32')]));_0x1e75a2['attributes']=_0x1e75a2['attributes'][_0x236d('0x33')]?_0x1e75a2[_0x236d('0x31')]:_0x4fe897['model'];if(!_0x50e7ab[_0x236d('0x2d')]['hasOwnProperty'](_0x236d('0x34'))){_0x1e75a2[_0x236d('0x1e')]=qs['limit'](_0x50e7ab['query'][_0x236d('0x1e')]);_0x1e75a2[_0x236d('0x1c')]=qs[_0x236d('0x1c')](_0x50e7ab[_0x236d('0x2d')][_0x236d('0x1c')]);}_0x1e75a2[_0x236d('0x35')]=qs[_0x236d('0x36')](_0x50e7ab[_0x236d('0x2d')]['sort']);_0x1e75a2[_0x236d('0x37')]=qs[_0x236d('0x2f')](_[_0x236d('0x38')](_0x50e7ab[_0x236d('0x2d')],_0x4fe897[_0x236d('0x2f')]),_0x4283bb);if(_0x50e7ab[_0x236d('0x2d')][_0x236d('0x39')]){_0x1e75a2[_0x236d('0x37')]=_[_0x236d('0x3a')](_0x1e75a2['where'],{'$or':_['map'](_0x4283bb,function(_0x30b1e6){if(_0x30b1e6[_0x236d('0x2a')]!==_0x236d('0x3b')){var _0x23414c={};_0x23414c[_0x30b1e6['name']]={'$like':'%'+_0x50e7ab[_0x236d('0x2d')][_0x236d('0x39')]+'%'};return _0x23414c;}})});}_0x1e75a2=_[_0x236d('0x3a')]({},_0x1e75a2,_0x50e7ab['options']);var _0x98c594={'where':_0x1e75a2['where']};return db['SmsTransferReport']['count'](_0x98c594)['then'](function(_0x50363d){_0x4a3845[_0x236d('0x1f')]=_0x50363d;if(_0x50e7ab['query'][_0x236d('0x3c')]){_0x1e75a2[_0x236d('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x236d('0x3e')](_0x1e75a2);})[_0x236d('0x23')](function(_0x530996){_0x4a3845[_0x236d('0x3f')]=_0x530996;return _0x4a3845;})[_0x236d('0x23')](respondWithFilteredResult(_0x23c5c9,_0x1e75a2))[_0x236d('0x40')](handleError(_0x23c5c9,null));};exports['show']=function(_0x4cae1c,_0x44bd92){var _0xf108e6={'raw':!![],'where':{'id':_0x4cae1c[_0x236d('0x41')]['id']}},_0x529941={};_0x529941[_0x236d('0x2c')]=_[_0x236d('0x2e')](db[_0x236d('0x27')][_0x236d('0x28')]);_0x529941[_0x236d('0x2d')]=_['keys'](_0x4cae1c[_0x236d('0x2d')]);_0x529941['filters']=_['intersection'](_0x529941[_0x236d('0x2c')],_0x529941[_0x236d('0x2d')]);_0xf108e6[_0x236d('0x31')]=_[_0x236d('0x30')](_0x529941['model'],qs[_0x236d('0x32')](_0x4cae1c['query'][_0x236d('0x32')]));_0xf108e6[_0x236d('0x31')]=_0xf108e6[_0x236d('0x31')][_0x236d('0x33')]?_0xf108e6[_0x236d('0x31')]:_0x529941[_0x236d('0x2c')];if(_0x4cae1c[_0x236d('0x2d')][_0x236d('0x3c')]){_0xf108e6[_0x236d('0x3d')]=[{'all':!![]}];}_0xf108e6=_[_0x236d('0x3a')]({},_0xf108e6,_0x4cae1c[_0x236d('0x42')]);return db[_0x236d('0x27')][_0x236d('0x43')](_0xf108e6)[_0x236d('0x23')](handleEntityNotFound(_0x44bd92,null))[_0x236d('0x23')](respondWithResult(_0x44bd92,null))[_0x236d('0x40')](handleError(_0x44bd92,null));};exports[_0x236d('0x44')]=function(_0x22a843,_0x32ab44){return db[_0x236d('0x27')][_0x236d('0x44')](_0x22a843['body'],{})[_0x236d('0x23')](respondWithResult(_0x32ab44,0xc9))[_0x236d('0x40')](handleError(_0x32ab44,null));};exports[_0x236d('0x45')]=function(_0x3b4c97,_0x4cc58f){if(_0x3b4c97[_0x236d('0x46')]['id']){delete _0x3b4c97[_0x236d('0x46')]['id'];}return db[_0x236d('0x27')]['find']({'where':{'id':_0x3b4c97[_0x236d('0x41')]['id']}})[_0x236d('0x23')](handleEntityNotFound(_0x4cc58f,null))['then'](saveUpdates(_0x3b4c97[_0x236d('0x46')],null))[_0x236d('0x23')](respondWithResult(_0x4cc58f,null))[_0x236d('0x40')](handleError(_0x4cc58f,null));};exports[_0x236d('0x47')]=function(_0x34fb44,_0x21c687){return db['SmsTransferReport']['find']({'where':{'id':_0x34fb44['params']['id']}})['then'](handleEntityNotFound(_0x21c687,null))['then'](removeEntity(_0x21c687,null))[_0x236d('0x40')](handleError(_0x21c687,null));};exports[_0x236d('0x48')]=function(_0x5d5799,_0x8f5205){return db['SmsTransferReport'][_0x236d('0x48')]()[_0x236d('0x23')](respondWithResult(_0x8f5205,null))[_0x236d('0x40')](handleError(_0x8f5205,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 99cbb37..9f0202c 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 _0x8939=['uniqueid','util','../../config/logger','api','bluebird','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer'];(function(_0x5292f7,_0x166703){var _0xf7d612=function(_0x13fda5){while(--_0x13fda5){_0x5292f7['push'](_0x5292f7['shift']());}};_0xf7d612(++_0x166703);}(_0x8939,0x12d));var _0x9893=function(_0x3481b8,_0x1cb647){_0x3481b8=_0x3481b8-0x0;var _0xe69794=_0x8939[_0x3481b8];return _0xe69794;};'use strict';var _=require('lodash');var util=require(_0x9893('0x0'));var logger=require(_0x9893('0x1'))(_0x9893('0x2'));var moment=require('moment');var BPromise=require(_0x9893('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9893('0x4'));var rimraf=require(_0x9893('0x5'));var config=require('../../config/environment');var attributes=require(_0x9893('0x6'));module[_0x9893('0x7')]=function(_0x5aee08,_0x1e1654){return _0x5aee08[_0x9893('0x8')](_0x9893('0x9'),attributes,{'tableName':_0x9893('0xa'),'paranoid':![],'indexes':[{'name':_0x9893('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a8=['report_sms_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x2401ee,_0x342ee6){var _0x51f7e1=function(_0x2990bc){while(--_0x2990bc){_0x2401ee['push'](_0x2401ee['shift']());}};_0x51f7e1(++_0x342ee6);}(_0xb7a8,0xec));var _0x8b7a=function(_0x780386,_0xb34541){_0x780386=_0x780386-0x0;var _0x4987a1=_0xb7a8[_0x780386];return _0x4987a1;};'use strict';var _=require('lodash');var util=require(_0x8b7a('0x0'));var logger=require(_0x8b7a('0x1'))('api');var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rp=require(_0x8b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var attributes=require(_0x8b7a('0x7'));module[_0x8b7a('0x8')]=function(_0x1d61f3,_0x42e4c1){return _0x1d61f3[_0x8b7a('0x9')](_0x8b7a('0xa'),attributes,{'tableName':_0x8b7a('0xb'),'paranoid':![],'indexes':[{'name':_0x8b7a('0xc'),'fields':[_0x8b7a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 034e8ff..e9ba684 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 _0xc0a4=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4536a4,_0x55af7b){var _0x4fd1c1=function(_0x4c68cd){while(--_0x4c68cd){_0x4536a4['push'](_0x4536a4['shift']());}};_0x4fd1c1(++_0x55af7b);}(_0xc0a4,0x147));var _0x4c0a=function(_0x5ec41b,_0x3e2d08){_0x5ec41b=_0x5ec41b-0x0;var _0x4fad0b=_0xc0a4[_0x5ec41b];return _0x4fad0b;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var moment=require(_0x4c0a('0x1'));var BPromise=require(_0x4c0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0a('0x3'));var db=require(_0x4c0a('0x4'))['db'];var utils=require(_0x4c0a('0x5'));var logger=require(_0x4c0a('0x6'))(_0x4c0a('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c0a('0x8'));var client=jayson[_0x4c0a('0x9')][_0x4c0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x457ef9,_0x7ca892,_0x1a64e7){return new BPromise(function(_0x4093d5,_0x33aedb){return client[_0x4c0a('0xb')](_0x457ef9,_0x1a64e7)['then'](function(_0x3bfa91){logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));logger[_0x4c0a('0xf')](_0x4c0a('0x10'),_0x7ca892,_0x4c0a('0xe'),JSON[_0x4c0a('0x11')](_0x3bfa91));if(_0x3bfa91[_0x4c0a('0x12')]){if(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x13')]===0x1f4){logger[_0x4c0a('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x33aedb(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}logger['error'](_0x4c0a('0xd'),_0x7ca892,_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);return _0x4093d5(_0x3bfa91[_0x4c0a('0x12')][_0x4c0a('0x14')]);}else{logger[_0x4c0a('0xc')](_0x4c0a('0xd'),_0x7ca892,_0x4c0a('0xe'));_0x4093d5(_0x3bfa91[_0x4c0a('0x15')][_0x4c0a('0x14')]);}})[_0x4c0a('0x16')](function(_0x4637a8){logger[_0x4c0a('0x12')](_0x4c0a('0xd'),_0x7ca892,_0x4637a8);_0x33aedb(_0x4637a8);});});} \ No newline at end of file +var _0x4ce6=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x5d18e3,_0x59a263){var _0x548643=function(_0x5d9a06){while(--_0x5d9a06){_0x5d18e3['push'](_0x5d18e3['shift']());}};_0x548643(++_0x59a263);}(_0x4ce6,0x108));var _0x64ce=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x4ce6[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var moment=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var rs=require(_0x64ce('0x3'));var fs=require('fs');var Redis=require(_0x64ce('0x4'));var db=require(_0x64ce('0x5'))['db'];var utils=require(_0x64ce('0x6'));var logger=require('../../config/logger')(_0x64ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x64ce('0x8')][_0x64ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b8f2d,_0x538b74,_0x3c279f){return new BPromise(function(_0x134230,_0x1b253e){return client[_0x64ce('0xa')](_0x5b8f2d,_0x3c279f)[_0x64ce('0xb')](function(_0x135482){logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));logger['debug'](_0x64ce('0xf'),_0x538b74,_0x64ce('0xe'),JSON[_0x64ce('0x10')](_0x135482));if(_0x135482[_0x64ce('0x11')]){if(_0x135482[_0x64ce('0x11')][_0x64ce('0x12')]===0x1f4){logger[_0x64ce('0x11')](_0x64ce('0xd'),_0x538b74,_0x135482['error'][_0x64ce('0x13')]);return _0x1b253e(_0x135482['error']['message']);}logger[_0x64ce('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x538b74,_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);return _0x134230(_0x135482[_0x64ce('0x11')][_0x64ce('0x13')]);}else{logger[_0x64ce('0xc')](_0x64ce('0xd'),_0x538b74,_0x64ce('0xe'));_0x134230(_0x135482[_0x64ce('0x14')][_0x64ce('0x13')]);}})['catch'](function(_0x4b49be){logger['error'](_0x64ce('0xd'),_0x538b74,_0x4b49be);_0x1b253e(_0x4b49be);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3e4ded3..ef0d2e0 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 _0x1b06=['show','get','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','single','file','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x1b06,0x15e));var _0x61b0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1b06[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x61b0('0x0'));var util=require(_0x61b0('0x1'));var path=require(_0x61b0('0x2'));var timeout=require(_0x61b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x61b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x61b0('0x5'));var controller=require(_0x61b0('0x6'));router['get']('/',auth[_0x61b0('0x7')](),controller[_0x61b0('0x8')]);router['get'](_0x61b0('0x9'),auth['isAuthenticated'](),controller[_0x61b0('0xa')]);router[_0x61b0('0xb')](_0x61b0('0xc'),auth[_0x61b0('0x7')](),controller[_0x61b0('0xd')]);var upload=multer({'storage':multer[_0x61b0('0xe')]({'destination':function(_0x2295f7,_0x2097ef,_0x33cedc){_0x33cedc(null,path[_0x61b0('0xf')](config[_0x61b0('0x10')],'server/files/sounds/original/'));},'filename':function(_0x41e8f7,_0x7ea669,_0x18c42d){_0x7ea669[_0x61b0('0x11')]=_0x7ea669[_0x61b0('0x11')][_0x61b0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x18c42d(null,util[_0x61b0('0x13')](_0x61b0('0x14'),path['basename'](_0x7ea669[_0x61b0('0x11')],path[_0x61b0('0x15')](_0x7ea669[_0x61b0('0x11')])),Date[_0x61b0('0x16')](),path['extname'](_0x7ea669[_0x61b0('0x11')])));}})});router[_0x61b0('0x17')]('/',upload[_0x61b0('0x18')](_0x61b0('0x19')),controller['create']);router[_0x61b0('0x1a')](_0x61b0('0x9'),auth[_0x61b0('0x7')](),controller[_0x61b0('0x1b')]);router[_0x61b0('0x1c')](_0x61b0('0x9'),auth[_0x61b0('0x7')](),controller[_0x61b0('0x1c')]);module[_0x61b0('0x1d')]=router; \ No newline at end of file +var _0xf1cd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','connect-timeout','Router'];(function(_0x1c5cd2,_0x277ceb){var _0x895e35=function(_0x4b4307){while(--_0x4b4307){_0x1c5cd2['push'](_0x1c5cd2['shift']());}};_0x895e35(++_0x277ceb);}(_0xf1cd,0xdc));var _0xdf1c=function(_0x1d3f4e,_0x1b7cbb){_0x1d3f4e=_0x1d3f4e-0x0;var _0x36105b=_0xf1cd[_0x1d3f4e];return _0x36105b;};'use strict';var multer=require(_0xdf1c('0x0'));var util=require(_0xdf1c('0x1'));var path=require('path');var timeout=require(_0xdf1c('0x2'));var express=require('express');var router=express[_0xdf1c('0x3')]();var fs_extra=require(_0xdf1c('0x4'));var auth=require(_0xdf1c('0x5'));var interaction=require(_0xdf1c('0x6'));var config=require(_0xdf1c('0x7'));var controller=require(_0xdf1c('0x8'));router[_0xdf1c('0x9')]('/',auth[_0xdf1c('0xa')](),controller[_0xdf1c('0xb')]);router[_0xdf1c('0x9')](_0xdf1c('0xc'),auth[_0xdf1c('0xa')](),controller['show']);router['get'](_0xdf1c('0xd'),auth[_0xdf1c('0xa')](),controller[_0xdf1c('0xe')]);var upload=multer({'storage':multer[_0xdf1c('0xf')]({'destination':function(_0x24b696,_0xb31119,_0x3f6475){_0x3f6475(null,path['join'](config['root'],_0xdf1c('0x10')));},'filename':function(_0x41d5fd,_0x35bedc,_0x1078b8){_0x35bedc[_0xdf1c('0x11')]=_0x35bedc[_0xdf1c('0x11')][_0xdf1c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1078b8(null,util[_0xdf1c('0x13')](_0xdf1c('0x14'),path[_0xdf1c('0x15')](_0x35bedc[_0xdf1c('0x11')],path[_0xdf1c('0x16')](_0x35bedc[_0xdf1c('0x11')])),Date[_0xdf1c('0x17')](),path[_0xdf1c('0x16')](_0x35bedc['originalname'])));}})});router[_0xdf1c('0x18')]('/',upload[_0xdf1c('0x19')](_0xdf1c('0x1a')),controller[_0xdf1c('0x1b')]);router[_0xdf1c('0x1c')]('/:id',auth[_0xdf1c('0xa')](),controller[_0xdf1c('0x1d')]);router[_0xdf1c('0x1e')](_0xdf1c('0xc'),auth[_0xdf1c('0xa')](),controller[_0xdf1c('0x1e')]);module[_0xdf1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index cf42c92..42f0a5a 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 _0x47e7=['name','INTEGER','FLOAT','sequelize','STRING'];(function(_0x1baafb,_0x8b1af5){var _0x1ccb45=function(_0x1351ea){while(--_0x1351ea){_0x1baafb['push'](_0x1baafb['shift']());}};_0x1ccb45(++_0x8b1af5);}(_0x47e7,0xfd));var _0x747e=function(_0x44ecd6,_0x440e22){_0x44ecd6=_0x44ecd6-0x0;var _0x4c9899=_0x47e7[_0x44ecd6];return _0x4c9899;};'use strict';var Sequelize=require(_0x747e('0x0'));module['exports']={'name':{'type':Sequelize[_0x747e('0x1')],'unique':_0x747e('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x747e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x747e('0x1')]},'original_format':{'type':Sequelize[_0x747e('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x747e('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x747e('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x747e('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x747e('0x3')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x747e('0x3')]}}; \ No newline at end of file +var _0x6642=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x6642,0x105));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2664('0x0'));module[_0x2664('0x1')]={'name':{'type':Sequelize[_0x2664('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2664('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2664('0x2')]},'original_duration':{'type':Sequelize[_0x2664('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x2664('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2664('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x2664('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2664('0x5')]},'converted_bitRate':{'type':Sequelize[_0x2664('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2664('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 56d7640..ff16791 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 _0x7183=['channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','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','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','Sounds','UserProfileResource','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','offset','order','sort','where','filter','VIRTUAL','merge','options','Sound','includeAll','include','findAll','rows','catch','params','fields','download','find','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','save_name','create','file','originalname','extname','basename','filename','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount'];(function(_0x1b2bde,_0x32ea63){var _0x1743b9=function(_0x1202ca){while(--_0x1202ca){_0x1b2bde['push'](_0x1b2bde['shift']());}};_0x1743b9(++_0x32ea63);}(_0x7183,0x194));var _0x3718=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7183[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x3718('0x0'));var rimraf=require(_0x3718('0x1'));var zipdir=require(_0x3718('0x2'));var jsonpatch=require(_0x3718('0x3'));var rp=require(_0x3718('0x4'));var moment=require('moment');var BPromise=require(_0x3718('0x5'));var Mustache=require(_0x3718('0x6'));var util=require(_0x3718('0x7'));var path=require('path');var sox=require(_0x3718('0x8'));var csv=require(_0x3718('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3718('0xa'));var squel=require(_0x3718('0xb'));var crypto=require('crypto');var jsforce=require(_0x3718('0xc'));var deskjs=require(_0x3718('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3718('0xe'));var Papa=require(_0x3718('0xf'));var Redis=require(_0x3718('0x10'));var authService=require(_0x3718('0x11'));var qs=require(_0x3718('0x12'));var as=require(_0x3718('0x13'));var hardwareService=require(_0x3718('0x14'));var logger=require(_0x3718('0x15'))(_0x3718('0x16'));var utils=require(_0x3718('0x17'));var config=require(_0x3718('0x18'));var licenseUtil=require(_0x3718('0x19'));var db=require(_0x3718('0x1a'))['db'];function respondWithStatusCode(_0x4dfad8,_0x59d1c1){_0x59d1c1=_0x59d1c1||0xcc;return function(_0x1ea590){if(_0x1ea590){return _0x4dfad8['sendStatus'](_0x59d1c1);}return _0x4dfad8[_0x3718('0x1b')](_0x59d1c1)[_0x3718('0x1c')]();};}function respondWithResult(_0x222d5a,_0x3adace){_0x3adace=_0x3adace||0xc8;return function(_0x12375c){if(_0x12375c){return _0x222d5a['status'](_0x3adace)[_0x3718('0x1d')](_0x12375c);}};}function respondWithFilteredResult(_0x508095,_0x5f43e2){return function(_0x2a450a){if(_0x2a450a){var _0xa95bbf=typeof _0x5f43e2['offset']===_0x3718('0x1e')&&typeof _0x5f43e2[_0x3718('0x1f')]===_0x3718('0x1e');var _0x4b9d54=_0x2a450a[_0x3718('0x20')];var _0x56829c=_0xa95bbf?0x0:_0x5f43e2['offset'];var _0x1f89c7=_0xa95bbf?_0x2a450a['count']:_0x5f43e2['offset']+_0x5f43e2[_0x3718('0x1f')];var _0x106814;if(_0x1f89c7>=_0x4b9d54){_0x1f89c7=_0x4b9d54;_0x106814=0xc8;}else{_0x106814=0xce;}_0x508095[_0x3718('0x1b')](_0x106814);return _0x508095[_0x3718('0x21')](_0x3718('0x22'),_0x56829c+'-'+_0x1f89c7+'/'+_0x4b9d54)[_0x3718('0x1d')](_0x2a450a);}return null;};}function patchUpdates(_0x22f993){return function(_0x25ae6d){try{jsonpatch[_0x3718('0x23')](_0x25ae6d,_0x22f993,!![]);}catch(_0x134e55){return BPromise[_0x3718('0x24')](_0x134e55);}return _0x25ae6d['save']();};}function saveUpdates(_0x2da914,_0x35ea26){return function(_0x460f17){if(_0x460f17){return _0x460f17[_0x3718('0x25')](_0x2da914)[_0x3718('0x26')](function(_0x2885a6){return _0x2885a6;});}return null;};}function removeEntity(_0x962ca2,_0x2d56ef){return function(_0x2d719a){if(_0x2d719a){return _0x2d719a['destroy']()['then'](function(){var _0x2b5b62=_0x2d719a[_0x3718('0x27')]({'plain':!![]});var _0x2c9f3b=_0x3718('0x28');return db[_0x3718('0x29')][_0x3718('0x2a')]({'where':{'type':_0x2c9f3b,'resourceId':_0x2b5b62['id']}})[_0x3718('0x26')](function(){return _0x2d719a;});})[_0x3718('0x26')](function(){_0x962ca2[_0x3718('0x1b')](0xcc)[_0x3718('0x1c')]();});}};}function handleEntityNotFound(_0x2bb942,_0x54306d){return function(_0x7238ba){if(!_0x7238ba){_0x2bb942[_0x3718('0x2b')](0x194);}return _0x7238ba;};}function handleError(_0x208c7c,_0xe6d072){_0xe6d072=_0xe6d072||0x1f4;return function(_0x49c859){logger[_0x3718('0x2c')](_0x49c859['stack']);if(_0x49c859[_0x3718('0x2d')]){delete _0x49c859['name'];}_0x208c7c['status'](_0xe6d072)[_0x3718('0x2e')](_0x49c859);};}exports[_0x3718('0x2f')]=function(_0x16e727,_0x54629a){var _0x511878={},_0x961be3={},_0x5578c7={'count':0x0,'rows':[]};var _0x5c4ea4=_[_0x3718('0x30')](db['Sound'][_0x3718('0x31')],function(_0x264f39){return{'name':_0x264f39[_0x3718('0x32')],'type':_0x264f39[_0x3718('0x33')][_0x3718('0x34')]};});_0x961be3['model']=_[_0x3718('0x30')](_0x5c4ea4,'name');_0x961be3[_0x3718('0x35')]=_[_0x3718('0x36')](_0x16e727['query']);_0x961be3[_0x3718('0x37')]=_[_0x3718('0x38')](_0x961be3[_0x3718('0x39')],_0x961be3[_0x3718('0x35')]);_0x511878[_0x3718('0x3a')]=_[_0x3718('0x38')](_0x961be3[_0x3718('0x39')],qs['fields'](_0x16e727[_0x3718('0x35')]['fields']));_0x511878[_0x3718('0x3a')]=_0x511878['attributes'][_0x3718('0x3b')]?_0x511878[_0x3718('0x3a')]:_0x961be3[_0x3718('0x39')];if(!_0x16e727['query'][_0x3718('0x3c')]('nolimit')){_0x511878[_0x3718('0x1f')]=qs[_0x3718('0x1f')](_0x16e727[_0x3718('0x35')][_0x3718('0x1f')]);_0x511878[_0x3718('0x3d')]=qs[_0x3718('0x3d')](_0x16e727[_0x3718('0x35')][_0x3718('0x3d')]);}_0x511878[_0x3718('0x3e')]=qs[_0x3718('0x3f')](_0x16e727[_0x3718('0x35')][_0x3718('0x3f')]);_0x511878[_0x3718('0x40')]=qs['filters'](_['pick'](_0x16e727[_0x3718('0x35')],_0x961be3[_0x3718('0x37')]),_0x5c4ea4);if(_0x16e727[_0x3718('0x35')][_0x3718('0x41')]){_0x511878[_0x3718('0x40')]=_['merge'](_0x511878[_0x3718('0x40')],{'$or':_[_0x3718('0x30')](_0x5c4ea4,function(_0x350a73){if(_0x350a73[_0x3718('0x33')]!==_0x3718('0x42')){var _0x502812={};_0x502812[_0x350a73[_0x3718('0x2d')]]={'$like':'%'+_0x16e727[_0x3718('0x35')][_0x3718('0x41')]+'%'};return _0x502812;}})});}_0x511878=_[_0x3718('0x43')]({},_0x511878,_0x16e727[_0x3718('0x44')]);var _0x473797={'where':_0x511878[_0x3718('0x40')]};return db[_0x3718('0x45')]['count'](_0x473797)[_0x3718('0x26')](function(_0x196208){_0x5578c7[_0x3718('0x20')]=_0x196208;if(_0x16e727[_0x3718('0x35')][_0x3718('0x46')]){_0x511878[_0x3718('0x47')]=[{'all':!![]}];}return db[_0x3718('0x45')][_0x3718('0x48')](_0x511878);})[_0x3718('0x26')](function(_0x4a4980){_0x5578c7[_0x3718('0x49')]=_0x4a4980;return _0x5578c7;})[_0x3718('0x26')](respondWithFilteredResult(_0x54629a,_0x511878))[_0x3718('0x4a')](handleError(_0x54629a,null));};exports['show']=function(_0x217fe1,_0x3cc21d){var _0x3de8a0={'raw':!![],'where':{'id':_0x217fe1[_0x3718('0x4b')]['id']}},_0x46c969={};_0x46c969[_0x3718('0x39')]=_[_0x3718('0x36')](db[_0x3718('0x45')][_0x3718('0x31')]);_0x46c969[_0x3718('0x35')]=_['keys'](_0x217fe1['query']);_0x46c969[_0x3718('0x37')]=_[_0x3718('0x38')](_0x46c969[_0x3718('0x39')],_0x46c969[_0x3718('0x35')]);_0x3de8a0[_0x3718('0x3a')]=_[_0x3718('0x38')](_0x46c969['model'],qs[_0x3718('0x4c')](_0x217fe1['query'][_0x3718('0x4c')]));_0x3de8a0[_0x3718('0x3a')]=_0x3de8a0[_0x3718('0x3a')]['length']?_0x3de8a0[_0x3718('0x3a')]:_0x46c969[_0x3718('0x39')];if(_0x217fe1[_0x3718('0x35')][_0x3718('0x46')]){_0x3de8a0[_0x3718('0x47')]=[{'all':!![]}];}_0x3de8a0=_[_0x3718('0x43')]({},_0x3de8a0,_0x217fe1[_0x3718('0x44')]);return db['Sound']['find'](_0x3de8a0)['then'](handleEntityNotFound(_0x3cc21d,null))['then'](respondWithResult(_0x3cc21d,null))[_0x3718('0x4a')](handleError(_0x3cc21d,null));};exports[_0x3718('0x4d')]=function(_0x1fb280,_0x4da05b,_0x39b999){return db['Sound'][_0x3718('0x4e')]({'where':{'id':_0x1fb280['params']['id']},'attributes':[_0x3718('0x2d'),'save_name',_0x3718('0x4f')],'raw':!![]})[_0x3718('0x26')](handleEntityNotFound(_0x4da05b,null))[_0x3718('0x26')](function(_0x10f046){if(_0x10f046){if(!fs[_0x3718('0x50')](path[_0x3718('0x51')](config[_0x3718('0x52')],_0x3718('0x53'),_0x10f046['save_name']+'.'+_0x10f046[_0x3718('0x4f')]))){throw new db[(_0x3718('0x54'))][(_0x3718('0x55'))](_0x3718('0x56'));}return _0x4da05b[_0x3718('0x4d')](path[_0x3718('0x51')](config['root'],'server/files/sounds/converted',util['format'](_0x3718('0x57'),_0x10f046[_0x3718('0x58')],_0x10f046['converted_format'])),util['format'](_0x3718('0x57'),_0x10f046['name'],_0x10f046['converted_format']));}return null;})[_0x3718('0x4a')](handleError(_0x4da05b,null));};exports[_0x3718('0x59')]=function(_0x40a477,_0x511b30,_0x59d1dc){var _0x2bbca8={'name':path['basename'](_0x40a477[_0x3718('0x5a')][_0x3718('0x5b')],path[_0x3718('0x5c')](_0x40a477[_0x3718('0x5a')][_0x3718('0x5b')])),'save_name':path[_0x3718('0x5d')](_0x40a477[_0x3718('0x5a')][_0x3718('0x5e')],path['extname'](_0x40a477['file'][_0x3718('0x5e')])),'original_format':path[_0x3718('0x5c')](_0x40a477[_0x3718('0x5a')][_0x3718('0x5b')])['substring'](0x1),'converted_format':_0x3718('0x5f')};var _0x105f20=path['join'](config[_0x3718('0x52')],_0x3718('0x60'),_0x40a477[_0x3718('0x5a')]['filename']);var _0x47f8e7=path[_0x3718('0x51')](config[_0x3718('0x52')],_0x3718('0x53'),util[_0x3718('0x61')](_0x3718('0x57'),path[_0x3718('0x5d')](_0x40a477['file'][_0x3718('0x5e')],path['extname'](_0x40a477[_0x3718('0x5a')][_0x3718('0x5e')])),_0x2bbca8['converted_format']));logger[_0x3718('0x62')](_0x3718('0x63'),_0x105f20);logger[_0x3718('0x62')](_0x3718('0x64'),_0x47f8e7);try{fs[_0x3718('0x65')](_0x105f20,parseInt(_0x3718('0x66'),0x8));var _0x211b17=sox[_0x3718('0x67')](_0x105f20,_0x47f8e7,{'sampleRate':0x1f40,'format':_0x3718('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x211b17['on']('error',function(_0x5d5a9e){fs[_0x3718('0x68')](_0x105f20);_0x511b30[_0x3718('0x1b')](0x1f4)[_0x3718('0x2e')](_0x5d5a9e);});_0x211b17['on'](_0x3718('0x69'),function(_0x4818be){_0x2bbca8['original_duration']=isNaN(_0x4818be['duration'])?null:_0x4818be[_0x3718('0x6a')]*0x3e8;_0x2bbca8['original_sampleCount']=isNaN(_0x4818be['sampleCount'])?null:_0x4818be[_0x3718('0x6b')];_0x2bbca8['original_channelCount']=isNaN(_0x4818be['channelCount'])?null:_0x4818be[_0x3718('0x6c')];_0x2bbca8['original_bitRate']=isNaN(_0x4818be[_0x3718('0x6d')])?null:_0x4818be['bitRate'];_0x2bbca8[_0x3718('0x6e')]=isNaN(_0x4818be[_0x3718('0x6f')])?null:_0x4818be[_0x3718('0x6f')];});_0x211b17['on'](_0x3718('0x70'),function(_0x3b748c){_0x2bbca8[_0x3718('0x71')]=isNaN(_0x3b748c[_0x3718('0x6a')])?null:_0x3b748c['duration']*0x3e8;_0x2bbca8[_0x3718('0x72')]=isNaN(_0x3b748c[_0x3718('0x6b')])?null:_0x3b748c['sampleCount'];_0x2bbca8[_0x3718('0x73')]=isNaN(_0x3b748c[_0x3718('0x6c')])?null:_0x3b748c[_0x3718('0x6c')];_0x2bbca8[_0x3718('0x74')]=isNaN(_0x3b748c['bitRate'])?null:_0x3b748c['bitRate'];_0x2bbca8[_0x3718('0x75')]=isNaN(_0x3b748c[_0x3718('0x6f')])?null:_0x3b748c['sampleRate'];});_0x211b17['on'](_0x3718('0x1c'),function(){fs[_0x3718('0x65')](_0x47f8e7,parseInt(_0x3718('0x66'),0x8));return db[_0x3718('0x45')]['create'](_0x2bbca8)[_0x3718('0x26')](function(_0x3a5b6d){var _0x8a5752={'role':_0x40a477[_0x3718('0x76')][_0x3718('0x77')],'userProfileId':_0x40a477[_0x3718('0x76')][_0x3718('0x78')]};if(!_0x8a5752)throw new Error(_0x3718('0x79'));if(_0x8a5752['role']===_0x3718('0x7a')){var _0x364513=_0x3a5b6d[_0x3718('0x27')]({'plain':!![]});return db[_0x3718('0x7b')][_0x3718('0x4e')]({'where':{'name':'Sounds','userProfileId':_0x8a5752[_0x3718('0x78')]},'raw':!![]})['then'](function(_0x590979){if(_0x590979&&_0x590979['autoAssociation']===0x0){return db[_0x3718('0x29')][_0x3718('0x59')]({'name':_0x364513['name'],'resourceId':_0x364513['id'],'type':_0x590979[_0x3718('0x2d')],'sectionId':_0x590979['id']},{})[_0x3718('0x26')](function(){return _0x3a5b6d;});}else{return _0x3a5b6d;}})[_0x3718('0x4a')](function(_0x44e469){logger[_0x3718('0x2c')](_0x3718('0x7c'),_0x44e469);throw _0x44e469;});}return _0x3a5b6d;})[_0x3718('0x26')](respondWithResult(_0x511b30,null))[_0x3718('0x4a')](handleError(_0x511b30,null));});_0x211b17[_0x3718('0x7d')]();}catch(_0x567091){_0x511b30[_0x3718('0x1b')](0x1f4)[_0x3718('0x2e')](_0x567091);}};exports[_0x3718('0x25')]=function(_0x1ec96f,_0x37ff49,_0x1f486f){return db[_0x3718('0x45')][_0x3718('0x4e')]({'where':{'id':_0x1ec96f[_0x3718('0x4b')]['id']}})[_0x3718('0x26')](handleEntityNotFound(_0x37ff49,null))[_0x3718('0x26')](saveUpdates(_['pick'](_0x1ec96f[_0x3718('0x76')],[_0x3718('0x2d'),'description']),null))['then'](respondWithResult(_0x37ff49,null))[_0x3718('0x4a')](handleError(_0x37ff49,null));};exports[_0x3718('0x7e')]=function(_0x5174e9,_0x1c0e2a,_0x1361b9){return db['Sound']['find']({'where':{'id':_0x5174e9[_0x3718('0x4b')]['id']}})['then'](function(_0x288d4a){if(_0x288d4a){return _0x288d4a['destroy']();}})['then'](function(_0x3e3885){var _0xa5046=path[_0x3718('0x51')](config['root'],'server/files/sounds/original',util[_0x3718('0x61')]('%s.%s',_0x3e3885[_0x3718('0x58')],_0x3e3885[_0x3718('0x7f')]));var _0xd1dd6e=path[_0x3718('0x51')](config[_0x3718('0x52')],_0x3718('0x53'),util[_0x3718('0x61')]('%s.%s',_0x3e3885[_0x3718('0x58')],_0x3e3885[_0x3718('0x4f')]));fs[_0x3718('0x68')](_0xa5046);fs[_0x3718('0x68')](_0xd1dd6e);return _0x3e3885;})[_0x3718('0x26')](function(_0x59bab6){if(_0x59bab6){return _0x1c0e2a[_0x3718('0x1b')](0xcc)[_0x3718('0x1c')]();}})[_0x3718('0x26')](handleEntityNotFound(_0x1c0e2a,null))[_0x3718('0x4a')](handleError(_0x1c0e2a,null));}; \ No newline at end of file +var _0x7116=['duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','role','body','user','userProfileId','error','start','description','original_format','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','destroy','get','Sounds','UserProfileResource','then','stack','name','send','index','map','Sound','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration'];(function(_0x546dd2,_0x2d5991){var _0x265106=function(_0x5bab94){while(--_0x5bab94){_0x546dd2['push'](_0x546dd2['shift']());}};_0x265106(++_0x2d5991);}(_0x7116,0x88));var _0x6711=function(_0x508b77,_0x5de944){_0x508b77=_0x508b77-0x0;var _0x440bd=_0x7116[_0x508b77];return _0x440bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6711('0x0'));var jsonpatch=require(_0x6711('0x1'));var rp=require(_0x6711('0x2'));var moment=require('moment');var BPromise=require(_0x6711('0x3'));var Mustache=require(_0x6711('0x4'));var util=require('util');var path=require(_0x6711('0x5'));var sox=require(_0x6711('0x6'));var csv=require(_0x6711('0x7'));var ejs=require(_0x6711('0x8'));var fs=require('fs');var fs_extra=require(_0x6711('0x9'));var _=require(_0x6711('0xa'));var squel=require(_0x6711('0xb'));var crypto=require(_0x6711('0xc'));var jsforce=require(_0x6711('0xd'));var deskjs=require(_0x6711('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6711('0xf'));var Papa=require(_0x6711('0x10'));var Redis=require(_0x6711('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6711('0x12'));var utils=require(_0x6711('0x13'));var config=require(_0x6711('0x14'));var licenseUtil=require(_0x6711('0x15'));var db=require(_0x6711('0x16'))['db'];function respondWithStatusCode(_0x291904,_0x35ab1f){_0x35ab1f=_0x35ab1f||0xcc;return function(_0x5b1abf){if(_0x5b1abf){return _0x291904[_0x6711('0x17')](_0x35ab1f);}return _0x291904[_0x6711('0x18')](_0x35ab1f)[_0x6711('0x19')]();};}function respondWithResult(_0x42a582,_0x44947b){_0x44947b=_0x44947b||0xc8;return function(_0xc7172c){if(_0xc7172c){return _0x42a582[_0x6711('0x18')](_0x44947b)[_0x6711('0x1a')](_0xc7172c);}};}function respondWithFilteredResult(_0x357601,_0x4395f7){return function(_0x5424d0){if(_0x5424d0){var _0x2a0012=typeof _0x4395f7[_0x6711('0x1b')]===_0x6711('0x1c')&&typeof _0x4395f7['limit']===_0x6711('0x1c');var _0x44c113=_0x5424d0[_0x6711('0x1d')];var _0x53db67=_0x2a0012?0x0:_0x4395f7['offset'];var _0x275990=_0x2a0012?_0x5424d0[_0x6711('0x1d')]:_0x4395f7[_0x6711('0x1b')]+_0x4395f7[_0x6711('0x1e')];var _0x5b804d;if(_0x275990>=_0x44c113){_0x275990=_0x44c113;_0x5b804d=0xc8;}else{_0x5b804d=0xce;}_0x357601[_0x6711('0x18')](_0x5b804d);return _0x357601[_0x6711('0x1f')](_0x6711('0x20'),_0x53db67+'-'+_0x275990+'/'+_0x44c113)[_0x6711('0x1a')](_0x5424d0);}return null;};}function patchUpdates(_0x83af5d){return function(_0x1bd47d){try{jsonpatch['apply'](_0x1bd47d,_0x83af5d,!![]);}catch(_0x81f9c2){return BPromise['reject'](_0x81f9c2);}return _0x1bd47d[_0x6711('0x21')]();};}function saveUpdates(_0x3f5d4c,_0x5e82cd){return function(_0x2b8c87){if(_0x2b8c87){return _0x2b8c87[_0x6711('0x22')](_0x3f5d4c)['then'](function(_0x5e50c6){return _0x5e50c6;});}return null;};}function removeEntity(_0x25a0cd,_0x3f7cda){return function(_0x22c116){if(_0x22c116){return _0x22c116[_0x6711('0x23')]()['then'](function(){var _0x8925a4=_0x22c116[_0x6711('0x24')]({'plain':!![]});var _0x37e26d=_0x6711('0x25');return db[_0x6711('0x26')][_0x6711('0x23')]({'where':{'type':_0x37e26d,'resourceId':_0x8925a4['id']}})[_0x6711('0x27')](function(){return _0x22c116;});})[_0x6711('0x27')](function(){_0x25a0cd[_0x6711('0x18')](0xcc)[_0x6711('0x19')]();});}};}function handleEntityNotFound(_0x22d1d7,_0x3c9b41){return function(_0x5b62e4){if(!_0x5b62e4){_0x22d1d7['sendStatus'](0x194);}return _0x5b62e4;};}function handleError(_0x32eef0,_0x2c2ea1){_0x2c2ea1=_0x2c2ea1||0x1f4;return function(_0x2be1b8){logger['error'](_0x2be1b8[_0x6711('0x28')]);if(_0x2be1b8['name']){delete _0x2be1b8[_0x6711('0x29')];}_0x32eef0['status'](_0x2c2ea1)[_0x6711('0x2a')](_0x2be1b8);};}exports[_0x6711('0x2b')]=function(_0x4c9228,_0x4dd2fe){var _0x13d919={},_0xd1987={},_0x33be3f={'count':0x0,'rows':[]};var _0xa95b92=_[_0x6711('0x2c')](db[_0x6711('0x2d')]['rawAttributes'],function(_0x333daa){return{'name':_0x333daa['fieldName'],'type':_0x333daa[_0x6711('0x2e')][_0x6711('0x2f')]};});_0xd1987[_0x6711('0x30')]=_[_0x6711('0x2c')](_0xa95b92,_0x6711('0x29'));_0xd1987[_0x6711('0x31')]=_[_0x6711('0x32')](_0x4c9228['query']);_0xd1987[_0x6711('0x33')]=_[_0x6711('0x34')](_0xd1987['model'],_0xd1987['query']);_0x13d919[_0x6711('0x35')]=_[_0x6711('0x34')](_0xd1987[_0x6711('0x30')],qs[_0x6711('0x36')](_0x4c9228[_0x6711('0x31')][_0x6711('0x36')]));_0x13d919[_0x6711('0x35')]=_0x13d919[_0x6711('0x35')]['length']?_0x13d919['attributes']:_0xd1987[_0x6711('0x30')];if(!_0x4c9228[_0x6711('0x31')][_0x6711('0x37')](_0x6711('0x38'))){_0x13d919['limit']=qs[_0x6711('0x1e')](_0x4c9228[_0x6711('0x31')][_0x6711('0x1e')]);_0x13d919[_0x6711('0x1b')]=qs[_0x6711('0x1b')](_0x4c9228[_0x6711('0x31')][_0x6711('0x1b')]);}_0x13d919['order']=qs[_0x6711('0x39')](_0x4c9228[_0x6711('0x31')][_0x6711('0x39')]);_0x13d919[_0x6711('0x3a')]=qs[_0x6711('0x33')](_[_0x6711('0x3b')](_0x4c9228[_0x6711('0x31')],_0xd1987['filters']),_0xa95b92);if(_0x4c9228[_0x6711('0x31')][_0x6711('0x3c')]){_0x13d919['where']=_['merge'](_0x13d919[_0x6711('0x3a')],{'$or':_[_0x6711('0x2c')](_0xa95b92,function(_0x201a35){if(_0x201a35[_0x6711('0x2e')]!==_0x6711('0x3d')){var _0x23b338={};_0x23b338[_0x201a35['name']]={'$like':'%'+_0x4c9228[_0x6711('0x31')][_0x6711('0x3c')]+'%'};return _0x23b338;}})});}_0x13d919=_[_0x6711('0x3e')]({},_0x13d919,_0x4c9228[_0x6711('0x3f')]);var _0x402744={'where':_0x13d919[_0x6711('0x3a')]};return db[_0x6711('0x2d')]['count'](_0x402744)[_0x6711('0x27')](function(_0x25eb72){_0x33be3f['count']=_0x25eb72;if(_0x4c9228['query'][_0x6711('0x40')]){_0x13d919[_0x6711('0x41')]=[{'all':!![]}];}return db[_0x6711('0x2d')][_0x6711('0x42')](_0x13d919);})[_0x6711('0x27')](function(_0x41b5b3){_0x33be3f['rows']=_0x41b5b3;return _0x33be3f;})[_0x6711('0x27')](respondWithFilteredResult(_0x4dd2fe,_0x13d919))[_0x6711('0x43')](handleError(_0x4dd2fe,null));};exports['show']=function(_0xafb64a,_0x23180a){var _0x3541d9={'raw':!![],'where':{'id':_0xafb64a[_0x6711('0x44')]['id']}},_0x624372={};_0x624372[_0x6711('0x30')]=_[_0x6711('0x32')](db[_0x6711('0x2d')]['rawAttributes']);_0x624372['query']=_['keys'](_0xafb64a[_0x6711('0x31')]);_0x624372[_0x6711('0x33')]=_[_0x6711('0x34')](_0x624372[_0x6711('0x30')],_0x624372[_0x6711('0x31')]);_0x3541d9[_0x6711('0x35')]=_[_0x6711('0x34')](_0x624372[_0x6711('0x30')],qs[_0x6711('0x36')](_0xafb64a['query'][_0x6711('0x36')]));_0x3541d9[_0x6711('0x35')]=_0x3541d9[_0x6711('0x35')]['length']?_0x3541d9['attributes']:_0x624372[_0x6711('0x30')];if(_0xafb64a[_0x6711('0x31')][_0x6711('0x40')]){_0x3541d9[_0x6711('0x41')]=[{'all':!![]}];}_0x3541d9=_['merge']({},_0x3541d9,_0xafb64a[_0x6711('0x3f')]);return db[_0x6711('0x2d')][_0x6711('0x45')](_0x3541d9)[_0x6711('0x27')](handleEntityNotFound(_0x23180a,null))['then'](respondWithResult(_0x23180a,null))[_0x6711('0x43')](handleError(_0x23180a,null));};exports['download']=function(_0x1c0100,_0x4ce91b,_0x5426f6){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0x1c0100[_0x6711('0x44')]['id']},'attributes':['name',_0x6711('0x46'),_0x6711('0x47')],'raw':!![]})[_0x6711('0x27')](handleEntityNotFound(_0x4ce91b,null))['then'](function(_0x13b29e){if(_0x13b29e){if(!fs[_0x6711('0x48')](path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),_0x13b29e[_0x6711('0x46')]+'.'+_0x13b29e[_0x6711('0x47')]))){throw new db[(_0x6711('0x4c'))][(_0x6711('0x4d'))](_0x6711('0x4e'));}return _0x4ce91b[_0x6711('0x4f')](path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')](_0x6711('0x51'),_0x13b29e['save_name'],_0x13b29e[_0x6711('0x47')])),util[_0x6711('0x50')]('%s.%s',_0x13b29e['name'],_0x13b29e['converted_format']));}return null;})[_0x6711('0x43')](handleError(_0x4ce91b,null));};exports[_0x6711('0x52')]=function(_0x30841f,_0x1fc2f5,_0x5a7d23){var _0x344665={'name':path[_0x6711('0x53')](_0x30841f[_0x6711('0x54')][_0x6711('0x55')],path[_0x6711('0x56')](_0x30841f[_0x6711('0x54')][_0x6711('0x55')])),'save_name':path[_0x6711('0x53')](_0x30841f['file'][_0x6711('0x57')],path[_0x6711('0x56')](_0x30841f[_0x6711('0x54')][_0x6711('0x57')])),'original_format':path['extname'](_0x30841f['file'][_0x6711('0x55')])['substring'](0x1),'converted_format':_0x6711('0x58')};var _0x58e8f0=path[_0x6711('0x49')](config[_0x6711('0x4a')],'server/files/sounds/original',_0x30841f[_0x6711('0x54')][_0x6711('0x57')]);var _0x10abdd=path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')]('%s.%s',path[_0x6711('0x53')](_0x30841f[_0x6711('0x54')][_0x6711('0x57')],path['extname'](_0x30841f['file'][_0x6711('0x57')])),_0x344665['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x58e8f0);logger[_0x6711('0x59')](_0x6711('0x5a'),_0x10abdd);try{fs[_0x6711('0x5b')](_0x58e8f0,parseInt(_0x6711('0x5c'),0x8));var _0x2ae852=sox[_0x6711('0x5d')](_0x58e8f0,_0x10abdd,{'sampleRate':0x1f40,'format':_0x6711('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ae852['on']('error',function(_0x1f1302){fs[_0x6711('0x5e')](_0x58e8f0);_0x1fc2f5['status'](0x1f4)[_0x6711('0x2a')](_0x1f1302);});_0x2ae852['on']('src',function(_0xf4baf8){_0x344665[_0x6711('0x5f')]=isNaN(_0xf4baf8[_0x6711('0x60')])?null:_0xf4baf8[_0x6711('0x60')]*0x3e8;_0x344665[_0x6711('0x61')]=isNaN(_0xf4baf8['sampleCount'])?null:_0xf4baf8[_0x6711('0x62')];_0x344665[_0x6711('0x63')]=isNaN(_0xf4baf8[_0x6711('0x64')])?null:_0xf4baf8[_0x6711('0x64')];_0x344665[_0x6711('0x65')]=isNaN(_0xf4baf8[_0x6711('0x66')])?null:_0xf4baf8['bitRate'];_0x344665[_0x6711('0x67')]=isNaN(_0xf4baf8[_0x6711('0x68')])?null:_0xf4baf8[_0x6711('0x68')];});_0x2ae852['on']('dest',function(_0x2c516d){_0x344665[_0x6711('0x69')]=isNaN(_0x2c516d[_0x6711('0x60')])?null:_0x2c516d['duration']*0x3e8;_0x344665[_0x6711('0x6a')]=isNaN(_0x2c516d[_0x6711('0x62')])?null:_0x2c516d[_0x6711('0x62')];_0x344665['converted_channelCount']=isNaN(_0x2c516d[_0x6711('0x64')])?null:_0x2c516d['channelCount'];_0x344665[_0x6711('0x6b')]=isNaN(_0x2c516d[_0x6711('0x66')])?null:_0x2c516d[_0x6711('0x66')];_0x344665['converted_sampleRate']=isNaN(_0x2c516d[_0x6711('0x68')])?null:_0x2c516d[_0x6711('0x68')];});_0x2ae852['on'](_0x6711('0x19'),function(){fs[_0x6711('0x5b')](_0x10abdd,parseInt('0777',0x8));return db[_0x6711('0x2d')][_0x6711('0x52')](_0x344665)[_0x6711('0x27')](function(_0xd5f22d){var _0x4d8235={'role':_0x30841f['body'][_0x6711('0x6c')],'userProfileId':_0x30841f[_0x6711('0x6d')]['userProfileId']};if(!_0x4d8235)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d8235[_0x6711('0x6c')]===_0x6711('0x6e')){var _0x407c64=_0xd5f22d[_0x6711('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x6711('0x45')]({'where':{'name':_0x6711('0x25'),'userProfileId':_0x4d8235[_0x6711('0x6f')]},'raw':!![]})[_0x6711('0x27')](function(_0x32e2b6){if(_0x32e2b6&&_0x32e2b6['autoAssociation']===0x0){return db['UserProfileResource'][_0x6711('0x52')]({'name':_0x407c64[_0x6711('0x29')],'resourceId':_0x407c64['id'],'type':_0x32e2b6['name'],'sectionId':_0x32e2b6['id']},{})[_0x6711('0x27')](function(){return _0xd5f22d;});}else{return _0xd5f22d;}})[_0x6711('0x43')](function(_0x1940bd){logger[_0x6711('0x70')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1940bd);throw _0x1940bd;});}return _0xd5f22d;})[_0x6711('0x27')](respondWithResult(_0x1fc2f5,null))[_0x6711('0x43')](handleError(_0x1fc2f5,null));});_0x2ae852[_0x6711('0x71')]();}catch(_0x5b9c3a){_0x1fc2f5[_0x6711('0x18')](0x1f4)[_0x6711('0x2a')](_0x5b9c3a);}};exports[_0x6711('0x22')]=function(_0x5d99a8,_0x3cf8e0,_0xd93399){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0x5d99a8[_0x6711('0x44')]['id']}})[_0x6711('0x27')](handleEntityNotFound(_0x3cf8e0,null))['then'](saveUpdates(_[_0x6711('0x3b')](_0x5d99a8[_0x6711('0x6d')],[_0x6711('0x29'),_0x6711('0x72')]),null))['then'](respondWithResult(_0x3cf8e0,null))[_0x6711('0x43')](handleError(_0x3cf8e0,null));};exports['delete']=function(_0xc6ffea,_0x45449c,_0x15f14c){return db[_0x6711('0x2d')][_0x6711('0x45')]({'where':{'id':_0xc6ffea['params']['id']}})[_0x6711('0x27')](function(_0x140567){if(_0x140567){return _0x140567[_0x6711('0x23')]();}})[_0x6711('0x27')](function(_0x1b4ac0){var _0x3cb90d=path[_0x6711('0x49')](config[_0x6711('0x4a')],'server/files/sounds/original',util[_0x6711('0x50')]('%s.%s',_0x1b4ac0[_0x6711('0x46')],_0x1b4ac0[_0x6711('0x73')]));var _0x37151e=path[_0x6711('0x49')](config[_0x6711('0x4a')],_0x6711('0x4b'),util[_0x6711('0x50')]('%s.%s',_0x1b4ac0['save_name'],_0x1b4ac0[_0x6711('0x47')]));fs[_0x6711('0x5e')](_0x3cb90d);fs[_0x6711('0x5e')](_0x37151e);return _0x1b4ac0;})[_0x6711('0x27')](function(_0x19c5c8){if(_0x19c5c8){return _0x45449c['status'](0xcc)[_0x6711('0x19')]();}})['then'](handleEntityNotFound(_0x45449c,null))[_0x6711('0x43')](handleError(_0x45449c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3aba855..f8ff29f 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 _0x96a0=['bluebird','rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x49a513,_0x35489e){var _0x8a1955=function(_0x379a75){while(--_0x379a75){_0x49a513['push'](_0x49a513['shift']());}};_0x8a1955(++_0x35489e);}(_0x96a0,0x80));var _0x096a=function(_0xaacb5c,_0x2f4a90){_0xaacb5c=_0xaacb5c-0x0;var _0x1915e7=_0x96a0[_0xaacb5c];return _0x1915e7;};'use strict';var _=require(_0x096a('0x0'));var util=require(_0x096a('0x1'));var logger=require('../../config/logger')(_0x096a('0x2'));var moment=require(_0x096a('0x3'));var BPromise=require(_0x096a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x096a('0x5'));var config=require(_0x096a('0x6'));var attributes=require('./sound.attributes');module[_0x096a('0x7')]=function(_0x58aa46,_0x3f744a){return _0x58aa46[_0x096a('0x8')](_0x096a('0x9'),attributes,{'tableName':_0x096a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dab=['rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','api','bluebird','request-promise','path'];(function(_0x4b0c2,_0x29d121){var _0x3b56a2=function(_0x34bed3){while(--_0x34bed3){_0x4b0c2['push'](_0x4b0c2['shift']());}};_0x3b56a2(++_0x29d121);}(_0x8dab,0xd7));var _0xb8da=function(_0x1e129a,_0x4bfa91){_0x1e129a=_0x1e129a-0x0;var _0x595d15=_0x8dab[_0x1e129a];return _0x595d15;};'use strict';var _=require(_0xb8da('0x0'));var util=require(_0xb8da('0x1'));var logger=require('../../config/logger')(_0xb8da('0x2'));var moment=require('moment');var BPromise=require(_0xb8da('0x3'));var rp=require(_0xb8da('0x4'));var fs=require('fs');var path=require(_0xb8da('0x5'));var rimraf=require(_0xb8da('0x6'));var config=require(_0xb8da('0x7'));var attributes=require(_0xb8da('0x8'));module[_0xb8da('0x9')]=function(_0x287261,_0x544ac6){return _0x287261[_0xb8da('0xa')](_0xb8da('0xb'),attributes,{'tableName':_0xb8da('0xc'),'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 4ab0fa3..e4dcfb8 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 _0x1255=['raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','options'];(function(_0x280065,_0x16858d){var _0x2dc380=function(_0x50f501){while(--_0x50f501){_0x280065['push'](_0x280065['shift']());}};_0x2dc380(++_0x16858d);}(_0x1255,0x8c));var _0x5125=function(_0x590503,_0x26fa19){_0x590503=_0x590503-0x0;var _0x1aab3a=_0x1255[_0x590503];return _0x1aab3a;};'use strict';var _=require(_0x5125('0x0'));var util=require(_0x5125('0x1'));var moment=require(_0x5125('0x2'));var BPromise=require(_0x5125('0x3'));var rs=require(_0x5125('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5125('0x5'))['db'];var utils=require(_0x5125('0x6'));var logger=require(_0x5125('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5125('0x8'));var client=jayson[_0x5125('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3854,_0x4e154c,_0x47a014){return new BPromise(function(_0x110520,_0x36553f){return client[_0x5125('0xa')](_0x4c3854,_0x47a014)[_0x5125('0xb')](function(_0x47d731){logger[_0x5125('0xc')](_0x5125('0xd'),_0x4e154c,_0x5125('0xe'));logger[_0x5125('0xf')](_0x5125('0x10'),_0x4e154c,_0x5125('0xe'),JSON['stringify'](_0x47d731));if(_0x47d731[_0x5125('0x11')]){if(_0x47d731[_0x5125('0x11')]['code']===0x1f4){logger['error'](_0x5125('0xd'),_0x4e154c,_0x47d731[_0x5125('0x11')][_0x5125('0x12')]);return _0x36553f(_0x47d731[_0x5125('0x11')][_0x5125('0x12')]);}logger[_0x5125('0x11')]('Sound,\x20%s,\x20%s',_0x4e154c,_0x47d731[_0x5125('0x11')][_0x5125('0x12')]);return _0x110520(_0x47d731[_0x5125('0x11')][_0x5125('0x12')]);}else{logger[_0x5125('0xc')](_0x5125('0xd'),_0x4e154c,'request\x20sent');_0x110520(_0x47d731[_0x5125('0x13')]['message']);}})[_0x5125('0x14')](function(_0x30a12a){logger[_0x5125('0x11')](_0x5125('0xd'),_0x4e154c,_0x30a12a);_0x36553f(_0x30a12a);});});}exports['ShowSound']=function(_0x1134e1){var _0x19c915=this;return new Promise(function(_0x39069b,_0x4beae5){return db['Sound']['find']({'raw':_0x1134e1[_0x5125('0x15')]?_0x1134e1['options'][_0x5125('0x16')]===undefined?!![]:![]:!![],'where':_0x1134e1['options']?_0x1134e1[_0x5125('0x15')]['where']||null:null,'attributes':_0x1134e1[_0x5125('0x15')]?_0x1134e1[_0x5125('0x15')][_0x5125('0x17')]||null:null,'include':_0x1134e1[_0x5125('0x15')]?_0x1134e1[_0x5125('0x15')][_0x5125('0x18')]?_[_0x5125('0x19')](_0x1134e1[_0x5125('0x15')][_0x5125('0x18')],function(_0x4f9f24){return{'model':db[_0x4f9f24[_0x5125('0x1a')]],'as':_0x4f9f24['as'],'attributes':_0x4f9f24['attributes'],'include':_0x4f9f24[_0x5125('0x18')]?_['map'](_0x4f9f24[_0x5125('0x18')],function(_0x30e077){return{'model':db[_0x30e077[_0x5125('0x1a')]],'as':_0x30e077['as'],'attributes':_0x30e077[_0x5125('0x17')],'include':_0x30e077[_0x5125('0x18')]?_['map'](_0x30e077[_0x5125('0x18')],function(_0x298fd4){return{'model':db[_0x298fd4[_0x5125('0x1a')]],'as':_0x298fd4['as'],'attributes':_0x298fd4[_0x5125('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5125('0xb')](function(_0x322fd2){logger[_0x5125('0xc')]('ShowSound',_0x1134e1);logger[_0x5125('0xf')]('ShowSound',_0x1134e1,JSON['stringify'](_0x322fd2));_0x39069b(_0x322fd2);})[_0x5125('0x14')](function(_0x3e50d7){logger[_0x5125('0x11')]('ShowSound',_0x3e50d7['message'],_0x1134e1);_0x4beae5(_0x19c915[_0x5125('0x11')](0x1f4,_0x3e50d7[_0x5125('0x12')]));});});}; \ No newline at end of file +var _0xf020=['client','http','then','info','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent','result','Sound','find','options','map','include','model','attributes','debug','ShowSound','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0xf020,0x154));var _0x0f02=function(_0x30ac17,_0x1f9dde){_0x30ac17=_0x30ac17-0x0;var _0x14d4af=_0xf020[_0x30ac17];return _0x14d4af;};'use strict';var _=require(_0x0f02('0x0'));var util=require(_0x0f02('0x1'));var moment=require(_0x0f02('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f02('0x3'))['db'];var utils=require(_0x0f02('0x4'));var logger=require('../../config/logger')(_0x0f02('0x5'));var config=require(_0x0f02('0x6'));var jayson=require(_0x0f02('0x7'));var client=jayson[_0x0f02('0x8')][_0x0f02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a9da,_0x396e03,_0x2152e0){return new BPromise(function(_0x23bf64,_0x4da6f1){return client['request'](_0x34a9da,_0x2152e0)[_0x0f02('0xa')](function(_0x2606b4){logger[_0x0f02('0xb')]('Sound,\x20%s,\x20%s',_0x396e03,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x396e03,'request\x20sent',JSON[_0x0f02('0xc')](_0x2606b4));if(_0x2606b4[_0x0f02('0xd')]){if(_0x2606b4[_0x0f02('0xd')][_0x0f02('0xe')]===0x1f4){logger['error'](_0x0f02('0xf'),_0x396e03,_0x2606b4[_0x0f02('0xd')]['message']);return _0x4da6f1(_0x2606b4['error']['message']);}logger[_0x0f02('0xd')]('Sound,\x20%s,\x20%s',_0x396e03,_0x2606b4['error'][_0x0f02('0x10')]);return _0x23bf64(_0x2606b4[_0x0f02('0xd')][_0x0f02('0x10')]);}else{logger[_0x0f02('0xb')](_0x0f02('0xf'),_0x396e03,_0x0f02('0x11'));_0x23bf64(_0x2606b4[_0x0f02('0x12')][_0x0f02('0x10')]);}})['catch'](function(_0x3f1429){logger['error'](_0x0f02('0xf'),_0x396e03,_0x3f1429);_0x4da6f1(_0x3f1429);});});}exports['ShowSound']=function(_0x390561){var _0x36b886=this;return new Promise(function(_0x3d77a5,_0x12a82c){return db[_0x0f02('0x13')][_0x0f02('0x14')]({'raw':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['where']||null:null,'attributes':_0x390561[_0x0f02('0x15')]?_0x390561[_0x0f02('0x15')]['attributes']||null:null,'include':_0x390561['options']?_0x390561[_0x0f02('0x15')]['include']?_[_0x0f02('0x16')](_0x390561[_0x0f02('0x15')][_0x0f02('0x17')],function(_0x5d5f25){return{'model':db[_0x5d5f25[_0x0f02('0x18')]],'as':_0x5d5f25['as'],'attributes':_0x5d5f25[_0x0f02('0x19')],'include':_0x5d5f25[_0x0f02('0x17')]?_[_0x0f02('0x16')](_0x5d5f25[_0x0f02('0x17')],function(_0x13a7aa){return{'model':db[_0x13a7aa[_0x0f02('0x18')]],'as':_0x13a7aa['as'],'attributes':_0x13a7aa[_0x0f02('0x19')],'include':_0x13a7aa['include']?_[_0x0f02('0x16')](_0x13a7aa[_0x0f02('0x17')],function(_0x2ff743){return{'model':db[_0x2ff743['model']],'as':_0x2ff743['as'],'attributes':_0x2ff743[_0x0f02('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0f02('0xa')](function(_0x4c91c4){logger['info']('ShowSound',_0x390561);logger[_0x0f02('0x1a')](_0x0f02('0x1b'),_0x390561,JSON[_0x0f02('0xc')](_0x4c91c4));_0x3d77a5(_0x4c91c4);})[_0x0f02('0x1c')](function(_0x9ac20a){logger['error'](_0x0f02('0x1b'),_0x9ac20a[_0x0f02('0x10')],_0x390561);_0x12a82c(_0x36b886[_0x0f02('0xd')](0x1f4,_0x9ac20a[_0x0f02('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ef265e2..a11afdb 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x69c91e,_0x2ab08c){var _0x22cb44=function(_0x5402d8){while(--_0x5402d8){_0x69c91e['push'](_0x69c91e['shift']());}};_0x22cb44(++_0x2ab08c);}(_0xda3f,0xec));var _0xfda3=function(_0x3f1ead,_0x484d19){_0x3f1ead=_0x3f1ead-0x0;var _0x31dd4c=_0xda3f[_0x3f1ead];return _0x31dd4c;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0x8603,0x190));var _0x3860=function(_0x4a3eef,_0x16388a){_0x4a3eef=_0x4a3eef-0x0;var _0x2d5b79=_0x8603[_0x4a3eef];return _0x2d5b79;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a26c81b..6e08e7a 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 _0x2ce0=['STRING','TEXT','medium','out','sequelize','exports'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2ce0,0x1de));var _0x02ce=function(_0x1ebcc5,_0x29cd7d){_0x1ebcc5=_0x1ebcc5-0x0;var _0x4e8fa6=_0x2ce0[_0x1ebcc5];return _0x4e8fa6;};'use strict';var Sequelize=require(_0x02ce('0x0'));module[_0x02ce('0x1')]={'uniqueid':{'type':Sequelize[_0x02ce('0x2')]},'body':{'type':Sequelize[_0x02ce('0x3')](_0x02ce('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x02ce('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x02ce('0x2')]},'providerResponse':{'type':Sequelize[_0x02ce('0x3')]}}; \ No newline at end of file +var _0x0788=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x4c9be7,_0x538b4d){var _0x5250a7=function(_0x4a71a0){while(--_0x4a71a0){_0x4c9be7['push'](_0x4c9be7['shift']());}};_0x5250a7(++_0x538b4d);}(_0x0788,0x88));var _0x8078=function(_0x1081b7,_0x1fc984){_0x1081b7=_0x1081b7-0x0;var _0x4603e3=_0x0788[_0x1081b7];return _0x4603e3;};'use strict';var Sequelize=require('sequelize');module[_0x8078('0x0')]={'uniqueid':{'type':Sequelize[_0x8078('0x1')]},'body':{'type':Sequelize[_0x8078('0x2')](_0x8078('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x8078('0x4')]('in',_0x8078('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8078('0x1')]},'providerResponse':{'type':Sequelize[_0x8078('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index c163367..ac65b62 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 _0x806d=['send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name'];(function(_0x4c9802,_0x559024){var _0x32552f=function(_0x1ab388){while(--_0x1ab388){_0x4c9802['push'](_0x4c9802['shift']());}};_0x32552f(++_0x559024);}(_0x806d,0x131));var _0xd806=function(_0x48e4ff,_0x389855){_0x48e4ff=_0x48e4ff-0x0;var _0xada3c6=_0x806d[_0x48e4ff];return _0xada3c6;};'use strict';var emlformat=require(_0xd806('0x0'));var rimraf=require(_0xd806('0x1'));var zipdir=require(_0xd806('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd806('0x3'));var Mustache=require(_0xd806('0x4'));var util=require('util');var path=require(_0xd806('0x5'));var sox=require('sox');var csv=require(_0xd806('0x6'));var ejs=require(_0xd806('0x7'));var fs=require('fs');var fs_extra=require(_0xd806('0x8'));var _=require(_0xd806('0x9'));var squel=require(_0xd806('0xa'));var crypto=require(_0xd806('0xb'));var jsforce=require(_0xd806('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd806('0x6'));var querystring=require(_0xd806('0xd'));var Papa=require(_0xd806('0xe'));var Redis=require(_0xd806('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd806('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd806('0x11'));var logger=require(_0xd806('0x12'))('api');var utils=require(_0xd806('0x13'));var config=require(_0xd806('0x14'));var licenseUtil=require(_0xd806('0x15'));var db=require(_0xd806('0x16'))['db'];function respondWithStatusCode(_0x451cba,_0x394569){_0x394569=_0x394569||0xcc;return function(_0x1c751c){if(_0x1c751c){return _0x451cba[_0xd806('0x17')](_0x394569);}return _0x451cba[_0xd806('0x18')](_0x394569)[_0xd806('0x19')]();};}function respondWithResult(_0x32f405,_0x47ef3b){_0x47ef3b=_0x47ef3b||0xc8;return function(_0x17d8bc){if(_0x17d8bc){return _0x32f405[_0xd806('0x18')](_0x47ef3b)[_0xd806('0x1a')](_0x17d8bc);}};}function respondWithFilteredResult(_0x4a2139,_0x7a8ed1){return function(_0x5a4ae4){if(_0x5a4ae4){var _0x33127f=typeof _0x7a8ed1[_0xd806('0x1b')]===_0xd806('0x1c')&&typeof _0x7a8ed1[_0xd806('0x1d')]===_0xd806('0x1c');var _0x1e7f7f=_0x5a4ae4[_0xd806('0x1e')];var _0x332eec=_0x33127f?0x0:_0x7a8ed1[_0xd806('0x1b')];var _0x5bd7a1=_0x33127f?_0x5a4ae4[_0xd806('0x1e')]:_0x7a8ed1[_0xd806('0x1b')]+_0x7a8ed1[_0xd806('0x1d')];var _0x5a3781;if(_0x5bd7a1>=_0x1e7f7f){_0x5bd7a1=_0x1e7f7f;_0x5a3781=0xc8;}else{_0x5a3781=0xce;}_0x4a2139[_0xd806('0x18')](_0x5a3781);return _0x4a2139['set'](_0xd806('0x1f'),_0x332eec+'-'+_0x5bd7a1+'/'+_0x1e7f7f)[_0xd806('0x1a')](_0x5a4ae4);}return null;};}function patchUpdates(_0x222a12){return function(_0x469f01){try{jsonpatch[_0xd806('0x20')](_0x469f01,_0x222a12,!![]);}catch(_0x58c632){return BPromise['reject'](_0x58c632);}return _0x469f01[_0xd806('0x21')]();};}function saveUpdates(_0x3680c1,_0x76392f){return function(_0x95450b){if(_0x95450b){return _0x95450b[_0xd806('0x22')](_0x3680c1)['then'](function(_0x500f9d){return _0x500f9d;});}return null;};}function removeEntity(_0x2a173b,_0x1335c9){return function(_0x17aa45){if(_0x17aa45){return _0x17aa45[_0xd806('0x23')]()[_0xd806('0x24')](function(){_0x2a173b['status'](0xcc)[_0xd806('0x19')]();});}};}function handleEntityNotFound(_0xf8df1e,_0x53782d){return function(_0x479744){if(!_0x479744){_0xf8df1e[_0xd806('0x17')](0x194);}return _0x479744;};}function handleError(_0x5acda8,_0x26bf96){_0x26bf96=_0x26bf96||0x1f4;return function(_0xe9664e){logger[_0xd806('0x25')](_0xe9664e[_0xd806('0x26')]);if(_0xe9664e[_0xd806('0x27')]){delete _0xe9664e['name'];}_0x5acda8['status'](_0x26bf96)[_0xd806('0x28')](_0xe9664e);};}exports[_0xd806('0x29')]=function(_0x10db6c,_0x4a7c5f){var _0x2b6b4d={},_0x25a2f0={},_0x358ae2={'count':0x0,'rows':[]};var _0x524893=_[_0xd806('0x2a')](db[_0xd806('0x2b')][_0xd806('0x2c')],function(_0x441e1d){return{'name':_0x441e1d[_0xd806('0x2d')],'type':_0x441e1d[_0xd806('0x2e')]['key']};});_0x25a2f0['model']=_['map'](_0x524893,'name');_0x25a2f0[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x10db6c[_0xd806('0x2f')]);_0x25a2f0[_0xd806('0x31')]=_[_0xd806('0x32')](_0x25a2f0[_0xd806('0x33')],_0x25a2f0[_0xd806('0x2f')]);_0x2b6b4d[_0xd806('0x34')]=_[_0xd806('0x32')](_0x25a2f0['model'],qs[_0xd806('0x35')](_0x10db6c[_0xd806('0x2f')][_0xd806('0x35')]));_0x2b6b4d[_0xd806('0x34')]=_0x2b6b4d['attributes'][_0xd806('0x36')]?_0x2b6b4d['attributes']:_0x25a2f0[_0xd806('0x33')];if(!_0x10db6c['query']['hasOwnProperty'](_0xd806('0x37'))){_0x2b6b4d[_0xd806('0x1d')]=qs['limit'](_0x10db6c[_0xd806('0x2f')][_0xd806('0x1d')]);_0x2b6b4d['offset']=qs[_0xd806('0x1b')](_0x10db6c[_0xd806('0x2f')]['offset']);}_0x2b6b4d[_0xd806('0x38')]=qs[_0xd806('0x39')](_0x10db6c['query']['sort']);_0x2b6b4d[_0xd806('0x3a')]=qs[_0xd806('0x31')](_['pick'](_0x10db6c[_0xd806('0x2f')],_0x25a2f0[_0xd806('0x31')]),_0x524893);if(_0x10db6c['query']['filter']){_0x2b6b4d['where']=_[_0xd806('0x3b')](_0x2b6b4d[_0xd806('0x3a')],{'$or':_[_0xd806('0x2a')](_0x524893,function(_0x3e69f6){if(_0x3e69f6[_0xd806('0x2e')]!==_0xd806('0x3c')){var _0x370644={};_0x370644[_0x3e69f6[_0xd806('0x27')]]={'$like':'%'+_0x10db6c[_0xd806('0x2f')][_0xd806('0x3d')]+'%'};return _0x370644;}})});}_0x2b6b4d=_['merge']({},_0x2b6b4d,_0x10db6c[_0xd806('0x3e')]);var _0x5c1cbf={'where':_0x2b6b4d[_0xd806('0x3a')]};return db[_0xd806('0x2b')]['count'](_0x5c1cbf)[_0xd806('0x24')](function(_0x54ab4a){_0x358ae2[_0xd806('0x1e')]=_0x54ab4a;if(_0x10db6c['query']['includeAll']){_0x2b6b4d['include']=[{'all':!![]}];}return db[_0xd806('0x2b')]['findAll'](_0x2b6b4d);})[_0xd806('0x24')](function(_0x11a915){_0x358ae2[_0xd806('0x3f')]=_0x11a915;return _0x358ae2;})[_0xd806('0x24')](respondWithFilteredResult(_0x4a7c5f,_0x2b6b4d))[_0xd806('0x40')](handleError(_0x4a7c5f,null));};exports['show']=function(_0x4e7904,_0x3f8ab5){var _0x5a97ae={'raw':!![],'where':{'id':_0x4e7904[_0xd806('0x41')]['id']}},_0x1c4191={};_0x1c4191[_0xd806('0x33')]=_['keys'](db[_0xd806('0x2b')]['rawAttributes']);_0x1c4191[_0xd806('0x2f')]=_[_0xd806('0x30')](_0x4e7904[_0xd806('0x2f')]);_0x1c4191[_0xd806('0x31')]=_['intersection'](_0x1c4191[_0xd806('0x33')],_0x1c4191[_0xd806('0x2f')]);_0x5a97ae[_0xd806('0x34')]=_['intersection'](_0x1c4191[_0xd806('0x33')],qs['fields'](_0x4e7904[_0xd806('0x2f')][_0xd806('0x35')]));_0x5a97ae[_0xd806('0x34')]=_0x5a97ae[_0xd806('0x34')]['length']?_0x5a97ae['attributes']:_0x1c4191[_0xd806('0x33')];if(_0x4e7904[_0xd806('0x2f')]['includeAll']){_0x5a97ae['include']=[{'all':!![]}];}_0x5a97ae=_[_0xd806('0x3b')]({},_0x5a97ae,_0x4e7904[_0xd806('0x3e')]);return db[_0xd806('0x2b')][_0xd806('0x42')](_0x5a97ae)[_0xd806('0x24')](handleEntityNotFound(_0x3f8ab5,null))['then'](respondWithResult(_0x3f8ab5,null))['catch'](handleError(_0x3f8ab5,null));};exports[_0xd806('0x43')]=function(_0x5058ba,_0x5555da){return db[_0xd806('0x2b')][_0xd806('0x43')](_0x5058ba[_0xd806('0x44')],{})['then'](respondWithResult(_0x5555da,0xc9))[_0xd806('0x40')](handleError(_0x5555da,null));};exports['update']=function(_0x45a75c,_0x1e5da1){if(_0x45a75c[_0xd806('0x44')]['id']){delete _0x45a75c[_0xd806('0x44')]['id'];}return db[_0xd806('0x2b')]['find']({'where':{'id':_0x45a75c['params']['id']}})['then'](handleEntityNotFound(_0x1e5da1,null))[_0xd806('0x24')](saveUpdates(_0x45a75c[_0xd806('0x44')],null))['then'](respondWithResult(_0x1e5da1,null))['catch'](handleError(_0x1e5da1,null));};exports[_0xd806('0x23')]=function(_0x34166a,_0x527dcb){return db[_0xd806('0x2b')]['find']({'where':{'id':_0x34166a[_0xd806('0x41')]['id']}})[_0xd806('0x24')](handleEntityNotFound(_0x527dcb,null))['then'](removeEntity(_0x527dcb,null))[_0xd806('0x40')](handleError(_0x527dcb,null));}; \ No newline at end of file +var _0xe469=['limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','save','update','then','end','stack','name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x2c41f9,_0x550191){var _0x5f3d76=function(_0x19ff0c){while(--_0x19ff0c){_0x2c41f9['push'](_0x2c41f9['shift']());}};_0x5f3d76(++_0x550191);}(_0xe469,0xef));var _0x9e46=function(_0x1337c6,_0x3e8010){_0x1337c6=_0x1337c6-0x0;var _0x28bcf4=_0xe469[_0x1337c6];return _0x28bcf4;};'use strict';var emlformat=require(_0x9e46('0x0'));var rimraf=require(_0x9e46('0x1'));var zipdir=require(_0x9e46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9e46('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e46('0x4'));var path=require(_0x9e46('0x5'));var sox=require(_0x9e46('0x6'));var csv=require(_0x9e46('0x7'));var ejs=require(_0x9e46('0x8'));var fs=require('fs');var fs_extra=require(_0x9e46('0x9'));var _=require(_0x9e46('0xa'));var squel=require('squel');var crypto=require(_0x9e46('0xb'));var jsforce=require(_0x9e46('0xc'));var deskjs=require(_0x9e46('0xd'));var toCsv=require(_0x9e46('0x7'));var querystring=require(_0x9e46('0xe'));var Papa=require(_0x9e46('0xf'));var Redis=require(_0x9e46('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e46('0x11'));var logger=require(_0x9e46('0x12'))(_0x9e46('0x13'));var utils=require('../../config/utils');var config=require(_0x9e46('0x14'));var licenseUtil=require(_0x9e46('0x15'));var db=require(_0x9e46('0x16'))['db'];function respondWithStatusCode(_0x3cbd98,_0x136c82){_0x136c82=_0x136c82||0xcc;return function(_0x4f85b3){if(_0x4f85b3){return _0x3cbd98[_0x9e46('0x17')](_0x136c82);}return _0x3cbd98['status'](_0x136c82)['end']();};}function respondWithResult(_0x2a5d04,_0x22efa0){_0x22efa0=_0x22efa0||0xc8;return function(_0x100911){if(_0x100911){return _0x2a5d04[_0x9e46('0x18')](_0x22efa0)['json'](_0x100911);}};}function respondWithFilteredResult(_0x1cd770,_0x201bae){return function(_0x53ebc0){if(_0x53ebc0){var _0x480f5f=typeof _0x201bae[_0x9e46('0x19')]===_0x9e46('0x1a')&&typeof _0x201bae['limit']==='undefined';var _0x519525=_0x53ebc0['count'];var _0x3a027a=_0x480f5f?0x0:_0x201bae[_0x9e46('0x19')];var _0x5b54c6=_0x480f5f?_0x53ebc0[_0x9e46('0x1b')]:_0x201bae[_0x9e46('0x19')]+_0x201bae['limit'];var _0x25e777;if(_0x5b54c6>=_0x519525){_0x5b54c6=_0x519525;_0x25e777=0xc8;}else{_0x25e777=0xce;}_0x1cd770[_0x9e46('0x18')](_0x25e777);return _0x1cd770[_0x9e46('0x1c')](_0x9e46('0x1d'),_0x3a027a+'-'+_0x5b54c6+'/'+_0x519525)[_0x9e46('0x1e')](_0x53ebc0);}return null;};}function patchUpdates(_0x1f2131){return function(_0x2c334d){try{jsonpatch['apply'](_0x2c334d,_0x1f2131,!![]);}catch(_0xaa8b60){return BPromise['reject'](_0xaa8b60);}return _0x2c334d[_0x9e46('0x1f')]();};}function saveUpdates(_0x590f73,_0x52b780){return function(_0x5a2b81){if(_0x5a2b81){return _0x5a2b81[_0x9e46('0x20')](_0x590f73)['then'](function(_0x3b89ab){return _0x3b89ab;});}return null;};}function removeEntity(_0x223557,_0x330ea6){return function(_0x1f8d35){if(_0x1f8d35){return _0x1f8d35['destroy']()[_0x9e46('0x21')](function(){_0x223557[_0x9e46('0x18')](0xcc)[_0x9e46('0x22')]();});}};}function handleEntityNotFound(_0x2454a6,_0x5bc271){return function(_0x37c568){if(!_0x37c568){_0x2454a6['sendStatus'](0x194);}return _0x37c568;};}function handleError(_0x28a43a,_0x49aaaa){_0x49aaaa=_0x49aaaa||0x1f4;return function(_0x4a665e){logger['error'](_0x4a665e[_0x9e46('0x23')]);if(_0x4a665e[_0x9e46('0x24')]){delete _0x4a665e[_0x9e46('0x24')];}_0x28a43a[_0x9e46('0x18')](_0x49aaaa)[_0x9e46('0x25')](_0x4a665e);};}exports[_0x9e46('0x26')]=function(_0x1cb0a1,_0x1dbe55){var _0x47997d={},_0x13b25c={},_0x194c70={'count':0x0,'rows':[]};var _0x10c6cd=_[_0x9e46('0x27')](db[_0x9e46('0x28')]['rawAttributes'],function(_0x4d5fc8){return{'name':_0x4d5fc8[_0x9e46('0x29')],'type':_0x4d5fc8[_0x9e46('0x2a')][_0x9e46('0x2b')]};});_0x13b25c[_0x9e46('0x2c')]=_['map'](_0x10c6cd,_0x9e46('0x24'));_0x13b25c[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0x1cb0a1[_0x9e46('0x2d')]);_0x13b25c[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x13b25c[_0x9e46('0x2c')],_0x13b25c[_0x9e46('0x2d')]);_0x47997d[_0x9e46('0x31')]=_[_0x9e46('0x30')](_0x13b25c['model'],qs['fields'](_0x1cb0a1['query'][_0x9e46('0x32')]));_0x47997d[_0x9e46('0x31')]=_0x47997d['attributes']['length']?_0x47997d[_0x9e46('0x31')]:_0x13b25c['model'];if(!_0x1cb0a1['query'][_0x9e46('0x33')](_0x9e46('0x34'))){_0x47997d['limit']=qs[_0x9e46('0x35')](_0x1cb0a1['query'][_0x9e46('0x35')]);_0x47997d[_0x9e46('0x19')]=qs['offset'](_0x1cb0a1['query']['offset']);}_0x47997d[_0x9e46('0x36')]=qs['sort'](_0x1cb0a1['query'][_0x9e46('0x37')]);_0x47997d[_0x9e46('0x38')]=qs['filters'](_[_0x9e46('0x39')](_0x1cb0a1['query'],_0x13b25c[_0x9e46('0x2f')]),_0x10c6cd);if(_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]){_0x47997d['where']=_[_0x9e46('0x3b')](_0x47997d['where'],{'$or':_[_0x9e46('0x27')](_0x10c6cd,function(_0x26dce9){if(_0x26dce9['type']!==_0x9e46('0x3c')){var _0x5e4b3a={};_0x5e4b3a[_0x26dce9[_0x9e46('0x24')]]={'$like':'%'+_0x1cb0a1[_0x9e46('0x2d')][_0x9e46('0x3a')]+'%'};return _0x5e4b3a;}})});}_0x47997d=_['merge']({},_0x47997d,_0x1cb0a1[_0x9e46('0x3d')]);var _0x2e695d={'where':_0x47997d[_0x9e46('0x38')]};return db['SquareMessage'][_0x9e46('0x1b')](_0x2e695d)[_0x9e46('0x21')](function(_0x1f8acb){_0x194c70[_0x9e46('0x1b')]=_0x1f8acb;if(_0x1cb0a1['query'][_0x9e46('0x3e')]){_0x47997d['include']=[{'all':!![]}];}return db[_0x9e46('0x28')][_0x9e46('0x3f')](_0x47997d);})[_0x9e46('0x21')](function(_0x37d3b5){_0x194c70[_0x9e46('0x40')]=_0x37d3b5;return _0x194c70;})[_0x9e46('0x21')](respondWithFilteredResult(_0x1dbe55,_0x47997d))[_0x9e46('0x41')](handleError(_0x1dbe55,null));};exports['show']=function(_0xdfa815,_0x50ea44){var _0x3d468d={'raw':!![],'where':{'id':_0xdfa815[_0x9e46('0x42')]['id']}},_0x1e3bb4={};_0x1e3bb4[_0x9e46('0x2c')]=_['keys'](db[_0x9e46('0x28')][_0x9e46('0x43')]);_0x1e3bb4[_0x9e46('0x2d')]=_[_0x9e46('0x2e')](_0xdfa815['query']);_0x1e3bb4[_0x9e46('0x2f')]=_[_0x9e46('0x30')](_0x1e3bb4[_0x9e46('0x2c')],_0x1e3bb4[_0x9e46('0x2d')]);_0x3d468d[_0x9e46('0x31')]=_['intersection'](_0x1e3bb4[_0x9e46('0x2c')],qs[_0x9e46('0x32')](_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x32')]));_0x3d468d[_0x9e46('0x31')]=_0x3d468d[_0x9e46('0x31')]['length']?_0x3d468d['attributes']:_0x1e3bb4[_0x9e46('0x2c')];if(_0xdfa815[_0x9e46('0x2d')][_0x9e46('0x3e')]){_0x3d468d[_0x9e46('0x44')]=[{'all':!![]}];}_0x3d468d=_[_0x9e46('0x3b')]({},_0x3d468d,_0xdfa815[_0x9e46('0x3d')]);return db[_0x9e46('0x28')][_0x9e46('0x45')](_0x3d468d)[_0x9e46('0x21')](handleEntityNotFound(_0x50ea44,null))[_0x9e46('0x21')](respondWithResult(_0x50ea44,null))[_0x9e46('0x41')](handleError(_0x50ea44,null));};exports[_0x9e46('0x46')]=function(_0x1cc59b,_0x9cf596){return db['SquareMessage'][_0x9e46('0x46')](_0x1cc59b[_0x9e46('0x47')],{})[_0x9e46('0x21')](respondWithResult(_0x9cf596,0xc9))[_0x9e46('0x41')](handleError(_0x9cf596,null));};exports['update']=function(_0x3be8b4,_0x4223dd){if(_0x3be8b4[_0x9e46('0x47')]['id']){delete _0x3be8b4[_0x9e46('0x47')]['id'];}return db[_0x9e46('0x28')]['find']({'where':{'id':_0x3be8b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x4223dd,null))[_0x9e46('0x21')](saveUpdates(_0x3be8b4[_0x9e46('0x47')],null))[_0x9e46('0x21')](respondWithResult(_0x4223dd,null))[_0x9e46('0x41')](handleError(_0x4223dd,null));};exports[_0x9e46('0x48')]=function(_0x5d71b4,_0x5b1419){return db[_0x9e46('0x28')]['find']({'where':{'id':_0x5d71b4[_0x9e46('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b1419,null))['then'](removeEntity(_0x5b1419,null))[_0x9e46('0x41')](handleError(_0x5b1419,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f038d81..4139c28 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 _0x5379=['square_messages','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x5c17d8,_0x51cc20){var _0x1841de=function(_0x128311){while(--_0x128311){_0x5c17d8['push'](_0x5c17d8['shift']());}};_0x1841de(++_0x51cc20);}(_0x5379,0x85));var _0x9537=function(_0x5809f9,_0x1159ec){_0x5809f9=_0x5809f9-0x0;var _0x2f562a=_0x5379[_0x5809f9];return _0x2f562a;};'use strict';var _=require(_0x9537('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9537('0x1'));var BPromise=require(_0x9537('0x2'));var rp=require(_0x9537('0x3'));var fs=require('fs');var path=require(_0x9537('0x4'));var rimraf=require(_0x9537('0x5'));var config=require(_0x9537('0x6'));var attributes=require(_0x9537('0x7'));module[_0x9537('0x8')]=function(_0x7a3337,_0x24fc44){return _0x7a3337[_0x9537('0x9')](_0x9537('0xa'),attributes,{'tableName':_0x9537('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd95=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x7ee0af,_0x53253a){var _0x4e8458=function(_0x5a5e5e){while(--_0x5a5e5e){_0x7ee0af['push'](_0x7ee0af['shift']());}};_0x4e8458(++_0x53253a);}(_0xcd95,0x145));var _0x5cd9=function(_0x29d4b5,_0x1913e2){_0x29d4b5=_0x29d4b5-0x0;var _0x3fbb01=_0xcd95[_0x29d4b5];return _0x3fbb01;};'use strict';var _=require(_0x5cd9('0x0'));var util=require(_0x5cd9('0x1'));var logger=require(_0x5cd9('0x2'))('api');var moment=require(_0x5cd9('0x3'));var BPromise=require('bluebird');var rp=require(_0x5cd9('0x4'));var fs=require('fs');var path=require(_0x5cd9('0x5'));var rimraf=require(_0x5cd9('0x6'));var config=require(_0x5cd9('0x7'));var attributes=require(_0x5cd9('0x8'));module[_0x5cd9('0x9')]=function(_0x53085e,_0x275669){return _0x53085e[_0x5cd9('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','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 85dd9fe..32b21fb 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 _0x2f77=['CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f77,0x156));var _0x72f7=function(_0x5194a8,_0x3296ae){_0x5194a8=_0x5194a8-0x0;var _0x1e95b7=_0x2f77[_0x5194a8];return _0x1e95b7;};'use strict';var _=require(_0x72f7('0x0'));var util=require(_0x72f7('0x1'));var moment=require(_0x72f7('0x2'));var BPromise=require(_0x72f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x72f7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x72f7('0x6'));var client=jayson[_0x72f7('0x7')][_0x72f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41c761,_0x4f83de,_0x23eb03){return new BPromise(function(_0x47be2d,_0x19ee46){return client[_0x72f7('0x9')](_0x41c761,_0x23eb03)[_0x72f7('0xa')](function(_0x6beb2c){logger[_0x72f7('0xb')]('SquareMessage,\x20%s,\x20%s',_0x4f83de,_0x72f7('0xc'));logger[_0x72f7('0xd')](_0x72f7('0xe'),_0x4f83de,_0x72f7('0xc'),JSON[_0x72f7('0xf')](_0x6beb2c));if(_0x6beb2c[_0x72f7('0x10')]){if(_0x6beb2c[_0x72f7('0x10')][_0x72f7('0x11')]===0x1f4){logger[_0x72f7('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4f83de,_0x6beb2c[_0x72f7('0x10')][_0x72f7('0x12')]);return _0x19ee46(_0x6beb2c['error'][_0x72f7('0x12')]);}logger[_0x72f7('0x10')](_0x72f7('0x13'),_0x4f83de,_0x6beb2c[_0x72f7('0x10')][_0x72f7('0x12')]);return _0x47be2d(_0x6beb2c[_0x72f7('0x10')][_0x72f7('0x12')]);}else{logger[_0x72f7('0xb')]('SquareMessage,\x20%s,\x20%s',_0x4f83de,_0x72f7('0xc'));_0x47be2d(_0x6beb2c[_0x72f7('0x14')][_0x72f7('0x12')]);}})[_0x72f7('0x15')](function(_0xc81aa9){logger['error'](_0x72f7('0x13'),_0x4f83de,_0xc81aa9);_0x19ee46(_0xc81aa9);});});}exports[_0x72f7('0x16')]=function(_0x4efe39){var _0x18cdeb=this;return new Promise(function(_0x2778ed,_0x188abe){return db[_0x72f7('0x17')][_0x72f7('0x18')](_0x4efe39[_0x72f7('0x19')],{'raw':_0x4efe39['options']?_0x4efe39[_0x72f7('0x1a')][_0x72f7('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2ebca3){logger['info'](_0x72f7('0x16'),_0x4efe39);logger['debug'](_0x72f7('0x16'),_0x4efe39,JSON[_0x72f7('0xf')](_0x2ebca3));_0x2778ed(_0x2ebca3);})[_0x72f7('0x15')](function(_0x17d827){logger['error']('CreateSquareMessage',_0x17d827[_0x72f7('0x12')],_0x4efe39);_0x188abe(_0x18cdeb['error'](0x1f4,_0x17d827[_0x72f7('0x12')]));});});}; \ No newline at end of file +var _0x54d8=['rpc','../../config/environment','jayson/promise','client','http','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateSquareMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4e3537,_0x361c10){var _0x5f48cb=function(_0x525888){while(--_0x525888){_0x4e3537['push'](_0x4e3537['shift']());}};_0x5f48cb(++_0x361c10);}(_0x54d8,0x13d));var _0x854d=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x54d8[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var moment=require(_0x854d('0x2'));var BPromise=require(_0x854d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x854d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x854d('0x5'));var logger=require(_0x854d('0x6'))(_0x854d('0x7'));var config=require(_0x854d('0x8'));var jayson=require(_0x854d('0x9'));var client=jayson[_0x854d('0xa')][_0x854d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x102d28,_0x48f294,_0x2632bd){return new BPromise(function(_0x43d097,_0x57dc46){return client['request'](_0x102d28,_0x2632bd)['then'](function(_0x277585){logger['info'](_0x854d('0xc'),_0x48f294,_0x854d('0xd'));logger[_0x854d('0xe')](_0x854d('0xf'),_0x48f294,_0x854d('0xd'),JSON['stringify'](_0x277585));if(_0x277585[_0x854d('0x10')]){if(_0x277585[_0x854d('0x10')][_0x854d('0x11')]===0x1f4){logger[_0x854d('0x10')]('SquareMessage,\x20%s,\x20%s',_0x48f294,_0x277585[_0x854d('0x10')][_0x854d('0x12')]);return _0x57dc46(_0x277585[_0x854d('0x10')][_0x854d('0x12')]);}logger[_0x854d('0x10')]('SquareMessage,\x20%s,\x20%s',_0x48f294,_0x277585['error'][_0x854d('0x12')]);return _0x43d097(_0x277585[_0x854d('0x10')][_0x854d('0x12')]);}else{logger[_0x854d('0x13')](_0x854d('0xc'),_0x48f294,'request\x20sent');_0x43d097(_0x277585[_0x854d('0x14')][_0x854d('0x12')]);}})['catch'](function(_0x800567){logger[_0x854d('0x10')](_0x854d('0xc'),_0x48f294,_0x800567);_0x57dc46(_0x800567);});});}exports[_0x854d('0x15')]=function(_0xb58179){var _0x403a51=this;return new Promise(function(_0x18dd5c,_0x520d67){return db['SquareMessage'][_0x854d('0x16')](_0xb58179['body'],{'raw':_0xb58179[_0x854d('0x17')]?_0xb58179['options'][_0x854d('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x99494f){logger['info'](_0x854d('0x15'),_0xb58179);logger[_0x854d('0xe')](_0x854d('0x15'),_0xb58179,JSON[_0x854d('0x19')](_0x99494f));_0x18dd5c(_0x99494f);})[_0x854d('0x1a')](function(_0x41ccc0){logger[_0x854d('0x10')](_0x854d('0x15'),_0x41ccc0[_0x854d('0x12')],_0xb58179);_0x520d67(_0x403a51[_0x854d('0x10')](0x1f4,_0x41ccc0[_0x854d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 67344fa..e08ef7b 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 _0x1ec3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get','/:id','show','/:id/test','isAuthenticated','15s','test','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x1ec3,0x133));var _0x31ec=function(_0x4dd094,_0x2958e4){_0x4dd094=_0x4dd094-0x0;var _0x2458cc=_0x1ec3[_0x4dd094];return _0x2458cc;};'use strict';var multer=require(_0x31ec('0x0'));var util=require(_0x31ec('0x1'));var path=require(_0x31ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x31ec('0x3'));var router=express[_0x31ec('0x4')]();var fs_extra=require(_0x31ec('0x5'));var auth=require(_0x31ec('0x6'));var interaction=require(_0x31ec('0x7'));var config=require(_0x31ec('0x8'));var controller=require(_0x31ec('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x31ec('0xa')]);router[_0x31ec('0xb')](_0x31ec('0xc'),auth['isAuthenticated'](),controller[_0x31ec('0xd')]);router[_0x31ec('0xb')](_0x31ec('0xe'),auth[_0x31ec('0xf')](),timeout(_0x31ec('0x10')),controller[_0x31ec('0x11')]);router[_0x31ec('0x12')]('/',auth[_0x31ec('0xf')](),controller[_0x31ec('0x13')]);router[_0x31ec('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x31ec('0x15')]);router[_0x31ec('0x16')](_0x31ec('0xc'),auth[_0x31ec('0xf')](),controller['destroy']);module[_0x31ec('0x17')]=router; \ No newline at end of file +var _0x8e1e=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','test','post','create','update'];(function(_0x588211,_0x3d73eb){var _0x37e6de=function(_0x260c56){while(--_0x260c56){_0x588211['push'](_0x588211['shift']());}};_0x37e6de(++_0x3d73eb);}(_0x8e1e,0x193));var _0xe8e1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x8e1e[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8e1('0x0'));var timeout=require('connect-timeout');var express=require(_0xe8e1('0x1'));var router=express[_0xe8e1('0x2')]();var fs_extra=require(_0xe8e1('0x3'));var auth=require(_0xe8e1('0x4'));var interaction=require(_0xe8e1('0x5'));var config=require('../../config/environment');var controller=require(_0xe8e1('0x6'));router[_0xe8e1('0x7')]('/',auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x9')]);router[_0xe8e1('0x7')](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller['show']);router['get'](_0xe8e1('0xb'),auth[_0xe8e1('0x8')](),timeout(_0xe8e1('0xc')),controller[_0xe8e1('0xd')]);router[_0xe8e1('0xe')]('/',auth[_0xe8e1('0x8')](),controller[_0xe8e1('0xf')]);router['put'](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x10')]);router[_0xe8e1('0x11')](_0xe8e1('0xa'),auth[_0xe8e1('0x8')](),controller[_0xe8e1('0x12')]);module[_0xe8e1('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 2758909..f444d68 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 _0xd630=['STRING','sequelize','exports','name'];(function(_0x7f644f,_0x1a3a98){var _0x5cfbdb=function(_0x4c64ea){while(--_0x4c64ea){_0x7f644f['push'](_0x7f644f['shift']());}};_0x5cfbdb(++_0x1a3a98);}(_0xd630,0xc5));var _0x0d63=function(_0x3a42b0,_0xd09bbc){_0x3a42b0=_0x3a42b0-0x0;var _0x1ddc9=_0xd630[_0x3a42b0];return _0x1ddc9;};'use strict';var Sequelize=require(_0x0d63('0x0'));module[_0x0d63('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0d63('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0d63('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xacba=['STRING','sequelize'];(function(_0x212b65,_0x3a695b){var _0x2ad15a=function(_0x51b4ea){while(--_0x51b4ea){_0x212b65['push'](_0x212b65['shift']());}};_0x2ad15a(++_0x3a695b);}(_0xacba,0xd1));var _0xaacb=function(_0x2871d4,_0x233c5a){_0x2871d4=_0x2871d4-0x0;var _0x54a31e=_0xacba[_0x2871d4];return _0x54a31e;};'use strict';var Sequelize=require(_0xaacb('0x0'));module['exports']={'name':{'type':Sequelize[_0xaacb('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaacb('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2e2389a..bc9d54e 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 _0x3066=['dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','desk.js','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','json','offset','limit','undefined','count','set','update','then','get','ODBC','destroy','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3066,0x1ac));var _0x6306=function(_0x5c58de,_0x2e3506){_0x5c58de=_0x5c58de-0x0;var _0x3b9b0d=_0x3066[_0x5c58de];return _0x3b9b0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6306('0x0'));var zipdir=require(_0x6306('0x1'));var jsonpatch=require(_0x6306('0x2'));var rp=require(_0x6306('0x3'));var moment=require(_0x6306('0x4'));var BPromise=require(_0x6306('0x5'));var Mustache=require('mustache');var util=require(_0x6306('0x6'));var path=require(_0x6306('0x7'));var sox=require(_0x6306('0x8'));var csv=require('to-csv');var ejs=require(_0x6306('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6306('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6306('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6306('0xc'));var Redis=require('ioredis');var authService=require(_0x6306('0xd'));var qs=require(_0x6306('0xe'));var as=require(_0x6306('0xf'));var hardwareService=require(_0x6306('0x10'));var logger=require(_0x6306('0x11'))(_0x6306('0x12'));var utils=require(_0x6306('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6306('0x14'));var db=require(_0x6306('0x15'))['db'];function respondWithStatusCode(_0x1eb18e,_0x2602b7){_0x2602b7=_0x2602b7||0xcc;return function(_0xb1c74e){if(_0xb1c74e){return _0x1eb18e[_0x6306('0x16')](_0x2602b7);}return _0x1eb18e[_0x6306('0x17')](_0x2602b7)[_0x6306('0x18')]();};}function respondWithResult(_0x7d76f7,_0x66b632){_0x66b632=_0x66b632||0xc8;return function(_0x2aedc7){if(_0x2aedc7){return _0x7d76f7[_0x6306('0x17')](_0x66b632)[_0x6306('0x19')](_0x2aedc7);}};}function respondWithFilteredResult(_0x5a8187,_0x457af6){return function(_0x17b2de){if(_0x17b2de){var _0x2783f8=typeof _0x457af6[_0x6306('0x1a')]==='undefined'&&typeof _0x457af6[_0x6306('0x1b')]===_0x6306('0x1c');var _0x46ab8c=_0x17b2de[_0x6306('0x1d')];var _0x467660=_0x2783f8?0x0:_0x457af6['offset'];var _0x5bda97=_0x2783f8?_0x17b2de[_0x6306('0x1d')]:_0x457af6['offset']+_0x457af6[_0x6306('0x1b')];var _0x45bba3;if(_0x5bda97>=_0x46ab8c){_0x5bda97=_0x46ab8c;_0x45bba3=0xc8;}else{_0x45bba3=0xce;}_0x5a8187[_0x6306('0x17')](_0x45bba3);return _0x5a8187[_0x6306('0x1e')]('Content-Range',_0x467660+'-'+_0x5bda97+'/'+_0x46ab8c)[_0x6306('0x19')](_0x17b2de);}return null;};}function patchUpdates(_0x39b2ed){return function(_0x2cbaeb){try{jsonpatch['apply'](_0x2cbaeb,_0x39b2ed,!![]);}catch(_0x287106){return BPromise['reject'](_0x287106);}return _0x2cbaeb['save']();};}function saveUpdates(_0x4943bb,_0x18f4cc){return function(_0x21bb9e){if(_0x21bb9e){return _0x21bb9e[_0x6306('0x1f')](_0x4943bb)[_0x6306('0x20')](function(_0x4eeaa2){return _0x4eeaa2;});}return null;};}function removeEntity(_0x45dcc6,_0x3f2ddf){return function(_0x1d8dc3){if(_0x1d8dc3){return _0x1d8dc3['destroy']()[_0x6306('0x20')](function(){var _0x53c597=_0x1d8dc3[_0x6306('0x21')]({'plain':!![]});var _0x4ab127=_0x6306('0x22');return db['UserProfileResource'][_0x6306('0x23')]({'where':{'type':_0x4ab127,'resourceId':_0x53c597['id']}})[_0x6306('0x20')](function(){return _0x1d8dc3;});})[_0x6306('0x20')](function(){_0x45dcc6[_0x6306('0x17')](0xcc)[_0x6306('0x18')]();});}};}function handleEntityNotFound(_0x2041c2,_0x28b446){return function(_0x3c3b90){if(!_0x3c3b90){_0x2041c2[_0x6306('0x16')](0x194);}return _0x3c3b90;};}function handleError(_0x4f7a82,_0x36314b){_0x36314b=_0x36314b||0x1f4;return function(_0x5d9c13){logger[_0x6306('0x24')](_0x5d9c13['stack']);if(_0x5d9c13[_0x6306('0x25')]){delete _0x5d9c13['name'];}_0x4f7a82[_0x6306('0x17')](_0x36314b)[_0x6306('0x26')](_0x5d9c13);};}exports[_0x6306('0x27')]=function(_0x16ef30,_0x12c71a){var _0xd4d13={},_0x2b84b1={},_0x5d9093={'count':0x0,'rows':[]};var _0x433b32=_[_0x6306('0x28')](db[_0x6306('0x29')][_0x6306('0x2a')],function(_0x5d6850){return{'name':_0x5d6850[_0x6306('0x2b')],'type':_0x5d6850[_0x6306('0x2c')][_0x6306('0x2d')]};});_0x2b84b1['model']=_[_0x6306('0x28')](_0x433b32,_0x6306('0x25'));_0x2b84b1['query']=_[_0x6306('0x2e')](_0x16ef30[_0x6306('0x2f')]);_0x2b84b1[_0x6306('0x30')]=_['intersection'](_0x2b84b1[_0x6306('0x31')],_0x2b84b1[_0x6306('0x2f')]);_0xd4d13[_0x6306('0x32')]=_[_0x6306('0x33')](_0x2b84b1[_0x6306('0x31')],qs[_0x6306('0x34')](_0x16ef30['query']['fields']));_0xd4d13[_0x6306('0x32')]=_0xd4d13['attributes'][_0x6306('0x35')]?_0xd4d13[_0x6306('0x32')]:_0x2b84b1[_0x6306('0x31')];if(!_0x16ef30[_0x6306('0x2f')][_0x6306('0x36')](_0x6306('0x37'))){_0xd4d13[_0x6306('0x1b')]=qs[_0x6306('0x1b')](_0x16ef30[_0x6306('0x2f')][_0x6306('0x1b')]);_0xd4d13['offset']=qs[_0x6306('0x1a')](_0x16ef30[_0x6306('0x2f')][_0x6306('0x1a')]);}_0xd4d13[_0x6306('0x38')]=qs[_0x6306('0x39')](_0x16ef30[_0x6306('0x2f')]['sort']);_0xd4d13[_0x6306('0x3a')]=qs[_0x6306('0x30')](_[_0x6306('0x3b')](_0x16ef30['query'],_0x2b84b1[_0x6306('0x30')]),_0x433b32);if(_0x16ef30['query'][_0x6306('0x3c')]){_0xd4d13[_0x6306('0x3a')]=_[_0x6306('0x3d')](_0xd4d13[_0x6306('0x3a')],{'$or':_[_0x6306('0x28')](_0x433b32,function(_0x17fe3b){if(_0x17fe3b[_0x6306('0x2c')]!==_0x6306('0x3e')){var _0x10e6ef={};_0x10e6ef[_0x17fe3b[_0x6306('0x25')]]={'$like':'%'+_0x16ef30[_0x6306('0x2f')][_0x6306('0x3c')]+'%'};return _0x10e6ef;}})});}_0xd4d13=_[_0x6306('0x3d')]({},_0xd4d13,_0x16ef30[_0x6306('0x3f')]);var _0xbb21f={'where':_0xd4d13[_0x6306('0x3a')]};return db[_0x6306('0x29')][_0x6306('0x1d')](_0xbb21f)[_0x6306('0x20')](function(_0x296739){_0x5d9093['count']=_0x296739;if(_0x16ef30[_0x6306('0x2f')][_0x6306('0x40')]){_0xd4d13[_0x6306('0x41')]=[{'all':!![]}];}return db[_0x6306('0x29')][_0x6306('0x42')](_0xd4d13);})['then'](function(_0x5d4b1b){_0x5d9093['rows']=_0x5d4b1b;return _0x5d9093;})[_0x6306('0x20')](respondWithFilteredResult(_0x12c71a,_0xd4d13))[_0x6306('0x43')](handleError(_0x12c71a,null));};exports[_0x6306('0x44')]=function(_0x11ddb1,_0x5b7c1f){var _0x51e913={'raw':!![],'where':{'id':_0x11ddb1['params']['id']}},_0x1321a9={};_0x1321a9[_0x6306('0x31')]=_[_0x6306('0x2e')](db[_0x6306('0x29')]['rawAttributes']);_0x1321a9['query']=_[_0x6306('0x2e')](_0x11ddb1[_0x6306('0x2f')]);_0x1321a9['filters']=_[_0x6306('0x33')](_0x1321a9[_0x6306('0x31')],_0x1321a9['query']);_0x51e913[_0x6306('0x32')]=_[_0x6306('0x33')](_0x1321a9[_0x6306('0x31')],qs['fields'](_0x11ddb1[_0x6306('0x2f')]['fields']));_0x51e913[_0x6306('0x32')]=_0x51e913[_0x6306('0x32')][_0x6306('0x35')]?_0x51e913[_0x6306('0x32')]:_0x1321a9['model'];if(_0x11ddb1[_0x6306('0x2f')][_0x6306('0x40')]){_0x51e913[_0x6306('0x41')]=[{'all':!![]}];}_0x51e913=_[_0x6306('0x3d')]({},_0x51e913,_0x11ddb1[_0x6306('0x3f')]);return db[_0x6306('0x29')][_0x6306('0x45')](_0x51e913)[_0x6306('0x20')](handleEntityNotFound(_0x5b7c1f,null))[_0x6306('0x20')](respondWithResult(_0x5b7c1f,null))[_0x6306('0x43')](handleError(_0x5b7c1f,null));};exports[_0x6306('0x46')]=function(_0x5a87c1,_0x46a73e){return db[_0x6306('0x29')][_0x6306('0x46')](_0x5a87c1[_0x6306('0x47')],{})['then'](function(_0x5de455){var _0x56b2d0=_0x5a87c1[_0x6306('0x48')][_0x6306('0x21')]({'plain':!![]});if(!_0x56b2d0)throw new Error(_0x6306('0x49'));if(_0x56b2d0[_0x6306('0x4a')]==='user'){var _0x1e027e=_0x5de455[_0x6306('0x21')]({'plain':!![]});var _0x45cb25='ODBC';return db[_0x6306('0x4b')][_0x6306('0x45')]({'where':{'name':_0x45cb25,'userProfileId':_0x56b2d0[_0x6306('0x4c')]},'raw':!![]})[_0x6306('0x20')](function(_0x4e9a8f){if(_0x4e9a8f&&_0x4e9a8f[_0x6306('0x4d')]===0x0){return db[_0x6306('0x4e')][_0x6306('0x46')]({'name':_0x1e027e[_0x6306('0x25')],'resourceId':_0x1e027e['id'],'type':_0x4e9a8f[_0x6306('0x25')],'sectionId':_0x4e9a8f['id']},{})[_0x6306('0x20')](function(){return _0x5de455;});}else{return _0x5de455;}})[_0x6306('0x43')](function(_0x5ba098){logger[_0x6306('0x24')](_0x6306('0x4f'),_0x5ba098);throw _0x5ba098;});}return _0x5de455;})['then'](respondWithResult(_0x46a73e,0xc9))['catch'](handleError(_0x46a73e,null));};exports[_0x6306('0x1f')]=function(_0x4107ff,_0x50ca7b){if(_0x4107ff[_0x6306('0x47')]['id']){delete _0x4107ff[_0x6306('0x47')]['id'];}return db[_0x6306('0x29')][_0x6306('0x45')]({'where':{'id':_0x4107ff[_0x6306('0x50')]['id']}})[_0x6306('0x20')](handleEntityNotFound(_0x50ca7b,null))[_0x6306('0x20')](saveUpdates(_0x4107ff['body'],null))[_0x6306('0x20')](respondWithResult(_0x50ca7b,null))[_0x6306('0x43')](handleError(_0x50ca7b,null));};exports[_0x6306('0x23')]=function(_0x340fa6,_0x1206e9){return db['SquareOdbc'][_0x6306('0x45')]({'where':{'id':_0x340fa6[_0x6306('0x50')]['id']}})[_0x6306('0x20')](handleEntityNotFound(_0x1206e9,null))[_0x6306('0x20')](removeEntity(_0x1206e9,null))[_0x6306('0x43')](handleError(_0x1206e9,null));};exports[_0x6306('0x51')]=function(_0x2e6b16,_0x16c37c,_0x2c7ac8){var _0x3dfc81;return db[_0x6306('0x29')][_0x6306('0x45')]({'where':{'id':_0x2e6b16[_0x6306('0x50')]['id']},'attributes':['id',_0x6306('0x52')]})[_0x6306('0x20')](handleEntityNotFound(_0x16c37c,null))[_0x6306('0x20')](function(_0xd483ec){if(_0xd483ec){var _0x1e9015=require('odbc')();_0x1e9015[_0x6306('0x53')](_0xd483ec['dsn']);_0x1e9015[_0x6306('0x54')]();return _0xd483ec;}})[_0x6306('0x20')](respondWithResult(_0x16c37c,null))[_0x6306('0x43')](handleError(_0x16c37c,null));}; \ No newline at end of file +var _0xd56b=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareOdbc','includeAll','catch','show','length','include','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','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'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd56b,0x196));var _0xbd56=function(_0x31904b,_0x48100a){_0x31904b=_0x31904b-0x0;var _0x38b2a0=_0xd56b[_0x31904b];return _0x38b2a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd56('0x0'));var zipdir=require(_0xbd56('0x1'));var jsonpatch=require(_0xbd56('0x2'));var rp=require(_0xbd56('0x3'));var moment=require(_0xbd56('0x4'));var BPromise=require(_0xbd56('0x5'));var Mustache=require('mustache');var util=require(_0xbd56('0x6'));var path=require('path');var sox=require(_0xbd56('0x7'));var csv=require('to-csv');var ejs=require(_0xbd56('0x8'));var fs=require('fs');var fs_extra=require(_0xbd56('0x9'));var _=require('lodash');var squel=require(_0xbd56('0xa'));var crypto=require(_0xbd56('0xb'));var jsforce=require(_0xbd56('0xc'));var deskjs=require(_0xbd56('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbd56('0xe'));var Papa=require(_0xbd56('0xf'));var Redis=require(_0xbd56('0x10'));var authService=require(_0xbd56('0x11'));var qs=require(_0xbd56('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd56('0x13'));var logger=require(_0xbd56('0x14'))(_0xbd56('0x15'));var utils=require(_0xbd56('0x16'));var config=require(_0xbd56('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd56('0x18'))['db'];function respondWithStatusCode(_0x1071c1,_0x1cadef){_0x1cadef=_0x1cadef||0xcc;return function(_0x3f58c6){if(_0x3f58c6){return _0x1071c1[_0xbd56('0x19')](_0x1cadef);}return _0x1071c1[_0xbd56('0x1a')](_0x1cadef)[_0xbd56('0x1b')]();};}function respondWithResult(_0x454f2e,_0x10379f){_0x10379f=_0x10379f||0xc8;return function(_0x5751ff){if(_0x5751ff){return _0x454f2e[_0xbd56('0x1a')](_0x10379f)[_0xbd56('0x1c')](_0x5751ff);}};}function respondWithFilteredResult(_0x3c207e,_0x10c63e){return function(_0x4910cc){if(_0x4910cc){var _0x598204=typeof _0x10c63e['offset']===_0xbd56('0x1d')&&typeof _0x10c63e[_0xbd56('0x1e')]===_0xbd56('0x1d');var _0x466022=_0x4910cc[_0xbd56('0x1f')];var _0x4e9deb=_0x598204?0x0:_0x10c63e[_0xbd56('0x20')];var _0x5c7e18=_0x598204?_0x4910cc[_0xbd56('0x1f')]:_0x10c63e[_0xbd56('0x20')]+_0x10c63e[_0xbd56('0x1e')];var _0x8910ae;if(_0x5c7e18>=_0x466022){_0x5c7e18=_0x466022;_0x8910ae=0xc8;}else{_0x8910ae=0xce;}_0x3c207e[_0xbd56('0x1a')](_0x8910ae);return _0x3c207e['set'](_0xbd56('0x21'),_0x4e9deb+'-'+_0x5c7e18+'/'+_0x466022)[_0xbd56('0x1c')](_0x4910cc);}return null;};}function patchUpdates(_0x43e73c){return function(_0x17a468){try{jsonpatch[_0xbd56('0x22')](_0x17a468,_0x43e73c,!![]);}catch(_0x128bb5){return BPromise[_0xbd56('0x23')](_0x128bb5);}return _0x17a468[_0xbd56('0x24')]();};}function saveUpdates(_0x1db910,_0x4da1b9){return function(_0x14033d){if(_0x14033d){return _0x14033d[_0xbd56('0x25')](_0x1db910)[_0xbd56('0x26')](function(_0x39ab27){return _0x39ab27;});}return null;};}function removeEntity(_0x4bee88,_0x44f9f5){return function(_0x5e2b2b){if(_0x5e2b2b){return _0x5e2b2b['destroy']()[_0xbd56('0x26')](function(){var _0x151bf3=_0x5e2b2b[_0xbd56('0x27')]({'plain':!![]});var _0xb591f9=_0xbd56('0x28');return db[_0xbd56('0x29')][_0xbd56('0x2a')]({'where':{'type':_0xb591f9,'resourceId':_0x151bf3['id']}})[_0xbd56('0x26')](function(){return _0x5e2b2b;});})[_0xbd56('0x26')](function(){_0x4bee88[_0xbd56('0x1a')](0xcc)[_0xbd56('0x1b')]();});}};}function handleEntityNotFound(_0xa1024f,_0x3aae8d){return function(_0x38597d){if(!_0x38597d){_0xa1024f[_0xbd56('0x19')](0x194);}return _0x38597d;};}function handleError(_0x33d01c,_0x2c64fa){_0x2c64fa=_0x2c64fa||0x1f4;return function(_0x49c90a){logger[_0xbd56('0x2b')](_0x49c90a['stack']);if(_0x49c90a[_0xbd56('0x2c')]){delete _0x49c90a[_0xbd56('0x2c')];}_0x33d01c[_0xbd56('0x1a')](_0x2c64fa)[_0xbd56('0x2d')](_0x49c90a);};}exports[_0xbd56('0x2e')]=function(_0x793946,_0xa54687){var _0x1d08d1={},_0x2d72cd={},_0x5f235a={'count':0x0,'rows':[]};var _0x4bf77a=_['map'](db['SquareOdbc']['rawAttributes'],function(_0xbd5474){return{'name':_0xbd5474['fieldName'],'type':_0xbd5474[_0xbd56('0x2f')][_0xbd56('0x30')]};});_0x2d72cd[_0xbd56('0x31')]=_[_0xbd56('0x32')](_0x4bf77a,_0xbd56('0x2c'));_0x2d72cd[_0xbd56('0x33')]=_[_0xbd56('0x34')](_0x793946[_0xbd56('0x33')]);_0x2d72cd[_0xbd56('0x35')]=_[_0xbd56('0x36')](_0x2d72cd[_0xbd56('0x31')],_0x2d72cd[_0xbd56('0x33')]);_0x1d08d1[_0xbd56('0x37')]=_[_0xbd56('0x36')](_0x2d72cd[_0xbd56('0x31')],qs[_0xbd56('0x38')](_0x793946['query'][_0xbd56('0x38')]));_0x1d08d1['attributes']=_0x1d08d1[_0xbd56('0x37')]['length']?_0x1d08d1[_0xbd56('0x37')]:_0x2d72cd[_0xbd56('0x31')];if(!_0x793946[_0xbd56('0x33')][_0xbd56('0x39')](_0xbd56('0x3a'))){_0x1d08d1[_0xbd56('0x1e')]=qs['limit'](_0x793946[_0xbd56('0x33')][_0xbd56('0x1e')]);_0x1d08d1[_0xbd56('0x20')]=qs[_0xbd56('0x20')](_0x793946[_0xbd56('0x33')][_0xbd56('0x20')]);}_0x1d08d1[_0xbd56('0x3b')]=qs[_0xbd56('0x3c')](_0x793946['query']['sort']);_0x1d08d1[_0xbd56('0x3d')]=qs[_0xbd56('0x35')](_[_0xbd56('0x3e')](_0x793946[_0xbd56('0x33')],_0x2d72cd['filters']),_0x4bf77a);if(_0x793946['query'][_0xbd56('0x3f')]){_0x1d08d1[_0xbd56('0x3d')]=_[_0xbd56('0x40')](_0x1d08d1[_0xbd56('0x3d')],{'$or':_[_0xbd56('0x32')](_0x4bf77a,function(_0x48adb3){if(_0x48adb3[_0xbd56('0x2f')]!=='VIRTUAL'){var _0x3986e0={};_0x3986e0[_0x48adb3['name']]={'$like':'%'+_0x793946[_0xbd56('0x33')][_0xbd56('0x3f')]+'%'};return _0x3986e0;}})});}_0x1d08d1=_['merge']({},_0x1d08d1,_0x793946[_0xbd56('0x41')]);var _0x380442={'where':_0x1d08d1[_0xbd56('0x3d')]};return db[_0xbd56('0x42')][_0xbd56('0x1f')](_0x380442)['then'](function(_0x5b0a90){_0x5f235a[_0xbd56('0x1f')]=_0x5b0a90;if(_0x793946[_0xbd56('0x33')][_0xbd56('0x43')]){_0x1d08d1['include']=[{'all':!![]}];}return db[_0xbd56('0x42')]['findAll'](_0x1d08d1);})[_0xbd56('0x26')](function(_0x1b6a2c){_0x5f235a['rows']=_0x1b6a2c;return _0x5f235a;})[_0xbd56('0x26')](respondWithFilteredResult(_0xa54687,_0x1d08d1))[_0xbd56('0x44')](handleError(_0xa54687,null));};exports[_0xbd56('0x45')]=function(_0x153758,_0x2f5a82){var _0x234d7b={'raw':!![],'where':{'id':_0x153758['params']['id']}},_0x3840e6={};_0x3840e6[_0xbd56('0x31')]=_['keys'](db['SquareOdbc']['rawAttributes']);_0x3840e6['query']=_[_0xbd56('0x34')](_0x153758[_0xbd56('0x33')]);_0x3840e6[_0xbd56('0x35')]=_[_0xbd56('0x36')](_0x3840e6[_0xbd56('0x31')],_0x3840e6['query']);_0x234d7b[_0xbd56('0x37')]=_[_0xbd56('0x36')](_0x3840e6['model'],qs[_0xbd56('0x38')](_0x153758[_0xbd56('0x33')]['fields']));_0x234d7b[_0xbd56('0x37')]=_0x234d7b[_0xbd56('0x37')][_0xbd56('0x46')]?_0x234d7b[_0xbd56('0x37')]:_0x3840e6[_0xbd56('0x31')];if(_0x153758['query']['includeAll']){_0x234d7b[_0xbd56('0x47')]=[{'all':!![]}];}_0x234d7b=_[_0xbd56('0x40')]({},_0x234d7b,_0x153758[_0xbd56('0x41')]);return db[_0xbd56('0x42')]['find'](_0x234d7b)[_0xbd56('0x26')](handleEntityNotFound(_0x2f5a82,null))[_0xbd56('0x26')](respondWithResult(_0x2f5a82,null))[_0xbd56('0x44')](handleError(_0x2f5a82,null));};exports[_0xbd56('0x48')]=function(_0x284e54,_0x46d097){return db['SquareOdbc'][_0xbd56('0x48')](_0x284e54[_0xbd56('0x49')],{})[_0xbd56('0x26')](function(_0x5327ca){var _0x18f155=_0x284e54[_0xbd56('0x4a')][_0xbd56('0x27')]({'plain':!![]});if(!_0x18f155)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f155[_0xbd56('0x4b')]==='user'){var _0x578209=_0x5327ca[_0xbd56('0x27')]({'plain':!![]});var _0x49c92e='ODBC';return db[_0xbd56('0x4c')]['find']({'where':{'name':_0x49c92e,'userProfileId':_0x18f155['userProfileId']},'raw':!![]})[_0xbd56('0x26')](function(_0x3b9299){if(_0x3b9299&&_0x3b9299[_0xbd56('0x4d')]===0x0){return db[_0xbd56('0x29')][_0xbd56('0x48')]({'name':_0x578209[_0xbd56('0x2c')],'resourceId':_0x578209['id'],'type':_0x3b9299[_0xbd56('0x2c')],'sectionId':_0x3b9299['id']},{})[_0xbd56('0x26')](function(){return _0x5327ca;});}else{return _0x5327ca;}})[_0xbd56('0x44')](function(_0x7371cb){logger[_0xbd56('0x2b')](_0xbd56('0x4e'),_0x7371cb);throw _0x7371cb;});}return _0x5327ca;})['then'](respondWithResult(_0x46d097,0xc9))[_0xbd56('0x44')](handleError(_0x46d097,null));};exports[_0xbd56('0x25')]=function(_0x45d4d7,_0x27cd52){if(_0x45d4d7[_0xbd56('0x49')]['id']){delete _0x45d4d7[_0xbd56('0x49')]['id'];}return db[_0xbd56('0x42')]['find']({'where':{'id':_0x45d4d7[_0xbd56('0x4f')]['id']}})[_0xbd56('0x26')](handleEntityNotFound(_0x27cd52,null))[_0xbd56('0x26')](saveUpdates(_0x45d4d7['body'],null))[_0xbd56('0x26')](respondWithResult(_0x27cd52,null))[_0xbd56('0x44')](handleError(_0x27cd52,null));};exports[_0xbd56('0x2a')]=function(_0x29f2f3,_0x1f9e75){return db['SquareOdbc'][_0xbd56('0x50')]({'where':{'id':_0x29f2f3['params']['id']}})[_0xbd56('0x26')](handleEntityNotFound(_0x1f9e75,null))[_0xbd56('0x26')](removeEntity(_0x1f9e75,null))[_0xbd56('0x44')](handleError(_0x1f9e75,null));};exports[_0xbd56('0x51')]=function(_0x3ab30a,_0x5e6e9c,_0x50faf2){var _0x4cde70;return db['SquareOdbc'][_0xbd56('0x50')]({'where':{'id':_0x3ab30a[_0xbd56('0x4f')]['id']},'attributes':['id',_0xbd56('0x52')]})[_0xbd56('0x26')](handleEntityNotFound(_0x5e6e9c,null))['then'](function(_0x220759){if(_0x220759){var _0x202d79=require(_0xbd56('0x53'))();_0x202d79[_0xbd56('0x54')](_0x220759['dsn']);_0x202d79[_0xbd56('0x55')]();return _0x220759;}})[_0xbd56('0x26')](respondWithResult(_0x5e6e9c,null))[_0xbd56('0x44')](handleError(_0x5e6e9c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5a1381c..20ea571 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 _0xf265=['request-promise','path','../../config/environment','define','lodash','util','moment','bluebird'];(function(_0x4ea104,_0x375e20){var _0xc0ade7=function(_0x79ea7c){while(--_0x79ea7c){_0x4ea104['push'](_0x4ea104['shift']());}};_0xc0ade7(++_0x375e20);}(_0xf265,0xf4));var _0x5f26=function(_0x4a0f60,_0x298c30){_0x4a0f60=_0x4a0f60-0x0;var _0x59b579=_0xf265[_0x4a0f60];return _0x59b579;};'use strict';var _=require(_0x5f26('0x0'));var util=require(_0x5f26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f26('0x2'));var BPromise=require(_0x5f26('0x3'));var rp=require(_0x5f26('0x4'));var fs=require('fs');var path=require(_0x5f26('0x5'));var rimraf=require('rimraf');var config=require(_0x5f26('0x6'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x937491,_0x192607){return _0x937491[_0x5f26('0x7')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b0b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1b0b,0x1c7));var _0xb1b0=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1b0b[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb1b0('0x0'))(_0xb1b0('0x1'));var moment=require(_0xb1b0('0x2'));var BPromise=require(_0xb1b0('0x3'));var rp=require(_0xb1b0('0x4'));var fs=require('fs');var path=require(_0xb1b0('0x5'));var rimraf=require(_0xb1b0('0x6'));var config=require(_0xb1b0('0x7'));var attributes=require(_0xb1b0('0x8'));module[_0xb1b0('0x9')]=function(_0x5ecfa7,_0x57c92f){return _0x5ecfa7[_0xb1b0('0xa')](_0xb1b0('0xb'),attributes,{'tableName':_0xb1b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index e95dd2c..c816181 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 _0x9d19=['SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','ShowSquareOdbc','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x6c2cd0,_0x48454e){var _0x288e7b=function(_0x2f1ede){while(--_0x2f1ede){_0x6c2cd0['push'](_0x6c2cd0['shift']());}};_0x288e7b(++_0x48454e);}(_0x9d19,0x15b));var _0x99d1=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x9d19[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x99d1('0x0'));var util=require(_0x99d1('0x1'));var moment=require(_0x99d1('0x2'));var BPromise=require(_0x99d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99d1('0x4'))['db'];var utils=require(_0x99d1('0x5'));var logger=require(_0x99d1('0x6'))(_0x99d1('0x7'));var config=require(_0x99d1('0x8'));var jayson=require(_0x99d1('0x9'));var client=jayson[_0x99d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bd5d7,_0x19e558,_0x557da5){return new BPromise(function(_0x543f1d,_0x36413b){return client[_0x99d1('0xb')](_0x4bd5d7,_0x557da5)[_0x99d1('0xc')](function(_0xf36fa7){logger['info'](_0x99d1('0xd'),_0x19e558,_0x99d1('0xe'));logger[_0x99d1('0xf')](_0x99d1('0x10'),_0x19e558,_0x99d1('0xe'),JSON[_0x99d1('0x11')](_0xf36fa7));if(_0xf36fa7['error']){if(_0xf36fa7[_0x99d1('0x12')][_0x99d1('0x13')]===0x1f4){logger[_0x99d1('0x12')](_0x99d1('0xd'),_0x19e558,_0xf36fa7[_0x99d1('0x12')]['message']);return _0x36413b(_0xf36fa7[_0x99d1('0x12')][_0x99d1('0x14')]);}logger[_0x99d1('0x12')](_0x99d1('0xd'),_0x19e558,_0xf36fa7['error'][_0x99d1('0x14')]);return _0x543f1d(_0xf36fa7[_0x99d1('0x12')][_0x99d1('0x14')]);}else{logger[_0x99d1('0x15')](_0x99d1('0xd'),_0x19e558,_0x99d1('0xe'));_0x543f1d(_0xf36fa7['result'][_0x99d1('0x14')]);}})['catch'](function(_0x2ecd7f){logger[_0x99d1('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x19e558,_0x2ecd7f);_0x36413b(_0x2ecd7f);});});}exports[_0x99d1('0x16')]=function(_0x15e072){var _0x24b946=this;return new Promise(function(_0x14c167,_0x4134a3){return db['SquareOdbc']['find']({'raw':_0x15e072[_0x99d1('0x17')]?_0x15e072[_0x99d1('0x17')][_0x99d1('0x18')]===undefined?!![]:![]:!![],'where':_0x15e072['options']?_0x15e072[_0x99d1('0x17')][_0x99d1('0x19')]||null:null,'attributes':_0x15e072[_0x99d1('0x17')]?_0x15e072[_0x99d1('0x17')][_0x99d1('0x1a')]||null:null,'include':_0x15e072['options']?_0x15e072['options'][_0x99d1('0x1b')]?_[_0x99d1('0x1c')](_0x15e072[_0x99d1('0x17')][_0x99d1('0x1b')],function(_0x4d7d20){return{'model':db[_0x4d7d20[_0x99d1('0x1d')]],'as':_0x4d7d20['as'],'attributes':_0x4d7d20['attributes'],'include':_0x4d7d20[_0x99d1('0x1b')]?_['map'](_0x4d7d20[_0x99d1('0x1b')],function(_0x1904d7){return{'model':db[_0x1904d7['model']],'as':_0x1904d7['as'],'attributes':_0x1904d7[_0x99d1('0x1a')],'include':_0x1904d7['include']?_[_0x99d1('0x1c')](_0x1904d7[_0x99d1('0x1b')],function(_0x57d273){return{'model':db[_0x57d273[_0x99d1('0x1d')]],'as':_0x57d273['as'],'attributes':_0x57d273['attributes']};}):[]};}):[]};}):[]:[]})[_0x99d1('0xc')](function(_0x3c2ce7){logger['info'](_0x99d1('0x16'),_0x15e072);logger[_0x99d1('0xf')]('ShowSquareOdbc',_0x15e072,JSON['stringify'](_0x3c2ce7));_0x14c167(_0x3c2ce7);})['catch'](function(_0x105905){logger[_0x99d1('0x12')](_0x99d1('0x16'),_0x105905[_0x99d1('0x14')],_0x15e072);_0x4134a3(_0x24b946[_0x99d1('0x12')](0x1f4,_0x105905[_0x99d1('0x14')]));});});}; \ No newline at end of file +var _0x9735=['client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x32cf56,_0x58ed3a){var _0x1f4d8f=function(_0x134638){while(--_0x134638){_0x32cf56['push'](_0x32cf56['shift']());}};_0x1f4d8f(++_0x58ed3a);}(_0x9735,0x1a5));var _0x5973=function(_0x3b664e,_0x1919f5){_0x3b664e=_0x3b664e-0x0;var _0x2f0b07=_0x9735[_0x3b664e];return _0x2f0b07;};'use strict';var _=require(_0x5973('0x0'));var util=require(_0x5973('0x1'));var moment=require(_0x5973('0x2'));var BPromise=require(_0x5973('0x3'));var rs=require(_0x5973('0x4'));var fs=require('fs');var Redis=require(_0x5973('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5973('0x6'))(_0x5973('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5973('0x8')][_0x5973('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11ef6f,_0x24dd27,_0x455ecd){return new BPromise(function(_0x2108de,_0x407a16){return client[_0x5973('0xa')](_0x11ef6f,_0x455ecd)[_0x5973('0xb')](function(_0x5af092){logger[_0x5973('0xc')](_0x5973('0xd'),_0x24dd27,_0x5973('0xe'));logger[_0x5973('0xf')](_0x5973('0x10'),_0x24dd27,_0x5973('0xe'),JSON['stringify'](_0x5af092));if(_0x5af092[_0x5973('0x11')]){if(_0x5af092[_0x5973('0x11')][_0x5973('0x12')]===0x1f4){logger[_0x5973('0x11')](_0x5973('0xd'),_0x24dd27,_0x5af092['error']['message']);return _0x407a16(_0x5af092[_0x5973('0x11')][_0x5973('0x13')]);}logger[_0x5973('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x24dd27,_0x5af092[_0x5973('0x11')][_0x5973('0x13')]);return _0x2108de(_0x5af092['error'][_0x5973('0x13')]);}else{logger[_0x5973('0xc')](_0x5973('0xd'),_0x24dd27,_0x5973('0xe'));_0x2108de(_0x5af092[_0x5973('0x14')]['message']);}})[_0x5973('0x15')](function(_0xbd7d74){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x24dd27,_0xbd7d74);_0x407a16(_0xbd7d74);});});}exports[_0x5973('0x16')]=function(_0x148439){var _0x5a8eea=this;return new Promise(function(_0x2f0414,_0x1e60fd){return db[_0x5973('0x17')][_0x5973('0x18')]({'raw':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1a')]===undefined?!![]:![]:!![],'where':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1b')]||null:null,'attributes':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1c')]||null:null,'include':_0x148439[_0x5973('0x19')]?_0x148439[_0x5973('0x19')][_0x5973('0x1d')]?_['map'](_0x148439[_0x5973('0x19')][_0x5973('0x1d')],function(_0x267563){return{'model':db[_0x267563[_0x5973('0x1e')]],'as':_0x267563['as'],'attributes':_0x267563[_0x5973('0x1c')],'include':_0x267563['include']?_[_0x5973('0x1f')](_0x267563['include'],function(_0x77f23f){return{'model':db[_0x77f23f[_0x5973('0x1e')]],'as':_0x77f23f['as'],'attributes':_0x77f23f[_0x5973('0x1c')],'include':_0x77f23f[_0x5973('0x1d')]?_[_0x5973('0x1f')](_0x77f23f[_0x5973('0x1d')],function(_0x430b09){return{'model':db[_0x430b09[_0x5973('0x1e')]],'as':_0x430b09['as'],'attributes':_0x430b09[_0x5973('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5973('0xb')](function(_0x2768d7){logger['info'](_0x5973('0x16'),_0x148439);logger['debug'](_0x5973('0x16'),_0x148439,JSON[_0x5973('0x20')](_0x2768d7));_0x2f0414(_0x2768d7);})[_0x5973('0x15')](function(_0x163047){logger[_0x5973('0x11')](_0x5973('0x16'),_0x163047[_0x5973('0x13')],_0x148439);_0x1e60fd(_0x5a8eea[_0x5973('0x11')](0x1f4,_0x163047[_0x5973('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 0ae5f7f..ccc0589 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 _0xa282=['get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','addUsers','put','update','destroy','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xa282,0x1f3));var _0x2a28=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa282[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0x2a28('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a28('0x1'));var express=require('express');var router=express[_0x2a28('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2a28('0x3'));var interaction=require(_0x2a28('0x4'));var config=require(_0x2a28('0x5'));var controller=require(_0x2a28('0x6'));router[_0x2a28('0x7')]('/',auth[_0x2a28('0x8')](),controller[_0x2a28('0x9')]);router[_0x2a28('0x7')](_0x2a28('0xa'),auth[_0x2a28('0x8')](),controller[_0x2a28('0xb')]);router[_0x2a28('0x7')](_0x2a28('0xc'),auth['isAuthenticated'](),controller[_0x2a28('0xd')]);router['post']('/',auth[_0x2a28('0x8')](),controller[_0x2a28('0xe')]);router[_0x2a28('0xf')](_0x2a28('0xc'),auth[_0x2a28('0x8')](),controller[_0x2a28('0x10')]);router[_0x2a28('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2a28('0x12')]);router['delete'](_0x2a28('0xa'),auth[_0x2a28('0x8')](),controller[_0x2a28('0x13')]);router[_0x2a28('0x14')](_0x2a28('0xc'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x2a28('0x15')]=router; \ No newline at end of file +var _0xfef3=['./squareProject.controller','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','addUsers','put','update','destroy','removeUsers','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5796d0,_0x2a4569){var _0x490adb=function(_0x26b827){while(--_0x26b827){_0x5796d0['push'](_0x5796d0['shift']());}};_0x490adb(++_0x2a4569);}(_0xfef3,0x118));var _0x3fef=function(_0x2b36fd,_0x156106){_0x2b36fd=_0x2b36fd-0x0;var _0x3df453=_0xfef3[_0x2b36fd];return _0x3df453;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');var controller=require(_0x3fef('0x6'));router[_0x3fef('0x7')]('/',auth['isAuthenticated'](),controller[_0x3fef('0x8')]);router[_0x3fef('0x7')](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xb')]);router[_0x3fef('0x7')](_0x3fef('0xc'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')]('/',auth[_0x3fef('0xa')](),controller[_0x3fef('0xf')]);router[_0x3fef('0xe')](_0x3fef('0xc'),auth['isAuthenticated'](),controller[_0x3fef('0x10')]);router[_0x3fef('0x11')](_0x3fef('0x9'),auth['isAuthenticated'](),controller[_0x3fef('0x12')]);router['delete'](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0x13')]);router['delete'](_0x3fef('0xc'),auth['isAuthenticated'](),controller[_0x3fef('0x14')]);module[_0x3fef('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 0c1a2c1..38c97a8 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 _0x6dda=['DATE','sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x6dda,0x17a));var _0xa6dd=function(_0x2e237b,_0x2f518e){_0x2e237b=_0x2e237b-0x0;var _0x404ad5=_0x6dda[_0x2e237b];return _0x404ad5;};'use strict';var Sequelize=require(_0xa6dd('0x0'));module[_0xa6dd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa6dd('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa6dd('0x3')]},'notes':{'type':Sequelize[_0xa6dd('0x4')]},'preproduction':{'type':Sequelize[_0xa6dd('0x5')](_0xa6dd('0x6')),'get':function(){if(this[_0xa6dd('0x7')](_0xa6dd('0x8'))){return this[_0xa6dd('0x7')](_0xa6dd('0x8'))[_0xa6dd('0x9')](_0xa6dd('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0xa6dd('0x6')),'get':function(){if(this[_0xa6dd('0x7')]('production')){return this[_0xa6dd('0x7')](_0xa6dd('0xb'))[_0xa6dd('0x9')](_0xa6dd('0xa'));}}},'savedAt':{'type':Sequelize[_0xa6dd('0xc')]},'publishedAt':{'type':Sequelize[_0xa6dd('0xc')]}}; \ No newline at end of file +var _0x7cf8=['sequelize','exports','STRING','name','TEXT','BLOB','preproduction','getDataValue','toString','utf8','long','production','DATE'];(function(_0xcd9ec8,_0x27699f){var _0x5aa31b=function(_0x32f922){while(--_0x32f922){_0xcd9ec8['push'](_0xcd9ec8['shift']());}};_0x5aa31b(++_0x27699f);}(_0x7cf8,0xa9));var _0x87cf=function(_0x2bb35c,_0x1fe5ec){_0x2bb35c=_0x2bb35c-0x0;var _0x377721=_0x7cf8[_0x2bb35c];return _0x377721;};'use strict';var Sequelize=require(_0x87cf('0x0'));module[_0x87cf('0x1')]={'name':{'type':Sequelize[_0x87cf('0x2')],'unique':_0x87cf('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x87cf('0x2')]},'notes':{'type':Sequelize[_0x87cf('0x4')]},'preproduction':{'type':Sequelize[_0x87cf('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x87cf('0x6'))){return this[_0x87cf('0x7')](_0x87cf('0x6'))[_0x87cf('0x8')](_0x87cf('0x9'));}}},'production':{'type':Sequelize[_0x87cf('0x5')](_0x87cf('0xa')),'get':function(){if(this[_0x87cf('0x7')](_0x87cf('0xb'))){return this[_0x87cf('0x7')](_0x87cf('0xb'))['toString'](_0x87cf('0x9'));}}},'savedAt':{'type':Sequelize[_0x87cf('0xc')]},'publishedAt':{'type':Sequelize[_0x87cf('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8054831..3772ef7 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 _0x61a3=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./squareProject.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x5955d8,_0x2367a0){var _0x2d1017=function(_0x523470){while(--_0x523470){_0x5955d8['push'](_0x5955d8['shift']());}};_0x2d1017(++_0x2367a0);}(_0x61a3,0x112));var _0x361a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x61a3[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x361a('0x0'));var zipdir=require(_0x361a('0x1'));var jsonpatch=require(_0x361a('0x2'));var rp=require(_0x361a('0x3'));var moment=require(_0x361a('0x4'));var BPromise=require(_0x361a('0x5'));var Mustache=require(_0x361a('0x6'));var util=require(_0x361a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x361a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x361a('0x9'));var squel=require('squel');var crypto=require(_0x361a('0xa'));var jsforce=require(_0x361a('0xb'));var deskjs=require(_0x361a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x361a('0xd'));var Papa=require(_0x361a('0xe'));var Redis=require('ioredis');var authService=require(_0x361a('0xf'));var qs=require(_0x361a('0x10'));var as=require(_0x361a('0x11'));var hardwareService=require(_0x361a('0x12'));var logger=require(_0x361a('0x13'))(_0x361a('0x14'));var utils=require(_0x361a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x361a('0x16')]=_['defaults'](config[_0x361a('0x16')],{'host':_0x361a('0x17'),'port':0x18eb});var socket=require(_0x361a('0x18'))(new Redis(config['redis']));require(_0x361a('0x19'))['register'](socket);function respondWithStatusCode(_0x321d17,_0x3e4e86){_0x3e4e86=_0x3e4e86||0xcc;return function(_0x1d8855){if(_0x1d8855){return _0x321d17['sendStatus'](_0x3e4e86);}return _0x321d17[_0x361a('0x1a')](_0x3e4e86)[_0x361a('0x1b')]();};}function respondWithResult(_0x1aef6c,_0x4cbb69){_0x4cbb69=_0x4cbb69||0xc8;return function(_0x5a51e5){if(_0x5a51e5){return _0x1aef6c[_0x361a('0x1a')](_0x4cbb69)[_0x361a('0x1c')](_0x5a51e5);}};}function respondWithFilteredResult(_0x171cfa,_0x296a09){return function(_0x376197){if(_0x376197){var _0x43907f=typeof _0x296a09[_0x361a('0x1d')]===_0x361a('0x1e')&&typeof _0x296a09['limit']===_0x361a('0x1e');var _0x2d0027=_0x376197['count'];var _0x10d3bd=_0x43907f?0x0:_0x296a09[_0x361a('0x1d')];var _0x3d3708=_0x43907f?_0x376197[_0x361a('0x1f')]:_0x296a09[_0x361a('0x1d')]+_0x296a09[_0x361a('0x20')];var _0x118d0e;if(_0x3d3708>=_0x2d0027){_0x3d3708=_0x2d0027;_0x118d0e=0xc8;}else{_0x118d0e=0xce;}_0x171cfa[_0x361a('0x1a')](_0x118d0e);return _0x171cfa[_0x361a('0x21')](_0x361a('0x22'),_0x10d3bd+'-'+_0x3d3708+'/'+_0x2d0027)[_0x361a('0x1c')](_0x376197);}return null;};}function patchUpdates(_0x114043){return function(_0x1fef01){try{jsonpatch[_0x361a('0x23')](_0x1fef01,_0x114043,!![]);}catch(_0x301033){return BPromise['reject'](_0x301033);}return _0x1fef01[_0x361a('0x24')]();};}function saveUpdates(_0x455813,_0xf0686d){return function(_0x203987){if(_0x203987){return _0x203987[_0x361a('0x25')](_0x455813)[_0x361a('0x26')](function(_0x1812ff){return _0x1812ff;});}return null;};}function removeEntity(_0x311bc5,_0x340eac){return function(_0x6911fc){if(_0x6911fc){return _0x6911fc[_0x361a('0x27')]()[_0x361a('0x26')](function(){var _0x14fb6f=_0x6911fc[_0x361a('0x28')]({'plain':!![]});var _0x977fb3=_0x361a('0x29');return db[_0x361a('0x2a')]['destroy']({'where':{'type':_0x977fb3,'resourceId':_0x14fb6f['id']}})[_0x361a('0x26')](function(){return _0x6911fc;});})[_0x361a('0x26')](function(){_0x311bc5['status'](0xcc)[_0x361a('0x1b')]();});}};}function handleEntityNotFound(_0x3f090c,_0x36d65d){return function(_0x496538){if(!_0x496538){_0x3f090c['sendStatus'](0x194);}return _0x496538;};}function handleError(_0x3d0448,_0x3f29e9){_0x3f29e9=_0x3f29e9||0x1f4;return function(_0x26d720){logger[_0x361a('0x2b')](_0x26d720['stack']);if(_0x26d720[_0x361a('0x2c')]){delete _0x26d720['name'];}_0x3d0448['status'](_0x3f29e9)[_0x361a('0x2d')](_0x26d720);};}exports[_0x361a('0x2e')]=function(_0x283c9b,_0x1b20f1){var _0x18c8fe={},_0x27d798={},_0x54b015={'count':0x0,'rows':[]};var _0x4e3e36=_['map'](db[_0x361a('0x2f')][_0x361a('0x30')],function(_0xc696f4){return{'name':_0xc696f4[_0x361a('0x31')],'type':_0xc696f4[_0x361a('0x32')][_0x361a('0x33')]};});_0x27d798[_0x361a('0x34')]=_[_0x361a('0x35')](_0x4e3e36,_0x361a('0x2c'));_0x27d798[_0x361a('0x36')]=_[_0x361a('0x37')](_0x283c9b[_0x361a('0x36')]);_0x27d798['filters']=_[_0x361a('0x38')](_0x27d798[_0x361a('0x34')],_0x27d798[_0x361a('0x36')]);_0x18c8fe[_0x361a('0x39')]=_['intersection'](_0x27d798[_0x361a('0x34')],qs[_0x361a('0x3a')](_0x283c9b[_0x361a('0x36')][_0x361a('0x3a')]));_0x18c8fe[_0x361a('0x39')]=_0x18c8fe['attributes'][_0x361a('0x3b')]?_0x18c8fe[_0x361a('0x39')]:_0x27d798[_0x361a('0x34')];if(!_0x283c9b['query'][_0x361a('0x3c')](_0x361a('0x3d'))){_0x18c8fe[_0x361a('0x20')]=qs[_0x361a('0x20')](_0x283c9b[_0x361a('0x36')][_0x361a('0x20')]);_0x18c8fe[_0x361a('0x1d')]=qs['offset'](_0x283c9b[_0x361a('0x36')][_0x361a('0x1d')]);}_0x18c8fe['order']=qs[_0x361a('0x3e')](_0x283c9b['query'][_0x361a('0x3e')]);_0x18c8fe[_0x361a('0x3f')]=qs[_0x361a('0x40')](_[_0x361a('0x41')](_0x283c9b[_0x361a('0x36')],_0x27d798[_0x361a('0x40')]),_0x4e3e36);if(_0x283c9b['query'][_0x361a('0x42')]){_0x18c8fe['where']=_[_0x361a('0x43')](_0x18c8fe[_0x361a('0x3f')],{'$or':_[_0x361a('0x35')](_0x4e3e36,function(_0x2806c5){if(_0x2806c5[_0x361a('0x32')]!==_0x361a('0x44')){var _0x21290e={};_0x21290e[_0x2806c5[_0x361a('0x2c')]]={'$like':'%'+_0x283c9b[_0x361a('0x36')][_0x361a('0x42')]+'%'};return _0x21290e;}})});}_0x18c8fe=_[_0x361a('0x43')]({},_0x18c8fe,_0x283c9b['options']);var _0x102d10={'where':_0x18c8fe[_0x361a('0x3f')]};return db[_0x361a('0x2f')]['count'](_0x102d10)[_0x361a('0x26')](function(_0x41eb26){_0x54b015[_0x361a('0x1f')]=_0x41eb26;if(_0x283c9b[_0x361a('0x36')]['includeAll']){_0x18c8fe[_0x361a('0x45')]=[{'all':!![]}];}return db[_0x361a('0x2f')][_0x361a('0x46')](_0x18c8fe);})[_0x361a('0x26')](function(_0x9aeb17){_0x54b015[_0x361a('0x47')]=_0x9aeb17;return _0x54b015;})[_0x361a('0x26')](respondWithFilteredResult(_0x1b20f1,_0x18c8fe))[_0x361a('0x48')](handleError(_0x1b20f1,null));};exports[_0x361a('0x49')]=function(_0x54911a,_0x1bc385){var _0x217541={'raw':![],'where':{'id':_0x54911a[_0x361a('0x4a')]['id']}},_0x226a59={};_0x226a59['model']=_[_0x361a('0x37')](db['SquareProject']['rawAttributes']);_0x226a59['query']=_['keys'](_0x54911a['query']);_0x226a59[_0x361a('0x40')]=_['intersection'](_0x226a59[_0x361a('0x34')],_0x226a59[_0x361a('0x36')]);_0x217541[_0x361a('0x39')]=_[_0x361a('0x38')](_0x226a59[_0x361a('0x34')],qs['fields'](_0x54911a[_0x361a('0x36')]['fields']));_0x217541[_0x361a('0x39')]=_0x217541[_0x361a('0x39')][_0x361a('0x3b')]?_0x217541[_0x361a('0x39')]:_0x226a59[_0x361a('0x34')];if(_0x54911a[_0x361a('0x36')][_0x361a('0x4b')]){_0x217541[_0x361a('0x45')]=[{'all':!![]}];}_0x217541=_[_0x361a('0x43')]({},_0x217541,_0x54911a[_0x361a('0x4c')]);return db[_0x361a('0x2f')][_0x361a('0x4d')](_0x217541)['then'](handleEntityNotFound(_0x1bc385,null))[_0x361a('0x26')](respondWithResult(_0x1bc385,null))[_0x361a('0x48')](handleError(_0x1bc385,null));};exports['create']=function(_0x42764c,_0x4df8f6){return db[_0x361a('0x2f')][_0x361a('0x4e')](_0x42764c[_0x361a('0x4f')],{})[_0x361a('0x26')](function(_0x29df14){var _0x31285e=_0x42764c[_0x361a('0x50')][_0x361a('0x28')]({'plain':!![]});if(!_0x31285e)throw new Error(_0x361a('0x51'));if(_0x31285e[_0x361a('0x52')]===_0x361a('0x50')){var _0x569941=_0x29df14[_0x361a('0x28')]({'plain':!![]});var _0x5cb326='SquareProjects';return db['UserProfileSection'][_0x361a('0x4d')]({'where':{'name':_0x5cb326,'userProfileId':_0x31285e[_0x361a('0x53')]},'raw':!![]})[_0x361a('0x26')](function(_0x17d5b1){if(_0x17d5b1&&_0x17d5b1[_0x361a('0x54')]===0x0){return db[_0x361a('0x2a')][_0x361a('0x4e')]({'name':_0x569941[_0x361a('0x2c')],'resourceId':_0x569941['id'],'type':_0x17d5b1[_0x361a('0x2c')],'sectionId':_0x17d5b1['id']},{})[_0x361a('0x26')](function(){return _0x29df14;});}else{return _0x29df14;}})[_0x361a('0x48')](function(_0x54c8e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54c8e5);throw _0x54c8e5;});}return _0x29df14;})[_0x361a('0x26')](respondWithResult(_0x4df8f6,0xc9))[_0x361a('0x48')](handleError(_0x4df8f6,null));};exports[_0x361a('0x25')]=function(_0xc8c74c,_0x427f9d){if(_0xc8c74c['body']['id']){delete _0xc8c74c[_0x361a('0x4f')]['id'];}return db[_0x361a('0x2f')][_0x361a('0x4d')]({'where':{'id':_0xc8c74c['params']['id']}})['then'](handleEntityNotFound(_0x427f9d,null))[_0x361a('0x26')](saveUpdates(_0xc8c74c[_0x361a('0x4f')],null))[_0x361a('0x26')](respondWithResult(_0x427f9d,null))[_0x361a('0x48')](handleError(_0x427f9d,null));};exports['destroy']=function(_0x4576f8,_0x4c1fc5){return db['SquareProject']['find']({'where':{'id':_0x4576f8[_0x361a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c1fc5,null))[_0x361a('0x26')](removeEntity(_0x4c1fc5,null))['catch'](handleError(_0x4c1fc5,null));};exports['addUsers']=function(_0x415fb2,_0x4b8c6a,_0x491145){return db['SquareProject'][_0x361a('0x4d')]({'where':{'id':_0x415fb2['params']['id']}})['then'](handleEntityNotFound(_0x4b8c6a,null))[_0x361a('0x26')](function(_0x5e2042){if(_0x5e2042){return _0x5e2042[_0x361a('0x55')](_0x415fb2['body'][_0x361a('0x56')],_[_0x361a('0x57')](_0x415fb2[_0x361a('0x4f')],[_0x361a('0x56'),'id'])||{});}})[_0x361a('0x26')](respondWithResult(_0x4b8c6a,null))[_0x361a('0x48')](handleError(_0x4b8c6a,null));};exports[_0x361a('0x58')]=function(_0x578070,_0x34f6bc,_0x1f3e94){return db[_0x361a('0x2f')][_0x361a('0x4d')]({'where':{'id':_0x578070[_0x361a('0x4a')]['id']}})[_0x361a('0x26')](handleEntityNotFound(_0x34f6bc,null))['then'](function(_0x5c5f56){if(_0x5c5f56){return _0x5c5f56[_0x361a('0x58')](_0x578070[_0x361a('0x36')][_0x361a('0x56')])[_0x361a('0x26')](function(){if(_[_0x361a('0x59')](_0x578070[_0x361a('0x36')][_0x361a('0x56')])){for(var _0x23a22f=0x0;_0x23a22f<_0x578070[_0x361a('0x36')][_0x361a('0x56')][_0x361a('0x3b')];_0x23a22f+=0x1){socket[_0x361a('0x5a')]('userSquareProject:remove',{'UserId':Number(_0x578070[_0x361a('0x36')]['ids'][_0x23a22f]),'SquareProjectId':Number(_0x578070[_0x361a('0x4a')]['id'])});}}else{socket[_0x361a('0x5a')](_0x361a('0x5b'),{'UserId':Number(_0x578070[_0x361a('0x36')][_0x361a('0x56')]),'SquareProjectId':Number(_0x578070[_0x361a('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x34f6bc,null))['catch'](handleError(_0x34f6bc,null));};exports[_0x361a('0x5c')]=function(_0x32323f,_0x5d5d2b,_0x3c0a28){var _0x59fdfe={};var _0x333b77={};var _0x3a98d9;var _0x43229a;return db[_0x361a('0x2f')][_0x361a('0x5d')]({'where':{'id':_0x32323f['params']['id']}})[_0x361a('0x26')](handleEntityNotFound(_0x5d5d2b,null))['then'](function(_0x23fb2c){if(_0x23fb2c){_0x3a98d9=_0x23fb2c;_0x333b77[_0x361a('0x34')]=_['keys'](db[_0x361a('0x5e')]['rawAttributes']);_0x333b77[_0x361a('0x36')]=_[_0x361a('0x37')](_0x32323f[_0x361a('0x36')]);_0x333b77[_0x361a('0x40')]=_[_0x361a('0x38')](_0x333b77[_0x361a('0x34')],_0x333b77[_0x361a('0x36')]);_0x59fdfe[_0x361a('0x39')]=_[_0x361a('0x38')](_0x333b77[_0x361a('0x34')],qs['fields'](_0x32323f[_0x361a('0x36')][_0x361a('0x3a')]));_0x59fdfe[_0x361a('0x39')]=_0x59fdfe[_0x361a('0x39')][_0x361a('0x3b')]?_0x59fdfe[_0x361a('0x39')]:_0x333b77[_0x361a('0x34')];_0x59fdfe[_0x361a('0x5f')]=qs[_0x361a('0x3e')](_0x32323f[_0x361a('0x36')][_0x361a('0x3e')]);_0x59fdfe[_0x361a('0x3f')]=qs[_0x361a('0x40')](_[_0x361a('0x41')](_0x32323f[_0x361a('0x36')],_0x333b77[_0x361a('0x40')]));if(_0x32323f[_0x361a('0x36')][_0x361a('0x42')]){_0x59fdfe[_0x361a('0x3f')]=_['merge'](_0x59fdfe[_0x361a('0x3f')],{'$or':_[_0x361a('0x35')](_0x59fdfe[_0x361a('0x39')],function(_0x538110){var _0x3203ed={};_0x3203ed[_0x538110]={'$like':'%'+_0x32323f[_0x361a('0x36')][_0x361a('0x42')]+'%'};return _0x3203ed;})});}_0x59fdfe=_['merge']({},_0x59fdfe,_0x32323f['options']);return _0x3a98d9[_0x361a('0x5c')](_0x59fdfe);}})['then'](function(_0x1b4216){if(_0x1b4216){_0x43229a=_0x1b4216[_0x361a('0x3b')];if(!_0x32323f[_0x361a('0x36')][_0x361a('0x3c')](_0x361a('0x3d'))){_0x59fdfe['limit']=qs[_0x361a('0x20')](_0x32323f[_0x361a('0x36')][_0x361a('0x20')]);_0x59fdfe['offset']=qs[_0x361a('0x1d')](_0x32323f['query'][_0x361a('0x1d')]);}return _0x3a98d9[_0x361a('0x5c')](_0x59fdfe);}})[_0x361a('0x26')](function(_0x5799de){if(_0x5799de){return _0x5799de?{'count':_0x43229a,'rows':_0x5799de}:null;}})[_0x361a('0x26')](respondWithResult(_0x5d5d2b,null))[_0x361a('0x48')](handleError(_0x5d5d2b,null));}; \ No newline at end of file +var _0xf915=['type','VIRTUAL','includeAll','include','SquareProject','findAll','rows','catch','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','SquareProjects','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x25fa5c,_0x421141){var _0x1bade2=function(_0x3faf20){while(--_0x3faf20){_0x25fa5c['push'](_0x25fa5c['shift']());}};_0x1bade2(++_0x421141);}(_0xf915,0x142));var _0x5f91=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf915[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f91('0x0'));var zipdir=require(_0x5f91('0x1'));var jsonpatch=require(_0x5f91('0x2'));var rp=require(_0x5f91('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f91('0x4'));var util=require(_0x5f91('0x5'));var path=require(_0x5f91('0x6'));var sox=require(_0x5f91('0x7'));var csv=require(_0x5f91('0x8'));var ejs=require(_0x5f91('0x9'));var fs=require('fs');var fs_extra=require(_0x5f91('0xa'));var _=require(_0x5f91('0xb'));var squel=require(_0x5f91('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f91('0xd'));var deskjs=require(_0x5f91('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5f91('0xf'));var Papa=require('papaparse');var Redis=require(_0x5f91('0x10'));var authService=require(_0x5f91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5f91('0x12'));var hardwareService=require(_0x5f91('0x13'));var logger=require(_0x5f91('0x14'))(_0x5f91('0x15'));var utils=require(_0x5f91('0x16'));var config=require(_0x5f91('0x17'));var licenseUtil=require(_0x5f91('0x18'));var db=require(_0x5f91('0x19'))['db'];config[_0x5f91('0x1a')]=_[_0x5f91('0x1b')](config[_0x5f91('0x1a')],{'host':_0x5f91('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f91('0x1a')]));require(_0x5f91('0x1d'))[_0x5f91('0x1e')](socket);function respondWithStatusCode(_0x4f10af,_0x159678){_0x159678=_0x159678||0xcc;return function(_0x3b035b){if(_0x3b035b){return _0x4f10af[_0x5f91('0x1f')](_0x159678);}return _0x4f10af[_0x5f91('0x20')](_0x159678)[_0x5f91('0x21')]();};}function respondWithResult(_0x1c6e47,_0x17d5fd){_0x17d5fd=_0x17d5fd||0xc8;return function(_0x3a2c46){if(_0x3a2c46){return _0x1c6e47[_0x5f91('0x20')](_0x17d5fd)[_0x5f91('0x22')](_0x3a2c46);}};}function respondWithFilteredResult(_0x18d055,_0x1d6538){return function(_0x50c547){if(_0x50c547){var _0x219b30=typeof _0x1d6538[_0x5f91('0x23')]==='undefined'&&typeof _0x1d6538[_0x5f91('0x24')]==='undefined';var _0x2fa8b3=_0x50c547[_0x5f91('0x25')];var _0x4d6c6a=_0x219b30?0x0:_0x1d6538[_0x5f91('0x23')];var _0x416b54=_0x219b30?_0x50c547[_0x5f91('0x25')]:_0x1d6538['offset']+_0x1d6538[_0x5f91('0x24')];var _0x4476e0;if(_0x416b54>=_0x2fa8b3){_0x416b54=_0x2fa8b3;_0x4476e0=0xc8;}else{_0x4476e0=0xce;}_0x18d055[_0x5f91('0x20')](_0x4476e0);return _0x18d055[_0x5f91('0x26')](_0x5f91('0x27'),_0x4d6c6a+'-'+_0x416b54+'/'+_0x2fa8b3)[_0x5f91('0x22')](_0x50c547);}return null;};}function patchUpdates(_0x3efeef){return function(_0x1700ac){try{jsonpatch[_0x5f91('0x28')](_0x1700ac,_0x3efeef,!![]);}catch(_0x1a1080){return BPromise[_0x5f91('0x29')](_0x1a1080);}return _0x1700ac[_0x5f91('0x2a')]();};}function saveUpdates(_0x56c08c,_0x2806b4){return function(_0x5c655d){if(_0x5c655d){return _0x5c655d[_0x5f91('0x2b')](_0x56c08c)[_0x5f91('0x2c')](function(_0x43d96a){return _0x43d96a;});}return null;};}function removeEntity(_0x171a30,_0x208f44){return function(_0x3257b4){if(_0x3257b4){return _0x3257b4['destroy']()['then'](function(){var _0x639ac2=_0x3257b4['get']({'plain':!![]});var _0x1a7037=_0x5f91('0x2d');return db[_0x5f91('0x2e')]['destroy']({'where':{'type':_0x1a7037,'resourceId':_0x639ac2['id']}})['then'](function(){return _0x3257b4;});})[_0x5f91('0x2c')](function(){_0x171a30['status'](0xcc)[_0x5f91('0x21')]();});}};}function handleEntityNotFound(_0x2c6e01,_0xc59968){return function(_0x37fff3){if(!_0x37fff3){_0x2c6e01[_0x5f91('0x1f')](0x194);}return _0x37fff3;};}function handleError(_0x40b0a2,_0xba33a4){_0xba33a4=_0xba33a4||0x1f4;return function(_0x5ba0ac){logger[_0x5f91('0x2f')](_0x5ba0ac[_0x5f91('0x30')]);if(_0x5ba0ac[_0x5f91('0x31')]){delete _0x5ba0ac['name'];}_0x40b0a2['status'](_0xba33a4)['send'](_0x5ba0ac);};}exports[_0x5f91('0x32')]=function(_0x16d4d8,_0xe2536d){var _0x304f66={},_0x12b2f3={},_0x12c61b={'count':0x0,'rows':[]};var _0x4be84f=_['map'](db['SquareProject'][_0x5f91('0x33')],function(_0x10879b){return{'name':_0x10879b[_0x5f91('0x34')],'type':_0x10879b['type'][_0x5f91('0x35')]};});_0x12b2f3[_0x5f91('0x36')]=_['map'](_0x4be84f,_0x5f91('0x31'));_0x12b2f3[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x16d4d8[_0x5f91('0x37')]);_0x12b2f3[_0x5f91('0x39')]=_[_0x5f91('0x3a')](_0x12b2f3[_0x5f91('0x36')],_0x12b2f3[_0x5f91('0x37')]);_0x304f66[_0x5f91('0x3b')]=_[_0x5f91('0x3a')](_0x12b2f3['model'],qs[_0x5f91('0x3c')](_0x16d4d8['query'][_0x5f91('0x3c')]));_0x304f66['attributes']=_0x304f66['attributes'][_0x5f91('0x3d')]?_0x304f66[_0x5f91('0x3b')]:_0x12b2f3['model'];if(!_0x16d4d8[_0x5f91('0x37')][_0x5f91('0x3e')](_0x5f91('0x3f'))){_0x304f66[_0x5f91('0x24')]=qs[_0x5f91('0x24')](_0x16d4d8['query']['limit']);_0x304f66[_0x5f91('0x23')]=qs[_0x5f91('0x23')](_0x16d4d8['query'][_0x5f91('0x23')]);}_0x304f66[_0x5f91('0x40')]=qs[_0x5f91('0x41')](_0x16d4d8['query'][_0x5f91('0x41')]);_0x304f66[_0x5f91('0x42')]=qs[_0x5f91('0x39')](_[_0x5f91('0x43')](_0x16d4d8[_0x5f91('0x37')],_0x12b2f3[_0x5f91('0x39')]),_0x4be84f);if(_0x16d4d8[_0x5f91('0x37')][_0x5f91('0x44')]){_0x304f66[_0x5f91('0x42')]=_[_0x5f91('0x45')](_0x304f66[_0x5f91('0x42')],{'$or':_['map'](_0x4be84f,function(_0x569f05){if(_0x569f05[_0x5f91('0x46')]!==_0x5f91('0x47')){var _0x4ac776={};_0x4ac776[_0x569f05[_0x5f91('0x31')]]={'$like':'%'+_0x16d4d8['query'][_0x5f91('0x44')]+'%'};return _0x4ac776;}})});}_0x304f66=_[_0x5f91('0x45')]({},_0x304f66,_0x16d4d8['options']);var _0x10899e={'where':_0x304f66[_0x5f91('0x42')]};return db['SquareProject'][_0x5f91('0x25')](_0x10899e)[_0x5f91('0x2c')](function(_0x2e1f67){_0x12c61b['count']=_0x2e1f67;if(_0x16d4d8['query'][_0x5f91('0x48')]){_0x304f66[_0x5f91('0x49')]=[{'all':!![]}];}return db[_0x5f91('0x4a')][_0x5f91('0x4b')](_0x304f66);})['then'](function(_0x3c634a){_0x12c61b[_0x5f91('0x4c')]=_0x3c634a;return _0x12c61b;})['then'](respondWithFilteredResult(_0xe2536d,_0x304f66))[_0x5f91('0x4d')](handleError(_0xe2536d,null));};exports['show']=function(_0x19ab5b,_0x5d0c61){var _0x187299={'raw':![],'where':{'id':_0x19ab5b[_0x5f91('0x4e')]['id']}},_0x38af1d={};_0x38af1d[_0x5f91('0x36')]=_[_0x5f91('0x38')](db[_0x5f91('0x4a')][_0x5f91('0x33')]);_0x38af1d[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x19ab5b[_0x5f91('0x37')]);_0x38af1d['filters']=_[_0x5f91('0x3a')](_0x38af1d[_0x5f91('0x36')],_0x38af1d[_0x5f91('0x37')]);_0x187299['attributes']=_[_0x5f91('0x3a')](_0x38af1d[_0x5f91('0x36')],qs[_0x5f91('0x3c')](_0x19ab5b['query'][_0x5f91('0x3c')]));_0x187299[_0x5f91('0x3b')]=_0x187299[_0x5f91('0x3b')][_0x5f91('0x3d')]?_0x187299[_0x5f91('0x3b')]:_0x38af1d[_0x5f91('0x36')];if(_0x19ab5b[_0x5f91('0x37')]['includeAll']){_0x187299[_0x5f91('0x49')]=[{'all':!![]}];}_0x187299=_[_0x5f91('0x45')]({},_0x187299,_0x19ab5b[_0x5f91('0x4f')]);return db[_0x5f91('0x4a')][_0x5f91('0x50')](_0x187299)[_0x5f91('0x2c')](handleEntityNotFound(_0x5d0c61,null))[_0x5f91('0x2c')](respondWithResult(_0x5d0c61,null))['catch'](handleError(_0x5d0c61,null));};exports[_0x5f91('0x51')]=function(_0x1d5ada,_0x443bfb){return db[_0x5f91('0x4a')][_0x5f91('0x51')](_0x1d5ada[_0x5f91('0x52')],{})[_0x5f91('0x2c')](function(_0x351c09){var _0x203063=_0x1d5ada['user'][_0x5f91('0x53')]({'plain':!![]});if(!_0x203063)throw new Error(_0x5f91('0x54'));if(_0x203063['role']===_0x5f91('0x55')){var _0x345a86=_0x351c09[_0x5f91('0x53')]({'plain':!![]});var _0x327313=_0x5f91('0x2d');return db[_0x5f91('0x56')][_0x5f91('0x50')]({'where':{'name':_0x327313,'userProfileId':_0x203063['userProfileId']},'raw':!![]})[_0x5f91('0x2c')](function(_0x152a3d){if(_0x152a3d&&_0x152a3d[_0x5f91('0x57')]===0x0){return db[_0x5f91('0x2e')][_0x5f91('0x51')]({'name':_0x345a86['name'],'resourceId':_0x345a86['id'],'type':_0x152a3d[_0x5f91('0x31')],'sectionId':_0x152a3d['id']},{})[_0x5f91('0x2c')](function(){return _0x351c09;});}else{return _0x351c09;}})[_0x5f91('0x4d')](function(_0x3361fa){logger['error'](_0x5f91('0x58'),_0x3361fa);throw _0x3361fa;});}return _0x351c09;})[_0x5f91('0x2c')](respondWithResult(_0x443bfb,0xc9))[_0x5f91('0x4d')](handleError(_0x443bfb,null));};exports['update']=function(_0x2b517a,_0x243648){if(_0x2b517a['body']['id']){delete _0x2b517a[_0x5f91('0x52')]['id'];}return db[_0x5f91('0x4a')][_0x5f91('0x50')]({'where':{'id':_0x2b517a['params']['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x243648,null))['then'](saveUpdates(_0x2b517a[_0x5f91('0x52')],null))[_0x5f91('0x2c')](respondWithResult(_0x243648,null))[_0x5f91('0x4d')](handleError(_0x243648,null));};exports['destroy']=function(_0x1169b2,_0x4ec2e0){return db[_0x5f91('0x4a')][_0x5f91('0x50')]({'where':{'id':_0x1169b2[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x4ec2e0,null))[_0x5f91('0x2c')](removeEntity(_0x4ec2e0,null))[_0x5f91('0x4d')](handleError(_0x4ec2e0,null));};exports[_0x5f91('0x59')]=function(_0x2662a5,_0x572879,_0x30cd03){return db[_0x5f91('0x4a')]['find']({'where':{'id':_0x2662a5[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x572879,null))[_0x5f91('0x2c')](function(_0x5187c2){if(_0x5187c2){return _0x5187c2[_0x5f91('0x59')](_0x2662a5[_0x5f91('0x52')][_0x5f91('0x5a')],_[_0x5f91('0x5b')](_0x2662a5['body'],['ids','id'])||{});}})[_0x5f91('0x2c')](respondWithResult(_0x572879,null))['catch'](handleError(_0x572879,null));};exports[_0x5f91('0x5c')]=function(_0x5059c7,_0x47fa9b,_0x34a291){return db['SquareProject'][_0x5f91('0x50')]({'where':{'id':_0x5059c7[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x47fa9b,null))[_0x5f91('0x2c')](function(_0x3d5959){if(_0x3d5959){return _0x3d5959[_0x5f91('0x5c')](_0x5059c7[_0x5f91('0x37')]['ids'])[_0x5f91('0x2c')](function(){if(_[_0x5f91('0x5d')](_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')])){for(var _0x4bd0e4=0x0;_0x4bd0e4<_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')]['length'];_0x4bd0e4+=0x1){socket[_0x5f91('0x5e')](_0x5f91('0x5f'),{'UserId':Number(_0x5059c7[_0x5f91('0x37')][_0x5f91('0x5a')][_0x4bd0e4]),'SquareProjectId':Number(_0x5059c7[_0x5f91('0x4e')]['id'])});}}else{socket[_0x5f91('0x5e')](_0x5f91('0x5f'),{'UserId':Number(_0x5059c7[_0x5f91('0x37')]['ids']),'SquareProjectId':Number(_0x5059c7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x47fa9b,null))['catch'](handleError(_0x47fa9b,null));};exports[_0x5f91('0x60')]=function(_0x196bcc,_0x47fdd4,_0x3756b5){var _0x1c5453={};var _0x292154={};var _0x2599f0;var _0xb5c284;return db[_0x5f91('0x4a')]['findOne']({'where':{'id':_0x196bcc[_0x5f91('0x4e')]['id']}})[_0x5f91('0x2c')](handleEntityNotFound(_0x47fdd4,null))['then'](function(_0x3d3edf){if(_0x3d3edf){_0x2599f0=_0x3d3edf;_0x292154[_0x5f91('0x36')]=_[_0x5f91('0x38')](db[_0x5f91('0x61')]['rawAttributes']);_0x292154[_0x5f91('0x37')]=_[_0x5f91('0x38')](_0x196bcc[_0x5f91('0x37')]);_0x292154[_0x5f91('0x39')]=_[_0x5f91('0x3a')](_0x292154[_0x5f91('0x36')],_0x292154[_0x5f91('0x37')]);_0x1c5453[_0x5f91('0x3b')]=_['intersection'](_0x292154[_0x5f91('0x36')],qs['fields'](_0x196bcc[_0x5f91('0x37')][_0x5f91('0x3c')]));_0x1c5453[_0x5f91('0x3b')]=_0x1c5453[_0x5f91('0x3b')][_0x5f91('0x3d')]?_0x1c5453[_0x5f91('0x3b')]:_0x292154[_0x5f91('0x36')];_0x1c5453[_0x5f91('0x40')]=qs[_0x5f91('0x41')](_0x196bcc['query'][_0x5f91('0x41')]);_0x1c5453['where']=qs[_0x5f91('0x39')](_[_0x5f91('0x43')](_0x196bcc[_0x5f91('0x37')],_0x292154[_0x5f91('0x39')]));if(_0x196bcc[_0x5f91('0x37')][_0x5f91('0x44')]){_0x1c5453[_0x5f91('0x42')]=_[_0x5f91('0x45')](_0x1c5453[_0x5f91('0x42')],{'$or':_['map'](_0x1c5453['attributes'],function(_0x2acab7){var _0x140d74={};_0x140d74[_0x2acab7]={'$like':'%'+_0x196bcc[_0x5f91('0x37')][_0x5f91('0x44')]+'%'};return _0x140d74;})});}_0x1c5453=_['merge']({},_0x1c5453,_0x196bcc[_0x5f91('0x4f')]);return _0x2599f0[_0x5f91('0x60')](_0x1c5453);}})[_0x5f91('0x2c')](function(_0x2ffd7b){if(_0x2ffd7b){_0xb5c284=_0x2ffd7b[_0x5f91('0x3d')];if(!_0x196bcc['query']['hasOwnProperty'](_0x5f91('0x3f'))){_0x1c5453[_0x5f91('0x24')]=qs['limit'](_0x196bcc['query']['limit']);_0x1c5453[_0x5f91('0x23')]=qs['offset'](_0x196bcc['query'][_0x5f91('0x23')]);}return _0x2599f0[_0x5f91('0x60')](_0x1c5453);}})[_0x5f91('0x2c')](function(_0x1ec0da){if(_0x1ec0da){return _0x1ec0da?{'count':_0xb5c284,'rows':_0x1ec0da}:null;}})[_0x5f91('0x2c')](respondWithResult(_0x47fdd4,null))['catch'](handleError(_0x47fdd4,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 563a78b..b7e9c96 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 _0xf3ae=['setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x12361b,_0x46e6f2){var _0x4b2510=function(_0x4772cb){while(--_0x4772cb){_0x12361b['push'](_0x12361b['shift']());}};_0x4b2510(++_0x46e6f2);}(_0xf3ae,0x87));var _0xef3a=function(_0x34f8d8,_0x32399f){_0x34f8d8=_0x34f8d8-0x0;var _0x209ad5=_0xf3ae[_0x34f8d8];return _0x209ad5;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xef3a('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xef3a('0x1'),'afterDestroy':'remove'};function emitEvent(_0x2fc761){return function(_0x5ead94,_0x4a68a7,_0x52960b){SquareProjectEvents[_0xef3a('0x2')](_0x2fc761+':'+_0x5ead94['id'],_0x5ead94);SquareProjectEvents[_0xef3a('0x2')](_0x2fc761,_0x5ead94);_0x52960b(null);};}for(var e in events){if(events[_0xef3a('0x3')](e)){var event=events[e];SquareProject[_0xef3a('0x4')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x8e8b=['hook','exports','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x50a6c5,_0x51b738){var _0x15d3d2=function(_0x71d5dd){while(--_0x71d5dd){_0x50a6c5['push'](_0x50a6c5['shift']());}};_0x15d3d2(++_0x51b738);}(_0x8e8b,0x12a));var _0xb8e8=function(_0x1a2420,_0x384ceb){_0x1a2420=_0x1a2420-0x0;var _0x494361=_0x8e8b[_0x1a2420];return _0x494361;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb8e8('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb8e8('0x1')](0x0);var events={'afterCreate':_0xb8e8('0x2'),'afterUpdate':'update','afterDestroy':_0xb8e8('0x3')};function emitEvent(_0x38a5e3){return function(_0x29465a,_0x1810ab,_0x34d512){SquareProjectEvents[_0xb8e8('0x4')](_0x38a5e3+':'+_0x29465a['id'],_0x29465a);SquareProjectEvents[_0xb8e8('0x4')](_0x38a5e3,_0x29465a);_0x34d512(null);};}for(var e in events){if(events[_0xb8e8('0x5')](e)){var event=events[e];SquareProject[_0xb8e8('0x6')](e,emitEvent(event));}}module[_0xb8e8('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index caf9f11..c468189 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 _0x4b08=['path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','format','util','../../config/logger','api','moment','bluebird'];(function(_0x5b8bbc,_0x4c2fcc){var _0xf8a508=function(_0x2c0b0e){while(--_0x2c0b0e){_0x5b8bbc['push'](_0x5b8bbc['shift']());}};_0xf8a508(++_0x4c2fcc);}(_0x4b08,0x1c3));var _0x84b0=function(_0x1657ef,_0x2ea730){_0x1657ef=_0x1657ef-0x0;var _0x5ed40e=_0x4b08[_0x1657ef];return _0x5ed40e;};'use strict';var _=require('lodash');var util=require(_0x84b0('0x0'));var logger=require(_0x84b0('0x1'))(_0x84b0('0x2'));var moment=require(_0x84b0('0x3'));var BPromise=require(_0x84b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84b0('0x5'));var rimraf=require(_0x84b0('0x6'));var config=require(_0x84b0('0x7'));var attributes=require(_0x84b0('0x8'));module['exports']=function(_0x281395,_0x4b0e4d){return _0x281395[_0x84b0('0x9')](_0x84b0('0xa'),attributes,{'tableName':_0x84b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xa4618b,_0x4d58e4,_0x44ea96){if(_0xa4618b['changed'](_0x84b0('0xc'))){_0xa4618b[_0x84b0('0xd')]=moment()['format'](_0x84b0('0xe'));}if(_0xa4618b[_0x84b0('0xf')](_0x84b0('0x10'))){_0xa4618b[_0x84b0('0x11')]=moment()[_0x84b0('0x12')](_0x84b0('0xe'));}_0x44ea96(null,_0xa4618b);}}});}; \ No newline at end of file +var _0xbf2c=['./squareProject.attributes','exports','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x266e80,_0xc5183a){var _0x26cbaa=function(_0x59c43a){while(--_0x59c43a){_0x266e80['push'](_0x266e80['shift']());}};_0x26cbaa(++_0xc5183a);}(_0xbf2c,0x1d4));var _0xcbf2=function(_0x34bf69,_0x46a0e6){_0x34bf69=_0x34bf69-0x0;var _0x216a60=_0xbf2c[_0x34bf69];return _0x216a60;};'use strict';var _=require(_0xcbf2('0x0'));var util=require(_0xcbf2('0x1'));var logger=require('../../config/logger')(_0xcbf2('0x2'));var moment=require(_0xcbf2('0x3'));var BPromise=require(_0xcbf2('0x4'));var rp=require(_0xcbf2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbf2('0x6'));var config=require(_0xcbf2('0x7'));var attributes=require(_0xcbf2('0x8'));module[_0xcbf2('0x9')]=function(_0x11f5b8,_0x2b561f){return _0x11f5b8['define']('SquareProject',attributes,{'tableName':_0xcbf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48658c,_0x2ac371,_0x233693){if(_0x48658c[_0xcbf2('0xb')](_0xcbf2('0xc'))){_0x48658c['savedAt']=moment()[_0xcbf2('0xd')](_0xcbf2('0xe'));}if(_0x48658c['changed'](_0xcbf2('0xf'))){_0x48658c[_0xcbf2('0x10')]=moment()[_0xcbf2('0xd')](_0xcbf2('0xe'));}_0x233693(null,_0x48658c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index b84ca0e..f6319c6 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 _0xddcd=['message','info','result','catch','ShowSquareProject','find','options','raw','where','attributes','include','map','model','stringify','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4f3b8b,_0x5a54ac){var _0x551ded=function(_0x41a2d5){while(--_0x41a2d5){_0x4f3b8b['push'](_0x4f3b8b['shift']());}};_0x551ded(++_0x5a54ac);}(_0xddcd,0x1be));var _0xdddc=function(_0x40363a,_0x13f568){_0x40363a=_0x40363a-0x0;var _0x4d0ca2=_0xddcd[_0x40363a];return _0x4d0ca2;};'use strict';var _=require('lodash');var util=require(_0xdddc('0x0'));var moment=require('moment');var BPromise=require(_0xdddc('0x1'));var rs=require(_0xdddc('0x2'));var fs=require('fs');var Redis=require(_0xdddc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdddc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdddc('0x5'));var jayson=require(_0xdddc('0x6'));var client=jayson[_0xdddc('0x7')][_0xdddc('0x8')]({'port':0x232a});config[_0xdddc('0x9')]=_[_0xdddc('0xa')](config[_0xdddc('0x9')],{'host':_0xdddc('0xb'),'port':0x18eb});var socket=require(_0xdddc('0xc'))(new Redis(config[_0xdddc('0x9')]));require(_0xdddc('0xd'))[_0xdddc('0xe')](socket);function respondWithRpcPromise(_0x7840f1,_0x36938f,_0x2960e4){return new BPromise(function(_0x18db2d,_0x4cd1a9){return client[_0xdddc('0xf')](_0x7840f1,_0x2960e4)[_0xdddc('0x10')](function(_0x1763bb){logger['info'](_0xdddc('0x11'),_0x36938f,'request\x20sent');logger['debug'](_0xdddc('0x12'),_0x36938f,_0xdddc('0x13'),JSON['stringify'](_0x1763bb));if(_0x1763bb['error']){if(_0x1763bb[_0xdddc('0x14')][_0xdddc('0x15')]===0x1f4){logger[_0xdddc('0x14')](_0xdddc('0x11'),_0x36938f,_0x1763bb[_0xdddc('0x14')][_0xdddc('0x16')]);return _0x4cd1a9(_0x1763bb[_0xdddc('0x14')][_0xdddc('0x16')]);}logger[_0xdddc('0x14')](_0xdddc('0x11'),_0x36938f,_0x1763bb[_0xdddc('0x14')][_0xdddc('0x16')]);return _0x18db2d(_0x1763bb['error'][_0xdddc('0x16')]);}else{logger[_0xdddc('0x17')]('SquareProject,\x20%s,\x20%s',_0x36938f,'request\x20sent');_0x18db2d(_0x1763bb[_0xdddc('0x18')][_0xdddc('0x16')]);}})[_0xdddc('0x19')](function(_0x2d582b){logger[_0xdddc('0x14')](_0xdddc('0x11'),_0x36938f,_0x2d582b);_0x4cd1a9(_0x2d582b);});});}exports[_0xdddc('0x1a')]=function(_0x52fe83){var _0xae7cee=this;return new Promise(function(_0x2628e8,_0x1d54fd){return db['SquareProject'][_0xdddc('0x1b')]({'raw':_0x52fe83['options']?_0x52fe83[_0xdddc('0x1c')][_0xdddc('0x1d')]===undefined?!![]:![]:!![],'where':_0x52fe83[_0xdddc('0x1c')]?_0x52fe83[_0xdddc('0x1c')][_0xdddc('0x1e')]||null:null,'attributes':_0x52fe83[_0xdddc('0x1c')]?_0x52fe83[_0xdddc('0x1c')][_0xdddc('0x1f')]||null:null,'include':_0x52fe83['options']?_0x52fe83[_0xdddc('0x1c')][_0xdddc('0x20')]?_[_0xdddc('0x21')](_0x52fe83['options'][_0xdddc('0x20')],function(_0x9110d6){return{'model':db[_0x9110d6[_0xdddc('0x22')]],'as':_0x9110d6['as'],'attributes':_0x9110d6[_0xdddc('0x1f')],'include':_0x9110d6['include']?_[_0xdddc('0x21')](_0x9110d6[_0xdddc('0x20')],function(_0x13eaea){return{'model':db[_0x13eaea['model']],'as':_0x13eaea['as'],'attributes':_0x13eaea[_0xdddc('0x1f')],'include':_0x13eaea[_0xdddc('0x20')]?_['map'](_0x13eaea[_0xdddc('0x20')],function(_0xe4cd8b){return{'model':db[_0xe4cd8b[_0xdddc('0x22')]],'as':_0xe4cd8b['as'],'attributes':_0xe4cd8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xdddc('0x10')](function(_0x348205){logger[_0xdddc('0x17')](_0xdddc('0x1a'),_0x52fe83);logger['debug'](_0xdddc('0x1a'),_0x52fe83,JSON[_0xdddc('0x23')](_0x348205));_0x2628e8(_0x348205);})[_0xdddc('0x19')](function(_0x19a24b){logger[_0xdddc('0x14')](_0xdddc('0x1a'),_0x19a24b[_0xdddc('0x16')],_0x52fe83);_0x1d54fd(_0xae7cee['error'](0x1f4,_0x19a24b[_0xdddc('0x16')]));});});}; \ No newline at end of file +var _0xdaa7=['redis','defaults','localhost','socket.io-emitter','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareProject','SquareProject','find','options','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xdaa7,0x82));var _0x7daa=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xdaa7[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0x7daa('0x0'));var util=require('util');var moment=require(_0x7daa('0x1'));var BPromise=require('bluebird');var rs=require(_0x7daa('0x2'));var fs=require('fs');var Redis=require(_0x7daa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7daa('0x4'));var logger=require(_0x7daa('0x5'))(_0x7daa('0x6'));var config=require(_0x7daa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7daa('0x8')][_0x7daa('0x9')]({'port':0x232a});config[_0x7daa('0xa')]=_[_0x7daa('0xb')](config[_0x7daa('0xa')],{'host':_0x7daa('0xc'),'port':0x18eb});var socket=require(_0x7daa('0xd'))(new Redis(config['redis']));require('./squareProject.socket')[_0x7daa('0xe')](socket);function respondWithRpcPromise(_0xc1ec6e,_0x26ad27,_0x33a194){return new BPromise(function(_0x493cdc,_0x27bb84){return client['request'](_0xc1ec6e,_0x33a194)[_0x7daa('0xf')](function(_0x86a46f){logger[_0x7daa('0x10')](_0x7daa('0x11'),_0x26ad27,_0x7daa('0x12'));logger[_0x7daa('0x13')](_0x7daa('0x14'),_0x26ad27,_0x7daa('0x12'),JSON[_0x7daa('0x15')](_0x86a46f));if(_0x86a46f['error']){if(_0x86a46f['error'][_0x7daa('0x16')]===0x1f4){logger['error'](_0x7daa('0x11'),_0x26ad27,_0x86a46f[_0x7daa('0x17')][_0x7daa('0x18')]);return _0x27bb84(_0x86a46f['error'][_0x7daa('0x18')]);}logger[_0x7daa('0x17')]('SquareProject,\x20%s,\x20%s',_0x26ad27,_0x86a46f['error'][_0x7daa('0x18')]);return _0x493cdc(_0x86a46f['error'][_0x7daa('0x18')]);}else{logger[_0x7daa('0x10')](_0x7daa('0x11'),_0x26ad27,_0x7daa('0x12'));_0x493cdc(_0x86a46f[_0x7daa('0x19')]['message']);}})[_0x7daa('0x1a')](function(_0x4783d2){logger['error'](_0x7daa('0x11'),_0x26ad27,_0x4783d2);_0x27bb84(_0x4783d2);});});}exports[_0x7daa('0x1b')]=function(_0x185306){var _0x5e65ec=this;return new Promise(function(_0x386730,_0x108a55){return db[_0x7daa('0x1c')][_0x7daa('0x1d')]({'raw':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')]['where']||null:null,'attributes':_0x185306['options']?_0x185306['options'][_0x7daa('0x1f')]||null:null,'include':_0x185306[_0x7daa('0x1e')]?_0x185306[_0x7daa('0x1e')][_0x7daa('0x20')]?_[_0x7daa('0x21')](_0x185306[_0x7daa('0x1e')][_0x7daa('0x20')],function(_0x2342ea){return{'model':db[_0x2342ea[_0x7daa('0x22')]],'as':_0x2342ea['as'],'attributes':_0x2342ea[_0x7daa('0x1f')],'include':_0x2342ea[_0x7daa('0x20')]?_['map'](_0x2342ea['include'],function(_0x131928){return{'model':db[_0x131928[_0x7daa('0x22')]],'as':_0x131928['as'],'attributes':_0x131928[_0x7daa('0x1f')],'include':_0x131928[_0x7daa('0x20')]?_[_0x7daa('0x21')](_0x131928[_0x7daa('0x20')],function(_0x312f61){return{'model':db[_0x312f61[_0x7daa('0x22')]],'as':_0x312f61['as'],'attributes':_0x312f61[_0x7daa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7daa('0xf')](function(_0x512335){logger['info'](_0x7daa('0x1b'),_0x185306);logger['debug'](_0x7daa('0x1b'),_0x185306,JSON[_0x7daa('0x15')](_0x512335));_0x386730(_0x512335);})[_0x7daa('0x1a')](function(_0x4abc94){logger[_0x7daa('0x17')](_0x7daa('0x1b'),_0x4abc94[_0x7daa('0x18')],_0x185306);_0x108a55(_0x5e65ec[_0x7daa('0x17')](0x1f4,_0x4abc94[_0x7daa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0427c98..214d5c8 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 _0xb5f0=['save','update','emit','removeListener'];(function(_0x26aa07,_0x55175f){var _0x3683e9=function(_0x484a30){while(--_0x484a30){_0x26aa07['push'](_0x26aa07['shift']());}};_0x3683e9(++_0x55175f);}(_0xb5f0,0x100));var _0x0b5f=function(_0x19f7f9,_0x2252d2){_0x19f7f9=_0x19f7f9-0x0;var _0x3d2efd=_0xb5f0[_0x19f7f9];return _0x3d2efd;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x0b5f('0x0'),'remove',_0x0b5f('0x1')];function createListener(_0x4181e5,_0x329728){return function(_0x1b9b12){_0x329728[_0x0b5f('0x2')](_0x4181e5,_0x1b9b12);};}function removeListener(_0x513f66,_0x1dcb4f){return function(){SquareProjectEvents[_0x0b5f('0x3')](_0x513f66,_0x1dcb4f);};}exports['register']=function(_0x1a1440){for(var _0x27d75f=0x0,_0x341396=events['length'];_0x27d75f<_0x341396;_0x27d75f++){var _0x56d495=events[_0x27d75f];var _0x1b4c13=createListener('squareProject:'+_0x56d495,_0x1a1440);SquareProjectEvents['on'](_0x56d495,_0x1b4c13);}}; \ No newline at end of file +var _0x5b9d=['register','squareProject:','save','update','emit','removeListener'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x5b9d,0x1a0));var _0xd5b9=function(_0x595505,_0x56cc58){_0x595505=_0x595505-0x0;var _0x4d62d7=_0x5b9d[_0x595505];return _0x4d62d7;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xd5b9('0x0'),'remove',_0xd5b9('0x1')];function createListener(_0x655d14,_0x4c410f){return function(_0x1907e5){_0x4c410f[_0xd5b9('0x2')](_0x655d14,_0x1907e5);};}function removeListener(_0x344198,_0x22d0be){return function(){SquareProjectEvents[_0xd5b9('0x3')](_0x344198,_0x22d0be);};}exports[_0xd5b9('0x4')]=function(_0xd7d976){for(var _0x49e834=0x0,_0x2883dd=events['length'];_0x49e834<_0x2883dd;_0x49e834++){var _0x5d15d1=events[_0x49e834];var _0x4da01c=createListener(_0xd5b9('0x5')+_0x5d15d1,_0xd7d976);SquareProjectEvents['on'](_0x5d15d1,_0x4da01c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index dab3412..e8d6104 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(_0x2993a9,_0x5be943){var _0x3e7aa5=function(_0xabb3d){while(--_0xabb3d){_0x2993a9['push'](_0x2993a9['shift']());}};_0x3e7aa5(++_0x5be943);}(_0x1cb9,0x14e));var _0x91cb=function(_0x574824,_0x56fc10){_0x574824=_0x574824-0x0;var _0x4c39aa=_0x1cb9[_0x574824];return _0x4c39aa;};'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 _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5728e3,_0x5b84aa){var _0x5337d2=function(_0x1b4e8b){while(--_0x1b4e8b){_0x5728e3['push'](_0x5728e3['shift']());}};_0x5337d2(++_0x5b84aa);}(_0x7a54,0x106));var _0x47a5=function(_0x22098a,_0x13a26){_0x22098a=_0x22098a-0x0;var _0x1cbfa1=_0x7a54[_0x22098a];return _0x1cbfa1;};'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/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0849b00..73f7083 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x15cf23,_0x4f90d5){var _0x19cf58=function(_0x33c23e){while(--_0x33c23e){_0x15cf23['push'](_0x15cf23['shift']());}};_0x19cf58(++_0x4f90d5);}(_0x2675,0x75));var _0x5267=function(_0x3ba046,_0x2a4065){_0x3ba046=_0x3ba046-0x0;var _0x3a4d54=_0x2675[_0x3ba046];return _0x3a4d54;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x4da328,_0x408279){var _0x58f11f=function(_0x10f768){while(--_0x10f768){_0x4da328['push'](_0x4da328['shift']());}};_0x58f11f(++_0x408279);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4ec962,_0x4e71b5){_0x4ec962=_0x4ec962-0x0;var _0x1b8d3c=_0xdbf5[_0x4ec962];return _0x1b8d3c;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e7f895e..ba837c1 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 _0xe039=['../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x428df1,_0x1e36c2){var _0x94ebf7=function(_0x34a5bd){while(--_0x34a5bd){_0x428df1['push'](_0x428df1['shift']());}};_0x94ebf7(++_0x1e36c2);}(_0xe039,0x1ca));var _0x9e03=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xe039[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e03('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e03('0x1'));var rp=require(_0x9e03('0x2'));var moment=require('moment');var BPromise=require(_0x9e03('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e03('0x4'));var sox=require(_0x9e03('0x5'));var csv=require('to-csv');var ejs=require(_0x9e03('0x6'));var fs=require('fs');var fs_extra=require(_0x9e03('0x7'));var _=require('lodash');var squel=require(_0x9e03('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e03('0x9'));var toCsv=require(_0x9e03('0xa'));var querystring=require(_0x9e03('0xb'));var Papa=require('papaparse');var Redis=require(_0x9e03('0xc'));var authService=require(_0x9e03('0xd'));var qs=require(_0x9e03('0xe'));var as=require(_0x9e03('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9e03('0x10'));var utils=require('../../config/utils');var config=require(_0x9e03('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e03('0x12'))['db'];function respondWithStatusCode(_0xa1b2f3,_0x5862bf){_0x5862bf=_0x5862bf||0xcc;return function(_0x37edda){if(_0x37edda){return _0xa1b2f3['sendStatus'](_0x5862bf);}return _0xa1b2f3['status'](_0x5862bf)[_0x9e03('0x13')]();};}function respondWithResult(_0x339c9b,_0x2ab10d){_0x2ab10d=_0x2ab10d||0xc8;return function(_0x109139){if(_0x109139){return _0x339c9b[_0x9e03('0x14')](_0x2ab10d)['json'](_0x109139);}};}function respondWithFilteredResult(_0x424a60,_0x1d6bb4){return function(_0x19c9fc){if(_0x19c9fc){var _0xd5a95d=typeof _0x1d6bb4[_0x9e03('0x15')]===_0x9e03('0x16')&&typeof _0x1d6bb4[_0x9e03('0x17')]===_0x9e03('0x16');var _0x1e6cbd=_0x19c9fc[_0x9e03('0x18')];var _0x8e16d8=_0xd5a95d?0x0:_0x1d6bb4['offset'];var _0x56fc2d=_0xd5a95d?_0x19c9fc[_0x9e03('0x18')]:_0x1d6bb4[_0x9e03('0x15')]+_0x1d6bb4[_0x9e03('0x17')];var _0x304836;if(_0x56fc2d>=_0x1e6cbd){_0x56fc2d=_0x1e6cbd;_0x304836=0xc8;}else{_0x304836=0xce;}_0x424a60['status'](_0x304836);return _0x424a60[_0x9e03('0x19')](_0x9e03('0x1a'),_0x8e16d8+'-'+_0x56fc2d+'/'+_0x1e6cbd)[_0x9e03('0x1b')](_0x19c9fc);}return null;};}function patchUpdates(_0x4b1374){return function(_0x3195cf){try{jsonpatch[_0x9e03('0x1c')](_0x3195cf,_0x4b1374,!![]);}catch(_0x1f9c4a){return BPromise['reject'](_0x1f9c4a);}return _0x3195cf[_0x9e03('0x1d')]();};}function saveUpdates(_0x24cc56,_0x14d6fc){return function(_0x30d4bc){if(_0x30d4bc){return _0x30d4bc['update'](_0x24cc56)['then'](function(_0x17c6be){return _0x17c6be;});}return null;};}function removeEntity(_0xb4da43,_0x5984b9){return function(_0x5f4c62){if(_0x5f4c62){return _0x5f4c62[_0x9e03('0x1e')]()[_0x9e03('0x1f')](function(){_0xb4da43[_0x9e03('0x14')](0xcc)[_0x9e03('0x13')]();});}};}function handleEntityNotFound(_0x52bcbf,_0x308c76){return function(_0x33cb94){if(!_0x33cb94){_0x52bcbf[_0x9e03('0x20')](0x194);}return _0x33cb94;};}function handleError(_0x47c423,_0x5c360f){_0x5c360f=_0x5c360f||0x1f4;return function(_0x12b09f){logger[_0x9e03('0x21')](_0x12b09f[_0x9e03('0x22')]);if(_0x12b09f[_0x9e03('0x23')]){delete _0x12b09f[_0x9e03('0x23')];}_0x47c423[_0x9e03('0x14')](_0x5c360f)[_0x9e03('0x24')](_0x12b09f);};}exports[_0x9e03('0x25')]=function(_0x38d298,_0x31c628){var _0x18cc78={},_0x20dd49={},_0xb1cbc0={'count':0x0,'rows':[]};var _0x43b6e7=_[_0x9e03('0x26')](db[_0x9e03('0x27')][_0x9e03('0x28')],function(_0x2349b){return{'name':_0x2349b[_0x9e03('0x29')],'type':_0x2349b[_0x9e03('0x2a')][_0x9e03('0x2b')]};});_0x20dd49[_0x9e03('0x2c')]=_['map'](_0x43b6e7,_0x9e03('0x23'));_0x20dd49[_0x9e03('0x2d')]=_['keys'](_0x38d298[_0x9e03('0x2d')]);_0x20dd49[_0x9e03('0x2e')]=_[_0x9e03('0x2f')](_0x20dd49[_0x9e03('0x2c')],_0x20dd49[_0x9e03('0x2d')]);_0x18cc78[_0x9e03('0x30')]=_['intersection'](_0x20dd49['model'],qs['fields'](_0x38d298[_0x9e03('0x2d')][_0x9e03('0x31')]));_0x18cc78['attributes']=_0x18cc78[_0x9e03('0x30')][_0x9e03('0x32')]?_0x18cc78[_0x9e03('0x30')]:_0x20dd49[_0x9e03('0x2c')];if(!_0x38d298[_0x9e03('0x2d')][_0x9e03('0x33')](_0x9e03('0x34'))){_0x18cc78[_0x9e03('0x17')]=qs['limit'](_0x38d298[_0x9e03('0x2d')][_0x9e03('0x17')]);_0x18cc78['offset']=qs['offset'](_0x38d298[_0x9e03('0x2d')][_0x9e03('0x15')]);}_0x18cc78[_0x9e03('0x35')]=qs[_0x9e03('0x36')](_0x38d298[_0x9e03('0x2d')][_0x9e03('0x36')]);_0x18cc78[_0x9e03('0x37')]=qs[_0x9e03('0x2e')](_[_0x9e03('0x38')](_0x38d298[_0x9e03('0x2d')],_0x20dd49[_0x9e03('0x2e')]),_0x43b6e7);if(_0x38d298[_0x9e03('0x2d')][_0x9e03('0x39')]){_0x18cc78[_0x9e03('0x37')]=_[_0x9e03('0x3a')](_0x18cc78[_0x9e03('0x37')],{'$or':_[_0x9e03('0x26')](_0x43b6e7,function(_0x5cc9dc){if(_0x5cc9dc[_0x9e03('0x2a')]!==_0x9e03('0x3b')){var _0x19c4b2={};_0x19c4b2[_0x5cc9dc[_0x9e03('0x23')]]={'$like':'%'+_0x38d298[_0x9e03('0x2d')]['filter']+'%'};return _0x19c4b2;}})});}_0x18cc78=_[_0x9e03('0x3a')]({},_0x18cc78,_0x38d298[_0x9e03('0x3c')]);var _0x49d9e4={'where':_0x18cc78[_0x9e03('0x37')]};return db['SquareRecording'][_0x9e03('0x18')](_0x49d9e4)['then'](function(_0x5c050d){_0xb1cbc0[_0x9e03('0x18')]=_0x5c050d;if(_0x38d298[_0x9e03('0x2d')][_0x9e03('0x3d')]){_0x18cc78[_0x9e03('0x3e')]=[{'all':!![]}];}return db[_0x9e03('0x27')][_0x9e03('0x3f')](_0x18cc78);})[_0x9e03('0x1f')](function(_0x1d2dfd){_0xb1cbc0['rows']=_0x1d2dfd;return _0xb1cbc0;})['then'](respondWithFilteredResult(_0x31c628,_0x18cc78))[_0x9e03('0x40')](handleError(_0x31c628,null));};exports[_0x9e03('0x41')]=function(_0x4e5103,_0x47b19f){var _0x5ad29e={'raw':!![],'where':{'id':_0x4e5103[_0x9e03('0x42')]['id']}},_0x5ab385={};_0x5ab385[_0x9e03('0x2c')]=_[_0x9e03('0x43')](db[_0x9e03('0x27')]['rawAttributes']);_0x5ab385['query']=_[_0x9e03('0x43')](_0x4e5103['query']);_0x5ab385['filters']=_['intersection'](_0x5ab385[_0x9e03('0x2c')],_0x5ab385['query']);_0x5ad29e[_0x9e03('0x30')]=_[_0x9e03('0x2f')](_0x5ab385[_0x9e03('0x2c')],qs[_0x9e03('0x31')](_0x4e5103[_0x9e03('0x2d')][_0x9e03('0x31')]));_0x5ad29e[_0x9e03('0x30')]=_0x5ad29e[_0x9e03('0x30')][_0x9e03('0x32')]?_0x5ad29e[_0x9e03('0x30')]:_0x5ab385[_0x9e03('0x2c')];if(_0x4e5103['query']['includeAll']){_0x5ad29e[_0x9e03('0x3e')]=[{'all':!![]}];}_0x5ad29e=_[_0x9e03('0x3a')]({},_0x5ad29e,_0x4e5103['options']);return db[_0x9e03('0x27')][_0x9e03('0x44')](_0x5ad29e)[_0x9e03('0x1f')](handleEntityNotFound(_0x47b19f,null))['then'](respondWithResult(_0x47b19f,null))[_0x9e03('0x40')](handleError(_0x47b19f,null));};exports[_0x9e03('0x45')]=function(_0x575bc3,_0x48e2a5){return db[_0x9e03('0x27')][_0x9e03('0x45')](_0x575bc3[_0x9e03('0x46')],{})['then'](respondWithResult(_0x48e2a5,0xc9))[_0x9e03('0x40')](handleError(_0x48e2a5,null));};exports[_0x9e03('0x47')]=function(_0x527e75,_0x5ea7fd){if(_0x527e75[_0x9e03('0x46')]['id']){delete _0x527e75[_0x9e03('0x46')]['id'];}return db[_0x9e03('0x27')][_0x9e03('0x44')]({'where':{'id':_0x527e75[_0x9e03('0x42')]['id']}})[_0x9e03('0x1f')](handleEntityNotFound(_0x5ea7fd,null))['then'](saveUpdates(_0x527e75[_0x9e03('0x46')],null))['then'](respondWithResult(_0x5ea7fd,null))[_0x9e03('0x40')](handleError(_0x5ea7fd,null));};exports[_0x9e03('0x48')]=function(_0x46989a,_0x1eb7a8,_0x569d79){var _0x4dc5cd=require(_0x9e03('0x49'));var _0x8ee465=![];var _0x220255={};if(_0x46989a[_0x9e03('0x2d')][_0x9e03('0x2a')]&&_0x46989a['query'][_0x9e03('0x2a')]==='uniqueid'){_0x220255[_0x9e03('0x4a')]=_0x46989a[_0x9e03('0x42')]['id'];}else{_0x220255['id']=_0x46989a[_0x9e03('0x42')]['id'];}return db[_0x9e03('0x27')]['find']({'where':_0x220255,'attributes':['id',_0x9e03('0x4b'),_0x9e03('0x4c')],'raw':!![]})[_0x9e03('0x1f')](handleEntityNotFound(_0x1eb7a8,null))[_0x9e03('0x1f')](function(_0x4b5b19){if(_0x4b5b19){var _0xbc6b0b=_0x4b5b19[_0x9e03('0x4b')];var _0x163bae=util['format'](_0x9e03('0x4d'),_0xbc6b0b);if(fs[_0x9e03('0x4e')](_0x163bae)){_0x8ee465=!![];return _0x4dc5cd[_0x9e03('0x4f')](_0x163bae,_0xbc6b0b,config[_0x9e03('0x50')][_0x9e03('0x51')])[_0x9e03('0x1f')](function(){return _0x4b5b19;});}return _0x4b5b19;}})[_0x9e03('0x1f')](function(_0x1b7db7){if(_0x1b7db7){var _0x2ea33f=_0x1b7db7[_0x9e03('0x4b')];if(!fs[_0x9e03('0x4e')](_0x2ea33f)){throw new db[(_0x9e03('0x52'))][(_0x9e03('0x53'))](_0x9e03('0x54'));}if(_0x1b7db7['filename']){return _0x1eb7a8[_0x9e03('0x48')](_0x2ea33f,_0x1b7db7[_0x9e03('0x4c')]+path[_0x9e03('0x55')](_0x2ea33f),function(){if(_0x8ee465){fs[_0x9e03('0x56')](_0x2ea33f);}});}else{return _0x1eb7a8[_0x9e03('0x48')](_0x2ea33f,function(_0x2e2e9b){if(_0x8ee465){fs['unlink'](_0x2ea33f);}});}}})[_0x9e03('0x40')](function(_0x133605){if(_0x133605[_0x9e03('0x57')]===_0x9e03('0x54')){_0x1eb7a8[_0x9e03('0x14')](0x194)[_0x9e03('0x24')](_0x9e03('0x58'));}else{return handleError(_0x1eb7a8,null);}});};exports[_0x9e03('0x1e')]=function(_0x28c17f,_0x13ebeb){return db[_0x9e03('0x27')][_0x9e03('0x44')]({'where':{'id':_0x28c17f[_0x9e03('0x42')]['id']}})[_0x9e03('0x1f')](function(_0x3cdeca){if(_[_0x9e03('0x59')](_0x3cdeca)){throw new ReferenceError(_0x9e03('0x5a'));}return _0x3cdeca;})[_0x9e03('0x1f')](function(_0x953d82){var _0x411e2d=_0x953d82[_0x9e03('0x4b')];logger[_0x9e03('0x5b')](_0x9e03('0x5c'),_0x411e2d);if(!_['isNil'](_0x953d82['savePath'])&&fs[_0x9e03('0x4e')](_0x411e2d)){logger[_0x9e03('0x5b')]('File:\x20\x22'+_0x411e2d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x411e2d);}_0x411e2d=_0x411e2d+'.cypher';if(!_[_0x9e03('0x59')](_0x953d82[_0x9e03('0x4b')])&&fs[_0x9e03('0x4e')](_0x411e2d)){logger['info']('File:\x20\x22'+_0x411e2d+_0x9e03('0x5d'));fs[_0x9e03('0x5e')](_0x411e2d);}return _0x953d82;})[_0x9e03('0x1f')](function(_0x1f0722){if(!_0x1f0722)throw new InternalError();return _0x1f0722['destroy']();})[_0x9e03('0x1f')](function(){_0x13ebeb[_0x9e03('0x14')](0xcc)[_0x9e03('0x13')]();})['catch'](handleError(_0x13ebeb,null));}; \ No newline at end of file +var _0x244a=['VIRTUAL','merge','options','includeAll','catch','show','params','keys','rawAttributes','length','find','create','body','download','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter'];(function(_0x158cfc,_0x3ff9e0){var _0x38baee=function(_0x1e30e0){while(--_0x1e30e0){_0x158cfc['push'](_0x158cfc['shift']());}};_0x38baee(++_0x3ff9e0);}(_0x244a,0x8b));var _0xa244=function(_0x4bb055,_0x48257a){_0x4bb055=_0x4bb055-0x0;var _0x2ab87e=_0x244a[_0x4bb055];return _0x2ab87e;};'use strict';var emlformat=require(_0xa244('0x0'));var rimraf=require(_0xa244('0x1'));var zipdir=require(_0xa244('0x2'));var jsonpatch=require(_0xa244('0x3'));var rp=require('request-promise');var moment=require(_0xa244('0x4'));var BPromise=require(_0xa244('0x5'));var Mustache=require(_0xa244('0x6'));var util=require(_0xa244('0x7'));var path=require(_0xa244('0x8'));var sox=require(_0xa244('0x9'));var csv=require('to-csv');var ejs=require(_0xa244('0xa'));var fs=require('fs');var fs_extra=require(_0xa244('0xb'));var _=require(_0xa244('0xc'));var squel=require(_0xa244('0xd'));var crypto=require('crypto');var jsforce=require(_0xa244('0xe'));var deskjs=require(_0xa244('0xf'));var toCsv=require(_0xa244('0x10'));var querystring=require('querystring');var Papa=require(_0xa244('0x11'));var Redis=require(_0xa244('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa244('0x13'));var as=require(_0xa244('0x14'));var hardwareService=require(_0xa244('0x15'));var logger=require(_0xa244('0x16'))(_0xa244('0x17'));var utils=require(_0xa244('0x18'));var config=require(_0xa244('0x19'));var licenseUtil=require(_0xa244('0x1a'));var db=require(_0xa244('0x1b'))['db'];function respondWithStatusCode(_0x7a6a1,_0xd5c1e7){_0xd5c1e7=_0xd5c1e7||0xcc;return function(_0x3ab9e7){if(_0x3ab9e7){return _0x7a6a1[_0xa244('0x1c')](_0xd5c1e7);}return _0x7a6a1['status'](_0xd5c1e7)[_0xa244('0x1d')]();};}function respondWithResult(_0x13e000,_0x5ef64a){_0x5ef64a=_0x5ef64a||0xc8;return function(_0x5c7e99){if(_0x5c7e99){return _0x13e000['status'](_0x5ef64a)[_0xa244('0x1e')](_0x5c7e99);}};}function respondWithFilteredResult(_0xd513d6,_0x1af25c){return function(_0x47b541){if(_0x47b541){var _0x567edf=typeof _0x1af25c['offset']===_0xa244('0x1f')&&typeof _0x1af25c['limit']===_0xa244('0x1f');var _0x5bdfbc=_0x47b541[_0xa244('0x20')];var _0x1ed7f9=_0x567edf?0x0:_0x1af25c[_0xa244('0x21')];var _0x147c24=_0x567edf?_0x47b541[_0xa244('0x20')]:_0x1af25c[_0xa244('0x21')]+_0x1af25c[_0xa244('0x22')];var _0x27d8c2;if(_0x147c24>=_0x5bdfbc){_0x147c24=_0x5bdfbc;_0x27d8c2=0xc8;}else{_0x27d8c2=0xce;}_0xd513d6[_0xa244('0x23')](_0x27d8c2);return _0xd513d6[_0xa244('0x24')](_0xa244('0x25'),_0x1ed7f9+'-'+_0x147c24+'/'+_0x5bdfbc)[_0xa244('0x1e')](_0x47b541);}return null;};}function patchUpdates(_0x5928c1){return function(_0x28b34e){try{jsonpatch[_0xa244('0x26')](_0x28b34e,_0x5928c1,!![]);}catch(_0x27c7a3){return BPromise[_0xa244('0x27')](_0x27c7a3);}return _0x28b34e['save']();};}function saveUpdates(_0x4f9565,_0x2b0b84){return function(_0x3f7bed){if(_0x3f7bed){return _0x3f7bed[_0xa244('0x28')](_0x4f9565)[_0xa244('0x29')](function(_0x3d4efa){return _0x3d4efa;});}return null;};}function removeEntity(_0xab646e,_0x538c35){return function(_0x45fa98){if(_0x45fa98){return _0x45fa98['destroy']()[_0xa244('0x29')](function(){_0xab646e[_0xa244('0x23')](0xcc)[_0xa244('0x1d')]();});}};}function handleEntityNotFound(_0x25f09f,_0x31c3b3){return function(_0x7b4450){if(!_0x7b4450){_0x25f09f['sendStatus'](0x194);}return _0x7b4450;};}function handleError(_0x529d62,_0x3cbf13){_0x3cbf13=_0x3cbf13||0x1f4;return function(_0x3ef2b2){logger[_0xa244('0x2a')](_0x3ef2b2[_0xa244('0x2b')]);if(_0x3ef2b2[_0xa244('0x2c')]){delete _0x3ef2b2['name'];}_0x529d62[_0xa244('0x23')](_0x3cbf13)[_0xa244('0x2d')](_0x3ef2b2);};}exports[_0xa244('0x2e')]=function(_0x18a380,_0x3920ce){var _0xfddf3e={},_0x42d592={},_0x279c0b={'count':0x0,'rows':[]};var _0x57bb9a=_[_0xa244('0x2f')](db[_0xa244('0x30')]['rawAttributes'],function(_0x4399fb){return{'name':_0x4399fb[_0xa244('0x31')],'type':_0x4399fb[_0xa244('0x32')][_0xa244('0x33')]};});_0x42d592[_0xa244('0x34')]=_[_0xa244('0x2f')](_0x57bb9a,_0xa244('0x2c'));_0x42d592['query']=_['keys'](_0x18a380[_0xa244('0x35')]);_0x42d592[_0xa244('0x36')]=_[_0xa244('0x37')](_0x42d592[_0xa244('0x34')],_0x42d592['query']);_0xfddf3e[_0xa244('0x38')]=_[_0xa244('0x37')](_0x42d592['model'],qs[_0xa244('0x39')](_0x18a380[_0xa244('0x35')][_0xa244('0x39')]));_0xfddf3e['attributes']=_0xfddf3e[_0xa244('0x38')]['length']?_0xfddf3e[_0xa244('0x38')]:_0x42d592[_0xa244('0x34')];if(!_0x18a380[_0xa244('0x35')][_0xa244('0x3a')]('nolimit')){_0xfddf3e[_0xa244('0x22')]=qs[_0xa244('0x22')](_0x18a380[_0xa244('0x35')][_0xa244('0x22')]);_0xfddf3e[_0xa244('0x21')]=qs[_0xa244('0x21')](_0x18a380[_0xa244('0x35')]['offset']);}_0xfddf3e[_0xa244('0x3b')]=qs[_0xa244('0x3c')](_0x18a380[_0xa244('0x35')][_0xa244('0x3c')]);_0xfddf3e[_0xa244('0x3d')]=qs['filters'](_['pick'](_0x18a380[_0xa244('0x35')],_0x42d592[_0xa244('0x36')]),_0x57bb9a);if(_0x18a380[_0xa244('0x35')][_0xa244('0x3e')]){_0xfddf3e[_0xa244('0x3d')]=_['merge'](_0xfddf3e['where'],{'$or':_[_0xa244('0x2f')](_0x57bb9a,function(_0x8309bf){if(_0x8309bf['type']!==_0xa244('0x3f')){var _0x2ce3f9={};_0x2ce3f9[_0x8309bf['name']]={'$like':'%'+_0x18a380[_0xa244('0x35')][_0xa244('0x3e')]+'%'};return _0x2ce3f9;}})});}_0xfddf3e=_[_0xa244('0x40')]({},_0xfddf3e,_0x18a380[_0xa244('0x41')]);var _0x4fe386={'where':_0xfddf3e[_0xa244('0x3d')]};return db[_0xa244('0x30')][_0xa244('0x20')](_0x4fe386)[_0xa244('0x29')](function(_0x3a1c0f){_0x279c0b[_0xa244('0x20')]=_0x3a1c0f;if(_0x18a380[_0xa244('0x35')][_0xa244('0x42')]){_0xfddf3e['include']=[{'all':!![]}];}return db[_0xa244('0x30')]['findAll'](_0xfddf3e);})[_0xa244('0x29')](function(_0xb08af4){_0x279c0b['rows']=_0xb08af4;return _0x279c0b;})[_0xa244('0x29')](respondWithFilteredResult(_0x3920ce,_0xfddf3e))[_0xa244('0x43')](handleError(_0x3920ce,null));};exports[_0xa244('0x44')]=function(_0x144570,_0x1a851f){var _0x2ba24d={'raw':!![],'where':{'id':_0x144570[_0xa244('0x45')]['id']}},_0x2e8129={};_0x2e8129[_0xa244('0x34')]=_[_0xa244('0x46')](db[_0xa244('0x30')][_0xa244('0x47')]);_0x2e8129['query']=_[_0xa244('0x46')](_0x144570[_0xa244('0x35')]);_0x2e8129['filters']=_['intersection'](_0x2e8129['model'],_0x2e8129['query']);_0x2ba24d[_0xa244('0x38')]=_['intersection'](_0x2e8129['model'],qs['fields'](_0x144570['query'][_0xa244('0x39')]));_0x2ba24d['attributes']=_0x2ba24d[_0xa244('0x38')][_0xa244('0x48')]?_0x2ba24d[_0xa244('0x38')]:_0x2e8129['model'];if(_0x144570[_0xa244('0x35')][_0xa244('0x42')]){_0x2ba24d['include']=[{'all':!![]}];}_0x2ba24d=_['merge']({},_0x2ba24d,_0x144570[_0xa244('0x41')]);return db[_0xa244('0x30')][_0xa244('0x49')](_0x2ba24d)[_0xa244('0x29')](handleEntityNotFound(_0x1a851f,null))[_0xa244('0x29')](respondWithResult(_0x1a851f,null))[_0xa244('0x43')](handleError(_0x1a851f,null));};exports[_0xa244('0x4a')]=function(_0x520f6f,_0x35d6e2){return db[_0xa244('0x30')][_0xa244('0x4a')](_0x520f6f[_0xa244('0x4b')],{})[_0xa244('0x29')](respondWithResult(_0x35d6e2,0xc9))[_0xa244('0x43')](handleError(_0x35d6e2,null));};exports[_0xa244('0x28')]=function(_0x1b7444,_0x11f39){if(_0x1b7444['body']['id']){delete _0x1b7444['body']['id'];}return db[_0xa244('0x30')][_0xa244('0x49')]({'where':{'id':_0x1b7444[_0xa244('0x45')]['id']}})['then'](handleEntityNotFound(_0x11f39,null))[_0xa244('0x29')](saveUpdates(_0x1b7444['body'],null))[_0xa244('0x29')](respondWithResult(_0x11f39,null))[_0xa244('0x43')](handleError(_0x11f39,null));};exports[_0xa244('0x4c')]=function(_0x272108,_0x274b31,_0x19b10a){var _0x5b8a4b=require('../../components/encryptor');var _0x58676f=![];var _0x11f88e={};if(_0x272108[_0xa244('0x35')][_0xa244('0x32')]&&_0x272108[_0xa244('0x35')][_0xa244('0x32')]==='uniqueid'){_0x11f88e[_0xa244('0x4d')]=_0x272108[_0xa244('0x45')]['id'];}else{_0x11f88e['id']=_0x272108[_0xa244('0x45')]['id'];}return db[_0xa244('0x30')][_0xa244('0x49')]({'where':_0x11f88e,'attributes':['id',_0xa244('0x4e'),'filename'],'raw':!![]})[_0xa244('0x29')](handleEntityNotFound(_0x274b31,null))[_0xa244('0x29')](function(_0x72dc67){if(_0x72dc67){var _0x2c3c81=_0x72dc67['savePath'];var _0x51c626=util[_0xa244('0x4f')](_0xa244('0x50'),_0x2c3c81);if(fs['existsSync'](_0x51c626)){_0x58676f=!![];return _0x5b8a4b[_0xa244('0x51')](_0x51c626,_0x2c3c81,config[_0xa244('0x52')][_0xa244('0x53')])[_0xa244('0x29')](function(){return _0x72dc67;});}return _0x72dc67;}})[_0xa244('0x29')](function(_0x349f56){if(_0x349f56){var _0x4812ae=_0x349f56[_0xa244('0x4e')];if(!fs[_0xa244('0x54')](_0x4812ae)){throw new db[(_0xa244('0x55'))][(_0xa244('0x56'))](_0xa244('0x57'));}if(_0x349f56[_0xa244('0x58')]){return _0x274b31[_0xa244('0x4c')](_0x4812ae,_0x349f56[_0xa244('0x58')]+path[_0xa244('0x59')](_0x4812ae),function(){if(_0x58676f){fs['unlink'](_0x4812ae);}});}else{return _0x274b31[_0xa244('0x4c')](_0x4812ae,function(_0x3b8782){if(_0x58676f){fs[_0xa244('0x5a')](_0x4812ae);}});}}})[_0xa244('0x43')](function(_0x1ecc2f){if(_0x1ecc2f[_0xa244('0x5b')]===_0xa244('0x57')){_0x274b31[_0xa244('0x23')](0x194)[_0xa244('0x2d')]('Not\x20found');}else{return handleError(_0x274b31,null);}});};exports[_0xa244('0x5c')]=function(_0x1eca56,_0x51987f){return db['SquareRecording']['find']({'where':{'id':_0x1eca56[_0xa244('0x45')]['id']}})[_0xa244('0x29')](function(_0x1f0068){if(_['isNil'](_0x1f0068)){throw new ReferenceError(_0xa244('0x5d'));}return _0x1f0068;})[_0xa244('0x29')](function(_0x4872cd){var _0x13a663=_0x4872cd[_0xa244('0x4e')];logger[_0xa244('0x5e')](_0xa244('0x5f'),_0x13a663);if(!_[_0xa244('0x60')](_0x4872cd[_0xa244('0x4e')])&&fs['existsSync'](_0x13a663)){logger['info'](_0xa244('0x61')+_0x13a663+_0xa244('0x62'));fs['unlinkSync'](_0x13a663);}_0x13a663=_0x13a663+_0xa244('0x63');if(!_[_0xa244('0x60')](_0x4872cd[_0xa244('0x4e')])&&fs[_0xa244('0x54')](_0x13a663)){logger[_0xa244('0x5e')]('File:\x20\x22'+_0x13a663+_0xa244('0x62'));fs[_0xa244('0x64')](_0x13a663);}return _0x4872cd;})[_0xa244('0x29')](function(_0x22ec55){if(!_0x22ec55)throw new InternalError();return _0x22ec55[_0xa244('0x5c')]();})[_0xa244('0x29')](function(){_0x51987f[_0xa244('0x23')](0xcc)['end']();})[_0xa244('0x43')](handleError(_0x51987f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7acf974..854bc56 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 _0x4672=['api','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','../../config/logger'];(function(_0x565dfa,_0x5ca74b){var _0x3d8102=function(_0x34276a){while(--_0x34276a){_0x565dfa['push'](_0x565dfa['shift']());}};_0x3d8102(++_0x5ca74b);}(_0x4672,0x18a));var _0x2467=function(_0x32f78b,_0x178f58){_0x32f78b=_0x32f78b-0x0;var _0x51d847=_0x4672[_0x32f78b];return _0x51d847;};'use strict';var _=require(_0x2467('0x0'));var util=require('util');var logger=require(_0x2467('0x1'))(_0x2467('0x2'));var moment=require('moment');var BPromise=require(_0x2467('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2467('0x4'));var rimraf=require(_0x2467('0x5'));var config=require(_0x2467('0x6'));var attributes=require(_0x2467('0x7'));module['exports']=function(_0x19e085,_0x48674e){return _0x19e085[_0x2467('0x8')](_0x2467('0x9'),attributes,{'tableName':_0x2467('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareRecording.attributes'];(function(_0x2429bd,_0x5a313a){var _0xd25392=function(_0x4c6cfb){while(--_0x4c6cfb){_0x2429bd['push'](_0x2429bd['shift']());}};_0xd25392(++_0x5a313a);}(_0x2ef3,0xba));var _0x32ef=function(_0x14875c,_0x524c92){_0x14875c=_0x14875c-0x0;var _0x24ccbd=_0x2ef3[_0x14875c];return _0x24ccbd;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'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 3f984d1..08aec5e 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 _0x4bb5=['create','options','raw','CreateSquareRecording','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SquareRecording'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4bb5,0x162));var _0x54bb=function(_0x11ed16,_0x3b87f0){_0x11ed16=_0x11ed16-0x0;var _0x5c6399=_0x4bb5[_0x11ed16];return _0x5c6399;};'use strict';var _=require('lodash');var util=require(_0x54bb('0x0'));var moment=require(_0x54bb('0x1'));var BPromise=require(_0x54bb('0x2'));var rs=require(_0x54bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54bb('0x4'));var logger=require(_0x54bb('0x5'))(_0x54bb('0x6'));var config=require(_0x54bb('0x7'));var jayson=require(_0x54bb('0x8'));var client=jayson[_0x54bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359fcf,_0x2f21ce,_0x5985a2){return new BPromise(function(_0x161868,_0x4f986a){return client['request'](_0x359fcf,_0x5985a2)[_0x54bb('0xa')](function(_0x4d8afc){logger[_0x54bb('0xb')](_0x54bb('0xc'),_0x2f21ce,'request\x20sent');logger['debug'](_0x54bb('0xd'),_0x2f21ce,_0x54bb('0xe'),JSON[_0x54bb('0xf')](_0x4d8afc));if(_0x4d8afc[_0x54bb('0x10')]){if(_0x4d8afc[_0x54bb('0x10')]['code']===0x1f4){logger[_0x54bb('0x10')](_0x54bb('0xc'),_0x2f21ce,_0x4d8afc['error'][_0x54bb('0x11')]);return _0x4f986a(_0x4d8afc[_0x54bb('0x10')][_0x54bb('0x11')]);}logger[_0x54bb('0x10')]('SquareRecording,\x20%s,\x20%s',_0x2f21ce,_0x4d8afc[_0x54bb('0x10')]['message']);return _0x161868(_0x4d8afc['error'][_0x54bb('0x11')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x2f21ce,_0x54bb('0xe'));_0x161868(_0x4d8afc[_0x54bb('0x12')][_0x54bb('0x11')]);}})[_0x54bb('0x13')](function(_0x5580d3){logger[_0x54bb('0x10')](_0x54bb('0xc'),_0x2f21ce,_0x5580d3);_0x4f986a(_0x5580d3);});});}exports['CreateSquareRecording']=function(_0x31c4da){var _0x4f31e6=this;return new Promise(function(_0x7b7585,_0x5d2148){return db[_0x54bb('0x14')][_0x54bb('0x15')](_0x31c4da['body'],{'raw':_0x31c4da[_0x54bb('0x16')]?_0x31c4da[_0x54bb('0x16')][_0x54bb('0x17')]===undefined?!![]:![]:!![]})[_0x54bb('0xa')](function(_0x38e9de){logger[_0x54bb('0xb')]('CreateSquareRecording',_0x31c4da);logger['debug'](_0x54bb('0x18'),_0x31c4da,JSON['stringify'](_0x38e9de));_0x7b7585(_0x38e9de);})[_0x54bb('0x13')](function(_0x4f5aa0){logger[_0x54bb('0x10')]('CreateSquareRecording',_0x4f5aa0[_0x54bb('0x11')],_0x31c4da);_0x5d2148(_0x4f31e6[_0x54bb('0x10')](0x1f4,_0x4f5aa0['message']));});});}; \ No newline at end of file +var _0xd30a=['catch','CreateSquareRecording','SquareRecording','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xd30a,0x19d));var _0xad30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd30a[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xad30('0x0'));var util=require('util');var moment=require(_0xad30('0x1'));var BPromise=require(_0xad30('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad30('0x3'));var db=require(_0xad30('0x4'))['db'];var utils=require(_0xad30('0x5'));var logger=require(_0xad30('0x6'))(_0xad30('0x7'));var config=require(_0xad30('0x8'));var jayson=require(_0xad30('0x9'));var client=jayson[_0xad30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc0,_0x2e99d4,_0x1493da){return new BPromise(function(_0x20ac8b,_0x53e6fe){return client[_0xad30('0xb')](_0x3dc0,_0x1493da)[_0xad30('0xc')](function(_0x384583){logger['info'](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));logger['debug'](_0xad30('0xf'),_0x2e99d4,_0xad30('0xe'),JSON[_0xad30('0x10')](_0x384583));if(_0x384583[_0xad30('0x11')]){if(_0x384583[_0xad30('0x11')][_0xad30('0x12')]===0x1f4){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x53e6fe(_0x384583['error'][_0xad30('0x13')]);}logger[_0xad30('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2e99d4,_0x384583[_0xad30('0x11')][_0xad30('0x13')]);return _0x20ac8b(_0x384583[_0xad30('0x11')]['message']);}else{logger[_0xad30('0x14')](_0xad30('0xd'),_0x2e99d4,_0xad30('0xe'));_0x20ac8b(_0x384583[_0xad30('0x15')][_0xad30('0x13')]);}})[_0xad30('0x16')](function(_0x2a6d9c){logger[_0xad30('0x11')](_0xad30('0xd'),_0x2e99d4,_0x2a6d9c);_0x53e6fe(_0x2a6d9c);});});}exports[_0xad30('0x17')]=function(_0x19a0cc){var _0x16cb53=this;return new Promise(function(_0x842841,_0x5068eb){return db[_0xad30('0x18')]['create'](_0x19a0cc[_0xad30('0x19')],{'raw':_0x19a0cc[_0xad30('0x1a')]?_0x19a0cc['options'][_0xad30('0x1b')]===undefined?!![]:![]:!![]})[_0xad30('0xc')](function(_0x312704){logger[_0xad30('0x14')]('CreateSquareRecording',_0x19a0cc);logger[_0xad30('0x1c')](_0xad30('0x17'),_0x19a0cc,JSON[_0xad30('0x10')](_0x312704));_0x842841(_0x312704);})[_0xad30('0x16')](function(_0x12ec56){logger['error'](_0xad30('0x17'),_0x12ec56[_0xad30('0x13')],_0x19a0cc);_0x5068eb(_0x16cb53[_0xad30('0x11')](0x1f4,_0x12ec56[_0xad30('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9db8e3c..bb911d2 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x204ebb,_0x468592){var _0x247225=function(_0x4e6c34){while(--_0x4e6c34){_0x204ebb['push'](_0x204ebb['shift']());}};_0x247225(++_0x468592);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3619cb,_0x1020a8){var _0x4d9a99=function(_0x4ee563){while(--_0x4ee563){_0x3619cb['push'](_0x3619cb['shift']());}};_0x4d9a99(++_0x1020a8);}(_0xe706,0xa3));var _0x6e70=function(_0x3161f4,_0x8e7b45){_0x3161f4=_0x3161f4-0x0;var _0x1b2b59=_0xe706[_0x3161f4];return _0x1b2b59;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index f5e9fd7..7c51a16 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 _0xd1f3=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x146fc2,_0x4beccc){var _0x3600ee=function(_0x38bae8){while(--_0x38bae8){_0x146fc2['push'](_0x146fc2['shift']());}};_0x3600ee(++_0x4beccc);}(_0xd1f3,0x14c));var _0x3d1f=function(_0x1e33f0,_0x461eba){_0x1e33f0=_0x1e33f0-0x0;var _0x155006=_0xd1f3[_0x1e33f0];return _0x155006;};'use strict';var Sequelize=require(_0x3d1f('0x0'));module[_0x3d1f('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3d1f('0x2')]},'request':{'type':Sequelize[_0x3d1f('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3d1f('0x2')]},'uniqueid':{'type':Sequelize[_0x3d1f('0x2')]},'version':{'type':Sequelize[_0x3d1f('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3d1f('0x2')]},'callingpres':{'type':Sequelize[_0x3d1f('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3d1f('0x2')]},'dnid':{'type':Sequelize[_0x3d1f('0x2')]},'rdnis':{'type':Sequelize[_0x3d1f('0x2')]},'context':{'type':Sequelize[_0x3d1f('0x2')]},'extension':{'type':Sequelize[_0x3d1f('0x2')]},'priority':{'type':Sequelize[_0x3d1f('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3d1f('0x2')]},'threadid':{'type':Sequelize[_0x3d1f('0x2')]},'project_name':{'type':Sequelize[_0x3d1f('0x2')]},'joinAt':{'type':Sequelize[_0x3d1f('0x3')]},'leaveAt':{'type':Sequelize[_0x3d1f('0x3')]},'bot':{'type':Sequelize[_0x3d1f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc29e=['exports','STRING','DATE','BOOLEAN'];(function(_0x2756ac,_0x102b48){var _0x551c31=function(_0x23b24f){while(--_0x23b24f){_0x2756ac['push'](_0x2756ac['shift']());}};_0x551c31(++_0x102b48);}(_0xc29e,0x1ec));var _0xec29=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc29e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xec29('0x0')]={'network':{'type':Sequelize[_0xec29('0x1')]},'network_script':{'type':Sequelize[_0xec29('0x1')]},'request':{'type':Sequelize[_0xec29('0x1')]},'channel':{'type':Sequelize[_0xec29('0x1')]},'language':{'type':Sequelize[_0xec29('0x1')]},'type':{'type':Sequelize[_0xec29('0x1')]},'uniqueid':{'type':Sequelize[_0xec29('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xec29('0x1')]},'calleridname':{'type':Sequelize[_0xec29('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xec29('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xec29('0x1')]},'rdnis':{'type':Sequelize[_0xec29('0x1')]},'context':{'type':Sequelize[_0xec29('0x1')]},'extension':{'type':Sequelize[_0xec29('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xec29('0x1')]},'accountcode':{'type':Sequelize[_0xec29('0x1')]},'threadid':{'type':Sequelize[_0xec29('0x1')]},'project_name':{'type':Sequelize[_0xec29('0x1')]},'joinAt':{'type':Sequelize[_0xec29('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xec29('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 afe9b43..aab3b78 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 _0x9fb7=['request-promise','moment','bluebird','mustache','path','sox','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','destroy','error','stack','name','send','index','map','SquareReport','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','include','rows','then','catch','show','params','intersection','find','create','body','describe','eml-format','fast-json-patch'];(function(_0x34ccc4,_0x27a096){var _0x2bc5b9=function(_0x4a22be){while(--_0x4a22be){_0x34ccc4['push'](_0x34ccc4['shift']());}};_0x2bc5b9(++_0x27a096);}(_0x9fb7,0x8e));var _0x79fb=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9fb7[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0x79fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x79fb('0x1'));var rp=require(_0x79fb('0x2'));var moment=require(_0x79fb('0x3'));var BPromise=require(_0x79fb('0x4'));var Mustache=require(_0x79fb('0x5'));var util=require('util');var path=require(_0x79fb('0x6'));var sox=require(_0x79fb('0x7'));var csv=require(_0x79fb('0x8'));var ejs=require(_0x79fb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79fb('0xa'));var squel=require('squel');var crypto=require(_0x79fb('0xb'));var jsforce=require(_0x79fb('0xc'));var deskjs=require(_0x79fb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x79fb('0xe'));var Papa=require('papaparse');var Redis=require(_0x79fb('0xf'));var authService=require(_0x79fb('0x10'));var qs=require(_0x79fb('0x11'));var as=require(_0x79fb('0x12'));var hardwareService=require(_0x79fb('0x13'));var logger=require(_0x79fb('0x14'))('api');var utils=require(_0x79fb('0x15'));var config=require(_0x79fb('0x16'));var licenseUtil=require(_0x79fb('0x17'));var db=require(_0x79fb('0x18'))['db'];function respondWithStatusCode(_0x4c93fb,_0xabd53d){_0xabd53d=_0xabd53d||0xcc;return function(_0x73b900){if(_0x73b900){return _0x4c93fb[_0x79fb('0x19')](_0xabd53d);}return _0x4c93fb[_0x79fb('0x1a')](_0xabd53d)[_0x79fb('0x1b')]();};}function respondWithResult(_0x22319f,_0x5a51a2){_0x5a51a2=_0x5a51a2||0xc8;return function(_0x3c1f67){if(_0x3c1f67){return _0x22319f['status'](_0x5a51a2)[_0x79fb('0x1c')](_0x3c1f67);}};}function respondWithFilteredResult(_0x12fd4d,_0x3bf25d){return function(_0x321188){if(_0x321188){var _0x36e6f4=typeof _0x3bf25d[_0x79fb('0x1d')]==='undefined'&&typeof _0x3bf25d[_0x79fb('0x1e')]===_0x79fb('0x1f');var _0x41033b=_0x321188[_0x79fb('0x20')];var _0x1611c5=_0x36e6f4?0x0:_0x3bf25d[_0x79fb('0x1d')];var _0x2b45e3=_0x36e6f4?_0x321188[_0x79fb('0x20')]:_0x3bf25d['offset']+_0x3bf25d['limit'];var _0x2d73f9;if(_0x2b45e3>=_0x41033b){_0x2b45e3=_0x41033b;_0x2d73f9=0xc8;}else{_0x2d73f9=0xce;}_0x12fd4d[_0x79fb('0x1a')](_0x2d73f9);return _0x12fd4d['set']('Content-Range',_0x1611c5+'-'+_0x2b45e3+'/'+_0x41033b)[_0x79fb('0x1c')](_0x321188);}return null;};}function patchUpdates(_0x53ae1f){return function(_0x5b1921){try{jsonpatch[_0x79fb('0x21')](_0x5b1921,_0x53ae1f,!![]);}catch(_0xe47f49){return BPromise[_0x79fb('0x22')](_0xe47f49);}return _0x5b1921[_0x79fb('0x23')]();};}function saveUpdates(_0x29b1eb,_0x3cc589){return function(_0x2e6c51){if(_0x2e6c51){return _0x2e6c51[_0x79fb('0x24')](_0x29b1eb)['then'](function(_0x1f8847){return _0x1f8847;});}return null;};}function removeEntity(_0xff22ab,_0x12669d){return function(_0x3212bf){if(_0x3212bf){return _0x3212bf[_0x79fb('0x25')]()['then'](function(){_0xff22ab[_0x79fb('0x1a')](0xcc)[_0x79fb('0x1b')]();});}};}function handleEntityNotFound(_0x13812e,_0x56126f){return function(_0x42134d){if(!_0x42134d){_0x13812e[_0x79fb('0x19')](0x194);}return _0x42134d;};}function handleError(_0x463ddb,_0x2ec24f){_0x2ec24f=_0x2ec24f||0x1f4;return function(_0x3ac73c){logger[_0x79fb('0x26')](_0x3ac73c[_0x79fb('0x27')]);if(_0x3ac73c[_0x79fb('0x28')]){delete _0x3ac73c[_0x79fb('0x28')];}_0x463ddb[_0x79fb('0x1a')](_0x2ec24f)[_0x79fb('0x29')](_0x3ac73c);};}exports[_0x79fb('0x2a')]=function(_0x2331ba,_0xdb20f0){var _0x5a171d={},_0x2454c3={},_0x2848e4={'count':0x0,'rows':[]};var _0x4608c7=_[_0x79fb('0x2b')](db[_0x79fb('0x2c')]['rawAttributes'],function(_0x33546f){return{'name':_0x33546f['fieldName'],'type':_0x33546f[_0x79fb('0x2d')]['key']};});_0x2454c3[_0x79fb('0x2e')]=_[_0x79fb('0x2b')](_0x4608c7,_0x79fb('0x28'));_0x2454c3[_0x79fb('0x2f')]=_[_0x79fb('0x30')](_0x2331ba[_0x79fb('0x2f')]);_0x2454c3[_0x79fb('0x31')]=_['intersection'](_0x2454c3[_0x79fb('0x2e')],_0x2454c3[_0x79fb('0x2f')]);_0x5a171d[_0x79fb('0x32')]=_['intersection'](_0x2454c3[_0x79fb('0x2e')],qs[_0x79fb('0x33')](_0x2331ba[_0x79fb('0x2f')]['fields']));_0x5a171d[_0x79fb('0x32')]=_0x5a171d[_0x79fb('0x32')][_0x79fb('0x34')]?_0x5a171d[_0x79fb('0x32')]:_0x2454c3['model'];if(!_0x2331ba['query'][_0x79fb('0x35')]('nolimit')){_0x5a171d[_0x79fb('0x1e')]=qs['limit'](_0x2331ba[_0x79fb('0x2f')][_0x79fb('0x1e')]);_0x5a171d['offset']=qs[_0x79fb('0x1d')](_0x2331ba[_0x79fb('0x2f')]['offset']);}_0x5a171d[_0x79fb('0x36')]=qs['sort'](_0x2331ba[_0x79fb('0x2f')]['sort']);_0x5a171d[_0x79fb('0x37')]=qs['filters'](_[_0x79fb('0x38')](_0x2331ba['query'],_0x2454c3[_0x79fb('0x31')]),_0x4608c7);if(_0x2331ba[_0x79fb('0x2f')][_0x79fb('0x39')]){_0x5a171d[_0x79fb('0x37')]=_[_0x79fb('0x3a')](_0x5a171d[_0x79fb('0x37')],{'$or':_[_0x79fb('0x2b')](_0x4608c7,function(_0x4001c0){if(_0x4001c0['type']!==_0x79fb('0x3b')){var _0x85a1d8={};_0x85a1d8[_0x4001c0['name']]={'$like':'%'+_0x2331ba[_0x79fb('0x2f')][_0x79fb('0x39')]+'%'};return _0x85a1d8;}})});}_0x5a171d=_[_0x79fb('0x3a')]({},_0x5a171d,_0x2331ba[_0x79fb('0x3c')]);var _0x182aed={'where':_0x5a171d[_0x79fb('0x37')]};return db['SquareReport']['count'](_0x182aed)['then'](function(_0x3fdcaf){_0x2848e4['count']=_0x3fdcaf;if(_0x2331ba[_0x79fb('0x2f')]['includeAll']){_0x5a171d[_0x79fb('0x3d')]=[{'all':!![]}];}return db[_0x79fb('0x2c')]['findAll'](_0x5a171d);})['then'](function(_0x357699){_0x2848e4[_0x79fb('0x3e')]=_0x357699;return _0x2848e4;})[_0x79fb('0x3f')](respondWithFilteredResult(_0xdb20f0,_0x5a171d))[_0x79fb('0x40')](handleError(_0xdb20f0,null));};exports[_0x79fb('0x41')]=function(_0x5dac14,_0x10a41c){var _0x2a03e2={'raw':!![],'where':{'id':_0x5dac14[_0x79fb('0x42')]['id']}},_0x2ac7f2={};_0x2ac7f2[_0x79fb('0x2e')]=_[_0x79fb('0x30')](db[_0x79fb('0x2c')]['rawAttributes']);_0x2ac7f2['query']=_[_0x79fb('0x30')](_0x5dac14[_0x79fb('0x2f')]);_0x2ac7f2[_0x79fb('0x31')]=_[_0x79fb('0x43')](_0x2ac7f2[_0x79fb('0x2e')],_0x2ac7f2[_0x79fb('0x2f')]);_0x2a03e2['attributes']=_[_0x79fb('0x43')](_0x2ac7f2[_0x79fb('0x2e')],qs['fields'](_0x5dac14[_0x79fb('0x2f')][_0x79fb('0x33')]));_0x2a03e2[_0x79fb('0x32')]=_0x2a03e2[_0x79fb('0x32')][_0x79fb('0x34')]?_0x2a03e2[_0x79fb('0x32')]:_0x2ac7f2[_0x79fb('0x2e')];if(_0x5dac14[_0x79fb('0x2f')]['includeAll']){_0x2a03e2[_0x79fb('0x3d')]=[{'all':!![]}];}_0x2a03e2=_['merge']({},_0x2a03e2,_0x5dac14['options']);return db[_0x79fb('0x2c')][_0x79fb('0x44')](_0x2a03e2)['then'](handleEntityNotFound(_0x10a41c,null))['then'](respondWithResult(_0x10a41c,null))[_0x79fb('0x40')](handleError(_0x10a41c,null));};exports[_0x79fb('0x45')]=function(_0x30004e,_0x25beb1){return db['SquareReport'][_0x79fb('0x45')](_0x30004e[_0x79fb('0x46')],{})[_0x79fb('0x3f')](respondWithResult(_0x25beb1,0xc9))['catch'](handleError(_0x25beb1,null));};exports['update']=function(_0xf78f49,_0x519647){if(_0xf78f49[_0x79fb('0x46')]['id']){delete _0xf78f49[_0x79fb('0x46')]['id'];}return db[_0x79fb('0x2c')][_0x79fb('0x44')]({'where':{'id':_0xf78f49[_0x79fb('0x42')]['id']}})[_0x79fb('0x3f')](handleEntityNotFound(_0x519647,null))['then'](saveUpdates(_0xf78f49['body'],null))[_0x79fb('0x3f')](respondWithResult(_0x519647,null))['catch'](handleError(_0x519647,null));};exports['destroy']=function(_0x3287d4,_0x2044be){return db['SquareReport'][_0x79fb('0x44')]({'where':{'id':_0x3287d4['params']['id']}})[_0x79fb('0x3f')](handleEntityNotFound(_0x2044be,null))[_0x79fb('0x3f')](removeEntity(_0x2044be,null))[_0x79fb('0x40')](handleError(_0x2044be,null));};exports[_0x79fb('0x47')]=function(_0xae9402,_0x4fa0c9){return db['SquareReport']['describe']()[_0x79fb('0x3f')](respondWithResult(_0x4fa0c9,null))['catch'](handleError(_0x4fa0c9,null));}; \ No newline at end of file +var _0x226f=['where','pick','merge','type','VIRTUAL','filter','SquareReport','include','findAll','rows','catch','show','params','intersection','length','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3d28c4,_0x12fdad){var _0x32f6af=function(_0x58e0b8){while(--_0x58e0b8){_0x3d28c4['push'](_0x3d28c4['shift']());}};_0x32f6af(++_0x12fdad);}(_0x226f,0xa3));var _0xf226=function(_0x42e961,_0x50673d){_0x42e961=_0x42e961-0x0;var _0x34f66b=_0x226f[_0x42e961];return _0x34f66b;};'use strict';var emlformat=require(_0xf226('0x0'));var rimraf=require(_0xf226('0x1'));var zipdir=require(_0xf226('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf226('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf226('0x4'));var sox=require(_0xf226('0x5'));var csv=require(_0xf226('0x6'));var ejs=require(_0xf226('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf226('0x8'));var squel=require(_0xf226('0x9'));var crypto=require(_0xf226('0xa'));var jsforce=require(_0xf226('0xb'));var deskjs=require(_0xf226('0xc'));var toCsv=require(_0xf226('0x6'));var querystring=require(_0xf226('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf226('0xe'));var qs=require(_0xf226('0xf'));var as=require(_0xf226('0x10'));var hardwareService=require(_0xf226('0x11'));var logger=require('../../config/logger')(_0xf226('0x12'));var utils=require('../../config/utils');var config=require(_0xf226('0x13'));var licenseUtil=require(_0xf226('0x14'));var db=require(_0xf226('0x15'))['db'];function respondWithStatusCode(_0x3e98f8,_0x4a7aa2){_0x4a7aa2=_0x4a7aa2||0xcc;return function(_0x4c8a06){if(_0x4c8a06){return _0x3e98f8[_0xf226('0x16')](_0x4a7aa2);}return _0x3e98f8['status'](_0x4a7aa2)['end']();};}function respondWithResult(_0x2a765b,_0x5555f7){_0x5555f7=_0x5555f7||0xc8;return function(_0x427d26){if(_0x427d26){return _0x2a765b[_0xf226('0x17')](_0x5555f7)[_0xf226('0x18')](_0x427d26);}};}function respondWithFilteredResult(_0x52fefc,_0x387b47){return function(_0x4c0779){if(_0x4c0779){var _0xbaf603=typeof _0x387b47['offset']==='undefined'&&typeof _0x387b47[_0xf226('0x19')]==='undefined';var _0x1f9cab=_0x4c0779[_0xf226('0x1a')];var _0x4a5a0a=_0xbaf603?0x0:_0x387b47[_0xf226('0x1b')];var _0x1039e0=_0xbaf603?_0x4c0779[_0xf226('0x1a')]:_0x387b47[_0xf226('0x1b')]+_0x387b47['limit'];var _0xefcfdf;if(_0x1039e0>=_0x1f9cab){_0x1039e0=_0x1f9cab;_0xefcfdf=0xc8;}else{_0xefcfdf=0xce;}_0x52fefc[_0xf226('0x17')](_0xefcfdf);return _0x52fefc[_0xf226('0x1c')](_0xf226('0x1d'),_0x4a5a0a+'-'+_0x1039e0+'/'+_0x1f9cab)[_0xf226('0x18')](_0x4c0779);}return null;};}function patchUpdates(_0xf16dd9){return function(_0x1a578a){try{jsonpatch['apply'](_0x1a578a,_0xf16dd9,!![]);}catch(_0x2a7a72){return BPromise[_0xf226('0x1e')](_0x2a7a72);}return _0x1a578a[_0xf226('0x1f')]();};}function saveUpdates(_0x110f6e,_0x2826a6){return function(_0x544fba){if(_0x544fba){return _0x544fba[_0xf226('0x20')](_0x110f6e)[_0xf226('0x21')](function(_0x548f4f){return _0x548f4f;});}return null;};}function removeEntity(_0x546f18,_0x361604){return function(_0x50fb73){if(_0x50fb73){return _0x50fb73[_0xf226('0x22')]()['then'](function(){_0x546f18[_0xf226('0x17')](0xcc)[_0xf226('0x23')]();});}};}function handleEntityNotFound(_0xd9362f,_0x3c561b){return function(_0x5abff8){if(!_0x5abff8){_0xd9362f[_0xf226('0x16')](0x194);}return _0x5abff8;};}function handleError(_0x5d1d10,_0x3d9078){_0x3d9078=_0x3d9078||0x1f4;return function(_0x5b5e48){logger['error'](_0x5b5e48[_0xf226('0x24')]);if(_0x5b5e48['name']){delete _0x5b5e48[_0xf226('0x25')];}_0x5d1d10[_0xf226('0x17')](_0x3d9078)['send'](_0x5b5e48);};}exports[_0xf226('0x26')]=function(_0x1e8dc5,_0x43e9e5){var _0x3038bb={},_0x130750={},_0x5ba878={'count':0x0,'rows':[]};var _0x1dfed2=_['map'](db['SquareReport'][_0xf226('0x27')],function(_0xfabc24){return{'name':_0xfabc24[_0xf226('0x28')],'type':_0xfabc24['type'][_0xf226('0x29')]};});_0x130750[_0xf226('0x2a')]=_[_0xf226('0x2b')](_0x1dfed2,_0xf226('0x25'));_0x130750[_0xf226('0x2c')]=_[_0xf226('0x2d')](_0x1e8dc5['query']);_0x130750[_0xf226('0x2e')]=_['intersection'](_0x130750[_0xf226('0x2a')],_0x130750['query']);_0x3038bb[_0xf226('0x2f')]=_['intersection'](_0x130750[_0xf226('0x2a')],qs[_0xf226('0x30')](_0x1e8dc5[_0xf226('0x2c')]['fields']));_0x3038bb['attributes']=_0x3038bb[_0xf226('0x2f')]['length']?_0x3038bb[_0xf226('0x2f')]:_0x130750[_0xf226('0x2a')];if(!_0x1e8dc5[_0xf226('0x2c')][_0xf226('0x31')](_0xf226('0x32'))){_0x3038bb[_0xf226('0x19')]=qs[_0xf226('0x19')](_0x1e8dc5[_0xf226('0x2c')][_0xf226('0x19')]);_0x3038bb[_0xf226('0x1b')]=qs['offset'](_0x1e8dc5[_0xf226('0x2c')]['offset']);}_0x3038bb[_0xf226('0x33')]=qs[_0xf226('0x34')](_0x1e8dc5[_0xf226('0x2c')]['sort']);_0x3038bb[_0xf226('0x35')]=qs[_0xf226('0x2e')](_[_0xf226('0x36')](_0x1e8dc5['query'],_0x130750[_0xf226('0x2e')]),_0x1dfed2);if(_0x1e8dc5[_0xf226('0x2c')]['filter']){_0x3038bb[_0xf226('0x35')]=_[_0xf226('0x37')](_0x3038bb[_0xf226('0x35')],{'$or':_[_0xf226('0x2b')](_0x1dfed2,function(_0x5a58fe){if(_0x5a58fe[_0xf226('0x38')]!==_0xf226('0x39')){var _0x5e591b={};_0x5e591b[_0x5a58fe[_0xf226('0x25')]]={'$like':'%'+_0x1e8dc5['query'][_0xf226('0x3a')]+'%'};return _0x5e591b;}})});}_0x3038bb=_['merge']({},_0x3038bb,_0x1e8dc5['options']);var _0x4e3e77={'where':_0x3038bb[_0xf226('0x35')]};return db[_0xf226('0x3b')][_0xf226('0x1a')](_0x4e3e77)[_0xf226('0x21')](function(_0x394837){_0x5ba878[_0xf226('0x1a')]=_0x394837;if(_0x1e8dc5[_0xf226('0x2c')]['includeAll']){_0x3038bb[_0xf226('0x3c')]=[{'all':!![]}];}return db[_0xf226('0x3b')][_0xf226('0x3d')](_0x3038bb);})[_0xf226('0x21')](function(_0x2aa2ba){_0x5ba878[_0xf226('0x3e')]=_0x2aa2ba;return _0x5ba878;})[_0xf226('0x21')](respondWithFilteredResult(_0x43e9e5,_0x3038bb))[_0xf226('0x3f')](handleError(_0x43e9e5,null));};exports[_0xf226('0x40')]=function(_0x16b102,_0xa3f446){var _0x548c36={'raw':!![],'where':{'id':_0x16b102[_0xf226('0x41')]['id']}},_0xff945d={};_0xff945d[_0xf226('0x2a')]=_[_0xf226('0x2d')](db[_0xf226('0x3b')]['rawAttributes']);_0xff945d[_0xf226('0x2c')]=_[_0xf226('0x2d')](_0x16b102['query']);_0xff945d[_0xf226('0x2e')]=_['intersection'](_0xff945d['model'],_0xff945d[_0xf226('0x2c')]);_0x548c36['attributes']=_[_0xf226('0x42')](_0xff945d['model'],qs[_0xf226('0x30')](_0x16b102[_0xf226('0x2c')][_0xf226('0x30')]));_0x548c36[_0xf226('0x2f')]=_0x548c36['attributes'][_0xf226('0x43')]?_0x548c36[_0xf226('0x2f')]:_0xff945d[_0xf226('0x2a')];if(_0x16b102[_0xf226('0x2c')]['includeAll']){_0x548c36[_0xf226('0x3c')]=[{'all':!![]}];}_0x548c36=_['merge']({},_0x548c36,_0x16b102['options']);return db['SquareReport'][_0xf226('0x44')](_0x548c36)['then'](handleEntityNotFound(_0xa3f446,null))['then'](respondWithResult(_0xa3f446,null))[_0xf226('0x3f')](handleError(_0xa3f446,null));};exports['create']=function(_0x28fade,_0x1dc935){return db[_0xf226('0x3b')][_0xf226('0x45')](_0x28fade[_0xf226('0x46')],{})[_0xf226('0x21')](respondWithResult(_0x1dc935,0xc9))[_0xf226('0x3f')](handleError(_0x1dc935,null));};exports[_0xf226('0x20')]=function(_0x3e49f6,_0x32a58f){if(_0x3e49f6[_0xf226('0x46')]['id']){delete _0x3e49f6['body']['id'];}return db[_0xf226('0x3b')]['find']({'where':{'id':_0x3e49f6[_0xf226('0x41')]['id']}})['then'](handleEntityNotFound(_0x32a58f,null))[_0xf226('0x21')](saveUpdates(_0x3e49f6[_0xf226('0x46')],null))['then'](respondWithResult(_0x32a58f,null))['catch'](handleError(_0x32a58f,null));};exports[_0xf226('0x22')]=function(_0x4da397,_0x2a4356){return db['SquareReport']['find']({'where':{'id':_0x4da397[_0xf226('0x41')]['id']}})[_0xf226('0x21')](handleEntityNotFound(_0x2a4356,null))[_0xf226('0x21')](removeEntity(_0x2a4356,null))['catch'](handleError(_0x2a4356,null));};exports[_0xf226('0x47')]=function(_0x51cd4f,_0x17ada3){return db['SquareReport'][_0xf226('0x47')]()[_0xf226('0x21')](respondWithResult(_0x17ada3,null))['catch'](handleError(_0x17ada3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 54e595f..3bd74ec 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 _0x3bdc=['SquareReport','report_square','uid_pname','uniqueid','leaveAt','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x13c2ba,_0x1b4b9c){var _0x39483a=function(_0x8b2866){while(--_0x8b2866){_0x13c2ba['push'](_0x13c2ba['shift']());}};_0x39483a(++_0x1b4b9c);}(_0x3bdc,0x14a));var _0xc3bd=function(_0x806e44,_0x2cbb34){_0x806e44=_0x806e44-0x0;var _0x5c29cb=_0x3bdc[_0x806e44];return _0x5c29cb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3bd('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc3bd('0x1'));var rp=require(_0xc3bd('0x2'));var fs=require('fs');var path=require(_0xc3bd('0x3'));var rimraf=require('rimraf');var config=require(_0xc3bd('0x4'));var attributes=require(_0xc3bd('0x5'));module[_0xc3bd('0x6')]=function(_0x5582ed,_0x5dc681){return _0x5582ed[_0xc3bd('0x7')](_0xc3bd('0x8'),attributes,{'tableName':_0xc3bd('0x9'),'paranoid':![],'indexes':[{'name':_0xc3bd('0xa'),'fields':[_0xc3bd('0xb'),'project_name']},{'name':_0xc3bd('0xc'),'fields':[_0xc3bd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x746d=['moment','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api'];(function(_0x57c955,_0x31e625){var _0x382c3f=function(_0x142bab){while(--_0x142bab){_0x57c955['push'](_0x57c955['shift']());}};_0x382c3f(++_0x31e625);}(_0x746d,0xc0));var _0xd746=function(_0xc864d,_0x3443f2){_0xc864d=_0xc864d-0x0;var _0x4a1305=_0x746d[_0xc864d];return _0x4a1305;};'use strict';var _=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var logger=require(_0xd746('0x2'))(_0xd746('0x3'));var moment=require(_0xd746('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd746('0x5'));var rimraf=require(_0xd746('0x6'));var config=require(_0xd746('0x7'));var attributes=require(_0xd746('0x8'));module[_0xd746('0x9')]=function(_0x2b87d5,_0x186249){return _0x2b87d5['define'](_0xd746('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xd746('0xb'),'fields':[_0xd746('0xc'),'project_name']},{'name':'leaveAt','fields':[_0xd746('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4797678..10847aa 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 _0x903c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','stringify','UpdateSquareReport','update','where','attributes','lodash','util'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x903c,0x1ed));var _0xc903=function(_0x3aa58c,_0x4f8dfc){_0x3aa58c=_0x3aa58c-0x0;var _0x464c07=_0x903c[_0x3aa58c];return _0x464c07;};'use strict';var _=require(_0xc903('0x0'));var util=require(_0xc903('0x1'));var moment=require('moment');var BPromise=require(_0xc903('0x2'));var rs=require(_0xc903('0x3'));var fs=require('fs');var Redis=require(_0xc903('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc903('0x5'));var logger=require(_0xc903('0x6'))(_0xc903('0x7'));var config=require(_0xc903('0x8'));var jayson=require(_0xc903('0x9'));var client=jayson[_0xc903('0xa')][_0xc903('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x458ac6,_0x48ef80,_0x782b81){return new BPromise(function(_0x11636c,_0x3dcb51){return client[_0xc903('0xc')](_0x458ac6,_0x782b81)[_0xc903('0xd')](function(_0x17f7dc){logger[_0xc903('0xe')](_0xc903('0xf'),_0x48ef80,_0xc903('0x10'));logger[_0xc903('0x11')](_0xc903('0x12'),_0x48ef80,'request\x20sent',JSON['stringify'](_0x17f7dc));if(_0x17f7dc[_0xc903('0x13')]){if(_0x17f7dc[_0xc903('0x13')]['code']===0x1f4){logger[_0xc903('0x13')](_0xc903('0xf'),_0x48ef80,_0x17f7dc['error'][_0xc903('0x14')]);return _0x3dcb51(_0x17f7dc[_0xc903('0x13')][_0xc903('0x14')]);}logger[_0xc903('0x13')](_0xc903('0xf'),_0x48ef80,_0x17f7dc['error'][_0xc903('0x14')]);return _0x11636c(_0x17f7dc['error']['message']);}else{logger['info'](_0xc903('0xf'),_0x48ef80,_0xc903('0x10'));_0x11636c(_0x17f7dc[_0xc903('0x15')][_0xc903('0x14')]);}})[_0xc903('0x16')](function(_0x574c62){logger[_0xc903('0x13')](_0xc903('0xf'),_0x48ef80,_0x574c62);_0x3dcb51(_0x574c62);});});}exports[_0xc903('0x17')]=function(_0x360ee4){var _0x435956=this;return new Promise(function(_0x38bd99,_0x77867c){return db[_0xc903('0x18')][_0xc903('0x19')](_0x360ee4[_0xc903('0x1a')],{'raw':_0x360ee4['options']?_0x360ee4[_0xc903('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc903('0xd')](function(_0x48a07a){logger[_0xc903('0xe')](_0xc903('0x17'),_0x360ee4);logger[_0xc903('0x11')](_0xc903('0x17'),_0x360ee4,JSON[_0xc903('0x1c')](_0x48a07a));_0x38bd99(_0x48a07a);})[_0xc903('0x16')](function(_0x3ce144){logger[_0xc903('0x13')](_0xc903('0x17'),_0x3ce144[_0xc903('0x14')],_0x360ee4);_0x77867c(_0x435956[_0xc903('0x13')](0x1f4,_0x3ce144[_0xc903('0x14')]));});});};exports[_0xc903('0x1d')]=function(_0x54586f){var _0x20da78=this;return new Promise(function(_0x1e6d5b,_0x324ac3){return db[_0xc903('0x18')][_0xc903('0x1e')](_0x54586f[_0xc903('0x1a')],{'raw':_0x54586f[_0xc903('0x1b')]?_0x54586f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54586f[_0xc903('0x1b')]?_0x54586f[_0xc903('0x1b')][_0xc903('0x1f')]||null:null,'attributes':_0x54586f['options']?_0x54586f[_0xc903('0x1b')][_0xc903('0x20')]||null:null,'limit':_0x54586f[_0xc903('0x1b')]?_0x54586f[_0xc903('0x1b')]['limit']||null:null})[_0xc903('0xd')](function(_0x149b6e){logger[_0xc903('0xe')](_0xc903('0x1d'),_0x54586f);logger[_0xc903('0x11')](_0xc903('0x1d'),_0x54586f,JSON[_0xc903('0x1c')](_0x149b6e));_0x1e6d5b(_0x149b6e);})[_0xc903('0x16')](function(_0x28d3ae){logger[_0xc903('0x13')](_0xc903('0x1d'),_0x28d3ae[_0xc903('0x14')],_0x54586f);_0x324ac3(_0x20da78[_0xc903('0x13')](0x1f4,_0x28d3ae[_0xc903('0x14')]));});});}; \ No newline at end of file +var _0x0127=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareReport','SquareReport','create','options','raw','update','body','where','limit','UpdateSquareReport','debug','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x555f6e,_0x365467){var _0x3e6d19=function(_0x36c297){while(--_0x36c297){_0x555f6e['push'](_0x555f6e['shift']());}};_0x3e6d19(++_0x365467);}(_0x0127,0x87));var _0x7012=function(_0x27b337,_0x193ee5){_0x27b337=_0x27b337-0x0;var _0x197a84=_0x0127[_0x27b337];return _0x197a84;};'use strict';var _=require(_0x7012('0x0'));var util=require(_0x7012('0x1'));var moment=require(_0x7012('0x2'));var BPromise=require(_0x7012('0x3'));var rs=require(_0x7012('0x4'));var fs=require('fs');var Redis=require(_0x7012('0x5'));var db=require(_0x7012('0x6'))['db'];var utils=require(_0x7012('0x7'));var logger=require(_0x7012('0x8'))(_0x7012('0x9'));var config=require(_0x7012('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7012('0xb')][_0x7012('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e63e8,_0x233387,_0x4af649){return new BPromise(function(_0x141db1,_0x1e69d8){return client[_0x7012('0xd')](_0x5e63e8,_0x4af649)[_0x7012('0xe')](function(_0x16fe90){logger[_0x7012('0xf')](_0x7012('0x10'),_0x233387,_0x7012('0x11'));logger['debug'](_0x7012('0x12'),_0x233387,'request\x20sent',JSON[_0x7012('0x13')](_0x16fe90));if(_0x16fe90['error']){if(_0x16fe90[_0x7012('0x14')][_0x7012('0x15')]===0x1f4){logger[_0x7012('0x14')]('SquareReport,\x20%s,\x20%s',_0x233387,_0x16fe90['error'][_0x7012('0x16')]);return _0x1e69d8(_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);}logger['error'](_0x7012('0x10'),_0x233387,_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);return _0x141db1(_0x16fe90[_0x7012('0x14')][_0x7012('0x16')]);}else{logger['info'](_0x7012('0x10'),_0x233387,_0x7012('0x11'));_0x141db1(_0x16fe90['result']['message']);}})['catch'](function(_0x46211a){logger[_0x7012('0x14')](_0x7012('0x10'),_0x233387,_0x46211a);_0x1e69d8(_0x46211a);});});}exports[_0x7012('0x17')]=function(_0xc5f557){var _0x6dad57=this;return new Promise(function(_0x546ecd,_0x165268){return db[_0x7012('0x18')][_0x7012('0x19')](_0xc5f557['body'],{'raw':_0xc5f557[_0x7012('0x1a')]?_0xc5f557[_0x7012('0x1a')][_0x7012('0x1b')]===undefined?!![]:![]:!![]})[_0x7012('0xe')](function(_0x2a2997){logger[_0x7012('0xf')](_0x7012('0x17'),_0xc5f557);logger['debug'](_0x7012('0x17'),_0xc5f557,JSON['stringify'](_0x2a2997));_0x546ecd(_0x2a2997);})['catch'](function(_0x3bcf11){logger['error'](_0x7012('0x17'),_0x3bcf11['message'],_0xc5f557);_0x165268(_0x6dad57[_0x7012('0x14')](0x1f4,_0x3bcf11[_0x7012('0x16')]));});});};exports['UpdateSquareReport']=function(_0x112a23){var _0x8633c5=this;return new Promise(function(_0x197386,_0x35f83a){return db['SquareReport'][_0x7012('0x1c')](_0x112a23[_0x7012('0x1d')],{'raw':_0x112a23['options']?_0x112a23[_0x7012('0x1a')][_0x7012('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')][_0x7012('0x1e')]||null:null,'attributes':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')]['attributes']||null:null,'limit':_0x112a23[_0x7012('0x1a')]?_0x112a23[_0x7012('0x1a')][_0x7012('0x1f')]||null:null})[_0x7012('0xe')](function(_0x53b9f5){logger[_0x7012('0xf')](_0x7012('0x20'),_0x112a23);logger[_0x7012('0x21')]('UpdateSquareReport',_0x112a23,JSON[_0x7012('0x13')](_0x53b9f5));_0x197386(_0x53b9f5);})[_0x7012('0x22')](function(_0x23f73a){logger[_0x7012('0x14')](_0x7012('0x20'),_0x23f73a[_0x7012('0x16')],_0x112a23);_0x35f83a(_0x8633c5['error'](0x1f4,_0x23f73a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 28cc483..1683147 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 _0xeb4d=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0xeb4d,0xd4));var _0xdeb4=function(_0x26aa8f,_0x42971c){_0x26aa8f=_0x26aa8f-0x0;var _0xb9dadc=_0xeb4d[_0x26aa8f];return _0xb9dadc;};'use strict';var multer=require(_0xdeb4('0x0'));var util=require(_0xdeb4('0x1'));var path=require(_0xdeb4('0x2'));var timeout=require(_0xdeb4('0x3'));var express=require(_0xdeb4('0x4'));var router=express[_0xdeb4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdeb4('0x6'));var config=require(_0xdeb4('0x7'));var controller=require('./squareReportDetail.controller');router[_0xdeb4('0x8')]('/',auth[_0xdeb4('0x9')](),controller[_0xdeb4('0xa')]);router[_0xdeb4('0x8')](_0xdeb4('0xb'),auth['isAuthenticated'](),controller[_0xdeb4('0xc')]);router['get'](_0xdeb4('0xd'),auth['isAuthenticated'](),controller[_0xdeb4('0xe')]);router[_0xdeb4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xdeb4('0xd'),auth[_0xdeb4('0x9')](),controller[_0xdeb4('0x10')]);router[_0xdeb4('0x11')]('/:id',auth[_0xdeb4('0x9')](),controller['destroy']);module[_0xdeb4('0x12')]=router; \ No newline at end of file +var _0x0a2e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0a2e,0xb1));var _0xe0a2=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x0a2e[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0xe0a2('0x0'));var util=require('util');var path=require(_0xe0a2('0x1'));var timeout=require(_0xe0a2('0x2'));var express=require('express');var router=express[_0xe0a2('0x3')]();var fs_extra=require(_0xe0a2('0x4'));var auth=require(_0xe0a2('0x5'));var interaction=require(_0xe0a2('0x6'));var config=require(_0xe0a2('0x7'));var controller=require(_0xe0a2('0x8'));router[_0xe0a2('0x9')]('/',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xb')]);router[_0xe0a2('0x9')]('/describe',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xc')]);router['get'](_0xe0a2('0xd'),auth[_0xe0a2('0xa')](),controller[_0xe0a2('0xe')]);router[_0xe0a2('0xf')]('/',auth[_0xe0a2('0xa')](),controller[_0xe0a2('0x10')]);router['put'](_0xe0a2('0xd'),auth['isAuthenticated'](),controller[_0xe0a2('0x11')]);router[_0xe0a2('0x12')](_0xe0a2('0xd'),auth[_0xe0a2('0xa')](),controller[_0xe0a2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index dee431b..21a3c03 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 _0x8911=['STRING','sequelize','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8911,0xf1));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1891('0x0'));module[_0x1891('0x1')]={'uniqueid':{'type':Sequelize[_0x1891('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1891('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xab0f=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xab0f,0x14e));var _0xfab0=function(_0xdf47f8,_0x48abc5){_0xdf47f8=_0xdf47f8-0x0;var _0x506e3c=_0xab0f[_0xdf47f8];return _0x506e3c;};'use strict';var Sequelize=require(_0xfab0('0x0'));module[_0xfab0('0x1')]={'uniqueid':{'type':Sequelize[_0xfab0('0x2')]},'node':{'type':Sequelize[_0xfab0('0x2')]},'application':{'type':Sequelize[_0xfab0('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xfab0('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index dff6107..a8b9f2a 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 _0x1e4b=['length','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','SquareDetailsReport','fieldName','type','key','keys','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x1e4b,0x115));var _0xb1e4=function(_0x469352,_0xa0813c){_0x469352=_0x469352-0x0;var _0x37df85=_0x1e4b[_0x469352];return _0x37df85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1e4('0x0'));var zipdir=require(_0xb1e4('0x1'));var jsonpatch=require(_0xb1e4('0x2'));var rp=require(_0xb1e4('0x3'));var moment=require(_0xb1e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1e4('0x5'));var util=require(_0xb1e4('0x6'));var path=require('path');var sox=require(_0xb1e4('0x7'));var csv=require(_0xb1e4('0x8'));var ejs=require(_0xb1e4('0x9'));var fs=require('fs');var fs_extra=require(_0xb1e4('0xa'));var _=require(_0xb1e4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb1e4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb1e4('0x8'));var querystring=require(_0xb1e4('0xd'));var Papa=require(_0xb1e4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1e4('0xf'));var hardwareService=require(_0xb1e4('0x10'));var logger=require('../../config/logger')(_0xb1e4('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb1e4('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1b81,_0x2f3b70){_0x2f3b70=_0x2f3b70||0xcc;return function(_0x254d6a){if(_0x254d6a){return _0x3c1b81[_0xb1e4('0x13')](_0x2f3b70);}return _0x3c1b81[_0xb1e4('0x14')](_0x2f3b70)[_0xb1e4('0x15')]();};}function respondWithResult(_0x49811e,_0x40c95d){_0x40c95d=_0x40c95d||0xc8;return function(_0x5a5431){if(_0x5a5431){return _0x49811e['status'](_0x40c95d)['json'](_0x5a5431);}};}function respondWithFilteredResult(_0xdac958,_0xe5fb10){return function(_0x1fe4d1){if(_0x1fe4d1){var _0x4593bf=typeof _0xe5fb10[_0xb1e4('0x16')]===_0xb1e4('0x17')&&typeof _0xe5fb10[_0xb1e4('0x18')]===_0xb1e4('0x17');var _0x573d44=_0x1fe4d1[_0xb1e4('0x19')];var _0x3eb597=_0x4593bf?0x0:_0xe5fb10['offset'];var _0x25d678=_0x4593bf?_0x1fe4d1[_0xb1e4('0x19')]:_0xe5fb10[_0xb1e4('0x16')]+_0xe5fb10['limit'];var _0x43cb87;if(_0x25d678>=_0x573d44){_0x25d678=_0x573d44;_0x43cb87=0xc8;}else{_0x43cb87=0xce;}_0xdac958['status'](_0x43cb87);return _0xdac958[_0xb1e4('0x1a')](_0xb1e4('0x1b'),_0x3eb597+'-'+_0x25d678+'/'+_0x573d44)[_0xb1e4('0x1c')](_0x1fe4d1);}return null;};}function patchUpdates(_0x5d3d82){return function(_0x149c9b){try{jsonpatch[_0xb1e4('0x1d')](_0x149c9b,_0x5d3d82,!![]);}catch(_0x876c18){return BPromise[_0xb1e4('0x1e')](_0x876c18);}return _0x149c9b['save']();};}function saveUpdates(_0x306d0d,_0x5f36f4){return function(_0x2c95a4){if(_0x2c95a4){return _0x2c95a4[_0xb1e4('0x1f')](_0x306d0d)[_0xb1e4('0x20')](function(_0x11bacf){return _0x11bacf;});}return null;};}function removeEntity(_0x4fe064,_0x39af36){return function(_0x4af4e9){if(_0x4af4e9){return _0x4af4e9[_0xb1e4('0x21')]()['then'](function(){_0x4fe064['status'](0xcc)[_0xb1e4('0x15')]();});}};}function handleEntityNotFound(_0x491a22,_0x160bfc){return function(_0x36e85c){if(!_0x36e85c){_0x491a22[_0xb1e4('0x13')](0x194);}return _0x36e85c;};}function handleError(_0x525f05,_0x46394c){_0x46394c=_0x46394c||0x1f4;return function(_0x2273b0){logger[_0xb1e4('0x22')](_0x2273b0[_0xb1e4('0x23')]);if(_0x2273b0['name']){delete _0x2273b0[_0xb1e4('0x24')];}_0x525f05['status'](_0x46394c)['send'](_0x2273b0);};}exports['index']=function(_0x5cd6e7,_0x5f3246){var _0x2a92db={},_0x4a6918={},_0x96752b={'count':0x0,'rows':[]};var _0x3ef460=_[_0xb1e4('0x25')](db[_0xb1e4('0x26')]['rawAttributes'],function(_0x261160){return{'name':_0x261160[_0xb1e4('0x27')],'type':_0x261160[_0xb1e4('0x28')][_0xb1e4('0x29')]};});_0x4a6918['model']=_['map'](_0x3ef460,_0xb1e4('0x24'));_0x4a6918['query']=_[_0xb1e4('0x2a')](_0x5cd6e7[_0xb1e4('0x2b')]);_0x4a6918['filters']=_[_0xb1e4('0x2c')](_0x4a6918[_0xb1e4('0x2d')],_0x4a6918[_0xb1e4('0x2b')]);_0x2a92db[_0xb1e4('0x2e')]=_[_0xb1e4('0x2c')](_0x4a6918[_0xb1e4('0x2d')],qs[_0xb1e4('0x2f')](_0x5cd6e7[_0xb1e4('0x2b')]['fields']));_0x2a92db[_0xb1e4('0x2e')]=_0x2a92db[_0xb1e4('0x2e')]['length']?_0x2a92db[_0xb1e4('0x2e')]:_0x4a6918[_0xb1e4('0x2d')];if(!_0x5cd6e7[_0xb1e4('0x2b')]['hasOwnProperty'](_0xb1e4('0x30'))){_0x2a92db['limit']=qs[_0xb1e4('0x18')](_0x5cd6e7[_0xb1e4('0x2b')][_0xb1e4('0x18')]);_0x2a92db['offset']=qs[_0xb1e4('0x16')](_0x5cd6e7[_0xb1e4('0x2b')][_0xb1e4('0x16')]);}_0x2a92db[_0xb1e4('0x31')]=qs['sort'](_0x5cd6e7[_0xb1e4('0x2b')][_0xb1e4('0x32')]);_0x2a92db[_0xb1e4('0x33')]=qs[_0xb1e4('0x34')](_['pick'](_0x5cd6e7[_0xb1e4('0x2b')],_0x4a6918['filters']),_0x3ef460);if(_0x5cd6e7[_0xb1e4('0x2b')]['filter']){_0x2a92db[_0xb1e4('0x33')]=_[_0xb1e4('0x35')](_0x2a92db[_0xb1e4('0x33')],{'$or':_['map'](_0x3ef460,function(_0x3c3c47){if(_0x3c3c47[_0xb1e4('0x28')]!==_0xb1e4('0x36')){var _0x378b8d={};_0x378b8d[_0x3c3c47[_0xb1e4('0x24')]]={'$like':'%'+_0x5cd6e7['query']['filter']+'%'};return _0x378b8d;}})});}_0x2a92db=_[_0xb1e4('0x35')]({},_0x2a92db,_0x5cd6e7[_0xb1e4('0x37')]);var _0x37e662={'where':_0x2a92db[_0xb1e4('0x33')]};return db[_0xb1e4('0x26')][_0xb1e4('0x19')](_0x37e662)[_0xb1e4('0x20')](function(_0x223610){_0x96752b[_0xb1e4('0x19')]=_0x223610;if(_0x5cd6e7[_0xb1e4('0x2b')][_0xb1e4('0x38')]){_0x2a92db['include']=[{'all':!![]}];}return db[_0xb1e4('0x26')][_0xb1e4('0x39')](_0x2a92db);})[_0xb1e4('0x20')](function(_0x36baf3){_0x96752b[_0xb1e4('0x3a')]=_0x36baf3;return _0x96752b;})[_0xb1e4('0x20')](respondWithFilteredResult(_0x5f3246,_0x2a92db))[_0xb1e4('0x3b')](handleError(_0x5f3246,null));};exports[_0xb1e4('0x3c')]=function(_0xb93ef3,_0x4678e9){var _0x3cf28d={'raw':!![],'where':{'id':_0xb93ef3[_0xb1e4('0x3d')]['id']}},_0x4ce1a1={};_0x4ce1a1[_0xb1e4('0x2d')]=_[_0xb1e4('0x2a')](db['SquareDetailsReport'][_0xb1e4('0x3e')]);_0x4ce1a1[_0xb1e4('0x2b')]=_[_0xb1e4('0x2a')](_0xb93ef3[_0xb1e4('0x2b')]);_0x4ce1a1['filters']=_['intersection'](_0x4ce1a1['model'],_0x4ce1a1[_0xb1e4('0x2b')]);_0x3cf28d[_0xb1e4('0x2e')]=_[_0xb1e4('0x2c')](_0x4ce1a1[_0xb1e4('0x2d')],qs[_0xb1e4('0x2f')](_0xb93ef3['query'][_0xb1e4('0x2f')]));_0x3cf28d[_0xb1e4('0x2e')]=_0x3cf28d[_0xb1e4('0x2e')][_0xb1e4('0x3f')]?_0x3cf28d[_0xb1e4('0x2e')]:_0x4ce1a1['model'];if(_0xb93ef3['query'][_0xb1e4('0x38')]){_0x3cf28d['include']=[{'all':!![]}];}_0x3cf28d=_[_0xb1e4('0x35')]({},_0x3cf28d,_0xb93ef3[_0xb1e4('0x37')]);return db['SquareDetailsReport'][_0xb1e4('0x40')](_0x3cf28d)[_0xb1e4('0x20')](handleEntityNotFound(_0x4678e9,null))[_0xb1e4('0x20')](respondWithResult(_0x4678e9,null))['catch'](handleError(_0x4678e9,null));};exports['create']=function(_0x350ff4,_0x427b74){return db[_0xb1e4('0x26')][_0xb1e4('0x41')](_0x350ff4['body'],{})['then'](respondWithResult(_0x427b74,0xc9))[_0xb1e4('0x3b')](handleError(_0x427b74,null));};exports[_0xb1e4('0x1f')]=function(_0x298a36,_0x4a45e7){if(_0x298a36[_0xb1e4('0x42')]['id']){delete _0x298a36['body']['id'];}return db[_0xb1e4('0x26')][_0xb1e4('0x40')]({'where':{'id':_0x298a36['params']['id']}})[_0xb1e4('0x20')](handleEntityNotFound(_0x4a45e7,null))['then'](saveUpdates(_0x298a36['body'],null))[_0xb1e4('0x20')](respondWithResult(_0x4a45e7,null))[_0xb1e4('0x3b')](handleError(_0x4a45e7,null));};exports[_0xb1e4('0x21')]=function(_0x46f2b9,_0xcacaba){return db[_0xb1e4('0x26')][_0xb1e4('0x40')]({'where':{'id':_0x46f2b9[_0xb1e4('0x3d')]['id']}})['then'](handleEntityNotFound(_0xcacaba,null))['then'](removeEntity(_0xcacaba,null))[_0xb1e4('0x3b')](handleError(_0xcacaba,null));};exports[_0xb1e4('0x43')]=function(_0x123b38,_0x4b47d7){return db[_0xb1e4('0x26')][_0xb1e4('0x43')]()[_0xb1e4('0x20')](respondWithResult(_0x4b47d7,null))[_0xb1e4('0x3b')](handleError(_0x4b47d7,null));}; \ No newline at end of file +var _0x4ed2=['fields','attributes','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','show','rawAttributes','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','then','error','name','send','index','map','SquareDetailsReport','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4ed2,0x13d));var _0x24ed=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4ed2[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x24ed('0x0'));var rimraf=require(_0x24ed('0x1'));var zipdir=require(_0x24ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24ed('0x3'));var moment=require(_0x24ed('0x4'));var BPromise=require(_0x24ed('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x24ed('0x6'));var sox=require(_0x24ed('0x7'));var csv=require('to-csv');var ejs=require(_0x24ed('0x8'));var fs=require('fs');var fs_extra=require(_0x24ed('0x9'));var _=require(_0x24ed('0xa'));var squel=require(_0x24ed('0xb'));var crypto=require('crypto');var jsforce=require(_0x24ed('0xc'));var deskjs=require(_0x24ed('0xd'));var toCsv=require(_0x24ed('0xe'));var querystring=require(_0x24ed('0xf'));var Papa=require(_0x24ed('0x10'));var Redis=require(_0x24ed('0x11'));var authService=require(_0x24ed('0x12'));var qs=require(_0x24ed('0x13'));var as=require(_0x24ed('0x14'));var hardwareService=require(_0x24ed('0x15'));var logger=require(_0x24ed('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x24ed('0x17'));var licenseUtil=require(_0x24ed('0x18'));var db=require(_0x24ed('0x19'))['db'];function respondWithStatusCode(_0x5e1cf7,_0x2e8811){_0x2e8811=_0x2e8811||0xcc;return function(_0xea470){if(_0xea470){return _0x5e1cf7[_0x24ed('0x1a')](_0x2e8811);}return _0x5e1cf7[_0x24ed('0x1b')](_0x2e8811)[_0x24ed('0x1c')]();};}function respondWithResult(_0x22ee47,_0xbc57c3){_0xbc57c3=_0xbc57c3||0xc8;return function(_0x5a7b69){if(_0x5a7b69){return _0x22ee47[_0x24ed('0x1b')](_0xbc57c3)[_0x24ed('0x1d')](_0x5a7b69);}};}function respondWithFilteredResult(_0x5d260f,_0x3c5129){return function(_0x34e1c2){if(_0x34e1c2){var _0x4f8af4=typeof _0x3c5129[_0x24ed('0x1e')]===_0x24ed('0x1f')&&typeof _0x3c5129[_0x24ed('0x20')]==='undefined';var _0x3f696f=_0x34e1c2[_0x24ed('0x21')];var _0xbdb421=_0x4f8af4?0x0:_0x3c5129[_0x24ed('0x1e')];var _0x142be8=_0x4f8af4?_0x34e1c2['count']:_0x3c5129[_0x24ed('0x1e')]+_0x3c5129['limit'];var _0x5a92c1;if(_0x142be8>=_0x3f696f){_0x142be8=_0x3f696f;_0x5a92c1=0xc8;}else{_0x5a92c1=0xce;}_0x5d260f[_0x24ed('0x1b')](_0x5a92c1);return _0x5d260f['set']('Content-Range',_0xbdb421+'-'+_0x142be8+'/'+_0x3f696f)['json'](_0x34e1c2);}return null;};}function patchUpdates(_0x466007){return function(_0xeabbbb){try{jsonpatch['apply'](_0xeabbbb,_0x466007,!![]);}catch(_0x37738f){return BPromise[_0x24ed('0x22')](_0x37738f);}return _0xeabbbb[_0x24ed('0x23')]();};}function saveUpdates(_0x589f49,_0x170661){return function(_0x2f1908){if(_0x2f1908){return _0x2f1908[_0x24ed('0x24')](_0x589f49)['then'](function(_0x67e0b7){return _0x67e0b7;});}return null;};}function removeEntity(_0x4693e6,_0x155abe){return function(_0x473b16){if(_0x473b16){return _0x473b16[_0x24ed('0x25')]()[_0x24ed('0x26')](function(){_0x4693e6[_0x24ed('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb83b,_0x402fcb){return function(_0x1a332b){if(!_0x1a332b){_0x2cb83b[_0x24ed('0x1a')](0x194);}return _0x1a332b;};}function handleError(_0x4c6112,_0x2a5518){_0x2a5518=_0x2a5518||0x1f4;return function(_0x20dfb2){logger[_0x24ed('0x27')](_0x20dfb2['stack']);if(_0x20dfb2['name']){delete _0x20dfb2[_0x24ed('0x28')];}_0x4c6112['status'](_0x2a5518)[_0x24ed('0x29')](_0x20dfb2);};}exports[_0x24ed('0x2a')]=function(_0x4b3ffd,_0x28a7f8){var _0xd109c5={},_0xf79095={},_0x49bb76={'count':0x0,'rows':[]};var _0x431b2c=_[_0x24ed('0x2b')](db[_0x24ed('0x2c')]['rawAttributes'],function(_0x4b675c){return{'name':_0x4b675c[_0x24ed('0x2d')],'type':_0x4b675c[_0x24ed('0x2e')][_0x24ed('0x2f')]};});_0xf79095['model']=_[_0x24ed('0x2b')](_0x431b2c,_0x24ed('0x28'));_0xf79095[_0x24ed('0x30')]=_[_0x24ed('0x31')](_0x4b3ffd[_0x24ed('0x30')]);_0xf79095[_0x24ed('0x32')]=_[_0x24ed('0x33')](_0xf79095[_0x24ed('0x34')],_0xf79095['query']);_0xd109c5['attributes']=_[_0x24ed('0x33')](_0xf79095['model'],qs[_0x24ed('0x35')](_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x35')]));_0xd109c5[_0x24ed('0x36')]=_0xd109c5[_0x24ed('0x36')]['length']?_0xd109c5[_0x24ed('0x36')]:_0xf79095[_0x24ed('0x34')];if(!_0x4b3ffd['query'][_0x24ed('0x37')](_0x24ed('0x38'))){_0xd109c5[_0x24ed('0x20')]=qs[_0x24ed('0x20')](_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x20')]);_0xd109c5['offset']=qs[_0x24ed('0x1e')](_0x4b3ffd['query']['offset']);}_0xd109c5['order']=qs[_0x24ed('0x39')](_0x4b3ffd['query']['sort']);_0xd109c5['where']=qs['filters'](_[_0x24ed('0x3a')](_0x4b3ffd[_0x24ed('0x30')],_0xf79095[_0x24ed('0x32')]),_0x431b2c);if(_0x4b3ffd[_0x24ed('0x30')]['filter']){_0xd109c5[_0x24ed('0x3b')]=_[_0x24ed('0x3c')](_0xd109c5[_0x24ed('0x3b')],{'$or':_['map'](_0x431b2c,function(_0x1be267){if(_0x1be267['type']!=='VIRTUAL'){var _0x59b7e0={};_0x59b7e0[_0x1be267['name']]={'$like':'%'+_0x4b3ffd['query'][_0x24ed('0x3d')]+'%'};return _0x59b7e0;}})});}_0xd109c5=_[_0x24ed('0x3c')]({},_0xd109c5,_0x4b3ffd[_0x24ed('0x3e')]);var _0x3df4cc={'where':_0xd109c5[_0x24ed('0x3b')]};return db[_0x24ed('0x2c')]['count'](_0x3df4cc)['then'](function(_0x4c65c9){_0x49bb76['count']=_0x4c65c9;if(_0x4b3ffd[_0x24ed('0x30')][_0x24ed('0x3f')]){_0xd109c5[_0x24ed('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x24ed('0x41')](_0xd109c5);})[_0x24ed('0x26')](function(_0x54fa2c){_0x49bb76['rows']=_0x54fa2c;return _0x49bb76;})['then'](respondWithFilteredResult(_0x28a7f8,_0xd109c5))['catch'](handleError(_0x28a7f8,null));};exports[_0x24ed('0x42')]=function(_0x47b806,_0x54fe48){var _0x19da1f={'raw':!![],'where':{'id':_0x47b806['params']['id']}},_0x5f22a6={};_0x5f22a6[_0x24ed('0x34')]=_[_0x24ed('0x31')](db[_0x24ed('0x2c')][_0x24ed('0x43')]);_0x5f22a6[_0x24ed('0x30')]=_[_0x24ed('0x31')](_0x47b806[_0x24ed('0x30')]);_0x5f22a6[_0x24ed('0x32')]=_[_0x24ed('0x33')](_0x5f22a6['model'],_0x5f22a6[_0x24ed('0x30')]);_0x19da1f['attributes']=_[_0x24ed('0x33')](_0x5f22a6[_0x24ed('0x34')],qs[_0x24ed('0x35')](_0x47b806[_0x24ed('0x30')][_0x24ed('0x35')]));_0x19da1f['attributes']=_0x19da1f['attributes']['length']?_0x19da1f[_0x24ed('0x36')]:_0x5f22a6[_0x24ed('0x34')];if(_0x47b806[_0x24ed('0x30')][_0x24ed('0x3f')]){_0x19da1f[_0x24ed('0x40')]=[{'all':!![]}];}_0x19da1f=_[_0x24ed('0x3c')]({},_0x19da1f,_0x47b806[_0x24ed('0x3e')]);return db[_0x24ed('0x2c')]['find'](_0x19da1f)[_0x24ed('0x26')](handleEntityNotFound(_0x54fe48,null))[_0x24ed('0x26')](respondWithResult(_0x54fe48,null))[_0x24ed('0x44')](handleError(_0x54fe48,null));};exports[_0x24ed('0x45')]=function(_0x305a18,_0x5cee36){return db[_0x24ed('0x2c')][_0x24ed('0x45')](_0x305a18[_0x24ed('0x46')],{})[_0x24ed('0x26')](respondWithResult(_0x5cee36,0xc9))[_0x24ed('0x44')](handleError(_0x5cee36,null));};exports[_0x24ed('0x24')]=function(_0x19f42a,_0x23f4a8){if(_0x19f42a[_0x24ed('0x46')]['id']){delete _0x19f42a['body']['id'];}return db[_0x24ed('0x2c')][_0x24ed('0x47')]({'where':{'id':_0x19f42a[_0x24ed('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f4a8,null))[_0x24ed('0x26')](saveUpdates(_0x19f42a[_0x24ed('0x46')],null))[_0x24ed('0x26')](respondWithResult(_0x23f4a8,null))[_0x24ed('0x44')](handleError(_0x23f4a8,null));};exports[_0x24ed('0x25')]=function(_0xf97c27,_0x3949ca){return db[_0x24ed('0x2c')]['find']({'where':{'id':_0xf97c27[_0x24ed('0x48')]['id']}})[_0x24ed('0x26')](handleEntityNotFound(_0x3949ca,null))['then'](removeEntity(_0x3949ca,null))['catch'](handleError(_0x3949ca,null));};exports['describe']=function(_0x3bf963,_0x195558){return db[_0x24ed('0x2c')][_0x24ed('0x49')]()[_0x24ed('0x26')](respondWithResult(_0x195558,null))[_0x24ed('0x44')](handleError(_0x195558,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5692368..a4b85e0 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 _0x8165=['../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2a2ce7,_0x5cc714){var _0x6b23aa=function(_0x4eb7fa){while(--_0x4eb7fa){_0x2a2ce7['push'](_0x2a2ce7['shift']());}};_0x6b23aa(++_0x5cc714);}(_0x8165,0x93));var _0x5816=function(_0x2fc4ac,_0x9d882d){_0x2fc4ac=_0x2fc4ac-0x0;var _0x3b77af=_0x8165[_0x2fc4ac];return _0x3b77af;};'use strict';var _=require(_0x5816('0x0'));var util=require('util');var logger=require(_0x5816('0x1'))(_0x5816('0x2'));var moment=require('moment');var BPromise=require(_0x5816('0x3'));var rp=require(_0x5816('0x4'));var fs=require('fs');var path=require(_0x5816('0x5'));var rimraf=require(_0x5816('0x6'));var config=require(_0x5816('0x7'));var attributes=require(_0x5816('0x8'));module['exports']=function(_0x363b9f,_0x18fa08){return _0x363b9f[_0x5816('0x9')](_0x5816('0xa'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a18=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','path','../../config/environment','./squareReportDetail.attributes'];(function(_0xf8c326,_0x38c9d3){var _0x307a22=function(_0x5ab46b){while(--_0x5ab46b){_0xf8c326['push'](_0xf8c326['shift']());}};_0x307a22(++_0x38c9d3);}(_0x6a18,0x184));var _0x86a1=function(_0x3ee3d7,_0x1df7a8){_0x3ee3d7=_0x3ee3d7-0x0;var _0x46332a=_0x6a18[_0x3ee3d7];return _0x46332a;};'use strict';var _=require(_0x86a1('0x0'));var util=require(_0x86a1('0x1'));var logger=require(_0x86a1('0x2'))(_0x86a1('0x3'));var moment=require(_0x86a1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x86a1('0x5'));var rimraf=require('rimraf');var config=require(_0x86a1('0x6'));var attributes=require(_0x86a1('0x7'));module[_0x86a1('0x8')]=function(_0x3110e0,_0x3cd2d1){return _0x3110e0[_0x86a1('0x9')](_0x86a1('0xa'),attributes,{'tableName':_0x86a1('0xb'),'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 f0c6724..e3d1539 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 _0x531a=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x4fc442,_0x4b21d0){var _0x1e2430=function(_0xcbe383){while(--_0xcbe383){_0x4fc442['push'](_0x4fc442['shift']());}};_0x1e2430(++_0x4b21d0);}(_0x531a,0x100));var _0xa531=function(_0x96cefd,_0x25cb5d){_0x96cefd=_0x96cefd-0x0;var _0x4310c1=_0x531a[_0x96cefd];return _0x4310c1;};'use strict';var _=require(_0xa531('0x0'));var util=require(_0xa531('0x1'));var moment=require(_0xa531('0x2'));var BPromise=require(_0xa531('0x3'));var rs=require(_0xa531('0x4'));var fs=require('fs');var Redis=require(_0xa531('0x5'));var db=require(_0xa531('0x6'))['db'];var utils=require(_0xa531('0x7'));var logger=require(_0xa531('0x8'))(_0xa531('0x9'));var config=require('../../config/environment');var jayson=require(_0xa531('0xa'));var client=jayson['client'][_0xa531('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4446b9,_0x3fd172,_0x286dc7){return new BPromise(function(_0x3b68a7,_0x5bd2f9){return client[_0xa531('0xc')](_0x4446b9,_0x286dc7)[_0xa531('0xd')](function(_0x4d07e4){logger[_0xa531('0xe')](_0xa531('0xf'),_0x3fd172,_0xa531('0x10'));logger[_0xa531('0x11')](_0xa531('0x12'),_0x3fd172,'request\x20sent',JSON[_0xa531('0x13')](_0x4d07e4));if(_0x4d07e4['error']){if(_0x4d07e4[_0xa531('0x14')][_0xa531('0x15')]===0x1f4){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x5bd2f9(_0x4d07e4['error'][_0xa531('0x16')]);}logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x4d07e4[_0xa531('0x14')][_0xa531('0x16')]);return _0x3b68a7(_0x4d07e4[_0xa531('0x14')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0xa531('0x10'));_0x3b68a7(_0x4d07e4[_0xa531('0x17')][_0xa531('0x16')]);}})[_0xa531('0x18')](function(_0x324076){logger[_0xa531('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x3fd172,_0x324076);_0x5bd2f9(_0x324076);});});}exports[_0xa531('0x19')]=function(_0x5124a1){var _0x412b84=this;return new Promise(function(_0x146013,_0x4fb62e){return db['SquareDetailsReport'][_0xa531('0x1a')](_0x5124a1[_0xa531('0x1b')],{'raw':_0x5124a1[_0xa531('0x1c')]?_0x5124a1['options'][_0xa531('0x1d')]===undefined?!![]:![]:!![]})[_0xa531('0xd')](function(_0x4096f0){logger['info'](_0xa531('0x19'),_0x5124a1);logger[_0xa531('0x11')]('CreateSquareDetailsReport',_0x5124a1,JSON[_0xa531('0x13')](_0x4096f0));_0x146013(_0x4096f0);})[_0xa531('0x18')](function(_0x3a2016){logger[_0xa531('0x14')](_0xa531('0x19'),_0x3a2016[_0xa531('0x16')],_0x5124a1);_0x4fb62e(_0x412b84[_0xa531('0x14')](0x1f4,_0x3a2016[_0xa531('0x16')]));});});}; \ No newline at end of file +var _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x40c87e,_0x40e38b){var _0xebcac5=function(_0x1c3523){while(--_0x1c3523){_0x40c87e['push'](_0x40c87e['shift']());}};_0xebcac5(++_0x40e38b);}(_0x4fc2,0x111));var _0x24fc=function(_0xdb0ce1,_0x1db757){_0xdb0ce1=_0xdb0ce1-0x0;var _0x24fa8b=_0x4fc2[_0xdb0ce1];return _0x24fa8b;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['CreateSquareDetailsReport']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['SquareDetailsReport'][_0x24fc('0x17')](_0x23873c[_0x24fc('0x18')],{'raw':_0x23873c[_0x24fc('0x19')]?_0x23873c['options'][_0x24fc('0x1a')]===undefined?!![]:![]:!![]})[_0x24fc('0xc')](function(_0xbf1d6b){logger[_0x24fc('0xd')]('CreateSquareDetailsReport',_0x23873c);logger[_0x24fc('0x10')]('CreateSquareDetailsReport',_0x23873c,JSON[_0x24fc('0x12')](_0xbf1d6b));_0x6cfa0a(_0xbf1d6b);})['catch'](function(_0x3ed464){logger[_0x24fc('0x13')](_0x24fc('0x1b'),_0x3ed464['message'],_0x23873c);_0x8ac114(_0x1cb3d0[_0x24fc('0x13')](0x1f4,_0x3ed464['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3a3559a..1889536 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 _0x8c60=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill'];(function(_0x127c86,_0x5320ae){var _0x5a7300=function(_0x1f494f){while(--_0x1f494f){_0x127c86['push'](_0x127c86['shift']());}};_0x5a7300(++_0x5320ae);}(_0x8c60,0x1df));var _0x08c6=function(_0x582932,_0x162ca4){_0x582932=_0x582932-0x0;var _0x141df1=_0x8c60[_0x582932];return _0x141df1;};'use strict';var express=require(_0x08c6('0x0'));var router=express[_0x08c6('0x1')]();var auth=require(_0x08c6('0x2'));var controller=require(_0x08c6('0x3'));router['get']('/',auth[_0x08c6('0x4')](),controller[_0x08c6('0x5')]);router['get'](_0x08c6('0x6'),auth['isAuthenticated'](),controller[_0x08c6('0x7')]);module[_0x08c6('0x8')]=router; \ No newline at end of file +var _0x7d79=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router'];(function(_0xb33085,_0x1b00b7){var _0x31919d=function(_0x252e08){while(--_0x252e08){_0xb33085['push'](_0xb33085['shift']());}};_0x31919d(++_0x1b00b7);}(_0x7d79,0x7e));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x97d7('0x0'));var router=express[_0x97d7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x97d7('0x2'));router[_0x97d7('0x3')]('/',auth[_0x97d7('0x4')](),controller[_0x97d7('0x5')]);router[_0x97d7('0x3')](_0x97d7('0x6'),auth[_0x97d7('0x4')](),controller[_0x97d7('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e01b107..685bbbb 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 _0x3987=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','killProcess','components/import/cm'];(function(_0x221f37,_0x17904c){var _0x237985=function(_0x28f064){while(--_0x28f064){_0x221f37['push'](_0x221f37['shift']());}};_0x237985(++_0x17904c);}(_0x3987,0x14f));var _0x7398=function(_0x282e64,_0x2cea86){_0x282e64=_0x282e64-0x0;var _0x5c2f6b=_0x3987[_0x282e64];return _0x5c2f6b;};'use strict';var info=require(_0x7398('0x0'));var exec=require('child_process')[_0x7398('0x1')];var logger=require('../../config/logger')(_0x7398('0x2'));var util=require('util');var BPromise=require(_0x7398('0x3'));var _=require(_0x7398('0x4'));function handleError(_0x5aef87,_0x2f2f65,_0x60024e){_0x2f2f65=_0x2f2f65||0x1f4;return function(_0x3b5e07){logger['error'](_0x7398('0x5'),_0x60024e,_0x2f2f65,util[_0x7398('0x6')](_0x3b5e07,{'showHidden':![],'depth':null}));delete _0x3b5e07[_0x7398('0x7')];_0x5aef87[_0x7398('0x8')](_0x2f2f65)[_0x7398('0x9')](_0x3b5e07);};}exports['index']=function(_0x58ac29,_0x22b6f9){return info[_0x7398('0xa')]()[_0x7398('0xb')](function(_0x15553a){return _0x22b6f9[_0x7398('0x8')](0xc8)[_0x7398('0xc')](_0x15553a);})[_0x7398('0xd')](function(_0x173dd3){return _0x22b6f9['status'](0x1f4)[_0x7398('0xc')](_0x173dd3);});};exports[_0x7398('0xe')]=function(_0x47db72,_0x2fce2a){var _0x3483cf=[_0x7398('0xf')];return new BPromise(function(_0x18f923,_0x5b359d){return exec(util[_0x7398('0x10')](_0x7398('0x11'),_0x47db72[_0x7398('0x12')]['pid']),function(_0x41bace,_0x51217e,_0x4e71c6){if(_0x41bace){return _0x5b359d(_0x41bace);}return _0x18f923(_0x51217e);});})[_0x7398('0xb')](function(_0x3ea7f3){var _0x54a8ba=![];var _0x25e69d=_0x3ea7f3[_0x7398('0x13')](/\n/);for(var _0x4b3db6=0x0,_0x4d8ca4=_0x3483cf[_0x7398('0x14')];_0x4b3db6<_0x4d8ca4,_0x54a8ba===![];_0x4b3db6+=0x1){if(_0x3ea7f3[_0x7398('0x15')](_0x3483cf[_0x4b3db6])>=0x0){_0x54a8ba=!![];}}if(!_0x54a8ba){throw new Error(util[_0x7398('0x10')](_0x7398('0x16'),_0x47db72[_0x7398('0x12')][_0x7398('0x17')]));}process[_0x7398('0x18')](_0x47db72['params'][_0x7398('0x17')],_0x7398('0x19'));return _0x2fce2a[_0x7398('0x8')](0xc8)[_0x7398('0xc')]({'message':util[_0x7398('0x10')](_0x7398('0x1a'),_0x47db72[_0x7398('0x12')][_0x7398('0x17')])});})[_0x7398('0xd')](handleError(_0x2fce2a,null,_0x7398('0xe')));}; \ No newline at end of file +var _0xec1b=['getAllData','then','json','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','exec','../../config/logger','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xec1b,0x15f));var _0xbec1=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xec1b[_0x582274];return _0x8f14d3;};'use strict';var info=require(_0xbec1('0x0'));var exec=require('child_process')[_0xbec1('0x1')];var logger=require(_0xbec1('0x2'))('api');var util=require(_0xbec1('0x3'));var BPromise=require('bluebird');var _=require(_0xbec1('0x4'));function handleError(_0x252fbb,_0x3a80c0,_0x7ff18d){_0x3a80c0=_0x3a80c0||0x1f4;return function(_0x549237){logger['error'](_0xbec1('0x5'),_0x7ff18d,_0x3a80c0,util[_0xbec1('0x6')](_0x549237,{'showHidden':![],'depth':null}));delete _0x549237[_0xbec1('0x7')];_0x252fbb[_0xbec1('0x8')](_0x3a80c0)['send'](_0x549237);};}exports['index']=function(_0x476719,_0x24c9be){return info[_0xbec1('0x9')]()[_0xbec1('0xa')](function(_0x59dbaf){return _0x24c9be[_0xbec1('0x8')](0xc8)[_0xbec1('0xb')](_0x59dbaf);})['catch'](function(_0x268393){return _0x24c9be[_0xbec1('0x8')](0x1f4)[_0xbec1('0xb')](_0x268393);});};exports['killProcess']=function(_0x6acde9,_0x3b457d){var _0x340314=[_0xbec1('0xc')];return new BPromise(function(_0x128107,_0x46c10b){return exec(util[_0xbec1('0xd')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')]),function(_0x20255c,_0x382478,_0xbbd8e7){if(_0x20255c){return _0x46c10b(_0x20255c);}return _0x128107(_0x382478);});})[_0xbec1('0xa')](function(_0x1c171b){var _0xbe3f1c=![];var _0x168cc7=_0x1c171b[_0xbec1('0x10')](/\n/);for(var _0x28c54d=0x0,_0x5703a3=_0x340314[_0xbec1('0x11')];_0x28c54d<_0x5703a3,_0xbe3f1c===![];_0x28c54d+=0x1){if(_0x1c171b[_0xbec1('0x12')](_0x340314[_0x28c54d])>=0x0){_0xbe3f1c=!![];}}if(!_0xbe3f1c){throw new Error(util[_0xbec1('0xd')](_0xbec1('0x13'),_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')]));}process['kill'](_0x6acde9[_0xbec1('0xe')]['pid'],_0xbec1('0x14'));return _0x3b457d[_0xbec1('0x8')](0xc8)[_0xbec1('0xb')]({'message':util[_0xbec1('0xd')](_0xbec1('0x15'),_0x6acde9[_0xbec1('0xe')][_0xbec1('0xf')])});})[_0xbec1('0x16')](handleError(_0x3b457d,null,_0xbec1('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d565c5d..2fb2196 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 _0x0799=['../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra'];(function(_0x3c5840,_0x29cf17){var _0x10c34b=function(_0x5ead94){while(--_0x5ead94){_0x3c5840['push'](_0x3c5840['shift']());}};_0x10c34b(++_0x29cf17);}(_0x0799,0x151));var _0x9079=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0799[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0x9079('0x0'));var util=require(_0x9079('0x1'));var path=require(_0x9079('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9079('0x3')]();var fs_extra=require(_0x9079('0x4'));var auth=require(_0x9079('0x5'));var interaction=require(_0x9079('0x6'));var config=require('../../config/environment');var controller=require(_0x9079('0x7'));router[_0x9079('0x8')]('/',auth[_0x9079('0x9')](),controller[_0x9079('0xa')]);router[_0x9079('0x8')](_0x9079('0xb'),auth[_0x9079('0x9')](),controller[_0x9079('0xc')]);router[_0x9079('0xd')]('/',auth['isAuthenticated'](),controller[_0x9079('0xe')]);router[_0x9079('0xf')]('/:id',auth[_0x9079('0x9')](),controller[_0x9079('0x10')]);router[_0x9079('0x11')]('/:id',auth[_0x9079('0x9')](),controller['destroy']);module[_0x9079('0x12')]=router; \ No newline at end of file +var _0xda28=['../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xda28,0xfd));var _0x8da2=function(_0x96b6bf,_0xa5a9cd){_0x96b6bf=_0x96b6bf-0x0;var _0x1bc323=_0xda28[_0x96b6bf];return _0x1bc323;};'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['show']);router[_0x8da2('0xe')]('/',auth['isAuthenticated'](),controller[_0x8da2('0xf')]);router[_0x8da2('0x10')](_0x8da2('0xc'),auth[_0x8da2('0xd')](),controller['update']);router[_0x8da2('0x11')]('/:id',auth[_0x8da2('0xd')](),controller[_0x8da2('0x12')]);module[_0x8da2('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 4b1aed6..cf5b5ea 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 _0x29b1=['name','sequelize','exports','STRING'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0x29b1,0x16d));var _0x129b=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x29b1[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x129b('0x0'));module[_0x129b('0x1')]={'name':{'type':Sequelize[_0x129b('0x2')],'unique':_0x129b('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x129b('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x129b('0x2')]}}; \ No newline at end of file +var _0x3308=['name','#0091EA','sequelize','exports','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x3308,0x160));var _0x8330=function(_0x4959a8,_0x40fc27){_0x4959a8=_0x4959a8-0x0;var _0x2454a4=_0x3308[_0x4959a8];return _0x2454a4;};'use strict';var Sequelize=require(_0x8330('0x0'));module[_0x8330('0x1')]={'name':{'type':Sequelize[_0x8330('0x2')],'unique':_0x8330('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8330('0x2')],'defaultValue':_0x8330('0x4')},'description':{'type':Sequelize[_0x8330('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3940069..df234ae 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 _0x9b9b=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','autoAssociation','error','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','type','key'];(function(_0x16d8db,_0x6a1999){var _0x51ca48=function(_0x412e25){while(--_0x412e25){_0x16d8db['push'](_0x16d8db['shift']());}};_0x51ca48(++_0x6a1999);}(_0x9b9b,0x114));var _0xb9b9=function(_0x7b544a,_0x33c45a){_0x7b544a=_0x7b544a-0x0;var _0x33dcb4=_0x9b9b[_0x7b544a];return _0x33dcb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x1'));var moment=require(_0xb9b9('0x2'));var BPromise=require(_0xb9b9('0x3'));var Mustache=require(_0xb9b9('0x4'));var util=require(_0xb9b9('0x5'));var path=require(_0xb9b9('0x6'));var sox=require(_0xb9b9('0x7'));var csv=require(_0xb9b9('0x8'));var ejs=require(_0xb9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xb9b9('0xa'));var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];function respondWithStatusCode(_0x26fa04,_0x230fea){_0x230fea=_0x230fea||0xcc;return function(_0x135cdc){if(_0x135cdc){return _0x26fa04['sendStatus'](_0x230fea);}return _0x26fa04['status'](_0x230fea)[_0xb9b9('0x19')]();};}function respondWithResult(_0x4ef543,_0xe78d58){_0xe78d58=_0xe78d58||0xc8;return function(_0x50e5d6){if(_0x50e5d6){return _0x4ef543[_0xb9b9('0x1a')](_0xe78d58)[_0xb9b9('0x1b')](_0x50e5d6);}};}function respondWithFilteredResult(_0x21fa2a,_0x29794c){return function(_0x177ad9){if(_0x177ad9){var _0x3fd09c=typeof _0x29794c[_0xb9b9('0x1c')]===_0xb9b9('0x1d')&&typeof _0x29794c['limit']===_0xb9b9('0x1d');var _0x48d9ae=_0x177ad9[_0xb9b9('0x1e')];var _0x3e6d23=_0x3fd09c?0x0:_0x29794c[_0xb9b9('0x1c')];var _0x11bb05=_0x3fd09c?_0x177ad9['count']:_0x29794c[_0xb9b9('0x1c')]+_0x29794c[_0xb9b9('0x1f')];var _0x398f3d;if(_0x11bb05>=_0x48d9ae){_0x11bb05=_0x48d9ae;_0x398f3d=0xc8;}else{_0x398f3d=0xce;}_0x21fa2a[_0xb9b9('0x1a')](_0x398f3d);return _0x21fa2a[_0xb9b9('0x20')](_0xb9b9('0x21'),_0x3e6d23+'-'+_0x11bb05+'/'+_0x48d9ae)[_0xb9b9('0x1b')](_0x177ad9);}return null;};}function patchUpdates(_0x3d0edb){return function(_0xb16391){try{jsonpatch[_0xb9b9('0x22')](_0xb16391,_0x3d0edb,!![]);}catch(_0xbf7c16){return BPromise[_0xb9b9('0x23')](_0xbf7c16);}return _0xb16391[_0xb9b9('0x24')]();};}function saveUpdates(_0x4e33a0,_0x10b7e1){return function(_0xe1e1d7){if(_0xe1e1d7){return _0xe1e1d7[_0xb9b9('0x25')](_0x4e33a0)['then'](function(_0x9898bc){return _0x9898bc;});}return null;};}function removeEntity(_0x46525d,_0x5efa01){return function(_0x18e2ca){if(_0x18e2ca){return _0x18e2ca[_0xb9b9('0x26')]()[_0xb9b9('0x27')](function(){var _0x40b801=_0x18e2ca[_0xb9b9('0x28')]({'plain':!![]});var _0x5299fb='Tags';return db[_0xb9b9('0x29')][_0xb9b9('0x26')]({'where':{'type':_0x5299fb,'resourceId':_0x40b801['id']}})['then'](function(){return _0x18e2ca;});})[_0xb9b9('0x27')](function(){_0x46525d[_0xb9b9('0x1a')](0xcc)[_0xb9b9('0x19')]();});}};}function handleEntityNotFound(_0x21f68f,_0x125f6c){return function(_0x54bf18){if(!_0x54bf18){_0x21f68f[_0xb9b9('0x2a')](0x194);}return _0x54bf18;};}function handleError(_0x554850,_0x1e0c5e){_0x1e0c5e=_0x1e0c5e||0x1f4;return function(_0xe28f3c){logger['error'](_0xe28f3c[_0xb9b9('0x2b')]);if(_0xe28f3c[_0xb9b9('0x2c')]){delete _0xe28f3c[_0xb9b9('0x2c')];}_0x554850['status'](_0x1e0c5e)[_0xb9b9('0x2d')](_0xe28f3c);};}exports[_0xb9b9('0x2e')]=function(_0x2e1d12,_0x300453){var _0x4f002a={},_0xc40dda={},_0xdbc1f1={'count':0x0,'rows':[]};var _0x49757e=_[_0xb9b9('0x2f')](db[_0xb9b9('0x30')][_0xb9b9('0x31')],function(_0xc47845){return{'name':_0xc47845['fieldName'],'type':_0xc47845[_0xb9b9('0x32')][_0xb9b9('0x33')]};});_0xc40dda[_0xb9b9('0x34')]=_[_0xb9b9('0x2f')](_0x49757e,'name');_0xc40dda[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0x2e1d12['query']);_0xc40dda[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0xc40dda[_0xb9b9('0x34')],_0xc40dda[_0xb9b9('0x35')]);_0x4f002a[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0xc40dda['model'],qs[_0xb9b9('0x3a')](_0x2e1d12[_0xb9b9('0x35')]['fields']));_0x4f002a[_0xb9b9('0x39')]=_0x4f002a[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x4f002a['attributes']:_0xc40dda[_0xb9b9('0x34')];if(!_0x2e1d12['query'][_0xb9b9('0x3c')]('nolimit')){_0x4f002a[_0xb9b9('0x1f')]=qs[_0xb9b9('0x1f')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x1f')]);_0x4f002a[_0xb9b9('0x1c')]=qs[_0xb9b9('0x1c')](_0x2e1d12[_0xb9b9('0x35')]['offset']);}_0x4f002a['order']=qs[_0xb9b9('0x3d')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3d')]);_0x4f002a['where']=qs[_0xb9b9('0x37')](_['pick'](_0x2e1d12[_0xb9b9('0x35')],_0xc40dda[_0xb9b9('0x37')]),_0x49757e);if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]){_0x4f002a[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x4f002a[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x2f')](_0x49757e,function(_0x496cf){if(_0x496cf[_0xb9b9('0x32')]!=='VIRTUAL'){var _0xf484fd={};_0xf484fd[_0x496cf[_0xb9b9('0x2c')]]={'$like':'%'+_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]+'%'};return _0xf484fd;}})});}_0x4f002a=_[_0xb9b9('0x40')]({},_0x4f002a,_0x2e1d12[_0xb9b9('0x41')]);var _0x36717c={'where':_0x4f002a[_0xb9b9('0x3f')]};return db[_0xb9b9('0x30')][_0xb9b9('0x1e')](_0x36717c)['then'](function(_0x357b9c){_0xdbc1f1[_0xb9b9('0x1e')]=_0x357b9c;if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x42')]){_0x4f002a['include']=[{'all':!![]}];}return db[_0xb9b9('0x30')]['findAll'](_0x4f002a);})['then'](function(_0x3e374e){_0xdbc1f1[_0xb9b9('0x43')]=_0x3e374e;return _0xdbc1f1;})['then'](respondWithFilteredResult(_0x300453,_0x4f002a))['catch'](handleError(_0x300453,null));};exports[_0xb9b9('0x44')]=function(_0x1a5888,_0x375543){var _0x3f4388={'raw':!![],'where':{'id':_0x1a5888[_0xb9b9('0x45')]['id']}},_0x493786={};_0x493786[_0xb9b9('0x34')]=_[_0xb9b9('0x36')](db['Tag']['rawAttributes']);_0x493786[_0xb9b9('0x35')]=_['keys'](_0x1a5888[_0xb9b9('0x35')]);_0x493786[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],_0x493786['query']);_0x3f4388[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],qs[_0xb9b9('0x3a')](_0x1a5888[_0xb9b9('0x35')][_0xb9b9('0x3a')]));_0x3f4388[_0xb9b9('0x39')]=_0x3f4388[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x3f4388[_0xb9b9('0x39')]:_0x493786[_0xb9b9('0x34')];if(_0x1a5888[_0xb9b9('0x35')]['includeAll']){_0x3f4388[_0xb9b9('0x46')]=[{'all':!![]}];}_0x3f4388=_['merge']({},_0x3f4388,_0x1a5888[_0xb9b9('0x41')]);return db[_0xb9b9('0x30')][_0xb9b9('0x47')](_0x3f4388)[_0xb9b9('0x27')](handleEntityNotFound(_0x375543,null))['then'](respondWithResult(_0x375543,null))[_0xb9b9('0x48')](handleError(_0x375543,null));};exports['create']=function(_0x2b3e22,_0x576c06){return db[_0xb9b9('0x30')][_0xb9b9('0x49')](_0x2b3e22[_0xb9b9('0x4a')],{})[_0xb9b9('0x27')](function(_0x25bfa1){var _0x1a406c=_0x2b3e22[_0xb9b9('0x4b')][_0xb9b9('0x28')]({'plain':!![]});if(!_0x1a406c)throw new Error(_0xb9b9('0x4c'));if(_0x1a406c['role']==='user'){var _0x4da7d8=_0x25bfa1[_0xb9b9('0x28')]({'plain':!![]});var _0x504c1d=_0xb9b9('0x4d');return db[_0xb9b9('0x4e')][_0xb9b9('0x47')]({'where':{'name':_0x504c1d,'userProfileId':_0x1a406c[_0xb9b9('0x4f')]},'raw':!![]})['then'](function(_0x39c444){if(_0x39c444&&_0x39c444[_0xb9b9('0x50')]===0x0){return db['UserProfileResource'][_0xb9b9('0x49')]({'name':_0x4da7d8[_0xb9b9('0x2c')],'resourceId':_0x4da7d8['id'],'type':_0x39c444['name'],'sectionId':_0x39c444['id']},{})['then'](function(){return _0x25bfa1;});}else{return _0x25bfa1;}})[_0xb9b9('0x48')](function(_0x2bbe9f){logger[_0xb9b9('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbe9f);throw _0x2bbe9f;});}return _0x25bfa1;})[_0xb9b9('0x27')](respondWithResult(_0x576c06,0xc9))[_0xb9b9('0x48')](handleError(_0x576c06,null));};exports['update']=function(_0x17b032,_0xb0b883){if(_0x17b032[_0xb9b9('0x4a')]['id']){delete _0x17b032[_0xb9b9('0x4a')]['id'];}return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x17b032[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0xb0b883,null))['then'](saveUpdates(_0x17b032[_0xb9b9('0x4a')],null))[_0xb9b9('0x27')](respondWithResult(_0xb0b883,null))[_0xb9b9('0x48')](handleError(_0xb0b883,null));};exports[_0xb9b9('0x26')]=function(_0x1e88f1,_0x49956d){return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x1e88f1[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0x49956d,null))[_0xb9b9('0x27')](removeEntity(_0x49956d,null))[_0xb9b9('0x48')](handleError(_0x49956d,null));}; \ No newline at end of file +var _0xad8a=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','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','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','map','Tag','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','fields','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x44caf4,_0x238750){var _0x117cad=function(_0x3e64c8){while(--_0x3e64c8){_0x44caf4['push'](_0x44caf4['shift']());}};_0x117cad(++_0x238750);}(_0xad8a,0xb0));var _0xaad8=function(_0x2bd6c4,_0x46e800){_0x2bd6c4=_0x2bd6c4-0x0;var _0x4ef8a5=_0xad8a[_0x2bd6c4];return _0x4ef8a5;};'use strict';var emlformat=require(_0xaad8('0x0'));var rimraf=require(_0xaad8('0x1'));var zipdir=require(_0xaad8('0x2'));var jsonpatch=require(_0xaad8('0x3'));var rp=require(_0xaad8('0x4'));var moment=require('moment');var BPromise=require(_0xaad8('0x5'));var Mustache=require(_0xaad8('0x6'));var util=require(_0xaad8('0x7'));var path=require('path');var sox=require(_0xaad8('0x8'));var csv=require(_0xaad8('0x9'));var ejs=require(_0xaad8('0xa'));var fs=require('fs');var fs_extra=require(_0xaad8('0xb'));var _=require(_0xaad8('0xc'));var squel=require(_0xaad8('0xd'));var crypto=require(_0xaad8('0xe'));var jsforce=require(_0xaad8('0xf'));var deskjs=require(_0xaad8('0x10'));var toCsv=require(_0xaad8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaad8('0x11'));var authService=require(_0xaad8('0x12'));var qs=require(_0xaad8('0x13'));var as=require(_0xaad8('0x14'));var hardwareService=require(_0xaad8('0x15'));var logger=require(_0xaad8('0x16'))(_0xaad8('0x17'));var utils=require(_0xaad8('0x18'));var config=require(_0xaad8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad8('0x1a'))['db'];function respondWithStatusCode(_0x2a13fb,_0xed6744){_0xed6744=_0xed6744||0xcc;return function(_0x456b77){if(_0x456b77){return _0x2a13fb[_0xaad8('0x1b')](_0xed6744);}return _0x2a13fb[_0xaad8('0x1c')](_0xed6744)[_0xaad8('0x1d')]();};}function respondWithResult(_0x357bf6,_0x1c70d3){_0x1c70d3=_0x1c70d3||0xc8;return function(_0x4372fc){if(_0x4372fc){return _0x357bf6[_0xaad8('0x1c')](_0x1c70d3)[_0xaad8('0x1e')](_0x4372fc);}};}function respondWithFilteredResult(_0x28bf95,_0x5e4fbb){return function(_0x334c4d){if(_0x334c4d){var _0xb63cb3=typeof _0x5e4fbb['offset']===_0xaad8('0x1f')&&typeof _0x5e4fbb[_0xaad8('0x20')]===_0xaad8('0x1f');var _0xc17ada=_0x334c4d[_0xaad8('0x21')];var _0x3895e2=_0xb63cb3?0x0:_0x5e4fbb['offset'];var _0xfd8b0a=_0xb63cb3?_0x334c4d[_0xaad8('0x21')]:_0x5e4fbb['offset']+_0x5e4fbb[_0xaad8('0x20')];var _0x4c681e;if(_0xfd8b0a>=_0xc17ada){_0xfd8b0a=_0xc17ada;_0x4c681e=0xc8;}else{_0x4c681e=0xce;}_0x28bf95[_0xaad8('0x1c')](_0x4c681e);return _0x28bf95[_0xaad8('0x22')](_0xaad8('0x23'),_0x3895e2+'-'+_0xfd8b0a+'/'+_0xc17ada)[_0xaad8('0x1e')](_0x334c4d);}return null;};}function patchUpdates(_0x5cb39b){return function(_0x18b856){try{jsonpatch[_0xaad8('0x24')](_0x18b856,_0x5cb39b,!![]);}catch(_0x594681){return BPromise[_0xaad8('0x25')](_0x594681);}return _0x18b856[_0xaad8('0x26')]();};}function saveUpdates(_0x262e57,_0x5b4b61){return function(_0x5ba0fb){if(_0x5ba0fb){return _0x5ba0fb[_0xaad8('0x27')](_0x262e57)[_0xaad8('0x28')](function(_0x3930f0){return _0x3930f0;});}return null;};}function removeEntity(_0x15e0c6,_0x29ba69){return function(_0x1daacf){if(_0x1daacf){return _0x1daacf[_0xaad8('0x29')]()[_0xaad8('0x28')](function(){var _0x477d29=_0x1daacf[_0xaad8('0x2a')]({'plain':!![]});var _0x1bbac4=_0xaad8('0x2b');return db[_0xaad8('0x2c')][_0xaad8('0x29')]({'where':{'type':_0x1bbac4,'resourceId':_0x477d29['id']}})[_0xaad8('0x28')](function(){return _0x1daacf;});})['then'](function(){_0x15e0c6[_0xaad8('0x1c')](0xcc)[_0xaad8('0x1d')]();});}};}function handleEntityNotFound(_0x3f066f,_0x47b7a2){return function(_0x237c67){if(!_0x237c67){_0x3f066f[_0xaad8('0x1b')](0x194);}return _0x237c67;};}function handleError(_0x36b180,_0x1ca776){_0x1ca776=_0x1ca776||0x1f4;return function(_0x24c01d){logger['error'](_0x24c01d[_0xaad8('0x2d')]);if(_0x24c01d[_0xaad8('0x2e')]){delete _0x24c01d[_0xaad8('0x2e')];}_0x36b180[_0xaad8('0x1c')](_0x1ca776)[_0xaad8('0x2f')](_0x24c01d);};}exports['index']=function(_0x78c862,_0x4030ea){var _0x20ea82={},_0x22f47a={},_0x47ffb7={'count':0x0,'rows':[]};var _0x30b0e2=_[_0xaad8('0x30')](db[_0xaad8('0x31')][_0xaad8('0x32')],function(_0x254ee5){return{'name':_0x254ee5['fieldName'],'type':_0x254ee5[_0xaad8('0x33')][_0xaad8('0x34')]};});_0x22f47a['model']=_['map'](_0x30b0e2,_0xaad8('0x2e'));_0x22f47a[_0xaad8('0x35')]=_[_0xaad8('0x36')](_0x78c862[_0xaad8('0x35')]);_0x22f47a['filters']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],_0x22f47a['query']);_0x20ea82['attributes']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],qs['fields'](_0x78c862[_0xaad8('0x35')]['fields']));_0x20ea82['attributes']=_0x20ea82[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x20ea82['attributes']:_0x22f47a[_0xaad8('0x38')];if(!_0x78c862[_0xaad8('0x35')][_0xaad8('0x3b')](_0xaad8('0x3c'))){_0x20ea82['limit']=qs[_0xaad8('0x20')](_0x78c862[_0xaad8('0x35')][_0xaad8('0x20')]);_0x20ea82[_0xaad8('0x3d')]=qs[_0xaad8('0x3d')](_0x78c862[_0xaad8('0x35')]['offset']);}_0x20ea82[_0xaad8('0x3e')]=qs[_0xaad8('0x3f')](_0x78c862[_0xaad8('0x35')]['sort']);_0x20ea82[_0xaad8('0x40')]=qs[_0xaad8('0x41')](_[_0xaad8('0x42')](_0x78c862[_0xaad8('0x35')],_0x22f47a[_0xaad8('0x41')]),_0x30b0e2);if(_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]){_0x20ea82['where']=_[_0xaad8('0x44')](_0x20ea82[_0xaad8('0x40')],{'$or':_[_0xaad8('0x30')](_0x30b0e2,function(_0x25c0a4){if(_0x25c0a4[_0xaad8('0x33')]!==_0xaad8('0x45')){var _0x4e4081={};_0x4e4081[_0x25c0a4[_0xaad8('0x2e')]]={'$like':'%'+_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]+'%'};return _0x4e4081;}})});}_0x20ea82=_[_0xaad8('0x44')]({},_0x20ea82,_0x78c862['options']);var _0x543761={'where':_0x20ea82['where']};return db[_0xaad8('0x31')][_0xaad8('0x21')](_0x543761)[_0xaad8('0x28')](function(_0x5bb668){_0x47ffb7[_0xaad8('0x21')]=_0x5bb668;if(_0x78c862[_0xaad8('0x35')]['includeAll']){_0x20ea82[_0xaad8('0x46')]=[{'all':!![]}];}return db[_0xaad8('0x31')][_0xaad8('0x47')](_0x20ea82);})[_0xaad8('0x28')](function(_0x3933ac){_0x47ffb7[_0xaad8('0x48')]=_0x3933ac;return _0x47ffb7;})[_0xaad8('0x28')](respondWithFilteredResult(_0x4030ea,_0x20ea82))[_0xaad8('0x49')](handleError(_0x4030ea,null));};exports[_0xaad8('0x4a')]=function(_0xbd5191,_0x29432a){var _0x241ceb={'raw':!![],'where':{'id':_0xbd5191['params']['id']}},_0x4b5b76={};_0x4b5b76['model']=_[_0xaad8('0x36')](db['Tag'][_0xaad8('0x32')]);_0x4b5b76['query']=_['keys'](_0xbd5191[_0xaad8('0x35')]);_0x4b5b76['filters']=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],_0x4b5b76[_0xaad8('0x35')]);_0x241ceb[_0xaad8('0x39')]=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],qs[_0xaad8('0x4b')](_0xbd5191[_0xaad8('0x35')][_0xaad8('0x4b')]));_0x241ceb[_0xaad8('0x39')]=_0x241ceb[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x241ceb[_0xaad8('0x39')]:_0x4b5b76[_0xaad8('0x38')];if(_0xbd5191[_0xaad8('0x35')]['includeAll']){_0x241ceb['include']=[{'all':!![]}];}_0x241ceb=_[_0xaad8('0x44')]({},_0x241ceb,_0xbd5191[_0xaad8('0x4c')]);return db[_0xaad8('0x31')]['find'](_0x241ceb)['then'](handleEntityNotFound(_0x29432a,null))[_0xaad8('0x28')](respondWithResult(_0x29432a,null))['catch'](handleError(_0x29432a,null));};exports[_0xaad8('0x4d')]=function(_0x1560ef,_0x313824){return db[_0xaad8('0x31')][_0xaad8('0x4d')](_0x1560ef[_0xaad8('0x4e')],{})[_0xaad8('0x28')](function(_0x23de0a){var _0xb19607=_0x1560ef['user'][_0xaad8('0x2a')]({'plain':!![]});if(!_0xb19607)throw new Error(_0xaad8('0x4f'));if(_0xb19607['role']===_0xaad8('0x50')){var _0x5e5ef1=_0x23de0a[_0xaad8('0x2a')]({'plain':!![]});var _0x15cb03=_0xaad8('0x2b');return db[_0xaad8('0x51')][_0xaad8('0x52')]({'where':{'name':_0x15cb03,'userProfileId':_0xb19607[_0xaad8('0x53')]},'raw':!![]})[_0xaad8('0x28')](function(_0x325a49){if(_0x325a49&&_0x325a49[_0xaad8('0x54')]===0x0){return db['UserProfileResource'][_0xaad8('0x4d')]({'name':_0x5e5ef1[_0xaad8('0x2e')],'resourceId':_0x5e5ef1['id'],'type':_0x325a49[_0xaad8('0x2e')],'sectionId':_0x325a49['id']},{})[_0xaad8('0x28')](function(){return _0x23de0a;});}else{return _0x23de0a;}})[_0xaad8('0x49')](function(_0x9bf893){logger['error'](_0xaad8('0x55'),_0x9bf893);throw _0x9bf893;});}return _0x23de0a;})[_0xaad8('0x28')](respondWithResult(_0x313824,0xc9))['catch'](handleError(_0x313824,null));};exports['update']=function(_0x33e743,_0x1202d4){if(_0x33e743[_0xaad8('0x4e')]['id']){delete _0x33e743[_0xaad8('0x4e')]['id'];}return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x33e743['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x1202d4,null))[_0xaad8('0x28')](saveUpdates(_0x33e743[_0xaad8('0x4e')],null))[_0xaad8('0x28')](respondWithResult(_0x1202d4,null))[_0xaad8('0x49')](handleError(_0x1202d4,null));};exports['destroy']=function(_0x5ddb77,_0x48edf6){return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x5ddb77['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x48edf6,null))[_0xaad8('0x28')](removeEntity(_0x48edf6,null))[_0xaad8('0x49')](handleError(_0x48edf6,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fb549a8..f9bcc5b 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 _0x12f1=['./tag.attributes','define','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x26f8b7,_0x48c4c0){var _0x213466=function(_0x3bf65c){while(--_0x3bf65c){_0x26f8b7['push'](_0x26f8b7['shift']());}};_0x213466(++_0x48c4c0);}(_0x12f1,0xf4));var _0x112f=function(_0x4259cd,_0x32ffd6){_0x4259cd=_0x4259cd-0x0;var _0x4f5230=_0x12f1[_0x4259cd];return _0x4f5230;};'use strict';var _=require(_0x112f('0x0'));var util=require('util');var logger=require(_0x112f('0x1'))(_0x112f('0x2'));var moment=require(_0x112f('0x3'));var BPromise=require(_0x112f('0x4'));var rp=require(_0x112f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x112f('0x6'));module['exports']=function(_0x21cccd,_0x2044f2){return _0x21cccd[_0x112f('0x7')](_0x112f('0x8'),attributes,{'tableName':_0x112f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca27=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','define','tools_tags'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xca27,0xbe));var _0x7ca2=function(_0x157c23,_0x4ac9b8){_0x157c23=_0x157c23-0x0;var _0x243ff8=_0xca27[_0x157c23];return _0x243ff8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ca2('0x0'))(_0x7ca2('0x1'));var moment=require(_0x7ca2('0x2'));var BPromise=require(_0x7ca2('0x3'));var rp=require(_0x7ca2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca2('0x5'));var config=require(_0x7ca2('0x6'));var attributes=require(_0x7ca2('0x7'));module['exports']=function(_0x17de9d,_0x22bc5c){return _0x17de9d[_0x7ca2('0x8')]('Tag',attributes,{'tableName':_0x7ca2('0x9'),'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 cf8f43c..46eb46b 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0xd25677,_0x34ad2d){var _0x5761e4=function(_0x192d3b){while(--_0x192d3b){_0xd25677['push'](_0xd25677['shift']());}};_0x5761e4(++_0x34ad2d);}(_0x81bd,0x7c));var _0xd81b=function(_0x54d2fb,_0x31fd9e){_0x54d2fb=_0x54d2fb-0x0;var _0x10cb87=_0x81bd[_0x54d2fb];return _0x10cb87;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('Tag,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('Tag,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0xc3b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x27de02,_0x580898){var _0x411734=function(_0x42f473){while(--_0x42f473){_0x27de02['push'](_0x27de02['shift']());}};_0x411734(++_0x580898);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x368614,_0xbd1d1b){_0x368614=_0x368614-0x0;var _0x3c753f=_0xc3b5[_0x368614];return _0x3c753f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c3b('0x0'));var BPromise=require(_0x5c3b('0x1'));var rs=require(_0x5c3b('0x2'));var fs=require('fs');var Redis=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];var utils=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c3b('0x8'));var client=jayson[_0x5c3b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x568a28,_0x30a08f,_0x420839){return new BPromise(function(_0x3892ad,_0x5be9ee){return client[_0x5c3b('0xa')](_0x568a28,_0x420839)[_0x5c3b('0xb')](function(_0x159db5){logger[_0x5c3b('0xc')]('Tag,\x20%s,\x20%s',_0x30a08f,_0x5c3b('0xd'));logger[_0x5c3b('0xe')](_0x5c3b('0xf'),_0x30a08f,_0x5c3b('0xd'),JSON[_0x5c3b('0x10')](_0x159db5));if(_0x159db5['error']){if(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x12')]===0x1f4){logger['error'](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')]['message']);return _0x5be9ee(_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);}logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x159db5[_0x5c3b('0x11')][_0x5c3b('0x14')]);return _0x3892ad(_0x159db5[_0x5c3b('0x11')]['message']);}else{logger[_0x5c3b('0xc')]('Tag,\x20%s,\x20%s',_0x30a08f,'request\x20sent');_0x3892ad(_0x159db5[_0x5c3b('0x15')][_0x5c3b('0x14')]);}})[_0x5c3b('0x16')](function(_0x589797){logger[_0x5c3b('0x11')](_0x5c3b('0x13'),_0x30a08f,_0x589797);_0x5be9ee(_0x589797);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f761b41..07ff3ce 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 e466b7f..85bffe9 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x4bc7c5,_0xb910e1){var _0x29885b=function(_0x557946){while(--_0x557946){_0x4bc7c5['push'](_0x4bc7c5['shift']());}};_0x29885b(++_0xb910e1);}(_0x2032,0xd9));var _0x2203=function(_0x22e529,_0x48fecb){_0x22e529=_0x22e529-0x0;var _0x3d52cb=_0x2032[_0x22e529];return _0x3d52cb;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x3f64a1,_0x44ab3c){var _0x503147=function(_0x34029d){while(--_0x34029d){_0x3f64a1['push'](_0x3f64a1['shift']());}};_0x503147(++_0x44ab3c);}(_0x757a,0xde));var _0xa757=function(_0x3d0469,_0x17aa0d){_0x3d0469=_0x3d0469-0x0;var _0x8bbb54=_0x757a[_0x3d0469];return _0x8bbb54;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3f84e6e..037342d 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 _0x5837=['send','channel','isValidChannel','ValidationError','capitalize','Queue','toLowerCase','addQueues','findOne','Unknown\x20channel','add','Queues','ids','remove','addAgents','isArray','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','defaults','User','findOrCreate','emit','online','interface','UserVoiceQueueRt','upsert','isNil','format','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','removeAgents','Chat','Mail','Queue:remove','QueueId','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5837,0x16a));var _0x7583=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0x5837[_0x112e2a];return _0x4f8af9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7583('0x0'));var zipdir=require(_0x7583('0x1'));var jsonpatch=require(_0x7583('0x2'));var rp=require('request-promise');var moment=require(_0x7583('0x3'));var BPromise=require(_0x7583('0x4'));var Mustache=require(_0x7583('0x5'));var util=require(_0x7583('0x6'));var path=require('path');var sox=require(_0x7583('0x7'));var csv=require('to-csv');var ejs=require(_0x7583('0x8'));var fs=require('fs');var fs_extra=require(_0x7583('0x9'));var _=require(_0x7583('0xa'));var squel=require(_0x7583('0xb'));var crypto=require(_0x7583('0xc'));var jsforce=require(_0x7583('0xd'));var deskjs=require(_0x7583('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7583('0xf'));var Papa=require(_0x7583('0x10'));var Redis=require('ioredis');var authService=require(_0x7583('0x11'));var qs=require(_0x7583('0x12'));var as=require(_0x7583('0x13'));var hardwareService=require(_0x7583('0x14'));var logger=require(_0x7583('0x15'))(_0x7583('0x16'));var utils=require('../../config/utils');var config=require(_0x7583('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7583('0x18'))['db'];config['redis']=_['defaults'](config[_0x7583('0x19')],{'host':_0x7583('0x1a'),'port':0x18eb});var socket=require(_0x7583('0x1b'))(new Redis(config[_0x7583('0x19')]));require(_0x7583('0x1c'))[_0x7583('0x1d')](socket);function respondWithStatusCode(_0x4c7773,_0x470558){_0x470558=_0x470558||0xcc;return function(_0x5234da){if(_0x5234da){return _0x4c7773[_0x7583('0x1e')](_0x470558);}return _0x4c7773['status'](_0x470558)[_0x7583('0x1f')]();};}function respondWithResult(_0x46f532,_0xa14b7c){_0xa14b7c=_0xa14b7c||0xc8;return function(_0x18fb09){if(_0x18fb09){return _0x46f532[_0x7583('0x20')](_0xa14b7c)[_0x7583('0x21')](_0x18fb09);}};}function respondWithFilteredResult(_0x4aa55c,_0x156091){return function(_0x3030ab){if(_0x3030ab){var _0x572a08=typeof _0x156091[_0x7583('0x22')]===_0x7583('0x23')&&typeof _0x156091[_0x7583('0x24')]===_0x7583('0x23');var _0x29ccd5=_0x3030ab['count'];var _0x504d63=_0x572a08?0x0:_0x156091[_0x7583('0x22')];var _0x486fe7=_0x572a08?_0x3030ab[_0x7583('0x25')]:_0x156091[_0x7583('0x22')]+_0x156091[_0x7583('0x24')];var _0x43f11a;if(_0x486fe7>=_0x29ccd5){_0x486fe7=_0x29ccd5;_0x43f11a=0xc8;}else{_0x43f11a=0xce;}_0x4aa55c[_0x7583('0x20')](_0x43f11a);return _0x4aa55c[_0x7583('0x26')](_0x7583('0x27'),_0x504d63+'-'+_0x486fe7+'/'+_0x29ccd5)[_0x7583('0x21')](_0x3030ab);}return null;};}function patchUpdates(_0x4ea0ab){return function(_0x5d4e6c){try{jsonpatch[_0x7583('0x28')](_0x5d4e6c,_0x4ea0ab,!![]);}catch(_0x419e98){return BPromise[_0x7583('0x29')](_0x419e98);}return _0x5d4e6c[_0x7583('0x2a')]();};}function saveUpdates(_0x357b2c,_0x3db017){return function(_0x5155f6){if(_0x5155f6){return _0x5155f6[_0x7583('0x2b')](_0x357b2c)[_0x7583('0x2c')](function(_0x4d59e5){return _0x4d59e5;});}return null;};}function handleEntityNotFound(_0x439a30,_0x14c4a5){return function(_0x471120){if(!_0x471120){_0x439a30[_0x7583('0x1e')](0x194);}return _0x471120;};}function handleError(_0x182524,_0x565211){_0x565211=_0x565211||0x1f4;return function(_0x2daac5){logger[_0x7583('0x2d')](_0x2daac5[_0x7583('0x2e')]);if(_0x2daac5[_0x7583('0x2f')]){delete _0x2daac5[_0x7583('0x2f')];}_0x182524[_0x7583('0x20')](_0x565211)['send'](_0x2daac5);};}exports[_0x7583('0x30')]=function(_0x4bc18f,_0x4a995e){var _0x184d07={},_0x14ffec={},_0x512e74={'count':0x0,'rows':[]};var _0xde7515=_[_0x7583('0x31')](db[_0x7583('0x32')][_0x7583('0x33')],function(_0x35eeb9){return{'name':_0x35eeb9[_0x7583('0x34')],'type':_0x35eeb9[_0x7583('0x35')][_0x7583('0x36')]};});_0x14ffec[_0x7583('0x37')]=_[_0x7583('0x31')](_0xde7515,_0x7583('0x2f'));_0x14ffec['query']=_[_0x7583('0x38')](_0x4bc18f[_0x7583('0x39')]);_0x14ffec[_0x7583('0x3a')]=_['intersection'](_0x14ffec[_0x7583('0x37')],_0x14ffec[_0x7583('0x39')]);_0x184d07[_0x7583('0x3b')]=_[_0x7583('0x3c')](_0x14ffec['model'],qs[_0x7583('0x3d')](_0x4bc18f['query'][_0x7583('0x3d')]));_0x184d07[_0x7583('0x3b')]=_0x184d07['attributes'][_0x7583('0x3e')]?_0x184d07[_0x7583('0x3b')]:_0x14ffec[_0x7583('0x37')];if(!_0x4bc18f['query']['hasOwnProperty'](_0x7583('0x3f'))){_0x184d07['limit']=qs[_0x7583('0x24')](_0x4bc18f[_0x7583('0x39')][_0x7583('0x24')]);_0x184d07[_0x7583('0x22')]=qs[_0x7583('0x22')](_0x4bc18f[_0x7583('0x39')][_0x7583('0x22')]);}_0x184d07[_0x7583('0x40')]=qs['sort'](_0x4bc18f[_0x7583('0x39')][_0x7583('0x41')]);_0x184d07[_0x7583('0x42')]=qs['filters'](_[_0x7583('0x43')](_0x4bc18f[_0x7583('0x39')],_0x14ffec['filters']),_0xde7515);if(_0x4bc18f['query'][_0x7583('0x44')]){_0x184d07[_0x7583('0x42')]=_['merge'](_0x184d07['where'],{'$or':_[_0x7583('0x31')](_0xde7515,function(_0x56a5bb){if(_0x56a5bb[_0x7583('0x35')]!=='VIRTUAL'){var _0x400105={};_0x400105[_0x56a5bb[_0x7583('0x2f')]]={'$like':'%'+_0x4bc18f[_0x7583('0x39')]['filter']+'%'};return _0x400105;}})});}_0x184d07=_[_0x7583('0x45')]({},_0x184d07,_0x4bc18f[_0x7583('0x46')]);var _0x22ca58={'where':_0x184d07[_0x7583('0x42')]};return db[_0x7583('0x32')][_0x7583('0x25')](_0x22ca58)[_0x7583('0x2c')](function(_0x8d593e){_0x512e74['count']=_0x8d593e;if(_0x4bc18f[_0x7583('0x39')]['includeAll']){_0x184d07[_0x7583('0x47')]=[{'all':!![]}];}return db[_0x7583('0x32')][_0x7583('0x48')](_0x184d07);})[_0x7583('0x2c')](function(_0x1fabda){_0x512e74[_0x7583('0x49')]=_0x1fabda;return _0x512e74;})[_0x7583('0x2c')](respondWithFilteredResult(_0x4a995e,_0x184d07))['catch'](handleError(_0x4a995e,null));};exports['show']=function(_0x4c68f8,_0x371016){var _0x20fa51={'raw':![],'where':{'id':_0x4c68f8[_0x7583('0x4a')]['id']}},_0x469954={};_0x469954[_0x7583('0x37')]=_[_0x7583('0x38')](db['Team'][_0x7583('0x33')]);_0x469954[_0x7583('0x39')]=_[_0x7583('0x38')](_0x4c68f8['query']);_0x469954['filters']=_[_0x7583('0x3c')](_0x469954['model'],_0x469954[_0x7583('0x39')]);_0x20fa51[_0x7583('0x3b')]=_[_0x7583('0x3c')](_0x469954[_0x7583('0x37')],qs[_0x7583('0x3d')](_0x4c68f8[_0x7583('0x39')][_0x7583('0x3d')]));_0x20fa51[_0x7583('0x3b')]=_0x20fa51[_0x7583('0x3b')]['length']?_0x20fa51['attributes']:_0x469954[_0x7583('0x37')];if(_0x4c68f8[_0x7583('0x39')][_0x7583('0x4b')]){_0x20fa51[_0x7583('0x47')]=[{'all':!![]}];}_0x20fa51=_[_0x7583('0x45')]({},_0x20fa51,_0x4c68f8[_0x7583('0x46')]);return db['Team']['find'](_0x20fa51)[_0x7583('0x2c')](handleEntityNotFound(_0x371016,null))[_0x7583('0x2c')](respondWithResult(_0x371016,null))['catch'](handleError(_0x371016,null));};exports[_0x7583('0x4c')]=function(_0x572d17,_0x1301d3){return db[_0x7583('0x32')][_0x7583('0x4c')](_0x572d17[_0x7583('0x4d')],{})['then'](function(_0x2c4447){var _0x571fe6=_0x572d17[_0x7583('0x4e')]['get']({'plain':!![]});if(!_0x571fe6)throw new Error(_0x7583('0x4f'));if(_0x571fe6['role']===_0x7583('0x4e')){var _0x2ff788=_0x2c4447[_0x7583('0x50')]({'plain':!![]});var _0x205312=_0x7583('0x51');return db[_0x7583('0x52')][_0x7583('0x53')]({'where':{'name':_0x205312,'userProfileId':_0x571fe6['userProfileId']},'raw':!![]})[_0x7583('0x2c')](function(_0x3dcefc){if(_0x3dcefc&&_0x3dcefc[_0x7583('0x54')]===0x0){return db[_0x7583('0x55')][_0x7583('0x4c')]({'name':_0x2ff788['name'],'resourceId':_0x2ff788['id'],'type':_0x3dcefc['name'],'sectionId':_0x3dcefc['id']},{})['then'](function(){return _0x2c4447;});}else{return _0x2c4447;}})[_0x7583('0x56')](function(_0x4612e5){logger[_0x7583('0x2d')](_0x7583('0x57'),_0x4612e5);throw _0x4612e5;});}return _0x2c4447;})[_0x7583('0x2c')](respondWithResult(_0x1301d3,0xc9))[_0x7583('0x56')](handleError(_0x1301d3,null));};exports['update']=function(_0x3e1602,_0x592abe){if(_0x3e1602['body']['id']){delete _0x3e1602[_0x7583('0x4d')]['id'];}return db[_0x7583('0x32')]['find']({'where':{'id':_0x3e1602[_0x7583('0x4a')]['id']}})[_0x7583('0x2c')](handleEntityNotFound(_0x592abe,null))['then'](saveUpdates(_0x3e1602[_0x7583('0x4d')],null))[_0x7583('0x2c')](respondWithResult(_0x592abe,null))['catch'](handleError(_0x592abe,null));};exports[_0x7583('0x58')]=function(_0x3d0370,_0x215fa5){var _0x433130=_0x3d0370[_0x7583('0x4a')]['id'];var _0x1c3ed0=[];return db[_0x7583('0x59')][_0x7583('0x5a')](function(_0x1833b1){var _0x582d00=_0x7583('0x5b')+_0x433130;return db['sequelize']['query'](_0x582d00,{'type':db[_0x7583('0x5c')][_0x7583('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1833b1})[_0x7583('0x2c')](function(_0x4107e9){_0x1c3ed0=_[_0x7583('0x31')](_0x4107e9,function(_0x3214ca){return Number(_0x3214ca['UserId']);});})[_0x7583('0x2c')](function(){var _0x243abb=_0x7583('0x5e')+_0x433130;return db['sequelize']['query'](_0x243abb,{'type':db[_0x7583('0x5c')][_0x7583('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x3aa472){var _0x17b852=_[_0x7583('0x31')](_0x3aa472,function(_0x2e6946){return Number(_0x2e6946[_0x7583('0x5f')]);});return db[_0x7583('0x60')]['destroy']({'where':{'UserId':{'$in':_0x1c3ed0},'VoiceQueueId':{'$in':_0x17b852}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){var _0x24353c=_0x7583('0x61')+_0x433130;return db['sequelize'][_0x7583('0x39')](_0x24353c,{'type':db[_0x7583('0x5c')][_0x7583('0x5d')][_0x7583('0x62')],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x45d78f){var _0x466e59=_[_0x7583('0x31')](_0x45d78f,function(_0x2bf146){return Number(_0x2bf146[_0x7583('0x63')]);});return db[_0x7583('0x64')][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'MailQueueId':{'$in':_0x466e59}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){var _0x1a0c1e='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x433130;return db['sequelize']['query'](_0x1a0c1e,{'type':db[_0x7583('0x5c')]['QueryTypes'][_0x7583('0x62')],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x4dad6b){var _0x53a217=_[_0x7583('0x31')](_0x4dad6b,function(_0x27b6da){return Number(_0x27b6da['SmsQueueId']);});return db[_0x7583('0x65')][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'SmsQueueId':{'$in':_0x53a217}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){var _0x3a4986=_0x7583('0x66')+_0x433130;return db[_0x7583('0x59')][_0x7583('0x39')](_0x3a4986,{'type':db[_0x7583('0x5c')][_0x7583('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x578dd1){var _0x1dc4ac=_[_0x7583('0x31')](_0x578dd1,function(_0x5389ab){return Number(_0x5389ab[_0x7583('0x67')]);});return db[_0x7583('0x68')][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'ChatQueueId':{'$in':_0x1dc4ac}},'transaction':_0x1833b1});})['then'](function(){var _0x5eaf5a=_0x7583('0x69')+_0x433130;return db[_0x7583('0x59')][_0x7583('0x39')](_0x5eaf5a,{'type':db['Sequelize'][_0x7583('0x5d')][_0x7583('0x62')],'raw':!![],'transaction':_0x1833b1});})['then'](function(_0x20be3f){var _0x30fe0c=_[_0x7583('0x31')](_0x20be3f,function(_0x1d1af5){return Number(_0x1d1af5[_0x7583('0x6a')]);});return db['UserFaxQueue'][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'FaxQueueId':{'$in':_0x30fe0c}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){var _0x485cb8=_0x7583('0x6b')+_0x433130;return db[_0x7583('0x59')][_0x7583('0x39')](_0x485cb8,{'type':db[_0x7583('0x5c')][_0x7583('0x5d')][_0x7583('0x62')],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x43c3db){var _0x29fbd0=_[_0x7583('0x31')](_0x43c3db,function(_0x58479d){return Number(_0x58479d[_0x7583('0x6c')]);});return db[_0x7583('0x6d')][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'OpenchannelQueueId':{'$in':_0x29fbd0}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){var _0x1a97fb=_0x7583('0x6e')+_0x433130;return db[_0x7583('0x59')][_0x7583('0x39')](_0x1a97fb,{'type':db['Sequelize'][_0x7583('0x5d')][_0x7583('0x62')],'raw':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0x436f2c){var _0x5690a0=_['map'](_0x436f2c,function(_0x10f83b){return Number(_0x10f83b[_0x7583('0x6f')]);});return db[_0x7583('0x70')][_0x7583('0x58')]({'where':{'UserId':{'$in':_0x1c3ed0},'WhatsappQueueId':{'$in':_0x5690a0}},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x433130}});})[_0x7583('0x2c')](function(_0x77ddd3){if(_0x77ddd3===null){return;}return db[_0x7583('0x71')]['destroy']({'where':{'UserId':{'$in':_0x1c3ed0},'VoicePrefixId':_0x77ddd3[_0x7583('0x72')]},'transaction':_0x1833b1});})[_0x7583('0x2c')](function(){return db[_0x7583('0x32')][_0x7583('0x58')]({'where':{'id':_0x433130},'cascade':!![],'transaction':_0x1833b1});})[_0x7583('0x2c')](function(_0xe4c685){if(_0xe4c685===0x0){_0x215fa5[_0x7583('0x1e')](0x194);}else{return db[_0x7583('0x55')]['destroy']({'where':{'type':_0x7583('0x51'),'resourceId':_0x433130},'cascade':!![],'transaction':_0x1833b1})[_0x7583('0x2c')](function(){_0x215fa5[_0x7583('0x20')](0xcc)[_0x7583('0x1f')]();});}})['catch'](function(_0x37677d){_0x215fa5[_0x7583('0x20')](0x1f4)[_0x7583('0x73')](_0x37677d);});});};exports['getQueues']=function(_0x2d36ed,_0x2f747f,_0x111992){return db[_0x7583('0x32')]['findOne']({'where':{'id':_0x2d36ed[_0x7583('0x4a')]['id']}})[_0x7583('0x2c')](handleEntityNotFound(_0x2f747f,null))[_0x7583('0x2c')](function(_0x1195dc){if(!_0x2d36ed['query'][_0x7583('0x74')]||!utils[_0x7583('0x75')](_0x2d36ed[_0x7583('0x39')][_0x7583('0x74')])){throw new db[(_0x7583('0x5c'))][(_0x7583('0x76'))]('Unknown\x20channel');}var _0x35ec4e={};var _0x3bdb9c={};_0x3bdb9c['model']=_['keys'](db[_[_0x7583('0x77')](_0x2d36ed[_0x7583('0x39')]['channel']['toLowerCase']())+_0x7583('0x78')][_0x7583('0x33')]);_0x3bdb9c[_0x7583('0x39')]=_[_0x7583('0x38')](_0x2d36ed[_0x7583('0x39')]);_0x3bdb9c['filters']=_[_0x7583('0x3c')](_0x3bdb9c['model'],_0x3bdb9c[_0x7583('0x39')]);_0x35ec4e[_0x7583('0x3b')]=_[_0x7583('0x3c')](_0x3bdb9c[_0x7583('0x37')],qs[_0x7583('0x3d')](_0x2d36ed[_0x7583('0x39')]['fields']));_0x35ec4e[_0x7583('0x3b')]=_0x35ec4e[_0x7583('0x3b')]['length']?_0x35ec4e['attributes']:_0x3bdb9c[_0x7583('0x37')];_0x35ec4e[_0x7583('0x24')]=qs[_0x7583('0x24')](_0x2d36ed['query'][_0x7583('0x24')]);_0x35ec4e[_0x7583('0x22')]=qs[_0x7583('0x22')](_0x2d36ed[_0x7583('0x39')][_0x7583('0x22')]);_0x35ec4e['order']=qs[_0x7583('0x41')](_0x2d36ed[_0x7583('0x39')][_0x7583('0x41')]);_0x35ec4e[_0x7583('0x42')]=qs[_0x7583('0x3a')](_[_0x7583('0x43')](_0x2d36ed[_0x7583('0x39')],_0x3bdb9c['filters']));_0x35ec4e=_[_0x7583('0x45')]({},_0x35ec4e,_0x2d36ed[_0x7583('0x46')]);return _0x1195dc[_0x7583('0x50')+_[_0x7583('0x77')](_0x2d36ed[_0x7583('0x39')][_0x7583('0x74')][_0x7583('0x79')]())+'Queues'](_0x35ec4e);})['then'](respondWithResult(_0x2f747f,null))[_0x7583('0x56')](handleError(_0x2f747f,null));};exports[_0x7583('0x7a')]=function(_0x3f9713,_0x450e50,_0x1ee8dd){return db[_0x7583('0x32')][_0x7583('0x7b')]({'where':{'id':_0x3f9713[_0x7583('0x4a')]['id']}})[_0x7583('0x2c')](function(_0x6389c7){if(_0x6389c7){if(!_0x3f9713[_0x7583('0x4d')][_0x7583('0x74')]||!utils[_0x7583('0x75')](_0x3f9713[_0x7583('0x4d')][_0x7583('0x74')])){throw new db['Sequelize']['ValidationError'](_0x7583('0x7c'));}return _0x6389c7[_0x7583('0x7d')+_[_0x7583('0x77')](_0x3f9713['body'][_0x7583('0x74')][_0x7583('0x79')]())+_0x7583('0x7e')](_0x3f9713[_0x7583('0x4d')][_0x7583('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x450e50,null))[_0x7583('0x2c')](respondWithStatusCode(_0x450e50,null))['catch'](handleError(_0x450e50,null));};exports['removeQueues']=function(_0x1d548d,_0x1c7279,_0x3ff915){return db[_0x7583('0x32')][_0x7583('0x7b')]({'where':{'id':_0x1d548d[_0x7583('0x4a')]['id']}})[_0x7583('0x2c')](function(_0x27c8fa){if(_0x27c8fa){if(!_0x1d548d[_0x7583('0x39')][_0x7583('0x74')]||!utils[_0x7583('0x75')](_0x1d548d[_0x7583('0x39')][_0x7583('0x74')])){throw new db[(_0x7583('0x5c'))][(_0x7583('0x76'))](_0x7583('0x7c'));}return _0x27c8fa[_0x7583('0x80')+_[_0x7583('0x77')](_0x1d548d[_0x7583('0x39')][_0x7583('0x74')]['toLowerCase']())+_0x7583('0x7e')](_0x1d548d[_0x7583('0x39')][_0x7583('0x7f')]);}return null;})[_0x7583('0x2c')](handleEntityNotFound(_0x1c7279,null))[_0x7583('0x2c')](respondWithStatusCode(_0x1c7279,null))[_0x7583('0x56')](handleError(_0x1c7279,null));};exports[_0x7583('0x81')]=function(_0xcfaea2,_0x57b5f1){var _0x13379f=_[_0x7583('0x82')](_0xcfaea2[_0x7583('0x4d')][_0x7583('0x7f')])?_0xcfaea2['body'][_0x7583('0x7f')]:[_0xcfaea2[_0x7583('0x4d')][_0x7583('0x7f')]];var _0x2d4ef0=_0xcfaea2[_0x7583('0x4a')]['id'];return db[_0x7583('0x32')]['find']({'where':{'id':_0x2d4ef0}})[_0x7583('0x2c')](handleEntityNotFound(_0x57b5f1,null))[_0x7583('0x2c')](function(_0xa96f63){if(_0xa96f63){var _0x208bc9=['Voice','Chat','Mail',_0x7583('0x83'),_0x7583('0x84'),_0x7583('0x85'),_0x7583('0x86')];return db[_0x7583('0x59')]['transaction'](function(_0x4a0d44){var _0x387bf8=_[_0x7583('0x31')](_0x208bc9,function(_0x27ce87){var _0x3e128d={'attributes':['id','name']};if(_0x27ce87===_0x7583('0x87')){_0x3e128d[_0x7583('0x88')]={'attributes':[_0x7583('0x89')]};}return _0xa96f63['get'+_0x27ce87+_0x7583('0x7e')](_0x3e128d)[_0x7583('0x2c')](function(_0x5e8aca){var _0x49ea47=_[_0x7583('0x31')](_0x5e8aca,function(_0x222ff4){var _0xde9994=_['map'](_0x13379f,function(_0x4e05c0){var _0x59e9a8={'where':{'UserId':_0x4e05c0,[_0x27ce87+'QueueId']:_0x222ff4['id']},'transaction':_0x4a0d44};if(_0x27ce87===_0x7583('0x87')){_0x59e9a8[_0x7583('0x8a')]={'penalty':_0x222ff4['TeamVoiceQueue']['penalty']};}return db[_0x7583('0x8b')+_0x27ce87+_0x7583('0x78')][_0x7583('0x8c')](_0x59e9a8)[_0x7583('0x2c')](function(){socket[_0x7583('0x8d')](_0x7583('0x4e')+_0x27ce87+'Queue:save',{'UserId':_0x4e05c0,[_0x27ce87+'QueueId']:_0x222ff4['id']});if(_0x27ce87!==_0x7583('0x87')){return;}return db[_0x7583('0x8b')][_0x7583('0x48')]({'where':{'id':_0x13379f,'online':0x1},'attributes':['id',_0x7583('0x2f'),_0x7583('0x8e'),'voicePause',_0x7583('0x8f')],'raw':!![]})['then'](function(_0x4fd991){var _0x19aef4=_[_0x7583('0x31')](_0x4fd991,function(_0x338c36){return db[_0x7583('0x90')][_0x7583('0x91')]({'membername':_0x338c36['name'],'UserId':_0x338c36['id'],'queue_name':_0x222ff4[_0x7583('0x2f')],'VoiceQueueId':_0x222ff4['id'],'interface':_[_0x7583('0x92')](_0x338c36[_0x7583('0x8f')])?util[_0x7583('0x93')]('SIP/%s',_0x338c36[_0x7583('0x2f')]):_0x338c36[_0x7583('0x8f')],'paused':_0x338c36[_0x7583('0x94')]||![],'penalty':_0x222ff4[_0x7583('0x95')][_0x7583('0x89')]},{'transaction':_0x4a0d44});});return Promise[_0x7583('0x96')](_0x19aef4);});});});return Promise[_0x7583('0x96')](_0xde9994);});return Promise[_0x7583('0x96')](_0x49ea47);})[_0x7583('0x2c')](function(){return db[_0x7583('0x97')][_0x7583('0x7b')]({'where':{'teamId':_0x2d4ef0}})[_0x7583('0x2c')](function(_0x6fa95f){if(_0x6fa95f){var _0x53b0ea=_[_0x7583('0x31')](_0x13379f,function(_0x3ac20d){db[_0x7583('0x71')][_0x7583('0x91')]({'UserId':_0x3ac20d,'VoicePrefixId':_0x6fa95f[_0x7583('0x72')]});});return Promise[_0x7583('0x96')](_0x53b0ea);}});});});return Promise[_0x7583('0x96')](_0x387bf8)[_0x7583('0x2c')](function(){return _0xa96f63[_0x7583('0x81')](_0x13379f,{'transaction':_0x4a0d44})['spread'](function(_0x390970){return _0x390970;});});});}})[_0x7583('0x2c')](respondWithResult(_0x57b5f1,null))[_0x7583('0x56')](handleError(_0x57b5f1,null));};exports[_0x7583('0x98')]=function(_0x1d6ab8,_0x1aed7d){var _0x34ac2a=_[_0x7583('0x82')](_0x1d6ab8[_0x7583('0x39')][_0x7583('0x7f')])?_0x1d6ab8[_0x7583('0x39')][_0x7583('0x7f')]:[_0x1d6ab8['query']['ids']];var _0x36e9b6=_0x1d6ab8['params']['id'];return db[_0x7583('0x32')][_0x7583('0x53')]({'where':{'id':_0x36e9b6}})['then'](handleEntityNotFound(_0x1aed7d,null))['then'](function(_0x3ec057){if(_0x3ec057){var _0x4c6f7e=[_0x7583('0x87'),_0x7583('0x99'),_0x7583('0x9a'),_0x7583('0x83'),_0x7583('0x84'),_0x7583('0x85'),_0x7583('0x86')];return db[_0x7583('0x59')][_0x7583('0x5a')](function(_0x1e3faf){var _0x8e02a7=_['map'](_0x4c6f7e,function(_0x3710cb){var _0x15ab8f={'attributes':['id',_0x7583('0x2f')]};return _0x3ec057[_0x7583('0x50')+_0x3710cb+_0x7583('0x7e')](_0x15ab8f)['then'](function(_0x4c9b29){var _0x5d847f=_[_0x7583('0x31')](_0x4c9b29,function(_0x510f76){return _0x510f76['removeAgents'](_0x34ac2a,{'transaction':_0x1e3faf})['then'](function(){var _0x7bcf4=_[_0x7583('0x31')](_0x34ac2a,function(_0x107ae4){socket[_0x7583('0x8d')](_0x7583('0x4e')+_0x3710cb+_0x7583('0x9b'),{'UserId':Number(_0x107ae4),[_0x3710cb+_0x7583('0x9c')]:_0x510f76['id']});if(_0x3710cb!==_0x7583('0x87')){return;}return db[_0x7583('0x90')][_0x7583('0x58')]({'where':{'VoiceQueueId':_0x510f76['id'],'UserId':_0x107ae4},'transaction':_0x1e3faf});});return Promise[_0x7583('0x96')](_0x7bcf4);});});return Promise[_0x7583('0x96')](_0x5d847f);});});return Promise['all'](_0x8e02a7)[_0x7583('0x2c')](function(){return _0x3ec057[_0x7583('0x98')](_0x34ac2a,{'transaction':_0x1e3faf});})[_0x7583('0x2c')](function(){return db['TeamVoicePrefix'][_0x7583('0x7b')]({'where':{'teamId':_0x36e9b6}})[_0x7583('0x2c')](function(_0x341dbb){if(_0x341dbb){var _0x318fde=_[_0x7583('0x31')](_0x34ac2a,function(_0x3811ce){db[_0x7583('0x71')][_0x7583('0x58')]({'where':{'UserId':_0x3811ce,'VoicePrefixId':_0x341dbb['VoicePrefixId']}});});return Promise[_0x7583('0x96')](_0x318fde);}});});});}})[_0x7583('0x2c')](respondWithStatusCode(_0x1aed7d,null))['catch'](handleError(_0x1aed7d,null));};exports[_0x7583('0x9d')]=function(_0x214a62,_0x10ce4e,_0x19a59e){var _0x1c57db={};var _0x2e8058={};var _0x59f308;var _0x1dde9e;return db['Team'][_0x7583('0x7b')]({'where':{'id':_0x214a62[_0x7583('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10ce4e,null))['then'](function(_0x22327d){if(_0x22327d){_0x59f308=_0x22327d;_0x2e8058['model']=_['keys'](db[_0x7583('0x8b')][_0x7583('0x33')]);_0x2e8058[_0x7583('0x39')]=_[_0x7583('0x38')](_0x214a62['query']);_0x2e8058['filters']=_[_0x7583('0x3c')](_0x2e8058['model'],_0x2e8058[_0x7583('0x39')]);_0x1c57db[_0x7583('0x3b')]=_[_0x7583('0x3c')](_0x2e8058['model'],qs['fields'](_0x214a62[_0x7583('0x39')][_0x7583('0x3d')]));_0x1c57db[_0x7583('0x3b')]=_0x1c57db[_0x7583('0x3b')][_0x7583('0x3e')]?_0x1c57db['attributes']:_0x2e8058[_0x7583('0x37')];_0x1c57db['order']=qs[_0x7583('0x41')](_0x214a62[_0x7583('0x39')][_0x7583('0x41')]);_0x1c57db[_0x7583('0x42')]=qs[_0x7583('0x3a')](_[_0x7583('0x43')](_0x214a62[_0x7583('0x39')],_0x2e8058[_0x7583('0x3a')]));if(_0x214a62[_0x7583('0x39')][_0x7583('0x44')]){_0x1c57db['where']=_[_0x7583('0x45')](_0x1c57db[_0x7583('0x42')],{'$or':_[_0x7583('0x31')](_0x1c57db[_0x7583('0x3b')],function(_0x4a67e1){var _0x310f5e={};_0x310f5e[_0x4a67e1]={'$like':'%'+_0x214a62[_0x7583('0x39')]['filter']+'%'};return _0x310f5e;})});}_0x1c57db=_['merge']({},_0x1c57db,_0x214a62['options']);return _0x59f308[_0x7583('0x9d')](_0x1c57db);}})['then'](function(_0x550bbc){if(_0x550bbc){_0x1dde9e=_0x550bbc[_0x7583('0x3e')];if(!_0x214a62[_0x7583('0x39')][_0x7583('0x9e')]('nolimit')){_0x1c57db['limit']=qs[_0x7583('0x24')](_0x214a62[_0x7583('0x39')][_0x7583('0x24')]);_0x1c57db['offset']=qs[_0x7583('0x22')](_0x214a62[_0x7583('0x39')][_0x7583('0x22')]);}return _0x59f308[_0x7583('0x9d')](_0x1c57db);}})['then'](function(_0xcb4767){if(_0xcb4767){return _0xcb4767?{'count':_0x1dde9e,'rows':_0xcb4767}:null;}})['then'](respondWithResult(_0x10ce4e,null))[_0x7583('0x56')](handleError(_0x10ce4e,null));}; \ No newline at end of file +var _0x590c=['Unknown\x20channel','capitalize','toLowerCase','Queue','get','Queues','addQueues','ValidationError','ids','remove','addAgents','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','QueueId','TeamVoiceQueue','penalty','User','Queue:save','online','voicePause','upsert','format','SIP/%s','interface','all','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','order','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','reject','error','stack','name','send','map','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','Team','count','then','includeAll','include','findAll','catch','show','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','destroy','params','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','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','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel'];(function(_0x5520c7,_0xbee449){var _0x3b0590=function(_0x1bb4f9){while(--_0x1bb4f9){_0x5520c7['push'](_0x5520c7['shift']());}};_0x3b0590(++_0xbee449);}(_0x590c,0x150));var _0xc590=function(_0x5be571,_0x46766a){_0x5be571=_0x5be571-0x0;var _0x4ac06c=_0x590c[_0x5be571];return _0x4ac06c;};'use strict';var emlformat=require(_0xc590('0x0'));var rimraf=require(_0xc590('0x1'));var zipdir=require(_0xc590('0x2'));var jsonpatch=require(_0xc590('0x3'));var rp=require(_0xc590('0x4'));var moment=require(_0xc590('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc590('0x6'));var util=require(_0xc590('0x7'));var path=require(_0xc590('0x8'));var sox=require(_0xc590('0x9'));var csv=require(_0xc590('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc590('0xb'));var _=require(_0xc590('0xc'));var squel=require(_0xc590('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc590('0xe'));var toCsv=require(_0xc590('0xa'));var querystring=require(_0xc590('0xf'));var Papa=require(_0xc590('0x10'));var Redis=require('ioredis');var authService=require(_0xc590('0x11'));var qs=require(_0xc590('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc590('0x13'))(_0xc590('0x14'));var utils=require(_0xc590('0x15'));var config=require(_0xc590('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc590('0x17'))['db'];config[_0xc590('0x18')]=_[_0xc590('0x19')](config[_0xc590('0x18')],{'host':_0xc590('0x1a'),'port':0x18eb});var socket=require(_0xc590('0x1b'))(new Redis(config[_0xc590('0x18')]));require(_0xc590('0x1c'))[_0xc590('0x1d')](socket);function respondWithStatusCode(_0x19965d,_0x59f4e7){_0x59f4e7=_0x59f4e7||0xcc;return function(_0x1fa9ca){if(_0x1fa9ca){return _0x19965d[_0xc590('0x1e')](_0x59f4e7);}return _0x19965d[_0xc590('0x1f')](_0x59f4e7)[_0xc590('0x20')]();};}function respondWithResult(_0x46544a,_0x336388){_0x336388=_0x336388||0xc8;return function(_0x50330e){if(_0x50330e){return _0x46544a['status'](_0x336388)['json'](_0x50330e);}};}function respondWithFilteredResult(_0x1d62c1,_0x3d0e04){return function(_0x7a779d){if(_0x7a779d){var _0x31daed=typeof _0x3d0e04['offset']==='undefined'&&typeof _0x3d0e04['limit']==='undefined';var _0x2381a3=_0x7a779d['count'];var _0x361d33=_0x31daed?0x0:_0x3d0e04[_0xc590('0x21')];var _0x3ce62c=_0x31daed?_0x7a779d['count']:_0x3d0e04[_0xc590('0x21')]+_0x3d0e04[_0xc590('0x22')];var _0x5516ae;if(_0x3ce62c>=_0x2381a3){_0x3ce62c=_0x2381a3;_0x5516ae=0xc8;}else{_0x5516ae=0xce;}_0x1d62c1[_0xc590('0x1f')](_0x5516ae);return _0x1d62c1['set'](_0xc590('0x23'),_0x361d33+'-'+_0x3ce62c+'/'+_0x2381a3)[_0xc590('0x24')](_0x7a779d);}return null;};}function patchUpdates(_0x5c5919){return function(_0x12c5eb){try{jsonpatch['apply'](_0x12c5eb,_0x5c5919,!![]);}catch(_0x571d5b){return BPromise[_0xc590('0x25')](_0x571d5b);}return _0x12c5eb['save']();};}function saveUpdates(_0x3fa9e8,_0x8a1124){return function(_0x1060b7){if(_0x1060b7){return _0x1060b7['update'](_0x3fa9e8)['then'](function(_0x1e3c2a){return _0x1e3c2a;});}return null;};}function handleEntityNotFound(_0x50ba8f,_0x391f42){return function(_0x27981c){if(!_0x27981c){_0x50ba8f['sendStatus'](0x194);}return _0x27981c;};}function handleError(_0x5720ee,_0x4bf73f){_0x4bf73f=_0x4bf73f||0x1f4;return function(_0x281851){logger[_0xc590('0x26')](_0x281851[_0xc590('0x27')]);if(_0x281851[_0xc590('0x28')]){delete _0x281851[_0xc590('0x28')];}_0x5720ee[_0xc590('0x1f')](_0x4bf73f)[_0xc590('0x29')](_0x281851);};}exports['index']=function(_0x557aea,_0x566f77){var _0x51dacf={},_0x7fc26c={},_0x2aee4c={'count':0x0,'rows':[]};var _0x224180=_[_0xc590('0x2a')](db['Team']['rawAttributes'],function(_0x4704ad){return{'name':_0x4704ad[_0xc590('0x2b')],'type':_0x4704ad[_0xc590('0x2c')][_0xc590('0x2d')]};});_0x7fc26c['model']=_[_0xc590('0x2a')](_0x224180,_0xc590('0x28'));_0x7fc26c[_0xc590('0x2e')]=_['keys'](_0x557aea[_0xc590('0x2e')]);_0x7fc26c['filters']=_[_0xc590('0x2f')](_0x7fc26c[_0xc590('0x30')],_0x7fc26c['query']);_0x51dacf[_0xc590('0x31')]=_[_0xc590('0x2f')](_0x7fc26c[_0xc590('0x30')],qs[_0xc590('0x32')](_0x557aea[_0xc590('0x2e')][_0xc590('0x32')]));_0x51dacf[_0xc590('0x31')]=_0x51dacf[_0xc590('0x31')][_0xc590('0x33')]?_0x51dacf['attributes']:_0x7fc26c[_0xc590('0x30')];if(!_0x557aea[_0xc590('0x2e')][_0xc590('0x34')]('nolimit')){_0x51dacf['limit']=qs[_0xc590('0x22')](_0x557aea['query'][_0xc590('0x22')]);_0x51dacf[_0xc590('0x21')]=qs['offset'](_0x557aea['query'][_0xc590('0x21')]);}_0x51dacf['order']=qs['sort'](_0x557aea['query'][_0xc590('0x35')]);_0x51dacf[_0xc590('0x36')]=qs[_0xc590('0x37')](_[_0xc590('0x38')](_0x557aea[_0xc590('0x2e')],_0x7fc26c[_0xc590('0x37')]),_0x224180);if(_0x557aea[_0xc590('0x2e')][_0xc590('0x39')]){_0x51dacf['where']=_['merge'](_0x51dacf[_0xc590('0x36')],{'$or':_[_0xc590('0x2a')](_0x224180,function(_0x31cdbd){if(_0x31cdbd[_0xc590('0x2c')]!==_0xc590('0x3a')){var _0x66ac9b={};_0x66ac9b[_0x31cdbd[_0xc590('0x28')]]={'$like':'%'+_0x557aea['query']['filter']+'%'};return _0x66ac9b;}})});}_0x51dacf=_[_0xc590('0x3b')]({},_0x51dacf,_0x557aea['options']);var _0x3c6803={'where':_0x51dacf[_0xc590('0x36')]};return db[_0xc590('0x3c')][_0xc590('0x3d')](_0x3c6803)[_0xc590('0x3e')](function(_0x5f37c3){_0x2aee4c[_0xc590('0x3d')]=_0x5f37c3;if(_0x557aea[_0xc590('0x2e')][_0xc590('0x3f')]){_0x51dacf[_0xc590('0x40')]=[{'all':!![]}];}return db[_0xc590('0x3c')][_0xc590('0x41')](_0x51dacf);})[_0xc590('0x3e')](function(_0x111014){_0x2aee4c['rows']=_0x111014;return _0x2aee4c;})[_0xc590('0x3e')](respondWithFilteredResult(_0x566f77,_0x51dacf))[_0xc590('0x42')](handleError(_0x566f77,null));};exports[_0xc590('0x43')]=function(_0x6c54b3,_0x79fa01){var _0x534389={'raw':![],'where':{'id':_0x6c54b3['params']['id']}},_0x43d32c={};_0x43d32c[_0xc590('0x30')]=_[_0xc590('0x44')](db[_0xc590('0x3c')][_0xc590('0x45')]);_0x43d32c[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x6c54b3[_0xc590('0x2e')]);_0x43d32c['filters']=_['intersection'](_0x43d32c[_0xc590('0x30')],_0x43d32c[_0xc590('0x2e')]);_0x534389[_0xc590('0x31')]=_['intersection'](_0x43d32c['model'],qs['fields'](_0x6c54b3[_0xc590('0x2e')][_0xc590('0x32')]));_0x534389[_0xc590('0x31')]=_0x534389[_0xc590('0x31')]['length']?_0x534389['attributes']:_0x43d32c[_0xc590('0x30')];if(_0x6c54b3[_0xc590('0x2e')][_0xc590('0x3f')]){_0x534389[_0xc590('0x40')]=[{'all':!![]}];}_0x534389=_[_0xc590('0x3b')]({},_0x534389,_0x6c54b3[_0xc590('0x46')]);return db[_0xc590('0x3c')][_0xc590('0x47')](_0x534389)['then'](handleEntityNotFound(_0x79fa01,null))[_0xc590('0x3e')](respondWithResult(_0x79fa01,null))[_0xc590('0x42')](handleError(_0x79fa01,null));};exports['create']=function(_0x4926f7,_0x46d592){return db[_0xc590('0x3c')][_0xc590('0x48')](_0x4926f7[_0xc590('0x49')],{})['then'](function(_0x6dd652){var _0x19c644=_0x4926f7[_0xc590('0x4a')]['get']({'plain':!![]});if(!_0x19c644)throw new Error(_0xc590('0x4b'));if(_0x19c644[_0xc590('0x4c')]===_0xc590('0x4a')){var _0x46a9e5=_0x6dd652['get']({'plain':!![]});var _0x26eddb=_0xc590('0x4d');return db[_0xc590('0x4e')][_0xc590('0x47')]({'where':{'name':_0x26eddb,'userProfileId':_0x19c644[_0xc590('0x4f')]},'raw':!![]})['then'](function(_0x105868){if(_0x105868&&_0x105868['autoAssociation']===0x0){return db[_0xc590('0x50')]['create']({'name':_0x46a9e5[_0xc590('0x28')],'resourceId':_0x46a9e5['id'],'type':_0x105868[_0xc590('0x28')],'sectionId':_0x105868['id']},{})[_0xc590('0x3e')](function(){return _0x6dd652;});}else{return _0x6dd652;}})[_0xc590('0x42')](function(_0x4364bc){logger[_0xc590('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4364bc);throw _0x4364bc;});}return _0x6dd652;})[_0xc590('0x3e')](respondWithResult(_0x46d592,0xc9))['catch'](handleError(_0x46d592,null));};exports['update']=function(_0x220e3f,_0x2a11ae){if(_0x220e3f[_0xc590('0x49')]['id']){delete _0x220e3f['body']['id'];}return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x220e3f['params']['id']}})['then'](handleEntityNotFound(_0x2a11ae,null))['then'](saveUpdates(_0x220e3f[_0xc590('0x49')],null))[_0xc590('0x3e')](respondWithResult(_0x2a11ae,null))[_0xc590('0x42')](handleError(_0x2a11ae,null));};exports[_0xc590('0x51')]=function(_0x51713f,_0x444c87){var _0x38429d=_0x51713f[_0xc590('0x52')]['id'];var _0x1b6370=[];return db[_0xc590('0x53')][_0xc590('0x54')](function(_0x40be1f){var _0x4a0577=_0xc590('0x55')+_0x38429d;return db[_0xc590('0x53')]['query'](_0x4a0577,{'type':db[_0xc590('0x56')][_0xc590('0x57')]['SELECT'],'raw':!![],'transaction':_0x40be1f})[_0xc590('0x3e')](function(_0x5476d0){_0x1b6370=_[_0xc590('0x2a')](_0x5476d0,function(_0x22d441){return Number(_0x22d441[_0xc590('0x58')]);});})[_0xc590('0x3e')](function(){var _0x5355dc=_0xc590('0x59')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x5355dc,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x19943d){var _0x51cea7=_[_0xc590('0x2a')](_0x19943d,function(_0xb0a21b){return Number(_0xb0a21b[_0xc590('0x5b')]);});return db[_0xc590('0x5c')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'VoiceQueueId':{'$in':_0x51cea7}},'transaction':_0x40be1f});})['then'](function(){var _0x13e4a5=_0xc590('0x5d')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x13e4a5,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x25ccf1){var _0x978057=_[_0xc590('0x2a')](_0x25ccf1,function(_0x12bb5e){return Number(_0x12bb5e[_0xc590('0x5e')]);});return db[_0xc590('0x5f')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'MailQueueId':{'$in':_0x978057}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x582097=_0xc590('0x60')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x582097,{'type':db[_0xc590('0x56')][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})['then'](function(_0xe4369d){var _0x4ca80d=_[_0xc590('0x2a')](_0xe4369d,function(_0x4144d7){return Number(_0x4144d7[_0xc590('0x61')]);});return db[_0xc590('0x62')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'SmsQueueId':{'$in':_0x4ca80d}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x3c21af='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x38429d;return db['sequelize']['query'](_0x3c21af,{'type':db['Sequelize'][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x1ad725){var _0x31f7c8=_[_0xc590('0x2a')](_0x1ad725,function(_0x439759){return Number(_0x439759['ChatQueueId']);});return db[_0xc590('0x63')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'ChatQueueId':{'$in':_0x31f7c8}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x46fc91=_0xc590('0x64')+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x46fc91,{'type':db[_0xc590('0x56')]['QueryTypes'][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x5d27c4){var _0x506dde=_[_0xc590('0x2a')](_0x5d27c4,function(_0x15868b){return Number(_0x15868b[_0xc590('0x65')]);});return db[_0xc590('0x66')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'FaxQueueId':{'$in':_0x506dde}},'transaction':_0x40be1f});})['then'](function(){var _0x292aae='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x38429d;return db[_0xc590('0x53')][_0xc590('0x2e')](_0x292aae,{'type':db['Sequelize'][_0xc590('0x57')]['SELECT'],'raw':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x5f26b0){var _0x5bce5a=_[_0xc590('0x2a')](_0x5f26b0,function(_0x336f65){return Number(_0x336f65[_0xc590('0x67')]);});return db['UserOpenchannelQueue'][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'OpenchannelQueueId':{'$in':_0x5bce5a}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){var _0x1b4083=_0xc590('0x68')+_0x38429d;return db['sequelize'][_0xc590('0x2e')](_0x1b4083,{'type':db['Sequelize'][_0xc590('0x57')][_0xc590('0x5a')],'raw':!![],'transaction':_0x40be1f});})['then'](function(_0x22f2e0){var _0x2f0838=_[_0xc590('0x2a')](_0x22f2e0,function(_0x520e9b){return Number(_0x520e9b[_0xc590('0x69')]);});return db[_0xc590('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x1b6370},'WhatsappQueueId':{'$in':_0x2f0838}},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){return db[_0xc590('0x6b')][_0xc590('0x47')]({'where':{'TeamId':_0x38429d}});})['then'](function(_0x4845ce){if(_0x4845ce===null){return;}return db[_0xc590('0x6c')][_0xc590('0x51')]({'where':{'UserId':{'$in':_0x1b6370},'VoicePrefixId':_0x4845ce[_0xc590('0x6d')]},'transaction':_0x40be1f});})[_0xc590('0x3e')](function(){return db[_0xc590('0x3c')][_0xc590('0x51')]({'where':{'id':_0x38429d},'cascade':!![],'transaction':_0x40be1f});})[_0xc590('0x3e')](function(_0x2e0b96){if(_0x2e0b96===0x0){_0x444c87['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xc590('0x51')]({'where':{'type':'Teams','resourceId':_0x38429d},'cascade':!![],'transaction':_0x40be1f})[_0xc590('0x3e')](function(){_0x444c87['status'](0xcc)['end']();});}})[_0xc590('0x42')](function(_0x207df0){_0x444c87[_0xc590('0x1f')](0x1f4)['send'](_0x207df0);});});};exports[_0xc590('0x6e')]=function(_0x56b2fb,_0x48a20a,_0x207560){return db[_0xc590('0x3c')][_0xc590('0x6f')]({'where':{'id':_0x56b2fb[_0xc590('0x52')]['id']}})['then'](handleEntityNotFound(_0x48a20a,null))[_0xc590('0x3e')](function(_0x1d850e){if(!_0x56b2fb['query'][_0xc590('0x70')]||!utils[_0xc590('0x71')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x70')])){throw new db['Sequelize']['ValidationError'](_0xc590('0x72'));}var _0x5af2e8={};var _0x49860d={};_0x49860d[_0xc590('0x30')]=_[_0xc590('0x44')](db[_[_0xc590('0x73')](_0x56b2fb['query'][_0xc590('0x70')][_0xc590('0x74')]())+_0xc590('0x75')][_0xc590('0x45')]);_0x49860d[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x56b2fb[_0xc590('0x2e')]);_0x49860d[_0xc590('0x37')]=_[_0xc590('0x2f')](_0x49860d[_0xc590('0x30')],_0x49860d['query']);_0x5af2e8[_0xc590('0x31')]=_[_0xc590('0x2f')](_0x49860d['model'],qs[_0xc590('0x32')](_0x56b2fb['query']['fields']));_0x5af2e8[_0xc590('0x31')]=_0x5af2e8[_0xc590('0x31')][_0xc590('0x33')]?_0x5af2e8[_0xc590('0x31')]:_0x49860d[_0xc590('0x30')];_0x5af2e8['limit']=qs[_0xc590('0x22')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x22')]);_0x5af2e8['offset']=qs[_0xc590('0x21')](_0x56b2fb['query']['offset']);_0x5af2e8['order']=qs[_0xc590('0x35')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x35')]);_0x5af2e8[_0xc590('0x36')]=qs['filters'](_[_0xc590('0x38')](_0x56b2fb[_0xc590('0x2e')],_0x49860d[_0xc590('0x37')]));_0x5af2e8=_['merge']({},_0x5af2e8,_0x56b2fb[_0xc590('0x46')]);return _0x1d850e[_0xc590('0x76')+_[_0xc590('0x73')](_0x56b2fb[_0xc590('0x2e')][_0xc590('0x70')][_0xc590('0x74')]())+_0xc590('0x77')](_0x5af2e8);})[_0xc590('0x3e')](respondWithResult(_0x48a20a,null))[_0xc590('0x42')](handleError(_0x48a20a,null));};exports[_0xc590('0x78')]=function(_0x2f76e3,_0xf52da4,_0x34a7fb){return db['Team'][_0xc590('0x6f')]({'where':{'id':_0x2f76e3[_0xc590('0x52')]['id']}})['then'](function(_0x2d1041){if(_0x2d1041){if(!_0x2f76e3[_0xc590('0x49')]['channel']||!utils[_0xc590('0x71')](_0x2f76e3[_0xc590('0x49')][_0xc590('0x70')])){throw new db[(_0xc590('0x56'))][(_0xc590('0x79'))](_0xc590('0x72'));}return _0x2d1041['add'+_[_0xc590('0x73')](_0x2f76e3[_0xc590('0x49')][_0xc590('0x70')][_0xc590('0x74')]())+'Queues'](_0x2f76e3[_0xc590('0x49')][_0xc590('0x7a')]);}return null;})[_0xc590('0x3e')](handleEntityNotFound(_0xf52da4,null))['then'](respondWithStatusCode(_0xf52da4,null))[_0xc590('0x42')](handleError(_0xf52da4,null));};exports['removeQueues']=function(_0x5bd4e1,_0x5c7a99,_0x54a72a){return db[_0xc590('0x3c')]['findOne']({'where':{'id':_0x5bd4e1[_0xc590('0x52')]['id']}})[_0xc590('0x3e')](function(_0x3bf800){if(_0x3bf800){if(!_0x5bd4e1['query'][_0xc590('0x70')]||!utils[_0xc590('0x71')](_0x5bd4e1[_0xc590('0x2e')][_0xc590('0x70')])){throw new db[(_0xc590('0x56'))][(_0xc590('0x79'))]('Unknown\x20channel');}return _0x3bf800[_0xc590('0x7b')+_['capitalize'](_0x5bd4e1[_0xc590('0x2e')]['channel']['toLowerCase']())+_0xc590('0x77')](_0x5bd4e1[_0xc590('0x2e')][_0xc590('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x5c7a99,null))[_0xc590('0x3e')](respondWithStatusCode(_0x5c7a99,null))['catch'](handleError(_0x5c7a99,null));};exports[_0xc590('0x7c')]=function(_0x381355,_0x4d1457){var _0x18ff89=_[_0xc590('0x7d')](_0x381355[_0xc590('0x49')][_0xc590('0x7a')])?_0x381355['body'][_0xc590('0x7a')]:[_0x381355[_0xc590('0x49')]['ids']];var _0x80a9af=_0x381355[_0xc590('0x52')]['id'];return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x80a9af}})[_0xc590('0x3e')](handleEntityNotFound(_0x4d1457,null))['then'](function(_0x3d86d3){if(_0x3d86d3){var _0x55de1c=[_0xc590('0x7e'),'Chat',_0xc590('0x7f'),'Sms',_0xc590('0x80'),_0xc590('0x81'),_0xc590('0x82')];return db['sequelize'][_0xc590('0x54')](function(_0xa19e99){var _0x3735e5=_['map'](_0x55de1c,function(_0x498143){var _0x9669c8={'attributes':['id',_0xc590('0x28')]};if(_0x498143===_0xc590('0x7e')){_0x9669c8['through']={'attributes':['penalty']};}return _0x3d86d3[_0xc590('0x76')+_0x498143+_0xc590('0x77')](_0x9669c8)[_0xc590('0x3e')](function(_0x245d91){var _0x2b42ec=_[_0xc590('0x2a')](_0x245d91,function(_0x40ade6){var _0x4de604=_[_0xc590('0x2a')](_0x18ff89,function(_0x2611b1){var _0x2103b5={'where':{'UserId':_0x2611b1,[_0x498143+_0xc590('0x83')]:_0x40ade6['id']},'transaction':_0xa19e99};if(_0x498143===_0xc590('0x7e')){_0x2103b5[_0xc590('0x19')]={'penalty':_0x40ade6[_0xc590('0x84')][_0xc590('0x85')]};}return db[_0xc590('0x86')+_0x498143+_0xc590('0x75')]['findOrCreate'](_0x2103b5)[_0xc590('0x3e')](function(){socket['emit'](_0xc590('0x4a')+_0x498143+_0xc590('0x87'),{'UserId':_0x2611b1,[_0x498143+'QueueId']:_0x40ade6['id']});if(_0x498143!==_0xc590('0x7e')){return;}return db['User'][_0xc590('0x41')]({'where':{'id':_0x18ff89,'online':0x1},'attributes':['id','name',_0xc590('0x88'),_0xc590('0x89'),'interface'],'raw':!![]})[_0xc590('0x3e')](function(_0x3abcae){var _0x4ed753=_[_0xc590('0x2a')](_0x3abcae,function(_0x83538d){return db['UserVoiceQueueRt'][_0xc590('0x8a')]({'membername':_0x83538d[_0xc590('0x28')],'UserId':_0x83538d['id'],'queue_name':_0x40ade6[_0xc590('0x28')],'VoiceQueueId':_0x40ade6['id'],'interface':_['isNil'](_0x83538d['interface'])?util[_0xc590('0x8b')](_0xc590('0x8c'),_0x83538d['name']):_0x83538d[_0xc590('0x8d')],'paused':_0x83538d[_0xc590('0x89')]||![],'penalty':_0x40ade6[_0xc590('0x84')][_0xc590('0x85')]},{'transaction':_0xa19e99});});return Promise[_0xc590('0x8e')](_0x4ed753);});});});return Promise['all'](_0x4de604);});return Promise[_0xc590('0x8e')](_0x2b42ec);})['then'](function(){return db[_0xc590('0x6b')][_0xc590('0x6f')]({'where':{'teamId':_0x80a9af}})[_0xc590('0x3e')](function(_0x494aeb){if(_0x494aeb){var _0xfd56d3=_[_0xc590('0x2a')](_0x18ff89,function(_0x4755df){db['UserVoicePrefix'][_0xc590('0x8a')]({'UserId':_0x4755df,'VoicePrefixId':_0x494aeb[_0xc590('0x6d')]});});return Promise[_0xc590('0x8e')](_0xfd56d3);}});});});return Promise[_0xc590('0x8e')](_0x3735e5)[_0xc590('0x3e')](function(){return _0x3d86d3[_0xc590('0x7c')](_0x18ff89,{'transaction':_0xa19e99})[_0xc590('0x8f')](function(_0x2d71f1){return _0x2d71f1;});});});}})[_0xc590('0x3e')](respondWithResult(_0x4d1457,null))[_0xc590('0x42')](handleError(_0x4d1457,null));};exports[_0xc590('0x90')]=function(_0x811163,_0x112e23){var _0x3129a4=_['isArray'](_0x811163[_0xc590('0x2e')][_0xc590('0x7a')])?_0x811163['query'][_0xc590('0x7a')]:[_0x811163[_0xc590('0x2e')]['ids']];var _0x395cf2=_0x811163[_0xc590('0x52')]['id'];return db[_0xc590('0x3c')][_0xc590('0x47')]({'where':{'id':_0x395cf2}})['then'](handleEntityNotFound(_0x112e23,null))['then'](function(_0x9ecd6c){if(_0x9ecd6c){var _0x490b65=[_0xc590('0x7e'),'Chat',_0xc590('0x7f'),'Sms',_0xc590('0x80'),_0xc590('0x81'),_0xc590('0x82')];return db['sequelize']['transaction'](function(_0x2aed41){var _0x40d924=_[_0xc590('0x2a')](_0x490b65,function(_0x4f3e05){var _0x582bc7={'attributes':['id',_0xc590('0x28')]};return _0x9ecd6c['get'+_0x4f3e05+_0xc590('0x77')](_0x582bc7)[_0xc590('0x3e')](function(_0x5bed29){var _0x1e0a78=_[_0xc590('0x2a')](_0x5bed29,function(_0x40c3e3){return _0x40c3e3[_0xc590('0x90')](_0x3129a4,{'transaction':_0x2aed41})[_0xc590('0x3e')](function(){var _0x8c2de=_['map'](_0x3129a4,function(_0x506d3e){socket['emit'](_0xc590('0x4a')+_0x4f3e05+_0xc590('0x91'),{'UserId':Number(_0x506d3e),[_0x4f3e05+_0xc590('0x83')]:_0x40c3e3['id']});if(_0x4f3e05!==_0xc590('0x7e')){return;}return db[_0xc590('0x92')][_0xc590('0x51')]({'where':{'VoiceQueueId':_0x40c3e3['id'],'UserId':_0x506d3e},'transaction':_0x2aed41});});return Promise[_0xc590('0x8e')](_0x8c2de);});});return Promise[_0xc590('0x8e')](_0x1e0a78);});});return Promise['all'](_0x40d924)[_0xc590('0x3e')](function(){return _0x9ecd6c[_0xc590('0x90')](_0x3129a4,{'transaction':_0x2aed41});})[_0xc590('0x3e')](function(){return db[_0xc590('0x6b')][_0xc590('0x6f')]({'where':{'teamId':_0x395cf2}})[_0xc590('0x3e')](function(_0x51a33f){if(_0x51a33f){var _0x5b9d44=_[_0xc590('0x2a')](_0x3129a4,function(_0x4dd8d6){db[_0xc590('0x6c')][_0xc590('0x51')]({'where':{'UserId':_0x4dd8d6,'VoicePrefixId':_0x51a33f['VoicePrefixId']}});});return Promise[_0xc590('0x8e')](_0x5b9d44);}});});});}})[_0xc590('0x3e')](respondWithStatusCode(_0x112e23,null))[_0xc590('0x42')](handleError(_0x112e23,null));};exports[_0xc590('0x93')]=function(_0x534d61,_0xb13392,_0x86890e){var _0x3c19f0={};var _0xe72274={};var _0x1f0987;var _0xa47262;return db[_0xc590('0x3c')]['findOne']({'where':{'id':_0x534d61['params']['id']}})[_0xc590('0x3e')](handleEntityNotFound(_0xb13392,null))[_0xc590('0x3e')](function(_0xad7653){if(_0xad7653){_0x1f0987=_0xad7653;_0xe72274[_0xc590('0x30')]=_[_0xc590('0x44')](db[_0xc590('0x86')][_0xc590('0x45')]);_0xe72274[_0xc590('0x2e')]=_[_0xc590('0x44')](_0x534d61[_0xc590('0x2e')]);_0xe72274['filters']=_[_0xc590('0x2f')](_0xe72274[_0xc590('0x30')],_0xe72274[_0xc590('0x2e')]);_0x3c19f0[_0xc590('0x31')]=_[_0xc590('0x2f')](_0xe72274['model'],qs[_0xc590('0x32')](_0x534d61[_0xc590('0x2e')][_0xc590('0x32')]));_0x3c19f0[_0xc590('0x31')]=_0x3c19f0['attributes'][_0xc590('0x33')]?_0x3c19f0[_0xc590('0x31')]:_0xe72274[_0xc590('0x30')];_0x3c19f0[_0xc590('0x94')]=qs[_0xc590('0x35')](_0x534d61['query'][_0xc590('0x35')]);_0x3c19f0[_0xc590('0x36')]=qs[_0xc590('0x37')](_[_0xc590('0x38')](_0x534d61[_0xc590('0x2e')],_0xe72274[_0xc590('0x37')]));if(_0x534d61[_0xc590('0x2e')][_0xc590('0x39')]){_0x3c19f0[_0xc590('0x36')]=_[_0xc590('0x3b')](_0x3c19f0[_0xc590('0x36')],{'$or':_[_0xc590('0x2a')](_0x3c19f0[_0xc590('0x31')],function(_0x165629){var _0x22dde1={};_0x22dde1[_0x165629]={'$like':'%'+_0x534d61[_0xc590('0x2e')][_0xc590('0x39')]+'%'};return _0x22dde1;})});}_0x3c19f0=_['merge']({},_0x3c19f0,_0x534d61[_0xc590('0x46')]);return _0x1f0987[_0xc590('0x93')](_0x3c19f0);}})[_0xc590('0x3e')](function(_0x4f4e5a){if(_0x4f4e5a){_0xa47262=_0x4f4e5a[_0xc590('0x33')];if(!_0x534d61[_0xc590('0x2e')][_0xc590('0x34')](_0xc590('0x95'))){_0x3c19f0[_0xc590('0x22')]=qs[_0xc590('0x22')](_0x534d61[_0xc590('0x2e')][_0xc590('0x22')]);_0x3c19f0[_0xc590('0x21')]=qs[_0xc590('0x21')](_0x534d61[_0xc590('0x2e')][_0xc590('0x21')]);}return _0x1f0987[_0xc590('0x93')](_0x3c19f0);}})[_0xc590('0x3e')](function(_0x22a7ea){if(_0x22a7ea){return _0x22a7ea?{'count':_0xa47262,'rows':_0x22a7ea}:null;}})[_0xc590('0x3e')](respondWithResult(_0xb13392,null))[_0xc590('0x42')](handleError(_0xb13392,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 27d12d7..cde9c69 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 _0x503f=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x44974a,_0x2c2a10){var _0x4b4f9b=function(_0x40d486){while(--_0x40d486){_0x44974a['push'](_0x44974a['shift']());}};_0x4b4f9b(++_0x2c2a10);}(_0x503f,0x108));var _0xf503=function(_0x48aaa3,_0x183ef0){_0x48aaa3=_0x48aaa3-0x0;var _0x43ef26=_0x503f[_0x48aaa3];return _0x43ef26;};'use strict';var EventEmitter=require(_0xf503('0x0'));var Team=require(_0xf503('0x1'))['db'][_0xf503('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf503('0x3')](0x0);var events={'afterCreate':_0xf503('0x4'),'afterUpdate':_0xf503('0x5'),'afterDestroy':_0xf503('0x6')};function emitEvent(_0x2bacca){return function(_0x1a4995,_0x4d82f7,_0x196bbd){TeamEvents[_0xf503('0x7')](_0x2bacca+':'+_0x1a4995['id'],_0x1a4995);TeamEvents[_0xf503('0x7')](_0x2bacca,_0x1a4995);_0x196bbd(null);};}for(var e in events){if(events[_0xf503('0x8')](e)){var event=events[e];Team[_0xf503('0x9')](e,emitEvent(event));}}module[_0xf503('0xa')]=TeamEvents; \ No newline at end of file +var _0x6be1=['emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners','update','remove'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x6be1,0x1c6));var _0x16be=function(_0x506339,_0x55a013){_0x506339=_0x506339-0x0;var _0xae1f30=_0x6be1[_0x506339];return _0xae1f30;};'use strict';var EventEmitter=require(_0x16be('0x0'));var Team=require('../../mysqldb')['db'][_0x16be('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x16be('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x16be('0x3'),'afterDestroy':_0x16be('0x4')};function emitEvent(_0x8542d9){return function(_0x850c92,_0x158858,_0x4dce1a){TeamEvents[_0x16be('0x5')](_0x8542d9+':'+_0x850c92['id'],_0x850c92);TeamEvents[_0x16be('0x5')](_0x8542d9,_0x850c92);_0x4dce1a(null);};}for(var e in events){if(events[_0x16be('0x6')](e)){var event=events[e];Team[_0x16be('0x7')](e,emitEvent(event));}}module[_0x16be('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 fd689eb..d91b31c 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 _0xa7b9=['api','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','util','../../config/logger'];(function(_0x55efa2,_0x30ba3c){var _0x269dee=function(_0x284aef){while(--_0x284aef){_0x55efa2['push'](_0x55efa2['shift']());}};_0x269dee(++_0x30ba3c);}(_0xa7b9,0x136));var _0x9a7b=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xa7b9[_0x1399d6];return _0x4a9db4;};'use strict';var _=require('lodash');var util=require(_0x9a7b('0x0'));var logger=require(_0x9a7b('0x1'))(_0x9a7b('0x2'));var moment=require('moment');var BPromise=require(_0x9a7b('0x3'));var rp=require(_0x9a7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a7b('0x5'));var config=require(_0x9a7b('0x6'));var attributes=require(_0x9a7b('0x7'));module[_0x9a7b('0x8')]=function(_0x5f3827,_0x2cdee9){return _0x5f3827[_0x9a7b('0x9')](_0x9a7b('0xa'),attributes,{'tableName':_0x9a7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x212a=['../../config/environment','./team.attributes','Team','teams','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x384ca5,_0x37d802){var _0x1495f1=function(_0x54e8ae){while(--_0x54e8ae){_0x384ca5['push'](_0x384ca5['shift']());}};_0x1495f1(++_0x37d802);}(_0x212a,0xe8));var _0xa212=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x212a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa212('0x0'));var util=require(_0xa212('0x1'));var logger=require(_0xa212('0x2'))(_0xa212('0x3'));var moment=require(_0xa212('0x4'));var BPromise=require(_0xa212('0x5'));var rp=require(_0xa212('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa212('0x7'));var config=require(_0xa212('0x8'));var attributes=require(_0xa212('0x9'));module['exports']=function(_0x200b73,_0x3f4ff5){return _0x200b73['define'](_0xa212('0xa'),attributes,{'tableName':_0xa212('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 29583b8..0e21279 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 _0x6e6b=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x6e6b,0x7e));var _0xb6e6=function(_0x46d0b5,_0x506ff8){_0x46d0b5=_0x46d0b5-0x0;var _0x82389e=_0x6e6b[_0x46d0b5];return _0x82389e;};'use strict';var _=require('lodash');var util=require(_0xb6e6('0x0'));var moment=require(_0xb6e6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6e6('0x2'));var db=require(_0xb6e6('0x3'))['db'];var utils=require(_0xb6e6('0x4'));var logger=require(_0xb6e6('0x5'))(_0xb6e6('0x6'));var config=require(_0xb6e6('0x7'));var jayson=require(_0xb6e6('0x8'));var client=jayson[_0xb6e6('0x9')]['http']({'port':0x232a});config['redis']=_[_0xb6e6('0xa')](config[_0xb6e6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6e6('0xc'))(new Redis(config[_0xb6e6('0xb')]));require('./team.socket')[_0xb6e6('0xd')](socket);function respondWithRpcPromise(_0x5986a4,_0x4425e9,_0xbdf715){return new BPromise(function(_0x45f239,_0x24daa5){return client['request'](_0x5986a4,_0xbdf715)[_0xb6e6('0xe')](function(_0x439ec7){logger['info'](_0xb6e6('0xf'),_0x4425e9,_0xb6e6('0x10'));logger[_0xb6e6('0x11')](_0xb6e6('0x12'),_0x4425e9,_0xb6e6('0x10'),JSON['stringify'](_0x439ec7));if(_0x439ec7[_0xb6e6('0x13')]){if(_0x439ec7[_0xb6e6('0x13')][_0xb6e6('0x14')]===0x1f4){logger['error'](_0xb6e6('0xf'),_0x4425e9,_0x439ec7[_0xb6e6('0x13')]['message']);return _0x24daa5(_0x439ec7[_0xb6e6('0x13')][_0xb6e6('0x15')]);}logger[_0xb6e6('0x13')](_0xb6e6('0xf'),_0x4425e9,_0x439ec7[_0xb6e6('0x13')][_0xb6e6('0x15')]);return _0x45f239(_0x439ec7[_0xb6e6('0x13')]['message']);}else{logger[_0xb6e6('0x16')]('Team,\x20%s,\x20%s',_0x4425e9,_0xb6e6('0x10'));_0x45f239(_0x439ec7[_0xb6e6('0x17')]['message']);}})[_0xb6e6('0x18')](function(_0x186916){logger[_0xb6e6('0x13')]('Team,\x20%s,\x20%s',_0x4425e9,_0x186916);_0x24daa5(_0x186916);});});} \ No newline at end of file +var _0xfd28=['code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4506ad,_0x247564){var _0x1d2252=function(_0x17349e){while(--_0x17349e){_0x4506ad['push'](_0x4506ad['shift']());}};_0x1d2252(++_0x247564);}(_0xfd28,0x112));var _0x8fd2=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0xfd28[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x8fd2('0x0'));var util=require(_0x8fd2('0x1'));var moment=require(_0x8fd2('0x2'));var BPromise=require(_0x8fd2('0x3'));var rs=require(_0x8fd2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x5'))['db'];var utils=require(_0x8fd2('0x6'));var logger=require(_0x8fd2('0x7'))(_0x8fd2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8fd2('0x9'));var client=jayson[_0x8fd2('0xa')][_0x8fd2('0xb')]({'port':0x232a});config[_0x8fd2('0xc')]=_[_0x8fd2('0xd')](config[_0x8fd2('0xc')],{'host':_0x8fd2('0xe'),'port':0x18eb});var socket=require(_0x8fd2('0xf'))(new Redis(config[_0x8fd2('0xc')]));require(_0x8fd2('0x10'))[_0x8fd2('0x11')](socket);function respondWithRpcPromise(_0x5e65f8,_0x5e5c1b,_0x50d562){return new BPromise(function(_0x50a246,_0x53bfbb){return client[_0x8fd2('0x12')](_0x5e65f8,_0x50d562)[_0x8fd2('0x13')](function(_0x433881){logger[_0x8fd2('0x14')](_0x8fd2('0x15'),_0x5e5c1b,'request\x20sent');logger[_0x8fd2('0x16')](_0x8fd2('0x17'),_0x5e5c1b,'request\x20sent',JSON[_0x8fd2('0x18')](_0x433881));if(_0x433881[_0x8fd2('0x19')]){if(_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1a')]===0x1f4){logger[_0x8fd2('0x19')]('Team,\x20%s,\x20%s',_0x5e5c1b,_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1b')]);return _0x53bfbb(_0x433881[_0x8fd2('0x19')]['message']);}logger[_0x8fd2('0x19')]('Team,\x20%s,\x20%s',_0x5e5c1b,_0x433881['error'][_0x8fd2('0x1b')]);return _0x50a246(_0x433881[_0x8fd2('0x19')][_0x8fd2('0x1b')]);}else{logger[_0x8fd2('0x14')](_0x8fd2('0x15'),_0x5e5c1b,_0x8fd2('0x1c'));_0x50a246(_0x433881[_0x8fd2('0x1d')][_0x8fd2('0x1b')]);}})['catch'](function(_0x26a8bd){logger['error'](_0x8fd2('0x15'),_0x5e5c1b,_0x26a8bd);_0x53bfbb(_0x26a8bd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0b6a7e8..9795b8d 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 _0x7c35=['emit','register','length','save','remove','update'];(function(_0x51eab8,_0x39bc64){var _0x166961=function(_0x2ae9e6){while(--_0x2ae9e6){_0x51eab8['push'](_0x51eab8['shift']());}};_0x166961(++_0x39bc64);}(_0x7c35,0x135));var _0x57c3=function(_0x4cdcb0,_0x2a66f7){_0x4cdcb0=_0x4cdcb0-0x0;var _0x1df0b0=_0x7c35[_0x4cdcb0];return _0x1df0b0;};'use strict';var TeamEvents=require('./team.events');var events=[_0x57c3('0x0'),_0x57c3('0x1'),_0x57c3('0x2')];function createListener(_0x14b13b,_0x23e38f){return function(_0x2acb85){_0x23e38f[_0x57c3('0x3')](_0x14b13b,_0x2acb85);};}function removeListener(_0x5519f2,_0x1ebc41){return function(){TeamEvents['removeListener'](_0x5519f2,_0x1ebc41);};}exports[_0x57c3('0x4')]=function(_0x562f00){for(var _0x564573=0x0,_0x341f1=events[_0x57c3('0x5')];_0x564573<_0x341f1;_0x564573++){var _0x38de37=events[_0x564573];var _0x13cf86=createListener('team:'+_0x38de37,_0x562f00);TeamEvents['on'](_0x38de37,_0x13cf86);}}; \ No newline at end of file +var _0x45d3=['save','remove','update','emit','removeListener','register','length','team:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45d3,0x148));var _0x345d=function(_0x2ad3e1,_0x1a75de){_0x2ad3e1=_0x2ad3e1-0x0;var _0x5630fc=_0x45d3[_0x2ad3e1];return _0x5630fc;};'use strict';var TeamEvents=require('./team.events');var events=[_0x345d('0x0'),_0x345d('0x1'),_0x345d('0x2')];function createListener(_0x25e275,_0x27e56c){return function(_0xb04cf2){_0x27e56c[_0x345d('0x3')](_0x25e275,_0xb04cf2);};}function removeListener(_0x153443,_0xaa7b7e){return function(){TeamEvents[_0x345d('0x4')](_0x153443,_0xaa7b7e);};}exports[_0x345d('0x5')]=function(_0x40f2ab){for(var _0x459be2=0x0,_0x15dfe2=events[_0x345d('0x6')];_0x459be2<_0x15dfe2;_0x459be2++){var _0x5404a9=events[_0x459be2];var _0x58a743=createListener(_0x345d('0x7')+_0x5404a9,_0x40f2ab);TeamEvents['on'](_0x5404a9,_0x58a743);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 371be07..0eff6ce 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 _0xf58e=['INTEGER','sequelize','exports'];(function(_0x2f6a9c,_0x38d439){var _0x385a8d=function(_0xaf181){while(--_0xaf181){_0x2f6a9c['push'](_0x2f6a9c['shift']());}};_0x385a8d(++_0x38d439);}(_0xf58e,0xc1));var _0xef58=function(_0x1c2935,_0x3a525d){_0x1c2935=_0x1c2935-0x0;var _0x5b69a0=_0xf58e[_0x1c2935];return _0x5b69a0;};'use strict';var Sequelize=require(_0xef58('0x0'));module[_0xef58('0x1')]={'TeamId':{'type':Sequelize[_0xef58('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xef58('0x2')]}}; \ No newline at end of file +var _0x6427=['exports','INTEGER'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x6427,0xbe));var _0x7642=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6427[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');module[_0x7642('0x0')]={'TeamId':{'type':Sequelize[_0x7642('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7642('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f3d0d16..1eb7b2f 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 _0x983c=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xc80b2b,_0x5a12e9){var _0x22af6f=function(_0x418bf5){while(--_0x418bf5){_0xc80b2b['push'](_0xc80b2b['shift']());}};_0x22af6f(++_0x5a12e9);}(_0x983c,0xf3));var _0xc983=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x983c[_0x4f6d08];return _0x53a9c6;};'use strict';var _=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var logger=require(_0xc983('0x2'))(_0xc983('0x3'));var moment=require(_0xc983('0x4'));var BPromise=require('bluebird');var rp=require(_0xc983('0x5'));var fs=require('fs');var path=require(_0xc983('0x6'));var rimraf=require(_0xc983('0x7'));var config=require(_0xc983('0x8'));var attributes=require(_0xc983('0x9'));module[_0xc983('0xa')]=function(_0x3897b9,_0x541e6f){return _0x3897b9[_0xc983('0xb')](_0xc983('0xc'),attributes,{'tableName':_0xc983('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea28=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19e754,_0x4aeb77){var _0x5504c8=function(_0x41db1a){while(--_0x41db1a){_0x19e754['push'](_0x19e754['shift']());}};_0x5504c8(++_0x4aeb77);}(_0xea28,0x13a));var _0x8ea2=function(_0xd90117,_0x196097){_0xd90117=_0xd90117-0x0;var _0x5e86f=_0xea28[_0xd90117];return _0x5e86f;};'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 diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1b37dbb..9d7958d 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x291ec3,_0x2f19a7){var _0x423b99=function(_0x345ddd){while(--_0x345ddd){_0x291ec3['push'](_0x291ec3['shift']());}};_0x423b99(++_0x2f19a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x507df9,_0x30a73b){var _0x42ddc9=function(_0x543377){while(--_0x543377){_0x507df9['push'](_0x507df9['shift']());}};_0x42ddc9(++_0x30a73b);}(_0xe706,0xa3));var _0x6e70=function(_0xd4d4aa,_0x5db1f0){_0xd4d4aa=_0xd4d4aa-0x0;var _0x3f2237=_0xe706[_0xd4d4aa];return _0x3f2237;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index f75a926..26b095b 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 _0x2739=['sequelize','INTEGER'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x2739,0x10e));var _0x9273=function(_0x51ba59,_0x8ec9b0){_0x51ba59=_0x51ba59-0x0;var _0x298023=_0x2739[_0x51ba59];return _0x298023;};'use strict';var Sequelize=require(_0x9273('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9273('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5699=['sequelize','exports'];(function(_0x5b02e6,_0x368c90){var _0x321842=function(_0x3a7dff){while(--_0x3a7dff){_0x5b02e6['push'](_0x5b02e6['shift']());}};_0x321842(++_0x368c90);}(_0x5699,0x68));var _0x9569=function(_0x619b0c,_0x7255c7){_0x619b0c=_0x619b0c-0x0;var _0x20b83e=_0x5699[_0x619b0c];return _0x20b83e;};'use strict';var Sequelize=require(_0x9569('0x0'));module[_0x9569('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 34f4abb..23848bb 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 _0xecd5=['TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes'];(function(_0x1a36e9,_0xe0aa5e){var _0x32cdd1=function(_0x4c32df){while(--_0x4c32df){_0x1a36e9['push'](_0x1a36e9['shift']());}};_0x32cdd1(++_0xe0aa5e);}(_0xecd5,0x110));var _0x5ecd=function(_0x1ec28e,_0x561fda){_0x1ec28e=_0x1ec28e-0x0;var _0x9aa737=_0xecd5[_0x1ec28e];return _0x9aa737;};'use strict';var _=require('lodash');var util=require(_0x5ecd('0x0'));var logger=require(_0x5ecd('0x1'))(_0x5ecd('0x2'));var moment=require('moment');var BPromise=require(_0x5ecd('0x3'));var rp=require(_0x5ecd('0x4'));var fs=require('fs');var path=require(_0x5ecd('0x5'));var rimraf=require(_0x5ecd('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ecd('0x7'));module['exports']=function(_0x1ddbad,_0x492eba){return _0x1ddbad['define'](_0x5ecd('0x8'),attributes,{'tableName':_0x5ecd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d70=['api','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util'];(function(_0x20ebb5,_0x237d88){var _0x487182=function(_0xaa5491){while(--_0xaa5491){_0x20ebb5['push'](_0x20ebb5['shift']());}};_0x487182(++_0x237d88);}(_0x5d70,0x8d));var _0x05d7=function(_0x3d9ff6,_0x25619f){_0x3d9ff6=_0x3d9ff6-0x0;var _0x22e4bb=_0x5d70[_0x3d9ff6];return _0x22e4bb;};'use strict';var _=require(_0x05d7('0x0'));var util=require(_0x05d7('0x1'));var logger=require('../../config/logger')(_0x05d7('0x2'));var moment=require(_0x05d7('0x3'));var BPromise=require(_0x05d7('0x4'));var rp=require(_0x05d7('0x5'));var fs=require('fs');var path=require(_0x05d7('0x6'));var rimraf=require(_0x05d7('0x7'));var config=require('../../config/environment');var attributes=require(_0x05d7('0x8'));module[_0x05d7('0x9')]=function(_0x416de3,_0x2fe205){return _0x416de3['define']('TeamVoiceQueue',attributes,{'tableName':_0x05d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 2798a76..6b54014 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 _0xdb4b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x25ab51,_0x4f84f5){_0x25ab51=_0x25ab51-0x0;var _0x3b4aa0=_0xdb4b[_0x25ab51];return _0x3b4aa0;};'use strict';var _=require('lodash');var util=require(_0xbdb4('0x0'));var moment=require('moment');var BPromise=require(_0xbdb4('0x1'));var rs=require(_0xbdb4('0x2'));var fs=require('fs');var Redis=require(_0xbdb4('0x3'));var db=require(_0xbdb4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb4('0x5'))(_0xbdb4('0x6'));var config=require(_0xbdb4('0x7'));var jayson=require(_0xbdb4('0x8'));var client=jayson[_0xbdb4('0x9')][_0xbdb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dcaa1,_0x565f24,_0x5b0b37){return new BPromise(function(_0x1345fd,_0x3a2b2d){return client[_0xbdb4('0xb')](_0x1dcaa1,_0x5b0b37)[_0xbdb4('0xc')](function(_0x57ded4){logger[_0xbdb4('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x565f24,_0xbdb4('0xe'));logger[_0xbdb4('0xf')](_0xbdb4('0x10'),_0x565f24,'request\x20sent',JSON['stringify'](_0x57ded4));if(_0x57ded4[_0xbdb4('0x11')]){if(_0x57ded4[_0xbdb4('0x11')][_0xbdb4('0x12')]===0x1f4){logger[_0xbdb4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x565f24,_0x57ded4['error'][_0xbdb4('0x13')]);return _0x3a2b2d(_0x57ded4[_0xbdb4('0x11')][_0xbdb4('0x13')]);}logger[_0xbdb4('0x11')](_0xbdb4('0x14'),_0x565f24,_0x57ded4[_0xbdb4('0x11')]['message']);return _0x1345fd(_0x57ded4['error'][_0xbdb4('0x13')]);}else{logger[_0xbdb4('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x565f24,_0xbdb4('0xe'));_0x1345fd(_0x57ded4[_0xbdb4('0x15')]['message']);}})['catch'](function(_0x3b7c35){logger[_0xbdb4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x565f24,_0x3b7c35);_0x3a2b2d(_0x3b7c35);});});} \ No newline at end of file +var _0xfd2f=['error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x28836b,_0x389433){var _0x51f3f8=function(_0x503226){while(--_0x503226){_0x28836b['push'](_0x28836b['shift']());}};_0x51f3f8(++_0x389433);}(_0xfd2f,0x14a));var _0xffd2=function(_0x1d4674,_0x2371ae){_0x1d4674=_0x1d4674-0x0;var _0x3b9ed7=_0xfd2f[_0x1d4674];return _0x3b9ed7;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var moment=require(_0xffd2('0x2'));var BPromise=require('bluebird');var rs=require(_0xffd2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd2('0x4'))['db'];var utils=require(_0xffd2('0x5'));var logger=require('../../config/logger')(_0xffd2('0x6'));var config=require(_0xffd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd5e752,_0x2074e0,_0x56a1e2){return new BPromise(function(_0x35d327,_0x5b24ca){return client['request'](_0xd5e752,_0x56a1e2)[_0xffd2('0x8')](function(_0x15e33f){logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,'request\x20sent');logger[_0xffd2('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2074e0,'request\x20sent',JSON['stringify'](_0x15e33f));if(_0x15e33f[_0xffd2('0xc')]){if(_0x15e33f[_0xffd2('0xc')][_0xffd2('0xd')]===0x1f4){logger[_0xffd2('0xc')](_0xffd2('0xa'),_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x5b24ca(_0x15e33f['error']['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x2074e0,_0x15e33f[_0xffd2('0xc')][_0xffd2('0xe')]);return _0x35d327(_0x15e33f['error'][_0xffd2('0xe')]);}else{logger[_0xffd2('0x9')](_0xffd2('0xa'),_0x2074e0,_0xffd2('0xf'));_0x35d327(_0x15e33f[_0xffd2('0x10')][_0xffd2('0xe')]);}})[_0xffd2('0x11')](function(_0x132d38){logger[_0xffd2('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2074e0,_0x132d38);_0x5b24ca(_0x132d38);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index f3c7914..6b1c047 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 _0x2fc9=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fc9,0xc2));var _0x92fc=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x2fc9[_0x178f52];return _0x556f99;};'use strict';var multer=require('multer');var util=require(_0x92fc('0x0'));var path=require(_0x92fc('0x1'));var timeout=require(_0x92fc('0x2'));var express=require(_0x92fc('0x3'));var router=express[_0x92fc('0x4')]();var fs_extra=require(_0x92fc('0x5'));var auth=require(_0x92fc('0x6'));var interaction=require(_0x92fc('0x7'));var config=require(_0x92fc('0x8'));var controller=require(_0x92fc('0x9'));router[_0x92fc('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x92fc('0xb'),auth[_0x92fc('0xc')](),controller[_0x92fc('0xd')]);router[_0x92fc('0xe')]('/',auth[_0x92fc('0xc')](),controller[_0x92fc('0xf')]);router[_0x92fc('0x10')]('/:id',auth[_0x92fc('0xc')](),controller[_0x92fc('0x11')]);router[_0x92fc('0x12')]('/:id',auth[_0x92fc('0xc')](),controller[_0x92fc('0x13')]);module[_0x92fc('0x14')]=router; \ No newline at end of file +var _0xa3db=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x2e15c0,_0x1d4e79){var _0x385d1b=function(_0x1cc592){while(--_0x1cc592){_0x2e15c0['push'](_0x2e15c0['shift']());}};_0x385d1b(++_0x1d4e79);}(_0xa3db,0x10c));var _0xba3d=function(_0x291b8f,_0x3b8484){_0x291b8f=_0x291b8f-0x0;var _0x3b504b=_0xa3db[_0x291b8f];return _0x3b504b;};'use strict';var multer=require(_0xba3d('0x0'));var util=require(_0xba3d('0x1'));var path=require(_0xba3d('0x2'));var timeout=require(_0xba3d('0x3'));var express=require(_0xba3d('0x4'));var router=express[_0xba3d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba3d('0x6'));var config=require('../../config/environment');var controller=require(_0xba3d('0x7'));router['get']('/',auth[_0xba3d('0x8')](),controller[_0xba3d('0x9')]);router[_0xba3d('0xa')](_0xba3d('0xb'),auth[_0xba3d('0x8')](),controller[_0xba3d('0xc')]);router[_0xba3d('0xd')]('/',auth[_0xba3d('0x8')](),controller[_0xba3d('0xe')]);router[_0xba3d('0xf')](_0xba3d('0xb'),auth['isAuthenticated'](),controller[_0xba3d('0x10')]);router[_0xba3d('0x11')](_0xba3d('0xb'),auth[_0xba3d('0x8')](),controller[_0xba3d('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 2cafe52..4468f2f 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 _0x8857=['sequelize','STRING','TEXT'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8857,0x1dd));var _0x7885=function(_0x4acd05,_0x2100d7){_0x4acd05=_0x4acd05-0x0;var _0x23b16f=_0x8857[_0x4acd05];return _0x23b16f;};'use strict';var Sequelize=require(_0x7885('0x0'));module['exports']={'name':{'type':Sequelize[_0x7885('0x1')]},'description':{'type':Sequelize[_0x7885('0x1')]},'html':{'type':Sequelize[_0x7885('0x2')]}}; \ No newline at end of file +var _0x30e5=['TEXT','sequelize','exports'];(function(_0x2bad4e,_0x583a4f){var _0x43c1c1=function(_0x39af5d){while(--_0x39af5d){_0x2bad4e['push'](_0x2bad4e['shift']());}};_0x43c1c1(++_0x583a4f);}(_0x30e5,0x112));var _0x530e=function(_0x292550,_0x5047bf){_0x292550=_0x292550-0x0;var _0x5e789d=_0x30e5[_0x292550];return _0x5e789d;};'use strict';var Sequelize=require(_0x530e('0x0'));module[_0x530e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x530e('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8f8084b..2a995e8 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 _0x5255=['UserProfileResource','sendStatus','error','stack','name','send','map','Template','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','apply','reject','save','destroy','then','get','Templates'];(function(_0x2dc28c,_0x164a43){var _0x399388=function(_0x112186){while(--_0x112186){_0x2dc28c['push'](_0x2dc28c['shift']());}};_0x399388(++_0x164a43);}(_0x5255,0x1eb));var _0x5525=function(_0x59efdd,_0x8be09a){_0x59efdd=_0x59efdd-0x0;var _0x4da8e4=_0x5255[_0x59efdd];return _0x4da8e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5525('0x0'));var zipdir=require(_0x5525('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5525('0x2'));var BPromise=require(_0x5525('0x3'));var Mustache=require(_0x5525('0x4'));var util=require(_0x5525('0x5'));var path=require(_0x5525('0x6'));var sox=require('sox');var csv=require(_0x5525('0x7'));var ejs=require(_0x5525('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5525('0x9'));var squel=require(_0x5525('0xa'));var crypto=require('crypto');var jsforce=require(_0x5525('0xb'));var deskjs=require(_0x5525('0xc'));var toCsv=require(_0x5525('0x7'));var querystring=require('querystring');var Papa=require(_0x5525('0xd'));var Redis=require(_0x5525('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5525('0xf'));var logger=require(_0x5525('0x10'))('api');var utils=require(_0x5525('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5525('0x12'));var db=require(_0x5525('0x13'))['db'];function respondWithStatusCode(_0x41e225,_0x3f6711){_0x3f6711=_0x3f6711||0xcc;return function(_0x316459){if(_0x316459){return _0x41e225['sendStatus'](_0x3f6711);}return _0x41e225['status'](_0x3f6711)[_0x5525('0x14')]();};}function respondWithResult(_0x1da84c,_0x44ae02){_0x44ae02=_0x44ae02||0xc8;return function(_0x499b38){if(_0x499b38){return _0x1da84c['status'](_0x44ae02)[_0x5525('0x15')](_0x499b38);}};}function respondWithFilteredResult(_0x1c77de,_0x2c5ebb){return function(_0x57b8c3){if(_0x57b8c3){var _0x130e37=typeof _0x2c5ebb[_0x5525('0x16')]===_0x5525('0x17')&&typeof _0x2c5ebb['limit']===_0x5525('0x17');var _0x4ac31b=_0x57b8c3[_0x5525('0x18')];var _0x1baa52=_0x130e37?0x0:_0x2c5ebb[_0x5525('0x16')];var _0x2dd6d3=_0x130e37?_0x57b8c3['count']:_0x2c5ebb[_0x5525('0x16')]+_0x2c5ebb[_0x5525('0x19')];var _0x48fc4e;if(_0x2dd6d3>=_0x4ac31b){_0x2dd6d3=_0x4ac31b;_0x48fc4e=0xc8;}else{_0x48fc4e=0xce;}_0x1c77de[_0x5525('0x1a')](_0x48fc4e);return _0x1c77de['set']('Content-Range',_0x1baa52+'-'+_0x2dd6d3+'/'+_0x4ac31b)[_0x5525('0x15')](_0x57b8c3);}return null;};}function patchUpdates(_0x22b986){return function(_0x1e1dad){try{jsonpatch[_0x5525('0x1b')](_0x1e1dad,_0x22b986,!![]);}catch(_0x42cb16){return BPromise[_0x5525('0x1c')](_0x42cb16);}return _0x1e1dad[_0x5525('0x1d')]();};}function saveUpdates(_0x4b7a41,_0x5e5611){return function(_0x7a8663){if(_0x7a8663){return _0x7a8663['update'](_0x4b7a41)['then'](function(_0x33ab65){return _0x33ab65;});}return null;};}function removeEntity(_0x1941fa,_0x7e98d){return function(_0x43cb52){if(_0x43cb52){return _0x43cb52[_0x5525('0x1e')]()[_0x5525('0x1f')](function(){var _0x3e2baa=_0x43cb52[_0x5525('0x20')]({'plain':!![]});var _0x42aef4=_0x5525('0x21');return db[_0x5525('0x22')][_0x5525('0x1e')]({'where':{'type':_0x42aef4,'resourceId':_0x3e2baa['id']}})[_0x5525('0x1f')](function(){return _0x43cb52;});})['then'](function(){_0x1941fa[_0x5525('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4c0e,_0x21339a){return function(_0x498e7a){if(!_0x498e7a){_0x2b4c0e[_0x5525('0x23')](0x194);}return _0x498e7a;};}function handleError(_0x27d973,_0x56b803){_0x56b803=_0x56b803||0x1f4;return function(_0x4d91ca){logger[_0x5525('0x24')](_0x4d91ca[_0x5525('0x25')]);if(_0x4d91ca[_0x5525('0x26')]){delete _0x4d91ca[_0x5525('0x26')];}_0x27d973[_0x5525('0x1a')](_0x56b803)[_0x5525('0x27')](_0x4d91ca);};}exports['index']=function(_0xb99adf,_0x3df517){var _0x1b411b={},_0x581780={},_0x30ef53={'count':0x0,'rows':[]};var _0x4b6f28=_[_0x5525('0x28')](db[_0x5525('0x29')][_0x5525('0x2a')],function(_0x1688ea){return{'name':_0x1688ea['fieldName'],'type':_0x1688ea[_0x5525('0x2b')][_0x5525('0x2c')]};});_0x581780[_0x5525('0x2d')]=_[_0x5525('0x28')](_0x4b6f28,_0x5525('0x26'));_0x581780[_0x5525('0x2e')]=_['keys'](_0xb99adf[_0x5525('0x2e')]);_0x581780[_0x5525('0x2f')]=_['intersection'](_0x581780[_0x5525('0x2d')],_0x581780[_0x5525('0x2e')]);_0x1b411b[_0x5525('0x30')]=_['intersection'](_0x581780[_0x5525('0x2d')],qs[_0x5525('0x31')](_0xb99adf[_0x5525('0x2e')][_0x5525('0x31')]));_0x1b411b[_0x5525('0x30')]=_0x1b411b[_0x5525('0x30')]['length']?_0x1b411b[_0x5525('0x30')]:_0x581780['model'];if(!_0xb99adf[_0x5525('0x2e')][_0x5525('0x32')]('nolimit')){_0x1b411b['limit']=qs[_0x5525('0x19')](_0xb99adf['query']['limit']);_0x1b411b[_0x5525('0x16')]=qs[_0x5525('0x16')](_0xb99adf['query'][_0x5525('0x16')]);}_0x1b411b[_0x5525('0x33')]=qs[_0x5525('0x34')](_0xb99adf[_0x5525('0x2e')][_0x5525('0x34')]);_0x1b411b[_0x5525('0x35')]=qs[_0x5525('0x2f')](_[_0x5525('0x36')](_0xb99adf[_0x5525('0x2e')],_0x581780['filters']),_0x4b6f28);if(_0xb99adf[_0x5525('0x2e')][_0x5525('0x37')]){_0x1b411b[_0x5525('0x35')]=_['merge'](_0x1b411b[_0x5525('0x35')],{'$or':_[_0x5525('0x28')](_0x4b6f28,function(_0x152591){if(_0x152591[_0x5525('0x2b')]!==_0x5525('0x38')){var _0x1b9082={};_0x1b9082[_0x152591[_0x5525('0x26')]]={'$like':'%'+_0xb99adf[_0x5525('0x2e')]['filter']+'%'};return _0x1b9082;}})});}_0x1b411b=_['merge']({},_0x1b411b,_0xb99adf[_0x5525('0x39')]);var _0x3a9c48={'where':_0x1b411b[_0x5525('0x35')]};return db[_0x5525('0x29')][_0x5525('0x18')](_0x3a9c48)[_0x5525('0x1f')](function(_0x1a9a94){_0x30ef53[_0x5525('0x18')]=_0x1a9a94;if(_0xb99adf['query'][_0x5525('0x3a')]){_0x1b411b[_0x5525('0x3b')]=[{'all':!![]}];}return db[_0x5525('0x29')][_0x5525('0x3c')](_0x1b411b);})[_0x5525('0x1f')](function(_0x689ec8){_0x30ef53['rows']=_0x689ec8;return _0x30ef53;})[_0x5525('0x1f')](respondWithFilteredResult(_0x3df517,_0x1b411b))[_0x5525('0x3d')](handleError(_0x3df517,null));};exports['show']=function(_0x152b74,_0x45f66d){var _0x5cdf26={'raw':!![],'where':{'id':_0x152b74[_0x5525('0x3e')]['id']}},_0x21390f={};_0x21390f[_0x5525('0x2d')]=_['keys'](db[_0x5525('0x29')][_0x5525('0x2a')]);_0x21390f[_0x5525('0x2e')]=_[_0x5525('0x3f')](_0x152b74[_0x5525('0x2e')]);_0x21390f[_0x5525('0x2f')]=_[_0x5525('0x40')](_0x21390f[_0x5525('0x2d')],_0x21390f[_0x5525('0x2e')]);_0x5cdf26['attributes']=_[_0x5525('0x40')](_0x21390f[_0x5525('0x2d')],qs[_0x5525('0x31')](_0x152b74[_0x5525('0x2e')][_0x5525('0x31')]));_0x5cdf26[_0x5525('0x30')]=_0x5cdf26[_0x5525('0x30')][_0x5525('0x41')]?_0x5cdf26[_0x5525('0x30')]:_0x21390f[_0x5525('0x2d')];if(_0x152b74[_0x5525('0x2e')][_0x5525('0x3a')]){_0x5cdf26[_0x5525('0x3b')]=[{'all':!![]}];}_0x5cdf26=_['merge']({},_0x5cdf26,_0x152b74['options']);return db[_0x5525('0x29')][_0x5525('0x42')](_0x5cdf26)['then'](handleEntityNotFound(_0x45f66d,null))[_0x5525('0x1f')](respondWithResult(_0x45f66d,null))[_0x5525('0x3d')](handleError(_0x45f66d,null));};exports[_0x5525('0x43')]=function(_0x5a2e53,_0x22b753){return db[_0x5525('0x29')]['create'](_0x5a2e53[_0x5525('0x44')],{})['then'](function(_0x1935f8){var _0x3737af=_0x5a2e53[_0x5525('0x45')]['get']({'plain':!![]});if(!_0x3737af)throw new Error(_0x5525('0x46'));if(_0x3737af['role']==='user'){var _0x3415ac=_0x1935f8[_0x5525('0x20')]({'plain':!![]});var _0x70b9c4='Templates';return db['UserProfileSection'][_0x5525('0x42')]({'where':{'name':_0x70b9c4,'userProfileId':_0x3737af[_0x5525('0x47')]},'raw':!![]})[_0x5525('0x1f')](function(_0x1ff93b){if(_0x1ff93b&&_0x1ff93b[_0x5525('0x48')]===0x0){return db[_0x5525('0x22')][_0x5525('0x43')]({'name':_0x3415ac[_0x5525('0x26')],'resourceId':_0x3415ac['id'],'type':_0x1ff93b[_0x5525('0x26')],'sectionId':_0x1ff93b['id']},{})[_0x5525('0x1f')](function(){return _0x1935f8;});}else{return _0x1935f8;}})[_0x5525('0x3d')](function(_0x13bf45){logger[_0x5525('0x24')](_0x5525('0x49'),_0x13bf45);throw _0x13bf45;});}return _0x1935f8;})[_0x5525('0x1f')](respondWithResult(_0x22b753,0xc9))[_0x5525('0x3d')](handleError(_0x22b753,null));};exports[_0x5525('0x4a')]=function(_0x1cd4fb,_0x2b852c){if(_0x1cd4fb[_0x5525('0x44')]['id']){delete _0x1cd4fb[_0x5525('0x44')]['id'];}return db[_0x5525('0x29')][_0x5525('0x42')]({'where':{'id':_0x1cd4fb[_0x5525('0x3e')]['id']}})[_0x5525('0x1f')](handleEntityNotFound(_0x2b852c,null))[_0x5525('0x1f')](saveUpdates(_0x1cd4fb['body'],null))[_0x5525('0x1f')](respondWithResult(_0x2b852c,null))[_0x5525('0x3d')](handleError(_0x2b852c,null));};exports['destroy']=function(_0x29c4d7,_0x19db78){return db['Template']['find']({'where':{'id':_0x29c4d7['params']['id']}})[_0x5525('0x1f')](handleEntityNotFound(_0x19db78,null))[_0x5525('0x1f')](removeEntity(_0x19db78,null))[_0x5525('0x3d')](handleError(_0x19db78,null));}; \ No newline at end of file +var _0xafb8=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','error','name','send','index','map','Template','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x1fe8b9,_0xd87696){var _0x25d006=function(_0x35727f){while(--_0x35727f){_0x1fe8b9['push'](_0x1fe8b9['shift']());}};_0x25d006(++_0xd87696);}(_0xafb8,0x18e));var _0x8afb=function(_0x504ed7,_0x30a9bb){_0x504ed7=_0x504ed7-0x0;var _0x418ca0=_0xafb8[_0x504ed7];return _0x418ca0;};'use strict';var emlformat=require(_0x8afb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8afb('0x1'));var jsonpatch=require(_0x8afb('0x2'));var rp=require(_0x8afb('0x3'));var moment=require(_0x8afb('0x4'));var BPromise=require(_0x8afb('0x5'));var Mustache=require('mustache');var util=require(_0x8afb('0x6'));var path=require(_0x8afb('0x7'));var sox=require(_0x8afb('0x8'));var csv=require(_0x8afb('0x9'));var ejs=require(_0x8afb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8afb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8afb('0xc'));var deskjs=require(_0x8afb('0xd'));var toCsv=require(_0x8afb('0x9'));var querystring=require(_0x8afb('0xe'));var Papa=require(_0x8afb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8afb('0x10'));var as=require(_0x8afb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8afb('0x12'))(_0x8afb('0x13'));var utils=require(_0x8afb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8afb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f68e0,_0x1f974b){_0x1f974b=_0x1f974b||0xcc;return function(_0x2f7fb3){if(_0x2f7fb3){return _0x3f68e0[_0x8afb('0x16')](_0x1f974b);}return _0x3f68e0[_0x8afb('0x17')](_0x1f974b)[_0x8afb('0x18')]();};}function respondWithResult(_0x301006,_0x1147c9){_0x1147c9=_0x1147c9||0xc8;return function(_0x202019){if(_0x202019){return _0x301006['status'](_0x1147c9)[_0x8afb('0x19')](_0x202019);}};}function respondWithFilteredResult(_0x56f518,_0x54b5b3){return function(_0x4ad7ad){if(_0x4ad7ad){var _0x112f20=typeof _0x54b5b3[_0x8afb('0x1a')]===_0x8afb('0x1b')&&typeof _0x54b5b3[_0x8afb('0x1c')]===_0x8afb('0x1b');var _0x10c57d=_0x4ad7ad[_0x8afb('0x1d')];var _0x44fd17=_0x112f20?0x0:_0x54b5b3[_0x8afb('0x1a')];var _0x473b08=_0x112f20?_0x4ad7ad[_0x8afb('0x1d')]:_0x54b5b3[_0x8afb('0x1a')]+_0x54b5b3[_0x8afb('0x1c')];var _0x591a82;if(_0x473b08>=_0x10c57d){_0x473b08=_0x10c57d;_0x591a82=0xc8;}else{_0x591a82=0xce;}_0x56f518[_0x8afb('0x17')](_0x591a82);return _0x56f518['set'](_0x8afb('0x1e'),_0x44fd17+'-'+_0x473b08+'/'+_0x10c57d)['json'](_0x4ad7ad);}return null;};}function patchUpdates(_0x295ed2){return function(_0x18132e){try{jsonpatch[_0x8afb('0x1f')](_0x18132e,_0x295ed2,!![]);}catch(_0x13a977){return BPromise[_0x8afb('0x20')](_0x13a977);}return _0x18132e['save']();};}function saveUpdates(_0x41e7a4,_0xae477d){return function(_0x470a35){if(_0x470a35){return _0x470a35[_0x8afb('0x21')](_0x41e7a4)[_0x8afb('0x22')](function(_0x57b0a9){return _0x57b0a9;});}return null;};}function removeEntity(_0x18dbd4,_0x2e285c){return function(_0x4804ae){if(_0x4804ae){return _0x4804ae[_0x8afb('0x23')]()['then'](function(){var _0x1460a7=_0x4804ae[_0x8afb('0x24')]({'plain':!![]});var _0xa76d1c='Templates';return db['UserProfileResource']['destroy']({'where':{'type':_0xa76d1c,'resourceId':_0x1460a7['id']}})[_0x8afb('0x22')](function(){return _0x4804ae;});})[_0x8afb('0x22')](function(){_0x18dbd4['status'](0xcc)[_0x8afb('0x18')]();});}};}function handleEntityNotFound(_0x552375,_0x5f2ec4){return function(_0x557781){if(!_0x557781){_0x552375[_0x8afb('0x16')](0x194);}return _0x557781;};}function handleError(_0xd0218e,_0x102c46){_0x102c46=_0x102c46||0x1f4;return function(_0x9ff304){logger[_0x8afb('0x25')](_0x9ff304['stack']);if(_0x9ff304[_0x8afb('0x26')]){delete _0x9ff304['name'];}_0xd0218e['status'](_0x102c46)[_0x8afb('0x27')](_0x9ff304);};}exports[_0x8afb('0x28')]=function(_0x26fea2,_0x4b3a27){var _0xd9b23={},_0x17676c={},_0x29c36c={'count':0x0,'rows':[]};var _0x514939=_[_0x8afb('0x29')](db[_0x8afb('0x2a')]['rawAttributes'],function(_0x546a36){return{'name':_0x546a36[_0x8afb('0x2b')],'type':_0x546a36['type'][_0x8afb('0x2c')]};});_0x17676c[_0x8afb('0x2d')]=_[_0x8afb('0x29')](_0x514939,'name');_0x17676c[_0x8afb('0x2e')]=_[_0x8afb('0x2f')](_0x26fea2[_0x8afb('0x2e')]);_0x17676c['filters']=_[_0x8afb('0x30')](_0x17676c[_0x8afb('0x2d')],_0x17676c[_0x8afb('0x2e')]);_0xd9b23[_0x8afb('0x31')]=_[_0x8afb('0x30')](_0x17676c[_0x8afb('0x2d')],qs['fields'](_0x26fea2['query'][_0x8afb('0x32')]));_0xd9b23[_0x8afb('0x31')]=_0xd9b23[_0x8afb('0x31')][_0x8afb('0x33')]?_0xd9b23[_0x8afb('0x31')]:_0x17676c['model'];if(!_0x26fea2['query'][_0x8afb('0x34')]('nolimit')){_0xd9b23[_0x8afb('0x1c')]=qs[_0x8afb('0x1c')](_0x26fea2['query'][_0x8afb('0x1c')]);_0xd9b23['offset']=qs[_0x8afb('0x1a')](_0x26fea2['query'][_0x8afb('0x1a')]);}_0xd9b23[_0x8afb('0x35')]=qs[_0x8afb('0x36')](_0x26fea2['query']['sort']);_0xd9b23['where']=qs[_0x8afb('0x37')](_[_0x8afb('0x38')](_0x26fea2['query'],_0x17676c[_0x8afb('0x37')]),_0x514939);if(_0x26fea2['query'][_0x8afb('0x39')]){_0xd9b23[_0x8afb('0x3a')]=_['merge'](_0xd9b23[_0x8afb('0x3a')],{'$or':_[_0x8afb('0x29')](_0x514939,function(_0x1f15b6){if(_0x1f15b6[_0x8afb('0x3b')]!==_0x8afb('0x3c')){var _0x43eb80={};_0x43eb80[_0x1f15b6[_0x8afb('0x26')]]={'$like':'%'+_0x26fea2[_0x8afb('0x2e')][_0x8afb('0x39')]+'%'};return _0x43eb80;}})});}_0xd9b23=_[_0x8afb('0x3d')]({},_0xd9b23,_0x26fea2[_0x8afb('0x3e')]);var _0x9bbd95={'where':_0xd9b23['where']};return db[_0x8afb('0x2a')][_0x8afb('0x1d')](_0x9bbd95)[_0x8afb('0x22')](function(_0x39363c){_0x29c36c[_0x8afb('0x1d')]=_0x39363c;if(_0x26fea2[_0x8afb('0x2e')][_0x8afb('0x3f')]){_0xd9b23[_0x8afb('0x40')]=[{'all':!![]}];}return db[_0x8afb('0x2a')][_0x8afb('0x41')](_0xd9b23);})[_0x8afb('0x22')](function(_0x36cb5d){_0x29c36c[_0x8afb('0x42')]=_0x36cb5d;return _0x29c36c;})[_0x8afb('0x22')](respondWithFilteredResult(_0x4b3a27,_0xd9b23))[_0x8afb('0x43')](handleError(_0x4b3a27,null));};exports[_0x8afb('0x44')]=function(_0xa64681,_0x4173c4){var _0x594924={'raw':!![],'where':{'id':_0xa64681['params']['id']}},_0x15538d={};_0x15538d['model']=_[_0x8afb('0x2f')](db[_0x8afb('0x2a')][_0x8afb('0x45')]);_0x15538d[_0x8afb('0x2e')]=_['keys'](_0xa64681[_0x8afb('0x2e')]);_0x15538d[_0x8afb('0x37')]=_[_0x8afb('0x30')](_0x15538d[_0x8afb('0x2d')],_0x15538d[_0x8afb('0x2e')]);_0x594924[_0x8afb('0x31')]=_[_0x8afb('0x30')](_0x15538d[_0x8afb('0x2d')],qs[_0x8afb('0x32')](_0xa64681[_0x8afb('0x2e')]['fields']));_0x594924['attributes']=_0x594924['attributes']['length']?_0x594924[_0x8afb('0x31')]:_0x15538d[_0x8afb('0x2d')];if(_0xa64681[_0x8afb('0x2e')][_0x8afb('0x3f')]){_0x594924[_0x8afb('0x40')]=[{'all':!![]}];}_0x594924=_['merge']({},_0x594924,_0xa64681[_0x8afb('0x3e')]);return db[_0x8afb('0x2a')]['find'](_0x594924)['then'](handleEntityNotFound(_0x4173c4,null))[_0x8afb('0x22')](respondWithResult(_0x4173c4,null))[_0x8afb('0x43')](handleError(_0x4173c4,null));};exports[_0x8afb('0x46')]=function(_0x1fa6a9,_0x53d49a){return db[_0x8afb('0x2a')][_0x8afb('0x46')](_0x1fa6a9[_0x8afb('0x47')],{})[_0x8afb('0x22')](function(_0x2255d6){var _0x26fb52=_0x1fa6a9[_0x8afb('0x48')][_0x8afb('0x24')]({'plain':!![]});if(!_0x26fb52)throw new Error(_0x8afb('0x49'));if(_0x26fb52[_0x8afb('0x4a')]===_0x8afb('0x48')){var _0x397547=_0x2255d6['get']({'plain':!![]});var _0x2b4dc='Templates';return db[_0x8afb('0x4b')][_0x8afb('0x4c')]({'where':{'name':_0x2b4dc,'userProfileId':_0x26fb52[_0x8afb('0x4d')]},'raw':!![]})[_0x8afb('0x22')](function(_0x3b79fa){if(_0x3b79fa&&_0x3b79fa[_0x8afb('0x4e')]===0x0){return db[_0x8afb('0x4f')][_0x8afb('0x46')]({'name':_0x397547[_0x8afb('0x26')],'resourceId':_0x397547['id'],'type':_0x3b79fa[_0x8afb('0x26')],'sectionId':_0x3b79fa['id']},{})[_0x8afb('0x22')](function(){return _0x2255d6;});}else{return _0x2255d6;}})[_0x8afb('0x43')](function(_0x12c025){logger['error'](_0x8afb('0x50'),_0x12c025);throw _0x12c025;});}return _0x2255d6;})[_0x8afb('0x22')](respondWithResult(_0x53d49a,0xc9))[_0x8afb('0x43')](handleError(_0x53d49a,null));};exports[_0x8afb('0x21')]=function(_0x5e08cd,_0x47b8c4){if(_0x5e08cd['body']['id']){delete _0x5e08cd[_0x8afb('0x47')]['id'];}return db[_0x8afb('0x2a')][_0x8afb('0x4c')]({'where':{'id':_0x5e08cd['params']['id']}})[_0x8afb('0x22')](handleEntityNotFound(_0x47b8c4,null))[_0x8afb('0x22')](saveUpdates(_0x5e08cd['body'],null))['then'](respondWithResult(_0x47b8c4,null))[_0x8afb('0x43')](handleError(_0x47b8c4,null));};exports['destroy']=function(_0x5ca2f8,_0x3a756f){return db[_0x8afb('0x2a')][_0x8afb('0x4c')]({'where':{'id':_0x5ca2f8[_0x8afb('0x51')]['id']}})[_0x8afb('0x22')](handleEntityNotFound(_0x3a756f,null))['then'](removeEntity(_0x3a756f,null))[_0x8afb('0x43')](handleError(_0x3a756f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 76c97c1..d779c66 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 _0x6e28=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','define','Template','tools_templates'];(function(_0xcba371,_0x5ae6e4){var _0x1afb50=function(_0x21134e){while(--_0x21134e){_0xcba371['push'](_0xcba371['shift']());}};_0x1afb50(++_0x5ae6e4);}(_0x6e28,0x12c));var _0x86e2=function(_0x285a09,_0x6c5f6e){_0x285a09=_0x285a09-0x0;var _0x2da757=_0x6e28[_0x285a09];return _0x2da757;};'use strict';var _=require(_0x86e2('0x0'));var util=require(_0x86e2('0x1'));var logger=require(_0x86e2('0x2'))('api');var moment=require(_0x86e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x86e2('0x4'));var fs=require('fs');var path=require(_0x86e2('0x5'));var rimraf=require(_0x86e2('0x6'));var config=require('../../config/environment');var attributes=require('./template.attributes');module['exports']=function(_0x16238e,_0x2a9120){return _0x16238e[_0x86e2('0x7')](_0x86e2('0x8'),attributes,{'tableName':_0x86e2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4033=['Template','tools_templates','lodash','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x1e4af8,_0x2cf263){var _0x28ce85=function(_0x40019c){while(--_0x40019c){_0x1e4af8['push'](_0x1e4af8['shift']());}};_0x28ce85(++_0x2cf263);}(_0x4033,0xfe));var _0x3403=function(_0x4ccf96,_0x34978e){_0x4ccf96=_0x4ccf96-0x0;var _0xd103b7=_0x4033[_0x4ccf96];return _0xd103b7;};'use strict';var _=require(_0x3403('0x0'));var util=require('util');var logger=require(_0x3403('0x1'))('api');var moment=require(_0x3403('0x2'));var BPromise=require('bluebird');var rp=require(_0x3403('0x3'));var fs=require('fs');var path=require(_0x3403('0x4'));var rimraf=require('rimraf');var config=require(_0x3403('0x5'));var attributes=require('./template.attributes');module[_0x3403('0x6')]=function(_0x2dda82,_0x381053){return _0x2dda82['define'](_0x3403('0x7'),attributes,{'tableName':_0x3403('0x8'),'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 0586566..6e99cc7 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 _0xa58e=['Template','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','Template,\x20%s,\x20%s','message','request\x20sent','catch','GetTemplate'];(function(_0x41200a,_0x929307){var _0x474ee4=function(_0x547dfe){while(--_0x547dfe){_0x41200a['push'](_0x41200a['shift']());}};_0x474ee4(++_0x929307);}(_0xa58e,0x172));var _0xea58=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa58e[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xea58('0x0'));var util=require('util');var moment=require(_0xea58('0x1'));var BPromise=require(_0xea58('0x2'));var rs=require(_0xea58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea58('0x5'))(_0xea58('0x6'));var config=require('../../config/environment');var jayson=require(_0xea58('0x7'));var client=jayson[_0xea58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dfb24,_0x3b9805,_0x2dc007){return new BPromise(function(_0x4d9150,_0x363937){return client[_0xea58('0x9')](_0x5dfb24,_0x2dc007)['then'](function(_0x417f7e){logger[_0xea58('0xa')]('Template,\x20%s,\x20%s',_0x3b9805,'request\x20sent');logger[_0xea58('0xb')](_0xea58('0xc'),_0x3b9805,'request\x20sent',JSON[_0xea58('0xd')](_0x417f7e));if(_0x417f7e[_0xea58('0xe')]){if(_0x417f7e['error']['code']===0x1f4){logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);return _0x363937(_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);}logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x417f7e['error']['message']);return _0x4d9150(_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);}else{logger[_0xea58('0xa')](_0xea58('0xf'),_0x3b9805,_0xea58('0x11'));_0x4d9150(_0x417f7e['result'][_0xea58('0x10')]);}})[_0xea58('0x12')](function(_0x518e75){logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x518e75);_0x363937(_0x518e75);});});}exports[_0xea58('0x13')]=function(_0x540a25){var _0x4d3311=this;return new Promise(function(_0x523160,_0x27efe1){return db[_0xea58('0x14')][_0xea58('0x15')]({'raw':_0x540a25[_0xea58('0x16')]?_0x540a25['options'][_0xea58('0x17')]===undefined?!![]:![]:!![],'where':_0x540a25[_0xea58('0x16')]?_0x540a25[_0xea58('0x16')][_0xea58('0x18')]||null:null,'attributes':_0x540a25['options']?_0x540a25['options'][_0xea58('0x19')]||null:null,'limit':_0x540a25['options']?_0x540a25['options'][_0xea58('0x1a')]||null:null,'include':_0x540a25['options']?_0x540a25[_0xea58('0x16')][_0xea58('0x1b')]?_[_0xea58('0x1c')](_0x540a25[_0xea58('0x16')][_0xea58('0x1b')],function(_0x2acb8d){return{'model':db[_0x2acb8d[_0xea58('0x1d')]],'as':_0x2acb8d['as'],'attributes':_0x2acb8d['attributes'],'include':_0x2acb8d[_0xea58('0x1b')]?_[_0xea58('0x1c')](_0x2acb8d[_0xea58('0x1b')],function(_0x32de75){return{'model':db[_0x32de75['model']],'as':_0x32de75['as'],'attributes':_0x32de75[_0xea58('0x19')],'include':_0x32de75[_0xea58('0x1b')]?_[_0xea58('0x1c')](_0x32de75[_0xea58('0x1b')],function(_0x2f5997){return{'model':db[_0x2f5997[_0xea58('0x1d')]],'as':_0x2f5997['as'],'attributes':_0x2f5997[_0xea58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x271303){logger[_0xea58('0xa')]('GetTemplate',_0x540a25);logger[_0xea58('0xb')](_0xea58('0x13'),_0x540a25,JSON[_0xea58('0xd')](_0x271303));_0x523160(_0x271303);})['catch'](function(_0x11c1c3){logger['error']('GetTemplate',_0x11c1c3['message'],_0x540a25);_0x27efe1(_0x4d3311[_0xea58('0xe')](0x1f4,_0x11c1c3[_0xea58('0x10')]));});});}; \ No newline at end of file +var _0x3d55=['message','info','result','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3ee882,_0x4e444f){var _0x118330=function(_0x2e92ec){while(--_0x2e92ec){_0x3ee882['push'](_0x3ee882['shift']());}};_0x118330(++_0x4e444f);}(_0x3d55,0x141));var _0x53d5=function(_0x4aa2ec,_0x3d552a){_0x4aa2ec=_0x4aa2ec-0x0;var _0x534708=_0x3d55[_0x4aa2ec];return _0x534708;};'use strict';var _=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var moment=require(_0x53d5('0x2'));var BPromise=require(_0x53d5('0x3'));var rs=require(_0x53d5('0x4'));var fs=require('fs');var Redis=require(_0x53d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x53d5('0x6'));var logger=require(_0x53d5('0x7'))(_0x53d5('0x8'));var config=require('../../config/environment');var jayson=require(_0x53d5('0x9'));var client=jayson[_0x53d5('0xa')][_0x53d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7757,_0x508d0a,_0x3cb107){return new BPromise(function(_0x15a422,_0x50fbe7){return client[_0x53d5('0xc')](_0x4a7757,_0x3cb107)[_0x53d5('0xd')](function(_0x478e73){logger['info'](_0x53d5('0xe'),_0x508d0a,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x508d0a,_0x53d5('0xf'),JSON[_0x53d5('0x10')](_0x478e73));if(_0x478e73[_0x53d5('0x11')]){if(_0x478e73[_0x53d5('0x11')][_0x53d5('0x12')]===0x1f4){logger['error'](_0x53d5('0xe'),_0x508d0a,_0x478e73['error'][_0x53d5('0x13')]);return _0x50fbe7(_0x478e73[_0x53d5('0x11')][_0x53d5('0x13')]);}logger[_0x53d5('0x11')](_0x53d5('0xe'),_0x508d0a,_0x478e73[_0x53d5('0x11')][_0x53d5('0x13')]);return _0x15a422(_0x478e73[_0x53d5('0x11')]['message']);}else{logger[_0x53d5('0x14')](_0x53d5('0xe'),_0x508d0a,'request\x20sent');_0x15a422(_0x478e73[_0x53d5('0x15')]['message']);}})['catch'](function(_0x5c7049){logger[_0x53d5('0x11')](_0x53d5('0xe'),_0x508d0a,_0x5c7049);_0x50fbe7(_0x5c7049);});});}exports['GetTemplate']=function(_0x599eca){var _0x67739b=this;return new Promise(function(_0xbf905f,_0x87d85c){return db[_0x53d5('0x16')][_0x53d5('0x17')]({'raw':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')][_0x53d5('0x19')]===undefined?!![]:![]:!![],'where':_0x599eca['options']?_0x599eca[_0x53d5('0x18')][_0x53d5('0x1a')]||null:null,'attributes':_0x599eca['options']?_0x599eca[_0x53d5('0x18')]['attributes']||null:null,'limit':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')]['limit']||null:null,'include':_0x599eca[_0x53d5('0x18')]?_0x599eca[_0x53d5('0x18')][_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x599eca[_0x53d5('0x18')][_0x53d5('0x1b')],function(_0x207eb3){return{'model':db[_0x207eb3[_0x53d5('0x1d')]],'as':_0x207eb3['as'],'attributes':_0x207eb3[_0x53d5('0x1e')],'include':_0x207eb3[_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x207eb3['include'],function(_0x44a91e){return{'model':db[_0x44a91e['model']],'as':_0x44a91e['as'],'attributes':_0x44a91e[_0x53d5('0x1e')],'include':_0x44a91e[_0x53d5('0x1b')]?_[_0x53d5('0x1c')](_0x44a91e[_0x53d5('0x1b')],function(_0x2c0421){return{'model':db[_0x2c0421[_0x53d5('0x1d')]],'as':_0x2c0421['as'],'attributes':_0x2c0421[_0x53d5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x53d5('0xd')](function(_0x30f1b2){logger[_0x53d5('0x14')](_0x53d5('0x1f'),_0x599eca);logger[_0x53d5('0x20')]('GetTemplate',_0x599eca,JSON[_0x53d5('0x10')](_0x30f1b2));_0xbf905f(_0x30f1b2);})[_0x53d5('0x21')](function(_0x3a7c92){logger[_0x53d5('0x11')](_0x53d5('0x1f'),_0x3a7c92[_0x53d5('0x13')],_0x599eca);_0x87d85c(_0x67739b[_0x53d5('0x11')](0x1f4,_0x3a7c92[_0x53d5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index af0a42d..82f37cc 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 _0xbafa=['connect-timeout','express','fs-extra','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','destroy','exports','multer','util'];(function(_0x2c6c05,_0x197597){var _0x391697=function(_0x5d98a4){while(--_0x5d98a4){_0x2c6c05['push'](_0x2c6c05['shift']());}};_0x391697(++_0x197597);}(_0xbafa,0x66));var _0xabaf=function(_0x5c3f86,_0xd9c394){_0x5c3f86=_0x5c3f86-0x0;var _0x2a473d=_0xbafa[_0x5c3f86];return _0x2a473d;};'use strict';var multer=require(_0xabaf('0x0'));var util=require(_0xabaf('0x1'));var path=require('path');var timeout=require(_0xabaf('0x2'));var express=require(_0xabaf('0x3'));var router=express['Router']();var fs_extra=require(_0xabaf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabaf('0x5'));var config=require('../../config/environment');var controller=require(_0xabaf('0x6'));router[_0xabaf('0x7')]('/',auth[_0xabaf('0x8')](),controller[_0xabaf('0x9')]);router['get'](_0xabaf('0xa'),auth['isAuthenticated'](),controller[_0xabaf('0xb')]);router[_0xabaf('0x7')](_0xabaf('0xc'),auth[_0xabaf('0x8')](),controller[_0xabaf('0xd')]);router[_0xabaf('0x7')](_0xabaf('0xe'),auth[_0xabaf('0x8')](),controller[_0xabaf('0xf')]);router[_0xabaf('0x7')](_0xabaf('0x10'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x11')]);router[_0xabaf('0x12')]('/',auth[_0xabaf('0x8')](),controller['create']);router[_0xabaf('0x12')](_0xabaf('0xc'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x13')]);router['post'](_0xabaf('0xe'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x14')]);router[_0xabaf('0x12')](_0xabaf('0x10'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x15')]);router[_0xabaf('0x16')](_0xabaf('0xa'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x17')]);router['delete'](_0xabaf('0xa'),auth[_0xabaf('0x8')](),controller[_0xabaf('0x18')]);module[_0xabaf('0x19')]=router; \ No newline at end of file +var _0xa38c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','delete','destroy','multer','util','connect-timeout'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xa38c,0x1bd));var _0xca38=function(_0x35104c,_0x343f63){_0x35104c=_0x35104c-0x0;var _0x24e5a6=_0xa38c[_0x35104c];return _0x24e5a6;};'use strict';var multer=require(_0xca38('0x0'));var util=require(_0xca38('0x1'));var path=require('path');var timeout=require(_0xca38('0x2'));var express=require(_0xca38('0x3'));var router=express[_0xca38('0x4')]();var fs_extra=require(_0xca38('0x5'));var auth=require(_0xca38('0x6'));var interaction=require(_0xca38('0x7'));var config=require(_0xca38('0x8'));var controller=require(_0xca38('0x9'));router[_0xca38('0xa')]('/',auth[_0xca38('0xb')](),controller[_0xca38('0xc')]);router['get'](_0xca38('0xd'),auth[_0xca38('0xb')](),controller[_0xca38('0xe')]);router[_0xca38('0xa')](_0xca38('0xf'),auth[_0xca38('0xb')](),controller[_0xca38('0x10')]);router[_0xca38('0xa')]('/:id/any_conditions',auth[_0xca38('0xb')](),controller[_0xca38('0x11')]);router[_0xca38('0xa')]('/:id/actions',auth[_0xca38('0xb')](),controller[_0xca38('0x12')]);router[_0xca38('0x13')]('/',auth['isAuthenticated'](),controller[_0xca38('0x14')]);router[_0xca38('0x13')](_0xca38('0xf'),auth[_0xca38('0xb')](),controller[_0xca38('0x15')]);router[_0xca38('0x13')]('/:id/any_conditions',auth[_0xca38('0xb')](),controller[_0xca38('0x16')]);router[_0xca38('0x13')](_0xca38('0x17'),auth[_0xca38('0xb')](),controller[_0xca38('0x18')]);router[_0xca38('0x19')]('/:id',auth[_0xca38('0xb')](),controller['update']);router[_0xca38('0x1a')](_0xca38('0xd'),auth[_0xca38('0xb')](),controller[_0xca38('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 928b1aa..836ef49 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 _0x86ea=['STRING','BOOLEAN','sequelize'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0x86ea,0x86));var _0xa86e=function(_0x1f0b27,_0x44cbb2){_0x1f0b27=_0x1f0b27-0x0;var _0x4556ee=_0x86ea[_0x1f0b27];return _0x4556ee;};'use strict';var Sequelize=require(_0xa86e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa86e('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa86e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8b3=['exports','STRING','sequelize'];(function(_0x49de12,_0x14458f){var _0x400593=function(_0x4f8054){while(--_0x4f8054){_0x49de12['push'](_0x49de12['shift']());}};_0x400593(++_0x14458f);}(_0xb8b3,0x1a0));var _0x3b8b=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xb8b3[_0x11f226];return _0x30be77;};'use strict';var Sequelize=require(_0x3b8b('0x0'));module[_0x3b8b('0x1')]={'name':{'type':Sequelize[_0x3b8b('0x2')]},'channel':{'type':Sequelize[_0x3b8b('0x2')]},'description':{'type':Sequelize[_0x3b8b('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index ca716aa..c4a674b 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 _0x5f1c=['create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','order','hasOwnProperty','TriggerId','Action','getActions','eml-format','rimraf','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','destroy','then','get','Triggers','UserProfileResource','name','send','index','Trigger','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','options'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x5f1c,0x74));var _0xc5f1=function(_0x50c980,_0xa9b56c){_0x50c980=_0x50c980-0x0;var _0x1645d6=_0x5f1c[_0x50c980];return _0x1645d6;};'use strict';var emlformat=require(_0xc5f1('0x0'));var rimraf=require(_0xc5f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5f1('0x2'));var BPromise=require(_0xc5f1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc5f1('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc5f1('0x5'));var fs=require('fs');var fs_extra=require(_0xc5f1('0x6'));var _=require(_0xc5f1('0x7'));var squel=require(_0xc5f1('0x8'));var crypto=require(_0xc5f1('0x9'));var jsforce=require(_0xc5f1('0xa'));var deskjs=require(_0xc5f1('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc5f1('0xc'));var Papa=require(_0xc5f1('0xd'));var Redis=require(_0xc5f1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc5f1('0xf'));var hardwareService=require(_0xc5f1('0x10'));var logger=require(_0xc5f1('0x11'))('api');var utils=require(_0xc5f1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc5f1('0x13'));var db=require(_0xc5f1('0x14'))['db'];function respondWithStatusCode(_0x3a79d0,_0x6160ce){_0x6160ce=_0x6160ce||0xcc;return function(_0x48cf31){if(_0x48cf31){return _0x3a79d0[_0xc5f1('0x15')](_0x6160ce);}return _0x3a79d0['status'](_0x6160ce)[_0xc5f1('0x16')]();};}function respondWithResult(_0x474feb,_0x4e5fea){_0x4e5fea=_0x4e5fea||0xc8;return function(_0x197699){if(_0x197699){return _0x474feb[_0xc5f1('0x17')](_0x4e5fea)[_0xc5f1('0x18')](_0x197699);}};}function respondWithFilteredResult(_0x251f24,_0xafdfb4){return function(_0x4a18cf){if(_0x4a18cf){var _0x46f072=typeof _0xafdfb4[_0xc5f1('0x19')]===_0xc5f1('0x1a')&&typeof _0xafdfb4[_0xc5f1('0x1b')]===_0xc5f1('0x1a');var _0x4df3d5=_0x4a18cf[_0xc5f1('0x1c')];var _0x4fa229=_0x46f072?0x0:_0xafdfb4[_0xc5f1('0x19')];var _0x20c3f9=_0x46f072?_0x4a18cf[_0xc5f1('0x1c')]:_0xafdfb4[_0xc5f1('0x19')]+_0xafdfb4['limit'];var _0x49e0a5;if(_0x20c3f9>=_0x4df3d5){_0x20c3f9=_0x4df3d5;_0x49e0a5=0xc8;}else{_0x49e0a5=0xce;}_0x251f24[_0xc5f1('0x17')](_0x49e0a5);return _0x251f24[_0xc5f1('0x1d')]('Content-Range',_0x4fa229+'-'+_0x20c3f9+'/'+_0x4df3d5)[_0xc5f1('0x18')](_0x4a18cf);}return null;};}function patchUpdates(_0x16bb74){return function(_0x5c8454){try{jsonpatch[_0xc5f1('0x1e')](_0x5c8454,_0x16bb74,!![]);}catch(_0xdc828d){return BPromise[_0xc5f1('0x1f')](_0xdc828d);}return _0x5c8454['save']();};}function saveUpdates(_0x5acc61,_0x416fe9){return function(_0x442a9b){if(_0x442a9b){return _0x442a9b['update'](_0x5acc61)['then'](function(_0x1c2e85){return _0x1c2e85;});}return null;};}function removeEntity(_0x361932,_0x237226){return function(_0xed5d71){if(_0xed5d71){return _0xed5d71[_0xc5f1('0x20')]()[_0xc5f1('0x21')](function(){var _0x4b2c47=_0xed5d71[_0xc5f1('0x22')]({'plain':!![]});var _0x326930=_0xc5f1('0x23');return db[_0xc5f1('0x24')]['destroy']({'where':{'type':_0x326930,'resourceId':_0x4b2c47['id']}})['then'](function(){return _0xed5d71;});})[_0xc5f1('0x21')](function(){_0x361932[_0xc5f1('0x17')](0xcc)[_0xc5f1('0x16')]();});}};}function handleEntityNotFound(_0x457e33,_0x59f5cc){return function(_0x417280){if(!_0x417280){_0x457e33[_0xc5f1('0x15')](0x194);}return _0x417280;};}function handleError(_0x18bfa2,_0x21c1bf){_0x21c1bf=_0x21c1bf||0x1f4;return function(_0x1f99ad){logger['error'](_0x1f99ad['stack']);if(_0x1f99ad[_0xc5f1('0x25')]){delete _0x1f99ad[_0xc5f1('0x25')];}_0x18bfa2[_0xc5f1('0x17')](_0x21c1bf)[_0xc5f1('0x26')](_0x1f99ad);};}exports[_0xc5f1('0x27')]=function(_0x23356e,_0x17e406){var _0x4e4388={},_0x2a6e8a={},_0x3df1d5={'count':0x0,'rows':[]};var _0x725048=_['map'](db[_0xc5f1('0x28')]['rawAttributes'],function(_0x286e2c){return{'name':_0x286e2c[_0xc5f1('0x29')],'type':_0x286e2c[_0xc5f1('0x2a')][_0xc5f1('0x2b')]};});_0x2a6e8a['model']=_[_0xc5f1('0x2c')](_0x725048,'name');_0x2a6e8a[_0xc5f1('0x2d')]=_[_0xc5f1('0x2e')](_0x23356e[_0xc5f1('0x2d')]);_0x2a6e8a[_0xc5f1('0x2f')]=_[_0xc5f1('0x30')](_0x2a6e8a[_0xc5f1('0x31')],_0x2a6e8a[_0xc5f1('0x2d')]);_0x4e4388[_0xc5f1('0x32')]=_[_0xc5f1('0x30')](_0x2a6e8a[_0xc5f1('0x31')],qs[_0xc5f1('0x33')](_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x33')]));_0x4e4388[_0xc5f1('0x32')]=_0x4e4388['attributes'][_0xc5f1('0x34')]?_0x4e4388['attributes']:_0x2a6e8a[_0xc5f1('0x31')];if(!_0x23356e['query']['hasOwnProperty'](_0xc5f1('0x35'))){_0x4e4388[_0xc5f1('0x1b')]=qs[_0xc5f1('0x1b')](_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x1b')]);_0x4e4388['offset']=qs[_0xc5f1('0x19')](_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x19')]);}_0x4e4388['order']=qs[_0xc5f1('0x36')](_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x36')]);_0x4e4388[_0xc5f1('0x37')]=qs[_0xc5f1('0x2f')](_['pick'](_0x23356e['query'],_0x2a6e8a[_0xc5f1('0x2f')]),_0x725048);if(_0x23356e['query'][_0xc5f1('0x38')]){_0x4e4388[_0xc5f1('0x37')]=_['merge'](_0x4e4388[_0xc5f1('0x37')],{'$or':_[_0xc5f1('0x2c')](_0x725048,function(_0x35c9a0){if(_0x35c9a0[_0xc5f1('0x2a')]!==_0xc5f1('0x39')){var _0x30d6f9={};_0x30d6f9[_0x35c9a0['name']]={'$like':'%'+_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x38')]+'%'};return _0x30d6f9;}})});}_0x4e4388=_['merge']({},_0x4e4388,_0x23356e['options']);var _0x262ee6={'where':_0x4e4388[_0xc5f1('0x37')]};return db[_0xc5f1('0x28')][_0xc5f1('0x1c')](_0x262ee6)[_0xc5f1('0x21')](function(_0x29e485){_0x3df1d5['count']=_0x29e485;if(_0x23356e[_0xc5f1('0x2d')][_0xc5f1('0x3a')]){_0x4e4388[_0xc5f1('0x3b')]=[{'all':!![]}];}return db['Trigger'][_0xc5f1('0x3c')](_0x4e4388);})['then'](function(_0x1512c8){_0x3df1d5[_0xc5f1('0x3d')]=_0x1512c8;return _0x3df1d5;})[_0xc5f1('0x21')](respondWithFilteredResult(_0x17e406,_0x4e4388))[_0xc5f1('0x3e')](handleError(_0x17e406,null));};exports[_0xc5f1('0x3f')]=function(_0x1d82cd,_0x149eec){var _0x2e2466={'raw':![],'where':{'id':_0x1d82cd[_0xc5f1('0x40')]['id']}},_0x56e95b={};_0x56e95b['model']=_[_0xc5f1('0x2e')](db[_0xc5f1('0x28')][_0xc5f1('0x41')]);_0x56e95b[_0xc5f1('0x2d')]=_[_0xc5f1('0x2e')](_0x1d82cd[_0xc5f1('0x2d')]);_0x56e95b[_0xc5f1('0x2f')]=_[_0xc5f1('0x30')](_0x56e95b['model'],_0x56e95b[_0xc5f1('0x2d')]);_0x2e2466[_0xc5f1('0x32')]=_[_0xc5f1('0x30')](_0x56e95b[_0xc5f1('0x31')],qs[_0xc5f1('0x33')](_0x1d82cd[_0xc5f1('0x2d')]['fields']));_0x2e2466[_0xc5f1('0x32')]=_0x2e2466['attributes'][_0xc5f1('0x34')]?_0x2e2466[_0xc5f1('0x32')]:_0x56e95b[_0xc5f1('0x31')];if(_0x1d82cd['query'][_0xc5f1('0x3a')]){_0x2e2466[_0xc5f1('0x3b')]=[{'all':!![]}];}_0x2e2466=_[_0xc5f1('0x42')]({},_0x2e2466,_0x1d82cd[_0xc5f1('0x43')]);return db[_0xc5f1('0x28')]['find'](_0x2e2466)[_0xc5f1('0x21')](handleEntityNotFound(_0x149eec,null))[_0xc5f1('0x21')](respondWithResult(_0x149eec,null))[_0xc5f1('0x3e')](handleError(_0x149eec,null));};exports['create']=function(_0x63ae1e,_0x21881d){return db['Trigger'][_0xc5f1('0x44')](_0x63ae1e[_0xc5f1('0x45')],{})[_0xc5f1('0x21')](function(_0x2f1eb5){var _0x47050c=_0x63ae1e[_0xc5f1('0x46')][_0xc5f1('0x22')]({'plain':!![]});if(!_0x47050c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47050c[_0xc5f1('0x47')]==='user'){var _0x3e8283=_0x2f1eb5[_0xc5f1('0x22')]({'plain':!![]});var _0x294be7=_0xc5f1('0x23');return db[_0xc5f1('0x48')][_0xc5f1('0x49')]({'where':{'name':_0x294be7,'userProfileId':_0x47050c[_0xc5f1('0x4a')]},'raw':!![]})[_0xc5f1('0x21')](function(_0x65e2db){if(_0x65e2db&&_0x65e2db[_0xc5f1('0x4b')]===0x0){return db[_0xc5f1('0x24')]['create']({'name':_0x3e8283[_0xc5f1('0x25')],'resourceId':_0x3e8283['id'],'type':_0x65e2db[_0xc5f1('0x25')],'sectionId':_0x65e2db['id']},{})[_0xc5f1('0x21')](function(){return _0x2f1eb5;});}else{return _0x2f1eb5;}})[_0xc5f1('0x3e')](function(_0x1ed8d6){logger[_0xc5f1('0x4c')](_0xc5f1('0x4d'),_0x1ed8d6);throw _0x1ed8d6;});}return _0x2f1eb5;})[_0xc5f1('0x21')](respondWithResult(_0x21881d,0xc9))['catch'](handleError(_0x21881d,null));};exports[_0xc5f1('0x4e')]=function(_0x759813,_0x57b509){if(_0x759813['body']['id']){delete _0x759813[_0xc5f1('0x45')]['id'];}return db[_0xc5f1('0x28')]['find']({'where':{'id':_0x759813[_0xc5f1('0x40')]['id']}})[_0xc5f1('0x21')](handleEntityNotFound(_0x57b509,null))[_0xc5f1('0x21')](saveUpdates(_0x759813['body'],null))[_0xc5f1('0x21')](respondWithResult(_0x57b509,null))[_0xc5f1('0x3e')](handleError(_0x57b509,null));};exports['destroy']=function(_0x38bcab,_0x18cb01){return db[_0xc5f1('0x28')][_0xc5f1('0x49')]({'where':{'id':_0x38bcab[_0xc5f1('0x40')]['id']}})['then'](handleEntityNotFound(_0x18cb01,null))[_0xc5f1('0x21')](removeEntity(_0x18cb01,null))[_0xc5f1('0x3e')](handleError(_0x18cb01,null));};exports['addAllCondition']=function(_0x275e9a,_0xf568e3,_0x43365d){if(_0x275e9a[_0xc5f1('0x45')]['id']){delete _0x275e9a[_0xc5f1('0x45')]['id'];}return db[_0xc5f1('0x28')]['find']({'where':{'id':_0x275e9a[_0xc5f1('0x40')]['id']}})[_0xc5f1('0x21')](handleEntityNotFound(_0xf568e3,null))[_0xc5f1('0x21')](function(_0x25b278){if(_0x25b278){_0x275e9a[_0xc5f1('0x45')][_0xc5f1('0x4f')]=_0x25b278['id'];return db[_0xc5f1('0x50')][_0xc5f1('0x44')](_0x275e9a['body']);}})['then'](respondWithResult(_0xf568e3,null))[_0xc5f1('0x3e')](handleError(_0xf568e3,null));};exports[_0xc5f1('0x51')]=function(_0x54106c,_0x5d4037,_0x34101e){if(_0x54106c['body']['id']){delete _0x54106c[_0xc5f1('0x45')]['id'];}return db[_0xc5f1('0x28')][_0xc5f1('0x49')]({'where':{'id':_0x54106c[_0xc5f1('0x40')]['id']}})[_0xc5f1('0x21')](handleEntityNotFound(_0x5d4037,null))[_0xc5f1('0x21')](function(_0x1529af){if(_0x1529af){_0x54106c[_0xc5f1('0x45')][_0xc5f1('0x52')]=_0x1529af['id'];return db[_0xc5f1('0x50')][_0xc5f1('0x44')](_0x54106c[_0xc5f1('0x45')]);}})[_0xc5f1('0x21')](respondWithResult(_0x5d4037,null))[_0xc5f1('0x3e')](handleError(_0x5d4037,null));};exports['getAllConditions']=function(_0x4778c2,_0x14d08e,_0x39e842){var _0x4be24b={};var _0x3549f9={};var _0x37e220;var _0x2e4a95;return db[_0xc5f1('0x28')][_0xc5f1('0x53')]({'where':{'id':_0x4778c2['params']['id']}})['then'](handleEntityNotFound(_0x14d08e,null))[_0xc5f1('0x21')](function(_0x3ae577){if(_0x3ae577){_0x37e220=_0x3ae577;_0x3549f9['model']=_[_0xc5f1('0x2e')](db[_0xc5f1('0x50')][_0xc5f1('0x41')]);_0x3549f9[_0xc5f1('0x2d')]=_['keys'](_0x4778c2[_0xc5f1('0x2d')]);_0x3549f9[_0xc5f1('0x2f')]=_[_0xc5f1('0x30')](_0x3549f9[_0xc5f1('0x31')],_0x3549f9[_0xc5f1('0x2d')]);_0x4be24b[_0xc5f1('0x32')]=_[_0xc5f1('0x30')](_0x3549f9[_0xc5f1('0x31')],qs['fields'](_0x4778c2[_0xc5f1('0x2d')][_0xc5f1('0x33')]));_0x4be24b[_0xc5f1('0x32')]=_0x4be24b[_0xc5f1('0x32')]['length']?_0x4be24b[_0xc5f1('0x32')]:_0x3549f9[_0xc5f1('0x31')];_0x4be24b['order']=qs[_0xc5f1('0x36')](_0x4778c2['query'][_0xc5f1('0x36')]);_0x4be24b['where']=qs[_0xc5f1('0x2f')](_[_0xc5f1('0x54')](_0x4778c2[_0xc5f1('0x2d')],_0x3549f9[_0xc5f1('0x2f')]));if(_0x4778c2[_0xc5f1('0x2d')]['filter']){_0x4be24b[_0xc5f1('0x37')]=_[_0xc5f1('0x42')](_0x4be24b['where'],{'$or':_['map'](_0x4be24b[_0xc5f1('0x32')],function(_0x86bbe6){var _0x718e2f={};_0x718e2f[_0x86bbe6]={'$like':'%'+_0x4778c2[_0xc5f1('0x2d')][_0xc5f1('0x38')]+'%'};return _0x718e2f;})});}_0x4be24b=_['merge']({},_0x4be24b,_0x4778c2['options']);return _0x37e220[_0xc5f1('0x55')](_0x4be24b);}})[_0xc5f1('0x21')](function(_0x5ab130){if(_0x5ab130){_0x2e4a95=_0x5ab130[_0xc5f1('0x34')];if(!_0x4778c2[_0xc5f1('0x2d')]['hasOwnProperty'](_0xc5f1('0x35'))){_0x4be24b[_0xc5f1('0x1b')]=qs[_0xc5f1('0x1b')](_0x4778c2['query'][_0xc5f1('0x1b')]);_0x4be24b[_0xc5f1('0x19')]=qs[_0xc5f1('0x19')](_0x4778c2[_0xc5f1('0x2d')]['offset']);}return _0x37e220['getAllConditions'](_0x4be24b);}})[_0xc5f1('0x21')](function(_0x34def2){if(_0x34def2){return _0x34def2?{'count':_0x2e4a95,'rows':_0x34def2}:null;}})['then'](respondWithResult(_0x14d08e,null))[_0xc5f1('0x3e')](handleError(_0x14d08e,null));};exports[_0xc5f1('0x56')]=function(_0x473118,_0x4b0744,_0x3f75a1){var _0x37983b={};var _0x42a2fd={};var _0x1ecac3;var _0x3b0667;return db[_0xc5f1('0x28')][_0xc5f1('0x53')]({'where':{'id':_0x473118[_0xc5f1('0x40')]['id']}})[_0xc5f1('0x21')](handleEntityNotFound(_0x4b0744,null))[_0xc5f1('0x21')](function(_0x3ccfa1){if(_0x3ccfa1){_0x1ecac3=_0x3ccfa1;_0x42a2fd[_0xc5f1('0x31')]=_[_0xc5f1('0x2e')](db['Condition'][_0xc5f1('0x41')]);_0x42a2fd[_0xc5f1('0x2d')]=_[_0xc5f1('0x2e')](_0x473118['query']);_0x42a2fd[_0xc5f1('0x2f')]=_[_0xc5f1('0x30')](_0x42a2fd['model'],_0x42a2fd['query']);_0x37983b['attributes']=_[_0xc5f1('0x30')](_0x42a2fd[_0xc5f1('0x31')],qs[_0xc5f1('0x33')](_0x473118[_0xc5f1('0x2d')]['fields']));_0x37983b[_0xc5f1('0x32')]=_0x37983b[_0xc5f1('0x32')][_0xc5f1('0x34')]?_0x37983b[_0xc5f1('0x32')]:_0x42a2fd[_0xc5f1('0x31')];_0x37983b[_0xc5f1('0x57')]=qs[_0xc5f1('0x36')](_0x473118[_0xc5f1('0x2d')][_0xc5f1('0x36')]);_0x37983b[_0xc5f1('0x37')]=qs[_0xc5f1('0x2f')](_[_0xc5f1('0x54')](_0x473118[_0xc5f1('0x2d')],_0x42a2fd[_0xc5f1('0x2f')]));if(_0x473118[_0xc5f1('0x2d')][_0xc5f1('0x38')]){_0x37983b[_0xc5f1('0x37')]=_[_0xc5f1('0x42')](_0x37983b['where'],{'$or':_[_0xc5f1('0x2c')](_0x37983b[_0xc5f1('0x32')],function(_0x41c9a8){var _0x443cd9={};_0x443cd9[_0x41c9a8]={'$like':'%'+_0x473118['query'][_0xc5f1('0x38')]+'%'};return _0x443cd9;})});}_0x37983b=_['merge']({},_0x37983b,_0x473118[_0xc5f1('0x43')]);return _0x1ecac3['getAnyConditions'](_0x37983b);}})[_0xc5f1('0x21')](function(_0x5e60f9){if(_0x5e60f9){_0x3b0667=_0x5e60f9['length'];if(!_0x473118[_0xc5f1('0x2d')][_0xc5f1('0x58')](_0xc5f1('0x35'))){_0x37983b['limit']=qs['limit'](_0x473118[_0xc5f1('0x2d')]['limit']);_0x37983b[_0xc5f1('0x19')]=qs[_0xc5f1('0x19')](_0x473118['query'][_0xc5f1('0x19')]);}return _0x1ecac3[_0xc5f1('0x56')](_0x37983b);}})[_0xc5f1('0x21')](function(_0x11858d){if(_0x11858d){return _0x11858d?{'count':_0x3b0667,'rows':_0x11858d}:null;}})[_0xc5f1('0x21')](respondWithResult(_0x4b0744,null))[_0xc5f1('0x3e')](handleError(_0x4b0744,null));};exports['addAction']=function(_0x378eb3,_0x2f6655,_0xef72a6){if(_0x378eb3[_0xc5f1('0x45')]['id']){delete _0x378eb3[_0xc5f1('0x45')]['id'];}return db[_0xc5f1('0x28')][_0xc5f1('0x49')]({'where':{'id':_0x378eb3[_0xc5f1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f6655,null))[_0xc5f1('0x21')](function(_0x305ce0){if(_0x305ce0){_0x378eb3[_0xc5f1('0x45')][_0xc5f1('0x59')]=_0x305ce0['id'];return db[_0xc5f1('0x5a')]['create'](_0x378eb3[_0xc5f1('0x45')]);}})[_0xc5f1('0x21')](respondWithResult(_0x2f6655,null))[_0xc5f1('0x3e')](handleError(_0x2f6655,null));};exports[_0xc5f1('0x5b')]=function(_0x4c0be1,_0x317945,_0x11dbb4){var _0x1bc3c6={};var _0x122b9c={};var _0x1df614;var _0x37e82e;return db[_0xc5f1('0x28')][_0xc5f1('0x53')]({'where':{'id':_0x4c0be1[_0xc5f1('0x40')]['id']}})[_0xc5f1('0x21')](handleEntityNotFound(_0x317945,null))['then'](function(_0x46d131){if(_0x46d131){_0x1df614=_0x46d131;_0x122b9c[_0xc5f1('0x31')]=_[_0xc5f1('0x2e')](db[_0xc5f1('0x5a')][_0xc5f1('0x41')]);_0x122b9c[_0xc5f1('0x2d')]=_['keys'](_0x4c0be1[_0xc5f1('0x2d')]);_0x122b9c[_0xc5f1('0x2f')]=_[_0xc5f1('0x30')](_0x122b9c[_0xc5f1('0x31')],_0x122b9c[_0xc5f1('0x2d')]);_0x1bc3c6['attributes']=_[_0xc5f1('0x30')](_0x122b9c[_0xc5f1('0x31')],qs[_0xc5f1('0x33')](_0x4c0be1[_0xc5f1('0x2d')]['fields']));_0x1bc3c6[_0xc5f1('0x32')]=_0x1bc3c6[_0xc5f1('0x32')][_0xc5f1('0x34')]?_0x1bc3c6[_0xc5f1('0x32')]:_0x122b9c[_0xc5f1('0x31')];_0x1bc3c6['order']=qs[_0xc5f1('0x36')](_0x4c0be1[_0xc5f1('0x2d')][_0xc5f1('0x36')]);_0x1bc3c6[_0xc5f1('0x37')]=qs[_0xc5f1('0x2f')](_[_0xc5f1('0x54')](_0x4c0be1[_0xc5f1('0x2d')],_0x122b9c[_0xc5f1('0x2f')]));if(_0x4c0be1['query']['filter']){_0x1bc3c6[_0xc5f1('0x37')]=_['merge'](_0x1bc3c6[_0xc5f1('0x37')],{'$or':_[_0xc5f1('0x2c')](_0x1bc3c6[_0xc5f1('0x32')],function(_0x4ca0f5){var _0x41ab8a={};_0x41ab8a[_0x4ca0f5]={'$like':'%'+_0x4c0be1[_0xc5f1('0x2d')][_0xc5f1('0x38')]+'%'};return _0x41ab8a;})});}_0x1bc3c6=_[_0xc5f1('0x42')]({},_0x1bc3c6,_0x4c0be1[_0xc5f1('0x43')]);return _0x1df614[_0xc5f1('0x5b')](_0x1bc3c6);}})[_0xc5f1('0x21')](function(_0x4adf67){if(_0x4adf67){_0x37e82e=_0x4adf67[_0xc5f1('0x34')];if(!_0x4c0be1[_0xc5f1('0x2d')][_0xc5f1('0x58')]('nolimit')){_0x1bc3c6[_0xc5f1('0x1b')]=qs['limit'](_0x4c0be1[_0xc5f1('0x2d')]['limit']);_0x1bc3c6[_0xc5f1('0x19')]=qs['offset'](_0x4c0be1[_0xc5f1('0x2d')][_0xc5f1('0x19')]);}return _0x1df614[_0xc5f1('0x5b')](_0x1bc3c6);}})[_0xc5f1('0x21')](function(_0x9d1402){if(_0x9d1402){return _0x9d1402?{'count':_0x37e82e,'rows':_0x9d1402}:null;}})[_0xc5f1('0x21')](respondWithResult(_0x317945,null))[_0xc5f1('0x3e')](handleError(_0x317945,null));}; \ No newline at end of file +var _0x56b1=['getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','keys','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','addAllCondition','body','Condition','addAnyCondition','TriggerAnyId'];(function(_0x1bd247,_0x14f195){var _0x54d8d5=function(_0x2aaf14){while(--_0x2aaf14){_0x1bd247['push'](_0x1bd247['shift']());}};_0x54d8d5(++_0x14f195);}(_0x56b1,0x12c));var _0x156b=function(_0x2c33fb,_0x3191c2){_0x2c33fb=_0x2c33fb-0x0;var _0x479094=_0x56b1[_0x2c33fb];return _0x479094;};'use strict';var emlformat=require(_0x156b('0x0'));var rimraf=require(_0x156b('0x1'));var zipdir=require(_0x156b('0x2'));var jsonpatch=require(_0x156b('0x3'));var rp=require(_0x156b('0x4'));var moment=require(_0x156b('0x5'));var BPromise=require(_0x156b('0x6'));var Mustache=require(_0x156b('0x7'));var util=require(_0x156b('0x8'));var path=require(_0x156b('0x9'));var sox=require('sox');var csv=require(_0x156b('0xa'));var ejs=require(_0x156b('0xb'));var fs=require('fs');var fs_extra=require(_0x156b('0xc'));var _=require('lodash');var squel=require(_0x156b('0xd'));var crypto=require(_0x156b('0xe'));var jsforce=require(_0x156b('0xf'));var deskjs=require(_0x156b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x156b('0x11'));var Papa=require('papaparse');var Redis=require(_0x156b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x156b('0x13'));var as=require(_0x156b('0x14'));var hardwareService=require(_0x156b('0x15'));var logger=require(_0x156b('0x16'))(_0x156b('0x17'));var utils=require(_0x156b('0x18'));var config=require(_0x156b('0x19'));var licenseUtil=require(_0x156b('0x1a'));var db=require(_0x156b('0x1b'))['db'];function respondWithStatusCode(_0x278e54,_0x58e1d9){_0x58e1d9=_0x58e1d9||0xcc;return function(_0x45d9b5){if(_0x45d9b5){return _0x278e54[_0x156b('0x1c')](_0x58e1d9);}return _0x278e54[_0x156b('0x1d')](_0x58e1d9)[_0x156b('0x1e')]();};}function respondWithResult(_0x1c0db0,_0x21c50a){_0x21c50a=_0x21c50a||0xc8;return function(_0x55b7b0){if(_0x55b7b0){return _0x1c0db0[_0x156b('0x1d')](_0x21c50a)[_0x156b('0x1f')](_0x55b7b0);}};}function respondWithFilteredResult(_0x31f7ff,_0x34b8ef){return function(_0x18ccc8){if(_0x18ccc8){var _0x3742f3=typeof _0x34b8ef[_0x156b('0x20')]===_0x156b('0x21')&&typeof _0x34b8ef[_0x156b('0x22')]===_0x156b('0x21');var _0x26b1f3=_0x18ccc8['count'];var _0x58586a=_0x3742f3?0x0:_0x34b8ef['offset'];var _0x545125=_0x3742f3?_0x18ccc8['count']:_0x34b8ef['offset']+_0x34b8ef[_0x156b('0x22')];var _0x565ba0;if(_0x545125>=_0x26b1f3){_0x545125=_0x26b1f3;_0x565ba0=0xc8;}else{_0x565ba0=0xce;}_0x31f7ff[_0x156b('0x1d')](_0x565ba0);return _0x31f7ff['set'](_0x156b('0x23'),_0x58586a+'-'+_0x545125+'/'+_0x26b1f3)['json'](_0x18ccc8);}return null;};}function patchUpdates(_0x127b01){return function(_0x3f0af0){try{jsonpatch['apply'](_0x3f0af0,_0x127b01,!![]);}catch(_0x2b93d5){return BPromise[_0x156b('0x24')](_0x2b93d5);}return _0x3f0af0[_0x156b('0x25')]();};}function saveUpdates(_0x206315,_0x4e00c4){return function(_0x1d7c5d){if(_0x1d7c5d){return _0x1d7c5d[_0x156b('0x26')](_0x206315)[_0x156b('0x27')](function(_0x492048){return _0x492048;});}return null;};}function removeEntity(_0xde8193,_0x2ab3d6){return function(_0xc733d0){if(_0xc733d0){return _0xc733d0[_0x156b('0x28')]()[_0x156b('0x27')](function(){var _0x241d6f=_0xc733d0[_0x156b('0x29')]({'plain':!![]});var _0x3f2464=_0x156b('0x2a');return db[_0x156b('0x2b')]['destroy']({'where':{'type':_0x3f2464,'resourceId':_0x241d6f['id']}})[_0x156b('0x27')](function(){return _0xc733d0;});})[_0x156b('0x27')](function(){_0xde8193[_0x156b('0x1d')](0xcc)[_0x156b('0x1e')]();});}};}function handleEntityNotFound(_0x4b4c84,_0x332749){return function(_0x1918d1){if(!_0x1918d1){_0x4b4c84[_0x156b('0x1c')](0x194);}return _0x1918d1;};}function handleError(_0x2c2d9e,_0x7816ed){_0x7816ed=_0x7816ed||0x1f4;return function(_0x218611){logger[_0x156b('0x2c')](_0x218611[_0x156b('0x2d')]);if(_0x218611[_0x156b('0x2e')]){delete _0x218611['name'];}_0x2c2d9e[_0x156b('0x1d')](_0x7816ed)[_0x156b('0x2f')](_0x218611);};}exports[_0x156b('0x30')]=function(_0x2a0515,_0x13183a){var _0x18732c={},_0x177168={},_0x3d9bf3={'count':0x0,'rows':[]};var _0x485c1d=_[_0x156b('0x31')](db[_0x156b('0x32')][_0x156b('0x33')],function(_0x593294){return{'name':_0x593294[_0x156b('0x34')],'type':_0x593294[_0x156b('0x35')][_0x156b('0x36')]};});_0x177168[_0x156b('0x37')]=_['map'](_0x485c1d,_0x156b('0x2e'));_0x177168[_0x156b('0x38')]=_['keys'](_0x2a0515[_0x156b('0x38')]);_0x177168[_0x156b('0x39')]=_['intersection'](_0x177168[_0x156b('0x37')],_0x177168[_0x156b('0x38')]);_0x18732c[_0x156b('0x3a')]=_[_0x156b('0x3b')](_0x177168[_0x156b('0x37')],qs[_0x156b('0x3c')](_0x2a0515[_0x156b('0x38')][_0x156b('0x3c')]));_0x18732c[_0x156b('0x3a')]=_0x18732c[_0x156b('0x3a')]['length']?_0x18732c['attributes']:_0x177168['model'];if(!_0x2a0515[_0x156b('0x38')][_0x156b('0x3d')](_0x156b('0x3e'))){_0x18732c['limit']=qs[_0x156b('0x22')](_0x2a0515[_0x156b('0x38')]['limit']);_0x18732c['offset']=qs[_0x156b('0x20')](_0x2a0515[_0x156b('0x38')][_0x156b('0x20')]);}_0x18732c[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x2a0515[_0x156b('0x38')]['sort']);_0x18732c[_0x156b('0x41')]=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0x2a0515['query'],_0x177168[_0x156b('0x39')]),_0x485c1d);if(_0x2a0515[_0x156b('0x38')]['filter']){_0x18732c[_0x156b('0x41')]=_[_0x156b('0x43')](_0x18732c[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x485c1d,function(_0x2b63bd){if(_0x2b63bd['type']!==_0x156b('0x44')){var _0x40e9c6={};_0x40e9c6[_0x2b63bd[_0x156b('0x2e')]]={'$like':'%'+_0x2a0515[_0x156b('0x38')][_0x156b('0x45')]+'%'};return _0x40e9c6;}})});}_0x18732c=_[_0x156b('0x43')]({},_0x18732c,_0x2a0515[_0x156b('0x46')]);var _0x1cc4af={'where':_0x18732c[_0x156b('0x41')]};return db['Trigger'][_0x156b('0x47')](_0x1cc4af)[_0x156b('0x27')](function(_0xcc76b7){_0x3d9bf3[_0x156b('0x47')]=_0xcc76b7;if(_0x2a0515[_0x156b('0x38')][_0x156b('0x48')]){_0x18732c['include']=[{'all':!![]}];}return db[_0x156b('0x32')]['findAll'](_0x18732c);})['then'](function(_0x68000a){_0x3d9bf3[_0x156b('0x49')]=_0x68000a;return _0x3d9bf3;})[_0x156b('0x27')](respondWithFilteredResult(_0x13183a,_0x18732c))[_0x156b('0x4a')](handleError(_0x13183a,null));};exports[_0x156b('0x4b')]=function(_0x4fdaf8,_0x3d3e3b){var _0x2736da={'raw':![],'where':{'id':_0x4fdaf8[_0x156b('0x4c')]['id']}},_0xe537a5={};_0xe537a5[_0x156b('0x37')]=_[_0x156b('0x4d')](db[_0x156b('0x32')][_0x156b('0x33')]);_0xe537a5['query']=_[_0x156b('0x4d')](_0x4fdaf8[_0x156b('0x38')]);_0xe537a5[_0x156b('0x39')]=_[_0x156b('0x3b')](_0xe537a5['model'],_0xe537a5[_0x156b('0x38')]);_0x2736da['attributes']=_[_0x156b('0x3b')](_0xe537a5['model'],qs[_0x156b('0x3c')](_0x4fdaf8['query']['fields']));_0x2736da[_0x156b('0x3a')]=_0x2736da['attributes'][_0x156b('0x4e')]?_0x2736da['attributes']:_0xe537a5[_0x156b('0x37')];if(_0x4fdaf8[_0x156b('0x38')][_0x156b('0x48')]){_0x2736da[_0x156b('0x4f')]=[{'all':!![]}];}_0x2736da=_['merge']({},_0x2736da,_0x4fdaf8[_0x156b('0x46')]);return db['Trigger'][_0x156b('0x50')](_0x2736da)[_0x156b('0x27')](handleEntityNotFound(_0x3d3e3b,null))['then'](respondWithResult(_0x3d3e3b,null))['catch'](handleError(_0x3d3e3b,null));};exports[_0x156b('0x51')]=function(_0x1fbb03,_0x109442){return db[_0x156b('0x32')][_0x156b('0x51')](_0x1fbb03['body'],{})[_0x156b('0x27')](function(_0x61b293){var _0x40a9ce=_0x1fbb03[_0x156b('0x52')][_0x156b('0x29')]({'plain':!![]});if(!_0x40a9ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a9ce[_0x156b('0x53')]===_0x156b('0x52')){var _0x36902c=_0x61b293['get']({'plain':!![]});var _0x3217d5=_0x156b('0x2a');return db[_0x156b('0x54')][_0x156b('0x50')]({'where':{'name':_0x3217d5,'userProfileId':_0x40a9ce[_0x156b('0x55')]},'raw':!![]})[_0x156b('0x27')](function(_0x1a2000){if(_0x1a2000&&_0x1a2000[_0x156b('0x56')]===0x0){return db['UserProfileResource'][_0x156b('0x51')]({'name':_0x36902c[_0x156b('0x2e')],'resourceId':_0x36902c['id'],'type':_0x1a2000['name'],'sectionId':_0x1a2000['id']},{})[_0x156b('0x27')](function(){return _0x61b293;});}else{return _0x61b293;}})[_0x156b('0x4a')](function(_0x16f739){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16f739);throw _0x16f739;});}return _0x61b293;})[_0x156b('0x27')](respondWithResult(_0x109442,0xc9))[_0x156b('0x4a')](handleError(_0x109442,null));};exports[_0x156b('0x26')]=function(_0xf4fa27,_0x5080b1){if(_0xf4fa27['body']['id']){delete _0xf4fa27['body']['id'];}return db[_0x156b('0x32')]['find']({'where':{'id':_0xf4fa27[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x5080b1,null))[_0x156b('0x27')](saveUpdates(_0xf4fa27['body'],null))[_0x156b('0x27')](respondWithResult(_0x5080b1,null))[_0x156b('0x4a')](handleError(_0x5080b1,null));};exports[_0x156b('0x28')]=function(_0x517902,_0x315567){return db[_0x156b('0x32')][_0x156b('0x50')]({'where':{'id':_0x517902['params']['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x315567,null))[_0x156b('0x27')](removeEntity(_0x315567,null))[_0x156b('0x4a')](handleError(_0x315567,null));};exports[_0x156b('0x57')]=function(_0x16f5be,_0x349afa,_0x2de7b8){if(_0x16f5be[_0x156b('0x58')]['id']){delete _0x16f5be[_0x156b('0x58')]['id'];}return db['Trigger']['find']({'where':{'id':_0x16f5be[_0x156b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x349afa,null))[_0x156b('0x27')](function(_0x2ac66e){if(_0x2ac66e){_0x16f5be[_0x156b('0x58')]['TriggerAllId']=_0x2ac66e['id'];return db[_0x156b('0x59')][_0x156b('0x51')](_0x16f5be[_0x156b('0x58')]);}})[_0x156b('0x27')](respondWithResult(_0x349afa,null))['catch'](handleError(_0x349afa,null));};exports[_0x156b('0x5a')]=function(_0x304c51,_0x48cfd5,_0x581467){if(_0x304c51[_0x156b('0x58')]['id']){delete _0x304c51['body']['id'];}return db[_0x156b('0x32')][_0x156b('0x50')]({'where':{'id':_0x304c51[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x48cfd5,null))[_0x156b('0x27')](function(_0x51ef70){if(_0x51ef70){_0x304c51[_0x156b('0x58')][_0x156b('0x5b')]=_0x51ef70['id'];return db[_0x156b('0x59')][_0x156b('0x51')](_0x304c51[_0x156b('0x58')]);}})[_0x156b('0x27')](respondWithResult(_0x48cfd5,null))[_0x156b('0x4a')](handleError(_0x48cfd5,null));};exports[_0x156b('0x5c')]=function(_0x209f68,_0x32a402,_0x504b75){var _0xaacf1={};var _0x405291={};var _0x14902b;var _0x996318;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0x209f68['params']['id']}})['then'](handleEntityNotFound(_0x32a402,null))['then'](function(_0x11ebb4){if(_0x11ebb4){_0x14902b=_0x11ebb4;_0x405291[_0x156b('0x37')]=_['keys'](db[_0x156b('0x59')][_0x156b('0x33')]);_0x405291[_0x156b('0x38')]=_['keys'](_0x209f68[_0x156b('0x38')]);_0x405291[_0x156b('0x39')]=_['intersection'](_0x405291['model'],_0x405291[_0x156b('0x38')]);_0xaacf1[_0x156b('0x3a')]=_['intersection'](_0x405291['model'],qs[_0x156b('0x3c')](_0x209f68[_0x156b('0x38')]['fields']));_0xaacf1[_0x156b('0x3a')]=_0xaacf1['attributes'][_0x156b('0x4e')]?_0xaacf1[_0x156b('0x3a')]:_0x405291[_0x156b('0x37')];_0xaacf1[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x209f68[_0x156b('0x38')][_0x156b('0x40')]);_0xaacf1['where']=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0x209f68[_0x156b('0x38')],_0x405291[_0x156b('0x39')]));if(_0x209f68[_0x156b('0x38')][_0x156b('0x45')]){_0xaacf1['where']=_[_0x156b('0x43')](_0xaacf1[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0xaacf1[_0x156b('0x3a')],function(_0x3bd8ab){var _0x528d01={};_0x528d01[_0x3bd8ab]={'$like':'%'+_0x209f68[_0x156b('0x38')][_0x156b('0x45')]+'%'};return _0x528d01;})});}_0xaacf1=_[_0x156b('0x43')]({},_0xaacf1,_0x209f68[_0x156b('0x46')]);return _0x14902b['getAllConditions'](_0xaacf1);}})['then'](function(_0xddd60b){if(_0xddd60b){_0x996318=_0xddd60b[_0x156b('0x4e')];if(!_0x209f68[_0x156b('0x38')][_0x156b('0x3d')](_0x156b('0x3e'))){_0xaacf1[_0x156b('0x22')]=qs[_0x156b('0x22')](_0x209f68[_0x156b('0x38')][_0x156b('0x22')]);_0xaacf1['offset']=qs[_0x156b('0x20')](_0x209f68[_0x156b('0x38')]['offset']);}return _0x14902b[_0x156b('0x5c')](_0xaacf1);}})[_0x156b('0x27')](function(_0x3ea5b9){if(_0x3ea5b9){return _0x3ea5b9?{'count':_0x996318,'rows':_0x3ea5b9}:null;}})['then'](respondWithResult(_0x32a402,null))[_0x156b('0x4a')](handleError(_0x32a402,null));};exports[_0x156b('0x5e')]=function(_0xef7aca,_0x1321a8,_0x44b67b){var _0x3e1ac8={};var _0x363e4f={};var _0x58af88;var _0x3b74fe;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0xef7aca[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x1321a8,null))[_0x156b('0x27')](function(_0x48dfe4){if(_0x48dfe4){_0x58af88=_0x48dfe4;_0x363e4f[_0x156b('0x37')]=_['keys'](db[_0x156b('0x59')]['rawAttributes']);_0x363e4f[_0x156b('0x38')]=_['keys'](_0xef7aca[_0x156b('0x38')]);_0x363e4f[_0x156b('0x39')]=_[_0x156b('0x3b')](_0x363e4f[_0x156b('0x37')],_0x363e4f[_0x156b('0x38')]);_0x3e1ac8[_0x156b('0x3a')]=_[_0x156b('0x3b')](_0x363e4f[_0x156b('0x37')],qs['fields'](_0xef7aca[_0x156b('0x38')][_0x156b('0x3c')]));_0x3e1ac8[_0x156b('0x3a')]=_0x3e1ac8[_0x156b('0x3a')]['length']?_0x3e1ac8[_0x156b('0x3a')]:_0x363e4f['model'];_0x3e1ac8[_0x156b('0x3f')]=qs['sort'](_0xef7aca['query']['sort']);_0x3e1ac8[_0x156b('0x41')]=qs[_0x156b('0x39')](_[_0x156b('0x42')](_0xef7aca[_0x156b('0x38')],_0x363e4f[_0x156b('0x39')]));if(_0xef7aca[_0x156b('0x38')][_0x156b('0x45')]){_0x3e1ac8['where']=_[_0x156b('0x43')](_0x3e1ac8[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x3e1ac8[_0x156b('0x3a')],function(_0x302da6){var _0x7fe6ea={};_0x7fe6ea[_0x302da6]={'$like':'%'+_0xef7aca['query'][_0x156b('0x45')]+'%'};return _0x7fe6ea;})});}_0x3e1ac8=_[_0x156b('0x43')]({},_0x3e1ac8,_0xef7aca[_0x156b('0x46')]);return _0x58af88[_0x156b('0x5e')](_0x3e1ac8);}})['then'](function(_0x2d516f){if(_0x2d516f){_0x3b74fe=_0x2d516f[_0x156b('0x4e')];if(!_0xef7aca['query']['hasOwnProperty']('nolimit')){_0x3e1ac8[_0x156b('0x22')]=qs[_0x156b('0x22')](_0xef7aca[_0x156b('0x38')][_0x156b('0x22')]);_0x3e1ac8[_0x156b('0x20')]=qs[_0x156b('0x20')](_0xef7aca[_0x156b('0x38')][_0x156b('0x20')]);}return _0x58af88[_0x156b('0x5e')](_0x3e1ac8);}})[_0x156b('0x27')](function(_0x5dce2d){if(_0x5dce2d){return _0x5dce2d?{'count':_0x3b74fe,'rows':_0x5dce2d}:null;}})[_0x156b('0x27')](respondWithResult(_0x1321a8,null))[_0x156b('0x4a')](handleError(_0x1321a8,null));};exports['addAction']=function(_0x2a8201,_0x3300a7,_0x2bfea8){if(_0x2a8201[_0x156b('0x58')]['id']){delete _0x2a8201['body']['id'];}return db['Trigger'][_0x156b('0x50')]({'where':{'id':_0x2a8201[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x3300a7,null))[_0x156b('0x27')](function(_0x2a99c3){if(_0x2a99c3){_0x2a8201[_0x156b('0x58')][_0x156b('0x5f')]=_0x2a99c3['id'];return db[_0x156b('0x60')][_0x156b('0x51')](_0x2a8201[_0x156b('0x58')]);}})['then'](respondWithResult(_0x3300a7,null))[_0x156b('0x4a')](handleError(_0x3300a7,null));};exports[_0x156b('0x61')]=function(_0x24a7c2,_0x2c7ebb,_0x9fe9e9){var _0x12c95e={};var _0x361a3c={};var _0x307805;var _0x38c174;return db[_0x156b('0x32')][_0x156b('0x5d')]({'where':{'id':_0x24a7c2[_0x156b('0x4c')]['id']}})[_0x156b('0x27')](handleEntityNotFound(_0x2c7ebb,null))[_0x156b('0x27')](function(_0x1a8f66){if(_0x1a8f66){_0x307805=_0x1a8f66;_0x361a3c[_0x156b('0x37')]=_[_0x156b('0x4d')](db[_0x156b('0x60')][_0x156b('0x33')]);_0x361a3c[_0x156b('0x38')]=_[_0x156b('0x4d')](_0x24a7c2[_0x156b('0x38')]);_0x361a3c[_0x156b('0x39')]=_[_0x156b('0x3b')](_0x361a3c[_0x156b('0x37')],_0x361a3c[_0x156b('0x38')]);_0x12c95e[_0x156b('0x3a')]=_['intersection'](_0x361a3c[_0x156b('0x37')],qs[_0x156b('0x3c')](_0x24a7c2['query'][_0x156b('0x3c')]));_0x12c95e[_0x156b('0x3a')]=_0x12c95e[_0x156b('0x3a')][_0x156b('0x4e')]?_0x12c95e['attributes']:_0x361a3c[_0x156b('0x37')];_0x12c95e[_0x156b('0x3f')]=qs[_0x156b('0x40')](_0x24a7c2[_0x156b('0x38')][_0x156b('0x40')]);_0x12c95e[_0x156b('0x41')]=qs[_0x156b('0x39')](_['pick'](_0x24a7c2['query'],_0x361a3c[_0x156b('0x39')]));if(_0x24a7c2[_0x156b('0x38')]['filter']){_0x12c95e['where']=_[_0x156b('0x43')](_0x12c95e[_0x156b('0x41')],{'$or':_[_0x156b('0x31')](_0x12c95e['attributes'],function(_0x209d43){var _0x669ff={};_0x669ff[_0x209d43]={'$like':'%'+_0x24a7c2[_0x156b('0x38')]['filter']+'%'};return _0x669ff;})});}_0x12c95e=_[_0x156b('0x43')]({},_0x12c95e,_0x24a7c2[_0x156b('0x46')]);return _0x307805[_0x156b('0x61')](_0x12c95e);}})['then'](function(_0x17aa13){if(_0x17aa13){_0x38c174=_0x17aa13['length'];if(!_0x24a7c2[_0x156b('0x38')]['hasOwnProperty'](_0x156b('0x3e'))){_0x12c95e[_0x156b('0x22')]=qs[_0x156b('0x22')](_0x24a7c2[_0x156b('0x38')][_0x156b('0x22')]);_0x12c95e[_0x156b('0x20')]=qs[_0x156b('0x20')](_0x24a7c2[_0x156b('0x38')]['offset']);}return _0x307805[_0x156b('0x61')](_0x12c95e);}})[_0x156b('0x27')](function(_0x3f7e76){if(_0x3f7e76){return _0x3f7e76?{'count':_0x38c174,'rows':_0x3f7e76}:null;}})[_0x156b('0x27')](respondWithResult(_0x2c7ebb,null))['catch'](handleError(_0x2c7ebb,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e9774de..19effe6 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 _0x62da=['moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0x2d836a,_0x5041d3){var _0x55ef37=function(_0x47de08){while(--_0x47de08){_0x2d836a['push'](_0x2d836a['shift']());}};_0x55ef37(++_0x5041d3);}(_0x62da,0xc0));var _0xa62d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62da[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa62d('0x0'));var util=require('util');var logger=require(_0xa62d('0x1'))(_0xa62d('0x2'));var moment=require(_0xa62d('0x3'));var BPromise=require(_0xa62d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa62d('0x5'));var rimraf=require(_0xa62d('0x6'));var config=require(_0xa62d('0x7'));var attributes=require(_0xa62d('0x8'));module[_0xa62d('0x9')]=function(_0x46f662,_0xab1efb){return _0x46f662[_0xa62d('0xa')](_0xa62d('0xb'),attributes,{'tableName':_0xa62d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf874=['path','../../config/environment','./trigger.attributes','exports','define','tools_triggers','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf874,0xed));var _0x4f87=function(_0x25ec6c,_0x288a26){_0x25ec6c=_0x25ec6c-0x0;var _0x41a304=_0xf874[_0x25ec6c];return _0x41a304;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f87('0x0'))(_0x4f87('0x1'));var moment=require(_0x4f87('0x2'));var BPromise=require(_0x4f87('0x3'));var rp=require(_0x4f87('0x4'));var fs=require('fs');var path=require(_0x4f87('0x5'));var rimraf=require('rimraf');var config=require(_0x4f87('0x6'));var attributes=require(_0x4f87('0x7'));module[_0x4f87('0x8')]=function(_0xf0ffb3,_0x104682){return _0xf0ffb3[_0x4f87('0x9')]('Trigger',attributes,{'tableName':_0x4f87('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 6fedf0f..a0dd4a1 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 _0xc172=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','options','raw','where','attributes','limit','map','include','model','GetTrigger','debug','stringify','catch','ShowTrigger','Trigger','find'];(function(_0x276888,_0x588d38){var _0x28fa5b=function(_0x5543cc){while(--_0x5543cc){_0x276888['push'](_0x276888['shift']());}};_0x28fa5b(++_0x588d38);}(_0xc172,0x1d4));var _0x2c17=function(_0x1b2daa,_0x461568){_0x1b2daa=_0x1b2daa-0x0;var _0x4726e9=_0xc172[_0x1b2daa];return _0x4726e9;};'use strict';var _=require(_0x2c17('0x0'));var util=require(_0x2c17('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c17('0x2'));var db=require(_0x2c17('0x3'))['db'];var utils=require(_0x2c17('0x4'));var logger=require(_0x2c17('0x5'))(_0x2c17('0x6'));var config=require(_0x2c17('0x7'));var jayson=require(_0x2c17('0x8'));var client=jayson[_0x2c17('0x9')][_0x2c17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4daa71,_0x42a781,_0x3911d0){return new BPromise(function(_0x3739a8,_0x1a9203){return client[_0x2c17('0xb')](_0x4daa71,_0x3911d0)[_0x2c17('0xc')](function(_0x3c6246){logger[_0x2c17('0xd')](_0x2c17('0xe'),_0x42a781,_0x2c17('0xf'));logger['debug'](_0x2c17('0x10'),_0x42a781,_0x2c17('0xf'),JSON['stringify'](_0x3c6246));if(_0x3c6246[_0x2c17('0x11')]){if(_0x3c6246['error'][_0x2c17('0x12')]===0x1f4){logger['error'](_0x2c17('0xe'),_0x42a781,_0x3c6246['error'][_0x2c17('0x13')]);return _0x1a9203(_0x3c6246[_0x2c17('0x11')][_0x2c17('0x13')]);}logger[_0x2c17('0x11')]('Trigger,\x20%s,\x20%s',_0x42a781,_0x3c6246[_0x2c17('0x11')][_0x2c17('0x13')]);return _0x3739a8(_0x3c6246[_0x2c17('0x11')]['message']);}else{logger[_0x2c17('0xd')](_0x2c17('0xe'),_0x42a781,_0x2c17('0xf'));_0x3739a8(_0x3c6246[_0x2c17('0x14')][_0x2c17('0x13')]);}})['catch'](function(_0x49a5b5){logger['error'](_0x2c17('0xe'),_0x42a781,_0x49a5b5);_0x1a9203(_0x49a5b5);});});}exports['GetTrigger']=function(_0xe5a3cc){var _0x2c522e=this;return new Promise(function(_0x35ca60,_0x45ae89){return db['Trigger']['findAll']({'raw':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x16')]===undefined?!![]:![]:!![],'where':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x17')]||null:null,'attributes':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc[_0x2c17('0x15')][_0x2c17('0x18')]||null:null,'limit':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x19')]||null:null,'include':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc[_0x2c17('0x15')]['include']?_[_0x2c17('0x1a')](_0xe5a3cc['options'][_0x2c17('0x1b')],function(_0x55e62d){return{'model':db[_0x55e62d[_0x2c17('0x1c')]],'as':_0x55e62d['as'],'attributes':_0x55e62d[_0x2c17('0x18')],'include':_0x55e62d[_0x2c17('0x1b')]?_['map'](_0x55e62d['include'],function(_0x14c066){return{'model':db[_0x14c066[_0x2c17('0x1c')]],'as':_0x14c066['as'],'attributes':_0x14c066[_0x2c17('0x18')],'include':_0x14c066[_0x2c17('0x1b')]?_[_0x2c17('0x1a')](_0x14c066['include'],function(_0x841574){return{'model':db[_0x841574[_0x2c17('0x1c')]],'as':_0x841574['as'],'attributes':_0x841574[_0x2c17('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2c17('0xc')](function(_0x634c7e){logger[_0x2c17('0xd')](_0x2c17('0x1d'),_0xe5a3cc);logger[_0x2c17('0x1e')](_0x2c17('0x1d'),_0xe5a3cc,JSON[_0x2c17('0x1f')](_0x634c7e));_0x35ca60(_0x634c7e);})[_0x2c17('0x20')](function(_0x31f27a){logger[_0x2c17('0x11')]('GetTrigger',_0x31f27a['message'],_0xe5a3cc);_0x45ae89(_0x2c522e['error'](0x1f4,_0x31f27a[_0x2c17('0x13')]));});});};exports[_0x2c17('0x21')]=function(_0x4076d2){var _0x3302bf=this;return new Promise(function(_0x1d03df,_0x3dd2e5){return db[_0x2c17('0x22')][_0x2c17('0x23')]({'raw':_0x4076d2[_0x2c17('0x15')]?_0x4076d2['options'][_0x2c17('0x16')]===undefined?!![]:![]:!![],'where':_0x4076d2[_0x2c17('0x15')]?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x17')]||null:null,'attributes':_0x4076d2[_0x2c17('0x15')]?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x18')]||null:null,'include':_0x4076d2['options']?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x1b')]?_['map'](_0x4076d2['options'][_0x2c17('0x1b')],function(_0x125085){return{'model':db[_0x125085[_0x2c17('0x1c')]],'as':_0x125085['as'],'attributes':_0x125085[_0x2c17('0x18')],'include':_0x125085[_0x2c17('0x1b')]?_[_0x2c17('0x1a')](_0x125085['include'],function(_0x23503a){return{'model':db[_0x23503a['model']],'as':_0x23503a['as'],'attributes':_0x23503a[_0x2c17('0x18')],'include':_0x23503a[_0x2c17('0x1b')]?_['map'](_0x23503a['include'],function(_0x52b032){return{'model':db[_0x52b032[_0x2c17('0x1c')]],'as':_0x52b032['as'],'attributes':_0x52b032[_0x2c17('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x240331){logger[_0x2c17('0xd')](_0x2c17('0x21'),_0x4076d2);logger[_0x2c17('0x1e')](_0x2c17('0x21'),_0x4076d2,JSON[_0x2c17('0x1f')](_0x240331));_0x1d03df(_0x240331);})[_0x2c17('0x20')](function(_0x5e9167){logger[_0x2c17('0x11')](_0x2c17('0x21'),_0x5e9167['message'],_0x4076d2);_0x3dd2e5(_0x3302bf[_0x2c17('0x11')](0x1f4,_0x5e9167['message']));});});}; \ No newline at end of file +var _0x46b7=['rpc','../../config/environment','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowTrigger','lodash','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x46b7,0x10b));var _0x746b=function(_0x1ba08c,_0x3b8ca1){_0x1ba08c=_0x1ba08c-0x0;var _0x18719f=_0x46b7[_0x1ba08c];return _0x18719f;};'use strict';var _=require(_0x746b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x746b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x746b('0x2'));var db=require(_0x746b('0x3'))['db'];var utils=require(_0x746b('0x4'));var logger=require('../../config/logger')(_0x746b('0x5'));var config=require(_0x746b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x746b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x599605,_0x43d1a1,_0x5f34f5){return new BPromise(function(_0x3a11cc,_0x39990d){return client[_0x746b('0x8')](_0x599605,_0x5f34f5)[_0x746b('0x9')](function(_0x21e5a9){logger[_0x746b('0xa')](_0x746b('0xb'),_0x43d1a1,_0x746b('0xc'));logger[_0x746b('0xd')](_0x746b('0xe'),_0x43d1a1,_0x746b('0xc'),JSON[_0x746b('0xf')](_0x21e5a9));if(_0x21e5a9['error']){if(_0x21e5a9['error'][_0x746b('0x10')]===0x1f4){logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x21e5a9[_0x746b('0x11')]['message']);return _0x39990d(_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);}logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);return _0x3a11cc(_0x21e5a9[_0x746b('0x11')][_0x746b('0x12')]);}else{logger[_0x746b('0xa')](_0x746b('0xb'),_0x43d1a1,_0x746b('0xc'));_0x3a11cc(_0x21e5a9[_0x746b('0x13')][_0x746b('0x12')]);}})[_0x746b('0x14')](function(_0x3b5200){logger[_0x746b('0x11')](_0x746b('0xb'),_0x43d1a1,_0x3b5200);_0x39990d(_0x3b5200);});});}exports[_0x746b('0x15')]=function(_0x3de789){var _0x2a7ef2=this;return new Promise(function(_0x1ba971,_0x26a650){return db[_0x746b('0x16')][_0x746b('0x17')]({'raw':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x19')]===undefined?!![]:![]:!![],'where':_0x3de789['options']?_0x3de789[_0x746b('0x18')][_0x746b('0x1a')]||null:null,'attributes':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1b')]||null:null,'limit':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1c')]||null:null,'include':_0x3de789[_0x746b('0x18')]?_0x3de789[_0x746b('0x18')][_0x746b('0x1d')]?_['map'](_0x3de789[_0x746b('0x18')][_0x746b('0x1d')],function(_0x196c2c){return{'model':db[_0x196c2c['model']],'as':_0x196c2c['as'],'attributes':_0x196c2c[_0x746b('0x1b')],'include':_0x196c2c[_0x746b('0x1d')]?_['map'](_0x196c2c[_0x746b('0x1d')],function(_0x4f0eae){return{'model':db[_0x4f0eae['model']],'as':_0x4f0eae['as'],'attributes':_0x4f0eae[_0x746b('0x1b')],'include':_0x4f0eae[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x4f0eae[_0x746b('0x1d')],function(_0xe91c7f){return{'model':db[_0xe91c7f[_0x746b('0x1f')]],'as':_0xe91c7f['as'],'attributes':_0xe91c7f[_0x746b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x746b('0x9')](function(_0x1d138f){logger[_0x746b('0xa')](_0x746b('0x15'),_0x3de789);logger['debug'](_0x746b('0x15'),_0x3de789,JSON[_0x746b('0xf')](_0x1d138f));_0x1ba971(_0x1d138f);})[_0x746b('0x14')](function(_0x585c13){logger[_0x746b('0x11')](_0x746b('0x15'),_0x585c13[_0x746b('0x12')],_0x3de789);_0x26a650(_0x2a7ef2[_0x746b('0x11')](0x1f4,_0x585c13[_0x746b('0x12')]));});});};exports['ShowTrigger']=function(_0x188901){var _0x590266=this;return new Promise(function(_0x52d16e,_0x353bbd){return db[_0x746b('0x16')][_0x746b('0x20')]({'raw':_0x188901[_0x746b('0x18')]?_0x188901[_0x746b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x188901[_0x746b('0x18')]?_0x188901['options'][_0x746b('0x1a')]||null:null,'attributes':_0x188901['options']?_0x188901[_0x746b('0x18')][_0x746b('0x1b')]||null:null,'include':_0x188901['options']?_0x188901[_0x746b('0x18')][_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x188901[_0x746b('0x18')][_0x746b('0x1d')],function(_0xa4e115){return{'model':db[_0xa4e115[_0x746b('0x1f')]],'as':_0xa4e115['as'],'attributes':_0xa4e115[_0x746b('0x1b')],'include':_0xa4e115[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0xa4e115[_0x746b('0x1d')],function(_0x5b8231){return{'model':db[_0x5b8231['model']],'as':_0x5b8231['as'],'attributes':_0x5b8231[_0x746b('0x1b')],'include':_0x5b8231[_0x746b('0x1d')]?_[_0x746b('0x1e')](_0x5b8231[_0x746b('0x1d')],function(_0x4615a4){return{'model':db[_0x4615a4[_0x746b('0x1f')]],'as':_0x4615a4['as'],'attributes':_0x4615a4[_0x746b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42c40e){logger[_0x746b('0xa')](_0x746b('0x21'),_0x188901);logger[_0x746b('0xd')]('ShowTrigger',_0x188901,JSON['stringify'](_0x42c40e));_0x52d16e(_0x42c40e);})['catch'](function(_0x2224a7){logger[_0x746b('0x11')](_0x746b('0x21'),_0x2224a7[_0x746b('0x12')],_0x188901);_0x353bbd(_0x590266[_0x746b('0x11')](0x1f4,_0x2224a7[_0x746b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 10782ba..54b0c21 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 _0x15a0=['./trunk.controller','index','/:id','isAuthenticated','show','/:id/clone','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x309e23,_0x46650a){var _0x10c2f0=function(_0x583665){while(--_0x583665){_0x309e23['push'](_0x309e23['shift']());}};_0x10c2f0(++_0x46650a);}(_0x15a0,0x6f));var _0x015a=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x15a0[_0x4aba15];return _0x1c8122;};'use strict';var multer=require(_0x015a('0x0'));var util=require(_0x015a('0x1'));var path=require(_0x015a('0x2'));var timeout=require(_0x015a('0x3'));var express=require(_0x015a('0x4'));var router=express[_0x015a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x015a('0x6'));var interaction=require(_0x015a('0x7'));var config=require(_0x015a('0x8'));var controller=require(_0x015a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x015a('0xa')]);router['get'](_0x015a('0xb'),auth[_0x015a('0xc')](),controller[_0x015a('0xd')]);router['post'](_0x015a('0xe'),auth[_0x015a('0xc')](),controller['clone']);router[_0x015a('0xf')]('/',auth[_0x015a('0xc')](),controller[_0x015a('0x10')]);router[_0x015a('0x11')](_0x015a('0xb'),auth[_0x015a('0xc')](),controller[_0x015a('0x12')]);router[_0x015a('0x13')](_0x015a('0xb'),auth[_0x015a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3031=['./trunk.controller','isAuthenticated','index','get','/:id','post','/:id/clone','clone','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x3031,0x70));var _0x1303=function(_0x5e23d4,_0x54bf44){_0x5e23d4=_0x5e23d4-0x0;var _0x2b32a3=_0x3031[_0x5e23d4];return _0x2b32a3;};'use strict';var multer=require(_0x1303('0x0'));var util=require('util');var path=require(_0x1303('0x1'));var timeout=require(_0x1303('0x2'));var express=require(_0x1303('0x3'));var router=express[_0x1303('0x4')]();var fs_extra=require(_0x1303('0x5'));var auth=require(_0x1303('0x6'));var interaction=require(_0x1303('0x7'));var config=require('../../config/environment');var controller=require(_0x1303('0x8'));router['get']('/',auth[_0x1303('0x9')](),controller[_0x1303('0xa')]);router[_0x1303('0xb')](_0x1303('0xc'),auth[_0x1303('0x9')](),controller['show']);router[_0x1303('0xd')](_0x1303('0xe'),auth[_0x1303('0x9')](),controller[_0x1303('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1303('0x10')](_0x1303('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1303('0x11')](_0x1303('0xc'),auth[_0x1303('0x9')](),controller[_0x1303('0x12')]);module[_0x1303('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index daf2ea6..44749e4 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 _0xa8f6=['INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','friend','peer','STRING','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','yes','nonat','update','force_rport,comedia','nat','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'];(function(_0x1c97c8,_0x28d564){var _0x2c096d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x1c97c8['push'](_0x1c97c8['shift']());}};_0x2c096d(++_0x28d564);}(_0xa8f6,0x14c));var _0x6a8f=function(_0x49b1e9,_0x5c738f){_0x49b1e9=_0x49b1e9-0x0;var _0x2a02b3=_0xa8f6[_0x49b1e9];return _0x2a02b3;};'use strict';var Sequelize=require(_0x6a8f('0x0'));module[_0x6a8f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6a8f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x6a8f('0x3'),'user',_0x6a8f('0x4')),'allowNull':![],'defaultValue':_0x6a8f('0x3')},'context':{'type':Sequelize[_0x6a8f('0x5')],'allowNull':![],'defaultValue':_0x6a8f('0x6')},'callingpres':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x8'),_0x6a8f('0x9'),_0x6a8f('0xa'),_0x6a8f('0xb'),_0x6a8f('0xc'),'PROHIB_PASSED_SCREEN',_0x6a8f('0xd'),_0x6a8f('0xe'))},'deny':{'type':Sequelize[_0x6a8f('0x5')]},'permit':{'type':Sequelize[_0x6a8f('0x5')]},'secret':{'type':Sequelize[_0x6a8f('0x5')]},'md5secret':{'type':Sequelize[_0x6a8f('0x5')]},'remotesecret':{'type':Sequelize[_0x6a8f('0x5')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x6a8f('0xf'),'set':function(_0x1a1c19){this[_0x6a8f('0x10')](_0x6a8f('0x11'),_0x1a1c19?_0x1a1c19[_0x6a8f('0x12')](','):null);},'get':function(){return this[_0x6a8f('0x13')](_0x6a8f('0x11'))?this[_0x6a8f('0x13')](_0x6a8f('0x11'))[_0x6a8f('0x14')](','):null;},'comment':_0x6a8f('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0x6a8f('0x16'),_0x6a8f('0x17'),'shortinfo',_0x6a8f('0x18'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no',_0x6a8f('0x1a'),_0x6a8f('0x1b'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6a8f('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6a8f('0x5')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x6a8f('0x1c'),'set':function(_0x291be4){this[_0x6a8f('0x10')](_0x6a8f('0x1d'),_0x291be4?_0x291be4[_0x6a8f('0x12')](','):null);},'get':function(){return this[_0x6a8f('0x13')](_0x6a8f('0x1d'))?this['getDataValue'](_0x6a8f('0x1d'))[_0x6a8f('0x14')](','):null;},'comment':_0x6a8f('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6a8f('0x5')]},'language':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6a8f('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':_0x6a8f('0x1f')},'allow':{'type':Sequelize[_0x6a8f('0x5')],'allowNull':![],'defaultValue':_0x6a8f('0x20'),'set':function(_0x1c0abd){this[_0x6a8f('0x10')](_0x6a8f('0x21'),_0x1c0abd?_0x1c0abd['join'](';'):_0x6a8f('0x20'));},'get':function(){return this['getDataValue'](_0x6a8f('0x21'))?this[_0x6a8f('0x13')](_0x6a8f('0x21'))['split'](';'):null;},'comment':_0x6a8f('0x22')},'autoframing':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'insecure':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':_0x6a8f('0x23'),'set':function(_0x2ac5f3){this['setDataValue']('insecure',_0x2ac5f3?_0x2ac5f3['join'](','):null);},'get':function(){return this[_0x6a8f('0x13')](_0x6a8f('0x24'))?this['getDataValue'](_0x6a8f('0x24'))[_0x6a8f('0x14')](','):null;},'comment':_0x6a8f('0x25')},'trustrpid':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no',_0x6a8f('0x26'))},'promiscredir':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no')},'accountcode':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'setvar':{'type':Sequelize[_0x6a8f('0x5')]},'callerid':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':_0x6a8f('0x28')},'amaflags':{'type':Sequelize[_0x6a8f('0x5')]},'callcounter':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no'),'defaultValue':_0x6a8f('0x19')},'busylevel':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x6a8f('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x6a8f('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no')},'mailbox':{'type':Sequelize[_0x6a8f('0x5')]},'session_timers':{'type':Sequelize['ENUM'](_0x6a8f('0x29'),_0x6a8f('0x2a'),_0x6a8f('0x2b'))},'session_expires':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x2c'),'uas'),'defaultValue':_0x6a8f('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x6a8f('0x5')]},'port':{'type':Sequelize[_0x6a8f('0x27')](0x5)},'qualify':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no'),'defaultValue':_0x6a8f('0x19')},'keepalive':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x6a8f('0x5')]},'defaultuser':{'type':Sequelize[_0x6a8f('0x5')]},'rtptimeout':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no',_0x6a8f('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6a8f('0x5')]},'callbackextension':{'type':Sequelize[_0x6a8f('0x5')]},'timert1':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'timerb':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x6a8f('0x5')]},'contactdeny':{'type':Sequelize[_0x6a8f('0x5')]},'contactacl':{'type':Sequelize[_0x6a8f('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x6a8f('0x5')]},'use_q850_reason':{'type':Sequelize[_0x6a8f('0x5')]},'maxforwards':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'encryption':{'type':Sequelize[_0x6a8f('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'force_avp':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'icesupport':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x6a8f('0x7')]('yes','no',_0x6a8f('0x2f'),_0x6a8f('0x30'))},'dtlsrekey':{'type':Sequelize[_0x6a8f('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6a8f('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x6a8f('0x5')]},'dtlscipher':{'type':Sequelize[_0x6a8f('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x6a8f('0x5')]},'dtlssetup':{'type':Sequelize[_0x6a8f('0x7')]('active','passive',_0x6a8f('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x6a8f('0x5')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x6a8f('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x6a8f('0x7')](_0x6a8f('0x19'),'no')},'vmexten':{'type':Sequelize[_0x6a8f('0x5')]},'mohinterpret':{'type':Sequelize[_0x6a8f('0x5')]},'mohsuggest':{'type':Sequelize[_0x6a8f('0x5')]},'parkinglot':{'type':Sequelize[_0x6a8f('0x5')]},'description':{'type':Sequelize[_0x6a8f('0x5')]},'host':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':_0x6a8f('0x32')},'canreinvite':{'type':Sequelize[_0x6a8f('0x7')]('yes','no','nonat',_0x6a8f('0x1b'),_0x6a8f('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6a8f('0x5')]},'otherFields':{'type':Sequelize[_0x6a8f('0x5')]},'active':{'type':Sequelize[_0x6a8f('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6a8f('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x00cb=['force_rport,comedia','setDataValue','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update','BOOLEAN','exports','name','ENUM','peer','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x00cb,0x1ef));var _0xb00c=function(_0x403330,_0x2edc43){_0x403330=_0x403330-0x0;var _0x3f0afd=_0x00cb[_0x403330];return _0x3f0afd;};'use strict';var Sequelize=require('sequelize');module[_0xb00c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb00c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb00c('0x2')]('friend','user',_0xb00c('0x3')),'allowNull':![],'defaultValue':_0xb00c('0x4')},'context':{'type':Sequelize[_0xb00c('0x5')],'allowNull':![],'defaultValue':_0xb00c('0x6')},'callingpres':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x7'),_0xb00c('0x8'),_0xb00c('0x9'),_0xb00c('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xb00c('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0xb00c('0x5')]},'permit':{'type':Sequelize[_0xb00c('0x5')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xb00c('0x5')]},'remotesecret':{'type':Sequelize[_0xb00c('0x5')]},'transport':{'type':Sequelize[_0xb00c('0x5')],'defaultValue':'udp','set':function(_0x24d067){this['setDataValue'](_0xb00c('0xc'),_0x24d067?_0x24d067[_0xb00c('0xd')](','):null);},'get':function(){return this['getDataValue'](_0xb00c('0xc'))?this[_0xb00c('0xe')](_0xb00c('0xc'))[_0xb00c('0xf')](','):null;},'comment':_0xb00c('0x10')},'dtmfmode':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x11'),_0xb00c('0x12'),_0xb00c('0x13'),_0xb00c('0x14'),_0xb00c('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x17'),'update',_0xb00c('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb00c('0x5')]},'directmediadeny':{'type':Sequelize[_0xb00c('0x5')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x19'),'set':function(_0x1034c6){this[_0xb00c('0x1a')](_0xb00c('0x1b'),_0x1034c6?_0x1034c6['join'](','):null);},'get':function(){return this[_0xb00c('0xe')]('nat')?this['getDataValue'](_0xb00c('0x1b'))[_0xb00c('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xb00c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xb00c('0x5')]},'pickupgroup':{'type':Sequelize[_0xb00c('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xb00c('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x1c')},'allow':{'type':Sequelize[_0xb00c('0x5')],'allowNull':![],'defaultValue':_0xb00c('0x1d'),'set':function(_0x3a70f2){this[_0xb00c('0x1a')](_0xb00c('0x1e'),_0x3a70f2?_0x3a70f2['join'](';'):_0xb00c('0x1d'));},'get':function(){return this[_0xb00c('0xe')](_0xb00c('0x1e'))?this[_0xb00c('0xe')](_0xb00c('0x1e'))[_0xb00c('0xf')](';'):null;},'comment':_0xb00c('0x1f')},'autoframing':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x20'),'set':function(_0x5db62d){this['setDataValue'](_0xb00c('0x21'),_0x5db62d?_0x5db62d[_0xb00c('0xd')](','):null);},'get':function(){return this[_0xb00c('0xe')](_0xb00c('0x21'))?this[_0xb00c('0xe')](_0xb00c('0x21'))[_0xb00c('0xf')](','):null;},'comment':_0xb00c('0x22')},'trustrpid':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'accountcode':{'type':Sequelize[_0xb00c('0x24')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xb00c('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':_0xb00c('0x16')},'busylevel':{'type':Sequelize[_0xb00c('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xb00c('0x5')]},'template':{'type':Sequelize[_0xb00c('0x5')]},'videosupport':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'mailbox':{'type':Sequelize[_0xb00c('0x5')]},'session_timers':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x27'),_0xb00c('0x28'),_0xb00c('0x29'))},'session_expires':{'type':Sequelize[_0xb00c('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xb00c('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x2a'),_0xb00c('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xb00c('0x5')]},'regexten':{'type':Sequelize[_0xb00c('0x5')]},'fromdomain':{'type':Sequelize[_0xb00c('0x5')]},'fromuser':{'type':Sequelize[_0xb00c('0x5')]},'port':{'type':Sequelize[_0xb00c('0x24')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no'),'defaultValue':_0xb00c('0x16')},'keepalive':{'type':Sequelize[_0xb00c('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xb00c('0x5')]},'defaultuser':{'type':Sequelize[_0xb00c('0x5')]},'rtptimeout':{'type':Sequelize[_0xb00c('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb00c('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb00c('0x5')]},'callbackextension':{'type':Sequelize[_0xb00c('0x5')]},'timert1':{'type':Sequelize[_0xb00c('0x24')](0xb)},'timerb':{'type':Sequelize[_0xb00c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb00c('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xb00c('0x5')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xb00c('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0xb00c('0x5')]},'use_q850_reason':{'type':Sequelize[_0xb00c('0x5')]},'maxforwards':{'type':Sequelize[_0xb00c('0x24')](0xb)},'encryption':{'type':Sequelize[_0xb00c('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xb00c('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no',_0xb00c('0x2d'),_0xb00c('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xb00c('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xb00c('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0xb00c('0x5')]},'dtlscipher':{'type':Sequelize[_0xb00c('0x5')]},'dtlscafile':{'type':Sequelize[_0xb00c('0x5')]},'dtlscapath':{'type':Sequelize[_0xb00c('0x5')]},'dtlssetup':{'type':Sequelize[_0xb00c('0x2')]('active',_0xb00c('0x2f'),_0xb00c('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb00c('0x5')]},'usereqphone':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb00c('0x5')]},'recordofffeature':{'type':Sequelize[_0xb00c('0x5')]},'call_limit':{'type':Sequelize[_0xb00c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xb00c('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xb00c('0x5')]},'mohsuggest':{'type':Sequelize[_0xb00c('0x5')]},'parkinglot':{'type':Sequelize[_0xb00c('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00c('0x5')],'defaultValue':_0xb00c('0x31')},'canreinvite':{'type':Sequelize[_0xb00c('0x2')](_0xb00c('0x16'),'no',_0xb00c('0x17'),_0xb00c('0x32'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb00c('0x5')]},'otherFields':{'type':Sequelize[_0xb00c('0x5')]},'active':{'type':Sequelize[_0xb00c('0x33')],'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 9b898bc..0d1512f 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x53e088,_0x51a639){var _0x3de518=function(_0x22a1f5){while(--_0x22a1f5){_0x53e088['push'](_0x53e088['shift']());}};_0x3de518(++_0x51a639);}(_0xedd9,0xfc));var _0x9edd=function(_0x2f73ec,_0x4b8f92){_0x2f73ec=_0x2f73ec-0x0;var _0x5c52d5=_0xedd9[_0x2f73ec];return _0x5c52d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x526dc2,_0x37ebb8){var _0x54e521=function(_0x186bfb){while(--_0x186bfb){_0x526dc2['push'](_0x526dc2['shift']());}};_0x54e521(++_0x37ebb8);}(_0x9f62,0x154));var _0x29f6=function(_0x588bf6,_0xb73af3){_0x588bf6=_0x588bf6-0x0;var _0x3327eb=_0x9f62[_0x588bf6];return _0x3327eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index a628fc8..485ab93 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 _0x0bb3=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','lodash'];(function(_0x40bfc2,_0x538e26){var _0x14d1db=function(_0x3c46bc){while(--_0x3c46bc){_0x40bfc2['push'](_0x40bfc2['shift']());}};_0x14d1db(++_0x538e26);}(_0x0bb3,0xcb));var _0x30bb=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x0bb3[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x30bb('0x0'));var util=require(_0x30bb('0x1'));var logger=require(_0x30bb('0x2'))('api');var moment=require(_0x30bb('0x3'));var BPromise=require(_0x30bb('0x4'));var rp=require(_0x30bb('0x5'));var fs=require('fs');var path=require(_0x30bb('0x6'));var rimraf=require(_0x30bb('0x7'));var config=require(_0x30bb('0x8'));var attributes=require(_0x30bb('0x9'));module[_0x30bb('0xa')]=function(_0x522fe2,_0x358dc7){return _0x522fe2[_0x30bb('0xb')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x919d=['api','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','lodash','util'];(function(_0x7e8e4,_0x8a8600){var _0x1f09e2=function(_0xd57505){while(--_0xd57505){_0x7e8e4['push'](_0x7e8e4['shift']());}};_0x1f09e2(++_0x8a8600);}(_0x919d,0xd6));var _0xd919=function(_0x5502a7,_0x325618){_0x5502a7=_0x5502a7-0x0;var _0x3946fa=_0x919d[_0x5502a7];return _0x3946fa;};'use strict';var _=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var logger=require('../../config/logger')(_0xd919('0x2'));var moment=require(_0xd919('0x3'));var BPromise=require(_0xd919('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x5'));var rimraf=require(_0xd919('0x6'));var config=require(_0xd919('0x7'));var attributes=require(_0xd919('0x8'));module['exports']=function(_0x263b4f,_0x350e98){return _0x263b4f[_0xd919('0x9')](_0xd919('0xa'),attributes,{'tableName':_0xd919('0xb'),'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 23096ab..a5b1447 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 _0x4fd6=['rpc','jayson/promise','client','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','find','catch','ShowTrunk','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x192a5b,_0x55f180){var _0x1d5764=function(_0x51c4ac){while(--_0x51c4ac){_0x192a5b['push'](_0x192a5b['shift']());}};_0x1d5764(++_0x55f180);}(_0x4fd6,0x1a8));var _0x64fd=function(_0x4a310d,_0x33322d){_0x4a310d=_0x4a310d-0x0;var _0x5eaf36=_0x4fd6[_0x4a310d];return _0x5eaf36;};'use strict';var _=require(_0x64fd('0x0'));var util=require(_0x64fd('0x1'));var moment=require(_0x64fd('0x2'));var BPromise=require(_0x64fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64fd('0x4'));var db=require(_0x64fd('0x5'))['db'];var utils=require(_0x64fd('0x6'));var logger=require(_0x64fd('0x7'))(_0x64fd('0x8'));var config=require('../../config/environment');var jayson=require(_0x64fd('0x9'));var client=jayson[_0x64fd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25ad0c,_0x2952dd,_0x5e2aaf){return new BPromise(function(_0x2c33bc,_0x566799){return client[_0x64fd('0xb')](_0x25ad0c,_0x5e2aaf)[_0x64fd('0xc')](function(_0x4b6c91){logger['info']('Trunk,\x20%s,\x20%s',_0x2952dd,_0x64fd('0xd'));logger[_0x64fd('0xe')](_0x64fd('0xf'),_0x2952dd,_0x64fd('0xd'),JSON[_0x64fd('0x10')](_0x4b6c91));if(_0x4b6c91[_0x64fd('0x11')]){if(_0x4b6c91[_0x64fd('0x11')][_0x64fd('0x12')]===0x1f4){logger['error'](_0x64fd('0x13'),_0x2952dd,_0x4b6c91[_0x64fd('0x11')][_0x64fd('0x14')]);return _0x566799(_0x4b6c91[_0x64fd('0x11')][_0x64fd('0x14')]);}logger[_0x64fd('0x11')](_0x64fd('0x13'),_0x2952dd,_0x4b6c91[_0x64fd('0x11')][_0x64fd('0x14')]);return _0x2c33bc(_0x4b6c91['error']['message']);}else{logger[_0x64fd('0x15')](_0x64fd('0x13'),_0x2952dd,_0x64fd('0xd'));_0x2c33bc(_0x4b6c91['result'][_0x64fd('0x14')]);}})['catch'](function(_0x46fbe6){logger[_0x64fd('0x11')]('Trunk,\x20%s,\x20%s',_0x2952dd,_0x46fbe6);_0x566799(_0x46fbe6);});});}exports[_0x64fd('0x16')]=function(_0x28f817){var _0x230841=this;return new Promise(function(_0x4e44b4,_0x583349){return db[_0x64fd('0x17')][_0x64fd('0x18')]({'raw':_0x28f817[_0x64fd('0x19')]?_0x28f817[_0x64fd('0x19')][_0x64fd('0x1a')]===undefined?!![]:![]:!![],'where':_0x28f817[_0x64fd('0x19')]?_0x28f817[_0x64fd('0x19')][_0x64fd('0x1b')]||null:null,'attributes':_0x28f817['options']?_0x28f817[_0x64fd('0x19')][_0x64fd('0x1c')]||null:null,'limit':_0x28f817[_0x64fd('0x19')]?_0x28f817['options'][_0x64fd('0x1d')]||null:null,'include':_0x28f817[_0x64fd('0x19')]?_0x28f817[_0x64fd('0x19')][_0x64fd('0x1e')]?_[_0x64fd('0x1f')](_0x28f817[_0x64fd('0x19')][_0x64fd('0x1e')],function(_0xd9b65c){return{'model':db[_0xd9b65c[_0x64fd('0x20')]],'as':_0xd9b65c['as'],'attributes':_0xd9b65c[_0x64fd('0x1c')],'include':_0xd9b65c[_0x64fd('0x1e')]?_[_0x64fd('0x1f')](_0xd9b65c['include'],function(_0x1718b6){return{'model':db[_0x1718b6[_0x64fd('0x20')]],'as':_0x1718b6['as'],'attributes':_0x1718b6[_0x64fd('0x1c')],'include':_0x1718b6['include']?_[_0x64fd('0x1f')](_0x1718b6['include'],function(_0x2baeee){return{'model':db[_0x2baeee[_0x64fd('0x20')]],'as':_0x2baeee['as'],'attributes':_0x2baeee[_0x64fd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x64fd('0xc')](function(_0x397f95){logger['info'](_0x64fd('0x16'),_0x28f817);logger[_0x64fd('0xe')](_0x64fd('0x16'),_0x28f817,JSON['stringify'](_0x397f95));_0x4e44b4(_0x397f95);})['catch'](function(_0x295768){logger[_0x64fd('0x11')]('GetTrunk',_0x295768[_0x64fd('0x14')],_0x28f817);_0x583349(_0x230841[_0x64fd('0x11')](0x1f4,_0x295768[_0x64fd('0x14')]));});});};exports['ShowTrunk']=function(_0x12adc1){var _0x8b43=this;return new Promise(function(_0x53bb12,_0x2e3923){return db[_0x64fd('0x17')][_0x64fd('0x21')]({'raw':_0x12adc1[_0x64fd('0x19')]?_0x12adc1[_0x64fd('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12adc1[_0x64fd('0x19')]?_0x12adc1[_0x64fd('0x19')]['where']||null:null,'attributes':_0x12adc1[_0x64fd('0x19')]?_0x12adc1[_0x64fd('0x19')][_0x64fd('0x1c')]||null:null,'include':_0x12adc1[_0x64fd('0x19')]?_0x12adc1['options']['include']?_[_0x64fd('0x1f')](_0x12adc1['options'][_0x64fd('0x1e')],function(_0x4d6224){return{'model':db[_0x4d6224[_0x64fd('0x20')]],'as':_0x4d6224['as'],'attributes':_0x4d6224['attributes'],'include':_0x4d6224[_0x64fd('0x1e')]?_[_0x64fd('0x1f')](_0x4d6224[_0x64fd('0x1e')],function(_0x52b061){return{'model':db[_0x52b061[_0x64fd('0x20')]],'as':_0x52b061['as'],'attributes':_0x52b061['attributes'],'include':_0x52b061['include']?_[_0x64fd('0x1f')](_0x52b061[_0x64fd('0x1e')],function(_0xdd5694){return{'model':db[_0xdd5694[_0x64fd('0x20')]],'as':_0xdd5694['as'],'attributes':_0xdd5694[_0x64fd('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a51b0){logger[_0x64fd('0x15')]('ShowTrunk',_0x12adc1);logger[_0x64fd('0xe')]('ShowTrunk',_0x12adc1,JSON[_0x64fd('0x10')](_0x2a51b0));_0x53bb12(_0x2a51b0);})[_0x64fd('0x22')](function(_0x594ff0){logger[_0x64fd('0x11')](_0x64fd('0x23'),_0x594ff0[_0x64fd('0x14')],_0x12adc1);_0x2e3923(_0x8b43['error'](0x1f4,_0x594ff0['message']));});});}; \ No newline at end of file +var _0xf4a4=['Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','ShowTrunk','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4a4,0x1f2));var _0x4f4a=function(_0x29a497,_0x20a68f){_0x29a497=_0x29a497-0x0;var _0x52897d=_0xf4a4[_0x29a497];return _0x52897d;};'use strict';var _=require('lodash');var util=require(_0x4f4a('0x0'));var moment=require(_0x4f4a('0x1'));var BPromise=require(_0x4f4a('0x2'));var rs=require(_0x4f4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f4a('0x4'))['db'];var utils=require(_0x4f4a('0x5'));var logger=require(_0x4f4a('0x6'))('rpc');var config=require(_0x4f4a('0x7'));var jayson=require(_0x4f4a('0x8'));var client=jayson[_0x4f4a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27144f,_0x36b7d8,_0xc94a87){return new BPromise(function(_0x314944,_0x3701bd){return client[_0x4f4a('0xa')](_0x27144f,_0xc94a87)[_0x4f4a('0xb')](function(_0x3cfdf2){logger['info'](_0x4f4a('0xc'),_0x36b7d8,'request\x20sent');logger[_0x4f4a('0xd')](_0x4f4a('0xe'),_0x36b7d8,_0x4f4a('0xf'),JSON[_0x4f4a('0x10')](_0x3cfdf2));if(_0x3cfdf2[_0x4f4a('0x11')]){if(_0x3cfdf2[_0x4f4a('0x11')]['code']===0x1f4){logger['error'](_0x4f4a('0xc'),_0x36b7d8,_0x3cfdf2['error'][_0x4f4a('0x12')]);return _0x3701bd(_0x3cfdf2[_0x4f4a('0x11')][_0x4f4a('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x36b7d8,_0x3cfdf2[_0x4f4a('0x11')][_0x4f4a('0x12')]);return _0x314944(_0x3cfdf2[_0x4f4a('0x11')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x36b7d8,_0x4f4a('0xf'));_0x314944(_0x3cfdf2[_0x4f4a('0x13')][_0x4f4a('0x12')]);}})['catch'](function(_0x20a91d){logger[_0x4f4a('0x11')](_0x4f4a('0xc'),_0x36b7d8,_0x20a91d);_0x3701bd(_0x20a91d);});});}exports[_0x4f4a('0x14')]=function(_0x56e5d3){var _0x29792a=this;return new Promise(function(_0x19d6b8,_0x18a2b4){return db[_0x4f4a('0x15')][_0x4f4a('0x16')]({'raw':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x19')]||null:null,'attributes':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1a')]||null:null,'limit':_0x56e5d3['options']?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1b')]||null:null,'include':_0x56e5d3[_0x4f4a('0x17')]?_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x56e5d3[_0x4f4a('0x17')][_0x4f4a('0x1c')],function(_0x1945f5){return{'model':db[_0x1945f5[_0x4f4a('0x1e')]],'as':_0x1945f5['as'],'attributes':_0x1945f5[_0x4f4a('0x1a')],'include':_0x1945f5[_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x1945f5['include'],function(_0x2b6e17){return{'model':db[_0x2b6e17[_0x4f4a('0x1e')]],'as':_0x2b6e17['as'],'attributes':_0x2b6e17[_0x4f4a('0x1a')],'include':_0x2b6e17[_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x2b6e17[_0x4f4a('0x1c')],function(_0x5b6e10){return{'model':db[_0x5b6e10[_0x4f4a('0x1e')]],'as':_0x5b6e10['as'],'attributes':_0x5b6e10[_0x4f4a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f4a('0xb')](function(_0x23a2f6){logger[_0x4f4a('0x1f')](_0x4f4a('0x14'),_0x56e5d3);logger[_0x4f4a('0xd')](_0x4f4a('0x14'),_0x56e5d3,JSON[_0x4f4a('0x10')](_0x23a2f6));_0x19d6b8(_0x23a2f6);})[_0x4f4a('0x20')](function(_0x3ec7c6){logger[_0x4f4a('0x11')](_0x4f4a('0x14'),_0x3ec7c6['message'],_0x56e5d3);_0x18a2b4(_0x29792a[_0x4f4a('0x11')](0x1f4,_0x3ec7c6['message']));});});};exports[_0x4f4a('0x21')]=function(_0x1a746a){var _0x3a71ba=this;return new Promise(function(_0x278196,_0x584155){return db[_0x4f4a('0x15')]['find']({'raw':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x18')]===undefined?!![]:![]:!![],'where':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x19')]||null:null,'attributes':_0x1a746a['options']?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x1a')]||null:null,'include':_0x1a746a[_0x4f4a('0x17')]?_0x1a746a[_0x4f4a('0x17')][_0x4f4a('0x1c')]?_[_0x4f4a('0x1d')](_0x1a746a[_0x4f4a('0x17')]['include'],function(_0x5ce5af){return{'model':db[_0x5ce5af['model']],'as':_0x5ce5af['as'],'attributes':_0x5ce5af[_0x4f4a('0x1a')],'include':_0x5ce5af['include']?_['map'](_0x5ce5af[_0x4f4a('0x1c')],function(_0x4b5e3d){return{'model':db[_0x4b5e3d[_0x4f4a('0x1e')]],'as':_0x4b5e3d['as'],'attributes':_0x4b5e3d['attributes'],'include':_0x4b5e3d[_0x4f4a('0x1c')]?_['map'](_0x4b5e3d['include'],function(_0x17f4e0){return{'model':db[_0x17f4e0[_0x4f4a('0x1e')]],'as':_0x17f4e0['as'],'attributes':_0x17f4e0[_0x4f4a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f4a('0xb')](function(_0x470509){logger[_0x4f4a('0x1f')](_0x4f4a('0x21'),_0x1a746a);logger['debug']('ShowTrunk',_0x1a746a,JSON[_0x4f4a('0x10')](_0x470509));_0x278196(_0x470509);})['catch'](function(_0x3564cb){logger[_0x4f4a('0x11')](_0x4f4a('0x21'),_0x3564cb[_0x4f4a('0x12')],_0x1a746a);_0x584155(_0x3a71ba['error'](0x1f4,_0x3564cb['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d7c3704..19bddf5 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 _0x6125=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x6125,0x1b2));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x5612('0x0'));var router=express[_0x5612('0x1')]();var auth=require(_0x5612('0x2'));var controller=require(_0x5612('0x3'));router['put'](_0x5612('0x4'),auth[_0x5612('0x5')](),controller[_0x5612('0x6')]);module[_0x5612('0x7')]=router; \ No newline at end of file +var _0x0f4c=['express','Router','./user-setting.controller','put','update'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x0f4c,0x18b));var _0xc0f4=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0x0f4c[_0x37e845];return _0x59e55b;};'use strict';var express=require(_0xc0f4('0x0'));var router=express[_0xc0f4('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc0f4('0x2'));router[_0xc0f4('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xc0f4('0x4')]);module['exports']=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 7c4eef7..a46d07b 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 _0x177d=['info','debug','ENUM','error','BOOLEAN','TEXT','DATE','sequelize','warning'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x177d,0xf1));var _0xd177=function(_0x8db7d7,_0x525275){_0x8db7d7=_0x8db7d7-0x0;var _0x2d8ba7=_0x177d[_0x8db7d7];return _0x2d8ba7;};'use strict';var Sequelize=require(_0xd177('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xd177('0x1'),_0xd177('0x2'),_0xd177('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xd177('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd177('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd177('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd177('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd177('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0xfd72=['UserId','error','info','debug','exports','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x16b248,_0x5eba31){var _0x53105b=function(_0x4a6413){while(--_0x4a6413){_0x16b248['push'](_0x16b248['shift']());}};_0x53105b(++_0x5eba31);}(_0xfd72,0xac));var _0x2fd7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfd72[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x2fd7('0x0'),'warning',_0x2fd7('0x1'),_0x2fd7('0x2')];module[_0x2fd7('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2fd7('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2fd7('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2fd7('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2fd7('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2fd7('0x7')],'unique':_0x2fd7('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 87a7a43..a739c3b 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 _0xd84b=['Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','body','catch','ioredis','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','localhost','sendStatus','stack','name','status','send','user','role','admin'];(function(_0x18d78f,_0x45bda6){var _0x19dce2=function(_0x2e4458){while(--_0x2e4458){_0x18d78f['push'](_0x18d78f['shift']());}};_0x19dce2(++_0x45bda6);}(_0xd84b,0x177));var _0xbd84=function(_0xacf477,_0x57d5c3){_0xacf477=_0xacf477-0x0;var _0x55d721=_0xd84b[_0xacf477];return _0x55d721;};'use strict';var _=require('lodash');var Redis=require(_0xbd84('0x0'));var logger=require(_0xbd84('0x1'))(_0xbd84('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xbd84('0x3'))(new Redis(config[_0xbd84('0x4')]));require(_0xbd84('0x5'))[_0xbd84('0x6')](socket);config['redis']=_['defaults'](config[_0xbd84('0x4')],{'host':_0xbd84('0x7'),'port':0x18eb});function respondWithResult(_0x32211a,_0x597a3f){_0x597a3f=_0x597a3f||0xc8;return function(_0x50c325){if(_0x50c325){return _0x32211a['status'](_0x597a3f)['json'](_0x50c325);}};}function saveUpdates(_0x41378e){return function(_0x4e0497){if(_0x4e0497){return _0x4e0497['update'](_0x41378e)['then'](function(_0x4b9d94){return _0x4b9d94;});}return null;};}function handleEntityNotFound(_0x4b9ada){return function(_0x282177){if(!_0x282177){_0x4b9ada[_0xbd84('0x8')](0x194);}return _0x282177;};}function handleError(_0x22a69d,_0xf9a392){_0xf9a392=_0xf9a392||0x1f4;return function(_0x40d530){logger['error'](_0x40d530[_0xbd84('0x9')]);if(_0x40d530[_0xbd84('0xa')]){delete _0x40d530[_0xbd84('0xa')];}_0x22a69d[_0xbd84('0xb')](_0xf9a392)[_0xbd84('0xc')](_0x40d530);};}exports['update']=function(_0x4687e9,_0x5cb132){if(_0x4687e9[_0xbd84('0xd')][_0xbd84('0xe')]!==_0xbd84('0xf'))throw new Error(_0xbd84('0x10'));if(isNaN(Number(_0x4687e9[_0xbd84('0x11')]['id'])))throw new Error(_0xbd84('0x12'));return db['UserSetting'][_0xbd84('0x13')]({'where':{'id':_0x4687e9[_0xbd84('0x11')]['id']}})['then'](handleEntityNotFound(_0x5cb132,null))[_0xbd84('0x14')](saveUpdates(_0x4687e9[_0xbd84('0x15')],null))[_0xbd84('0x14')](respondWithResult(_0x5cb132,null))[_0xbd84('0x16')](handleError(_0x5cb132,null));}; \ No newline at end of file +var _0x2cc1=['find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','defaults','status','json','update','then','sendStatus','error','stack','name','send','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0x166212,_0x2e9aec){var _0x4632b7=function(_0x277967){while(--_0x277967){_0x166212['push'](_0x166212['shift']());}};_0x4632b7(++_0x2e9aec);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x2c1101,_0x1909d9){_0x2c1101=_0x2c1101-0x0;var _0x56f52f=_0x2cc1[_0x2c1101];return _0x56f52f;};'use strict';var _=require(_0x12cc('0x0'));var Redis=require(_0x12cc('0x1'));var logger=require(_0x12cc('0x2'))(_0x12cc('0x3'));var config=require(_0x12cc('0x4'));var db=require(_0x12cc('0x5'))['db'];var socket=require(_0x12cc('0x6'))(new Redis(config[_0x12cc('0x7')]));require('./user-setting.socket')['register'](socket);config[_0x12cc('0x7')]=_[_0x12cc('0x8')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3dee73,_0x132370){_0x132370=_0x132370||0xc8;return function(_0x21d042){if(_0x21d042){return _0x3dee73[_0x12cc('0x9')](_0x132370)[_0x12cc('0xa')](_0x21d042);}};}function saveUpdates(_0x1597c0){return function(_0x2dc401){if(_0x2dc401){return _0x2dc401[_0x12cc('0xb')](_0x1597c0)[_0x12cc('0xc')](function(_0x353689){return _0x353689;});}return null;};}function handleEntityNotFound(_0x1a4192){return function(_0x27adee){if(!_0x27adee){_0x1a4192[_0x12cc('0xd')](0x194);}return _0x27adee;};}function handleError(_0x4fcf41,_0x865d59){_0x865d59=_0x865d59||0x1f4;return function(_0x4cdc4c){logger[_0x12cc('0xe')](_0x4cdc4c[_0x12cc('0xf')]);if(_0x4cdc4c[_0x12cc('0x10')]){delete _0x4cdc4c[_0x12cc('0x10')];}_0x4fcf41[_0x12cc('0x9')](_0x865d59)[_0x12cc('0x11')](_0x4cdc4c);};}exports['update']=function(_0x5909d3,_0x45e5aa){if(_0x5909d3['user'][_0x12cc('0x12')]!=='admin')throw new Error(_0x12cc('0x13'));if(isNaN(Number(_0x5909d3[_0x12cc('0x14')]['id'])))throw new Error(_0x12cc('0x15'));return db[_0x12cc('0x16')][_0x12cc('0x17')]({'where':{'id':_0x5909d3[_0x12cc('0x14')]['id']}})['then'](handleEntityNotFound(_0x45e5aa,null))[_0x12cc('0xc')](saveUpdates(_0x5909d3[_0x12cc('0x18')],null))['then'](respondWithResult(_0x45e5aa,null))[_0x12cc('0x19')](handleError(_0x45e5aa,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 51fbcf8..5fe7fce 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 _0x2d57=['emit','hasOwnProperty','hook','exports','events','UserSetting','setMaxListeners','save','remove'];(function(_0x470b87,_0x3bf4b8){var _0xf8fb24=function(_0x41af84){while(--_0x41af84){_0x470b87['push'](_0x470b87['shift']());}};_0xf8fb24(++_0x3bf4b8);}(_0x2d57,0x79));var _0x72d5=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x2d57[_0x4bdf64];return _0x9a1a19;};'use strict';var EventEmitter=require(_0x72d5('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x72d5('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x72d5('0x2')](0x0);var events={'afterCreate':_0x72d5('0x3'),'afterUpdate':'update','afterDestroy':_0x72d5('0x4')};function emitEvent(_0x4acf0b){return function(_0x102efd,_0x270e5a,_0x8eed70){UserSettingEvents[_0x72d5('0x5')](_0x4acf0b+':'+_0x102efd['id'],_0x102efd);UserSettingEvents[_0x72d5('0x5')](_0x4acf0b,_0x102efd);_0x8eed70(null);};}for(var e in events){if(events[_0x72d5('0x6')](e)){var event=events[e];UserSetting[_0x72d5('0x7')](e,emitEvent(event));}}module[_0x72d5('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x1a46=['setMaxListeners','save','update','remove','exports','../../mysqldb'];(function(_0x17de2c,_0x1e6708){var _0xbe6716=function(_0x347adc){while(--_0x347adc){_0x17de2c['push'](_0x17de2c['shift']());}};_0xbe6716(++_0x1e6708);}(_0x1a46,0x13d));var _0x61a4=function(_0x5f25d2,_0x3e6525){_0x5f25d2=_0x5f25d2-0x0;var _0x229197=_0x1a46[_0x5f25d2];return _0x229197;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x61a4('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x61a4('0x1')](0x0);var events={'afterCreate':_0x61a4('0x2'),'afterUpdate':_0x61a4('0x3'),'afterDestroy':_0x61a4('0x4')};function emitEvent(_0x57214c){return function(_0x169d56,_0x4d0343,_0x1bd8ff){UserSettingEvents['emit'](_0x57214c+':'+_0x169d56['id'],_0x169d56);UserSettingEvents['emit'](_0x57214c,_0x169d56);_0x1bd8ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x61a4('0x5')]=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 8d0bca4..21bb7b4 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 _0x5d86=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x215fba,_0x2df8f4){var _0x2f8d43=function(_0x175164){while(--_0x175164){_0x215fba['push'](_0x215fba['shift']());}};_0x2f8d43(++_0x2df8f4);}(_0x5d86,0x76));var _0x65d8=function(_0x14c7b3,_0x4677b7){_0x14c7b3=_0x14c7b3-0x0;var _0x1518ef=_0x5d86[_0x14c7b3];return _0x1518ef;};'use strict';var attributes=require(_0x65d8('0x0'));module[_0x65d8('0x1')]=function(_0x5686cc){return _0x5686cc['define'](_0x65d8('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bfcd7){if(!_0x2bfcd7[_0x65d8('0x3')])_0x2bfcd7['clientSideLoggingEnabledSince']=null;else if(_0x2bfcd7[_0x65d8('0x4')]===null)_0x2bfcd7['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xcffe=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x4ccf97,_0x37c63b){var _0x5a8af1=function(_0x48b3b2){while(--_0x48b3b2){_0x4ccf97['push'](_0x4ccf97['shift']());}};_0x5a8af1(++_0x37c63b);}(_0xcffe,0x1a1));var _0xecff=function(_0x481604,_0x276ff8){_0x481604=_0x481604-0x0;var _0x1ca4ed=_0xcffe[_0x481604];return _0x1ca4ed;};'use strict';var attributes=require(_0xecff('0x0'));module[_0xecff('0x1')]=function(_0x1946a1){return _0x1946a1[_0xecff('0x2')](_0xecff('0x3'),attributes,{'tableName':_0xecff('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfe1d81){if(!_0xfe1d81[_0xecff('0x5')])_0xfe1d81[_0xecff('0x6')]=null;else if(_0xfe1d81[_0xecff('0x6')]===null)_0xfe1d81['clientSideLoggingEnabledSince']=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 82f5024..5fafc1f 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 _0xd757=['./user-setting.events','save','remove','emit','user-setting:update:user-','UserId','register','user-setting:'];(function(_0x440bed,_0x45b0c7){var _0x509cfd=function(_0x9c4c64){while(--_0x9c4c64){_0x440bed['push'](_0x440bed['shift']());}};_0x509cfd(++_0x45b0c7);}(_0xd757,0x68));var _0x7d75=function(_0x225053,_0x194dee){_0x225053=_0x225053-0x0;var _0x167572=_0xd757[_0x225053];return _0x167572;};'use strict';var UserSettingEvents=require(_0x7d75('0x0'));var events=[_0x7d75('0x1'),_0x7d75('0x2'),'update'];function createListener(_0xb098d1,_0x5051f2){return function(_0x452c77){_0x5051f2[_0x7d75('0x3')](_0xb098d1,_0x452c77);if(_0xb098d1==='user-setting:update'){_0x5051f2[_0x7d75('0x3')](_0x7d75('0x4')+_0x452c77[_0x7d75('0x5')],_0x452c77);}};}exports[_0x7d75('0x6')]=function(_0x44042a){for(var _0x5b9159=0x0,_0xe861a6=events['length'];_0x5b9159<_0xe861a6;_0x5b9159++){var _0x49b324=events[_0x5b9159];var _0x41d223=createListener(_0x7d75('0x7')+_0x49b324,_0x44042a);UserSettingEvents['on'](_0x49b324,_0x41d223);}}; \ No newline at end of file +var _0xe0ab=['./user-setting.events','save','remove','user-setting:update','emit','UserId','register','length'];(function(_0x44d456,_0x21528a){var _0x2cf549=function(_0x2765dd){while(--_0x2765dd){_0x44d456['push'](_0x44d456['shift']());}};_0x2cf549(++_0x21528a);}(_0xe0ab,0x1d8));var _0xbe0a=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe0ab[_0x4243a3];return _0x1b2a33;};'use strict';var UserSettingEvents=require(_0xbe0a('0x0'));var events=[_0xbe0a('0x1'),_0xbe0a('0x2'),'update'];function createListener(_0x215c59,_0x4fb6be){return function(_0x367f7d){_0x4fb6be['emit'](_0x215c59,_0x367f7d);if(_0x215c59===_0xbe0a('0x3')){_0x4fb6be[_0xbe0a('0x4')]('user-setting:update:user-'+_0x367f7d[_0xbe0a('0x5')],_0x367f7d);}};}exports[_0xbe0a('0x6')]=function(_0x26b510){for(var _0x339c69=0x0,_0xe08709=events[_0xbe0a('0x7')];_0x339c69<_0xe08709;_0x339c69++){var _0x1213ee=events[_0x339c69];var _0x9342a9=createListener('user-setting:'+_0x1213ee,_0x26b510);UserSettingEvents['on'](_0x1213ee,_0x9342a9);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e92e852..b975e7f 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 _0x5744=['index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','addQueues','join','root','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeSquareProjects','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5744,0x65));var _0x4574=function(_0x523332,_0x586247){_0x523332=_0x523332-0x0;var _0x46dd88=_0x5744[_0x523332];return _0x46dd88;};'use strict';var multer=require(_0x4574('0x0'));var util=require(_0x4574('0x1'));var path=require(_0x4574('0x2'));var timeout=require('connect-timeout');var express=require(_0x4574('0x3'));var router=express[_0x4574('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4574('0x5'));var interaction=require(_0x4574('0x6'));var config=require(_0x4574('0x7'));var controller=require(_0x4574('0x8'));router['get']('/',auth[_0x4574('0x9')](),controller[_0x4574('0xa')]);router[_0x4574('0xb')](_0x4574('0xc'),auth[_0x4574('0x9')](),controller[_0x4574('0xd')]);router[_0x4574('0xb')](_0x4574('0xe'),auth[_0x4574('0x9')](),controller[_0x4574('0xf')]);router[_0x4574('0xb')](_0x4574('0x10'),auth[_0x4574('0x9')](),controller[_0x4574('0x11')]);router[_0x4574('0xb')](_0x4574('0x12'),auth[_0x4574('0x9')](),controller[_0x4574('0x13')]);router[_0x4574('0xb')](_0x4574('0x14'),controller['getAvatar']);router['get'](_0x4574('0x15'),auth[_0x4574('0x9')](),controller['getOpenTabs']);router[_0x4574('0xb')](_0x4574('0x16'),auth[_0x4574('0x9')](),controller[_0x4574('0x17')]);router['get'](_0x4574('0x18'),auth[_0x4574('0x9')](),controller[_0x4574('0x19')]);router[_0x4574('0xb')](_0x4574('0x1a'),auth[_0x4574('0x9')](),controller[_0x4574('0x1b')]);router['get'](_0x4574('0x1c'),auth['isAuthenticated'](),controller[_0x4574('0x1d')]);router[_0x4574('0xb')](_0x4574('0x1e'),auth[_0x4574('0x9')](),controller['getRecordings']);router[_0x4574('0xb')](_0x4574('0x1f'),auth[_0x4574('0x9')](),controller[_0x4574('0x20')]);router['get']('/:id/chat/interactions',auth[_0x4574('0x9')](),controller['getChatInteractions']);router[_0x4574('0xb')]('/:id/openchannel/interactions',auth[_0x4574('0x9')](),controller[_0x4574('0x21')]);router[_0x4574('0xb')](_0x4574('0x22'),auth['isAuthenticated'](),controller[_0x4574('0x23')]);router['get'](_0x4574('0x24'),auth[_0x4574('0x9')](),controller[_0x4574('0x25')]);router[_0x4574('0xb')]('/:id/fax/interactions',auth[_0x4574('0x9')](),controller['getFaxInteractions']);router[_0x4574('0xb')](_0x4574('0x26'),auth[_0x4574('0x9')](),controller['getWhatsappInteractions']);router[_0x4574('0xb')](_0x4574('0x27'),auth[_0x4574('0x9')](),controller[_0x4574('0x28')]);router['get']('/:id/lists',auth[_0x4574('0x9')](),controller[_0x4574('0x29')]);router[_0x4574('0xb')]('/:id/agents',auth[_0x4574('0x9')](),controller[_0x4574('0x2a')]);router['get'](_0x4574('0x2b'),auth['isAuthenticated'](),controller[_0x4574('0x2c')]);router[_0x4574('0xb')](_0x4574('0x2d'),auth[_0x4574('0x9')](),controller[_0x4574('0x2e')]);router[_0x4574('0xb')](_0x4574('0x2f'),auth[_0x4574('0x9')](),controller['getMailAccounts']);router[_0x4574('0xb')](_0x4574('0x30'),auth[_0x4574('0x9')](),controller[_0x4574('0x31')]);router[_0x4574('0xb')](_0x4574('0x32'),auth[_0x4574('0x9')](),controller[_0x4574('0x33')]);router[_0x4574('0xb')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x4574('0x34')]);router[_0x4574('0xb')](_0x4574('0x35'),auth['isAuthenticated'](),controller[_0x4574('0x36')]);router[_0x4574('0xb')](_0x4574('0x37'),auth[_0x4574('0x9')](),controller['getSquareProjects']);router[_0x4574('0xb')](_0x4574('0x38'),auth[_0x4574('0x9')](),controller[_0x4574('0x39')]);router[_0x4574('0xb')](_0x4574('0x3a'),auth[_0x4574('0x9')](),controller[_0x4574('0x3b')]);router[_0x4574('0x3c')](_0x4574('0x16'),auth['isAuthenticated'](),controller['addContacts']);router[_0x4574('0x3c')]('/',auth[_0x4574('0x9')](),controller['create']);router['post'](_0x4574('0x3d'),auth[_0x4574('0x9')](),controller['bulkCreate']);router[_0x4574('0x3c')](_0x4574('0x18'),auth['isAuthenticated'](),controller[_0x4574('0x3e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19aa11,_0x17bc84,_0x1d1382){_0x1d1382(null,path[_0x4574('0x3f')](config[_0x4574('0x40')],'server/files/images/'));},'filename':function(_0x445d47,_0x192e0,_0x4efcdd){_0x4efcdd(null,util['format'](_0x4574('0x41'),Date['now'](),_0x192e0[_0x4574('0x42')]));}})});router[_0x4574('0x3c')]('/:id/avatar',upload[_0x4574('0x43')](_0x4574('0x44')),controller[_0x4574('0x45')]);router['post'](_0x4574('0x46'),auth[_0x4574('0x9')](),controller[_0x4574('0x47')]);router[_0x4574('0x3c')](_0x4574('0x48'),auth['isAuthenticated'](),controller[_0x4574('0x49')]);router[_0x4574('0x3c')](_0x4574('0x4a'),auth[_0x4574('0x9')](),controller[_0x4574('0x4b')]);router[_0x4574('0x3c')](_0x4574('0x4c'),auth[_0x4574('0x9')](),controller['unpause']);router[_0x4574('0x3c')]('/:id/teams',auth[_0x4574('0x9')](),controller[_0x4574('0x4d')]);router[_0x4574('0x3c')](_0x4574('0x4e'),auth[_0x4574('0x9')](),controller['addChatInteractions']);router[_0x4574('0x3c')](_0x4574('0x4f'),auth['isAuthenticated'](),controller[_0x4574('0x50')]);router[_0x4574('0x3c')]('/:id/fax_interactions',auth[_0x4574('0x9')](),controller[_0x4574('0x51')]);router[_0x4574('0x3c')]('/:id/sms_interactions',auth[_0x4574('0x9')](),controller[_0x4574('0x52')]);router[_0x4574('0x3c')]('/:id/openchannel_interactions',auth[_0x4574('0x9')](),controller[_0x4574('0x53')]);router[_0x4574('0x3c')](_0x4574('0x54'),auth['isAuthenticated'](),controller[_0x4574('0x55')]);router[_0x4574('0x3c')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x4574('0x3c')](_0x4574('0x2f'),auth[_0x4574('0x9')](),controller['addMailAccounts']);router[_0x4574('0x3c')](_0x4574('0x30'),auth[_0x4574('0x9')](),controller[_0x4574('0x56')]);router[_0x4574('0x3c')](_0x4574('0x32'),auth['isAuthenticated'](),controller[_0x4574('0x57')]);router[_0x4574('0x3c')](_0x4574('0x58'),auth[_0x4574('0x9')](),controller[_0x4574('0x59')]);router[_0x4574('0x3c')](_0x4574('0x35'),auth['isAuthenticated'](),controller[_0x4574('0x5a')]);router['post'](_0x4574('0x37'),auth['isAuthenticated'](),controller[_0x4574('0x5b')]);router[_0x4574('0x3c')](_0x4574('0x3a'),auth['isAuthenticated'](),controller[_0x4574('0x5c')]);router[_0x4574('0x5d')](_0x4574('0x12'),auth[_0x4574('0x9')](),controller[_0x4574('0x5e')]);router[_0x4574('0x5d')]('/:id/password',auth[_0x4574('0x9')](),controller[_0x4574('0x5f')]);router['delete'](_0x4574('0x18'),auth['isAuthenticated'](),controller[_0x4574('0x60')]);router[_0x4574('0x61')](_0x4574('0x27'),auth[_0x4574('0x9')](),controller[_0x4574('0x62')]);router[_0x4574('0x61')](_0x4574('0x12'),auth[_0x4574('0x9')](),controller[_0x4574('0x63')]);router['delete'](_0x4574('0x4e'),auth[_0x4574('0x9')](),controller[_0x4574('0x64')]);router['delete'](_0x4574('0x4f'),auth[_0x4574('0x9')](),controller[_0x4574('0x65')]);router['delete'](_0x4574('0x66'),auth[_0x4574('0x9')](),controller[_0x4574('0x67')]);router['delete'](_0x4574('0x68'),auth['isAuthenticated'](),controller[_0x4574('0x69')]);router['delete']('/:id/openchannel_interactions',auth[_0x4574('0x9')](),controller['removeOpenchannelInteractions']);router[_0x4574('0x61')](_0x4574('0x54'),auth['isAuthenticated'](),controller[_0x4574('0x6a')]);router[_0x4574('0x61')](_0x4574('0x2d'),auth[_0x4574('0x9')](),controller[_0x4574('0x6b')]);router[_0x4574('0x61')]('/:id/mail_accounts',auth[_0x4574('0x9')](),controller[_0x4574('0x6c')]);router[_0x4574('0x61')](_0x4574('0x30'),auth[_0x4574('0x9')](),controller['removeOpenchannelAccounts']);router[_0x4574('0x61')]('/:id/sms_accounts',auth[_0x4574('0x9')](),controller['removeSmsAccounts']);router['delete'](_0x4574('0x58'),auth[_0x4574('0x9')](),controller['removeChatWebsites']);router[_0x4574('0x61')]('/:id/whatsapp_accounts',auth[_0x4574('0x9')](),controller[_0x4574('0x6d')]);router['delete']('/:id/square_projects',auth[_0x4574('0x9')](),controller[_0x4574('0x6e')]);router[_0x4574('0x61')](_0x4574('0x3a'),auth[_0x4574('0x9')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0x082e=['/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','destroy','removeChatInteractions','removeFaxInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','describe','/whoami','whoami','isAuthenticated','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x082e,0x196));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xe082('0x0'));var path=require(_0xe082('0x1'));var timeout=require(_0xe082('0x2'));var express=require(_0xe082('0x3'));var router=express['Router']();var fs_extra=require(_0xe082('0x4'));var auth=require(_0xe082('0x5'));var interaction=require(_0xe082('0x6'));var config=require('../../config/environment');var controller=require(_0xe082('0x7'));router[_0xe082('0x8')]('/',auth['isAuthenticated'](),controller[_0xe082('0x9')]);router[_0xe082('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe082('0xa')]);router['get'](_0xe082('0xb'),auth['isAuthenticated'](),controller[_0xe082('0xc')]);router['get']('/presence',auth[_0xe082('0xd')](),controller[_0xe082('0xe')]);router[_0xe082('0x8')](_0xe082('0xf'),auth['isAuthenticated'](),controller[_0xe082('0x10')]);router[_0xe082('0x8')](_0xe082('0x11'),controller['getAvatar']);router['get'](_0xe082('0x12'),auth[_0xe082('0xd')](),controller['getOpenTabs']);router['get'](_0xe082('0x13'),auth['isAuthenticated'](),controller['getContacts']);router[_0xe082('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0xe082('0x14')]);router[_0xe082('0x8')](_0xe082('0x15'),auth[_0xe082('0xd')](),controller[_0xe082('0x16')]);router['get']('/:id/groups',auth[_0xe082('0xd')](),controller['getGroups']);router['get'](_0xe082('0x17'),auth['isAuthenticated'](),controller[_0xe082('0x18')]);router[_0xe082('0x8')](_0xe082('0x19'),auth[_0xe082('0xd')](),controller['getScreenRecordings']);router[_0xe082('0x8')](_0xe082('0x1a'),auth[_0xe082('0xd')](),controller['getChatInteractions']);router['get'](_0xe082('0x1b'),auth[_0xe082('0xd')](),controller[_0xe082('0x1c')]);router[_0xe082('0x8')](_0xe082('0x1d'),auth[_0xe082('0xd')](),controller[_0xe082('0x1e')]);router['get'](_0xe082('0x1f'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xe082('0x8')](_0xe082('0x20'),auth[_0xe082('0xd')](),controller['getFaxInteractions']);router[_0xe082('0x8')](_0xe082('0x21'),auth[_0xe082('0xd')](),controller[_0xe082('0x22')]);router['get'](_0xe082('0x23'),auth[_0xe082('0xd')](),controller[_0xe082('0x24')]);router[_0xe082('0x8')](_0xe082('0x25'),auth['isAuthenticated'](),controller[_0xe082('0x26')]);router['get']('/:id/agents',auth[_0xe082('0xd')](),controller[_0xe082('0x27')]);router[_0xe082('0x8')](_0xe082('0x28'),auth[_0xe082('0xd')](),controller[_0xe082('0x29')]);router['get'](_0xe082('0x2a'),auth[_0xe082('0xd')](),controller['getFaxAccounts']);router[_0xe082('0x8')](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller['getMailAccounts']);router[_0xe082('0x8')](_0xe082('0x2c'),auth[_0xe082('0xd')](),controller['getOpenchannelAccounts']);router['get'](_0xe082('0x2d'),auth[_0xe082('0xd')](),controller[_0xe082('0x2e')]);router[_0xe082('0x8')](_0xe082('0x2f'),auth['isAuthenticated'](),controller[_0xe082('0x30')]);router[_0xe082('0x8')]('/:id/whatsapp_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x31')]);router[_0xe082('0x8')]('/:id/square_projects',auth[_0xe082('0xd')](),controller[_0xe082('0x32')]);router[_0xe082('0x8')]('/:id/scheduled_calls',auth[_0xe082('0xd')](),controller[_0xe082('0x33')]);router[_0xe082('0x8')](_0xe082('0x34'),auth[_0xe082('0xd')](),controller['getApiKey']);router[_0xe082('0x35')](_0xe082('0x13'),auth[_0xe082('0xd')](),controller[_0xe082('0x36')]);router[_0xe082('0x35')]('/',auth[_0xe082('0xd')](),controller[_0xe082('0x37')]);router[_0xe082('0x35')](_0xe082('0x38'),auth[_0xe082('0xd')](),controller[_0xe082('0x39')]);router[_0xe082('0x35')](_0xe082('0x3a'),auth[_0xe082('0xd')](),controller[_0xe082('0x3b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a8d3,_0x390d1c,_0x55dda){_0x55dda(null,path[_0xe082('0x3c')](config['root'],_0xe082('0x3d')));},'filename':function(_0x524bb4,_0x428a5e,_0x34e8dd){_0x34e8dd(null,util[_0xe082('0x3e')](_0xe082('0x3f'),Date[_0xe082('0x40')](),_0x428a5e[_0xe082('0x41')]));}})});router[_0xe082('0x35')](_0xe082('0x11'),upload[_0xe082('0x42')](_0xe082('0x43')),controller[_0xe082('0x44')]);router['post'](_0xe082('0x45'),auth['isAuthenticated'](),controller[_0xe082('0x46')]);router[_0xe082('0x35')]('/:id/logout',auth[_0xe082('0xd')](),controller['logout']);router[_0xe082('0x35')]('/:id/pause',auth[_0xe082('0xd')](),controller[_0xe082('0x47')]);router[_0xe082('0x35')](_0xe082('0x48'),auth[_0xe082('0xd')](),controller[_0xe082('0x49')]);router['post'](_0xe082('0x23'),auth['isAuthenticated'](),controller[_0xe082('0x4a')]);router[_0xe082('0x35')](_0xe082('0x4b'),auth[_0xe082('0xd')](),controller['addChatInteractions']);router[_0xe082('0x35')](_0xe082('0x4c'),auth[_0xe082('0xd')](),controller['addMailInteractions']);router[_0xe082('0x35')](_0xe082('0x4d'),auth[_0xe082('0xd')](),controller[_0xe082('0x4e')]);router[_0xe082('0x35')](_0xe082('0x4f'),auth[_0xe082('0xd')](),controller[_0xe082('0x50')]);router['post'](_0xe082('0x51'),auth[_0xe082('0xd')](),controller[_0xe082('0x52')]);router[_0xe082('0x35')](_0xe082('0x53'),auth['isAuthenticated'](),controller[_0xe082('0x54')]);router['post'](_0xe082('0x2a'),auth[_0xe082('0xd')](),controller[_0xe082('0x55')]);router[_0xe082('0x35')](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller['addMailAccounts']);router[_0xe082('0x35')](_0xe082('0x2c'),auth[_0xe082('0xd')](),controller[_0xe082('0x56')]);router[_0xe082('0x35')]('/:id/sms_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x57')]);router[_0xe082('0x35')](_0xe082('0x2f'),auth[_0xe082('0xd')](),controller['addChatWebsites']);router[_0xe082('0x35')](_0xe082('0x58'),auth[_0xe082('0xd')](),controller[_0xe082('0x59')]);router[_0xe082('0x35')](_0xe082('0x5a'),auth['isAuthenticated'](),controller[_0xe082('0x5b')]);router[_0xe082('0x35')](_0xe082('0x34'),auth['isAuthenticated'](),controller[_0xe082('0x5c')]);router[_0xe082('0x5d')](_0xe082('0xf'),auth['isAuthenticated'](),controller[_0xe082('0x5e')]);router[_0xe082('0x5d')](_0xe082('0x5f'),auth[_0xe082('0xd')](),controller[_0xe082('0x60')]);router[_0xe082('0x61')](_0xe082('0x3a'),auth[_0xe082('0xd')](),controller['removeQueues']);router['delete'](_0xe082('0x23'),auth[_0xe082('0xd')](),controller['removeTeams']);router[_0xe082('0x61')](_0xe082('0xf'),auth[_0xe082('0xd')](),controller[_0xe082('0x62')]);router[_0xe082('0x61')](_0xe082('0x4b'),auth[_0xe082('0xd')](),controller[_0xe082('0x63')]);router[_0xe082('0x61')](_0xe082('0x4c'),auth[_0xe082('0xd')](),controller['removeMailInteractions']);router[_0xe082('0x61')](_0xe082('0x4d'),auth['isAuthenticated'](),controller[_0xe082('0x64')]);router[_0xe082('0x61')](_0xe082('0x4f'),auth[_0xe082('0xd')](),controller['removeSmsInteractions']);router[_0xe082('0x61')]('/:id/openchannel_interactions',auth[_0xe082('0xd')](),controller['removeOpenchannelInteractions']);router[_0xe082('0x61')](_0xe082('0x53'),auth[_0xe082('0xd')](),controller[_0xe082('0x65')]);router[_0xe082('0x61')](_0xe082('0x2a'),auth['isAuthenticated'](),controller[_0xe082('0x66')]);router['delete'](_0xe082('0x2b'),auth[_0xe082('0xd')](),controller[_0xe082('0x67')]);router[_0xe082('0x61')]('/:id/openchannel_accounts',auth[_0xe082('0xd')](),controller['removeOpenchannelAccounts']);router['delete'](_0xe082('0x2d'),auth[_0xe082('0xd')](),controller['removeSmsAccounts']);router[_0xe082('0x61')](_0xe082('0x2f'),auth['isAuthenticated'](),controller[_0xe082('0x68')]);router[_0xe082('0x61')]('/:id/whatsapp_accounts',auth[_0xe082('0xd')](),controller[_0xe082('0x69')]);router['delete'](_0xe082('0x5a'),auth[_0xe082('0xd')](),controller[_0xe082('0x6a')]);router['delete'](_0xe082('0x34'),auth[_0xe082('0xd')](),controller[_0xe082('0x6b')]);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 a5d6b8f..9db0cbf 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x555413,_0x5c76cb){var _0x1c7c8d=function(_0x540ffb){while(--_0x540ffb){_0x555413['push'](_0x555413['shift']());}};_0x1c7c8d(++_0x5c76cb);}(_0x34e8,0x12c));var _0x834e=function(_0x3faab4,_0x47571a){_0x3faab4=_0x3faab4-0x0;var _0x45ebc4=_0x34e8[_0x3faab4];return _0x45ebc4;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x36c232,_0x20dbe9){var _0x273c07=function(_0x4492bd){while(--_0x4492bd){_0x36c232['push'](_0x36c232['shift']());}};_0x273c07(++_0x20dbe9);}(_0x70e0,0x17b));var _0x070e=function(_0x4a1e4d,_0x57c765){_0x4a1e4d=_0x4a1e4d-0x0;var _0x5cbb17=_0x70e0[_0x4a1e4d];return _0x5cbb17;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index d624e22..e5a62f9 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 _0x1ad2=['$ne','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','phone','CmContact','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','isEmpty','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','InteractionId','_interactions','ui.UserId\x20=\x20?','moment','bluebird','path','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','socket.io-emitter','redis','localhost','client','http','request','info','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','role','admin','agent','telephone','ignore','map','includes','name','end','stack','index','rawAttributes','type','key','filter','password','salt','value','getOptions','where','User','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','dataValues','mail','openchannel','whatsapp','all','catch','show','params','differenceBy','keys','filters','intersection','model','fields','merge','options','find','fax','body','describe','addContacts','ids','omit','internal','Setting','securePassword','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','104','105','106','107','108','100','114','115','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','userProfileId','UserProfileSection','Telephones','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','Agents','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','addQueues','channel','loginInPause','interface','isValidChannel','add','spread','capitalize','QueueId','emit','toLowerCase','voice','VoiceQueue','online','format','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/','download','chat','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','order','sort','getContacts','List','Tag','Tags','color','tag','hasOwnProperty','nolimit','getQueues','Queue','Unknown\x20role','pick','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','PAUSE','DEFAULT\x20PAUSE','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','unpause','manual','sms','%s%s','Team','getTeams','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','Openchannel','transaction','addAgent','getDataValue','Queue:save','TeamVoicePrefix','VoicePrefixId','removeTeams','getFaxQueues','getOpenchannelQueues','removeAgent','UserVoicePrefix','getLists','CmList','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','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','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte'];(function(_0x3885c6,_0x2bbb4c){var _0x2aff15=function(_0x597f05){while(--_0x597f05){_0x3885c6['push'](_0x3885c6['shift']());}};_0x2aff15(++_0x2bbb4c);}(_0x1ad2,0x1d4));var _0x21ad=function(_0x2d8029,_0x16a1e8){_0x2d8029=_0x2d8029-0x0;var _0x3fb34d=_0x1ad2[_0x2d8029];return _0x3fb34d;};'use strict';var moment=require(_0x21ad('0x0'));var BPromise=require(_0x21ad('0x1'));var util=require('util');var path=require(_0x21ad('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x21ad('0x3'));var jayson=require(_0x21ad('0x4'));var Redis=require(_0x21ad('0x5'));var authService=require(_0x21ad('0x6'));var qs=require(_0x21ad('0x7'));var logger=require(_0x21ad('0x8'))(_0x21ad('0x9'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21ad('0xa'));var db=require(_0x21ad('0xb'))['db'];var socket=require(_0x21ad('0xc'))(new Redis(config[_0x21ad('0xd')]));require('./user.socket')['register'](socket);config['redis']=_['defaults'](config['redis'],{'host':_0x21ad('0xe'),'port':0x18eb});var client=jayson[_0x21ad('0xf')][_0x21ad('0x10')]({'port':0x232a});var values;function respondWithRpcPromise(_0xedd546,_0x251aa3,_0x2cff7c,_0x458fc7){return new BPromise(function(_0x5d0466,_0x5ca6fe){var _0xae7fa9=_0x458fc7||client;return _0xae7fa9[_0x21ad('0x11')](_0xedd546,_0x2cff7c)['then'](function(_0x5a3a3d){logger[_0x21ad('0x12')]('User,\x20%s,\x20%s',_0x251aa3,'request\x20sent');logger[_0x21ad('0x13')](_0x21ad('0x14'),_0x251aa3,'request\x20sent',JSON[_0x21ad('0x15')](_0x5a3a3d));if(_0x5a3a3d[_0x21ad('0x16')]){if(_0x5a3a3d[_0x21ad('0x16')][_0x21ad('0x17')]===0x1f4){logger[_0x21ad('0x16')]('User,\x20%s,\x20%s',_0x251aa3,_0x5a3a3d['error'][_0x21ad('0x18')]);return _0x5ca6fe(_0x5a3a3d[_0x21ad('0x16')]['message']);}logger['error']('User,\x20%s,\x20%s',_0x251aa3,_0x5a3a3d[_0x21ad('0x16')]['message']);return _0x5d0466(_0x5a3a3d[_0x21ad('0x16')][_0x21ad('0x18')]);}else{logger[_0x21ad('0x12')](_0x21ad('0x19'),_0x251aa3,'request\x20sent');_0x5d0466(_0x5a3a3d[_0x21ad('0x1a')][_0x21ad('0x18')]);}})['catch'](function(_0x11adbf){logger[_0x21ad('0x16')](_0x21ad('0x19'),_0x251aa3,_0x11adbf);_0x5ca6fe(_0x11adbf);});});}function respondWithStatusCode(_0x1b3b5a,_0x365ca6){_0x365ca6=_0x365ca6||0xcc;return function(_0x57b767){if(_0x57b767){return _0x1b3b5a[_0x21ad('0x1b')](_0x365ca6);}return _0x1b3b5a[_0x21ad('0x1c')](_0x365ca6)['end']();};}function respondWithResult(_0x4024e9,_0x5dd218){_0x5dd218=_0x5dd218||0xc8;return function(_0x5b7dbf){if(_0x5b7dbf){return _0x4024e9[_0x21ad('0x1c')](_0x5dd218)[_0x21ad('0x1d')](_0x5b7dbf);}};}function respondWithFilteredResult(_0x2e0936,_0x5d7157){return function(_0x16e893){if(_0x16e893){var _0x3c10de=typeof _0x5d7157[_0x21ad('0x1e')]===_0x21ad('0x1f')&&typeof _0x5d7157[_0x21ad('0x20')]===_0x21ad('0x1f');var _0x36f607=_0x16e893[_0x21ad('0x21')];var _0x3a81e3=_0x3c10de?0x0:_0x5d7157['offset'];var _0x23fb3b=_0x3c10de?_0x16e893[_0x21ad('0x21')]:_0x5d7157[_0x21ad('0x1e')]+_0x5d7157['limit'];var _0x437ee7;if(_0x23fb3b>=_0x36f607){_0x23fb3b=_0x36f607;_0x437ee7=0xc8;}else{_0x437ee7=0xce;}_0x2e0936['status'](_0x437ee7);return _0x2e0936[_0x21ad('0x22')](_0x21ad('0x23'),_0x3a81e3+'-'+_0x23fb3b+'/'+_0x36f607)['json'](_0x16e893);}return null;};}function saveUpdates(_0x45a743){return function(_0x58c146){if(_0x58c146){return _0x58c146[_0x21ad('0x24')](_0x45a743)[_0x21ad('0x25')](function(_0xac9f14){return _0xac9f14;});}return null;};}function removeEntity(_0x359f21){return function(_0x4713ff){if(_0x4713ff){return _0x4713ff[_0x21ad('0x26')]()[_0x21ad('0x25')](function(){var _0x37a946=_0x4713ff[_0x21ad('0x27')]({'plain':!![]});if(_0x37a946[_0x21ad('0x28')]===_0x21ad('0x29'))return;var _0x23b1ab=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0x21ad('0x2a'),'ignore':![]},{'name':'Telephones','value':_0x21ad('0x2b'),'ignore':![]}];var _0x78c234=_(_0x23b1ab)['filter'](_0x21ad('0x2c'))[_0x21ad('0x2d')]('value')['value']();if(_[_0x21ad('0x2e')](_0x78c234,_0x37a946[_0x21ad('0x28')])){return;}var _0x33fdf1=_['find'](_0x23b1ab,['value',_0x37a946['role']])[_0x21ad('0x2f')];return db['UserProfileResource'][_0x21ad('0x26')]({'where':{'type':_0x33fdf1,'resourceId':_0x37a946['id']}})[_0x21ad('0x25')](function(){return _0x4713ff;});})[_0x21ad('0x25')](function(){_0x359f21['status'](0xcc)[_0x21ad('0x30')]();});}};}function handleEntityNotFound(_0x146663){return function(_0xa82e85){if(!_0xa82e85){_0x146663[_0x21ad('0x1b')](0x194);}return _0xa82e85;};}function handleError(_0xab1229,_0x4bc773){_0x4bc773=_0x4bc773||0x1f4;return function(_0x12b883){logger['error'](_0x12b883[_0x21ad('0x31')]);if(_0x12b883[_0x21ad('0x2f')]){delete _0x12b883['name'];}_0xab1229[_0x21ad('0x1c')](_0x4bc773)['send'](_0x12b883);};}exports[_0x21ad('0x32')]=function(_0x5a4a3c,_0x34b121){var _0x396086={},_0x539526={'count':0x0,'rows':[]};var _0x110dae=_(db['User'][_0x21ad('0x33')])[_0x21ad('0x2d')](function(_0x4c05ab){return{'name':_0x4c05ab['fieldName'],'type':_0x4c05ab[_0x21ad('0x34')][_0x21ad('0x35')]};})[_0x21ad('0x36')](function(_0x5ba0c4){return!_[_0x21ad('0x2e')]([_0x21ad('0x37'),_0x21ad('0x38')],_0x5ba0c4[_0x21ad('0x2f')]);})[_0x21ad('0x39')]();_0x396086=qs[_0x21ad('0x3a')](_0x110dae,_0x5a4a3c);var _0x485cfc={'where':_0x396086[_0x21ad('0x3b')]};return db[_0x21ad('0x3c')][_0x21ad('0x21')](_0x485cfc)[_0x21ad('0x25')](function(_0xb6af4e){_0x539526[_0x21ad('0x21')]=_0xb6af4e;if(_0x5a4a3c[_0x21ad('0x3d')][_0x21ad('0x3e')]){_0x396086[_0x21ad('0x3f')]=[{'all':!![]}];}if(_0x5a4a3c[_0x21ad('0x3d')][_0x21ad('0x40')]===_0x21ad('0x41')){_0x396086[_0x21ad('0x3f')]=[{'model':db[_0x21ad('0x42')],'as':'userSetting'}];}if(!_[_0x21ad('0x2e')](_0x396086[_0x21ad('0x43')],'id')){_0x396086[_0x21ad('0x43')][_0x21ad('0x44')]('id');}return db[_0x21ad('0x3c')][_0x21ad('0x45')](_0x396086);})[_0x21ad('0x25')](function(_0x54729f){_0x539526[_0x21ad('0x46')]=_0x54729f;if(_0x5a4a3c['query'][_0x21ad('0x47')]===_0x21ad('0x41')){var _0x43b062=[];for(var _0x5083fa=0x0;_0x5083fa<_0x539526[_0x21ad('0x46')][_0x21ad('0x48')];_0x5083fa++){_0x43b062['push'](get_open_tabs('chat',_0x539526[_0x21ad('0x46')][_0x5083fa][_0x21ad('0x49')]));_0x43b062[_0x21ad('0x44')](get_open_tabs('sms',_0x539526[_0x21ad('0x46')][_0x5083fa]['dataValues']));_0x43b062[_0x21ad('0x44')](get_open_tabs('fax',_0x539526[_0x21ad('0x46')][_0x5083fa][_0x21ad('0x49')]));_0x43b062[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4a'),_0x539526[_0x21ad('0x46')][_0x5083fa]['dataValues']));_0x43b062[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4b'),_0x539526[_0x21ad('0x46')][_0x5083fa][_0x21ad('0x49')]));_0x43b062[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4c'),_0x539526[_0x21ad('0x46')][_0x5083fa][_0x21ad('0x49')]));}return BPromise[_0x21ad('0x4d')](_0x43b062)[_0x21ad('0x25')](function(){return _0x539526;});}else{return _0x539526;}})[_0x21ad('0x25')](respondWithFilteredResult(_0x34b121,_0x396086))[_0x21ad('0x4e')](handleError(_0x34b121,null));};exports[_0x21ad('0x4f')]=function(_0x3f9881,_0x282fe7){var _0x952b19={'raw':![],'where':{'id':_0x3f9881[_0x21ad('0x50')]['id']}},_0x2679af={};_0x2679af['model']=_[_0x21ad('0x51')](_[_0x21ad('0x52')](db['User']['rawAttributes']),[_0x21ad('0x37'),_0x21ad('0x38')]);_0x2679af[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x3f9881[_0x21ad('0x3d')]);_0x2679af[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x2679af['model'],_0x2679af[_0x21ad('0x3d')]);_0x952b19['attributes']=_[_0x21ad('0x54')](_0x2679af[_0x21ad('0x55')],qs['fields'](_0x3f9881[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x952b19[_0x21ad('0x43')]=_0x952b19[_0x21ad('0x43')][_0x21ad('0x48')]?_0x952b19[_0x21ad('0x43')]:_0x2679af[_0x21ad('0x55')];if(_0x3f9881[_0x21ad('0x3d')][_0x21ad('0x3e')]){_0x952b19[_0x21ad('0x3f')]=[{'all':!![]}];}if(_0x3f9881['query'][_0x21ad('0x40')]===_0x21ad('0x41')){_0x952b19['include']=[{'model':db[_0x21ad('0x42')],'as':_0x21ad('0x40')}];}_0x952b19=_[_0x21ad('0x57')]({},_0x952b19,_0x3f9881[_0x21ad('0x58')]);if(!_[_0x21ad('0x2e')](_0x952b19[_0x21ad('0x43')],'id')){_0x952b19[_0x21ad('0x43')][_0x21ad('0x44')]('id');}return db['User'][_0x21ad('0x59')](_0x952b19)['then'](handleEntityNotFound(_0x282fe7,null))[_0x21ad('0x25')](function(_0x576154){var _0x4b31bb=[];values=_0x576154;if(_0x3f9881['query'][_0x21ad('0x47')]===_0x21ad('0x41')){_0x4b31bb['push'](get_open_tabs('chat',_0x576154[_0x21ad('0x49')]));_0x4b31bb[_0x21ad('0x44')](get_open_tabs('sms',_0x576154[_0x21ad('0x49')]));_0x4b31bb[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4b'),_0x576154['dataValues']));_0x4b31bb[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4c'),_0x576154[_0x21ad('0x49')]));_0x4b31bb['push'](get_open_tabs(_0x21ad('0x5a'),_0x576154[_0x21ad('0x49')]));_0x4b31bb[_0x21ad('0x44')](get_open_tabs('mail',_0x576154[_0x21ad('0x49')]));return BPromise[_0x21ad('0x4d')](_0x4b31bb);}else{return values;}})[_0x21ad('0x25')](function(){return values;})[_0x21ad('0x25')](respondWithResult(_0x282fe7,null))[_0x21ad('0x4e')](handleError(_0x282fe7,null));};exports[_0x21ad('0x24')]=function(_0x2189b5,_0x1db9f1){if(_0x2189b5[_0x21ad('0x5b')]['id']){delete _0x2189b5[_0x21ad('0x5b')]['id'];}delete _0x2189b5[_0x21ad('0x5b')][_0x21ad('0x28')];return db['User']['find']({'where':{'id':_0x2189b5[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x1db9f1,null))['then'](saveUpdates(_0x2189b5[_0x21ad('0x5b')],null))['then'](respondWithResult(_0x1db9f1,null))[_0x21ad('0x4e')](handleError(_0x1db9f1,null));};exports[_0x21ad('0x5c')]=function(_0x4439cd,_0x322496){return db['User']['describe']()[_0x21ad('0x25')](respondWithResult(_0x322496,null))[_0x21ad('0x4e')](handleError(_0x322496,null));};exports['addContacts']=function(_0x31c754,_0x84dae){return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x31c754[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x84dae,null))[_0x21ad('0x25')](function(_0x311a4b){if(_0x311a4b){return _0x311a4b[_0x21ad('0x5d')](_0x31c754[_0x21ad('0x5b')][_0x21ad('0x5e')],_[_0x21ad('0x5f')](_0x31c754[_0x21ad('0x5b')],['ids','id'])||{});}})[_0x21ad('0x25')](respondWithResult(_0x84dae,null))[_0x21ad('0x4e')](handleError(_0x84dae,null));};function validateUser(_0x216b21){return new BPromise(function(_0x2a82a3,_0x4bfec8){if(_0x216b21[_0x21ad('0x60')])return _0x2a82a3(_0x216b21);return db[_0x21ad('0x61')]['findById'](0x1)[_0x21ad('0x25')](function(_0xf4e60f){if(_0xf4e60f[_0x21ad('0x62')])authService['validatePasswordPattern'](_0x216b21[_0x21ad('0x37')]);db[_0x21ad('0x3c')][_0x21ad('0x63')](_0x21ad('0x60'))[_0x21ad('0x25')](function(_0x2f3c6c){if(_[_0x21ad('0x64')](_0x2f3c6c)){_0x216b21['internal']=_0xf4e60f[_0x21ad('0x65')]||0x1;return;}if(_[_0x21ad('0x64')](_0xf4e60f[_0x21ad('0x65')])||_0xf4e60f['min_internal']===_0x2f3c6c){_0x216b21[_0x21ad('0x60')]=_0x2f3c6c+0x1;return;}if(_0xf4e60f[_0x21ad('0x65')]>_0x2f3c6c){_0x216b21[_0x21ad('0x60')]=_0xf4e60f[_0x21ad('0x65')];return;}return db['sequelize'][_0x21ad('0x3d')](_0x21ad('0x66'),{'type':db[_0x21ad('0x67')]['QueryTypes'][_0x21ad('0x68')]})['then'](function(_0x4444a7){if(_0x4444a7&&_0x4444a7[_0x21ad('0x48')]){for(var _0x536d6a=0x0,_0x43faf1=_0x4444a7[_0x21ad('0x48')];_0x536d6a<_0x43faf1&&_[_0x21ad('0x64')](_0x216b21[_0x21ad('0x60')]);_0x536d6a++){if(_0xf4e60f[_0x21ad('0x65')]<=_0x4444a7[_0x536d6a]['from']){_0x216b21[_0x21ad('0x60')]=_0x4444a7[_0x536d6a][_0x21ad('0x69')];}else if(_0xf4e60f[_0x21ad('0x65')]>_0x4444a7[_0x536d6a][_0x21ad('0x69')]&&_0xf4e60f['min_internal']<=_0x4444a7[_0x536d6a]['to']){_0x216b21[_0x21ad('0x60')]=_0xf4e60f[_0x21ad('0x65')];}}}if(_[_0x21ad('0x64')](_0x216b21[_0x21ad('0x60')])){_0x216b21['internal']=_0x2f3c6c+0x1;}return _0x2a82a3(_0x216b21);});});})[_0x21ad('0x4e')](function(_0x2b883a){_0x4bfec8(_0x2b883a);});});}function updateUser(_0xf5550d){return new BPromise(function(_0x189af6,_0x331f97){try{if(_0xf5550d[_0x21ad('0x6a')]){_0xf5550d[_0x21ad('0x6b')]=_0xf5550d[_0x21ad('0x60')];_0xf5550d[_0x21ad('0x6c')]={'mailbox':_0xf5550d[_0x21ad('0x60')],'password':_0xf5550d[_0x21ad('0x37')],'fullname':_0xf5550d[_0x21ad('0x6d')],'email':_0xf5550d[_0x21ad('0x6e')]};}if(_0xf5550d[_0x21ad('0x28')]==='agent'){if(!_0xf5550d[_0x21ad('0x6f')])_0xf5550d['permissions']=[_0x21ad('0x70'),_0x21ad('0x71'),_0x21ad('0x72'),_0x21ad('0x73'),'110',_0x21ad('0x74'),_0x21ad('0x75'),_0x21ad('0x76'),_0x21ad('0x77'),_0x21ad('0x78'),'109',_0x21ad('0x79'),'111',_0x21ad('0x7a'),_0x21ad('0x7b')];}_0x189af6(_0xf5550d);}catch(_0x5c3d87){_0x331f97(_0x5c3d87);}});}exports[_0x21ad('0x7c')]=function(_0x134438,_0x5e55c1){if(_0x134438[_0x21ad('0x7d')][_0x21ad('0x28')]===_0x21ad('0x2a'))throw new Error(_0x21ad('0x7e'));if(_0x134438[_0x21ad('0x5b')][_0x21ad('0x28')]==='user'&&_0x134438[_0x21ad('0x7d')]['role']!==_0x21ad('0x29')){throw new Error(_0x21ad('0x7f'));}if(_0x134438[_0x21ad('0x5b')][_0x21ad('0x28')]===_0x21ad('0x29')&&_0x134438['user']['role']!=='admin'){throw new Error(_0x21ad('0x80'));}return licenseUtil[_0x21ad('0x81')]([_0x134438['body']])['then'](function(){return validateUser(_0x134438['body']);})[_0x21ad('0x25')](function(_0x36d134){return updateUser(_0x36d134)[_0x21ad('0x25')](function(_0x4e9ff5){if(_0x4e9ff5['role']==='admin'){_0x4e9ff5['settingsEnabled']=_0x134438[_0x21ad('0x7d')]['settingsEnabled'];delete _0x4e9ff5[_0x21ad('0x82')];}return _0x4e9ff5;});})[_0x21ad('0x25')](function(_0x439ce4){return db[_0x21ad('0x3c')][_0x21ad('0x7c')](_0x439ce4,{'include':[{'model':db['VoiceMail'],'as':_0x21ad('0x6c')}]});})[_0x21ad('0x25')](function(_0x348460){if(_0x134438['body'][_0x21ad('0x28')]===_0x21ad('0x7d'))return _0x348460;if(_0x134438[_0x21ad('0x7d')][_0x21ad('0x28')]!==_0x21ad('0x7d'))return _0x348460;return db[_0x21ad('0x83')][_0x21ad('0x59')]({'where':{'name':_0x348460[_0x21ad('0x28')]===_0x21ad('0x2a')?'Agents':_0x21ad('0x84'),'userProfileId':_0x134438[_0x21ad('0x7d')][_0x21ad('0x82')]},'raw':!![]})[_0x21ad('0x25')](function(_0x850495){if(!_0x850495||_0x850495[_0x21ad('0x85')]!=0x0)return _0x348460;return db[_0x21ad('0x86')]['create']({'name':_0x348460[_0x21ad('0x2f')],'resourceId':_0x348460['id'],'type':_0x850495['name'],'sectionId':_0x850495['id']},{})[_0x21ad('0x25')](function(){return _0x348460;});})['catch'](function(_0x175446){logger[_0x21ad('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x175446);throw _0x175446;});})[_0x21ad('0x25')](respondWithResult(_0x5e55c1,0xc9))[_0x21ad('0x4e')](handleError(_0x5e55c1,null));};exports[_0x21ad('0x87')]=function(_0x1173ee,_0x578f8a){var _0xfb869c=_0x1173ee[_0x21ad('0x5b')];var _0x21edb4=[];if(_0x1173ee[_0x21ad('0x7d')][_0x21ad('0x28')]===_0x21ad('0x2a'))throw new Error(_0x21ad('0x7e'));if(_[_0x21ad('0x88')](_0xfb869c,[_0x21ad('0x28'),_0x21ad('0x7d')])&&_0x1173ee[_0x21ad('0x7d')][_0x21ad('0x28')]!==_0x21ad('0x29')){throw new Error(_0x21ad('0x7f'));}if(_['some'](_0xfb869c,[_0x21ad('0x28'),'admin'])&&_0x1173ee[_0x21ad('0x7d')][_0x21ad('0x28')]!==_0x21ad('0x29')){throw new Error(_0x21ad('0x89'));}return licenseUtil[_0x21ad('0x81')](_0xfb869c)[_0x21ad('0x25')](function(){return validateUser(_0xfb869c[0x0]);})['then'](function(){for(var _0x2dd85f=0x1;_0x2dd85f<_0xfb869c[_0x21ad('0x48')];_0x2dd85f++){var _0x24a571=_0xfb869c[_0x2dd85f-0x1][_0x21ad('0x60')];if(!_0xfb869c[_0x2dd85f]['internal'])_0xfb869c[_0x2dd85f]['internal']=_0x24a571+0x1;_0x21edb4[_0x21ad('0x44')](validateUser(_0xfb869c[_0x2dd85f]));}return BPromise['all'](_0x21edb4);})[_0x21ad('0x25')](function(){_0x21edb4=[];for(var _0x3b44b2=0x0;_0x3b44b2<_0xfb869c[_0x21ad('0x48')];_0x3b44b2++){_0x21edb4[_0x21ad('0x44')](updateUser(_0xfb869c[_0x3b44b2]));}return BPromise[_0x21ad('0x4d')](_0x21edb4);})['then'](function(){return BPromise[_0x21ad('0x8a')](_0xfb869c,function(_0x59317b){return db['User']['create'](_0x59317b,{'include':[{'model':db[_0x21ad('0x6c')],'as':_0x21ad('0x6c')}]})[_0x21ad('0x25')](function(_0x13c4b7){_0x59317b['id']=_0x13c4b7['id'];return _0x59317b;});});})[_0x21ad('0x25')](function(_0x2a08be){if(_0x1173ee[_0x21ad('0x5b')][_0x21ad('0x28')]===_0x21ad('0x7d'))return _0x2a08be;if(_0x1173ee['user']['role']!==_0x21ad('0x7d'))return _0x2a08be;var _0x397c43=_[_0x21ad('0x88')](_0x2a08be,function(_0x21224c){return _0x21224c[_0x21ad('0x28')]===_0x21ad('0x2a')||_0x21224c[_0x21ad('0x28')]===_0x21ad('0x2b');});if(!_0x397c43)return _0x2a08be;return db[_0x21ad('0x83')][_0x21ad('0x45')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x1173ee['user'][_0x21ad('0x82')]},'raw':!![]})['then'](function(_0x599dc4){if(_['isEmpty'](_0x599dc4)||!_[_0x21ad('0x88')](_0x599dc4,[_0x21ad('0x85'),0x0]))return _0x2a08be;_0x21edb4=[];var _0x59d04f=_(_0x599dc4)[_0x21ad('0x2d')](function(_0x1db48a){if(_0x1db48a[_0x21ad('0x85')]===0x1)return;return _0x1db48a[_0x21ad('0x2f')]===_0x21ad('0x8b')?_0x21ad('0x2a'):_0x21ad('0x2b');})['compact']()[_0x21ad('0x39')]();for(var _0x3183b7=0x0;_0x3183b7<_0x2a08be['length'];_0x3183b7++){if(!_[_0x21ad('0x2e')](_0x59d04f,_0x2a08be[_0x3183b7]['role']))return;var _0x59d32a=_0x2a08be[_0x3183b7][_0x21ad('0x28')]===_0x21ad('0x2a')?_0x21ad('0x8b'):'Telephones';_0x21edb4[_0x21ad('0x44')](db[_0x21ad('0x86')][_0x21ad('0x7c')]({'name':_0x2a08be[_0x3183b7]['name'],'resourceId':_0x2a08be[_0x3183b7]['id'],'type':_0x59d32a,'sectionId':_[_0x21ad('0x59')](_0x599dc4,['name',_0x59d32a])['id']},{}));}return BPromise[_0x21ad('0x4d')](_0x21edb4);});})[_0x21ad('0x25')](respondWithResult(_0x578f8a,0xc9))['catch'](handleError(_0x578f8a,null));};exports[_0x21ad('0x8c')]=function(_0x350685,_0x36e13e){if(_0x350685['body']['id']){delete _0x350685[_0x21ad('0x5b')]['id'];}return db[_0x21ad('0x3c')]['find']({'where':{'id':_0x350685['params']['id']}})['then'](function(_0x81a336){if(!_0x81a336)return null;if(_0x81a336['id']===_0x350685[_0x21ad('0x7d')]['id']){if(!_0x350685[_0x21ad('0x5b')][_0x21ad('0x8d')]||!_0x350685[_0x21ad('0x5b')][_0x21ad('0x8e')]){throw new db['Sequelize'][(_0x21ad('0x8f'))](_0x21ad('0x90'));}if(!_0x81a336[_0x21ad('0x91')](_0x350685[_0x21ad('0x5b')][_0x21ad('0x8d')])){throw new db[(_0x21ad('0x92'))][(_0x21ad('0x8f'))](_0x21ad('0x93'));}if(_0x350685[_0x21ad('0x5b')][_0x21ad('0x8d')]===_0x350685[_0x21ad('0x5b')][_0x21ad('0x8e')]){throw new db[(_0x21ad('0x92'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x350685[_0x21ad('0x7d')][_0x21ad('0x28')]===_0x21ad('0x29')){if(!_0x350685[_0x21ad('0x5b')]['newPassword']){throw new db[(_0x21ad('0x92'))][(_0x21ad('0x8f'))](_0x21ad('0x94'));}}else if(_0x350685['user'][_0x21ad('0x28')]===_0x21ad('0x7d')){if(!_0x350685[_0x21ad('0x5b')][_0x21ad('0x8e')]){throw new db[(_0x21ad('0x92'))]['ValidationError'](_0x21ad('0x94'));}if(_0x81a336[_0x21ad('0x28')]!=='agent'){throw new db['Sequelize'][(_0x21ad('0x8f'))](_0x21ad('0x7e'));}}else{throw new db['Sequelize'][(_0x21ad('0x8f'))]('Unauthorized');}return _0x81a336;})[_0x21ad('0x25')](handleEntityNotFound(_0x36e13e,null))['then'](function(_0x3d906f){return db[_0x21ad('0x61')][_0x21ad('0x95')]({'attributes':['id',_0x21ad('0x62'),_0x21ad('0x96'),_0x21ad('0x97')]})[_0x21ad('0x25')](function(_0x121a3a){if(_0x121a3a[_0x21ad('0x62')])authService[_0x21ad('0x98')](_0x350685[_0x21ad('0x5b')]['newPassword']);if(!_0x121a3a['enforcePasswordHistory']||!_0x3d906f['previousPasswords'])return _0x3d906f;authService['validatePasswordHistory'](_0x350685[_0x21ad('0x5b')][_0x21ad('0x8e')],_0x3d906f[_0x21ad('0x99')],_0x121a3a[_0x21ad('0x97')]);return _0x3d906f;})['then'](saveUpdates({'password':_0x350685[_0x21ad('0x5b')]['newPassword'],'passwordResetAt':_0x350685['user']['id']==_0x350685[_0x21ad('0x50')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x350685[_0x21ad('0x5b')][_0x21ad('0x8e')],_0x3d906f[_0x21ad('0x99')])},null));})['then'](respondWithResult(_0x36e13e,null))[_0x21ad('0x4e')](handleError(_0x36e13e,null));};exports[_0x21ad('0x9a')]=function(_0x1fd35e,_0x2c48ba){var _0x305647=_0x1fd35e[_0x21ad('0x5b')][_0x21ad('0x9b')];return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x1fd35e[_0x21ad('0x50')]['id']},'attributes':['id',_0x21ad('0x2f'),_0x21ad('0x28'),'online',_0x21ad('0x9c'),'voicePause',_0x21ad('0x9d')]})['then'](handleEntityNotFound(_0x2c48ba,null))[_0x21ad('0x25')](function(_0x39a233){if(_0x39a233){if(!utils[_0x21ad('0x9e')](_0x305647)){throw new db['Sequelize'][(_0x21ad('0x8f'))]('Unknown\x20channel');}return _0x39a233[_0x21ad('0x9f')+_['capitalize'](_0x305647['toLowerCase']())+'Queues'](_0x1fd35e['body'][_0x21ad('0x5e')],{'penalty':_0x1fd35e[_0x21ad('0x5b')]['penalty']||0x0})[_0x21ad('0xa0')](function(_0xf44006){for(var _0x561df8=0x0;_0x561df8<_0x1fd35e[_0x21ad('0x5b')][_0x21ad('0x5e')][_0x21ad('0x48')];_0x561df8+=0x1){var _0xa4288a={'UserId':Number(_0x1fd35e[_0x21ad('0x50')]['id'])};_0xa4288a[_[_0x21ad('0xa1')](_0x305647['toLowerCase']())+_0x21ad('0xa2')]=Number(_0x1fd35e[_0x21ad('0x5b')][_0x21ad('0x5e')][_0x561df8]);socket[_0x21ad('0xa3')](_0x21ad('0x7d')+_['capitalize'](_0x305647[_0x21ad('0xa4')]())+'Queue:save',_0xa4288a);}return _0xf44006;})[_0x21ad('0x25')](function(){if(_0x305647===_0x21ad('0xa5')){return db[_0x21ad('0xa6')][_0x21ad('0x45')]({'where':{'id':_0x1fd35e['body'][_0x21ad('0x5e')]||[]},'raw':!![],'attributes':['id',_0x21ad('0x2f')]});}})['then'](function(_0xabb48c){var _0x143a30=_0x39a233['get']({'plain':!![]});var _0x55f170=[];if(_0x305647===_0x21ad('0xa5')&&_0x143a30[_0x21ad('0x28')]===_0x21ad('0x2a')&&_0x143a30[_0x21ad('0xa7')]){for(var _0x2bec8a=0x0;_0x2bec8a<_0xabb48c[_0x21ad('0x48')];_0x2bec8a+=0x1){_0x55f170[_0x21ad('0x44')]({'membername':_0x143a30['name'],'UserId':_0x143a30['id'],'queue_name':_0xabb48c[_0x2bec8a][_0x21ad('0x2f')],'VoiceQueueId':_0xabb48c[_0x2bec8a]['id'],'interface':_['isNil'](_0x143a30['interface'])?util[_0x21ad('0xa8')](_0x21ad('0xa9'),_0x143a30[_0x21ad('0x2f')]):_0x143a30[_0x21ad('0x9d')],'paused':_0x143a30['voicePause']||![],'penalty':_0x1fd35e['body'][_0x21ad('0xaa')]||0x0});}return BPromise[_0x21ad('0x8a')](_0x55f170,function(_0x1720c7){return db[_0x21ad('0xab')][_0x21ad('0xac')](_0x1720c7);});}return _0x39a233;});}})[_0x21ad('0x25')](respondWithStatusCode(_0x2c48ba,null))[_0x21ad('0x4e')](handleError(_0x2c48ba,null));};exports[_0x21ad('0xad')]=function(_0x4cb8f7,_0x21a55){var _0x3a5f46,_0x5e7070;return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x4cb8f7[_0x21ad('0x50')]['id']},'attributes':['id','name',_0x21ad('0x28')]})[_0x21ad('0x25')](handleEntityNotFound(_0x21a55,null))[_0x21ad('0x25')](function(_0x5bedbd){if(_0x5bedbd){_0x3a5f46=_0x5bedbd;if(!_0x4cb8f7[_0x21ad('0x3d')]['channel']||!utils['isValidChannel'](_0x4cb8f7[_0x21ad('0x3d')]['channel'])){throw new db['Sequelize']['ValidationError'](_0x21ad('0xae'));}return _0x5bedbd[_0x21ad('0xaf')+_[_0x21ad('0xa1')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x9b')][_0x21ad('0xa4')]())+_0x21ad('0xb0')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x5e')]);}})[_0x21ad('0x25')](function(_0x4971c3){if(_[_0x21ad('0xb1')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x5e')])){for(var _0x1b9fd4=0x0;_0x1b9fd4<_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x5e')][_0x21ad('0x48')];_0x1b9fd4+=0x1){_0x5e7070={'UserId':Number(_0x4cb8f7['params']['id'])};_0x5e7070[_[_0x21ad('0xa1')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x9b')][_0x21ad('0xa4')]())+_0x21ad('0xa2')]=Number(_0x4cb8f7['query'][_0x21ad('0x5e')][_0x1b9fd4]);socket[_0x21ad('0xa3')]('user'+_[_0x21ad('0xa1')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x9b')][_0x21ad('0xa4')]())+_0x21ad('0xb2'),_0x5e7070);}}else{_0x5e7070={'UserId':Number(_0x4cb8f7['params']['id'])};_0x5e7070[_[_0x21ad('0xa1')](_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x9b')][_0x21ad('0xa4')]())+'QueueId']=Number(_0x4cb8f7['query']['ids']);socket[_0x21ad('0xa3')](_0x21ad('0x7d')+_[_0x21ad('0xa1')](_0x4cb8f7['query'][_0x21ad('0x9b')][_0x21ad('0xa4')]())+_0x21ad('0xb2'),_0x5e7070);}return _0x4971c3;})['then'](function(){if(_0x4cb8f7[_0x21ad('0x3d')]['channel']==='voice'){return db[_0x21ad('0xab')][_0x21ad('0x26')]({'where':{'UserId':_0x4cb8f7[_0x21ad('0x50')]['id'],'VoiceQueueId':_0x4cb8f7[_0x21ad('0x3d')][_0x21ad('0x5e')]},'individualHooks':!![]})[_0x21ad('0x25')](function(){return _0x3a5f46;});}return _0x3a5f46;})[_0x21ad('0x25')](respondWithStatusCode(_0x21a55,null))[_0x21ad('0x4e')](handleError(_0x21a55,null));};exports[_0x21ad('0xb3')]=function(_0x185a71,_0x5724a3){_0x185a71[_0x21ad('0x5b')][_0x21ad('0xb4')]=_0x185a71[_0x21ad('0xb5')][_0x21ad('0xb6')];return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x185a71[_0x21ad('0x50')]['id']}})['then'](handleEntityNotFound(_0x5724a3,null))[_0x21ad('0x25')](saveUpdates(_0x185a71['body'],null))[_0x21ad('0x25')](respondWithResult(_0x5724a3,null))[_0x21ad('0x4e')](handleError(_0x5724a3,null));};exports[_0x21ad('0xb7')]=function(_0x45e2de,_0x3b2a00){var _0x2cddd2=path[_0x21ad('0xb8')](config[_0x21ad('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x21ad('0x3c')]['find']({'where':{'id':_0x45e2de[_0x21ad('0x50')]['id']},'attributes':['id',_0x21ad('0xb4')],'raw':!![]})[_0x21ad('0x25')](handleEntityNotFound(_0x3b2a00,null))[_0x21ad('0x25')](function(_0xa81593){if(_0xa81593){if(_[_0x21ad('0x64')](_0xa81593['userpic'])){return _0x3b2a00['download'](_0x2cddd2);}else{if(!fs['existsSync'](path[_0x21ad('0xb8')](config[_0x21ad('0xb9')],_0x21ad('0xba'),_0xa81593[_0x21ad('0xb4')]))){return _0x3b2a00[_0x21ad('0xbb')](_0x2cddd2);}return _0x3b2a00['download'](path[_0x21ad('0xb8')](config['root'],_0x21ad('0xba'),_0xa81593[_0x21ad('0xb4')]));}}})[_0x21ad('0x4e')](handleError(_0x3b2a00,null));};exports['getOpenTabs']=function(_0x33927b,_0x59b6aa){return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x33927b[_0x21ad('0x50')]['id']},'attributes':['id']})[_0x21ad('0x25')](handleEntityNotFound(_0x59b6aa,null))[_0x21ad('0x25')](function(_0x30c352){var _0x1fdc79=[];values=_0x30c352[_0x21ad('0x49')];_0x1fdc79['push'](get_open_tabs(_0x21ad('0xbc'),_0x30c352['dataValues']));_0x1fdc79[_0x21ad('0x44')](get_open_tabs('sms',_0x30c352[_0x21ad('0x49')]));_0x1fdc79[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4b'),_0x30c352[_0x21ad('0x49')]));_0x1fdc79[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4c'),_0x30c352[_0x21ad('0x49')]));_0x1fdc79['push'](get_open_tabs('fax',_0x30c352[_0x21ad('0x49')]));_0x1fdc79[_0x21ad('0x44')](get_open_tabs(_0x21ad('0x4a'),_0x30c352[_0x21ad('0x49')]));return BPromise[_0x21ad('0x4d')](_0x1fdc79);})[_0x21ad('0x25')](function(_0x2c206b){if(_0x2c206b){var _0x4d94c1=_['map'](values[_0x21ad('0xbd')],function(_0x2afcc1){return{'channel':'CHAT','id':_0x2afcc1['id'],'createdAt':_0x2afcc1[_0x21ad('0xbe')]};});var _0x3f87c5=_[_0x21ad('0x2d')](values[_0x21ad('0xbf')],function(_0xa57dc8){return{'channel':_0x21ad('0xc0'),'id':_0xa57dc8['id'],'createdAt':_0xa57dc8[_0x21ad('0xbe')]};});var _0x382e72=_[_0x21ad('0x2d')](values[_0x21ad('0xc1')],function(_0x493a61){return{'channel':_0x21ad('0xc2'),'id':_0x493a61['id'],'createdAt':_0x493a61[_0x21ad('0xbe')]};});var _0x48dc2a=_[_0x21ad('0x2d')](values[_0x21ad('0xc3')],function(_0xdda857){return{'channel':_0x21ad('0xc4'),'id':_0xdda857['id'],'createdAt':_0xdda857[_0x21ad('0xbe')]};});var _0x3ccba7=_[_0x21ad('0x2d')](values[_0x21ad('0xc5')],function(_0xe161c3){return{'channel':_0x21ad('0xc6'),'id':_0xe161c3['id'],'createdAt':_0xe161c3[_0x21ad('0xbe')]};});var _0x2a9c45=_['map'](values[_0x21ad('0xc7')],function(_0x5d0bd6){return{'channel':_0x21ad('0xc8'),'id':_0x5d0bd6['id'],'createdAt':_0x5d0bd6[_0x21ad('0xbe')]};});var _0x1796ed=_[_0x21ad('0xc9')](_0x4d94c1,_0x3f87c5,_0x382e72,_0x48dc2a,_0x3ccba7,_0x2a9c45);var _0x51a8c9={'count':_0x1796ed[_0x21ad('0x48')],'rows':_0x1796ed};return _0x51a8c9;}else return null;})['then'](respondWithResult(_0x59b6aa,null))[_0x21ad('0x4e')](handleError(_0x59b6aa,null));};exports['getContacts']=function(_0x11c1eb,_0x3902fb){var _0xa22088={};var _0x1e9efa={};var _0x5651ce;var _0x372593;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x11c1eb[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x3902fb,null))['then'](function(_0x4a2784){if(_0x4a2784){_0x5651ce=_0x4a2784;_0x1e9efa[_0x21ad('0x55')]=_[_0x21ad('0x52')](db['CmContact'][_0x21ad('0x33')]);_0x1e9efa[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x11c1eb['query']);_0x1e9efa[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x1e9efa[_0x21ad('0x55')],_0x1e9efa[_0x21ad('0x3d')]);_0xa22088['attributes']=_[_0x21ad('0x54')](_0x1e9efa['model'],qs[_0x21ad('0x56')](_0x11c1eb[_0x21ad('0x3d')][_0x21ad('0x56')]));_0xa22088[_0x21ad('0x43')]=_0xa22088[_0x21ad('0x43')]['length']?_0xa22088[_0x21ad('0x43')]:_0x1e9efa['model'];_0xa22088[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x11c1eb['query'][_0x21ad('0xcb')]);_0xa22088[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_['pick'](_0x11c1eb[_0x21ad('0x3d')],_0x1e9efa[_0x21ad('0x53')]));if(_0x11c1eb['query'][_0x21ad('0x36')]){_0xa22088[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0xa22088[_0x21ad('0x3b')],{'$or':_['map'](_0xa22088[_0x21ad('0x43')],function(_0x2006c9){var _0x572667={};_0x572667[_0x2006c9]={'$like':'%'+_0x11c1eb[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x572667;})});}_0xa22088=_['merge']({},_0xa22088,_0x11c1eb[_0x21ad('0x58')]);return _0x5651ce[_0x21ad('0xcc')](_0xa22088);}})[_0x21ad('0x25')](function(_0x11e1df){if(_0x11e1df){_0x372593=_0x11e1df[_0x21ad('0x48')];if(_0x11c1eb[_0x21ad('0x3d')]['hasOwnProperty'](_0x21ad('0x3e'))){_0xa22088[_0x21ad('0x3f')]=[{'model':db['CmList'],'as':_0x21ad('0xcd'),'required':![]},{'model':db[_0x21ad('0xce')],'as':_0x21ad('0xcf'),'attributes':['id',_0x21ad('0x2f'),_0x21ad('0xd0')],'where':_0x11c1eb[_0x21ad('0x3d')][_0x21ad('0xd1')]?{'id':_0x11c1eb['query'][_0x21ad('0xd1')]}:undefined,'required':_0x11c1eb[_0x21ad('0x3d')][_0x21ad('0xd1')]?!![]:![]}];}if(!_0x11c1eb[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0xa22088[_0x21ad('0x20')]=qs['limit'](_0x11c1eb['query'][_0x21ad('0x20')]);_0xa22088[_0x21ad('0x1e')]=qs['offset'](_0x11c1eb[_0x21ad('0x3d')]['offset']);}return _0x5651ce[_0x21ad('0xcc')](_0xa22088);}})[_0x21ad('0x25')](function(_0x51250){if(_0x51250){return _0x51250?{'count':_0x372593,'rows':_0x51250}:null;}})[_0x21ad('0x25')](respondWithResult(_0x3902fb,null))[_0x21ad('0x4e')](handleError(_0x3902fb,null));};exports[_0x21ad('0xd4')]=function(_0x39e1ab,_0xaaa619){var _0x274181;var _0x42eb54={};var _0x1aa7ce;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x39e1ab[_0x21ad('0x50')]['id']},'attributes':['id',_0x21ad('0x2f'),_0x21ad('0x28')]})[_0x21ad('0x25')](handleEntityNotFound(_0xaaa619,null))[_0x21ad('0x25')](function(_0x2ca046){if(!utils[_0x21ad('0x9e')](_0x39e1ab[_0x21ad('0x3d')]['channel'])){throw new db[(_0x21ad('0x92'))][(_0x21ad('0x8f'))]('Unknown\x20channel');}_0x274181=_0x2ca046;var _0x37bf15={};_0x37bf15[_0x21ad('0x55')]=_['keys'](db[_[_0x21ad('0xa1')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x9b')])+_0x21ad('0xd5')]['rawAttributes']);_0x37bf15[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x39e1ab[_0x21ad('0x3d')]);_0x37bf15[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x37bf15[_0x21ad('0x55')],_0x37bf15['query']);_0x42eb54['attributes']=_[_0x21ad('0x54')](_0x37bf15[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x42eb54[_0x21ad('0x43')]=_0x42eb54[_0x21ad('0x43')][_0x21ad('0x48')]?_0x42eb54[_0x21ad('0x43')]:_0x37bf15[_0x21ad('0x55')];_0x42eb54[_0x21ad('0xca')]=qs['sort'](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x42eb54[_0x21ad('0x3b')]=qs['filters'](_['pick'](_0x39e1ab[_0x21ad('0x3d')],_0x37bf15['filters']));if(_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x42eb54['where']=_[_0x21ad('0x57')](_0x42eb54[_0x21ad('0x3b')],{'$or':_['map'](_0x42eb54[_0x21ad('0x43')],function(_0x4bdff2){var _0x49aca0={};_0x49aca0[_0x4bdff2]={'$like':'%'+_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x49aca0;})});}_0x42eb54=_[_0x21ad('0x57')]({},_0x42eb54,_0x39e1ab[_0x21ad('0x58')]);switch(_0x274181['role']){case _0x21ad('0x29'):return db[_[_0x21ad('0xa1')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x9b')])+_0x21ad('0xd5')][_0x21ad('0x45')](_0x42eb54);case _0x21ad('0x7d'):case'agent':return _0x274181['get'+_[_0x21ad('0xa1')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x9b')])+_0x21ad('0xb0')](_0x42eb54);default:throw new db[(_0x21ad('0x92'))][(_0x21ad('0x8f'))](_0x21ad('0xd6'));}})[_0x21ad('0x25')](function(_0x24d9f6){_0x1aa7ce=_0x24d9f6[_0x21ad('0x48')];if(!_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x42eb54[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x42eb54[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x39e1ab[_0x21ad('0x3d')]['offset']);}switch(_0x274181[_0x21ad('0x28')]){case _0x21ad('0x29'):return db[_[_0x21ad('0xa1')](_0x39e1ab[_0x21ad('0x3d')][_0x21ad('0x9b')])+_0x21ad('0xd5')][_0x21ad('0x45')](_0x42eb54);case _0x21ad('0x7d'):case _0x21ad('0x2a'):return _0x274181[_0x21ad('0x27')+_[_0x21ad('0xa1')](_0x39e1ab['query']['channel'])+_0x21ad('0xb0')](_0x42eb54);}})['then'](function(_0x4dd79a){return{'count':_0x1aa7ce,'rows':_0x4dd79a};})[_0x21ad('0x25')](respondWithResult(_0xaaa619,null))[_0x21ad('0x4e')](handleError(_0xaaa619,null));};exports['getVoiceQueuesRt']=function(_0x1bf1ee,_0x37f0cb){var _0x46a9f4={};var _0x183f28={};var _0x2ba44c;var _0xd93ec1;return db['User'][_0x21ad('0x95')]({'where':{'id':_0x1bf1ee[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x37f0cb,null))[_0x21ad('0x25')](function(_0x2e044b){if(_0x2e044b){_0x2ba44c=_0x2e044b;_0x183f28[_0x21ad('0x55')]=_[_0x21ad('0x52')](db[_0x21ad('0xab')]['rawAttributes']);_0x183f28[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x1bf1ee[_0x21ad('0x3d')]);_0x183f28['filters']=_[_0x21ad('0x54')](_0x183f28[_0x21ad('0x55')],_0x183f28[_0x21ad('0x3d')]);_0x46a9f4[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x183f28[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x1bf1ee['query'][_0x21ad('0x56')]));_0x46a9f4['attributes']=_0x46a9f4[_0x21ad('0x43')][_0x21ad('0x48')]?_0x46a9f4[_0x21ad('0x43')]:_0x183f28[_0x21ad('0x55')];_0x46a9f4[_0x21ad('0xca')]=qs['sort'](_0x1bf1ee[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x46a9f4[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x1bf1ee[_0x21ad('0x3d')],_0x183f28[_0x21ad('0x53')]));if(_0x1bf1ee[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x46a9f4['where']=_['merge'](_0x46a9f4['where'],{'$or':_[_0x21ad('0x2d')](_0x46a9f4[_0x21ad('0x43')],function(_0x19ef93){var _0x4681c3={};_0x4681c3[_0x19ef93]={'$like':'%'+_0x1bf1ee[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x4681c3;})});}_0x46a9f4=_[_0x21ad('0x57')]({},_0x46a9f4,_0x1bf1ee['options']);return _0x2ba44c['getVoiceQueuesRt'](_0x46a9f4);}})[_0x21ad('0x25')](function(_0x31420){if(_0x31420){_0xd93ec1=_0x31420['length'];if(!_0x1bf1ee['query'][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x46a9f4['limit']=qs['limit'](_0x1bf1ee['query']['limit']);_0x46a9f4['offset']=qs[_0x21ad('0x1e')](_0x1bf1ee[_0x21ad('0x3d')][_0x21ad('0x1e')]);}return _0x2ba44c[_0x21ad('0xd8')](_0x46a9f4);}})[_0x21ad('0x25')](function(_0x1d43d8){if(_0x1d43d8){return _0x1d43d8?{'count':_0xd93ec1,'rows':_0x1d43d8}:null;}})[_0x21ad('0x25')](respondWithResult(_0x37f0cb,null))[_0x21ad('0x4e')](handleError(_0x37f0cb,null));};exports[_0x21ad('0xd9')]=function(_0xa8d192,_0x55ebd7){var _0x4d5e3a={};var _0x595a30={};var _0x68fa2d;var _0x4131d0;return db[_0x21ad('0x3c')]['findOne']({'where':{'id':_0xa8d192[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x55ebd7,null))['then'](function(_0x33bd95){if(_0x33bd95){_0x68fa2d=_0x33bd95;_0x595a30[_0x21ad('0x55')]=_[_0x21ad('0x52')](db['ChatGroup'][_0x21ad('0x33')]);_0x595a30[_0x21ad('0x3d')]=_['keys'](_0xa8d192['query']);_0x595a30[_0x21ad('0x53')]=_['intersection'](_0x595a30[_0x21ad('0x55')],_0x595a30[_0x21ad('0x3d')]);_0x4d5e3a[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x595a30[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0xa8d192[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x4d5e3a['attributes']=_0x4d5e3a['attributes'][_0x21ad('0x48')]?_0x4d5e3a[_0x21ad('0x43')]:_0x595a30[_0x21ad('0x55')];_0x4d5e3a[_0x21ad('0xca')]=qs['sort'](_0xa8d192[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x4d5e3a[_0x21ad('0x3b')]=qs['filters'](_[_0x21ad('0xd7')](_0xa8d192['query'],_0x595a30['filters']));if(_0xa8d192[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x4d5e3a[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x4d5e3a[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x4d5e3a[_0x21ad('0x43')],function(_0x337b5c){var _0x5abf4b={};_0x5abf4b[_0x337b5c]={'$like':'%'+_0xa8d192[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x5abf4b;})});}_0x4d5e3a=_[_0x21ad('0x57')]({},_0x4d5e3a,_0xa8d192['options']);return _0x68fa2d['getGroups'](_0x4d5e3a);}})['then'](function(_0x17bed2){if(_0x17bed2){_0x4131d0=_0x17bed2['length'];if(!_0xa8d192[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x4d5e3a[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0xa8d192[_0x21ad('0x3d')]['limit']);_0x4d5e3a[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0xa8d192[_0x21ad('0x3d')][_0x21ad('0x1e')]);}return _0x68fa2d['getGroups'](_0x4d5e3a);}})['then'](function(_0x27d229){if(_0x27d229){return _0x27d229?{'count':_0x4131d0,'rows':_0x27d229}:null;}})[_0x21ad('0x25')](respondWithResult(_0x55ebd7,null))['catch'](handleError(_0x55ebd7,null));};exports[_0x21ad('0xda')]=function(_0x12f9fc,_0x20160d){var _0x1f942d={'raw':!![],'where':{}};var _0x108b22={};var _0x5e52aa={'count':0x0,'rows':[]};return db[_0x21ad('0x3c')]['findOne']({'where':{'id':_0x12f9fc[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x20160d,null))[_0x21ad('0x25')](function(_0x7a1c25){if(_0x7a1c25){_0x108b22['model']=_['keys'](db[_0x21ad('0xdb')][_0x21ad('0x33')]);_0x108b22[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x12f9fc[_0x21ad('0x3d')]);_0x108b22[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x108b22[_0x21ad('0x55')],_0x108b22[_0x21ad('0x3d')]);_0x1f942d[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x108b22[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x12f9fc[_0x21ad('0x3d')]['fields']));_0x1f942d['attributes']=_0x1f942d['attributes'][_0x21ad('0x48')]?_0x1f942d[_0x21ad('0x43')]:_0x108b22[_0x21ad('0x55')];if(!_0x12f9fc['query'][_0x21ad('0xd2')]('nolimit')){_0x1f942d[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0x12f9fc['query']['limit']);_0x1f942d['offset']=qs[_0x21ad('0x1e')](_0x12f9fc[_0x21ad('0x3d')][_0x21ad('0x1e')]);}_0x1f942d[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x12f9fc[_0x21ad('0x3d')]['sort']);_0x1f942d['where']=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x12f9fc[_0x21ad('0x3d')],_0x108b22[_0x21ad('0x53')]));_0x1f942d[_0x21ad('0x3b')][_0x21ad('0xdc')]=_0x7a1c25['id'];if(_0x12f9fc[_0x21ad('0x3d')]['filter']){_0x1f942d['where']=_[_0x21ad('0x57')](_0x1f942d['where'],{'$or':_[_0x21ad('0x2d')](_0x1f942d[_0x21ad('0x43')],function(_0x483e26){var _0x20b797={};_0x20b797[_0x483e26]={'$like':'%'+_0x12f9fc[_0x21ad('0x3d')]['filter']+'%'};return _0x20b797;})});}_0x1f942d=_[_0x21ad('0x57')]({},_0x1f942d,_0x12f9fc[_0x21ad('0x58')]);return db[_0x21ad('0xdb')][_0x21ad('0x21')]({'where':_0x1f942d[_0x21ad('0x3b')]})[_0x21ad('0x25')](function(_0x3f0a89){_0x5e52aa[_0x21ad('0x21')]=_0x3f0a89;if(_0x12f9fc[_0x21ad('0x3d')][_0x21ad('0x3e')]){_0x1f942d[_0x21ad('0x3f')]=[{'all':!![]}];}return db[_0x21ad('0xdb')]['findAll'](_0x1f942d);})[_0x21ad('0x25')](function(_0x3c1fb0){_0x5e52aa['rows']=_0x3c1fb0;return _0x5e52aa;});}})[_0x21ad('0x25')](respondWithFilteredResult(_0x20160d,_0x1f942d))[_0x21ad('0x4e')](handleError(_0x20160d,null));};exports[_0x21ad('0xdd')]=function(_0x1f20ad,_0x43615f){var _0x218895={'raw':!![],'where':{}};var _0x3a32c3={};var _0x42865c={'count':0x0,'rows':[]};return db[_0x21ad('0x3c')]['findOne']({'where':{'id':_0x1f20ad[_0x21ad('0x50')]['id']}})['then'](handleEntityNotFound(_0x43615f,null))[_0x21ad('0x25')](function(_0x5b22f4){if(_0x5b22f4){_0x3a32c3['model']=_[_0x21ad('0x52')](db['ScreenRecording'][_0x21ad('0x33')]);_0x3a32c3[_0x21ad('0x3d')]=_['keys'](_0x1f20ad[_0x21ad('0x3d')]);_0x3a32c3['filters']=_[_0x21ad('0x54')](_0x3a32c3[_0x21ad('0x55')],_0x3a32c3[_0x21ad('0x3d')]);_0x218895['attributes']=_['intersection'](_0x3a32c3[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x218895['attributes']=_0x218895[_0x21ad('0x43')][_0x21ad('0x48')]?_0x218895[_0x21ad('0x43')]:_0x3a32c3['model'];if(!_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0xd2')]('nolimit')){_0x218895[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x218895[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x1e')]);}_0x218895[_0x21ad('0xca')]=qs['sort'](_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x218895[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x1f20ad[_0x21ad('0x3d')],_0x3a32c3['filters']));_0x218895[_0x21ad('0x3b')][_0x21ad('0xdc')]=_0x5b22f4['id'];if(_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x218895['where']=_['merge'](_0x218895[_0x21ad('0x3b')],{'$or':_['map'](_0x218895[_0x21ad('0x43')],function(_0x450af9){var _0x26062a={};_0x26062a[_0x450af9]={'$like':'%'+_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x26062a;})});}_0x218895=_[_0x21ad('0x57')]({},_0x218895,_0x1f20ad['options']);return db[_0x21ad('0xde')]['count']({'where':_0x218895[_0x21ad('0x3b')]})[_0x21ad('0x25')](function(_0x1c6cd6){_0x42865c['count']=_0x1c6cd6;if(_0x1f20ad[_0x21ad('0x3d')][_0x21ad('0x3e')]){_0x218895['include']=[{'all':!![]}];}return db[_0x21ad('0xde')][_0x21ad('0x45')](_0x218895);})[_0x21ad('0x25')](function(_0x12861e){_0x42865c['rows']=_0x12861e;return _0x42865c;});}})[_0x21ad('0x25')](respondWithFilteredResult(_0x43615f,_0x218895))[_0x21ad('0x4e')](handleError(_0x43615f,null));};exports[_0x21ad('0xdf')]=function(_0x54ca62,_0x21ee61){var _0x171f4a={};var _0x234387={};var _0xae87cf;var _0x41a0b6;return db['User'][_0x21ad('0x95')]({'where':{'id':_0x54ca62[_0x21ad('0x50')]['id']}})['then'](handleEntityNotFound(_0x21ee61,null))[_0x21ad('0x25')](function(_0x11f239){if(_0x11f239){_0xae87cf=_0x11f239;_0x234387['model']=_[_0x21ad('0x52')](db[_0x21ad('0xe0')][_0x21ad('0x33')]);_0x234387[_0x21ad('0x3d')]=_['keys'](_0x54ca62[_0x21ad('0x3d')]);_0x234387['filters']=_['intersection'](_0x234387[_0x21ad('0x55')],_0x234387['query']);_0x171f4a['attributes']=_[_0x21ad('0x54')](_0x234387[_0x21ad('0x55')],qs['fields'](_0x54ca62[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x171f4a[_0x21ad('0x43')]=_0x171f4a[_0x21ad('0x43')][_0x21ad('0x48')]?_0x171f4a[_0x21ad('0x43')]:_0x234387[_0x21ad('0x55')];_0x171f4a['order']=qs[_0x21ad('0xcb')](_0x54ca62[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x171f4a[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x54ca62[_0x21ad('0x3d')],_0x234387[_0x21ad('0x53')]));if(_0x54ca62[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x171f4a['where']=_[_0x21ad('0x57')](_0x171f4a[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x171f4a[_0x21ad('0x43')],function(_0x581309){var _0xcad871={};_0xcad871[_0x581309]={'$like':'%'+_0x54ca62[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0xcad871;})});}_0x171f4a=_[_0x21ad('0x57')]({},_0x171f4a,_0x54ca62[_0x21ad('0x58')]);return _0xae87cf['getChatInteractions'](_0x171f4a);}})[_0x21ad('0x25')](function(_0x3fedd6){if(_0x3fedd6){_0x41a0b6=_0x3fedd6[_0x21ad('0x48')];if(!_0x54ca62[_0x21ad('0x3d')][_0x21ad('0xd2')]('nolimit')){_0x171f4a[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0x54ca62[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x171f4a[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x54ca62['query'][_0x21ad('0x1e')]);}return _0xae87cf['getChatInteractions'](_0x171f4a);}})[_0x21ad('0x25')](function(_0x5bd085){if(_0x5bd085){return _0x5bd085?{'count':_0x41a0b6,'rows':_0x5bd085}:null;}})['then'](respondWithResult(_0x21ee61,null))[_0x21ad('0x4e')](handleError(_0x21ee61,null));};exports['getOpenchannelInteractions']=function(_0x198a05,_0x4af4bb){var _0x48cb29={};var _0x592f12={};var _0x1c4f30;var _0x99011e;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x198a05[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x4af4bb,null))[_0x21ad('0x25')](function(_0x1cf6a0){if(_0x1cf6a0){_0x1c4f30=_0x1cf6a0;_0x592f12[_0x21ad('0x55')]=_['keys'](db[_0x21ad('0xe1')][_0x21ad('0x33')]);_0x592f12['query']=_[_0x21ad('0x52')](_0x198a05[_0x21ad('0x3d')]);_0x592f12['filters']=_[_0x21ad('0x54')](_0x592f12[_0x21ad('0x55')],_0x592f12[_0x21ad('0x3d')]);_0x48cb29[_0x21ad('0x43')]=_['intersection'](_0x592f12[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x198a05[_0x21ad('0x3d')]['fields']));_0x48cb29[_0x21ad('0x43')]=_0x48cb29[_0x21ad('0x43')][_0x21ad('0x48')]?_0x48cb29[_0x21ad('0x43')]:_0x592f12[_0x21ad('0x55')];_0x48cb29[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x198a05[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x48cb29[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x198a05[_0x21ad('0x3d')],_0x592f12[_0x21ad('0x53')]));if(_0x198a05['query'][_0x21ad('0x36')]){_0x48cb29[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x48cb29[_0x21ad('0x3b')],{'$or':_['map'](_0x48cb29[_0x21ad('0x43')],function(_0x3de1f1){var _0xd9c601={};_0xd9c601[_0x3de1f1]={'$like':'%'+_0x198a05[_0x21ad('0x3d')]['filter']+'%'};return _0xd9c601;})});}_0x48cb29=_[_0x21ad('0x57')]({},_0x48cb29,_0x198a05[_0x21ad('0x58')]);return _0x1c4f30[_0x21ad('0xe2')](_0x48cb29);}})['then'](function(_0x5defbf){if(_0x5defbf){_0x99011e=_0x5defbf[_0x21ad('0x48')];if(!_0x198a05[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x48cb29[_0x21ad('0x20')]=qs[_0x21ad('0x20')](_0x198a05[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x48cb29[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x198a05['query'][_0x21ad('0x1e')]);}return _0x1c4f30['getOpenchannelInteractions'](_0x48cb29);}})['then'](function(_0x2bc0ed){if(_0x2bc0ed){return _0x2bc0ed?{'count':_0x99011e,'rows':_0x2bc0ed}:null;}})[_0x21ad('0x25')](respondWithResult(_0x4af4bb,null))[_0x21ad('0x4e')](handleError(_0x4af4bb,null));};exports[_0x21ad('0xe3')]=function(_0x2c6cc7,_0x1cfd5f){var _0x458b27={'raw':!![],'where':{}};var _0x5c988c={};var _0x38f67b={'count':0x0,'rows':[]};return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x2c6cc7[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x1cfd5f,null))['then'](function(_0x275a6c){if(_0x275a6c){_0x5c988c[_0x21ad('0x55')]=_[_0x21ad('0x52')](db[_0x21ad('0xe4')][_0x21ad('0x33')]);_0x5c988c[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x2c6cc7[_0x21ad('0x3d')]);_0x5c988c[_0x21ad('0x53')]=_['intersection'](_0x5c988c['model'],_0x5c988c[_0x21ad('0x3d')]);_0x458b27[_0x21ad('0x43')]=_['intersection'](_0x5c988c[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x458b27[_0x21ad('0x43')]=_0x458b27[_0x21ad('0x43')][_0x21ad('0x48')]?_0x458b27[_0x21ad('0x43')]:_0x5c988c[_0x21ad('0x55')];if(!_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x458b27['limit']=qs[_0x21ad('0x20')](_0x2c6cc7[_0x21ad('0x3d')]['limit']);_0x458b27[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0x1e')]);}_0x458b27[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x458b27['where']=qs['filters'](_[_0x21ad('0xd7')](_0x2c6cc7[_0x21ad('0x3d')],_0x5c988c[_0x21ad('0x53')]));_0x458b27[_0x21ad('0x3b')][_0x21ad('0xdc')]=_0x275a6c['id'];if(_0x2c6cc7['query']['filter']){_0x458b27['where']=_[_0x21ad('0x57')](_0x458b27[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x458b27[_0x21ad('0x43')],function(_0x112f33){var _0x26ad22={};_0x26ad22[_0x112f33]={'$like':'%'+_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x26ad22;})});}_0x458b27=_['merge']({},_0x458b27,_0x2c6cc7[_0x21ad('0x58')]);return db['MailInteraction'][_0x21ad('0x21')]({'where':_0x458b27[_0x21ad('0x3b')]})[_0x21ad('0x25')](function(_0x4ebbd2){_0x38f67b[_0x21ad('0x21')]=_0x4ebbd2;if(_0x2c6cc7[_0x21ad('0x3d')][_0x21ad('0x3e')]){_0x458b27[_0x21ad('0x3f')]=[{'all':!![]}];}return db['MailInteraction'][_0x21ad('0x45')](_0x458b27);})[_0x21ad('0x25')](function(_0x369110){_0x38f67b[_0x21ad('0x46')]=_0x369110;return _0x38f67b;});}})[_0x21ad('0x25')](respondWithFilteredResult(_0x1cfd5f,_0x458b27))[_0x21ad('0x4e')](handleError(_0x1cfd5f,null));};exports['getSmsInteractions']=function(_0x435d41,_0x43f66d){var _0x184b48={};var _0x5f36a5={};var _0x510f54;var _0x1a1316;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x435d41[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x43f66d,null))[_0x21ad('0x25')](function(_0x5385b9){if(_0x5385b9){_0x510f54=_0x5385b9;_0x5f36a5[_0x21ad('0x55')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x5f36a5[_0x21ad('0x3d')]=_['keys'](_0x435d41[_0x21ad('0x3d')]);_0x5f36a5[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x5f36a5[_0x21ad('0x55')],_0x5f36a5[_0x21ad('0x3d')]);_0x184b48['attributes']=_[_0x21ad('0x54')](_0x5f36a5[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x435d41[_0x21ad('0x3d')]['fields']));_0x184b48['attributes']=_0x184b48[_0x21ad('0x43')][_0x21ad('0x48')]?_0x184b48[_0x21ad('0x43')]:_0x5f36a5[_0x21ad('0x55')];_0x184b48[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x435d41[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x184b48[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_['pick'](_0x435d41[_0x21ad('0x3d')],_0x5f36a5[_0x21ad('0x53')]));if(_0x435d41[_0x21ad('0x3d')]['filter']){_0x184b48[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x184b48[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x184b48['attributes'],function(_0x46382e){var _0x3747c7={};_0x3747c7[_0x46382e]={'$like':'%'+_0x435d41[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x3747c7;})});}_0x184b48=_[_0x21ad('0x57')]({},_0x184b48,_0x435d41[_0x21ad('0x58')]);return _0x510f54[_0x21ad('0xe5')](_0x184b48);}})[_0x21ad('0x25')](function(_0x24d8dd){if(_0x24d8dd){_0x1a1316=_0x24d8dd[_0x21ad('0x48')];if(!_0x435d41['query'][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x184b48['limit']=qs[_0x21ad('0x20')](_0x435d41[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x184b48[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x435d41[_0x21ad('0x3d')]['offset']);}return _0x510f54[_0x21ad('0xe5')](_0x184b48);}})[_0x21ad('0x25')](function(_0x42ae65){if(_0x42ae65){return _0x42ae65?{'count':_0x1a1316,'rows':_0x42ae65}:null;}})[_0x21ad('0x25')](respondWithResult(_0x43f66d,null))[_0x21ad('0x4e')](handleError(_0x43f66d,null));};exports[_0x21ad('0xe6')]=function(_0x2c38b6,_0x56f888){var _0x3af113={};var _0x2a72c6={};var _0x166c1f;var _0x154ddf;return db[_0x21ad('0x3c')]['findOne']({'where':{'id':_0x2c38b6[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x56f888,null))[_0x21ad('0x25')](function(_0x33137f){if(_0x33137f){_0x166c1f=_0x33137f;_0x2a72c6['model']=_['keys'](db[_0x21ad('0xe7')][_0x21ad('0x33')]);_0x2a72c6[_0x21ad('0x3d')]=_['keys'](_0x2c38b6['query']);_0x2a72c6[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x2a72c6[_0x21ad('0x55')],_0x2a72c6['query']);_0x3af113[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x2a72c6[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x2c38b6[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x3af113[_0x21ad('0x43')]=_0x3af113[_0x21ad('0x43')][_0x21ad('0x48')]?_0x3af113[_0x21ad('0x43')]:_0x2a72c6['model'];_0x3af113['order']=qs['sort'](_0x2c38b6[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x3af113[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_[_0x21ad('0xd7')](_0x2c38b6['query'],_0x2a72c6[_0x21ad('0x53')]));if(_0x2c38b6['query'][_0x21ad('0x36')]){_0x3af113[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x3af113[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x3af113[_0x21ad('0x43')],function(_0x474c53){var _0x5d94bd={};_0x5d94bd[_0x474c53]={'$like':'%'+_0x2c38b6[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x5d94bd;})});}_0x3af113=_[_0x21ad('0x57')]({},_0x3af113,_0x2c38b6[_0x21ad('0x58')]);return _0x166c1f[_0x21ad('0xe6')](_0x3af113);}})[_0x21ad('0x25')](function(_0x1cfb7d){if(_0x1cfb7d){_0x154ddf=_0x1cfb7d[_0x21ad('0x48')];if(!_0x2c38b6[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x3af113[_0x21ad('0x20')]=qs['limit'](_0x2c38b6[_0x21ad('0x3d')]['limit']);_0x3af113[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x2c38b6[_0x21ad('0x3d')][_0x21ad('0x1e')]);}return _0x166c1f[_0x21ad('0xe6')](_0x3af113);}})[_0x21ad('0x25')](function(_0x1b3eec){if(_0x1b3eec){return _0x1b3eec?{'count':_0x154ddf,'rows':_0x1b3eec}:null;}})[_0x21ad('0x25')](respondWithResult(_0x56f888,null))[_0x21ad('0x4e')](handleError(_0x56f888,null));};exports[_0x21ad('0xe8')]=function(_0x53335c,_0x231979){var _0x4ed36f={};var _0x83a08c={};var _0x4feb8b;var _0xcdb4bb;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x53335c[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x231979,null))[_0x21ad('0x25')](function(_0x4fa567){if(_0x4fa567){_0x4feb8b=_0x4fa567;_0x83a08c[_0x21ad('0x55')]=_[_0x21ad('0x52')](db[_0x21ad('0xe9')][_0x21ad('0x33')]);_0x83a08c[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x53335c[_0x21ad('0x3d')]);_0x83a08c[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x83a08c[_0x21ad('0x55')],_0x83a08c['query']);_0x4ed36f[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x83a08c[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x53335c[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x4ed36f[_0x21ad('0x43')]=_0x4ed36f[_0x21ad('0x43')][_0x21ad('0x48')]?_0x4ed36f[_0x21ad('0x43')]:_0x83a08c[_0x21ad('0x55')];_0x4ed36f['order']=qs[_0x21ad('0xcb')](_0x53335c[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x4ed36f[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_['pick'](_0x53335c[_0x21ad('0x3d')],_0x83a08c['filters']));if(_0x53335c[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x4ed36f['where']=_[_0x21ad('0x57')](_0x4ed36f[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x4ed36f[_0x21ad('0x43')],function(_0xfd4374){var _0x1f1d3e={};_0x1f1d3e[_0xfd4374]={'$like':'%'+_0x53335c['query'][_0x21ad('0x36')]+'%'};return _0x1f1d3e;})});}_0x4ed36f=_[_0x21ad('0x57')]({},_0x4ed36f,_0x53335c[_0x21ad('0x58')]);return _0x4feb8b['getWhatsappInteractions'](_0x4ed36f);}})[_0x21ad('0x25')](function(_0x1b607f){if(_0x1b607f){_0xcdb4bb=_0x1b607f[_0x21ad('0x48')];if(!_0x53335c[_0x21ad('0x3d')]['hasOwnProperty'](_0x21ad('0xd3'))){_0x4ed36f['limit']=qs[_0x21ad('0x20')](_0x53335c[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x4ed36f['offset']=qs[_0x21ad('0x1e')](_0x53335c[_0x21ad('0x3d')][_0x21ad('0x1e')]);}return _0x4feb8b[_0x21ad('0xe8')](_0x4ed36f);}})['then'](function(_0x32da31){if(_0x32da31){return _0x32da31?{'count':_0xcdb4bb,'rows':_0x32da31}:null;}})[_0x21ad('0x25')](respondWithResult(_0x231979,null))['catch'](handleError(_0x231979,null));};exports['login']=function(_0x372943,_0x109a9c,_0x65f678){var _0x1ca408;var _0x822b7c;var _0x5e368b;var _0x1618a4=!_[_0x21ad('0x64')](_0x372943['params']['id'])?_0x372943['params']['id']:!_[_0x21ad('0x64')](_0x372943[_0x21ad('0x7d')]['id'])?_0x372943['user']['id']:null;return db[_0x21ad('0x3c')]['find']({'where':{'id':_0x1618a4,'role':{'$or':[_0x21ad('0x29'),_0x21ad('0x7d'),'agent']}},'attributes':['id','name','phone','mobile',_0x21ad('0x28'),_0x21ad('0x60'),_0x21ad('0x9c')]})[_0x21ad('0x25')](function(_0x4af302){if(_0x4af302){if(_0x4af302[_0x21ad('0x28')]===_0x21ad('0x2a')){_0x1ca408=_0x4af302;if(_0x372943[_0x21ad('0x5b')][_0x21ad('0x9d')]){_0x5e368b=util[_0x21ad('0xa8')](_0x21ad('0xea'),_0x1ca408[_0x372943['body'][_0x21ad('0x9d')]]);}else if(_0x372943[_0x21ad('0x5b')][_0x21ad('0xeb')]){_0x5e368b=util[_0x21ad('0xa8')](_0x21ad('0xa9'),_0x372943[_0x21ad('0x5b')][_0x21ad('0xeb')]);}else{_0x5e368b=util[_0x21ad('0xa8')](_0x21ad('0xa9'),_0x1ca408['name']);}socket['to'](util['format'](_0x21ad('0xec'),_0x1ca408['name']))[_0x21ad('0xa3')](_0x21ad('0xed'),{'user':{'id':_0x1ca408['id'],'name':_0x1ca408['name']},'ip':_0x372943[_0x21ad('0xee')][_0x21ad('0xef')]||_0x372943[_0x21ad('0xf0')]['remoteAddress']||_0x372943[_0x21ad('0xf1')][_0x21ad('0xf2')]||_0x372943[_0x21ad('0xf0')][_0x21ad('0xf1')][_0x21ad('0xf2')]});return db[_0x21ad('0xab')]['destroy']({'where':{'membername':_0x1ca408[_0x21ad('0x2f')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x21ad('0x8f'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x21ad('0x25')](function(){if(_0x1ca408){return _0x1ca408[_0x21ad('0xf3')]({'raw':!![]});}})[_0x21ad('0x25')](function(_0x5e8e2e){if(_0x1ca408){var _0x326b94=[];if(_0x5e8e2e){_0x822b7c=_0x5e8e2e;if(_0x822b7c[_0x21ad('0x48')]){for(var _0x52aaa5=0x0;_0x52aaa5<_0x822b7c[_0x21ad('0x48')];_0x52aaa5++){_0x326b94[_0x21ad('0x44')]({'membername':_0x1ca408['name'],'UserId':_0x1ca408['id'],'queue_name':_0x822b7c[_0x52aaa5][_0x21ad('0x2f')],'VoiceQueueId':_0x822b7c[_0x52aaa5]['id'],'interface':_0x5e368b,'paused':_0x1ca408[_0x21ad('0x9c')]||![],'penalty':_0x822b7c[_0x52aaa5][_0x21ad('0xf4')]||0x0});}return BPromise[_0x21ad('0x8a')](_0x326b94,function(_0x9a31ee){return db[_0x21ad('0xab')][_0x21ad('0xac')](_0x9a31ee);});}}}})[_0x21ad('0x25')](function(){if(_0x1ca408){return db[_0x21ad('0xf5')][_0x21ad('0x45')]({'where':{'membername':_0x1ca408[_0x21ad('0x2f')],'exitAt':null}});}})[_0x21ad('0x25')](function(_0x4a6d7d){if(_0x1ca408){var _0x2613cb=[];_0x4a6d7d[_0x21ad('0xf6')](function(_0x50e69b){_0x2613cb[_0x21ad('0x44')](_0x50e69b[_0x21ad('0x24')]({'exitAt':moment()['format'](_0x21ad('0xf7'))}));});return BPromise[_0x21ad('0x4d')](_0x2613cb);}})['then'](function(){if(_0x1ca408){var _0x3340f8=[];var _0x2f4216=[];var _0x1db71c=utils[_0x21ad('0xf8')]();var _0x48c755={'membername':_0x1ca408[_0x21ad('0x2f')],'interface':_0x5e368b,'enterAt':moment()[_0x21ad('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1ca408['role'],'internal':_0x1ca408[_0x21ad('0x60')]};_0x1db71c[_0x21ad('0xf6')](function(_0x4837fd){_0x3340f8[_0x21ad('0x44')](_[_0x21ad('0x57')]({'channel':_0x4837fd,'type':_0x21ad('0xf9'),'data1':_0x372943['body']['device'],'data2':_0x5e368b},_0x48c755));if(_0x1ca408[_0x21ad('0x9c')]){_0x2f4216[_0x21ad('0x44')](_[_0x21ad('0x57')]({'channel':_0x4837fd,'type':'PAUSE','data1':_0x21ad('0xfa')},_0x48c755));}});return db[_0x21ad('0xf5')][_0x21ad('0x87')](_0x3340f8['concat'](_0x2f4216),{'individualHooks':!![]});}})[_0x21ad('0x25')](function(){if(_0x1ca408){return _0x1ca408[_0x21ad('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x21ad('0xf7')),'voicePause':_0x1ca408[_0x21ad('0x9c')]||![],'mailPause':_0x1ca408['loginInPause']||![],'chatPause':_0x1ca408[_0x21ad('0x9c')]||![],'faxPause':_0x1ca408[_0x21ad('0x9c')]||![],'smsPause':_0x1ca408[_0x21ad('0x9c')]||![],'openchannelPause':_0x1ca408[_0x21ad('0x9c')]||![],'whatsappPause':_0x1ca408['loginInPause']||![],'pauseType':_0x1ca408[_0x21ad('0x9c')]?_0x21ad('0xfa'):null,'interface':_0x5e368b,'lastPauseAt':moment()[_0x21ad('0xa8')](_0x21ad('0xf7'))});}})['then'](function(_0x2f9fd8){if(_0x372943[_0x21ad('0xfb')]){return _0x65f678();}else{return BPromise[_0x21ad('0xfc')](_0x2f9fd8)[_0x21ad('0x25')](respondWithResult(_0x109a9c,null));}})[_0x21ad('0x4e')](handleError(_0x109a9c,null));};exports[_0x21ad('0xfd')]=function(_0x10f628,_0x36d75c){var _0x2c86d4;return db[_0x21ad('0x3c')][_0x21ad('0x59')]({'where':{'id':_0x10f628[_0x21ad('0x50')]['id'],'role':_0x21ad('0x2a')},'attributes':['id',_0x21ad('0x2f'),_0x21ad('0x28')]})['then'](handleEntityNotFound(_0x36d75c,null))[_0x21ad('0x25')](function(_0x34a9da){if(_0x34a9da){_0x2c86d4=_0x34a9da;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2c86d4[_0x21ad('0x2f')]},'individualHooks':!![]});}})[_0x21ad('0x25')](function(){return db[_0x21ad('0xf5')][_0x21ad('0x45')]({'where':{'membername':_0x2c86d4[_0x21ad('0x2f')],'exitAt':null}});})['then'](function(_0x86654b){var _0x17cbdf=[];_0x86654b['forEach'](function(_0x4d9558){_0x17cbdf[_0x21ad('0x44')](_0x4d9558['update']({'exitAt':moment()[_0x21ad('0xa8')](_0x21ad('0xf7'))}));});return BPromise[_0x21ad('0x4d')](_0x17cbdf);})[_0x21ad('0x25')](function(){return _0x2c86d4['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x21ad('0x25')](respondWithResult(_0x36d75c,null))['catch'](handleError(_0x36d75c,null));};exports[_0x21ad('0xfe')]=function(_0x5dccd7,_0x114218){var _0x59a89d;return db[_0x21ad('0xab')][_0x21ad('0x24')]({'paused':0x1},{'where':{'UserId':_0x5dccd7[_0x21ad('0x50')]['id']},'individualHooks':!![]})[_0x21ad('0x25')](function(){return db[_0x21ad('0x3c')]['find']({'where':{'id':_0x5dccd7['params']['id'],'role':'agent'},'attributes':['id',_0x21ad('0x2f'),_0x21ad('0x28'),_0x21ad('0x60'),'interface']});})[_0x21ad('0x25')](handleEntityNotFound(_0x114218,null))['then'](function(_0x33d838){if(_0x33d838){_0x59a89d=_0x33d838;return respondWithRpcPromise(_0x21ad('0xff'),_0x21ad('0xfe'),{'id':_0x59a89d['id'],'name':_0x59a89d[_0x21ad('0x2f')],'pause':!![]});}})[_0x21ad('0x25')](function(){if(_0x59a89d){return db['MemberReport']['findAll']({'where':{'membername':_0x59a89d[_0x21ad('0x2f')],'type':_0x21ad('0x100'),'exitAt':null}});}})['then'](function(_0x36bbdc){if(_0x36bbdc[_0x21ad('0x48')]){var _0x10b0f5=moment()[_0x21ad('0xa8')](_0x21ad('0xf7'));for(var _0x4455c4=0x0,_0x45be0a=_0x36bbdc[_0x21ad('0x48')];_0x4455c4<_0x45be0a;_0x4455c4++){_0x36bbdc[_0x4455c4]['updateAttributes']({'exitAt':_0x10b0f5});}}})[_0x21ad('0x25')](function(){var _0x48465e=[];var _0x540177=utils[_0x21ad('0xf8')]();_0x540177[_0x21ad('0xf6')](function(_0x2058e2){_0x48465e[_0x21ad('0x44')]({'channel':_0x2058e2,'membername':_0x59a89d[_0x21ad('0x2f')],'interface':_[_0x21ad('0x64')](_0x59a89d[_0x21ad('0x9d')])?util['format'](_0x21ad('0xa9'),_0x59a89d[_0x21ad('0x2f')]):_0x59a89d[_0x21ad('0x9d')],'type':_0x21ad('0x100'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5dccd7['body'][_0x21ad('0x34')]||_0x21ad('0x101'),'role':_0x59a89d[_0x21ad('0x28')],'internal':_0x59a89d[_0x21ad('0x60')]});});return db[_0x21ad('0xf5')][_0x21ad('0x87')](_0x48465e,{'individualHooks':!![]});})[_0x21ad('0x25')](function(){return _0x59a89d[_0x21ad('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5dccd7[_0x21ad('0x5b')][_0x21ad('0x34')]||_0x21ad('0x101'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x21ad('0x25')](respondWithResult(_0x114218,null))[_0x21ad('0x4e')](handleError(_0x114218,null));};exports['unpause']=function(_0x4d047b,_0xc84181){var _0x162442;return db['User']['find']({'where':{'id':_0x4d047b[_0x21ad('0x50')]['id']},'attributes':['id',_0x21ad('0x2f'),_0x21ad('0x28'),_0x21ad('0x102'),_0x21ad('0x103'),_0x21ad('0x104'),_0x21ad('0x105'),_0x21ad('0x106'),_0x21ad('0x107'),_0x21ad('0x108'),_0x21ad('0x109'),_0x21ad('0x10a')]})['then'](handleEntityNotFound(_0xc84181,null))[_0x21ad('0x25')](function(_0x4beba9){if(_0x4beba9){_0x162442=_0x4beba9;if(_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')]&&!utils[_0x21ad('0x9e')](_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')])){throw new db['Sequelize'][(_0x21ad('0x8f'))](_0x21ad('0xae'));}switch(_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')]){case _0x21ad('0xa5'):return respondWithRpcPromise('QueuePause',_0x21ad('0x10b'),{'id':_0x162442['id'],'name':_0x162442['name'],'pause':![]})[_0x21ad('0x25')](function(){return db[_0x21ad('0xab')]['update']({'paused':0x0},{'where':{'UserId':_0x162442['id']},'individualHooks':!![]});})[_0x21ad('0x25')](function(){return db[_0x21ad('0xf5')][_0x21ad('0x59')]({'where':{'channel':_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')],'membername':_0x162442[_0x21ad('0x2f')],'type':'PAUSE','exitAt':null}});})[_0x21ad('0x25')](function(_0x13da9c){if(_0x13da9c){return _0x13da9c[_0x21ad('0x24')]({'exitAt':moment()[_0x21ad('0xa8')](_0x21ad('0xf7')),'data2':_0x21ad('0x10c')},{'individualHooks':!![]});}return null;})[_0x21ad('0x25')](function(){return _0x162442[_0x21ad('0x24')]({'voicePause':![]});});case _0x21ad('0x4a'):case _0x21ad('0xbc'):case'fax':case _0x21ad('0x10d'):case _0x21ad('0x4c'):case _0x21ad('0x4b'):return db[_0x21ad('0xf5')][_0x21ad('0x59')]({'where':{'channel':_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')],'membername':_0x162442[_0x21ad('0x2f')],'type':_0x21ad('0x100'),'exitAt':null}})[_0x21ad('0x25')](function(_0x58cdcb){if(_0x58cdcb){return _0x58cdcb[_0x21ad('0x24')]({'exitAt':moment()[_0x21ad('0xa8')](_0x21ad('0xf7')),'data2':_0x21ad('0x10c')},{'individualHooks':!![]});}return null;})[_0x21ad('0x25')](function(){var _0x153afc={};_[_0x21ad('0x22')](_0x153afc,util[_0x21ad('0xa8')](_0x21ad('0x10e'),_0x4d047b[_0x21ad('0x5b')][_0x21ad('0x9b')],'Pause'),![]);return _0x162442[_0x21ad('0x24')](_0x153afc);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x162442['id'],'name':_0x162442[_0x21ad('0x2f')],'pause':![]})[_0x21ad('0x25')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x162442['id']}});})[_0x21ad('0x25')](function(){return db[_0x21ad('0xf5')][_0x21ad('0x45')]({'where':{'membername':_0x162442[_0x21ad('0x2f')],'type':_0x21ad('0x100'),'exitAt':null}});})[_0x21ad('0x25')](function(_0x49b78a){var _0x42fa2e=[];_0x49b78a[_0x21ad('0xf6')](function(_0x591482){_0x42fa2e[_0x21ad('0x44')](_0x591482[_0x21ad('0x24')]({'exitAt':moment()[_0x21ad('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x21ad('0x10c')}));});return BPromise[_0x21ad('0x4d')](_0x42fa2e);})[_0x21ad('0x25')](function(){return _0x162442[_0x21ad('0x24')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x21ad('0x25')](respondWithResult(_0xc84181,null))[_0x21ad('0x4e')](handleError(_0xc84181,null));};exports['getTeams']=function(_0x20acf9,_0x3cf6be){var _0x483b01={};var _0x2575d3={};var _0x5f2fcd;var _0x4bc66f;return db['User']['findOne']({'where':{'id':_0x20acf9['params']['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x3cf6be,null))['then'](function(_0x1cbeea){if(_0x1cbeea){_0x5f2fcd=_0x1cbeea;_0x2575d3[_0x21ad('0x55')]=_[_0x21ad('0x52')](db[_0x21ad('0x10f')][_0x21ad('0x33')]);_0x2575d3[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x20acf9[_0x21ad('0x3d')]);_0x2575d3[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x2575d3['model'],_0x2575d3[_0x21ad('0x3d')]);_0x483b01[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x2575d3[_0x21ad('0x55')],qs['fields'](_0x20acf9[_0x21ad('0x3d')]['fields']));_0x483b01[_0x21ad('0x43')]=_0x483b01[_0x21ad('0x43')][_0x21ad('0x48')]?_0x483b01[_0x21ad('0x43')]:_0x2575d3[_0x21ad('0x55')];_0x483b01[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x20acf9['query'][_0x21ad('0xcb')]);_0x483b01[_0x21ad('0x3b')]=qs['filters'](_[_0x21ad('0xd7')](_0x20acf9[_0x21ad('0x3d')],_0x2575d3[_0x21ad('0x53')]));if(_0x20acf9[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x483b01[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x483b01['where'],{'$or':_[_0x21ad('0x2d')](_0x483b01[_0x21ad('0x43')],function(_0x180a9b){var _0x3f6d19={};_0x3f6d19[_0x180a9b]={'$like':'%'+_0x20acf9[_0x21ad('0x3d')]['filter']+'%'};return _0x3f6d19;})});}_0x483b01=_[_0x21ad('0x57')]({},_0x483b01,_0x20acf9[_0x21ad('0x58')]);return _0x5f2fcd[_0x21ad('0x110')](_0x483b01);}})[_0x21ad('0x25')](function(_0x414daf){if(_0x414daf){_0x4bc66f=_0x414daf['length'];if(!_0x20acf9[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x483b01['limit']=qs[_0x21ad('0x20')](_0x20acf9[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x483b01['offset']=qs[_0x21ad('0x1e')](_0x20acf9['query'][_0x21ad('0x1e')]);}return _0x5f2fcd['getTeams'](_0x483b01);}})[_0x21ad('0x25')](function(_0x5504d4){if(_0x5504d4){return _0x5504d4?{'count':_0x4bc66f,'rows':_0x5504d4}:null;}})[_0x21ad('0x25')](respondWithResult(_0x3cf6be,null))[_0x21ad('0x4e')](handleError(_0x3cf6be,null));};exports[_0x21ad('0x111')]=function(_0x1f98c2,_0x56c080){return db['User'][_0x21ad('0x59')]({'where':{'id':_0x1f98c2[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x56c080,null))['then'](function(_0x156f1f){if(_0x156f1f){var _0x16b58a=_0x156f1f[_0x21ad('0x27')]({'plain':!![]});return _0x156f1f[_0x21ad('0x111')](_0x1f98c2[_0x21ad('0x5b')][_0x21ad('0x5e')],_[_0x21ad('0x5f')](_0x1f98c2[_0x21ad('0x5b')],[_0x21ad('0x5e'),'id'])||{})[_0x21ad('0x25')](function(){for(var _0x5370be=0x0;_0x5370be<_0x1f98c2['body'][_0x21ad('0x5e')][_0x21ad('0x48')];_0x5370be++){var _0x17c8de=[];var _0x4fa587={};db[_0x21ad('0x10f')]['findOne']({'where':{'id':_0x1f98c2[_0x21ad('0x5b')][_0x21ad('0x5e')][_0x5370be]}})[_0x21ad('0x25')](function(_0x75f0e7){_0x4fa587=_0x75f0e7[_0x21ad('0x49')];_0x17c8de[_0x21ad('0x44')](_0x75f0e7['getVoiceQueues']()[_0x21ad('0x25')](function(_0x56260b){for(var _0x1bd14f=0x0;_0x1bd14f<_0x56260b['length'];_0x1bd14f++){_0x56260b[_0x1bd14f][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x113'));}return _0x56260b;}));_0x17c8de[_0x21ad('0x44')](_0x75f0e7['getChatQueues']()[_0x21ad('0x25')](function(_0x1a2a53){for(var _0x421f6f=0x0;_0x421f6f<_0x1a2a53[_0x21ad('0x48')];_0x421f6f++){_0x1a2a53[_0x421f6f][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x114'));}return _0x1a2a53;}));_0x17c8de['push'](_0x75f0e7[_0x21ad('0x115')]()[_0x21ad('0x25')](function(_0x18c027){for(var _0x3106f0=0x0;_0x3106f0<_0x18c027[_0x21ad('0x48')];_0x3106f0++){_0x18c027[_0x3106f0][_0x21ad('0x112')]('channel',_0x21ad('0x116'));}return _0x18c027;}));_0x17c8de[_0x21ad('0x44')](_0x75f0e7[_0x21ad('0x117')]()['then'](function(_0x27f48f){for(var _0x218fc6=0x0;_0x218fc6<_0x27f48f['length'];_0x218fc6++){_0x27f48f[_0x218fc6]['setDataValue'](_0x21ad('0x9b'),_0x21ad('0x118'));}return _0x27f48f;}));_0x17c8de[_0x21ad('0x44')](_0x75f0e7[_0x21ad('0x119')]()['then'](function(_0x23d3f0){for(var _0x56d9fb=0x0;_0x56d9fb<_0x23d3f0[_0x21ad('0x48')];_0x56d9fb++){_0x23d3f0[_0x56d9fb][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x11a'));}return _0x23d3f0;}));_0x17c8de['push'](_0x75f0e7['getFaxQueues']()[_0x21ad('0x25')](function(_0x124274){for(var _0x43d52c=0x0;_0x43d52c<_0x124274[_0x21ad('0x48')];_0x43d52c++){_0x124274[_0x43d52c][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x11b'));}return _0x124274;}));_0x17c8de[_0x21ad('0x44')](_0x75f0e7['getOpenchannelQueues']()['then'](function(_0x35c73c){for(var _0x74dfad=0x0;_0x74dfad<_0x35c73c[_0x21ad('0x48')];_0x74dfad++){_0x35c73c[_0x74dfad][_0x21ad('0x112')]('channel',_0x21ad('0x11c'));}return _0x35c73c;}));return BPromise[_0x21ad('0x4d')](_0x17c8de);})['then'](function(_0x2303f2){var _0x582bb8=_['flatten'](_0x2303f2);_0x17c8de=[];return db[_0x21ad('0x67')][_0x21ad('0x11d')](function(_0x53dcd9){for(var _0xbd41f1=0x0;_0xbd41f1<_0x582bb8[_0x21ad('0x48')];_0xbd41f1++){_0x17c8de[_0x21ad('0x44')](_0x582bb8[_0xbd41f1][_0x21ad('0x11e')](_0x16b58a['id']),{'transaction':_0x53dcd9});}return BPromise['all'](_0x17c8de)['then'](function(){if(_0x16b58a[_0x21ad('0xa7')]){return BPromise['each'](_[_0x21ad('0x36')](_0x582bb8,function(_0x3a4195){return _0x3a4195[_0x21ad('0x11f')]('channel')==='Voice';}),function(_0x125e02){return db['UserVoiceQueueRt'][_0x21ad('0xac')]({'membername':_0x16b58a[_0x21ad('0x2f')],'UserId':_0x16b58a['id'],'queue_name':_0x125e02[_0x21ad('0x2f')],'VoiceQueueId':_0x125e02['id'],'interface':_['isNil'](_0x16b58a[_0x21ad('0x9d')])?util[_0x21ad('0xa8')](_0x21ad('0xa9'),_0x16b58a['name']):_0x16b58a['interface'],'paused':_0x16b58a[_0x21ad('0x102')]||![],'penalty':_0x16b58a['penalty']},{'transaction':_0x53dcd9});});}else{return;}})['then'](function(){for(var _0x3fa933=0x0;_0x3fa933<_0x582bb8[_0x21ad('0x48')];_0x3fa933++){var _0xb457aa=_0x582bb8[_0x3fa933]['getDataValue'](_0x21ad('0x9b'));var _0x249539=_0xb457aa+_0x21ad('0xa2');socket[_0x21ad('0xa3')](_0x21ad('0x7d')+_0xb457aa+_0x21ad('0x120'),{'UserId':_0x16b58a['id'],['queueField']:_0x582bb8[_0x3fa933]['id']});}});});})[_0x21ad('0x25')](function(){db[_0x21ad('0x121')][_0x21ad('0x95')]({'where':{'teamId':_0x4fa587['id']}})[_0x21ad('0x25')](function(_0x2595c5){if(_0x2595c5){db['UserVoicePrefix'][_0x21ad('0x7c')]({'UserId':_0x1f98c2['params']['id'],'VoicePrefixId':_0x2595c5[_0x21ad('0x122')]});}});});}});}})[_0x21ad('0x25')](respondWithStatusCode(_0x56c080,null))[_0x21ad('0x4e')](handleError(_0x56c080,null));};exports[_0x21ad('0x123')]=function(_0x549bba,_0x539215){return db['User']['findOne']({'where':{'id':_0x549bba['params']['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x539215,null))['then'](function(_0x52327a){if(_0x52327a){var _0x453954=_0x52327a[_0x21ad('0x27')]({'plain':!![]});var _0x418f99=_0x549bba[_0x21ad('0x3d')][_0x21ad('0x5e')];return _0x52327a['removeTeams'](_0x418f99)[_0x21ad('0x25')](function(){for(var _0x350325=0x0;_0x350325<_0x418f99[_0x21ad('0x48')];_0x350325++){var _0x1f8452=[];var _0x57ea3a={};db[_0x21ad('0x10f')]['findOne']({'where':{'id':_0x418f99[_0x350325]}})[_0x21ad('0x25')](function(_0x47f79f){_0x57ea3a=_0x47f79f[_0x21ad('0x49')];_0x1f8452[_0x21ad('0x44')](_0x47f79f[_0x21ad('0xf3')]()[_0x21ad('0x25')](function(_0x2ffe28){for(var _0x2fed3e=0x0;_0x2fed3e<_0x2ffe28[_0x21ad('0x48')];_0x2fed3e++){_0x2ffe28[_0x2fed3e][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x113'));}return _0x2ffe28;}));_0x1f8452['push'](_0x47f79f['getChatQueues']()[_0x21ad('0x25')](function(_0x3866f1){for(var _0x51b956=0x0;_0x51b956<_0x3866f1['length'];_0x51b956++){_0x3866f1[_0x51b956]['setDataValue'](_0x21ad('0x9b'),_0x21ad('0x114'));}return _0x3866f1;}));_0x1f8452['push'](_0x47f79f[_0x21ad('0x115')]()[_0x21ad('0x25')](function(_0x108232){for(var _0x585346=0x0;_0x585346<_0x108232[_0x21ad('0x48')];_0x585346++){_0x108232[_0x585346]['setDataValue'](_0x21ad('0x9b'),_0x21ad('0x116'));}return _0x108232;}));_0x1f8452[_0x21ad('0x44')](_0x47f79f['getSmsQueues']()[_0x21ad('0x25')](function(_0x1e8f74){for(var _0x49f6d6=0x0;_0x49f6d6<_0x1e8f74['length'];_0x49f6d6++){_0x1e8f74[_0x49f6d6][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x118'));}return _0x1e8f74;}));_0x1f8452[_0x21ad('0x44')](_0x47f79f[_0x21ad('0x119')]()[_0x21ad('0x25')](function(_0x556a79){for(var _0x1a6e79=0x0;_0x1a6e79<_0x556a79[_0x21ad('0x48')];_0x1a6e79++){_0x556a79[_0x1a6e79][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x11a'));}return _0x556a79;}));_0x1f8452[_0x21ad('0x44')](_0x47f79f[_0x21ad('0x124')]()[_0x21ad('0x25')](function(_0x3dc5ca){for(var _0x1bfa72=0x0;_0x1bfa72<_0x3dc5ca['length'];_0x1bfa72++){_0x3dc5ca[_0x1bfa72][_0x21ad('0x112')](_0x21ad('0x9b'),_0x21ad('0x11b'));}return _0x3dc5ca;}));_0x1f8452[_0x21ad('0x44')](_0x47f79f[_0x21ad('0x125')]()[_0x21ad('0x25')](function(_0x261c51){for(var _0x3ddd61=0x0;_0x3ddd61<_0x261c51[_0x21ad('0x48')];_0x3ddd61++){_0x261c51[_0x3ddd61][_0x21ad('0x112')]('channel',_0x21ad('0x11c'));}return _0x261c51;}));return BPromise[_0x21ad('0x4d')](_0x1f8452);})[_0x21ad('0x25')](function(_0x4b07d4){var _0x46f002=_['flatten'](_0x4b07d4);_0x1f8452=[];return db[_0x21ad('0x67')][_0x21ad('0x11d')](function(_0x30f450){for(var _0x2d7048=0x0;_0x2d7048<_0x46f002[_0x21ad('0x48')];_0x2d7048++){_0x1f8452[_0x21ad('0x44')](_0x46f002[_0x2d7048][_0x21ad('0x126')](_0x453954['id']),{'transaction':_0x30f450});}return BPromise[_0x21ad('0x4d')](_0x1f8452)[_0x21ad('0x25')](function(){if(_0x453954[_0x21ad('0xa7')]){return BPromise['each'](_[_0x21ad('0x36')](_0x46f002,function(_0x5cd52e){return _0x5cd52e['getDataValue'](_0x21ad('0x9b'))===_0x21ad('0x113');}),function(_0x34f44d){return db['UserVoiceQueueRt'][_0x21ad('0x26')]({'where':{'VoiceQueueId':_0x34f44d['id'],'UserId':_0x453954['id']},'transaction':_0x30f450});});}else{return;}})['then'](function(){db[_0x21ad('0x121')][_0x21ad('0x95')]({'where':{'teamId':_0x57ea3a['id']}})['then'](function(_0x12a0f0){if(_0x12a0f0){return db[_0x21ad('0x127')][_0x21ad('0x26')]({'where':{'UserId':_0x453954['id'],'VoicePrefixId':_0x12a0f0[_0x21ad('0x49')][_0x21ad('0x122')]}});}});})[_0x21ad('0x25')](function(){for(var _0x51b341=0x0;_0x51b341<_0x46f002[_0x21ad('0x48')];_0x51b341++){var _0x2d9c79=_0x46f002[_0x51b341][_0x21ad('0x11f')]('channel');var _0x370956=_0x2d9c79+_0x21ad('0xa2');socket[_0x21ad('0xa3')]('user'+_0x2d9c79+_0x21ad('0xb2'),{'UserId':_0x453954['id'],['queueField']:_0x46f002[_0x51b341]['id']});}});});});}});}})[_0x21ad('0x25')](respondWithStatusCode(_0x539215,null))[_0x21ad('0x4e')](handleError(_0x539215,null));};exports[_0x21ad('0x128')]=function(_0x389704,_0x3a1381){var _0x275f8d={};var _0x1a77be={};var _0x174573;var _0x5ec16c;return db['User'][_0x21ad('0x95')]({'where':{'id':_0x389704['params']['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x3a1381,null))[_0x21ad('0x25')](function(_0x2aa7ce){if(_0x2aa7ce){_0x174573=_0x2aa7ce;_0x1a77be[_0x21ad('0x55')]=_['keys'](db[_0x21ad('0x129')][_0x21ad('0x33')]);_0x1a77be['query']=_[_0x21ad('0x52')](_0x389704['query']);_0x1a77be['filters']=_[_0x21ad('0x54')](_0x1a77be[_0x21ad('0x55')],_0x1a77be[_0x21ad('0x3d')]);_0x275f8d[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x1a77be[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x389704[_0x21ad('0x3d')]['fields']));_0x275f8d[_0x21ad('0x43')]=_0x275f8d[_0x21ad('0x43')][_0x21ad('0x48')]?_0x275f8d['attributes']:_0x1a77be[_0x21ad('0x55')];_0x275f8d[_0x21ad('0xca')]=qs[_0x21ad('0xcb')](_0x389704[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x275f8d[_0x21ad('0x3b')]=qs[_0x21ad('0x53')](_['pick'](_0x389704[_0x21ad('0x3d')],_0x1a77be[_0x21ad('0x53')]));if(_0x389704[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x275f8d[_0x21ad('0x3b')]=_[_0x21ad('0x57')](_0x275f8d['where'],{'$or':_[_0x21ad('0x2d')](_0x275f8d[_0x21ad('0x43')],function(_0x4c8f80){var _0x45fb58={};_0x45fb58[_0x4c8f80]={'$like':'%'+_0x389704['query'][_0x21ad('0x36')]+'%'};return _0x45fb58;})});}_0x275f8d=_[_0x21ad('0x57')]({},_0x275f8d,_0x389704[_0x21ad('0x58')]);return _0x174573[_0x21ad('0x128')](_0x275f8d);}})[_0x21ad('0x25')](function(_0x3b6786){if(_0x3b6786){_0x5ec16c=_0x3b6786[_0x21ad('0x48')];if(!_0x389704[_0x21ad('0x3d')][_0x21ad('0xd2')](_0x21ad('0xd3'))){_0x275f8d[_0x21ad('0x20')]=qs['limit'](_0x389704[_0x21ad('0x3d')][_0x21ad('0x20')]);_0x275f8d[_0x21ad('0x1e')]=qs[_0x21ad('0x1e')](_0x389704[_0x21ad('0x3d')][_0x21ad('0x1e')]);}return _0x174573[_0x21ad('0x128')](_0x275f8d);}})['then'](function(_0x2fe151){if(_0x2fe151){return _0x2fe151?{'count':_0x5ec16c,'rows':_0x2fe151}:null;}})[_0x21ad('0x25')](respondWithResult(_0x3a1381,null))['catch'](handleError(_0x3a1381,null));};exports[_0x21ad('0x12a')]=function(_0x27c055,_0x77411d){var _0x40a5b3={};var _0x7f442a={};var _0x13789e;return db[_0x21ad('0x3c')][_0x21ad('0x95')]({'where':{'id':_0x27c055[_0x21ad('0x50')]['id']}})[_0x21ad('0x25')](handleEntityNotFound(_0x77411d,null))['then'](function(_0x2bb104){if(_0x2bb104){_0x13789e=_0x2bb104;_0x7f442a['model']=_[_0x21ad('0x52')](db[_0x21ad('0x3c')][_0x21ad('0x33')]);_0x7f442a[_0x21ad('0x3d')]=_[_0x21ad('0x52')](_0x27c055[_0x21ad('0x3d')]);_0x7f442a[_0x21ad('0x53')]=_[_0x21ad('0x54')](_0x7f442a[_0x21ad('0x55')],_0x7f442a[_0x21ad('0x3d')]);_0x40a5b3[_0x21ad('0x43')]=_[_0x21ad('0x54')](_0x7f442a[_0x21ad('0x55')],qs[_0x21ad('0x56')](_0x27c055[_0x21ad('0x3d')][_0x21ad('0x56')]));_0x40a5b3[_0x21ad('0x43')]=_0x40a5b3['attributes']['length']?_0x40a5b3['attributes']:_0x7f442a['model'];_0x40a5b3[_0x21ad('0xca')]=qs['sort'](_0x27c055[_0x21ad('0x3d')][_0x21ad('0xcb')]);_0x40a5b3[_0x21ad('0x3b')]=qs['filters'](_[_0x21ad('0xd7')](_0x27c055[_0x21ad('0x3d')],_0x7f442a[_0x21ad('0x53')]));if(_0x27c055[_0x21ad('0x3d')][_0x21ad('0x36')]){_0x40a5b3['where']=_[_0x21ad('0x57')](_0x40a5b3[_0x21ad('0x3b')],{'$or':_[_0x21ad('0x2d')](_0x40a5b3[_0x21ad('0x43')],function(_0x5c3f80){var _0x537ded={};_0x537ded[_0x5c3f80]={'$like':'%'+_0x27c055[_0x21ad('0x3d')][_0x21ad('0x36')]+'%'};return _0x537ded;})});}_0x40a5b3['model']=db['User'];_0x40a5b3['as']=_0x21ad('0x8b');_0x40a5b3=_[_0x21ad('0x57')]({},_0x40a5b3,_0x27c055['options']);return _0x13789e['getVoiceQueues']({'include':[_0x40a5b3]});}})['then'](function(_0x3cb95d){if(_0x3cb95d){var _0x2954d7={},_0x33289a=[];for(var _0xa2f1f1=0x0;_0xa2f1f1<_0x3cb95d[_0x21ad('0x48')];_0xa2f1f1+=0x1){for(var _0x22c27d=0x0,_0x5a2a75;_0x22c27d<_0x3cb95d[_0xa2f1f1][_0x21ad('0x8b')][_0x21ad('0x48')];_0x22c27d+=0x1){_0x5a2a75=_0x3cb95d[_0xa2f1f1][_0x21ad('0x8b')][_0x22c27d][_0x21ad('0x27')]({'plain':!![]});_0x2954d7[_0x5a2a75['id']]=_0x5a2a75;}}_0x2954d7=_[_0x21ad('0x12b')](_0x2954d7);for(var _0x147e80=qs[_0x21ad('0x1e')](_0x27c055['query'][_0x21ad('0x1e')]);_0x147e80<_0x2954d7[_0x21ad('0x48')]&&_0x33289a[_0x21ad('0x48')]=_0x39f077){_0x97d894=_0x39f077;_0xe852f3=0xc8;}else{_0xe852f3=0xce;}_0x2746bf[_0x0375('0x1d')](_0xe852f3);return _0x2746bf[_0x0375('0x23')]('Content-Range',_0x144078+'-'+_0x97d894+'/'+_0x39f077)[_0x0375('0x1e')](_0x1eb570);}return null;};}function saveUpdates(_0x56bfb3){return function(_0x3b702a){if(_0x3b702a){return _0x3b702a[_0x0375('0x24')](_0x56bfb3)['then'](function(_0xf2797a){return _0xf2797a;});}return null;};}function removeEntity(_0x10be8e){return function(_0x440fb8){if(_0x440fb8){return _0x440fb8[_0x0375('0x25')]()[_0x0375('0x26')](function(){var _0x3afbc6=_0x440fb8[_0x0375('0x27')]({'plain':!![]});if(_0x3afbc6[_0x0375('0x28')]===_0x0375('0x29'))return;var _0x421160=[{'name':_0x0375('0x2a'),'value':'user','ignore':!![]},{'name':_0x0375('0x2b'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0x0375('0x2c'),'ignore':![]}];var _0x142f8c=_(_0x421160)[_0x0375('0x2d')](_0x0375('0x2e'))[_0x0375('0x2f')](_0x0375('0x30'))[_0x0375('0x30')]();if(_[_0x0375('0x31')](_0x142f8c,_0x3afbc6[_0x0375('0x28')])){return;}var _0x5b3027=_[_0x0375('0x32')](_0x421160,[_0x0375('0x30'),_0x3afbc6[_0x0375('0x28')]])['name'];return db[_0x0375('0x33')][_0x0375('0x25')]({'where':{'type':_0x5b3027,'resourceId':_0x3afbc6['id']}})[_0x0375('0x26')](function(){return _0x440fb8;});})[_0x0375('0x26')](function(){_0x10be8e['status'](0xcc)[_0x0375('0x34')]();});}};}function handleEntityNotFound(_0x47c7f9){return function(_0x104ac2){if(!_0x104ac2){_0x47c7f9[_0x0375('0x1c')](0x194);}return _0x104ac2;};}function handleError(_0x3b4395,_0x1bac8e){_0x1bac8e=_0x1bac8e||0x1f4;return function(_0x111de7){logger[_0x0375('0x16')](_0x111de7[_0x0375('0x35')]);if(_0x111de7[_0x0375('0x36')]){delete _0x111de7[_0x0375('0x36')];}_0x3b4395['status'](_0x1bac8e)[_0x0375('0x37')](_0x111de7);};}exports[_0x0375('0x38')]=function(_0x31cc26,_0x11da99){var _0x35dc56={},_0x564c60={'count':0x0,'rows':[]};var _0x1c482f=_(db[_0x0375('0x39')][_0x0375('0x3a')])[_0x0375('0x2f')](function(_0x2d3f83){return{'name':_0x2d3f83[_0x0375('0x3b')],'type':_0x2d3f83[_0x0375('0x3c')][_0x0375('0x3d')]};})[_0x0375('0x2d')](function(_0x5500d6){return!_[_0x0375('0x31')]([_0x0375('0x3e'),_0x0375('0x3f')],_0x5500d6['name']);})[_0x0375('0x30')]();_0x35dc56=qs['getOptions'](_0x1c482f,_0x31cc26);var _0x2cbc25={'where':_0x35dc56[_0x0375('0x40')]};return db[_0x0375('0x39')]['count'](_0x2cbc25)[_0x0375('0x26')](function(_0x10a1c8){_0x564c60[_0x0375('0x22')]=_0x10a1c8;if(_0x31cc26[_0x0375('0x41')][_0x0375('0x42')]){_0x35dc56[_0x0375('0x43')]=[{'all':!![]}];}if(_0x31cc26[_0x0375('0x41')]['userSetting']===_0x0375('0x44')){_0x35dc56[_0x0375('0x43')]=[{'model':db[_0x0375('0x45')],'as':_0x0375('0x46')}];}if(!_[_0x0375('0x31')](_0x35dc56[_0x0375('0x47')],'id')){_0x35dc56[_0x0375('0x47')][_0x0375('0x48')]('id');}return db['User'][_0x0375('0x49')](_0x35dc56);})[_0x0375('0x26')](function(_0x4bade1){_0x564c60['rows']=_0x4bade1;if(_0x31cc26[_0x0375('0x41')][_0x0375('0x4a')]===_0x0375('0x44')){var _0x5ac4fe=[];for(var _0x3df054=0x0;_0x3df054<_0x564c60[_0x0375('0x4b')][_0x0375('0x4c')];_0x3df054++){_0x5ac4fe['push'](get_open_tabs(_0x0375('0x4d'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs('sms',_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe['push'](get_open_tabs('fax',_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x50'),_0x564c60['rows'][_0x3df054]['dataValues']));_0x5ac4fe[_0x0375('0x48')](get_open_tabs(_0x0375('0x51'),_0x564c60[_0x0375('0x4b')][_0x3df054][_0x0375('0x4e')]));}return BPromise[_0x0375('0x52')](_0x5ac4fe)[_0x0375('0x26')](function(){return _0x564c60;});}else{return _0x564c60;}})['then'](respondWithFilteredResult(_0x11da99,_0x35dc56))[_0x0375('0x1b')](handleError(_0x11da99,null));};exports[_0x0375('0x53')]=function(_0x55d21f,_0x1e3cd9){var _0xd2066e={'raw':![],'where':{'id':_0x55d21f['params']['id']}},_0x4e03d8={};_0x4e03d8[_0x0375('0x54')]=_[_0x0375('0x55')](_['keys'](db[_0x0375('0x39')][_0x0375('0x3a')]),[_0x0375('0x3e'),_0x0375('0x3f')]);_0x4e03d8['query']=_['keys'](_0x55d21f[_0x0375('0x41')]);_0x4e03d8[_0x0375('0x56')]=_[_0x0375('0x57')](_0x4e03d8['model'],_0x4e03d8['query']);_0xd2066e[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4e03d8[_0x0375('0x54')],qs['fields'](_0x55d21f[_0x0375('0x41')][_0x0375('0x58')]));_0xd2066e[_0x0375('0x47')]=_0xd2066e[_0x0375('0x47')][_0x0375('0x4c')]?_0xd2066e[_0x0375('0x47')]:_0x4e03d8[_0x0375('0x54')];if(_0x55d21f[_0x0375('0x41')][_0x0375('0x42')]){_0xd2066e[_0x0375('0x43')]=[{'all':!![]}];}if(_0x55d21f['query']['userSetting']===_0x0375('0x44')){_0xd2066e[_0x0375('0x43')]=[{'model':db[_0x0375('0x45')],'as':_0x0375('0x46')}];}_0xd2066e=_['merge']({},_0xd2066e,_0x55d21f[_0x0375('0x59')]);if(!_[_0x0375('0x31')](_0xd2066e[_0x0375('0x47')],'id')){_0xd2066e[_0x0375('0x47')]['push']('id');}return db[_0x0375('0x39')][_0x0375('0x32')](_0xd2066e)[_0x0375('0x26')](handleEntityNotFound(_0x1e3cd9,null))[_0x0375('0x26')](function(_0x37962d){var _0x3f0a20=[];values=_0x37962d;if(_0x55d21f[_0x0375('0x41')]['openTabs']===_0x0375('0x44')){_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x4d'),_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x5a'),_0x37962d['dataValues']));_0x3f0a20['push'](get_open_tabs('openchannel',_0x37962d['dataValues']));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x51'),_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs('fax',_0x37962d[_0x0375('0x4e')]));_0x3f0a20[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x37962d[_0x0375('0x4e')]));return BPromise[_0x0375('0x52')](_0x3f0a20);}else{return values;}})[_0x0375('0x26')](function(){return values;})['then'](respondWithResult(_0x1e3cd9,null))[_0x0375('0x1b')](handleError(_0x1e3cd9,null));};exports[_0x0375('0x24')]=function(_0x462cfe,_0x320b32){if(_0x462cfe[_0x0375('0x5b')]['id']){delete _0x462cfe[_0x0375('0x5b')]['id'];}delete _0x462cfe[_0x0375('0x5b')]['role'];return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x462cfe['params']['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x320b32,null))['then'](saveUpdates(_0x462cfe[_0x0375('0x5b')],null))['then'](respondWithResult(_0x320b32,null))[_0x0375('0x1b')](handleError(_0x320b32,null));};exports[_0x0375('0x5c')]=function(_0x566b61,_0x4c1229){return db[_0x0375('0x39')][_0x0375('0x5c')]()[_0x0375('0x26')](respondWithResult(_0x4c1229,null))[_0x0375('0x1b')](handleError(_0x4c1229,null));};exports[_0x0375('0x5d')]=function(_0x1129e6,_0xe88d18){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x1129e6[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0xe88d18,null))[_0x0375('0x26')](function(_0x2ff912){if(_0x2ff912){return _0x2ff912[_0x0375('0x5d')](_0x1129e6['body'][_0x0375('0x5f')],_[_0x0375('0x60')](_0x1129e6[_0x0375('0x5b')],[_0x0375('0x5f'),'id'])||{});}})[_0x0375('0x26')](respondWithResult(_0xe88d18,null))['catch'](handleError(_0xe88d18,null));};function validateUser(_0x1e46d0){return new BPromise(function(_0x218166,_0x446d08){if(_0x1e46d0[_0x0375('0x61')])return _0x218166(_0x1e46d0);return db[_0x0375('0x62')][_0x0375('0x63')](0x1)[_0x0375('0x26')](function(_0x281168){if(_0x281168[_0x0375('0x64')])authService[_0x0375('0x65')](_0x1e46d0[_0x0375('0x3e')]);db['User'][_0x0375('0x66')]('internal')[_0x0375('0x26')](function(_0x50148a){if(_[_0x0375('0x67')](_0x50148a)){_0x1e46d0[_0x0375('0x61')]=_0x281168['min_internal']||0x1;return;}if(_[_0x0375('0x67')](_0x281168['min_internal'])||_0x281168[_0x0375('0x68')]===_0x50148a){_0x1e46d0[_0x0375('0x61')]=_0x50148a+0x1;return;}if(_0x281168[_0x0375('0x68')]>_0x50148a){_0x1e46d0[_0x0375('0x61')]=_0x281168[_0x0375('0x68')];return;}return db[_0x0375('0x69')][_0x0375('0x41')](_0x0375('0x6a'),{'type':db[_0x0375('0x69')][_0x0375('0x6b')]['SELECT']})['then'](function(_0x420020){if(_0x420020&&_0x420020[_0x0375('0x4c')]){for(var _0x3524e9=0x0,_0x1870b5=_0x420020[_0x0375('0x4c')];_0x3524e9<_0x1870b5&&_['isNil'](_0x1e46d0['internal']);_0x3524e9++){if(_0x281168[_0x0375('0x68')]<=_0x420020[_0x3524e9][_0x0375('0x6c')]){_0x1e46d0[_0x0375('0x61')]=_0x420020[_0x3524e9][_0x0375('0x6c')];}else if(_0x281168[_0x0375('0x68')]>_0x420020[_0x3524e9]['from']&&_0x281168[_0x0375('0x68')]<=_0x420020[_0x3524e9]['to']){_0x1e46d0[_0x0375('0x61')]=_0x281168['min_internal'];}}}if(_[_0x0375('0x67')](_0x1e46d0[_0x0375('0x61')])){_0x1e46d0[_0x0375('0x61')]=_0x50148a+0x1;}return _0x218166(_0x1e46d0);});});})[_0x0375('0x1b')](function(_0x5a2bc8){_0x446d08(_0x5a2bc8);});});}function updateUser(_0x123ee2){return new BPromise(function(_0x5d3a1d,_0xe524fb){try{if(_0x123ee2[_0x0375('0x6d')]){_0x123ee2[_0x0375('0x6e')]=_0x123ee2['internal'];_0x123ee2[_0x0375('0x6f')]={'mailbox':_0x123ee2[_0x0375('0x61')],'password':_0x123ee2[_0x0375('0x3e')],'fullname':_0x123ee2['fullname'],'email':_0x123ee2[_0x0375('0x70')]};}if(_0x123ee2[_0x0375('0x28')]===_0x0375('0x71')){if(!_0x123ee2['permissions'])_0x123ee2[_0x0375('0x72')]=[_0x0375('0x73'),_0x0375('0x74'),_0x0375('0x75'),_0x0375('0x76'),_0x0375('0x77'),'104',_0x0375('0x78'),'106','107',_0x0375('0x79'),_0x0375('0x7a'),'100',_0x0375('0x7b'),_0x0375('0x7c'),_0x0375('0x7d')];}_0x5d3a1d(_0x123ee2);}catch(_0x2027cf){_0xe524fb(_0x2027cf);}});}exports['create']=function(_0x2bba61,_0x383893){if(_0x2bba61[_0x0375('0x7e')]['role']===_0x0375('0x71'))throw new Error(_0x0375('0x7f'));if(_0x2bba61[_0x0375('0x5b')][_0x0375('0x28')]===_0x0375('0x7e')&&_0x2bba61[_0x0375('0x7e')][_0x0375('0x28')]!==_0x0375('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2bba61['body'][_0x0375('0x28')]===_0x0375('0x29')&&_0x2bba61['user'][_0x0375('0x28')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x0375('0x80')]([_0x2bba61['body']])[_0x0375('0x26')](function(){return validateUser(_0x2bba61[_0x0375('0x5b')]);})[_0x0375('0x26')](function(_0x3081b6){return updateUser(_0x3081b6)[_0x0375('0x26')](function(_0x283e5f){if(_0x283e5f[_0x0375('0x28')]===_0x0375('0x29')){_0x283e5f[_0x0375('0x81')]=_0x2bba61['user'][_0x0375('0x81')];delete _0x283e5f[_0x0375('0x82')];}return _0x283e5f;});})['then'](function(_0x589664){return db[_0x0375('0x39')][_0x0375('0x83')](_0x589664,{'include':[{'model':db[_0x0375('0x6f')],'as':_0x0375('0x6f')}]});})['then'](function(_0x16d5cc){if(_0x2bba61['body'][_0x0375('0x28')]===_0x0375('0x7e'))return _0x16d5cc;if(_0x2bba61[_0x0375('0x7e')][_0x0375('0x28')]!=='user')return _0x16d5cc;return db['UserProfileSection'][_0x0375('0x32')]({'where':{'name':_0x16d5cc['role']==='agent'?'Agents':_0x0375('0x84'),'userProfileId':_0x2bba61[_0x0375('0x7e')]['userProfileId']},'raw':!![]})[_0x0375('0x26')](function(_0x41ec85){if(!_0x41ec85||_0x41ec85[_0x0375('0x85')]!=0x0)return _0x16d5cc;return db['UserProfileResource'][_0x0375('0x83')]({'name':_0x16d5cc[_0x0375('0x36')],'resourceId':_0x16d5cc['id'],'type':_0x41ec85[_0x0375('0x36')],'sectionId':_0x41ec85['id']},{})[_0x0375('0x26')](function(){return _0x16d5cc;});})[_0x0375('0x1b')](function(_0x1915ea){logger[_0x0375('0x16')](_0x0375('0x86'),_0x1915ea);throw _0x1915ea;});})[_0x0375('0x26')](respondWithResult(_0x383893,0xc9))['catch'](handleError(_0x383893,null));};exports[_0x0375('0x87')]=function(_0x56c9f1,_0x514071){var _0x261c35=_0x56c9f1['body'];var _0x12dd70=[];if(_0x56c9f1[_0x0375('0x7e')]['role']==='agent')throw new Error('Unauthorized');if(_['some'](_0x261c35,[_0x0375('0x28'),_0x0375('0x7e')])&&_0x56c9f1[_0x0375('0x7e')][_0x0375('0x28')]!=='admin'){throw new Error(_0x0375('0x88'));}if(_[_0x0375('0x89')](_0x261c35,[_0x0375('0x28'),_0x0375('0x29')])&&_0x56c9f1[_0x0375('0x7e')]['role']!=='admin'){throw new Error(_0x0375('0x8a'));}return licenseUtil[_0x0375('0x80')](_0x261c35)[_0x0375('0x26')](function(){return validateUser(_0x261c35[0x0]);})[_0x0375('0x26')](function(){for(var _0x4209a2=0x1;_0x4209a2<_0x261c35[_0x0375('0x4c')];_0x4209a2++){var _0x2bdfe4=_0x261c35[_0x4209a2-0x1]['internal'];if(!_0x261c35[_0x4209a2][_0x0375('0x61')])_0x261c35[_0x4209a2][_0x0375('0x61')]=_0x2bdfe4+0x1;_0x12dd70[_0x0375('0x48')](validateUser(_0x261c35[_0x4209a2]));}return BPromise[_0x0375('0x52')](_0x12dd70);})[_0x0375('0x26')](function(){_0x12dd70=[];for(var _0xf6e95c=0x0;_0xf6e95c<_0x261c35[_0x0375('0x4c')];_0xf6e95c++){_0x12dd70[_0x0375('0x48')](updateUser(_0x261c35[_0xf6e95c]));}return BPromise[_0x0375('0x52')](_0x12dd70);})['then'](function(){return BPromise[_0x0375('0x8b')](_0x261c35,function(_0x57933d){return db[_0x0375('0x39')][_0x0375('0x83')](_0x57933d,{'include':[{'model':db[_0x0375('0x6f')],'as':_0x0375('0x6f')}]})[_0x0375('0x26')](function(_0x4b352c){_0x57933d['id']=_0x4b352c['id'];return _0x57933d;});});})[_0x0375('0x26')](function(_0xeddc46){if(_0x56c9f1[_0x0375('0x5b')]['role']===_0x0375('0x7e'))return _0xeddc46;if(_0x56c9f1[_0x0375('0x7e')][_0x0375('0x28')]!==_0x0375('0x7e'))return _0xeddc46;var _0x1815b5=_[_0x0375('0x89')](_0xeddc46,function(_0x319bc8){return _0x319bc8[_0x0375('0x28')]===_0x0375('0x71')||_0x319bc8[_0x0375('0x28')]===_0x0375('0x2c');});if(!_0x1815b5)return _0xeddc46;return db[_0x0375('0x8c')][_0x0375('0x49')]({'where':{'name':{'$or':[_0x0375('0x2b'),_0x0375('0x84')]},'userProfileId':_0x56c9f1[_0x0375('0x7e')]['userProfileId']},'raw':!![]})[_0x0375('0x26')](function(_0x5b2b6b){if(_[_0x0375('0x8d')](_0x5b2b6b)||!_[_0x0375('0x89')](_0x5b2b6b,[_0x0375('0x85'),0x0]))return _0xeddc46;_0x12dd70=[];var _0x45538f=_(_0x5b2b6b)[_0x0375('0x2f')](function(_0xdf45f5){if(_0xdf45f5['autoAssociation']===0x1)return;return _0xdf45f5[_0x0375('0x36')]===_0x0375('0x2b')?'agent':_0x0375('0x2c');})[_0x0375('0x8e')]()[_0x0375('0x30')]();for(var _0x4a48d9=0x0;_0x4a48d9<_0xeddc46[_0x0375('0x4c')];_0x4a48d9++){if(!_[_0x0375('0x31')](_0x45538f,_0xeddc46[_0x4a48d9][_0x0375('0x28')]))return;var _0x484f25=_0xeddc46[_0x4a48d9][_0x0375('0x28')]==='agent'?_0x0375('0x2b'):'Telephones';_0x12dd70[_0x0375('0x48')](db[_0x0375('0x33')][_0x0375('0x83')]({'name':_0xeddc46[_0x4a48d9][_0x0375('0x36')],'resourceId':_0xeddc46[_0x4a48d9]['id'],'type':_0x484f25,'sectionId':_[_0x0375('0x32')](_0x5b2b6b,[_0x0375('0x36'),_0x484f25])['id']},{}));}return BPromise[_0x0375('0x52')](_0x12dd70);});})[_0x0375('0x26')](respondWithResult(_0x514071,0xc9))[_0x0375('0x1b')](handleError(_0x514071,null));};exports[_0x0375('0x8f')]=function(_0x1ad731,_0x385d11){if(_0x1ad731[_0x0375('0x5b')]['id']){delete _0x1ad731[_0x0375('0x5b')]['id'];}return db[_0x0375('0x39')]['find']({'where':{'id':_0x1ad731[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](function(_0x45ee49){if(!_0x45ee49)return null;if(_0x45ee49['id']===_0x1ad731[_0x0375('0x7e')]['id']){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x90')]||!_0x1ad731['body'][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0x94'));}if(!_0x45ee49[_0x0375('0x95')](_0x1ad731['body'][_0x0375('0x90')])){throw new db['Sequelize'][(_0x0375('0x93'))](_0x0375('0x96'));}if(_0x1ad731[_0x0375('0x5b')][_0x0375('0x90')]===_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0x97'));}}else if(_0x1ad731['user'][_0x0375('0x28')]==='admin'){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db['Sequelize'][(_0x0375('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1ad731[_0x0375('0x7e')][_0x0375('0x28')]===_0x0375('0x7e')){if(!_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')]){throw new db[(_0x0375('0x92'))]['ValidationError'](_0x0375('0x98'));}if(_0x45ee49['role']!==_0x0375('0x71')){throw new db[(_0x0375('0x92'))]['ValidationError'](_0x0375('0x7f'));}}else{throw new db['Sequelize']['ValidationError'](_0x0375('0x7f'));}return _0x45ee49;})[_0x0375('0x26')](handleEntityNotFound(_0x385d11,null))[_0x0375('0x26')](function(_0x34cbfa){return db['Setting'][_0x0375('0x99')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x0375('0x9a')]})[_0x0375('0x26')](function(_0x27558b){if(_0x27558b[_0x0375('0x64')])authService[_0x0375('0x65')](_0x1ad731['body'][_0x0375('0x91')]);if(!_0x27558b[_0x0375('0x9b')]||!_0x34cbfa[_0x0375('0x9c')])return _0x34cbfa;authService[_0x0375('0x9d')](_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],_0x34cbfa[_0x0375('0x9c')],_0x27558b[_0x0375('0x9a')]);return _0x34cbfa;})[_0x0375('0x26')](saveUpdates({'password':_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],'passwordResetAt':_0x1ad731[_0x0375('0x7e')]['id']==_0x1ad731['params']['id']?moment():null,'previousPasswords':authService[_0x0375('0x9e')](_0x1ad731[_0x0375('0x5b')][_0x0375('0x91')],_0x34cbfa[_0x0375('0x9c')])},null));})[_0x0375('0x26')](respondWithResult(_0x385d11,null))['catch'](handleError(_0x385d11,null));};exports['addQueues']=function(_0x302540,_0x53a5ae){var _0x21d779=_0x302540[_0x0375('0x5b')][_0x0375('0x9f')];return db[_0x0375('0x39')]['find']({'where':{'id':_0x302540['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28'),'online',_0x0375('0xa0'),_0x0375('0xa1'),_0x0375('0xa2')]})['then'](handleEntityNotFound(_0x53a5ae,null))[_0x0375('0x26')](function(_0x2b8f4b){if(_0x2b8f4b){if(!utils[_0x0375('0xa3')](_0x21d779)){throw new db['Sequelize'][(_0x0375('0x93'))](_0x0375('0xa4'));}return _0x2b8f4b['add'+_[_0x0375('0xa5')](_0x21d779[_0x0375('0xa6')]())+_0x0375('0xa7')](_0x302540[_0x0375('0x5b')][_0x0375('0x5f')],{'penalty':_0x302540[_0x0375('0x5b')][_0x0375('0xa8')]||0x0})[_0x0375('0xa9')](function(_0x2eadff){for(var _0x3f082f=0x0;_0x3f082f<_0x302540[_0x0375('0x5b')][_0x0375('0x5f')]['length'];_0x3f082f+=0x1){var _0x1cb6f6={'UserId':Number(_0x302540[_0x0375('0x5e')]['id'])};_0x1cb6f6[_['capitalize'](_0x21d779['toLowerCase']())+_0x0375('0xaa')]=Number(_0x302540['body']['ids'][_0x3f082f]);socket[_0x0375('0xab')]('user'+_[_0x0375('0xa5')](_0x21d779[_0x0375('0xa6')]())+'Queue:save',_0x1cb6f6);}return _0x2eadff;})[_0x0375('0x26')](function(){if(_0x21d779===_0x0375('0xac')){return db[_0x0375('0xad')][_0x0375('0x49')]({'where':{'id':_0x302540[_0x0375('0x5b')]['ids']||[]},'raw':!![],'attributes':['id',_0x0375('0x36')]});}})[_0x0375('0x26')](function(_0x13fce8){var _0x1d83b3=_0x2b8f4b[_0x0375('0x27')]({'plain':!![]});var _0x391cdc=[];if(_0x21d779===_0x0375('0xac')&&_0x1d83b3[_0x0375('0x28')]===_0x0375('0x71')&&_0x1d83b3['online']){for(var _0x2f948e=0x0;_0x2f948e<_0x13fce8[_0x0375('0x4c')];_0x2f948e+=0x1){_0x391cdc['push']({'membername':_0x1d83b3['name'],'UserId':_0x1d83b3['id'],'queue_name':_0x13fce8[_0x2f948e][_0x0375('0x36')],'VoiceQueueId':_0x13fce8[_0x2f948e]['id'],'interface':_['isNil'](_0x1d83b3[_0x0375('0xa2')])?util[_0x0375('0xae')](_0x0375('0xaf'),_0x1d83b3[_0x0375('0x36')]):_0x1d83b3['interface'],'paused':_0x1d83b3[_0x0375('0xa1')]||![],'penalty':_0x302540[_0x0375('0x5b')][_0x0375('0xa8')]||0x0});}return BPromise[_0x0375('0x8b')](_0x391cdc,function(_0x2f34bc){return db[_0x0375('0xb0')][_0x0375('0xb1')](_0x2f34bc);});}return _0x2b8f4b;});}})[_0x0375('0x26')](respondWithStatusCode(_0x53a5ae,null))[_0x0375('0x1b')](handleError(_0x53a5ae,null));};exports[_0x0375('0xb2')]=function(_0x25701b,_0x13b913){var _0x8433e1,_0x3ea368;return db[_0x0375('0x39')]['find']({'where':{'id':_0x25701b['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0x13b913,null))[_0x0375('0x26')](function(_0x3e2021){if(_0x3e2021){_0x8433e1=_0x3e2021;if(!_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]||!utils[_0x0375('0xa3')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')])){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xa4'));}return _0x3e2021[_0x0375('0xb3')+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]['toLowerCase']())+'Queues'](_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]);}})['then'](function(_0x2beb04){if(_[_0x0375('0xb4')](_0x25701b[_0x0375('0x41')][_0x0375('0x5f')])){for(var _0x7a6e9c=0x0;_0x7a6e9c<_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]['length'];_0x7a6e9c+=0x1){_0x3ea368={'UserId':Number(_0x25701b['params']['id'])};_0x3ea368[_['capitalize'](_0x25701b[_0x0375('0x41')]['channel']['toLowerCase']())+'QueueId']=Number(_0x25701b[_0x0375('0x41')][_0x0375('0x5f')][_0x7a6e9c]);socket[_0x0375('0xab')](_0x0375('0x7e')+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')]['channel'][_0x0375('0xa6')]())+_0x0375('0xb5'),_0x3ea368);}}else{_0x3ea368={'UserId':Number(_0x25701b[_0x0375('0x5e')]['id'])};_0x3ea368[_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')][_0x0375('0xa6')]())+_0x0375('0xaa')]=Number(_0x25701b[_0x0375('0x41')][_0x0375('0x5f')]);socket[_0x0375('0xab')]('user'+_[_0x0375('0xa5')](_0x25701b[_0x0375('0x41')][_0x0375('0x9f')][_0x0375('0xa6')]())+_0x0375('0xb5'),_0x3ea368);}return _0x2beb04;})[_0x0375('0x26')](function(){if(_0x25701b[_0x0375('0x41')][_0x0375('0x9f')]==='voice'){return db[_0x0375('0xb0')][_0x0375('0x25')]({'where':{'UserId':_0x25701b[_0x0375('0x5e')]['id'],'VoiceQueueId':_0x25701b[_0x0375('0x41')]['ids']},'individualHooks':!![]})[_0x0375('0x26')](function(){return _0x8433e1;});}return _0x8433e1;})[_0x0375('0x26')](respondWithStatusCode(_0x13b913,null))[_0x0375('0x1b')](handleError(_0x13b913,null));};exports['addAvatar']=function(_0x2fdd03,_0x512989){_0x2fdd03[_0x0375('0x5b')][_0x0375('0xb6')]=_0x2fdd03[_0x0375('0xb7')][_0x0375('0xb8')];return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x2fdd03[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x512989,null))['then'](saveUpdates(_0x2fdd03['body'],null))[_0x0375('0x26')](respondWithResult(_0x512989,null))[_0x0375('0x1b')](handleError(_0x512989,null));};exports[_0x0375('0xb9')]=function(_0x5472c5,_0x2472a1){var _0x1a83c7=path[_0x0375('0xba')](config[_0x0375('0xbb')],'server/files/images/logos/default_profile.png');return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x5472c5[_0x0375('0x5e')]['id']},'attributes':['id',_0x0375('0xb6')],'raw':!![]})[_0x0375('0x26')](handleEntityNotFound(_0x2472a1,null))[_0x0375('0x26')](function(_0x4326aa){if(_0x4326aa){if(_['isNil'](_0x4326aa['userpic'])){return _0x2472a1[_0x0375('0xbc')](_0x1a83c7);}else{if(!fs['existsSync'](path[_0x0375('0xba')](config[_0x0375('0xbb')],'server/files/images/',_0x4326aa['userpic']))){return _0x2472a1['download'](_0x1a83c7);}return _0x2472a1[_0x0375('0xbc')](path[_0x0375('0xba')](config[_0x0375('0xbb')],_0x0375('0xbd'),_0x4326aa[_0x0375('0xb6')]));}}})[_0x0375('0x1b')](handleError(_0x2472a1,null));};exports[_0x0375('0xbe')]=function(_0x219bac,_0x5dd8c0){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x219bac['params']['id']},'attributes':['id']})[_0x0375('0x26')](handleEntityNotFound(_0x5dd8c0,null))['then'](function(_0x49485f){var _0x11a2d9=[];values=_0x49485f['dataValues'];_0x11a2d9[_0x0375('0x48')](get_open_tabs('chat',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs('sms',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0x50'),_0x49485f['dataValues']));_0x11a2d9[_0x0375('0x48')](get_open_tabs('whatsapp',_0x49485f[_0x0375('0x4e')]));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0xbf'),_0x49485f['dataValues']));_0x11a2d9[_0x0375('0x48')](get_open_tabs(_0x0375('0x4f'),_0x49485f[_0x0375('0x4e')]));return BPromise[_0x0375('0x52')](_0x11a2d9);})[_0x0375('0x26')](function(_0x568b3f){if(_0x568b3f){var _0x5cc970=_[_0x0375('0x2f')](values[_0x0375('0xc0')],function(_0x1045bc){return{'channel':_0x0375('0xc1'),'id':_0x1045bc['id'],'createdAt':_0x1045bc[_0x0375('0xc2')]};});var _0x6fd7c1=_[_0x0375('0x2f')](values[_0x0375('0xc3')],function(_0x11e17b){return{'channel':_0x0375('0xc4'),'id':_0x11e17b['id'],'createdAt':_0x11e17b[_0x0375('0xc2')]};});var _0x36c744=_['map'](values[_0x0375('0xc5')],function(_0x8b6751){return{'channel':_0x0375('0xc6'),'id':_0x8b6751['id'],'createdAt':_0x8b6751[_0x0375('0xc2')]};});var _0xfe1ce0=_[_0x0375('0x2f')](values[_0x0375('0xc7')],function(_0x48a946){return{'channel':'MAIL','id':_0x48a946['id'],'createdAt':_0x48a946[_0x0375('0xc2')]};});var _0x37d488=_[_0x0375('0x2f')](values['SmsOpenTabs'],function(_0x1a0995){return{'channel':_0x0375('0xc8'),'id':_0x1a0995['id'],'createdAt':_0x1a0995['createdAt']};});var _0x214e73=_[_0x0375('0x2f')](values[_0x0375('0xc9')],function(_0x1caab4){return{'channel':_0x0375('0xca'),'id':_0x1caab4['id'],'createdAt':_0x1caab4[_0x0375('0xc2')]};});var _0x1d172a=_[_0x0375('0xcb')](_0x5cc970,_0x6fd7c1,_0x36c744,_0xfe1ce0,_0x37d488,_0x214e73);var _0x50618e={'count':_0x1d172a[_0x0375('0x4c')],'rows':_0x1d172a};return _0x50618e;}else return null;})[_0x0375('0x26')](respondWithResult(_0x5dd8c0,null))[_0x0375('0x1b')](handleError(_0x5dd8c0,null));};exports[_0x0375('0xcc')]=function(_0x422afc,_0x2c32d2){var _0xb833d4={};var _0x348920={};var _0x2d03ec;var _0x566e7b;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x422afc[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x2c32d2,null))[_0x0375('0x26')](function(_0x2138b1){if(_0x2138b1){_0x2d03ec=_0x2138b1;_0x348920[_0x0375('0x54')]=_[_0x0375('0xcd')](db['CmContact'][_0x0375('0x3a')]);_0x348920[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x422afc[_0x0375('0x41')]);_0x348920[_0x0375('0x56')]=_[_0x0375('0x57')](_0x348920[_0x0375('0x54')],_0x348920[_0x0375('0x41')]);_0xb833d4[_0x0375('0x47')]=_[_0x0375('0x57')](_0x348920[_0x0375('0x54')],qs[_0x0375('0x58')](_0x422afc[_0x0375('0x41')][_0x0375('0x58')]));_0xb833d4['attributes']=_0xb833d4[_0x0375('0x47')][_0x0375('0x4c')]?_0xb833d4[_0x0375('0x47')]:_0x348920['model'];_0xb833d4[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x422afc[_0x0375('0x41')][_0x0375('0xcf')]);_0xb833d4[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x422afc['query'],_0x348920['filters']));if(_0x422afc['query'][_0x0375('0x2d')]){_0xb833d4[_0x0375('0x40')]=_[_0x0375('0xd1')](_0xb833d4['where'],{'$or':_[_0x0375('0x2f')](_0xb833d4['attributes'],function(_0x3953ee){var _0x5dbd9d={};_0x5dbd9d[_0x3953ee]={'$like':'%'+_0x422afc[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x5dbd9d;})});}_0xb833d4=_[_0x0375('0xd1')]({},_0xb833d4,_0x422afc[_0x0375('0x59')]);return _0x2d03ec[_0x0375('0xcc')](_0xb833d4);}})[_0x0375('0x26')](function(_0x4cae8c){if(_0x4cae8c){_0x566e7b=_0x4cae8c[_0x0375('0x4c')];if(_0x422afc[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0x42'))){_0xb833d4[_0x0375('0x43')]=[{'model':db[_0x0375('0xd3')],'as':_0x0375('0xd4'),'required':![]},{'model':db[_0x0375('0xd5')],'as':'Tags','attributes':['id',_0x0375('0x36'),_0x0375('0xd6')],'where':_0x422afc[_0x0375('0x41')][_0x0375('0xd7')]?{'id':_0x422afc['query'][_0x0375('0xd7')]}:undefined,'required':_0x422afc[_0x0375('0x41')][_0x0375('0xd7')]?!![]:![]}];}if(!_0x422afc[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0xb833d4['limit']=qs['limit'](_0x422afc[_0x0375('0x41')][_0x0375('0x21')]);_0xb833d4[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x422afc[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x2d03ec[_0x0375('0xcc')](_0xb833d4);}})[_0x0375('0x26')](function(_0x343364){if(_0x343364){return _0x343364?{'count':_0x566e7b,'rows':_0x343364}:null;}})[_0x0375('0x26')](respondWithResult(_0x2c32d2,null))['catch'](handleError(_0x2c32d2,null));};exports[_0x0375('0xd9')]=function(_0x3ebab0,_0xe8d720){var _0x2cb491;var _0x3e091d={};var _0x27fb4e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x3ebab0['params']['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0xe8d720,null))[_0x0375('0x26')](function(_0x34fdf5){if(!utils[_0x0375('0xa3')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])){throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xa4'));}_0x2cb491=_0x34fdf5;var _0x75664a={};_0x75664a[_0x0375('0x54')]=_['keys'](db[_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xda')][_0x0375('0x3a')]);_0x75664a[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x3ebab0['query']);_0x75664a[_0x0375('0x56')]=_[_0x0375('0x57')](_0x75664a[_0x0375('0x54')],_0x75664a['query']);_0x3e091d[_0x0375('0x47')]=_[_0x0375('0x57')](_0x75664a[_0x0375('0x54')],qs[_0x0375('0x58')](_0x3ebab0['query'][_0x0375('0x58')]));_0x3e091d[_0x0375('0x47')]=_0x3e091d[_0x0375('0x47')]['length']?_0x3e091d[_0x0375('0x47')]:_0x75664a[_0x0375('0x54')];_0x3e091d[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x3ebab0['query'][_0x0375('0xcf')]);_0x3e091d[_0x0375('0x40')]=qs['filters'](_['pick'](_0x3ebab0['query'],_0x75664a[_0x0375('0x56')]));if(_0x3ebab0[_0x0375('0x41')][_0x0375('0x2d')]){_0x3e091d['where']=_['merge'](_0x3e091d[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x3e091d[_0x0375('0x47')],function(_0x22fc88){var _0x6c257a={};_0x6c257a[_0x22fc88]={'$like':'%'+_0x3ebab0[_0x0375('0x41')]['filter']+'%'};return _0x6c257a;})});}_0x3e091d=_['merge']({},_0x3e091d,_0x3ebab0[_0x0375('0x59')]);switch(_0x2cb491[_0x0375('0x28')]){case _0x0375('0x29'):return db[_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xda')]['findAll'](_0x3e091d);case _0x0375('0x7e'):case _0x0375('0x71'):return _0x2cb491[_0x0375('0x27')+_['capitalize'](_0x3ebab0['query'][_0x0375('0x9f')])+'Queues'](_0x3e091d);default:throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xdb'));}})['then'](function(_0x7bfd6c){_0x27fb4e=_0x7bfd6c['length'];if(!_0x3ebab0[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x3e091d[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x21')]);_0x3e091d[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x3ebab0[_0x0375('0x41')]['offset']);}switch(_0x2cb491[_0x0375('0x28')]){case _0x0375('0x29'):return db[_['capitalize'](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+'Queue'][_0x0375('0x49')](_0x3e091d);case _0x0375('0x7e'):case'agent':return _0x2cb491['get'+_[_0x0375('0xa5')](_0x3ebab0[_0x0375('0x41')][_0x0375('0x9f')])+_0x0375('0xa7')](_0x3e091d);}})['then'](function(_0x42809b){return{'count':_0x27fb4e,'rows':_0x42809b};})[_0x0375('0x26')](respondWithResult(_0xe8d720,null))[_0x0375('0x1b')](handleError(_0xe8d720,null));};exports[_0x0375('0xdc')]=function(_0x10ae03,_0xdcc593){var _0x4439e7={};var _0x4f7b4f={};var _0x4a6fe0;var _0x2c0127;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x10ae03[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0xdcc593,null))[_0x0375('0x26')](function(_0x534f71){if(_0x534f71){_0x4a6fe0=_0x534f71;_0x4f7b4f[_0x0375('0x54')]=_['keys'](db['UserVoiceQueueRt'][_0x0375('0x3a')]);_0x4f7b4f[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x10ae03[_0x0375('0x41')]);_0x4f7b4f[_0x0375('0x56')]=_['intersection'](_0x4f7b4f[_0x0375('0x54')],_0x4f7b4f['query']);_0x4439e7[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4f7b4f[_0x0375('0x54')],qs[_0x0375('0x58')](_0x10ae03['query'][_0x0375('0x58')]));_0x4439e7[_0x0375('0x47')]=_0x4439e7[_0x0375('0x47')][_0x0375('0x4c')]?_0x4439e7['attributes']:_0x4f7b4f[_0x0375('0x54')];_0x4439e7[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x10ae03[_0x0375('0x41')][_0x0375('0xcf')]);_0x4439e7[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x10ae03['query'],_0x4f7b4f[_0x0375('0x56')]));if(_0x10ae03[_0x0375('0x41')]['filter']){_0x4439e7['where']=_[_0x0375('0xd1')](_0x4439e7[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x4439e7[_0x0375('0x47')],function(_0x7165b){var _0x4eeef7={};_0x4eeef7[_0x7165b]={'$like':'%'+_0x10ae03[_0x0375('0x41')]['filter']+'%'};return _0x4eeef7;})});}_0x4439e7=_['merge']({},_0x4439e7,_0x10ae03[_0x0375('0x59')]);return _0x4a6fe0[_0x0375('0xdc')](_0x4439e7);}})[_0x0375('0x26')](function(_0x56a446){if(_0x56a446){_0x2c0127=_0x56a446[_0x0375('0x4c')];if(!_0x10ae03[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x4439e7[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x10ae03[_0x0375('0x41')][_0x0375('0x21')]);_0x4439e7[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x10ae03[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x4a6fe0[_0x0375('0xdc')](_0x4439e7);}})[_0x0375('0x26')](function(_0x52986c){if(_0x52986c){return _0x52986c?{'count':_0x2c0127,'rows':_0x52986c}:null;}})[_0x0375('0x26')](respondWithResult(_0xdcc593,null))[_0x0375('0x1b')](handleError(_0xdcc593,null));};exports[_0x0375('0xdd')]=function(_0x273f82,_0x1a5985){var _0x22bd5f={};var _0x377923={};var _0x1911fc;var _0x47513e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x273f82[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a5985,null))[_0x0375('0x26')](function(_0x598002){if(_0x598002){_0x1911fc=_0x598002;_0x377923[_0x0375('0x54')]=_[_0x0375('0xcd')](db['ChatGroup'][_0x0375('0x3a')]);_0x377923[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x273f82[_0x0375('0x41')]);_0x377923[_0x0375('0x56')]=_['intersection'](_0x377923['model'],_0x377923[_0x0375('0x41')]);_0x22bd5f[_0x0375('0x47')]=_[_0x0375('0x57')](_0x377923[_0x0375('0x54')],qs['fields'](_0x273f82[_0x0375('0x41')][_0x0375('0x58')]));_0x22bd5f[_0x0375('0x47')]=_0x22bd5f[_0x0375('0x47')]['length']?_0x22bd5f['attributes']:_0x377923['model'];_0x22bd5f[_0x0375('0xce')]=qs['sort'](_0x273f82[_0x0375('0x41')][_0x0375('0xcf')]);_0x22bd5f[_0x0375('0x40')]=qs['filters'](_[_0x0375('0xd0')](_0x273f82[_0x0375('0x41')],_0x377923['filters']));if(_0x273f82[_0x0375('0x41')][_0x0375('0x2d')]){_0x22bd5f[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x22bd5f['where'],{'$or':_[_0x0375('0x2f')](_0x22bd5f[_0x0375('0x47')],function(_0x5f061e){var _0x11984c={};_0x11984c[_0x5f061e]={'$like':'%'+_0x273f82['query']['filter']+'%'};return _0x11984c;})});}_0x22bd5f=_[_0x0375('0xd1')]({},_0x22bd5f,_0x273f82[_0x0375('0x59')]);return _0x1911fc[_0x0375('0xdd')](_0x22bd5f);}})['then'](function(_0x41747d){if(_0x41747d){_0x47513e=_0x41747d[_0x0375('0x4c')];if(!_0x273f82[_0x0375('0x41')][_0x0375('0xd2')]('nolimit')){_0x22bd5f[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x273f82[_0x0375('0x41')]['limit']);_0x22bd5f[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x273f82[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x1911fc['getGroups'](_0x22bd5f);}})['then'](function(_0xd2862f){if(_0xd2862f){return _0xd2862f?{'count':_0x47513e,'rows':_0xd2862f}:null;}})[_0x0375('0x26')](respondWithResult(_0x1a5985,null))[_0x0375('0x1b')](handleError(_0x1a5985,null));};exports[_0x0375('0xde')]=function(_0x1e776d,_0x34c494){var _0x535e1c={'raw':!![],'where':{}};var _0x309916={};var _0x210306={'count':0x0,'rows':[]};return db[_0x0375('0x39')]['findOne']({'where':{'id':_0x1e776d['params']['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x34c494,null))['then'](function(_0x439926){if(_0x439926){_0x309916['model']=_['keys'](db[_0x0375('0xdf')][_0x0375('0x3a')]);_0x309916[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x1e776d[_0x0375('0x41')]);_0x309916['filters']=_[_0x0375('0x57')](_0x309916[_0x0375('0x54')],_0x309916['query']);_0x535e1c[_0x0375('0x47')]=_[_0x0375('0x57')](_0x309916[_0x0375('0x54')],qs['fields'](_0x1e776d['query'][_0x0375('0x58')]));_0x535e1c[_0x0375('0x47')]=_0x535e1c[_0x0375('0x47')]['length']?_0x535e1c[_0x0375('0x47')]:_0x309916[_0x0375('0x54')];if(!_0x1e776d[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x535e1c['limit']=qs[_0x0375('0x21')](_0x1e776d[_0x0375('0x41')]['limit']);_0x535e1c[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x1e776d[_0x0375('0x41')]['offset']);}_0x535e1c[_0x0375('0xce')]=qs['sort'](_0x1e776d['query'][_0x0375('0xcf')]);_0x535e1c['where']=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x1e776d[_0x0375('0x41')],_0x309916[_0x0375('0x56')]));_0x535e1c[_0x0375('0x40')][_0x0375('0xe0')]=_0x439926['id'];if(_0x1e776d[_0x0375('0x41')][_0x0375('0x2d')]){_0x535e1c[_0x0375('0x40')]=_['merge'](_0x535e1c[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x535e1c['attributes'],function(_0x5cdedf){var _0x180a45={};_0x180a45[_0x5cdedf]={'$like':'%'+_0x1e776d[_0x0375('0x41')]['filter']+'%'};return _0x180a45;})});}_0x535e1c=_[_0x0375('0xd1')]({},_0x535e1c,_0x1e776d[_0x0375('0x59')]);return db[_0x0375('0xdf')][_0x0375('0x22')]({'where':_0x535e1c[_0x0375('0x40')]})['then'](function(_0x1717df){_0x210306[_0x0375('0x22')]=_0x1717df;if(_0x1e776d[_0x0375('0x41')][_0x0375('0x42')]){_0x535e1c[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xdf')]['findAll'](_0x535e1c);})[_0x0375('0x26')](function(_0x11099e){_0x210306['rows']=_0x11099e;return _0x210306;});}})[_0x0375('0x26')](respondWithFilteredResult(_0x34c494,_0x535e1c))[_0x0375('0x1b')](handleError(_0x34c494,null));};exports[_0x0375('0xe1')]=function(_0x4d9383,_0x490cf1){var _0x30a845={'raw':!![],'where':{}};var _0x40acf7={};var _0x5bdf55={'count':0x0,'rows':[]};return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x4d9383[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x490cf1,null))[_0x0375('0x26')](function(_0x4a2c1f){if(_0x4a2c1f){_0x40acf7[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe2')]['rawAttributes']);_0x40acf7[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x4d9383[_0x0375('0x41')]);_0x40acf7[_0x0375('0x56')]=_[_0x0375('0x57')](_0x40acf7['model'],_0x40acf7[_0x0375('0x41')]);_0x30a845[_0x0375('0x47')]=_[_0x0375('0x57')](_0x40acf7['model'],qs[_0x0375('0x58')](_0x4d9383['query']['fields']));_0x30a845[_0x0375('0x47')]=_0x30a845[_0x0375('0x47')][_0x0375('0x4c')]?_0x30a845['attributes']:_0x40acf7[_0x0375('0x54')];if(!_0x4d9383[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x30a845[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x4d9383[_0x0375('0x41')][_0x0375('0x21')]);_0x30a845['offset']=qs[_0x0375('0x1f')](_0x4d9383[_0x0375('0x41')]['offset']);}_0x30a845[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x4d9383[_0x0375('0x41')]['sort']);_0x30a845[_0x0375('0x40')]=qs[_0x0375('0x56')](_['pick'](_0x4d9383[_0x0375('0x41')],_0x40acf7['filters']));_0x30a845[_0x0375('0x40')]['UserId']=_0x4a2c1f['id'];if(_0x4d9383[_0x0375('0x41')]['filter']){_0x30a845[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x30a845['where'],{'$or':_[_0x0375('0x2f')](_0x30a845['attributes'],function(_0x4d1cd6){var _0xa2f919={};_0xa2f919[_0x4d1cd6]={'$like':'%'+_0x4d9383['query']['filter']+'%'};return _0xa2f919;})});}_0x30a845=_[_0x0375('0xd1')]({},_0x30a845,_0x4d9383[_0x0375('0x59')]);return db[_0x0375('0xe2')][_0x0375('0x22')]({'where':_0x30a845[_0x0375('0x40')]})['then'](function(_0x5801a7){_0x5bdf55[_0x0375('0x22')]=_0x5801a7;if(_0x4d9383['query'][_0x0375('0x42')]){_0x30a845[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xe2')][_0x0375('0x49')](_0x30a845);})['then'](function(_0x274727){_0x5bdf55[_0x0375('0x4b')]=_0x274727;return _0x5bdf55;});}})['then'](respondWithFilteredResult(_0x490cf1,_0x30a845))[_0x0375('0x1b')](handleError(_0x490cf1,null));};exports[_0x0375('0xe3')]=function(_0x718a49,_0x55bcf6){var _0x36d200={};var _0x552d32={};var _0x12ddf6;var _0x2f036e;return db['User'][_0x0375('0x99')]({'where':{'id':_0x718a49[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x55bcf6,null))[_0x0375('0x26')](function(_0x872d9){if(_0x872d9){_0x12ddf6=_0x872d9;_0x552d32[_0x0375('0x54')]=_['keys'](db[_0x0375('0xe4')][_0x0375('0x3a')]);_0x552d32[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x718a49[_0x0375('0x41')]);_0x552d32['filters']=_[_0x0375('0x57')](_0x552d32[_0x0375('0x54')],_0x552d32[_0x0375('0x41')]);_0x36d200[_0x0375('0x47')]=_['intersection'](_0x552d32[_0x0375('0x54')],qs[_0x0375('0x58')](_0x718a49[_0x0375('0x41')][_0x0375('0x58')]));_0x36d200['attributes']=_0x36d200['attributes'][_0x0375('0x4c')]?_0x36d200['attributes']:_0x552d32[_0x0375('0x54')];_0x36d200['order']=qs[_0x0375('0xcf')](_0x718a49[_0x0375('0x41')][_0x0375('0xcf')]);_0x36d200[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x718a49[_0x0375('0x41')],_0x552d32[_0x0375('0x56')]));if(_0x718a49[_0x0375('0x41')][_0x0375('0x2d')]){_0x36d200[_0x0375('0x40')]=_['merge'](_0x36d200[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x36d200[_0x0375('0x47')],function(_0x22b8ee){var _0xa0d89d={};_0xa0d89d[_0x22b8ee]={'$like':'%'+_0x718a49['query']['filter']+'%'};return _0xa0d89d;})});}_0x36d200=_['merge']({},_0x36d200,_0x718a49[_0x0375('0x59')]);return _0x12ddf6['getChatInteractions'](_0x36d200);}})[_0x0375('0x26')](function(_0x2b8180){if(_0x2b8180){_0x2f036e=_0x2b8180[_0x0375('0x4c')];if(!_0x718a49[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x36d200[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x718a49[_0x0375('0x41')][_0x0375('0x21')]);_0x36d200['offset']=qs[_0x0375('0x1f')](_0x718a49[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x12ddf6[_0x0375('0xe3')](_0x36d200);}})[_0x0375('0x26')](function(_0x17db3d){if(_0x17db3d){return _0x17db3d?{'count':_0x2f036e,'rows':_0x17db3d}:null;}})[_0x0375('0x26')](respondWithResult(_0x55bcf6,null))[_0x0375('0x1b')](handleError(_0x55bcf6,null));};exports[_0x0375('0xe5')]=function(_0x4a640e,_0x158b51){var _0x3e72c6={};var _0x38a66a={};var _0x4d1e9a;var _0x4b9710;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x4a640e[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x158b51,null))[_0x0375('0x26')](function(_0x3b7196){if(_0x3b7196){_0x4d1e9a=_0x3b7196;_0x38a66a[_0x0375('0x54')]=_[_0x0375('0xcd')](db['OpenchannelInteraction']['rawAttributes']);_0x38a66a[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x4a640e[_0x0375('0x41')]);_0x38a66a[_0x0375('0x56')]=_['intersection'](_0x38a66a[_0x0375('0x54')],_0x38a66a['query']);_0x3e72c6['attributes']=_[_0x0375('0x57')](_0x38a66a[_0x0375('0x54')],qs[_0x0375('0x58')](_0x4a640e[_0x0375('0x41')]['fields']));_0x3e72c6[_0x0375('0x47')]=_0x3e72c6[_0x0375('0x47')][_0x0375('0x4c')]?_0x3e72c6[_0x0375('0x47')]:_0x38a66a[_0x0375('0x54')];_0x3e72c6[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x4a640e[_0x0375('0x41')]['sort']);_0x3e72c6[_0x0375('0x40')]=qs[_0x0375('0x56')](_['pick'](_0x4a640e[_0x0375('0x41')],_0x38a66a[_0x0375('0x56')]));if(_0x4a640e[_0x0375('0x41')][_0x0375('0x2d')]){_0x3e72c6['where']=_[_0x0375('0xd1')](_0x3e72c6[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x3e72c6['attributes'],function(_0x3cfda7){var _0x4dbf88={};_0x4dbf88[_0x3cfda7]={'$like':'%'+_0x4a640e[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x4dbf88;})});}_0x3e72c6=_[_0x0375('0xd1')]({},_0x3e72c6,_0x4a640e[_0x0375('0x59')]);return _0x4d1e9a[_0x0375('0xe5')](_0x3e72c6);}})[_0x0375('0x26')](function(_0x577863){if(_0x577863){_0x4b9710=_0x577863[_0x0375('0x4c')];if(!_0x4a640e['query']['hasOwnProperty']('nolimit')){_0x3e72c6[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x4a640e[_0x0375('0x41')][_0x0375('0x21')]);_0x3e72c6[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x4a640e['query'][_0x0375('0x1f')]);}return _0x4d1e9a['getOpenchannelInteractions'](_0x3e72c6);}})[_0x0375('0x26')](function(_0x4f11eb){if(_0x4f11eb){return _0x4f11eb?{'count':_0x4b9710,'rows':_0x4f11eb}:null;}})['then'](respondWithResult(_0x158b51,null))[_0x0375('0x1b')](handleError(_0x158b51,null));};exports['getMailInteractions']=function(_0x240de0,_0x1db51f){var _0x58382a={'raw':!![],'where':{}};var _0x3355b3={};var _0x2e6e2e={'count':0x0,'rows':[]};return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x240de0[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x1db51f,null))[_0x0375('0x26')](function(_0x4cb60a){if(_0x4cb60a){_0x3355b3[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe6')]['rawAttributes']);_0x3355b3[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x240de0[_0x0375('0x41')]);_0x3355b3[_0x0375('0x56')]=_[_0x0375('0x57')](_0x3355b3[_0x0375('0x54')],_0x3355b3[_0x0375('0x41')]);_0x58382a['attributes']=_[_0x0375('0x57')](_0x3355b3[_0x0375('0x54')],qs[_0x0375('0x58')](_0x240de0[_0x0375('0x41')][_0x0375('0x58')]));_0x58382a[_0x0375('0x47')]=_0x58382a[_0x0375('0x47')][_0x0375('0x4c')]?_0x58382a[_0x0375('0x47')]:_0x3355b3[_0x0375('0x54')];if(!_0x240de0[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x58382a['limit']=qs[_0x0375('0x21')](_0x240de0['query'][_0x0375('0x21')]);_0x58382a[_0x0375('0x1f')]=qs['offset'](_0x240de0[_0x0375('0x41')]['offset']);}_0x58382a[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x240de0[_0x0375('0x41')][_0x0375('0xcf')]);_0x58382a[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x240de0[_0x0375('0x41')],_0x3355b3[_0x0375('0x56')]));_0x58382a[_0x0375('0x40')][_0x0375('0xe0')]=_0x4cb60a['id'];if(_0x240de0['query'][_0x0375('0x2d')]){_0x58382a['where']=_[_0x0375('0xd1')](_0x58382a[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x58382a[_0x0375('0x47')],function(_0x15c6bc){var _0x225e34={};_0x225e34[_0x15c6bc]={'$like':'%'+_0x240de0[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x225e34;})});}_0x58382a=_[_0x0375('0xd1')]({},_0x58382a,_0x240de0['options']);return db[_0x0375('0xe6')][_0x0375('0x22')]({'where':_0x58382a['where']})[_0x0375('0x26')](function(_0x1e20d3){_0x2e6e2e[_0x0375('0x22')]=_0x1e20d3;if(_0x240de0['query'][_0x0375('0x42')]){_0x58382a[_0x0375('0x43')]=[{'all':!![]}];}return db[_0x0375('0xe6')]['findAll'](_0x58382a);})['then'](function(_0x3d1d2f){_0x2e6e2e['rows']=_0x3d1d2f;return _0x2e6e2e;});}})[_0x0375('0x26')](respondWithFilteredResult(_0x1db51f,_0x58382a))[_0x0375('0x1b')](handleError(_0x1db51f,null));};exports[_0x0375('0xe7')]=function(_0x2dd80a,_0x13aa74){var _0x1edc0b={};var _0x4fedad={};var _0x49a90d;var _0x57d38f;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x2dd80a[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x13aa74,null))[_0x0375('0x26')](function(_0x5f517f){if(_0x5f517f){_0x49a90d=_0x5f517f;_0x4fedad[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xe8')][_0x0375('0x3a')]);_0x4fedad[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x2dd80a['query']);_0x4fedad[_0x0375('0x56')]=_['intersection'](_0x4fedad[_0x0375('0x54')],_0x4fedad[_0x0375('0x41')]);_0x1edc0b[_0x0375('0x47')]=_[_0x0375('0x57')](_0x4fedad[_0x0375('0x54')],qs[_0x0375('0x58')](_0x2dd80a[_0x0375('0x41')][_0x0375('0x58')]));_0x1edc0b[_0x0375('0x47')]=_0x1edc0b[_0x0375('0x47')][_0x0375('0x4c')]?_0x1edc0b['attributes']:_0x4fedad['model'];_0x1edc0b['order']=qs['sort'](_0x2dd80a[_0x0375('0x41')][_0x0375('0xcf')]);_0x1edc0b[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x2dd80a[_0x0375('0x41')],_0x4fedad[_0x0375('0x56')]));if(_0x2dd80a[_0x0375('0x41')]['filter']){_0x1edc0b[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x1edc0b[_0x0375('0x40')],{'$or':_['map'](_0x1edc0b['attributes'],function(_0x5b21be){var _0x364629={};_0x364629[_0x5b21be]={'$like':'%'+_0x2dd80a['query']['filter']+'%'};return _0x364629;})});}_0x1edc0b=_['merge']({},_0x1edc0b,_0x2dd80a[_0x0375('0x59')]);return _0x49a90d[_0x0375('0xe7')](_0x1edc0b);}})['then'](function(_0x5c12ba){if(_0x5c12ba){_0x57d38f=_0x5c12ba[_0x0375('0x4c')];if(!_0x2dd80a[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x1edc0b[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x2dd80a[_0x0375('0x41')]['limit']);_0x1edc0b[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x2dd80a[_0x0375('0x41')]['offset']);}return _0x49a90d[_0x0375('0xe7')](_0x1edc0b);}})[_0x0375('0x26')](function(_0x58a4b8){if(_0x58a4b8){return _0x58a4b8?{'count':_0x57d38f,'rows':_0x58a4b8}:null;}})[_0x0375('0x26')](respondWithResult(_0x13aa74,null))[_0x0375('0x1b')](handleError(_0x13aa74,null));};exports[_0x0375('0xe9')]=function(_0x13f410,_0x15c7ae){var _0x12e59f={};var _0x594624={};var _0x4c0f6c;var _0x55fbbd;return db['User']['findOne']({'where':{'id':_0x13f410[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x15c7ae,null))[_0x0375('0x26')](function(_0x2197d5){if(_0x2197d5){_0x4c0f6c=_0x2197d5;_0x594624['model']=_[_0x0375('0xcd')](db[_0x0375('0xea')][_0x0375('0x3a')]);_0x594624['query']=_[_0x0375('0xcd')](_0x13f410[_0x0375('0x41')]);_0x594624['filters']=_[_0x0375('0x57')](_0x594624[_0x0375('0x54')],_0x594624['query']);_0x12e59f[_0x0375('0x47')]=_['intersection'](_0x594624[_0x0375('0x54')],qs[_0x0375('0x58')](_0x13f410[_0x0375('0x41')]['fields']));_0x12e59f[_0x0375('0x47')]=_0x12e59f[_0x0375('0x47')]['length']?_0x12e59f[_0x0375('0x47')]:_0x594624['model'];_0x12e59f[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x13f410[_0x0375('0x41')][_0x0375('0xcf')]);_0x12e59f[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x13f410[_0x0375('0x41')],_0x594624[_0x0375('0x56')]));if(_0x13f410[_0x0375('0x41')][_0x0375('0x2d')]){_0x12e59f[_0x0375('0x40')]=_['merge'](_0x12e59f['where'],{'$or':_[_0x0375('0x2f')](_0x12e59f[_0x0375('0x47')],function(_0x2a56ab){var _0x52c07c={};_0x52c07c[_0x2a56ab]={'$like':'%'+_0x13f410[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x52c07c;})});}_0x12e59f=_[_0x0375('0xd1')]({},_0x12e59f,_0x13f410[_0x0375('0x59')]);return _0x4c0f6c[_0x0375('0xe9')](_0x12e59f);}})[_0x0375('0x26')](function(_0x31bac8){if(_0x31bac8){_0x55fbbd=_0x31bac8['length'];if(!_0x13f410[_0x0375('0x41')][_0x0375('0xd2')](_0x0375('0xd8'))){_0x12e59f[_0x0375('0x21')]=qs['limit'](_0x13f410[_0x0375('0x41')]['limit']);_0x12e59f[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x13f410[_0x0375('0x41')]['offset']);}return _0x4c0f6c['getFaxInteractions'](_0x12e59f);}})[_0x0375('0x26')](function(_0x1b55d0){if(_0x1b55d0){return _0x1b55d0?{'count':_0x55fbbd,'rows':_0x1b55d0}:null;}})[_0x0375('0x26')](respondWithResult(_0x15c7ae,null))['catch'](handleError(_0x15c7ae,null));};exports[_0x0375('0xeb')]=function(_0x345d59,_0x55efbc){var _0x359ae8={};var _0x3ea733={};var _0x122ff8;var _0x5e6b4d;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x345d59[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x55efbc,null))[_0x0375('0x26')](function(_0x3637c8){if(_0x3637c8){_0x122ff8=_0x3637c8;_0x3ea733[_0x0375('0x54')]=_['keys'](db[_0x0375('0xec')][_0x0375('0x3a')]);_0x3ea733['query']=_['keys'](_0x345d59['query']);_0x3ea733['filters']=_[_0x0375('0x57')](_0x3ea733[_0x0375('0x54')],_0x3ea733['query']);_0x359ae8[_0x0375('0x47')]=_[_0x0375('0x57')](_0x3ea733[_0x0375('0x54')],qs[_0x0375('0x58')](_0x345d59[_0x0375('0x41')][_0x0375('0x58')]));_0x359ae8[_0x0375('0x47')]=_0x359ae8[_0x0375('0x47')][_0x0375('0x4c')]?_0x359ae8[_0x0375('0x47')]:_0x3ea733[_0x0375('0x54')];_0x359ae8[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x345d59[_0x0375('0x41')][_0x0375('0xcf')]);_0x359ae8[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x345d59[_0x0375('0x41')],_0x3ea733[_0x0375('0x56')]));if(_0x345d59[_0x0375('0x41')][_0x0375('0x2d')]){_0x359ae8[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x359ae8[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x359ae8['attributes'],function(_0xb550d5){var _0x49e9b9={};_0x49e9b9[_0xb550d5]={'$like':'%'+_0x345d59[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x49e9b9;})});}_0x359ae8=_[_0x0375('0xd1')]({},_0x359ae8,_0x345d59[_0x0375('0x59')]);return _0x122ff8[_0x0375('0xeb')](_0x359ae8);}})[_0x0375('0x26')](function(_0x406cf5){if(_0x406cf5){_0x5e6b4d=_0x406cf5[_0x0375('0x4c')];if(!_0x345d59['query'][_0x0375('0xd2')]('nolimit')){_0x359ae8[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x345d59['query']['limit']);_0x359ae8[_0x0375('0x1f')]=qs[_0x0375('0x1f')](_0x345d59['query'][_0x0375('0x1f')]);}return _0x122ff8['getWhatsappInteractions'](_0x359ae8);}})[_0x0375('0x26')](function(_0xa5720f){if(_0xa5720f){return _0xa5720f?{'count':_0x5e6b4d,'rows':_0xa5720f}:null;}})[_0x0375('0x26')](respondWithResult(_0x55efbc,null))[_0x0375('0x1b')](handleError(_0x55efbc,null));};exports[_0x0375('0xed')]=function(_0xa5a731,_0x1a9299,_0x981312){var _0x3ab3f7;var _0x53e4a7;var _0x365c85;var _0x18eefa=!_['isNil'](_0xa5a731['params']['id'])?_0xa5a731[_0x0375('0x5e')]['id']:!_['isNil'](_0xa5a731[_0x0375('0x7e')]['id'])?_0xa5a731[_0x0375('0x7e')]['id']:null;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x18eefa,'role':{'$or':[_0x0375('0x29'),_0x0375('0x7e'),_0x0375('0x71')]}},'attributes':['id',_0x0375('0x36'),_0x0375('0xee'),'mobile',_0x0375('0x28'),_0x0375('0x61'),_0x0375('0xa0')]})[_0x0375('0x26')](function(_0x4878d7){if(_0x4878d7){if(_0x4878d7['role']===_0x0375('0x71')){_0x3ab3f7=_0x4878d7;if(_0xa5a731[_0x0375('0x5b')]['interface']){_0x365c85=util['format'](_0x0375('0xef'),_0x3ab3f7[_0xa5a731[_0x0375('0x5b')]['interface']]);}else if(_0xa5a731[_0x0375('0x5b')]['intrf']){_0x365c85=util[_0x0375('0xae')]('SIP/%s',_0xa5a731[_0x0375('0x5b')][_0x0375('0xf0')]);}else{_0x365c85=util[_0x0375('0xae')](_0x0375('0xaf'),_0x3ab3f7[_0x0375('0x36')]);}socket['to'](util[_0x0375('0xae')](_0x0375('0xf1'),_0x3ab3f7[_0x0375('0x36')]))[_0x0375('0xab')](_0x0375('0xf2'),{'user':{'id':_0x3ab3f7['id'],'name':_0x3ab3f7[_0x0375('0x36')]},'ip':_0xa5a731[_0x0375('0xf3')][_0x0375('0xf4')]||_0xa5a731[_0x0375('0xf5')][_0x0375('0xf6')]||_0xa5a731[_0x0375('0xf7')][_0x0375('0xf6')]||_0xa5a731[_0x0375('0xf5')][_0x0375('0xf7')][_0x0375('0xf6')]});return db[_0x0375('0xb0')][_0x0375('0x25')]({'where':{'membername':_0x3ab3f7[_0x0375('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x0375('0x92'))][(_0x0375('0x93'))](_0x0375('0xf8'));}})['then'](function(){if(_0x3ab3f7){return _0x3ab3f7[_0x0375('0xf9')]({'raw':!![]});}})['then'](function(_0x3c0f0c){if(_0x3ab3f7){var _0x30c50e=[];if(_0x3c0f0c){_0x53e4a7=_0x3c0f0c;if(_0x53e4a7['length']){for(var _0x27aaf9=0x0;_0x27aaf9<_0x53e4a7[_0x0375('0x4c')];_0x27aaf9++){_0x30c50e[_0x0375('0x48')]({'membername':_0x3ab3f7[_0x0375('0x36')],'UserId':_0x3ab3f7['id'],'queue_name':_0x53e4a7[_0x27aaf9]['name'],'VoiceQueueId':_0x53e4a7[_0x27aaf9]['id'],'interface':_0x365c85,'paused':_0x3ab3f7[_0x0375('0xa0')]||![],'penalty':_0x53e4a7[_0x27aaf9][_0x0375('0xfa')]||0x0});}return BPromise['each'](_0x30c50e,function(_0x2adfd5){return db['UserVoiceQueueRt']['upsert'](_0x2adfd5);});}}}})[_0x0375('0x26')](function(){if(_0x3ab3f7){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x3ab3f7[_0x0375('0x36')],'exitAt':null}});}})[_0x0375('0x26')](function(_0x585eaa){if(_0x3ab3f7){var _0x5f004c=[];_0x585eaa['forEach'](function(_0x13e90){_0x5f004c[_0x0375('0x48')](_0x13e90[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))}));});return BPromise[_0x0375('0x52')](_0x5f004c);}})[_0x0375('0x26')](function(){if(_0x3ab3f7){var _0x344459=[];var _0x18bd2d=[];var _0x39e668=utils[_0x0375('0xfd')]();var _0x267549={'membername':_0x3ab3f7[_0x0375('0x36')],'interface':_0x365c85,'enterAt':moment()[_0x0375('0xae')](_0x0375('0xfc')),'role':_0x3ab3f7['role'],'internal':_0x3ab3f7[_0x0375('0x61')]};_0x39e668[_0x0375('0xfe')](function(_0x2ac9ee){_0x344459['push'](_[_0x0375('0xd1')]({'channel':_0x2ac9ee,'type':_0x0375('0xff'),'data1':_0xa5a731[_0x0375('0x5b')]['device'],'data2':_0x365c85},_0x267549));if(_0x3ab3f7[_0x0375('0xa0')]){_0x18bd2d[_0x0375('0x48')](_[_0x0375('0xd1')]({'channel':_0x2ac9ee,'type':_0x0375('0x100'),'data1':_0x0375('0x101')},_0x267549));}});return db['MemberReport'][_0x0375('0x87')](_0x344459['concat'](_0x18bd2d),{'individualHooks':!![]});}})[_0x0375('0x26')](function(){if(_0x3ab3f7){return _0x3ab3f7[_0x0375('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x0375('0xfc')),'voicePause':_0x3ab3f7[_0x0375('0xa0')]||![],'mailPause':_0x3ab3f7[_0x0375('0xa0')]||![],'chatPause':_0x3ab3f7[_0x0375('0xa0')]||![],'faxPause':_0x3ab3f7[_0x0375('0xa0')]||![],'smsPause':_0x3ab3f7[_0x0375('0xa0')]||![],'openchannelPause':_0x3ab3f7[_0x0375('0xa0')]||![],'whatsappPause':_0x3ab3f7[_0x0375('0xa0')]||![],'pauseType':_0x3ab3f7[_0x0375('0xa0')]?_0x0375('0x101'):null,'interface':_0x365c85,'lastPauseAt':moment()[_0x0375('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x0375('0x26')](function(_0x5ae1a4){if(_0xa5a731[_0x0375('0x102')]){return _0x981312();}else{return BPromise[_0x0375('0x103')](_0x5ae1a4)['then'](respondWithResult(_0x1a9299,null));}})[_0x0375('0x1b')](handleError(_0x1a9299,null));};exports[_0x0375('0x104')]=function(_0x4a8e00,_0x150e9e){var _0x453afc;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x4a8e00[_0x0375('0x5e')]['id'],'role':_0x0375('0x71')},'attributes':['id',_0x0375('0x36'),_0x0375('0x28')]})[_0x0375('0x26')](handleEntityNotFound(_0x150e9e,null))['then'](function(_0x221d72){if(_0x221d72){_0x453afc=_0x221d72;return db['UserVoiceQueueRt'][_0x0375('0x25')]({'where':{'membername':_0x453afc['name']},'individualHooks':!![]});}})[_0x0375('0x26')](function(){return db['MemberReport'][_0x0375('0x49')]({'where':{'membername':_0x453afc[_0x0375('0x36')],'exitAt':null}});})[_0x0375('0x26')](function(_0x49b082){var _0x15d6fe=[];_0x49b082[_0x0375('0xfe')](function(_0x110f1c){_0x15d6fe['push'](_0x110f1c[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))}));});return BPromise[_0x0375('0x52')](_0x15d6fe);})[_0x0375('0x26')](function(){return _0x453afc[_0x0375('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0375('0x26')](respondWithResult(_0x150e9e,null))[_0x0375('0x1b')](handleError(_0x150e9e,null));};exports[_0x0375('0x105')]=function(_0x4f8a76,_0xb62755){var _0x1c5816;return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x1},{'where':{'UserId':_0x4f8a76[_0x0375('0x5e')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x4f8a76[_0x0375('0x5e')]['id'],'role':_0x0375('0x71')},'attributes':['id',_0x0375('0x36'),'role',_0x0375('0x61'),_0x0375('0xa2')]});})[_0x0375('0x26')](handleEntityNotFound(_0xb62755,null))['then'](function(_0x24dd39){if(_0x24dd39){_0x1c5816=_0x24dd39;return respondWithRpcPromise(_0x0375('0x106'),_0x0375('0x105'),{'id':_0x1c5816['id'],'name':_0x1c5816[_0x0375('0x36')],'pause':!![]});}})[_0x0375('0x26')](function(){if(_0x1c5816){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x1c5816[_0x0375('0x36')],'type':'PAUSE','exitAt':null}});}})[_0x0375('0x26')](function(_0x30bb75){if(_0x30bb75[_0x0375('0x4c')]){var _0x220ea6=moment()['format'](_0x0375('0xfc'));for(var _0x290479=0x0,_0x5d33c4=_0x30bb75[_0x0375('0x4c')];_0x290479<_0x5d33c4;_0x290479++){_0x30bb75[_0x290479][_0x0375('0x107')]({'exitAt':_0x220ea6});}}})[_0x0375('0x26')](function(){var _0x460333=[];var _0x15b1b5=utils[_0x0375('0xfd')]();_0x15b1b5[_0x0375('0xfe')](function(_0x3dc632){_0x460333[_0x0375('0x48')]({'channel':_0x3dc632,'membername':_0x1c5816[_0x0375('0x36')],'interface':_[_0x0375('0x67')](_0x1c5816[_0x0375('0xa2')])?util[_0x0375('0xae')]('SIP/%s',_0x1c5816[_0x0375('0x36')]):_0x1c5816[_0x0375('0xa2')],'type':_0x0375('0x100'),'enterAt':moment()['format'](_0x0375('0xfc')),'data1':_0x4f8a76[_0x0375('0x5b')][_0x0375('0x3c')]||_0x0375('0x108'),'role':_0x1c5816[_0x0375('0x28')],'internal':_0x1c5816[_0x0375('0x61')]});});return db[_0x0375('0xfb')][_0x0375('0x87')](_0x460333,{'individualHooks':!![]});})[_0x0375('0x26')](function(){return _0x1c5816[_0x0375('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4f8a76[_0x0375('0x5b')]['type']||_0x0375('0x108'),'lastPauseAt':moment()[_0x0375('0xae')](_0x0375('0xfc'))});})['then'](respondWithResult(_0xb62755,null))[_0x0375('0x1b')](handleError(_0xb62755,null));};exports[_0x0375('0x109')]=function(_0x12efac,_0x52c91b){var _0x1beebc;return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x12efac[_0x0375('0x5e')]['id']},'attributes':['id',_0x0375('0x36'),_0x0375('0x28'),'voicePause','mailPause',_0x0375('0x10a'),_0x0375('0x10b'),_0x0375('0x10c'),_0x0375('0x10d'),_0x0375('0x10e'),_0x0375('0x10f'),_0x0375('0x110')]})[_0x0375('0x26')](handleEntityNotFound(_0x52c91b,null))[_0x0375('0x26')](function(_0x4b50bd){if(_0x4b50bd){_0x1beebc=_0x4b50bd;if(_0x12efac[_0x0375('0x5b')]['channel']&&!utils['isValidChannel'](_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')])){throw new db['Sequelize'][(_0x0375('0x93'))]('Unknown\x20channel');}switch(_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')]){case _0x0375('0xac'):return respondWithRpcPromise(_0x0375('0x106'),'unpause',{'id':_0x1beebc['id'],'name':_0x1beebc['name'],'pause':![]})[_0x0375('0x26')](function(){return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x0},{'where':{'UserId':_0x1beebc['id']},'individualHooks':!![]});})[_0x0375('0x26')](function(){return db[_0x0375('0xfb')][_0x0375('0x32')]({'where':{'channel':_0x12efac['body'][_0x0375('0x9f')],'membername':_0x1beebc['name'],'type':_0x0375('0x100'),'exitAt':null}});})[_0x0375('0x26')](function(_0x338824){if(_0x338824){return _0x338824[_0x0375('0x24')]({'exitAt':moment()[_0x0375('0xae')](_0x0375('0xfc')),'data2':_0x0375('0x111')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x1beebc[_0x0375('0x24')]({'voicePause':![]});});case _0x0375('0x4f'):case'chat':case _0x0375('0xbf'):case _0x0375('0x5a'):case'whatsapp':case _0x0375('0x50'):return db[_0x0375('0xfb')][_0x0375('0x32')]({'where':{'channel':_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')],'membername':_0x1beebc[_0x0375('0x36')],'type':_0x0375('0x100'),'exitAt':null}})[_0x0375('0x26')](function(_0x19007f){if(_0x19007f){return _0x19007f[_0x0375('0x24')]({'exitAt':moment()['format'](_0x0375('0xfc')),'data2':_0x0375('0x111')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x34408c={};_[_0x0375('0x23')](_0x34408c,util[_0x0375('0xae')]('%s%s',_0x12efac[_0x0375('0x5b')][_0x0375('0x9f')],_0x0375('0x112')),![]);return _0x1beebc['update'](_0x34408c);});default:return respondWithRpcPromise('QueuePause',_0x0375('0x109'),{'id':_0x1beebc['id'],'name':_0x1beebc[_0x0375('0x36')],'pause':![]})[_0x0375('0x26')](function(){return db[_0x0375('0xb0')][_0x0375('0x24')]({'paused':0x0},{'where':{'UserId':_0x1beebc['id']}});})['then'](function(){return db[_0x0375('0xfb')][_0x0375('0x49')]({'where':{'membername':_0x1beebc[_0x0375('0x36')],'type':_0x0375('0x100'),'exitAt':null}});})[_0x0375('0x26')](function(_0x183443){var _0x4c8d97=[];_0x183443[_0x0375('0xfe')](function(_0x5ed642){_0x4c8d97['push'](_0x5ed642['update']({'exitAt':moment()['format'](_0x0375('0xfc')),'data2':_0x0375('0x111')}));});return BPromise[_0x0375('0x52')](_0x4c8d97);})[_0x0375('0x26')](function(){return _0x1beebc['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0375('0x26')](respondWithResult(_0x52c91b,null))[_0x0375('0x1b')](handleError(_0x52c91b,null));};exports[_0x0375('0x113')]=function(_0xd88290,_0x4e1473){var _0x82bb53={};var _0x305f48={};var _0x2b15aa;var _0x4b6099;return db['User'][_0x0375('0x99')]({'where':{'id':_0xd88290[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x4e1473,null))['then'](function(_0x3898e2){if(_0x3898e2){_0x2b15aa=_0x3898e2;_0x305f48[_0x0375('0x54')]=_[_0x0375('0xcd')](db['Team'][_0x0375('0x3a')]);_0x305f48[_0x0375('0x41')]=_[_0x0375('0xcd')](_0xd88290[_0x0375('0x41')]);_0x305f48[_0x0375('0x56')]=_[_0x0375('0x57')](_0x305f48['model'],_0x305f48[_0x0375('0x41')]);_0x82bb53[_0x0375('0x47')]=_[_0x0375('0x57')](_0x305f48[_0x0375('0x54')],qs[_0x0375('0x58')](_0xd88290[_0x0375('0x41')]['fields']));_0x82bb53['attributes']=_0x82bb53[_0x0375('0x47')]['length']?_0x82bb53[_0x0375('0x47')]:_0x305f48[_0x0375('0x54')];_0x82bb53[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0xd88290[_0x0375('0x41')][_0x0375('0xcf')]);_0x82bb53[_0x0375('0x40')]=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0xd88290[_0x0375('0x41')],_0x305f48['filters']));if(_0xd88290[_0x0375('0x41')]['filter']){_0x82bb53[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x82bb53[_0x0375('0x40')],{'$or':_[_0x0375('0x2f')](_0x82bb53[_0x0375('0x47')],function(_0x3bd35b){var _0x84ff3f={};_0x84ff3f[_0x3bd35b]={'$like':'%'+_0xd88290[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x84ff3f;})});}_0x82bb53=_[_0x0375('0xd1')]({},_0x82bb53,_0xd88290[_0x0375('0x59')]);return _0x2b15aa[_0x0375('0x113')](_0x82bb53);}})['then'](function(_0xf0649e){if(_0xf0649e){_0x4b6099=_0xf0649e[_0x0375('0x4c')];if(!_0xd88290[_0x0375('0x41')]['hasOwnProperty'](_0x0375('0xd8'))){_0x82bb53['limit']=qs[_0x0375('0x21')](_0xd88290[_0x0375('0x41')][_0x0375('0x21')]);_0x82bb53['offset']=qs[_0x0375('0x1f')](_0xd88290[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x2b15aa['getTeams'](_0x82bb53);}})[_0x0375('0x26')](function(_0x28e978){if(_0x28e978){return _0x28e978?{'count':_0x4b6099,'rows':_0x28e978}:null;}})['then'](respondWithResult(_0x4e1473,null))[_0x0375('0x1b')](handleError(_0x4e1473,null));};exports[_0x0375('0x114')]=function(_0x20eb94,_0x5f09d0){return db[_0x0375('0x39')][_0x0375('0x32')]({'where':{'id':_0x20eb94[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x5f09d0,null))[_0x0375('0x26')](function(_0x4efa19){if(_0x4efa19){var _0x2f4190=_0x4efa19[_0x0375('0x27')]({'plain':!![]});return _0x4efa19[_0x0375('0x114')](_0x20eb94[_0x0375('0x5b')]['ids'],_[_0x0375('0x60')](_0x20eb94[_0x0375('0x5b')],[_0x0375('0x5f'),'id'])||{})[_0x0375('0x26')](function(){for(var _0x3b768d=0x0;_0x3b768d<_0x20eb94[_0x0375('0x5b')][_0x0375('0x5f')]['length'];_0x3b768d++){var _0x5ab980=[];var _0x4333f7={};db[_0x0375('0x115')][_0x0375('0x99')]({'where':{'id':_0x20eb94[_0x0375('0x5b')][_0x0375('0x5f')][_0x3b768d]}})[_0x0375('0x26')](function(_0x44c861){_0x4333f7=_0x44c861[_0x0375('0x4e')];_0x5ab980['push'](_0x44c861[_0x0375('0xf9')]()['then'](function(_0x1b36dd){for(var _0x24cc94=0x0;_0x24cc94<_0x1b36dd[_0x0375('0x4c')];_0x24cc94++){_0x1b36dd[_0x24cc94][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x117'));}return _0x1b36dd;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x118')]()['then'](function(_0x2315b9){for(var _0x4a4d45=0x0;_0x4a4d45<_0x2315b9['length'];_0x4a4d45++){_0x2315b9[_0x4a4d45][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x119'));}return _0x2315b9;}));_0x5ab980['push'](_0x44c861[_0x0375('0x11a')]()[_0x0375('0x26')](function(_0x4afac8){for(var _0x43e7c2=0x0;_0x43e7c2<_0x4afac8['length'];_0x43e7c2++){_0x4afac8[_0x43e7c2][_0x0375('0x116')](_0x0375('0x9f'),'Mail');}return _0x4afac8;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11b')]()[_0x0375('0x26')](function(_0xed100){for(var _0x40600f=0x0;_0x40600f<_0xed100[_0x0375('0x4c')];_0x40600f++){_0xed100[_0x40600f][_0x0375('0x116')](_0x0375('0x9f'),'Sms');}return _0xed100;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11c')]()[_0x0375('0x26')](function(_0x52bbcb){for(var _0x514445=0x0;_0x514445<_0x52bbcb[_0x0375('0x4c')];_0x514445++){_0x52bbcb[_0x514445][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11d'));}return _0x52bbcb;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x11e')]()['then'](function(_0x2f66a5){for(var _0x4c6c6b=0x0;_0x4c6c6b<_0x2f66a5[_0x0375('0x4c')];_0x4c6c6b++){_0x2f66a5[_0x4c6c6b][_0x0375('0x116')]('channel',_0x0375('0x11f'));}return _0x2f66a5;}));_0x5ab980[_0x0375('0x48')](_0x44c861[_0x0375('0x120')]()[_0x0375('0x26')](function(_0x4b48a0){for(var _0xee2a93=0x0;_0xee2a93<_0x4b48a0['length'];_0xee2a93++){_0x4b48a0[_0xee2a93][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x121'));}return _0x4b48a0;}));return BPromise['all'](_0x5ab980);})[_0x0375('0x26')](function(_0x5c12dd){var _0x4127f7=_['flatten'](_0x5c12dd);_0x5ab980=[];return db[_0x0375('0x69')][_0x0375('0x122')](function(_0x1bd0a6){for(var _0x47d5f4=0x0;_0x47d5f4<_0x4127f7['length'];_0x47d5f4++){_0x5ab980[_0x0375('0x48')](_0x4127f7[_0x47d5f4]['addAgent'](_0x2f4190['id']),{'transaction':_0x1bd0a6});}return BPromise[_0x0375('0x52')](_0x5ab980)[_0x0375('0x26')](function(){if(_0x2f4190[_0x0375('0x123')]){return BPromise['each'](_[_0x0375('0x2d')](_0x4127f7,function(_0x27a406){return _0x27a406['getDataValue'](_0x0375('0x9f'))===_0x0375('0x117');}),function(_0x923519){return db[_0x0375('0xb0')][_0x0375('0xb1')]({'membername':_0x2f4190['name'],'UserId':_0x2f4190['id'],'queue_name':_0x923519['name'],'VoiceQueueId':_0x923519['id'],'interface':_['isNil'](_0x2f4190[_0x0375('0xa2')])?util[_0x0375('0xae')]('SIP/%s',_0x2f4190['name']):_0x2f4190['interface'],'paused':_0x2f4190[_0x0375('0xa1')]||![],'penalty':_0x2f4190[_0x0375('0xa8')]},{'transaction':_0x1bd0a6});});}else{return;}})[_0x0375('0x26')](function(){for(var _0x4ad9aa=0x0;_0x4ad9aa<_0x4127f7[_0x0375('0x4c')];_0x4ad9aa++){var _0x293b1d=_0x4127f7[_0x4ad9aa][_0x0375('0x124')](_0x0375('0x9f'));var _0x526c27=_0x293b1d+_0x0375('0xaa');socket[_0x0375('0xab')](_0x0375('0x7e')+_0x293b1d+'Queue:save',{'UserId':_0x2f4190['id'],['queueField']:_0x4127f7[_0x4ad9aa]['id']});}});});})['then'](function(){db[_0x0375('0x125')][_0x0375('0x99')]({'where':{'teamId':_0x4333f7['id']}})[_0x0375('0x26')](function(_0x371bc0){if(_0x371bc0){db['UserVoicePrefix']['create']({'UserId':_0x20eb94['params']['id'],'VoicePrefixId':_0x371bc0[_0x0375('0x126')]});}});});}});}})[_0x0375('0x26')](respondWithStatusCode(_0x5f09d0,null))[_0x0375('0x1b')](handleError(_0x5f09d0,null));};exports[_0x0375('0x127')]=function(_0x4b4ec4,_0x9e6e64){return db['User'][_0x0375('0x99')]({'where':{'id':_0x4b4ec4[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x9e6e64,null))['then'](function(_0x1c35a5){if(_0x1c35a5){var _0x12c882=_0x1c35a5['get']({'plain':!![]});var _0xd14bb8=_0x4b4ec4[_0x0375('0x41')][_0x0375('0x5f')];return _0x1c35a5['removeTeams'](_0xd14bb8)[_0x0375('0x26')](function(){for(var _0x3ed865=0x0;_0x3ed865<_0xd14bb8[_0x0375('0x4c')];_0x3ed865++){var _0x53c0ed=[];var _0x10880d={};db[_0x0375('0x115')][_0x0375('0x99')]({'where':{'id':_0xd14bb8[_0x3ed865]}})[_0x0375('0x26')](function(_0x1a73ff){_0x10880d=_0x1a73ff['dataValues'];_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0xf9')]()[_0x0375('0x26')](function(_0x1777b1){for(var _0x1ac3c2=0x0;_0x1ac3c2<_0x1777b1['length'];_0x1ac3c2++){_0x1777b1[_0x1ac3c2][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x117'));}return _0x1777b1;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x118')]()['then'](function(_0x26601d){for(var _0x35defa=0x0;_0x35defa<_0x26601d[_0x0375('0x4c')];_0x35defa++){_0x26601d[_0x35defa]['setDataValue'](_0x0375('0x9f'),_0x0375('0x119'));}return _0x26601d;}));_0x53c0ed['push'](_0x1a73ff['getMailQueues']()['then'](function(_0x42f90c){for(var _0x4383b0=0x0;_0x4383b0<_0x42f90c['length'];_0x4383b0++){_0x42f90c[_0x4383b0][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x128'));}return _0x42f90c;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11b')]()[_0x0375('0x26')](function(_0x11f03b){for(var _0x3d9309=0x0;_0x3d9309<_0x11f03b[_0x0375('0x4c')];_0x3d9309++){_0x11f03b[_0x3d9309][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x129'));}return _0x11f03b;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11c')]()['then'](function(_0x1e5640){for(var _0x257069=0x0;_0x257069<_0x1e5640['length'];_0x257069++){_0x1e5640[_0x257069][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11d'));}return _0x1e5640;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff[_0x0375('0x11e')]()['then'](function(_0xb650ff){for(var _0x44d39f=0x0;_0x44d39f<_0xb650ff[_0x0375('0x4c')];_0x44d39f++){_0xb650ff[_0x44d39f][_0x0375('0x116')](_0x0375('0x9f'),_0x0375('0x11f'));}return _0xb650ff;}));_0x53c0ed[_0x0375('0x48')](_0x1a73ff['getOpenchannelQueues']()[_0x0375('0x26')](function(_0x3ae15d){for(var _0x598c38=0x0;_0x598c38<_0x3ae15d[_0x0375('0x4c')];_0x598c38++){_0x3ae15d[_0x598c38][_0x0375('0x116')]('channel',_0x0375('0x121'));}return _0x3ae15d;}));return BPromise['all'](_0x53c0ed);})[_0x0375('0x26')](function(_0x40c21f){var _0x3a602a=_['flatten'](_0x40c21f);_0x53c0ed=[];return db[_0x0375('0x69')]['transaction'](function(_0x24c755){for(var _0x2d9777=0x0;_0x2d9777<_0x3a602a[_0x0375('0x4c')];_0x2d9777++){_0x53c0ed['push'](_0x3a602a[_0x2d9777][_0x0375('0x12a')](_0x12c882['id']),{'transaction':_0x24c755});}return BPromise['all'](_0x53c0ed)[_0x0375('0x26')](function(){if(_0x12c882[_0x0375('0x123')]){return BPromise[_0x0375('0x8b')](_[_0x0375('0x2d')](_0x3a602a,function(_0xda040a){return _0xda040a[_0x0375('0x124')]('channel')===_0x0375('0x117');}),function(_0xb8df41){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xb8df41['id'],'UserId':_0x12c882['id']},'transaction':_0x24c755});});}else{return;}})['then'](function(){db['TeamVoicePrefix'][_0x0375('0x99')]({'where':{'teamId':_0x10880d['id']}})[_0x0375('0x26')](function(_0x1fb594){if(_0x1fb594){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x12c882['id'],'VoicePrefixId':_0x1fb594[_0x0375('0x4e')][_0x0375('0x126')]}});}});})[_0x0375('0x26')](function(){for(var _0x13da38=0x0;_0x13da38<_0x3a602a['length'];_0x13da38++){var _0x32a22b=_0x3a602a[_0x13da38][_0x0375('0x124')](_0x0375('0x9f'));var _0x57dbba=_0x32a22b+_0x0375('0xaa');socket[_0x0375('0xab')](_0x0375('0x7e')+_0x32a22b+_0x0375('0xb5'),{'UserId':_0x12c882['id'],['queueField']:_0x3a602a[_0x13da38]['id']});}});});});}});}})[_0x0375('0x26')](respondWithStatusCode(_0x9e6e64,null))[_0x0375('0x1b')](handleError(_0x9e6e64,null));};exports[_0x0375('0x12b')]=function(_0x5cc0de,_0x3ed6df){var _0x2f4e20={};var _0x36caa6={};var _0x5403bd;var _0x2d68be;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x5cc0de[_0x0375('0x5e')]['id']}})[_0x0375('0x26')](handleEntityNotFound(_0x3ed6df,null))[_0x0375('0x26')](function(_0x499157){if(_0x499157){_0x5403bd=_0x499157;_0x36caa6[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0xd3')][_0x0375('0x3a')]);_0x36caa6[_0x0375('0x41')]=_[_0x0375('0xcd')](_0x5cc0de[_0x0375('0x41')]);_0x36caa6['filters']=_[_0x0375('0x57')](_0x36caa6[_0x0375('0x54')],_0x36caa6[_0x0375('0x41')]);_0x2f4e20[_0x0375('0x47')]=_[_0x0375('0x57')](_0x36caa6['model'],qs[_0x0375('0x58')](_0x5cc0de['query']['fields']));_0x2f4e20[_0x0375('0x47')]=_0x2f4e20['attributes'][_0x0375('0x4c')]?_0x2f4e20[_0x0375('0x47')]:_0x36caa6[_0x0375('0x54')];_0x2f4e20[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x5cc0de[_0x0375('0x41')]['sort']);_0x2f4e20[_0x0375('0x40')]=qs['filters'](_['pick'](_0x5cc0de[_0x0375('0x41')],_0x36caa6[_0x0375('0x56')]));if(_0x5cc0de[_0x0375('0x41')][_0x0375('0x2d')]){_0x2f4e20[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x2f4e20[_0x0375('0x40')],{'$or':_['map'](_0x2f4e20[_0x0375('0x47')],function(_0xb1749b){var _0x290b80={};_0x290b80[_0xb1749b]={'$like':'%'+_0x5cc0de['query'][_0x0375('0x2d')]+'%'};return _0x290b80;})});}_0x2f4e20=_[_0x0375('0xd1')]({},_0x2f4e20,_0x5cc0de[_0x0375('0x59')]);return _0x5403bd[_0x0375('0x12b')](_0x2f4e20);}})[_0x0375('0x26')](function(_0x2f13b4){if(_0x2f13b4){_0x2d68be=_0x2f13b4[_0x0375('0x4c')];if(!_0x5cc0de[_0x0375('0x41')]['hasOwnProperty']('nolimit')){_0x2f4e20[_0x0375('0x21')]=qs[_0x0375('0x21')](_0x5cc0de[_0x0375('0x41')][_0x0375('0x21')]);_0x2f4e20['offset']=qs[_0x0375('0x1f')](_0x5cc0de[_0x0375('0x41')][_0x0375('0x1f')]);}return _0x5403bd[_0x0375('0x12b')](_0x2f4e20);}})[_0x0375('0x26')](function(_0x1b76df){if(_0x1b76df){return _0x1b76df?{'count':_0x2d68be,'rows':_0x1b76df}:null;}})[_0x0375('0x26')](respondWithResult(_0x3ed6df,null))[_0x0375('0x1b')](handleError(_0x3ed6df,null));};exports[_0x0375('0x12c')]=function(_0x109922,_0x15bd68){var _0x5e284c={};var _0xf64f61={};var _0x47fc6e;return db[_0x0375('0x39')][_0x0375('0x99')]({'where':{'id':_0x109922[_0x0375('0x5e')]['id']}})['then'](handleEntityNotFound(_0x15bd68,null))[_0x0375('0x26')](function(_0x3eee34){if(_0x3eee34){_0x47fc6e=_0x3eee34;_0xf64f61[_0x0375('0x54')]=_[_0x0375('0xcd')](db[_0x0375('0x39')]['rawAttributes']);_0xf64f61['query']=_['keys'](_0x109922[_0x0375('0x41')]);_0xf64f61['filters']=_[_0x0375('0x57')](_0xf64f61[_0x0375('0x54')],_0xf64f61[_0x0375('0x41')]);_0x5e284c[_0x0375('0x47')]=_[_0x0375('0x57')](_0xf64f61['model'],qs[_0x0375('0x58')](_0x109922[_0x0375('0x41')][_0x0375('0x58')]));_0x5e284c[_0x0375('0x47')]=_0x5e284c[_0x0375('0x47')][_0x0375('0x4c')]?_0x5e284c[_0x0375('0x47')]:_0xf64f61[_0x0375('0x54')];_0x5e284c[_0x0375('0xce')]=qs[_0x0375('0xcf')](_0x109922[_0x0375('0x41')][_0x0375('0xcf')]);_0x5e284c['where']=qs[_0x0375('0x56')](_[_0x0375('0xd0')](_0x109922['query'],_0xf64f61[_0x0375('0x56')]));if(_0x109922[_0x0375('0x41')][_0x0375('0x2d')]){_0x5e284c[_0x0375('0x40')]=_[_0x0375('0xd1')](_0x5e284c[_0x0375('0x40')],{'$or':_['map'](_0x5e284c[_0x0375('0x47')],function(_0x1e0fa4){var _0x921b0a={};_0x921b0a[_0x1e0fa4]={'$like':'%'+_0x109922[_0x0375('0x41')][_0x0375('0x2d')]+'%'};return _0x921b0a;})});}_0x5e284c['model']=db[_0x0375('0x39')];_0x5e284c['as']=_0x0375('0x2b');_0x5e284c=_[_0x0375('0xd1')]({},_0x5e284c,_0x109922['options']);return _0x47fc6e['getVoiceQueues']({'include':[_0x5e284c]});}})['then'](function(_0x7a8bfa){if(_0x7a8bfa){var _0x446f8={},_0x396675=[];for(var _0x29b060=0x0;_0x29b060<_0x7a8bfa[_0x0375('0x4c')];_0x29b060+=0x1){for(var _0x12211a=0x0,_0xa06dc2;_0x12211a<_0x7a8bfa[_0x29b060][_0x0375('0x2b')]['length'];_0x12211a+=0x1){_0xa06dc2=_0x7a8bfa[_0x29b060][_0x0375('0x2b')][_0x12211a][_0x0375('0x27')]({'plain':!![]});_0x446f8[_0xa06dc2['id']]=_0xa06dc2;}}_0x446f8=_['values'](_0x446f8);for(var _0x3da263=qs[_0x0375('0x1f')](_0x109922[_0x0375('0x41')][_0x0375('0x1f')]);_0x3da263<_0x446f8[_0x0375('0x4c')]&&_0x396675[_0x0375('0x4c')]=_0x1054bb[_0xad7d('0x52')]){throw new Error(_0xad7d('0x53'));}})[_0xad7d('0x11')](function(){if(_0x18c88d){return db[_0xad7d('0x2d')][_0xad7d('0x54')]({'where':{'membername':_0x18c88d[_0xad7d('0x30')]},'individualHooks':!![]});}})[_0xad7d('0x11')](function(){if(_0x18c88d){return _0x18c88d[_0xad7d('0x55')]({'raw':!![]});}})[_0xad7d('0x11')](function(_0x41b159){if(_0x18c88d){if(_0x41b159){var _0x29a471=[];_0xdd90ec=_0x41b159;if(_0xdd90ec[_0xad7d('0x32')]){for(var _0x408eb1=0x0;_0x408eb1<_0xdd90ec[_0xad7d('0x32')];_0x408eb1++){_0x29a471[_0xad7d('0x48')](db['UserVoiceQueueRt'][_0xad7d('0x56')]({'membername':_0x18c88d[_0xad7d('0x30')],'UserId':_0x18c88d['id'],'queue_name':_0xdd90ec[_0x408eb1][_0xad7d('0x30')],'VoiceQueueId':_0xdd90ec[_0x408eb1]['id'],'interface':_0x41137d,'paused':_0x18c88d[_0xad7d('0x4d')]||![],'penalty':_0xdd90ec[_0x408eb1][_0xad7d('0x57')]||0x0}));}return BPromise[_0xad7d('0x4a')](_0x29a471);}}}})[_0xad7d('0x11')](function(){if(_0x18c88d){return db[_0xad7d('0x2f')]['findAll']({'where':{'membername':_0x18c88d[_0xad7d('0x30')],'exitAt':null}});}})[_0xad7d('0x11')](function(_0xab4f3e){if(_0x18c88d){if(_0xab4f3e&&_0xab4f3e[_0xad7d('0x32')]){var _0x2718b5=[];_0xab4f3e[_0xad7d('0x47')](function(_0x4acb8b){_0x2718b5[_0xad7d('0x48')](_0x4acb8b[_0xad7d('0x2e')]({'exitAt':moment()['format'](_0xad7d('0x34'))}));});return BPromise[_0xad7d('0x4a')](_0x2718b5);}}})['then'](function(_0x3ff540){if(_0x18c88d){var _0x43a80d=[];var _0x462f0=[];var _0x2c1f20=utils['getChannels']();var _0x334d38={'membername':_0x18c88d[_0xad7d('0x30')],'interface':_0x41137d,'enterAt':moment()[_0xad7d('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x18c88d[_0xad7d('0x2b')],'internal':_0x18c88d[_0xad7d('0x2c')]};_0x2c1f20[_0xad7d('0x47')](function(_0x3e0e30){_0x43a80d[_0xad7d('0x48')](_[_0xad7d('0x58')]({'channel':_0x3e0e30,'type':'LOGIN','data1':_0xad7d('0x59'),'data2':_0x41137d},_0x334d38));if(_0x18c88d['loginInPause']){_0x462f0['push'](_['merge']({'channel':_0x3e0e30,'type':_0xad7d('0x31'),'data1':_0xad7d('0x5a')},_0x334d38));}});return db[_0xad7d('0x2f')][_0xad7d('0x3a')](_0x43a80d[_0xad7d('0x5b')](_0x462f0),{'individualHooks':!![]});}})[_0xad7d('0x11')](function(){if(_0x18c88d){return _0x18c88d[_0xad7d('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xad7d('0x33')](_0xad7d('0x34')),'voicePause':_0x18c88d[_0xad7d('0x4d')]||![],'mailPause':_0x18c88d[_0xad7d('0x4d')]||![],'chatPause':_0x18c88d[_0xad7d('0x4d')]||![],'faxPause':_0x18c88d['loginInPause']||![],'smsPause':_0x18c88d[_0xad7d('0x4d')]||![],'openchannelPause':_0x18c88d[_0xad7d('0x4d')]||![],'pauseType':_0x18c88d[_0xad7d('0x4d')]?_0xad7d('0x5a'):null,'lastPauseAt':moment()[_0xad7d('0x33')](_0xad7d('0x34')),'interface':_0x41137d});}})[_0xad7d('0x11')](function(_0x2422f3){_0x766c04(_0x2422f3);})[_0xad7d('0x1b')](function(_0x290fed){_0x4a3767(_0x1e119a[_0xad7d('0x16')](0x1f4,_0x290fed[_0xad7d('0x18')]));});});}; \ No newline at end of file +var _0x637f=['User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','User','findAll','options','raw','attributes','limit','model','include','map','then','GetUser','stringify','ShowUser','where','debug','find','name','role','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','internal','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','callysquare','merge','concat','LOGININPAUSE','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./user.socket','register','request','info'];(function(_0x51a004,_0x504f1b){var _0x4403a1=function(_0x2277db){while(--_0x2277db){_0x51a004['push'](_0x51a004['shift']());}};_0x4403a1(++_0x504f1b);}(_0x637f,0x16c));var _0xf637=function(_0x2624f7,_0x4175b9){_0x2624f7=_0x2624f7-0x0;var _0x3ea815=_0x637f[_0x2624f7];return _0x3ea815;};'use strict';var _=require('lodash');var util=require(_0xf637('0x0'));var moment=require(_0xf637('0x1'));var BPromise=require(_0xf637('0x2'));var rs=require(_0xf637('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf637('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf637('0x5'))(_0xf637('0x6'));var config=require(_0xf637('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf637('0x8')][_0xf637('0x9')]({'port':0x232a});config[_0xf637('0xa')]=_['defaults'](config[_0xf637('0xa')],{'host':_0xf637('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf637('0xa')]));require(_0xf637('0xc'))[_0xf637('0xd')](socket);function respondWithRpcPromise(_0x264655,_0x593458,_0x196bde){return new BPromise(function(_0x49aea6,_0x142bf4){return client[_0xf637('0xe')](_0x264655,_0x196bde)['then'](function(_0x5b9aac){logger[_0xf637('0xf')](_0xf637('0x10'),_0x593458,'request\x20sent');logger['debug'](_0xf637('0x11'),_0x593458,_0xf637('0x12'),JSON['stringify'](_0x5b9aac));if(_0x5b9aac[_0xf637('0x13')]){if(_0x5b9aac[_0xf637('0x13')][_0xf637('0x14')]===0x1f4){logger[_0xf637('0x13')](_0xf637('0x10'),_0x593458,_0x5b9aac[_0xf637('0x13')]['message']);return _0x142bf4(_0x5b9aac[_0xf637('0x13')][_0xf637('0x15')]);}logger[_0xf637('0x13')](_0xf637('0x10'),_0x593458,_0x5b9aac[_0xf637('0x13')]['message']);return _0x49aea6(_0x5b9aac[_0xf637('0x13')][_0xf637('0x15')]);}else{logger[_0xf637('0xf')](_0xf637('0x10'),_0x593458,_0xf637('0x12'));_0x49aea6(_0x5b9aac[_0xf637('0x16')]['message']);}})[_0xf637('0x17')](function(_0x6e892d){logger[_0xf637('0x13')](_0xf637('0x10'),_0x593458,_0x6e892d);_0x142bf4(_0x6e892d);});});}exports['GetUser']=function(_0x589839){var _0x3bd4a9=this;return new Promise(function(_0x4ee459,_0xa6e1dc){return db[_0xf637('0x18')][_0xf637('0x19')]({'raw':_0x589839[_0xf637('0x1a')]?_0x589839[_0xf637('0x1a')][_0xf637('0x1b')]===undefined?!![]:![]:!![],'where':_0x589839['options']?_0x589839[_0xf637('0x1a')]['where']||null:null,'attributes':_0x589839[_0xf637('0x1a')]?_0x589839['options'][_0xf637('0x1c')]||null:null,'limit':_0x589839['options']?_0x589839[_0xf637('0x1a')][_0xf637('0x1d')]||null:null,'include':_0x589839[_0xf637('0x1a')]?_0x589839['options']['include']?_['map'](_0x589839[_0xf637('0x1a')]['include'],function(_0x95e6dc){return{'model':db[_0x95e6dc[_0xf637('0x1e')]],'as':_0x95e6dc['as'],'attributes':_0x95e6dc['attributes'],'include':_0x95e6dc[_0xf637('0x1f')]?_[_0xf637('0x20')](_0x95e6dc[_0xf637('0x1f')],function(_0x5c5930){return{'model':db[_0x5c5930[_0xf637('0x1e')]],'as':_0x5c5930['as'],'attributes':_0x5c5930['attributes'],'include':_0x5c5930[_0xf637('0x1f')]?_['map'](_0x5c5930[_0xf637('0x1f')],function(_0x2b1c4f){return{'model':db[_0x2b1c4f[_0xf637('0x1e')]],'as':_0x2b1c4f['as'],'attributes':_0x2b1c4f[_0xf637('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf637('0x21')](function(_0x459f78){logger['info'](_0xf637('0x22'),_0x589839);logger['debug'](_0xf637('0x22'),_0x589839,JSON[_0xf637('0x23')](_0x459f78));_0x4ee459(_0x459f78);})[_0xf637('0x17')](function(_0xbb095){logger[_0xf637('0x13')](_0xf637('0x22'),_0xbb095[_0xf637('0x15')],_0x589839);_0xa6e1dc(_0x3bd4a9[_0xf637('0x13')](0x1f4,_0xbb095[_0xf637('0x15')]));});});};exports[_0xf637('0x24')]=function(_0x35bc5b){var _0x4f5663=this;return new Promise(function(_0x3e7bdd,_0x85c235){return db['User']['find']({'raw':_0x35bc5b[_0xf637('0x1a')]?_0x35bc5b[_0xf637('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35bc5b['options']?_0x35bc5b[_0xf637('0x1a')][_0xf637('0x25')]||null:null,'attributes':_0x35bc5b[_0xf637('0x1a')]?_0x35bc5b[_0xf637('0x1a')][_0xf637('0x1c')]||null:null,'include':_0x35bc5b[_0xf637('0x1a')]?_0x35bc5b[_0xf637('0x1a')][_0xf637('0x1f')]?_['map'](_0x35bc5b[_0xf637('0x1a')][_0xf637('0x1f')],function(_0xca66a4){return{'model':db[_0xca66a4[_0xf637('0x1e')]],'as':_0xca66a4['as'],'attributes':_0xca66a4['attributes'],'include':_0xca66a4[_0xf637('0x1f')]?_['map'](_0xca66a4['include'],function(_0x1afe5b){return{'model':db[_0x1afe5b['model']],'as':_0x1afe5b['as'],'attributes':_0x1afe5b[_0xf637('0x1c')],'include':_0x1afe5b['include']?_[_0xf637('0x20')](_0x1afe5b['include'],function(_0x1fff17){return{'model':db[_0x1fff17[_0xf637('0x1e')]],'as':_0x1fff17['as'],'attributes':_0x1fff17[_0xf637('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf637('0x21')](function(_0x4f68ff){logger[_0xf637('0xf')](_0xf637('0x24'),_0x35bc5b);logger[_0xf637('0x26')]('ShowUser',_0x35bc5b,JSON[_0xf637('0x23')](_0x4f68ff));_0x3e7bdd(_0x4f68ff);})[_0xf637('0x17')](function(_0x27891c){logger[_0xf637('0x13')](_0xf637('0x24'),_0x27891c[_0xf637('0x15')],_0x35bc5b);_0x85c235(_0x4f5663[_0xf637('0x13')](0x1f4,_0x27891c['message']));});});};exports['PauseUser']=function(_0x5b7e93){var _0x531f46=this;return new Promise(function(_0x45cab4,_0x15c1d1){var _0xf5ec4b;return db[_0xf637('0x18')][_0xf637('0x27')]({'where':_0x5b7e93[_0xf637('0x1a')][_0xf637('0x25')]||{},'attributes':['id',_0xf637('0x28'),_0xf637('0x29'),'internal','interface']})[_0xf637('0x21')](function(_0x344b22){if(_0x344b22){_0xf5ec4b=_0x344b22;return db[_0xf637('0x2a')][_0xf637('0x2b')]({'paused':0x1},{'where':{'UserId':_0xf5ec4b['id']},'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0xf5ec4b){return db[_0xf637('0x2c')][_0xf637('0x19')]({'where':{'membername':_0xf5ec4b[_0xf637('0x28')],'type':_0xf637('0x2d'),'exitAt':null}});}})['then'](function(_0x45d71d){if(_0xf5ec4b){if(_0x45d71d&&_0x45d71d[_0xf637('0x2e')]){var _0x3baf02=moment()[_0xf637('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3626e3=0x0,_0x7cad8=_0x45d71d[_0xf637('0x2e')];_0x3626e3<_0x7cad8;_0x3626e3++){_0x45d71d[_0x3626e3][_0xf637('0x30')]({'exitAt':_0x3baf02});}}}})[_0xf637('0x21')](function(){if(_0xf5ec4b){var _0xfd7984=[];var _0x5ac571=utils[_0xf637('0x31')]();_0x5ac571[_0xf637('0x32')](function(_0x4b3964){_0xfd7984[_0xf637('0x33')]({'channel':_0x4b3964,'membername':_0xf5ec4b[_0xf637('0x28')],'interface':_[_0xf637('0x34')](_0xf5ec4b[_0xf637('0x35')])?util[_0xf637('0x2f')](_0xf637('0x36'),_0xf5ec4b[_0xf637('0x28')]):_0xf5ec4b['interface'],'type':_0xf637('0x2d'),'enterAt':moment()['format'](_0xf637('0x37')),'data1':_0x5b7e93[_0xf637('0x38')][_0xf637('0x39')]||'DEFAULT\x20PAUSE','role':_0xf5ec4b[_0xf637('0x29')],'internal':_0xf5ec4b[_0xf637('0x3a')],'uniqueid':_0x5b7e93['body'][_0xf637('0x3b')]||null});});return db[_0xf637('0x2c')][_0xf637('0x3c')](_0xfd7984,{'individualHooks':!![]});}})['then'](function(){if(_0xf5ec4b){return _0xf5ec4b[_0xf637('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5b7e93[_0xf637('0x38')]['type']||_0xf637('0x3d'),'lastPauseAt':moment()[_0xf637('0x2f')](_0xf637('0x37'))});}})[_0xf637('0x21')](function(_0x428c16){_0x45cab4(_0x428c16);})[_0xf637('0x17')](function(_0x3b408c){_0x15c1d1(_0x531f46[_0xf637('0x13')](0x1f4,_0x3b408c['message']));});});};exports[_0xf637('0x3e')]=function(_0x16c2db){var _0x43e95a=this;return new Promise(function(_0x316b5c,_0x45fff9){var _0x5535d6;return db[_0xf637('0x18')][_0xf637('0x3f')]({'where':_0x16c2db['options'][_0xf637('0x25')]||{},'attributes':['id',_0xf637('0x28')]})['then'](function(_0x21c829){if(_0x21c829){_0x5535d6=_0x21c829;if(_0x16c2db[_0xf637('0x38')][_0xf637('0x40')]&&!utils[_0xf637('0x41')](_0x16c2db[_0xf637('0x38')][_0xf637('0x40')])){throw new Error(_0xf637('0x42'));}switch(_0x16c2db[_0xf637('0x38')][_0xf637('0x40')]){case _0xf637('0x43'):return db[_0xf637('0x2a')][_0xf637('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5535d6['id']}})['then'](function(){return db[_0xf637('0x2c')][_0xf637('0x27')]({'where':{'channel':_0x16c2db[_0xf637('0x38')][_0xf637('0x40')],'membername':_0x5535d6[_0xf637('0x28')],'type':_0xf637('0x2d'),'exitAt':null}});})[_0xf637('0x21')](function(_0x1ecd19){if(_0x1ecd19){return _0x1ecd19[_0xf637('0x2b')]({'exitAt':moment()[_0xf637('0x2f')](_0xf637('0x37')),'data2':_0xf637('0x44')},{'individualHooks':!![]});}return null;})[_0xf637('0x21')](function(){return _0x5535d6[_0xf637('0x2b')]({'voicePause':![]});});case _0xf637('0x45'):case _0xf637('0x46'):case _0xf637('0x47'):case _0xf637('0x48'):case _0xf637('0x49'):case _0xf637('0x4a'):return db[_0xf637('0x2c')][_0xf637('0x27')]({'where':{'channel':_0x16c2db[_0xf637('0x38')][_0xf637('0x40')],'membername':_0x5535d6[_0xf637('0x28')],'type':_0xf637('0x2d'),'exitAt':null}})[_0xf637('0x21')](function(_0x4166ab){return _0x4166ab['update']({'exitAt':moment()[_0xf637('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xf637('0x44')},{'individualHooks':!![]});})[_0xf637('0x21')](function(){var _0x1bffcb={};_[_0xf637('0x4b')](_0x1bffcb,util[_0xf637('0x2f')](_0xf637('0x4c'),_0x16c2db[_0xf637('0x38')]['channel'],_0xf637('0x4d')),![]);return _0x5535d6[_0xf637('0x2b')](_0x1bffcb);});default:return db['UserVoiceQueueRt'][_0xf637('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5535d6['id']}})['then'](function(){return db[_0xf637('0x2c')][_0xf637('0x19')]({'where':{'membername':_0x5535d6[_0xf637('0x28')],'type':'PAUSE','exitAt':null}});})[_0xf637('0x21')](function(_0xafee09){var _0x3d1b58=[];_0xafee09[_0xf637('0x32')](function(_0x297626){_0x3d1b58[_0xf637('0x33')](_0x297626['update']({'exitAt':moment()[_0xf637('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'}));});return BPromise[_0xf637('0x4e')](_0x3d1b58);})[_0xf637('0x21')](function(){return _0x5535d6['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xf637('0x21')](function(_0x3c53e6){_0x316b5c(_0x3c53e6);})[_0xf637('0x17')](function(_0x3d9b00){_0x45fff9(_0x43e95a[_0xf637('0x13')](0x1f4,_0x3d9b00[_0xf637('0x15')]));});});};exports[_0xf637('0x4f')]=function(_0x4c9e77){var _0xf18cc3=this;return new Promise(function(_0x10fa11,_0x1a8930){var _0x4baf5a;return db['User'][_0xf637('0x3f')]({'where':_0x4c9e77[_0xf637('0x1a')][_0xf637('0x25')]||{},'attributes':['id',_0xf637('0x28')]})[_0xf637('0x21')](function(_0x3b3b7e){if(_0x3b3b7e){_0x4baf5a=_0x3b3b7e;return db[_0xf637('0x2a')][_0xf637('0x50')]({'where':{'membername':_0x4baf5a[_0xf637('0x28')]},'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0x4baf5a){return db[_0xf637('0x2c')][_0xf637('0x19')]({'where':{'membername':_0x4baf5a[_0xf637('0x28')],'exitAt':null}});}})['then'](function(_0x13c714){if(_0x4baf5a){if(_0x13c714&&_0x13c714['length']){var _0x157078=[];_0x13c714[_0xf637('0x32')](function(_0x529667){_0x157078[_0xf637('0x33')](_0x529667[_0xf637('0x2b')]({'exitAt':moment()[_0xf637('0x2f')](_0xf637('0x37'))}));});return BPromise['all'](_0x157078);}}})['then'](function(){if(_0x4baf5a){return _0x4baf5a['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x5c8927){_0x10fa11(_0x5c8927);})[_0xf637('0x17')](function(_0x4bc2a7){_0x1a8930(_0xf18cc3[_0xf637('0x13')](0x1f4,_0x4bc2a7[_0xf637('0x15')]));});});};exports[_0xf637('0x51')]=function(_0x336a6e){var _0x6150ff=this;return new Promise(function(_0x534b9b,_0x50dec6){var _0x45893b;var _0x354905;var _0x56a8be;var _0x46ba38;return db['User']['findOne']({'where':_0x336a6e[_0xf637('0x1a')][_0xf637('0x25')]||{},'attributes':['id',_0xf637('0x28'),'role','mobile','phone','internal',_0xf637('0x52'),_0xf637('0x35')]})[_0xf637('0x21')](function(_0x2948c6){if(_0x2948c6){_0x45893b=_0x2948c6;_0x46ba38=_0x336a6e[_0xf637('0x38')]['interface']?_0x336a6e[_0xf637('0x38')][_0xf637('0x35')]:util[_0xf637('0x2f')](_0xf637('0x36'),_0x45893b['name']);return db[_0xf637('0x18')][_0xf637('0x53')]({'where':{'role':_0xf637('0x54'),'online':!![],'id':{'$ne':_0x45893b['id']}}});}})[_0xf637('0x21')](function(_0x2d84e1){if(_0x2d84e1){_0x56a8be=_0x2d84e1;return require(_0xf637('0x55'))[_0xf637('0x56')]();}})['then'](function(_0x36e87c){if(_0x36e87c&&_0x36e87c[_0xf637('0x57')]&&_0x56a8be>=_0x36e87c[_0xf637('0x57')]){throw new Error(_0xf637('0x58'));}})[_0xf637('0x21')](function(){if(_0x45893b){return db[_0xf637('0x2a')]['destroy']({'where':{'membername':_0x45893b['name']},'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0x45893b){return _0x45893b['getVoiceQueues']({'raw':!![]});}})[_0xf637('0x21')](function(_0x11ed30){if(_0x45893b){if(_0x11ed30){var _0x1dd7b1=[];_0x354905=_0x11ed30;if(_0x354905[_0xf637('0x2e')]){for(var _0x22e06f=0x0;_0x22e06f<_0x354905[_0xf637('0x2e')];_0x22e06f++){_0x1dd7b1['push'](db[_0xf637('0x2a')][_0xf637('0x59')]({'membername':_0x45893b['name'],'UserId':_0x45893b['id'],'queue_name':_0x354905[_0x22e06f]['name'],'VoiceQueueId':_0x354905[_0x22e06f]['id'],'interface':_0x46ba38,'paused':_0x45893b['loginInPause']||![],'penalty':_0x354905[_0x22e06f][_0xf637('0x5a')]||0x0}));}return BPromise[_0xf637('0x4e')](_0x1dd7b1);}}}})[_0xf637('0x21')](function(){if(_0x45893b){return db[_0xf637('0x2c')][_0xf637('0x19')]({'where':{'membername':_0x45893b['name'],'exitAt':null}});}})['then'](function(_0x6be900){if(_0x45893b){if(_0x6be900&&_0x6be900[_0xf637('0x2e')]){var _0x3c6908=[];_0x6be900['forEach'](function(_0x1d6fa2){_0x3c6908['push'](_0x1d6fa2[_0xf637('0x2b')]({'exitAt':moment()[_0xf637('0x2f')](_0xf637('0x37'))}));});return BPromise[_0xf637('0x4e')](_0x3c6908);}}})['then'](function(_0x29b538){if(_0x45893b){var _0x3e88aa=[];var _0x1e7fd9=[];var _0x2dfb4c=utils[_0xf637('0x31')]();var _0x51d3a1={'membername':_0x45893b['name'],'interface':_0x46ba38,'enterAt':moment()['format'](_0xf637('0x37')),'role':_0x45893b[_0xf637('0x29')],'internal':_0x45893b[_0xf637('0x3a')]};_0x2dfb4c[_0xf637('0x32')](function(_0x28cc8c){_0x3e88aa[_0xf637('0x33')](_['merge']({'channel':_0x28cc8c,'type':'LOGIN','data1':_0xf637('0x5b'),'data2':_0x46ba38},_0x51d3a1));if(_0x45893b['loginInPause']){_0x1e7fd9['push'](_[_0xf637('0x5c')]({'channel':_0x28cc8c,'type':_0xf637('0x2d'),'data1':'LOGININPAUSE'},_0x51d3a1));}});return db['MemberReport'][_0xf637('0x3c')](_0x3e88aa[_0xf637('0x5d')](_0x1e7fd9),{'individualHooks':!![]});}})[_0xf637('0x21')](function(){if(_0x45893b){return _0x45893b[_0xf637('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0xf637('0x37')),'voicePause':_0x45893b[_0xf637('0x52')]||![],'mailPause':_0x45893b[_0xf637('0x52')]||![],'chatPause':_0x45893b['loginInPause']||![],'faxPause':_0x45893b[_0xf637('0x52')]||![],'smsPause':_0x45893b[_0xf637('0x52')]||![],'openchannelPause':_0x45893b[_0xf637('0x52')]||![],'pauseType':_0x45893b[_0xf637('0x52')]?_0xf637('0x5e'):null,'lastPauseAt':moment()['format'](_0xf637('0x37')),'interface':_0x46ba38});}})[_0xf637('0x21')](function(_0x281732){_0x534b9b(_0x281732);})['catch'](function(_0x3812fd){_0x50dec6(_0x6150ff[_0xf637('0x13')](0x1f4,_0x3812fd[_0xf637('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 649a5c4..867057b 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 _0xd2ca=['user:','remove','update','removeListener','register'];(function(_0x283123,_0x13cc12){var _0x1ac6b3=function(_0x1adf36){while(--_0x1adf36){_0x283123['push'](_0x283123['shift']());}};_0x1ac6b3(++_0x13cc12);}(_0xd2ca,0x132));var _0xad2c=function(_0x41425a,_0xb7f84e){_0x41425a=_0x41425a-0x0;var _0x3538d9=_0xd2ca[_0x41425a];return _0x3538d9;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xad2c('0x0'),_0xad2c('0x1')];function createListener(_0x40a387,_0x1e1e73){return function(_0x34fabd){_0x1e1e73['emit'](_0x40a387,_0x34fabd);};}function removeListener(_0x4f8213,_0x2df439){return function(){UserEvents[_0xad2c('0x2')](_0x4f8213,_0x2df439);};}exports[_0xad2c('0x3')]=function(_0x489c8f){for(var _0x5914fb=0x0,_0x44f204=events['length'];_0x5914fb<_0x44f204;_0x5914fb++){var _0x576c85=events[_0x5914fb];var _0x153176=createListener(_0xad2c('0x4')+_0x576c85,_0x489c8f);UserEvents['on'](_0x576c85,_0x153176);}}; \ No newline at end of file +var _0x6f90=['save','remove','update','emit','removeListener','register','length','user:','./user.events'];(function(_0x24f974,_0x19f818){var _0x297896=function(_0x305e08){while(--_0x305e08){_0x24f974['push'](_0x24f974['shift']());}};_0x297896(++_0x19f818);}(_0x6f90,0x131));var _0x06f9=function(_0x1d04c4,_0x53978b){_0x1d04c4=_0x1d04c4-0x0;var _0x1ac3ed=_0x6f90[_0x1d04c4];return _0x1ac3ed;};'use strict';var UserEvents=require(_0x06f9('0x0'));var events=[_0x06f9('0x1'),_0x06f9('0x2'),_0x06f9('0x3')];function createListener(_0x16496f,_0x14eeb9){return function(_0x4ad675){_0x14eeb9[_0x06f9('0x4')](_0x16496f,_0x4ad675);};}function removeListener(_0x20926f,_0x151f08){return function(){UserEvents[_0x06f9('0x5')](_0x20926f,_0x151f08);};}exports[_0x06f9('0x6')]=function(_0x20c76e){for(var _0x372207=0x0,_0x48da4d=events[_0x06f9('0x7')];_0x372207<_0x48da4d;_0x372207++){var _0x1e24a3=events[_0x372207];var _0x28e578=createListener(_0x06f9('0x8')+_0x1e24a3,_0x20c76e);UserEvents['on'](_0x1e24a3,_0x28e578);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3c0d5b1..e24b35d 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2656a4,_0x28dd1b){var _0x48ce85=function(_0x41d957){while(--_0x41d957){_0x2656a4['push'](_0x2656a4['shift']());}};_0x48ce85(++_0x28dd1b);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36e583,_0x58368c){var _0x2c0880=function(_0x10cd4d){while(--_0x10cd4d){_0x36e583['push'](_0x36e583['shift']());}};_0x2c0880(++_0x58368c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ea257d6..24b708c 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 _0x444a=['sequelize','exports','INTEGER'];(function(_0x545e86,_0x46a2ed){var _0xa98055=function(_0x41aa23){while(--_0x41aa23){_0x545e86['push'](_0x545e86['shift']());}};_0xa98055(++_0x46a2ed);}(_0x444a,0xba));var _0xa444=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0x444a[_0x1081a3];return _0x5696a2;};'use strict';var Sequelize=require(_0xa444('0x0'));module[_0xa444('0x1')]={'penalty':{'type':Sequelize[_0xa444('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd3f3=['sequelize','exports','INTEGER'];(function(_0x2fa9f8,_0x39e7eb){var _0x568ad7=function(_0x4222a4){while(--_0x4222a4){_0x2fa9f8['push'](_0x2fa9f8['shift']());}};_0x568ad7(++_0x39e7eb);}(_0xd3f3,0x72));var _0x3d3f=function(_0x21bfcd,_0x48e609){_0x21bfcd=_0x21bfcd-0x0;var _0xe9acb0=_0xd3f3[_0x21bfcd];return _0xe9acb0;};'use strict';var Sequelize=require(_0x3d3f('0x0'));module[_0x3d3f('0x1')]={'penalty':{'type':Sequelize[_0x3d3f('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 3825215..908e025 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 _0xd6a7=['define','UserChatQueue','user_has_chat_queues','lodash','util','moment','request-promise','path','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x576560,_0x2966e1){var _0x12a93a=function(_0x37c434){while(--_0x37c434){_0x576560['push'](_0x576560['shift']());}};_0x12a93a(++_0x2966e1);}(_0xd6a7,0x87));var _0x7d6a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd6a7[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7d6a('0x0'));var util=require(_0x7d6a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7d6a('0x2'));var BPromise=require('bluebird');var rp=require(_0x7d6a('0x3'));var fs=require('fs');var path=require(_0x7d6a('0x4'));var rimraf=require('rimraf');var config=require(_0x7d6a('0x5'));var attributes=require(_0x7d6a('0x6'));module[_0x7d6a('0x7')]=function(_0x4645ad,_0x5e8614){return _0x4645ad[_0x7d6a('0x8')](_0x7d6a('0x9'),attributes,{'tableName':_0x7d6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x084a=['api','moment','bluebird','path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger'];(function(_0x509ee7,_0x49440c){var _0x856347=function(_0x51ef03){while(--_0x51ef03){_0x509ee7['push'](_0x509ee7['shift']());}};_0x856347(++_0x49440c);}(_0x084a,0x6c));var _0xa084=function(_0x2c1ac1,_0x3dfb07){_0x2c1ac1=_0x2c1ac1-0x0;var _0x240e2d=_0x084a[_0x2c1ac1];return _0x240e2d;};'use strict';var _=require('lodash');var util=require(_0xa084('0x0'));var logger=require(_0xa084('0x1'))(_0xa084('0x2'));var moment=require(_0xa084('0x3'));var BPromise=require(_0xa084('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa084('0x5'));var rimraf=require('rimraf');var config=require(_0xa084('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xa084('0x7')]=function(_0x4e0c67,_0x23b93c){return _0x4e0c67[_0xa084('0x8')](_0xa084('0x9'),attributes,{'tableName':_0xa084('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index b181efd..3b72f42 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 _0xbfb5=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x1ede8e,_0x2acfbd){var _0x43bb4a=function(_0x24fca7){while(--_0x24fca7){_0x1ede8e['push'](_0x1ede8e['shift']());}};_0x43bb4a(++_0x2acfbd);}(_0xbfb5,0x1bf));var _0x5bfb=function(_0x1c001a,_0x52f4b1){_0x1c001a=_0x1c001a-0x0;var _0xc83fc6=_0xbfb5[_0x1c001a];return _0xc83fc6;};'use strict';var _=require('lodash');var util=require(_0x5bfb('0x0'));var moment=require(_0x5bfb('0x1'));var BPromise=require(_0x5bfb('0x2'));var rs=require(_0x5bfb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5bfb('0x4'))['db'];var utils=require(_0x5bfb('0x5'));var logger=require(_0x5bfb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bfb('0x7'));var client=jayson[_0x5bfb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3917aa,_0x5ae23f,_0x5a54cb){return new BPromise(function(_0x44ad98,_0x514892){return client[_0x5bfb('0x9')](_0x3917aa,_0x5a54cb)[_0x5bfb('0xa')](function(_0xa1e66f){logger[_0x5bfb('0xb')](_0x5bfb('0xc'),_0x5ae23f,_0x5bfb('0xd'));logger[_0x5bfb('0xe')](_0x5bfb('0xf'),_0x5ae23f,_0x5bfb('0xd'),JSON['stringify'](_0xa1e66f));if(_0xa1e66f[_0x5bfb('0x10')]){if(_0xa1e66f['error'][_0x5bfb('0x11')]===0x1f4){logger[_0x5bfb('0x10')](_0x5bfb('0xc'),_0x5ae23f,_0xa1e66f[_0x5bfb('0x10')][_0x5bfb('0x12')]);return _0x514892(_0xa1e66f[_0x5bfb('0x10')]['message']);}logger['error'](_0x5bfb('0xc'),_0x5ae23f,_0xa1e66f['error'][_0x5bfb('0x12')]);return _0x44ad98(_0xa1e66f[_0x5bfb('0x10')][_0x5bfb('0x12')]);}else{logger[_0x5bfb('0xb')](_0x5bfb('0xc'),_0x5ae23f,_0x5bfb('0xd'));_0x44ad98(_0xa1e66f[_0x5bfb('0x13')]['message']);}})['catch'](function(_0x43f257){logger[_0x5bfb('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5ae23f,_0x43f257);_0x514892(_0x43f257);});});} \ No newline at end of file +var _0x51e7=['stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x46be36,_0x5451a8){var _0x203d30=function(_0x5c5653){while(--_0x5c5653){_0x46be36['push'](_0x46be36['shift']());}};_0x203d30(++_0x5451a8);}(_0x51e7,0x1e7));var _0x751e=function(_0x2bbae5,_0x1f4626){_0x2bbae5=_0x2bbae5-0x0;var _0x90f6f=_0x51e7[_0x2bbae5];return _0x90f6f;};'use strict';var _=require(_0x751e('0x0'));var util=require(_0x751e('0x1'));var moment=require(_0x751e('0x2'));var BPromise=require(_0x751e('0x3'));var rs=require(_0x751e('0x4'));var fs=require('fs');var Redis=require(_0x751e('0x5'));var db=require(_0x751e('0x6'))['db'];var utils=require(_0x751e('0x7'));var logger=require(_0x751e('0x8'))(_0x751e('0x9'));var config=require(_0x751e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x751e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c422f,_0x2881ae,_0x59367b){return new BPromise(function(_0x585c03,_0x1c83b4){return client[_0x751e('0xc')](_0x4c422f,_0x59367b)['then'](function(_0x425612){logger[_0x751e('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x751e('0xe'));logger[_0x751e('0xf')](_0x751e('0x10'),_0x2881ae,_0x751e('0xe'),JSON[_0x751e('0x11')](_0x425612));if(_0x425612['error']){if(_0x425612[_0x751e('0x12')][_0x751e('0x13')]===0x1f4){logger['error'](_0x751e('0x14'),_0x2881ae,_0x425612[_0x751e('0x12')][_0x751e('0x15')]);return _0x1c83b4(_0x425612[_0x751e('0x12')][_0x751e('0x15')]);}logger[_0x751e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x425612['error'][_0x751e('0x15')]);return _0x585c03(_0x425612[_0x751e('0x12')][_0x751e('0x15')]);}else{logger['info'](_0x751e('0x14'),_0x2881ae,_0x751e('0xe'));_0x585c03(_0x425612[_0x751e('0x16')]['message']);}})[_0x751e('0x17')](function(_0x2ed4cd){logger[_0x751e('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x2881ae,_0x2ed4cd);_0x1c83b4(_0x2ed4cd);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 02b64d0..ca9f017 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1a957b,_0x3823df){var _0xff156d=function(_0x4dae9a){while(--_0x4dae9a){_0x1a957b['push'](_0x1a957b['shift']());}};_0xff156d(++_0x3823df);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'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 2cb9ada..ba98fbf 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 _0x5cf0=['INTEGER','STRING','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5cf0,0x1ca));var _0x05cf=function(_0x293926,_0x4aa16f){_0x293926=_0x293926-0x0;var _0x2a5ead=_0x5cf0[_0x293926];return _0x2a5ead;};'use strict';var Sequelize=require('sequelize');module[_0x05cf('0x0')]={'penalty':{'type':Sequelize[_0x05cf('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x05cf('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x05cf('0x2')]}}; \ No newline at end of file +var _0xf5aa=['exports','INTEGER','sequelize'];(function(_0x367e7e,_0x564aa4){var _0x90036e=function(_0x45ec9e){while(--_0x45ec9e){_0x367e7e['push'](_0x367e7e['shift']());}};_0x90036e(++_0x564aa4);}(_0xf5aa,0x1a9));var _0xaf5a=function(_0x26f6b4,_0x160445){_0x26f6b4=_0x26f6b4-0x0;var _0x53a138=_0xf5aa[_0x26f6b4];return _0x53a138;};'use strict';var Sequelize=require(_0xaf5a('0x0'));module[_0xaf5a('0x1')]={'penalty':{'type':Sequelize[_0xaf5a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaf5a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ec0e0f1..ed25832 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 _0xc1f2=['bluebird','path','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','util','../../config/logger','moment'];(function(_0x4142af,_0x396358){var _0x4bd460=function(_0x2ca275){while(--_0x2ca275){_0x4142af['push'](_0x4142af['shift']());}};_0x4bd460(++_0x396358);}(_0xc1f2,0x165));var _0x2c1f=function(_0x31b6b1,_0x394456){_0x31b6b1=_0x31b6b1-0x0;var _0x2dd1f3=_0xc1f2[_0x31b6b1];return _0x2dd1f3;};'use strict';var _=require('lodash');var util=require(_0x2c1f('0x0'));var logger=require(_0x2c1f('0x1'))('api');var moment=require(_0x2c1f('0x2'));var BPromise=require(_0x2c1f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c1f('0x4'));var rimraf=require(_0x2c1f('0x5'));var config=require(_0x2c1f('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x2c1f('0x7')]=function(_0x1f071c,_0x35028a){return _0x1f071c['define'](_0x2c1f('0x8'),attributes,{'tableName':_0x2c1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d7d=['moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x2b73cb,_0x35754a){var _0x2fae69=function(_0x46262b){while(--_0x46262b){_0x2b73cb['push'](_0x2b73cb['shift']());}};_0x2fae69(++_0x35754a);}(_0x0d7d,0x111));var _0xd0d7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x0d7d[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xd0d7('0x0'));var util=require(_0xd0d7('0x1'));var logger=require(_0xd0d7('0x2'))('api');var moment=require(_0xd0d7('0x3'));var BPromise=require(_0xd0d7('0x4'));var rp=require(_0xd0d7('0x5'));var fs=require('fs');var path=require(_0xd0d7('0x6'));var rimraf=require(_0xd0d7('0x7'));var config=require('../../config/environment');var attributes=require(_0xd0d7('0x8'));module['exports']=function(_0x71119a,_0x55ebca){return _0x71119a[_0xd0d7('0x9')](_0xd0d7('0xa'),attributes,{'tableName':_0xd0d7('0xb'),'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 8685396..93e19a3 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 _0xdaf7=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xdaf7,0xe7));var _0x7daf=function(_0x5adef4,_0x1a67cf){_0x5adef4=_0x5adef4-0x0;var _0x2be5bc=_0xdaf7[_0x5adef4];return _0x2be5bc;};'use strict';var _=require(_0x7daf('0x0'));var util=require(_0x7daf('0x1'));var moment=require(_0x7daf('0x2'));var BPromise=require(_0x7daf('0x3'));var rs=require(_0x7daf('0x4'));var fs=require('fs');var Redis=require(_0x7daf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7daf('0x6'));var logger=require(_0x7daf('0x7'))(_0x7daf('0x8'));var config=require(_0x7daf('0x9'));var jayson=require(_0x7daf('0xa'));var client=jayson[_0x7daf('0xb')][_0x7daf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34986d,_0x2a729f,_0x72effd){return new BPromise(function(_0x453eca,_0x48eb2c){return client[_0x7daf('0xd')](_0x34986d,_0x72effd)[_0x7daf('0xe')](function(_0x832b3e){logger['info'](_0x7daf('0xf'),_0x2a729f,_0x7daf('0x10'));logger[_0x7daf('0x11')](_0x7daf('0x12'),_0x2a729f,_0x7daf('0x10'),JSON[_0x7daf('0x13')](_0x832b3e));if(_0x832b3e[_0x7daf('0x14')]){if(_0x832b3e['error'][_0x7daf('0x15')]===0x1f4){logger['error'](_0x7daf('0xf'),_0x2a729f,_0x832b3e[_0x7daf('0x14')][_0x7daf('0x16')]);return _0x48eb2c(_0x832b3e[_0x7daf('0x14')][_0x7daf('0x16')]);}logger[_0x7daf('0x14')](_0x7daf('0xf'),_0x2a729f,_0x832b3e[_0x7daf('0x14')][_0x7daf('0x16')]);return _0x453eca(_0x832b3e[_0x7daf('0x14')][_0x7daf('0x16')]);}else{logger['info'](_0x7daf('0xf'),_0x2a729f,_0x7daf('0x10'));_0x453eca(_0x832b3e['result'][_0x7daf('0x16')]);}})['catch'](function(_0x24de85){logger[_0x7daf('0x14')](_0x7daf('0xf'),_0x2a729f,_0x24de85);_0x48eb2c(_0x24de85);});});} \ No newline at end of file +var _0x4fcb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserFaxQueue,\x20%s,\x20%s'];(function(_0x1b0dc7,_0x58b8c2){var _0x324d9b=function(_0x4a2f0e){while(--_0x4a2f0e){_0x1b0dc7['push'](_0x1b0dc7['shift']());}};_0x324d9b(++_0x58b8c2);}(_0x4fcb,0xa3));var _0xb4fc=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x4fcb[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0xb4fc('0x0'));var util=require(_0xb4fc('0x1'));var moment=require(_0xb4fc('0x2'));var BPromise=require(_0xb4fc('0x3'));var rs=require(_0xb4fc('0x4'));var fs=require('fs');var Redis=require(_0xb4fc('0x5'));var db=require(_0xb4fc('0x6'))['db'];var utils=require(_0xb4fc('0x7'));var logger=require(_0xb4fc('0x8'))(_0xb4fc('0x9'));var config=require(_0xb4fc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb4fc('0xb')][_0xb4fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd9d9e0,_0x3c4c69,_0x2a4911){return new BPromise(function(_0x5727c9,_0x1bc700){return client['request'](_0xd9d9e0,_0x2a4911)['then'](function(_0x550e2b){logger[_0xb4fc('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0xb4fc('0xe'));logger[_0xb4fc('0xf')](_0xb4fc('0x10'),_0x3c4c69,_0xb4fc('0xe'),JSON['stringify'](_0x550e2b));if(_0x550e2b[_0xb4fc('0x11')]){if(_0x550e2b[_0xb4fc('0x11')][_0xb4fc('0x12')]===0x1f4){logger[_0xb4fc('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0x550e2b[_0xb4fc('0x11')][_0xb4fc('0x13')]);return _0x1bc700(_0x550e2b[_0xb4fc('0x11')]['message']);}logger[_0xb4fc('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x3c4c69,_0x550e2b[_0xb4fc('0x11')]['message']);return _0x5727c9(_0x550e2b['error']['message']);}else{logger[_0xb4fc('0xd')](_0xb4fc('0x14'),_0x3c4c69,'request\x20sent');_0x5727c9(_0x550e2b[_0xb4fc('0x15')][_0xb4fc('0x13')]);}})[_0xb4fc('0x16')](function(_0x579598){logger[_0xb4fc('0x11')](_0xb4fc('0x14'),_0x3c4c69,_0x579598);_0x1bc700(_0x579598);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 12cf29d..a22017b 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x49c7bd,_0x1432db){var _0x1ba37d=function(_0x30f525){while(--_0x30f525){_0x49c7bd['push'](_0x49c7bd['shift']());}};_0x1ba37d(++_0x1432db);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x475c35,_0xbc5a8){var _0xdac2c2=function(_0x3c9ef3){while(--_0x3c9ef3){_0x475c35['push'](_0x475c35['shift']());}};_0xdac2c2(++_0xbc5a8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xcb91[_0x5774be];return _0x4914b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c557069..0fd4e7d 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 _0x1447=['exports'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x1447,0xd3));var _0x7144=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1447[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x7144('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc777=['exports','sequelize'];(function(_0x12bdba,_0x49ea0d){var _0x2a756a=function(_0x4cfe22){while(--_0x4cfe22){_0x12bdba['push'](_0x12bdba['shift']());}};_0x2a756a(++_0x49ea0d);}(_0xc777,0x1b7));var _0x7c77=function(_0x4ac6e1,_0xe338c0){_0x4ac6e1=_0x4ac6e1-0x0;var _0xd9937a=_0xc777[_0x4ac6e1];return _0xd9937a;};'use strict';var Sequelize=require(_0x7c77('0x0'));module[_0x7c77('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 6ab64f9..2bd3c23 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 _0x5a56=['./userMailQueue.attributes','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x5a56,0x1a7));var _0x65a5=function(_0x593bd5,_0x3931ff){_0x593bd5=_0x593bd5-0x0;var _0x57edd7=_0x5a56[_0x593bd5];return _0x57edd7;};'use strict';var _=require(_0x65a5('0x0'));var util=require(_0x65a5('0x1'));var logger=require(_0x65a5('0x2'))(_0x65a5('0x3'));var moment=require(_0x65a5('0x4'));var BPromise=require(_0x65a5('0x5'));var rp=require(_0x65a5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65a5('0x7'));var config=require(_0x65a5('0x8'));var attributes=require(_0x65a5('0x9'));module['exports']=function(_0x5edd8c,_0x51f678){return _0x5edd8c['define'](_0x65a5('0xa'),attributes,{'tableName':_0x65a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0d7=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x7e19de,_0x368cce){var _0x3b06be=function(_0x5021eb){while(--_0x5021eb){_0x7e19de['push'](_0x7e19de['shift']());}};_0x3b06be(++_0x368cce);}(_0xa0d7,0x101));var _0x7a0d=function(_0x325cca,_0x1310a0){_0x325cca=_0x325cca-0x0;var _0x4005e1=_0xa0d7[_0x325cca];return _0x4005e1;};'use strict';var _=require('lodash');var util=require(_0x7a0d('0x0'));var logger=require(_0x7a0d('0x1'))(_0x7a0d('0x2'));var moment=require(_0x7a0d('0x3'));var BPromise=require(_0x7a0d('0x4'));var rp=require(_0x7a0d('0x5'));var fs=require('fs');var path=require(_0x7a0d('0x6'));var rimraf=require(_0x7a0d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a0d('0x8'));module[_0x7a0d('0x9')]=function(_0x315547,_0x56df4e){return _0x315547[_0x7a0d('0xa')]('UserMailQueue',attributes,{'tableName':_0x7a0d('0xb'),'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 98f8fd9..704d0fd 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1cec9d,_0x2f65b8){var _0x458d57=function(_0x252cf4){while(--_0x252cf4){_0x1cec9d['push'](_0x1cec9d['shift']());}};_0x458d57(++_0x2f65b8);}(_0x34e8,0x12c));var _0x834e=function(_0x300faf,_0x5ceb39){_0x300faf=_0x300faf-0x0;var _0x167200=_0x34e8[_0x300faf];return _0x167200;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x472c48,_0x268c55){var _0x346f36=function(_0x572fc6){while(--_0x572fc6){_0x472c48['push'](_0x472c48['shift']());}};_0x346f36(++_0x268c55);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c894b,_0x54fa91){_0x4c894b=_0x4c894b-0x0;var _0x490258=_0x7fbe[_0x4c894b];return _0x490258;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 37302b4..dce7d7b 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 _0x855e=['sendUserNotification','path','connect-timeout','express','../../components/auth/service','../../config/environment','./userNotification.controller'];(function(_0x51dae4,_0x2811c2){var _0xa6e49f=function(_0x1430e4){while(--_0x1430e4){_0x51dae4['push'](_0x51dae4['shift']());}};_0xa6e49f(++_0x2811c2);}(_0x855e,0x1c1));var _0xe855=function(_0x4f9ae8,_0x4d69fe){_0x4f9ae8=_0x4f9ae8-0x0;var _0x53cce6=_0x855e[_0x4f9ae8];return _0x53cce6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe855('0x0'));var timeout=require(_0xe855('0x1'));var express=require(_0xe855('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe855('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe855('0x4'));var controller=require(_0xe855('0x5'));router['post']('/',auth['isAuthenticated'](),controller[_0xe855('0x6')]);module['exports']=router; \ No newline at end of file +var _0x0924=['./userNotification.controller','isAuthenticated','sendUserNotification','multer','path','Router','fs-extra','../../config/environment'];(function(_0xc742da,_0x520607){var _0x18328c=function(_0x394875){while(--_0x394875){_0xc742da['push'](_0xc742da['shift']());}};_0x18328c(++_0x520607);}(_0x0924,0x17b));var _0x4092=function(_0x5b4a06,_0x2734e7){_0x5b4a06=_0x5b4a06-0x0;var _0x1cf5e5=_0x0924[_0x5b4a06];return _0x1cf5e5;};'use strict';var multer=require(_0x4092('0x0'));var util=require('util');var path=require(_0x4092('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4092('0x2')]();var fs_extra=require(_0x4092('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4092('0x4'));var controller=require(_0x4092('0x5'));router['post']('/',auth[_0x4092('0x6')](),controller[_0x4092('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index deed43d..c9108ac 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 _0xfccd=['exports','TEXT','STRING','sequelize'];(function(_0x6ab981,_0x3af43b){var _0xf46675=function(_0x590292){while(--_0x590292){_0x6ab981['push'](_0x6ab981['shift']());}};_0xf46675(++_0x3af43b);}(_0xfccd,0xcb));var _0xdfcc=function(_0x3b76e9,_0x39efb2){_0x3b76e9=_0x3b76e9-0x0;var _0x43489c=_0xfccd[_0x3b76e9];return _0x43489c;};'use strict';var Sequelize=require(_0xdfcc('0x0'));module[_0xdfcc('0x1')]={'body':{'type':Sequelize[_0xdfcc('0x2')]},'senderName':{'type':Sequelize[_0xdfcc('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xdfcc('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x6073=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x6073,0xb2));var _0x3607=function(_0x396e8a,_0x39f47a){_0x396e8a=_0x396e8a-0x0;var _0x4b9fa5=_0x6073[_0x396e8a];return _0x4b9fa5;};'use strict';var Sequelize=require(_0x3607('0x0'));module[_0x3607('0x1')]={'body':{'type':Sequelize[_0x3607('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x3607('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3607('0x3')]},'beep':{'type':Sequelize[_0x3607('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5a92356..622ebbb 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 _0x91c4=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','end','json','limit','undefined','offset','set','reject','save','update','then','destroy','sendStatus','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','UserNotification','create','forEach','recipient','emit','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','toLowerCase','ids','queue','replace','push','union','getAgents','map','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4c67b8,_0x571e13){var _0xbc26e=function(_0x16e9ac){while(--_0x16e9ac){_0x4c67b8['push'](_0x4c67b8['shift']());}};_0xbc26e(++_0x571e13);}(_0x91c4,0x15d));var _0x491c=function(_0x303cd1,_0x57e5b9){_0x303cd1=_0x303cd1-0x0;var _0x5c3128=_0x91c4[_0x303cd1];return _0x5c3128;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x491c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x491c('0x1'));var rp=require('request-promise');var moment=require(_0x491c('0x2'));var BPromise=require(_0x491c('0x3'));var Mustache=require('mustache');var util=require(_0x491c('0x4'));var path=require(_0x491c('0x5'));var sox=require(_0x491c('0x6'));var csv=require(_0x491c('0x7'));var ejs=require(_0x491c('0x8'));var fs=require('fs');var fs_extra=require(_0x491c('0x9'));var _=require(_0x491c('0xa'));var squel=require(_0x491c('0xb'));var crypto=require(_0x491c('0xc'));var jsforce=require(_0x491c('0xd'));var deskjs=require(_0x491c('0xe'));var toCsv=require(_0x491c('0x7'));var querystring=require(_0x491c('0xf'));var Papa=require('papaparse');var Redis=require(_0x491c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x491c('0x11'));var as=require(_0x491c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x491c('0x13'))(_0x491c('0x14'));var utils=require(_0x491c('0x15'));var config=require(_0x491c('0x16'));var licenseUtil=require(_0x491c('0x17'));var db=require(_0x491c('0x18'))['db'];config[_0x491c('0x19')]=_[_0x491c('0x1a')](config['redis'],{'host':_0x491c('0x1b'),'port':0x18eb});var socket=require(_0x491c('0x1c'))(new Redis(config[_0x491c('0x19')]));require(_0x491c('0x1d'))['register'](socket);function respondWithStatusCode(_0x22b919,_0x3ee068){_0x3ee068=_0x3ee068||0xcc;return function(_0x4860b7){if(_0x4860b7){return _0x22b919['sendStatus'](_0x3ee068);}return _0x22b919[_0x491c('0x1e')](_0x3ee068)[_0x491c('0x1f')]();};}function respondWithResult(_0x1b740d,_0x153704){_0x153704=_0x153704||0xc8;return function(_0x1c2d56){if(_0x1c2d56){return _0x1b740d[_0x491c('0x1e')](_0x153704)[_0x491c('0x20')](_0x1c2d56);}};}function respondWithFilteredResult(_0x1ed86a,_0x5f4803){return function(_0x47759e){if(_0x47759e){var _0x467fce=typeof _0x5f4803['offset']==='undefined'&&typeof _0x5f4803[_0x491c('0x21')]===_0x491c('0x22');var _0x58ecb9=_0x47759e['count'];var _0xd7362f=_0x467fce?0x0:_0x5f4803[_0x491c('0x23')];var _0x432856=_0x467fce?_0x47759e['count']:_0x5f4803[_0x491c('0x23')]+_0x5f4803[_0x491c('0x21')];var _0x4b6eca;if(_0x432856>=_0x58ecb9){_0x432856=_0x58ecb9;_0x4b6eca=0xc8;}else{_0x4b6eca=0xce;}_0x1ed86a[_0x491c('0x1e')](_0x4b6eca);return _0x1ed86a[_0x491c('0x24')]('Content-Range',_0xd7362f+'-'+_0x432856+'/'+_0x58ecb9)[_0x491c('0x20')](_0x47759e);}return null;};}function patchUpdates(_0x3b1f78){return function(_0x2d159f){try{jsonpatch['apply'](_0x2d159f,_0x3b1f78,!![]);}catch(_0x2ecf1e){return BPromise[_0x491c('0x25')](_0x2ecf1e);}return _0x2d159f[_0x491c('0x26')]();};}function saveUpdates(_0x33c09c,_0x47353c){return function(_0x139ce3){if(_0x139ce3){return _0x139ce3[_0x491c('0x27')](_0x33c09c)[_0x491c('0x28')](function(_0x1bb0a1){return _0x1bb0a1;});}return null;};}function removeEntity(_0x1062b5,_0x3c08c7){return function(_0x552d80){if(_0x552d80){return _0x552d80[_0x491c('0x29')]()[_0x491c('0x28')](function(){_0x1062b5[_0x491c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5277d1,_0x352d20){return function(_0x13fd68){if(!_0x13fd68){_0x5277d1[_0x491c('0x2a')](0x194);}return _0x13fd68;};}function handleError(_0x2838c3,_0x104ef8){_0x104ef8=_0x104ef8||0x1f4;return function(_0x221b1d){logger[_0x491c('0x2b')](_0x221b1d[_0x491c('0x2c')]);if(_0x221b1d[_0x491c('0x2d')]){delete _0x221b1d[_0x491c('0x2d')];}_0x2838c3[_0x491c('0x1e')](_0x104ef8)['send'](_0x221b1d);};}exports[_0x491c('0x2e')]=function(_0x4e07e8,_0x51b307,_0x10f20d){if(!_0x4e07e8[_0x491c('0x2f')][_0x491c('0x30')](_0x491c('0x31'))&&!_0x4e07e8[_0x491c('0x2f')][_0x491c('0x30')](_0x491c('0x32'))){throw new db['Sequelize'][(_0x491c('0x33'))](_0x491c('0x34'));}else{if(_0x4e07e8['body']['hasOwnProperty'](_0x491c('0x32'))&&!_0x4e07e8[_0x491c('0x2f')][_0x491c('0x30')]('view')){throw new db[(_0x491c('0x35'))][(_0x491c('0x33'))](_0x491c('0x36'));}if(!_0x4e07e8[_0x491c('0x2f')][_0x491c('0x30')](_0x491c('0x37'))){throw new db[(_0x491c('0x35'))]['ValidationError'](_0x491c('0x38'));}else{try{var _0x2947ff=JSON['parse'](_0x4e07e8['body'][_0x491c('0x37')]);}catch(_0x4a937e){logger[_0x491c('0x2b')](_0x4a937e);throw new db['Sequelize'][(_0x491c('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x586b9b=['chatqueue',_0x491c('0x39'),_0x491c('0x3a'),_0x491c('0x3b'),'smsqueue',_0x491c('0x3c'),_0x491c('0x3d'),'team',_0x491c('0x3e')];if(_['some'](_0x2947ff,function(_0xd761ac){return!_[_0x491c('0x3f')](_0x586b9b,_0xd761ac[_0x491c('0x40')]['toLowerCase']());})){throw new db[(_0x491c('0x35'))][(_0x491c('0x33'))](_0x491c('0x41'));}}}var _0x458d6d={};_0x458d6d['senderName']=_0x4e07e8[_0x491c('0x2f')][_0x491c('0x30')](_0x491c('0x42'))?_0x4e07e8[_0x491c('0x2f')][_0x491c('0x42')]:_0x4e07e8[_0x491c('0x3e')]['fullname'];_0x458d6d[_0x491c('0x43')]=_[_0x491c('0x44')](_0x4e07e8['body']['recipientsDescription'])?null:_0x4e07e8[_0x491c('0x2f')][_0x491c('0x43')];_0x458d6d[_0x491c('0x45')]=_0x4e07e8['body'][_0x491c('0x45')]||![];_0x458d6d[_0x491c('0x46')]=_0x4e07e8[_0x491c('0x3e')]['id'];return getContent(_0x4e07e8[_0x491c('0x2f')])['then'](function(_0x243e46){_0x458d6d[_0x491c('0x2f')]=_0x243e46;return getRecipients(_0x2947ff);})[_0x491c('0x28')](function(_0x399cca){_0x458d6d[_0x491c('0x47')]=_['sortBy'](_0x399cca)['join'](',');return db[_0x491c('0x48')]['transaction'](function(_0x2a7e2d){return db[_0x491c('0x49')][_0x491c('0x4a')](_0x458d6d,{'raw':!![],'transaction':_0x2a7e2d})[_0x491c('0x28')](function(_0x54524e){var _0x17bfe1={'sender':_0x458d6d['senderName'],'description':_0x458d6d[_0x491c('0x43')],'content':_0x458d6d[_0x491c('0x2f')],'beep':_0x458d6d[_0x491c('0x45')]};_0x399cca[_0x491c('0x4b')](function(_0x3bbb67){_0x17bfe1[_0x491c('0x4c')]=_0x3bbb67;socket[_0x491c('0x4d')]('userNotification:send',_0x17bfe1);});return _0x54524e;});});})[_0x491c('0x28')](respondWithResult(_0x51b307,0xc9))['catch'](handleError(_0x51b307,null));};function getContent(_0x2e08a0){return new BPromise(function(_0x13cbc5,_0x5d44d8){if(_0x2e08a0[_0x491c('0x31')]){_0x13cbc5(_0x2e08a0[_0x491c('0x31')]);return;}return db['Template'][_0x491c('0x4e')]({'attributes':[_0x491c('0x4f')],'where':{'id':_0x2e08a0[_0x491c('0x32')]},'raw':!![]})[_0x491c('0x28')](function(_0x21507e){if(!_0x21507e)throw new db[(_0x491c('0x35'))][(_0x491c('0x33'))](_0x491c('0x50'));var _0x1d71f2=Mustache[_0x491c('0x51')](_0x21507e['html'],_0x2e08a0[_0x491c('0x52')]);_0x13cbc5(_0x1d71f2);})[_0x491c('0x53')](function(_0x178f94){_0x5d44d8(_0x178f94);});});}function getRecipients(_0x1cb432){return new BPromise(function(_0xe0a6e6,_0x3b91d4){var _0x396f4d=[];var _0x56bfce=[];_0x1cb432[_0x491c('0x4b')](function(_0x1e665e){var _0x7d897b=_['startCase'](_0x1e665e[_0x491c('0x40')][_0x491c('0x54')]());if(_0x7d897b==='User'){_0x396f4d=_['union'](_0x396f4d,_0x1e665e[_0x491c('0x55')]);}else{if(_['includes'](_0x7d897b,_0x491c('0x56')))_0x7d897b=_0x7d897b[_0x491c('0x57')](_0x491c('0x56'),'Queue');_0x1e665e[_0x491c('0x55')][_0x491c('0x4b')](function(_0x309f92){_0x56bfce[_0x491c('0x58')](getAgents(_0x7d897b,_0x309f92));});}});return BPromise['all'](_0x56bfce)[_0x491c('0x28')](function(_0x1e0e90){_0x396f4d=_[_0x491c('0x59')](_0x396f4d,_['flatten'](_0x1e0e90));_0xe0a6e6(_0x396f4d);})[_0x491c('0x53')](function(_0x2d25ef){_0x3b91d4(_0x2d25ef);});});}function getAgents(_0x196c41,_0x20505b){return new BPromise(function(_0x55c7a3,_0x4cfa55){return db[_0x196c41][_0x491c('0x4e')]({'where':{'id':_0x20505b}})['then'](function(_0x40a95d){return _0x40a95d[_0x491c('0x5a')]({'attributes':['id'],'raw':!![]})[_0x491c('0x28')](function(_0x3b2e29){var _0x484f63=_[_0x491c('0x5b')](_0x3b2e29,'id');_0x55c7a3(_0x484f63);});})[_0x491c('0x53')](function(_0x4f1e42){_0x4cfa55(_0x4f1e42);});});} \ No newline at end of file +var _0x1bdb=['faxqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','forEach','recipient','emit','userNotification:send','catch','text','Template','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','model','User','union','ids','queue','replace','push','all','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','offset','undefined','count','apply','reject','update','then','error','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue'];(function(_0x2d6c79,_0x40ef4b){var _0x432466=function(_0x590099){while(--_0x590099){_0x2d6c79['push'](_0x2d6c79['shift']());}};_0x432466(++_0x40ef4b);}(_0x1bdb,0xeb));var _0xb1bd=function(_0x1ae125,_0x1c2c5f){_0x1ae125=_0x1ae125-0x0;var _0x419783=_0x1bdb[_0x1ae125];return _0x419783;};'use strict';var emlformat=require(_0xb1bd('0x0'));var rimraf=require(_0xb1bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1bd('0x2'));var rp=require(_0xb1bd('0x3'));var moment=require('moment');var BPromise=require(_0xb1bd('0x4'));var Mustache=require(_0xb1bd('0x5'));var util=require(_0xb1bd('0x6'));var path=require(_0xb1bd('0x7'));var sox=require(_0xb1bd('0x8'));var csv=require('to-csv');var ejs=require(_0xb1bd('0x9'));var fs=require('fs');var fs_extra=require(_0xb1bd('0xa'));var _=require(_0xb1bd('0xb'));var squel=require(_0xb1bd('0xc'));var crypto=require(_0xb1bd('0xd'));var jsforce=require(_0xb1bd('0xe'));var deskjs=require(_0xb1bd('0xf'));var toCsv=require(_0xb1bd('0x10'));var querystring=require(_0xb1bd('0x11'));var Papa=require(_0xb1bd('0x12'));var Redis=require(_0xb1bd('0x13'));var authService=require(_0xb1bd('0x14'));var qs=require(_0xb1bd('0x15'));var as=require(_0xb1bd('0x16'));var hardwareService=require(_0xb1bd('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb1bd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb1bd('0x19'))['db'];config[_0xb1bd('0x1a')]=_[_0xb1bd('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb1bd('0x1c'))(new Redis(config[_0xb1bd('0x1a')]));require(_0xb1bd('0x1d'))[_0xb1bd('0x1e')](socket);function respondWithStatusCode(_0x745692,_0x2b1070){_0x2b1070=_0x2b1070||0xcc;return function(_0x3a9fd8){if(_0x3a9fd8){return _0x745692[_0xb1bd('0x1f')](_0x2b1070);}return _0x745692['status'](_0x2b1070)[_0xb1bd('0x20')]();};}function respondWithResult(_0x50cc15,_0x2eaa64){_0x2eaa64=_0x2eaa64||0xc8;return function(_0x2056fa){if(_0x2056fa){return _0x50cc15[_0xb1bd('0x21')](_0x2eaa64)[_0xb1bd('0x22')](_0x2056fa);}};}function respondWithFilteredResult(_0x1a0011,_0x23a575){return function(_0x259f47){if(_0x259f47){var _0x2f639d=typeof _0x23a575[_0xb1bd('0x23')]===_0xb1bd('0x24')&&typeof _0x23a575['limit']===_0xb1bd('0x24');var _0x2ce7f8=_0x259f47['count'];var _0x15d64f=_0x2f639d?0x0:_0x23a575['offset'];var _0xbbf3ed=_0x2f639d?_0x259f47[_0xb1bd('0x25')]:_0x23a575[_0xb1bd('0x23')]+_0x23a575['limit'];var _0x10e661;if(_0xbbf3ed>=_0x2ce7f8){_0xbbf3ed=_0x2ce7f8;_0x10e661=0xc8;}else{_0x10e661=0xce;}_0x1a0011[_0xb1bd('0x21')](_0x10e661);return _0x1a0011['set']('Content-Range',_0x15d64f+'-'+_0xbbf3ed+'/'+_0x2ce7f8)[_0xb1bd('0x22')](_0x259f47);}return null;};}function patchUpdates(_0x3b6c1d){return function(_0xe86fee){try{jsonpatch[_0xb1bd('0x26')](_0xe86fee,_0x3b6c1d,!![]);}catch(_0x278c2e){return BPromise[_0xb1bd('0x27')](_0x278c2e);}return _0xe86fee['save']();};}function saveUpdates(_0x16d253,_0x2ccb32){return function(_0x3ba67b){if(_0x3ba67b){return _0x3ba67b[_0xb1bd('0x28')](_0x16d253)[_0xb1bd('0x29')](function(_0x2357a1){return _0x2357a1;});}return null;};}function removeEntity(_0x3926fc,_0x36aea2){return function(_0x1dccb1){if(_0x1dccb1){return _0x1dccb1['destroy']()['then'](function(){_0x3926fc[_0xb1bd('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51544c,_0x466a47){return function(_0x59389a){if(!_0x59389a){_0x51544c[_0xb1bd('0x1f')](0x194);}return _0x59389a;};}function handleError(_0x5bfa4e,_0x52e271){_0x52e271=_0x52e271||0x1f4;return function(_0x5a72c8){logger[_0xb1bd('0x2a')](_0x5a72c8['stack']);if(_0x5a72c8[_0xb1bd('0x2b')]){delete _0x5a72c8['name'];}_0x5bfa4e[_0xb1bd('0x21')](_0x52e271)[_0xb1bd('0x2c')](_0x5a72c8);};}exports[_0xb1bd('0x2d')]=function(_0x31fc70,_0x142bf6,_0xa2edb1){if(!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('text')&&!_0x31fc70['body'][_0xb1bd('0x2f')](_0xb1bd('0x30'))){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('TemplateId')&&!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')]('view')){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')](_0xb1bd('0x33'))){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x34'));}else{try{var _0x589407=JSON[_0xb1bd('0x35')](_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x33')]);}catch(_0x1ec144){logger[_0xb1bd('0x2a')](_0x1ec144);throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x36'));}var _0x266684=[_0xb1bd('0x37'),_0xb1bd('0x38'),'mailqueue','openchannelqueue',_0xb1bd('0x39'),_0xb1bd('0x3a'),_0xb1bd('0x3b'),'team',_0xb1bd('0x3c')];if(_[_0xb1bd('0x3d')](_0x589407,function(_0x2d99cf){return!_[_0xb1bd('0x3e')](_0x266684,_0x2d99cf['model'][_0xb1bd('0x3f')]());})){throw new db[(_0xb1bd('0x31'))][(_0xb1bd('0x32'))](_0xb1bd('0x40'));}}}var _0x426752={};_0x426752[_0xb1bd('0x41')]=_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x2f')](_0xb1bd('0x41'))?_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x41')]:_0x31fc70[_0xb1bd('0x3c')][_0xb1bd('0x42')];_0x426752[_0xb1bd('0x43')]=_[_0xb1bd('0x44')](_0x31fc70['body'][_0xb1bd('0x43')])?null:_0x31fc70['body'][_0xb1bd('0x43')];_0x426752[_0xb1bd('0x45')]=_0x31fc70[_0xb1bd('0x2e')][_0xb1bd('0x45')]||![];_0x426752[_0xb1bd('0x46')]=_0x31fc70[_0xb1bd('0x3c')]['id'];return getContent(_0x31fc70['body'])[_0xb1bd('0x29')](function(_0x3626c5){_0x426752[_0xb1bd('0x2e')]=_0x3626c5;return getRecipients(_0x589407);})[_0xb1bd('0x29')](function(_0x1aebd8){_0x426752[_0xb1bd('0x47')]=_[_0xb1bd('0x48')](_0x1aebd8)[_0xb1bd('0x49')](',');return db[_0xb1bd('0x4a')]['transaction'](function(_0x34914e){return db['UserNotification']['create'](_0x426752,{'raw':!![],'transaction':_0x34914e})[_0xb1bd('0x29')](function(_0x4e42e7){var _0x442d0c={'sender':_0x426752['senderName'],'description':_0x426752[_0xb1bd('0x43')],'content':_0x426752[_0xb1bd('0x2e')],'beep':_0x426752[_0xb1bd('0x45')]};_0x1aebd8[_0xb1bd('0x4b')](function(_0x3a246d){_0x442d0c[_0xb1bd('0x4c')]=_0x3a246d;socket[_0xb1bd('0x4d')](_0xb1bd('0x4e'),_0x442d0c);});return _0x4e42e7;});});})[_0xb1bd('0x29')](respondWithResult(_0x142bf6,0xc9))[_0xb1bd('0x4f')](handleError(_0x142bf6,null));};function getContent(_0x2a8482){return new BPromise(function(_0x80e9cc,_0x772fa1){if(_0x2a8482[_0xb1bd('0x50')]){_0x80e9cc(_0x2a8482[_0xb1bd('0x50')]);return;}return db[_0xb1bd('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x2a8482['TemplateId']},'raw':!![]})[_0xb1bd('0x29')](function(_0x1c0d1e){if(!_0x1c0d1e)throw new db['Sequelize'][(_0xb1bd('0x32'))](_0xb1bd('0x52'));var _0x329638=Mustache['render'](_0x1c0d1e[_0xb1bd('0x53')],_0x2a8482[_0xb1bd('0x54')]);_0x80e9cc(_0x329638);})[_0xb1bd('0x4f')](function(_0x2f0cf2){_0x772fa1(_0x2f0cf2);});});}function getRecipients(_0x3390c9){return new BPromise(function(_0xa1abb4,_0x527793){var _0x468334=[];var _0x3e70b7=[];_0x3390c9['forEach'](function(_0x398b3b){var _0x32eb15=_[_0xb1bd('0x55')](_0x398b3b[_0xb1bd('0x56')][_0xb1bd('0x3f')]());if(_0x32eb15===_0xb1bd('0x57')){_0x468334=_[_0xb1bd('0x58')](_0x468334,_0x398b3b[_0xb1bd('0x59')]);}else{if(_[_0xb1bd('0x3e')](_0x32eb15,_0xb1bd('0x5a')))_0x32eb15=_0x32eb15[_0xb1bd('0x5b')]('queue','Queue');_0x398b3b[_0xb1bd('0x59')][_0xb1bd('0x4b')](function(_0x3708d5){_0x3e70b7[_0xb1bd('0x5c')](getAgents(_0x32eb15,_0x3708d5));});}});return BPromise[_0xb1bd('0x5d')](_0x3e70b7)['then'](function(_0x468901){_0x468334=_[_0xb1bd('0x58')](_0x468334,_['flatten'](_0x468901));_0xa1abb4(_0x468334);})['catch'](function(_0x2e547f){_0x527793(_0x2e547f);});});}function getAgents(_0x2988a0,_0x5a6fda){return new BPromise(function(_0x652f98,_0x2c2bc0){return db[_0x2988a0][_0xb1bd('0x5e')]({'where':{'id':_0x5a6fda}})[_0xb1bd('0x29')](function(_0x518977){return _0x518977[_0xb1bd('0x5f')]({'attributes':['id'],'raw':!![]})[_0xb1bd('0x29')](function(_0x453d41){var _0x463fc0=_[_0xb1bd('0x60')](_0x453d41,'id');_0x652f98(_0x463fc0);});})[_0xb1bd('0x4f')](function(_0x52e6aa){_0x2c2bc0(_0x52e6aa);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d3462c6..358adb4 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 _0x0c1f=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x3c8956,_0x1f5c39){var _0x258e08=function(_0x1f7668){while(--_0x1f7668){_0x3c8956['push'](_0x3c8956['shift']());}};_0x258e08(++_0x1f5c39);}(_0x0c1f,0x10a));var _0xf0c1=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0x0c1f[_0xd4470d];return _0x5544c5;};'use strict';var EventEmitter=require(_0xf0c1('0x0'));var UserNotification=require(_0xf0c1('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf0c1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf0c1('0x3')};function emitEvent(_0x1b3c8d){return function(_0x121328,_0xded259,_0x1f1a39){UserNotificationEvents[_0xf0c1('0x4')](_0x1b3c8d+':'+_0x121328['id'],_0x121328);UserNotificationEvents[_0xf0c1('0x4')](_0x1b3c8d,_0x121328);_0x1f1a39(null);};}for(var e in events){if(events[_0xf0c1('0x5')](e)){var event=events[e];UserNotification[_0xf0c1('0x6')](e,emitEvent(event));}}module[_0xf0c1('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xc9c0=['remove','emit','hasOwnProperty','events','UserNotification','setMaxListeners','save'];(function(_0x32987d,_0x1cc727){var _0x35dbf1=function(_0x342404){while(--_0x342404){_0x32987d['push'](_0x32987d['shift']());}};_0x35dbf1(++_0x1cc727);}(_0xc9c0,0xf1));var _0x0c9c=function(_0x3b8912,_0x4c7f4d){_0x3b8912=_0x3b8912-0x0;var _0x15a943=_0xc9c0[_0x3b8912];return _0x15a943;};'use strict';var EventEmitter=require(_0x0c9c('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x0c9c('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0c9c('0x2')](0x0);var events={'afterCreate':_0x0c9c('0x3'),'afterUpdate':'update','afterDestroy':_0x0c9c('0x4')};function emitEvent(_0x2106e5){return function(_0xed637f,_0x4aac1e,_0x18f3c4){UserNotificationEvents['emit'](_0x2106e5+':'+_0xed637f['id'],_0xed637f);UserNotificationEvents[_0x0c9c('0x5')](_0x2106e5,_0xed637f);_0x18f3c4(null);};}for(var e in events){if(events[_0x0c9c('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index c56c3c6..70313a9 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 _0xa897=['../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x324a58,_0x201c2e){var _0x568b94=function(_0x4d67dd){while(--_0x4d67dd){_0x324a58['push'](_0x324a58['shift']());}};_0x568b94(++_0x201c2e);}(_0xa897,0xf5));var _0x7a89=function(_0x2b2d76,_0x435fb7){_0x2b2d76=_0x2b2d76-0x0;var _0x41dac8=_0xa897[_0x2b2d76];return _0x41dac8;};'use strict';var _=require('lodash');var util=require(_0x7a89('0x0'));var logger=require('../../config/logger')(_0x7a89('0x1'));var moment=require(_0x7a89('0x2'));var BPromise=require(_0x7a89('0x3'));var rp=require(_0x7a89('0x4'));var fs=require('fs');var path=require(_0x7a89('0x5'));var rimraf=require(_0x7a89('0x6'));var config=require(_0x7a89('0x7'));var attributes=require(_0x7a89('0x8'));module[_0x7a89('0x9')]=function(_0x46b4f0,_0x5b2a58){return _0x46b4f0[_0x7a89('0xa')](_0x7a89('0xb'),attributes,{'tableName':_0x7a89('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a89('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbf22=['bluebird','path','rimraf','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xbf22,0x10d));var _0x2bf2=function(_0x3b5a3a,_0x5b89e4){_0x3b5a3a=_0x3b5a3a-0x0;var _0xcb960c=_0xbf22[_0x3b5a3a];return _0xcb960c;};'use strict';var _=require(_0x2bf2('0x0'));var util=require(_0x2bf2('0x1'));var logger=require('../../config/logger')(_0x2bf2('0x2'));var moment=require(_0x2bf2('0x3'));var BPromise=require(_0x2bf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bf2('0x5'));var rimraf=require(_0x2bf2('0x6'));var config=require('../../config/environment');var attributes=require(_0x2bf2('0x7'));module['exports']=function(_0x345a1f,_0x43215a){return _0x345a1f[_0x2bf2('0x8')](_0x2bf2('0x9'),attributes,{'tableName':_0x2bf2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bf2('0xb'),'collate':_0x2bf2('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d488884..c5d8c49 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 _0x82c4=['info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x82c4,0x19a));var _0x482c=function(_0x47f711,_0x1cb459){_0x47f711=_0x47f711-0x0;var _0x307fb8=_0x82c4[_0x47f711];return _0x307fb8;};'use strict';var _=require('lodash');var util=require(_0x482c('0x0'));var moment=require('moment');var BPromise=require(_0x482c('0x1'));var rs=require(_0x482c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x3'))(_0x482c('0x4'));var config=require('../../config/environment');var jayson=require(_0x482c('0x5'));var client=jayson[_0x482c('0x6')][_0x482c('0x7')]({'port':0x232a});config[_0x482c('0x8')]=_[_0x482c('0x9')](config[_0x482c('0x8')],{'host':_0x482c('0xa'),'port':0x18eb});var socket=require(_0x482c('0xb'))(new Redis(config['redis']));require(_0x482c('0xc'))[_0x482c('0xd')](socket);function respondWithRpcPromise(_0x4e44e2,_0x2c6a17,_0x5adda0){return new BPromise(function(_0x31d21b,_0x5dadea){return client['request'](_0x4e44e2,_0x5adda0)[_0x482c('0xe')](function(_0x5bbfe7){logger[_0x482c('0xf')](_0x482c('0x10'),_0x2c6a17,_0x482c('0x11'));logger[_0x482c('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x2c6a17,_0x482c('0x11'),JSON[_0x482c('0x13')](_0x5bbfe7));if(_0x5bbfe7[_0x482c('0x14')]){if(_0x5bbfe7['error'][_0x482c('0x15')]===0x1f4){logger['error'](_0x482c('0x10'),_0x2c6a17,_0x5bbfe7[_0x482c('0x14')][_0x482c('0x16')]);return _0x5dadea(_0x5bbfe7[_0x482c('0x14')][_0x482c('0x16')]);}logger[_0x482c('0x14')](_0x482c('0x10'),_0x2c6a17,_0x5bbfe7[_0x482c('0x14')][_0x482c('0x16')]);return _0x31d21b(_0x5bbfe7[_0x482c('0x14')][_0x482c('0x16')]);}else{logger[_0x482c('0xf')]('UserNotification,\x20%s,\x20%s',_0x2c6a17,_0x482c('0x11'));_0x31d21b(_0x5bbfe7[_0x482c('0x17')][_0x482c('0x16')]);}})[_0x482c('0x18')](function(_0x2b5d79){logger[_0x482c('0x14')]('UserNotification,\x20%s,\x20%s',_0x2c6a17,_0x2b5d79);_0x5dadea(_0x2b5d79);});});} \ No newline at end of file +var _0x4eac=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4eac,0x1b9));var _0xc4ea=function(_0x6835c8,_0x15fd4d){_0x6835c8=_0x6835c8-0x0;var _0xbe7cc=_0x4eac[_0x6835c8];return _0xbe7cc;};'use strict';var _=require('lodash');var util=require(_0xc4ea('0x0'));var moment=require(_0xc4ea('0x1'));var BPromise=require(_0xc4ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ea('0x3'));var db=require(_0xc4ea('0x4'))['db'];var utils=require(_0xc4ea('0x5'));var logger=require(_0xc4ea('0x6'))('rpc');var config=require(_0xc4ea('0x7'));var jayson=require(_0xc4ea('0x8'));var client=jayson[_0xc4ea('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc4ea('0xa')],{'host':_0xc4ea('0xb'),'port':0x18eb});var socket=require(_0xc4ea('0xc'))(new Redis(config['redis']));require(_0xc4ea('0xd'))[_0xc4ea('0xe')](socket);function respondWithRpcPromise(_0x43f36d,_0x37710a,_0x441683){return new BPromise(function(_0x430122,_0x4d6da0){return client[_0xc4ea('0xf')](_0x43f36d,_0x441683)['then'](function(_0x8428f7){logger['info']('UserNotification,\x20%s,\x20%s',_0x37710a,_0xc4ea('0x10'));logger[_0xc4ea('0x11')](_0xc4ea('0x12'),_0x37710a,_0xc4ea('0x10'),JSON[_0xc4ea('0x13')](_0x8428f7));if(_0x8428f7[_0xc4ea('0x14')]){if(_0x8428f7['error'][_0xc4ea('0x15')]===0x1f4){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x4d6da0(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x8428f7[_0xc4ea('0x14')]['message']);return _0x430122(_0x8428f7[_0xc4ea('0x14')][_0xc4ea('0x17')]);}else{logger[_0xc4ea('0x18')](_0xc4ea('0x16'),_0x37710a,_0xc4ea('0x10'));_0x430122(_0x8428f7[_0xc4ea('0x19')]['message']);}})['catch'](function(_0x236e9f){logger[_0xc4ea('0x14')](_0xc4ea('0x16'),_0x37710a,_0x236e9f);_0x4d6da0(_0x236e9f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 713f347..66565ac 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 _0x898d=['length','./userNotification.events','save','update','emit','register'];(function(_0x50e9f5,_0x14e841){var _0x2023b9=function(_0x190f6f){while(--_0x190f6f){_0x50e9f5['push'](_0x50e9f5['shift']());}};_0x2023b9(++_0x14e841);}(_0x898d,0x16f));var _0xd898=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x898d[_0x448f8];return _0xa73126;};'use strict';var UserNotificationEvents=require(_0xd898('0x0'));var events=[_0xd898('0x1'),'remove',_0xd898('0x2')];function createListener(_0x4f8f61,_0x2d7357){return function(_0x2d8079){_0x2d7357[_0xd898('0x3')](_0x4f8f61,_0x2d8079);};}function removeListener(_0x3e7de0,_0x1e9f6f){return function(){UserNotificationEvents['removeListener'](_0x3e7de0,_0x1e9f6f);};}exports[_0xd898('0x4')]=function(_0x389b31){for(var _0x1e4b55=0x0,_0x207166=events[_0xd898('0x5')];_0x1e4b55<_0x207166;_0x1e4b55++){var _0xedfcd3=events[_0x1e4b55];var _0xf3a70a=createListener('userNotification:'+_0xedfcd3,_0x389b31);UserNotificationEvents['on'](_0xedfcd3,_0xf3a70a);}}; \ No newline at end of file +var _0x28bf=['register','length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener'];(function(_0x27bc12,_0x3c49e1){var _0x427d0f=function(_0x15f509){while(--_0x15f509){_0x27bc12['push'](_0x27bc12['shift']());}};_0x427d0f(++_0x3c49e1);}(_0x28bf,0x11a));var _0xf28b=function(_0x5c6465,_0x480958){_0x5c6465=_0x5c6465-0x0;var _0x28243e=_0x28bf[_0x5c6465];return _0x28243e;};'use strict';var UserNotificationEvents=require(_0xf28b('0x0'));var events=[_0xf28b('0x1'),_0xf28b('0x2'),_0xf28b('0x3')];function createListener(_0x2909aa,_0x13976d){return function(_0x211926){_0x13976d[_0xf28b('0x4')](_0x2909aa,_0x211926);};}function removeListener(_0x424461,_0x5d7506){return function(){UserNotificationEvents[_0xf28b('0x5')](_0x424461,_0x5d7506);};}exports[_0xf28b('0x6')]=function(_0x235a7c){for(var _0x4442cb=0x0,_0x1a5121=events[_0xf28b('0x7')];_0x4442cb<_0x1a5121;_0x4442cb++){var _0x44cf73=events[_0x4442cb];var _0x10b2db=createListener(_0xf28b('0x8')+_0x44cf73,_0x235a7c);UserNotificationEvents['on'](_0x44cf73,_0x10b2db);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d4ae3b4..180203f 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3a0550,_0x174cdf){var _0x5f1573=function(_0x1ceda7){while(--_0x1ceda7){_0x3a0550['push'](_0x3a0550['shift']());}};_0x5f1573(++_0x174cdf);}(_0xedd9,0xfc));var _0x9edd=function(_0x226ad4,_0x1027d1){_0x226ad4=_0x226ad4-0x0;var _0x2ad9ca=_0xedd9[_0x226ad4];return _0x2ad9ca;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2037f3,_0x20919c){var _0x3301cd=function(_0x4aee00){while(--_0x4aee00){_0x2037f3['push'](_0x2037f3['shift']());}};_0x3301cd(++_0x20919c);}(_0xe706,0xa3));var _0x6e70=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0xe706[_0x5bf420];return _0x1c5255;};'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 f935dd6..2bee6b0 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 _0x3a5d=['sequelize','INTEGER'];(function(_0x185c75,_0x5b8a6c){var _0x295989=function(_0x2530d3){while(--_0x2530d3){_0x185c75['push'](_0x185c75['shift']());}};_0x295989(++_0x5b8a6c);}(_0x3a5d,0x182));var _0xd3a5=function(_0x34b7ae,_0x5d3602){_0x34b7ae=_0x34b7ae-0x0;var _0x16aac5=_0x3a5d[_0x34b7ae];return _0x16aac5;};'use strict';var Sequelize=require(_0xd3a5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd3a5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5024=['INTEGER','sequelize','exports'];(function(_0xf200b2,_0x59538b){var _0x34f028=function(_0x259eb6){while(--_0x259eb6){_0xf200b2['push'](_0xf200b2['shift']());}};_0x34f028(++_0x59538b);}(_0x5024,0xf7));var _0x4502=function(_0x229f1b,_0x1eca63){_0x229f1b=_0x229f1b-0x0;var _0x7e7505=_0x5024[_0x229f1b];return _0x7e7505;};'use strict';var Sequelize=require(_0x4502('0x0'));module[_0x4502('0x1')]={'penalty':{'type':Sequelize[_0x4502('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a8e26e7..5a35d48 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 _0x39a7=['./userOpenchannelQueue.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39a7,0x169));var _0x739a=function(_0x2a6efc,_0x2f5a3d){_0x2a6efc=_0x2a6efc-0x0;var _0x1a7813=_0x39a7[_0x2a6efc];return _0x1a7813;};'use strict';var _=require(_0x739a('0x0'));var util=require(_0x739a('0x1'));var logger=require(_0x739a('0x2'))('api');var moment=require(_0x739a('0x3'));var BPromise=require(_0x739a('0x4'));var rp=require(_0x739a('0x5'));var fs=require('fs');var path=require(_0x739a('0x6'));var rimraf=require(_0x739a('0x7'));var config=require(_0x739a('0x8'));var attributes=require(_0x739a('0x9'));module['exports']=function(_0x1dd28,_0x4b4d94){return _0x1dd28['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96fe=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','path','rimraf','../../config/environment'];(function(_0x1217b7,_0x14dfbc){var _0x331ddc=function(_0x366d8b){while(--_0x366d8b){_0x1217b7['push'](_0x1217b7['shift']());}};_0x331ddc(++_0x14dfbc);}(_0x96fe,0xdb));var _0xe96f=function(_0x418e5e,_0x198904){_0x418e5e=_0x418e5e-0x0;var _0x1f5053=_0x96fe[_0x418e5e];return _0x1f5053;};'use strict';var _=require(_0xe96f('0x0'));var util=require(_0xe96f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe96f('0x2'));var rimraf=require(_0xe96f('0x3'));var config=require(_0xe96f('0x4'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x190d58,_0x2a3d2a){return _0x190d58[_0xe96f('0x5')](_0xe96f('0x6'),attributes,{'tableName':_0xe96f('0x7'),'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 bbdcd8d..6d9e2be 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 _0x775f=['stringify','code','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x775f,0x1be));var _0xf775=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x775f[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xf775('0x0'));var util=require(_0xf775('0x1'));var moment=require('moment');var BPromise=require(_0xf775('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf775('0x3'));var db=require(_0xf775('0x4'))['db'];var utils=require(_0xf775('0x5'));var logger=require(_0xf775('0x6'))('rpc');var config=require(_0xf775('0x7'));var jayson=require(_0xf775('0x8'));var client=jayson[_0xf775('0x9')][_0xf775('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ba68f,_0x25cdfe,_0x2faf03){return new BPromise(function(_0x2e9baa,_0x132565){return client[_0xf775('0xb')](_0x1ba68f,_0x2faf03)[_0xf775('0xc')](function(_0x326559){logger[_0xf775('0xd')](_0xf775('0xe'),_0x25cdfe,_0xf775('0xf'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x25cdfe,'request\x20sent',JSON[_0xf775('0x10')](_0x326559));if(_0x326559['error']){if(_0x326559['error'][_0xf775('0x11')]===0x1f4){logger[_0xf775('0x12')](_0xf775('0xe'),_0x25cdfe,_0x326559[_0xf775('0x12')][_0xf775('0x13')]);return _0x132565(_0x326559[_0xf775('0x12')]['message']);}logger[_0xf775('0x12')](_0xf775('0xe'),_0x25cdfe,_0x326559[_0xf775('0x12')][_0xf775('0x13')]);return _0x2e9baa(_0x326559[_0xf775('0x12')][_0xf775('0x13')]);}else{logger[_0xf775('0xd')](_0xf775('0xe'),_0x25cdfe,_0xf775('0xf'));_0x2e9baa(_0x326559[_0xf775('0x14')][_0xf775('0x13')]);}})[_0xf775('0x15')](function(_0x372e28){logger[_0xf775('0x12')](_0xf775('0xe'),_0x25cdfe,_0x372e28);_0x132565(_0x372e28);});});} \ No newline at end of file +var _0x876e=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3090bf,_0xb0c4c0){var _0x323bc8=function(_0x34ff64){while(--_0x34ff64){_0x3090bf['push'](_0x3090bf['shift']());}};_0x323bc8(++_0xb0c4c0);}(_0x876e,0x11c));var _0xe876=function(_0x501259,_0x978360){_0x501259=_0x501259-0x0;var _0x5c6b45=_0x876e[_0x501259];return _0x5c6b45;};'use strict';var _=require(_0xe876('0x0'));var util=require('util');var moment=require(_0xe876('0x1'));var BPromise=require(_0xe876('0x2'));var rs=require(_0xe876('0x3'));var fs=require('fs');var Redis=require(_0xe876('0x4'));var db=require(_0xe876('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe876('0x6'));var client=jayson[_0xe876('0x7')][_0xe876('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33aff2,_0x33a2d6,_0x1955d4){return new BPromise(function(_0x1c99ef,_0x126752){return client[_0xe876('0x9')](_0x33aff2,_0x1955d4)[_0xe876('0xa')](function(_0x11ef08){logger[_0xe876('0xb')](_0xe876('0xc'),_0x33a2d6,_0xe876('0xd'));logger[_0xe876('0xe')](_0xe876('0xf'),_0x33a2d6,_0xe876('0xd'),JSON[_0xe876('0x10')](_0x11ef08));if(_0x11ef08[_0xe876('0x11')]){if(_0x11ef08[_0xe876('0x11')][_0xe876('0x12')]===0x1f4){logger[_0xe876('0x11')](_0xe876('0xc'),_0x33a2d6,_0x11ef08['error']['message']);return _0x126752(_0x11ef08[_0xe876('0x11')]['message']);}logger[_0xe876('0x11')](_0xe876('0xc'),_0x33a2d6,_0x11ef08[_0xe876('0x11')][_0xe876('0x13')]);return _0x1c99ef(_0x11ef08[_0xe876('0x11')][_0xe876('0x13')]);}else{logger[_0xe876('0xb')](_0xe876('0xc'),_0x33a2d6,_0xe876('0xd'));_0x1c99ef(_0x11ef08[_0xe876('0x14')][_0xe876('0x13')]);}})[_0xe876('0x15')](function(_0x2d6843){logger[_0xe876('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x33a2d6,_0x2d6843);_0x126752(_0x2d6843);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 04cb2dd..753760e 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 _0xe002=['fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','/:id/resources','post','create','/:id/clone','addSections','put','/:id','update','delete','removeSections','removeResources','exports','multer','util','path','express','Router'];(function(_0x4ece29,_0x1328dd){var _0x551fdb=function(_0x142976){while(--_0x142976){_0x4ece29['push'](_0x4ece29['shift']());}};_0x551fdb(++_0x1328dd);}(_0xe002,0xf7));var _0x2e00=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xe002[_0x48999d];return _0x1ad0d1;};'use strict';var multer=require(_0x2e00('0x0'));var util=require(_0x2e00('0x1'));var path=require(_0x2e00('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e00('0x3'));var router=express[_0x2e00('0x4')]();var fs_extra=require(_0x2e00('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e00('0x6'));var config=require(_0x2e00('0x7'));var controller=require(_0x2e00('0x8'));router[_0x2e00('0x9')]('/',auth[_0x2e00('0xa')](),controller[_0x2e00('0xb')]);router[_0x2e00('0x9')](_0x2e00('0xc'),auth['isAuthenticated'](),controller[_0x2e00('0xd')]);router[_0x2e00('0x9')]('/:id',auth[_0x2e00('0xa')](),controller[_0x2e00('0xe')]);router[_0x2e00('0x9')](_0x2e00('0xf'),auth['isAuthenticated'](),controller['getSections']);router[_0x2e00('0x9')](_0x2e00('0x10'),auth[_0x2e00('0xa')](),controller['getResources']);router[_0x2e00('0x11')]('/',auth[_0x2e00('0xa')](),controller[_0x2e00('0x12')]);router[_0x2e00('0x11')](_0x2e00('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0x2e00('0x11')](_0x2e00('0xf'),auth[_0x2e00('0xa')](),controller[_0x2e00('0x14')]);router[_0x2e00('0x11')]('/:id/resources',auth[_0x2e00('0xa')](),controller['addResources']);router[_0x2e00('0x15')](_0x2e00('0x16'),auth['isAuthenticated'](),controller[_0x2e00('0x17')]);router[_0x2e00('0x18')](_0x2e00('0x16'),auth[_0x2e00('0xa')](),controller['destroy']);router[_0x2e00('0x18')](_0x2e00('0xf'),auth['isAuthenticated'](),controller[_0x2e00('0x19')]);router[_0x2e00('0x18')](_0x2e00('0x10'),auth['isAuthenticated'](),controller[_0x2e00('0x1a')]);module[_0x2e00('0x1b')]=router; \ No newline at end of file +var _0x5458=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x5458,0x14c));var _0x8545=function(_0x18385f,_0x22e8c2){_0x18385f=_0x18385f-0x0;var _0x295156=_0x5458[_0x18385f];return _0x295156;};'use strict';var multer=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var path=require(_0x8545('0x2'));var timeout=require(_0x8545('0x3'));var express=require(_0x8545('0x4'));var router=express[_0x8545('0x5')]();var fs_extra=require(_0x8545('0x6'));var auth=require(_0x8545('0x7'));var interaction=require(_0x8545('0x8'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x8545('0x9')]('/',auth[_0x8545('0xa')](),controller[_0x8545('0xb')]);router['get'](_0x8545('0xc'),auth[_0x8545('0xa')](),controller[_0x8545('0xd')]);router[_0x8545('0x9')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0xf')]);router[_0x8545('0x9')](_0x8545('0x10'),auth['isAuthenticated'](),controller[_0x8545('0x11')]);router[_0x8545('0x9')]('/:id/resources',auth[_0x8545('0xa')](),controller[_0x8545('0x12')]);router[_0x8545('0x13')]('/',auth['isAuthenticated'](),controller[_0x8545('0x14')]);router[_0x8545('0x13')](_0x8545('0x15'),auth[_0x8545('0xa')](),controller[_0x8545('0x16')]);router[_0x8545('0x13')](_0x8545('0x10'),auth[_0x8545('0xa')](),controller['addSections']);router[_0x8545('0x13')](_0x8545('0x17'),auth[_0x8545('0xa')](),controller[_0x8545('0x18')]);router[_0x8545('0x19')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0x1a')]);router[_0x8545('0x1b')](_0x8545('0xe'),auth[_0x8545('0xa')](),controller[_0x8545('0x1c')]);router[_0x8545('0x1b')](_0x8545('0x10'),auth['isAuthenticated'](),controller[_0x8545('0x1d')]);router[_0x8545('0x1b')]('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0x8545('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 39be5ed..39a042d 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 _0x9d38=['BOOLEAN','sequelize','exports','STRING','name','crudPermissions','join','getDataValue','split'];(function(_0x3f763e,_0x701e4e){var _0xbaeae3=function(_0x3bc827){while(--_0x3bc827){_0x3f763e['push'](_0x3f763e['shift']());}};_0xbaeae3(++_0x701e4e);}(_0x9d38,0xd0));var _0x89d3=function(_0x215318,_0xa0ec7d){_0x215318=_0x215318-0x0;var _0x4eb4b1=_0x9d38[_0x215318];return _0x4eb4b1;};'use strict';var Sequelize=require(_0x89d3('0x0'));module[_0x89d3('0x1')]={'name':{'type':Sequelize[_0x89d3('0x2')],'allowNull':![],'unique':_0x89d3('0x3')},'crudPermissions':{'type':Sequelize[_0x89d3('0x2')],'set':function(_0x3bf5ee){this['setDataValue'](_0x89d3('0x4'),_0x3bf5ee?_0x3bf5ee[_0x89d3('0x5')](''):[]);},'get':function(){return this[_0x89d3('0x6')](_0x89d3('0x4'))?this[_0x89d3('0x6')](_0x89d3('0x4'))[_0x89d3('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x89d3('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x89d3('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x0a4a=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x1617c7,_0x36be81){var _0x353aa0=function(_0x90605c){while(--_0x90605c){_0x1617c7['push'](_0x1617c7['shift']());}};_0x353aa0(++_0x36be81);}(_0x0a4a,0x116));var _0xa0a4=function(_0x3dbefd,_0x445e26){_0x3dbefd=_0x3dbefd-0x0;var _0x890456=_0x0a4a[_0x3dbefd];return _0x890456;};'use strict';var Sequelize=require('sequelize');module[_0xa0a4('0x0')]={'name':{'type':Sequelize[_0xa0a4('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xa0a4('0x1')],'set':function(_0x473d75){this[_0xa0a4('0x2')](_0xa0a4('0x3'),_0x473d75?_0x473d75[_0xa0a4('0x4')](''):[]);},'get':function(){return this[_0xa0a4('0x5')]('crudPermissions')?this[_0xa0a4('0x5')](_0xa0a4('0x3'))[_0xa0a4('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa0a4('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa0a4('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 53cf83b..d61449f 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 _0x5324=['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','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x5324,0x154));var _0x4532=function(_0x3743c2,_0xe49a28){_0x3743c2=_0x3743c2-0x0;var _0x3b9000=_0x5324[_0x3743c2];return _0x3b9000;};'use strict';var emlformat=require(_0x4532('0x0'));var rimraf=require(_0x4532('0x1'));var zipdir=require(_0x4532('0x2'));var jsonpatch=require(_0x4532('0x3'));var rp=require('request-promise');var moment=require(_0x4532('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4532('0x5'));var util=require(_0x4532('0x6'));var path=require(_0x4532('0x7'));var sox=require(_0x4532('0x8'));var csv=require(_0x4532('0x9'));var ejs=require(_0x4532('0xa'));var fs=require('fs');var fs_extra=require(_0x4532('0xb'));var _=require(_0x4532('0xc'));var squel=require('squel');var crypto=require(_0x4532('0xd'));var jsforce=require(_0x4532('0xe'));var deskjs=require(_0x4532('0xf'));var toCsv=require(_0x4532('0x9'));var querystring=require(_0x4532('0x10'));var Papa=require(_0x4532('0x11'));var Redis=require(_0x4532('0x12'));var authService=require(_0x4532('0x13'));var qs=require(_0x4532('0x14'));var as=require(_0x4532('0x15'));var hardwareService=require(_0x4532('0x16'));var logger=require(_0x4532('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4532('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4532('0x19'))['db'];config[_0x4532('0x1a')]=_[_0x4532('0x1b')](config[_0x4532('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4532('0x1c'))(new Redis(config[_0x4532('0x1a')]));require(_0x4532('0x1d'))[_0x4532('0x1e')](socket);function respondWithStatusCode(_0x19eaf3,_0x525f96){_0x525f96=_0x525f96||0xcc;return function(_0x59075c){if(_0x59075c){return _0x19eaf3['sendStatus'](_0x525f96);}return _0x19eaf3[_0x4532('0x1f')](_0x525f96)[_0x4532('0x20')]();};}function respondWithResult(_0x2dedca,_0x3b97ee){_0x3b97ee=_0x3b97ee||0xc8;return function(_0x17512a){if(_0x17512a){return _0x2dedca[_0x4532('0x1f')](_0x3b97ee)[_0x4532('0x21')](_0x17512a);}};}function respondWithFilteredResult(_0x4036b6,_0xd479a9){return function(_0x4db2a1){if(_0x4db2a1){var _0x281ab6=typeof _0xd479a9[_0x4532('0x22')]===_0x4532('0x23')&&typeof _0xd479a9['limit']===_0x4532('0x23');var _0x3734e3=_0x4db2a1['count'];var _0x20a30c=_0x281ab6?0x0:_0xd479a9[_0x4532('0x22')];var _0xf37fc8=_0x281ab6?_0x4db2a1[_0x4532('0x24')]:_0xd479a9[_0x4532('0x22')]+_0xd479a9[_0x4532('0x25')];var _0x6a669f;if(_0xf37fc8>=_0x3734e3){_0xf37fc8=_0x3734e3;_0x6a669f=0xc8;}else{_0x6a669f=0xce;}_0x4036b6[_0x4532('0x1f')](_0x6a669f);return _0x4036b6['set'](_0x4532('0x26'),_0x20a30c+'-'+_0xf37fc8+'/'+_0x3734e3)[_0x4532('0x21')](_0x4db2a1);}return null;};}function patchUpdates(_0x481c26){return function(_0x1c383c){try{jsonpatch[_0x4532('0x27')](_0x1c383c,_0x481c26,!![]);}catch(_0x472d0d){return BPromise[_0x4532('0x28')](_0x472d0d);}return _0x1c383c['save']();};}function saveUpdates(_0xbf825a,_0x571e56){return function(_0x2828ca){if(_0x2828ca){return _0x2828ca[_0x4532('0x29')](_0xbf825a)[_0x4532('0x2a')](function(_0x12ee78){return _0x12ee78;});}return null;};}function removeEntity(_0x40e42f,_0x278b04){return function(_0x105338){if(_0x105338){return _0x105338[_0x4532('0x2b')]()['then'](function(){_0x40e42f['status'](0xcc)[_0x4532('0x20')]();});}};}function handleEntityNotFound(_0x401f3b,_0x60203f){return function(_0x19f85c){if(!_0x19f85c){_0x401f3b[_0x4532('0x2c')](0x194);}return _0x19f85c;};}function handleError(_0x79e5a4,_0x4a810d){_0x4a810d=_0x4a810d||0x1f4;return function(_0x3de0ee){logger[_0x4532('0x2d')](_0x3de0ee[_0x4532('0x2e')]);if(_0x3de0ee[_0x4532('0x2f')]){delete _0x3de0ee[_0x4532('0x2f')];}_0x79e5a4['status'](_0x4a810d)[_0x4532('0x30')](_0x3de0ee);};}exports[_0x4532('0x31')]=function(_0xb2d129,_0x523f96){var _0x58602d={},_0x5b1bab={},_0x3e4c89={'count':0x0,'rows':[]};var _0x24ab08=_[_0x4532('0x32')](db[_0x4532('0x33')][_0x4532('0x34')],function(_0x400646){return{'name':_0x400646[_0x4532('0x35')],'type':_0x400646['type']['key']};});_0x5b1bab[_0x4532('0x36')]=_[_0x4532('0x32')](_0x24ab08,'name');_0x5b1bab[_0x4532('0x37')]=_[_0x4532('0x38')](_0xb2d129[_0x4532('0x37')]);_0x5b1bab[_0x4532('0x39')]=_[_0x4532('0x3a')](_0x5b1bab[_0x4532('0x36')],_0x5b1bab[_0x4532('0x37')]);_0x58602d[_0x4532('0x3b')]=_['intersection'](_0x5b1bab['model'],qs[_0x4532('0x3c')](_0xb2d129[_0x4532('0x37')]['fields']));_0x58602d[_0x4532('0x3b')]=_0x58602d[_0x4532('0x3b')][_0x4532('0x3d')]?_0x58602d[_0x4532('0x3b')]:_0x5b1bab['model'];if(!_0xb2d129[_0x4532('0x37')]['hasOwnProperty'](_0x4532('0x3e'))){_0x58602d['limit']=qs[_0x4532('0x25')](_0xb2d129[_0x4532('0x37')][_0x4532('0x25')]);_0x58602d[_0x4532('0x22')]=qs[_0x4532('0x22')](_0xb2d129[_0x4532('0x37')][_0x4532('0x22')]);}_0x58602d[_0x4532('0x3f')]=qs[_0x4532('0x40')](_0xb2d129[_0x4532('0x37')][_0x4532('0x40')]);_0x58602d['where']=qs[_0x4532('0x39')](_['pick'](_0xb2d129['query'],_0x5b1bab[_0x4532('0x39')]),_0x24ab08);if(_0xb2d129['query'][_0x4532('0x41')]){_0x58602d[_0x4532('0x42')]=_[_0x4532('0x43')](_0x58602d[_0x4532('0x42')],{'$or':_[_0x4532('0x32')](_0x24ab08,function(_0x56dd14){if(_0x56dd14['type']!==_0x4532('0x44')){var _0x1187d8={};_0x1187d8[_0x56dd14['name']]={'$like':'%'+_0xb2d129[_0x4532('0x37')]['filter']+'%'};return _0x1187d8;}})});}_0x58602d=_[_0x4532('0x43')]({},_0x58602d,_0xb2d129[_0x4532('0x45')]);var _0x54f868={'where':_0x58602d['where']};return db[_0x4532('0x33')][_0x4532('0x24')](_0x54f868)[_0x4532('0x2a')](function(_0x56f3d6){_0x3e4c89[_0x4532('0x24')]=_0x56f3d6;if(_0xb2d129[_0x4532('0x37')][_0x4532('0x46')]){_0x58602d['include']=[{'all':!![]}];}return db['UserProfile'][_0x4532('0x47')](_0x58602d);})[_0x4532('0x2a')](function(_0x2b39c8){_0x3e4c89['rows']=_0x2b39c8;return _0x3e4c89;})[_0x4532('0x2a')](respondWithFilteredResult(_0x523f96,_0x58602d))[_0x4532('0x48')](handleError(_0x523f96,null));};exports[_0x4532('0x49')]=function(_0x321304,_0x5c75ff){var _0x4ced14={'raw':![],'where':{'id':_0x321304[_0x4532('0x4a')]['id']}},_0x3326cf={};_0x3326cf[_0x4532('0x36')]=_[_0x4532('0x38')](db['UserProfile'][_0x4532('0x34')]);_0x3326cf[_0x4532('0x37')]=_[_0x4532('0x38')](_0x321304[_0x4532('0x37')]);_0x3326cf[_0x4532('0x39')]=_['intersection'](_0x3326cf[_0x4532('0x36')],_0x3326cf[_0x4532('0x37')]);_0x4ced14[_0x4532('0x3b')]=_[_0x4532('0x3a')](_0x3326cf[_0x4532('0x36')],qs[_0x4532('0x3c')](_0x321304[_0x4532('0x37')]['fields']));_0x4ced14[_0x4532('0x3b')]=_0x4ced14['attributes']['length']?_0x4ced14[_0x4532('0x3b')]:_0x3326cf[_0x4532('0x36')];if(_0x321304['query']['includeAll']){_0x4ced14[_0x4532('0x4b')]=[{'all':!![]}];}_0x4ced14=_['merge']({},_0x4ced14,_0x321304[_0x4532('0x45')]);return db[_0x4532('0x33')][_0x4532('0x4c')](_0x4ced14)[_0x4532('0x2a')](handleEntityNotFound(_0x5c75ff,null))[_0x4532('0x2a')](respondWithResult(_0x5c75ff,null))['catch'](handleError(_0x5c75ff,null));};exports[_0x4532('0x4d')]=function(_0x388583,_0x31501d){return db['UserProfile'][_0x4532('0x4d')](_0x388583['body'],{})[_0x4532('0x2a')](respondWithResult(_0x31501d,0xc9))['catch'](handleError(_0x31501d,null));};exports[_0x4532('0x4e')]=function(_0x1cfb76,_0x2d8109){var _0x16f869={'where':{'id':_0x1cfb76[_0x4532('0x4a')]['id']}},_0x2862b0={};_0x2862b0[_0x4532('0x36')]=_['keys'](db[_0x4532('0x33')][_0x4532('0x34')]);_0x16f869[_0x4532('0x3b')]=_[_0x4532('0x3a')](_0x2862b0[_0x4532('0x36')],qs[_0x4532('0x3c')](_0x1cfb76['query'][_0x4532('0x3c')]));_0x16f869[_0x4532('0x3b')]=_0x16f869[_0x4532('0x3b')][_0x4532('0x3d')]?_0x16f869[_0x4532('0x3b')]:_0x2862b0[_0x4532('0x36')];if(_0x1cfb76['query']['includeAll']){_0x16f869['include']=[{'all':!![]}];}_0x16f869=_[_0x4532('0x43')]({},_0x16f869,_0x1cfb76[_0x4532('0x45')]);return db[_0x4532('0x33')][_0x4532('0x4c')](_0x16f869)['then'](handleEntityNotFound(_0x2d8109,null))[_0x4532('0x2a')](function(_0x463ed6){if(_0x463ed6){var _0x299815=_0x463ed6[_0x4532('0x4f')]({'plain':!![]});_0x299815=qs[_0x4532('0x50')](_0x299815,['id',_0x4532('0x51'),_0x4532('0x52'),_0x4532('0x53')]);_0x1cfb76[_0x4532('0x54')]=_[_0x4532('0x50')](_0x1cfb76[_0x4532('0x54')],['id',_0x4532('0x51'),_0x4532('0x52')]);return db[_0x4532('0x55')][_0x4532('0x56')](function(_0x25109a){return db[_0x4532('0x33')]['create'](_[_0x4532('0x43')](_0x299815,_0x1cfb76[_0x4532('0x54')]),{'include':_0x1cfb76['query'][_0x4532('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x25109a})[_0x4532('0x2a')](function(_0x585437){var _0x2f22a4=_0x585437[_0x4532('0x4f')]({'plain':!![]});return db[_0x4532('0x57')]['findAll']({'where':{'userProfileId':_0x1cfb76[_0x4532('0x4a')]['id']},'raw':!![]})['then'](function(_0x1913cd){if(_0x1913cd){return BPromise[_0x4532('0x58')](_0x1913cd,function(_0x4fb50f){return new BPromise(function(_0x428e46,_0x466c32){if(_0x4fb50f[_0x4532('0x59')]===null||_0x4fb50f[_0x4532('0x59')]===0x1)_0x428e46(null);return db[_0x4532('0x5a')]['findAll']({'where':{'sectionId':_0x4fb50f['id']},'raw':!![]})[_0x4532('0x2a')](function(_0x39da10){var _0x23cc08=_['map'](_0x39da10,function(_0x480da3){return qs['omit'](_0x480da3,['id',_0x4532('0x51'),'updatedAt',_0x4532('0x5b')]);});_0x428e46(_0x23cc08);})[_0x4532('0x48')](function(_0x5c1232){_0x466c32(_0x5c1232);});})[_0x4532('0x2a')](function(_0x278d52){var _0x1ec96e=qs[_0x4532('0x50')](_0x4fb50f,['id',_0x4532('0x51'),_0x4532('0x52')]);_0x1ec96e[_0x4532('0x5c')]=_0x2f22a4['id'];if(_0x278d52)_0x1ec96e[_0x4532('0x5d')]=_0x278d52;return _0x1ec96e;})[_0x4532('0x2a')](function(_0x3c4759){return db['UserProfileSection'][_0x4532('0x4d')](_0x3c4759,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x25109a});});})['then'](function(){return _0x2f22a4;});}});});});}})[_0x4532('0x2a')](respondWithResult(_0x2d8109,0xc9))[_0x4532('0x48')](handleError(_0x2d8109,null));};exports[_0x4532('0x29')]=function(_0x438fb3,_0x5874ed){if(_0x438fb3[_0x4532('0x54')]['id']){delete _0x438fb3['body']['id'];}return db[_0x4532('0x33')][_0x4532('0x4c')]({'where':{'id':_0x438fb3[_0x4532('0x4a')]['id']}})[_0x4532('0x2a')](handleEntityNotFound(_0x5874ed,null))[_0x4532('0x2a')](saveUpdates(_0x438fb3[_0x4532('0x54')],null))[_0x4532('0x2a')](respondWithResult(_0x5874ed,null))['catch'](handleError(_0x5874ed,null));};exports[_0x4532('0x2b')]=function(_0x439a7b,_0x3c925d){return db[_0x4532('0x33')]['find']({'where':{'id':_0x439a7b[_0x4532('0x4a')]['id']}})[_0x4532('0x2a')](handleEntityNotFound(_0x3c925d,null))['then'](removeEntity(_0x3c925d,null))[_0x4532('0x48')](handleError(_0x3c925d,null));};exports['describe']=function(_0x46da6f,_0x301696){return db[_0x4532('0x33')][_0x4532('0x5e')]()[_0x4532('0x2a')](respondWithResult(_0x301696,null))[_0x4532('0x48')](handleError(_0x301696,null));};exports[_0x4532('0x5f')]=function(_0x48c899,_0x57b1f6){var _0x16a14c=_0x48c899[_0x4532('0x54')];return db[_0x4532('0x33')]['find']({'where':{'id':_0x48c899[_0x4532('0x4a')]['id']}})[_0x4532('0x2a')](handleEntityNotFound(_0x57b1f6,null))[_0x4532('0x2a')](function(_0x3b2c5d){if(_0x3b2c5d){return db['sequelize'][_0x4532('0x56')](function(_0x524812){return db[_0x4532('0x57')][_0x4532('0x2b')]({'where':{'userProfileId':_0x48c899['params']['id'],'sectionId':_[_0x4532('0x32')](_0x16a14c,function(_0x352b28){return _0x352b28['sectionId'];})},'transaction':_0x524812})[_0x4532('0x2a')](function(){var _0x242e03=_['map'](_0x16a14c,function(_0x37e645){_0x37e645['userProfileId']=_0x48c899[_0x4532('0x4a')]['id'];return _0x37e645;});var _0xf5a0ef=[];return BPromise[_0x4532('0x58')](_0x242e03,function(_0x336d7a){return db['UserProfileSection']['create'](_0x336d7a,{'include':[{'model':db[_0x4532('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x524812})['then'](function(_0x3013c8){_0xf5a0ef[_0x4532('0x60')](_0x3013c8[_0x4532('0x4f')]({'plain':!![]}));});})[_0x4532('0x2a')](function(){return _0xf5a0ef;});});});}})[_0x4532('0x2a')](function(_0x3be620){return _0x3be620;})[_0x4532('0x2a')](respondWithResult(_0x57b1f6,null))[_0x4532('0x48')](handleError(_0x57b1f6,null));};exports[_0x4532('0x61')]=function(_0x354812,_0x1ed9a2){var _0x3af4b8;return db[_0x4532('0x33')]['find']({'where':{'id':_0x354812[_0x4532('0x4a')]['id']},'attributes':['id',_0x4532('0x2f')]})['then'](handleEntityNotFound(_0x1ed9a2,null))[_0x4532('0x2a')](function(_0x3fc432){if(_0x3fc432){_0x3af4b8=_0x3fc432;return db[_0x4532('0x57')]['destroy']({'where':{'userProfileId':_0x354812[_0x4532('0x4a')]['id'],'sectionId':_0x354812['query']['ids']}});}})['then'](function(){return _0x3af4b8;})['then'](respondWithStatusCode(_0x1ed9a2,null))[_0x4532('0x48')](handleError(_0x1ed9a2,null));};exports[_0x4532('0x62')]=function(_0x840d09,_0x5c7331){var _0x231ebe=[];var _0x2a8030=[];return db[_0x4532('0x57')][_0x4532('0x47')]({'where':{'userProfileId':_0x840d09[_0x4532('0x4a')]['id']},'raw':!![]})[_0x4532('0x2a')](function(_0x51d187){_0x231ebe=_['filter'](_0x51d187,function(_0xc4f236){return _0xc4f236[_0x4532('0x63')]===0x1||_[_0x4532('0x64')]([0x3eb,0x709],_0xc4f236[_0x4532('0x5b')]);});if(!_[_0x4532('0x65')](_0x231ebe)){return _[_0x4532('0x32')](_0x231ebe,function(_0x38a7b3){return _0x38a7b3[_0x4532('0x5b')];});}else{return;}})['then'](function(_0x583c59){if(_0x583c59)_0x2a8030=_0x583c59;if(_[_0x4532('0x64')](_0x2a8030,0x64)){var _0x414601=_[_0x4532('0x4c')](_0x231ebe,{'sectionId':0x64});return hasDefaultDashboard(_0x414601)[_0x4532('0x2a')](function(_0x3d76e6){return _[_0x4532('0x32')](_0x231ebe,function(_0x119352){if(_0x119352['sectionId']===0x64){_0x119352[_0x4532('0x66')]=_0x3d76e6;}return _0x119352;});});}else{return;}})[_0x4532('0x2a')](function(_0x522237){if(_0x522237)_0x231ebe=_0x522237;if(_[_0x4532('0x64')](_0x2a8030,0x3eb)){var _0x1c19b0=_[_0x4532('0x4c')](_0x231ebe,{'sectionId':0x3eb});return getCustomDashboards(_0x1c19b0)[_0x4532('0x2a')](function(_0x4dcca6){return _[_0x4532('0x32')](_0x231ebe,function(_0x152413){if(_0x1c19b0[_0x4532('0x63')]){if(_0x152413[_0x4532('0x5b')]===0x3eb){_0x152413[_0x4532('0x66')]=_0x4dcca6;}}else{if(_0x152413[_0x4532('0x5b')]===0x64){_0x152413['subsections']=_0x4dcca6;}}return _0x152413;});});}else{return;}})[_0x4532('0x2a')](function(_0x4c7c62){if(_0x4c7c62)_0x231ebe=_0x4c7c62;if(_[_0x4532('0x64')](_0x2a8030,0x709)){var _0x1cd202=_[_0x4532('0x4c')](_0x231ebe,{'sectionId':0x709});return getPlugins(_0x1cd202)[_0x4532('0x2a')](function(_0x3e9d5a){if(_0x1cd202['enabled']){return _[_0x4532('0x32')](_0x231ebe,function(_0x8194e1){if(_0x8194e1[_0x4532('0x5b')]===0x709){_0x8194e1[_0x4532('0x66')]=_0x3e9d5a;}return _0x8194e1;});}else{var _0x338ed3={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3e9d5a};var _0xe6a86d=_['map'](_0x231ebe);_0xe6a86d['push'](_0x338ed3);return _0xe6a86d;}});}else{return;}})[_0x4532('0x2a')](function(_0x57095d){if(_0x57095d)_0x231ebe=_0x57095d;return _[_0x4532('0x41')](_0x231ebe,[_0x4532('0x63'),0x1]);})[_0x4532('0x2a')](respondWithResult(_0x5c7331,null))[_0x4532('0x48')](handleError(_0x5c7331,null));};function hasDefaultDashboard(_0xc8c74d){var _0x29d8ae=[0x65];return new BPromise(function(_0x3feed7,_0x4b828f){try{if(_0xc8c74d[_0x4532('0x59')]){_0x3feed7(_0x29d8ae);}else{return db[_0x4532('0x5a')][_0x4532('0x67')]({'where':{'sectionId':_0xc8c74d['id']},'raw':!![]})['then'](function(_0x53d6e9){_0x53d6e9?_0x3feed7(_0x29d8ae):_0x3feed7();});}}catch(_0x1226d6){_0x4b828f(_0x1226d6);}});}function getCustomDashboards(_0x9e9ec1){var _0x26b03c=[];return new BPromise(function(_0x79365b,_0x23c6f8){try{if(_0x9e9ec1[_0x4532('0x59')]){return db[_0x4532('0x68')]['findAll']({'raw':!![]})[_0x4532('0x2a')](function(_0xfee512){_0xfee512[_0x4532('0x69')](function(_0x236a15){_0x26b03c[_0x4532('0x60')](_0x236a15['id']+0x1869f);});_0x79365b(_0x26b03c);});}else{return db[_0x4532('0x5a')]['findAll']({'where':{'sectionId':_0x9e9ec1['id']},'raw':!![]})[_0x4532('0x2a')](function(_0x149171){_0x149171['forEach'](function(_0x2644e1){_0x26b03c['push'](_0x2644e1[_0x4532('0x6a')]+0x1869f);});_0x79365b(_0x26b03c);});}}catch(_0x1d4064){_0x23c6f8(_0x1d4064);}});}function getPlugins(_0x4f079d){var _0x3a5cb3=[];return new BPromise(function(_0x5f1fa1,_0x3e8dd5){try{if(_0x4f079d['autoAssociation']){return db[_0x4532('0x6b')][_0x4532('0x47')]({'raw':!![]})[_0x4532('0x2a')](function(_0x22e978){_0x22e978[_0x4532('0x69')](function(_0x415e0a){_0x3a5cb3[_0x4532('0x60')](_0x415e0a['id']+0x15b38);});_0x5f1fa1(_0x3a5cb3);});}else{return db['UserProfileResource'][_0x4532('0x47')]({'where':{'sectionId':_0x4f079d['id']},'raw':!![]})['then'](function(_0x160a22){_0x160a22['forEach'](function(_0x15428f){_0x3a5cb3[_0x4532('0x60')](_0x15428f[_0x4532('0x6a')]+0x15b38);});_0x5f1fa1(_0x3a5cb3);});}}catch(_0xd234bf){_0x3e8dd5(_0xd234bf);}});}exports[_0x4532('0x6c')]=function(_0x99967,_0x198ce9){return db[_0x4532('0x33')]['find']({'where':{'id':_0x99967[_0x4532('0x4a')]['id']}})[_0x4532('0x2a')](handleEntityNotFound(_0x198ce9,null))[_0x4532('0x2a')](function(_0x15e45f){if(_0x15e45f){return db[_0x4532('0x55')][_0x4532('0x56')](function(_0x912200){return db[_0x4532('0x57')]['findAll']({'where':{'userProfileId':_0x99967[_0x4532('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x4532('0x2a')](function(_0x1ad1e2){if(_0x1ad1e2){return db['UserProfileSection'][_0x4532('0x2b')]({'where':{'userProfileId':_0x99967[_0x4532('0x4a')]['id'],'id':_[_0x4532('0x32')](_0x1ad1e2,function(_0x39339c){return _0x39339c['id'];})},'transaction':_0x912200});}})[_0x4532('0x2a')](function(_0x3d6974){var _0x5e83f3=_[_0x4532('0x32')](_0x99967[_0x4532('0x54')],function(_0xdf35af){_0xdf35af[_0x4532('0x5c')]=_0x99967[_0x4532('0x4a')]['id'];return _0xdf35af;});return db[_0x4532('0x57')][_0x4532('0x6d')](_0x5e83f3,{'raw':!![],'transaction':_0x912200});})[_0x4532('0x2a')](function(_0x580926){var _0x1995fa=_[_0x4532('0x41')](_['map'](_0x580926,function(_0x1fb527){return _0x1fb527['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1995fa){return db[_0x4532('0x57')]['findAll']({'where':{'userProfileId':_0x99967[_0x4532('0x4a')]['id'],'sectionId':_[_0x4532('0x32')](_0x1995fa,function(_0x2457ce){return _0x2457ce[_0x4532('0x5b')];})},'attributes':['id',_0x4532('0x5b')],'raw':!![]})[_0x4532('0x2a')](function(_0x29a4fc){var _0x458f4e=_[_0x4532('0x32')](_0x99967['body'],function(_0x1a759c){_0x1a759c[_0x4532('0x5c')]=_0x99967[_0x4532('0x4a')]['id'];return _0x1a759c;});return db[_0x4532('0x5a')][_0x4532('0x6d')](_0x458f4e,{'raw':!![],'transaction':_0x912200});});}})[_0x4532('0x48')](handleError(_0x198ce9,null));});}})['then'](function(_0x260cb0){var _0x2e6744=_[_0x4532('0x32')](_0x260cb0,function(_0x33523a){return _0x33523a[_0x4532('0x4f')]({'plain':!![]});});})[_0x4532('0x2a')](respondWithResult(_0x198ce9,null))['catch'](handleError(_0x198ce9,null));};exports[_0x4532('0x6e')]=function(_0x4a4542,_0x1e6a1d,_0x7c6011){return db[_0x4532('0x33')][_0x4532('0x4c')]({'where':{'id':_0x4a4542[_0x4532('0x4a')]['id']}})[_0x4532('0x2a')](handleEntityNotFound(_0x1e6a1d,null))[_0x4532('0x2a')](function(_0x4da3a7){if(_0x4da3a7){return _0x4da3a7['removeResources'](_0x4a4542[_0x4532('0x37')][_0x4532('0x6f')]);}})[_0x4532('0x2a')](respondWithStatusCode(_0x1e6a1d,null))['catch'](handleError(_0x1e6a1d,null));};exports[_0x4532('0x70')]=function(_0x1954f2,_0x1d3421){var _0x3faa71={};if(!_0x1954f2['query']['section'])throw new Error(_0x4532('0x71'));if(!_0x1954f2[_0x4532('0x37')][_0x4532('0x72')](_0x4532('0x3e'))){_0x3faa71[_0x4532('0x25')]=qs[_0x4532('0x25')](_0x1954f2['query'][_0x4532('0x25')]);_0x3faa71[_0x4532('0x22')]=qs[_0x4532('0x22')](_0x1954f2[_0x4532('0x37')][_0x4532('0x22')]);}return db[_0x4532('0x33')]['find']({'where':{'id':_0x1954f2[_0x4532('0x4a')]['id']}})['then'](function(_0x48a685){if(!_0x48a685)throw new Error(_0x4532('0x73')+_0x1954f2[_0x4532('0x4a')]['id']);return db['UserProfile'][_0x4532('0x70')](_0x1954f2);})[_0x4532('0x2a')](respondWithFilteredResult(_0x1d3421,_0x3faa71))[_0x4532('0x48')](handleError(_0x1d3421,null));}; \ No newline at end of file +var _0xb2f3=['removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','sequelize','bulkCreate','removeResources','section','Missing\x20section\x20parameter','nolimit','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','VIRTUAL','filter','options','UserProfile','includeAll','rows','catch','show','params','rawAttributes','include','find','create','clone','omit','createdAt','crudPermissions','body','updatedAt','get','findAll','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','update','describe','addSections','transaction','each'];(function(_0x41e75c,_0x58592e){var _0xd75e28=function(_0x1fbf1c){while(--_0x1fbf1c){_0x41e75c['push'](_0x41e75c['shift']());}};_0xd75e28(++_0x58592e);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xb2f3[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x3b2f('0x0'));var rimraf=require(_0x3b2f('0x1'));var zipdir=require(_0x3b2f('0x2'));var jsonpatch=require(_0x3b2f('0x3'));var rp=require(_0x3b2f('0x4'));var moment=require(_0x3b2f('0x5'));var BPromise=require(_0x3b2f('0x6'));var Mustache=require('mustache');var util=require(_0x3b2f('0x7'));var path=require(_0x3b2f('0x8'));var sox=require(_0x3b2f('0x9'));var csv=require(_0x3b2f('0xa'));var ejs=require(_0x3b2f('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2f('0xc'));var _=require(_0x3b2f('0xd'));var squel=require('squel');var crypto=require(_0x3b2f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3b2f('0xf'));var toCsv=require(_0x3b2f('0xa'));var querystring=require(_0x3b2f('0x10'));var Papa=require(_0x3b2f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b2f('0x12'));var as=require(_0x3b2f('0x13'));var hardwareService=require(_0x3b2f('0x14'));var logger=require(_0x3b2f('0x15'))(_0x3b2f('0x16'));var utils=require(_0x3b2f('0x17'));var config=require(_0x3b2f('0x18'));var licenseUtil=require(_0x3b2f('0x19'));var db=require(_0x3b2f('0x1a'))['db'];config[_0x3b2f('0x1b')]=_[_0x3b2f('0x1c')](config[_0x3b2f('0x1b')],{'host':_0x3b2f('0x1d'),'port':0x18eb});var socket=require(_0x3b2f('0x1e'))(new Redis(config[_0x3b2f('0x1b')]));require('./userProfile.socket')[_0x3b2f('0x1f')](socket);function respondWithStatusCode(_0x4da3bd,_0x2ef8ca){_0x2ef8ca=_0x2ef8ca||0xcc;return function(_0x42477c){if(_0x42477c){return _0x4da3bd['sendStatus'](_0x2ef8ca);}return _0x4da3bd[_0x3b2f('0x20')](_0x2ef8ca)['end']();};}function respondWithResult(_0x3c0b3f,_0x3aa3d6){_0x3aa3d6=_0x3aa3d6||0xc8;return function(_0xd5a583){if(_0xd5a583){return _0x3c0b3f[_0x3b2f('0x20')](_0x3aa3d6)['json'](_0xd5a583);}};}function respondWithFilteredResult(_0x52e91d,_0x4756f0){return function(_0x6d8948){if(_0x6d8948){var _0x3ff190=typeof _0x4756f0[_0x3b2f('0x21')]===_0x3b2f('0x22')&&typeof _0x4756f0[_0x3b2f('0x23')]===_0x3b2f('0x22');var _0x3d94c0=_0x6d8948[_0x3b2f('0x24')];var _0x22db91=_0x3ff190?0x0:_0x4756f0[_0x3b2f('0x21')];var _0x2116aa=_0x3ff190?_0x6d8948[_0x3b2f('0x24')]:_0x4756f0[_0x3b2f('0x21')]+_0x4756f0['limit'];var _0x6fdf3f;if(_0x2116aa>=_0x3d94c0){_0x2116aa=_0x3d94c0;_0x6fdf3f=0xc8;}else{_0x6fdf3f=0xce;}_0x52e91d[_0x3b2f('0x20')](_0x6fdf3f);return _0x52e91d[_0x3b2f('0x25')](_0x3b2f('0x26'),_0x22db91+'-'+_0x2116aa+'/'+_0x3d94c0)['json'](_0x6d8948);}return null;};}function patchUpdates(_0x1476a0){return function(_0x3d270b){try{jsonpatch['apply'](_0x3d270b,_0x1476a0,!![]);}catch(_0x429649){return BPromise['reject'](_0x429649);}return _0x3d270b[_0x3b2f('0x27')]();};}function saveUpdates(_0x94aced,_0x267fa5){return function(_0x409401){if(_0x409401){return _0x409401['update'](_0x94aced)[_0x3b2f('0x28')](function(_0x2ee755){return _0x2ee755;});}return null;};}function removeEntity(_0x48592c,_0x4db72f){return function(_0x11e9e7){if(_0x11e9e7){return _0x11e9e7[_0x3b2f('0x29')]()[_0x3b2f('0x28')](function(){_0x48592c[_0x3b2f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x511360,_0x14fac0){return function(_0x5a39f0){if(!_0x5a39f0){_0x511360[_0x3b2f('0x2a')](0x194);}return _0x5a39f0;};}function handleError(_0x2a9afe,_0x536323){_0x536323=_0x536323||0x1f4;return function(_0x39f342){logger['error'](_0x39f342[_0x3b2f('0x2b')]);if(_0x39f342[_0x3b2f('0x2c')]){delete _0x39f342[_0x3b2f('0x2c')];}_0x2a9afe[_0x3b2f('0x20')](_0x536323)[_0x3b2f('0x2d')](_0x39f342);};}exports[_0x3b2f('0x2e')]=function(_0x593f3d,_0x1fbcb6){var _0x335e75={},_0x5d247c={},_0x500e82={'count':0x0,'rows':[]};var _0x450080=_[_0x3b2f('0x2f')](db['UserProfile']['rawAttributes'],function(_0x158628){return{'name':_0x158628[_0x3b2f('0x30')],'type':_0x158628[_0x3b2f('0x31')][_0x3b2f('0x32')]};});_0x5d247c[_0x3b2f('0x33')]=_[_0x3b2f('0x2f')](_0x450080,'name');_0x5d247c[_0x3b2f('0x34')]=_[_0x3b2f('0x35')](_0x593f3d['query']);_0x5d247c[_0x3b2f('0x36')]=_[_0x3b2f('0x37')](_0x5d247c[_0x3b2f('0x33')],_0x5d247c[_0x3b2f('0x34')]);_0x335e75['attributes']=_[_0x3b2f('0x37')](_0x5d247c[_0x3b2f('0x33')],qs[_0x3b2f('0x38')](_0x593f3d[_0x3b2f('0x34')]['fields']));_0x335e75['attributes']=_0x335e75[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x335e75[_0x3b2f('0x39')]:_0x5d247c[_0x3b2f('0x33')];if(!_0x593f3d[_0x3b2f('0x34')]['hasOwnProperty']('nolimit')){_0x335e75[_0x3b2f('0x23')]=qs[_0x3b2f('0x23')](_0x593f3d[_0x3b2f('0x34')]['limit']);_0x335e75[_0x3b2f('0x21')]=qs[_0x3b2f('0x21')](_0x593f3d[_0x3b2f('0x34')]['offset']);}_0x335e75[_0x3b2f('0x3b')]=qs[_0x3b2f('0x3c')](_0x593f3d[_0x3b2f('0x34')]['sort']);_0x335e75['where']=qs[_0x3b2f('0x36')](_['pick'](_0x593f3d['query'],_0x5d247c[_0x3b2f('0x36')]),_0x450080);if(_0x593f3d[_0x3b2f('0x34')]['filter']){_0x335e75[_0x3b2f('0x3d')]=_[_0x3b2f('0x3e')](_0x335e75[_0x3b2f('0x3d')],{'$or':_[_0x3b2f('0x2f')](_0x450080,function(_0x2b4a2b){if(_0x2b4a2b[_0x3b2f('0x31')]!==_0x3b2f('0x3f')){var _0x1b0e8e={};_0x1b0e8e[_0x2b4a2b['name']]={'$like':'%'+_0x593f3d[_0x3b2f('0x34')][_0x3b2f('0x40')]+'%'};return _0x1b0e8e;}})});}_0x335e75=_[_0x3b2f('0x3e')]({},_0x335e75,_0x593f3d[_0x3b2f('0x41')]);var _0x2f3691={'where':_0x335e75[_0x3b2f('0x3d')]};return db[_0x3b2f('0x42')][_0x3b2f('0x24')](_0x2f3691)[_0x3b2f('0x28')](function(_0x507813){_0x500e82[_0x3b2f('0x24')]=_0x507813;if(_0x593f3d[_0x3b2f('0x34')][_0x3b2f('0x43')]){_0x335e75['include']=[{'all':!![]}];}return db[_0x3b2f('0x42')]['findAll'](_0x335e75);})[_0x3b2f('0x28')](function(_0x23b747){_0x500e82[_0x3b2f('0x44')]=_0x23b747;return _0x500e82;})[_0x3b2f('0x28')](respondWithFilteredResult(_0x1fbcb6,_0x335e75))[_0x3b2f('0x45')](handleError(_0x1fbcb6,null));};exports[_0x3b2f('0x46')]=function(_0x4bc44c,_0x3417bc){var _0x4c6a74={'raw':![],'where':{'id':_0x4bc44c[_0x3b2f('0x47')]['id']}},_0x1e3fd4={};_0x1e3fd4['model']=_[_0x3b2f('0x35')](db[_0x3b2f('0x42')][_0x3b2f('0x48')]);_0x1e3fd4[_0x3b2f('0x34')]=_[_0x3b2f('0x35')](_0x4bc44c['query']);_0x1e3fd4['filters']=_[_0x3b2f('0x37')](_0x1e3fd4['model'],_0x1e3fd4[_0x3b2f('0x34')]);_0x4c6a74['attributes']=_[_0x3b2f('0x37')](_0x1e3fd4[_0x3b2f('0x33')],qs[_0x3b2f('0x38')](_0x4bc44c[_0x3b2f('0x34')]['fields']));_0x4c6a74[_0x3b2f('0x39')]=_0x4c6a74[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x4c6a74['attributes']:_0x1e3fd4[_0x3b2f('0x33')];if(_0x4bc44c[_0x3b2f('0x34')][_0x3b2f('0x43')]){_0x4c6a74[_0x3b2f('0x49')]=[{'all':!![]}];}_0x4c6a74=_['merge']({},_0x4c6a74,_0x4bc44c[_0x3b2f('0x41')]);return db[_0x3b2f('0x42')][_0x3b2f('0x4a')](_0x4c6a74)[_0x3b2f('0x28')](handleEntityNotFound(_0x3417bc,null))[_0x3b2f('0x28')](respondWithResult(_0x3417bc,null))[_0x3b2f('0x45')](handleError(_0x3417bc,null));};exports[_0x3b2f('0x4b')]=function(_0x2e182e,_0x56be24){return db[_0x3b2f('0x42')][_0x3b2f('0x4b')](_0x2e182e['body'],{})['then'](respondWithResult(_0x56be24,0xc9))['catch'](handleError(_0x56be24,null));};exports[_0x3b2f('0x4c')]=function(_0x2ff96e,_0x38f615){var _0x2eabc2={'where':{'id':_0x2ff96e[_0x3b2f('0x47')]['id']}},_0x5cd3c0={};_0x5cd3c0[_0x3b2f('0x33')]=_['keys'](db['UserProfile']['rawAttributes']);_0x2eabc2[_0x3b2f('0x39')]=_[_0x3b2f('0x37')](_0x5cd3c0['model'],qs['fields'](_0x2ff96e['query']['fields']));_0x2eabc2[_0x3b2f('0x39')]=_0x2eabc2[_0x3b2f('0x39')][_0x3b2f('0x3a')]?_0x2eabc2[_0x3b2f('0x39')]:_0x5cd3c0['model'];if(_0x2ff96e[_0x3b2f('0x34')]['includeAll']){_0x2eabc2[_0x3b2f('0x49')]=[{'all':!![]}];}_0x2eabc2=_[_0x3b2f('0x3e')]({},_0x2eabc2,_0x2ff96e[_0x3b2f('0x41')]);return db[_0x3b2f('0x42')]['find'](_0x2eabc2)['then'](handleEntityNotFound(_0x38f615,null))['then'](function(_0x500f77){if(_0x500f77){var _0xa5f372=_0x500f77['get']({'plain':!![]});_0xa5f372=qs[_0x3b2f('0x4d')](_0xa5f372,['id',_0x3b2f('0x4e'),'updatedAt',_0x3b2f('0x4f')]);_0x2ff96e[_0x3b2f('0x50')]=_[_0x3b2f('0x4d')](_0x2ff96e['body'],['id',_0x3b2f('0x4e'),_0x3b2f('0x51')]);return db['sequelize']['transaction'](function(_0x2f83d6){return db[_0x3b2f('0x42')][_0x3b2f('0x4b')](_[_0x3b2f('0x3e')](_0xa5f372,_0x2ff96e['body']),{'include':_0x2ff96e[_0x3b2f('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2f83d6})[_0x3b2f('0x28')](function(_0x47951d){var _0x3daf82=_0x47951d[_0x3b2f('0x52')]({'plain':!![]});return db['UserProfileSection'][_0x3b2f('0x53')]({'where':{'userProfileId':_0x2ff96e[_0x3b2f('0x47')]['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5710a3){if(_0x5710a3){return BPromise['each'](_0x5710a3,function(_0x27fcc4){return new BPromise(function(_0x145de5,_0x228534){if(_0x27fcc4[_0x3b2f('0x54')]===null||_0x27fcc4[_0x3b2f('0x54')]===0x1)_0x145de5(null);return db['UserProfileResource'][_0x3b2f('0x53')]({'where':{'sectionId':_0x27fcc4['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x300975){var _0x1ec965=_[_0x3b2f('0x2f')](_0x300975,function(_0x1871cc){return qs['omit'](_0x1871cc,['id',_0x3b2f('0x4e'),'updatedAt',_0x3b2f('0x55')]);});_0x145de5(_0x1ec965);})['catch'](function(_0x5e8b55){_0x228534(_0x5e8b55);});})['then'](function(_0x57d08b){var _0x2a183a=qs[_0x3b2f('0x4d')](_0x27fcc4,['id','createdAt',_0x3b2f('0x51')]);_0x2a183a[_0x3b2f('0x56')]=_0x3daf82['id'];if(_0x57d08b)_0x2a183a[_0x3b2f('0x57')]=_0x57d08b;return _0x2a183a;})['then'](function(_0x5c7f9c){return db[_0x3b2f('0x58')][_0x3b2f('0x4b')](_0x5c7f9c,{'include':[{'model':db[_0x3b2f('0x59')],'as':_0x3b2f('0x57')}],'raw':!![],'transaction':_0x2f83d6});});})[_0x3b2f('0x28')](function(){return _0x3daf82;});}});});});}})['then'](respondWithResult(_0x38f615,0xc9))[_0x3b2f('0x45')](handleError(_0x38f615,null));};exports[_0x3b2f('0x5a')]=function(_0x39538f,_0x1325fa){if(_0x39538f[_0x3b2f('0x50')]['id']){delete _0x39538f[_0x3b2f('0x50')]['id'];}return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x39538f[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0x1325fa,null))[_0x3b2f('0x28')](saveUpdates(_0x39538f[_0x3b2f('0x50')],null))[_0x3b2f('0x28')](respondWithResult(_0x1325fa,null))[_0x3b2f('0x45')](handleError(_0x1325fa,null));};exports['destroy']=function(_0x55bc41,_0xfd3e77){return db[_0x3b2f('0x42')]['find']({'where':{'id':_0x55bc41[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0xfd3e77,null))[_0x3b2f('0x28')](removeEntity(_0xfd3e77,null))[_0x3b2f('0x45')](handleError(_0xfd3e77,null));};exports[_0x3b2f('0x5b')]=function(_0x1ded44,_0x42e512){return db[_0x3b2f('0x42')][_0x3b2f('0x5b')]()['then'](respondWithResult(_0x42e512,null))[_0x3b2f('0x45')](handleError(_0x42e512,null));};exports[_0x3b2f('0x5c')]=function(_0x574e48,_0x37648b){var _0x3399e7=_0x574e48[_0x3b2f('0x50')];return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x574e48['params']['id']}})['then'](handleEntityNotFound(_0x37648b,null))[_0x3b2f('0x28')](function(_0x1efdb7){if(_0x1efdb7){return db['sequelize'][_0x3b2f('0x5d')](function(_0x16785b){return db[_0x3b2f('0x58')][_0x3b2f('0x29')]({'where':{'userProfileId':_0x574e48['params']['id'],'sectionId':_[_0x3b2f('0x2f')](_0x3399e7,function(_0x23087d){return _0x23087d[_0x3b2f('0x55')];})},'transaction':_0x16785b})[_0x3b2f('0x28')](function(){var _0xa932e8=_['map'](_0x3399e7,function(_0x4ef0be){_0x4ef0be[_0x3b2f('0x56')]=_0x574e48[_0x3b2f('0x47')]['id'];return _0x4ef0be;});var _0x11bbed=[];return BPromise[_0x3b2f('0x5e')](_0xa932e8,function(_0x171ba4){return db[_0x3b2f('0x58')]['create'](_0x171ba4,{'include':[{'model':db[_0x3b2f('0x59')],'as':_0x3b2f('0x57')}],'raw':!![],'transaction':_0x16785b})['then'](function(_0x4d433c){_0x11bbed['push'](_0x4d433c[_0x3b2f('0x52')]({'plain':!![]}));});})['then'](function(){return _0x11bbed;});});});}})['then'](function(_0x46ef22){return _0x46ef22;})[_0x3b2f('0x28')](respondWithResult(_0x37648b,null))[_0x3b2f('0x45')](handleError(_0x37648b,null));};exports[_0x3b2f('0x5f')]=function(_0xf1a384,_0x3c9de5){var _0x242389;return db['UserProfile'][_0x3b2f('0x4a')]({'where':{'id':_0xf1a384[_0x3b2f('0x47')]['id']},'attributes':['id','name']})[_0x3b2f('0x28')](handleEntityNotFound(_0x3c9de5,null))['then'](function(_0x50ddca){if(_0x50ddca){_0x242389=_0x50ddca;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0xf1a384[_0x3b2f('0x47')]['id'],'sectionId':_0xf1a384['query'][_0x3b2f('0x60')]}});}})[_0x3b2f('0x28')](function(){return _0x242389;})['then'](respondWithStatusCode(_0x3c9de5,null))[_0x3b2f('0x45')](handleError(_0x3c9de5,null));};exports[_0x3b2f('0x61')]=function(_0x1c25b2,_0x1f8c03){var _0x11199f=[];var _0x11f280=[];return db[_0x3b2f('0x58')]['findAll']({'where':{'userProfileId':_0x1c25b2['params']['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0xde8946){_0x11199f=_['filter'](_0xde8946,function(_0x5b5b91){return _0x5b5b91[_0x3b2f('0x62')]===0x1||_[_0x3b2f('0x63')]([0x3eb,0x709],_0x5b5b91[_0x3b2f('0x55')]);});if(!_[_0x3b2f('0x64')](_0x11199f)){return _[_0x3b2f('0x2f')](_0x11199f,function(_0x6732d7){return _0x6732d7[_0x3b2f('0x55')];});}else{return;}})[_0x3b2f('0x28')](function(_0x88576b){if(_0x88576b)_0x11f280=_0x88576b;if(_[_0x3b2f('0x63')](_0x11f280,0x64)){var _0x2b24b5=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x64});return hasDefaultDashboard(_0x2b24b5)['then'](function(_0x7b0ed3){return _['map'](_0x11199f,function(_0x500dcd){if(_0x500dcd[_0x3b2f('0x55')]===0x64){_0x500dcd['subsections']=_0x7b0ed3;}return _0x500dcd;});});}else{return;}})[_0x3b2f('0x28')](function(_0x4abe6a){if(_0x4abe6a)_0x11199f=_0x4abe6a;if(_[_0x3b2f('0x63')](_0x11f280,0x3eb)){var _0x1dd448=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x3eb});return getCustomDashboards(_0x1dd448)['then'](function(_0x54ecee){return _['map'](_0x11199f,function(_0x42b3b8){if(_0x1dd448['enabled']){if(_0x42b3b8[_0x3b2f('0x55')]===0x3eb){_0x42b3b8[_0x3b2f('0x65')]=_0x54ecee;}}else{if(_0x42b3b8[_0x3b2f('0x55')]===0x64){_0x42b3b8[_0x3b2f('0x65')]=_0x54ecee;}}return _0x42b3b8;});});}else{return;}})[_0x3b2f('0x28')](function(_0x16bcb8){if(_0x16bcb8)_0x11199f=_0x16bcb8;if(_[_0x3b2f('0x63')](_0x11f280,0x709)){var _0x57b5ae=_[_0x3b2f('0x4a')](_0x11199f,{'sectionId':0x709});return getPlugins(_0x57b5ae)['then'](function(_0x361d79){if(_0x57b5ae['enabled']){return _['map'](_0x11199f,function(_0x35232d){if(_0x35232d[_0x3b2f('0x55')]===0x709){_0x35232d[_0x3b2f('0x65')]=_0x361d79;}return _0x35232d;});}else{var _0x4d5dae={'sectionId':0x76c,'enabled':0x1,'subsections':_0x361d79};var _0x55746a=_['map'](_0x11199f);_0x55746a[_0x3b2f('0x66')](_0x4d5dae);return _0x55746a;}});}else{return;}})[_0x3b2f('0x28')](function(_0x1c2136){if(_0x1c2136)_0x11199f=_0x1c2136;return _[_0x3b2f('0x40')](_0x11199f,[_0x3b2f('0x62'),0x1]);})[_0x3b2f('0x28')](respondWithResult(_0x1f8c03,null))['catch'](handleError(_0x1f8c03,null));};function hasDefaultDashboard(_0x484d07){var _0x460d1f=[0x65];return new BPromise(function(_0x4dd272,_0x4496fe){try{if(_0x484d07[_0x3b2f('0x54')]){_0x4dd272(_0x460d1f);}else{return db['UserProfileResource'][_0x3b2f('0x67')]({'where':{'sectionId':_0x484d07['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5c991b){_0x5c991b?_0x4dd272(_0x460d1f):_0x4dd272();});}}catch(_0xf5d8a9){_0x4496fe(_0xf5d8a9);}});}function getCustomDashboards(_0x35c056){var _0x172a09=[];return new BPromise(function(_0x5abc09,_0x3e5d8c){try{if(_0x35c056[_0x3b2f('0x54')]){return db[_0x3b2f('0x68')][_0x3b2f('0x53')]({'raw':!![]})[_0x3b2f('0x28')](function(_0x32f0d8){_0x32f0d8[_0x3b2f('0x69')](function(_0x20fd6a){_0x172a09[_0x3b2f('0x66')](_0x20fd6a['id']+0x1869f);});_0x5abc09(_0x172a09);});}else{return db['UserProfileResource'][_0x3b2f('0x53')]({'where':{'sectionId':_0x35c056['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x5adafe){_0x5adafe['forEach'](function(_0x2e3bf5){_0x172a09[_0x3b2f('0x66')](_0x2e3bf5[_0x3b2f('0x6a')]+0x1869f);});_0x5abc09(_0x172a09);});}}catch(_0x135dd1){_0x3e5d8c(_0x135dd1);}});}function getPlugins(_0x54873f){var _0x292991=[];return new BPromise(function(_0x484294,_0x450f1a){try{if(_0x54873f['autoAssociation']){return db[_0x3b2f('0x6b')][_0x3b2f('0x53')]({'raw':!![]})[_0x3b2f('0x28')](function(_0xc4839f){_0xc4839f['forEach'](function(_0x52f091){_0x292991[_0x3b2f('0x66')](_0x52f091['id']+0x15b38);});_0x484294(_0x292991);});}else{return db[_0x3b2f('0x59')]['findAll']({'where':{'sectionId':_0x54873f['id']},'raw':!![]})[_0x3b2f('0x28')](function(_0x295b7b){_0x295b7b[_0x3b2f('0x69')](function(_0x47557d){_0x292991[_0x3b2f('0x66')](_0x47557d['resourceId']+0x15b38);});_0x484294(_0x292991);});}}catch(_0x473b01){_0x450f1a(_0x473b01);}});}exports[_0x3b2f('0x6c')]=function(_0x3db90f,_0x431942){return db['UserProfile']['find']({'where':{'id':_0x3db90f[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](handleEntityNotFound(_0x431942,null))[_0x3b2f('0x28')](function(_0x3fb0f8){if(_0x3fb0f8){return db[_0x3b2f('0x6d')][_0x3b2f('0x5d')](function(_0x151a21){return db['UserProfileSection'][_0x3b2f('0x53')]({'where':{'userProfileId':_0x3db90f['params']['id']},'attributes':['id'],'raw':!![]})[_0x3b2f('0x28')](function(_0x464c15){if(_0x464c15){return db[_0x3b2f('0x58')][_0x3b2f('0x29')]({'where':{'userProfileId':_0x3db90f[_0x3b2f('0x47')]['id'],'id':_[_0x3b2f('0x2f')](_0x464c15,function(_0x338d00){return _0x338d00['id'];})},'transaction':_0x151a21});}})[_0x3b2f('0x28')](function(_0x5f1be9){var _0x2eeb26=_['map'](_0x3db90f[_0x3b2f('0x50')],function(_0x3b6d14){_0x3b6d14[_0x3b2f('0x56')]=_0x3db90f[_0x3b2f('0x47')]['id'];return _0x3b6d14;});return db['UserProfileSection'][_0x3b2f('0x6e')](_0x2eeb26,{'raw':!![],'transaction':_0x151a21});})['then'](function(_0x77e415){var _0x4e85ec=_[_0x3b2f('0x40')](_[_0x3b2f('0x2f')](_0x77e415,function(_0x459e3b){return _0x459e3b[_0x3b2f('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e85ec){return db[_0x3b2f('0x58')][_0x3b2f('0x53')]({'where':{'userProfileId':_0x3db90f['params']['id'],'sectionId':_[_0x3b2f('0x2f')](_0x4e85ec,function(_0x1a1978){return _0x1a1978['sectionId'];})},'attributes':['id',_0x3b2f('0x55')],'raw':!![]})[_0x3b2f('0x28')](function(_0x5a9ef5){var _0x26860b=_['map'](_0x3db90f[_0x3b2f('0x50')],function(_0x4908c4){_0x4908c4[_0x3b2f('0x56')]=_0x3db90f[_0x3b2f('0x47')]['id'];return _0x4908c4;});return db[_0x3b2f('0x59')][_0x3b2f('0x6e')](_0x26860b,{'raw':!![],'transaction':_0x151a21});});}})[_0x3b2f('0x45')](handleError(_0x431942,null));});}})['then'](function(_0x4415ff){var _0x2403f3=_[_0x3b2f('0x2f')](_0x4415ff,function(_0x3d6d78){return _0x3d6d78[_0x3b2f('0x52')]({'plain':!![]});});})[_0x3b2f('0x28')](respondWithResult(_0x431942,null))[_0x3b2f('0x45')](handleError(_0x431942,null));};exports[_0x3b2f('0x6f')]=function(_0xf2a343,_0x36cbb0,_0x5f2643){return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0xf2a343[_0x3b2f('0x47')]['id']}})['then'](handleEntityNotFound(_0x36cbb0,null))[_0x3b2f('0x28')](function(_0x55dd1f){if(_0x55dd1f){return _0x55dd1f[_0x3b2f('0x6f')](_0xf2a343[_0x3b2f('0x34')][_0x3b2f('0x60')]);}})['then'](respondWithStatusCode(_0x36cbb0,null))['catch'](handleError(_0x36cbb0,null));};exports['getResources']=function(_0x5abd58,_0x99c604){var _0x4189ec={};if(!_0x5abd58[_0x3b2f('0x34')][_0x3b2f('0x70')])throw new Error(_0x3b2f('0x71'));if(!_0x5abd58[_0x3b2f('0x34')]['hasOwnProperty'](_0x3b2f('0x72'))){_0x4189ec[_0x3b2f('0x23')]=qs[_0x3b2f('0x23')](_0x5abd58[_0x3b2f('0x34')][_0x3b2f('0x23')]);_0x4189ec[_0x3b2f('0x21')]=qs[_0x3b2f('0x21')](_0x5abd58['query'][_0x3b2f('0x21')]);}return db[_0x3b2f('0x42')][_0x3b2f('0x4a')]({'where':{'id':_0x5abd58[_0x3b2f('0x47')]['id']}})[_0x3b2f('0x28')](function(_0x402db6){if(!_0x402db6)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5abd58[_0x3b2f('0x47')]['id']);return db[_0x3b2f('0x42')][_0x3b2f('0x73')](_0x5abd58);})[_0x3b2f('0x28')](respondWithFilteredResult(_0x99c604,_0x4189ec))['catch'](handleError(_0x99c604,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 934b700..fcad484 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 _0xc1db=['hasOwnProperty','events','UserProfile','setMaxListeners','save','update','remove'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc1db,0x120));var _0xbc1d=function(_0x53be23,_0x13b752){_0x53be23=_0x53be23-0x0;var _0x3b57f2=_0xc1db[_0x53be23];return _0x3b57f2;};'use strict';var EventEmitter=require(_0xbc1d('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xbc1d('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbc1d('0x2')](0x0);var events={'afterCreate':_0xbc1d('0x3'),'afterUpdate':_0xbc1d('0x4'),'afterDestroy':_0xbc1d('0x5')};function emitEvent(_0x4b69f6){return function(_0x3d0b27,_0x329960,_0x23a61e){UserProfileEvents['emit'](_0x4b69f6+':'+_0x3d0b27['id'],_0x3d0b27);UserProfileEvents['emit'](_0x4b69f6,_0x3d0b27);_0x23a61e(null);};}for(var e in events){if(events[_0xbc1d('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xa498=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0xa498,0x1d6));var _0x8a49=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xa498[_0x1acc2d];return _0xabfa6d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x8a49('0x0'))['db'][_0x8a49('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8a49('0x2'),'afterDestroy':_0x8a49('0x3')};function emitEvent(_0x1d4dd2){return function(_0x65eb15,_0x2f362e,_0x5aaf52){UserProfileEvents[_0x8a49('0x4')](_0x1d4dd2+':'+_0x65eb15['id'],_0x65eb15);UserProfileEvents['emit'](_0x1d4dd2,_0x65eb15);_0x5aaf52(null);};}for(var e in events){if(events[_0x8a49('0x5')](e)){var event=events[e];UserProfile[_0x8a49('0x6')](e,emitEvent(event));}}module[_0x8a49('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index fab8a0c..e1b96cc 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 _0x4888=['offset','sort','pick','merge','key','foreignKey','options','includeAll','forEach','DefaultReports','custom','CustomReports','count','rows','ids','Tag','Tags','tag','ThroughTags','include','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','findAll','then','associatedResources','map','catch','field','model','name','resolve','UserProfileResource','resourceId','type','odbc','squarerecordings','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','pauses','Pause','Schedule','sounds','tags','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','all','union','length','find','ignore','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','limit'];(function(_0x54409d,_0x514956){var _0x19c75b=function(_0x47ae60){while(--_0x47ae60){_0x54409d['push'](_0x54409d['shift']());}};_0x19c75b(++_0x514956);}(_0x4888,0x198));var _0x8488=function(_0x1c25c0,_0x575b5b){_0x1c25c0=_0x1c25c0-0x0;var _0x588338=_0x4888[_0x1c25c0];return _0x588338;};'use strict';var _=require('lodash');var attributes=require(_0x8488('0x0'));var qs=require(_0x8488('0x1'));var squel=require(_0x8488('0x2'));module[_0x8488('0x3')]=function(_0x257275){var _0xacc8f0=_0x257275[_0x8488('0x4')];function _0x571e4b(_0x267093,_0xf45c3f){return new Promise(function(_0x1a97f4,_0x421292){if(!_0xf45c3f)return _0x1a97f4(null);var _0x326887=_0xf45c3f[_0x8488('0x5')]?{[_0xf45c3f['filter']['field']]:_0xf45c3f['filter']['value']}:undefined;return _0xacc8f0[_0x267093][_0x8488('0x6')]({'where':_0x326887,'raw':!![]})[_0x8488('0x7')](function(_0x542bd8){_0xf45c3f[_0x8488('0x8')]=_[_0x8488('0x9')](_0x542bd8,'id');_0x1a97f4(_0xf45c3f);})[_0x8488('0xa')](function(_0x19a2ee){_0x421292(_0x19a2ee);});});}function _0x515ea8(_0x377d3b,_0x1909c9){return new Promise(function(_0x468896,_0x256bab){var _0x47146a=_0x377d3b['filter']?{[_0x377d3b[_0x8488('0x5')][_0x8488('0xb')]]:_0x377d3b['filter']['value']}:undefined;return _0xacc8f0[_0x377d3b[_0x8488('0xc')]]['findAll']({'where':_0x47146a,'raw':!![]})[_0x8488('0x7')](function(_0x4e94fc){_0x1909c9['associatedResources']=_[_0x8488('0x9')](_0x4e94fc,function(_0x3635da){return _0x3635da[_0x8488('0xd')];});_0x468896(_0x1909c9);})[_0x8488('0xa')](function(_0x3b3cfa){_0x256bab(_0x3b3cfa);});});}function _0x8d3b3d(_0x165139,_0x4e44af,_0x3dad45){if(!_0x4e44af)return Promise[_0x8488('0xe')](null);return new Promise(function(_0x3edfe4,_0x37361d){return _0xacc8f0[_0x8488('0xf')][_0x8488('0x6')]({'where':{'sectionId':_0x4e44af['id']},'raw':!![]})[_0x8488('0x7')](function(_0x27c62a){if(_0x165139[_0x8488('0xb')]&&_0x165139[_0x8488('0xb')]!=='id'){_0x4e44af[_0x8488('0x8')]=_[_0x8488('0x9')](_0x27c62a,function(_0x3dd93e){return _0x3dd93e[_0x165139['field']];});}else{if(_0x3dad45==='AnalyticExtractedReport'){_0x4e44af[_0x8488('0x8')]=_[_0x8488('0x9')](_0x27c62a,function(_0xbb10fe){return{'id':_0xbb10fe[_0x8488('0x10')],'type':_0xbb10fe[_0x8488('0x11')]};});}else{_0x4e44af[_0x8488('0x8')]=_[_0x8488('0x9')](_0x27c62a,function(_0x3c078c){return _0x3c078c[_0x8488('0x10')];});}}_0x3edfe4(_0x4e44af);})['catch'](function(_0x476a14){_0x37361d(_0x476a14);});});}function _0x4e07e1(_0x140b0b,_0x1361a6){var _0x290b33={'parentSections':[]};switch(_0x140b0b['toLowerCase']()){case'squareprojects':_0x290b33['childModel']='SquareProject';break;case _0x8488('0x12'):_0x290b33['childModel']='SquareOdbc';break;case _0x8488('0x13'):_0x290b33[_0x8488('0x14')]=_0x8488('0x15');_0x290b33[_0x8488('0x16')]=[{'name':_0x8488('0x17'),'field':'name','foreignKey':_0x8488('0x18')}];break;case _0x8488('0x19'):_0x290b33[_0x8488('0x14')]=_0x8488('0x1a');break;case _0x8488('0x1b'):_0x290b33[_0x8488('0x14')]=_0x8488('0x1c');_0x290b33[_0x8488('0x16')]=[{'name':_0x8488('0x1d'),'field':'id','foreignKey':_0x8488('0x1e')}];break;case _0x8488('0x1f'):_0x290b33['childModel']='CmList';break;case'companies':_0x290b33[_0x8488('0x14')]=_0x8488('0x20');break;case _0x8488('0x21'):_0x290b33[_0x8488('0x14')]=_0x8488('0x22');break;case _0x8488('0x23'):_0x290b33['childModel']=_0x8488('0x24');break;case _0x8488('0x25'):_0x290b33[_0x8488('0x14')]=_0x8488('0x26');break;case _0x8488('0x27'):_0x290b33['childModel']=_0x8488('0x28');break;case _0x8488('0x29'):_0x290b33['childModel']=_0x8488('0x2a');break;case _0x8488('0x2b'):case _0x8488('0x2c'):case _0x8488('0x2d'):_0x290b33[_0x8488('0x14')]='VoiceExtension';break;case _0x8488('0x2e'):_0x290b33[_0x8488('0x14')]=_0x8488('0x2f');break;case'voicemails':_0x290b33[_0x8488('0x14')]='VoiceMail';break;case _0x8488('0x30'):_0x290b33[_0x8488('0x14')]=_0x8488('0x31');_0x290b33[_0x8488('0x16')]=[{'name':'Agents','field':_0x8488('0xd'),'foreignKey':_0x8488('0x32'),'model':_0x8488('0x33'),'filter':{'field':'role','value':[_0x8488('0x34')]}},{'name':_0x8488('0x35'),'field':_0x8488('0xd'),'foreignKey':_0x8488('0x32'),'model':_0x8488('0x33'),'filter':{'field':_0x8488('0x36'),'value':[_0x8488('0x37')]}},{'name':_0x8488('0x38'),'field':_0x8488('0xd'),'foreignKey':_0x8488('0x39'),'model':_0x8488('0x3a'),'filter':{'field':'type','value':['inbound']}},{'name':_0x8488('0x3b'),'field':_0x8488('0xd'),'foreignKey':_0x8488('0x39'),'model':_0x8488('0x3a'),'filter':{'field':_0x8488('0x11'),'value':[_0x8488('0x3c')]}}];break;case _0x8488('0x3d'):_0x290b33[_0x8488('0x14')]=_0x8488('0x3e');break;case'chanspies':_0x290b33[_0x8488('0x14')]=_0x8488('0x3f');break;case _0x8488('0x40'):_0x290b33['childModel']=_0x8488('0x41');break;case _0x8488('0x42'):_0x290b33[_0x8488('0x14')]=_0x8488('0x43');break;case _0x8488('0x44'):_0x290b33[_0x8488('0x14')]=_0x8488('0x45');break;case'mailaccounts':_0x290b33[_0x8488('0x14')]=_0x8488('0x46');break;case _0x8488('0x47'):_0x290b33['childModel']=_0x8488('0x48');break;case'openchannelqueues':_0x290b33[_0x8488('0x14')]=_0x8488('0x49');break;case'openchannelaccounts':_0x290b33[_0x8488('0x14')]=_0x8488('0x4a');break;case _0x8488('0x4b'):_0x290b33[_0x8488('0x14')]=_0x8488('0x4c');break;case'smsaccounts':_0x290b33[_0x8488('0x14')]='SmsAccount';break;case _0x8488('0x4d'):_0x290b33[_0x8488('0x14')]=_0x8488('0x4e');break;case _0x8488('0x4f'):_0x290b33[_0x8488('0x14')]=_0x8488('0x50');break;case _0x8488('0x51'):_0x290b33[_0x8488('0x14')]=_0x8488('0x52');break;case _0x8488('0x53'):case _0x8488('0x54'):_0x290b33[_0x8488('0x14')]=_0x8488('0x3a');if(_0x1361a6){_0x290b33[_0x8488('0x16')]=[{'name':_0x8488('0x38')},{'name':_0x8488('0x3b')}];}break;case _0x8488('0x55'):case'agents':case _0x8488('0x56'):_0x290b33[_0x8488('0x14')]=_0x8488('0x33');if(_0x1361a6){_0x290b33[_0x8488('0x16')]=[{'name':'Users','filter':{'field':_0x8488('0x36'),'value':[_0x8488('0x57'),_0x8488('0x58')]},'ignore':!![]},{'name':_0x8488('0x59')},{'name':'Telephones'}];}break;case _0x8488('0x5a'):_0x290b33[_0x8488('0x14')]=_0x8488('0x5b');break;case _0x8488('0x5c'):_0x290b33[_0x8488('0x14')]=_0x8488('0x5d');break;case _0x8488('0x5e'):_0x290b33[_0x8488('0x14')]=_0x8488('0x5f');break;case _0x8488('0x60'):_0x290b33[_0x8488('0x14')]=_0x8488('0x61');break;case _0x8488('0x62'):_0x290b33['childModel']='DeskAccount';break;case _0x8488('0x63'):_0x290b33[_0x8488('0x14')]=_0x8488('0x64');break;case _0x8488('0x65'):_0x290b33[_0x8488('0x14')]=_0x8488('0x33');break;case _0x8488('0x66'):_0x290b33[_0x8488('0x14')]=_0x8488('0x67');break;case'dispositions':_0x290b33[_0x8488('0x14')]=_0x8488('0x68');break;case'customdashboards':_0x290b33[_0x8488('0x14')]=_0x8488('0x69');break;case _0x8488('0x6a'):_0x290b33[_0x8488('0x14')]='Interval';break;case _0x8488('0x6b'):_0x290b33[_0x8488('0x14')]=_0x8488('0x6c');break;case'scheduler':_0x290b33[_0x8488('0x14')]=_0x8488('0x6d');break;case _0x8488('0x6e'):_0x290b33[_0x8488('0x14')]='Sound';break;case _0x8488('0x6f'):_0x290b33['childModel']='Tag';break;case _0x8488('0x70'):_0x290b33['childModel']=_0x8488('0x71');break;case _0x8488('0x72'):_0x290b33[_0x8488('0x14')]=_0x8488('0x73');break;case _0x8488('0x74'):_0x290b33[_0x8488('0x14')]='Trunk';break;case _0x8488('0x75'):_0x290b33[_0x8488('0x14')]=_0x8488('0x76');break;case _0x8488('0x77'):_0x290b33[_0x8488('0x14')]='Plugin';break;case _0x8488('0x78'):_0x290b33['childModel']=_0x8488('0x79');_0x290b33[_0x8488('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x8488('0x7a')}];break;case _0x8488('0x7b'):_0x290b33[_0x8488('0x14')]=_0x8488('0x7c');break;}return _0x290b33;}function _0x4041e5(_0x168740,_0x59d0d4){var _0xb3574c=_0x168740['charAt'](0x0)[_0x8488('0x7d')]()+_0x168740[_0x8488('0x7e')](0x1);var _0x3c06a4={'type':_0xacc8f0[_0x8488('0x7f')][_0x8488('0x80')][_0x8488('0x81')],'raw':!![]};return new Promise(function(_0x5a4426,_0x43ec52){var _0x4dba5a=squel[_0x8488('0x82')]()[_0x8488('0xb')](_0x8488('0x83')+_0xb3574c+_0x8488('0x84'),'id')[_0x8488('0xb')](_0x8488('0x85'))['from']('user_has_'+_0x168740+'_interactions','ui')[_0x8488('0x86')](_0x8488('0x87'),_0x59d0d4['id']);return _0xacc8f0[_0x8488('0x88')][_0x8488('0x89')](_0x4dba5a[_0x8488('0x8a')](),_0x3c06a4)[_0x8488('0x7')](function(_0x2377db){_0x59d0d4[_0xb3574c+_0x8488('0x8b')]=_0x2377db;_0x5a4426(_0x2377db);})[_0x8488('0xa')](function(_0xa90a65){_0x43ec52(_0xa90a65);});});}return _0x257275['define'](_0x8488('0x8c'),attributes,{'tableName':_0x8488('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3b6bfe){var _0x4ba14e={'raw':_0x3b6bfe['query'][_0x8488('0x8e')],'where':{}};var _0x379a4d={};var _0x405b0a={'count':0x0,'rows':[]};var _0xf975a6=_0x3b6bfe['query']['section'];var _0x1577ce=_0x3b6bfe[_0x8488('0x89')][_0x8488('0x8f')]||![];var _0x4856fc=_0x4e07e1(_0xf975a6,_0x1577ce);if(!_0x4856fc[_0x8488('0x14')])throw new Error(_0x8488('0x90')+_0xf975a6+'\x27');var _0x17149f=[{'name':_0xf975a6}];if(!_[_0x8488('0x91')](_0x4856fc[_0x8488('0x16')]))_0x17149f=_0x4856fc['parentSections'];var _0x37ceeb=[];for(var _0x3babee=0x0;_0x3babee<_0x17149f['length'];_0x3babee++){_0x37ceeb[_0x8488('0x92')](_0xacc8f0[_0x8488('0x93')]['find']({'where':{'userProfileId':_0x3b6bfe[_0x8488('0x94')]['id'],'name':_0x17149f[_0x3babee][_0x8488('0xd')]},'raw':!![]}));}return Promise[_0x8488('0x95')](_0x37ceeb)[_0x8488('0x7')](function(_0x493041){var _0x105f23=_[_0x8488('0x5')](_0x493041,function(_0x59110d){return _0x59110d?_0x59110d:undefined;});var _0xfdb4dd=_[_0x8488('0x5')](_0x17149f,['ignore',!![]]);var _0x49ef10=_[_0x8488('0x91')](_0x105f23)&&_[_0x8488('0x91')](_0xfdb4dd)?null:_[_0x8488('0x96')](_0xfdb4dd,_0x105f23);if(!_0x49ef10)return null;var _0x49c391=[];for(var _0xb85159=0x0;_0xb85159<_0x49ef10[_0x8488('0x97')];_0xb85159++){var _0x56b35a=_[_0x8488('0x98')](_0x17149f,function(_0x59da4a){return _0x49ef10[_0xb85159]?_0x59da4a[_0x8488('0xd')]===_0x49ef10[_0xb85159][_0x8488('0xd')]:null;});if(_0x56b35a){if(_0x49ef10[_0xb85159][_0x8488('0x99')]){_0x49c391['push'](_0x571e4b(_0x4856fc[_0x8488('0x14')],_0x49ef10[_0xb85159]));}else{if(!_0x49ef10[_0xb85159][_0x8488('0x9a')]){_0x49c391['push'](_0x8d3b3d(_0x56b35a,_0x49ef10[_0xb85159],_0x4856fc['childModel']));}else{if(_0x56b35a[_0x8488('0xc')]){_0x49c391[_0x8488('0x92')](_0x515ea8(_0x56b35a,_0x49ef10[_0xb85159]));}}}}}return Promise[_0x8488('0x95')](_0x49c391);})[_0x8488('0x7')](function(_0xe1fe21){var _0x2fb435=_0xe1fe21;var _0x20d7c3=null;if(_0x2fb435){_0x20d7c3=_0x2fb435[_0x8488('0x97')]===0x1?_0x2fb435[0x0]:null;}if(!_0x20d7c3&&!_0x2fb435)return _0x405b0a;var _0x1dee36=_0xacc8f0[_0x4856fc[_0x8488('0x14')]]['rawAttributes'];_0x379a4d[_0x8488('0xc')]=_['keys'](_0x1dee36);_0x379a4d[_0x8488('0x89')]=_[_0x8488('0x9b')](_0x3b6bfe[_0x8488('0x89')]);_0x379a4d[_0x8488('0x9c')]=_['intersection'](_0x379a4d[_0x8488('0xc')],_0x379a4d[_0x8488('0x89')]);_0x4ba14e['attributes']=_[_0x8488('0x9d')](_0x379a4d['model'],qs[_0x8488('0x9e')](_0x3b6bfe[_0x8488('0x89')][_0x8488('0x9e')]));_0x4ba14e[_0x8488('0x9f')]=_0x4ba14e[_0x8488('0x9f')][_0x8488('0x97')]?_0x4ba14e[_0x8488('0x9f')]:_0x379a4d[_0x8488('0xc')];if(!_0x3b6bfe['query'][_0x8488('0xa0')]('nolimit')){_0x4ba14e['limit']=qs[_0x8488('0xa1')](_0x3b6bfe[_0x8488('0x89')][_0x8488('0xa1')]);_0x4ba14e['offset']=qs['offset'](_0x3b6bfe[_0x8488('0x89')][_0x8488('0xa2')]);}_0x4ba14e['order']=qs[_0x8488('0xa3')](_0x3b6bfe[_0x8488('0x89')][_0x8488('0xa3')]);_0x4ba14e[_0x8488('0x86')]=qs[_0x8488('0x9c')](_[_0x8488('0xa4')](_0x3b6bfe['query'],_0x379a4d[_0x8488('0x9c')]));if(_0x3b6bfe[_0x8488('0x89')][_0x8488('0x5')]){_0x4ba14e['where']=_[_0x8488('0xa5')](_0x4ba14e[_0x8488('0x86')],{'$or':_[_0x8488('0x9')](_0x1dee36,function(_0x52e034){if(_0x52e034[_0x8488('0x11')][_0x8488('0xa6')]!=='VIRTUAL'){var _0x48860c={};_0x48860c[_0x52e034[_0x8488('0xb')]]={'$like':'%'+_0x3b6bfe[_0x8488('0x89')]['filter']+'%'};return _0x48860c;}})});}var _0x353514=[];var _0x249a32=null;var _0x5c63b1={};if(_0x20d7c3){_0x249a32=_['find'](_0x17149f,[_0x8488('0xd'),_0x20d7c3['name']]);if(_0x249a32[_0x8488('0xb')]){_0x5c63b1={};if(_0x4856fc[_0x8488('0x14')]===_0x8488('0x79')){_0x5c63b1[_0x249a32[_0x8488('0xa7')]]=_['map'](_0x20d7c3[_0x8488('0x8')],'id');}else{_0x5c63b1[_0x249a32['foreignKey']]=_0x20d7c3[_0x8488('0x8')];}_0x353514['push'](_0x5c63b1);}else{_0x4ba14e[_0x8488('0x86')]['id']=_0x20d7c3[_0x8488('0x8')];}}else{for(var _0x267401=0x0;_0x267401<_0x2fb435[_0x8488('0x97')];_0x267401++){_0x249a32=_[_0x8488('0x98')](_0x17149f,[_0x8488('0xd'),_0x2fb435[_0x267401][_0x8488('0xd')]]);if(_0x249a32[_0x8488('0xb')]){_0x5c63b1={};_0x5c63b1[_0x249a32[_0x8488('0xa7')]]=_0x2fb435[_0x267401][_0x8488('0x8')];_0x353514[_0x8488('0x92')](_0x5c63b1);}else{if(!_0x4ba14e[_0x8488('0x86')]['id'])_0x4ba14e[_0x8488('0x86')]['id']=[];_0x2fb435[_0x267401][_0x8488('0x8')]['forEach'](function(_0x79989c){_0x4ba14e[_0x8488('0x86')]['id']['push'](_0x79989c);});}}}if(!_[_0x8488('0x91')](_0x353514)){_0x4ba14e[_0x8488('0x86')]=_[_0x8488('0xa5')](_0x4ba14e[_0x8488('0x86')],{'$and':{'$or':_0x353514}});}_0x4ba14e=_[_0x8488('0xa5')]({},_0x4ba14e,_0x3b6bfe[_0x8488('0xa8')]);if(_0x20d7c3&&!_0x20d7c3[_0x8488('0x9a')]&&_0x4856fc[_0x8488('0x14')]===_0x8488('0x79')){if(_0x3b6bfe[_0x8488('0x89')][_0x8488('0xa9')]){_0x4ba14e['include']=[{'all':!![]}];}return _0xacc8f0[_0x4856fc[_0x8488('0x14')]][_0x8488('0x6')](_0x4ba14e)['then'](function(_0x1e509a){var _0x7426b2=[];_0x1e509a[_0x8488('0xaa')](function(_0x1099ae){var _0x2df32b;switch(_0x1099ae['reportType']){case'default':_0x2df32b=_[_0x8488('0x98')](_0x20d7c3[_0x8488('0x8')],function(_0x21246e){return _0x21246e['id']===_0x1099ae[_0x8488('0x7a')]&&_0x21246e[_0x8488('0x11')]===_0x8488('0xab');});break;case _0x8488('0xac'):_0x2df32b=_[_0x8488('0x98')](_0x20d7c3[_0x8488('0x8')],function(_0x167437){return _0x167437['id']===_0x1099ae[_0x8488('0x7a')]&&_0x167437[_0x8488('0x11')]===_0x8488('0xad');});break;}if(_0x2df32b)_0x7426b2[_0x8488('0x92')](_0x1099ae);});_0x405b0a[_0x8488('0xae')]=_0x7426b2['length'];_0x405b0a[_0x8488('0xaf')]=_0x7426b2;return _0x405b0a;});}else{if(!_['isEmpty'](_0x3b6bfe['query'][_0x8488('0xb0')])){_0x4ba14e[_0x8488('0x86')]['id']=_0x4ba14e[_0x8488('0x86')]['id']?_[_0x8488('0x9d')](_0x4ba14e[_0x8488('0x86')]['id'],_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb0')]):_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb0')];}return _0xacc8f0[_0x4856fc[_0x8488('0x14')]]['count']({'where':_0x4ba14e[_0x8488('0x86')]})[_0x8488('0x7')](function(_0x179637){_0x405b0a[_0x8488('0xae')]=_0x179637;if(_0x3b6bfe[_0x8488('0x89')][_0x8488('0xa9')]){if(_0x4856fc['childModel']===_0x8488('0x1c')){_0x4ba14e['include']=[{'model':_0xacc8f0[_0x8488('0xb1')],'as':_0x8488('0xb2'),'attributes':['id','name','color'],'required':_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb3')]?!![]:![]},{'model':_0xacc8f0[_0x8488('0xb1')],'as':_0x8488('0xb4'),'attributes':['id',_0x8488('0xd'),'color'],'through':_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb3')]?{'attributes':[],'where':{'TagId':_0x3b6bfe['query']['tag']||undefined}}:{},'required':_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb3')]?!![]:![]}];}else{_0x4ba14e[_0x8488('0xb5')]=[{'all':!![]}];}}return _0xacc8f0[_0x4856fc['childModel']]['findAll'](_0x4ba14e);})[_0x8488('0x7')](function(_0x3c13f6){_0x405b0a[_0x8488('0xaf')]=_0x3c13f6;if(_0xf975a6==='Agents'&&_0x3b6bfe[_0x8488('0x89')][_0x8488('0xb6')]===_0x8488('0xb7')){var _0x39851c=[];for(var _0x7b2aa2=0x0;_0x7b2aa2<_0x405b0a[_0x8488('0xaf')][_0x8488('0x97')];_0x7b2aa2++){_0x39851c[_0x8488('0x92')](_0x4041e5(_0x8488('0xb8'),_0x405b0a[_0x8488('0xaf')][_0x7b2aa2][_0x8488('0xb9')]));_0x39851c[_0x8488('0x92')](_0x4041e5(_0x8488('0xba'),_0x405b0a['rows'][_0x7b2aa2][_0x8488('0xb9')]));_0x39851c[_0x8488('0x92')](_0x4041e5(_0x8488('0xbb'),_0x405b0a['rows'][_0x7b2aa2][_0x8488('0xb9')]));_0x39851c['push'](_0x4041e5(_0x8488('0xbc'),_0x405b0a['rows'][_0x7b2aa2]['dataValues']));_0x39851c[_0x8488('0x92')](_0x4041e5('openchannel',_0x405b0a[_0x8488('0xaf')][_0x7b2aa2][_0x8488('0xb9')]));_0x39851c[_0x8488('0x92')](_0x4041e5(_0x8488('0xbd'),_0x405b0a['rows'][_0x7b2aa2][_0x8488('0xb9')]));}return Promise[_0x8488('0x95')](_0x39851c)[_0x8488('0x7')](function(){return _0x405b0a;});}return _0x405b0a;});}});}}});}; \ No newline at end of file +var _0x1eba=['plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','where','sequelize','query','define','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','union','length','push','autoAssociation','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','options','includeAll','default','DefaultReports','custom','CustomReports','count','rows','ids','include','ThroughTags','tag','openTabs','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','then','associatedResources','catch','findAll','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables'];(function(_0x1d895d,_0x3e5c93){var _0x2dae23=function(_0x443cd0){while(--_0x443cd0){_0x1d895d['push'](_0x1d895d['shift']());}};_0x2dae23(++_0x3e5c93);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x1eba[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0xa1eb('0x0'));var attributes=require(_0xa1eb('0x1'));var qs=require(_0xa1eb('0x2'));var squel=require(_0xa1eb('0x3'));module[_0xa1eb('0x4')]=function(_0x5865fc){var _0x56c5f2=_0x5865fc[_0xa1eb('0x5')];function _0x34be5a(_0x16a13a,_0xf9d704){return new Promise(function(_0x138789,_0x2933d0){if(!_0xf9d704)return _0x138789(null);var _0x1d0d67=_0xf9d704[_0xa1eb('0x6')]?{[_0xf9d704[_0xa1eb('0x6')][_0xa1eb('0x7')]]:_0xf9d704[_0xa1eb('0x6')][_0xa1eb('0x8')]}:undefined;return _0x56c5f2[_0x16a13a]['findAll']({'where':_0x1d0d67,'raw':!![]})[_0xa1eb('0x9')](function(_0x4d4aaf){_0xf9d704[_0xa1eb('0xa')]=_['map'](_0x4d4aaf,'id');_0x138789(_0xf9d704);})[_0xa1eb('0xb')](function(_0x5d7101){_0x2933d0(_0x5d7101);});});}function _0x41a7bc(_0x5502e4,_0xc23b2e){return new Promise(function(_0x325d13,_0x151580){var _0x5839d3=_0x5502e4[_0xa1eb('0x6')]?{[_0x5502e4[_0xa1eb('0x6')]['field']]:_0x5502e4[_0xa1eb('0x6')]['value']}:undefined;return _0x56c5f2[_0x5502e4['model']][_0xa1eb('0xc')]({'where':_0x5839d3,'raw':!![]})['then'](function(_0x25d058){_0xc23b2e[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x25d058,function(_0x2877cb){return _0x2877cb[_0xa1eb('0xe')];});_0x325d13(_0xc23b2e);})[_0xa1eb('0xb')](function(_0x1c858c){_0x151580(_0x1c858c);});});}function _0x45d6dd(_0x211e42,_0x4aa527,_0xbd6a6b){if(!_0x4aa527)return Promise['resolve'](null);return new Promise(function(_0x1401ef,_0x3dafcd){return _0x56c5f2[_0xa1eb('0xf')][_0xa1eb('0xc')]({'where':{'sectionId':_0x4aa527['id']},'raw':!![]})['then'](function(_0x1dd621){if(_0x211e42[_0xa1eb('0x7')]&&_0x211e42[_0xa1eb('0x7')]!=='id'){_0x4aa527[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x1dd621,function(_0x3b8607){return _0x3b8607[_0x211e42[_0xa1eb('0x7')]];});}else{if(_0xbd6a6b===_0xa1eb('0x10')){_0x4aa527['associatedResources']=_[_0xa1eb('0xd')](_0x1dd621,function(_0x56653c){return{'id':_0x56653c[_0xa1eb('0x11')],'type':_0x56653c[_0xa1eb('0x12')]};});}else{_0x4aa527[_0xa1eb('0xa')]=_[_0xa1eb('0xd')](_0x1dd621,function(_0x5e7a34){return _0x5e7a34['resourceId'];});}}_0x1401ef(_0x4aa527);})[_0xa1eb('0xb')](function(_0xc64cb9){_0x3dafcd(_0xc64cb9);});});}function _0x5b0903(_0x437b2a,_0x250728){var _0x258d3a={'parentSections':[]};switch(_0x437b2a[_0xa1eb('0x13')]()){case _0xa1eb('0x14'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x16');break;case _0xa1eb('0x17'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x18');break;case _0xa1eb('0x19'):_0x258d3a[_0xa1eb('0x15')]='SquareRecording';_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x1b'),'field':'name','foreignKey':_0xa1eb('0x1c')}];break;case'projects':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x1d');break;case'contacts':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x1e');_0x258d3a[_0xa1eb('0x1a')]=[{'name':'Lists','field':'id','foreignKey':_0xa1eb('0x1f')}];break;case _0xa1eb('0x20'):_0x258d3a['childModel']=_0xa1eb('0x21');break;case _0xa1eb('0x22'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x23');break;case _0xa1eb('0x24'):_0x258d3a['childModel']=_0xa1eb('0x25');break;case _0xa1eb('0x26'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x27');break;case _0xa1eb('0x28'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x29');break;case _0xa1eb('0x2a'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x2b');break;case _0xa1eb('0x2c'):_0x258d3a['childModel']='FaxAccount';break;case _0xa1eb('0x2d'):case _0xa1eb('0x2e'):case _0xa1eb('0x2f'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x30');break;case'contexts':_0x258d3a['childModel']=_0xa1eb('0x31');break;case _0xa1eb('0x32'):_0x258d3a['childModel']='VoiceMail';break;case _0xa1eb('0x33'):_0x258d3a['childModel']=_0xa1eb('0x34');_0x258d3a['parentSections']=[{'name':_0xa1eb('0x35'),'field':_0xa1eb('0xe'),'foreignKey':_0xa1eb('0x36'),'model':'User','filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x38')]}},{'name':_0xa1eb('0x39'),'field':'name','foreignKey':_0xa1eb('0x36'),'model':_0xa1eb('0x3a'),'filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x3b')]}},{'name':_0xa1eb('0x3c'),'field':'name','foreignKey':_0xa1eb('0x3d'),'model':_0xa1eb('0x3e'),'filter':{'field':_0xa1eb('0x12'),'value':[_0xa1eb('0x3f')]}},{'name':_0xa1eb('0x40'),'field':_0xa1eb('0xe'),'foreignKey':_0xa1eb('0x3d'),'model':_0xa1eb('0x3e'),'filter':{'field':'type','value':[_0xa1eb('0x41')]}}];break;case _0xa1eb('0x42'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x43');break;case _0xa1eb('0x44'):_0x258d3a['childModel']=_0xa1eb('0x45');break;case _0xa1eb('0x46'):_0x258d3a[_0xa1eb('0x15')]='VoicePrefix';break;case _0xa1eb('0x47'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x48');break;case _0xa1eb('0x49'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x4a');break;case _0xa1eb('0x4b'):_0x258d3a['childModel']=_0xa1eb('0x4c');break;case _0xa1eb('0x4d'):_0x258d3a['childModel']=_0xa1eb('0x4e');break;case'openchannelqueues':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x4f');break;case _0xa1eb('0x50'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x51');break;case _0xa1eb('0x52'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x53');break;case _0xa1eb('0x54'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x55');break;case _0xa1eb('0x56'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x57');break;case _0xa1eb('0x58'):_0x258d3a[_0xa1eb('0x15')]='WhatsappAccount';break;case _0xa1eb('0x59'):_0x258d3a['childModel']=_0xa1eb('0x5a');break;case _0xa1eb('0x5b'):case'queuecampaigns':_0x258d3a['childModel']=_0xa1eb('0x3e');if(_0x250728){_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x3c')},{'name':'QueueCampaigns'}];}break;case _0xa1eb('0x5c'):case _0xa1eb('0x5d'):case _0xa1eb('0x5e'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x3a');if(_0x250728){_0x258d3a[_0xa1eb('0x1a')]=[{'name':_0xa1eb('0x5f'),'filter':{'field':_0xa1eb('0x37'),'value':[_0xa1eb('0x60'),_0xa1eb('0x61')]},'ignore':!![]},{'name':_0xa1eb('0x35')},{'name':_0xa1eb('0x39')}];}break;case _0xa1eb('0x62'):_0x258d3a[_0xa1eb('0x15')]='ZendeskAccount';break;case _0xa1eb('0x63'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x64');break;case _0xa1eb('0x65'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x66');break;case _0xa1eb('0x67'):_0x258d3a['childModel']=_0xa1eb('0x68');break;case _0xa1eb('0x69'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x6a');break;case _0xa1eb('0x6b'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x6c');break;case _0xa1eb('0x6d'):_0x258d3a[_0xa1eb('0x15')]='User';break;case _0xa1eb('0x6e'):_0x258d3a['childModel']=_0xa1eb('0x6f');break;case'dispositions':_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x70');break;case _0xa1eb('0x71'):_0x258d3a['childModel']=_0xa1eb('0x72');break;case _0xa1eb('0x73'):_0x258d3a['childModel']=_0xa1eb('0x74');break;case _0xa1eb('0x75'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x76');break;case _0xa1eb('0x77'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x78');break;case _0xa1eb('0x79'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7a');break;case _0xa1eb('0x7b'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7c');break;case _0xa1eb('0x7d'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x7e');break;case _0xa1eb('0x7f'):_0x258d3a['childModel']=_0xa1eb('0x80');break;case _0xa1eb('0x81'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x82');break;case _0xa1eb('0x83'):_0x258d3a[_0xa1eb('0x15')]='Variable';break;case _0xa1eb('0x84'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x85');break;case _0xa1eb('0x86'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x10');_0x258d3a[_0xa1eb('0x1a')]=[{'name':'Reports','field':'id','foreignKey':_0xa1eb('0x87')}];break;case _0xa1eb('0x88'):_0x258d3a[_0xa1eb('0x15')]=_0xa1eb('0x89');break;}return _0x258d3a;}function _0x4c30ad(_0x5af1e6,_0x58ca4e){var _0x5673fa=_0x5af1e6[_0xa1eb('0x8a')](0x0)[_0xa1eb('0x8b')]()+_0x5af1e6['slice'](0x1);var _0x4643f3={'type':_0x56c5f2[_0xa1eb('0x8c')][_0xa1eb('0x8d')][_0xa1eb('0x8e')],'raw':!![]};return new Promise(function(_0x4edf8e,_0x481d19){var _0x201e6a=squel[_0xa1eb('0x8f')]()[_0xa1eb('0x7')](_0xa1eb('0x90')+_0x5673fa+_0xa1eb('0x91'),'id')[_0xa1eb('0x7')]('ui.createdAt')['from'](_0xa1eb('0x92')+_0x5af1e6+'_interactions','ui')[_0xa1eb('0x93')]('ui.UserId\x20=\x20?',_0x58ca4e['id']);return _0x56c5f2[_0xa1eb('0x94')][_0xa1eb('0x95')](_0x201e6a['toString'](),_0x4643f3)[_0xa1eb('0x9')](function(_0xf48372){_0x58ca4e[_0x5673fa+'OpenTabs']=_0xf48372;_0x4edf8e(_0xf48372);})[_0xa1eb('0xb')](function(_0x17feb5){_0x481d19(_0x17feb5);});});}return _0x5865fc[_0xa1eb('0x96')]('UserProfile',attributes,{'tableName':_0xa1eb('0x97'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x11e85f){var _0x4af59a={'raw':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0x98')],'where':{}};var _0x139a37={};var _0x4a0545={'count':0x0,'rows':[]};var _0x3a43c3=_0x11e85f['query'][_0xa1eb('0x99')];var _0x1ea97b=_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0x9a')]||![];var _0x2df867=_0x5b0903(_0x3a43c3,_0x1ea97b);if(!_0x2df867['childModel'])throw new Error(_0xa1eb('0x9b')+_0x3a43c3+'\x27');var _0x401800=[{'name':_0x3a43c3}];if(!_[_0xa1eb('0x9c')](_0x2df867['parentSections']))_0x401800=_0x2df867[_0xa1eb('0x1a')];var _0x527921=[];for(var _0x4e582c=0x0;_0x4e582c<_0x401800['length'];_0x4e582c++){_0x527921['push'](_0x56c5f2[_0xa1eb('0x9d')][_0xa1eb('0x9e')]({'where':{'userProfileId':_0x11e85f[_0xa1eb('0x9f')]['id'],'name':_0x401800[_0x4e582c][_0xa1eb('0xe')]},'raw':!![]}));}return Promise[_0xa1eb('0xa0')](_0x527921)[_0xa1eb('0x9')](function(_0x11f031){var _0xc8cb66=_[_0xa1eb('0x6')](_0x11f031,function(_0x43d59b){return _0x43d59b?_0x43d59b:undefined;});var _0x5cf153=_[_0xa1eb('0x6')](_0x401800,[_0xa1eb('0xa1'),!![]]);var _0x46207c=_[_0xa1eb('0x9c')](_0xc8cb66)&&_[_0xa1eb('0x9c')](_0x5cf153)?null:_[_0xa1eb('0xa2')](_0x5cf153,_0xc8cb66);if(!_0x46207c)return null;var _0x4bf3c9=[];for(var _0x113a3a=0x0;_0x113a3a<_0x46207c[_0xa1eb('0xa3')];_0x113a3a++){var _0x16c5a3=_['find'](_0x401800,function(_0x1434a1){return _0x46207c[_0x113a3a]?_0x1434a1[_0xa1eb('0xe')]===_0x46207c[_0x113a3a][_0xa1eb('0xe')]:null;});if(_0x16c5a3){if(_0x46207c[_0x113a3a][_0xa1eb('0xa1')]){_0x4bf3c9[_0xa1eb('0xa4')](_0x34be5a(_0x2df867['childModel'],_0x46207c[_0x113a3a]));}else{if(!_0x46207c[_0x113a3a][_0xa1eb('0xa5')]){_0x4bf3c9['push'](_0x45d6dd(_0x16c5a3,_0x46207c[_0x113a3a],_0x2df867[_0xa1eb('0x15')]));}else{if(_0x16c5a3['model']){_0x4bf3c9[_0xa1eb('0xa4')](_0x41a7bc(_0x16c5a3,_0x46207c[_0x113a3a]));}}}}}return Promise[_0xa1eb('0xa0')](_0x4bf3c9);})[_0xa1eb('0x9')](function(_0x32cdfa){var _0x47c618=_0x32cdfa;var _0x3bc2e7=null;if(_0x47c618){_0x3bc2e7=_0x47c618[_0xa1eb('0xa3')]===0x1?_0x47c618[0x0]:null;}if(!_0x3bc2e7&&!_0x47c618)return _0x4a0545;var _0x2b8191=_0x56c5f2[_0x2df867[_0xa1eb('0x15')]]['rawAttributes'];_0x139a37[_0xa1eb('0xa6')]=_[_0xa1eb('0xa7')](_0x2b8191);_0x139a37[_0xa1eb('0x95')]=_[_0xa1eb('0xa7')](_0x11e85f[_0xa1eb('0x95')]);_0x139a37[_0xa1eb('0xa8')]=_[_0xa1eb('0xa9')](_0x139a37[_0xa1eb('0xa6')],_0x139a37[_0xa1eb('0x95')]);_0x4af59a['attributes']=_['intersection'](_0x139a37['model'],qs[_0xa1eb('0xaa')](_0x11e85f['query'][_0xa1eb('0xaa')]));_0x4af59a[_0xa1eb('0xab')]=_0x4af59a['attributes']['length']?_0x4af59a[_0xa1eb('0xab')]:_0x139a37[_0xa1eb('0xa6')];if(!_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xac')](_0xa1eb('0xad'))){_0x4af59a['limit']=qs['limit'](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xae')]);_0x4af59a[_0xa1eb('0xaf')]=qs[_0xa1eb('0xaf')](_0x11e85f['query'][_0xa1eb('0xaf')]);}_0x4af59a[_0xa1eb('0xb0')]=qs[_0xa1eb('0xb1')](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb1')]);_0x4af59a[_0xa1eb('0x93')]=qs[_0xa1eb('0xa8')](_[_0xa1eb('0xb2')](_0x11e85f[_0xa1eb('0x95')],_0x139a37[_0xa1eb('0xa8')]));if(_0x11e85f[_0xa1eb('0x95')]['filter']){_0x4af59a[_0xa1eb('0x93')]=_[_0xa1eb('0xb3')](_0x4af59a[_0xa1eb('0x93')],{'$or':_[_0xa1eb('0xd')](_0x2b8191,function(_0x3fe7ef){if(_0x3fe7ef[_0xa1eb('0x12')]['key']!==_0xa1eb('0xb4')){var _0x36a94f={};_0x36a94f[_0x3fe7ef[_0xa1eb('0x7')]]={'$like':'%'+_0x11e85f[_0xa1eb('0x95')]['filter']+'%'};return _0x36a94f;}})});}var _0x4e24dc=[];var _0xff1843=null;var _0x5e0cd5={};if(_0x3bc2e7){_0xff1843=_[_0xa1eb('0x9e')](_0x401800,[_0xa1eb('0xe'),_0x3bc2e7['name']]);if(_0xff1843[_0xa1eb('0x7')]){_0x5e0cd5={};if(_0x2df867[_0xa1eb('0x15')]==='AnalyticExtractedReport'){_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_[_0xa1eb('0xd')](_0x3bc2e7[_0xa1eb('0xa')],'id');}else{_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_0x3bc2e7[_0xa1eb('0xa')];}_0x4e24dc[_0xa1eb('0xa4')](_0x5e0cd5);}else{_0x4af59a[_0xa1eb('0x93')]['id']=_0x3bc2e7[_0xa1eb('0xa')];}}else{for(var _0x3d32da=0x0;_0x3d32da<_0x47c618[_0xa1eb('0xa3')];_0x3d32da++){_0xff1843=_[_0xa1eb('0x9e')](_0x401800,['name',_0x47c618[_0x3d32da][_0xa1eb('0xe')]]);if(_0xff1843[_0xa1eb('0x7')]){_0x5e0cd5={};_0x5e0cd5[_0xff1843[_0xa1eb('0xb5')]]=_0x47c618[_0x3d32da][_0xa1eb('0xa')];_0x4e24dc['push'](_0x5e0cd5);}else{if(!_0x4af59a[_0xa1eb('0x93')]['id'])_0x4af59a[_0xa1eb('0x93')]['id']=[];_0x47c618[_0x3d32da][_0xa1eb('0xa')]['forEach'](function(_0x214913){_0x4af59a[_0xa1eb('0x93')]['id'][_0xa1eb('0xa4')](_0x214913);});}}}if(!_['isEmpty'](_0x4e24dc)){_0x4af59a[_0xa1eb('0x93')]=_['merge'](_0x4af59a[_0xa1eb('0x93')],{'$and':{'$or':_0x4e24dc}});}_0x4af59a=_[_0xa1eb('0xb3')]({},_0x4af59a,_0x11e85f[_0xa1eb('0xb6')]);if(_0x3bc2e7&&!_0x3bc2e7[_0xa1eb('0xa5')]&&_0x2df867[_0xa1eb('0x15')]===_0xa1eb('0x10')){if(_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb7')]){_0x4af59a['include']=[{'all':!![]}];}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xc')](_0x4af59a)[_0xa1eb('0x9')](function(_0x3ae7e1){var _0x454320=[];_0x3ae7e1['forEach'](function(_0x140475){var _0x2a9f79;switch(_0x140475['reportType']){case _0xa1eb('0xb8'):_0x2a9f79=_['find'](_0x3bc2e7['associatedResources'],function(_0x29f795){return _0x29f795['id']===_0x140475[_0xa1eb('0x87')]&&_0x29f795['type']===_0xa1eb('0xb9');});break;case _0xa1eb('0xba'):_0x2a9f79=_['find'](_0x3bc2e7[_0xa1eb('0xa')],function(_0x2c49d1){return _0x2c49d1['id']===_0x140475['reportId']&&_0x2c49d1['type']===_0xa1eb('0xbb');});break;}if(_0x2a9f79)_0x454320['push'](_0x140475);});_0x4a0545[_0xa1eb('0xbc')]=_0x454320[_0xa1eb('0xa3')];_0x4a0545[_0xa1eb('0xbd')]=_0x454320;return _0x4a0545;});}else{if(!_[_0xa1eb('0x9c')](_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')])){_0x4af59a['where']['id']=_0x4af59a[_0xa1eb('0x93')]['id']?_['intersection'](_0x4af59a[_0xa1eb('0x93')]['id'],_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')]):_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xbe')];}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xbc')]({'where':_0x4af59a['where']})[_0xa1eb('0x9')](function(_0x4effc0){_0x4a0545['count']=_0x4effc0;if(_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xb7')]){if(_0x2df867[_0xa1eb('0x15')]===_0xa1eb('0x1e')){_0x4af59a[_0xa1eb('0xbf')]=[{'model':_0x56c5f2[_0xa1eb('0x7c')],'as':'Tags','attributes':['id',_0xa1eb('0xe'),'color'],'required':_0x11e85f[_0xa1eb('0x95')]['tag']?!![]:![]},{'model':_0x56c5f2[_0xa1eb('0x7c')],'as':_0xa1eb('0xc0'),'attributes':['id','name','color'],'through':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]?{'attributes':[],'where':{'TagId':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]||undefined}}:{},'required':_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc1')]?!![]:![]}];}else{_0x4af59a[_0xa1eb('0xbf')]=[{'all':!![]}];}}return _0x56c5f2[_0x2df867[_0xa1eb('0x15')]][_0xa1eb('0xc')](_0x4af59a);})[_0xa1eb('0x9')](function(_0x2fc881){_0x4a0545[_0xa1eb('0xbd')]=_0x2fc881;if(_0x3a43c3===_0xa1eb('0x35')&&_0x11e85f[_0xa1eb('0x95')][_0xa1eb('0xc2')]==='true'){var _0x2593b5=[];for(var _0x34d84d=0x0;_0x34d84d<_0x4a0545['rows'][_0xa1eb('0xa3')];_0x34d84d++){_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc3'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc5'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad('fax',_0x4a0545[_0xa1eb('0xbd')][_0x34d84d]['dataValues']));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad(_0xa1eb('0xc6'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5[_0xa1eb('0xa4')](_0x4c30ad(_0xa1eb('0xc7'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));_0x2593b5['push'](_0x4c30ad(_0xa1eb('0xc8'),_0x4a0545[_0xa1eb('0xbd')][_0x34d84d][_0xa1eb('0xc4')]));}return Promise[_0xa1eb('0xa0')](_0x2593b5)[_0xa1eb('0x9')](function(){return _0x4a0545;});}return _0x4a0545;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 414b61c..0099ef0 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 _0x36c3=['defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x107cb0,_0x52fb04){var _0x24d028=function(_0x4bf191){while(--_0x4bf191){_0x107cb0['push'](_0x107cb0['shift']());}};_0x24d028(++_0x52fb04);}(_0x36c3,0x1a6));var _0x336c=function(_0xfcfc35,_0x41125e){_0xfcfc35=_0xfcfc35-0x0;var _0x13a3c7=_0x36c3[_0xfcfc35];return _0x13a3c7;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var moment=require('moment');var BPromise=require(_0x336c('0x2'));var rs=require(_0x336c('0x3'));var fs=require('fs');var Redis=require(_0x336c('0x4'));var db=require(_0x336c('0x5'))['db'];var utils=require(_0x336c('0x6'));var logger=require(_0x336c('0x7'))(_0x336c('0x8'));var config=require('../../config/environment');var jayson=require(_0x336c('0x9'));var client=jayson[_0x336c('0xa')][_0x336c('0xb')]({'port':0x232a});config[_0x336c('0xc')]=_[_0x336c('0xd')](config['redis'],{'host':_0x336c('0xe'),'port':0x18eb});var socket=require(_0x336c('0xf'))(new Redis(config[_0x336c('0xc')]));require(_0x336c('0x10'))[_0x336c('0x11')](socket);function respondWithRpcPromise(_0x243984,_0x33ced0,_0x1a4503){return new BPromise(function(_0x179247,_0x31cee7){return client[_0x336c('0x12')](_0x243984,_0x1a4503)[_0x336c('0x13')](function(_0x1d896b){logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,_0x336c('0x16'));logger[_0x336c('0x17')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x33ced0,'request\x20sent',JSON[_0x336c('0x18')](_0x1d896b));if(_0x1d896b['error']){if(_0x1d896b[_0x336c('0x19')][_0x336c('0x1a')]===0x1f4){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d896b['error'][_0x336c('0x1b')]);return _0x31cee7(_0x1d896b[_0x336c('0x19')]['message']);}logger[_0x336c('0x19')]('UserProfile,\x20%s,\x20%s',_0x33ced0,_0x1d896b[_0x336c('0x19')]['message']);return _0x179247(_0x1d896b[_0x336c('0x19')]['message']);}else{logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,'request\x20sent');_0x179247(_0x1d896b['result'][_0x336c('0x1b')]);}})[_0x336c('0x1c')](function(_0x1d306c){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d306c);_0x31cee7(_0x1d306c);});});} \ No newline at end of file +var _0x4813=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4813,0x14e));var _0x3481=function(_0x450a7e,_0x39ca8b){_0x450a7e=_0x450a7e-0x0;var _0x42c4c4=_0x4813[_0x450a7e];return _0x42c4c4;};'use strict';var _=require(_0x3481('0x0'));var util=require(_0x3481('0x1'));var moment=require(_0x3481('0x2'));var BPromise=require(_0x3481('0x3'));var rs=require(_0x3481('0x4'));var fs=require('fs');var Redis=require(_0x3481('0x5'));var db=require(_0x3481('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3481('0x7'))(_0x3481('0x8'));var config=require(_0x3481('0x9'));var jayson=require(_0x3481('0xa'));var client=jayson[_0x3481('0xb')]['http']({'port':0x232a});config['redis']=_[_0x3481('0xc')](config['redis'],{'host':_0x3481('0xd'),'port':0x18eb});var socket=require(_0x3481('0xe'))(new Redis(config[_0x3481('0xf')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x52e455,_0x3da272,_0x4ab043){return new BPromise(function(_0x4da46b,_0x2a079d){return client[_0x3481('0x10')](_0x52e455,_0x4ab043)[_0x3481('0x11')](function(_0x3aff58){logger[_0x3481('0x12')](_0x3481('0x13'),_0x3da272,_0x3481('0x14'));logger[_0x3481('0x15')](_0x3481('0x16'),_0x3da272,_0x3481('0x14'),JSON[_0x3481('0x17')](_0x3aff58));if(_0x3aff58[_0x3481('0x18')]){if(_0x3aff58['error'][_0x3481('0x19')]===0x1f4){logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x3aff58[_0x3481('0x18')][_0x3481('0x1a')]);return _0x2a079d(_0x3aff58[_0x3481('0x18')]['message']);}logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x3aff58['error']['message']);return _0x4da46b(_0x3aff58['error']['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x3da272,_0x3481('0x14'));_0x4da46b(_0x3aff58[_0x3481('0x1b')]['message']);}})['catch'](function(_0x11c6b3){logger[_0x3481('0x18')](_0x3481('0x13'),_0x3da272,_0x11c6b3);_0x2a079d(_0x11c6b3);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 15b71cd..c47eb6c 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 _0x0dd4=['./userProfile.events','remove','update','removeListener','length','userProfile:'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x0dd4,0x19e));var _0x40dd=function(_0x3c860c,_0x5e4f68){_0x3c860c=_0x3c860c-0x0;var _0x288597=_0x0dd4[_0x3c860c];return _0x288597;};'use strict';var UserProfileEvents=require(_0x40dd('0x0'));var events=['save',_0x40dd('0x1'),_0x40dd('0x2')];function createListener(_0x1cb7e3,_0x2dabc2){return function(_0xfbeb10){_0x2dabc2['emit'](_0x1cb7e3,_0xfbeb10);};}function removeListener(_0x4628ca,_0x188da5){return function(){UserProfileEvents[_0x40dd('0x3')](_0x4628ca,_0x188da5);};}exports['register']=function(_0x4b755c){for(var _0x1ce841=0x0,_0x59bbe2=events[_0x40dd('0x4')];_0x1ce841<_0x59bbe2;_0x1ce841++){var _0x29a045=events[_0x1ce841];var _0x25b157=createListener(_0x40dd('0x5')+_0x29a045,_0x4b755c);UserProfileEvents['on'](_0x29a045,_0x25b157);}}; \ No newline at end of file +var _0x09df=['update','removeListener','register','length','userProfile:','./userProfile.events','save','remove'];(function(_0x1ffb38,_0x4c3cd4){var _0x433b38=function(_0x4fc8e9){while(--_0x4fc8e9){_0x1ffb38['push'](_0x1ffb38['shift']());}};_0x433b38(++_0x4c3cd4);}(_0x09df,0x1d5));var _0xf09d=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x09df[_0x5a60ce];return _0x393e5e;};'use strict';var UserProfileEvents=require(_0xf09d('0x0'));var events=[_0xf09d('0x1'),_0xf09d('0x2'),_0xf09d('0x3')];function createListener(_0x1d9a05,_0x69858f){return function(_0x386b92){_0x69858f['emit'](_0x1d9a05,_0x386b92);};}function removeListener(_0x28789a,_0x13cbf2){return function(){UserProfileEvents[_0xf09d('0x4')](_0x28789a,_0x13cbf2);};}exports[_0xf09d('0x5')]=function(_0x286546){for(var _0x10be21=0x0,_0x5bbb1b=events[_0xf09d('0x6')];_0x10be21<_0x5bbb1b;_0x10be21++){var _0x372baa=events[_0x10be21];var _0xd8f745=createListener(_0xf09d('0x7')+_0x372baa,_0x286546);UserProfileEvents['on'](_0x372baa,_0xd8f745);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 81977c9..d9d07ee 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 _0x288d=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0x288d,0xee));var _0xd288=function(_0x3abad6,_0x188df0){_0x3abad6=_0x3abad6-0x0;var _0x403898=_0x288d[_0x3abad6];return _0x403898;};'use strict';var multer=require(_0xd288('0x0'));var util=require(_0xd288('0x1'));var path=require(_0xd288('0x2'));var timeout=require(_0xd288('0x3'));var express=require(_0xd288('0x4'));var router=express[_0xd288('0x5')]();var fs_extra=require(_0xd288('0x6'));var auth=require(_0xd288('0x7'));var interaction=require(_0xd288('0x8'));var config=require(_0xd288('0x9'));var controller=require('./userProfileResource.controller');router[_0xd288('0xa')]('/',auth[_0xd288('0xb')](),controller['index']);router[_0xd288('0xa')]('/describe',auth[_0xd288('0xb')](),controller['describe']);router[_0xd288('0xa')](_0xd288('0xc'),auth['isAuthenticated'](),controller[_0xd288('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd288('0xe')](_0xd288('0xc'),auth[_0xd288('0xb')](),controller['update']);router[_0xd288('0xf')](_0xd288('0xc'),auth[_0xd288('0xb')](),controller[_0xd288('0x10')]);module[_0xd288('0x11')]=router; \ No newline at end of file +var _0xfaae=['describe','get','/:id','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfaae,0x1aa));var _0xefaa=function(_0x1ef81b,_0x2e03e2){_0x1ef81b=_0x1ef81b-0x0;var _0x33349f=_0xfaae[_0x1ef81b];return _0x33349f;};'use strict';var multer=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var path=require(_0xefaa('0x2'));var timeout=require(_0xefaa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xefaa('0x4'));var auth=require(_0xefaa('0x5'));var interaction=require(_0xefaa('0x6'));var config=require(_0xefaa('0x7'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xefaa('0x8')](),controller[_0xefaa('0x9')]);router['get'](_0xefaa('0xa'),auth[_0xefaa('0x8')](),controller[_0xefaa('0xb')]);router[_0xefaa('0xc')](_0xefaa('0xd'),auth[_0xefaa('0x8')](),controller['show']);router[_0xefaa('0xe')]('/',auth['isAuthenticated'](),controller[_0xefaa('0xf')]);router[_0xefaa('0x10')](_0xefaa('0xd'),auth[_0xefaa('0x8')](),controller[_0xefaa('0x11')]);router['delete'](_0xefaa('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xefaa('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 4d52b0a..ce344b3 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 _0xb83b=['STRING'];(function(_0x4b8645,_0x4373eb){var _0xc5fa40=function(_0xd51ab){while(--_0xd51ab){_0x4b8645['push'](_0x4b8645['shift']());}};_0xc5fa40(++_0x4373eb);}(_0xb83b,0xeb));var _0xbb83=function(_0x259453,_0x3bcee0){_0x259453=_0x259453-0x0;var _0x2f431d=_0xb83b[_0x259453];return _0x2f431d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbb83('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xeceb=['STRING','INTEGER','sequelize','exports'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0xeceb,0x136));var _0xbece=function(_0x1857ae,_0xfbc7e8){_0x1857ae=_0x1857ae-0x0;var _0x211f80=_0xeceb[_0x1857ae];return _0x211f80;};'use strict';var Sequelize=require(_0xbece('0x0'));module[_0xbece('0x1')]={'name':{'type':Sequelize[_0xbece('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbece('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a86bac9..c011d52 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 _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x4a8949,_0x4f7308){var _0x22f9cf=function(_0x275146){while(--_0x275146){_0x4a8949['push'](_0x4a8949['shift']());}};_0x22f9cf(++_0x4f7308);}(_0x5496,0x175));var _0x6549=function(_0x96bd92,_0x572ca8){_0x96bd92=_0x96bd92-0x0;var _0x3c5193=_0x5496[_0x96bd92];return _0x3c5193;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['UserProfileResource'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file +var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xacf4,0xe7));var _0x4acf=function(_0xcd03ed,_0x186cbb){_0xcd03ed=_0xcd03ed-0x0;var _0x567fb6=_0xacf4[_0xcd03ed];return _0x567fb6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cf34dbb..a920fac 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 _0xfc69=['exports','define','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x1dde2f,_0x137d22){var _0x3a5e91=function(_0x5c6c17){while(--_0x5c6c17){_0x1dde2f['push'](_0x1dde2f['shift']());}};_0x3a5e91(++_0x137d22);}(_0xfc69,0x1f3));var _0x9fc6=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xfc69[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x9fc6('0x0'));var util=require(_0x9fc6('0x1'));var logger=require(_0x9fc6('0x2'))(_0x9fc6('0x3'));var moment=require(_0x9fc6('0x4'));var BPromise=require(_0x9fc6('0x5'));var rp=require(_0x9fc6('0x6'));var fs=require('fs');var path=require(_0x9fc6('0x7'));var rimraf=require(_0x9fc6('0x8'));var config=require(_0x9fc6('0x9'));var attributes=require(_0x9fc6('0xa'));module[_0x9fc6('0xb')]=function(_0x19d2a0,_0xaf3117){return _0x19d2a0[_0x9fc6('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x9fc6('0xd'),'fields':[_0x9fc6('0xe'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x766c=['../../config/logger','api','bluebird','request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x766c,0xb5));var _0xc766=function(_0x314464,_0x32e9db){_0x314464=_0x314464-0x0;var _0x54f901=_0x766c[_0x314464];return _0x54f901;};'use strict';var _=require('lodash');var util=require(_0xc766('0x0'));var logger=require(_0xc766('0x1'))(_0xc766('0x2'));var moment=require('moment');var BPromise=require(_0xc766('0x3'));var rp=require(_0xc766('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc766('0x5'));var attributes=require(_0xc766('0x6'));module[_0xc766('0x7')]=function(_0x2b61ca,_0x126637){return _0x2b61ca[_0xc766('0x8')](_0xc766('0x9'),attributes,{'tableName':_0xc766('0xa'),'paranoid':![],'indexes':[{'name':_0xc766('0xb'),'fields':[_0xc766('0xc'),_0xc766('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 0eac13e..89b339b 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 _0xbc76=['code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4838ad,_0x46ea78){var _0x506762=function(_0x232a2c){while(--_0x232a2c){_0x4838ad['push'](_0x4838ad['shift']());}};_0x506762(++_0x46ea78);}(_0xbc76,0x1e4));var _0x6bc7=function(_0x5c2bbf,_0x1f6443){_0x5c2bbf=_0x5c2bbf-0x0;var _0x13ec02=_0xbc76[_0x5c2bbf];return _0x13ec02;};'use strict';var _=require(_0x6bc7('0x0'));var util=require(_0x6bc7('0x1'));var moment=require(_0x6bc7('0x2'));var BPromise=require(_0x6bc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bc7('0x4'));var db=require(_0x6bc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bc7('0x6'))('rpc');var config=require(_0x6bc7('0x7'));var jayson=require(_0x6bc7('0x8'));var client=jayson[_0x6bc7('0x9')][_0x6bc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4377,_0x1f10a1,_0x2c3f8e){return new BPromise(function(_0x26a877,_0x554937){return client['request'](_0x3a4377,_0x2c3f8e)['then'](function(_0x17d481){logger['info'](_0x6bc7('0xb'),_0x1f10a1,_0x6bc7('0xc'));logger[_0x6bc7('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1f10a1,_0x6bc7('0xc'),JSON[_0x6bc7('0xe')](_0x17d481));if(_0x17d481[_0x6bc7('0xf')]){if(_0x17d481[_0x6bc7('0xf')][_0x6bc7('0x10')]===0x1f4){logger['error'](_0x6bc7('0xb'),_0x1f10a1,_0x17d481[_0x6bc7('0xf')][_0x6bc7('0x11')]);return _0x554937(_0x17d481[_0x6bc7('0xf')][_0x6bc7('0x11')]);}logger['error'](_0x6bc7('0xb'),_0x1f10a1,_0x17d481['error'][_0x6bc7('0x11')]);return _0x26a877(_0x17d481[_0x6bc7('0xf')]['message']);}else{logger[_0x6bc7('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x1f10a1,_0x6bc7('0xc'));_0x26a877(_0x17d481[_0x6bc7('0x13')][_0x6bc7('0x11')]);}})['catch'](function(_0x5e6f80){logger[_0x6bc7('0xf')](_0x6bc7('0xb'),_0x1f10a1,_0x5e6f80);_0x554937(_0x5e6f80);});});} \ No newline at end of file +var _0x4780=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4780,0x1d5));var _0x0478=function(_0x2b4722,_0x44a089){_0x2b4722=_0x2b4722-0x0;var _0x29c705=_0x4780[_0x2b4722];return _0x29c705;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0478('0x0'));var rs=require(_0x0478('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0478('0x2'))['db'];var utils=require(_0x0478('0x3'));var logger=require(_0x0478('0x4'))(_0x0478('0x5'));var config=require(_0x0478('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0478('0x7')][_0x0478('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bd105,_0x380956,_0x4fd0ec){return new BPromise(function(_0x3a9c97,_0x39d1f3){return client[_0x0478('0x9')](_0x4bd105,_0x4fd0ec)[_0x0478('0xa')](function(_0x3c3d66){logger[_0x0478('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x380956,_0x0478('0xc'));logger[_0x0478('0xd')](_0x0478('0xe'),_0x380956,'request\x20sent',JSON[_0x0478('0xf')](_0x3c3d66));if(_0x3c3d66[_0x0478('0x10')]){if(_0x3c3d66[_0x0478('0x10')][_0x0478('0x11')]===0x1f4){logger[_0x0478('0x10')](_0x0478('0x12'),_0x380956,_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);return _0x39d1f3(_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);}logger[_0x0478('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x380956,_0x3c3d66[_0x0478('0x10')][_0x0478('0x13')]);return _0x3a9c97(_0x3c3d66[_0x0478('0x10')]['message']);}else{logger['info'](_0x0478('0x12'),_0x380956,_0x0478('0xc'));_0x3a9c97(_0x3c3d66[_0x0478('0x14')][_0x0478('0x13')]);}})['catch'](function(_0x486f8e){logger[_0x0478('0x10')](_0x0478('0x12'),_0x380956,_0x486f8e);_0x39d1f3(_0x486f8e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7e062eb..4e7e863 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 _0xd3f0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0xd3f0,0x18b));var _0x0d3f=function(_0x143c51,_0x2f54a0){_0x143c51=_0x143c51-0x0;var _0x29c51c=_0xd3f0[_0x143c51];return _0x29c51c;};'use strict';var multer=require(_0x0d3f('0x0'));var util=require(_0x0d3f('0x1'));var path=require(_0x0d3f('0x2'));var timeout=require(_0x0d3f('0x3'));var express=require(_0x0d3f('0x4'));var router=express[_0x0d3f('0x5')]();var fs_extra=require(_0x0d3f('0x6'));var auth=require(_0x0d3f('0x7'));var interaction=require(_0x0d3f('0x8'));var config=require(_0x0d3f('0x9'));var controller=require(_0x0d3f('0xa'));router[_0x0d3f('0xb')]('/',auth[_0x0d3f('0xc')](),controller[_0x0d3f('0xd')]);router[_0x0d3f('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0d3f('0xb')](_0x0d3f('0xe'),auth[_0x0d3f('0xc')](),controller[_0x0d3f('0xf')]);router[_0x0d3f('0x10')]('/',auth[_0x0d3f('0xc')](),controller[_0x0d3f('0x11')]);router[_0x0d3f('0x12')]('/:id',auth[_0x0d3f('0xc')](),controller['update']);router['delete'](_0x0d3f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d3f('0x13')]=router; \ No newline at end of file +var _0x2350=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1bbb02,_0x4e7c03){var _0x52d18c=function(_0x19b6a9){while(--_0x19b6a9){_0x1bbb02['push'](_0x1bbb02['shift']());}};_0x52d18c(++_0x4e7c03);}(_0x2350,0xae));var _0x0235=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x2350[_0x53f402];return _0x45a76d;};'use strict';var multer=require('multer');var util=require(_0x0235('0x0'));var path=require(_0x0235('0x1'));var timeout=require(_0x0235('0x2'));var express=require(_0x0235('0x3'));var router=express[_0x0235('0x4')]();var fs_extra=require(_0x0235('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0235('0x6'));var config=require(_0x0235('0x7'));var controller=require(_0x0235('0x8'));router['get']('/',auth[_0x0235('0x9')](),controller['index']);router[_0x0235('0xa')](_0x0235('0xb'),auth[_0x0235('0x9')](),controller['describe']);router[_0x0235('0xa')](_0x0235('0xc'),auth[_0x0235('0x9')](),controller[_0x0235('0xd')]);router[_0x0235('0xe')]('/',auth['isAuthenticated'](),controller[_0x0235('0xf')]);router[_0x0235('0x10')](_0x0235('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0235('0x11')](_0x0235('0xc'),auth[_0x0235('0x9')](),controller[_0x0235('0x12')]);module[_0x0235('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 390c454..4b5cc55 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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x313c5b,_0x39d119){var _0x1c1fa0=function(_0x4ebf8c){while(--_0x4ebf8c){_0x313c5b['push'](_0x313c5b['shift']());}};_0x1c1fa0(++_0x39d119);}(_0x6cb4,0xff));var _0x46cb=function(_0x4ba5fc,_0x163e08){_0x4ba5fc=_0x4ba5fc-0x0;var _0x1f7f6d=_0x6cb4[_0x4ba5fc];return _0x1f7f6d;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file +var _0x9ffd=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize'];(function(_0x29917f,_0x2b328a){var _0x41bc5f=function(_0x5f3f8a){while(--_0x5f3f8a){_0x29917f['push'](_0x29917f['shift']());}};_0x41bc5f(++_0x2b328a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xccb522,_0x3893c4){_0xccb522=_0xccb522-0x0;var _0x27b24b=_0x9ffd[_0xccb522];return _0x27b24b;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd9ff('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd9ff('0x2')],'set':function(_0x53e962){this[_0xd9ff('0x5')](_0xd9ff('0x6'),_0x53e962?_0x53e962['join'](''):[]);},'get':function(){return this[_0xd9ff('0x7')](_0xd9ff('0x6'))?this[_0xd9ff('0x7')](_0xd9ff('0x6'))[_0xd9ff('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 86d1d0f..991adc4 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 _0x4a0a=['include','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x5d8a0f,_0x36c1da){var _0x19b518=function(_0x205da6){while(--_0x205da6){_0x5d8a0f['push'](_0x5d8a0f['shift']());}};_0x19b518(++_0x36c1da);}(_0x4a0a,0xec));var _0xa4a0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4a0a[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xa4a0('0x0'));var rimraf=require(_0xa4a0('0x1'));var zipdir=require(_0xa4a0('0x2'));var jsonpatch=require(_0xa4a0('0x3'));var rp=require(_0xa4a0('0x4'));var moment=require(_0xa4a0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa4a0('0x6'));var util=require(_0xa4a0('0x7'));var path=require(_0xa4a0('0x8'));var sox=require(_0xa4a0('0x9'));var csv=require('to-csv');var ejs=require(_0xa4a0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4a0('0xb'));var squel=require(_0xa4a0('0xc'));var crypto=require('crypto');var jsforce=require(_0xa4a0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa4a0('0xe'));var querystring=require(_0xa4a0('0xf'));var Papa=require('papaparse');var Redis=require(_0xa4a0('0x10'));var authService=require(_0xa4a0('0x11'));var qs=require(_0xa4a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa4a0('0x13'));var logger=require(_0xa4a0('0x14'))(_0xa4a0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa4a0('0x16'));var db=require(_0xa4a0('0x17'))['db'];function respondWithStatusCode(_0x4b1851,_0x10aaad){_0x10aaad=_0x10aaad||0xcc;return function(_0x1943d3){if(_0x1943d3){return _0x4b1851['sendStatus'](_0x10aaad);}return _0x4b1851['status'](_0x10aaad)['end']();};}function respondWithResult(_0x5e913e,_0x86648f){_0x86648f=_0x86648f||0xc8;return function(_0x3b54ea){if(_0x3b54ea){return _0x5e913e[_0xa4a0('0x18')](_0x86648f)[_0xa4a0('0x19')](_0x3b54ea);}};}function respondWithFilteredResult(_0x3032cb,_0x3a4e70){return function(_0x442068){if(_0x442068){var _0x484166=typeof _0x3a4e70[_0xa4a0('0x1a')]===_0xa4a0('0x1b')&&typeof _0x3a4e70[_0xa4a0('0x1c')]===_0xa4a0('0x1b');var _0x58884a=_0x442068[_0xa4a0('0x1d')];var _0x1cc0cb=_0x484166?0x0:_0x3a4e70[_0xa4a0('0x1a')];var _0x5d8d43=_0x484166?_0x442068[_0xa4a0('0x1d')]:_0x3a4e70['offset']+_0x3a4e70[_0xa4a0('0x1c')];var _0x255fb0;if(_0x5d8d43>=_0x58884a){_0x5d8d43=_0x58884a;_0x255fb0=0xc8;}else{_0x255fb0=0xce;}_0x3032cb[_0xa4a0('0x18')](_0x255fb0);return _0x3032cb[_0xa4a0('0x1e')](_0xa4a0('0x1f'),_0x1cc0cb+'-'+_0x5d8d43+'/'+_0x58884a)[_0xa4a0('0x19')](_0x442068);}return null;};}function patchUpdates(_0x5dcd8b){return function(_0x170094){try{jsonpatch['apply'](_0x170094,_0x5dcd8b,!![]);}catch(_0x584c46){return BPromise[_0xa4a0('0x20')](_0x584c46);}return _0x170094[_0xa4a0('0x21')]();};}function saveUpdates(_0x16f573,_0x9497b6){return function(_0x120414){if(_0x120414){return _0x120414[_0xa4a0('0x22')](_0x16f573)[_0xa4a0('0x23')](function(_0x405b3d){return _0x405b3d;});}return null;};}function removeEntity(_0x2b7e61,_0x3933aa){return function(_0x2166df){if(_0x2166df){return _0x2166df[_0xa4a0('0x24')]()[_0xa4a0('0x23')](function(){_0x2b7e61[_0xa4a0('0x18')](0xcc)[_0xa4a0('0x25')]();});}};}function handleEntityNotFound(_0x5e017e,_0x40cd1b){return function(_0x226fae){if(!_0x226fae){_0x5e017e[_0xa4a0('0x26')](0x194);}return _0x226fae;};}function handleError(_0x3dba5d,_0x1c40bc){_0x1c40bc=_0x1c40bc||0x1f4;return function(_0xe339de){logger[_0xa4a0('0x27')](_0xe339de[_0xa4a0('0x28')]);if(_0xe339de[_0xa4a0('0x29')]){delete _0xe339de[_0xa4a0('0x29')];}_0x3dba5d['status'](_0x1c40bc)[_0xa4a0('0x2a')](_0xe339de);};}exports[_0xa4a0('0x2b')]=function(_0x1af0d1,_0x25ffcf){var _0xf70f1f={},_0x25e259={},_0x482e22={'count':0x0,'rows':[]};var _0x36c23b=_[_0xa4a0('0x2c')](db[_0xa4a0('0x2d')][_0xa4a0('0x2e')],function(_0x53505e){return{'name':_0x53505e[_0xa4a0('0x2f')],'type':_0x53505e[_0xa4a0('0x30')][_0xa4a0('0x31')]};});_0x25e259[_0xa4a0('0x32')]=_[_0xa4a0('0x2c')](_0x36c23b,'name');_0x25e259[_0xa4a0('0x33')]=_[_0xa4a0('0x34')](_0x1af0d1[_0xa4a0('0x33')]);_0x25e259[_0xa4a0('0x35')]=_[_0xa4a0('0x36')](_0x25e259['model'],_0x25e259[_0xa4a0('0x33')]);_0xf70f1f[_0xa4a0('0x37')]=_[_0xa4a0('0x36')](_0x25e259[_0xa4a0('0x32')],qs['fields'](_0x1af0d1[_0xa4a0('0x33')][_0xa4a0('0x38')]));_0xf70f1f[_0xa4a0('0x37')]=_0xf70f1f[_0xa4a0('0x37')][_0xa4a0('0x39')]?_0xf70f1f['attributes']:_0x25e259['model'];if(!_0x1af0d1[_0xa4a0('0x33')][_0xa4a0('0x3a')](_0xa4a0('0x3b'))){_0xf70f1f[_0xa4a0('0x1c')]=qs[_0xa4a0('0x1c')](_0x1af0d1[_0xa4a0('0x33')][_0xa4a0('0x1c')]);_0xf70f1f['offset']=qs['offset'](_0x1af0d1['query'][_0xa4a0('0x1a')]);}_0xf70f1f[_0xa4a0('0x3c')]=qs[_0xa4a0('0x3d')](_0x1af0d1[_0xa4a0('0x33')]['sort']);_0xf70f1f['where']=qs[_0xa4a0('0x35')](_['pick'](_0x1af0d1[_0xa4a0('0x33')],_0x25e259[_0xa4a0('0x35')]),_0x36c23b);if(_0x1af0d1[_0xa4a0('0x33')][_0xa4a0('0x3e')]){_0xf70f1f[_0xa4a0('0x3f')]=_[_0xa4a0('0x40')](_0xf70f1f[_0xa4a0('0x3f')],{'$or':_['map'](_0x36c23b,function(_0x376100){if(_0x376100[_0xa4a0('0x30')]!==_0xa4a0('0x41')){var _0x703a5e={};_0x703a5e[_0x376100[_0xa4a0('0x29')]]={'$like':'%'+_0x1af0d1[_0xa4a0('0x33')][_0xa4a0('0x3e')]+'%'};return _0x703a5e;}})});}_0xf70f1f=_['merge']({},_0xf70f1f,_0x1af0d1[_0xa4a0('0x42')]);var _0x268d43={'where':_0xf70f1f[_0xa4a0('0x3f')]};return db[_0xa4a0('0x2d')][_0xa4a0('0x1d')](_0x268d43)['then'](function(_0x430c2a){_0x482e22[_0xa4a0('0x1d')]=_0x430c2a;if(_0x1af0d1['query'][_0xa4a0('0x43')]){_0xf70f1f[_0xa4a0('0x44')]=[{'all':!![]}];}return db[_0xa4a0('0x2d')]['findAll'](_0xf70f1f);})[_0xa4a0('0x23')](function(_0x20edf3){_0x482e22['rows']=_0x20edf3;return _0x482e22;})[_0xa4a0('0x23')](respondWithFilteredResult(_0x25ffcf,_0xf70f1f))[_0xa4a0('0x45')](handleError(_0x25ffcf,null));};exports[_0xa4a0('0x46')]=function(_0x335d40,_0x745096){var _0x1220b4={'raw':![],'where':{'id':_0x335d40[_0xa4a0('0x47')]['id']}},_0x41df3f={};_0x41df3f[_0xa4a0('0x32')]=_[_0xa4a0('0x34')](db['UserProfileSection'][_0xa4a0('0x2e')]);_0x41df3f[_0xa4a0('0x33')]=_[_0xa4a0('0x34')](_0x335d40[_0xa4a0('0x33')]);_0x41df3f['filters']=_[_0xa4a0('0x36')](_0x41df3f[_0xa4a0('0x32')],_0x41df3f['query']);_0x1220b4[_0xa4a0('0x37')]=_['intersection'](_0x41df3f[_0xa4a0('0x32')],qs[_0xa4a0('0x38')](_0x335d40[_0xa4a0('0x33')]['fields']));_0x1220b4[_0xa4a0('0x37')]=_0x1220b4[_0xa4a0('0x37')][_0xa4a0('0x39')]?_0x1220b4[_0xa4a0('0x37')]:_0x41df3f[_0xa4a0('0x32')];if(_0x335d40[_0xa4a0('0x33')][_0xa4a0('0x43')]){_0x1220b4[_0xa4a0('0x44')]=[{'all':!![]}];}_0x1220b4=_[_0xa4a0('0x40')]({},_0x1220b4,_0x335d40[_0xa4a0('0x42')]);return db[_0xa4a0('0x2d')]['find'](_0x1220b4)[_0xa4a0('0x23')](handleEntityNotFound(_0x745096,null))[_0xa4a0('0x23')](respondWithResult(_0x745096,null))[_0xa4a0('0x45')](handleError(_0x745096,null));};exports['create']=function(_0x571590,_0xc4dfd7){return db[_0xa4a0('0x2d')][_0xa4a0('0x48')](_0x571590[_0xa4a0('0x49')],{})['then'](respondWithResult(_0xc4dfd7,0xc9))['catch'](handleError(_0xc4dfd7,null));};exports['update']=function(_0x1739cd,_0x23928d){if(_0x1739cd[_0xa4a0('0x49')]['id']){delete _0x1739cd[_0xa4a0('0x49')]['id'];}return db['UserProfileSection'][_0xa4a0('0x4a')]({'where':{'id':_0x1739cd[_0xa4a0('0x47')]['id']}})[_0xa4a0('0x23')](handleEntityNotFound(_0x23928d,null))['then'](saveUpdates(_0x1739cd[_0xa4a0('0x49')],null))['then'](respondWithResult(_0x23928d,null))[_0xa4a0('0x45')](handleError(_0x23928d,null));};exports[_0xa4a0('0x24')]=function(_0x429e26,_0x43efc3){return db[_0xa4a0('0x2d')][_0xa4a0('0x4a')]({'where':{'id':_0x429e26[_0xa4a0('0x47')]['id']}})['then'](handleEntityNotFound(_0x43efc3,null))[_0xa4a0('0x23')](removeEntity(_0x43efc3,null))[_0xa4a0('0x45')](handleError(_0x43efc3,null));};exports[_0xa4a0('0x4b')]=function(_0x278fc4,_0x5df33d){return db[_0xa4a0('0x2d')][_0xa4a0('0x4b')]()['then'](respondWithResult(_0x5df33d,null))[_0xa4a0('0x45')](handleError(_0x5df33d,null));}; \ No newline at end of file +var _0x4a0a=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','update','then','destroy','error','name','send','UserProfileSection','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find'];(function(_0x3f760b,_0x7a0af7){var _0x5afcd2=function(_0x4dee59){while(--_0x4dee59){_0x3f760b['push'](_0x3f760b['shift']());}};_0x5afcd2(++_0x7a0af7);}(_0x4a0a,0x11f));var _0xa4a0=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x4a0a[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xa4a0('0x0'));var rimraf=require(_0xa4a0('0x1'));var zipdir=require(_0xa4a0('0x2'));var jsonpatch=require(_0xa4a0('0x3'));var rp=require('request-promise');var moment=require(_0xa4a0('0x4'));var BPromise=require(_0xa4a0('0x5'));var Mustache=require(_0xa4a0('0x6'));var util=require(_0xa4a0('0x7'));var path=require('path');var sox=require(_0xa4a0('0x8'));var csv=require('to-csv');var ejs=require(_0xa4a0('0x9'));var fs=require('fs');var fs_extra=require(_0xa4a0('0xa'));var _=require(_0xa4a0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4a0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa4a0('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa4a0('0xe'));var authService=require(_0xa4a0('0xf'));var qs=require(_0xa4a0('0x10'));var as=require(_0xa4a0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa4a0('0x12'));var utils=require('../../config/utils');var config=require(_0xa4a0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4a0('0x14'))['db'];function respondWithStatusCode(_0x29c646,_0x5d3759){_0x5d3759=_0x5d3759||0xcc;return function(_0x33ac0d){if(_0x33ac0d){return _0x29c646[_0xa4a0('0x15')](_0x5d3759);}return _0x29c646[_0xa4a0('0x16')](_0x5d3759)[_0xa4a0('0x17')]();};}function respondWithResult(_0x483d55,_0x4bf9e5){_0x4bf9e5=_0x4bf9e5||0xc8;return function(_0x511e9a){if(_0x511e9a){return _0x483d55['status'](_0x4bf9e5)[_0xa4a0('0x18')](_0x511e9a);}};}function respondWithFilteredResult(_0x34705d,_0x1213d7){return function(_0x4a8a42){if(_0x4a8a42){var _0x4d62d5=typeof _0x1213d7[_0xa4a0('0x19')]===_0xa4a0('0x1a')&&typeof _0x1213d7['limit']===_0xa4a0('0x1a');var _0x531b50=_0x4a8a42['count'];var _0x2de01b=_0x4d62d5?0x0:_0x1213d7[_0xa4a0('0x19')];var _0x4de65a=_0x4d62d5?_0x4a8a42['count']:_0x1213d7['offset']+_0x1213d7[_0xa4a0('0x1b')];var _0x2f0ad5;if(_0x4de65a>=_0x531b50){_0x4de65a=_0x531b50;_0x2f0ad5=0xc8;}else{_0x2f0ad5=0xce;}_0x34705d['status'](_0x2f0ad5);return _0x34705d[_0xa4a0('0x1c')]('Content-Range',_0x2de01b+'-'+_0x4de65a+'/'+_0x531b50)[_0xa4a0('0x18')](_0x4a8a42);}return null;};}function patchUpdates(_0x39e2c6){return function(_0x48ee73){try{jsonpatch[_0xa4a0('0x1d')](_0x48ee73,_0x39e2c6,!![]);}catch(_0x2ce4c3){return BPromise['reject'](_0x2ce4c3);}return _0x48ee73['save']();};}function saveUpdates(_0x58bb29,_0x1ce327){return function(_0x5c0eb){if(_0x5c0eb){return _0x5c0eb[_0xa4a0('0x1e')](_0x58bb29)[_0xa4a0('0x1f')](function(_0x4c6e4f){return _0x4c6e4f;});}return null;};}function removeEntity(_0x5294f9,_0x446ec7){return function(_0x11b737){if(_0x11b737){return _0x11b737[_0xa4a0('0x20')]()[_0xa4a0('0x1f')](function(){_0x5294f9[_0xa4a0('0x16')](0xcc)[_0xa4a0('0x17')]();});}};}function handleEntityNotFound(_0xe8f8b,_0x509192){return function(_0xdbbd63){if(!_0xdbbd63){_0xe8f8b[_0xa4a0('0x15')](0x194);}return _0xdbbd63;};}function handleError(_0x28181c,_0x73e44b){_0x73e44b=_0x73e44b||0x1f4;return function(_0x44a180){logger[_0xa4a0('0x21')](_0x44a180['stack']);if(_0x44a180[_0xa4a0('0x22')]){delete _0x44a180['name'];}_0x28181c['status'](_0x73e44b)[_0xa4a0('0x23')](_0x44a180);};}exports['index']=function(_0x41e27e,_0x38fd17){var _0x13f35f={},_0x2fcc6e={},_0x43b68b={'count':0x0,'rows':[]};var _0x3386e1=_['map'](db[_0xa4a0('0x24')]['rawAttributes'],function(_0x5ece45){return{'name':_0x5ece45[_0xa4a0('0x25')],'type':_0x5ece45[_0xa4a0('0x26')][_0xa4a0('0x27')]};});_0x2fcc6e[_0xa4a0('0x28')]=_[_0xa4a0('0x29')](_0x3386e1,_0xa4a0('0x22'));_0x2fcc6e[_0xa4a0('0x2a')]=_[_0xa4a0('0x2b')](_0x41e27e[_0xa4a0('0x2a')]);_0x2fcc6e['filters']=_['intersection'](_0x2fcc6e[_0xa4a0('0x28')],_0x2fcc6e[_0xa4a0('0x2a')]);_0x13f35f[_0xa4a0('0x2c')]=_['intersection'](_0x2fcc6e[_0xa4a0('0x28')],qs[_0xa4a0('0x2d')](_0x41e27e[_0xa4a0('0x2a')]['fields']));_0x13f35f['attributes']=_0x13f35f[_0xa4a0('0x2c')][_0xa4a0('0x2e')]?_0x13f35f[_0xa4a0('0x2c')]:_0x2fcc6e[_0xa4a0('0x28')];if(!_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x2f')]('nolimit')){_0x13f35f[_0xa4a0('0x1b')]=qs[_0xa4a0('0x1b')](_0x41e27e['query'][_0xa4a0('0x1b')]);_0x13f35f[_0xa4a0('0x19')]=qs['offset'](_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x19')]);}_0x13f35f[_0xa4a0('0x30')]=qs[_0xa4a0('0x31')](_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x31')]);_0x13f35f['where']=qs[_0xa4a0('0x32')](_[_0xa4a0('0x33')](_0x41e27e[_0xa4a0('0x2a')],_0x2fcc6e[_0xa4a0('0x32')]),_0x3386e1);if(_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x34')]){_0x13f35f[_0xa4a0('0x35')]=_[_0xa4a0('0x36')](_0x13f35f[_0xa4a0('0x35')],{'$or':_[_0xa4a0('0x29')](_0x3386e1,function(_0x34a4a5){if(_0x34a4a5['type']!==_0xa4a0('0x37')){var _0x2ac634={};_0x2ac634[_0x34a4a5[_0xa4a0('0x22')]]={'$like':'%'+_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x34')]+'%'};return _0x2ac634;}})});}_0x13f35f=_[_0xa4a0('0x36')]({},_0x13f35f,_0x41e27e[_0xa4a0('0x38')]);var _0x125136={'where':_0x13f35f[_0xa4a0('0x35')]};return db[_0xa4a0('0x24')][_0xa4a0('0x39')](_0x125136)[_0xa4a0('0x1f')](function(_0x5c8818){_0x43b68b['count']=_0x5c8818;if(_0x41e27e[_0xa4a0('0x2a')][_0xa4a0('0x3a')]){_0x13f35f['include']=[{'all':!![]}];}return db[_0xa4a0('0x24')][_0xa4a0('0x3b')](_0x13f35f);})[_0xa4a0('0x1f')](function(_0x12e2cc){_0x43b68b[_0xa4a0('0x3c')]=_0x12e2cc;return _0x43b68b;})[_0xa4a0('0x1f')](respondWithFilteredResult(_0x38fd17,_0x13f35f))[_0xa4a0('0x3d')](handleError(_0x38fd17,null));};exports[_0xa4a0('0x3e')]=function(_0x53eca0,_0x2215c2){var _0x1047f8={'raw':![],'where':{'id':_0x53eca0[_0xa4a0('0x3f')]['id']}},_0x2b686e={};_0x2b686e['model']=_['keys'](db['UserProfileSection'][_0xa4a0('0x40')]);_0x2b686e[_0xa4a0('0x2a')]=_[_0xa4a0('0x2b')](_0x53eca0['query']);_0x2b686e[_0xa4a0('0x32')]=_[_0xa4a0('0x41')](_0x2b686e[_0xa4a0('0x28')],_0x2b686e[_0xa4a0('0x2a')]);_0x1047f8[_0xa4a0('0x2c')]=_[_0xa4a0('0x41')](_0x2b686e['model'],qs[_0xa4a0('0x2d')](_0x53eca0[_0xa4a0('0x2a')][_0xa4a0('0x2d')]));_0x1047f8['attributes']=_0x1047f8[_0xa4a0('0x2c')][_0xa4a0('0x2e')]?_0x1047f8[_0xa4a0('0x2c')]:_0x2b686e[_0xa4a0('0x28')];if(_0x53eca0['query']['includeAll']){_0x1047f8[_0xa4a0('0x42')]=[{'all':!![]}];}_0x1047f8=_[_0xa4a0('0x36')]({},_0x1047f8,_0x53eca0[_0xa4a0('0x38')]);return db[_0xa4a0('0x24')][_0xa4a0('0x43')](_0x1047f8)[_0xa4a0('0x1f')](handleEntityNotFound(_0x2215c2,null))[_0xa4a0('0x1f')](respondWithResult(_0x2215c2,null))[_0xa4a0('0x3d')](handleError(_0x2215c2,null));};exports[_0xa4a0('0x44')]=function(_0x4a2031,_0x3263a4){return db[_0xa4a0('0x24')][_0xa4a0('0x44')](_0x4a2031['body'],{})['then'](respondWithResult(_0x3263a4,0xc9))[_0xa4a0('0x3d')](handleError(_0x3263a4,null));};exports[_0xa4a0('0x1e')]=function(_0x118ab0,_0x44a9b7){if(_0x118ab0[_0xa4a0('0x45')]['id']){delete _0x118ab0[_0xa4a0('0x45')]['id'];}return db[_0xa4a0('0x24')][_0xa4a0('0x43')]({'where':{'id':_0x118ab0[_0xa4a0('0x3f')]['id']}})[_0xa4a0('0x1f')](handleEntityNotFound(_0x44a9b7,null))[_0xa4a0('0x1f')](saveUpdates(_0x118ab0[_0xa4a0('0x45')],null))[_0xa4a0('0x1f')](respondWithResult(_0x44a9b7,null))[_0xa4a0('0x3d')](handleError(_0x44a9b7,null));};exports[_0xa4a0('0x20')]=function(_0xa2d85b,_0x53be9d){return db['UserProfileSection'][_0xa4a0('0x43')]({'where':{'id':_0xa2d85b[_0xa4a0('0x3f')]['id']}})[_0xa4a0('0x1f')](handleEntityNotFound(_0x53be9d,null))[_0xa4a0('0x1f')](removeEntity(_0x53be9d,null))[_0xa4a0('0x3d')](handleError(_0x53be9d,null));};exports[_0xa4a0('0x46')]=function(_0x5b5647,_0x21050b){return db[_0xa4a0('0x24')]['describe']()[_0xa4a0('0x1f')](respondWithResult(_0x21050b,null))[_0xa4a0('0x3d')](handleError(_0x21050b,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 51223ec..fd137ca 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 _0x9c99=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger'];(function(_0x5b2011,_0x59cd2e){var _0xca3680=function(_0x53f4d9){while(--_0x53f4d9){_0x5b2011['push'](_0x5b2011['shift']());}};_0xca3680(++_0x59cd2e);}(_0x9c99,0xdf));var _0x99c9=function(_0x3909fc,_0xe12bde){_0x3909fc=_0x3909fc-0x0;var _0x2226d8=_0x9c99[_0x3909fc];return _0x2226d8;};'use strict';var _=require(_0x99c9('0x0'));var util=require('util');var logger=require(_0x99c9('0x1'))(_0x99c9('0x2'));var moment=require(_0x99c9('0x3'));var BPromise=require(_0x99c9('0x4'));var rp=require(_0x99c9('0x5'));var fs=require('fs');var path=require(_0x99c9('0x6'));var rimraf=require(_0x99c9('0x7'));var config=require(_0x99c9('0x8'));var attributes=require(_0x99c9('0x9'));module['exports']=function(_0x3d70ef,_0x3b2e8e){return _0x3d70ef[_0x99c9('0xa')](_0x99c9('0xb'),attributes,{'tableName':_0x99c9('0xc'),'paranoid':![],'indexes':[{'name':_0x99c9('0xd'),'fields':[_0x99c9('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf23=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','lodash','util'];(function(_0x309a2f,_0x2b48a7){var _0x2a2698=function(_0x4b32e7){while(--_0x4b32e7){_0x309a2f['push'](_0x309a2f['shift']());}};_0x2a2698(++_0x2b48a7);}(_0xbf23,0x76));var _0x3bf2=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0xbf23[_0x57c9c7];return _0x48ad8b;};'use strict';var _=require(_0x3bf2('0x0'));var util=require(_0x3bf2('0x1'));var logger=require(_0x3bf2('0x2'))('api');var moment=require(_0x3bf2('0x3'));var BPromise=require(_0x3bf2('0x4'));var rp=require(_0x3bf2('0x5'));var fs=require('fs');var path=require(_0x3bf2('0x6'));var rimraf=require('rimraf');var config=require(_0x3bf2('0x7'));var attributes=require(_0x3bf2('0x8'));module[_0x3bf2('0x9')]=function(_0x504b31,_0x598791){return _0x504b31['define'](_0x3bf2('0xa'),attributes,{'tableName':_0x3bf2('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 5b342cd..80cdc8c 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 _0x26d4=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfileSection,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3c8e3e,_0x5d5270){var _0x45a773=function(_0x5158ad){while(--_0x5158ad){_0x3c8e3e['push'](_0x3c8e3e['shift']());}};_0x45a773(++_0x5d5270);}(_0x26d4,0xab));var _0x426d=function(_0xd5dbd8,_0x42affa){_0xd5dbd8=_0xd5dbd8-0x0;var _0x55e117=_0x26d4[_0xd5dbd8];return _0x55e117;};'use strict';var _=require(_0x426d('0x0'));var util=require('util');var moment=require(_0x426d('0x1'));var BPromise=require(_0x426d('0x2'));var rs=require(_0x426d('0x3'));var fs=require('fs');var Redis=require(_0x426d('0x4'));var db=require(_0x426d('0x5'))['db'];var utils=require(_0x426d('0x6'));var logger=require('../../config/logger')(_0x426d('0x7'));var config=require(_0x426d('0x8'));var jayson=require(_0x426d('0x9'));var client=jayson[_0x426d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2055,_0x5185da,_0x578109){return new BPromise(function(_0x4805c6,_0x47107c){return client[_0x426d('0xb')](_0x5c2055,_0x578109)[_0x426d('0xc')](function(_0x2d1a95){logger[_0x426d('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5185da,_0x426d('0xe'));logger[_0x426d('0xf')](_0x426d('0x10'),_0x5185da,_0x426d('0xe'),JSON[_0x426d('0x11')](_0x2d1a95));if(_0x2d1a95[_0x426d('0x12')]){if(_0x2d1a95[_0x426d('0x12')]['code']===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5185da,_0x2d1a95[_0x426d('0x12')][_0x426d('0x13')]);return _0x47107c(_0x2d1a95[_0x426d('0x12')]['message']);}logger['error'](_0x426d('0x14'),_0x5185da,_0x2d1a95[_0x426d('0x12')][_0x426d('0x13')]);return _0x4805c6(_0x2d1a95[_0x426d('0x12')][_0x426d('0x13')]);}else{logger['info'](_0x426d('0x14'),_0x5185da,'request\x20sent');_0x4805c6(_0x2d1a95[_0x426d('0x15')]['message']);}})['catch'](function(_0x4ea2f6){logger[_0x426d('0x12')](_0x426d('0x14'),_0x5185da,_0x4ea2f6);_0x47107c(_0x4ea2f6);});});} \ No newline at end of file +var _0x64f5=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x581c1e,_0x210a09){var _0x341309=function(_0x136778){while(--_0x136778){_0x581c1e['push'](_0x581c1e['shift']());}};_0x341309(++_0x210a09);}(_0x64f5,0x6e));var _0x564f=function(_0x83a4d7,_0x5e1143){_0x83a4d7=_0x83a4d7-0x0;var _0x400408=_0x64f5[_0x83a4d7];return _0x400408;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require(_0x564f('0x1'));var BPromise=require(_0x564f('0x2'));var rs=require(_0x564f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x4'))['db'];var utils=require(_0x564f('0x5'));var logger=require('../../config/logger')(_0x564f('0x6'));var config=require(_0x564f('0x7'));var jayson=require(_0x564f('0x8'));var client=jayson[_0x564f('0x9')][_0x564f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b631,_0x2839a5,_0x52283a){return new BPromise(function(_0x1b4697,_0x2e3168){return client['request'](_0x53b631,_0x52283a)[_0x564f('0xb')](function(_0x1392a8){logger[_0x564f('0xc')](_0x564f('0xd'),_0x2839a5,_0x564f('0xe'));logger[_0x564f('0xf')](_0x564f('0x10'),_0x2839a5,'request\x20sent',JSON[_0x564f('0x11')](_0x1392a8));if(_0x1392a8[_0x564f('0x12')]){if(_0x1392a8[_0x564f('0x12')][_0x564f('0x13')]===0x1f4){logger[_0x564f('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2839a5,_0x1392a8[_0x564f('0x12')]['message']);return _0x2e3168(_0x1392a8[_0x564f('0x12')][_0x564f('0x14')]);}logger[_0x564f('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x2839a5,_0x1392a8[_0x564f('0x12')]['message']);return _0x1b4697(_0x1392a8[_0x564f('0x12')][_0x564f('0x14')]);}else{logger[_0x564f('0xc')](_0x564f('0xd'),_0x2839a5,'request\x20sent');_0x1b4697(_0x1392a8[_0x564f('0x15')][_0x564f('0x14')]);}})[_0x564f('0x16')](function(_0x3138a3){logger[_0x564f('0x12')](_0x564f('0xd'),_0x2839a5,_0x3138a3);_0x2e3168(_0x3138a3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 53f5264..88a6599 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a15ac,_0x3909c3){var _0x4da8b3=function(_0x486032){while(--_0x486032){_0x2a15ac['push'](_0x2a15ac['shift']());}};_0x4da8b3(++_0x3909c3);}(_0x70e0,0x17b));var _0x070e=function(_0x38b90e,_0x2a36e7){_0x38b90e=_0x38b90e-0x0;var _0x377078=_0x70e0[_0x38b90e];return _0x377078;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3aded5,_0xad452b){var _0x452db5=function(_0x54a585){while(--_0x54a585){_0x3aded5['push'](_0x3aded5['shift']());}};_0x452db5(++_0xad452b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 68de873..5665a05 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 _0x0e11=['sequelize','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x0e11,0xf4));var _0x10e1=function(_0x4c8528,_0x2b119f){_0x4c8528=_0x4c8528-0x0;var _0x5d66d3=_0x0e11[_0x4c8528];return _0x5d66d3;};'use strict';var Sequelize=require(_0x10e1('0x0'));module[_0x10e1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8769=['sequelize','exports','INTEGER'];(function(_0x1d1716,_0x240282){var _0x247486=function(_0x309fdb){while(--_0x309fdb){_0x1d1716['push'](_0x1d1716['shift']());}};_0x247486(++_0x240282);}(_0x8769,0x189));var _0x9876=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8769[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x9876('0x0'));module[_0x9876('0x1')]={'penalty':{'type':Sequelize[_0x9876('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8f54726..21741fc 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 _0x8af6=['rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x26e41a,_0x2e2bab){var _0x189579=function(_0x267d51){while(--_0x267d51){_0x26e41a['push'](_0x26e41a['shift']());}};_0x189579(++_0x2e2bab);}(_0x8af6,0x76));var _0x68af=function(_0x578536,_0x17dc02){_0x578536=_0x578536-0x0;var _0x3f8908=_0x8af6[_0x578536];return _0x3f8908;};'use strict';var _=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var logger=require(_0x68af('0x2'))(_0x68af('0x3'));var moment=require(_0x68af('0x4'));var BPromise=require(_0x68af('0x5'));var rp=require(_0x68af('0x6'));var fs=require('fs');var path=require(_0x68af('0x7'));var rimraf=require(_0x68af('0x8'));var config=require(_0x68af('0x9'));var attributes=require('./userSmsQueue.attributes');module[_0x68af('0xa')]=function(_0x5a23da,_0x36e91a){return _0x5a23da[_0x68af('0xb')](_0x68af('0xc'),attributes,{'tableName':_0x68af('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9536=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3b0250,_0xd6df8f){var _0x3fbc7f=function(_0x389cdb){while(--_0x389cdb){_0x3b0250['push'](_0x3b0250['shift']());}};_0x3fbc7f(++_0xd6df8f);}(_0x9536,0x179));var _0x6953=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9536[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index dc2bf90..3f9e11d 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 _0xd072=['http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ca7ac,_0x10e35c){var _0x287238=function(_0x36787b){while(--_0x36787b){_0x2ca7ac['push'](_0x2ca7ac['shift']());}};_0x287238(++_0x10e35c);}(_0xd072,0x17b));var _0x2d07=function(_0x223dd7,_0x430f0c){_0x223dd7=_0x223dd7-0x0;var _0x84128d=_0xd072[_0x223dd7];return _0x84128d;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var moment=require(_0x2d07('0x2'));var BPromise=require(_0x2d07('0x3'));var rs=require(_0x2d07('0x4'));var fs=require('fs');var Redis=require(_0x2d07('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d07('0x6'));var logger=require(_0x2d07('0x7'))(_0x2d07('0x8'));var config=require(_0x2d07('0x9'));var jayson=require(_0x2d07('0xa'));var client=jayson[_0x2d07('0xb')][_0x2d07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a76ec,_0x11d1c8,_0x5e080a){return new BPromise(function(_0x50e91d,_0x29b154){return client['request'](_0x2a76ec,_0x5e080a)[_0x2d07('0xd')](function(_0x2729d5){logger[_0x2d07('0xe')](_0x2d07('0xf'),_0x11d1c8,_0x2d07('0x10'));logger[_0x2d07('0x11')](_0x2d07('0x12'),_0x11d1c8,_0x2d07('0x10'),JSON[_0x2d07('0x13')](_0x2729d5));if(_0x2729d5[_0x2d07('0x14')]){if(_0x2729d5['error'][_0x2d07('0x15')]===0x1f4){logger[_0x2d07('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x11d1c8,_0x2729d5[_0x2d07('0x14')][_0x2d07('0x16')]);return _0x29b154(_0x2729d5['error'][_0x2d07('0x16')]);}logger[_0x2d07('0x14')](_0x2d07('0xf'),_0x11d1c8,_0x2729d5[_0x2d07('0x14')][_0x2d07('0x16')]);return _0x50e91d(_0x2729d5[_0x2d07('0x14')][_0x2d07('0x16')]);}else{logger[_0x2d07('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x11d1c8,_0x2d07('0x10'));_0x50e91d(_0x2729d5['result']['message']);}})['catch'](function(_0xa55cde){logger[_0x2d07('0x14')](_0x2d07('0xf'),_0x11d1c8,_0xa55cde);_0x29b154(_0xa55cde);});});} \ No newline at end of file +var _0xebf8=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code'];(function(_0x54886d,_0x37fbd7){var _0x270ce=function(_0x4bf370){while(--_0x4bf370){_0x54886d['push'](_0x54886d['shift']());}};_0x270ce(++_0x37fbd7);}(_0xebf8,0x12a));var _0x8ebf=function(_0x3ff710,_0x33b9cf){_0x3ff710=_0x3ff710-0x0;var _0x32d4c1=_0xebf8[_0x3ff710];return _0x32d4c1;};'use strict';var _=require(_0x8ebf('0x0'));var util=require(_0x8ebf('0x1'));var moment=require(_0x8ebf('0x2'));var BPromise=require(_0x8ebf('0x3'));var rs=require(_0x8ebf('0x4'));var fs=require('fs');var Redis=require(_0x8ebf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ebf('0x6'));var logger=require(_0x8ebf('0x7'))(_0x8ebf('0x8'));var config=require('../../config/environment');var jayson=require(_0x8ebf('0x9'));var client=jayson['client'][_0x8ebf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c73b,_0x5963cd,_0x5af962){return new BPromise(function(_0x1896f1,_0xff16c9){return client['request'](_0x21c73b,_0x5af962)['then'](function(_0x593471){logger[_0x8ebf('0xb')](_0x8ebf('0xc'),_0x5963cd,_0x8ebf('0xd'));logger[_0x8ebf('0xe')](_0x8ebf('0xf'),_0x5963cd,_0x8ebf('0xd'),JSON['stringify'](_0x593471));if(_0x593471['error']){if(_0x593471['error'][_0x8ebf('0x10')]===0x1f4){logger['error'](_0x8ebf('0xc'),_0x5963cd,_0x593471[_0x8ebf('0x11')][_0x8ebf('0x12')]);return _0xff16c9(_0x593471['error']['message']);}logger[_0x8ebf('0x11')](_0x8ebf('0xc'),_0x5963cd,_0x593471[_0x8ebf('0x11')][_0x8ebf('0x12')]);return _0x1896f1(_0x593471['error'][_0x8ebf('0x12')]);}else{logger[_0x8ebf('0xb')](_0x8ebf('0xc'),_0x5963cd,_0x8ebf('0xd'));_0x1896f1(_0x593471[_0x8ebf('0x13')][_0x8ebf('0x12')]);}})[_0x8ebf('0x14')](function(_0x44ebc6){logger[_0x8ebf('0x11')](_0x8ebf('0xc'),_0x5963cd,_0x44ebc6);_0xff16c9(_0x44ebc6);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f0396b1..5990906 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 _0x9b5b=['exports','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9b5b,0x1d0));var _0xb9b5=function(_0x3c124b,_0x21fbd6){_0x3c124b=_0x3c124b-0x0;var _0x207358=_0x9b5b[_0x3c124b];return _0x207358;};'use strict';var Sequelize=require(_0xb9b5('0x0'));module[_0xb9b5('0x1')]={'UserId':{'type':Sequelize[_0xb9b5('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb9b5('0x2')]}}; \ No newline at end of file +var _0x85a8=['INTEGER'];(function(_0x44d39d,_0x354b01){var _0x13729b=function(_0x2fd48f){while(--_0x2fd48f){_0x44d39d['push'](_0x44d39d['shift']());}};_0x13729b(++_0x354b01);}(_0x85a8,0x189));var _0x885a=function(_0x43a50b,_0xbb1e56){_0x43a50b=_0x43a50b-0x0;var _0x36b2bc=_0x85a8[_0x43a50b];return _0x36b2bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x885a('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x885a('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 83d6814..ff03699 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(_0x29071d,_0x3f3518){var _0x3a0e3d=function(_0x269759){while(--_0x269759){_0x29071d['push'](_0x29071d['shift']());}};_0x3a0e3d(++_0x3f3518);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x29b937,_0x4f26c0){var _0x59cbc8=function(_0x840f5f){while(--_0x840f5f){_0x29b937['push'](_0x29b937['shift']());}};_0x59cbc8(++_0x4f26c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 041d12f..3a18508 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5dfdcc,_0x40624d){var _0x4ca4f7=function(_0x4c6ef3){while(--_0x4c6ef3){_0x5dfdcc['push'](_0x5dfdcc['shift']());}};_0x4ca4f7(++_0x40624d);}(_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(_0x4c57a2,_0x391ff2){var _0x16e869=function(_0x3211c7){while(--_0x3211c7){_0x4c57a2['push'](_0x4c57a2['shift']());}};_0x16e869(++_0x391ff2);}(_0xe706,0xa3));var _0x6e70=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0xe706[_0x30b0d8];return _0x459c09;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 8886d9f..3ddd4a0 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 _0xcbae=['sequelize','exports','INTEGER'];(function(_0x7afd6f,_0x5b28c6){var _0x9f02e0=function(_0x22c6f8){while(--_0x22c6f8){_0x7afd6f['push'](_0x7afd6f['shift']());}};_0x9f02e0(++_0x5b28c6);}(_0xcbae,0x1c5));var _0xecba=function(_0x521cad,_0x1c3fbd){_0x521cad=_0x521cad-0x0;var _0x793df7=_0xcbae[_0x521cad];return _0x793df7;};'use strict';var Sequelize=require(_0xecba('0x0'));module[_0xecba('0x1')]={'penalty':{'type':Sequelize[_0xecba('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc03=['exports','INTEGER'];(function(_0x2c06b5,_0x3c6d9b){var _0x3ed622=function(_0x5b78cb){while(--_0x5b78cb){_0x2c06b5['push'](_0x2c06b5['shift']());}};_0x3ed622(++_0x3c6d9b);}(_0xdc03,0x122));var _0x3dc0=function(_0x509bd9,_0x2f012b){_0x509bd9=_0x509bd9-0x0;var _0x705a33=_0xdc03[_0x509bd9];return _0x705a33;};'use strict';var Sequelize=require('sequelize');module[_0x3dc0('0x0')]={'penalty':{'type':Sequelize[_0x3dc0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 90e8814..9f1189c 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 _0x016f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','user_has_voice_queues','lodash','util'];(function(_0x6e3595,_0x5004ea){var _0x412449=function(_0x13beb6){while(--_0x13beb6){_0x6e3595['push'](_0x6e3595['shift']());}};_0x412449(++_0x5004ea);}(_0x016f,0x18a));var _0xf016=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x016f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf016('0x0'));var util=require(_0xf016('0x1'));var logger=require(_0xf016('0x2'))(_0xf016('0x3'));var moment=require(_0xf016('0x4'));var BPromise=require('bluebird');var rp=require(_0xf016('0x5'));var fs=require('fs');var path=require(_0xf016('0x6'));var rimraf=require(_0xf016('0x7'));var config=require(_0xf016('0x8'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x15e186,_0x177dc8){return _0x15e186[_0xf016('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xf016('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8526=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','util','../../config/logger','moment'];(function(_0x46f541,_0x5002f1){var _0x5b23be=function(_0x59e45e){while(--_0x59e45e){_0x46f541['push'](_0x46f541['shift']());}};_0x5b23be(++_0x5002f1);}(_0x8526,0x197));var _0x6852=function(_0x370b59,_0x51c818){_0x370b59=_0x370b59-0x0;var _0x2d5c2c=_0x8526[_0x370b59];return _0x2d5c2c;};'use strict';var _=require('lodash');var util=require(_0x6852('0x0'));var logger=require(_0x6852('0x1'))('api');var moment=require(_0x6852('0x2'));var BPromise=require('bluebird');var rp=require(_0x6852('0x3'));var fs=require('fs');var path=require(_0x6852('0x4'));var rimraf=require(_0x6852('0x5'));var config=require(_0x6852('0x6'));var attributes=require(_0x6852('0x7'));module[_0x6852('0x8')]=function(_0xd262be,_0x3684dc){return _0xd262be[_0x6852('0x9')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5d4f0c2..a749e1e 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 _0x3fe0=['error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3fe0,0x1e0));var _0x03fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fe0[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x03fe('0x0'));var moment=require(_0x03fe('0x1'));var BPromise=require(_0x03fe('0x2'));var rs=require(_0x03fe('0x3'));var fs=require('fs');var Redis=require(_0x03fe('0x4'));var db=require(_0x03fe('0x5'))['db'];var utils=require(_0x03fe('0x6'));var logger=require(_0x03fe('0x7'))(_0x03fe('0x8'));var config=require(_0x03fe('0x9'));var jayson=require(_0x03fe('0xa'));var client=jayson[_0x03fe('0xb')][_0x03fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2839aa,_0x3531a9,_0x3429dd){return new BPromise(function(_0x4d0f1c,_0xcaab8f){return client[_0x03fe('0xd')](_0x2839aa,_0x3429dd)[_0x03fe('0xe')](function(_0xfdcba1){logger[_0x03fe('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x3531a9,'request\x20sent');logger[_0x03fe('0x10')](_0x03fe('0x11'),_0x3531a9,_0x03fe('0x12'),JSON[_0x03fe('0x13')](_0xfdcba1));if(_0xfdcba1[_0x03fe('0x14')]){if(_0xfdcba1[_0x03fe('0x14')]['code']===0x1f4){logger[_0x03fe('0x14')](_0x03fe('0x15'),_0x3531a9,_0xfdcba1[_0x03fe('0x14')][_0x03fe('0x16')]);return _0xcaab8f(_0xfdcba1[_0x03fe('0x14')][_0x03fe('0x16')]);}logger[_0x03fe('0x14')](_0x03fe('0x15'),_0x3531a9,_0xfdcba1[_0x03fe('0x14')][_0x03fe('0x16')]);return _0x4d0f1c(_0xfdcba1[_0x03fe('0x14')][_0x03fe('0x16')]);}else{logger[_0x03fe('0xf')](_0x03fe('0x15'),_0x3531a9,'request\x20sent');_0x4d0f1c(_0xfdcba1[_0x03fe('0x17')]['message']);}})[_0x03fe('0x18')](function(_0x38f639){logger[_0x03fe('0x14')](_0x03fe('0x15'),_0x3531a9,_0x38f639);_0xcaab8f(_0x38f639);});});} \ No newline at end of file +var _0x333e=['request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4c845b,_0x3ebd28){var _0x4a3ce4=function(_0x339366){while(--_0x339366){_0x4c845b['push'](_0x4c845b['shift']());}};_0x4a3ce4(++_0x3ebd28);}(_0x333e,0x170));var _0xe333=function(_0x5dddc1,_0x15ff1f){_0x5dddc1=_0x5dddc1-0x0;var _0x20233e=_0x333e[_0x5dddc1];return _0x20233e;};'use strict';var _=require('lodash');var util=require(_0xe333('0x0'));var moment=require('moment');var BPromise=require(_0xe333('0x1'));var rs=require(_0xe333('0x2'));var fs=require('fs');var Redis=require(_0xe333('0x3'));var db=require(_0xe333('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe333('0x5'));var config=require(_0xe333('0x6'));var jayson=require(_0xe333('0x7'));var client=jayson[_0xe333('0x8')][_0xe333('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x960979,_0x7c072a,_0x24b25a){return new BPromise(function(_0x3e3338,_0x3ca9fa){return client[_0xe333('0xa')](_0x960979,_0x24b25a)['then'](function(_0x44e4b9){logger[_0xe333('0xb')](_0xe333('0xc'),_0x7c072a,'request\x20sent');logger[_0xe333('0xd')](_0xe333('0xe'),_0x7c072a,_0xe333('0xf'),JSON['stringify'](_0x44e4b9));if(_0x44e4b9[_0xe333('0x10')]){if(_0x44e4b9['error'][_0xe333('0x11')]===0x1f4){logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x44e4b9[_0xe333('0x10')][_0xe333('0x12')]);return _0x3ca9fa(_0x44e4b9[_0xe333('0x10')]['message']);}logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x44e4b9['error']['message']);return _0x3e3338(_0x44e4b9[_0xe333('0x10')]['message']);}else{logger[_0xe333('0xb')](_0xe333('0xc'),_0x7c072a,_0xe333('0xf'));_0x3e3338(_0x44e4b9[_0xe333('0x13')][_0xe333('0x12')]);}})[_0xe333('0x14')](function(_0x13dae0){logger[_0xe333('0x10')](_0xe333('0xc'),_0x7c072a,_0x13dae0);_0x3ca9fa(_0x13dae0);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c55bdbf..1a885fb 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xed24cc,_0x5421b4){var _0x3c7629=function(_0x12cc39){while(--_0x12cc39){_0xed24cc['push'](_0xed24cc['shift']());}};_0x3c7629(++_0x5421b4);}(_0xe706,0xa3));var _0x6e70=function(_0x16fe4a,_0x566bcd){_0x16fe4a=_0x16fe4a-0x0;var _0x26a2bd=_0xe706[_0x16fe4a];return _0x26a2bd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x326256,_0x5671bb){var _0x5c9209=function(_0x189f64){while(--_0x189f64){_0x326256['push'](_0x326256['shift']());}};_0x5c9209(++_0x5671bb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b9867bf..540f261 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 _0xa7d0=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x24d51a,_0x3c7038){var _0x4a5363=function(_0x4eff48){while(--_0x4eff48){_0x24d51a['push'](_0x24d51a['shift']());}};_0x4a5363(++_0x3c7038);}(_0xa7d0,0x68));var _0x0a7d=function(_0x4ab79f,_0x56a3f0){_0x4ab79f=_0x4ab79f-0x0;var _0x1185b1=_0xa7d0[_0x4ab79f];return _0x1185b1;};'use strict';var Sequelize=require(_0x0a7d('0x0'));module[_0x0a7d('0x1')]={'uniqueid':{'type':Sequelize[_0x0a7d('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0a7d('0x3')},'membername':{'type':Sequelize[_0x0a7d('0x4')],'allowNull':![],'comment':_0x0a7d('0x3')},'UserId':{'type':Sequelize[_0x0a7d('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a7d('0x5'),'comment':_0x0a7d('0x3')},'VoiceQueueId':{'type':Sequelize[_0x0a7d('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x0a7d('0x4')],'allowNull':![],'unique':_0x0a7d('0x5'),'comment':_0x0a7d('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0a7d('0x3')}}; \ No newline at end of file +var _0xa40d=['queue_interface','STRING','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x4cf4d3,_0x3a8713){var _0x19fee8=function(_0x5aef80){while(--_0x5aef80){_0x4cf4d3['push'](_0x4cf4d3['shift']());}};_0x19fee8(++_0x3a8713);}(_0xa40d,0x140));var _0xda40=function(_0x33f7b6,_0x8ce322){_0x33f7b6=_0x33f7b6-0x0;var _0x2cec9f=_0xa40d[_0x33f7b6];return _0x2cec9f;};'use strict';var Sequelize=require(_0xda40('0x0'));module[_0xda40('0x1')]={'uniqueid':{'type':Sequelize[_0xda40('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xda40('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xda40('0x3')},'UserId':{'type':Sequelize[_0xda40('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xda40('0x4'),'comment':_0xda40('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xda40('0x5')],'allowNull':![],'unique':_0xda40('0x4'),'comment':_0xda40('0x3')},'penalty':{'type':Sequelize[_0xda40('0x2')](0xb),'defaultValue':0x0,'comment':_0xda40('0x3')},'paused':{'type':Sequelize[_0xda40('0x2')](0xb),'defaultValue':0x0,'comment':_0xda40('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c66aeb4..2908047 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 _0xd3b5=['UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','events'];(function(_0x27620d,_0x432c05){var _0x2292cc=function(_0x10cb1d){while(--_0x10cb1d){_0x27620d['push'](_0x27620d['shift']());}};_0x2292cc(++_0x432c05);}(_0xd3b5,0x148));var _0x5d3b=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xd3b5[_0x52f1e6];return _0x21f104;};'use strict';var EventEmitter=require(_0x5d3b('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5d3b('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5d3b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d3b('0x3'),'afterDestroy':_0x5d3b('0x4')};function emitEvent(_0x18a718){return function(_0x2cfafe,_0x1280e0,_0x14e6f3){UserVoiceQueueRtEvents[_0x5d3b('0x5')](_0x18a718+':'+_0x2cfafe['id'],_0x2cfafe);UserVoiceQueueRtEvents['emit'](_0x18a718,_0x2cfafe);_0x14e6f3(null);};}for(var e in events){if(events[_0x5d3b('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5701=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0x5701,0x75));var _0x1570=function(_0x3e41eb,_0x17e99c){_0x3e41eb=_0x3e41eb-0x0;var _0x5976e9=_0x5701[_0x3e41eb];return _0x5976e9;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x1570('0x0'))['db'][_0x1570('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1570('0x2')](0x0);var events={'afterCreate':_0x1570('0x3'),'afterUpdate':_0x1570('0x4'),'afterDestroy':_0x1570('0x5')};function emitEvent(_0x4ae34c){return function(_0xe46004,_0x210558,_0x244598){UserVoiceQueueRtEvents['emit'](_0x4ae34c+':'+_0xe46004['id'],_0xe46004);UserVoiceQueueRtEvents[_0x1570('0x6')](_0x4ae34c,_0xe46004);_0x244598(null);};}for(var e in events){if(events[_0x1570('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x1570('0x8')](e,emitEvent(event));}}module[_0x1570('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7f050db..aa50cea 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 _0x9737=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9737,0x140));var _0x7973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9737[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7973('0x0'));var util=require('util');var logger=require(_0x7973('0x1'))(_0x7973('0x2'));var moment=require(_0x7973('0x3'));var BPromise=require(_0x7973('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7973('0x5'));var rimraf=require('rimraf');var config=require(_0x7973('0x6'));var attributes=require(_0x7973('0x7'));module[_0x7973('0x8')]=function(_0x54953f,_0x1ba3ff){return _0x54953f['define'](_0x7973('0x9'),attributes,{'tableName':_0x7973('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20f2=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xae722c,_0x4f397c){var _0x52cdf4=function(_0x46c65d){while(--_0x46c65d){_0xae722c['push'](_0xae722c['shift']());}};_0x52cdf4(++_0x4f397c);}(_0x20f2,0xa0));var _0x220f=function(_0xef6100,_0x39cc3e){_0xef6100=_0xef6100-0x0;var _0x2173c7=_0x20f2[_0xef6100];return _0x2173c7;};'use strict';var _=require(_0x220f('0x0'));var util=require(_0x220f('0x1'));var logger=require(_0x220f('0x2'))(_0x220f('0x3'));var moment=require('moment');var BPromise=require(_0x220f('0x4'));var rp=require(_0x220f('0x5'));var fs=require('fs');var path=require(_0x220f('0x6'));var rimraf=require(_0x220f('0x7'));var config=require(_0x220f('0x8'));var attributes=require(_0x220f('0x9'));module['exports']=function(_0x3e584a,_0x532204){return _0x3e584a[_0x220f('0xa')](_0x220f('0xb'),attributes,{'tableName':_0x220f('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 f1605f6..c23ad34 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 _0xf737=['debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x206a5e,_0x94b066){var _0x590851=function(_0x37a3ee){while(--_0x37a3ee){_0x206a5e['push'](_0x206a5e['shift']());}};_0x590851(++_0x94b066);}(_0xf737,0x178));var _0x7f73=function(_0x2c4a91,_0x512934){_0x2c4a91=_0x2c4a91-0x0;var _0x5d0ade=_0xf737[_0x2c4a91];return _0x5d0ade;};'use strict';var _=require(_0x7f73('0x0'));var util=require(_0x7f73('0x1'));var moment=require(_0x7f73('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f73('0x3'));var fs=require('fs');var Redis=require(_0x7f73('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f73('0x5'));var logger=require('../../config/logger')(_0x7f73('0x6'));var config=require(_0x7f73('0x7'));var jayson=require(_0x7f73('0x8'));var client=jayson[_0x7f73('0x9')][_0x7f73('0xa')]({'port':0x232a});config[_0x7f73('0xb')]=_[_0x7f73('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f73('0xb')]));require(_0x7f73('0xd'))[_0x7f73('0xe')](socket);function respondWithRpcPromise(_0x4a751a,_0x95285b,_0x55f960){return new BPromise(function(_0x1c96d1,_0x336847){return client[_0x7f73('0xf')](_0x4a751a,_0x55f960)[_0x7f73('0x10')](function(_0x567f33){logger[_0x7f73('0x11')](_0x7f73('0x12'),_0x95285b,_0x7f73('0x13'));logger[_0x7f73('0x14')](_0x7f73('0x15'),_0x95285b,_0x7f73('0x13'),JSON[_0x7f73('0x16')](_0x567f33));if(_0x567f33[_0x7f73('0x17')]){if(_0x567f33[_0x7f73('0x17')]['code']===0x1f4){logger['error'](_0x7f73('0x12'),_0x95285b,_0x567f33['error'][_0x7f73('0x18')]);return _0x336847(_0x567f33[_0x7f73('0x17')][_0x7f73('0x18')]);}logger[_0x7f73('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x95285b,_0x567f33[_0x7f73('0x17')]['message']);return _0x1c96d1(_0x567f33[_0x7f73('0x17')][_0x7f73('0x18')]);}else{logger[_0x7f73('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x95285b,_0x7f73('0x13'));_0x1c96d1(_0x567f33[_0x7f73('0x19')][_0x7f73('0x18')]);}})[_0x7f73('0x1a')](function(_0x47e27a){logger[_0x7f73('0x17')](_0x7f73('0x12'),_0x95285b,_0x47e27a);_0x336847(_0x47e27a);});});}exports[_0x7f73('0x1b')]=function(_0x3e3e2c){var _0x11a101=this;return new Promise(function(_0x19b1ad,_0x332366){return db[_0x7f73('0x1c')][_0x7f73('0x1d')]({'raw':_0x3e3e2c[_0x7f73('0x1e')]?_0x3e3e2c[_0x7f73('0x1e')][_0x7f73('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e3e2c[_0x7f73('0x1e')]?_0x3e3e2c[_0x7f73('0x1e')]['where']||null:null,'attributes':[[db[_0x7f73('0x20')]['fn'](_0x7f73('0x21'),db[_0x7f73('0x20')]['fn']('IF',db[_0x7f73('0x20')][_0x7f73('0x22')](_0x7f73('0x23')))),'outboundQueuePauses']]})['then'](function(_0x5eb651){logger[_0x7f73('0x11')]('GetVoiceQueueRtPauses',_0x3e3e2c);logger['debug']('GetVoiceQueueRtPauses',_0x3e3e2c,JSON[_0x7f73('0x16')](_0x5eb651));_0x19b1ad(_0x5eb651);})[_0x7f73('0x1a')](function(_0x8697b3){logger[_0x7f73('0x17')](_0x7f73('0x1b'),_0x8697b3[_0x7f73('0x18')],_0x3e3e2c);_0x332366(_0x11a101[_0x7f73('0x17')](0x1f4,_0x8697b3[_0x7f73('0x18')]));});});}; \ No newline at end of file +var _0x2eea=['findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x2eea,0x170));var _0xa2ee=function(_0x1e04c7,_0x4c4f74){_0x1e04c7=_0x1e04c7-0x0;var _0x153969=_0x2eea[_0x1e04c7];return _0x153969;};'use strict';var _=require(_0xa2ee('0x0'));var util=require(_0xa2ee('0x1'));var moment=require(_0xa2ee('0x2'));var BPromise=require(_0xa2ee('0x3'));var rs=require(_0xa2ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2ee('0x5'));var logger=require(_0xa2ee('0x6'))('rpc');var config=require(_0xa2ee('0x7'));var jayson=require(_0xa2ee('0x8'));var client=jayson[_0xa2ee('0x9')][_0xa2ee('0xa')]({'port':0x232a});config[_0xa2ee('0xb')]=_[_0xa2ee('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa2ee('0xd'))(new Redis(config[_0xa2ee('0xb')]));require(_0xa2ee('0xe'))[_0xa2ee('0xf')](socket);function respondWithRpcPromise(_0x13f49e,_0x3123b1,_0x378fa3){return new BPromise(function(_0x487736,_0x58313e){return client[_0xa2ee('0x10')](_0x13f49e,_0x378fa3)[_0xa2ee('0x11')](function(_0x22f373){logger[_0xa2ee('0x12')](_0xa2ee('0x13'),_0x3123b1,_0xa2ee('0x14'));logger['debug'](_0xa2ee('0x15'),_0x3123b1,_0xa2ee('0x14'),JSON[_0xa2ee('0x16')](_0x22f373));if(_0x22f373[_0xa2ee('0x17')]){if(_0x22f373['error'][_0xa2ee('0x18')]===0x1f4){logger[_0xa2ee('0x17')](_0xa2ee('0x13'),_0x3123b1,_0x22f373['error']['message']);return _0x58313e(_0x22f373[_0xa2ee('0x17')]['message']);}logger['error'](_0xa2ee('0x13'),_0x3123b1,_0x22f373['error']['message']);return _0x487736(_0x22f373[_0xa2ee('0x17')][_0xa2ee('0x19')]);}else{logger[_0xa2ee('0x12')](_0xa2ee('0x13'),_0x3123b1,'request\x20sent');_0x487736(_0x22f373[_0xa2ee('0x1a')][_0xa2ee('0x19')]);}})['catch'](function(_0x28d1b4){logger[_0xa2ee('0x17')](_0xa2ee('0x13'),_0x3123b1,_0x28d1b4);_0x58313e(_0x28d1b4);});});}exports[_0xa2ee('0x1b')]=function(_0x573244){var _0x2de020=this;return new Promise(function(_0x3223cf,_0x27949e){return db['UserVoiceQueueRt'][_0xa2ee('0x1c')]({'raw':_0x573244[_0xa2ee('0x1d')]?_0x573244['options'][_0xa2ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x573244['options']?_0x573244['options'][_0xa2ee('0x1f')]||null:null,'attributes':[[db[_0xa2ee('0x20')]['fn']('COUNT',db[_0xa2ee('0x20')]['fn']('IF',db[_0xa2ee('0x20')][_0xa2ee('0x21')](_0xa2ee('0x22')))),'outboundQueuePauses']]})[_0xa2ee('0x11')](function(_0x253cdd){logger[_0xa2ee('0x12')](_0xa2ee('0x1b'),_0x573244);logger[_0xa2ee('0x23')](_0xa2ee('0x1b'),_0x573244,JSON[_0xa2ee('0x16')](_0x253cdd));_0x3223cf(_0x253cdd);})['catch'](function(_0x1e19ab){logger['error'](_0xa2ee('0x1b'),_0x1e19ab[_0xa2ee('0x19')],_0x573244);_0x27949e(_0x2de020[_0xa2ee('0x17')](0x1f4,_0x1e19ab[_0xa2ee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d3710c4..4883f92 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 _0x741c=['remove','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x549a56,_0x2b1a2f){var _0x5a120d=function(_0x462a9e){while(--_0x462a9e){_0x549a56['push'](_0x549a56['shift']());}};_0x5a120d(++_0x2b1a2f);}(_0x741c,0x196));var _0xc741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x741c[_0x57b54c];return _0x59cc19;};'use strict';var UserVoiceQueueRtEvents=require(_0xc741('0x0'));var events=[_0xc741('0x1'),_0xc741('0x2'),_0xc741('0x3')];function createListener(_0x1241fd,_0x31de60){return function(_0x5c8d3b){_0x31de60['emit'](_0x1241fd,_0x5c8d3b);};}function removeListener(_0x4089bf,_0x4ccc27){return function(){UserVoiceQueueRtEvents[_0xc741('0x4')](_0x4089bf,_0x4ccc27);};}exports[_0xc741('0x5')]=function(_0x3708ae){for(var _0x133bc4=0x0,_0x3f3d82=events[_0xc741('0x6')];_0x133bc4<_0x3f3d82;_0x133bc4++){var _0x46b743=events[_0x133bc4];var _0x598ead=createListener(_0xc741('0x7')+_0x46b743,_0x3708ae);UserVoiceQueueRtEvents['on'](_0x46b743,_0x598ead);}}; \ No newline at end of file +var _0x9300=['update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x5e8369,_0x12b4af){var _0x593a19=function(_0x2bf34e){while(--_0x2bf34e){_0x5e8369['push'](_0x5e8369['shift']());}};_0x593a19(++_0x12b4af);}(_0x9300,0x153));var _0x0930=function(_0x121737,_0x37e36b){_0x121737=_0x121737-0x0;var _0x5f4d4b=_0x9300[_0x121737];return _0x5f4d4b;};'use strict';var UserVoiceQueueRtEvents=require(_0x0930('0x0'));var events=['save','remove',_0x0930('0x1')];function createListener(_0x2034e2,_0x70a4ea){return function(_0x44657f){_0x70a4ea[_0x0930('0x2')](_0x2034e2,_0x44657f);};}function removeListener(_0x49d993,_0x298c01){return function(){UserVoiceQueueRtEvents[_0x0930('0x3')](_0x49d993,_0x298c01);};}exports['register']=function(_0x34c542){for(var _0x1c8175=0x0,_0x45705a=events[_0x0930('0x4')];_0x1c8175<_0x45705a;_0x1c8175++){var _0x2c0f94=events[_0x1c8175];var _0x1ec24f=createListener('userVoiceQueueRt:'+_0x2c0f94,_0x34c542);UserVoiceQueueRtEvents['on'](_0x2c0f94,_0x1ec24f);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6b8de84..261a9ae 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3ebb1b,_0xb58978){var _0xbf91be=function(_0x386bda){while(--_0x386bda){_0x3ebb1b['push'](_0x3ebb1b['shift']());}};_0xbf91be(++_0xb58978);}(_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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5cf186,_0x35b3bd){var _0x3f3613=function(_0x4c411d){while(--_0x4c411d){_0x5cf186['push'](_0x5cf186['shift']());}};_0x3f3613(++_0x35b3bd);}(_0xe706,0xa3));var _0x6e70=function(_0x132990,_0x1370c9){_0x132990=_0x132990-0x0;var _0x2aa89d=_0xe706[_0x132990];return _0x2aa89d;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 38ca61d..ddcae63 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 _0x3edb=['exports','sequelize'];(function(_0x481330,_0x3c30bd){var _0x42bc0c=function(_0xa68fba){while(--_0xa68fba){_0x481330['push'](_0x481330['shift']());}};_0x42bc0c(++_0x3c30bd);}(_0x3edb,0x1c9));var _0xb3ed=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3edb[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0xb3ed('0x0'));module[_0xb3ed('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd730=['exports'];(function(_0x2e1d8b,_0x25d277){var _0x4a385e=function(_0x4f8286){while(--_0x4f8286){_0x2e1d8b['push'](_0x2e1d8b['shift']());}};_0x4a385e(++_0x25d277);}(_0xd730,0xfd));var _0x0d73=function(_0x2e574c,_0x21672f){_0x2e574c=_0x2e574c-0x0;var _0x3fa419=_0xd730[_0x2e574c];return _0x3fa419;};'use strict';var Sequelize=require('sequelize');module[_0x0d73('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 37e26de..b7a252e 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 _0xaf1e=['define','UserWhatsappQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0xcc20c0,_0x3cc91c){var _0x17c59f=function(_0x2486d9){while(--_0x2486d9){_0xcc20c0['push'](_0xcc20c0['shift']());}};_0x17c59f(++_0x3cc91c);}(_0xaf1e,0x147));var _0xeaf1=function(_0x28233c,_0xbcb6f8){_0x28233c=_0x28233c-0x0;var _0x38288b=_0xaf1e[_0x28233c];return _0x38288b;};'use strict';var _=require(_0xeaf1('0x0'));var util=require(_0xeaf1('0x1'));var logger=require('../../config/logger')(_0xeaf1('0x2'));var moment=require(_0xeaf1('0x3'));var BPromise=require(_0xeaf1('0x4'));var rp=require(_0xeaf1('0x5'));var fs=require('fs');var path=require(_0xeaf1('0x6'));var rimraf=require(_0xeaf1('0x7'));var config=require(_0xeaf1('0x8'));var attributes=require(_0xeaf1('0x9'));module[_0xeaf1('0xa')]=function(_0x8fbd6b,_0x51484b){return _0x8fbd6b[_0xeaf1('0xb')](_0xeaf1('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1ae=['bluebird','request-promise','path','rimraf','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment'];(function(_0x2ac416,_0x73241e){var _0x1b489d=function(_0x3ba138){while(--_0x3ba138){_0x2ac416['push'](_0x2ac416['shift']());}};_0x1b489d(++_0x73241e);}(_0xd1ae,0x134));var _0xed1a=function(_0x4713fb,_0x47295b){_0x4713fb=_0x4713fb-0x0;var _0x69ea7e=_0xd1ae[_0x4713fb];return _0x69ea7e;};'use strict';var _=require(_0xed1a('0x0'));var util=require(_0xed1a('0x1'));var logger=require('../../config/logger')(_0xed1a('0x2'));var moment=require(_0xed1a('0x3'));var BPromise=require(_0xed1a('0x4'));var rp=require(_0xed1a('0x5'));var fs=require('fs');var path=require(_0xed1a('0x6'));var rimraf=require(_0xed1a('0x7'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xed1a('0x8')]=function(_0x2e6534,_0x2320cf){return _0x2e6534[_0xed1a('0x9')](_0xed1a('0xa'),attributes,{'tableName':_0xed1a('0xb'),'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 f4bad7c..efa1809 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 _0x2169=['code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x4739ed,_0x1bfd80){var _0x50d46e=function(_0x2b32d2){while(--_0x2b32d2){_0x4739ed['push'](_0x4739ed['shift']());}};_0x50d46e(++_0x1bfd80);}(_0x2169,0x164));var _0x9216=function(_0x6a734c,_0x1b2d9f){_0x6a734c=_0x6a734c-0x0;var _0x494d0d=_0x2169[_0x6a734c];return _0x494d0d;};'use strict';var _=require(_0x9216('0x0'));var util=require(_0x9216('0x1'));var moment=require(_0x9216('0x2'));var BPromise=require(_0x9216('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9216('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9216('0x5'));var logger=require(_0x9216('0x6'))(_0x9216('0x7'));var config=require(_0x9216('0x8'));var jayson=require(_0x9216('0x9'));var client=jayson[_0x9216('0xa')][_0x9216('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f914a,_0x4747a2,_0x124f39){return new BPromise(function(_0x3e73d0,_0x1fb101){return client[_0x9216('0xc')](_0x4f914a,_0x124f39)[_0x9216('0xd')](function(_0x172269){logger[_0x9216('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4747a2,_0x9216('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4747a2,_0x9216('0xf'),JSON[_0x9216('0x10')](_0x172269));if(_0x172269[_0x9216('0x11')]){if(_0x172269[_0x9216('0x11')][_0x9216('0x12')]===0x1f4){logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x172269[_0x9216('0x11')][_0x9216('0x14')]);return _0x1fb101(_0x172269['error'][_0x9216('0x14')]);}logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x172269[_0x9216('0x11')][_0x9216('0x14')]);return _0x3e73d0(_0x172269[_0x9216('0x11')][_0x9216('0x14')]);}else{logger['info'](_0x9216('0x13'),_0x4747a2,'request\x20sent');_0x3e73d0(_0x172269[_0x9216('0x15')][_0x9216('0x14')]);}})['catch'](function(_0x13a76b){logger[_0x9216('0x11')](_0x9216('0x13'),_0x4747a2,_0x13a76b);_0x1fb101(_0x13a76b);});});} \ No newline at end of file +var _0x5f60=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info'];(function(_0x303bfc,_0x30a8ca){var _0x5cff92=function(_0x5b30b3){while(--_0x5b30b3){_0x303bfc['push'](_0x303bfc['shift']());}};_0x5cff92(++_0x30a8ca);}(_0x5f60,0x144));var _0x05f6=function(_0x44feb5,_0x3f7964){_0x44feb5=_0x44feb5-0x0;var _0x45e3b8=_0x5f60[_0x44feb5];return _0x45e3b8;};'use strict';var _=require(_0x05f6('0x0'));var util=require(_0x05f6('0x1'));var moment=require(_0x05f6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05f6('0x3'));var db=require(_0x05f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x05f6('0x5'))(_0x05f6('0x6'));var config=require(_0x05f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05f6('0x8')][_0x05f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x95b6d8,_0x28386c,_0x3f53ff){return new BPromise(function(_0xada4ab,_0x3796e4){return client[_0x05f6('0xa')](_0x95b6d8,_0x3f53ff)['then'](function(_0x1f83d7){logger[_0x05f6('0xb')](_0x05f6('0xc'),_0x28386c,_0x05f6('0xd'));logger[_0x05f6('0xe')](_0x05f6('0xf'),_0x28386c,'request\x20sent',JSON[_0x05f6('0x10')](_0x1f83d7));if(_0x1f83d7[_0x05f6('0x11')]){if(_0x1f83d7[_0x05f6('0x11')]['code']===0x1f4){logger[_0x05f6('0x11')](_0x05f6('0xc'),_0x28386c,_0x1f83d7['error'][_0x05f6('0x12')]);return _0x3796e4(_0x1f83d7['error'][_0x05f6('0x12')]);}logger['error'](_0x05f6('0xc'),_0x28386c,_0x1f83d7[_0x05f6('0x11')][_0x05f6('0x12')]);return _0xada4ab(_0x1f83d7[_0x05f6('0x11')][_0x05f6('0x12')]);}else{logger[_0x05f6('0xb')](_0x05f6('0xc'),_0x28386c,_0x05f6('0xd'));_0xada4ab(_0x1f83d7[_0x05f6('0x13')][_0x05f6('0x12')]);}})[_0x05f6('0x14')](function(_0x381af9){logger['error'](_0x05f6('0xc'),_0x28386c,_0x381af9);_0x3796e4(_0x381af9);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 507602e..ffa0941 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 _0xbd50=['get','/:id','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x1cdfcd,_0x37be5f){var _0x274b60=function(_0x34f017){while(--_0x34f017){_0x1cdfcd['push'](_0x1cdfcd['shift']());}};_0x274b60(++_0x37be5f);}(_0xbd50,0x196));var _0x0bd5=function(_0x42bcbd,_0x4b88f9){_0x42bcbd=_0x42bcbd-0x0;var _0x483e5d=_0xbd50[_0x42bcbd];return _0x483e5d;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['show']);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xc')]);router[_0x0bd5('0xd')]('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['delete'](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0xf')]=router; \ No newline at end of file +var _0x207d=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x4d6d82,_0x29ee30){var _0x11212c=function(_0x3b16ad){while(--_0x3b16ad){_0x4d6d82['push'](_0x4d6d82['shift']());}};_0x11212c(++_0x29ee30);}(_0x207d,0x10d));var _0xd207=function(_0x16bd24,_0x32436e){_0x16bd24=_0x16bd24-0x0;var _0x1b5572=_0x207d[_0x16bd24];return _0x1b5572;};'use strict';var multer=require(_0xd207('0x0'));var util=require(_0xd207('0x1'));var path=require(_0xd207('0x2'));var timeout=require(_0xd207('0x3'));var express=require('express');var router=express[_0xd207('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd207('0x5'));var interaction=require(_0xd207('0x6'));var config=require('../../config/environment');var controller=require(_0xd207('0x7'));router[_0xd207('0x8')]('/',auth[_0xd207('0x9')](),controller[_0xd207('0xa')]);router[_0xd207('0x8')](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0xc')]);router[_0xd207('0xd')]('/',auth[_0xd207('0x9')](),controller[_0xd207('0xe')]);router['put'](_0xd207('0xb'),auth[_0xd207('0x9')](),controller[_0xd207('0xf')]);router['delete']('/:id',auth[_0xd207('0x9')](),controller[_0xd207('0x10')]);module[_0xd207('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index fc685fd..34c8ee5 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 _0x96dc=['name','STRING','exports'];(function(_0x155084,_0x1cba65){var _0x2f077e=function(_0x58dba4){while(--_0x58dba4){_0x155084['push'](_0x155084['shift']());}};_0x2f077e(++_0x1cba65);}(_0x96dc,0x134));var _0xc96d=function(_0x5ada9a,_0x428c3a){_0x5ada9a=_0x5ada9a-0x0;var _0x16d722=_0x96dc[_0x5ada9a];return _0x16d722;};'use strict';var Sequelize=require('sequelize');module[_0xc96d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc96d('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc96d('0x2')]}}; \ No newline at end of file +var _0x668b=['name','sequelize','exports','STRING'];(function(_0x2d99e9,_0x5b5af0){var _0x4b9d95=function(_0x3fdfc9){while(--_0x3fdfc9){_0x2d99e9['push'](_0x2d99e9['shift']());}};_0x4b9d95(++_0x5b5af0);}(_0x668b,0x8d));var _0xb668=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0x668b[_0x3f3f06];return _0x140feb;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize[_0xb668('0x2')],'unique':_0xb668('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 575900f..41c5024 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 _0xbff3=['querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0xbff3,0x1dd));var _0x3bff=function(_0x38e6b9,_0x1f73e4){_0x38e6b9=_0x38e6b9-0x0;var _0x3c7899=_0xbff3[_0x38e6b9];return _0x3c7899;};'use strict';var emlformat=require(_0x3bff('0x0'));var rimraf=require(_0x3bff('0x1'));var zipdir=require(_0x3bff('0x2'));var jsonpatch=require(_0x3bff('0x3'));var rp=require(_0x3bff('0x4'));var moment=require('moment');var BPromise=require(_0x3bff('0x5'));var Mustache=require(_0x3bff('0x6'));var util=require(_0x3bff('0x7'));var path=require(_0x3bff('0x8'));var sox=require('sox');var csv=require(_0x3bff('0x9'));var ejs=require(_0x3bff('0xa'));var fs=require('fs');var fs_extra=require(_0x3bff('0xb'));var _=require('lodash');var squel=require(_0x3bff('0xc'));var crypto=require('crypto');var jsforce=require(_0x3bff('0xd'));var deskjs=require(_0x3bff('0xe'));var toCsv=require(_0x3bff('0x9'));var querystring=require(_0x3bff('0xf'));var Papa=require(_0x3bff('0x10'));var Redis=require('ioredis');var authService=require(_0x3bff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bff('0x12'))(_0x3bff('0x13'));var utils=require('../../config/utils');var config=require(_0x3bff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bff('0x15'))['db'];function respondWithStatusCode(_0x245004,_0x24e111){_0x24e111=_0x24e111||0xcc;return function(_0x178e80){if(_0x178e80){return _0x245004[_0x3bff('0x16')](_0x24e111);}return _0x245004[_0x3bff('0x17')](_0x24e111)[_0x3bff('0x18')]();};}function respondWithResult(_0x3f443e,_0x443304){_0x443304=_0x443304||0xc8;return function(_0x55f6d2){if(_0x55f6d2){return _0x3f443e[_0x3bff('0x17')](_0x443304)[_0x3bff('0x19')](_0x55f6d2);}};}function respondWithFilteredResult(_0xc74b45,_0x1ec63c){return function(_0x36256e){if(_0x36256e){var _0x53fdad=typeof _0x1ec63c['offset']===_0x3bff('0x1a')&&typeof _0x1ec63c[_0x3bff('0x1b')]==='undefined';var _0x4c5003=_0x36256e[_0x3bff('0x1c')];var _0x1f5197=_0x53fdad?0x0:_0x1ec63c[_0x3bff('0x1d')];var _0x2c8d2d=_0x53fdad?_0x36256e['count']:_0x1ec63c['offset']+_0x1ec63c['limit'];var _0x31e1a8;if(_0x2c8d2d>=_0x4c5003){_0x2c8d2d=_0x4c5003;_0x31e1a8=0xc8;}else{_0x31e1a8=0xce;}_0xc74b45['status'](_0x31e1a8);return _0xc74b45[_0x3bff('0x1e')](_0x3bff('0x1f'),_0x1f5197+'-'+_0x2c8d2d+'/'+_0x4c5003)['json'](_0x36256e);}return null;};}function patchUpdates(_0x514162){return function(_0x1ff083){try{jsonpatch['apply'](_0x1ff083,_0x514162,!![]);}catch(_0x370a3b){return BPromise[_0x3bff('0x20')](_0x370a3b);}return _0x1ff083[_0x3bff('0x21')]();};}function saveUpdates(_0x5e0721,_0x51310e){return function(_0x3d3f7f){if(_0x3d3f7f){return _0x3d3f7f['update'](_0x5e0721)[_0x3bff('0x22')](function(_0x12b733){return _0x12b733;});}return null;};}function removeEntity(_0x4df903,_0x5701bd){return function(_0x5e8e2c){if(_0x5e8e2c){return _0x5e8e2c[_0x3bff('0x23')]()[_0x3bff('0x22')](function(){var _0x2984dd=_0x5e8e2c[_0x3bff('0x24')]({'plain':!![]});var _0x3d40dc=_0x3bff('0x25');return db[_0x3bff('0x26')][_0x3bff('0x23')]({'where':{'type':_0x3d40dc,'resourceId':_0x2984dd['id']}})[_0x3bff('0x22')](function(){return _0x5e8e2c;});})[_0x3bff('0x22')](function(){_0x4df903['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x304dce,_0xb0b862){return function(_0x462270){if(!_0x462270){_0x304dce[_0x3bff('0x16')](0x194);}return _0x462270;};}function handleError(_0x5c641a,_0x3242b0){_0x3242b0=_0x3242b0||0x1f4;return function(_0x29da80){logger[_0x3bff('0x27')](_0x29da80[_0x3bff('0x28')]);if(_0x29da80['name']){delete _0x29da80[_0x3bff('0x29')];}_0x5c641a[_0x3bff('0x17')](_0x3242b0)['send'](_0x29da80);};}exports[_0x3bff('0x2a')]=function(_0x400970,_0x17fd2e){var _0x4343fc={},_0x465179={},_0x5e9a9b={'count':0x0,'rows':[]};var _0x1aaf3f=_[_0x3bff('0x2b')](db[_0x3bff('0x2c')][_0x3bff('0x2d')],function(_0x18bfd0){return{'name':_0x18bfd0[_0x3bff('0x2e')],'type':_0x18bfd0[_0x3bff('0x2f')][_0x3bff('0x30')]};});_0x465179[_0x3bff('0x31')]=_[_0x3bff('0x2b')](_0x1aaf3f,_0x3bff('0x29'));_0x465179[_0x3bff('0x32')]=_[_0x3bff('0x33')](_0x400970[_0x3bff('0x32')]);_0x465179[_0x3bff('0x34')]=_[_0x3bff('0x35')](_0x465179[_0x3bff('0x31')],_0x465179[_0x3bff('0x32')]);_0x4343fc['attributes']=_['intersection'](_0x465179[_0x3bff('0x31')],qs['fields'](_0x400970[_0x3bff('0x32')][_0x3bff('0x36')]));_0x4343fc[_0x3bff('0x37')]=_0x4343fc[_0x3bff('0x37')][_0x3bff('0x38')]?_0x4343fc['attributes']:_0x465179['model'];if(!_0x400970['query'][_0x3bff('0x39')]('nolimit')){_0x4343fc[_0x3bff('0x1b')]=qs[_0x3bff('0x1b')](_0x400970[_0x3bff('0x32')][_0x3bff('0x1b')]);_0x4343fc[_0x3bff('0x1d')]=qs[_0x3bff('0x1d')](_0x400970[_0x3bff('0x32')][_0x3bff('0x1d')]);}_0x4343fc[_0x3bff('0x3a')]=qs[_0x3bff('0x3b')](_0x400970['query'][_0x3bff('0x3b')]);_0x4343fc[_0x3bff('0x3c')]=qs['filters'](_[_0x3bff('0x3d')](_0x400970[_0x3bff('0x32')],_0x465179['filters']),_0x1aaf3f);if(_0x400970[_0x3bff('0x32')][_0x3bff('0x3e')]){_0x4343fc[_0x3bff('0x3c')]=_[_0x3bff('0x3f')](_0x4343fc['where'],{'$or':_[_0x3bff('0x2b')](_0x1aaf3f,function(_0x11bb4d){if(_0x11bb4d[_0x3bff('0x2f')]!==_0x3bff('0x40')){var _0x203815={};_0x203815[_0x11bb4d['name']]={'$like':'%'+_0x400970['query'][_0x3bff('0x3e')]+'%'};return _0x203815;}})});}_0x4343fc=_[_0x3bff('0x3f')]({},_0x4343fc,_0x400970[_0x3bff('0x41')]);var _0x2f312f={'where':_0x4343fc[_0x3bff('0x3c')]};return db[_0x3bff('0x2c')][_0x3bff('0x1c')](_0x2f312f)[_0x3bff('0x22')](function(_0x3bd915){_0x5e9a9b['count']=_0x3bd915;if(_0x400970[_0x3bff('0x32')][_0x3bff('0x42')]){_0x4343fc['include']=[{'all':!![]}];}return db[_0x3bff('0x2c')][_0x3bff('0x43')](_0x4343fc);})[_0x3bff('0x22')](function(_0x38ce71){_0x5e9a9b[_0x3bff('0x44')]=_0x38ce71;return _0x5e9a9b;})[_0x3bff('0x22')](respondWithFilteredResult(_0x17fd2e,_0x4343fc))[_0x3bff('0x45')](handleError(_0x17fd2e,null));};exports[_0x3bff('0x46')]=function(_0x4bfe4d,_0x3b908a){var _0x3cda9f={'raw':!![],'where':{'id':_0x4bfe4d[_0x3bff('0x47')]['id']}},_0x59af9f={};_0x59af9f[_0x3bff('0x31')]=_['keys'](db['Variable'][_0x3bff('0x2d')]);_0x59af9f[_0x3bff('0x32')]=_[_0x3bff('0x33')](_0x4bfe4d['query']);_0x59af9f[_0x3bff('0x34')]=_[_0x3bff('0x35')](_0x59af9f[_0x3bff('0x31')],_0x59af9f[_0x3bff('0x32')]);_0x3cda9f['attributes']=_[_0x3bff('0x35')](_0x59af9f[_0x3bff('0x31')],qs[_0x3bff('0x36')](_0x4bfe4d['query'][_0x3bff('0x36')]));_0x3cda9f[_0x3bff('0x37')]=_0x3cda9f[_0x3bff('0x37')][_0x3bff('0x38')]?_0x3cda9f[_0x3bff('0x37')]:_0x59af9f[_0x3bff('0x31')];if(_0x4bfe4d[_0x3bff('0x32')][_0x3bff('0x42')]){_0x3cda9f[_0x3bff('0x48')]=[{'all':!![]}];}_0x3cda9f=_[_0x3bff('0x3f')]({},_0x3cda9f,_0x4bfe4d[_0x3bff('0x41')]);return db[_0x3bff('0x2c')][_0x3bff('0x49')](_0x3cda9f)[_0x3bff('0x22')](handleEntityNotFound(_0x3b908a,null))[_0x3bff('0x22')](respondWithResult(_0x3b908a,null))[_0x3bff('0x45')](handleError(_0x3b908a,null));};exports['create']=function(_0x6996be,_0x32b531){return db['Variable']['create'](_0x6996be[_0x3bff('0x4a')],{})[_0x3bff('0x22')](function(_0x3756e8){var _0x58be99=_0x6996be[_0x3bff('0x4b')]['get']({'plain':!![]});if(!_0x58be99)throw new Error(_0x3bff('0x4c'));if(_0x58be99[_0x3bff('0x4d')]===_0x3bff('0x4b')){var _0x244ec9=_0x3756e8['get']({'plain':!![]});var _0xb16c0d=_0x3bff('0x25');return db['UserProfileSection'][_0x3bff('0x49')]({'where':{'name':_0xb16c0d,'userProfileId':_0x58be99[_0x3bff('0x4e')]},'raw':!![]})[_0x3bff('0x22')](function(_0x471ac7){if(_0x471ac7&&_0x471ac7['autoAssociation']===0x0){return db[_0x3bff('0x26')][_0x3bff('0x4f')]({'name':_0x244ec9[_0x3bff('0x29')],'resourceId':_0x244ec9['id'],'type':_0x471ac7['name'],'sectionId':_0x471ac7['id']},{})[_0x3bff('0x22')](function(){return _0x3756e8;});}else{return _0x3756e8;}})[_0x3bff('0x45')](function(_0x46d91c){logger[_0x3bff('0x27')](_0x3bff('0x50'),_0x46d91c);throw _0x46d91c;});}return _0x3756e8;})['then'](respondWithResult(_0x32b531,0xc9))['catch'](handleError(_0x32b531,null));};exports[_0x3bff('0x51')]=function(_0x41ca5b,_0x5f2c28){if(_0x41ca5b[_0x3bff('0x4a')]['id']){delete _0x41ca5b[_0x3bff('0x4a')]['id'];}return db[_0x3bff('0x2c')][_0x3bff('0x49')]({'where':{'id':_0x41ca5b['params']['id']}})[_0x3bff('0x22')](handleEntityNotFound(_0x5f2c28,null))['then'](saveUpdates(_0x41ca5b[_0x3bff('0x4a')],null))[_0x3bff('0x22')](respondWithResult(_0x5f2c28,null))[_0x3bff('0x45')](handleError(_0x5f2c28,null));};exports[_0x3bff('0x23')]=function(_0xa08e24,_0x3bc0f0){return db[_0x3bff('0x2c')]['find']({'where':{'id':_0xa08e24[_0x3bff('0x47')]['id']}})[_0x3bff('0x22')](handleEntityNotFound(_0x3bc0f0,null))[_0x3bff('0x22')](removeEntity(_0x3bc0f0,null))[_0x3bff('0x45')](handleError(_0x3bc0f0,null));}; \ No newline at end of file +var _0xab39=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','Variable','findAll','catch','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xab39,0xf1));var _0x9ab3=function(_0x5bd233,_0x101d88){_0x5bd233=_0x5bd233-0x0;var _0x2febde=_0xab39[_0x5bd233];return _0x2febde;};'use strict';var emlformat=require(_0x9ab3('0x0'));var rimraf=require(_0x9ab3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9ab3('0x2'));var BPromise=require(_0x9ab3('0x3'));var Mustache=require(_0x9ab3('0x4'));var util=require('util');var path=require(_0x9ab3('0x5'));var sox=require(_0x9ab3('0x6'));var csv=require(_0x9ab3('0x7'));var ejs=require(_0x9ab3('0x8'));var fs=require('fs');var fs_extra=require(_0x9ab3('0x9'));var _=require(_0x9ab3('0xa'));var squel=require(_0x9ab3('0xb'));var crypto=require('crypto');var jsforce=require(_0x9ab3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ab3('0xd'));var Papa=require('papaparse');var Redis=require(_0x9ab3('0xe'));var authService=require(_0x9ab3('0xf'));var qs=require(_0x9ab3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ab3('0x11'));var logger=require('../../config/logger')(_0x9ab3('0x12'));var utils=require(_0x9ab3('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ab3('0x14'))['db'];function respondWithStatusCode(_0x90d4d5,_0xa4eeae){_0xa4eeae=_0xa4eeae||0xcc;return function(_0x470274){if(_0x470274){return _0x90d4d5[_0x9ab3('0x15')](_0xa4eeae);}return _0x90d4d5[_0x9ab3('0x16')](_0xa4eeae)[_0x9ab3('0x17')]();};}function respondWithResult(_0x879e2a,_0x393d46){_0x393d46=_0x393d46||0xc8;return function(_0x212f01){if(_0x212f01){return _0x879e2a['status'](_0x393d46)[_0x9ab3('0x18')](_0x212f01);}};}function respondWithFilteredResult(_0x1276be,_0xc60689){return function(_0x37e6e1){if(_0x37e6e1){var _0x29b629=typeof _0xc60689['offset']===_0x9ab3('0x19')&&typeof _0xc60689[_0x9ab3('0x1a')]===_0x9ab3('0x19');var _0x51fc75=_0x37e6e1[_0x9ab3('0x1b')];var _0x1363f0=_0x29b629?0x0:_0xc60689[_0x9ab3('0x1c')];var _0x5db12e=_0x29b629?_0x37e6e1['count']:_0xc60689[_0x9ab3('0x1c')]+_0xc60689[_0x9ab3('0x1a')];var _0x520d86;if(_0x5db12e>=_0x51fc75){_0x5db12e=_0x51fc75;_0x520d86=0xc8;}else{_0x520d86=0xce;}_0x1276be[_0x9ab3('0x16')](_0x520d86);return _0x1276be['set'](_0x9ab3('0x1d'),_0x1363f0+'-'+_0x5db12e+'/'+_0x51fc75)[_0x9ab3('0x18')](_0x37e6e1);}return null;};}function patchUpdates(_0x5443fd){return function(_0x567c92){try{jsonpatch[_0x9ab3('0x1e')](_0x567c92,_0x5443fd,!![]);}catch(_0x20fcf2){return BPromise[_0x9ab3('0x1f')](_0x20fcf2);}return _0x567c92['save']();};}function saveUpdates(_0x5125a1,_0x445097){return function(_0x467d24){if(_0x467d24){return _0x467d24[_0x9ab3('0x20')](_0x5125a1)[_0x9ab3('0x21')](function(_0x56161e){return _0x56161e;});}return null;};}function removeEntity(_0x455e70,_0x51e730){return function(_0x4ac5b3){if(_0x4ac5b3){return _0x4ac5b3[_0x9ab3('0x22')]()[_0x9ab3('0x21')](function(){var _0x5d1a3c=_0x4ac5b3[_0x9ab3('0x23')]({'plain':!![]});var _0x3243f4=_0x9ab3('0x24');return db[_0x9ab3('0x25')][_0x9ab3('0x22')]({'where':{'type':_0x3243f4,'resourceId':_0x5d1a3c['id']}})['then'](function(){return _0x4ac5b3;});})[_0x9ab3('0x21')](function(){_0x455e70[_0x9ab3('0x16')](0xcc)[_0x9ab3('0x17')]();});}};}function handleEntityNotFound(_0x2dbd71,_0x4b485a){return function(_0x4ce5a4){if(!_0x4ce5a4){_0x2dbd71[_0x9ab3('0x15')](0x194);}return _0x4ce5a4;};}function handleError(_0x21b707,_0x49b9e3){_0x49b9e3=_0x49b9e3||0x1f4;return function(_0x213e72){logger['error'](_0x213e72[_0x9ab3('0x26')]);if(_0x213e72[_0x9ab3('0x27')]){delete _0x213e72[_0x9ab3('0x27')];}_0x21b707[_0x9ab3('0x16')](_0x49b9e3)[_0x9ab3('0x28')](_0x213e72);};}exports[_0x9ab3('0x29')]=function(_0x5c1734,_0x5322f2){var _0x112c6c={},_0x524981={},_0x5b26f1={'count':0x0,'rows':[]};var _0xb5662c=_['map'](db['Variable']['rawAttributes'],function(_0x36086f){return{'name':_0x36086f[_0x9ab3('0x2a')],'type':_0x36086f[_0x9ab3('0x2b')][_0x9ab3('0x2c')]};});_0x524981[_0x9ab3('0x2d')]=_[_0x9ab3('0x2e')](_0xb5662c,'name');_0x524981[_0x9ab3('0x2f')]=_['keys'](_0x5c1734[_0x9ab3('0x2f')]);_0x524981[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x524981[_0x9ab3('0x2d')],_0x524981[_0x9ab3('0x2f')]);_0x112c6c['attributes']=_[_0x9ab3('0x31')](_0x524981['model'],qs[_0x9ab3('0x32')](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x32')]));_0x112c6c[_0x9ab3('0x33')]=_0x112c6c[_0x9ab3('0x33')][_0x9ab3('0x34')]?_0x112c6c[_0x9ab3('0x33')]:_0x524981[_0x9ab3('0x2d')];if(!_0x5c1734[_0x9ab3('0x2f')]['hasOwnProperty'](_0x9ab3('0x35'))){_0x112c6c[_0x9ab3('0x1a')]=qs[_0x9ab3('0x1a')](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x1a')]);_0x112c6c[_0x9ab3('0x1c')]=qs[_0x9ab3('0x1c')](_0x5c1734['query'][_0x9ab3('0x1c')]);}_0x112c6c[_0x9ab3('0x36')]=qs['sort'](_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x37')]);_0x112c6c['where']=qs[_0x9ab3('0x30')](_[_0x9ab3('0x38')](_0x5c1734[_0x9ab3('0x2f')],_0x524981[_0x9ab3('0x30')]),_0xb5662c);if(_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x39')]){_0x112c6c[_0x9ab3('0x3a')]=_['merge'](_0x112c6c['where'],{'$or':_[_0x9ab3('0x2e')](_0xb5662c,function(_0x5969d1){if(_0x5969d1[_0x9ab3('0x2b')]!==_0x9ab3('0x3b')){var _0x7f6ab7={};_0x7f6ab7[_0x5969d1[_0x9ab3('0x27')]]={'$like':'%'+_0x5c1734[_0x9ab3('0x2f')][_0x9ab3('0x39')]+'%'};return _0x7f6ab7;}})});}_0x112c6c=_[_0x9ab3('0x3c')]({},_0x112c6c,_0x5c1734[_0x9ab3('0x3d')]);var _0x216db8={'where':_0x112c6c[_0x9ab3('0x3a')]};return db['Variable'][_0x9ab3('0x1b')](_0x216db8)[_0x9ab3('0x21')](function(_0x1334f2){_0x5b26f1['count']=_0x1334f2;if(_0x5c1734['query'][_0x9ab3('0x3e')]){_0x112c6c[_0x9ab3('0x3f')]=[{'all':!![]}];}return db[_0x9ab3('0x40')][_0x9ab3('0x41')](_0x112c6c);})[_0x9ab3('0x21')](function(_0x3ececb){_0x5b26f1['rows']=_0x3ececb;return _0x5b26f1;})[_0x9ab3('0x21')](respondWithFilteredResult(_0x5322f2,_0x112c6c))[_0x9ab3('0x42')](handleError(_0x5322f2,null));};exports['show']=function(_0x17692b,_0x50a03e){var _0xf21bb2={'raw':!![],'where':{'id':_0x17692b[_0x9ab3('0x43')]['id']}},_0x4f557d={};_0x4f557d['model']=_[_0x9ab3('0x44')](db['Variable'][_0x9ab3('0x45')]);_0x4f557d['query']=_['keys'](_0x17692b['query']);_0x4f557d[_0x9ab3('0x30')]=_[_0x9ab3('0x31')](_0x4f557d[_0x9ab3('0x2d')],_0x4f557d['query']);_0xf21bb2[_0x9ab3('0x33')]=_['intersection'](_0x4f557d['model'],qs[_0x9ab3('0x32')](_0x17692b[_0x9ab3('0x2f')][_0x9ab3('0x32')]));_0xf21bb2['attributes']=_0xf21bb2['attributes']['length']?_0xf21bb2[_0x9ab3('0x33')]:_0x4f557d[_0x9ab3('0x2d')];if(_0x17692b[_0x9ab3('0x2f')][_0x9ab3('0x3e')]){_0xf21bb2[_0x9ab3('0x3f')]=[{'all':!![]}];}_0xf21bb2=_[_0x9ab3('0x3c')]({},_0xf21bb2,_0x17692b[_0x9ab3('0x3d')]);return db[_0x9ab3('0x40')]['find'](_0xf21bb2)[_0x9ab3('0x21')](handleEntityNotFound(_0x50a03e,null))[_0x9ab3('0x21')](respondWithResult(_0x50a03e,null))[_0x9ab3('0x42')](handleError(_0x50a03e,null));};exports[_0x9ab3('0x46')]=function(_0x38b3df,_0x12997e){return db[_0x9ab3('0x40')][_0x9ab3('0x46')](_0x38b3df['body'],{})[_0x9ab3('0x21')](function(_0x242f62){var _0x4b2b87=_0x38b3df[_0x9ab3('0x47')][_0x9ab3('0x23')]({'plain':!![]});if(!_0x4b2b87)throw new Error(_0x9ab3('0x48'));if(_0x4b2b87[_0x9ab3('0x49')]===_0x9ab3('0x47')){var _0x32b8c4=_0x242f62['get']({'plain':!![]});var _0x59b5a3='Variables';return db['UserProfileSection'][_0x9ab3('0x4a')]({'where':{'name':_0x59b5a3,'userProfileId':_0x4b2b87[_0x9ab3('0x4b')]},'raw':!![]})[_0x9ab3('0x21')](function(_0x24e4e7){if(_0x24e4e7&&_0x24e4e7[_0x9ab3('0x4c')]===0x0){return db[_0x9ab3('0x25')]['create']({'name':_0x32b8c4['name'],'resourceId':_0x32b8c4['id'],'type':_0x24e4e7[_0x9ab3('0x27')],'sectionId':_0x24e4e7['id']},{})[_0x9ab3('0x21')](function(){return _0x242f62;});}else{return _0x242f62;}})[_0x9ab3('0x42')](function(_0x445ec9){logger['error'](_0x9ab3('0x4d'),_0x445ec9);throw _0x445ec9;});}return _0x242f62;})[_0x9ab3('0x21')](respondWithResult(_0x12997e,0xc9))[_0x9ab3('0x42')](handleError(_0x12997e,null));};exports[_0x9ab3('0x20')]=function(_0x4c6492,_0x5f3d9f){if(_0x4c6492['body']['id']){delete _0x4c6492[_0x9ab3('0x4e')]['id'];}return db['Variable'][_0x9ab3('0x4a')]({'where':{'id':_0x4c6492['params']['id']}})[_0x9ab3('0x21')](handleEntityNotFound(_0x5f3d9f,null))[_0x9ab3('0x21')](saveUpdates(_0x4c6492[_0x9ab3('0x4e')],null))['then'](respondWithResult(_0x5f3d9f,null))[_0x9ab3('0x42')](handleError(_0x5f3d9f,null));};exports[_0x9ab3('0x22')]=function(_0x525a9d,_0x561086){return db[_0x9ab3('0x40')][_0x9ab3('0x4a')]({'where':{'id':_0x525a9d['params']['id']}})['then'](handleEntityNotFound(_0x561086,null))[_0x9ab3('0x21')](removeEntity(_0x561086,null))[_0x9ab3('0x42')](handleError(_0x561086,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 4616d66..94651ac 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 _0x29de=['rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','util','bluebird','request-promise','path'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x29de,0xf6));var _0xe29d=function(_0x425ca2,_0x42bb21){_0x425ca2=_0x425ca2-0x0;var _0x460860=_0x29de[_0x425ca2];return _0x460860;};'use strict';var _=require('lodash');var util=require(_0xe29d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe29d('0x1'));var rp=require(_0xe29d('0x2'));var fs=require('fs');var path=require(_0xe29d('0x3'));var rimraf=require(_0xe29d('0x4'));var config=require(_0xe29d('0x5'));var attributes=require(_0xe29d('0x6'));module[_0xe29d('0x7')]=function(_0x280c4e,_0xdbd3){return _0x280c4e[_0xe29d('0x8')]('Variable',attributes,{'tableName':_0xe29d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9779=['moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api'];(function(_0x5b00f9,_0x2b32e4){var _0x8041a4=function(_0x18419c){while(--_0x18419c){_0x5b00f9['push'](_0x5b00f9['shift']());}};_0x8041a4(++_0x2b32e4);}(_0x9779,0x1e6));var _0x9977=function(_0x3fa723,_0x59966a){_0x3fa723=_0x3fa723-0x0;var _0x395014=_0x9779[_0x3fa723];return _0x395014;};'use strict';var _=require(_0x9977('0x0'));var util=require(_0x9977('0x1'));var logger=require(_0x9977('0x2'))(_0x9977('0x3'));var moment=require(_0x9977('0x4'));var BPromise=require(_0x9977('0x5'));var rp=require(_0x9977('0x6'));var fs=require('fs');var path=require(_0x9977('0x7'));var rimraf=require('rimraf');var config=require(_0x9977('0x8'));var attributes=require(_0x9977('0x9'));module[_0x9977('0xa')]=function(_0x4a7fe4,_0x1edfa3){return _0x4a7fe4[_0x9977('0xb')](_0x9977('0xc'),attributes,{'tableName':_0x9977('0xd'),'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 37e06ff..f896a74 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x4b8121,_0x15384c){var _0x57ba4c=function(_0x328d69){while(--_0x328d69){_0x4b8121['push'](_0x4b8121['shift']());}};_0x57ba4c(++_0x15384c);}(_0x7217,0x19e));var _0x7721=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7217[_0x47e7cb];return _0x2a8874;};'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')]('Variable,\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']('Variable,\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);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x2ea14b,_0x3a2d8d){var _0x3236f2=function(_0x5da382){while(--_0x5da382){_0x2ea14b['push'](_0x2ea14b['shift']());}};_0x3236f2(++_0x3a2d8d);}(_0x814b,0x1a2));var _0xb814=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x814b[_0x3bd52b];return _0x1e5b89;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b2a9dcd..14ef6e7 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 _0x9cb1=['exports','express','Router','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','pull','/restart','restart','/migrations','migrations'];(function(_0x49f875,_0xcaaade){var _0x181fb7=function(_0x1e166c){while(--_0x1e166c){_0x49f875['push'](_0x49f875['shift']());}};_0x181fb7(++_0xcaaade);}(_0x9cb1,0x81));var _0x19cb=function(_0x1a9f37,_0x3d5d56){_0x1a9f37=_0x1a9f37-0x0;var _0x4f1595=_0x9cb1[_0x1a9f37];return _0x4f1595;};'use strict';var express=require(_0x19cb('0x0'));var router=express[_0x19cb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x19cb('0x2')]('/',controller[_0x19cb('0x3')]);router['get'](_0x19cb('0x4'),auth[_0x19cb('0x5')](),auth['canUpdate'](),controller[_0x19cb('0x6')]);router[_0x19cb('0x2')](_0x19cb('0x7'),auth[_0x19cb('0x5')](),auth[_0x19cb('0x8')](),controller[_0x19cb('0x9')]);router[_0x19cb('0x2')]('/pull',auth[_0x19cb('0x5')](),auth[_0x19cb('0x8')](),controller[_0x19cb('0xa')]);router[_0x19cb('0x2')](_0x19cb('0xb'),auth[_0x19cb('0x5')](),controller[_0x19cb('0xc')]);router[_0x19cb('0x2')](_0x19cb('0xd'),controller[_0x19cb('0xe')]);module[_0x19cb('0xf')]=router; \ No newline at end of file +var _0xe604=['canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated'];(function(_0x18d081,_0x47e92e){var _0x1dbeb4=function(_0x15c2c5){while(--_0x15c2c5){_0x18d081['push'](_0x18d081['shift']());}};_0x1dbeb4(++_0x47e92e);}(_0xe604,0x106));var _0x4e60=function(_0x45ae48,_0x585e9c){_0x45ae48=_0x45ae48-0x0;var _0x39b5b0=_0xe604[_0x45ae48];return _0x39b5b0;};'use strict';var express=require(_0x4e60('0x0'));var router=express[_0x4e60('0x1')]();var auth=require(_0x4e60('0x2'));var controller=require(_0x4e60('0x3'));router[_0x4e60('0x4')]('/',controller[_0x4e60('0x5')]);router[_0x4e60('0x4')](_0x4e60('0x6'),auth[_0x4e60('0x7')](),auth[_0x4e60('0x8')](),controller[_0x4e60('0x9')]);router[_0x4e60('0x4')](_0x4e60('0xa'),auth[_0x4e60('0x7')](),auth[_0x4e60('0x8')](),controller[_0x4e60('0xb')]);router['get'](_0x4e60('0xc'),auth['isAuthenticated'](),auth[_0x4e60('0x8')](),controller[_0x4e60('0xd')]);router[_0x4e60('0x4')](_0x4e60('0xe'),auth[_0x4e60('0x7')](),controller[_0x4e60('0xf')]);router[_0x4e60('0x4')](_0x4e60('0x10'),controller['migrations']);module[_0x4e60('0x11')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d70beb4..52f9039 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 _0x25bf=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','sort','Migration','sequelize','getQueryInterface','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart'];(function(_0x233c13,_0x5592db){var _0x5ecc71=function(_0x334dae){while(--_0x334dae){_0x233c13['push'](_0x233c13['shift']());}};_0x5ecc71(++_0x5592db);}(_0x25bf,0x1bb));var _0xf25b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x25bf[_0x4565bf];return _0x5610ba;};'use strict';var Umzug=require('umzug');var path=require(_0xf25b('0x0'));var fs=require('fs');var _=require(_0xf25b('0x1'));var pkginfo=require(_0xf25b('0x2'))(module,_0xf25b('0x3'));var compareVersions=require(_0xf25b('0x4'));var exec=require(_0xf25b('0x5'))[_0xf25b('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xf25b('0x7'));var logger=require(_0xf25b('0x8'))(_0xf25b('0x9'));var git=require(_0xf25b('0xa'))(config[_0xf25b('0xb')]);exports[_0xf25b('0xc')]=function(_0x570b2c,_0x23faea){var _0x7e478e={'current':module[_0xf25b('0xd')][_0xf25b('0x3')],'phonebar':0x2};if(_0x570b2c[_0xf25b('0xe')]&&_0x570b2c[_0xf25b('0xe')][_0xf25b('0xf')]){return git[_0xf25b('0x10')]()[_0xf25b('0x11')](function(_0x1af93e,_0x1363ba){_0x7e478e[_0xf25b('0xf')]=(_0x1af93e?module[_0xf25b('0xd')][_0xf25b('0x3')]:_0x1363ba[_0xf25b('0xf')])||_0xf25b('0x12');return _0x23faea[_0xf25b('0x13')](0xc8)[_0xf25b('0x14')](_0x7e478e);});}else{return _0x23faea[_0xf25b('0x13')](0xc8)[_0xf25b('0x14')](_0x7e478e);}};exports[_0xf25b('0x10')]=function(_0x508ab2,_0x55df1d){return git['fetch']([_0xf25b('0x15'),_0xf25b('0x16')],function(_0x7052fb){if(_0x7052fb){logger['error'](_0x7052fb);return _0x55df1d[_0xf25b('0x13')](0x1f4)[_0xf25b('0x14')](_0x7052fb);}logger[_0xf25b('0x17')](_0xf25b('0x18'));return _0x55df1d[_0xf25b('0x13')](0xc8)[_0xf25b('0x14')]({'output':_0xf25b('0x19')});});};exports[_0xf25b('0x1a')]=function(_0x579efe,_0x393c92){return git['reset']([_0xf25b('0x1b'),'FETCH_HEAD'],function(_0x367234){if(_0x367234){logger[_0xf25b('0x1c')](_0x367234);return _0x393c92[_0xf25b('0x13')](0x1f4)['json'](_0x367234);}logger[_0xf25b('0x17')](_0xf25b('0x1d'));return _0x393c92[_0xf25b('0x13')](0xc8)[_0xf25b('0x14')]({'output':_0xf25b('0x1e')});});};exports[_0xf25b('0x1f')]=function(_0x10819d,_0x1747cd){exec(_0xf25b('0x20'),function(_0x2bf701,_0x52efda,_0xb7d482){logger['info'](_0x52efda);logger[_0xf25b('0x17')](_0xb7d482);if(_0x2bf701){logger[_0xf25b('0x1c')](_0x2bf701);return _0x1747cd[_0xf25b('0x13')](0x1f4)[_0xf25b('0x14')](_0x2bf701);}return _0x1747cd[_0xf25b('0x13')](0xc8)['json']({'output':_0x52efda});});};exports['restart']=function(_0x3d5a16,_0x2e5b13){return pm2[_0xf25b('0x21')]('motion2')['then'](function(_0x5ae0d1){logger[_0xf25b('0x17')](_0xf25b('0x22'),_0x5ae0d1);return _0x2e5b13['status'](0xc8)['json']({'output':_0xf25b('0x23')});})[_0xf25b('0x24')](function(_0xdc012){logger[_0xf25b('0x1c')](_0xdc012);return _0x2e5b13['status'](0x1f4)[_0xf25b('0x14')](_0xdc012);});};exports[_0xf25b('0x25')]=function(_0x1f557e,_0x3db58b){var _0x30e1bc=fs[_0xf25b('0x26')](path[_0xf25b('0x27')](config['root'],_0xf25b('0x28'),_0xf25b('0x25')));var _0x39aa86=[];for(var _0x2db689=0x0;_0x2db689<_0x30e1bc[_0xf25b('0x29')];_0x2db689++){var _0x131f37=_0x30e1bc[_0x2db689][_0xf25b('0x2a')]('.js','');if(compareVersions(module[_0xf25b('0xd')][_0xf25b('0x3')],_0x131f37)===-0x1){_0x39aa86['push'](_0x131f37);}}if(_0x39aa86[_0xf25b('0x29')]){var _0x45a353=_0x39aa86[_0xf25b('0x2b')](compareVersions);var _0x42a49f=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf25b('0x2c')],'modelName':_0xf25b('0x2c'),'columnName':_0xf25b('0x3')},'migrations':{'params':[db[_0xf25b('0x2d')][_0xf25b('0x2e')](),db[_0xf25b('0x2d')]['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[_0xf25b('0x27')](config[_0xf25b('0xb')],'server',_0xf25b('0x25')),'pattern':/\.js$/}});_0x42a49f['up']({'migrations':_['map'](_0x45a353,function(_0x3e6d59){return _0x3e6d59+'.js';})})[_0xf25b('0x2f')](function(){return _0x3db58b['status'](0xc8)[_0xf25b('0x14')]({'output':_0xf25b('0x30')+module['exports'][_0xf25b('0x3')]+_0xf25b('0x31')+_[_0xf25b('0x32')](_0x45a353),'migrations':_[_0xf25b('0x27')](_0x45a353)});})[_0xf25b('0x24')](function(_0x33b050){if(_0x33b050 instanceof db[_0xf25b('0x2d')][_0xf25b('0x33')]){return _0x3db58b[_0xf25b('0x13')](0xc8)['json']({'output':_0xf25b('0x34')});}else{return _0x3db58b['status'](0x1f4)[_0xf25b('0x14')](_0x33b050);}});}else{return _0x3db58b[_0xf25b('0x13')](0xc8)[_0xf25b('0x14')]({'output':_0xf25b('0x34')});}}; \ No newline at end of file +var _0x3608=['pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','child_process','exec','../../config/logger','simple-git','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3608,0x14e));var _0x8360=function(_0x59314b,_0x2f0795){_0x59314b=_0x59314b-0x0;var _0x3a6413=_0x3608[_0x59314b];return _0x3a6413;};'use strict';var Umzug=require(_0x8360('0x0'));var path=require(_0x8360('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x8360('0x2'))(module,_0x8360('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x8360('0x4'))[_0x8360('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x8360('0x6'))('update');var git=require(_0x8360('0x7'))(config['root']);exports[_0x8360('0x8')]=function(_0x459357,_0x3cac50){var _0x525de7={'current':module[_0x8360('0x9')][_0x8360('0x3')],'phonebar':0x2};if(_0x459357[_0x8360('0xa')]&&_0x459357[_0x8360('0xa')][_0x8360('0xb')]){return git[_0x8360('0xc')]()['tags'](function(_0x32c33d,_0x553fbf){_0x525de7[_0x8360('0xb')]=(_0x32c33d?module[_0x8360('0x9')]['version']:_0x553fbf[_0x8360('0xb')])||_0x8360('0xd');return _0x3cac50[_0x8360('0xe')](0xc8)[_0x8360('0xf')](_0x525de7);});}else{return _0x3cac50[_0x8360('0xe')](0xc8)[_0x8360('0xf')](_0x525de7);}};exports[_0x8360('0xc')]=function(_0x51ec69,_0x48d809){return git[_0x8360('0xc')]([_0x8360('0x10'),_0x8360('0x11')],function(_0x2626c4){if(_0x2626c4){logger[_0x8360('0x12')](_0x2626c4);return _0x48d809['status'](0x1f4)[_0x8360('0xf')](_0x2626c4);}logger[_0x8360('0x13')]('git\x20fetch');return _0x48d809['status'](0xc8)[_0x8360('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x8360('0x14')]=function(_0x4a2376,_0x37c6b7){return git[_0x8360('0x14')]([_0x8360('0x15'),_0x8360('0x16')],function(_0x55b64b){if(_0x55b64b){logger['error'](_0x55b64b);return _0x37c6b7[_0x8360('0xe')](0x1f4)['json'](_0x55b64b);}logger['info'](_0x8360('0x17'));return _0x37c6b7[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x18')});});};exports[_0x8360('0x19')]=function(_0x1299c2,_0x2f975a){exec(_0x8360('0x1a'),function(_0x28057f,_0x177019,_0x1aeabc){logger[_0x8360('0x13')](_0x177019);logger[_0x8360('0x13')](_0x1aeabc);if(_0x28057f){logger['error'](_0x28057f);return _0x2f975a[_0x8360('0xe')](0x1f4)[_0x8360('0xf')](_0x28057f);}return _0x2f975a[_0x8360('0xe')](0xc8)['json']({'output':_0x177019});});};exports['restart']=function(_0x26087c,_0x987ef4){return pm2[_0x8360('0x1b')](_0x8360('0x1c'))[_0x8360('0x1d')](function(_0x2f604c){logger[_0x8360('0x13')](_0x8360('0x1e'),_0x2f604c);return _0x987ef4[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x1f')});})[_0x8360('0x20')](function(_0x36822f){logger[_0x8360('0x12')](_0x36822f);return _0x987ef4[_0x8360('0xe')](0x1f4)[_0x8360('0xf')](_0x36822f);});};exports[_0x8360('0x21')]=function(_0x37f0d1,_0x2461d8){var _0x49a956=fs[_0x8360('0x22')](path[_0x8360('0x23')](config[_0x8360('0x24')],_0x8360('0x25'),'migrations'));var _0x3faa34=[];for(var _0x15bd5d=0x0;_0x15bd5d<_0x49a956[_0x8360('0x26')];_0x15bd5d++){var _0x3ee2db=_0x49a956[_0x15bd5d][_0x8360('0x27')]('.js','');if(compareVersions(module[_0x8360('0x9')][_0x8360('0x3')],_0x3ee2db)===-0x1){_0x3faa34[_0x8360('0x28')](_0x3ee2db);}}if(_0x3faa34[_0x8360('0x26')]){var _0x2d05f3=_0x3faa34[_0x8360('0x29')](compareVersions);var _0x4f46ab=new Umzug({'storage':_0x8360('0x2a'),'storageOptions':{'model':db[_0x8360('0x2b')],'modelName':_0x8360('0x2b'),'columnName':_0x8360('0x3')},'migrations':{'params':[db[_0x8360('0x2a')][_0x8360('0x2c')](),db['sequelize'][_0x8360('0x2d')],function(){throw new Error(_0x8360('0x2e'));}],'path':path['join'](config[_0x8360('0x24')],_0x8360('0x25'),_0x8360('0x21')),'pattern':/\.js$/}});_0x4f46ab['up']({'migrations':_[_0x8360('0x2f')](_0x2d05f3,function(_0xce3ff6){return _0xce3ff6+_0x8360('0x30');})})['then'](function(){return _0x2461d8[_0x8360('0xe')](0xc8)['json']({'output':_0x8360('0x31')+module[_0x8360('0x9')][_0x8360('0x3')]+_0x8360('0x32')+_['last'](_0x2d05f3),'migrations':_[_0x8360('0x23')](_0x2d05f3)});})['catch'](function(_0x371b8d){if(_0x371b8d instanceof db[_0x8360('0x2a')]['UniqueConstraintError']){return _0x2461d8[_0x8360('0xe')](0xc8)['json']({'output':_0x8360('0x33')});}else{return _0x2461d8['status'](0x1f4)[_0x8360('0xf')](_0x371b8d);}});}else{return _0x2461d8[_0x8360('0xe')](0xc8)[_0x8360('0xf')]({'output':_0x8360('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index dce6b6f..1ad3d68 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 _0x6f65=['/describe','isAuthenticated','/:id','post','create','update','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','index','get'];(function(_0x4581bb,_0x4c2d63){var _0x3eaa10=function(_0x47fc2b){while(--_0x47fc2b){_0x4581bb['push'](_0x4581bb['shift']());}};_0x3eaa10(++_0x4c2d63);}(_0x6f65,0x7f));var _0x56f6=function(_0x1d7380,_0x201040){_0x1d7380=_0x1d7380-0x0;var _0x4cb9a2=_0x6f65[_0x1d7380];return _0x4cb9a2;};'use strict';var multer=require(_0x56f6('0x0'));var util=require(_0x56f6('0x1'));var path=require(_0x56f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56f6('0x3'));var interaction=require(_0x56f6('0x4'));var config=require(_0x56f6('0x5'));var controller=require(_0x56f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x56f6('0x7')]);router[_0x56f6('0x8')](_0x56f6('0x9'),auth[_0x56f6('0xa')](),controller['describe']);router['get'](_0x56f6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x56f6('0xc')]('/',auth[_0x56f6('0xa')](),controller[_0x56f6('0xd')]);router['put'](_0x56f6('0xb'),auth['isAuthenticated'](),controller[_0x56f6('0xe')]);router[_0x56f6('0xf')](_0x56f6('0xb'),auth[_0x56f6('0xa')](),controller['destroy']);module[_0x56f6('0x10')]=router; \ No newline at end of file +var _0x8a91=['../../components/auth/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x47529f,_0x6c7061){var _0x4505a9=function(_0x463eea){while(--_0x463eea){_0x47529f['push'](_0x47529f['shift']());}};_0x4505a9(++_0x6c7061);}(_0x8a91,0xb7));var _0x18a9=function(_0x251f37,_0x10e309){_0x251f37=_0x251f37-0x0;var _0x33e26f=_0x8a91[_0x251f37];return _0x33e26f;};'use strict';var multer=require(_0x18a9('0x0'));var util=require(_0x18a9('0x1'));var path=require(_0x18a9('0x2'));var timeout=require(_0x18a9('0x3'));var express=require(_0x18a9('0x4'));var router=express['Router']();var fs_extra=require(_0x18a9('0x5'));var auth=require(_0x18a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x18a9('0x7'));router[_0x18a9('0x8')]('/',auth[_0x18a9('0x9')](),controller[_0x18a9('0xa')]);router['get'](_0x18a9('0xb'),auth['isAuthenticated'](),controller[_0x18a9('0xc')]);router['get']('/:id',auth[_0x18a9('0x9')](),controller[_0x18a9('0xd')]);router[_0x18a9('0xe')]('/',auth[_0x18a9('0x9')](),controller[_0x18a9('0xf')]);router[_0x18a9('0x10')](_0x18a9('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x18a9('0x12')]('/:id',auth[_0x18a9('0x9')](),controller[_0x18a9('0x13')]);module[_0x18a9('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 17a303d..123f95c 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 _0x9ffd=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x2090f7,_0x546b63){var _0x2d4767=function(_0x3b4bed){while(--_0x3b4bed){_0x2090f7['push'](_0x2090f7['shift']());}};_0x2d4767(++_0x546b63);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x543ee4,_0x346e60){_0x543ee4=_0x543ee4-0x0;var _0x440cf4=_0x9ffd[_0x543ee4];return _0x440cf4;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'type':{'type':Sequelize[_0xd9ff('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd9ff('0x2')]},'calleridname':{'type':Sequelize[_0xd9ff('0x2')]},'queue':{'type':Sequelize[_0xd9ff('0x2')]},'interface':{'type':Sequelize[_0xd9ff('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd9ff('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd9ff('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd9ff('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd9ff('0x3')]},'holdtime':{'type':Sequelize[_0xd9ff('0x4')]},'agentcomplete':{'type':Sequelize[_0xd9ff('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9ff('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9ff('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9ff('0x4')]},'agentacw':{'type':Sequelize[_0xd9ff('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9ff('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd9ff('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd9ff('0x2')]},'connectedlinename':{'type':Sequelize[_0xd9ff('0x2')]},'language':{'type':Sequelize[_0xd9ff('0x2')]},'accountcode':{'type':Sequelize[_0xd9ff('0x2')]},'context':{'type':Sequelize[_0xd9ff('0x2')]},'exten':{'type':Sequelize[_0xd9ff('0x2')]},'priority':{'type':Sequelize[_0xd9ff('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd9ff('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd9ff('0x2')]},'destcalleridname':{'type':Sequelize[_0xd9ff('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd9ff('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd9ff('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd9ff('0x2')]},'destcontext':{'type':Sequelize[_0xd9ff('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd9ff('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd9ff('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9ff('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd9ff('0x2')]},'agententerreason':{'type':Sequelize[_0xd9ff('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc91=['INTEGER','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xdc91,0x8b));var _0x1dc9=function(_0x1c2970,_0x5b0b36){_0x1c2970=_0x1c2970-0x0;var _0x40936a=_0xdc91[_0x1c2970];return _0x40936a;};'use strict';var Sequelize=require(_0x1dc9('0x0'));module[_0x1dc9('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1dc9('0x2')]},'interface':{'type':Sequelize[_0x1dc9('0x2')]},'membername':{'type':Sequelize[_0x1dc9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x1dc9('0x3')]},'agentdumpAt':{'type':Sequelize[_0x1dc9('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1dc9('0x5')]},'agentacw':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1dc9('0x5')]},'reason':{'type':Sequelize[_0x1dc9('0x2')]},'lastevent':{'type':Sequelize[_0x1dc9('0x2')]},'channel':{'type':Sequelize[_0x1dc9('0x2')]},'channelstate':{'type':Sequelize[_0x1dc9('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1dc9('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1dc9('0x2')]},'exten':{'type':Sequelize[_0x1dc9('0x2')]},'priority':{'type':Sequelize[_0x1dc9('0x2')]},'destchannel':{'type':Sequelize[_0x1dc9('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x1dc9('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1dc9('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x1dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1dc9('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1dc9('0x2')]},'destexten':{'type':Sequelize[_0x1dc9('0x2')]},'destpriority':{'type':Sequelize[_0x1dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x1dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1dc9('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1dc9('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1dc9('0x2')]},'agententerreason':{'type':Sequelize[_0x1dc9('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index cae7dbd..ba959f6 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(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 bac9962..d575fd4 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 _0x46e1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4a790a,_0x92ee7c){var _0x2f0d92=function(_0xf4a237){while(--_0xf4a237){_0x4a790a['push'](_0x4a790a['shift']());}};_0x2f0d92(++_0x92ee7c);}(_0x46e1,0x155));var _0x146e=function(_0x55cf90,_0x4b3d2f){_0x55cf90=_0x55cf90-0x0;var _0x454056=_0x46e1[_0x55cf90];return _0x454056;};'use strict';var _=require(_0x146e('0x0'));var util=require(_0x146e('0x1'));var logger=require(_0x146e('0x2'))(_0x146e('0x3'));var moment=require(_0x146e('0x4'));var BPromise=require(_0x146e('0x5'));var rp=require(_0x146e('0x6'));var fs=require('fs');var path=require(_0x146e('0x7'));var rimraf=require(_0x146e('0x8'));var config=require(_0x146e('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0x146e('0xa')]=function(_0x1f1f15,_0x3de564){return _0x1f1f15[_0x146e('0xb')](_0x146e('0xc'),attributes,{'tableName':_0x146e('0xd'),'paranoid':![],'indexes':[{'fields':[_0x146e('0xe'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','VoiceAgentReport','report_agent','lodash'];(function(_0x66e6ba,_0x407437){var _0x12a6a2=function(_0x1e92e3){while(--_0x1e92e3){_0x66e6ba['push'](_0x66e6ba['shift']());}};_0x12a6a2(++_0x407437);}(_0xbd50,0x196));var _0x0bd5=function(_0x3667c4,_0x4b64bd){_0x3667c4=_0x3667c4-0x0;var _0x12a5a2=_0xbd50[_0x3667c4];return _0x12a5a2;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index abaa225..ea112a3 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 _0x53bc=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','info','UpdateVoiceAgentReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x16e705,_0x3c1245){var _0x1008fd=function(_0x4904c8){while(--_0x4904c8){_0x16e705['push'](_0x16e705['shift']());}};_0x1008fd(++_0x3c1245);}(_0x53bc,0xad));var _0xc53b=function(_0x2af4ff,_0x693eb7){_0x2af4ff=_0x2af4ff-0x0;var _0x2de186=_0x53bc[_0x2af4ff];return _0x2de186;};'use strict';var _=require('lodash');var util=require(_0xc53b('0x0'));var moment=require(_0xc53b('0x1'));var BPromise=require(_0xc53b('0x2'));var rs=require(_0xc53b('0x3'));var fs=require('fs');var Redis=require(_0xc53b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc53b('0x5'))(_0xc53b('0x6'));var config=require(_0xc53b('0x7'));var jayson=require(_0xc53b('0x8'));var client=jayson[_0xc53b('0x9')][_0xc53b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf6bb73,_0x56853d,_0x1df0b4){return new BPromise(function(_0x33071f,_0x5e1f27){return client[_0xc53b('0xb')](_0xf6bb73,_0x1df0b4)[_0xc53b('0xc')](function(_0x3b46a4){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x56853d,_0xc53b('0xd'));logger[_0xc53b('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x56853d,_0xc53b('0xd'),JSON[_0xc53b('0xf')](_0x3b46a4));if(_0x3b46a4['error']){if(_0x3b46a4[_0xc53b('0x10')][_0xc53b('0x11')]===0x1f4){logger[_0xc53b('0x10')](_0xc53b('0x12'),_0x56853d,_0x3b46a4[_0xc53b('0x10')][_0xc53b('0x13')]);return _0x5e1f27(_0x3b46a4[_0xc53b('0x10')][_0xc53b('0x13')]);}logger[_0xc53b('0x10')](_0xc53b('0x12'),_0x56853d,_0x3b46a4[_0xc53b('0x10')][_0xc53b('0x13')]);return _0x33071f(_0x3b46a4[_0xc53b('0x10')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x56853d,_0xc53b('0xd'));_0x33071f(_0x3b46a4['result'][_0xc53b('0x13')]);}})[_0xc53b('0x14')](function(_0x14df07){logger[_0xc53b('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x56853d,_0x14df07);_0x5e1f27(_0x14df07);});});}exports[_0xc53b('0x15')]=function(_0x39bbca){var _0x1e691a=this;return new Promise(function(_0x3573e8,_0x3f19e3){return db[_0xc53b('0x16')]['create'](_0x39bbca[_0xc53b('0x17')],{'raw':_0x39bbca['options']?_0x39bbca[_0xc53b('0x18')][_0xc53b('0x19')]===undefined?!![]:![]:!![]})[_0xc53b('0xc')](function(_0x588396){logger[_0xc53b('0x1a')](_0xc53b('0x15'),_0x39bbca);logger[_0xc53b('0xe')](_0xc53b('0x15'),_0x39bbca,JSON[_0xc53b('0xf')](_0x588396));_0x3573e8(_0x588396);})[_0xc53b('0x14')](function(_0x47e9c8){logger['error'](_0xc53b('0x15'),_0x47e9c8['message'],_0x39bbca);_0x3f19e3(_0x1e691a[_0xc53b('0x10')](0x1f4,_0x47e9c8['message']));});});};exports[_0xc53b('0x1b')]=function(_0x3463a8){var _0x1cdc0c=this;return new Promise(function(_0x3406d0,_0x1651fb){return db[_0xc53b('0x16')][_0xc53b('0x1c')](_0x3463a8['body'],{'raw':_0x3463a8[_0xc53b('0x18')]?_0x3463a8['options'][_0xc53b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3463a8[_0xc53b('0x18')]?_0x3463a8[_0xc53b('0x18')]['where']||null:null,'attributes':_0x3463a8[_0xc53b('0x18')]?_0x3463a8['options']['attributes']||null:null,'limit':_0x3463a8['options']?_0x3463a8[_0xc53b('0x18')][_0xc53b('0x1d')]||null:null})[_0xc53b('0xc')](function(_0x2352db){logger[_0xc53b('0x1a')](_0xc53b('0x1b'),_0x3463a8);logger[_0xc53b('0xe')](_0xc53b('0x1b'),_0x3463a8,JSON['stringify'](_0x2352db));_0x3406d0(_0x2352db);})[_0xc53b('0x14')](function(_0x5e30d1){logger[_0xc53b('0x10')](_0xc53b('0x1b'),_0x5e30d1[_0xc53b('0x13')],_0x3463a8);_0x1651fb(_0x1cdc0c[_0xc53b('0x10')](0x1f4,_0x5e30d1['message']));});});}; \ No newline at end of file +var _0xf83e=['debug','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','then','UpdateVoiceAgentReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xf83e,0x1cd));var _0xef83=function(_0xf22dce,_0x46f799){_0xf22dce=_0xf22dce-0x0;var _0x55c4ba=_0xf83e[_0xf22dce];return _0x55c4ba;};'use strict';var _=require(_0xef83('0x0'));var util=require(_0xef83('0x1'));var moment=require(_0xef83('0x2'));var BPromise=require(_0xef83('0x3'));var rs=require(_0xef83('0x4'));var fs=require('fs');var Redis=require(_0xef83('0x5'));var db=require(_0xef83('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef83('0x7'))(_0xef83('0x8'));var config=require(_0xef83('0x9'));var jayson=require(_0xef83('0xa'));var client=jayson['client'][_0xef83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a831b,_0x221d10,_0x575190){return new BPromise(function(_0x2f7851,_0x581b9f){return client[_0xef83('0xc')](_0x4a831b,_0x575190)['then'](function(_0x350e4f){logger[_0xef83('0xd')](_0xef83('0xe'),_0x221d10,'request\x20sent');logger[_0xef83('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x221d10,_0xef83('0x10'),JSON[_0xef83('0x11')](_0x350e4f));if(_0x350e4f[_0xef83('0x12')]){if(_0x350e4f[_0xef83('0x12')][_0xef83('0x13')]===0x1f4){logger[_0xef83('0x12')](_0xef83('0xe'),_0x221d10,_0x350e4f['error'][_0xef83('0x14')]);return _0x581b9f(_0x350e4f['error'][_0xef83('0x14')]);}logger[_0xef83('0x12')](_0xef83('0xe'),_0x221d10,_0x350e4f[_0xef83('0x12')][_0xef83('0x14')]);return _0x2f7851(_0x350e4f[_0xef83('0x12')][_0xef83('0x14')]);}else{logger[_0xef83('0xd')](_0xef83('0xe'),_0x221d10,_0xef83('0x10'));_0x2f7851(_0x350e4f[_0xef83('0x15')][_0xef83('0x14')]);}})[_0xef83('0x16')](function(_0x24c717){logger[_0xef83('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x221d10,_0x24c717);_0x581b9f(_0x24c717);});});}exports[_0xef83('0x17')]=function(_0x172680){var _0x372cf2=this;return new Promise(function(_0x5c9c87,_0x211c7b){return db[_0xef83('0x18')]['create'](_0x172680[_0xef83('0x19')],{'raw':_0x172680[_0xef83('0x1a')]?_0x172680['options']['raw']===undefined?!![]:![]:!![]})[_0xef83('0x1b')](function(_0x58f931){logger[_0xef83('0xd')](_0xef83('0x17'),_0x172680);logger[_0xef83('0xf')](_0xef83('0x17'),_0x172680,JSON[_0xef83('0x11')](_0x58f931));_0x5c9c87(_0x58f931);})[_0xef83('0x16')](function(_0x43ae88){logger[_0xef83('0x12')](_0xef83('0x17'),_0x43ae88['message'],_0x172680);_0x211c7b(_0x372cf2['error'](0x1f4,_0x43ae88[_0xef83('0x14')]));});});};exports[_0xef83('0x1c')]=function(_0x2e6ab2){var _0x125ba2=this;return new Promise(function(_0x1980df,_0x48ab20){return db[_0xef83('0x18')][_0xef83('0x1d')](_0x2e6ab2[_0xef83('0x19')],{'raw':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6ab2['options']?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x1f')]||null:null,'attributes':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x20')]||null:null,'limit':_0x2e6ab2[_0xef83('0x1a')]?_0x2e6ab2[_0xef83('0x1a')][_0xef83('0x21')]||null:null})[_0xef83('0x1b')](function(_0x28cc3b){logger[_0xef83('0xd')](_0xef83('0x1c'),_0x2e6ab2);logger['debug']('UpdateVoiceAgentReport',_0x2e6ab2,JSON[_0xef83('0x11')](_0x28cc3b));_0x1980df(_0x28cc3b);})['catch'](function(_0x101a58){logger[_0xef83('0x12')](_0xef83('0x1c'),_0x101a58[_0xef83('0x14')],_0x2e6ab2);_0x48ab20(_0x125ba2['error'](0x1f4,_0x101a58['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 410479a..1ee19e0 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 _0x008c=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','show','post','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x008c,0x188));var _0xc008=function(_0x5677b1,_0x4cfe89){_0x5677b1=_0x5677b1-0x0;var _0x3324e5=_0x008c[_0x5677b1];return _0x3324e5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['update']);router[_0xc008('0x10')](_0xc008('0xf'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);module[_0xc008('0x12')]=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(_0x2df0e1,_0x59d50c){var _0xd8d640=function(_0x519f35){while(--_0x519f35){_0x2df0e1['push'](_0x2df0e1['shift']());}};_0xd8d640(++_0x59d50c);}(_0xa630,0xbe));var _0x0a63=function(_0x3ade45,_0x5ea3a8){_0x3ade45=_0x3ade45-0x0;var _0x539c4c=_0xa630[_0x3ade45];return _0x539c4c;};'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 e580168..f75c573 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 _0xbbcd=['outbound','dialer','DATE','INTEGER','exports','STRING','ENUM','inbound'];(function(_0x48eab4,_0x277c00){var _0xae2e9e=function(_0x590f1c){while(--_0x590f1c){_0x48eab4['push'](_0x48eab4['shift']());}};_0xae2e9e(++_0x277c00);}(_0xbbcd,0x13c));var _0xdbbc=function(_0xb37a06,_0x5d9dd3){_0xb37a06=_0xb37a06-0x0;var _0x404bcf=_0xbbcd[_0xb37a06];return _0x404bcf;};'use strict';var Sequelize=require('sequelize');module[_0xdbbc('0x0')]={'uniqueid':{'type':Sequelize[_0xdbbc('0x1')]},'type':{'type':Sequelize[_0xdbbc('0x2')](_0xdbbc('0x3'),'internal',_0xdbbc('0x4'),'inbound-fax','outbound-fax',_0xdbbc('0x5'))},'tag':{'type':Sequelize[_0xdbbc('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xdbbc('0x1')]},'callerid':{'type':Sequelize[_0xdbbc('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xdbbc('0x1')]},'lastapplication':{'type':Sequelize[_0xdbbc('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xdbbc('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xdbbc('0x7')]},'billableseconds':{'type':Sequelize[_0xdbbc('0x7')]},'mohtime':{'type':Sequelize[_0xdbbc('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdbbc('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xdbbc('0x1')]},'userDisposition':{'type':Sequelize[_0xdbbc('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xdbbc('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xdbbc('0x1')]},'note':{'type':Sequelize[_0xdbbc('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xdbbc('0x1')]}}; \ No newline at end of file +var _0xc593=['sequelize','exports','inbound','internal','outbound','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER'];(function(_0x5c4e59,_0x4119ac){var _0x58b87d=function(_0x407699){while(--_0x407699){_0x5c4e59['push'](_0x5c4e59['shift']());}};_0x58b87d(++_0x4119ac);}(_0xc593,0xfd));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x3c59('0x0'));module[_0x3c59('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x3c59('0x2'),_0x3c59('0x3'),_0x3c59('0x4'),'inbound-fax',_0x3c59('0x5'),_0x3c59('0x6'))},'tag':{'type':Sequelize[_0x3c59('0x7')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x3c59('0x7')]},'destination':{'type':Sequelize[_0x3c59('0x7')]},'destinationcontext':{'type':Sequelize[_0x3c59('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3c59('0x7')]},'destinationchannel':{'type':Sequelize[_0x3c59('0x7')]},'lastapplication':{'type':Sequelize[_0x3c59('0x7')]},'lastdata':{'type':Sequelize[_0x3c59('0x8')]},'starttime':{'type':Sequelize[_0x3c59('0x9')]},'systemanswertime':{'type':Sequelize[_0x3c59('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3c59('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x3c59('0xa')]},'mohtime':{'type':Sequelize[_0x3c59('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3c59('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3c59('0x7')]},'userDisposition':{'type':Sequelize[_0x3c59('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x3c59('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x3c59('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x3c59('0xa')]},'sipcallid':{'type':Sequelize[_0x3c59('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a6695f5..9f0290a 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x5f2f,0x73));var _0xf5f2=function(_0x503152,_0x3ed987){_0x503152=_0x503152-0x0;var _0x503932=_0x5f2f[_0x503152];return _0x503932;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xadb5,0xad));var _0x5adb=function(_0x1ab434,_0xd8d5f2){_0x1ab434=_0x1ab434-0x0;var _0x39a7be=_0xadb5[_0x1ab434];return _0x39a7be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1bb16b4..65da4cb 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 _0x1e44=['moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','lodash','util','../../config/logger','api'];(function(_0x2ecea4,_0x17f635){var _0x1e6e5c=function(_0x1c9ed0){while(--_0x1c9ed0){_0x2ecea4['push'](_0x2ecea4['shift']());}};_0x1e6e5c(++_0x17f635);}(_0x1e44,0x1a9));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41e4('0x0'));var util=require(_0x41e4('0x1'));var logger=require(_0x41e4('0x2'))(_0x41e4('0x3'));var moment=require(_0x41e4('0x4'));var BPromise=require(_0x41e4('0x5'));var rp=require(_0x41e4('0x6'));var fs=require('fs');var path=require(_0x41e4('0x7'));var rimraf=require('rimraf');var config=require(_0x41e4('0x8'));var attributes=require(_0x41e4('0x9'));module[_0x41e4('0xa')]=function(_0x4f0c86,_0xf44512){return _0x4f0c86[_0x41e4('0xb')](_0x41e4('0xc'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x50f0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api'];(function(_0x3cac55,_0x586499){var _0x3a598f=function(_0x61800){while(--_0x61800){_0x3cac55['push'](_0x3cac55['shift']());}};_0x3a598f(++_0x586499);}(_0x50f0,0x1cb));var _0x050f=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x50f0[_0x28e2cd];return _0x11fd46;};'use strict';var _=require(_0x050f('0x0'));var util=require(_0x050f('0x1'));var logger=require('../../config/logger')(_0x050f('0x2'));var moment=require(_0x050f('0x3'));var BPromise=require(_0x050f('0x4'));var rp=require(_0x050f('0x5'));var fs=require('fs');var path=require(_0x050f('0x6'));var rimraf=require(_0x050f('0x7'));var config=require(_0x050f('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0x050f('0x9')]=function(_0xed99e4,_0xdf8793){return _0xed99e4[_0x050f('0xa')](_0x050f('0xb'),attributes,{'tableName':_0x050f('0xc'),'paranoid':![],'indexes':[{'fields':[_0x050f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5400311..c682b66 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 _0x2cbc=['error','message','catch','VoiceCallReport','findAll','options','where','attributes','include','model','map','info','GetVoiceCallReport','create','body','then','CreateVoiceCallReport','debug','UpdateVoiceCallReport','update','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2cbc,0x87));var _0xc2cb=function(_0x138c4c,_0x5693fa){_0x138c4c=_0x138c4c-0x0;var _0x57af3d=_0x2cbc[_0x138c4c];return _0x57af3d;};'use strict';var _=require(_0xc2cb('0x0'));var util=require(_0xc2cb('0x1'));var moment=require(_0xc2cb('0x2'));var BPromise=require(_0xc2cb('0x3'));var rs=require(_0xc2cb('0x4'));var fs=require('fs');var Redis=require(_0xc2cb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2cb('0x6'));var logger=require(_0xc2cb('0x7'))(_0xc2cb('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2cb('0x9'));var client=jayson[_0xc2cb('0xa')][_0xc2cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43b9a6,_0x49c5ba,_0x6e6559){return new BPromise(function(_0x316a43,_0x424964){return client[_0xc2cb('0xc')](_0x43b9a6,_0x6e6559)['then'](function(_0x14e3ec){logger['info'](_0xc2cb('0xd'),_0x49c5ba,_0xc2cb('0xe'));logger['debug'](_0xc2cb('0xf'),_0x49c5ba,'request\x20sent',JSON[_0xc2cb('0x10')](_0x14e3ec));if(_0x14e3ec[_0xc2cb('0x11')]){if(_0x14e3ec['error']['code']===0x1f4){logger[_0xc2cb('0x11')](_0xc2cb('0xd'),_0x49c5ba,_0x14e3ec[_0xc2cb('0x11')]['message']);return _0x424964(_0x14e3ec[_0xc2cb('0x11')][_0xc2cb('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x49c5ba,_0x14e3ec[_0xc2cb('0x11')][_0xc2cb('0x12')]);return _0x316a43(_0x14e3ec[_0xc2cb('0x11')][_0xc2cb('0x12')]);}else{logger['info'](_0xc2cb('0xd'),_0x49c5ba,'request\x20sent');_0x316a43(_0x14e3ec['result'][_0xc2cb('0x12')]);}})[_0xc2cb('0x13')](function(_0x2563d5){logger[_0xc2cb('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x49c5ba,_0x2563d5);_0x424964(_0x2563d5);});});}exports['GetVoiceCallReport']=function(_0x27ba29){var _0x23a406=this;return new Promise(function(_0x113722,_0x57c259){return db[_0xc2cb('0x14')][_0xc2cb('0x15')]({'raw':_0x27ba29[_0xc2cb('0x16')]?_0x27ba29['options']['raw']===undefined?!![]:![]:!![],'where':_0x27ba29[_0xc2cb('0x16')]?_0x27ba29[_0xc2cb('0x16')][_0xc2cb('0x17')]||null:null,'attributes':_0x27ba29[_0xc2cb('0x16')]?_0x27ba29[_0xc2cb('0x16')][_0xc2cb('0x18')]||null:null,'limit':_0x27ba29[_0xc2cb('0x16')]?_0x27ba29[_0xc2cb('0x16')]['limit']||null:null,'include':_0x27ba29['options']?_0x27ba29[_0xc2cb('0x16')]['include']?_['map'](_0x27ba29[_0xc2cb('0x16')][_0xc2cb('0x19')],function(_0x2b728c){return{'model':db[_0x2b728c[_0xc2cb('0x1a')]],'as':_0x2b728c['as'],'attributes':_0x2b728c[_0xc2cb('0x18')],'include':_0x2b728c[_0xc2cb('0x19')]?_[_0xc2cb('0x1b')](_0x2b728c[_0xc2cb('0x19')],function(_0x35b99d){return{'model':db[_0x35b99d[_0xc2cb('0x1a')]],'as':_0x35b99d['as'],'attributes':_0x35b99d[_0xc2cb('0x18')],'include':_0x35b99d[_0xc2cb('0x19')]?_[_0xc2cb('0x1b')](_0x35b99d['include'],function(_0x564b67){return{'model':db[_0x564b67[_0xc2cb('0x1a')]],'as':_0x564b67['as'],'attributes':_0x564b67[_0xc2cb('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e51e5){logger[_0xc2cb('0x1c')](_0xc2cb('0x1d'),_0x27ba29);logger['debug'](_0xc2cb('0x1d'),_0x27ba29,JSON[_0xc2cb('0x10')](_0x5e51e5));_0x113722(_0x5e51e5);})['catch'](function(_0x2398d0){logger['error'](_0xc2cb('0x1d'),_0x2398d0['message'],_0x27ba29);_0x57c259(_0x23a406['error'](0x1f4,_0x2398d0[_0xc2cb('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x23f930){var _0x53107f=this;return new Promise(function(_0x5e4b02,_0x1bb8be){return db[_0xc2cb('0x14')][_0xc2cb('0x1e')](_0x23f930[_0xc2cb('0x1f')],{'raw':_0x23f930[_0xc2cb('0x16')]?_0x23f930[_0xc2cb('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc2cb('0x20')](function(_0x5a7d00){logger[_0xc2cb('0x1c')](_0xc2cb('0x21'),_0x23f930);logger[_0xc2cb('0x22')](_0xc2cb('0x21'),_0x23f930,JSON['stringify'](_0x5a7d00));_0x5e4b02(_0x5a7d00);})['catch'](function(_0x82d572){logger[_0xc2cb('0x11')](_0xc2cb('0x21'),_0x82d572[_0xc2cb('0x12')],_0x23f930);_0x1bb8be(_0x53107f['error'](0x1f4,_0x82d572['message']));});});};exports[_0xc2cb('0x23')]=function(_0x4f36c8){var _0x137f20=this;return new Promise(function(_0x2177d9,_0x2c56bd){return db[_0xc2cb('0x14')][_0xc2cb('0x24')](_0x4f36c8[_0xc2cb('0x1f')],{'raw':_0x4f36c8['options']?_0x4f36c8[_0xc2cb('0x16')][_0xc2cb('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f36c8[_0xc2cb('0x16')]?_0x4f36c8['options'][_0xc2cb('0x17')]||null:null,'attributes':_0x4f36c8[_0xc2cb('0x16')]?_0x4f36c8[_0xc2cb('0x16')]['attributes']||null:null,'limit':_0x4f36c8['options']?_0x4f36c8['options']['limit']||null:null})[_0xc2cb('0x20')](function(_0x5e8791){logger['info'](_0xc2cb('0x23'),_0x4f36c8);logger['debug'](_0xc2cb('0x23'),_0x4f36c8,JSON['stringify'](_0x5e8791));_0x2177d9(_0x5e8791);})['catch'](function(_0x1b4987){logger[_0xc2cb('0x11')]('UpdateVoiceCallReport',_0x1b4987['message'],_0x4f36c8);_0x2c56bd(_0x137f20[_0xc2cb('0x11')](0x1f4,_0x1b4987['message']));});});}; \ No newline at end of file +var _0x1f7f=['VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2585dd,_0x272265){var _0x373e8b=function(_0x1b0569){while(--_0x1b0569){_0x2585dd['push'](_0x2585dd['shift']());}};_0x373e8b(++_0x272265);}(_0x1f7f,0x17f));var _0xf1f7=function(_0x1dfef9,_0x2f9407){_0x1dfef9=_0x1dfef9-0x0;var _0x532254=_0x1f7f[_0x1dfef9];return _0x532254;};'use strict';var _=require(_0xf1f7('0x0'));var util=require(_0xf1f7('0x1'));var moment=require(_0xf1f7('0x2'));var BPromise=require(_0xf1f7('0x3'));var rs=require(_0xf1f7('0x4'));var fs=require('fs');var Redis=require(_0xf1f7('0x5'));var db=require(_0xf1f7('0x6'))['db'];var utils=require(_0xf1f7('0x7'));var logger=require('../../config/logger')(_0xf1f7('0x8'));var config=require(_0xf1f7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf1f7('0xa')][_0xf1f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe1181a,_0x74d260,_0x2f33fc){return new BPromise(function(_0x155c0d,_0x117fed){return client[_0xf1f7('0xc')](_0xe1181a,_0x2f33fc)[_0xf1f7('0xd')](function(_0x212925){logger[_0xf1f7('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x74d260,_0xf1f7('0xf'));logger[_0xf1f7('0x10')](_0xf1f7('0x11'),_0x74d260,_0xf1f7('0xf'),JSON[_0xf1f7('0x12')](_0x212925));if(_0x212925[_0xf1f7('0x13')]){if(_0x212925['error'][_0xf1f7('0x14')]===0x1f4){logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x212925['error']['message']);return _0x117fed(_0x212925[_0xf1f7('0x13')][_0xf1f7('0x16')]);}logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x212925[_0xf1f7('0x13')]['message']);return _0x155c0d(_0x212925['error'][_0xf1f7('0x16')]);}else{logger[_0xf1f7('0xe')](_0xf1f7('0x15'),_0x74d260,_0xf1f7('0xf'));_0x155c0d(_0x212925['result'][_0xf1f7('0x16')]);}})[_0xf1f7('0x17')](function(_0x1b2735){logger[_0xf1f7('0x13')](_0xf1f7('0x15'),_0x74d260,_0x1b2735);_0x117fed(_0x1b2735);});});}exports[_0xf1f7('0x18')]=function(_0x41e45b){var _0x56a8f1=this;return new Promise(function(_0x44f978,_0x513904){return db[_0xf1f7('0x19')][_0xf1f7('0x1a')]({'raw':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b[_0xf1f7('0x1b')][_0xf1f7('0x1c')]===undefined?!![]:![]:!![],'where':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b[_0xf1f7('0x1b')][_0xf1f7('0x1d')]||null:null,'attributes':_0x41e45b['options']?_0x41e45b['options'][_0xf1f7('0x1e')]||null:null,'limit':_0x41e45b['options']?_0x41e45b['options'][_0xf1f7('0x1f')]||null:null,'include':_0x41e45b[_0xf1f7('0x1b')]?_0x41e45b['options'][_0xf1f7('0x20')]?_['map'](_0x41e45b['options']['include'],function(_0x5a5b68){return{'model':db[_0x5a5b68[_0xf1f7('0x21')]],'as':_0x5a5b68['as'],'attributes':_0x5a5b68[_0xf1f7('0x1e')],'include':_0x5a5b68[_0xf1f7('0x20')]?_[_0xf1f7('0x22')](_0x5a5b68['include'],function(_0x2189a3){return{'model':db[_0x2189a3[_0xf1f7('0x21')]],'as':_0x2189a3['as'],'attributes':_0x2189a3['attributes'],'include':_0x2189a3[_0xf1f7('0x20')]?_['map'](_0x2189a3['include'],function(_0x182b34){return{'model':db[_0x182b34[_0xf1f7('0x21')]],'as':_0x182b34['as'],'attributes':_0x182b34[_0xf1f7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf1f7('0xd')](function(_0x363390){logger[_0xf1f7('0xe')]('GetVoiceCallReport',_0x41e45b);logger[_0xf1f7('0x10')](_0xf1f7('0x18'),_0x41e45b,JSON[_0xf1f7('0x12')](_0x363390));_0x44f978(_0x363390);})[_0xf1f7('0x17')](function(_0x26617b){logger[_0xf1f7('0x13')](_0xf1f7('0x18'),_0x26617b[_0xf1f7('0x16')],_0x41e45b);_0x513904(_0x56a8f1['error'](0x1f4,_0x26617b[_0xf1f7('0x16')]));});});};exports[_0xf1f7('0x23')]=function(_0xb2123e){var _0x25b122=this;return new Promise(function(_0x5d41df,_0x7a268f){return db[_0xf1f7('0x19')][_0xf1f7('0x24')](_0xb2123e[_0xf1f7('0x25')],{'raw':_0xb2123e['options']?_0xb2123e[_0xf1f7('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf1f7('0xd')](function(_0x47e731){logger[_0xf1f7('0xe')](_0xf1f7('0x23'),_0xb2123e);logger[_0xf1f7('0x10')](_0xf1f7('0x23'),_0xb2123e,JSON[_0xf1f7('0x12')](_0x47e731));_0x5d41df(_0x47e731);})[_0xf1f7('0x17')](function(_0x436a48){logger[_0xf1f7('0x13')](_0xf1f7('0x23'),_0x436a48[_0xf1f7('0x16')],_0xb2123e);_0x7a268f(_0x25b122[_0xf1f7('0x13')](0x1f4,_0x436a48[_0xf1f7('0x16')]));});});};exports[_0xf1f7('0x26')]=function(_0x4d669d){var _0x50779a=this;return new Promise(function(_0x18065d,_0x234ba9){return db[_0xf1f7('0x19')][_0xf1f7('0x27')](_0x4d669d[_0xf1f7('0x25')],{'raw':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d['options']['where']||null:null,'attributes':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')][_0xf1f7('0x1e')]||null:null,'limit':_0x4d669d[_0xf1f7('0x1b')]?_0x4d669d[_0xf1f7('0x1b')][_0xf1f7('0x1f')]||null:null})['then'](function(_0x5bcc7c){logger[_0xf1f7('0xe')]('UpdateVoiceCallReport',_0x4d669d);logger[_0xf1f7('0x10')](_0xf1f7('0x26'),_0x4d669d,JSON[_0xf1f7('0x12')](_0x5bcc7c));_0x18065d(_0x5bcc7c);})['catch'](function(_0x3e9826){logger[_0xf1f7('0x13')](_0xf1f7('0x26'),_0x3e9826[_0xf1f7('0x16')],_0x4d669d);_0x234ba9(_0x50779a[_0xf1f7('0x13')](0x1f4,_0x3e9826[_0xf1f7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6053f16..b10646f 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 _0xe04a=['fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','create','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xe04a,0x182));var _0xae04=function(_0x4207e1,_0x42d8fb){_0x4207e1=_0x4207e1-0x0;var _0x701eff=_0xe04a[_0x4207e1];return _0x701eff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xae04('0x0'));var timeout=require(_0xae04('0x1'));var express=require(_0xae04('0x2'));var router=express[_0xae04('0x3')]();var fs_extra=require(_0xae04('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xae04('0x5'));var config=require(_0xae04('0x6'));var controller=require(_0xae04('0x7'));router[_0xae04('0x8')]('/',auth[_0xae04('0x9')](),controller['index']);router[_0xae04('0x8')](_0xae04('0xa'),auth[_0xae04('0x9')](),controller['show']);router['post']('/',auth[_0xae04('0x9')](),controller[_0xae04('0xb')]);router['put']('/:id',auth[_0xae04('0x9')](),controller[_0xae04('0xc')]);router[_0xae04('0xd')]('/:id',auth[_0xae04('0x9')](),controller[_0xae04('0xe')]);module['exports']=router; \ No newline at end of file +var _0xf449=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x595013,_0x65a215){var _0x2a29e3=function(_0x307bf8){while(--_0x307bf8){_0x595013['push'](_0x595013['shift']());}};_0x2a29e3(++_0x65a215);}(_0xf449,0x73));var _0x9f44=function(_0x31004c,_0x503c2e){_0x31004c=_0x31004c-0x0;var _0x399a98=_0xf449[_0x31004c];return _0x399a98;};'use strict';var multer=require(_0x9f44('0x0'));var util=require(_0x9f44('0x1'));var path=require('path');var timeout=require(_0x9f44('0x2'));var express=require(_0x9f44('0x3'));var router=express[_0x9f44('0x4')]();var fs_extra=require(_0x9f44('0x5'));var auth=require(_0x9f44('0x6'));var interaction=require(_0x9f44('0x7'));var config=require('../../config/environment');var controller=require(_0x9f44('0x8'));router[_0x9f44('0x9')]('/',auth[_0x9f44('0xa')](),controller[_0x9f44('0xb')]);router[_0x9f44('0x9')](_0x9f44('0xc'),auth[_0x9f44('0xa')](),controller[_0x9f44('0xd')]);router['post']('/',auth[_0x9f44('0xa')](),controller[_0x9f44('0xe')]);router[_0x9f44('0xf')]('/:id',auth[_0x9f44('0xa')](),controller[_0x9f44('0x10')]);router['delete']('/:id',auth[_0x9f44('0xa')](),controller[_0x9f44('0x11')]);module[_0x9f44('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index efc0bae..7bbba7b 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 _0x8c27=['split','BOOLEAN','sequelize','STRING','setDataValue','options','join','getDataValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8c27,0x10a));var _0x78c2=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x8c27[_0x38b14f];return _0x22a324;};'use strict';var Sequelize=require(_0x78c2('0x0'));module['exports']={'name':{'type':Sequelize[_0x78c2('0x1')]},'prefix':{'type':Sequelize[_0x78c2('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x78c2('0x1')],'set':function(_0x3517b4){this[_0x78c2('0x2')](_0x78c2('0x3'),_0x3517b4?_0x3517b4[_0x78c2('0x4')](''):[]);},'get':function(){return this[_0x78c2('0x5')](_0x78c2('0x3'))?this[_0x78c2('0x5')](_0x78c2('0x3'))[_0x78c2('0x6')](''):[];}},'auth':{'type':Sequelize[_0x78c2('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x78c2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x78c2('0x1')]}}; \ No newline at end of file +var _0x743b=['STRING','name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x5068cb,_0x372a2a){var _0x423559=function(_0x26a3e3){while(--_0x26a3e3){_0x5068cb['push'](_0x5068cb['shift']());}};_0x423559(++_0x372a2a);}(_0x743b,0xf7));var _0xb743=function(_0x111ac9,_0x5bd85d){_0x111ac9=_0x111ac9-0x0;var _0x12c620=_0x743b[_0x111ac9];return _0x12c620;};'use strict';var Sequelize=require(_0xb743('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb743('0x1')],'unique':_0xb743('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xb743('0x1')],'set':function(_0xe3d427){this[_0xb743('0x3')]('options',_0xe3d427?_0xe3d427['join'](''):[]);},'get':function(){return this[_0xb743('0x4')](_0xb743('0x5'))?this[_0xb743('0x4')](_0xb743('0x5'))[_0xb743('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb743('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb743('0x1')]},'record':{'type':Sequelize[_0xb743('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb743('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ae1318c..bd281b7 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 _0x220b=['findAll','rows','catch','show','params','intersection','includeAll','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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','../../config/utils','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','ChanSpies','destroy','sendStatus','stack','name','send','index','map','VoiceChanSpy','fieldName','query','keys','filters','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x1c2b9b,_0x20c4f1){var _0x40e77b=function(_0x2b830c){while(--_0x2b830c){_0x1c2b9b['push'](_0x1c2b9b['shift']());}};_0x40e77b(++_0x20c4f1);}(_0x220b,0x1a2));var _0xb220=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x220b[_0x503ffd];return _0x160437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb220('0x0'));var zipdir=require(_0xb220('0x1'));var jsonpatch=require(_0xb220('0x2'));var rp=require(_0xb220('0x3'));var moment=require('moment');var BPromise=require(_0xb220('0x4'));var Mustache=require('mustache');var util=require(_0xb220('0x5'));var path=require('path');var sox=require(_0xb220('0x6'));var csv=require(_0xb220('0x7'));var ejs=require(_0xb220('0x8'));var fs=require('fs');var fs_extra=require(_0xb220('0x9'));var _=require('lodash');var squel=require(_0xb220('0xa'));var crypto=require(_0xb220('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb220('0xc'));var toCsv=require(_0xb220('0x7'));var querystring=require(_0xb220('0xd'));var Papa=require(_0xb220('0xe'));var Redis=require(_0xb220('0xf'));var authService=require(_0xb220('0x10'));var qs=require(_0xb220('0x11'));var as=require(_0xb220('0x12'));var hardwareService=require(_0xb220('0x13'));var logger=require('../../config/logger')(_0xb220('0x14'));var utils=require(_0xb220('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x528ce0,_0x59ef3e){_0x59ef3e=_0x59ef3e||0xcc;return function(_0x11229c){if(_0x11229c){return _0x528ce0['sendStatus'](_0x59ef3e);}return _0x528ce0[_0xb220('0x16')](_0x59ef3e)[_0xb220('0x17')]();};}function respondWithResult(_0x378a3b,_0x312c59){_0x312c59=_0x312c59||0xc8;return function(_0x576649){if(_0x576649){return _0x378a3b['status'](_0x312c59)[_0xb220('0x18')](_0x576649);}};}function respondWithFilteredResult(_0x1db409,_0x159eb7){return function(_0x2ee3d2){if(_0x2ee3d2){var _0x16a34b=typeof _0x159eb7[_0xb220('0x19')]===_0xb220('0x1a')&&typeof _0x159eb7[_0xb220('0x1b')]===_0xb220('0x1a');var _0x1416de=_0x2ee3d2[_0xb220('0x1c')];var _0x464ceb=_0x16a34b?0x0:_0x159eb7[_0xb220('0x19')];var _0x21cf2d=_0x16a34b?_0x2ee3d2[_0xb220('0x1c')]:_0x159eb7[_0xb220('0x19')]+_0x159eb7[_0xb220('0x1b')];var _0x1cc822;if(_0x21cf2d>=_0x1416de){_0x21cf2d=_0x1416de;_0x1cc822=0xc8;}else{_0x1cc822=0xce;}_0x1db409[_0xb220('0x16')](_0x1cc822);return _0x1db409[_0xb220('0x1d')](_0xb220('0x1e'),_0x464ceb+'-'+_0x21cf2d+'/'+_0x1416de)[_0xb220('0x18')](_0x2ee3d2);}return null;};}function patchUpdates(_0x213736){return function(_0x358035){try{jsonpatch['apply'](_0x358035,_0x213736,!![]);}catch(_0x45b406){return BPromise['reject'](_0x45b406);}return _0x358035[_0xb220('0x1f')]();};}function saveUpdates(_0x5c4d46,_0x3a1ad7){return function(_0x501f0f){if(_0x501f0f){return _0x501f0f[_0xb220('0x20')](_0x5c4d46)[_0xb220('0x21')](function(_0x2ddf73){return _0x2ddf73;});}return null;};}function removeEntity(_0x2f5a0d,_0x396c72){return function(_0x2975ff){if(_0x2975ff){return _0x2975ff['destroy']()[_0xb220('0x21')](function(){var _0x108450=_0x2975ff[_0xb220('0x22')]({'plain':!![]});var _0x1849c8=_0xb220('0x23');return db['UserProfileResource'][_0xb220('0x24')]({'where':{'type':_0x1849c8,'resourceId':_0x108450['id']}})[_0xb220('0x21')](function(){return _0x2975ff;});})['then'](function(){_0x2f5a0d[_0xb220('0x16')](0xcc)[_0xb220('0x17')]();});}};}function handleEntityNotFound(_0x19d0c4,_0x20b7e5){return function(_0x386778){if(!_0x386778){_0x19d0c4[_0xb220('0x25')](0x194);}return _0x386778;};}function handleError(_0x5c18cb,_0x3b4644){_0x3b4644=_0x3b4644||0x1f4;return function(_0x54c1b9){logger['error'](_0x54c1b9[_0xb220('0x26')]);if(_0x54c1b9[_0xb220('0x27')]){delete _0x54c1b9[_0xb220('0x27')];}_0x5c18cb[_0xb220('0x16')](_0x3b4644)[_0xb220('0x28')](_0x54c1b9);};}exports[_0xb220('0x29')]=function(_0x463e6a,_0x355525){var _0x44da01={},_0x436715={},_0x4e202c={'count':0x0,'rows':[]};var _0x2d98e5=_[_0xb220('0x2a')](db[_0xb220('0x2b')]['rawAttributes'],function(_0x5768eb){return{'name':_0x5768eb[_0xb220('0x2c')],'type':_0x5768eb['type']['key']};});_0x436715['model']=_[_0xb220('0x2a')](_0x2d98e5,_0xb220('0x27'));_0x436715[_0xb220('0x2d')]=_[_0xb220('0x2e')](_0x463e6a[_0xb220('0x2d')]);_0x436715[_0xb220('0x2f')]=_['intersection'](_0x436715['model'],_0x436715[_0xb220('0x2d')]);_0x44da01[_0xb220('0x30')]=_['intersection'](_0x436715[_0xb220('0x31')],qs['fields'](_0x463e6a[_0xb220('0x2d')][_0xb220('0x32')]));_0x44da01[_0xb220('0x30')]=_0x44da01[_0xb220('0x30')][_0xb220('0x33')]?_0x44da01['attributes']:_0x436715['model'];if(!_0x463e6a['query'][_0xb220('0x34')]('nolimit')){_0x44da01[_0xb220('0x1b')]=qs[_0xb220('0x1b')](_0x463e6a[_0xb220('0x2d')]['limit']);_0x44da01['offset']=qs[_0xb220('0x19')](_0x463e6a['query'][_0xb220('0x19')]);}_0x44da01[_0xb220('0x35')]=qs['sort'](_0x463e6a[_0xb220('0x2d')][_0xb220('0x36')]);_0x44da01[_0xb220('0x37')]=qs[_0xb220('0x2f')](_[_0xb220('0x38')](_0x463e6a[_0xb220('0x2d')],_0x436715[_0xb220('0x2f')]),_0x2d98e5);if(_0x463e6a[_0xb220('0x2d')][_0xb220('0x39')]){_0x44da01[_0xb220('0x37')]=_[_0xb220('0x3a')](_0x44da01[_0xb220('0x37')],{'$or':_[_0xb220('0x2a')](_0x2d98e5,function(_0x5ef350){if(_0x5ef350[_0xb220('0x3b')]!==_0xb220('0x3c')){var _0x1cca35={};_0x1cca35[_0x5ef350[_0xb220('0x27')]]={'$like':'%'+_0x463e6a[_0xb220('0x2d')]['filter']+'%'};return _0x1cca35;}})});}_0x44da01=_[_0xb220('0x3a')]({},_0x44da01,_0x463e6a[_0xb220('0x3d')]);var _0x2a5008={'where':_0x44da01[_0xb220('0x37')]};return db['VoiceChanSpy']['count'](_0x2a5008)[_0xb220('0x21')](function(_0x51fd4f){_0x4e202c['count']=_0x51fd4f;if(_0x463e6a[_0xb220('0x2d')]['includeAll']){_0x44da01['include']=[{'all':!![]}];}return db[_0xb220('0x2b')][_0xb220('0x3e')](_0x44da01);})[_0xb220('0x21')](function(_0x24d75c){_0x4e202c[_0xb220('0x3f')]=_0x24d75c;return _0x4e202c;})['then'](respondWithFilteredResult(_0x355525,_0x44da01))[_0xb220('0x40')](handleError(_0x355525,null));};exports[_0xb220('0x41')]=function(_0x458105,_0x284eb2){var _0x45c609={'raw':![],'where':{'id':_0x458105[_0xb220('0x42')]['id']}},_0x2689a1={};_0x2689a1[_0xb220('0x31')]=_[_0xb220('0x2e')](db['VoiceChanSpy']['rawAttributes']);_0x2689a1['query']=_[_0xb220('0x2e')](_0x458105[_0xb220('0x2d')]);_0x2689a1[_0xb220('0x2f')]=_[_0xb220('0x43')](_0x2689a1[_0xb220('0x31')],_0x2689a1[_0xb220('0x2d')]);_0x45c609[_0xb220('0x30')]=_[_0xb220('0x43')](_0x2689a1[_0xb220('0x31')],qs[_0xb220('0x32')](_0x458105[_0xb220('0x2d')][_0xb220('0x32')]));_0x45c609[_0xb220('0x30')]=_0x45c609['attributes'][_0xb220('0x33')]?_0x45c609[_0xb220('0x30')]:_0x2689a1['model'];if(_0x458105[_0xb220('0x2d')][_0xb220('0x44')]){_0x45c609[_0xb220('0x45')]=[{'all':!![]}];}_0x45c609=_[_0xb220('0x3a')]({},_0x45c609,_0x458105[_0xb220('0x3d')]);return db[_0xb220('0x2b')][_0xb220('0x46')](_0x45c609)[_0xb220('0x21')](handleEntityNotFound(_0x284eb2,null))[_0xb220('0x21')](respondWithResult(_0x284eb2,null))[_0xb220('0x40')](handleError(_0x284eb2,null));};exports['create']=function(_0x56fb72,_0x4d80f6){return db[_0xb220('0x2b')][_0xb220('0x47')](_0x56fb72[_0xb220('0x48')],{})[_0xb220('0x21')](function(_0x5c6c3d){var _0x4e0f01=_0x56fb72[_0xb220('0x49')][_0xb220('0x22')]({'plain':!![]});if(!_0x4e0f01)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e0f01['role']===_0xb220('0x49')){var _0x5ef174=_0x5c6c3d[_0xb220('0x22')]({'plain':!![]});var _0xa4ce65=_0xb220('0x23');return db[_0xb220('0x4a')][_0xb220('0x46')]({'where':{'name':_0xa4ce65,'userProfileId':_0x4e0f01[_0xb220('0x4b')]},'raw':!![]})['then'](function(_0x3e1156){if(_0x3e1156&&_0x3e1156[_0xb220('0x4c')]===0x0){return db[_0xb220('0x4d')][_0xb220('0x47')]({'name':_0x5ef174[_0xb220('0x27')],'resourceId':_0x5ef174['id'],'type':_0x3e1156[_0xb220('0x27')],'sectionId':_0x3e1156['id']},{})['then'](function(){return _0x5c6c3d;});}else{return _0x5c6c3d;}})['catch'](function(_0x179cc5){logger[_0xb220('0x4e')](_0xb220('0x4f'),_0x179cc5);throw _0x179cc5;});}return _0x5c6c3d;})[_0xb220('0x21')](respondWithResult(_0x4d80f6,0xc9))[_0xb220('0x40')](handleError(_0x4d80f6,null));};exports[_0xb220('0x20')]=function(_0x255b7b,_0xc92b82){if(_0x255b7b[_0xb220('0x48')]['id']){delete _0x255b7b[_0xb220('0x48')]['id'];}return db['VoiceChanSpy'][_0xb220('0x46')]({'where':{'id':_0x255b7b['params']['id']}})[_0xb220('0x21')](handleEntityNotFound(_0xc92b82,null))[_0xb220('0x21')](saveUpdates(_0x255b7b[_0xb220('0x48')],null))[_0xb220('0x21')](respondWithResult(_0xc92b82,null))[_0xb220('0x40')](handleError(_0xc92b82,null));};exports[_0xb220('0x24')]=function(_0x22063c,_0x5e7a1f){return db['VoiceChanSpy'][_0xb220('0x46')]({'where':{'id':_0x22063c[_0xb220('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e7a1f,null))[_0xb220('0x21')](removeEntity(_0x5e7a1f,null))['catch'](handleError(_0x5e7a1f,null));}; \ No newline at end of file +var _0x8b7c=['stack','name','send','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','catch','show','params','rawAttributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','ChanSpies','UserProfileResource','sendStatus','error'];(function(_0x50f7e8,_0xe4a371){var _0x89f04b=function(_0x95e2f6){while(--_0x95e2f6){_0x50f7e8['push'](_0x50f7e8['shift']());}};_0x89f04b(++_0xe4a371);}(_0x8b7c,0x119));var _0xc8b7=function(_0x52660e,_0x4bae6b){_0x52660e=_0x52660e-0x0;var _0x2fd1a3=_0x8b7c[_0x52660e];return _0x2fd1a3;};'use strict';var emlformat=require(_0xc8b7('0x0'));var rimraf=require(_0xc8b7('0x1'));var zipdir=require(_0xc8b7('0x2'));var jsonpatch=require(_0xc8b7('0x3'));var rp=require(_0xc8b7('0x4'));var moment=require(_0xc8b7('0x5'));var BPromise=require(_0xc8b7('0x6'));var Mustache=require(_0xc8b7('0x7'));var util=require('util');var path=require(_0xc8b7('0x8'));var sox=require(_0xc8b7('0x9'));var csv=require(_0xc8b7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8b7('0xb'));var _=require(_0xc8b7('0xc'));var squel=require(_0xc8b7('0xd'));var crypto=require(_0xc8b7('0xe'));var jsforce=require(_0xc8b7('0xf'));var deskjs=require(_0xc8b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc8b7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc8b7('0x12'));var authService=require(_0xc8b7('0x13'));var qs=require(_0xc8b7('0x14'));var as=require(_0xc8b7('0x15'));var hardwareService=require(_0xc8b7('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc8b7('0x17'));var licenseUtil=require(_0xc8b7('0x18'));var db=require(_0xc8b7('0x19'))['db'];function respondWithStatusCode(_0x21ec4f,_0x5063ad){_0x5063ad=_0x5063ad||0xcc;return function(_0x5495e9){if(_0x5495e9){return _0x21ec4f['sendStatus'](_0x5063ad);}return _0x21ec4f[_0xc8b7('0x1a')](_0x5063ad)[_0xc8b7('0x1b')]();};}function respondWithResult(_0x38da92,_0x5c6e5b){_0x5c6e5b=_0x5c6e5b||0xc8;return function(_0x19d3ea){if(_0x19d3ea){return _0x38da92[_0xc8b7('0x1a')](_0x5c6e5b)[_0xc8b7('0x1c')](_0x19d3ea);}};}function respondWithFilteredResult(_0x1b7dc0,_0x3d189e){return function(_0x5d412e){if(_0x5d412e){var _0xb53183=typeof _0x3d189e[_0xc8b7('0x1d')]===_0xc8b7('0x1e')&&typeof _0x3d189e[_0xc8b7('0x1f')]===_0xc8b7('0x1e');var _0x186dbd=_0x5d412e[_0xc8b7('0x20')];var _0x485415=_0xb53183?0x0:_0x3d189e['offset'];var _0x1cf47c=_0xb53183?_0x5d412e[_0xc8b7('0x20')]:_0x3d189e[_0xc8b7('0x1d')]+_0x3d189e['limit'];var _0x5df9f7;if(_0x1cf47c>=_0x186dbd){_0x1cf47c=_0x186dbd;_0x5df9f7=0xc8;}else{_0x5df9f7=0xce;}_0x1b7dc0[_0xc8b7('0x1a')](_0x5df9f7);return _0x1b7dc0['set'](_0xc8b7('0x21'),_0x485415+'-'+_0x1cf47c+'/'+_0x186dbd)['json'](_0x5d412e);}return null;};}function patchUpdates(_0x462cce){return function(_0x3b39a3){try{jsonpatch['apply'](_0x3b39a3,_0x462cce,!![]);}catch(_0x298e69){return BPromise['reject'](_0x298e69);}return _0x3b39a3[_0xc8b7('0x22')]();};}function saveUpdates(_0x431163,_0x456eea){return function(_0x5e11cd){if(_0x5e11cd){return _0x5e11cd[_0xc8b7('0x23')](_0x431163)[_0xc8b7('0x24')](function(_0x4065d9){return _0x4065d9;});}return null;};}function removeEntity(_0x5b28ad,_0x3b0e47){return function(_0x191c12){if(_0x191c12){return _0x191c12[_0xc8b7('0x25')]()[_0xc8b7('0x24')](function(){var _0x2335cc=_0x191c12[_0xc8b7('0x26')]({'plain':!![]});var _0x2acda2=_0xc8b7('0x27');return db[_0xc8b7('0x28')][_0xc8b7('0x25')]({'where':{'type':_0x2acda2,'resourceId':_0x2335cc['id']}})[_0xc8b7('0x24')](function(){return _0x191c12;});})['then'](function(){_0x5b28ad[_0xc8b7('0x1a')](0xcc)[_0xc8b7('0x1b')]();});}};}function handleEntityNotFound(_0x3a9ce2,_0x3f92bd){return function(_0x2046f5){if(!_0x2046f5){_0x3a9ce2[_0xc8b7('0x29')](0x194);}return _0x2046f5;};}function handleError(_0x5629ce,_0x48682b){_0x48682b=_0x48682b||0x1f4;return function(_0x16cc83){logger[_0xc8b7('0x2a')](_0x16cc83[_0xc8b7('0x2b')]);if(_0x16cc83[_0xc8b7('0x2c')]){delete _0x16cc83[_0xc8b7('0x2c')];}_0x5629ce[_0xc8b7('0x1a')](_0x48682b)[_0xc8b7('0x2d')](_0x16cc83);};}exports['index']=function(_0x3a9658,_0x3d6f00){var _0x13000d={},_0x118574={},_0x27f4b7={'count':0x0,'rows':[]};var _0x340af1=_[_0xc8b7('0x2e')](db[_0xc8b7('0x2f')]['rawAttributes'],function(_0x247388){return{'name':_0x247388[_0xc8b7('0x30')],'type':_0x247388[_0xc8b7('0x31')][_0xc8b7('0x32')]};});_0x118574[_0xc8b7('0x33')]=_[_0xc8b7('0x2e')](_0x340af1,_0xc8b7('0x2c'));_0x118574[_0xc8b7('0x34')]=_[_0xc8b7('0x35')](_0x3a9658[_0xc8b7('0x34')]);_0x118574[_0xc8b7('0x36')]=_[_0xc8b7('0x37')](_0x118574[_0xc8b7('0x33')],_0x118574['query']);_0x13000d['attributes']=_[_0xc8b7('0x37')](_0x118574['model'],qs[_0xc8b7('0x38')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x38')]));_0x13000d[_0xc8b7('0x39')]=_0x13000d[_0xc8b7('0x39')]['length']?_0x13000d[_0xc8b7('0x39')]:_0x118574['model'];if(!_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x3a')](_0xc8b7('0x3b'))){_0x13000d[_0xc8b7('0x1f')]=qs[_0xc8b7('0x1f')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x1f')]);_0x13000d[_0xc8b7('0x1d')]=qs[_0xc8b7('0x1d')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x1d')]);}_0x13000d[_0xc8b7('0x3c')]=qs[_0xc8b7('0x3d')](_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x3d')]);_0x13000d[_0xc8b7('0x3e')]=qs['filters'](_[_0xc8b7('0x3f')](_0x3a9658[_0xc8b7('0x34')],_0x118574[_0xc8b7('0x36')]),_0x340af1);if(_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x40')]){_0x13000d[_0xc8b7('0x3e')]=_['merge'](_0x13000d[_0xc8b7('0x3e')],{'$or':_[_0xc8b7('0x2e')](_0x340af1,function(_0x1d208b){if(_0x1d208b[_0xc8b7('0x31')]!=='VIRTUAL'){var _0x5ae9a2={};_0x5ae9a2[_0x1d208b[_0xc8b7('0x2c')]]={'$like':'%'+_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x40')]+'%'};return _0x5ae9a2;}})});}_0x13000d=_['merge']({},_0x13000d,_0x3a9658['options']);var _0xec344f={'where':_0x13000d[_0xc8b7('0x3e')]};return db[_0xc8b7('0x2f')][_0xc8b7('0x20')](_0xec344f)[_0xc8b7('0x24')](function(_0x3ab722){_0x27f4b7[_0xc8b7('0x20')]=_0x3ab722;if(_0x3a9658[_0xc8b7('0x34')][_0xc8b7('0x41')]){_0x13000d[_0xc8b7('0x42')]=[{'all':!![]}];}return db[_0xc8b7('0x2f')]['findAll'](_0x13000d);})[_0xc8b7('0x24')](function(_0x3d86af){_0x27f4b7['rows']=_0x3d86af;return _0x27f4b7;})['then'](respondWithFilteredResult(_0x3d6f00,_0x13000d))[_0xc8b7('0x43')](handleError(_0x3d6f00,null));};exports[_0xc8b7('0x44')]=function(_0x507326,_0x3aa261){var _0x10a4ff={'raw':![],'where':{'id':_0x507326[_0xc8b7('0x45')]['id']}},_0x768ade={};_0x768ade[_0xc8b7('0x33')]=_[_0xc8b7('0x35')](db[_0xc8b7('0x2f')][_0xc8b7('0x46')]);_0x768ade[_0xc8b7('0x34')]=_[_0xc8b7('0x35')](_0x507326[_0xc8b7('0x34')]);_0x768ade['filters']=_['intersection'](_0x768ade[_0xc8b7('0x33')],_0x768ade['query']);_0x10a4ff[_0xc8b7('0x39')]=_[_0xc8b7('0x37')](_0x768ade[_0xc8b7('0x33')],qs[_0xc8b7('0x38')](_0x507326[_0xc8b7('0x34')][_0xc8b7('0x38')]));_0x10a4ff[_0xc8b7('0x39')]=_0x10a4ff['attributes'][_0xc8b7('0x47')]?_0x10a4ff[_0xc8b7('0x39')]:_0x768ade[_0xc8b7('0x33')];if(_0x507326[_0xc8b7('0x34')][_0xc8b7('0x41')]){_0x10a4ff[_0xc8b7('0x42')]=[{'all':!![]}];}_0x10a4ff=_[_0xc8b7('0x48')]({},_0x10a4ff,_0x507326[_0xc8b7('0x49')]);return db[_0xc8b7('0x2f')][_0xc8b7('0x4a')](_0x10a4ff)[_0xc8b7('0x24')](handleEntityNotFound(_0x3aa261,null))[_0xc8b7('0x24')](respondWithResult(_0x3aa261,null))[_0xc8b7('0x43')](handleError(_0x3aa261,null));};exports[_0xc8b7('0x4b')]=function(_0x493681,_0x3bd1c8){return db[_0xc8b7('0x2f')][_0xc8b7('0x4b')](_0x493681[_0xc8b7('0x4c')],{})[_0xc8b7('0x24')](function(_0x4aa959){var _0xe38e6=_0x493681[_0xc8b7('0x4d')]['get']({'plain':!![]});if(!_0xe38e6)throw new Error(_0xc8b7('0x4e'));if(_0xe38e6[_0xc8b7('0x4f')]===_0xc8b7('0x4d')){var _0x7941a1=_0x4aa959[_0xc8b7('0x26')]({'plain':!![]});var _0x34ee57='ChanSpies';return db[_0xc8b7('0x50')][_0xc8b7('0x4a')]({'where':{'name':_0x34ee57,'userProfileId':_0xe38e6['userProfileId']},'raw':!![]})[_0xc8b7('0x24')](function(_0x34d9bd){if(_0x34d9bd&&_0x34d9bd['autoAssociation']===0x0){return db['UserProfileResource'][_0xc8b7('0x4b')]({'name':_0x7941a1['name'],'resourceId':_0x7941a1['id'],'type':_0x34d9bd['name'],'sectionId':_0x34d9bd['id']},{})[_0xc8b7('0x24')](function(){return _0x4aa959;});}else{return _0x4aa959;}})[_0xc8b7('0x43')](function(_0xbbf03b){logger[_0xc8b7('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbbf03b);throw _0xbbf03b;});}return _0x4aa959;})[_0xc8b7('0x24')](respondWithResult(_0x3bd1c8,0xc9))[_0xc8b7('0x43')](handleError(_0x3bd1c8,null));};exports[_0xc8b7('0x23')]=function(_0x2ece25,_0x525b64){if(_0x2ece25[_0xc8b7('0x4c')]['id']){delete _0x2ece25[_0xc8b7('0x4c')]['id'];}return db[_0xc8b7('0x2f')]['find']({'where':{'id':_0x2ece25[_0xc8b7('0x45')]['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x525b64,null))['then'](saveUpdates(_0x2ece25[_0xc8b7('0x4c')],null))[_0xc8b7('0x24')](respondWithResult(_0x525b64,null))['catch'](handleError(_0x525b64,null));};exports[_0xc8b7('0x25')]=function(_0x264aac,_0x33769d){return db[_0xc8b7('0x2f')]['find']({'where':{'id':_0x264aac['params']['id']}})[_0xc8b7('0x24')](handleEntityNotFound(_0x33769d,null))[_0xc8b7('0x24')](removeEntity(_0x33769d,null))[_0xc8b7('0x43')](handleError(_0x33769d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 64d302e..5937a5b 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 _0x318a=['system','merge','Set','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','push','Authenticate','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','agent','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','catch','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix'];(function(_0x3cd4d5,_0x5b1c28){var _0x6b538d=function(_0x3faeca){while(--_0x3faeca){_0x3cd4d5['push'](_0x3cd4d5['shift']());}};_0x6b538d(++_0x5b1c28);}(_0x318a,0x156));var _0xa318=function(_0x48d15,_0x7c21b2){_0x48d15=_0x48d15-0x0;var _0x1176ad=_0x318a[_0x48d15];return _0x1176ad;};'use strict';var _=require('lodash');var util=require(_0xa318('0x0'));var BPromise=require(_0xa318('0x1'));var attributes=require(_0xa318('0x2'));var getUserApplications=function(_0x2aa6d4,_0x34450f,_0x922c33){var _0x2d2769=0x1;var _0x1682fc=[];var _0x50b89b={'context':_0x34450f[_0xa318('0x3')]||_0xa318('0x4'),'exten':util[_0xa318('0x5')](_0xa318('0x6'),_0x2aa6d4[_0xa318('0x7')],_0x922c33),'type':_0xa318('0x8'),'isApp':![],'ChanSpyId':_0x2aa6d4['id'],'UserId':_0x34450f['id']};_0x1682fc['push'](_[_0xa318('0x9')]({'app':_0xa318('0xa'),'appdata':util[_0xa318('0x5')](_0xa318('0xb'),'chanspy'),'priority':_0x2d2769++},_0x50b89b));if(_0x2aa6d4['record']){_0x1682fc['push'](_[_0xa318('0x9')]({'app':_0xa318('0xc'),'appdata':util['format'](_0xa318('0xd'),_0x2aa6d4[_0xa318('0xe')]),'priority':_0x2d2769++},_0x50b89b));}if(_0x2aa6d4['auth']){_0x1682fc[_0xa318('0xf')](_['merge']({'app':_0xa318('0x10'),'appdata':_0x2aa6d4['password'],'priority':_0x2d2769++},_0x50b89b));}_0x1682fc[_0xa318('0xf')](_[_0xa318('0x9')]({'app':_0xa318('0x11'),'appdata':util[_0xa318('0x5')](_0xa318('0x12'),_0x34450f[_0xa318('0x13')],_0x2aa6d4[_0xa318('0x14')]?_0x2aa6d4['options']['join'](''):''),'priority':_0x2d2769++},_0x50b89b));if(_0x2aa6d4['record']){_0x1682fc[_0xa318('0xf')](_[_0xa318('0x9')]({'app':_0xa318('0x15'),'priority':_0x2d2769++},_0x50b89b));}return _0x1682fc;};var getChanSpyApplications=function(_0x1fe967,_0x536f5d){var _0x247069=[];for(var _0x10981e=0x0,_0x36402a=0x1;_0x10981e<_0x536f5d[_0xa318('0x16')];_0x10981e++,_0x36402a=0x1){_0x247069=_0x247069[_0xa318('0x17')](getUserApplications(_0x1fe967,_0x536f5d[_0x10981e],_0x536f5d[_0x10981e][_0xa318('0x18')]));if(_0x536f5d[_0x10981e][_0xa318('0x18')]!=_0x536f5d[_0x10981e][_0xa318('0x13')]){_0x247069=_0x247069['concat'](getUserApplications(_0x1fe967,_0x536f5d[_0x10981e],_0x536f5d[_0x10981e][_0xa318('0x13')]));}}return _0x247069;};var getChanSpyPromise=function(_0x1df459,_0x22ef46){return new BPromise(function(_0x2c860f,_0x2d28a3){return _0x1df459[_0xa318('0x19')][_0xa318('0x1a')]({'attributes':['id',_0xa318('0x13'),_0xa318('0x18')],'where':{'role':_0xa318('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0xf3ef7f){if(_0xf3ef7f){return _0x2c860f(getChanSpyApplications(_0x22ef46,_0xf3ef7f));}return _0x2c860f([]);})['catch'](function(_0x21d5de){_0x2d28a3(_0x21d5de);});});};module['exports']=function(_0x2943d2,_0x55dba6){var _0x2c0626=_0x2943d2['models'];return _0x2943d2[_0xa318('0x1c')](_0xa318('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xff75d1,_0x546dad,_0x55df77){return getChanSpyPromise(_0x2c0626,_0xff75d1)[_0xa318('0x1e')](function(_0x4f9a3a){if(_0x4f9a3a&&_0x4f9a3a[_0xa318('0x16')]){return _0x2c0626[_0xa318('0x1f')][_0xa318('0x20')](_0x4f9a3a);}})['then'](function(){_0x55df77();})[_0xa318('0x21')](function(_0x178b47){_0x55df77(_0x178b47);});},'afterUpdate':function(_0x4a2e77,_0x5ceaa3,_0x3ccd4d){return _0x2c0626[_0xa318('0x1f')][_0xa318('0x22')]({'where':{'ChanSpyId':_0x4a2e77['id']}})[_0xa318('0x1e')](function(){return getChanSpyPromise(_0x2c0626,_0x4a2e77);})[_0xa318('0x1e')](function(_0x4f8f94){if(_0x4f8f94&&_0x4f8f94['length']){return _0x2c0626['VoiceExtension'][_0xa318('0x20')](_0x4f8f94);}})[_0xa318('0x1e')](function(){_0x3ccd4d();})[_0xa318('0x21')](function(_0x49b8f5){_0x3ccd4d(_0x49b8f5);});},'afterDestroy':function(_0x59414b,_0x3aa1ec,_0x3e330d){return _0x2c0626['VoiceExtension'][_0xa318('0x22')]({'where':{'ChanSpyId':_0x59414b['id']}})[_0xa318('0x1e')](function(){_0x3e330d();})[_0xa318('0x21')](function(_0x1e4d65){_0x3e330d(_0x1e4d65);});}}});}; \ No newline at end of file +var _0xb413=['catch','destroy','lodash','bluebird','context','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','exports','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate'];(function(_0x10c4ed,_0x1c501c){var _0xa29467=function(_0x48da7f){while(--_0x48da7f){_0x10c4ed['push'](_0x10c4ed['shift']());}};_0xa29467(++_0x1c501c);}(_0xb413,0x178));var _0x3b41=function(_0x255737,_0x86f390){_0x255737=_0x255737-0x0;var _0x80deee=_0xb413[_0x255737];return _0x80deee;};'use strict';var _=require(_0x3b41('0x0'));var util=require('util');var BPromise=require(_0x3b41('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x308e50,_0x41c944,_0x24272d){var _0x2f1035=0x1;var _0x22459c=[];var _0x7844d9={'context':_0x41c944[_0x3b41('0x2')]||'from-sip','exten':util[_0x3b41('0x3')](_0x3b41('0x4'),_0x308e50[_0x3b41('0x5')],_0x24272d),'type':'system','isApp':![],'ChanSpyId':_0x308e50['id'],'UserId':_0x41c944['id']};_0x22459c[_0x3b41('0x6')](_[_0x3b41('0x7')]({'app':_0x3b41('0x8'),'appdata':util['format'](_0x3b41('0x9'),'chanspy'),'priority':_0x2f1035++},_0x7844d9));if(_0x308e50[_0x3b41('0xa')]){_0x22459c[_0x3b41('0x6')](_['merge']({'app':_0x3b41('0xb'),'appdata':util[_0x3b41('0x3')](_0x3b41('0xc'),_0x308e50['recordingFormat']),'priority':_0x2f1035++},_0x7844d9));}if(_0x308e50[_0x3b41('0xd')]){_0x22459c[_0x3b41('0x6')](_['merge']({'app':'Authenticate','appdata':_0x308e50[_0x3b41('0xe')],'priority':_0x2f1035++},_0x7844d9));}_0x22459c[_0x3b41('0x6')](_['merge']({'app':_0x3b41('0xf'),'appdata':util['format'](_0x3b41('0x10'),_0x41c944[_0x3b41('0x11')],_0x308e50[_0x3b41('0x12')]?_0x308e50[_0x3b41('0x12')][_0x3b41('0x13')](''):''),'priority':_0x2f1035++},_0x7844d9));if(_0x308e50['record']){_0x22459c[_0x3b41('0x6')](_[_0x3b41('0x7')]({'app':'StopMixMonitor','priority':_0x2f1035++},_0x7844d9));}return _0x22459c;};var getChanSpyApplications=function(_0x12d88b,_0x4fb826){var _0x45204f=[];for(var _0x4e0a64=0x0,_0x43aad6=0x1;_0x4e0a64<_0x4fb826[_0x3b41('0x14')];_0x4e0a64++,_0x43aad6=0x1){_0x45204f=_0x45204f[_0x3b41('0x15')](getUserApplications(_0x12d88b,_0x4fb826[_0x4e0a64],_0x4fb826[_0x4e0a64][_0x3b41('0x16')]));if(_0x4fb826[_0x4e0a64][_0x3b41('0x16')]!=_0x4fb826[_0x4e0a64][_0x3b41('0x11')]){_0x45204f=_0x45204f[_0x3b41('0x15')](getUserApplications(_0x12d88b,_0x4fb826[_0x4e0a64],_0x4fb826[_0x4e0a64][_0x3b41('0x11')]));}}return _0x45204f;};var getChanSpyPromise=function(_0x39a0a3,_0x28c882){return new BPromise(function(_0x53bda4,_0x2ad415){return _0x39a0a3[_0x3b41('0x17')][_0x3b41('0x18')]({'attributes':['id',_0x3b41('0x11'),_0x3b41('0x16')],'where':{'role':_0x3b41('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x57622c){if(_0x57622c){return _0x53bda4(getChanSpyApplications(_0x28c882,_0x57622c));}return _0x53bda4([]);})['catch'](function(_0x22cba8){_0x2ad415(_0x22cba8);});});};module[_0x3b41('0x1a')]=function(_0x1f0fd8,_0x426549){var _0x3e3a6f=_0x1f0fd8['models'];return _0x1f0fd8['define'](_0x3b41('0x1b'),attributes,{'tableName':_0x3b41('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x56fe8a,_0x12530c,_0x551d4b){return getChanSpyPromise(_0x3e3a6f,_0x56fe8a)[_0x3b41('0x1d')](function(_0x143ada){if(_0x143ada&&_0x143ada[_0x3b41('0x14')]){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x1f')](_0x143ada);}})[_0x3b41('0x1d')](function(){_0x551d4b();})[_0x3b41('0x20')](function(_0x382808){_0x551d4b(_0x382808);});},'afterUpdate':function(_0x59ee2b,_0x1538cf,_0x40e8c1){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x21')]({'where':{'ChanSpyId':_0x59ee2b['id']}})[_0x3b41('0x1d')](function(){return getChanSpyPromise(_0x3e3a6f,_0x59ee2b);})['then'](function(_0x50a392){if(_0x50a392&&_0x50a392[_0x3b41('0x14')]){return _0x3e3a6f[_0x3b41('0x1e')][_0x3b41('0x1f')](_0x50a392);}})[_0x3b41('0x1d')](function(){_0x40e8c1();})[_0x3b41('0x20')](function(_0x432c39){_0x40e8c1(_0x432c39);});},'afterDestroy':function(_0x10f784,_0x26e9fb,_0x4f8075){return _0x3e3a6f[_0x3b41('0x1e')]['destroy']({'where':{'ChanSpyId':_0x10f784['id']}})[_0x3b41('0x1d')](function(){_0x4f8075();})['catch'](function(_0x14ce34){_0x4f8075(_0x14ce34);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 882c41a..1304b26 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 _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0x4e1379,_0x5e1a14){_0x4e1379=_0x4e1379-0x0;var _0x3a963c=_0x765e[_0x4e1379];return _0x3a963c;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file +var _0x0713=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f39d5,_0x3fa93c){var _0xcf8861=function(_0x130cff){while(--_0x130cff){_0x1f39d5['push'](_0x1f39d5['shift']());}};_0xcf8861(++_0x3fa93c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4d9d3b2..00ef17d 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 _0x5b2a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','multer'];(function(_0x176b13,_0x78c30b){var _0x5cd0b0=function(_0x1039a2){while(--_0x1039a2){_0x176b13['push'](_0x176b13['shift']());}};_0x5cd0b0(++_0x78c30b);}(_0x5b2a,0x17b));var _0xa5b2=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x5b2a[_0xf0bc07];return _0x1c50c2;};'use strict';var multer=require(_0xa5b2('0x0'));var util=require(_0xa5b2('0x1'));var path=require(_0xa5b2('0x2'));var timeout=require(_0xa5b2('0x3'));var express=require(_0xa5b2('0x4'));var router=express[_0xa5b2('0x5')]();var fs_extra=require(_0xa5b2('0x6'));var auth=require(_0xa5b2('0x7'));var interaction=require(_0xa5b2('0x8'));var config=require(_0xa5b2('0x9'));var controller=require(_0xa5b2('0xa'));router[_0xa5b2('0xb')]('/',auth[_0xa5b2('0xc')](),controller['index']);router[_0xa5b2('0xb')](_0xa5b2('0xd'),auth[_0xa5b2('0xc')](),controller[_0xa5b2('0xe')]);router[_0xa5b2('0xf')]('/',auth[_0xa5b2('0xc')](),controller['create']);router[_0xa5b2('0x10')](_0xa5b2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa5b2('0x11')](_0xa5b2('0xd'),auth['isAuthenticated'](),controller[_0xa5b2('0x12')]);module['exports']=router; \ No newline at end of file +var _0x79f1=['fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','express','Router'];(function(_0x1983dc,_0x21194c){var _0x1d64e4=function(_0x5c8f02){while(--_0x5c8f02){_0x1983dc['push'](_0x1983dc['shift']());}};_0x1d64e4(++_0x21194c);}(_0x79f1,0xf8));var _0x179f=function(_0x12fcbd,_0x884804){_0x12fcbd=_0x12fcbd-0x0;var _0x28ec2a=_0x79f1[_0x12fcbd];return _0x28ec2a;};'use strict';var multer=require(_0x179f('0x0'));var util=require(_0x179f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x179f('0x2'));var router=express[_0x179f('0x3')]();var fs_extra=require(_0x179f('0x4'));var auth=require(_0x179f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x179f('0x6'));var controller=require(_0x179f('0x7'));router[_0x179f('0x8')]('/',auth[_0x179f('0x9')](),controller[_0x179f('0xa')]);router[_0x179f('0x8')](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0xc')]);router[_0x179f('0xd')]('/',auth[_0x179f('0x9')](),controller[_0x179f('0xe')]);router['put'](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0xf')]);router[_0x179f('0x10')](_0x179f('0xb'),auth[_0x179f('0x9')](),controller[_0x179f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ab9ab30..62d8872 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 _0xf8fc=['exports','STRING','sequelize'];(function(_0x4b4a64,_0x448ada){var _0x1b1e21=function(_0xd3240d){while(--_0xd3240d){_0x4b4a64['push'](_0x4b4a64['shift']());}};_0x1b1e21(++_0x448ada);}(_0xf8fc,0x14f));var _0xcf8f=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xf8fc[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0xcf8f('0x0'));module[_0xcf8f('0x1')]={'name':{'type':Sequelize[_0xcf8f('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xcf8f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf24e=['BOOLEAN','STRING'];(function(_0xf069c8,_0x185662){var _0x545d14=function(_0x1edcad){while(--_0x1edcad){_0xf069c8['push'](_0xf069c8['shift']());}};_0x545d14(++_0x185662);}(_0xf24e,0x129));var _0xef24=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xf24e[_0xb66df];return _0x42a702;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xef24('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xef24('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 2d2889e..912724c 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 _0xc433=['sort','pick','filter','where','merge','type','includeAll','include','findAll','rows','show','params','length','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','count','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','sendStatus','name','send','index','VoiceContext','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x43aaab,_0x2796b5){var _0x5e837d=function(_0x2d9d39){while(--_0x2d9d39){_0x43aaab['push'](_0x43aaab['shift']());}};_0x5e837d(++_0x2796b5);}(_0xc433,0x1b0));var _0x3c43=function(_0x402bfa,_0xa06308){_0x402bfa=_0x402bfa-0x0;var _0x3227ea=_0xc433[_0x402bfa];return _0x3227ea;};'use strict';var emlformat=require(_0x3c43('0x0'));var rimraf=require(_0x3c43('0x1'));var zipdir=require(_0x3c43('0x2'));var jsonpatch=require(_0x3c43('0x3'));var rp=require(_0x3c43('0x4'));var moment=require(_0x3c43('0x5'));var BPromise=require(_0x3c43('0x6'));var Mustache=require('mustache');var util=require(_0x3c43('0x7'));var path=require(_0x3c43('0x8'));var sox=require(_0x3c43('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c43('0xa'));var jsforce=require(_0x3c43('0xb'));var deskjs=require(_0x3c43('0xc'));var toCsv=require(_0x3c43('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c43('0xe'));var authService=require(_0x3c43('0xf'));var qs=require(_0x3c43('0x10'));var as=require(_0x3c43('0x11'));var hardwareService=require(_0x3c43('0x12'));var logger=require(_0x3c43('0x13'))(_0x3c43('0x14'));var utils=require('../../config/utils');var config=require(_0x3c43('0x15'));var licenseUtil=require(_0x3c43('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3c43('0x17')][_0x3c43('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x42714c,_0x257b62,_0x112591,_0xe40dbd){return new BPromise(function(_0x556cda,_0x5b49a5){var _0x47d6f1=_0xe40dbd||client;return _0x47d6f1[_0x3c43('0x19')](_0x42714c,_0x112591)[_0x3c43('0x1a')](function(_0x43aa69){logger['info'](_0x3c43('0x1b'),_0x257b62,_0x3c43('0x1c'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x257b62,_0x3c43('0x1c'),JSON[_0x3c43('0x1d')](_0x43aa69));if(_0x43aa69[_0x3c43('0x1e')]){if(_0x43aa69[_0x3c43('0x1e')][_0x3c43('0x1f')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x257b62,_0x43aa69[_0x3c43('0x1e')]['message']);return _0x5b49a5(_0x43aa69[_0x3c43('0x1e')]['message']);}logger['error'](_0x3c43('0x1b'),_0x257b62,_0x43aa69[_0x3c43('0x1e')][_0x3c43('0x20')]);return _0x556cda(_0x43aa69[_0x3c43('0x1e')]['message']);}else{logger[_0x3c43('0x21')](_0x3c43('0x1b'),_0x257b62,_0x3c43('0x1c'));_0x556cda(_0x43aa69[_0x3c43('0x22')][_0x3c43('0x20')]);}})[_0x3c43('0x23')](function(_0x4c52a1){logger['error'](_0x3c43('0x1b'),_0x257b62,_0x4c52a1);_0x5b49a5(_0x4c52a1);});});}function respondWithStatusCode(_0x1ec6fc,_0x5e5437){_0x5e5437=_0x5e5437||0xcc;return function(_0x3c1b17){if(_0x3c1b17){return _0x1ec6fc['sendStatus'](_0x5e5437);}return _0x1ec6fc[_0x3c43('0x24')](_0x5e5437)[_0x3c43('0x25')]();};}function respondWithResult(_0xde9309,_0x4eed83){_0x4eed83=_0x4eed83||0xc8;return function(_0x1e8f2b){if(_0x1e8f2b){return _0xde9309[_0x3c43('0x24')](_0x4eed83)[_0x3c43('0x26')](_0x1e8f2b);}};}function respondWithFilteredResult(_0x183e09,_0x4f5d18){return function(_0xab4c52){if(_0xab4c52){var _0x59447c=typeof _0x4f5d18[_0x3c43('0x27')]==='undefined'&&typeof _0x4f5d18[_0x3c43('0x28')]==='undefined';var _0x2dc04e=_0xab4c52[_0x3c43('0x29')];var _0x4149e1=_0x59447c?0x0:_0x4f5d18[_0x3c43('0x27')];var _0x459fac=_0x59447c?_0xab4c52['count']:_0x4f5d18[_0x3c43('0x27')]+_0x4f5d18[_0x3c43('0x28')];var _0x1c04ac;if(_0x459fac>=_0x2dc04e){_0x459fac=_0x2dc04e;_0x1c04ac=0xc8;}else{_0x1c04ac=0xce;}_0x183e09[_0x3c43('0x24')](_0x1c04ac);return _0x183e09['set']('Content-Range',_0x4149e1+'-'+_0x459fac+'/'+_0x2dc04e)['json'](_0xab4c52);}return null;};}function patchUpdates(_0x5b972c){return function(_0x1c0b56){try{jsonpatch[_0x3c43('0x2a')](_0x1c0b56,_0x5b972c,!![]);}catch(_0x2a3472){return BPromise[_0x3c43('0x2b')](_0x2a3472);}return _0x1c0b56[_0x3c43('0x2c')]();};}function saveUpdates(_0x25e1d0,_0x56ba8c){return function(_0x10b1be){if(_0x10b1be){return _0x10b1be[_0x3c43('0x2d')](_0x25e1d0)['then'](function(_0x1dab8b){return _0x1dab8b;});}return null;};}function removeEntity(_0x855951,_0x448a34){return function(_0x414fec){if(_0x414fec){return _0x414fec['destroy']()['then'](function(){var _0x27601d=_0x414fec[_0x3c43('0x2e')]({'plain':!![]});var _0x47ae2e=_0x3c43('0x2f');return db[_0x3c43('0x30')][_0x3c43('0x31')]({'where':{'type':_0x47ae2e,'resourceId':_0x27601d['id']}})[_0x3c43('0x1a')](function(){return _0x414fec;});})[_0x3c43('0x1a')](function(){_0x855951[_0x3c43('0x24')](0xcc)[_0x3c43('0x25')]();});}};}function handleEntityNotFound(_0x2ea2f6,_0x48f2fe){return function(_0x22b704){if(!_0x22b704){_0x2ea2f6[_0x3c43('0x32')](0x194);}return _0x22b704;};}function handleError(_0xb16bed,_0x3237d2){_0x3237d2=_0x3237d2||0x1f4;return function(_0xb2d274){logger[_0x3c43('0x1e')](_0xb2d274['stack']);if(_0xb2d274[_0x3c43('0x33')]){delete _0xb2d274[_0x3c43('0x33')];}_0xb16bed['status'](_0x3237d2)[_0x3c43('0x34')](_0xb2d274);};}exports[_0x3c43('0x35')]=function(_0x1279fd,_0x158678){var _0xee1c2e={},_0x38c528={},_0x48ecd6={'count':0x0,'rows':[]};var _0x44a9ad=_['map'](db[_0x3c43('0x36')][_0x3c43('0x37')],function(_0x5f563e){return{'name':_0x5f563e[_0x3c43('0x38')],'type':_0x5f563e['type']['key']};});_0x38c528['model']=_[_0x3c43('0x39')](_0x44a9ad,'name');_0x38c528[_0x3c43('0x3a')]=_[_0x3c43('0x3b')](_0x1279fd[_0x3c43('0x3a')]);_0x38c528[_0x3c43('0x3c')]=_[_0x3c43('0x3d')](_0x38c528[_0x3c43('0x3e')],_0x38c528['query']);_0xee1c2e[_0x3c43('0x3f')]=_[_0x3c43('0x3d')](_0x38c528[_0x3c43('0x3e')],qs[_0x3c43('0x40')](_0x1279fd['query'][_0x3c43('0x40')]));_0xee1c2e[_0x3c43('0x3f')]=_0xee1c2e[_0x3c43('0x3f')]['length']?_0xee1c2e[_0x3c43('0x3f')]:_0x38c528['model'];if(!_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x41')](_0x3c43('0x42'))){_0xee1c2e['limit']=qs[_0x3c43('0x28')](_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x28')]);_0xee1c2e[_0x3c43('0x27')]=qs[_0x3c43('0x27')](_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x27')]);}_0xee1c2e[_0x3c43('0x43')]=qs[_0x3c43('0x44')](_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x44')]);_0xee1c2e['where']=qs[_0x3c43('0x3c')](_[_0x3c43('0x45')](_0x1279fd[_0x3c43('0x3a')],_0x38c528['filters']),_0x44a9ad);if(_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x46')]){_0xee1c2e[_0x3c43('0x47')]=_[_0x3c43('0x48')](_0xee1c2e[_0x3c43('0x47')],{'$or':_[_0x3c43('0x39')](_0x44a9ad,function(_0x177b85){if(_0x177b85[_0x3c43('0x49')]!=='VIRTUAL'){var _0x3f8f10={};_0x3f8f10[_0x177b85['name']]={'$like':'%'+_0x1279fd['query'][_0x3c43('0x46')]+'%'};return _0x3f8f10;}})});}_0xee1c2e=_[_0x3c43('0x48')]({},_0xee1c2e,_0x1279fd['options']);var _0x27b544={'where':_0xee1c2e[_0x3c43('0x47')]};return db[_0x3c43('0x36')]['count'](_0x27b544)[_0x3c43('0x1a')](function(_0x370d24){_0x48ecd6[_0x3c43('0x29')]=_0x370d24;if(_0x1279fd[_0x3c43('0x3a')][_0x3c43('0x4a')]){_0xee1c2e[_0x3c43('0x4b')]=[{'all':!![]}];}return db['VoiceContext'][_0x3c43('0x4c')](_0xee1c2e);})['then'](function(_0x2b2d47){_0x48ecd6[_0x3c43('0x4d')]=_0x2b2d47;return _0x48ecd6;})[_0x3c43('0x1a')](respondWithFilteredResult(_0x158678,_0xee1c2e))[_0x3c43('0x23')](handleError(_0x158678,null));};exports[_0x3c43('0x4e')]=function(_0x3ae42e,_0x34d6f2){var _0x4b779e={'raw':![],'where':{'id':_0x3ae42e[_0x3c43('0x4f')]['id']}},_0x250f0a={};_0x250f0a['model']=_['keys'](db[_0x3c43('0x36')]['rawAttributes']);_0x250f0a[_0x3c43('0x3a')]=_[_0x3c43('0x3b')](_0x3ae42e[_0x3c43('0x3a')]);_0x250f0a[_0x3c43('0x3c')]=_[_0x3c43('0x3d')](_0x250f0a[_0x3c43('0x3e')],_0x250f0a['query']);_0x4b779e[_0x3c43('0x3f')]=_[_0x3c43('0x3d')](_0x250f0a[_0x3c43('0x3e')],qs[_0x3c43('0x40')](_0x3ae42e[_0x3c43('0x3a')][_0x3c43('0x40')]));_0x4b779e[_0x3c43('0x3f')]=_0x4b779e[_0x3c43('0x3f')][_0x3c43('0x50')]?_0x4b779e[_0x3c43('0x3f')]:_0x250f0a[_0x3c43('0x3e')];if(_0x3ae42e[_0x3c43('0x3a')][_0x3c43('0x4a')]){_0x4b779e[_0x3c43('0x4b')]=[{'all':!![]}];}_0x4b779e=_[_0x3c43('0x48')]({},_0x4b779e,_0x3ae42e['options']);return db[_0x3c43('0x36')][_0x3c43('0x51')](_0x4b779e)['then'](handleEntityNotFound(_0x34d6f2,null))[_0x3c43('0x1a')](respondWithResult(_0x34d6f2,null))[_0x3c43('0x23')](handleError(_0x34d6f2,null));};exports[_0x3c43('0x52')]=function(_0x3399b7,_0x2a8b29,_0x4f77e3){var _0x3a47bc;return db[_0x3c43('0x36')]['create'](_0x3399b7['body'],{'raw':!![]})['then'](function(_0x22372b){_0x3a47bc=_0x22372b;return db[_0x3c43('0x36')][_0x3c43('0x4c')]({'raw':!![]});})[_0x3c43('0x1a')](function(_0x58219c){var _0x5eac76=fs['readFileSync'](path[_0x3c43('0x53')](config[_0x3c43('0x54')],_0x3c43('0x55')),_0x3c43('0x56'));var _0x116120=ejs[_0x3c43('0x57')](_0x5eac76,{'contexts':_0x58219c||[]});fs[_0x3c43('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x116120);})['then'](function(){return respondWithRpcPromise(_0x3c43('0x59'),_0x3c43('0x52'),{'module':_0x3c43('0x5a')});})[_0x3c43('0x1a')](function(){var _0x3fabf0=_0x3399b7[_0x3c43('0x5b')][_0x3c43('0x2e')]({'plain':!![]});if(!_0x3fabf0)throw new Error(_0x3c43('0x5c'));if(_0x3fabf0[_0x3c43('0x5d')]===_0x3c43('0x5b')){var _0x3f48da=_0x3a47bc['get']({'plain':!![]});return db[_0x3c43('0x5e')]['find']({'where':{'name':'Contexts','userProfileId':_0x3fabf0['userProfileId']},'raw':!![]})['then'](function(_0x27e920){if(_0x27e920&&_0x27e920[_0x3c43('0x5f')]===0x0){return db['UserProfileResource'][_0x3c43('0x52')]({'name':_0x3f48da['name'],'resourceId':_0x3f48da['id'],'type':_0x27e920['name'],'sectionId':_0x27e920['id']},{})['then'](function(){return _0x3a47bc;});}else{return _0x3a47bc;}})[_0x3c43('0x23')](function(_0x53d0b3){logger['error'](_0x3c43('0x60'),_0x53d0b3);throw _0x53d0b3;});}return _0x3a47bc;})['then'](respondWithResult(_0x2a8b29,0xc9))[_0x3c43('0x23')](handleError(_0x2a8b29,null));};exports['update']=function(_0x24fcad,_0x36b9ae,_0x925920){var _0x346eab;return db[_0x3c43('0x36')][_0x3c43('0x51')]({'where':{'id':_0x24fcad[_0x3c43('0x4f')]['id']}})[_0x3c43('0x1a')](handleEntityNotFound(_0x36b9ae,null))[_0x3c43('0x1a')](saveUpdates(_0x24fcad[_0x3c43('0x61')],null))[_0x3c43('0x1a')](function(_0x41844b){if(_0x41844b){_0x346eab=_0x41844b;return db[_0x3c43('0x36')][_0x3c43('0x4c')]({'raw':!![]});}})[_0x3c43('0x1a')](function(_0x93d1a9){var _0x39cfd3=fs[_0x3c43('0x62')](path[_0x3c43('0x53')](config[_0x3c43('0x54')],_0x3c43('0x55')),'utf8');var _0x35ff6e=ejs['render'](_0x39cfd3,{'contexts':_0x93d1a9||[]});fs[_0x3c43('0x58')](_0x3c43('0x63'),_0x35ff6e);})[_0x3c43('0x1a')](function(){return respondWithRpcPromise('Reload',_0x3c43('0x2d'),{'module':_0x3c43('0x5a')});})['then'](function(){return _0x346eab;})['then'](respondWithResult(_0x36b9ae,null))[_0x3c43('0x23')](handleError(_0x36b9ae,null));};exports[_0x3c43('0x31')]=function(_0x24c314,_0x57a8c7,_0x4389b6){var _0x16a25e;return db[_0x3c43('0x36')][_0x3c43('0x51')]({'where':{'id':_0x24c314['params']['id']}})['then'](handleEntityNotFound(_0x57a8c7,null))['then'](removeEntity(_0x57a8c7,null))[_0x3c43('0x1a')](function(){return db[_0x3c43('0x36')][_0x3c43('0x4c')]({'raw':!![]});})[_0x3c43('0x1a')](function(_0x1e3c20){var _0x31eeb9=fs['readFileSync'](path['join'](config['root'],_0x3c43('0x55')),_0x3c43('0x56'));var _0x22c882=ejs[_0x3c43('0x57')](_0x31eeb9,{'contexts':_0x1e3c20});fs[_0x3c43('0x58')](_0x3c43('0x63'),_0x22c882);return respondWithRpcPromise(_0x3c43('0x59'),_0x3c43('0x31'),{'module':_0x3c43('0x5a')});})[_0x3c43('0x23')](handleError(_0x57a8c7,null));}; \ No newline at end of file +var _0x2b26=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','intersection','find','create','join','root','utf8','render','writeFileSync','Reload','chan_sip.so','role','user','UserProfileSection','autoAssociation','UserProfileResource','readFileSync','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','sendStatus','stack','name','index','VoiceContext','type','key','model','map'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x2b26,0x91));var _0x62b2=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2b26[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x62b2('0x0'));var rimraf=require(_0x62b2('0x1'));var zipdir=require(_0x62b2('0x2'));var jsonpatch=require(_0x62b2('0x3'));var rp=require(_0x62b2('0x4'));var moment=require(_0x62b2('0x5'));var BPromise=require(_0x62b2('0x6'));var Mustache=require(_0x62b2('0x7'));var util=require(_0x62b2('0x8'));var path=require('path');var sox=require(_0x62b2('0x9'));var csv=require(_0x62b2('0xa'));var ejs=require(_0x62b2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62b2('0xc'));var squel=require(_0x62b2('0xd'));var crypto=require(_0x62b2('0xe'));var jsforce=require(_0x62b2('0xf'));var deskjs=require(_0x62b2('0x10'));var toCsv=require(_0x62b2('0xa'));var querystring=require(_0x62b2('0x11'));var Papa=require(_0x62b2('0x12'));var Redis=require(_0x62b2('0x13'));var authService=require(_0x62b2('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62b2('0x15'));var logger=require(_0x62b2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x62b2('0x17'));var licenseUtil=require(_0x62b2('0x18'));var db=require(_0x62b2('0x19'))['db'];var jayson=require(_0x62b2('0x1a'));var client=jayson[_0x62b2('0x1b')][_0x62b2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x9eca5f,_0x4c82b2,_0x1d0c9b,_0x486dd7){return new BPromise(function(_0x1c02c5,_0x102dfc){var _0x1c1366=_0x486dd7||client;return _0x1c1366[_0x62b2('0x1d')](_0x9eca5f,_0x1d0c9b)['then'](function(_0x3d6bce){logger[_0x62b2('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'));logger[_0x62b2('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'),JSON[_0x62b2('0x21')](_0x3d6bce));if(_0x3d6bce['error']){if(_0x3d6bce[_0x62b2('0x22')][_0x62b2('0x23')]===0x1f4){logger['error'](_0x62b2('0x24'),_0x4c82b2,_0x3d6bce[_0x62b2('0x22')]['message']);return _0x102dfc(_0x3d6bce['error']['message']);}logger['error'](_0x62b2('0x24'),_0x4c82b2,_0x3d6bce['error'][_0x62b2('0x25')]);return _0x1c02c5(_0x3d6bce[_0x62b2('0x22')][_0x62b2('0x25')]);}else{logger[_0x62b2('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x4c82b2,_0x62b2('0x1f'));_0x1c02c5(_0x3d6bce['result']['message']);}})[_0x62b2('0x26')](function(_0x2b07d5){logger[_0x62b2('0x22')](_0x62b2('0x24'),_0x4c82b2,_0x2b07d5);_0x102dfc(_0x2b07d5);});});}function respondWithStatusCode(_0xf48b7a,_0x57d0bf){_0x57d0bf=_0x57d0bf||0xcc;return function(_0x26db99){if(_0x26db99){return _0xf48b7a['sendStatus'](_0x57d0bf);}return _0xf48b7a[_0x62b2('0x27')](_0x57d0bf)[_0x62b2('0x28')]();};}function respondWithResult(_0x4fab79,_0x2b6c8d){_0x2b6c8d=_0x2b6c8d||0xc8;return function(_0x24d681){if(_0x24d681){return _0x4fab79[_0x62b2('0x27')](_0x2b6c8d)[_0x62b2('0x29')](_0x24d681);}};}function respondWithFilteredResult(_0x4becff,_0x47e5cf){return function(_0x1699b0){if(_0x1699b0){var _0x485fdc=typeof _0x47e5cf['offset']==='undefined'&&typeof _0x47e5cf[_0x62b2('0x2a')]===_0x62b2('0x2b');var _0x3293dc=_0x1699b0[_0x62b2('0x2c')];var _0x50459d=_0x485fdc?0x0:_0x47e5cf[_0x62b2('0x2d')];var _0x33a399=_0x485fdc?_0x1699b0[_0x62b2('0x2c')]:_0x47e5cf[_0x62b2('0x2d')]+_0x47e5cf['limit'];var _0x290565;if(_0x33a399>=_0x3293dc){_0x33a399=_0x3293dc;_0x290565=0xc8;}else{_0x290565=0xce;}_0x4becff[_0x62b2('0x27')](_0x290565);return _0x4becff[_0x62b2('0x2e')](_0x62b2('0x2f'),_0x50459d+'-'+_0x33a399+'/'+_0x3293dc)[_0x62b2('0x29')](_0x1699b0);}return null;};}function patchUpdates(_0xed83d4){return function(_0x2745ea){try{jsonpatch[_0x62b2('0x30')](_0x2745ea,_0xed83d4,!![]);}catch(_0x456773){return BPromise[_0x62b2('0x31')](_0x456773);}return _0x2745ea[_0x62b2('0x32')]();};}function saveUpdates(_0x1006e2,_0x4c067a){return function(_0x36cdf7){if(_0x36cdf7){return _0x36cdf7[_0x62b2('0x33')](_0x1006e2)[_0x62b2('0x34')](function(_0x43f72a){return _0x43f72a;});}return null;};}function removeEntity(_0x7573f0,_0x5f45ca){return function(_0xdc8fe3){if(_0xdc8fe3){return _0xdc8fe3[_0x62b2('0x35')]()[_0x62b2('0x34')](function(){var _0x4da3ca=_0xdc8fe3[_0x62b2('0x36')]({'plain':!![]});var _0xda51e4=_0x62b2('0x37');return db['UserProfileResource'][_0x62b2('0x35')]({'where':{'type':_0xda51e4,'resourceId':_0x4da3ca['id']}})[_0x62b2('0x34')](function(){return _0xdc8fe3;});})[_0x62b2('0x34')](function(){_0x7573f0[_0x62b2('0x27')](0xcc)[_0x62b2('0x28')]();});}};}function handleEntityNotFound(_0x1eae90,_0x430d18){return function(_0x47a0b){if(!_0x47a0b){_0x1eae90[_0x62b2('0x38')](0x194);}return _0x47a0b;};}function handleError(_0x18eafe,_0x2fbff2){_0x2fbff2=_0x2fbff2||0x1f4;return function(_0x385fb0){logger[_0x62b2('0x22')](_0x385fb0[_0x62b2('0x39')]);if(_0x385fb0['name']){delete _0x385fb0[_0x62b2('0x3a')];}_0x18eafe['status'](_0x2fbff2)['send'](_0x385fb0);};}exports[_0x62b2('0x3b')]=function(_0x5308a5,_0xa2f561){var _0x5d65d6={},_0x4dd334={},_0x1d6959={'count':0x0,'rows':[]};var _0x18df14=_['map'](db[_0x62b2('0x3c')]['rawAttributes'],function(_0xd22ed7){return{'name':_0xd22ed7['fieldName'],'type':_0xd22ed7[_0x62b2('0x3d')][_0x62b2('0x3e')]};});_0x4dd334[_0x62b2('0x3f')]=_[_0x62b2('0x40')](_0x18df14,_0x62b2('0x3a'));_0x4dd334['query']=_['keys'](_0x5308a5[_0x62b2('0x41')]);_0x4dd334[_0x62b2('0x42')]=_['intersection'](_0x4dd334['model'],_0x4dd334[_0x62b2('0x41')]);_0x5d65d6[_0x62b2('0x43')]=_['intersection'](_0x4dd334['model'],qs[_0x62b2('0x44')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x44')]));_0x5d65d6[_0x62b2('0x43')]=_0x5d65d6[_0x62b2('0x43')][_0x62b2('0x45')]?_0x5d65d6['attributes']:_0x4dd334[_0x62b2('0x3f')];if(!_0x5308a5[_0x62b2('0x41')][_0x62b2('0x46')](_0x62b2('0x47'))){_0x5d65d6['limit']=qs[_0x62b2('0x2a')](_0x5308a5[_0x62b2('0x41')]['limit']);_0x5d65d6[_0x62b2('0x2d')]=qs[_0x62b2('0x2d')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x2d')]);}_0x5d65d6[_0x62b2('0x48')]=qs[_0x62b2('0x49')](_0x5308a5[_0x62b2('0x41')][_0x62b2('0x49')]);_0x5d65d6['where']=qs[_0x62b2('0x42')](_[_0x62b2('0x4a')](_0x5308a5[_0x62b2('0x41')],_0x4dd334[_0x62b2('0x42')]),_0x18df14);if(_0x5308a5['query'][_0x62b2('0x4b')]){_0x5d65d6[_0x62b2('0x4c')]=_[_0x62b2('0x4d')](_0x5d65d6[_0x62b2('0x4c')],{'$or':_['map'](_0x18df14,function(_0x15995f){if(_0x15995f[_0x62b2('0x3d')]!==_0x62b2('0x4e')){var _0x38a014={};_0x38a014[_0x15995f[_0x62b2('0x3a')]]={'$like':'%'+_0x5308a5[_0x62b2('0x41')]['filter']+'%'};return _0x38a014;}})});}_0x5d65d6=_['merge']({},_0x5d65d6,_0x5308a5[_0x62b2('0x4f')]);var _0x5e66ca={'where':_0x5d65d6[_0x62b2('0x4c')]};return db[_0x62b2('0x3c')][_0x62b2('0x2c')](_0x5e66ca)[_0x62b2('0x34')](function(_0x3a2020){_0x1d6959[_0x62b2('0x2c')]=_0x3a2020;if(_0x5308a5[_0x62b2('0x41')][_0x62b2('0x50')]){_0x5d65d6[_0x62b2('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x62b2('0x52')](_0x5d65d6);})[_0x62b2('0x34')](function(_0x4a234f){_0x1d6959['rows']=_0x4a234f;return _0x1d6959;})[_0x62b2('0x34')](respondWithFilteredResult(_0xa2f561,_0x5d65d6))['catch'](handleError(_0xa2f561,null));};exports[_0x62b2('0x53')]=function(_0x4d716b,_0x41b196){var _0x3eae16={'raw':![],'where':{'id':_0x4d716b[_0x62b2('0x54')]['id']}},_0x58f19a={};_0x58f19a[_0x62b2('0x3f')]=_[_0x62b2('0x55')](db[_0x62b2('0x3c')][_0x62b2('0x56')]);_0x58f19a[_0x62b2('0x41')]=_['keys'](_0x4d716b[_0x62b2('0x41')]);_0x58f19a[_0x62b2('0x42')]=_[_0x62b2('0x57')](_0x58f19a[_0x62b2('0x3f')],_0x58f19a[_0x62b2('0x41')]);_0x3eae16[_0x62b2('0x43')]=_[_0x62b2('0x57')](_0x58f19a[_0x62b2('0x3f')],qs[_0x62b2('0x44')](_0x4d716b[_0x62b2('0x41')][_0x62b2('0x44')]));_0x3eae16[_0x62b2('0x43')]=_0x3eae16[_0x62b2('0x43')][_0x62b2('0x45')]?_0x3eae16['attributes']:_0x58f19a[_0x62b2('0x3f')];if(_0x4d716b['query'][_0x62b2('0x50')]){_0x3eae16[_0x62b2('0x51')]=[{'all':!![]}];}_0x3eae16=_['merge']({},_0x3eae16,_0x4d716b[_0x62b2('0x4f')]);return db[_0x62b2('0x3c')][_0x62b2('0x58')](_0x3eae16)[_0x62b2('0x34')](handleEntityNotFound(_0x41b196,null))['then'](respondWithResult(_0x41b196,null))['catch'](handleError(_0x41b196,null));};exports[_0x62b2('0x59')]=function(_0x53ddb0,_0x6d90ef,_0x6223c2){var _0x4418cd;return db[_0x62b2('0x3c')][_0x62b2('0x59')](_0x53ddb0['body'],{'raw':!![]})[_0x62b2('0x34')](function(_0x2ff441){_0x4418cd=_0x2ff441;return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});})[_0x62b2('0x34')](function(_0x4ca1ed){var _0x3153a4=fs['readFileSync'](path[_0x62b2('0x5a')](config[_0x62b2('0x5b')],'server/files/templates/context.ejs'),_0x62b2('0x5c'));var _0x1bc31f=ejs[_0x62b2('0x5d')](_0x3153a4,{'contexts':_0x4ca1ed||[]});fs[_0x62b2('0x5e')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1bc31f);})[_0x62b2('0x34')](function(){return respondWithRpcPromise(_0x62b2('0x5f'),_0x62b2('0x59'),{'module':_0x62b2('0x60')});})['then'](function(){var _0x10012b=_0x53ddb0['user'][_0x62b2('0x36')]({'plain':!![]});if(!_0x10012b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10012b[_0x62b2('0x61')]===_0x62b2('0x62')){var _0xe2738c=_0x4418cd[_0x62b2('0x36')]({'plain':!![]});return db[_0x62b2('0x63')][_0x62b2('0x58')]({'where':{'name':_0x62b2('0x37'),'userProfileId':_0x10012b['userProfileId']},'raw':!![]})['then'](function(_0x19546b){if(_0x19546b&&_0x19546b[_0x62b2('0x64')]===0x0){return db[_0x62b2('0x65')][_0x62b2('0x59')]({'name':_0xe2738c[_0x62b2('0x3a')],'resourceId':_0xe2738c['id'],'type':_0x19546b['name'],'sectionId':_0x19546b['id']},{})[_0x62b2('0x34')](function(){return _0x4418cd;});}else{return _0x4418cd;}})[_0x62b2('0x26')](function(_0x4a6463){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a6463);throw _0x4a6463;});}return _0x4418cd;})[_0x62b2('0x34')](respondWithResult(_0x6d90ef,0xc9))[_0x62b2('0x26')](handleError(_0x6d90ef,null));};exports[_0x62b2('0x33')]=function(_0x355959,_0x20fce3,_0x5cf175){var _0x1cde8c;return db[_0x62b2('0x3c')]['find']({'where':{'id':_0x355959[_0x62b2('0x54')]['id']}})[_0x62b2('0x34')](handleEntityNotFound(_0x20fce3,null))['then'](saveUpdates(_0x355959['body'],null))[_0x62b2('0x34')](function(_0x4dfdeb){if(_0x4dfdeb){_0x1cde8c=_0x4dfdeb;return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});}})[_0x62b2('0x34')](function(_0x1270f1){var _0x63bdb0=fs[_0x62b2('0x66')](path[_0x62b2('0x5a')](config[_0x62b2('0x5b')],_0x62b2('0x67')),_0x62b2('0x5c'));var _0x7df9d1=ejs['render'](_0x63bdb0,{'contexts':_0x1270f1||[]});fs[_0x62b2('0x5e')](_0x62b2('0x68'),_0x7df9d1);})[_0x62b2('0x34')](function(){return respondWithRpcPromise('Reload',_0x62b2('0x33'),{'module':'chan_sip.so'});})['then'](function(){return _0x1cde8c;})['then'](respondWithResult(_0x20fce3,null))[_0x62b2('0x26')](handleError(_0x20fce3,null));};exports['destroy']=function(_0x590577,_0x1f1022,_0xe581b4){var _0x5123a9;return db['VoiceContext'][_0x62b2('0x58')]({'where':{'id':_0x590577[_0x62b2('0x54')]['id']}})[_0x62b2('0x34')](handleEntityNotFound(_0x1f1022,null))[_0x62b2('0x34')](removeEntity(_0x1f1022,null))[_0x62b2('0x34')](function(){return db[_0x62b2('0x3c')][_0x62b2('0x52')]({'raw':!![]});})[_0x62b2('0x34')](function(_0x2db3aa){var _0x2e642a=fs[_0x62b2('0x66')](path['join'](config[_0x62b2('0x5b')],_0x62b2('0x67')),_0x62b2('0x5c'));var _0x286bf0=ejs['render'](_0x2e642a,{'contexts':_0x2db3aa});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x286bf0);return respondWithRpcPromise(_0x62b2('0x5f'),'destroy',{'module':_0x62b2('0x60')});})[_0x62b2('0x26')](handleError(_0x1f1022,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 8af0db4..5de1c4e 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 _0xb1be=['rimraf','../../config/environment','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x121c2d,_0x5077f0){var _0xb9219e=function(_0x4dc4a4){while(--_0x4dc4a4){_0x121c2d['push'](_0x121c2d['shift']());}};_0xb9219e(++_0x5077f0);}(_0xb1be,0x1c1));var _0xeb1b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1be[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var logger=require(_0xeb1b('0x2'))(_0xeb1b('0x3'));var moment=require(_0xeb1b('0x4'));var BPromise=require(_0xeb1b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb1b('0x6'));var rimraf=require(_0xeb1b('0x7'));var config=require(_0xeb1b('0x8'));var attributes=require('./voiceContext.attributes');module[_0xeb1b('0x9')]=function(_0x2af118,_0x4a3f44){return _0x2af118[_0xeb1b('0xa')]('VoiceContext',attributes,{'tableName':_0xeb1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd811=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x2fc844,_0x734f34){var _0x8cb657=function(_0x4b01fd){while(--_0x4b01fd){_0x2fc844['push'](_0x2fc844['shift']());}};_0x8cb657(++_0x734f34);}(_0xd811,0x165));var _0x1d81=function(_0x470f4b,_0x563ba2){_0x470f4b=_0x470f4b-0x0;var _0x359ae6=_0xd811[_0x470f4b];return _0x359ae6;};'use strict';var _=require(_0x1d81('0x0'));var util=require(_0x1d81('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d81('0x2'));var BPromise=require(_0x1d81('0x3'));var rp=require(_0x1d81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d81('0x5'));var config=require('../../config/environment');var attributes=require(_0x1d81('0x6'));module[_0x1d81('0x7')]=function(_0x41d857,_0x3c0e8d){return _0x41d857[_0x1d81('0x8')](_0x1d81('0x9'),attributes,{'tableName':_0x1d81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 363bb6f..61b6ad7 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 _0xbfcc=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0x1f02cd,_0x2eab7f){var _0x273b83=function(_0x39131e){while(--_0x39131e){_0x1f02cd['push'](_0x1f02cd['shift']());}};_0x273b83(++_0x2eab7f);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0xbfcc[_0x5ecadc];return _0x565037;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('VoiceContext,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});} \ No newline at end of file +var _0x2964=['client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x2964,0x108));var _0x4296=function(_0x300850,_0x518b6c){_0x300850=_0x300850-0x0;var _0x3f324b=_0x2964[_0x300850];return _0x3f324b;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var moment=require(_0x4296('0x2'));var BPromise=require(_0x4296('0x3'));var rs=require(_0x4296('0x4'));var fs=require('fs');var Redis=require(_0x4296('0x5'));var db=require(_0x4296('0x6'))['db'];var utils=require(_0x4296('0x7'));var logger=require(_0x4296('0x8'))('rpc');var config=require(_0x4296('0x9'));var jayson=require(_0x4296('0xa'));var client=jayson[_0x4296('0xb')][_0x4296('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15d705,_0x273d90,_0x50a6c5){return new BPromise(function(_0x20c967,_0x25019c){return client[_0x4296('0xd')](_0x15d705,_0x50a6c5)[_0x4296('0xe')](function(_0x35a29a){logger[_0x4296('0xf')](_0x4296('0x10'),_0x273d90,_0x4296('0x11'));logger[_0x4296('0x12')](_0x4296('0x13'),_0x273d90,_0x4296('0x11'),JSON[_0x4296('0x14')](_0x35a29a));if(_0x35a29a['error']){if(_0x35a29a[_0x4296('0x15')][_0x4296('0x16')]===0x1f4){logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x35a29a[_0x4296('0x15')][_0x4296('0x17')]);return _0x25019c(_0x35a29a[_0x4296('0x15')]['message']);}logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x35a29a[_0x4296('0x15')]['message']);return _0x20c967(_0x35a29a[_0x4296('0x15')][_0x4296('0x17')]);}else{logger[_0x4296('0xf')]('VoiceContext,\x20%s,\x20%s',_0x273d90,_0x4296('0x11'));_0x20c967(_0x35a29a[_0x4296('0x18')][_0x4296('0x17')]);}})['catch'](function(_0x3f5896){logger[_0x4296('0x15')](_0x4296('0x10'),_0x273d90,_0x3f5896);_0x25019c(_0x3f5896);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f6ef1de..582f7c5 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 _0xf0dc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','post','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x213cc8,_0x50d689){var _0x3230f2=function(_0x24e3af){while(--_0x24e3af){_0x213cc8['push'](_0x213cc8['shift']());}};_0x3230f2(++_0x50d689);}(_0xf0dc,0x1f3));var _0xcf0d=function(_0x3eea8a,_0x17cf9f){_0x3eea8a=_0x3eea8a-0x0;var _0xb3c0e1=_0xf0dc[_0x3eea8a];return _0xb3c0e1;};'use strict';var multer=require('multer');var util=require(_0xcf0d('0x0'));var path=require(_0xcf0d('0x1'));var timeout=require(_0xcf0d('0x2'));var express=require(_0xcf0d('0x3'));var router=express['Router']();var fs_extra=require(_0xcf0d('0x4'));var auth=require(_0xcf0d('0x5'));var interaction=require(_0xcf0d('0x6'));var config=require(_0xcf0d('0x7'));var controller=require(_0xcf0d('0x8'));router[_0xcf0d('0x9')]('/',auth[_0xcf0d('0xa')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcf0d('0xb')]);router[_0xcf0d('0x9')]('/:id',auth[_0xcf0d('0xa')](),controller['show']);router[_0xcf0d('0xc')]('/',auth[_0xcf0d('0xa')](),controller['create']);router[_0xcf0d('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcf0d('0xe')](_0xcf0d('0xf'),auth[_0xcf0d('0xa')](),controller[_0xcf0d('0x10')]);module[_0xcf0d('0x11')]=router; \ No newline at end of file +var _0xa1fd=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x4cfdfe,_0x55a62b){var _0x4eea9d=function(_0x32e668){while(--_0x32e668){_0x4cfdfe['push'](_0x4cfdfe['shift']());}};_0x4eea9d(++_0x55a62b);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x4baf36,_0x4e3e17){_0x4baf36=_0x4baf36-0x0;var _0x5a029f=_0xa1fd[_0x4baf36];return _0x5a029f;};'use strict';var multer=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var path=require(_0xda1f('0x2'));var timeout=require(_0xda1f('0x3'));var express=require('express');var router=express[_0xda1f('0x4')]();var fs_extra=require(_0xda1f('0x5'));var auth=require(_0xda1f('0x6'));var interaction=require(_0xda1f('0x7'));var config=require(_0xda1f('0x8'));var controller=require('./voiceDialReport.controller');router[_0xda1f('0x9')]('/',auth[_0xda1f('0xa')](),controller[_0xda1f('0xb')]);router['get'](_0xda1f('0xc'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xd')]);router[_0xda1f('0x9')](_0xda1f('0xe'),auth[_0xda1f('0xa')](),controller[_0xda1f('0xf')]);router[_0xda1f('0x10')]('/',auth[_0xda1f('0xa')](),controller['create']);router[_0xda1f('0x11')](_0xda1f('0xe'),auth[_0xda1f('0xa')](),controller[_0xda1f('0x12')]);router['delete']('/:id',auth[_0xda1f('0xa')](),controller[_0xda1f('0x13')]);module[_0xda1f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 3f32923..12fabcb 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x38253d,_0x17295b){var _0x1b27fd=function(_0x4ab398){while(--_0x4ab398){_0x38253d['push'](_0x38253d['shift']());}};_0x1b27fd(++_0x17295b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x196d30,_0xad0c1f){_0x196d30=_0x196d30-0x0;var _0x3614ec=_0x9bde[_0x196d30];return _0x3614ec;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file +var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x2f568c,_0x43333b){var _0x133182=function(_0x388957){while(--_0x388957){_0x2f568c['push'](_0x2f568c['shift']());}};_0x133182(++_0x43333b);}(_0x6aa7,0x178));var _0x76aa=function(_0x1e2a3c,_0x5d5d13){_0x1e2a3c=_0x1e2a3c-0x0;var _0x5f2d16=_0x6aa7[_0x1e2a3c];return _0x5f2d16;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9b9e5c7..386b598 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 _0x3714=['send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','include','findAll','catch','show','rawAttributes','length','includeAll','options','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name'];(function(_0x23437d,_0x33d2bf){var _0x3317eb=function(_0x1b2378){while(--_0x1b2378){_0x23437d['push'](_0x23437d['shift']());}};_0x3317eb(++_0x33d2bf);}(_0x3714,0xbb));var _0x4371=function(_0x5d93fd,_0xe12f29){_0x5d93fd=_0x5d93fd-0x0;var _0x358960=_0x3714[_0x5d93fd];return _0x358960;};'use strict';var emlformat=require(_0x4371('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4371('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4371('0x2'));var moment=require(_0x4371('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4371('0x4'));var util=require(_0x4371('0x5'));var path=require(_0x4371('0x6'));var sox=require('sox');var csv=require(_0x4371('0x7'));var ejs=require(_0x4371('0x8'));var fs=require('fs');var fs_extra=require(_0x4371('0x9'));var _=require('lodash');var squel=require(_0x4371('0xa'));var crypto=require(_0x4371('0xb'));var jsforce=require(_0x4371('0xc'));var deskjs=require(_0x4371('0xd'));var toCsv=require(_0x4371('0x7'));var querystring=require(_0x4371('0xe'));var Papa=require('papaparse');var Redis=require(_0x4371('0xf'));var authService=require(_0x4371('0x10'));var qs=require(_0x4371('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4371('0x12'))(_0x4371('0x13'));var utils=require('../../config/utils');var config=require(_0x4371('0x14'));var licenseUtil=require(_0x4371('0x15'));var db=require(_0x4371('0x16'))['db'];function respondWithStatusCode(_0x3b1504,_0x91cbcd){_0x91cbcd=_0x91cbcd||0xcc;return function(_0x5cc89f){if(_0x5cc89f){return _0x3b1504[_0x4371('0x17')](_0x91cbcd);}return _0x3b1504['status'](_0x91cbcd)['end']();};}function respondWithResult(_0x2f5059,_0x26ad81){_0x26ad81=_0x26ad81||0xc8;return function(_0xc4e69d){if(_0xc4e69d){return _0x2f5059[_0x4371('0x18')](_0x26ad81)[_0x4371('0x19')](_0xc4e69d);}};}function respondWithFilteredResult(_0x25bd58,_0x401277){return function(_0x392964){if(_0x392964){var _0x1f382c=typeof _0x401277[_0x4371('0x1a')]===_0x4371('0x1b')&&typeof _0x401277[_0x4371('0x1c')]===_0x4371('0x1b');var _0x6a2297=_0x392964['count'];var _0x4fef8d=_0x1f382c?0x0:_0x401277[_0x4371('0x1a')];var _0x54f10a=_0x1f382c?_0x392964[_0x4371('0x1d')]:_0x401277[_0x4371('0x1a')]+_0x401277['limit'];var _0x45b7a7;if(_0x54f10a>=_0x6a2297){_0x54f10a=_0x6a2297;_0x45b7a7=0xc8;}else{_0x45b7a7=0xce;}_0x25bd58[_0x4371('0x18')](_0x45b7a7);return _0x25bd58[_0x4371('0x1e')](_0x4371('0x1f'),_0x4fef8d+'-'+_0x54f10a+'/'+_0x6a2297)[_0x4371('0x19')](_0x392964);}return null;};}function patchUpdates(_0x442513){return function(_0x3469fb){try{jsonpatch[_0x4371('0x20')](_0x3469fb,_0x442513,!![]);}catch(_0x5611f6){return BPromise[_0x4371('0x21')](_0x5611f6);}return _0x3469fb['save']();};}function saveUpdates(_0x2e6164,_0x51bb45){return function(_0x8281a3){if(_0x8281a3){return _0x8281a3[_0x4371('0x22')](_0x2e6164)[_0x4371('0x23')](function(_0x46a4ac){return _0x46a4ac;});}return null;};}function removeEntity(_0x5df158,_0x1c709a){return function(_0x43c001){if(_0x43c001){return _0x43c001[_0x4371('0x24')]()[_0x4371('0x23')](function(){_0x5df158['status'](0xcc)[_0x4371('0x25')]();});}};}function handleEntityNotFound(_0x5f192c,_0x1aa805){return function(_0x3929f0){if(!_0x3929f0){_0x5f192c['sendStatus'](0x194);}return _0x3929f0;};}function handleError(_0x6a107b,_0x1aa295){_0x1aa295=_0x1aa295||0x1f4;return function(_0x4f3ece){logger[_0x4371('0x26')](_0x4f3ece[_0x4371('0x27')]);if(_0x4f3ece[_0x4371('0x28')]){delete _0x4f3ece[_0x4371('0x28')];}_0x6a107b[_0x4371('0x18')](_0x1aa295)[_0x4371('0x29')](_0x4f3ece);};}exports[_0x4371('0x2a')]=function(_0x57cf5b,_0x21f481){var _0x4c9cbf={},_0x4b4b2f={},_0x471498={'count':0x0,'rows':[]};var _0x38546d=_[_0x4371('0x2b')](db[_0x4371('0x2c')]['rawAttributes'],function(_0x1972a7){return{'name':_0x1972a7[_0x4371('0x2d')],'type':_0x1972a7[_0x4371('0x2e')][_0x4371('0x2f')]};});_0x4b4b2f[_0x4371('0x30')]=_[_0x4371('0x2b')](_0x38546d,_0x4371('0x28'));_0x4b4b2f[_0x4371('0x31')]=_[_0x4371('0x32')](_0x57cf5b[_0x4371('0x31')]);_0x4b4b2f[_0x4371('0x33')]=_[_0x4371('0x34')](_0x4b4b2f[_0x4371('0x30')],_0x4b4b2f['query']);_0x4c9cbf['attributes']=_['intersection'](_0x4b4b2f[_0x4371('0x30')],qs[_0x4371('0x35')](_0x57cf5b['query']['fields']));_0x4c9cbf[_0x4371('0x36')]=_0x4c9cbf['attributes']['length']?_0x4c9cbf[_0x4371('0x36')]:_0x4b4b2f[_0x4371('0x30')];if(!_0x57cf5b[_0x4371('0x31')][_0x4371('0x37')](_0x4371('0x38'))){_0x4c9cbf[_0x4371('0x1c')]=qs[_0x4371('0x1c')](_0x57cf5b[_0x4371('0x31')][_0x4371('0x1c')]);_0x4c9cbf[_0x4371('0x1a')]=qs[_0x4371('0x1a')](_0x57cf5b[_0x4371('0x31')][_0x4371('0x1a')]);}_0x4c9cbf[_0x4371('0x39')]=qs[_0x4371('0x3a')](_0x57cf5b['query']['sort']);_0x4c9cbf['where']=qs[_0x4371('0x33')](_[_0x4371('0x3b')](_0x57cf5b['query'],_0x4b4b2f[_0x4371('0x33')]),_0x38546d);if(_0x57cf5b[_0x4371('0x31')]['filter']){_0x4c9cbf[_0x4371('0x3c')]=_[_0x4371('0x3d')](_0x4c9cbf['where'],{'$or':_[_0x4371('0x2b')](_0x38546d,function(_0x586594){if(_0x586594[_0x4371('0x2e')]!==_0x4371('0x3e')){var _0x18140d={};_0x18140d[_0x586594[_0x4371('0x28')]]={'$like':'%'+_0x57cf5b['query']['filter']+'%'};return _0x18140d;}})});}_0x4c9cbf=_['merge']({},_0x4c9cbf,_0x57cf5b['options']);var _0x51aea4={'where':_0x4c9cbf[_0x4371('0x3c')]};return db['VoiceDialReport'][_0x4371('0x1d')](_0x51aea4)[_0x4371('0x23')](function(_0x3fa1f1){_0x471498[_0x4371('0x1d')]=_0x3fa1f1;if(_0x57cf5b[_0x4371('0x31')]['includeAll']){_0x4c9cbf[_0x4371('0x3f')]=[{'all':!![]}];}return db[_0x4371('0x2c')][_0x4371('0x40')](_0x4c9cbf);})[_0x4371('0x23')](function(_0x3f266c){_0x471498['rows']=_0x3f266c;return _0x471498;})[_0x4371('0x23')](respondWithFilteredResult(_0x21f481,_0x4c9cbf))[_0x4371('0x41')](handleError(_0x21f481,null));};exports[_0x4371('0x42')]=function(_0x1adddc,_0x474ea9){var _0x3cacf6={'raw':!![],'where':{'id':_0x1adddc['params']['id']}},_0x1db13f={};_0x1db13f[_0x4371('0x30')]=_[_0x4371('0x32')](db[_0x4371('0x2c')][_0x4371('0x43')]);_0x1db13f['query']=_[_0x4371('0x32')](_0x1adddc[_0x4371('0x31')]);_0x1db13f['filters']=_[_0x4371('0x34')](_0x1db13f[_0x4371('0x30')],_0x1db13f[_0x4371('0x31')]);_0x3cacf6['attributes']=_[_0x4371('0x34')](_0x1db13f[_0x4371('0x30')],qs['fields'](_0x1adddc[_0x4371('0x31')]['fields']));_0x3cacf6['attributes']=_0x3cacf6[_0x4371('0x36')][_0x4371('0x44')]?_0x3cacf6[_0x4371('0x36')]:_0x1db13f[_0x4371('0x30')];if(_0x1adddc['query'][_0x4371('0x45')]){_0x3cacf6[_0x4371('0x3f')]=[{'all':!![]}];}_0x3cacf6=_[_0x4371('0x3d')]({},_0x3cacf6,_0x1adddc[_0x4371('0x46')]);return db['VoiceDialReport'][_0x4371('0x47')](_0x3cacf6)[_0x4371('0x23')](handleEntityNotFound(_0x474ea9,null))[_0x4371('0x23')](respondWithResult(_0x474ea9,null))[_0x4371('0x41')](handleError(_0x474ea9,null));};exports[_0x4371('0x48')]=function(_0x332c21,_0x2dbb9c){return db['VoiceDialReport'][_0x4371('0x48')](_0x332c21['body'],{})[_0x4371('0x23')](respondWithResult(_0x2dbb9c,0xc9))[_0x4371('0x41')](handleError(_0x2dbb9c,null));};exports[_0x4371('0x22')]=function(_0x4e46d5,_0x576809){if(_0x4e46d5[_0x4371('0x49')]['id']){delete _0x4e46d5[_0x4371('0x49')]['id'];}return db[_0x4371('0x2c')][_0x4371('0x47')]({'where':{'id':_0x4e46d5[_0x4371('0x4a')]['id']}})['then'](handleEntityNotFound(_0x576809,null))[_0x4371('0x23')](saveUpdates(_0x4e46d5['body'],null))[_0x4371('0x23')](respondWithResult(_0x576809,null))[_0x4371('0x41')](handleError(_0x576809,null));};exports['destroy']=function(_0x1b3023,_0x492fa3){return db[_0x4371('0x2c')][_0x4371('0x47')]({'where':{'id':_0x1b3023[_0x4371('0x4a')]['id']}})[_0x4371('0x23')](handleEntityNotFound(_0x492fa3,null))[_0x4371('0x23')](removeEntity(_0x492fa3,null))['catch'](handleError(_0x492fa3,null));};exports['describe']=function(_0x53eed2,_0x3a2bd2){return db[_0x4371('0x2c')][_0x4371('0x4b')]()[_0x4371('0x23')](respondWithResult(_0x3a2bd2,null))[_0x4371('0x41')](handleError(_0x3a2bd2,null));}; \ No newline at end of file +var _0xacc5=['stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacc5,0x15c));var _0x5acc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xacc5[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x5acc('0x0'));var rimraf=require(_0x5acc('0x1'));var zipdir=require(_0x5acc('0x2'));var jsonpatch=require(_0x5acc('0x3'));var rp=require(_0x5acc('0x4'));var moment=require(_0x5acc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5acc('0x6'));var util=require(_0x5acc('0x7'));var path=require(_0x5acc('0x8'));var sox=require(_0x5acc('0x9'));var csv=require(_0x5acc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5acc('0xb'));var _=require('lodash');var squel=require(_0x5acc('0xc'));var crypto=require(_0x5acc('0xd'));var jsforce=require(_0x5acc('0xe'));var deskjs=require(_0x5acc('0xf'));var toCsv=require(_0x5acc('0xa'));var querystring=require(_0x5acc('0x10'));var Papa=require(_0x5acc('0x11'));var Redis=require(_0x5acc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5acc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5acc('0x14'));var logger=require(_0x5acc('0x15'))(_0x5acc('0x16'));var utils=require(_0x5acc('0x17'));var config=require(_0x5acc('0x18'));var licenseUtil=require(_0x5acc('0x19'));var db=require(_0x5acc('0x1a'))['db'];function respondWithStatusCode(_0x52268c,_0x55e411){_0x55e411=_0x55e411||0xcc;return function(_0x3ed967){if(_0x3ed967){return _0x52268c[_0x5acc('0x1b')](_0x55e411);}return _0x52268c['status'](_0x55e411)[_0x5acc('0x1c')]();};}function respondWithResult(_0x36706b,_0x504d0b){_0x504d0b=_0x504d0b||0xc8;return function(_0x6a9b16){if(_0x6a9b16){return _0x36706b[_0x5acc('0x1d')](_0x504d0b)[_0x5acc('0x1e')](_0x6a9b16);}};}function respondWithFilteredResult(_0x2acf94,_0x1bd31a){return function(_0x1de419){if(_0x1de419){var _0x105c43=typeof _0x1bd31a[_0x5acc('0x1f')]===_0x5acc('0x20')&&typeof _0x1bd31a[_0x5acc('0x21')]===_0x5acc('0x20');var _0x39322b=_0x1de419[_0x5acc('0x22')];var _0x884a46=_0x105c43?0x0:_0x1bd31a[_0x5acc('0x1f')];var _0x3f5d13=_0x105c43?_0x1de419[_0x5acc('0x22')]:_0x1bd31a['offset']+_0x1bd31a[_0x5acc('0x21')];var _0x285fe5;if(_0x3f5d13>=_0x39322b){_0x3f5d13=_0x39322b;_0x285fe5=0xc8;}else{_0x285fe5=0xce;}_0x2acf94[_0x5acc('0x1d')](_0x285fe5);return _0x2acf94[_0x5acc('0x23')](_0x5acc('0x24'),_0x884a46+'-'+_0x3f5d13+'/'+_0x39322b)[_0x5acc('0x1e')](_0x1de419);}return null;};}function patchUpdates(_0xf9452a){return function(_0x2cb52d){try{jsonpatch['apply'](_0x2cb52d,_0xf9452a,!![]);}catch(_0x3a4b62){return BPromise['reject'](_0x3a4b62);}return _0x2cb52d[_0x5acc('0x25')]();};}function saveUpdates(_0x4ebb3a,_0x56f7c7){return function(_0x5cb301){if(_0x5cb301){return _0x5cb301[_0x5acc('0x26')](_0x4ebb3a)[_0x5acc('0x27')](function(_0x5dacab){return _0x5dacab;});}return null;};}function removeEntity(_0xd52649,_0x53b1e2){return function(_0x175237){if(_0x175237){return _0x175237[_0x5acc('0x28')]()['then'](function(){_0xd52649[_0x5acc('0x1d')](0xcc)[_0x5acc('0x1c')]();});}};}function handleEntityNotFound(_0x1f7faa,_0x21e08c){return function(_0x2ba7bf){if(!_0x2ba7bf){_0x1f7faa['sendStatus'](0x194);}return _0x2ba7bf;};}function handleError(_0x3dc0ee,_0x59cafe){_0x59cafe=_0x59cafe||0x1f4;return function(_0x472a3e){logger[_0x5acc('0x29')](_0x472a3e[_0x5acc('0x2a')]);if(_0x472a3e[_0x5acc('0x2b')]){delete _0x472a3e[_0x5acc('0x2b')];}_0x3dc0ee[_0x5acc('0x1d')](_0x59cafe)[_0x5acc('0x2c')](_0x472a3e);};}exports[_0x5acc('0x2d')]=function(_0x254785,_0x3ae70f){var _0x56d9ae={},_0xe51bdb={},_0x2f181b={'count':0x0,'rows':[]};var _0x28c187=_[_0x5acc('0x2e')](db[_0x5acc('0x2f')][_0x5acc('0x30')],function(_0x2b8d3e){return{'name':_0x2b8d3e[_0x5acc('0x31')],'type':_0x2b8d3e[_0x5acc('0x32')][_0x5acc('0x33')]};});_0xe51bdb[_0x5acc('0x34')]=_[_0x5acc('0x2e')](_0x28c187,'name');_0xe51bdb[_0x5acc('0x35')]=_['keys'](_0x254785[_0x5acc('0x35')]);_0xe51bdb[_0x5acc('0x36')]=_[_0x5acc('0x37')](_0xe51bdb[_0x5acc('0x34')],_0xe51bdb[_0x5acc('0x35')]);_0x56d9ae[_0x5acc('0x38')]=_[_0x5acc('0x37')](_0xe51bdb['model'],qs[_0x5acc('0x39')](_0x254785[_0x5acc('0x35')][_0x5acc('0x39')]));_0x56d9ae[_0x5acc('0x38')]=_0x56d9ae[_0x5acc('0x38')]['length']?_0x56d9ae[_0x5acc('0x38')]:_0xe51bdb[_0x5acc('0x34')];if(!_0x254785[_0x5acc('0x35')][_0x5acc('0x3a')]('nolimit')){_0x56d9ae[_0x5acc('0x21')]=qs[_0x5acc('0x21')](_0x254785['query'][_0x5acc('0x21')]);_0x56d9ae[_0x5acc('0x1f')]=qs[_0x5acc('0x1f')](_0x254785['query']['offset']);}_0x56d9ae['order']=qs['sort'](_0x254785['query'][_0x5acc('0x3b')]);_0x56d9ae['where']=qs[_0x5acc('0x36')](_[_0x5acc('0x3c')](_0x254785['query'],_0xe51bdb[_0x5acc('0x36')]),_0x28c187);if(_0x254785[_0x5acc('0x35')][_0x5acc('0x3d')]){_0x56d9ae[_0x5acc('0x3e')]=_[_0x5acc('0x3f')](_0x56d9ae[_0x5acc('0x3e')],{'$or':_[_0x5acc('0x2e')](_0x28c187,function(_0x3f4148){if(_0x3f4148['type']!==_0x5acc('0x40')){var _0x787ab0={};_0x787ab0[_0x3f4148[_0x5acc('0x2b')]]={'$like':'%'+_0x254785[_0x5acc('0x35')][_0x5acc('0x3d')]+'%'};return _0x787ab0;}})});}_0x56d9ae=_[_0x5acc('0x3f')]({},_0x56d9ae,_0x254785[_0x5acc('0x41')]);var _0x1c439b={'where':_0x56d9ae[_0x5acc('0x3e')]};return db[_0x5acc('0x2f')]['count'](_0x1c439b)[_0x5acc('0x27')](function(_0x3a798){_0x2f181b[_0x5acc('0x22')]=_0x3a798;if(_0x254785[_0x5acc('0x35')][_0x5acc('0x42')]){_0x56d9ae['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x56d9ae);})[_0x5acc('0x27')](function(_0x5ba337){_0x2f181b[_0x5acc('0x43')]=_0x5ba337;return _0x2f181b;})['then'](respondWithFilteredResult(_0x3ae70f,_0x56d9ae))['catch'](handleError(_0x3ae70f,null));};exports[_0x5acc('0x44')]=function(_0x419812,_0x475d26){var _0x34d288={'raw':!![],'where':{'id':_0x419812[_0x5acc('0x45')]['id']}},_0xe9fbea={};_0xe9fbea[_0x5acc('0x34')]=_['keys'](db[_0x5acc('0x2f')]['rawAttributes']);_0xe9fbea[_0x5acc('0x35')]=_[_0x5acc('0x46')](_0x419812[_0x5acc('0x35')]);_0xe9fbea[_0x5acc('0x36')]=_[_0x5acc('0x37')](_0xe9fbea[_0x5acc('0x34')],_0xe9fbea['query']);_0x34d288[_0x5acc('0x38')]=_[_0x5acc('0x37')](_0xe9fbea['model'],qs[_0x5acc('0x39')](_0x419812[_0x5acc('0x35')][_0x5acc('0x39')]));_0x34d288[_0x5acc('0x38')]=_0x34d288['attributes'][_0x5acc('0x47')]?_0x34d288[_0x5acc('0x38')]:_0xe9fbea[_0x5acc('0x34')];if(_0x419812['query'][_0x5acc('0x42')]){_0x34d288[_0x5acc('0x48')]=[{'all':!![]}];}_0x34d288=_[_0x5acc('0x3f')]({},_0x34d288,_0x419812['options']);return db['VoiceDialReport']['find'](_0x34d288)[_0x5acc('0x27')](handleEntityNotFound(_0x475d26,null))[_0x5acc('0x27')](respondWithResult(_0x475d26,null))[_0x5acc('0x49')](handleError(_0x475d26,null));};exports[_0x5acc('0x4a')]=function(_0x5e2812,_0x5cb0a4){return db[_0x5acc('0x2f')][_0x5acc('0x4a')](_0x5e2812[_0x5acc('0x4b')],{})[_0x5acc('0x27')](respondWithResult(_0x5cb0a4,0xc9))[_0x5acc('0x49')](handleError(_0x5cb0a4,null));};exports[_0x5acc('0x26')]=function(_0x4c9c4c,_0x4e64e3){if(_0x4c9c4c['body']['id']){delete _0x4c9c4c[_0x5acc('0x4b')]['id'];}return db[_0x5acc('0x2f')][_0x5acc('0x4c')]({'where':{'id':_0x4c9c4c[_0x5acc('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e64e3,null))[_0x5acc('0x27')](saveUpdates(_0x4c9c4c[_0x5acc('0x4b')],null))['then'](respondWithResult(_0x4e64e3,null))[_0x5acc('0x49')](handleError(_0x4e64e3,null));};exports['destroy']=function(_0x44b2bd,_0xba9491){return db['VoiceDialReport']['find']({'where':{'id':_0x44b2bd[_0x5acc('0x45')]['id']}})['then'](handleEntityNotFound(_0xba9491,null))[_0x5acc('0x27')](removeEntity(_0xba9491,null))[_0x5acc('0x49')](handleError(_0xba9491,null));};exports[_0x5acc('0x4d')]=function(_0x10bd20,_0x3020b8){return db[_0x5acc('0x2f')]['describe']()[_0x5acc('0x27')](respondWithResult(_0x3020b8,null))[_0x5acc('0x49')](handleError(_0x3020b8,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7720870..591a79d 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 _0x0896=['api','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger'];(function(_0x2baecc,_0x25dc1e){var _0x1e16ec=function(_0x2bd1d3){while(--_0x2bd1d3){_0x2baecc['push'](_0x2baecc['shift']());}};_0x1e16ec(++_0x25dc1e);}(_0x0896,0x12a));var _0x6089=function(_0x5c1df3,_0x3e6735){_0x5c1df3=_0x5c1df3-0x0;var _0x1f54e0=_0x0896[_0x5c1df3];return _0x1f54e0;};'use strict';var _=require(_0x6089('0x0'));var util=require('util');var logger=require(_0x6089('0x1'))(_0x6089('0x2'));var moment=require('moment');var BPromise=require(_0x6089('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6089('0x4'));var config=require(_0x6089('0x5'));var attributes=require(_0x6089('0x6'));module['exports']=function(_0x11cdbb,_0x4f0dbd){return _0x11cdbb['define'](_0x6089('0x7'),attributes,{'tableName':_0x6089('0x8'),'paranoid':![],'indexes':[{'fields':[_0x6089('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96a2=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid'];(function(_0x522bc8,_0x3525bf){var _0x5c5ab4=function(_0x48cafe){while(--_0x48cafe){_0x522bc8['push'](_0x522bc8['shift']());}};_0x5c5ab4(++_0x3525bf);}(_0x96a2,0x96));var _0x296a=function(_0x42c109,_0x49d418){_0x42c109=_0x42c109-0x0;var _0x52e394=_0x96a2[_0x42c109];return _0x52e394;};'use strict';var _=require(_0x296a('0x0'));var util=require('util');var logger=require(_0x296a('0x1'))(_0x296a('0x2'));var moment=require(_0x296a('0x3'));var BPromise=require(_0x296a('0x4'));var rp=require(_0x296a('0x5'));var fs=require('fs');var path=require(_0x296a('0x6'));var rimraf=require(_0x296a('0x7'));var config=require(_0x296a('0x8'));var attributes=require(_0x296a('0x9'));module[_0x296a('0xa')]=function(_0x285be8,_0x31bb42){return _0x285be8[_0x296a('0xb')](_0x296a('0xc'),attributes,{'tableName':_0x296a('0xd'),'paranoid':![],'indexes':[{'fields':[_0x296a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a815e21..05d3aba 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 _0x81f1=['request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x81f1,0x18b));var _0x181f=function(_0x4b7bdf,_0x2be2d1){_0x4b7bdf=_0x4b7bdf-0x0;var _0x3fce2f=_0x81f1[_0x4b7bdf];return _0x3fce2f;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require(_0x181f('0x4'));var fs=require('fs');var Redis=require(_0x181f('0x5'));var db=require(_0x181f('0x6'))['db'];var utils=require(_0x181f('0x7'));var logger=require(_0x181f('0x8'))(_0x181f('0x9'));var config=require(_0x181f('0xa'));var jayson=require(_0x181f('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25130c,_0x18211a,_0x51d0b4){return new BPromise(function(_0x4bf461,_0x2bd29a){return client[_0x181f('0xc')](_0x25130c,_0x51d0b4)[_0x181f('0xd')](function(_0x273e25){logger['info'](_0x181f('0xe'),_0x18211a,'request\x20sent');logger[_0x181f('0xf')](_0x181f('0x10'),_0x18211a,'request\x20sent',JSON[_0x181f('0x11')](_0x273e25));if(_0x273e25[_0x181f('0x12')]){if(_0x273e25[_0x181f('0x12')]['code']===0x1f4){logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x273e25[_0x181f('0x12')][_0x181f('0x13')]);return _0x2bd29a(_0x273e25[_0x181f('0x12')]['message']);}logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x273e25['error']['message']);return _0x4bf461(_0x273e25[_0x181f('0x12')][_0x181f('0x13')]);}else{logger[_0x181f('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x18211a,_0x181f('0x15'));_0x4bf461(_0x273e25[_0x181f('0x16')][_0x181f('0x13')]);}})[_0x181f('0x17')](function(_0x41b3de){logger[_0x181f('0x12')](_0x181f('0xe'),_0x18211a,_0x41b3de);_0x2bd29a(_0x41b3de);});});}exports[_0x181f('0x18')]=function(_0x4e4b56){var _0x43ccec=this;return new Promise(function(_0x214aa5,_0x55366c){return db[_0x181f('0x19')][_0x181f('0x1a')](_0x4e4b56[_0x181f('0x1b')],{'raw':_0x4e4b56[_0x181f('0x1c')]?_0x4e4b56[_0x181f('0x1c')][_0x181f('0x1d')]===undefined?!![]:![]:!![]})[_0x181f('0xd')](function(_0x2adfbd){logger[_0x181f('0x14')]('CreateVoiceDialReport',_0x4e4b56);logger[_0x181f('0xf')]('CreateVoiceDialReport',_0x4e4b56,JSON['stringify'](_0x2adfbd));_0x214aa5(_0x2adfbd);})[_0x181f('0x17')](function(_0x199f56){logger['error'](_0x181f('0x18'),_0x199f56[_0x181f('0x13')],_0x4e4b56);_0x55366c(_0x43ccec[_0x181f('0x12')](0x1f4,_0x199f56[_0x181f('0x13')]));});});};exports[_0x181f('0x1e')]=function(_0x4af1a6){var _0x4b5dce=this;return new Promise(function(_0x221cea,_0x415369){return db[_0x181f('0x19')]['update'](_0x4af1a6[_0x181f('0x1b')],{'raw':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')][_0x181f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4af1a6['options']?_0x4af1a6['options'][_0x181f('0x1f')]||null:null,'attributes':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')]['attributes']||null:null,'limit':_0x4af1a6[_0x181f('0x1c')]?_0x4af1a6[_0x181f('0x1c')]['limit']||null:null})['then'](function(_0x3069e9){logger[_0x181f('0x14')](_0x181f('0x1e'),_0x4af1a6);logger[_0x181f('0xf')](_0x181f('0x1e'),_0x4af1a6,JSON[_0x181f('0x11')](_0x3069e9));_0x221cea(_0x3069e9);})[_0x181f('0x17')](function(_0x4d2fd4){logger['error'](_0x181f('0x1e'),_0x4d2fd4[_0x181f('0x13')],_0x4af1a6);_0x415369(_0x4b5dce[_0x181f('0x12')](0x1f4,_0x4d2fd4['message']));});});}; \ No newline at end of file +var _0x3abf=['catch','VoiceDialReport','create','options','CreateVoiceDialReport','update','body','raw','where','attributes','limit','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x108fc1,_0x18e358){var _0x597063=function(_0x29fcaf){while(--_0x29fcaf){_0x108fc1['push'](_0x108fc1['shift']());}};_0x597063(++_0x18e358);}(_0x3abf,0x16c));var _0xf3ab=function(_0x5c8338,_0x43ab02){_0x5c8338=_0x5c8338-0x0;var _0x4b246f=_0x3abf[_0x5c8338];return _0x4b246f;};'use strict';var _=require(_0xf3ab('0x0'));var util=require('util');var moment=require(_0xf3ab('0x1'));var BPromise=require(_0xf3ab('0x2'));var rs=require(_0xf3ab('0x3'));var fs=require('fs');var Redis=require(_0xf3ab('0x4'));var db=require(_0xf3ab('0x5'))['db'];var utils=require(_0xf3ab('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf3ab('0x7'));var client=jayson[_0xf3ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d87a,_0x33da97,_0x5fecd0){return new BPromise(function(_0x3db795,_0x29e846){return client[_0xf3ab('0x9')](_0x4d87a,_0x5fecd0)[_0xf3ab('0xa')](function(_0xda4e68){logger[_0xf3ab('0xb')](_0xf3ab('0xc'),_0x33da97,'request\x20sent');logger[_0xf3ab('0xd')](_0xf3ab('0xe'),_0x33da97,_0xf3ab('0xf'),JSON[_0xf3ab('0x10')](_0xda4e68));if(_0xda4e68[_0xf3ab('0x11')]){if(_0xda4e68[_0xf3ab('0x11')]['code']===0x1f4){logger[_0xf3ab('0x11')](_0xf3ab('0xc'),_0x33da97,_0xda4e68[_0xf3ab('0x11')][_0xf3ab('0x12')]);return _0x29e846(_0xda4e68['error'][_0xf3ab('0x12')]);}logger['error'](_0xf3ab('0xc'),_0x33da97,_0xda4e68[_0xf3ab('0x11')]['message']);return _0x3db795(_0xda4e68[_0xf3ab('0x11')]['message']);}else{logger[_0xf3ab('0xb')](_0xf3ab('0xc'),_0x33da97,_0xf3ab('0xf'));_0x3db795(_0xda4e68[_0xf3ab('0x13')]['message']);}})[_0xf3ab('0x14')](function(_0x272dd2){logger[_0xf3ab('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x33da97,_0x272dd2);_0x29e846(_0x272dd2);});});}exports['CreateVoiceDialReport']=function(_0x46e71b){var _0x35a925=this;return new Promise(function(_0x41ba01,_0x42e5bf){return db[_0xf3ab('0x15')][_0xf3ab('0x16')](_0x46e71b['body'],{'raw':_0x46e71b[_0xf3ab('0x17')]?_0x46e71b[_0xf3ab('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf3ab('0xa')](function(_0x202998){logger['info'](_0xf3ab('0x18'),_0x46e71b);logger['debug'](_0xf3ab('0x18'),_0x46e71b,JSON['stringify'](_0x202998));_0x41ba01(_0x202998);})[_0xf3ab('0x14')](function(_0x204102){logger[_0xf3ab('0x11')]('CreateVoiceDialReport',_0x204102[_0xf3ab('0x12')],_0x46e71b);_0x42e5bf(_0x35a925['error'](0x1f4,_0x204102[_0xf3ab('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x152e39){var _0x39ea4e=this;return new Promise(function(_0x3aada1,_0x5bf6a9){return db[_0xf3ab('0x15')][_0xf3ab('0x19')](_0x152e39[_0xf3ab('0x1a')],{'raw':_0x152e39[_0xf3ab('0x17')]?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152e39[_0xf3ab('0x17')]?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1c')]||null:null,'attributes':_0x152e39['options']?_0x152e39[_0xf3ab('0x17')][_0xf3ab('0x1d')]||null:null,'limit':_0x152e39['options']?_0x152e39['options'][_0xf3ab('0x1e')]||null:null})[_0xf3ab('0xa')](function(_0x29ee6c){logger[_0xf3ab('0xb')](_0xf3ab('0x1f'),_0x152e39);logger[_0xf3ab('0xd')](_0xf3ab('0x1f'),_0x152e39,JSON['stringify'](_0x29ee6c));_0x3aada1(_0x29ee6c);})[_0xf3ab('0x14')](function(_0x203bd5){logger[_0xf3ab('0x11')]('UpdateVoiceDialReport',_0x203bd5[_0xf3ab('0x12')],_0x152e39);_0x5bf6a9(_0x39ea4e[_0xf3ab('0x11')](0x1f4,_0x203bd5[_0xf3ab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index fae0c45..a5e179c 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 _0x258e=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update','delete','exports','multer'];(function(_0x366d9a,_0x334f38){var _0x258ed5=function(_0x3a5cf2){while(--_0x3a5cf2){_0x366d9a['push'](_0x366d9a['shift']());}};_0x258ed5(++_0x334f38);}(_0x258e,0x107));var _0xe258=function(_0x5f071d,_0x18471b){_0x5f071d=_0x5f071d-0x0;var _0x5ec7f5=_0x258e[_0x5f071d];return _0x5ec7f5;};'use strict';var multer=require(_0xe258('0x0'));var util=require(_0xe258('0x1'));var path=require('path');var timeout=require(_0xe258('0x2'));var express=require(_0xe258('0x3'));var router=express[_0xe258('0x4')]();var fs_extra=require(_0xe258('0x5'));var auth=require(_0xe258('0x6'));var interaction=require(_0xe258('0x7'));var config=require(_0xe258('0x8'));var controller=require(_0xe258('0x9'));router[_0xe258('0xa')]('/',auth[_0xe258('0xb')](),controller[_0xe258('0xc')]);router[_0xe258('0xa')](_0xe258('0xd'),auth['isAuthenticated'](),controller[_0xe258('0xe')]);router[_0xe258('0xf')]('/',auth[_0xe258('0xb')](),controller[_0xe258('0x10')]);router[_0xe258('0xf')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe258('0x11')]);router[_0xe258('0x12')](_0xe258('0xd'),auth[_0xe258('0xb')](),controller[_0xe258('0x13')]);router[_0xe258('0x14')](_0xe258('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe258('0x15')]=router; \ No newline at end of file +var _0x2f53=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x32eb5f,_0x1b4725){var _0x4f95d2=function(_0x324fb6){while(--_0x324fb6){_0x32eb5f['push'](_0x32eb5f['shift']());}};_0x4f95d2(++_0x1b4725);}(_0x2f53,0xb7));var _0x32f5=function(_0x34645a,_0xa23bd1){_0x34645a=_0x34645a-0x0;var _0x3c28e2=_0x2f53[_0x34645a];return _0x3c28e2;};'use strict';var multer=require(_0x32f5('0x0'));var util=require(_0x32f5('0x1'));var path=require('path');var timeout=require(_0x32f5('0x2'));var express=require(_0x32f5('0x3'));var router=express[_0x32f5('0x4')]();var fs_extra=require(_0x32f5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32f5('0x6'));var controller=require(_0x32f5('0x7'));router[_0x32f5('0x8')]('/',auth[_0x32f5('0x9')](),controller[_0x32f5('0xa')]);router[_0x32f5('0x8')](_0x32f5('0xb'),auth[_0x32f5('0x9')](),controller[_0x32f5('0xc')]);router[_0x32f5('0xd')]('/',auth[_0x32f5('0x9')](),controller[_0x32f5('0xe')]);router[_0x32f5('0xd')](_0x32f5('0xf'),auth[_0x32f5('0x9')](),controller[_0x32f5('0x10')]);router[_0x32f5('0x11')](_0x32f5('0xb'),auth['isAuthenticated'](),controller[_0x32f5('0x12')]);router[_0x32f5('0x13')](_0x32f5('0xb'),auth['isAuthenticated'](),controller[_0x32f5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 56a5cbc..f603b67 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 _0xdc35=['wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal','outbound-fax','system','*,*,*,*','BOOLEAN','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc35,0x9d));var _0x5dc3=function(_0x573187,_0x2f5c3d){_0x573187=_0x573187-0x0;var _0x4c0f69=_0xdc35[_0x573187];return _0x4c0f69;};'use strict';var Sequelize=require(_0x5dc3('0x0'));module[_0x5dc3('0x1')]={'context':{'type':Sequelize[_0x5dc3('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5dc3('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x5dc3('0x3')},'tag':{'type':Sequelize[_0x5dc3('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5dc3('0x2')],'allowNull':![],'defaultValue':_0x5dc3('0x4')},'appdata':{'type':Sequelize[_0x5dc3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5dc3('0x5')](_0x5dc3('0x6'),'outbound',_0x5dc3('0x7'),'inbound-fax',_0x5dc3('0x8'),_0x5dc3('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x5dc3('0x2')]},'interval':{'type':Sequelize[_0x5dc3('0x2')],'allowNull':![],'defaultValue':_0x5dc3('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x5dc3('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x5dc3('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x5dc3('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5dc3('0xc')]},'recordingFormat':{'type':Sequelize[_0x5dc3('0x2')],'defaultValue':_0x5dc3('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x5dc3('0xe')],'get':function(_0x28df2f){return this[_0x5dc3('0xf')](_0x5dc3('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x874b=['BOOLEAN','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x3f4a13,_0x5dff9){var _0x52ee29=function(_0x3da011){while(--_0x3da011){_0x3f4a13['push'](_0x3f4a13['shift']());}};_0x52ee29(++_0x5dff9);}(_0x874b,0x100));var _0xb874=function(_0x4e5ff7,_0x1c555f){_0x4e5ff7=_0x4e5ff7-0x0;var _0xd3aec=_0x874b[_0x4e5ff7];return _0xd3aec;};'use strict';var Sequelize=require('sequelize');module[_0xb874('0x0')]={'context':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'unique':_0xb874('0x2')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xb874('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'defaultValue':_0xb874('0x3')},'appdata':{'type':Sequelize[_0xb874('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb874('0x4')](_0xb874('0x5'),_0xb874('0x6'),_0xb874('0x7'),_0xb874('0x8'),_0xb874('0x9'),_0xb874('0xa'),_0xb874('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xb874('0x1')]},'interval':{'type':Sequelize[_0xb874('0x1')],'allowNull':![],'defaultValue':_0xb874('0xc')},'IntervalId':{'type':Sequelize[_0xb874('0xd')]},'isApp':{'type':Sequelize[_0xb874('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xb874('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb874('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb874('0xf')},'answer':{'type':Sequelize[_0xb874('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb874('0x10')],'get':function(_0x1fc1a3){return this['getDataValue'](_0xb874('0x11'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 824e877..85d211e 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 _0x08d4=['context','description','recordingFormat','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','params','keys','includeAll','catch','create','outbound','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x08d4,0x1ea));var _0x408d=function(_0x3d57bd,_0x46431c){_0x3d57bd=_0x3d57bd-0x0;var _0x301a7e=_0x08d4[_0x3d57bd];return _0x301a7e;};'use strict';var _=require(_0x408d('0x0'));var Redis=require(_0x408d('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x408d('0x2'))('api');var config=require(_0x408d('0x3'));var db=require(_0x408d('0x4'))['db'];config[_0x408d('0x5')]=_[_0x408d('0x6')](config['redis'],{'host':_0x408d('0x7'),'port':0x18eb});var socket=require(_0x408d('0x8'))(new Redis(config[_0x408d('0x5')]));require(_0x408d('0x9'))[_0x408d('0xa')](socket);function respondWithStatusCode(_0x2149d6,_0x1a91c6){_0x1a91c6=_0x1a91c6||0xcc;return function(_0x1a8a77){if(_0x1a8a77){return _0x2149d6[_0x408d('0xb')](_0x1a91c6);}return _0x2149d6['status'](_0x1a91c6)[_0x408d('0xc')]();};}function respondWithResult(_0x36d196,_0x2e7ba2){_0x2e7ba2=_0x2e7ba2||0xc8;return function(_0xf8215f){if(_0xf8215f){return _0x36d196[_0x408d('0xd')](_0x2e7ba2)[_0x408d('0xe')](_0xf8215f);}};}function respondWithFilteredResult(_0x123fda,_0x293455){return function(_0x1ebcc3){if(_0x1ebcc3){var _0x3e556c=typeof _0x293455[_0x408d('0xf')]===_0x408d('0x10')&&typeof _0x293455[_0x408d('0x11')]==='undefined';var _0x348c65=_0x1ebcc3[_0x408d('0x12')];var _0x3951f3=_0x3e556c?0x0:_0x293455[_0x408d('0xf')];var _0x129c57=_0x3e556c?_0x1ebcc3[_0x408d('0x12')]:_0x293455[_0x408d('0xf')]+_0x293455['limit'];var _0x52dd20;if(_0x129c57>=_0x348c65){_0x129c57=_0x348c65;_0x52dd20=0xc8;}else{_0x52dd20=0xce;}_0x123fda[_0x408d('0xd')](_0x52dd20);return _0x123fda['set'](_0x408d('0x13'),_0x3951f3+'-'+_0x129c57+'/'+_0x348c65)[_0x408d('0xe')](_0x1ebcc3);}return null;};}function removeEntity(_0x58aea7){return function(_0x313db7){if(_0x313db7){return _0x313db7['destroy']()['then'](function(){var _0x274129=_0x313db7[_0x408d('0x14')]({'plain':!![]});var _0xe6d3d3=[{'name':_0x408d('0x15'),'value':_0x408d('0x16'),'ignore':![]},{'name':_0x408d('0x17'),'value':'outbound','ignore':![]},{'name':_0x408d('0x18'),'value':_0x408d('0x19'),'ignore':![]}];var _0x285689=_(_0xe6d3d3)[_0x408d('0x1a')](_0x408d('0x1b'))[_0x408d('0x1c')]('value')[_0x408d('0x1d')]();if(_[_0x408d('0x1e')](_0x285689,_0x274129[_0x408d('0x1f')])){return;}var _0x2b2ce2=_[_0x408d('0x20')](_0xe6d3d3,[_0x408d('0x1d'),_0x274129['type']])['name'];return db[_0x408d('0x21')][_0x408d('0x22')]({'where':{'type':_0x2b2ce2,'resourceId':_0x274129['id']}})[_0x408d('0x23')](function(){return _0x313db7;});})[_0x408d('0x23')](function(){_0x58aea7[_0x408d('0xd')](0xcc)[_0x408d('0xc')]();});}};}function handleEntityNotFound(_0x54b5c1){return function(_0x1d60df){if(!_0x1d60df){_0x54b5c1[_0x408d('0xb')](0x194);}return _0x1d60df;};}function handleError(_0x1ba7ad,_0x32ad22){_0x32ad22=_0x32ad22||0x1f4;return function(_0x214a2d){logger[_0x408d('0x24')](_0x214a2d[_0x408d('0x25')]);if(_0x214a2d[_0x408d('0x26')]){delete _0x214a2d[_0x408d('0x26')];}_0x1ba7ad[_0x408d('0xd')](_0x32ad22)[_0x408d('0x27')](_0x214a2d);};}exports[_0x408d('0x28')]=function(_0x5173fc,_0xfc230d){var _0x2e9ab9={},_0x3dcac1={},_0x413016={'count':0x0,'rows':[]};var _0x3d5ba8=_[_0x408d('0x1c')](db['VoiceExtension'][_0x408d('0x29')],function(_0x1f03bf){return{'name':_0x1f03bf[_0x408d('0x2a')],'type':_0x1f03bf['type'][_0x408d('0x2b')]};});_0x3dcac1['model']=_[_0x408d('0x1c')](_0x3d5ba8,_0x408d('0x26'));_0x3dcac1['query']=_['keys'](_0x5173fc[_0x408d('0x2c')]);_0x3dcac1['filters']=_[_0x408d('0x2d')](_0x3dcac1[_0x408d('0x2e')],_0x3dcac1['query']);_0x2e9ab9[_0x408d('0x2f')]=_[_0x408d('0x2d')](_0x3dcac1[_0x408d('0x2e')],qs[_0x408d('0x30')](_0x5173fc[_0x408d('0x2c')][_0x408d('0x30')]));_0x2e9ab9[_0x408d('0x2f')]=_0x2e9ab9['attributes'][_0x408d('0x31')]?_0x2e9ab9[_0x408d('0x2f')]:_0x3dcac1[_0x408d('0x2e')];if(!_0x5173fc[_0x408d('0x2c')][_0x408d('0x32')]('nolimit')){_0x2e9ab9[_0x408d('0x11')]=qs['limit'](_0x5173fc['query']['limit']);_0x2e9ab9[_0x408d('0xf')]=qs[_0x408d('0xf')](_0x5173fc[_0x408d('0x2c')][_0x408d('0xf')]);}_0x2e9ab9[_0x408d('0x33')]=qs['sort'](_0x5173fc['query'][_0x408d('0x34')]);_0x2e9ab9[_0x408d('0x35')]=qs[_0x408d('0x36')](_[_0x408d('0x37')](_0x5173fc[_0x408d('0x2c')],_0x3dcac1[_0x408d('0x36')]),_0x3d5ba8);if(_0x5173fc['query'][_0x408d('0x1a')]){_0x2e9ab9[_0x408d('0x35')]=_[_0x408d('0x38')](_0x2e9ab9[_0x408d('0x35')],{'$or':_['map'](_0x3d5ba8,function(_0x4cb2cd){if(_0x4cb2cd[_0x408d('0x1f')]!==_0x408d('0x39')){var _0x2ee8bb={};_0x2ee8bb[_0x4cb2cd[_0x408d('0x26')]]={'$like':'%'+_0x5173fc['query']['filter']+'%'};return _0x2ee8bb;}})});}_0x2e9ab9=_[_0x408d('0x38')]({},_0x2e9ab9,_0x5173fc[_0x408d('0x3a')]);var _0xe0f29a={'where':_0x2e9ab9[_0x408d('0x35')]};return db[_0x408d('0x3b')]['count'](_0xe0f29a)['then'](function(_0x517f0c){_0x413016[_0x408d('0x12')]=_0x517f0c;if(_0x5173fc[_0x408d('0x2c')]['includeAll']){_0x2e9ab9[_0x408d('0x3c')]=[{'all':!![]}];}return db[_0x408d('0x3b')][_0x408d('0x3d')](_0x2e9ab9);})[_0x408d('0x23')](function(_0x238ff2){_0x413016[_0x408d('0x3e')]=_0x238ff2;return _0x413016;})[_0x408d('0x23')](respondWithFilteredResult(_0xfc230d,_0x2e9ab9))['catch'](handleError(_0xfc230d,null));};exports['show']=function(_0xd12552,_0x292610){var _0x363e72={'raw':![],'where':{'id':_0xd12552[_0x408d('0x3f')]['id']}},_0x3bcaf9={};_0x3bcaf9[_0x408d('0x2e')]=_[_0x408d('0x40')](db[_0x408d('0x3b')][_0x408d('0x29')]);_0x3bcaf9['query']=_[_0x408d('0x40')](_0xd12552[_0x408d('0x2c')]);_0x3bcaf9[_0x408d('0x36')]=_['intersection'](_0x3bcaf9['model'],_0x3bcaf9[_0x408d('0x2c')]);_0x363e72[_0x408d('0x2f')]=_[_0x408d('0x2d')](_0x3bcaf9['model'],qs['fields'](_0xd12552['query'][_0x408d('0x30')]));_0x363e72[_0x408d('0x2f')]=_0x363e72[_0x408d('0x2f')]['length']?_0x363e72[_0x408d('0x2f')]:_0x3bcaf9[_0x408d('0x2e')];if(_0xd12552['query'][_0x408d('0x41')]){_0x363e72[_0x408d('0x3c')]=[{'all':!![]}];}_0x363e72=_['merge']({},_0x363e72,_0xd12552[_0x408d('0x3a')]);return db[_0x408d('0x3b')]['find'](_0x363e72)['then'](handleEntityNotFound(_0x292610,null))[_0x408d('0x23')](respondWithResult(_0x292610,null))[_0x408d('0x42')](handleError(_0x292610,null));};exports[_0x408d('0x22')]=function(_0x49a539,_0x37903d){return db['VoiceExtension'][_0x408d('0x20')]({'where':{'id':_0x49a539['params']['id']}})[_0x408d('0x23')](handleEntityNotFound(_0x37903d,null))[_0x408d('0x23')](removeEntity(_0x37903d,null))[_0x408d('0x42')](handleError(_0x37903d,null));};exports[_0x408d('0x43')]=function(_0xf1df72,_0x1846ae){if(_0xf1df72['body'][_0x408d('0x1f')]===_0x408d('0x44')&&!_['startsWith'](_0xf1df72[_0x408d('0x45')][_0x408d('0x46')],'_')){_0xf1df72[_0x408d('0x45')][_0x408d('0x46')]='_'[_0x408d('0x47')](_0xf1df72[_0x408d('0x45')][_0x408d('0x46')]);}return db[_0x408d('0x3b')]['create'](_0xf1df72[_0x408d('0x45')],{'raw':![]})[_0x408d('0x23')](function(_0xfbb4b1){var _0x5448ba=_0xf1df72[_0x408d('0x48')][_0x408d('0x14')]({'plain':!![]});if(!_0x5448ba)throw new Error(_0x408d('0x49'));if(_0x5448ba[_0x408d('0x4a')]===_0x408d('0x48')){var _0x5a8708=_0xfbb4b1[_0x408d('0x14')]({'plain':!![]});var _0x85e9ec=[{'name':_0x408d('0x15'),'value':'inbound'},{'name':_0x408d('0x17'),'value':_0x408d('0x44')},{'name':_0x408d('0x18'),'value':_0x408d('0x19')}];var _0x20e322=_[_0x408d('0x20')](_0x85e9ec,[_0x408d('0x1d'),_0x5a8708[_0x408d('0x1f')]])[_0x408d('0x26')];return db[_0x408d('0x4b')][_0x408d('0x20')]({'where':{'name':_0x20e322,'userProfileId':_0x5448ba[_0x408d('0x4c')]},'raw':!![]})[_0x408d('0x23')](function(_0x199c7f){if(_0x199c7f&&_0x199c7f[_0x408d('0x4d')]===0x0){return db['UserProfileResource'][_0x408d('0x43')]({'name':_0x5a8708[_0x408d('0x26')],'resourceId':_0x5a8708['id'],'type':_0x199c7f[_0x408d('0x26')],'sectionId':_0x199c7f['id']},{})[_0x408d('0x23')](function(){return _0xfbb4b1;});}else{return _0xfbb4b1;}})[_0x408d('0x42')](function(_0x5e9cf9){logger[_0x408d('0x24')](_0x408d('0x4e'),_0x5e9cf9);throw _0x5e9cf9;});}return _0xfbb4b1;})[_0x408d('0x23')](respondWithResult(_0x1846ae,0xc9))['catch'](handleError(_0x1846ae,null));};exports[_0x408d('0x4f')]=function(_0x51b629,_0x55fb0d){if(_0x51b629[_0x408d('0x45')]['id']){delete _0x51b629[_0x408d('0x45')]['id'];}return db[_0x408d('0x3b')][_0x408d('0x20')]({'where':{'id':_0x51b629[_0x408d('0x3f')]['id']}})[_0x408d('0x23')](handleEntityNotFound(_0x55fb0d,null))[_0x408d('0x23')](function(_0x4e0d6b){if(_0x4e0d6b){return db[_0x408d('0x3b')][_0x408d('0x4f')](_[_0x408d('0x37')](_0x51b629['body'],['exten',_0x408d('0x50'),_0x408d('0x51'),_0x408d('0x52'),'cutdigits','mandatoryDisposition',_0x408d('0x53')]),{'where':{'context':_0x4e0d6b[_0x408d('0x50')],'exten':_0x4e0d6b[_0x408d('0x46')]},'individualHooks':!![]})[_0x408d('0x23')](function(_0x455450){return _0x455450;});}return null;})[_0x408d('0x23')](respondWithStatusCode(_0x55fb0d,null))[_0x408d('0x42')](handleError(_0x55fb0d,null));};exports[_0x408d('0x54')]=function(_0x326c6b,_0x144d2a){var _0x46763e=_0x326c6b[_0x408d('0x3f')]['id'];var _0x34bb72=_0x326c6b[_0x408d('0x45')];var _0xde67f5=0xc8;var _0x8617e6=null;return db[_0x408d('0x55')][_0x408d('0x56')]({'isolationLevel':db[_0x408d('0x55')][_0x408d('0x57')][_0x408d('0x58')]['READ_COMMITTED']},function(_0x531aba){return db[_0x408d('0x3b')][_0x408d('0x59')]({'where':{'id':_0x46763e},'transaction':_0x531aba})[_0x408d('0x23')](function(_0x1ed778){if(_0x1ed778){return db[_0x408d('0x3b')]['destroy']({'where':{'VoiceExtensionId':_0x46763e},'transaction':_0x531aba})['then'](function(){var _0x139c46=_[_0x408d('0x1c')](_0x34bb72,function(_0x3a7f06){_0x3a7f06[_0x408d('0x5a')]=_0x46763e;_0x3a7f06['isApp']=!![];return _0x3a7f06;});return _0x1ed778[_0x408d('0x5b')](_0x139c46);})[_0x408d('0x23')](function(_0x3900cc){return db[_0x408d('0x3b')][_0x408d('0x5c')](_0x3900cc,{'transaction':_0x531aba});});}else{_0xde67f5=0x194;_0x8617e6=[];}});})[_0x408d('0x23')](function(){if(_0xde67f5!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x46763e},'order':_0x408d('0x5d')})[_0x408d('0x23')](function(_0x72c970){_0x8617e6=_0x72c970;});}})[_0x408d('0x42')](function(_0x368ef6){_0xde67f5=0x1f4;logger[_0x408d('0x24')](_0x368ef6[_0x408d('0x25')]);if(_0x368ef6[_0x408d('0x26')]){delete _0x368ef6[_0x408d('0x26')];}_0x8617e6=_0x368ef6;})[_0x408d('0x5e')](function(){if(_0x8617e6===null){_0x144d2a[_0x408d('0xb')](_0xde67f5);}else{if(_0xde67f5===0x1f4){_0x144d2a[_0x408d('0xd')](_0xde67f5)[_0x408d('0x27')](_0x8617e6);}else{_0x144d2a[_0x408d('0xd')](_0xde67f5)[_0x408d('0xe')](_0x8617e6);}}});}; \ No newline at end of file +var _0x614d=['stack','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','startsWith','exten','user','get','InboundRoutes','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../components/parsers/qs','../../config/logger','api','redis','./voiceExtension.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','UserProfileResource','error'];(function(_0x4009fa,_0x3a54a7){var _0xcfb041=function(_0xe7e7a7){while(--_0xe7e7a7){_0x4009fa['push'](_0x4009fa['shift']());}};_0xcfb041(++_0x3a54a7);}(_0x614d,0x95));var _0xd614=function(_0x53c87f,_0x5a8c39){_0x53c87f=_0x53c87f-0x0;var _0x6e934a=_0x614d[_0x53c87f];return _0x6e934a;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xd614('0x0'));var logger=require(_0xd614('0x1'))(_0xd614('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd614('0x3')]=_['defaults'](config[_0xd614('0x3')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd614('0x4'))[_0xd614('0x5')](socket);function respondWithStatusCode(_0x50f0d1,_0x3d4d52){_0x3d4d52=_0x3d4d52||0xcc;return function(_0x3a7c18){if(_0x3a7c18){return _0x50f0d1['sendStatus'](_0x3d4d52);}return _0x50f0d1[_0xd614('0x6')](_0x3d4d52)[_0xd614('0x7')]();};}function respondWithResult(_0x59412e,_0x988ee2){_0x988ee2=_0x988ee2||0xc8;return function(_0x20894c){if(_0x20894c){return _0x59412e[_0xd614('0x6')](_0x988ee2)[_0xd614('0x8')](_0x20894c);}};}function respondWithFilteredResult(_0x3f7d49,_0x598db8){return function(_0x23a9c5){if(_0x23a9c5){var _0x469da5=typeof _0x598db8[_0xd614('0x9')]==='undefined'&&typeof _0x598db8[_0xd614('0xa')]===_0xd614('0xb');var _0x455e98=_0x23a9c5['count'];var _0x120185=_0x469da5?0x0:_0x598db8[_0xd614('0x9')];var _0x4a4ef0=_0x469da5?_0x23a9c5[_0xd614('0xc')]:_0x598db8[_0xd614('0x9')]+_0x598db8[_0xd614('0xa')];var _0x193534;if(_0x4a4ef0>=_0x455e98){_0x4a4ef0=_0x455e98;_0x193534=0xc8;}else{_0x193534=0xce;}_0x3f7d49[_0xd614('0x6')](_0x193534);return _0x3f7d49[_0xd614('0xd')](_0xd614('0xe'),_0x120185+'-'+_0x4a4ef0+'/'+_0x455e98)[_0xd614('0x8')](_0x23a9c5);}return null;};}function removeEntity(_0x474506){return function(_0x16ab45){if(_0x16ab45){return _0x16ab45[_0xd614('0xf')]()[_0xd614('0x10')](function(){var _0x121429=_0x16ab45['get']({'plain':!![]});var _0x2db0a6=[{'name':'InboundRoutes','value':_0xd614('0x11'),'ignore':![]},{'name':_0xd614('0x12'),'value':_0xd614('0x13'),'ignore':![]},{'name':_0xd614('0x14'),'value':'internal','ignore':![]}];var _0x574cea=_(_0x2db0a6)[_0xd614('0x15')](_0xd614('0x16'))[_0xd614('0x17')](_0xd614('0x18'))['value']();if(_[_0xd614('0x19')](_0x574cea,_0x121429[_0xd614('0x1a')])){return;}var _0x435bff=_['find'](_0x2db0a6,[_0xd614('0x18'),_0x121429[_0xd614('0x1a')]])['name'];return db[_0xd614('0x1b')][_0xd614('0xf')]({'where':{'type':_0x435bff,'resourceId':_0x121429['id']}})[_0xd614('0x10')](function(){return _0x16ab45;});})[_0xd614('0x10')](function(){_0x474506['status'](0xcc)[_0xd614('0x7')]();});}};}function handleEntityNotFound(_0x401296){return function(_0x38cb0c){if(!_0x38cb0c){_0x401296['sendStatus'](0x194);}return _0x38cb0c;};}function handleError(_0x545e8f,_0x549e81){_0x549e81=_0x549e81||0x1f4;return function(_0x488c91){logger[_0xd614('0x1c')](_0x488c91[_0xd614('0x1d')]);if(_0x488c91[_0xd614('0x1e')]){delete _0x488c91[_0xd614('0x1e')];}_0x545e8f[_0xd614('0x6')](_0x549e81)[_0xd614('0x1f')](_0x488c91);};}exports['index']=function(_0x43df89,_0xa0b047){var _0x4dda94={},_0x3f4b75={},_0x5a0929={'count':0x0,'rows':[]};var _0x589313=_[_0xd614('0x17')](db[_0xd614('0x20')][_0xd614('0x21')],function(_0x37952d){return{'name':_0x37952d[_0xd614('0x22')],'type':_0x37952d[_0xd614('0x1a')][_0xd614('0x23')]};});_0x3f4b75[_0xd614('0x24')]=_['map'](_0x589313,_0xd614('0x1e'));_0x3f4b75[_0xd614('0x25')]=_[_0xd614('0x26')](_0x43df89[_0xd614('0x25')]);_0x3f4b75[_0xd614('0x27')]=_[_0xd614('0x28')](_0x3f4b75[_0xd614('0x24')],_0x3f4b75[_0xd614('0x25')]);_0x4dda94[_0xd614('0x29')]=_['intersection'](_0x3f4b75[_0xd614('0x24')],qs[_0xd614('0x2a')](_0x43df89['query'][_0xd614('0x2a')]));_0x4dda94[_0xd614('0x29')]=_0x4dda94[_0xd614('0x29')][_0xd614('0x2b')]?_0x4dda94['attributes']:_0x3f4b75['model'];if(!_0x43df89[_0xd614('0x25')]['hasOwnProperty'](_0xd614('0x2c'))){_0x4dda94['limit']=qs[_0xd614('0xa')](_0x43df89[_0xd614('0x25')][_0xd614('0xa')]);_0x4dda94[_0xd614('0x9')]=qs[_0xd614('0x9')](_0x43df89[_0xd614('0x25')][_0xd614('0x9')]);}_0x4dda94[_0xd614('0x2d')]=qs[_0xd614('0x2e')](_0x43df89[_0xd614('0x25')][_0xd614('0x2e')]);_0x4dda94[_0xd614('0x2f')]=qs[_0xd614('0x27')](_[_0xd614('0x30')](_0x43df89[_0xd614('0x25')],_0x3f4b75[_0xd614('0x27')]),_0x589313);if(_0x43df89[_0xd614('0x25')][_0xd614('0x15')]){_0x4dda94['where']=_[_0xd614('0x31')](_0x4dda94[_0xd614('0x2f')],{'$or':_[_0xd614('0x17')](_0x589313,function(_0x5bf6da){if(_0x5bf6da[_0xd614('0x1a')]!==_0xd614('0x32')){var _0x391d20={};_0x391d20[_0x5bf6da[_0xd614('0x1e')]]={'$like':'%'+_0x43df89[_0xd614('0x25')][_0xd614('0x15')]+'%'};return _0x391d20;}})});}_0x4dda94=_[_0xd614('0x31')]({},_0x4dda94,_0x43df89[_0xd614('0x33')]);var _0x15fa6f={'where':_0x4dda94[_0xd614('0x2f')]};return db[_0xd614('0x20')][_0xd614('0xc')](_0x15fa6f)[_0xd614('0x10')](function(_0x232b2f){_0x5a0929['count']=_0x232b2f;if(_0x43df89[_0xd614('0x25')][_0xd614('0x34')]){_0x4dda94[_0xd614('0x35')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd614('0x36')](_0x4dda94);})[_0xd614('0x10')](function(_0x4a66b2){_0x5a0929[_0xd614('0x37')]=_0x4a66b2;return _0x5a0929;})[_0xd614('0x10')](respondWithFilteredResult(_0xa0b047,_0x4dda94))['catch'](handleError(_0xa0b047,null));};exports[_0xd614('0x38')]=function(_0x59239d,_0x5e4d45){var _0x193217={'raw':![],'where':{'id':_0x59239d[_0xd614('0x39')]['id']}},_0x4fa5c0={};_0x4fa5c0[_0xd614('0x24')]=_['keys'](db[_0xd614('0x20')][_0xd614('0x21')]);_0x4fa5c0[_0xd614('0x25')]=_['keys'](_0x59239d[_0xd614('0x25')]);_0x4fa5c0[_0xd614('0x27')]=_[_0xd614('0x28')](_0x4fa5c0[_0xd614('0x24')],_0x4fa5c0[_0xd614('0x25')]);_0x193217[_0xd614('0x29')]=_['intersection'](_0x4fa5c0[_0xd614('0x24')],qs[_0xd614('0x2a')](_0x59239d[_0xd614('0x25')][_0xd614('0x2a')]));_0x193217['attributes']=_0x193217[_0xd614('0x29')]['length']?_0x193217[_0xd614('0x29')]:_0x4fa5c0[_0xd614('0x24')];if(_0x59239d[_0xd614('0x25')][_0xd614('0x34')]){_0x193217[_0xd614('0x35')]=[{'all':!![]}];}_0x193217=_['merge']({},_0x193217,_0x59239d[_0xd614('0x33')]);return db[_0xd614('0x20')][_0xd614('0x3a')](_0x193217)[_0xd614('0x10')](handleEntityNotFound(_0x5e4d45,null))['then'](respondWithResult(_0x5e4d45,null))[_0xd614('0x3b')](handleError(_0x5e4d45,null));};exports[_0xd614('0xf')]=function(_0x500de6,_0x439a12){return db['VoiceExtension'][_0xd614('0x3a')]({'where':{'id':_0x500de6[_0xd614('0x39')]['id']}})[_0xd614('0x10')](handleEntityNotFound(_0x439a12,null))[_0xd614('0x10')](removeEntity(_0x439a12,null))[_0xd614('0x3b')](handleError(_0x439a12,null));};exports[_0xd614('0x3c')]=function(_0x23345c,_0x8a168e){if(_0x23345c[_0xd614('0x3d')][_0xd614('0x1a')]===_0xd614('0x13')&&!_[_0xd614('0x3e')](_0x23345c[_0xd614('0x3d')][_0xd614('0x3f')],'_')){_0x23345c[_0xd614('0x3d')][_0xd614('0x3f')]='_'['concat'](_0x23345c[_0xd614('0x3d')]['exten']);}return db[_0xd614('0x20')][_0xd614('0x3c')](_0x23345c[_0xd614('0x3d')],{'raw':![]})[_0xd614('0x10')](function(_0x198b1b){var _0x3b6326=_0x23345c[_0xd614('0x40')][_0xd614('0x41')]({'plain':!![]});if(!_0x3b6326)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b6326['role']===_0xd614('0x40')){var _0x127861=_0x198b1b[_0xd614('0x41')]({'plain':!![]});var _0x19a70e=[{'name':_0xd614('0x42'),'value':_0xd614('0x11')},{'name':'OutboundRoutes','value':_0xd614('0x13')},{'name':'InternalRoutes','value':_0xd614('0x43')}];var _0x7853d6=_['find'](_0x19a70e,[_0xd614('0x18'),_0x127861[_0xd614('0x1a')]])[_0xd614('0x1e')];return db['UserProfileSection'][_0xd614('0x3a')]({'where':{'name':_0x7853d6,'userProfileId':_0x3b6326[_0xd614('0x44')]},'raw':!![]})['then'](function(_0x4359ff){if(_0x4359ff&&_0x4359ff[_0xd614('0x45')]===0x0){return db[_0xd614('0x1b')][_0xd614('0x3c')]({'name':_0x127861[_0xd614('0x1e')],'resourceId':_0x127861['id'],'type':_0x4359ff[_0xd614('0x1e')],'sectionId':_0x4359ff['id']},{})[_0xd614('0x10')](function(){return _0x198b1b;});}else{return _0x198b1b;}})['catch'](function(_0x31a591){logger['error'](_0xd614('0x46'),_0x31a591);throw _0x31a591;});}return _0x198b1b;})['then'](respondWithResult(_0x8a168e,0xc9))[_0xd614('0x3b')](handleError(_0x8a168e,null));};exports[_0xd614('0x47')]=function(_0x533ac1,_0x14148f){if(_0x533ac1[_0xd614('0x3d')]['id']){delete _0x533ac1[_0xd614('0x3d')]['id'];}return db[_0xd614('0x20')][_0xd614('0x3a')]({'where':{'id':_0x533ac1[_0xd614('0x39')]['id']}})[_0xd614('0x10')](handleEntityNotFound(_0x14148f,null))[_0xd614('0x10')](function(_0xa93581){if(_0xa93581){return db['VoiceExtension'][_0xd614('0x47')](_[_0xd614('0x30')](_0x533ac1[_0xd614('0x3d')],[_0xd614('0x3f'),_0xd614('0x48'),_0xd614('0x49'),_0xd614('0x4a'),'cutdigits',_0xd614('0x4b'),_0xd614('0x4c')]),{'where':{'context':_0xa93581[_0xd614('0x48')],'exten':_0xa93581['exten']},'individualHooks':!![]})[_0xd614('0x10')](function(_0x4c57c5){return _0x4c57c5;});}return null;})[_0xd614('0x10')](respondWithStatusCode(_0x14148f,null))[_0xd614('0x3b')](handleError(_0x14148f,null));};exports[_0xd614('0x4d')]=function(_0x1bce8b,_0x52b2b1){var _0x5c307c=_0x1bce8b[_0xd614('0x39')]['id'];var _0x27dd1d=_0x1bce8b[_0xd614('0x3d')];var _0x52c610=0xc8;var _0x3560d6=null;return db[_0xd614('0x4e')][_0xd614('0x4f')]({'isolationLevel':db[_0xd614('0x4e')]['Transaction']['ISOLATION_LEVELS'][_0xd614('0x50')]},function(_0x310a61){return db['VoiceExtension'][_0xd614('0x51')]({'where':{'id':_0x5c307c},'transaction':_0x310a61})[_0xd614('0x10')](function(_0x3d282d){if(_0x3d282d){return db[_0xd614('0x20')][_0xd614('0xf')]({'where':{'VoiceExtensionId':_0x5c307c},'transaction':_0x310a61})['then'](function(){var _0x3e6398=_[_0xd614('0x17')](_0x27dd1d,function(_0x396c26){_0x396c26[_0xd614('0x52')]=_0x5c307c;_0x396c26[_0xd614('0x53')]=!![];return _0x396c26;});return _0x3d282d[_0xd614('0x54')](_0x3e6398);})[_0xd614('0x10')](function(_0x2aa34a){return db[_0xd614('0x20')][_0xd614('0x55')](_0x2aa34a,{'transaction':_0x310a61});});}else{_0x52c610=0x194;_0x3560d6=[];}});})[_0xd614('0x10')](function(){if(_0x52c610!==0x194){return db[_0xd614('0x20')][_0xd614('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5c307c},'order':_0xd614('0x57')})[_0xd614('0x10')](function(_0x14a471){_0x3560d6=_0x14a471;});}})['catch'](function(_0x16d8c0){_0x52c610=0x1f4;logger[_0xd614('0x1c')](_0x16d8c0[_0xd614('0x1d')]);if(_0x16d8c0['name']){delete _0x16d8c0[_0xd614('0x1e')];}_0x3560d6=_0x16d8c0;})[_0xd614('0x58')](function(){if(_0x3560d6===null){_0x52b2b1['sendStatus'](_0x52c610);}else{if(_0x52c610===0x1f4){_0x52b2b1[_0xd614('0x6')](_0x52c610)[_0xd614('0x1f')](_0x3560d6);}else{_0x52b2b1[_0xd614('0x6')](_0x52c610)[_0xd614('0x8')](_0x3560d6);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 33435c4..2651ce1 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 _0x3b09=['events','setMaxListeners','save','update','emit'];(function(_0x3acd90,_0x152d88){var _0x37da20=function(_0x6ab2a0){while(--_0x6ab2a0){_0x3acd90['push'](_0x3acd90['shift']());}};_0x37da20(++_0x152d88);}(_0x3b09,0x118));var _0x93b0=function(_0x51da74,_0xed04){_0x51da74=_0x51da74-0x0;var _0x58cbd7=_0x3b09[_0x51da74];return _0x58cbd7;};'use strict';var EventEmitter=require(_0x93b0('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x93b0('0x1')](0x0);var events={'afterCreate':_0x93b0('0x2'),'afterUpdate':_0x93b0('0x3'),'afterDestroy':'remove'};function emitEvent(_0x56b4a0){return function(_0x10f2e8,_0x356067,_0x37e4bc){VoiceExtensionEvents['emit'](_0x56b4a0+':'+_0x10f2e8['id'],_0x10f2e8);VoiceExtensionEvents[_0x93b0('0x4')](_0x56b4a0,_0x10f2e8);_0x37e4bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x3ec2=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x4e1211,_0x3babe2){var _0x2ffc28=function(_0x4febf4){while(--_0x4febf4){_0x4e1211['push'](_0x4e1211['shift']());}};_0x2ffc28(++_0x3babe2);}(_0x3ec2,0x177));var _0x23ec=function(_0x244a5f,_0x3652c3){_0x244a5f=_0x244a5f-0x0;var _0x115943=_0x3ec2[_0x244a5f];return _0x115943;};'use strict';var EventEmitter=require(_0x23ec('0x0'));var VoiceExtension=require(_0x23ec('0x1'))['db'][_0x23ec('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x23ec('0x3')](0x0);var events={'afterCreate':_0x23ec('0x4'),'afterUpdate':_0x23ec('0x5'),'afterDestroy':_0x23ec('0x6')};function emitEvent(_0x4d26cc){return function(_0xa4be59,_0x67f63d,_0x1ad767){VoiceExtensionEvents[_0x23ec('0x7')](_0x4d26cc+':'+_0xa4be59['id'],_0xa4be59);VoiceExtensionEvents[_0x23ec('0x7')](_0x4d26cc,_0xa4be59);_0x1ad767(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x23ec('0x8')](e,emitEvent(event));}}module[_0x23ec('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 1e81285..2606833 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 _0xe685=['push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','wav','trunk','timeout','options','url','split','length','name','phone','param','${EXTEN:','SIP','join','none','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','intervals','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','alias','NoOp','No\x20alias\x20set','exten','inbound','CDR(routeid)='];(function(_0x2390be,_0x30f806){var _0x581dfe=function(_0x102f17){while(--_0x102f17){_0x2390be['push'](_0x2390be['shift']());}};_0x581dfe(++_0x30f806);}(_0xe685,0xe0));var _0x5e68=function(_0x216a7a,_0x530b5c){_0x216a7a=_0x216a7a-0x0;var _0x2bd92a=_0xe685[_0x216a7a];return _0x2bd92a;};'use strict';var _=require('lodash');var attributes=require(_0x5e68('0x0'));module[_0x5e68('0x1')]=function(_0x1a6382){var _0x4173ff=_0x1a6382[_0x5e68('0x2')];function _0xd1426(_0x126247){var _0xb3a1d0=0x2;var _0x36653c=[{'type':_0x126247['type'],'app':_0x5e68('0x3'),'appdata':_0x5e68('0x4')+_0x126247[_0x5e68('0x5')],'context':_0x126247[_0x5e68('0x6')],'exten':_0x126247['exten'],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']},{'type':_0x126247[_0x5e68('0x5')],'app':_0x126247[_0x5e68('0x7')]?_0x5e68('0x3'):_0x5e68('0x8'),'appdata':_0x126247[_0x5e68('0x7')]?'CDR(routeAlias)='+_0x126247['alias']:_0x5e68('0x9'),'context':_0x126247[_0x5e68('0x6')],'exten':_0x126247[_0x5e68('0xa')],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']}];if(_0x126247[_0x5e68('0x5')]===_0x5e68('0xb')){_0x36653c['push']({'type':_0x5e68('0xb'),'app':_0x5e68('0x3'),'appdata':_0x5e68('0xc')+_0x126247['id'],'context':_0x126247[_0x5e68('0x6')],'exten':_0x126247['exten'],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']});}_0x36653c[_0x5e68('0xd')]({'type':_0x126247[_0x5e68('0x5')],'app':_0x5e68('0x3'),'appdata':_0x5e68('0xe'),'context':_0x126247[_0x5e68('0x6')],'exten':_0x126247[_0x5e68('0xa')],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']},{'type':_0x126247[_0x5e68('0x5')],'app':_0x5e68('0x3'),'appdata':_0x5e68('0xf'),'context':_0x126247['context'],'exten':_0x126247[_0x5e68('0xa')],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']},{'type':_0x126247[_0x5e68('0x5')],'app':'Set','appdata':_0x5e68('0x10'),'context':_0x126247['context'],'exten':_0x126247[_0x5e68('0xa')],'priority':_0xb3a1d0++,'VoiceExtensionId':_0x126247['id']});return _0x36653c;}function _0xd82104(_0x3e5bfb){var _0x3d29be=0x2;var _0x3c29a8=[{'type':_0x5e68('0x11'),'app':'Set','appdata':_0x5e68('0x12'),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x3e5bfb['alias']?_0x5e68('0x3'):'NoOp','appdata':_0x3e5bfb[_0x5e68('0x7')]?_0x5e68('0x13')+_0x3e5bfb[_0x5e68('0x7')]:_0x5e68('0x9'),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':'CDR(destination)='+(_0x3e5bfb[_0x5e68('0x14')]?'${EXTEN:'+_0x3e5bfb[_0x5e68('0x14')]+'}':_0x5e68('0x15')),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':'Set','appdata':_0x5e68('0xc')+_0x3e5bfb['id'],'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':'outbound','app':_0x5e68('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d29be+0x2)+_0x5e68('0x17')+(_0x3d29be+0x1)+')','context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':'outbound','app':_0x5e68('0x3'),'appdata':_0x3e5bfb[_0x5e68('0x14')]?_0x5e68('0x18')+_0x3e5bfb[_0x5e68('0x14')]+'}':_0x5e68('0x19'),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb['exten'],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':_0x5e68('0xe'),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb['exten'],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':_0x5e68('0x1a')+_0x3e5bfb['id'],'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']}];if(_0x3e5bfb[_0x5e68('0x1b')](_0x5e68('0x1c'))&&_0x3e5bfb[_0x5e68('0x1c')]!=='none'){_0x3c29a8[_0x5e68('0xd')]({'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']},{'type':_0x5e68('0x11'),'app':_0x5e68('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3e5bfb[_0x5e68('0x1c')]||_0x5e68('0x1d'),'context':_0x3e5bfb[_0x5e68('0x6')],'exten':_0x3e5bfb[_0x5e68('0xa')],'priority':_0x3d29be++,'VoiceExtensionId':_0x3e5bfb['id']});}return _0x3c29a8;}function _0x1e1e3d(_0x51d6ec,_0x18d08b){var _0x37a8ae=[{'name':_0x5e68('0x1e'),'param':0x0},{'name':_0x5e68('0x1f'),'param':0x1},{'name':_0x5e68('0x20'),'param':0x2},{'name':_0x5e68('0x21'),'param':0x3}];var _0x5c2dcf={};var _0x5db5d8=_0x18d08b[_0x5e68('0x22')](',');var _0x5a2116=[];for(var _0x21169d=0x0;_0x21169d<_0x37a8ae[_0x5e68('0x23')];_0x21169d++){switch(_0x37a8ae[_0x21169d][_0x5e68('0x24')]){case'trunk':_0x5c2dcf['trunk']=_0x5db5d8[_0x37a8ae[_0x21169d]['param']]['split']('/')[0x1];_0x5c2dcf[_0x5e68('0x25')]=_0x5db5d8[_0x37a8ae[_0x21169d][_0x5e68('0x26')]]['split']('/')[0x2];_0x5c2dcf['prefix']=_0x5c2dcf['phone']?_0x5c2dcf[_0x5e68('0x25')][_0x5e68('0x22')]('$')[0x0]:undefined;_0x5c2dcf[_0x5e68('0x25')]=_0x51d6ec[_0x5e68('0x14')]?(_0x5c2dcf['prefix']||'')+_0x5e68('0x27')+_0x51d6ec[_0x5e68('0x14')]+'}':(_0x5c2dcf['prefix']||'')+_0x5e68('0x15');_0x5a2116[_0x37a8ae[_0x21169d][_0x5e68('0x26')]]=[_0x5e68('0x28'),_0x5c2dcf['trunk'],_0x5c2dcf['phone']][_0x5e68('0x29')]('/');break;case _0x5e68('0x20'):_0x5c2dcf['options']=_0x5db5d8[_0x37a8ae[_0x21169d][_0x5e68('0x26')]];if(_0x51d6ec['recordingFormat']!==_0x5e68('0x2a')){if(_0x5c2dcf[_0x5e68('0x20')]['indexOf'](_0x5e68('0x2b'))<0x0){_0x5c2dcf[_0x5e68('0x20')]+=_0x5e68('0x2b');}}else{_0x5c2dcf[_0x5e68('0x20')]=_0x5c2dcf[_0x5e68('0x20')]['replace'](_0x5e68('0x2b'),'');}_0x5a2116[_0x37a8ae[_0x21169d]['param']]=_0x5c2dcf['options'];break;default:_0x5a2116[_0x37a8ae[_0x21169d][_0x5e68('0x26')]]=_0x5db5d8[_0x37a8ae[_0x21169d][_0x5e68('0x26')]];}}return _0x5a2116[_0x5e68('0x29')](',');}function _0xa7159b(_0x23b337,_0x5132b6,_0x17c8fd){return new Promise(function(_0x1b5ef2,_0x1cf466){var _0x3c8e00=[];if(_[_0x5e68('0x2c')](_0x5132b6))return _0x1b5ef2(_0x3c8e00);_0x4173ff['Interval'][_0x5e68('0x2d')]({'attributes':['id',_0x5e68('0x2e'),_0x5e68('0x2f')],'raw':!![]})[_0x5e68('0x30')](function(_0x29ec79){for(var _0x156856=0x0,_0x1e56ed=0x0;_0x156856<_0x5132b6['length'];_0x156856++,_0x1e56ed=0x0){var _0x2cc3f9=_0x5132b6[_0x156856];var _0x4fcf98=[];var _0x16be6e=[];delete _0x2cc3f9['id'];if(_0x2cc3f9[_0x5e68('0x2e')]!==_0x5e68('0x31')){_0x2cc3f9['intervals']=[_0x2cc3f9['interval']];}else{_0x2cc3f9['intervals']=_0x2cc3f9[_0x5e68('0x2f')]?_[_0x5e68('0x32')](_[_0x5e68('0x33')](_0x29ec79,{'IntervalId':_0x2cc3f9['IntervalId']}),_0x5e68('0x2e')):[];}_0x2cc3f9['context']=_0x23b337[_0x5e68('0x6')];_0x2cc3f9['exten']=_0x23b337[_0x5e68('0xa')];if(_0x2cc3f9[_0x5e68('0x5')])_0x2cc3f9['type']=_0x2cc3f9[_0x5e68('0x5')][_0x5e68('0x34')]();if(_0x23b337[_0x5e68('0x5')]==='outbound'){if(_0x2cc3f9[_0x5e68('0x1b')](_0x5e68('0x35'))&&_0x2cc3f9[_0x5e68('0x35')]&&_0x2cc3f9[_0x5e68('0x35')]!=='--'){_0x4fcf98[_0x5e68('0xd')]({'type':_0x2cc3f9[_0x5e68('0x5')]['toLowerCase'](),'app':_0x5e68('0x3'),'appdata':_0x5e68('0x36')+_0x2cc3f9['tag'],'context':_0x23b337[_0x5e68('0x6')],'exten':_0x23b337['exten'],'priority':_0x2cc3f9['intervals'][_0x5e68('0x23')]+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});}_0x4fcf98[_0x5e68('0xd')]({'type':_0x2cc3f9[_0x5e68('0x5')]['toLowerCase'](),'app':_0x5e68('0x16'),'appdata':_0x5e68('0x37')+(_0x2cc3f9[_0x5e68('0x38')]?_0x5e68('0x39')+_0x2cc3f9[_0x5e68('0x38')]+')':'NoOp(No\x20number\x20available)'),'context':_0x23b337['context'],'exten':_0x23b337[_0x5e68('0xa')],'priority':_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')]+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});}else{if(_0x2cc3f9['hasOwnProperty']('answer')){if(['queue','playback'][_0x5e68('0x3b')](_0x2cc3f9[_0x5e68('0x3c')][_0x5e68('0x34')]())&&_0x2cc3f9[_0x5e68('0x3d')]!==_0x5e68('0x3e')){if(_0x2cc3f9[_0x5e68('0x3f')]){_0x4fcf98[_0x5e68('0xd')]({'type':_0x2cc3f9[_0x5e68('0x5')]['toLowerCase'](),'app':_0x5e68('0x16'),'appdata':_0x5e68('0x40'),'context':_0x23b337[_0x5e68('0x6')],'exten':_0x23b337[_0x5e68('0xa')],'priority':_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')]+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});_0x4fcf98[_0x5e68('0xd')]({'type':_0x2cc3f9['type']['toLowerCase'](),'app':_0x5e68('0x3'),'appdata':_0x5e68('0x41'),'context':_0x23b337[_0x5e68('0x6')],'exten':_0x23b337[_0x5e68('0xa')],'priority':_0x2cc3f9['intervals']['length']+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});}else{_0x4fcf98['push']({'type':_0x2cc3f9[_0x5e68('0x5')][_0x5e68('0x34')](),'app':_0x5e68('0x16'),'appdata':_0x5e68('0x42'),'context':_0x23b337[_0x5e68('0x6')],'exten':_0x23b337['exten'],'priority':_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')]+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});_0x4fcf98[_0x5e68('0xd')]({'type':_0x2cc3f9[_0x5e68('0x5')][_0x5e68('0x34')](),'app':_0x5e68('0x3'),'appdata':_0x5e68('0x43'),'context':_0x23b337[_0x5e68('0x6')],'exten':_0x23b337[_0x5e68('0xa')],'priority':_0x2cc3f9['intervals'][_0x5e68('0x23')]+_0x17c8fd+_0x1e56ed++,'VoiceExtensionId':_0x23b337['id']});}}}}for(var _0x5ca837=0x0;_0x5ca837<_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')];_0x5ca837++){var _0x4f230f=_0x17c8fd+_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')];var _0x5509d2=_0x5ca837===_0x2cc3f9[_0x5e68('0x3a')][_0x5e68('0x23')]-0x1?_0x17c8fd+_0x4fcf98[_0x5e68('0x23')]+_0x16be6e['length']+0x2:_0x17c8fd+_0x5ca837+0x1;_0x4fcf98[_0x5e68('0x44')](_0x5ca837,0x0,{'type':_0x23b337[_0x5e68('0x5')],'app':'GotoIfTime','appdata':_0x2cc3f9[_0x5e68('0x3a')][_0x5ca837]+'?'+_0x23b337['context']+_0x5e68('0x45')+_0x4f230f+':'+_0x23b337[_0x5e68('0x6')]+_0x5e68('0x45')+_0x5509d2,'exten':_0x23b337[_0x5e68('0xa')],'context':_0x23b337[_0x5e68('0x6')],'priority':_0x17c8fd+_0x5ca837,'VoiceExtensionId':_0x23b337['id']});}if(_0x2cc3f9[_0x5e68('0x3d')]===_0x5e68('0x46'))_0x2cc3f9[_0x5e68('0x47')]=_0x1e1e3d(_0x23b337,_0x2cc3f9[_0x5e68('0x47')]);_0x2cc3f9['priority']=_0x4fcf98[_0x5e68('0x23')]?_[_0x5e68('0x48')](_0x4fcf98)[_0x5e68('0x49')]+0x1:_0x17c8fd;_0x3c8e00=_[_0x5e68('0x4a')](_0x3c8e00,_0x4fcf98,[_0x2cc3f9],_0x16be6e);_0x17c8fd=_['last'](_0x3c8e00)[_0x5e68('0x49')]+0x1;}return _0x1b5ef2(_0x3c8e00);})[_0x5e68('0x4b')](function(_0x8584f0){_0x1cf466(_0x8584f0);});});}return _0x1a6382[_0x5e68('0x4c')](_0x5e68('0x4d'),attributes,{'tableName':_0x5e68('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x186b07){var _0x123af9=this['get']({'plain':!![]});var _0x1b393a=_0x123af9[_0x5e68('0x5')]==='outbound'?_0xd82104(_0x123af9):_0xd1426(_0x123af9);return _0xa7159b(_0x123af9,_0x186b07,_[_0x5e68('0x48')](_0x1b393a)[_0x5e68('0x49')]+0x1)[_0x5e68('0x30')](function(_0x456707){var _0x1ad911=_[_0x5e68('0x4a')](_0x1b393a,_0x456707);_0x1ad911[_0x5e68('0xd')]({'type':_0x123af9['type'],'app':'Hangup','exten':_0x123af9['exten'],'context':_0x123af9[_0x5e68('0x6')],'priority':_[_0x5e68('0x48')](_0x1ad911)[_0x5e68('0x49')]+0x1,'VoiceExtensionId':_0x123af9['id']});return _0x1ad911;});}}});}; \ No newline at end of file +var _0x433a=['Set','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','phone','prefix','${EXTEN:','param','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','exten'];(function(_0x36914e,_0x320aab){var _0x311165=function(_0x63c6b0){while(--_0x63c6b0){_0x36914e['push'](_0x36914e['shift']());}};_0x311165(++_0x320aab);}(_0x433a,0x14c));var _0xa433=function(_0x3882a5,_0x27af1f){_0x3882a5=_0x3882a5-0x0;var _0x223f53=_0x433a[_0x3882a5];return _0x223f53;};'use strict';var _=require(_0xa433('0x0'));var attributes=require(_0xa433('0x1'));module[_0xa433('0x2')]=function(_0x57aaa9){var _0x29307f=_0x57aaa9[_0xa433('0x3')];function _0x22ac7b(_0x1fcf09){var _0x4a4d5c=0x2;var _0x22f282=[{'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0x5')+_0x1fcf09[_0xa433('0x4')],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0x1fcf09['alias']?_0xa433('0x8'):_0xa433('0x9'),'appdata':_0x1fcf09['alias']?_0xa433('0xa')+_0x1fcf09[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']}];if(_0x1fcf09[_0xa433('0x4')]===_0xa433('0xd')){_0x22f282[_0xa433('0xe')]({'type':_0xa433('0xd'),'app':_0xa433('0x8'),'appdata':'CDR(routeid)='+_0x1fcf09['id'],'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});}_0x22f282[_0xa433('0xe')]({'type':_0x1fcf09[_0xa433('0x4')],'app':'Set','appdata':_0xa433('0xf'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09[_0xa433('0x4')],'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']},{'type':_0x1fcf09['type'],'app':_0xa433('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1fcf09[_0xa433('0x6')],'exten':_0x1fcf09[_0xa433('0x7')],'priority':_0x4a4d5c++,'VoiceExtensionId':_0x1fcf09['id']});return _0x22f282;}function _0x3b8323(_0x3a580e){var _0x3c5db6=0x2;var _0x1bc01f=[{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x12'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0x3a580e[_0xa433('0xb')]?_0xa433('0x8'):'NoOp','appdata':_0x3a580e['alias']?_0xa433('0xa')+_0x3a580e[_0xa433('0xb')]:_0xa433('0xc'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x13')+(_0x3a580e[_0xa433('0x14')]?'${EXTEN:'+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x15')),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x16')+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x17'),'appdata':_0xa433('0x18')+(_0x3c5db6+0x2)+_0xa433('0x19')+(_0x3c5db6+0x1)+')','context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0x3a580e[_0xa433('0x14')]?_0xa433('0x1a')+_0x3a580e[_0xa433('0x14')]+'}':_0xa433('0x1b'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0xf'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x10'),'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':'outbound','app':_0xa433('0x8'),'appdata':_0xa433('0x1c'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':'outboundrouteid='+_0x3a580e['id'],'context':_0x3a580e[_0xa433('0x6')],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']}];if(_0x3a580e[_0xa433('0x1d')](_0xa433('0x1e'))&&_0x3a580e[_0xa433('0x1e')]!==_0xa433('0x1f')){_0x1bc01f[_0xa433('0xe')]({'type':_0xa433('0x11'),'app':'Set','appdata':_0xa433('0x20'),'context':_0x3a580e['context'],'exten':_0x3a580e[_0xa433('0x7')],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']},{'type':_0xa433('0x11'),'app':_0xa433('0x8'),'appdata':_0xa433('0x21')+_0x3a580e[_0xa433('0x1e')]||_0xa433('0x22'),'context':_0x3a580e['context'],'exten':_0x3a580e['exten'],'priority':_0x3c5db6++,'VoiceExtensionId':_0x3a580e['id']});}return _0x1bc01f;}function _0x115f84(_0x560281,_0x32b9fb){var _0x138b60=[{'name':_0xa433('0x23'),'param':0x0},{'name':_0xa433('0x24'),'param':0x1},{'name':_0xa433('0x25'),'param':0x2},{'name':'url','param':0x3}];var _0x126223={};var _0x5a829c=_0x32b9fb[_0xa433('0x26')](',');var _0x48f571=[];for(var _0x47ce7d=0x0;_0x47ce7d<_0x138b60[_0xa433('0x27')];_0x47ce7d++){switch(_0x138b60[_0x47ce7d][_0xa433('0x28')]){case _0xa433('0x23'):_0x126223[_0xa433('0x23')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']][_0xa433('0x26')]('/')[0x1];_0x126223[_0xa433('0x29')]=_0x5a829c[_0x138b60[_0x47ce7d]['param']]['split']('/')[0x2];_0x126223[_0xa433('0x2a')]=_0x126223[_0xa433('0x29')]?_0x126223['phone'][_0xa433('0x26')]('$')[0x0]:undefined;_0x126223[_0xa433('0x29')]=_0x560281[_0xa433('0x14')]?(_0x126223[_0xa433('0x2a')]||'')+_0xa433('0x2b')+_0x560281['cutdigits']+'}':(_0x126223[_0xa433('0x2a')]||'')+'${EXTEN}';_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=[_0xa433('0x2d'),_0x126223[_0xa433('0x23')],_0x126223[_0xa433('0x29')]][_0xa433('0x2e')]('/');break;case _0xa433('0x25'):_0x126223[_0xa433('0x25')]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];if(_0x560281[_0xa433('0x1e')]!==_0xa433('0x1f')){if(_0x126223[_0xa433('0x25')][_0xa433('0x2f')](_0xa433('0x30'))<0x0){_0x126223[_0xa433('0x25')]+=_0xa433('0x30');}}else{_0x126223['options']=_0x126223[_0xa433('0x25')][_0xa433('0x31')](_0xa433('0x30'),'');}_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x126223['options'];break;default:_0x48f571[_0x138b60[_0x47ce7d][_0xa433('0x2c')]]=_0x5a829c[_0x138b60[_0x47ce7d][_0xa433('0x2c')]];}}return _0x48f571[_0xa433('0x2e')](',');}function _0x38aafe(_0x420c74,_0x1462b7,_0x35555c){return new Promise(function(_0x584506,_0x96c81c){var _0x45ff00=[];if(_[_0xa433('0x32')](_0x1462b7))return _0x584506(_0x45ff00);_0x29307f['Interval'][_0xa433('0x33')]({'attributes':['id',_0xa433('0x34'),_0xa433('0x35')],'raw':!![]})[_0xa433('0x36')](function(_0x2dba36){for(var _0x5ce562=0x0,_0xab35cc=0x0;_0x5ce562<_0x1462b7[_0xa433('0x27')];_0x5ce562++,_0xab35cc=0x0){var _0x3dbf4d=_0x1462b7[_0x5ce562];var _0x566815=[];var _0x5b2d04=[];delete _0x3dbf4d['id'];if(_0x3dbf4d[_0xa433('0x34')]!==_0xa433('0x37')){_0x3dbf4d[_0xa433('0x38')]=[_0x3dbf4d['interval']];}else{_0x3dbf4d['intervals']=_0x3dbf4d[_0xa433('0x35')]?_[_0xa433('0x39')](_[_0xa433('0x3a')](_0x2dba36,{'IntervalId':_0x3dbf4d['IntervalId']}),_0xa433('0x34')):[];}_0x3dbf4d['context']=_0x420c74[_0xa433('0x6')];_0x3dbf4d[_0xa433('0x7')]=_0x420c74[_0xa433('0x7')];if(_0x3dbf4d[_0xa433('0x4')])_0x3dbf4d[_0xa433('0x4')]=_0x3dbf4d[_0xa433('0x4')]['toLowerCase']();if(_0x420c74[_0xa433('0x4')]==='outbound'){if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x3b'))&&_0x3dbf4d[_0xa433('0x3b')]&&_0x3dbf4d[_0xa433('0x3b')]!=='--'){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type']['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x3c')+_0x3dbf4d[_0xa433('0x3b')],'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':_0xa433('0x3e')+(_0x3dbf4d['callerID']?_0xa433('0x3f')+_0x3dbf4d['callerID']+')':_0xa433('0x40')),'context':_0x420c74['context'],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{if(_0x3dbf4d[_0xa433('0x1d')](_0xa433('0x41'))){if([_0xa433('0x42'),'playback'][_0xa433('0x43')](_0x3dbf4d[_0xa433('0x44')][_0xa433('0x3d')]())&&_0x3dbf4d[_0xa433('0x45')]!==_0xa433('0x46')){if(_0x3dbf4d[_0xa433('0x41')]){_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals']['length']+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')][_0xa433('0x3d')](),'app':_0xa433('0x8'),'appdata':_0xa433('0x47'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}else{_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d['type'][_0xa433('0x3d')](),'app':'ExecIf','appdata':_0xa433('0x48'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74[_0xa433('0x7')],'priority':_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});_0x566815[_0xa433('0xe')]({'type':_0x3dbf4d[_0xa433('0x4')]['toLowerCase'](),'app':_0xa433('0x8'),'appdata':_0xa433('0x49'),'context':_0x420c74[_0xa433('0x6')],'exten':_0x420c74['exten'],'priority':_0x3dbf4d['intervals'][_0xa433('0x27')]+_0x35555c+_0xab35cc++,'VoiceExtensionId':_0x420c74['id']});}}}}for(var _0x3cbcdb=0x0;_0x3cbcdb<_0x3dbf4d['intervals'][_0xa433('0x27')];_0x3cbcdb++){var _0x5e5e89=_0x35555c+_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')];var _0x378b78=_0x3cbcdb===_0x3dbf4d[_0xa433('0x38')][_0xa433('0x27')]-0x1?_0x35555c+_0x566815[_0xa433('0x27')]+_0x5b2d04[_0xa433('0x27')]+0x2:_0x35555c+_0x3cbcdb+0x1;_0x566815[_0xa433('0x4a')](_0x3cbcdb,0x0,{'type':_0x420c74[_0xa433('0x4')],'app':'GotoIfTime','appdata':_0x3dbf4d[_0xa433('0x38')][_0x3cbcdb]+'?'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x5e5e89+':'+_0x420c74[_0xa433('0x6')]+_0xa433('0x4b')+_0x378b78,'exten':_0x420c74[_0xa433('0x7')],'context':_0x420c74[_0xa433('0x6')],'priority':_0x35555c+_0x3cbcdb,'VoiceExtensionId':_0x420c74['id']});}if(_0x3dbf4d[_0xa433('0x45')]===_0xa433('0x4c'))_0x3dbf4d[_0xa433('0x4d')]=_0x115f84(_0x420c74,_0x3dbf4d[_0xa433('0x4d')]);_0x3dbf4d['priority']=_0x566815[_0xa433('0x27')]?_[_0xa433('0x4e')](_0x566815)[_0xa433('0x4f')]+0x1:_0x35555c;_0x45ff00=_[_0xa433('0x50')](_0x45ff00,_0x566815,[_0x3dbf4d],_0x5b2d04);_0x35555c=_[_0xa433('0x4e')](_0x45ff00)[_0xa433('0x4f')]+0x1;}return _0x584506(_0x45ff00);})[_0xa433('0x51')](function(_0x27f74a){_0x96c81c(_0x27f74a);});});}return _0x57aaa9[_0xa433('0x52')](_0xa433('0x53'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x41ee8a){var _0x2dedf2=this['get']({'plain':!![]});var _0xa4aeec=_0x2dedf2[_0xa433('0x4')]===_0xa433('0x11')?_0x3b8323(_0x2dedf2):_0x22ac7b(_0x2dedf2);return _0x38aafe(_0x2dedf2,_0x41ee8a,_[_0xa433('0x4e')](_0xa4aeec)[_0xa433('0x4f')]+0x1)[_0xa433('0x36')](function(_0x132df4){var _0x1e29c4=_[_0xa433('0x50')](_0xa4aeec,_0x132df4);_0x1e29c4[_0xa433('0xe')]({'type':_0x2dedf2[_0xa433('0x4')],'app':_0xa433('0x54'),'exten':_0x2dedf2['exten'],'context':_0x2dedf2[_0xa433('0x6')],'priority':_[_0xa433('0x4e')](_0x1e29c4)[_0xa433('0x4f')]+0x1,'VoiceExtensionId':_0x2dedf2['id']});return _0x1e29c4;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fedf18b..c878224 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 _0x2171=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','model','map','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2171,0x143));var _0x1217=function(_0x1f961d,_0x14fd96){_0x1f961d=_0x1f961d-0x0;var _0x26d648=_0x2171[_0x1f961d];return _0x26d648;};'use strict';var _=require('lodash');var util=require(_0x1217('0x0'));var moment=require(_0x1217('0x1'));var BPromise=require(_0x1217('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1217('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1217('0x4'))(_0x1217('0x5'));var config=require(_0x1217('0x6'));var jayson=require(_0x1217('0x7'));var client=jayson['client'][_0x1217('0x8')]({'port':0x232a});config[_0x1217('0x9')]=_[_0x1217('0xa')](config['redis'],{'host':_0x1217('0xb'),'port':0x18eb});var socket=require(_0x1217('0xc'))(new Redis(config[_0x1217('0x9')]));require(_0x1217('0xd'))[_0x1217('0xe')](socket);function respondWithRpcPromise(_0x35f3a8,_0x5a321c,_0x125efc){return new BPromise(function(_0x5114fd,_0x42abbf){return client[_0x1217('0xf')](_0x35f3a8,_0x125efc)[_0x1217('0x10')](function(_0x24336c){logger[_0x1217('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x5a321c,_0x1217('0x12'));logger[_0x1217('0x13')](_0x1217('0x14'),_0x5a321c,_0x1217('0x12'),JSON[_0x1217('0x15')](_0x24336c));if(_0x24336c['error']){if(_0x24336c['error'][_0x1217('0x16')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5a321c,_0x24336c[_0x1217('0x17')]['message']);return _0x42abbf(_0x24336c['error'][_0x1217('0x18')]);}logger[_0x1217('0x17')](_0x1217('0x19'),_0x5a321c,_0x24336c[_0x1217('0x17')]['message']);return _0x5114fd(_0x24336c[_0x1217('0x17')][_0x1217('0x18')]);}else{logger[_0x1217('0x11')](_0x1217('0x19'),_0x5a321c,'request\x20sent');_0x5114fd(_0x24336c[_0x1217('0x1a')][_0x1217('0x18')]);}})[_0x1217('0x1b')](function(_0x1a0a6c){logger[_0x1217('0x17')](_0x1217('0x19'),_0x5a321c,_0x1a0a6c);_0x42abbf(_0x1a0a6c);});});}exports[_0x1217('0x1c')]=function(_0xa0a5fd){var _0x48fd63=this;return new Promise(function(_0x3546a1,_0x49382b){return db[_0x1217('0x1d')][_0x1217('0x1e')]({'raw':_0xa0a5fd['options']?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x20')]===undefined?!![]:![]:!![],'where':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x21')]||null:null,'attributes':_0xa0a5fd['options']?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x22')]||null:null,'limit':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd['options']['limit']||null:null,'include':_0xa0a5fd[_0x1217('0x1f')]?_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x23')]?_['map'](_0xa0a5fd[_0x1217('0x1f')][_0x1217('0x23')],function(_0x1bde0b){return{'model':db[_0x1bde0b[_0x1217('0x24')]],'as':_0x1bde0b['as'],'attributes':_0x1bde0b[_0x1217('0x22')],'include':_0x1bde0b[_0x1217('0x23')]?_['map'](_0x1bde0b['include'],function(_0x1c61b2){return{'model':db[_0x1c61b2[_0x1217('0x24')]],'as':_0x1c61b2['as'],'attributes':_0x1c61b2['attributes'],'include':_0x1c61b2[_0x1217('0x23')]?_[_0x1217('0x25')](_0x1c61b2[_0x1217('0x23')],function(_0x21392c){return{'model':db[_0x21392c[_0x1217('0x24')]],'as':_0x21392c['as'],'attributes':_0x21392c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1217('0x10')](function(_0x46b735){logger[_0x1217('0x11')]('GetVoiceExtension',_0xa0a5fd);logger['debug'](_0x1217('0x1c'),_0xa0a5fd,JSON[_0x1217('0x15')](_0x46b735));_0x3546a1(_0x46b735);})[_0x1217('0x1b')](function(_0x5c7fe3){logger['error'](_0x1217('0x1c'),_0x5c7fe3[_0x1217('0x18')],_0xa0a5fd);_0x49382b(_0x48fd63[_0x1217('0x17')](0x1f4,_0x5c7fe3['message']));});});}; \ No newline at end of file +var _0xd7c3=['result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x4486ac,_0x5d6ee1){_0x4486ac=_0x4486ac-0x0;var _0x1ac2b8=_0xd7c3[_0x4486ac];return _0x1ac2b8;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))('rpc');var config=require(_0x3d7c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3d7c('0xa')]=_[_0x3d7c('0xb')](config[_0x3d7c('0xa')],{'host':_0x3d7c('0xc'),'port':0x18eb});var socket=require(_0x3d7c('0xd'))(new Redis(config[_0x3d7c('0xa')]));require(_0x3d7c('0xe'))[_0x3d7c('0xf')](socket);function respondWithRpcPromise(_0x2e387e,_0x3a2d6c,_0x222e27){return new BPromise(function(_0x1aec45,_0x295fbb){return client[_0x3d7c('0x10')](_0x2e387e,_0x222e27)[_0x3d7c('0x11')](function(_0x25e2f9){logger[_0x3d7c('0x12')](_0x3d7c('0x13'),_0x3a2d6c,'request\x20sent');logger[_0x3d7c('0x14')](_0x3d7c('0x15'),_0x3a2d6c,_0x3d7c('0x16'),JSON[_0x3d7c('0x17')](_0x25e2f9));if(_0x25e2f9[_0x3d7c('0x18')]){if(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x19')]===0x1f4){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);return _0x295fbb(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')]['message']);return _0x1aec45(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x3a2d6c,_0x3d7c('0x16'));_0x1aec45(_0x25e2f9[_0x3d7c('0x1b')][_0x3d7c('0x1a')]);}})[_0x3d7c('0x1c')](function(_0x591455){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x591455);_0x295fbb(_0x591455);});});}exports[_0x3d7c('0x1d')]=function(_0x4f9ccb){var _0x1308ef=this;return new Promise(function(_0x38207e,_0x3a99fd){return db[_0x3d7c('0x1e')][_0x3d7c('0x1f')]({'raw':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x21')]===undefined?!![]:![]:!![],'where':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb['options'][_0x3d7c('0x22')]||null:null,'attributes':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x23')]||null:null,'limit':_0x4f9ccb['options']?_0x4f9ccb['options'][_0x3d7c('0x24')]||null:null,'include':_0x4f9ccb[_0x3d7c('0x20')]?_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x25')]?_[_0x3d7c('0x26')](_0x4f9ccb[_0x3d7c('0x20')][_0x3d7c('0x25')],function(_0x2ac594){return{'model':db[_0x2ac594[_0x3d7c('0x27')]],'as':_0x2ac594['as'],'attributes':_0x2ac594[_0x3d7c('0x23')],'include':_0x2ac594[_0x3d7c('0x25')]?_['map'](_0x2ac594['include'],function(_0x316c7c){return{'model':db[_0x316c7c[_0x3d7c('0x27')]],'as':_0x316c7c['as'],'attributes':_0x316c7c['attributes'],'include':_0x316c7c[_0x3d7c('0x25')]?_[_0x3d7c('0x26')](_0x316c7c[_0x3d7c('0x25')],function(_0x53698b){return{'model':db[_0x53698b[_0x3d7c('0x27')]],'as':_0x53698b['as'],'attributes':_0x53698b[_0x3d7c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3d7c('0x11')](function(_0x236440){logger[_0x3d7c('0x12')]('GetVoiceExtension',_0x4f9ccb);logger[_0x3d7c('0x14')](_0x3d7c('0x1d'),_0x4f9ccb,JSON[_0x3d7c('0x17')](_0x236440));_0x38207e(_0x236440);})['catch'](function(_0x77d399){logger[_0x3d7c('0x18')](_0x3d7c('0x1d'),_0x77d399[_0x3d7c('0x1a')],_0x4f9ccb);_0x3a99fd(_0x1308ef[_0x3d7c('0x18')](0x1f4,_0x77d399[_0x3d7c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0f48523..dd684ba 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x534463,_0x17354f){var _0x1f5c37=function(_0x1c0e34){while(--_0x1c0e34){_0x534463['push'](_0x534463['shift']());}};_0x1f5c37(++_0x17354f);}(_0x4975,0x86));var _0x5497=function(_0x411249,_0x34a545){_0x411249=_0x411249-0x0;var _0x120f86=_0x4975[_0x411249];return _0x120f86;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x1d1f2c,_0x5349f5){var _0x18905c=function(_0x1d4278){while(--_0x1d4278){_0x1d1f2c['push'](_0x1d1f2c['shift']());}};_0x18905c(++_0x5349f5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7f05d15..3060255 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 _0x4745=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','getMessages','post','create','put'];(function(_0x3df186,_0x12592c){var _0x5440fc=function(_0x2a7a70){while(--_0x2a7a70){_0x3df186['push'](_0x3df186['shift']());}};_0x5440fc(++_0x12592c);}(_0x4745,0x1e7));var _0x5474=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x4745[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/:id',auth[_0x5474('0xd')](),controller['show']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0x10')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0x12')](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router['delete'](_0x5474('0x13'),auth[_0x5474('0xd')](),controller[_0x5474('0x15')]);module[_0x5474('0x16')]=router; \ No newline at end of file +var _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x50620b,_0x10bb13){var _0x3afc55=function(_0x56ca52){while(--_0x56ca52){_0x50620b['push'](_0x50620b['shift']());}};_0x3afc55(++_0x10bb13);}(_0x741c,0x196));var _0xc741=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x741c[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 284cbbb..d89118e 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 _0xe621=['yes','TINYINT(4)','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM'];(function(_0x30fc67,_0x468e59){var _0x53995e=function(_0x2d5bf2){while(--_0x2d5bf2){_0x30fc67['push'](_0x30fc67['shift']());}};_0x53995e(++_0x468e59);}(_0xe621,0x8f));var _0x1e62=function(_0x34d6cb,_0x1ae55c){_0x34d6cb=_0x34d6cb-0x0;var _0x4372cb=_0xe621[_0x34d6cb];return _0x4372cb;};'use strict';var Sequelize=require(_0x1e62('0x0'));module[_0x1e62('0x1')]={'customer_id':{'type':Sequelize[_0x1e62('0x2')]},'context':{'type':Sequelize[_0x1e62('0x2')],'defaultValue':'from-voicemail','unique':_0x1e62('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x1e62('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x1e62('0x2')]},'email':{'type':Sequelize[_0x1e62('0x2')],'validate':{'isEmail':!![]},'set':function(_0x110b97){this[_0x1e62('0x4')](_0x1e62('0x5'),typeof _0x110b97===_0x1e62('0x6')&&_0x110b97[_0x1e62('0x7')]()?_0x110b97[_0x1e62('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1e62('0x2')],'defaultValue':_0x1e62('0x8')},'attach':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':_0x1e62('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x1e62('0xa'),'no'),'defaultValue':_0x1e62('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1e62('0x2')]},'callback':{'type':Sequelize[_0x1e62('0x2')]},'review':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1e62('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':_0x1e62('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1e62('0x9')](_0x1e62('0xa'),'no'),'defaultValue':_0x1e62('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x1e62('0x2')]},'emailbody':{'type':Sequelize[_0x1e62('0x2')]},'maxsecs':{'type':Sequelize[_0x1e62('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1e62('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1e62('0xd')](_0x1e62('0xe'))+_0x1e62('0xf')+this[_0x1e62('0xd')](_0x1e62('0x10'));}}}; \ No newline at end of file +var _0xcaf8=['string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0xc3da99,_0x1b483c){var _0x246794=function(_0x2df4cc){while(--_0x2df4cc){_0xc3da99['push'](_0xc3da99['shift']());}};_0x246794(++_0x1b483c);}(_0xcaf8,0x1ba));var _0x8caf=function(_0x54fb32,_0xd7e960){_0x54fb32=_0x54fb32-0x0;var _0x3c1d46=_0xcaf8[_0x54fb32];return _0x3c1d46;};'use strict';var Sequelize=require(_0x8caf('0x0'));module[_0x8caf('0x1')]={'customer_id':{'type':Sequelize[_0x8caf('0x2')]},'context':{'type':Sequelize[_0x8caf('0x2')],'defaultValue':_0x8caf('0x3'),'unique':_0x8caf('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x8caf('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8caf('0x2')]},'email':{'type':Sequelize[_0x8caf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1a4024){this[_0x8caf('0x5')]('email',typeof _0x1a4024===_0x8caf('0x6')&&_0x1a4024[_0x8caf('0x7')]()?_0x1a4024['trim']():null);}},'pager':{'type':Sequelize[_0x8caf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x8caf('0x8')},'attach':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8caf('0x2')]},'review':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8caf('0xa')](_0x8caf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8caf('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8caf('0x9'),'no'),'defaultValue':_0x8caf('0x9'),'allowNull':![]},'stamp':{'type':_0x8caf('0xb')},'emailsubject':{'type':Sequelize[_0x8caf('0x2')]},'emailbody':{'type':Sequelize[_0x8caf('0x2')]},'maxsecs':{'type':Sequelize[_0x8caf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x8caf('0xd'))+_0x8caf('0xe')+this['getDataValue'](_0x8caf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 6b7f006..2e7a9c2 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 _0x44a3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','VoiceMail','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','params','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring'];(function(_0x50dd72,_0x436603){var _0x196bc2=function(_0x35acb8){while(--_0x35acb8){_0x50dd72['push'](_0x50dd72['shift']());}};_0x196bc2(++_0x436603);}(_0x44a3,0x1a9));var _0x344a=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0x44a3[_0xd49fef];return _0x304be8;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){var _0x6ccfba=_0x5ce9da['get']({'plain':!![]});var _0x2a5e49='Voicemails';return db[_0x344a('0x27')][_0x344a('0x26')]({'where':{'type':_0x2a5e49,'resourceId':_0x6ccfba['id']}})[_0x344a('0x25')](function(){return _0x5ce9da;});})[_0x344a('0x25')](function(){_0x90070c[_0x344a('0x18')](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x229ccd,_0x114637){return function(_0x4f2499){if(!_0x4f2499){_0x229ccd[_0x344a('0x17')](0x194);}return _0x4f2499;};}function handleError(_0x18be46,_0x26cf51){_0x26cf51=_0x26cf51||0x1f4;return function(_0xc02d6){logger[_0x344a('0x28')](_0xc02d6[_0x344a('0x29')]);if(_0xc02d6['name']){delete _0xc02d6[_0x344a('0x2a')];}_0x18be46['status'](_0x26cf51)['send'](_0xc02d6);};}exports[_0x344a('0x2b')]=function(_0x14fa86,_0x5a36bb){var _0x4803db={},_0x5cd9c6={},_0x5cafd2={'count':0x0,'rows':[]};var _0x16f490=_[_0x344a('0x2c')](db[_0x344a('0x2d')]['rawAttributes'],function(_0x25b28d){return{'name':_0x25b28d[_0x344a('0x2e')],'type':_0x25b28d[_0x344a('0x2f')][_0x344a('0x30')]};});_0x5cd9c6[_0x344a('0x31')]=_[_0x344a('0x2c')](_0x16f490,_0x344a('0x2a'));_0x5cd9c6['query']=_[_0x344a('0x32')](_0x14fa86['query']);_0x5cd9c6['filters']=_['intersection'](_0x5cd9c6[_0x344a('0x31')],_0x5cd9c6[_0x344a('0x33')]);_0x4803db[_0x344a('0x34')]=_[_0x344a('0x35')](_0x5cd9c6[_0x344a('0x31')],qs[_0x344a('0x36')](_0x14fa86['query'][_0x344a('0x36')]));_0x4803db[_0x344a('0x34')]=_0x4803db[_0x344a('0x34')]['length']?_0x4803db[_0x344a('0x34')]:_0x5cd9c6[_0x344a('0x31')];if(!_0x14fa86[_0x344a('0x33')][_0x344a('0x37')](_0x344a('0x38'))){_0x4803db['limit']=qs[_0x344a('0x1d')](_0x14fa86[_0x344a('0x33')][_0x344a('0x1d')]);_0x4803db[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14fa86['query'][_0x344a('0x1b')]);}_0x4803db[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14fa86[_0x344a('0x33')][_0x344a('0x3a')]);_0x4803db['where']=qs[_0x344a('0x3b')](_[_0x344a('0x3c')](_0x14fa86[_0x344a('0x33')],_0x5cd9c6[_0x344a('0x3b')]),_0x16f490);if(_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]){_0x4803db[_0x344a('0x3e')]=_[_0x344a('0x3f')](_0x4803db['where'],{'$or':_[_0x344a('0x2c')](_0x16f490,function(_0x371c68){if(_0x371c68[_0x344a('0x2f')]!==_0x344a('0x40')){var _0x2fc05f={};_0x2fc05f[_0x371c68['name']]={'$like':'%'+_0x14fa86[_0x344a('0x33')][_0x344a('0x3d')]+'%'};return _0x2fc05f;}})});}_0x4803db=_[_0x344a('0x3f')]({},_0x4803db,_0x14fa86[_0x344a('0x41')]);var _0x2f5132={'where':_0x4803db[_0x344a('0x3e')]};return db[_0x344a('0x2d')][_0x344a('0x1e')](_0x2f5132)[_0x344a('0x25')](function(_0x4b1bac){_0x5cafd2[_0x344a('0x1e')]=_0x4b1bac;if(_0x14fa86[_0x344a('0x33')][_0x344a('0x42')]){_0x4803db[_0x344a('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x344a('0x44')](_0x4803db);})[_0x344a('0x25')](function(_0x2b0ee9){_0x5cafd2[_0x344a('0x45')]=_0x2b0ee9;return _0x5cafd2;})[_0x344a('0x25')](respondWithFilteredResult(_0x5a36bb,_0x4803db))[_0x344a('0x46')](handleError(_0x5a36bb,null));};exports[_0x344a('0x47')]=function(_0x372e7d,_0x483c39){var _0x4509be={'raw':!![],'where':{'id':_0x372e7d['params']['id']}},_0x2de5aa={};_0x2de5aa[_0x344a('0x31')]=_[_0x344a('0x32')](db['VoiceMail'][_0x344a('0x48')]);_0x2de5aa[_0x344a('0x33')]=_['keys'](_0x372e7d[_0x344a('0x33')]);_0x2de5aa[_0x344a('0x3b')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],_0x2de5aa[_0x344a('0x33')]);_0x4509be[_0x344a('0x34')]=_['intersection'](_0x2de5aa[_0x344a('0x31')],qs['fields'](_0x372e7d[_0x344a('0x33')][_0x344a('0x36')]));_0x4509be[_0x344a('0x34')]=_0x4509be[_0x344a('0x34')]['length']?_0x4509be['attributes']:_0x2de5aa[_0x344a('0x31')];if(_0x372e7d[_0x344a('0x33')][_0x344a('0x42')]){_0x4509be[_0x344a('0x43')]=[{'all':!![]}];}_0x4509be=_[_0x344a('0x3f')]({},_0x4509be,_0x372e7d[_0x344a('0x41')]);return db[_0x344a('0x2d')][_0x344a('0x49')](_0x4509be)[_0x344a('0x25')](handleEntityNotFound(_0x483c39,null))[_0x344a('0x25')](respondWithResult(_0x483c39,null))['catch'](handleError(_0x483c39,null));};exports[_0x344a('0x4a')]=function(_0x2d9858,_0x6fad37){return db[_0x344a('0x2d')]['create'](_0x2d9858[_0x344a('0x4b')],{})['then'](function(_0x590f77){var _0xa6b6b5=_0x2d9858[_0x344a('0x4c')]['get']({'plain':!![]});if(!_0xa6b6b5)throw new Error(_0x344a('0x4d'));if(_0xa6b6b5[_0x344a('0x4e')]===_0x344a('0x4c')){var _0x226f41=_0x590f77['get']({'plain':!![]});var _0x225fce=_0x344a('0x4f');return db[_0x344a('0x50')][_0x344a('0x49')]({'where':{'name':_0x225fce,'userProfileId':_0xa6b6b5[_0x344a('0x51')]},'raw':!![]})[_0x344a('0x25')](function(_0x45232c){if(_0x45232c&&_0x45232c[_0x344a('0x52')]===0x0){return db[_0x344a('0x27')][_0x344a('0x4a')]({'name':_0x226f41['name'],'resourceId':_0x226f41['id'],'type':_0x45232c[_0x344a('0x2a')],'sectionId':_0x45232c['id']},{})['then'](function(){return _0x590f77;});}else{return _0x590f77;}})[_0x344a('0x46')](function(_0xb744c6){logger[_0x344a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb744c6);throw _0xb744c6;});}return _0x590f77;})[_0x344a('0x25')](respondWithResult(_0x6fad37,0xc9))[_0x344a('0x46')](handleError(_0x6fad37,null));};exports[_0x344a('0x24')]=function(_0x14921e,_0x346cf3){if(_0x14921e[_0x344a('0x4b')]['id']){delete _0x14921e[_0x344a('0x4b')]['id'];}return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x14921e['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x346cf3,null))[_0x344a('0x25')](saveUpdates(_0x14921e[_0x344a('0x4b')],null))[_0x344a('0x25')](respondWithResult(_0x346cf3,null))[_0x344a('0x46')](handleError(_0x346cf3,null));};exports['destroy']=function(_0x33077f,_0x163047){return db[_0x344a('0x2d')][_0x344a('0x49')]({'where':{'id':_0x33077f['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x163047,null))[_0x344a('0x25')](removeEntity(_0x163047,null))['catch'](handleError(_0x163047,null));};exports[_0x344a('0x53')]=function(_0x11d301,_0x16482c,_0x2ea2ad){return db[_0x344a('0x2d')][_0x344a('0x54')]({'where':{'id':_0x11d301[_0x344a('0x55')]['id']}})['then'](handleEntityNotFound(_0x16482c,null))['then'](function(_0x4d707b){var _0x41dc89;var _0x450a64={},_0x2acfc0={};_0x2acfc0[_0x344a('0x31')]=_['keys'](db[_0x344a('0x56')]['rawAttributes']);_0x2acfc0['query']=_['keys'](_0x11d301['query']);_0x2acfc0[_0x344a('0x3b')]=_[_0x344a('0x35')](_0x2acfc0[_0x344a('0x31')],_0x2acfc0[_0x344a('0x33')]);_0x450a64['attributes']=_['intersection'](_0x2acfc0['model'],qs[_0x344a('0x36')](_0x11d301[_0x344a('0x33')][_0x344a('0x36')]));_0x450a64[_0x344a('0x34')]=_0x450a64[_0x344a('0x34')]['length']?_0x450a64[_0x344a('0x34')]:_0x2acfc0[_0x344a('0x31')];if(!_0x11d301[_0x344a('0x33')]['hasOwnProperty'](_0x344a('0x38'))){_0x450a64['limit']=qs['limit'](_0x11d301[_0x344a('0x33')]['limit']);_0x450a64['offset']=qs[_0x344a('0x1b')](_0x11d301[_0x344a('0x33')]['offset']);}_0x450a64[_0x344a('0x39')]=qs['sort'](_0x11d301[_0x344a('0x33')][_0x344a('0x3a')]);_0x450a64[_0x344a('0x3e')]=qs['filters'](_['pick'](_0x11d301[_0x344a('0x33')],_0x2acfc0[_0x344a('0x3b')]));if(_0x11d301[_0x344a('0x33')][_0x344a('0x3d')]){_0x450a64['where']=_['merge'](_0x450a64[_0x344a('0x3e')],{'$or':_[_0x344a('0x2c')](_0x450a64[_0x344a('0x34')],function(_0x4f5119){var _0x827f2e={};_0x827f2e[_0x4f5119]={'$like':'%'+_0x11d301[_0x344a('0x33')]['filter']+'%'};return _0x827f2e;})});}_0x450a64[_0x344a('0x3e')]=_['merge'](_0x450a64[_0x344a('0x3e')],{'mailboxuser':_0x4d707b['mailbox']});_0x450a64=_['merge']({},_0x450a64,_0x11d301['options']);return db[_0x344a('0x56')][_0x344a('0x57')](_0x450a64)[_0x344a('0x25')](respondWithFilteredResult(_0x16482c,_0x450a64));})[_0x344a('0x46')](handleError(_0x16482c,null));}; \ No newline at end of file +var _0x373d=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','filter','VoiceMail','include','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','options','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x64ca31,_0x55d800){var _0x142d59=function(_0x4390da){while(--_0x4390da){_0x64ca31['push'](_0x64ca31['shift']());}};_0x142d59(++_0x55d800);}(_0x373d,0x1e2));var _0xd373=function(_0x2e17f0,_0xacc452){_0x2e17f0=_0x2e17f0-0x0;var _0x16b4e7=_0x373d[_0x2e17f0];return _0x16b4e7;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){var _0x1ab540=_0x238ffd[_0xd373('0x25')]({'plain':!![]});var _0x437110=_0xd373('0x26');return db[_0xd373('0x27')][_0xd373('0x24')]({'where':{'type':_0x437110,'resourceId':_0x1ab540['id']}})[_0xd373('0x23')](function(){return _0x238ffd;});})[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x3e657b,_0x470612){return function(_0x45ee58){if(!_0x45ee58){_0x3e657b[_0xd373('0x15')](0x194);}return _0x45ee58;};}function handleError(_0x71c5c,_0x3384a5){_0x3384a5=_0x3384a5||0x1f4;return function(_0xf85ca8){logger[_0xd373('0x28')](_0xf85ca8[_0xd373('0x29')]);if(_0xf85ca8[_0xd373('0x2a')]){delete _0xf85ca8[_0xd373('0x2a')];}_0x71c5c[_0xd373('0x17')](_0x3384a5)['send'](_0xf85ca8);};}exports[_0xd373('0x2b')]=function(_0x490842,_0x498aaa){var _0xedc8f3={},_0x15da6c={},_0x25e016={'count':0x0,'rows':[]};var _0x23024c=_[_0xd373('0x2c')](db['VoiceMail'][_0xd373('0x2d')],function(_0x104156){return{'name':_0x104156['fieldName'],'type':_0x104156[_0xd373('0x2e')][_0xd373('0x2f')]};});_0x15da6c[_0xd373('0x30')]=_[_0xd373('0x2c')](_0x23024c,_0xd373('0x2a'));_0x15da6c[_0xd373('0x31')]=_[_0xd373('0x32')](_0x490842[_0xd373('0x31')]);_0x15da6c[_0xd373('0x33')]=_['intersection'](_0x15da6c[_0xd373('0x30')],_0x15da6c[_0xd373('0x31')]);_0xedc8f3[_0xd373('0x34')]=_[_0xd373('0x35')](_0x15da6c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x490842[_0xd373('0x31')][_0xd373('0x36')]));_0xedc8f3[_0xd373('0x34')]=_0xedc8f3[_0xd373('0x34')][_0xd373('0x37')]?_0xedc8f3[_0xd373('0x34')]:_0x15da6c[_0xd373('0x30')];if(!_0x490842[_0xd373('0x31')][_0xd373('0x38')]('nolimit')){_0xedc8f3[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x490842[_0xd373('0x31')][_0xd373('0x1b')]);_0xedc8f3['offset']=qs[_0xd373('0x19')](_0x490842[_0xd373('0x31')][_0xd373('0x19')]);}_0xedc8f3[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x490842[_0xd373('0x31')]['sort']);_0xedc8f3['where']=qs[_0xd373('0x33')](_['pick'](_0x490842[_0xd373('0x31')],_0x15da6c[_0xd373('0x33')]),_0x23024c);if(_0x490842[_0xd373('0x31')]['filter']){_0xedc8f3[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0xedc8f3[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x23024c,function(_0x504450){if(_0x504450['type']!=='VIRTUAL'){var _0x11ec1b={};_0x11ec1b[_0x504450['name']]={'$like':'%'+_0x490842[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x11ec1b;}})});}_0xedc8f3=_['merge']({},_0xedc8f3,_0x490842['options']);var _0x5f3dd5={'where':_0xedc8f3[_0xd373('0x3b')]};return db[_0xd373('0x3e')][_0xd373('0x1c')](_0x5f3dd5)['then'](function(_0x5c3b22){_0x25e016[_0xd373('0x1c')]=_0x5c3b22;if(_0x490842[_0xd373('0x31')]['includeAll']){_0xedc8f3[_0xd373('0x3f')]=[{'all':!![]}];}return db[_0xd373('0x3e')][_0xd373('0x40')](_0xedc8f3);})[_0xd373('0x23')](function(_0x2d8c7d){_0x25e016['rows']=_0x2d8c7d;return _0x25e016;})['then'](respondWithFilteredResult(_0x498aaa,_0xedc8f3))[_0xd373('0x41')](handleError(_0x498aaa,null));};exports[_0xd373('0x42')]=function(_0x30b423,_0x302f65){var _0x5d4dd2={'raw':!![],'where':{'id':_0x30b423['params']['id']}},_0x29725c={};_0x29725c[_0xd373('0x30')]=_[_0xd373('0x32')](db[_0xd373('0x3e')][_0xd373('0x2d')]);_0x29725c[_0xd373('0x31')]=_['keys'](_0x30b423[_0xd373('0x31')]);_0x29725c[_0xd373('0x33')]=_['intersection'](_0x29725c[_0xd373('0x30')],_0x29725c[_0xd373('0x31')]);_0x5d4dd2[_0xd373('0x34')]=_[_0xd373('0x35')](_0x29725c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x30b423[_0xd373('0x31')][_0xd373('0x36')]));_0x5d4dd2[_0xd373('0x34')]=_0x5d4dd2[_0xd373('0x34')]['length']?_0x5d4dd2['attributes']:_0x29725c[_0xd373('0x30')];if(_0x30b423['query'][_0xd373('0x43')]){_0x5d4dd2['include']=[{'all':!![]}];}_0x5d4dd2=_['merge']({},_0x5d4dd2,_0x30b423['options']);return db[_0xd373('0x3e')][_0xd373('0x44')](_0x5d4dd2)[_0xd373('0x23')](handleEntityNotFound(_0x302f65,null))[_0xd373('0x23')](respondWithResult(_0x302f65,null))[_0xd373('0x41')](handleError(_0x302f65,null));};exports[_0xd373('0x45')]=function(_0x1855aa,_0x4d1088){return db[_0xd373('0x3e')]['create'](_0x1855aa[_0xd373('0x46')],{})[_0xd373('0x23')](function(_0x5502e5){var _0x4517ab=_0x1855aa['user'][_0xd373('0x25')]({'plain':!![]});if(!_0x4517ab)throw new Error(_0xd373('0x47'));if(_0x4517ab[_0xd373('0x48')]===_0xd373('0x49')){var _0xe22cbd=_0x5502e5['get']({'plain':!![]});var _0x4971a0='Voicemails';return db[_0xd373('0x4a')][_0xd373('0x44')]({'where':{'name':_0x4971a0,'userProfileId':_0x4517ab['userProfileId']},'raw':!![]})[_0xd373('0x23')](function(_0x3e6766){if(_0x3e6766&&_0x3e6766['autoAssociation']===0x0){return db[_0xd373('0x27')][_0xd373('0x45')]({'name':_0xe22cbd[_0xd373('0x2a')],'resourceId':_0xe22cbd['id'],'type':_0x3e6766[_0xd373('0x2a')],'sectionId':_0x3e6766['id']},{})[_0xd373('0x23')](function(){return _0x5502e5;});}else{return _0x5502e5;}})[_0xd373('0x41')](function(_0xc255ec){logger[_0xd373('0x28')](_0xd373('0x4b'),_0xc255ec);throw _0xc255ec;});}return _0x5502e5;})[_0xd373('0x23')](respondWithResult(_0x4d1088,0xc9))[_0xd373('0x41')](handleError(_0x4d1088,null));};exports['update']=function(_0x4b2645,_0x51ca73){if(_0x4b2645['body']['id']){delete _0x4b2645['body']['id'];}return db['VoiceMail'][_0xd373('0x44')]({'where':{'id':_0x4b2645[_0xd373('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51ca73,null))['then'](saveUpdates(_0x4b2645['body'],null))[_0xd373('0x23')](respondWithResult(_0x51ca73,null))[_0xd373('0x41')](handleError(_0x51ca73,null));};exports['destroy']=function(_0x52fa5b,_0x2230d6){return db[_0xd373('0x3e')][_0xd373('0x44')]({'where':{'id':_0x52fa5b[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x2230d6,null))['then'](removeEntity(_0x2230d6,null))[_0xd373('0x41')](handleError(_0x2230d6,null));};exports[_0xd373('0x4d')]=function(_0x386e4c,_0x213da6,_0xc607fb){return db[_0xd373('0x3e')][_0xd373('0x4e')]({'where':{'id':_0x386e4c[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x213da6,null))[_0xd373('0x23')](function(_0x1c21d2){var _0x3ad1ec;var _0x213b3c={},_0x42e45d={};_0x42e45d[_0xd373('0x30')]=_['keys'](db[_0xd373('0x4f')][_0xd373('0x2d')]);_0x42e45d[_0xd373('0x31')]=_['keys'](_0x386e4c[_0xd373('0x31')]);_0x42e45d['filters']=_[_0xd373('0x35')](_0x42e45d['model'],_0x42e45d[_0xd373('0x31')]);_0x213b3c[_0xd373('0x34')]=_[_0xd373('0x35')](_0x42e45d[_0xd373('0x30')],qs[_0xd373('0x36')](_0x386e4c[_0xd373('0x31')][_0xd373('0x36')]));_0x213b3c[_0xd373('0x34')]=_0x213b3c[_0xd373('0x34')][_0xd373('0x37')]?_0x213b3c[_0xd373('0x34')]:_0x42e45d[_0xd373('0x30')];if(!_0x386e4c[_0xd373('0x31')][_0xd373('0x38')](_0xd373('0x50'))){_0x213b3c[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x386e4c[_0xd373('0x31')][_0xd373('0x1b')]);_0x213b3c[_0xd373('0x19')]=qs[_0xd373('0x19')](_0x386e4c[_0xd373('0x31')][_0xd373('0x19')]);}_0x213b3c[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x386e4c[_0xd373('0x31')]['sort']);_0x213b3c[_0xd373('0x3b')]=qs[_0xd373('0x33')](_[_0xd373('0x51')](_0x386e4c['query'],_0x42e45d[_0xd373('0x33')]));if(_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]){_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x213b3c['attributes'],function(_0x1afe12){var _0x356820={};_0x356820[_0x1afe12]={'$like':'%'+_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x356820;})});}_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'mailboxuser':_0x1c21d2[_0xd373('0x52')]});_0x213b3c=_['merge']({},_0x213b3c,_0x386e4c[_0xd373('0x53')]);return db['VoiceMailMessage'][_0xd373('0x54')](_0x213b3c)[_0xd373('0x23')](respondWithFilteredResult(_0x213da6,_0x213b3c));})[_0xd373('0x41')](handleError(_0x213da6,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 39b0b0e..5d5c0a3 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 _0x591b=['api','moment','request-promise','rimraf','../../config/environment','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x1718ed,_0x31f89e){var _0x374961=function(_0x4c6f21){while(--_0x4c6f21){_0x1718ed['push'](_0x1718ed['shift']());}};_0x374961(++_0x31f89e);}(_0x591b,0x131));var _0xb591=function(_0x33e83d,_0x43ff11){_0x33e83d=_0x33e83d-0x0;var _0x41b3fd=_0x591b[_0x33e83d];return _0x41b3fd;};'use strict';var _=require(_0xb591('0x0'));var util=require(_0xb591('0x1'));var logger=require(_0xb591('0x2'))(_0xb591('0x3'));var moment=require(_0xb591('0x4'));var BPromise=require('bluebird');var rp=require(_0xb591('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb591('0x6'));var config=require(_0xb591('0x7'));var attributes=require('./voiceMail.attributes');module[_0xb591('0x8')]=function(_0x4ccfd6,_0x5a93a2){return _0x4ccfd6[_0xb591('0x9')](_0xb591('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb591('0xb'),'fields':[_0xb591('0xc'),_0xb591('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2349=['./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x48e3bc,_0x21b78d){var _0xc69b22=function(_0x1663e1){while(--_0x1663e1){_0x48e3bc['push'](_0x48e3bc['shift']());}};_0xc69b22(++_0x21b78d);}(_0x2349,0x133));var _0x9234=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0x2349[_0x27fe26];return _0x4fcb35;};'use strict';var _=require('lodash');var util=require(_0x9234('0x0'));var logger=require(_0x9234('0x1'))(_0x9234('0x2'));var moment=require(_0x9234('0x3'));var BPromise=require(_0x9234('0x4'));var rp=require(_0x9234('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9234('0x6'));var config=require(_0x9234('0x7'));var attributes=require(_0x9234('0x8'));module['exports']=function(_0x3cff60,_0x59dffd){return _0x3cff60[_0x9234('0x9')](_0x9234('0xa'),attributes,{'tableName':_0x9234('0xb'),'paranoid':![],'indexes':[{'name':_0x9234('0xc'),'fields':[_0x9234('0xd'),_0x9234('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a06fa4d..5d88025 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 _0x23c7=['VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x19018f,_0x1ed257){var _0x183cb2=function(_0x2916a3){while(--_0x2916a3){_0x19018f['push'](_0x19018f['shift']());}};_0x183cb2(++_0x1ed257);}(_0x23c7,0x18f));var _0x723c=function(_0xedfa8,_0x6db736){_0xedfa8=_0xedfa8-0x0;var _0x5a5e49=_0x23c7[_0xedfa8];return _0x5a5e49;};'use strict';var _=require(_0x723c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x723c('0x1'));var rs=require(_0x723c('0x2'));var fs=require('fs');var Redis=require(_0x723c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x723c('0x4'));var logger=require(_0x723c('0x5'))(_0x723c('0x6'));var config=require(_0x723c('0x7'));var jayson=require(_0x723c('0x8'));var client=jayson[_0x723c('0x9')][_0x723c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bd82c,_0x3f7bcb,_0x264700){return new BPromise(function(_0x41dfb9,_0x5e0099){return client[_0x723c('0xb')](_0x3bd82c,_0x264700)['then'](function(_0x108a80){logger[_0x723c('0xc')]('VoiceMail,\x20%s,\x20%s',_0x3f7bcb,_0x723c('0xd'));logger[_0x723c('0xe')](_0x723c('0xf'),_0x3f7bcb,_0x723c('0xd'),JSON[_0x723c('0x10')](_0x108a80));if(_0x108a80[_0x723c('0x11')]){if(_0x108a80['error'][_0x723c('0x12')]===0x1f4){logger[_0x723c('0x11')]('VoiceMail,\x20%s,\x20%s',_0x3f7bcb,_0x108a80['error']['message']);return _0x5e0099(_0x108a80[_0x723c('0x11')]['message']);}logger[_0x723c('0x11')](_0x723c('0x13'),_0x3f7bcb,_0x108a80['error'][_0x723c('0x14')]);return _0x41dfb9(_0x108a80[_0x723c('0x11')][_0x723c('0x14')]);}else{logger['info'](_0x723c('0x13'),_0x3f7bcb,_0x723c('0xd'));_0x41dfb9(_0x108a80[_0x723c('0x15')]['message']);}})[_0x723c('0x16')](function(_0x4e3a75){logger[_0x723c('0x11')](_0x723c('0x13'),_0x3f7bcb,_0x4e3a75);_0x5e0099(_0x4e3a75);});});} \ No newline at end of file +var _0xd42e=['VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x1493a6,_0x4b92af){var _0x3e9893=function(_0x48bca3){while(--_0x48bca3){_0x1493a6['push'](_0x1493a6['shift']());}};_0x3e9893(++_0x4b92af);}(_0xd42e,0x10b));var _0xed42=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xd42e[_0x585d81];return _0x1aca0d;};'use strict';var _=require(_0xed42('0x0'));var util=require(_0xed42('0x1'));var moment=require(_0xed42('0x2'));var BPromise=require(_0xed42('0x3'));var rs=require(_0xed42('0x4'));var fs=require('fs');var Redis=require(_0xed42('0x5'));var db=require(_0xed42('0x6'))['db'];var utils=require(_0xed42('0x7'));var logger=require(_0xed42('0x8'))(_0xed42('0x9'));var config=require(_0xed42('0xa'));var jayson=require(_0xed42('0xb'));var client=jayson[_0xed42('0xc')][_0xed42('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c693c,_0x3796f1,_0x75be60){return new BPromise(function(_0x21e615,_0x5c84a8){return client[_0xed42('0xe')](_0x2c693c,_0x75be60)[_0xed42('0xf')](function(_0x4c3cc6){logger[_0xed42('0x10')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0xed42('0x11'));logger[_0xed42('0x12')](_0xed42('0x13'),_0x3796f1,_0xed42('0x11'),JSON['stringify'](_0x4c3cc6));if(_0x4c3cc6[_0xed42('0x14')]){if(_0x4c3cc6[_0xed42('0x14')][_0xed42('0x15')]===0x1f4){logger[_0xed42('0x14')](_0xed42('0x16'),_0x3796f1,_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);return _0x5c84a8(_0x4c3cc6['error'][_0xed42('0x17')]);}logger[_0xed42('0x14')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);return _0x21e615(_0x4c3cc6[_0xed42('0x14')][_0xed42('0x17')]);}else{logger[_0xed42('0x10')](_0xed42('0x16'),_0x3796f1,'request\x20sent');_0x21e615(_0x4c3cc6[_0xed42('0x18')][_0xed42('0x17')]);}})[_0xed42('0x19')](function(_0x3609b8){logger[_0xed42('0x14')]('VoiceMail,\x20%s,\x20%s',_0x3796f1,_0x3609b8);_0x5c84a8(_0x3609b8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 42db2a8..13e0811 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 _0xbe08=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','delete','destroy','multer','util','path'];(function(_0x32dd14,_0x4248ca){var _0x33e13b=function(_0x247d57){while(--_0x247d57){_0x32dd14['push'](_0x32dd14['shift']());}};_0x33e13b(++_0x4248ca);}(_0xbe08,0x123));var _0x8be0=function(_0x5eba39,_0x30160a){_0x5eba39=_0x5eba39-0x0;var _0x17dad7=_0xbe08[_0x5eba39];return _0x17dad7;};'use strict';var multer=require(_0x8be0('0x0'));var util=require(_0x8be0('0x1'));var path=require(_0x8be0('0x2'));var timeout=require(_0x8be0('0x3'));var express=require('express');var router=express[_0x8be0('0x4')]();var fs_extra=require(_0x8be0('0x5'));var auth=require(_0x8be0('0x6'));var interaction=require(_0x8be0('0x7'));var config=require(_0x8be0('0x8'));var controller=require(_0x8be0('0x9'));router[_0x8be0('0xa')]('/',auth[_0x8be0('0xb')](),controller[_0x8be0('0xc')]);router[_0x8be0('0xa')](_0x8be0('0xd'),auth[_0x8be0('0xb')](),controller[_0x8be0('0xe')]);router[_0x8be0('0xa')](_0x8be0('0xf'),auth[_0x8be0('0xb')](),controller[_0x8be0('0x10')]);router[_0x8be0('0x11')]('/',auth[_0x8be0('0xb')](),controller['create']);router[_0x8be0('0x12')](_0x8be0('0xd'),auth[_0x8be0('0xb')](),controller['update']);router[_0x8be0('0x13')]('/:id',auth[_0x8be0('0xb')](),controller[_0x8be0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xcc60=['download','post','create','put','/:id','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/download'];(function(_0x8fa072,_0x4d9ca6){var _0x1b5f89=function(_0x23c013){while(--_0x23c013){_0x8fa072['push'](_0x8fa072['shift']());}};_0x1b5f89(++_0x4d9ca6);}(_0xcc60,0x1a8));var _0x0cc6=function(_0x14e18e,_0x1cc1fb){_0x14e18e=_0x14e18e-0x0;var _0x3871ad=_0xcc60[_0x14e18e];return _0x3871ad;};'use strict';var multer=require(_0x0cc6('0x0'));var util=require(_0x0cc6('0x1'));var path=require('path');var timeout=require(_0x0cc6('0x2'));var express=require(_0x0cc6('0x3'));var router=express[_0x0cc6('0x4')]();var fs_extra=require(_0x0cc6('0x5'));var auth=require(_0x0cc6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cc6('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0x9')]);router[_0x0cc6('0xa')]('/:id',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xb')]);router[_0x0cc6('0xa')](_0x0cc6('0xc'),auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xd')]);router[_0x0cc6('0xe')]('/',auth[_0x0cc6('0x8')](),controller[_0x0cc6('0xf')]);router[_0x0cc6('0x10')](_0x0cc6('0x11'),auth['isAuthenticated'](),controller[_0x0cc6('0x12')]);router['delete'](_0x0cc6('0x11'),auth['isAuthenticated'](),controller['destroy']);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 181bb2a..764f79a 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 _0x7ff6=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING','TIMESTAMP'];(function(_0x450b65,_0x215093){var _0x50d8ba=function(_0x529585){while(--_0x529585){_0x450b65['push'](_0x450b65['shift']());}};_0x50d8ba(++_0x215093);}(_0x7ff6,0x1a5));var _0x67ff=function(_0x2432bd,_0x30c2a4){_0x2432bd=_0x2432bd-0x0;var _0x702855=_0x7ff6[_0x2432bd];return _0x702855;};'use strict';var Sequelize=require(_0x67ff('0x0'));module[_0x67ff('0x1')]={'name':{'type':Sequelize[_0x67ff('0x2')],'get':function(_0x2dfcdc){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x67ff('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x67ff('0x4')],'defaultValue':''},'stamp':{'type':_0x67ff('0x5'),'defaultValue':Sequelize['literal'](_0x67ff('0x6'))}}; \ No newline at end of file +var _0xdc40=['sequelize','exports','VIRTUAL','STRING','long','TIMESTAMP','literal'];(function(_0xfc2da6,_0x1206d9){var _0x3974d8=function(_0x1580e0){while(--_0x1580e0){_0xfc2da6['push'](_0xfc2da6['shift']());}};_0x3974d8(++_0x1206d9);}(_0xdc40,0x1b9));var _0x0dc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdc40[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0dc4('0x0'));module[_0x0dc4('0x1')]={'name':{'type':Sequelize[_0x0dc4('0x2')],'get':function(_0x39e26b){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x0dc4('0x4')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0dc4('0x3')],'defaultValue':''},'stamp':{'type':_0x0dc4('0x5'),'defaultValue':Sequelize[_0x0dc4('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 20ad4db..c4831a3 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 _0xff19=['VoiceMailMessage\x20not\x20found','Content-Disposition','.wav\x22','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','keys','find','catch','create','body','destroy','msg_id','recording','Sequelize'];(function(_0x66ee22,_0x3fced6){var _0x7a8f76=function(_0x3ed427){while(--_0x3ed427){_0x66ee22['push'](_0x66ee22['shift']());}};_0x7a8f76(++_0x3fced6);}(_0xff19,0x1ef));var _0x9ff1=function(_0x55eb1d,_0x416562){_0x55eb1d=_0x55eb1d-0x0;var _0x3080f4=_0xff19[_0x55eb1d];return _0x3080f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ff1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ff1('0x1'));var rp=require(_0x9ff1('0x2'));var moment=require(_0x9ff1('0x3'));var BPromise=require(_0x9ff1('0x4'));var Mustache=require('mustache');var util=require(_0x9ff1('0x5'));var path=require(_0x9ff1('0x6'));var sox=require(_0x9ff1('0x7'));var csv=require('to-csv');var ejs=require(_0x9ff1('0x8'));var fs=require('fs');var fs_extra=require(_0x9ff1('0x9'));var _=require('lodash');var squel=require(_0x9ff1('0xa'));var crypto=require(_0x9ff1('0xb'));var jsforce=require(_0x9ff1('0xc'));var deskjs=require(_0x9ff1('0xd'));var toCsv=require(_0x9ff1('0xe'));var querystring=require(_0x9ff1('0xf'));var Papa=require('papaparse');var Redis=require(_0x9ff1('0x10'));var authService=require(_0x9ff1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ff1('0x12'));var hardwareService=require(_0x9ff1('0x13'));var logger=require(_0x9ff1('0x14'))(_0x9ff1('0x15'));var utils=require(_0x9ff1('0x16'));var config=require(_0x9ff1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ff1('0x18'))['db'];function respondWithStatusCode(_0xdd124a,_0x36fe9d){_0x36fe9d=_0x36fe9d||0xcc;return function(_0x2ab5b7){if(_0x2ab5b7){return _0xdd124a['sendStatus'](_0x36fe9d);}return _0xdd124a[_0x9ff1('0x19')](_0x36fe9d)[_0x9ff1('0x1a')]();};}function respondWithResult(_0x46d40e,_0x53e53a){_0x53e53a=_0x53e53a||0xc8;return function(_0x17a900){if(_0x17a900){return _0x46d40e[_0x9ff1('0x19')](_0x53e53a)[_0x9ff1('0x1b')](_0x17a900);}};}function respondWithFilteredResult(_0x42d7c1,_0x23db54){return function(_0x15127d){if(_0x15127d){var _0x6bec8=typeof _0x23db54[_0x9ff1('0x1c')]===_0x9ff1('0x1d')&&typeof _0x23db54['limit']==='undefined';var _0x5ad7dd=_0x15127d[_0x9ff1('0x1e')];var _0x41f917=_0x6bec8?0x0:_0x23db54[_0x9ff1('0x1c')];var _0x3cec5a=_0x6bec8?_0x15127d[_0x9ff1('0x1e')]:_0x23db54[_0x9ff1('0x1c')]+_0x23db54['limit'];var _0x71f5c8;if(_0x3cec5a>=_0x5ad7dd){_0x3cec5a=_0x5ad7dd;_0x71f5c8=0xc8;}else{_0x71f5c8=0xce;}_0x42d7c1['status'](_0x71f5c8);return _0x42d7c1[_0x9ff1('0x1f')](_0x9ff1('0x20'),_0x41f917+'-'+_0x3cec5a+'/'+_0x5ad7dd)[_0x9ff1('0x1b')](_0x15127d);}return null;};}function patchUpdates(_0x5d05d6){return function(_0x3f397a){try{jsonpatch['apply'](_0x3f397a,_0x5d05d6,!![]);}catch(_0x59155d){return BPromise[_0x9ff1('0x21')](_0x59155d);}return _0x3f397a[_0x9ff1('0x22')]();};}function saveUpdates(_0x3421b7,_0x3a7096){return function(_0x3991cf){if(_0x3991cf){return _0x3991cf[_0x9ff1('0x23')](_0x3421b7)[_0x9ff1('0x24')](function(_0x3f1e2d){return _0x3f1e2d;});}return null;};}function removeEntity(_0x2c2835,_0x47ac05){return function(_0x432e06){if(_0x432e06){return _0x432e06['destroy']()[_0x9ff1('0x24')](function(){_0x2c2835['status'](0xcc)[_0x9ff1('0x1a')]();});}};}function handleEntityNotFound(_0x230271,_0x1bab02){return function(_0x28fdad){if(!_0x28fdad){_0x230271[_0x9ff1('0x25')](0x194);}return _0x28fdad;};}function handleError(_0x171ee3,_0x38d43c){_0x38d43c=_0x38d43c||0x1f4;return function(_0x2f2e8c){logger['error'](_0x2f2e8c[_0x9ff1('0x26')]);if(_0x2f2e8c[_0x9ff1('0x27')]){delete _0x2f2e8c['name'];}_0x171ee3[_0x9ff1('0x19')](_0x38d43c)[_0x9ff1('0x28')](_0x2f2e8c);};}exports[_0x9ff1('0x29')]=function(_0x46c9b8,_0x1439ba){var _0x19b8c2={},_0x9546e2={},_0x5c9685={'count':0x0,'rows':[]};var _0x3e8a34=_[_0x9ff1('0x2a')](db[_0x9ff1('0x2b')]['rawAttributes'],function(_0x125f39){return{'name':_0x125f39[_0x9ff1('0x2c')],'type':_0x125f39[_0x9ff1('0x2d')][_0x9ff1('0x2e')]};});_0x9546e2['model']=_[_0x9ff1('0x2f')](_[_0x9ff1('0x2a')](_0x3e8a34,_0x9ff1('0x27')),[_0x9ff1('0x27')]);_0x9546e2['query']=_['keys'](_0x46c9b8[_0x9ff1('0x30')]);_0x9546e2[_0x9ff1('0x31')]=_[_0x9ff1('0x32')](_0x9546e2[_0x9ff1('0x33')],_0x9546e2['query']);_0x19b8c2[_0x9ff1('0x34')]=_[_0x9ff1('0x32')](_0x9546e2[_0x9ff1('0x33')],qs[_0x9ff1('0x35')](_0x46c9b8['query']['fields']));_0x19b8c2[_0x9ff1('0x34')]=_0x19b8c2['attributes'][_0x9ff1('0x36')]?_0x19b8c2['attributes']:_0x9546e2[_0x9ff1('0x33')];if(!_0x46c9b8['query'][_0x9ff1('0x37')](_0x9ff1('0x38'))){_0x19b8c2['limit']=qs['limit'](_0x46c9b8[_0x9ff1('0x30')][_0x9ff1('0x39')]);_0x19b8c2['offset']=qs[_0x9ff1('0x1c')](_0x46c9b8[_0x9ff1('0x30')]['offset']);}_0x19b8c2['order']=qs[_0x9ff1('0x3a')](_0x46c9b8[_0x9ff1('0x30')]['sort']);_0x19b8c2[_0x9ff1('0x3b')]=qs[_0x9ff1('0x31')](_[_0x9ff1('0x3c')](_0x46c9b8[_0x9ff1('0x30')],_0x9546e2[_0x9ff1('0x31')]),_0x3e8a34);if(_0x46c9b8[_0x9ff1('0x30')]['filter']){_0x19b8c2[_0x9ff1('0x3b')]=_[_0x9ff1('0x3d')](_0x19b8c2['where'],{'$or':_[_0x9ff1('0x2a')](_0x3e8a34,function(_0x48ba96){if(_0x48ba96[_0x9ff1('0x2d')]!==_0x9ff1('0x3e')){var _0x470f3c={};_0x470f3c[_0x48ba96[_0x9ff1('0x27')]]={'$like':'%'+_0x46c9b8['query']['filter']+'%'};return _0x470f3c;}})});}_0x19b8c2=_[_0x9ff1('0x3d')]({},_0x19b8c2,_0x46c9b8[_0x9ff1('0x3f')]);var _0x31ad92={'where':_0x19b8c2[_0x9ff1('0x3b')]};return db[_0x9ff1('0x2b')][_0x9ff1('0x1e')](_0x31ad92)[_0x9ff1('0x24')](function(_0x586a29){_0x5c9685[_0x9ff1('0x1e')]=_0x586a29;if(_0x46c9b8['query'][_0x9ff1('0x40')]){_0x19b8c2[_0x9ff1('0x41')]=[{'all':!![]}];}return db[_0x9ff1('0x2b')][_0x9ff1('0x42')](_0x19b8c2);})['then'](function(_0x33947c){_0x5c9685['rows']=_0x33947c;return _0x5c9685;})[_0x9ff1('0x24')](respondWithFilteredResult(_0x1439ba,_0x19b8c2))['catch'](handleError(_0x1439ba,null));};exports[_0x9ff1('0x43')]=function(_0x730009,_0x186051){var _0x479aae={'raw':!![],'where':{'id':_0x730009[_0x9ff1('0x44')]['id']}},_0x59b0cd={};_0x59b0cd['model']=_['keys'](db[_0x9ff1('0x2b')][_0x9ff1('0x45')]);_0x59b0cd[_0x9ff1('0x30')]=_[_0x9ff1('0x46')](_0x730009[_0x9ff1('0x30')]);_0x59b0cd[_0x9ff1('0x31')]=_[_0x9ff1('0x32')](_0x59b0cd[_0x9ff1('0x33')],_0x59b0cd[_0x9ff1('0x30')]);_0x479aae[_0x9ff1('0x34')]=_['intersection'](_0x59b0cd[_0x9ff1('0x33')],qs['fields'](_0x730009[_0x9ff1('0x30')][_0x9ff1('0x35')]));_0x479aae['attributes']=_0x479aae[_0x9ff1('0x34')][_0x9ff1('0x36')]?_0x479aae['attributes']:_0x59b0cd[_0x9ff1('0x33')];if(_0x730009[_0x9ff1('0x30')][_0x9ff1('0x40')]){_0x479aae[_0x9ff1('0x41')]=[{'all':!![]}];}_0x479aae=_[_0x9ff1('0x3d')]({},_0x479aae,_0x730009[_0x9ff1('0x3f')]);return db['VoiceMailMessage'][_0x9ff1('0x47')](_0x479aae)[_0x9ff1('0x24')](handleEntityNotFound(_0x186051,null))[_0x9ff1('0x24')](respondWithResult(_0x186051,null))[_0x9ff1('0x48')](handleError(_0x186051,null));};exports[_0x9ff1('0x49')]=function(_0x450a0b,_0x51c397){return db[_0x9ff1('0x2b')]['create'](_0x450a0b['body'],{})[_0x9ff1('0x24')](respondWithResult(_0x51c397,0xc9))['catch'](handleError(_0x51c397,null));};exports[_0x9ff1('0x23')]=function(_0x3f2ac7,_0x79d6af){if(_0x3f2ac7[_0x9ff1('0x4a')]['id']){delete _0x3f2ac7[_0x9ff1('0x4a')]['id'];}return db[_0x9ff1('0x2b')][_0x9ff1('0x47')]({'where':{'id':_0x3f2ac7[_0x9ff1('0x44')]['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x79d6af,null))['then'](saveUpdates(_0x3f2ac7[_0x9ff1('0x4a')],null))[_0x9ff1('0x24')](respondWithResult(_0x79d6af,null))['catch'](handleError(_0x79d6af,null));};exports[_0x9ff1('0x4b')]=function(_0x24a5b0,_0x52acda){return db[_0x9ff1('0x2b')][_0x9ff1('0x47')]({'where':{'id':_0x24a5b0['params']['id']}})[_0x9ff1('0x24')](handleEntityNotFound(_0x52acda,null))[_0x9ff1('0x24')](removeEntity(_0x52acda,null))[_0x9ff1('0x48')](handleError(_0x52acda,null));};exports['download']=function(_0x3bfdf3,_0x283205,_0x3b22d6){return db['VoiceMailMessage'][_0x9ff1('0x47')]({'where':{'id':_0x3bfdf3[_0x9ff1('0x44')]['id']},'attributes':['id','recording',_0x9ff1('0x4c')]})[_0x9ff1('0x24')](handleEntityNotFound(_0x283205,null))['then'](function(_0x3b8043){if(_0x3b8043){if(!_0x3b8043[_0x9ff1('0x4d')]){throw new db[(_0x9ff1('0x4e'))]['ValidationError'](_0x9ff1('0x4f'));}var _0x27bbd8={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x3b8043[_0x9ff1('0x4c')]){_0x27bbd8[_0x9ff1('0x50')]='attachment;\x20filename=\x22'+_0x3b8043['msg_id']+_0x9ff1('0x51');}_0x283205[_0x9ff1('0x1f')](_0x27bbd8);return _0x283205[_0x9ff1('0x28')](new Buffer(_0x3b8043['recording']));}})[_0x9ff1('0x48')](handleError(_0x283205,null));}; \ No newline at end of file +var _0xe590=['rawAttributes','fields','length','options','find','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','name','VoiceMailMessage','fieldName','type','model','map','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params'];(function(_0x11d7c9,_0x11549a){var _0x278e53=function(_0x427769){while(--_0x427769){_0x11d7c9['push'](_0x11d7c9['shift']());}};_0x278e53(++_0x11549a);}(_0xe590,0xaf));var _0x0e59=function(_0x40f52b,_0x522fd4){_0x40f52b=_0x40f52b-0x0;var _0x3afe11=_0xe590[_0x40f52b];return _0x3afe11;};'use strict';var emlformat=require(_0x0e59('0x0'));var rimraf=require(_0x0e59('0x1'));var zipdir=require(_0x0e59('0x2'));var jsonpatch=require(_0x0e59('0x3'));var rp=require(_0x0e59('0x4'));var moment=require('moment');var BPromise=require(_0x0e59('0x5'));var Mustache=require(_0x0e59('0x6'));var util=require(_0x0e59('0x7'));var path=require(_0x0e59('0x8'));var sox=require(_0x0e59('0x9'));var csv=require('to-csv');var ejs=require(_0x0e59('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0e59('0xb'));var crypto=require(_0x0e59('0xc'));var jsforce=require(_0x0e59('0xd'));var deskjs=require(_0x0e59('0xe'));var toCsv=require(_0x0e59('0xf'));var querystring=require(_0x0e59('0x10'));var Papa=require(_0x0e59('0x11'));var Redis=require(_0x0e59('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e59('0x13'));var hardwareService=require(_0x0e59('0x14'));var logger=require('../../config/logger')(_0x0e59('0x15'));var utils=require('../../config/utils');var config=require(_0x0e59('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e59('0x17'))['db'];function respondWithStatusCode(_0x2c0482,_0x587b2e){_0x587b2e=_0x587b2e||0xcc;return function(_0x4c627d){if(_0x4c627d){return _0x2c0482[_0x0e59('0x18')](_0x587b2e);}return _0x2c0482['status'](_0x587b2e)[_0x0e59('0x19')]();};}function respondWithResult(_0x55b310,_0x259611){_0x259611=_0x259611||0xc8;return function(_0x102116){if(_0x102116){return _0x55b310[_0x0e59('0x1a')](_0x259611)[_0x0e59('0x1b')](_0x102116);}};}function respondWithFilteredResult(_0x12aa9d,_0x2f3c05){return function(_0x5054ad){if(_0x5054ad){var _0x4c490a=typeof _0x2f3c05[_0x0e59('0x1c')]===_0x0e59('0x1d')&&typeof _0x2f3c05[_0x0e59('0x1e')]===_0x0e59('0x1d');var _0x9fbbb5=_0x5054ad[_0x0e59('0x1f')];var _0xcc2daa=_0x4c490a?0x0:_0x2f3c05[_0x0e59('0x1c')];var _0xb4b188=_0x4c490a?_0x5054ad[_0x0e59('0x1f')]:_0x2f3c05[_0x0e59('0x1c')]+_0x2f3c05['limit'];var _0xf4fa93;if(_0xb4b188>=_0x9fbbb5){_0xb4b188=_0x9fbbb5;_0xf4fa93=0xc8;}else{_0xf4fa93=0xce;}_0x12aa9d[_0x0e59('0x1a')](_0xf4fa93);return _0x12aa9d['set']('Content-Range',_0xcc2daa+'-'+_0xb4b188+'/'+_0x9fbbb5)[_0x0e59('0x1b')](_0x5054ad);}return null;};}function patchUpdates(_0x11cdfd){return function(_0x4b5714){try{jsonpatch[_0x0e59('0x20')](_0x4b5714,_0x11cdfd,!![]);}catch(_0x1e4db7){return BPromise[_0x0e59('0x21')](_0x1e4db7);}return _0x4b5714[_0x0e59('0x22')]();};}function saveUpdates(_0x2ecd14,_0x2a4294){return function(_0x22c799){if(_0x22c799){return _0x22c799[_0x0e59('0x23')](_0x2ecd14)[_0x0e59('0x24')](function(_0x5d7a0b){return _0x5d7a0b;});}return null;};}function removeEntity(_0x556ef2,_0x1e58bb){return function(_0x5b41a2){if(_0x5b41a2){return _0x5b41a2[_0x0e59('0x25')]()[_0x0e59('0x24')](function(){_0x556ef2[_0x0e59('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42edbc,_0x23ff98){return function(_0x33b4d1){if(!_0x33b4d1){_0x42edbc[_0x0e59('0x18')](0x194);}return _0x33b4d1;};}function handleError(_0x31400c,_0x100916){_0x100916=_0x100916||0x1f4;return function(_0x22a843){logger['error'](_0x22a843['stack']);if(_0x22a843[_0x0e59('0x26')]){delete _0x22a843['name'];}_0x31400c[_0x0e59('0x1a')](_0x100916)['send'](_0x22a843);};}exports['index']=function(_0x45177e,_0x9682fa){var _0x59209e={},_0x3c9a61={},_0x200251={'count':0x0,'rows':[]};var _0x3a2fce=_['map'](db[_0x0e59('0x27')]['rawAttributes'],function(_0x51dbc1){return{'name':_0x51dbc1[_0x0e59('0x28')],'type':_0x51dbc1[_0x0e59('0x29')]['key']};});_0x3c9a61[_0x0e59('0x2a')]=_['differenceBy'](_[_0x0e59('0x2b')](_0x3a2fce,_0x0e59('0x26')),['name']);_0x3c9a61['query']=_[_0x0e59('0x2c')](_0x45177e[_0x0e59('0x2d')]);_0x3c9a61[_0x0e59('0x2e')]=_['intersection'](_0x3c9a61[_0x0e59('0x2a')],_0x3c9a61[_0x0e59('0x2d')]);_0x59209e[_0x0e59('0x2f')]=_[_0x0e59('0x30')](_0x3c9a61[_0x0e59('0x2a')],qs['fields'](_0x45177e['query']['fields']));_0x59209e[_0x0e59('0x2f')]=_0x59209e[_0x0e59('0x2f')]['length']?_0x59209e[_0x0e59('0x2f')]:_0x3c9a61[_0x0e59('0x2a')];if(!_0x45177e[_0x0e59('0x2d')][_0x0e59('0x31')](_0x0e59('0x32'))){_0x59209e[_0x0e59('0x1e')]=qs[_0x0e59('0x1e')](_0x45177e['query'][_0x0e59('0x1e')]);_0x59209e[_0x0e59('0x1c')]=qs[_0x0e59('0x1c')](_0x45177e[_0x0e59('0x2d')]['offset']);}_0x59209e['order']=qs['sort'](_0x45177e[_0x0e59('0x2d')][_0x0e59('0x33')]);_0x59209e[_0x0e59('0x34')]=qs[_0x0e59('0x2e')](_[_0x0e59('0x35')](_0x45177e[_0x0e59('0x2d')],_0x3c9a61[_0x0e59('0x2e')]),_0x3a2fce);if(_0x45177e[_0x0e59('0x2d')][_0x0e59('0x36')]){_0x59209e[_0x0e59('0x34')]=_[_0x0e59('0x37')](_0x59209e[_0x0e59('0x34')],{'$or':_[_0x0e59('0x2b')](_0x3a2fce,function(_0x4810d3){if(_0x4810d3[_0x0e59('0x29')]!==_0x0e59('0x38')){var _0x1fe9ca={};_0x1fe9ca[_0x4810d3[_0x0e59('0x26')]]={'$like':'%'+_0x45177e[_0x0e59('0x2d')][_0x0e59('0x36')]+'%'};return _0x1fe9ca;}})});}_0x59209e=_['merge']({},_0x59209e,_0x45177e['options']);var _0x33a645={'where':_0x59209e['where']};return db['VoiceMailMessage'][_0x0e59('0x1f')](_0x33a645)[_0x0e59('0x24')](function(_0x3cd13c){_0x200251['count']=_0x3cd13c;if(_0x45177e['query'][_0x0e59('0x39')]){_0x59209e[_0x0e59('0x3a')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x59209e);})[_0x0e59('0x24')](function(_0x5e2047){_0x200251[_0x0e59('0x3b')]=_0x5e2047;return _0x200251;})[_0x0e59('0x24')](respondWithFilteredResult(_0x9682fa,_0x59209e))[_0x0e59('0x3c')](handleError(_0x9682fa,null));};exports['show']=function(_0x599b7f,_0x5da923){var _0x3405d2={'raw':!![],'where':{'id':_0x599b7f[_0x0e59('0x3d')]['id']}},_0x5674d9={};_0x5674d9[_0x0e59('0x2a')]=_['keys'](db['VoiceMailMessage'][_0x0e59('0x3e')]);_0x5674d9[_0x0e59('0x2d')]=_[_0x0e59('0x2c')](_0x599b7f[_0x0e59('0x2d')]);_0x5674d9[_0x0e59('0x2e')]=_['intersection'](_0x5674d9[_0x0e59('0x2a')],_0x5674d9[_0x0e59('0x2d')]);_0x3405d2[_0x0e59('0x2f')]=_[_0x0e59('0x30')](_0x5674d9[_0x0e59('0x2a')],qs[_0x0e59('0x3f')](_0x599b7f[_0x0e59('0x2d')][_0x0e59('0x3f')]));_0x3405d2[_0x0e59('0x2f')]=_0x3405d2[_0x0e59('0x2f')][_0x0e59('0x40')]?_0x3405d2[_0x0e59('0x2f')]:_0x5674d9[_0x0e59('0x2a')];if(_0x599b7f[_0x0e59('0x2d')]['includeAll']){_0x3405d2[_0x0e59('0x3a')]=[{'all':!![]}];}_0x3405d2=_[_0x0e59('0x37')]({},_0x3405d2,_0x599b7f[_0x0e59('0x41')]);return db[_0x0e59('0x27')][_0x0e59('0x42')](_0x3405d2)[_0x0e59('0x24')](handleEntityNotFound(_0x5da923,null))[_0x0e59('0x24')](respondWithResult(_0x5da923,null))[_0x0e59('0x3c')](handleError(_0x5da923,null));};exports['create']=function(_0x5ceda3,_0x235fd0){return db[_0x0e59('0x27')]['create'](_0x5ceda3['body'],{})[_0x0e59('0x24')](respondWithResult(_0x235fd0,0xc9))['catch'](handleError(_0x235fd0,null));};exports[_0x0e59('0x23')]=function(_0x1299e7,_0x21116b){if(_0x1299e7['body']['id']){delete _0x1299e7[_0x0e59('0x43')]['id'];}return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x1299e7[_0x0e59('0x3d')]['id']}})[_0x0e59('0x24')](handleEntityNotFound(_0x21116b,null))[_0x0e59('0x24')](saveUpdates(_0x1299e7[_0x0e59('0x43')],null))[_0x0e59('0x24')](respondWithResult(_0x21116b,null))['catch'](handleError(_0x21116b,null));};exports[_0x0e59('0x25')]=function(_0x301950,_0x5fcc12){return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x301950[_0x0e59('0x3d')]['id']}})[_0x0e59('0x24')](handleEntityNotFound(_0x5fcc12,null))[_0x0e59('0x24')](removeEntity(_0x5fcc12,null))['catch'](handleError(_0x5fcc12,null));};exports['download']=function(_0x500191,_0x492975,_0x5a461f){return db[_0x0e59('0x27')][_0x0e59('0x42')]({'where':{'id':_0x500191['params']['id']},'attributes':['id',_0x0e59('0x44'),_0x0e59('0x45')]})[_0x0e59('0x24')](handleEntityNotFound(_0x492975,null))[_0x0e59('0x24')](function(_0x5b1583){if(_0x5b1583){if(!_0x5b1583[_0x0e59('0x44')]){throw new db['Sequelize'][(_0x0e59('0x46'))](_0x0e59('0x47'));}var _0x3dca09={'Content-Type':_0x0e59('0x48'),'Content-Disposition':_0x0e59('0x49')};if(_0x5b1583['msg_id']){_0x3dca09[_0x0e59('0x4a')]=_0x0e59('0x4b')+_0x5b1583[_0x0e59('0x45')]+_0x0e59('0x4c');}_0x492975[_0x0e59('0x4d')](_0x3dca09);return _0x492975[_0x0e59('0x4e')](new Buffer(_0x5b1583['recording']));}})[_0x0e59('0x3c')](handleError(_0x492975,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index bdf5822..222bb5d 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 _0x3598=['./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x47ddea,_0x2bdb69){var _0x4383aa=function(_0x17292c){while(--_0x17292c){_0x47ddea['push'](_0x47ddea['shift']());}};_0x4383aa(++_0x2bdb69);}(_0x3598,0x157));var _0x8359=function(_0x186b88,_0xdee6ca){_0x186b88=_0x186b88-0x0;var _0x835d0c=_0x3598[_0x186b88];return _0x835d0c;};'use strict';var _=require(_0x8359('0x0'));var util=require(_0x8359('0x1'));var logger=require('../../config/logger')(_0x8359('0x2'));var moment=require(_0x8359('0x3'));var BPromise=require('bluebird');var rp=require(_0x8359('0x4'));var fs=require('fs');var path=require(_0x8359('0x5'));var rimraf=require(_0x8359('0x6'));var config=require(_0x8359('0x7'));var attributes=require(_0x8359('0x8'));module[_0x8359('0x9')]=function(_0xf75c30,_0x4c4f97){return _0xf75c30['define'](_0x8359('0xa'),attributes,{'tableName':_0x8359('0xb'),'paranoid':![],'indexes':[{'name':_0x8359('0xc'),'fields':[_0x8359('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x52ba=['voice_voicemail_messages','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage'];(function(_0x4cb5d1,_0xab4936){var _0x2226ed=function(_0x5b0120){while(--_0x5b0120){_0x4cb5d1['push'](_0x4cb5d1['shift']());}};_0x2226ed(++_0xab4936);}(_0x52ba,0x121));var _0xa52b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x52ba[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xa52b('0x0'));var logger=require(_0xa52b('0x1'))('api');var moment=require(_0xa52b('0x2'));var BPromise=require(_0xa52b('0x3'));var rp=require(_0xa52b('0x4'));var fs=require('fs');var path=require(_0xa52b('0x5'));var rimraf=require(_0xa52b('0x6'));var config=require(_0xa52b('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xa52b('0x8')]=function(_0x4185b0,_0x3a4cfa){return _0x4185b0[_0xa52b('0x9')](_0xa52b('0xa'),attributes,{'tableName':_0xa52b('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a132a6a..ac5c337 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 _0xc218=['then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','info','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xc218,0x6c));var _0x8c21=function(_0x4f852f,_0xfef88b){_0x4f852f=_0x4f852f-0x0;var _0x5d5de1=_0xc218[_0x4f852f];return _0x5d5de1;};'use strict';var _=require(_0x8c21('0x0'));var util=require(_0x8c21('0x1'));var moment=require(_0x8c21('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c21('0x3'))['db'];var utils=require(_0x8c21('0x4'));var logger=require(_0x8c21('0x5'))(_0x8c21('0x6'));var config=require(_0x8c21('0x7'));var jayson=require(_0x8c21('0x8'));var client=jayson[_0x8c21('0x9')][_0x8c21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11beae,_0x4c6e43,_0x5619aa){return new BPromise(function(_0x5c8a39,_0x33c8b2){return client[_0x8c21('0xb')](_0x11beae,_0x5619aa)[_0x8c21('0xc')](function(_0x1695d9){logger['info'](_0x8c21('0xd'),_0x4c6e43,_0x8c21('0xe'));logger[_0x8c21('0xf')](_0x8c21('0x10'),_0x4c6e43,_0x8c21('0xe'),JSON['stringify'](_0x1695d9));if(_0x1695d9[_0x8c21('0x11')]){if(_0x1695d9['error']['code']===0x1f4){logger['error'](_0x8c21('0xd'),_0x4c6e43,_0x1695d9[_0x8c21('0x11')]['message']);return _0x33c8b2(_0x1695d9[_0x8c21('0x11')]['message']);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4c6e43,_0x1695d9['error']['message']);return _0x5c8a39(_0x1695d9[_0x8c21('0x11')]['message']);}else{logger[_0x8c21('0x12')](_0x8c21('0xd'),_0x4c6e43,_0x8c21('0xe'));_0x5c8a39(_0x1695d9['result']['message']);}})[_0x8c21('0x13')](function(_0x5e7641){logger[_0x8c21('0x11')](_0x8c21('0xd'),_0x4c6e43,_0x5e7641);_0x33c8b2(_0x5e7641);});});} \ No newline at end of file +var _0xc7ee=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x152970,_0x535b63){var _0x3ea32d=function(_0x3a2abb){while(--_0x3a2abb){_0x152970['push'](_0x152970['shift']());}};_0x3ea32d(++_0x535b63);}(_0xc7ee,0xbc));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xec7e('0x0'));var util=require(_0xec7e('0x1'));var moment=require(_0xec7e('0x2'));var BPromise=require(_0xec7e('0x3'));var rs=require(_0xec7e('0x4'));var fs=require('fs');var Redis=require(_0xec7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec7e('0x6'))('rpc');var config=require(_0xec7e('0x7'));var jayson=require(_0xec7e('0x8'));var client=jayson[_0xec7e('0x9')][_0xec7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c3f81,_0x506693,_0x99e6c5){return new BPromise(function(_0x56ddca,_0x2ae11b){return client[_0xec7e('0xb')](_0x1c3f81,_0x99e6c5)['then'](function(_0xf91c31){logger[_0xec7e('0xc')](_0xec7e('0xd'),_0x506693,_0xec7e('0xe'));logger[_0xec7e('0xf')](_0xec7e('0x10'),_0x506693,'request\x20sent',JSON[_0xec7e('0x11')](_0xf91c31));if(_0xf91c31[_0xec7e('0x12')]){if(_0xf91c31['error']['code']===0x1f4){logger['error'](_0xec7e('0xd'),_0x506693,_0xf91c31['error'][_0xec7e('0x13')]);return _0x2ae11b(_0xf91c31[_0xec7e('0x12')][_0xec7e('0x13')]);}logger[_0xec7e('0x12')](_0xec7e('0xd'),_0x506693,_0xf91c31['error'][_0xec7e('0x13')]);return _0x56ddca(_0xf91c31[_0xec7e('0x12')]['message']);}else{logger[_0xec7e('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x506693,'request\x20sent');_0x56ddca(_0xf91c31['result'][_0xec7e('0x13')]);}})['catch'](function(_0x59c7ce){logger[_0xec7e('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x506693,_0x59c7ce);_0x2ae11b(_0x59c7ce);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index ea59008..1d1c145 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 _0x2651=['removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x3e66b3,_0x27b8f0){var _0x26ffac=function(_0x5d8d3f){while(--_0x5d8d3f){_0x3e66b3['push'](_0x3e66b3['shift']());}};_0x26ffac(++_0x27b8f0);}(_0x2651,0x10a));var _0x1265=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x2651[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x1265('0x0'));var util=require(_0x1265('0x1'));var path=require('path');var timeout=require(_0x1265('0x2'));var express=require(_0x1265('0x3'));var router=express[_0x1265('0x4')]();var fs_extra=require(_0x1265('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1265('0x6'));router['get']('/',auth[_0x1265('0x7')](),controller[_0x1265('0x8')]);router[_0x1265('0x9')](_0x1265('0xa'),auth[_0x1265('0x7')](),controller[_0x1265('0xb')]);router['get'](_0x1265('0xc'),auth[_0x1265('0x7')](),controller[_0x1265('0xd')]);router[_0x1265('0xe')]('/',auth[_0x1265('0x7')](),controller[_0x1265('0xf')]);router[_0x1265('0xe')](_0x1265('0xc'),auth['isAuthenticated'](),controller[_0x1265('0x10')]);router[_0x1265('0x11')]('/:id',auth[_0x1265('0x7')](),controller[_0x1265('0x12')]);router[_0x1265('0x13')](_0x1265('0xa'),auth[_0x1265('0x7')](),controller[_0x1265('0x14')]);router['delete'](_0x1265('0x15'),auth['isAuthenticated'](),controller[_0x1265('0x16')]);module[_0x1265('0x17')]=router; \ No newline at end of file +var _0x0d97=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports'];(function(_0x146125,_0x113d8a){var _0x79e75c=function(_0x45aff0){while(--_0x45aff0){_0x146125['push'](_0x146125['shift']());}};_0x79e75c(++_0x113d8a);}(_0x0d97,0xe6));var _0x70d9=function(_0x1ca680,_0xde255b){_0x1ca680=_0x1ca680-0x0;var _0x4577d4=_0x0d97[_0x1ca680];return _0x4577d4;};'use strict';var multer=require('multer');var util=require(_0x70d9('0x0'));var path=require(_0x70d9('0x1'));var timeout=require(_0x70d9('0x2'));var express=require(_0x70d9('0x3'));var router=express[_0x70d9('0x4')]();var fs_extra=require(_0x70d9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70d9('0x6'));var config=require(_0x70d9('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x70d9('0x8')]('/',auth[_0x70d9('0x9')](),controller[_0x70d9('0xa')]);router['get'](_0x70d9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x70d9('0x8')](_0x70d9('0xc'),auth[_0x70d9('0x9')](),controller['getSounds']);router[_0x70d9('0xd')]('/',auth[_0x70d9('0x9')](),controller[_0x70d9('0xe')]);router[_0x70d9('0xd')](_0x70d9('0xc'),auth[_0x70d9('0x9')](),controller[_0x70d9('0xf')]);router[_0x70d9('0x10')]('/:id',auth[_0x70d9('0x9')](),controller[_0x70d9('0x11')]);router[_0x70d9('0x12')](_0x70d9('0xb'),auth[_0x70d9('0x9')](),controller[_0x70d9('0x13')]);router[_0x70d9('0x12')](_0x70d9('0x14'),auth['isAuthenticated'](),controller[_0x70d9('0x15')]);module[_0x70d9('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index f6ed452..5da1bcf 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 _0x2650=['mp3nb','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files'];(function(_0x5bc988,_0x3f5307){var _0x406372=function(_0x194786){while(--_0x194786){_0x5bc988['push'](_0x5bc988['shift']());}};_0x406372(++_0x3f5307);}(_0x2650,0x1d2));var _0x0265=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x2650[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0x0265('0x0'));module[_0x0265('0x1')]={'name':{'type':Sequelize[_0x0265('0x2')],'allowNull':![],'unique':_0x0265('0x3')},'mode':{'type':Sequelize[_0x0265('0x4')](_0x0265('0x5'),_0x0265('0x6'),_0x0265('0x7'),'quietmp3nb','quietmp3',_0x0265('0x8')),'allowNull':!![],'defaultValue':_0x0265('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x0265('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0265('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0265('0x2')],'allowNull':!![],'defaultValue':_0x0265('0x9')},'format':{'type':Sequelize[_0x0265('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x0265('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe69c=['BOOLEAN','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','alpha'];(function(_0x109c62,_0x4d46a4){var _0x1a2e26=function(_0x5db895){while(--_0x5db895){_0x109c62['push'](_0x109c62['shift']());}};_0x1a2e26(++_0x4d46a4);}(_0xe69c,0x19b));var _0xce69=function(_0x25512c,_0x37e3be){_0x25512c=_0x25512c-0x0;var _0x46c852=_0xe69c[_0x25512c];return _0x46c852;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xce69('0x0')],'allowNull':![],'unique':_0xce69('0x1')},'mode':{'type':Sequelize[_0xce69('0x2')](_0xce69('0x3'),'files',_0xce69('0x4'),_0xce69('0x5'),_0xce69('0x6'),_0xce69('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![],'defaultValue':_0xce69('0x8')},'format':{'type':Sequelize[_0xce69('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xce69('0x9')],'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 acff09f..1283e57 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 _0xf41c=['Sound','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','options','include','findAll','rows','catch','show','params','includeAll','merge','find','body','sequelize','files','directory','join','root','server/files/moh','create','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','getSounds'];(function(_0x194494,_0x57c76e){var _0x45acaf=function(_0x37e62f){while(--_0x37e62f){_0x194494['push'](_0x194494['shift']());}};_0x45acaf(++_0x57c76e);}(_0xf41c,0xd2));var _0xcf41=function(_0x1e4c88,_0xd20f47){_0x1e4c88=_0x1e4c88-0x0;var _0x1fe6a6=_0xf41c[_0x1e4c88];return _0x1fe6a6;};'use strict';var emlformat=require(_0xcf41('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf41('0x1'));var jsonpatch=require(_0xcf41('0x2'));var rp=require(_0xcf41('0x3'));var moment=require(_0xcf41('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf41('0x5'));var util=require(_0xcf41('0x6'));var path=require('path');var sox=require(_0xcf41('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf41('0x8'));var squel=require(_0xcf41('0x9'));var crypto=require(_0xcf41('0xa'));var jsforce=require(_0xcf41('0xb'));var deskjs=require(_0xcf41('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcf41('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf41('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcf41('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf41('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xcf41('0x11'));var licenseUtil=require(_0xcf41('0x12'));var db=require(_0xcf41('0x13'))['db'];function respondWithStatusCode(_0x2bb86f,_0x3e745b){_0x3e745b=_0x3e745b||0xcc;return function(_0x12b118){if(_0x12b118){return _0x2bb86f['sendStatus'](_0x3e745b);}return _0x2bb86f[_0xcf41('0x14')](_0x3e745b)[_0xcf41('0x15')]();};}function respondWithResult(_0x45b8b7,_0x22ad10){_0x22ad10=_0x22ad10||0xc8;return function(_0x6fb5c5){if(_0x6fb5c5){return _0x45b8b7[_0xcf41('0x14')](_0x22ad10)[_0xcf41('0x16')](_0x6fb5c5);}};}function respondWithFilteredResult(_0x14074d,_0x1376b4){return function(_0x202ac0){if(_0x202ac0){var _0x544883=typeof _0x1376b4[_0xcf41('0x17')]===_0xcf41('0x18')&&typeof _0x1376b4['limit']==='undefined';var _0x2dc230=_0x202ac0['count'];var _0x455a32=_0x544883?0x0:_0x1376b4['offset'];var _0x2a72ca=_0x544883?_0x202ac0[_0xcf41('0x19')]:_0x1376b4[_0xcf41('0x17')]+_0x1376b4[_0xcf41('0x1a')];var _0x36b428;if(_0x2a72ca>=_0x2dc230){_0x2a72ca=_0x2dc230;_0x36b428=0xc8;}else{_0x36b428=0xce;}_0x14074d[_0xcf41('0x14')](_0x36b428);return _0x14074d[_0xcf41('0x1b')](_0xcf41('0x1c'),_0x455a32+'-'+_0x2a72ca+'/'+_0x2dc230)[_0xcf41('0x16')](_0x202ac0);}return null;};}function patchUpdates(_0x4ff1f3){return function(_0x1d6cc0){try{jsonpatch['apply'](_0x1d6cc0,_0x4ff1f3,!![]);}catch(_0x18ec90){return BPromise['reject'](_0x18ec90);}return _0x1d6cc0['save']();};}function saveUpdates(_0x3bbd76,_0x2b48e1){return function(_0x47a50b){if(_0x47a50b){return _0x47a50b[_0xcf41('0x1d')](_0x3bbd76)[_0xcf41('0x1e')](function(_0x4393a1){return _0x4393a1;});}return null;};}function removeEntity(_0x40ed14,_0xd37f4b){return function(_0xad62ce){if(_0xad62ce){return _0xad62ce['destroy']()[_0xcf41('0x1e')](function(){var _0x549183=_0xad62ce[_0xcf41('0x1f')]({'plain':!![]});var _0x470b01=_0xcf41('0x20');return db[_0xcf41('0x21')][_0xcf41('0x22')]({'where':{'type':_0x470b01,'resourceId':_0x549183['id']}})[_0xcf41('0x1e')](function(){return _0xad62ce;});})[_0xcf41('0x1e')](function(){_0x40ed14['status'](0xcc)[_0xcf41('0x15')]();});}};}function handleEntityNotFound(_0xdc107,_0x3be8f1){return function(_0x46990e){if(!_0x46990e){_0xdc107['sendStatus'](0x194);}return _0x46990e;};}function handleError(_0xd7a9e,_0xaad5a3){_0xaad5a3=_0xaad5a3||0x1f4;return function(_0xd0d6a3){logger['error'](_0xd0d6a3['stack']);if(_0xd0d6a3['name']){delete _0xd0d6a3[_0xcf41('0x23')];}_0xd7a9e[_0xcf41('0x14')](_0xaad5a3)['send'](_0xd0d6a3);};}exports[_0xcf41('0x24')]=function(_0xcbba8d,_0x21c416){var _0x1b9c3d={},_0x41d402={},_0x9830f7={'count':0x0,'rows':[]};var _0x2b8186=_[_0xcf41('0x25')](db[_0xcf41('0x26')][_0xcf41('0x27')],function(_0x33b797){return{'name':_0x33b797[_0xcf41('0x28')],'type':_0x33b797[_0xcf41('0x29')][_0xcf41('0x2a')]};});_0x41d402[_0xcf41('0x2b')]=_['map'](_0x2b8186,'name');_0x41d402[_0xcf41('0x2c')]=_[_0xcf41('0x2d')](_0xcbba8d[_0xcf41('0x2c')]);_0x41d402[_0xcf41('0x2e')]=_[_0xcf41('0x2f')](_0x41d402[_0xcf41('0x2b')],_0x41d402[_0xcf41('0x2c')]);_0x1b9c3d[_0xcf41('0x30')]=_['intersection'](_0x41d402['model'],qs[_0xcf41('0x31')](_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x31')]));_0x1b9c3d[_0xcf41('0x30')]=_0x1b9c3d[_0xcf41('0x30')][_0xcf41('0x32')]?_0x1b9c3d[_0xcf41('0x30')]:_0x41d402['model'];if(!_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x33')]('nolimit')){_0x1b9c3d[_0xcf41('0x1a')]=qs[_0xcf41('0x1a')](_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x1a')]);_0x1b9c3d['offset']=qs['offset'](_0xcbba8d['query'][_0xcf41('0x17')]);}_0x1b9c3d[_0xcf41('0x34')]=qs['sort'](_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x35')]);delete _0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x35')];_0x1b9c3d['where']=qs[_0xcf41('0x2e')](_['pick'](_0xcbba8d[_0xcf41('0x2c')],_0x41d402[_0xcf41('0x2e')]),_0x2b8186);if(_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x36')]){_0x1b9c3d[_0xcf41('0x37')]=_['merge'](_0x1b9c3d[_0xcf41('0x37')],{'$or':_['map'](_0x2b8186,function(_0x452200){if(_0x452200['type']!=='VIRTUAL'){var _0x186763={};_0x186763[_0x452200[_0xcf41('0x23')]]={'$like':'%'+_0xcbba8d[_0xcf41('0x2c')][_0xcf41('0x36')]+'%'};return _0x186763;}})});}_0x1b9c3d=_['merge']({},_0x1b9c3d,_0xcbba8d[_0xcf41('0x38')]);var _0x3dcf2e={'where':_0x1b9c3d[_0xcf41('0x37')]};return db[_0xcf41('0x26')][_0xcf41('0x19')](_0x3dcf2e)['then'](function(_0x2f28af){_0x9830f7[_0xcf41('0x19')]=_0x2f28af;if(_0xcbba8d[_0xcf41('0x2c')]['includeAll']){_0x1b9c3d[_0xcf41('0x39')]=[{'all':!![]}];}return db[_0xcf41('0x26')][_0xcf41('0x3a')](_0x1b9c3d);})[_0xcf41('0x1e')](function(_0x5ea3b9){_0x9830f7[_0xcf41('0x3b')]=_0x5ea3b9;return _0x9830f7;})[_0xcf41('0x1e')](respondWithFilteredResult(_0x21c416,_0x1b9c3d))[_0xcf41('0x3c')](handleError(_0x21c416,null));};exports[_0xcf41('0x3d')]=function(_0x121dab,_0x50b6ba){var _0x332ca8={'raw':![],'where':{'id':_0x121dab[_0xcf41('0x3e')]['id']}},_0x1d2d8b={};_0x1d2d8b[_0xcf41('0x2b')]=_['keys'](db[_0xcf41('0x26')][_0xcf41('0x27')]);_0x1d2d8b['query']=_[_0xcf41('0x2d')](_0x121dab['query']);_0x1d2d8b[_0xcf41('0x2e')]=_[_0xcf41('0x2f')](_0x1d2d8b[_0xcf41('0x2b')],_0x1d2d8b[_0xcf41('0x2c')]);_0x332ca8[_0xcf41('0x30')]=_[_0xcf41('0x2f')](_0x1d2d8b[_0xcf41('0x2b')],qs[_0xcf41('0x31')](_0x121dab[_0xcf41('0x2c')]['fields']));_0x332ca8[_0xcf41('0x30')]=_0x332ca8[_0xcf41('0x30')][_0xcf41('0x32')]?_0x332ca8[_0xcf41('0x30')]:_0x1d2d8b[_0xcf41('0x2b')];if(_0x121dab[_0xcf41('0x2c')][_0xcf41('0x3f')]){_0x332ca8[_0xcf41('0x39')]=[{'all':!![]}];}_0x332ca8=_[_0xcf41('0x40')]({},_0x332ca8,_0x121dab[_0xcf41('0x38')]);return db['VoiceMusicOnHold'][_0xcf41('0x41')](_0x332ca8)[_0xcf41('0x1e')](handleEntityNotFound(_0x50b6ba,null))[_0xcf41('0x1e')](respondWithResult(_0x50b6ba,null))[_0xcf41('0x3c')](handleError(_0x50b6ba,null));};exports[_0xcf41('0x1d')]=function(_0x8a491,_0x5a9852){if(_0x8a491[_0xcf41('0x42')]['id']){delete _0x8a491[_0xcf41('0x42')]['id'];}return db[_0xcf41('0x26')][_0xcf41('0x41')]({'where':{'id':_0x8a491[_0xcf41('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5a9852,null))[_0xcf41('0x1e')](saveUpdates(_0x8a491['body'],null))['then'](respondWithResult(_0x5a9852,null))[_0xcf41('0x3c')](handleError(_0x5a9852,null));};exports['create']=function(_0x2f9bd6,_0x6e0c23,_0x294d35){return db[_0xcf41('0x43')]['transaction'](function(_0x261437){if(_0x2f9bd6['body']['mode']===_0xcf41('0x44')){_0x2f9bd6[_0xcf41('0x42')][_0xcf41('0x45')]=path[_0xcf41('0x46')](config[_0xcf41('0x47')],_0xcf41('0x48'),_0x2f9bd6[_0xcf41('0x42')][_0xcf41('0x23')]);}return db['VoiceMusicOnHold'][_0xcf41('0x49')](_0x2f9bd6['body'],{'transaction':_0x261437})[_0xcf41('0x1e')](function(_0x110f9a){if(_0x2f9bd6[_0xcf41('0x42')]['mode']==='files'){fs[_0xcf41('0x4a')](_0x110f9a[_0xcf41('0x45')],parseInt(_0xcf41('0x4b'),0x8));}var _0x1b8c0c=_0x2f9bd6['user']['get']({'plain':!![]});if(!_0x1b8c0c)throw new Error(_0xcf41('0x4c'));if(_0x1b8c0c['role']===_0xcf41('0x4d')){var _0x414283=_0x110f9a['get']({'plain':!![]});return db['UserProfileSection'][_0xcf41('0x41')]({'where':{'name':_0xcf41('0x20'),'userProfileId':_0x1b8c0c[_0xcf41('0x4e')]},'raw':!![]})['then'](function(_0x15c0c5){if(_0x15c0c5&&_0x15c0c5[_0xcf41('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x414283[_0xcf41('0x23')],'resourceId':_0x414283['id'],'type':_0x15c0c5['name'],'sectionId':_0x15c0c5['id']},{})[_0xcf41('0x1e')](function(){return _0x110f9a;});}else{return _0x110f9a;}})[_0xcf41('0x3c')](function(_0x396aee){logger['error'](_0xcf41('0x50'),_0x396aee);});}return _0x110f9a;});})[_0xcf41('0x1e')](respondWithResult(_0x6e0c23,0xc9))['catch'](handleError(_0x6e0c23,null));};exports[_0xcf41('0x22')]=function(_0x579acf,_0x1ad0e6,_0x40eeae){var _0x5e4714;return db[_0xcf41('0x26')][_0xcf41('0x41')]({'where':{'id':_0x579acf[_0xcf41('0x3e')]['id']}})[_0xcf41('0x1e')](function(_0x71277f){if(_0x71277f){return db[_0xcf41('0x43')][_0xcf41('0x51')](function(_0x3da3e0){return _0x71277f[_0xcf41('0x22')]({'transaction':_0x3da3e0,'raw':!![]})[_0xcf41('0x1e')](function(_0x1a9434){if(_0x1a9434[_0xcf41('0x45')]){fs[_0xcf41('0x52')](_0x1a9434[_0xcf41('0x45')])['forEach'](function(_0x24d920){fs[_0xcf41('0x53')](path['join'](_0x1a9434[_0xcf41('0x45')],_0x24d920));});fs[_0xcf41('0x54')](_0x1a9434[_0xcf41('0x45')]);}return _0x1a9434;});})['catch'](function(_0x251644){throw new db[(_0xcf41('0x55'))][(_0xcf41('0x56'))](_0x251644[_0xcf41('0x57')]);});}})[_0xcf41('0x1e')](handleEntityNotFound(_0x1ad0e6,null))['then'](removeEntity(_0x1ad0e6,null))[_0xcf41('0x3c')](handleError(_0x1ad0e6,null));};exports[_0xcf41('0x58')]=function(_0x5d0ca0,_0x246c08,_0x345b5b){return db[_0xcf41('0x43')]['transaction'](function(_0x1e50d7){var _0x2d63d2;return db[_0xcf41('0x26')]['find']({'where':{'id':_0x5d0ca0[_0xcf41('0x3e')]['id']}})[_0xcf41('0x1e')](function(_0xc8a1db){if(_0xc8a1db){_0x2d63d2=_0xc8a1db;return _0xc8a1db[_0xcf41('0x58')](_0x5d0ca0['body']['id'],{'transaction':_0x1e50d7});}})[_0xcf41('0x1e')](function(_0x46c2a7){if(_0x46c2a7){return db['Sound'][_0xcf41('0x59')]({'where':{'id':_0x5d0ca0[_0xcf41('0x42')]['id']},'attributes':['id','name',_0xcf41('0x5a'),_0xcf41('0x5b'),'createdAt'],'raw':!![]});}})[_0xcf41('0x1e')](function(_0x12df6a){if(_0x12df6a){var _0x33c665=path[_0xcf41('0x46')](config[_0xcf41('0x47')],_0xcf41('0x5c'),util[_0xcf41('0x5d')](_0xcf41('0x5e'),path[_0xcf41('0x5f')](_0x12df6a[_0xcf41('0x5a')],path[_0xcf41('0x60')](_0x12df6a[_0xcf41('0x5a')])),_0x12df6a[_0xcf41('0x5b')]));var _0x1305ac=path[_0xcf41('0x46')](config[_0xcf41('0x47')],'server/files/moh',_0x2d63d2[_0xcf41('0x23')],util[_0xcf41('0x5d')](_0xcf41('0x5e'),_0x12df6a['name'],_0x12df6a[_0xcf41('0x5b')]));fs[_0xcf41('0x61')](_0x33c665,_0x1305ac);return _0x12df6a;}})['catch'](function(_0x6b86f4){throw new db[(_0xcf41('0x55'))][(_0xcf41('0x56'))](_0x6b86f4[_0xcf41('0x57')]);});})[_0xcf41('0x1e')](handleEntityNotFound(_0x246c08,null))[_0xcf41('0x1e')](respondWithResult(_0x246c08,0xc9))[_0xcf41('0x3c')](handleError(_0x246c08,null));};exports[_0xcf41('0x62')]=function(_0x4c5ed2,_0x2c82f3,_0x5def86){return db[_0xcf41('0x43')][_0xcf41('0x51')](function(_0x5a3bf3){var _0x5ad12d;return db[_0xcf41('0x26')]['findOne']({'where':{'id':_0x4c5ed2[_0xcf41('0x3e')]['id']}})[_0xcf41('0x1e')](handleEntityNotFound(_0x2c82f3,null))[_0xcf41('0x1e')](function(_0x455633){if(_0x455633){_0x5ad12d=_0x455633;return _0x455633[_0xcf41('0x62')](_0x4c5ed2[_0xcf41('0x3e')][_0xcf41('0x63')]);}})[_0xcf41('0x1e')](function(_0x2a4637){if(_0x2a4637){return db['Sound'][_0xcf41('0x59')]({'where':{'id':_0x4c5ed2[_0xcf41('0x3e')][_0xcf41('0x63')]},'attributes':['id',_0xcf41('0x23'),_0xcf41('0x5a'),'converted_format',_0xcf41('0x64')],'raw':!![]});}})[_0xcf41('0x1e')](function(_0x10a615){if(_0x10a615){fs[_0xcf41('0x53')](path[_0xcf41('0x46')](_0x5ad12d['directory'],util[_0xcf41('0x5d')](_0xcf41('0x5e'),_0x10a615[_0xcf41('0x23')],_0x10a615[_0xcf41('0x5b')])));return _0x10a615;}})[_0xcf41('0x3c')](function(_0x4a83ff){throw new db[(_0xcf41('0x55'))][(_0xcf41('0x56'))](_0x4a83ff[_0xcf41('0x57')]);});})[_0xcf41('0x1e')](handleEntityNotFound(_0x2c82f3,null))[_0xcf41('0x1e')](respondWithStatusCode(_0x2c82f3,0xcc))[_0xcf41('0x3c')](handleError(_0x2c82f3,null));};exports[_0xcf41('0x65')]=function(_0xa30550,_0x2bd4d2,_0x586eb3){var _0x8b8ec6={};var _0x5bf090={};var _0x198683;var _0x186440;return db[_0xcf41('0x26')][_0xcf41('0x59')]({'where':{'id':_0xa30550[_0xcf41('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2bd4d2,null))[_0xcf41('0x1e')](function(_0x2f2bc0){if(_0x2f2bc0){_0x198683=_0x2f2bc0;_0x5bf090[_0xcf41('0x2b')]=_['keys'](db[_0xcf41('0x66')][_0xcf41('0x27')]);_0x5bf090[_0xcf41('0x2c')]=_[_0xcf41('0x2d')](_0xa30550['query']);_0x5bf090[_0xcf41('0x2e')]=_[_0xcf41('0x2f')](_0x5bf090[_0xcf41('0x2b')],_0x5bf090[_0xcf41('0x2c')]);_0x8b8ec6[_0xcf41('0x30')]=_[_0xcf41('0x2f')](_0x5bf090[_0xcf41('0x2b')],qs[_0xcf41('0x31')](_0xa30550[_0xcf41('0x2c')][_0xcf41('0x31')]));_0x8b8ec6['attributes']=_0x8b8ec6[_0xcf41('0x30')][_0xcf41('0x32')]?_0x8b8ec6['attributes']:_0x5bf090[_0xcf41('0x2b')];_0x8b8ec6[_0xcf41('0x34')]=qs[_0xcf41('0x35')](_0xa30550['query'][_0xcf41('0x35')]);_0x8b8ec6[_0xcf41('0x37')]=qs['filters'](_[_0xcf41('0x67')](_0xa30550[_0xcf41('0x2c')],_0x5bf090[_0xcf41('0x2e')]));if(_0xa30550[_0xcf41('0x2c')][_0xcf41('0x36')]){_0x8b8ec6[_0xcf41('0x37')]=_[_0xcf41('0x40')](_0x8b8ec6[_0xcf41('0x37')],{'$or':_['map'](_0x8b8ec6['attributes'],function(_0x9d254c){var _0x258467={};_0x258467[_0x9d254c]={'$like':'%'+_0xa30550['query'][_0xcf41('0x36')]+'%'};return _0x258467;})});}_0x8b8ec6=_[_0xcf41('0x40')]({},_0x8b8ec6,_0xa30550[_0xcf41('0x38')]);return _0x198683[_0xcf41('0x65')](_0x8b8ec6);}})['then'](function(_0x5b6cc0){if(_0x5b6cc0){_0x186440=_0x5b6cc0[_0xcf41('0x32')];if(!_0xa30550[_0xcf41('0x2c')]['hasOwnProperty']('nolimit')){_0x8b8ec6[_0xcf41('0x1a')]=qs[_0xcf41('0x1a')](_0xa30550[_0xcf41('0x2c')][_0xcf41('0x1a')]);_0x8b8ec6[_0xcf41('0x17')]=qs[_0xcf41('0x17')](_0xa30550[_0xcf41('0x2c')][_0xcf41('0x17')]);}return _0x198683['getSounds'](_0x8b8ec6);}})[_0xcf41('0x1e')](function(_0x4dec3c){if(_0x4dec3c){return _0x4dec3c?{'count':_0x186440,'rows':_0x4dec3c}:null;}})['then'](respondWithResult(_0x2bd4d2,null))[_0xcf41('0x3c')](handleError(_0x2bd4d2,null));}; \ No newline at end of file +var _0xc0bc=['addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','symlinkSync','removeSound','id2','rawAttributes','getSounds','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','MusicOnHolds','UserProfileResource','error','name','index','map','VoiceMusicOnHold','fieldName','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','find','body','params','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message'];(function(_0x5cc6c1,_0x5e09db){var _0x4c8192=function(_0x1bc7ee){while(--_0x1bc7ee){_0x5cc6c1['push'](_0x5cc6c1['shift']());}};_0x4c8192(++_0x5e09db);}(_0xc0bc,0x1b9));var _0xcc0b=function(_0x1c5db9,_0x55e902){_0x1c5db9=_0x1c5db9-0x0;var _0x499a0b=_0xc0bc[_0x1c5db9];return _0x499a0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcc0b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc0b('0x1'));var moment=require('moment');var BPromise=require(_0xcc0b('0x2'));var Mustache=require('mustache');var util=require(_0xcc0b('0x3'));var path=require(_0xcc0b('0x4'));var sox=require('sox');var csv=require(_0xcc0b('0x5'));var ejs=require(_0xcc0b('0x6'));var fs=require('fs');var fs_extra=require(_0xcc0b('0x7'));var _=require(_0xcc0b('0x8'));var squel=require(_0xcc0b('0x9'));var crypto=require(_0xcc0b('0xa'));var jsforce=require(_0xcc0b('0xb'));var deskjs=require(_0xcc0b('0xc'));var toCsv=require(_0xcc0b('0x5'));var querystring=require(_0xcc0b('0xd'));var Papa=require(_0xcc0b('0xe'));var Redis=require(_0xcc0b('0xf'));var authService=require(_0xcc0b('0x10'));var qs=require(_0xcc0b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc0b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xcc0b('0x13'));var licenseUtil=require(_0xcc0b('0x14'));var db=require(_0xcc0b('0x15'))['db'];function respondWithStatusCode(_0x4adb5e,_0x34a5a7){_0x34a5a7=_0x34a5a7||0xcc;return function(_0x4d42ba){if(_0x4d42ba){return _0x4adb5e[_0xcc0b('0x16')](_0x34a5a7);}return _0x4adb5e['status'](_0x34a5a7)[_0xcc0b('0x17')]();};}function respondWithResult(_0x568b26,_0x4a704a){_0x4a704a=_0x4a704a||0xc8;return function(_0x21aeac){if(_0x21aeac){return _0x568b26[_0xcc0b('0x18')](_0x4a704a)[_0xcc0b('0x19')](_0x21aeac);}};}function respondWithFilteredResult(_0x37a83b,_0x5019cf){return function(_0x519cdd){if(_0x519cdd){var _0x244473=typeof _0x5019cf[_0xcc0b('0x1a')]===_0xcc0b('0x1b')&&typeof _0x5019cf['limit']===_0xcc0b('0x1b');var _0x449c80=_0x519cdd[_0xcc0b('0x1c')];var _0x88a482=_0x244473?0x0:_0x5019cf[_0xcc0b('0x1a')];var _0x3eb83b=_0x244473?_0x519cdd[_0xcc0b('0x1c')]:_0x5019cf['offset']+_0x5019cf[_0xcc0b('0x1d')];var _0xd77933;if(_0x3eb83b>=_0x449c80){_0x3eb83b=_0x449c80;_0xd77933=0xc8;}else{_0xd77933=0xce;}_0x37a83b[_0xcc0b('0x18')](_0xd77933);return _0x37a83b[_0xcc0b('0x1e')](_0xcc0b('0x1f'),_0x88a482+'-'+_0x3eb83b+'/'+_0x449c80)[_0xcc0b('0x19')](_0x519cdd);}return null;};}function patchUpdates(_0x521bc3){return function(_0x512bdc){try{jsonpatch['apply'](_0x512bdc,_0x521bc3,!![]);}catch(_0xb55ebb){return BPromise['reject'](_0xb55ebb);}return _0x512bdc['save']();};}function saveUpdates(_0xd04eeb,_0x3cb40e){return function(_0x391204){if(_0x391204){return _0x391204[_0xcc0b('0x20')](_0xd04eeb)[_0xcc0b('0x21')](function(_0x4fbb49){return _0x4fbb49;});}return null;};}function removeEntity(_0x281c52,_0x2728cd){return function(_0x76842a){if(_0x76842a){return _0x76842a[_0xcc0b('0x22')]()['then'](function(){var _0x12bad5=_0x76842a['get']({'plain':!![]});var _0x3320c3=_0xcc0b('0x23');return db[_0xcc0b('0x24')][_0xcc0b('0x22')]({'where':{'type':_0x3320c3,'resourceId':_0x12bad5['id']}})[_0xcc0b('0x21')](function(){return _0x76842a;});})[_0xcc0b('0x21')](function(){_0x281c52[_0xcc0b('0x18')](0xcc)[_0xcc0b('0x17')]();});}};}function handleEntityNotFound(_0x342d9b,_0x241095){return function(_0x36d633){if(!_0x36d633){_0x342d9b[_0xcc0b('0x16')](0x194);}return _0x36d633;};}function handleError(_0x50b362,_0x51afda){_0x51afda=_0x51afda||0x1f4;return function(_0x26857f){logger[_0xcc0b('0x25')](_0x26857f['stack']);if(_0x26857f[_0xcc0b('0x26')]){delete _0x26857f[_0xcc0b('0x26')];}_0x50b362[_0xcc0b('0x18')](_0x51afda)['send'](_0x26857f);};}exports[_0xcc0b('0x27')]=function(_0x16cac2,_0x3a7faa){var _0x42ad8f={},_0x15a63e={},_0x1d8474={'count':0x0,'rows':[]};var _0x4758cc=_[_0xcc0b('0x28')](db[_0xcc0b('0x29')]['rawAttributes'],function(_0x3eabb9){return{'name':_0x3eabb9[_0xcc0b('0x2a')],'type':_0x3eabb9['type']['key']};});_0x15a63e['model']=_[_0xcc0b('0x28')](_0x4758cc,_0xcc0b('0x26'));_0x15a63e[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x16cac2[_0xcc0b('0x2b')]);_0x15a63e['filters']=_['intersection'](_0x15a63e[_0xcc0b('0x2d')],_0x15a63e[_0xcc0b('0x2b')]);_0x42ad8f[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x15a63e[_0xcc0b('0x2d')],qs[_0xcc0b('0x30')](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x30')]));_0x42ad8f['attributes']=_0x42ad8f[_0xcc0b('0x2e')]['length']?_0x42ad8f[_0xcc0b('0x2e')]:_0x15a63e[_0xcc0b('0x2d')];if(!_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x31')](_0xcc0b('0x32'))){_0x42ad8f['limit']=qs[_0xcc0b('0x1d')](_0x16cac2['query'][_0xcc0b('0x1d')]);_0x42ad8f[_0xcc0b('0x1a')]=qs['offset'](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x1a')]);}_0x42ad8f[_0xcc0b('0x33')]=qs[_0xcc0b('0x34')](_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x34')]);delete _0x16cac2['query'][_0xcc0b('0x34')];_0x42ad8f[_0xcc0b('0x35')]=qs[_0xcc0b('0x36')](_[_0xcc0b('0x37')](_0x16cac2[_0xcc0b('0x2b')],_0x15a63e[_0xcc0b('0x36')]),_0x4758cc);if(_0x16cac2[_0xcc0b('0x2b')]['filter']){_0x42ad8f['where']=_[_0xcc0b('0x38')](_0x42ad8f[_0xcc0b('0x35')],{'$or':_['map'](_0x4758cc,function(_0x18adbe){if(_0x18adbe[_0xcc0b('0x39')]!==_0xcc0b('0x3a')){var _0x4c7cd5={};_0x4c7cd5[_0x18adbe[_0xcc0b('0x26')]]={'$like':'%'+_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x3b')]+'%'};return _0x4c7cd5;}})});}_0x42ad8f=_[_0xcc0b('0x38')]({},_0x42ad8f,_0x16cac2[_0xcc0b('0x3c')]);var _0x1db93d={'where':_0x42ad8f['where']};return db[_0xcc0b('0x29')][_0xcc0b('0x1c')](_0x1db93d)[_0xcc0b('0x21')](function(_0x239ced){_0x1d8474[_0xcc0b('0x1c')]=_0x239ced;if(_0x16cac2[_0xcc0b('0x2b')][_0xcc0b('0x3d')]){_0x42ad8f[_0xcc0b('0x3e')]=[{'all':!![]}];}return db[_0xcc0b('0x29')]['findAll'](_0x42ad8f);})['then'](function(_0x2f4431){_0x1d8474[_0xcc0b('0x3f')]=_0x2f4431;return _0x1d8474;})[_0xcc0b('0x21')](respondWithFilteredResult(_0x3a7faa,_0x42ad8f))[_0xcc0b('0x40')](handleError(_0x3a7faa,null));};exports[_0xcc0b('0x41')]=function(_0x5c9dfd,_0x55695d){var _0x4a00a9={'raw':![],'where':{'id':_0x5c9dfd['params']['id']}},_0x20e267={};_0x20e267[_0xcc0b('0x2d')]=_[_0xcc0b('0x2c')](db[_0xcc0b('0x29')]['rawAttributes']);_0x20e267[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x5c9dfd[_0xcc0b('0x2b')]);_0x20e267[_0xcc0b('0x36')]=_[_0xcc0b('0x2f')](_0x20e267[_0xcc0b('0x2d')],_0x20e267[_0xcc0b('0x2b')]);_0x4a00a9[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x20e267[_0xcc0b('0x2d')],qs['fields'](_0x5c9dfd[_0xcc0b('0x2b')][_0xcc0b('0x30')]));_0x4a00a9['attributes']=_0x4a00a9[_0xcc0b('0x2e')][_0xcc0b('0x42')]?_0x4a00a9['attributes']:_0x20e267['model'];if(_0x5c9dfd[_0xcc0b('0x2b')][_0xcc0b('0x3d')]){_0x4a00a9['include']=[{'all':!![]}];}_0x4a00a9=_[_0xcc0b('0x38')]({},_0x4a00a9,_0x5c9dfd[_0xcc0b('0x3c')]);return db[_0xcc0b('0x29')][_0xcc0b('0x43')](_0x4a00a9)[_0xcc0b('0x21')](handleEntityNotFound(_0x55695d,null))[_0xcc0b('0x21')](respondWithResult(_0x55695d,null))['catch'](handleError(_0x55695d,null));};exports['update']=function(_0x1e69b2,_0x2e41f0){if(_0x1e69b2[_0xcc0b('0x44')]['id']){delete _0x1e69b2['body']['id'];}return db['VoiceMusicOnHold'][_0xcc0b('0x43')]({'where':{'id':_0x1e69b2[_0xcc0b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e41f0,null))[_0xcc0b('0x21')](saveUpdates(_0x1e69b2['body'],null))[_0xcc0b('0x21')](respondWithResult(_0x2e41f0,null))[_0xcc0b('0x40')](handleError(_0x2e41f0,null));};exports[_0xcc0b('0x46')]=function(_0x3bd510,_0x3f842d,_0x35404c){return db[_0xcc0b('0x47')][_0xcc0b('0x48')](function(_0x461815){if(_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x49')]===_0xcc0b('0x4a')){_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x4b')]=path[_0xcc0b('0x4c')](config[_0xcc0b('0x4d')],_0xcc0b('0x4e'),_0x3bd510['body'][_0xcc0b('0x26')]);}return db[_0xcc0b('0x29')][_0xcc0b('0x46')](_0x3bd510[_0xcc0b('0x44')],{'transaction':_0x461815})[_0xcc0b('0x21')](function(_0x554f46){if(_0x3bd510[_0xcc0b('0x44')][_0xcc0b('0x49')]===_0xcc0b('0x4a')){fs[_0xcc0b('0x4f')](_0x554f46[_0xcc0b('0x4b')],parseInt('0777',0x8));}var _0x3748fe=_0x3bd510['user'][_0xcc0b('0x50')]({'plain':!![]});if(!_0x3748fe)throw new Error(_0xcc0b('0x51'));if(_0x3748fe[_0xcc0b('0x52')]===_0xcc0b('0x53')){var _0x27a839=_0x554f46['get']({'plain':!![]});return db[_0xcc0b('0x54')][_0xcc0b('0x43')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3748fe[_0xcc0b('0x55')]},'raw':!![]})[_0xcc0b('0x21')](function(_0x4270e3){if(_0x4270e3&&_0x4270e3[_0xcc0b('0x56')]===0x0){return db[_0xcc0b('0x24')][_0xcc0b('0x46')]({'name':_0x27a839['name'],'resourceId':_0x27a839['id'],'type':_0x4270e3[_0xcc0b('0x26')],'sectionId':_0x4270e3['id']},{})['then'](function(){return _0x554f46;});}else{return _0x554f46;}})[_0xcc0b('0x40')](function(_0x5aca99){logger[_0xcc0b('0x25')](_0xcc0b('0x57'),_0x5aca99);});}return _0x554f46;});})['then'](respondWithResult(_0x3f842d,0xc9))[_0xcc0b('0x40')](handleError(_0x3f842d,null));};exports['destroy']=function(_0xdb2ef,_0x112fa6,_0x425022){var _0x5688d8;return db[_0xcc0b('0x29')][_0xcc0b('0x43')]({'where':{'id':_0xdb2ef[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](function(_0x4ec2cb){if(_0x4ec2cb){return db[_0xcc0b('0x47')][_0xcc0b('0x48')](function(_0x48873d){return _0x4ec2cb['destroy']({'transaction':_0x48873d,'raw':!![]})[_0xcc0b('0x21')](function(_0x4ed274){if(_0x4ed274[_0xcc0b('0x4b')]){fs[_0xcc0b('0x58')](_0x4ed274[_0xcc0b('0x4b')])[_0xcc0b('0x59')](function(_0x1def44){fs['unlinkSync'](path[_0xcc0b('0x4c')](_0x4ed274['directory'],_0x1def44));});fs[_0xcc0b('0x5a')](_0x4ed274[_0xcc0b('0x4b')]);}return _0x4ed274;});})[_0xcc0b('0x40')](function(_0x50aa6c){throw new db[(_0xcc0b('0x5b'))][(_0xcc0b('0x5c'))](_0x50aa6c[_0xcc0b('0x5d')]);});}})[_0xcc0b('0x21')](handleEntityNotFound(_0x112fa6,null))['then'](removeEntity(_0x112fa6,null))['catch'](handleError(_0x112fa6,null));};exports[_0xcc0b('0x5e')]=function(_0x17a411,_0x56d854,_0x5f5cc7){return db[_0xcc0b('0x47')]['transaction'](function(_0x22b592){var _0x34045b;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x17a411[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](function(_0x579965){if(_0x579965){_0x34045b=_0x579965;return _0x579965['addSound'](_0x17a411['body']['id'],{'transaction':_0x22b592});}})['then'](function(_0x21b1a3){if(_0x21b1a3){return db[_0xcc0b('0x5f')][_0xcc0b('0x60')]({'where':{'id':_0x17a411[_0xcc0b('0x44')]['id']},'attributes':['id','name',_0xcc0b('0x61'),_0xcc0b('0x62'),_0xcc0b('0x63')],'raw':!![]});}})[_0xcc0b('0x21')](function(_0x28cd81){if(_0x28cd81){var _0x58a9ee=path['join'](config[_0xcc0b('0x4d')],'server/files/sounds/converted',util[_0xcc0b('0x64')](_0xcc0b('0x65'),path['basename'](_0x28cd81[_0xcc0b('0x61')],path['extname'](_0x28cd81['save_name'])),_0x28cd81[_0xcc0b('0x62')]));var _0x23a2e1=path[_0xcc0b('0x4c')](config[_0xcc0b('0x4d')],_0xcc0b('0x4e'),_0x34045b['name'],util[_0xcc0b('0x64')](_0xcc0b('0x65'),_0x28cd81['name'],_0x28cd81[_0xcc0b('0x62')]));fs[_0xcc0b('0x66')](_0x58a9ee,_0x23a2e1);return _0x28cd81;}})['catch'](function(_0x5ce986){throw new db['Sequelize'][(_0xcc0b('0x5c'))](_0x5ce986[_0xcc0b('0x5d')]);});})[_0xcc0b('0x21')](handleEntityNotFound(_0x56d854,null))[_0xcc0b('0x21')](respondWithResult(_0x56d854,0xc9))[_0xcc0b('0x40')](handleError(_0x56d854,null));};exports[_0xcc0b('0x67')]=function(_0x158e9a,_0x4fbe6a,_0x4c8ad2){return db[_0xcc0b('0x47')]['transaction'](function(_0xe28438){var _0x17ba1e;return db[_0xcc0b('0x29')][_0xcc0b('0x60')]({'where':{'id':_0x158e9a[_0xcc0b('0x45')]['id']}})[_0xcc0b('0x21')](handleEntityNotFound(_0x4fbe6a,null))[_0xcc0b('0x21')](function(_0x50bc96){if(_0x50bc96){_0x17ba1e=_0x50bc96;return _0x50bc96['removeSound'](_0x158e9a[_0xcc0b('0x45')][_0xcc0b('0x68')]);}})[_0xcc0b('0x21')](function(_0x21485a){if(_0x21485a){return db[_0xcc0b('0x5f')]['findOne']({'where':{'id':_0x158e9a[_0xcc0b('0x45')][_0xcc0b('0x68')]},'attributes':['id','name',_0xcc0b('0x61'),'converted_format',_0xcc0b('0x63')],'raw':!![]});}})[_0xcc0b('0x21')](function(_0x3858cb){if(_0x3858cb){fs['unlinkSync'](path[_0xcc0b('0x4c')](_0x17ba1e[_0xcc0b('0x4b')],util[_0xcc0b('0x64')](_0xcc0b('0x65'),_0x3858cb[_0xcc0b('0x26')],_0x3858cb[_0xcc0b('0x62')])));return _0x3858cb;}})[_0xcc0b('0x40')](function(_0x92c58b){throw new db[(_0xcc0b('0x5b'))][(_0xcc0b('0x5c'))](_0x92c58b[_0xcc0b('0x5d')]);});})[_0xcc0b('0x21')](handleEntityNotFound(_0x4fbe6a,null))[_0xcc0b('0x21')](respondWithStatusCode(_0x4fbe6a,0xcc))[_0xcc0b('0x40')](handleError(_0x4fbe6a,null));};exports['getSounds']=function(_0x12805b,_0x3d902a,_0x238931){var _0x1aed17={};var _0x421930={};var _0x35a371;var _0x3ec5cb;return db[_0xcc0b('0x29')][_0xcc0b('0x60')]({'where':{'id':_0x12805b['params']['id']}})['then'](handleEntityNotFound(_0x3d902a,null))[_0xcc0b('0x21')](function(_0x2c354e){if(_0x2c354e){_0x35a371=_0x2c354e;_0x421930[_0xcc0b('0x2d')]=_[_0xcc0b('0x2c')](db[_0xcc0b('0x5f')][_0xcc0b('0x69')]);_0x421930[_0xcc0b('0x2b')]=_[_0xcc0b('0x2c')](_0x12805b['query']);_0x421930[_0xcc0b('0x36')]=_[_0xcc0b('0x2f')](_0x421930[_0xcc0b('0x2d')],_0x421930['query']);_0x1aed17[_0xcc0b('0x2e')]=_[_0xcc0b('0x2f')](_0x421930[_0xcc0b('0x2d')],qs['fields'](_0x12805b['query']['fields']));_0x1aed17['attributes']=_0x1aed17['attributes'][_0xcc0b('0x42')]?_0x1aed17[_0xcc0b('0x2e')]:_0x421930[_0xcc0b('0x2d')];_0x1aed17[_0xcc0b('0x33')]=qs['sort'](_0x12805b['query'][_0xcc0b('0x34')]);_0x1aed17[_0xcc0b('0x35')]=qs[_0xcc0b('0x36')](_['pick'](_0x12805b[_0xcc0b('0x2b')],_0x421930[_0xcc0b('0x36')]));if(_0x12805b['query'][_0xcc0b('0x3b')]){_0x1aed17['where']=_[_0xcc0b('0x38')](_0x1aed17[_0xcc0b('0x35')],{'$or':_['map'](_0x1aed17[_0xcc0b('0x2e')],function(_0x55c191){var _0x5a62c0={};_0x5a62c0[_0x55c191]={'$like':'%'+_0x12805b['query'][_0xcc0b('0x3b')]+'%'};return _0x5a62c0;})});}_0x1aed17=_[_0xcc0b('0x38')]({},_0x1aed17,_0x12805b[_0xcc0b('0x3c')]);return _0x35a371[_0xcc0b('0x6a')](_0x1aed17);}})['then'](function(_0x65a3ae){if(_0x65a3ae){_0x3ec5cb=_0x65a3ae['length'];if(!_0x12805b['query'][_0xcc0b('0x31')](_0xcc0b('0x32'))){_0x1aed17[_0xcc0b('0x1d')]=qs[_0xcc0b('0x1d')](_0x12805b[_0xcc0b('0x2b')]['limit']);_0x1aed17[_0xcc0b('0x1a')]=qs[_0xcc0b('0x1a')](_0x12805b[_0xcc0b('0x2b')]['offset']);}return _0x35a371[_0xcc0b('0x6a')](_0x1aed17);}})[_0xcc0b('0x21')](function(_0x1a58b0){if(_0x1a58b0){return _0x1a58b0?{'count':_0x3ec5cb,'rows':_0x1a58b0}:null;}})['then'](respondWithResult(_0x3d902a,null))[_0xcc0b('0x40')](handleError(_0x3d902a,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 02add29..b372b6b 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 _0x5168=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x389018,_0x5a094d){var _0x1e8b35=function(_0xadd8d6){while(--_0xadd8d6){_0x389018['push'](_0x389018['shift']());}};_0x1e8b35(++_0x5a094d);}(_0x5168,0x1b6));var _0x8516=function(_0x137cfe,_0x491fab){_0x137cfe=_0x137cfe-0x0;var _0x4e6132=_0x5168[_0x137cfe];return _0x4e6132;};'use strict';var _=require(_0x8516('0x0'));var util=require(_0x8516('0x1'));var logger=require(_0x8516('0x2'))(_0x8516('0x3'));var moment=require(_0x8516('0x4'));var BPromise=require(_0x8516('0x5'));var rp=require(_0x8516('0x6'));var fs=require('fs');var path=require(_0x8516('0x7'));var rimraf=require(_0x8516('0x8'));var config=require(_0x8516('0x9'));var attributes=require(_0x8516('0xa'));module[_0x8516('0xb')]=function(_0x4b2205,_0x608459){return _0x4b2205[_0x8516('0xc')](_0x8516('0xd'),attributes,{'tableName':_0x8516('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06eb=['./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3d34fa,_0x5bc7ac){var _0x326489=function(_0x594209){while(--_0x594209){_0x3d34fa['push'](_0x3d34fa['shift']());}};_0x326489(++_0x5bc7ac);}(_0x06eb,0x13c));var _0xb06e=function(_0x2a4729,_0x4e8097){_0x2a4729=_0x2a4729-0x0;var _0xcbac55=_0x06eb[_0x2a4729];return _0xcbac55;};'use strict';var _=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var logger=require('../../config/logger')(_0xb06e('0x2'));var moment=require('moment');var BPromise=require(_0xb06e('0x3'));var rp=require(_0xb06e('0x4'));var fs=require('fs');var path=require(_0xb06e('0x5'));var rimraf=require(_0xb06e('0x6'));var config=require(_0xb06e('0x7'));var attributes=require(_0xb06e('0x8'));module[_0xb06e('0x9')]=function(_0xcbd84e,_0x2a8aa5){return _0xcbd84e['define'](_0xb06e('0xa'),attributes,{'tableName':_0xb06e('0xb'),'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 71d1b08..a2ac8ae 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x45273f,_0x47f8b4){var _0x3ab4af=function(_0x336b6a){while(--_0x336b6a){_0x45273f['push'](_0x45273f['shift']());}};_0x3ab4af(++_0x47f8b4);}(_0xe706,0xa3));var _0x6e70=function(_0x25c1bd,_0x2b9085){_0x25c1bd=_0x25c1bd-0x0;var _0x1eea5f=_0xe706[_0x25c1bd];return _0x1eea5f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x411610,_0x26f8cb){var _0x3d6f03=function(_0x14218f){while(--_0x14218f){_0x411610['push'](_0x411610['shift']());}};_0x3d6f03(++_0x26f8cb);}(_0x70e0,0x17b));var _0x070e=function(_0xc2d811,_0x1677fb){_0xc2d811=_0xc2d811-0x0;var _0x5e254f=_0x70e0[_0xc2d811];return _0x5e254f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e207463..dad6876 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 _0x165d=['update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','describe','/:id','isAuthenticated','show','/:id/users','/:id/teams','post','create','addTeams'];(function(_0x553647,_0xca2dac){var _0x4082fb=function(_0x14061f){while(--_0x14061f){_0x553647['push'](_0x553647['shift']());}};_0x4082fb(++_0xca2dac);}(_0x165d,0x14a));var _0xd165=function(_0x53e646,_0x124cd4){_0x53e646=_0x53e646-0x0;var _0x8963c=_0x165d[_0x53e646];return _0x8963c;};'use strict';var multer=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var path=require(_0xd165('0x2'));var timeout=require(_0xd165('0x3'));var express=require(_0xd165('0x4'));var router=express[_0xd165('0x5')]();var fs_extra=require(_0xd165('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd165('0x9')]);router[_0xd165('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xd165('0xb')]);router[_0xd165('0xa')](_0xd165('0xc'),auth[_0xd165('0xd')](),controller[_0xd165('0xe')]);router[_0xd165('0xa')](_0xd165('0xf'),auth[_0xd165('0xd')](),controller['getAgents']);router[_0xd165('0xa')](_0xd165('0x10'),auth[_0xd165('0xd')](),controller['getTeams']);router[_0xd165('0x11')]('/',auth['isAuthenticated'](),controller[_0xd165('0x12')]);router[_0xd165('0x11')](_0xd165('0xf'),auth[_0xd165('0xd')](),controller['addAgents']);router['post'](_0xd165('0x10'),auth[_0xd165('0xd')](),controller[_0xd165('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd165('0x14')]);router[_0xd165('0x15')]('/:id',auth[_0xd165('0xd')](),controller[_0xd165('0x16')]);router['delete']('/:id/users',auth[_0xd165('0xd')](),controller[_0xd165('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0xd165('0x18')]=router; \ No newline at end of file +var _0x723e=['destroy','delete','removeAgents','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','update'];(function(_0x3f7454,_0x343109){var _0x12a8e7=function(_0x1aacaf){while(--_0x1aacaf){_0x3f7454['push'](_0x3f7454['shift']());}};_0x12a8e7(++_0x343109);}(_0x723e,0x179));var _0xe723=function(_0x4624c4,_0x2620c9){_0x4624c4=_0x4624c4-0x0;var _0x3c0d60=_0x723e[_0x4624c4];return _0x3c0d60;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xc')](_0xe723('0xf'),auth['isAuthenticated'](),controller[_0xe723('0x10')]);router[_0xe723('0xc')](_0xe723('0x11'),auth['isAuthenticated'](),controller[_0xe723('0x12')]);router[_0xe723('0xc')](_0xe723('0x13'),auth['isAuthenticated'](),controller[_0xe723('0x14')]);router[_0xe723('0x15')]('/',auth[_0xe723('0xa')](),controller[_0xe723('0x16')]);router[_0xe723('0x15')]('/:id/users',auth[_0xe723('0xa')](),controller['addAgents']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0xe723('0x17')]);router[_0xe723('0x18')](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x19')]);router['delete'](_0xe723('0xf'),auth[_0xe723('0xa')](),controller[_0xe723('0x1a')]);router[_0xe723('0x1b')](_0xe723('0x11'),auth[_0xe723('0xa')](),controller[_0xe723('0x1c')]);router[_0xe723('0x1b')](_0xe723('0x13'),auth[_0xe723('0xa')](),controller[_0xe723('0x1d')]);module[_0xe723('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 238c7fc..cad234f 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 _0xb1de=['STRING','name','VIRTUAL','system-','sequelize'];(function(_0x44fe3e,_0x4887a2){var _0x278b89=function(_0xe0a54c){while(--_0xe0a54c){_0x44fe3e['push'](_0x44fe3e['shift']());}};_0x278b89(++_0x4887a2);}(_0xb1de,0x135));var _0xeb1d=function(_0x12fac6,_0x3e4af8){_0x12fac6=_0x12fac6-0x0;var _0x3b0893=_0xb1de[_0x12fac6];return _0x3b0893;};'use strict';var Sequelize=require(_0xeb1d('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb1d('0x1')],'allowNull':![],'unique':_0xeb1d('0x2')},'prefix':{'type':Sequelize[_0xeb1d('0x3')],'get':function(_0x3a00a4){return _0xeb1d('0x4')+this['getDataValue'](_0xeb1d('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xeb1d('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7565=['system-','getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL'];(function(_0x477d8f,_0x4e0e3c){var _0x17c560=function(_0x549209){while(--_0x549209){_0x477d8f['push'](_0x477d8f['shift']());}};_0x17c560(++_0x4e0e3c);}(_0x7565,0x7c));var _0x5756=function(_0x302f4a,_0x1f14d1){_0x302f4a=_0x302f4a-0x0;var _0x243d7b=_0x7565[_0x302f4a];return _0x243d7b;};'use strict';var Sequelize=require(_0x5756('0x0'));module[_0x5756('0x1')]={'name':{'type':Sequelize[_0x5756('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x5756('0x3')],'get':function(_0xb50ecd){return _0x5756('0x4')+this[_0x5756('0x5')](_0x5756('0x6'))+'-';}},'description':{'type':Sequelize[_0x5756('0x2')]},'callerIdAll':{'type':Sequelize[_0x5756('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x5756('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6ca6d09..3375b74 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 _0x2032=['sequelize','body','VoiceExtension','user','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','charAt','system-','transaction','findById','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','sort','nolimit','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','User','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','sendStatus','status','end','offset','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','describe','create'];(function(_0x316095,_0xf389f5){var _0x32e9cc=function(_0x1630ba){while(--_0x1630ba){_0x316095['push'](_0x316095['shift']());}};_0x32e9cc(++_0xf389f5);}(_0x2032,0xd9));var _0x2203=function(_0x279119,_0x11fce4){_0x279119=_0x279119-0x0;var _0xc8acb5=_0x2032[_0x279119];return _0xc8acb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2203('0x18')]));require('./voicePrefix.socket')['register'](socket);function respondWithStatusCode(_0x21a3af,_0x472265){_0x472265=_0x472265||0xcc;return function(_0x1c1ead){if(_0x1c1ead){return _0x21a3af[_0x2203('0x19')](_0x472265);}return _0x21a3af[_0x2203('0x1a')](_0x472265)[_0x2203('0x1b')]();};}function respondWithResult(_0x2c36e6,_0x2c085c){_0x2c085c=_0x2c085c||0xc8;return function(_0xdf9d0b){if(_0xdf9d0b){return _0x2c36e6[_0x2203('0x1a')](_0x2c085c)['json'](_0xdf9d0b);}};}function respondWithFilteredResult(_0x280eda,_0x2ee127){return function(_0x4893ff){if(_0x4893ff){var _0x3f9ef6=typeof _0x2ee127[_0x2203('0x1c')]==='undefined'&&typeof _0x2ee127[_0x2203('0x1d')]==='undefined';var _0x2904ba=_0x4893ff[_0x2203('0x1e')];var _0x3c8c34=_0x3f9ef6?0x0:_0x2ee127[_0x2203('0x1c')];var _0x15cb1a=_0x3f9ef6?_0x4893ff[_0x2203('0x1e')]:_0x2ee127['offset']+_0x2ee127[_0x2203('0x1d')];var _0x50822b;if(_0x15cb1a>=_0x2904ba){_0x15cb1a=_0x2904ba;_0x50822b=0xc8;}else{_0x50822b=0xce;}_0x280eda['status'](_0x50822b);return _0x280eda[_0x2203('0x1f')]('Content-Range',_0x3c8c34+'-'+_0x15cb1a+'/'+_0x2904ba)[_0x2203('0x20')](_0x4893ff);}return null;};}function patchUpdates(_0x5bfe61){return function(_0x5d4c4e){try{jsonpatch[_0x2203('0x21')](_0x5d4c4e,_0x5bfe61,!![]);}catch(_0x5e29cd){return BPromise['reject'](_0x5e29cd);}return _0x5d4c4e[_0x2203('0x22')]();};}function saveUpdates(_0x2718f5,_0x21f930){return function(_0xfd0970){if(_0xfd0970){return _0xfd0970[_0x2203('0x23')](_0x2718f5)[_0x2203('0x24')](function(_0x49c12){return _0x49c12;});}return null;};}function removeEntity(_0x250349,_0x576378){return function(_0x143f41){if(_0x143f41){return _0x143f41[_0x2203('0x25')]()[_0x2203('0x24')](function(){var _0x5f11bf=_0x143f41[_0x2203('0x26')]({'plain':!![]});var _0x1cec17='VoicePrefixes';return db[_0x2203('0x27')][_0x2203('0x25')]({'where':{'type':_0x1cec17,'resourceId':_0x5f11bf['id']}})[_0x2203('0x24')](function(){return _0x143f41;});})[_0x2203('0x24')](function(){_0x250349[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x9c53f,_0x5a95c1){return function(_0x34b8ba){if(!_0x34b8ba){_0x9c53f[_0x2203('0x19')](0x194);}return _0x34b8ba;};}function handleError(_0x406ce9,_0x74f035){_0x74f035=_0x74f035||0x1f4;return function(_0x52a426){logger[_0x2203('0x28')](_0x52a426[_0x2203('0x29')]);if(_0x52a426[_0x2203('0x2a')]){delete _0x52a426[_0x2203('0x2a')];}_0x406ce9['status'](_0x74f035)[_0x2203('0x2b')](_0x52a426);};}exports[_0x2203('0x2c')]=function(_0x5e6560,_0x5c0157){var _0x1d5f74={},_0x52fafc={},_0x58b44d={'count':0x0,'rows':[]};var _0x125dfc=_[_0x2203('0x2d')](db[_0x2203('0x2e')][_0x2203('0x2f')],function(_0xf2801d){return{'name':_0xf2801d['fieldName'],'type':_0xf2801d[_0x2203('0x30')][_0x2203('0x31')]};});_0x52fafc['model']=_[_0x2203('0x2d')](_0x125dfc,_0x2203('0x2a'));_0x52fafc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5e6560[_0x2203('0x32')]);_0x52fafc[_0x2203('0x34')]=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],_0x52fafc[_0x2203('0x32')]);_0x1d5f74['attributes']=_[_0x2203('0x35')](_0x52fafc[_0x2203('0x36')],qs['fields'](_0x5e6560['query'][_0x2203('0x37')]));_0x1d5f74['attributes']=_0x1d5f74[_0x2203('0x38')][_0x2203('0x39')]?_0x1d5f74[_0x2203('0x38')]:_0x52fafc['model'];if(!_0x5e6560['query'][_0x2203('0x3a')]('nolimit')){_0x1d5f74[_0x2203('0x1d')]=qs['limit'](_0x5e6560[_0x2203('0x32')]['limit']);_0x1d5f74[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x5e6560[_0x2203('0x32')][_0x2203('0x1c')]);}_0x1d5f74[_0x2203('0x3b')]=qs['sort'](_0x5e6560['query']['sort']);_0x1d5f74[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x5e6560[_0x2203('0x32')],_0x52fafc[_0x2203('0x34')]),_0x125dfc);if(_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]){_0x1d5f74['where']=_[_0x2203('0x3f')](_0x1d5f74[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x125dfc,function(_0x26be74){if(_0x26be74['type']!=='VIRTUAL'){var _0x3ddfe0={};_0x3ddfe0[_0x26be74['name']]={'$like':'%'+_0x5e6560[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3ddfe0;}})});}_0x1d5f74=_[_0x2203('0x3f')]({},_0x1d5f74,_0x5e6560['options']);var _0x5bba52={'where':_0x1d5f74[_0x2203('0x3c')]};return db[_0x2203('0x2e')][_0x2203('0x1e')](_0x5bba52)[_0x2203('0x24')](function(_0x372709){_0x58b44d[_0x2203('0x1e')]=_0x372709;if(_0x5e6560['query'][_0x2203('0x40')]){_0x1d5f74[_0x2203('0x41')]=[{'all':!![]}];}return db[_0x2203('0x2e')][_0x2203('0x42')](_0x1d5f74);})[_0x2203('0x24')](function(_0x36b99f){_0x58b44d[_0x2203('0x43')]=_0x36b99f;return _0x58b44d;})[_0x2203('0x24')](respondWithFilteredResult(_0x5c0157,_0x1d5f74))[_0x2203('0x44')](handleError(_0x5c0157,null));};exports[_0x2203('0x45')]=function(_0x595281,_0x2e2ca5){var _0x24e773={'raw':![],'where':{'id':_0x595281[_0x2203('0x46')]['id']}},_0x4aab80={};_0x4aab80['model']=_['keys'](db[_0x2203('0x2e')]['rawAttributes']);_0x4aab80[_0x2203('0x32')]=_[_0x2203('0x33')](_0x595281[_0x2203('0x32')]);_0x4aab80[_0x2203('0x34')]=_['intersection'](_0x4aab80[_0x2203('0x36')],_0x4aab80[_0x2203('0x32')]);_0x24e773['attributes']=_[_0x2203('0x35')](_0x4aab80[_0x2203('0x36')],qs[_0x2203('0x37')](_0x595281[_0x2203('0x32')]['fields']));_0x24e773['attributes']=_0x24e773[_0x2203('0x38')]['length']?_0x24e773['attributes']:_0x4aab80[_0x2203('0x36')];if(_0x595281[_0x2203('0x32')][_0x2203('0x40')]){_0x24e773['include']=[{'all':!![]}];}_0x24e773=_['merge']({},_0x24e773,_0x595281[_0x2203('0x47')]);return db[_0x2203('0x2e')][_0x2203('0x48')](_0x24e773)[_0x2203('0x24')](handleEntityNotFound(_0x2e2ca5,null))[_0x2203('0x24')](respondWithResult(_0x2e2ca5,null))[_0x2203('0x44')](handleError(_0x2e2ca5,null));};exports['destroy']=function(_0x747dce,_0x557659){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x747dce[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x557659,null))['then'](removeEntity(_0x557659,null))['catch'](handleError(_0x557659,null));};exports[_0x2203('0x49')]=function(_0x1f772d,_0x126aad){return db[_0x2203('0x2e')]['describe']()['then'](respondWithResult(_0x126aad,null))['catch'](handleError(_0x126aad,null));};exports[_0x2203('0x4a')]=function(_0x1c2734,_0x57b891){var _0x7f61df;return db[_0x2203('0x4b')]['transaction'](function(_0x32b1db){return db[_0x2203('0x2e')][_0x2203('0x4a')](_0x1c2734[_0x2203('0x4c')],{'transaction':_0x32b1db})['then'](function(_0x120db1){_0x7f61df=_0x120db1['get']({'plain':!![]});return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x7f61df['VoiceExtensionId']},'raw':!![]})[_0x2203('0x24')](function(_0x8d089e){return createVoicePrefixExtensions(_0x7f61df,_0x8d089e,_0x32b1db);});});})[_0x2203('0x24')](function(){var _0x378132=_0x1c2734[_0x2203('0x4e')][_0x2203('0x26')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x4e')){var _0x524356=_0x7f61df;return db['UserProfileSection'][_0x2203('0x48')]({'where':{'name':_0x2203('0x4f'),'userProfileId':_0x378132[_0x2203('0x50')]},'raw':!![]})['then'](function(_0x213c24){if(_0x213c24&&_0x213c24['autoAssociation']===0x0){return db['UserProfileResource'][_0x2203('0x4a')]({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x213c24['name'],'sectionId':_0x213c24['id']},{})['then'](function(){return _0x7f61df;});}else{return _0x7f61df;}})[_0x2203('0x44')](function(_0x31256b){logger[_0x2203('0x28')](_0x2203('0x51'),_0x31256b);throw _0x31256b;});}return _0x7f61df;})[_0x2203('0x24')](respondWithResult(_0x57b891,null))[_0x2203('0x44')](handleError(_0x57b891,null));};function Extension(_0x2baea2,_0x91f70c,_0x36b5fb,_0x216641){this[_0x2203('0x52')]=_0x2203('0x53');this['exten']=_0x2baea2;this['app']=_0x36b5fb;this[_0x2203('0x30')]=_0x2203('0x54');this[_0x2203('0x55')]=_0x2203('0x56');this[_0x2203('0x57')]=_0x91f70c;this[_0x2203('0x58')]=_0x216641;}function createVoicePrefixExtensions(_0x4f8b8e,_0x5486f9,_0xb49120){return new BPromise(function(_0x34358e,_0x21ee59){var _0x1e6d21=new Extension(formatPrefixName(_0x4f8b8e[_0x2203('0x59')]),0x1,_0x2203('0x5a'),_0x2203('0x5b'));_0x1e6d21[_0x2203('0x5c')]=_0x4f8b8e['id'];return db[_0x2203('0x4d')][_0x2203('0x4a')](_0x1e6d21,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x48bed1){var _0x1ea97a=_0x48bed1[_0x2203('0x26')]({'plain':!![]});var _0x3ce9f5=_[_0x2203('0x2d')](addVoicePrefixExtensions(_0x4f8b8e,_0x5486f9),function(_0x41a938){_0x41a938[_0x2203('0x5d')]=_0x1ea97a['id'];_0x41a938[_0x2203('0x5c')]=_0x4f8b8e['id'];return _0x41a938;});return db[_0x2203('0x4d')][_0x2203('0x5e')](_0x3ce9f5,{'transaction':_0xb49120})[_0x2203('0x24')](function(_0x49e795){if(!_0x49e795){return _0x21ee59(_0x2203('0x5f'));}else{return _0x34358e(_0x49e795);}})[_0x2203('0x44')](function(_0x24179a){return _0x21ee59(_0x24179a);});});;});};function addVoicePrefixExtensions(_0xc193b7,_0x34e820){var _0x1e44c=[];var _0x1068bc=formatPrefixName(_0xc193b7[_0x2203('0x59')]);_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x2,'Set',_0x2203('0x61')+_0xc193b7[_0x2203('0x2a')]));if(_0xc193b7[_0x2203('0x62')]){_0x1e44c['push'](new Extension(_0x1068bc,0x3,_0x2203('0x63'),_0x2203('0x64')+_0xc193b7[_0x2203('0x62')]));}else{_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x3,_0x2203('0x5a'),'No\x20callerid\x20available'));}_0x1e44c[_0x2203('0x60')](new Extension(_0x1068bc,0x4,_0x2203('0x65'),_0x34e820[_0x2203('0x52')]+','+'${EXTEN:'+(0x8+_0xc193b7['name']['length'])+'}'+','+0x1));return _0x1e44c;}function formatPrefixName(_0x485e5b){var _0x595814='_';for(var _0x418d48=0x0;_0x418d48<_0x485e5b[_0x2203('0x39')];_0x418d48++){if(_0x485e5b[_0x2203('0x66')](_0x418d48)=='-'){_0x595814+=_0x485e5b[_0x2203('0x66')](_0x418d48);}else{_0x595814+='['+_0x485e5b[_0x2203('0x66')](_0x418d48)+']';}}_0x595814+='.';return _0x595814;}exports[_0x2203('0x23')]=function(_0x3f7926,_0x44bea0,_0x56dcbe){var _0x500860=_0x3f7926[_0x2203('0x4c')];_0x500860[_0x2203('0x59')]=_0x2203('0x67')+_0x500860[_0x2203('0x2a')]+'-';return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x45cc3a){return db[_0x2203('0x2e')][_0x2203('0x23')](_0x500860,{'where':{'id':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x25')]({'where':{'VoicePrefixId':_0x500860['id']},'transaction':_0x45cc3a})[_0x2203('0x24')](function(){return db[_0x2203('0x4d')][_0x2203('0x48')]({'where':{'id':_0x500860[_0x2203('0x5d')]},'raw':!![]})[_0x2203('0x24')](function(_0x173ac1){return createVoicePrefixExtensions(_0x500860,_0x173ac1,_0x45cc3a);});});});})[_0x2203('0x24')](function(){return db['VoicePrefix'][_0x2203('0x69')](_0x500860['id']);})['then'](respondWithResult(_0x44bea0,null))[_0x2203('0x44')](handleError(_0x44bea0,null));};exports['addAgents']=function(_0x5ba500,_0xf71e7e,_0x269649){return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x5ba500[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0xf71e7e,null))[_0x2203('0x24')](function(_0x4e9a01){if(_0x4e9a01){return _0x4e9a01['addAgents'](_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')],_[_0x2203('0x6b')](_0x5ba500['body'],['ids','id'])||{})['spread'](function(_0xdff006){for(var _0x2d26ba=0x0;_0x2d26ba<_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')]['length'];_0x2d26ba+=0x1){socket[_0x2203('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x5ba500[_0x2203('0x4c')][_0x2203('0x6a')][_0x2d26ba]),'VoicePrefixId':Number(_0x5ba500[_0x2203('0x46')]['id'])});}return _0xdff006;});}})[_0x2203('0x24')](respondWithResult(_0xf71e7e,null))[_0x2203('0x44')](handleError(_0xf71e7e,null));};exports['removeAgents']=function(_0x4592fa,_0x247f26,_0x18663f){return db['VoicePrefix'][_0x2203('0x48')]({'where':{'id':_0x4592fa[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x247f26,null))[_0x2203('0x24')](function(_0x1c65f9){if(_0x1c65f9){return _0x1c65f9[_0x2203('0x6d')](_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')])[_0x2203('0x24')](function(){if(_[_0x2203('0x6e')](_0x4592fa[_0x2203('0x32')]['ids'])){for(var _0x1adfa6=0x0;_0x1adfa6<_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x2203('0x39')];_0x1adfa6+=0x1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')][_0x2203('0x6a')][_0x1adfa6]),'VoicePrefixId':Number(_0x4592fa[_0x2203('0x46')]['id'])});}}else{socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':Number(_0x4592fa[_0x2203('0x32')]['ids']),'VoicePrefixId':Number(_0x4592fa['params']['id'])});}});}})[_0x2203('0x24')](respondWithStatusCode(_0x247f26,null))[_0x2203('0x44')](handleError(_0x247f26,null));};exports[_0x2203('0x70')]=function(_0xb6863b,_0x42dce6,_0x4fd029){var _0x16e518={};var _0x3cb792={};var _0x4e539b;var _0x511689;return db['VoicePrefix']['findOne']({'where':{'id':_0xb6863b['params']['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x42dce6,null))[_0x2203('0x24')](function(_0x437095){if(_0x437095){_0x4e539b=_0x437095;_0x3cb792['model']=_['keys'](db['User'][_0x2203('0x2f')]);_0x3cb792[_0x2203('0x32')]=_[_0x2203('0x33')](_0xb6863b[_0x2203('0x32')]);_0x3cb792[_0x2203('0x34')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],_0x3cb792['query']);_0x16e518[_0x2203('0x38')]=_[_0x2203('0x35')](_0x3cb792[_0x2203('0x36')],qs[_0x2203('0x37')](_0xb6863b[_0x2203('0x32')][_0x2203('0x37')]));_0x16e518[_0x2203('0x38')]=_0x16e518['attributes'][_0x2203('0x39')]?_0x16e518['attributes']:_0x3cb792['model'];_0x16e518[_0x2203('0x3b')]=qs['sort'](_0xb6863b[_0x2203('0x32')][_0x2203('0x71')]);_0x16e518['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0xb6863b[_0x2203('0x32')],_0x3cb792[_0x2203('0x34')]));if(_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]){_0x16e518['where']=_[_0x2203('0x3f')](_0x16e518[_0x2203('0x3c')],{'$or':_['map'](_0x16e518['attributes'],function(_0x377176){var _0x3fe71b={};_0x3fe71b[_0x377176]={'$like':'%'+_0xb6863b[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x3fe71b;})});}_0x16e518=_[_0x2203('0x3f')]({},_0x16e518,_0xb6863b[_0x2203('0x47')]);return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x4749df){if(_0x4749df){_0x511689=_0x4749df[_0x2203('0x39')];if(!_0xb6863b[_0x2203('0x32')][_0x2203('0x3a')](_0x2203('0x72'))){_0x16e518[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0xb6863b[_0x2203('0x32')]['limit']);_0x16e518['offset']=qs[_0x2203('0x1c')](_0xb6863b[_0x2203('0x32')]['offset']);}return _0x4e539b[_0x2203('0x70')](_0x16e518);}})[_0x2203('0x24')](function(_0x5b5e95){if(_0x5b5e95){return _0x5b5e95?{'count':_0x511689,'rows':_0x5b5e95}:null;}})[_0x2203('0x24')](respondWithResult(_0x42dce6,null))[_0x2203('0x44')](handleError(_0x42dce6,null));};exports['getTeams']=function(_0x21f357,_0x10c65a,_0x541639){var _0x318f3f={};var _0x1c4b57={};var _0x3cfe3f;var _0x1596f7;return db['VoicePrefix']['findOne']({'where':{'id':_0x21f357[_0x2203('0x46')]['id']}})[_0x2203('0x24')](handleEntityNotFound(_0x10c65a,null))[_0x2203('0x24')](function(_0x4ff77f){if(_0x4ff77f){_0x3cfe3f=_0x4ff77f;_0x1c4b57['model']=_[_0x2203('0x33')](db[_0x2203('0x73')][_0x2203('0x2f')]);_0x1c4b57['query']=_['keys'](_0x21f357[_0x2203('0x32')]);_0x1c4b57[_0x2203('0x34')]=_['intersection'](_0x1c4b57[_0x2203('0x36')],_0x1c4b57[_0x2203('0x32')]);_0x318f3f['attributes']=_[_0x2203('0x35')](_0x1c4b57['model'],qs[_0x2203('0x37')](_0x21f357['query']['fields']));_0x318f3f['attributes']=_0x318f3f[_0x2203('0x38')][_0x2203('0x39')]?_0x318f3f['attributes']:_0x1c4b57[_0x2203('0x36')];_0x318f3f[_0x2203('0x3b')]=qs[_0x2203('0x71')](_0x21f357['query'][_0x2203('0x71')]);_0x318f3f['where']=qs[_0x2203('0x34')](_[_0x2203('0x3d')](_0x21f357['query'],_0x1c4b57[_0x2203('0x34')]));if(_0x21f357[_0x2203('0x32')]['filter']){_0x318f3f[_0x2203('0x3c')]=_[_0x2203('0x3f')](_0x318f3f[_0x2203('0x3c')],{'$or':_[_0x2203('0x2d')](_0x318f3f[_0x2203('0x38')],function(_0x5d73a7){var _0x2ba7d3={};_0x2ba7d3[_0x5d73a7]={'$like':'%'+_0x21f357[_0x2203('0x32')][_0x2203('0x3e')]+'%'};return _0x2ba7d3;})});}_0x318f3f=_[_0x2203('0x3f')]({},_0x318f3f,_0x21f357[_0x2203('0x47')]);return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})['then'](function(_0x29b41b){if(_0x29b41b){_0x1596f7=_0x29b41b[_0x2203('0x39')];if(!_0x21f357['query'][_0x2203('0x3a')]('nolimit')){_0x318f3f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x21f357[_0x2203('0x32')]['limit']);_0x318f3f[_0x2203('0x1c')]=qs[_0x2203('0x1c')](_0x21f357[_0x2203('0x32')][_0x2203('0x1c')]);}return _0x3cfe3f[_0x2203('0x74')](_0x318f3f);}})[_0x2203('0x24')](function(_0x1ccf09){if(_0x1ccf09){return _0x1ccf09?{'count':_0x1596f7,'rows':_0x1ccf09}:null;}})['then'](respondWithResult(_0x10c65a,null))['catch'](handleError(_0x10c65a,null));};exports[_0x2203('0x75')]=function(_0x41eb4c,_0x25996c,_0x4e1f55){var _0x2188d4=_0x41eb4c[_0x2203('0x4c')][_0x2203('0x6a')];var _0x500604;return db[_0x2203('0x73')][_0x2203('0x42')]({'where':{'id':_0x2188d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2203('0x76'),'attributes':['id','name',_0x2203('0x77'),_0x2203('0x78'),'interface'],'raw':!![]}]})[_0x2203('0x24')](function(_0x9586e1){if(_0x9586e1){_0x500604=_0x9586e1;var _0x266d7e=_[_0x2203('0x79')](_0x9586e1,function(_0x34a160){var _0x36ab7f=_0x34a160[_0x2203('0x26')]({'plain':!![]});return _0x36ab7f[_0x2203('0x76')];});return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x41eb4c[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x4e7ba1){return db[_0x2203('0x4b')]['transaction'](function(_0x114e07){return _0x4e7ba1[_0x2203('0x75')](_0x2188d4,{'transaction':_0x114e07})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x500604,function(_0x145a72){return db[_0x2203('0x7b')][_0x2203('0x7c')]({'TeamId':_0x145a72['id'],'VoicePrefixId':_0x41eb4c[_0x2203('0x46')]['id']},{'transaction':_0x114e07});});})[_0x2203('0x24')](function(){return BPromise[_0x2203('0x7a')](_0x266d7e,function(_0x62843c){return db['UserVoicePrefix'][_0x2203('0x7d')]({'where':{'UserId':_0x62843c['id'],'VoicePrefixId':_0x41eb4c['params']['id']},'transaction':_0x114e07});});})[_0x2203('0x24')](function(){_0x266d7e[_0x2203('0x7e')](function(_0x6b8ea4){socket['emit'](_0x2203('0x7f'),{'UserId':_0x6b8ea4['id'],'VoicePrefixId':_0x4e7ba1['id']});});});});});}})[_0x2203('0x24')](respondWithStatusCode(_0x25996c,null))[_0x2203('0x44')](handleError(_0x25996c,null));};exports[_0x2203('0x80')]=function(_0x4316ae,_0x5c1138,_0x389f7f){return db['Team'][_0x2203('0x42')]({'where':{'id':_0x4316ae[_0x2203('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2203('0x81')],'as':_0x2203('0x76'),'attributes':['id'],'raw':!![]}]})[_0x2203('0x24')](handleEntityNotFound(_0x5c1138,null))[_0x2203('0x24')](function(_0x56c2cb){var _0x12179d=_['map'](_0x56c2cb,'id');var _0x55e083=[];var _0x4055eb=[];var _0x95b45a=squel[_0x2203('0x82')]();_0x95b45a[_0x2203('0x83')](_0x2203('0x84'))[_0x2203('0x85')](_0x2203('0x86'),'tq')['join'](_0x2203('0x87'),'ut',_0x2203('0x88'))[_0x2203('0x3c')]('VoicePrefixId\x20=\x20?',_0x4316ae['params']['id']);for(var _0x4d6ece=0x0;_0x4d6ece<_0x56c2cb[_0x2203('0x39')];_0x4d6ece+=0x1){let _0x46b5e6=_0x56c2cb[_0x4d6ece];for(var _0x3dba31=0x0;_0x3dba31<_0x46b5e6[_0x2203('0x76')]['length'];_0x3dba31+=0x1){let _0x238e6f=_0x46b5e6[_0x2203('0x76')][_0x3dba31];var _0x46146e=_0x95b45a[_0x2203('0x89')]();_0x46146e['where']('ut.UserId\x20=\x20?',_0x238e6f['id']);_0x4055eb[_0x2203('0x60')](db[_0x2203('0x4b')][_0x2203('0x32')](_0x46146e['toString'](),{'type':db[_0x2203('0x4b')][_0x2203('0x8a')][_0x2203('0x8b')]})[_0x2203('0x24')](function(_0x263130){if(_0x263130[_0x2203('0x39')]===0x1){return _0x238e6f['id'];}else{var _0xbee79c=_['every'](_[_0x2203('0x2d')](_0x263130,_0x2203('0x8c')),function(_0x131332){return _[_0x2203('0x8d')](_0x12179d,_0x131332);});if(_0xbee79c){return _0x238e6f['id'];}}}));}}return BPromise[_0x2203('0x8e')](_0x4055eb)[_0x2203('0x24')](function(_0x2d9004){_0x55e083=_(_0x55e083)[_0x2203('0x8f')](_0x2d9004)[_0x2203('0x90')]()['value']();return db[_0x2203('0x2e')][_0x2203('0x48')]({'where':{'id':_0x4316ae[_0x2203('0x46')]['id']}})[_0x2203('0x24')](function(_0x547eb9){return db[_0x2203('0x4b')][_0x2203('0x68')](function(_0x1022ef){return _0x547eb9[_0x2203('0x80')](_0x4316ae[_0x2203('0x32')][_0x2203('0x6a')],{'transaction':_0x1022ef})[_0x2203('0x24')](function(){if(!_[_0x2203('0x91')](_0x55e083)){return _0x547eb9[_0x2203('0x6d')](_0x55e083,{'transaction':_0x1022ef});}})['then'](function(){_0x55e083['forEach'](function(_0x225ea1){socket[_0x2203('0x6c')](_0x2203('0x6f'),{'UserId':_0x225ea1,'VoicePrefixId':_0x547eb9['id']});});});});});});})[_0x2203('0x24')](respondWithStatusCode(_0x5c1138,null))['catch'](handleError(_0x5c1138,null));}; \ No newline at end of file +var _0x0598=['bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','options','find','describe','sequelize','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch'];(function(_0x241fc6,_0x1ff659){var _0x2639ba=function(_0x3c6bdc){while(--_0x3c6bdc){_0x241fc6['push'](_0x241fc6['shift']());}};_0x2639ba(++_0x1ff659);}(_0x0598,0x92));var _0x8059=function(_0x18ec10,_0x3394cd){_0x18ec10=_0x18ec10-0x0;var _0x2b3d96=_0x0598[_0x18ec10];return _0x2b3d96;};'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'];config[_0x8059('0x12')]=_[_0x8059('0x13')](config[_0x8059('0x12')],{'host':_0x8059('0x14'),'port':0x18eb});var socket=require(_0x8059('0x15'))(new Redis(config['redis']));require(_0x8059('0x16'))['register'](socket);function respondWithStatusCode(_0x346b23,_0x5c916e){_0x5c916e=_0x5c916e||0xcc;return function(_0x3e4f08){if(_0x3e4f08){return _0x346b23[_0x8059('0x17')](_0x5c916e);}return _0x346b23[_0x8059('0x18')](_0x5c916e)['end']();};}function respondWithResult(_0x516c1f,_0x5cda43){_0x5cda43=_0x5cda43||0xc8;return function(_0x3b8f18){if(_0x3b8f18){return _0x516c1f[_0x8059('0x18')](_0x5cda43)[_0x8059('0x19')](_0x3b8f18);}};}function respondWithFilteredResult(_0x246c9d,_0x3abfe8){return function(_0x4b6d55){if(_0x4b6d55){var _0x10ad98=typeof _0x3abfe8[_0x8059('0x1a')]===_0x8059('0x1b')&&typeof _0x3abfe8[_0x8059('0x1c')]==='undefined';var _0x5456a9=_0x4b6d55['count'];var _0x113f42=_0x10ad98?0x0:_0x3abfe8['offset'];var _0x1857c1=_0x10ad98?_0x4b6d55['count']:_0x3abfe8[_0x8059('0x1a')]+_0x3abfe8[_0x8059('0x1c')];var _0x1e9ac5;if(_0x1857c1>=_0x5456a9){_0x1857c1=_0x5456a9;_0x1e9ac5=0xc8;}else{_0x1e9ac5=0xce;}_0x246c9d['status'](_0x1e9ac5);return _0x246c9d['set'](_0x8059('0x1d'),_0x113f42+'-'+_0x1857c1+'/'+_0x5456a9)[_0x8059('0x19')](_0x4b6d55);}return null;};}function patchUpdates(_0x32aeda){return function(_0x1585a3){try{jsonpatch['apply'](_0x1585a3,_0x32aeda,!![]);}catch(_0x3bc226){return BPromise[_0x8059('0x1e')](_0x3bc226);}return _0x1585a3[_0x8059('0x1f')]();};}function saveUpdates(_0x5449d9,_0xe9a72d){return function(_0x2256b1){if(_0x2256b1){return _0x2256b1[_0x8059('0x20')](_0x5449d9)[_0x8059('0x21')](function(_0x59d3a6){return _0x59d3a6;});}return null;};}function removeEntity(_0x140f64,_0x2cd179){return function(_0x4781e2){if(_0x4781e2){return _0x4781e2[_0x8059('0x22')]()[_0x8059('0x21')](function(){var _0x54b88b=_0x4781e2[_0x8059('0x23')]({'plain':!![]});var _0x19b95a=_0x8059('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x19b95a,'resourceId':_0x54b88b['id']}})['then'](function(){return _0x4781e2;});})[_0x8059('0x21')](function(){_0x140f64[_0x8059('0x18')](0xcc)[_0x8059('0x25')]();});}};}function handleEntityNotFound(_0x1009af,_0x59abe9){return function(_0x1eb71b){if(!_0x1eb71b){_0x1009af['sendStatus'](0x194);}return _0x1eb71b;};}function handleError(_0x2f887c,_0x35c73e){_0x35c73e=_0x35c73e||0x1f4;return function(_0x5ecf7f){logger[_0x8059('0x26')](_0x5ecf7f[_0x8059('0x27')]);if(_0x5ecf7f[_0x8059('0x28')]){delete _0x5ecf7f[_0x8059('0x28')];}_0x2f887c[_0x8059('0x18')](_0x35c73e)[_0x8059('0x29')](_0x5ecf7f);};}exports[_0x8059('0x2a')]=function(_0x2016ea,_0x505756){var _0xb3c36e={},_0x40b39e={},_0x1f8983={'count':0x0,'rows':[]};var _0x15f843=_[_0x8059('0x2b')](db['VoicePrefix'][_0x8059('0x2c')],function(_0x22c492){return{'name':_0x22c492[_0x8059('0x2d')],'type':_0x22c492[_0x8059('0x2e')][_0x8059('0x2f')]};});_0x40b39e[_0x8059('0x30')]=_[_0x8059('0x2b')](_0x15f843,_0x8059('0x28'));_0x40b39e[_0x8059('0x31')]=_[_0x8059('0x32')](_0x2016ea['query']);_0x40b39e[_0x8059('0x33')]=_['intersection'](_0x40b39e[_0x8059('0x30')],_0x40b39e['query']);_0xb3c36e['attributes']=_[_0x8059('0x34')](_0x40b39e['model'],qs[_0x8059('0x35')](_0x2016ea['query'][_0x8059('0x35')]));_0xb3c36e['attributes']=_0xb3c36e[_0x8059('0x36')][_0x8059('0x37')]?_0xb3c36e['attributes']:_0x40b39e[_0x8059('0x30')];if(!_0x2016ea[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0xb3c36e[_0x8059('0x1c')]=qs['limit'](_0x2016ea[_0x8059('0x31')]['limit']);_0xb3c36e[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x2016ea[_0x8059('0x31')][_0x8059('0x1a')]);}_0xb3c36e['order']=qs[_0x8059('0x39')](_0x2016ea['query']['sort']);_0xb3c36e[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x2016ea[_0x8059('0x31')],_0x40b39e[_0x8059('0x33')]),_0x15f843);if(_0x2016ea['query']['filter']){_0xb3c36e['where']=_['merge'](_0xb3c36e[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x15f843,function(_0xc84f04){if(_0xc84f04['type']!==_0x8059('0x3c')){var _0x406ec3={};_0x406ec3[_0xc84f04['name']]={'$like':'%'+_0x2016ea[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x406ec3;}})});}_0xb3c36e=_[_0x8059('0x3e')]({},_0xb3c36e,_0x2016ea['options']);var _0x2c48cf={'where':_0xb3c36e[_0x8059('0x3a')]};return db['VoicePrefix'][_0x8059('0x3f')](_0x2c48cf)[_0x8059('0x21')](function(_0x3f00de){_0x1f8983[_0x8059('0x3f')]=_0x3f00de;if(_0x2016ea[_0x8059('0x31')][_0x8059('0x40')]){_0xb3c36e[_0x8059('0x41')]=[{'all':!![]}];}return db[_0x8059('0x42')][_0x8059('0x43')](_0xb3c36e);})[_0x8059('0x21')](function(_0x1d64db){_0x1f8983[_0x8059('0x44')]=_0x1d64db;return _0x1f8983;})[_0x8059('0x21')](respondWithFilteredResult(_0x505756,_0xb3c36e))[_0x8059('0x45')](handleError(_0x505756,null));};exports[_0x8059('0x46')]=function(_0x93ee2f,_0x35c94a){var _0x25f542={'raw':![],'where':{'id':_0x93ee2f[_0x8059('0x47')]['id']}},_0x1b613f={};_0x1b613f[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x42')]['rawAttributes']);_0x1b613f[_0x8059('0x31')]=_['keys'](_0x93ee2f['query']);_0x1b613f[_0x8059('0x33')]=_['intersection'](_0x1b613f[_0x8059('0x30')],_0x1b613f['query']);_0x25f542[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1b613f[_0x8059('0x30')],qs[_0x8059('0x35')](_0x93ee2f[_0x8059('0x31')][_0x8059('0x35')]));_0x25f542['attributes']=_0x25f542[_0x8059('0x36')]['length']?_0x25f542[_0x8059('0x36')]:_0x1b613f[_0x8059('0x30')];if(_0x93ee2f[_0x8059('0x31')]['includeAll']){_0x25f542[_0x8059('0x41')]=[{'all':!![]}];}_0x25f542=_[_0x8059('0x3e')]({},_0x25f542,_0x93ee2f[_0x8059('0x48')]);return db[_0x8059('0x42')]['find'](_0x25f542)[_0x8059('0x21')](handleEntityNotFound(_0x35c94a,null))[_0x8059('0x21')](respondWithResult(_0x35c94a,null))[_0x8059('0x45')](handleError(_0x35c94a,null));};exports['destroy']=function(_0x2ba3f1,_0x5d9458){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x2ba3f1['params']['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x5d9458,null))['then'](removeEntity(_0x5d9458,null))[_0x8059('0x45')](handleError(_0x5d9458,null));};exports[_0x8059('0x4a')]=function(_0x5ea40c,_0x20d779){return db['VoicePrefix'][_0x8059('0x4a')]()[_0x8059('0x21')](respondWithResult(_0x20d779,null))[_0x8059('0x45')](handleError(_0x20d779,null));};exports['create']=function(_0x2dd991,_0x5035a9){var _0x21ceef;return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0xb63fee){return db['VoicePrefix'][_0x8059('0x4d')](_0x2dd991[_0x8059('0x4e')],{'transaction':_0xb63fee})['then'](function(_0x41e280){_0x21ceef=_0x41e280['get']({'plain':!![]});return db[_0x8059('0x4f')]['find']({'where':{'id':_0x21ceef['VoiceExtensionId']},'raw':!![]})[_0x8059('0x21')](function(_0x388829){return createVoicePrefixExtensions(_0x21ceef,_0x388829,_0xb63fee);});});})[_0x8059('0x21')](function(){var _0x3afe66=_0x2dd991[_0x8059('0x50')][_0x8059('0x23')]({'plain':!![]});if(!_0x3afe66)throw new Error(_0x8059('0x51'));if(_0x3afe66['role']==='user'){var _0x52ed37=_0x21ceef;return db['UserProfileSection'][_0x8059('0x49')]({'where':{'name':_0x8059('0x24'),'userProfileId':_0x3afe66['userProfileId']},'raw':!![]})[_0x8059('0x21')](function(_0x4b0078){if(_0x4b0078&&_0x4b0078['autoAssociation']===0x0){return db[_0x8059('0x52')]['create']({'name':_0x52ed37[_0x8059('0x28')],'resourceId':_0x52ed37['id'],'type':_0x4b0078[_0x8059('0x28')],'sectionId':_0x4b0078['id']},{})[_0x8059('0x21')](function(){return _0x21ceef;});}else{return _0x21ceef;}})['catch'](function(_0x52511f){logger[_0x8059('0x26')](_0x8059('0x53'),_0x52511f);throw _0x52511f;});}return _0x21ceef;})[_0x8059('0x21')](respondWithResult(_0x5035a9,null))['catch'](handleError(_0x5035a9,null));};function Extension(_0x501f2c,_0x1260b1,_0x538460,_0x479a19){this[_0x8059('0x54')]='from-sip';this[_0x8059('0x55')]=_0x501f2c;this[_0x8059('0x56')]=_0x538460;this['type']='system';this[_0x8059('0x57')]=_0x8059('0x58');this[_0x8059('0x59')]=_0x1260b1;this['appdata']=_0x479a19;}function createVoicePrefixExtensions(_0x2d9df5,_0x4452ab,_0xc6b6d8){return new BPromise(function(_0x18bce2,_0x4b4dbe){var _0x1b3553=new Extension(formatPrefixName(_0x2d9df5['prefix']),0x1,_0x8059('0x5a'),_0x8059('0x5b'));_0x1b3553['VoicePrefixId']=_0x2d9df5['id'];return db[_0x8059('0x4f')]['create'](_0x1b3553,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x319c65){var _0x2e8ef2=_0x319c65[_0x8059('0x23')]({'plain':!![]});var _0x2750b0=_[_0x8059('0x2b')](addVoicePrefixExtensions(_0x2d9df5,_0x4452ab),function(_0x28b466){_0x28b466[_0x8059('0x5c')]=_0x2e8ef2['id'];_0x28b466[_0x8059('0x5d')]=_0x2d9df5['id'];return _0x28b466;});return db[_0x8059('0x4f')][_0x8059('0x5e')](_0x2750b0,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x325f9c){if(!_0x325f9c){return _0x4b4dbe('Extensions\x20creation\x20failed');}else{return _0x18bce2(_0x325f9c);}})[_0x8059('0x45')](function(_0x2dc612){return _0x4b4dbe(_0x2dc612);});});;});};function addVoicePrefixExtensions(_0x391924,_0x421682){var _0x2cf1fd=[];var _0x59a211=formatPrefixName(_0x391924[_0x8059('0x5f')]);_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x2,_0x8059('0x61'),_0x8059('0x62')+_0x391924[_0x8059('0x28')]));if(_0x391924[_0x8059('0x63')]){_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x61'),_0x8059('0x64')+_0x391924['callerIdAll']));}else{_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x5a'),_0x8059('0x65')));}_0x2cf1fd['push'](new Extension(_0x59a211,0x4,'goto',_0x421682[_0x8059('0x54')]+','+_0x8059('0x66')+(0x8+_0x391924[_0x8059('0x28')][_0x8059('0x37')])+'}'+','+0x1));return _0x2cf1fd;}function formatPrefixName(_0x1878a6){var _0x2a1833='_';for(var _0x18b3d8=0x0;_0x18b3d8<_0x1878a6['length'];_0x18b3d8++){if(_0x1878a6[_0x8059('0x67')](_0x18b3d8)=='-'){_0x2a1833+=_0x1878a6[_0x8059('0x67')](_0x18b3d8);}else{_0x2a1833+='['+_0x1878a6[_0x8059('0x67')](_0x18b3d8)+']';}}_0x2a1833+='.';return _0x2a1833;}exports['update']=function(_0x3cacf8,_0x255ade,_0x3cd45d){var _0x2d4970=_0x3cacf8['body'];_0x2d4970['prefix']=_0x8059('0x68')+_0x2d4970[_0x8059('0x28')]+'-';return db['sequelize'][_0x8059('0x4c')](function(_0x1c19b0){return db[_0x8059('0x42')][_0x8059('0x20')](_0x2d4970,{'where':{'id':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')][_0x8059('0x49')]({'where':{'id':_0x2d4970['VoiceExtensionId']},'raw':!![]})['then'](function(_0x36b586){return createVoicePrefixExtensions(_0x2d4970,_0x36b586,_0x1c19b0);});});});})[_0x8059('0x21')](function(){return db['VoicePrefix'][_0x8059('0x69')](_0x2d4970['id']);})[_0x8059('0x21')](respondWithResult(_0x255ade,null))[_0x8059('0x45')](handleError(_0x255ade,null));};exports[_0x8059('0x6a')]=function(_0x2009d9,_0xb36842,_0x2596ff){return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x2009d9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0xb36842,null))[_0x8059('0x21')](function(_0x598596){if(_0x598596){return _0x598596[_0x8059('0x6a')](_0x2009d9[_0x8059('0x4e')][_0x8059('0x6b')],_['omit'](_0x2009d9['body'],[_0x8059('0x6b'),'id'])||{})['spread'](function(_0x4b31cb){for(var _0x1554ca=0x0;_0x1554ca<_0x2009d9[_0x8059('0x4e')]['ids'][_0x8059('0x37')];_0x1554ca+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x2009d9['body'][_0x8059('0x6b')][_0x1554ca]),'VoicePrefixId':Number(_0x2009d9['params']['id'])});}return _0x4b31cb;});}})['then'](respondWithResult(_0xb36842,null))[_0x8059('0x45')](handleError(_0xb36842,null));};exports[_0x8059('0x6d')]=function(_0x230c39,_0x3be51a,_0x55257a){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x230c39[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x3be51a,null))[_0x8059('0x21')](function(_0x1611d0){if(_0x1611d0){return _0x1611d0[_0x8059('0x6d')](_0x230c39['query']['ids'])[_0x8059('0x21')](function(){if(_[_0x8059('0x6e')](_0x230c39[_0x8059('0x31')]['ids'])){for(var _0x25bae4=0x0;_0x25bae4<_0x230c39[_0x8059('0x31')]['ids'][_0x8059('0x37')];_0x25bae4+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:remove',{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')][_0x25bae4]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}}else{socket[_0x8059('0x6c')](_0x8059('0x6f'),{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}});}})[_0x8059('0x21')](respondWithStatusCode(_0x3be51a,null))['catch'](handleError(_0x3be51a,null));};exports['getAgents']=function(_0x1b9f1a,_0x1452ed,_0x3fbdbe){var _0x32c6f2={};var _0x1a92c9={};var _0x29715f;var _0x5f3d1a;return db[_0x8059('0x42')][_0x8059('0x70')]({'where':{'id':_0x1b9f1a[_0x8059('0x47')]['id']}})['then'](handleEntityNotFound(_0x1452ed,null))[_0x8059('0x21')](function(_0x3c3b4d){if(_0x3c3b4d){_0x29715f=_0x3c3b4d;_0x1a92c9[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x71')][_0x8059('0x2c')]);_0x1a92c9[_0x8059('0x31')]=_[_0x8059('0x32')](_0x1b9f1a[_0x8059('0x31')]);_0x1a92c9[_0x8059('0x33')]=_[_0x8059('0x34')](_0x1a92c9[_0x8059('0x30')],_0x1a92c9[_0x8059('0x31')]);_0x32c6f2[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1a92c9['model'],qs[_0x8059('0x35')](_0x1b9f1a[_0x8059('0x31')]['fields']));_0x32c6f2[_0x8059('0x36')]=_0x32c6f2['attributes'][_0x8059('0x37')]?_0x32c6f2[_0x8059('0x36')]:_0x1a92c9[_0x8059('0x30')];_0x32c6f2[_0x8059('0x72')]=qs[_0x8059('0x39')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x39')]);_0x32c6f2[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x1b9f1a[_0x8059('0x31')],_0x1a92c9[_0x8059('0x33')]));if(_0x1b9f1a['query']['filter']){_0x32c6f2[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x32c6f2['where'],{'$or':_[_0x8059('0x2b')](_0x32c6f2['attributes'],function(_0x27fb1c){var _0x33e2e9={};_0x33e2e9[_0x27fb1c]={'$like':'%'+_0x1b9f1a[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x33e2e9;})});}_0x32c6f2=_[_0x8059('0x3e')]({},_0x32c6f2,_0x1b9f1a[_0x8059('0x48')]);return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x403f68){if(_0x403f68){_0x5f3d1a=_0x403f68[_0x8059('0x37')];if(!_0x1b9f1a['query'][_0x8059('0x38')](_0x8059('0x74'))){_0x32c6f2['limit']=qs[_0x8059('0x1c')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x1c')]);_0x32c6f2[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x1b9f1a['query'][_0x8059('0x1a')]);}return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x360f2d){if(_0x360f2d){return _0x360f2d?{'count':_0x5f3d1a,'rows':_0x360f2d}:null;}})['then'](respondWithResult(_0x1452ed,null))[_0x8059('0x45')](handleError(_0x1452ed,null));};exports[_0x8059('0x75')]=function(_0x6356ed,_0x36c21b,_0x299b67){var _0x43388b={};var _0x29e863={};var _0x3ac878;var _0x163883;return db[_0x8059('0x42')]['findOne']({'where':{'id':_0x6356ed[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x36c21b,null))[_0x8059('0x21')](function(_0x3fe77d){if(_0x3fe77d){_0x3ac878=_0x3fe77d;_0x29e863[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x76')][_0x8059('0x2c')]);_0x29e863[_0x8059('0x31')]=_[_0x8059('0x32')](_0x6356ed['query']);_0x29e863[_0x8059('0x33')]=_[_0x8059('0x34')](_0x29e863[_0x8059('0x30')],_0x29e863[_0x8059('0x31')]);_0x43388b[_0x8059('0x36')]=_[_0x8059('0x34')](_0x29e863['model'],qs['fields'](_0x6356ed[_0x8059('0x31')]['fields']));_0x43388b['attributes']=_0x43388b['attributes'][_0x8059('0x37')]?_0x43388b[_0x8059('0x36')]:_0x29e863[_0x8059('0x30')];_0x43388b[_0x8059('0x72')]=qs['sort'](_0x6356ed[_0x8059('0x31')][_0x8059('0x39')]);_0x43388b[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x6356ed[_0x8059('0x31')],_0x29e863['filters']));if(_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]){_0x43388b[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x43388b[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x43388b[_0x8059('0x36')],function(_0x1c2e18){var _0x15a50f={};_0x15a50f[_0x1c2e18]={'$like':'%'+_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x15a50f;})});}_0x43388b=_[_0x8059('0x3e')]({},_0x43388b,_0x6356ed[_0x8059('0x48')]);return _0x3ac878[_0x8059('0x75')](_0x43388b);}})['then'](function(_0x26f318){if(_0x26f318){_0x163883=_0x26f318[_0x8059('0x37')];if(!_0x6356ed[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0x43388b['limit']=qs['limit'](_0x6356ed['query'][_0x8059('0x1c')]);_0x43388b[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x6356ed[_0x8059('0x31')][_0x8059('0x1a')]);}return _0x3ac878[_0x8059('0x75')](_0x43388b);}})[_0x8059('0x21')](function(_0x2ec671){if(_0x2ec671){return _0x2ec671?{'count':_0x163883,'rows':_0x2ec671}:null;}})[_0x8059('0x21')](respondWithResult(_0x36c21b,null))[_0x8059('0x45')](handleError(_0x36c21b,null));};exports[_0x8059('0x77')]=function(_0x28a925,_0x4bc6a7,_0x11462a){var _0x42378f=_0x28a925[_0x8059('0x4e')][_0x8059('0x6b')];var _0x5369dd;return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x42378f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8059('0x78'),'attributes':['id','name',_0x8059('0x79'),_0x8059('0x7a'),_0x8059('0x7b')],'raw':!![]}]})[_0x8059('0x21')](function(_0x23c4ce){if(_0x23c4ce){_0x5369dd=_0x23c4ce;var _0x179a1a=_[_0x8059('0x7c')](_0x23c4ce,function(_0x485ca3){var _0x234f25=_0x485ca3[_0x8059('0x23')]({'plain':!![]});return _0x234f25[_0x8059('0x78')];});return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x28a925[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x59d597){return db[_0x8059('0x4b')]['transaction'](function(_0x396e77){return _0x59d597[_0x8059('0x77')](_0x42378f,{'transaction':_0x396e77})[_0x8059('0x21')](function(){return BPromise[_0x8059('0x7d')](_0x5369dd,function(_0x554d39){return db[_0x8059('0x7e')][_0x8059('0x7f')]({'TeamId':_0x554d39['id'],'VoicePrefixId':_0x28a925['params']['id']},{'transaction':_0x396e77});});})['then'](function(){return BPromise[_0x8059('0x7d')](_0x179a1a,function(_0x52dc27){return db[_0x8059('0x80')][_0x8059('0x81')]({'where':{'UserId':_0x52dc27['id'],'VoicePrefixId':_0x28a925[_0x8059('0x47')]['id']},'transaction':_0x396e77});});})[_0x8059('0x21')](function(){_0x179a1a[_0x8059('0x82')](function(_0x4f5235){socket['emit']('userVoicePrefix:save',{'UserId':_0x4f5235['id'],'VoicePrefixId':_0x59d597['id']});});});});});}})['then'](respondWithStatusCode(_0x4bc6a7,null))[_0x8059('0x45')](handleError(_0x4bc6a7,null));};exports[_0x8059('0x83')]=function(_0x3741b9,_0x59feb8,_0x390e92){return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59feb8,null))[_0x8059('0x21')](function(_0xe6758c){var _0x11b71b=_[_0x8059('0x2b')](_0xe6758c,'id');var _0x4cc1c0=[];var _0x4e1ca4=[];var _0x5282b2=squel[_0x8059('0x84')]();_0x5282b2[_0x8059('0x85')]('tq.TeamId')[_0x8059('0x86')](_0x8059('0x87'),'tq')[_0x8059('0x88')](_0x8059('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8059('0x3a')](_0x8059('0x8a'),_0x3741b9[_0x8059('0x47')]['id']);for(var _0xdd7d0d=0x0;_0xdd7d0d<_0xe6758c[_0x8059('0x37')];_0xdd7d0d+=0x1){let _0x1922be=_0xe6758c[_0xdd7d0d];for(var _0x1baaba=0x0;_0x1baaba<_0x1922be[_0x8059('0x78')][_0x8059('0x37')];_0x1baaba+=0x1){let _0x4ca098=_0x1922be[_0x8059('0x78')][_0x1baaba];var _0x1e5ff8=_0x5282b2[_0x8059('0x8b')]();_0x1e5ff8['where']('ut.UserId\x20=\x20?',_0x4ca098['id']);_0x4e1ca4['push'](db[_0x8059('0x4b')][_0x8059('0x31')](_0x1e5ff8[_0x8059('0x8c')](),{'type':db[_0x8059('0x4b')][_0x8059('0x8d')][_0x8059('0x8e')]})[_0x8059('0x21')](function(_0x31fa7f){if(_0x31fa7f[_0x8059('0x37')]===0x1){return _0x4ca098['id'];}else{var _0x38dc0d=_[_0x8059('0x8f')](_['map'](_0x31fa7f,'TeamId'),function(_0x2b6c58){return _['includes'](_0x11b71b,_0x2b6c58);});if(_0x38dc0d){return _0x4ca098['id'];}}}));}}return BPromise[_0x8059('0x90')](_0x4e1ca4)[_0x8059('0x21')](function(_0xbe8fb){_0x4cc1c0=_(_0x4cc1c0)[_0x8059('0x91')](_0xbe8fb)[_0x8059('0x92')]()[_0x8059('0x93')]();return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x3741b9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x3a5e9a){return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0x13dcc1){return _0x3a5e9a[_0x8059('0x83')](_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')],{'transaction':_0x13dcc1})[_0x8059('0x21')](function(){if(!_[_0x8059('0x94')](_0x4cc1c0)){return _0x3a5e9a[_0x8059('0x6d')](_0x4cc1c0,{'transaction':_0x13dcc1});}})[_0x8059('0x21')](function(){_0x4cc1c0['forEach'](function(_0x3be218){socket['emit']('userVoicePrefix:remove',{'UserId':_0x3be218,'VoicePrefixId':_0x3a5e9a['id']});});});});});});})['then'](respondWithStatusCode(_0x59feb8,null))[_0x8059('0x45')](handleError(_0x59feb8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5241423..268a0f1 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 _0x8c50=['hook','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5498b8,_0x5033e7){var _0x29c87b=function(_0x249f60){while(--_0x249f60){_0x5498b8['push'](_0x5498b8['shift']());}};_0x29c87b(++_0x5033e7);}(_0x8c50,0x1e9));var _0x08c5=function(_0x421bb8,_0x4b0c79){_0x421bb8=_0x421bb8-0x0;var _0x224bc9=_0x8c50[_0x421bb8];return _0x224bc9;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x08c5('0x0'))['db'][_0x08c5('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x08c5('0x2')](0x0);var events={'afterCreate':_0x08c5('0x3'),'afterUpdate':'update','afterDestroy':_0x08c5('0x4')};function emitEvent(_0x469dbd){return function(_0x465bc2,_0x230166,_0xcd587c){VoicePrefixEvents[_0x08c5('0x5')](_0x469dbd+':'+_0x465bc2['id'],_0x465bc2);VoicePrefixEvents['emit'](_0x469dbd,_0x465bc2);_0xcd587c(null);};}for(var e in events){if(events[_0x08c5('0x6')](e)){var event=events[e];VoicePrefix[_0x08c5('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xbc62=['VoicePrefix','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x33f1ab,_0x4cf32d){var _0x2afd3c=function(_0x229aee){while(--_0x229aee){_0x33f1ab['push'](_0x33f1ab['shift']());}};_0x2afd3c(++_0x4cf32d);}(_0xbc62,0x15d));var _0x2bc6=function(_0x3b3cc6,_0x1982db){_0x3b3cc6=_0x3b3cc6-0x0;var _0x3a3437=_0xbc62[_0x3b3cc6];return _0x3a3437;};'use strict';var EventEmitter=require(_0x2bc6('0x0'));var VoicePrefix=require(_0x2bc6('0x1'))['db'][_0x2bc6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2bc6('0x3')](0x0);var events={'afterCreate':_0x2bc6('0x4'),'afterUpdate':_0x2bc6('0x5'),'afterDestroy':_0x2bc6('0x6')};function emitEvent(_0x5a5a9f){return function(_0x2443e1,_0x5d50bb,_0x21ddbb){VoicePrefixEvents[_0x2bc6('0x7')](_0x5a5a9f+':'+_0x2443e1['id'],_0x2443e1);VoicePrefixEvents['emit'](_0x5a5a9f,_0x2443e1);_0x21ddbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x2bc6('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 32708e7..7aaddd6 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 _0x7b0b=['api','moment','request-promise','path','rimraf','../../config/environment','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x577669,_0x3fa500){var _0x3eaca4=function(_0x298c96){while(--_0x298c96){_0x577669['push'](_0x577669['shift']());}};_0x3eaca4(++_0x3fa500);}(_0x7b0b,0x168));var _0xb7b0=function(_0x5cf62f,_0x63cb5d){_0x5cf62f=_0x5cf62f-0x0;var _0x4a8142=_0x7b0b[_0x5cf62f];return _0x4a8142;};'use strict';var _=require(_0xb7b0('0x0'));var util=require(_0xb7b0('0x1'));var logger=require(_0xb7b0('0x2'))(_0xb7b0('0x3'));var moment=require(_0xb7b0('0x4'));var BPromise=require('bluebird');var rp=require(_0xb7b0('0x5'));var fs=require('fs');var path=require(_0xb7b0('0x6'));var rimraf=require(_0xb7b0('0x7'));var config=require(_0xb7b0('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x12ac4a,_0x37e683){return _0x12ac4a['define'](_0xb7b0('0x9'),attributes,{'tableName':_0xb7b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ba=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','lodash','../../config/logger','bluebird'];(function(_0x43ed94,_0x2c017e){var _0x39e979=function(_0x10b29f){while(--_0x10b29f){_0x43ed94['push'](_0x43ed94['shift']());}};_0x39e979(++_0x2c017e);}(_0x56ba,0x1c5));var _0xa56b=function(_0x2d9bc7,_0x1df59c){_0x2d9bc7=_0x2d9bc7-0x0;var _0x3acc34=_0x56ba[_0x2d9bc7];return _0x3acc34;};'use strict';var _=require(_0xa56b('0x0'));var util=require('util');var logger=require(_0xa56b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa56b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa56b('0x3'));var config=require(_0xa56b('0x4'));var attributes=require(_0xa56b('0x5'));module[_0xa56b('0x6')]=function(_0x2c11b4,_0x2f2479){return _0x2c11b4['define'](_0xa56b('0x7'),attributes,{'tableName':'voice_prefixes','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 658c09d..10de398 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 _0x7c1a=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5c9273,_0x4d348e){var _0x3daad7=function(_0x49a7af){while(--_0x49a7af){_0x5c9273['push'](_0x5c9273['shift']());}};_0x3daad7(++_0x4d348e);}(_0x7c1a,0x159));var _0xa7c1=function(_0x33c028,_0x1f7cb4){_0x33c028=_0x33c028-0x0;var _0x4cc90a=_0x7c1a[_0x33c028];return _0x4cc90a;};'use strict';var _=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var moment=require(_0xa7c1('0x2'));var BPromise=require(_0xa7c1('0x3'));var rs=require(_0xa7c1('0x4'));var fs=require('fs');var Redis=require(_0xa7c1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7c1('0x6'));var logger=require(_0xa7c1('0x7'))('rpc');var config=require(_0xa7c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7c1('0x9')][_0xa7c1('0xa')]({'port':0x232a});config[_0xa7c1('0xb')]=_[_0xa7c1('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa7c1('0xd'))(new Redis(config[_0xa7c1('0xb')]));require(_0xa7c1('0xe'))['register'](socket);function respondWithRpcPromise(_0x3cdeaa,_0x16bf94,_0x359454){return new BPromise(function(_0x4f2957,_0x169d72){return client[_0xa7c1('0xf')](_0x3cdeaa,_0x359454)['then'](function(_0x309790){logger[_0xa7c1('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x16bf94,_0xa7c1('0x11'));logger[_0xa7c1('0x12')](_0xa7c1('0x13'),_0x16bf94,_0xa7c1('0x11'),JSON[_0xa7c1('0x14')](_0x309790));if(_0x309790[_0xa7c1('0x15')]){if(_0x309790[_0xa7c1('0x15')][_0xa7c1('0x16')]===0x1f4){logger[_0xa7c1('0x15')](_0xa7c1('0x17'),_0x16bf94,_0x309790[_0xa7c1('0x15')][_0xa7c1('0x18')]);return _0x169d72(_0x309790[_0xa7c1('0x15')]['message']);}logger[_0xa7c1('0x15')](_0xa7c1('0x17'),_0x16bf94,_0x309790[_0xa7c1('0x15')][_0xa7c1('0x18')]);return _0x4f2957(_0x309790[_0xa7c1('0x15')]['message']);}else{logger[_0xa7c1('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x16bf94,_0xa7c1('0x11'));_0x4f2957(_0x309790[_0xa7c1('0x19')]['message']);}})[_0xa7c1('0x1a')](function(_0x19198b){logger[_0xa7c1('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x16bf94,_0x19198b);_0x169d72(_0x19198b);});});} \ No newline at end of file +var _0xcaf2=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x58feab,_0xd0bfd8){var _0x1b87e6=function(_0x3d939f){while(--_0x3d939f){_0x58feab['push'](_0x58feab['shift']());}};_0x1b87e6(++_0xd0bfd8);}(_0xcaf2,0x8a));var _0x2caf=function(_0x37ef38,_0x2cfe4e){_0x37ef38=_0x37ef38-0x0;var _0x499daa=_0xcaf2[_0x37ef38];return _0x499daa;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});config[_0x2caf('0x9')]=_[_0x2caf('0xa')](config[_0x2caf('0x9')],{'host':_0x2caf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x9')]));require(_0x2caf('0xc'))[_0x2caf('0xd')](socket);function respondWithRpcPromise(_0x1ff859,_0x219d0f,_0x438434){return new BPromise(function(_0x1b20e3,_0x3b5631){return client[_0x2caf('0xe')](_0x1ff859,_0x438434)['then'](function(_0xd56396){logger[_0x2caf('0xf')](_0x2caf('0x10'),_0x219d0f,_0x2caf('0x11'));logger[_0x2caf('0x12')](_0x2caf('0x13'),_0x219d0f,_0x2caf('0x11'),JSON[_0x2caf('0x14')](_0xd56396));if(_0xd56396['error']){if(_0xd56396[_0x2caf('0x15')][_0x2caf('0x16')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x219d0f,_0xd56396['error'][_0x2caf('0x17')]);return _0x3b5631(_0xd56396['error'][_0x2caf('0x17')]);}logger[_0x2caf('0x15')](_0x2caf('0x10'),_0x219d0f,_0xd56396[_0x2caf('0x15')]['message']);return _0x1b20e3(_0xd56396[_0x2caf('0x15')]['message']);}else{logger[_0x2caf('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x219d0f,'request\x20sent');_0x1b20e3(_0xd56396[_0x2caf('0x18')]['message']);}})[_0x2caf('0x19')](function(_0x9c7302){logger['error'](_0x2caf('0x10'),_0x219d0f,_0x9c7302);_0x3b5631(_0x9c7302);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index cdd7f63..c14fd51 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 _0xc874=['emit','removeListener','register','length','./voicePrefix.events','remove','update'];(function(_0x20c6c7,_0x137eca){var _0x306048=function(_0x5f447a){while(--_0x5f447a){_0x20c6c7['push'](_0x20c6c7['shift']());}};_0x306048(++_0x137eca);}(_0xc874,0x154));var _0x4c87=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc874[_0x4baae2];return _0x1a2285;};'use strict';var VoicePrefixEvents=require(_0x4c87('0x0'));var events=['save',_0x4c87('0x1'),_0x4c87('0x2')];function createListener(_0x505440,_0x5e6d61){return function(_0xfc1b9f){_0x5e6d61[_0x4c87('0x3')](_0x505440,_0xfc1b9f);};}function removeListener(_0x1c3dbc,_0x575a7c){return function(){VoicePrefixEvents[_0x4c87('0x4')](_0x1c3dbc,_0x575a7c);};}exports[_0x4c87('0x5')]=function(_0x5d63ae){for(var _0x46e0f5=0x0,_0x3dafe0=events[_0x4c87('0x6')];_0x46e0f5<_0x3dafe0;_0x46e0f5++){var _0xdc4a29=events[_0x46e0f5];var _0x116649=createListener('voicePrefix:'+_0xdc4a29,_0x5d63ae);VoicePrefixEvents['on'](_0xdc4a29,_0x116649);}}; \ No newline at end of file +var _0xffe1=['length','./voicePrefix.events','save','removeListener'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xffe1,0x175));var _0x1ffe=function(_0xc04b24,_0x79b9c7){_0xc04b24=_0xc04b24-0x0;var _0xf7d2ed=_0xffe1[_0xc04b24];return _0xf7d2ed;};'use strict';var VoicePrefixEvents=require(_0x1ffe('0x0'));var events=[_0x1ffe('0x1'),'remove','update'];function createListener(_0x37f22a,_0x100207){return function(_0x38121){_0x100207['emit'](_0x37f22a,_0x38121);};}function removeListener(_0x2be98c,_0x21ba54){return function(){VoicePrefixEvents[_0x1ffe('0x2')](_0x2be98c,_0x21ba54);};}exports['register']=function(_0x219223){for(var _0x22d421=0x0,_0x6bc1ed=events[_0x1ffe('0x3')];_0x22d421<_0x6bc1ed;_0x22d421++){var _0xb34112=events[_0x22d421];var _0x8eee2b=createListener('voicePrefix:'+_0xb34112,_0x219223);VoicePrefixEvents['on'](_0xb34112,_0x8eee2b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 45f09fe..4ce6eb7 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(_0x4fcf67,_0x177232){var _0x59e754=function(_0x1a911c){while(--_0x1a911c){_0x4fcf67['push'](_0x4fcf67['shift']());}};_0x59e754(++_0x177232);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0xb10b[_0x542f45];return _0x38c609;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c0d9ad5..99f1120 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 _0x82d8=['FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#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','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','STRING','ENUM','inbound','outbound','ringall','leastrecent','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x82d8,0x19e));var _0x882d=function(_0x427e17,_0x4c99a0){_0x427e17=_0x427e17-0x0;var _0x2985bc=_0x82d8[_0x427e17];return _0x2985bc;};'use strict';var Sequelize=require(_0x882d('0x0'));module['exports']={'name':{'type':Sequelize[_0x882d('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x3'),_0x882d('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x882d('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x882d('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x882d('0x2')]('rr',_0x882d('0x5'),_0x882d('0x6'),'fewestcalls',_0x882d('0x7'),_0x882d('0x8'),_0x882d('0x9'),_0x882d('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x882d('0x5'),'set':function(_0x311a08){this[_0x882d('0xb')](_0x882d('0xc'),_0x311a08?_0x311a08:_0x882d('0x8'));},'get':function(){var _0xdbf0ff=this[_0x882d('0xd')](_0x882d('0xe'));var _0xb9e3a9=this[_0x882d('0xd')](_0x882d('0xf'));var _0x37179a=this[_0x882d('0xd')](_0x882d('0xc'));if(_0xdbf0ff===_0x882d('0x3')){return _0x37179a;}if(_0xb9e3a9===_0x882d('0x10')&&_0x37179a==='rrmemory'||_0xb9e3a9===_0x882d('0x10')&&_0x37179a===_0x882d('0x11')){return _0x37179a;}if(_0xb9e3a9===_0x882d('0x12')||_0xb9e3a9===_0x882d('0x13')||_0xb9e3a9===_0x882d('0x14')){return _0x37179a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x882d('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x882d('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x882d('0x16'),'no',_0x882d('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x882d('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x882d('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x882d('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x882d('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x882d('0x2')]('yes','no'),'defaultValue':_0x882d('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x882d('0x16'),'no',_0x882d('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x882d('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x882d('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x882d('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x882d('0x1')]},'queue_youarenext':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x882d('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x882d('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x882d('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x882d('0x1')]},'queue_less_than':{'type':Sequelize[_0x882d('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x2a5461){this['setDataValue']('periodic_announce',_0x2a5461?_0x2a5461[_0x882d('0x19')](','):[]);},'get':function(){return this[_0x882d('0xd')]('periodic_announce')?this['getDataValue'](_0x882d('0x1a'))[_0x882d('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x882d('0x1')],'defaultValue':'yes','set':function(_0xa918c8){this['setDataValue']('joinempty',_0xa918c8?_0xa918c8[_0x882d('0x19')](','):undefined);},'get':function(){return this[_0x882d('0xd')](_0x882d('0x1c'))?this[_0x882d('0xd')]('joinempty')[_0x882d('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x6b6f8d){this[_0x882d('0xb')]('leavewhenempty',_0x6b6f8d?_0x6b6f8d['join'](','):undefined);},'get':function(){return this[_0x882d('0xd')]('leavewhenempty')?this[_0x882d('0xd')]('leavewhenempty')[_0x882d('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x882d('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x882d('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':0x0,'set':function(_0x5e2904){this['setDataValue']('acw',_0x5e2904);if(_0x5e2904){if(this[_0x882d('0xd')](_0x882d('0x1e'))<0x2){this[_0x882d('0xb')](_0x882d('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x882d('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':0x0,'comment':_0x882d('0x1f')},'dialMethod':{'type':Sequelize[_0x882d('0x2')]('preview',_0x882d('0x12'),_0x882d('0x14'),_0x882d('0x13'),_0x882d('0x10')),'defaultValue':_0x882d('0x12'),'comment':_0x882d('0x20')},'dialLimitChannel':{'type':Sequelize[_0x882d('0x15')](0x4)[_0x882d('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x882d('0x22')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x882d('0x23')},'dialPowerLevel':{'type':Sequelize[_0x882d('0x24')](0x2)[_0x882d('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x882d('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x26'),'dropRate'),'defaultValue':_0x882d('0x27'),'comment':_0x882d('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x882d('0x24')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x882d('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x882d('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x882d('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x882d('0x1')],'defaultValue':_0x882d('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x2c')},'dialQueueProject':{'type':Sequelize[_0x882d('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x2f')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x882d('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x882d('0x32')},'dialTimezone':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x882d('0x1')],'defaultValue':_0x882d('0x33')},'dialPrefix':{'type':Sequelize[_0x882d('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x882d('0x34'),'never',_0x882d('0x35')),'defaultValue':_0x882d('0x34')},'dialAMDActive':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x882d('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x882d('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x882d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x882d('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x882d('0x15')](0x9)[_0x882d('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x882d('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x882d('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x882d('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x882d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x882d('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x882d('0x15')](0x9)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x882d('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x882d('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x882d('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x882d('0x15')](0x9)[_0x882d('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x882d('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x882d('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x882d('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':0x0,'comment':_0x882d('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x882d('0x2')](_0x882d('0x3f'),_0x882d('0x40')),'defaultValue':_0x882d('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x882d('0x1')],'comment':_0x882d('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x882d('0x42')},'dialCutDigit':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x882d('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x45')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x882d('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x882d('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x882d('0x15')](0x5)[_0x882d('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x882d('0x15')],'allowNull':!![],'comment':_0x882d('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2023af){if(!_0x2023af)this[_0x882d('0xb')]('mandatoryDispositionPauseId',null);this[_0x882d('0xb')]('mandatoryDisposition',_0x2023af);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x882d('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x882d('0x15')](0x3)[_0x882d('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x882d('0x1d')],'defaultValue':![]}}; \ No newline at end of file +var _0xfbb7=['#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfbb7,0x103));var _0x7fbb=function(_0x29ba54,_0x2b62fb){_0x29ba54=_0x29ba54-0x0;var _0x18c153=_0xfbb7[_0x29ba54];return _0x18c153;};'use strict';var Sequelize=require(_0x7fbb('0x0'));module[_0x7fbb('0x1')]={'name':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':![],'unique':_0x7fbb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x5'),_0x7fbb('0x6')),'allowNull':![],'defaultValue':_0x7fbb('0x5')},'musiconhold':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':_0x7fbb('0x7')},'announce':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x7fbb('0x4')]('rr',_0x7fbb('0x8'),_0x7fbb('0x9'),_0x7fbb('0xa'),_0x7fbb('0xb'),_0x7fbb('0xc'),_0x7fbb('0xd'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x7fbb('0x8'),'set':function(_0x9a0e6d){this['setDataValue'](_0x7fbb('0xe'),_0x9a0e6d?_0x9a0e6d:_0x7fbb('0xc'));},'get':function(){var _0x5f02fc=this[_0x7fbb('0xf')](_0x7fbb('0x10'));var _0x1a1737=this[_0x7fbb('0xf')](_0x7fbb('0x11'));var _0x5c5e9a=this[_0x7fbb('0xf')]('strategy');if(_0x5f02fc===_0x7fbb('0x5')){return _0x5c5e9a;}if(_0x1a1737===_0x7fbb('0x12')&&_0x5c5e9a===_0x7fbb('0xc')||_0x1a1737==='booked'&&_0x5c5e9a===_0x7fbb('0x13')){return _0x5c5e9a;}if(_0x1a1737===_0x7fbb('0x14')||_0x1a1737===_0x7fbb('0x15')||_0x1a1737==='power'){return _0x5c5e9a;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'timeout':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':_0x7fbb('0x17')},'autopause':{'type':Sequelize[_0x7fbb('0x4')]('yes','no',_0x7fbb('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7fbb('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x7fbb('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7fbb('0x2')]},'queue_youarenext':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x7fbb('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7fbb('0x2')]},'queue_less_than':{'type':Sequelize[_0x7fbb('0x2')]},'periodic_announce':{'type':Sequelize[_0x7fbb('0x19')],'set':function(_0x250f21){this[_0x7fbb('0x1a')](_0x7fbb('0x1b'),_0x250f21?_0x250f21[_0x7fbb('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x7fbb('0x1b'))?this[_0x7fbb('0xf')](_0x7fbb('0x1b'))[_0x7fbb('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'yes','set':function(_0x59244d){this[_0x7fbb('0x1a')]('joinempty',_0x59244d?_0x59244d[_0x7fbb('0x1c')](','):undefined);},'get':function(){return this[_0x7fbb('0xf')](_0x7fbb('0x1e'))?this[_0x7fbb('0xf')](_0x7fbb('0x1e'))[_0x7fbb('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':'no','set':function(_0x5f536b){this[_0x7fbb('0x1a')]('leavewhenempty',_0x5f536b?_0x5f536b[_0x7fbb('0x1c')](','):undefined);},'get':function(){return this[_0x7fbb('0xf')](_0x7fbb('0x1f'))?this['getDataValue'](_0x7fbb('0x1f'))[_0x7fbb('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7fbb('0x4')](_0x7fbb('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7fbb('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7fbb('0x2')]},'description':{'type':Sequelize[_0x7fbb('0x2')]},'acw':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'set':function(_0x1739ec){this[_0x7fbb('0x1a')](_0x7fbb('0x21'),_0x1739ec);if(_0x1739ec){if(this[_0x7fbb('0xf')](_0x7fbb('0x22'))<0x2){this[_0x7fbb('0x1a')](_0x7fbb('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7fbb('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':_0x7fbb('0x23')},'dialMethod':{'type':Sequelize[_0x7fbb('0x4')]('preview',_0x7fbb('0x14'),_0x7fbb('0x24'),_0x7fbb('0x15'),_0x7fbb('0x12')),'defaultValue':_0x7fbb('0x14'),'comment':_0x7fbb('0x25')},'dialLimitChannel':{'type':Sequelize[_0x7fbb('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7fbb('0x26')},'dialLimitQueue':{'type':Sequelize[_0x7fbb('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7fbb('0x27')](0x2)[_0x7fbb('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7fbb('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x7fbb('0x4')]('agentBusyFactor','dropRate'),'defaultValue':_0x7fbb('0x2a'),'comment':_0x7fbb('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7fbb('0x27')](0x2)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7fbb('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7fbb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x2d')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x7fbb('0x2e'),'comment':_0x7fbb('0x2f')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x30')},'dialQueueProject':{'type':Sequelize[_0x7fbb('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':_0x7fbb('0x35')},'dialPrefix':{'type':Sequelize[_0x7fbb('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7fbb('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x7fbb('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7fbb('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7fbb('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7fbb('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7fbb('0x39')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7fbb('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7fbb('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7fbb('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7fbb('0x16')](0x9)[_0x7fbb('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7fbb('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':0x0,'comment':_0x7fbb('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7fbb('0x4')]('DESC','ASC'),'defaultValue':_0x7fbb('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x7fbb('0x2')],'comment':_0x7fbb('0x40')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7fbb('0x41')},'dialCutDigit':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7fbb('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7fbb('0x16')](0x5)[_0x7fbb('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7fbb('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7fbb('0x16')],'allowNull':!![],'comment':_0x7fbb('0x49')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7fbb('0x4a'),'set':function(_0x2dfb9d){if(!_0x2dfb9d)this[_0x7fbb('0x1a')](_0x7fbb('0x4b'),null);this[_0x7fbb('0x1a')](_0x7fbb('0x4c'),_0x2dfb9d);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x3)[_0x7fbb('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7fbb('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7fbb('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 11665b7..50a55c4 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 _0xa1b6=['hasOwnProperty','sort','pick','where','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','inbound','findOne','nolimit','order','VoiceQueueId','CmHopper','getHopperHistories','rawAttributes','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','removeTeams','isEmpty','removeAgents','addAgents','format','SIP/%s','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','toString','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','end','status','json','offset','limit','count','reject','save','update','then','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','destroy','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x30087f,_0x296bad){var _0x4e39c6=function(_0x5db80a){while(--_0x5db80a){_0x30087f['push'](_0x30087f['shift']());}};_0x4e39c6(++_0x296bad);}(_0xa1b6,0x1da));var _0x6a1b=function(_0x77cb01,_0x48d566){_0x77cb01=_0x77cb01-0x0;var _0x3b115b=_0xa1b6[_0x77cb01];return _0x3b115b;};'use strict';var emlformat=require(_0x6a1b('0x0'));var rimraf=require(_0x6a1b('0x1'));var zipdir=require(_0x6a1b('0x2'));var jsonpatch=require(_0x6a1b('0x3'));var rp=require(_0x6a1b('0x4'));var moment=require(_0x6a1b('0x5'));var BPromise=require(_0x6a1b('0x6'));var Mustache=require('mustache');var util=require(_0x6a1b('0x7'));var path=require(_0x6a1b('0x8'));var sox=require('sox');var csv=require(_0x6a1b('0x9'));var ejs=require(_0x6a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x6a1b('0xb'));var _=require(_0x6a1b('0xc'));var squel=require(_0x6a1b('0xd'));var crypto=require('crypto');var jsforce=require(_0x6a1b('0xe'));var deskjs=require(_0x6a1b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a1b('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a1b('0x11'));var authService=require(_0x6a1b('0x12'));var qs=require(_0x6a1b('0x13'));var as=require(_0x6a1b('0x14'));var hardwareService=require(_0x6a1b('0x15'));var logger=require(_0x6a1b('0x16'))('api');var utils=require(_0x6a1b('0x17'));var config=require(_0x6a1b('0x18'));var licenseUtil=require(_0x6a1b('0x19'));var db=require(_0x6a1b('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6a1b('0x1b'),'port':0x18eb});var socket=require(_0x6a1b('0x1c'))(new Redis(config[_0x6a1b('0x1d')]));require(_0x6a1b('0x1e'))[_0x6a1b('0x1f')](socket);function respondWithStatusCode(_0x2f4e7e,_0x88c981){_0x88c981=_0x88c981||0xcc;return function(_0x4fcd34){if(_0x4fcd34){return _0x2f4e7e['sendStatus'](_0x88c981);}return _0x2f4e7e['status'](_0x88c981)[_0x6a1b('0x20')]();};}function respondWithResult(_0x205313,_0x5b76b7){_0x5b76b7=_0x5b76b7||0xc8;return function(_0x46b907){if(_0x46b907){return _0x205313[_0x6a1b('0x21')](_0x5b76b7)[_0x6a1b('0x22')](_0x46b907);}};}function respondWithFilteredResult(_0x29739a,_0x1695dc){return function(_0x4b3141){if(_0x4b3141){var _0x3477b0=typeof _0x1695dc[_0x6a1b('0x23')]==='undefined'&&typeof _0x1695dc[_0x6a1b('0x24')]==='undefined';var _0x458155=_0x4b3141[_0x6a1b('0x25')];var _0x304641=_0x3477b0?0x0:_0x1695dc['offset'];var _0xde39e=_0x3477b0?_0x4b3141['count']:_0x1695dc[_0x6a1b('0x23')]+_0x1695dc[_0x6a1b('0x24')];var _0x18f8c6;if(_0xde39e>=_0x458155){_0xde39e=_0x458155;_0x18f8c6=0xc8;}else{_0x18f8c6=0xce;}_0x29739a[_0x6a1b('0x21')](_0x18f8c6);return _0x29739a['set']('Content-Range',_0x304641+'-'+_0xde39e+'/'+_0x458155)['json'](_0x4b3141);}return null;};}function patchUpdates(_0x41f38e){return function(_0x425819){try{jsonpatch['apply'](_0x425819,_0x41f38e,!![]);}catch(_0x351642){return BPromise[_0x6a1b('0x26')](_0x351642);}return _0x425819[_0x6a1b('0x27')]();};}function saveUpdates(_0x2c30be,_0x1917ed){return function(_0x58fd4b){if(_0x58fd4b){return _0x58fd4b[_0x6a1b('0x28')](_0x2c30be)[_0x6a1b('0x29')](function(_0x2565a1){return _0x2565a1;});}return null;};}function removeEntity(_0x2b9f22,_0x334e80){return function(_0x12533b){if(_0x12533b){return _0x12533b['destroy']()[_0x6a1b('0x29')](function(){var _0x47e707=_0x12533b[_0x6a1b('0x2a')]({'plain':!![]});var _0x2b9dcf=[{'name':_0x6a1b('0x2b'),'value':'inbound','ignore':![]},{'name':_0x6a1b('0x2c'),'value':_0x6a1b('0x2d'),'ignore':![]}];var _0x35746a=_(_0x2b9dcf)[_0x6a1b('0x2e')](_0x6a1b('0x2f'))[_0x6a1b('0x30')]('value')[_0x6a1b('0x31')]();if(_['includes'](_0x35746a,_0x47e707[_0x6a1b('0x32')])){return;}var _0x1594d5=_[_0x6a1b('0x33')](_0x2b9dcf,['value',_0x47e707[_0x6a1b('0x32')]])[_0x6a1b('0x34')];return db[_0x6a1b('0x35')][_0x6a1b('0x36')]({'where':{'type':_0x1594d5,'resourceId':_0x47e707['id']}})[_0x6a1b('0x29')](function(){return _0x12533b;});})[_0x6a1b('0x29')](function(){_0x2b9f22[_0x6a1b('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460df8,_0x3e58d6){return function(_0x2547af){if(!_0x2547af){_0x460df8['sendStatus'](0x194);}return _0x2547af;};}function handleError(_0x44c484,_0x12691f){_0x12691f=_0x12691f||0x1f4;return function(_0x3a9ef3){logger[_0x6a1b('0x37')](_0x3a9ef3[_0x6a1b('0x38')]);if(_0x3a9ef3[_0x6a1b('0x34')]){delete _0x3a9ef3[_0x6a1b('0x34')];}_0x44c484[_0x6a1b('0x21')](_0x12691f)[_0x6a1b('0x39')](_0x3a9ef3);};}exports[_0x6a1b('0x3a')]=function(_0x3a6035,_0x13f58b){var _0x4445f4={},_0x2e3a9a={},_0x32b100={'count':0x0,'rows':[]};var _0x5f2d4c=_[_0x6a1b('0x30')](db['VoiceQueue']['rawAttributes'],function(_0x113f79){return{'name':_0x113f79[_0x6a1b('0x3b')],'type':_0x113f79[_0x6a1b('0x32')][_0x6a1b('0x3c')]};});_0x2e3a9a[_0x6a1b('0x3d')]=_['map'](_0x5f2d4c,_0x6a1b('0x34'));_0x2e3a9a[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x3a6035[_0x6a1b('0x3e')]);_0x2e3a9a[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x2e3a9a[_0x6a1b('0x3d')],_0x2e3a9a[_0x6a1b('0x3e')]);_0x4445f4['attributes']=_[_0x6a1b('0x41')](_0x2e3a9a['model'],qs[_0x6a1b('0x42')](_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x4445f4[_0x6a1b('0x43')]=_0x4445f4[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x4445f4[_0x6a1b('0x43')]:_0x2e3a9a[_0x6a1b('0x3d')];if(!_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x45')]('nolimit')){_0x4445f4[_0x6a1b('0x24')]=qs['limit'](_0x3a6035[_0x6a1b('0x3e')]['limit']);_0x4445f4['offset']=qs[_0x6a1b('0x23')](_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}_0x4445f4['order']=qs[_0x6a1b('0x46')](_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x4445f4['where']=qs['filters'](_[_0x6a1b('0x47')](_0x3a6035['query'],_0x2e3a9a['filters']),_0x5f2d4c);if(_0x3a6035[_0x6a1b('0x3e')]['filter']){_0x4445f4[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x4445f4[_0x6a1b('0x48')],{'$or':_['map'](_0x5f2d4c,function(_0x2c9c68){if(_0x2c9c68[_0x6a1b('0x32')]!=='VIRTUAL'){var _0x138de6={};_0x138de6[_0x2c9c68[_0x6a1b('0x34')]]={'$like':'%'+_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x138de6;}})});}_0x4445f4=_[_0x6a1b('0x49')]({},_0x4445f4,_0x3a6035[_0x6a1b('0x4a')]);var _0x46a368={'where':_0x4445f4['where']};return db[_0x6a1b('0x4b')][_0x6a1b('0x25')](_0x46a368)['then'](function(_0x24ac33){_0x32b100[_0x6a1b('0x25')]=_0x24ac33;if(_0x3a6035[_0x6a1b('0x3e')][_0x6a1b('0x4c')]){_0x4445f4[_0x6a1b('0x4d')]=[{'all':!![]}];}return db[_0x6a1b('0x4b')][_0x6a1b('0x4e')](_0x4445f4);})[_0x6a1b('0x29')](function(_0x576642){_0x32b100[_0x6a1b('0x4f')]=_0x576642;return _0x32b100;})[_0x6a1b('0x29')](respondWithFilteredResult(_0x13f58b,_0x4445f4))[_0x6a1b('0x50')](handleError(_0x13f58b,null));};exports['show']=function(_0x31b44f,_0x4125ed){var _0x40a28a={'raw':![],'where':{'id':_0x31b44f['params']['id']}},_0x4224c3={};_0x4224c3['model']=_[_0x6a1b('0x3f')](db[_0x6a1b('0x4b')]['rawAttributes']);_0x4224c3[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x31b44f[_0x6a1b('0x3e')]);_0x4224c3[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x4224c3['model'],_0x4224c3[_0x6a1b('0x3e')]);_0x40a28a['attributes']=_[_0x6a1b('0x41')](_0x4224c3[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x31b44f[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x40a28a['attributes']=_0x40a28a['attributes'][_0x6a1b('0x44')]?_0x40a28a[_0x6a1b('0x43')]:_0x4224c3[_0x6a1b('0x3d')];if(_0x31b44f[_0x6a1b('0x3e')][_0x6a1b('0x4c')]){_0x40a28a[_0x6a1b('0x4d')]=[{'all':!![]}];}_0x40a28a=_['merge']({},_0x40a28a,_0x31b44f[_0x6a1b('0x4a')]);return db[_0x6a1b('0x4b')][_0x6a1b('0x33')](_0x40a28a)[_0x6a1b('0x29')](handleEntityNotFound(_0x4125ed,null))[_0x6a1b('0x29')](respondWithResult(_0x4125ed,null))[_0x6a1b('0x50')](handleError(_0x4125ed,null));};exports['create']=function(_0xb23aa5,_0xe0801e){return db[_0x6a1b('0x4b')]['create'](_0xb23aa5[_0x6a1b('0x51')],{})[_0x6a1b('0x29')](function(_0x10eb87){var _0x26dfe1=_0xb23aa5[_0x6a1b('0x52')][_0x6a1b('0x2a')]({'plain':!![]});if(!_0x26dfe1)throw new Error(_0x6a1b('0x53'));if(_0x26dfe1[_0x6a1b('0x54')]===_0x6a1b('0x52')){var _0x3181e5=_0x10eb87[_0x6a1b('0x2a')]({'plain':!![]});var _0x14f5a5=[{'name':_0x6a1b('0x2b'),'value':'inbound'},{'name':_0x6a1b('0x2c'),'value':_0x6a1b('0x2d')}];var _0x2cb8a6=_[_0x6a1b('0x33')](_0x14f5a5,['value',_0x3181e5[_0x6a1b('0x32')]])['name'];return db[_0x6a1b('0x55')]['find']({'where':{'name':_0x2cb8a6,'userProfileId':_0x26dfe1[_0x6a1b('0x56')]},'raw':!![]})[_0x6a1b('0x29')](function(_0x2b72f6){if(_0x2b72f6&&_0x2b72f6[_0x6a1b('0x57')]===0x0){return db[_0x6a1b('0x35')][_0x6a1b('0x58')]({'name':_0x3181e5[_0x6a1b('0x34')],'resourceId':_0x3181e5['id'],'type':_0x2b72f6[_0x6a1b('0x34')],'sectionId':_0x2b72f6['id']},{})[_0x6a1b('0x29')](function(){return _0x10eb87;});}else{return _0x10eb87;}})['catch'](function(_0x517e78){logger[_0x6a1b('0x37')](_0x6a1b('0x59'),_0x517e78);throw _0x517e78;});}return _0x10eb87;})['then'](respondWithResult(_0xe0801e,0xc9))[_0x6a1b('0x50')](handleError(_0xe0801e,null));};exports[_0x6a1b('0x5a')]=function(_0x38a9d9,_0x37191){var _0x28b8cf={'where':{'id':_0x38a9d9[_0x6a1b('0x5b')]['id']}},_0x1c9be3={};_0x1c9be3[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db[_0x6a1b('0x4b')]['rawAttributes']);_0x28b8cf['attributes']=_[_0x6a1b('0x41')](_0x1c9be3[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x38a9d9[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x28b8cf[_0x6a1b('0x43')]=_0x28b8cf[_0x6a1b('0x43')]['length']?_0x28b8cf[_0x6a1b('0x43')]:_0x1c9be3['model'];if(_0x38a9d9['query'][_0x6a1b('0x4c')]){_0x28b8cf[_0x6a1b('0x4d')]=[{'all':!![]}];}_0x28b8cf=_[_0x6a1b('0x49')]({},_0x28b8cf,_0x38a9d9[_0x6a1b('0x4a')]);return db['VoiceQueue'][_0x6a1b('0x33')](_0x28b8cf)[_0x6a1b('0x29')](handleEntityNotFound(_0x37191,null))[_0x6a1b('0x29')](function(_0x438aa0){if(_0x438aa0){var _0x5e5b44=_0x438aa0['get']({'plain':!![]});_0x5e5b44=qs[_0x6a1b('0x5c')](_0x5e5b44,['id','createdAt',_0x6a1b('0x5d')]);_0x38a9d9[_0x6a1b('0x51')]=_[_0x6a1b('0x5c')](_0x38a9d9[_0x6a1b('0x51')],['id',_0x6a1b('0x5e'),_0x6a1b('0x5d')]);return db[_0x6a1b('0x4b')]['create'](_[_0x6a1b('0x49')](_0x5e5b44,_0x38a9d9[_0x6a1b('0x51')]),{'include':_0x38a9d9[_0x6a1b('0x3e')][_0x6a1b('0x4c')]?[{'all':!![]}]:undefined})[_0x6a1b('0x29')](function(_0x2fcff0){var _0x178a76=_0x38a9d9[_0x6a1b('0x52')][_0x6a1b('0x2a')]({'plain':!![]});if(!_0x178a76)throw new Error(_0x6a1b('0x53'));if(_0x178a76[_0x6a1b('0x54')]==='user'){var _0x473c72=_0x2fcff0[_0x6a1b('0x2a')]({'plain':!![]});var _0x3b5f72=[{'name':_0x6a1b('0x2b'),'value':_0x6a1b('0x5f')},{'name':_0x6a1b('0x2c'),'value':_0x6a1b('0x2d')}];var _0x7d96f5=_[_0x6a1b('0x33')](_0x3b5f72,[_0x6a1b('0x31'),_0x473c72[_0x6a1b('0x32')]])[_0x6a1b('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x7d96f5,'userProfileId':_0x178a76[_0x6a1b('0x56')]},'raw':!![]})[_0x6a1b('0x29')](function(_0x1b1da5){if(_0x1b1da5&&_0x1b1da5[_0x6a1b('0x57')]===0x0){return db[_0x6a1b('0x35')][_0x6a1b('0x58')]({'name':_0x473c72['name'],'resourceId':_0x473c72['id'],'type':_0x1b1da5[_0x6a1b('0x34')],'sectionId':_0x1b1da5['id']},{})[_0x6a1b('0x29')](function(){return _0x2fcff0;});}else{return _0x2fcff0;}})[_0x6a1b('0x50')](function(_0x33f6f9){logger[_0x6a1b('0x37')](_0x6a1b('0x59'),_0x33f6f9);throw _0x33f6f9;});}return _0x2fcff0;});}})[_0x6a1b('0x29')](respondWithResult(_0x37191,0xc9))[_0x6a1b('0x50')](handleError(_0x37191,null));};exports[_0x6a1b('0x28')]=function(_0x46b062,_0x435921){if(_0x46b062[_0x6a1b('0x51')]['id']){delete _0x46b062[_0x6a1b('0x51')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x46b062['params']['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x435921,null))[_0x6a1b('0x29')](saveUpdates(_0x46b062[_0x6a1b('0x51')],null))[_0x6a1b('0x29')](respondWithResult(_0x435921,null))['catch'](handleError(_0x435921,null));};exports[_0x6a1b('0x36')]=function(_0xab4b3,_0x5fe3e0){return db[_0x6a1b('0x4b')]['find']({'where':{'id':_0xab4b3['params']['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x5fe3e0,null))['then'](removeEntity(_0x5fe3e0,null))[_0x6a1b('0x50')](handleError(_0x5fe3e0,null));};exports['getHoppers']=function(_0x31c5dd,_0x1f8f3c,_0xf198f){var _0x467509={'raw':![],'where':{}};var _0x1e5877={};var _0x121fbf={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6a1b('0x60')]({'where':{'id':_0x31c5dd[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x1f8f3c,null))['then'](function(_0x3fb90d){if(_0x3fb90d){_0x1e5877[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db['CmHopper']['rawAttributes']);_0x1e5877[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x31c5dd[_0x6a1b('0x3e')]);_0x1e5877['filters']=_[_0x6a1b('0x41')](_0x1e5877[_0x6a1b('0x3d')],_0x1e5877[_0x6a1b('0x3e')]);_0x467509[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x1e5877[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x31c5dd[_0x6a1b('0x3e')]['fields']));_0x467509['attributes']=_0x467509[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x467509[_0x6a1b('0x43')]:_0x1e5877[_0x6a1b('0x3d')];if(!_0x31c5dd['query'][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x467509[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x467509[_0x6a1b('0x23')]=qs[_0x6a1b('0x23')](_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}_0x467509[_0x6a1b('0x62')]=qs[_0x6a1b('0x46')](_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x467509['where']=qs['filters'](_[_0x6a1b('0x47')](_0x31c5dd[_0x6a1b('0x3e')],_0x1e5877[_0x6a1b('0x40')]));_0x467509['where'][_0x6a1b('0x63')]=_0x3fb90d['id'];if(_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x467509['where']=_[_0x6a1b('0x49')](_0x467509[_0x6a1b('0x48')],{'$or':_['map'](_0x467509[_0x6a1b('0x43')],function(_0x38ccb1){var _0x22daea={};_0x22daea[_0x38ccb1]={'$like':'%'+_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x22daea;})});}_0x467509=_[_0x6a1b('0x49')]({},_0x467509,_0x31c5dd[_0x6a1b('0x4a')]);return db['CmHopper'][_0x6a1b('0x25')]({'where':_0x467509[_0x6a1b('0x48')]})['then'](function(_0x3a9f28){_0x121fbf['count']=_0x3a9f28;if(_0x31c5dd[_0x6a1b('0x3e')][_0x6a1b('0x4c')]){_0x467509[_0x6a1b('0x4d')]=[{'all':!![]}];}return db[_0x6a1b('0x64')][_0x6a1b('0x4e')](_0x467509);})[_0x6a1b('0x29')](function(_0x5afdc8){_0x121fbf['rows']=_0x5afdc8;return _0x121fbf;});}})['then'](respondWithFilteredResult(_0x1f8f3c,_0x467509))[_0x6a1b('0x50')](handleError(_0x1f8f3c,null));};exports[_0x6a1b('0x65')]=function(_0x43c7e8,_0x433f37,_0x2ab3d5){var _0x3878f2={'raw':!![],'where':{}};var _0x45a993={};var _0x4836e3={'count':0x0,'rows':[]};return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0x43c7e8[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x433f37,null))[_0x6a1b('0x29')](function(_0x47f5e7){if(_0x47f5e7){_0x45a993[_0x6a1b('0x3d')]=_['keys'](db['CmHopperHistory'][_0x6a1b('0x66')]);_0x45a993[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x43c7e8[_0x6a1b('0x3e')]);_0x45a993[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x45a993[_0x6a1b('0x3d')],_0x45a993[_0x6a1b('0x3e')]);_0x3878f2[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x45a993[_0x6a1b('0x3d')],qs['fields'](_0x43c7e8[_0x6a1b('0x3e')]['fields']));_0x3878f2[_0x6a1b('0x43')]=_0x3878f2[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x3878f2[_0x6a1b('0x43')]:_0x45a993['model'];if(!_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x3878f2[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x3878f2[_0x6a1b('0x23')]=qs['offset'](_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}_0x3878f2[_0x6a1b('0x62')]=qs[_0x6a1b('0x46')](_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x3878f2[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0x43c7e8[_0x6a1b('0x3e')],_0x45a993[_0x6a1b('0x40')]));_0x3878f2[_0x6a1b('0x48')]['VoiceQueueId']=_0x47f5e7['id'];if(_0x43c7e8[_0x6a1b('0x3e')]['filter']){_0x3878f2[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x3878f2[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x3878f2[_0x6a1b('0x43')],function(_0x3a071b){var _0x22e4b5={};_0x22e4b5[_0x3a071b]={'$like':'%'+_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x22e4b5;})});}_0x3878f2=_['merge']({},_0x3878f2,_0x43c7e8[_0x6a1b('0x4a')]);return db['CmHopperHistory'][_0x6a1b('0x25')]({'where':_0x3878f2[_0x6a1b('0x48')]})[_0x6a1b('0x29')](function(_0xec568){_0x4836e3['count']=_0xec568;if(_0x43c7e8[_0x6a1b('0x3e')][_0x6a1b('0x4c')]){_0x3878f2[_0x6a1b('0x4d')]=[{'all':!![]}];}return db[_0x6a1b('0x67')][_0x6a1b('0x4e')](_0x3878f2);})[_0x6a1b('0x29')](function(_0x1bb0e3){_0x4836e3[_0x6a1b('0x4f')]=_0x1bb0e3;return _0x4836e3;});}})['then'](respondWithFilteredResult(_0x433f37,_0x3878f2))[_0x6a1b('0x50')](handleError(_0x433f37,null));};exports[_0x6a1b('0x68')]=function(_0x293c41,_0x599dcd,_0x5101c0){var _0x5b31ed={'raw':!![],'where':{}};var _0x2fa7ed={};var _0x6d9b94={'count':0x0,'rows':[]};return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0x293c41['params']['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x599dcd,null))[_0x6a1b('0x29')](function(_0x1cdd2a){if(_0x1cdd2a){_0x2fa7ed[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db[_0x6a1b('0x69')][_0x6a1b('0x66')]);_0x2fa7ed[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x293c41[_0x6a1b('0x3e')]);_0x2fa7ed[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x2fa7ed[_0x6a1b('0x3d')],_0x2fa7ed[_0x6a1b('0x3e')]);_0x5b31ed[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x2fa7ed[_0x6a1b('0x3d')],qs['fields'](_0x293c41['query']['fields']));_0x5b31ed['attributes']=_0x5b31ed[_0x6a1b('0x43')]['length']?_0x5b31ed[_0x6a1b('0x43')]:_0x2fa7ed[_0x6a1b('0x3d')];if(!_0x293c41[_0x6a1b('0x3e')]['hasOwnProperty']('nolimit')){_0x5b31ed[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x293c41[_0x6a1b('0x3e')]['limit']);_0x5b31ed[_0x6a1b('0x23')]=qs[_0x6a1b('0x23')](_0x293c41['query']['offset']);}_0x5b31ed['order']=qs[_0x6a1b('0x46')](_0x293c41[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x5b31ed[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0x293c41[_0x6a1b('0x3e')],_0x2fa7ed[_0x6a1b('0x40')]));_0x5b31ed[_0x6a1b('0x48')]['VoiceQueueId']=_0x1cdd2a['id'];if(_0x293c41[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x5b31ed['where']=_['merge'](_0x5b31ed[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x5b31ed[_0x6a1b('0x43')],function(_0x3a91db){var _0x233393={};_0x233393[_0x3a91db]={'$like':'%'+_0x293c41[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x233393;})});}_0x5b31ed=_[_0x6a1b('0x49')]({},_0x5b31ed,_0x293c41[_0x6a1b('0x4a')]);return db[_0x6a1b('0x69')]['count']({'where':_0x5b31ed[_0x6a1b('0x48')]})[_0x6a1b('0x29')](function(_0x418345){_0x6d9b94['count']=_0x418345;if(_0x293c41[_0x6a1b('0x3e')]['includeAll']){_0x5b31ed[_0x6a1b('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6a1b('0x4e')](_0x5b31ed);})[_0x6a1b('0x29')](function(_0x198cc3){_0x6d9b94[_0x6a1b('0x4f')]=_0x198cc3;return _0x6d9b94;});}})[_0x6a1b('0x29')](respondWithFilteredResult(_0x599dcd,_0x5b31ed))[_0x6a1b('0x50')](handleError(_0x599dcd,null));};exports['getHopperBlacks']=function(_0xc59946,_0x4bed63,_0x2e631f){var _0x1c7f1f={'raw':!![],'where':{}};var _0x15901f={};var _0x3d0eed={'count':0x0,'rows':[]};return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0xc59946[_0x6a1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4bed63,null))['then'](function(_0xa9ca7f){if(_0xa9ca7f){_0x15901f['model']=_[_0x6a1b('0x3f')](db[_0x6a1b('0x6a')][_0x6a1b('0x66')]);_0x15901f[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0xc59946[_0x6a1b('0x3e')]);_0x15901f[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x15901f[_0x6a1b('0x3d')],_0x15901f['query']);_0x1c7f1f[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x15901f[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x1c7f1f[_0x6a1b('0x43')]=_0x1c7f1f[_0x6a1b('0x43')]['length']?_0x1c7f1f[_0x6a1b('0x43')]:_0x15901f['model'];if(!_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x45')]('nolimit')){_0x1c7f1f[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0xc59946['query'][_0x6a1b('0x24')]);_0x1c7f1f['offset']=qs['offset'](_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}_0x1c7f1f[_0x6a1b('0x62')]=qs[_0x6a1b('0x46')](_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x1c7f1f[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0xc59946[_0x6a1b('0x3e')],_0x15901f[_0x6a1b('0x40')]));_0x1c7f1f[_0x6a1b('0x48')]['VoiceQueueId']=_0xa9ca7f['id'];if(_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x1c7f1f[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x1c7f1f[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x1c7f1f[_0x6a1b('0x43')],function(_0x354367){var _0x5cf2f3={};_0x5cf2f3[_0x354367]={'$like':'%'+_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x5cf2f3;})});}_0x1c7f1f=_[_0x6a1b('0x49')]({},_0x1c7f1f,_0xc59946[_0x6a1b('0x4a')]);return db[_0x6a1b('0x6a')][_0x6a1b('0x25')]({'where':_0x1c7f1f['where']})[_0x6a1b('0x29')](function(_0x5e1a0a){_0x3d0eed[_0x6a1b('0x25')]=_0x5e1a0a;if(_0xc59946[_0x6a1b('0x3e')][_0x6a1b('0x4c')]){_0x1c7f1f[_0x6a1b('0x4d')]=[{'all':!![]}];}return db[_0x6a1b('0x6a')]['findAll'](_0x1c7f1f);})[_0x6a1b('0x29')](function(_0xc64e2b){_0x3d0eed[_0x6a1b('0x4f')]=_0xc64e2b;return _0x3d0eed;});}})['then'](respondWithFilteredResult(_0x4bed63,_0x1c7f1f))[_0x6a1b('0x50')](handleError(_0x4bed63,null));};exports[_0x6a1b('0x6b')]=function(_0x11871d,_0x373140,_0x56983f){var _0x467e0a={};var _0x2078d0={};var _0x2ab701;var _0x59f5e3;return db[_0x6a1b('0x4b')]['findOne']({'where':{'id':_0x11871d[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x373140,null))['then'](function(_0x3fa1d5){if(_0x3fa1d5){_0x2ab701=_0x3fa1d5;_0x2078d0['model']=_['keys'](db['Team'][_0x6a1b('0x66')]);_0x2078d0[_0x6a1b('0x3e')]=_['keys'](_0x11871d['query']);_0x2078d0[_0x6a1b('0x40')]=_['intersection'](_0x2078d0[_0x6a1b('0x3d')],_0x2078d0[_0x6a1b('0x3e')]);_0x467e0a[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x2078d0[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x11871d[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x467e0a[_0x6a1b('0x43')]=_0x467e0a['attributes']['length']?_0x467e0a['attributes']:_0x2078d0['model'];_0x467e0a['order']=qs[_0x6a1b('0x46')](_0x11871d['query'][_0x6a1b('0x46')]);_0x467e0a[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0x11871d[_0x6a1b('0x3e')],_0x2078d0[_0x6a1b('0x40')]));if(_0x11871d[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x467e0a[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x467e0a[_0x6a1b('0x48')],{'$or':_['map'](_0x467e0a[_0x6a1b('0x43')],function(_0x2523cf){var _0x16a92f={};_0x16a92f[_0x2523cf]={'$like':'%'+_0x11871d[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x16a92f;})});}_0x467e0a=_[_0x6a1b('0x49')]({},_0x467e0a,_0x11871d[_0x6a1b('0x4a')]);return _0x2ab701['getTeams'](_0x467e0a);}})['then'](function(_0x58e7c1){if(_0x58e7c1){_0x59f5e3=_0x58e7c1[_0x6a1b('0x44')];if(!_0x11871d[_0x6a1b('0x3e')]['hasOwnProperty'](_0x6a1b('0x61'))){_0x467e0a[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x11871d[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x467e0a['offset']=qs[_0x6a1b('0x23')](_0x11871d[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}return _0x2ab701[_0x6a1b('0x6b')](_0x467e0a);}})[_0x6a1b('0x29')](function(_0x5b9078){if(_0x5b9078){return _0x5b9078?{'count':_0x59f5e3,'rows':_0x5b9078}:null;}})[_0x6a1b('0x29')](respondWithResult(_0x373140,null))[_0x6a1b('0x50')](handleError(_0x373140,null));};exports[_0x6a1b('0x6c')]=function(_0x115f66,_0x1e36ab,_0x96d3f4){var _0x218065=_0x115f66[_0x6a1b('0x51')][_0x6a1b('0x6d')];var _0x202565=_[_0x6a1b('0x30')](_0x218065,'id');return db[_0x6a1b('0x6e')][_0x6a1b('0x4e')]({'where':{'id':_0x202565},'attributes':['id'],'include':[{'model':db[_0x6a1b('0x6f')],'as':_0x6a1b('0x70'),'attributes':['id',_0x6a1b('0x34'),_0x6a1b('0x71'),_0x6a1b('0x72'),_0x6a1b('0x73')],'raw':!![]}]})[_0x6a1b('0x29')](function(_0x434bba){if(_0x434bba){var _0x45cc1f=_['flatMap'](_0x434bba,function(_0x29ecb7){var _0x2abba3=_0x29ecb7['get']({'plain':!![]});_0x2abba3['Agents'][_0x6a1b('0x74')](function(_0x452573){_0x452573[_0x6a1b('0x75')]=_['find'](_0x218065,{'id':_0x2abba3['id']})['penalty'];});return _0x2abba3[_0x6a1b('0x70')];});return db['VoiceQueue'][_0x6a1b('0x33')]({'where':{'id':_0x115f66[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](function(_0x5565d7){return db[_0x6a1b('0x76')][_0x6a1b('0x77')](function(_0x173264){return _0x5565d7[_0x6a1b('0x6c')](_0x202565,{'transaction':_0x173264})[_0x6a1b('0x29')](function(){return BPromise[_0x6a1b('0x78')](_0x218065,function(_0x58608c){return db[_0x6a1b('0x79')][_0x6a1b('0x7a')]({'TeamId':_0x58608c['id'],'VoiceQueueId':_0x115f66['params']['id'],'penalty':_0x58608c['penalty']},{'transaction':_0x173264});});})[_0x6a1b('0x29')](function(){return BPromise['each'](_0x45cc1f,function(_0x55e084){return db[_0x6a1b('0x7b')][_0x6a1b('0x7c')]({'where':{'UserId':_0x55e084['id'],'VoiceQueueId':_0x115f66[_0x6a1b('0x5b')]['id']},'defaults':{'penalty':_0x55e084[_0x6a1b('0x75')]},'transaction':_0x173264});});})[_0x6a1b('0x29')](function(){return BPromise[_0x6a1b('0x78')](_[_0x6a1b('0x2e')](_0x45cc1f,{'online':!![]}),function(_0x5dbcc3){return db[_0x6a1b('0x7d')][_0x6a1b('0x7a')]({'membername':_0x5dbcc3['name'],'UserId':_0x5dbcc3['id'],'queue_name':_0x5565d7['name'],'VoiceQueueId':_0x5565d7['id'],'interface':_[_0x6a1b('0x7e')](_0x5dbcc3[_0x6a1b('0x73')])?util['format']('SIP/%s',_0x5dbcc3[_0x6a1b('0x34')]):_0x5dbcc3[_0x6a1b('0x73')],'paused':_0x5dbcc3[_0x6a1b('0x72')]||![],'penalty':_0x5dbcc3[_0x6a1b('0x75')]},{'transaction':_0x173264});});})[_0x6a1b('0x29')](function(){_0x45cc1f[_0x6a1b('0x74')](function(_0x36cdb8){socket[_0x6a1b('0x7f')](_0x6a1b('0x80'),{'UserId':_0x36cdb8['id'],'VoiceQueueId':_0x5565d7['id']});});});});});}})[_0x6a1b('0x29')](respondWithStatusCode(_0x1e36ab,null))['catch'](handleError(_0x1e36ab,null));};exports['removeTeams']=function(_0x5e015c,_0xb1fc12,_0x233a85){return db[_0x6a1b('0x6e')]['findAll']({'where':{'id':_0x5e015c['query'][_0x6a1b('0x81')]},'attributes':['id'],'include':[{'model':db[_0x6a1b('0x6f')],'as':_0x6a1b('0x70'),'attributes':['id'],'raw':!![]}]})[_0x6a1b('0x29')](handleEntityNotFound(_0xb1fc12,null))[_0x6a1b('0x29')](function(_0x12669b){var _0x112b5e=_[_0x6a1b('0x30')](_0x12669b,'id');var _0x2da43f=[];var _0x4ba98f=[];var _0x20c1ce=squel[_0x6a1b('0x82')]();_0x20c1ce[_0x6a1b('0x83')](_0x6a1b('0x84'))[_0x6a1b('0x85')](_0x6a1b('0x86'),'tq')['join'](_0x6a1b('0x87'),'ut',_0x6a1b('0x88'))[_0x6a1b('0x48')](_0x6a1b('0x89'),_0x5e015c[_0x6a1b('0x5b')]['id']);for(var _0x1d43ef=0x0;_0x1d43ef<_0x12669b[_0x6a1b('0x44')];_0x1d43ef+=0x1){let _0x23b785=_0x12669b[_0x1d43ef];for(var _0x1bb047=0x0;_0x1bb047<_0x23b785[_0x6a1b('0x70')][_0x6a1b('0x44')];_0x1bb047+=0x1){let _0xb559d0=_0x23b785[_0x6a1b('0x70')][_0x1bb047];var _0x3276fe=_0x20c1ce[_0x6a1b('0x5a')]();_0x3276fe[_0x6a1b('0x48')](_0x6a1b('0x8a'),_0xb559d0['id']);_0x4ba98f[_0x6a1b('0x8b')](db[_0x6a1b('0x76')]['query'](_0x3276fe['toString'](),{'type':db[_0x6a1b('0x76')][_0x6a1b('0x8c')]['SELECT']})[_0x6a1b('0x29')](function(_0x3657ee){if(_0x3657ee[_0x6a1b('0x44')]===0x1){return _0xb559d0['id'];}else{var _0x3713ee=_[_0x6a1b('0x8d')](_['map'](_0x3657ee,'TeamId'),function(_0x14fbcd){return _[_0x6a1b('0x8e')](_0x112b5e,_0x14fbcd);});if(_0x3713ee){return _0xb559d0['id'];}}}));}}return BPromise[_0x6a1b('0x8f')](_0x4ba98f)['then'](function(_0x526c50){_0x2da43f=_(_0x2da43f)[_0x6a1b('0x90')](_0x526c50)['compact']()['value']();return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0x5e015c[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](function(_0x278e47){return db[_0x6a1b('0x76')][_0x6a1b('0x77')](function(_0xf764f5){return _0x278e47[_0x6a1b('0x91')](_0x5e015c[_0x6a1b('0x3e')][_0x6a1b('0x81')],{'transaction':_0xf764f5})[_0x6a1b('0x29')](function(){if(!_[_0x6a1b('0x92')](_0x2da43f)){return _0x278e47[_0x6a1b('0x93')](_0x2da43f,{'transaction':_0xf764f5})[_0x6a1b('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5e015c[_0x6a1b('0x5b')]['id'],'UserId':_0x2da43f},'transaction':_0xf764f5});});}})['then'](function(){_0x2da43f['forEach'](function(_0x12e8c5){socket[_0x6a1b('0x7f')]('userVoiceQueue:remove',{'UserId':_0x12e8c5,'VoiceQueueId':_0x278e47['id']});});});});});});})[_0x6a1b('0x29')](respondWithStatusCode(_0xb1fc12,null))['catch'](handleError(_0xb1fc12,null));};exports[_0x6a1b('0x94')]=function(_0x18f2d3,_0x19d757,_0x1ae0ae){var _0x307b2,_0x45dc3a;return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0x18f2d3[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x19d757,null))[_0x6a1b('0x29')](function(_0x31a803){if(_0x31a803){_0x45dc3a=_0x31a803;return _0x31a803[_0x6a1b('0x94')](_0x18f2d3['body'][_0x6a1b('0x81')],_['omit'](_0x18f2d3[_0x6a1b('0x51')],['ids','id'])||{})['spread'](function(_0x44c447){for(var _0xee1613=0x0;_0xee1613<_0x18f2d3['body'][_0x6a1b('0x81')][_0x6a1b('0x44')];_0xee1613+=0x1){socket[_0x6a1b('0x7f')](_0x6a1b('0x80'),{'UserId':Number(_0x18f2d3[_0x6a1b('0x51')][_0x6a1b('0x81')][_0xee1613]),'VoiceQueueId':Number(_0x18f2d3[_0x6a1b('0x5b')]['id'])});}return _0x44c447;});}})[_0x6a1b('0x29')](function(_0x3b28fd){_0x307b2=_0x3b28fd||[];if(_0x45dc3a){return db[_0x6a1b('0x6f')][_0x6a1b('0x4e')]({'where':{'id':_0x18f2d3['body'][_0x6a1b('0x81')]},'attributes':['id',_0x6a1b('0x34'),'online',_0x6a1b('0x72'),'interface'],'raw':!![]});}})['then'](function(_0x5ec472){if(!_[_0x6a1b('0x92')](_0x5ec472)){var _0x2beb47=[];for(var _0xc8c8a0=0x0;_0xc8c8a0<_0x5ec472['length'];_0xc8c8a0++){if(_0x5ec472[_0xc8c8a0][_0x6a1b('0x71')]){_0x2beb47[_0x6a1b('0x8b')](db[_0x6a1b('0x7d')][_0x6a1b('0x7a')]({'membername':_0x5ec472[_0xc8c8a0]['name'],'UserId':_0x5ec472[_0xc8c8a0]['id'],'queue_name':_0x45dc3a[_0x6a1b('0x34')],'VoiceQueueId':_0x45dc3a['id'],'interface':_['isNil'](_0x5ec472[_0xc8c8a0][_0x6a1b('0x73')])?util[_0x6a1b('0x95')](_0x6a1b('0x96'),_0x5ec472[_0xc8c8a0][_0x6a1b('0x34')]):_0x5ec472[_0xc8c8a0][_0x6a1b('0x73')],'paused':_0x5ec472[_0xc8c8a0]['voicePause']||![],'penalty':_0x18f2d3[_0x6a1b('0x51')]['penalty']||0x0}));}}return BPromise[_0x6a1b('0x8f')](_0x2beb47);}})[_0x6a1b('0x29')](function(){return _0x307b2;})[_0x6a1b('0x29')](respondWithResult(_0x19d757,null))[_0x6a1b('0x50')](handleError(_0x19d757,null));};exports['removeAgents']=function(_0x2361c0,_0x516613,_0x58bfcb){return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0x2361c0['params']['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x516613,null))['then'](function(_0x47923c){if(_0x47923c){return _0x47923c['removeAgents'](_0x2361c0['query']['ids'])[_0x6a1b('0x29')](function(){if(_['isArray'](_0x2361c0[_0x6a1b('0x3e')][_0x6a1b('0x81')])){for(var _0x17d701=0x0;_0x17d701<_0x2361c0[_0x6a1b('0x3e')][_0x6a1b('0x81')][_0x6a1b('0x44')];_0x17d701+=0x1){socket[_0x6a1b('0x7f')](_0x6a1b('0x97'),{'UserId':Number(_0x2361c0[_0x6a1b('0x3e')][_0x6a1b('0x81')][_0x17d701]),'VoiceQueueId':Number(_0x2361c0[_0x6a1b('0x5b')]['id'])});}}else{socket[_0x6a1b('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x2361c0[_0x6a1b('0x3e')][_0x6a1b('0x81')]),'VoiceQueueId':Number(_0x2361c0[_0x6a1b('0x5b')]['id'])});}});}})['then'](function(_0x4caeee){return db[_0x6a1b('0x7d')][_0x6a1b('0x36')]({'where':{'VoiceQueueId':_0x2361c0[_0x6a1b('0x5b')]['id'],'UserId':_0x2361c0[_0x6a1b('0x3e')]['ids']}})[_0x6a1b('0x29')](function(){return _0x4caeee;});})[_0x6a1b('0x29')](respondWithStatusCode(_0x516613,null))[_0x6a1b('0x50')](handleError(_0x516613,null));};exports['getAgents']=function(_0x395e45,_0x414ed3,_0x25c27e){var _0x1e3633={};var _0x32d32b={};var _0x50747d;var _0x168d90;return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0x395e45[_0x6a1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x414ed3,null))[_0x6a1b('0x29')](function(_0x2cba43){if(_0x2cba43){_0x50747d=_0x2cba43;_0x32d32b[_0x6a1b('0x3d')]=_['keys'](db[_0x6a1b('0x6f')][_0x6a1b('0x66')]);_0x32d32b[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x395e45[_0x6a1b('0x3e')]);_0x32d32b[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x32d32b[_0x6a1b('0x3d')],_0x32d32b['query']);_0x1e3633['attributes']=_[_0x6a1b('0x41')](_0x32d32b[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x395e45[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x1e3633[_0x6a1b('0x43')]=_0x1e3633[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x1e3633[_0x6a1b('0x43')]:_0x32d32b[_0x6a1b('0x3d')];_0x1e3633[_0x6a1b('0x62')]=qs[_0x6a1b('0x46')](_0x395e45[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x1e3633[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_['pick'](_0x395e45[_0x6a1b('0x3e')],_0x32d32b[_0x6a1b('0x40')]));if(_0x395e45[_0x6a1b('0x3e')]['filter']){_0x1e3633[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x1e3633[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x1e3633['attributes'],function(_0x24db5d){var _0x426929={};_0x426929[_0x24db5d]={'$like':'%'+_0x395e45['query']['filter']+'%'};return _0x426929;})});}_0x1e3633=_[_0x6a1b('0x49')]({},_0x1e3633,_0x395e45[_0x6a1b('0x4a')]);return _0x50747d[_0x6a1b('0x98')](_0x1e3633);}})[_0x6a1b('0x29')](function(_0x494795){if(_0x494795){_0x168d90=_0x494795[_0x6a1b('0x44')];if(!_0x395e45['query'][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x1e3633[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x395e45[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x1e3633[_0x6a1b('0x23')]=qs['offset'](_0x395e45['query'][_0x6a1b('0x23')]);}return _0x50747d[_0x6a1b('0x98')](_0x1e3633);}})['then'](function(_0x1ddbde){if(_0x1ddbde){return _0x1ddbde?{'count':_0x168d90,'rows':_0x1ddbde}:null;}})['then'](respondWithResult(_0x414ed3,null))[_0x6a1b('0x50')](handleError(_0x414ed3,null));};exports[_0x6a1b('0x99')]=function(_0x568153,_0x27a5de,_0x581ba7){var _0x3dcab7={};var _0x25cb44={};var _0x3d7c60;var _0x343739;return db[_0x6a1b('0x4b')]['findOne']({'where':{'id':_0x568153[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x27a5de,null))[_0x6a1b('0x29')](function(_0x12df38){if(_0x12df38){_0x3d7c60=_0x12df38;_0x25cb44[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db[_0x6a1b('0x7d')][_0x6a1b('0x66')]);_0x25cb44[_0x6a1b('0x3e')]=_[_0x6a1b('0x3f')](_0x568153['query']);_0x25cb44[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x25cb44[_0x6a1b('0x3d')],_0x25cb44['query']);_0x3dcab7['attributes']=_[_0x6a1b('0x41')](_0x25cb44[_0x6a1b('0x3d')],qs['fields'](_0x568153['query'][_0x6a1b('0x42')]));_0x3dcab7[_0x6a1b('0x43')]=_0x3dcab7[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x3dcab7[_0x6a1b('0x43')]:_0x25cb44[_0x6a1b('0x3d')];_0x3dcab7[_0x6a1b('0x62')]=qs['sort'](_0x568153['query'][_0x6a1b('0x46')]);_0x3dcab7[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0x568153[_0x6a1b('0x3e')],_0x25cb44[_0x6a1b('0x40')]));if(_0x568153[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x3dcab7[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x3dcab7[_0x6a1b('0x48')],{'$or':_['map'](_0x3dcab7[_0x6a1b('0x43')],function(_0x3ea41b){var _0x4a113b={};_0x4a113b[_0x3ea41b]={'$like':'%'+_0x568153[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x4a113b;})});}_0x3dcab7=_[_0x6a1b('0x49')]({},_0x3dcab7,_0x568153[_0x6a1b('0x4a')]);return _0x3d7c60[_0x6a1b('0x99')](_0x3dcab7);}})[_0x6a1b('0x29')](function(_0x12ffeb){if(_0x12ffeb){_0x343739=_0x12ffeb[_0x6a1b('0x44')];if(!_0x568153['query'][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x3dcab7['limit']=qs[_0x6a1b('0x24')](_0x568153[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x3dcab7[_0x6a1b('0x23')]=qs[_0x6a1b('0x23')](_0x568153['query'][_0x6a1b('0x23')]);}return _0x3d7c60['getMembers'](_0x3dcab7);}})[_0x6a1b('0x29')](function(_0x3e8475){return _0x3e8475?{'count':_0x343739,'rows':_0x3e8475}:null;})[_0x6a1b('0x29')](respondWithResult(_0x27a5de,null))[_0x6a1b('0x50')](handleError(_0x27a5de,null));};exports[_0x6a1b('0x9a')]=function(_0x326521,_0x45d946,_0x128bb2){var _0x92acc0={};var _0x100ddc={};var _0x2afba1;var _0x21c5fb;return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0x326521[_0x6a1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45d946,null))[_0x6a1b('0x29')](function(_0x3d69ce){if(_0x3d69ce){_0x2afba1=_0x3d69ce;_0x100ddc[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db[_0x6a1b('0x9b')][_0x6a1b('0x66')]);_0x100ddc['query']=_[_0x6a1b('0x3f')](_0x326521['query']);_0x100ddc['filters']=_[_0x6a1b('0x41')](_0x100ddc['model'],_0x100ddc[_0x6a1b('0x3e')]);_0x92acc0[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x100ddc[_0x6a1b('0x3d')],qs[_0x6a1b('0x42')](_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x92acc0[_0x6a1b('0x43')]=_0x92acc0[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x92acc0[_0x6a1b('0x43')]:_0x100ddc['model'];_0x92acc0[_0x6a1b('0x62')]=qs[_0x6a1b('0x46')](_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x46')]);_0x92acc0[_0x6a1b('0x48')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x47')](_0x326521[_0x6a1b('0x3e')],_0x100ddc[_0x6a1b('0x40')]));if(_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x92acc0['where']=_['merge'](_0x92acc0[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x92acc0['attributes'],function(_0x553e47){var _0x25b99c={};_0x25b99c[_0x553e47]={'$like':'%'+_0x326521[_0x6a1b('0x3e')]['filter']+'%'};return _0x25b99c;})});}_0x92acc0=_[_0x6a1b('0x49')]({},_0x92acc0,_0x326521[_0x6a1b('0x4a')]);return _0x2afba1[_0x6a1b('0x9a')](_0x92acc0);}})[_0x6a1b('0x29')](function(_0x44d26d){if(_0x44d26d){_0x21c5fb=_0x44d26d[_0x6a1b('0x44')];if(!_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x92acc0[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x24')]);_0x92acc0['offset']=qs[_0x6a1b('0x23')](_0x326521[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}return _0x2afba1['getLists'](_0x92acc0);}})['then'](function(_0x22400c){if(_0x22400c){return _0x22400c?{'count':_0x21c5fb,'rows':_0x22400c}:null;}})[_0x6a1b('0x29')](respondWithResult(_0x45d946,null))[_0x6a1b('0x50')](handleError(_0x45d946,null));};exports[_0x6a1b('0x9c')]=function(_0x443806,_0x5541dd,_0x3b08f7){var _0x57c686,_0x17aa39;return db['VoiceQueue']['find']({'where':{'id':_0x443806[_0x6a1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5541dd,null))['then'](function(_0x55fbc9){if(_0x55fbc9){_0x17aa39=_0x55fbc9;return _0x55fbc9['addLists'](_0x443806[_0x6a1b('0x51')][_0x6a1b('0x81')],_[_0x6a1b('0x5c')](_0x443806[_0x6a1b('0x51')],[_0x6a1b('0x81'),'id'])||{});}return null;})[_0x6a1b('0x9d')](function(_0x2f86d1){var _0x3875c0;_0x57c686=_0x2f86d1||[];var _0x159e28=[];if(_0x2f86d1){for(var _0x29d949=0x0;_0x29d949<_0x2f86d1[_0x6a1b('0x44')];_0x29d949+=0x1){var _0xa5143f=_0x2f86d1[_0x29d949][_0x6a1b('0x2a')]({'plain':!![]});_0x17aa39[_0x6a1b('0x9e')]=_0x443806[_0x6a1b('0x51')][_0x6a1b('0x9e')]?_0x443806[_0x6a1b('0x51')]['dialCheckDuplicateType']:_0x17aa39[_0x6a1b('0x9e')];switch(_0x17aa39[_0x6a1b('0x9e')]){case _0x6a1b('0x9f'):_0x3875c0=squel[_0x6a1b('0xa0')]()[_0x6a1b('0xa1')](_0x6a1b('0xa2'))[_0x6a1b('0xa3')]([_0x6a1b('0xa4'),_0x6a1b('0xa5'),_0x6a1b('0xa6'),'ListId',_0x6a1b('0x63'),_0x6a1b('0x5e'),_0x6a1b('0x5d')],squel[_0x6a1b('0x82')]()[_0x6a1b('0x83')](_0x6a1b('0xa4'),_0x6a1b('0xa4'))[_0x6a1b('0x83')]('NOW()',_0x6a1b('0xa5'))[_0x6a1b('0x83')]('id','ContactId')[_0x6a1b('0x83')](_0xa5143f[_0x6a1b('0xa7')][_0x6a1b('0xa8')](),_0x6a1b('0xa9'))[_0x6a1b('0x83')](_0x443806['params']['id'][_0x6a1b('0xa8')](),_0x6a1b('0x63'))[_0x6a1b('0x83')](_0x6a1b('0xaa'),_0x6a1b('0x5e'))['field'](_0x6a1b('0xaa'),_0x6a1b('0x5d'))['from'](_0x6a1b('0xab'))[_0x6a1b('0x48')](_0x6a1b('0xac'))['where']('ListId\x20=\x20?',_0xa5143f[_0x6a1b('0xa7')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6a1b('0x82')]()[_0x6a1b('0x83')]('COALESCE(calleridnum,\x27\x27)')[_0x6a1b('0x85')](_0x6a1b('0xad'))['where'](_0x6a1b('0x89'),_0x443806[_0x6a1b('0x5b')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6a1b('0x82')]()[_0x6a1b('0x83')](_0x6a1b('0xae'))['from'](_0x6a1b('0xa2'))['where'](_0x6a1b('0x89'),_0x443806[_0x6a1b('0x5b')]['id'][_0x6a1b('0xa8')]())))[_0x6a1b('0xa8')]();break;case'onlyIfOpen':_0x3875c0=squel['insert']()['into'](_0x6a1b('0xa2'))[_0x6a1b('0xa3')]([_0x6a1b('0xa4'),_0x6a1b('0xa5'),_0x6a1b('0xa6'),_0x6a1b('0xa9'),'VoiceQueueId',_0x6a1b('0x5e'),_0x6a1b('0x5d')],squel[_0x6a1b('0x82')]()['field']('phone','phone')[_0x6a1b('0x83')]('NOW()',_0x6a1b('0xa5'))[_0x6a1b('0x83')]('id',_0x6a1b('0xa6'))['field'](_0xa5143f[_0x6a1b('0xa7')]['toString'](),_0x6a1b('0xa9'))[_0x6a1b('0x83')](_0x443806[_0x6a1b('0x5b')]['id'][_0x6a1b('0xa8')](),_0x6a1b('0x63'))['field'](_0x6a1b('0xaa'),'createdAt')[_0x6a1b('0x83')](_0x6a1b('0xaa'),'updatedAt')[_0x6a1b('0x85')](_0x6a1b('0xab'))[_0x6a1b('0x48')](_0x6a1b('0xac'))['where']('ListId\x20=\x20?',_0xa5143f[_0x6a1b('0xa7')][_0x6a1b('0xa8')]())[_0x6a1b('0x48')](_0x6a1b('0xaf'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6a1b('0x82')]()[_0x6a1b('0x83')]('COALESCE(phone,\x27\x27)')[_0x6a1b('0x85')](_0x6a1b('0xa2'))['where'](_0x6a1b('0x89'),_0x443806[_0x6a1b('0x5b')]['id'][_0x6a1b('0xa8')]())))[_0x6a1b('0xa8')]();break;default:_0x3875c0=squel['insert']()[_0x6a1b('0xa1')](_0x6a1b('0xa2'))[_0x6a1b('0xa3')]([_0x6a1b('0xa4'),_0x6a1b('0xa5'),_0x6a1b('0xa6'),_0x6a1b('0xa9'),_0x6a1b('0x63'),_0x6a1b('0x5e'),_0x6a1b('0x5d')],squel['select']()[_0x6a1b('0x83')](_0x6a1b('0xa4'),_0x6a1b('0xa4'))[_0x6a1b('0x83')](_0x6a1b('0xaa'),_0x6a1b('0xa5'))[_0x6a1b('0x83')]('id','ContactId')['field'](_0xa5143f['CmListId']['toString'](),_0x6a1b('0xa9'))[_0x6a1b('0x83')](_0x443806['params']['id'][_0x6a1b('0xa8')](),'VoiceQueueId')[_0x6a1b('0x83')](_0x6a1b('0xaa'),'createdAt')[_0x6a1b('0x83')](_0x6a1b('0xaa'),_0x6a1b('0x5d'))[_0x6a1b('0x85')](_0x6a1b('0xab'))['where'](_0x6a1b('0xac'))['where'](_0x6a1b('0xb0'),_0xa5143f['CmListId'][_0x6a1b('0xa8')]())['where'](_0x6a1b('0xaf')))[_0x6a1b('0xa8')]();}_0x159e28[_0x6a1b('0x8b')](db[_0x6a1b('0x76')]['query'](_0x3875c0));}return BPromise[_0x6a1b('0x8f')](_0x159e28);}})[_0x6a1b('0x29')](function(){return _0x57c686;})[_0x6a1b('0x29')](respondWithResult(_0x5541dd,null))['catch'](handleError(_0x5541dd,null));};exports[_0x6a1b('0xb1')]=function(_0x163b07,_0x249714,_0x28caa5){return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0x163b07['params']['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x249714,null))[_0x6a1b('0x29')](function(_0x2e3e60){if(_0x2e3e60){return _0x2e3e60['removeLists'](_0x163b07['query'][_0x6a1b('0x81')]);}})['then'](function(_0x414b09){if(_0x414b09){return db[_0x6a1b('0x64')][_0x6a1b('0x36')]({'where':{'ListId':_0x163b07['query'][_0x6a1b('0x81')],'VoiceQueueId':_0x163b07['params']['id']}})[_0x6a1b('0x29')](function(){return _0x414b09;});}})[_0x6a1b('0x29')](respondWithStatusCode(_0x249714,null))[_0x6a1b('0x50')](handleError(_0x249714,null));};exports[_0x6a1b('0xb2')]=function(_0x33d9ce,_0x3db694,_0x7fe4f0){var _0x1393cf={};var _0x386627={};var _0x46c0a9;var _0x186e28;return db[_0x6a1b('0x4b')][_0x6a1b('0x60')]({'where':{'id':_0x33d9ce[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x3db694,null))[_0x6a1b('0x29')](function(_0xa63ad4){if(_0xa63ad4){_0x46c0a9=_0xa63ad4;_0x386627[_0x6a1b('0x3d')]=_[_0x6a1b('0x3f')](db[_0x6a1b('0x9b')]['rawAttributes']);_0x386627['query']=_[_0x6a1b('0x3f')](_0x33d9ce[_0x6a1b('0x3e')]);_0x386627[_0x6a1b('0x40')]=_[_0x6a1b('0x41')](_0x386627[_0x6a1b('0x3d')],_0x386627['query']);_0x1393cf[_0x6a1b('0x43')]=_[_0x6a1b('0x41')](_0x386627['model'],qs[_0x6a1b('0x42')](_0x33d9ce[_0x6a1b('0x3e')][_0x6a1b('0x42')]));_0x1393cf[_0x6a1b('0x43')]=_0x1393cf[_0x6a1b('0x43')][_0x6a1b('0x44')]?_0x1393cf['attributes']:_0x386627[_0x6a1b('0x3d')];_0x1393cf['order']=qs[_0x6a1b('0x46')](_0x33d9ce[_0x6a1b('0x3e')]['sort']);_0x1393cf['where']=qs['filters'](_['pick'](_0x33d9ce[_0x6a1b('0x3e')],_0x386627[_0x6a1b('0x40')]));if(_0x33d9ce[_0x6a1b('0x3e')][_0x6a1b('0x2e')]){_0x1393cf[_0x6a1b('0x48')]=_[_0x6a1b('0x49')](_0x1393cf[_0x6a1b('0x48')],{'$or':_[_0x6a1b('0x30')](_0x1393cf[_0x6a1b('0x43')],function(_0x2b8eda){var _0x5b6fb2={};_0x5b6fb2[_0x2b8eda]={'$like':'%'+_0x33d9ce[_0x6a1b('0x3e')][_0x6a1b('0x2e')]+'%'};return _0x5b6fb2;})});}_0x1393cf=_['merge']({},_0x1393cf,_0x33d9ce[_0x6a1b('0x4a')]);return _0x46c0a9[_0x6a1b('0xb2')](_0x1393cf);}})[_0x6a1b('0x29')](function(_0x149c60){if(_0x149c60){_0x186e28=_0x149c60['length'];if(!_0x33d9ce['query'][_0x6a1b('0x45')](_0x6a1b('0x61'))){_0x1393cf[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x33d9ce[_0x6a1b('0x3e')]['limit']);_0x1393cf['offset']=qs[_0x6a1b('0x23')](_0x33d9ce[_0x6a1b('0x3e')][_0x6a1b('0x23')]);}return _0x46c0a9[_0x6a1b('0xb2')](_0x1393cf);}})['then'](function(_0x475667){if(_0x475667){return _0x475667?{'count':_0x186e28,'rows':_0x475667}:null;}})[_0x6a1b('0x29')](respondWithResult(_0x3db694,null))[_0x6a1b('0x50')](handleError(_0x3db694,null));};exports['addBlackLists']=function(_0x36f98b,_0x39ed92,_0x32ae4a){var _0x504a11,_0x5ebabe;return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0x36f98b[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x39ed92,null))[_0x6a1b('0x29')](function(_0x33ab0d){if(_0x33ab0d){_0x5ebabe=_0x33ab0d;return _0x33ab0d[_0x6a1b('0xb3')](_0x36f98b[_0x6a1b('0x51')][_0x6a1b('0x81')],_[_0x6a1b('0x5c')](_0x36f98b[_0x6a1b('0x51')],[_0x6a1b('0x81'),'id'])||{});}return null;})[_0x6a1b('0x9d')](function(_0x1985aa){var _0x7117e1;_0x504a11=_0x1985aa||[];var _0x24d413=[];if(_0x1985aa){for(var _0x3602ed=0x0;_0x3602ed<_0x1985aa[_0x6a1b('0x44')];_0x3602ed+=0x1){var _0x29e3b0=_0x1985aa[_0x3602ed][_0x6a1b('0x2a')]({'plain':!![]});_0x7117e1=squel[_0x6a1b('0xa0')]()[_0x6a1b('0xa1')]('cm_hopper_black')[_0x6a1b('0xa3')]([_0x6a1b('0xa4'),_0x6a1b('0xa6'),_0x6a1b('0xa9'),_0x6a1b('0x63'),_0x6a1b('0x5e'),_0x6a1b('0x5d')],squel[_0x6a1b('0x82')]()['field'](_0x6a1b('0xa4'),_0x6a1b('0xa4'))[_0x6a1b('0x83')]('id','ContactId')[_0x6a1b('0x83')](_0x29e3b0['CmListId']['toString'](),_0x6a1b('0xa9'))[_0x6a1b('0x83')](_0x36f98b[_0x6a1b('0x5b')]['id']['toString'](),_0x6a1b('0x63'))[_0x6a1b('0x83')]('NOW()','createdAt')[_0x6a1b('0x83')](_0x6a1b('0xaa'),_0x6a1b('0x5d'))[_0x6a1b('0x85')](_0x6a1b('0xab'))[_0x6a1b('0x48')]('deletedAt\x20IS\x20NULL')[_0x6a1b('0x48')](_0x6a1b('0xb0'),_0x29e3b0[_0x6a1b('0xa7')][_0x6a1b('0xa8')]())[_0x6a1b('0x48')](_0x6a1b('0xaf')))[_0x6a1b('0xa8')]();_0x24d413[_0x6a1b('0x8b')](db[_0x6a1b('0x76')]['query'](_0x7117e1));}return BPromise[_0x6a1b('0x8f')](_0x24d413);}})[_0x6a1b('0x29')](function(){return _0x504a11;})[_0x6a1b('0x29')](respondWithResult(_0x39ed92,null))['catch'](handleError(_0x39ed92,null));};exports['removeBlackLists']=function(_0xfcede6,_0x3b3de6,_0x4be23e){return db[_0x6a1b('0x4b')][_0x6a1b('0x33')]({'where':{'id':_0xfcede6[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](handleEntityNotFound(_0x3b3de6,null))[_0x6a1b('0x29')](function(_0x54c2d2){if(_0x54c2d2){return _0x54c2d2[_0x6a1b('0xb4')](_0xfcede6[_0x6a1b('0x3e')][_0x6a1b('0x81')]);}})['then'](function(_0x1821f0){if(_0x1821f0){return db[_0x6a1b('0x6a')][_0x6a1b('0x36')]({'where':{'ListId':_0xfcede6[_0x6a1b('0x3e')][_0x6a1b('0x81')],'VoiceQueueId':_0xfcede6[_0x6a1b('0x5b')]['id']}})[_0x6a1b('0x29')](function(){return _0x1821f0;});}})[_0x6a1b('0x29')](respondWithStatusCode(_0x3b3de6,null))[_0x6a1b('0x50')](handleError(_0x3b3de6,null));}; \ No newline at end of file +var _0x0e9b=['util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','catch','show','params','keys','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getHoppers','nolimit','pick','VoiceQueueId','CmHopper','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','User','online','format','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','NOW()','ContactId','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','ListId\x20=\x20?','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x4eaa4c,_0x2f7422){var _0x15aec6=function(_0x23efc9){while(--_0x23efc9){_0x4eaa4c['push'](_0x4eaa4c['shift']());}};_0x15aec6(++_0x2f7422);}(_0x0e9b,0xb3));var _0xb0e9=function(_0x53e885,_0x49d504){_0x53e885=_0x53e885-0x0;var _0x40e126=_0x0e9b[_0x53e885];return _0x40e126;};'use strict';var emlformat=require(_0xb0e9('0x0'));var rimraf=require(_0xb0e9('0x1'));var zipdir=require(_0xb0e9('0x2'));var jsonpatch=require(_0xb0e9('0x3'));var rp=require(_0xb0e9('0x4'));var moment=require(_0xb0e9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb0e9('0x6'));var util=require(_0xb0e9('0x7'));var path=require(_0xb0e9('0x8'));var sox=require(_0xb0e9('0x9'));var csv=require(_0xb0e9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0e9('0xb'));var _=require('lodash');var squel=require(_0xb0e9('0xc'));var crypto=require('crypto');var jsforce=require(_0xb0e9('0xd'));var deskjs=require(_0xb0e9('0xe'));var toCsv=require(_0xb0e9('0xa'));var querystring=require(_0xb0e9('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0e9('0x10'));var authService=require(_0xb0e9('0x11'));var qs=require(_0xb0e9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0e9('0x13'))(_0xb0e9('0x14'));var utils=require(_0xb0e9('0x15'));var config=require(_0xb0e9('0x16'));var licenseUtil=require(_0xb0e9('0x17'));var db=require(_0xb0e9('0x18'))['db'];config['redis']=_[_0xb0e9('0x19')](config['redis'],{'host':_0xb0e9('0x1a'),'port':0x18eb});var socket=require(_0xb0e9('0x1b'))(new Redis(config[_0xb0e9('0x1c')]));require('./voiceQueue.socket')[_0xb0e9('0x1d')](socket);function respondWithStatusCode(_0x20db9c,_0xa5927f){_0xa5927f=_0xa5927f||0xcc;return function(_0x142539){if(_0x142539){return _0x20db9c[_0xb0e9('0x1e')](_0xa5927f);}return _0x20db9c[_0xb0e9('0x1f')](_0xa5927f)[_0xb0e9('0x20')]();};}function respondWithResult(_0x480028,_0x43f181){_0x43f181=_0x43f181||0xc8;return function(_0x5efd29){if(_0x5efd29){return _0x480028[_0xb0e9('0x1f')](_0x43f181)[_0xb0e9('0x21')](_0x5efd29);}};}function respondWithFilteredResult(_0x20f038,_0xa5c04b){return function(_0x42674b){if(_0x42674b){var _0x4675ca=typeof _0xa5c04b[_0xb0e9('0x22')]===_0xb0e9('0x23')&&typeof _0xa5c04b['limit']===_0xb0e9('0x23');var _0x5431ce=_0x42674b[_0xb0e9('0x24')];var _0x8fabf5=_0x4675ca?0x0:_0xa5c04b['offset'];var _0x42353b=_0x4675ca?_0x42674b[_0xb0e9('0x24')]:_0xa5c04b['offset']+_0xa5c04b[_0xb0e9('0x25')];var _0x3847d3;if(_0x42353b>=_0x5431ce){_0x42353b=_0x5431ce;_0x3847d3=0xc8;}else{_0x3847d3=0xce;}_0x20f038[_0xb0e9('0x1f')](_0x3847d3);return _0x20f038[_0xb0e9('0x26')]('Content-Range',_0x8fabf5+'-'+_0x42353b+'/'+_0x5431ce)[_0xb0e9('0x21')](_0x42674b);}return null;};}function patchUpdates(_0x5035c4){return function(_0x1f144e){try{jsonpatch['apply'](_0x1f144e,_0x5035c4,!![]);}catch(_0x154c0b){return BPromise['reject'](_0x154c0b);}return _0x1f144e[_0xb0e9('0x27')]();};}function saveUpdates(_0x18a5a8,_0xb618ed){return function(_0x1b5215){if(_0x1b5215){return _0x1b5215[_0xb0e9('0x28')](_0x18a5a8)[_0xb0e9('0x29')](function(_0x4bd1df){return _0x4bd1df;});}return null;};}function removeEntity(_0x409e97,_0x4b16e5){return function(_0x3ac7cd){if(_0x3ac7cd){return _0x3ac7cd[_0xb0e9('0x2a')]()[_0xb0e9('0x29')](function(){var _0x30157d=_0x3ac7cd[_0xb0e9('0x2b')]({'plain':!![]});var _0x46a199=[{'name':_0xb0e9('0x2c'),'value':_0xb0e9('0x2d'),'ignore':![]},{'name':_0xb0e9('0x2e'),'value':_0xb0e9('0x2f'),'ignore':![]}];var _0x5a1024=_(_0x46a199)[_0xb0e9('0x30')]('ignore')[_0xb0e9('0x31')](_0xb0e9('0x32'))[_0xb0e9('0x32')]();if(_[_0xb0e9('0x33')](_0x5a1024,_0x30157d['type'])){return;}var _0x136685=_['find'](_0x46a199,[_0xb0e9('0x32'),_0x30157d[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db[_0xb0e9('0x36')]['destroy']({'where':{'type':_0x136685,'resourceId':_0x30157d['id']}})['then'](function(){return _0x3ac7cd;});})[_0xb0e9('0x29')](function(){_0x409e97[_0xb0e9('0x1f')](0xcc)[_0xb0e9('0x20')]();});}};}function handleEntityNotFound(_0x1e1b24,_0x5a3a00){return function(_0xf281d6){if(!_0xf281d6){_0x1e1b24[_0xb0e9('0x1e')](0x194);}return _0xf281d6;};}function handleError(_0x5a1231,_0x4edf59){_0x4edf59=_0x4edf59||0x1f4;return function(_0x201128){logger[_0xb0e9('0x37')](_0x201128[_0xb0e9('0x38')]);if(_0x201128[_0xb0e9('0x35')]){delete _0x201128[_0xb0e9('0x35')];}_0x5a1231[_0xb0e9('0x1f')](_0x4edf59)['send'](_0x201128);};}exports[_0xb0e9('0x39')]=function(_0x2510c1,_0x37e033){var _0x186e71={},_0x3dd8b3={},_0x965d08={'count':0x0,'rows':[]};var _0x39e934=_[_0xb0e9('0x31')](db[_0xb0e9('0x3a')][_0xb0e9('0x3b')],function(_0x2bdec8){return{'name':_0x2bdec8['fieldName'],'type':_0x2bdec8[_0xb0e9('0x34')][_0xb0e9('0x3c')]};});_0x3dd8b3['model']=_[_0xb0e9('0x31')](_0x39e934,_0xb0e9('0x35'));_0x3dd8b3[_0xb0e9('0x3d')]=_['keys'](_0x2510c1[_0xb0e9('0x3d')]);_0x3dd8b3[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x3dd8b3[_0xb0e9('0x40')],_0x3dd8b3[_0xb0e9('0x3d')]);_0x186e71['attributes']=_['intersection'](_0x3dd8b3['model'],qs[_0xb0e9('0x41')](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x186e71[_0xb0e9('0x42')]=_0x186e71[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x186e71['attributes']:_0x3dd8b3[_0xb0e9('0x40')];if(!_0x2510c1['query'][_0xb0e9('0x44')]('nolimit')){_0x186e71[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x2510c1['query']['limit']);_0x186e71[_0xb0e9('0x22')]=qs['offset'](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}_0x186e71[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x186e71[_0xb0e9('0x47')]=qs['filters'](_['pick'](_0x2510c1['query'],_0x3dd8b3[_0xb0e9('0x3e')]),_0x39e934);if(_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x186e71[_0xb0e9('0x47')]=_['merge'](_0x186e71[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x39e934,function(_0x54cc80){if(_0x54cc80[_0xb0e9('0x34')]!==_0xb0e9('0x48')){var _0x3d211b={};_0x3d211b[_0x54cc80[_0xb0e9('0x35')]]={'$like':'%'+_0x2510c1[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x3d211b;}})});}_0x186e71=_[_0xb0e9('0x49')]({},_0x186e71,_0x2510c1[_0xb0e9('0x4a')]);var _0x2e77f3={'where':_0x186e71[_0xb0e9('0x47')]};return db['VoiceQueue'][_0xb0e9('0x24')](_0x2e77f3)[_0xb0e9('0x29')](function(_0x2819cd){_0x965d08[_0xb0e9('0x24')]=_0x2819cd;if(_0x2510c1[_0xb0e9('0x3d')]['includeAll']){_0x186e71['include']=[{'all':!![]}];}return db[_0xb0e9('0x3a')]['findAll'](_0x186e71);})[_0xb0e9('0x29')](function(_0x1e9b76){_0x965d08['rows']=_0x1e9b76;return _0x965d08;})[_0xb0e9('0x29')](respondWithFilteredResult(_0x37e033,_0x186e71))[_0xb0e9('0x4b')](handleError(_0x37e033,null));};exports[_0xb0e9('0x4c')]=function(_0xb3779c,_0x2b91bd){var _0x4b3af2={'raw':![],'where':{'id':_0xb3779c[_0xb0e9('0x4d')]['id']}},_0x20d4a4={};_0x20d4a4['model']=_[_0xb0e9('0x4e')](db['VoiceQueue'][_0xb0e9('0x3b')]);_0x20d4a4[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0xb3779c[_0xb0e9('0x3d')]);_0x20d4a4[_0xb0e9('0x3e')]=_['intersection'](_0x20d4a4['model'],_0x20d4a4[_0xb0e9('0x3d')]);_0x4b3af2[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x20d4a4[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0xb3779c[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x4b3af2[_0xb0e9('0x42')]=_0x4b3af2[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x4b3af2[_0xb0e9('0x42')]:_0x20d4a4[_0xb0e9('0x40')];if(_0xb3779c[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x4b3af2[_0xb0e9('0x50')]=[{'all':!![]}];}_0x4b3af2=_[_0xb0e9('0x49')]({},_0x4b3af2,_0xb3779c['options']);return db[_0xb0e9('0x3a')][_0xb0e9('0x51')](_0x4b3af2)[_0xb0e9('0x29')](handleEntityNotFound(_0x2b91bd,null))[_0xb0e9('0x29')](respondWithResult(_0x2b91bd,null))[_0xb0e9('0x4b')](handleError(_0x2b91bd,null));};exports['create']=function(_0x3bb3de,_0x2e9d99){return db[_0xb0e9('0x3a')][_0xb0e9('0x52')](_0x3bb3de[_0xb0e9('0x53')],{})[_0xb0e9('0x29')](function(_0x2ba8e7){var _0x484ab3=_0x3bb3de[_0xb0e9('0x54')][_0xb0e9('0x2b')]({'plain':!![]});if(!_0x484ab3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x484ab3[_0xb0e9('0x55')]===_0xb0e9('0x54')){var _0x1398f1=_0x2ba8e7[_0xb0e9('0x2b')]({'plain':!![]});var _0x121873=[{'name':_0xb0e9('0x2c'),'value':_0xb0e9('0x2d')},{'name':_0xb0e9('0x2e'),'value':_0xb0e9('0x2f')}];var _0x3842af=_['find'](_0x121873,[_0xb0e9('0x32'),_0x1398f1[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x3842af,'userProfileId':_0x484ab3[_0xb0e9('0x56')]},'raw':!![]})[_0xb0e9('0x29')](function(_0x34aa36){if(_0x34aa36&&_0x34aa36[_0xb0e9('0x57')]===0x0){return db[_0xb0e9('0x36')]['create']({'name':_0x1398f1[_0xb0e9('0x35')],'resourceId':_0x1398f1['id'],'type':_0x34aa36['name'],'sectionId':_0x34aa36['id']},{})[_0xb0e9('0x29')](function(){return _0x2ba8e7;});}else{return _0x2ba8e7;}})[_0xb0e9('0x4b')](function(_0x4a8ccf){logger[_0xb0e9('0x37')](_0xb0e9('0x58'),_0x4a8ccf);throw _0x4a8ccf;});}return _0x2ba8e7;})[_0xb0e9('0x29')](respondWithResult(_0x2e9d99,0xc9))[_0xb0e9('0x4b')](handleError(_0x2e9d99,null));};exports[_0xb0e9('0x59')]=function(_0x1c5c2b,_0x1ced50){var _0x23b839={'where':{'id':_0x1c5c2b[_0xb0e9('0x4d')]['id']}},_0x198d66={};_0x198d66[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['VoiceQueue'][_0xb0e9('0x3b')]);_0x23b839[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x198d66[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x1c5c2b[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x23b839[_0xb0e9('0x42')]=_0x23b839[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x23b839[_0xb0e9('0x42')]:_0x198d66['model'];if(_0x1c5c2b[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x23b839[_0xb0e9('0x50')]=[{'all':!![]}];}_0x23b839=_[_0xb0e9('0x49')]({},_0x23b839,_0x1c5c2b['options']);return db['VoiceQueue'][_0xb0e9('0x51')](_0x23b839)[_0xb0e9('0x29')](handleEntityNotFound(_0x1ced50,null))['then'](function(_0x47eeb7){if(_0x47eeb7){var _0x3c0d02=_0x47eeb7[_0xb0e9('0x2b')]({'plain':!![]});_0x3c0d02=qs[_0xb0e9('0x5a')](_0x3c0d02,['id','createdAt',_0xb0e9('0x5b')]);_0x1c5c2b[_0xb0e9('0x53')]=_[_0xb0e9('0x5a')](_0x1c5c2b[_0xb0e9('0x53')],['id',_0xb0e9('0x5c'),_0xb0e9('0x5b')]);return db[_0xb0e9('0x3a')][_0xb0e9('0x52')](_[_0xb0e9('0x49')](_0x3c0d02,_0x1c5c2b[_0xb0e9('0x53')]),{'include':_0x1c5c2b[_0xb0e9('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xb0e9('0x29')](function(_0x4c476d){var _0x14bcb2=_0x1c5c2b[_0xb0e9('0x54')]['get']({'plain':!![]});if(!_0x14bcb2)throw new Error(_0xb0e9('0x5d'));if(_0x14bcb2[_0xb0e9('0x55')]===_0xb0e9('0x54')){var _0x306eb2=_0x4c476d[_0xb0e9('0x2b')]({'plain':!![]});var _0x5db9d1=[{'name':_0xb0e9('0x2c'),'value':'inbound'},{'name':_0xb0e9('0x2e'),'value':'outbound'}];var _0x54cdcf=_[_0xb0e9('0x51')](_0x5db9d1,[_0xb0e9('0x32'),_0x306eb2[_0xb0e9('0x34')]])[_0xb0e9('0x35')];return db[_0xb0e9('0x5e')][_0xb0e9('0x51')]({'where':{'name':_0x54cdcf,'userProfileId':_0x14bcb2[_0xb0e9('0x56')]},'raw':!![]})['then'](function(_0x3d0296){if(_0x3d0296&&_0x3d0296[_0xb0e9('0x57')]===0x0){return db[_0xb0e9('0x36')][_0xb0e9('0x52')]({'name':_0x306eb2[_0xb0e9('0x35')],'resourceId':_0x306eb2['id'],'type':_0x3d0296[_0xb0e9('0x35')],'sectionId':_0x3d0296['id']},{})[_0xb0e9('0x29')](function(){return _0x4c476d;});}else{return _0x4c476d;}})[_0xb0e9('0x4b')](function(_0x182b0e){logger[_0xb0e9('0x37')](_0xb0e9('0x58'),_0x182b0e);throw _0x182b0e;});}return _0x4c476d;});}})[_0xb0e9('0x29')](respondWithResult(_0x1ced50,0xc9))['catch'](handleError(_0x1ced50,null));};exports[_0xb0e9('0x28')]=function(_0x3e1ffd,_0x2712b1){if(_0x3e1ffd[_0xb0e9('0x53')]['id']){delete _0x3e1ffd[_0xb0e9('0x53')]['id'];}return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x3e1ffd[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x2712b1,null))[_0xb0e9('0x29')](saveUpdates(_0x3e1ffd[_0xb0e9('0x53')],null))[_0xb0e9('0x29')](respondWithResult(_0x2712b1,null))['catch'](handleError(_0x2712b1,null));};exports[_0xb0e9('0x2a')]=function(_0x3b3fbc,_0x5855be){return db[_0xb0e9('0x3a')]['find']({'where':{'id':_0x3b3fbc[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x5855be,null))['then'](removeEntity(_0x5855be,null))['catch'](handleError(_0x5855be,null));};exports[_0xb0e9('0x5f')]=function(_0x5b67ba,_0x1030c0,_0xf5bce4){var _0x5a7368={'raw':![],'where':{}};var _0x261374={};var _0x5cc487={'count':0x0,'rows':[]};return db[_0xb0e9('0x3a')]['findOne']({'where':{'id':_0x5b67ba[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1030c0,null))['then'](function(_0x459947){if(_0x459947){_0x261374[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['CmHopper'][_0xb0e9('0x3b')]);_0x261374['query']=_['keys'](_0x5b67ba['query']);_0x261374[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x261374['model'],_0x261374[_0xb0e9('0x3d')]);_0x5a7368[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x261374[_0xb0e9('0x40')],qs['fields'](_0x5b67ba[_0xb0e9('0x3d')]['fields']));_0x5a7368[_0xb0e9('0x42')]=_0x5a7368[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x5a7368['attributes']:_0x261374[_0xb0e9('0x40')];if(!_0x5b67ba[_0xb0e9('0x3d')]['hasOwnProperty'](_0xb0e9('0x60'))){_0x5a7368['limit']=qs['limit'](_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x5a7368['offset']=qs['offset'](_0x5b67ba['query'][_0xb0e9('0x22')]);}_0x5a7368[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x5a7368[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x5b67ba[_0xb0e9('0x3d')],_0x261374[_0xb0e9('0x3e')]));_0x5a7368[_0xb0e9('0x47')][_0xb0e9('0x62')]=_0x459947['id'];if(_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x5a7368[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x5a7368[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5a7368[_0xb0e9('0x42')],function(_0x419485){var _0x77272d={};_0x77272d[_0x419485]={'$like':'%'+_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x77272d;})});}_0x5a7368=_[_0xb0e9('0x49')]({},_0x5a7368,_0x5b67ba[_0xb0e9('0x4a')]);return db[_0xb0e9('0x63')]['count']({'where':_0x5a7368[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x13114d){_0x5cc487[_0xb0e9('0x24')]=_0x13114d;if(_0x5b67ba[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x5a7368['include']=[{'all':!![]}];}return db['CmHopper'][_0xb0e9('0x64')](_0x5a7368);})[_0xb0e9('0x29')](function(_0x74b29a){_0x5cc487[_0xb0e9('0x65')]=_0x74b29a;return _0x5cc487;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0x1030c0,_0x5a7368))['catch'](handleError(_0x1030c0,null));};exports[_0xb0e9('0x66')]=function(_0x290eab,_0xa2c67e,_0x5b86f7){var _0x5a68b7={'raw':!![],'where':{}};var _0x21bdbb={};var _0x265a8c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x290eab[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xa2c67e,null))[_0xb0e9('0x29')](function(_0x3e3038){if(_0x3e3038){_0x21bdbb[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x68')][_0xb0e9('0x3b')]);_0x21bdbb[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x290eab[_0xb0e9('0x3d')]);_0x21bdbb[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x21bdbb[_0xb0e9('0x40')],_0x21bdbb[_0xb0e9('0x3d')]);_0x5a68b7['attributes']=_[_0xb0e9('0x3f')](_0x21bdbb['model'],qs[_0xb0e9('0x41')](_0x290eab['query'][_0xb0e9('0x41')]));_0x5a68b7[_0xb0e9('0x42')]=_0x5a68b7[_0xb0e9('0x42')]['length']?_0x5a68b7['attributes']:_0x21bdbb['model'];if(!_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x44')]('nolimit')){_0x5a68b7[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x290eab['query'][_0xb0e9('0x25')]);_0x5a68b7[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x290eab['query']['offset']);}_0x5a68b7['order']=qs[_0xb0e9('0x46')](_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x5a68b7[_0xb0e9('0x47')]=qs['filters'](_['pick'](_0x290eab[_0xb0e9('0x3d')],_0x21bdbb[_0xb0e9('0x3e')]));_0x5a68b7[_0xb0e9('0x47')][_0xb0e9('0x62')]=_0x3e3038['id'];if(_0x290eab[_0xb0e9('0x3d')]['filter']){_0x5a68b7[_0xb0e9('0x47')]=_['merge'](_0x5a68b7[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5a68b7[_0xb0e9('0x42')],function(_0x3bf6a5){var _0x5c860e={};_0x5c860e[_0x3bf6a5]={'$like':'%'+_0x290eab[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x5c860e;})});}_0x5a68b7=_[_0xb0e9('0x49')]({},_0x5a68b7,_0x290eab[_0xb0e9('0x4a')]);return db['CmHopperHistory']['count']({'where':_0x5a68b7['where']})[_0xb0e9('0x29')](function(_0xf0b8ff){_0x265a8c[_0xb0e9('0x24')]=_0xf0b8ff;if(_0x290eab['query'][_0xb0e9('0x4f')]){_0x5a68b7[_0xb0e9('0x50')]=[{'all':!![]}];}return db[_0xb0e9('0x68')]['findAll'](_0x5a68b7);})[_0xb0e9('0x29')](function(_0xfd45d){_0x265a8c[_0xb0e9('0x65')]=_0xfd45d;return _0x265a8c;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0xa2c67e,_0x5a68b7))[_0xb0e9('0x4b')](handleError(_0xa2c67e,null));};exports[_0xb0e9('0x69')]=function(_0x42d3e8,_0x5ca2e7,_0x35f105){var _0x1a7a20={'raw':!![],'where':{}};var _0x5c075f={};var _0x1be8e4={'count':0x0,'rows':[]};return db[_0xb0e9('0x3a')][_0xb0e9('0x67')]({'where':{'id':_0x42d3e8[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ca2e7,null))[_0xb0e9('0x29')](function(_0x4f7dd1){if(_0x4f7dd1){_0x5c075f[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x6a')][_0xb0e9('0x3b')]);_0x5c075f[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x42d3e8[_0xb0e9('0x3d')]);_0x5c075f['filters']=_[_0xb0e9('0x3f')](_0x5c075f['model'],_0x5c075f[_0xb0e9('0x3d')]);_0x1a7a20[_0xb0e9('0x42')]=_[_0xb0e9('0x3f')](_0x5c075f['model'],qs[_0xb0e9('0x41')](_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x1a7a20['attributes']=_0x1a7a20[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x1a7a20[_0xb0e9('0x42')]:_0x5c075f[_0xb0e9('0x40')];if(!_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x1a7a20[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x42d3e8[_0xb0e9('0x3d')]['limit']);_0x1a7a20[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x42d3e8[_0xb0e9('0x3d')]['offset']);}_0x1a7a20[_0xb0e9('0x45')]=qs['sort'](_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x1a7a20[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x42d3e8[_0xb0e9('0x3d')],_0x5c075f[_0xb0e9('0x3e')]));_0x1a7a20['where']['VoiceQueueId']=_0x4f7dd1['id'];if(_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x1a7a20[_0xb0e9('0x47')]=_['merge'](_0x1a7a20[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x1a7a20[_0xb0e9('0x42')],function(_0x42fa14){var _0x3c4c72={};_0x3c4c72[_0x42fa14]={'$like':'%'+_0x42d3e8['query']['filter']+'%'};return _0x3c4c72;})});}_0x1a7a20=_[_0xb0e9('0x49')]({},_0x1a7a20,_0x42d3e8[_0xb0e9('0x4a')]);return db['CmHopperFinal']['count']({'where':_0x1a7a20[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x18f98b){_0x1be8e4[_0xb0e9('0x24')]=_0x18f98b;if(_0x42d3e8[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x1a7a20['include']=[{'all':!![]}];}return db[_0xb0e9('0x6a')][_0xb0e9('0x64')](_0x1a7a20);})[_0xb0e9('0x29')](function(_0x5c0068){_0x1be8e4[_0xb0e9('0x65')]=_0x5c0068;return _0x1be8e4;});}})[_0xb0e9('0x29')](respondWithFilteredResult(_0x5ca2e7,_0x1a7a20))[_0xb0e9('0x4b')](handleError(_0x5ca2e7,null));};exports[_0xb0e9('0x6b')]=function(_0x2b2a16,_0x47b266,_0x101608){var _0x34b532={'raw':!![],'where':{}};var _0x38ecd4={};var _0x26b8d4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x2b2a16[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x47b266,null))['then'](function(_0x14d815){if(_0x14d815){_0x38ecd4[_0xb0e9('0x40')]=_['keys'](db[_0xb0e9('0x6c')]['rawAttributes']);_0x38ecd4[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x2b2a16['query']);_0x38ecd4[_0xb0e9('0x3e')]=_['intersection'](_0x38ecd4[_0xb0e9('0x40')],_0x38ecd4[_0xb0e9('0x3d')]);_0x34b532['attributes']=_[_0xb0e9('0x3f')](_0x38ecd4[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x2b2a16[_0xb0e9('0x3d')]['fields']));_0x34b532[_0xb0e9('0x42')]=_0x34b532[_0xb0e9('0x42')]['length']?_0x34b532[_0xb0e9('0x42')]:_0x38ecd4['model'];if(!_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x44')]('nolimit')){_0x34b532[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x34b532[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x2b2a16[_0xb0e9('0x3d')]['offset']);}_0x34b532[_0xb0e9('0x45')]=qs['sort'](_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x34b532['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x2b2a16[_0xb0e9('0x3d')],_0x38ecd4[_0xb0e9('0x3e')]));_0x34b532['where'][_0xb0e9('0x62')]=_0x14d815['id'];if(_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x34b532['where']=_[_0xb0e9('0x49')](_0x34b532[_0xb0e9('0x47')],{'$or':_['map'](_0x34b532[_0xb0e9('0x42')],function(_0x5cc689){var _0x56bf7d={};_0x56bf7d[_0x5cc689]={'$like':'%'+_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x56bf7d;})});}_0x34b532=_['merge']({},_0x34b532,_0x2b2a16[_0xb0e9('0x4a')]);return db['CmHopperBlack'][_0xb0e9('0x24')]({'where':_0x34b532[_0xb0e9('0x47')]})[_0xb0e9('0x29')](function(_0x25cf13){_0x26b8d4[_0xb0e9('0x24')]=_0x25cf13;if(_0x2b2a16[_0xb0e9('0x3d')][_0xb0e9('0x4f')]){_0x34b532[_0xb0e9('0x50')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xb0e9('0x64')](_0x34b532);})[_0xb0e9('0x29')](function(_0x2fea86){_0x26b8d4[_0xb0e9('0x65')]=_0x2fea86;return _0x26b8d4;});}})['then'](respondWithFilteredResult(_0x47b266,_0x34b532))[_0xb0e9('0x4b')](handleError(_0x47b266,null));};exports[_0xb0e9('0x6d')]=function(_0x442543,_0x40e800,_0x5d215f){var _0x3a8400={};var _0x1d1bd5={};var _0x297a34;var _0x214127;return db['VoiceQueue']['findOne']({'where':{'id':_0x442543[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40e800,null))['then'](function(_0x52c7ef){if(_0x52c7ef){_0x297a34=_0x52c7ef;_0x1d1bd5[_0xb0e9('0x40')]=_['keys'](db['Team'][_0xb0e9('0x3b')]);_0x1d1bd5[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x442543[_0xb0e9('0x3d')]);_0x1d1bd5[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x1d1bd5['model'],_0x1d1bd5['query']);_0x3a8400['attributes']=_['intersection'](_0x1d1bd5[_0xb0e9('0x40')],qs['fields'](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x3a8400[_0xb0e9('0x42')]=_0x3a8400[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x3a8400[_0xb0e9('0x42')]:_0x1d1bd5[_0xb0e9('0x40')];_0x3a8400[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x3a8400['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x442543[_0xb0e9('0x3d')],_0x1d1bd5['filters']));if(_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x3a8400[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x3a8400[_0xb0e9('0x47')],{'$or':_['map'](_0x3a8400['attributes'],function(_0x29c425){var _0x27d1b7={};_0x27d1b7[_0x29c425]={'$like':'%'+_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x27d1b7;})});}_0x3a8400=_[_0xb0e9('0x49')]({},_0x3a8400,_0x442543['options']);return _0x297a34['getTeams'](_0x3a8400);}})[_0xb0e9('0x29')](function(_0x5a6629){if(_0x5a6629){_0x214127=_0x5a6629['length'];if(!_0x442543['query'][_0xb0e9('0x44')]('nolimit')){_0x3a8400[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x3a8400[_0xb0e9('0x22')]=qs['offset'](_0x442543[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x297a34['getTeams'](_0x3a8400);}})[_0xb0e9('0x29')](function(_0x56e43b){if(_0x56e43b){return _0x56e43b?{'count':_0x214127,'rows':_0x56e43b}:null;}})[_0xb0e9('0x29')](respondWithResult(_0x40e800,null))[_0xb0e9('0x4b')](handleError(_0x40e800,null));};exports[_0xb0e9('0x6e')]=function(_0xfcfe5d,_0x4b479d,_0x3e52a8){var _0x3e5dab=_0xfcfe5d['body']['teams'];var _0x5cc7cd=_[_0xb0e9('0x31')](_0x3e5dab,'id');return db[_0xb0e9('0x6f')][_0xb0e9('0x64')]({'where':{'id':_0x5cc7cd},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0xb0e9('0x70'),_0xb0e9('0x71')],'raw':!![]}]})[_0xb0e9('0x29')](function(_0x4315bd){if(_0x4315bd){var _0x482c34=_[_0xb0e9('0x72')](_0x4315bd,function(_0x49f740){var _0xbc36cc=_0x49f740['get']({'plain':!![]});_0xbc36cc[_0xb0e9('0x73')][_0xb0e9('0x74')](function(_0x49e999){_0x49e999[_0xb0e9('0x75')]=_[_0xb0e9('0x51')](_0x3e5dab,{'id':_0xbc36cc['id']})[_0xb0e9('0x75')];});return _0xbc36cc[_0xb0e9('0x73')];});return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0xfcfe5d[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](function(_0x2f209c){return db[_0xb0e9('0x76')][_0xb0e9('0x77')](function(_0x386e92){return _0x2f209c[_0xb0e9('0x6e')](_0x5cc7cd,{'transaction':_0x386e92})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_0x3e5dab,function(_0x8ee83d){return db['TeamVoiceQueue'][_0xb0e9('0x79')]({'TeamId':_0x8ee83d['id'],'VoiceQueueId':_0xfcfe5d[_0xb0e9('0x4d')]['id'],'penalty':_0x8ee83d[_0xb0e9('0x75')]},{'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_0x482c34,function(_0x119e8a){return db[_0xb0e9('0x7a')][_0xb0e9('0x7b')]({'where':{'UserId':_0x119e8a['id'],'VoiceQueueId':_0xfcfe5d['params']['id']},'defaults':{'penalty':_0x119e8a['penalty']},'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){return BPromise[_0xb0e9('0x78')](_['filter'](_0x482c34,{'online':!![]}),function(_0x9244cc){return db[_0xb0e9('0x7c')][_0xb0e9('0x79')]({'membername':_0x9244cc[_0xb0e9('0x35')],'UserId':_0x9244cc['id'],'queue_name':_0x2f209c[_0xb0e9('0x35')],'VoiceQueueId':_0x2f209c['id'],'interface':_[_0xb0e9('0x7d')](_0x9244cc['interface'])?util['format'](_0xb0e9('0x7e'),_0x9244cc[_0xb0e9('0x35')]):_0x9244cc['interface'],'paused':_0x9244cc['voicePause']||![],'penalty':_0x9244cc[_0xb0e9('0x75')]},{'transaction':_0x386e92});});})[_0xb0e9('0x29')](function(){_0x482c34[_0xb0e9('0x74')](function(_0x56580d){socket[_0xb0e9('0x7f')](_0xb0e9('0x80'),{'UserId':_0x56580d['id'],'VoiceQueueId':_0x2f209c['id']});});});});});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x4b479d,null))['catch'](handleError(_0x4b479d,null));};exports['removeTeams']=function(_0xaac117,_0x4617ff,_0xa2c78e){return db[_0xb0e9('0x6f')][_0xb0e9('0x64')]({'where':{'id':_0xaac117[_0xb0e9('0x3d')][_0xb0e9('0x81')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb0e9('0x73'),'attributes':['id'],'raw':!![]}]})[_0xb0e9('0x29')](handleEntityNotFound(_0x4617ff,null))[_0xb0e9('0x29')](function(_0x9ee37){var _0x588e8f=_[_0xb0e9('0x31')](_0x9ee37,'id');var _0x5ed4d5=[];var _0x4379a7=[];var _0xde6e43=squel[_0xb0e9('0x82')]();_0xde6e43[_0xb0e9('0x83')](_0xb0e9('0x84'))[_0xb0e9('0x85')](_0xb0e9('0x86'),'tq')['join']('user_has_teams','ut',_0xb0e9('0x87'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0xaac117[_0xb0e9('0x4d')]['id']);for(var _0x2eb49a=0x0;_0x2eb49a<_0x9ee37[_0xb0e9('0x43')];_0x2eb49a+=0x1){let _0x3b4ccc=_0x9ee37[_0x2eb49a];for(var _0x2bb99d=0x0;_0x2bb99d<_0x3b4ccc['Agents'][_0xb0e9('0x43')];_0x2bb99d+=0x1){let _0x257650=_0x3b4ccc[_0xb0e9('0x73')][_0x2bb99d];var _0x40860b=_0xde6e43['clone']();_0x40860b['where'](_0xb0e9('0x89'),_0x257650['id']);_0x4379a7[_0xb0e9('0x8a')](db[_0xb0e9('0x76')][_0xb0e9('0x3d')](_0x40860b[_0xb0e9('0x8b')](),{'type':db[_0xb0e9('0x76')][_0xb0e9('0x8c')][_0xb0e9('0x8d')]})[_0xb0e9('0x29')](function(_0x121049){if(_0x121049[_0xb0e9('0x43')]===0x1){return _0x257650['id'];}else{var _0x2ee2c3=_[_0xb0e9('0x8e')](_[_0xb0e9('0x31')](_0x121049,_0xb0e9('0x8f')),function(_0x35ab73){return _[_0xb0e9('0x33')](_0x588e8f,_0x35ab73);});if(_0x2ee2c3){return _0x257650['id'];}}}));}}return BPromise[_0xb0e9('0x90')](_0x4379a7)['then'](function(_0xd9b620){_0x5ed4d5=_(_0x5ed4d5)[_0xb0e9('0x91')](_0xd9b620)['compact']()[_0xb0e9('0x32')]();return db['VoiceQueue'][_0xb0e9('0x51')]({'where':{'id':_0xaac117[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](function(_0x21a966){return db[_0xb0e9('0x76')][_0xb0e9('0x77')](function(_0x3bd9d2){return _0x21a966[_0xb0e9('0x92')](_0xaac117[_0xb0e9('0x3d')][_0xb0e9('0x81')],{'transaction':_0x3bd9d2})['then'](function(){if(!_[_0xb0e9('0x93')](_0x5ed4d5)){return _0x21a966[_0xb0e9('0x94')](_0x5ed4d5,{'transaction':_0x3bd9d2})[_0xb0e9('0x29')](function(){return db[_0xb0e9('0x7c')]['destroy']({'where':{'VoiceQueueId':_0xaac117[_0xb0e9('0x4d')]['id'],'UserId':_0x5ed4d5},'transaction':_0x3bd9d2});});}})['then'](function(){_0x5ed4d5[_0xb0e9('0x74')](function(_0x2e21aa){socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':_0x2e21aa,'VoiceQueueId':_0x21a966['id']});});});});});});})['then'](respondWithStatusCode(_0x4617ff,null))[_0xb0e9('0x4b')](handleError(_0x4617ff,null));};exports['addAgents']=function(_0xe21957,_0x1a9dab,_0x590a83){var _0x2709c6,_0x14438b;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0xe21957['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1a9dab,null))[_0xb0e9('0x29')](function(_0xa8e90e){if(_0xa8e90e){_0x14438b=_0xa8e90e;return _0xa8e90e[_0xb0e9('0x96')](_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')],_[_0xb0e9('0x5a')](_0xe21957[_0xb0e9('0x53')],['ids','id'])||{})[_0xb0e9('0x97')](function(_0x49385a){for(var _0x65aa74=0x0;_0x65aa74<_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')]['length'];_0x65aa74+=0x1){socket[_0xb0e9('0x7f')](_0xb0e9('0x80'),{'UserId':Number(_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x81')][_0x65aa74]),'VoiceQueueId':Number(_0xe21957['params']['id'])});}return _0x49385a;});}})[_0xb0e9('0x29')](function(_0x4845a4){_0x2709c6=_0x4845a4||[];if(_0x14438b){return db[_0xb0e9('0x98')][_0xb0e9('0x64')]({'where':{'id':_0xe21957['body'][_0xb0e9('0x81')]},'attributes':['id','name',_0xb0e9('0x99'),_0xb0e9('0x70'),_0xb0e9('0x71')],'raw':!![]});}})['then'](function(_0x1c8b7d){if(!_[_0xb0e9('0x93')](_0x1c8b7d)){var _0x412943=[];for(var _0x2d2e60=0x0;_0x2d2e60<_0x1c8b7d[_0xb0e9('0x43')];_0x2d2e60++){if(_0x1c8b7d[_0x2d2e60][_0xb0e9('0x99')]){_0x412943['push'](db[_0xb0e9('0x7c')][_0xb0e9('0x79')]({'membername':_0x1c8b7d[_0x2d2e60][_0xb0e9('0x35')],'UserId':_0x1c8b7d[_0x2d2e60]['id'],'queue_name':_0x14438b[_0xb0e9('0x35')],'VoiceQueueId':_0x14438b['id'],'interface':_[_0xb0e9('0x7d')](_0x1c8b7d[_0x2d2e60][_0xb0e9('0x71')])?util[_0xb0e9('0x9a')]('SIP/%s',_0x1c8b7d[_0x2d2e60][_0xb0e9('0x35')]):_0x1c8b7d[_0x2d2e60]['interface'],'paused':_0x1c8b7d[_0x2d2e60][_0xb0e9('0x70')]||![],'penalty':_0xe21957[_0xb0e9('0x53')][_0xb0e9('0x75')]||0x0}));}}return BPromise[_0xb0e9('0x90')](_0x412943);}})['then'](function(){return _0x2709c6;})[_0xb0e9('0x29')](respondWithResult(_0x1a9dab,null))[_0xb0e9('0x4b')](handleError(_0x1a9dab,null));};exports['removeAgents']=function(_0x1561c7,_0xd7435d,_0x15b5c5){return db[_0xb0e9('0x3a')]['find']({'where':{'id':_0x1561c7[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xd7435d,null))['then'](function(_0x39c750){if(_0x39c750){return _0x39c750[_0xb0e9('0x94')](_0x1561c7[_0xb0e9('0x3d')]['ids'])[_0xb0e9('0x29')](function(){if(_['isArray'](_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')])){for(var _0x4dc3f7=0x0;_0x4dc3f7<_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')]['length'];_0x4dc3f7+=0x1){socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':Number(_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')][_0x4dc3f7]),'VoiceQueueId':Number(_0x1561c7[_0xb0e9('0x4d')]['id'])});}}else{socket[_0xb0e9('0x7f')](_0xb0e9('0x95'),{'UserId':Number(_0x1561c7['query']['ids']),'VoiceQueueId':Number(_0x1561c7[_0xb0e9('0x4d')]['id'])});}});}})[_0xb0e9('0x29')](function(_0x59c6d8){return db[_0xb0e9('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x1561c7['params']['id'],'UserId':_0x1561c7[_0xb0e9('0x3d')][_0xb0e9('0x81')]}})['then'](function(){return _0x59c6d8;});})[_0xb0e9('0x29')](respondWithStatusCode(_0xd7435d,null))['catch'](handleError(_0xd7435d,null));};exports[_0xb0e9('0x9b')]=function(_0x9811b,_0x20539a,_0x33455b){var _0x227810={};var _0x13ee97={};var _0x2978c4;var _0x31266c;return db['VoiceQueue']['findOne']({'where':{'id':_0x9811b[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x20539a,null))['then'](function(_0xdbe506){if(_0xdbe506){_0x2978c4=_0xdbe506;_0x13ee97[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0x98')]['rawAttributes']);_0x13ee97['query']=_[_0xb0e9('0x4e')](_0x9811b[_0xb0e9('0x3d')]);_0x13ee97['filters']=_[_0xb0e9('0x3f')](_0x13ee97[_0xb0e9('0x40')],_0x13ee97[_0xb0e9('0x3d')]);_0x227810['attributes']=_[_0xb0e9('0x3f')](_0x13ee97[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x9811b[_0xb0e9('0x3d')]['fields']));_0x227810['attributes']=_0x227810[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x227810[_0xb0e9('0x42')]:_0x13ee97[_0xb0e9('0x40')];_0x227810[_0xb0e9('0x45')]=qs['sort'](_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x227810['where']=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x9811b[_0xb0e9('0x3d')],_0x13ee97[_0xb0e9('0x3e')]));if(_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x227810[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x227810[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x227810[_0xb0e9('0x42')],function(_0x460886){var _0x4db17f={};_0x4db17f[_0x460886]={'$like':'%'+_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x4db17f;})});}_0x227810=_[_0xb0e9('0x49')]({},_0x227810,_0x9811b[_0xb0e9('0x4a')]);return _0x2978c4['getAgents'](_0x227810);}})['then'](function(_0x3983ff){if(_0x3983ff){_0x31266c=_0x3983ff['length'];if(!_0x9811b['query'][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x227810[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x9811b[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x227810[_0xb0e9('0x22')]=qs['offset'](_0x9811b[_0xb0e9('0x3d')]['offset']);}return _0x2978c4['getAgents'](_0x227810);}})['then'](function(_0x4cee91){if(_0x4cee91){return _0x4cee91?{'count':_0x31266c,'rows':_0x4cee91}:null;}})[_0xb0e9('0x29')](respondWithResult(_0x20539a,null))[_0xb0e9('0x4b')](handleError(_0x20539a,null));};exports['getMembers']=function(_0x4cc164,_0xd35758,_0x4076d2){var _0x13e45b={};var _0x517b98={};var _0xf8520a;var _0x3f4132;return db[_0xb0e9('0x3a')]['findOne']({'where':{'id':_0x4cc164[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0xd35758,null))['then'](function(_0x525226){if(_0x525226){_0xf8520a=_0x525226;_0x517b98[_0xb0e9('0x40')]=_['keys'](db[_0xb0e9('0x7c')][_0xb0e9('0x3b')]);_0x517b98[_0xb0e9('0x3d')]=_['keys'](_0x4cc164[_0xb0e9('0x3d')]);_0x517b98[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x517b98[_0xb0e9('0x40')],_0x517b98[_0xb0e9('0x3d')]);_0x13e45b['attributes']=_[_0xb0e9('0x3f')](_0x517b98['model'],qs[_0xb0e9('0x41')](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x41')]));_0x13e45b['attributes']=_0x13e45b[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x13e45b['attributes']:_0x517b98[_0xb0e9('0x40')];_0x13e45b[_0xb0e9('0x45')]=qs['sort'](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x46')]);_0x13e45b[_0xb0e9('0x47')]=qs['filters'](_[_0xb0e9('0x61')](_0x4cc164[_0xb0e9('0x3d')],_0x517b98[_0xb0e9('0x3e')]));if(_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x13e45b['where']=_[_0xb0e9('0x49')](_0x13e45b[_0xb0e9('0x47')],{'$or':_['map'](_0x13e45b[_0xb0e9('0x42')],function(_0x424c67){var _0x310857={};_0x310857[_0x424c67]={'$like':'%'+_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x310857;})});}_0x13e45b=_['merge']({},_0x13e45b,_0x4cc164[_0xb0e9('0x4a')]);return _0xf8520a['getMembers'](_0x13e45b);}})['then'](function(_0x36d14b){if(_0x36d14b){_0x3f4132=_0x36d14b[_0xb0e9('0x43')];if(!_0x4cc164[_0xb0e9('0x3d')]['hasOwnProperty'](_0xb0e9('0x60'))){_0x13e45b['limit']=qs['limit'](_0x4cc164[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x13e45b[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x4cc164[_0xb0e9('0x3d')]['offset']);}return _0xf8520a[_0xb0e9('0x9c')](_0x13e45b);}})[_0xb0e9('0x29')](function(_0x51b71a){return _0x51b71a?{'count':_0x3f4132,'rows':_0x51b71a}:null;})[_0xb0e9('0x29')](respondWithResult(_0xd35758,null))[_0xb0e9('0x4b')](handleError(_0xd35758,null));};exports[_0xb0e9('0x9d')]=function(_0x48144a,_0x32a0c0,_0x3b84f9){var _0x5b26e9={};var _0x3613f3={};var _0x14e390;var _0xf46ec3;return db[_0xb0e9('0x3a')][_0xb0e9('0x67')]({'where':{'id':_0x48144a[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32a0c0,null))['then'](function(_0x3f8bc8){if(_0x3f8bc8){_0x14e390=_0x3f8bc8;_0x3613f3[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db['CmList'][_0xb0e9('0x3b')]);_0x3613f3[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x48144a[_0xb0e9('0x3d')]);_0x3613f3[_0xb0e9('0x3e')]=_[_0xb0e9('0x3f')](_0x3613f3[_0xb0e9('0x40')],_0x3613f3[_0xb0e9('0x3d')]);_0x5b26e9['attributes']=_['intersection'](_0x3613f3[_0xb0e9('0x40')],qs[_0xb0e9('0x41')](_0x48144a[_0xb0e9('0x3d')]['fields']));_0x5b26e9[_0xb0e9('0x42')]=_0x5b26e9[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x5b26e9[_0xb0e9('0x42')]:_0x3613f3['model'];_0x5b26e9['order']=qs[_0xb0e9('0x46')](_0x48144a['query'][_0xb0e9('0x46')]);_0x5b26e9[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_['pick'](_0x48144a[_0xb0e9('0x3d')],_0x3613f3['filters']));if(_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x5b26e9['where']=_[_0xb0e9('0x49')](_0x5b26e9[_0xb0e9('0x47')],{'$or':_[_0xb0e9('0x31')](_0x5b26e9[_0xb0e9('0x42')],function(_0x1ae9e1){var _0x33ce6b={};_0x33ce6b[_0x1ae9e1]={'$like':'%'+_0x48144a[_0xb0e9('0x3d')]['filter']+'%'};return _0x33ce6b;})});}_0x5b26e9=_[_0xb0e9('0x49')]({},_0x5b26e9,_0x48144a[_0xb0e9('0x4a')]);return _0x14e390[_0xb0e9('0x9d')](_0x5b26e9);}})[_0xb0e9('0x29')](function(_0x142e1c){if(_0x142e1c){_0xf46ec3=_0x142e1c['length'];if(!_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x44')](_0xb0e9('0x60'))){_0x5b26e9[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x25')]);_0x5b26e9[_0xb0e9('0x22')]=qs[_0xb0e9('0x22')](_0x48144a[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x14e390['getLists'](_0x5b26e9);}})[_0xb0e9('0x29')](function(_0x35f7ac){if(_0x35f7ac){return _0x35f7ac?{'count':_0xf46ec3,'rows':_0x35f7ac}:null;}})['then'](respondWithResult(_0x32a0c0,null))[_0xb0e9('0x4b')](handleError(_0x32a0c0,null));};exports[_0xb0e9('0x9e')]=function(_0x1f43ca,_0x204954,_0x3a29d6){var _0x59bee3,_0x3cc232;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x1f43ca[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x204954,null))[_0xb0e9('0x29')](function(_0x5b691f){if(_0x5b691f){_0x3cc232=_0x5b691f;return _0x5b691f[_0xb0e9('0x9e')](_0x1f43ca[_0xb0e9('0x53')]['ids'],_['omit'](_0x1f43ca[_0xb0e9('0x53')],[_0xb0e9('0x81'),'id'])||{});}return null;})[_0xb0e9('0x97')](function(_0x2c81bc){var _0x20f18d;_0x59bee3=_0x2c81bc||[];var _0x4f6854=[];if(_0x2c81bc){for(var _0x7bb709=0x0;_0x7bb709<_0x2c81bc['length'];_0x7bb709+=0x1){var _0xc3543c=_0x2c81bc[_0x7bb709]['get']({'plain':!![]});_0x3cc232[_0xb0e9('0x9f')]=_0x1f43ca[_0xb0e9('0x53')][_0xb0e9('0x9f')]?_0x1f43ca[_0xb0e9('0x53')][_0xb0e9('0x9f')]:_0x3cc232[_0xb0e9('0x9f')];switch(_0x3cc232[_0xb0e9('0x9f')]){case _0xb0e9('0xa0'):_0x20f18d=squel[_0xb0e9('0xa1')]()['into']('cm_hopper')[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),'ContactId','ListId','VoiceQueueId',_0xb0e9('0x5c'),'updatedAt'],squel['select']()[_0xb0e9('0x83')]('phone','phone')[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0xa4'))[_0xb0e9('0x83')]('id',_0xb0e9('0xa6'))[_0xb0e9('0x83')](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')](),_0xb0e9('0x62'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),'updatedAt')[_0xb0e9('0x85')](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))[_0xb0e9('0x47')]('ListId\x20=\x20?',_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())[_0xb0e9('0x47')](_0xb0e9('0xab'))[_0xb0e9('0x47')](_0xb0e9('0xac'),squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xad'))[_0xb0e9('0x85')](_0xb0e9('0xae'))[_0xb0e9('0x47')]('VoiceQueueId\x20=\x20?',_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')]()))[_0xb0e9('0x47')](_0xb0e9('0xac'),squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xaf'))[_0xb0e9('0x85')](_0xb0e9('0xb0'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')]())))[_0xb0e9('0x8b')]();break;case _0xb0e9('0xb1'):_0x20f18d=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb0'))[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),_0xb0e9('0x62'),_0xb0e9('0x5c'),'updatedAt'],squel['select']()['field'](_0xb0e9('0xa3'),_0xb0e9('0xa3'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0xa4'))['field']('id',_0xb0e9('0xa6'))['field'](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca['params']['id']['toString'](),_0xb0e9('0x62'))['field'](_0xb0e9('0xa5'),'createdAt')['field'](_0xb0e9('0xa5'),'updatedAt')['from'](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))[_0xb0e9('0x47')](_0xb0e9('0xb3'),_0xc3543c['CmListId'][_0xb0e9('0x8b')]())['where'](_0xb0e9('0xab'))[_0xb0e9('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xb0e9('0xaf'))[_0xb0e9('0x85')](_0xb0e9('0xb0'))[_0xb0e9('0x47')](_0xb0e9('0x88'),_0x1f43ca['params']['id']['toString']())))[_0xb0e9('0x8b')]();break;default:_0x20f18d=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb0'))[_0xb0e9('0xa2')]([_0xb0e9('0xa3'),_0xb0e9('0xa4'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),'VoiceQueueId',_0xb0e9('0x5c'),'updatedAt'],squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')]('phone',_0xb0e9('0xa3'))[_0xb0e9('0x83')]('NOW()','scheduledAt')[_0xb0e9('0x83')]('id','ContactId')[_0xb0e9('0x83')](_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x1f43ca[_0xb0e9('0x4d')]['id'][_0xb0e9('0x8b')](),_0xb0e9('0x62'))['field'](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')]('NOW()',_0xb0e9('0x5b'))[_0xb0e9('0x85')](_0xb0e9('0xa9'))['where'](_0xb0e9('0xaa'))['where'](_0xb0e9('0xb3'),_0xc3543c[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())[_0xb0e9('0x47')](_0xb0e9('0xab')))[_0xb0e9('0x8b')]();}_0x4f6854[_0xb0e9('0x8a')](db[_0xb0e9('0x76')]['query'](_0x20f18d));}return BPromise['all'](_0x4f6854);}})[_0xb0e9('0x29')](function(){return _0x59bee3;})['then'](respondWithResult(_0x204954,null))['catch'](handleError(_0x204954,null));};exports[_0xb0e9('0xb4')]=function(_0x4fa908,_0x385bac,_0x218e6d){return db['VoiceQueue']['find']({'where':{'id':_0x4fa908['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x385bac,null))[_0xb0e9('0x29')](function(_0x549088){if(_0x549088){return _0x549088[_0xb0e9('0xb4')](_0x4fa908[_0xb0e9('0x3d')][_0xb0e9('0x81')]);}})[_0xb0e9('0x29')](function(_0x74850d){if(_0x74850d){return db['CmHopper'][_0xb0e9('0x2a')]({'where':{'ListId':_0x4fa908[_0xb0e9('0x3d')]['ids'],'VoiceQueueId':_0x4fa908[_0xb0e9('0x4d')]['id']}})['then'](function(){return _0x74850d;});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x385bac,null))['catch'](handleError(_0x385bac,null));};exports[_0xb0e9('0xb5')]=function(_0x261978,_0xf94b1b,_0x771707){var _0x630dde={};var _0x5cc9c0={};var _0x3269d6;var _0x4821fa;return db['VoiceQueue'][_0xb0e9('0x67')]({'where':{'id':_0x261978[_0xb0e9('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf94b1b,null))[_0xb0e9('0x29')](function(_0x3cd1c6){if(_0x3cd1c6){_0x3269d6=_0x3cd1c6;_0x5cc9c0[_0xb0e9('0x40')]=_[_0xb0e9('0x4e')](db[_0xb0e9('0xb6')][_0xb0e9('0x3b')]);_0x5cc9c0[_0xb0e9('0x3d')]=_[_0xb0e9('0x4e')](_0x261978[_0xb0e9('0x3d')]);_0x5cc9c0[_0xb0e9('0x3e')]=_['intersection'](_0x5cc9c0['model'],_0x5cc9c0['query']);_0x630dde['attributes']=_[_0xb0e9('0x3f')](_0x5cc9c0[_0xb0e9('0x40')],qs['fields'](_0x261978['query'][_0xb0e9('0x41')]));_0x630dde['attributes']=_0x630dde[_0xb0e9('0x42')][_0xb0e9('0x43')]?_0x630dde[_0xb0e9('0x42')]:_0x5cc9c0['model'];_0x630dde[_0xb0e9('0x45')]=qs[_0xb0e9('0x46')](_0x261978['query']['sort']);_0x630dde[_0xb0e9('0x47')]=qs[_0xb0e9('0x3e')](_[_0xb0e9('0x61')](_0x261978[_0xb0e9('0x3d')],_0x5cc9c0['filters']));if(_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x30')]){_0x630dde[_0xb0e9('0x47')]=_[_0xb0e9('0x49')](_0x630dde['where'],{'$or':_[_0xb0e9('0x31')](_0x630dde[_0xb0e9('0x42')],function(_0x1327d3){var _0x8b6dc6={};_0x8b6dc6[_0x1327d3]={'$like':'%'+_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x30')]+'%'};return _0x8b6dc6;})});}_0x630dde=_[_0xb0e9('0x49')]({},_0x630dde,_0x261978[_0xb0e9('0x4a')]);return _0x3269d6[_0xb0e9('0xb5')](_0x630dde);}})[_0xb0e9('0x29')](function(_0x5019b0){if(_0x5019b0){_0x4821fa=_0x5019b0[_0xb0e9('0x43')];if(!_0x261978['query']['hasOwnProperty']('nolimit')){_0x630dde[_0xb0e9('0x25')]=qs[_0xb0e9('0x25')](_0x261978[_0xb0e9('0x3d')]['limit']);_0x630dde['offset']=qs['offset'](_0x261978[_0xb0e9('0x3d')][_0xb0e9('0x22')]);}return _0x3269d6[_0xb0e9('0xb5')](_0x630dde);}})[_0xb0e9('0x29')](function(_0x26d382){if(_0x26d382){return _0x26d382?{'count':_0x4821fa,'rows':_0x26d382}:null;}})['then'](respondWithResult(_0xf94b1b,null))[_0xb0e9('0x4b')](handleError(_0xf94b1b,null));};exports[_0xb0e9('0xb7')]=function(_0x258e43,_0xd7d02,_0x20a52a){var _0x753c81,_0x2f82a2;return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x258e43['params']['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0xd7d02,null))[_0xb0e9('0x29')](function(_0x45d752){if(_0x45d752){_0x2f82a2=_0x45d752;return _0x45d752[_0xb0e9('0xb7')](_0x258e43[_0xb0e9('0x53')][_0xb0e9('0x81')],_[_0xb0e9('0x5a')](_0x258e43[_0xb0e9('0x53')],['ids','id'])||{});}return null;})[_0xb0e9('0x97')](function(_0x528f21){var _0x3d2096;_0x753c81=_0x528f21||[];var _0x4ddc6c=[];if(_0x528f21){for(var _0x5dfc79=0x0;_0x5dfc79<_0x528f21['length'];_0x5dfc79+=0x1){var _0x1bc2cd=_0x528f21[_0x5dfc79][_0xb0e9('0x2b')]({'plain':!![]});_0x3d2096=squel['insert']()[_0xb0e9('0xb2')](_0xb0e9('0xb8'))['fromQuery']([_0xb0e9('0xa3'),_0xb0e9('0xa6'),_0xb0e9('0xa8'),'VoiceQueueId',_0xb0e9('0x5c'),_0xb0e9('0x5b')],squel[_0xb0e9('0x82')]()[_0xb0e9('0x83')](_0xb0e9('0xa3'),_0xb0e9('0xa3'))['field']('id','ContactId')['field'](_0x1bc2cd['CmListId'][_0xb0e9('0x8b')](),_0xb0e9('0xa8'))[_0xb0e9('0x83')](_0x258e43['params']['id'][_0xb0e9('0x8b')](),'VoiceQueueId')[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5c'))[_0xb0e9('0x83')](_0xb0e9('0xa5'),_0xb0e9('0x5b'))[_0xb0e9('0x85')](_0xb0e9('0xa9'))[_0xb0e9('0x47')](_0xb0e9('0xaa'))['where'](_0xb0e9('0xb3'),_0x1bc2cd[_0xb0e9('0xa7')][_0xb0e9('0x8b')]())['where'](_0xb0e9('0xab')))[_0xb0e9('0x8b')]();_0x4ddc6c[_0xb0e9('0x8a')](db[_0xb0e9('0x76')][_0xb0e9('0x3d')](_0x3d2096));}return BPromise['all'](_0x4ddc6c);}})['then'](function(){return _0x753c81;})[_0xb0e9('0x29')](respondWithResult(_0xd7d02,null))['catch'](handleError(_0xd7d02,null));};exports[_0xb0e9('0xb9')]=function(_0x3b37a0,_0x1e8d20,_0x7d596e){return db[_0xb0e9('0x3a')][_0xb0e9('0x51')]({'where':{'id':_0x3b37a0[_0xb0e9('0x4d')]['id']}})[_0xb0e9('0x29')](handleEntityNotFound(_0x1e8d20,null))['then'](function(_0x1d21a0){if(_0x1d21a0){return _0x1d21a0[_0xb0e9('0xb9')](_0x3b37a0[_0xb0e9('0x3d')][_0xb0e9('0x81')]);}})[_0xb0e9('0x29')](function(_0x5dc41a){if(_0x5dc41a){return db[_0xb0e9('0x6c')]['destroy']({'where':{'ListId':_0x3b37a0[_0xb0e9('0x3d')][_0xb0e9('0x81')],'VoiceQueueId':_0x3b37a0[_0xb0e9('0x4d')]['id']}})['then'](function(){return _0x5dc41a;});}})[_0xb0e9('0x29')](respondWithStatusCode(_0x1e8d20,null))[_0xb0e9('0x4b')](handleError(_0x1e8d20,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 9bf79aa..018b3ff 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 _0x5328=['hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1789c2,_0x2a99c1){var _0x4dfe76=function(_0x3a4e5c){while(--_0x3a4e5c){_0x1789c2['push'](_0x1789c2['shift']());}};_0x4dfe76(++_0x2a99c1);}(_0x5328,0x121));var _0x8532=function(_0x3f3117,_0x9074ba){_0x3f3117=_0x3f3117-0x0;var _0x5cdf22=_0x5328[_0x3f3117];return _0x5cdf22;};'use strict';var EventEmitter=require(_0x8532('0x0'));var VoiceQueue=require(_0x8532('0x1'))['db'][_0x8532('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8532('0x3')](0x0);var events={'afterCreate':_0x8532('0x4'),'afterUpdate':_0x8532('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21336c){return function(_0x220ca1,_0x460bf0,_0x3941cf){VoiceQueueEvents[_0x8532('0x6')](_0x21336c+':'+_0x220ca1['id'],_0x220ca1);VoiceQueueEvents['emit'](_0x21336c,_0x220ca1);_0x3941cf(null);};}for(var e in events){if(events[_0x8532('0x7')](e)){var event=events[e];VoiceQueue[_0x8532('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x0c5a=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x552252,_0xdb0d75){var _0x16ae8d=function(_0x1cebe2){while(--_0x1cebe2){_0x552252['push'](_0x552252['shift']());}};_0x16ae8d(++_0xdb0d75);}(_0x0c5a,0x157));var _0xa0c5=function(_0x32eb3f,_0x3cc610){_0x32eb3f=_0x32eb3f-0x0;var _0x372d5f=_0x0c5a[_0x32eb3f];return _0x372d5f;};'use strict';var EventEmitter=require(_0xa0c5('0x0'));var VoiceQueue=require(_0xa0c5('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa0c5('0x2')](0x0);var events={'afterCreate':_0xa0c5('0x3'),'afterUpdate':_0xa0c5('0x4'),'afterDestroy':_0xa0c5('0x5')};function emitEvent(_0x390d11){return function(_0xdfc78e,_0x2c5532,_0x4f0851){VoiceQueueEvents[_0xa0c5('0x6')](_0x390d11+':'+_0xdfc78e['id'],_0xdfc78e);VoiceQueueEvents[_0xa0c5('0x6')](_0x390d11,_0xdfc78e);_0x4f0851(null);};}for(var e in events){if(events[_0xa0c5('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa0c5('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a1a1bc8..2966aa1 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x4403e5,_0x32ddae){var _0x512114=function(_0x1f21cb){while(--_0x1f21cb){_0x4403e5['push'](_0x4403e5['shift']());}};_0x512114(++_0x32ddae);}(_0x70e0,0x17b));var _0x070e=function(_0x1d0fa6,_0x463b0d){_0x1d0fa6=_0x1d0fa6-0x0;var _0x1c36d7=_0x70e0[_0x1d0fa6];return _0x1c36d7;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1f8f66,_0x5dc25a){var _0x3b992d=function(_0x25dadb){while(--_0x25dadb){_0x1f8f66['push'](_0x1f8f66['shift']());}};_0x3b992d(++_0x5dc25a);}(_0x70e0,0x17b));var _0x070e=function(_0x2a0929,_0x4abe7c){_0x2a0929=_0x2a0929-0x0;var _0x50e47b=_0x70e0[_0x2a0929];return _0x50e47b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 29e411e..b1c178a 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 _0x1f91=['stringify','error','code','message','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2cc5e4,_0x41bac4){var _0x100a9c=function(_0x4a445b){while(--_0x4a445b){_0x2cc5e4['push'](_0x2cc5e4['shift']());}};_0x100a9c(++_0x41bac4);}(_0x1f91,0xfb));var _0x11f9=function(_0x26195b,_0x37a5d7){_0x26195b=_0x26195b-0x0;var _0x34638a=_0x1f91[_0x26195b];return _0x34638a;};'use strict';var _=require('lodash');var util=require(_0x11f9('0x0'));var moment=require(_0x11f9('0x1'));var BPromise=require(_0x11f9('0x2'));var rs=require(_0x11f9('0x3'));var fs=require('fs');var Redis=require(_0x11f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11f9('0x5'));var logger=require(_0x11f9('0x6'))(_0x11f9('0x7'));var config=require(_0x11f9('0x8'));var jayson=require(_0x11f9('0x9'));var client=jayson['client'][_0x11f9('0xa')]({'port':0x232a});config[_0x11f9('0xb')]=_[_0x11f9('0xc')](config[_0x11f9('0xb')],{'host':_0x11f9('0xd'),'port':0x18eb});var socket=require(_0x11f9('0xe'))(new Redis(config[_0x11f9('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x39e864,_0x4673e3,_0x14162d){return new BPromise(function(_0x50ce91,_0x6a53d0){return client[_0x11f9('0xf')](_0x39e864,_0x14162d)[_0x11f9('0x10')](function(_0x411ddb){logger[_0x11f9('0x11')](_0x11f9('0x12'),_0x4673e3,_0x11f9('0x13'));logger[_0x11f9('0x14')](_0x11f9('0x15'),_0x4673e3,_0x11f9('0x13'),JSON[_0x11f9('0x16')](_0x411ddb));if(_0x411ddb['error']){if(_0x411ddb[_0x11f9('0x17')][_0x11f9('0x18')]===0x1f4){logger['error'](_0x11f9('0x12'),_0x4673e3,_0x411ddb[_0x11f9('0x17')][_0x11f9('0x19')]);return _0x6a53d0(_0x411ddb[_0x11f9('0x17')]['message']);}logger['error'](_0x11f9('0x12'),_0x4673e3,_0x411ddb[_0x11f9('0x17')]['message']);return _0x50ce91(_0x411ddb[_0x11f9('0x17')][_0x11f9('0x19')]);}else{logger[_0x11f9('0x11')](_0x11f9('0x12'),_0x4673e3,_0x11f9('0x13'));_0x50ce91(_0x411ddb['result'][_0x11f9('0x19')]);}})['catch'](function(_0x4cb021){logger[_0x11f9('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x4673e3,_0x4cb021);_0x6a53d0(_0x4cb021);});});}exports[_0x11f9('0x1a')]=function(_0x5e51cb){var _0x456521=this;return new Promise(function(_0x51ab32,_0xd7d220){return db[_0x11f9('0x1b')]['findAll']({'raw':_0x5e51cb[_0x11f9('0x1c')]?_0x5e51cb[_0x11f9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e51cb[_0x11f9('0x1c')]?_0x5e51cb['options'][_0x11f9('0x1d')]||null:null,'attributes':_0x5e51cb[_0x11f9('0x1c')]?_0x5e51cb[_0x11f9('0x1c')][_0x11f9('0x1e')]||null:null,'limit':_0x5e51cb['options']?_0x5e51cb[_0x11f9('0x1c')][_0x11f9('0x1f')]||null:null,'include':_0x5e51cb[_0x11f9('0x1c')]?_0x5e51cb['options'][_0x11f9('0x20')]?_[_0x11f9('0x21')](_0x5e51cb['options']['include'],function(_0xb0817f){return{'model':db[_0xb0817f[_0x11f9('0x22')]],'as':_0xb0817f['as'],'attributes':_0xb0817f[_0x11f9('0x1e')],'include':_0xb0817f['include']?_[_0x11f9('0x21')](_0xb0817f['include'],function(_0x55ef8c){return{'model':db[_0x55ef8c['model']],'as':_0x55ef8c['as'],'attributes':_0x55ef8c[_0x11f9('0x1e')],'include':_0x55ef8c[_0x11f9('0x20')]?_[_0x11f9('0x21')](_0x55ef8c['include'],function(_0x5c291a){return{'model':db[_0x5c291a[_0x11f9('0x22')]],'as':_0x5c291a['as'],'attributes':_0x5c291a[_0x11f9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11f9('0x10')](function(_0x45be88){logger['info']('GetVoiceQueue',_0x5e51cb);logger[_0x11f9('0x14')]('GetVoiceQueue',_0x5e51cb,JSON[_0x11f9('0x16')](_0x45be88));_0x51ab32(_0x45be88);})[_0x11f9('0x23')](function(_0x2f0f39){logger['error']('GetVoiceQueue',_0x2f0f39['message'],_0x5e51cb);_0xd7d220(_0x456521[_0x11f9('0x17')](0x1f4,_0x2f0f39[_0x11f9('0x19')]));});});};exports[_0x11f9('0x24')]=function(_0x152606){var _0x571d47=this;return new Promise(function(_0x4a2360,_0x35914e){return db[_0x11f9('0x1b')][_0x11f9('0x25')]({'raw':_0x152606[_0x11f9('0x1c')]?_0x152606[_0x11f9('0x1c')][_0x11f9('0x26')]===undefined?!![]:![]:!![],'where':_0x152606[_0x11f9('0x1c')]?_0x152606[_0x11f9('0x1c')]['where']||null:null,'attributes':_0x152606[_0x11f9('0x1c')]?_0x152606['options'][_0x11f9('0x1e')]||null:null,'include':_0x152606[_0x11f9('0x1c')]?_0x152606[_0x11f9('0x1c')]['include']?_[_0x11f9('0x21')](_0x152606['options']['include'],function(_0x5c0a9c){return{'model':db[_0x5c0a9c['model']],'as':_0x5c0a9c['as'],'attributes':_0x5c0a9c[_0x11f9('0x1e')],'include':_0x5c0a9c['include']?_[_0x11f9('0x21')](_0x5c0a9c[_0x11f9('0x20')],function(_0x2e7be3){return{'model':db[_0x2e7be3[_0x11f9('0x22')]],'as':_0x2e7be3['as'],'attributes':_0x2e7be3[_0x11f9('0x1e')],'include':_0x2e7be3[_0x11f9('0x20')]?_[_0x11f9('0x21')](_0x2e7be3['include'],function(_0x54583f){return{'model':db[_0x54583f[_0x11f9('0x22')]],'as':_0x54583f['as'],'attributes':_0x54583f[_0x11f9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11f9('0x10')](function(_0x49c9f4){logger[_0x11f9('0x11')](_0x11f9('0x24'),_0x152606);logger[_0x11f9('0x14')]('ShowVoiceQueue',_0x152606,JSON[_0x11f9('0x16')](_0x49c9f4));_0x4a2360(_0x49c9f4);})[_0x11f9('0x23')](function(_0x21036f){logger[_0x11f9('0x17')](_0x11f9('0x24'),_0x21036f[_0x11f9('0x19')],_0x152606);_0x35914e(_0x571d47[_0x11f9('0x17')](0x1f4,_0x21036f['message']));});});}; \ No newline at end of file +var _0x5d6a=['info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','model','include','map','catch','debug','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then'];(function(_0x34da94,_0x178b79){var _0x7ae05e=function(_0xa083ee){while(--_0xa083ee){_0x34da94['push'](_0x34da94['shift']());}};_0x7ae05e(++_0x178b79);}(_0x5d6a,0xbd));var _0xa5d6=function(_0x1512b5,_0x532fef){_0x1512b5=_0x1512b5-0x0;var _0x57baad=_0x5d6a[_0x1512b5];return _0x57baad;};'use strict';var _=require(_0xa5d6('0x0'));var util=require(_0xa5d6('0x1'));var moment=require(_0xa5d6('0x2'));var BPromise=require(_0xa5d6('0x3'));var rs=require(_0xa5d6('0x4'));var fs=require('fs');var Redis=require(_0xa5d6('0x5'));var db=require(_0xa5d6('0x6'))['db'];var utils=require(_0xa5d6('0x7'));var logger=require(_0xa5d6('0x8'))(_0xa5d6('0x9'));var config=require('../../config/environment');var jayson=require(_0xa5d6('0xa'));var client=jayson[_0xa5d6('0xb')][_0xa5d6('0xc')]({'port':0x232a});config[_0xa5d6('0xd')]=_[_0xa5d6('0xe')](config[_0xa5d6('0xd')],{'host':_0xa5d6('0xf'),'port':0x18eb});var socket=require(_0xa5d6('0x10'))(new Redis(config[_0xa5d6('0xd')]));require(_0xa5d6('0x11'))[_0xa5d6('0x12')](socket);function respondWithRpcPromise(_0x49c914,_0x488605,_0x2328a1){return new BPromise(function(_0x47a4dc,_0x111507){return client[_0xa5d6('0x13')](_0x49c914,_0x2328a1)[_0xa5d6('0x14')](function(_0x20d7f2){logger[_0xa5d6('0x15')](_0xa5d6('0x16'),_0x488605,_0xa5d6('0x17'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x488605,_0xa5d6('0x17'),JSON[_0xa5d6('0x18')](_0x20d7f2));if(_0x20d7f2[_0xa5d6('0x19')]){if(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1a')]===0x1f4){logger['error'](_0xa5d6('0x16'),_0x488605,_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);return _0x111507(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);}logger[_0xa5d6('0x19')](_0xa5d6('0x16'),_0x488605,_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);return _0x47a4dc(_0x20d7f2[_0xa5d6('0x19')][_0xa5d6('0x1b')]);}else{logger[_0xa5d6('0x15')](_0xa5d6('0x16'),_0x488605,_0xa5d6('0x17'));_0x47a4dc(_0x20d7f2[_0xa5d6('0x1c')][_0xa5d6('0x1b')]);}})['catch'](function(_0x4841cf){logger[_0xa5d6('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x488605,_0x4841cf);_0x111507(_0x4841cf);});});}exports[_0xa5d6('0x1d')]=function(_0x3546ac){var _0xdb17d5=this;return new Promise(function(_0x2368b7,_0x247e1a){return db[_0xa5d6('0x1e')]['findAll']({'raw':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x20')]===undefined?!![]:![]:!![],'where':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x21')]||null:null,'attributes':_0x3546ac['options']?_0x3546ac['options'][_0xa5d6('0x22')]||null:null,'limit':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')][_0xa5d6('0x23')]||null:null,'include':_0x3546ac[_0xa5d6('0x1f')]?_0x3546ac[_0xa5d6('0x1f')]['include']?_['map'](_0x3546ac['options']['include'],function(_0x5288c2){return{'model':db[_0x5288c2[_0xa5d6('0x24')]],'as':_0x5288c2['as'],'attributes':_0x5288c2[_0xa5d6('0x22')],'include':_0x5288c2[_0xa5d6('0x25')]?_['map'](_0x5288c2[_0xa5d6('0x25')],function(_0x334aee){return{'model':db[_0x334aee[_0xa5d6('0x24')]],'as':_0x334aee['as'],'attributes':_0x334aee[_0xa5d6('0x22')],'include':_0x334aee[_0xa5d6('0x25')]?_[_0xa5d6('0x26')](_0x334aee[_0xa5d6('0x25')],function(_0x6c898f){return{'model':db[_0x6c898f[_0xa5d6('0x24')]],'as':_0x6c898f['as'],'attributes':_0x6c898f[_0xa5d6('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa5d6('0x14')](function(_0x5087e8){logger[_0xa5d6('0x15')]('GetVoiceQueue',_0x3546ac);logger['debug'](_0xa5d6('0x1d'),_0x3546ac,JSON[_0xa5d6('0x18')](_0x5087e8));_0x2368b7(_0x5087e8);})[_0xa5d6('0x27')](function(_0x3b24c5){logger[_0xa5d6('0x19')](_0xa5d6('0x1d'),_0x3b24c5[_0xa5d6('0x1b')],_0x3546ac);_0x247e1a(_0xdb17d5['error'](0x1f4,_0x3b24c5[_0xa5d6('0x1b')]));});});};exports['ShowVoiceQueue']=function(_0x44b60e){var _0x3916df=this;return new Promise(function(_0x18949c,_0x3fb803){return db[_0xa5d6('0x1e')]['find']({'raw':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')][_0xa5d6('0x20')]===undefined?!![]:![]:!![],'where':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')][_0xa5d6('0x21')]||null:null,'attributes':_0x44b60e['options']?_0x44b60e[_0xa5d6('0x1f')]['attributes']||null:null,'include':_0x44b60e[_0xa5d6('0x1f')]?_0x44b60e[_0xa5d6('0x1f')]['include']?_[_0xa5d6('0x26')](_0x44b60e[_0xa5d6('0x1f')]['include'],function(_0x1753fc){return{'model':db[_0x1753fc['model']],'as':_0x1753fc['as'],'attributes':_0x1753fc['attributes'],'include':_0x1753fc[_0xa5d6('0x25')]?_[_0xa5d6('0x26')](_0x1753fc[_0xa5d6('0x25')],function(_0x38f703){return{'model':db[_0x38f703['model']],'as':_0x38f703['as'],'attributes':_0x38f703[_0xa5d6('0x22')],'include':_0x38f703[_0xa5d6('0x25')]?_['map'](_0x38f703[_0xa5d6('0x25')],function(_0xd37da6){return{'model':db[_0xd37da6[_0xa5d6('0x24')]],'as':_0xd37da6['as'],'attributes':_0xd37da6[_0xa5d6('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2e8a8){logger['info']('ShowVoiceQueue',_0x44b60e);logger[_0xa5d6('0x28')](_0xa5d6('0x29'),_0x44b60e,JSON[_0xa5d6('0x18')](_0xf2e8a8));_0x18949c(_0xf2e8a8);})[_0xa5d6('0x27')](function(_0x3dfff7){logger['error'](_0xa5d6('0x29'),_0x3dfff7[_0xa5d6('0x1b')],_0x44b60e);_0x3fb803(_0x3916df['error'](0x1f4,_0x3dfff7[_0xa5d6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 496e7fc..feee47c 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 _0x2320=['save','remove','update','removeListener','register','length','./voiceQueue.events'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2320,0x7d));var _0x0232=function(_0x1c3929,_0x2578c6){_0x1c3929=_0x1c3929-0x0;var _0x35a491=_0x2320[_0x1c3929];return _0x35a491;};'use strict';var VoiceQueueEvents=require(_0x0232('0x0'));var events=[_0x0232('0x1'),_0x0232('0x2'),_0x0232('0x3')];function createListener(_0x353d59,_0xcf8f3){return function(_0x373ced){_0xcf8f3['emit'](_0x353d59,_0x373ced);};}function removeListener(_0x32d161,_0x2e0298){return function(){VoiceQueueEvents[_0x0232('0x4')](_0x32d161,_0x2e0298);};}exports[_0x0232('0x5')]=function(_0x40ace3){for(var _0x462e85=0x0,_0x18178c=events[_0x0232('0x6')];_0x462e85<_0x18178c;_0x462e85++){var _0x1af5a1=events[_0x462e85];var _0xd063a=createListener('voiceQueue:'+_0x1af5a1,_0x40ace3);VoiceQueueEvents['on'](_0x1af5a1,_0xd063a);}}; \ No newline at end of file +var _0x54a5=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x54a5,0x8b));var _0x554a=function(_0x24ac55,_0x4f1363){_0x24ac55=_0x24ac55-0x0;var _0x235a72=_0x54a5[_0x24ac55];return _0x235a72;};'use strict';var VoiceQueueEvents=require(_0x554a('0x0'));var events=[_0x554a('0x1'),_0x554a('0x2'),_0x554a('0x3')];function createListener(_0x524ef8,_0x17bdd4){return function(_0x3d838){_0x17bdd4[_0x554a('0x4')](_0x524ef8,_0x3d838);};}function removeListener(_0x125f53,_0x5171f8){return function(){VoiceQueueEvents[_0x554a('0x5')](_0x125f53,_0x5171f8);};}exports[_0x554a('0x6')]=function(_0x1c20ff){for(var _0x3ebcb6=0x0,_0x54c4e4=events['length'];_0x3ebcb6<_0x54c4e4;_0x3ebcb6++){var _0x59a31f=events[_0x3ebcb6];var _0x210c94=createListener(_0x554a('0x7')+_0x59a31f,_0x1c20ff);VoiceQueueEvents['on'](_0x59a31f,_0x210c94);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 3313a97..448fb5a 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 _0xe467=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update','delete','exports','multer'];(function(_0x1595cf,_0x4dc350){var _0x2fbd1f=function(_0x2bde39){while(--_0x2bde39){_0x1595cf['push'](_0x1595cf['shift']());}};_0x2fbd1f(++_0x4dc350);}(_0xe467,0x149));var _0x7e46=function(_0x5aea5a,_0x346fe0){_0x5aea5a=_0x5aea5a-0x0;var _0x557a58=_0xe467[_0x5aea5a];return _0x557a58;};'use strict';var multer=require(_0x7e46('0x0'));var util=require('util');var path=require(_0x7e46('0x1'));var timeout=require(_0x7e46('0x2'));var express=require('express');var router=express[_0x7e46('0x3')]();var fs_extra=require(_0x7e46('0x4'));var auth=require(_0x7e46('0x5'));var interaction=require(_0x7e46('0x6'));var config=require(_0x7e46('0x7'));var controller=require(_0x7e46('0x8'));router[_0x7e46('0x9')]('/',auth[_0x7e46('0xa')](),controller[_0x7e46('0xb')]);router[_0x7e46('0x9')]('/describe',auth[_0x7e46('0xa')](),controller[_0x7e46('0xc')]);router[_0x7e46('0x9')](_0x7e46('0xd'),auth['isAuthenticated'](),controller[_0x7e46('0xe')]);router[_0x7e46('0x9')](_0x7e46('0xf'),auth[_0x7e46('0xa')](),controller[_0x7e46('0x10')]);router['post']('/',auth[_0x7e46('0xa')](),controller[_0x7e46('0x11')]);router[_0x7e46('0x12')](_0x7e46('0xf'),auth[_0x7e46('0xa')](),controller[_0x7e46('0x13')]);router[_0x7e46('0x14')](_0x7e46('0xf'),auth[_0x7e46('0xa')](),controller['destroy']);module[_0x7e46('0x15')]=router; \ No newline at end of file +var _0xcd3a=['/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','describe','getVoiceQueuesReport','create','put'];(function(_0x24b959,_0x5a8890){var _0x5644a4=function(_0x700cdb){while(--_0x700cdb){_0x24b959['push'](_0x24b959['shift']());}};_0x5644a4(++_0x5a8890);}(_0xcd3a,0x9c));var _0xacd3=function(_0x3d8466,_0x30f91e){_0x3d8466=_0x3d8466-0x0;var _0x102407=_0xcd3a[_0x3d8466];return _0x102407;};'use strict';var multer=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xacd3('0x2'));var router=express[_0xacd3('0x3')]();var fs_extra=require(_0xacd3('0x4'));var auth=require(_0xacd3('0x5'));var interaction=require(_0xacd3('0x6'));var config=require(_0xacd3('0x7'));var controller=require(_0xacd3('0x8'));router[_0xacd3('0x9')]('/',auth[_0xacd3('0xa')](),controller['index']);router[_0xacd3('0x9')]('/describe',auth[_0xacd3('0xa')](),controller[_0xacd3('0xb')]);router[_0xacd3('0x9')]('/index',auth[_0xacd3('0xa')](),controller[_0xacd3('0xc')]);router[_0xacd3('0x9')]('/:id',auth[_0xacd3('0xa')](),controller['show']);router['post']('/',auth[_0xacd3('0xa')](),controller[_0xacd3('0xd')]);router[_0xacd3('0xe')](_0xacd3('0xf'),auth[_0xacd3('0xa')](),controller[_0xacd3('0x10')]);router[_0xacd3('0x11')](_0xacd3('0xf'),auth[_0xacd3('0xa')](),controller['destroy']);module[_0xacd3('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 030ff87..1098f6c 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 _0xb4f5=['setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xb4f5,0xb6));var _0x5b4f=function(_0x4e4827,_0x4c1947){_0x4e4827=_0x4e4827-0x0;var _0x58d622=_0xb4f5[_0x4e4827];return _0x58d622;};'use strict';var Sequelize=require(_0x5b4f('0x0'));var moment=require(_0x5b4f('0x1'));module[_0x5b4f('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5b4f('0x3')]},'calleridnum':{'type':Sequelize[_0x5b4f('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x5b4f('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5b4f('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5b4f('0x4')],'set':function(_0x569d28){var _0x591f34=moment(_0x569d28);var _0x5bc5d7=moment(this[_0x5b4f('0x5')](_0x5b4f('0x6')))[_0x5b4f('0x7')](_0x5b4f('0x8'));var _0x1c7ec0=_0x591f34[_0x5b4f('0x9')](_0x5bc5d7,'seconds');this[_0x5b4f('0xa')](_0x5b4f('0xb'),_0x569d28);this['setDataValue'](_0x5b4f('0xc'),_0x1c7ec0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5b4f('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5b4f('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5b4f('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x5b4f('0x3')],'comment':_0x5b4f('0xe')},'originalposition':{'type':Sequelize[_0x5b4f('0xf')]},'channel':{'type':Sequelize[_0x5b4f('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5b4f('0x3')]},'accountcode':{'type':Sequelize[_0x5b4f('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5b4f('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x5b4f('0xf')]},'mohtime':{'type':Sequelize[_0x5b4f('0xf')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5b4f('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5b4f('0x3')]},'transfer':{'type':Sequelize[_0x5b4f('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5b4f('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x5b4f('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5b4f('0x3')]},'disposition':{'type':Sequelize[_0x5b4f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x5b4f('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd4a=['INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x51cbec,_0x279f70){var _0x5dde1c=function(_0x110f5e){while(--_0x110f5e){_0x51cbec['push'](_0x51cbec['shift']());}};_0x5dde1c(++_0x279f70);}(_0xfd4a,0x158));var _0xafd4=function(_0x466241,_0x42f815){_0x466241=_0x466241-0x0;var _0x51e0a9=_0xfd4a[_0x466241];return _0x51e0a9;};'use strict';var Sequelize=require(_0xafd4('0x0'));var moment=require(_0xafd4('0x1'));module[_0xafd4('0x2')]={'type':{'type':Sequelize[_0xafd4('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xafd4('0x3')]},'queue':{'type':Sequelize[_0xafd4('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xafd4('0x4')],'set':function(_0x39f71e){var _0x3d1dca=moment(_0x39f71e);var _0xd41b0a=moment(this['getDataValue'](_0xafd4('0x5')))[_0xafd4('0x6')](_0xafd4('0x7'));var _0x464b1e=_0x3d1dca[_0xafd4('0x8')](_0xd41b0a,_0xafd4('0x9'));this[_0xafd4('0xa')](_0xafd4('0xb'),_0x39f71e);this[_0xafd4('0xa')](_0xafd4('0xc'),_0x464b1e||null);}},'position':{'type':Sequelize[_0xafd4('0xd')]},'count':{'type':Sequelize[_0xafd4('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xafd4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xafd4('0x3')],'comment':_0xafd4('0xe')},'originalposition':{'type':Sequelize[_0xafd4('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xafd4('0x3')]},'connectedlinename':{'type':Sequelize[_0xafd4('0x3')]},'accountcode':{'type':Sequelize[_0xafd4('0x3')]},'context':{'type':Sequelize[_0xafd4('0x3')]},'exten':{'type':Sequelize[_0xafd4('0x3')]},'priority':{'type':Sequelize[_0xafd4('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xafd4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xafd4('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xafd4('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xafd4('0x3')],'comment':_0xafd4('0x10')},'transferexten':{'type':Sequelize[_0xafd4('0x3')]},'transferuniqueid':{'type':Sequelize[_0xafd4('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xafd4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xafd4('0xd')],'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 8df1383..a13395d 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 _0x098e=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','params','find','create','body','destroy','describe','getVoiceQueuesReport','findAll','rows','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','then','end','error','name','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x551dc7,_0x395b19){var _0x1df540=function(_0x5a96a3){while(--_0x5a96a3){_0x551dc7['push'](_0x551dc7['shift']());}};_0x1df540(++_0x395b19);}(_0x098e,0x149));var _0xe098=function(_0x1cd483,_0x58be50){_0x1cd483=_0x1cd483-0x0;var _0xa8bc0=_0x098e[_0x1cd483];return _0xa8bc0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe098('0x0'));var jsonpatch=require(_0xe098('0x1'));var rp=require(_0xe098('0x2'));var moment=require(_0xe098('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe098('0x4'));var sox=require(_0xe098('0x5'));var csv=require(_0xe098('0x6'));var ejs=require(_0xe098('0x7'));var fs=require('fs');var fs_extra=require(_0xe098('0x8'));var _=require(_0xe098('0x9'));var squel=require('squel');var crypto=require(_0xe098('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe098('0xb'));var toCsv=require(_0xe098('0x6'));var querystring=require(_0xe098('0xc'));var Papa=require('papaparse');var Redis=require(_0xe098('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe098('0xe'));var as=require(_0xe098('0xf'));var hardwareService=require(_0xe098('0x10'));var logger=require(_0xe098('0x11'))(_0xe098('0x12'));var utils=require('../../config/utils');var config=require(_0xe098('0x13'));var licenseUtil=require(_0xe098('0x14'));var db=require(_0xe098('0x15'))['db'];config[_0xe098('0x16')]=_[_0xe098('0x17')](config[_0xe098('0x16')],{'host':_0xe098('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe098('0x16')]));require(_0xe098('0x19'))[_0xe098('0x1a')](socket);function respondWithStatusCode(_0x14aea1,_0x1f2682){_0x1f2682=_0x1f2682||0xcc;return function(_0x5b7291){if(_0x5b7291){return _0x14aea1[_0xe098('0x1b')](_0x1f2682);}return _0x14aea1[_0xe098('0x1c')](_0x1f2682)['end']();};}function respondWithResult(_0x2e5ef0,_0x2afcfa){_0x2afcfa=_0x2afcfa||0xc8;return function(_0x5f4da3){if(_0x5f4da3){return _0x2e5ef0[_0xe098('0x1c')](_0x2afcfa)[_0xe098('0x1d')](_0x5f4da3);}};}function respondWithFilteredResult(_0x3fe8cd,_0x176e7d){return function(_0x12f608){if(_0x12f608){var _0x1b1c1a=typeof _0x176e7d[_0xe098('0x1e')]===_0xe098('0x1f')&&typeof _0x176e7d['limit']==='undefined';var _0x125f6c=_0x12f608['count'];var _0x39ba93=_0x1b1c1a?0x0:_0x176e7d[_0xe098('0x1e')];var _0x44e1de=_0x1b1c1a?_0x12f608['count']:_0x176e7d[_0xe098('0x1e')]+_0x176e7d[_0xe098('0x20')];var _0x166c5b;if(_0x44e1de>=_0x125f6c){_0x44e1de=_0x125f6c;_0x166c5b=0xc8;}else{_0x166c5b=0xce;}_0x3fe8cd['status'](_0x166c5b);return _0x3fe8cd['set'](_0xe098('0x21'),_0x39ba93+'-'+_0x44e1de+'/'+_0x125f6c)[_0xe098('0x1d')](_0x12f608);}return null;};}function patchUpdates(_0x5c0e86){return function(_0x4b4253){try{jsonpatch[_0xe098('0x22')](_0x4b4253,_0x5c0e86,!![]);}catch(_0x4f11e9){return BPromise[_0xe098('0x23')](_0x4f11e9);}return _0x4b4253[_0xe098('0x24')]();};}function saveUpdates(_0xaba7a5,_0x25754d){return function(_0x2f27ea){if(_0x2f27ea){return _0x2f27ea['update'](_0xaba7a5)[_0xe098('0x25')](function(_0x1c6a94){return _0x1c6a94;});}return null;};}function removeEntity(_0x54c6f8,_0xae767d){return function(_0x470b7b){if(_0x470b7b){return _0x470b7b['destroy']()['then'](function(){_0x54c6f8[_0xe098('0x1c')](0xcc)[_0xe098('0x26')]();});}};}function handleEntityNotFound(_0x5dc3eb,_0x589af0){return function(_0x977ea){if(!_0x977ea){_0x5dc3eb['sendStatus'](0x194);}return _0x977ea;};}function handleError(_0x1af31e,_0x29275f){_0x29275f=_0x29275f||0x1f4;return function(_0x4091fc){logger[_0xe098('0x27')](_0x4091fc['stack']);if(_0x4091fc[_0xe098('0x28')]){delete _0x4091fc[_0xe098('0x28')];}_0x1af31e[_0xe098('0x1c')](_0x29275f)['send'](_0x4091fc);};}exports['index']=function(_0x50c4b3,_0x2dbc29){var _0x56bb80={},_0x46a4d3={},_0x42d288={'count':0x0,'rows':[]};var _0x1e0b59=_[_0xe098('0x29')](db[_0xe098('0x2a')][_0xe098('0x2b')],function(_0x38fdd9){return{'name':_0x38fdd9[_0xe098('0x2c')],'type':_0x38fdd9[_0xe098('0x2d')][_0xe098('0x2e')]};});_0x46a4d3[_0xe098('0x2f')]=_[_0xe098('0x29')](_0x1e0b59,'name');_0x46a4d3[_0xe098('0x30')]=_[_0xe098('0x31')](_0x50c4b3[_0xe098('0x30')]);_0x46a4d3[_0xe098('0x32')]=_[_0xe098('0x33')](_0x46a4d3[_0xe098('0x2f')],_0x46a4d3[_0xe098('0x30')]);_0x56bb80[_0xe098('0x34')]=_[_0xe098('0x33')](_0x46a4d3[_0xe098('0x2f')],qs['fields'](_0x50c4b3['query'][_0xe098('0x35')]));_0x56bb80[_0xe098('0x34')]=_0x56bb80[_0xe098('0x34')][_0xe098('0x36')]?_0x56bb80[_0xe098('0x34')]:_0x46a4d3['model'];if(!_0x50c4b3['query'][_0xe098('0x37')](_0xe098('0x38'))){_0x56bb80[_0xe098('0x20')]=qs[_0xe098('0x20')](_0x50c4b3[_0xe098('0x30')][_0xe098('0x20')]);_0x56bb80[_0xe098('0x1e')]=qs[_0xe098('0x1e')](_0x50c4b3[_0xe098('0x30')][_0xe098('0x1e')]);}_0x56bb80['order']=qs[_0xe098('0x39')](_0x50c4b3[_0xe098('0x30')][_0xe098('0x39')]);_0x56bb80[_0xe098('0x3a')]=qs[_0xe098('0x32')](_[_0xe098('0x3b')](_0x50c4b3['query'],_0x46a4d3[_0xe098('0x32')]),_0x1e0b59);if(_0x50c4b3[_0xe098('0x30')][_0xe098('0x3c')]){_0x56bb80[_0xe098('0x3a')]=_[_0xe098('0x3d')](_0x56bb80[_0xe098('0x3a')],{'$or':_[_0xe098('0x29')](_0x1e0b59,function(_0x161e18){if(_0x161e18[_0xe098('0x2d')]!==_0xe098('0x3e')){var _0x5bb0d8={};_0x5bb0d8[_0x161e18[_0xe098('0x28')]]={'$like':'%'+_0x50c4b3[_0xe098('0x30')][_0xe098('0x3c')]+'%'};return _0x5bb0d8;}})});}_0x56bb80=_[_0xe098('0x3d')]({},_0x56bb80,_0x50c4b3[_0xe098('0x3f')]);var _0x4d900a={'where':_0x56bb80[_0xe098('0x3a')]};return db['VoiceQueueReport'][_0xe098('0x40')](_0x4d900a)[_0xe098('0x25')](function(_0x1fdb12){_0x42d288[_0xe098('0x40')]=_0x1fdb12;if(_0x50c4b3['query'][_0xe098('0x41')]){_0x56bb80[_0xe098('0x42')]=[{'all':!![]}];}return db[_0xe098('0x2a')]['findAll'](_0x56bb80);})[_0xe098('0x25')](function(_0x2af55a){_0x42d288['rows']=_0x2af55a;return _0x42d288;})[_0xe098('0x25')](respondWithFilteredResult(_0x2dbc29,_0x56bb80))[_0xe098('0x43')](handleError(_0x2dbc29,null));};exports['show']=function(_0x4d31fa,_0x592faa){var _0x196125={'raw':![],'where':{'id':_0x4d31fa[_0xe098('0x44')]['id']}},_0x51ee5d={};_0x51ee5d[_0xe098('0x2f')]=_[_0xe098('0x31')](db['VoiceQueueReport'][_0xe098('0x2b')]);_0x51ee5d[_0xe098('0x30')]=_[_0xe098('0x31')](_0x4d31fa[_0xe098('0x30')]);_0x51ee5d[_0xe098('0x32')]=_['intersection'](_0x51ee5d[_0xe098('0x2f')],_0x51ee5d[_0xe098('0x30')]);_0x196125[_0xe098('0x34')]=_[_0xe098('0x33')](_0x51ee5d['model'],qs[_0xe098('0x35')](_0x4d31fa[_0xe098('0x30')][_0xe098('0x35')]));_0x196125['attributes']=_0x196125[_0xe098('0x34')][_0xe098('0x36')]?_0x196125[_0xe098('0x34')]:_0x51ee5d['model'];if(_0x4d31fa[_0xe098('0x30')][_0xe098('0x41')]){_0x196125[_0xe098('0x42')]=[{'all':!![]}];}_0x196125=_[_0xe098('0x3d')]({},_0x196125,_0x4d31fa[_0xe098('0x3f')]);return db[_0xe098('0x2a')][_0xe098('0x45')](_0x196125)[_0xe098('0x25')](handleEntityNotFound(_0x592faa,null))[_0xe098('0x25')](respondWithResult(_0x592faa,null))[_0xe098('0x43')](handleError(_0x592faa,null));};exports[_0xe098('0x46')]=function(_0x3ce941,_0x126de2){return db[_0xe098('0x2a')]['create'](_0x3ce941['body'],{})[_0xe098('0x25')](respondWithResult(_0x126de2,0xc9))[_0xe098('0x43')](handleError(_0x126de2,null));};exports['update']=function(_0x459b29,_0x352581){if(_0x459b29['body']['id']){delete _0x459b29[_0xe098('0x47')]['id'];}return db['VoiceQueueReport'][_0xe098('0x45')]({'where':{'id':_0x459b29[_0xe098('0x44')]['id']}})[_0xe098('0x25')](handleEntityNotFound(_0x352581,null))[_0xe098('0x25')](saveUpdates(_0x459b29['body'],null))[_0xe098('0x25')](respondWithResult(_0x352581,null))[_0xe098('0x43')](handleError(_0x352581,null));};exports[_0xe098('0x48')]=function(_0x3db7a0,_0x5f4f6e){return db[_0xe098('0x2a')][_0xe098('0x45')]({'where':{'id':_0x3db7a0['params']['id']}})[_0xe098('0x25')](handleEntityNotFound(_0x5f4f6e,null))['then'](removeEntity(_0x5f4f6e,null))[_0xe098('0x43')](handleError(_0x5f4f6e,null));};exports[_0xe098('0x49')]=function(_0x2798ef,_0x3042dd){return db[_0xe098('0x2a')]['describe']()[_0xe098('0x25')](respondWithResult(_0x3042dd,null))[_0xe098('0x43')](handleError(_0x3042dd,null));};exports[_0xe098('0x4a')]=function(_0x3216e4,_0x4a06fe){var _0xebd3eb={},_0x5b0133={},_0x367880={'count':0x0,'rows':[]};_0x5b0133['model']=_[_0xe098('0x31')](db[_0xe098('0x2a')][_0xe098('0x2b')]);_0x5b0133[_0xe098('0x30')]=_['keys'](_0x3216e4[_0xe098('0x30')]);_0x5b0133['filters']=_[_0xe098('0x33')](_0x5b0133[_0xe098('0x2f')],_0x5b0133[_0xe098('0x30')]);_0xebd3eb[_0xe098('0x34')]=_['intersection'](_0x5b0133[_0xe098('0x2f')],qs[_0xe098('0x35')](_0x3216e4[_0xe098('0x30')][_0xe098('0x35')]));_0xebd3eb[_0xe098('0x34')]=_0xebd3eb[_0xe098('0x34')][_0xe098('0x36')]?_0xebd3eb[_0xe098('0x34')]:_0x5b0133[_0xe098('0x2f')];if(!_0x3216e4[_0xe098('0x30')]['hasOwnProperty']('nolimit')){_0xebd3eb['limit']=qs[_0xe098('0x20')](_0x3216e4[_0xe098('0x30')][_0xe098('0x20')]);_0xebd3eb[_0xe098('0x1e')]=qs[_0xe098('0x1e')](_0x3216e4['query'][_0xe098('0x1e')]);}_0xebd3eb['order']=qs[_0xe098('0x39')](_0x3216e4[_0xe098('0x30')][_0xe098('0x39')]);_0xebd3eb['where']=qs[_0xe098('0x32')](_[_0xe098('0x3b')](_0x3216e4[_0xe098('0x30')],_0x5b0133[_0xe098('0x32')]));if(_0x3216e4[_0xe098('0x30')][_0xe098('0x3c')]){_0xebd3eb[_0xe098('0x3a')]=_['merge'](_0xebd3eb[_0xe098('0x3a')],{'$or':_['map'](_0xebd3eb[_0xe098('0x34')],function(_0x44b3ec){var _0x1998da={};_0x1998da[_0x44b3ec]={'$like':'%'+_0x3216e4[_0xe098('0x30')][_0xe098('0x3c')]+'%'};return _0x1998da;})});}_0xebd3eb=_[_0xe098('0x3d')]({},_0xebd3eb,_0x3216e4[_0xe098('0x3f')]);var _0x443744={'where':_0xebd3eb['where']};return db[_0xe098('0x2a')][_0xe098('0x40')](_0x443744)[_0xe098('0x25')](function(_0x1a1afe){_0x367880[_0xe098('0x40')]=_0x1a1afe;if(_0x3216e4[_0xe098('0x30')]['includeAll']){_0xebd3eb[_0xe098('0x42')]=[{'all':!![]}];}return db[_0xe098('0x2a')][_0xe098('0x4b')](_0xebd3eb);})[_0xe098('0x25')](function(_0x3239c8){_0x367880[_0xe098('0x4c')]=_0x3239c8;return _0x367880;})[_0xe098('0x25')](respondWithFilteredResult(_0x4a06fe,_0xebd3eb,'getVoiceQueuesReport'))[_0xe098('0x43')](handleError(_0x4a06fe,null,_0xe098('0x4a')));}; \ No newline at end of file +var _0x3b2b=['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','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','destroy','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','VoiceQueueReport','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','options','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x19d1e1,_0x123555){var _0x4bfa93=function(_0x10daac){while(--_0x10daac){_0x19d1e1['push'](_0x19d1e1['shift']());}};_0x4bfa93(++_0x123555);}(_0x3b2b,0x136));var _0xb3b2=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x3b2b[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0xb3b2('0x0'));var rimraf=require(_0xb3b2('0x1'));var zipdir=require(_0xb3b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3b2('0x3'));var moment=require(_0xb3b2('0x4'));var BPromise=require(_0xb3b2('0x5'));var Mustache=require('mustache');var util=require(_0xb3b2('0x6'));var path=require('path');var sox=require(_0xb3b2('0x7'));var csv=require('to-csv');var ejs=require(_0xb3b2('0x8'));var fs=require('fs');var fs_extra=require(_0xb3b2('0x9'));var _=require(_0xb3b2('0xa'));var squel=require(_0xb3b2('0xb'));var crypto=require(_0xb3b2('0xc'));var jsforce=require(_0xb3b2('0xd'));var deskjs=require(_0xb3b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb3b2('0xf'));var Papa=require(_0xb3b2('0x10'));var Redis=require(_0xb3b2('0x11'));var authService=require(_0xb3b2('0x12'));var qs=require(_0xb3b2('0x13'));var as=require(_0xb3b2('0x14'));var hardwareService=require(_0xb3b2('0x15'));var logger=require(_0xb3b2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb3b2('0x17'));var licenseUtil=require(_0xb3b2('0x18'));var db=require(_0xb3b2('0x19'))['db'];config[_0xb3b2('0x1a')]=_['defaults'](config[_0xb3b2('0x1a')],{'host':_0xb3b2('0x1b'),'port':0x18eb});var socket=require(_0xb3b2('0x1c'))(new Redis(config[_0xb3b2('0x1a')]));require(_0xb3b2('0x1d'))['register'](socket);function respondWithStatusCode(_0x50db1b,_0x228db2){_0x228db2=_0x228db2||0xcc;return function(_0x407e07){if(_0x407e07){return _0x50db1b[_0xb3b2('0x1e')](_0x228db2);}return _0x50db1b[_0xb3b2('0x1f')](_0x228db2)[_0xb3b2('0x20')]();};}function respondWithResult(_0x2791fa,_0x29d194){_0x29d194=_0x29d194||0xc8;return function(_0x34c503){if(_0x34c503){return _0x2791fa[_0xb3b2('0x1f')](_0x29d194)[_0xb3b2('0x21')](_0x34c503);}};}function respondWithFilteredResult(_0x43bca3,_0x1ee1b4){return function(_0x2254bd){if(_0x2254bd){var _0x34f3eb=typeof _0x1ee1b4[_0xb3b2('0x22')]==='undefined'&&typeof _0x1ee1b4['limit']===_0xb3b2('0x23');var _0x3e927a=_0x2254bd[_0xb3b2('0x24')];var _0x51632b=_0x34f3eb?0x0:_0x1ee1b4[_0xb3b2('0x22')];var _0x367d58=_0x34f3eb?_0x2254bd[_0xb3b2('0x24')]:_0x1ee1b4[_0xb3b2('0x22')]+_0x1ee1b4[_0xb3b2('0x25')];var _0x2e50c9;if(_0x367d58>=_0x3e927a){_0x367d58=_0x3e927a;_0x2e50c9=0xc8;}else{_0x2e50c9=0xce;}_0x43bca3['status'](_0x2e50c9);return _0x43bca3[_0xb3b2('0x26')](_0xb3b2('0x27'),_0x51632b+'-'+_0x367d58+'/'+_0x3e927a)[_0xb3b2('0x21')](_0x2254bd);}return null;};}function patchUpdates(_0xd37241){return function(_0x404bd1){try{jsonpatch['apply'](_0x404bd1,_0xd37241,!![]);}catch(_0x190996){return BPromise['reject'](_0x190996);}return _0x404bd1[_0xb3b2('0x28')]();};}function saveUpdates(_0x32b52c,_0x25dd59){return function(_0xd9f470){if(_0xd9f470){return _0xd9f470['update'](_0x32b52c)['then'](function(_0x212dfb){return _0x212dfb;});}return null;};}function removeEntity(_0x31ae68,_0x328f41){return function(_0x29eb77){if(_0x29eb77){return _0x29eb77[_0xb3b2('0x29')]()['then'](function(){_0x31ae68[_0xb3b2('0x1f')](0xcc)[_0xb3b2('0x20')]();});}};}function handleEntityNotFound(_0x2b5b9e,_0x2f633a){return function(_0x6a9ef1){if(!_0x6a9ef1){_0x2b5b9e[_0xb3b2('0x1e')](0x194);}return _0x6a9ef1;};}function handleError(_0x28821e,_0x102951){_0x102951=_0x102951||0x1f4;return function(_0x559bcc){logger['error'](_0x559bcc[_0xb3b2('0x2a')]);if(_0x559bcc[_0xb3b2('0x2b')]){delete _0x559bcc[_0xb3b2('0x2b')];}_0x28821e['status'](_0x102951)[_0xb3b2('0x2c')](_0x559bcc);};}exports[_0xb3b2('0x2d')]=function(_0x546f57,_0x3b3fab){var _0x419395={},_0x44a28d={},_0x216499={'count':0x0,'rows':[]};var _0x234be8=_[_0xb3b2('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x52dbc2){return{'name':_0x52dbc2['fieldName'],'type':_0x52dbc2[_0xb3b2('0x2f')][_0xb3b2('0x30')]};});_0x44a28d[_0xb3b2('0x31')]=_[_0xb3b2('0x2e')](_0x234be8,_0xb3b2('0x2b'));_0x44a28d[_0xb3b2('0x32')]=_['keys'](_0x546f57[_0xb3b2('0x32')]);_0x44a28d[_0xb3b2('0x33')]=_[_0xb3b2('0x34')](_0x44a28d[_0xb3b2('0x31')],_0x44a28d[_0xb3b2('0x32')]);_0x419395[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x44a28d[_0xb3b2('0x31')],qs['fields'](_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x419395[_0xb3b2('0x35')]=_0x419395[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x419395['attributes']:_0x44a28d[_0xb3b2('0x31')];if(!_0x546f57[_0xb3b2('0x32')]['hasOwnProperty'](_0xb3b2('0x38'))){_0x419395[_0xb3b2('0x25')]=qs['limit'](_0x546f57[_0xb3b2('0x32')]['limit']);_0x419395[_0xb3b2('0x22')]=qs['offset'](_0x546f57['query'][_0xb3b2('0x22')]);}_0x419395[_0xb3b2('0x39')]=qs[_0xb3b2('0x3a')](_0x546f57['query'][_0xb3b2('0x3a')]);_0x419395[_0xb3b2('0x3b')]=qs[_0xb3b2('0x33')](_[_0xb3b2('0x3c')](_0x546f57[_0xb3b2('0x32')],_0x44a28d['filters']),_0x234be8);if(_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x3d')]){_0x419395[_0xb3b2('0x3b')]=_[_0xb3b2('0x3e')](_0x419395[_0xb3b2('0x3b')],{'$or':_[_0xb3b2('0x2e')](_0x234be8,function(_0x57a59c){if(_0x57a59c[_0xb3b2('0x2f')]!==_0xb3b2('0x3f')){var _0x229822={};_0x229822[_0x57a59c[_0xb3b2('0x2b')]]={'$like':'%'+_0x546f57[_0xb3b2('0x32')][_0xb3b2('0x3d')]+'%'};return _0x229822;}})});}_0x419395=_[_0xb3b2('0x3e')]({},_0x419395,_0x546f57['options']);var _0x39169d={'where':_0x419395[_0xb3b2('0x3b')]};return db['VoiceQueueReport'][_0xb3b2('0x24')](_0x39169d)[_0xb3b2('0x40')](function(_0x56af69){_0x216499['count']=_0x56af69;if(_0x546f57[_0xb3b2('0x32')]['includeAll']){_0x419395[_0xb3b2('0x41')]=[{'all':!![]}];}return db[_0xb3b2('0x42')][_0xb3b2('0x43')](_0x419395);})[_0xb3b2('0x40')](function(_0x3e9a2a){_0x216499[_0xb3b2('0x44')]=_0x3e9a2a;return _0x216499;})[_0xb3b2('0x40')](respondWithFilteredResult(_0x3b3fab,_0x419395))[_0xb3b2('0x45')](handleError(_0x3b3fab,null));};exports[_0xb3b2('0x46')]=function(_0x18901f,_0x3ba67b){var _0x30e1ee={'raw':![],'where':{'id':_0x18901f[_0xb3b2('0x47')]['id']}},_0x50f814={};_0x50f814[_0xb3b2('0x31')]=_[_0xb3b2('0x48')](db[_0xb3b2('0x42')][_0xb3b2('0x49')]);_0x50f814[_0xb3b2('0x32')]=_[_0xb3b2('0x48')](_0x18901f[_0xb3b2('0x32')]);_0x50f814['filters']=_[_0xb3b2('0x34')](_0x50f814[_0xb3b2('0x31')],_0x50f814[_0xb3b2('0x32')]);_0x30e1ee[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x50f814[_0xb3b2('0x31')],qs[_0xb3b2('0x36')](_0x18901f[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x30e1ee[_0xb3b2('0x35')]=_0x30e1ee[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x30e1ee[_0xb3b2('0x35')]:_0x50f814[_0xb3b2('0x31')];if(_0x18901f[_0xb3b2('0x32')]['includeAll']){_0x30e1ee[_0xb3b2('0x41')]=[{'all':!![]}];}_0x30e1ee=_['merge']({},_0x30e1ee,_0x18901f['options']);return db['VoiceQueueReport'][_0xb3b2('0x4a')](_0x30e1ee)['then'](handleEntityNotFound(_0x3ba67b,null))[_0xb3b2('0x40')](respondWithResult(_0x3ba67b,null))[_0xb3b2('0x45')](handleError(_0x3ba67b,null));};exports[_0xb3b2('0x4b')]=function(_0x3b9d47,_0x4fccfe){return db[_0xb3b2('0x42')][_0xb3b2('0x4b')](_0x3b9d47['body'],{})[_0xb3b2('0x40')](respondWithResult(_0x4fccfe,0xc9))[_0xb3b2('0x45')](handleError(_0x4fccfe,null));};exports['update']=function(_0x43803c,_0x19a82e){if(_0x43803c[_0xb3b2('0x4c')]['id']){delete _0x43803c[_0xb3b2('0x4c')]['id'];}return db['VoiceQueueReport'][_0xb3b2('0x4a')]({'where':{'id':_0x43803c[_0xb3b2('0x47')]['id']}})[_0xb3b2('0x40')](handleEntityNotFound(_0x19a82e,null))[_0xb3b2('0x40')](saveUpdates(_0x43803c['body'],null))[_0xb3b2('0x40')](respondWithResult(_0x19a82e,null))[_0xb3b2('0x45')](handleError(_0x19a82e,null));};exports[_0xb3b2('0x29')]=function(_0x1a6cff,_0x275ee4){return db['VoiceQueueReport'][_0xb3b2('0x4a')]({'where':{'id':_0x1a6cff[_0xb3b2('0x47')]['id']}})[_0xb3b2('0x40')](handleEntityNotFound(_0x275ee4,null))[_0xb3b2('0x40')](removeEntity(_0x275ee4,null))[_0xb3b2('0x45')](handleError(_0x275ee4,null));};exports['describe']=function(_0x207257,_0x2af88f){return db['VoiceQueueReport'][_0xb3b2('0x4d')]()['then'](respondWithResult(_0x2af88f,null))[_0xb3b2('0x45')](handleError(_0x2af88f,null));};exports[_0xb3b2('0x4e')]=function(_0x96ff72,_0x58f5c8){var _0x15da35={},_0x4be87d={},_0x20c421={'count':0x0,'rows':[]};_0x4be87d[_0xb3b2('0x31')]=_[_0xb3b2('0x48')](db[_0xb3b2('0x42')][_0xb3b2('0x49')]);_0x4be87d[_0xb3b2('0x32')]=_[_0xb3b2('0x48')](_0x96ff72[_0xb3b2('0x32')]);_0x4be87d[_0xb3b2('0x33')]=_[_0xb3b2('0x34')](_0x4be87d[_0xb3b2('0x31')],_0x4be87d['query']);_0x15da35[_0xb3b2('0x35')]=_[_0xb3b2('0x34')](_0x4be87d[_0xb3b2('0x31')],qs[_0xb3b2('0x36')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x36')]));_0x15da35[_0xb3b2('0x35')]=_0x15da35[_0xb3b2('0x35')][_0xb3b2('0x37')]?_0x15da35[_0xb3b2('0x35')]:_0x4be87d['model'];if(!_0x96ff72['query'][_0xb3b2('0x4f')](_0xb3b2('0x38'))){_0x15da35['limit']=qs[_0xb3b2('0x25')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x25')]);_0x15da35[_0xb3b2('0x22')]=qs[_0xb3b2('0x22')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x22')]);}_0x15da35[_0xb3b2('0x39')]=qs[_0xb3b2('0x3a')](_0x96ff72[_0xb3b2('0x32')][_0xb3b2('0x3a')]);_0x15da35['where']=qs[_0xb3b2('0x33')](_['pick'](_0x96ff72[_0xb3b2('0x32')],_0x4be87d[_0xb3b2('0x33')]));if(_0x96ff72['query'][_0xb3b2('0x3d')]){_0x15da35[_0xb3b2('0x3b')]=_[_0xb3b2('0x3e')](_0x15da35['where'],{'$or':_['map'](_0x15da35['attributes'],function(_0x594ede){var _0x4149dc={};_0x4149dc[_0x594ede]={'$like':'%'+_0x96ff72[_0xb3b2('0x32')]['filter']+'%'};return _0x4149dc;})});}_0x15da35=_[_0xb3b2('0x3e')]({},_0x15da35,_0x96ff72[_0xb3b2('0x50')]);var _0xb83744={'where':_0x15da35[_0xb3b2('0x3b')]};return db[_0xb3b2('0x42')][_0xb3b2('0x24')](_0xb83744)[_0xb3b2('0x40')](function(_0x41f2db){_0x20c421[_0xb3b2('0x24')]=_0x41f2db;if(_0x96ff72[_0xb3b2('0x32')]['includeAll']){_0x15da35['include']=[{'all':!![]}];}return db[_0xb3b2('0x42')][_0xb3b2('0x43')](_0x15da35);})['then'](function(_0x4b9826){_0x20c421[_0xb3b2('0x44')]=_0x4b9826;return _0x20c421;})['then'](respondWithFilteredResult(_0x58f5c8,_0x15da35,'getVoiceQueuesReport'))[_0xb3b2('0x45')](handleError(_0x58f5c8,null,_0xb3b2('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6881fd2..12434cc 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 _0x5e92=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5e92,0xda));var _0x25e9=function(_0x1b8020,_0x1c55c0){_0x1b8020=_0x1b8020-0x0;var _0x59aa91=_0x5e92[_0x1b8020];return _0x59aa91;};'use strict';var EventEmitter=require(_0x25e9('0x0'));var VoiceQueueReport=require(_0x25e9('0x1'))['db'][_0x25e9('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x25e9('0x3')](0x0);var events={'afterCreate':_0x25e9('0x4'),'afterUpdate':_0x25e9('0x5'),'afterDestroy':_0x25e9('0x6')};function emitEvent(_0x4ff86a){return function(_0x256cb7,_0x4d9548,_0x5708d3){VoiceQueueReportEvents[_0x25e9('0x7')](_0x4ff86a+':'+_0x256cb7['id'],_0x256cb7);VoiceQueueReportEvents[_0x25e9('0x7')](_0x4ff86a,_0x256cb7);_0x5708d3(null);};}for(var e in events){if(events[_0x25e9('0x8')](e)){var event=events[e];VoiceQueueReport[_0x25e9('0x9')](e,emitEvent(event));}}module[_0x25e9('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xc864=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x34d57c,_0x114150){var _0x2b01ad=function(_0xd77311){while(--_0xd77311){_0x34d57c['push'](_0x34d57c['shift']());}};_0x2b01ad(++_0x114150);}(_0xc864,0x1a6));var _0x4c86=function(_0xc62010,_0x18db7d){_0xc62010=_0xc62010-0x0;var _0x5777bf=_0xc864[_0xc62010];return _0x5777bf;};'use strict';var EventEmitter=require(_0x4c86('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x4c86('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x4c86('0x2')](0x0);var events={'afterCreate':_0x4c86('0x3'),'afterUpdate':_0x4c86('0x4'),'afterDestroy':_0x4c86('0x5')};function emitEvent(_0x57620d){return function(_0x103bf7,_0x277834,_0x239172){VoiceQueueReportEvents[_0x4c86('0x6')](_0x57620d+':'+_0x103bf7['id'],_0x103bf7);VoiceQueueReportEvents['emit'](_0x57620d,_0x103bf7);_0x239172(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x4c86('0x7')](e,emitEvent(event));}}module[_0x4c86('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 47dfac8..dad5713 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 _0x98b5=['path','../../config/environment','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','request-promise'];(function(_0x908e8c,_0x2da11c){var _0x930a4d=function(_0x18d4d0){while(--_0x18d4d0){_0x908e8c['push'](_0x908e8c['shift']());}};_0x930a4d(++_0x2da11c);}(_0x98b5,0x98));var _0x598b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x98b5[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x598b('0x0'));var logger=require('../../config/logger')(_0x598b('0x1'));var moment=require(_0x598b('0x2'));var BPromise=require('bluebird');var rp=require(_0x598b('0x3'));var fs=require('fs');var path=require(_0x598b('0x4'));var rimraf=require('rimraf');var config=require(_0x598b('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0x598b('0x6')]=function(_0x569351,_0x14cf6f){return _0x569351[_0x598b('0x7')](_0x598b('0x8'),attributes,{'tableName':_0x598b('0x9'),'paranoid':![],'indexes':[{'fields':[_0x598b('0xa')]},{'fields':[_0x598b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc616=['uniqueid','util','../../config/logger','request-promise','rimraf','./voiceQueueReport.attributes','exports','define'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xc616,0x1f1));var _0x6c61=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0xc616[_0x31080a];return _0x58d2fc;};'use strict';var _=require('lodash');var util=require(_0x6c61('0x0'));var logger=require(_0x6c61('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6c61('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c61('0x3'));var config=require('../../config/environment');var attributes=require(_0x6c61('0x4'));module[_0x6c61('0x5')]=function(_0x1a9e70,_0x21cd39){return _0x1a9e70[_0x6c61('0x6')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x6c61('0x7')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ceecec2..4477c4a 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 _0xf7bf=['VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','then','update','body','UpdateVoiceQueueReport','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x6b695f,_0x1607cf){var _0x39536a=function(_0x542d5a){while(--_0x542d5a){_0x6b695f['push'](_0x6b695f['shift']());}};_0x39536a(++_0x1607cf);}(_0xf7bf,0x18a));var _0xff7b=function(_0x507c6e,_0x5b7703){_0x507c6e=_0x507c6e-0x0;var _0x236242=_0xf7bf[_0x507c6e];return _0x236242;};'use strict';var _=require('lodash');var util=require(_0xff7b('0x0'));var moment=require(_0xff7b('0x1'));var BPromise=require(_0xff7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff7b('0x4'))(_0xff7b('0x5'));var config=require(_0xff7b('0x6'));var jayson=require(_0xff7b('0x7'));var client=jayson[_0xff7b('0x8')][_0xff7b('0x9')]({'port':0x232a});config[_0xff7b('0xa')]=_['defaults'](config[_0xff7b('0xa')],{'host':_0xff7b('0xb'),'port':0x18eb});var socket=require(_0xff7b('0xc'))(new Redis(config[_0xff7b('0xa')]));require('./voiceQueueReport.socket')[_0xff7b('0xd')](socket);function respondWithRpcPromise(_0x5792a9,_0x373219,_0x1f941d){return new BPromise(function(_0x2b4c07,_0x25835d){return client[_0xff7b('0xe')](_0x5792a9,_0x1f941d)['then'](function(_0x4dc1fe){logger[_0xff7b('0xf')](_0xff7b('0x10'),_0x373219,_0xff7b('0x11'));logger[_0xff7b('0x12')](_0xff7b('0x13'),_0x373219,_0xff7b('0x11'),JSON[_0xff7b('0x14')](_0x4dc1fe));if(_0x4dc1fe[_0xff7b('0x15')]){if(_0x4dc1fe[_0xff7b('0x15')][_0xff7b('0x16')]===0x1f4){logger[_0xff7b('0x15')](_0xff7b('0x10'),_0x373219,_0x4dc1fe[_0xff7b('0x15')][_0xff7b('0x17')]);return _0x25835d(_0x4dc1fe['error'][_0xff7b('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x373219,_0x4dc1fe[_0xff7b('0x15')]['message']);return _0x2b4c07(_0x4dc1fe['error'][_0xff7b('0x17')]);}else{logger[_0xff7b('0xf')](_0xff7b('0x10'),_0x373219,_0xff7b('0x11'));_0x2b4c07(_0x4dc1fe[_0xff7b('0x18')][_0xff7b('0x17')]);}})[_0xff7b('0x19')](function(_0x15083a){logger[_0xff7b('0x15')](_0xff7b('0x10'),_0x373219,_0x15083a);_0x25835d(_0x15083a);});});}exports['GetVoiceQueueReport']=function(_0x24f11d){var _0x274f3a=this;return new Promise(function(_0x2a190d,_0x361d0d){return db[_0xff7b('0x1a')][_0xff7b('0x1b')]({'raw':_0x24f11d[_0xff7b('0x1c')]?_0x24f11d['options'][_0xff7b('0x1d')]===undefined?!![]:![]:!![],'where':_0x24f11d[_0xff7b('0x1c')]?_0x24f11d[_0xff7b('0x1c')][_0xff7b('0x1e')]||null:null,'attributes':_0x24f11d[_0xff7b('0x1c')]?_0x24f11d[_0xff7b('0x1c')][_0xff7b('0x1f')]||null:null,'limit':_0x24f11d[_0xff7b('0x1c')]?_0x24f11d[_0xff7b('0x1c')][_0xff7b('0x20')]||null:null,'include':_0x24f11d[_0xff7b('0x1c')]?_0x24f11d[_0xff7b('0x1c')][_0xff7b('0x21')]?_[_0xff7b('0x22')](_0x24f11d[_0xff7b('0x1c')][_0xff7b('0x21')],function(_0x4e3c4c){return{'model':db[_0x4e3c4c['model']],'as':_0x4e3c4c['as'],'attributes':_0x4e3c4c[_0xff7b('0x1f')],'include':_0x4e3c4c['include']?_[_0xff7b('0x22')](_0x4e3c4c[_0xff7b('0x21')],function(_0x41217c){return{'model':db[_0x41217c[_0xff7b('0x23')]],'as':_0x41217c['as'],'attributes':_0x41217c[_0xff7b('0x1f')],'include':_0x41217c[_0xff7b('0x21')]?_[_0xff7b('0x22')](_0x41217c[_0xff7b('0x21')],function(_0x3206bf){return{'model':db[_0x3206bf[_0xff7b('0x23')]],'as':_0x3206bf['as'],'attributes':_0x3206bf[_0xff7b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2672fa){logger[_0xff7b('0xf')](_0xff7b('0x24'),_0x24f11d);logger[_0xff7b('0x12')](_0xff7b('0x24'),_0x24f11d,JSON[_0xff7b('0x14')](_0x2672fa));_0x2a190d(_0x2672fa);})[_0xff7b('0x19')](function(_0x432e72){logger[_0xff7b('0x15')]('GetVoiceQueueReport',_0x432e72[_0xff7b('0x17')],_0x24f11d);_0x361d0d(_0x274f3a[_0xff7b('0x15')](0x1f4,_0x432e72[_0xff7b('0x17')]));});});};exports[_0xff7b('0x25')]=function(_0x2abb90){var _0x1f683e=this;return new Promise(function(_0x3bb525,_0x477b95){return db[_0xff7b('0x1a')]['create'](_0x2abb90['body'],{'raw':_0x2abb90['options']?_0x2abb90[_0xff7b('0x1c')][_0xff7b('0x1d')]===undefined?!![]:![]:!![]})[_0xff7b('0x26')](function(_0x451ce5){logger['info'](_0xff7b('0x25'),_0x2abb90);logger[_0xff7b('0x12')]('CreateVoiceQueueReport',_0x2abb90,JSON[_0xff7b('0x14')](_0x451ce5));_0x3bb525(_0x451ce5);})[_0xff7b('0x19')](function(_0x47bb67){logger[_0xff7b('0x15')](_0xff7b('0x25'),_0x47bb67[_0xff7b('0x17')],_0x2abb90);_0x477b95(_0x1f683e[_0xff7b('0x15')](0x1f4,_0x47bb67[_0xff7b('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x22a5e4){var _0x12bedd=this;return new Promise(function(_0x10c401,_0x22414b){return db[_0xff7b('0x1a')][_0xff7b('0x27')](_0x22a5e4[_0xff7b('0x28')],{'raw':_0x22a5e4[_0xff7b('0x1c')]?_0x22a5e4[_0xff7b('0x1c')][_0xff7b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22a5e4['options']?_0x22a5e4['options'][_0xff7b('0x1e')]||null:null,'attributes':_0x22a5e4['options']?_0x22a5e4[_0xff7b('0x1c')]['attributes']||null:null,'limit':_0x22a5e4['options']?_0x22a5e4['options']['limit']||null:null})[_0xff7b('0x26')](function(_0x3da371){logger[_0xff7b('0xf')]('UpdateVoiceQueueReport',_0x22a5e4);logger['debug'](_0xff7b('0x29'),_0x22a5e4,JSON['stringify'](_0x3da371));_0x10c401(_0x3da371);})[_0xff7b('0x19')](function(_0x1b0696){logger[_0xff7b('0x15')](_0xff7b('0x29'),_0x1b0696['message'],_0x22a5e4);_0x22414b(_0x12bedd['error'](0x1f4,_0x1b0696[_0xff7b('0x17')]));});});}; \ No newline at end of file +var _0x4802=['socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','debug','catch','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x4802,0xef));var _0x2480=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4802[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2480('0x0'));var BPromise=require(_0x2480('0x1'));var rs=require(_0x2480('0x2'));var fs=require('fs');var Redis=require(_0x2480('0x3'));var db=require(_0x2480('0x4'))['db'];var utils=require(_0x2480('0x5'));var logger=require(_0x2480('0x6'))(_0x2480('0x7'));var config=require(_0x2480('0x8'));var jayson=require(_0x2480('0x9'));var client=jayson[_0x2480('0xa')][_0x2480('0xb')]({'port':0x232a});config[_0x2480('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2480('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x2480('0xe')](socket);function respondWithRpcPromise(_0x399466,_0x21fb19,_0x4cbe13){return new BPromise(function(_0xc3492b,_0x3d47a3){return client['request'](_0x399466,_0x4cbe13)[_0x2480('0xf')](function(_0x5b9be3){logger[_0x2480('0x10')](_0x2480('0x11'),_0x21fb19,'request\x20sent');logger['debug'](_0x2480('0x12'),_0x21fb19,_0x2480('0x13'),JSON[_0x2480('0x14')](_0x5b9be3));if(_0x5b9be3[_0x2480('0x15')]){if(_0x5b9be3[_0x2480('0x15')][_0x2480('0x16')]===0x1f4){logger[_0x2480('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x21fb19,_0x5b9be3[_0x2480('0x15')]['message']);return _0x3d47a3(_0x5b9be3[_0x2480('0x15')][_0x2480('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x21fb19,_0x5b9be3[_0x2480('0x15')]['message']);return _0xc3492b(_0x5b9be3['error']['message']);}else{logger[_0x2480('0x10')](_0x2480('0x11'),_0x21fb19,_0x2480('0x13'));_0xc3492b(_0x5b9be3[_0x2480('0x18')]['message']);}})['catch'](function(_0x50a0cb){logger['error'](_0x2480('0x11'),_0x21fb19,_0x50a0cb);_0x3d47a3(_0x50a0cb);});});}exports[_0x2480('0x19')]=function(_0x5a460a){var _0x37aff6=this;return new Promise(function(_0x346163,_0x164c97){return db[_0x2480('0x1a')]['findAll']({'raw':_0x5a460a[_0x2480('0x1b')]?_0x5a460a['options'][_0x2480('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1d')]||null:null,'attributes':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1e')]||null:null,'limit':_0x5a460a[_0x2480('0x1b')]?_0x5a460a[_0x2480('0x1b')][_0x2480('0x1f')]||null:null,'include':_0x5a460a['options']?_0x5a460a[_0x2480('0x1b')][_0x2480('0x20')]?_[_0x2480('0x21')](_0x5a460a[_0x2480('0x1b')][_0x2480('0x20')],function(_0x3375f3){return{'model':db[_0x3375f3[_0x2480('0x22')]],'as':_0x3375f3['as'],'attributes':_0x3375f3[_0x2480('0x1e')],'include':_0x3375f3[_0x2480('0x20')]?_[_0x2480('0x21')](_0x3375f3['include'],function(_0x316182){return{'model':db[_0x316182[_0x2480('0x22')]],'as':_0x316182['as'],'attributes':_0x316182['attributes'],'include':_0x316182[_0x2480('0x20')]?_[_0x2480('0x21')](_0x316182[_0x2480('0x20')],function(_0x494636){return{'model':db[_0x494636[_0x2480('0x22')]],'as':_0x494636['as'],'attributes':_0x494636[_0x2480('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2480('0xf')](function(_0x53b796){logger[_0x2480('0x10')](_0x2480('0x19'),_0x5a460a);logger[_0x2480('0x23')]('GetVoiceQueueReport',_0x5a460a,JSON['stringify'](_0x53b796));_0x346163(_0x53b796);})[_0x2480('0x24')](function(_0x5352e1){logger['error']('GetVoiceQueueReport',_0x5352e1[_0x2480('0x17')],_0x5a460a);_0x164c97(_0x37aff6[_0x2480('0x15')](0x1f4,_0x5352e1[_0x2480('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0xfeaf1d){var _0x4f718e=this;return new Promise(function(_0x2fde67,_0x555165){return db['VoiceQueueReport'][_0x2480('0x25')](_0xfeaf1d[_0x2480('0x26')],{'raw':_0xfeaf1d[_0x2480('0x1b')]?_0xfeaf1d['options'][_0x2480('0x1c')]===undefined?!![]:![]:!![]})[_0x2480('0xf')](function(_0x3d2d8a){logger[_0x2480('0x10')](_0x2480('0x27'),_0xfeaf1d);logger[_0x2480('0x23')](_0x2480('0x27'),_0xfeaf1d,JSON[_0x2480('0x14')](_0x3d2d8a));_0x2fde67(_0x3d2d8a);})['catch'](function(_0x1a2720){logger[_0x2480('0x15')](_0x2480('0x27'),_0x1a2720[_0x2480('0x17')],_0xfeaf1d);_0x555165(_0x4f718e[_0x2480('0x15')](0x1f4,_0x1a2720[_0x2480('0x17')]));});});};exports[_0x2480('0x28')]=function(_0xae8554){var _0x31819b=this;return new Promise(function(_0xcb032a,_0x5ac61a){return db['VoiceQueueReport'][_0x2480('0x29')](_0xae8554[_0x2480('0x26')],{'raw':_0xae8554[_0x2480('0x1b')]?_0xae8554[_0x2480('0x1b')][_0x2480('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xae8554[_0x2480('0x1b')]?_0xae8554['options']['where']||null:null,'attributes':_0xae8554[_0x2480('0x1b')]?_0xae8554['options']['attributes']||null:null,'limit':_0xae8554[_0x2480('0x1b')]?_0xae8554[_0x2480('0x1b')][_0x2480('0x1f')]||null:null})[_0x2480('0xf')](function(_0xe94ab7){logger[_0x2480('0x10')]('UpdateVoiceQueueReport',_0xae8554);logger[_0x2480('0x23')](_0x2480('0x28'),_0xae8554,JSON['stringify'](_0xe94ab7));_0xcb032a(_0xe94ab7);})[_0x2480('0x24')](function(_0x20b6f3){logger[_0x2480('0x15')](_0x2480('0x28'),_0x20b6f3[_0x2480('0x17')],_0xae8554);_0x5ac61a(_0x31819b[_0x2480('0x15')](0x1f4,_0x20b6f3[_0x2480('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 542f700..24c6d03 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 _0xd405=['voiceQueueReport:','emit','removeListener','register','length'];(function(_0x1e6511,_0x59dc0e){var _0x3013a2=function(_0x5011db){while(--_0x5011db){_0x1e6511['push'](_0x1e6511['shift']());}};_0x3013a2(++_0x59dc0e);}(_0xd405,0x1d2));var _0x5d40=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xd405[_0x223c0d];return _0x207827;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove','update'];function createListener(_0x21301a,_0x1c3258){return function(_0x3424a4){_0x1c3258[_0x5d40('0x0')](_0x21301a,_0x3424a4);};}function removeListener(_0x3d9938,_0x908b27){return function(){VoiceQueueReportEvents[_0x5d40('0x1')](_0x3d9938,_0x908b27);};}exports[_0x5d40('0x2')]=function(_0x4cf6e4){for(var _0x2aefdc=0x0,_0x49fc37=events[_0x5d40('0x3')];_0x2aefdc<_0x49fc37;_0x2aefdc++){var _0x18e63f=events[_0x2aefdc];var _0x15088c=createListener(_0x5d40('0x4')+_0x18e63f,_0x4cf6e4);VoiceQueueReportEvents['on'](_0x18e63f,_0x15088c);}}; \ No newline at end of file +var _0x60c2=['removeListener','register','length','save','remove','update','emit'];(function(_0x3c8af8,_0x4cd367){var _0x14fd3a=function(_0x10e297){while(--_0x10e297){_0x3c8af8['push'](_0x3c8af8['shift']());}};_0x14fd3a(++_0x4cd367);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x260c('0x0'),_0x260c('0x1'),_0x260c('0x2')];function createListener(_0x3ad4c5,_0x2f5bc8){return function(_0x759b92){_0x2f5bc8[_0x260c('0x3')](_0x3ad4c5,_0x759b92);};}function removeListener(_0x309bde,_0x17a599){return function(){VoiceQueueReportEvents[_0x260c('0x4')](_0x309bde,_0x17a599);};}exports[_0x260c('0x5')]=function(_0x13c7d0){for(var _0x558b0c=0x0,_0x14fab2=events[_0x260c('0x6')];_0x558b0c<_0x14fab2;_0x558b0c++){var _0x3b432d=events[_0x558b0c];var _0xf22c37=createListener('voiceQueueReport:'+_0x3b432d,_0x13c7d0);VoiceQueueReportEvents['on'](_0x3b432d,_0xf22c37);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4abe6e4..9a6ccbe 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 _0xd4de=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd4de,0x1ac));var _0xed4d=function(_0x20b667,_0x4c85ea){_0x20b667=_0x20b667-0x0;var _0x18bf2d=_0xd4de[_0x20b667];return _0x18bf2d;};'use strict';var multer=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var path=require(_0xed4d('0x2'));var timeout=require(_0xed4d('0x3'));var express=require(_0xed4d('0x4'));var router=express[_0xed4d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xed4d('0x6'));var interaction=require(_0xed4d('0x7'));var config=require(_0xed4d('0x8'));var controller=require(_0xed4d('0x9'));router[_0xed4d('0xa')]('/',auth[_0xed4d('0xb')](),controller[_0xed4d('0xc')]);router[_0xed4d('0xa')](_0xed4d('0xd'),auth[_0xed4d('0xb')](),controller[_0xed4d('0xe')]);router[_0xed4d('0xf')]('/',auth[_0xed4d('0xb')](),controller[_0xed4d('0x10')]);router[_0xed4d('0x11')](_0xed4d('0xd'),auth['isAuthenticated'](),controller[_0xed4d('0x12')]);router[_0xed4d('0x13')]('/:id',auth[_0xed4d('0xb')](),controller[_0xed4d('0x14')]);module[_0xed4d('0x15')]=router; \ No newline at end of file +var _0x8ff3=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x2bbdc4,_0x2cb88e){_0x2bbdc4=_0x2bbdc4-0x0;var _0x482d0c=_0x8ff3[_0x2bbdc4];return _0x482d0c;};'use strict';var multer=require('multer');var util=require(_0x38ff('0x0'));var path=require('path');var timeout=require(_0x38ff('0x1'));var express=require(_0x38ff('0x2'));var router=express[_0x38ff('0x3')]();var fs_extra=require(_0x38ff('0x4'));var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0x38ff('0x8')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xa')]);router[_0x38ff('0x8')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xc')]);router[_0x38ff('0xd')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xe')]);router[_0x38ff('0xf')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller['update']);router[_0x38ff('0x10')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b906165..5717a75 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 _0x0f8d=['sequelize','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1f1b92,_0x59ac38){var _0x4fddf8=function(_0x48d0ef){while(--_0x48d0ef){_0x1f1b92['push'](_0x1f1b92['shift']());}};_0x4fddf8(++_0x59ac38);}(_0x0f8d,0xa0));var _0xd0f8=function(_0x537c48,_0x294b7b){_0x537c48=_0x537c48-0x0;var _0x34d5a5=_0x0f8d[_0x537c48];return _0x34d5a5;};'use strict';var Sequelize=require(_0xd0f8('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xd0f8('0x1')]},'callid':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd0f8('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd0f8('0x2')],'allowNull':![],'defaultValue':moment()[_0xd0f8('0x3')](_0xd0f8('0x4'))}}; \ No newline at end of file +var _0xb9e0=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x36de4f,_0x350d30){var _0x1a91c2=function(_0x475034){while(--_0x475034){_0x36de4f['push'](_0x36de4f['shift']());}};_0x1a91c2(++_0x350d30);}(_0xb9e0,0x18c));var _0x0b9e=function(_0xf5e3ca,_0x46d54a){_0xf5e3ca=_0xf5e3ca-0x0;var _0xcb667=_0xb9e0[_0xf5e3ca];return _0xcb667;};'use strict';var Sequelize=require(_0x0b9e('0x0'));var moment=require(_0x0b9e('0x1'));module[_0x0b9e('0x2')]={'time':{'type':Sequelize[_0x0b9e('0x3')]},'callid':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0b9e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0b9e('0x4')],'allowNull':![],'defaultValue':moment()[_0x0b9e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 31b2878..19c9a86 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 _0x734b=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','then','end','error','stack','name','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoiceQueuesLog','include','findAll','params','includeAll','find','create','body','catch','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x734b,0x181));var _0xb734=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x734b[_0x1573ea];return _0x51c0e2;};'use strict';var emlformat=require(_0xb734('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb734('0x1'));var jsonpatch=require(_0xb734('0x2'));var rp=require('request-promise');var moment=require(_0xb734('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb734('0x4'));var util=require('util');var path=require(_0xb734('0x5'));var sox=require(_0xb734('0x6'));var csv=require(_0xb734('0x7'));var ejs=require(_0xb734('0x8'));var fs=require('fs');var fs_extra=require(_0xb734('0x9'));var _=require(_0xb734('0xa'));var squel=require(_0xb734('0xb'));var crypto=require(_0xb734('0xc'));var jsforce=require(_0xb734('0xd'));var deskjs=require(_0xb734('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb734('0xf'));var Papa=require(_0xb734('0x10'));var Redis=require(_0xb734('0x11'));var authService=require(_0xb734('0x12'));var qs=require(_0xb734('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb734('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb734('0x15'));var db=require(_0xb734('0x16'))['db'];function respondWithStatusCode(_0x119ab1,_0x5b8477){_0x5b8477=_0x5b8477||0xcc;return function(_0x52a88f){if(_0x52a88f){return _0x119ab1[_0xb734('0x17')](_0x5b8477);}return _0x119ab1['status'](_0x5b8477)['end']();};}function respondWithResult(_0x4b2613,_0x5467c9){_0x5467c9=_0x5467c9||0xc8;return function(_0x513312){if(_0x513312){return _0x4b2613['status'](_0x5467c9)[_0xb734('0x18')](_0x513312);}};}function respondWithFilteredResult(_0x3e49fe,_0x34281e){return function(_0x1eb3cc){if(_0x1eb3cc){var _0x3c9777=typeof _0x34281e[_0xb734('0x19')]===_0xb734('0x1a')&&typeof _0x34281e[_0xb734('0x1b')]===_0xb734('0x1a');var _0x976f15=_0x1eb3cc[_0xb734('0x1c')];var _0x7eba0c=_0x3c9777?0x0:_0x34281e[_0xb734('0x19')];var _0xb896bd=_0x3c9777?_0x1eb3cc[_0xb734('0x1c')]:_0x34281e[_0xb734('0x19')]+_0x34281e[_0xb734('0x1b')];var _0xb43c91;if(_0xb896bd>=_0x976f15){_0xb896bd=_0x976f15;_0xb43c91=0xc8;}else{_0xb43c91=0xce;}_0x3e49fe[_0xb734('0x1d')](_0xb43c91);return _0x3e49fe[_0xb734('0x1e')](_0xb734('0x1f'),_0x7eba0c+'-'+_0xb896bd+'/'+_0x976f15)[_0xb734('0x18')](_0x1eb3cc);}return null;};}function patchUpdates(_0x29cf48){return function(_0x50a037){try{jsonpatch['apply'](_0x50a037,_0x29cf48,!![]);}catch(_0x1b6c23){return BPromise['reject'](_0x1b6c23);}return _0x50a037['save']();};}function saveUpdates(_0x2cd46d,_0x33819c){return function(_0x5917fe){if(_0x5917fe){return _0x5917fe['update'](_0x2cd46d)[_0xb734('0x20')](function(_0x2a4409){return _0x2a4409;});}return null;};}function removeEntity(_0x206837,_0x5ea099){return function(_0x297d9e){if(_0x297d9e){return _0x297d9e['destroy']()[_0xb734('0x20')](function(){_0x206837[_0xb734('0x1d')](0xcc)[_0xb734('0x21')]();});}};}function handleEntityNotFound(_0x436b15,_0x3dcb1b){return function(_0x16a3b7){if(!_0x16a3b7){_0x436b15['sendStatus'](0x194);}return _0x16a3b7;};}function handleError(_0x3d7fae,_0x3484c4){_0x3484c4=_0x3484c4||0x1f4;return function(_0x672153){logger[_0xb734('0x22')](_0x672153[_0xb734('0x23')]);if(_0x672153[_0xb734('0x24')]){delete _0x672153[_0xb734('0x24')];}_0x3d7fae[_0xb734('0x1d')](_0x3484c4)['send'](_0x672153);};}exports['index']=function(_0x2717a1,_0x156b9c){var _0x3bfd35={},_0x311abe={},_0x9f5fae={'count':0x0,'rows':[]};var _0x104a0a=_['map'](db['VoiceQueuesLog'][_0xb734('0x25')],function(_0x15e32d){return{'name':_0x15e32d[_0xb734('0x26')],'type':_0x15e32d[_0xb734('0x27')]['key']};});_0x311abe['model']=_[_0xb734('0x28')](_0x104a0a,_0xb734('0x24'));_0x311abe[_0xb734('0x29')]=_[_0xb734('0x2a')](_0x2717a1[_0xb734('0x29')]);_0x311abe[_0xb734('0x2b')]=_[_0xb734('0x2c')](_0x311abe[_0xb734('0x2d')],_0x311abe[_0xb734('0x29')]);_0x3bfd35[_0xb734('0x2e')]=_[_0xb734('0x2c')](_0x311abe['model'],qs[_0xb734('0x2f')](_0x2717a1[_0xb734('0x29')][_0xb734('0x2f')]));_0x3bfd35[_0xb734('0x2e')]=_0x3bfd35[_0xb734('0x2e')][_0xb734('0x30')]?_0x3bfd35[_0xb734('0x2e')]:_0x311abe[_0xb734('0x2d')];if(!_0x2717a1['query'][_0xb734('0x31')](_0xb734('0x32'))){_0x3bfd35['limit']=qs[_0xb734('0x1b')](_0x2717a1[_0xb734('0x29')][_0xb734('0x1b')]);_0x3bfd35['offset']=qs[_0xb734('0x19')](_0x2717a1['query']['offset']);}_0x3bfd35['order']=qs[_0xb734('0x33')](_0x2717a1[_0xb734('0x29')][_0xb734('0x33')]);_0x3bfd35[_0xb734('0x34')]=qs[_0xb734('0x2b')](_['pick'](_0x2717a1[_0xb734('0x29')],_0x311abe[_0xb734('0x2b')]),_0x104a0a);if(_0x2717a1['query'][_0xb734('0x35')]){_0x3bfd35[_0xb734('0x34')]=_[_0xb734('0x36')](_0x3bfd35[_0xb734('0x34')],{'$or':_['map'](_0x104a0a,function(_0x3954d4){if(_0x3954d4['type']!=='VIRTUAL'){var _0x587e42={};_0x587e42[_0x3954d4['name']]={'$like':'%'+_0x2717a1[_0xb734('0x29')][_0xb734('0x35')]+'%'};return _0x587e42;}})});}_0x3bfd35=_[_0xb734('0x36')]({},_0x3bfd35,_0x2717a1[_0xb734('0x37')]);var _0x678ea3={'where':_0x3bfd35[_0xb734('0x34')]};return db[_0xb734('0x38')]['count'](_0x678ea3)[_0xb734('0x20')](function(_0xa0e1f3){_0x9f5fae[_0xb734('0x1c')]=_0xa0e1f3;if(_0x2717a1[_0xb734('0x29')]['includeAll']){_0x3bfd35[_0xb734('0x39')]=[{'all':!![]}];}return db[_0xb734('0x38')][_0xb734('0x3a')](_0x3bfd35);})[_0xb734('0x20')](function(_0x2f73a0){_0x9f5fae['rows']=_0x2f73a0;return _0x9f5fae;})[_0xb734('0x20')](respondWithFilteredResult(_0x156b9c,_0x3bfd35))['catch'](handleError(_0x156b9c,null));};exports['show']=function(_0x30036c,_0x301836){var _0x5b4fa8={'raw':!![],'where':{'id':_0x30036c[_0xb734('0x3b')]['id']}},_0x146691={};_0x146691['model']=_[_0xb734('0x2a')](db[_0xb734('0x38')][_0xb734('0x25')]);_0x146691[_0xb734('0x29')]=_[_0xb734('0x2a')](_0x30036c['query']);_0x146691[_0xb734('0x2b')]=_[_0xb734('0x2c')](_0x146691[_0xb734('0x2d')],_0x146691['query']);_0x5b4fa8[_0xb734('0x2e')]=_[_0xb734('0x2c')](_0x146691[_0xb734('0x2d')],qs[_0xb734('0x2f')](_0x30036c['query']['fields']));_0x5b4fa8[_0xb734('0x2e')]=_0x5b4fa8[_0xb734('0x2e')]['length']?_0x5b4fa8[_0xb734('0x2e')]:_0x146691['model'];if(_0x30036c[_0xb734('0x29')][_0xb734('0x3c')]){_0x5b4fa8[_0xb734('0x39')]=[{'all':!![]}];}_0x5b4fa8=_['merge']({},_0x5b4fa8,_0x30036c[_0xb734('0x37')]);return db[_0xb734('0x38')][_0xb734('0x3d')](_0x5b4fa8)['then'](handleEntityNotFound(_0x301836,null))[_0xb734('0x20')](respondWithResult(_0x301836,null))['catch'](handleError(_0x301836,null));};exports[_0xb734('0x3e')]=function(_0x5d2cbe,_0x528054){return db[_0xb734('0x38')][_0xb734('0x3e')](_0x5d2cbe[_0xb734('0x3f')],{})['then'](respondWithResult(_0x528054,0xc9))[_0xb734('0x40')](handleError(_0x528054,null));};exports['update']=function(_0x5d57f7,_0x464f4a){if(_0x5d57f7[_0xb734('0x3f')]['id']){delete _0x5d57f7[_0xb734('0x3f')]['id'];}return db[_0xb734('0x38')][_0xb734('0x3d')]({'where':{'id':_0x5d57f7[_0xb734('0x3b')]['id']}})[_0xb734('0x20')](handleEntityNotFound(_0x464f4a,null))[_0xb734('0x20')](saveUpdates(_0x5d57f7[_0xb734('0x3f')],null))[_0xb734('0x20')](respondWithResult(_0x464f4a,null))[_0xb734('0x40')](handleError(_0x464f4a,null));};exports[_0xb734('0x41')]=function(_0x49c942,_0x46f354){return db[_0xb734('0x38')][_0xb734('0x3d')]({'where':{'id':_0x49c942[_0xb734('0x3b')]['id']}})[_0xb734('0x20')](handleEntityNotFound(_0x46f354,null))[_0xb734('0x20')](removeEntity(_0x46f354,null))['catch'](handleError(_0x46f354,null));}; \ No newline at end of file +var _0xc69b=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','VoiceQueuesLog','rawAttributes','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','find','create','body','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1e5cb6,_0x1314d6){var _0x408f84=function(_0x120da5){while(--_0x120da5){_0x1e5cb6['push'](_0x1e5cb6['shift']());}};_0x408f84(++_0x1314d6);}(_0xc69b,0x8d));var _0xbc69=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xc69b[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0xbc69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc69('0x1'));var jsonpatch=require(_0xbc69('0x2'));var rp=require('request-promise');var moment=require(_0xbc69('0x3'));var BPromise=require(_0xbc69('0x4'));var Mustache=require(_0xbc69('0x5'));var util=require(_0xbc69('0x6'));var path=require(_0xbc69('0x7'));var sox=require(_0xbc69('0x8'));var csv=require(_0xbc69('0x9'));var ejs=require(_0xbc69('0xa'));var fs=require('fs');var fs_extra=require(_0xbc69('0xb'));var _=require(_0xbc69('0xc'));var squel=require(_0xbc69('0xd'));var crypto=require(_0xbc69('0xe'));var jsforce=require(_0xbc69('0xf'));var deskjs=require(_0xbc69('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbc69('0x11'));var Papa=require(_0xbc69('0x12'));var Redis=require(_0xbc69('0x13'));var authService=require(_0xbc69('0x14'));var qs=require(_0xbc69('0x15'));var as=require(_0xbc69('0x16'));var hardwareService=require(_0xbc69('0x17'));var logger=require('../../config/logger')(_0xbc69('0x18'));var utils=require(_0xbc69('0x19'));var config=require(_0xbc69('0x1a'));var licenseUtil=require(_0xbc69('0x1b'));var db=require(_0xbc69('0x1c'))['db'];function respondWithStatusCode(_0x29895a,_0x7e1023){_0x7e1023=_0x7e1023||0xcc;return function(_0x6efa7b){if(_0x6efa7b){return _0x29895a['sendStatus'](_0x7e1023);}return _0x29895a[_0xbc69('0x1d')](_0x7e1023)[_0xbc69('0x1e')]();};}function respondWithResult(_0xe8bff4,_0x58b346){_0x58b346=_0x58b346||0xc8;return function(_0x3b43f6){if(_0x3b43f6){return _0xe8bff4[_0xbc69('0x1d')](_0x58b346)[_0xbc69('0x1f')](_0x3b43f6);}};}function respondWithFilteredResult(_0x5e1049,_0x3fce0f){return function(_0x4b0927){if(_0x4b0927){var _0x1607fd=typeof _0x3fce0f['offset']===_0xbc69('0x20')&&typeof _0x3fce0f[_0xbc69('0x21')]==='undefined';var _0x414de9=_0x4b0927[_0xbc69('0x22')];var _0x444cfd=_0x1607fd?0x0:_0x3fce0f['offset'];var _0x26f17c=_0x1607fd?_0x4b0927[_0xbc69('0x22')]:_0x3fce0f[_0xbc69('0x23')]+_0x3fce0f[_0xbc69('0x21')];var _0x50680d;if(_0x26f17c>=_0x414de9){_0x26f17c=_0x414de9;_0x50680d=0xc8;}else{_0x50680d=0xce;}_0x5e1049[_0xbc69('0x1d')](_0x50680d);return _0x5e1049[_0xbc69('0x24')](_0xbc69('0x25'),_0x444cfd+'-'+_0x26f17c+'/'+_0x414de9)[_0xbc69('0x1f')](_0x4b0927);}return null;};}function patchUpdates(_0x48d323){return function(_0x5cc135){try{jsonpatch['apply'](_0x5cc135,_0x48d323,!![]);}catch(_0x3e3b1a){return BPromise[_0xbc69('0x26')](_0x3e3b1a);}return _0x5cc135[_0xbc69('0x27')]();};}function saveUpdates(_0x19654f,_0x31009c){return function(_0x46c026){if(_0x46c026){return _0x46c026[_0xbc69('0x28')](_0x19654f)[_0xbc69('0x29')](function(_0x2a7262){return _0x2a7262;});}return null;};}function removeEntity(_0x3bfd80,_0x3e562a){return function(_0x53629e){if(_0x53629e){return _0x53629e[_0xbc69('0x2a')]()['then'](function(){_0x3bfd80['status'](0xcc)[_0xbc69('0x1e')]();});}};}function handleEntityNotFound(_0x5caea9,_0x19be9c){return function(_0x3eda90){if(!_0x3eda90){_0x5caea9[_0xbc69('0x2b')](0x194);}return _0x3eda90;};}function handleError(_0x45a54b,_0x72147d){_0x72147d=_0x72147d||0x1f4;return function(_0x39b3e6){logger[_0xbc69('0x2c')](_0x39b3e6[_0xbc69('0x2d')]);if(_0x39b3e6['name']){delete _0x39b3e6['name'];}_0x45a54b[_0xbc69('0x1d')](_0x72147d)[_0xbc69('0x2e')](_0x39b3e6);};}exports[_0xbc69('0x2f')]=function(_0x523f77,_0x15dd41){var _0x4b77bd={},_0x55542e={},_0x3654d6={'count':0x0,'rows':[]};var _0x5ee9a8=_['map'](db[_0xbc69('0x30')][_0xbc69('0x31')],function(_0x3f92f1){return{'name':_0x3f92f1[_0xbc69('0x32')],'type':_0x3f92f1['type'][_0xbc69('0x33')]};});_0x55542e[_0xbc69('0x34')]=_[_0xbc69('0x35')](_0x5ee9a8,_0xbc69('0x36'));_0x55542e[_0xbc69('0x37')]=_[_0xbc69('0x38')](_0x523f77[_0xbc69('0x37')]);_0x55542e['filters']=_[_0xbc69('0x39')](_0x55542e[_0xbc69('0x34')],_0x55542e[_0xbc69('0x37')]);_0x4b77bd[_0xbc69('0x3a')]=_[_0xbc69('0x39')](_0x55542e['model'],qs['fields'](_0x523f77[_0xbc69('0x37')][_0xbc69('0x3b')]));_0x4b77bd['attributes']=_0x4b77bd[_0xbc69('0x3a')]['length']?_0x4b77bd[_0xbc69('0x3a')]:_0x55542e[_0xbc69('0x34')];if(!_0x523f77['query'][_0xbc69('0x3c')]('nolimit')){_0x4b77bd[_0xbc69('0x21')]=qs[_0xbc69('0x21')](_0x523f77[_0xbc69('0x37')][_0xbc69('0x21')]);_0x4b77bd[_0xbc69('0x23')]=qs['offset'](_0x523f77['query'][_0xbc69('0x23')]);}_0x4b77bd[_0xbc69('0x3d')]=qs[_0xbc69('0x3e')](_0x523f77[_0xbc69('0x37')][_0xbc69('0x3e')]);_0x4b77bd[_0xbc69('0x3f')]=qs[_0xbc69('0x40')](_[_0xbc69('0x41')](_0x523f77[_0xbc69('0x37')],_0x55542e[_0xbc69('0x40')]),_0x5ee9a8);if(_0x523f77['query'][_0xbc69('0x42')]){_0x4b77bd['where']=_[_0xbc69('0x43')](_0x4b77bd[_0xbc69('0x3f')],{'$or':_['map'](_0x5ee9a8,function(_0x6c64d6){if(_0x6c64d6[_0xbc69('0x44')]!==_0xbc69('0x45')){var _0xd345e8={};_0xd345e8[_0x6c64d6[_0xbc69('0x36')]]={'$like':'%'+_0x523f77[_0xbc69('0x37')][_0xbc69('0x42')]+'%'};return _0xd345e8;}})});}_0x4b77bd=_['merge']({},_0x4b77bd,_0x523f77['options']);var _0x86dff={'where':_0x4b77bd[_0xbc69('0x3f')]};return db[_0xbc69('0x30')][_0xbc69('0x22')](_0x86dff)[_0xbc69('0x29')](function(_0x1d16d8){_0x3654d6[_0xbc69('0x22')]=_0x1d16d8;if(_0x523f77[_0xbc69('0x37')][_0xbc69('0x46')]){_0x4b77bd['include']=[{'all':!![]}];}return db[_0xbc69('0x30')][_0xbc69('0x47')](_0x4b77bd);})['then'](function(_0x58f462){_0x3654d6[_0xbc69('0x48')]=_0x58f462;return _0x3654d6;})[_0xbc69('0x29')](respondWithFilteredResult(_0x15dd41,_0x4b77bd))['catch'](handleError(_0x15dd41,null));};exports[_0xbc69('0x49')]=function(_0x4288fc,_0x2d3df2){var _0x446111={'raw':!![],'where':{'id':_0x4288fc[_0xbc69('0x4a')]['id']}},_0x6282cd={};_0x6282cd[_0xbc69('0x34')]=_[_0xbc69('0x38')](db[_0xbc69('0x30')]['rawAttributes']);_0x6282cd['query']=_[_0xbc69('0x38')](_0x4288fc['query']);_0x6282cd[_0xbc69('0x40')]=_['intersection'](_0x6282cd[_0xbc69('0x34')],_0x6282cd[_0xbc69('0x37')]);_0x446111[_0xbc69('0x3a')]=_[_0xbc69('0x39')](_0x6282cd[_0xbc69('0x34')],qs['fields'](_0x4288fc[_0xbc69('0x37')][_0xbc69('0x3b')]));_0x446111[_0xbc69('0x3a')]=_0x446111[_0xbc69('0x3a')][_0xbc69('0x4b')]?_0x446111[_0xbc69('0x3a')]:_0x6282cd[_0xbc69('0x34')];if(_0x4288fc[_0xbc69('0x37')][_0xbc69('0x46')]){_0x446111[_0xbc69('0x4c')]=[{'all':!![]}];}_0x446111=_['merge']({},_0x446111,_0x4288fc[_0xbc69('0x4d')]);return db['VoiceQueuesLog'][_0xbc69('0x4e')](_0x446111)[_0xbc69('0x29')](handleEntityNotFound(_0x2d3df2,null))[_0xbc69('0x29')](respondWithResult(_0x2d3df2,null))['catch'](handleError(_0x2d3df2,null));};exports[_0xbc69('0x4f')]=function(_0x1f579d,_0x3d675a){return db['VoiceQueuesLog']['create'](_0x1f579d[_0xbc69('0x50')],{})['then'](respondWithResult(_0x3d675a,0xc9))[_0xbc69('0x51')](handleError(_0x3d675a,null));};exports[_0xbc69('0x28')]=function(_0x295789,_0x20296e){if(_0x295789['body']['id']){delete _0x295789['body']['id'];}return db[_0xbc69('0x30')]['find']({'where':{'id':_0x295789[_0xbc69('0x4a')]['id']}})[_0xbc69('0x29')](handleEntityNotFound(_0x20296e,null))[_0xbc69('0x29')](saveUpdates(_0x295789[_0xbc69('0x50')],null))[_0xbc69('0x29')](respondWithResult(_0x20296e,null))['catch'](handleError(_0x20296e,null));};exports[_0xbc69('0x2a')]=function(_0x2dcdef,_0x114a72){return db[_0xbc69('0x30')][_0xbc69('0x4e')]({'where':{'id':_0x2dcdef[_0xbc69('0x4a')]['id']}})[_0xbc69('0x29')](handleEntityNotFound(_0x114a72,null))[_0xbc69('0x29')](removeEntity(_0x114a72,null))['catch'](handleError(_0x114a72,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 7600571..4d9759c 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 _0x9ec4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_queues_log','event','lodash','util','api'];(function(_0x6c0364,_0x400c93){var _0x1a8d87=function(_0x1a1be7){while(--_0x1a1be7){_0x6c0364['push'](_0x6c0364['shift']());}};_0x1a8d87(++_0x400c93);}(_0x9ec4,0xda));var _0x49ec=function(_0x4ab4cb,_0x5f5151){_0x4ab4cb=_0x4ab4cb-0x0;var _0x59466d=_0x9ec4[_0x4ab4cb];return _0x59466d;};'use strict';var _=require(_0x49ec('0x0'));var util=require(_0x49ec('0x1'));var logger=require('../../config/logger')(_0x49ec('0x2'));var moment=require(_0x49ec('0x3'));var BPromise=require(_0x49ec('0x4'));var rp=require(_0x49ec('0x5'));var fs=require('fs');var path=require(_0x49ec('0x6'));var rimraf=require(_0x49ec('0x7'));var config=require(_0x49ec('0x8'));var attributes=require('./voiceQueuesLog.attributes');module[_0x49ec('0x9')]=function(_0x470bf0,_0x22f99d){return _0x470bf0[_0x49ec('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x49ec('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x49ec('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x5580=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util'];(function(_0x264de4,_0x41f555){var _0x4e004e=function(_0x43f7c8){while(--_0x43f7c8){_0x264de4['push'](_0x264de4['shift']());}};_0x4e004e(++_0x41f555);}(_0x5580,0xa6));var _0x0558=function(_0x40b2bd,_0xc696ef){_0x40b2bd=_0x40b2bd-0x0;var _0x138cfc=_0x5580[_0x40b2bd];return _0x138cfc;};'use strict';var _=require(_0x0558('0x0'));var util=require(_0x0558('0x1'));var logger=require(_0x0558('0x2'))('api');var moment=require(_0x0558('0x3'));var BPromise=require(_0x0558('0x4'));var rp=require(_0x0558('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0558('0x6'));var config=require(_0x0558('0x7'));var attributes=require(_0x0558('0x8'));module[_0x0558('0x9')]=function(_0x147d9e,_0x1c49dd){return _0x147d9e['define'](_0x0558('0xa'),attributes,{'tableName':_0x0558('0xb'),'paranoid':![],'indexes':[{'name':_0x0558('0xc'),'fields':[_0x0558('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4166db2..b43304f 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 _0x1d60=['error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x1d60,0xe8));var _0x01d6=function(_0x2946f3,_0x305c84){_0x2946f3=_0x2946f3-0x0;var _0x2f69c2=_0x1d60[_0x2946f3];return _0x2f69c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x01d6('0x0'));var rs=require(_0x01d6('0x1'));var fs=require('fs');var Redis=require(_0x01d6('0x2'));var db=require(_0x01d6('0x3'))['db'];var utils=require(_0x01d6('0x4'));var logger=require(_0x01d6('0x5'))('rpc');var config=require(_0x01d6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x01d6('0x7')][_0x01d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e0aca,_0x11aba6,_0x19809c){return new BPromise(function(_0x1de5bb,_0x385ac1){return client['request'](_0x4e0aca,_0x19809c)[_0x01d6('0x9')](function(_0x274d85){logger[_0x01d6('0xa')](_0x01d6('0xb'),_0x11aba6,_0x01d6('0xc'));logger[_0x01d6('0xd')](_0x01d6('0xe'),_0x11aba6,'request\x20sent',JSON['stringify'](_0x274d85));if(_0x274d85[_0x01d6('0xf')]){if(_0x274d85[_0x01d6('0xf')][_0x01d6('0x10')]===0x1f4){logger[_0x01d6('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x11aba6,_0x274d85[_0x01d6('0xf')][_0x01d6('0x11')]);return _0x385ac1(_0x274d85[_0x01d6('0xf')][_0x01d6('0x11')]);}logger[_0x01d6('0xf')](_0x01d6('0xb'),_0x11aba6,_0x274d85[_0x01d6('0xf')][_0x01d6('0x11')]);return _0x1de5bb(_0x274d85[_0x01d6('0xf')][_0x01d6('0x11')]);}else{logger['info'](_0x01d6('0xb'),_0x11aba6,_0x01d6('0xc'));_0x1de5bb(_0x274d85[_0x01d6('0x12')][_0x01d6('0x11')]);}})['catch'](function(_0x49b433){logger[_0x01d6('0xf')](_0x01d6('0xb'),_0x11aba6,_0x49b433);_0x385ac1(_0x49b433);});});} \ No newline at end of file +var _0x24db=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3024e5,_0x3261ac){var _0x4d988a=function(_0x90d571){while(--_0x90d571){_0x3024e5['push'](_0x3024e5['shift']());}};_0x4d988a(++_0x3261ac);}(_0x24db,0x17d));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb24d('0x0'));var moment=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require(_0xb24d('0x4'));var db=require(_0xb24d('0x5'))['db'];var utils=require(_0xb24d('0x6'));var logger=require(_0xb24d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb24d('0x8')][_0xb24d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37754f,_0x477ed8,_0x13158c){return new BPromise(function(_0x99799c,_0xd0ab81){return client['request'](_0x37754f,_0x13158c)[_0xb24d('0xa')](function(_0x3bdaeb){logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));logger[_0xb24d('0xe')](_0xb24d('0xf'),_0x477ed8,'request\x20sent',JSON['stringify'](_0x3bdaeb));if(_0x3bdaeb['error']){if(_0x3bdaeb[_0xb24d('0x10')]['code']===0x1f4){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')][_0xb24d('0x11')]);return _0xd0ab81(_0x3bdaeb[_0xb24d('0x10')]['message']);}logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')]['message']);return _0x99799c(_0x3bdaeb['error']['message']);}else{logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));_0x99799c(_0x3bdaeb[_0xb24d('0x12')][_0xb24d('0x11')]);}})[_0xb24d('0x13')](function(_0x366390){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x366390);_0xd0ab81(_0x366390);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 938c337..046da1d 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 _0xb9b1=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','create','post','update','delete','exports','multer'];(function(_0x34c30b,_0x83d8d6){var _0xb787ab=function(_0x2938a4){while(--_0x2938a4){_0x34c30b['push'](_0x34c30b['shift']());}};_0xb787ab(++_0x83d8d6);}(_0xb9b1,0x12a));var _0x1b9b=function(_0x584bdd,_0x40997c){_0x584bdd=_0x584bdd-0x0;var _0x5d5298=_0xb9b1[_0x584bdd];return _0x5d5298;};'use strict';var multer=require(_0x1b9b('0x0'));var util=require(_0x1b9b('0x1'));var path=require('path');var timeout=require(_0x1b9b('0x2'));var express=require(_0x1b9b('0x3'));var router=express[_0x1b9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1b9b('0x6'));var controller=require('./voiceRecording.controller');router[_0x1b9b('0x7')]('/',auth[_0x1b9b('0x8')](),controller[_0x1b9b('0x9')]);router['get'](_0x1b9b('0xa'),auth[_0x1b9b('0x8')](),controller[_0x1b9b('0xb')]);router[_0x1b9b('0x7')](_0x1b9b('0xc'),auth[_0x1b9b('0x8')](),controller[_0x1b9b('0xd')]);router['get'](_0x1b9b('0xe'),auth[_0x1b9b('0x8')](),controller[_0x1b9b('0xf')]);router[_0x1b9b('0x7')](_0x1b9b('0x10'),controller['downloads']);router[_0x1b9b('0x7')](_0x1b9b('0x11'),auth[_0x1b9b('0x8')](),controller['downloadTranscribe']);router['post']('/',auth[_0x1b9b('0x8')](),controller[_0x1b9b('0x12')]);router[_0x1b9b('0x13')](_0x1b9b('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router['put'](_0x1b9b('0xc'),auth[_0x1b9b('0x8')](),controller[_0x1b9b('0x14')]);router[_0x1b9b('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1b9b('0x16')]=router; \ No newline at end of file +var _0x9422=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','exports','multer','util'];(function(_0x5c13f8,_0x5d0bb3){var _0x5351db=function(_0x145d1c){while(--_0x145d1c){_0x5c13f8['push'](_0x5c13f8['shift']());}};_0x5351db(++_0x5d0bb3);}(_0x9422,0x16a));var _0x2942=function(_0x38d335,_0x5eeb3e){_0x38d335=_0x38d335-0x0;var _0x34b3ac=_0x9422[_0x38d335];return _0x34b3ac;};'use strict';var multer=require(_0x2942('0x0'));var util=require(_0x2942('0x1'));var path=require(_0x2942('0x2'));var timeout=require(_0x2942('0x3'));var express=require(_0x2942('0x4'));var router=express[_0x2942('0x5')]();var fs_extra=require(_0x2942('0x6'));var auth=require(_0x2942('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2942('0x8'));var controller=require(_0x2942('0x9'));router[_0x2942('0xa')]('/',auth[_0x2942('0xb')](),controller[_0x2942('0xc')]);router[_0x2942('0xa')](_0x2942('0xd'),auth[_0x2942('0xb')](),controller['describe']);router[_0x2942('0xa')](_0x2942('0xe'),auth[_0x2942('0xb')](),controller[_0x2942('0xf')]);router[_0x2942('0xa')](_0x2942('0x10'),auth[_0x2942('0xb')](),controller[_0x2942('0x11')]);router[_0x2942('0xa')]('/:id/downloads',controller[_0x2942('0x12')]);router['get'](_0x2942('0x13'),auth['isAuthenticated'](),controller[_0x2942('0x14')]);router[_0x2942('0x15')]('/',auth[_0x2942('0xb')](),controller[_0x2942('0x16')]);router[_0x2942('0x15')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x2942('0x17')]);router['put'](_0x2942('0xe'),auth[_0x2942('0xb')](),controller[_0x2942('0x18')]);router['delete'](_0x2942('0xe'),auth[_0x2942('0xb')](),controller['destroy']);module[_0x2942('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a127bc5..64155c9 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 6cb086e..d9c0f17 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 _0x4de2=['TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','updateAttributes','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','aws-sdk','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','format','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','VoiceRecording','include','findAll','rows','catch','show','params','keys','intersection','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','$and','push','secrets','ValidationError','filename','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','TranscriptionJob','TranscriptionJobName','transcribeStatus'];(function(_0x4a7836,_0x35cea2){var _0x54425b=function(_0x5940f2){while(--_0x5940f2){_0x4a7836['push'](_0x4a7836['shift']());}};_0x54425b(++_0x35cea2);}(_0x4de2,0x152));var _0x24de=function(_0x3485f8,_0x1b66cf){_0x3485f8=_0x3485f8-0x0;var _0x1fbba7=_0x4de2[_0x3485f8];return _0x1fbba7;};'use strict';var emlformat=require(_0x24de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24de('0x1'));var jsonpatch=require(_0x24de('0x2'));var rp=require(_0x24de('0x3'));var moment=require(_0x24de('0x4'));var BPromise=require(_0x24de('0x5'));var Mustache=require('mustache');var util=require(_0x24de('0x6'));var path=require(_0x24de('0x7'));var sox=require(_0x24de('0x8'));var csv=require(_0x24de('0x9'));var ejs=require(_0x24de('0xa'));var fs=require('fs');var fs_extra=require(_0x24de('0xb'));var _=require(_0x24de('0xc'));var squel=require(_0x24de('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x24de('0x9'));var querystring=require(_0x24de('0xe'));var Papa=require(_0x24de('0xf'));var AWS=require(_0x24de('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x24de('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x24de('0x12'));var as=require(_0x24de('0x13'));var hardwareService=require(_0x24de('0x14'));var logger=require(_0x24de('0x15'))(_0x24de('0x16'));var utils=require('../../config/utils');var config=require(_0x24de('0x17'));var licenseUtil=require(_0x24de('0x18'));var db=require(_0x24de('0x19'))['db'];function respondWithStatusCode(_0x2ae67e,_0x128bea){_0x128bea=_0x128bea||0xcc;return function(_0x44906b){if(_0x44906b){return _0x2ae67e[_0x24de('0x1a')](_0x128bea);}return _0x2ae67e[_0x24de('0x1b')](_0x128bea)['end']();};}function respondWithResult(_0x4113af,_0x5b3133){_0x5b3133=_0x5b3133||0xc8;return function(_0xe042e0){if(_0xe042e0){return _0x4113af['status'](_0x5b3133)[_0x24de('0x1c')](_0xe042e0);}};}function respondWithFilteredResult(_0x3cc51e,_0x48ae47){return function(_0x99aeaf){if(_0x99aeaf){var _0x58b1a2=typeof _0x48ae47[_0x24de('0x1d')]==='undefined'&&typeof _0x48ae47[_0x24de('0x1e')]===_0x24de('0x1f');var _0xd88d91=_0x99aeaf[_0x24de('0x20')];var _0x38d6e0=_0x58b1a2?0x0:_0x48ae47[_0x24de('0x1d')];var _0x147bae=_0x58b1a2?_0x99aeaf['count']:_0x48ae47['offset']+_0x48ae47[_0x24de('0x1e')];var _0x561bc5;if(_0x147bae>=_0xd88d91){_0x147bae=_0xd88d91;_0x561bc5=0xc8;}else{_0x561bc5=0xce;}_0x3cc51e[_0x24de('0x1b')](_0x561bc5);return _0x3cc51e[_0x24de('0x21')]('Content-Range',_0x38d6e0+'-'+_0x147bae+'/'+_0xd88d91)[_0x24de('0x1c')](_0x99aeaf);}return null;};}function patchUpdates(_0x77935a){return function(_0xe988ab){try{jsonpatch[_0x24de('0x22')](_0xe988ab,_0x77935a,!![]);}catch(_0xb88e24){return BPromise[_0x24de('0x23')](_0xb88e24);}return _0xe988ab[_0x24de('0x24')]();};}function saveUpdates(_0x417c55,_0x4eeec8){return function(_0x2cf11b){if(_0x2cf11b){return _0x2cf11b[_0x24de('0x25')](_0x417c55)[_0x24de('0x26')](function(_0x3b0f2f){return _0x3b0f2f;});}return null;};}function removeEntity(_0x2ca813,_0x2da1b3){return function(_0x493d8e){if(_0x493d8e){return _0x493d8e[_0x24de('0x27')]()[_0x24de('0x26')](function(){_0x2ca813[_0x24de('0x1b')](0xcc)[_0x24de('0x28')]();});}};}function handleEntityNotFound(_0x37b37e,_0xae6cfa){return function(_0x25f50d){if(!_0x25f50d){_0x37b37e['sendStatus'](0x194);}return _0x25f50d;};}function handleError(_0x579ea3,_0x432a79){_0x432a79=_0x432a79||0x1f4;return function(_0x32822f){logger[_0x24de('0x29')](_0x32822f[_0x24de('0x2a')]);if(_0x32822f[_0x24de('0x2b')]){delete _0x32822f[_0x24de('0x2b')];}_0x579ea3['status'](_0x432a79)[_0x24de('0x2c')](_0x32822f);};}exports[_0x24de('0x2d')]=function(_0x456ca7,_0x51e786){var _0x5919dc={},_0x2cdbab={},_0x1c2034={'count':0x0,'rows':[]};var _0x537bab=_[_0x24de('0x2e')](db['VoiceRecording'][_0x24de('0x2f')],function(_0x492b7c){return{'name':_0x492b7c[_0x24de('0x30')],'type':_0x492b7c['type'][_0x24de('0x31')]};});_0x2cdbab['model']=_[_0x24de('0x32')](_['map'](_0x537bab,_0x24de('0x2b')),[_0x24de('0x33')]);_0x2cdbab[_0x24de('0x34')]=_['keys'](_0x456ca7[_0x24de('0x34')]);_0x2cdbab['filters']=_['intersection'](_0x2cdbab[_0x24de('0x35')],_0x2cdbab[_0x24de('0x34')]);_0x5919dc[_0x24de('0x36')]=_['intersection'](_0x2cdbab['model'],qs[_0x24de('0x37')](_0x456ca7[_0x24de('0x34')][_0x24de('0x37')]));_0x5919dc[_0x24de('0x36')]=_0x5919dc[_0x24de('0x36')][_0x24de('0x38')]?_0x5919dc[_0x24de('0x36')]:_0x2cdbab[_0x24de('0x35')];if(!_0x456ca7[_0x24de('0x34')][_0x24de('0x39')](_0x24de('0x3a'))){_0x5919dc[_0x24de('0x1e')]=qs[_0x24de('0x1e')](_0x456ca7['query'][_0x24de('0x1e')]);_0x5919dc['offset']=qs[_0x24de('0x1d')](_0x456ca7['query'][_0x24de('0x1d')]);}_0x5919dc[_0x24de('0x3b')]=qs[_0x24de('0x3c')](_0x456ca7['query'][_0x24de('0x3c')]);_0x5919dc[_0x24de('0x3d')]=qs[_0x24de('0x3e')](_['pick'](_0x456ca7[_0x24de('0x34')],_0x2cdbab['filters']),_0x537bab);if(_0x456ca7[_0x24de('0x34')]['filter']){_0x5919dc[_0x24de('0x3d')]=_['merge'](_0x5919dc[_0x24de('0x3d')],{'$or':_['map'](_0x537bab,function(_0xa6f9f7){if(_0xa6f9f7[_0x24de('0x3f')]!==_0x24de('0x40')){var _0x514caa={};_0x514caa[_0xa6f9f7[_0x24de('0x2b')]]={'$like':'%'+_0x456ca7[_0x24de('0x34')][_0x24de('0x41')]+'%'};return _0x514caa;}})});}_0x5919dc=_[_0x24de('0x42')]({},_0x5919dc,_0x456ca7[_0x24de('0x43')]);var _0x3dea28={'where':_0x5919dc[_0x24de('0x3d')]};return db[_0x24de('0x44')][_0x24de('0x20')](_0x3dea28)[_0x24de('0x26')](function(_0x29b51b){_0x1c2034[_0x24de('0x20')]=_0x29b51b;if(_0x456ca7[_0x24de('0x34')]['includeAll']){_0x5919dc[_0x24de('0x45')]=[{'all':!![]}];}return db[_0x24de('0x44')][_0x24de('0x46')](_0x5919dc);})['then'](function(_0x12b836){_0x1c2034[_0x24de('0x47')]=_0x12b836;return _0x1c2034;})['then'](respondWithFilteredResult(_0x51e786,_0x5919dc))[_0x24de('0x48')](handleError(_0x51e786,null));};exports[_0x24de('0x49')]=function(_0x3ba086,_0x18e052){var _0x251f89={'raw':![],'where':{'id':_0x3ba086[_0x24de('0x4a')]['id']}},_0x423f05={};_0x423f05['model']=_[_0x24de('0x4b')](db[_0x24de('0x44')][_0x24de('0x2f')]);_0x423f05[_0x24de('0x34')]=_[_0x24de('0x4b')](_0x3ba086[_0x24de('0x34')]);_0x423f05['filters']=_[_0x24de('0x4c')](_0x423f05[_0x24de('0x35')],_0x423f05[_0x24de('0x34')]);_0x251f89[_0x24de('0x36')]=_[_0x24de('0x4c')](_0x423f05[_0x24de('0x35')],qs['fields'](_0x3ba086[_0x24de('0x34')][_0x24de('0x37')]));_0x251f89['attributes']=_0x251f89[_0x24de('0x36')]['length']?_0x251f89[_0x24de('0x36')]:_0x423f05[_0x24de('0x35')];if(_0x3ba086[_0x24de('0x34')][_0x24de('0x4d')]){_0x251f89['include']=[{'all':!![]}];}_0x251f89=_[_0x24de('0x42')]({},_0x251f89,_0x3ba086[_0x24de('0x43')]);return db['VoiceRecording'][_0x24de('0x4e')](_0x251f89)[_0x24de('0x26')](handleEntityNotFound(_0x18e052,null))[_0x24de('0x26')](respondWithResult(_0x18e052,null))[_0x24de('0x48')](handleError(_0x18e052,null));};exports[_0x24de('0x4f')]=function(_0x16817f,_0x229419){return db['VoiceRecording']['create'](_0x16817f[_0x24de('0x50')],{})[_0x24de('0x26')](respondWithResult(_0x229419,0xc9))[_0x24de('0x48')](handleError(_0x229419,null));};exports[_0x24de('0x25')]=function(_0x1b414f,_0x46d0de){if(_0x1b414f[_0x24de('0x50')]['id']){delete _0x1b414f['body']['id'];}return db[_0x24de('0x44')][_0x24de('0x4e')]({'where':{'id':_0x1b414f[_0x24de('0x4a')]['id']}})[_0x24de('0x26')](handleEntityNotFound(_0x46d0de,null))[_0x24de('0x26')](saveUpdates(_0x1b414f['body'],null))[_0x24de('0x26')](respondWithResult(_0x46d0de,null))['catch'](handleError(_0x46d0de,null));};exports['describe']=function(_0x198b7b,_0x5456cc){return db['VoiceRecording'][_0x24de('0x51')]()[_0x24de('0x26')](respondWithResult(_0x5456cc,null))[_0x24de('0x48')](handleError(_0x5456cc,null));};exports[_0x24de('0x52')]=function(_0x57a597,_0x58b0fd,_0x29ef7b){var _0xe3e0ed=require(_0x24de('0x53'));var _0x4a53a6=![];var _0x55d46a={};if(_0x57a597[_0x24de('0x34')][_0x24de('0x3f')]&&_0x57a597[_0x24de('0x34')]['type']===_0x24de('0x54')){_0x55d46a['uniqueid']=_0x57a597[_0x24de('0x4a')]['id'];}else{_0x55d46a['id']=_0x57a597[_0x24de('0x4a')]['id'];}return db[_0x24de('0x44')]['find']({'where':_0x55d46a,'attributes':['id',_0x24de('0x55')],'raw':!![]})[_0x24de('0x26')](handleEntityNotFound(_0x58b0fd,null))['then'](function(_0x42be41){if(_0x42be41){var _0x2d155b=_0x42be41['value'];var _0x583411=util[_0x24de('0x33')]('%s.cypher',_0x2d155b);if(fs[_0x24de('0x56')](_0x583411)){_0x4a53a6=!![];return _0xe3e0ed[_0x24de('0x57')](_0x583411,_0x2d155b,config['secrets'][_0x24de('0x58')])[_0x24de('0x26')](function(){return _0x42be41;});}return _0x42be41;}})[_0x24de('0x26')](function(_0x3763bf){if(_0x3763bf){var _0x1267cd=_0x3763bf['value'];if(!fs[_0x24de('0x56')](_0x1267cd)){throw new db[(_0x24de('0x59'))]['ValidationError'](_0x24de('0x5a'));}if(_0x3763bf['filename']){return _0x58b0fd[_0x24de('0x52')](_0x1267cd,_0x3763bf['filename']+path[_0x24de('0x5b')](_0x1267cd),function(){if(_0x4a53a6){fs[_0x24de('0x5c')](_0x1267cd);}});}else{return _0x58b0fd[_0x24de('0x52')](_0x1267cd,function(_0x22cbe4){if(_0x4a53a6){fs['unlink'](_0x1267cd);}});}}})[_0x24de('0x48')](function(_0x37f213){if(_0x37f213[_0x24de('0x5d')]===_0x24de('0x5a')){_0x58b0fd[_0x24de('0x1b')](0x194)[_0x24de('0x2c')](_0x24de('0x5e'));}else{return handleError(_0x58b0fd,null);}});};exports[_0x24de('0x5f')]=function(_0x365109,_0x49992a,_0x5c0371){var _0x1a727e=require(_0x24de('0x53'));var _0x30fb7a=![];var _0xdafdff={'$and':[db[_0x24de('0x60')][_0x24de('0x3d')](db[_0x24de('0x60')]['fn'](_0x24de('0x61'),db[_0x24de('0x60')]['col']('uniqueid')),_0x365109[_0x24de('0x34')]['token'])]};if(_0x365109[_0x24de('0x34')][_0x24de('0x3f')]&&_0x365109[_0x24de('0x34')][_0x24de('0x3f')]===_0x24de('0x54')){_0xdafdff[_0x24de('0x62')][_0x24de('0x63')]({'uniqueid':_0x365109[_0x24de('0x4a')]['id']});}else{_0xdafdff[_0x24de('0x62')][_0x24de('0x63')]({'id':_0x365109[_0x24de('0x4a')]['id']});}return db[_0x24de('0x44')]['find']({'where':_0xdafdff,'attributes':['id','value'],'raw':!![]})[_0x24de('0x26')](handleEntityNotFound(_0x49992a,null))['then'](function(_0x5bd7e7){if(_0x5bd7e7){var _0xfbc9ba=util['format']('%s.cypher',_0x5bd7e7[_0x24de('0x55')]);if(fs[_0x24de('0x56')](_0xfbc9ba)){_0x30fb7a=!![];return _0x1a727e[_0x24de('0x57')](_0xfbc9ba,_0x5bd7e7[_0x24de('0x55')],config[_0x24de('0x64')][_0x24de('0x58')])[_0x24de('0x26')](function(){return _0x5bd7e7;});}return _0x5bd7e7;}})[_0x24de('0x26')](function(_0x4ad7ac){if(_0x4ad7ac){if(!fs[_0x24de('0x56')](_0x4ad7ac[_0x24de('0x55')])){throw new db['Sequelize'][(_0x24de('0x65'))](_0x24de('0x5a'));}if(_0x4ad7ac['filename']){return _0x49992a['download'](_0x4ad7ac[_0x24de('0x55')],_0x4ad7ac[_0x24de('0x66')]+path['extname'](_0x4ad7ac[_0x24de('0x55')]),function(){if(_0x30fb7a){fs[_0x24de('0x5c')](_0x4ad7ac['value']);}});}else{return _0x49992a[_0x24de('0x52')](_0x4ad7ac[_0x24de('0x55')],function(_0x5cbc3b){if(_0x30fb7a){fs[_0x24de('0x5c')](_0x4ad7ac['value']);}});}}})[_0x24de('0x48')](handleError(_0x49992a,null));};exports[_0x24de('0x27')]=function(_0x278c06,_0x400665){return db[_0x24de('0x44')][_0x24de('0x4e')]({'where':{'id':_0x278c06['params']['id']}})['then'](function(_0x44a931){if(_['isNil'](_0x44a931)){throw new ReferenceError(_0x24de('0x67'));}return _0x44a931;})[_0x24de('0x26')](function(_0x3364a6){var _0x19c58c=_0x3364a6[_0x24de('0x55')];logger[_0x24de('0x68')](_0x24de('0x69'),_0x19c58c);if(!_[_0x24de('0x6a')](_0x3364a6[_0x24de('0x55')])&&fs[_0x24de('0x56')](_0x19c58c)){logger['info']('File:\x20\x22'+_0x19c58c+_0x24de('0x6b'));fs[_0x24de('0x6c')](_0x19c58c);}_0x19c58c=_0x19c58c+_0x24de('0x6d');if(!_['isNil'](_0x3364a6[_0x24de('0x55')])&&fs[_0x24de('0x56')](_0x19c58c)){logger[_0x24de('0x68')](_0x24de('0x6e')+_0x19c58c+_0x24de('0x6b'));fs[_0x24de('0x6c')](_0x19c58c);}return _0x3364a6;})['then'](function(_0x1d81ab){if(!_0x1d81ab)throw new InternalError();return _0x1d81ab[_0x24de('0x27')]();})[_0x24de('0x26')](function(){_0x400665[_0x24de('0x1b')](0xcc)['end']();})[_0x24de('0x48')](handleError(_0x400665,null));};function getBucketslist(_0x392af8,_0x206f22,_0x294d63){return new Promise(function(_0x59c73d,_0x4ad01d){var _0x3a0cc1=new AWS['S3']({'accessKeyId':_0x206f22,'secretAccessKey':_0x392af8,'region':_0x294d63});_0x3a0cc1[_0x24de('0x6f')]({},function(_0x361f45,_0x54bc78){if(_0x361f45){return _0x4ad01d(_0x361f45);}else{return _0x59c73d(_0x54bc78);}});});}function createBucket(_0x15bee5,_0x1186c3,_0x2da65e,_0x7d445e){return new Promise(function(_0x3c141c,_0x55807f){var _0x5a19d3=new AWS['S3']({'accessKeyId':_0x1186c3,'secretAccessKey':_0x15bee5,'region':_0x2da65e});_0x5a19d3[_0x24de('0x70')]({'Bucket':_0x7d445e},function(_0x1d0424,_0x22721d){if(_0x1d0424){return _0x55807f(_0x1d0424);}else{return _0x3c141c(_0x22721d);}});});}function uploadFile(_0x21f73e,_0x54e6ba,_0x2127ee,_0x520353,_0x3654e7,_0x311603){return new Promise(function(_0x493979,_0x31bf42){var _0x372d2d=new AWS['S3']({'accessKeyId':_0x54e6ba,'secretAccessKey':_0x21f73e,'region':_0x2127ee});_0x372d2d[_0x24de('0x71')]({'Bucket':_0x520353,'Key':_0x3654e7,'Body':_0x311603},function(_0x22fcbe,_0x4b488d){if(_0x22fcbe){return _0x31bf42(_0x22fcbe);}else{return _0x493979(_0x4b488d);}});});}function startTranscribe(_0x229316,_0x2527ac,_0x1e5e95,_0x2c62db,_0x1a4728,_0x579957){return new Promise(function(_0x5676fb,_0x2c588f){var _0x1bdc44=new AWS[(_0x24de('0x72'))]({'accessKeyId':_0x2527ac,'secretAccessKey':_0x229316,'region':_0x1e5e95});_0x1bdc44[_0x24de('0x73')]({'TranscriptionJobName':_0x2c62db,'LanguageCode':_0x1a4728,'Media':{'MediaFileUri':_0x579957}},function(_0xcda26c,_0x3e0afb){if(_0xcda26c){return _0x2c588f(_0xcda26c);}else{return _0x5676fb(_0x3e0afb);}});});}function transcribe(_0xe6e4d1,_0x2618ee,_0x59aa17,_0x162599,_0x2b474b,_0x271750,_0x2c0e69){return new Promise(function(_0x2b5300,_0x18c200){var _0x2af05e={};logger[_0x24de('0x68')](util[_0x24de('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xe6e4d1,_0x2b474b));return uploadFile(_0x2618ee,_0x59aa17,_0x162599,_0x2b474b,path['basename'](_0x271750),fs[_0x24de('0x74')](_0x271750))[_0x24de('0x26')](function(_0x13940a){logger[_0x24de('0x68')](util['format'](_0x24de('0x75'),_0xe6e4d1,_0x2b474b,_0x13940a[_0x24de('0x76')]));_0x2af05e[_0x24de('0x77')]=_0x13940a['Bucket'];_0x2af05e[_0x24de('0x78')]=_0x13940a[_0x24de('0x76')];logger['info'](util[_0x24de('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xe6e4d1));return startTranscribe(_0x2618ee,_0x59aa17,_0x162599,uuidv4(),_0x2c0e69,_0x13940a['Location']);})[_0x24de('0x26')](function(_0x269f3){logger[_0x24de('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0xe6e4d1,_0x269f3[_0x24de('0x79')][_0x24de('0x7a')]));_0x2af05e['transcribeName']=_0x269f3[_0x24de('0x79')]['TranscriptionJobName'];_0x2af05e[_0x24de('0x7b')]=_0x269f3['TranscriptionJob'][_0x24de('0x7c')];return _0x2b5300(_0x2af05e);})['catch'](function(_0x2a387e){return _0x18c200(_0x2a387e);});});}exports[_0x24de('0x7d')]=function(_0x4d0966,_0x19d945,_0x23b3b8){var _0x30ad16;var _0x5be054;var _0x26c218;var _0x42398a=require(_0x24de('0x53'));return db[_0x24de('0x44')][_0x24de('0x7e')]({'where':{'id':_0x4d0966[_0x24de('0x4a')]['id']}})[_0x24de('0x26')](function(_0x308f2a){if(_0x308f2a){var _0x2c1405=util['format']('%s.cypher',_0x308f2a[_0x24de('0x55')]);if(fs['existsSync'](_0x2c1405)){cypher=!![];return _0x42398a[_0x24de('0x57')](_0x2c1405,_0x308f2a[_0x24de('0x55')],config[_0x24de('0x64')][_0x24de('0x58')])[_0x24de('0x26')](function(){return _0x308f2a;});}return _0x308f2a;}})[_0x24de('0x26')](function(_0x52d5a4){if(!_0x52d5a4){throw new db[(_0x24de('0x59'))][(_0x24de('0x65'))](_0x24de('0x7f'));}_0x5be054=_0x52d5a4;return db['Setting'][_0x24de('0x7e')]({'where':{'id':0x1}});})[_0x24de('0x26')](handleEntityNotFound(_0x19d945,null))[_0x24de('0x26')](function(_0x2836bf){if(_0x2836bf){_0x30ad16=_0x2836bf;if(!_0x30ad16[_0x24de('0x80')]||!_0x30ad16[_0x24de('0x81')]||!_0x30ad16[_0x24de('0x82')]||!_0x30ad16[_0x24de('0x83')]||!_0x30ad16[_0x24de('0x77')]){throw new db[(_0x24de('0x59'))][(_0x24de('0x65'))](_0x24de('0x84'));}if(_0x4d0966[_0x24de('0x50')]['runSentiment']&&(!_0x30ad16[_0x24de('0x85')]||!_0x30ad16[_0x24de('0x86')]||!_0x30ad16[_0x24de('0x87')]||!_0x30ad16[_0x24de('0x83')]||!_0x30ad16[_0x24de('0x77')])){throw new db[(_0x24de('0x59'))][(_0x24de('0x65'))](_0x24de('0x88'));}return db[_0x24de('0x89')][_0x24de('0x7e')]({'where':{'id':_0x30ad16['transcribeAccountId']}});}})[_0x24de('0x26')](function(_0x205c71){if(!_0x205c71){throw new db[(_0x24de('0x59'))]['ValidationError'](_0x24de('0x8a'));}if(!_0x205c71['data1']||!_0x205c71['data2']){throw new db[(_0x24de('0x59'))][(_0x24de('0x65'))](_0x24de('0x8b'));}_0x26c218=_0x205c71;return getBucketslist(_0x26c218[_0x24de('0x8c')],_0x26c218[_0x24de('0x8d')],_0x30ad16[_0x24de('0x82')]);})[_0x24de('0x26')](function(_0x177535){if(_0x177535&&_0x177535[_0x24de('0x8e')]){var _0x11580a=_['find'](_0x177535['Buckets'],function(_0x307768){return _0x307768[_0x24de('0x8f')]===_0x30ad16[_0x24de('0x77')];});if(!_0x11580a){logger[_0x24de('0x68')](util[_0x24de('0x33')](_0x24de('0x90'),_0x4d0966[_0x24de('0x4a')]['id'],_0x30ad16['bucket']));return createBucket(_0x26c218[_0x24de('0x8c')],_0x26c218[_0x24de('0x8d')],_0x30ad16[_0x24de('0x82')],_0x30ad16['bucket']);}logger[_0x24de('0x68')](util[_0x24de('0x33')](_0x24de('0x91'),_0x4d0966['params']['id'],_0x30ad16[_0x24de('0x77')]));return;}})[_0x24de('0x26')](function(_0x2d7a11){if(_0x5be054['transcribeStatus']===_0x24de('0x92')){return transcribe(_0x4d0966[_0x24de('0x4a')]['id'],_0x26c218[_0x24de('0x8c')],_0x26c218['data2'],_0x30ad16[_0x24de('0x82')],_0x30ad16['bucket'],_0x5be054[_0x24de('0x55')],_0x30ad16[_0x24de('0x83')]);}else{logger[_0x24de('0x68')](util[_0x24de('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4d0966[_0x24de('0x4a')]['id']));return{'transcribeStatus':_0x24de('0x93')};}})[_0x24de('0x26')](function(_0x2a36ae){if(_0x2a36ae){_0x2a36ae['tempSentiment']=_0x4d0966[_0x24de('0x50')][_0x24de('0x94')];return _0x5be054[_0x24de('0x95')](_0x2a36ae);}})[_0x24de('0x26')](respondWithResult(_0x19d945,null))['catch'](handleError(_0x19d945,null));};function writeFile(_0x25f7db,_0x2154ac){return new Promise(function(_0x2c5286,_0x3ecfcd){fs['writeFile'](_0x2154ac,_0x25f7db,function(_0x3454b5,_0x29b10b){if(_0x3454b5){return _0x3ecfcd(_0x3454b5);}else{return _0x2c5286(_0x29b10b);}});});}exports['downloadTranscribe']=function(_0x206dbc,_0x30621a,_0x5af2f1){return db['VoiceRecording']['findOne']({'where':{'id':_0x206dbc[_0x24de('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30621a))[_0x24de('0x26')](function(_0x139a32){if(_0x139a32&&_0x139a32['fileText']){var _0x24431c=_0x139a32['fileText'];var _0x41b671=config[_0x24de('0x96')]+_0x24de('0x97')+_0x139a32['id']+_0x24de('0x98');if(fs[_0x24de('0x56')](_0x41b671)){return _0x41b671;}return writeFile(_0x24431c,_0x41b671)[_0x24de('0x26')](function(){return _0x41b671;});}else{throw new db[(_0x24de('0x59'))][(_0x24de('0x65'))](_0x24de('0x99'));}})['then'](function(_0xa6991d){return _0x30621a[_0x24de('0x52')](_0xa6991d);})['catch'](handleError(_0x30621a));}; \ No newline at end of file +var _0x0fc5=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','bucket','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','end','sendStatus','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','catch','params','keys','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','Not\x20found','sequelize','MD5','col','token','$and','push','VoiceRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync'];(function(_0x582ccd,_0xa9ab43){var _0x11545d=function(_0x4010fa){while(--_0x4010fa){_0x582ccd['push'](_0x582ccd['shift']());}};_0x11545d(++_0xa9ab43);}(_0x0fc5,0xbd));var _0x50fc=function(_0x279df8,_0x58ac13){_0x279df8=_0x279df8-0x0;var _0x180824=_0x0fc5[_0x279df8];return _0x180824;};'use strict';var emlformat=require(_0x50fc('0x0'));var rimraf=require(_0x50fc('0x1'));var zipdir=require(_0x50fc('0x2'));var jsonpatch=require(_0x50fc('0x3'));var rp=require(_0x50fc('0x4'));var moment=require('moment');var BPromise=require(_0x50fc('0x5'));var Mustache=require('mustache');var util=require(_0x50fc('0x6'));var path=require(_0x50fc('0x7'));var sox=require(_0x50fc('0x8'));var csv=require(_0x50fc('0x9'));var ejs=require(_0x50fc('0xa'));var fs=require('fs');var fs_extra=require(_0x50fc('0xb'));var _=require(_0x50fc('0xc'));var squel=require('squel');var crypto=require(_0x50fc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x50fc('0xe'));var toCsv=require(_0x50fc('0x9'));var querystring=require(_0x50fc('0xf'));var Papa=require(_0x50fc('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x50fc('0x11'));var Redis=require('ioredis');var authService=require(_0x50fc('0x12'));var qs=require(_0x50fc('0x13'));var as=require(_0x50fc('0x14'));var hardwareService=require(_0x50fc('0x15'));var logger=require(_0x50fc('0x16'))('api');var utils=require(_0x50fc('0x17'));var config=require(_0x50fc('0x18'));var licenseUtil=require(_0x50fc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d21d,_0x1b2a15){_0x1b2a15=_0x1b2a15||0xcc;return function(_0x16e5f2){if(_0x16e5f2){return _0x58d21d['sendStatus'](_0x1b2a15);}return _0x58d21d[_0x50fc('0x1a')](_0x1b2a15)['end']();};}function respondWithResult(_0x3dbf3e,_0x3075fc){_0x3075fc=_0x3075fc||0xc8;return function(_0x2369fa){if(_0x2369fa){return _0x3dbf3e['status'](_0x3075fc)[_0x50fc('0x1b')](_0x2369fa);}};}function respondWithFilteredResult(_0x3512a9,_0xbf6599){return function(_0xf0e0ba){if(_0xf0e0ba){var _0x1da3fb=typeof _0xbf6599['offset']===_0x50fc('0x1c')&&typeof _0xbf6599['limit']===_0x50fc('0x1c');var _0x26e498=_0xf0e0ba[_0x50fc('0x1d')];var _0x2e892a=_0x1da3fb?0x0:_0xbf6599[_0x50fc('0x1e')];var _0x511874=_0x1da3fb?_0xf0e0ba['count']:_0xbf6599[_0x50fc('0x1e')]+_0xbf6599[_0x50fc('0x1f')];var _0x1a2d04;if(_0x511874>=_0x26e498){_0x511874=_0x26e498;_0x1a2d04=0xc8;}else{_0x1a2d04=0xce;}_0x3512a9[_0x50fc('0x1a')](_0x1a2d04);return _0x3512a9[_0x50fc('0x20')]('Content-Range',_0x2e892a+'-'+_0x511874+'/'+_0x26e498)['json'](_0xf0e0ba);}return null;};}function patchUpdates(_0x32c2be){return function(_0x343f14){try{jsonpatch[_0x50fc('0x21')](_0x343f14,_0x32c2be,!![]);}catch(_0x564b34){return BPromise['reject'](_0x564b34);}return _0x343f14[_0x50fc('0x22')]();};}function saveUpdates(_0xced0d9,_0x438a34){return function(_0x30b7a3){if(_0x30b7a3){return _0x30b7a3[_0x50fc('0x23')](_0xced0d9)[_0x50fc('0x24')](function(_0x37c94f){return _0x37c94f;});}return null;};}function removeEntity(_0x3b8348,_0x2149dc){return function(_0x12d6f2){if(_0x12d6f2){return _0x12d6f2[_0x50fc('0x25')]()[_0x50fc('0x24')](function(){_0x3b8348[_0x50fc('0x1a')](0xcc)[_0x50fc('0x26')]();});}};}function handleEntityNotFound(_0x2812ae,_0x4726db){return function(_0xb98671){if(!_0xb98671){_0x2812ae[_0x50fc('0x27')](0x194);}return _0xb98671;};}function handleError(_0x563a3e,_0x54fa9b){_0x54fa9b=_0x54fa9b||0x1f4;return function(_0x140c0f){logger['error'](_0x140c0f['stack']);if(_0x140c0f[_0x50fc('0x28')]){delete _0x140c0f[_0x50fc('0x28')];}_0x563a3e[_0x50fc('0x1a')](_0x54fa9b)[_0x50fc('0x29')](_0x140c0f);};}exports[_0x50fc('0x2a')]=function(_0x344c60,_0x39a44d){var _0x3b44da={},_0x2122b5={},_0xfbce23={'count':0x0,'rows':[]};var _0x1449b5=_[_0x50fc('0x2b')](db[_0x50fc('0x2c')][_0x50fc('0x2d')],function(_0x234bc1){return{'name':_0x234bc1[_0x50fc('0x2e')],'type':_0x234bc1[_0x50fc('0x2f')][_0x50fc('0x30')]};});_0x2122b5[_0x50fc('0x31')]=_[_0x50fc('0x32')](_['map'](_0x1449b5,_0x50fc('0x28')),[_0x50fc('0x33')]);_0x2122b5['query']=_['keys'](_0x344c60[_0x50fc('0x34')]);_0x2122b5[_0x50fc('0x35')]=_[_0x50fc('0x36')](_0x2122b5[_0x50fc('0x31')],_0x2122b5[_0x50fc('0x34')]);_0x3b44da['attributes']=_[_0x50fc('0x36')](_0x2122b5[_0x50fc('0x31')],qs[_0x50fc('0x37')](_0x344c60['query'][_0x50fc('0x37')]));_0x3b44da[_0x50fc('0x38')]=_0x3b44da[_0x50fc('0x38')][_0x50fc('0x39')]?_0x3b44da[_0x50fc('0x38')]:_0x2122b5['model'];if(!_0x344c60[_0x50fc('0x34')][_0x50fc('0x3a')](_0x50fc('0x3b'))){_0x3b44da[_0x50fc('0x1f')]=qs[_0x50fc('0x1f')](_0x344c60['query'][_0x50fc('0x1f')]);_0x3b44da[_0x50fc('0x1e')]=qs[_0x50fc('0x1e')](_0x344c60[_0x50fc('0x34')][_0x50fc('0x1e')]);}_0x3b44da[_0x50fc('0x3c')]=qs['sort'](_0x344c60[_0x50fc('0x34')][_0x50fc('0x3d')]);_0x3b44da['where']=qs[_0x50fc('0x35')](_[_0x50fc('0x3e')](_0x344c60[_0x50fc('0x34')],_0x2122b5[_0x50fc('0x35')]),_0x1449b5);if(_0x344c60[_0x50fc('0x34')][_0x50fc('0x3f')]){_0x3b44da['where']=_[_0x50fc('0x40')](_0x3b44da[_0x50fc('0x41')],{'$or':_[_0x50fc('0x2b')](_0x1449b5,function(_0x404c15){if(_0x404c15['type']!=='VIRTUAL'){var _0x3a2770={};_0x3a2770[_0x404c15['name']]={'$like':'%'+_0x344c60['query'][_0x50fc('0x3f')]+'%'};return _0x3a2770;}})});}_0x3b44da=_['merge']({},_0x3b44da,_0x344c60['options']);var _0x2e3887={'where':_0x3b44da[_0x50fc('0x41')]};return db[_0x50fc('0x2c')][_0x50fc('0x1d')](_0x2e3887)[_0x50fc('0x24')](function(_0xb204ef){_0xfbce23[_0x50fc('0x1d')]=_0xb204ef;if(_0x344c60['query'][_0x50fc('0x42')]){_0x3b44da[_0x50fc('0x43')]=[{'all':!![]}];}return db[_0x50fc('0x2c')]['findAll'](_0x3b44da);})[_0x50fc('0x24')](function(_0xc042eb){_0xfbce23['rows']=_0xc042eb;return _0xfbce23;})[_0x50fc('0x24')](respondWithFilteredResult(_0x39a44d,_0x3b44da))[_0x50fc('0x44')](handleError(_0x39a44d,null));};exports['show']=function(_0x40a72c,_0x5348a9){var _0x39118a={'raw':![],'where':{'id':_0x40a72c[_0x50fc('0x45')]['id']}},_0x31a082={};_0x31a082[_0x50fc('0x31')]=_[_0x50fc('0x46')](db[_0x50fc('0x2c')][_0x50fc('0x2d')]);_0x31a082[_0x50fc('0x34')]=_[_0x50fc('0x46')](_0x40a72c[_0x50fc('0x34')]);_0x31a082['filters']=_['intersection'](_0x31a082[_0x50fc('0x31')],_0x31a082[_0x50fc('0x34')]);_0x39118a[_0x50fc('0x38')]=_[_0x50fc('0x36')](_0x31a082['model'],qs[_0x50fc('0x37')](_0x40a72c[_0x50fc('0x34')][_0x50fc('0x37')]));_0x39118a[_0x50fc('0x38')]=_0x39118a['attributes'][_0x50fc('0x39')]?_0x39118a[_0x50fc('0x38')]:_0x31a082['model'];if(_0x40a72c[_0x50fc('0x34')][_0x50fc('0x42')]){_0x39118a[_0x50fc('0x43')]=[{'all':!![]}];}_0x39118a=_['merge']({},_0x39118a,_0x40a72c['options']);return db[_0x50fc('0x2c')]['find'](_0x39118a)[_0x50fc('0x24')](handleEntityNotFound(_0x5348a9,null))[_0x50fc('0x24')](respondWithResult(_0x5348a9,null))[_0x50fc('0x44')](handleError(_0x5348a9,null));};exports[_0x50fc('0x47')]=function(_0x27bba3,_0x339578){return db['VoiceRecording'][_0x50fc('0x47')](_0x27bba3['body'],{})[_0x50fc('0x24')](respondWithResult(_0x339578,0xc9))[_0x50fc('0x44')](handleError(_0x339578,null));};exports['update']=function(_0x4ab890,_0x282d36){if(_0x4ab890[_0x50fc('0x48')]['id']){delete _0x4ab890[_0x50fc('0x48')]['id'];}return db[_0x50fc('0x2c')]['find']({'where':{'id':_0x4ab890[_0x50fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x282d36,null))[_0x50fc('0x24')](saveUpdates(_0x4ab890['body'],null))['then'](respondWithResult(_0x282d36,null))['catch'](handleError(_0x282d36,null));};exports[_0x50fc('0x49')]=function(_0x2cb24b,_0x7ce0c){return db[_0x50fc('0x2c')]['describe']()[_0x50fc('0x24')](respondWithResult(_0x7ce0c,null))[_0x50fc('0x44')](handleError(_0x7ce0c,null));};exports[_0x50fc('0x4a')]=function(_0x1d94c5,_0x3e47d7,_0x37339f){var _0x4e3764=require(_0x50fc('0x4b'));var _0x3b34e2=![];var _0x518682={};if(_0x1d94c5['query'][_0x50fc('0x2f')]&&_0x1d94c5['query']['type']===_0x50fc('0x4c')){_0x518682['uniqueid']=_0x1d94c5[_0x50fc('0x45')]['id'];}else{_0x518682['id']=_0x1d94c5[_0x50fc('0x45')]['id'];}return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':_0x518682,'attributes':['id','value'],'raw':!![]})[_0x50fc('0x24')](handleEntityNotFound(_0x3e47d7,null))['then'](function(_0x5bccaf){if(_0x5bccaf){var _0x1bc167=_0x5bccaf[_0x50fc('0x4e')];var _0x1af93a=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x1bc167);if(fs[_0x50fc('0x50')](_0x1af93a)){_0x3b34e2=!![];return _0x4e3764[_0x50fc('0x51')](_0x1af93a,_0x1bc167,config[_0x50fc('0x52')][_0x50fc('0x53')])['then'](function(){return _0x5bccaf;});}return _0x5bccaf;}})[_0x50fc('0x24')](function(_0x27f71a){if(_0x27f71a){var _0x3ea04a=_0x27f71a[_0x50fc('0x4e')];if(!fs[_0x50fc('0x50')](_0x3ea04a)){throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x27f71a[_0x50fc('0x56')]){return _0x3e47d7[_0x50fc('0x4a')](_0x3ea04a,_0x27f71a[_0x50fc('0x56')]+path[_0x50fc('0x57')](_0x3ea04a),function(){if(_0x3b34e2){fs[_0x50fc('0x58')](_0x3ea04a);}});}else{return _0x3e47d7[_0x50fc('0x4a')](_0x3ea04a,function(_0x2c75c0){if(_0x3b34e2){fs[_0x50fc('0x58')](_0x3ea04a);}});}}})[_0x50fc('0x44')](function(_0x322d8c){if(_0x322d8c['message']==='VoiceRecording\x20not\x20found'){_0x3e47d7[_0x50fc('0x1a')](0x194)[_0x50fc('0x29')](_0x50fc('0x59'));}else{return handleError(_0x3e47d7,null);}});};exports['downloads']=function(_0x5ee4b8,_0x1f5c40,_0x37aaf0){var _0x2889ce=require(_0x50fc('0x4b'));var _0x12118d=![];var _0x1bd282={'$and':[db[_0x50fc('0x5a')][_0x50fc('0x41')](db[_0x50fc('0x5a')]['fn'](_0x50fc('0x5b'),db[_0x50fc('0x5a')][_0x50fc('0x5c')](_0x50fc('0x4c'))),_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x5d')])]};if(_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x2f')]&&_0x5ee4b8[_0x50fc('0x34')][_0x50fc('0x2f')]===_0x50fc('0x4c')){_0x1bd282[_0x50fc('0x5e')][_0x50fc('0x5f')]({'uniqueid':_0x5ee4b8[_0x50fc('0x45')]['id']});}else{_0x1bd282[_0x50fc('0x5e')][_0x50fc('0x5f')]({'id':_0x5ee4b8['params']['id']});}return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':_0x1bd282,'attributes':['id',_0x50fc('0x4e')],'raw':!![]})[_0x50fc('0x24')](handleEntityNotFound(_0x1f5c40,null))[_0x50fc('0x24')](function(_0x587040){if(_0x587040){var _0x352ba2=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x587040[_0x50fc('0x4e')]);if(fs['existsSync'](_0x352ba2)){_0x12118d=!![];return _0x2889ce[_0x50fc('0x51')](_0x352ba2,_0x587040['value'],config[_0x50fc('0x52')][_0x50fc('0x53')])['then'](function(){return _0x587040;});}return _0x587040;}})[_0x50fc('0x24')](function(_0x51e9fe){if(_0x51e9fe){if(!fs[_0x50fc('0x50')](_0x51e9fe[_0x50fc('0x4e')])){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x60'));}if(_0x51e9fe[_0x50fc('0x56')]){return _0x1f5c40[_0x50fc('0x4a')](_0x51e9fe['value'],_0x51e9fe[_0x50fc('0x56')]+path[_0x50fc('0x57')](_0x51e9fe[_0x50fc('0x4e')]),function(){if(_0x12118d){fs['unlink'](_0x51e9fe[_0x50fc('0x4e')]);}});}else{return _0x1f5c40[_0x50fc('0x4a')](_0x51e9fe[_0x50fc('0x4e')],function(_0x269152){if(_0x12118d){fs[_0x50fc('0x58')](_0x51e9fe[_0x50fc('0x4e')]);}});}}})[_0x50fc('0x44')](handleError(_0x1f5c40,null));};exports[_0x50fc('0x25')]=function(_0x1834dd,_0xc97c77){return db[_0x50fc('0x2c')][_0x50fc('0x4d')]({'where':{'id':_0x1834dd[_0x50fc('0x45')]['id']}})[_0x50fc('0x24')](function(_0x284481){if(_['isNil'](_0x284481)){throw new ReferenceError(_0x50fc('0x61'));}return _0x284481;})[_0x50fc('0x24')](function(_0x5cfb3a){var _0x4f8f7=_0x5cfb3a[_0x50fc('0x4e')];logger[_0x50fc('0x62')](_0x50fc('0x63'),_0x4f8f7);if(!_[_0x50fc('0x64')](_0x5cfb3a[_0x50fc('0x4e')])&&fs['existsSync'](_0x4f8f7)){logger[_0x50fc('0x62')](_0x50fc('0x65')+_0x4f8f7+_0x50fc('0x66'));fs[_0x50fc('0x67')](_0x4f8f7);}_0x4f8f7=_0x4f8f7+_0x50fc('0x68');if(!_[_0x50fc('0x64')](_0x5cfb3a[_0x50fc('0x4e')])&&fs[_0x50fc('0x50')](_0x4f8f7)){logger['info'](_0x50fc('0x65')+_0x4f8f7+_0x50fc('0x66'));fs[_0x50fc('0x67')](_0x4f8f7);}return _0x5cfb3a;})[_0x50fc('0x24')](function(_0x204886){if(!_0x204886)throw new InternalError();return _0x204886[_0x50fc('0x25')]();})[_0x50fc('0x24')](function(){_0xc97c77[_0x50fc('0x1a')](0xcc)[_0x50fc('0x26')]();})[_0x50fc('0x44')](handleError(_0xc97c77,null));};function getBucketslist(_0x1205d3,_0x195746,_0x50c995){return new Promise(function(_0x5e3f81,_0x484d2b){var _0x47f4d9=new AWS['S3']({'accessKeyId':_0x195746,'secretAccessKey':_0x1205d3,'region':_0x50c995});_0x47f4d9[_0x50fc('0x69')]({},function(_0x296eba,_0x22072b){if(_0x296eba){return _0x484d2b(_0x296eba);}else{return _0x5e3f81(_0x22072b);}});});}function createBucket(_0x3b3e04,_0x5c1299,_0x40c7a3,_0x1cbcb8){return new Promise(function(_0x204033,_0x408808){var _0x3063c8=new AWS['S3']({'accessKeyId':_0x5c1299,'secretAccessKey':_0x3b3e04,'region':_0x40c7a3});_0x3063c8[_0x50fc('0x6a')]({'Bucket':_0x1cbcb8},function(_0x2a06b9,_0x189b2f){if(_0x2a06b9){return _0x408808(_0x2a06b9);}else{return _0x204033(_0x189b2f);}});});}function uploadFile(_0x50aa51,_0x115f5b,_0x31de38,_0x116c5d,_0x2c35a2,_0x1123b3){return new Promise(function(_0x181b31,_0x18b81f){var _0x3dd043=new AWS['S3']({'accessKeyId':_0x115f5b,'secretAccessKey':_0x50aa51,'region':_0x31de38});_0x3dd043['upload']({'Bucket':_0x116c5d,'Key':_0x2c35a2,'Body':_0x1123b3},function(_0x2b78b4,_0x4c6bd4){if(_0x2b78b4){return _0x18b81f(_0x2b78b4);}else{return _0x181b31(_0x4c6bd4);}});});}function startTranscribe(_0x8d1b8f,_0x203829,_0x3ecf18,_0x5ec359,_0x1ac9d2,_0x13b12a){return new Promise(function(_0x325aa7,_0x403541){var _0x1090d6=new AWS[(_0x50fc('0x6b'))]({'accessKeyId':_0x203829,'secretAccessKey':_0x8d1b8f,'region':_0x3ecf18});_0x1090d6[_0x50fc('0x6c')]({'TranscriptionJobName':_0x5ec359,'LanguageCode':_0x1ac9d2,'Media':{'MediaFileUri':_0x13b12a}},function(_0x473375,_0x10fd6b){if(_0x473375){return _0x403541(_0x473375);}else{return _0x325aa7(_0x10fd6b);}});});}function transcribe(_0x37945a,_0xbc923e,_0x18eb5e,_0x58a68d,_0x7f2dc,_0x3d6a9b,_0x6acb4d){return new Promise(function(_0x4ca4b8,_0x2b0c81){var _0x385890={};logger['info'](util['format'](_0x50fc('0x6d'),_0x37945a,_0x7f2dc));return uploadFile(_0xbc923e,_0x18eb5e,_0x58a68d,_0x7f2dc,path['basename'](_0x3d6a9b),fs[_0x50fc('0x6e')](_0x3d6a9b))[_0x50fc('0x24')](function(_0x5d6401){logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x6f'),_0x37945a,_0x7f2dc,_0x5d6401[_0x50fc('0x70')]));_0x385890['bucket']=_0x5d6401[_0x50fc('0x71')];_0x385890[_0x50fc('0x72')]=_0x5d6401['Location'];logger[_0x50fc('0x62')](util['format'](_0x50fc('0x73'),_0x37945a));return startTranscribe(_0xbc923e,_0x18eb5e,_0x58a68d,uuidv4(),_0x6acb4d,_0x5d6401['Location']);})[_0x50fc('0x24')](function(_0x29248c){logger['info'](util[_0x50fc('0x33')](_0x50fc('0x74'),_0x37945a,_0x29248c[_0x50fc('0x75')]['TranscriptionJobName']));_0x385890[_0x50fc('0x76')]=_0x29248c[_0x50fc('0x75')][_0x50fc('0x77')];_0x385890[_0x50fc('0x78')]=_0x29248c[_0x50fc('0x75')][_0x50fc('0x79')];return _0x4ca4b8(_0x385890);})[_0x50fc('0x44')](function(_0x2822ce){return _0x2b0c81(_0x2822ce);});});}exports[_0x50fc('0x7a')]=function(_0x4f96dd,_0x4928a9,_0x4ad369){var _0x34306e;var _0x416919;var _0x2b7807;var _0x263904=require(_0x50fc('0x4b'));return db[_0x50fc('0x2c')][_0x50fc('0x7b')]({'where':{'id':_0x4f96dd[_0x50fc('0x45')]['id']}})['then'](function(_0x14ff98){if(_0x14ff98){var _0x3e8461=util[_0x50fc('0x33')](_0x50fc('0x4f'),_0x14ff98[_0x50fc('0x4e')]);if(fs['existsSync'](_0x3e8461)){cypher=!![];return _0x263904[_0x50fc('0x51')](_0x3e8461,_0x14ff98[_0x50fc('0x4e')],config[_0x50fc('0x52')]['recording'])[_0x50fc('0x24')](function(){return _0x14ff98;});}return _0x14ff98;}})['then'](function(_0x53f351){if(!_0x53f351){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x7c'));}_0x416919=_0x53f351;return db[_0x50fc('0x7d')][_0x50fc('0x7b')]({'where':{'id':0x1}});})[_0x50fc('0x24')](handleEntityNotFound(_0x4928a9,null))[_0x50fc('0x24')](function(_0x47dd24){if(_0x47dd24){_0x34306e=_0x47dd24;if(!_0x34306e['transcribe']||!_0x34306e[_0x50fc('0x7e')]||!_0x34306e[_0x50fc('0x7f')]||!_0x34306e[_0x50fc('0x80')]||!_0x34306e['bucket']){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x81'));}if(_0x4f96dd['body'][_0x50fc('0x82')]&&(!_0x34306e['sentiment']||!_0x34306e[_0x50fc('0x83')]||!_0x34306e[_0x50fc('0x84')]||!_0x34306e[_0x50fc('0x80')]||!_0x34306e['bucket'])){throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x50fc('0x85')][_0x50fc('0x7b')]({'where':{'id':_0x34306e[_0x50fc('0x7e')]}});}})[_0x50fc('0x24')](function(_0x3bca5b){if(!_0x3bca5b){throw new db['Sequelize'][(_0x50fc('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3bca5b[_0x50fc('0x86')]||!_0x3bca5b['data2']){throw new db[(_0x50fc('0x54'))]['ValidationError'](_0x50fc('0x87'));}_0x2b7807=_0x3bca5b;return getBucketslist(_0x2b7807[_0x50fc('0x86')],_0x2b7807[_0x50fc('0x88')],_0x34306e[_0x50fc('0x7f')]);})[_0x50fc('0x24')](function(_0x1f240c){if(_0x1f240c&&_0x1f240c[_0x50fc('0x89')]){var _0x52522e=_[_0x50fc('0x4d')](_0x1f240c['Buckets'],function(_0x210df6){return _0x210df6['Name']===_0x34306e[_0x50fc('0x8a')];});if(!_0x52522e){logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x8b'),_0x4f96dd[_0x50fc('0x45')]['id'],_0x34306e[_0x50fc('0x8a')]));return createBucket(_0x2b7807[_0x50fc('0x86')],_0x2b7807['data2'],_0x34306e['transcribeRegion'],_0x34306e[_0x50fc('0x8a')]);}logger[_0x50fc('0x62')](util[_0x50fc('0x33')](_0x50fc('0x8c'),_0x4f96dd[_0x50fc('0x45')]['id'],_0x34306e[_0x50fc('0x8a')]));return;}})[_0x50fc('0x24')](function(_0x4f916c){if(_0x416919[_0x50fc('0x78')]===_0x50fc('0x8d')){return transcribe(_0x4f96dd['params']['id'],_0x2b7807['data1'],_0x2b7807[_0x50fc('0x88')],_0x34306e['transcribeRegion'],_0x34306e['bucket'],_0x416919['value'],_0x34306e[_0x50fc('0x80')]);}else{logger['info'](util[_0x50fc('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4f96dd[_0x50fc('0x45')]['id']));return{'transcribeStatus':_0x50fc('0x8e')};}})[_0x50fc('0x24')](function(_0x4f4558){if(_0x4f4558){_0x4f4558[_0x50fc('0x8f')]=_0x4f96dd['body']['runSentiment'];return _0x416919[_0x50fc('0x90')](_0x4f4558);}})[_0x50fc('0x24')](respondWithResult(_0x4928a9,null))[_0x50fc('0x44')](handleError(_0x4928a9,null));};function writeFile(_0xae351b,_0x156d80){return new Promise(function(_0x4926b5,_0x44e7f7){fs[_0x50fc('0x91')](_0x156d80,_0xae351b,function(_0x13fc04,_0x4e825d){if(_0x13fc04){return _0x44e7f7(_0x13fc04);}else{return _0x4926b5(_0x4e825d);}});});}exports[_0x50fc('0x92')]=function(_0xf7265b,_0x145cac,_0x2ca733){return db[_0x50fc('0x2c')]['findOne']({'where':{'id':_0xf7265b[_0x50fc('0x45')]['id']}})['then'](handleEntityNotFound(_0x145cac))['then'](function(_0x42f3ce){if(_0x42f3ce&&_0x42f3ce[_0x50fc('0x93')]){var _0x48098e=_0x42f3ce[_0x50fc('0x93')];var _0x44ef14=config['root']+_0x50fc('0x94')+_0x42f3ce['id']+_0x50fc('0x95');if(fs[_0x50fc('0x50')](_0x44ef14)){return _0x44ef14;}return writeFile(_0x48098e,_0x44ef14)[_0x50fc('0x24')](function(){return _0x44ef14;});}else{throw new db[(_0x50fc('0x54'))][(_0x50fc('0x55'))]('Transcript\x20not\x20available');}})[_0x50fc('0x24')](function(_0x381d92){return _0x145cac['download'](_0x381d92);})[_0x50fc('0x44')](handleError(_0x145cac));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6a780fa..33e1012 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 _0xd2f8=['../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x598f7e,_0xeb61e1){var _0x10e5fe=function(_0x16b06f){while(--_0x16b06f){_0x598f7e['push'](_0x598f7e['shift']());}};_0x10e5fe(++_0xeb61e1);}(_0xd2f8,0x95));var _0x8d2f=function(_0x19b709,_0x373b44){_0x19b709=_0x19b709-0x0;var _0x29eb28=_0xd2f8[_0x19b709];return _0x29eb28;};'use strict';var _=require(_0x8d2f('0x0'));var util=require(_0x8d2f('0x1'));var logger=require(_0x8d2f('0x2'))(_0x8d2f('0x3'));var moment=require(_0x8d2f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d2f('0x5'));var rimraf=require(_0x8d2f('0x6'));var config=require(_0x8d2f('0x7'));var attributes=require(_0x8d2f('0x8'));module[_0x8d2f('0x9')]=function(_0x3ab9e0,_0x1113e1){return _0x3ab9e0['define'](_0x8d2f('0xa'),attributes,{'tableName':_0x8d2f('0xb'),'paranoid':![],'indexes':[{'name':_0x8d2f('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x11e3=['VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x3a8ff0,_0x49fc6e){var _0x46d6ba=function(_0xc73be8){while(--_0xc73be8){_0x3a8ff0['push'](_0x3a8ff0['shift']());}};_0x46d6ba(++_0x49fc6e);}(_0x11e3,0x6f));var _0x311e=function(_0xe51299,_0x1f1a98){_0xe51299=_0xe51299-0x0;var _0x2efed7=_0x11e3[_0xe51299];return _0x2efed7;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var logger=require(_0x311e('0x2'))(_0x311e('0x3'));var moment=require('moment');var BPromise=require(_0x311e('0x4'));var rp=require(_0x311e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x311e('0x6'));var config=require(_0x311e('0x7'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0xe46ee6,_0xd18f09){return _0xe46ee6[_0x311e('0x8')](_0x311e('0x9'),attributes,{'tableName':_0x311e('0xa'),'paranoid':![],'indexes':[{'name':_0x311e('0xb'),'fields':[_0x311e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index e18756a..0cb0197 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 _0x77d4=['%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format'];(function(_0x3ce9ba,_0x38de28){var _0x34a5d9=function(_0x3f5b20){while(--_0x3f5b20){_0x3ce9ba['push'](_0x3ce9ba['shift']());}};_0x34a5d9(++_0x38de28);}(_0x77d4,0x108));var _0x477d=function(_0x56ac97,_0x2fc64a){_0x56ac97=_0x56ac97-0x0;var _0x14ef2f=_0x77d4[_0x56ac97];return _0x14ef2f;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')](_0x5d5553[_0x477d('0x16')],{'raw':_0x5d5553['options']?_0x5d5553[_0x477d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x17')]?_0x5d5553[_0x477d('0x17')][_0x477d('0x1a')]||null:null})[_0x477d('0x9')](function(_0x3d2943){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1b')]('UpdateVoiceRecording',_0x5d5553,JSON[_0x477d('0xe')](_0x3d2943));_0x1399d7(_0x3d2943);})['catch'](function(_0x239b56){logger[_0x477d('0xf')](_0x477d('0x13'),_0x239b56[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965['error'](0x1f4,_0x239b56[_0x477d('0x11')]));});});};exports[_0x477d('0x1c')]=function(_0x1ca4fe){var _0x48ee5e=this;return new Promise(function(_0x585648,_0x198697){var _0x3c6270=require(_0x477d('0x1d'));var _0x5c8ef1;return db[_0x477d('0x1e')][_0x477d('0x1f')]({'attributes':['id',_0x477d('0x20')],'where':{'id':0x1},'raw':!![]})[_0x477d('0x9')](function(_0x37b332){_0x5c8ef1=_0x37b332;return db['VoiceRecording'][_0x477d('0x21')](_0x1ca4fe[_0x477d('0x16')]);})[_0x477d('0x9')](function(_0x25a329){if(_0x5c8ef1[_0x477d('0x20')]&&fs[_0x477d('0x22')](_0x25a329[_0x477d('0x23')])){var _0x98b5d9=util[_0x477d('0x24')](_0x477d('0x25'),_0x25a329[_0x477d('0x23')]);return _0x3c6270[_0x477d('0x26')](_0x25a329[_0x477d('0x23')],_0x98b5d9,config[_0x477d('0x27')][_0x477d('0x28')])[_0x477d('0x9')](function(){fs[_0x477d('0x29')](_0x25a329[_0x477d('0x23')]);logger[_0x477d('0xa')](_0x477d('0x2a'));return _0x25a329;});}return _0x25a329;})['then'](function(_0x304d25){logger['info'](_0x477d('0x1c'),_0x1ca4fe);logger[_0x477d('0x1b')](_0x477d('0x1c'),_0x1ca4fe,JSON['stringify'](_0x304d25));_0x585648(_0x304d25);})[_0x477d('0x12')](function(_0x1201a9){logger[_0x477d('0xf')](_0x477d('0x1c'),_0x1201a9[_0x477d('0x11')],_0x1ca4fe);_0x198697(_0x48ee5e[_0x477d('0xf')](0x1f4,_0x1201a9[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0x8aad=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info'];(function(_0x27bc6d,_0x4ece2a){var _0x6c9f0=function(_0x1741b6){while(--_0x1741b6){_0x27bc6d['push'](_0x27bc6d['shift']());}};_0x6c9f0(++_0x4ece2a);}(_0x8aad,0x146));var _0xd8aa=function(_0x2cd584,_0x189ec4){_0x2cd584=_0x2cd584-0x0;var _0x12e780=_0x8aad[_0x2cd584];return _0x12e780;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});}exports[_0xd8aa('0x14')]=function(_0x32e2cd){var _0x3a29ca=this;return new Promise(function(_0x2d34ac,_0x4953be){return db[_0xd8aa('0x15')][_0xd8aa('0x16')](_0x32e2cd[_0xd8aa('0x17')],{'raw':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')][_0xd8aa('0x1a')]||null:null,'attributes':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd['options'][_0xd8aa('0x1b')]||null:null,'limit':_0x32e2cd[_0xd8aa('0x18')]?_0x32e2cd[_0xd8aa('0x18')]['limit']||null:null})[_0xd8aa('0x1c')](function(_0x7a4ce7){logger[_0xd8aa('0x9')](_0xd8aa('0x14'),_0x32e2cd);logger[_0xd8aa('0xc')](_0xd8aa('0x14'),_0x32e2cd,JSON[_0xd8aa('0xe')](_0x7a4ce7));_0x2d34ac(_0x7a4ce7);})[_0xd8aa('0x13')](function(_0x375f64){logger[_0xd8aa('0xf')](_0xd8aa('0x14'),_0x375f64[_0xd8aa('0x11')],_0x32e2cd);_0x4953be(_0x3a29ca[_0xd8aa('0xf')](0x1f4,_0x375f64['message']));});});};exports[_0xd8aa('0x1d')]=function(_0x59eb3f){var _0xd4d204=this;return new Promise(function(_0x1f6ab2,_0x26cff3){var _0x3696fd=require(_0xd8aa('0x1e'));var _0x19edee;return db[_0xd8aa('0x1f')][_0xd8aa('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xd8aa('0x1c')](function(_0x34b792){_0x19edee=_0x34b792;return db[_0xd8aa('0x15')]['create'](_0x59eb3f[_0xd8aa('0x17')]);})['then'](function(_0x3052c6){if(_0x19edee[_0xd8aa('0x21')]&&fs[_0xd8aa('0x22')](_0x3052c6[_0xd8aa('0x23')])){var _0x44f783=util[_0xd8aa('0x24')](_0xd8aa('0x25'),_0x3052c6[_0xd8aa('0x23')]);return _0x3696fd['encryptFile'](_0x3052c6[_0xd8aa('0x23')],_0x44f783,config[_0xd8aa('0x26')][_0xd8aa('0x27')])[_0xd8aa('0x1c')](function(){fs[_0xd8aa('0x28')](_0x3052c6[_0xd8aa('0x23')]);logger[_0xd8aa('0x9')](_0xd8aa('0x29'));return _0x3052c6;});}return _0x3052c6;})['then'](function(_0x265217){logger[_0xd8aa('0x9')](_0xd8aa('0x1d'),_0x59eb3f);logger['debug'](_0xd8aa('0x1d'),_0x59eb3f,JSON[_0xd8aa('0xe')](_0x265217));_0x1f6ab2(_0x265217);})[_0xd8aa('0x13')](function(_0x45c216){logger[_0xd8aa('0xf')](_0xd8aa('0x1d'),_0x45c216[_0xd8aa('0x11')],_0x59eb3f);_0x26cff3(_0xd4d204[_0xd8aa('0xf')](0x1f4,_0x45c216[_0xd8aa('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 827fa2c..b49412f 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 _0x6b18=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x29e8b6,_0x355c43){var _0x2ddb9b=function(_0x47a7ff){while(--_0x47a7ff){_0x29e8b6['push'](_0x29e8b6['shift']());}};_0x2ddb9b(++_0x355c43);}(_0x6b18,0xc8));var _0x86b1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6b18[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x86b1('0x0'));var util=require(_0x86b1('0x1'));var path=require(_0x86b1('0x2'));var timeout=require(_0x86b1('0x3'));var express=require('express');var router=express[_0x86b1('0x4')]();var fs_extra=require(_0x86b1('0x5'));var auth=require(_0x86b1('0x6'));var interaction=require(_0x86b1('0x7'));var config=require(_0x86b1('0x8'));var controller=require(_0x86b1('0x9'));router[_0x86b1('0xa')]('/',auth[_0x86b1('0xb')](),controller[_0x86b1('0xc')]);router['get'](_0x86b1('0xd'),auth[_0x86b1('0xb')](),controller[_0x86b1('0xe')]);router['get'](_0x86b1('0xf'),auth[_0x86b1('0xb')](),controller[_0x86b1('0x10')]);router[_0x86b1('0x11')]('/',auth[_0x86b1('0xb')](),controller[_0x86b1('0x12')]);router['put'](_0x86b1('0xf'),auth[_0x86b1('0xb')](),controller[_0x86b1('0x13')]);router[_0x86b1('0x14')](_0x86b1('0xf'),auth[_0x86b1('0xb')](),controller[_0x86b1('0x15')]);module[_0x86b1('0x16')]=router; \ No newline at end of file +var _0x25b0=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x3a2797,_0x1f905c){var _0x5c2d96=function(_0x3c7bd7){while(--_0x3c7bd7){_0x3a2797['push'](_0x3a2797['shift']());}};_0x5c2d96(++_0x1f905c);}(_0x25b0,0x17e));var _0x025b=function(_0x4fbaf9,_0x3b8190){_0x4fbaf9=_0x4fbaf9-0x0;var _0x1d89a0=_0x25b0[_0x4fbaf9];return _0x1d89a0;};'use strict';var multer=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x025b('0x2'));var auth=require(_0x025b('0x3'));var interaction=require(_0x025b('0x4'));var config=require(_0x025b('0x5'));var controller=require(_0x025b('0x6'));router[_0x025b('0x7')]('/',auth[_0x025b('0x8')](),controller[_0x025b('0x9')]);router[_0x025b('0x7')](_0x025b('0xa'),auth[_0x025b('0x8')](),controller[_0x025b('0xb')]);router[_0x025b('0x7')](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0xd')]);router[_0x025b('0xe')]('/',auth[_0x025b('0x8')](),controller[_0x025b('0xf')]);router[_0x025b('0x10')](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0x11')]);router['delete'](_0x025b('0xc'),auth[_0x025b('0x8')](),controller[_0x025b('0x12')]);module[_0x025b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 7653e15..4caee0a 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 _0xdddf=['STRING','Yes','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdddf,0x17a));var _0xfddd=function(_0x16868d,_0x2d49d9){_0x16868d=_0x16868d-0x0;var _0x52737c=_0xdddf[_0x16868d];return _0x52737c;};'use strict';var Sequelize=require(_0xfddd('0x0'));var moment=require(_0xfddd('0x1'));module[_0xfddd('0x2')]={'type':{'type':Sequelize[_0xfddd('0x3')](_0xfddd('0x4'),_0xfddd('0x5'))},'result':{'type':Sequelize[_0xfddd('0x6')]},'transfererchannel':{'type':Sequelize[_0xfddd('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xfddd('0x6')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xfddd('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xfddd('0x6')]},'transferercontext':{'type':Sequelize[_0xfddd('0x6')]},'transfererexten':{'type':Sequelize[_0xfddd('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xfddd('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xfddd('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xfddd('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfddd('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xfddd('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xfddd('0x6')]},'isexternal':{'type':Sequelize['ENUM'](_0xfddd('0x7'),'No')},'context':{'type':Sequelize[_0xfddd('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb046=['ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x16142d,_0x518da9){var _0x4e2aeb=function(_0x20fc76){while(--_0x20fc76){_0x16142d['push'](_0x16142d['shift']());}};_0x4e2aeb(++_0x518da9);}(_0xb046,0x142));var _0x6b04=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xb046[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x6b04('0x0'));var moment=require(_0x6b04('0x1'));module['exports']={'type':{'type':Sequelize[_0x6b04('0x2')](_0x6b04('0x3'),_0x6b04('0x4'))},'result':{'type':Sequelize[_0x6b04('0x5')]},'transfererchannel':{'type':Sequelize[_0x6b04('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x6b04('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x6b04('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x6b04('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6b04('0x5')]},'transferercontext':{'type':Sequelize[_0x6b04('0x5')]},'transfererexten':{'type':Sequelize[_0x6b04('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x6b04('0x5')]},'transfereechannel':{'type':Sequelize[_0x6b04('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x6b04('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x6b04('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6b04('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6b04('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6b04('0x5')]},'transfereeexten':{'type':Sequelize[_0x6b04('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6b04('0x5')]},'isexternal':{'type':Sequelize[_0x6b04('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x6b04('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 096dc0d..9057f6e 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 _0x8ad3=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto'];(function(_0x50a490,_0x320a4d){var _0x3ce7e1=function(_0xcd5ec5){while(--_0xcd5ec5){_0x50a490['push'](_0x50a490['shift']());}};_0x3ce7e1(++_0x320a4d);}(_0x8ad3,0xe1));var _0x38ad=function(_0x2d7ff1,_0x182cf4){_0x2d7ff1=_0x2d7ff1-0x0;var _0x45f2e4=_0x8ad3[_0x2d7ff1];return _0x45f2e4;};'use strict';var emlformat=require(_0x38ad('0x0'));var rimraf=require(_0x38ad('0x1'));var zipdir=require(_0x38ad('0x2'));var jsonpatch=require(_0x38ad('0x3'));var rp=require('request-promise');var moment=require(_0x38ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38ad('0x5'));var util=require(_0x38ad('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x38ad('0x7'));var ejs=require(_0x38ad('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38ad('0x9'));var squel=require(_0x38ad('0xa'));var crypto=require(_0x38ad('0xb'));var jsforce=require(_0x38ad('0xc'));var deskjs=require(_0x38ad('0xd'));var toCsv=require(_0x38ad('0x7'));var querystring=require(_0x38ad('0xe'));var Papa=require(_0x38ad('0xf'));var Redis=require(_0x38ad('0x10'));var authService=require(_0x38ad('0x11'));var qs=require(_0x38ad('0x12'));var as=require(_0x38ad('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x38ad('0x14'))('api');var utils=require(_0x38ad('0x15'));var config=require(_0x38ad('0x16'));var licenseUtil=require(_0x38ad('0x17'));var db=require(_0x38ad('0x18'))['db'];function respondWithStatusCode(_0x2c2ced,_0x2d7ac2){_0x2d7ac2=_0x2d7ac2||0xcc;return function(_0x23be1a){if(_0x23be1a){return _0x2c2ced[_0x38ad('0x19')](_0x2d7ac2);}return _0x2c2ced['status'](_0x2d7ac2)[_0x38ad('0x1a')]();};}function respondWithResult(_0x2a1654,_0x585326){_0x585326=_0x585326||0xc8;return function(_0x210145){if(_0x210145){return _0x2a1654[_0x38ad('0x1b')](_0x585326)[_0x38ad('0x1c')](_0x210145);}};}function respondWithFilteredResult(_0x3d7631,_0x19cba2){return function(_0x10d3fc){if(_0x10d3fc){var _0x41d4da=typeof _0x19cba2[_0x38ad('0x1d')]===_0x38ad('0x1e')&&typeof _0x19cba2[_0x38ad('0x1f')]===_0x38ad('0x1e');var _0x28b940=_0x10d3fc[_0x38ad('0x20')];var _0x2cdc9b=_0x41d4da?0x0:_0x19cba2[_0x38ad('0x1d')];var _0x199dc8=_0x41d4da?_0x10d3fc['count']:_0x19cba2[_0x38ad('0x1d')]+_0x19cba2['limit'];var _0x4c4b1f;if(_0x199dc8>=_0x28b940){_0x199dc8=_0x28b940;_0x4c4b1f=0xc8;}else{_0x4c4b1f=0xce;}_0x3d7631['status'](_0x4c4b1f);return _0x3d7631[_0x38ad('0x21')](_0x38ad('0x22'),_0x2cdc9b+'-'+_0x199dc8+'/'+_0x28b940)[_0x38ad('0x1c')](_0x10d3fc);}return null;};}function patchUpdates(_0x249cf8){return function(_0x23e48b){try{jsonpatch[_0x38ad('0x23')](_0x23e48b,_0x249cf8,!![]);}catch(_0x3f94c1){return BPromise[_0x38ad('0x24')](_0x3f94c1);}return _0x23e48b[_0x38ad('0x25')]();};}function saveUpdates(_0x482567,_0x620d4d){return function(_0x18d27d){if(_0x18d27d){return _0x18d27d[_0x38ad('0x26')](_0x482567)[_0x38ad('0x27')](function(_0x589131){return _0x589131;});}return null;};}function removeEntity(_0x4c1c8b,_0x19b02e){return function(_0x23a971){if(_0x23a971){return _0x23a971[_0x38ad('0x28')]()[_0x38ad('0x27')](function(){_0x4c1c8b[_0x38ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c2e7,_0x10b13e){return function(_0x54bf76){if(!_0x54bf76){_0x27c2e7['sendStatus'](0x194);}return _0x54bf76;};}function handleError(_0x3fe760,_0x66bef6){_0x66bef6=_0x66bef6||0x1f4;return function(_0x270adc){logger[_0x38ad('0x29')](_0x270adc[_0x38ad('0x2a')]);if(_0x270adc[_0x38ad('0x2b')]){delete _0x270adc[_0x38ad('0x2b')];}_0x3fe760['status'](_0x66bef6)['send'](_0x270adc);};}exports[_0x38ad('0x2c')]=function(_0x50de2d,_0x14030d){var _0x4cfc62={},_0x4e3f42={},_0x405b85={'count':0x0,'rows':[]};var _0x3833aa=_[_0x38ad('0x2d')](db[_0x38ad('0x2e')]['rawAttributes'],function(_0x518117){return{'name':_0x518117[_0x38ad('0x2f')],'type':_0x518117[_0x38ad('0x30')][_0x38ad('0x31')]};});_0x4e3f42['model']=_[_0x38ad('0x2d')](_0x3833aa,_0x38ad('0x2b'));_0x4e3f42[_0x38ad('0x32')]=_['keys'](_0x50de2d['query']);_0x4e3f42[_0x38ad('0x33')]=_['intersection'](_0x4e3f42[_0x38ad('0x34')],_0x4e3f42[_0x38ad('0x32')]);_0x4cfc62[_0x38ad('0x35')]=_[_0x38ad('0x36')](_0x4e3f42[_0x38ad('0x34')],qs['fields'](_0x50de2d[_0x38ad('0x32')][_0x38ad('0x37')]));_0x4cfc62[_0x38ad('0x35')]=_0x4cfc62[_0x38ad('0x35')][_0x38ad('0x38')]?_0x4cfc62[_0x38ad('0x35')]:_0x4e3f42[_0x38ad('0x34')];if(!_0x50de2d[_0x38ad('0x32')][_0x38ad('0x39')](_0x38ad('0x3a'))){_0x4cfc62[_0x38ad('0x1f')]=qs['limit'](_0x50de2d[_0x38ad('0x32')][_0x38ad('0x1f')]);_0x4cfc62['offset']=qs[_0x38ad('0x1d')](_0x50de2d[_0x38ad('0x32')][_0x38ad('0x1d')]);}_0x4cfc62[_0x38ad('0x3b')]=qs[_0x38ad('0x3c')](_0x50de2d['query'][_0x38ad('0x3c')]);_0x4cfc62['where']=qs[_0x38ad('0x33')](_[_0x38ad('0x3d')](_0x50de2d[_0x38ad('0x32')],_0x4e3f42['filters']),_0x3833aa);if(_0x50de2d['query'][_0x38ad('0x3e')]){_0x4cfc62[_0x38ad('0x3f')]=_['merge'](_0x4cfc62[_0x38ad('0x3f')],{'$or':_[_0x38ad('0x2d')](_0x3833aa,function(_0x4663e9){if(_0x4663e9[_0x38ad('0x30')]!==_0x38ad('0x40')){var _0x2ca8ec={};_0x2ca8ec[_0x4663e9['name']]={'$like':'%'+_0x50de2d[_0x38ad('0x32')][_0x38ad('0x3e')]+'%'};return _0x2ca8ec;}})});}_0x4cfc62=_['merge']({},_0x4cfc62,_0x50de2d[_0x38ad('0x41')]);var _0x403a91={'where':_0x4cfc62[_0x38ad('0x3f')]};return db[_0x38ad('0x2e')]['count'](_0x403a91)['then'](function(_0x1b7a1f){_0x405b85[_0x38ad('0x20')]=_0x1b7a1f;if(_0x50de2d[_0x38ad('0x32')][_0x38ad('0x42')]){_0x4cfc62[_0x38ad('0x43')]=[{'all':!![]}];}return db[_0x38ad('0x2e')]['findAll'](_0x4cfc62);})['then'](function(_0x4c87a7){_0x405b85[_0x38ad('0x44')]=_0x4c87a7;return _0x405b85;})[_0x38ad('0x27')](respondWithFilteredResult(_0x14030d,_0x4cfc62))[_0x38ad('0x45')](handleError(_0x14030d,null));};exports[_0x38ad('0x46')]=function(_0x520a6f,_0xb82ad0){var _0x142e0e={'raw':!![],'where':{'id':_0x520a6f[_0x38ad('0x47')]['id']}},_0x14c415={};_0x14c415[_0x38ad('0x34')]=_[_0x38ad('0x48')](db[_0x38ad('0x2e')][_0x38ad('0x49')]);_0x14c415[_0x38ad('0x32')]=_[_0x38ad('0x48')](_0x520a6f[_0x38ad('0x32')]);_0x14c415['filters']=_[_0x38ad('0x36')](_0x14c415[_0x38ad('0x34')],_0x14c415[_0x38ad('0x32')]);_0x142e0e['attributes']=_[_0x38ad('0x36')](_0x14c415[_0x38ad('0x34')],qs['fields'](_0x520a6f[_0x38ad('0x32')]['fields']));_0x142e0e['attributes']=_0x142e0e[_0x38ad('0x35')][_0x38ad('0x38')]?_0x142e0e[_0x38ad('0x35')]:_0x14c415['model'];if(_0x520a6f[_0x38ad('0x32')]['includeAll']){_0x142e0e[_0x38ad('0x43')]=[{'all':!![]}];}_0x142e0e=_[_0x38ad('0x4a')]({},_0x142e0e,_0x520a6f[_0x38ad('0x41')]);return db[_0x38ad('0x2e')][_0x38ad('0x4b')](_0x142e0e)[_0x38ad('0x27')](handleEntityNotFound(_0xb82ad0,null))['then'](respondWithResult(_0xb82ad0,null))['catch'](handleError(_0xb82ad0,null));};exports[_0x38ad('0x4c')]=function(_0x198ca1,_0x4c3f87){return db[_0x38ad('0x2e')]['create'](_0x198ca1[_0x38ad('0x4d')],{})[_0x38ad('0x27')](respondWithResult(_0x4c3f87,0xc9))['catch'](handleError(_0x4c3f87,null));};exports[_0x38ad('0x26')]=function(_0x8cc2b2,_0x4a8aa6){if(_0x8cc2b2[_0x38ad('0x4d')]['id']){delete _0x8cc2b2[_0x38ad('0x4d')]['id'];}return db['VoiceTransferReport'][_0x38ad('0x4b')]({'where':{'id':_0x8cc2b2['params']['id']}})['then'](handleEntityNotFound(_0x4a8aa6,null))[_0x38ad('0x27')](saveUpdates(_0x8cc2b2[_0x38ad('0x4d')],null))[_0x38ad('0x27')](respondWithResult(_0x4a8aa6,null))[_0x38ad('0x45')](handleError(_0x4a8aa6,null));};exports[_0x38ad('0x28')]=function(_0x71d9c1,_0x1412e6){return db[_0x38ad('0x2e')][_0x38ad('0x4b')]({'where':{'id':_0x71d9c1[_0x38ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x1412e6,null))[_0x38ad('0x27')](removeEntity(_0x1412e6,null))[_0x38ad('0x45')](handleError(_0x1412e6,null));};exports[_0x38ad('0x4e')]=function(_0x5933b3,_0x4d55db){return db[_0x38ad('0x2e')][_0x38ad('0x4e')]()[_0x38ad('0x27')](respondWithResult(_0x4d55db,null))[_0x38ad('0x45')](handleError(_0x4d55db,null));}; \ No newline at end of file +var _0x2340=['catch','show','rawAttributes','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x485342,_0xe19f6f){var _0x54e30c=function(_0x5048a7){while(--_0x5048a7){_0x485342['push'](_0x485342['shift']());}};_0x54e30c(++_0xe19f6f);}(_0x2340,0x157));var _0x0234=function(_0x529aff,_0x7b99af){_0x529aff=_0x529aff-0x0;var _0x1a1e64=_0x2340[_0x529aff];return _0x1a1e64;};'use strict';var emlformat=require(_0x0234('0x0'));var rimraf=require(_0x0234('0x1'));var zipdir=require(_0x0234('0x2'));var jsonpatch=require(_0x0234('0x3'));var rp=require(_0x0234('0x4'));var moment=require(_0x0234('0x5'));var BPromise=require(_0x0234('0x6'));var Mustache=require(_0x0234('0x7'));var util=require(_0x0234('0x8'));var path=require(_0x0234('0x9'));var sox=require(_0x0234('0xa'));var csv=require('to-csv');var ejs=require(_0x0234('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0234('0xc'));var squel=require(_0x0234('0xd'));var crypto=require('crypto');var jsforce=require(_0x0234('0xe'));var deskjs=require(_0x0234('0xf'));var toCsv=require(_0x0234('0x10'));var querystring=require(_0x0234('0x11'));var Papa=require(_0x0234('0x12'));var Redis=require(_0x0234('0x13'));var authService=require(_0x0234('0x14'));var qs=require(_0x0234('0x15'));var as=require(_0x0234('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0234('0x17'))(_0x0234('0x18'));var utils=require(_0x0234('0x19'));var config=require(_0x0234('0x1a'));var licenseUtil=require(_0x0234('0x1b'));var db=require(_0x0234('0x1c'))['db'];function respondWithStatusCode(_0x472a1d,_0x724e5){_0x724e5=_0x724e5||0xcc;return function(_0x2757ff){if(_0x2757ff){return _0x472a1d[_0x0234('0x1d')](_0x724e5);}return _0x472a1d[_0x0234('0x1e')](_0x724e5)[_0x0234('0x1f')]();};}function respondWithResult(_0x543451,_0x1d5e34){_0x1d5e34=_0x1d5e34||0xc8;return function(_0x4e07aa){if(_0x4e07aa){return _0x543451[_0x0234('0x1e')](_0x1d5e34)['json'](_0x4e07aa);}};}function respondWithFilteredResult(_0xb65369,_0x5ba3cf){return function(_0x2c9933){if(_0x2c9933){var _0x234914=typeof _0x5ba3cf[_0x0234('0x20')]===_0x0234('0x21')&&typeof _0x5ba3cf[_0x0234('0x22')]===_0x0234('0x21');var _0x4477b6=_0x2c9933[_0x0234('0x23')];var _0x502faa=_0x234914?0x0:_0x5ba3cf[_0x0234('0x20')];var _0x7b944d=_0x234914?_0x2c9933[_0x0234('0x23')]:_0x5ba3cf['offset']+_0x5ba3cf[_0x0234('0x22')];var _0x28ec08;if(_0x7b944d>=_0x4477b6){_0x7b944d=_0x4477b6;_0x28ec08=0xc8;}else{_0x28ec08=0xce;}_0xb65369[_0x0234('0x1e')](_0x28ec08);return _0xb65369[_0x0234('0x24')](_0x0234('0x25'),_0x502faa+'-'+_0x7b944d+'/'+_0x4477b6)[_0x0234('0x26')](_0x2c9933);}return null;};}function patchUpdates(_0x1d9273){return function(_0x5ea19a){try{jsonpatch[_0x0234('0x27')](_0x5ea19a,_0x1d9273,!![]);}catch(_0x49359b){return BPromise[_0x0234('0x28')](_0x49359b);}return _0x5ea19a[_0x0234('0x29')]();};}function saveUpdates(_0x2216b2,_0xf04751){return function(_0x28ae3b){if(_0x28ae3b){return _0x28ae3b[_0x0234('0x2a')](_0x2216b2)[_0x0234('0x2b')](function(_0x1c0bbb){return _0x1c0bbb;});}return null;};}function removeEntity(_0x2bf55b,_0x50f829){return function(_0x3a3b78){if(_0x3a3b78){return _0x3a3b78[_0x0234('0x2c')]()['then'](function(){_0x2bf55b[_0x0234('0x1e')](0xcc)[_0x0234('0x1f')]();});}};}function handleEntityNotFound(_0x59fe79,_0x30d7de){return function(_0x48d5e0){if(!_0x48d5e0){_0x59fe79[_0x0234('0x1d')](0x194);}return _0x48d5e0;};}function handleError(_0x222dbd,_0x8e1362){_0x8e1362=_0x8e1362||0x1f4;return function(_0x5e46fa){logger[_0x0234('0x2d')](_0x5e46fa[_0x0234('0x2e')]);if(_0x5e46fa[_0x0234('0x2f')]){delete _0x5e46fa[_0x0234('0x2f')];}_0x222dbd[_0x0234('0x1e')](_0x8e1362)[_0x0234('0x30')](_0x5e46fa);};}exports[_0x0234('0x31')]=function(_0xf1371a,_0x415bf6){var _0x535e5d={},_0x1d7cdd={},_0x3130c0={'count':0x0,'rows':[]};var _0x2c7b3b=_[_0x0234('0x32')](db[_0x0234('0x33')]['rawAttributes'],function(_0x5568ef){return{'name':_0x5568ef[_0x0234('0x34')],'type':_0x5568ef[_0x0234('0x35')][_0x0234('0x36')]};});_0x1d7cdd[_0x0234('0x37')]=_[_0x0234('0x32')](_0x2c7b3b,_0x0234('0x2f'));_0x1d7cdd['query']=_[_0x0234('0x38')](_0xf1371a['query']);_0x1d7cdd[_0x0234('0x39')]=_['intersection'](_0x1d7cdd['model'],_0x1d7cdd[_0x0234('0x3a')]);_0x535e5d[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x1d7cdd['model'],qs[_0x0234('0x3d')](_0xf1371a[_0x0234('0x3a')]['fields']));_0x535e5d[_0x0234('0x3b')]=_0x535e5d['attributes'][_0x0234('0x3e')]?_0x535e5d[_0x0234('0x3b')]:_0x1d7cdd[_0x0234('0x37')];if(!_0xf1371a[_0x0234('0x3a')][_0x0234('0x3f')](_0x0234('0x40'))){_0x535e5d[_0x0234('0x22')]=qs[_0x0234('0x22')](_0xf1371a[_0x0234('0x3a')][_0x0234('0x22')]);_0x535e5d[_0x0234('0x20')]=qs['offset'](_0xf1371a[_0x0234('0x3a')][_0x0234('0x20')]);}_0x535e5d[_0x0234('0x41')]=qs[_0x0234('0x42')](_0xf1371a[_0x0234('0x3a')][_0x0234('0x42')]);_0x535e5d[_0x0234('0x43')]=qs[_0x0234('0x39')](_[_0x0234('0x44')](_0xf1371a[_0x0234('0x3a')],_0x1d7cdd[_0x0234('0x39')]),_0x2c7b3b);if(_0xf1371a['query']['filter']){_0x535e5d['where']=_['merge'](_0x535e5d[_0x0234('0x43')],{'$or':_[_0x0234('0x32')](_0x2c7b3b,function(_0x5c3e51){if(_0x5c3e51[_0x0234('0x35')]!==_0x0234('0x45')){var _0x2eecbc={};_0x2eecbc[_0x5c3e51[_0x0234('0x2f')]]={'$like':'%'+_0xf1371a[_0x0234('0x3a')][_0x0234('0x46')]+'%'};return _0x2eecbc;}})});}_0x535e5d=_[_0x0234('0x47')]({},_0x535e5d,_0xf1371a[_0x0234('0x48')]);var _0x3d45ce={'where':_0x535e5d[_0x0234('0x43')]};return db[_0x0234('0x33')][_0x0234('0x23')](_0x3d45ce)[_0x0234('0x2b')](function(_0x3432cb){_0x3130c0[_0x0234('0x23')]=_0x3432cb;if(_0xf1371a['query'][_0x0234('0x49')]){_0x535e5d[_0x0234('0x4a')]=[{'all':!![]}];}return db[_0x0234('0x33')][_0x0234('0x4b')](_0x535e5d);})[_0x0234('0x2b')](function(_0xfb5854){_0x3130c0[_0x0234('0x4c')]=_0xfb5854;return _0x3130c0;})['then'](respondWithFilteredResult(_0x415bf6,_0x535e5d))[_0x0234('0x4d')](handleError(_0x415bf6,null));};exports[_0x0234('0x4e')]=function(_0x7b92c8,_0x35774b){var _0x32452b={'raw':!![],'where':{'id':_0x7b92c8['params']['id']}},_0x3edceb={};_0x3edceb[_0x0234('0x37')]=_['keys'](db[_0x0234('0x33')][_0x0234('0x4f')]);_0x3edceb[_0x0234('0x3a')]=_['keys'](_0x7b92c8[_0x0234('0x3a')]);_0x3edceb[_0x0234('0x39')]=_[_0x0234('0x3c')](_0x3edceb[_0x0234('0x37')],_0x3edceb[_0x0234('0x3a')]);_0x32452b[_0x0234('0x3b')]=_[_0x0234('0x3c')](_0x3edceb[_0x0234('0x37')],qs[_0x0234('0x3d')](_0x7b92c8[_0x0234('0x3a')][_0x0234('0x3d')]));_0x32452b[_0x0234('0x3b')]=_0x32452b[_0x0234('0x3b')][_0x0234('0x3e')]?_0x32452b['attributes']:_0x3edceb[_0x0234('0x37')];if(_0x7b92c8[_0x0234('0x3a')][_0x0234('0x49')]){_0x32452b['include']=[{'all':!![]}];}_0x32452b=_[_0x0234('0x47')]({},_0x32452b,_0x7b92c8[_0x0234('0x48')]);return db[_0x0234('0x33')]['find'](_0x32452b)[_0x0234('0x2b')](handleEntityNotFound(_0x35774b,null))[_0x0234('0x2b')](respondWithResult(_0x35774b,null))[_0x0234('0x4d')](handleError(_0x35774b,null));};exports['create']=function(_0x3900d8,_0x2e6848){return db[_0x0234('0x33')]['create'](_0x3900d8[_0x0234('0x50')],{})['then'](respondWithResult(_0x2e6848,0xc9))['catch'](handleError(_0x2e6848,null));};exports['update']=function(_0x1bedd4,_0x1cb75f){if(_0x1bedd4['body']['id']){delete _0x1bedd4[_0x0234('0x50')]['id'];}return db[_0x0234('0x33')][_0x0234('0x51')]({'where':{'id':_0x1bedd4[_0x0234('0x52')]['id']}})[_0x0234('0x2b')](handleEntityNotFound(_0x1cb75f,null))[_0x0234('0x2b')](saveUpdates(_0x1bedd4[_0x0234('0x50')],null))[_0x0234('0x2b')](respondWithResult(_0x1cb75f,null))[_0x0234('0x4d')](handleError(_0x1cb75f,null));};exports['destroy']=function(_0x30e2,_0x16c835){return db[_0x0234('0x33')][_0x0234('0x51')]({'where':{'id':_0x30e2[_0x0234('0x52')]['id']}})['then'](handleEntityNotFound(_0x16c835,null))[_0x0234('0x2b')](removeEntity(_0x16c835,null))[_0x0234('0x4d')](handleError(_0x16c835,null));};exports[_0x0234('0x53')]=function(_0x4dd92f,_0x1b0636){return db[_0x0234('0x33')][_0x0234('0x53')]()[_0x0234('0x2b')](respondWithResult(_0x1b0636,null))[_0x0234('0x4d')](handleError(_0x1b0636,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9dd0e45..51d80de 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 _0xab4f=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports','VoiceTransferReport','report_call_transfer'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xab4f,0x1e0));var _0xfab4=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xab4f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xfab4('0x0'));var util=require(_0xfab4('0x1'));var logger=require('../../config/logger')(_0xfab4('0x2'));var moment=require(_0xfab4('0x3'));var BPromise=require('bluebird');var rp=require(_0xfab4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfab4('0x5'));var config=require(_0xfab4('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xfab4('0x7')]=function(_0x4d4cd4,_0x59262d){return _0x4d4cd4['define'](_0xfab4('0x8'),attributes,{'tableName':_0xfab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5e=['api','moment','bluebird','path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','util','../../config/logger'];(function(_0x570cdc,_0xc45524){var _0xbde795=function(_0x527f68){while(--_0x527f68){_0x570cdc['push'](_0x570cdc['shift']());}};_0xbde795(++_0xc45524);}(_0x9c5e,0x6c));var _0xe9c5=function(_0x37bf65,_0x220141){_0x37bf65=_0x37bf65-0x0;var _0x45a736=_0x9c5e[_0x37bf65];return _0x45a736;};'use strict';var _=require('lodash');var util=require(_0xe9c5('0x0'));var logger=require(_0xe9c5('0x1'))(_0xe9c5('0x2'));var moment=require(_0xe9c5('0x3'));var BPromise=require(_0xe9c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9c5('0x5'));var rimraf=require('rimraf');var config=require(_0xe9c5('0x6'));var attributes=require(_0xe9c5('0x7'));module['exports']=function(_0x1eb8fd,_0x472ec5){return _0x1eb8fd[_0xe9c5('0x8')](_0xe9c5('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c5eb429..43add72 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 _0x1f05=['VoiceTransferReport','create','options','raw','debug','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','CreateVoiceTransferReport'];(function(_0x39c65b,_0x4b5a02){var _0x487fee=function(_0x5d3a6b){while(--_0x5d3a6b){_0x39c65b['push'](_0x39c65b['shift']());}};_0x487fee(++_0x4b5a02);}(_0x1f05,0xae));var _0x51f0=function(_0x431534,_0x5a24a6){_0x431534=_0x431534-0x0;var _0x67f5c3=_0x1f05[_0x431534];return _0x67f5c3;};'use strict';var _=require(_0x51f0('0x0'));var util=require('util');var moment=require(_0x51f0('0x1'));var BPromise=require('bluebird');var rs=require(_0x51f0('0x2'));var fs=require('fs');var Redis=require(_0x51f0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x51f0('0x4'));var logger=require(_0x51f0('0x5'))(_0x51f0('0x6'));var config=require(_0x51f0('0x7'));var jayson=require(_0x51f0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7fff8c,_0x1f558b,_0x3d39e7){return new BPromise(function(_0x551c4a,_0x3927e5){return client['request'](_0x7fff8c,_0x3d39e7)[_0x51f0('0x9')](function(_0x574645){logger['info'](_0x51f0('0xa'),_0x1f558b,_0x51f0('0xb'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1f558b,'request\x20sent',JSON['stringify'](_0x574645));if(_0x574645['error']){if(_0x574645[_0x51f0('0xc')][_0x51f0('0xd')]===0x1f4){logger[_0x51f0('0xc')](_0x51f0('0xa'),_0x1f558b,_0x574645['error']['message']);return _0x3927e5(_0x574645['error'][_0x51f0('0xe')]);}logger[_0x51f0('0xc')](_0x51f0('0xa'),_0x1f558b,_0x574645['error'][_0x51f0('0xe')]);return _0x551c4a(_0x574645[_0x51f0('0xc')][_0x51f0('0xe')]);}else{logger[_0x51f0('0xf')](_0x51f0('0xa'),_0x1f558b,'request\x20sent');_0x551c4a(_0x574645['result']['message']);}})[_0x51f0('0x10')](function(_0xa0f655){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1f558b,_0xa0f655);_0x3927e5(_0xa0f655);});});}exports[_0x51f0('0x11')]=function(_0x6f6d3a){var _0x319e09=this;return new Promise(function(_0x444c2a,_0xa6c65c){return db[_0x51f0('0x12')][_0x51f0('0x13')](_0x6f6d3a['body'],{'raw':_0x6f6d3a[_0x51f0('0x14')]?_0x6f6d3a[_0x51f0('0x14')][_0x51f0('0x15')]===undefined?!![]:![]:!![]})[_0x51f0('0x9')](function(_0x2b031a){logger[_0x51f0('0xf')]('CreateVoiceTransferReport',_0x6f6d3a);logger[_0x51f0('0x16')](_0x51f0('0x11'),_0x6f6d3a,JSON[_0x51f0('0x17')](_0x2b031a));_0x444c2a(_0x2b031a);})[_0x51f0('0x10')](function(_0x4ecfc3){logger[_0x51f0('0xc')](_0x51f0('0x11'),_0x4ecfc3[_0x51f0('0xe')],_0x6f6d3a);_0xa6c65c(_0x319e09['error'](0x1f4,_0x4ecfc3[_0x51f0('0xe')]));});});}; \ No newline at end of file +var _0x03f5=['body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create'];(function(_0x3022a5,_0x10fa75){var _0x58264b=function(_0x5e734d){while(--_0x5e734d){_0x3022a5['push'](_0x3022a5['shift']());}};_0x58264b(++_0x10fa75);}(_0x03f5,0x177));var _0x503f=function(_0x47679f,_0x25950d){_0x47679f=_0x47679f-0x0;var _0x20ebe7=_0x03f5[_0x47679f];return _0x20ebe7;};'use strict';var _=require(_0x503f('0x0'));var util=require(_0x503f('0x1'));var moment=require(_0x503f('0x2'));var BPromise=require(_0x503f('0x3'));var rs=require(_0x503f('0x4'));var fs=require('fs');var Redis=require(_0x503f('0x5'));var db=require(_0x503f('0x6'))['db'];var utils=require(_0x503f('0x7'));var logger=require('../../config/logger')(_0x503f('0x8'));var config=require(_0x503f('0x9'));var jayson=require(_0x503f('0xa'));var client=jayson[_0x503f('0xb')][_0x503f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50f665,_0x236138,_0x9a6b89){return new BPromise(function(_0x45ca63,_0x543d4d){return client[_0x503f('0xd')](_0x50f665,_0x9a6b89)[_0x503f('0xe')](function(_0x73d632){logger[_0x503f('0xf')](_0x503f('0x10'),_0x236138,_0x503f('0x11'));logger[_0x503f('0x12')](_0x503f('0x13'),_0x236138,_0x503f('0x11'),JSON[_0x503f('0x14')](_0x73d632));if(_0x73d632[_0x503f('0x15')]){if(_0x73d632[_0x503f('0x15')][_0x503f('0x16')]===0x1f4){logger['error'](_0x503f('0x10'),_0x236138,_0x73d632['error'][_0x503f('0x17')]);return _0x543d4d(_0x73d632[_0x503f('0x15')][_0x503f('0x17')]);}logger[_0x503f('0x15')](_0x503f('0x10'),_0x236138,_0x73d632[_0x503f('0x15')]['message']);return _0x45ca63(_0x73d632['error'][_0x503f('0x17')]);}else{logger[_0x503f('0xf')](_0x503f('0x10'),_0x236138,_0x503f('0x11'));_0x45ca63(_0x73d632[_0x503f('0x18')][_0x503f('0x17')]);}})[_0x503f('0x19')](function(_0xb3f87c){logger[_0x503f('0x15')]('VoiceTransferReport,\x20%s,\x20%s',_0x236138,_0xb3f87c);_0x543d4d(_0xb3f87c);});});}exports[_0x503f('0x1a')]=function(_0x4865cf){var _0x2c3254=this;return new Promise(function(_0x3b7547,_0x14d143){return db['VoiceTransferReport'][_0x503f('0x1b')](_0x4865cf[_0x503f('0x1c')],{'raw':_0x4865cf[_0x503f('0x1d')]?_0x4865cf[_0x503f('0x1d')][_0x503f('0x1e')]===undefined?!![]:![]:!![]})[_0x503f('0xe')](function(_0x35b6f8){logger[_0x503f('0xf')]('CreateVoiceTransferReport',_0x4865cf);logger[_0x503f('0x12')](_0x503f('0x1a'),_0x4865cf,JSON['stringify'](_0x35b6f8));_0x3b7547(_0x35b6f8);})['catch'](function(_0x162fc9){logger[_0x503f('0x15')](_0x503f('0x1a'),_0x162fc9[_0x503f('0x17')],_0x4865cf);_0x14d143(_0x2c3254[_0x503f('0x15')](0x1f4,_0x162fc9[_0x503f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 25b4a0f..1c650d9 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4acae7,_0x5a15e4){_0x4acae7=_0x4acae7-0x0;var _0x26d67f=_0xb43b[_0x4acae7];return _0x26d67f;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x70e0,0x17b));var _0x070e=function(_0x1f67a6,_0x1369cd){_0x1f67a6=_0x1f67a6-0x0;var _0x5c1dae=_0x70e0[_0x1f67a6];return _0x5c1dae;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 849cf00..5eee7d2 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 _0x0c02=['info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','hangup\x20fired:','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','conference','entityFound:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required'];(function(_0x4fb618,_0x5950cf){var _0x499480=function(_0x105820){while(--_0x105820){_0x4fb618['push'](_0x4fb618['shift']());}};_0x499480(++_0x5950cf);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x20c0('0x0'));var db=require(_0x20c0('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x20c0('0x2'));var BPromise=require(_0x20c0('0x3'));var jayson=require(_0x20c0('0x4'));var amiClient=jayson[_0x20c0('0x5')][_0x20c0('0x6')]({'port':0x232a});var logger=require(_0x20c0('0x7'))(_0x20c0('0x8'));var Redis=require(_0x20c0('0x9'));config[_0x20c0('0xa')]=_[_0x20c0('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x20c0('0xc'));var originateValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'callNumber':{'type':_0x20c0('0xf'),'required':[!![],_0x20c0('0x10')]},'callerId':{'type':_0x20c0('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':'string','required':[!![],_0x20c0('0x11')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]},'sessionId':{'type':_0x20c0('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],_0x20c0('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x20c0('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0xd80b64,_0xc78626,_0x1a708e){logger[_0x20c0('0x12')](_0xd80b64,_0xc78626,JSON[_0x20c0('0x13')](_0x1a708e));io['to'](_0xd80b64)[_0x20c0('0x14')](_0xc78626,_0x1a708e);}function handleError(_0x5d6d18){return function(_0x55de3b){console['log'](_0x20c0('0x15'),_0x55de3b,_0x55de3b instanceof RangeError);logger[_0x20c0('0x16')](_0x55de3b[_0x20c0('0x17')]);if(_0x55de3b instanceof RangeError){if(_0x55de3b[_0x20c0('0x18')]){delete _0x55de3b['name'];}_0x5d6d18[_0x20c0('0x19')](0x194)[_0x20c0('0x1a')](_0x55de3b);}else{if(_0x55de3b[_0x20c0('0x18')]){delete _0x55de3b['name'];}_0x5d6d18['status'](0x1f4)[_0x20c0('0x1a')](_0x55de3b);}};}function checkError(){return function(_0x108973){if(!_0x108973){throw new RangeError(_0x20c0('0x1b'));}return _0x108973;};}function respondWithRpcPromise(_0x2315dc,_0x36ed49){return new BPromise(function(_0x53d8e8,_0x2213f5){var _0x28959a=amiClient;return _0x28959a[_0x20c0('0x1c')](_0x2315dc,_0x36ed49)[_0x20c0('0x1d')](function(_0x52b8b8){if(_0x52b8b8[_0x20c0('0x16')]){if(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1e')]===0x1f4){return _0x2213f5(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1f')]);}return _0x53d8e8(_0x52b8b8[_0x20c0('0x16')][_0x20c0('0x1f')]);}else{_0x53d8e8(_0x52b8b8['result']);}})[_0x20c0('0x20')](function(_0x595d94){_0x2213f5(_0x595d94);});});}function getAgent(_0x22d11a){return db[_0x20c0('0x21')][_0x20c0('0x22')]({'where':{'id':_0x22d11a,'role':_0x20c0('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x4e0cbb,_0x3012d5){return new BPromise(function(_0x198bdd,_0x1e3790){var _0x5b863b=respondWithRpcPromise(_0x20c0('0x24'));var _0x25592b=getAgent(_0x4e0cbb);Promise[_0x20c0('0x25')]([_0x5b863b,_0x25592b])[_0x20c0('0x1d')](function(_0x4baaed){var _0x49b738=_0x4baaed[0x0];var _0x29d8ee=_0x4baaed[0x1];var _0x11f405=_[_0x20c0('0x26')](_0x49b738[_0x20c0('0x27')],function(_0x3055e9){return _0x3055e9[_0x20c0('0x28')]==_0x29d8ee['id']&&_0x3055e9[_0x20c0('0x29')]==_0x3012d5;});if(_0x11f405[_0x20c0('0x2a')]==0x1){_0x198bdd(_0x29d8ee);}else{_0x1e3790(new RangeError(_0x20c0('0x2b')+_0x3012d5+_0x20c0('0x2c')));}});});}exports[_0x20c0('0x2d')]=function(_0x32448b,_0x1fef93){logger[_0x20c0('0x12')]('originate\x20fired:',_0x32448b[_0x20c0('0x2e')]);var _0x1ad64f=originateValidation[_0x20c0('0xc')](_0x32448b[_0x20c0('0x2e')]);if(_0x1ad64f['length']>0x0){return _0x1fef93[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0x1ad64f);}var _0x355db9=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x5550b7=_0x32448b[_0x20c0('0x2e')]['callNumber'];var _0x5e9640=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x31')];var _0x3b334a=_0x32448b[_0x20c0('0x2e')][_0x20c0('0x32')];return getAgent(_0x355db9)[_0x20c0('0x1d')](function(_0x41532c){logger['info']('entityFound:',_0x41532c['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x41532c['name']),_0x20c0('0x35'),{'callNumber':_0x5550b7,'callerId':_0x5e9640,'callbackUrl':_0x3b334a});return _0x1fef93[_0x20c0('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x20c0('0x20')](handleError(_0x1fef93));};exports[_0x20c0('0x36')]=function(_0x481dc0,_0x44326a){logger['info'](_0x20c0('0x37'),_0x481dc0[_0x20c0('0x2e')]);var _0xcaa484=hangupValidation[_0x20c0('0xc')](_0x481dc0['body']);if(_0xcaa484[_0x20c0('0x2a')]>0x0){return _0x44326a[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0xcaa484);}var _0x415b41=_0x481dc0[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x121ddf=_0x481dc0[_0x20c0('0x2e')]['sessionId'];return getAgent(_0x415b41)['then'](function(_0x581fe4){logger[_0x20c0('0x12')]('entityFound:',_0x581fe4[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x581fe4[_0x20c0('0x18')]),'webbar:hangup',{'sessionId':_0x121ddf});return _0x44326a[_0x20c0('0x19')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x20c0('0x20')](handleError(_0x44326a));};exports[_0x20c0('0x38')]=function(_0x456d28,_0x446c89){logger['info'](_0x20c0('0x39'),_0x456d28[_0x20c0('0x2e')]);var _0x39852a=answerValidation[_0x20c0('0xc')](_0x456d28['body']);if(_0x39852a[_0x20c0('0x2a')]>0x0){return _0x446c89[_0x20c0('0x19')](0x190)['json'](_0x39852a);}var _0x285509=_0x456d28[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x527f6f=_0x456d28[_0x20c0('0x2e')]['sessionId'];return getAgent(_0x285509)['then'](function(_0x49759b){logger[_0x20c0('0x12')]('entityFound:',_0x49759b[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x49759b[_0x20c0('0x18')]),_0x20c0('0x3a'),{'sessionId':_0x527f6f});return _0x446c89[_0x20c0('0x19')](0xc8)[_0x20c0('0x2f')]({'error':![],'message':'answer\x20executed!'});})[_0x20c0('0x20')](handleError(_0x446c89));};exports[_0x20c0('0x3b')]=function(_0x523b16,_0x1b81d5){logger[_0x20c0('0x12')](_0x20c0('0x3c'),_0x523b16['body']);var _0x4fa87f=holdValidation[_0x20c0('0xc')](_0x523b16[_0x20c0('0x2e')]);if(_0x4fa87f[_0x20c0('0x2a')]>0x0){return _0x1b81d5['status'](0x190)['json'](_0x4fa87f);}var _0x1e11c4=_0x523b16[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x55d46c=_0x523b16[_0x20c0('0x2e')][_0x20c0('0x29')];return getAgent(_0x1e11c4)['then'](function(_0x4972a3){logger[_0x20c0('0x12')]('entityFound:',_0x4972a3[_0x20c0('0x18')]);emit(util['format'](_0x20c0('0x34'),_0x4972a3[_0x20c0('0x18')]),'webbar:hold',{'sessionId':_0x55d46c});return _0x1b81d5['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x3d')});})[_0x20c0('0x20')](handleError(_0x1b81d5));};exports[_0x20c0('0x3e')]=function(_0x35cc23,_0x327b12){logger[_0x20c0('0x12')](_0x20c0('0x3f'),_0x35cc23['body']);var _0x24b5f5=unholdValidation[_0x20c0('0xc')](_0x35cc23[_0x20c0('0x2e')]);if(_0x24b5f5[_0x20c0('0x2a')]>0x0){return _0x327b12[_0x20c0('0x19')](0x190)['json'](_0x24b5f5);}var _0x4eaca2=_0x35cc23[_0x20c0('0x2e')][_0x20c0('0x30')];var _0x1d0c97=_0x35cc23[_0x20c0('0x2e')][_0x20c0('0x29')];return getAgent(_0x4eaca2)[_0x20c0('0x1d')](function(_0x431336){logger['info']('entityFound:',_0x431336[_0x20c0('0x18')]);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x431336['name']),_0x20c0('0x40'),{'sessionId':_0x1d0c97});return _0x327b12['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x41')});})[_0x20c0('0x20')](handleError(_0x327b12));};exports['calls']=function(_0x30a75d,_0x28bc98){logger[_0x20c0('0x12')](_0x20c0('0x42'),_0x28bc98[_0x20c0('0x2e')]);var _0x5dc06f=callsValidation[_0x20c0('0xc')](_0x30a75d[_0x20c0('0x2e')]);if(_0x5dc06f[_0x20c0('0x2a')]>0x0){return _0x28bc98[_0x20c0('0x19')](0x190)['json'](_0x5dc06f);}var _0x1aaaec=_0x30a75d['body'][_0x20c0('0x30')];var _0x5d40c9=respondWithRpcPromise(_0x20c0('0x24'));var _0x2e64f5=getAgent(_0x1aaaec);return Promise[_0x20c0('0x25')]([_0x5d40c9,_0x2e64f5])[_0x20c0('0x1d')](function(_0x54bb05){var _0x371cbb=_0x54bb05[0x0];var _0xcd87e8=_0x54bb05[0x1];var _0x1e1c4b=_[_0x20c0('0x26')](_0x371cbb[_0x20c0('0x27')],function(_0x2091d2){return _0x2091d2[_0x20c0('0x28')]==_0xcd87e8['id'];});return _0x28bc98[_0x20c0('0x19')](0xc8)['json']({'count':_0x1e1c4b[_0x20c0('0x2a')],'rows':_0x1e1c4b});})[_0x20c0('0x20')](handleError(_0x28bc98));};exports[_0x20c0('0x43')]=function(_0x56e1f6,_0x1f553c){logger[_0x20c0('0x12')]('conference\x20fired:',_0x56e1f6[_0x20c0('0x2e')]);var _0x4dd07d=conferenceValidation['validate'](_0x56e1f6['body']);if(_0x4dd07d['length']>0x0){return _0x1f553c[_0x20c0('0x19')](0x190)[_0x20c0('0x2f')](_0x4dd07d);}var _0x1dc800=_0x56e1f6[_0x20c0('0x2e')][_0x20c0('0x30')];return getAgent(_0x1dc800)[_0x20c0('0x1d')](function(_0x1f16e6){logger[_0x20c0('0x12')](_0x20c0('0x44'),_0x1f16e6['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x1f16e6[_0x20c0('0x18')]),_0x20c0('0x45'));return _0x1f553c[_0x20c0('0x19')](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x46')});})[_0x20c0('0x20')](handleError(_0x1f553c));};exports[_0x20c0('0x47')]=function(_0x309a40,_0x54b78f){logger[_0x20c0('0x12')](_0x20c0('0x48'),_0x309a40[_0x20c0('0x2e')]);var _0x11511c=transferValidation['validate'](_0x309a40['body']);if(_0x11511c[_0x20c0('0x2a')]>0x0){return _0x54b78f[_0x20c0('0x19')](0x190)['json'](_0x11511c);}var _0x2222eb=_0x309a40['body'][_0x20c0('0x30')];var _0x44b17d=_0x309a40[_0x20c0('0x2e')]['sessionId'];var _0x59c854=_0x309a40[_0x20c0('0x2e')][_0x20c0('0x49')];return getAgent(_0x2222eb)[_0x20c0('0x1d')](function(_0x2df90c){logger['info']('entityFound:',_0x2df90c['name']);emit(util[_0x20c0('0x33')](_0x20c0('0x34'),_0x2df90c[_0x20c0('0x18')]),'webbar:transfer',{'sessionId':_0x44b17d,'transferNumber':_0x59c854});return _0x54b78f['status'](0xc8)[_0x20c0('0x2f')]({'error':![],'message':_0x20c0('0x4a')});})['catch'](handleError(_0x54b78f));}; \ No newline at end of file +var _0xedd9=['originate\x20executed!','hangup','hangup\x20fired:','status','webbar:hangup','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','stack','name','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate'];(function(_0x596b66,_0x45e85e){var _0x1a06ec=function(_0x337e3f){while(--_0x337e3f){_0x596b66['push'](_0x596b66['shift']());}};_0x1a06ec(++_0x45e85e);}(_0xedd9,0xfc));var _0x9edd=function(_0x395bbf,_0x13359b){_0x395bbf=_0x395bbf-0x0;var _0x150db2=_0xedd9[_0x395bbf];return _0x150db2;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x9edd('0x0'));var db=require(_0x9edd('0x1'))['db'];var config=require(_0x9edd('0x2'));var util=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var jayson=require(_0x9edd('0x5'));var amiClient=jayson[_0x9edd('0x6')][_0x9edd('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0x9edd('0x8'));var Redis=require(_0x9edd('0x9'));config[_0x9edd('0xa')]=_[_0x9edd('0xb')](config['redis'],{'host':_0x9edd('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0xa')]));var Schema=require(_0x9edd('0xd'));var originateValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'callNumber':{'type':'string','required':[!![],_0x9edd('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x9edd('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'sessionId':{'type':_0x9edd('0x11'),'required':[!![],_0x9edd('0x12')]},'transferNumber':{'type':_0x9edd('0x11'),'required':[!![],_0x9edd('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]},'sessionId':{'type':_0x9edd('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x9edd('0xe'),'required':[!![],_0x9edd('0xf')]}});function emit(_0x4ea60f,_0x5f5bf4,_0x448996){logger[_0x9edd('0x14')](_0x4ea60f,_0x5f5bf4,JSON['stringify'](_0x448996));io['to'](_0x4ea60f)[_0x9edd('0x15')](_0x5f5bf4,_0x448996);}function handleError(_0x35f454){return function(_0x40ba32){console['log'](_0x9edd('0x16'),_0x40ba32,_0x40ba32 instanceof RangeError);logger['error'](_0x40ba32[_0x9edd('0x17')]);if(_0x40ba32 instanceof RangeError){if(_0x40ba32[_0x9edd('0x18')]){delete _0x40ba32['name'];}_0x35f454['status'](0x194)[_0x9edd('0x19')](_0x40ba32);}else{if(_0x40ba32['name']){delete _0x40ba32[_0x9edd('0x18')];}_0x35f454['status'](0x1f4)['send'](_0x40ba32);}};}function checkError(){return function(_0x356751){if(!_0x356751){throw new RangeError(_0x9edd('0x1a'));}return _0x356751;};}function respondWithRpcPromise(_0x4fb7bf,_0x5823bc){return new BPromise(function(_0x341d67,_0x186186){var _0x477878=amiClient;return _0x477878['request'](_0x4fb7bf,_0x5823bc)[_0x9edd('0x1b')](function(_0x1dca43){if(_0x1dca43[_0x9edd('0x1c')]){if(_0x1dca43[_0x9edd('0x1c')][_0x9edd('0x1d')]===0x1f4){return _0x186186(_0x1dca43['error'][_0x9edd('0x1e')]);}return _0x341d67(_0x1dca43[_0x9edd('0x1c')][_0x9edd('0x1e')]);}else{_0x341d67(_0x1dca43[_0x9edd('0x1f')]);}})[_0x9edd('0x20')](function(_0x4d507f){_0x186186(_0x4d507f);});});}function getAgent(_0x4b3d1b){return db[_0x9edd('0x21')][_0x9edd('0x22')]({'where':{'id':_0x4b3d1b,'role':_0x9edd('0x23')}})[_0x9edd('0x1b')](checkError());}function getAgentCheckSession(_0x3c2227,_0x4fe471){return new BPromise(function(_0x57a2cc,_0x214d0a){var _0x257a26=respondWithRpcPromise(_0x9edd('0x24'));var _0x52746a=getAgent(_0x3c2227);Promise[_0x9edd('0x25')]([_0x257a26,_0x52746a])[_0x9edd('0x1b')](function(_0x2ae8dd){var _0x41af53=_0x2ae8dd[0x0];var _0x5eccfb=_0x2ae8dd[0x1];var _0x2155a1=_[_0x9edd('0x26')](_0x41af53[_0x9edd('0x27')],function(_0x12c1bc){return _0x12c1bc[_0x9edd('0x28')]==_0x5eccfb['id']&&_0x12c1bc[_0x9edd('0x29')]==_0x4fe471;});if(_0x2155a1[_0x9edd('0x2a')]==0x1){_0x57a2cc(_0x5eccfb);}else{_0x214d0a(new RangeError(_0x9edd('0x2b')+_0x4fe471+_0x9edd('0x2c')));}});});}exports[_0x9edd('0x2d')]=function(_0x4fd03f,_0x138002){logger[_0x9edd('0x14')](_0x9edd('0x2e'),_0x4fd03f[_0x9edd('0x2f')]);var _0x5af178=originateValidation[_0x9edd('0xd')](_0x4fd03f[_0x9edd('0x2f')]);if(_0x5af178[_0x9edd('0x2a')]>0x0){return _0x138002['status'](0x190)[_0x9edd('0x30')](_0x5af178);}var _0x3990fb=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x21bc30=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x32')];var _0x438a5d=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x33')];var _0x29e789=_0x4fd03f[_0x9edd('0x2f')][_0x9edd('0x34')];return getAgent(_0x3990fb)[_0x9edd('0x1b')](function(_0x5757fc){logger[_0x9edd('0x14')]('entityFound:',_0x5757fc[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x5757fc[_0x9edd('0x18')]),_0x9edd('0x37'),{'callNumber':_0x21bc30,'callerId':_0x438a5d,'callbackUrl':_0x29e789});return _0x138002['status'](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x38')});})[_0x9edd('0x20')](handleError(_0x138002));};exports[_0x9edd('0x39')]=function(_0x1be77f,_0x337e6c){logger[_0x9edd('0x14')](_0x9edd('0x3a'),_0x1be77f[_0x9edd('0x2f')]);var _0x35c16f=hangupValidation['validate'](_0x1be77f[_0x9edd('0x2f')]);if(_0x35c16f['length']>0x0){return _0x337e6c[_0x9edd('0x3b')](0x190)['json'](_0x35c16f);}var _0x30883e=_0x1be77f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x479661=_0x1be77f[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x30883e)[_0x9edd('0x1b')](function(_0x48958a){logger[_0x9edd('0x14')]('entityFound:',_0x48958a[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')]('user:%s',_0x48958a[_0x9edd('0x18')]),_0x9edd('0x3c'),{'sessionId':_0x479661});return _0x337e6c[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x9edd('0x20')](handleError(_0x337e6c));};exports['answer']=function(_0x2bdb3f,_0xc1e657){logger['info'](_0x9edd('0x3d'),_0x2bdb3f['body']);var _0x548299=answerValidation[_0x9edd('0xd')](_0x2bdb3f[_0x9edd('0x2f')]);if(_0x548299[_0x9edd('0x2a')]>0x0){return _0xc1e657[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x548299);}var _0x4737ae=_0x2bdb3f[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x18c149=_0x2bdb3f[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x4737ae)[_0x9edd('0x1b')](function(_0x3d5eba){logger[_0x9edd('0x14')](_0x9edd('0x3e'),_0x3d5eba['name']);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x3d5eba[_0x9edd('0x18')]),_0x9edd('0x3f'),{'sessionId':_0x18c149});return _0xc1e657[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x40')});})['catch'](handleError(_0xc1e657));};exports['hold']=function(_0x4bc7a1,_0x4a7dc9){logger['info'](_0x9edd('0x41'),_0x4bc7a1[_0x9edd('0x2f')]);var _0x2b06d3=holdValidation[_0x9edd('0xd')](_0x4bc7a1[_0x9edd('0x2f')]);if(_0x2b06d3['length']>0x0){return _0x4a7dc9[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x2b06d3);}var _0x40e33d=_0x4bc7a1['body'][_0x9edd('0x31')];var _0xfd7bd1=_0x4bc7a1[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x40e33d)[_0x9edd('0x1b')](function(_0x35bdec){logger['info'](_0x9edd('0x3e'),_0x35bdec[_0x9edd('0x18')]);emit(util['format'](_0x9edd('0x36'),_0x35bdec[_0x9edd('0x18')]),'webbar:hold',{'sessionId':_0xfd7bd1});return _0x4a7dc9[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x42')});})['catch'](handleError(_0x4a7dc9));};exports[_0x9edd('0x43')]=function(_0x151157,_0x317a60){logger[_0x9edd('0x14')]('unhold\x20fired:',_0x151157[_0x9edd('0x2f')]);var _0x527727=unholdValidation[_0x9edd('0xd')](_0x151157['body']);if(_0x527727[_0x9edd('0x2a')]>0x0){return _0x317a60[_0x9edd('0x3b')](0x190)['json'](_0x527727);}var _0x8e59bd=_0x151157['body'][_0x9edd('0x31')];var _0xe6b20c=_0x151157[_0x9edd('0x2f')][_0x9edd('0x29')];return getAgent(_0x8e59bd)[_0x9edd('0x1b')](function(_0x18548e){logger[_0x9edd('0x14')](_0x9edd('0x3e'),_0x18548e[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')](_0x9edd('0x36'),_0x18548e['name']),_0x9edd('0x44'),{'sessionId':_0xe6b20c});return _0x317a60[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x9edd('0x20')](handleError(_0x317a60));};exports['calls']=function(_0x54d83d,_0x54ecfa){logger[_0x9edd('0x14')](_0x9edd('0x45'),_0x54ecfa[_0x9edd('0x2f')]);var _0x35ddb3=callsValidation['validate'](_0x54d83d['body']);if(_0x35ddb3['length']>0x0){return _0x54ecfa[_0x9edd('0x3b')](0x190)[_0x9edd('0x30')](_0x35ddb3);}var _0xd5090a=_0x54d83d[_0x9edd('0x2f')][_0x9edd('0x31')];var _0x41ec97=respondWithRpcPromise(_0x9edd('0x24'));var _0x1e3087=getAgent(_0xd5090a);return Promise['all']([_0x41ec97,_0x1e3087])[_0x9edd('0x1b')](function(_0x49d0ce){var _0x421e82=_0x49d0ce[0x0];var _0x6a1cfc=_0x49d0ce[0x1];var _0x4b7e68=_[_0x9edd('0x26')](_0x421e82[_0x9edd('0x27')],function(_0x950e53){return _0x950e53['UserId']==_0x6a1cfc['id'];});return _0x54ecfa[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'count':_0x4b7e68[_0x9edd('0x2a')],'rows':_0x4b7e68});})[_0x9edd('0x20')](handleError(_0x54ecfa));};exports[_0x9edd('0x46')]=function(_0x2c3173,_0x53f55b){logger['info'](_0x9edd('0x47'),_0x2c3173['body']);var _0x173ec9=conferenceValidation[_0x9edd('0xd')](_0x2c3173[_0x9edd('0x2f')]);if(_0x173ec9[_0x9edd('0x2a')]>0x0){return _0x53f55b['status'](0x190)[_0x9edd('0x30')](_0x173ec9);}var _0x507cce=_0x2c3173[_0x9edd('0x2f')][_0x9edd('0x31')];return getAgent(_0x507cce)[_0x9edd('0x1b')](function(_0x5ca123){logger[_0x9edd('0x14')]('entityFound:',_0x5ca123[_0x9edd('0x18')]);emit(util[_0x9edd('0x35')]('user:%s',_0x5ca123[_0x9edd('0x18')]),'webbar:conference');return _0x53f55b[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x48')});})['catch'](handleError(_0x53f55b));};exports[_0x9edd('0x49')]=function(_0x321485,_0x45c17d){logger[_0x9edd('0x14')](_0x9edd('0x4a'),_0x321485['body']);var _0x48f017=transferValidation[_0x9edd('0xd')](_0x321485[_0x9edd('0x2f')]);if(_0x48f017['length']>0x0){return _0x45c17d['status'](0x190)['json'](_0x48f017);}var _0x1bc89b=_0x321485['body']['userId'];var _0x3ef9c9=_0x321485[_0x9edd('0x2f')]['sessionId'];var _0xb9ebeb=_0x321485[_0x9edd('0x2f')][_0x9edd('0x4b')];return getAgent(_0x1bc89b)['then'](function(_0x34b229){logger['info'](_0x9edd('0x3e'),_0x34b229[_0x9edd('0x18')]);emit(util['format'](_0x9edd('0x36'),_0x34b229[_0x9edd('0x18')]),'webbar:transfer',{'sessionId':_0x3ef9c9,'transferNumber':_0xb9ebeb});return _0x45c17d[_0x9edd('0x3b')](0xc8)[_0x9edd('0x30')]({'error':![],'message':_0x9edd('0x4c')});})[_0x9edd('0x20')](handleError(_0x45c17d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 0ae6fd9..1ebfb4d 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 _0x01d9=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x47b5df,_0x1a06f4){var _0xe8d73d=function(_0x44e73d){while(--_0x44e73d){_0x47b5df['push'](_0x47b5df['shift']());}};_0xe8d73d(++_0x1a06f4);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['get'](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x18')]);router[_0x901d('0x19')]('/',auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router['post'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x1b')]);router[_0x901d('0x19')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x19')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1d')]);router[_0x901d('0x19')](_0x901d('0x17'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x19')](_0x901d('0x1f'),controller[_0x901d('0x20')]);router['post'](_0x901d('0x21'),auth[_0x901d('0xd')](),controller['send']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x901d('0x22')]);router[_0x901d('0x23')]('/:id',auth[_0x901d('0xd')](),controller[_0x901d('0x24')]);router['delete'](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x25')]);router[_0x901d('0x23')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x26')]);router[_0x901d('0x23')]('/:id/users',auth[_0x901d('0xd')](),controller[_0x901d('0x27')]);module[_0x901d('0x28')]=router; \ No newline at end of file +var _0x8f4c=['create','addDisposition','/:id/canned_answers','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','post'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x543bd8,_0x1382c2){_0x543bd8=_0x543bd8-0x0;var _0x31ad82=_0x8f4c[_0x543bd8];return _0x31ad82;};'use strict';var multer=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var timeout=require(_0xc8f4('0x3'));var express=require(_0xc8f4('0x4'));var router=express[_0xc8f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8f4('0x6'));var interaction=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var controller=require('./whatsappAccount.controller');router[_0xc8f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc8f4('0xa'),auth['isAuthenticated'](),controller[_0xc8f4('0xb')]);router[_0xc8f4('0x9')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0xe')]);router['get'](_0xc8f4('0xf'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x10')]);router[_0xc8f4('0x9')]('/:id/canned_answers',auth[_0xc8f4('0xd')](),controller['getAnswers']);router[_0xc8f4('0x9')](_0xc8f4('0x11'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x12')]);router[_0xc8f4('0x9')]('/:id/applications',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x13')]);router[_0xc8f4('0x14')]('/',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x15')]);router[_0xc8f4('0x14')]('/:id/dispositions',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x16')]);router[_0xc8f4('0x14')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['addAnswer']);router[_0xc8f4('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xc8f4('0x18')]);router[_0xc8f4('0x14')](_0xc8f4('0x19'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1a')]);router[_0xc8f4('0x14')](_0xc8f4('0x1b'),controller[_0xc8f4('0x1c')]);router[_0xc8f4('0x14')](_0xc8f4('0x1d'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x1e')]);router[_0xc8f4('0x1f')]('/:id',auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x20')]);router[_0xc8f4('0x21')](_0xc8f4('0xc'),auth[_0xc8f4('0xd')](),controller[_0xc8f4('0x22')]);router[_0xc8f4('0x21')](_0xc8f4('0xf'),auth['isAuthenticated'](),controller[_0xc8f4('0x23')]);router[_0xc8f4('0x21')](_0xc8f4('0x17'),auth[_0xc8f4('0xd')](),controller['removeAnswers']);router[_0xc8f4('0x21')]('/:id/users',auth[_0xc8f4('0xd')](),controller['removeAgents']);module[_0xc8f4('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 64a2056..65459c5 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 _0x0f3e=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','sinch','TEXT'];(function(_0x51d3ac,_0x2cdcfc){var _0x29b333=function(_0xd4e32){while(--_0xd4e32){_0x51d3ac['push'](_0x51d3ac['shift']());}};_0x29b333(++_0x2cdcfc);}(_0x0f3e,0xfc));var _0xe0f3=function(_0x35e59e,_0x7546fe){_0x35e59e=_0x35e59e-0x0;var _0x11770f=_0x0f3e[_0x35e59e];return _0x11770f;};'use strict';var Sequelize=require(_0xe0f3('0x0'));var rs=require(_0xe0f3('0x1'));module[_0xe0f3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xe0f3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xe0f3('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xe0f3('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xe0f3('0x4')],'defaultValue':function(){return rs[_0xe0f3('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0xe0f3('0x6'))},'accountSid':{'type':Sequelize[_0xe0f3('0x4')]},'baseUrl':{'type':Sequelize[_0xe0f3('0x4')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe0f3('0x7')],'defaultValue':function(){return _0xe0f3('0x8');}},'notificationSound':{'type':Sequelize[_0xe0f3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe0f3('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe0f3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe0f3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe0f3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe0f3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe0f3('0xa')],'comment':_0xe0f3('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xe0f3('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9c13fd){if(!_0x9c13fd){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xe0f3('0xc'),_0x9c13fd);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3cdb=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x429e1,_0x3dcc52){var _0x4d01b0=function(_0xd04ffe){while(--_0xd04ffe){_0x429e1['push'](_0x429e1['shift']());}};_0x4d01b0(++_0x3dcc52);}(_0x3cdb,0xa1));var _0xb3cd=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x3cdb[_0x14476b];return _0x24e2e8;};'use strict';var Sequelize=require(_0xb3cd('0x0'));var rs=require(_0xb3cd('0x1'));module[_0xb3cd('0x2')]={'name':{'type':Sequelize[_0xb3cd('0x3')],'unique':_0xb3cd('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb3cd('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb3cd('0x3')],'defaultValue':function(){return rs[_0xb3cd('0x5')]();}},'phone':{'type':Sequelize[_0xb3cd('0x3')]},'type':{'type':Sequelize[_0xb3cd('0x6')]('twilio',_0xb3cd('0x7'))},'accountSid':{'type':Sequelize[_0xb3cd('0x3')]},'baseUrl':{'type':Sequelize[_0xb3cd('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb3cd('0x8')],'defaultValue':function(){return _0xb3cd('0x9');}},'notificationSound':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3cd('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb3cd('0xa')],'defaultValue':![],'comment':_0xb3cd('0xc'),'set':function(_0x6ea0da){if(!_0x6ea0da){this[_0xb3cd('0xd')](_0xb3cd('0xe'),null);}this['setDataValue'](_0xb3cd('0xf'),_0x6ea0da);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 6da36de..28ef89c 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 _0x07f3=['CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','MessageSid','notifications','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Contacts','WhatsappInteraction','interaction','created','applications','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','request-promise','bluebird','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','destroy','get','WhatsappAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','model','map','name','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','include','rows','params','intersection','fields','includeAll','options','catch','create','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','pick','WhatsappAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt'];(function(_0xe1172d,_0x5d627b){var _0x41fcde=function(_0x2b187f){while(--_0x2b187f){_0xe1172d['push'](_0xe1172d['shift']());}};_0x41fcde(++_0x5d627b);}(_0x07f3,0xed));var _0x307f=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x07f3[_0x1c510a];return _0x23cedd;};'use strict';var emlformat=require(_0x307f('0x0'));var rimraf=require(_0x307f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x307f('0x2'));var moment=require('moment');var BPromise=require(_0x307f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x307f('0x4'));var sox=require('sox');var csv=require(_0x307f('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x307f('0x6'));var _=require(_0x307f('0x7'));var squel=require(_0x307f('0x8'));var crypto=require(_0x307f('0x9'));var jsforce=require(_0x307f('0xa'));var deskjs=require(_0x307f('0xb'));var toCsv=require(_0x307f('0x5'));var querystring=require(_0x307f('0xc'));var Papa=require(_0x307f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x307f('0xe'));var as=require(_0x307f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x307f('0x10'))(_0x307f('0x11'));var utils=require(_0x307f('0x12'));var config=require(_0x307f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x307f('0x14'))['db'];config['redis']=_[_0x307f('0x15')](config[_0x307f('0x16')],{'host':_0x307f('0x17'),'port':0x18eb});var socket=require(_0x307f('0x18'))(new Redis(config[_0x307f('0x16')]));require('./whatsappAccount.socket')[_0x307f('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x307f('0x1a')][_0x307f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x552df2,_0x4abab7,_0x1429b2,_0x200759){return new BPromise(function(_0x3da267,_0x17aeeb){var _0x14d969=_0x200759||client;return _0x14d969[_0x307f('0x1c')](_0x552df2,_0x1429b2)[_0x307f('0x1d')](function(_0xa8dbce){logger[_0x307f('0x1e')](_0x307f('0x1f'),_0x4abab7,'request\x20sent');logger[_0x307f('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4abab7,_0x307f('0x21'),JSON[_0x307f('0x22')](_0xa8dbce));if(_0xa8dbce[_0x307f('0x23')]){if(_0xa8dbce[_0x307f('0x23')][_0x307f('0x24')]===0x1f4){logger[_0x307f('0x23')](_0x307f('0x1f'),_0x4abab7,_0xa8dbce[_0x307f('0x23')][_0x307f('0x25')]);return _0x17aeeb(_0xa8dbce[_0x307f('0x23')][_0x307f('0x25')]);}logger['error'](_0x307f('0x1f'),_0x4abab7,_0xa8dbce[_0x307f('0x23')]['message']);return _0x3da267(_0xa8dbce[_0x307f('0x23')][_0x307f('0x25')]);}else{logger[_0x307f('0x1e')](_0x307f('0x1f'),_0x4abab7,_0x307f('0x21'));_0x3da267(_0xa8dbce[_0x307f('0x26')][_0x307f('0x25')]);}})['catch'](function(_0x5419e4){logger[_0x307f('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x4abab7,_0x5419e4);_0x17aeeb(_0x5419e4);});});}function respondWithStatusCode(_0x2af9e0,_0x4e7561){_0x4e7561=_0x4e7561||0xcc;return function(_0x482b51){if(_0x482b51){return _0x2af9e0[_0x307f('0x27')](_0x4e7561);}return _0x2af9e0['status'](_0x4e7561)[_0x307f('0x28')]();};}function respondWithResult(_0x3bab95,_0x1e35a8){_0x1e35a8=_0x1e35a8||0xc8;return function(_0x31f6fe){if(_0x31f6fe){return _0x3bab95['status'](_0x1e35a8)[_0x307f('0x29')](_0x31f6fe);}};}function respondWithFilteredResult(_0x100045,_0x4c1ed7){return function(_0x4c7b7b){if(_0x4c7b7b){var _0x297794=typeof _0x4c1ed7['offset']===_0x307f('0x2a')&&typeof _0x4c1ed7[_0x307f('0x2b')]===_0x307f('0x2a');var _0x3a233b=_0x4c7b7b['count'];var _0x230d45=_0x297794?0x0:_0x4c1ed7[_0x307f('0x2c')];var _0x556ad2=_0x297794?_0x4c7b7b[_0x307f('0x2d')]:_0x4c1ed7['offset']+_0x4c1ed7[_0x307f('0x2b')];var _0x5d863a;if(_0x556ad2>=_0x3a233b){_0x556ad2=_0x3a233b;_0x5d863a=0xc8;}else{_0x5d863a=0xce;}_0x100045[_0x307f('0x2e')](_0x5d863a);return _0x100045[_0x307f('0x2f')](_0x307f('0x30'),_0x230d45+'-'+_0x556ad2+'/'+_0x3a233b)[_0x307f('0x29')](_0x4c7b7b);}return null;};}function patchUpdates(_0x473b1e){return function(_0x5cfb69){try{jsonpatch['apply'](_0x5cfb69,_0x473b1e,!![]);}catch(_0x3ae309){return BPromise[_0x307f('0x31')](_0x3ae309);}return _0x5cfb69['save']();};}function saveUpdates(_0x18cc0f,_0x2742ca){return function(_0x1a590c){if(_0x1a590c){return _0x1a590c['update'](_0x18cc0f)[_0x307f('0x1d')](function(_0x4d66ef){return _0x4d66ef;});}return null;};}function removeEntity(_0x462b0a,_0x48ea6c){return function(_0x42ed38){if(_0x42ed38){return _0x42ed38[_0x307f('0x32')]()[_0x307f('0x1d')](function(){var _0x3c1389=_0x42ed38[_0x307f('0x33')]({'plain':!![]});var _0x2756a5=_0x307f('0x34');return db[_0x307f('0x35')][_0x307f('0x32')]({'where':{'type':_0x2756a5,'resourceId':_0x3c1389['id']}})[_0x307f('0x1d')](function(){return _0x42ed38;});})['then'](function(){_0x462b0a['status'](0xcc)[_0x307f('0x28')]();});}};}function handleEntityNotFound(_0x5ef700,_0x212f0f){return function(_0x3e9c7e){if(!_0x3e9c7e){_0x5ef700[_0x307f('0x27')](0x194);}return _0x3e9c7e;};}function handleError(_0x3a9433,_0xc8e1df){_0xc8e1df=_0xc8e1df||0x1f4;return function(_0x3a38e6){logger[_0x307f('0x23')](_0x3a38e6[_0x307f('0x36')]);if(_0x3a38e6['name']){delete _0x3a38e6['name'];}_0x3a9433[_0x307f('0x2e')](_0xc8e1df)['send'](_0x3a38e6);};}exports[_0x307f('0x37')]=function(_0x1621f7,_0xee9845){var _0x13fe7f={'include':[{'model':db[_0x307f('0x38')],'as':_0x307f('0x39')}]},_0x241626={},_0x258fd8={'count':0x0,'rows':[]};var _0x2e7928=_['map'](db[_0x307f('0x3a')]['rawAttributes'],function(_0x1b6789){return{'name':_0x1b6789[_0x307f('0x3b')],'type':_0x1b6789[_0x307f('0x3c')]['key']};});_0x241626[_0x307f('0x3d')]=_[_0x307f('0x3e')](_0x2e7928,_0x307f('0x3f'));_0x241626[_0x307f('0x40')]=_[_0x307f('0x41')](_0x1621f7[_0x307f('0x40')]);_0x241626[_0x307f('0x42')]=_['intersection'](_0x241626['model'],_0x241626[_0x307f('0x40')]);_0x13fe7f[_0x307f('0x43')]=_['intersection'](_0x241626[_0x307f('0x3d')],qs['fields'](_0x1621f7['query']['fields']));_0x13fe7f[_0x307f('0x43')]=_0x13fe7f['attributes'][_0x307f('0x44')]?_0x13fe7f[_0x307f('0x43')]:_0x241626[_0x307f('0x3d')];if(!_0x1621f7[_0x307f('0x40')][_0x307f('0x45')](_0x307f('0x46'))){_0x13fe7f[_0x307f('0x2b')]=qs[_0x307f('0x2b')](_0x1621f7[_0x307f('0x40')]['limit']);_0x13fe7f[_0x307f('0x2c')]=qs[_0x307f('0x2c')](_0x1621f7[_0x307f('0x40')][_0x307f('0x2c')]);}_0x13fe7f[_0x307f('0x47')]=qs[_0x307f('0x48')](_0x1621f7['query'][_0x307f('0x48')]);_0x13fe7f['where']=qs[_0x307f('0x42')](_['pick'](_0x1621f7[_0x307f('0x40')],_0x241626[_0x307f('0x42')]),_0x2e7928);if(_0x1621f7['query'][_0x307f('0x49')]){_0x13fe7f[_0x307f('0x4a')]=_[_0x307f('0x4b')](_0x13fe7f[_0x307f('0x4a')],{'$or':_[_0x307f('0x3e')](_0x2e7928,function(_0x530cde){if(_0x530cde[_0x307f('0x3c')]!==_0x307f('0x4c')){var _0xdcabd1={};_0xdcabd1[_0x530cde['name']]={'$like':'%'+_0x1621f7[_0x307f('0x40')][_0x307f('0x49')]+'%'};return _0xdcabd1;}})});}_0x13fe7f=_[_0x307f('0x4b')]({},_0x13fe7f,_0x1621f7['options']);var _0xf2909={'where':_0x13fe7f[_0x307f('0x4a')]};return db[_0x307f('0x3a')][_0x307f('0x2d')](_0xf2909)[_0x307f('0x1d')](function(_0x1a9aed){_0x258fd8[_0x307f('0x2d')]=_0x1a9aed;if(_0x1621f7[_0x307f('0x40')]['includeAll']){_0x13fe7f[_0x307f('0x4d')]=[{'all':!![]}];}return db[_0x307f('0x3a')]['findAll'](_0x13fe7f);})['then'](function(_0x398496){_0x258fd8[_0x307f('0x4e')]=_0x398496;return _0x258fd8;})[_0x307f('0x1d')](respondWithFilteredResult(_0xee9845,_0x13fe7f))['catch'](handleError(_0xee9845,null));};exports['show']=function(_0x3407de,_0x47a12e){var _0x310747={'raw':![],'where':{'id':_0x3407de[_0x307f('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0x307f('0x39')}]},_0x2fe034={};_0x2fe034[_0x307f('0x3d')]=_[_0x307f('0x41')](db[_0x307f('0x3a')]['rawAttributes']);_0x2fe034[_0x307f('0x40')]=_[_0x307f('0x41')](_0x3407de[_0x307f('0x40')]);_0x2fe034['filters']=_[_0x307f('0x50')](_0x2fe034[_0x307f('0x3d')],_0x2fe034[_0x307f('0x40')]);_0x310747['attributes']=_['intersection'](_0x2fe034[_0x307f('0x3d')],qs[_0x307f('0x51')](_0x3407de['query'][_0x307f('0x51')]));_0x310747[_0x307f('0x43')]=_0x310747[_0x307f('0x43')][_0x307f('0x44')]?_0x310747[_0x307f('0x43')]:_0x2fe034[_0x307f('0x3d')];if(_0x3407de['query'][_0x307f('0x52')]){_0x310747['include']=[{'all':!![]}];}_0x310747=_[_0x307f('0x4b')]({},_0x310747,_0x3407de[_0x307f('0x53')]);return db[_0x307f('0x3a')]['find'](_0x310747)[_0x307f('0x1d')](handleEntityNotFound(_0x47a12e,null))[_0x307f('0x1d')](respondWithResult(_0x47a12e,null))[_0x307f('0x54')](handleError(_0x47a12e,null));};exports[_0x307f('0x55')]=function(_0x139883,_0x4215bf){return db[_0x307f('0x3a')]['create'](_0x139883['body'],{})['then'](function(_0x3a3504){var _0x34665c=_0x139883['user'][_0x307f('0x33')]({'plain':!![]});if(!_0x34665c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34665c['role']===_0x307f('0x56')){var _0x1bbe4f=_0x3a3504[_0x307f('0x33')]({'plain':!![]});var _0x5cf19e='WhatsappAccounts';return db[_0x307f('0x57')][_0x307f('0x58')]({'where':{'name':_0x5cf19e,'userProfileId':_0x34665c[_0x307f('0x59')]},'raw':!![]})[_0x307f('0x1d')](function(_0x498446){if(_0x498446&&_0x498446[_0x307f('0x5a')]===0x0){return db[_0x307f('0x35')][_0x307f('0x55')]({'name':_0x1bbe4f[_0x307f('0x3f')],'resourceId':_0x1bbe4f['id'],'type':_0x498446[_0x307f('0x3f')],'sectionId':_0x498446['id']},{})[_0x307f('0x1d')](function(){return _0x3a3504;});}else{return _0x3a3504;}})[_0x307f('0x54')](function(_0x4cb073){logger[_0x307f('0x23')](_0x307f('0x5b'),_0x4cb073);throw _0x4cb073;});}return _0x3a3504;})[_0x307f('0x1d')](respondWithResult(_0x4215bf,0xc9))['catch'](handleError(_0x4215bf,null));};exports[_0x307f('0x5c')]=function(_0x8e9d10,_0x6b7d0d){if(_0x8e9d10['body']['id']){delete _0x8e9d10['body']['id'];}return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0x8e9d10[_0x307f('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0x307f('0x39')}]})[_0x307f('0x1d')](handleEntityNotFound(_0x6b7d0d,null))[_0x307f('0x1d')](saveUpdates(_0x8e9d10[_0x307f('0x5d')],null))[_0x307f('0x1d')](respondWithResult(_0x6b7d0d,null))[_0x307f('0x54')](handleError(_0x6b7d0d,null));};exports[_0x307f('0x32')]=function(_0xcbc74e,_0x2abdae){return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0xcbc74e[_0x307f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2abdae,null))[_0x307f('0x1d')](removeEntity(_0x2abdae,null))[_0x307f('0x54')](handleError(_0x2abdae,null));};exports[_0x307f('0x5e')]=function(_0x10a134,_0x4b07b5){return db[_0x307f('0x3a')][_0x307f('0x5e')]()[_0x307f('0x1d')](respondWithResult(_0x4b07b5,null))['catch'](handleError(_0x4b07b5,null));};exports[_0x307f('0x5f')]=function(_0x2c28ee,_0x2a0d02,_0x398240){if(_0x2c28ee['body']['id']){delete _0x2c28ee[_0x307f('0x5d')]['id'];}return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0x2c28ee[_0x307f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2a0d02,null))[_0x307f('0x1d')](function(_0x57fe6e){if(_0x57fe6e){_0x2c28ee['body']['WhatsappAccountId']=_0x57fe6e['id'];return db[_0x307f('0x60')][_0x307f('0x55')](_0x2c28ee[_0x307f('0x5d')]);}})['then'](respondWithResult(_0x2a0d02,null))[_0x307f('0x54')](handleError(_0x2a0d02,null));};exports[_0x307f('0x61')]=function(_0x454fa0,_0x47d907,_0x17154d){var _0x3addfb={'raw':![],'where':{}};var _0xe836e3={};var _0xda64de={'count':0x0,'rows':[]};return db[_0x307f('0x3a')][_0x307f('0x62')]({'where':{'id':_0x454fa0[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x47d907,null))[_0x307f('0x1d')](function(_0x1e1bf0){if(_0x1e1bf0){_0xe836e3[_0x307f('0x3d')]=_[_0x307f('0x41')](db[_0x307f('0x60')][_0x307f('0x63')]);_0xe836e3[_0x307f('0x40')]=_[_0x307f('0x41')](_0x454fa0[_0x307f('0x40')]);_0xe836e3[_0x307f('0x42')]=_['intersection'](_0xe836e3[_0x307f('0x3d')],_0xe836e3[_0x307f('0x40')]);_0x3addfb[_0x307f('0x43')]=_['intersection'](_0xe836e3[_0x307f('0x3d')],qs['fields'](_0x454fa0[_0x307f('0x40')][_0x307f('0x51')]));_0x3addfb[_0x307f('0x43')]=_0x3addfb[_0x307f('0x43')]['length']?_0x3addfb[_0x307f('0x43')]:_0xe836e3[_0x307f('0x3d')];if(!_0x454fa0[_0x307f('0x40')][_0x307f('0x45')]('nolimit')){_0x3addfb[_0x307f('0x2b')]=qs[_0x307f('0x2b')](_0x454fa0['query'][_0x307f('0x2b')]);_0x3addfb['offset']=qs[_0x307f('0x2c')](_0x454fa0[_0x307f('0x40')]['offset']);}_0x3addfb[_0x307f('0x47')]=qs['sort'](_0x454fa0[_0x307f('0x40')][_0x307f('0x48')]);_0x3addfb[_0x307f('0x4a')]=qs['filters'](_[_0x307f('0x64')](_0x454fa0[_0x307f('0x40')],_0xe836e3[_0x307f('0x42')]));_0x3addfb[_0x307f('0x4a')][_0x307f('0x65')]=_0x1e1bf0['id'];if(_0x454fa0[_0x307f('0x40')][_0x307f('0x49')]){_0x3addfb[_0x307f('0x4a')]=_['merge'](_0x3addfb[_0x307f('0x4a')],{'$or':_['map'](_0x3addfb[_0x307f('0x43')],function(_0x182e82){var _0x4e2156={};_0x4e2156[_0x182e82]={'$like':'%'+_0x454fa0['query'][_0x307f('0x49')]+'%'};return _0x4e2156;})});}_0x3addfb=_[_0x307f('0x4b')]({},_0x3addfb,_0x454fa0['options']);return db[_0x307f('0x60')]['count']({'where':_0x3addfb['where']})[_0x307f('0x1d')](function(_0x3c5c55){_0xda64de[_0x307f('0x2d')]=_0x3c5c55;if(_0x454fa0[_0x307f('0x40')][_0x307f('0x52')]){_0x3addfb[_0x307f('0x4d')]=[{'all':!![]}];}return db[_0x307f('0x60')][_0x307f('0x66')](_0x3addfb);})[_0x307f('0x1d')](function(_0x4b5a2b){_0xda64de['rows']=_0x4b5a2b;return _0xda64de;});}})[_0x307f('0x1d')](respondWithFilteredResult(_0x47d907,_0x3addfb))[_0x307f('0x54')](handleError(_0x47d907,null));};exports[_0x307f('0x67')]=function(_0x267508,_0x1ac373,_0x397457){return db['WhatsappAccount']['find']({'where':{'id':_0x267508['params']['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x1ac373,null))[_0x307f('0x1d')](function(_0x3100a5){if(_0x3100a5){return _0x3100a5[_0x307f('0x67')](_0x267508[_0x307f('0x40')][_0x307f('0x68')]);}})['then'](respondWithStatusCode(_0x1ac373,null))[_0x307f('0x54')](handleError(_0x1ac373,null));};exports[_0x307f('0x69')]=function(_0x384793,_0x176389,_0x2ebb4b){if(_0x384793[_0x307f('0x5d')]['id']){delete _0x384793[_0x307f('0x5d')]['id'];}return db['WhatsappAccount'][_0x307f('0x58')]({'where':{'id':_0x384793[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x176389,null))[_0x307f('0x1d')](function(_0x23a883){if(_0x23a883){_0x384793[_0x307f('0x5d')]['WhatsappAccountId']=_0x23a883['id'];return db[_0x307f('0x6a')][_0x307f('0x55')](_0x384793[_0x307f('0x5d')]);}})[_0x307f('0x1d')](respondWithResult(_0x176389,null))[_0x307f('0x54')](handleError(_0x176389,null));};exports[_0x307f('0x6b')]=function(_0x5daa97,_0x4f8309,_0x1bfa75){var _0x96bae7={'raw':![],'where':{}};var _0x2d3a76={};var _0x157137={'count':0x0,'rows':[]};return db[_0x307f('0x3a')]['findOne']({'where':{'id':_0x5daa97[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x4f8309,null))[_0x307f('0x1d')](function(_0x4ce4ca){if(_0x4ce4ca){_0x2d3a76[_0x307f('0x3d')]=_[_0x307f('0x41')](db[_0x307f('0x6a')][_0x307f('0x63')]);_0x2d3a76['query']=_[_0x307f('0x41')](_0x5daa97[_0x307f('0x40')]);_0x2d3a76[_0x307f('0x42')]=_[_0x307f('0x50')](_0x2d3a76[_0x307f('0x3d')],_0x2d3a76[_0x307f('0x40')]);_0x96bae7['attributes']=_[_0x307f('0x50')](_0x2d3a76[_0x307f('0x3d')],qs[_0x307f('0x51')](_0x5daa97[_0x307f('0x40')][_0x307f('0x51')]));_0x96bae7['attributes']=_0x96bae7[_0x307f('0x43')][_0x307f('0x44')]?_0x96bae7[_0x307f('0x43')]:_0x2d3a76[_0x307f('0x3d')];if(!_0x5daa97['query'][_0x307f('0x45')](_0x307f('0x46'))){_0x96bae7[_0x307f('0x2b')]=qs[_0x307f('0x2b')](_0x5daa97[_0x307f('0x40')]['limit']);_0x96bae7['offset']=qs[_0x307f('0x2c')](_0x5daa97[_0x307f('0x40')][_0x307f('0x2c')]);}_0x96bae7[_0x307f('0x47')]=qs[_0x307f('0x48')](_0x5daa97[_0x307f('0x40')]['sort']);_0x96bae7[_0x307f('0x4a')]=qs[_0x307f('0x42')](_['pick'](_0x5daa97[_0x307f('0x40')],_0x2d3a76[_0x307f('0x42')]));_0x96bae7['where'][_0x307f('0x65')]=_0x4ce4ca['id'];if(_0x5daa97[_0x307f('0x40')][_0x307f('0x49')]){_0x96bae7[_0x307f('0x4a')]=_[_0x307f('0x4b')](_0x96bae7[_0x307f('0x4a')],{'$or':_[_0x307f('0x3e')](_0x96bae7[_0x307f('0x43')],function(_0xeb4b62){var _0xa41bb6={};_0xa41bb6[_0xeb4b62]={'$like':'%'+_0x5daa97[_0x307f('0x40')][_0x307f('0x49')]+'%'};return _0xa41bb6;})});}_0x96bae7=_['merge']({},_0x96bae7,_0x5daa97[_0x307f('0x53')]);return db[_0x307f('0x6a')][_0x307f('0x2d')]({'where':_0x96bae7[_0x307f('0x4a')]})[_0x307f('0x1d')](function(_0x58fc74){_0x157137['count']=_0x58fc74;if(_0x5daa97['query'][_0x307f('0x52')]){_0x96bae7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x307f('0x66')](_0x96bae7);})[_0x307f('0x1d')](function(_0x211287){_0x157137[_0x307f('0x4e')]=_0x211287;return _0x157137;});}})[_0x307f('0x1d')](respondWithFilteredResult(_0x4f8309,_0x96bae7))['catch'](handleError(_0x4f8309,null));};exports['removeAnswers']=function(_0x5ea761,_0x41b331,_0x564a11){return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0x5ea761[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x41b331,null))[_0x307f('0x1d')](function(_0x54af61){if(_0x54af61){return _0x54af61['removeAnswers'](_0x5ea761[_0x307f('0x40')][_0x307f('0x68')]);}})[_0x307f('0x1d')](respondWithStatusCode(_0x41b331,null))[_0x307f('0x54')](handleError(_0x41b331,null));};exports[_0x307f('0x6c')]=function(_0x4e8c78,_0x17b8ca,_0x3dc49b){return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0x4e8c78['params']['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x17b8ca,null))[_0x307f('0x1d')](function(_0x77d3c9){if(_0x77d3c9){return _0x77d3c9['addAgents'](_0x4e8c78[_0x307f('0x5d')][_0x307f('0x68')],_[_0x307f('0x6d')](_0x4e8c78[_0x307f('0x5d')],[_0x307f('0x68'),'id'])||{})[_0x307f('0x6e')](function(_0x478c3d){for(var _0x40ce40=0x0;_0x40ce40<_0x4e8c78[_0x307f('0x5d')][_0x307f('0x68')][_0x307f('0x44')];_0x40ce40+=0x1){socket[_0x307f('0x6f')](_0x307f('0x70'),{'UserId':Number(_0x4e8c78['body'][_0x307f('0x68')][_0x40ce40]),'WhatsappAccountId':Number(_0x4e8c78[_0x307f('0x4f')]['id'])});}return _0x478c3d;});}})['then'](respondWithResult(_0x17b8ca,null))[_0x307f('0x54')](handleError(_0x17b8ca,null));};exports['removeAgents']=function(_0xfabc74,_0x2ab8cc,_0x397bcf){return db[_0x307f('0x3a')]['find']({'where':{'id':_0xfabc74[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x2ab8cc,null))['then'](function(_0x4c7f43){if(_0x4c7f43){return _0x4c7f43[_0x307f('0x71')](_0xfabc74[_0x307f('0x40')][_0x307f('0x68')])[_0x307f('0x1d')](function(){if(_[_0x307f('0x72')](_0xfabc74['query'][_0x307f('0x68')])){for(var _0x1be2d6=0x0;_0x1be2d6<_0xfabc74['query'][_0x307f('0x68')]['length'];_0x1be2d6+=0x1){socket[_0x307f('0x6f')](_0x307f('0x73'),{'UserId':Number(_0xfabc74[_0x307f('0x40')][_0x307f('0x68')][_0x1be2d6]),'WhatsappAccountId':Number(_0xfabc74[_0x307f('0x4f')]['id'])});}}else{socket[_0x307f('0x6f')](_0x307f('0x73'),{'UserId':Number(_0xfabc74[_0x307f('0x40')][_0x307f('0x68')]),'WhatsappAccountId':Number(_0xfabc74[_0x307f('0x4f')]['id'])});}});}})[_0x307f('0x1d')](respondWithStatusCode(_0x2ab8cc,null))['catch'](handleError(_0x2ab8cc,null));};exports[_0x307f('0x74')]=function(_0x42cd0d,_0xa99486,_0x3948d6){var _0x3053ab={};var _0x30ff4e={};var _0x4c9d2c;var _0xe6548b;return db[_0x307f('0x3a')][_0x307f('0x62')]({'where':{'id':_0x42cd0d[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0xa99486,null))['then'](function(_0x5be2a7){if(_0x5be2a7){_0x4c9d2c=_0x5be2a7;_0x30ff4e[_0x307f('0x3d')]=_[_0x307f('0x41')](db[_0x307f('0x75')][_0x307f('0x63')]);_0x30ff4e[_0x307f('0x40')]=_[_0x307f('0x41')](_0x42cd0d[_0x307f('0x40')]);_0x30ff4e[_0x307f('0x42')]=_[_0x307f('0x50')](_0x30ff4e[_0x307f('0x3d')],_0x30ff4e[_0x307f('0x40')]);_0x3053ab[_0x307f('0x43')]=_[_0x307f('0x50')](_0x30ff4e[_0x307f('0x3d')],qs[_0x307f('0x51')](_0x42cd0d['query'][_0x307f('0x51')]));_0x3053ab[_0x307f('0x43')]=_0x3053ab[_0x307f('0x43')][_0x307f('0x44')]?_0x3053ab[_0x307f('0x43')]:_0x30ff4e[_0x307f('0x3d')];_0x3053ab[_0x307f('0x47')]=qs[_0x307f('0x48')](_0x42cd0d[_0x307f('0x40')][_0x307f('0x48')]);_0x3053ab[_0x307f('0x4a')]=qs[_0x307f('0x42')](_[_0x307f('0x64')](_0x42cd0d[_0x307f('0x40')],_0x30ff4e[_0x307f('0x42')]));if(_0x42cd0d['query'][_0x307f('0x49')]){_0x3053ab[_0x307f('0x4a')]=_[_0x307f('0x4b')](_0x3053ab[_0x307f('0x4a')],{'$or':_[_0x307f('0x3e')](_0x3053ab['attributes'],function(_0x5359c8){var _0xd03c78={};_0xd03c78[_0x5359c8]={'$like':'%'+_0x42cd0d[_0x307f('0x40')]['filter']+'%'};return _0xd03c78;})});}_0x3053ab=_[_0x307f('0x4b')]({},_0x3053ab,_0x42cd0d['options']);return _0x4c9d2c[_0x307f('0x74')](_0x3053ab);}})[_0x307f('0x1d')](function(_0x1caaab){if(_0x1caaab){_0xe6548b=_0x1caaab[_0x307f('0x44')];if(!_0x42cd0d[_0x307f('0x40')][_0x307f('0x45')](_0x307f('0x46'))){_0x3053ab[_0x307f('0x2b')]=qs[_0x307f('0x2b')](_0x42cd0d[_0x307f('0x40')][_0x307f('0x2b')]);_0x3053ab[_0x307f('0x2c')]=qs[_0x307f('0x2c')](_0x42cd0d[_0x307f('0x40')][_0x307f('0x2c')]);}return _0x4c9d2c['getAgents'](_0x3053ab);}})['then'](function(_0x460cfe){if(_0x460cfe){return _0x460cfe?{'count':_0xe6548b,'rows':_0x460cfe}:null;}})['then'](respondWithResult(_0xa99486,null))[_0x307f('0x54')](handleError(_0xa99486,null));};exports[_0x307f('0x76')]=function(_0x3ea32b,_0xba39b2){var _0x45f8df=_0x3ea32b[_0x307f('0x4f')]['id'];var _0x4fbeb0=_0x3ea32b[_0x307f('0x5d')];var _0x254a74=0xc8;var _0x78b475=null;return db[_0x307f('0x77')][_0x307f('0x78')]({'isolationLevel':db['sequelize'][_0x307f('0x79')][_0x307f('0x7a')][_0x307f('0x7b')]},function(_0x4a57e8){return db[_0x307f('0x3a')][_0x307f('0x62')]({'where':{'id':_0x45f8df},'transaction':_0x4a57e8})[_0x307f('0x1d')](function(_0x2a6d9b){if(_0x2a6d9b){return db[_0x307f('0x7c')][_0x307f('0x32')]({'where':{'WhatsappAccountId':_0x45f8df},'transaction':_0x4a57e8})['then'](function(){var _0x42378b=_[_0x307f('0x3e')](_0x4fbeb0,function(_0x3674d7){_0x3674d7['WhatsappAccountId']=_0x45f8df;return _0x3674d7;});return db[_0x307f('0x7c')][_0x307f('0x7d')](_0x42378b,{'transaction':_0x4a57e8});});}else{_0x254a74=0x194;_0x78b475=[];}});})[_0x307f('0x1d')](function(){if(_0x254a74!==0x194){return db[_0x307f('0x7c')][_0x307f('0x7e')]({'where':{'WhatsappAccountId':_0x45f8df},'order':'priority'})[_0x307f('0x1d')](function(_0x5b7c5e){_0x78b475=_0x5b7c5e;});}})[_0x307f('0x54')](function(_0xac3ec5){_0x254a74=0x1f4;logger[_0x307f('0x23')](_0xac3ec5[_0x307f('0x36')]);if(_0xac3ec5[_0x307f('0x3f')]){delete _0xac3ec5['name'];}_0x78b475=_0xac3ec5;})[_0x307f('0x7f')](function(){if(_0x78b475===null){_0xba39b2[_0x307f('0x27')](_0x254a74);}else{if(_0x254a74===0x1f4){_0xba39b2[_0x307f('0x2e')](_0x254a74)[_0x307f('0x80')](_0x78b475);}else{_0xba39b2[_0x307f('0x2e')](_0x254a74)['json'](_0x78b475);}}});};exports[_0x307f('0x81')]=function(_0x35969a,_0x1218c6,_0x123d1e){var _0x49269f={};var _0x42551d={};var _0x39be3b;var _0xe6c53f;return db[_0x307f('0x3a')][_0x307f('0x62')]({'where':{'id':_0x35969a[_0x307f('0x4f')]['id']}})[_0x307f('0x1d')](handleEntityNotFound(_0x1218c6,null))[_0x307f('0x1d')](function(_0x3bfb08){if(_0x3bfb08){_0x39be3b=_0x3bfb08;_0x42551d[_0x307f('0x3d')]=_['keys'](db[_0x307f('0x7c')][_0x307f('0x63')]);_0x42551d[_0x307f('0x40')]=_['keys'](_0x35969a[_0x307f('0x40')]);_0x42551d['filters']=_[_0x307f('0x50')](_0x42551d['model'],_0x42551d[_0x307f('0x40')]);_0x49269f['attributes']=_['intersection'](_0x42551d[_0x307f('0x3d')],qs[_0x307f('0x51')](_0x35969a[_0x307f('0x40')]['fields']));_0x49269f[_0x307f('0x43')]=_0x49269f[_0x307f('0x43')][_0x307f('0x44')]?_0x49269f['attributes']:_0x42551d[_0x307f('0x3d')];_0x49269f[_0x307f('0x47')]=qs['sort'](_0x35969a['query'][_0x307f('0x48')]);_0x49269f[_0x307f('0x4a')]=qs['filters'](_[_0x307f('0x64')](_0x35969a[_0x307f('0x40')],_0x42551d[_0x307f('0x42')]));if(_0x35969a[_0x307f('0x40')][_0x307f('0x49')]){_0x49269f[_0x307f('0x4a')]=_[_0x307f('0x4b')](_0x49269f['where'],{'$or':_['map'](_0x49269f[_0x307f('0x43')],function(_0x56ec78){var _0x4a21b6={};_0x4a21b6[_0x56ec78]={'$like':'%'+_0x35969a[_0x307f('0x40')][_0x307f('0x49')]+'%'};return _0x4a21b6;})});}_0x49269f=_['merge']({},_0x49269f,_0x35969a[_0x307f('0x53')]);return _0x39be3b[_0x307f('0x81')](_0x49269f);}})[_0x307f('0x1d')](function(_0x5e8ac9){if(_0x5e8ac9){_0xe6c53f=_0x5e8ac9[_0x307f('0x44')];if(!_0x35969a[_0x307f('0x40')]['hasOwnProperty']('nolimit')){_0x49269f[_0x307f('0x2b')]=qs[_0x307f('0x2b')](_0x35969a[_0x307f('0x40')]['limit']);_0x49269f[_0x307f('0x2c')]=qs[_0x307f('0x2c')](_0x35969a['query'][_0x307f('0x2c')]);}return _0x39be3b[_0x307f('0x81')](_0x49269f);}})[_0x307f('0x1d')](function(_0x312f24){if(_0x312f24){return _0x312f24?{'count':_0xe6c53f,'rows':_0x312f24}:null;}})[_0x307f('0x1d')](respondWithResult(_0x1218c6,null))[_0x307f('0x54')](handleError(_0x1218c6,null));};exports[_0x307f('0x82')]=function(_0x4b2799,_0x392a76,_0x43787a){var _0x38cbc1={'channel':_0x307f('0x83')};var _0x232463=[];var _0x11fe1d=[];var _0x5481be={};return db[_0x307f('0x3a')]['find']({'where':{'id':_0x4b2799[_0x307f('0x4f')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x307f('0x84')}]})[_0x307f('0x1d')](handleEntityNotFound(_0x392a76,null))[_0x307f('0x1d')](function(_0x10f5bb){_0x38cbc1[_0x307f('0x85')]=_0x10f5bb;if(_0x38cbc1[_0x307f('0x85')]&&_0x38cbc1[_0x307f('0x85')][_0x307f('0x3c')]===_0x307f('0x86')&&_0x4b2799[_0x307f('0x5d')][_0x307f('0x87')]){if(_0x4b2799[_0x307f('0x5d')][_0x307f('0x87')][_0x307f('0x44')]===0x0)return;if(_0x4b2799[_0x307f('0x5d')][_0x307f('0x87')][0x0]['state']!==_0x307f('0x88'))return;return db[_0x307f('0x89')][_0x307f('0x5c')]({'read':!![],'readAt':_0x4b2799[_0x307f('0x5d')]['statuses'][0x0][_0x307f('0x8a')]},{'where':{'messageId':_0x4b2799[_0x307f('0x5d')]['statuses'][0x0][_0x307f('0x8b')]},'individualHooks':!![]})[_0x307f('0x1d')](function(_0x1e2fb7){return _0x392a76['status'](0xc8)[_0x307f('0x29')](_0x1e2fb7);});}_0x38cbc1['applications']=_[_0x307f('0x8c')](_0x10f5bb[_0x307f('0x84')],[_0x307f('0x8d')],[_0x307f('0x8e')]);if(_0x38cbc1[_0x307f('0x85')][_0x307f('0x84')]){delete _0x38cbc1[_0x307f('0x85')]['Applications'];}return db[_0x307f('0x8f')][_0x307f('0x5e')]()[_0x307f('0x1d')](function(_0x4f63cd){if(!_0x4f63cd){throw new db[(_0x307f('0x90'))][(_0x307f('0x91'))](_0x307f('0x92'));}_0x232463=_[_0x307f('0x93')](_[_0x307f('0x41')](_0x4f63cd),['createdAt',_0x307f('0x94')]);_0x11fe1d=_[_0x307f('0x93')](_[_0x307f('0x41')](_0x4f63cd),['createdAt','updatedAt',_0x307f('0x95'),_0x307f('0x96')]);_0x38cbc1['body']={'mapKey':_0x307f('0x97')};if(_0x38cbc1[_0x307f('0x85')]&&_0x38cbc1[_0x307f('0x85')][_0x307f('0x3c')]===_0x307f('0x98')){_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')]=_0x4b2799['body']['From'][_0x307f('0x9a')](_0x307f('0x9b'),'');_0x38cbc1[_0x307f('0x5d')][_0x307f('0x5d')]=_0x4b2799[_0x307f('0x5d')][_0x307f('0x9c')];_0x38cbc1[_0x307f('0x5d')]['messageId']=_0x4b2799[_0x307f('0x5d')][_0x307f('0x9d')];}if(_0x38cbc1[_0x307f('0x85')]&&_0x38cbc1['account'][_0x307f('0x3c')]==='sinch'){_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')]=_0x4b2799[_0x307f('0x5d')][_0x307f('0x9e')][0x0][_0x307f('0x99')];_0x38cbc1[_0x307f('0x5d')]['body']=_0x4b2799[_0x307f('0x5d')][_0x307f('0x9e')][0x0][_0x307f('0x25')][_0x307f('0x5d')];_0x38cbc1['body'][_0x307f('0x9f')]=_0x4b2799[_0x307f('0x5d')][_0x307f('0x9e')][0x0][_0x307f('0x8b')];}if(_0x38cbc1[_0x307f('0x5d')]['id']){delete _0x38cbc1[_0x307f('0x5d')]['id'];}if(_[_0x307f('0xa0')](_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')])){throw new db[(_0x307f('0x90'))][(_0x307f('0x91'))]('from\x20is\x20mandatory');}if(_[_0x307f('0xa0')](_0x38cbc1[_0x307f('0x5d')]['body'])||_0x38cbc1['body']['body']===''){throw new db[(_0x307f('0x90'))][(_0x307f('0x91'))](_0x307f('0xa1'));}if(_['isNil'](_0x38cbc1['body'][_0x307f('0xa2')])){throw new db['Sequelize'][(_0x307f('0x91'))](_0x307f('0xa3')+_0x11fe1d);}if(!_[_0x307f('0xa4')](_0x11fe1d,_0x38cbc1['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x307f('0xa5')+_0x11fe1d);}_0x5481be[_0x38cbc1['body']['mapKey']]=_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')];return db[_0x307f('0xa6')][_0x307f('0x58')]({'where':{'id':_0x38cbc1[_0x307f('0x85')][_0x307f('0x96')]},'include':[{'model':db[_0x307f('0x8f')],'as':'Contacts','where':_0x5481be,'limit':0x1,'order':[[_0x307f('0x94'),_0x307f('0xa7')]]}]});})[_0x307f('0x1d')](handleEntityNotFound(_0x392a76,null))[_0x307f('0x1d')](function(_0x13a265){if(_0x13a265){_0x38cbc1['list']=_[_0x307f('0x6d')](_0x13a265,[_0x307f('0xa8')]);if(_0x13a265['Contacts']['length']){return _0x13a265['Contacts'][0x0];}var _0xe6222c=_[_0x307f('0x15')](_0x38cbc1[_0x307f('0x5d')],{'firstName':_0x38cbc1['body'][_0x307f('0x99')],'ListId':_0x13a265['id']});_0xe6222c[_0x38cbc1[_0x307f('0x5d')][_0x307f('0xa2')]]=_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')];return db[_0x307f('0x8f')][_0x307f('0x55')](_0xe6222c,{'fields':_0x232463,'raw':!![]});}})[_0x307f('0x1d')](handleEntityNotFound(_0x392a76,null))[_0x307f('0x1d')](function(_0x4da771){if(_0x4da771){_0x38cbc1['contact']=_0x4da771;var _0x3485f4={'ContactId':_0x4da771['id'],'phone':_0x38cbc1[_0x307f('0x5d')]['from'],'WhatsappAccountId':_0x4b2799[_0x307f('0x4f')]['id']};var _0x366223={'ContactId':_0x4da771['id'],'WhatsappAccountId':_0x4b2799[_0x307f('0x4f')]['id'],'closed':![]};return db[_0x307f('0xa9')][_0x307f('0x58')]({'where':_0x366223})[_0x307f('0x1d')](function(_0x5d5872){if(_0x5d5872){return[_0x5d5872,![]];}return db[_0x307f('0xa9')][_0x307f('0x55')](_0x3485f4)[_0x307f('0x1d')](function(_0xadfead){return[_0xadfead,!![]];});});}})['spread'](function(_0x565153,_0x4f62a2){_0x38cbc1[_0x307f('0xaa')]=_0x565153['get']({'plain':!![]});_0x38cbc1[_0x307f('0xaa')][_0x307f('0xab')]=![];if(_0x4f62a2){if(_0x38cbc1['account']['autoclose']){_0x38cbc1[_0x307f('0xac')]['push']({'id':0x0,'priority':_0x38cbc1[_0x307f('0xac')][_0x307f('0x44')]+0x1,'app':'close','appdata':_0x307f('0xad'),'interval':_0x307f('0xae')});}_0x38cbc1[_0x307f('0xaa')][_0x307f('0xab')]=!![];}return db[_0x307f('0x89')]['create']({'phone':_0x38cbc1[_0x307f('0x5d')][_0x307f('0x99')],'messageId':_0x38cbc1[_0x307f('0x5d')][_0x307f('0x9f')],'body':_0x38cbc1[_0x307f('0x5d')][_0x307f('0x5d')],'WhatsappAccountId':_0x4b2799[_0x307f('0x4f')]['id'],'WhatsappInteractionId':_0x565153['id'],'direction':'in','ContactId':_0x565153[_0x307f('0xaf')],'AttachmentId':_0x38cbc1[_0x307f('0x5d')][_0x307f('0xb0')]});})[_0x307f('0x1d')](function(_0x5f4d5e){_0x38cbc1[_0x307f('0x25')]=_0x5f4d5e;if(_0x38cbc1[_0x307f('0xaa')][_0x307f('0xb1')]){return db[_0x307f('0x75')]['find']({'attributes':['id','name'],'where':{'id':_0x38cbc1[_0x307f('0xaa')][_0x307f('0xb1')]}})[_0x307f('0x1d')](function(_0x212e6c){if(_0x212e6c){_0x38cbc1[_0x307f('0xac')][_0x307f('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x212e6c['name']+','+(_0x38cbc1[_0x307f('0x85')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x307f('0xb3'),_0x307f('0xb4'),_0x38cbc1);});}return respondWithRpcPromise(_0x307f('0xb3'),_0x307f('0xb4'),_0x38cbc1);})[_0x307f('0x1d')](function(_0x28f5f3){if(_0x28f5f3){var _0x386b00=0xc8;var _0x10ca53=_0x307f('0xb5');logger[_0x307f('0x1e')](_0x307f('0xb6'),_0x10ca53,_0x386b00,_0x307f('0xb7'));logger['debug'](_0x307f('0xb8'),_0x10ca53,_0x386b00,'entity\x20found',JSON['stringify'](_0x28f5f3));if(_0x38cbc1[_0x307f('0x85')][_0x307f('0x3c')]===_0x307f('0x98')){return _0x392a76[_0x307f('0x2e')](_0x386b00)[_0x307f('0x2f')]('Content-Type',_0x307f('0xb9'))[_0x307f('0x80')](_0x307f('0xba'));}else{return _0x392a76[_0x307f('0x2e')](_0x386b00)[_0x307f('0x29')](_0x28f5f3);}}});})[_0x307f('0x54')](handleError(_0x392a76,null));};exports[_0x307f('0x80')]=function(_0x2227ba,_0x10b43f,_0x1ad668){var _0x5ac76b,_0x1a3662,_0x54ac9a;if(_['isNil'](_0x2227ba['body'][_0x307f('0x5d')])||_0x2227ba[_0x307f('0x5d')][_0x307f('0x5d')]===''){throw new db[(_0x307f('0x90'))]['ValidationError'](_0x307f('0xa1'));}if(_[_0x307f('0xa0')](_0x2227ba[_0x307f('0x5d')]['to'])){throw new db[(_0x307f('0x90'))][(_0x307f('0x91'))](_0x307f('0xbb'));}_0x5ac76b=_0x2227ba[_0x307f('0x5d')]['to'];return db[_0x307f('0x3a')][_0x307f('0x58')]({'where':{'id':_0x2227ba[_0x307f('0x4f')]['id']},'include':[{'model':db[_0x307f('0xa6')],'as':'List','include':[{'model':db[_0x307f('0x8f')],'as':_0x307f('0xa8'),'where':{'mobile':_0x5ac76b},'limit':0x1,'order':[[_0x307f('0x94'),_0x307f('0xa7')]]}]}]})['then'](handleEntityNotFound(_0x10b43f,null))[_0x307f('0x1d')](function(_0x39346f){if(_0x39346f&&_0x39346f[_0x307f('0xbc')]){_0x1a3662=_0x39346f['get']({'plain':!![]});if(_0x1a3662[_0x307f('0xbc')]&&_0x1a3662['List'][_0x307f('0xa8')][_0x307f('0x44')]){return _0x1a3662['List'][_0x307f('0xa8')][0x0];}return db[_0x307f('0x8f')][_0x307f('0x55')](_[_0x307f('0x15')](_0x2227ba[_0x307f('0x5d')],{'firstName':_0x5ac76b,'mobile':_0x5ac76b,'phone':_0x5ac76b,'ListId':_0x1a3662[_0x307f('0x96')]}));}})[_0x307f('0x1d')](handleEntityNotFound(_0x10b43f,null))[_0x307f('0x1d')](function(_0x21f280){if(_0x21f280){_0x54ac9a=_0x21f280;return db['WhatsappInteraction'][_0x307f('0x58')]({'where':{'ContactId':_0x54ac9a['id'],'closed':![],'WhatsappAccountId':_0x1a3662['id']}})[_0x307f('0x1d')](function(_0x545a54){if(_0x545a54){return[_0x545a54,![]];}return db[_0x307f('0xa9')][_0x307f('0x55')]({'UserId':_0x2227ba[_0x307f('0x56')]['id'],'ContactId':_0x54ac9a['id'],'WhatsappAccountId':_0x1a3662['id'],'phone':_0x5ac76b,'firstMsgDirection':_0x307f('0xbd'),'Messages':[_['merge'](_0x2227ba['body'],{'read':![],'body':_0x2227ba[_0x307f('0x5d')]['body'],'phone':_0x5ac76b,'WhatsappAccountId':_0x1a3662['id'],'UserId':_0x2227ba[_0x307f('0x56')]['id'],'ContactId':_0x54ac9a['id']})]},{'include':[{'model':db[_0x307f('0x89')],'as':'Messages'}]})[_0x307f('0x1d')](function(_0x453937){return[_0x453937,!![]];});});}})[_0x307f('0x6e')](function(_0xa833a8,_0x5d7e7d){if(_0x5d7e7d){return _0xa833a8;}return db['WhatsappMessage'][_0x307f('0x55')](_[_0x307f('0x4b')](_0x2227ba[_0x307f('0x5d')],{'read':![],'body':_0x2227ba[_0x307f('0x5d')][_0x307f('0x5d')],'phone':_0x5ac76b,'WhatsappAccountId':_0x1a3662['id'],'WhatsappInteractionId':_0xa833a8['id'],'UserId':_0x2227ba[_0x307f('0x56')]['id'],'ContactId':_0x54ac9a['id']}))['then'](function(_0x431934){_0xa833a8['dataValues'][_0x307f('0xbe')]=[];_0xa833a8[_0x307f('0xbf')][_0x307f('0xbe')][_0x307f('0xc0')](_0x431934[_0x307f('0xbf')]);return _0xa833a8;});})[_0x307f('0x1d')](respondWithResult(_0x10b43f,null))['catch'](handleError(_0x10b43f,null));}; \ No newline at end of file +var _0x616c=['key','query','filters','model','attributes','intersection','fields','order','sort','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','length','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','pick','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','type','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','DESC','List','out','dataValues','Messages','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','map','WhatsappAccount','rawAttributes','fieldName'];(function(_0x105b02,_0x5bdbdd){var _0x36237c=function(_0x50541b){while(--_0x50541b){_0x105b02['push'](_0x105b02['shift']());}};_0x36237c(++_0x5bdbdd);}(_0x616c,0x14e));var _0xc616=function(_0x3224d7,_0x1e7c2a){_0x3224d7=_0x3224d7-0x0;var _0x46435f=_0x616c[_0x3224d7];return _0x46435f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc616('0x0'));var zipdir=require(_0xc616('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc616('0x2'));var moment=require(_0xc616('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc616('0x4'));var util=require(_0xc616('0x5'));var path=require(_0xc616('0x6'));var sox=require(_0xc616('0x7'));var csv=require('to-csv');var ejs=require(_0xc616('0x8'));var fs=require('fs');var fs_extra=require(_0xc616('0x9'));var _=require(_0xc616('0xa'));var squel=require(_0xc616('0xb'));var crypto=require('crypto');var jsforce=require(_0xc616('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc616('0xd'));var Papa=require(_0xc616('0xe'));var Redis=require(_0xc616('0xf'));var authService=require(_0xc616('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc616('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc616('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc616('0x13'));var licenseUtil=require(_0xc616('0x14'));var db=require(_0xc616('0x15'))['db'];config[_0xc616('0x16')]=_[_0xc616('0x17')](config['redis'],{'host':_0xc616('0x18'),'port':0x18eb});var socket=require(_0xc616('0x19'))(new Redis(config['redis']));require(_0xc616('0x1a'))[_0xc616('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc616('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5afda6,_0x1f1c3c,_0x4d3e77,_0x437c7a){return new BPromise(function(_0x1cf1c9,_0x5360c6){var _0x232d74=_0x437c7a||client;return _0x232d74['request'](_0x5afda6,_0x4d3e77)[_0xc616('0x1d')](function(_0x1cb668){logger[_0xc616('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x1f1c3c,_0xc616('0x1f'));logger['debug'](_0xc616('0x20'),_0x1f1c3c,_0xc616('0x1f'),JSON[_0xc616('0x21')](_0x1cb668));if(_0x1cb668[_0xc616('0x22')]){if(_0x1cb668['error']['code']===0x1f4){logger[_0xc616('0x22')](_0xc616('0x23'),_0x1f1c3c,_0x1cb668['error'][_0xc616('0x24')]);return _0x5360c6(_0x1cb668[_0xc616('0x22')]['message']);}logger[_0xc616('0x22')](_0xc616('0x23'),_0x1f1c3c,_0x1cb668['error'][_0xc616('0x24')]);return _0x1cf1c9(_0x1cb668[_0xc616('0x22')][_0xc616('0x24')]);}else{logger[_0xc616('0x1e')](_0xc616('0x23'),_0x1f1c3c,'request\x20sent');_0x1cf1c9(_0x1cb668[_0xc616('0x25')][_0xc616('0x24')]);}})[_0xc616('0x26')](function(_0x32a325){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1f1c3c,_0x32a325);_0x5360c6(_0x32a325);});});}function respondWithStatusCode(_0x220a67,_0x25e42e){_0x25e42e=_0x25e42e||0xcc;return function(_0xdc4745){if(_0xdc4745){return _0x220a67[_0xc616('0x27')](_0x25e42e);}return _0x220a67[_0xc616('0x28')](_0x25e42e)[_0xc616('0x29')]();};}function respondWithResult(_0xb11975,_0x28a37f){_0x28a37f=_0x28a37f||0xc8;return function(_0x18da71){if(_0x18da71){return _0xb11975[_0xc616('0x28')](_0x28a37f)[_0xc616('0x2a')](_0x18da71);}};}function respondWithFilteredResult(_0x244179,_0x153e1c){return function(_0x4e0e22){if(_0x4e0e22){var _0x1eaf15=typeof _0x153e1c[_0xc616('0x2b')]==='undefined'&&typeof _0x153e1c[_0xc616('0x2c')]===_0xc616('0x2d');var _0x3c0c53=_0x4e0e22['count'];var _0x5798cb=_0x1eaf15?0x0:_0x153e1c['offset'];var _0x23cbd0=_0x1eaf15?_0x4e0e22[_0xc616('0x2e')]:_0x153e1c[_0xc616('0x2b')]+_0x153e1c[_0xc616('0x2c')];var _0xb7723a;if(_0x23cbd0>=_0x3c0c53){_0x23cbd0=_0x3c0c53;_0xb7723a=0xc8;}else{_0xb7723a=0xce;}_0x244179['status'](_0xb7723a);return _0x244179[_0xc616('0x2f')](_0xc616('0x30'),_0x5798cb+'-'+_0x23cbd0+'/'+_0x3c0c53)['json'](_0x4e0e22);}return null;};}function patchUpdates(_0xa22e1e){return function(_0x4229c5){try{jsonpatch[_0xc616('0x31')](_0x4229c5,_0xa22e1e,!![]);}catch(_0xde3c76){return BPromise[_0xc616('0x32')](_0xde3c76);}return _0x4229c5[_0xc616('0x33')]();};}function saveUpdates(_0x510d02,_0x42fde3){return function(_0x401ad1){if(_0x401ad1){return _0x401ad1[_0xc616('0x34')](_0x510d02)['then'](function(_0x3a48f8){return _0x3a48f8;});}return null;};}function removeEntity(_0x3b4eaa,_0x14deb5){return function(_0x4b88b2){if(_0x4b88b2){return _0x4b88b2[_0xc616('0x35')]()[_0xc616('0x1d')](function(){var _0x4411c0=_0x4b88b2['get']({'plain':!![]});var _0x39b886=_0xc616('0x36');return db[_0xc616('0x37')]['destroy']({'where':{'type':_0x39b886,'resourceId':_0x4411c0['id']}})[_0xc616('0x1d')](function(){return _0x4b88b2;});})[_0xc616('0x1d')](function(){_0x3b4eaa[_0xc616('0x28')](0xcc)[_0xc616('0x29')]();});}};}function handleEntityNotFound(_0x2f6065,_0x59ff23){return function(_0x5619b0){if(!_0x5619b0){_0x2f6065['sendStatus'](0x194);}return _0x5619b0;};}function handleError(_0x50c27b,_0x41ba60){_0x41ba60=_0x41ba60||0x1f4;return function(_0x172b19){logger[_0xc616('0x22')](_0x172b19[_0xc616('0x38')]);if(_0x172b19[_0xc616('0x39')]){delete _0x172b19[_0xc616('0x39')];}_0x50c27b[_0xc616('0x28')](_0x41ba60)[_0xc616('0x3a')](_0x172b19);};}exports['index']=function(_0x4f23c4,_0x5f8542){var _0x219458={'include':[{'model':db[_0xc616('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4b4ced={},_0x130c9a={'count':0x0,'rows':[]};var _0x565095=_[_0xc616('0x3c')](db[_0xc616('0x3d')][_0xc616('0x3e')],function(_0x2ab6c4){return{'name':_0x2ab6c4[_0xc616('0x3f')],'type':_0x2ab6c4['type'][_0xc616('0x40')]};});_0x4b4ced['model']=_[_0xc616('0x3c')](_0x565095,_0xc616('0x39'));_0x4b4ced['query']=_['keys'](_0x4f23c4[_0xc616('0x41')]);_0x4b4ced[_0xc616('0x42')]=_['intersection'](_0x4b4ced[_0xc616('0x43')],_0x4b4ced[_0xc616('0x41')]);_0x219458[_0xc616('0x44')]=_[_0xc616('0x45')](_0x4b4ced[_0xc616('0x43')],qs[_0xc616('0x46')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x46')]));_0x219458[_0xc616('0x44')]=_0x219458[_0xc616('0x44')]['length']?_0x219458['attributes']:_0x4b4ced[_0xc616('0x43')];if(!_0x4f23c4[_0xc616('0x41')]['hasOwnProperty']('nolimit')){_0x219458['limit']=qs[_0xc616('0x2c')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x2c')]);_0x219458['offset']=qs[_0xc616('0x2b')](_0x4f23c4['query'][_0xc616('0x2b')]);}_0x219458[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x4f23c4[_0xc616('0x41')][_0xc616('0x48')]);_0x219458['where']=qs[_0xc616('0x42')](_['pick'](_0x4f23c4[_0xc616('0x41')],_0x4b4ced[_0xc616('0x42')]),_0x565095);if(_0x4f23c4[_0xc616('0x41')]['filter']){_0x219458['where']=_[_0xc616('0x49')](_0x219458['where'],{'$or':_[_0xc616('0x3c')](_0x565095,function(_0x52e58c){if(_0x52e58c['type']!==_0xc616('0x4a')){var _0x3f1481={};_0x3f1481[_0x52e58c[_0xc616('0x39')]]={'$like':'%'+_0x4f23c4[_0xc616('0x41')][_0xc616('0x4b')]+'%'};return _0x3f1481;}})});}_0x219458=_['merge']({},_0x219458,_0x4f23c4[_0xc616('0x4c')]);var _0x15f974={'where':_0x219458[_0xc616('0x4d')]};return db['WhatsappAccount']['count'](_0x15f974)[_0xc616('0x1d')](function(_0x40b7d1){_0x130c9a[_0xc616('0x2e')]=_0x40b7d1;if(_0x4f23c4['query'][_0xc616('0x4e')]){_0x219458[_0xc616('0x4f')]=[{'all':!![]}];}return db[_0xc616('0x3d')][_0xc616('0x50')](_0x219458);})[_0xc616('0x1d')](function(_0x1ed746){_0x130c9a[_0xc616('0x51')]=_0x1ed746;return _0x130c9a;})[_0xc616('0x1d')](respondWithFilteredResult(_0x5f8542,_0x219458))[_0xc616('0x26')](handleError(_0x5f8542,null));};exports[_0xc616('0x52')]=function(_0x464360,_0x5df040){var _0x18245a={'raw':![],'where':{'id':_0x464360[_0xc616('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0xc616('0x54')}]},_0x190e3e={};_0x190e3e[_0xc616('0x43')]=_[_0xc616('0x55')](db['WhatsappAccount'][_0xc616('0x3e')]);_0x190e3e[_0xc616('0x41')]=_[_0xc616('0x55')](_0x464360[_0xc616('0x41')]);_0x190e3e['filters']=_['intersection'](_0x190e3e['model'],_0x190e3e[_0xc616('0x41')]);_0x18245a['attributes']=_[_0xc616('0x45')](_0x190e3e[_0xc616('0x43')],qs[_0xc616('0x46')](_0x464360['query']['fields']));_0x18245a[_0xc616('0x44')]=_0x18245a[_0xc616('0x44')][_0xc616('0x56')]?_0x18245a[_0xc616('0x44')]:_0x190e3e[_0xc616('0x43')];if(_0x464360['query'][_0xc616('0x4e')]){_0x18245a['include']=[{'all':!![]}];}_0x18245a=_[_0xc616('0x49')]({},_0x18245a,_0x464360['options']);return db[_0xc616('0x3d')][_0xc616('0x57')](_0x18245a)['then'](handleEntityNotFound(_0x5df040,null))['then'](respondWithResult(_0x5df040,null))[_0xc616('0x26')](handleError(_0x5df040,null));};exports[_0xc616('0x58')]=function(_0xcfc781,_0x2a15ca){return db['WhatsappAccount'][_0xc616('0x58')](_0xcfc781['body'],{})['then'](function(_0x529b73){var _0xf70952=_0xcfc781['user'][_0xc616('0x59')]({'plain':!![]});if(!_0xf70952)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf70952[_0xc616('0x5a')]===_0xc616('0x5b')){var _0x2b8824=_0x529b73[_0xc616('0x59')]({'plain':!![]});var _0x4cf619=_0xc616('0x36');return db[_0xc616('0x5c')][_0xc616('0x57')]({'where':{'name':_0x4cf619,'userProfileId':_0xf70952[_0xc616('0x5d')]},'raw':!![]})[_0xc616('0x1d')](function(_0xec02d6){if(_0xec02d6&&_0xec02d6[_0xc616('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b8824[_0xc616('0x39')],'resourceId':_0x2b8824['id'],'type':_0xec02d6[_0xc616('0x39')],'sectionId':_0xec02d6['id']},{})['then'](function(){return _0x529b73;});}else{return _0x529b73;}})['catch'](function(_0x570234){logger[_0xc616('0x22')](_0xc616('0x5f'),_0x570234);throw _0x570234;});}return _0x529b73;})[_0xc616('0x1d')](respondWithResult(_0x2a15ca,0xc9))[_0xc616('0x26')](handleError(_0x2a15ca,null));};exports[_0xc616('0x34')]=function(_0x117547,_0x32e943){if(_0x117547[_0xc616('0x60')]['id']){delete _0x117547[_0xc616('0x60')]['id'];}return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x117547[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xc616('0x1d')](handleEntityNotFound(_0x32e943,null))[_0xc616('0x1d')](saveUpdates(_0x117547[_0xc616('0x60')],null))[_0xc616('0x1d')](respondWithResult(_0x32e943,null))['catch'](handleError(_0x32e943,null));};exports[_0xc616('0x35')]=function(_0x1a6080,_0x47a004){return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0x1a6080[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x47a004,null))[_0xc616('0x1d')](removeEntity(_0x47a004,null))['catch'](handleError(_0x47a004,null));};exports['describe']=function(_0x3c8602,_0x52f0da){return db[_0xc616('0x3d')][_0xc616('0x61')]()[_0xc616('0x1d')](respondWithResult(_0x52f0da,null))[_0xc616('0x26')](handleError(_0x52f0da,null));};exports[_0xc616('0x62')]=function(_0x4ea762,_0x19534d,_0x1802f8){if(_0x4ea762[_0xc616('0x60')]['id']){delete _0x4ea762[_0xc616('0x60')]['id'];}return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0x4ea762[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x19534d,null))[_0xc616('0x1d')](function(_0x5d47da){if(_0x5d47da){_0x4ea762[_0xc616('0x60')][_0xc616('0x63')]=_0x5d47da['id'];return db[_0xc616('0x64')]['create'](_0x4ea762['body']);}})['then'](respondWithResult(_0x19534d,null))[_0xc616('0x26')](handleError(_0x19534d,null));};exports[_0xc616('0x65')]=function(_0x2adcf4,_0xf37a2b,_0x31205b){var _0x17105b={'raw':![],'where':{}};var _0x29547a={};var _0x21fa1f={'count':0x0,'rows':[]};return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x2adcf4[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0xf37a2b,null))[_0xc616('0x1d')](function(_0x33ed5c){if(_0x33ed5c){_0x29547a[_0xc616('0x43')]=_[_0xc616('0x55')](db[_0xc616('0x64')][_0xc616('0x3e')]);_0x29547a['query']=_[_0xc616('0x55')](_0x2adcf4['query']);_0x29547a[_0xc616('0x42')]=_['intersection'](_0x29547a[_0xc616('0x43')],_0x29547a[_0xc616('0x41')]);_0x17105b[_0xc616('0x44')]=_[_0xc616('0x45')](_0x29547a[_0xc616('0x43')],qs[_0xc616('0x46')](_0x2adcf4['query'][_0xc616('0x46')]));_0x17105b[_0xc616('0x44')]=_0x17105b['attributes'][_0xc616('0x56')]?_0x17105b[_0xc616('0x44')]:_0x29547a[_0xc616('0x43')];if(!_0x2adcf4[_0xc616('0x41')]['hasOwnProperty'](_0xc616('0x67'))){_0x17105b['limit']=qs[_0xc616('0x2c')](_0x2adcf4['query'][_0xc616('0x2c')]);_0x17105b[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x2adcf4[_0xc616('0x41')][_0xc616('0x2b')]);}_0x17105b['order']=qs[_0xc616('0x48')](_0x2adcf4['query'][_0xc616('0x48')]);_0x17105b[_0xc616('0x4d')]=qs[_0xc616('0x42')](_['pick'](_0x2adcf4[_0xc616('0x41')],_0x29547a[_0xc616('0x42')]));_0x17105b[_0xc616('0x4d')]['WhatsappAccountId']=_0x33ed5c['id'];if(_0x2adcf4[_0xc616('0x41')][_0xc616('0x4b')]){_0x17105b[_0xc616('0x4d')]=_['merge'](_0x17105b['where'],{'$or':_['map'](_0x17105b[_0xc616('0x44')],function(_0x1aedd){var _0x23bd84={};_0x23bd84[_0x1aedd]={'$like':'%'+_0x2adcf4['query'][_0xc616('0x4b')]+'%'};return _0x23bd84;})});}_0x17105b=_[_0xc616('0x49')]({},_0x17105b,_0x2adcf4[_0xc616('0x4c')]);return db['Disposition']['count']({'where':_0x17105b['where']})[_0xc616('0x1d')](function(_0x2bfa98){_0x21fa1f[_0xc616('0x2e')]=_0x2bfa98;if(_0x2adcf4[_0xc616('0x41')]['includeAll']){_0x17105b[_0xc616('0x4f')]=[{'all':!![]}];}return db[_0xc616('0x64')]['findAll'](_0x17105b);})[_0xc616('0x1d')](function(_0x12c77b){_0x21fa1f['rows']=_0x12c77b;return _0x21fa1f;});}})[_0xc616('0x1d')](respondWithFilteredResult(_0xf37a2b,_0x17105b))[_0xc616('0x26')](handleError(_0xf37a2b,null));};exports[_0xc616('0x68')]=function(_0xa5778c,_0x59f878,_0x32fbce){return db['WhatsappAccount'][_0xc616('0x57')]({'where':{'id':_0xa5778c[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x59f878,null))[_0xc616('0x1d')](function(_0x2f3b28){if(_0x2f3b28){return _0x2f3b28['removeDispositions'](_0xa5778c[_0xc616('0x41')][_0xc616('0x69')]);}})['then'](respondWithStatusCode(_0x59f878,null))['catch'](handleError(_0x59f878,null));};exports[_0xc616('0x6a')]=function(_0x28c340,_0x533c72,_0xe79124){if(_0x28c340['body']['id']){delete _0x28c340[_0xc616('0x60')]['id'];}return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x28c340[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x533c72,null))['then'](function(_0xece723){if(_0xece723){_0x28c340['body'][_0xc616('0x63')]=_0xece723['id'];return db[_0xc616('0x6b')][_0xc616('0x58')](_0x28c340[_0xc616('0x60')]);}})[_0xc616('0x1d')](respondWithResult(_0x533c72,null))[_0xc616('0x26')](handleError(_0x533c72,null));};exports[_0xc616('0x6c')]=function(_0x5d3257,_0x210347,_0x46fa7b){var _0x3f93e6={'raw':![],'where':{}};var _0x1c4576={};var _0x1d8099={'count':0x0,'rows':[]};return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x5d3257[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x210347,null))[_0xc616('0x1d')](function(_0x26dfc8){if(_0x26dfc8){_0x1c4576[_0xc616('0x43')]=_[_0xc616('0x55')](db['CannedAnswer']['rawAttributes']);_0x1c4576['query']=_[_0xc616('0x55')](_0x5d3257['query']);_0x1c4576[_0xc616('0x42')]=_[_0xc616('0x45')](_0x1c4576[_0xc616('0x43')],_0x1c4576['query']);_0x3f93e6[_0xc616('0x44')]=_[_0xc616('0x45')](_0x1c4576[_0xc616('0x43')],qs[_0xc616('0x46')](_0x5d3257[_0xc616('0x41')][_0xc616('0x46')]));_0x3f93e6[_0xc616('0x44')]=_0x3f93e6[_0xc616('0x44')][_0xc616('0x56')]?_0x3f93e6[_0xc616('0x44')]:_0x1c4576[_0xc616('0x43')];if(!_0x5d3257[_0xc616('0x41')][_0xc616('0x6d')](_0xc616('0x67'))){_0x3f93e6['limit']=qs[_0xc616('0x2c')](_0x5d3257[_0xc616('0x41')]['limit']);_0x3f93e6[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x5d3257[_0xc616('0x41')][_0xc616('0x2b')]);}_0x3f93e6[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x5d3257['query'][_0xc616('0x48')]);_0x3f93e6['where']=qs['filters'](_[_0xc616('0x6e')](_0x5d3257['query'],_0x1c4576[_0xc616('0x42')]));_0x3f93e6[_0xc616('0x4d')][_0xc616('0x63')]=_0x26dfc8['id'];if(_0x5d3257[_0xc616('0x41')][_0xc616('0x4b')]){_0x3f93e6[_0xc616('0x4d')]=_[_0xc616('0x49')](_0x3f93e6[_0xc616('0x4d')],{'$or':_[_0xc616('0x3c')](_0x3f93e6[_0xc616('0x44')],function(_0x134c02){var _0x4b1e2b={};_0x4b1e2b[_0x134c02]={'$like':'%'+_0x5d3257['query'][_0xc616('0x4b')]+'%'};return _0x4b1e2b;})});}_0x3f93e6=_[_0xc616('0x49')]({},_0x3f93e6,_0x5d3257[_0xc616('0x4c')]);return db[_0xc616('0x6b')]['count']({'where':_0x3f93e6['where']})[_0xc616('0x1d')](function(_0x2530d6){_0x1d8099[_0xc616('0x2e')]=_0x2530d6;if(_0x5d3257['query'][_0xc616('0x4e')]){_0x3f93e6['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc616('0x50')](_0x3f93e6);})[_0xc616('0x1d')](function(_0x574510){_0x1d8099['rows']=_0x574510;return _0x1d8099;});}})[_0xc616('0x1d')](respondWithFilteredResult(_0x210347,_0x3f93e6))[_0xc616('0x26')](handleError(_0x210347,null));};exports[_0xc616('0x6f')]=function(_0x525f22,_0x30c226,_0x1b397e){return db[_0xc616('0x3d')]['find']({'where':{'id':_0x525f22['params']['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x30c226,null))[_0xc616('0x1d')](function(_0x461fd0){if(_0x461fd0){return _0x461fd0[_0xc616('0x6f')](_0x525f22[_0xc616('0x41')][_0xc616('0x69')]);}})[_0xc616('0x1d')](respondWithStatusCode(_0x30c226,null))[_0xc616('0x26')](handleError(_0x30c226,null));};exports['addAgents']=function(_0x31c8bb,_0x8c5b72,_0xb8a9d8){return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x31c8bb[_0xc616('0x53')]['id']}})['then'](handleEntityNotFound(_0x8c5b72,null))[_0xc616('0x1d')](function(_0x4974ac){if(_0x4974ac){return _0x4974ac[_0xc616('0x70')](_0x31c8bb[_0xc616('0x60')]['ids'],_[_0xc616('0x71')](_0x31c8bb[_0xc616('0x60')],[_0xc616('0x69'),'id'])||{})[_0xc616('0x72')](function(_0x598bed){for(var _0x574abf=0x0;_0x574abf<_0x31c8bb['body'][_0xc616('0x69')][_0xc616('0x56')];_0x574abf+=0x1){socket[_0xc616('0x73')](_0xc616('0x74'),{'UserId':Number(_0x31c8bb[_0xc616('0x60')][_0xc616('0x69')][_0x574abf]),'WhatsappAccountId':Number(_0x31c8bb[_0xc616('0x53')]['id'])});}return _0x598bed;});}})['then'](respondWithResult(_0x8c5b72,null))['catch'](handleError(_0x8c5b72,null));};exports['removeAgents']=function(_0x26723f,_0x233ced,_0x568584){return db[_0xc616('0x3d')]['find']({'where':{'id':_0x26723f['params']['id']}})['then'](handleEntityNotFound(_0x233ced,null))['then'](function(_0x46f92b){if(_0x46f92b){return _0x46f92b[_0xc616('0x75')](_0x26723f[_0xc616('0x41')][_0xc616('0x69')])['then'](function(){if(_[_0xc616('0x76')](_0x26723f[_0xc616('0x41')][_0xc616('0x69')])){for(var _0x38e34a=0x0;_0x38e34a<_0x26723f[_0xc616('0x41')][_0xc616('0x69')][_0xc616('0x56')];_0x38e34a+=0x1){socket[_0xc616('0x73')](_0xc616('0x77'),{'UserId':Number(_0x26723f['query'][_0xc616('0x69')][_0x38e34a]),'WhatsappAccountId':Number(_0x26723f[_0xc616('0x53')]['id'])});}}else{socket['emit'](_0xc616('0x77'),{'UserId':Number(_0x26723f['query'][_0xc616('0x69')]),'WhatsappAccountId':Number(_0x26723f['params']['id'])});}});}})[_0xc616('0x1d')](respondWithStatusCode(_0x233ced,null))[_0xc616('0x26')](handleError(_0x233ced,null));};exports[_0xc616('0x78')]=function(_0x26ef30,_0x5f2aa3,_0x59f8d5){var _0x5f7b18={};var _0x2ca412={};var _0x305ffd;var _0x3a54c3;return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x26ef30[_0xc616('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f2aa3,null))[_0xc616('0x1d')](function(_0x115632){if(_0x115632){_0x305ffd=_0x115632;_0x2ca412[_0xc616('0x43')]=_[_0xc616('0x55')](db['User'][_0xc616('0x3e')]);_0x2ca412['query']=_[_0xc616('0x55')](_0x26ef30[_0xc616('0x41')]);_0x2ca412[_0xc616('0x42')]=_[_0xc616('0x45')](_0x2ca412[_0xc616('0x43')],_0x2ca412[_0xc616('0x41')]);_0x5f7b18[_0xc616('0x44')]=_[_0xc616('0x45')](_0x2ca412[_0xc616('0x43')],qs[_0xc616('0x46')](_0x26ef30[_0xc616('0x41')][_0xc616('0x46')]));_0x5f7b18[_0xc616('0x44')]=_0x5f7b18['attributes'][_0xc616('0x56')]?_0x5f7b18[_0xc616('0x44')]:_0x2ca412[_0xc616('0x43')];_0x5f7b18[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x26ef30[_0xc616('0x41')][_0xc616('0x48')]);_0x5f7b18[_0xc616('0x4d')]=qs[_0xc616('0x42')](_[_0xc616('0x6e')](_0x26ef30[_0xc616('0x41')],_0x2ca412[_0xc616('0x42')]));if(_0x26ef30['query'][_0xc616('0x4b')]){_0x5f7b18[_0xc616('0x4d')]=_['merge'](_0x5f7b18['where'],{'$or':_[_0xc616('0x3c')](_0x5f7b18['attributes'],function(_0x3f3ae7){var _0x5e6ce3={};_0x5e6ce3[_0x3f3ae7]={'$like':'%'+_0x26ef30[_0xc616('0x41')][_0xc616('0x4b')]+'%'};return _0x5e6ce3;})});}_0x5f7b18=_['merge']({},_0x5f7b18,_0x26ef30[_0xc616('0x4c')]);return _0x305ffd[_0xc616('0x78')](_0x5f7b18);}})[_0xc616('0x1d')](function(_0x72153e){if(_0x72153e){_0x3a54c3=_0x72153e[_0xc616('0x56')];if(!_0x26ef30[_0xc616('0x41')][_0xc616('0x6d')](_0xc616('0x67'))){_0x5f7b18[_0xc616('0x2c')]=qs[_0xc616('0x2c')](_0x26ef30['query'][_0xc616('0x2c')]);_0x5f7b18[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x26ef30[_0xc616('0x41')][_0xc616('0x2b')]);}return _0x305ffd[_0xc616('0x78')](_0x5f7b18);}})[_0xc616('0x1d')](function(_0x59cc2e){if(_0x59cc2e){return _0x59cc2e?{'count':_0x3a54c3,'rows':_0x59cc2e}:null;}})[_0xc616('0x1d')](respondWithResult(_0x5f2aa3,null))['catch'](handleError(_0x5f2aa3,null));};exports['addApplications']=function(_0x48fea5,_0x2b1343){var _0x475279=_0x48fea5[_0xc616('0x53')]['id'];var _0x241776=_0x48fea5[_0xc616('0x60')];var _0x356aae=0xc8;var _0x3ed9a4=null;return db[_0xc616('0x79')][_0xc616('0x7a')]({'isolationLevel':db[_0xc616('0x79')][_0xc616('0x7b')][_0xc616('0x7c')][_0xc616('0x7d')]},function(_0xd14a70){return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x475279},'transaction':_0xd14a70})[_0xc616('0x1d')](function(_0x3e047a){if(_0x3e047a){return db[_0xc616('0x7e')][_0xc616('0x35')]({'where':{'WhatsappAccountId':_0x475279},'transaction':_0xd14a70})[_0xc616('0x1d')](function(){var _0x278cf5=_[_0xc616('0x3c')](_0x241776,function(_0x54c4b0){_0x54c4b0[_0xc616('0x63')]=_0x475279;return _0x54c4b0;});return db[_0xc616('0x7e')][_0xc616('0x7f')](_0x278cf5,{'transaction':_0xd14a70});});}else{_0x356aae=0x194;_0x3ed9a4=[];}});})[_0xc616('0x1d')](function(){if(_0x356aae!==0x194){return db[_0xc616('0x7e')][_0xc616('0x80')]({'where':{'WhatsappAccountId':_0x475279},'order':_0xc616('0x81')})[_0xc616('0x1d')](function(_0x197664){_0x3ed9a4=_0x197664;});}})[_0xc616('0x26')](function(_0x250cc6){_0x356aae=0x1f4;logger[_0xc616('0x22')](_0x250cc6[_0xc616('0x38')]);if(_0x250cc6[_0xc616('0x39')]){delete _0x250cc6[_0xc616('0x39')];}_0x3ed9a4=_0x250cc6;})[_0xc616('0x82')](function(){if(_0x3ed9a4===null){_0x2b1343[_0xc616('0x27')](_0x356aae);}else{if(_0x356aae===0x1f4){_0x2b1343[_0xc616('0x28')](_0x356aae)[_0xc616('0x3a')](_0x3ed9a4);}else{_0x2b1343['status'](_0x356aae)[_0xc616('0x2a')](_0x3ed9a4);}}});};exports[_0xc616('0x83')]=function(_0x19a2bb,_0x51b437,_0x41d044){var _0x1e20c6={};var _0x42a0bb={};var _0x936432;var _0x19a1af;return db[_0xc616('0x3d')][_0xc616('0x66')]({'where':{'id':_0x19a2bb[_0xc616('0x53')]['id']}})[_0xc616('0x1d')](handleEntityNotFound(_0x51b437,null))[_0xc616('0x1d')](function(_0x5f325b){if(_0x5f325b){_0x936432=_0x5f325b;_0x42a0bb['model']=_['keys'](db[_0xc616('0x7e')]['rawAttributes']);_0x42a0bb['query']=_[_0xc616('0x55')](_0x19a2bb[_0xc616('0x41')]);_0x42a0bb['filters']=_[_0xc616('0x45')](_0x42a0bb[_0xc616('0x43')],_0x42a0bb[_0xc616('0x41')]);_0x1e20c6['attributes']=_[_0xc616('0x45')](_0x42a0bb[_0xc616('0x43')],qs[_0xc616('0x46')](_0x19a2bb['query'][_0xc616('0x46')]));_0x1e20c6[_0xc616('0x44')]=_0x1e20c6[_0xc616('0x44')][_0xc616('0x56')]?_0x1e20c6[_0xc616('0x44')]:_0x42a0bb[_0xc616('0x43')];_0x1e20c6[_0xc616('0x47')]=qs[_0xc616('0x48')](_0x19a2bb[_0xc616('0x41')]['sort']);_0x1e20c6[_0xc616('0x4d')]=qs[_0xc616('0x42')](_[_0xc616('0x6e')](_0x19a2bb['query'],_0x42a0bb[_0xc616('0x42')]));if(_0x19a2bb[_0xc616('0x41')]['filter']){_0x1e20c6[_0xc616('0x4d')]=_['merge'](_0x1e20c6[_0xc616('0x4d')],{'$or':_[_0xc616('0x3c')](_0x1e20c6[_0xc616('0x44')],function(_0x56cced){var _0x31e0c6={};_0x31e0c6[_0x56cced]={'$like':'%'+_0x19a2bb['query'][_0xc616('0x4b')]+'%'};return _0x31e0c6;})});}_0x1e20c6=_[_0xc616('0x49')]({},_0x1e20c6,_0x19a2bb['options']);return _0x936432[_0xc616('0x83')](_0x1e20c6);}})[_0xc616('0x1d')](function(_0x1bd1f4){if(_0x1bd1f4){_0x19a1af=_0x1bd1f4[_0xc616('0x56')];if(!_0x19a2bb[_0xc616('0x41')]['hasOwnProperty'](_0xc616('0x67'))){_0x1e20c6['limit']=qs[_0xc616('0x2c')](_0x19a2bb[_0xc616('0x41')][_0xc616('0x2c')]);_0x1e20c6[_0xc616('0x2b')]=qs[_0xc616('0x2b')](_0x19a2bb[_0xc616('0x41')][_0xc616('0x2b')]);}return _0x936432[_0xc616('0x83')](_0x1e20c6);}})[_0xc616('0x1d')](function(_0x2513ca){if(_0x2513ca){return _0x2513ca?{'count':_0x19a1af,'rows':_0x2513ca}:null;}})[_0xc616('0x1d')](respondWithResult(_0x51b437,null))[_0xc616('0x26')](handleError(_0x51b437,null));};exports[_0xc616('0x84')]=function(_0x564a95,_0x4af228,_0x22f895){var _0x138b54={'channel':_0xc616('0x85')};var _0x37e881=[];var _0x10d291=[];var _0x9c10f2={};return db[_0xc616('0x3d')]['find']({'where':{'id':_0x564a95[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0x7e')],'as':_0xc616('0x86')}]})[_0xc616('0x1d')](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x5538fb){_0x138b54['account']=_0x5538fb;if(_0x138b54[_0xc616('0x87')]&&_0x138b54[_0xc616('0x87')]['type']===_0xc616('0x88')&&_0x564a95[_0xc616('0x60')]['statuses']){if(_0x564a95[_0xc616('0x60')][_0xc616('0x89')][_0xc616('0x56')]===0x0)return;if(_0x564a95[_0xc616('0x60')][_0xc616('0x89')][0x0]['state']!==_0xc616('0x8a'))return;return db[_0xc616('0x8b')][_0xc616('0x34')]({'read':!![],'readAt':_0x564a95[_0xc616('0x60')]['statuses'][0x0][_0xc616('0x8c')]},{'where':{'messageId':_0x564a95[_0xc616('0x60')]['statuses'][0x0][_0xc616('0x8d')]},'individualHooks':!![]})['then'](function(_0x58c611){return _0x4af228[_0xc616('0x28')](0xc8)[_0xc616('0x2a')](_0x58c611);});}_0x138b54[_0xc616('0x8e')]=_[_0xc616('0x8f')](_0x5538fb[_0xc616('0x86')],['priority'],[_0xc616('0x90')]);if(_0x138b54[_0xc616('0x87')][_0xc616('0x86')]){delete _0x138b54[_0xc616('0x87')]['Applications'];}return db[_0xc616('0x91')][_0xc616('0x61')]()[_0xc616('0x1d')](function(_0x84a0ad){if(!_0x84a0ad){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0x94'));}_0x37e881=_[_0xc616('0x95')](_['keys'](_0x84a0ad),['createdAt',_0xc616('0x96')]);_0x10d291=_[_0xc616('0x95')](_[_0xc616('0x55')](_0x84a0ad),['createdAt',_0xc616('0x96'),_0xc616('0x97'),_0xc616('0x98')]);_0x138b54[_0xc616('0x60')]={'mapKey':_0xc616('0x99')};if(_0x138b54['account']&&_0x138b54['account'][_0xc616('0x9a')]==='twilio'){_0x138b54[_0xc616('0x60')][_0xc616('0x9b')]=_0x564a95[_0xc616('0x60')][_0xc616('0x9c')]['replace'](_0xc616('0x9d'),'');_0x138b54[_0xc616('0x60')][_0xc616('0x60')]=_0x564a95[_0xc616('0x60')][_0xc616('0x9e')];_0x138b54['body'][_0xc616('0x9f')]=_0x564a95[_0xc616('0x60')][_0xc616('0xa0')];}if(_0x138b54['account']&&_0x138b54['account'][_0xc616('0x9a')]===_0xc616('0x88')){_0x138b54[_0xc616('0x60')]['from']=_0x564a95[_0xc616('0x60')]['notifications'][0x0]['from'];_0x138b54['body'][_0xc616('0x60')]=_0x564a95[_0xc616('0x60')][_0xc616('0xa1')][0x0][_0xc616('0x24')][_0xc616('0x60')];_0x138b54[_0xc616('0x60')]['messageId']=_0x564a95[_0xc616('0x60')][_0xc616('0xa1')][0x0][_0xc616('0x8d')];}if(_0x138b54[_0xc616('0x60')]['id']){delete _0x138b54['body']['id'];}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0x9b')])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa3'));}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0x60')])||_0x138b54[_0xc616('0x60')][_0xc616('0x60')]===''){throw new db['Sequelize'][(_0xc616('0x93'))](_0xc616('0xa4'));}if(_[_0xc616('0xa2')](_0x138b54[_0xc616('0x60')][_0xc616('0xa5')])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa6')+_0x10d291);}if(!_[_0xc616('0xa7')](_0x10d291,_0x138b54[_0xc616('0x60')]['mapKey'])){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))](_0xc616('0xa8')+_0x10d291);}_0x9c10f2[_0x138b54[_0xc616('0x60')][_0xc616('0xa5')]]=_0x138b54[_0xc616('0x60')][_0xc616('0x9b')];return db[_0xc616('0xa9')][_0xc616('0x57')]({'where':{'id':_0x138b54[_0xc616('0x87')]['ListId']},'include':[{'model':db[_0xc616('0x91')],'as':_0xc616('0xaa'),'where':_0x9c10f2,'limit':0x1,'order':[[_0xc616('0x96'),'DESC']]}]});})[_0xc616('0x1d')](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x3033b3){if(_0x3033b3){_0x138b54[_0xc616('0xab')]=_[_0xc616('0x71')](_0x3033b3,[_0xc616('0xaa')]);if(_0x3033b3[_0xc616('0xaa')][_0xc616('0x56')]){return _0x3033b3[_0xc616('0xaa')][0x0];}var _0x3b4f6c=_['defaults'](_0x138b54['body'],{'firstName':_0x138b54['body'][_0xc616('0x9b')],'ListId':_0x3033b3['id']});_0x3b4f6c[_0x138b54[_0xc616('0x60')][_0xc616('0xa5')]]=_0x138b54[_0xc616('0x60')][_0xc616('0x9b')];return db[_0xc616('0x91')][_0xc616('0x58')](_0x3b4f6c,{'fields':_0x37e881,'raw':!![]});}})['then'](handleEntityNotFound(_0x4af228,null))[_0xc616('0x1d')](function(_0x295a11){if(_0x295a11){_0x138b54['contact']=_0x295a11;var _0x545899={'ContactId':_0x295a11['id'],'phone':_0x138b54['body'][_0xc616('0x9b')],'WhatsappAccountId':_0x564a95[_0xc616('0x53')]['id']};var _0x1ec575={'ContactId':_0x295a11['id'],'WhatsappAccountId':_0x564a95['params']['id'],'closed':![]};return db[_0xc616('0xac')]['find']({'where':_0x1ec575})['then'](function(_0x57d1d2){if(_0x57d1d2){return[_0x57d1d2,![]];}return db[_0xc616('0xac')][_0xc616('0x58')](_0x545899)[_0xc616('0x1d')](function(_0x1d401d){return[_0x1d401d,!![]];});});}})[_0xc616('0x72')](function(_0x196d11,_0x25a6ca){_0x138b54['interaction']=_0x196d11[_0xc616('0x59')]({'plain':!![]});_0x138b54[_0xc616('0xad')][_0xc616('0xae')]=![];if(_0x25a6ca){if(_0x138b54[_0xc616('0x87')][_0xc616('0xaf')]){_0x138b54[_0xc616('0x8e')][_0xc616('0xb0')]({'id':0x0,'priority':_0x138b54[_0xc616('0x8e')][_0xc616('0x56')]+0x1,'app':_0xc616('0xb1'),'appdata':_0xc616('0xb2'),'interval':_0xc616('0xb3')});}_0x138b54[_0xc616('0xad')][_0xc616('0xae')]=!![];}return db[_0xc616('0x8b')]['create']({'phone':_0x138b54['body'][_0xc616('0x9b')],'messageId':_0x138b54['body'][_0xc616('0x9f')],'body':_0x138b54[_0xc616('0x60')][_0xc616('0x60')],'WhatsappAccountId':_0x564a95[_0xc616('0x53')]['id'],'WhatsappInteractionId':_0x196d11['id'],'direction':'in','ContactId':_0x196d11[_0xc616('0xb4')],'AttachmentId':_0x138b54[_0xc616('0x60')][_0xc616('0xb5')]});})[_0xc616('0x1d')](function(_0x561f4b){_0x138b54[_0xc616('0x24')]=_0x561f4b;if(_0x138b54['interaction'][_0xc616('0xb6')]){return db[_0xc616('0xb7')][_0xc616('0x57')]({'attributes':['id',_0xc616('0x39')],'where':{'id':_0x138b54[_0xc616('0xad')]['UserId']}})[_0xc616('0x1d')](function(_0x25cbd3){if(_0x25cbd3){_0x138b54[_0xc616('0x8e')][_0xc616('0xb8')]({'id':0x0,'priority':0x0,'app':_0xc616('0xb9'),'appdata':_0x25cbd3[_0xc616('0x39')]+','+(_0x138b54['account'][_0xc616('0xba')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc616('0xbb'),_0xc616('0xbc'),_0x138b54);});}return respondWithRpcPromise(_0xc616('0xbb'),_0xc616('0xbc'),_0x138b54);})[_0xc616('0x1d')](function(_0x457017){if(_0x457017){var _0x540381=0xc8;var _0x9fa353='receiveMessage';logger[_0xc616('0x1e')](_0xc616('0x20'),_0x9fa353,_0x540381,_0xc616('0xbd'));logger['debug'](_0xc616('0xbe'),_0x9fa353,_0x540381,'entity\x20found',JSON[_0xc616('0x21')](_0x457017));if(_0x138b54[_0xc616('0x87')][_0xc616('0x9a')]===_0xc616('0xbf')){return _0x4af228[_0xc616('0x28')](_0x540381)['set'](_0xc616('0xc0'),'text/xml')[_0xc616('0x3a')](_0xc616('0xc1'));}else{return _0x4af228[_0xc616('0x28')](_0x540381)[_0xc616('0x2a')](_0x457017);}}});})['catch'](handleError(_0x4af228,null));};exports['send']=function(_0x13ae84,_0x4ffffa,_0x2355de){var _0x161db2,_0x43e2ec,_0x13968d;if(_[_0xc616('0xa2')](_0x13ae84[_0xc616('0x60')]['body'])||_0x13ae84[_0xc616('0x60')][_0xc616('0x60')]===''){throw new db[(_0xc616('0x92'))][(_0xc616('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc616('0xa2')](_0x13ae84[_0xc616('0x60')]['to'])){throw new db['Sequelize'][(_0xc616('0x93'))]('to\x20is\x20mandatory');}_0x161db2=_0x13ae84[_0xc616('0x60')]['to'];return db[_0xc616('0x3d')][_0xc616('0x57')]({'where':{'id':_0x13ae84[_0xc616('0x53')]['id']},'include':[{'model':db[_0xc616('0xa9')],'as':'List','include':[{'model':db[_0xc616('0x91')],'as':_0xc616('0xaa'),'where':{'mobile':_0x161db2},'limit':0x1,'order':[[_0xc616('0x96'),_0xc616('0xc2')]]}]}]})[_0xc616('0x1d')](handleEntityNotFound(_0x4ffffa,null))[_0xc616('0x1d')](function(_0xff9f28){if(_0xff9f28&&_0xff9f28[_0xc616('0xc3')]){_0x43e2ec=_0xff9f28['get']({'plain':!![]});if(_0x43e2ec[_0xc616('0xc3')]&&_0x43e2ec['List'][_0xc616('0xaa')][_0xc616('0x56')]){return _0x43e2ec[_0xc616('0xc3')][_0xc616('0xaa')][0x0];}return db[_0xc616('0x91')]['create'](_[_0xc616('0x17')](_0x13ae84[_0xc616('0x60')],{'firstName':_0x161db2,'mobile':_0x161db2,'phone':_0x161db2,'ListId':_0x43e2ec[_0xc616('0x98')]}));}})[_0xc616('0x1d')](handleEntityNotFound(_0x4ffffa,null))[_0xc616('0x1d')](function(_0x47f0fc){if(_0x47f0fc){_0x13968d=_0x47f0fc;return db['WhatsappInteraction'][_0xc616('0x57')]({'where':{'ContactId':_0x13968d['id'],'closed':![],'WhatsappAccountId':_0x43e2ec['id']}})['then'](function(_0xd30c03){if(_0xd30c03){return[_0xd30c03,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id'],'WhatsappAccountId':_0x43e2ec['id'],'phone':_0x161db2,'firstMsgDirection':_0xc616('0xc4'),'Messages':[_[_0xc616('0x49')](_0x13ae84['body'],{'read':![],'body':_0x13ae84[_0xc616('0x60')][_0xc616('0x60')],'phone':_0x161db2,'WhatsappAccountId':_0x43e2ec['id'],'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x411bfc){return[_0x411bfc,!![]];});});}})[_0xc616('0x72')](function(_0x998f71,_0x234147){if(_0x234147){return _0x998f71;}return db[_0xc616('0x8b')][_0xc616('0x58')](_[_0xc616('0x49')](_0x13ae84[_0xc616('0x60')],{'read':![],'body':_0x13ae84[_0xc616('0x60')][_0xc616('0x60')],'phone':_0x161db2,'WhatsappAccountId':_0x43e2ec['id'],'WhatsappInteractionId':_0x998f71['id'],'UserId':_0x13ae84[_0xc616('0x5b')]['id'],'ContactId':_0x13968d['id']}))['then'](function(_0x49aa10){_0x998f71[_0xc616('0xc5')][_0xc616('0xc6')]=[];_0x998f71[_0xc616('0xc5')][_0xc616('0xc6')][_0xc616('0xb0')](_0x49aa10['dataValues']);return _0x998f71;});})[_0xc616('0x1d')](respondWithResult(_0x4ffffa,null))[_0xc616('0x26')](handleError(_0x4ffffa,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f0d8a60..2f9a778 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 _0x6b62=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','save'];(function(_0x5ea8fb,_0xc46f1c){var _0xc97803=function(_0x394c3e){while(--_0x394c3e){_0x5ea8fb['push'](_0x5ea8fb['shift']());}};_0xc97803(++_0xc46f1c);}(_0x6b62,0xf0));var _0x26b6=function(_0x452814,_0x2c4a23){_0x452814=_0x452814-0x0;var _0x335f41=_0x6b62[_0x452814];return _0x335f41;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x26b6('0x0'))['db'][_0x26b6('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x26b6('0x2'),'afterUpdate':_0x26b6('0x3'),'afterDestroy':_0x26b6('0x4')};function emitEvent(_0x1c8838){return function(_0x21db5a,_0x115c64,_0x3bdac8){WhatsappAccountEvents[_0x26b6('0x5')](_0x1c8838+':'+_0x21db5a['id'],_0x21db5a);WhatsappAccountEvents[_0x26b6('0x5')](_0x1c8838,_0x21db5a);_0x3bdac8(null);};}for(var e in events){if(events[_0x26b6('0x6')](e)){var event=events[e];WhatsappAccount[_0x26b6('0x7')](e,emitEvent(event));}}module[_0x26b6('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6f1f=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6f1f,0x1bc));var _0xf6f1=function(_0x21be2b,_0x3db162){_0x21be2b=_0x21be2b-0x0;var _0x10932e=_0x6f1f[_0x21be2b];return _0x10932e;};'use strict';var EventEmitter=require(_0xf6f1('0x0'));var WhatsappAccount=require(_0xf6f1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6f1('0x2'),'afterUpdate':_0xf6f1('0x3'),'afterDestroy':_0xf6f1('0x4')};function emitEvent(_0x77df6e){return function(_0x3842af,_0x4c7485,_0x2175ce){WhatsappAccountEvents['emit'](_0x77df6e+':'+_0x3842af['id'],_0x3842af);WhatsappAccountEvents[_0xf6f1('0x5')](_0x77df6e,_0x3842af);_0x2175ce(null);};}for(var e in events){if(events[_0xf6f1('0x6')](e)){var event=events[e];WhatsappAccount[_0xf6f1('0x7')](e,emitEvent(event));}}module[_0xf6f1('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index b1bb7a3..2d83826 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 _0xb83a=['path','rimraf','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','api','moment','bluebird','request-promise'];(function(_0x14cae8,_0x42afd1){var _0x3b67bd=function(_0x11d2fa){while(--_0x11d2fa){_0x14cae8['push'](_0x14cae8['shift']());}};_0x3b67bd(++_0x42afd1);}(_0xb83a,0x7f));var _0xab83=function(_0x5f5a07,_0x2b0d45){_0x5f5a07=_0x5f5a07-0x0;var _0x4fc725=_0xb83a[_0x5f5a07];return _0x4fc725;};'use strict';var _=require('lodash');var util=require(_0xab83('0x0'));var logger=require('../../config/logger')(_0xab83('0x1'));var moment=require(_0xab83('0x2'));var BPromise=require(_0xab83('0x3'));var rp=require(_0xab83('0x4'));var fs=require('fs');var path=require(_0xab83('0x5'));var rimraf=require(_0xab83('0x6'));var config=require(_0xab83('0x7'));var attributes=require(_0xab83('0x8'));module['exports']=function(_0x5b579e,_0x53b871){return _0x5b579e['define'](_0xab83('0x9'),attributes,{'tableName':_0xab83('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cef=['../../config/environment','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x53cc80,_0x51492a){var _0x13e14d=function(_0x3d8335){while(--_0x3d8335){_0x53cc80['push'](_0x53cc80['shift']());}};_0x13e14d(++_0x51492a);}(_0x8cef,0x142));var _0xf8ce=function(_0x27b267,_0x3eba43){_0x27b267=_0x27b267-0x0;var _0x140266=_0x8cef[_0x27b267];return _0x140266;};'use strict';var _=require(_0xf8ce('0x0'));var util=require(_0xf8ce('0x1'));var logger=require(_0xf8ce('0x2'))(_0xf8ce('0x3'));var moment=require(_0xf8ce('0x4'));var BPromise=require(_0xf8ce('0x5'));var rp=require(_0xf8ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8ce('0x7'));var config=require(_0xf8ce('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x5e7d4d,_0x29ac73){return _0x5e7d4d[_0xf8ce('0x9')]('WhatsappAccount',attributes,{'tableName':_0xf8ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index e883b81..9a30a7d 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 _0x8510=['request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x8510,0x1d9));var _0x0851=function(_0x3a32e0,_0x69a2f1){_0x3a32e0=_0x3a32e0-0x0;var _0x43ae59=_0x8510[_0x3a32e0];return _0x43ae59;};'use strict';var _=require(_0x0851('0x0'));var util=require(_0x0851('0x1'));var moment=require(_0x0851('0x2'));var BPromise=require(_0x0851('0x3'));var rs=require(_0x0851('0x4'));var fs=require('fs');var Redis=require(_0x0851('0x5'));var db=require(_0x0851('0x6'))['db'];var utils=require(_0x0851('0x7'));var logger=require(_0x0851('0x8'))(_0x0851('0x9'));var config=require(_0x0851('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0851('0xb')][_0x0851('0xc')]({'port':0x232a});config[_0x0851('0xd')]=_['defaults'](config['redis'],{'host':_0x0851('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0851('0xd')]));require(_0x0851('0xf'))[_0x0851('0x10')](socket);function respondWithRpcPromise(_0x380120,_0x28678b,_0x416717){return new BPromise(function(_0x46476d,_0x169301){return client[_0x0851('0x11')](_0x380120,_0x416717)['then'](function(_0x3841d8){logger[_0x0851('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x28678b,'request\x20sent');logger[_0x0851('0x13')](_0x0851('0x14'),_0x28678b,_0x0851('0x15'),JSON[_0x0851('0x16')](_0x3841d8));if(_0x3841d8['error']){if(_0x3841d8[_0x0851('0x17')][_0x0851('0x18')]===0x1f4){logger[_0x0851('0x17')](_0x0851('0x19'),_0x28678b,_0x3841d8[_0x0851('0x17')][_0x0851('0x1a')]);return _0x169301(_0x3841d8['error'][_0x0851('0x1a')]);}logger[_0x0851('0x17')](_0x0851('0x19'),_0x28678b,_0x3841d8[_0x0851('0x17')]['message']);return _0x46476d(_0x3841d8[_0x0851('0x17')][_0x0851('0x1a')]);}else{logger['info'](_0x0851('0x19'),_0x28678b,'request\x20sent');_0x46476d(_0x3841d8['result'][_0x0851('0x1a')]);}})['catch'](function(_0x3031c3){logger['error'](_0x0851('0x19'),_0x28678b,_0x3031c3);_0x169301(_0x3031c3);});});}exports[_0x0851('0x1b')]=function(_0xc45026){var _0x3872a9=this;return new Promise(function(_0x1540d5,_0x31ca08){return db[_0x0851('0x1c')][_0x0851('0x1d')]({'raw':_0xc45026[_0x0851('0x1e')]?_0xc45026[_0x0851('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xc45026['options']?_0xc45026[_0x0851('0x1e')][_0x0851('0x1f')]||null:null,'attributes':_0xc45026['options']?_0xc45026[_0x0851('0x1e')]['attributes']||null:null,'include':_0xc45026['options']?_0xc45026['options'][_0x0851('0x20')]?_[_0x0851('0x21')](_0xc45026['options'][_0x0851('0x20')],function(_0x3929ca){return{'model':db[_0x3929ca[_0x0851('0x22')]],'as':_0x3929ca['as'],'attributes':_0x3929ca[_0x0851('0x23')],'include':_0x3929ca['include']?_[_0x0851('0x21')](_0x3929ca[_0x0851('0x20')],function(_0x2b9255){return{'model':db[_0x2b9255[_0x0851('0x22')]],'as':_0x2b9255['as'],'attributes':_0x2b9255[_0x0851('0x23')],'include':_0x2b9255[_0x0851('0x20')]?_[_0x0851('0x21')](_0x2b9255[_0x0851('0x20')],function(_0x7460e4){return{'model':db[_0x7460e4['model']],'as':_0x7460e4['as'],'attributes':_0x7460e4[_0x0851('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0851('0x24')](function(_0x46e85d){logger['info'](_0x0851('0x1b'),_0xc45026);logger[_0x0851('0x13')](_0x0851('0x1b'),_0xc45026,JSON['stringify'](_0x46e85d));_0x1540d5(_0x46e85d);})[_0x0851('0x25')](function(_0x5ad59b){logger[_0x0851('0x17')](_0x0851('0x1b'),_0x5ad59b[_0x0851('0x1a')],_0xc45026);_0x31ca08(_0x3872a9[_0x0851('0x17')](0x1f4,_0x5ad59b[_0x0851('0x1a')]));});});}; \ No newline at end of file +var _0x5e02=['attributes','include','map','model','then','debug','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','stringify','error','code','message','ShowWhatsappAccount','WhatsappAccount','find','options','where'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x5e02,0x1c7));var _0x25e0=function(_0x4d9205,_0x8e02b2){_0x4d9205=_0x4d9205-0x0;var _0x2d6e01=_0x5e02[_0x4d9205];return _0x2d6e01;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25e0('0x1'));var fs=require('fs');var Redis=require(_0x25e0('0x2'));var db=require(_0x25e0('0x3'))['db'];var utils=require(_0x25e0('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25e0('0x5'));var jayson=require(_0x25e0('0x6'));var client=jayson['client'][_0x25e0('0x7')]({'port':0x232a});config[_0x25e0('0x8')]=_[_0x25e0('0x9')](config[_0x25e0('0x8')],{'host':_0x25e0('0xa'),'port':0x18eb});var socket=require(_0x25e0('0xb'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x25e0('0xc')](socket);function respondWithRpcPromise(_0x1ddcf0,_0x26c62f,_0x42e6e3){return new BPromise(function(_0x3039e6,_0x10dc96){return client[_0x25e0('0xd')](_0x1ddcf0,_0x42e6e3)['then'](function(_0xa4beeb){logger[_0x25e0('0xe')](_0x25e0('0xf'),_0x26c62f,'request\x20sent');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26c62f,'request\x20sent',JSON[_0x25e0('0x10')](_0xa4beeb));if(_0xa4beeb[_0x25e0('0x11')]){if(_0xa4beeb['error'][_0x25e0('0x12')]===0x1f4){logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb['error'][_0x25e0('0x13')]);return _0x10dc96(_0xa4beeb['error'][_0x25e0('0x13')]);}logger['error'](_0x25e0('0xf'),_0x26c62f,_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);return _0x3039e6(_0xa4beeb[_0x25e0('0x11')][_0x25e0('0x13')]);}else{logger['info'](_0x25e0('0xf'),_0x26c62f,'request\x20sent');_0x3039e6(_0xa4beeb['result'][_0x25e0('0x13')]);}})['catch'](function(_0x39c631){logger[_0x25e0('0x11')](_0x25e0('0xf'),_0x26c62f,_0x39c631);_0x10dc96(_0x39c631);});});}exports[_0x25e0('0x14')]=function(_0xff9e95){var _0x5b7add=this;return new Promise(function(_0x3cd388,_0x600dff){return db[_0x25e0('0x15')][_0x25e0('0x16')]({'raw':_0xff9e95[_0x25e0('0x17')]?_0xff9e95['options']['raw']===undefined?!![]:![]:!![],'where':_0xff9e95['options']?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x18')]||null:null,'attributes':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x19')]||null:null,'include':_0xff9e95[_0x25e0('0x17')]?_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')]?_[_0x25e0('0x1b')](_0xff9e95[_0x25e0('0x17')][_0x25e0('0x1a')],function(_0x48fdfd){return{'model':db[_0x48fdfd[_0x25e0('0x1c')]],'as':_0x48fdfd['as'],'attributes':_0x48fdfd[_0x25e0('0x19')],'include':_0x48fdfd[_0x25e0('0x1a')]?_['map'](_0x48fdfd[_0x25e0('0x1a')],function(_0x129b6e){return{'model':db[_0x129b6e[_0x25e0('0x1c')]],'as':_0x129b6e['as'],'attributes':_0x129b6e['attributes'],'include':_0x129b6e['include']?_[_0x25e0('0x1b')](_0x129b6e[_0x25e0('0x1a')],function(_0x2a0392){return{'model':db[_0x2a0392['model']],'as':_0x2a0392['as'],'attributes':_0x2a0392[_0x25e0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x25e0('0x1d')](function(_0x265813){logger[_0x25e0('0xe')](_0x25e0('0x14'),_0xff9e95);logger[_0x25e0('0x1e')]('ShowWhatsappAccount',_0xff9e95,JSON[_0x25e0('0x10')](_0x265813));_0x3cd388(_0x265813);})[_0x25e0('0x1f')](function(_0x4201cd){logger['error'](_0x25e0('0x14'),_0x4201cd['message'],_0xff9e95);_0x600dff(_0x5b7add[_0x25e0('0x11')](0x1f4,_0x4201cd[_0x25e0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 26322f8..43bad1e 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 _0x808b=['emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x27ac10,_0x3a5af9){var _0x279f96=function(_0xac262){while(--_0xac262){_0x27ac10['push'](_0x27ac10['shift']());}};_0x279f96(++_0x3a5af9);}(_0x808b,0xa6));var _0xb808=function(_0x5b68fb,_0x33c51a){_0x5b68fb=_0x5b68fb-0x0;var _0x339476=_0x808b[_0x5b68fb];return _0x339476;};'use strict';var WhatsappAccountEvents=require(_0xb808('0x0'));var events=[_0xb808('0x1'),'remove','update'];function createListener(_0x5a9ab7,_0xd96bcb){return function(_0x1b9c78){_0xd96bcb[_0xb808('0x2')](_0x5a9ab7,_0x1b9c78);};}function removeListener(_0x680e91,_0xc35ecc){return function(){WhatsappAccountEvents[_0xb808('0x3')](_0x680e91,_0xc35ecc);};}exports[_0xb808('0x4')]=function(_0x4f3df6){for(var _0x4473ed=0x0,_0x1ad3ca=events['length'];_0x4473ed<_0x1ad3ca;_0x4473ed++){var _0xf352e8=events[_0x4473ed];var _0x194e68=createListener(_0xb808('0x5')+_0xf352e8,_0x4f3df6);WhatsappAccountEvents['on'](_0xf352e8,_0x194e68);}}; \ No newline at end of file +var _0x90a0=['./whatsappAccount.events','save','remove','update','emit','removeListener','length','whatsappAccount:'];(function(_0x259a2e,_0x36d780){var _0x24fcb0=function(_0x4b84fd){while(--_0x4b84fd){_0x259a2e['push'](_0x259a2e['shift']());}};_0x24fcb0(++_0x36d780);}(_0x90a0,0xd0));var _0x090a=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x90a0[_0x54d4fe];return _0x1ab5bb;};'use strict';var WhatsappAccountEvents=require(_0x090a('0x0'));var events=[_0x090a('0x1'),_0x090a('0x2'),_0x090a('0x3')];function createListener(_0x46ca10,_0x16a01f){return function(_0x599038){_0x16a01f[_0x090a('0x4')](_0x46ca10,_0x599038);};}function removeListener(_0x4b3d9b,_0x5001f8){return function(){WhatsappAccountEvents[_0x090a('0x5')](_0x4b3d9b,_0x5001f8);};}exports['register']=function(_0x1eac2f){for(var _0x1a2e02=0x0,_0x4f385f=events[_0x090a('0x6')];_0x1a2e02<_0x4f385f;_0x1a2e02++){var _0x571815=events[_0x1a2e02];var _0x3546d3=createListener(_0x090a('0x7')+_0x571815,_0x1eac2f);WhatsappAccountEvents['on'](_0x571815,_0x3546d3);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7f15ade..d738bc8 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 _0xf588=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf588,0x19f));var _0x8f58=function(_0x595fab,_0x796c33){_0x595fab=_0x595fab-0x0;var _0x5961c1=_0xf588[_0x595fab];return _0x5961c1;};'use strict';var multer=require(_0x8f58('0x0'));var util=require('util');var path=require(_0x8f58('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f58('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f58('0x3'));var interaction=require(_0x8f58('0x4'));var config=require(_0x8f58('0x5'));var controller=require(_0x8f58('0x6'));router['get']('/',auth[_0x8f58('0x7')](),controller[_0x8f58('0x8')]);router['get'](_0x8f58('0x9'),auth[_0x8f58('0x7')](),controller[_0x8f58('0xa')]);router[_0x8f58('0xb')]('/',auth['isAuthenticated'](),controller[_0x8f58('0xc')]);router['put'](_0x8f58('0x9'),auth[_0x8f58('0x7')](),controller[_0x8f58('0xd')]);router[_0x8f58('0xe')](_0x8f58('0x9'),auth[_0x8f58('0x7')](),controller[_0x8f58('0xf')]);module['exports']=router; \ No newline at end of file +var _0x00d0=['post','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','show'];(function(_0xeb4f99,_0x263cea){var _0x5723fc=function(_0x4f4e85){while(--_0x4f4e85){_0xeb4f99['push'](_0xeb4f99['shift']());}};_0x5723fc(++_0x263cea);}(_0x00d0,0x15b));var _0x000d=function(_0x214132,_0x203c94){_0x214132=_0x214132-0x0;var _0x272e5d=_0x00d0[_0x214132];return _0x272e5d;};'use strict';var multer=require('multer');var util=require(_0x000d('0x0'));var path=require(_0x000d('0x1'));var timeout=require(_0x000d('0x2'));var express=require(_0x000d('0x3'));var router=express[_0x000d('0x4')]();var fs_extra=require(_0x000d('0x5'));var auth=require(_0x000d('0x6'));var interaction=require(_0x000d('0x7'));var config=require(_0x000d('0x8'));var controller=require(_0x000d('0x9'));router[_0x000d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x000d('0xa')](_0x000d('0xb'),auth['isAuthenticated'](),controller[_0x000d('0xc')]);router[_0x000d('0xd')]('/',auth[_0x000d('0xe')](),controller[_0x000d('0xf')]);router[_0x000d('0x10')](_0x000d('0xb'),auth['isAuthenticated'](),controller[_0x000d('0x11')]);router[_0x000d('0x12')](_0x000d('0xb'),auth[_0x000d('0xe')](),controller[_0x000d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a79db80..ca9a542 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 _0x8c8e=['STRING','TEXT','*,*,*,*','exports'];(function(_0x3978e9,_0x202fbf){var _0x4c6581=function(_0x5016d1){while(--_0x5016d1){_0x3978e9['push'](_0x3978e9['shift']());}};_0x4c6581(++_0x202fbf);}(_0x8c8e,0xe7));var _0xe8c8=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x8c8e[_0x810025];return _0x4dbc81;};'use strict';var Sequelize=require('sequelize');module[_0xe8c8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe8c8('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe8c8('0x2')]()},'description':{'type':Sequelize[_0xe8c8('0x1')]},'interval':{'type':Sequelize[_0xe8c8('0x1')],'defaultValue':_0xe8c8('0x3')}}; \ No newline at end of file +var _0x4aa8=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x4a51b3,_0xa4ab0a){var _0x115620=function(_0x5dcda7){while(--_0x5dcda7){_0x4a51b3['push'](_0x4a51b3['shift']());}};_0x115620(++_0xa4ab0a);}(_0x4aa8,0x17b));var _0x84aa=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4aa8[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0x84aa('0x0'));module['exports']={'priority':{'type':Sequelize[_0x84aa('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x84aa('0x2')},'appdata':{'type':Sequelize[_0x84aa('0x3')]()},'description':{'type':Sequelize[_0x84aa('0x4')]},'interval':{'type':Sequelize[_0x84aa('0x4')],'defaultValue':_0x84aa('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index fcb29cd..f1b1b49 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 _0x11c1=['include','findAll','catch','show','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options'];(function(_0x4a86b5,_0x490af3){var _0x471e33=function(_0x20908a){while(--_0x20908a){_0x4a86b5['push'](_0x4a86b5['shift']());}};_0x471e33(++_0x490af3);}(_0x11c1,0x1cb));var _0x111c=function(_0x4091ce,_0xd09e05){_0x4091ce=_0x4091ce-0x0;var _0x584e41=_0x11c1[_0x4091ce];return _0x584e41;};'use strict';var emlformat=require(_0x111c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x111c('0x1'));var jsonpatch=require(_0x111c('0x2'));var rp=require(_0x111c('0x3'));var moment=require(_0x111c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x111c('0x5'));var util=require(_0x111c('0x6'));var path=require(_0x111c('0x7'));var sox=require(_0x111c('0x8'));var csv=require(_0x111c('0x9'));var ejs=require(_0x111c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x111c('0xb'));var squel=require(_0x111c('0xc'));var crypto=require(_0x111c('0xd'));var jsforce=require(_0x111c('0xe'));var deskjs=require(_0x111c('0xf'));var toCsv=require(_0x111c('0x9'));var querystring=require(_0x111c('0x10'));var Papa=require(_0x111c('0x11'));var Redis=require(_0x111c('0x12'));var authService=require(_0x111c('0x13'));var qs=require(_0x111c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x111c('0x15'));var config=require(_0x111c('0x16'));var licenseUtil=require(_0x111c('0x17'));var db=require(_0x111c('0x18'))['db'];function respondWithStatusCode(_0x161df9,_0x18f728){_0x18f728=_0x18f728||0xcc;return function(_0x37deee){if(_0x37deee){return _0x161df9[_0x111c('0x19')](_0x18f728);}return _0x161df9[_0x111c('0x1a')](_0x18f728)[_0x111c('0x1b')]();};}function respondWithResult(_0x1b0dd5,_0x37a4bd){_0x37a4bd=_0x37a4bd||0xc8;return function(_0x3ad856){if(_0x3ad856){return _0x1b0dd5[_0x111c('0x1a')](_0x37a4bd)[_0x111c('0x1c')](_0x3ad856);}};}function respondWithFilteredResult(_0x412f7e,_0x2d2adb){return function(_0x9e7a7c){if(_0x9e7a7c){var _0x3babf6=typeof _0x2d2adb['offset']==='undefined'&&typeof _0x2d2adb['limit']===_0x111c('0x1d');var _0x4bd3d8=_0x9e7a7c['count'];var _0x198249=_0x3babf6?0x0:_0x2d2adb[_0x111c('0x1e')];var _0x2d54e6=_0x3babf6?_0x9e7a7c[_0x111c('0x1f')]:_0x2d2adb[_0x111c('0x1e')]+_0x2d2adb[_0x111c('0x20')];var _0x5b9171;if(_0x2d54e6>=_0x4bd3d8){_0x2d54e6=_0x4bd3d8;_0x5b9171=0xc8;}else{_0x5b9171=0xce;}_0x412f7e[_0x111c('0x1a')](_0x5b9171);return _0x412f7e[_0x111c('0x21')]('Content-Range',_0x198249+'-'+_0x2d54e6+'/'+_0x4bd3d8)[_0x111c('0x1c')](_0x9e7a7c);}return null;};}function patchUpdates(_0x211de8){return function(_0x1df840){try{jsonpatch['apply'](_0x1df840,_0x211de8,!![]);}catch(_0x39ebe3){return BPromise[_0x111c('0x22')](_0x39ebe3);}return _0x1df840[_0x111c('0x23')]();};}function saveUpdates(_0x54a586,_0x31b236){return function(_0x17d02b){if(_0x17d02b){return _0x17d02b[_0x111c('0x24')](_0x54a586)[_0x111c('0x25')](function(_0x2c4c6b){return _0x2c4c6b;});}return null;};}function removeEntity(_0x3da021,_0xe5b252){return function(_0x3694b5){if(_0x3694b5){return _0x3694b5[_0x111c('0x26')]()['then'](function(){_0x3da021[_0x111c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b3b8,_0x2576b8){return function(_0x5764b9){if(!_0x5764b9){_0x26b3b8[_0x111c('0x19')](0x194);}return _0x5764b9;};}function handleError(_0x17a9cd,_0x55e7d0){_0x55e7d0=_0x55e7d0||0x1f4;return function(_0x33040d){logger[_0x111c('0x27')](_0x33040d[_0x111c('0x28')]);if(_0x33040d[_0x111c('0x29')]){delete _0x33040d[_0x111c('0x29')];}_0x17a9cd[_0x111c('0x1a')](_0x55e7d0)[_0x111c('0x2a')](_0x33040d);};}exports[_0x111c('0x2b')]=function(_0x46e407,_0x70592b){var _0x5e3047={},_0x40d992={},_0x45bd8c={'count':0x0,'rows':[]};var _0x4c9c67=_[_0x111c('0x2c')](db[_0x111c('0x2d')]['rawAttributes'],function(_0x401138){return{'name':_0x401138[_0x111c('0x2e')],'type':_0x401138['type'][_0x111c('0x2f')]};});_0x40d992['model']=_['map'](_0x4c9c67,_0x111c('0x29'));_0x40d992[_0x111c('0x30')]=_[_0x111c('0x31')](_0x46e407[_0x111c('0x30')]);_0x40d992[_0x111c('0x32')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],_0x40d992[_0x111c('0x30')]);_0x5e3047[_0x111c('0x35')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],qs[_0x111c('0x36')](_0x46e407[_0x111c('0x30')]['fields']));_0x5e3047[_0x111c('0x35')]=_0x5e3047[_0x111c('0x35')][_0x111c('0x37')]?_0x5e3047['attributes']:_0x40d992[_0x111c('0x34')];if(!_0x46e407[_0x111c('0x30')][_0x111c('0x38')](_0x111c('0x39'))){_0x5e3047[_0x111c('0x20')]=qs[_0x111c('0x20')](_0x46e407[_0x111c('0x30')]['limit']);_0x5e3047[_0x111c('0x1e')]=qs['offset'](_0x46e407[_0x111c('0x30')][_0x111c('0x1e')]);}_0x5e3047[_0x111c('0x3a')]=qs[_0x111c('0x3b')](_0x46e407['query'][_0x111c('0x3b')]);_0x5e3047['where']=qs[_0x111c('0x32')](_['pick'](_0x46e407[_0x111c('0x30')],_0x40d992[_0x111c('0x32')]),_0x4c9c67);if(_0x46e407[_0x111c('0x30')][_0x111c('0x3c')]){_0x5e3047[_0x111c('0x3d')]=_[_0x111c('0x3e')](_0x5e3047[_0x111c('0x3d')],{'$or':_[_0x111c('0x2c')](_0x4c9c67,function(_0x56fb83){if(_0x56fb83[_0x111c('0x3f')]!==_0x111c('0x40')){var _0x591fe1={};_0x591fe1[_0x56fb83['name']]={'$like':'%'+_0x46e407[_0x111c('0x30')]['filter']+'%'};return _0x591fe1;}})});}_0x5e3047=_['merge']({},_0x5e3047,_0x46e407[_0x111c('0x41')]);var _0x5ffb09={'where':_0x5e3047[_0x111c('0x3d')]};return db[_0x111c('0x2d')][_0x111c('0x1f')](_0x5ffb09)[_0x111c('0x25')](function(_0x167b00){_0x45bd8c[_0x111c('0x1f')]=_0x167b00;if(_0x46e407[_0x111c('0x30')]['includeAll']){_0x5e3047[_0x111c('0x42')]=[{'all':!![]}];}return db[_0x111c('0x2d')][_0x111c('0x43')](_0x5e3047);})['then'](function(_0x354dca){_0x45bd8c['rows']=_0x354dca;return _0x45bd8c;})['then'](respondWithFilteredResult(_0x70592b,_0x5e3047))[_0x111c('0x44')](handleError(_0x70592b,null));};exports[_0x111c('0x45')]=function(_0x10f4f7,_0x22e95b){var _0x38d7a0={'raw':!![],'where':{'id':_0x10f4f7[_0x111c('0x46')]['id']}},_0x1b4e4f={};_0x1b4e4f[_0x111c('0x34')]=_['keys'](db[_0x111c('0x2d')]['rawAttributes']);_0x1b4e4f[_0x111c('0x30')]=_[_0x111c('0x31')](_0x10f4f7[_0x111c('0x30')]);_0x1b4e4f[_0x111c('0x32')]=_[_0x111c('0x33')](_0x1b4e4f['model'],_0x1b4e4f['query']);_0x38d7a0[_0x111c('0x35')]=_[_0x111c('0x33')](_0x1b4e4f[_0x111c('0x34')],qs['fields'](_0x10f4f7['query']['fields']));_0x38d7a0['attributes']=_0x38d7a0[_0x111c('0x35')]['length']?_0x38d7a0['attributes']:_0x1b4e4f['model'];if(_0x10f4f7[_0x111c('0x30')][_0x111c('0x47')]){_0x38d7a0['include']=[{'all':!![]}];}_0x38d7a0=_['merge']({},_0x38d7a0,_0x10f4f7['options']);return db[_0x111c('0x2d')]['find'](_0x38d7a0)[_0x111c('0x25')](handleEntityNotFound(_0x22e95b,null))[_0x111c('0x25')](respondWithResult(_0x22e95b,null))[_0x111c('0x44')](handleError(_0x22e95b,null));};exports[_0x111c('0x48')]=function(_0x2849b6,_0x137ee5){return db['WhatsappApplication'][_0x111c('0x48')](_0x2849b6[_0x111c('0x49')],{})['then'](respondWithResult(_0x137ee5,0xc9))[_0x111c('0x44')](handleError(_0x137ee5,null));};exports[_0x111c('0x24')]=function(_0x8cad9c,_0x24731d){if(_0x8cad9c[_0x111c('0x49')]['id']){delete _0x8cad9c[_0x111c('0x49')]['id'];}return db[_0x111c('0x2d')][_0x111c('0x4a')]({'where':{'id':_0x8cad9c[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x24731d,null))['then'](saveUpdates(_0x8cad9c['body'],null))[_0x111c('0x25')](respondWithResult(_0x24731d,null))[_0x111c('0x44')](handleError(_0x24731d,null));};exports[_0x111c('0x26')]=function(_0x4288ab,_0x584c6f){return db['WhatsappApplication'][_0x111c('0x4a')]({'where':{'id':_0x4288ab[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x584c6f,null))[_0x111c('0x25')](removeEntity(_0x584c6f,null))['catch'](handleError(_0x584c6f,null));}; \ No newline at end of file +var _0x49fe=['set','json','apply','reject','save','update','then','destroy','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x49fe,0x75));var _0xe49f=function(_0x383523,_0x5d95d3){_0x383523=_0x383523-0x0;var _0x5b307e=_0x49fe[_0x383523];return _0x5b307e;};'use strict';var emlformat=require(_0xe49f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe49f('0x1'));var moment=require(_0xe49f('0x2'));var BPromise=require(_0xe49f('0x3'));var Mustache=require(_0xe49f('0x4'));var util=require(_0xe49f('0x5'));var path=require(_0xe49f('0x6'));var sox=require(_0xe49f('0x7'));var csv=require(_0xe49f('0x8'));var ejs=require(_0xe49f('0x9'));var fs=require('fs');var fs_extra=require(_0xe49f('0xa'));var _=require(_0xe49f('0xb'));var squel=require(_0xe49f('0xc'));var crypto=require(_0xe49f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe49f('0xe'));var toCsv=require(_0xe49f('0x8'));var querystring=require('querystring');var Papa=require(_0xe49f('0xf'));var Redis=require('ioredis');var authService=require(_0xe49f('0x10'));var qs=require(_0xe49f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe49f('0x12'));var logger=require(_0xe49f('0x13'))(_0xe49f('0x14'));var utils=require(_0xe49f('0x15'));var config=require(_0xe49f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe49f('0x17'))['db'];function respondWithStatusCode(_0x3958bd,_0x504081){_0x504081=_0x504081||0xcc;return function(_0x10517d){if(_0x10517d){return _0x3958bd[_0xe49f('0x18')](_0x504081);}return _0x3958bd[_0xe49f('0x19')](_0x504081)[_0xe49f('0x1a')]();};}function respondWithResult(_0x44c7fe,_0x5708d9){_0x5708d9=_0x5708d9||0xc8;return function(_0x3645e8){if(_0x3645e8){return _0x44c7fe[_0xe49f('0x19')](_0x5708d9)['json'](_0x3645e8);}};}function respondWithFilteredResult(_0x4f3550,_0xfe24b7){return function(_0x3e5fb3){if(_0x3e5fb3){var _0x1e8eb8=typeof _0xfe24b7[_0xe49f('0x1b')]===_0xe49f('0x1c')&&typeof _0xfe24b7[_0xe49f('0x1d')]==='undefined';var _0x7831f1=_0x3e5fb3['count'];var _0x6ab378=_0x1e8eb8?0x0:_0xfe24b7['offset'];var _0x58f852=_0x1e8eb8?_0x3e5fb3[_0xe49f('0x1e')]:_0xfe24b7[_0xe49f('0x1b')]+_0xfe24b7['limit'];var _0x7a5643;if(_0x58f852>=_0x7831f1){_0x58f852=_0x7831f1;_0x7a5643=0xc8;}else{_0x7a5643=0xce;}_0x4f3550['status'](_0x7a5643);return _0x4f3550[_0xe49f('0x1f')]('Content-Range',_0x6ab378+'-'+_0x58f852+'/'+_0x7831f1)[_0xe49f('0x20')](_0x3e5fb3);}return null;};}function patchUpdates(_0x47b09a){return function(_0x4c4dcf){try{jsonpatch[_0xe49f('0x21')](_0x4c4dcf,_0x47b09a,!![]);}catch(_0x5b50e0){return BPromise[_0xe49f('0x22')](_0x5b50e0);}return _0x4c4dcf[_0xe49f('0x23')]();};}function saveUpdates(_0x40129c,_0x1647d1){return function(_0x424927){if(_0x424927){return _0x424927[_0xe49f('0x24')](_0x40129c)[_0xe49f('0x25')](function(_0x3d4146){return _0x3d4146;});}return null;};}function removeEntity(_0x233646,_0x2a2926){return function(_0x2bc2b2){if(_0x2bc2b2){return _0x2bc2b2[_0xe49f('0x26')]()[_0xe49f('0x25')](function(){_0x233646['status'](0xcc)[_0xe49f('0x1a')]();});}};}function handleEntityNotFound(_0x298cba,_0xbe357){return function(_0x14d820){if(!_0x14d820){_0x298cba['sendStatus'](0x194);}return _0x14d820;};}function handleError(_0x4ca90a,_0x1ff78c){_0x1ff78c=_0x1ff78c||0x1f4;return function(_0x44b702){logger['error'](_0x44b702[_0xe49f('0x27')]);if(_0x44b702['name']){delete _0x44b702[_0xe49f('0x28')];}_0x4ca90a[_0xe49f('0x19')](_0x1ff78c)[_0xe49f('0x29')](_0x44b702);};}exports['index']=function(_0x557b4e,_0x1357f6){var _0x32406b={},_0x298248={},_0x268f6e={'count':0x0,'rows':[]};var _0x4be6fc=_[_0xe49f('0x2a')](db[_0xe49f('0x2b')][_0xe49f('0x2c')],function(_0x1b3280){return{'name':_0x1b3280[_0xe49f('0x2d')],'type':_0x1b3280[_0xe49f('0x2e')]['key']};});_0x298248[_0xe49f('0x2f')]=_[_0xe49f('0x2a')](_0x4be6fc,_0xe49f('0x28'));_0x298248[_0xe49f('0x30')]=_['keys'](_0x557b4e['query']);_0x298248[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],_0x298248['query']);_0x32406b['attributes']=_[_0xe49f('0x32')](_0x298248[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0x557b4e['query'][_0xe49f('0x33')]));_0x32406b['attributes']=_0x32406b['attributes'][_0xe49f('0x34')]?_0x32406b[_0xe49f('0x35')]:_0x298248[_0xe49f('0x2f')];if(!_0x557b4e['query'][_0xe49f('0x36')](_0xe49f('0x37'))){_0x32406b['limit']=qs['limit'](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x1d')]);_0x32406b[_0xe49f('0x1b')]=qs[_0xe49f('0x1b')](_0x557b4e['query'][_0xe49f('0x1b')]);}_0x32406b[_0xe49f('0x38')]=qs[_0xe49f('0x39')](_0x557b4e[_0xe49f('0x30')][_0xe49f('0x39')]);_0x32406b[_0xe49f('0x3a')]=qs[_0xe49f('0x31')](_[_0xe49f('0x3b')](_0x557b4e[_0xe49f('0x30')],_0x298248[_0xe49f('0x31')]),_0x4be6fc);if(_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]){_0x32406b[_0xe49f('0x3a')]=_[_0xe49f('0x3d')](_0x32406b[_0xe49f('0x3a')],{'$or':_[_0xe49f('0x2a')](_0x4be6fc,function(_0x1edf31){if(_0x1edf31[_0xe49f('0x2e')]!==_0xe49f('0x3e')){var _0x3d1380={};_0x3d1380[_0x1edf31[_0xe49f('0x28')]]={'$like':'%'+_0x557b4e[_0xe49f('0x30')][_0xe49f('0x3c')]+'%'};return _0x3d1380;}})});}_0x32406b=_['merge']({},_0x32406b,_0x557b4e[_0xe49f('0x3f')]);var _0x2efd45={'where':_0x32406b[_0xe49f('0x3a')]};return db['WhatsappApplication'][_0xe49f('0x1e')](_0x2efd45)['then'](function(_0x5cdf86){_0x268f6e[_0xe49f('0x1e')]=_0x5cdf86;if(_0x557b4e[_0xe49f('0x30')]['includeAll']){_0x32406b[_0xe49f('0x40')]=[{'all':!![]}];}return db[_0xe49f('0x2b')][_0xe49f('0x41')](_0x32406b);})[_0xe49f('0x25')](function(_0x36422e){_0x268f6e[_0xe49f('0x42')]=_0x36422e;return _0x268f6e;})[_0xe49f('0x25')](respondWithFilteredResult(_0x1357f6,_0x32406b))['catch'](handleError(_0x1357f6,null));};exports[_0xe49f('0x43')]=function(_0xbe91d2,_0x370162){var _0x2fb5f4={'raw':!![],'where':{'id':_0xbe91d2[_0xe49f('0x44')]['id']}},_0xd4341f={};_0xd4341f['model']=_[_0xe49f('0x45')](db[_0xe49f('0x2b')][_0xe49f('0x2c')]);_0xd4341f[_0xe49f('0x30')]=_[_0xe49f('0x45')](_0xbe91d2[_0xe49f('0x30')]);_0xd4341f[_0xe49f('0x31')]=_[_0xe49f('0x32')](_0xd4341f['model'],_0xd4341f['query']);_0x2fb5f4[_0xe49f('0x35')]=_['intersection'](_0xd4341f[_0xe49f('0x2f')],qs[_0xe49f('0x33')](_0xbe91d2[_0xe49f('0x30')][_0xe49f('0x33')]));_0x2fb5f4['attributes']=_0x2fb5f4[_0xe49f('0x35')][_0xe49f('0x34')]?_0x2fb5f4[_0xe49f('0x35')]:_0xd4341f['model'];if(_0xbe91d2[_0xe49f('0x30')]['includeAll']){_0x2fb5f4[_0xe49f('0x40')]=[{'all':!![]}];}_0x2fb5f4=_['merge']({},_0x2fb5f4,_0xbe91d2[_0xe49f('0x3f')]);return db['WhatsappApplication'][_0xe49f('0x46')](_0x2fb5f4)[_0xe49f('0x25')](handleEntityNotFound(_0x370162,null))[_0xe49f('0x25')](respondWithResult(_0x370162,null))[_0xe49f('0x47')](handleError(_0x370162,null));};exports[_0xe49f('0x48')]=function(_0x21796d,_0x2f87aa){return db[_0xe49f('0x2b')][_0xe49f('0x48')](_0x21796d['body'],{})['then'](respondWithResult(_0x2f87aa,0xc9))[_0xe49f('0x47')](handleError(_0x2f87aa,null));};exports[_0xe49f('0x24')]=function(_0x3fa5ec,_0x2cd14d){if(_0x3fa5ec[_0xe49f('0x49')]['id']){delete _0x3fa5ec[_0xe49f('0x49')]['id'];}return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x3fa5ec[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x2cd14d,null))[_0xe49f('0x25')](saveUpdates(_0x3fa5ec['body'],null))[_0xe49f('0x25')](respondWithResult(_0x2cd14d,null))['catch'](handleError(_0x2cd14d,null));};exports[_0xe49f('0x26')]=function(_0x1daf27,_0x416807){return db[_0xe49f('0x2b')][_0xe49f('0x46')]({'where':{'id':_0x1daf27[_0xe49f('0x44')]['id']}})[_0xe49f('0x25')](handleEntityNotFound(_0x416807,null))[_0xe49f('0x25')](removeEntity(_0x416807,null))[_0xe49f('0x47')](handleError(_0x416807,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 50d9df6..cb13c8c 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 _0xb0b9=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1732ab,_0x3ea517){var _0xe332c2=function(_0x2be6d6){while(--_0x2be6d6){_0x1732ab['push'](_0x1732ab['shift']());}};_0xe332c2(++_0x3ea517);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x1d85d3,_0x5d6b86){_0x1d85d3=_0x1d85d3-0x0;var _0x175c12=_0xb0b9[_0x1d85d3];return _0x175c12;};'use strict';var _=require(_0x9b0b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9b0b('0x1'));var moment=require(_0x9b0b('0x2'));var BPromise=require(_0x9b0b('0x3'));var rp=require(_0x9b0b('0x4'));var fs=require('fs');var path=require(_0x9b0b('0x5'));var rimraf=require(_0x9b0b('0x6'));var config=require(_0x9b0b('0x7'));var attributes=require(_0x9b0b('0x8'));module[_0x9b0b('0x9')]=function(_0x24d4a9,_0x2c3d97){return _0x24d4a9[_0x9b0b('0xa')](_0x9b0b('0xb'),attributes,{'tableName':_0x9b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x885a=['./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x885a,0x180));var _0xa885=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x885a[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xa885('0x0'));var logger=require(_0xa885('0x1'))(_0xa885('0x2'));var moment=require(_0xa885('0x3'));var BPromise=require('bluebird');var rp=require(_0xa885('0x4'));var fs=require('fs');var path=require(_0xa885('0x5'));var rimraf=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var attributes=require(_0xa885('0x8'));module[_0xa885('0x9')]=function(_0x5dfd7e,_0x7ac6bd){return _0x5dfd7e[_0xa885('0xa')](_0xa885('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa885('0xc'),'collate':_0xa885('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7b778e4..028993a 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 _0xbd50=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x9fa69a,_0x1fde02){_0x9fa69a=_0x9fa69a-0x0;var _0x54621a=_0xbd50[_0x9fa69a];return _0x54621a;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x577225,_0x4213bc){var _0x34dca0=function(_0x474bd5){while(--_0x474bd5){_0x577225['push'](_0x577225['shift']());}};_0x34dca0(++_0x4213bc);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1a422a,_0x3468fd){_0x1a422a=_0x1a422a-0x0;var _0x4dcab4=_0xd0bb[_0x1a422a];return _0x4dcab4;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ee9ee76..f5ce441 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 _0x277c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','whatsapp','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x277c,0x153));var _0xc277=function(_0x2e3a04,_0x23bbca){_0x2e3a04=_0x2e3a04-0x0;var _0xbbb00d=_0x277c[_0x2e3a04];return _0xbbb00d;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xa')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller['getMessages']);router['get'](_0xc277('0xf'),auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')]('/',auth['isAuthenticated'](),controller[_0xc277('0x12')]);router['post'](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0x13')]);router[_0xc277('0x11')]('/:id/tags',auth[_0xc277('0x9')](),interaction[_0xc277('0x14')](_0xc277('0x15'),'whatsappinteraction:addtags'),controller['addTags']);router[_0xc277('0x16')]('/:id',auth[_0xc277('0x9')](),interaction['tracked'](_0xc277('0x15'),_0xc277('0x17')),controller[_0xc277('0x18')]);router['delete']('/:id',auth[_0xc277('0x9')](),interaction['tracked']('whatsapp',_0xc277('0x19')),controller[_0xc277('0x1a')]);router[_0xc277('0x1b')](_0xc277('0x1c'),auth[_0xc277('0x9')](),controller[_0xc277('0x1d')]);module[_0xc277('0x1e')]=router; \ No newline at end of file +var _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xda19,0xd5));var _0x9da1=function(_0x4eaf56,_0x183b51){_0x4eaf56=_0x4eaf56-0x0;var _0x1e4eb0=_0xda19[_0x4eaf56];return _0x1e4eb0;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 87c46ff..cd29fc7 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 _0x3937=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3937,0xbf));var _0x7393=function(_0x40b005,_0x3bfd52){_0x40b005=_0x40b005-0x0;var _0x399cc6=_0x3937[_0x40b005];return _0x399cc6;};'use strict';var Sequelize=require(_0x7393('0x0'));var moment=require('moment');module[_0x7393('0x1')]={'closed':{'type':Sequelize[_0x7393('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7393('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7393('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7393('0x3')]},'read1stAt':{'type':Sequelize[_0x7393('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7393('0x5')]('in',_0x7393('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7393('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7393('0x5')]('in',_0x7393('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7393('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xad78=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xad78,0x149));var _0x8ad7=function(_0x3ab4da,_0x51e0ef){_0x3ab4da=_0x3ab4da-0x0;var _0x125d3f=_0xad78[_0x3ab4da];return _0x125d3f;};'use strict';var Sequelize=require(_0x8ad7('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x8ad7('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8ad7('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8ad7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8ad7('0x3')]},'note':{'type':Sequelize[_0x8ad7('0x3')]},'phone':{'type':Sequelize[_0x8ad7('0x3')]},'read1stAt':{'type':Sequelize[_0x8ad7('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8ad7('0x4')]('in',_0x8ad7('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8ad7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8ad7('0x4')]('in',_0x8ad7('0x5')),'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 b3c7845..22b0d15 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 _0xee87=['transcript-%d-%s.zip','lastName','Attachment','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Messages','existsSync','createWriteStream','basename','direction','System','firstName','out','secret','renderFile','views','.pdf','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','name','send','Users','map','fullname','Tags','TagIds','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','field','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','having','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','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','contactName','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','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','params','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','Tag','whatsappInteractionTags:save','removeTags','download','unix','join','server','tmp','root','attachments'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xee87,0x10d));var _0x7ee8=function(_0x46b21b,_0x254195){_0x46b21b=_0x46b21b-0x0;var _0x9d2c3c=_0xee87[_0x46b21b];return _0x9d2c3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require(_0x7ee8('0x1'));var jsonpatch=require(_0x7ee8('0x2'));var rp=require(_0x7ee8('0x3'));var moment=require(_0x7ee8('0x4'));var BPromise=require(_0x7ee8('0x5'));var Mustache=require(_0x7ee8('0x6'));var util=require(_0x7ee8('0x7'));var path=require(_0x7ee8('0x8'));var sox=require(_0x7ee8('0x9'));var csv=require('to-csv');var ejs=require(_0x7ee8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ee8('0xb'));var squel=require(_0x7ee8('0xc'));var crypto=require(_0x7ee8('0xd'));var jsforce=require(_0x7ee8('0xe'));var deskjs=require(_0x7ee8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ee8('0x10'));var Redis=require('ioredis');var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require(_0x7ee8('0x13'));var pdf=require(_0x7ee8('0x14'));var hardwareService=require(_0x7ee8('0x15'));var logger=require(_0x7ee8('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x7ee8('0x17'));var licenseUtil=require(_0x7ee8('0x18'));var db=require(_0x7ee8('0x19'))['db'];config[_0x7ee8('0x1a')]=_[_0x7ee8('0x1b')](config[_0x7ee8('0x1a')],{'host':_0x7ee8('0x1c'),'port':0x18eb});var socket=require(_0x7ee8('0x1d'))(new Redis(config[_0x7ee8('0x1a')]));require(_0x7ee8('0x1e'))[_0x7ee8('0x1f')](socket);function respondWithStatusCode(_0x3ac36a,_0x59a5d3){_0x59a5d3=_0x59a5d3||0xcc;return function(_0x12e853){if(_0x12e853){return _0x3ac36a[_0x7ee8('0x20')](_0x59a5d3);}return _0x3ac36a[_0x7ee8('0x21')](_0x59a5d3)[_0x7ee8('0x22')]();};}function respondWithResult(_0xf4a2c8,_0xc46e32){_0xc46e32=_0xc46e32||0xc8;return function(_0x3de0b8){if(_0x3de0b8){return _0xf4a2c8[_0x7ee8('0x21')](_0xc46e32)[_0x7ee8('0x23')](_0x3de0b8);}};}function respondWithFilteredResult(_0x18d962,_0x4028a7){return function(_0xf14110){if(_0xf14110){var _0x5c1969=typeof _0x4028a7[_0x7ee8('0x24')]==='undefined'&&typeof _0x4028a7[_0x7ee8('0x25')]===_0x7ee8('0x26');var _0x48a36c=_0xf14110['count'];var _0x36c443=_0x5c1969?0x0:_0x4028a7[_0x7ee8('0x24')];var _0x298430=_0x5c1969?_0xf14110[_0x7ee8('0x27')]:_0x4028a7[_0x7ee8('0x24')]+_0x4028a7['limit'];var _0x35dac9;if(_0x298430>=_0x48a36c){_0x298430=_0x48a36c;_0x35dac9=0xc8;}else{_0x35dac9=0xce;}_0x18d962[_0x7ee8('0x21')](_0x35dac9);return _0x18d962[_0x7ee8('0x28')]('Content-Range',_0x36c443+'-'+_0x298430+'/'+_0x48a36c)[_0x7ee8('0x23')](_0xf14110);}return null;};}function patchUpdates(_0x406c2c){return function(_0xdf109c){try{jsonpatch[_0x7ee8('0x29')](_0xdf109c,_0x406c2c,!![]);}catch(_0x57dfaa){return BPromise[_0x7ee8('0x2a')](_0x57dfaa);}return _0xdf109c[_0x7ee8('0x2b')]();};}function saveUpdates(_0x1342ca,_0x5568cb){return function(_0x384e26){if(_0x384e26){return _0x384e26[_0x7ee8('0x2c')](_0x1342ca)[_0x7ee8('0x2d')](function(_0x5ae459){return _0x5ae459;});}return null;};}function removeEntity(_0x3f9cae,_0x3870e9){return function(_0x568ea){if(_0x568ea){return _0x568ea['destroy']()[_0x7ee8('0x2d')](function(){_0x3f9cae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x368b8c,_0x357683){return function(_0x4c214d){if(!_0x4c214d){_0x368b8c[_0x7ee8('0x20')](0x194);}return _0x4c214d;};}function handleError(_0x534075,_0x2e31ed){_0x2e31ed=_0x2e31ed||0x1f4;return function(_0x5e81d7){logger[_0x7ee8('0x2e')](_0x5e81d7['stack']);if(_0x5e81d7[_0x7ee8('0x2f')]){delete _0x5e81d7[_0x7ee8('0x2f')];}_0x534075['status'](_0x2e31ed)[_0x7ee8('0x30')](_0x5e81d7);};}function getInteractionUsers(_0x1f34c5,_0x2d8809){return new BPromise(function(_0x10af17,_0x2a8422){try{if(_0x2d8809[_0x1f34c5['id']]){_0x1f34c5[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x2d8809[_0x1f34c5['id']],function(_0x49b47b){return{'id':_0x49b47b['id'],'fullname':_0x49b47b[_0x7ee8('0x33')]};});}}catch(_0x4a34b8){_0x2a8422(_0x4a34b8);}_0x10af17(_0x1f34c5);});}function getInteractionTags(_0x40feae,_0x6544db){return new BPromise(function(_0x4871d4,_0x344796){try{if(_0x40feae['TagIds']){_0x40feae[_0x7ee8('0x34')]=[];_0x40feae[_0x7ee8('0x35')]['split'](',')[_0x7ee8('0x36')](function(_0x279f88){_0x40feae[_0x7ee8('0x34')][_0x7ee8('0x37')](_0x6544db[_0x279f88]);});}delete _0x40feae[_0x7ee8('0x35')];}catch(_0x52f50b){_0x344796(_0x52f50b);}_0x4871d4(_0x40feae);});}function updateWhatsappInteraction(_0x1f6c1d,_0x340852,_0x249173){return new BPromise(function(_0x505b3a,_0x314cf7){return getInteractionUsers(_0x1f6c1d,_0x249173)['then'](function(_0x20b1de){return getInteractionTags(_0x20b1de,_0x340852);})[_0x7ee8('0x2d')](function(_0x540ab6){return getStateInteraction(_0x540ab6);})[_0x7ee8('0x2d')](function(_0x18780b){_0x505b3a(_0x18780b);})[_0x7ee8('0x38')](function(_0x5d5b62){_0x314cf7(_0x5d5b62);});});}function getStateInteraction(_0x3004e7){return new BPromise(function(_0x5e8f51){_0x3004e7[_0x7ee8('0x39')]=0x0;_0x3004e7[_0x7ee8('0x3a')]=0x0;_0x3004e7[_0x7ee8('0x3b')]=0x0;_0x3004e7[_0x7ee8('0x3c')]=0x0;_0x3004e7[_0x7ee8('0x3d')]=0x0;if(!_0x3004e7[_0x7ee8('0x3e')]&&!_0x3004e7[_0x7ee8('0x3f')]){_0x3004e7[_0x7ee8('0x39')]+=0x1;}if(!_0x3004e7[_0x7ee8('0x3e')]&&_0x3004e7[_0x7ee8('0x3f')]){_0x3004e7[_0x7ee8('0x3a')]+=0x1;if(_0x3004e7[_0x7ee8('0x39')]){_0x3004e7[_0x7ee8('0x39')]-=0x1;}}if(_0x3004e7[_0x7ee8('0x3e')]&&_0x3004e7['UserId']){_0x3004e7['answered']+=0x1;if(_0x3004e7[_0x7ee8('0x3a')]){_0x3004e7['talking']-=0x1;}}if(_0x3004e7[_0x7ee8('0x3e')]&&!_0x3004e7[_0x7ee8('0x3f')]){_0x3004e7[_0x7ee8('0x3c')]+=0x1;if(_0x3004e7[_0x7ee8('0x39')]){_0x3004e7[_0x7ee8('0x39')]-=0x1;}}_0x3004e7[_0x7ee8('0x3d')]+=0x1;_0x5e8f51(_0x3004e7);});}exports[_0x7ee8('0x40')]=function(_0x384d83,_0x1f80e7){var _0x113319={},_0x2017e6={},_0x4540a5={'count':0x0,'rows':[]};var _0x11f352=_[_0x7ee8('0x32')](db[_0x7ee8('0x41')][_0x7ee8('0x42')],function(_0x3c0cd6){return{'name':_0x3c0cd6[_0x7ee8('0x43')],'type':_0x3c0cd6[_0x7ee8('0x44')][_0x7ee8('0x45')]};});_0x2017e6['model']=_[_0x7ee8('0x32')](_0x11f352,_0x7ee8('0x2f'));_0x2017e6['query']=_[_0x7ee8('0x46')](_0x384d83[_0x7ee8('0x47')]);_0x2017e6['filters']=_[_0x7ee8('0x48')](_0x2017e6[_0x7ee8('0x49')],_0x2017e6['query']);_0x113319[_0x7ee8('0x4a')]=_['intersection'](_0x2017e6['model'],qs['fields'](_0x384d83['query'][_0x7ee8('0x4b')]));_0x113319[_0x7ee8('0x4a')]=_0x113319['attributes'][_0x7ee8('0x4c')]?_0x113319[_0x7ee8('0x4a')]:_0x2017e6[_0x7ee8('0x49')];if(!_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x4d')](_0x7ee8('0x4e'))){_0x113319[_0x7ee8('0x25')]=qs[_0x7ee8('0x25')](_0x384d83['query'][_0x7ee8('0x25')]);_0x113319[_0x7ee8('0x24')]=qs['offset'](_0x384d83[_0x7ee8('0x47')]['offset']);}_0x113319['order']=qs[_0x7ee8('0x4f')](_0x384d83['query'][_0x7ee8('0x4f')]);_0x113319[_0x7ee8('0x50')]=qs[_0x7ee8('0x51')](_['pick'](_0x384d83[_0x7ee8('0x47')],_0x2017e6['filters']),_0x11f352);var _0xf0d68e=[];var _0x45c08b=squel['select']()[_0x7ee8('0x52')]('id')[_0x7ee8('0x52')](_0x7ee8('0x2f'))[_0x7ee8('0x52')]('color')['from'](_0x7ee8('0x53'));var _0xd7d328=squel['select']()[_0x7ee8('0x52')]('u.id')['field'](_0x7ee8('0x54'))[_0x7ee8('0x52')](_0x7ee8('0x55'))[_0x7ee8('0x56')](_0x7ee8('0x57'),'ui')[_0x7ee8('0x58')](_0x7ee8('0x59'),'u',_0x7ee8('0x5a'));var _0x419a16=squel[_0x7ee8('0x5b')]()['from'](_0x7ee8('0x5c'),'i')[_0x7ee8('0x58')]('cm_contacts','c',_0x7ee8('0x5d'))[_0x7ee8('0x58')]('users','o',_0x7ee8('0x5e'))[_0x7ee8('0x58')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x7ee8('0x58')](_0x7ee8('0x5f'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x7ee8('0x58')](_0x7ee8('0x60'),'it',_0x7ee8('0x61'))[_0x7ee8('0x58')](_0x7ee8('0x53'),'t',_0x7ee8('0x62'));var _0xf29280=squel['expr']();var _0x1b2dc1=[];var _0x1917b6=squel[_0x7ee8('0x63')]();var _0x45c7f6;if(_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x64')]){_0x45c7f6=as[_0x7ee8('0x65')](_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x64')]);var _0x1e7ccb=_0x45c7f6[_0x7ee8('0x66')];for(var _0x4a25d6=0x0;_0x4a25d6<_0x45c7f6[_0x7ee8('0x67')]['length'];_0x4a25d6++){var _0x36b730=_0x45c7f6[_0x7ee8('0x67')][_0x4a25d6];var _0xa78400='i';var _0x1e382a=_[_0x7ee8('0x68')](_0x11f352,[_0x7ee8('0x2f'),_0x36b730[_0x7ee8('0x52')]]);if(!_0x1e382a){switch(_0x36b730[_0x7ee8('0x52')]){case _0x7ee8('0x69'):if(_0x36b730['value']==0x1){_0x419a16['having']('`'+_0x36b730[_0x7ee8('0x52')]+_0x7ee8('0x6a'));}else{_0x419a16['having']('`'+_0x36b730[_0x7ee8('0x52')]+_0x7ee8('0x6b'));}break;case _0x7ee8('0x6c'):if(_0x36b730['operator']==='$substring'){if(_0x36b730[_0x7ee8('0x6d')][_0x7ee8('0x6e')]('\x20')[_0x7ee8('0x4c')]>0x1){_0xf29280[_0x1e7ccb](_0x7ee8('0x6f'),qs['getFullTextValue'](_0x36b730[_0x7ee8('0x6d')]),null);}else{var _0x24cf92='%'+_0x36b730[_0x7ee8('0x6d')]+'%';_0xf29280[_0x1e7ccb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x24cf92,_0x24cf92,_0x24cf92);}}else{_0x1e382a=_['find'](_0x11f352,[_0x7ee8('0x2f'),_0x7ee8('0x70')]);_0x36b730['field']=_0x7ee8('0x70');_0x4295b0=as[_0x7ee8('0x71')](_0xa78400,_0x1e382a[_0x7ee8('0x44')],_0x36b730);_0xf29280[_0x1e7ccb](_0x4295b0[_0x7ee8('0x72')],_0x4295b0[_0x7ee8('0x6d')][_0x7ee8('0x73')],_0x4295b0['value'][_0x7ee8('0x22')]);}break;case'Tag':var _0x722c77=_0x36b730[_0x7ee8('0x6d')][_0x7ee8('0x6e')](',')['map'](function(_0x7be683){return Number(_0x7be683);});_0x722c77[_0x7ee8('0x36')](function(_0x19d2d9){_0x1917b6['or'](_0x7ee8('0x74'),'%,'+_0x19d2d9+',%');});_0x1b2dc1=_[_0x7ee8('0x75')](_0x1b2dc1,_0x722c77);break;case _0x7ee8('0x76'):if(_0x36b730[_0x7ee8('0x77')]===_0x7ee8('0x78')){_0xf29280[_0x1e7ccb](_0x7ee8('0x79'),'%'+_0x36b730[_0x7ee8('0x6d')]+'%',null);}else{_0x1e382a=_[_0x7ee8('0x68')](_0x11f352,['name',_0x7ee8('0x3f')]);_0x36b730[_0x7ee8('0x52')]='UserId';_0x4295b0=as[_0x7ee8('0x71')](_0xa78400,_0x1e382a[_0x7ee8('0x44')],_0x36b730);_0xf29280[_0x1e7ccb](_0x4295b0['text'],_0x4295b0['value'][_0x7ee8('0x73')],_0x4295b0[_0x7ee8('0x6d')]['end']);}break;case _0x7ee8('0x7a'):_0x4295b0=as[_0x7ee8('0x71')]('me',null,_0x36b730);_0xf29280[_0x1e7ccb](_0x4295b0[_0x7ee8('0x72')],_0x4295b0['value']['start'],_0x4295b0[_0x7ee8('0x6d')][_0x7ee8('0x22')]);break;}}else{var _0x4295b0=as[_0x7ee8('0x71')](_0xa78400,_0x1e382a[_0x7ee8('0x44')],_0x36b730);_0xf29280[_0x1e7ccb](_0x4295b0[_0x7ee8('0x72')],_0x4295b0[_0x7ee8('0x6d')][_0x7ee8('0x73')],_0x4295b0[_0x7ee8('0x6d')][_0x7ee8('0x22')]);}}}else{var _0x4f8836=_(_0x384d83[_0x7ee8('0x47')])[_0x7ee8('0x46')]()[_0x7ee8('0x32')](function(_0x11ee40){return _['some'](_0x11f352,[_0x7ee8('0x2f'),_0x11ee40])?_0x11ee40:undefined;})[_0x7ee8('0x7b')]()['value']();if(!_['isEmpty'](_0x4f8836)){_0x4f8836['forEach'](function(_0x2a7f50){if(_0x2a7f50===_0x7ee8('0x7c')){_0x419a16[_0x7ee8('0x50')](_0x7ee8('0x7d'),[][_0x7ee8('0x7e')](_0x384d83['query'][_0x2a7f50]));}else if(_0x2a7f50===_0x7ee8('0x7f')){var _0x7caaec=JSON[_0x7ee8('0x80')](_0x384d83[_0x7ee8('0x47')][_0x2a7f50])[_0x7ee8('0x81')];var _0x51a581=JSON[_0x7ee8('0x80')](_0x384d83[_0x7ee8('0x47')][_0x2a7f50])['$lte'];_0x419a16[_0x7ee8('0x50')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7caaec,_0x51a581);}else{if(_0x384d83[_0x7ee8('0x47')][_0x2a7f50]===_0x7ee8('0x82')){_0x419a16[_0x7ee8('0x50')]('i.'+_0x2a7f50+'\x20IS\x20NULL');}else{_0x419a16['where']('i.'+_0x2a7f50+'\x20=\x20?',_0x384d83['query'][_0x2a7f50]);}}});}if(_0x384d83['query']['read']){if(_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x83')]==0x1){_0x419a16['having'](_0x7ee8('0x84'));}else{_0x419a16['having'](_0x7ee8('0x85'));}}if(_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x86')]){_0x1b2dc1=_[_0x7ee8('0x87')](_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x86')])?_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x86')]:new Array(_0x384d83['query']['tag']);_0x1b2dc1[_0x7ee8('0x36')](function(_0x2e4c17){_0x1917b6['or'](_0x7ee8('0x74'),'%,'+_0x2e4c17+',%');});}if(_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x88')]){var _0x140559=_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x88')]['replace']('\x5c','\x5c\x5c')[_0x7ee8('0x89')](/'/g,'\x27\x27');if(qs[_0x7ee8('0x8a')](_0x140559)){_0xf29280['or'](_0x7ee8('0x8b'),_0x140559+'%')['or'](_0x7ee8('0x8c'),_0x140559+'%');}else{_0xf29280['or'](_0x7ee8('0x8d'),qs[_0x7ee8('0x8e')](_0x140559))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x140559+'%');}}}_0x419a16['where'](_0xf29280);_0x419a16[_0x7ee8('0x8f')](_0x7ee8('0x90'));var _0x2d5b55={'type':db[_0x7ee8('0x91')][_0x7ee8('0x92')]['SELECT'],'raw':!![]};var _0x7659ba=_0x419a16[_0x7ee8('0x93')]();_0x7659ba['field'](_0x7ee8('0x90'));_0x7659ba[_0x7ee8('0x52')](_0x7ee8('0x94'),_0x7ee8('0x69'));if(_0x113319[_0x7ee8('0x95')]){_0x113319[_0x7ee8('0x95')][_0x7ee8('0x36')](function(_0x53c14d){var _0x5f3da3=_0x53c14d[0x0]==='contactName'?_0x53c14d[0x0]:'i.'+_0x53c14d[0x0];_0x419a16[_0x7ee8('0x95')](_0x5f3da3,_0x53c14d[0x1]===_0x7ee8('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x1b2dc1)){_0x419a16[_0x7ee8('0x97')](_0x1917b6);_0x7659ba[_0x7ee8('0x50')](_0x7ee8('0x98'),_0x1b2dc1);}BPromise[_0x7ee8('0x99')]()[_0x7ee8('0x2d')](function(){if(!_0x45c7f6){if(_0x384d83[_0x7ee8('0x47')]['WhatsappAccountId'])return;_0x7659ba[_0x7ee8('0x50')](_0x7ee8('0x9a'));_0x419a16[_0x7ee8('0x50')](_0x7ee8('0x9a'));return;}if(_0x384d83[_0x7ee8('0x9b')][_0x7ee8('0x9c')]!==_0x7ee8('0x9d'))return;return _0x384d83[_0x7ee8('0x9b')][_0x7ee8('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x303a8c){if(_[_0x7ee8('0x9f')](_0x303a8c)){_0x7659ba[_0x7ee8('0x50')](_0x7ee8('0xa0'));_0x419a16[_0x7ee8('0x50')](_0x7ee8('0xa0'));}else{_0x7659ba[_0x7ee8('0x50')](_0x7ee8('0x7d'),_[_0x7ee8('0x32')](_0x303a8c,'id'));_0x419a16[_0x7ee8('0x50')](_0x7ee8('0x7d'),_[_0x7ee8('0x32')](_0x303a8c,'id'));}});})[_0x7ee8('0x2d')](function(){if(_0x384d83[_0x7ee8('0x9b')]['role']==='agent'&&!_0x45c7f6&&!_0x384d83[_0x7ee8('0x47')][_0x7ee8('0x7c')])return[];return db[_0x7ee8('0xa1')][_0x7ee8('0x47')](_0x7659ba[_0x7ee8('0xa2')](),_0x2d5b55);})[_0x7ee8('0x2d')](function(_0x20ee4e){_0x4540a5[_0x7ee8('0x27')]=_0x20ee4e[_0x7ee8('0x4c')];if(_0x4540a5['count']===0x0)return[];return db[_0x7ee8('0xa1')][_0x7ee8('0x47')](_0x45c08b[_0x7ee8('0xa2')](),_0x2d5b55)[_0x7ee8('0x2d')](function(_0x2312af){_0xf0d68e=_[_0x7ee8('0xa3')](_0x2312af,'id');_0x2d5b55=_[_0x7ee8('0xa4')](_0x2d5b55,{'model':db[_0x7ee8('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x384d83[_0x7ee8('0x47')]['fields']){_0x113319[_0x7ee8('0x4a')][_0x7ee8('0x36')](function(_0x641b7){_0x419a16[_0x7ee8('0x52')]('i.'+_0x641b7);});}else{_0x419a16['field'](_0x7ee8('0x94'),'unreadMessages');_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xa5'),_0x7ee8('0xa6'));_0x419a16['field'](_0x7ee8('0xa7'),_0x7ee8('0xa8'));_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xa9'),_0x7ee8('0xaa'));_0x419a16['field']('i.*');_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xab'),_0x7ee8('0xac'));_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xad'),_0x7ee8('0xae'));_0x419a16['field'](_0x7ee8('0xaf'),_0x7ee8('0xb0'));_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xb1'),_0x7ee8('0xb2'));_0x419a16['field'](_0x7ee8('0xb3'),_0x7ee8('0xb4'));_0x419a16['field'](_0x7ee8('0xb5'),'Contact.fax');_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xb6'),_0x7ee8('0xb7'));_0x419a16[_0x7ee8('0x52')](_0x7ee8('0xb8'),'Owner.internal');_0x419a16['field'](_0x7ee8('0xb9'),_0x7ee8('0x35'));}if(_0x113319[_0x7ee8('0x25')])_0x419a16[_0x7ee8('0x25')](_0x113319['limit']);if(_0x113319[_0x7ee8('0x24')])_0x419a16[_0x7ee8('0x24')](_0x113319[_0x7ee8('0x24')]);return db['sequelize'][_0x7ee8('0x47')](_0x419a16[_0x7ee8('0xa2')](),_0x2d5b55);})[_0x7ee8('0x2d')](function(_0x331cc0){if(_0x331cc0[_0x7ee8('0x4c')]>0x0)_0xd7d328[_0x7ee8('0x50')](_0x7ee8('0xba'),_[_0x7ee8('0x32')](_0x331cc0,'id'));return db[_0x7ee8('0xa1')]['query'](_0xd7d328[_0x7ee8('0xa2')](),_0x2d5b55)[_0x7ee8('0x2d')](function(_0x304a39){var _0x2604f5=_[_0x7ee8('0xbb')](_0x304a39,_0x7ee8('0xbc'));var _0x3c6f90=[];_0x331cc0[_0x7ee8('0x36')](function(_0xd627f9){_0x3c6f90[_0x7ee8('0x37')](updateWhatsappInteraction(_0xd627f9,_0xf0d68e,_0x2604f5));});return BPromise[_0x7ee8('0xbd')](_0x3c6f90);});});})[_0x7ee8('0x2d')](function(_0x46374d){_0x4540a5[_0x7ee8('0xbe')]=_0x46374d;return _0x4540a5;})['then'](respondWithFilteredResult(_0x1f80e7,_0x113319))[_0x7ee8('0x38')](handleError(_0x1f80e7,null));};exports['show']=function(_0x451238,_0x56c3ff){var _0x47bd6a={'raw':![],'where':{'id':_0x451238[_0x7ee8('0xbf')]['id']}},_0x1cfaa9={};_0x1cfaa9[_0x7ee8('0x49')]=_['keys'](db[_0x7ee8('0x41')][_0x7ee8('0x42')]);_0x1cfaa9[_0x7ee8('0x47')]=_[_0x7ee8('0x46')](_0x451238[_0x7ee8('0x47')]);_0x1cfaa9[_0x7ee8('0x51')]=_['intersection'](_0x1cfaa9['model'],_0x1cfaa9[_0x7ee8('0x47')]);_0x47bd6a[_0x7ee8('0x4a')]=_[_0x7ee8('0x48')](_0x1cfaa9[_0x7ee8('0x49')],qs[_0x7ee8('0x4b')](_0x451238[_0x7ee8('0x47')]['fields']));_0x47bd6a['attributes']=_0x47bd6a[_0x7ee8('0x4a')][_0x7ee8('0x4c')]?_0x47bd6a[_0x7ee8('0x4a')]:_0x1cfaa9[_0x7ee8('0x49')];if(_0x451238[_0x7ee8('0x47')][_0x7ee8('0xc0')]){_0x47bd6a[_0x7ee8('0xc1')]=[{'all':!![]}];}_0x47bd6a=_[_0x7ee8('0xa4')]({},_0x47bd6a,_0x451238[_0x7ee8('0xc2')]);return db[_0x7ee8('0x41')][_0x7ee8('0x68')](_0x47bd6a)[_0x7ee8('0x2d')](handleEntityNotFound(_0x56c3ff,null))['then'](respondWithResult(_0x56c3ff,null))[_0x7ee8('0x38')](handleError(_0x56c3ff,null));};exports[_0x7ee8('0xc3')]=function(_0x57263c,_0x159954){return db[_0x7ee8('0x41')]['create'](_0x57263c[_0x7ee8('0x7a')],{})[_0x7ee8('0x2d')](respondWithResult(_0x159954,0xc9))['catch'](handleError(_0x159954,null));};exports[_0x7ee8('0x2c')]=function(_0x13b274,_0x2e2856){if(_0x13b274[_0x7ee8('0x7a')]['id']){delete _0x13b274['body']['id'];}return db[_0x7ee8('0x41')]['find']({'where':{'id':_0x13b274[_0x7ee8('0xbf')]['id']}})['then'](handleEntityNotFound(_0x2e2856,null))[_0x7ee8('0x2d')](saveUpdates(_0x13b274[_0x7ee8('0x7a')],null))[_0x7ee8('0x2d')](respondWithResult(_0x2e2856,null))['catch'](handleError(_0x2e2856,null));};exports['destroy']=function(_0x4b585f,_0x3de823){return db['WhatsappInteraction']['find']({'where':{'id':_0x4b585f[_0x7ee8('0xbf')]['id']}})[_0x7ee8('0x2d')](handleEntityNotFound(_0x3de823,null))[_0x7ee8('0x2d')](removeEntity(_0x3de823,null))[_0x7ee8('0x38')](handleError(_0x3de823,null));};exports['describe']=function(_0x95f49c,_0x15a37e){return db[_0x7ee8('0x41')][_0x7ee8('0xc4')]()[_0x7ee8('0x2d')](respondWithResult(_0x15a37e,null))[_0x7ee8('0x38')](handleError(_0x15a37e,null));};exports[_0x7ee8('0xc5')]=function(_0x2b828a,_0x22d7fe,_0x5ace84){return db[_0x7ee8('0xc6')]['find']({'where':{'id':_0x2b828a[_0x7ee8('0xbf')]['id']}})[_0x7ee8('0x2d')](handleEntityNotFound(_0x22d7fe,null))[_0x7ee8('0x2d')](function(_0x229948){if(_0x229948){return _0x229948[_0x7ee8('0xc5')](_0x2b828a[_0x7ee8('0x7a')][_0x7ee8('0xc7')],_[_0x7ee8('0xc8')](_0x2b828a[_0x7ee8('0x7a')],['ids','id'])||{});}})['then'](respondWithResult(_0x22d7fe,null))['catch'](handleError(_0x22d7fe,null));};exports[_0x7ee8('0xc9')]=function(_0xbddf89,_0x426c07,_0x82d594){var _0x161e95={'raw':![],'where':{}};var _0x526cc9={};var _0x341343={'count':0x0,'rows':[]};return db[_0x7ee8('0x41')]['findOne']({'where':{'id':_0xbddf89[_0x7ee8('0xbf')]['id']}})[_0x7ee8('0x2d')](handleEntityNotFound(_0x426c07,null))[_0x7ee8('0x2d')](function(_0x39d1aa){if(_0x39d1aa){_0x526cc9[_0x7ee8('0x49')]=_[_0x7ee8('0x46')](db[_0x7ee8('0xc6')]['rawAttributes']);_0x526cc9['query']=_[_0x7ee8('0x46')](_0xbddf89[_0x7ee8('0x47')]);_0x526cc9['filters']=_[_0x7ee8('0x48')](_0x526cc9[_0x7ee8('0x49')],_0x526cc9['query']);_0x161e95[_0x7ee8('0x4a')]=_[_0x7ee8('0x48')](_0x526cc9[_0x7ee8('0x49')],qs[_0x7ee8('0x4b')](_0xbddf89[_0x7ee8('0x47')]['fields']));_0x161e95[_0x7ee8('0x4a')]=_0x161e95[_0x7ee8('0x4a')][_0x7ee8('0x4c')]?_0x161e95[_0x7ee8('0x4a')]:_0x526cc9[_0x7ee8('0x49')];if(!_0xbddf89['query'][_0x7ee8('0x4d')](_0x7ee8('0x4e'))){_0x161e95[_0x7ee8('0x25')]=qs[_0x7ee8('0x25')](_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x25')]);_0x161e95[_0x7ee8('0x24')]=qs[_0x7ee8('0x24')](_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x24')]);}_0x161e95[_0x7ee8('0x95')]=qs[_0x7ee8('0x4f')](_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x4f')]);_0x161e95[_0x7ee8('0x50')]=qs[_0x7ee8('0x51')](_[_0x7ee8('0xca')](_0xbddf89[_0x7ee8('0x47')],_0x526cc9[_0x7ee8('0x51')]));_0x161e95[_0x7ee8('0x50')]['WhatsappInteractionId']=_0x39d1aa['id'];if(_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x88')]){_0x161e95[_0x7ee8('0x50')]=_['merge'](_0x161e95['where'],{'$or':_['map'](_0x161e95[_0x7ee8('0x4a')],function(_0x1f6d9f){var _0x5b78ae={};_0x5b78ae[_0x1f6d9f]={'$like':'%'+_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x88')]+'%'};return _0x5b78ae;})});}if(_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0x81')]){var _0x237c44=_0xbddf89[_0x7ee8('0x47')]['$gte'][_0x7ee8('0x6e')](',');var _0x4bb4e0={};_0x4bb4e0[_0x237c44[0x0]]={'$gte':moment(_0x237c44[0x1])[_0x7ee8('0xcb')](_0x7ee8('0xcc'))};_0x161e95[_0x7ee8('0x50')]=_[_0x7ee8('0xa4')](_0x161e95[_0x7ee8('0x50')],_0x4bb4e0);}_0x161e95=_[_0x7ee8('0xa4')]({},_0x161e95,_0xbddf89[_0x7ee8('0xc2')]);return db[_0x7ee8('0xc6')][_0x7ee8('0x27')]({'where':_0x161e95[_0x7ee8('0x50')]})[_0x7ee8('0x2d')](function(_0x3d1ab2){_0x341343[_0x7ee8('0x27')]=_0x3d1ab2;if(_0xbddf89[_0x7ee8('0x47')][_0x7ee8('0xc0')]){_0x161e95[_0x7ee8('0xc1')]=[{'all':!![]}];}return db[_0x7ee8('0xc6')][_0x7ee8('0xcd')](_0x161e95);})[_0x7ee8('0x2d')](function(_0x3d54ad){_0x341343[_0x7ee8('0xbe')]=_0x3d54ad;return _0x341343;});}})[_0x7ee8('0x2d')](respondWithFilteredResult(_0x426c07,_0x161e95))[_0x7ee8('0x38')](handleError(_0x426c07,null));};exports[_0x7ee8('0xce')]=function(_0x3e552a,_0x4c58e5,_0x5ea611){return db[_0x7ee8('0x41')][_0x7ee8('0x68')]({'where':{'id':_0x3e552a['params']['id']}})[_0x7ee8('0x2d')](handleEntityNotFound(_0x4c58e5,null))[_0x7ee8('0x2d')](function(_0x1cffa1){if(_0x1cffa1){return _0x1cffa1['setTags'](_0x3e552a[_0x7ee8('0x7a')]['ids'],_[_0x7ee8('0xc8')](_0x3e552a[_0x7ee8('0x7a')],[_0x7ee8('0xc7'),'id'])||{})['spread'](function(){return db[_0x7ee8('0xcf')][_0x7ee8('0xcd')]({'attributes':['id',_0x7ee8('0x2f'),'color'],'where':{'id':_0x3e552a[_0x7ee8('0x7a')]['ids']}});})[_0x7ee8('0x2d')](function(_0x1a50e4){socket['emit'](_0x7ee8('0xd0'),{'id':Number(_0x3e552a['params']['id']),'tags':_0x1a50e4||[]});return{'id':Number(_0x3e552a['params']['id']),'tags':_0x1a50e4||[]};});}})['then'](respondWithResult(_0x4c58e5,null))[_0x7ee8('0x38')](handleError(_0x4c58e5,null));};exports[_0x7ee8('0xd1')]=function(_0x4d3409,_0x5011ed,_0x3ca08c){return db[_0x7ee8('0x41')][_0x7ee8('0x68')]({'where':{'id':_0x4d3409[_0x7ee8('0xbf')]['id']}})[_0x7ee8('0x2d')](handleEntityNotFound(_0x5011ed,null))['then'](function(_0x1028a4){if(_0x1028a4){return _0x1028a4['removeTags'](_0x4d3409[_0x7ee8('0x47')][_0x7ee8('0xc7')]);}})[_0x7ee8('0x2d')](respondWithStatusCode(_0x5011ed,null))[_0x7ee8('0x38')](handleError(_0x5011ed,null));};exports[_0x7ee8('0xd2')]=function(_0x544a69,_0x1399cc){var _0x24d409=moment()[_0x7ee8('0xd3')]()[_0x7ee8('0xa2')]();var _0x5281b9=path[_0x7ee8('0xd4')](config['root'],_0x7ee8('0xd5'),'files',_0x7ee8('0xd6'));var _0x520b03=path['join'](config[_0x7ee8('0xd7')],'server','files',_0x7ee8('0xd8'));var _0x729e61=path[_0x7ee8('0xd4')](_0x5281b9,_0x24d409);var _0x4e4be6=util['format'](_0x7ee8('0xd9'),_0x544a69['params']['id'],_0x24d409);var _0x1531ba=path['join'](_0x5281b9,_0x4e4be6);var _0x200a09=[];_0x200a09[_0x7ee8('0x37')]({'model':db['User'],'as':_0x7ee8('0x76'),'attributes':['id',_0x7ee8('0x33')],'raw':!![]});_0x200a09['push']({'model':db['CmContact'],'as':_0x7ee8('0x6c'),'attributes':['id','firstName',_0x7ee8('0xda')],'raw':!![]});if(_0x544a69['query'][_0x7ee8('0xd8')]){_0x200a09['push']({'model':db[_0x7ee8('0xdb')],'as':_0x7ee8('0xdb'),'raw':!![]});}var _0x43e35c=[{'model':db[_0x7ee8('0xc6')],'as':'Messages','attributes':['id',_0x7ee8('0x7a'),_0x7ee8('0x7f'),'direction','secret','read'],'include':_0x200a09}];_0x43e35c[_0x7ee8('0x37')]({'model':db[_0x7ee8('0xdc')],'as':_0x7ee8('0xdd'),'attributes':['id',_0x7ee8('0x2f')]});_0x43e35c[_0x7ee8('0x37')]({'model':db[_0x7ee8('0x76')],'as':_0x7ee8('0xde'),'attributes':['id',_0x7ee8('0x33')]});return db[_0x7ee8('0x41')][_0x7ee8('0x68')]({'where':{'id':_0x544a69[_0x7ee8('0xbf')]['id']},'include':_0x43e35c})[_0x7ee8('0x2d')](handleEntityNotFound(_0x1399cc,null))['then'](function(_0x81877d){if(_0x81877d){var _0x21bef5=_0x81877d[_0x7ee8('0xdf')]({'plain':!![]});fs[_0x7ee8('0xe0')](_0x729e61);var _0x540027={'channel':_0x7ee8('0xe1'),'account':_0x21bef5[_0x7ee8('0xdd')][_0x7ee8('0x2f')],'agent':_0x21bef5['Owner']?_0x21bef5[_0x7ee8('0xde')][_0x7ee8('0x33')]:_0x7ee8('0xe2'),'createdAt':moment(_0x21bef5[_0x7ee8('0x7f')])[_0x7ee8('0xcb')](_0x7ee8('0xcc'))['toString'](),'closedAt':_0x21bef5[_0x7ee8('0x3e')]?moment(_0x21bef5[_0x7ee8('0xe3')])['format'](_0x7ee8('0xcc'))['toString']():'','disposition':_0x21bef5[_0x7ee8('0xe4')],'messages':_(_0x21bef5[_0x7ee8('0xe5')])[_0x7ee8('0x88')]({'secret':![]})[_0x7ee8('0x32')](function(_0x28663c){if(_0x28663c[_0x7ee8('0xdb')]){var _0x71430e=path[_0x7ee8('0xd4')](_0x520b03,_0x28663c['Attachment']['basename']);if(fs[_0x7ee8('0xe6')](_0x71430e)){fs['createReadStream'](_0x71430e)['pipe'](fs[_0x7ee8('0xe7')](path['join'](_0x729e61,_0x28663c['Attachment'][_0x7ee8('0xe8')])));}}return{'date':moment(_0x28663c[_0x7ee8('0x7f')])[_0x7ee8('0xcb')](_0x7ee8('0xcc'))[_0x7ee8('0xa2')](),'sender':_0x28663c[_0x7ee8('0xe9')]==='out'?_0x28663c[_0x7ee8('0x76')]?_0x28663c[_0x7ee8('0x76')][_0x7ee8('0x33')]:_0x7ee8('0xea'):_0x28663c[_0x7ee8('0x6c')][_0x7ee8('0xeb')]+(_0x28663c['Contact'][_0x7ee8('0xda')]?'\x20'+_0x28663c['Contact'][_0x7ee8('0xda')]:''),'body':_0x28663c[_0x7ee8('0xdb')]?_0x28663c[_0x7ee8('0xdb')]['basename']:_0x28663c['body'],'direction':_0x28663c['direction']===_0x7ee8('0xec')?'A':'C','secret':_0x28663c[_0x7ee8('0xed')],'read':_0x28663c[_0x7ee8('0x83')],'attachment':_0x28663c[_0x7ee8('0xdb')]};})['value']()};return ejs[_0x7ee8('0xee')](path['join'](config[_0x7ee8('0xd7')],_0x7ee8('0xd5'),_0x7ee8('0xef'),'downloadInteraction.ejs'),{'interaction':_0x540027})['then'](function(_0x144a49){var _0x4b4dce=path[_0x7ee8('0xd4')](_0x729e61,'transcript-'+_0x21bef5['id']+'-'+_0x24d409+_0x7ee8('0xf0'));var _0x2d761f={'path':_0x4b4dce,'channel':'Whatsapp','interactionId':_0x21bef5['id']};return pdf['createPdfFromHTML'](_0x144a49,_0x2d761f);})[_0x7ee8('0x2d')](function(){return new BPromise(function(_0x20c472,_0x3278b6){zipdir(_0x729e61,{'saveTo':_0x1531ba},function(_0x3c3fe1,_0x420182){if(_0x3c3fe1)return _0x3278b6(_0x3c3fe1);return _0x20c472(_0x420182);});})['then'](function(){return new BPromise(function(_0x17befb,_0x3df183){rimraf(_0x729e61,function(_0x1c3395){if(_0x1c3395)_0x3df183(_0x1c3395);return _0x17befb();});});})[_0x7ee8('0x2d')](function(){return _0x1399cc[_0x7ee8('0xd2')](_0x1531ba,_0x4e4be6,function(_0x30cdde){if(_0x30cdde){console['log'](_0x7ee8('0xf1'),_0x30cdde);}else{fs[_0x7ee8('0xf2')](_0x1531ba);}});});});}else{return _0x1399cc[_0x7ee8('0x20')](0xc8);}})[_0x7ee8('0x38')](handleError(_0x1399cc,null));}; \ No newline at end of file +var _0x86dc=['Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','rawAttributes','include','options','create','body','params','destroy','describe','addMessage','ids','omit','findOne','WhatsappMessage','nolimit','order','sort','format','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','createReadStream','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','error','name','send','fullname','Tags','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','WhatsappInteraction','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','where','pick','select','field','color','tools_tags','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','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','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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?','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','i.WhatsappAccountId\x20IS\x20NULL','user','sequelize','toString','merge','Account.key','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.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile'];(function(_0x315b61,_0x4bb11e){var _0x3521e8=function(_0x5e6389){while(--_0x5e6389){_0x315b61['push'](_0x315b61['shift']());}};_0x3521e8(++_0x4bb11e);}(_0x86dc,0x13e));var _0xc86d=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0x86dc[_0x56d591];return _0x4bf0ff;};'use strict';var emlformat=require(_0xc86d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc86d('0x1'));var rp=require(_0xc86d('0x2'));var moment=require(_0xc86d('0x3'));var BPromise=require(_0xc86d('0x4'));var Mustache=require('mustache');var util=require(_0xc86d('0x5'));var path=require('path');var sox=require(_0xc86d('0x6'));var csv=require('to-csv');var ejs=require(_0xc86d('0x7'));var fs=require('fs');var fs_extra=require(_0xc86d('0x8'));var _=require(_0xc86d('0x9'));var squel=require('squel');var crypto=require(_0xc86d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc86d('0xb'));var toCsv=require(_0xc86d('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc86d('0xd'));var authService=require(_0xc86d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc86d('0xf'));var pdf=require(_0xc86d('0x10'));var hardwareService=require(_0xc86d('0x11'));var logger=require(_0xc86d('0x12'))(_0xc86d('0x13'));var utils=require(_0xc86d('0x14'));var config=require(_0xc86d('0x15'));var licenseUtil=require(_0xc86d('0x16'));var db=require(_0xc86d('0x17'))['db'];config[_0xc86d('0x18')]=_[_0xc86d('0x19')](config[_0xc86d('0x18')],{'host':_0xc86d('0x1a'),'port':0x18eb});var socket=require(_0xc86d('0x1b'))(new Redis(config[_0xc86d('0x18')]));require(_0xc86d('0x1c'))[_0xc86d('0x1d')](socket);function respondWithStatusCode(_0x313c16,_0x2bc469){_0x2bc469=_0x2bc469||0xcc;return function(_0x24c9c3){if(_0x24c9c3){return _0x313c16[_0xc86d('0x1e')](_0x2bc469);}return _0x313c16['status'](_0x2bc469)['end']();};}function respondWithResult(_0x49af1f,_0x3a253c){_0x3a253c=_0x3a253c||0xc8;return function(_0x376a90){if(_0x376a90){return _0x49af1f[_0xc86d('0x1f')](_0x3a253c)[_0xc86d('0x20')](_0x376a90);}};}function respondWithFilteredResult(_0x3a95c2,_0x3d7e72){return function(_0x279406){if(_0x279406){var _0x5f3ece=typeof _0x3d7e72['offset']===_0xc86d('0x21')&&typeof _0x3d7e72[_0xc86d('0x22')]===_0xc86d('0x21');var _0x56f510=_0x279406[_0xc86d('0x23')];var _0xb25b1b=_0x5f3ece?0x0:_0x3d7e72[_0xc86d('0x24')];var _0x4eb0e5=_0x5f3ece?_0x279406[_0xc86d('0x23')]:_0x3d7e72[_0xc86d('0x24')]+_0x3d7e72['limit'];var _0x34bb85;if(_0x4eb0e5>=_0x56f510){_0x4eb0e5=_0x56f510;_0x34bb85=0xc8;}else{_0x34bb85=0xce;}_0x3a95c2[_0xc86d('0x1f')](_0x34bb85);return _0x3a95c2[_0xc86d('0x25')](_0xc86d('0x26'),_0xb25b1b+'-'+_0x4eb0e5+'/'+_0x56f510)['json'](_0x279406);}return null;};}function patchUpdates(_0x2a0308){return function(_0x350cda){try{jsonpatch[_0xc86d('0x27')](_0x350cda,_0x2a0308,!![]);}catch(_0x1bb9ed){return BPromise[_0xc86d('0x28')](_0x1bb9ed);}return _0x350cda['save']();};}function saveUpdates(_0x38fb11,_0x419afa){return function(_0x41de64){if(_0x41de64){return _0x41de64[_0xc86d('0x29')](_0x38fb11)[_0xc86d('0x2a')](function(_0x5347f7){return _0x5347f7;});}return null;};}function removeEntity(_0x1458fe,_0x54303e){return function(_0x4e1312){if(_0x4e1312){return _0x4e1312['destroy']()[_0xc86d('0x2a')](function(){_0x1458fe[_0xc86d('0x1f')](0xcc)[_0xc86d('0x2b')]();});}};}function handleEntityNotFound(_0x1e29be,_0xd8b255){return function(_0x1ad978){if(!_0x1ad978){_0x1e29be[_0xc86d('0x1e')](0x194);}return _0x1ad978;};}function handleError(_0x2a35b3,_0x4db581){_0x4db581=_0x4db581||0x1f4;return function(_0x397a55){logger[_0xc86d('0x2c')](_0x397a55['stack']);if(_0x397a55['name']){delete _0x397a55[_0xc86d('0x2d')];}_0x2a35b3[_0xc86d('0x1f')](_0x4db581)[_0xc86d('0x2e')](_0x397a55);};}function getInteractionUsers(_0x271b23,_0x384bc9){return new BPromise(function(_0x217415,_0x27e478){try{if(_0x384bc9[_0x271b23['id']]){_0x271b23['Users']=_['map'](_0x384bc9[_0x271b23['id']],function(_0x205a2b){return{'id':_0x205a2b['id'],'fullname':_0x205a2b[_0xc86d('0x2f')]};});}}catch(_0x18e468){_0x27e478(_0x18e468);}_0x217415(_0x271b23);});}function getInteractionTags(_0x219673,_0x28dd82){return new BPromise(function(_0x5b80cb,_0x3ca99a){try{if(_0x219673['TagIds']){_0x219673[_0xc86d('0x30')]=[];_0x219673[_0xc86d('0x31')][_0xc86d('0x32')](',')[_0xc86d('0x33')](function(_0x3a469d){_0x219673[_0xc86d('0x30')][_0xc86d('0x34')](_0x28dd82[_0x3a469d]);});}delete _0x219673[_0xc86d('0x31')];}catch(_0x12ea63){_0x3ca99a(_0x12ea63);}_0x5b80cb(_0x219673);});}function updateWhatsappInteraction(_0x4e51bd,_0x557a73,_0x52c552){return new BPromise(function(_0x4ce856,_0x50d014){return getInteractionUsers(_0x4e51bd,_0x52c552)['then'](function(_0x412dd7){return getInteractionTags(_0x412dd7,_0x557a73);})[_0xc86d('0x2a')](function(_0x3fa1dd){return getStateInteraction(_0x3fa1dd);})[_0xc86d('0x2a')](function(_0x2cba68){_0x4ce856(_0x2cba68);})[_0xc86d('0x35')](function(_0x51924c){_0x50d014(_0x51924c);});});}function getStateInteraction(_0x3b0940){return new BPromise(function(_0x288c34){_0x3b0940[_0xc86d('0x36')]=0x0;_0x3b0940[_0xc86d('0x37')]=0x0;_0x3b0940[_0xc86d('0x38')]=0x0;_0x3b0940[_0xc86d('0x39')]=0x0;_0x3b0940[_0xc86d('0x3a')]=0x0;if(!_0x3b0940[_0xc86d('0x3b')]&&!_0x3b0940[_0xc86d('0x3c')]){_0x3b0940[_0xc86d('0x36')]+=0x1;}if(!_0x3b0940['closed']&&_0x3b0940[_0xc86d('0x3c')]){_0x3b0940['talking']+=0x1;if(_0x3b0940[_0xc86d('0x36')]){_0x3b0940[_0xc86d('0x36')]-=0x1;}}if(_0x3b0940[_0xc86d('0x3b')]&&_0x3b0940['UserId']){_0x3b0940[_0xc86d('0x38')]+=0x1;if(_0x3b0940[_0xc86d('0x37')]){_0x3b0940[_0xc86d('0x37')]-=0x1;}}if(_0x3b0940['closed']&&!_0x3b0940[_0xc86d('0x3c')]){_0x3b0940[_0xc86d('0x39')]+=0x1;if(_0x3b0940[_0xc86d('0x36')]){_0x3b0940[_0xc86d('0x36')]-=0x1;}}_0x3b0940[_0xc86d('0x3a')]+=0x1;_0x288c34(_0x3b0940);});}exports['index']=function(_0x25e94e,_0x30c566){var _0xdbe2c2={},_0x38d25e={},_0x3bd5ce={'count':0x0,'rows':[]};var _0x117d82=_['map'](db[_0xc86d('0x3d')]['rawAttributes'],function(_0x2023b5){return{'name':_0x2023b5[_0xc86d('0x3e')],'type':_0x2023b5[_0xc86d('0x3f')][_0xc86d('0x40')]};});_0x38d25e['model']=_['map'](_0x117d82,'name');_0x38d25e[_0xc86d('0x41')]=_[_0xc86d('0x42')](_0x25e94e[_0xc86d('0x41')]);_0x38d25e[_0xc86d('0x43')]=_['intersection'](_0x38d25e[_0xc86d('0x44')],_0x38d25e[_0xc86d('0x41')]);_0xdbe2c2[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x38d25e[_0xc86d('0x44')],qs['fields'](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x47')]));_0xdbe2c2[_0xc86d('0x45')]=_0xdbe2c2[_0xc86d('0x45')]['length']?_0xdbe2c2[_0xc86d('0x45')]:_0x38d25e['model'];if(!_0x25e94e['query'][_0xc86d('0x48')]('nolimit')){_0xdbe2c2[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x22')]);_0xdbe2c2['offset']=qs[_0xc86d('0x24')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x24')]);}_0xdbe2c2['order']=qs['sort'](_0x25e94e[_0xc86d('0x41')]['sort']);_0xdbe2c2[_0xc86d('0x49')]=qs[_0xc86d('0x43')](_[_0xc86d('0x4a')](_0x25e94e['query'],_0x38d25e['filters']),_0x117d82);var _0xe8a2aa=[];var _0x21b745=squel[_0xc86d('0x4b')]()['field']('id')[_0xc86d('0x4c')]('name')[_0xc86d('0x4c')](_0xc86d('0x4d'))['from'](_0xc86d('0x4e'));var _0x401ba4=squel['select']()[_0xc86d('0x4c')]('u.id')[_0xc86d('0x4c')](_0xc86d('0x4f'))[_0xc86d('0x4c')]('ui.WhatsappInteractionId')['from'](_0xc86d('0x50'),'ui')[_0xc86d('0x51')](_0xc86d('0x52'),'u',_0xc86d('0x53'));var _0x4fdeb8=squel[_0xc86d('0x4b')]()[_0xc86d('0x54')](_0xc86d('0x55'),'i')[_0xc86d('0x51')](_0xc86d('0x56'),'c',_0xc86d('0x57'))['left_join'](_0xc86d('0x52'),'o',_0xc86d('0x58'))[_0xc86d('0x51')](_0xc86d('0x59'),'a',_0xc86d('0x5a'))[_0xc86d('0x51')](_0xc86d('0x5b'),'me',_0xc86d('0x5c'))['left_join']('whatsapp_interaction_has_tags','it',_0xc86d('0x5d'))['left_join'](_0xc86d('0x4e'),'t',_0xc86d('0x5e'));var _0x52da8c=squel[_0xc86d('0x5f')]();var _0x64d4f7=[];var _0x2bf181=squel[_0xc86d('0x5f')]();var _0x2d8103;if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x60')]){_0x2d8103=as[_0xc86d('0x61')](_0x25e94e['query'][_0xc86d('0x60')]);var _0x28e7e3=_0x2d8103[_0xc86d('0x62')];for(var _0x345ae0=0x0;_0x345ae0<_0x2d8103['conditions'][_0xc86d('0x63')];_0x345ae0++){var _0x5cfb45=_0x2d8103[_0xc86d('0x64')][_0x345ae0];var _0x3a7900='i';var _0x1612d1=_['find'](_0x117d82,[_0xc86d('0x2d'),_0x5cfb45[_0xc86d('0x4c')]]);if(!_0x1612d1){switch(_0x5cfb45[_0xc86d('0x4c')]){case _0xc86d('0x65'):if(_0x5cfb45['value']==0x1){_0x4fdeb8['having']('`'+_0x5cfb45[_0xc86d('0x4c')]+'`\x20=\x200');}else{_0x4fdeb8[_0xc86d('0x66')]('`'+_0x5cfb45['field']+_0xc86d('0x67'));}break;case _0xc86d('0x68'):if(_0x5cfb45[_0xc86d('0x69')]==='$substring'){if(_0x5cfb45['value']['split']('\x20')[_0xc86d('0x63')]>0x1){_0x52da8c[_0x28e7e3](_0xc86d('0x6a'),qs[_0xc86d('0x6b')](_0x5cfb45[_0xc86d('0x6c')]),null);}else{var _0x7a5d0c='%'+_0x5cfb45[_0xc86d('0x6c')]+'%';_0x52da8c[_0x28e7e3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x7a5d0c,_0x7a5d0c,_0x7a5d0c);}}else{_0x1612d1=_['find'](_0x117d82,[_0xc86d('0x2d'),_0xc86d('0x6d')]);_0x5cfb45[_0xc86d('0x4c')]=_0xc86d('0x6d');_0x4cacd3=as[_0xc86d('0x6e')](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3['value'][_0xc86d('0x2b')]);}break;case _0xc86d('0x71'):var _0x5aa7be=_0x5cfb45['value']['split'](',')[_0xc86d('0x72')](function(_0x1d92d8){return Number(_0x1d92d8);});_0x5aa7be[_0xc86d('0x33')](function(_0x1c96ca){_0x2bf181['or'](_0xc86d('0x73'),'%,'+_0x1c96ca+',%');});_0x64d4f7=_[_0xc86d('0x74')](_0x64d4f7,_0x5aa7be);break;case _0xc86d('0x75'):if(_0x5cfb45[_0xc86d('0x69')]==='$substring'){_0x52da8c[_0x28e7e3](_0xc86d('0x76'),'%'+_0x5cfb45['value']+'%',null);}else{_0x1612d1=_[_0xc86d('0x77')](_0x117d82,[_0xc86d('0x2d'),_0xc86d('0x3c')]);_0x5cfb45[_0xc86d('0x4c')]=_0xc86d('0x3c');_0x4cacd3=as[_0xc86d('0x6e')](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);}break;case'body':_0x4cacd3=as[_0xc86d('0x6e')]('me',null,_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x70')],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);break;}}else{var _0x4cacd3=as['buildExpression'](_0x3a7900,_0x1612d1[_0xc86d('0x3f')],_0x5cfb45);_0x52da8c[_0x28e7e3](_0x4cacd3[_0xc86d('0x6f')],_0x4cacd3[_0xc86d('0x6c')]['start'],_0x4cacd3[_0xc86d('0x6c')][_0xc86d('0x2b')]);}}}else{var _0x542d27=_(_0x25e94e['query'])[_0xc86d('0x42')]()[_0xc86d('0x72')](function(_0x332cae){return _[_0xc86d('0x78')](_0x117d82,[_0xc86d('0x2d'),_0x332cae])?_0x332cae:undefined;})[_0xc86d('0x79')]()[_0xc86d('0x6c')]();if(!_[_0xc86d('0x7a')](_0x542d27)){_0x542d27[_0xc86d('0x33')](function(_0xd550a3){if(_0xd550a3===_0xc86d('0x7b')){_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x7c'),[][_0xc86d('0x7d')](_0x25e94e[_0xc86d('0x41')][_0xd550a3]));}else if(_0xd550a3===_0xc86d('0x7e')){var _0x20ce5b=JSON[_0xc86d('0x7f')](_0x25e94e['query'][_0xd550a3])[_0xc86d('0x80')];var _0x29ec29=JSON['parse'](_0x25e94e['query'][_0xd550a3])[_0xc86d('0x81')];_0x4fdeb8['where'](_0xc86d('0x82'),_0x20ce5b,_0x29ec29);}else{if(_0x25e94e[_0xc86d('0x41')][_0xd550a3]===_0xc86d('0x83')){_0x4fdeb8['where']('i.'+_0xd550a3+_0xc86d('0x84'));}else{_0x4fdeb8[_0xc86d('0x49')]('i.'+_0xd550a3+_0xc86d('0x85'),_0x25e94e[_0xc86d('0x41')][_0xd550a3]);}}});}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x86')]){if(_0x25e94e[_0xc86d('0x41')]['read']==0x1){_0x4fdeb8[_0xc86d('0x66')](_0xc86d('0x87'));}else{_0x4fdeb8[_0xc86d('0x66')](_0xc86d('0x88'));}}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]){_0x64d4f7=_[_0xc86d('0x8a')](_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')])?_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]:new Array(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x89')]);_0x64d4f7[_0xc86d('0x33')](function(_0x13c6a5){_0x2bf181['or'](_0xc86d('0x73'),'%,'+_0x13c6a5+',%');});}if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x8b')]){var _0x46ba36=_0x25e94e['query'][_0xc86d('0x8b')][_0xc86d('0x8c')]('\x5c','\x5c\x5c')[_0xc86d('0x8c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x46ba36)){_0x52da8c['or'](_0xc86d('0x8d'),_0x46ba36+'%')['or'](_0xc86d('0x8e'),_0x46ba36+'%');}else{_0x52da8c['or'](_0xc86d('0x8f'),qs[_0xc86d('0x6b')](_0x46ba36))['or'](_0xc86d('0x90'),_0x46ba36+'%');}}}_0x4fdeb8[_0xc86d('0x49')](_0x52da8c);_0x4fdeb8['group'](_0xc86d('0x91'));var _0x45d52e={'type':db['Sequelize'][_0xc86d('0x92')][_0xc86d('0x93')],'raw':!![]};var _0x43a3bc=_0x4fdeb8['clone']();_0x43a3bc[_0xc86d('0x4c')](_0xc86d('0x91'));_0x43a3bc[_0xc86d('0x4c')](_0xc86d('0x94'),_0xc86d('0x65'));if(_0xdbe2c2['order']){_0xdbe2c2['order'][_0xc86d('0x33')](function(_0x512f2e){var _0x4bbac8=_0x512f2e[0x0]===_0xc86d('0x95')?_0x512f2e[0x0]:'i.'+_0x512f2e[0x0];_0x4fdeb8['order'](_0x4bbac8,_0x512f2e[0x1]===_0xc86d('0x96')?![]:!![]);});}if(!_[_0xc86d('0x7a')](_0x64d4f7)){_0x4fdeb8[_0xc86d('0x66')](_0x2bf181);_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x97'),_0x64d4f7);}BPromise[_0xc86d('0x98')]()[_0xc86d('0x2a')](function(){if(!_0x2d8103){if(_0x25e94e[_0xc86d('0x41')][_0xc86d('0x7b')])return;_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x99'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x99'));return;}if(_0x25e94e['user'][_0xc86d('0x9a')]!==_0xc86d('0x9b'))return;return _0x25e94e['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2789ad){if(_[_0xc86d('0x7a')](_0x2789ad)){_0x43a3bc[_0xc86d('0x49')](_0xc86d('0x9c'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x9c'));}else{_0x43a3bc[_0xc86d('0x49')]('i.WhatsappAccountId\x20IN\x20?',_[_0xc86d('0x72')](_0x2789ad,'id'));_0x4fdeb8[_0xc86d('0x49')](_0xc86d('0x7c'),_['map'](_0x2789ad,'id'));}});})[_0xc86d('0x2a')](function(){if(_0x25e94e[_0xc86d('0x9d')]['role']===_0xc86d('0x9b')&&!_0x2d8103&&!_0x25e94e[_0xc86d('0x41')]['WhatsappAccountId'])return[];return db[_0xc86d('0x9e')]['query'](_0x43a3bc[_0xc86d('0x9f')](),_0x45d52e);})[_0xc86d('0x2a')](function(_0x449c2f){_0x3bd5ce['count']=_0x449c2f[_0xc86d('0x63')];if(_0x3bd5ce[_0xc86d('0x23')]===0x0)return[];return db[_0xc86d('0x9e')][_0xc86d('0x41')](_0x21b745[_0xc86d('0x9f')](),_0x45d52e)[_0xc86d('0x2a')](function(_0x576e56){_0xe8a2aa=_['keyBy'](_0x576e56,'id');_0x45d52e=_[_0xc86d('0xa0')](_0x45d52e,{'model':db[_0xc86d('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x25e94e[_0xc86d('0x41')]['fields']){_0xdbe2c2[_0xc86d('0x45')][_0xc86d('0x33')](function(_0xba3b4f){_0x4fdeb8[_0xc86d('0x4c')]('i.'+_0xba3b4f);});}else{_0x4fdeb8['field'](_0xc86d('0x94'),_0xc86d('0x65'));_0x4fdeb8['field']('a.key',_0xc86d('0xa1'));_0x4fdeb8[_0xc86d('0x4c')]('a.mandatoryDisposition',_0xc86d('0xa2'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa3'),_0xc86d('0x95'));_0x4fdeb8['field'](_0xc86d('0xa4'));_0x4fdeb8['field'](_0xc86d('0xa5'),_0xc86d('0xa6'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa7'),_0xc86d('0xa8'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xa9'),_0xc86d('0xaa'));_0x4fdeb8['field'](_0xc86d('0xab'),_0xc86d('0xac'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xad'),'Contact.mobile');_0x4fdeb8[_0xc86d('0x4c')]('c.fax',_0xc86d('0xae'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xaf'),_0xc86d('0xb0'));_0x4fdeb8[_0xc86d('0x4c')](_0xc86d('0xb1'),_0xc86d('0xb2'));_0x4fdeb8['field'](_0xc86d('0xb3'),_0xc86d('0x31'));}if(_0xdbe2c2['limit'])_0x4fdeb8['limit'](_0xdbe2c2[_0xc86d('0x22')]);if(_0xdbe2c2[_0xc86d('0x24')])_0x4fdeb8['offset'](_0xdbe2c2[_0xc86d('0x24')]);return db[_0xc86d('0x9e')][_0xc86d('0x41')](_0x4fdeb8[_0xc86d('0x9f')](),_0x45d52e);})[_0xc86d('0x2a')](function(_0x1c14d6){if(_0x1c14d6[_0xc86d('0x63')]>0x0)_0x401ba4[_0xc86d('0x49')](_0xc86d('0xb4'),_['map'](_0x1c14d6,'id'));return db['sequelize'][_0xc86d('0x41')](_0x401ba4[_0xc86d('0x9f')](),_0x45d52e)[_0xc86d('0x2a')](function(_0x5a300b){var _0x389f19=_[_0xc86d('0xb5')](_0x5a300b,_0xc86d('0xb6'));var _0x5a1571=[];_0x1c14d6[_0xc86d('0x33')](function(_0x2820a5){_0x5a1571['push'](updateWhatsappInteraction(_0x2820a5,_0xe8a2aa,_0x389f19));});return BPromise[_0xc86d('0xb7')](_0x5a1571);});});})[_0xc86d('0x2a')](function(_0x345bae){_0x3bd5ce[_0xc86d('0xb8')]=_0x345bae;return _0x3bd5ce;})[_0xc86d('0x2a')](respondWithFilteredResult(_0x30c566,_0xdbe2c2))[_0xc86d('0x35')](handleError(_0x30c566,null));};exports[_0xc86d('0xb9')]=function(_0x553ab0,_0x2a09d9){var _0xd7ad53={'raw':![],'where':{'id':_0x553ab0['params']['id']}},_0x541c22={};_0x541c22[_0xc86d('0x44')]=_[_0xc86d('0x42')](db['WhatsappInteraction'][_0xc86d('0xba')]);_0x541c22[_0xc86d('0x41')]=_[_0xc86d('0x42')](_0x553ab0[_0xc86d('0x41')]);_0x541c22[_0xc86d('0x43')]=_['intersection'](_0x541c22['model'],_0x541c22[_0xc86d('0x41')]);_0xd7ad53['attributes']=_[_0xc86d('0x46')](_0x541c22[_0xc86d('0x44')],qs['fields'](_0x553ab0[_0xc86d('0x41')][_0xc86d('0x47')]));_0xd7ad53[_0xc86d('0x45')]=_0xd7ad53[_0xc86d('0x45')]['length']?_0xd7ad53[_0xc86d('0x45')]:_0x541c22['model'];if(_0x553ab0[_0xc86d('0x41')]['includeAll']){_0xd7ad53[_0xc86d('0xbb')]=[{'all':!![]}];}_0xd7ad53=_['merge']({},_0xd7ad53,_0x553ab0[_0xc86d('0xbc')]);return db[_0xc86d('0x3d')]['find'](_0xd7ad53)[_0xc86d('0x2a')](handleEntityNotFound(_0x2a09d9,null))['then'](respondWithResult(_0x2a09d9,null))['catch'](handleError(_0x2a09d9,null));};exports[_0xc86d('0xbd')]=function(_0x335719,_0x36a070){return db[_0xc86d('0x3d')]['create'](_0x335719[_0xc86d('0xbe')],{})['then'](respondWithResult(_0x36a070,0xc9))[_0xc86d('0x35')](handleError(_0x36a070,null));};exports[_0xc86d('0x29')]=function(_0x44c4a7,_0x11a158){if(_0x44c4a7[_0xc86d('0xbe')]['id']){delete _0x44c4a7[_0xc86d('0xbe')]['id'];}return db[_0xc86d('0x3d')]['find']({'where':{'id':_0x44c4a7[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x11a158,null))[_0xc86d('0x2a')](saveUpdates(_0x44c4a7[_0xc86d('0xbe')],null))[_0xc86d('0x2a')](respondWithResult(_0x11a158,null))['catch'](handleError(_0x11a158,null));};exports[_0xc86d('0xc0')]=function(_0x214525,_0x20dda3){return db[_0xc86d('0x3d')]['find']({'where':{'id':_0x214525[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x20dda3,null))[_0xc86d('0x2a')](removeEntity(_0x20dda3,null))[_0xc86d('0x35')](handleError(_0x20dda3,null));};exports[_0xc86d('0xc1')]=function(_0xd8d92e,_0x42e51f){return db[_0xc86d('0x3d')]['describe']()[_0xc86d('0x2a')](respondWithResult(_0x42e51f,null))[_0xc86d('0x35')](handleError(_0x42e51f,null));};exports['addMessage']=function(_0x4cd541,_0x15d9c3,_0x31ef20){return db['WhatsappMessage'][_0xc86d('0x77')]({'where':{'id':_0x4cd541['params']['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x15d9c3,null))[_0xc86d('0x2a')](function(_0xc53dbe){if(_0xc53dbe){return _0xc53dbe[_0xc86d('0xc2')](_0x4cd541['body'][_0xc86d('0xc3')],_[_0xc86d('0xc4')](_0x4cd541[_0xc86d('0xbe')],[_0xc86d('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x15d9c3,null))[_0xc86d('0x35')](handleError(_0x15d9c3,null));};exports['getMessages']=function(_0x27a95a,_0x42dae8,_0x4aa98c){var _0x496258={'raw':![],'where':{}};var _0x4bca38={};var _0x4280f7={'count':0x0,'rows':[]};return db[_0xc86d('0x3d')][_0xc86d('0xc5')]({'where':{'id':_0x27a95a[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x42dae8,null))['then'](function(_0x3820aa){if(_0x3820aa){_0x4bca38[_0xc86d('0x44')]=_['keys'](db[_0xc86d('0xc6')][_0xc86d('0xba')]);_0x4bca38['query']=_[_0xc86d('0x42')](_0x27a95a[_0xc86d('0x41')]);_0x4bca38['filters']=_[_0xc86d('0x46')](_0x4bca38[_0xc86d('0x44')],_0x4bca38['query']);_0x496258[_0xc86d('0x45')]=_[_0xc86d('0x46')](_0x4bca38['model'],qs[_0xc86d('0x47')](_0x27a95a['query'][_0xc86d('0x47')]));_0x496258[_0xc86d('0x45')]=_0x496258[_0xc86d('0x45')][_0xc86d('0x63')]?_0x496258[_0xc86d('0x45')]:_0x4bca38['model'];if(!_0x27a95a[_0xc86d('0x41')][_0xc86d('0x48')](_0xc86d('0xc7'))){_0x496258[_0xc86d('0x22')]=qs[_0xc86d('0x22')](_0x27a95a[_0xc86d('0x41')]['limit']);_0x496258[_0xc86d('0x24')]=qs[_0xc86d('0x24')](_0x27a95a[_0xc86d('0x41')]['offset']);}_0x496258[_0xc86d('0xc8')]=qs[_0xc86d('0xc9')](_0x27a95a['query'][_0xc86d('0xc9')]);_0x496258[_0xc86d('0x49')]=qs[_0xc86d('0x43')](_['pick'](_0x27a95a[_0xc86d('0x41')],_0x4bca38[_0xc86d('0x43')]));_0x496258[_0xc86d('0x49')]['WhatsappInteractionId']=_0x3820aa['id'];if(_0x27a95a[_0xc86d('0x41')][_0xc86d('0x8b')]){_0x496258['where']=_[_0xc86d('0xa0')](_0x496258[_0xc86d('0x49')],{'$or':_[_0xc86d('0x72')](_0x496258['attributes'],function(_0x2f4a6b){var _0x4a2e17={};_0x4a2e17[_0x2f4a6b]={'$like':'%'+_0x27a95a[_0xc86d('0x41')][_0xc86d('0x8b')]+'%'};return _0x4a2e17;})});}if(_0x27a95a[_0xc86d('0x41')][_0xc86d('0x80')]){var _0x4437b3=_0x27a95a[_0xc86d('0x41')]['$gte']['split'](',');var _0x5de776={};_0x5de776[_0x4437b3[0x0]]={'$gte':moment(_0x4437b3[0x1])[_0xc86d('0xca')]('YYYY-MM-DD\x20HH:mm:ss')};_0x496258['where']=_[_0xc86d('0xa0')](_0x496258[_0xc86d('0x49')],_0x5de776);}_0x496258=_[_0xc86d('0xa0')]({},_0x496258,_0x27a95a['options']);return db['WhatsappMessage']['count']({'where':_0x496258['where']})[_0xc86d('0x2a')](function(_0x186c8a){_0x4280f7[_0xc86d('0x23')]=_0x186c8a;if(_0x27a95a['query']['includeAll']){_0x496258[_0xc86d('0xbb')]=[{'all':!![]}];}return db[_0xc86d('0xc6')][_0xc86d('0xcb')](_0x496258);})['then'](function(_0x1f6abb){_0x4280f7[_0xc86d('0xb8')]=_0x1f6abb;return _0x4280f7;});}})[_0xc86d('0x2a')](respondWithFilteredResult(_0x42dae8,_0x496258))[_0xc86d('0x35')](handleError(_0x42dae8,null));};exports[_0xc86d('0xcc')]=function(_0x538eac,_0x428b69,_0x2d63c5){return db['WhatsappInteraction']['find']({'where':{'id':_0x538eac[_0xc86d('0xbf')]['id']}})[_0xc86d('0x2a')](handleEntityNotFound(_0x428b69,null))[_0xc86d('0x2a')](function(_0x230c63){if(_0x230c63){return _0x230c63[_0xc86d('0xcd')](_0x538eac[_0xc86d('0xbe')][_0xc86d('0xc3')],_[_0xc86d('0xc4')](_0x538eac[_0xc86d('0xbe')],[_0xc86d('0xc3'),'id'])||{})[_0xc86d('0xce')](function(){return db[_0xc86d('0x71')][_0xc86d('0xcb')]({'attributes':['id',_0xc86d('0x2d'),'color'],'where':{'id':_0x538eac[_0xc86d('0xbe')][_0xc86d('0xc3')]}});})['then'](function(_0x5bcd2a){socket[_0xc86d('0xcf')](_0xc86d('0xd0'),{'id':Number(_0x538eac[_0xc86d('0xbf')]['id']),'tags':_0x5bcd2a||[]});return{'id':Number(_0x538eac['params']['id']),'tags':_0x5bcd2a||[]};});}})[_0xc86d('0x2a')](respondWithResult(_0x428b69,null))[_0xc86d('0x35')](handleError(_0x428b69,null));};exports[_0xc86d('0xd1')]=function(_0x4be8b1,_0x2953ac,_0x405cbf){return db[_0xc86d('0x3d')][_0xc86d('0x77')]({'where':{'id':_0x4be8b1[_0xc86d('0xbf')]['id']}})['then'](handleEntityNotFound(_0x2953ac,null))[_0xc86d('0x2a')](function(_0x31ea6e){if(_0x31ea6e){return _0x31ea6e[_0xc86d('0xd1')](_0x4be8b1[_0xc86d('0x41')][_0xc86d('0xc3')]);}})[_0xc86d('0x2a')](respondWithStatusCode(_0x2953ac,null))[_0xc86d('0x35')](handleError(_0x2953ac,null));};exports['download']=function(_0x366d41,_0x367409){var _0x1fcbdc=moment()[_0xc86d('0xd2')]()['toString']();var _0x34adda=path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),'files',_0xc86d('0xd6'));var _0xda3c27=path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),_0xc86d('0xd7'),_0xc86d('0xd8'));var _0x5bfc62=path[_0xc86d('0xd3')](_0x34adda,_0x1fcbdc);var _0x6fefb1=util['format'](_0xc86d('0xd9'),_0x366d41[_0xc86d('0xbf')]['id'],_0x1fcbdc);var _0x170b62=path[_0xc86d('0xd3')](_0x34adda,_0x6fefb1);var _0x33c099=[];_0x33c099[_0xc86d('0x34')]({'model':db[_0xc86d('0x75')],'as':_0xc86d('0x75'),'attributes':['id',_0xc86d('0x2f')],'raw':!![]});_0x33c099[_0xc86d('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xc86d('0xda'),_0xc86d('0xdb')],'raw':!![]});if(_0x366d41[_0xc86d('0x41')][_0xc86d('0xd8')]){_0x33c099['push']({'model':db['Attachment'],'as':_0xc86d('0xdc'),'raw':!![]});}var _0x367c67=[{'model':db['WhatsappMessage'],'as':_0xc86d('0xdd'),'attributes':['id',_0xc86d('0xbe'),_0xc86d('0x7e'),_0xc86d('0xde'),_0xc86d('0xdf'),_0xc86d('0x86')],'include':_0x33c099}];_0x367c67[_0xc86d('0x34')]({'model':db[_0xc86d('0xe0')],'as':_0xc86d('0xe1'),'attributes':['id',_0xc86d('0x2d')]});_0x367c67[_0xc86d('0x34')]({'model':db['User'],'as':_0xc86d('0xe2'),'attributes':['id',_0xc86d('0x2f')]});return db[_0xc86d('0x3d')][_0xc86d('0x77')]({'where':{'id':_0x366d41['params']['id']},'include':_0x367c67})['then'](handleEntityNotFound(_0x367409,null))[_0xc86d('0x2a')](function(_0x10f0b8){if(_0x10f0b8){var _0xcaaa5d=_0x10f0b8[_0xc86d('0xe3')]({'plain':!![]});fs[_0xc86d('0xe4')](_0x5bfc62);var _0x18758a={'channel':'Whatsapp','account':_0xcaaa5d[_0xc86d('0xe1')][_0xc86d('0x2d')],'agent':_0xcaaa5d[_0xc86d('0xe2')]?_0xcaaa5d['Owner']['fullname']:_0xc86d('0xe5'),'createdAt':moment(_0xcaaa5d['createdAt'])[_0xc86d('0xca')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0xcaaa5d['closed']?moment(_0xcaaa5d['closedAt'])[_0xc86d('0xca')](_0xc86d('0xe6'))[_0xc86d('0x9f')]():'','disposition':_0xcaaa5d[_0xc86d('0xe7')],'messages':_(_0xcaaa5d[_0xc86d('0xdd')])['filter']({'secret':![]})[_0xc86d('0x72')](function(_0x1d931a){if(_0x1d931a[_0xc86d('0xdc')]){var _0x55cb12=path[_0xc86d('0xd3')](_0xda3c27,_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')]);if(fs['existsSync'](_0x55cb12)){fs[_0xc86d('0xe9')](_0x55cb12)[_0xc86d('0xea')](fs[_0xc86d('0xeb')](path[_0xc86d('0xd3')](_0x5bfc62,_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')])));}}return{'date':moment(_0x1d931a['createdAt'])[_0xc86d('0xca')](_0xc86d('0xe6'))['toString'](),'sender':_0x1d931a[_0xc86d('0xde')]===_0xc86d('0xec')?_0x1d931a[_0xc86d('0x75')]?_0x1d931a[_0xc86d('0x75')][_0xc86d('0x2f')]:_0xc86d('0xed'):_0x1d931a['Contact']['firstName']+(_0x1d931a['Contact']['lastName']?'\x20'+_0x1d931a[_0xc86d('0x68')][_0xc86d('0xdb')]:''),'body':_0x1d931a['Attachment']?_0x1d931a[_0xc86d('0xdc')][_0xc86d('0xe8')]:_0x1d931a[_0xc86d('0xbe')],'direction':_0x1d931a['direction']==='out'?'A':'C','secret':_0x1d931a['secret'],'read':_0x1d931a[_0xc86d('0x86')],'attachment':_0x1d931a[_0xc86d('0xdc')]};})['value']()};return ejs[_0xc86d('0xee')](path[_0xc86d('0xd3')](config[_0xc86d('0xd4')],_0xc86d('0xd5'),_0xc86d('0xef'),_0xc86d('0xf0')),{'interaction':_0x18758a})['then'](function(_0x2f79f5){var _0x2b02d0=path['join'](_0x5bfc62,_0xc86d('0xf1')+_0xcaaa5d['id']+'-'+_0x1fcbdc+'.pdf');var _0x12ff5a={'path':_0x2b02d0,'channel':'Whatsapp','interactionId':_0xcaaa5d['id']};return pdf[_0xc86d('0xf2')](_0x2f79f5,_0x12ff5a);})[_0xc86d('0x2a')](function(){return new BPromise(function(_0x30a3f8,_0x1b1b10){zipdir(_0x5bfc62,{'saveTo':_0x170b62},function(_0xf2a9c5,_0x35a1d2){if(_0xf2a9c5)return _0x1b1b10(_0xf2a9c5);return _0x30a3f8(_0x35a1d2);});})['then'](function(){return new BPromise(function(_0x14e246,_0x50b50c){rimraf(_0x5bfc62,function(_0x2b7a9e){if(_0x2b7a9e)_0x50b50c(_0x2b7a9e);return _0x14e246();});});})[_0xc86d('0x2a')](function(){return _0x367409[_0xc86d('0xf3')](_0x170b62,_0x6fefb1,function(_0x352450){if(_0x352450){console[_0xc86d('0xf4')](_0xc86d('0xf5'),_0x352450);}else{fs['unlinkSync'](_0x170b62);}});});});}else{return _0x367409['sendStatus'](0xc8);}})[_0xc86d('0x35')](handleError(_0x367409,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3d99c90..fbc3afb 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 _0x5c00=['length','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x1a473b,_0x1e579e){var _0x5535af=function(_0x59ec72){while(--_0x59ec72){_0x1a473b['push'](_0x1a473b['shift']());}};_0x5535af(++_0x1e579e);}(_0x5c00,0x17e));var _0x05c0=function(_0x1cfba1,_0xceafc){_0x1cfba1=_0x1cfba1-0x0;var _0x4fd6aa=_0x5c00[_0x1cfba1];return _0x4fd6aa;};'use strict';var EventEmitter=require(_0x05c0('0x0'));var WhatsappInteraction=require(_0x05c0('0x1'))['db'][_0x05c0('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x05c0('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x05c0('0x4'),'afterUpdate':_0x05c0('0x5'),'afterDestroy':_0x05c0('0x6')};function emitEvent(_0x28d9c7){return function(_0x565efc,_0x145973,_0x3521fe){_0x565efc[_0x05c0('0x7')]({'attributes':['id'],'raw':!![]})[_0x05c0('0x8')](function(_0x5b9f09){_0x565efc[_0x05c0('0x9')](_0x05c0('0xa'),_0x5b9f09[_0x05c0('0xb')](function(_0x5afd4d){return{'id':_0x5afd4d['id']};}));return WhatsappMessage[_0x05c0('0xc')]({'where':{'WhatsappInteractionId':_0x565efc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x05c0('0x8')](function(_0x996d6b){_0x565efc[_0x05c0('0x9')](_0x05c0('0xd'),_0x996d6b[_0x05c0('0xe')]);WhatsappInteractionEvents['emit'](_0x28d9c7+':'+_0x565efc['id'],_0x565efc);WhatsappInteractionEvents['emit'](_0x28d9c7,_0x565efc);_0x3521fe(null);})[_0x05c0('0xf')](_0x3521fe(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x05c0('0x10')](e,emitEvent(event));}}module[_0x05c0('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf290=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x595e89,_0x4edaa9){var _0x48eaf4=function(_0x3d251b){while(--_0x3d251b){_0x595e89['push'](_0x595e89['shift']());}};_0x48eaf4(++_0x4edaa9);}(_0xf290,0xde));var _0x0f29=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xf290[_0x1ee351];return _0x245aaf;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x0f29('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x0f29('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0f29('0x1')](0x0);var events={'afterCreate':_0x0f29('0x2'),'afterUpdate':_0x0f29('0x3'),'afterDestroy':_0x0f29('0x4')};function emitEvent(_0xfdab92){return function(_0x5984ba,_0x45d37d,_0x4911fb){_0x5984ba[_0x0f29('0x5')]({'attributes':['id'],'raw':!![]})[_0x0f29('0x6')](function(_0x355e21){_0x5984ba[_0x0f29('0x7')](_0x0f29('0x8'),_0x355e21[_0x0f29('0x9')](function(_0x2be26e){return{'id':_0x2be26e['id']};}));return WhatsappMessage[_0x0f29('0xa')]({'where':{'WhatsappInteractionId':_0x5984ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0f29('0x6')](function(_0x139c65){_0x5984ba[_0x0f29('0x7')](_0x0f29('0xb'),_0x139c65[_0x0f29('0xc')]);WhatsappInteractionEvents[_0x0f29('0xd')](_0xfdab92+':'+_0x5984ba['id'],_0x5984ba);WhatsappInteractionEvents[_0x0f29('0xd')](_0xfdab92,_0x5984ba);_0x4911fb(null);})['catch'](_0x4911fb(null));};}for(var e in events){if(events[_0x0f29('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x0f29('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b3060a6..90629df 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 _0xab95=['bluebird','request-promise','path','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x4810ee,_0x2b6c3b){var _0x4b8e33=function(_0x124336){while(--_0x124336){_0x4810ee['push'](_0x4810ee['shift']());}};_0x4b8e33(++_0x2b6c3b);}(_0xab95,0xaf));var _0x5ab9=function(_0x4fadb3,_0x609f0b){_0x4fadb3=_0x4fadb3-0x0;var _0x384a7e=_0xab95[_0x4fadb3];return _0x384a7e;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var logger=require(_0x5ab9('0x2'))(_0x5ab9('0x3'));var moment=require(_0x5ab9('0x4'));var BPromise=require(_0x5ab9('0x5'));var rp=require(_0x5ab9('0x6'));var fs=require('fs');var path=require(_0x5ab9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ab9('0x8'));module[_0x5ab9('0x9')]=function(_0x8f739e,_0x46af13){return _0x8f739e[_0x5ab9('0xa')](_0x5ab9('0xb'),attributes,{'tableName':_0x5ab9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x483c3d,_0x3a91fc,_0x3018ae){if(_0x483c3d[_0x5ab9('0xd')](_0x5ab9('0xe'))){_0x483c3d[_0x5ab9('0xf')]=moment()[_0x5ab9('0x10')](_0x5ab9('0x11'));}_0x3018ae(null,_0x483c3d);}}});}; \ No newline at end of file +var _0x52db=['path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise'];(function(_0x867c03,_0x5f532d){var _0x760969=function(_0xd23675){while(--_0xd23675){_0x867c03['push'](_0x867c03['shift']());}};_0x760969(++_0x5f532d);}(_0x52db,0xe9));var _0xb52d=function(_0x494c47,_0x238d36){_0x494c47=_0x494c47-0x0;var _0x30db84=_0x52db[_0x494c47];return _0x30db84;};'use strict';var _=require(_0xb52d('0x0'));var util=require(_0xb52d('0x1'));var logger=require(_0xb52d('0x2'))(_0xb52d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb52d('0x4'));var fs=require('fs');var path=require(_0xb52d('0x5'));var rimraf=require(_0xb52d('0x6'));var config=require(_0xb52d('0x7'));var attributes=require(_0xb52d('0x8'));module[_0xb52d('0x9')]=function(_0x5e1250,_0x476ae9){return _0x5e1250['define'](_0xb52d('0xa'),attributes,{'tableName':_0xb52d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x474533,_0x33758c,_0x4b7178){if(_0x474533[_0xb52d('0xc')](_0xb52d('0xd'))){_0x474533[_0xb52d('0xe')]=moment()[_0xb52d('0xf')](_0xb52d('0x10'));}_0x4b7178(null,_0x474533);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8131be9..716809e 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 _0x0bbc=['WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','UpdateWhatsappInteraction'];(function(_0x30c713,_0x14ddfd){var _0x5791af=function(_0x17e37d){while(--_0x17e37d){_0x30c713['push'](_0x30c713['shift']());}};_0x5791af(++_0x14ddfd);}(_0x0bbc,0x1dc));var _0xc0bb=function(_0x2a3eab,_0x465414){_0x2a3eab=_0x2a3eab-0x0;var _0x931762=_0x0bbc[_0x2a3eab];return _0x931762;};'use strict';var _=require(_0xc0bb('0x0'));var util=require(_0xc0bb('0x1'));var moment=require(_0xc0bb('0x2'));var BPromise=require(_0xc0bb('0x3'));var rs=require(_0xc0bb('0x4'));var fs=require('fs');var Redis=require(_0xc0bb('0x5'));var db=require(_0xc0bb('0x6'))['db'];var utils=require(_0xc0bb('0x7'));var logger=require(_0xc0bb('0x8'))(_0xc0bb('0x9'));var config=require(_0xc0bb('0xa'));var jayson=require(_0xc0bb('0xb'));var client=jayson[_0xc0bb('0xc')]['http']({'port':0x232a});config['redis']=_[_0xc0bb('0xd')](config[_0xc0bb('0xe')],{'host':_0xc0bb('0xf'),'port':0x18eb});var socket=require(_0xc0bb('0x10'))(new Redis(config['redis']));require(_0xc0bb('0x11'))[_0xc0bb('0x12')](socket);function respondWithRpcPromise(_0x368f35,_0x2ac4a4,_0x133899){return new BPromise(function(_0x584c68,_0x3e2843){return client[_0xc0bb('0x13')](_0x368f35,_0x133899)[_0xc0bb('0x14')](function(_0x2f8209){logger[_0xc0bb('0x15')](_0xc0bb('0x16'),_0x2ac4a4,'request\x20sent');logger[_0xc0bb('0x17')](_0xc0bb('0x18'),_0x2ac4a4,_0xc0bb('0x19'),JSON['stringify'](_0x2f8209));if(_0x2f8209[_0xc0bb('0x1a')]){if(_0x2f8209[_0xc0bb('0x1a')]['code']===0x1f4){logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);return _0x3e2843(_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);}logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);return _0x584c68(_0x2f8209[_0xc0bb('0x1a')][_0xc0bb('0x1b')]);}else{logger[_0xc0bb('0x15')](_0xc0bb('0x16'),_0x2ac4a4,_0xc0bb('0x19'));_0x584c68(_0x2f8209['result']['message']);}})[_0xc0bb('0x1c')](function(_0xc0f7a){logger[_0xc0bb('0x1a')](_0xc0bb('0x16'),_0x2ac4a4,_0xc0f7a);_0x3e2843(_0xc0f7a);});});}exports[_0xc0bb('0x1d')]=function(_0x479718){var _0x46d366=this;return new Promise(function(_0x1700c9,_0x2605a9){return db[_0xc0bb('0x1e')][_0xc0bb('0x1f')](_0x479718[_0xc0bb('0x20')],{'raw':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x479718[_0xc0bb('0x21')]?_0x479718[_0xc0bb('0x21')][_0xc0bb('0x23')]||null:null,'attributes':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x24')]||null:null,'limit':_0x479718[_0xc0bb('0x21')]?_0x479718['options'][_0xc0bb('0x25')]||null:null})['then'](function(_0x124bd8){logger['info']('UpdateWhatsappInteraction',_0x479718);logger[_0xc0bb('0x17')]('UpdateWhatsappInteraction',_0x479718,JSON[_0xc0bb('0x26')](_0x124bd8));_0x1700c9(_0x124bd8);})[_0xc0bb('0x1c')](function(_0x8c3c39){logger[_0xc0bb('0x1a')](_0xc0bb('0x1d'),_0x8c3c39['message'],_0x479718);_0x2605a9(_0x46d366[_0xc0bb('0x1a')](0x1f4,_0x8c3c39['message']));});});};exports[_0xc0bb('0x27')]=function(_0x418896){return new Promise(function(_0xc4f376,_0x50c4be){return db['WhatsappInteraction'][_0xc0bb('0x28')]({'where':_0x418896['options']?_0x418896['options']['where']||null:null})['then'](function(_0x3dcf06){if(_0x3dcf06){return _0x3dcf06[_0xc0bb('0x29')](_0x418896[_0xc0bb('0x20')][_0xc0bb('0x2a')],_[_0xc0bb('0x2b')](_0x418896[_0xc0bb('0x20')],[_0xc0bb('0x2a'),'id'])||{});}})[_0xc0bb('0x2c')](function(_0x78fcba){logger[_0xc0bb('0x15')]('AddTags',_0x418896);logger[_0xc0bb('0x17')](_0xc0bb('0x2d'),_0x418896,JSON[_0xc0bb('0x26')](_0x78fcba));_0xc4f376(_0x78fcba);})['catch'](function(_0x4b1498){logger['error'](_0xc0bb('0x2d'),_0x4b1498[_0xc0bb('0x1b')],_0x418896);_0x50c4be(_this[_0xc0bb('0x1a')](0x1f4,_0x4b1498[_0xc0bb('0x1b')]));});});}; \ No newline at end of file +var _0xd677=['attributes','AddTagsToWhatsappInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where'];(function(_0x333683,_0x2e51dc){var _0x570c76=function(_0x2b51a2){while(--_0x2b51a2){_0x333683['push'](_0x333683['shift']());}};_0x570c76(++_0x2e51dc);}(_0xd677,0x9b));var _0x7d67=function(_0xc49b87,_0x9b1222){_0xc49b87=_0xc49b87-0x0;var _0x3c72c7=_0xd677[_0xc49b87];return _0x3c72c7;};'use strict';var _=require(_0x7d67('0x0'));var util=require(_0x7d67('0x1'));var moment=require(_0x7d67('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d67('0x3'));var logger=require(_0x7d67('0x4'))(_0x7d67('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7d67('0x6')][_0x7d67('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7d67('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d67('0x9'))(new Redis(config[_0x7d67('0x8')]));require(_0x7d67('0xa'))[_0x7d67('0xb')](socket);function respondWithRpcPromise(_0x275f89,_0x373263,_0x578ec3){return new BPromise(function(_0x3e30eb,_0x173c31){return client[_0x7d67('0xc')](_0x275f89,_0x578ec3)[_0x7d67('0xd')](function(_0x3c03ce){logger['info'](_0x7d67('0xe'),_0x373263,_0x7d67('0xf'));logger[_0x7d67('0x10')](_0x7d67('0x11'),_0x373263,'request\x20sent',JSON[_0x7d67('0x12')](_0x3c03ce));if(_0x3c03ce[_0x7d67('0x13')]){if(_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x14')]===0x1f4){logger[_0x7d67('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x373263,_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);return _0x173c31(_0x3c03ce[_0x7d67('0x13')]['message']);}logger[_0x7d67('0x13')](_0x7d67('0xe'),_0x373263,_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);return _0x3e30eb(_0x3c03ce[_0x7d67('0x13')][_0x7d67('0x15')]);}else{logger[_0x7d67('0x16')](_0x7d67('0xe'),_0x373263,_0x7d67('0xf'));_0x3e30eb(_0x3c03ce[_0x7d67('0x17')][_0x7d67('0x15')]);}})['catch'](function(_0x4d4606){logger[_0x7d67('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x373263,_0x4d4606);_0x173c31(_0x4d4606);});});}exports[_0x7d67('0x18')]=function(_0x587ac2){var _0x2fab09=this;return new Promise(function(_0x3ed15f,_0x54a8cf){return db[_0x7d67('0x19')][_0x7d67('0x1a')](_0x587ac2[_0x7d67('0x1b')],{'raw':_0x587ac2['options']?_0x587ac2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587ac2[_0x7d67('0x1c')]?_0x587ac2['options'][_0x7d67('0x1d')]||null:null,'attributes':_0x587ac2['options']?_0x587ac2[_0x7d67('0x1c')][_0x7d67('0x1e')]||null:null,'limit':_0x587ac2[_0x7d67('0x1c')]?_0x587ac2[_0x7d67('0x1c')]['limit']||null:null})['then'](function(_0x1bf766){logger[_0x7d67('0x16')](_0x7d67('0x18'),_0x587ac2);logger[_0x7d67('0x10')](_0x7d67('0x18'),_0x587ac2,JSON[_0x7d67('0x12')](_0x1bf766));_0x3ed15f(_0x1bf766);})['catch'](function(_0x463d0a){logger['error'](_0x7d67('0x18'),_0x463d0a[_0x7d67('0x15')],_0x587ac2);_0x54a8cf(_0x2fab09[_0x7d67('0x13')](0x1f4,_0x463d0a['message']));});});};exports[_0x7d67('0x1f')]=function(_0x127f4e){return new Promise(function(_0x2e2ea9,_0x19abca){return db[_0x7d67('0x19')][_0x7d67('0x20')]({'where':_0x127f4e[_0x7d67('0x1c')]?_0x127f4e['options']['where']||null:null})[_0x7d67('0xd')](function(_0x1d0795){if(_0x1d0795){return _0x1d0795[_0x7d67('0x21')](_0x127f4e['body']['ids'],_[_0x7d67('0x22')](_0x127f4e['body'],[_0x7d67('0x23'),'id'])||{});}})['spread'](function(_0x8cb99a){logger[_0x7d67('0x16')](_0x7d67('0x24'),_0x127f4e);logger[_0x7d67('0x10')](_0x7d67('0x24'),_0x127f4e,JSON['stringify'](_0x8cb99a));_0x2e2ea9(_0x8cb99a);})['catch'](function(_0xddad8d){logger['error'](_0x7d67('0x24'),_0xddad8d[_0x7d67('0x15')],_0x127f4e);_0x19abca(_this[_0x7d67('0x13')](0x1f4,_0xddad8d[_0x7d67('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2ab3b76..d4740a3 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 _0x8472=['whatsappInteraction:','./whatsappInteraction.events','removeListener','length'];(function(_0x2b04eb,_0x496171){var _0x1ec29b=function(_0x54480f){while(--_0x54480f){_0x2b04eb['push'](_0x2b04eb['shift']());}};_0x1ec29b(++_0x496171);}(_0x8472,0xf5));var _0x2847=function(_0x200fda,_0x4ae957){_0x200fda=_0x200fda-0x0;var _0x56a31c=_0x8472[_0x200fda];return _0x56a31c;};'use strict';var WhatsappInteractionEvents=require(_0x2847('0x0'));var events=['save','remove','update'];function createListener(_0xb34b78,_0x37231c){return function(_0x265857){_0x37231c['emit'](_0xb34b78,_0x265857);};}function removeListener(_0x2820ac,_0x2da171){return function(){WhatsappInteractionEvents[_0x2847('0x1')](_0x2820ac,_0x2da171);};}exports['register']=function(_0x2f4477){for(var _0xef5db1=0x0,_0x1d91bd=events[_0x2847('0x2')];_0xef5db1<_0x1d91bd;_0xef5db1++){var _0x21d21c=events[_0xef5db1];var _0x51c7a9=createListener(_0x2847('0x3')+_0x21d21c,_0x2f4477);WhatsappInteractionEvents['on'](_0x21d21c,_0x51c7a9);}}; \ No newline at end of file +var _0x1f59=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x246e98,_0x2fbb91){var _0x53721b=function(_0xa61a2d){while(--_0xa61a2d){_0x246e98['push'](_0x246e98['shift']());}};_0x53721b(++_0x2fbb91);}(_0x1f59,0x184));var _0x91f5=function(_0xbc38cd,_0x5c87d3){_0xbc38cd=_0xbc38cd-0x0;var _0x3f031f=_0x1f59[_0xbc38cd];return _0x3f031f;};'use strict';var WhatsappInteractionEvents=require(_0x91f5('0x0'));var events=[_0x91f5('0x1'),_0x91f5('0x2'),_0x91f5('0x3')];function createListener(_0x21f64c,_0xcfe8d2){return function(_0x482b38){_0xcfe8d2[_0x91f5('0x4')](_0x21f64c,_0x482b38);};}function removeListener(_0xdb2fe0,_0x141b6c){return function(){WhatsappInteractionEvents[_0x91f5('0x5')](_0xdb2fe0,_0x141b6c);};}exports[_0x91f5('0x6')]=function(_0x4b2fd0){for(var _0x140c3f=0x0,_0x39ebd3=events['length'];_0x140c3f<_0x39ebd3;_0x140c3f++){var _0x7cb509=events[_0x140c3f];var _0x135745=createListener(_0x91f5('0x7')+_0x7cb509,_0x4b2fd0);WhatsappInteractionEvents['on'](_0x7cb509,_0x135745);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index cba49e7..15cc3d5 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 _0x484c=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1429a1,_0x5f1de2){var _0xa8f57a=function(_0x10ecff){while(--_0x10ecff){_0x1429a1['push'](_0x1429a1['shift']());}};_0xa8f57a(++_0x5f1de2);}(_0x484c,0x9d));var _0xc484=function(_0x1f0342,_0x5b8367){_0x1f0342=_0x1f0342-0x0;var _0x94f2ec=_0x484c[_0x1f0342];return _0x94f2ec;};'use strict';var multer=require(_0xc484('0x0'));var util=require(_0xc484('0x1'));var path=require(_0xc484('0x2'));var timeout=require(_0xc484('0x3'));var express=require(_0xc484('0x4'));var router=express[_0xc484('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc484('0x6'));var interaction=require(_0xc484('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xc484('0x8')]('/',auth[_0xc484('0x9')](),controller[_0xc484('0xa')]);router[_0xc484('0x8')](_0xc484('0xb'),auth[_0xc484('0x9')](),controller[_0xc484('0xc')]);router['get'](_0xc484('0xd'),auth[_0xc484('0x9')](),controller[_0xc484('0xe')]);router[_0xc484('0xf')]('/',auth[_0xc484('0x9')](),interaction['tracked']('whatsapp',_0xc484('0x10')),controller[_0xc484('0x11')]);router[_0xc484('0xf')](_0xc484('0x12'),controller['status']);router[_0xc484('0x13')](_0xc484('0xd'),auth[_0xc484('0x9')](),controller[_0xc484('0x14')]);router[_0xc484('0x13')](_0xc484('0x15'),auth[_0xc484('0x9')](),controller['accept']);router[_0xc484('0x13')](_0xc484('0x16'),auth[_0xc484('0x9')](),controller[_0xc484('0x17')]);router[_0xc484('0x18')](_0xc484('0xd'),auth[_0xc484('0x9')](),controller[_0xc484('0x19')]);module[_0xc484('0x1a')]=router; \ No newline at end of file +var _0xc60f=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put'];(function(_0x26af68,_0x4537b1){var _0x52c348=function(_0xf5fde2){while(--_0xf5fde2){_0x26af68['push'](_0x26af68['shift']());}};_0x52c348(++_0x4537b1);}(_0xc60f,0xfb));var _0xfc60=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0xc60f[_0x1b00f1];return _0x5c3dad;};'use strict';var multer=require(_0xfc60('0x0'));var util=require(_0xfc60('0x1'));var path=require(_0xfc60('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfc60('0x3'));var interaction=require(_0xfc60('0x4'));var config=require('../../config/environment');var controller=require(_0xfc60('0x5'));router[_0xfc60('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xfc60('0x7')](),controller[_0xfc60('0x8')]);router[_0xfc60('0x6')](_0xfc60('0x9'),auth[_0xfc60('0x7')](),controller[_0xfc60('0xa')]);router[_0xfc60('0xb')]('/',auth[_0xfc60('0x7')](),interaction[_0xfc60('0xc')](_0xfc60('0xd'),_0xfc60('0xe')),controller[_0xfc60('0xf')]);router['post'](_0xfc60('0x10'),controller[_0xfc60('0x11')]);router[_0xfc60('0x12')](_0xfc60('0x9'),auth['isAuthenticated'](),controller[_0xfc60('0x13')]);router[_0xfc60('0x12')](_0xfc60('0x14'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x15')]);router[_0xfc60('0x12')](_0xfc60('0x16'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x17')]);router[_0xfc60('0x18')](_0xfc60('0x9'),auth[_0xfc60('0x7')](),controller[_0xfc60('0x19')]);module[_0xfc60('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8bbae81..f17cdc9 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 _0x23a1=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x1063f0,_0x53980d){var _0x4698ce=function(_0x21d966){while(--_0x21d966){_0x1063f0['push'](_0x1063f0['shift']());}};_0x4698ce(++_0x53980d);}(_0x23a1,0x19c));var _0x123a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x23a1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x123a('0x0'));module[_0x123a('0x1')]={'body':{'type':Sequelize[_0x123a('0x2')](_0x123a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x123a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x123a('0x5')),'defaultValue':_0x123a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x123a('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x123a('0x7')]},'providerResponse':{'type':Sequelize[_0x123a('0x2')]}}; \ No newline at end of file +var _0xf52f=['out','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4d4497,_0x344597){var _0x442b0b=function(_0x6ecd33){while(--_0x6ecd33){_0x4d4497['push'](_0x4d4497['shift']());}};_0x442b0b(++_0x344597);}(_0xf52f,0x113));var _0xff52=function(_0x228636,_0x51d570){_0x228636=_0x228636-0x0;var _0x327b9e=_0xf52f[_0x228636];return _0x327b9e;};'use strict';var Sequelize=require(_0xff52('0x0'));module[_0xff52('0x1')]={'body':{'type':Sequelize[_0xff52('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xff52('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xff52('0x4')]('in',_0xff52('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xff52('0x6')](0xbe)},'phone':{'type':Sequelize[_0xff52('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xff52('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xff52('0x6')]},'providerResponse':{'type':Sequelize[_0xff52('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5f0b476..d83830b 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 _0xf818=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','get','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','fullname','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','findAll','show','keys','include','find','create','body','params','describe','accept','whatsapp','readAt'];(function(_0x25e7da,_0x20e853){var _0x310d03=function(_0x575faa){while(--_0x575faa){_0x25e7da['push'](_0x25e7da['shift']());}};_0x310d03(++_0x20e853);}(_0xf818,0x1e7));var _0x8f81=function(_0x571576,_0x50e525){_0x571576=_0x571576-0x0;var _0x15cd1c=_0xf818[_0x571576];return _0x15cd1c;};'use strict';var emlformat=require(_0x8f81('0x0'));var rimraf=require(_0x8f81('0x1'));var zipdir=require(_0x8f81('0x2'));var jsonpatch=require(_0x8f81('0x3'));var rp=require('request-promise');var moment=require(_0x8f81('0x4'));var BPromise=require(_0x8f81('0x5'));var Mustache=require(_0x8f81('0x6'));var util=require(_0x8f81('0x7'));var path=require(_0x8f81('0x8'));var sox=require('sox');var csv=require(_0x8f81('0x9'));var ejs=require(_0x8f81('0xa'));var fs=require('fs');var fs_extra=require(_0x8f81('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f81('0xc'));var jsforce=require(_0x8f81('0xd'));var deskjs=require(_0x8f81('0xe'));var toCsv=require(_0x8f81('0x9'));var querystring=require(_0x8f81('0xf'));var Papa=require(_0x8f81('0x10'));var Redis=require(_0x8f81('0x11'));var authService=require(_0x8f81('0x12'));var qs=require(_0x8f81('0x13'));var as=require(_0x8f81('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f81('0x15'))(_0x8f81('0x16'));var utils=require(_0x8f81('0x17'));var config=require(_0x8f81('0x18'));var licenseUtil=require(_0x8f81('0x19'));var db=require(_0x8f81('0x1a'))['db'];config['redis']=_[_0x8f81('0x1b')](config[_0x8f81('0x1c')],{'host':_0x8f81('0x1d'),'port':0x18eb});var socket=require(_0x8f81('0x1e'))(new Redis(config[_0x8f81('0x1c')]));require(_0x8f81('0x1f'))[_0x8f81('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8f81('0x21')][_0x8f81('0x22')]({'port':0x232c});var client9002=jayson[_0x8f81('0x21')][_0x8f81('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x244fc3,_0x366bcf,_0x95eb68,_0x5f835a){return new BPromise(function(_0x438c2b,_0x5f4013){var _0x349727=_0x5f835a||client;return _0x349727[_0x8f81('0x23')](_0x244fc3,_0x95eb68)['then'](function(_0xf513be){logger[_0x8f81('0x24')](_0x8f81('0x25'),_0x366bcf,_0x8f81('0x26'));logger[_0x8f81('0x27')](_0x8f81('0x28'),_0x366bcf,_0x8f81('0x26'),JSON[_0x8f81('0x29')](_0xf513be));if(_0xf513be[_0x8f81('0x2a')]){if(_0xf513be[_0x8f81('0x2a')]['code']===0x1f4){logger[_0x8f81('0x2a')](_0x8f81('0x25'),_0x366bcf,_0xf513be[_0x8f81('0x2a')]['message']);return _0x5f4013(_0xf513be[_0x8f81('0x2a')][_0x8f81('0x2b')]);}logger[_0x8f81('0x2a')](_0x8f81('0x25'),_0x366bcf,_0xf513be[_0x8f81('0x2a')]['message']);return _0x438c2b(_0xf513be[_0x8f81('0x2a')][_0x8f81('0x2b')]);}else{logger['info'](_0x8f81('0x25'),_0x366bcf,'request\x20sent');_0x438c2b(_0xf513be[_0x8f81('0x2c')]['message']);}})[_0x8f81('0x2d')](function(_0x4c7b46){logger['error'](_0x8f81('0x25'),_0x366bcf,_0x4c7b46);_0x5f4013(_0x4c7b46);});});}function respondWithStatusCode(_0xfb5100,_0x4dd29e){_0x4dd29e=_0x4dd29e||0xcc;return function(_0x3b3e9a){if(_0x3b3e9a){return _0xfb5100[_0x8f81('0x2e')](_0x4dd29e);}return _0xfb5100[_0x8f81('0x2f')](_0x4dd29e)[_0x8f81('0x30')]();};}function respondWithResult(_0x24c143,_0x541fcf){_0x541fcf=_0x541fcf||0xc8;return function(_0x25e6e1){if(_0x25e6e1){return _0x24c143[_0x8f81('0x2f')](_0x541fcf)[_0x8f81('0x31')](_0x25e6e1);}};}function respondWithFilteredResult(_0x1c98e8,_0x2c6db4){return function(_0x128949){if(_0x128949){var _0x1a726e=typeof _0x2c6db4[_0x8f81('0x32')]==='undefined'&&typeof _0x2c6db4[_0x8f81('0x33')]===_0x8f81('0x34');var _0x4dac2d=_0x128949[_0x8f81('0x35')];var _0x594ad4=_0x1a726e?0x0:_0x2c6db4['offset'];var _0x9ee475=_0x1a726e?_0x128949['count']:_0x2c6db4[_0x8f81('0x32')]+_0x2c6db4['limit'];var _0x2709ef;if(_0x9ee475>=_0x4dac2d){_0x9ee475=_0x4dac2d;_0x2709ef=0xc8;}else{_0x2709ef=0xce;}_0x1c98e8[_0x8f81('0x2f')](_0x2709ef);return _0x1c98e8[_0x8f81('0x36')](_0x8f81('0x37'),_0x594ad4+'-'+_0x9ee475+'/'+_0x4dac2d)[_0x8f81('0x31')](_0x128949);}return null;};}function patchUpdates(_0x564f47){return function(_0x160f45){try{jsonpatch[_0x8f81('0x38')](_0x160f45,_0x564f47,!![]);}catch(_0x43d1ef){return BPromise[_0x8f81('0x39')](_0x43d1ef);}return _0x160f45[_0x8f81('0x3a')]();};}function saveUpdates(_0x3af962,_0x587d38){return function(_0x5c0c66){if(_0x5c0c66){return _0x5c0c66['update'](_0x3af962)[_0x8f81('0x3b')](function(_0x569b7d){return _0x569b7d;});}return null;};}function removeEntity(_0x4cfb87,_0x3a6c97){return function(_0x3971b8){if(_0x3971b8){return _0x3971b8[_0x8f81('0x3c')]()[_0x8f81('0x3b')](function(){_0x4cfb87[_0x8f81('0x2f')](0xcc)[_0x8f81('0x30')]();});}};}function handleEntityNotFound(_0x1e1c4d,_0x1f9b1d){return function(_0x34a8a8){if(!_0x34a8a8){_0x1e1c4d[_0x8f81('0x2e')](0x194);}return _0x34a8a8;};}function handleError(_0x4117db,_0x58cfff){_0x58cfff=_0x58cfff||0x1f4;return function(_0x35a0b8){logger['error'](_0x35a0b8['stack']);if(_0x35a0b8[_0x8f81('0x3d')]){delete _0x35a0b8['name'];}_0x4117db[_0x8f81('0x2f')](_0x58cfff)[_0x8f81('0x3e')](_0x35a0b8);};}exports[_0x8f81('0x3f')]=function(_0xa465a,_0x69bf41){var _0x429571={},_0x15e636={},_0x41db47={'count':0x0,'rows':[]};var _0x4c12a7=_[_0x8f81('0x40')](db[_0x8f81('0x41')][_0x8f81('0x42')],function(_0x532634){return{'name':_0x532634[_0x8f81('0x43')],'type':_0x532634['type'][_0x8f81('0x44')]};});_0x15e636[_0x8f81('0x45')]=_['map'](_0x4c12a7,'name');_0x15e636[_0x8f81('0x46')]=_['keys'](_0xa465a[_0x8f81('0x46')]);_0x15e636[_0x8f81('0x47')]=_['intersection'](_0x15e636[_0x8f81('0x45')],_0x15e636[_0x8f81('0x46')]);_0x429571[_0x8f81('0x48')]=_[_0x8f81('0x49')](_0x15e636[_0x8f81('0x45')],qs[_0x8f81('0x4a')](_0xa465a[_0x8f81('0x46')][_0x8f81('0x4a')]));_0x429571['attributes']=_0x429571[_0x8f81('0x48')]['length']?_0x429571[_0x8f81('0x48')]:_0x15e636[_0x8f81('0x45')];if(!_0xa465a[_0x8f81('0x46')][_0x8f81('0x4b')](_0x8f81('0x4c'))){_0x429571[_0x8f81('0x33')]=qs[_0x8f81('0x33')](_0xa465a[_0x8f81('0x46')]['limit']);_0x429571[_0x8f81('0x32')]=qs[_0x8f81('0x32')](_0xa465a[_0x8f81('0x46')]['offset']);}_0x429571[_0x8f81('0x4d')]=qs[_0x8f81('0x4e')](_0xa465a[_0x8f81('0x46')][_0x8f81('0x4e')]);_0x429571[_0x8f81('0x4f')]=qs['filters'](_['pick'](_0xa465a['query'],_0x15e636[_0x8f81('0x47')]),_0x4c12a7);if(_0xa465a['query'][_0x8f81('0x50')]){_0x429571[_0x8f81('0x4f')]=_[_0x8f81('0x51')](_0x429571['where'],{'$or':_[_0x8f81('0x40')](_0x4c12a7,function(_0x4747fa){if(_0x4747fa[_0x8f81('0x52')]!=='VIRTUAL'){var _0x404ba1={};_0x404ba1[_0x4747fa[_0x8f81('0x3d')]]={'$like':'%'+_0xa465a['query'][_0x8f81('0x50')]+'%'};return _0x404ba1;}})});}_0x429571=_['merge']({},_0x429571,_0xa465a[_0x8f81('0x53')]);var _0x38184c={'where':_0x429571[_0x8f81('0x4f')]};return db['WhatsappMessage'][_0x8f81('0x35')](_0x38184c)[_0x8f81('0x3b')](function(_0x12219b){_0x41db47[_0x8f81('0x35')]=_0x12219b;if(_0xa465a[_0x8f81('0x46')][_0x8f81('0x54')]){_0x429571['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x8f81('0x55')](_0x429571);})[_0x8f81('0x3b')](function(_0x3b38cb){_0x41db47['rows']=_0x3b38cb;return _0x41db47;})[_0x8f81('0x3b')](respondWithFilteredResult(_0x69bf41,_0x429571))[_0x8f81('0x2d')](handleError(_0x69bf41,null));};exports[_0x8f81('0x56')]=function(_0x58a669,_0x317f8c){var _0x422744={'raw':!![],'where':{'id':_0x58a669['params']['id']}},_0xe3f1a0={};_0xe3f1a0[_0x8f81('0x45')]=_[_0x8f81('0x57')](db[_0x8f81('0x41')][_0x8f81('0x42')]);_0xe3f1a0[_0x8f81('0x46')]=_[_0x8f81('0x57')](_0x58a669['query']);_0xe3f1a0['filters']=_[_0x8f81('0x49')](_0xe3f1a0['model'],_0xe3f1a0[_0x8f81('0x46')]);_0x422744[_0x8f81('0x48')]=_[_0x8f81('0x49')](_0xe3f1a0[_0x8f81('0x45')],qs[_0x8f81('0x4a')](_0x58a669[_0x8f81('0x46')][_0x8f81('0x4a')]));_0x422744['attributes']=_0x422744[_0x8f81('0x48')]['length']?_0x422744[_0x8f81('0x48')]:_0xe3f1a0['model'];if(_0x58a669[_0x8f81('0x46')][_0x8f81('0x54')]){_0x422744[_0x8f81('0x58')]=[{'all':!![]}];}_0x422744=_[_0x8f81('0x51')]({},_0x422744,_0x58a669[_0x8f81('0x53')]);return db[_0x8f81('0x41')][_0x8f81('0x59')](_0x422744)[_0x8f81('0x3b')](handleEntityNotFound(_0x317f8c,null))[_0x8f81('0x3b')](respondWithResult(_0x317f8c,null))[_0x8f81('0x2d')](handleError(_0x317f8c,null));};exports[_0x8f81('0x5a')]=function(_0xfa1424,_0x4fec65){return db['WhatsappMessage'][_0x8f81('0x5a')](_0xfa1424['body'],{})[_0x8f81('0x3b')](respondWithResult(_0x4fec65,0xc9))[_0x8f81('0x2d')](handleError(_0x4fec65,null));};exports['update']=function(_0x55b564,_0x4f87cf){if(_0x55b564['body']['id']){delete _0x55b564[_0x8f81('0x5b')]['id'];}return db[_0x8f81('0x41')][_0x8f81('0x59')]({'where':{'id':_0x55b564['params']['id']}})[_0x8f81('0x3b')](handleEntityNotFound(_0x4f87cf,null))[_0x8f81('0x3b')](saveUpdates(_0x55b564[_0x8f81('0x5b')],null))[_0x8f81('0x3b')](respondWithResult(_0x4f87cf,null))[_0x8f81('0x2d')](handleError(_0x4f87cf,null));};exports[_0x8f81('0x3c')]=function(_0x1a6528,_0x23511a){return db[_0x8f81('0x41')][_0x8f81('0x59')]({'where':{'id':_0x1a6528[_0x8f81('0x5c')]['id']}})[_0x8f81('0x3b')](handleEntityNotFound(_0x23511a,null))[_0x8f81('0x3b')](removeEntity(_0x23511a,null))['catch'](handleError(_0x23511a,null));};exports[_0x8f81('0x5d')]=function(_0x5ea8b7,_0x139f6d){return db[_0x8f81('0x41')][_0x8f81('0x5d')]()[_0x8f81('0x3b')](respondWithResult(_0x139f6d,null))['catch'](handleError(_0x139f6d,null));};var interaction_log=require(_0x8f81('0x15'))('whatsapp-interactions');exports[_0x8f81('0x5e')]=function(_0x7f70bb,_0x240912,_0x201345){var _0x40747e={'agent':{},'channel':_0x8f81('0x5f')};if(_0x7f70bb[_0x8f81('0x5b')]['id']){delete _0x7f70bb[_0x8f81('0x5b')]['id'];}_0x7f70bb['body']['read']=!![];_0x7f70bb['body'][_0x8f81('0x60')]=moment()[_0x8f81('0x61')](_0x8f81('0x62'));_0x7f70bb[_0x8f81('0x5b')][_0x8f81('0x63')]=_0x7f70bb[_0x8f81('0x5b')]['UserId']||_0x7f70bb[_0x8f81('0x64')]['id'];_0x40747e[_0x8f81('0x65')]['id']=_0x7f70bb[_0x8f81('0x5b')][_0x8f81('0x63')];return db['WhatsappMessage'][_0x8f81('0x59')]({'where':{'id':_0x7f70bb[_0x8f81('0x5c')]['id'],'UserId':null}})[_0x8f81('0x3b')](handleEntityNotFound(_0x240912,null))[_0x8f81('0x3b')](saveUpdates(_0x7f70bb[_0x8f81('0x5b')],null))['then'](function(_0x344b92){if(_0x344b92){_0x40747e[_0x8f81('0x2b')]=_0x344b92['get']({'plain':!![]});return db[_0x8f81('0x66')]['find']({'where':{'id':_0x344b92[_0x8f81('0x67')]}});}return null;})[_0x8f81('0x3b')](handleEntityNotFound(_0x240912,null))[_0x8f81('0x3b')](function(_0x3b8a00){if(_0x3b8a00){return _0x3b8a00[_0x8f81('0x68')]({'UserId':_0x7f70bb['body'][_0x8f81('0x63')],'read1stAt':_[_0x8f81('0x69')](_0x3b8a00[_0x8f81('0x6a')])?moment()[_0x8f81('0x61')](_0x8f81('0x62')):undefined});}return null;})[_0x8f81('0x3b')](function(_0x1df3bc){if(_0x1df3bc){_0x40747e[_0x8f81('0x6b')]=_0x1df3bc['get']({'plain':!![]});interaction_log['info'](_0x8f81('0x6c'),_0x7f70bb[_0x8f81('0x64')]['id'],_0x7f70bb[_0x8f81('0x64')][_0x8f81('0x3d')],_0x7f70bb[_0x8f81('0x64')][_0x8f81('0x6d')],_0x40747e['interaction']['id'],_0x7f70bb[_0x8f81('0x5b')]?JSON[_0x8f81('0x29')](_0x7f70bb['body']):_0x8f81('0x6e'));return respondWithRpcPromise(_0x8f81('0x6f'),_0x8f81('0x70'),_0x40747e);}return null;})['then'](function(_0x2ca5ee){var _0xc99eb0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ca5ee[_0x8f81('0x2b')][_0x8f81('0x71')];return db['sequelize']['query'](_0xc99eb0,{'type':db['Sequelize'][_0x8f81('0x72')][_0x8f81('0x73')],'raw':!![]})[_0x8f81('0x3b')](function(_0x148f9d){return _0x148f9d;});})['then'](function(_0x114acf){if(_0x114acf){_0x40747e['message']['contact']=_0x114acf[0x0];if(!_0x7f70bb['body'][_0x8f81('0x63')])return;return db[_0x8f81('0x74')]['find']({'where':{'id':_0x7f70bb[_0x8f81('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0x8f81('0x3d'),'fullname',_0x8f81('0x75'),_0x8f81('0x76')],'raw':!![]});}return null;})[_0x8f81('0x3b')](function(_0x2e38b7){if(!_0x2e38b7)return null;_0x40747e[_0x8f81('0x2b')]['agent']=_0x2e38b7;return _0x40747e;})[_0x8f81('0x3b')](function(_0x1d4eea){if(_0x1d4eea){if(_0x7f70bb[_0x8f81('0x5b')]['manual']){_0x40747e[_0x8f81('0x2b')][_0x8f81('0x77')]=util['format'](_0x8f81('0x78'),_0x7f70bb[_0x8f81('0x64')][_0x8f81('0x3d')]);_0x40747e['message'][_0x8f81('0x79')]=_0x40747e[_0x8f81('0x79')];_0x40747e[_0x8f81('0x2b')][_0x8f81('0x7a')]=_0x40747e[_0x8f81('0x79')];_0x40747e[_0x8f81('0x2b')][_0x8f81('0x7b')]='accept';return respondWithRpcPromise(_0x8f81('0x7c'),_0x8f81('0x7c'),{'event':_0x8f81('0x7d'),'message':_0x40747e['message']},client9002)[_0x8f81('0x3b')](function(){return _0x40747e;});}return _0x40747e;}return null;})[_0x8f81('0x3b')](respondWithResult(_0x240912,null))[_0x8f81('0x2d')](handleError(_0x240912,null));};var interaction_log=require(_0x8f81('0x15'))(_0x8f81('0x7e'));exports['reject']=function(_0x168f47,_0x59df90,_0x43a537){var _0x3258a2={'agent':{},'channel':'whatsapp'};if(_0x168f47[_0x8f81('0x5b')]['id']){delete _0x168f47['body']['id'];}_0x168f47[_0x8f81('0x5b')]['UserId']=_0x168f47['body'][_0x8f81('0x63')]||_0x168f47[_0x8f81('0x64')]['id'];_0x3258a2[_0x8f81('0x65')]['id']=_0x168f47[_0x8f81('0x5b')][_0x8f81('0x63')];return db[_0x8f81('0x41')]['find']({'where':{'id':_0x168f47[_0x8f81('0x5c')]['id'],'UserId':null}})[_0x8f81('0x3b')](handleEntityNotFound(_0x59df90,null))['then'](function(_0x452a85){if(_0x452a85){_0x3258a2[_0x8f81('0x2b')]=_0x452a85[_0x8f81('0x7f')]({'plain':!![]});return db[_0x8f81('0x66')][_0x8f81('0x59')]({'where':{'id':_0x452a85['WhatsappInteractionId']}});}return null;})[_0x8f81('0x3b')](handleEntityNotFound(_0x59df90,null))[_0x8f81('0x3b')](function(_0x14951e){if(_0x14951e){_0x3258a2[_0x8f81('0x6b')]=_0x14951e[_0x8f81('0x7f')]({'plain':!![]});interaction_log[_0x8f81('0x24')](_0x8f81('0x80'),_0x168f47[_0x8f81('0x64')]['id'],_0x168f47[_0x8f81('0x64')][_0x8f81('0x3d')],_0x168f47[_0x8f81('0x64')][_0x8f81('0x6d')],_0x3258a2[_0x8f81('0x6b')]['id'],_0x168f47[_0x8f81('0x5b')]?JSON[_0x8f81('0x29')](_0x168f47[_0x8f81('0x5b')]):'null');return respondWithRpcPromise(_0x8f81('0x81'),_0x8f81('0x82'),_0x3258a2);}return null;})[_0x8f81('0x3b')](function(_0x1bd5bf){var _0x183f81=_0x8f81('0x83')+_0x1bd5bf[_0x8f81('0x2b')][_0x8f81('0x71')];return db[_0x8f81('0x84')][_0x8f81('0x46')](_0x183f81,{'type':db[_0x8f81('0x85')][_0x8f81('0x72')][_0x8f81('0x73')],'raw':!![]})[_0x8f81('0x3b')](function(_0x1d52d3){return _0x1d52d3;});})[_0x8f81('0x3b')](function(_0x1cf8f5){if(_0x1cf8f5){_0x3258a2['message'][_0x8f81('0x86')]=_0x1cf8f5[0x0];if(!_0x168f47[_0x8f81('0x5b')][_0x8f81('0x63')])return;return db['User'][_0x8f81('0x59')]({'where':{'id':_0x168f47['body'][_0x8f81('0x63')],'role':_0x8f81('0x65')},'attributes':['id',_0x8f81('0x3d'),_0x8f81('0x87'),_0x8f81('0x75'),_0x8f81('0x76')],'raw':!![]});}return null;})[_0x8f81('0x3b')](function(_0x7720d7){if(!_0x7720d7)return null;_0x3258a2[_0x8f81('0x2b')][_0x8f81('0x65')]=_0x7720d7;return _0x3258a2;})[_0x8f81('0x3b')](function(_0x593ce6){if(_0x593ce6){_0x593ce6[_0x8f81('0x2b')][_0x8f81('0x77')]=util[_0x8f81('0x61')](_0x8f81('0x78'),_0x168f47[_0x8f81('0x64')]['name']);_0x593ce6['message'][_0x8f81('0x79')]=_0x3258a2[_0x8f81('0x79')];_0x593ce6[_0x8f81('0x2b')][_0x8f81('0x7a')]=_0x3258a2[_0x8f81('0x79')];_0x593ce6[_0x8f81('0x2b')][_0x8f81('0x7b')]=_0x8f81('0x39');respondWithRpcPromise(_0x8f81('0x7c'),_0x8f81('0x7c'),{'event':'rejectmessage','message':_0x593ce6['message']},client9002);return _0x3258a2;}return null;})[_0x8f81('0x3b')](respondWithResult(_0x59df90,null))[_0x8f81('0x2d')](handleError(_0x59df90,null));};exports[_0x8f81('0x2f')]=function(_0x1d652e,_0x11c5fd,_0x1f404d){if(_0x1d652e[_0x8f81('0x5b')]['id']){delete _0x1d652e[_0x8f81('0x5b')]['id'];}var _0x17cc7a;return db['WhatsappMessage'][_0x8f81('0x59')]({'where':{'id':_0x1d652e[_0x8f81('0x5c')]['id']}})['then'](handleEntityNotFound(_0x11c5fd,null))[_0x8f81('0x3b')](function(_0x3c2100){if(_0x3c2100){_0x17cc7a=_0x3c2100;return db[_0x8f81('0x88')][_0x8f81('0x59')]({'where':{'id':_0x3c2100[_0x8f81('0x89')]}});}})[_0x8f81('0x3b')](handleEntityNotFound(_0x11c5fd,null))[_0x8f81('0x3b')](function(_0x579b45){if(_0x579b45){logger['debug'](_0x8f81('0x8a'),_0x8f81('0x2f'),_0x8f81('0x8b'),_0x579b45['type'],util[_0x8f81('0x8c')](_0x1d652e[_0x8f81('0x5b')],{'showHidden':![],'depth':null}));switch(_0x579b45[_0x8f81('0x52')]){case _0x8f81('0x8d'):if(_0x1d652e['body'][_0x8f81('0x8e')]&&_0x1d652e['body'][_0x8f81('0x8e')]===_0x17cc7a[_0x8f81('0x8f')]&&_0x1d652e[_0x8f81('0x5b')][_0x8f81('0x90')]&&_0x1d652e[_0x8f81('0x5b')]['MessageStatus']==='read'){return _0x17cc7a['update']({'read':!![]});}else{logger['error'](_0x8f81('0x91'),_0x8f81('0x2f'),'twilio',util[_0x8f81('0x8c')](_0x1d652e[_0x8f81('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x17cc7a;}})[_0x8f81('0x3b')](respondWithResult(_0x11c5fd,null))[_0x8f81('0x2d')](handleError(_0x11c5fd,null));}; \ No newline at end of file +var _0x9aa4=['VIRTUAL','options','include','findAll','show','params','intersection','find','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','whatsapp-interactions','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','internal','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','WhatsappMessage','rawAttributes','fieldName','map','query','keys','filters','fields','attributes','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge'];(function(_0x15bb39,_0x42bd41){var _0x88fadc=function(_0x177f6c){while(--_0x177f6c){_0x15bb39['push'](_0x15bb39['shift']());}};_0x88fadc(++_0x42bd41);}(_0x9aa4,0xce));var _0x49aa=function(_0x2dcc30,_0x427855){_0x2dcc30=_0x2dcc30-0x0;var _0xc9aa6c=_0x9aa4[_0x2dcc30];return _0xc9aa6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49aa('0x0'));var zipdir=require(_0x49aa('0x1'));var jsonpatch=require(_0x49aa('0x2'));var rp=require('request-promise');var moment=require(_0x49aa('0x3'));var BPromise=require(_0x49aa('0x4'));var Mustache=require(_0x49aa('0x5'));var util=require(_0x49aa('0x6'));var path=require(_0x49aa('0x7'));var sox=require(_0x49aa('0x8'));var csv=require(_0x49aa('0x9'));var ejs=require(_0x49aa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49aa('0xb'));var squel=require(_0x49aa('0xc'));var crypto=require(_0x49aa('0xd'));var jsforce=require(_0x49aa('0xe'));var deskjs=require(_0x49aa('0xf'));var toCsv=require(_0x49aa('0x9'));var querystring=require(_0x49aa('0x10'));var Papa=require(_0x49aa('0x11'));var Redis=require(_0x49aa('0x12'));var authService=require(_0x49aa('0x13'));var qs=require(_0x49aa('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49aa('0x15'))('api');var utils=require(_0x49aa('0x16'));var config=require(_0x49aa('0x17'));var licenseUtil=require(_0x49aa('0x18'));var db=require(_0x49aa('0x19'))['db'];config['redis']=_['defaults'](config[_0x49aa('0x1a')],{'host':_0x49aa('0x1b'),'port':0x18eb});var socket=require(_0x49aa('0x1c'))(new Redis(config[_0x49aa('0x1a')]));require(_0x49aa('0x1d'))[_0x49aa('0x1e')](socket);var jayson=require(_0x49aa('0x1f'));var client=jayson[_0x49aa('0x20')][_0x49aa('0x21')]({'port':0x232c});var client9002=jayson[_0x49aa('0x20')][_0x49aa('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x47298e,_0x4e0c34,_0x54e548,_0x3d322f){return new BPromise(function(_0x238ef3,_0x3e7d11){var _0x2ea354=_0x3d322f||client;return _0x2ea354['request'](_0x47298e,_0x54e548)['then'](function(_0xdc9d88){logger[_0x49aa('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0x49aa('0x23'));logger[_0x49aa('0x24')](_0x49aa('0x25'),_0x4e0c34,_0x49aa('0x23'),JSON['stringify'](_0xdc9d88));if(_0xdc9d88[_0x49aa('0x26')]){if(_0xdc9d88['error'][_0x49aa('0x27')]===0x1f4){logger[_0x49aa('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0xdc9d88['error']['message']);return _0x3e7d11(_0xdc9d88[_0x49aa('0x26')][_0x49aa('0x28')]);}logger[_0x49aa('0x26')](_0x49aa('0x29'),_0x4e0c34,_0xdc9d88[_0x49aa('0x26')]['message']);return _0x238ef3(_0xdc9d88[_0x49aa('0x26')][_0x49aa('0x28')]);}else{logger[_0x49aa('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,'request\x20sent');_0x238ef3(_0xdc9d88[_0x49aa('0x2a')]['message']);}})[_0x49aa('0x2b')](function(_0x3f4016){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4e0c34,_0x3f4016);_0x3e7d11(_0x3f4016);});});}function respondWithStatusCode(_0x373a2b,_0x24b092){_0x24b092=_0x24b092||0xcc;return function(_0x285b9e){if(_0x285b9e){return _0x373a2b['sendStatus'](_0x24b092);}return _0x373a2b['status'](_0x24b092)[_0x49aa('0x2c')]();};}function respondWithResult(_0x409839,_0x9c3fc4){_0x9c3fc4=_0x9c3fc4||0xc8;return function(_0x545c40){if(_0x545c40){return _0x409839[_0x49aa('0x2d')](_0x9c3fc4)[_0x49aa('0x2e')](_0x545c40);}};}function respondWithFilteredResult(_0x248906,_0x38ca35){return function(_0x2fda94){if(_0x2fda94){var _0x47cc0e=typeof _0x38ca35[_0x49aa('0x2f')]==='undefined'&&typeof _0x38ca35['limit']===_0x49aa('0x30');var _0x529ce5=_0x2fda94[_0x49aa('0x31')];var _0x122f35=_0x47cc0e?0x0:_0x38ca35[_0x49aa('0x2f')];var _0xea69b4=_0x47cc0e?_0x2fda94[_0x49aa('0x31')]:_0x38ca35[_0x49aa('0x2f')]+_0x38ca35['limit'];var _0x1a4a1e;if(_0xea69b4>=_0x529ce5){_0xea69b4=_0x529ce5;_0x1a4a1e=0xc8;}else{_0x1a4a1e=0xce;}_0x248906[_0x49aa('0x2d')](_0x1a4a1e);return _0x248906[_0x49aa('0x32')](_0x49aa('0x33'),_0x122f35+'-'+_0xea69b4+'/'+_0x529ce5)[_0x49aa('0x2e')](_0x2fda94);}return null;};}function patchUpdates(_0x40e283){return function(_0x201355){try{jsonpatch[_0x49aa('0x34')](_0x201355,_0x40e283,!![]);}catch(_0x4f1072){return BPromise['reject'](_0x4f1072);}return _0x201355[_0x49aa('0x35')]();};}function saveUpdates(_0x3bdb91,_0x37925b){return function(_0x4d0c3f){if(_0x4d0c3f){return _0x4d0c3f[_0x49aa('0x36')](_0x3bdb91)[_0x49aa('0x37')](function(_0x3fb320){return _0x3fb320;});}return null;};}function removeEntity(_0x5e7f2e,_0x1e9a35){return function(_0x1a8be4){if(_0x1a8be4){return _0x1a8be4[_0x49aa('0x38')]()['then'](function(){_0x5e7f2e[_0x49aa('0x2d')](0xcc)[_0x49aa('0x2c')]();});}};}function handleEntityNotFound(_0x2e9861,_0x1a8721){return function(_0x205c7e){if(!_0x205c7e){_0x2e9861['sendStatus'](0x194);}return _0x205c7e;};}function handleError(_0x356ca1,_0x54a132){_0x54a132=_0x54a132||0x1f4;return function(_0xf49f29){logger['error'](_0xf49f29[_0x49aa('0x39')]);if(_0xf49f29[_0x49aa('0x3a')]){delete _0xf49f29['name'];}_0x356ca1[_0x49aa('0x2d')](_0x54a132)[_0x49aa('0x3b')](_0xf49f29);};}exports['index']=function(_0x309d81,_0x182ca4){var _0x1617d8={},_0x5464cb={},_0x14aa20={'count':0x0,'rows':[]};var _0x246056=_['map'](db[_0x49aa('0x3c')][_0x49aa('0x3d')],function(_0x18d12e){return{'name':_0x18d12e[_0x49aa('0x3e')],'type':_0x18d12e['type']['key']};});_0x5464cb['model']=_[_0x49aa('0x3f')](_0x246056,_0x49aa('0x3a'));_0x5464cb[_0x49aa('0x40')]=_[_0x49aa('0x41')](_0x309d81['query']);_0x5464cb[_0x49aa('0x42')]=_['intersection'](_0x5464cb['model'],_0x5464cb[_0x49aa('0x40')]);_0x1617d8['attributes']=_['intersection'](_0x5464cb['model'],qs['fields'](_0x309d81[_0x49aa('0x40')][_0x49aa('0x43')]));_0x1617d8[_0x49aa('0x44')]=_0x1617d8[_0x49aa('0x44')][_0x49aa('0x45')]?_0x1617d8[_0x49aa('0x44')]:_0x5464cb[_0x49aa('0x46')];if(!_0x309d81[_0x49aa('0x40')][_0x49aa('0x47')](_0x49aa('0x48'))){_0x1617d8['limit']=qs[_0x49aa('0x49')](_0x309d81[_0x49aa('0x40')]['limit']);_0x1617d8[_0x49aa('0x2f')]=qs[_0x49aa('0x2f')](_0x309d81[_0x49aa('0x40')][_0x49aa('0x2f')]);}_0x1617d8[_0x49aa('0x4a')]=qs[_0x49aa('0x4b')](_0x309d81[_0x49aa('0x40')][_0x49aa('0x4b')]);_0x1617d8['where']=qs[_0x49aa('0x42')](_[_0x49aa('0x4c')](_0x309d81[_0x49aa('0x40')],_0x5464cb['filters']),_0x246056);if(_0x309d81['query'][_0x49aa('0x4d')]){_0x1617d8[_0x49aa('0x4e')]=_[_0x49aa('0x4f')](_0x1617d8[_0x49aa('0x4e')],{'$or':_[_0x49aa('0x3f')](_0x246056,function(_0x3a9622){if(_0x3a9622['type']!==_0x49aa('0x50')){var _0x16b691={};_0x16b691[_0x3a9622['name']]={'$like':'%'+_0x309d81[_0x49aa('0x40')]['filter']+'%'};return _0x16b691;}})});}_0x1617d8=_[_0x49aa('0x4f')]({},_0x1617d8,_0x309d81[_0x49aa('0x51')]);var _0x517c3d={'where':_0x1617d8['where']};return db[_0x49aa('0x3c')]['count'](_0x517c3d)[_0x49aa('0x37')](function(_0xaa926f){_0x14aa20['count']=_0xaa926f;if(_0x309d81[_0x49aa('0x40')]['includeAll']){_0x1617d8[_0x49aa('0x52')]=[{'all':!![]}];}return db[_0x49aa('0x3c')][_0x49aa('0x53')](_0x1617d8);})['then'](function(_0xf21920){_0x14aa20['rows']=_0xf21920;return _0x14aa20;})['then'](respondWithFilteredResult(_0x182ca4,_0x1617d8))[_0x49aa('0x2b')](handleError(_0x182ca4,null));};exports[_0x49aa('0x54')]=function(_0x3aea24,_0xdf3ff1){var _0x44f698={'raw':!![],'where':{'id':_0x3aea24[_0x49aa('0x55')]['id']}},_0x178172={};_0x178172['model']=_['keys'](db[_0x49aa('0x3c')]['rawAttributes']);_0x178172['query']=_[_0x49aa('0x41')](_0x3aea24['query']);_0x178172[_0x49aa('0x42')]=_[_0x49aa('0x56')](_0x178172[_0x49aa('0x46')],_0x178172[_0x49aa('0x40')]);_0x44f698[_0x49aa('0x44')]=_[_0x49aa('0x56')](_0x178172[_0x49aa('0x46')],qs['fields'](_0x3aea24[_0x49aa('0x40')][_0x49aa('0x43')]));_0x44f698[_0x49aa('0x44')]=_0x44f698[_0x49aa('0x44')]['length']?_0x44f698['attributes']:_0x178172[_0x49aa('0x46')];if(_0x3aea24[_0x49aa('0x40')]['includeAll']){_0x44f698[_0x49aa('0x52')]=[{'all':!![]}];}_0x44f698=_[_0x49aa('0x4f')]({},_0x44f698,_0x3aea24['options']);return db['WhatsappMessage'][_0x49aa('0x57')](_0x44f698)[_0x49aa('0x37')](handleEntityNotFound(_0xdf3ff1,null))[_0x49aa('0x37')](respondWithResult(_0xdf3ff1,null))[_0x49aa('0x2b')](handleError(_0xdf3ff1,null));};exports['create']=function(_0x87720,_0x4f5884){return db[_0x49aa('0x3c')][_0x49aa('0x58')](_0x87720['body'],{})[_0x49aa('0x37')](respondWithResult(_0x4f5884,0xc9))[_0x49aa('0x2b')](handleError(_0x4f5884,null));};exports[_0x49aa('0x36')]=function(_0x137a4f,_0x40da87){if(_0x137a4f[_0x49aa('0x59')]['id']){delete _0x137a4f[_0x49aa('0x59')]['id'];}return db[_0x49aa('0x3c')]['find']({'where':{'id':_0x137a4f[_0x49aa('0x55')]['id']}})[_0x49aa('0x37')](handleEntityNotFound(_0x40da87,null))[_0x49aa('0x37')](saveUpdates(_0x137a4f[_0x49aa('0x59')],null))[_0x49aa('0x37')](respondWithResult(_0x40da87,null))[_0x49aa('0x2b')](handleError(_0x40da87,null));};exports[_0x49aa('0x38')]=function(_0x1daf2e,_0x175cc5){return db['WhatsappMessage']['find']({'where':{'id':_0x1daf2e[_0x49aa('0x55')]['id']}})['then'](handleEntityNotFound(_0x175cc5,null))[_0x49aa('0x37')](removeEntity(_0x175cc5,null))[_0x49aa('0x2b')](handleError(_0x175cc5,null));};exports[_0x49aa('0x5a')]=function(_0x56c2cb,_0x2cbe60){return db['WhatsappMessage'][_0x49aa('0x5a')]()[_0x49aa('0x37')](respondWithResult(_0x2cbe60,null))[_0x49aa('0x2b')](handleError(_0x2cbe60,null));};var interaction_log=require(_0x49aa('0x15'))('whatsapp-interactions');exports[_0x49aa('0x5b')]=function(_0x5e360f,_0x151a7c,_0x5d453e){var _0x30d452={'agent':{},'channel':_0x49aa('0x5c')};if(_0x5e360f[_0x49aa('0x59')]['id']){delete _0x5e360f['body']['id'];}_0x5e360f[_0x49aa('0x59')][_0x49aa('0x5d')]=!![];_0x5e360f[_0x49aa('0x59')][_0x49aa('0x5e')]=moment()[_0x49aa('0x5f')](_0x49aa('0x60'));_0x5e360f['body'][_0x49aa('0x61')]=_0x5e360f[_0x49aa('0x59')]['UserId']||_0x5e360f[_0x49aa('0x62')]['id'];_0x30d452[_0x49aa('0x63')]['id']=_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')];return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x5e360f['params']['id'],'UserId':null}})[_0x49aa('0x37')](handleEntityNotFound(_0x151a7c,null))[_0x49aa('0x37')](saveUpdates(_0x5e360f[_0x49aa('0x59')],null))[_0x49aa('0x37')](function(_0x54caa0){if(_0x54caa0){_0x30d452[_0x49aa('0x28')]=_0x54caa0[_0x49aa('0x64')]({'plain':!![]});return db[_0x49aa('0x65')][_0x49aa('0x57')]({'where':{'id':_0x54caa0[_0x49aa('0x66')]}});}return null;})[_0x49aa('0x37')](handleEntityNotFound(_0x151a7c,null))['then'](function(_0x7de333){if(_0x7de333){return _0x7de333[_0x49aa('0x36')]({'UserId':_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')],'read1stAt':_[_0x49aa('0x67')](_0x7de333[_0x49aa('0x68')])?moment()[_0x49aa('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x49aa('0x37')](function(_0x545884){if(_0x545884){_0x30d452[_0x49aa('0x69')]=_0x545884[_0x49aa('0x64')]({'plain':!![]});interaction_log[_0x49aa('0x22')](_0x49aa('0x6a'),_0x5e360f['user']['id'],_0x5e360f[_0x49aa('0x62')][_0x49aa('0x3a')],_0x5e360f[_0x49aa('0x62')][_0x49aa('0x6b')],_0x30d452['interaction']['id'],_0x5e360f['body']?JSON[_0x49aa('0x6c')](_0x5e360f[_0x49aa('0x59')]):_0x49aa('0x6d'));return respondWithRpcPromise(_0x49aa('0x6e'),'acceptMessage',_0x30d452);}return null;})[_0x49aa('0x37')](function(_0x5537b8){var _0x1a300d=_0x49aa('0x6f')+_0x5537b8[_0x49aa('0x28')][_0x49aa('0x70')];return db[_0x49aa('0x71')][_0x49aa('0x40')](_0x1a300d,{'type':db['Sequelize'][_0x49aa('0x72')][_0x49aa('0x73')],'raw':!![]})['then'](function(_0x76abe3){return _0x76abe3;});})[_0x49aa('0x37')](function(_0x227ad5){if(_0x227ad5){_0x30d452[_0x49aa('0x28')]['contact']=_0x227ad5[0x0];if(!_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')])return;return db[_0x49aa('0x74')]['find']({'where':{'id':_0x5e360f[_0x49aa('0x59')][_0x49aa('0x61')],'role':'agent'},'attributes':['id',_0x49aa('0x3a'),_0x49aa('0x75'),_0x49aa('0x76'),'internal'],'raw':!![]});}return null;})[_0x49aa('0x37')](function(_0x1b1962){if(!_0x1b1962)return null;_0x30d452[_0x49aa('0x28')][_0x49aa('0x63')]=_0x1b1962;return _0x30d452;})['then'](function(_0x2ef808){if(_0x2ef808){if(_0x5e360f['body'][_0x49aa('0x77')]){_0x30d452['message'][_0x49aa('0x78')]=util[_0x49aa('0x5f')](_0x49aa('0x79'),_0x5e360f['user'][_0x49aa('0x3a')]);_0x30d452['message'][_0x49aa('0x7a')]=_0x30d452[_0x49aa('0x7a')];_0x30d452[_0x49aa('0x28')]['motionChannel']=_0x30d452['channel'];_0x30d452['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x49aa('0x7b'),{'event':_0x49aa('0x7c'),'message':_0x30d452[_0x49aa('0x28')]},client9002)[_0x49aa('0x37')](function(){return _0x30d452;});}return _0x30d452;}return null;})['then'](respondWithResult(_0x151a7c,null))[_0x49aa('0x2b')](handleError(_0x151a7c,null));};var interaction_log=require(_0x49aa('0x15'))(_0x49aa('0x7d'));exports[_0x49aa('0x7e')]=function(_0x299525,_0x3dad36,_0xa3a2e4){var _0x5f2e0e={'agent':{},'channel':_0x49aa('0x5c')};if(_0x299525[_0x49aa('0x59')]['id']){delete _0x299525[_0x49aa('0x59')]['id'];}_0x299525[_0x49aa('0x59')][_0x49aa('0x61')]=_0x299525['body'][_0x49aa('0x61')]||_0x299525[_0x49aa('0x62')]['id'];_0x5f2e0e[_0x49aa('0x63')]['id']=_0x299525[_0x49aa('0x59')][_0x49aa('0x61')];return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x299525[_0x49aa('0x55')]['id'],'UserId':null}})[_0x49aa('0x37')](handleEntityNotFound(_0x3dad36,null))['then'](function(_0x5c4c79){if(_0x5c4c79){_0x5f2e0e[_0x49aa('0x28')]=_0x5c4c79[_0x49aa('0x64')]({'plain':!![]});return db[_0x49aa('0x65')][_0x49aa('0x57')]({'where':{'id':_0x5c4c79[_0x49aa('0x66')]}});}return null;})[_0x49aa('0x37')](handleEntityNotFound(_0x3dad36,null))[_0x49aa('0x37')](function(_0x2d555e){if(_0x2d555e){_0x5f2e0e[_0x49aa('0x69')]=_0x2d555e[_0x49aa('0x64')]({'plain':!![]});interaction_log[_0x49aa('0x22')](_0x49aa('0x7f'),_0x299525[_0x49aa('0x62')]['id'],_0x299525['user']['name'],_0x299525['user'][_0x49aa('0x6b')],_0x5f2e0e[_0x49aa('0x69')]['id'],_0x299525[_0x49aa('0x59')]?JSON[_0x49aa('0x6c')](_0x299525[_0x49aa('0x59')]):_0x49aa('0x6d'));return respondWithRpcPromise(_0x49aa('0x80'),_0x49aa('0x81'),_0x5f2e0e);}return null;})[_0x49aa('0x37')](function(_0x30f0e6){var _0x1b1c65=_0x49aa('0x6f')+_0x30f0e6['message'][_0x49aa('0x70')];return db[_0x49aa('0x71')][_0x49aa('0x40')](_0x1b1c65,{'type':db['Sequelize']['QueryTypes'][_0x49aa('0x73')],'raw':!![]})[_0x49aa('0x37')](function(_0x1e65d1){return _0x1e65d1;});})[_0x49aa('0x37')](function(_0x1c9778){if(_0x1c9778){_0x5f2e0e[_0x49aa('0x28')][_0x49aa('0x82')]=_0x1c9778[0x0];if(!_0x299525['body'][_0x49aa('0x61')])return;return db[_0x49aa('0x74')][_0x49aa('0x57')]({'where':{'id':_0x299525[_0x49aa('0x59')][_0x49aa('0x61')],'role':_0x49aa('0x63')},'attributes':['id','name',_0x49aa('0x75'),_0x49aa('0x76'),_0x49aa('0x83')],'raw':!![]});}return null;})[_0x49aa('0x37')](function(_0x1246cc){if(!_0x1246cc)return null;_0x5f2e0e[_0x49aa('0x28')][_0x49aa('0x63')]=_0x1246cc;return _0x5f2e0e;})[_0x49aa('0x37')](function(_0x3fc31c){if(_0x3fc31c){_0x3fc31c[_0x49aa('0x28')]['interface']=util['format'](_0x49aa('0x79'),_0x299525['user'][_0x49aa('0x3a')]);_0x3fc31c[_0x49aa('0x28')][_0x49aa('0x7a')]=_0x5f2e0e[_0x49aa('0x7a')];_0x3fc31c[_0x49aa('0x28')]['motionChannel']=_0x5f2e0e[_0x49aa('0x7a')];_0x3fc31c[_0x49aa('0x28')][_0x49aa('0x84')]=_0x49aa('0x7e');respondWithRpcPromise('EventManager',_0x49aa('0x7b'),{'event':_0x49aa('0x85'),'message':_0x3fc31c['message']},client9002);return _0x5f2e0e;}return null;})[_0x49aa('0x37')](respondWithResult(_0x3dad36,null))['catch'](handleError(_0x3dad36,null));};exports[_0x49aa('0x2d')]=function(_0x3fa9c4,_0x5c2e8c,_0x38edd8){if(_0x3fa9c4[_0x49aa('0x59')]['id']){delete _0x3fa9c4[_0x49aa('0x59')]['id'];}var _0x2aa432;return db[_0x49aa('0x3c')][_0x49aa('0x57')]({'where':{'id':_0x3fa9c4[_0x49aa('0x55')]['id']}})[_0x49aa('0x37')](handleEntityNotFound(_0x5c2e8c,null))[_0x49aa('0x37')](function(_0x5e3842){if(_0x5e3842){_0x2aa432=_0x5e3842;return db[_0x49aa('0x86')][_0x49aa('0x57')]({'where':{'id':_0x5e3842[_0x49aa('0x87')]}});}})[_0x49aa('0x37')](handleEntityNotFound(_0x5c2e8c,null))[_0x49aa('0x37')](function(_0x2d7c84){if(_0x2d7c84){logger[_0x49aa('0x24')](_0x49aa('0x88'),_0x49aa('0x2d'),_0x49aa('0x89'),_0x2d7c84[_0x49aa('0x8a')],util[_0x49aa('0x8b')](_0x3fa9c4[_0x49aa('0x59')],{'showHidden':![],'depth':null}));switch(_0x2d7c84[_0x49aa('0x8a')]){case _0x49aa('0x8c'):if(_0x3fa9c4['body'][_0x49aa('0x8d')]&&_0x3fa9c4['body']['MessageSid']===_0x2aa432['messageId']&&_0x3fa9c4[_0x49aa('0x59')]['MessageStatus']&&_0x3fa9c4['body']['MessageStatus']===_0x49aa('0x5d')){return _0x2aa432[_0x49aa('0x36')]({'read':!![]});}else{logger['error'](_0x49aa('0x8e'),'status','twilio',util[_0x49aa('0x8b')](_0x3fa9c4[_0x49aa('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2aa432;}})[_0x49aa('0x37')](respondWithResult(_0x5c2e8c,null))['catch'](handleError(_0x5c2e8c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index fee5d87..88f29d0 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 _0x823c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x42a024,_0x464c2d){var _0x18233f=function(_0xb6cea5){while(--_0xb6cea5){_0x42a024['push'](_0x42a024['shift']());}};_0x18233f(++_0x464c2d);}(_0x823c,0x143));var _0xc823=function(_0xb8b2ce,_0x47721f){_0xb8b2ce=_0xb8b2ce-0x0;var _0x3b3c45=_0x823c[_0xb8b2ce];return _0x3b3c45;};'use strict';var EventEmitter=require(_0xc823('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc823('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc823('0x2')](0x0);var events={'afterCreate':_0xc823('0x3'),'afterUpdate':_0xc823('0x4'),'afterDestroy':_0xc823('0x5')};function emitEvent(_0x67f9d){return function(_0x49f2d2,_0x3309cc,_0x35dedf){WhatsappMessageEvents[_0xc823('0x6')](_0x67f9d+':'+_0x49f2d2['id'],_0x49f2d2);WhatsappMessageEvents[_0xc823('0x6')](_0x67f9d,_0x49f2d2);_0x35dedf(null);};}for(var e in events){if(events[_0xc823('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc823('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd547=['hook','WhatsappMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xd547,0x1c1));var _0x7d54=function(_0x1ee41b,_0x1874af){_0x1ee41b=_0x1ee41b-0x0;var _0x1f5200=_0xd547[_0x1ee41b];return _0x1f5200;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x7d54('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d54('0x1')](0x0);var events={'afterCreate':_0x7d54('0x2'),'afterUpdate':_0x7d54('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab00b){return function(_0x21c23f,_0x5d21c1,_0x22ea09){WhatsappMessageEvents['emit'](_0x4ab00b+':'+_0x21c23f['id'],_0x21c23f);WhatsappMessageEvents[_0x7d54('0x4')](_0x4ab00b,_0x21c23f);_0x22ea09(null);};}for(var e in events){if(events[_0x7d54('0x5')](e)){var event=events[e];WhatsappMessage[_0x7d54('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 00e3c7a..62176d1 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 _0x07a3=['whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','toLowerCase','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/status?token=','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','statuses','message_id','catch','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x07a3,0xeb));var _0x307a=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x07a3[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x307a('0x0'));var logger=require(_0x307a('0x1'))(_0x307a('0x2'));var moment=require('moment');var BPromise=require(_0x307a('0x3'));var rp=require(_0x307a('0x4'));var fetch=require(_0x307a('0x5'));var fs=require('fs');var path=require(_0x307a('0x6'));var rimraf=require(_0x307a('0x7'));var config=require(_0x307a('0x8'));var attributes=require(_0x307a('0x9'));module[_0x307a('0xa')]=function(_0x348f32,_0x43cf5f){return _0x348f32[_0x307a('0xb')](_0x307a('0xc'),attributes,{'tableName':_0x307a('0xd'),'paranoid':![],'indexes':[{'name':_0x307a('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x307a('0xf')],'type':_0x307a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fb534,_0x1a467c,_0x386c98){var _0x3bff09=_0x348f32[_0x307a('0x11')];var _0x47875a=_0x3fb534[_0x307a('0x12')]({'plain':!![]});if(_0x47875a[_0x307a('0x13')]['toLowerCase']()==='in'||_0x47875a[_0x307a('0x13')]['toLowerCase']()===_0x307a('0x14')&&!_0x47875a[_0x307a('0x15')]&&!_[_0x307a('0x16')](_0x47875a[_0x307a('0x17')])){_0x3bff09[_0x307a('0x18')][_0x307a('0x19')]({'where':{'id':_0x47875a['WhatsappInteractionId']}})[_0x307a('0x1a')](function(_0x111349){if(_0x111349){_0x111349[_0x307a('0x1b')]({'lastMsgAt':_0x47875a[_0x307a('0x1c')],'lastMsgDirection':_0x47875a['direction'][_0x307a('0x1d')]()});}})['catch'](function(_0xaa39aa){console[_0x307a('0x1e')](_0xaa39aa);});}if(_0x47875a[_0x307a('0x13')]===_0x307a('0x14')&&!_0x47875a[_0x307a('0x15')]){var _0x2fc219;_0x3bff09[_0x307a('0x1f')]['find']({'where':{'id':_0x47875a[_0x307a('0x20')]},'raw':!![]})[_0x307a('0x1a')](function(_0x56666b){_0x2fc219=_0x56666b;if(_0x2fc219&&_0x2fc219['type']){switch(_0x2fc219[_0x307a('0x21')]){case'twilio':var _0x9a60ee=require(_0x307a('0x22'));if(_0x2fc219[_0x307a('0x23')]&&_0x2fc219[_0x307a('0x24')]&&_0x2fc219[_0x307a('0x25')]){var _0x553d4b=new _0x9a60ee(_0x2fc219[_0x307a('0x23')],_0x2fc219[_0x307a('0x24')]);_0x553d4b[_0x307a('0x26')]['create']({'body':_0x47875a['body'],'to':_0x307a('0x27')+_0x47875a[_0x307a('0x25')],'from':_0x307a('0x27')+_0x2fc219[_0x307a('0x25')],'statusCallback':_0x2fc219[_0x307a('0x28')]+'/api/whatsapp/messages/'+_0x47875a['id']+_0x307a('0x29')+_0x2fc219[_0x307a('0x2a')]})[_0x307a('0x1a')](function(_0x5cefba){if(_0x5cefba[_0x307a('0x2b')]){return _0x3fb534[_0x307a('0x1b')]({'messageId':_0x5cefba[_0x307a('0x2b')]});}})['catch'](function(_0x47a9d6){logger[_0x307a('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x307a('0x2c'),'twilio',util[_0x307a('0x2d')](_0x47a9d6,{'showHidden':![],'depth':null}));});}else{logger[_0x307a('0x1e')](_0x307a('0x2e'),_0x307a('0x2c'),_0x307a('0x22'),_0x307a('0x2f'));}break;case _0x307a('0x30'):var _0x3b52ea=_0x2fc219['accountSid'];var _0x4bd1f9=_0x2fc219['authToken'];var _0x106999=_0x2fc219[_0x307a('0x31')]+_0x307a('0x32')+_0x3b52ea+_0x307a('0x33');var _0x4a51c3={'to':[_0x47875a[_0x307a('0x25')]],'message':{'type':_0x307a('0x34'),'text':_0x47875a[_0x307a('0xf')]}};var _0x24f6b9={'method':_0x307a('0x35'),'uri':_0x106999,'headers':{'Authorization':'Bearer\x20'+_0x4bd1f9,'Content-Type':_0x307a('0x36')},'body':_0x4a51c3,'json':!![]};rp(_0x24f6b9)['then'](function(_0xbc6f1e){if(_0xbc6f1e['statuses'][0x0]['message_id']){return _0x3fb534[_0x307a('0x1b')]({'messageId':_0xbc6f1e[_0x307a('0x37')][0x0][_0x307a('0x38')]});}})[_0x307a('0x39')](function(_0x23fa88){logger['err'](_0x307a('0x3a'),_0x23fa88);});break;}}})[_0x307a('0x3b')](function(){_0x386c98();});}else{_0x386c98();}}},'charset':_0x307a('0x3c'),'collate':_0x307a('0x3d')});}; \ No newline at end of file +var _0x201c=['POST','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','node-fetch','path','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','out','WhatsappInteraction','then','update','createdAt','toLowerCase','catch','error','find','WhatsappAccountId','type','accountSid','authToken','phone','messages','create','body','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text'];(function(_0x49eb4f,_0x197eb3){var _0x52c8fe=function(_0x28983d){while(--_0x28983d){_0x49eb4f['push'](_0x49eb4f['shift']());}};_0x52c8fe(++_0x197eb3);}(_0x201c,0x10b));var _0xc201=function(_0x3dae4f,_0x964e6e){_0x3dae4f=_0x3dae4f-0x0;var _0x38fc9b=_0x201c[_0x3dae4f];return _0x38fc9b;};'use strict';var _=require(_0xc201('0x0'));var util=require('util');var logger=require(_0xc201('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc201('0x2'));var rp=require(_0xc201('0x3'));var fetch=require(_0xc201('0x4'));var fs=require('fs');var path=require(_0xc201('0x5'));var rimraf=require('rimraf');var config=require(_0xc201('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xc201('0x7')]=function(_0x53a626,_0x269ec3){return _0x53a626[_0xc201('0x8')](_0xc201('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc201('0xa'),'fields':[_0xc201('0xa')]},{'name':_0xc201('0xb'),'fields':['body'],'type':_0xc201('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7ede3c,_0x345d6c,_0x549e8e){var _0x2843d2=_0x53a626[_0xc201('0xd')];var _0x4c7ad9=_0x7ede3c[_0xc201('0xe')]({'plain':!![]});if(_0x4c7ad9[_0xc201('0xf')]['toLowerCase']()==='in'||_0x4c7ad9['direction']['toLowerCase']()===_0xc201('0x10')&&!_0x4c7ad9['secret']&&!_['isNil'](_0x4c7ad9['UserId'])){_0x2843d2[_0xc201('0x11')]['findOne']({'where':{'id':_0x4c7ad9['WhatsappInteractionId']}})[_0xc201('0x12')](function(_0x22ef2a){if(_0x22ef2a){_0x22ef2a[_0xc201('0x13')]({'lastMsgAt':_0x4c7ad9[_0xc201('0x14')],'lastMsgDirection':_0x4c7ad9['direction'][_0xc201('0x15')]()});}})[_0xc201('0x16')](function(_0x513ccd){console[_0xc201('0x17')](_0x513ccd);});}if(_0x4c7ad9[_0xc201('0xf')]===_0xc201('0x10')&&!_0x4c7ad9['secret']){var _0x5f3895;_0x2843d2['WhatsappAccount'][_0xc201('0x18')]({'where':{'id':_0x4c7ad9[_0xc201('0x19')]},'raw':!![]})[_0xc201('0x12')](function(_0x176aed){_0x5f3895=_0x176aed;if(_0x5f3895&&_0x5f3895[_0xc201('0x1a')]){switch(_0x5f3895[_0xc201('0x1a')]){case'twilio':var _0x3a1f56=require('twilio');if(_0x5f3895[_0xc201('0x1b')]&&_0x5f3895[_0xc201('0x1c')]&&_0x5f3895[_0xc201('0x1d')]){var _0x50e638=new _0x3a1f56(_0x5f3895[_0xc201('0x1b')],_0x5f3895['authToken']);_0x50e638[_0xc201('0x1e')][_0xc201('0x1f')]({'body':_0x4c7ad9[_0xc201('0x20')],'to':_0xc201('0x21')+_0x4c7ad9[_0xc201('0x1d')],'from':_0xc201('0x21')+_0x5f3895[_0xc201('0x1d')],'statusCallback':_0x5f3895['remote']+_0xc201('0x22')+_0x4c7ad9['id']+_0xc201('0x23')+_0x5f3895[_0xc201('0x24')]})['then'](function(_0x2cc3df){if(_0x2cc3df[_0xc201('0x25')]){return _0x7ede3c['update']({'messageId':_0x2cc3df['sid']});}})[_0xc201('0x16')](function(_0x56a2c0){logger[_0xc201('0x17')](_0xc201('0x26'),'afterCreate','twilio',util['inspect'](_0x56a2c0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xc201('0x26'),_0xc201('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc201('0x28'):var _0x5efbb=_0x5f3895[_0xc201('0x1b')];var _0x291466=_0x5f3895[_0xc201('0x1c')];var _0x142e36=_0x5f3895[_0xc201('0x29')]+_0xc201('0x2a')+_0x5efbb+_0xc201('0x2b');var _0x2455c5={'to':[_0x4c7ad9[_0xc201('0x1d')]],'message':{'type':_0xc201('0x2c'),'text':_0x4c7ad9[_0xc201('0x20')]}};var _0x4a1897={'method':_0xc201('0x2d'),'uri':_0x142e36,'headers':{'Authorization':'Bearer\x20'+_0x291466,'Content-Type':_0xc201('0x2e')},'body':_0x2455c5,'json':!![]};rp(_0x4a1897)[_0xc201('0x12')](function(_0x2269a0){if(_0x2269a0[_0xc201('0x2f')][0x0][_0xc201('0x30')]){return _0x7ede3c[_0xc201('0x13')]({'messageId':_0x2269a0[_0xc201('0x2f')][0x0][_0xc201('0x30')]});}})[_0xc201('0x16')](function(_0x37b2d4){logger['err']('WhatsappMessage,\x20%s',_0x37b2d4);});break;}}})[_0xc201('0x31')](function(){_0x549e8e();});}else{_0x549e8e();}}},'charset':_0xc201('0x32'),'collate':_0xc201('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a9ae9a6..e8df510 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 _0x4d3a=['../../config/utils','../../config/logger','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','debug','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x346891,_0x23a17c){var _0x5d19dc=function(_0x5a90fa){while(--_0x5a90fa){_0x346891['push'](_0x346891['shift']());}};_0x5d19dc(++_0x23a17c);}(_0x4d3a,0x11b));var _0xa4d3=function(_0x343dfb,_0xed8587){_0x343dfb=_0x343dfb-0x0;var _0x297fe2=_0x4d3a[_0x343dfb];return _0x297fe2;};'use strict';var _=require('lodash');var util=require(_0xa4d3('0x0'));var moment=require(_0xa4d3('0x1'));var BPromise=require(_0xa4d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d3('0x3'));var db=require(_0xa4d3('0x4'))['db'];var utils=require(_0xa4d3('0x5'));var logger=require(_0xa4d3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa4d3('0x7')](config[_0xa4d3('0x8')],{'host':_0xa4d3('0x9'),'port':0x18eb});var socket=require(_0xa4d3('0xa'))(new Redis(config[_0xa4d3('0x8')]));require(_0xa4d3('0xb'))[_0xa4d3('0xc')](socket);function respondWithRpcPromise(_0x26061d,_0x127b3a,_0x1ad4fc){return new BPromise(function(_0x302a59,_0x561984){return client[_0xa4d3('0xd')](_0x26061d,_0x1ad4fc)[_0xa4d3('0xe')](function(_0x1a3636){logger[_0xa4d3('0xf')](_0xa4d3('0x10'),_0x127b3a,_0xa4d3('0x11'));logger['debug'](_0xa4d3('0x12'),_0x127b3a,'request\x20sent',JSON[_0xa4d3('0x13')](_0x1a3636));if(_0x1a3636[_0xa4d3('0x14')]){if(_0x1a3636[_0xa4d3('0x14')][_0xa4d3('0x15')]===0x1f4){logger[_0xa4d3('0x14')](_0xa4d3('0x10'),_0x127b3a,_0x1a3636[_0xa4d3('0x14')][_0xa4d3('0x16')]);return _0x561984(_0x1a3636[_0xa4d3('0x14')]['message']);}logger[_0xa4d3('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x127b3a,_0x1a3636[_0xa4d3('0x14')][_0xa4d3('0x16')]);return _0x302a59(_0x1a3636['error'][_0xa4d3('0x16')]);}else{logger[_0xa4d3('0xf')](_0xa4d3('0x10'),_0x127b3a,'request\x20sent');_0x302a59(_0x1a3636[_0xa4d3('0x17')][_0xa4d3('0x16')]);}})[_0xa4d3('0x18')](function(_0x381f6d){logger[_0xa4d3('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x127b3a,_0x381f6d);_0x561984(_0x381f6d);});});}exports['CreateWhatsappMessage']=function(_0x17f938){var _0x2f18ad=this;return new Promise(function(_0x583729,_0x4c2dee){return db[_0xa4d3('0x19')][_0xa4d3('0x1a')](_0x17f938[_0xa4d3('0x1b')],{'raw':_0x17f938['options']?_0x17f938[_0xa4d3('0x1c')][_0xa4d3('0x1d')]===undefined?!![]:![]:!![]})[_0xa4d3('0xe')](function(_0xca0ffd){logger[_0xa4d3('0xf')](_0xa4d3('0x1e'),_0x17f938);logger[_0xa4d3('0x1f')]('CreateWhatsappMessage',_0x17f938,JSON[_0xa4d3('0x13')](_0xca0ffd));_0x583729(_0xca0ffd);})[_0xa4d3('0x18')](function(_0x4fefa9){logger['error'](_0xa4d3('0x1e'),_0x4fefa9[_0xa4d3('0x16')],_0x17f938);_0x4c2dee(_0x2f18ad[_0xa4d3('0x14')](0x1f4,_0x4fefa9[_0xa4d3('0x16')]));});});}; \ No newline at end of file +var _0x4b4c=['../../config/environment','client','redis','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4b4c,0x162));var _0xc4b4=function(_0x191485,_0x18a5ec){_0x191485=_0x191485-0x0;var _0x4e9c7a=_0x4b4c[_0x191485];return _0x4e9c7a;};'use strict';var _=require(_0xc4b4('0x0'));var util=require(_0xc4b4('0x1'));var moment=require(_0xc4b4('0x2'));var BPromise=require(_0xc4b4('0x3'));var rs=require(_0xc4b4('0x4'));var fs=require('fs');var Redis=require(_0xc4b4('0x5'));var db=require(_0xc4b4('0x6'))['db'];var utils=require(_0xc4b4('0x7'));var logger=require('../../config/logger')(_0xc4b4('0x8'));var config=require(_0xc4b4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc4b4('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc4b4('0xb')],{'host':_0xc4b4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4b4('0xb')]));require(_0xc4b4('0xd'))[_0xc4b4('0xe')](socket);function respondWithRpcPromise(_0x29a01d,_0x4fee90,_0x13b8ce){return new BPromise(function(_0x14ade0,_0x6714cf){return client[_0xc4b4('0xf')](_0x29a01d,_0x13b8ce)[_0xc4b4('0x10')](function(_0x80499e){logger['info'](_0xc4b4('0x11'),_0x4fee90,_0xc4b4('0x12'));logger[_0xc4b4('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4fee90,_0xc4b4('0x12'),JSON[_0xc4b4('0x14')](_0x80499e));if(_0x80499e['error']){if(_0x80499e[_0xc4b4('0x15')][_0xc4b4('0x16')]===0x1f4){logger[_0xc4b4('0x15')](_0xc4b4('0x11'),_0x4fee90,_0x80499e[_0xc4b4('0x15')]['message']);return _0x6714cf(_0x80499e[_0xc4b4('0x15')][_0xc4b4('0x17')]);}logger[_0xc4b4('0x15')](_0xc4b4('0x11'),_0x4fee90,_0x80499e['error'][_0xc4b4('0x17')]);return _0x14ade0(_0x80499e[_0xc4b4('0x15')]['message']);}else{logger[_0xc4b4('0x18')](_0xc4b4('0x11'),_0x4fee90,_0xc4b4('0x12'));_0x14ade0(_0x80499e[_0xc4b4('0x19')][_0xc4b4('0x17')]);}})[_0xc4b4('0x1a')](function(_0x2b8c0a){logger[_0xc4b4('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x4fee90,_0x2b8c0a);_0x6714cf(_0x2b8c0a);});});}exports[_0xc4b4('0x1b')]=function(_0x514234){var _0x47be6a=this;return new Promise(function(_0x15ec3c,_0x6576b0){return db[_0xc4b4('0x1c')][_0xc4b4('0x1d')](_0x514234[_0xc4b4('0x1e')],{'raw':_0x514234[_0xc4b4('0x1f')]?_0x514234[_0xc4b4('0x1f')][_0xc4b4('0x20')]===undefined?!![]:![]:!![]})[_0xc4b4('0x10')](function(_0x162305){logger[_0xc4b4('0x18')](_0xc4b4('0x1b'),_0x514234);logger['debug']('CreateWhatsappMessage',_0x514234,JSON['stringify'](_0x162305));_0x15ec3c(_0x162305);})[_0xc4b4('0x1a')](function(_0x4be294){logger[_0xc4b4('0x15')]('CreateWhatsappMessage',_0x4be294['message'],_0x514234);_0x6576b0(_0x47be6a[_0xc4b4('0x15')](0x1f4,_0x4be294[_0xc4b4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 51fb1d4..e34080e 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 _0xf08b=['update','emit','register','whatsappMessage:','./whatsappMessage.events'];(function(_0x37dbf3,_0x4ad77d){var _0x1cda9b=function(_0x5d1a10){while(--_0x5d1a10){_0x37dbf3['push'](_0x37dbf3['shift']());}};_0x1cda9b(++_0x4ad77d);}(_0xf08b,0x1c1));var _0xbf08=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf08b[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappMessageEvents=require(_0xbf08('0x0'));var events=['save','remove',_0xbf08('0x1')];function createListener(_0x1c572c,_0x151eca){return function(_0x221175){_0x151eca[_0xbf08('0x2')](_0x1c572c,_0x221175);};}function removeListener(_0x35f2a3,_0x649ffd){return function(){WhatsappMessageEvents['removeListener'](_0x35f2a3,_0x649ffd);};}exports[_0xbf08('0x3')]=function(_0xe2ae28){for(var _0x113650=0x0,_0x4d2d63=events['length'];_0x113650<_0x4d2d63;_0x113650++){var _0x2c1e04=events[_0x113650];var _0x1cbb82=createListener(_0xbf08('0x4')+_0x2c1e04,_0xe2ae28);WhatsappMessageEvents['on'](_0x2c1e04,_0x1cbb82);}}; \ No newline at end of file +var _0x6dee=['length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x100b85,_0x4997b5){var _0xf4f5aa=function(_0x5d0924){while(--_0x5d0924){_0x100b85['push'](_0x100b85['shift']());}};_0xf4f5aa(++_0x4997b5);}(_0x6dee,0x1c2));var _0xe6de=function(_0x5170ed,_0x591fb4){_0x5170ed=_0x5170ed-0x0;var _0x2829e6=_0x6dee[_0x5170ed];return _0x2829e6;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe6de('0x0'),_0xe6de('0x1'),_0xe6de('0x2')];function createListener(_0x2d1325,_0xefec7e){return function(_0x3c35ad){_0xefec7e[_0xe6de('0x3')](_0x2d1325,_0x3c35ad);};}function removeListener(_0xae8bff,_0x20edf8){return function(){WhatsappMessageEvents[_0xe6de('0x4')](_0xae8bff,_0x20edf8);};}exports['register']=function(_0x46d07b){for(var _0x50ace2=0x0,_0x29fc21=events[_0xe6de('0x5')];_0x50ace2<_0x29fc21;_0x50ace2++){var _0x3647b6=events[_0x50ace2];var _0x3476ab=createListener(_0xe6de('0x6')+_0x3647b6,_0x46d07b);WhatsappMessageEvents['on'](_0x3647b6,_0x3476ab);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a0c309d..ce98b93 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 _0x5b41=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8930b3,_0x1fa28a){var _0x16d889=function(_0x3b4cbd){while(--_0x3b4cbd){_0x8930b3['push'](_0x8930b3['shift']());}};_0x16d889(++_0x1fa28a);}(_0x5b41,0xa5));var _0x15b4=function(_0x488cd4,_0x419d9d){_0x488cd4=_0x488cd4-0x0;var _0x16fecb=_0x5b41[_0x488cd4];return _0x16fecb;};'use strict';var multer=require(_0x15b4('0x0'));var util=require(_0x15b4('0x1'));var path=require(_0x15b4('0x2'));var timeout=require(_0x15b4('0x3'));var express=require(_0x15b4('0x4'));var router=express[_0x15b4('0x5')]();var fs_extra=require(_0x15b4('0x6'));var auth=require(_0x15b4('0x7'));var interaction=require(_0x15b4('0x8'));var config=require(_0x15b4('0x9'));var controller=require('./whatsappQueue.controller');router[_0x15b4('0xa')]('/',auth[_0x15b4('0xb')](),controller[_0x15b4('0xc')]);router[_0x15b4('0xa')](_0x15b4('0xd'),auth[_0x15b4('0xb')](),controller[_0x15b4('0xe')]);router[_0x15b4('0xa')](_0x15b4('0xf'),auth[_0x15b4('0xb')](),controller[_0x15b4('0x10')]);router[_0x15b4('0xa')](_0x15b4('0x11'),auth[_0x15b4('0xb')](),controller[_0x15b4('0x12')]);router[_0x15b4('0xa')]('/:id/teams',auth[_0x15b4('0xb')](),controller[_0x15b4('0x13')]);router[_0x15b4('0xa')]('/:id/users',auth[_0x15b4('0xb')](),controller[_0x15b4('0x14')]);router[_0x15b4('0x15')]('/',auth[_0x15b4('0xb')](),controller['create']);router[_0x15b4('0x15')](_0x15b4('0x16'),auth[_0x15b4('0xb')](),controller[_0x15b4('0x17')]);router[_0x15b4('0x15')](_0x15b4('0x18'),auth['isAuthenticated'](),controller[_0x15b4('0x19')]);router[_0x15b4('0x1a')]('/:id',auth[_0x15b4('0xb')](),controller[_0x15b4('0x1b')]);router[_0x15b4('0x1c')](_0x15b4('0xf'),auth[_0x15b4('0xb')](),controller['destroy']);router[_0x15b4('0x1c')](_0x15b4('0x16'),auth[_0x15b4('0xb')](),controller['removeTeams']);router[_0x15b4('0x1c')](_0x15b4('0x18'),auth[_0x15b4('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x61ed=['util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addAgents','put','update','delete','removeAgents','exports'];(function(_0x1e2a66,_0x1bbeed){var _0xde23fe=function(_0x65c7de){while(--_0x65c7de){_0x1e2a66['push'](_0x1e2a66['shift']());}};_0xde23fe(++_0x1bbeed);}(_0x61ed,0xf2));var _0xd61e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x61ed[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xd61e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd61e('0x1'));var router=express[_0xd61e('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd61e('0x3'));var config=require(_0xd61e('0x4'));var controller=require('./whatsappQueue.controller');router[_0xd61e('0x5')]('/',auth[_0xd61e('0x6')](),controller['index']);router[_0xd61e('0x5')](_0xd61e('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xd61e('0x5')](_0xd61e('0x8'),auth['isAuthenticated'](),controller[_0xd61e('0x9')]);router[_0xd61e('0x5')](_0xd61e('0xa'),auth[_0xd61e('0x6')](),controller[_0xd61e('0xb')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xd61e('0x5')](_0xd61e('0xc'),auth[_0xd61e('0x6')](),controller[_0xd61e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd61e('0xe')](_0xd61e('0xf'),auth[_0xd61e('0x6')](),controller['addTeams']);router['post']('/:id/users',auth[_0xd61e('0x6')](),controller[_0xd61e('0x10')]);router[_0xd61e('0x11')]('/:id',auth[_0xd61e('0x6')](),controller[_0xd61e('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd61e('0x13')](_0xd61e('0xf'),auth[_0xd61e('0x6')](),controller['removeTeams']);router['delete'](_0xd61e('0xc'),auth['isAuthenticated'](),controller[_0xd61e('0x14')]);module[_0xd61e('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5a34432..d46d5af 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 _0xf4dd=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x64f4ae,_0x43bd40){_0x64f4ae=_0x64f4ae-0x0;var _0x4be1ce=_0xf4dd[_0x64f4ae];return _0x4be1ce;};'use strict';var Sequelize=require(_0xdf4d('0x0'));module[_0xdf4d('0x1')]={'name':{'type':Sequelize[_0xdf4d('0x2')],'unique':_0xdf4d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdf4d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdf4d('0x5')](_0xdf4d('0x6'),'beepall',_0xdf4d('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfa7c=['rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x573898,_0x17ee35){var _0x4a1528=function(_0x35169b){while(--_0x35169b){_0x573898['push'](_0x573898['shift']());}};_0x4a1528(++_0x17ee35);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x10cf32,_0x47abf4){_0x10cf32=_0x10cf32-0x0;var _0x4270da=_0xfa7c[_0x10cf32];return _0x4270da;};'use strict';var Sequelize=require(_0xcfa7('0x0'));module['exports']={'name':{'type':Sequelize[_0xcfa7('0x1')],'unique':_0xcfa7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcfa7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcfa7('0x4')](_0xcfa7('0x5'),_0xcfa7('0x6'),_0xcfa7('0x7'))},'description':{'type':Sequelize[_0xcfa7('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8cafb7d..f3fb816 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 _0x204e=['WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userWhatsappQueue:save','removeTeams','field','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','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','getMembers','findOne'];(function(_0x7e918f,_0x48cf10){var _0x5b35ab=function(_0x1455be){while(--_0x1455be){_0x7e918f['push'](_0x7e918f['shift']());}};_0x5b35ab(++_0x48cf10);}(_0x204e,0xc8));var _0xe204=function(_0x1f2186,_0x5eb77f){_0x1f2186=_0x1f2186-0x0;var _0x3b6279=_0x204e[_0x1f2186];return _0x3b6279;};'use strict';var emlformat=require(_0xe204('0x0'));var rimraf=require(_0xe204('0x1'));var zipdir=require(_0xe204('0x2'));var jsonpatch=require(_0xe204('0x3'));var rp=require(_0xe204('0x4'));var moment=require(_0xe204('0x5'));var BPromise=require(_0xe204('0x6'));var Mustache=require(_0xe204('0x7'));var util=require(_0xe204('0x8'));var path=require(_0xe204('0x9'));var sox=require(_0xe204('0xa'));var csv=require(_0xe204('0xb'));var ejs=require(_0xe204('0xc'));var fs=require('fs');var fs_extra=require(_0xe204('0xd'));var _=require(_0xe204('0xe'));var squel=require(_0xe204('0xf'));var crypto=require(_0xe204('0x10'));var jsforce=require(_0xe204('0x11'));var deskjs=require(_0xe204('0x12'));var toCsv=require(_0xe204('0xb'));var querystring=require(_0xe204('0x13'));var Papa=require(_0xe204('0x14'));var Redis=require(_0xe204('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xe204('0x16'));var as=require(_0xe204('0x17'));var hardwareService=require(_0xe204('0x18'));var logger=require('../../config/logger')(_0xe204('0x19'));var utils=require('../../config/utils');var config=require(_0xe204('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe204('0x1b'))['db'];config[_0xe204('0x1c')]=_['defaults'](config[_0xe204('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xe204('0x1d'))(new Redis(config[_0xe204('0x1c')]));require(_0xe204('0x1e'))['register'](socket);function respondWithStatusCode(_0x56d7a2,_0x44aa32){_0x44aa32=_0x44aa32||0xcc;return function(_0x2ab01a){if(_0x2ab01a){return _0x56d7a2[_0xe204('0x1f')](_0x44aa32);}return _0x56d7a2[_0xe204('0x20')](_0x44aa32)[_0xe204('0x21')]();};}function respondWithResult(_0x321718,_0x35137f){_0x35137f=_0x35137f||0xc8;return function(_0x4ef01a){if(_0x4ef01a){return _0x321718['status'](_0x35137f)[_0xe204('0x22')](_0x4ef01a);}};}function respondWithFilteredResult(_0xbc4d0,_0x2974c0){return function(_0x5b2da1){if(_0x5b2da1){var _0x1a9ce3=typeof _0x2974c0[_0xe204('0x23')]===_0xe204('0x24')&&typeof _0x2974c0['limit']===_0xe204('0x24');var _0x166d2a=_0x5b2da1[_0xe204('0x25')];var _0x2eaa95=_0x1a9ce3?0x0:_0x2974c0[_0xe204('0x23')];var _0x294b59=_0x1a9ce3?_0x5b2da1[_0xe204('0x25')]:_0x2974c0[_0xe204('0x23')]+_0x2974c0['limit'];var _0x3be5ab;if(_0x294b59>=_0x166d2a){_0x294b59=_0x166d2a;_0x3be5ab=0xc8;}else{_0x3be5ab=0xce;}_0xbc4d0[_0xe204('0x20')](_0x3be5ab);return _0xbc4d0[_0xe204('0x26')](_0xe204('0x27'),_0x2eaa95+'-'+_0x294b59+'/'+_0x166d2a)['json'](_0x5b2da1);}return null;};}function patchUpdates(_0x1d9dac){return function(_0xcbbc3a){try{jsonpatch[_0xe204('0x28')](_0xcbbc3a,_0x1d9dac,!![]);}catch(_0x3d8524){return BPromise[_0xe204('0x29')](_0x3d8524);}return _0xcbbc3a[_0xe204('0x2a')]();};}function saveUpdates(_0x45709c,_0x3302c3){return function(_0x375d95){if(_0x375d95){return _0x375d95[_0xe204('0x2b')](_0x45709c)[_0xe204('0x2c')](function(_0xab1163){return _0xab1163;});}return null;};}function removeEntity(_0x2199ae,_0x18e5c4){return function(_0x255228){if(_0x255228){return _0x255228[_0xe204('0x2d')]()['then'](function(){var _0x478031=_0x255228[_0xe204('0x2e')]({'plain':!![]});var _0x383abb=_0xe204('0x2f');return db[_0xe204('0x30')][_0xe204('0x2d')]({'where':{'type':_0x383abb,'resourceId':_0x478031['id']}})[_0xe204('0x2c')](function(){return _0x255228;});})[_0xe204('0x2c')](function(){_0x2199ae[_0xe204('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e0c0,_0x483d73){return function(_0xee9952){if(!_0xee9952){_0x35e0c0['sendStatus'](0x194);}return _0xee9952;};}function handleError(_0x68f602,_0x1ce6eb){_0x1ce6eb=_0x1ce6eb||0x1f4;return function(_0x43f5f0){logger[_0xe204('0x31')](_0x43f5f0[_0xe204('0x32')]);if(_0x43f5f0[_0xe204('0x33')]){delete _0x43f5f0[_0xe204('0x33')];}_0x68f602['status'](_0x1ce6eb)[_0xe204('0x34')](_0x43f5f0);};}exports['index']=function(_0x58dc65,_0x239b91){var _0x2502ed={},_0x227a0b={},_0x5db06b={'count':0x0,'rows':[]};var _0x4a80b2=_[_0xe204('0x35')](db[_0xe204('0x36')]['rawAttributes'],function(_0xff602a){return{'name':_0xff602a[_0xe204('0x37')],'type':_0xff602a[_0xe204('0x38')][_0xe204('0x39')]};});_0x227a0b[_0xe204('0x3a')]=_[_0xe204('0x35')](_0x4a80b2,_0xe204('0x33'));_0x227a0b['query']=_['keys'](_0x58dc65[_0xe204('0x3b')]);_0x227a0b[_0xe204('0x3c')]=_[_0xe204('0x3d')](_0x227a0b['model'],_0x227a0b[_0xe204('0x3b')]);_0x2502ed[_0xe204('0x3e')]=_[_0xe204('0x3d')](_0x227a0b['model'],qs[_0xe204('0x3f')](_0x58dc65[_0xe204('0x3b')]['fields']));_0x2502ed[_0xe204('0x3e')]=_0x2502ed[_0xe204('0x3e')][_0xe204('0x40')]?_0x2502ed['attributes']:_0x227a0b['model'];if(!_0x58dc65[_0xe204('0x3b')][_0xe204('0x41')](_0xe204('0x42'))){_0x2502ed[_0xe204('0x43')]=qs[_0xe204('0x43')](_0x58dc65[_0xe204('0x3b')][_0xe204('0x43')]);_0x2502ed[_0xe204('0x23')]=qs[_0xe204('0x23')](_0x58dc65[_0xe204('0x3b')][_0xe204('0x23')]);}_0x2502ed[_0xe204('0x44')]=qs['sort'](_0x58dc65[_0xe204('0x3b')][_0xe204('0x45')]);_0x2502ed[_0xe204('0x46')]=qs[_0xe204('0x3c')](_[_0xe204('0x47')](_0x58dc65[_0xe204('0x3b')],_0x227a0b[_0xe204('0x3c')]),_0x4a80b2);if(_0x58dc65[_0xe204('0x3b')][_0xe204('0x48')]){_0x2502ed[_0xe204('0x46')]=_[_0xe204('0x49')](_0x2502ed[_0xe204('0x46')],{'$or':_['map'](_0x4a80b2,function(_0x11b52d){if(_0x11b52d[_0xe204('0x38')]!==_0xe204('0x4a')){var _0x2b504f={};_0x2b504f[_0x11b52d[_0xe204('0x33')]]={'$like':'%'+_0x58dc65[_0xe204('0x3b')][_0xe204('0x48')]+'%'};return _0x2b504f;}})});}_0x2502ed=_[_0xe204('0x49')]({},_0x2502ed,_0x58dc65['options']);var _0x811810={'where':_0x2502ed['where']};return db[_0xe204('0x36')][_0xe204('0x25')](_0x811810)[_0xe204('0x2c')](function(_0x5b9812){_0x5db06b[_0xe204('0x25')]=_0x5b9812;if(_0x58dc65[_0xe204('0x3b')]['includeAll']){_0x2502ed['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0xe204('0x4b')](_0x2502ed);})[_0xe204('0x2c')](function(_0x568b25){_0x5db06b[_0xe204('0x4c')]=_0x568b25;return _0x5db06b;})[_0xe204('0x2c')](respondWithFilteredResult(_0x239b91,_0x2502ed))[_0xe204('0x4d')](handleError(_0x239b91,null));};exports[_0xe204('0x4e')]=function(_0x21334d,_0x28f908){var _0x54bd3f={'raw':!![],'where':{'id':_0x21334d[_0xe204('0x4f')]['id']}},_0x1d6b68={};_0x1d6b68[_0xe204('0x3a')]=_[_0xe204('0x50')](db['WhatsappQueue'][_0xe204('0x51')]);_0x1d6b68[_0xe204('0x3b')]=_[_0xe204('0x50')](_0x21334d[_0xe204('0x3b')]);_0x1d6b68[_0xe204('0x3c')]=_['intersection'](_0x1d6b68[_0xe204('0x3a')],_0x1d6b68[_0xe204('0x3b')]);_0x54bd3f['attributes']=_['intersection'](_0x1d6b68[_0xe204('0x3a')],qs['fields'](_0x21334d[_0xe204('0x3b')][_0xe204('0x3f')]));_0x54bd3f[_0xe204('0x3e')]=_0x54bd3f['attributes'][_0xe204('0x40')]?_0x54bd3f[_0xe204('0x3e')]:_0x1d6b68[_0xe204('0x3a')];if(_0x21334d[_0xe204('0x3b')][_0xe204('0x52')]){_0x54bd3f['include']=[{'all':!![]}];}_0x54bd3f=_[_0xe204('0x49')]({},_0x54bd3f,_0x21334d[_0xe204('0x53')]);return db['WhatsappQueue'][_0xe204('0x54')](_0x54bd3f)[_0xe204('0x2c')](handleEntityNotFound(_0x28f908,null))[_0xe204('0x2c')](respondWithResult(_0x28f908,null))[_0xe204('0x4d')](handleError(_0x28f908,null));};exports[_0xe204('0x55')]=function(_0x2dde55,_0x392545){return db[_0xe204('0x36')]['create'](_0x2dde55[_0xe204('0x56')],{})[_0xe204('0x2c')](function(_0x1a5fae){var _0x3d5e8b=_0x2dde55[_0xe204('0x57')][_0xe204('0x2e')]({'plain':!![]});if(!_0x3d5e8b)throw new Error(_0xe204('0x58'));if(_0x3d5e8b[_0xe204('0x59')]===_0xe204('0x57')){var _0x12a8ef=_0x1a5fae[_0xe204('0x2e')]({'plain':!![]});var _0x31b86a=_0xe204('0x2f');return db['UserProfileSection']['find']({'where':{'name':_0x31b86a,'userProfileId':_0x3d5e8b[_0xe204('0x5a')]},'raw':!![]})[_0xe204('0x2c')](function(_0x17826d){if(_0x17826d&&_0x17826d[_0xe204('0x5b')]===0x0){return db[_0xe204('0x30')]['create']({'name':_0x12a8ef[_0xe204('0x33')],'resourceId':_0x12a8ef['id'],'type':_0x17826d[_0xe204('0x33')],'sectionId':_0x17826d['id']},{})[_0xe204('0x2c')](function(){return _0x1a5fae;});}else{return _0x1a5fae;}})[_0xe204('0x4d')](function(_0xfd0368){logger[_0xe204('0x31')](_0xe204('0x5c'),_0xfd0368);throw _0xfd0368;});}return _0x1a5fae;})[_0xe204('0x2c')](respondWithResult(_0x392545,0xc9))[_0xe204('0x4d')](handleError(_0x392545,null));};exports['update']=function(_0x365e50,_0xea4a34){if(_0x365e50['body']['id']){delete _0x365e50[_0xe204('0x56')]['id'];}return db[_0xe204('0x36')]['find']({'where':{'id':_0x365e50[_0xe204('0x4f')]['id']}})[_0xe204('0x2c')](handleEntityNotFound(_0xea4a34,null))['then'](saveUpdates(_0x365e50[_0xe204('0x56')],null))[_0xe204('0x2c')](respondWithResult(_0xea4a34,null))[_0xe204('0x4d')](handleError(_0xea4a34,null));};exports['destroy']=function(_0x38c5db,_0x40f41e){return db[_0xe204('0x36')][_0xe204('0x54')]({'where':{'id':_0x38c5db[_0xe204('0x4f')]['id']}})[_0xe204('0x2c')](handleEntityNotFound(_0x40f41e,null))[_0xe204('0x2c')](removeEntity(_0x40f41e,null))[_0xe204('0x4d')](handleError(_0x40f41e,null));};exports[_0xe204('0x5d')]=function(_0x595d33,_0x58dcef){return db[_0xe204('0x36')][_0xe204('0x5d')]()['then'](respondWithResult(_0x58dcef,null))[_0xe204('0x4d')](handleError(_0x58dcef,null));};exports[_0xe204('0x5e')]=function(_0x3a29d6,_0x19be24,_0x3d81d1){var _0x114dde={'raw':!![],'where':{}},_0x2fcd7e={},_0x429a2d;return db['WhatsappQueue'][_0xe204('0x5f')]({'where':{'id':_0x3a29d6[_0xe204('0x4f')]['id']}})[_0xe204('0x2c')](handleEntityNotFound(_0x19be24,null))[_0xe204('0x2c')](function(_0xbeda12){if(_0xbeda12){_0x429a2d=_0xbeda12[_0xe204('0x2e')]({'plain':!![]});_0x2fcd7e['model']=_['keys'](db['UserWhatsappQueue']['rawAttributes']);_0x2fcd7e[_0xe204('0x3b')]=_[_0xe204('0x50')](_0x3a29d6[_0xe204('0x3b')]);_0x2fcd7e['filters']=_[_0xe204('0x3d')](_0x2fcd7e['model'],_0x2fcd7e[_0xe204('0x3b')]);_0x114dde[_0xe204('0x3e')]=_[_0xe204('0x3d')](_0x2fcd7e[_0xe204('0x3a')],qs['fields'](_0x3a29d6[_0xe204('0x3b')][_0xe204('0x3f')]));_0x114dde['attributes']=_0x114dde['attributes'][_0xe204('0x40')]?_0x114dde[_0xe204('0x3e')]:_0x2fcd7e[_0xe204('0x3a')];if(!_0x3a29d6[_0xe204('0x3b')][_0xe204('0x41')](_0xe204('0x42'))){_0x114dde[_0xe204('0x43')]=qs['limit'](_0x3a29d6[_0xe204('0x3b')]['limit']);_0x114dde[_0xe204('0x23')]=qs[_0xe204('0x23')](_0x3a29d6[_0xe204('0x3b')][_0xe204('0x23')]);}_0x114dde['order']=qs['sort'](_0x3a29d6['query'][_0xe204('0x45')]);_0x114dde[_0xe204('0x46')]=qs[_0xe204('0x3c')](_['pick'](_0x3a29d6[_0xe204('0x3b')],_0x2fcd7e[_0xe204('0x3c')]));_0x114dde[_0xe204('0x46')][_0xe204('0x60')]=_0xbeda12['id'];if(_0x3a29d6[_0xe204('0x3b')][_0xe204('0x48')]){_0x114dde[_0xe204('0x46')]=_['merge'](_0x114dde[_0xe204('0x46')],{'$or':_[_0xe204('0x35')](_0x114dde['attributes'],function(_0x4f945f){var _0xa5e529={};_0xa5e529[_0x4f945f]={'$like':'%'+_0x3a29d6[_0xe204('0x3b')]['filter']+'%'};return _0xa5e529;})});}_0x114dde=_['merge']({},_0x114dde,_0x3a29d6['options']);return db[_0xe204('0x61')][_0xe204('0x4b')](_0x114dde);}})['then'](function(_0x24634f){if(_0x24634f){return db[_0xe204('0x62')][_0xe204('0x63')]({'where':{'id':_['map'](_0x24634f,_0xe204('0x64')),'role':_0xe204('0x65')},'attributes':['id',_0xe204('0x33'),_0xe204('0x66'),_0xe204('0x67'),'createdAt']});}})[_0xe204('0x2c')](function(_0x3a1833){if(_0x3a1833){return{'count':_0x3a1833[_0xe204('0x25')],'rows':_[_0xe204('0x35')](_0x3a1833[_0xe204('0x4c')],function(_0x31d0fc){return{'membername':_0x31d0fc['name'],'UserId':_0x31d0fc['id'],'queue_name':_0x429a2d[_0xe204('0x33')],'WhatsappQueueId':_0x429a2d['id'],'interface':util['format'](_0xe204('0x68'),_0xe204('0x69'),_0x31d0fc['name']),'penalty':0x0,'paused':_0x31d0fc[_0xe204('0x66')],'createdAt':_0x31d0fc[_0xe204('0x6a')],'updatedAt':_0x31d0fc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe204('0x2c')](respondWithFilteredResult(_0x19be24,_0x114dde))[_0xe204('0x4d')](handleError(_0x19be24,null));};exports[_0xe204('0x6b')]=function(_0x2717f7,_0xdee01b,_0x5cdc5e){var _0x4c1a89={};var _0x2665fa={};var _0x2b63a7;var _0x1a42be;return db[_0xe204('0x36')][_0xe204('0x5f')]({'where':{'id':_0x2717f7[_0xe204('0x4f')]['id']}})[_0xe204('0x2c')](handleEntityNotFound(_0xdee01b,null))['then'](function(_0x47fd15){if(_0x47fd15){_0x2b63a7=_0x47fd15;_0x2665fa['model']=_['keys'](db[_0xe204('0x6c')][_0xe204('0x51')]);_0x2665fa[_0xe204('0x3b')]=_[_0xe204('0x50')](_0x2717f7['query']);_0x2665fa[_0xe204('0x3c')]=_[_0xe204('0x3d')](_0x2665fa[_0xe204('0x3a')],_0x2665fa[_0xe204('0x3b')]);_0x4c1a89['attributes']=_[_0xe204('0x3d')](_0x2665fa[_0xe204('0x3a')],qs[_0xe204('0x3f')](_0x2717f7[_0xe204('0x3b')]['fields']));_0x4c1a89[_0xe204('0x3e')]=_0x4c1a89[_0xe204('0x3e')][_0xe204('0x40')]?_0x4c1a89[_0xe204('0x3e')]:_0x2665fa['model'];_0x4c1a89[_0xe204('0x44')]=qs[_0xe204('0x45')](_0x2717f7['query'][_0xe204('0x45')]);_0x4c1a89[_0xe204('0x46')]=qs[_0xe204('0x3c')](_[_0xe204('0x47')](_0x2717f7['query'],_0x2665fa[_0xe204('0x3c')]));if(_0x2717f7[_0xe204('0x3b')][_0xe204('0x48')]){_0x4c1a89[_0xe204('0x46')]=_['merge'](_0x4c1a89[_0xe204('0x46')],{'$or':_[_0xe204('0x35')](_0x4c1a89['attributes'],function(_0x34ec92){var _0x1ff7ca={};_0x1ff7ca[_0x34ec92]={'$like':'%'+_0x2717f7[_0xe204('0x3b')][_0xe204('0x48')]+'%'};return _0x1ff7ca;})});}_0x4c1a89=_[_0xe204('0x49')]({},_0x4c1a89,_0x2717f7[_0xe204('0x53')]);return _0x2b63a7[_0xe204('0x6b')](_0x4c1a89);}})['then'](function(_0x2c9381){if(_0x2c9381){_0x1a42be=_0x2c9381[_0xe204('0x40')];if(!_0x2717f7[_0xe204('0x3b')][_0xe204('0x41')]('nolimit')){_0x4c1a89[_0xe204('0x43')]=qs[_0xe204('0x43')](_0x2717f7[_0xe204('0x3b')][_0xe204('0x43')]);_0x4c1a89[_0xe204('0x23')]=qs['offset'](_0x2717f7[_0xe204('0x3b')][_0xe204('0x23')]);}return _0x2b63a7[_0xe204('0x6b')](_0x4c1a89);}})[_0xe204('0x2c')](function(_0x262b88){if(_0x262b88){return _0x262b88?{'count':_0x1a42be,'rows':_0x262b88}:null;}})[_0xe204('0x2c')](respondWithResult(_0xdee01b,null))['catch'](handleError(_0xdee01b,null));};exports[_0xe204('0x6d')]=function(_0x22d77c,_0x554a26,_0x35d19d){var _0x215a04=_0x22d77c[_0xe204('0x56')][_0xe204('0x6e')];return db[_0xe204('0x6c')][_0xe204('0x4b')]({'where':{'id':_0x215a04},'attributes':['id'],'include':[{'model':db[_0xe204('0x62')],'as':_0xe204('0x6f'),'attributes':['id','name',_0xe204('0x70'),'voicePause',_0xe204('0x71')],'raw':!![]}]})['then'](function(_0x64dd7b){if(_0x64dd7b){var _0x511927=_[_0xe204('0x72')](_0x64dd7b,function(_0x41479b){var _0x2c421e=_0x41479b[_0xe204('0x2e')]({'plain':!![]});return _0x2c421e['Agents'];});return db[_0xe204('0x36')]['find']({'where':{'id':_0x22d77c[_0xe204('0x4f')]['id']}})['then'](function(_0x368279){return db[_0xe204('0x73')][_0xe204('0x74')](function(_0x58b63c){return _0x368279['addTeams'](_0x215a04,{'transaction':_0x58b63c})[_0xe204('0x2c')](function(){return BPromise[_0xe204('0x75')](_0x511927,function(_0x4f13f8){return db[_0xe204('0x61')][_0xe204('0x76')]({'where':{'UserId':_0x4f13f8['id'],'WhatsappQueueId':_0x22d77c[_0xe204('0x4f')]['id']},'transaction':_0x58b63c});});})[_0xe204('0x2c')](function(){_0x511927['forEach'](function(_0x49aae9){socket['emit'](_0xe204('0x77'),{'UserId':_0x49aae9['id'],'WhatsappQueueId':_0x368279['id']});});});});});}})[_0xe204('0x2c')](respondWithStatusCode(_0x554a26,null))[_0xe204('0x4d')](handleError(_0x554a26,null));};exports[_0xe204('0x78')]=function(_0x2a2bc9,_0x5169e3,_0x1f3b7b){return db[_0xe204('0x6c')][_0xe204('0x4b')]({'where':{'id':_0x2a2bc9[_0xe204('0x3b')][_0xe204('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xe204('0x62')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe204('0x2c')](handleEntityNotFound(_0x5169e3,null))[_0xe204('0x2c')](function(_0x1fe39c){var _0x2035fe=_['map'](_0x1fe39c,'id');var _0x3cde75=[];var _0x1ce545=[];var _0x2ab392=squel['select']();_0x2ab392[_0xe204('0x79')]('tq.TeamId')[_0xe204('0x7a')](_0xe204('0x7b'),'tq')[_0xe204('0x7c')](_0xe204('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe204('0x46')](_0xe204('0x7e'),_0x2a2bc9[_0xe204('0x4f')]['id']);for(var _0x341c68=0x0;_0x341c68<_0x1fe39c['length'];_0x341c68+=0x1){let _0x5e5e82=_0x1fe39c[_0x341c68];for(var _0x24218d=0x0;_0x24218d<_0x5e5e82[_0xe204('0x6f')][_0xe204('0x40')];_0x24218d+=0x1){let _0x342cab=_0x5e5e82['Agents'][_0x24218d];var _0xfb3d23=_0x2ab392[_0xe204('0x7f')]();_0xfb3d23['where'](_0xe204('0x80'),_0x342cab['id']);_0x1ce545[_0xe204('0x81')](db[_0xe204('0x73')]['query'](_0xfb3d23[_0xe204('0x82')](),{'type':db['sequelize'][_0xe204('0x83')][_0xe204('0x84')]})['then'](function(_0x25ff78){if(_0x25ff78[_0xe204('0x40')]===0x1){return _0x342cab['id'];}else{var _0x245258=_[_0xe204('0x85')](_[_0xe204('0x35')](_0x25ff78,_0xe204('0x86')),function(_0x1a3824){return _[_0xe204('0x87')](_0x2035fe,_0x1a3824);});if(_0x245258){return _0x342cab['id'];}}}));}}return BPromise[_0xe204('0x88')](_0x1ce545)[_0xe204('0x2c')](function(_0x45f8c8){_0x3cde75=_(_0x3cde75)[_0xe204('0x89')](_0x45f8c8)['compact']()[_0xe204('0x8a')]();return db[_0xe204('0x36')][_0xe204('0x54')]({'where':{'id':_0x2a2bc9[_0xe204('0x4f')]['id']}})['then'](function(_0x23137d){return db['sequelize'][_0xe204('0x74')](function(_0x258b96){return _0x23137d[_0xe204('0x78')](_0x2a2bc9['query'][_0xe204('0x6e')],{'transaction':_0x258b96})['then'](function(){if(!_[_0xe204('0x8b')](_0x3cde75)){return _0x23137d[_0xe204('0x8c')](_0x3cde75,{'transaction':_0x258b96});}})['then'](function(){_0x3cde75['forEach'](function(_0x930c49){socket[_0xe204('0x8d')](_0xe204('0x8e'),{'UserId':_0x930c49,'WhatsappQueueId':_0x23137d['id']});});});});});});})[_0xe204('0x2c')](respondWithStatusCode(_0x5169e3,null))[_0xe204('0x4d')](handleError(_0x5169e3,null));};exports[_0xe204('0x8f')]=function(_0x19f7b7,_0xe4e5e5,_0xc527c2){return db[_0xe204('0x36')][_0xe204('0x54')]({'where':{'id':_0x19f7b7[_0xe204('0x4f')]['id']}})[_0xe204('0x2c')](handleEntityNotFound(_0xe4e5e5,null))[_0xe204('0x2c')](function(_0x15d676){if(_0x15d676){return _0x15d676['addAgents'](_0x19f7b7[_0xe204('0x56')][_0xe204('0x6e')],_[_0xe204('0x90')](_0x19f7b7['body'],[_0xe204('0x6e'),'id'])||{})[_0xe204('0x91')](function(_0x28efd5){for(var _0x3d2f8b=0x0;_0x3d2f8b<_0x19f7b7['body'][_0xe204('0x6e')][_0xe204('0x40')];_0x3d2f8b+=0x1){socket[_0xe204('0x8d')](_0xe204('0x77'),{'UserId':Number(_0x19f7b7[_0xe204('0x56')][_0xe204('0x6e')][_0x3d2f8b]),'WhatsappQueueId':Number(_0x19f7b7[_0xe204('0x4f')]['id'])});}return _0x28efd5;});}})[_0xe204('0x2c')](respondWithResult(_0xe4e5e5,null))[_0xe204('0x4d')](handleError(_0xe4e5e5,null));};exports[_0xe204('0x8c')]=function(_0x5e8586,_0x625335,_0x399edd){return db[_0xe204('0x36')][_0xe204('0x54')]({'where':{'id':_0x5e8586['params']['id']}})['then'](handleEntityNotFound(_0x625335,null))[_0xe204('0x2c')](function(_0x5af442){if(_0x5af442){return _0x5af442[_0xe204('0x8c')](_0x5e8586[_0xe204('0x3b')][_0xe204('0x6e')])[_0xe204('0x2c')](function(){if(_[_0xe204('0x92')](_0x5e8586[_0xe204('0x3b')][_0xe204('0x6e')])){for(var _0x56629c=0x0;_0x56629c<_0x5e8586[_0xe204('0x3b')][_0xe204('0x6e')][_0xe204('0x40')];_0x56629c+=0x1){socket['emit'](_0xe204('0x8e'),{'UserId':Number(_0x5e8586[_0xe204('0x3b')][_0xe204('0x6e')][_0x56629c]),'WhatsappQueueId':Number(_0x5e8586[_0xe204('0x4f')]['id'])});}}else{socket[_0xe204('0x8d')](_0xe204('0x8e'),{'UserId':Number(_0x5e8586['query'][_0xe204('0x6e')]),'WhatsappQueueId':Number(_0x5e8586[_0xe204('0x4f')]['id'])});}});}})[_0xe204('0x2c')](respondWithStatusCode(_0x625335,null))[_0xe204('0x4d')](handleError(_0x625335,null));};exports[_0xe204('0x93')]=function(_0x2ec7af,_0x2cf12b,_0x1f492e){var _0x50ba26={};var _0x46c9a2={};var _0x5ec7ec;var _0x40b1d7;return db[_0xe204('0x36')][_0xe204('0x5f')]({'where':{'id':_0x2ec7af[_0xe204('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2cf12b,null))[_0xe204('0x2c')](function(_0x527ab3){if(_0x527ab3){_0x5ec7ec=_0x527ab3;_0x46c9a2[_0xe204('0x3a')]=_['keys'](db[_0xe204('0x62')][_0xe204('0x51')]);_0x46c9a2[_0xe204('0x3b')]=_[_0xe204('0x50')](_0x2ec7af[_0xe204('0x3b')]);_0x46c9a2[_0xe204('0x3c')]=_[_0xe204('0x3d')](_0x46c9a2[_0xe204('0x3a')],_0x46c9a2[_0xe204('0x3b')]);_0x50ba26['attributes']=_[_0xe204('0x3d')](_0x46c9a2[_0xe204('0x3a')],qs['fields'](_0x2ec7af['query'][_0xe204('0x3f')]));_0x50ba26[_0xe204('0x3e')]=_0x50ba26[_0xe204('0x3e')][_0xe204('0x40')]?_0x50ba26['attributes']:_0x46c9a2['model'];_0x50ba26['order']=qs[_0xe204('0x45')](_0x2ec7af[_0xe204('0x3b')]['sort']);_0x50ba26[_0xe204('0x46')]=qs['filters'](_[_0xe204('0x47')](_0x2ec7af[_0xe204('0x3b')],_0x46c9a2[_0xe204('0x3c')]));if(_0x2ec7af[_0xe204('0x3b')][_0xe204('0x48')]){_0x50ba26['where']=_[_0xe204('0x49')](_0x50ba26[_0xe204('0x46')],{'$or':_[_0xe204('0x35')](_0x50ba26['attributes'],function(_0x2a1580){var _0x31d7a5={};_0x31d7a5[_0x2a1580]={'$like':'%'+_0x2ec7af['query']['filter']+'%'};return _0x31d7a5;})});}_0x50ba26=_[_0xe204('0x49')]({},_0x50ba26,_0x2ec7af[_0xe204('0x53')]);return _0x5ec7ec[_0xe204('0x93')](_0x50ba26);}})[_0xe204('0x2c')](function(_0xadd2cf){if(_0xadd2cf){_0x40b1d7=_0xadd2cf[_0xe204('0x40')];if(!_0x2ec7af[_0xe204('0x3b')]['hasOwnProperty']('nolimit')){_0x50ba26[_0xe204('0x43')]=qs['limit'](_0x2ec7af[_0xe204('0x3b')][_0xe204('0x43')]);_0x50ba26[_0xe204('0x23')]=qs[_0xe204('0x23')](_0x2ec7af[_0xe204('0x3b')]['offset']);}return _0x5ec7ec[_0xe204('0x93')](_0x50ba26);}})[_0xe204('0x2c')](function(_0x36991e){if(_0x36991e){return _0x36991e?{'count':_0x40b1d7,'rows':_0x36991e}:null;}})['then'](respondWithResult(_0x2cf12b,null))[_0xe204('0x4d')](handleError(_0x2cf12b,null));}; \ No newline at end of file +var _0x9e11=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','hasOwnProperty','nolimit','ids','Agents','online','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','Team','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','map','WhatsappQueue','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9e11,0x1dd));var _0x19e1=function(_0x51d59a,_0x298939){_0x51d59a=_0x51d59a-0x0;var _0x193f56=_0x9e11[_0x51d59a];return _0x193f56;};'use strict';var emlformat=require(_0x19e1('0x0'));var rimraf=require(_0x19e1('0x1'));var zipdir=require(_0x19e1('0x2'));var jsonpatch=require(_0x19e1('0x3'));var rp=require(_0x19e1('0x4'));var moment=require(_0x19e1('0x5'));var BPromise=require(_0x19e1('0x6'));var Mustache=require(_0x19e1('0x7'));var util=require(_0x19e1('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x19e1('0x9'));var ejs=require(_0x19e1('0xa'));var fs=require('fs');var fs_extra=require(_0x19e1('0xb'));var _=require(_0x19e1('0xc'));var squel=require('squel');var crypto=require(_0x19e1('0xd'));var jsforce=require(_0x19e1('0xe'));var deskjs=require(_0x19e1('0xf'));var toCsv=require(_0x19e1('0x9'));var querystring=require(_0x19e1('0x10'));var Papa=require('papaparse');var Redis=require(_0x19e1('0x11'));var authService=require(_0x19e1('0x12'));var qs=require(_0x19e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19e1('0x14'));var logger=require(_0x19e1('0x15'))(_0x19e1('0x16'));var utils=require('../../config/utils');var config=require(_0x19e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x19e1('0x18'))['db'];config[_0x19e1('0x19')]=_['defaults'](config[_0x19e1('0x19')],{'host':_0x19e1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19e1('0x19')]));require(_0x19e1('0x1b'))[_0x19e1('0x1c')](socket);function respondWithStatusCode(_0x358287,_0x23932a){_0x23932a=_0x23932a||0xcc;return function(_0x213f45){if(_0x213f45){return _0x358287[_0x19e1('0x1d')](_0x23932a);}return _0x358287[_0x19e1('0x1e')](_0x23932a)[_0x19e1('0x1f')]();};}function respondWithResult(_0x308c25,_0x2bea86){_0x2bea86=_0x2bea86||0xc8;return function(_0x2654e2){if(_0x2654e2){return _0x308c25[_0x19e1('0x1e')](_0x2bea86)[_0x19e1('0x20')](_0x2654e2);}};}function respondWithFilteredResult(_0x30dfc2,_0x502737){return function(_0x4ed67b){if(_0x4ed67b){var _0x3336a3=typeof _0x502737[_0x19e1('0x21')]==='undefined'&&typeof _0x502737[_0x19e1('0x22')]==='undefined';var _0x1dd428=_0x4ed67b['count'];var _0xf61ba6=_0x3336a3?0x0:_0x502737['offset'];var _0x4c5db5=_0x3336a3?_0x4ed67b[_0x19e1('0x23')]:_0x502737['offset']+_0x502737['limit'];var _0x5b1dbd;if(_0x4c5db5>=_0x1dd428){_0x4c5db5=_0x1dd428;_0x5b1dbd=0xc8;}else{_0x5b1dbd=0xce;}_0x30dfc2[_0x19e1('0x1e')](_0x5b1dbd);return _0x30dfc2[_0x19e1('0x24')]('Content-Range',_0xf61ba6+'-'+_0x4c5db5+'/'+_0x1dd428)[_0x19e1('0x20')](_0x4ed67b);}return null;};}function patchUpdates(_0x3009d0){return function(_0x2816eb){try{jsonpatch[_0x19e1('0x25')](_0x2816eb,_0x3009d0,!![]);}catch(_0x22663a){return BPromise[_0x19e1('0x26')](_0x22663a);}return _0x2816eb[_0x19e1('0x27')]();};}function saveUpdates(_0xf43b0d,_0x5c16b8){return function(_0x48c4a8){if(_0x48c4a8){return _0x48c4a8[_0x19e1('0x28')](_0xf43b0d)[_0x19e1('0x29')](function(_0x18d7af){return _0x18d7af;});}return null;};}function removeEntity(_0xc61906,_0x4a0d84){return function(_0x476e6d){if(_0x476e6d){return _0x476e6d[_0x19e1('0x2a')]()['then'](function(){var _0xf930d9=_0x476e6d[_0x19e1('0x2b')]({'plain':!![]});var _0x3e80e8=_0x19e1('0x2c');return db[_0x19e1('0x2d')][_0x19e1('0x2a')]({'where':{'type':_0x3e80e8,'resourceId':_0xf930d9['id']}})[_0x19e1('0x29')](function(){return _0x476e6d;});})[_0x19e1('0x29')](function(){_0xc61906[_0x19e1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5e6f0,_0x1f2c3b){return function(_0x296071){if(!_0x296071){_0xc5e6f0[_0x19e1('0x1d')](0x194);}return _0x296071;};}function handleError(_0x13247b,_0x562c23){_0x562c23=_0x562c23||0x1f4;return function(_0x53afcc){logger[_0x19e1('0x2e')](_0x53afcc[_0x19e1('0x2f')]);if(_0x53afcc[_0x19e1('0x30')]){delete _0x53afcc['name'];}_0x13247b['status'](_0x562c23)[_0x19e1('0x31')](_0x53afcc);};}exports['index']=function(_0x44573c,_0x55080a){var _0x17b539={},_0x206978={},_0x2e3751={'count':0x0,'rows':[]};var _0x37e85b=_[_0x19e1('0x32')](db[_0x19e1('0x33')]['rawAttributes'],function(_0x35ed5a){return{'name':_0x35ed5a[_0x19e1('0x34')],'type':_0x35ed5a[_0x19e1('0x35')][_0x19e1('0x36')]};});_0x206978[_0x19e1('0x37')]=_['map'](_0x37e85b,_0x19e1('0x30'));_0x206978[_0x19e1('0x38')]=_[_0x19e1('0x39')](_0x44573c[_0x19e1('0x38')]);_0x206978[_0x19e1('0x3a')]=_['intersection'](_0x206978['model'],_0x206978['query']);_0x17b539[_0x19e1('0x3b')]=_[_0x19e1('0x3c')](_0x206978['model'],qs[_0x19e1('0x3d')](_0x44573c[_0x19e1('0x38')]['fields']));_0x17b539[_0x19e1('0x3b')]=_0x17b539[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x17b539[_0x19e1('0x3b')]:_0x206978['model'];if(!_0x44573c[_0x19e1('0x38')]['hasOwnProperty']('nolimit')){_0x17b539[_0x19e1('0x22')]=qs[_0x19e1('0x22')](_0x44573c[_0x19e1('0x38')][_0x19e1('0x22')]);_0x17b539[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x44573c['query']['offset']);}_0x17b539[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x44573c[_0x19e1('0x38')][_0x19e1('0x40')]);_0x17b539[_0x19e1('0x41')]=qs['filters'](_[_0x19e1('0x42')](_0x44573c['query'],_0x206978[_0x19e1('0x3a')]),_0x37e85b);if(_0x44573c['query'][_0x19e1('0x43')]){_0x17b539[_0x19e1('0x41')]=_[_0x19e1('0x44')](_0x17b539['where'],{'$or':_[_0x19e1('0x32')](_0x37e85b,function(_0x14128e){if(_0x14128e[_0x19e1('0x35')]!==_0x19e1('0x45')){var _0x1e111e={};_0x1e111e[_0x14128e[_0x19e1('0x30')]]={'$like':'%'+_0x44573c[_0x19e1('0x38')]['filter']+'%'};return _0x1e111e;}})});}_0x17b539=_[_0x19e1('0x44')]({},_0x17b539,_0x44573c[_0x19e1('0x46')]);var _0x593151={'where':_0x17b539[_0x19e1('0x41')]};return db[_0x19e1('0x33')][_0x19e1('0x23')](_0x593151)[_0x19e1('0x29')](function(_0x306df1){_0x2e3751[_0x19e1('0x23')]=_0x306df1;if(_0x44573c[_0x19e1('0x38')][_0x19e1('0x47')]){_0x17b539[_0x19e1('0x48')]=[{'all':!![]}];}return db[_0x19e1('0x33')][_0x19e1('0x49')](_0x17b539);})[_0x19e1('0x29')](function(_0x8eadcf){_0x2e3751[_0x19e1('0x4a')]=_0x8eadcf;return _0x2e3751;})[_0x19e1('0x29')](respondWithFilteredResult(_0x55080a,_0x17b539))[_0x19e1('0x4b')](handleError(_0x55080a,null));};exports[_0x19e1('0x4c')]=function(_0x4fbfd5,_0x5bc2b2){var _0x151940={'raw':!![],'where':{'id':_0x4fbfd5[_0x19e1('0x4d')]['id']}},_0xc2ae47={};_0xc2ae47[_0x19e1('0x37')]=_['keys'](db[_0x19e1('0x33')][_0x19e1('0x4e')]);_0xc2ae47[_0x19e1('0x38')]=_['keys'](_0x4fbfd5['query']);_0xc2ae47[_0x19e1('0x3a')]=_['intersection'](_0xc2ae47[_0x19e1('0x37')],_0xc2ae47['query']);_0x151940[_0x19e1('0x3b')]=_[_0x19e1('0x3c')](_0xc2ae47['model'],qs['fields'](_0x4fbfd5[_0x19e1('0x38')]['fields']));_0x151940[_0x19e1('0x3b')]=_0x151940[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x151940['attributes']:_0xc2ae47[_0x19e1('0x37')];if(_0x4fbfd5[_0x19e1('0x38')][_0x19e1('0x47')]){_0x151940[_0x19e1('0x48')]=[{'all':!![]}];}_0x151940=_[_0x19e1('0x44')]({},_0x151940,_0x4fbfd5[_0x19e1('0x46')]);return db['WhatsappQueue'][_0x19e1('0x4f')](_0x151940)[_0x19e1('0x29')](handleEntityNotFound(_0x5bc2b2,null))[_0x19e1('0x29')](respondWithResult(_0x5bc2b2,null))[_0x19e1('0x4b')](handleError(_0x5bc2b2,null));};exports[_0x19e1('0x50')]=function(_0x2e049d,_0x1f49f1){return db[_0x19e1('0x33')]['create'](_0x2e049d[_0x19e1('0x51')],{})[_0x19e1('0x29')](function(_0x29d93d){var _0x47bbde=_0x2e049d[_0x19e1('0x52')][_0x19e1('0x2b')]({'plain':!![]});if(!_0x47bbde)throw new Error(_0x19e1('0x53'));if(_0x47bbde[_0x19e1('0x54')]==='user'){var _0x3094da=_0x29d93d[_0x19e1('0x2b')]({'plain':!![]});var _0x2df62d=_0x19e1('0x2c');return db['UserProfileSection'][_0x19e1('0x4f')]({'where':{'name':_0x2df62d,'userProfileId':_0x47bbde['userProfileId']},'raw':!![]})[_0x19e1('0x29')](function(_0x414cf7){if(_0x414cf7&&_0x414cf7['autoAssociation']===0x0){return db[_0x19e1('0x2d')][_0x19e1('0x50')]({'name':_0x3094da['name'],'resourceId':_0x3094da['id'],'type':_0x414cf7[_0x19e1('0x30')],'sectionId':_0x414cf7['id']},{})[_0x19e1('0x29')](function(){return _0x29d93d;});}else{return _0x29d93d;}})['catch'](function(_0x1006e6){logger['error'](_0x19e1('0x55'),_0x1006e6);throw _0x1006e6;});}return _0x29d93d;})['then'](respondWithResult(_0x1f49f1,0xc9))[_0x19e1('0x4b')](handleError(_0x1f49f1,null));};exports[_0x19e1('0x28')]=function(_0x32e627,_0x54b0ec){if(_0x32e627[_0x19e1('0x51')]['id']){delete _0x32e627[_0x19e1('0x51')]['id'];}return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x32e627[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x54b0ec,null))[_0x19e1('0x29')](saveUpdates(_0x32e627[_0x19e1('0x51')],null))[_0x19e1('0x29')](respondWithResult(_0x54b0ec,null))[_0x19e1('0x4b')](handleError(_0x54b0ec,null));};exports['destroy']=function(_0x2a57bb,_0x40fd89){return db[_0x19e1('0x33')]['find']({'where':{'id':_0x2a57bb[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x40fd89,null))[_0x19e1('0x29')](removeEntity(_0x40fd89,null))[_0x19e1('0x4b')](handleError(_0x40fd89,null));};exports[_0x19e1('0x56')]=function(_0x3e41cf,_0x51852f){return db[_0x19e1('0x33')]['describe']()[_0x19e1('0x29')](respondWithResult(_0x51852f,null))['catch'](handleError(_0x51852f,null));};exports[_0x19e1('0x57')]=function(_0x28d82f,_0x5380b3,_0x1b9ad1){var _0x2a95d4={'raw':!![],'where':{}},_0x530732={},_0x19a815;return db[_0x19e1('0x33')][_0x19e1('0x58')]({'where':{'id':_0x28d82f['params']['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x5380b3,null))[_0x19e1('0x29')](function(_0x437309){if(_0x437309){_0x19a815=_0x437309[_0x19e1('0x2b')]({'plain':!![]});_0x530732[_0x19e1('0x37')]=_[_0x19e1('0x39')](db[_0x19e1('0x59')][_0x19e1('0x4e')]);_0x530732[_0x19e1('0x38')]=_['keys'](_0x28d82f[_0x19e1('0x38')]);_0x530732[_0x19e1('0x3a')]=_[_0x19e1('0x3c')](_0x530732[_0x19e1('0x37')],_0x530732[_0x19e1('0x38')]);_0x2a95d4[_0x19e1('0x3b')]=_['intersection'](_0x530732['model'],qs['fields'](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x3d')]));_0x2a95d4['attributes']=_0x2a95d4[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x2a95d4[_0x19e1('0x3b')]:_0x530732['model'];if(!_0x28d82f[_0x19e1('0x38')]['hasOwnProperty']('nolimit')){_0x2a95d4[_0x19e1('0x22')]=qs['limit'](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x22')]);_0x2a95d4[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x28d82f['query'][_0x19e1('0x21')]);}_0x2a95d4[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x28d82f[_0x19e1('0x38')][_0x19e1('0x40')]);_0x2a95d4['where']=qs['filters'](_[_0x19e1('0x42')](_0x28d82f[_0x19e1('0x38')],_0x530732[_0x19e1('0x3a')]));_0x2a95d4[_0x19e1('0x41')][_0x19e1('0x5a')]=_0x437309['id'];if(_0x28d82f[_0x19e1('0x38')][_0x19e1('0x43')]){_0x2a95d4['where']=_[_0x19e1('0x44')](_0x2a95d4[_0x19e1('0x41')],{'$or':_[_0x19e1('0x32')](_0x2a95d4[_0x19e1('0x3b')],function(_0x412928){var _0x75670={};_0x75670[_0x412928]={'$like':'%'+_0x28d82f['query']['filter']+'%'};return _0x75670;})});}_0x2a95d4=_[_0x19e1('0x44')]({},_0x2a95d4,_0x28d82f['options']);return db[_0x19e1('0x59')][_0x19e1('0x49')](_0x2a95d4);}})[_0x19e1('0x29')](function(_0xc76b49){if(_0xc76b49){return db[_0x19e1('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0xc76b49,_0x19e1('0x5c')),'role':_0x19e1('0x5d')},'attributes':['id',_0x19e1('0x30'),_0x19e1('0x5e'),_0x19e1('0x5f'),_0x19e1('0x60')]});}})['then'](function(_0x190898){if(_0x190898){return{'count':_0x190898[_0x19e1('0x23')],'rows':_[_0x19e1('0x32')](_0x190898[_0x19e1('0x4a')],function(_0x157034){return{'membername':_0x157034[_0x19e1('0x30')],'UserId':_0x157034['id'],'queue_name':_0x19a815[_0x19e1('0x30')],'WhatsappQueueId':_0x19a815['id'],'interface':util['format'](_0x19e1('0x61'),_0x19e1('0x62'),_0x157034['name']),'penalty':0x0,'paused':_0x157034[_0x19e1('0x5e')],'createdAt':_0x157034[_0x19e1('0x60')],'updatedAt':_0x157034[_0x19e1('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x19e1('0x29')](respondWithFilteredResult(_0x5380b3,_0x2a95d4))['catch'](handleError(_0x5380b3,null));};exports['getTeams']=function(_0x35a4cb,_0xdfaff6,_0x160663){var _0x53d132={};var _0x36d3b9={};var _0x3cbbfe;var _0x295b8a;return db['WhatsappQueue'][_0x19e1('0x58')]({'where':{'id':_0x35a4cb[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0xdfaff6,null))[_0x19e1('0x29')](function(_0x2378f2){if(_0x2378f2){_0x3cbbfe=_0x2378f2;_0x36d3b9['model']=_[_0x19e1('0x39')](db['Team'][_0x19e1('0x4e')]);_0x36d3b9[_0x19e1('0x38')]=_[_0x19e1('0x39')](_0x35a4cb[_0x19e1('0x38')]);_0x36d3b9['filters']=_[_0x19e1('0x3c')](_0x36d3b9['model'],_0x36d3b9['query']);_0x53d132[_0x19e1('0x3b')]=_['intersection'](_0x36d3b9['model'],qs[_0x19e1('0x3d')](_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x3d')]));_0x53d132[_0x19e1('0x3b')]=_0x53d132[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x53d132[_0x19e1('0x3b')]:_0x36d3b9[_0x19e1('0x37')];_0x53d132['order']=qs['sort'](_0x35a4cb[_0x19e1('0x38')]['sort']);_0x53d132[_0x19e1('0x41')]=qs[_0x19e1('0x3a')](_[_0x19e1('0x42')](_0x35a4cb['query'],_0x36d3b9['filters']));if(_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x43')]){_0x53d132['where']=_['merge'](_0x53d132['where'],{'$or':_[_0x19e1('0x32')](_0x53d132['attributes'],function(_0xe37032){var _0x32561e={};_0x32561e[_0xe37032]={'$like':'%'+_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x43')]+'%'};return _0x32561e;})});}_0x53d132=_['merge']({},_0x53d132,_0x35a4cb[_0x19e1('0x46')]);return _0x3cbbfe[_0x19e1('0x63')](_0x53d132);}})['then'](function(_0x422506){if(_0x422506){_0x295b8a=_0x422506[_0x19e1('0x3e')];if(!_0x35a4cb[_0x19e1('0x38')][_0x19e1('0x64')](_0x19e1('0x65'))){_0x53d132['limit']=qs[_0x19e1('0x22')](_0x35a4cb[_0x19e1('0x38')]['limit']);_0x53d132[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x35a4cb[_0x19e1('0x38')]['offset']);}return _0x3cbbfe[_0x19e1('0x63')](_0x53d132);}})[_0x19e1('0x29')](function(_0x263032){if(_0x263032){return _0x263032?{'count':_0x295b8a,'rows':_0x263032}:null;}})[_0x19e1('0x29')](respondWithResult(_0xdfaff6,null))[_0x19e1('0x4b')](handleError(_0xdfaff6,null));};exports['addTeams']=function(_0x2555b9,_0x21b032,_0x48e3de){var _0x14d884=_0x2555b9[_0x19e1('0x51')][_0x19e1('0x66')];return db['Team']['findAll']({'where':{'id':_0x14d884},'attributes':['id'],'include':[{'model':db[_0x19e1('0x5b')],'as':_0x19e1('0x67'),'attributes':['id','name',_0x19e1('0x68'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x4afadf){if(_0x4afadf){var _0x35ccba=_[_0x19e1('0x69')](_0x4afadf,function(_0x39dd98){var _0x4a9777=_0x39dd98[_0x19e1('0x2b')]({'plain':!![]});return _0x4a9777[_0x19e1('0x67')];});return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x2555b9[_0x19e1('0x4d')]['id']}})['then'](function(_0x52f325){return db[_0x19e1('0x6a')]['transaction'](function(_0x23814b){return _0x52f325[_0x19e1('0x6b')](_0x14d884,{'transaction':_0x23814b})['then'](function(){return BPromise[_0x19e1('0x6c')](_0x35ccba,function(_0x1c6509){return db[_0x19e1('0x59')][_0x19e1('0x6d')]({'where':{'UserId':_0x1c6509['id'],'WhatsappQueueId':_0x2555b9[_0x19e1('0x4d')]['id']},'transaction':_0x23814b});});})['then'](function(){_0x35ccba[_0x19e1('0x6e')](function(_0x3bcd94){socket[_0x19e1('0x6f')]('userWhatsappQueue:save',{'UserId':_0x3bcd94['id'],'WhatsappQueueId':_0x52f325['id']});});});});});}})[_0x19e1('0x29')](respondWithStatusCode(_0x21b032,null))[_0x19e1('0x4b')](handleError(_0x21b032,null));};exports[_0x19e1('0x70')]=function(_0x2f6242,_0x1661e9,_0x13b31f){return db[_0x19e1('0x71')][_0x19e1('0x49')]({'where':{'id':_0x2f6242[_0x19e1('0x38')][_0x19e1('0x66')]},'attributes':['id'],'include':[{'model':db[_0x19e1('0x5b')],'as':_0x19e1('0x67'),'attributes':['id'],'raw':!![]}]})[_0x19e1('0x29')](handleEntityNotFound(_0x1661e9,null))['then'](function(_0x212e8c){var _0x409762=_[_0x19e1('0x32')](_0x212e8c,'id');var _0x39abdd=[];var _0x2bde2f=[];var _0x461878=squel[_0x19e1('0x72')]();_0x461878[_0x19e1('0x73')]('tq.TeamId')['from'](_0x19e1('0x74'),'tq')[_0x19e1('0x75')](_0x19e1('0x76'),'ut',_0x19e1('0x77'))[_0x19e1('0x41')](_0x19e1('0x78'),_0x2f6242[_0x19e1('0x4d')]['id']);for(var _0x4f6cd5=0x0;_0x4f6cd5<_0x212e8c['length'];_0x4f6cd5+=0x1){let _0x4df615=_0x212e8c[_0x4f6cd5];for(var _0x351fd3=0x0;_0x351fd3<_0x4df615[_0x19e1('0x67')][_0x19e1('0x3e')];_0x351fd3+=0x1){let _0x10cdb9=_0x4df615['Agents'][_0x351fd3];var _0x340a35=_0x461878['clone']();_0x340a35[_0x19e1('0x41')](_0x19e1('0x79'),_0x10cdb9['id']);_0x2bde2f[_0x19e1('0x7a')](db[_0x19e1('0x6a')]['query'](_0x340a35[_0x19e1('0x7b')](),{'type':db['sequelize'][_0x19e1('0x7c')][_0x19e1('0x7d')]})[_0x19e1('0x29')](function(_0x31810e){if(_0x31810e[_0x19e1('0x3e')]===0x1){return _0x10cdb9['id'];}else{var _0x423fe7=_[_0x19e1('0x7e')](_['map'](_0x31810e,_0x19e1('0x7f')),function(_0x3ff7a0){return _['includes'](_0x409762,_0x3ff7a0);});if(_0x423fe7){return _0x10cdb9['id'];}}}));}}return BPromise[_0x19e1('0x80')](_0x2bde2f)[_0x19e1('0x29')](function(_0x461573){_0x39abdd=_(_0x39abdd)['union'](_0x461573)['compact']()[_0x19e1('0x81')]();return db['WhatsappQueue'][_0x19e1('0x4f')]({'where':{'id':_0x2f6242[_0x19e1('0x4d')]['id']}})['then'](function(_0x350f23){return db[_0x19e1('0x6a')]['transaction'](function(_0x250641){return _0x350f23[_0x19e1('0x70')](_0x2f6242[_0x19e1('0x38')][_0x19e1('0x66')],{'transaction':_0x250641})['then'](function(){if(!_[_0x19e1('0x82')](_0x39abdd)){return _0x350f23[_0x19e1('0x83')](_0x39abdd,{'transaction':_0x250641});}})[_0x19e1('0x29')](function(){_0x39abdd[_0x19e1('0x6e')](function(_0x5d6577){socket['emit'](_0x19e1('0x84'),{'UserId':_0x5d6577,'WhatsappQueueId':_0x350f23['id']});});});});});});})[_0x19e1('0x29')](respondWithStatusCode(_0x1661e9,null))[_0x19e1('0x4b')](handleError(_0x1661e9,null));};exports['addAgents']=function(_0x24a15b,_0x18a91f,_0x181511){return db[_0x19e1('0x33')]['find']({'where':{'id':_0x24a15b['params']['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x18a91f,null))[_0x19e1('0x29')](function(_0x32293f){if(_0x32293f){return _0x32293f[_0x19e1('0x85')](_0x24a15b['body'][_0x19e1('0x66')],_[_0x19e1('0x86')](_0x24a15b[_0x19e1('0x51')],['ids','id'])||{})[_0x19e1('0x87')](function(_0x424de9){for(var _0x31def7=0x0;_0x31def7<_0x24a15b[_0x19e1('0x51')]['ids'][_0x19e1('0x3e')];_0x31def7+=0x1){socket[_0x19e1('0x6f')](_0x19e1('0x88'),{'UserId':Number(_0x24a15b['body'][_0x19e1('0x66')][_0x31def7]),'WhatsappQueueId':Number(_0x24a15b['params']['id'])});}return _0x424de9;});}})[_0x19e1('0x29')](respondWithResult(_0x18a91f,null))[_0x19e1('0x4b')](handleError(_0x18a91f,null));};exports[_0x19e1('0x83')]=function(_0x244f20,_0x3b029b,_0x210c7a){return db[_0x19e1('0x33')][_0x19e1('0x4f')]({'where':{'id':_0x244f20[_0x19e1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3b029b,null))[_0x19e1('0x29')](function(_0xd5c7f9){if(_0xd5c7f9){return _0xd5c7f9[_0x19e1('0x83')](_0x244f20['query'][_0x19e1('0x66')])[_0x19e1('0x29')](function(){if(_[_0x19e1('0x89')](_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')])){for(var _0x5dbf03=0x0;_0x5dbf03<_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')][_0x19e1('0x3e')];_0x5dbf03+=0x1){socket[_0x19e1('0x6f')](_0x19e1('0x84'),{'UserId':Number(_0x244f20['query'][_0x19e1('0x66')][_0x5dbf03]),'WhatsappQueueId':Number(_0x244f20['params']['id'])});}}else{socket['emit'](_0x19e1('0x84'),{'UserId':Number(_0x244f20[_0x19e1('0x38')][_0x19e1('0x66')]),'WhatsappQueueId':Number(_0x244f20['params']['id'])});}});}})[_0x19e1('0x29')](respondWithStatusCode(_0x3b029b,null))[_0x19e1('0x4b')](handleError(_0x3b029b,null));};exports[_0x19e1('0x8a')]=function(_0x4c74f4,_0x380e63,_0x3a1b2b){var _0x13edb0={};var _0x125e21={};var _0x205ae7;var _0x1b77a2;return db[_0x19e1('0x33')][_0x19e1('0x58')]({'where':{'id':_0x4c74f4[_0x19e1('0x4d')]['id']}})[_0x19e1('0x29')](handleEntityNotFound(_0x380e63,null))[_0x19e1('0x29')](function(_0x5b38a6){if(_0x5b38a6){_0x205ae7=_0x5b38a6;_0x125e21[_0x19e1('0x37')]=_['keys'](db[_0x19e1('0x5b')]['rawAttributes']);_0x125e21[_0x19e1('0x38')]=_['keys'](_0x4c74f4['query']);_0x125e21[_0x19e1('0x3a')]=_[_0x19e1('0x3c')](_0x125e21['model'],_0x125e21['query']);_0x13edb0['attributes']=_['intersection'](_0x125e21[_0x19e1('0x37')],qs[_0x19e1('0x3d')](_0x4c74f4[_0x19e1('0x38')]['fields']));_0x13edb0[_0x19e1('0x3b')]=_0x13edb0[_0x19e1('0x3b')][_0x19e1('0x3e')]?_0x13edb0[_0x19e1('0x3b')]:_0x125e21[_0x19e1('0x37')];_0x13edb0[_0x19e1('0x3f')]=qs[_0x19e1('0x40')](_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x40')]);_0x13edb0[_0x19e1('0x41')]=qs[_0x19e1('0x3a')](_[_0x19e1('0x42')](_0x4c74f4['query'],_0x125e21[_0x19e1('0x3a')]));if(_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x43')]){_0x13edb0[_0x19e1('0x41')]=_[_0x19e1('0x44')](_0x13edb0[_0x19e1('0x41')],{'$or':_[_0x19e1('0x32')](_0x13edb0[_0x19e1('0x3b')],function(_0x5f4f20){var _0x1c95f5={};_0x1c95f5[_0x5f4f20]={'$like':'%'+_0x4c74f4[_0x19e1('0x38')][_0x19e1('0x43')]+'%'};return _0x1c95f5;})});}_0x13edb0=_[_0x19e1('0x44')]({},_0x13edb0,_0x4c74f4[_0x19e1('0x46')]);return _0x205ae7['getAgents'](_0x13edb0);}})[_0x19e1('0x29')](function(_0xcd67fb){if(_0xcd67fb){_0x1b77a2=_0xcd67fb['length'];if(!_0x4c74f4[_0x19e1('0x38')]['hasOwnProperty'](_0x19e1('0x65'))){_0x13edb0[_0x19e1('0x22')]=qs[_0x19e1('0x22')](_0x4c74f4['query'][_0x19e1('0x22')]);_0x13edb0[_0x19e1('0x21')]=qs[_0x19e1('0x21')](_0x4c74f4[_0x19e1('0x38')]['offset']);}return _0x205ae7[_0x19e1('0x8a')](_0x13edb0);}})['then'](function(_0x4a7695){if(_0x4a7695){return _0x4a7695?{'count':_0x1b77a2,'rows':_0x4a7695}:null;}})[_0x19e1('0x29')](respondWithResult(_0x380e63,null))['catch'](handleError(_0x380e63,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 2b6be42..6103ce8 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 _0x9ce9=['hook','exports','../../mysqldb','WhatsappQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x29cb4f,_0x26a21d){var _0x51e06d=function(_0x3ce158){while(--_0x3ce158){_0x29cb4f['push'](_0x29cb4f['shift']());}};_0x51e06d(++_0x26a21d);}(_0x9ce9,0x1e8));var _0x99ce=function(_0x4d6f10,_0x1bb9fc){_0x4d6f10=_0x4d6f10-0x0;var _0x251b9c=_0x9ce9[_0x4d6f10];return _0x251b9c;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x99ce('0x0'))['db'][_0x99ce('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99ce('0x2'),'afterUpdate':_0x99ce('0x3'),'afterDestroy':_0x99ce('0x4')};function emitEvent(_0x8afaf4){return function(_0x5e4282,_0x5170f2,_0x4b9756){WhatsappQueueEvents[_0x99ce('0x5')](_0x8afaf4+':'+_0x5e4282['id'],_0x5e4282);WhatsappQueueEvents[_0x99ce('0x5')](_0x8afaf4,_0x5e4282);_0x4b9756(null);};}for(var e in events){if(events[_0x99ce('0x6')](e)){var event=events[e];WhatsappQueue[_0x99ce('0x7')](e,emitEvent(event));}}module[_0x99ce('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x42d1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x42d1,0x178));var _0x142d=function(_0x863e3,_0x45bb06){_0x863e3=_0x863e3-0x0;var _0x52faeb=_0x42d1[_0x863e3];return _0x52faeb;};'use strict';var EventEmitter=require(_0x142d('0x0'));var WhatsappQueue=require(_0x142d('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x142d('0x2')](0x0);var events={'afterCreate':_0x142d('0x3'),'afterUpdate':_0x142d('0x4'),'afterDestroy':_0x142d('0x5')};function emitEvent(_0x20e47c){return function(_0x1086d6,_0x348299,_0x1aba2b){WhatsappQueueEvents[_0x142d('0x6')](_0x20e47c+':'+_0x1086d6['id'],_0x1086d6);WhatsappQueueEvents[_0x142d('0x6')](_0x20e47c,_0x1086d6);_0x1aba2b(null);};}for(var e in events){if(events[_0x142d('0x7')](e)){var event=events[e];WhatsappQueue[_0x142d('0x8')](e,emitEvent(event));}}module[_0x142d('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ad446a0..d5b3af7 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 _0x173d=['api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappQueue','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x173d,0xf2));var _0xd173=function(_0x6636f0,_0x11cb9e){_0x6636f0=_0x6636f0-0x0;var _0x21e2b3=_0x173d[_0x6636f0];return _0x21e2b3;};'use strict';var _=require(_0xd173('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd173('0x1'));var moment=require(_0xd173('0x2'));var BPromise=require(_0xd173('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd173('0x4'));var rimraf=require(_0xd173('0x5'));var config=require(_0xd173('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x526b1c,_0x318b55){return _0x526b1c[_0xd173('0x7')](_0xd173('0x8'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3c2=['rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xd3c2,0x1e6));var _0x2d3c=function(_0x498dbc,_0x10b18a){_0x498dbc=_0x498dbc-0x0;var _0x176755=_0xd3c2[_0x498dbc];return _0x176755;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d3c('0x0'))(_0x2d3c('0x1'));var moment=require(_0x2d3c('0x2'));var BPromise=require(_0x2d3c('0x3'));var rp=require(_0x2d3c('0x4'));var fs=require('fs');var path=require(_0x2d3c('0x5'));var rimraf=require(_0x2d3c('0x6'));var config=require(_0x2d3c('0x7'));var attributes=require(_0x2d3c('0x8'));module['exports']=function(_0x5616d7,_0x1a3d41){return _0x5616d7[_0x2d3c('0x9')](_0x2d3c('0xa'),attributes,{'tableName':_0x2d3c('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 907e025..710e86a 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 _0x9ee4=['options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll'];(function(_0x52dc80,_0x2bc27d){var _0x59c1ff=function(_0x2d0222){while(--_0x2d0222){_0x52dc80['push'](_0x52dc80['shift']());}};_0x59c1ff(++_0x2bc27d);}(_0x9ee4,0x18f));var _0x49ee=function(_0x5d7c72,_0x1ef2fc){_0x5d7c72=_0x5d7c72-0x0;var _0x10bd35=_0x9ee4[_0x5d7c72];return _0x10bd35;};'use strict';var _=require(_0x49ee('0x0'));var util=require(_0x49ee('0x1'));var moment=require('moment');var BPromise=require(_0x49ee('0x2'));var rs=require(_0x49ee('0x3'));var fs=require('fs');var Redis=require(_0x49ee('0x4'));var db=require(_0x49ee('0x5'))['db'];var utils=require(_0x49ee('0x6'));var logger=require(_0x49ee('0x7'))(_0x49ee('0x8'));var config=require(_0x49ee('0x9'));var jayson=require(_0x49ee('0xa'));var client=jayson[_0x49ee('0xb')][_0x49ee('0xc')]({'port':0x232a});config[_0x49ee('0xd')]=_[_0x49ee('0xe')](config[_0x49ee('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x49ee('0xf'))(new Redis(config[_0x49ee('0xd')]));require(_0x49ee('0x10'))['register'](socket);function respondWithRpcPromise(_0x22f474,_0x1bdfa8,_0x4ad945){return new BPromise(function(_0x28f49e,_0x1253f7){return client[_0x49ee('0x11')](_0x22f474,_0x4ad945)[_0x49ee('0x12')](function(_0x2f9d42){logger[_0x49ee('0x13')](_0x49ee('0x14'),_0x1bdfa8,'request\x20sent');logger[_0x49ee('0x15')](_0x49ee('0x16'),_0x1bdfa8,_0x49ee('0x17'),JSON['stringify'](_0x2f9d42));if(_0x2f9d42[_0x49ee('0x18')]){if(_0x2f9d42[_0x49ee('0x18')][_0x49ee('0x19')]===0x1f4){logger['error'](_0x49ee('0x14'),_0x1bdfa8,_0x2f9d42[_0x49ee('0x18')][_0x49ee('0x1a')]);return _0x1253f7(_0x2f9d42['error'][_0x49ee('0x1a')]);}logger[_0x49ee('0x18')](_0x49ee('0x14'),_0x1bdfa8,_0x2f9d42[_0x49ee('0x18')][_0x49ee('0x1a')]);return _0x28f49e(_0x2f9d42[_0x49ee('0x18')][_0x49ee('0x1a')]);}else{logger['info'](_0x49ee('0x14'),_0x1bdfa8,_0x49ee('0x17'));_0x28f49e(_0x2f9d42[_0x49ee('0x1b')][_0x49ee('0x1a')]);}})['catch'](function(_0x329731){logger[_0x49ee('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x1bdfa8,_0x329731);_0x1253f7(_0x329731);});});}exports[_0x49ee('0x1c')]=function(_0x128b29){var _0x637fd=this;return new Promise(function(_0x30416e,_0x208665){return db[_0x49ee('0x1d')][_0x49ee('0x1e')]({'raw':_0x128b29[_0x49ee('0x1f')]?_0x128b29[_0x49ee('0x1f')][_0x49ee('0x20')]===undefined?!![]:![]:!![],'where':_0x128b29[_0x49ee('0x1f')]?_0x128b29[_0x49ee('0x1f')][_0x49ee('0x21')]||null:null,'attributes':_0x128b29['options']?_0x128b29[_0x49ee('0x1f')][_0x49ee('0x22')]||null:null,'limit':_0x128b29[_0x49ee('0x1f')]?_0x128b29[_0x49ee('0x1f')][_0x49ee('0x23')]||null:null,'include':_0x128b29[_0x49ee('0x1f')]?_0x128b29[_0x49ee('0x1f')][_0x49ee('0x24')]?_[_0x49ee('0x25')](_0x128b29['options'][_0x49ee('0x24')],function(_0x16f285){return{'model':db[_0x16f285[_0x49ee('0x26')]],'as':_0x16f285['as'],'attributes':_0x16f285['attributes'],'include':_0x16f285[_0x49ee('0x24')]?_['map'](_0x16f285['include'],function(_0x12ca7c){return{'model':db[_0x12ca7c[_0x49ee('0x26')]],'as':_0x12ca7c['as'],'attributes':_0x12ca7c['attributes'],'include':_0x12ca7c['include']?_[_0x49ee('0x25')](_0x12ca7c[_0x49ee('0x24')],function(_0x23e7b9){return{'model':db[_0x23e7b9['model']],'as':_0x23e7b9['as'],'attributes':_0x23e7b9[_0x49ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x49ee('0x12')](function(_0x30e6e6){logger[_0x49ee('0x13')](_0x49ee('0x1c'),_0x128b29);logger[_0x49ee('0x15')](_0x49ee('0x1c'),_0x128b29,JSON[_0x49ee('0x27')](_0x30e6e6));_0x30416e(_0x30e6e6);})[_0x49ee('0x28')](function(_0x51b81b){logger[_0x49ee('0x18')]('GetWhatsappQueue',_0x51b81b[_0x49ee('0x1a')],_0x128b29);_0x208665(_0x637fd['error'](0x1f4,_0x51b81b[_0x49ee('0x1a')]));});});};exports[_0x49ee('0x29')]=function(_0x2f0a0f){var _0x42ed14=this;return new Promise(function(_0x1121bb,_0x1057b0){return db['WhatsappQueue'][_0x49ee('0x2a')]({'raw':_0x2f0a0f[_0x49ee('0x1f')]?_0x2f0a0f[_0x49ee('0x1f')][_0x49ee('0x20')]===undefined?!![]:![]:!![],'where':_0x2f0a0f[_0x49ee('0x1f')]?_0x2f0a0f[_0x49ee('0x1f')]['where']||null:null,'attributes':_0x2f0a0f[_0x49ee('0x1f')]?_0x2f0a0f[_0x49ee('0x1f')][_0x49ee('0x22')]||null:null,'include':_0x2f0a0f[_0x49ee('0x1f')]?_0x2f0a0f['options'][_0x49ee('0x24')]?_[_0x49ee('0x25')](_0x2f0a0f[_0x49ee('0x1f')][_0x49ee('0x24')],function(_0x52d629){return{'model':db[_0x52d629[_0x49ee('0x26')]],'as':_0x52d629['as'],'attributes':_0x52d629[_0x49ee('0x22')],'include':_0x52d629['include']?_[_0x49ee('0x25')](_0x52d629[_0x49ee('0x24')],function(_0x19dcbe){return{'model':db[_0x19dcbe[_0x49ee('0x26')]],'as':_0x19dcbe['as'],'attributes':_0x19dcbe[_0x49ee('0x22')],'include':_0x19dcbe[_0x49ee('0x24')]?_[_0x49ee('0x25')](_0x19dcbe[_0x49ee('0x24')],function(_0x5dc345){return{'model':db[_0x5dc345['model']],'as':_0x5dc345['as'],'attributes':_0x5dc345[_0x49ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x49ee('0x12')](function(_0xdeb48e){logger[_0x49ee('0x13')](_0x49ee('0x29'),_0x2f0a0f);logger[_0x49ee('0x15')](_0x49ee('0x29'),_0x2f0a0f,JSON['stringify'](_0xdeb48e));_0x1121bb(_0xdeb48e);})[_0x49ee('0x28')](function(_0x1ed47a){logger[_0x49ee('0x18')](_0x49ee('0x29'),_0x1ed47a[_0x49ee('0x1a')],_0x2f0a0f);_0x1057b0(_0x42ed14['error'](0x1f4,_0x1ed47a['message']));});});}; \ No newline at end of file +var _0x9f52=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','include','model','map','ShowWhatsappQueue','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc5cb,_0x32f79a){var _0x339a14=function(_0xde92eb){while(--_0xde92eb){_0x1cc5cb['push'](_0x1cc5cb['shift']());}};_0x339a14(++_0x32f79a);}(_0x9f52,0xb3));var _0x29f5=function(_0x1c20cc,_0x2f6860){_0x1c20cc=_0x1c20cc-0x0;var _0x2ed490=_0x9f52[_0x1c20cc];return _0x2ed490;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var moment=require(_0x29f5('0x1'));var BPromise=require('bluebird');var rs=require(_0x29f5('0x2'));var fs=require('fs');var Redis=require(_0x29f5('0x3'));var db=require(_0x29f5('0x4'))['db'];var utils=require(_0x29f5('0x5'));var logger=require('../../config/logger')(_0x29f5('0x6'));var config=require(_0x29f5('0x7'));var jayson=require(_0x29f5('0x8'));var client=jayson[_0x29f5('0x9')][_0x29f5('0xa')]({'port':0x232a});config[_0x29f5('0xb')]=_[_0x29f5('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29f5('0xb')]));require(_0x29f5('0xd'))[_0x29f5('0xe')](socket);function respondWithRpcPromise(_0x26200c,_0x1f00a2,_0x4db1b6){return new BPromise(function(_0x584cd8,_0x4b71dd){return client[_0x29f5('0xf')](_0x26200c,_0x4db1b6)[_0x29f5('0x10')](function(_0x305768){logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,'request\x20sent');logger[_0x29f5('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1f00a2,_0x29f5('0x14'),JSON[_0x29f5('0x15')](_0x305768));if(_0x305768[_0x29f5('0x16')]){if(_0x305768[_0x29f5('0x16')]['code']===0x1f4){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x4b71dd(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x305768['error'][_0x29f5('0x17')]);return _0x584cd8(_0x305768[_0x29f5('0x16')][_0x29f5('0x17')]);}else{logger[_0x29f5('0x11')](_0x29f5('0x12'),_0x1f00a2,_0x29f5('0x14'));_0x584cd8(_0x305768['result'][_0x29f5('0x17')]);}})[_0x29f5('0x18')](function(_0x2b3028){logger[_0x29f5('0x16')](_0x29f5('0x12'),_0x1f00a2,_0x2b3028);_0x4b71dd(_0x2b3028);});});}exports[_0x29f5('0x19')]=function(_0x19d646){var _0x20c25c=this;return new Promise(function(_0x2e1b7c,_0x4d2caa){return db[_0x29f5('0x1a')][_0x29f5('0x1b')]({'raw':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1e')]||null:null,'attributes':_0x19d646['options']?_0x19d646[_0x29f5('0x1c')][_0x29f5('0x1f')]||null:null,'limit':_0x19d646[_0x29f5('0x1c')]?_0x19d646['options']['limit']||null:null,'include':_0x19d646[_0x29f5('0x1c')]?_0x19d646[_0x29f5('0x1c')]['include']?_['map'](_0x19d646['options'][_0x29f5('0x20')],function(_0x5b8a07){return{'model':db[_0x5b8a07['model']],'as':_0x5b8a07['as'],'attributes':_0x5b8a07['attributes'],'include':_0x5b8a07[_0x29f5('0x20')]?_['map'](_0x5b8a07['include'],function(_0x381836){return{'model':db[_0x381836[_0x29f5('0x21')]],'as':_0x381836['as'],'attributes':_0x381836[_0x29f5('0x1f')],'include':_0x381836['include']?_[_0x29f5('0x22')](_0x381836[_0x29f5('0x20')],function(_0x532330){return{'model':db[_0x532330['model']],'as':_0x532330['as'],'attributes':_0x532330['attributes']};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x2beb11){logger[_0x29f5('0x11')](_0x29f5('0x19'),_0x19d646);logger[_0x29f5('0x13')](_0x29f5('0x19'),_0x19d646,JSON[_0x29f5('0x15')](_0x2beb11));_0x2e1b7c(_0x2beb11);})[_0x29f5('0x18')](function(_0x21a570){logger[_0x29f5('0x16')](_0x29f5('0x19'),_0x21a570[_0x29f5('0x17')],_0x19d646);_0x4d2caa(_0x20c25c[_0x29f5('0x16')](0x1f4,_0x21a570[_0x29f5('0x17')]));});});};exports[_0x29f5('0x23')]=function(_0x1be222){var _0x2ebeb3=this;return new Promise(function(_0x4aef8e,_0x223b76){return db[_0x29f5('0x1a')][_0x29f5('0x24')]({'raw':_0x1be222[_0x29f5('0x1c')]?_0x1be222['options'][_0x29f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['where']||null:null,'attributes':_0x1be222['options']?_0x1be222['options'][_0x29f5('0x1f')]||null:null,'include':_0x1be222[_0x29f5('0x1c')]?_0x1be222[_0x29f5('0x1c')]['include']?_['map'](_0x1be222['options']['include'],function(_0x169d22){return{'model':db[_0x169d22[_0x29f5('0x21')]],'as':_0x169d22['as'],'attributes':_0x169d22['attributes'],'include':_0x169d22['include']?_[_0x29f5('0x22')](_0x169d22['include'],function(_0x3b26b1){return{'model':db[_0x3b26b1[_0x29f5('0x21')]],'as':_0x3b26b1['as'],'attributes':_0x3b26b1[_0x29f5('0x1f')],'include':_0x3b26b1[_0x29f5('0x20')]?_[_0x29f5('0x22')](_0x3b26b1[_0x29f5('0x20')],function(_0x5f2b58){return{'model':db[_0x5f2b58[_0x29f5('0x21')]],'as':_0x5f2b58['as'],'attributes':_0x5f2b58[_0x29f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x29f5('0x10')](function(_0x4b161d){logger[_0x29f5('0x11')](_0x29f5('0x23'),_0x1be222);logger[_0x29f5('0x13')]('ShowWhatsappQueue',_0x1be222,JSON[_0x29f5('0x15')](_0x4b161d));_0x4aef8e(_0x4b161d);})['catch'](function(_0x1b5c4c){logger[_0x29f5('0x16')]('ShowWhatsappQueue',_0x1b5c4c['message'],_0x1be222);_0x223b76(_0x2ebeb3[_0x29f5('0x16')](0x1f4,_0x1b5c4c[_0x29f5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 015f052..5903fd3 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 _0x1544=['emit','length','whatsappQueue:','save','remove','update'];(function(_0x465a55,_0x531bc0){var _0x1a90a0=function(_0x5c6cb5){while(--_0x5c6cb5){_0x465a55['push'](_0x465a55['shift']());}};_0x1a90a0(++_0x531bc0);}(_0x1544,0x99));var _0x4154=function(_0xf2ee56,_0x565642){_0xf2ee56=_0xf2ee56-0x0;var _0x2b9bc9=_0x1544[_0xf2ee56];return _0x2b9bc9;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x4154('0x0'),_0x4154('0x1'),_0x4154('0x2')];function createListener(_0x37c848,_0x5b61f5){return function(_0xea10d1){_0x5b61f5[_0x4154('0x3')](_0x37c848,_0xea10d1);};}function removeListener(_0x4c852c,_0x5666f0){return function(){WhatsappQueueEvents['removeListener'](_0x4c852c,_0x5666f0);};}exports['register']=function(_0x31cf4c){for(var _0x8093=0x0,_0x487d91=events[_0x4154('0x4')];_0x8093<_0x487d91;_0x8093++){var _0x451ea7=events[_0x8093];var _0xc26652=createListener(_0x4154('0x5')+_0x451ea7,_0x31cf4c);WhatsappQueueEvents['on'](_0x451ea7,_0xc26652);}}; \ No newline at end of file +var _0xb6e7=['./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x273c83,_0x2b2100){var _0x1ade28=function(_0x242135){while(--_0x242135){_0x273c83['push'](_0x273c83['shift']());}};_0x1ade28(++_0x2b2100);}(_0xb6e7,0x165));var _0x7b6e=function(_0x2384b2,_0x4d6a25){_0x2384b2=_0x2384b2-0x0;var _0xf02d94=_0xb6e7[_0x2384b2];return _0xf02d94;};'use strict';var WhatsappQueueEvents=require(_0x7b6e('0x0'));var events=[_0x7b6e('0x1'),_0x7b6e('0x2'),_0x7b6e('0x3')];function createListener(_0x2be004,_0x313ec6){return function(_0x2dceb3){_0x313ec6[_0x7b6e('0x4')](_0x2be004,_0x2dceb3);};}function removeListener(_0x3ebb07,_0xcb5b0a){return function(){WhatsappQueueEvents[_0x7b6e('0x5')](_0x3ebb07,_0xcb5b0a);};}exports[_0x7b6e('0x6')]=function(_0x393101){for(var _0x2efe79=0x0,_0x236689=events['length'];_0x2efe79<_0x236689;_0x2efe79++){var _0x449f5a=events[_0x2efe79];var _0x1fe324=createListener('whatsappQueue:'+_0x449f5a,_0x393101);WhatsappQueueEvents['on'](_0x449f5a,_0x1fe324);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 32d591f..dbc1f67 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 _0x4443=['describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x319fa0,_0x31377a){var _0x464fee=function(_0x503a37){while(--_0x503a37){_0x319fa0['push'](_0x319fa0['shift']());}};_0x464fee(++_0x31377a);}(_0x4443,0x71));var _0x3444=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4443[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x3444('0x0'));var util=require('util');var path=require(_0x3444('0x1'));var timeout=require(_0x3444('0x2'));var express=require(_0x3444('0x3'));var router=express[_0x3444('0x4')]();var fs_extra=require(_0x3444('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3444('0x6'));var config=require(_0x3444('0x7'));var controller=require(_0x3444('0x8'));router[_0x3444('0x9')]('/',auth[_0x3444('0xa')](),controller[_0x3444('0xb')]);router[_0x3444('0x9')](_0x3444('0xc'),auth['isAuthenticated'](),controller[_0x3444('0xd')]);router[_0x3444('0x9')](_0x3444('0xe'),auth['isAuthenticated'](),controller[_0x3444('0xf')]);router[_0x3444('0x10')]('/',auth[_0x3444('0xa')](),controller[_0x3444('0x11')]);router[_0x3444('0x12')]('/:id',auth[_0x3444('0xa')](),controller['update']);router[_0x3444('0x13')](_0x3444('0xe'),auth['isAuthenticated'](),controller[_0x3444('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd3fd=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3fd,0xd7));var _0xdd3f=function(_0x133f52,_0x5b8c93){_0x133f52=_0x133f52-0x0;var _0x42fad9=_0xd3fd[_0x133f52];return _0x42fad9;};'use strict';var multer=require(_0xdd3f('0x0'));var util=require(_0xdd3f('0x1'));var path=require(_0xdd3f('0x2'));var timeout=require(_0xdd3f('0x3'));var express=require(_0xdd3f('0x4'));var router=express[_0xdd3f('0x5')]();var fs_extra=require(_0xdd3f('0x6'));var auth=require(_0xdd3f('0x7'));var interaction=require(_0xdd3f('0x8'));var config=require(_0xdd3f('0x9'));var controller=require(_0xdd3f('0xa'));router[_0xdd3f('0xb')]('/',auth[_0xdd3f('0xc')](),controller[_0xdd3f('0xd')]);router[_0xdd3f('0xb')](_0xdd3f('0xe'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0xf')]);router[_0xdd3f('0xb')](_0xdd3f('0x10'),auth['isAuthenticated'](),controller[_0xdd3f('0x11')]);router[_0xdd3f('0x12')]('/',auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x13')]);router['put'](_0xdd3f('0x10'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x14')]);router[_0xdd3f('0x15')](_0xdd3f('0x10'),auth[_0xdd3f('0xc')](),controller[_0xdd3f('0x16')]);module[_0xdd3f('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b4f24c5..9d1ac0f 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0xadf19d,_0x262a73){var _0x5f0d5d=function(_0x17fccb){while(--_0x17fccb){_0xadf19d['push'](_0xadf19d['shift']());}};_0x5f0d5d(++_0x262a73);}(_0x7a54,0x106));var _0x47a5=function(_0x3a2d64,_0x266d80){_0x3a2d64=_0x3a2d64-0x0;var _0x5cc594=_0x7a54[_0x3a2d64];return _0x5cc594;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xab4108,_0x30e977){var _0x2138d7=function(_0x353f82){while(--_0x353f82){_0xab4108['push'](_0xab4108['shift']());}};_0x2138d7(++_0x30e977);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 95a6d5f..eea15dc 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 _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file +var _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','rimraf','zip-dir','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0x699aff,_0x29a314){var _0x37eb40=function(_0x70e349){while(--_0x70e349){_0x699aff['push'](_0x699aff['shift']());}};_0x37eb40(++_0x29a314);}(_0xda3f,0xec));var _0xfda3=function(_0x2b8b95,_0xe1e8c5){_0x2b8b95=_0x2b8b95-0x0;var _0x3a724f=_0xda3f[_0x2b8b95];return _0x3a724f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 125dc7d..cfe1a73 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 _0xd0cb=['util','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash'];(function(_0x218c43,_0x209f63){var _0x4ac0db=function(_0x335608){while(--_0x335608){_0x218c43['push'](_0x218c43['shift']());}};_0x4ac0db(++_0x209f63);}(_0xd0cb,0x1b9));var _0xbd0c=function(_0x10ede2,_0x2c1c33){_0x10ede2=_0x10ede2-0x0;var _0x466543=_0xd0cb[_0x10ede2];return _0x466543;};'use strict';var _=require(_0xbd0c('0x0'));var util=require(_0xbd0c('0x1'));var logger=require(_0xbd0c('0x2'))(_0xbd0c('0x3'));var moment=require(_0xbd0c('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd0c('0x5'));var fs=require('fs');var path=require(_0xbd0c('0x6'));var rimraf=require(_0xbd0c('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd0c('0x8'));module[_0xbd0c('0x9')]=function(_0x2f7730,_0x3a4f0b){return _0x2f7730[_0xbd0c('0xa')](_0xbd0c('0xb'),attributes,{'tableName':_0xbd0c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a49=['../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a49,0xf0));var _0x98a4=function(_0x4da690,_0x12d136){_0x4da690=_0x4da690-0x0;var _0x263c53=_0x8a49[_0x4da690];return _0x263c53;};'use strict';var _=require(_0x98a4('0x0'));var util=require('util');var logger=require(_0x98a4('0x1'))('api');var moment=require(_0x98a4('0x2'));var BPromise=require(_0x98a4('0x3'));var rp=require(_0x98a4('0x4'));var fs=require('fs');var path=require(_0x98a4('0x5'));var rimraf=require(_0x98a4('0x6'));var config=require(_0x98a4('0x7'));var attributes=require(_0x98a4('0x8'));module[_0x98a4('0x9')]=function(_0x3d8ccc,_0x4e1444){return _0x3d8ccc['define'](_0x98a4('0xa'),attributes,{'tableName':_0x98a4('0xb'),'paranoid':![],'indexes':[{'name':_0x98a4('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 35b7681..22ddf9d 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 _0x902c=['jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x902c,0x155));var _0xc902=function(_0x1de06b,_0x7fa1c4){_0x1de06b=_0x1de06b-0x0;var _0x578041=_0x902c[_0x1de06b];return _0x578041;};'use strict';var _=require(_0xc902('0x0'));var util=require('util');var moment=require(_0xc902('0x1'));var BPromise=require('bluebird');var rs=require(_0xc902('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc902('0x3'))['db'];var utils=require(_0xc902('0x4'));var logger=require('../../config/logger')(_0xc902('0x5'));var config=require(_0xc902('0x6'));var jayson=require(_0xc902('0x7'));var client=jayson[_0xc902('0x8')][_0xc902('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35ae20,_0x46ea55,_0x191277){return new BPromise(function(_0x1fcf91,_0x527506){return client[_0xc902('0xa')](_0x35ae20,_0x191277)[_0xc902('0xb')](function(_0x38dc49){logger['info'](_0xc902('0xc'),_0x46ea55,_0xc902('0xd'));logger[_0xc902('0xe')](_0xc902('0xf'),_0x46ea55,_0xc902('0xd'),JSON[_0xc902('0x10')](_0x38dc49));if(_0x38dc49[_0xc902('0x11')]){if(_0x38dc49[_0xc902('0x11')]['code']===0x1f4){logger[_0xc902('0x11')](_0xc902('0xc'),_0x46ea55,_0x38dc49[_0xc902('0x11')][_0xc902('0x12')]);return _0x527506(_0x38dc49[_0xc902('0x11')][_0xc902('0x12')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x46ea55,_0x38dc49['error'][_0xc902('0x12')]);return _0x1fcf91(_0x38dc49[_0xc902('0x11')][_0xc902('0x12')]);}else{logger[_0xc902('0x13')](_0xc902('0xc'),_0x46ea55,'request\x20sent');_0x1fcf91(_0x38dc49['result']['message']);}})['catch'](function(_0x1c2871){logger[_0xc902('0x11')](_0xc902('0xc'),_0x46ea55,_0x1c2871);_0x527506(_0x1c2871);});});}exports[_0xc902('0x14')]=function(_0x2ca99f){var _0x3f7193=this;return new Promise(function(_0x154c82,_0x4e82ef){return db[_0xc902('0x15')]['create'](_0x2ca99f[_0xc902('0x16')],{'raw':_0x2ca99f[_0xc902('0x17')]?_0x2ca99f['options'][_0xc902('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5c4e01){logger['info'](_0xc902('0x14'),_0x2ca99f);logger['debug'](_0xc902('0x14'),_0x2ca99f,JSON[_0xc902('0x10')](_0x5c4e01));_0x154c82(_0x5c4e01);})['catch'](function(_0x2b1b85){logger[_0xc902('0x11')](_0xc902('0x14'),_0x2b1b85['message'],_0x2ca99f);_0x4e82ef(_0x3f7193['error'](0x1f4,_0x2b1b85[_0xc902('0x12')]));});});};exports[_0xc902('0x19')]=function(_0x1ca9b8){var _0x2eb945=this;return new Promise(function(_0x44344d,_0x1644c6){return db[_0xc902('0x15')][_0xc902('0x1a')](_0x1ca9b8[_0xc902('0x16')],{'raw':_0x1ca9b8[_0xc902('0x17')]?_0x1ca9b8[_0xc902('0x17')][_0xc902('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ca9b8[_0xc902('0x17')]?_0x1ca9b8[_0xc902('0x17')]['where']||null:null,'attributes':_0x1ca9b8[_0xc902('0x17')]?_0x1ca9b8[_0xc902('0x17')][_0xc902('0x1b')]||null:null,'limit':_0x1ca9b8[_0xc902('0x17')]?_0x1ca9b8[_0xc902('0x17')][_0xc902('0x1c')]||null:null})[_0xc902('0xb')](function(_0x704540){logger[_0xc902('0x13')](_0xc902('0x19'),_0x1ca9b8);logger[_0xc902('0xe')](_0xc902('0x19'),_0x1ca9b8,JSON[_0xc902('0x10')](_0x704540));_0x44344d(_0x704540);})['catch'](function(_0x12a5b7){logger['error'](_0xc902('0x19'),_0x12a5b7['message'],_0x1ca9b8);_0x1644c6(_0x2eb945[_0xc902('0x11')](0x1f4,_0x12a5b7[_0xc902('0x12')]));});});}; \ No newline at end of file +var _0xe57f=['options','raw','UpdateWhatsappQueueReport','update','attributes','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0x1961b0,_0x236bee){var _0xedeecb=function(_0x3d3901){while(--_0x3d3901){_0x1961b0['push'](_0x1961b0['shift']());}};_0xedeecb(++_0x236bee);}(_0xe57f,0x1a6));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfe57('0x0'));var util=require('util');var moment=require(_0xfe57('0x1'));var BPromise=require(_0xfe57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe57('0x3'));var db=require(_0xfe57('0x4'))['db'];var utils=require(_0xfe57('0x5'));var logger=require(_0xfe57('0x6'))(_0xfe57('0x7'));var config=require(_0xfe57('0x8'));var jayson=require(_0xfe57('0x9'));var client=jayson[_0xfe57('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8b07,_0x1d34ec,_0x3f235d){return new BPromise(function(_0x32cda5,_0x3298d8){return client[_0xfe57('0xb')](_0x1b8b07,_0x3f235d)[_0xfe57('0xc')](function(_0x163791){logger[_0xfe57('0xd')](_0xfe57('0xe'),_0x1d34ec,_0xfe57('0xf'));logger['debug'](_0xfe57('0x10'),_0x1d34ec,'request\x20sent',JSON[_0xfe57('0x11')](_0x163791));if(_0x163791['error']){if(_0x163791['error'][_0xfe57('0x12')]===0x1f4){logger['error'](_0xfe57('0xe'),_0x1d34ec,_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);return _0x3298d8(_0x163791['error'][_0xfe57('0x14')]);}logger[_0xfe57('0x13')](_0xfe57('0xe'),_0x1d34ec,_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);return _0x32cda5(_0x163791[_0xfe57('0x13')][_0xfe57('0x14')]);}else{logger[_0xfe57('0xd')](_0xfe57('0xe'),_0x1d34ec,'request\x20sent');_0x32cda5(_0x163791[_0xfe57('0x15')][_0xfe57('0x14')]);}})[_0xfe57('0x16')](function(_0x5ce253){logger['error'](_0xfe57('0xe'),_0x1d34ec,_0x5ce253);_0x3298d8(_0x5ce253);});});}exports[_0xfe57('0x17')]=function(_0x26a02c){var _0x1daf73=this;return new Promise(function(_0x1e1ec3,_0x2ed5c9){return db[_0xfe57('0x18')]['create'](_0x26a02c[_0xfe57('0x19')],{'raw':_0x26a02c[_0xfe57('0x1a')]?_0x26a02c[_0xfe57('0x1a')][_0xfe57('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x18410f){logger[_0xfe57('0xd')](_0xfe57('0x17'),_0x26a02c);logger['debug'](_0xfe57('0x17'),_0x26a02c,JSON['stringify'](_0x18410f));_0x1e1ec3(_0x18410f);})[_0xfe57('0x16')](function(_0x1ba9d3){logger[_0xfe57('0x13')](_0xfe57('0x17'),_0x1ba9d3['message'],_0x26a02c);_0x2ed5c9(_0x1daf73['error'](0x1f4,_0x1ba9d3[_0xfe57('0x14')]));});});};exports[_0xfe57('0x1c')]=function(_0x3fd149){var _0x412d56=this;return new Promise(function(_0x57c380,_0xdea752){return db[_0xfe57('0x18')][_0xfe57('0x1d')](_0x3fd149['body'],{'raw':_0x3fd149['options']?_0x3fd149['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149[_0xfe57('0x1a')]['where']||null:null,'attributes':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149[_0xfe57('0x1a')][_0xfe57('0x1e')]||null:null,'limit':_0x3fd149[_0xfe57('0x1a')]?_0x3fd149['options']['limit']||null:null})[_0xfe57('0xc')](function(_0x133bed){logger[_0xfe57('0xd')]('UpdateWhatsappQueueReport',_0x3fd149);logger[_0xfe57('0x1f')](_0xfe57('0x1c'),_0x3fd149,JSON[_0xfe57('0x11')](_0x133bed));_0x57c380(_0x133bed);})[_0xfe57('0x16')](function(_0x5023d0){logger[_0xfe57('0x13')](_0xfe57('0x1c'),_0x5023d0['message'],_0x3fd149);_0xdea752(_0x412d56[_0xfe57('0x13')](0x1f4,_0x5023d0[_0xfe57('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6e06ce6..71aec89 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 _0x746e=['path','connect-timeout','Router','fs-extra','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','util'];(function(_0x1863a8,_0x3b70e1){var _0x5e17f0=function(_0x152b7a){while(--_0x152b7a){_0x1863a8['push'](_0x1863a8['shift']());}};_0x5e17f0(++_0x3b70e1);}(_0x746e,0x1a1));var _0xe746=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x746e[_0x673722];return _0x21249c;};'use strict';var multer=require('multer');var util=require(_0xe746('0x0'));var path=require(_0xe746('0x1'));var timeout=require(_0xe746('0x2'));var express=require('express');var router=express[_0xe746('0x3')]();var fs_extra=require(_0xe746('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe746('0x5'));var controller=require(_0xe746('0x6'));router[_0xe746('0x7')]('/',auth[_0xe746('0x8')](),controller['index']);router[_0xe746('0x7')](_0xe746('0x9'),auth['isAuthenticated'](),controller[_0xe746('0xa')]);router['get'](_0xe746('0xb'),auth[_0xe746('0x8')](),controller[_0xe746('0xc')]);router['post']('/',auth[_0xe746('0x8')](),controller[_0xe746('0xd')]);router[_0xe746('0xe')]('/:id',auth[_0xe746('0x8')](),controller[_0xe746('0xf')]);router[_0xe746('0x10')](_0xe746('0xb'),auth[_0xe746('0x8')](),controller[_0xe746('0x11')]);module[_0xe746('0x12')]=router; \ No newline at end of file +var _0x2605=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','delete','/:id','destroy','exports','util','path','connect-timeout','express'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2605,0x18b));var _0x5260=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x2605[_0xeff2c3];return _0x2cade6;};'use strict';var multer=require('multer');var util=require(_0x5260('0x0'));var path=require(_0x5260('0x1'));var timeout=require(_0x5260('0x2'));var express=require(_0x5260('0x3'));var router=express['Router']();var fs_extra=require(_0x5260('0x4'));var auth=require(_0x5260('0x5'));var interaction=require(_0x5260('0x6'));var config=require('../../config/environment');var controller=require(_0x5260('0x7'));router[_0x5260('0x8')]('/',auth[_0x5260('0x9')](),controller['index']);router[_0x5260('0x8')](_0x5260('0xa'),auth[_0x5260('0x9')](),controller[_0x5260('0xb')]);router['get']('/:id',auth[_0x5260('0x9')](),controller[_0x5260('0xc')]);router[_0x5260('0xd')]('/',auth['isAuthenticated'](),controller[_0x5260('0xe')]);router['put']('/:id',auth[_0x5260('0x9')](),controller['update']);router[_0x5260('0xf')](_0x5260('0x10'),auth[_0x5260('0x9')](),controller[_0x5260('0x11')]);module[_0x5260('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index b23260c..54fa088 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 _0x86c0=['DATE','sequelize','STRING','ENUM','account','agent'];(function(_0x2f345d,_0x53fe35){var _0xe3231c=function(_0x3bec3b){while(--_0x3bec3b){_0x2f345d['push'](_0x2f345d['shift']());}};_0xe3231c(++_0x53fe35);}(_0x86c0,0x133));var _0x086c=function(_0x3d47df,_0x2d0121){_0x3d47df=_0x3d47df-0x0;var _0x2091e0=_0x86c0[_0x3d47df];return _0x2091e0;};'use strict';var Sequelize=require(_0x086c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x086c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x086c('0x2')](_0x086c('0x3'),_0x086c('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x086c('0x5')]}}; \ No newline at end of file +var _0xd237=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xd237,0x14f));var _0x7d23=function(_0x5721d7,_0x3908cd){_0x5721d7=_0x5721d7-0x0;var _0x504bbe=_0xd237[_0x5721d7];return _0x504bbe;};'use strict';var Sequelize=require(_0x7d23('0x0'));module[_0x7d23('0x1')]={'uniqueid':{'type':Sequelize[_0x7d23('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7d23('0x3')]('account',_0x7d23('0x4'),_0x7d23('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7d23('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index fe4878f..539bd51 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 _0x112f=['request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','send','map','WhatsappTransferReport','fieldName','type','model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','count','include','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','describe','eml-format','zip-dir'];(function(_0x4667f4,_0x2eec03){var _0x4a5141=function(_0x391924){while(--_0x391924){_0x4667f4['push'](_0x4667f4['shift']());}};_0x4a5141(++_0x2eec03);}(_0x112f,0x11e));var _0xf112=function(_0x5ca876,_0x373d34){_0x5ca876=_0x5ca876-0x0;var _0x758bb9=_0x112f[_0x5ca876];return _0x758bb9;};'use strict';var emlformat=require(_0xf112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf112('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf112('0x2'));var moment=require(_0xf112('0x3'));var BPromise=require(_0xf112('0x4'));var Mustache=require(_0xf112('0x5'));var util=require('util');var path=require(_0xf112('0x6'));var sox=require('sox');var csv=require(_0xf112('0x7'));var ejs=require(_0xf112('0x8'));var fs=require('fs');var fs_extra=require(_0xf112('0x9'));var _=require(_0xf112('0xa'));var squel=require(_0xf112('0xb'));var crypto=require(_0xf112('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf112('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf112('0xe'));var Papa=require(_0xf112('0xf'));var Redis=require(_0xf112('0x10'));var authService=require(_0xf112('0x11'));var qs=require(_0xf112('0x12'));var as=require(_0xf112('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf112('0x14'));var config=require(_0xf112('0x15'));var licenseUtil=require(_0xf112('0x16'));var db=require(_0xf112('0x17'))['db'];function respondWithStatusCode(_0x350f60,_0x330f6c){_0x330f6c=_0x330f6c||0xcc;return function(_0x401344){if(_0x401344){return _0x350f60[_0xf112('0x18')](_0x330f6c);}return _0x350f60[_0xf112('0x19')](_0x330f6c)['end']();};}function respondWithResult(_0x1381f4,_0x5c32f2){_0x5c32f2=_0x5c32f2||0xc8;return function(_0x568a07){if(_0x568a07){return _0x1381f4['status'](_0x5c32f2)[_0xf112('0x1a')](_0x568a07);}};}function respondWithFilteredResult(_0x5111e9,_0xb7fc78){return function(_0x1dabb1){if(_0x1dabb1){var _0x3e5780=typeof _0xb7fc78[_0xf112('0x1b')]===_0xf112('0x1c')&&typeof _0xb7fc78['limit']===_0xf112('0x1c');var _0xae0e54=_0x1dabb1['count'];var _0x16d575=_0x3e5780?0x0:_0xb7fc78[_0xf112('0x1b')];var _0x23872c=_0x3e5780?_0x1dabb1['count']:_0xb7fc78[_0xf112('0x1b')]+_0xb7fc78[_0xf112('0x1d')];var _0x46a02c;if(_0x23872c>=_0xae0e54){_0x23872c=_0xae0e54;_0x46a02c=0xc8;}else{_0x46a02c=0xce;}_0x5111e9[_0xf112('0x19')](_0x46a02c);return _0x5111e9[_0xf112('0x1e')](_0xf112('0x1f'),_0x16d575+'-'+_0x23872c+'/'+_0xae0e54)[_0xf112('0x1a')](_0x1dabb1);}return null;};}function patchUpdates(_0x13cc44){return function(_0x2d3a1b){try{jsonpatch[_0xf112('0x20')](_0x2d3a1b,_0x13cc44,!![]);}catch(_0x240bd4){return BPromise['reject'](_0x240bd4);}return _0x2d3a1b[_0xf112('0x21')]();};}function saveUpdates(_0x5e9599,_0xaed84c){return function(_0x8e7b25){if(_0x8e7b25){return _0x8e7b25[_0xf112('0x22')](_0x5e9599)[_0xf112('0x23')](function(_0x390f4d){return _0x390f4d;});}return null;};}function removeEntity(_0x29b6fb,_0x3f9604){return function(_0x1163b6){if(_0x1163b6){return _0x1163b6[_0xf112('0x24')]()[_0xf112('0x23')](function(){_0x29b6fb[_0xf112('0x19')](0xcc)[_0xf112('0x25')]();});}};}function handleEntityNotFound(_0x48a5c9,_0x5d9769){return function(_0x3c7a94){if(!_0x3c7a94){_0x48a5c9[_0xf112('0x18')](0x194);}return _0x3c7a94;};}function handleError(_0x4a2cc1,_0x44e546){_0x44e546=_0x44e546||0x1f4;return function(_0x16a491){logger['error'](_0x16a491[_0xf112('0x26')]);if(_0x16a491['name']){delete _0x16a491['name'];}_0x4a2cc1[_0xf112('0x19')](_0x44e546)[_0xf112('0x27')](_0x16a491);};}exports['index']=function(_0x50ca78,_0x167c07){var _0x2d8156={},_0x85dc43={},_0x17f157={'count':0x0,'rows':[]};var _0xd6484b=_[_0xf112('0x28')](db[_0xf112('0x29')]['rawAttributes'],function(_0x55db9d){return{'name':_0x55db9d[_0xf112('0x2a')],'type':_0x55db9d[_0xf112('0x2b')]['key']};});_0x85dc43[_0xf112('0x2c')]=_['map'](_0xd6484b,_0xf112('0x2d'));_0x85dc43[_0xf112('0x2e')]=_['keys'](_0x50ca78[_0xf112('0x2e')]);_0x85dc43[_0xf112('0x2f')]=_[_0xf112('0x30')](_0x85dc43['model'],_0x85dc43[_0xf112('0x2e')]);_0x2d8156[_0xf112('0x31')]=_[_0xf112('0x30')](_0x85dc43['model'],qs[_0xf112('0x32')](_0x50ca78['query'][_0xf112('0x32')]));_0x2d8156[_0xf112('0x31')]=_0x2d8156[_0xf112('0x31')]['length']?_0x2d8156[_0xf112('0x31')]:_0x85dc43[_0xf112('0x2c')];if(!_0x50ca78['query']['hasOwnProperty'](_0xf112('0x33'))){_0x2d8156[_0xf112('0x1d')]=qs[_0xf112('0x1d')](_0x50ca78[_0xf112('0x2e')][_0xf112('0x1d')]);_0x2d8156[_0xf112('0x1b')]=qs[_0xf112('0x1b')](_0x50ca78[_0xf112('0x2e')][_0xf112('0x1b')]);}_0x2d8156[_0xf112('0x34')]=qs[_0xf112('0x35')](_0x50ca78[_0xf112('0x2e')]['sort']);_0x2d8156[_0xf112('0x36')]=qs[_0xf112('0x2f')](_[_0xf112('0x37')](_0x50ca78[_0xf112('0x2e')],_0x85dc43['filters']),_0xd6484b);if(_0x50ca78[_0xf112('0x2e')][_0xf112('0x38')]){_0x2d8156[_0xf112('0x36')]=_[_0xf112('0x39')](_0x2d8156[_0xf112('0x36')],{'$or':_['map'](_0xd6484b,function(_0x1904c1){if(_0x1904c1['type']!=='VIRTUAL'){var _0x16c7d9={};_0x16c7d9[_0x1904c1[_0xf112('0x2d')]]={'$like':'%'+_0x50ca78[_0xf112('0x2e')][_0xf112('0x38')]+'%'};return _0x16c7d9;}})});}_0x2d8156=_['merge']({},_0x2d8156,_0x50ca78[_0xf112('0x3a')]);var _0x519ff7={'where':_0x2d8156[_0xf112('0x36')]};return db[_0xf112('0x29')]['count'](_0x519ff7)[_0xf112('0x23')](function(_0x31bf17){_0x17f157[_0xf112('0x3b')]=_0x31bf17;if(_0x50ca78[_0xf112('0x2e')]['includeAll']){_0x2d8156[_0xf112('0x3c')]=[{'all':!![]}];}return db[_0xf112('0x29')]['findAll'](_0x2d8156);})[_0xf112('0x23')](function(_0x685a5a){_0x17f157[_0xf112('0x3d')]=_0x685a5a;return _0x17f157;})['then'](respondWithFilteredResult(_0x167c07,_0x2d8156))[_0xf112('0x3e')](handleError(_0x167c07,null));};exports[_0xf112('0x3f')]=function(_0x1ebeef,_0x1858c6){var _0x147e05={'raw':!![],'where':{'id':_0x1ebeef[_0xf112('0x40')]['id']}},_0x1c0f45={};_0x1c0f45[_0xf112('0x2c')]=_['keys'](db[_0xf112('0x29')][_0xf112('0x41')]);_0x1c0f45['query']=_[_0xf112('0x42')](_0x1ebeef[_0xf112('0x2e')]);_0x1c0f45['filters']=_[_0xf112('0x30')](_0x1c0f45[_0xf112('0x2c')],_0x1c0f45['query']);_0x147e05[_0xf112('0x31')]=_[_0xf112('0x30')](_0x1c0f45[_0xf112('0x2c')],qs[_0xf112('0x32')](_0x1ebeef[_0xf112('0x2e')][_0xf112('0x32')]));_0x147e05[_0xf112('0x31')]=_0x147e05[_0xf112('0x31')]['length']?_0x147e05['attributes']:_0x1c0f45[_0xf112('0x2c')];if(_0x1ebeef[_0xf112('0x2e')][_0xf112('0x43')]){_0x147e05[_0xf112('0x3c')]=[{'all':!![]}];}_0x147e05=_[_0xf112('0x39')]({},_0x147e05,_0x1ebeef[_0xf112('0x3a')]);return db[_0xf112('0x29')][_0xf112('0x44')](_0x147e05)[_0xf112('0x23')](handleEntityNotFound(_0x1858c6,null))[_0xf112('0x23')](respondWithResult(_0x1858c6,null))[_0xf112('0x3e')](handleError(_0x1858c6,null));};exports[_0xf112('0x45')]=function(_0x31cab8,_0x1b496e){return db[_0xf112('0x29')][_0xf112('0x45')](_0x31cab8[_0xf112('0x46')],{})['then'](respondWithResult(_0x1b496e,0xc9))[_0xf112('0x3e')](handleError(_0x1b496e,null));};exports[_0xf112('0x22')]=function(_0x34c66d,_0x51a6c4){if(_0x34c66d[_0xf112('0x46')]['id']){delete _0x34c66d[_0xf112('0x46')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x34c66d['params']['id']}})['then'](handleEntityNotFound(_0x51a6c4,null))['then'](saveUpdates(_0x34c66d[_0xf112('0x46')],null))[_0xf112('0x23')](respondWithResult(_0x51a6c4,null))[_0xf112('0x3e')](handleError(_0x51a6c4,null));};exports[_0xf112('0x24')]=function(_0x5de006,_0x3faa34){return db[_0xf112('0x29')]['find']({'where':{'id':_0x5de006[_0xf112('0x40')]['id']}})[_0xf112('0x23')](handleEntityNotFound(_0x3faa34,null))['then'](removeEntity(_0x3faa34,null))[_0xf112('0x3e')](handleError(_0x3faa34,null));};exports['describe']=function(_0x3683bd,_0x4f9d58){return db['WhatsappTransferReport'][_0xf112('0x47')]()[_0xf112('0x23')](respondWithResult(_0x4f9d58,null))[_0xf112('0x3e')](handleError(_0x4f9d58,null));}; \ No newline at end of file +var _0x1fe1=['status','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit'];(function(_0x1d10ae,_0x23555b){var _0x4541fc=function(_0x9e1a36){while(--_0x9e1a36){_0x1d10ae['push'](_0x1d10ae['shift']());}};_0x4541fc(++_0x23555b);}(_0x1fe1,0xbd));var _0x11fe=function(_0x25ad0d,_0x1c13e6){_0x25ad0d=_0x25ad0d-0x0;var _0x12f2b7=_0x1fe1[_0x25ad0d];return _0x12f2b7;};'use strict';var emlformat=require(_0x11fe('0x0'));var rimraf=require(_0x11fe('0x1'));var zipdir=require(_0x11fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11fe('0x3'));var moment=require(_0x11fe('0x4'));var BPromise=require(_0x11fe('0x5'));var Mustache=require(_0x11fe('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x11fe('0x7'));var ejs=require(_0x11fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11fe('0x9'));var crypto=require(_0x11fe('0xa'));var jsforce=require(_0x11fe('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x11fe('0x7'));var querystring=require(_0x11fe('0xc'));var Papa=require(_0x11fe('0xd'));var Redis=require(_0x11fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x11fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11fe('0x10'));var utils=require(_0x11fe('0x11'));var config=require(_0x11fe('0x12'));var licenseUtil=require(_0x11fe('0x13'));var db=require(_0x11fe('0x14'))['db'];function respondWithStatusCode(_0x2b7fc7,_0x430d76){_0x430d76=_0x430d76||0xcc;return function(_0x389ab7){if(_0x389ab7){return _0x2b7fc7[_0x11fe('0x15')](_0x430d76);}return _0x2b7fc7['status'](_0x430d76)['end']();};}function respondWithResult(_0x514f10,_0x159fb7){_0x159fb7=_0x159fb7||0xc8;return function(_0x1318b3){if(_0x1318b3){return _0x514f10['status'](_0x159fb7)[_0x11fe('0x16')](_0x1318b3);}};}function respondWithFilteredResult(_0xcaccd5,_0x376748){return function(_0x39c8f3){if(_0x39c8f3){var _0x3bc5d8=typeof _0x376748[_0x11fe('0x17')]===_0x11fe('0x18')&&typeof _0x376748['limit']===_0x11fe('0x18');var _0x2ef394=_0x39c8f3['count'];var _0x5d4e0b=_0x3bc5d8?0x0:_0x376748[_0x11fe('0x17')];var _0x47f70b=_0x3bc5d8?_0x39c8f3[_0x11fe('0x19')]:_0x376748['offset']+_0x376748[_0x11fe('0x1a')];var _0x3dd272;if(_0x47f70b>=_0x2ef394){_0x47f70b=_0x2ef394;_0x3dd272=0xc8;}else{_0x3dd272=0xce;}_0xcaccd5[_0x11fe('0x1b')](_0x3dd272);return _0xcaccd5[_0x11fe('0x1c')](_0x11fe('0x1d'),_0x5d4e0b+'-'+_0x47f70b+'/'+_0x2ef394)['json'](_0x39c8f3);}return null;};}function patchUpdates(_0x37c309){return function(_0x112c2c){try{jsonpatch[_0x11fe('0x1e')](_0x112c2c,_0x37c309,!![]);}catch(_0xd37dae){return BPromise[_0x11fe('0x1f')](_0xd37dae);}return _0x112c2c[_0x11fe('0x20')]();};}function saveUpdates(_0x2c6795,_0x74fad4){return function(_0x1a1040){if(_0x1a1040){return _0x1a1040[_0x11fe('0x21')](_0x2c6795)[_0x11fe('0x22')](function(_0x197344){return _0x197344;});}return null;};}function removeEntity(_0xd5dd60,_0x1eda95){return function(_0x422969){if(_0x422969){return _0x422969['destroy']()[_0x11fe('0x22')](function(){_0xd5dd60[_0x11fe('0x1b')](0xcc)[_0x11fe('0x23')]();});}};}function handleEntityNotFound(_0x440ada,_0x51a4d3){return function(_0x322a4c){if(!_0x322a4c){_0x440ada[_0x11fe('0x15')](0x194);}return _0x322a4c;};}function handleError(_0x509036,_0x3731b2){_0x3731b2=_0x3731b2||0x1f4;return function(_0x315cd6){logger[_0x11fe('0x24')](_0x315cd6[_0x11fe('0x25')]);if(_0x315cd6['name']){delete _0x315cd6[_0x11fe('0x26')];}_0x509036[_0x11fe('0x1b')](_0x3731b2)['send'](_0x315cd6);};}exports[_0x11fe('0x27')]=function(_0x4e9016,_0x1f1953){var _0x3057e1={},_0x2436ad={},_0xeb4150={'count':0x0,'rows':[]};var _0x3ec437=_[_0x11fe('0x28')](db[_0x11fe('0x29')][_0x11fe('0x2a')],function(_0x5cda21){return{'name':_0x5cda21['fieldName'],'type':_0x5cda21[_0x11fe('0x2b')]['key']};});_0x2436ad[_0x11fe('0x2c')]=_['map'](_0x3ec437,_0x11fe('0x26'));_0x2436ad['query']=_[_0x11fe('0x2d')](_0x4e9016[_0x11fe('0x2e')]);_0x2436ad[_0x11fe('0x2f')]=_['intersection'](_0x2436ad['model'],_0x2436ad[_0x11fe('0x2e')]);_0x3057e1[_0x11fe('0x30')]=_[_0x11fe('0x31')](_0x2436ad[_0x11fe('0x2c')],qs[_0x11fe('0x32')](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x32')]));_0x3057e1['attributes']=_0x3057e1['attributes'][_0x11fe('0x33')]?_0x3057e1['attributes']:_0x2436ad[_0x11fe('0x2c')];if(!_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x34')](_0x11fe('0x35'))){_0x3057e1[_0x11fe('0x1a')]=qs[_0x11fe('0x1a')](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x1a')]);_0x3057e1[_0x11fe('0x17')]=qs['offset'](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x17')]);}_0x3057e1[_0x11fe('0x36')]=qs['sort'](_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x37')]);_0x3057e1[_0x11fe('0x38')]=qs[_0x11fe('0x2f')](_['pick'](_0x4e9016[_0x11fe('0x2e')],_0x2436ad[_0x11fe('0x2f')]),_0x3ec437);if(_0x4e9016[_0x11fe('0x2e')][_0x11fe('0x39')]){_0x3057e1[_0x11fe('0x38')]=_[_0x11fe('0x3a')](_0x3057e1[_0x11fe('0x38')],{'$or':_['map'](_0x3ec437,function(_0x415151){if(_0x415151[_0x11fe('0x2b')]!==_0x11fe('0x3b')){var _0x1758d0={};_0x1758d0[_0x415151[_0x11fe('0x26')]]={'$like':'%'+_0x4e9016[_0x11fe('0x2e')]['filter']+'%'};return _0x1758d0;}})});}_0x3057e1=_[_0x11fe('0x3a')]({},_0x3057e1,_0x4e9016[_0x11fe('0x3c')]);var _0x161c8d={'where':_0x3057e1['where']};return db['WhatsappTransferReport'][_0x11fe('0x19')](_0x161c8d)[_0x11fe('0x22')](function(_0x51607c){_0xeb4150[_0x11fe('0x19')]=_0x51607c;if(_0x4e9016['query']['includeAll']){_0x3057e1['include']=[{'all':!![]}];}return db[_0x11fe('0x29')][_0x11fe('0x3d')](_0x3057e1);})[_0x11fe('0x22')](function(_0x37ed92){_0xeb4150[_0x11fe('0x3e')]=_0x37ed92;return _0xeb4150;})[_0x11fe('0x22')](respondWithFilteredResult(_0x1f1953,_0x3057e1))[_0x11fe('0x3f')](handleError(_0x1f1953,null));};exports[_0x11fe('0x40')]=function(_0xa1c698,_0x2fe790){var _0x114a7d={'raw':!![],'where':{'id':_0xa1c698['params']['id']}},_0x1a6bcc={};_0x1a6bcc['model']=_['keys'](db[_0x11fe('0x29')][_0x11fe('0x2a')]);_0x1a6bcc[_0x11fe('0x2e')]=_[_0x11fe('0x2d')](_0xa1c698[_0x11fe('0x2e')]);_0x1a6bcc['filters']=_[_0x11fe('0x31')](_0x1a6bcc['model'],_0x1a6bcc[_0x11fe('0x2e')]);_0x114a7d[_0x11fe('0x30')]=_[_0x11fe('0x31')](_0x1a6bcc['model'],qs[_0x11fe('0x32')](_0xa1c698['query']['fields']));_0x114a7d['attributes']=_0x114a7d[_0x11fe('0x30')][_0x11fe('0x33')]?_0x114a7d[_0x11fe('0x30')]:_0x1a6bcc[_0x11fe('0x2c')];if(_0xa1c698[_0x11fe('0x2e')][_0x11fe('0x41')]){_0x114a7d['include']=[{'all':!![]}];}_0x114a7d=_[_0x11fe('0x3a')]({},_0x114a7d,_0xa1c698[_0x11fe('0x3c')]);return db[_0x11fe('0x29')]['find'](_0x114a7d)[_0x11fe('0x22')](handleEntityNotFound(_0x2fe790,null))[_0x11fe('0x22')](respondWithResult(_0x2fe790,null))['catch'](handleError(_0x2fe790,null));};exports[_0x11fe('0x42')]=function(_0x5567d4,_0x128066){return db[_0x11fe('0x29')][_0x11fe('0x42')](_0x5567d4[_0x11fe('0x43')],{})[_0x11fe('0x22')](respondWithResult(_0x128066,0xc9))[_0x11fe('0x3f')](handleError(_0x128066,null));};exports[_0x11fe('0x21')]=function(_0x36e31b,_0x215f38){if(_0x36e31b['body']['id']){delete _0x36e31b[_0x11fe('0x43')]['id'];}return db[_0x11fe('0x29')][_0x11fe('0x44')]({'where':{'id':_0x36e31b[_0x11fe('0x45')]['id']}})[_0x11fe('0x22')](handleEntityNotFound(_0x215f38,null))[_0x11fe('0x22')](saveUpdates(_0x36e31b['body'],null))[_0x11fe('0x22')](respondWithResult(_0x215f38,null))['catch'](handleError(_0x215f38,null));};exports[_0x11fe('0x46')]=function(_0x4ebd9c,_0x37acf2){return db[_0x11fe('0x29')][_0x11fe('0x44')]({'where':{'id':_0x4ebd9c[_0x11fe('0x45')]['id']}})[_0x11fe('0x22')](handleEntityNotFound(_0x37acf2,null))[_0x11fe('0x22')](removeEntity(_0x37acf2,null))[_0x11fe('0x3f')](handleError(_0x37acf2,null));};exports['describe']=function(_0x10a54f,_0xd7690c){return db['WhatsappTransferReport'][_0x11fe('0x47')]()['then'](respondWithResult(_0xd7690c,null))['catch'](handleError(_0xd7690c,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index d917308..3745182 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 _0x3ef7=['../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x33b858,_0x39f009){var _0x1112ba=function(_0x107f61){while(--_0x107f61){_0x33b858['push'](_0x33b858['shift']());}};_0x1112ba(++_0x39f009);}(_0x3ef7,0xa0));var _0x73ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ef7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x73ef('0x0'));var util=require(_0x73ef('0x1'));var logger=require(_0x73ef('0x2'))(_0x73ef('0x3'));var moment=require(_0x73ef('0x4'));var BPromise=require(_0x73ef('0x5'));var rp=require(_0x73ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x73ef('0x9')]=function(_0x1b1c92,_0xeb8dde){return _0x1b1c92[_0x73ef('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x73ef('0xb'),'fields':[_0x73ef('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2cc=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','lodash','../../config/logger','api','bluebird','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc2cc,0x1b1));var _0xcc2c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc2cc[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcc2c('0x0'));var util=require('util');var logger=require(_0xcc2c('0x1'))(_0xcc2c('0x2'));var moment=require('moment');var BPromise=require(_0xcc2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc2c('0x4'));var rimraf=require('rimraf');var config=require(_0xcc2c('0x5'));var attributes=require(_0xcc2c('0x6'));module[_0xcc2c('0x7')]=function(_0xb91e3c,_0x215116){return _0xb91e3c[_0xcc2c('0x8')](_0xcc2c('0x9'),attributes,{'tableName':_0xcc2c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6d9f288..1a966da 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 _0x69a3=['debug','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0xc751f5,_0x41d3d6){var _0x4b98eb=function(_0x36d10d){while(--_0x36d10d){_0xc751f5['push'](_0xc751f5['shift']());}};_0x4b98eb(++_0x41d3d6);}(_0x69a3,0x18e));var _0x369a=function(_0x3bec89,_0xa9396a){_0x3bec89=_0x3bec89-0x0;var _0x1c3745=_0x69a3[_0x3bec89];return _0x1c3745;};'use strict';var _=require('lodash');var util=require(_0x369a('0x0'));var moment=require(_0x369a('0x1'));var BPromise=require(_0x369a('0x2'));var rs=require(_0x369a('0x3'));var fs=require('fs');var Redis=require(_0x369a('0x4'));var db=require(_0x369a('0x5'))['db'];var utils=require(_0x369a('0x6'));var logger=require(_0x369a('0x7'))(_0x369a('0x8'));var config=require(_0x369a('0x9'));var jayson=require(_0x369a('0xa'));var client=jayson[_0x369a('0xb')][_0x369a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10299c,_0x56ddf1,_0x34fb3c){return new BPromise(function(_0x4974c8,_0x46f3f5){return client['request'](_0x10299c,_0x34fb3c)[_0x369a('0xd')](function(_0x120d29){logger['info'](_0x369a('0xe'),_0x56ddf1,_0x369a('0xf'));logger[_0x369a('0x10')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x56ddf1,_0x369a('0xf'),JSON[_0x369a('0x11')](_0x120d29));if(_0x120d29[_0x369a('0x12')]){if(_0x120d29[_0x369a('0x12')][_0x369a('0x13')]===0x1f4){logger['error'](_0x369a('0xe'),_0x56ddf1,_0x120d29[_0x369a('0x12')]['message']);return _0x46f3f5(_0x120d29[_0x369a('0x12')]['message']);}logger[_0x369a('0x12')](_0x369a('0xe'),_0x56ddf1,_0x120d29[_0x369a('0x12')][_0x369a('0x14')]);return _0x4974c8(_0x120d29[_0x369a('0x12')][_0x369a('0x14')]);}else{logger[_0x369a('0x15')](_0x369a('0xe'),_0x56ddf1,'request\x20sent');_0x4974c8(_0x120d29['result']['message']);}})[_0x369a('0x16')](function(_0x21fed9){logger[_0x369a('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x56ddf1,_0x21fed9);_0x46f3f5(_0x21fed9);});});} \ No newline at end of file +var _0xfaa8=['message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1eff93,_0x54cce2){var _0x3dd75a=function(_0x191c0f){while(--_0x191c0f){_0x1eff93['push'](_0x1eff93['shift']());}};_0x3dd75a(++_0x54cce2);}(_0xfaa8,0x183));var _0x8faa=function(_0x2ef71a,_0x4b07af){_0x2ef71a=_0x2ef71a-0x0;var _0x579efe=_0xfaa8[_0x2ef71a];return _0x579efe;};'use strict';var _=require(_0x8faa('0x0'));var util=require('util');var moment=require(_0x8faa('0x1'));var BPromise=require(_0x8faa('0x2'));var rs=require(_0x8faa('0x3'));var fs=require('fs');var Redis=require(_0x8faa('0x4'));var db=require(_0x8faa('0x5'))['db'];var utils=require(_0x8faa('0x6'));var logger=require(_0x8faa('0x7'))(_0x8faa('0x8'));var config=require(_0x8faa('0x9'));var jayson=require(_0x8faa('0xa'));var client=jayson[_0x8faa('0xb')][_0x8faa('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5bfd7a,_0x201bd,_0x345ad9){return new BPromise(function(_0x4f6294,_0x52602f){return client[_0x8faa('0xd')](_0x5bfd7a,_0x345ad9)[_0x8faa('0xe')](function(_0x256071){logger['info'](_0x8faa('0xf'),_0x201bd,_0x8faa('0x10'));logger[_0x8faa('0x11')](_0x8faa('0x12'),_0x201bd,_0x8faa('0x10'),JSON['stringify'](_0x256071));if(_0x256071[_0x8faa('0x13')]){if(_0x256071['error'][_0x8faa('0x14')]===0x1f4){logger[_0x8faa('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201bd,_0x256071[_0x8faa('0x13')]['message']);return _0x52602f(_0x256071[_0x8faa('0x13')][_0x8faa('0x15')]);}logger[_0x8faa('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x201bd,_0x256071[_0x8faa('0x13')][_0x8faa('0x15')]);return _0x4f6294(_0x256071[_0x8faa('0x13')]['message']);}else{logger[_0x8faa('0x16')](_0x8faa('0xf'),_0x201bd,'request\x20sent');_0x4f6294(_0x256071[_0x8faa('0x17')][_0x8faa('0x15')]);}})['catch'](function(_0x1492bf){logger[_0x8faa('0x13')](_0x8faa('0xf'),_0x201bd,_0x1492bf);_0x52602f(_0x1492bf);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8af6ed2..c586690 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27c5=['./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sync','seedDB','default','then','listen','info','start','exitCode','length','map','name','Online\x20apps:','join','Offline\x20apps:','filter','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./config/seedDB','./config/license','./rpc'];(function(_0x296e42,_0x381970){var _0x497996=function(_0x113ed7){while(--_0x113ed7){_0x296e42['push'](_0x296e42['shift']());}};_0x497996(++_0x381970);}(_0x27c5,0x173));var _0x527c=function(_0x38efe1,_0x34a883){_0x38efe1=_0x38efe1-0x0;var _0x44c9fb=_0x27c5[_0x38efe1];return _0x44c9fb;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x527c('0x0'));var checkLicense=require(_0x527c('0x1'));var rpc=require(_0x527c('0x2'));var config=require('./config/environment');var logger=require(_0x527c('0x3'))(_0x527c('0x4'));var pm2=require(_0x527c('0x5'));var pm2Config=require(_0x527c('0x6'));var schedule=require(_0x527c('0x7'));var chat=require(_0x527c('0x8'));var whatsapp=require(_0x527c('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x527c('0xa'));function main(){return db['sequelize'][_0x527c('0xb')]()['then'](function(){if(config[_0x527c('0xc')]){return seedDb[_0x527c('0xd')]();}})[_0x527c('0xe')](function(){return checkLicense['default']();})[_0x527c('0xe')](function(){return rpc[_0x527c('0xf')]();})[_0x527c('0xe')](function(_0x369374){logger[_0x527c('0x10')](_0x369374);return chat[_0x527c('0x11')]();})[_0x527c('0xe')](function(){return whatsapp[_0x527c('0x11')]();})[_0x527c('0xe')](function(){return schedule[_0x527c('0x11')]();})[_0x527c('0xe')](function(){return transcribe['start']();})['then'](function(){return provider[_0x527c('0x11')]();})[_0x527c('0xe')](function(_0x30a65a){logger[_0x527c('0x10')](_0x30a65a);return pm2['start'](pm2Config);})[_0x527c('0xe')](function(_0xf7c373){var _0x5de1a2=_0xf7c373['filter'](function(_0x2fce03){return typeof _0x2fce03['exitCode']==='number'&&_0x2fce03[_0x527c('0x12')]>=0x0;});if(_0x5de1a2[_0x527c('0x13')]>0x0){throw new Error(_0x5de1a2[_0x527c('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x527c('0x14')](_0x5de1a2,function(_0x1f2702){return'\x22'+_0x1f2702['pm2_env'][_0x527c('0x15')]+'\x22';}));}logger['info'](_0x527c('0x16'),_[_0x527c('0x14')](_['filter'](_0xf7c373,{'status':'online'}),_0x527c('0x15'))[_0x527c('0x17')]());logger[_0x527c('0x10')](_0x527c('0x18'),_['map'](_[_0x527c('0x19')](_0xf7c373,function(_0x526b03){return _0x526b03[_0x527c('0x1a')]!=='online';}),_0x527c('0x15'))['join']()||_0x527c('0x1b'));console[_0x527c('0x1c')](_0x527c('0x1d'));})['catch'](function(_0x166a42){console['log'](_0x527c('0x1e'),_0x166a42);logger[_0x527c('0x1f')](_0x527c('0x20'),_0x166a42);process[_0x527c('0x21')](0x1);});}main(); \ No newline at end of file +var _0x8375=['./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','seedDB','default','listen','then','info','start','filter','exitCode','number','length','map','pm2_env','online','join','Offline\x20apps:','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app'];(function(_0x531125,_0x398535){var _0x529a09=function(_0x3e54b0){while(--_0x3e54b0){_0x531125['push'](_0x531125['shift']());}};_0x529a09(++_0x398535);}(_0x8375,0xa8));var _0x5837=function(_0x4808cd,_0x1522c2){_0x4808cd=_0x4808cd-0x0;var _0x560440=_0x8375[_0x4808cd];return _0x560440;};'use strict';var _=require(_0x5837('0x0'));var db=require(_0x5837('0x1'))['db'];var seedDb=require(_0x5837('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x5837('0x3'));var config=require(_0x5837('0x4'));var logger=require(_0x5837('0x5'))(_0x5837('0x6'));var pm2=require(_0x5837('0x7'));var pm2Config=require(_0x5837('0x8'));var schedule=require('./config/schedule');var chat=require(_0x5837('0x9'));var whatsapp=require(_0x5837('0xa'));var transcribe=require(_0x5837('0xb'));var provider=require(_0x5837('0xc'));function main(){return db[_0x5837('0xd')]['sync']()['then'](function(){if(config[_0x5837('0xe')]){return seedDb[_0x5837('0xf')]();}})['then'](function(){return checkLicense[_0x5837('0xf')]();})['then'](function(){return rpc[_0x5837('0x10')]();})[_0x5837('0x11')](function(_0x11cd29){logger[_0x5837('0x12')](_0x11cd29);return chat[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return whatsapp['start']();})[_0x5837('0x11')](function(){return schedule[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return transcribe[_0x5837('0x13')]();})[_0x5837('0x11')](function(){return provider['start']();})['then'](function(_0x5a23d2){logger[_0x5837('0x12')](_0x5a23d2);return pm2[_0x5837('0x13')](pm2Config);})[_0x5837('0x11')](function(_0xa5718d){var _0x17601e=_0xa5718d[_0x5837('0x14')](function(_0x206f02){return typeof _0x206f02[_0x5837('0x15')]===_0x5837('0x16')&&_0x206f02['exitCode']>=0x0;});if(_0x17601e[_0x5837('0x17')]>0x0){throw new Error(_0x17601e[_0x5837('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x5837('0x18')](_0x17601e,function(_0x2297b4){return'\x22'+_0x2297b4[_0x5837('0x19')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x5837('0x18')](_[_0x5837('0x14')](_0xa5718d,{'status':_0x5837('0x1a')}),'name')[_0x5837('0x1b')]());logger[_0x5837('0x12')](_0x5837('0x1c'),_[_0x5837('0x18')](_['filter'](_0xa5718d,function(_0x4908c2){return _0x4908c2['status']!==_0x5837('0x1a');}),'name')[_0x5837('0x1b')]()||_0x5837('0x1d'));console[_0x5837('0x1e')](_0x5837('0x1f'));})['catch'](function(_0x5aa887){console[_0x5837('0x1e')](_0x5837('0x20'),_0x5aa887);logger[_0x5837('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5aa887);process[_0x5837('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 795aae7..ead4cfd 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x172555,_0x4f04fe){var _0x5edc24=function(_0x436fe3){while(--_0x436fe3){_0x172555['push'](_0x172555['shift']());}};_0x5edc24(++_0x4f04fe);}(_0x55ca,0x126));var _0xa55c=function(_0x466f51,_0x1393ed){_0x466f51=_0x466f51-0x0;var _0x2db305=_0x55ca[_0x466f51];return _0x2db305;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x346442,_0x38f991){var _0x436e50=function(_0x3f9f47){while(--_0x3f9f47){_0x346442['push'](_0x346442['shift']());}};_0x436e50(++_0x38f991);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('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[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4ae9a97..42e7518 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 _0x72ca=['final','utf8','crypto','bluebird','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','encryptFile','createReadStream','createWriteStream','createCipher','binary','write','end','close','unlink','decryptFile','createDecipher','data','update','secret','base64','decryptString'];(function(_0x1ecb6e,_0x580df0){var _0x474799=function(_0x4c8fbc){while(--_0x4c8fbc){_0x1ecb6e['push'](_0x1ecb6e['shift']());}};_0x474799(++_0x580df0);}(_0x72ca,0xe9));var _0xa72c=function(_0x327c64,_0x3d947b){_0x327c64=_0x327c64-0x0;var _0x18dab3=_0x72ca[_0x327c64];return _0x18dab3;};'use strict';var crypto=require(_0xa72c('0x0'));var fs=require('fs');var BPromise=require(_0xa72c('0x1'));var _=require('lodash');var config=require(_0xa72c('0x2'));var logger=require(_0xa72c('0x3'))(_0xa72c('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xa72c('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa72c('0x6')};if(config['encrypt']&&config[_0xa72c('0x7')][_0xa72c('0x8')]){var isSupported=isAlgorithmSupported(config[_0xa72c('0x7')][_0xa72c('0x8')]);if(isSupported){fileOptions[_0xa72c('0x8')]=config[_0xa72c('0x7')][_0xa72c('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa72c('0x9')](',\x20');logger[_0xa72c('0xa')](config[_0xa72c('0x7')][_0xa72c('0x8')],_0xa72c('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x5e311a){return AES_SUPPORTED_RX['test'](_0x5e311a);}function getSupportedCiphers(){return crypto[_0xa72c('0xc')]()[_0xa72c('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x259c27){return getSupportedCiphers()[_0xa72c('0xe')](_0x259c27)>-0x1;}function combineOptions(_0x4a98ad){var _0x155b9c={};for(var _0x46eba4 in fileOptions){if(fileOptions['hasOwnProperty'](_0x46eba4)){_0x155b9c[_0x46eba4]=fileOptions[_0x46eba4];}}if(_0x4a98ad){for(var _0x5830e6 in _0x4a98ad){if(_0x4a98ad['hasOwnProperty'](_0x5830e6)){_0x155b9c[_0x5830e6]=_0x4a98ad[_0x5830e6];}}}return _0x155b9c;}exports[_0xa72c('0xf')]=function(_0x135202,_0x1d7a0d,_0x5ca636,_0x402844){return new BPromise(function(_0x593c25,_0x1b82ea){_0x402844=combineOptions(_0x402844);var _0x3344b5=new Buffer(_0x5ca636);var _0xe978ec=fs[_0xa72c('0x10')](_0x135202);var _0x458094=fs[_0xa72c('0x11')](_0x1d7a0d);var _0x4022d5=crypto[_0xa72c('0x12')](_0x402844[_0xa72c('0x8')],_0x3344b5);_0xe978ec['on']('data',function(_0x38acb1){var _0x287da8=new Buffer(_0x4022d5['update'](_0x38acb1),_0xa72c('0x13'));_0x458094[_0xa72c('0x14')](_0x287da8);});_0xe978ec['on'](_0xa72c('0x15'),function(){try{var _0x250063=new Buffer(_0x4022d5['final'](_0xa72c('0x13')),_0xa72c('0x13'));_0x458094[_0xa72c('0x14')](_0x250063);_0x458094[_0xa72c('0x15')]();_0x458094['on'](_0xa72c('0x16'),function(){return _0x593c25(_0x1d7a0d);});}catch(_0x186849){fs[_0xa72c('0x17')](_0x1d7a0d);return _0x1b82ea(_0x186849);}});});};exports[_0xa72c('0x18')]=function(_0x1415f4,_0x322260,_0x3a1ef0,_0xd735c5){return new BPromise(function(_0x243880,_0x37f9f1){_0xd735c5=combineOptions(_0xd735c5);var _0x248b41=new Buffer(_0x3a1ef0);var _0x26d853=fs[_0xa72c('0x10')](_0x1415f4);var _0x2a39c2=fs[_0xa72c('0x11')](_0x322260);var _0x28f667=crypto[_0xa72c('0x19')](_0xd735c5[_0xa72c('0x8')],_0x248b41);_0x26d853['on'](_0xa72c('0x1a'),function(_0x54447d){var _0x150156=new Buffer(_0x28f667[_0xa72c('0x1b')](_0x54447d),'binary');_0x2a39c2[_0xa72c('0x14')](_0x150156);});_0x26d853['on']('end',function(){try{var _0x241fa8=new Buffer(_0x28f667['final']('binary'),_0xa72c('0x13'));_0x2a39c2[_0xa72c('0x14')](_0x241fa8);_0x2a39c2[_0xa72c('0x15')]();_0x2a39c2['on']('close',function(){return _0x243880(_0x322260);});}catch(_0x25871f){fs[_0xa72c('0x17')](_0x322260);return _0x37f9f1(_0x25871f);}});});};exports['encryptString']=function(_0x1a6e56,_0x5b63fb,_0x1cf0ee){var _0x44ad0f=_0x1cf0ee||stringOptions[_0xa72c('0x8')];var _0x32b7f3=_0x5b63fb||stringOptions[_0xa72c('0x1c')];var _0x31c429=crypto[_0xa72c('0x12')](_0x44ad0f,_0x32b7f3);var _0x2744ef=_0x31c429[_0xa72c('0x1b')](_0x1a6e56,'utf8',_0xa72c('0x1d'));_0x2744ef+=_0x31c429['final'](_0xa72c('0x1d'));return _0x2744ef;};exports[_0xa72c('0x1e')]=function(_0x11b665,_0x2d2509,_0x201b30){var _0x339bbe=_0x201b30||stringOptions[_0xa72c('0x8')];var _0x1003dc=_0x2d2509||stringOptions[_0xa72c('0x1c')];var _0x176810=crypto['createDecipher'](_0x339bbe,_0x1003dc);var _0x5bec6d=_0x176810[_0xa72c('0x1b')](_0x11b665,_0xa72c('0x1d'),'utf8');_0x5bec6d+=_0x176810[_0xa72c('0x1f')](_0xa72c('0x20'));return _0x5bec6d;}; \ No newline at end of file +var _0x2abb=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','write','end','final','binary','unlink','createReadStream','createWriteStream','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x25f743,_0x765664){var _0x2ba165=function(_0xf13c61){while(--_0xf13c61){_0x25f743['push'](_0x25f743['shift']());}};_0x2ba165(++_0x765664);}(_0x2abb,0x7e));var _0xb2ab=function(_0x1f0159,_0x1939a9){_0x1f0159=_0x1f0159-0x0;var _0x3e145f=_0x2abb[_0x1f0159];return _0x3e145f;};'use strict';var crypto=require(_0xb2ab('0x0'));var fs=require('fs');var BPromise=require(_0xb2ab('0x1'));var _=require(_0xb2ab('0x2'));var config=require(_0xb2ab('0x3'));var logger=require(_0xb2ab('0x4'))(_0xb2ab('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb2ab('0x6')][_0xb2ab('0x7')],'algorithm':_0xb2ab('0x8')};const fileOptions={'algorithm':_0xb2ab('0x9')};if(config[_0xb2ab('0xa')]&&config[_0xb2ab('0xa')][_0xb2ab('0xb')]){var isSupported=isAlgorithmSupported(config[_0xb2ab('0xa')][_0xb2ab('0xb')]);if(isSupported){fileOptions[_0xb2ab('0xb')]=config[_0xb2ab('0xa')][_0xb2ab('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb2ab('0xc')](',\x20');logger[_0xb2ab('0xd')](config[_0xb2ab('0xa')][_0xb2ab('0xb')],_0xb2ab('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x8d4530){return AES_SUPPORTED_RX[_0xb2ab('0xf')](_0x8d4530);}function getSupportedCiphers(){return crypto[_0xb2ab('0x10')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2a606b){return getSupportedCiphers()[_0xb2ab('0x11')](_0x2a606b)>-0x1;}function combineOptions(_0x510e35){var _0x1c6845={};for(var _0x16fde7 in fileOptions){if(fileOptions[_0xb2ab('0x12')](_0x16fde7)){_0x1c6845[_0x16fde7]=fileOptions[_0x16fde7];}}if(_0x510e35){for(var _0x14f13c in _0x510e35){if(_0x510e35[_0xb2ab('0x12')](_0x14f13c)){_0x1c6845[_0x14f13c]=_0x510e35[_0x14f13c];}}}return _0x1c6845;}exports[_0xb2ab('0x13')]=function(_0x95fb07,_0x1ebeaa,_0x308ee9,_0x38adfc){return new BPromise(function(_0x312784,_0xaebb08){_0x38adfc=combineOptions(_0x38adfc);var _0x5bb070=new Buffer(_0x308ee9);var _0x539dfd=fs['createReadStream'](_0x95fb07);var _0x9224ca=fs['createWriteStream'](_0x1ebeaa);var _0x2756a4=crypto[_0xb2ab('0x14')](_0x38adfc[_0xb2ab('0xb')],_0x5bb070);_0x539dfd['on'](_0xb2ab('0x15'),function(_0x1a1f84){var _0x3432ed=new Buffer(_0x2756a4[_0xb2ab('0x16')](_0x1a1f84),'binary');_0x9224ca[_0xb2ab('0x17')](_0x3432ed);});_0x539dfd['on'](_0xb2ab('0x18'),function(){try{var _0x41b200=new Buffer(_0x2756a4[_0xb2ab('0x19')](_0xb2ab('0x1a')),'binary');_0x9224ca[_0xb2ab('0x17')](_0x41b200);_0x9224ca[_0xb2ab('0x18')]();_0x9224ca['on']('close',function(){return _0x312784(_0x1ebeaa);});}catch(_0x435606){fs[_0xb2ab('0x1b')](_0x1ebeaa);return _0xaebb08(_0x435606);}});});};exports['decryptFile']=function(_0x1e8df8,_0x149417,_0x28d3a1,_0x1fe137){return new BPromise(function(_0x33e6be,_0x479cd7){_0x1fe137=combineOptions(_0x1fe137);var _0x277e37=new Buffer(_0x28d3a1);var _0x293281=fs[_0xb2ab('0x1c')](_0x1e8df8);var _0x47eb9e=fs[_0xb2ab('0x1d')](_0x149417);var _0x2c0241=crypto[_0xb2ab('0x1e')](_0x1fe137[_0xb2ab('0xb')],_0x277e37);_0x293281['on'](_0xb2ab('0x15'),function(_0x5d1c6f){var _0x2905f1=new Buffer(_0x2c0241[_0xb2ab('0x16')](_0x5d1c6f),_0xb2ab('0x1a'));_0x47eb9e[_0xb2ab('0x17')](_0x2905f1);});_0x293281['on'](_0xb2ab('0x18'),function(){try{var _0x2ee6d6=new Buffer(_0x2c0241['final']('binary'),_0xb2ab('0x1a'));_0x47eb9e['write'](_0x2ee6d6);_0x47eb9e[_0xb2ab('0x18')]();_0x47eb9e['on']('close',function(){return _0x33e6be(_0x149417);});}catch(_0x5aac88){fs[_0xb2ab('0x1b')](_0x149417);return _0x479cd7(_0x5aac88);}});});};exports['encryptString']=function(_0x4d5474,_0x24a69a,_0x187c83){var _0x1f95d6=_0x187c83||stringOptions['algorithm'];var _0x453ea1=_0x24a69a||stringOptions[_0xb2ab('0x1f')];var _0x3e2262=crypto['createCipher'](_0x1f95d6,_0x453ea1);var _0xe32594=_0x3e2262['update'](_0x4d5474,_0xb2ab('0x20'),_0xb2ab('0x21'));_0xe32594+=_0x3e2262['final'](_0xb2ab('0x21'));return _0xe32594;};exports[_0xb2ab('0x22')]=function(_0x571ee8,_0x5baeb1,_0x47848b){var _0x43d187=_0x47848b||stringOptions[_0xb2ab('0xb')];var _0x3b37ab=_0x5baeb1||stringOptions['secret'];var _0x519139=crypto['createDecipher'](_0x43d187,_0x3b37ab);var _0x4c2c0c=_0x519139[_0xb2ab('0x16')](_0x571ee8,_0xb2ab('0x21'),_0xb2ab('0x20'));_0x4c2c0c+=_0x519139[_0xb2ab('0x19')](_0xb2ab('0x20'));return _0x4c2c0c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f7074dc..38553ce 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 _0x83ca=['%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s'];(function(_0x185767,_0x21ad80){var _0x9842a2=function(_0x3d39e6){while(--_0x3d39e6){_0x185767['push'](_0x185767['shift']());}};_0x9842a2(++_0x21ad80);}(_0x83ca,0xd2));var _0xa83c=function(_0x3531fd,_0x50c302){_0x3531fd=_0x3531fd-0x0;var _0x2db543=_0x83ca[_0x3531fd];return _0x2db543;};'use strict';var util=require(_0xa83c('0x0'));var path=require(_0xa83c('0x1'));var _=require(_0xa83c('0x2'));var csv=require(_0xa83c('0x3'));var fs=require('fs');var BPromise=require(_0xa83c('0x4'));var zipdir=require(_0xa83c('0x5'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xa83c('0x6')];var logger=require(_0xa83c('0x7'))(_0xa83c('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa83c('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xd1ccb0,_0x43a528){var _0x5e8db7={'status':_0xd1ccb0};var _0x3fe164={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43a528){_0x5e8db7[_0xa83c('0xa')]=_0x43a528;}return db[_0xa83c('0xb')]['update'](_0x5e8db7,_0x3fe164);}function main(){var _0x559407=0x1388;var _0xfd8c71;logger[_0xa83c('0xc')](util[_0xa83c('0xd')](_0xa83c('0xe'),EXTRACTED_REPORT_ID,_0xa83c('0xf')));return db[_0xa83c('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa83c('0x11'),'splitSizeCsv']})[_0xa83c('0x12')](function(_0x5916a9){if(_0x5916a9){_0xfd8c71=_0x5916a9;_0x559407=_0xfd8c71['splitSizeCsv']||0x1388;}})[_0xa83c('0x12')](function(){return dbH[_0xa83c('0x13')][_0xa83c('0x14')](util[_0xa83c('0xd')](_0xa83c('0x15'),QUERY),{'type':dbH['sequelize'][_0xa83c('0x16')][_0xa83c('0x17')]});})[_0xa83c('0x12')](function(_0x329dc2){if(!_0x329dc2[0x0]['num']){return analyticExtractedReport(_0xa83c('0x18'));}var _0x252d8b=[];var _0x28c6ed=0x0;if(_0xfd8c71[_0xa83c('0x11')]){if(_0x329dc2&&_0x329dc2[_0xa83c('0x19')]){var _0x2bd5c8=_[_0xa83c('0x1a')](_0x329dc2[0x0][_0xa83c('0x1b')]/_0x559407);var _0x520cd4=Number[_0xa83c('0x1c')](_0x329dc2[0x0]['num']/_0x559407)?_0x329dc2[0x0][_0xa83c('0x1b')]%_0x559407:0x0;_0x2bd5c8[_0xa83c('0x1d')](function(_0x13d782){if(_0x13d782>0x0){_0x28c6ed+=_0x559407;}_0x252d8b[_0xa83c('0x1e')](dbH['sequelize'][_0xa83c('0x14')](util[_0xa83c('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x559407,_0x28c6ed),{'type':dbH[_0xa83c('0x13')]['QueryTypes'][_0xa83c('0x17')]}));});if(_0x520cd4>0x0){_0x28c6ed+=_0x559407;_0x252d8b[_0xa83c('0x1e')](dbH[_0xa83c('0x13')][_0xa83c('0x14')](util[_0xa83c('0xd')](_0xa83c('0x1f'),QUERY,_0x520cd4,_0x28c6ed),{'type':dbH[_0xa83c('0x13')]['QueryTypes'][_0xa83c('0x17')]}));}}}else{_0x252d8b[_0xa83c('0x1e')](dbH[_0xa83c('0x13')][_0xa83c('0x14')](QUERY,{'type':dbH[_0xa83c('0x13')][_0xa83c('0x16')][_0xa83c('0x17')]}));}var _0x380913=path[_0xa83c('0x20')](PATH);var _0x2322f9=path[_0xa83c('0x21')](PATH,_0xa83c('0x22'));var _0x1aa43f=_0xfd8c71[_0xa83c('0x11')]&&_0x252d8b[_0xa83c('0x19')]>0x1;var _0x5257d8=[];if(!fs[_0xa83c('0x23')](path[_0xa83c('0x24')](_0x380913,_0x2322f9))&&_0x1aa43f){fs[_0xa83c('0x25')](path[_0xa83c('0x24')](_0x380913,_0x2322f9));}return BPromise[_0xa83c('0x26')](_0x252d8b,function(_0x4881a5){_0x5257d8['push'](_0x4881a5);})[_0xa83c('0x12')](function(){for(var _0x3b0c2e=0x0;_0x3b0c2e<_0x5257d8[_0xa83c('0x19')];_0x3b0c2e+=0x1){var _0x144521;var _0x54662d=_0x5257d8[_0x3b0c2e];if(_0x1aa43f){_0x144521=path[_0xa83c('0x24')](_0x380913,_0x2322f9,util[_0xa83c('0xd')](_0xa83c('0x27'),_0x2322f9,_0x3b0c2e,'csv'));}else{_0x144521=path[_0xa83c('0x24')](_0x380913,util['format'](_0xa83c('0x28'),_0x2322f9,_0xa83c('0x29')));}fs[_0xa83c('0x2a')](_0x144521,csv(_0x54662d));}})['then'](function(){if(_0x1aa43f){return new Promise(function(_0x34f437){zipdir(path[_0xa83c('0x24')](_0x380913,_0x2322f9),{'saveTo':path[_0xa83c('0x24')](_0x380913,util[_0xa83c('0xd')](_0xa83c('0x28'),_0x2322f9,_0xa83c('0x2b')))},function(_0x28ca08,_0x15a93f){rimraf(path[_0xa83c('0x24')](_0x380913,_0x2322f9),function(){});_0x34f437(_0xa83c('0x2c'));});});}})[_0xa83c('0x12')](function(){logger[_0xa83c('0xc')](util[_0xa83c('0xd')](_0xa83c('0x2d'),EXTRACTED_REPORT_ID,_0xa83c('0xf')));return analyticExtractedReport('Completed',_0x1aa43f?util[_0xa83c('0xd')](_0xa83c('0x28'),_0x2322f9,_0x1aa43f?'zip':_0xa83c('0x29')):null);});})['catch'](function(_0x32a932){logger['info'](util['format'](_0xa83c('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xa83c('0x2f')](_0x32a932,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa83c('0x30'));})[_0xa83c('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb2b5=['then','join','%s%d.%s','%s.%s','csv','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync'];(function(_0x3f7796,_0x4f003b){var _0x3a4c76=function(_0x4246fc){while(--_0x4246fc){_0x3f7796['push'](_0x3f7796['shift']());}};_0x3a4c76(++_0x4f003b);}(_0xb2b5,0xa4));var _0x5b2b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb2b5[_0x32f7d7];return _0x133d09;};'use strict';var util=require('util');var path=require(_0x5b2b('0x0'));var _=require(_0x5b2b('0x1'));var csv=require(_0x5b2b('0x2'));var fs=require('fs');var BPromise=require(_0x5b2b('0x3'));var zipdir=require(_0x5b2b('0x4'));var rimraf=require(_0x5b2b('0x5'));var db=require(_0x5b2b('0x6'))['db'];var dbH=require(_0x5b2b('0x6'))[_0x5b2b('0x7')];var logger=require('../../config/logger')(_0x5b2b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x5b2b('0x9')][0x2]);var QUERY=process[_0x5b2b('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x32d2e6,_0xb74c42){var _0x1c0dab={'status':_0x32d2e6};var _0x322f14={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb74c42){_0x1c0dab[_0x5b2b('0xa')]=_0xb74c42;}return db['AnalyticExtractedReport'][_0x5b2b('0xb')](_0x1c0dab,_0x322f14);}function main(){var _0x2a823b=0x1388;var _0x4e56f4;logger['info'](util[_0x5b2b('0xc')](_0x5b2b('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x5b2b('0xe')][_0x5b2b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5b2b('0x10'),_0x5b2b('0x11')]})['then'](function(_0x1cee5c){if(_0x1cee5c){_0x4e56f4=_0x1cee5c;_0x2a823b=_0x4e56f4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util[_0x5b2b('0xc')](_0x5b2b('0x14'),QUERY),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]});})['then'](function(_0x5afb45){if(!_0x5afb45[0x0]['num']){return analyticExtractedReport('Empty');}var _0x20a306=[];var _0x327390=0x0;if(_0x4e56f4['split']){if(_0x5afb45&&_0x5afb45[_0x5b2b('0x17')]){var _0x56d207=_[_0x5b2b('0x18')](_0x5afb45[0x0]['num']/_0x2a823b);var _0x344162=Number['isInteger'](_0x5afb45[0x0]['num']/_0x2a823b)?_0x5afb45[0x0][_0x5b2b('0x19')]%_0x2a823b:0x0;_0x56d207['forEach'](function(_0x1a4a0f){if(_0x1a4a0f>0x0){_0x327390+=_0x2a823b;}_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util[_0x5b2b('0xc')](_0x5b2b('0x1b'),QUERY,_0x2a823b,_0x327390),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));});if(_0x344162>0x0){_0x327390+=_0x2a823b;_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](util['format'](_0x5b2b('0x1b'),QUERY,_0x344162,_0x327390),{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));}}}else{_0x20a306[_0x5b2b('0x1a')](dbH[_0x5b2b('0x12')][_0x5b2b('0x13')](QUERY,{'type':dbH[_0x5b2b('0x12')][_0x5b2b('0x15')][_0x5b2b('0x16')]}));}var _0x327915=path[_0x5b2b('0x1c')](PATH);var _0x303681=path['basename'](PATH,_0x5b2b('0x1d'));var _0x239922=_0x4e56f4[_0x5b2b('0x10')]&&_0x20a306[_0x5b2b('0x17')]>0x1;var _0x50c186=[];if(!fs[_0x5b2b('0x1e')](path['join'](_0x327915,_0x303681))&&_0x239922){fs[_0x5b2b('0x1f')](path['join'](_0x327915,_0x303681));}return BPromise['each'](_0x20a306,function(_0x21524){_0x50c186[_0x5b2b('0x1a')](_0x21524);})[_0x5b2b('0x20')](function(){for(var _0x3996ba=0x0;_0x3996ba<_0x50c186['length'];_0x3996ba+=0x1){var _0x61a95c;var _0x3851ad=_0x50c186[_0x3996ba];if(_0x239922){_0x61a95c=path[_0x5b2b('0x21')](_0x327915,_0x303681,util[_0x5b2b('0xc')](_0x5b2b('0x22'),_0x303681,_0x3996ba,'csv'));}else{_0x61a95c=path['join'](_0x327915,util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x5b2b('0x24')));}fs[_0x5b2b('0x25')](_0x61a95c,csv(_0x3851ad));}})['then'](function(){if(_0x239922){return new Promise(function(_0x369836){zipdir(path[_0x5b2b('0x21')](_0x327915,_0x303681),{'saveTo':path[_0x5b2b('0x21')](_0x327915,util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x5b2b('0x26')))},function(_0x2d49a7,_0x1aeabc){rimraf(path[_0x5b2b('0x21')](_0x327915,_0x303681),function(){});_0x369836('zip\x20finished');});});}})[_0x5b2b('0x20')](function(){logger[_0x5b2b('0x27')](util[_0x5b2b('0xc')](_0x5b2b('0x28'),EXTRACTED_REPORT_ID,_0x5b2b('0x29')));return analyticExtractedReport(_0x5b2b('0x2a'),_0x239922?util[_0x5b2b('0xc')](_0x5b2b('0x23'),_0x303681,_0x239922?_0x5b2b('0x26'):_0x5b2b('0x24')):null);});})[_0x5b2b('0x2b')](function(_0x4410a8){logger[_0x5b2b('0x27')](util[_0x5b2b('0xc')](_0x5b2b('0x2c'),EXTRACTED_REPORT_ID,_0x5b2b('0x29')),util[_0x5b2b('0x2d')](_0x4410a8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5b2b('0x2e'));})[_0x5b2b('0x2f')](function(){process[_0x5b2b('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 4d318d4..7bdbeed 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 _0xf4ad=['%s.%s','all','zip','info','PDF','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','/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','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','html-to-pdfmake','rimraf','jsdom','window','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','pick','toString','value','fill','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','header','pageBreak','before','margin','landscape','\x20/\x20','black','num','Empty','Setting','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','length','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf4ad,0x172));var _0xdf4a=function(_0x59da33,_0x555969){_0x59da33=_0x59da33-0x0;var _0x1da20f=_0xf4ad[_0x59da33];return _0x1da20f;};'use strict';var _=require(_0xdf4a('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0xdf4a('0x1'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xdf4a('0x2'));var JSDOM=require(_0xdf4a('0x3'))['JSDOM'];var window=new JSDOM('')[_0xdf4a('0x4')];var BPromise=require('bluebird');var db=require(_0xdf4a('0x5'))['db'];var dbH=require(_0xdf4a('0x5'))[_0xdf4a('0x6')];var logger=require(_0xdf4a('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdf4a('0x8')][0x2]);var QUERY=process[_0xdf4a('0x8')][0x3];var PATH=process[_0xdf4a('0x8')][0x4];var NAME=process[_0xdf4a('0x8')][0x5];var FORMAT=_0xdf4a('0x9');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ec74e,_0x5d58e6){var _0x4307b1={'status':_0x5ec74e};var _0x9c2480={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5d58e6){_0x4307b1['savename']=_0x5d58e6;}return db[_0xdf4a('0xa')]['update'](_0x4307b1,_0x9c2480);}function getHeaders(_0x1b318f){return _['map'](_0x1b318f,function(_0x103d34){return{'text':_0x103d34,'style':'tableHeader'};});}function getRows(_0x50995d,_0x4d890b){return _[_0xdf4a('0xb')](_0x4d890b,function(_0x6af49d){return _(_0x6af49d)[_0xdf4a('0xc')](_0x50995d)[_0xdf4a('0xb')](function(_0x5ce8eb){return _0x5ce8eb?_[_0xdf4a('0xd')](_0x5ce8eb):'';})[_0xdf4a('0xe')]();});}function createTable(_0x342361,_0x54bca8){var _0x4f0bce={'widths':_[_0xdf4a('0xf')](Array(_0x342361['length']),0x91),'heights':function(_0x519ace){return _0x519ace===0x0?_0xdf4a('0x10'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x274d50=getHeaders(_0x342361);_0x4f0bce[_0xdf4a('0x11')][_0xdf4a('0x12')](_0x274d50);var _0x275ace=getRows(_0x342361,_0x54bca8);_0x4f0bce[_0xdf4a('0x11')]=_0x4f0bce['body'][_0xdf4a('0x13')](_0x275ace);return _0x4f0bce;}function createTables(_0x33b1e0){var _0x1c9d9f=[];var _0x220157=_[_0xdf4a('0x14')](Object[_0xdf4a('0x15')](_0x33b1e0[0x0]),0x5);_0x220157[_0xdf4a('0x16')](function(_0x195167){_0x1c9d9f['push'](createTable(_0x195167,_0x33b1e0));});return _0x1c9d9f;}function getPDFDocDefinition(_0x842015){var _0x32a33c=util[_0xdf4a('0x17')](_0xdf4a('0x18'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0xdf4a('0x17')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xdf4a('0x17')](FORMAT));var _0x407784=[];for(var _0x14935a=0x0;_0x14935a<_0x842015['length'];_0x14935a++){var _0x5b76c7=[];if(_0x14935a===0x0){_0x5b76c7[_0xdf4a('0x12')]({'text':_0x32a33c,'style':_0xdf4a('0x19')});}var _0x16719e={'table':_0x842015[_0x14935a]};if(_0x14935a>0x0){_0x16719e[_0xdf4a('0x1a')]=_0xdf4a('0x1b');_0x16719e[_0xdf4a('0x1c')]=[0x0,0x46,0x0,0x0];}_0x5b76c7[_0xdf4a('0x12')](_0x16719e);_0x407784[_0xdf4a('0x12')](_0x5b76c7);}return{'pageSize':'A4','pageOrientation':_0xdf4a('0x1d'),'content':_0x407784,'footer':function(_0xfed4df,_0x48415c){return{'text':_0xfed4df[_0xdf4a('0xd')]()+_0xdf4a('0x1e')+_0x48415c,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xdf4a('0x1f')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11a2f1){var _0x455df0=0x1388;var _0x4e22b4;if(!_0x11a2f1[0x0][_0xdf4a('0x20')]){return analyticExtractedReport(_0xdf4a('0x21'));}return db[_0xdf4a('0x22')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x3b3fe6){if(_0x3b3fe6){_0x4e22b4=_0x3b3fe6;_0x455df0=_0x4e22b4[_0xdf4a('0x23')]||0x3e8;}})[_0xdf4a('0x24')](function(){var _0x169dc0=[];var _0x225074=0x0;if(_0x4e22b4[_0xdf4a('0x25')]){if(_0x11a2f1&&_0x11a2f1['length']){var _0x32b808=_[_0xdf4a('0x26')](_0x11a2f1[0x0][_0xdf4a('0x20')]/_0x455df0);var _0x28edc6=Number[_0xdf4a('0x27')](_0x11a2f1[0x0][_0xdf4a('0x20')]/_0x455df0)?_0x11a2f1[0x0][_0xdf4a('0x20')]%_0x455df0:0x0;_0x32b808[_0xdf4a('0x16')](function(_0x4bc1e2){if(_0x4bc1e2>0x0){_0x225074+=_0x455df0;}_0x169dc0[_0xdf4a('0x12')](dbH[_0xdf4a('0x28')][_0xdf4a('0x29')](util['format'](_0xdf4a('0x2a'),QUERY,_0x455df0,_0x225074),{'type':dbH[_0xdf4a('0x28')][_0xdf4a('0x2b')][_0xdf4a('0x2c')]}));});if(_0x28edc6>0x0){_0x225074+=_0x455df0;_0x169dc0['push'](dbH['sequelize'][_0xdf4a('0x29')](util[_0xdf4a('0x17')](_0xdf4a('0x2a'),QUERY,_0x28edc6,_0x225074),{'type':dbH[_0xdf4a('0x28')][_0xdf4a('0x2b')][_0xdf4a('0x2c')]}));}}}else{_0x169dc0[_0xdf4a('0x12')](dbH['sequelize'][_0xdf4a('0x29')](QUERY,{'type':dbH[_0xdf4a('0x28')][_0xdf4a('0x2b')]['SELECT']}));}var _0x368b13=path[_0xdf4a('0x2d')](PATH);var _0x51ed0d=path['basename'](PATH,_0xdf4a('0x2e'));var _0x562c0b=_0x4e22b4[_0xdf4a('0x25')]&&_0x169dc0[_0xdf4a('0x2f')]>0x1;var _0x3acb09=[];if(!fs[_0xdf4a('0x30')](path[_0xdf4a('0x31')](_0x368b13,_0x51ed0d))&&_0x562c0b){fs[_0xdf4a('0x32')](path['join'](_0x368b13,_0x51ed0d));}return BPromise['each'](_0x169dc0,function(_0x593809){_0x3acb09[_0xdf4a('0x12')](_0x593809);})[_0xdf4a('0x24')](function(){var _0x5b4749=[];for(var _0x3819e5=0x0;_0x3819e5<_0x3acb09[_0xdf4a('0x2f')];_0x3819e5+=0x1){var _0x2995d3=_0x3acb09[_0x3819e5];var _0x25c998=createTables(_[_0xdf4a('0x33')](_0x2995d3));var _0x4c0165;var _0x3363f3=getPDFDocDefinition(_0x25c998);var _0x565ff7=getPDFPrinter();var _0x4428c6=_0x565ff7[_0xdf4a('0x34')](_0x3363f3);if(_0x562c0b){_0x4c0165=path['join'](_0x368b13,_0x51ed0d,util[_0xdf4a('0x17')](_0xdf4a('0x35'),_0x51ed0d,_0x3819e5,_0xdf4a('0x36')));}else{_0x4c0165=path['join'](_0x368b13,util[_0xdf4a('0x17')](_0xdf4a('0x37'),_0x51ed0d,'pdf'));}_0x5b4749['push'](writePDFDocument(_0x4428c6,_0x4c0165));}return Promise[_0xdf4a('0x38')](_0x5b4749);})[_0xdf4a('0x24')](function(){if(_0x562c0b){return new Promise(function(_0x17fad6){zipdir(path[_0xdf4a('0x31')](_0x368b13,_0x51ed0d),{'saveTo':path['join'](_0x368b13,util['format'](_0xdf4a('0x37'),_0x51ed0d,_0xdf4a('0x39')))},function(){rimraf(path[_0xdf4a('0x31')](_0x368b13,_0x51ed0d),function(){});_0x17fad6('zip\x20finished');});});}})[_0xdf4a('0x24')](function(){if(!_0x562c0b)return;rimraf(path['join'](_0x368b13,_0x51ed0d),function(){});})[_0xdf4a('0x24')](function(){logger[_0xdf4a('0x3a')](util[_0xdf4a('0x17')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdf4a('0x3b')));return analyticExtractedReport('Completed',_0x562c0b?util['format']('%s.%s',_0x51ed0d,_0x562c0b?_0xdf4a('0x39'):_0xdf4a('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xdf4a('0x3a')](util[_0xdf4a('0x17')](_0xdf4a('0x3c'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xdf4a('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xdf4a('0x24')](function(_0x3e2ddc){EXTRACTED_REPORT=_0x3e2ddc;return dbH[_0xdf4a('0x28')][_0xdf4a('0x29')](util[_0xdf4a('0x17')](_0xdf4a('0x3e'),QUERY),{'type':dbH[_0xdf4a('0x28')][_0xdf4a('0x2b')][_0xdf4a('0x2c')]});})[_0xdf4a('0x24')](extractReport)[_0xdf4a('0x3f')](function(_0x56eacd){logger['info'](util[_0xdf4a('0x17')](_0xdf4a('0x40'),EXTRACTED_REPORT_ID,_0xdf4a('0x3b')),util['inspect'](_0x56eacd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdf4a('0x41'));})[_0xdf4a('0x42')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1cf4f1=new PdfPrinter({'Arial':{'normal':__dirname+_0xdf4a('0x43'),'bold':__dirname+_0xdf4a('0x44'),'italics':__dirname+_0xdf4a('0x45'),'bolditalics':__dirname+_0xdf4a('0x46')}});return _0x1cf4f1;}function getPDFDocDefinitionFromHTML(_0x1976be,_0x59785a){var _0x1e5513=util[_0xdf4a('0x17')](_0xdf4a('0x47'),_0x59785a['channel'],_0x59785a[_0xdf4a('0x48')]);var _0x159f7e=moment()[_0xdf4a('0x17')](_0xdf4a('0x49'))[_0xdf4a('0xd')]();var _0x4d0f29=htmlToPdfmake(_0x1976be,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4d0f29],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xdf4a('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xdf4a('0x4a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xdf4a('0x4b'),'style':'header'}];},'footer':function(_0x3e87da,_0x3e91a3){return[{'text':util[_0xdf4a('0x17')](_0xdf4a('0x4c'),_0x1e5513,_0x3e87da,_0x3e91a3,_0x159f7e),'style':_0xdf4a('0x4d')}];}};}function writePDFDocument(_0x5dd5ee,_0x21bd48){return new Promise(function(_0x428e80,_0x3fc6e7){var _0x4b119f=_0x5dd5ee[_0xdf4a('0x4e')](fs[_0xdf4a('0x4f')](_0x21bd48));_0x4b119f['on'](_0xdf4a('0x50'),function(){_0x428e80(_0xdf4a('0x50'));});_0x4b119f['on'](_0xdf4a('0x51'),function(_0x3dcd03){_0x3fc6e7(_0x3dcd03);});_0x5dd5ee[_0xdf4a('0x52')]();});}exports[_0xdf4a('0x53')]=function(_0x524f98,_0x174ac0){var _0x2d68cf=getPDFPrinter();var _0x14b3e2=getPDFDocDefinitionFromHTML(_0x524f98,_0x174ac0);var _0x101ce1=_0x2d68cf[_0xdf4a('0x34')](_0x14b3e2);return writePDFDocument(_0x101ce1,_0x174ac0[_0xdf4a('0x54')])[_0xdf4a('0x3f')](function(_0x14d974){throw _0x14d974;});}; \ No newline at end of file +var _0xae08=['chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','margin','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','.pdf','join','mkdirSync','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','info','findOne','PDF','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','path','catch','lodash','util','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','value','fill','length','auto','push','body'];(function(_0x48b5bc,_0xeaa079){var _0x1beb4d=function(_0x3999e6){while(--_0x3999e6){_0x48b5bc['push'](_0x48b5bc['shift']());}};_0x1beb4d(++_0xeaa079);}(_0xae08,0xdb));var _0x8ae0=function(_0x299b62,_0x1bea7c){_0x299b62=_0x299b62-0x0;var _0x198be9=_0xae08[_0x299b62];return _0x198be9;};'use strict';var _=require(_0x8ae0('0x0'));var fs=require('fs');var util=require(_0x8ae0('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x8ae0('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8ae0('0x3'));var rimraf=require(_0x8ae0('0x4'));var JSDOM=require(_0x8ae0('0x5'))[_0x8ae0('0x6')];var window=new JSDOM('')[_0x8ae0('0x7')];var BPromise=require(_0x8ae0('0x8'));var db=require(_0x8ae0('0x9'))['db'];var dbH=require(_0x8ae0('0x9'))[_0x8ae0('0xa')];var logger=require(_0x8ae0('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8ae0('0xc')][0x2]);var QUERY=process[_0x8ae0('0xc')][0x3];var PATH=process[_0x8ae0('0xc')][0x4];var NAME=process[_0x8ae0('0xc')][0x5];var FORMAT=_0x8ae0('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d4ad6,_0x3c5b0d){var _0xb5f548={'status':_0x5d4ad6};var _0x3b51f6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c5b0d){_0xb5f548[_0x8ae0('0xe')]=_0x3c5b0d;}return db[_0x8ae0('0xf')]['update'](_0xb5f548,_0x3b51f6);}function getHeaders(_0x23738e){return _[_0x8ae0('0x10')](_0x23738e,function(_0x3f750a){return{'text':_0x3f750a,'style':_0x8ae0('0x11')};});}function getRows(_0x408179,_0x4893d4){return _[_0x8ae0('0x10')](_0x4893d4,function(_0x29cd69){return _(_0x29cd69)['pick'](_0x408179)['map'](function(_0x3391e9){return _0x3391e9?_['toString'](_0x3391e9):'';})[_0x8ae0('0x12')]();});}function createTable(_0x3bc5c6,_0x4baf31){var _0x16bcf9={'widths':_[_0x8ae0('0x13')](Array(_0x3bc5c6[_0x8ae0('0x14')]),0x91),'heights':function(_0xd6b5cc){return _0xd6b5cc===0x0?_0x8ae0('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x47fd93=getHeaders(_0x3bc5c6);_0x16bcf9['body'][_0x8ae0('0x16')](_0x47fd93);var _0x5c5e17=getRows(_0x3bc5c6,_0x4baf31);_0x16bcf9[_0x8ae0('0x17')]=_0x16bcf9[_0x8ae0('0x17')]['concat'](_0x5c5e17);return _0x16bcf9;}function createTables(_0x1c44fd){var _0x104085=[];var _0x2bf64a=_[_0x8ae0('0x18')](Object[_0x8ae0('0x19')](_0x1c44fd[0x0]),0x5);_0x2bf64a[_0x8ae0('0x1a')](function(_0xe1eb7){_0x104085[_0x8ae0('0x16')](createTable(_0xe1eb7,_0x1c44fd));});return _0x104085;}function getPDFDocDefinition(_0x3e5668){var _0x198322=util[_0x8ae0('0x1b')](_0x8ae0('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x8ae0('0x1d')])[_0x8ae0('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x8ae0('0x1e')])[_0x8ae0('0x1b')](FORMAT));var _0x51f591=[];for(var _0x52213d=0x0;_0x52213d<_0x3e5668[_0x8ae0('0x14')];_0x52213d++){var _0x53659e=[];if(_0x52213d===0x0){_0x53659e[_0x8ae0('0x16')]({'text':_0x198322,'style':'header'});}var _0x2e1200={'table':_0x3e5668[_0x52213d]};if(_0x52213d>0x0){_0x2e1200['pageBreak']='before';_0x2e1200[_0x8ae0('0x1f')]=[0x0,0x46,0x0,0x0];}_0x53659e['push'](_0x2e1200);_0x51f591[_0x8ae0('0x16')](_0x53659e);}return{'pageSize':'A4','pageOrientation':_0x8ae0('0x20'),'content':_0x51f591,'footer':function(_0x1057ef,_0x509006){return{'text':_0x1057ef[_0x8ae0('0x21')]()+_0x8ae0('0x22')+_0x509006,'style':_0x8ae0('0x23')};},'defaultStyle':{'font':_0x8ae0('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8ae0('0x25')},'footer':{'alignment':_0x8ae0('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5d189e){var _0x2f3def=0x1388;var _0x61dcae;if(!_0x5d189e[0x0][_0x8ae0('0x27')]){return analyticExtractedReport(_0x8ae0('0x28'));}return db[_0x8ae0('0x29')][_0x8ae0('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8ae0('0x2b'),_0x8ae0('0x2c')]})[_0x8ae0('0x2d')](function(_0x2d0b62){if(_0x2d0b62){_0x61dcae=_0x2d0b62;_0x2f3def=_0x61dcae[_0x8ae0('0x2c')]||0x3e8;}})[_0x8ae0('0x2d')](function(){var _0x2f827e=[];var _0xd8262a=0x0;if(_0x61dcae[_0x8ae0('0x2b')]){if(_0x5d189e&&_0x5d189e['length']){var _0x4346b3=_['range'](_0x5d189e[0x0][_0x8ae0('0x27')]/_0x2f3def);var _0x29cc5f=Number['isInteger'](_0x5d189e[0x0][_0x8ae0('0x27')]/_0x2f3def)?_0x5d189e[0x0][_0x8ae0('0x27')]%_0x2f3def:0x0;_0x4346b3[_0x8ae0('0x1a')](function(_0x2bb3e1){if(_0x2bb3e1>0x0){_0xd8262a+=_0x2f3def;}_0x2f827e['push'](dbH[_0x8ae0('0x2e')]['query'](util['format'](_0x8ae0('0x2f'),QUERY,_0x2f3def,_0xd8262a),{'type':dbH[_0x8ae0('0x2e')][_0x8ae0('0x30')][_0x8ae0('0x31')]}));});if(_0x29cc5f>0x0){_0xd8262a+=_0x2f3def;_0x2f827e[_0x8ae0('0x16')](dbH[_0x8ae0('0x2e')][_0x8ae0('0x32')](util[_0x8ae0('0x1b')](_0x8ae0('0x2f'),QUERY,_0x29cc5f,_0xd8262a),{'type':dbH[_0x8ae0('0x2e')][_0x8ae0('0x30')]['SELECT']}));}}}else{_0x2f827e['push'](dbH[_0x8ae0('0x2e')]['query'](QUERY,{'type':dbH['sequelize'][_0x8ae0('0x30')]['SELECT']}));}var _0xad2107=path['dirname'](PATH);var _0x4adc6b=path['basename'](PATH,_0x8ae0('0x33'));var _0x2e2b17=_0x61dcae[_0x8ae0('0x2b')]&&_0x2f827e['length']>0x1;var _0x5e19e4=[];if(!fs['existsSync'](path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b))&&_0x2e2b17){fs[_0x8ae0('0x35')](path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b));}return BPromise['each'](_0x2f827e,function(_0x109157){_0x5e19e4['push'](_0x109157);})['then'](function(){var _0x45c5a8=[];for(var _0x229b4d=0x0;_0x229b4d<_0x5e19e4[_0x8ae0('0x14')];_0x229b4d+=0x1){var _0x117780=_0x5e19e4[_0x229b4d];var _0x444d88=createTables(_[_0x8ae0('0x36')](_0x117780));var _0x403518;var _0x1ea91f=getPDFDocDefinition(_0x444d88);var _0x3d901d=getPDFPrinter();var _0x5c7f60=_0x3d901d[_0x8ae0('0x37')](_0x1ea91f);if(_0x2e2b17){_0x403518=path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b,util[_0x8ae0('0x1b')]('%s%d.%s',_0x4adc6b,_0x229b4d,_0x8ae0('0x38')));}else{_0x403518=path[_0x8ae0('0x34')](_0xad2107,util['format'](_0x8ae0('0x39'),_0x4adc6b,_0x8ae0('0x38')));}_0x45c5a8[_0x8ae0('0x16')](writePDFDocument(_0x5c7f60,_0x403518));}return Promise[_0x8ae0('0x3a')](_0x45c5a8);})[_0x8ae0('0x2d')](function(){if(_0x2e2b17){return new Promise(function(_0x7db760){zipdir(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),{'saveTo':path[_0x8ae0('0x34')](_0xad2107,util[_0x8ae0('0x1b')]('%s.%s',_0x4adc6b,_0x8ae0('0x3b')))},function(){rimraf(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),function(){});_0x7db760('zip\x20finished');});});}})[_0x8ae0('0x2d')](function(){if(!_0x2e2b17)return;rimraf(path[_0x8ae0('0x34')](_0xad2107,_0x4adc6b),function(){});})[_0x8ae0('0x2d')](function(){logger[_0x8ae0('0x3c')](util[_0x8ae0('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x2e2b17?util[_0x8ae0('0x1b')](_0x8ae0('0x39'),_0x4adc6b,_0x2e2b17?_0x8ae0('0x3b'):_0x8ae0('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x8ae0('0x1b')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0x8ae0('0xf')][_0x8ae0('0x3d')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8ae0('0x2d')](function(_0x54f749){EXTRACTED_REPORT=_0x54f749;return dbH[_0x8ae0('0x2e')][_0x8ae0('0x32')](util[_0x8ae0('0x1b')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x8ae0('0x2e')]['QueryTypes'][_0x8ae0('0x31')]});})[_0x8ae0('0x2d')](extractReport)['catch'](function(_0x422262){logger['info'](util[_0x8ae0('0x1b')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8ae0('0x3e')),util['inspect'](_0x422262,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8ae0('0x3f'));})[_0x8ae0('0x40')](function(){process[_0x8ae0('0x41')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x18b466=new PdfPrinter({'Arial':{'normal':__dirname+_0x8ae0('0x42'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x8ae0('0x43'),'bolditalics':__dirname+_0x8ae0('0x44')}});return _0x18b466;}function getPDFDocDefinitionFromHTML(_0x1f2cc0,_0x4b4cc5){var _0x4d05c6=util['format'](_0x8ae0('0x45'),_0x4b4cc5[_0x8ae0('0x46')],_0x4b4cc5['interactionId']);var _0x2d4dcd=moment()[_0x8ae0('0x1b')]('YYYY-MM-DD')[_0x8ae0('0x21')]();var _0x383f08=htmlToPdfmake(_0x1f2cc0,{'window':window,'tableAutoSize':!![]});return{'content':[_0x383f08],'defaultStyle':{'font':_0x8ae0('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8ae0('0x47'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x8ae0('0x48'),'style':_0x8ae0('0x49')}];},'footer':function(_0x48c54f,_0x15adb4){return[{'text':util[_0x8ae0('0x1b')](_0x8ae0('0x4a'),_0x4d05c6,_0x48c54f,_0x15adb4,_0x2d4dcd),'style':_0x8ae0('0x23')}];}};}function writePDFDocument(_0x4e1b62,_0x1c7b5c){return new Promise(function(_0x3eade3,_0x3fa24f){var _0x517ebc=_0x4e1b62[_0x8ae0('0x4b')](fs[_0x8ae0('0x4c')](_0x1c7b5c));_0x517ebc['on'](_0x8ae0('0x4d'),function(){_0x3eade3(_0x8ae0('0x4d'));});_0x517ebc['on']('error',function(_0x338d02){_0x3fa24f(_0x338d02);});_0x4e1b62[_0x8ae0('0x4e')]();});}exports['createPdfFromHTML']=function(_0x2daabc,_0xe513ad){var _0x1bda3d=getPDFPrinter();var _0x1387c9=getPDFDocDefinitionFromHTML(_0x2daabc,_0xe513ad);var _0x54950d=_0x1bda3d['createPdfKitDocument'](_0x1387c9);return writePDFDocument(_0x54950d,_0xe513ad[_0x8ae0('0x4f')])[_0x8ae0('0x50')](function(_0x5c6961){throw _0x5c6961;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c0af626..f635427 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 _0x7d25=['../../mysqldb','argv','savename','update','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','Empty','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','binary','zip','zip\x20finished','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x7d25,0x8a));var _0x57d2=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x7d25[_0x35885a];return _0xe86249;};'use strict';var util=require('util');var path=require(_0x57d2('0x0'));var _=require(_0x57d2('0x1'));var fs=require('fs');var json2xls=require(_0x57d2('0x2'));var BPromise=require(_0x57d2('0x3'));var zipdir=require(_0x57d2('0x4'));var rimraf=require(_0x57d2('0x5'));var db=require(_0x57d2('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x57d2('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x57d2('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x263d35,_0x147194){var _0x59ae87={'status':_0x263d35};var _0x49e3e5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x147194){_0x59ae87[_0x57d2('0x8')]=_0x147194;}return db['AnalyticExtractedReport'][_0x57d2('0x9')](_0x59ae87,_0x49e3e5);}function main(){var _0x5153c2=0x1388;var _0xa04872;logger['info'](util[_0x57d2('0xa')](_0x57d2('0xb'),EXTRACTED_REPORT_ID,_0x57d2('0xc')));return db[_0x57d2('0xd')][_0x57d2('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x57d2('0xf'),_0x57d2('0x10')]})[_0x57d2('0x11')](function(_0x43d7fb){if(_0x43d7fb){_0xa04872=_0x43d7fb;_0x5153c2=_0xa04872[_0x57d2('0x10')]||0x1388;}})[_0x57d2('0x11')](function(){return dbH[_0x57d2('0x12')][_0x57d2('0x13')](util[_0x57d2('0xa')](_0x57d2('0x14'),QUERY),{'type':dbH[_0x57d2('0x12')]['QueryTypes']['SELECT']});})[_0x57d2('0x11')](function(_0x148ef3){if(!_0x148ef3[0x0]['num']){return analyticExtractedReport(_0x57d2('0x15'));}var _0x319489=[];var _0x4bb8f7=0x0;if(_0xa04872[_0x57d2('0xf')]){if(_0x148ef3&&_0x148ef3['length']){var _0x1f6e45=_['range'](_0x148ef3[0x0][_0x57d2('0x16')]/_0x5153c2);var _0x7d4cf1=Number[_0x57d2('0x17')](_0x148ef3[0x0]['num']/_0x5153c2)?_0x148ef3[0x0]['num']%_0x5153c2:0x0;_0x1f6e45[_0x57d2('0x18')](function(_0x2a41b0){if(_0x2a41b0>0x0){_0x4bb8f7+=_0x5153c2;}_0x319489[_0x57d2('0x19')](dbH[_0x57d2('0x12')]['query'](util[_0x57d2('0xa')](_0x57d2('0x1a'),QUERY,_0x5153c2,_0x4bb8f7),{'type':dbH['sequelize']['QueryTypes'][_0x57d2('0x1b')]}));});if(_0x7d4cf1>0x0){_0x4bb8f7+=_0x5153c2;_0x319489[_0x57d2('0x19')](dbH[_0x57d2('0x12')][_0x57d2('0x13')](util[_0x57d2('0xa')](_0x57d2('0x1a'),QUERY,_0x7d4cf1,_0x4bb8f7),{'type':dbH[_0x57d2('0x12')][_0x57d2('0x1c')][_0x57d2('0x1b')]}));}}}else{_0x319489[_0x57d2('0x19')](dbH[_0x57d2('0x12')][_0x57d2('0x13')](QUERY,{'type':dbH[_0x57d2('0x12')][_0x57d2('0x1c')]['SELECT']}));}var _0x424ddc=path[_0x57d2('0x1d')](PATH);var _0x3c7de8=path[_0x57d2('0x1e')](PATH,_0x57d2('0x1f'));var _0x5058be=_0xa04872[_0x57d2('0xf')]&&_0x319489[_0x57d2('0x20')]>0x1;var _0x995928=[];if(!fs[_0x57d2('0x21')](path[_0x57d2('0x22')](_0x424ddc,_0x3c7de8))&&_0x5058be){fs[_0x57d2('0x23')](path[_0x57d2('0x22')](_0x424ddc,_0x3c7de8));}return BPromise['each'](_0x319489,function(_0x1ae5ff){_0x995928[_0x57d2('0x19')](_0x1ae5ff);})[_0x57d2('0x11')](function(){for(var _0x1fe383=0x0;_0x1fe383<_0x995928[_0x57d2('0x20')];_0x1fe383+=0x1){var _0x7c33f3;var _0x1dd6cb=_0x995928[_0x1fe383];if(_0x5058be){_0x7c33f3=path[_0x57d2('0x22')](_0x424ddc,_0x3c7de8,util[_0x57d2('0xa')](_0x57d2('0x24'),_0x3c7de8,_0x1fe383,'xlsx'));}else{_0x7c33f3=path[_0x57d2('0x22')](_0x424ddc,util[_0x57d2('0xa')](_0x57d2('0x25'),_0x3c7de8,_0x57d2('0x26')));}fs['writeFileSync'](_0x7c33f3,json2xls(_0x1dd6cb),_0x57d2('0x27'));}})[_0x57d2('0x11')](function(){if(_0x5058be){return new Promise(function(_0x21152e){zipdir(path[_0x57d2('0x22')](_0x424ddc,_0x3c7de8),{'saveTo':path[_0x57d2('0x22')](_0x424ddc,util[_0x57d2('0xa')](_0x57d2('0x25'),_0x3c7de8,_0x57d2('0x28')))},function(_0x319fcf,_0x581cf7){rimraf(path[_0x57d2('0x22')](_0x424ddc,_0x3c7de8),function(){});_0x21152e(_0x57d2('0x29'));});});}})['then'](function(){logger[_0x57d2('0x2a')](util[_0x57d2('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x57d2('0xc')));return analyticExtractedReport(_0x57d2('0x2b'),_0x5058be?util[_0x57d2('0xa')](_0x57d2('0x25'),_0x3c7de8,_0x5058be?_0x57d2('0x28'):'xlsx'):null);});})['catch'](function(_0x581ebc){logger['info'](util[_0x57d2('0xa')](_0x57d2('0x2c'),EXTRACTED_REPORT_ID,_0x57d2('0xc')),util[_0x57d2('0x2d')](_0x581ebc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x57d2('0x2e'));})['finally'](function(){process[_0x57d2('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7d31=['Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','Empty','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d31,0x1e4));var _0x17d3=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0x7d31[_0x21c2c8];return _0x4dd745;};'use strict';var util=require(_0x17d3('0x0'));var path=require('path');var _=require(_0x17d3('0x1'));var fs=require('fs');var json2xls=require(_0x17d3('0x2'));var BPromise=require(_0x17d3('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x17d3('0x4'));var db=require(_0x17d3('0x5'))['db'];var dbH=require(_0x17d3('0x5'))[_0x17d3('0x6')];var logger=require(_0x17d3('0x7'))(_0x17d3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x17d3('0x9')][0x2]);var QUERY=process[_0x17d3('0x9')][0x3];var PATH=process[_0x17d3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7e7376,_0x59589f){var _0x3d7936={'status':_0x7e7376};var _0x359c2e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59589f){_0x3d7936['savename']=_0x59589f;}return db[_0x17d3('0xa')][_0x17d3('0xb')](_0x3d7936,_0x359c2e);}function main(){var _0x2ec0bc=0x1388;var _0x557a6c;logger['info'](util[_0x17d3('0xc')](_0x17d3('0xd'),EXTRACTED_REPORT_ID,_0x17d3('0xe')));return db[_0x17d3('0xf')][_0x17d3('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x17d3('0x11'),_0x17d3('0x12')]})[_0x17d3('0x13')](function(_0x186824){if(_0x186824){_0x557a6c=_0x186824;_0x2ec0bc=_0x557a6c[_0x17d3('0x12')]||0x1388;}})[_0x17d3('0x13')](function(){return dbH[_0x17d3('0x14')][_0x17d3('0x15')](util[_0x17d3('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x17d3('0x14')]['QueryTypes']['SELECT']});})['then'](function(_0x32a77a){if(!_0x32a77a[0x0]['num']){return analyticExtractedReport(_0x17d3('0x16'));}var _0x2693c7=[];var _0x4ae72b=0x0;if(_0x557a6c['split']){if(_0x32a77a&&_0x32a77a['length']){var _0x215e5e=_[_0x17d3('0x17')](_0x32a77a[0x0][_0x17d3('0x18')]/_0x2ec0bc);var _0x430e3e=Number[_0x17d3('0x19')](_0x32a77a[0x0][_0x17d3('0x18')]/_0x2ec0bc)?_0x32a77a[0x0][_0x17d3('0x18')]%_0x2ec0bc:0x0;_0x215e5e[_0x17d3('0x1a')](function(_0x24f0f2){if(_0x24f0f2>0x0){_0x4ae72b+=_0x2ec0bc;}_0x2693c7[_0x17d3('0x1b')](dbH['sequelize'][_0x17d3('0x15')](util['format'](_0x17d3('0x1c'),QUERY,_0x2ec0bc,_0x4ae72b),{'type':dbH['sequelize']['QueryTypes'][_0x17d3('0x1d')]}));});if(_0x430e3e>0x0){_0x4ae72b+=_0x2ec0bc;_0x2693c7['push'](dbH[_0x17d3('0x14')][_0x17d3('0x15')](util[_0x17d3('0xc')](_0x17d3('0x1c'),QUERY,_0x430e3e,_0x4ae72b),{'type':dbH[_0x17d3('0x14')][_0x17d3('0x1e')]['SELECT']}));}}}else{_0x2693c7[_0x17d3('0x1b')](dbH[_0x17d3('0x14')][_0x17d3('0x15')](QUERY,{'type':dbH['sequelize'][_0x17d3('0x1e')][_0x17d3('0x1d')]}));}var _0x79887=path[_0x17d3('0x1f')](PATH);var _0x2ac50b=path[_0x17d3('0x20')](PATH,_0x17d3('0x21'));var _0x3e804b=_0x557a6c[_0x17d3('0x11')]&&_0x2693c7[_0x17d3('0x22')]>0x1;var _0x3c95d7=[];if(!fs[_0x17d3('0x23')](path[_0x17d3('0x24')](_0x79887,_0x2ac50b))&&_0x3e804b){fs[_0x17d3('0x25')](path[_0x17d3('0x24')](_0x79887,_0x2ac50b));}return BPromise['each'](_0x2693c7,function(_0x518950){_0x3c95d7[_0x17d3('0x1b')](_0x518950);})[_0x17d3('0x13')](function(){for(var _0xe95d36=0x0;_0xe95d36<_0x3c95d7['length'];_0xe95d36+=0x1){var _0x418535;var _0x204ed0=_0x3c95d7[_0xe95d36];if(_0x3e804b){_0x418535=path[_0x17d3('0x24')](_0x79887,_0x2ac50b,util[_0x17d3('0xc')](_0x17d3('0x26'),_0x2ac50b,_0xe95d36,_0x17d3('0x27')));}else{_0x418535=path[_0x17d3('0x24')](_0x79887,util[_0x17d3('0xc')](_0x17d3('0x28'),_0x2ac50b,_0x17d3('0x27')));}fs[_0x17d3('0x29')](_0x418535,json2xls(_0x204ed0),_0x17d3('0x2a'));}})[_0x17d3('0x13')](function(){if(_0x3e804b){return new Promise(function(_0x437d97){zipdir(path['join'](_0x79887,_0x2ac50b),{'saveTo':path[_0x17d3('0x24')](_0x79887,util[_0x17d3('0xc')]('%s.%s',_0x2ac50b,_0x17d3('0x2b')))},function(_0x41b649,_0x3c79fd){rimraf(path[_0x17d3('0x24')](_0x79887,_0x2ac50b),function(){});_0x437d97(_0x17d3('0x2c'));});});}})[_0x17d3('0x13')](function(){logger['info'](util[_0x17d3('0xc')](_0x17d3('0x2d'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x17d3('0x2e'),_0x3e804b?util[_0x17d3('0xc')](_0x17d3('0x28'),_0x2ac50b,_0x3e804b?'zip':_0x17d3('0x27')):null);});})['catch'](function(_0x38401e){logger[_0x17d3('0x2f')](util[_0x17d3('0xc')](_0x17d3('0x30'),EXTRACTED_REPORT_ID,_0x17d3('0xe')),util[_0x17d3('0x31')](_0x38401e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x17d3('0x32'));})[_0x17d3('0x33')](function(){process[_0x17d3('0x34')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0aa883b..0e87420 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 _0x5617=['appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','destroy','bulkCreate','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','map','then','filter','groupBy','exten','playback','hasOwnProperty','priority','extension','type','CDR(type)=%s','context','inbound','extensions','Set','CDR(routeid)=','VoiceExtensionId','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app'];(function(_0x1cec22,_0x34766e){var _0x547137=function(_0x3bcf6b){while(--_0x3bcf6b){_0x1cec22['push'](_0x1cec22['shift']());}};_0x547137(++_0x34766e);}(_0x5617,0x194));var _0x7561=function(_0x48401f,_0x2457e2){_0x48401f=_0x48401f-0x0;var _0x5dc63f=_0x5617[_0x48401f];return _0x5dc63f;};'use strict';var _=require(_0x7561('0x0'));var util=require(_0x7561('0x1'));function rewrite(_0x1c03f3,_0x3cd253){var _0x444f39=this;return _0x1c03f3[_0x7561('0x2')][_0x7561('0x3')][_0x7561('0x4')]({'raw':!![]})['then'](function(_0x49f7cd){_0x444f39[_0x7561('0x5')]=_0x49f7cd;return _0x1c03f3[_0x7561('0x2')][_0x7561('0x6')][_0x7561('0x4')]({'where':{'IntervalId':_0x3cd253[_0x7561('0x7')]},'raw':!![]});})['then'](function(_0x2f2bac){return _0x1c03f3['models']['VoiceExtension'][_0x7561('0x4')]({'where':{'exten':{'$in':_[_0x7561('0x8')](_[_0x7561('0x9')](_0x2f2bac,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x7561('0xa')](function(_0x5f3c86){var _0x567f26=_[_0x7561('0xb')](_0x5f3c86,{'priority':'1'});var _0x31ea04=_[_0x7561('0xb')](_0x5f3c86,{'isApp':0x1});var _0x5c803a=_[_0x7561('0xc')](_0x31ea04,_0x7561('0xd'));var _0x3507cb=['queue',_0x7561('0xe')];var _0x23a8e0=[];var _0xe446b7=[];for(var _0x4886bf in _0x5c803a){if(_0x5c803a[_0x7561('0xf')](_0x4886bf)){_0x444f39[_0x7561('0x10')]=0x2;_0x444f39['extensions']=[];_0x444f39[_0x7561('0x11')]=_['find'](_0x567f26,{'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')]});_0x444f39['extensions']['push']({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':'Set','appdata':util['format'](_0x7561('0x13'),_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')]),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39['priority']++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId']});if(_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')]===_0x7561('0x15')){_0x444f39[_0x7561('0x16')]['push']({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x18')+_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')],'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});}else if(_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')]===_0x7561('0x1a')){if(_0x444f39[_0x7561('0x11')]){_0x444f39[_0x7561('0x16')][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x1c')+(_0x444f39[_0x7561('0x11')][_0x7561('0x1d')]?_0x7561('0x1e')+_0x444f39[_0x7561('0x11')][_0x7561('0x1d')]+'}':_0x7561('0x1f')),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});}_0x444f39[_0x7561('0x16')][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':'Set','appdata':_0x7561('0x18')+_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')],'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId']});var _0x9c108a=_0x444f39[_0x7561('0x10')]++;_0x444f39[_0x7561('0x16')][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':'ExecIf','appdata':_0x7561('0x20')+(_0x9c108a+0x2)+_0x7561('0x21')+(_0x9c108a+0x1)+')','context':_0x5c803a[_0x4886bf][0x0]['context'],'exten':_0x5c803a[_0x4886bf][0x0]['exten'],'priority':_0x9c108a,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId']});if(_0x444f39[_0x7561('0x11')]){_0x444f39['extensions']['push']({'type':_0x5c803a[_0x4886bf][0x0]['type'],'app':'Set','appdata':_0x444f39[_0x7561('0x11')][_0x7561('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x444f39[_0x7561('0x11')][_0x7561('0x1d')]+'}':_0x7561('0x22'),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});}_0x444f39[_0x7561('0x16')][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':'outboundrouteid='+_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId'],'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});if(_0x444f39['extension']&&_0x444f39[_0x7561('0x11')][_0x7561('0xf')](_0x7561('0x23'))&&_0x444f39[_0x7561('0x11')][_0x7561('0x23')]!=='none'){_0x444f39['extensions'][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x24'),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId']});_0x444f39['extensions'][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0]['type'],'app':_0x7561('0x17'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x444f39[_0x7561('0x11')][_0x7561('0x23')]||_0x7561('0x25'),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});}}_0x444f39[_0x7561('0x16')]['push']({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5c803a[_0x4886bf][0x0]['context'],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});_0x444f39[_0x7561('0x16')]['push']({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x26'),'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39[_0x7561('0x10')]++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0]['VoiceExtensionId']});_0x444f39['extensions'][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5c803a[_0x4886bf][0x0]['context'],'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'priority':_0x444f39['priority']++,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});for(var _0x1b475a=0x0,_0x42bef1=0x0;_0x1b475a<_0x5c803a[_0x4886bf]['length'];_0x1b475a+=0x1,_0x42bef1=0x0){var _0x25064b=_0x5c803a[_0x4886bf][_0x1b475a];if(_0x25064b[_0x7561('0x12')]){_0x25064b[_0x7561('0x12')]=_0x25064b[_0x7561('0x12')][_0x7561('0x27')]();}var _0x48d492=[];var _0x3ebecf=[];delete _0x25064b['id'];delete _0x25064b['createdAt'];delete _0x25064b[_0x7561('0x28')];var _0x2179b0=_0x25064b[_0x7561('0x29')]!==_0x7561('0x2a')?[_0x25064b[_0x7561('0x29')]]:_0x25064b[_0x7561('0x7')]?_[_0x7561('0x9')](_[_0x7561('0xb')](_0x444f39[_0x7561('0x5')],{'IntervalId':_0x25064b[_0x7561('0x7')]}),_0x7561('0x29')):[];if(_0x25064b[_0x7561('0xf')](_0x7561('0x2b'))){if(_0x25064b['tag']&&_0x25064b[_0x7561('0x2b')]!=='--'){_0x48d492['push']({'type':_0x25064b[_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x2c')+_0x25064b[_0x7561('0x2b')],'context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b[_0x7561('0xd')],'priority':_0x2179b0[_0x7561('0x2d')]+_0x444f39[_0x7561('0x10')]+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});}}if(_0x25064b[_0x7561('0x12')]==='outbound'&&_0x25064b['hasOwnProperty'](_0x7561('0x2e'))){if(_0x25064b['callerID']){_0x48d492[_0x7561('0x1b')]({'type':_0x25064b[_0x7561('0x12')],'app':_0x7561('0x2f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x25064b[_0x7561('0x2e')]+')','context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b[_0x7561('0xd')],'priority':_0x2179b0[_0x7561('0x2d')]+_0x444f39[_0x7561('0x10')]+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});}else{_0x48d492['push']({'type':_0x25064b[_0x7561('0x12')],'app':'ExecIf','appdata':_0x7561('0x30'),'context':_0x25064b['context'],'exten':_0x25064b['exten'],'priority':_0x2179b0['length']+_0x444f39[_0x7561('0x10')]+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});}}if(_0x25064b['hasOwnProperty']('answer')){if(_0x3507cb[_0x7561('0x31')](_0x25064b[_0x7561('0x32')][_0x7561('0x27')]())>=0x0&&_0x25064b[_0x7561('0x33')]!==_0x7561('0x34')){if(_0x25064b[_0x7561('0x35')]){_0x48d492[_0x7561('0x1b')]({'type':_0x25064b['type'],'app':_0x7561('0x2f'),'appdata':_0x7561('0x36'),'context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b['exten'],'priority':_0x2179b0[_0x7561('0x2d')]+_0x444f39['priority']+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});_0x48d492['push']({'type':_0x25064b[_0x7561('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b[_0x7561('0xd')],'priority':_0x2179b0[_0x7561('0x2d')]+_0x444f39['priority']+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});}else{_0x48d492[_0x7561('0x1b')]({'type':_0x25064b[_0x7561('0x12')],'app':_0x7561('0x2f'),'appdata':_0x7561('0x37'),'context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b[_0x7561('0xd')],'priority':_0x2179b0['length']+_0x444f39[_0x7561('0x10')]+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});_0x48d492[_0x7561('0x1b')]({'type':_0x25064b[_0x7561('0x12')],'app':_0x7561('0x17'),'appdata':_0x7561('0x38'),'context':_0x25064b[_0x7561('0x14')],'exten':_0x25064b['exten'],'priority':_0x2179b0[_0x7561('0x2d')]+_0x444f39['priority']+_0x42bef1++,'VoiceExtensionId':_0x25064b[_0x7561('0x19')]});}}}for(var _0x37abd4=0x0;_0x37abd4<_0x2179b0[_0x7561('0x2d')];_0x37abd4+=0x1){var _0xb40945=_0x444f39[_0x7561('0x10')]+_0x2179b0['length'];var _0x32bf6b=_0x37abd4===_0x2179b0[_0x7561('0x2d')]-0x1?_0x444f39['priority']+_0x48d492[_0x7561('0x2d')]+_0x3ebecf[_0x7561('0x2d')]+0x2:_0x444f39[_0x7561('0x10')]+_0x37abd4+0x1;_0x48d492[_0x7561('0x39')](_0x37abd4,0x0,{'type':_0x25064b['type'],'app':'GotoIfTime','appdata':_0x2179b0[_0x37abd4]+'?'+_0x25064b['context']+_0x7561('0x3a')+_0xb40945+':'+_0x25064b[_0x7561('0x14')]+_0x7561('0x3a')+_0x32bf6b,'exten':_0x25064b[_0x7561('0xd')],'context':_0x25064b[_0x7561('0x14')],'priority':_0x444f39['priority']+_0x37abd4,'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});}_0x25064b[_0x7561('0x10')]=_0x48d492[_0x7561('0x2d')]?_[_0x7561('0x3b')](_0x48d492)[_0x7561('0x10')]+0x1:_0x444f39[_0x7561('0x10')];_0x444f39[_0x7561('0x10')]=(_0x3ebecf[_0x7561('0x2d')]?_['last'](_0x3ebecf)[_0x7561('0x10')]:_0x25064b[_0x7561('0x10')])+0x1;_0x444f39[_0x7561('0x16')]=_['concat'](_0x444f39[_0x7561('0x16')],_0x48d492,[_0x25064b],_0x3ebecf);}_0x444f39[_0x7561('0x16')][_0x7561('0x1b')]({'type':_0x5c803a[_0x4886bf][0x0][_0x7561('0x12')],'app':_0x7561('0x3c'),'exten':_0x5c803a[_0x4886bf][0x0][_0x7561('0xd')],'context':_0x5c803a[_0x4886bf][0x0][_0x7561('0x14')],'priority':_0x444f39[_0x7561('0x10')],'VoiceExtensionId':_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]});_0x23a8e0['push'](_0x5c803a[_0x4886bf][0x0][_0x7561('0x19')]);_0xe446b7=_['concat'](_0xe446b7,_0x444f39[_0x7561('0x16')]);}}return _0x1c03f3['transaction'](function(_0x2e5497){return _0x1c03f3[_0x7561('0x2')]['VoiceExtension'][_0x7561('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x23a8e0}},'transaction':_0x2e5497})[_0x7561('0xa')](function(_0x2328b8){return _0x1c03f3[_0x7561('0x2')][_0x7561('0x6')][_0x7561('0x3e')](_['sortBy'](_0xe446b7,_0x7561('0x10')),{'transaction':_0x2e5497});});});})['catch'](function(_0x42de15){console[_0x7561('0x3f')](_0x42de15);});}exports[_0x7561('0x40')]=rewrite; \ No newline at end of file +var _0x189f=['callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','last','Hangup','concat','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','hasOwnProperty','priority','find','extensions','push','Set','format','CDR(type)=%s','type','context','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)='];(function(_0x18ce8c,_0xecedd2){var _0x4d1946=function(_0x3bb64e){while(--_0x3bb64e){_0x18ce8c['push'](_0x18ce8c['shift']());}};_0x4d1946(++_0xecedd2);}(_0x189f,0xd8));var _0xf189=function(_0x5fb9da,_0x1ac0d0){_0x5fb9da=_0x5fb9da-0x0;var _0x528081=_0x189f[_0x5fb9da];return _0x528081;};'use strict';var _=require(_0xf189('0x0'));var util=require(_0xf189('0x1'));function rewrite(_0x10a0d3,_0xdb9097){var _0x375bcc=this;return _0x10a0d3[_0xf189('0x2')][_0xf189('0x3')][_0xf189('0x4')]({'raw':!![]})['then'](function(_0x53dcf0){_0x375bcc['intervals']=_0x53dcf0;return _0x10a0d3['models']['VoiceExtension'][_0xf189('0x4')]({'where':{'IntervalId':_0xdb9097[_0xf189('0x5')]},'raw':!![]});})['then'](function(_0x4f40f4){return _0x10a0d3[_0xf189('0x2')][_0xf189('0x6')][_0xf189('0x4')]({'where':{'exten':{'$in':_[_0xf189('0x7')](_[_0xf189('0x8')](_0x4f40f4,_0xf189('0x9')))}},'order':[{'raw':_0xf189('0xa')}],'raw':!![]});})[_0xf189('0xb')](function(_0x5e4cbc){var _0xed8679=_[_0xf189('0xc')](_0x5e4cbc,{'priority':'1'});var _0x3de60b=_['filter'](_0x5e4cbc,{'isApp':0x1});var _0x105d4d=_[_0xf189('0xd')](_0x3de60b,_0xf189('0x9'));var _0x4da8be=['queue','playback'];var _0x2030d5=[];var _0x5cd328=[];for(var _0x4231bf in _0x105d4d){if(_0x105d4d[_0xf189('0xe')](_0x4231bf)){_0x375bcc[_0xf189('0xf')]=0x2;_0x375bcc['extensions']=[];_0x375bcc['extension']=_[_0xf189('0x10')](_0xed8679,{'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':util[_0xf189('0x14')](_0xf189('0x15'),_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')]),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x105d4d[_0x4231bf][0x0]['type']==='inbound'){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x105d4d[_0x4231bf][0x0]['VoiceExtensionId'],'context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}else if(_0x105d4d[_0x4231bf][0x0]['type']===_0xf189('0x19')){if(_0x375bcc[_0xf189('0x1a')]){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':_0xf189('0x1b')+(_0x375bcc[_0xf189('0x1a')][_0xf189('0x1c')]?_0xf189('0x1d')+_0x375bcc['extension'][_0xf189('0x1c')]+'}':_0xf189('0x1e')),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x375bcc['extensions'][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':'Set','appdata':_0xf189('0x1f')+_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')],'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});var _0x2afce1=_0x375bcc[_0xf189('0xf')]++;_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2afce1+0x2)+'):Goto('+(_0x2afce1+0x1)+')','context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x2afce1,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x375bcc['extension']){_0x375bcc['extensions']['push']({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':_0x375bcc['extension'][_0xf189('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x375bcc[_0xf189('0x1a')][_0xf189('0x1c')]+'}':_0xf189('0x21'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x375bcc['extensions'][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':_0xf189('0x22')+_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')],'context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc['priority']++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});if(_0x375bcc[_0xf189('0x1a')]&&_0x375bcc[_0xf189('0x1a')][_0xf189('0xe')](_0xf189('0x23'))&&_0x375bcc[_0xf189('0x1a')]['recordingFormat']!==_0xf189('0x24')){_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':'Set','appdata':_0xf189('0x25')+_0x375bcc[_0xf189('0x1a')]['recordingFormat']||_0xf189('0x26'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}}_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x27'),'context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x105d4d[_0x4231bf][0x0][_0xf189('0x17')],'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x375bcc[_0xf189('0x11')]['push']({'type':_0x105d4d[_0x4231bf][0x0]['type'],'app':_0xf189('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x105d4d[_0x4231bf][0x0]['context'],'exten':_0x105d4d[_0x4231bf][0x0]['exten'],'priority':_0x375bcc[_0xf189('0xf')]++,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0]['VoiceExtensionId']});for(var _0x2ec564=0x0,_0x268f40=0x0;_0x2ec564<_0x105d4d[_0x4231bf][_0xf189('0x28')];_0x2ec564+=0x1,_0x268f40=0x0){var _0x207e2a=_0x105d4d[_0x4231bf][_0x2ec564];if(_0x207e2a[_0xf189('0x16')]){_0x207e2a[_0xf189('0x16')]=_0x207e2a['type'][_0xf189('0x29')]();}var _0x3a6b54=[];var _0x172104=[];delete _0x207e2a['id'];delete _0x207e2a[_0xf189('0x2a')];delete _0x207e2a[_0xf189('0x2b')];var _0x97a380=_0x207e2a[_0xf189('0x2c')]!=='*,*,*,*'?[_0x207e2a['interval']]:_0x207e2a['IntervalId']?_['map'](_[_0xf189('0xc')](_0x375bcc[_0xf189('0x2d')],{'IntervalId':_0x207e2a['IntervalId']}),_0xf189('0x2c')):[];if(_0x207e2a[_0xf189('0xe')]('tag')){if(_0x207e2a[_0xf189('0x2e')]&&_0x207e2a[_0xf189('0x2e')]!=='--'){_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x2f')+_0x207e2a['tag'],'context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc['priority']+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}if(_0x207e2a['type']===_0xf189('0x19')&&_0x207e2a[_0xf189('0xe')](_0xf189('0x30'))){if(_0x207e2a[_0xf189('0x30')]){_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':_0xf189('0x31')+_0x207e2a[_0xf189('0x30')]+')','context':_0x207e2a['context'],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}else{_0x3a6b54['push']({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}if(_0x207e2a[_0xf189('0xe')](_0xf189('0x32'))){if(_0x4da8be[_0xf189('0x33')](_0x207e2a[_0xf189('0x34')]['toLowerCase']())>=0x0&&_0x207e2a[_0xf189('0x35')]!==_0xf189('0x36')){if(_0x207e2a[_0xf189('0x32')]){_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a['type'],'app':_0xf189('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':_0xf189('0x37'),'context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a['exten'],'priority':_0x97a380['length']+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}else{_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x20'),'appdata':_0xf189('0x38'),'context':_0x207e2a['context'],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380[_0xf189('0x28')]+_0x375bcc[_0xf189('0xf')]+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});_0x3a6b54[_0xf189('0x12')]({'type':_0x207e2a[_0xf189('0x16')],'app':_0xf189('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x207e2a[_0xf189('0x17')],'exten':_0x207e2a[_0xf189('0x9')],'priority':_0x97a380['length']+_0x375bcc['priority']+_0x268f40++,'VoiceExtensionId':_0x207e2a[_0xf189('0x18')]});}}}for(var _0x1c1ae9=0x0;_0x1c1ae9<_0x97a380[_0xf189('0x28')];_0x1c1ae9+=0x1){var _0x1d44bb=_0x375bcc[_0xf189('0xf')]+_0x97a380[_0xf189('0x28')];var _0x131577=_0x1c1ae9===_0x97a380[_0xf189('0x28')]-0x1?_0x375bcc[_0xf189('0xf')]+_0x3a6b54['length']+_0x172104[_0xf189('0x28')]+0x2:_0x375bcc[_0xf189('0xf')]+_0x1c1ae9+0x1;_0x3a6b54[_0xf189('0x39')](_0x1c1ae9,0x0,{'type':_0x207e2a[_0xf189('0x16')],'app':'GotoIfTime','appdata':_0x97a380[_0x1c1ae9]+'?'+_0x207e2a[_0xf189('0x17')]+',${EXTEN},'+_0x1d44bb+':'+_0x207e2a[_0xf189('0x17')]+',${EXTEN},'+_0x131577,'exten':_0x207e2a[_0xf189('0x9')],'context':_0x207e2a[_0xf189('0x17')],'priority':_0x375bcc[_0xf189('0xf')]+_0x1c1ae9,'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});}_0x207e2a['priority']=_0x3a6b54['length']?_[_0xf189('0x3a')](_0x3a6b54)[_0xf189('0xf')]+0x1:_0x375bcc[_0xf189('0xf')];_0x375bcc[_0xf189('0xf')]=(_0x172104[_0xf189('0x28')]?_[_0xf189('0x3a')](_0x172104)[_0xf189('0xf')]:_0x207e2a[_0xf189('0xf')])+0x1;_0x375bcc[_0xf189('0x11')]=_['concat'](_0x375bcc['extensions'],_0x3a6b54,[_0x207e2a],_0x172104);}_0x375bcc[_0xf189('0x11')][_0xf189('0x12')]({'type':_0x105d4d[_0x4231bf][0x0][_0xf189('0x16')],'app':_0xf189('0x3b'),'exten':_0x105d4d[_0x4231bf][0x0][_0xf189('0x9')],'context':_0x105d4d[_0x4231bf][0x0]['context'],'priority':_0x375bcc[_0xf189('0xf')],'VoiceExtensionId':_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]});_0x2030d5[_0xf189('0x12')](_0x105d4d[_0x4231bf][0x0][_0xf189('0x18')]);_0x5cd328=_[_0xf189('0x3c')](_0x5cd328,_0x375bcc[_0xf189('0x11')]);}}return _0x10a0d3['transaction'](function(_0x4f1579){return _0x10a0d3['models']['VoiceExtension'][_0xf189('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x2030d5}},'transaction':_0x4f1579})[_0xf189('0xb')](function(_0x4cc7ba){return _0x10a0d3[_0xf189('0x2')][_0xf189('0x6')][_0xf189('0x3e')](_['sortBy'](_0x5cd328,_0xf189('0xf')),{'transaction':_0x4f1579});});});})[_0xf189('0x3f')](function(_0x343553){console[_0xf189('0x40')](_0x343553);});}exports[_0xf189('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 29fc0a2..2f18840 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 _0xf5f7=['squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','createdAt','cm_contacts','id\x20IN\x20?','str','VoiceQueue','findAll','dialCheckDuplicateType','Lists','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','outbound','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','contact:csv_','resume','resolve','emit','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash'];(function(_0xe4b9a8,_0x149fac){var _0x2c5904=function(_0x2c091a){while(--_0x2c091a){_0xe4b9a8['push'](_0xe4b9a8['shift']());}};_0x2c5904(++_0x149fac);}(_0xf5f7,0x6a));var _0x7f5f=function(_0x3e3725,_0x574046){_0x3e3725=_0x3e3725-0x0;var _0x57d8dd=_0xf5f7[_0x3e3725];return _0x57d8dd;};'use strict';var BPromise=require(_0x7f5f('0x0'));var util=require(_0x7f5f('0x1'));var _=require(_0x7f5f('0x2'));var fs=require('fs');var squel=require(_0x7f5f('0x3'));var Papa=require(_0x7f5f('0x4'));var Redis=require(_0x7f5f('0x5'));var db=require(_0x7f5f('0x6'))['db'];var config=require(_0x7f5f('0x7'));var logger=require(_0x7f5f('0x8'))('api');config[_0x7f5f('0x9')]=_[_0x7f5f('0xa')](config[_0x7f5f('0x9')],{'host':_0x7f5f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x7f5f('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x7f5f('0xd')][0x2]===_0x7f5f('0xe')||process[_0x7f5f('0xd')][0x2]===_0x7f5f('0xf')){throw new Error(_0x7f5f('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7f5f('0xd')][0x3]||process[_0x7f5f('0xd')][0x3]===_0x7f5f('0xe')||process[_0x7f5f('0xd')][0x3]===_0x7f5f('0xf')||!process[_0x7f5f('0xd')][0x4]||process[_0x7f5f('0xd')][0x4]==='undefined'||process['argv'][0x4]===_0x7f5f('0xf')){throw new Error(_0x7f5f('0x11'));}var FIELDS=_['zipObject'](process[_0x7f5f('0xd')][0x3][_0x7f5f('0x12')](','),process[_0x7f5f('0xd')][0x4]['split'](','));if(!process[_0x7f5f('0xd')][0x5]||process[_0x7f5f('0xd')][0x5]===_0x7f5f('0xe')||process[_0x7f5f('0xd')][0x5]===_0x7f5f('0xf')){throw new Error(_0x7f5f('0x13'));}var LISTID=process[_0x7f5f('0xd')][0x5];var COMPANYID=process[_0x7f5f('0xd')][0x6]&&process[_0x7f5f('0xd')][0x6]!=='undefined'&&process[_0x7f5f('0xd')][0x6]!==_0x7f5f('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x7f5f('0xd')][0x7]&&process['argv'][0x7]!==_0x7f5f('0xe')&&process[_0x7f5f('0xd')][0x7]!==_0x7f5f('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x7f5f('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x5756c7){logger[_0x7f5f('0x14')](_0x5756c7);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(_0x384072,_0x10bd6b,_0x117b4b,_0x1f9751){var _0x238c2b={'message':_0x10bd6b};_0x238c2b[_0x384072]=!![];if(_0x117b4b){_0x238c2b[_0x7f5f('0x15')]=_0x117b4b;}if(_0x1f9751){_0x238c2b[_0x7f5f('0x16')]=_0x1f9751;}return _0x238c2b;}function isEmail(_0x11c7ff){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))*$/[_0x7f5f('0x17')](_0x11c7ff);}function checkRow(_0xa1cee7,_0x5b4f16,_0x621ceb){return new BPromise(function(_0x32752d,_0x2d6f4e){if(_[_0x7f5f('0x18')](_0xa1cee7)){return _0x2d6f4e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x621ceb));}if(_0xa1cee7[_0x7f5f('0x19')]&&_0xa1cee7['errors'][_0x7f5f('0x1a')]){var _0x41b49b=_[_0x7f5f('0x1b')](_0xa1cee7[_0x7f5f('0x19')],_0x7f5f('0x1c'))[_0x7f5f('0x1d')](';');return _0x2d6f4e(handleCheckRowError('error',_0x41b49b,null,_0x621ceb));}var _0x33fec3={};for(var _0x109852 in FIELDS){if(FIELDS['hasOwnProperty'](_0x109852)&&FIELDS[_0x109852]){_0x33fec3[_0x109852]=_0xa1cee7['data'][0x0][FIELDS[_0x109852]]||_0xa1cee7[_0x7f5f('0x1e')][0x0]['\ufeff'+FIELDS[_0x109852]];}}if(!_0x33fec3[_0x7f5f('0x1f')]){return _0x2d6f4e(handleCheckRowError('error',_0x7f5f('0x20'),null,_0x621ceb));}if(!_0x33fec3[_0x7f5f('0x21')]){return _0x2d6f4e(handleCheckRowError(_0x7f5f('0x14'),'phone\x20not\x20specified!',null,_0x621ceb));}if(_0x33fec3[_0x7f5f('0x22')]){var _0x51735d=moment(_0x33fec3['birthDate'],_0x7f5f('0x23'));if(!_0x51735d[_0x7f5f('0x24')]()){return _0x2d6f4e(handleCheckRowError(_0x7f5f('0x14'),_0x7f5f('0x25'),null,_0x621ceb));}}if(_0x33fec3[_0x7f5f('0x26')]){if(!isEmail(_0x33fec3['email'])){return _0x2d6f4e(handleCheckRowError(_0x7f5f('0x14'),_0x7f5f('0x27'),null,_0x621ceb));}}_0x33fec3[_0x7f5f('0x28')]=LISTID;_0x33fec3[_0x7f5f('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5b4f16){var _0xe235e6={};for(var _0x29ac24=0x0,_0x36c357=DUPLICATES['length'];_0x29ac24<_0x36c357;_0x29ac24+=0x1){_0xe235e6[DUPLICATES[_0x29ac24]]=_0x33fec3[DUPLICATES[_0x29ac24]];}var _0x295f09=_[_0x7f5f('0x2a')](_0x5b4f16,_0xe235e6);if(_0x295f09){return _0x2d6f4e(handleCheckRowError(_0x7f5f('0x2b'),'Duplicate\x20Contact',_0x295f09,_0x621ceb));}}return db[_0x7f5f('0x2c')][_0x7f5f('0x2d')](_0x33fec3,{'raw':!![],'hooks':![],'fields':_[_0x7f5f('0x2e')](_0x33fec3)})[_0x7f5f('0x2f')](function(_0x1c5957){if(DUPLICATES&&DUPLICATES['length']&&_0x5b4f16){_0x5b4f16[_0x7f5f('0x30')](_['pick'](_0x33fec3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1c5957['id'];return _0x32752d();})[_0x7f5f('0x31')](function(_0x362aa7){return _0x2d6f4e(handleCheckRowError(_0x7f5f('0x14'),_0x7f5f('0x32')+(_0x362aa7[_0x7f5f('0x1c')]||JSON[_0x7f5f('0x33')](_0x362aa7)),null,_0x621ceb));});});}function checkHopper(){function _0x1d21c8(){return function(_0x386042){logger[_0x7f5f('0x14')](_0x7f5f('0x34'),_0x7f5f('0x35'),util[_0x7f5f('0x36')](_0x386042,{'showHidden':![],'depth':null}));};}var _0x4c1d1f=function(_0x1c3b73,_0x3d0ca9){var _0x171f0c=squel['insert']()[_0x7f5f('0x37')](_0x7f5f('0x38'))[_0x7f5f('0x39')]([_0x7f5f('0x21'),_0x7f5f('0x3a'),_0x7f5f('0x3b'),_0x7f5f('0x28'),_0x3d0ca9,'createdAt',_0x7f5f('0x3c')],squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')](_0x7f5f('0x21'),'phone')['field'](_0x7f5f('0x3f'),_0x7f5f('0x3a'))[_0x7f5f('0x3e')]('id',_0x7f5f('0x3b'))['field'](LISTID['toString'](),_0x7f5f('0x28'))[_0x7f5f('0x3e')](_0x1c3b73['id'][_0x7f5f('0x40')](),_0x3d0ca9)[_0x7f5f('0x3e')]('NOW()','createdAt')[_0x7f5f('0x3e')](_0x7f5f('0x3f'),_0x7f5f('0x3c'))[_0x7f5f('0x41')]('cm_contacts')[_0x7f5f('0x42')](_0x7f5f('0x43'))[_0x7f5f('0x42')](_0x7f5f('0x44'),LISTID[_0x7f5f('0x40')]())[_0x7f5f('0x42')](_0x7f5f('0x45'))[_0x7f5f('0x42')](_0x7f5f('0x46'),squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')]('phone')['from'](_0x7f5f('0x38'))['where'](_0x3d0ca9+_0x7f5f('0x47'),_0x1c3b73['id'][_0x7f5f('0x40')]())))[_0x7f5f('0x40')]();return _0x171f0c;};var _0x1f1760=function(_0x93f4f,_0x4ad7ac){var _0x47cd60=squel[_0x7f5f('0x48')]()[_0x7f5f('0x37')]('cm_hopper')['fromQuery']([_0x7f5f('0x21'),'scheduledAt',_0x7f5f('0x3b'),_0x7f5f('0x28'),_0x4ad7ac,_0x7f5f('0x49'),_0x7f5f('0x3c')],squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')](_0x7f5f('0x21'),'phone')['field'](_0x7f5f('0x3f'),'scheduledAt')[_0x7f5f('0x3e')]('id',_0x7f5f('0x3b'))[_0x7f5f('0x3e')](LISTID[_0x7f5f('0x40')](),_0x7f5f('0x28'))[_0x7f5f('0x3e')](_0x93f4f['id'][_0x7f5f('0x40')](),_0x4ad7ac)[_0x7f5f('0x3e')](_0x7f5f('0x3f'),_0x7f5f('0x49'))[_0x7f5f('0x3e')](_0x7f5f('0x3f'),_0x7f5f('0x3c'))[_0x7f5f('0x41')](_0x7f5f('0x4a'))['where'](_0x7f5f('0x43'))[_0x7f5f('0x42')]('ListId\x20=\x20?',LISTID[_0x7f5f('0x40')]())[_0x7f5f('0x42')](_0x7f5f('0x4b'),squel[_0x7f5f('0x4c')](hopperContacts))[_0x7f5f('0x42')](_0x7f5f('0x45'))['where'](_0x7f5f('0x46'),squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')]('calleridnum')[_0x7f5f('0x41')]('cm_hopper_final')['where'](_0x4ad7ac+_0x7f5f('0x47'),_0x93f4f['id'][_0x7f5f('0x40')]()))[_0x7f5f('0x42')](_0x7f5f('0x46'),squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')]('phone')[_0x7f5f('0x41')](_0x7f5f('0x38'))['where'](_0x4ad7ac+_0x7f5f('0x47'),_0x93f4f['id'][_0x7f5f('0x40')]())))[_0x7f5f('0x40')]();return _0x47cd60;};function _0x282163(_0x4c77e5,_0x117238){var _0x2546a0=squel[_0x7f5f('0x48')]()[_0x7f5f('0x37')](_0x7f5f('0x38'))[_0x7f5f('0x39')](['phone','scheduledAt',_0x7f5f('0x3b'),_0x7f5f('0x28'),_0x117238,'createdAt',_0x7f5f('0x3c')],squel[_0x7f5f('0x3d')]()[_0x7f5f('0x3e')](_0x7f5f('0x21'),_0x7f5f('0x21'))[_0x7f5f('0x3e')]('NOW()','scheduledAt')['field']('id',_0x7f5f('0x3b'))[_0x7f5f('0x3e')](LISTID[_0x7f5f('0x40')](),'ListId')['field'](_0x4c77e5['id'][_0x7f5f('0x40')](),_0x117238)[_0x7f5f('0x3e')](_0x7f5f('0x3f'),_0x7f5f('0x49'))[_0x7f5f('0x3e')](_0x7f5f('0x3f'),_0x7f5f('0x3c'))['from']('cm_contacts')[_0x7f5f('0x42')](_0x7f5f('0x43'))[_0x7f5f('0x42')](_0x7f5f('0x44'),LISTID[_0x7f5f('0x40')]())[_0x7f5f('0x42')]('id\x20IN\x20?',squel[_0x7f5f('0x4c')](hopperContacts))[_0x7f5f('0x42')](_0x7f5f('0x45')))[_0x7f5f('0x40')]();return _0x2546a0;}function _0x56af9c(_0x5ec11b,_0x17b3f1){var _0xf240b2=squel[_0x7f5f('0x48')]()[_0x7f5f('0x37')]('cm_hopper_black')[_0x7f5f('0x39')]([_0x7f5f('0x21'),_0x7f5f('0x3b'),_0x7f5f('0x28'),_0x17b3f1,_0x7f5f('0x49'),_0x7f5f('0x3c')],squel['select']()[_0x7f5f('0x3e')](_0x7f5f('0x21'),_0x7f5f('0x21'))[_0x7f5f('0x3e')]('id','ContactId')[_0x7f5f('0x3e')](LISTID[_0x7f5f('0x40')](),_0x7f5f('0x28'))[_0x7f5f('0x3e')](_0x5ec11b['id'][_0x7f5f('0x40')](),_0x17b3f1)[_0x7f5f('0x3e')](_0x7f5f('0x3f'),'createdAt')['field'](_0x7f5f('0x3f'),_0x7f5f('0x3c'))[_0x7f5f('0x41')](_0x7f5f('0x4a'))[_0x7f5f('0x42')](_0x7f5f('0x43'))['where'](_0x7f5f('0x44'),LISTID[_0x7f5f('0x40')]())['where'](_0x7f5f('0x4b'),squel[_0x7f5f('0x4c')](hopperContacts))['where'](_0x7f5f('0x45')))[_0x7f5f('0x40')]();return _0xf240b2;}return db[_0x7f5f('0x4d')][_0x7f5f('0x4e')]({'where':{'type':'outbound'},'attributes':['id',_0x7f5f('0x4f')],'include':[{'model':db['CmList'],'as':_0x7f5f('0x50'),'where':{'id':LISTID}}]})[_0x7f5f('0x2f')](function(_0x10943d){var _0x3767fa=[];if(_0x10943d){var _0x162ce1;for(var _0x2330f7=0x0,_0x599cdb;_0x2330f7<_0x10943d[_0x7f5f('0x1a')];_0x2330f7+=0x1){_0x599cdb=_0x10943d[_0x2330f7][_0x7f5f('0x51')]({'plain':!![]});switch(_0x599cdb[_0x7f5f('0x4f')]){case _0x7f5f('0x52'):_0x3767fa[_0x7f5f('0x30')](db[_0x7f5f('0x53')][_0x7f5f('0x54')](_0x1f1760(_0x599cdb,'VoiceQueueId'))[_0x7f5f('0x2f')](function(){})[_0x7f5f('0x31')](_0x1d21c8()));break;case _0x7f5f('0x55'):_0x3767fa[_0x7f5f('0x30')](db[_0x7f5f('0x53')]['query'](_0x4c1d1f(_0x599cdb,_0x7f5f('0x56')))['then'](function(){})[_0x7f5f('0x31')](_0x1d21c8()));break;default:_0x3767fa[_0x7f5f('0x30')](db[_0x7f5f('0x53')][_0x7f5f('0x54')](_0x282163(_0x599cdb,_0x7f5f('0x56')))[_0x7f5f('0x2f')](function(){})['catch'](_0x1d21c8()));}}}return _0x3767fa;})[_0x7f5f('0x57')]()['then'](function(){return db[_0x7f5f('0x4d')][_0x7f5f('0x4e')]({'where':{'type':_0x7f5f('0x58')},'attributes':['id'],'include':[{'model':db[_0x7f5f('0x59')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x7f5f('0x2f')](function(_0x24647a){var _0x34308b=[];if(_0x24647a){var _0x496ce6;for(var _0x554c54=0x0,_0x4a0086;_0x554c54<_0x24647a[_0x7f5f('0x1a')];_0x554c54+=0x1){_0x4a0086=_0x24647a[_0x554c54][_0x7f5f('0x51')]({'plain':!![]});_0x34308b[_0x7f5f('0x30')](db[_0x7f5f('0x53')][_0x7f5f('0x54')](_0x56af9c(_0x4a0086,'VoiceQueueId'))[_0x7f5f('0x2f')](function(){})[_0x7f5f('0x31')](_0x1d21c8()));}}return _0x34308b;})['all']();})['then'](function(){return db[_0x7f5f('0x5a')]['findAll']({'attributes':['id',_0x7f5f('0x4f')],'include':[{'model':db[_0x7f5f('0x59')],'as':_0x7f5f('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x4a0634){var _0x3fba38=[];if(_0x4a0634){for(var _0x50b4fb=0x0,_0x2225b7;_0x50b4fb<_0x4a0634[_0x7f5f('0x1a')];_0x50b4fb+=0x1){_0x2225b7=_0x4a0634[_0x50b4fb]['get']({'plain':!![]});switch(_0x2225b7['dialCheckDuplicateType']){case _0x7f5f('0x52'):_0x3fba38[_0x7f5f('0x30')](db['sequelize'][_0x7f5f('0x54')](_0x1f1760(_0x2225b7,_0x7f5f('0x5b')))[_0x7f5f('0x2f')](function(){})[_0x7f5f('0x31')](_0x1d21c8()));break;case _0x7f5f('0x55'):_0x3fba38[_0x7f5f('0x30')](db[_0x7f5f('0x53')]['query'](_0x4c1d1f(_0x2225b7,'CampaignId'))[_0x7f5f('0x2f')](function(){})[_0x7f5f('0x31')](_0x1d21c8()));break;default:_0x3fba38[_0x7f5f('0x30')](db['sequelize'][_0x7f5f('0x54')](_0x282163(_0x2225b7,'CampaignId'))['then'](function(){})['catch'](_0x1d21c8()));}}}return _0x3fba38;})['all']();})[_0x7f5f('0x2f')](function(){return db[_0x7f5f('0x5a')][_0x7f5f('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x7f5f('0x59')],'as':_0x7f5f('0x5c'),'where':{'id':LISTID}}]})[_0x7f5f('0x2f')](function(_0x2bd6d7){var _0x4a8b74=[];if(_0x2bd6d7){for(var _0x768102=0x0,_0x262324;_0x768102<_0x2bd6d7['length'];_0x768102+=0x1){_0x262324=_0x2bd6d7[_0x768102]['get']({'plain':!![]});_0x4a8b74[_0x7f5f('0x30')](db[_0x7f5f('0x53')][_0x7f5f('0x54')](_0x56af9c(_0x262324,_0x7f5f('0x5b')))[_0x7f5f('0x2f')](function(){})['catch'](_0x1d21c8()));}}return _0x4a8b74;})['all']();})['catch'](function(_0x5e84d6){logger[_0x7f5f('0x14')](_0x7f5f('0x5d'),_0x7f5f('0x5e'),_0x5e84d6[_0x7f5f('0x1c')]);});}var processPromises=function(_0x1824f1){return BPromise['all'](promises)[_0x7f5f('0x2f')](function(_0x5973fe){})['catch'](function(_0x3b327f){logger[_0x7f5f('0x14')]('Error\x20processing\x20rows\x20block:',JSON[_0x7f5f('0x33')](_0x3b327f));})['finally'](function(){socket['emit'](_0x7f5f('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1824f1){return _0x1824f1[_0x7f5f('0x60')]();}});};var endCsv=function(){return BPromise[_0x7f5f('0x61')]()[_0x7f5f('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x7f5f('0x2f')](function(){socket[_0x7f5f('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x3ba9e3){logger[_0x7f5f('0x14')](_0x7f5f('0x63'),JSON['stringify'](_0x3ba9e3));}finally{process[_0x7f5f('0x64')](0x0);}});};process['on'](_0x7f5f('0x65'),function(){logger[_0x7f5f('0x66')](_0x7f5f('0x67'));endCsv();});function main(){return BPromise[_0x7f5f('0x61')]()[_0x7f5f('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7f5f('0x12')](',');return db[_0x7f5f('0x2c')][_0x7f5f('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7f5f('0x2f')](function(_0x5e6533){var _0x73f5fe=fs[_0x7f5f('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7f5f('0x69')](_0x73f5fe,{'header':!![],'skipEmptyLines':!![],'step':function(_0x112424,_0x3f4238){total+=0x1;var _0x5d9b1b=total;promises[_0x7f5f('0x30')](checkRow(_0x112424,_0x5e6533,_0x5d9b1b)[_0x7f5f('0x2f')](function(){success+=0x1;})[_0x7f5f('0x31')](function(_0x3e65e2){if(_0x3e65e2[_0x7f5f('0x14')]){errors+=0x1;delete _0x3e65e2[_0x7f5f('0x14')];}else if(_0x3e65e2[_0x7f5f('0x2b')]){duplicates+=0x1;delete _0x3e65e2[_0x7f5f('0x2b')];}rows['push'](_0x3e65e2);}));if(total%0xc8===0x0){_0x3f4238[_0x7f5f('0x6a')]();return processPromises(_0x3f4238);}},'complete':function(){return processPromises()[_0x7f5f('0x2f')](function(){logger[_0x7f5f('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x58b87a,_0x36abc6){logger['info'](_0x7f5f('0x6b'),JSON[_0x7f5f('0x33')](_0x58b87a));endCsv();}});})[_0x7f5f('0x31')](function(_0x1f8883){logger[_0x7f5f('0x14')](_0x7f5f('0x6c'),JSON[_0x7f5f('0x33')](_0x1f8883));});}main(); \ No newline at end of file +var _0xa1d0=['Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','test','isNil','errors','length','join','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','CmList','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','info','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','zipObject','split'];(function(_0x2554a9,_0x466c5a){var _0x22b0df=function(_0xe96591){while(--_0xe96591){_0x2554a9['push'](_0x2554a9['shift']());}};_0x22b0df(++_0x466c5a);}(_0xa1d0,0x19f));var _0x0a1d=function(_0x2ba95a,_0x4f1647){_0x2ba95a=_0x2ba95a-0x0;var _0x37387c=_0xa1d0[_0x2ba95a];return _0x37387c;};'use strict';var BPromise=require(_0x0a1d('0x0'));var util=require(_0x0a1d('0x1'));var _=require(_0x0a1d('0x2'));var fs=require('fs');var squel=require(_0x0a1d('0x3'));var Papa=require(_0x0a1d('0x4'));var Redis=require(_0x0a1d('0x5'));var db=require(_0x0a1d('0x6'))['db'];var config=require(_0x0a1d('0x7'));var logger=require(_0x0a1d('0x8'))(_0x0a1d('0x9'));config[_0x0a1d('0xa')]=_[_0x0a1d('0xb')](config[_0x0a1d('0xa')],{'host':_0x0a1d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a1d('0xa')]));require(_0x0a1d('0xd'))[_0x0a1d('0xe')](socket);try{if(!process[_0x0a1d('0xf')][0x2]||process[_0x0a1d('0xf')][0x2]===_0x0a1d('0x10')||process[_0x0a1d('0xf')][0x2]==='null'){throw new Error(_0x0a1d('0x11'));}var FILEPATH=process[_0x0a1d('0xf')][0x2];if(!process[_0x0a1d('0xf')][0x3]||process[_0x0a1d('0xf')][0x3]==='undefined'||process[_0x0a1d('0xf')][0x3]===_0x0a1d('0x12')||!process[_0x0a1d('0xf')][0x4]||process['argv'][0x4]===_0x0a1d('0x10')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x0a1d('0x13')](process[_0x0a1d('0xf')][0x3][_0x0a1d('0x14')](','),process[_0x0a1d('0xf')][0x4][_0x0a1d('0x14')](','));if(!process[_0x0a1d('0xf')][0x5]||process[_0x0a1d('0xf')][0x5]===_0x0a1d('0x10')||process[_0x0a1d('0xf')][0x5]==='null'){throw new Error(_0x0a1d('0x15'));}var LISTID=process[_0x0a1d('0xf')][0x5];var COMPANYID=process[_0x0a1d('0xf')][0x6]&&process[_0x0a1d('0xf')][0x6]!==_0x0a1d('0x10')&&process[_0x0a1d('0xf')][0x6]!==_0x0a1d('0x12')?process[_0x0a1d('0xf')][0x6]:null;var DUPLICATES=process[_0x0a1d('0xf')][0x7]&&process[_0x0a1d('0xf')][0x7]!==_0x0a1d('0x10')&&process['argv'][0x7]!==_0x0a1d('0x12')?process[_0x0a1d('0xf')][0x7]:null;if(!process[_0x0a1d('0xf')][0x8]||process['argv'][0x8]===_0x0a1d('0x10')||process['argv'][0x8]===_0x0a1d('0x12')){throw new Error(_0x0a1d('0x16'));}var SOCKET_TIMESTAMP=process[_0x0a1d('0xf')][0x8];}catch(_0x119c57){logger[_0x0a1d('0x17')](_0x119c57);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(_0x14ef10,_0x555017,_0xab2456,_0x2977cb){var _0x4487a6={'message':_0x555017};_0x4487a6[_0x14ef10]=!![];if(_0xab2456){_0x4487a6['contact']=_0xab2456;}if(_0x2977cb){_0x4487a6['index']=_0x2977cb;}return _0x4487a6;}function isEmail(_0x11d2d4){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))*$/[_0x0a1d('0x18')](_0x11d2d4);}function checkRow(_0x1077c9,_0xbe19b2,_0x459d6d){return new BPromise(function(_0x5d3d09,_0x213eab){if(_[_0x0a1d('0x19')](_0x1077c9)){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x459d6d));}if(_0x1077c9[_0x0a1d('0x1a')]&&_0x1077c9[_0x0a1d('0x1a')][_0x0a1d('0x1b')]){var _0x405833=_['map'](_0x1077c9[_0x0a1d('0x1a')],'message')[_0x0a1d('0x1c')](';');return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x405833,null,_0x459d6d));}var _0x5c1c9f={};for(var _0x255ab0 in FIELDS){if(FIELDS['hasOwnProperty'](_0x255ab0)&&FIELDS[_0x255ab0]){_0x5c1c9f[_0x255ab0]=_0x1077c9['data'][0x0][FIELDS[_0x255ab0]]||_0x1077c9['data'][0x0]['\ufeff'+FIELDS[_0x255ab0]];}}if(!_0x5c1c9f[_0x0a1d('0x1d')]){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x1e'),null,_0x459d6d));}if(!_0x5c1c9f[_0x0a1d('0x1f')]){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x20'),null,_0x459d6d));}if(_0x5c1c9f['birthDate']){var _0x4701bf=moment(_0x5c1c9f['birthDate'],_0x0a1d('0x21'));if(!_0x4701bf[_0x0a1d('0x22')]()){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x459d6d));}}if(_0x5c1c9f[_0x0a1d('0x23')]){if(!isEmail(_0x5c1c9f['email'])){return _0x213eab(handleCheckRowError(_0x0a1d('0x17'),_0x0a1d('0x24'),null,_0x459d6d));}}_0x5c1c9f['ListId']=LISTID;_0x5c1c9f[_0x0a1d('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0a1d('0x1b')]&&_0xbe19b2){var _0x62efef={};for(var _0x521eec=0x0,_0x5a96b7=DUPLICATES[_0x0a1d('0x1b')];_0x521eec<_0x5a96b7;_0x521eec+=0x1){_0x62efef[DUPLICATES[_0x521eec]]=_0x5c1c9f[DUPLICATES[_0x521eec]];}var _0x5331a9=_[_0x0a1d('0x26')](_0xbe19b2,_0x62efef);if(_0x5331a9){return _0x213eab(handleCheckRowError(_0x0a1d('0x27'),'Duplicate\x20Contact',_0x5331a9,_0x459d6d));}}return db['CmContact'][_0x0a1d('0x28')](_0x5c1c9f,{'raw':!![],'hooks':![],'fields':_[_0x0a1d('0x29')](_0x5c1c9f)})[_0x0a1d('0x2a')](function(_0xb8b43){if(DUPLICATES&&DUPLICATES[_0x0a1d('0x1b')]&&_0xbe19b2){_0xbe19b2[_0x0a1d('0x2b')](_[_0x0a1d('0x2c')](_0x5c1c9f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb8b43['id'];return _0x5d3d09();})[_0x0a1d('0x2d')](function(_0x23058f){return _0x213eab(handleCheckRowError('error',_0x0a1d('0x2e')+(_0x23058f[_0x0a1d('0x2f')]||JSON[_0x0a1d('0x30')](_0x23058f)),null,_0x459d6d));});});}function checkHopper(){function _0x1d8052(){return function(_0x35177e){logger[_0x0a1d('0x17')](_0x0a1d('0x31'),_0x0a1d('0x32'),util[_0x0a1d('0x33')](_0x35177e,{'showHidden':![],'depth':null}));};}var _0xfa5836=function(_0x1a6581,_0x14c096){var _0x373e47=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')]('cm_hopper')[_0x0a1d('0x36')]([_0x0a1d('0x1f'),_0x0a1d('0x37'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x14c096,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')](_0x0a1d('0x1f'),_0x0a1d('0x1f'))['field']('NOW()',_0x0a1d('0x37'))[_0x0a1d('0x3d')]('id',_0x0a1d('0x38'))[_0x0a1d('0x3d')](LISTID[_0x0a1d('0x3e')](),'ListId')['field'](_0x1a6581['id'][_0x0a1d('0x3e')](),_0x14c096)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'createdAt')[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'updatedAt')[_0x0a1d('0x40')](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))[_0x0a1d('0x42')](_0x0a1d('0x44'),LISTID['toString']())[_0x0a1d('0x42')](_0x0a1d('0x45'))[_0x0a1d('0x42')](_0x0a1d('0x46'),squel['select']()[_0x0a1d('0x3d')](_0x0a1d('0x1f'))[_0x0a1d('0x40')](_0x0a1d('0x47'))[_0x0a1d('0x42')](_0x14c096+_0x0a1d('0x48'),_0x1a6581['id'][_0x0a1d('0x3e')]())))[_0x0a1d('0x3e')]();return _0x373e47;};var _0x2b7742=function(_0x259917,_0x7a091e){var _0x5167de=squel[_0x0a1d('0x34')]()['into'](_0x0a1d('0x47'))[_0x0a1d('0x36')]([_0x0a1d('0x1f'),_0x0a1d('0x37'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x7a091e,_0x0a1d('0x3a'),'updatedAt'],squel[_0x0a1d('0x3c')]()['field']('phone',_0x0a1d('0x1f'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x37'))['field']('id','ContactId')[_0x0a1d('0x3d')](LISTID[_0x0a1d('0x3e')](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x259917['id']['toString'](),_0x7a091e)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3a'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))[_0x0a1d('0x40')]('cm_contacts')[_0x0a1d('0x42')](_0x0a1d('0x43'))['where'](_0x0a1d('0x44'),LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')](_0x0a1d('0x49'),squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45'))[_0x0a1d('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')](_0x0a1d('0x4b'))[_0x0a1d('0x40')](_0x0a1d('0x4c'))[_0x0a1d('0x42')](_0x7a091e+_0x0a1d('0x48'),_0x259917['id'][_0x0a1d('0x3e')]()))[_0x0a1d('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a1d('0x3c')]()[_0x0a1d('0x3d')]('phone')[_0x0a1d('0x40')](_0x0a1d('0x47'))[_0x0a1d('0x42')](_0x7a091e+'\x20=\x20?',_0x259917['id'][_0x0a1d('0x3e')]())))[_0x0a1d('0x3e')]();return _0x5167de;};function _0x13b1cf(_0x3b29b2,_0x1795e3){var _0xac9161=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')](_0x0a1d('0x47'))['fromQuery']([_0x0a1d('0x1f'),'scheduledAt',_0x0a1d('0x38'),_0x0a1d('0x39'),_0x1795e3,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()['field'](_0x0a1d('0x1f'),_0x0a1d('0x1f'))['field'](_0x0a1d('0x3f'),_0x0a1d('0x37'))[_0x0a1d('0x3d')]('id','ContactId')[_0x0a1d('0x3d')](LISTID['toString'](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x3b29b2['id'][_0x0a1d('0x3e')](),_0x1795e3)[_0x0a1d('0x3d')]('NOW()',_0x0a1d('0x3a'))[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))['from'](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))['where'](_0x0a1d('0x44'),LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')](_0x0a1d('0x49'),squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45')))[_0x0a1d('0x3e')]();return _0xac9161;}function _0x19fe09(_0x1e2dc5,_0x320953){var _0x281ba1=squel[_0x0a1d('0x34')]()[_0x0a1d('0x35')](_0x0a1d('0x4d'))['fromQuery']([_0x0a1d('0x1f'),_0x0a1d('0x38'),_0x0a1d('0x39'),_0x320953,_0x0a1d('0x3a'),_0x0a1d('0x3b')],squel[_0x0a1d('0x3c')]()['field'](_0x0a1d('0x1f'),_0x0a1d('0x1f'))[_0x0a1d('0x3d')]('id',_0x0a1d('0x38'))['field'](LISTID['toString'](),_0x0a1d('0x39'))[_0x0a1d('0x3d')](_0x1e2dc5['id'][_0x0a1d('0x3e')](),_0x320953)[_0x0a1d('0x3d')](_0x0a1d('0x3f'),'createdAt')[_0x0a1d('0x3d')](_0x0a1d('0x3f'),_0x0a1d('0x3b'))['from'](_0x0a1d('0x41'))[_0x0a1d('0x42')](_0x0a1d('0x43'))[_0x0a1d('0x42')]('ListId\x20=\x20?',LISTID[_0x0a1d('0x3e')]())[_0x0a1d('0x42')]('id\x20IN\x20?',squel[_0x0a1d('0x4a')](hopperContacts))[_0x0a1d('0x42')](_0x0a1d('0x45')))['toString']();return _0x281ba1;}return db[_0x0a1d('0x4e')][_0x0a1d('0x4f')]({'where':{'type':_0x0a1d('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0a1d('0x51'),'where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x5421){var _0x1fb1e7=[];if(_0x5421){var _0x233a57;for(var _0x7d8094=0x0,_0x4530f8;_0x7d8094<_0x5421['length'];_0x7d8094+=0x1){_0x4530f8=_0x5421[_0x7d8094][_0x0a1d('0x52')]({'plain':!![]});switch(_0x4530f8['dialCheckDuplicateType']){case _0x0a1d('0x53'):_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x2b7742(_0x4530f8,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;case _0x0a1d('0x56'):_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')][_0x0a1d('0x57')](_0xfa5836(_0x4530f8,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;default:_0x1fb1e7[_0x0a1d('0x2b')](db[_0x0a1d('0x54')][_0x0a1d('0x57')](_0x13b1cf(_0x4530f8,'VoiceQueueId'))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));}}}return _0x1fb1e7;})['all']()[_0x0a1d('0x2a')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x0a1d('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a1d('0x58')],'as':_0x0a1d('0x59'),'where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x34c5dd){var _0x2dd549=[];if(_0x34c5dd){var _0x373163;for(var _0x322943=0x0,_0x346adf;_0x322943<_0x34c5dd[_0x0a1d('0x1b')];_0x322943+=0x1){_0x346adf=_0x34c5dd[_0x322943][_0x0a1d('0x52')]({'plain':!![]});_0x2dd549[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x19fe09(_0x346adf,_0x0a1d('0x55')))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));}}return _0x2dd549;})[_0x0a1d('0x5a')]();})[_0x0a1d('0x2a')](function(){return db[_0x0a1d('0x5b')][_0x0a1d('0x4f')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0a1d('0x58')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x43bddd){var _0x3bc8b0=[];if(_0x43bddd){for(var _0x5aca44=0x0,_0x302a1a;_0x5aca44<_0x43bddd[_0x0a1d('0x1b')];_0x5aca44+=0x1){_0x302a1a=_0x43bddd[_0x5aca44][_0x0a1d('0x52')]({'plain':!![]});switch(_0x302a1a['dialCheckDuplicateType']){case _0x0a1d('0x53'):_0x3bc8b0[_0x0a1d('0x2b')](db['sequelize'][_0x0a1d('0x57')](_0x2b7742(_0x302a1a,'CampaignId'))[_0x0a1d('0x2a')](function(){})['catch'](_0x1d8052()));break;case _0x0a1d('0x56'):_0x3bc8b0['push'](db[_0x0a1d('0x54')]['query'](_0xfa5836(_0x302a1a,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));break;default:_0x3bc8b0[_0x0a1d('0x2b')](db[_0x0a1d('0x54')]['query'](_0x13b1cf(_0x302a1a,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));}}}return _0x3bc8b0;})[_0x0a1d('0x5a')]();})[_0x0a1d('0x2a')](function(){return db['Campaign'][_0x0a1d('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0a1d('0x58')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0a1d('0x2a')](function(_0x417863){var _0x2a088b=[];if(_0x417863){for(var _0x5247db=0x0,_0x5bdd9b;_0x5247db<_0x417863[_0x0a1d('0x1b')];_0x5247db+=0x1){_0x5bdd9b=_0x417863[_0x5247db][_0x0a1d('0x52')]({'plain':!![]});_0x2a088b[_0x0a1d('0x2b')](db['sequelize'][_0x0a1d('0x57')](_0x19fe09(_0x5bdd9b,_0x0a1d('0x5c')))[_0x0a1d('0x2a')](function(){})[_0x0a1d('0x2d')](_0x1d8052()));}}return _0x2a088b;})[_0x0a1d('0x5a')]();})['catch'](function(_0x5d8386){logger[_0x0a1d('0x17')](_0x0a1d('0x5d'),_0x0a1d('0x5e'),_0x5d8386[_0x0a1d('0x2f')]);});}var processPromises=function(_0x30a1d0){return BPromise[_0x0a1d('0x5a')](promises)[_0x0a1d('0x2a')](function(_0x1de868){})['catch'](function(_0x560df5){logger[_0x0a1d('0x17')](_0x0a1d('0x5f'),JSON[_0x0a1d('0x30')](_0x560df5));})[_0x0a1d('0x60')](function(){socket['emit'](_0x0a1d('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x30a1d0){return _0x30a1d0[_0x0a1d('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x0a1d('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x0a1d('0x2a')](function(){socket['emit'](_0x0a1d('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a1d('0x63')](FILEPATH);}catch(_0x21feab){logger['error'](_0x0a1d('0x64'),JSON[_0x0a1d('0x30')](_0x21feab));}finally{process[_0x0a1d('0x65')](0x0);}});};process['on'](_0x0a1d('0x66'),function(){logger['info'](_0x0a1d('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x0a1d('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a1d('0x14')](',');return db[_0x0a1d('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0a1d('0x2a')](function(_0x56aeca){var _0x458175=fs[_0x0a1d('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a1d('0x6a')](_0x458175,{'header':!![],'skipEmptyLines':!![],'step':function(_0x11df5b,_0x4521de){total+=0x1;var _0x43c662=total;promises[_0x0a1d('0x2b')](checkRow(_0x11df5b,_0x56aeca,_0x43c662)['then'](function(){success+=0x1;})[_0x0a1d('0x2d')](function(_0x1ad142){if(_0x1ad142['error']){errors+=0x1;delete _0x1ad142[_0x0a1d('0x17')];}else if(_0x1ad142[_0x0a1d('0x27')]){duplicates+=0x1;delete _0x1ad142[_0x0a1d('0x27')];}rows[_0x0a1d('0x2b')](_0x1ad142);}));if(total%0xc8===0x0){_0x4521de['pause']();return processPromises(_0x4521de);}},'complete':function(){return processPromises()[_0x0a1d('0x2a')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x500094,_0x51c8bb){logger[_0x0a1d('0x6b')](_0x0a1d('0x6c'),JSON[_0x0a1d('0x30')](_0x500094));endCsv();}});})[_0x0a1d('0x2d')](function(_0x286b0e){logger[_0x0a1d('0x17')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x286b0e));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1b6f6c2..c3c9f11 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 _0xedd8=['ListId\x20=\x20?','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','concat',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','then','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','length','dialTimezone','isNil','utcOffset','set','offset','send','binding','socket_timestamp','root','server/files/tmp','.csv','keys','includes',',utcOffset','writeFileSync','parse','data','rows','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','appendFileSync','abort','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(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','CompanyId','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','contact:import:','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','updatedAt','priority','UserId','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','ContactId','fields'];(function(_0x579d58,_0x1517da){var _0x155d36=function(_0x2e0c28){while(--_0x2e0c28){_0x579d58['push'](_0x579d58['shift']());}};_0x155d36(++_0x1517da);}(_0xedd8,0xfa));var _0x8edd=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0xedd8[_0x5a1cc9];return _0x471761;};'use strict';var fs=require('fs');var path=require(_0x8edd('0x0'));var _=require('lodash');var Papa=require(_0x8edd('0x1'));var util=require('util');var BPromise=require(_0x8edd('0x2'));var moment=require(_0x8edd('0x3'));var squel=require(_0x8edd('0x4'));var Redis=require(_0x8edd('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x8edd('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0x8edd('0x7'))(_0x8edd('0x8'));config['redis']=_[_0x8edd('0x9')](config['redis'],{'host':_0x8edd('0xa'),'port':0x18eb});var socket=require(_0x8edd('0xb'))(new Redis(config['redis']));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'](_0x8edd('0xc'));function isEmail(_0x349349){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))*$/[_0x8edd('0xd')](_0x349349);}function selectNotIn(_0x5090ef,_0x59e5b9,_0x15141c,_0x4d5bee,_0x588175){return squel[_0x8edd('0xe')]()[_0x8edd('0xf')]('phone')['from'](_0x4d5bee)[_0x8edd('0x10')](_0x59e5b9,null,_0x59e5b9+'.id\x20=\x20'+_0x4d5bee+'.'+_0x15141c)[_0x8edd('0x11')](_0x4d5bee+'.'+_0x15141c+'\x20=\x20'+_0x5090ef+'.'+_0x15141c)['where'](_0x59e5b9+_0x8edd('0x12')+_0x588175[_0x8edd('0x10')]()+')');}function insertCmHopper(_0x508f90,_0xfaf45e,_0x53f901,_0x2f941d,_0x1820ae){var _0x4b5859=['cm_contacts.phone','cm_contacts.scheduledat',_0x8edd('0x13'),_0x8edd('0x14'),_0xfaf45e+'.'+_0x2f941d,'cm_contacts.createdAt',_0x8edd('0x15'),_0x8edd('0x16'),_0x8edd('0x17'),'\x22'+_0x1820ae+'\x22'];return squel[_0x8edd('0x18')]()[_0x8edd('0x19')](_0x8edd('0x1a'))[_0x8edd('0x1b')]([_0x8edd('0x1c'),'scheduledat','ContactId',_0x8edd('0x1d'),_0x2f941d,_0x8edd('0x1e'),_0x8edd('0x1f'),_0x8edd('0x20'),_0x8edd('0x21'),_0x8edd('0x22')],squel[_0x8edd('0xe')]()['fields'](_0x4b5859)[_0x8edd('0x23')](_0xfaf45e)['join'](_0x8edd('0x24'),null,_0x8edd('0x25')+_0xfaf45e+_0x8edd('0x26'))[_0x8edd('0x10')](_0x53f901,null,_0x53f901+_0x8edd('0x27')+_0xfaf45e+'.'+_0x2f941d)[_0x8edd('0x11')](_0xfaf45e+_0x8edd('0x28'),_0x508f90)['where'](_0x8edd('0x29'),NOW)[_0x8edd('0x11')](_0x8edd('0x2a'),selectNotIn(_0xfaf45e,_0x53f901,_0x2f941d,_0x8edd('0x1a'),[_0x8edd('0x2b'),_0x8edd('0x2c')]))[_0x8edd('0x11')](_0x8edd('0x2a'),selectNotIn(_0xfaf45e,_0x53f901,_0x2f941d,_0x8edd('0x1a'),['\x22always\x22'])))[_0x8edd('0x2d')]();}function insertCmHopperBlack(_0x5853ee,_0x1a6c2e,_0x237727,_0x4f4f7c){var _0x444fbc=['cm_contacts.phone','cm_contacts.id',_0x8edd('0x14'),_0x1a6c2e+'.'+_0x4f4f7c,_0x8edd('0x2e'),_0x8edd('0x15')];return squel[_0x8edd('0x18')]()[_0x8edd('0x19')](_0x8edd('0x2f'))[_0x8edd('0x1b')]([_0x8edd('0x1c'),_0x8edd('0x30'),_0x8edd('0x1d'),_0x4f4f7c,_0x8edd('0x1e'),_0x8edd('0x1f')],squel[_0x8edd('0xe')]()[_0x8edd('0x31')](_0x444fbc)[_0x8edd('0x23')](_0x1a6c2e)[_0x8edd('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1a6c2e+_0x8edd('0x26'))[_0x8edd('0x10')](_0x237727,null,_0x237727+_0x8edd('0x27')+_0x1a6c2e+'.'+_0x4f4f7c)[_0x8edd('0x11')](_0x1a6c2e+_0x8edd('0x28'),_0x5853ee)[_0x8edd('0x11')](_0x8edd('0x29'),NOW)[_0x8edd('0x11')](_0x8edd('0x2a'),squel[_0x8edd('0xe')]()[_0x8edd('0xf')](_0x8edd('0x1c'))[_0x8edd('0x23')](_0x8edd('0x2f'))['where'](_0x8edd('0x32'),_0x5853ee)['where'](_0x4f4f7c+'\x20=\x20?',_0x1a6c2e+'.'+_0x4f4f7c)))[_0x8edd('0x2d')]();}function insertTzCmHopper(_0x2869d5,_0x5d01db,_0x432163,_0x120227,_0x50442f,_0x32dfae){var _0x1d2ed6=[_0x8edd('0x33'),_0x8edd('0x34')+_0x32dfae+_0x8edd('0x35'),_0x8edd('0x13'),_0x8edd('0x14'),_0x5d01db+'.'+_0x120227,'cm_contacts.createdAt',_0x8edd('0x15'),_0x8edd('0x16'),_0x8edd('0x17'),'\x22'+_0x50442f+'\x22'];var _0xcc706b=squel[_0x8edd('0x18')]()[_0x8edd('0x19')](_0x8edd('0x1a'))[_0x8edd('0x1b')]([_0x8edd('0x1c'),'scheduledat',_0x8edd('0x30'),_0x8edd('0x1d'),_0x120227,_0x8edd('0x1e'),_0x8edd('0x1f'),_0x8edd('0x20'),_0x8edd('0x21'),'recallme'],squel[_0x8edd('0xe')]()[_0x8edd('0x31')](_0x1d2ed6)[_0x8edd('0x23')](_0x5d01db)[_0x8edd('0x10')](_0x8edd('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x5d01db+_0x8edd('0x26'))[_0x8edd('0x10')](_0x432163,null,_0x432163+_0x8edd('0x27')+_0x5d01db+'.'+_0x120227)[_0x8edd('0x10')](_0x32dfae,null,_0x32dfae+_0x8edd('0x27')+_0x5d01db+'.'+_0x120227)[_0x8edd('0x11')](_0x5d01db+'.CmListId\x20=\x20?',_0x2869d5)[_0x8edd('0x11')](_0x8edd('0x29'),NOW)[_0x8edd('0x11')](_0x8edd('0x2a'),selectNotIn(_0x5d01db,_0x432163,_0x120227,_0x8edd('0x1a'),[_0x8edd('0x2b'),_0x8edd('0x2c')]))[_0x8edd('0x11')](_0x8edd('0x2a'),selectNotIn(_0x5d01db,_0x432163,_0x120227,_0x8edd('0x1a'),[_0x8edd('0x2b')])))[_0x8edd('0x2d')]();return _0xcc706b;}function insertTzCmHopperBlack(_0x5f5265,_0x1ebe2d,_0x9747e,_0x3df93){var _0x5f35e1=[_0x8edd('0x33'),_0x8edd('0x13'),'cm_contacts.ListId',_0x1ebe2d+'.'+_0x3df93,'cm_contacts.createdAt',_0x8edd('0x15')];return squel['insert']()['into'](_0x8edd('0x2f'))['fromQuery']([_0x8edd('0x1c'),_0x8edd('0x30'),_0x8edd('0x1d'),_0x3df93,_0x8edd('0x1e'),_0x8edd('0x1f')],squel['select']()['fields'](_0x5f35e1)['from'](_0x1ebe2d)[_0x8edd('0x10')]('cm_contacts',null,_0x8edd('0x25')+_0x1ebe2d+'.CmListId')['join'](_0x9747e,null,_0x9747e+_0x8edd('0x27')+_0x1ebe2d+'.'+_0x3df93)[_0x8edd('0x11')](_0x1ebe2d+_0x8edd('0x28'),_0x5f5265)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8edd('0x11')](_0x8edd('0x2a'),squel[_0x8edd('0xe')]()[_0x8edd('0xf')]('phone')[_0x8edd('0x23')](_0x8edd('0x2f'))['where'](_0x8edd('0x32'),_0x5f5265)[_0x8edd('0x11')](_0x3df93+'\x20=\x20?',_0x1ebe2d+'.'+_0x3df93)))[_0x8edd('0x2d')]();}function insertCmContact(_0x183eb1,_0x4f5859,_0x5a55fa,_0x18b492){var _0x2a402e=_[_0x8edd('0x36')](_['keys'](_0x18b492),['ListId','CompanyId',_0x8edd('0x1e'),'updatedAt']);return squel[_0x8edd('0x18')]()[_0x8edd('0x19')]('cm_contacts')[_0x8edd('0x1b')](_0x2a402e,squel['select']()[_0x8edd('0x31')](_0x2a402e)[_0x8edd('0x23')](_0x4f5859)[_0x8edd('0x11')]('('+_0x5a55fa[_0x8edd('0x10')](',')+_0x8edd('0x37'),squel[_0x8edd('0xe')]()[_0x8edd('0x31')](_0x5a55fa)[_0x8edd('0x23')]('cm_contacts')[_0x8edd('0x11')](_0x8edd('0x32'),_0x183eb1)[_0x8edd('0x11')]('deletedAt\x20IS\x20NULL'))['where'](_0x8edd('0x38'),squel[_0x8edd('0xe')]()[_0x8edd('0xf')](_0x8edd('0x39'),_0x8edd('0x3a'))[_0x8edd('0x23')](_0x4f5859)[_0x8edd('0x3b')](_0x5a55fa[_0x8edd('0x10')](','))))['toString']();}function handleStop(){logger[_0x8edd('0x3c')](_0x8edd('0x3d'));stopped=!![];}function handleUncaughtException(_0x364f6d){logger[_0x8edd('0x3e')](_0x364f6d[_0x8edd('0x3f')]);process['exit'](0x1);}function handleError(_0x2a8aac,_0x3c01a2){stats[_0x8edd('0x40')][_0x8edd('0x41')]({'name':_0x3c01a2[_0x8edd('0x42')],'message':_0x3c01a2[_0x8edd('0x3f')],'row':_0x2a8aac});}function handleQuery(_0x948f7b){logger['info'](_0x948f7b);return db[_0x8edd('0x43')][_0x8edd('0x44')](_0x948f7b)[_0x8edd('0x45')](function(_0x597307){results['push'](_0x597307);})[_0x8edd('0x46')](function(_0xb816d){logger['error'](_0xb816d[_0x8edd('0x3f')]);});}function updateTzCampaigns(_0x399def){return new Promise(function(_0xa53ae5,_0x413a19){var _0x268b2a=squel['select']()[_0x8edd('0x31')]([_0x8edd('0x47'),_0x8edd('0x48')])['from'](_0x8edd('0x49'))[_0x8edd('0x10')]('campaigns_has_cm_lists',null,_0x8edd('0x4a'))['where'](_0x8edd('0x4b')+_0x399def);db['sequelize'][_0x8edd('0x44')](_0x268b2a[_0x8edd('0x2d')]())['spread'](function(_0x5b225d){var _0xa067ed=[];for(var _0x2c0ee5=0x0;_0x2c0ee5<_0x5b225d['length'];_0x2c0ee5++){_0xa067ed['push'](getTimezoneData(_0x5b225d[_0x2c0ee5],tmp_campaigns));}BPromise[_0x8edd('0x4c')](_0xa067ed)[_0x8edd('0x4d')](function(){_0xa53ae5({'val':0x1});});})[_0x8edd('0x46')](function(_0xbc1e99){logger[_0x8edd('0x3e')](_0xbc1e99[_0x8edd('0x3f')]);_0xa53ae5({'val':0x0});});});}function updateTzVoiceQueues(_0x517452){return new Promise(function(_0x26fed5,_0x4d310e){var _0x24a372=squel[_0x8edd('0xe')]()[_0x8edd('0x31')]([_0x8edd('0x4e'),'voice_queues.dialTimezone'])[_0x8edd('0x23')](_0x8edd('0x4f'))['join'](_0x8edd('0x50'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x8edd('0x51')+_0x517452);db[_0x8edd('0x43')][_0x8edd('0x44')](_0x24a372['toString']())[_0x8edd('0x45')](function(_0x559992){var _0xf77a64=[];for(var _0xb49713=0x0;_0xb49713<_0x559992[_0x8edd('0x52')];_0xb49713++){_0xf77a64[_0x8edd('0x41')](getTimezoneData(_0x559992[_0xb49713],tmp_voice_queues));}BPromise[_0x8edd('0x4c')](_0xf77a64)[_0x8edd('0x4d')](function(){_0x26fed5({'val':0x1});});})[_0x8edd('0x46')](function(_0x544e47){logger[_0x8edd('0x3e')](_0x544e47[_0x8edd('0x3f')]);_0x26fed5({'val':0x0});});});}function getTimezoneData(_0xe215d6,_0x3de7ff){return new Promise(function(_0x25bd35,_0x5ea980){var _0x3571c0=shared['timezones'];var _0x1000b4=_0x3571c0[_0xe215d6[_0x8edd('0x53')]];if(_[_0x8edd('0x54')](_0x1000b4)){_0x25bd35({'ret':0x1});}else{var _0x2b6b43=_0x1000b4[_0x8edd('0x55')];var _0x31014f=squel[_0x8edd('0x18')]()[_0x8edd('0x19')](_0x3de7ff)[_0x8edd('0x56')]('id',_0xe215d6['id'])[_0x8edd('0x56')](_0x8edd('0x57'),_0x2b6b43)[_0x8edd('0x56')](_0x8edd('0x53'),_0xe215d6[_0x8edd('0x53')])[_0x8edd('0x2d')]();return db[_0x8edd('0x43')][_0x8edd('0x44')](_0x31014f)[_0x8edd('0x45')](function(_0x385e78){_0x25bd35({'ret':0x1});})[_0x8edd('0x46')](function(_0x1c25ad){logger[_0x8edd('0x3e')](_0x1c25ad['message']);_0x5ea980({'ret':0x1});});}});}function handleTZQuery(_0x52e603){logger[_0x8edd('0x3c')](_0x52e603);return db[_0x8edd('0x43')][_0x8edd('0x44')](_0x52e603)['spread'](function(_0x588228){})[_0x8edd('0x46')](function(_0x46c04a){logger[_0x8edd('0x3e')](_0x46c04a[_0x8edd('0x3f')]);});}function main(_0x4f006f,_0x210762,_0xc4d417,_0xfc22b){logger[_0x8edd('0x3c')]('main',_0x4f006f,JSON['stringify'](_0x210762));process[_0x8edd('0x58')]('start');var _0x503148=_0x210762[_0x8edd('0x59')];var _0x243de9=_0x210762[_0x8edd('0x5a')];var _0x3d2809=path[_0x8edd('0x10')](config[_0x8edd('0x5b')],_0x8edd('0x5c'),_0x243de9+_0x8edd('0x5d'));hasTZ=_[_0x8edd('0x5e')](_0x503148)[_0x8edd('0x5f')](_0x8edd('0x53'));var _0x338fa5=_[_0x8edd('0x5e')](_0x503148)[_0x8edd('0x10')]();logger[_0x8edd('0x3c')]('header',_0x338fa5);if(hasTZ)_0x338fa5+=_0x8edd('0x60');fs[_0x8edd('0x61')](_0x3d2809,_0x338fa5+'\x0a');Papa[_0x8edd('0x62')](fs['createReadStream'](_0x4f006f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x24d14e,_0x437843){try{for(var _0xb0daea=0x0,_0x4f0567=[];_0xb0daea<_0x24d14e[_0x8edd('0x63')]['length'];_0xb0daea++){stats[_0x8edd('0x64')]+=0x1;if(_0x24d14e[_0x8edd('0x40')][_0xb0daea]){handleError(_0x24d14e['data'][_0xb0daea],_0x24d14e['errors'][_0xb0daea]);}else{var _0x4447c6=[];for(var _0x474a02 in _0x503148){if(_0x503148['hasOwnProperty'](_0x474a02)){if(_0x24d14e[_0x8edd('0x63')][_0xb0daea][_0x503148[_0x474a02]]){var _0x4cd6f3=_[_0x8edd('0x65')](_0x24d14e[_0x8edd('0x63')][_0xb0daea][_0x503148[_0x474a02]]['replace'](/"/g,'\x27'));switch(_0x474a02){case _0x8edd('0x66'):var _0x5ecfe4=moment(_0x4cd6f3,_0x8edd('0xc'),!![]);if(_0x5ecfe4[_0x8edd('0x67')]()){_0x4f0567['push']('\x22'+_0x4cd6f3+'\x22');}else{_0x4447c6[_0x8edd('0x41')](_0x8edd('0x68'));}break;case _0x8edd('0x20'):var _0x108e69=parseInt(_0x4cd6f3);_0x4cd6f3=_[_0x8edd('0x69')](_0x108e69)||_0x108e69<0x0||_0x108e69>0x4?_0xfc22b?0x3:0x2:_0x108e69;_0x4f0567['push']('\x22'+_0x4cd6f3+'\x22');break;case _0x8edd('0x21'):var _0x2da68a=parseInt(_0x4cd6f3);if(_[_0x8edd('0x6a')](_0x2da68a)&&_[_0x8edd('0x5f')](_0xc4d417,_0x2da68a)){_0x4f0567[_0x8edd('0x41')]('\x22'+_0x2da68a+'\x22');}else{_0x4447c6['push'](_0x8edd('0x6b'));}break;case _0x8edd('0x6c'):if(isEmail(_0x4cd6f3)){_0x4f0567[_0x8edd('0x41')]('\x22'+_0x4cd6f3+'\x22');}else{_0x4447c6[_0x8edd('0x41')](_0x8edd('0x6d'));}break;case _0x8edd('0x6e'):var _0xfb63ce=moment(_0x4cd6f3,_0x8edd('0x6f'),!![]);if(_0xfb63ce['isValid']()){_0x4f0567['push']('\x22'+_0x4cd6f3+'\x22');}else{_0x4447c6[_0x8edd('0x41')](_0x8edd('0x70'));}break;case _0x8edd('0x53'):var _0x2ec4e0=shared[_0x8edd('0x71')];var _0x39fc0f=_0x2ec4e0[_0x4cd6f3];if(!_[_0x8edd('0x54')](_0x39fc0f)){var _0x2ee9df=_0x39fc0f['utcOffset'];_0x4f0567['push']('\x22'+_0x4cd6f3+'\x22');_0x4f0567[_0x8edd('0x41')]('\x22'+_0x2ee9df+'\x22');}break;default:_0x4f0567[_0x8edd('0x41')]('\x22'+_0x4cd6f3+'\x22');}}else{switch(_0x474a02){case _0x8edd('0x72'):case _0x8edd('0x1c'):_0x4447c6['push'](_0x474a02+_0x8edd('0x73'));break;default:_0x4f0567['push']('\x22\x22');}}}}if(_0x4447c6[_0x8edd('0x52')]){handleError(_0x24d14e['data'][_0xb0daea],{'code':'SystemRow','message':_0x4447c6[_0x8edd('0x10')]()});}else{fs[_0x8edd('0x74')](_0x3d2809,_0x4f0567[_0x8edd('0x10')]()+'\x0a');}_0x4f0567=[];}if(!(stats[_0x8edd('0x64')]%0xc8)){socket['emit']('contact:import:'+_0x243de9,stats);stats[_0x8edd('0x40')]=[];}}if(stopped){logger[_0x8edd('0x3c')]('Abort\x20parser');_0x437843[_0x8edd('0x75')]();}}catch(_0x55b0db){handleError(_0x24d14e[_0x8edd('0x63')][_0xb0daea],{'code':'SystemError','message':_0x55b0db[_0x8edd('0x3f')]});logger['error']('step',_0x55b0db['message']);}},'complete':function(){try{var _0x1d9535=[];var _0x4fe92c=[];var _0x55992a=_0x8edd('0x24');if(_0x210762['duplicates']&&_0x210762[_0x8edd('0x76')]['length']){_0x55992a='cm_contacts_'+_0x243de9;_0x1d9535[_0x8edd('0x41')](_0x8edd('0x77')+_0x55992a+_0x8edd('0x78'));}tmp_campaigns=_0x8edd('0x79')+_0x243de9;tmp_voice_queues='voice_queues_'+_0x243de9;_0x4fe92c[_0x8edd('0x41')](_0x8edd('0x77')+tmp_campaigns+_0x8edd('0x7a'));_0x4fe92c['push'](_0x8edd('0x77')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8edd('0x7b')](_0x4fe92c,handleTZQuery)['then'](function(_0x307496){updateTzCampaigns(_0x210762[_0x8edd('0x1d')])[_0x8edd('0x4d')](function(_0x5e63de){updateTzVoiceQueues(_0x210762['ListId'])[_0x8edd('0x4d')](function(_0x321e0b){var _0x214473=util[_0x8edd('0x7c')](_0x8edd('0x7d'),_0x3d2809,_0x55992a,_0x338fa5,_0x210762[_0x8edd('0x1d')],_0x210762[_0x8edd('0x7e')]||null,NOW,NOW);if(_[_0x8edd('0x54')](_0x503148[_0x8edd('0x66')])){_0x214473+=',\x20scheduledAt\x20=\x20NOW()';}_0x1d9535[_0x8edd('0x41')](_0x214473);if(_0x210762['duplicates']&&_0x210762['duplicates'][_0x8edd('0x52')]){_0x1d9535[_0x8edd('0x41')](insertCmContact(_0x210762['ListId'],_0x55992a,_0x210762[_0x8edd('0x76')],_0x503148));_0x1d9535[_0x8edd('0x41')](_0x8edd('0x7f')+_0x55992a+';');}if(hasTZ){_0x1d9535[_0x8edd('0x41')](insertTzCmHopper(_0x210762[_0x8edd('0x1d')],_0x8edd('0x50'),_0x8edd('0x4f'),_0x8edd('0x80'),_0xfc22b,tmp_voice_queues));_0x1d9535[_0x8edd('0x41')](insertTzCmHopperBlack(_0x210762['ListId'],_0x8edd('0x81'),'voice_queues',_0x8edd('0x80')));_0x1d9535[_0x8edd('0x41')](insertTzCmHopper(_0x210762[_0x8edd('0x1d')],'campaigns_has_cm_lists',_0x8edd('0x49'),_0x8edd('0x82'),_0xfc22b,tmp_campaigns));_0x1d9535[_0x8edd('0x41')](insertTzCmHopperBlack(_0x210762['ListId'],_0x8edd('0x83'),'campaigns',_0x8edd('0x82')));}else{_0x1d9535[_0x8edd('0x41')](insertCmHopper(_0x210762[_0x8edd('0x1d')],'voice_queues_has_cm_lists',_0x8edd('0x4f'),_0x8edd('0x80'),_0xfc22b));_0x1d9535[_0x8edd('0x41')](insertCmHopperBlack(_0x210762['ListId'],_0x8edd('0x81'),_0x8edd('0x4f'),'VoiceQueueId'));_0x1d9535['push'](insertCmHopper(_0x210762['ListId'],'campaigns_has_cm_lists','campaigns',_0x8edd('0x82'),_0xfc22b));_0x1d9535[_0x8edd('0x41')](insertCmHopperBlack(_0x210762[_0x8edd('0x1d')],_0x8edd('0x83'),_0x8edd('0x49'),'CampaignId'));}_0x1d9535[_0x8edd('0x41')](_0x8edd('0x7f')+tmp_campaigns+';');_0x1d9535[_0x8edd('0x41')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x8edd('0x7b')](_0x1d9535,handleQuery)[_0x8edd('0x4d')](function(_0x11cc34){stats[_0x8edd('0x84')]=!![];stats[_0x8edd('0x85')]=_0x210762[_0x8edd('0x76')]&&_0x210762['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x8edd('0x85')];socket[_0x8edd('0x86')](_0x8edd('0x87')+_0x243de9,stats);fs[_0x8edd('0x88')](_0x4f006f);fs[_0x8edd('0x88')](_0x3d2809);process['exit'](0x0);})['catch'](function(_0x247bae){logger[_0x8edd('0x3e')](_0x247bae[_0x8edd('0x3f')]);process[_0x8edd('0x89')](0x1);});});});});}catch(_0x2e7b91){logger[_0x8edd('0x3e')](_0x8edd('0x8a'),_0x2e7b91[_0x8edd('0x3f')]);process[_0x8edd('0x89')](0x1);}},'error':function(_0x3387a0,_0x271cb9,_0x34859b,_0x54f4e8){throw new Error(_0x54f4e8);}});}function validate(){if(process[_0x8edd('0x8b')]&&process[_0x8edd('0x8b')][_0x8edd('0x52')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0xbfc649=path[_0x8edd('0x10')](config[_0x8edd('0x5b')],_0x8edd('0x5c'),process['argv'][0x2]);if(!fs[_0x8edd('0x8c')](_0xbfc649)){throw new Error(_0x8edd('0x8d'));}var _0x3e7994={};try{_0x3e7994=JSON[_0x8edd('0x62')](process['argv'][0x3]);if(!_0x3e7994[_0x8edd('0x59')]){throw new Error(_0x8edd('0x8e'));}if(!_0x3e7994[_0x8edd('0x59')][_0x8edd('0x1c')]){throw new Error(_0x8edd('0x8f'));}if(!_0x3e7994[_0x8edd('0x59')][_0x8edd('0x72')]){throw new Error(_0x8edd('0x90'));}var _0x5a4cc1=0x0;if(_0x3e7994['binding'][_0x8edd('0x21')]){_0x5a4cc1=0x1;}if(!_0x3e7994[_0x8edd('0x1d')]){throw new Error(_0x8edd('0x91'));}}catch(_0x147998){throw new Error(_0x8edd('0x92'));}var _0x47d5b9=[];try{_0x47d5b9=_[_0x8edd('0x93')](JSON[_0x8edd('0x62')](process['argv'][0x4]),'id');}catch(_0x35ee77){logger[_0x8edd('0x3c')](_0x8edd('0x94'));}main(_0xbfc649,_0x3e7994,_0x47d5b9,_0x5a4cc1);}validate();process['on'](_0x8edd('0x95'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xa66d=['voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','then','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','.csv','includes','header',',utcOffset','writeFileSync','parse','rows','errors','data','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','server/files/tmp','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','where','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','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','ContactId','.CmListId','.id\x20=\x20','cm_hopper_black','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','createdAt','ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','push','code','message','sequelize','query','spread','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','length','all','catch','voice_queues.dialTimezone'];(function(_0x5522d4,_0x453448){var _0x23a3f9=function(_0x1a8cbc){while(--_0x1a8cbc){_0x5522d4['push'](_0x5522d4['shift']());}};_0x23a3f9(++_0x453448);}(_0xa66d,0xeb));var _0xda66=function(_0xa6603d,_0x374178){_0xa6603d=_0xa6603d-0x0;var _0x3500d8=_0xa66d[_0xa6603d];return _0x3500d8;};'use strict';var fs=require('fs');var path=require(_0xda66('0x0'));var _=require(_0xda66('0x1'));var Papa=require(_0xda66('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xda66('0x3'));var squel=require(_0xda66('0x4'));var Redis=require(_0xda66('0x5'));var db=require(_0xda66('0x6'))['db'];var config=require(_0xda66('0x7'));var shared=require(_0xda66('0x8'));var logger=require(_0xda66('0x9'))('import');config[_0xda66('0xa')]=_[_0xda66('0xb')](config[_0xda66('0xa')],{'host':_0xda66('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda66('0xa')]));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()[_0xda66('0xd')](_0xda66('0xe'));function isEmail(_0x3d7d41){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'](_0x3d7d41);}function selectNotIn(_0x407f96,_0x219417,_0x3c3ff8,_0x3690b5,_0x5c1238){return squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0x3690b5)['join'](_0x219417,null,_0x219417+'.id\x20=\x20'+_0x3690b5+'.'+_0x3c3ff8)[_0xda66('0x13')](_0x3690b5+'.'+_0x3c3ff8+'\x20=\x20'+_0x407f96+'.'+_0x3c3ff8)[_0xda66('0x13')](_0x219417+'.dialCheckDuplicateType\x20IN\x20('+_0x5c1238[_0xda66('0x14')]()+')');}function insertCmHopper(_0x1aa462,_0x18c68c,_0x1e5905,_0x45c0c4,_0x2f745e){var _0x5a351b=[_0xda66('0x15'),_0xda66('0x16'),'cm_contacts.id',_0xda66('0x17'),_0x18c68c+'.'+_0x45c0c4,_0xda66('0x18'),'cm_contacts.updatedAt',_0xda66('0x19'),_0xda66('0x1a'),'\x22'+_0x2f745e+'\x22'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x1d'))[_0xda66('0x1e')](['phone',_0xda66('0x1f'),'ContactId',_0xda66('0x20'),_0x45c0c4,'createdAt',_0xda66('0x21'),_0xda66('0x22'),_0xda66('0x23'),_0xda66('0x24')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0x5a351b)[_0xda66('0x12')](_0x18c68c)['join'](_0xda66('0x26'),null,_0xda66('0x27')+_0x18c68c+'.CmListId')['join'](_0x1e5905,null,_0x1e5905+'.id\x20=\x20'+_0x18c68c+'.'+_0x45c0c4)[_0xda66('0x13')](_0x18c68c+_0xda66('0x28'),_0x1aa462)['where'](_0xda66('0x29'),NOW)['where'](_0xda66('0x2a'),selectNotIn(_0x18c68c,_0x1e5905,_0x45c0c4,'cm_hopper',[_0xda66('0x2b'),_0xda66('0x2c')]))[_0xda66('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x18c68c,_0x1e5905,_0x45c0c4,'cm_hopper',['\x22always\x22'])))[_0xda66('0x2d')]();}function insertCmHopperBlack(_0x304921,_0x3e4f83,_0x4f1fdd,_0x52c387){var _0x4bd851=['cm_contacts.phone',_0xda66('0x2e'),_0xda66('0x17'),_0x3e4f83+'.'+_0x52c387,_0xda66('0x18'),'cm_contacts.updatedAt'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')]('cm_hopper_black')[_0xda66('0x1e')]([_0xda66('0x11'),_0xda66('0x2f'),'ListId',_0x52c387,'createdAt',_0xda66('0x21')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0x4bd851)[_0xda66('0x12')](_0x3e4f83)['join']('cm_contacts',null,_0xda66('0x27')+_0x3e4f83+_0xda66('0x30'))[_0xda66('0x14')](_0x4f1fdd,null,_0x4f1fdd+_0xda66('0x31')+_0x3e4f83+'.'+_0x52c387)[_0xda66('0x13')](_0x3e4f83+_0xda66('0x28'),_0x304921)[_0xda66('0x13')](_0xda66('0x29'),NOW)[_0xda66('0x13')](_0xda66('0x2a'),squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0xda66('0x32'))['where']('ListId\x20=\x20?',_0x304921)[_0xda66('0x13')](_0x52c387+_0xda66('0x33'),_0x3e4f83+'.'+_0x52c387)))[_0xda66('0x2d')]();}function insertTzCmHopper(_0x307873,_0x22a9ca,_0x391e17,_0x29cfcf,_0x2da5b5,_0x26dfbd){var _0xd65d4c=[_0xda66('0x15'),_0xda66('0x34')+_0x26dfbd+_0xda66('0x35'),_0xda66('0x2e'),_0xda66('0x17'),_0x22a9ca+'.'+_0x29cfcf,_0xda66('0x18'),_0xda66('0x36'),_0xda66('0x19'),_0xda66('0x1a'),'\x22'+_0x2da5b5+'\x22'];var _0x800af2=squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x1d'))[_0xda66('0x1e')]([_0xda66('0x11'),'scheduledat',_0xda66('0x2f'),_0xda66('0x20'),_0x29cfcf,'createdAt',_0xda66('0x21'),'priority',_0xda66('0x23'),_0xda66('0x24')],squel[_0xda66('0xf')]()[_0xda66('0x25')](_0xd65d4c)['from'](_0x22a9ca)[_0xda66('0x14')](_0xda66('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x22a9ca+_0xda66('0x30'))[_0xda66('0x14')](_0x391e17,null,_0x391e17+_0xda66('0x31')+_0x22a9ca+'.'+_0x29cfcf)[_0xda66('0x14')](_0x26dfbd,null,_0x26dfbd+_0xda66('0x31')+_0x22a9ca+'.'+_0x29cfcf)['where'](_0x22a9ca+_0xda66('0x28'),_0x307873)['where'](_0xda66('0x29'),NOW)[_0xda66('0x13')](_0xda66('0x2a'),selectNotIn(_0x22a9ca,_0x391e17,_0x29cfcf,_0xda66('0x1d'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xda66('0x13')](_0xda66('0x2a'),selectNotIn(_0x22a9ca,_0x391e17,_0x29cfcf,_0xda66('0x1d'),[_0xda66('0x2b')])))['toString']();return _0x800af2;}function insertTzCmHopperBlack(_0x57e39b,_0x42c152,_0x17193e,_0x1cea17){var _0x2833be=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x42c152+'.'+_0x1cea17,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xda66('0x1b')]()[_0xda66('0x1c')](_0xda66('0x32'))[_0xda66('0x1e')]([_0xda66('0x11'),_0xda66('0x2f'),_0xda66('0x20'),_0x1cea17,_0xda66('0x37'),_0xda66('0x21')],squel[_0xda66('0xf')]()['fields'](_0x2833be)['from'](_0x42c152)[_0xda66('0x14')](_0xda66('0x26'),null,_0xda66('0x27')+_0x42c152+_0xda66('0x30'))[_0xda66('0x14')](_0x17193e,null,_0x17193e+_0xda66('0x31')+_0x42c152+'.'+_0x1cea17)[_0xda66('0x13')](_0x42c152+_0xda66('0x28'),_0x57e39b)[_0xda66('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xda66('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xda66('0xf')]()[_0xda66('0x10')](_0xda66('0x11'))[_0xda66('0x12')](_0xda66('0x32'))[_0xda66('0x13')](_0xda66('0x38'),_0x57e39b)[_0xda66('0x13')](_0x1cea17+_0xda66('0x33'),_0x42c152+'.'+_0x1cea17)))[_0xda66('0x2d')]();}function insertCmContact(_0x39765a,_0x1afe28,_0x2cff05,_0x436c5f){var _0x15fa08=_['concat'](_[_0xda66('0x39')](_0x436c5f),[_0xda66('0x20'),_0xda66('0x3a'),_0xda66('0x37'),_0xda66('0x21')]);return squel[_0xda66('0x1b')]()[_0xda66('0x1c')]('cm_contacts')[_0xda66('0x1e')](_0x15fa08,squel[_0xda66('0xf')]()['fields'](_0x15fa08)['from'](_0x1afe28)[_0xda66('0x13')]('('+_0x2cff05['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xda66('0xf')]()['fields'](_0x2cff05)[_0xda66('0x12')](_0xda66('0x26'))[_0xda66('0x13')](_0xda66('0x38'),_0x39765a)[_0xda66('0x13')]('deletedAt\x20IS\x20NULL'))[_0xda66('0x13')](_0xda66('0x3b'),squel['select']()[_0xda66('0x10')](_0xda66('0x3c'),_0xda66('0x3d'))[_0xda66('0x12')](_0x1afe28)[_0xda66('0x3e')](_0x2cff05['join'](','))))['toString']();}function handleStop(){logger[_0xda66('0x3f')](_0xda66('0x40'));stopped=!![];}function handleUncaughtException(_0x1cacea){logger[_0xda66('0x41')](_0x1cacea['message']);process[_0xda66('0x42')](0x1);}function handleError(_0xc7e10b,_0x572ef6){stats['errors'][_0xda66('0x43')]({'name':_0x572ef6[_0xda66('0x44')],'message':_0x572ef6[_0xda66('0x45')],'row':_0xc7e10b});}function handleQuery(_0x842529){logger[_0xda66('0x3f')](_0x842529);return db[_0xda66('0x46')][_0xda66('0x47')](_0x842529)[_0xda66('0x48')](function(_0x20ceaf){results[_0xda66('0x43')](_0x20ceaf);})['catch'](function(_0x39995b){logger[_0xda66('0x41')](_0x39995b[_0xda66('0x45')]);});}function updateTzCampaigns(_0xbc1d58){return new Promise(function(_0x54f7c3,_0x281fa9){var _0xdcc283=squel['select']()[_0xda66('0x25')](['campaigns.id',_0xda66('0x49')])[_0xda66('0x12')](_0xda66('0x4a'))[_0xda66('0x14')](_0xda66('0x4b'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0xda66('0x4c')+_0xbc1d58);db[_0xda66('0x46')]['query'](_0xdcc283[_0xda66('0x2d')]())[_0xda66('0x48')](function(_0x3490ee){var _0x5afd93=[];for(var _0x18234f=0x0;_0x18234f<_0x3490ee[_0xda66('0x4d')];_0x18234f++){_0x5afd93['push'](getTimezoneData(_0x3490ee[_0x18234f],tmp_campaigns));}BPromise[_0xda66('0x4e')](_0x5afd93)['then'](function(){_0x54f7c3({'val':0x1});});})[_0xda66('0x4f')](function(_0x15a155){logger[_0xda66('0x41')](_0x15a155[_0xda66('0x45')]);_0x54f7c3({'val':0x0});});});}function updateTzVoiceQueues(_0x2e1138){return new Promise(function(_0x4e8255,_0x4e1937){var _0x2ec57a=squel[_0xda66('0xf')]()[_0xda66('0x25')](['voice_queues.id',_0xda66('0x50')])[_0xda66('0x12')](_0xda66('0x51'))[_0xda66('0x14')](_0xda66('0x52'),null,_0xda66('0x53'))[_0xda66('0x13')](_0xda66('0x54')+_0x2e1138);db['sequelize']['query'](_0x2ec57a[_0xda66('0x2d')]())[_0xda66('0x48')](function(_0x2d84ef){var _0x200800=[];for(var _0x55ef28=0x0;_0x55ef28<_0x2d84ef[_0xda66('0x4d')];_0x55ef28++){_0x200800['push'](getTimezoneData(_0x2d84ef[_0x55ef28],tmp_voice_queues));}BPromise[_0xda66('0x4e')](_0x200800)[_0xda66('0x55')](function(){_0x4e8255({'val':0x1});});})[_0xda66('0x4f')](function(_0x48ac14){logger[_0xda66('0x41')](_0x48ac14[_0xda66('0x45')]);_0x4e8255({'val':0x0});});});}function getTimezoneData(_0x19781e,_0x1119bb){return new Promise(function(_0x4332ff,_0x314741){var _0x59487b=shared[_0xda66('0x56')];var _0x2aa37f=_0x59487b[_0x19781e[_0xda66('0x57')]];if(_[_0xda66('0x58')](_0x2aa37f)){_0x4332ff({'ret':0x1});}else{var _0x1db818=_0x2aa37f[_0xda66('0x59')];var _0x4457f8=squel['insert']()[_0xda66('0x1c')](_0x1119bb)[_0xda66('0x5a')]('id',_0x19781e['id'])[_0xda66('0x5a')](_0xda66('0x5b'),_0x1db818)[_0xda66('0x5a')](_0xda66('0x57'),_0x19781e[_0xda66('0x57')])[_0xda66('0x2d')]();return db[_0xda66('0x46')][_0xda66('0x47')](_0x4457f8)[_0xda66('0x48')](function(_0x13411a){_0x4332ff({'ret':0x1});})[_0xda66('0x4f')](function(_0x1aa11c){logger[_0xda66('0x41')](_0x1aa11c[_0xda66('0x45')]);_0x314741({'ret':0x1});});}});}function handleTZQuery(_0x26cdd7){logger[_0xda66('0x3f')](_0x26cdd7);return db[_0xda66('0x46')][_0xda66('0x47')](_0x26cdd7)[_0xda66('0x48')](function(_0x160f7d){})[_0xda66('0x4f')](function(_0x3156ad){logger[_0xda66('0x41')](_0x3156ad[_0xda66('0x45')]);});}function main(_0x1fed52,_0x2b73ac,_0x37b50f,_0x5a60ed){logger[_0xda66('0x3f')](_0xda66('0x5c'),_0x1fed52,JSON[_0xda66('0x5d')](_0x2b73ac));process[_0xda66('0x5e')](_0xda66('0x5f'));var _0x857ed0=_0x2b73ac[_0xda66('0x60')];var _0xe0c439=_0x2b73ac[_0xda66('0x61')];var _0x3cccd3=path[_0xda66('0x14')](config[_0xda66('0x62')],'server/files/tmp',_0xe0c439+_0xda66('0x63'));hasTZ=_[_0xda66('0x39')](_0x857ed0)[_0xda66('0x64')]('dialTimezone');var _0x46caf0=_[_0xda66('0x39')](_0x857ed0)['join']();logger[_0xda66('0x3f')](_0xda66('0x65'),_0x46caf0);if(hasTZ)_0x46caf0+=_0xda66('0x66');fs[_0xda66('0x67')](_0x3cccd3,_0x46caf0+'\x0a');Papa[_0xda66('0x68')](fs['createReadStream'](_0x1fed52),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5111be,_0x247895){try{for(var _0x408bfd=0x0,_0x4561d4=[];_0x408bfd<_0x5111be['data'][_0xda66('0x4d')];_0x408bfd++){stats[_0xda66('0x69')]+=0x1;if(_0x5111be[_0xda66('0x6a')][_0x408bfd]){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],_0x5111be[_0xda66('0x6a')][_0x408bfd]);}else{var _0x4a9101=[];for(var _0x5ed874 in _0x857ed0){if(_0x857ed0[_0xda66('0x6c')](_0x5ed874)){if(_0x5111be[_0xda66('0x6b')][_0x408bfd][_0x857ed0[_0x5ed874]]){var _0x4bde1a=_[_0xda66('0x6d')](_0x5111be[_0xda66('0x6b')][_0x408bfd][_0x857ed0[_0x5ed874]][_0xda66('0x6e')](/"/g,'\x27'));switch(_0x5ed874){case _0xda66('0x1f'):var _0x47cc49=moment(_0x4bde1a,_0xda66('0xe'),!![]);if(_0x47cc49[_0xda66('0x6f')]()){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x70'));}break;case _0xda66('0x22'):var _0x35d89c=parseInt(_0x4bde1a);_0x4bde1a=_[_0xda66('0x71')](_0x35d89c)||_0x35d89c<0x0||_0x35d89c>0x4?_0x5a60ed?0x3:0x2:_0x35d89c;_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');break;case _0xda66('0x23'):var _0x9badfa=parseInt(_0x4bde1a);if(_[_0xda66('0x72')](_0x9badfa)&&_[_0xda66('0x64')](_0x37b50f,_0x9badfa)){_0x4561d4[_0xda66('0x43')]('\x22'+_0x9badfa+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x73'));}break;case _0xda66('0x74'):if(isEmail(_0x4bde1a)){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101['push'](_0xda66('0x75'));}break;case _0xda66('0x76'):var _0x5231d0=moment(_0x4bde1a,_0xda66('0x77'),!![]);if(_0x5231d0[_0xda66('0x6f')]()){_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}else{_0x4a9101[_0xda66('0x43')](_0xda66('0x78'));}break;case'dialTimezone':var _0x4d765d=shared[_0xda66('0x56')];var _0x3063bd=_0x4d765d[_0x4bde1a];if(!_[_0xda66('0x58')](_0x3063bd)){var _0x284957=_0x3063bd[_0xda66('0x59')];_0x4561d4['push']('\x22'+_0x4bde1a+'\x22');_0x4561d4[_0xda66('0x43')]('\x22'+_0x284957+'\x22');}break;default:_0x4561d4[_0xda66('0x43')]('\x22'+_0x4bde1a+'\x22');}}else{switch(_0x5ed874){case _0xda66('0x79'):case _0xda66('0x11'):_0x4a9101['push'](_0x5ed874+_0xda66('0x7a'));break;default:_0x4561d4[_0xda66('0x43')]('\x22\x22');}}}}if(_0x4a9101['length']){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],{'code':_0xda66('0x7b'),'message':_0x4a9101['join']()});}else{fs[_0xda66('0x7c')](_0x3cccd3,_0x4561d4['join']()+'\x0a');}_0x4561d4=[];}if(!(stats[_0xda66('0x69')]%0xc8)){socket['emit'](_0xda66('0x7d')+_0xe0c439,stats);stats[_0xda66('0x6a')]=[];}}if(stopped){logger['info'](_0xda66('0x7e'));_0x247895['abort']();}}catch(_0xf0c894){handleError(_0x5111be[_0xda66('0x6b')][_0x408bfd],{'code':_0xda66('0x7f'),'message':_0xf0c894[_0xda66('0x45')]});logger['error'](_0xda66('0x80'),_0xf0c894['message']);}},'complete':function(){try{var _0x216c2c=[];var _0x149240=[];var _0x3857a2=_0xda66('0x26');if(_0x2b73ac['duplicates']&&_0x2b73ac[_0xda66('0x81')]['length']){_0x3857a2=_0xda66('0x82')+_0xe0c439;_0x216c2c['push'](_0xda66('0x83')+_0x3857a2+_0xda66('0x84'));}tmp_campaigns=_0xda66('0x85')+_0xe0c439;tmp_voice_queues='voice_queues_'+_0xe0c439;_0x149240[_0xda66('0x43')](_0xda66('0x83')+tmp_campaigns+_0xda66('0x86'));_0x149240[_0xda66('0x43')](_0xda66('0x83')+tmp_voice_queues+_0xda66('0x86'));BPromise[_0xda66('0x87')](_0x149240,handleTZQuery)['then'](function(_0x24cae2){updateTzCampaigns(_0x2b73ac['ListId'])[_0xda66('0x55')](function(_0x33e286){updateTzVoiceQueues(_0x2b73ac[_0xda66('0x20')])['then'](function(_0x32c228){var _0x5de96c=util['format'](_0xda66('0x88'),_0x3cccd3,_0x3857a2,_0x46caf0,_0x2b73ac[_0xda66('0x20')],_0x2b73ac[_0xda66('0x3a')]||null,NOW,NOW);if(_[_0xda66('0x58')](_0x857ed0[_0xda66('0x1f')])){_0x5de96c+=_0xda66('0x89');}_0x216c2c[_0xda66('0x43')](_0x5de96c);if(_0x2b73ac[_0xda66('0x81')]&&_0x2b73ac[_0xda66('0x81')]['length']){_0x216c2c['push'](insertCmContact(_0x2b73ac[_0xda66('0x20')],_0x3857a2,_0x2b73ac[_0xda66('0x81')],_0x857ed0));_0x216c2c[_0xda66('0x43')]('DROP\x20TABLE\x20'+_0x3857a2+';');}if(hasTZ){_0x216c2c[_0xda66('0x43')](insertTzCmHopper(_0x2b73ac[_0xda66('0x20')],'voice_queues_has_cm_lists','voice_queues','VoiceQueueId',_0x5a60ed,tmp_voice_queues));_0x216c2c[_0xda66('0x43')](insertTzCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8a'),_0xda66('0x51'),_0xda66('0x8b')));_0x216c2c[_0xda66('0x43')](insertTzCmHopper(_0x2b73ac[_0xda66('0x20')],_0xda66('0x4b'),_0xda66('0x4a'),'CampaignId',_0x5a60ed,tmp_campaigns));_0x216c2c['push'](insertTzCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8c'),_0xda66('0x4a'),'CampaignId'));}else{_0x216c2c[_0xda66('0x43')](insertCmHopper(_0x2b73ac['ListId'],_0xda66('0x52'),'voice_queues',_0xda66('0x8b'),_0x5a60ed));_0x216c2c[_0xda66('0x43')](insertCmHopperBlack(_0x2b73ac[_0xda66('0x20')],_0xda66('0x8a'),_0xda66('0x51'),_0xda66('0x8b')));_0x216c2c[_0xda66('0x43')](insertCmHopper(_0x2b73ac[_0xda66('0x20')],'campaigns_has_cm_lists',_0xda66('0x4a'),_0xda66('0x8d'),_0x5a60ed));_0x216c2c['push'](insertCmHopperBlack(_0x2b73ac[_0xda66('0x20')],'campaigns_has_cm_blacklists',_0xda66('0x4a'),_0xda66('0x8d')));}_0x216c2c[_0xda66('0x43')](_0xda66('0x8e')+tmp_campaigns+';');_0x216c2c[_0xda66('0x43')](_0xda66('0x8e')+tmp_voice_queues+';');BPromise['each'](_0x216c2c,handleQuery)['then'](function(_0x11f111){stats[_0xda66('0x8f')]=!![];stats[_0xda66('0x90')]=_0x2b73ac['duplicates']&&_0x2b73ac['duplicates'][_0xda66('0x4d')]?results[0x2][_0xda66('0x90')]:results[0x0][_0xda66('0x90')];socket[_0xda66('0x91')]('contact:import:'+_0xe0c439,stats);fs['unlink'](_0x1fed52);fs[_0xda66('0x92')](_0x3cccd3);process[_0xda66('0x42')](0x0);})['catch'](function(_0x9eee63){logger[_0xda66('0x41')](_0x9eee63['message']);process[_0xda66('0x42')](0x1);});});});});}catch(_0x225c42){logger[_0xda66('0x41')](_0xda66('0x93'),_0x225c42[_0xda66('0x45')]);process[_0xda66('0x42')](0x1);}},'error':function(_0x32e78d,_0x56d1d0,_0x59c931,_0x5a7ebd){throw new Error(_0x5a7ebd);}});}function validate(){if(process['argv']&&process[_0xda66('0x94')][_0xda66('0x4d')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x2e4f23=path[_0xda66('0x14')](config[_0xda66('0x62')],_0xda66('0x95'),process['argv'][0x2]);if(!fs['existsSync'](_0x2e4f23)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x62aacd={};try{_0x62aacd=JSON[_0xda66('0x68')](process[_0xda66('0x94')][0x3]);if(!_0x62aacd['binding']){throw new Error(_0xda66('0x96'));}if(!_0x62aacd[_0xda66('0x60')][_0xda66('0x11')]){throw new Error(_0xda66('0x97'));}if(!_0x62aacd['binding'][_0xda66('0x79')]){throw new Error(_0xda66('0x98'));}var _0x2c56e7=0x0;if(_0x62aacd[_0xda66('0x60')][_0xda66('0x23')]){_0x2c56e7=0x1;}if(!_0x62aacd['ListId']){throw new Error(_0xda66('0x99'));}}catch(_0x1b356a){throw new Error(_0xda66('0x9a'));}var _0x4dce2e=[];try{_0x4dce2e=_['map'](JSON[_0xda66('0x68')](process[_0xda66('0x94')][0x4]),'id');}catch(_0x4b6f4f){logger[_0xda66('0x3f')](_0xda66('0x9b'));}main(_0x2e4f23,_0x62aacd,_0x4dce2e,_0x2c56e7);}validate();process['on'](_0xda66('0x9c'),handleStop);process['on'](_0xda66('0x9d'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 778a1fa..ae62715 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 _0x0cdb=['Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','outbound','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','holdtime','Talk\x20Time','talktime','Member\x20Name','Date','answertime','Complete\x20Time','endtime','Duration','duration'];(function(_0x3d11be,_0x1b9a8c){var _0x4b657b=function(_0x4a96f2){while(--_0x4a96f2){_0x3d11be['push'](_0x3d11be['shift']());}};_0x4b657b(++_0x1b9a8c);}(_0x0cdb,0x119));var _0xb0cd=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x0cdb[_0x582d0b];return _0x2e93e1;};'use strict';exports['getSubjects']=function(_0x189f96,_0x5bd135){var _0xec954=[{'type':_0xb0cd('0x0'),'content':_0xb0cd('0x1'),'variableName':null}];switch(_0x189f96[_0xb0cd('0x2')]()){case'voice':switch(_0x5bd135[_0xb0cd('0x2')]()){case _0xb0cd('0x3'):_0xec954[_0xb0cd('0x4')]({'type':_0xb0cd('0x5'),'content':'','variableName':_0xb0cd('0x6')});_0xec954[_0xb0cd('0x4')]({'type':_0xb0cd('0x5'),'content':'','variableName':'calleridnum'});break;case _0xb0cd('0x7'):_0xec954[_0xb0cd('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0xec954[_0xb0cd('0x4')]({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0xec954;};exports[_0xb0cd('0x8')]=function(_0x3f99aa,_0x165795){var _0x55c8fb=[];switch(_0x3f99aa[_0xb0cd('0x2')]()){case _0xb0cd('0x9'):switch(_0x165795['toLowerCase']()){case'inbound':_0x55c8fb=[{'type':_0xb0cd('0x0'),'content':_0xb0cd('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0xc'),'keyType':_0xb0cd('0x5'),'variableName':'calleridnum'},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0xd'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0xe')},{'type':_0xb0cd('0xb'),'content':'','key':'Call\x20To','keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0xf')},{'type':'keyValue','content':'','key':_0xb0cd('0x10'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x6')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x11'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x12')},{'type':_0xb0cd('0xb'),'content':'','key':'Date','keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x13')},{'type':_0xb0cd('0x0'),'content':_0xb0cd('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0xb0cd('0xb'),'content':'','key':'Agent\x20Name','keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x15')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x16'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x17')},{'type':_0xb0cd('0x0'),'content':_0xb0cd('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb0cd('0x19'),'keyType':'variable','variableName':_0xb0cd('0x13')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x1a'),'keyType':_0xb0cd('0x5'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xb0cd('0x1b'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x1c')},{'type':_0xb0cd('0xb'),'content':'','key':'Hold\x20Time','keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x1d')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x1e'),'keyType':_0xb0cd('0x5'),'variableName':_0xb0cd('0x1f')}];break;case _0xb0cd('0x7'):_0x55c8fb=[{'type':_0xb0cd('0x0'),'content':_0xb0cd('0xa'),'variableName':null},{'type':_0xb0cd('0xb'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xb0cd('0x17')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x20'),'keyType':_0xb0cd('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x11'),'keyType':_0xb0cd('0x5'),'keyContent':'','variableName':_0xb0cd('0x12')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x21'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0xb0cd('0x0'),'content':_0xb0cd('0x18')},{'type':_0xb0cd('0xb'),'content':'','key':'Answer\x20Time','keyType':_0xb0cd('0x5'),'keyContent':'','variableName':_0xb0cd('0x22')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x23'),'keyType':_0xb0cd('0x5'),'keyContent':'','variableName':_0xb0cd('0x24')},{'type':'keyValue','content':'','key':_0xb0cd('0x25'),'keyType':'variable','keyContent':'','variableName':_0xb0cd('0x26')},{'type':_0xb0cd('0xb'),'content':'','key':_0xb0cd('0x27'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x55c8fb;}; \ No newline at end of file +var _0xdb6e=['Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','holdtime','talktime'];(function(_0x1aebde,_0x548787){var _0x2cec9c=function(_0x194e9e){while(--_0x194e9e){_0x1aebde['push'](_0x1aebde['shift']());}};_0x2cec9c(++_0x548787);}(_0xdb6e,0x137));var _0xedb6=function(_0x3b9aa6,_0x3f0c03){_0x3b9aa6=_0x3b9aa6-0x0;var _0x12a0a9=_0xdb6e[_0x3b9aa6];return _0x12a0a9;};'use strict';exports[_0xedb6('0x0')]=function(_0x3aee2b,_0x3991e8){var _0x5dbd8f=[{'type':_0xedb6('0x1'),'content':_0xedb6('0x2'),'variableName':null}];switch(_0x3aee2b['toLowerCase']()){case _0xedb6('0x3'):switch(_0x3991e8[_0xedb6('0x4')]()){case _0xedb6('0x5'):_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x7'),'content':'','variableName':_0xedb6('0x8')});_0x5dbd8f['push']({'type':'variable','content':'','variableName':_0xedb6('0x9')});break;case _0xedb6('0xa'):_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5dbd8f[_0xedb6('0x6')]({'type':_0xedb6('0x7'),'content':'','variableName':_0xedb6('0xb')});break;}}return _0x5dbd8f;};exports[_0xedb6('0xc')]=function(_0x42e2f6,_0x538fde){var _0x58e342=[];switch(_0x42e2f6['toLowerCase']()){case _0xedb6('0x3'):switch(_0x538fde[_0xedb6('0x4')]()){case _0xedb6('0x5'):_0x58e342=[{'type':'string','content':_0xedb6('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0xf'),'keyType':_0xedb6('0x7'),'variableName':'calleridnum'},{'type':'keyValue','content':'','key':_0xedb6('0x10'),'keyType':'variable','variableName':_0xedb6('0x11')},{'type':'keyValue','content':'','key':_0xedb6('0x12'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x13')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x14'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0xedb6('0x15'),'keyType':'variable','variableName':_0xedb6('0x16')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x17'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x18')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xedb6('0x19')},{'type':'keyValue','content':'','key':_0xedb6('0x1a'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0xb')},{'type':_0xedb6('0x1'),'content':_0xedb6('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x1c'),'keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x18')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x1d'),'keyType':_0xedb6('0x7'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xedb6('0x1e'),'keyType':_0xedb6('0x7'),'variableName':'agentcompleteAt'},{'type':_0xedb6('0xe'),'content':'','key':'Hold\x20Time','keyType':'variable','variableName':_0xedb6('0x1f')},{'type':_0xedb6('0xe'),'content':'','key':'Talk\x20Time','keyType':_0xedb6('0x7'),'variableName':_0xedb6('0x20')}];break;case _0xedb6('0xa'):_0x58e342=[{'type':_0xedb6('0x1'),'content':_0xedb6('0xd'),'variableName':null},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x21'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0xb')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x22'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x15'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x16')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x17'),'keyType':'variable','keyContent':'','variableName':_0xedb6('0x23')},{'type':_0xedb6('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x24'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x25')},{'type':_0xedb6('0xe'),'content':'','key':_0xedb6('0x26'),'keyType':'variable','keyContent':'','variableName':_0xedb6('0x27')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x28')},{'type':'keyValue','content':'','key':_0xedb6('0x29'),'keyType':_0xedb6('0x7'),'keyContent':'','variableName':_0xedb6('0x2a')}];break;}}return _0x58e342;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 1fb57d0..989cfe8 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 _0x241f=['Interaction','findOne','then','info','error','tracked','query','body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null'];(function(_0x3fa163,_0x13729c){var _0x4f99a4=function(_0x5f1018){while(--_0x5f1018){_0x3fa163['push'](_0x3fa163['shift']());}};_0x4f99a4(++_0x13729c);}(_0x241f,0x1e8));var _0xf241=function(_0x12a62c,_0xc9c41a){_0x12a62c=_0x12a62c-0x0;var _0x268a58=_0x241f[_0x12a62c];return _0x268a58;};'use strict';var _=require(_0xf241('0x0'));var db=require(_0xf241('0x1'))['db'];var loggers={'openchannel':require(_0xf241('0x2'))(_0xf241('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xf241('0x2'))('fax-interactions'),'sms':require(_0xf241('0x2'))(_0xf241('0x4')),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0xf241('0x5'))};function getInteractionId(_0x229fb9,_0x374573,_0x55c8a8){if(_0x229fb9&&_0x229fb9[_[_0xf241('0x6')](_0x55c8a8)+_0xf241('0x7')]){return _0x229fb9[_['upperFirst'](_0x55c8a8)+_0xf241('0x7')];}else if(_0x229fb9&&_0x229fb9['id']){return _0x229fb9['id'];}else if(_0x374573&&_0x374573['id']){return _0x374573['id'];}else{return _0xf241('0x8');}}function log(_0x4b9cd2,_0x16fc41,_0x2430c6,_0x2c166f,_0x2e910c,_0x5f2ad9){loggers[_0x2e910c[_0xf241('0x9')]()][_0x4b9cd2](_0xf241('0xa'),_0x5f2ad9[_0xf241('0xb')](),_0x16fc41?_0x16fc41['id']:null,_0x16fc41?_0x16fc41[_0xf241('0xc')]:null,_0x16fc41?_0x16fc41[_0xf241('0xd')]:null,getInteractionId(_0x2430c6,_0x2c166f,_0x2e910c),_0x2430c6?JSON[_0xf241('0xe')](_0x2430c6):_0xf241('0xf'));}function updateUser(_0x4b8cd2,_0x313013,_0x3f52a0,_0xe28e71,_0x31ef62){db[_['upperFirst'](_0xe28e71)+_0xf241('0x10')][_0xf241('0x11')]({'where':{'id':getInteractionId(_0x313013,_0x3f52a0,_0xe28e71)}})[_0xf241('0x12')](function(_0xc7ad33){if(_0xc7ad33){return _0xc7ad33['update']({'UserId':_0x4b8cd2?_0x4b8cd2['id']:null});}})['then'](function(_0x44ff9c){if(_0x44ff9c){log(_0xf241('0x13'),_0x4b8cd2,_0x313013,_0x3f52a0,_0xe28e71,_0x31ef62);}})['catch'](function(){log(_0xf241('0x14'),_0x4b8cd2,_0x313013,_0x3f52a0,_0xe28e71,_0x31ef62);});}exports[_0xf241('0x15')]=function(_0x23b6d9,_0x364ed2){return function(_0x223d1f,_0x48dd49,_0x42c209){var _0x3271d4=_0x223d1f['user'];var _0x3f997a={};var _0x1226a8=_0x223d1f[_0xf241('0x16')];if(_0x3f997a){_0x3f997a=_['clone'](_0x223d1f['body']);_0x3f997a=_['omit'](_0x3f997a,[_0xf241('0x17'),_0xf241('0x18'),_0xf241('0x19'),_0xf241('0x1a'),_0xf241('0x1b')]);}updateUser(_0x3271d4,_0x3f997a,_0x1226a8,_0x23b6d9,_0x364ed2);_0x42c209(null);};}; \ No newline at end of file +var _0x3280=['fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','Interaction','findOne','info','catch','error','tracked','user','query','clone','body','html','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x204575,_0x4011a6){var _0x44825f=function(_0x2bff5a){while(--_0x2bff5a){_0x204575['push'](_0x204575['shift']());}};_0x44825f(++_0x4011a6);}(_0x3280,0x83));var _0x0328=function(_0x234732,_0x2dc38b){_0x234732=_0x234732-0x0;var _0xed5bc7=_0x3280[_0x234732];return _0xed5bc7;};'use strict';var _=require(_0x0328('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x0328('0x1'))(_0x0328('0x2')),'mail':require('../../config/logger')(_0x0328('0x3')),'fax':require(_0x0328('0x1'))(_0x0328('0x4')),'sms':require(_0x0328('0x1'))('sms-interactions'),'chat':require(_0x0328('0x1'))(_0x0328('0x5')),'whatsapp':require('../../config/logger')(_0x0328('0x6'))};function getInteractionId(_0x108e1f,_0x2379df,_0x36e11e){if(_0x108e1f&&_0x108e1f[_[_0x0328('0x7')](_0x36e11e)+_0x0328('0x8')]){return _0x108e1f[_[_0x0328('0x7')](_0x36e11e)+_0x0328('0x8')];}else if(_0x108e1f&&_0x108e1f['id']){return _0x108e1f['id'];}else if(_0x2379df&&_0x2379df['id']){return _0x2379df['id'];}else{return'unknown';}}function log(_0xdd8d36,_0x274a02,_0x2335a9,_0x348558,_0x233d18,_0x5a80a0){loggers[_0x233d18[_0x0328('0x9')]()][_0xdd8d36](_0x0328('0xa'),_0x5a80a0['toUpperCase'](),_0x274a02?_0x274a02['id']:null,_0x274a02?_0x274a02[_0x0328('0xb')]:null,_0x274a02?_0x274a02['role']:null,getInteractionId(_0x2335a9,_0x348558,_0x233d18),_0x2335a9?JSON[_0x0328('0xc')](_0x2335a9):_0x0328('0xd'));}function updateUser(_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910){db[_[_0x0328('0x7')](_0x39f542)+_0x0328('0xe')][_0x0328('0xf')]({'where':{'id':getInteractionId(_0x1adcc8,_0x44ce6b,_0x39f542)}})['then'](function(_0x2b9f03){if(_0x2b9f03){return _0x2b9f03['update']({'UserId':_0x1f0f29?_0x1f0f29['id']:null});}})['then'](function(_0x21a897){if(_0x21a897){log(_0x0328('0x10'),_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910);}})[_0x0328('0x11')](function(){log(_0x0328('0x12'),_0x1f0f29,_0x1adcc8,_0x44ce6b,_0x39f542,_0x3e6910);});}exports[_0x0328('0x13')]=function(_0x490d00,_0x2bbba5){return function(_0xfcef53,_0x3d8c37,_0x257940){var _0x52c85e=_0xfcef53[_0x0328('0x14')];var _0x52312d={};var _0x689fc0=_0xfcef53[_0x0328('0x15')];if(_0x52312d){_0x52312d=_[_0x0328('0x16')](_0xfcef53[_0x0328('0x17')]);_0x52312d=_['omit'](_0x52312d,['body',_0x0328('0x18'),'phone',_0x0328('0x19'),_0x0328('0x1a')]);}updateUser(_0x52c85e,_0x52312d,_0x689fc0,_0x490d00,_0x2bbba5);_0x257940(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 6c96236..971f1c3 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 _0xaf26=['../../mysqldb','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','crypto','util','composable-middleware'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xaf26,0x142));var _0x6af2=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xaf26[_0x30a31e];return _0x170879;};'use strict';var crypto=require(_0x6af2('0x0'));var util=require(_0x6af2('0x1'));var compose=require(_0x6af2('0x2'));var db=require(_0x6af2('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x40c2ad,_0x26a557){if(_0x40c2ad&&_0x26a557){if(_0x26a557[_0x6af2('0x4')]&&_0x26a557['license']){var _0x8f051f=_0x26a557[_0x6af2('0x4')];var _0x1f0db6=_0x26a557['license'];var _0x198a60=_0x8f051f[_0x6af2('0x5')]('-')[0x4];var _0x362115=_0x8f051f[_0x6af2('0x5')]('-')[0x0];var _0x46b310=crypto[_0x6af2('0x6')](_0x6af2('0x7'),util['format'](_0x6af2('0x8'),_0x198a60,_0x8f051f,_0x362115));var _0x506352=_0x46b310[_0x6af2('0x9')](_0x1f0db6,_0x6af2('0xa'),_0x6af2('0xb'));_0x506352+=_0x46b310[_0x6af2('0xc')](_0x6af2('0xb'));var _0x554345=JSON[_0x6af2('0xd')](_0x506352);return _0x554345[_0x6af2('0xe')](_0x40c2ad)?_0x554345[_0x40c2ad]:null;}}return null;}function isLimit(_0x49fb33,_0x2a3279,_0x1678e6,_0x2931f5){var _0x5e3728=_0x2a3279;return compose()[_0x6af2('0xf')](function(_0x497569,_0x3ac6ea,_0x1ad265){return db['License'][_0x6af2('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x6af2('0x11')](function(_0x35ec73){var _0x110ecb=getValueFromLicense(_0x49fb33,_0x35ec73);return _0x110ecb?_0x110ecb:_0x5e3728;})[_0x6af2('0x11')](function(_0xa47a1a){_0x5e3728=_0xa47a1a;return _0x1678e6[_0x6af2('0x12')](_0x2931f5);})['then'](function(_0x9d2ec3){if(_0x9d2ec3>=_0x5e3728){return _0x3ac6ea['status'](0x193)[_0x6af2('0x13')]({'message':util[_0x6af2('0x14')](_0x6af2('0x15'),_0x49fb33)});}_0x1ad265();})[_0x6af2('0x16')](function(_0x45538b){_0x1ad265(_0x45538b);});});}function isUserLimit(){return isLimit(_0x6af2('0x17'),0x1,db[_0x6af2('0x18')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x7e3a=['User','admin','user','isUserLimit','crypto','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users'];(function(_0x2715cf,_0x517bb2){var _0x1bdcb8=function(_0x5dec7b){while(--_0x5dec7b){_0x2715cf['push'](_0x2715cf['shift']());}};_0x1bdcb8(++_0x517bb2);}(_0x7e3a,0xee));var _0xa7e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7e3a[_0x397e5f];return _0x5302b8;};'use strict';var crypto=require(_0xa7e3('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xa7e3('0x1'));function getValueFromLicense(_0x2d4f79,_0x9e8f43){if(_0x2d4f79&&_0x9e8f43){if(_0x9e8f43[_0xa7e3('0x2')]&&_0x9e8f43[_0xa7e3('0x3')]){var _0x540023=_0x9e8f43[_0xa7e3('0x2')];var _0x87d3fc=_0x9e8f43['license'];var _0x3d74dc=_0x540023[_0xa7e3('0x4')]('-')[0x4];var _0x19f7f9=_0x540023[_0xa7e3('0x4')]('-')[0x0];var _0x2db722=crypto[_0xa7e3('0x5')](_0xa7e3('0x6'),util['format'](_0xa7e3('0x7'),_0x3d74dc,_0x540023,_0x19f7f9));var _0x527781=_0x2db722[_0xa7e3('0x8')](_0x87d3fc,_0xa7e3('0x9'),_0xa7e3('0xa'));_0x527781+=_0x2db722[_0xa7e3('0xb')](_0xa7e3('0xa'));var _0x347a07=JSON[_0xa7e3('0xc')](_0x527781);return _0x347a07[_0xa7e3('0xd')](_0x2d4f79)?_0x347a07[_0x2d4f79]:null;}}return null;}function isLimit(_0x533264,_0x411458,_0x612127,_0x40694d){var _0x3582cb=_0x411458;return compose()[_0xa7e3('0xe')](function(_0x40e2ef,_0x345448,_0xc53a94){return db[_0xa7e3('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xa7e3('0x10')](function(_0x1a27e1){var _0x35646b=getValueFromLicense(_0x533264,_0x1a27e1);return _0x35646b?_0x35646b:_0x3582cb;})[_0xa7e3('0x10')](function(_0x1a49c9){_0x3582cb=_0x1a49c9;return _0x612127[_0xa7e3('0x11')](_0x40694d);})[_0xa7e3('0x10')](function(_0x2e77c5){if(_0x2e77c5>=_0x3582cb){return _0x345448[_0xa7e3('0x12')](0x193)['json']({'message':util[_0xa7e3('0x13')](_0xa7e3('0x14'),_0x533264)});}_0xc53a94();})['catch'](function(_0xfe422b){_0xc53a94(_0xfe422b);});});}function isUserLimit(){return isLimit(_0xa7e3('0x15'),0x1,db[_0xa7e3('0x16')],{'where':{'$or':[{'role':_0xa7e3('0x17')},{'role':_0xa7e3('0x18')}]}});}exports[_0xa7e3('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index deffe60..ab1c3a0 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 _0x5421=['>\x20?','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','format','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','and','[$and]','split','length','slice','forEach','shift','match','map','conditions','push','buildExpression','operator','$between','value','includes','$gt','$lte','add','days','castTo','CAST(','field','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','LIKE\x20?','$lt'];(function(_0x4cd685,_0x472697){var _0x37743e=function(_0x238ec8){while(--_0x238ec8){_0x4cd685['push'](_0x4cd685['shift']());}};_0x37743e(++_0x472697);}(_0x5421,0x10c));var _0x1542=function(_0x76faa4,_0x4a8b9c){_0x76faa4=_0x76faa4-0x0;var _0x5cab58=_0x5421[_0x76faa4];return _0x5cab58;};'use strict';var _=require('lodash');var moment=require(_0x1542('0x0'));exports['parseSearch']=function(_0x10c0c4){var _0x4119ef={'conditions':[]};_0x4119ef[_0x1542('0x1')]=_[_0x1542('0x2')](_0x10c0c4,_0x1542('0x3'))?'or':_0x1542('0x4');var _0x5cdc1a=_0x10c0c4['replace'](_0x1542('0x5'),'')['replace'](_0x1542('0x3'),'')[_0x1542('0x6')]('||');for(var _0x1ce0e7=0x0;_0x1ce0e7<_0x5cdc1a[_0x1542('0x7')];_0x1ce0e7++){var _0x11f954=_0x5cdc1a[_0x1ce0e7]['split'](':=');var _0x184dfb=_0x11f954[0x0];var _0x228103=_0x11f954[_0x1542('0x8')](0x1);_0x228103[_0x1542('0x9')](function(_0x335454){var _0x380dfc=_0x335454['split']('[')[_0x1542('0xa')]();var _0x31214c=_0x335454[_0x1542('0xb')](/\[(.*?)\]/g);_0x31214c[_0x1542('0x9')](function(_0x205169){var _0x22cb08=_0x205169[_0x1542('0x6')]('[')['filter'](function(_0x4651fb){return _0x4651fb['indexOf'](']')>-0x1;})[_0x1542('0xc')](function(_0xef4abf){return _0xef4abf[_0x1542('0x6')](']')[0x0];})[0x0];_0x4119ef[_0x1542('0xd')][_0x1542('0xe')]({'field':_0x184dfb,'operator':_0x380dfc,'value':_0x22cb08});});});}return _0x4119ef;};exports[_0x1542('0xf')]=function(_0x52bb73,_0x12228c,_0x13ecad){var _0x313860={};if(_0x12228c==='DATE'){if(_0x13ecad[_0x1542('0x10')]==='$eq'){_0x13ecad['operator']=_0x1542('0x11');_0x13ecad[_0x1542('0x12')]+=','+_0x13ecad[_0x1542('0x12')];}else if(_[_0x1542('0x13')]([_0x1542('0x14'),_0x1542('0x15')],_0x13ecad[_0x1542('0x10')])){_0x13ecad['value']=moment(_0x13ecad[_0x1542('0x12')])[_0x1542('0x16')](0x1,_0x1542('0x17'))['format']('YYYY-MM-DD');}}if(_0x13ecad[_0x1542('0x18')]){_0x12228c=_0x13ecad['castTo'];_0x313860['text']=_0x1542('0x19')+_0x52bb73+'.'+_0x13ecad[_0x1542('0x1a')]+'\x20AS\x20'+_0x13ecad[_0x1542('0x18')]+')\x20'+parseOperator(_0x13ecad[_0x1542('0x10')]);}else{_0x313860['text']=_0x52bb73+'.'+_0x13ecad['field']+'\x20'+parseOperator(_0x13ecad[_0x1542('0x10')]);}if(_[_0x1542('0x13')](['$ne',_0x1542('0x1b')],_0x13ecad['operator']))_0x313860[_0x1542('0x1c')]='('+_0x313860['text']+_0x1542('0x1d')+_0x52bb73+'.'+_0x13ecad[_0x1542('0x1a')]+_0x1542('0x1e');_0x313860[_0x1542('0x12')]=parseValue(_0x12228c,_0x13ecad[_0x1542('0x10')],_0x13ecad[_0x1542('0x12')]);return _0x313860;};function parseOperator(_0x4051ae){var _0x1b7b0e;switch(_0x4051ae){case _0x1542('0x1f'):_0x1b7b0e=_0x1542('0x20');break;case _0x1542('0x1b'):_0x1b7b0e=_0x1542('0x21');break;case'$eq':_0x1b7b0e='=\x20?';break;case'$ne':_0x1b7b0e=_0x1542('0x22');break;case _0x1542('0x23'):case'$startsWith':case'$endsWith':_0x1b7b0e=_0x1542('0x24');break;case _0x1542('0x25'):_0x1b7b0e='<\x20?';break;case _0x1542('0x14'):_0x1b7b0e=_0x1542('0x26');break;case _0x1542('0x15'):_0x1b7b0e=_0x1542('0x27');break;case'$gte':_0x1b7b0e=_0x1542('0x28');break;case _0x1542('0x11'):_0x1b7b0e=_0x1542('0x29');break;}return _0x1b7b0e;}function parseValue(_0x15e4f8,_0x3437f9,_0x144003){var _0x271a27={'start':undefined,'end':undefined};switch(_0x3437f9){case _0x1542('0x1f'):case _0x1542('0x1b'):_0x271a27[_0x1542('0x2a')]=_0x144003[_0x1542('0x6')](',');break;case _0x1542('0x23'):_0x271a27[_0x1542('0x2a')]='%'+_0x144003+'%';break;case'$startsWith':_0x271a27[_0x1542('0x2a')]=_0x144003+'%';break;case _0x1542('0x2b'):_0x271a27[_0x1542('0x2a')]='%'+_0x144003;break;case _0x1542('0x11'):var _0x2b66c1=_0x144003[_0x1542('0x6')](',');var _0x144003=_0x2b66c1[_0x1542('0xa')]();var _0x1776de=_0x2b66c1[_0x1542('0x2c')]();if(_0x15e4f8===_0x1542('0x2d')){_0x144003=moment(_0x144003)[_0x1542('0x2e')](0x0,!![])[_0x1542('0x2f')]();_0x1776de=moment(_0x1776de)[_0x1542('0x2e')](0x0,!![])['add'](0x17,_0x1542('0x30'))[_0x1542('0x16')](0x3b,_0x1542('0x31'))['add'](0x3b,_0x1542('0x32'))[_0x1542('0x2f')]();}_0x271a27={'start':_0x144003,'end':_0x1776de};break;default:_0x271a27['start']=_0x144003;break;}return _0x271a27;} \ No newline at end of file +var _0xa044=['sqlOperator','and','replace','[$and]','split','length','slice','forEach','shift','indexOf','map','conditions','buildExpression','$eq','operator','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$startsWith','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch'];(function(_0x582c64,_0xadba12){var _0x3c906b=function(_0x4a3a82){while(--_0x4a3a82){_0x582c64['push'](_0x582c64['shift']());}};_0x3c906b(++_0xadba12);}(_0xa044,0x1d2));var _0x4a04=function(_0x5ae509,_0x30c3c4){_0x5ae509=_0x5ae509-0x0;var _0x2d6892=_0xa044[_0x5ae509];return _0x2d6892;};'use strict';var _=require(_0x4a04('0x0'));var moment=require('moment');exports[_0x4a04('0x1')]=function(_0x2814b7){var _0x4bd134={'conditions':[]};_0x4bd134[_0x4a04('0x2')]=_['startsWith'](_0x2814b7,'[$or]')?'or':_0x4a04('0x3');var _0x433160=_0x2814b7[_0x4a04('0x4')](_0x4a04('0x5'),'')['replace']('[$or]','')[_0x4a04('0x6')]('||');for(var _0x48fdf3=0x0;_0x48fdf3<_0x433160[_0x4a04('0x7')];_0x48fdf3++){var _0x2427d1=_0x433160[_0x48fdf3][_0x4a04('0x6')](':=');var _0x400ab1=_0x2427d1[0x0];var _0x4c72ea=_0x2427d1[_0x4a04('0x8')](0x1);_0x4c72ea[_0x4a04('0x9')](function(_0xce639c){var _0x44a287=_0xce639c[_0x4a04('0x6')]('[')[_0x4a04('0xa')]();var _0x1b4ab0=_0xce639c['match'](/\[(.*?)\]/g);_0x1b4ab0[_0x4a04('0x9')](function(_0x577143){var _0x184038=_0x577143[_0x4a04('0x6')]('[')['filter'](function(_0x3ae869){return _0x3ae869[_0x4a04('0xb')](']')>-0x1;})[_0x4a04('0xc')](function(_0x3cf8bd){return _0x3cf8bd['split'](']')[0x0];})[0x0];_0x4bd134[_0x4a04('0xd')]['push']({'field':_0x400ab1,'operator':_0x44a287,'value':_0x184038});});});}return _0x4bd134;};exports[_0x4a04('0xe')]=function(_0x23b5bc,_0x3d919b,_0x2e2d24){var _0x437aa4={};if(_0x3d919b==='DATE'){if(_0x2e2d24['operator']===_0x4a04('0xf')){_0x2e2d24[_0x4a04('0x10')]=_0x4a04('0x11');_0x2e2d24[_0x4a04('0x12')]+=','+_0x2e2d24[_0x4a04('0x12')];}else if(_[_0x4a04('0x13')]([_0x4a04('0x14'),'$lte'],_0x2e2d24['operator'])){_0x2e2d24['value']=moment(_0x2e2d24[_0x4a04('0x12')])[_0x4a04('0x15')](0x1,_0x4a04('0x16'))[_0x4a04('0x17')](_0x4a04('0x18'));}}if(_0x2e2d24[_0x4a04('0x19')]){_0x3d919b=_0x2e2d24[_0x4a04('0x19')];_0x437aa4[_0x4a04('0x1a')]='CAST('+_0x23b5bc+'.'+_0x2e2d24['field']+_0x4a04('0x1b')+_0x2e2d24[_0x4a04('0x19')]+')\x20'+parseOperator(_0x2e2d24[_0x4a04('0x10')]);}else{_0x437aa4[_0x4a04('0x1a')]=_0x23b5bc+'.'+_0x2e2d24[_0x4a04('0x1c')]+'\x20'+parseOperator(_0x2e2d24[_0x4a04('0x10')]);}if(_[_0x4a04('0x13')]([_0x4a04('0x1d'),_0x4a04('0x1e')],_0x2e2d24[_0x4a04('0x10')]))_0x437aa4[_0x4a04('0x1a')]='('+_0x437aa4[_0x4a04('0x1a')]+_0x4a04('0x1f')+_0x23b5bc+'.'+_0x2e2d24[_0x4a04('0x1c')]+_0x4a04('0x20');_0x437aa4[_0x4a04('0x12')]=parseValue(_0x3d919b,_0x2e2d24[_0x4a04('0x10')],_0x2e2d24['value']);return _0x437aa4;};function parseOperator(_0x5467b3){var _0x1d21b2;switch(_0x5467b3){case'$in':_0x1d21b2='IN\x20?';break;case _0x4a04('0x1e'):_0x1d21b2=_0x4a04('0x21');break;case _0x4a04('0xf'):_0x1d21b2='=\x20?';break;case _0x4a04('0x1d'):_0x1d21b2=_0x4a04('0x22');break;case _0x4a04('0x23'):case'$startsWith':case _0x4a04('0x24'):_0x1d21b2=_0x4a04('0x25');break;case _0x4a04('0x26'):_0x1d21b2=_0x4a04('0x27');break;case'$gt':_0x1d21b2=_0x4a04('0x28');break;case'$lte':_0x1d21b2='<=\x20?';break;case _0x4a04('0x29'):_0x1d21b2=_0x4a04('0x2a');break;case _0x4a04('0x11'):_0x1d21b2=_0x4a04('0x2b');break;}return _0x1d21b2;}function parseValue(_0x5eb638,_0x50ca60,_0x141fb1){var _0x365727={'start':undefined,'end':undefined};switch(_0x50ca60){case _0x4a04('0x2c'):case'$notIn':_0x365727[_0x4a04('0x2d')]=_0x141fb1[_0x4a04('0x6')](',');break;case _0x4a04('0x23'):_0x365727['start']='%'+_0x141fb1+'%';break;case _0x4a04('0x2e'):_0x365727[_0x4a04('0x2d')]=_0x141fb1+'%';break;case _0x4a04('0x24'):_0x365727[_0x4a04('0x2d')]='%'+_0x141fb1;break;case _0x4a04('0x11'):var _0x8aa7a2=_0x141fb1['split'](',');var _0x141fb1=_0x8aa7a2['shift']();var _0x4e94b3=_0x8aa7a2[_0x4a04('0x2f')]();if(_0x5eb638==='DATE'){_0x141fb1=moment(_0x141fb1)[_0x4a04('0x30')](0x0,!![])[_0x4a04('0x17')]();_0x4e94b3=moment(_0x4e94b3)[_0x4a04('0x30')](0x0,!![])[_0x4a04('0x15')](0x17,_0x4a04('0x31'))[_0x4a04('0x15')](0x3b,_0x4a04('0x32'))[_0x4a04('0x15')](0x3b,_0x4a04('0x33'))[_0x4a04('0x17')]();}_0x365727={'start':_0x141fb1,'end':_0x4e94b3};break;default:_0x365727[_0x4a04('0x2d')]=_0x141fb1;break;}return _0x365727;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index fb3ab65..d36ff90 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 _0xac31=['object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','unset','hasOwnProperty','omit','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','fields','length','nolimit','order','where','pick','filter'];(function(_0x4b5543,_0xf090c){var _0x574e4c=function(_0x1cb20c){while(--_0x1cb20c){_0x4b5543['push'](_0x4b5543['shift']());}};_0x574e4c(++_0xf090c);}(_0xac31,0xca));var _0x1ac3=function(_0x157037,_0x269ffe){_0x157037=_0x157037-0x0;var _0x5638e6=_0xac31[_0x157037];return _0x5638e6;};'use strict';var _=require(_0x1ac3('0x0'));var sequelize=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3086c0){var _0xd6934=['ne'];try{var _0x11dd6d=JSON[_0x1ac3('0x3')](_0x3086c0);var _0x59b42c=Object[_0x1ac3('0x4')](_0x11dd6d)[0x0];return _0xd6934[_0x1ac3('0x5')](_0x59b42c);}catch(_0x4dcc96){return![];}}function getOperatorValue(_0x5ef1b6){var _0xbe22b7=JSON[_0x1ac3('0x3')](_0x5ef1b6);var _0x2bf9b1=Object[_0x1ac3('0x4')](_0xbe22b7)[0x0];var _0x157604=_0xbe22b7[_0x2bf9b1];return{['$'+_0x2bf9b1]:_0x157604};}exports['fields']=function(_0x2d17de){var _0x4d7695=null;if(_0x2d17de){_0x4d7695=_0x2d17de[_0x1ac3('0x6')](',');}return _0x4d7695;};exports[_0x1ac3('0x7')]=function(_0x344674,_0x53500b){var _0xa26c88={};if(!_[_0x1ac3('0x8')](_0x344674)){_[_0x1ac3('0x9')](_0x344674,function(_0x24f0d2,_0x2a8dc7){try{if(_0x53500b){var _0x422d19=_['find'](_0x53500b,{'name':_0x2a8dc7})||{};if(hasSequelizeOperator(_0x24f0d2)){_0xa26c88[_0x2a8dc7]=getOperatorValue(_0x24f0d2);}else if(_0x422d19[_0x1ac3('0xa')]===_0x1ac3('0xb')&&_[_0x1ac3('0xc')](_0x24f0d2)){var _0x2338b9=JSON['parse'](_0x24f0d2);var _0x88ed7c={'$gte':moment(moment(_0x2338b9[_0x1ac3('0xd')])[_0x1ac3('0xe')](_0x1ac3('0xf')))['utc']()[_0x1ac3('0xe')](),'$lte':moment(moment(_0x2338b9[_0x1ac3('0x10')])['format'](_0x1ac3('0xf')))[_0x1ac3('0x11')]()[_0x1ac3('0x12')](0x1,'s')['format']()};_0xa26c88[_0x2a8dc7]=_0x88ed7c;}else if(_0x422d19[_0x1ac3('0x13')]===_0x1ac3('0x14')){_0xa26c88[_0x2a8dc7]=_0x24f0d2;}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}catch(_0x291616){_0xa26c88[_0x2a8dc7]=_0x24f0d2[_0x1ac3('0x6')](',');}});}return _0xa26c88;};exports[_0x1ac3('0x16')]=function(_0x3b7e51){_0x3b7e51=parseInt(_0x3b7e51,0xa);if(!_0x3b7e51||_0x3b7e51<0x0){_0x3b7e51=LIMIT_VALUE;}return _0x3b7e51;};exports[_0x1ac3('0x17')]=function(_0x557076){_0x557076=parseInt(_0x557076,0xa);if(!_0x557076||_0x557076<0x0){_0x557076=0x0;}return _0x557076;};exports[_0x1ac3('0x18')]=function(_0x2ea481){var _0x296abf,_0x257f60=null;if(_0x2ea481){_0x296abf=_0x2ea481['split'](',');_0x257f60=_['map'](_0x296abf,function(_0x2879d8){if(_0x2879d8[_0x1ac3('0x19')]('-')===0x0){return[_0x2879d8===_0x1ac3('0x1a')?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')](_0x1ac3('0x1a')),_0x1ac3('0x1d')):_0x2879d8[_0x1ac3('0x1e')](0x1),_0x1ac3('0x1f')];}else{return[_0x2879d8==='priority'?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')]('priority'),_0x1ac3('0x1d')):_0x2879d8,_0x1ac3('0x20')];}});}return _0x257f60;};exports['omit']=function(_0xf9affb,_0x2f65e8){if(_[_0x1ac3('0x8')](_0xf9affb)){return _0xf9affb;}if(_[_0x1ac3('0x15')](_0xf9affb)){for(var _0x10db3d=0x0;_0x10db3d<_0xf9affb['length'];_0x10db3d+=0x1){_0xf9affb[_0x10db3d]=this['omit'](_0xf9affb[_0x10db3d],_0x2f65e8);}return _0xf9affb;}if(!_['isObject'](_0xf9affb)){return _0xf9affb;}if(_['isString'](_0x2f65e8)){_0x2f65e8=[_0x2f65e8];}if(!_['isArray'](_0x2f65e8)){return _0xf9affb;}for(var _0x3ea482=0x0;_0x3ea482<_0x2f65e8['length'];_0x3ea482+=0x1){_[_0x1ac3('0x21')](_0xf9affb,_0x2f65e8[_0x3ea482]);}for(var _0x3e4a4e in _0xf9affb){if(_0xf9affb[_0x1ac3('0x22')](_0x3e4a4e)){_0xf9affb[_0x3e4a4e]=this[_0x1ac3('0x23')](_0xf9affb[_0x3e4a4e],_0x2f65e8);}}return _0xf9affb;};exports['isNumeric']=function(_0x61441d){return _0x61441d['match'](RegExp(_0x1ac3('0x24')))?!![]:![];};exports[_0x1ac3('0x25')]=function(_0x440aed){return _0x440aed[_0x1ac3('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x1ac3('0x27')]=function(_0xc3f097){var _0x9c17c2=[];_0xc3f097['split'](/[ ,]+/)[_0x1ac3('0x28')](function(_0x3b4c65){_0x3b4c65=_0x3b4c65[_0x1ac3('0x29')](/([^:]")"+/g,'$1');_0x3b4c65='+'+_0x3b4c65+'*';var _0x47437c=/[ `!@#$%^&*()_\-?~]/;if(_0x3b4c65['match'](_0x47437c))_0x3b4c65='\x22'+_0x3b4c65+'\x22';_0x9c17c2[_0x1ac3('0x2a')](_0x3b4c65);});return _0x9c17c2[_0x1ac3('0x2b')]('\x20');};exports[_0x1ac3('0x2c')]=function(_0x294513,_0x204d78,_0x479b42){var _0xbeed18={},_0x760b65={};if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')]){_0x204d78[_0x1ac3('0x2d')]['id']=_0x204d78[_0x1ac3('0x2d')]['$id'];delete _0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')];}_0xbeed18[_0x1ac3('0x2f')]=_[_0x1ac3('0x30')](_0x294513,'name');_0xbeed18[_0x1ac3('0x2d')]=_[_0x1ac3('0x4')](_0x204d78[_0x1ac3('0x2d')]);_0xbeed18[_0x1ac3('0x7')]=_[_0x1ac3('0x31')](_0xbeed18[_0x1ac3('0x2f')],_0xbeed18[_0x1ac3('0x2d')]);_0x760b65[_0x1ac3('0x32')]=_[_0x1ac3('0x31')](_0xbeed18['model'],this[_0x1ac3('0x33')](_0x204d78[_0x1ac3('0x2d')]['fields']));_0x760b65[_0x1ac3('0x32')]=_0x760b65[_0x1ac3('0x32')][_0x1ac3('0x34')]?_0x760b65[_0x1ac3('0x32')]:_0xbeed18[_0x1ac3('0x2f')];if(!_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x22')](_0x1ac3('0x35'))){_0x760b65['limit']=this[_0x1ac3('0x16')](_0x204d78['query'][_0x1ac3('0x16')]);_0x760b65[_0x1ac3('0x17')]=this[_0x1ac3('0x17')](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x17')]);}_0x760b65[_0x1ac3('0x36')]=this['sort'](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x18')]);_0x760b65[_0x1ac3('0x37')]=this['filters'](_[_0x1ac3('0x38')](_0x204d78[_0x1ac3('0x2d')],_0xbeed18['filters']),_0x294513);if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')]){var _0xb4664e=_0x294513;var _0x1b0099=_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')];if(typeof _0x1b0099===_0x1ac3('0x3a')){_0xb4664e=_[_0x1ac3('0x39')](_0x294513,function(_0x48a0a2){return _[_0x1ac3('0x5')](_0x1b0099[_0x1ac3('0x3b')],_0x48a0a2[_0x1ac3('0x13')]);});_0x1b0099=_0x1b0099[_0x1ac3('0x3c')];}_0x760b65[_0x1ac3('0x37')]=_[_0x1ac3('0x3d')](_0x760b65[_0x1ac3('0x37')],{'$or':_['map'](_0xb4664e,function(_0x4edc4d){if(_0x4edc4d[_0x1ac3('0xa')]!==_0x1ac3('0x3e')){if(_0x479b42){return sequelize['where'](sequelize['fn'](_0x1ac3('0x3f'),sequelize[_0x1ac3('0x1c')](_0x4edc4d['name'])),{'$like':sequelize['fn'](_0x1ac3('0x3f'),'%'+_0x204d78['query'][_0x1ac3('0x39')]+'%')});}else{var _0x406f0d={};_0x406f0d[_0x4edc4d[_0x1ac3('0x13')]]={'$like':'%'+_0x204d78[_0x1ac3('0x2d')]['filter']+'%'};return _0x406f0d;}}})});}_0x760b65=_[_0x1ac3('0x3d')]({},_0x760b65,_0x204d78[_0x1ac3('0x40')]);return _0x760b65;}; \ No newline at end of file +var _0xcca7=['filter','columns','value','merge','VIRTUAL','lower','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','find','type','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','name','intersection','model','attributes','hasOwnProperty','offset','order','where'];(function(_0x4f3242,_0x391954){var _0x49844f=function(_0x5ee033){while(--_0x5ee033){_0x4f3242['push'](_0x4f3242['shift']());}};_0x49844f(++_0x391954);}(_0xcca7,0x1aa));var _0x7cca=function(_0x1a43a5,_0x4d1b4c){_0x1a43a5=_0x1a43a5-0x0;var _0x3ff971=_0xcca7[_0x1a43a5];return _0x3ff971;};'use strict';var _=require(_0x7cca('0x0'));var sequelize=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x33db4f){var _0x5cfce5=['ne'];try{var _0x4c311e=JSON[_0x7cca('0x3')](_0x33db4f);var _0x533b00=Object[_0x7cca('0x4')](_0x4c311e)[0x0];return _0x5cfce5[_0x7cca('0x5')](_0x533b00);}catch(_0x2126f7){return![];}}function getOperatorValue(_0x312e98){var _0x1c6c95=JSON[_0x7cca('0x3')](_0x312e98);var _0x5aec51=Object['keys'](_0x1c6c95)[0x0];var _0x937fad=_0x1c6c95[_0x5aec51];return{['$'+_0x5aec51]:_0x937fad};}exports[_0x7cca('0x6')]=function(_0x1aed1b){var _0x1e8cb9=null;if(_0x1aed1b){_0x1e8cb9=_0x1aed1b[_0x7cca('0x7')](',');}return _0x1e8cb9;};exports[_0x7cca('0x8')]=function(_0x20ffa9,_0x2b8b62){var _0x27323a={};if(!_[_0x7cca('0x9')](_0x20ffa9)){_['forOwn'](_0x20ffa9,function(_0x302367,_0x464911){try{if(_0x2b8b62){var _0x275ab2=_[_0x7cca('0xa')](_0x2b8b62,{'name':_0x464911})||{};if(hasSequelizeOperator(_0x302367)){_0x27323a[_0x464911]=getOperatorValue(_0x302367);}else if(_0x275ab2[_0x7cca('0xb')]==='DATE'&&_[_0x7cca('0xc')](_0x302367)){var _0x41e0a2=JSON[_0x7cca('0x3')](_0x302367);var _0x4d0d6d={'$gte':moment(moment(_0x41e0a2['$gte'])[_0x7cca('0xd')](_0x7cca('0xe')))[_0x7cca('0xf')]()[_0x7cca('0xd')](),'$lte':moment(moment(_0x41e0a2[_0x7cca('0x10')])[_0x7cca('0xd')](_0x7cca('0xe')))['utc']()[_0x7cca('0x11')](0x1,'s')['format']()};_0x27323a[_0x464911]=_0x4d0d6d;}else if(_0x275ab2['name']==='uniqueid'){_0x27323a[_0x464911]=_0x302367;}else{_0x27323a[_0x464911]=_[_0x7cca('0x12')](_0x302367)?_0x302367:JSON[_0x7cca('0x3')](_0x302367);}}else{_0x27323a[_0x464911]=_[_0x7cca('0x12')](_0x302367)?_0x302367:JSON[_0x7cca('0x3')](_0x302367);}}catch(_0x44294b){_0x27323a[_0x464911]=_0x302367['split'](',');}});}return _0x27323a;};exports[_0x7cca('0x13')]=function(_0x4fba9e){_0x4fba9e=parseInt(_0x4fba9e,0xa);if(!_0x4fba9e||_0x4fba9e<0x0){_0x4fba9e=LIMIT_VALUE;}return _0x4fba9e;};exports['offset']=function(_0x5d7ac6){_0x5d7ac6=parseInt(_0x5d7ac6,0xa);if(!_0x5d7ac6||_0x5d7ac6<0x0){_0x5d7ac6=0x0;}return _0x5d7ac6;};exports[_0x7cca('0x14')]=function(_0x25297b){var _0x2beb6c,_0x1a20be=null;if(_0x25297b){_0x2beb6c=_0x25297b[_0x7cca('0x7')](',');_0x1a20be=_[_0x7cca('0x15')](_0x2beb6c,function(_0x2e023c){if(_0x2e023c[_0x7cca('0x16')]('-')===0x0){return[_0x2e023c==='priority'?sequelize[_0x7cca('0x17')](sequelize[_0x7cca('0x18')](_0x7cca('0x19')),_0x7cca('0x1a')):_0x2e023c['substr'](0x1),_0x7cca('0x1b')];}else{return[_0x2e023c===_0x7cca('0x19')?sequelize[_0x7cca('0x17')](sequelize[_0x7cca('0x18')](_0x7cca('0x19')),_0x7cca('0x1a')):_0x2e023c,_0x7cca('0x1c')];}});}return _0x1a20be;};exports[_0x7cca('0x1d')]=function(_0x4b99b6,_0xfe121c){if(_[_0x7cca('0x9')](_0x4b99b6)){return _0x4b99b6;}if(_[_0x7cca('0x12')](_0x4b99b6)){for(var _0xdaf07f=0x0;_0xdaf07f<_0x4b99b6[_0x7cca('0x1e')];_0xdaf07f+=0x1){_0x4b99b6[_0xdaf07f]=this[_0x7cca('0x1d')](_0x4b99b6[_0xdaf07f],_0xfe121c);}return _0x4b99b6;}if(!_[_0x7cca('0x1f')](_0x4b99b6)){return _0x4b99b6;}if(_[_0x7cca('0x20')](_0xfe121c)){_0xfe121c=[_0xfe121c];}if(!_['isArray'](_0xfe121c)){return _0x4b99b6;}for(var _0x2cafe1=0x0;_0x2cafe1<_0xfe121c['length'];_0x2cafe1+=0x1){_[_0x7cca('0x21')](_0x4b99b6,_0xfe121c[_0x2cafe1]);}for(var _0x201fbb in _0x4b99b6){if(_0x4b99b6['hasOwnProperty'](_0x201fbb)){_0x4b99b6[_0x201fbb]=this[_0x7cca('0x1d')](_0x4b99b6[_0x201fbb],_0xfe121c);}}return _0x4b99b6;};exports[_0x7cca('0x22')]=function(_0x5533fb){return _0x5533fb[_0x7cca('0x23')](RegExp(_0x7cca('0x24')))?!![]:![];};exports[_0x7cca('0x25')]=function(_0x52fb40){return _0x52fb40['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7cca('0x26')]=function(_0x13d217){var _0x3797f4=[];_0x13d217[_0x7cca('0x7')](/[ ,]+/)[_0x7cca('0x27')](function(_0xe1ee18){_0xe1ee18=_0xe1ee18[_0x7cca('0x28')](/([^:]")"+/g,'$1');_0xe1ee18='+'+_0xe1ee18+'*';var _0x5a2c7c=/[ `!@#$%^&*()_\-?~]/;if(_0xe1ee18['match'](_0x5a2c7c))_0xe1ee18='\x22'+_0xe1ee18+'\x22';_0x3797f4[_0x7cca('0x29')](_0xe1ee18);});return _0x3797f4[_0x7cca('0x2a')]('\x20');};exports[_0x7cca('0x2b')]=function(_0x4f5fd2,_0x2c4f63,_0x4f8e75){var _0x2061fe={},_0x10558a={};if(_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x2d')]){_0x2c4f63['query']['id']=_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x2d')];delete _0x2c4f63[_0x7cca('0x2c')]['$id'];}_0x2061fe['model']=_['map'](_0x4f5fd2,_0x7cca('0x2e'));_0x2061fe[_0x7cca('0x2c')]=_['keys'](_0x2c4f63[_0x7cca('0x2c')]);_0x2061fe[_0x7cca('0x8')]=_[_0x7cca('0x2f')](_0x2061fe[_0x7cca('0x30')],_0x2061fe[_0x7cca('0x2c')]);_0x10558a[_0x7cca('0x31')]=_[_0x7cca('0x2f')](_0x2061fe['model'],this[_0x7cca('0x6')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x6')]));_0x10558a[_0x7cca('0x31')]=_0x10558a['attributes'][_0x7cca('0x1e')]?_0x10558a[_0x7cca('0x31')]:_0x2061fe[_0x7cca('0x30')];if(!_0x2c4f63['query'][_0x7cca('0x32')]('nolimit')){_0x10558a[_0x7cca('0x13')]=this[_0x7cca('0x13')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x13')]);_0x10558a[_0x7cca('0x33')]=this[_0x7cca('0x33')](_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x33')]);}_0x10558a[_0x7cca('0x34')]=this['sort'](_0x2c4f63['query'][_0x7cca('0x14')]);_0x10558a[_0x7cca('0x35')]=this['filters'](_['pick'](_0x2c4f63[_0x7cca('0x2c')],_0x2061fe[_0x7cca('0x8')]),_0x4f5fd2);if(_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x36')]){var _0x371c67=_0x4f5fd2;var _0x4cd159=_0x2c4f63[_0x7cca('0x2c')]['filter'];if(typeof _0x4cd159==='object'){_0x371c67=_[_0x7cca('0x36')](_0x4f5fd2,function(_0x33d069){return _['includes'](_0x4cd159[_0x7cca('0x37')],_0x33d069['name']);});_0x4cd159=_0x4cd159[_0x7cca('0x38')];}_0x10558a[_0x7cca('0x35')]=_[_0x7cca('0x39')](_0x10558a['where'],{'$or':_[_0x7cca('0x15')](_0x371c67,function(_0x207250){if(_0x207250[_0x7cca('0xb')]!==_0x7cca('0x3a')){if(_0x4f8e75){return sequelize['where'](sequelize['fn'](_0x7cca('0x3b'),sequelize[_0x7cca('0x18')](_0x207250[_0x7cca('0x2e')])),{'$like':sequelize['fn'](_0x7cca('0x3b'),'%'+_0x2c4f63[_0x7cca('0x2c')][_0x7cca('0x36')]+'%')});}else{var _0x57f440={};_0x57f440[_0x207250['name']]={'$like':'%'+_0x2c4f63['query']['filter']+'%'};return _0x57f440;}}})});}_0x10558a=_[_0x7cca('0x39')]({},_0x10558a,_0x2c4f63['options']);return _0x10558a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index dcd2626..2e3a157 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(_0x502137,_0x372ad2){var _0x443ecf=function(_0x4baaad){while(--_0x4baaad){_0x502137['push'](_0x502137['shift']());}};_0x443ecf(++_0x372ad2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x11bd02,_0x2d91d1){var _0x262863=function(_0x80104){while(--_0x80104){_0x11bd02['push'](_0x11bd02['shift']());}};_0x262863(++_0x2d91d1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 88d5aed..d7acf9c 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 _0x2046=['win32','dmidecode\x20--string\x20system-uuid','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','digest','hex','platform','licenseToken'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x2046,0xb0));var _0x6204=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2046[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6204('0x0'));var os=require('os');var crypto=require(_0x6204('0x1'));var machine=require(_0x6204('0x2'));var exec=require(_0x6204('0x3'))[_0x6204('0x4')];var config=require(_0x6204('0x5'));function getInterfaces(){var _0xca8696=[];var _0x36ad50=os['networkInterfaces']();var _0x591bc1=_[_0x6204('0x6')](_[_0x6204('0x7')](_0x36ad50));for(var _0x1bb3af=0x0;_0x1bb3af<_0x591bc1['length'];_0x1bb3af++){var _0x40a00c=_0x36ad50[_0x591bc1[_0x1bb3af]][_0x6204('0x8')](function(_0x355f11){return _0x355f11[_0x6204('0x9')]===_0x6204('0xa')&&_0x355f11[_0x6204('0xb')]===![];});_0xca8696=_0xca8696[_0x6204('0xc')](_0x40a00c);}return _0xca8696;}function getFirstInterface(){var _0x5b4c8e=_[_0x6204('0xd')](getInterfaces());return{'macAddress':_0x5b4c8e&&_0x5b4c8e[_0x6204('0xe')]?_0x5b4c8e[_0x6204('0xe')]:_0x6204('0xf'),'ipAddress':_0x5b4c8e&&_0x5b4c8e[_0x6204('0x10')]?_0x5b4c8e['address']:_0x6204('0x11')};}exports[_0x6204('0x12')]=getFirstInterface;function getCPUhash(){var _0x40938c=_['orderBy'](os[_0x6204('0x13')]()[_0x6204('0x14')](function(_0xf173e8){return _0xf173e8[_0x6204('0x15')];}))[_0x6204('0x16')](':');return crypto['createHash'](_0x6204('0x17'))['update'](_0x40938c)[_0x6204('0x18')](_0x6204('0x19'));}exports['getUuid']=function(){var _0x4a88e6=os[_0x6204('0x1a')]();var _0x362194=/[0-9a-f-]{36}/;if(config[_0x6204('0x1b')]&&_0x362194['test'](config[_0x6204('0x1b')])){return config[_0x6204('0x1b')];}else if(_0x4a88e6===_0x6204('0x1c')){return exec(_0x6204('0x1d'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x315705=getFirstInterface();var _0x58526a=getCPUhash();var _0x9edfc1=_0x58526a+'|'+os['hostname']()+'|'+_0x315705[_0x6204('0x1e')]+'|'+_0x315705[_0x6204('0x1f')];var _0x322586=crypto['createHash'](_0x6204('0x17'))[_0x6204('0x20')](_0x9edfc1)[_0x6204('0x18')]('hex');return _0x322586[_0x6204('0x21')](0x0,0x8)+'-'+_0x322586[_0x6204('0x21')](0x8,0xc)+'-'+_0x322586[_0x6204('0x21')](0xc,0x10)+'-'+_0x322586[_0x6204('0x21')](0x10,0x14)+'-'+_0x322586[_0x6204('0x21')](0x14);}}; \ No newline at end of file +var _0xc763=['model','join','update','digest','hex','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','createHash','md5','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','cpus','map'];(function(_0x52c1e0,_0x1d7896){var _0x39acfc=function(_0x4529fb){while(--_0x4529fb){_0x52c1e0['push'](_0x52c1e0['shift']());}};_0x39acfc(++_0x1d7896);}(_0xc763,0x107));var _0x3c76=function(_0x3ab0ea,_0x56dfec){_0x3ab0ea=_0x3ab0ea-0x0;var _0x554187=_0xc763[_0x3ab0ea];return _0x554187;};'use strict';var _=require(_0x3c76('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x3c76('0x1'));var exec=require(_0x3c76('0x2'))[_0x3c76('0x3')];var config=require(_0x3c76('0x4'));function getInterfaces(){var _0x39caf3=[];var _0x1fc0c3=os['networkInterfaces']();var _0x814a95=_[_0x3c76('0x5')](_['keys'](_0x1fc0c3));for(var _0x4f0f10=0x0;_0x4f0f10<_0x814a95['length'];_0x4f0f10++){var _0xae78c7=_0x1fc0c3[_0x814a95[_0x4f0f10]][_0x3c76('0x6')](function(_0x40974f){return _0x40974f[_0x3c76('0x7')]==='IPv4'&&_0x40974f[_0x3c76('0x8')]===![];});_0x39caf3=_0x39caf3[_0x3c76('0x9')](_0xae78c7);}return _0x39caf3;}function getFirstInterface(){var _0xc45dbc=_[_0x3c76('0xa')](getInterfaces());return{'macAddress':_0xc45dbc&&_0xc45dbc[_0x3c76('0xb')]?_0xc45dbc[_0x3c76('0xb')]:_0x3c76('0xc'),'ipAddress':_0xc45dbc&&_0xc45dbc[_0x3c76('0xd')]?_0xc45dbc[_0x3c76('0xd')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x132ca4=_[_0x3c76('0x5')](os[_0x3c76('0xe')]()[_0x3c76('0xf')](function(_0x21a763){return _0x21a763[_0x3c76('0x10')];}))[_0x3c76('0x11')](':');return crypto['createHash']('md5')[_0x3c76('0x12')](_0x132ca4)[_0x3c76('0x13')](_0x3c76('0x14'));}exports['getUuid']=function(){var _0x40cd21=os['platform']();var _0x33da9d=/[0-9a-f-]{36}/;if(config[_0x3c76('0x15')]&&_0x33da9d[_0x3c76('0x16')](config['licenseToken'])){return config['licenseToken'];}else if(_0x40cd21===_0x3c76('0x17')){return exec(_0x3c76('0x18'),{'encoding':'utf8'})[_0x3c76('0x19')]('\x0d\x0a','');}else{var _0x295475=getFirstInterface();var _0x14c3cf=getCPUhash();var _0x53d019=_0x14c3cf+'|'+os[_0x3c76('0x1a')]()+'|'+_0x295475['macAddress']+'|'+_0x295475[_0x3c76('0x1b')];var _0xba90=crypto[_0x3c76('0x1c')](_0x3c76('0x1d'))[_0x3c76('0x12')](_0x53d019)[_0x3c76('0x13')](_0x3c76('0x14'));return _0xba90[_0x3c76('0x1e')](0x0,0x8)+'-'+_0xba90[_0x3c76('0x1e')](0x8,0xc)+'-'+_0xba90[_0x3c76('0x1e')](0xc,0x10)+'-'+_0xba90['substring'](0x10,0x14)+'-'+_0xba90['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1916c58..ba62dd4 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 _0x0747=['catch','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','data1','data2','then','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x0747,0x7d));var _0x7074=function(_0x3e2127,_0x1d2e33){_0x3e2127=_0x3e2127-0x0;var _0x4a92b0=_0x0747[_0x3e2127];return _0x4a92b0;};'use strict';var util=require(_0x7074('0x0'));var moment=require(_0x7074('0x1'));var rp=require(_0x7074('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x7074('0x3'))(module,_0x7074('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x7074('0x5'));var hardware=require(_0x7074('0x6'));var logger=require(_0x7074('0x7'))(_0x7074('0x8'));var HOST=_0x7074('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x24d979){return new BPromise(function(_0x4f0f84,_0x1d6314){var _0x503738=util[_0x7074('0xa')](_0x7074('0xb'),HOST,_0x24d979,module[_0x7074('0xc')][_0x7074('0x4')]);if(oldToken){_0x503738=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x24d979,module['exports'][_0x7074('0x4')],oldToken);}var _0x5e7161={'uri':_0x503738,'method':_0x7074('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x5e7161)['then'](function(_0x4832d0){_0x4f0f84(_0x4832d0);})['catch'](function(_0x1021cb){_0x1d6314(_0x1021cb);});});}function manageLicense(_0x299b29,_0x4dbb4e){var _0x5bf0d7=_0x4dbb4e['get']({'plain':!![]});if(!isOldTokenSent&&_0x5bf0d7[_0x7074('0xe')]!==_0x299b29&&!_0x5bf0d7[_0x7074('0xf')]){oldToken=_0x5bf0d7[_0x7074('0xe')];}httpRequest(_0x299b29)[_0x7074('0x10')](function(_0x5f4d6b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5f4d6b[_0x7074('0x11')]){isOldTokenSent=![];if(!_0x5bf0d7['license']&&_0x5bf0d7[_0x7074('0x8')]!=_0x5f4d6b[_0x7074('0x8')]||_0x5bf0d7[_0x7074('0x8')]&&_0x5bf0d7[_0x7074('0xf')]){logger['info'](_0x7074('0x12'));}if(_0x5bf0d7[_0x7074('0x8')]&&!_0x5bf0d7[_0x7074('0xf')]&&_0x5bf0d7['license']!=_0x5f4d6b[_0x7074('0x8')]){logger[_0x7074('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5bf0d7[_0x7074('0x8')]&&!_0x5bf0d7[_0x7074('0xf')]&&_0x5bf0d7[_0x7074('0x8')]==_0x5f4d6b[_0x7074('0x8')]){return _0x4dbb4e;}return _0x4dbb4e[_0x7074('0x14')]({'data1':_0x299b29,'data2':null,'license':_0x5f4d6b[_0x7074('0x8')]});}else{if(_0x5f4d6b['license']||_0x5bf0d7['license']){if(!_0x5bf0d7[_0x7074('0xf')]){if(_0x5bf0d7['data1']==_0x299b29){GRAY_PERIOD_REASON=_0x7074('0x15');logger['info'](_0x7074('0x16'));}else{GRAY_PERIOD_REASON=_0x7074('0x17');logger['info'](_0x7074('0x18'),_0x5bf0d7['data1'],_0x299b29);}logger[_0x7074('0x13')](_0x7074('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x7074('0x1a')));return _0x4dbb4e[_0x7074('0x14')]({'data2':encryptor[_0x7074('0x1b')](moment()[_0x7074('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x7074('0x1c')](encryptor[_0x7074('0x1d')](_0x5bf0d7[_0x7074('0xf')]),_0x7074('0x1e'))>DAYS){logger[_0x7074('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x7074('0x1a')));isOldTokenSent=![];return _0x4dbb4e[_0x7074('0x14')]({'data1':_0x299b29,'data2':null,'license':null});}}}else{if(_0x5bf0d7[_0x7074('0xe')]!=_0x299b29){logger[_0x7074('0x13')](_0x7074('0x18'),_0x5bf0d7[_0x7074('0xe')],_0x299b29);return _0x4dbb4e['update']({'data1':_0x299b29,'data2':null,'license':null});}}}return _0x4dbb4e;})['then'](function(_0x151406){_0x4dbb4e=_0x151406;})[_0x7074('0x1f')](function(_0x7a0c2e){logger[_0x7074('0x20')](_0x7a0c2e[_0x7074('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4dbb4e);},TIME);});}function defaultLicense(){var _0xd77f95=hardware[_0x7074('0x22')]();if(_0xd77f95){return db[_0x7074('0x23')][_0x7074('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xd77f95}})['spread'](function(_0x42382d,_0x5f41f0){logger[_0x7074('0x13')](_0x7074('0x25'),_0xd77f95);manageLicense(_0xd77f95,_0x42382d);})[_0x7074('0x1f')](function(_0x35fb61){logger[_0x7074('0x20')](_0x35fb61[_0x7074('0x21')]);});}}exports[_0x7074('0x26')]=defaultLicense; \ No newline at end of file +var _0x712e=['DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','util','bluebird','pkginfo','../../components/encryptor','./hardware','license','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','get','data1','active','data2','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days'];(function(_0x4855b9,_0x3e5fc4){var _0x2ee04a=function(_0xd81ff5){while(--_0xd81ff5){_0x4855b9['push'](_0x4855b9['shift']());}};_0x2ee04a(++_0x3e5fc4);}(_0x712e,0x184));var _0xe712=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x712e[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xe712('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xe712('0x1'));var pkginfo=require(_0xe712('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xe712('0x3'));var hardware=require(_0xe712('0x4'));var logger=require('../logger')(_0xe712('0x5'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x453dba){return new BPromise(function(_0x3e9b56,_0x2a3f8c){var _0x3dc282=util[_0xe712('0x6')](_0xe712('0x7'),HOST,_0x453dba,module[_0xe712('0x8')][_0xe712('0x9')]);if(oldToken){_0x3dc282=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x453dba,module['exports']['version'],oldToken);}var _0x4e4135={'uri':_0x3dc282,'method':_0xe712('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x4e4135)[_0xe712('0xb')](function(_0x12ae7f){_0x3e9b56(_0x12ae7f);})[_0xe712('0xc')](function(_0x2d2883){_0x2a3f8c(_0x2d2883);});});}function manageLicense(_0x271adf,_0x2e8c13){var _0x3b45e7=_0x2e8c13[_0xe712('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x3b45e7[_0xe712('0xe')]!==_0x271adf&&!_0x3b45e7['data2']){oldToken=_0x3b45e7['data1'];}httpRequest(_0x271adf)[_0xe712('0xb')](function(_0x167824){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x167824[_0xe712('0xf')]){isOldTokenSent=![];if(!_0x3b45e7[_0xe712('0x5')]&&_0x3b45e7[_0xe712('0x5')]!=_0x167824[_0xe712('0x5')]||_0x3b45e7[_0xe712('0x5')]&&_0x3b45e7[_0xe712('0x10')]){logger[_0xe712('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3b45e7['license']&&!_0x3b45e7[_0xe712('0x10')]&&_0x3b45e7[_0xe712('0x5')]!=_0x167824[_0xe712('0x5')]){logger[_0xe712('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3b45e7['license']&&!_0x3b45e7['data2']&&_0x3b45e7[_0xe712('0x5')]==_0x167824[_0xe712('0x5')]){return _0x2e8c13;}return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':_0x167824[_0xe712('0x5')]});}else{if(_0x167824[_0xe712('0x5')]||_0x3b45e7['license']){if(!_0x3b45e7['data2']){if(_0x3b45e7['data1']==_0x271adf){GRAY_PERIOD_REASON=_0xe712('0x13');logger[_0xe712('0x11')](_0xe712('0x14'));}else{GRAY_PERIOD_REASON=_0xe712('0x15');logger['info'](_0xe712('0x16'),_0x3b45e7[_0xe712('0xe')],_0x271adf);}logger['info'](_0xe712('0x17'),GRAY_PERIOD_REASON[_0xe712('0x18')](),moment()[_0xe712('0x6')](_0xe712('0x19')));return _0x2e8c13[_0xe712('0x12')]({'data2':encryptor[_0xe712('0x1a')](moment()[_0xe712('0x6')](_0xe712('0x19')))});}else{if(moment()[_0xe712('0x1b')](encryptor[_0xe712('0x1c')](_0x3b45e7['data2']),_0xe712('0x1d'))>DAYS){logger['info'](_0xe712('0x1e'),moment()['format'](_0xe712('0x19')));isOldTokenSent=![];return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':null});}}}else{if(_0x3b45e7[_0xe712('0xe')]!=_0x271adf){logger[_0xe712('0x11')](_0xe712('0x16'),_0x3b45e7[_0xe712('0xe')],_0x271adf);return _0x2e8c13[_0xe712('0x12')]({'data1':_0x271adf,'data2':null,'license':null});}}}return _0x2e8c13;})['then'](function(_0x2e6a65){_0x2e8c13=_0x2e6a65;})[_0xe712('0xc')](function(_0x2e588e){logger['error'](_0x2e588e[_0xe712('0x1f')]);})[_0xe712('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2e8c13);},TIME);});}function defaultLicense(){var _0xdbda6d=hardware[_0xe712('0x21')]();if(_0xdbda6d){return db[_0xe712('0x22')][_0xe712('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0xdbda6d}})['spread'](function(_0x509066,_0x52ab83){logger[_0xe712('0x11')](_0xe712('0x24'),_0xdbda6d);manageLicense(_0xdbda6d,_0x509066);})[_0xe712('0xc')](function(_0x1e2dd7){logger[_0xe712('0x25')](_0x1e2dd7['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a48f0ad..99bea71 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 _0x2b2c=['message','findAll','role','sequelize','col','count','user','telephone','telephones','forEach','admin','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo','machineUuid','decryptString','gray','deadline','add','days','grayReason','changed','disabled'];(function(_0x2465c6,_0x412a0a){var _0x28b33c=function(_0x52220f){while(--_0x52220f){_0x2465c6['push'](_0x2465c6['shift']());}};_0x28b33c(++_0x412a0a);}(_0x2b2c,0x1b5));var _0xc2b2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2b2c[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xc2b2('0x0'));var _=require(_0xc2b2('0x1'));var moment=require(_0xc2b2('0x2'));var BPromise=require(_0xc2b2('0x3'));var hardware=require('./hardware');var encryptor=require(_0xc2b2('0x4'));var db=require(_0xc2b2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc2b2('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xc2b2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc2b2('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc2b2('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x49b81b){return new BPromise(function(_0x181b98,_0x19afb7){return db[_0xc2b2('0x9')][_0xc2b2('0xa')](_[_0xc2b2('0xb')](_0x49b81b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x369995){return checkLicense(_0x369995,null);})[_0xc2b2('0xc')](function(_0x2d7a6b){_0x181b98(_0x2d7a6b);return;})[_0xc2b2('0xd')](function(_0x26027e){_0x19afb7(_0x26027e);});});}function checkLicense(_0x5b0788,_0x442b35){if(!_0x5b0788){demoLicense[_0xc2b2('0xe')]=_0x5b0788[_0xc2b2('0xf')];return demoLicense;}try{var _0x33f936=_0x442b35||_0x5b0788[_0xc2b2('0x10')];if(_[_0xc2b2('0x11')](_0x33f936)){throw new Error(_0xc2b2('0x12'));}var _0x4fa6ee=_0x5b0788[_0xc2b2('0xf')];var _0x57fda5=_0x5b0788[_0xc2b2('0x13')];var _0x438d7d=_0x4fa6ee[_0xc2b2('0x14')]('-')[0x4];var _0x222db4=_0x4fa6ee[_0xc2b2('0x14')]('-')[0x0];var _0x28e235=encryptor['decryptString'](_0x33f936,util[_0xc2b2('0x15')]('%s:%s:%s',_0x438d7d,_0x4fa6ee,_0x222db4));var _0x1700b4=JSON[_0xc2b2('0x16')](_0x28e235);_0x1700b4[_0xc2b2('0x17')]=![];_0x1700b4[_0xc2b2('0xe')]=_0x4fa6ee;_0x1700b4[_0xc2b2('0x18')]=hardware['getUuid']();if(_0x57fda5){var _0x243e07=encryptor[_0xc2b2('0x19')](_0x57fda5);_0x1700b4[_0xc2b2('0x1a')]=_0x243e07;_0x1700b4[_0xc2b2('0x1b')]=moment(_0x243e07)[_0xc2b2('0x1c')](0x7,_0xc2b2('0x1d'))[_0xc2b2('0x15')]();_0x1700b4[_0xc2b2('0x1e')]=_0x1700b4[_0xc2b2('0xe')]!=_0x1700b4[_0xc2b2('0x18')]?_0xc2b2('0x1f'):_0xc2b2('0x20');}return _0x1700b4;}catch(_0x8b3cf){breakingLicense['uuid']=_0x5b0788['data1'];breakingLicense[_0xc2b2('0x21')]=_0x8b3cf['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x281e8e,_0x27d17d){getLicense()[_0xc2b2('0xc')](function(_0x1ecd87){return db['User'][_0xc2b2('0x22')]({'attributes':[_0xc2b2('0x23'),[db['sequelize']['fn']('COUNT',db[_0xc2b2('0x24')][_0xc2b2('0x25')](_0xc2b2('0x23'))),_0xc2b2('0x26')]],'group':_0xc2b2('0x23'),'where':{'role':{'$or':['admin',_0xc2b2('0x27'),_0xc2b2('0x28')]}},'raw':!![]})[_0xc2b2('0xc')](function(_0x4a9450){var _0x499406={'user':_0x1ecd87['users']||0x0,'telephone':_0x1ecd87[_0xc2b2('0x29')]||0x0};_0x4a9450[_0xc2b2('0x2a')](function(_0x4ec396){var _0x5c6da3=_0x4ec396[_0xc2b2('0x23')]===_0xc2b2('0x2b')?_0xc2b2('0x27'):_0x4ec396[_0xc2b2('0x23')];_0x499406[_0x5c6da3]-=_0x4ec396[_0xc2b2('0x26')];if(_0x499406[_0x5c6da3]<0x0)_0x499406[_0x5c6da3]=0x0;});_0x281e8e(_0x499406);return;});})['catch'](function(_0x5e54d9){_0x27d17d(_0x5e54d9);});});}function checkUserLimits(_0x374a80){return new BPromise(function(_0x4b31d7,_0x39906b){getLimits()[_0xc2b2('0xc')](function(_0x1ed025){var _0x2e55cc=_[_0xc2b2('0x2c')](_['countBy'](_0x374a80,_0xc2b2('0x23')),['admin','user',_0xc2b2('0x28')]);var _0x484da4=(_0x2e55cc[_0xc2b2('0x2b')]||0x0)+(_0x2e55cc['user']||0x0);var _0x15c98=_0x2e55cc[_0xc2b2('0x28')]||0x0;if(_0x484da4>_0x1ed025[_0xc2b2('0x27')])return _0x39906b(_0xc2b2('0x2d'));if(_0x15c98>_0x1ed025[_0xc2b2('0x28')])return _0x39906b(_0xc2b2('0x2e'));return _0x4b31d7();})[_0xc2b2('0xd')](function(_0x105d11){_0x39906b(_0x105d11);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf3bc=['telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','uuid','license','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','admin','user','telephone','users'];(function(_0xbf61e,_0x75f898){var _0x380a49=function(_0x2f619e){while(--_0x2f619e){_0xbf61e['push'](_0xbf61e['shift']());}};_0x380a49(++_0x75f898);}(_0xf3bc,0x108));var _0xcf3b=function(_0x4d7cfa,_0x5673a0){_0x4d7cfa=_0x4d7cfa-0x0;var _0x8c7be9=_0xf3bc[_0x4d7cfa];return _0x8c7be9;};'use strict';var util=require(_0xcf3b('0x0'));var _=require(_0xcf3b('0x1'));var moment=require(_0xcf3b('0x2'));var BPromise=require(_0xcf3b('0x3'));var hardware=require(_0xcf3b('0x4'));var encryptor=require(_0xcf3b('0x5'));var db=require(_0xcf3b('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xcf3b('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xcf3b('0x8'),'machineUuid':hardware[_0xcf3b('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xcf3b('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1b0a0b){return new BPromise(function(_0x53594f,_0xa67296){return db[_0xcf3b('0xb')]['find'](_['defaults'](_0x1b0a0b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x42eedd){return checkLicense(_0x42eedd,null);})[_0xcf3b('0xc')](function(_0x1b6fcc){_0x53594f(_0x1b6fcc);return;})[_0xcf3b('0xd')](function(_0x1ed7e8){_0xa67296(_0x1ed7e8);});});}function checkLicense(_0x2ccb40,_0x5020b1){if(!_0x2ccb40){demoLicense[_0xcf3b('0xe')]=_0x2ccb40['data1'];return demoLicense;}try{var _0x4d678b=_0x5020b1||_0x2ccb40[_0xcf3b('0xf')];if(_['isEmpty'](_0x4d678b)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x47aa0f=_0x2ccb40['data1'];var _0x3c19ba=_0x2ccb40['data2'];var _0x4dcd87=_0x47aa0f['split']('-')[0x4];var _0x37d173=_0x47aa0f[_0xcf3b('0x10')]('-')[0x0];var _0x1b361=encryptor[_0xcf3b('0x11')](_0x4d678b,util[_0xcf3b('0x12')](_0xcf3b('0x13'),_0x4dcd87,_0x47aa0f,_0x37d173));var _0x1a51c6=JSON[_0xcf3b('0x14')](_0x1b361);_0x1a51c6[_0xcf3b('0x15')]=![];_0x1a51c6[_0xcf3b('0xe')]=_0x47aa0f;_0x1a51c6[_0xcf3b('0x16')]=hardware[_0xcf3b('0x9')]();if(_0x3c19ba){var _0x2468f0=encryptor[_0xcf3b('0x11')](_0x3c19ba);_0x1a51c6[_0xcf3b('0x17')]=_0x2468f0;_0x1a51c6['deadline']=moment(_0x2468f0)['add'](0x7,_0xcf3b('0x18'))[_0xcf3b('0x12')]();_0x1a51c6['grayReason']=_0x1a51c6['uuid']!=_0x1a51c6[_0xcf3b('0x16')]?_0xcf3b('0x19'):_0xcf3b('0x1a');}return _0x1a51c6;}catch(_0xb85666){breakingLicense['uuid']=_0x2ccb40['data1'];breakingLicense[_0xcf3b('0x1b')]=_0xb85666['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x19d440,_0x15557f){getLicense()[_0xcf3b('0xc')](function(_0x627f5d){return db[_0xcf3b('0x1c')][_0xcf3b('0x1d')]({'attributes':[_0xcf3b('0x1e'),[db[_0xcf3b('0x1f')]['fn'](_0xcf3b('0x20'),db[_0xcf3b('0x1f')]['col'](_0xcf3b('0x1e'))),'count']],'group':_0xcf3b('0x1e'),'where':{'role':{'$or':[_0xcf3b('0x21'),_0xcf3b('0x22'),_0xcf3b('0x23')]}},'raw':!![]})['then'](function(_0x88b7bb){var _0x3e7809={'user':_0x627f5d[_0xcf3b('0x24')]||0x0,'telephone':_0x627f5d[_0xcf3b('0x25')]||0x0};_0x88b7bb[_0xcf3b('0x26')](function(_0x16d2b0){var _0x1b0697=_0x16d2b0[_0xcf3b('0x1e')]===_0xcf3b('0x21')?'user':_0x16d2b0[_0xcf3b('0x1e')];_0x3e7809[_0x1b0697]-=_0x16d2b0['count'];if(_0x3e7809[_0x1b0697]<0x0)_0x3e7809[_0x1b0697]=0x0;});_0x19d440(_0x3e7809);return;});})['catch'](function(_0x9ba366){_0x15557f(_0x9ba366);});});}function checkUserLimits(_0xcc8c3){return new BPromise(function(_0x20f8ed,_0x20c7ed){getLimits()['then'](function(_0x43c218){var _0x1baf4f=_['pick'](_[_0xcf3b('0x27')](_0xcc8c3,'role'),['admin',_0xcf3b('0x22'),_0xcf3b('0x23')]);var _0x10135b=(_0x1baf4f['admin']||0x0)+(_0x1baf4f[_0xcf3b('0x22')]||0x0);var _0x113149=_0x1baf4f['telephone']||0x0;if(_0x10135b>_0x43c218[_0xcf3b('0x22')])return _0x20c7ed(_0xcf3b('0x28'));if(_0x113149>_0x43c218[_0xcf3b('0x23')])return _0x20c7ed(_0xcf3b('0x29'));return _0x20f8ed();})['catch'](function(_0xa66011){_0x20c7ed(_0xa66011);});});}module[_0xcf3b('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 05d58d7..69ec251 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 _0x4fc2=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x2c3822,_0x23ea36){var _0x4b4342=function(_0x5848d0){while(--_0x5848d0){_0x2c3822['push'](_0x2c3822['shift']());}};_0x4b4342(++_0x23ea36);}(_0x4fc2,0x111));var _0x24fc=function(_0x5860ca,_0x5e7823){_0x5860ca=_0x5860ca-0x0;var _0x20adec=_0x4fc2[_0x5860ca];return _0x20adec;};'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 +var _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x41b3d6,_0x21daa8){var _0x3e60ca=function(_0xee2395){while(--_0xee2395){_0x41b3d6['push'](_0x41b3d6['shift']());}};_0x3e60ca(++_0x21daa8);}(_0x1893,0xa2));var _0x3189=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0x1893[_0x743701];return _0x5a141d;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index bf9709e..fa0cd7b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf04d=['../utils/loggers','fileLogger','exports'];(function(_0x40d627,_0x1276e4){var _0x4c3ab7=function(_0x55e71c){while(--_0x55e71c){_0x40d627['push'](_0x40d627['shift']());}};_0x4c3ab7(++_0x1276e4);}(_0xf04d,0x1e0));var _0xdf04=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xf04d[_0x4a53d];return _0x27410e;};'use strict';var fileLogger=require(_0xdf04('0x0'))[_0xdf04('0x1')];module[_0xdf04('0x2')]=fileLogger; \ No newline at end of file +var _0x1b16=['exports'];(function(_0x2df643,_0x364578){var _0x3b3414=function(_0x5cf1d3){while(--_0x5cf1d3){_0x2df643['push'](_0x2df643['shift']());}};_0x3b3414(++_0x364578);}(_0x1b16,0x18f));var _0x61b1=function(_0xa2fd67,_0x219feb){_0xa2fd67=_0xa2fd67-0x0;var _0x7e1739=_0x1b16[_0xa2fd67];return _0x7e1739;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0x61b1('0x0')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index db9aed2..875ea86 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 _0x300c=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x300c,0xe0));var _0xc300=function(_0x420532,_0x121c0c){_0x420532=_0x420532-0x0;var _0x15fb4a=_0x300c[_0x420532];return _0x15fb4a;};'use strict';var path=require(_0xc300('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xc300('0x1')](__dirname,_0xc300('0x2'))},{'name':_0xc300('0x3'),'script':path[_0xc300('0x1')](__dirname,_0xc300('0x4'))},{'name':'agi','script':path[_0xc300('0x1')](__dirname,_0xc300('0x5'))},{'name':'email','script':path[_0xc300('0x1')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xc300('0x1')](__dirname,_0xc300('0x6'))},{'name':_0xc300('0x7'),'script':path['join'](__dirname,_0xc300('0x8'))}]};module[_0xc300('0x9')]=config; \ No newline at end of file +var _0xc838=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','path','express','join','ami','../../services/ami/index.js','../../services/agi/index.js'];(function(_0x415996,_0x96fe6f){var _0x1a245f=function(_0x5f3602){while(--_0x5f3602){_0x415996['push'](_0x415996['shift']());}};_0x1a245f(++_0x96fe6f);}(_0xc838,0x8a));var _0x8c83=function(_0x533966,_0x193c81){_0x533966=_0x533966-0x0;var _0x4abd82=_0xc838[_0x533966];return _0x4abd82;};'use strict';var path=require(_0x8c83('0x0'));var os=require('os');var config={'apps':[{'name':_0x8c83('0x1'),'script':path[_0x8c83('0x2')](__dirname,'../../services/express/index.js')},{'name':_0x8c83('0x3'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x4'))},{'name':'agi','script':path['join'](__dirname,_0x8c83('0x5'))},{'name':_0x8c83('0x6'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x7'))},{'name':_0x8c83('0x8'),'script':path[_0x8c83('0x2')](__dirname,_0x8c83('0x9'))},{'name':_0x8c83('0xa'),'script':path[_0x8c83('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x8c83('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6162385..6359258 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 _0x9176=['restart','list','describe','delete','dump','saved','pm2','./config','start','then','disconnect','stop'];(function(_0x117f85,_0x5afa65){var _0x1c61a7=function(_0x5be223){while(--_0x5be223){_0x117f85['push'](_0x117f85['shift']());}};_0x1c61a7(++_0x5afa65);}(_0x9176,0xae));var _0x6917=function(_0x1da3ef,_0x5a9bd8){_0x1da3ef=_0x1da3ef-0x0;var _0x33bf12=_0x9176[_0x1da3ef];return _0x33bf12;};'use strict';var pm2=require(_0x6917('0x0'));var BPromise=require('bluebird');var config=require(_0x6917('0x1'));function connect(){return new BPromise(function(_0x4d42de,_0x3982a4){return pm2['connect'](function(_0x5c01d3){if(_0x5c01d3){return _0x3982a4(_0x5c01d3);}return _0x4d42de('connected');});});};exports[_0x6917('0x2')]=function(_0x203043){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x24489a,_0x26e0ea){return pm2[_0x6917('0x2')](_0x203043,function(_0x137a77,_0x1814a6){if(_0x137a77){return _0x26e0ea(_0x137a77);}pm2[_0x6917('0x4')]();return _0x24489a(_0x1814a6);});});});};exports[_0x6917('0x5')]=function(_0x3b0335){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x222dea,_0x56f1dc){return pm2[_0x6917('0x5')](_0x3b0335,function(_0x272021,_0xfffbd1){if(_0x272021){return _0x56f1dc(_0x272021);}pm2[_0x6917('0x4')]();return _0x222dea(_0xfffbd1);});});});};exports['restart']=function(_0x53886b){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x14139c,_0x248dbf){return pm2[_0x6917('0x6')](_0x53886b,function(_0x54fad4,_0x331d1d){if(_0x54fad4){return _0x248dbf(_0x54fad4);}pm2[_0x6917('0x4')]();return _0x14139c(_0x331d1d);});});});};exports[_0x6917('0x7')]=function(){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x4e546b,_0x37ccdf){return pm2['list'](function(_0x2ab82f,_0x81ea4b){if(_0x2ab82f){return _0x37ccdf(_0x2ab82f);}pm2[_0x6917('0x4')]();return _0x4e546b(_0x81ea4b);});});});};exports['describe']=function(_0x41f8b){return connect()['then'](function(){return new BPromise(function(_0x52ccc7,_0x5ad9ac){return pm2[_0x6917('0x8')](_0x41f8b,function(_0x18a672,_0x7c6b72){if(_0x18a672){return _0x5ad9ac(_0x18a672);}pm2[_0x6917('0x4')]();return _0x52ccc7(_0x7c6b72);});});});};exports[_0x6917('0x9')]=function(_0x4708ff){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x388a86,_0x540e47){return pm2[_0x6917('0x9')](_0x4708ff,function(_0x3dfa92,_0x156513){if(_0x3dfa92){return _0x540e47(_0x3dfa92);}pm2['disconnect']();return _0x388a86(_0x156513);});});});};exports['dump']=function(){return connect()[_0x6917('0x3')](function(){return new BPromise(function(_0x11b530,_0x577317){return pm2[_0x6917('0xa')](function(_0x199548){if(_0x199548){return _0x577317(_0x199548);}return _0x11b530(_0x6917('0xb'));});});});}; \ No newline at end of file +var _0x54ed=['delete','dump','saved','pm2','bluebird','./config','connected','then','disconnect','stop','restart','describe'];(function(_0xdcc822,_0x13c856){var _0x47dceb=function(_0x23dfc7){while(--_0x23dfc7){_0xdcc822['push'](_0xdcc822['shift']());}};_0x47dceb(++_0x13c856);}(_0x54ed,0x1bf));var _0xd54e=function(_0x595775,_0x1d5665){_0x595775=_0x595775-0x0;var _0x5ad30f=_0x54ed[_0x595775];return _0x5ad30f;};'use strict';var pm2=require(_0xd54e('0x0'));var BPromise=require(_0xd54e('0x1'));var config=require(_0xd54e('0x2'));function connect(){return new BPromise(function(_0x59e522,_0x55e5ce){return pm2['connect'](function(_0xde89f1){if(_0xde89f1){return _0x55e5ce(_0xde89f1);}return _0x59e522(_0xd54e('0x3'));});});};exports['start']=function(_0x5a47ac){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0xeb1113,_0xceffe4){return pm2['start'](_0x5a47ac,function(_0x3647d0,_0x349a67){if(_0x3647d0){return _0xceffe4(_0x3647d0);}pm2[_0xd54e('0x5')]();return _0xeb1113(_0x349a67);});});});};exports[_0xd54e('0x6')]=function(_0x2d4b38){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x2f9460,_0x1c1a54){return pm2[_0xd54e('0x6')](_0x2d4b38,function(_0x3646b7,_0x4e9744){if(_0x3646b7){return _0x1c1a54(_0x3646b7);}pm2[_0xd54e('0x5')]();return _0x2f9460(_0x4e9744);});});});};exports[_0xd54e('0x7')]=function(_0x3bd8bf){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x5d1054,_0x2b0dda){return pm2[_0xd54e('0x7')](_0x3bd8bf,function(_0x27ec05,_0x33c0f0){if(_0x27ec05){return _0x2b0dda(_0x27ec05);}pm2[_0xd54e('0x5')]();return _0x5d1054(_0x33c0f0);});});});};exports['list']=function(){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x161d30,_0x24c49b){return pm2['list'](function(_0x36c6e2,_0x5a2d67){if(_0x36c6e2){return _0x24c49b(_0x36c6e2);}pm2[_0xd54e('0x5')]();return _0x161d30(_0x5a2d67);});});});};exports[_0xd54e('0x8')]=function(_0x251e9f){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x418e94,_0xc51d5c){return pm2[_0xd54e('0x8')](_0x251e9f,function(_0x5ea46c,_0x12ff6f){if(_0x5ea46c){return _0xc51d5c(_0x5ea46c);}pm2[_0xd54e('0x5')]();return _0x418e94(_0x12ff6f);});});});};exports[_0xd54e('0x9')]=function(_0x14647c){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x285aaf,_0x4c815d){return pm2[_0xd54e('0x9')](_0x14647c,function(_0x2844f8,_0xbe5bae){if(_0x2844f8){return _0x4c815d(_0x2844f8);}pm2['disconnect']();return _0x285aaf(_0xbe5bae);});});});};exports[_0xd54e('0xa')]=function(){return connect()[_0xd54e('0x4')](function(){return new BPromise(function(_0x578230,_0x1f3ca4){return pm2[_0xd54e('0xa')](function(_0x177b1a){if(_0x177b1a){return _0x1f3ca4(_0x177b1a);}return _0x578230(_0xd54e('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index ec676a1..f4ddf97 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 _0x40bb=['defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40bb,0x199));var _0xb40b=function(_0x4ee717,_0x1610d5){_0x4ee717=_0x4ee717-0x0;var _0x58d6d8=_0x40bb[_0x4ee717];return _0x58d6d8;};'use strict';var _=require(_0xb40b('0x0'));var moment=require(_0xb40b('0x1'));var Redis=require(_0xb40b('0x2'));var util=require('util');var config=require(_0xb40b('0x3'));var db=require(_0xb40b('0x4'))['db'];var logger=require(_0xb40b('0x5'))('schedule');config[_0xb40b('0x6')]=_[_0xb40b('0x7')](config[_0xb40b('0x6')],{'host':_0xb40b('0x8'),'port':0x18eb});var io=require(_0xb40b('0x9'))(new Redis(config[_0xb40b('0x6')]));function closeInteractions(){var _0x225f25=0x0;var _0x66e19e=[];return db['Setting'][_0xb40b('0xa')]({'raw':!![],'attributes':['id',_0xb40b('0xb')],'where':{'id':0x1}})[_0xb40b('0xc')](function(_0x2da29a){_0x225f25=_0x2da29a['chatTimeout'];if(_0x225f25){return db[_0xb40b('0xd')]['findAll']({'raw':!![],'attributes':['id',_0xb40b('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb40b('0xf')](_0x2da29a[_0xb40b('0xb')],_0xb40b('0x10'))}}});}else{return[];}})[_0xb40b('0xc')](function(_0x20de82){if(_0x20de82&&_0x20de82[_0xb40b('0x11')]){_0x66e19e=_['map'](_0x20de82||[],'id');logger[_0xb40b('0x12')](_0xb40b('0x13'),_0x66e19e[_0xb40b('0x14')]());return db[_0xb40b('0xd')][_0xb40b('0x15')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xb40b('0x16')](_0xb40b('0x17'))},{'where':{'id':_0x66e19e}});}})[_0xb40b('0xc')](function(){if(_0x66e19e&&_0x66e19e[_0xb40b('0x11')]){logger[_0xb40b('0x12')](_0xb40b('0x18'),_0x66e19e[_0xb40b('0x14')]());for(var _0x31f6bf=0x0;_0x31f6bf<_0x66e19e[_0xb40b('0x11')];_0x31f6bf++){io[_0xb40b('0x19')](_0xb40b('0x1a'),{'id':_0x66e19e[_0x31f6bf],'closed':!![]});}}})[_0xb40b('0x1b')](function(_0x232630){logger[_0xb40b('0x1c')](_0xb40b('0x1d'),_0x232630?util[_0xb40b('0x1e')](_0x232630,{'showHidden':![],'depth':null}):'');});}exports[_0xb40b('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8b79=['chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','Setting','find'];(function(_0x570c8a,_0x4a11cc){var _0x25dc12=function(_0x4585d9){while(--_0x4585d9){_0x570c8a['push'](_0x570c8a['shift']());}};_0x25dc12(++_0x4a11cc);}(_0x8b79,0x78));var _0x98b7=function(_0x368933,_0x1add51){_0x368933=_0x368933-0x0;var _0x346847=_0x8b79[_0x368933];return _0x346847;};'use strict';var _=require(_0x98b7('0x0'));var moment=require(_0x98b7('0x1'));var Redis=require(_0x98b7('0x2'));var util=require(_0x98b7('0x3'));var config=require(_0x98b7('0x4'));var db=require(_0x98b7('0x5'))['db'];var logger=require(_0x98b7('0x6'))('schedule');config[_0x98b7('0x7')]=_['defaults'](config[_0x98b7('0x7')],{'host':_0x98b7('0x8'),'port':0x18eb});var io=require(_0x98b7('0x9'))(new Redis(config[_0x98b7('0x7')]));function closeInteractions(){var _0x5355cd=0x0;var _0x528dd5=[];return db[_0x98b7('0xa')][_0x98b7('0xb')]({'raw':!![],'attributes':['id',_0x98b7('0xc')],'where':{'id':0x1}})['then'](function(_0xcf2d3f){_0x5355cd=_0xcf2d3f['chatTimeout'];if(_0x5355cd){return db[_0x98b7('0xd')][_0x98b7('0xe')]({'raw':!![],'attributes':['id',_0x98b7('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x98b7('0x10')](_0xcf2d3f[_0x98b7('0xc')],_0x98b7('0x11'))}}});}else{return[];}})[_0x98b7('0x12')](function(_0x2aa561){if(_0x2aa561&&_0x2aa561['length']){_0x528dd5=_[_0x98b7('0x13')](_0x2aa561||[],'id');logger['info'](_0x98b7('0x14'),_0x528dd5[_0x98b7('0x15')]());return db[_0x98b7('0xd')][_0x98b7('0x16')]({'closeReason':_0x98b7('0x17'),'disposition':_0x98b7('0x18'),'closed':!![],'closedAt':moment()['format'](_0x98b7('0x19'))},{'where':{'id':_0x528dd5}});}})[_0x98b7('0x12')](function(){if(_0x528dd5&&_0x528dd5['length']){logger[_0x98b7('0x1a')](_0x98b7('0x1b'),_0x528dd5[_0x98b7('0x15')]());for(var _0x3953d2=0x0;_0x3953d2<_0x528dd5[_0x98b7('0x1c')];_0x3953d2++){io['emit'](_0x98b7('0x1d'),{'id':_0x528dd5[_0x3953d2],'closed':!![]});}}})[_0x98b7('0x1e')](function(_0x407d62){logger[_0x98b7('0x1f')](_0x98b7('0x20'),_0x407d62?util['inspect'](_0x407d62,{'showHidden':![],'depth':null}):'');});}exports['start']=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 74252ab..3e5fcc7 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 _0x6209=['startAllRefreshIntervals','exports'];(function(_0x4662fc,_0x2787f7){var _0x2026cb=function(_0xd60ea5){while(--_0xd60ea5){_0x4662fc['push'](_0x4662fc['shift']());}};_0x2026cb(++_0x2787f7);}(_0x6209,0x126));var _0x9620=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6209[_0x297fd3];return _0x2af381;};'use strict';function start(){var _0x3fa92b=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3fa92b[_0x9620('0x0')]();}module[_0x9620('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4d28=['startAllRefreshIntervals','exports'];(function(_0x50bc23,_0x11e425){var _0x2571fd=function(_0x6412e0){while(--_0x6412e0){_0x50bc23['push'](_0x50bc23['shift']());}};_0x2571fd(++_0x11e425);}(_0x4d28,0x116));var _0x84d2=function(_0x4145a8,_0x55e817){_0x4145a8=_0x4145a8-0x0;var _0x155db0=_0x4d28[_0x4145a8];return _0x155db0;};'use strict';function start(){var _0xa68c12=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0xa68c12[_0x84d2('0x0')]();}module[_0x84d2('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 5b0c1aa..cd863a7 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 _0x29a4=['stop\x20cron','exists','update','run','path','lodash','moment','cron-job-manager','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','status','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','then','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','map','toString','difference','length','stop','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start'];(function(_0x704a28,_0x56e3f0){var _0x2b9686=function(_0x111c0d){while(--_0x111c0d){_0x704a28['push'](_0x704a28['shift']());}};_0x2b9686(++_0x56e3f0);}(_0x29a4,0x1e4));var _0x429a=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x29a4[_0x487b0c];return _0x1adbdc;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x429a('0x0'));var _=require(_0x429a('0x1'));var moment=require(_0x429a('0x2'));var CronJobManager=require(_0x429a('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x429a('0x4'));var logger=require('../logger')('schedule');var db=require(_0x429a('0x5'))['db'];var analyticCustomReportController=require(_0x429a('0x6'));var analyticDefaultReportController=require(_0x429a('0x7'));var client=jayson[_0x429a('0x8')][_0x429a('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x27736d,_0x40bf7c){return function(){logger[_0x429a('0xa')](_0x429a('0xb'),_0x27736d[_0x429a('0xc')]);var _0x27656e=!![];var _0x3197d3=_0x27736d[_0x429a('0xd')][_0x429a('0xe')]();var _0x4ce1c4={'account':_0x3197d3,'message':{'from':util[_0x429a('0xf')](_0x429a('0x10'),_0x27736d[_0x429a('0xd')][_0x429a('0x11')],_0x27736d[_0x429a('0xd')]['email']||_0x27736d[_0x429a('0xd')][_0x429a('0x12')]['user']),'to':_0x27736d[_0x429a('0xc')],'cc':_0x27736d['cc'],'bcc':_0x27736d[_0x429a('0x13')],'subject':util[_0x429a('0xf')](_0x429a('0x14'),_0x40bf7c[_0x429a('0x11')],_0x27736d['subtractNumber'],_0x27736d[_0x429a('0x15')])}};var _0x47f985=path[_0x429a('0x16')](__dirname,'../../files/reports');var _0x1883b9=_0x40bf7c[_0x429a('0x17')];var _0x4f0cbc=util[_0x429a('0xf')](_0x429a('0x18'),path[_0x429a('0x19')](_0x40bf7c[_0x429a('0x17')],path[_0x429a('0x1a')](_0x40bf7c[_0x429a('0x17')])),_0x429a('0x1b'));var _0x480a32=path['join'](_0x47f985,_0x1883b9);var _0x414e98=path['join'](_0x47f985,_0x4f0cbc);if(fs[_0x429a('0x1c')](_0x480a32)){_0x40bf7c[_0x429a('0x1d')]='Sent';_0x4ce1c4[_0x429a('0x1e')]['attachments']=[{'filename':_0x1883b9,'path':_0x480a32}];_0x4ce1c4[_0x429a('0x1e')][_0x429a('0x1f')]=util[_0x429a('0xf')](_0x429a('0x20'),JSON[_0x429a('0x21')](_0x40bf7c,null,0x2));}else if(fs[_0x429a('0x1c')](_0x414e98)){_0x40bf7c[_0x429a('0x1d')]=_0x429a('0x22');_0x4ce1c4[_0x429a('0x1e')]['attachments']=[{'filename':_0x4f0cbc,'path':_0x414e98}];}else{_0x4ce1c4[_0x429a('0x1e')]['text']=_0x429a('0x23');if(!_0x27736d['sendIfEmpty']){_0x27656e=![];logger[_0x429a('0xa')](_0x429a('0x24'));}}if(_0x27656e){return client[_0x429a('0x25')]('SendMail',_0x4ce1c4)['then'](function(_0x3d70bf){if(_0x3d70bf['error']){return logger[_0x429a('0x26')](_0x429a('0x27'),JSON['stringify'](_0x3d70bf));}return logger[_0x429a('0xa')](_0x429a('0x28'));})['catch'](function(_0x40387f){return logger[_0x429a('0x26')]('error\x20mail',JSON[_0x429a('0x21')](_0x40387f));});}};}function handleError(){return function(_0x4eb6ab){return logger['error'](JSON[_0x429a('0x21')](_0x4eb6ab));};}function handleResult(_0x56fd50){return function(_0x513798){logger['info'](_0x429a('0x29'),JSON[_0x429a('0x21')](_0x513798));if(_0x56fd50['MailAccount']&&_0x56fd50[_0x429a('0xd')]['Smtp']&&!_[_0x429a('0x2a')](_0x56fd50['email'])){setTimeout(handleSendEmail(_0x56fd50,_0x513798),0x3c*0x3e8);}};}function handleJob(_0x15d1c1){return function(){try{if(_[_0x429a('0x2a')](_0x15d1c1[_0x429a('0x2b')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x429a('0x2a')](_0x15d1c1[_0x429a('0x15')])){return logger[_0x429a('0xa')](_0x429a('0x2c'));}var _0x118550={'startDate':moment()['subtract'](_0x15d1c1[_0x429a('0x2b')],_0x15d1c1[_0x429a('0x15')])[_0x429a('0xf')](_0x429a('0x2d')),'endDate':moment()[_0x429a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x429a('0x2e'),'output':_0x15d1c1['output'],'name':_0x15d1c1[_0x429a('0x11')]};if(!_[_0x429a('0x2a')](_0x15d1c1['DefaultReportId'])){logger[_0x429a('0xa')](_0x429a('0x2f'),_0x15d1c1[_0x429a('0x30')]);return analyticDefaultReportController[_0x429a('0x31')]({'id':_0x15d1c1[_0x429a('0x30')]},_0x118550)[_0x429a('0x32')](handleResult(_0x15d1c1))[_0x429a('0x33')](handleError());}if(!_[_0x429a('0x2a')](_0x15d1c1['CustomReportId'])){logger['info'](_0x429a('0x34'),_0x15d1c1['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x15d1c1[_0x429a('0x35')]},_0x118550)[_0x429a('0x32')](handleResult(_0x15d1c1))[_0x429a('0x33')](handleError());}}catch(_0xe1dccd){logger[_0x429a('0x26')](JSON[_0x429a('0x21')](_0xe1dccd));}return logger[_0x429a('0xa')](_0x429a('0x36'));};}function getJobs(_0x303abc){var _0x242868={};if(_0x303abc){_0x242868['id']=_0x303abc;}return db[_0x429a('0x37')][_0x429a('0x38')]({'where':_0x242868,'include':[{'model':db[_0x429a('0xd')],'attributes':['id','name',_0x429a('0xc')],'include':[{'model':db[_0x429a('0x39')],'as':_0x429a('0x12'),'include':[{'model':db[_0x429a('0x3a')],'as':_0x429a('0x3a')}]}]}]})[_0x429a('0x32')](function(_0x5df4bc){var _0x31a05b=_['keys'](manager['jobs']);var _0x315e0a=_[_0x429a('0x3b')](_0x5df4bc,function(_0x31b3be){return _0x31b3be['id'][_0x429a('0x3c')]();});var _0x52466f=_['keyBy'](_0x5df4bc,function(_0x31d0e6){return _0x31d0e6['id'][_0x429a('0x3c')]();});var _0x579daa=_0x303abc?_0x315e0a:_[_0x429a('0x3d')](_0x315e0a,_0x31a05b);var _0x400755=_['intersection'](_0x315e0a,_0x31a05b);var _0x4d1bac=_[_0x429a('0x3d')](_0x31a05b,_0x315e0a);var _0x498216;var _0x53e730;for(_0x498216=0x0;_0x498216<_0x4d1bac[_0x429a('0x3e')]&&!_0x303abc;_0x498216+=0x1){_0x53e730=_0x4d1bac[_0x498216][_0x429a('0x3c')]();if(manager['exists'](_0x53e730)){manager[_0x429a('0x3f')](_0x53e730);manager[_0x429a('0x40')](_0x53e730);logger[_0x429a('0xa')]('delete\x20cron',_0x53e730);}}logger['info'](_0x429a('0x41'),JSON['stringify'](_0x579daa));for(_0x498216=0x0;_0x498216<_0x579daa[_0x429a('0x3e')];_0x498216+=0x1){_0x53e730=_0x579daa[_0x498216][_0x429a('0x3c')]();logger[_0x429a('0xa')](_0x429a('0x42'),_0x53e730);if(_0x303abc){logger[_0x429a('0xa')](_0x429a('0x43'),_0x303abc);logger[_0x429a('0xa')](JSON[_0x429a('0x21')](_0x52466f[_0x53e730]));BPromise['resolve']()[_0x429a('0x32')](handleJob(_0x52466f[_0x53e730]));logger[_0x429a('0xa')](_0x429a('0x44'),_0x52466f[_0x53e730]['name'],_0x52466f[_0x53e730][_0x429a('0x45')]);}else if(_0x52466f[_0x53e730][_0x429a('0x45')]&&_0x52466f[_0x53e730][_0x429a('0x46')]&&moment()[_0x429a('0x47')](_0x52466f[_0x53e730][_0x429a('0x48')],_0x52466f[_0x53e730][_0x429a('0x49')])){manager[_0x429a('0x4a')](_0x53e730,_0x52466f[_0x53e730]['cron'],handleJob(_0x52466f[_0x53e730]));manager[_0x429a('0x4b')](_0x53e730);logger[_0x429a('0xa')]('add\x20cron',_0x52466f[_0x53e730][_0x429a('0x11')],_0x52466f[_0x53e730][_0x429a('0x45')]);}else if(manager['exists'](_0x53e730)){manager['stop'](_0x53e730);manager[_0x429a('0x40')](_0x53e730);logger['info'](_0x429a('0x4c'),_0x52466f[_0x53e730]['name'],_0x52466f[_0x53e730][_0x429a('0x45')]);}}for(_0x498216=0x0,_0x53e730;_0x498216<_0x400755[_0x429a('0x3e')]&&!_0x303abc;_0x498216+=0x1){_0x53e730=_0x400755[_0x498216][_0x429a('0x3c')]();if(manager[_0x429a('0x4d')](_0x53e730)){if(_0x52466f[_0x53e730][_0x429a('0x45')]&&_0x52466f[_0x53e730][_0x429a('0x46')]&&moment()[_0x429a('0x47')](_0x52466f[_0x53e730][_0x429a('0x48')],_0x52466f[_0x53e730][_0x429a('0x49')])){manager[_0x429a('0x4e')](_0x53e730,_0x52466f[_0x53e730][_0x429a('0x45')],handleJob(_0x52466f[_0x53e730]));logger[_0x429a('0xa')]('update\x20cron',_0x52466f[_0x53e730][_0x429a('0x11')],_0x52466f[_0x53e730][_0x429a('0x45')]);}else{manager[_0x429a('0x3f')](_0x53e730);manager[_0x429a('0x40')](_0x53e730);logger[_0x429a('0xa')](_0x429a('0x4c'),_0x52466f[_0x53e730][_0x429a('0x11')],_0x52466f[_0x53e730][_0x429a('0x45')]);}}}})['catch'](function(_0x47d326){logger[_0x429a('0x26')](JSON[_0x429a('0x21')](_0x47d326));});}exports[_0x429a('0x4f')]=function(_0x26bb06){return getJobs(_0x26bb06);};exports[_0x429a('0x4b')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x94bc=['endAt','start','add\x20cron','stop','stop\x20cron','update','update\x20cron','run','util','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt'];(function(_0x51db58,_0x44d00c){var _0x3eeec5=function(_0x362fa6){while(--_0x362fa6){_0x51db58['push'](_0x51db58['shift']());}};_0x3eeec5(++_0x44d00c);}(_0x94bc,0x1bb));var _0xc94b=function(_0x275fa1,_0x28af28){_0x275fa1=_0x275fa1-0x0;var _0x5c04db=_0x94bc[_0x275fa1];return _0x5c04db;};'use strict';var fs=require('fs');var util=require(_0xc94b('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xc94b('0x1'));var jayson=require(_0xc94b('0x2'));var BPromise=require(_0xc94b('0x3'));var logger=require(_0xc94b('0x4'))(_0xc94b('0x5'));var db=require(_0xc94b('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xc94b('0x7'));var client=jayson[_0xc94b('0x8')][_0xc94b('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xbfc8b6,_0x4d061b){return function(){logger['info'](_0xc94b('0xa'),_0xbfc8b6[_0xc94b('0xb')]);var _0x19fcad=!![];var _0x5ff609=_0xbfc8b6[_0xc94b('0xc')]['getSmtpOptions']();var _0x499888={'account':_0x5ff609,'message':{'from':util[_0xc94b('0xd')](_0xc94b('0xe'),_0xbfc8b6['MailAccount'][_0xc94b('0xf')],_0xbfc8b6[_0xc94b('0xc')][_0xc94b('0xb')]||_0xbfc8b6[_0xc94b('0xc')][_0xc94b('0x10')][_0xc94b('0x11')]),'to':_0xbfc8b6['email'],'cc':_0xbfc8b6['cc'],'bcc':_0xbfc8b6[_0xc94b('0x12')],'subject':util[_0xc94b('0xd')](_0xc94b('0x13'),_0x4d061b[_0xc94b('0xf')],_0xbfc8b6['subtractNumber'],_0xbfc8b6[_0xc94b('0x14')])}};var _0x43fcaa=path['join'](__dirname,_0xc94b('0x15'));var _0x134232=_0x4d061b[_0xc94b('0x16')];var _0x1fc126=util['format'](_0xc94b('0x17'),path[_0xc94b('0x18')](_0x4d061b[_0xc94b('0x16')],path[_0xc94b('0x19')](_0x4d061b[_0xc94b('0x16')])),'zip');var _0x65fd9c=path[_0xc94b('0x1a')](_0x43fcaa,_0x134232);var _0x523bb1=path[_0xc94b('0x1a')](_0x43fcaa,_0x1fc126);if(fs[_0xc94b('0x1b')](_0x65fd9c)){_0x4d061b[_0xc94b('0x1c')]=_0xc94b('0x1d');_0x499888[_0xc94b('0x1e')][_0xc94b('0x1f')]=[{'filename':_0x134232,'path':_0x65fd9c}];_0x499888[_0xc94b('0x1e')]['text']=util['format'](_0xc94b('0x20'),JSON[_0xc94b('0x21')](_0x4d061b,null,0x2));}else if(fs['existsSync'](_0x523bb1)){_0x4d061b[_0xc94b('0x1c')]='Sent';_0x499888[_0xc94b('0x1e')][_0xc94b('0x1f')]=[{'filename':_0x1fc126,'path':_0x523bb1}];}else{_0x499888[_0xc94b('0x1e')][_0xc94b('0x22')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xbfc8b6[_0xc94b('0x23')]){_0x19fcad=![];logger[_0xc94b('0x24')](_0xc94b('0x25'));}}if(_0x19fcad){return client[_0xc94b('0x26')](_0xc94b('0x27'),_0x499888)[_0xc94b('0x28')](function(_0x2a01a5){if(_0x2a01a5[_0xc94b('0x29')]){return logger[_0xc94b('0x29')](_0xc94b('0x2a'),JSON[_0xc94b('0x21')](_0x2a01a5));}return logger['info'](_0xc94b('0x2b'));})['catch'](function(_0x322928){return logger['error'](_0xc94b('0x2a'),JSON['stringify'](_0x322928));});}};}function handleError(){return function(_0x5d0eda){return logger[_0xc94b('0x29')](JSON[_0xc94b('0x21')](_0x5d0eda));};}function handleResult(_0xcadf70){return function(_0x1105a4){logger[_0xc94b('0x24')](_0xc94b('0x2c'),JSON[_0xc94b('0x21')](_0x1105a4));if(_0xcadf70[_0xc94b('0xc')]&&_0xcadf70['MailAccount'][_0xc94b('0x10')]&&!_[_0xc94b('0x2d')](_0xcadf70['email'])){setTimeout(handleSendEmail(_0xcadf70,_0x1105a4),0x3c*0x3e8);}};}function handleJob(_0x2c0027){return function(){try{if(_[_0xc94b('0x2d')](_0x2c0027[_0xc94b('0x2e')])){return logger[_0xc94b('0x24')](_0xc94b('0x2f'));}if(_['isNil'](_0x2c0027[_0xc94b('0x14')])){return logger[_0xc94b('0x24')](_0xc94b('0x30'));}var _0xfbf2d8={'startDate':moment()[_0xc94b('0x31')](_0x2c0027[_0xc94b('0x2e')],_0x2c0027[_0xc94b('0x14')])[_0xc94b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xc94b('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xc94b('0x32'),'output':_0x2c0027[_0xc94b('0x33')],'name':_0x2c0027[_0xc94b('0xf')]};if(!_[_0xc94b('0x2d')](_0x2c0027[_0xc94b('0x34')])){logger['info'](_0xc94b('0x35'),_0x2c0027[_0xc94b('0x34')]);return analyticDefaultReportController[_0xc94b('0x36')]({'id':_0x2c0027[_0xc94b('0x34')]},_0xfbf2d8)['then'](handleResult(_0x2c0027))[_0xc94b('0x37')](handleError());}if(!_['isNil'](_0x2c0027['CustomReportId'])){logger['info'](_0xc94b('0x38'),_0x2c0027[_0xc94b('0x39')]);return analyticCustomReportController[_0xc94b('0x36')]({'id':_0x2c0027['CustomReportId']},_0xfbf2d8)['then'](handleResult(_0x2c0027))[_0xc94b('0x37')](handleError());}}catch(_0x311c2f){logger[_0xc94b('0x29')](JSON[_0xc94b('0x21')](_0x311c2f));}return logger[_0xc94b('0x24')](_0xc94b('0x3a'));};}function getJobs(_0x3fd003){var _0x49075d={};if(_0x3fd003){_0x49075d['id']=_0x3fd003;}return db[_0xc94b('0x3b')][_0xc94b('0x3c')]({'where':_0x49075d,'include':[{'model':db['MailAccount'],'attributes':['id',_0xc94b('0xf'),_0xc94b('0xb')],'include':[{'model':db['MailServerOut'],'as':_0xc94b('0x10'),'include':[{'model':db[_0xc94b('0x3d')],'as':_0xc94b('0x3d')}]}]}]})[_0xc94b('0x28')](function(_0x592cf0){var _0x1dd6db=_['keys'](manager[_0xc94b('0x3e')]);var _0x5c9bab=_['map'](_0x592cf0,function(_0x4049e2){return _0x4049e2['id']['toString']();});var _0x33819f=_[_0xc94b('0x3f')](_0x592cf0,function(_0x35466c){return _0x35466c['id'][_0xc94b('0x40')]();});var _0x3624d9=_0x3fd003?_0x5c9bab:_[_0xc94b('0x41')](_0x5c9bab,_0x1dd6db);var _0x427dd9=_[_0xc94b('0x42')](_0x5c9bab,_0x1dd6db);var _0x5a1fe9=_[_0xc94b('0x41')](_0x1dd6db,_0x5c9bab);var _0x3141fb;var _0xa5bcb;for(_0x3141fb=0x0;_0x3141fb<_0x5a1fe9[_0xc94b('0x43')]&&!_0x3fd003;_0x3141fb+=0x1){_0xa5bcb=_0x5a1fe9[_0x3141fb]['toString']();if(manager[_0xc94b('0x44')](_0xa5bcb)){manager['stop'](_0xa5bcb);manager[_0xc94b('0x45')](_0xa5bcb);logger[_0xc94b('0x24')](_0xc94b('0x46'),_0xa5bcb);}}logger[_0xc94b('0x24')](_0xc94b('0x47'),JSON[_0xc94b('0x21')](_0x3624d9));for(_0x3141fb=0x0;_0x3141fb<_0x3624d9[_0xc94b('0x43')];_0x3141fb+=0x1){_0xa5bcb=_0x3624d9[_0x3141fb][_0xc94b('0x40')]();logger[_0xc94b('0x24')](_0xc94b('0x48'),_0xa5bcb);if(_0x3fd003){logger[_0xc94b('0x24')](_0xc94b('0x49'),_0x3fd003);logger['info'](JSON[_0xc94b('0x21')](_0x33819f[_0xa5bcb]));BPromise[_0xc94b('0x4a')]()[_0xc94b('0x28')](handleJob(_0x33819f[_0xa5bcb]));logger['info'](_0xc94b('0x4b'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}else if(_0x33819f[_0xa5bcb][_0xc94b('0x4c')]&&_0x33819f[_0xa5bcb]['active']&&moment()[_0xc94b('0x4d')](_0x33819f[_0xa5bcb][_0xc94b('0x4e')],_0x33819f[_0xa5bcb][_0xc94b('0x4f')])){manager['add'](_0xa5bcb,_0x33819f[_0xa5bcb][_0xc94b('0x4c')],handleJob(_0x33819f[_0xa5bcb]));manager[_0xc94b('0x50')](_0xa5bcb);logger['info'](_0xc94b('0x51'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}else if(manager[_0xc94b('0x44')](_0xa5bcb)){manager[_0xc94b('0x52')](_0xa5bcb);manager['deleteJob'](_0xa5bcb);logger[_0xc94b('0x24')](_0xc94b('0x53'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb][_0xc94b('0x4c')]);}}for(_0x3141fb=0x0,_0xa5bcb;_0x3141fb<_0x427dd9[_0xc94b('0x43')]&&!_0x3fd003;_0x3141fb+=0x1){_0xa5bcb=_0x427dd9[_0x3141fb][_0xc94b('0x40')]();if(manager[_0xc94b('0x44')](_0xa5bcb)){if(_0x33819f[_0xa5bcb][_0xc94b('0x4c')]&&_0x33819f[_0xa5bcb]['active']&&moment()[_0xc94b('0x4d')](_0x33819f[_0xa5bcb]['startAt'],_0x33819f[_0xa5bcb][_0xc94b('0x4f')])){manager[_0xc94b('0x54')](_0xa5bcb,_0x33819f[_0xa5bcb][_0xc94b('0x4c')],handleJob(_0x33819f[_0xa5bcb]));logger[_0xc94b('0x24')](_0xc94b('0x55'),_0x33819f[_0xa5bcb]['name'],_0x33819f[_0xa5bcb]['cron']);}else{manager[_0xc94b('0x52')](_0xa5bcb);manager['deleteJob'](_0xa5bcb);logger['info'](_0xc94b('0x53'),_0x33819f[_0xa5bcb][_0xc94b('0xf')],_0x33819f[_0xa5bcb]['cron']);}}}})['catch'](function(_0x1e337b){logger['error'](JSON['stringify'](_0x1e337b));});}exports[_0xc94b('0x56')]=function(_0x34c908){return getJobs(_0x34c908);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 604677d..895457b 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 _0x56c8=['transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x56c8,0x12f));var _0x856c=function(_0x2f7dee,_0x27b0b1){_0x2f7dee=_0x2f7dee-0x0;var _0x5c48ee=_0x56c8[_0x2f7dee];return _0x5c48ee;};var _=require(_0x856c('0x0'));var AWS=require(_0x856c('0x1'));var rp=require(_0x856c('0x2'));var util=require(_0x856c('0x3'));var BPromise=require('bluebird');var db=require(_0x856c('0x4'))['db'];var logger=require(_0x856c('0x5'))(_0x856c('0x6'));function getTranscriptionJob(_0xd0f4b3,_0x2a1b07,_0x5888ad,_0x2608a5){return new Promise(function(_0x1922f4,_0x413964){var _0x15a17c=new AWS[(_0x856c('0x7'))]({'accessKeyId':_0x2a1b07,'secretAccessKey':_0xd0f4b3,'region':_0x5888ad});_0x15a17c[_0x856c('0x8')]({'TranscriptionJobName':_0x2608a5},function(_0x48d81b,_0x5064ef){if(_0x48d81b){return _0x413964(_0x48d81b);}else{return _0x1922f4(_0x5064ef);}});});}function sentiment(_0x2822ca,_0x17ac74,_0xa2bd07,_0x4c173b,_0x4b8bbc){return new Promise(function(_0x56217b,_0x619489){var _0x36e8ef=new AWS[(_0x856c('0x9'))]({'accessKeyId':_0x17ac74,'secretAccessKey':_0x2822ca,'region':_0xa2bd07});_0x36e8ef['detectSentiment']({'Text':_0x4c173b,'LanguageCode':_0x4b8bbc[_0x856c('0xa')](0x0,0x2)},function(_0xf65022,_0x4f7d31){if(_0xf65022){return _0x619489(_0xf65022);}else{return _0x56217b(_0x4f7d31);}});});}function checkTranscribeJob(_0x2539a6,_0x117c1a,_0x326656){var _0x28c3d4;return new BPromise(function(_0x3dad74,_0x288d44){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2539a6['id'],_0x2539a6[_0x856c('0xd')]));return getTranscriptionJob(_0x326656['data1'],_0x326656[_0x856c('0xe')],_0x117c1a[_0x856c('0xf')],_0x2539a6[_0x856c('0xd')])[_0x856c('0x10')](function(_0x6856e5){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x11'),_0x2539a6['id'],_0x2539a6[_0x856c('0xd')],_0x6856e5[_0x856c('0x12')][_0x856c('0x13')]));if(!_0x2539a6[_0x856c('0x14')]){switch(_0x6856e5[_0x856c('0x12')][_0x856c('0x13')]){case _0x856c('0x15'):var _0x27c7cc={'transcribeStatus':_0x6856e5[_0x856c('0x12')][_0x856c('0x13')],'fileUri':_0x6856e5[_0x856c('0x12')][_0x856c('0x16')][_0x856c('0x17')]};logger[_0x856c('0xb')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2539a6['id']));return rp({'uri':_0x6856e5[_0x856c('0x12')][_0x856c('0x16')][_0x856c('0x17')],'json':!![]})['then'](function(_0x120bc2){logger['info'](util[_0x856c('0xc')](_0x856c('0x18'),_0x2539a6['id']));if(_0x120bc2&&_0x120bc2[_0x856c('0x19')]&&_0x120bc2['results'][_0x856c('0x1a')]&&_0x120bc2[_0x856c('0x19')][_0x856c('0x1a')][_0x856c('0x1b')]){_0x27c7cc[_0x856c('0x14')]='';for(var _0x3b2f35=0x0;_0x3b2f35<_0x120bc2['results'][_0x856c('0x1a')][_0x856c('0x1b')];_0x3b2f35++){_0x27c7cc[_0x856c('0x14')]+=_0x120bc2['results'][_0x856c('0x1a')][_0x3b2f35]['transcript']+'';}}return _0x2539a6[_0x856c('0x1c')](_0x27c7cc);})['then'](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2539a6['id']));if(!_0x2539a6[_0x856c('0x1d')]){throw new db['Sequelize'][(_0x856c('0x1e'))](_0x856c('0x1f'));}if(!_0x117c1a[_0x856c('0x20')]||!_0x117c1a['sentimentAccountId']||!_0x117c1a[_0x856c('0x21')]||!_0x117c1a[_0x856c('0x22')]||!_0x117c1a[_0x856c('0x23')]){throw new db['Sequelize']['ValidationError'](_0x856c('0x24'));}if(!_0x27c7cc[_0x856c('0x14')]){throw new Error(_0x856c('0x25'));}if(_0x117c1a[_0x856c('0x26')]===_0x326656['id']){return _0x326656;}else{return db[_0x856c('0x27')][_0x856c('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x856c('0x10')](function(_0x866950){if(!_0x866950){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2a'));}if(!_0x866950[_0x856c('0x2b')]||!_0x866950['data2']){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2c'));}_0x28c3d4=_0x866950;logger['info'](util[_0x856c('0xc')](_0x856c('0x2d'),_0x2539a6['id']));return sentiment(_0x28c3d4['data1'],_0x28c3d4[_0x856c('0xe')],_0x117c1a[_0x856c('0x21')],_0x27c7cc[_0x856c('0x14')],_0x117c1a[_0x856c('0x22')]);})[_0x856c('0x10')](function(_0x592a4c){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x2e'),_0x2539a6['id']));return _0x2539a6[_0x856c('0x1c')]({'sentiment':_0x592a4c[_0x856c('0x2f')],'sPositive':_0x592a4c[_0x856c('0x30')][_0x856c('0x31')],'sNegative':_0x592a4c[_0x856c('0x30')][_0x856c('0x32')],'sMixed':_0x592a4c[_0x856c('0x30')][_0x856c('0x33')],'sNeutral':_0x592a4c[_0x856c('0x30')]['Neutral']});})['then'](function(){logger[_0x856c('0xb')](util['format'](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});case _0x856c('0x35'):return _0x2539a6[_0x856c('0x1c')]({'transcribeStatus':_0x856c('0x35'),'failureReason':_0x6856e5[_0x856c('0x12')]['FailureReason']})[_0x856c('0x10')](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});default:logger[_0x856c('0xb')](util['format'](_0x856c('0x36'),_0x2539a6['id']));break;}}else{return BPromise[_0x856c('0x37')]()[_0x856c('0x10')](function(){if(!_0x2539a6[_0x856c('0x1d')]){throw new db[(_0x856c('0x29'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x117c1a[_0x856c('0x20')]||!_0x117c1a[_0x856c('0x26')]||!_0x117c1a[_0x856c('0x21')]||!_0x117c1a['language']||!_0x117c1a[_0x856c('0x23')]){throw new db[(_0x856c('0x29'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2539a6[_0x856c('0x14')]){throw new Error(_0x856c('0x25'));}if(_0x117c1a[_0x856c('0x26')]===_0x326656['id']){return _0x326656;}else{return db[_0x856c('0x27')][_0x856c('0x28')]({'where':{'id':_settings[_0x856c('0x26')]}});}})[_0x856c('0x10')](function(_0x4da144){if(!_0x4da144){throw new db['Sequelize'][(_0x856c('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4da144[_0x856c('0x2b')]||!_0x4da144[_0x856c('0xe')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x28c3d4=_0x4da144;logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x2d'),_0x2539a6['id']));return sentiment(_0x28c3d4[_0x856c('0x2b')],_0x28c3d4[_0x856c('0xe')],_0x117c1a[_0x856c('0x21')],_0x2539a6[_0x856c('0x14')],_0x117c1a[_0x856c('0x22')]);})['then'](function(_0x145d20){logger[_0x856c('0xb')](util[_0x856c('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2539a6['id']));return _0x2539a6[_0x856c('0x1c')]({'sentiment':_0x145d20[_0x856c('0x2f')],'sPositive':_0x145d20[_0x856c('0x30')]['Positive'],'sNegative':_0x145d20[_0x856c('0x30')][_0x856c('0x32')],'sMixed':_0x145d20['SentimentScore'][_0x856c('0x33')],'sNeutral':_0x145d20[_0x856c('0x30')][_0x856c('0x38')],'transcribeStatus':_0x856c('0x15')});})[_0x856c('0x10')](function(){logger[_0x856c('0xb')](util[_0x856c('0xc')](_0x856c('0x34'),_0x2539a6['id']));_0x3dad74();});}})[_0x856c('0x39')](function(_0x2826d7){if(_0x2826d7){if(!_0x2826d7[_0x856c('0x3a')]||_0x2826d7[_0x856c('0x3a')]!==_0x856c('0x3b')){logger['error'](util[_0x856c('0xc')](_0x856c('0x3c'),_0x2539a6['id']),util[_0x856c('0x3d')](_0x2826d7,{'showHidden':![],'depth':null}));}}_0x3dad74();});});}function checkTranscribe(){var _0x9e9f27;var _0x23d403;var _0x24d009;return db['VoiceRecording'][_0x856c('0x3e')]({'where':{'transcribeStatus':_0x856c('0x3f')}})[_0x856c('0x10')](function(_0x28e0b4){if(!_0x28e0b4||!_0x28e0b4['length']){throw new db[(_0x856c('0x29'))]['ValidationError'](_0x856c('0x40'));}_0x9e9f27=_0x28e0b4;return db[_0x856c('0x41')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x30fa12){if(!_0x30fa12){throw new db['Sequelize']['ValidationError'](_0x856c('0x42'));}_0x23d403=_0x30fa12;if(!_0x23d403[_0x856c('0x6')]||!_0x23d403[_0x856c('0x43')]||!_0x23d403[_0x856c('0xf')]||!_0x23d403[_0x856c('0x22')]||!_0x23d403[_0x856c('0x23')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x44'));}return db[_0x856c('0x27')]['findOne']({'where':{'id':_0x23d403[_0x856c('0x43')]}});})[_0x856c('0x10')](function(_0x4b1955){if(!_0x4b1955){throw new db[(_0x856c('0x29'))]['ValidationError'](_0x856c('0x2a'));}if(!_0x4b1955['data1']||!_0x4b1955[_0x856c('0xe')]){throw new db[(_0x856c('0x29'))][(_0x856c('0x1e'))](_0x856c('0x2c'));}_0x24d009=_0x4b1955;var _0xb4e351=[];_0x9e9f27[_0x856c('0x45')](function(_0x5c38dc){_0xb4e351[_0x856c('0x46')](checkTranscribeJob(_0x5c38dc,_0x23d403,_0x24d009));});return BPromise[_0x856c('0x47')](_0xb4e351);})[_0x856c('0x39')](function(_0x200547){if(_0x200547){if(!_0x200547[_0x856c('0x3a')]||_0x200547[_0x856c('0x3a')]!==_0x856c('0x3b')){logger[_0x856c('0x48')](util[_0x856c('0x3d')](_0x200547,{'showHidden':![],'depth':null}));}}});}exports[_0x856c('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xaa5e=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3e6a45,_0x3ac4a6){var _0x152744=function(_0x1dc9d7){while(--_0x1dc9d7){_0x3e6a45['push'](_0x3e6a45['shift']());}};_0x152744(++_0x3ac4a6);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x17fa36,_0x308d81){_0x17fa36=_0x17fa36-0x0;var _0x10ad45=_0xaa5e[_0x17fa36];return _0x10ad45;};var _=require(_0xeaa5('0x0'));var AWS=require(_0xeaa5('0x1'));var rp=require('request-promise');var util=require(_0xeaa5('0x2'));var BPromise=require(_0xeaa5('0x3'));var db=require(_0xeaa5('0x4'))['db'];var logger=require(_0xeaa5('0x5'))(_0xeaa5('0x6'));function getTranscriptionJob(_0x5a1aca,_0x2c111f,_0xd64e9f,_0x33d376){return new Promise(function(_0x382868,_0x553f20){var _0x4d405e=new AWS[(_0xeaa5('0x7'))]({'accessKeyId':_0x2c111f,'secretAccessKey':_0x5a1aca,'region':_0xd64e9f});_0x4d405e[_0xeaa5('0x8')]({'TranscriptionJobName':_0x33d376},function(_0x50cb62,_0x2e35c3){if(_0x50cb62){return _0x553f20(_0x50cb62);}else{return _0x382868(_0x2e35c3);}});});}function sentiment(_0x404f3d,_0x55b4f1,_0x2e9ca6,_0x49682b,_0x2f5750){return new Promise(function(_0x3552ac,_0x503237){var _0x3e1c2e=new AWS[(_0xeaa5('0x9'))]({'accessKeyId':_0x55b4f1,'secretAccessKey':_0x404f3d,'region':_0x2e9ca6});_0x3e1c2e[_0xeaa5('0xa')]({'Text':_0x49682b,'LanguageCode':_0x2f5750[_0xeaa5('0xb')](0x0,0x2)},function(_0x260009,_0x6f18de){if(_0x260009){return _0x503237(_0x260009);}else{return _0x3552ac(_0x6f18de);}});});}function checkTranscribeJob(_0x119d7f,_0x2c3561,_0x123d6e){var _0x47a779;return new BPromise(function(_0x3ae823,_0x422a0e){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0xe'),_0x119d7f['id'],_0x119d7f['transcribeName']));return getTranscriptionJob(_0x123d6e[_0xeaa5('0xf')],_0x123d6e['data2'],_0x2c3561[_0xeaa5('0x10')],_0x119d7f[_0xeaa5('0x11')])[_0xeaa5('0x12')](function(_0x507fb4){logger[_0xeaa5('0xc')](util['format'](_0xeaa5('0x13'),_0x119d7f['id'],_0x119d7f[_0xeaa5('0x11')],_0x507fb4[_0xeaa5('0x14')]['TranscriptionJobStatus']));if(!_0x119d7f[_0xeaa5('0x15')]){switch(_0x507fb4['TranscriptionJob'][_0xeaa5('0x16')]){case _0xeaa5('0x17'):var _0x22f4d3={'transcribeStatus':_0x507fb4[_0xeaa5('0x14')]['TranscriptionJobStatus'],'fileUri':_0x507fb4[_0xeaa5('0x14')][_0xeaa5('0x18')][_0xeaa5('0x19')]};logger['info'](util[_0xeaa5('0xd')](_0xeaa5('0x1a'),_0x119d7f['id']));return rp({'uri':_0x507fb4[_0xeaa5('0x14')][_0xeaa5('0x18')][_0xeaa5('0x19')],'json':!![]})['then'](function(_0x3f081e){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x1b'),_0x119d7f['id']));if(_0x3f081e&&_0x3f081e[_0xeaa5('0x1c')]&&_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')]&&_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')][_0xeaa5('0x1e')]){_0x22f4d3[_0xeaa5('0x15')]='';for(var _0x2c4003=0x0;_0x2c4003<_0x3f081e[_0xeaa5('0x1c')][_0xeaa5('0x1d')][_0xeaa5('0x1e')];_0x2c4003++){_0x22f4d3[_0xeaa5('0x15')]+=_0x3f081e[_0xeaa5('0x1c')]['transcripts'][_0x2c4003][_0xeaa5('0x1f')]+'';}}return _0x119d7f[_0xeaa5('0x20')](_0x22f4d3);})['then'](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));if(!_0x119d7f[_0xeaa5('0x22')]){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x24'));}if(!_0x2c3561['sentiment']||!_0x2c3561[_0xeaa5('0x25')]||!_0x2c3561[_0xeaa5('0x26')]||!_0x2c3561[_0xeaa5('0x27')]||!_0x2c3561[_0xeaa5('0x28')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x22f4d3[_0xeaa5('0x15')]){throw new Error(_0xeaa5('0x2a'));}if(_0x2c3561['sentimentAccountId']===_0x123d6e['id']){return _0x123d6e;}else{return db[_0xeaa5('0x2b')]['findOne']({'where':{'id':_settings[_0xeaa5('0x25')]}});}})['then'](function(_0x5be25f){if(!_0x5be25f){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x2c'));}if(!_0x5be25f['data1']||!_0x5be25f[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2e'));}_0x47a779=_0x5be25f;logger['info'](util[_0xeaa5('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x119d7f['id']));return sentiment(_0x47a779['data1'],_0x47a779[_0xeaa5('0x2d')],_0x2c3561[_0xeaa5('0x26')],_0x22f4d3['fileText'],_0x2c3561[_0xeaa5('0x27')]);})[_0xeaa5('0x12')](function(_0x254d28){logger[_0xeaa5('0xc')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x119d7f['id']));return _0x119d7f[_0xeaa5('0x20')]({'sentiment':_0x254d28[_0xeaa5('0x2f')],'sPositive':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x31')],'sNegative':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x32')],'sMixed':_0x254d28[_0xeaa5('0x30')]['Mixed'],'sNeutral':_0x254d28[_0xeaa5('0x30')][_0xeaa5('0x33')]});})['then'](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x119d7f['id']));_0x3ae823();});case'FAILED':return _0x119d7f['update']({'transcribeStatus':_0xeaa5('0x34'),'failureReason':_0x507fb4['TranscriptionJob'][_0xeaa5('0x35')]})['then'](function(){logger['info'](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));_0x3ae823();});default:logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x36'),_0x119d7f['id']));break;}}else{return BPromise[_0xeaa5('0x37')]()['then'](function(){if(!_0x119d7f['tempSentiment']){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x24'));}if(!_0x2c3561[_0xeaa5('0x38')]||!_0x2c3561['sentimentAccountId']||!_0x2c3561[_0xeaa5('0x26')]||!_0x2c3561[_0xeaa5('0x27')]||!_0x2c3561[_0xeaa5('0x28')]){throw new db['Sequelize'][(_0xeaa5('0x29'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x119d7f[_0xeaa5('0x15')]){throw new Error(_0xeaa5('0x2a'));}if(_0x2c3561['sentimentAccountId']===_0x123d6e['id']){return _0x123d6e;}else{return db[_0xeaa5('0x2b')][_0xeaa5('0x39')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xeaa5('0x12')](function(_0x2445fb){if(!_0x2445fb){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2c'));}if(!_0x2445fb[_0xeaa5('0xf')]||!_0x2445fb[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))]('Cloud\x20Provider\x20not\x20configured');}_0x47a779=_0x2445fb;logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x3a'),_0x119d7f['id']));return sentiment(_0x47a779[_0xeaa5('0xf')],_0x47a779[_0xeaa5('0x2d')],_0x2c3561[_0xeaa5('0x26')],_0x119d7f['fileText'],_0x2c3561['language']);})[_0xeaa5('0x12')](function(_0x256e08){logger[_0xeaa5('0xc')](util['format'](_0xeaa5('0x3b'),_0x119d7f['id']));return _0x119d7f[_0xeaa5('0x20')]({'sentiment':_0x256e08[_0xeaa5('0x2f')],'sPositive':_0x256e08['SentimentScore'][_0xeaa5('0x31')],'sNegative':_0x256e08[_0xeaa5('0x30')][_0xeaa5('0x32')],'sMixed':_0x256e08['SentimentScore'][_0xeaa5('0x3c')],'sNeutral':_0x256e08[_0xeaa5('0x30')][_0xeaa5('0x33')],'transcribeStatus':_0xeaa5('0x17')});})[_0xeaa5('0x12')](function(){logger[_0xeaa5('0xc')](util[_0xeaa5('0xd')](_0xeaa5('0x21'),_0x119d7f['id']));_0x3ae823();});}})[_0xeaa5('0x3d')](function(_0x5d8712){if(_0x5d8712){if(!_0x5d8712[_0xeaa5('0x3e')]||_0x5d8712[_0xeaa5('0x3e')]!==_0xeaa5('0x3f')){logger[_0xeaa5('0x40')](util[_0xeaa5('0xd')](_0xeaa5('0x41'),_0x119d7f['id']),util[_0xeaa5('0x42')](_0x5d8712,{'showHidden':![],'depth':null}));}}_0x3ae823();});});}function checkTranscribe(){var _0x2d2509;var _0x159446;var _0x516368;return db[_0xeaa5('0x43')][_0xeaa5('0x44')]({'where':{'transcribeStatus':_0xeaa5('0x45')}})[_0xeaa5('0x12')](function(_0x53a0ac){if(!_0x53a0ac||!_0x53a0ac[_0xeaa5('0x1e')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x46'));}_0x2d2509=_0x53a0ac;return db['Setting'][_0xeaa5('0x39')]({'where':{'id':0x1}});})[_0xeaa5('0x12')](function(_0x3cb257){if(!_0x3cb257){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x47'));}_0x159446=_0x3cb257;if(!_0x159446['transcribe']||!_0x159446['transcribeAccountId']||!_0x159446[_0xeaa5('0x10')]||!_0x159446['language']||!_0x159446['bucket']){throw new db[(_0xeaa5('0x23'))]['ValidationError'](_0xeaa5('0x48'));}return db['CloudProvider']['findOne']({'where':{'id':_0x159446['transcribeAccountId']}});})[_0xeaa5('0x12')](function(_0x5559e8){if(!_0x5559e8){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2c'));}if(!_0x5559e8[_0xeaa5('0xf')]||!_0x5559e8[_0xeaa5('0x2d')]){throw new db[(_0xeaa5('0x23'))][(_0xeaa5('0x29'))](_0xeaa5('0x2e'));}_0x516368=_0x5559e8;var _0x1c22c6=[];_0x2d2509[_0xeaa5('0x49')](function(_0x5bf37b){_0x1c22c6[_0xeaa5('0x4a')](checkTranscribeJob(_0x5bf37b,_0x159446,_0x516368));});return BPromise[_0xeaa5('0x4b')](_0x1c22c6);})[_0xeaa5('0x3d')](function(_0x599a62){if(_0x599a62){if(!_0x599a62['name']||_0x599a62[_0xeaa5('0x3e')]!==_0xeaa5('0x3f')){logger[_0xeaa5('0x40')](util['inspect'](_0x599a62,{'showHidden':![],'depth':null}));}}});}exports[_0xeaa5('0x4c')]=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 3415531..9be5281 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 _0xc238=['format','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout'];(function(_0x2d4f37,_0x471870){var _0x3487a9=function(_0x3eb45f){while(--_0x3eb45f){_0x2d4f37['push'](_0x2d4f37['shift']());}};_0x3487a9(++_0x471870);}(_0xc238,0x172));var _0x8c23=function(_0x176b96,_0x293eb5){_0x176b96=_0x176b96-0x0;var _0x5ec209=_0xc238[_0x176b96];return _0x5ec209;};'use strict';var _=require(_0x8c23('0x0'));var moment=require('moment');var Redis=require(_0x8c23('0x1'));var util=require(_0x8c23('0x2'));var config=require(_0x8c23('0x3'));var db=require(_0x8c23('0x4'))['db'];var logger=require(_0x8c23('0x5'))(_0x8c23('0x6'));config['redis']=_[_0x8c23('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c23('0x8')]));function closeInteractions(){var _0x27c439=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x8c23('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8c23('0xa')](0x18,_0x8c23('0xb'))}}})[_0x8c23('0xc')](function(_0x38a9ab){if(_0x38a9ab&&_0x38a9ab[_0x8c23('0xd')]){_0x27c439=_[_0x8c23('0xe')](_0x38a9ab||[],'id');logger[_0x8c23('0xf')](_0x8c23('0x10'),_0x27c439[_0x8c23('0x11')]());return db[_0x8c23('0x12')][_0x8c23('0x13')]({'closeReason':_0x8c23('0x14'),'disposition':_0x8c23('0x15'),'closed':!![],'closedAt':moment()[_0x8c23('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x27c439}});}})[_0x8c23('0xc')](function(){if(_0x27c439&&_0x27c439[_0x8c23('0xd')]){logger[_0x8c23('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x27c439[_0x8c23('0x11')]());for(var _0x4cd26e=0x0;_0x4cd26e<_0x27c439['length'];_0x4cd26e++){io[_0x8c23('0x17')]('whatsappInteraction:update',{'id':_0x27c439[_0x4cd26e],'closed':!![]});}}})[_0x8c23('0x18')](function(_0x448b5b){logger['error'](_0x8c23('0x19'),_0x448b5b?util[_0x8c23('0x1a')](_0x448b5b,{'showHidden':![],'depth':null}):'');});}exports[_0x8c23('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe4bb=['hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../mysqldb','../logger','redis','defaults','socket.io-emitter','findAll','lastMsgAt','subtract'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe4bb,0x154));var _0xbe4b=function(_0x274893,_0xcb9961){_0x274893=_0x274893-0x0;var _0xe47e19=_0xe4bb[_0x274893];return _0xe47e19;};'use strict';var _=require(_0xbe4b('0x0'));var moment=require(_0xbe4b('0x1'));var Redis=require(_0xbe4b('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0xbe4b('0x3'))['db'];var logger=require(_0xbe4b('0x4'))('schedule');config[_0xbe4b('0x5')]=_[_0xbe4b('0x6')](config[_0xbe4b('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbe4b('0x7'))(new Redis(config[_0xbe4b('0x5')]));function closeInteractions(){var _0x2d15cf=[];return db['WhatsappInteraction'][_0xbe4b('0x8')]({'raw':!![],'attributes':['id',_0xbe4b('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xbe4b('0xa')](0x18,_0xbe4b('0xb'))}}})[_0xbe4b('0xc')](function(_0x15c635){if(_0x15c635&&_0x15c635[_0xbe4b('0xd')]){_0x2d15cf=_['map'](_0x15c635||[],'id');logger['info'](_0xbe4b('0xe'),_0x2d15cf[_0xbe4b('0xf')]());return db[_0xbe4b('0x10')][_0xbe4b('0x11')]({'closeReason':_0xbe4b('0x12'),'disposition':_0xbe4b('0x13'),'closed':!![],'closedAt':moment()['format'](_0xbe4b('0x14'))},{'where':{'id':_0x2d15cf}});}})['then'](function(){if(_0x2d15cf&&_0x2d15cf['length']){logger[_0xbe4b('0x15')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2d15cf[_0xbe4b('0xf')]());for(var _0x52b7f9=0x0;_0x52b7f9<_0x2d15cf[_0xbe4b('0xd')];_0x52b7f9++){io[_0xbe4b('0x16')]('whatsappInteraction:update',{'id':_0x2d15cf[_0x52b7f9],'closed':!![]});}}})[_0xbe4b('0x17')](function(_0x303ed6){logger[_0xbe4b('0x18')](_0xbe4b('0x19'),_0x303ed6?util[_0xbe4b('0x1a')](_0x303ed6,{'showHidden':![],'depth':null}):'');});}exports['start']=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 df6bd21..bda15d5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51a6=['catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','hopper1','contacts2'];(function(_0x24c963,_0x5f32a4){var _0x32a0eb=function(_0x3fd2eb){while(--_0x3fd2eb){_0x24c963['push'](_0x24c963['shift']());}};_0x32a0eb(++_0x5f32a4);}(_0x51a6,0x145));var _0x651a=function(_0x493dda,_0x1528d3){_0x493dda=_0x493dda-0x0;var _0x31a5a6=_0x51a6[_0x493dda];return _0x31a5a6;};'use strict';var util=require(_0x651a('0x0'));var db=require(_0x651a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x651a('0x2')]({'id':i,'firstName':_0x651a('0x3')+i,'lastName':_0x651a('0x4')+i,'phone':0xf879fb460+i,'email':_0x651a('0x5')+i+_0x651a('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x651a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x651a('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x651a('0x7')](),'updatedAt':Date[_0x651a('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x651a('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x651a('0x5')+i+_0x651a('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x651a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x651a('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x651a('0x7')](),'updatedAt':Date['now']()});}db[_0x651a('0x8')][_0x651a('0x9')]({'where':{}})['then'](function(){return db[_0x651a('0x8')]['bulkCreate'](contacts);})[_0x651a('0xa')](function(){console[_0x651a('0xb')](_0x651a('0xc'),'contacts1');return db[_0x651a('0xd')][_0x651a('0x9')]({'where':{}});})[_0x651a('0xa')](function(){return db[_0x651a('0xd')][_0x651a('0xe')](hopper);})[_0x651a('0xa')](function(){console['log'](_0x651a('0xc'),_0x651a('0xf'));return db['CmContact'][_0x651a('0xe')](contacts2);})[_0x651a('0xa')](function(){console[_0x651a('0xb')](_0x651a('0xc'),_0x651a('0x10'));return db['CmHopper'][_0x651a('0xe')](hopper2);})[_0x651a('0xa')](function(){console[_0x651a('0xb')]('finished\x20populating','hopper2');})[_0x651a('0x11')](function(_0x568582){console[_0x651a('0xb')](_0x568582);}); \ No newline at end of file +var _0xb8b1=['../mysqldb','Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','hopper2','catch'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xb8b1,0x110));var _0x1b8b=function(_0x7460d8,_0x2fc1a1){_0x7460d8=_0x7460d8-0x0;var _0x338f82=_0xb8b1[_0x7460d8];return _0x338f82;};'use strict';var util=require('util');var db=require(_0x1b8b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1b8b('0x1')+i,'lastName':_0x1b8b('0x2')+i,'phone':0xf879fb460+i,'email':_0x1b8b('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1b8b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x1b8b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1b8b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1b8b('0x2')+i,'phone':0xf879fb460+i,'email':_0x1b8b('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1b8b('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x1b8b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1b8b('0x5')](),'updatedAt':Date[_0x1b8b('0x5')]()});}db[_0x1b8b('0x6')][_0x1b8b('0x7')]({'where':{}})['then'](function(){return db[_0x1b8b('0x6')][_0x1b8b('0x8')](contacts);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')]('finished\x20populating',_0x1b8b('0xb'));return db[_0x1b8b('0xc')][_0x1b8b('0x7')]({'where':{}});})[_0x1b8b('0x9')](function(){return db[_0x1b8b('0xc')][_0x1b8b('0x8')](hopper);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')]('finished\x20populating','hopper1');return db[_0x1b8b('0x6')][_0x1b8b('0x8')](contacts2);})[_0x1b8b('0x9')](function(){console[_0x1b8b('0xa')](_0x1b8b('0xd'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x1b8b('0xa')](_0x1b8b('0xd'),_0x1b8b('0xe'));})[_0x1b8b('0xf')](function(_0x1cb328){console[_0x1b8b('0xa')](_0x1cb328);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 89b74c9..440e256 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c62=['ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','all'];(function(_0x41f9df,_0x341fbe){var _0x1caec1=function(_0x13e119){while(--_0x13e119){_0x41f9df['push'](_0x41f9df['shift']());}};_0x1caec1(++_0x341fbe);}(_0x2c62,0x1ee));var _0x22c6=function(_0x5eff72,_0x13380a){_0x5eff72=_0x5eff72-0x0;var _0xbd79e2=_0x2c62[_0x5eff72];return _0xbd79e2;};'use strict';var util=require(_0x22c6('0x0'));var db=require(_0x22c6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x22c6('0x2'),_0x22c6('0x3'),i),'fullname':util[_0x22c6('0x4')](_0x22c6('0x2'),_0x22c6('0x3'),i),'email':util[_0x22c6('0x4')](_0x22c6('0x5'),_0x22c6('0x3'),i),'role':_0x22c6('0x3'),'password':_0x22c6('0x6'),'internal':0xfa0+i,'type':_0x22c6('0x7'),'transport':[_0x22c6('0x8'),'ws','wss'],'disallow':[_0x22c6('0x9')],'allow':[_0x22c6('0xa')],'defaultuser':util[_0x22c6('0x4')](_0x22c6('0x2'),_0x22c6('0x3'),i),'encryption':_0x22c6('0xb'),'avpf':_0x22c6('0xb'),'force_avp':'yes','icesupport':_0x22c6('0xb'),'dtlsenable':_0x22c6('0xb'),'dtlsverify':'no','dtlscertfile':_0x22c6('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x22c6('0xd'),'callerid':util['format'](_0x22c6('0xe'),util['format'](_0x22c6('0x2'),_0x22c6('0x3'),i),0xfa0+i)});}db[_0x22c6('0xf')][_0x22c6('0x10')](users)[_0x22c6('0x11')](function(){console[_0x22c6('0x12')](_0x22c6('0x13'));})[_0x22c6('0x14')](function(_0x23b0c0){console[_0x22c6('0x12')](_0x23b0c0);}); \ No newline at end of file +var _0xa15e=['format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','log','add\x20user','push','%s%s','agent'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa15e,0x1a6));var _0xea15=function(_0x25f693,_0x55ba5c){_0x25f693=_0x25f693-0x0;var _0x473583=_0xa15e[_0x25f693];return _0x473583;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xea15('0x0')]({'name':util['format'](_0xea15('0x1'),'agent',i),'fullname':util['format'](_0xea15('0x1'),_0xea15('0x2'),i),'email':util[_0xea15('0x3')](_0xea15('0x4'),_0xea15('0x2'),i),'role':_0xea15('0x2'),'password':_0xea15('0x5'),'internal':0xfa0+i,'type':_0xea15('0x6'),'transport':[_0xea15('0x7'),'ws',_0xea15('0x8')],'disallow':[_0xea15('0x9')],'allow':[_0xea15('0xa')],'defaultuser':util['format']('%s%s','agent',i),'encryption':_0xea15('0xb'),'avpf':_0xea15('0xb'),'force_avp':_0xea15('0xb'),'icesupport':_0xea15('0xb'),'dtlsenable':_0xea15('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xea15('0xc'),'dtlssetup':_0xea15('0xd'),'callerid':util['format'](_0xea15('0xe'),util[_0xea15('0x3')](_0xea15('0x1'),_0xea15('0x2'),i),0xfa0+i)});}db['User']['bulkCreate'](users)['then'](function(){console[_0xea15('0xf')](_0xea15('0x10'));})['catch'](function(_0x30bd91){console[_0xea15('0xf')](_0x30bd91);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 133803d..04a6a08 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9eb=['Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','format','handshake','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','WhatsappQueue','user','userProfileId','FaxQueue','MailQueues','MailQueue','OpenchannelQueue','Trunk','voice:inbound','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','remoteAddress','request','connection','remotePort','connectedAt','SocketIO\x20','address','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0xd9eb,0xca));var _0xbd9e=function(_0x5a7282,_0xa6e195){_0x5a7282=_0x5a7282-0x0;var _0x4928ec=_0xd9eb[_0x5a7282];return _0x4928ec;};'use strict';var _=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var BPromise=require(_0xbd9e('0x2'));var db=require(_0xbd9e('0x3'))['db'];var config=require(_0xbd9e('0x4'));var queryQueues={'attributes':['id',_0xbd9e('0x5')],'include':[{'as':_0xbd9e('0x6'),'model':db[_0xbd9e('0x7')],'attributes':['id',_0xbd9e('0x5'),_0xbd9e('0x8')],'raw':!![],'where':{'role':_0xbd9e('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbd9e('0x5')],'where':{'role':_0xbd9e('0xa')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xbd9e('0x5')],'where':{'role':_0xbd9e('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbd9e('0x5'),_0xbd9e('0xb')],'where':{'type':_0xbd9e('0xc')}};function getAssociatedResources(_0x7755b8,_0x131530,_0x82e476){return db[_0xbd9e('0xd')][_0xbd9e('0xe')]({'where':{'name':_0x7755b8,'userProfileId':_0x131530},'raw':!![]})[_0xbd9e('0xf')](function(_0x1e3c0b){if(_0x1e3c0b){if(_0x1e3c0b['autoAssociation']){switch(_0x7755b8){case _0xbd9e('0x10'):case _0xbd9e('0x11'):case'FaxQueues':case _0xbd9e('0x12'):case'MailQueues':case _0xbd9e('0x13'):case _0xbd9e('0x14'):return db[_0x82e476][_0xbd9e('0x15')](queryQueues);case _0xbd9e('0x16'):return db[_0x82e476][_0xbd9e('0x15')](queryTelephones);case _0xbd9e('0x17'):return db[_0x82e476][_0xbd9e('0x15')](queryTrunks);case _0xbd9e('0x18'):return db[_0x82e476]['findAll'](queryCampaigns);}}else{return db[_0xbd9e('0x19')][_0xbd9e('0x15')]({'attributes':[_0xbd9e('0x1a')],'where':{'sectionId':_0x1e3c0b['id']},'raw':!![]})[_0xbd9e('0xf')](function(_0x243802){if(_0x243802){var _0x339d79={'where':{'id':_[_0xbd9e('0x1b')](_0x243802,_0xbd9e('0x1a'))},'raw':!![]};switch(_0x82e476){case _0xbd9e('0x7'):_0x339d79[_0xbd9e('0x1c')][_0xbd9e('0x8')]='telephone';break;case _0xbd9e('0x1d'):_0x339d79[_0xbd9e('0x1c')][_0xbd9e('0xb')]=_0xbd9e('0xc');break;}return db[_0x82e476][_0xbd9e('0x15')](_0x339d79);}else{return[];}});}}else{return[];}})['then'](function(_0x5bf755){return _0x5bf755;});}function joinOrLeaveQueues(_0x36bdc1,_0x37e6d8,_0xb9ff26,_0x1165e0){_0x36bdc1[_0x37e6d8](util['format'](_0xbd9e('0x1e'),_0xb9ff26,_0x1165e0['name']));if(_0x1165e0['Agents']){for(var _0x30d92f=0x0;_0x30d92f<_0x1165e0[_0xbd9e('0x6')][_0xbd9e('0x1f')];_0x30d92f+=0x1){_0x36bdc1[_0x37e6d8](util[_0xbd9e('0x20')]('user:%s',_0x1165e0[_0xbd9e('0x6')][_0x30d92f][_0xbd9e('0x5')]));}}}function joinOrLeave(_0x4e53cd,_0x4efbe2,_0x2733cb){var _0x2957d1;if(_0x4e53cd[_0xbd9e('0x21')][_0xbd9e('0x22')]['id']){db['User']['find']({'attributes':['id','name',_0xbd9e('0x8'),'userProfileId'],'where':{'id':_0x4e53cd[_0xbd9e('0x21')]['query']['id']},'include':[{'model':db[_0xbd9e('0x23')],'as':_0xbd9e('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xbd9e('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd9e('0x26')],'as':_0xbd9e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd9e('0x28')],'as':_0xbd9e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xbd9e('0x2a')],'as':_0xbd9e('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xbd9e('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x33d152){if(_0x33d152){_0x2957d1=_0x33d152;_0x4e53cd[_0x4efbe2](util['format'](_0xbd9e('0x2d'),_0x33d152[_0xbd9e('0x5')]));var _0x5485ec=[];switch(_0x33d152[_0xbd9e('0x8')]){case _0xbd9e('0x2e'):_0x4e53cd[_0x4efbe2]('voice:inbound');_0x4e53cd[_0x4efbe2](_0xbd9e('0x2f'));if(queryQueues[_0xbd9e('0x30')]('include')){delete queryQueues[_0xbd9e('0x31')];}_0x5485ec[_0xbd9e('0x32')](db[_0xbd9e('0x33')]['findAll'](queryQueues));_0x5485ec[_0xbd9e('0x32')](db[_0xbd9e('0x34')][_0xbd9e('0x15')](queryQueues));_0x5485ec[_0xbd9e('0x32')](db['FaxQueue']['findAll'](queryQueues));_0x5485ec['push'](db[_0xbd9e('0x35')]['findAll'](queryQueues));_0x5485ec[_0xbd9e('0x32')](db['MailQueue']['findAll'](queryQueues));_0x5485ec[_0xbd9e('0x32')](db['OpenchannelQueue'][_0xbd9e('0x15')](queryQueues));_0x5485ec[_0xbd9e('0x32')](db[_0xbd9e('0x36')][_0xbd9e('0x15')](queryQueues));_0x5485ec[_0xbd9e('0x32')](db[_0xbd9e('0x7')]['findAll'](queryTelephones));_0x5485ec[_0xbd9e('0x32')](db['Trunk'][_0xbd9e('0x15')](queryTrunks));_0x5485ec['push'](db['Campaign']['findAll'](queryCampaigns));_0x5485ec[_0xbd9e('0x32')](db['User']['findAll'](queryAgents));break;case _0xbd9e('0x37'):_0x4e53cd[_0x4efbe2]('voice:inbound');_0x4e53cd[_0x4efbe2](_0xbd9e('0x2f'));_0x5485ec['push'](getAssociatedResources(_0xbd9e('0x10'),_0x33d152[_0xbd9e('0x38')],_0xbd9e('0x33')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x11'),_0x33d152['userProfileId'],_0xbd9e('0x34')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources('FaxQueues',_0x33d152[_0xbd9e('0x38')],_0xbd9e('0x39')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x12'),_0x33d152[_0xbd9e('0x38')],'SmsQueue'));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x3a'),_0x33d152[_0xbd9e('0x38')],_0xbd9e('0x3b')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x13'),_0x33d152['userProfileId'],_0xbd9e('0x3c')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x14'),_0x33d152['userProfileId'],_0xbd9e('0x36')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources('Telephones',_0x33d152['userProfileId'],'User'));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x17'),_0x33d152['userProfileId'],_0xbd9e('0x3d')));_0x5485ec[_0xbd9e('0x32')](getAssociatedResources(_0xbd9e('0x18'),_0x33d152[_0xbd9e('0x38')],_0xbd9e('0x1d')));_0x5485ec[_0xbd9e('0x32')](db[_0xbd9e('0x7')][_0xbd9e('0x15')](queryAgents));break;case'agent':_0x4e53cd[_0x4efbe2](_0xbd9e('0x3e'));_0x4e53cd[_0x4efbe2](_0xbd9e('0x2f'));_0x5485ec[_0xbd9e('0x32')](_0x33d152[_0xbd9e('0x3f')]({'attributes':['id','name']}));_0x5485ec['push'](_0x33d152[_0xbd9e('0x40')]({'attributes':['id',_0xbd9e('0x5')]}));_0x5485ec['push'](_0x33d152[_0xbd9e('0x41')]({'attributes':['id','name']}));_0x5485ec[_0xbd9e('0x32')](_0x33d152[_0xbd9e('0x42')]({'attributes':['id','name']}));_0x5485ec['push'](_0x33d152['getMailQueues']({'attributes':['id',_0xbd9e('0x5')]}));_0x5485ec[_0xbd9e('0x32')](_0x33d152[_0xbd9e('0x43')]({'attributes':['id',_0xbd9e('0x5')]}));_0x5485ec[_0xbd9e('0x32')](_0x33d152[_0xbd9e('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0xbd9e('0x45')](_0x5485ec);}})['then'](function(_0x53c961){if(_0x53c961&&_0x53c961[_0xbd9e('0x1f')]){for(var _0x9e55e7=0x0;_0x9e55e7<_0x53c961[_0xbd9e('0x1f')];_0x9e55e7+=0x1){for(var _0x5c8485=0x0;_0x5c8485<_0x53c961[_0x9e55e7][_0xbd9e('0x1f')];_0x5c8485+=0x1){switch(_0x9e55e7){case 0x0:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,_0xbd9e('0x46'),_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x1:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,_0xbd9e('0x47'),_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x2:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,'fax',_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x3:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,_0xbd9e('0x48'),_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x4:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,'mail',_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x5:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,_0xbd9e('0x49'),_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x6:joinOrLeaveQueues(_0x4e53cd,_0x4efbe2,_0xbd9e('0x4a'),_0x53c961[_0x9e55e7][_0x5c8485]);break;case 0x7:if(_0x2957d1[_0xbd9e('0x8')]!==_0xbd9e('0x9'))_0x4e53cd[_0x4efbe2](util[_0xbd9e('0x20')](_0xbd9e('0x4b'),_0x53c961[_0x9e55e7][_0x5c8485][_0xbd9e('0x5')]));break;case 0x8:if(_0x2957d1[_0xbd9e('0x8')]!==_0xbd9e('0x9'))_0x4e53cd[_0x4efbe2](util[_0xbd9e('0x20')](_0xbd9e('0x4c'),_0x53c961[_0x9e55e7][_0x5c8485][_0xbd9e('0x5')]));break;case 0x9:if(_0x2957d1[_0xbd9e('0x8')]!=='agent')_0x4e53cd[_0x4efbe2](util[_0xbd9e('0x20')](_0xbd9e('0x4d'),_0x53c961[_0x9e55e7][_0x5c8485][_0xbd9e('0xb')],_0x53c961[_0x9e55e7][_0x5c8485][_0xbd9e('0x5')]));break;case 0xa:_0x4e53cd[_0x4efbe2](util[_0xbd9e('0x20')](_0xbd9e('0x2d'),_0x53c961[_0x9e55e7][_0x5c8485][_0xbd9e('0x5')]));break;}}}}})[_0xbd9e('0xf')](function(){if(_0x4efbe2==='leave'){var _0x4c56e5=_[_0xbd9e('0x1b')](_0x2957d1[_0xbd9e('0x24')],'id');return _0x2957d1[_0xbd9e('0x4e')](_0x4c56e5)[_0xbd9e('0xf')](function(){for(var _0x328799=0x0;_0x328799<_0x4c56e5['length'];_0x328799+=0x1){_0x2733cb[_0xbd9e('0x4f')](_0xbd9e('0x50'),{'ChatInteractionId':Number(_0x4c56e5[_0x328799]),'UserId':Number(_0x2957d1['id'])});}});}})['then'](function(){if(_0x4efbe2===_0xbd9e('0x51')){var _0x15c9c6=_[_0xbd9e('0x1b')](_0x2957d1[_0xbd9e('0x25')],'id');return _0x2957d1[_0xbd9e('0x52')](_0x15c9c6)[_0xbd9e('0xf')](function(){for(var _0x81363f=0x0;_0x81363f<_0x15c9c6['length'];_0x81363f+=0x1){_0x2733cb['emit'](_0xbd9e('0x53'),{'MailInteractionId':Number(_0x15c9c6[_0x81363f]),'UserId':Number(_0x2957d1['id'])});}});}})[_0xbd9e('0xf')](function(){if(_0x4efbe2===_0xbd9e('0x51')){var _0x1f5fa6=_[_0xbd9e('0x1b')](_0x2957d1[_0xbd9e('0x27')],'id');return _0x2957d1[_0xbd9e('0x54')](_0x1f5fa6)[_0xbd9e('0xf')](function(){for(var _0x512ec7=0x0;_0x512ec7<_0x1f5fa6[_0xbd9e('0x1f')];_0x512ec7+=0x1){_0x2733cb[_0xbd9e('0x4f')](_0xbd9e('0x55'),{'FaxInteractionId':Number(_0x1f5fa6[_0x512ec7]),'UserId':Number(_0x2957d1['id'])});}});}})[_0xbd9e('0xf')](function(){if(_0x4efbe2===_0xbd9e('0x51')){var _0x9a6dfe=_[_0xbd9e('0x1b')](_0x2957d1[_0xbd9e('0x29')],'id');return _0x2957d1[_0xbd9e('0x56')](_0x9a6dfe)[_0xbd9e('0xf')](function(){for(var _0x530b17=0x0;_0x530b17<_0x9a6dfe[_0xbd9e('0x1f')];_0x530b17+=0x1){_0x2733cb['emit'](_0xbd9e('0x57'),{'SmsInteractionId':Number(_0x9a6dfe[_0x530b17]),'UserId':Number(_0x2957d1['id'])});}});}})['then'](function(){if(_0x4efbe2==='leave'){var _0x58bc0a=_[_0xbd9e('0x1b')](_0x2957d1['OpenchannelInteractions'],'id');return _0x2957d1[_0xbd9e('0x58')](_0x58bc0a)[_0xbd9e('0xf')](function(){for(var _0x3dcd10=0x0;_0x3dcd10<_0x58bc0a[_0xbd9e('0x1f')];_0x3dcd10+=0x1){_0x2733cb[_0xbd9e('0x4f')](_0xbd9e('0x59'),{'OpenchannelInteractionId':Number(_0x58bc0a[_0x3dcd10]),'UserId':Number(_0x2957d1['id'])});}});}})[_0xbd9e('0xf')](function(){if(_0x4efbe2===_0xbd9e('0x51')){var _0x4754d3=_['map'](_0x2957d1['WhatsappInteractions'],'id');return _0x2957d1[_0xbd9e('0x5a')](_0x4754d3)[_0xbd9e('0xf')](function(){for(var _0x2fb385=0x0;_0x2fb385<_0x4754d3[_0xbd9e('0x1f')];_0x2fb385+=0x1){_0x2733cb[_0xbd9e('0x4f')](_0xbd9e('0x5b'),{'WhatsappInteractionId':Number(_0x4754d3[_0x2fb385]),'UserId':Number(_0x2957d1['id'])});}});}})[_0xbd9e('0x5c')](function(_0x4e9056){_0x4e53cd[_0xbd9e('0x5d')](_0x4e9056);});}}function onDisconnect(_0x52e794,_0x34b792){joinOrLeave(_0x52e794,_0xbd9e('0x51'),_0x34b792);}function onConnect(_0x3b8566){joinOrLeave(_0x3b8566,_0xbd9e('0x5e'));}exports[_0xbd9e('0x5f')]=function(_0x467868){_0x467868['on']('connection',function(_0x5b0222){_0x5b0222['setMaxListeners'](0x0);_0x5b0222['address']=_0x5b0222['request']['connection'][_0xbd9e('0x60')]+':'+_0x5b0222[_0xbd9e('0x61')][_0xbd9e('0x62')][_0xbd9e('0x63')];_0x5b0222[_0xbd9e('0x64')]=new Date();_0x5b0222[_0xbd9e('0x5d')]=function(_0x508e86){console[_0xbd9e('0x5d')](_0xbd9e('0x65')+_0x5b0222['nsp'][_0xbd9e('0x5')]+'['+_0x5b0222[_0xbd9e('0x66')]+']',_0x508e86);};_0x5b0222['on']('disconnect',function(){onDisconnect(_0x5b0222,_0x467868);_0x5b0222[_0xbd9e('0x5d')](_0xbd9e('0x67'));});onConnect(_0x5b0222);_0x5b0222[_0xbd9e('0x5d')]('CONNECTED');});}; \ No newline at end of file +var _0x1107=['log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','%s:queue:%s','length','format','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','user','voice:outbound','VoiceQueue','ChatQueue','voice:inbound','getChatQueues','getFaxQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch'];(function(_0xe2fe4a,_0x5955f0){var _0x528ec3=function(_0x167a15){while(--_0x167a15){_0xe2fe4a['push'](_0xe2fe4a['shift']());}};_0x528ec3(++_0x5955f0);}(_0x1107,0xd8));var _0x7110=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x1107[_0x11b58d];return _0xc2811b;};'use strict';var _=require(_0x7110('0x0'));var util=require(_0x7110('0x1'));var BPromise=require(_0x7110('0x2'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7110('0x3')],'include':[{'as':_0x7110('0x4'),'model':db['User'],'attributes':['id',_0x7110('0x3'),_0x7110('0x5')],'raw':!![],'where':{'role':_0x7110('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7110('0x3')],'where':{'role':_0x7110('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7110('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7110('0x3')],'where':{'role':_0x7110('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7110('0x3'),_0x7110('0x8')],'where':{'type':_0x7110('0x9')}};function getAssociatedResources(_0x466351,_0x271466,_0x4960b1){return db[_0x7110('0xa')]['findOne']({'where':{'name':_0x466351,'userProfileId':_0x271466},'raw':!![]})[_0x7110('0xb')](function(_0x19d729){if(_0x19d729){if(_0x19d729['autoAssociation']){switch(_0x466351){case _0x7110('0xc'):case _0x7110('0xd'):case _0x7110('0xe'):case _0x7110('0xf'):case _0x7110('0x10'):case _0x7110('0x11'):case _0x7110('0x12'):return db[_0x4960b1][_0x7110('0x13')](queryQueues);case _0x7110('0x14'):return db[_0x4960b1]['findAll'](queryTelephones);case _0x7110('0x15'):return db[_0x4960b1]['findAll'](queryTrunks);case _0x7110('0x16'):return db[_0x4960b1]['findAll'](queryCampaigns);}}else{return db[_0x7110('0x17')][_0x7110('0x13')]({'attributes':[_0x7110('0x18')],'where':{'sectionId':_0x19d729['id']},'raw':!![]})[_0x7110('0xb')](function(_0x26fe8a){if(_0x26fe8a){var _0x1a8f7f={'where':{'id':_[_0x7110('0x19')](_0x26fe8a,'resourceId')},'raw':!![]};switch(_0x4960b1){case _0x7110('0x1a'):_0x1a8f7f['where'][_0x7110('0x5')]=_0x7110('0x7');break;case'Campaign':_0x1a8f7f[_0x7110('0x1b')][_0x7110('0x8')]=_0x7110('0x9');break;}return db[_0x4960b1]['findAll'](_0x1a8f7f);}else{return[];}});}}else{return[];}})['then'](function(_0x25cc51){return _0x25cc51;});}function joinOrLeaveQueues(_0x13c8ea,_0x388c84,_0x21cc2e,_0x2adfc7){_0x13c8ea[_0x388c84](util['format'](_0x7110('0x1c'),_0x21cc2e,_0x2adfc7[_0x7110('0x3')]));if(_0x2adfc7[_0x7110('0x4')]){for(var _0x264250=0x0;_0x264250<_0x2adfc7[_0x7110('0x4')][_0x7110('0x1d')];_0x264250+=0x1){_0x13c8ea[_0x388c84](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x2adfc7['Agents'][_0x264250][_0x7110('0x3')]));}}}function joinOrLeave(_0x5e22d9,_0x3bd510,_0xcf45c){var _0x2373b4;if(_0x5e22d9[_0x7110('0x20')]['query']['id']){db[_0x7110('0x1a')][_0x7110('0x21')]({'attributes':['id',_0x7110('0x3'),'role',_0x7110('0x22')],'where':{'id':_0x5e22d9['handshake']['query']['id']},'include':[{'model':db[_0x7110('0x23')],'as':_0x7110('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x25')],'as':_0x7110('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x7110('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x28')],'as':_0x7110('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x2a')],'as':_0x7110('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x7110('0x2c')],'as':_0x7110('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x7110('0xb')](function(_0x1b163a){if(_0x1b163a){_0x2373b4=_0x1b163a;_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x1b163a[_0x7110('0x3')]));var _0x5aedc2=[];switch(_0x1b163a['role']){case _0x7110('0x2e'):_0x5e22d9[_0x3bd510]('voice:inbound');_0x5e22d9[_0x3bd510]('voice:outbound');if(queryQueues[_0x7110('0x2f')](_0x7110('0x30'))){delete queryQueues['include'];}_0x5aedc2[_0x7110('0x31')](db['VoiceQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db['ChatQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x32')]['findAll'](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x33')][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x34')][_0x7110('0x13')](queryQueues));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x35')][_0x7110('0x13')](queryQueues));_0x5aedc2['push'](db['WhatsappQueue'][_0x7110('0x13')](queryQueues));_0x5aedc2['push'](db[_0x7110('0x1a')][_0x7110('0x13')](queryTelephones));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x36')]['findAll'](queryTrunks));_0x5aedc2['push'](db[_0x7110('0x37')]['findAll'](queryCampaigns));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x1a')]['findAll'](queryAgents));break;case _0x7110('0x38'):_0x5e22d9[_0x3bd510]('voice:inbound');_0x5e22d9[_0x3bd510](_0x7110('0x39'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xc'),_0x1b163a[_0x7110('0x22')],_0x7110('0x3a')));_0x5aedc2['push'](getAssociatedResources(_0x7110('0xd'),_0x1b163a[_0x7110('0x22')],_0x7110('0x3b')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xe'),_0x1b163a[_0x7110('0x22')],'FaxQueue'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0xf'),_0x1b163a[_0x7110('0x22')],'SmsQueue'));_0x5aedc2['push'](getAssociatedResources('MailQueues',_0x1b163a[_0x7110('0x22')],_0x7110('0x34')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0x11'),_0x1b163a['userProfileId'],_0x7110('0x35')));_0x5aedc2[_0x7110('0x31')](getAssociatedResources('WhatsappQueues',_0x1b163a[_0x7110('0x22')],'WhatsappQueue'));_0x5aedc2['push'](getAssociatedResources('Telephones',_0x1b163a[_0x7110('0x22')],'User'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources(_0x7110('0x15'),_0x1b163a[_0x7110('0x22')],'Trunk'));_0x5aedc2[_0x7110('0x31')](getAssociatedResources('IvrCampaigns',_0x1b163a[_0x7110('0x22')],_0x7110('0x37')));_0x5aedc2[_0x7110('0x31')](db[_0x7110('0x1a')][_0x7110('0x13')](queryAgents));break;case _0x7110('0x6'):_0x5e22d9[_0x3bd510](_0x7110('0x3c'));_0x5e22d9[_0x3bd510]('voice:outbound');_0x5aedc2[_0x7110('0x31')](_0x1b163a['getVoiceQueues']({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2['push'](_0x1b163a[_0x7110('0x3d')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2['push'](_0x1b163a[_0x7110('0x3e')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getSmsQueues']({'attributes':['id','name']}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getMailQueues']({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a[_0x7110('0x3f')]({'attributes':['id',_0x7110('0x3')]}));_0x5aedc2[_0x7110('0x31')](_0x1b163a['getWhatsappQueues']({'attributes':['id',_0x7110('0x3')]}));break;}return BPromise[_0x7110('0x40')](_0x5aedc2);}})[_0x7110('0xb')](function(_0x15b2ca){if(_0x15b2ca&&_0x15b2ca['length']){for(var _0x1bb7f3=0x0;_0x1bb7f3<_0x15b2ca[_0x7110('0x1d')];_0x1bb7f3+=0x1){for(var _0x4ca881=0x0;_0x4ca881<_0x15b2ca[_0x1bb7f3]['length'];_0x4ca881+=0x1){switch(_0x1bb7f3){case 0x0:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x41'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x1:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x42'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x2:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x43'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x3:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x44'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x4:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x45'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x5:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,'openchannel',_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x6:joinOrLeaveQueues(_0x5e22d9,_0x3bd510,_0x7110('0x46'),_0x15b2ca[_0x1bb7f3][_0x4ca881]);break;case 0x7:if(_0x2373b4['role']!==_0x7110('0x6'))_0x5e22d9[_0x3bd510](util['format'](_0x7110('0x47'),_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x3')]));break;case 0x8:if(_0x2373b4[_0x7110('0x5')]!=='agent')_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x48'),_0x15b2ca[_0x1bb7f3][_0x4ca881]['name']));break;case 0x9:if(_0x2373b4[_0x7110('0x5')]!==_0x7110('0x6'))_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x49'),_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x8')],_0x15b2ca[_0x1bb7f3][_0x4ca881][_0x7110('0x3')]));break;case 0xa:_0x5e22d9[_0x3bd510](util[_0x7110('0x1e')](_0x7110('0x1f'),_0x15b2ca[_0x1bb7f3][_0x4ca881]['name']));break;}}}}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x29ffe6=_[_0x7110('0x19')](_0x2373b4['ChatInteractions'],'id');return _0x2373b4['removeChatInteractions'](_0x29ffe6)[_0x7110('0xb')](function(){for(var _0x26976d=0x0;_0x26976d<_0x29ffe6[_0x7110('0x1d')];_0x26976d+=0x1){_0xcf45c[_0x7110('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x29ffe6[_0x26976d]),'UserId':Number(_0x2373b4['id'])});}});}})['then'](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x3d7ad6=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x26')],'id');return _0x2373b4[_0x7110('0x4c')](_0x3d7ad6)[_0x7110('0xb')](function(){for(var _0xa28592=0x0;_0xa28592<_0x3d7ad6['length'];_0xa28592+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x4d'),{'MailInteractionId':Number(_0x3d7ad6[_0xa28592]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510==='leave'){var _0x106ea4=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x27')],'id');return _0x2373b4[_0x7110('0x4e')](_0x106ea4)[_0x7110('0xb')](function(){for(var _0x5c9b76=0x0;_0x5c9b76<_0x106ea4[_0x7110('0x1d')];_0x5c9b76+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x4f'),{'FaxInteractionId':Number(_0x106ea4[_0x5c9b76]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x2102fd=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x29')],'id');return _0x2373b4[_0x7110('0x50')](_0x2102fd)[_0x7110('0xb')](function(){for(var _0x64b6df=0x0;_0x64b6df<_0x2102fd['length'];_0x64b6df+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x51'),{'SmsInteractionId':Number(_0x2102fd[_0x64b6df]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x9f41ab=_[_0x7110('0x19')](_0x2373b4['OpenchannelInteractions'],'id');return _0x2373b4[_0x7110('0x52')](_0x9f41ab)[_0x7110('0xb')](function(){for(var _0x444025=0x0;_0x444025<_0x9f41ab[_0x7110('0x1d')];_0x444025+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x53'),{'OpenchannelInteractionId':Number(_0x9f41ab[_0x444025]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0xb')](function(){if(_0x3bd510===_0x7110('0x4a')){var _0x3b17b4=_[_0x7110('0x19')](_0x2373b4[_0x7110('0x2d')],'id');return _0x2373b4[_0x7110('0x54')](_0x3b17b4)[_0x7110('0xb')](function(){for(var _0xfb36c1=0x0;_0xfb36c1<_0x3b17b4[_0x7110('0x1d')];_0xfb36c1+=0x1){_0xcf45c[_0x7110('0x4b')](_0x7110('0x55'),{'WhatsappInteractionId':Number(_0x3b17b4[_0xfb36c1]),'UserId':Number(_0x2373b4['id'])});}});}})[_0x7110('0x56')](function(_0x364a42){_0x5e22d9[_0x7110('0x57')](_0x364a42);});}}function onDisconnect(_0xb8f1d7,_0x5ec978){joinOrLeave(_0xb8f1d7,_0x7110('0x4a'),_0x5ec978);}function onConnect(_0x1112f7){joinOrLeave(_0x1112f7,_0x7110('0x58'));}exports[_0x7110('0x59')]=function(_0xc58606){_0xc58606['on'](_0x7110('0x5a'),function(_0x2d3f96){_0x2d3f96[_0x7110('0x5b')](0x0);_0x2d3f96[_0x7110('0x5c')]=_0x2d3f96[_0x7110('0x5d')][_0x7110('0x5a')][_0x7110('0x5e')]+':'+_0x2d3f96[_0x7110('0x5d')]['connection'][_0x7110('0x5f')];_0x2d3f96[_0x7110('0x60')]=new Date();_0x2d3f96[_0x7110('0x57')]=function(_0x34de8b){console[_0x7110('0x57')]('SocketIO\x20'+_0x2d3f96[_0x7110('0x61')][_0x7110('0x3')]+'['+_0x2d3f96[_0x7110('0x5c')]+']',_0x34de8b);};_0x2d3f96['on'](_0x7110('0x62'),function(){onDisconnect(_0x2d3f96,_0xc58606);_0x2d3f96[_0x7110('0x57')](_0x7110('0x63'));});onConnect(_0x2d3f96);_0x2d3f96[_0x7110('0x57')](_0x7110('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index de8d0cf..1e1b695 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 _0x7a93=['FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','opened','changed','closed','substatus','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','callback','toLowerCase','../../mysqldb','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage'];(function(_0x4fadaf,_0x179d85){var _0x4738a8=function(_0x34ce7b){while(--_0x34ce7b){_0x4fadaf['push'](_0x4fadaf['shift']());}};_0x4738a8(++_0x179d85);}(_0x7a93,0x1a3));var _0x37a9=function(_0x1015ec,_0x56facf){_0x1015ec=_0x1015ec-0x0;var _0x3ac0f7=_0x7a93[_0x1015ec];return _0x3ac0f7;};'use strict';var util=require('util');var db=require(_0x37a9('0x0'))['db'];var jayson=require(_0x37a9('0x1'));var logger=require('../logger')(_0x37a9('0x2'));var client=jayson[_0x37a9('0x3')][_0x37a9('0x4')]({'port':0x232a});var triggers=[{'channel':_0x37a9('0x5'),'model':_0x37a9('0x6'),'event':_0x37a9('0x7'),'condition':_0x37a9('0x8'),'callback':afterCreate},{'channel':_0x37a9('0x5'),'model':_0x37a9('0x6'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x37a9('0x5'),'model':'ChatMessage','event':_0x37a9('0x7'),'condition':_0x37a9('0x9'),'callback':afterCreateMessage},{'channel':_0x37a9('0x5'),'model':_0x37a9('0xa'),'event':_0x37a9('0x7'),'condition':_0x37a9('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x37a9('0xb'),'model':_0x37a9('0xc'),'event':_0x37a9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x37a9('0xb'),'model':_0x37a9('0xc'),'event':_0x37a9('0xd'),'condition':_0x37a9('0xe'),'callback':afterUpdate},{'channel':_0x37a9('0xb'),'model':_0x37a9('0xf'),'event':'afterCreate','condition':_0x37a9('0x9'),'callback':afterCreateMessage},{'channel':_0x37a9('0x10'),'model':_0x37a9('0x11'),'event':_0x37a9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x37a9('0x10'),'model':_0x37a9('0x11'),'event':'afterUpdate','condition':_0x37a9('0xe'),'callback':afterUpdate},{'channel':_0x37a9('0x10'),'model':_0x37a9('0x12'),'event':_0x37a9('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x37a9('0x13'),'event':_0x37a9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x37a9('0x14'),'model':'FaxInteraction','event':_0x37a9('0xd'),'condition':_0x37a9('0xe'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x37a9('0x7'),'condition':_0x37a9('0x9'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x37a9('0x7'),'condition':_0x37a9('0x8'),'callback':afterCreate},{'channel':_0x37a9('0x15'),'model':_0x37a9('0x16'),'event':'afterUpdate','condition':_0x37a9('0xe'),'callback':afterUpdate},{'channel':'Mail','model':_0x37a9('0x17'),'event':_0x37a9('0x7'),'condition':_0x37a9('0x9'),'callback':afterCreateMessage},{'channel':_0x37a9('0x18'),'model':_0x37a9('0x19'),'event':_0x37a9('0x7'),'condition':_0x37a9('0x8'),'callback':afterCreate},{'channel':_0x37a9('0x18'),'model':_0x37a9('0x19'),'event':_0x37a9('0xd'),'condition':_0x37a9('0xe'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x37a9('0x1a'),'event':_0x37a9('0x7'),'condition':_0x37a9('0x9'),'callback':afterCreateMessage}];function request(_0x26c295){return client[_0x37a9('0x1b')](_0x37a9('0x1c'),_0x26c295)[_0x37a9('0x1d')](function(_0x1ff437){logger[_0x37a9('0x1e')](_0x37a9('0x1f'),_0x37a9('0x1c'),_0x1ff437);if(_0x1ff437[_0x37a9('0x20')]){if(_0x1ff437[_0x37a9('0x20')]['code']===0x1f4){logger[_0x37a9('0x20')](_0x37a9('0x1f'),'EventManager',_0x1ff437[_0x37a9('0x20')]);}}})[_0x37a9('0x21')](function(_0x379098){logger[_0x37a9('0x20')]('Trigger,\x20%s','EventManager',_0x379098);});}function afterCreateMessage(_0x54f331){return function(_0xd4936c){_0xd4936c=_0xd4936c[_0x37a9('0x22')]({'plain':!![]});_0xd4936c[_0x37a9('0x23')]=_0x54f331;_0xd4936c[_0x37a9('0x24')]=_0x54f331;_0xd4936c[_0x37a9('0x25')]=_0xd4936c['direction'];Promise[_0x37a9('0x26')]()['then'](function(){if(typeof _0xd4936c[_0x37a9('0x27')]===_0x37a9('0x28'))return null;var _0x54f7c9=_0x37a9('0x29')+_0xd4936c[_0x37a9('0x27')];return db[_0x37a9('0x2a')][_0x37a9('0x2b')](_0x54f7c9,{'type':db[_0x37a9('0x2c')][_0x37a9('0x2d')][_0x37a9('0x2e')],'raw':!![]});})[_0x37a9('0x1d')](function(_0x462136){if(_0x462136){_0xd4936c[_0x37a9('0x2f')]=_0x462136[0x0];}if(typeof _0xd4936c['UserId']===_0x37a9('0x28'))return;return getAgent(_0xd4936c[_0x37a9('0x30')]);})[_0x37a9('0x1d')](function(_0xe26033){if(_0xe26033){_0xd4936c[_0x37a9('0x31')]=util[_0x37a9('0x32')](_0x37a9('0x33'),_0xe26033[_0x37a9('0x34')]);_0xd4936c[_0x37a9('0x35')]=_0xe26033;_0xd4936c[_0x37a9('0x23')]=_0x54f331;return request({'event':_0x37a9('0x36'),'message':_0xd4936c});}else{return request({'event':_0x37a9('0x37'),'message':_0xd4936c});}})[_0x37a9('0x21')](function(_0x5fa19d){logger[_0x37a9('0x20')](_0x37a9('0x1f'),_0x37a9('0x38'),_0x5fa19d);});};}function afterCreateOfflineMessage(_0xd453a7){return function(_0x22f379){_0x22f379=_0x22f379[_0x37a9('0x22')]({'plain':!![]});_0x22f379[_0x37a9('0x23')]=_0xd453a7;_0x22f379['motionChannel']=_0xd453a7;_0x22f379[_0x37a9('0x25')]='offlineMessage';return request({'event':_0x22f379[_0x37a9('0x25')],'message':_0x22f379});};}function afterCreate(_0x3e1afa,_0x8cd239){return function(_0x170044){_0x170044=_0x170044[_0x37a9('0x22')]({'plain':!![]});_0x170044[_0x37a9('0x23')]=_0x3e1afa;_0x170044[_0x37a9('0x24')]=_0x3e1afa;_0x170044['event']=_0x37a9('0x39');Promise['resolve']()[_0x37a9('0x1d')](function(){var _0x39acb7=_0x37a9('0x29')+_0x170044['ContactId'];return db[_0x37a9('0x2a')]['query'](_0x39acb7,{'type':db[_0x37a9('0x2c')][_0x37a9('0x2d')][_0x37a9('0x2e')],'raw':!![]});})['then'](function(_0x345324){if(_0x345324){_0x170044[_0x37a9('0x2f')]=_0x345324[0x0];}if(typeof _0x170044[_0x37a9('0x30')]===_0x37a9('0x28'))return;return getAgent(_0x170044['UserId']);})[_0x37a9('0x1d')](function(_0x27ea8d){if(_0x27ea8d){_0x170044['interface']=util[_0x37a9('0x32')](_0x37a9('0x33'),_0x27ea8d['name']);_0x170044[_0x37a9('0x35')]=_0x27ea8d;}return request({'event':_0x8cd239,'message':_0x170044});})[_0x37a9('0x21')](function(_0x30b945){logger[_0x37a9('0x20')]('Trigger,\x20%s','AfterCreate',_0x30b945);});};}function afterUpdate(_0x1cd2ef){return function(_0x5a301a){var _0x5b9c69=_0x5a301a[_0x37a9('0x3a')](_0x37a9('0x3b'))&&_0x5a301a['closed'];var _0x12396e=_0x5a301a[_0x37a9('0x3a')](_0x37a9('0x3c'));if(_0x5b9c69||_0x12396e){var _0x3d6327=_0x5b9c69?'closedinteraction':_0x37a9('0x3c');var _0x1c4a79=_0x5a301a[_0x37a9('0x22')]({'plain':!![]});_0x1c4a79['channel']=_0x1cd2ef;_0x1c4a79['motionChannel']=_0x1cd2ef;_0x1c4a79[_0x37a9('0x25')]=_0x5b9c69?'closed':_0x37a9('0x3c');var _0x53538a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c4a79[_0x37a9('0x27')];return db['sequelize']['query'](_0x53538a,{'type':db[_0x37a9('0x2c')][_0x37a9('0x2d')]['SELECT'],'raw':!![]})[_0x37a9('0x1d')](function(_0x2ebc7){if(_0x2ebc7){_0x1c4a79['contact']=_0x2ebc7[0x0];}if(typeof _0x1c4a79['UserId']===_0x37a9('0x28'))return;return getAgent(_0x1c4a79[_0x37a9('0x30')]);})[_0x37a9('0x1d')](function(_0x5bae67){if(_0x5bae67){_0x1c4a79[_0x37a9('0x31')]=util[_0x37a9('0x32')]('SIP/%s',_0x5bae67[_0x37a9('0x34')]);_0x1c4a79[_0x37a9('0x35')]=_0x5bae67;}return request({'event':_0x3d6327,'message':_0x1c4a79});})[_0x37a9('0x21')](function(_0xc3cf30){logger[_0x37a9('0x20')](_0x37a9('0x1f'),_0x37a9('0x3d'),_0xc3cf30);});}};}function getAgent(_0x11a3d2){return db[_0x37a9('0x3e')][_0x37a9('0x3f')]({'where':{'id':_0x11a3d2},'attributes':['id','name',_0x37a9('0x40'),'email',_0x37a9('0x41')],'raw':!![]})['then'](function(_0x166105){return _0x166105;});}exports[_0x37a9('0x42')]=function(){for(var _0x4a7da9=0x0;_0x4a7da9=_0x43d9ed[_0x4e91('0x13')]){throw Error(_0x4e91('0x14'));}_0x4ffa6d(_0x35ef5f);})[_0x4e91('0x15')](function(_0x333e51){_0x263f7f(_0x333e51);});});}; \ No newline at end of file +var _0xcb5d=['lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x128734,_0xb06f3d){var _0x35747b=function(_0x172885){while(--_0x172885){_0x128734['push'](_0x128734['shift']());}};_0x35747b(++_0xb06f3d);}(_0xcb5d,0x11e));var _0xdcb5=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xcb5d[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xdcb5('0x0'));var BPromise=require(_0xdcb5('0x1'));var db=require(_0xdcb5('0x2'))['db'];var util=require(_0xdcb5('0x3'));var channels=[_0xdcb5('0x4'),_0xdcb5('0x5'),_0xdcb5('0x6'),_0xdcb5('0x7'),_0xdcb5('0x8'),_0xdcb5('0x9'),'openchannel'];exports[_0xdcb5('0xa')]=function(){return channels;};exports[_0xdcb5('0xb')]=function(_0x4cd186){_0x4cd186=_0x4cd186[_0xdcb5('0xc')]();return _['includes'](channels,_0x4cd186);};exports[_0xdcb5('0xd')]=function(_0xcc94aa,_0x2962a2,_0x535541,_0x1f2c6c){var _0x2478ff={'loginAttempts':_0x2962a2,'blocked':_0x535541};if(!_[_0xdcb5('0xe')](_0x1f2c6c)){_0x2478ff[_0xdcb5('0xf')]=_0x1f2c6c;}return _0xcc94aa[_0xdcb5('0x10')](_0x2478ff);};exports[_0xdcb5('0x11')]=function(_0xc3654e){return new BPromise(function(_0x53d9fb,_0x542d29){var _0x1327ef=0x0;if(_0xc3654e[_0xdcb5('0x12')]!==_0xdcb5('0x13')){_0x53d9fb(_0xc3654e);}db[_0xdcb5('0x14')][_0xdcb5('0x15')]({'where':{'role':_0xdcb5('0x13'),'online':!![],'id':{'$ne':_0xc3654e['id']}}})[_0xdcb5('0x16')](function(_0x411747){_0x1327ef=_0x411747;return util[_0xdcb5('0x11')]();})[_0xdcb5('0x16')](function(_0x145bf1){if(_0x145bf1&&_0x145bf1[_0xdcb5('0x17')]&&_0x1327ef>=_0x145bf1[_0xdcb5('0x17')]){throw Error(_0xdcb5('0x18'));}_0x53d9fb(_0xc3654e);})[_0xdcb5('0x19')](function(_0x3ae6f5){_0x542d29(_0x3ae6f5);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d4b5222..690d74e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac9d=['exports','404','status','render'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xac9d,0x19c));var _0xdac9=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0xac9d[_0x4c6bca];return _0x29d58e;};'use strict';module[_0xdac9('0x0')][0x194]=function pageNotFound(_0x33ee25,_0x51a032){var _0x23fbd1=_0xdac9('0x1');var _0x22a830=0x194;var _0x190a0c={'status':_0x22a830};_0x51a032[_0xdac9('0x2')](_0x190a0c[_0xdac9('0x2')]);_0x51a032[_0xdac9('0x3')](_0x23fbd1,{},function(_0x3c38a4,_0x510309){if(_0x3c38a4){return _0x51a032[_0xdac9('0x2')](_0x190a0c[_0xdac9('0x2')])['json'](_0x190a0c);}_0x51a032['send'](_0x510309);});}; \ No newline at end of file +var _0x4e70=['json','exports','status','render'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4e70,0x69));var _0x04e7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4e70[_0x344a3f];return _0x264712;};'use strict';module[_0x04e7('0x0')][0x194]=function pageNotFound(_0x24d0b6,_0xd7186){var _0x3cb72f='404';var _0xdfbede=0x194;var _0x19e8a7={'status':_0xdfbede};_0xd7186[_0x04e7('0x1')](_0x19e8a7[_0x04e7('0x1')]);_0xd7186[_0x04e7('0x2')](_0x3cb72f,{},function(_0x3deea3,_0x7f90ba){if(_0x3deea3){return _0xd7186[_0x04e7('0x1')](_0x19e8a7[_0x04e7('0x1')])[_0x04e7('0x3')](_0x19e8a7);}_0xd7186['send'](_0x7f90ba);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 268b0fe..66529ea 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e22=['UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','UserVoiceQueueRt','Extensions','CmHopperFinal','HopperFinals','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','Members','VoiceQueueId','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','Trunk','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','AgentReports','uniqueid','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Smtp','MailAccountId','CannedAnswer','List','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','Contact','ContactId','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','user_has_mail_interactions','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','ListId','Items','Dispositions','FaxAccountId','Answers','Interactions','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','HopperHistories','Company','cm_contact_has_tags','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','Mohs','moh_has_sounds','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','Subject','Description','Field','FieldId','VariableId','Descriptions','int_desk_configuration_has_tags','ZohoAccount','ZohoField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','JscriptyQuestionReport','team_has_sms_queues','VoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','sequelize','lodash','jstz','motion2','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','utf8mb4','password','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','Sound','../api/sound/sound.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integrationReport/integrationReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model'];(function(_0x2767cb,_0x3ce837){var _0x15e0fa=function(_0x4d9c9d){while(--_0x4d9c9d){_0x2767cb['push'](_0x2767cb['shift']());}};_0x15e0fa(++_0x3ce837);}(_0x2e22,0x10f));var _0x22e2=function(_0xaf8267,_0x33968b){_0xaf8267=_0xaf8267-0x0;var _0x20798b=_0x2e22[_0xaf8267];return _0x20798b;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x22e2('0x0'));var _=require(_0x22e2('0x1'));var jstz=require(_0x22e2('0x2'));var timezone=jstz['determine']();config[_0x22e2('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':_0x22e2('0x3'),'username':'xcall','password':_0x22e2('0x4'),'options':{'host':_0x22e2('0x5'),'port':0xcea,'dialect':_0x22e2('0x6'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x22e2('0x7')](),'define':{'charset':_0x22e2('0x8'),'collate':_0x22e2('0x9')}}});config[_0x22e2('0xa')]=_[_0x22e2('0xb')](config[_0x22e2('0xa')],{'database':_0x22e2('0x3'),'username':_0x22e2('0xc'),'password':_0x22e2('0x4'),'options':{'host':_0x22e2('0x5'),'port':0xcea,'dialect':_0x22e2('0x6'),'dialectOptions':{'charset':_0x22e2('0xd')},'logging':![],'timezone':timezone[_0x22e2('0x7')](),'define':{'charset':_0x22e2('0x8'),'collate':_0x22e2('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x22e2('0x0')]['database'],config[_0x22e2('0x0')]['username'],config['sequelize'][_0x22e2('0xe')],config[_0x22e2('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x22e2('0xa')][_0x22e2('0xf')],config[_0x22e2('0xa')]['username'],config[_0x22e2('0xa')][_0x22e2('0xe')],config[_0x22e2('0xa')]['options'])};db[_0x22e2('0x10')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x12'));db[_0x22e2('0x13')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x14'));db['VoiceContext']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x15'));db[_0x22e2('0x16')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x17'));db[_0x22e2('0x18')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x19'));db[_0x22e2('0x1a')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x1b'));db[_0x22e2('0x1c')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x1d'));db['ScreenRecording']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x1e'));db[_0x22e2('0x1f')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x20'));db['VoiceMailMessage']=db['sequelize'][_0x22e2('0x11')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x22e2('0x21')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x22'));db[_0x22e2('0x23')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x24'));db[_0x22e2('0x25')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x26'));db[_0x22e2('0x27')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x22e2('0x28')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x29'));db['Trunk']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x2a'));db[_0x22e2('0x2b')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x2c'));db['UserVoiceQueueRt']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x2d'));db[_0x22e2('0x2e')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x2f'));db[_0x22e2('0x30')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x31'));db['UserMailQueue']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x32'));db[_0x22e2('0x33')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x22e2('0x0')]['import'](_0x22e2('0x34'));db[_0x22e2('0x35')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x22e2('0x36')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x37'));db['MailServerIn']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x38'));db[_0x22e2('0x39')]=db[_0x22e2('0x0')]['import']('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/mailAccount/mailAccount.model');db[_0x22e2('0x3a')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/mailQueue/mailQueue.model');db[_0x22e2('0x3b')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x3c'));db[_0x22e2('0x3d')]=db[_0x22e2('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x22e2('0x3e')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x3f'));db[_0x22e2('0x40')]=db['sequelize'][_0x22e2('0x11')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x41'));db[_0x22e2('0x42')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/dashboard/dashboard.model');db[_0x22e2('0x43')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x44'));db[_0x22e2('0x45')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/faxAccount/faxAccount.model');db[_0x22e2('0x46')]=db[_0x22e2('0x0')]['import']('../api/faxApplication/faxApplication.model');db[_0x22e2('0x47')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x48'));db[_0x22e2('0x49')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x4a'));db['FaxQueueReport']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x4b'));db['SmsAccount']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x4c'));db[_0x22e2('0x4d')]=db['sequelize'][_0x22e2('0x11')]('../api/smsApplication/smsApplication.model');db[_0x22e2('0x4e')]=db['sequelize']['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/smsMessage/smsMessage.model');db[_0x22e2('0x4f')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x50'));db['OpenchannelAccount']=db[_0x22e2('0x0')]['import'](_0x22e2('0x51'));db[_0x22e2('0x52')]=db['sequelize'][_0x22e2('0x11')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x53'));db[_0x22e2('0x54')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x55'));db[_0x22e2('0x56')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x57'));db[_0x22e2('0x58')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/chatWebsite/chatWebsite.model');db[_0x22e2('0x59')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x5a'));db['ChatApplication']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x5b'));db[_0x22e2('0x5c')]=db[_0x22e2('0x0')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x5d'));db[_0x22e2('0x5e')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x5f'));db[_0x22e2('0x60')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x61'));db[_0x22e2('0x62')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x63'));db[_0x22e2('0x64')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x65'));db[_0x22e2('0x66')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x67'));db[_0x22e2('0x68')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x69'));db['CmHopperBlack']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x6a'));db['CmHopperFinal']=db[_0x22e2('0x0')]['import'](_0x22e2('0x6b'));db[_0x22e2('0x6c')]=db['sequelize']['import'](_0x22e2('0x6d'));db['ReportAgentPreview']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x6e'));db[_0x22e2('0x6f')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x22e2('0x70')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/action/action.model');db[_0x22e2('0x71')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x72'));db['CannedAnswer']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x73'));db[_0x22e2('0x74')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/disposition/disposition.model');db[_0x22e2('0x75')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x76'));db['Interval']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x77'));db[_0x22e2('0x78')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x79'));db[_0x22e2('0x7a')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x7b'));db[_0x22e2('0x7c')]=db['sequelize'][_0x22e2('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x22e2('0x7d')]=db['sequelize'][_0x22e2('0x11')]('../api/schedule/schedule.model');db[_0x22e2('0x7e')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x7f'));db['Tag']=db['sequelize'][_0x22e2('0x11')]('../api/tag/tag.model');db[_0x22e2('0x80')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x81'));db[_0x22e2('0x82')]=db['sequelize']['import'](_0x22e2('0x83'));db[_0x22e2('0x84')]=db[_0x22e2('0x0')]['import']('../api/variable/variable.model');db[_0x22e2('0x85')]=db[_0x22e2('0x0')]['import']('../api/integration/integration.model');db['IntegrationReport']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x86'));db['AnalyticCustomReport']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x22e2('0x0')]['import'](_0x22e2('0x87'));db[_0x22e2('0x88')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x22e2('0x89')]=db[_0x22e2('0x0')]['import'](_0x22e2('0x8a'));db[_0x22e2('0x8b')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x8c'));db[_0x22e2('0x8d')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x8e'));db[_0x22e2('0x8f')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x22e2('0x90')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x91'));db[_0x22e2('0x92')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x93'));db[_0x22e2('0x94')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x95'));db[_0x22e2('0x96')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0x97'));db[_0x22e2('0x98')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x99'));db[_0x22e2('0x9a')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intDeskAccount/intDeskAccount.model');db[_0x22e2('0x9b')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x9c'));db[_0x22e2('0x9d')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0x9e'));db['ZohoAccount']=db['sequelize'][_0x22e2('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0x22e2('0x9f')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xa0'));db['ZohoField']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xa1'));db[_0x22e2('0xa2')]=db['sequelize']['import'](_0x22e2('0xa3'));db[_0x22e2('0xa4')]=db['sequelize'][_0x22e2('0x11')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x22e2('0xa5')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xa6'));db[_0x22e2('0xa7')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xa8'));db[_0x22e2('0xa9')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xaa'));db[_0x22e2('0xab')]=db['sequelize']['import'](_0x22e2('0xac'));db[_0x22e2('0xad')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xae'));db['VtigerConfiguration']=db['sequelize'][_0x22e2('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x22e2('0xaf')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x22e2('0xb0')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xb1'));db['ServicenowConfiguration']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xb2'));db[_0x22e2('0xb3')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xb4'));db[_0x22e2('0xb5')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x22e2('0xb6')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xb7'));db[_0x22e2('0xb8')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x22e2('0xb9')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xba'));db[_0x22e2('0xbb')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xbc'));db[_0x22e2('0xbd')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x22e2('0x85')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xbe'));db['Network']=db['sequelize']['import'](_0x22e2('0xbf'));db[_0x22e2('0xc0')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xc1'));db[_0x22e2('0xc2')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xc3'));db[_0x22e2('0xc4')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xc5'));db['JscriptyQuestionReport']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x22e2('0xc6')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x22e2('0x0')]['import']('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/squareReportDetail/squareReportDetail.model');db[_0x22e2('0xc7')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xc8'));db[_0x22e2('0xc9')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xca'));db[_0x22e2('0xcb')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/squareOdbc/squareOdbc.model');db[_0x22e2('0xcc')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xcd'));db[_0x22e2('0xce')]=db[_0x22e2('0x0')]['import']('../api/squareRecording/squareRecording.model');db[_0x22e2('0xcf')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xd0'));db['Team']=db['sequelize']['import'](_0x22e2('0xd1'));db['License']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xd2'));db[_0x22e2('0xd3')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xd4'));db[_0x22e2('0xd5')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xd6'));db[_0x22e2('0xd7')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xd8'));db['Plugin']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xd9'));db[_0x22e2('0xda')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xdb'));db[_0x22e2('0xdc')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xdd'));db[_0x22e2('0xde')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xdf'));db[_0x22e2('0xe0')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xe1'));db[_0x22e2('0xe2')]=db['sequelize'][_0x22e2('0x11')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xe3'));db['UserProfile']=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/userProfile/userProfile.model');db[_0x22e2('0xe4')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xe5'));db[_0x22e2('0xe6')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xe7'));db[_0x22e2('0xe8')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xe9'));db[_0x22e2('0xea')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xeb'));db[_0x22e2('0xec')]=db['sequelize']['import'](_0x22e2('0xed'));db[_0x22e2('0xee')]=db[_0x22e2('0x0')][_0x22e2('0x11')](_0x22e2('0xef'));db[_0x22e2('0xf0')]=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x22e2('0xf1')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xf2'));db[_0x22e2('0xf3')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xf4'));db['CloudProvider']=db[_0x22e2('0x0')]['import'](_0x22e2('0xf5'));db[_0x22e2('0xf6')]=db['sequelize'][_0x22e2('0x11')](_0x22e2('0xf7'));db[_0x22e2('0xf8')]=db[_0x22e2('0x0')][_0x22e2('0x11')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x22e2('0xf9')]=db[_0x22e2('0x0')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x22e2('0xfa')]=db[_0x22e2('0x0')]['import'](_0x22e2('0xfb'));db['User'][_0x22e2('0xfc')](db['VoiceMail'],{'as':_0x22e2('0x1f'),'onDelete':'cascade','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0xfc')](db['UserSetting'],{'as':_0x22e2('0xfe'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0xfd')});db['User'][_0x22e2('0x100')](db[_0x22e2('0x1c')],{'as':'Recordings','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db[_0x22e2('0x101')],{'as':'VoiceQueuesRt','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db['VoiceExtension'],{'as':_0x22e2('0x102'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x10')]['hasMany'](db[_0x22e2('0x103')],{'as':_0x22e2('0x104'),'foreignKey':'UserId'});db[_0x22e2('0x10')]['hasMany'](db[_0x22e2('0x6c')],{'as':'HopperHistory','foreignKey':_0x22e2('0xfd')});db['User'][_0x22e2('0x100')](db['ReportAgentPreview'],{'as':_0x22e2('0x105'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db[_0x22e2('0x106')],{'as':_0x22e2('0x107'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db[_0x22e2('0x108')],{'as':_0x22e2('0x109'),'foreignKey':_0x22e2('0xfd')});db['User']['hasMany'](db[_0x22e2('0x4e')],{'as':_0x22e2('0x10a'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')]['hasMany'](db[_0x22e2('0x47')],{'as':_0x22e2('0x10b'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db[_0x22e2('0x3d')],{'as':_0x22e2('0x10c'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')][_0x22e2('0x100')](db[_0x22e2('0xec')],{'as':_0x22e2('0x10d'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x10')]['hasMany'](db[_0x22e2('0xe8')],{'as':_0x22e2('0x10e'),'foreignKey':_0x22e2('0x10f')});db[_0x22e2('0x10')][_0x22e2('0x110')](db[_0x22e2('0x111')],{'as':'UserProfile','foreignKey':_0x22e2('0x112')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x60')],{'as':_0x22e2('0x114'),'through':_0x22e2('0x115')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x66')],{'as':_0x22e2('0x116'),'through':_0x22e2('0x117')});db['User'][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x118'),'through':_0x22e2('0x119')});db[_0x22e2('0x10')]['belongsToMany'](db[_0x22e2('0x11a')],{'through':_0x22e2('0x11b')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x3d')],{'as':_0x22e2('0x10c'),'through':'user_has_mail_interactions'});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x108')],{'as':_0x22e2('0x109'),'through':'user_has_chat_interactions'});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x47')],{'as':_0x22e2('0x10b'),'through':_0x22e2('0x11c')});db['User'][_0x22e2('0x113')](db[_0x22e2('0x4e')],{'as':_0x22e2('0x10a'),'through':_0x22e2('0x11d')});db[_0x22e2('0x10')][_0x22e2('0x113')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db['User'][_0x22e2('0x113')](db[_0x22e2('0xec')],{'as':_0x22e2('0x10d'),'through':_0x22e2('0x11e')});db[_0x22e2('0x10')]['belongsToMany'](db['VoiceQueue'],{'as':_0x22e2('0x11f'),'through':_0x22e2('0x2e'),'required':![]});db['User'][_0x22e2('0x113')](db['VoicePrefix'],{'as':_0x22e2('0x120'),'through':_0x22e2('0xf9'),'required':![]});db[_0x22e2('0x10')][_0x22e2('0x113')](db['MailQueue'],{'as':_0x22e2('0x121'),'through':_0x22e2('0x122'),'required':![]});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x5e')],{'as':_0x22e2('0x123'),'through':_0x22e2('0x30'),'required':![],'hooks':!![]});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x124')],{'as':_0x22e2('0x125'),'through':_0x22e2('0x33'),'required':![]});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x4f')],{'as':_0x22e2('0x126'),'through':_0x22e2('0x127'),'required':![]});db[_0x22e2('0x10')]['belongsToMany'](db[_0x22e2('0x56')],{'as':_0x22e2('0x128'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x22e2('0xf3')],{'as':'WhatsappQueues','through':_0x22e2('0x36'),'required':![]});db['User'][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'through':_0x22e2('0x119')});db[_0x22e2('0x10')][_0x22e2('0x113')](db['ChatWebsite'],{'as':_0x22e2('0x129'),'through':_0x22e2('0x12a')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x45')],{'as':_0x22e2('0x12b'),'through':_0x22e2('0x12c')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x12d')],{'as':_0x22e2('0x12e'),'through':_0x22e2('0x12f')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x130')],{'as':_0x22e2('0x131'),'through':_0x22e2('0x132')});db[_0x22e2('0x10')][_0x22e2('0x113')](db[_0x22e2('0x133')],{'as':_0x22e2('0x134'),'through':_0x22e2('0x135')});db['User'][_0x22e2('0x113')](db[_0x22e2('0x136')],{'as':_0x22e2('0x137'),'through':'user_has_whatsapp_accounts'});db[_0x22e2('0x10')][_0x22e2('0x113')](db['SquareProject'],{'as':'SquareProjects','through':_0x22e2('0x138')});db[_0x22e2('0x13')][_0x22e2('0x100')](db['VoiceExtension'],{'as':_0x22e2('0x139'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x13a')});db[_0x22e2('0x13b')][_0x22e2('0x100')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x22e2('0x16')][_0x22e2('0x100')](db[_0x22e2('0x16')],{'as':_0x22e2('0x13c'),'onDelete':_0x22e2('0xff')});db['VoiceMusicOnHold'][_0x22e2('0x113')](db[_0x22e2('0x7e')],{'as':_0x22e2('0x13d'),'through':'moh_has_sounds'});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x101')],{'as':_0x22e2('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x68')],{'as':'Hoppers','foreignKey':_0x22e2('0x13f')});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x103')],{'as':_0x22e2('0x104'),'foreignKey':'VoiceQueueId'});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x6c')],{'as':'HopperHistories','foreignKey':_0x22e2('0x13f')});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x105')],{'as':_0x22e2('0x105'),'foreignKey':'VoiceQueueId'});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0x140')],{'as':_0x22e2('0x141'),'foreignKey':_0x22e2('0x13f')});db[_0x22e2('0x1a')][_0x22e2('0x100')](db[_0x22e2('0xc6')],{'as':_0x22e2('0x142'),'foreignKey':'VoiceQueueId'});db[_0x22e2('0x1a')][_0x22e2('0x110')](db['Trunk'],{'as':'Trunk','foreignKey':_0x22e2('0x143')});db[_0x22e2('0x1a')][_0x22e2('0x110')](db[_0x22e2('0x144')],{'as':_0x22e2('0x145'),'foreignKey':_0x22e2('0x146')});db[_0x22e2('0x1a')]['belongsTo'](db[_0x22e2('0x147')],{'as':_0x22e2('0x147'),'foreignKey':_0x22e2('0x148')});db['VoiceQueue']['belongsTo'](db[_0x22e2('0x78')],{'as':'mandatoryDispositionPause','foreignKey':_0x22e2('0x149')});db[_0x22e2('0x1a')][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x118'),'through':_0x22e2('0x14a')});db[_0x22e2('0x1a')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':'Agents','through':_0x22e2('0x2e')});db[_0x22e2('0x1a')][_0x22e2('0x113')](db['Team'],{'as':_0x22e2('0x14b'),'through':'TeamVoiceQueue'});db[_0x22e2('0x1a')][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x14c'),'through':_0x22e2('0x14d')});db[_0x22e2('0x1c')][_0x22e2('0x110')](db['User'],{'as':_0x22e2('0x10'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x14e')]['belongsTo'](db[_0x22e2('0x10')],{'as':_0x22e2('0x10'),'foreignKey':'UserId'});db[_0x22e2('0x1f')][_0x22e2('0x100')](db['VoiceMailMessage'],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x150'),'sourceKey':_0x22e2('0x151')});db[_0x22e2('0x152')]['belongsTo'](db[_0x22e2('0x1f')],{'foreignKey':_0x22e2('0x150'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x22e2('0x100')](db[_0x22e2('0x27')],{'as':_0x22e2('0x153'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x22e2('0x100')](db[_0x22e2('0x25')],{'as':_0x22e2('0x154'),'foreignKey':_0x22e2('0x155'),'constraints':![]});db[_0x22e2('0x21')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'as':'User','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x21')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':'Contact','foreignKey':'ContactId'});db[_0x22e2('0x156')][_0x22e2('0x110')](db['MailAccount'],{'as':_0x22e2('0x12d'),'foreignKey':'MailAccountId'});db[_0x22e2('0x156')][_0x22e2('0x110')](db['CloudProvider'],{'as':_0x22e2('0x157'),'foreignKey':_0x22e2('0x158'),'onDelete':_0x22e2('0x159')});db[_0x22e2('0x39')][_0x22e2('0x110')](db['MailAccount'],{'as':_0x22e2('0x12d'),'foreignKey':'MailAccountId'});db[_0x22e2('0x39')][_0x22e2('0x110')](db[_0x22e2('0x157')],{'as':_0x22e2('0x157'),'foreignKey':'CloudProviderId','onDelete':_0x22e2('0x159')});db['MailAccount'][_0x22e2('0xfc')](db[_0x22e2('0x156')],{'as':_0x22e2('0x15a'),'onDelete':'cascade'});db[_0x22e2('0x12d')][_0x22e2('0xfc')](db[_0x22e2('0x39')],{'as':_0x22e2('0x15b'),'onDelete':_0x22e2('0xff')});db['MailAccount'][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':'Dispositions','foreignKey':_0x22e2('0x15c'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x12d')][_0x22e2('0x100')](db[_0x22e2('0x15d')],{'as':'Answers','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x22e2('0x3e')],{'as':_0x22e2('0x14f'),'foreignKey':_0x22e2('0x15c')});db['MailAccount']['hasMany'](db[_0x22e2('0x3d')],{'as':'Interactions'});db['MailAccount']['hasMany'](db[_0x22e2('0x40')],{'as':_0x22e2('0x13c')});db[_0x22e2('0x12d')][_0x22e2('0x110')](db['CmList'],{'as':_0x22e2('0x15e'),'foreignKey':'ListId'});db[_0x22e2('0x12d')][_0x22e2('0x110')](db[_0x22e2('0x80')],{'as':_0x22e2('0x80'),'foreignKey':_0x22e2('0x15f')});db[_0x22e2('0x12d')][_0x22e2('0x110')](db['Pause'],{'as':_0x22e2('0x160'),'foreignKey':_0x22e2('0x149')});db[_0x22e2('0x12d')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':'Agents','through':_0x22e2('0x12f')});db[_0x22e2('0x3a')]['belongsToMany'](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':'UserMailQueue'});db[_0x22e2('0x3a')][_0x22e2('0x113')](db[_0x22e2('0x11a')],{'through':_0x22e2('0x162'),'as':_0x22e2('0x14b')});db[_0x22e2('0x3d')][_0x22e2('0x100')](db[_0x22e2('0x3e')],{'as':'Messages','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x163')});db['MailInteraction'][_0x22e2('0x110')](db[_0x22e2('0x12d')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x22e2('0x3d')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x3d')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'as':'Owner','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x3d')][_0x22e2('0x113')](db['Tag'],{'through':_0x22e2('0x166'),'as':_0x22e2('0x167')});db['MailInteraction']['belongsToMany'](db[_0x22e2('0x168')],{'through':_0x22e2('0x166'),'as':_0x22e2('0x169')});db['MailInteraction'][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x16b'),'foreignKey':_0x22e2('0x163')});db[_0x22e2('0x3e')][_0x22e2('0x100')](db[_0x22e2('0xd7')],{'as':'Attachments','onDelete':_0x22e2('0xff')});db[_0x22e2('0x3e')][_0x22e2('0x110')](db['User'],{'as':_0x22e2('0x10')});db[_0x22e2('0x3e')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'onDelete':_0x22e2('0xff'),'as':_0x22e2('0x164')});db[_0x22e2('0x3e')][_0x22e2('0x110')](db[_0x22e2('0x3d')],{'as':_0x22e2('0x16c'),'foreignKey':_0x22e2('0x163')});db[_0x22e2('0x3e')][_0x22e2('0x110')](db['MailAccount'],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x15c')});db['MailMessage'][_0x22e2('0x110')](db['ChatWebsite'],{'as':_0x22e2('0x58'),'foreignKey':_0x22e2('0x16e')});db['MailMessage']['belongsTo'](db[_0x22e2('0x16f')],{'as':_0x22e2('0x16f'),'foreignKey':_0x22e2('0x170')});db[_0x22e2('0x40')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x40')][_0x22e2('0x110')](db[_0x22e2('0x3a')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x22e2('0x12d')],{'onDelete':'restrict'});db['MailApplication'][_0x22e2('0x110')](db[_0x22e2('0x147')],{'onDelete':'restrict','foreignKey':_0x22e2('0x148')});db[_0x22e2('0x40')]['belongsTo'](db[_0x22e2('0x168')],{'onDelete':'restrict','foreignKey':_0x22e2('0x171')});db['MailQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x12d')],{});db[_0x22e2('0x172')][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db[_0x22e2('0x172')]['belongsTo'](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x172')][_0x22e2('0x110')](db[_0x22e2('0x3d')],{});db[_0x22e2('0x172')][_0x22e2('0x110')](db[_0x22e2('0x3e')],{});db[_0x22e2('0x172')]['belongsTo'](db[_0x22e2('0x10')],{});db[_0x22e2('0x172')][_0x22e2('0x110')](db[_0x22e2('0x3a')],{});db[_0x22e2('0x42')][_0x22e2('0x100')](db['DashboardItem'],{'as':_0x22e2('0x174'),'onDelete':_0x22e2('0xff')});db['FaxAccount'][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':_0x22e2('0x175'),'foreignKey':_0x22e2('0x176'),'onDelete':_0x22e2('0xff')});db['FaxAccount'][_0x22e2('0x100')](db[_0x22e2('0x15d')],{'as':_0x22e2('0x177'),'foreignKey':'FaxAccountId'});db[_0x22e2('0x45')][_0x22e2('0x100')](db[_0x22e2('0x47')],{'as':_0x22e2('0x178')});db[_0x22e2('0x45')]['hasMany'](db['FaxApplication'],{'as':_0x22e2('0x13c')});db['FaxAccount'][_0x22e2('0x100')](db[_0x22e2('0x16')],{'as':_0x22e2('0x179'),'onDelete':'cascade'});db[_0x22e2('0x45')][_0x22e2('0x100')](db[_0x22e2('0x49')],{'as':_0x22e2('0x14f')});db[_0x22e2('0x45')][_0x22e2('0x110')](db[_0x22e2('0x144')],{'as':_0x22e2('0x144')});db[_0x22e2('0x45')][_0x22e2('0x110')](db['CmList'],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db[_0x22e2('0x45')][_0x22e2('0x110')](db[_0x22e2('0x78')],{'as':_0x22e2('0x160'),'foreignKey':_0x22e2('0x149')});db[_0x22e2('0x45')]['belongsToMany'](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x12c')});db[_0x22e2('0x46')]['belongsTo'](db['User'],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x46')][_0x22e2('0x110')](db[_0x22e2('0x124')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x46')][_0x22e2('0x110')](db[_0x22e2('0x45')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x46')][_0x22e2('0x110')](db[_0x22e2('0x168')],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x171')});db[_0x22e2('0x47')][_0x22e2('0x100')](db[_0x22e2('0x49')],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x17a')});db[_0x22e2('0x47')][_0x22e2('0x110')](db[_0x22e2('0x45')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x176')});db[_0x22e2('0x47')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':'Contact','foreignKey':_0x22e2('0x165')});db[_0x22e2('0x47')]['belongsTo'](db['User'],{'as':_0x22e2('0x17b'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x47')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x17c'),'as':_0x22e2('0x167')});db[_0x22e2('0x47')]['belongsToMany'](db[_0x22e2('0x168')],{'through':'fax_interaction_has_tags','as':_0x22e2('0x169')});db[_0x22e2('0x47')][_0x22e2('0x113')](db['User'],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x11c'),'foreignKey':_0x22e2('0x17a')});db['FaxMessage'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':'cascade','as':_0x22e2('0x10')});db[_0x22e2('0x49')][_0x22e2('0x110')](db[_0x22e2('0x47')],{'as':_0x22e2('0x16c'),'foreignKey':_0x22e2('0x17a')});db['FaxMessage'][_0x22e2('0x110')](db[_0x22e2('0x66')],{'onDelete':'cascade','as':_0x22e2('0x164')});db['FaxMessage'][_0x22e2('0x110')](db['Attachment'],{'as':_0x22e2('0xd7'),'foreignKey':_0x22e2('0x17d')});db[_0x22e2('0x49')]['belongsTo'](db['FaxAccount'],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x176')});db['FaxQueue'][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x33')});db[_0x22e2('0x124')][_0x22e2('0x113')](db[_0x22e2('0x11a')],{'through':_0x22e2('0x17e'),'as':_0x22e2('0x14b')});db[_0x22e2('0x17f')][_0x22e2('0x110')](db[_0x22e2('0x45')],{});db[_0x22e2('0x17f')][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':'ListId'});db[_0x22e2('0x17f')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':'Contact','foreignKey':'ContactId'});db[_0x22e2('0x17f')][_0x22e2('0x110')](db[_0x22e2('0x47')],{});db[_0x22e2('0x17f')]['belongsTo'](db[_0x22e2('0x49')],{});db[_0x22e2('0x17f')][_0x22e2('0x110')](db[_0x22e2('0x10')],{});db[_0x22e2('0x17f')][_0x22e2('0x110')](db['FaxQueue'],{});db[_0x22e2('0x133')][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':_0x22e2('0x175'),'foreignKey':_0x22e2('0x180'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x133')][_0x22e2('0x100')](db[_0x22e2('0x15d')],{'as':_0x22e2('0x177'),'foreignKey':_0x22e2('0x180')});db[_0x22e2('0x133')][_0x22e2('0x100')](db[_0x22e2('0x181')],{'as':_0x22e2('0x14f'),'foreignKey':'SmsAccountId'});db[_0x22e2('0x133')][_0x22e2('0x100')](db[_0x22e2('0x4e')],{'as':'Interactions'});db[_0x22e2('0x133')][_0x22e2('0x100')](db[_0x22e2('0x4d')],{'as':'Applications'});db[_0x22e2('0x133')][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db['SmsAccount'][_0x22e2('0x110')](db[_0x22e2('0x78')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':'Agents','through':_0x22e2('0x135')});db[_0x22e2('0x4d')]['belongsTo'](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x4d')][_0x22e2('0x110')](db['SmsQueue'],{'onDelete':_0x22e2('0x159')});db['SmsApplication'][_0x22e2('0x110')](db[_0x22e2('0x133')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x4d')]['belongsTo'](db[_0x22e2('0x147')],{'onDelete':_0x22e2('0x159'),'foreignKey':'IntervalId'});db[_0x22e2('0x4d')]['belongsTo'](db[_0x22e2('0x168')],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x171')});db['SmsInteraction'][_0x22e2('0x100')](db[_0x22e2('0x181')],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x182')});db[_0x22e2('0x4e')][_0x22e2('0x110')](db[_0x22e2('0x133')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x180')});db[_0x22e2('0x4e')]['belongsTo'](db['CmContact'],{'as':_0x22e2('0x164'),'foreignKey':'ContactId'});db[_0x22e2('0x4e')]['belongsTo'](db[_0x22e2('0x10')],{'as':_0x22e2('0x17b'),'foreignKey':'UserId'});db['SmsInteraction'][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x183'),'as':_0x22e2('0x167')});db[_0x22e2('0x4e')]['belongsToMany'](db['Tag'],{'through':_0x22e2('0x183'),'as':_0x22e2('0x169')});db[_0x22e2('0x4e')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x16a'),'through':'user_has_sms_interactions','foreignKey':_0x22e2('0x182')});db[_0x22e2('0x181')]['belongsTo'](db[_0x22e2('0x10')],{'as':'User'});db['SmsMessage'][_0x22e2('0x110')](db[_0x22e2('0x66')],{'onDelete':'cascade','as':_0x22e2('0x164')});db['SmsMessage'][_0x22e2('0x110')](db[_0x22e2('0x4e')],{'onDelete':_0x22e2('0xff'),'as':_0x22e2('0x16c'),'foreignKey':_0x22e2('0x182')});db[_0x22e2('0x181')][_0x22e2('0x110')](db[_0x22e2('0x133')],{'as':'Account','foreignKey':_0x22e2('0x180')});db[_0x22e2('0x4f')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x127'),'foreignKey':_0x22e2('0x184')});db[_0x22e2('0x4f')][_0x22e2('0x113')](db[_0x22e2('0x11a')],{'through':'team_has_sms_queues','as':'Teams'});db[_0x22e2('0x130')][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':_0x22e2('0x175'),'foreignKey':_0x22e2('0x185'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x130')][_0x22e2('0x100')](db['CannedAnswer'],{'as':_0x22e2('0x177'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x22e2('0x100')](db[_0x22e2('0x106')],{'as':_0x22e2('0x178'),'foreignKey':_0x22e2('0x185')});db[_0x22e2('0x130')]['hasMany'](db[_0x22e2('0x54')],{'as':_0x22e2('0x14f'),'foreignKey':_0x22e2('0x185')});db[_0x22e2('0x130')]['hasMany'](db[_0x22e2('0x52')],{'as':_0x22e2('0x13c'),'foreignKey':'OpenchannelAccountId'});db[_0x22e2('0x130')][_0x22e2('0x110')](db['CmList'],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db['OpenchannelAccount']['belongsTo'](db[_0x22e2('0x78')],{'as':'mandatoryDispositionPause','foreignKey':_0x22e2('0x149')});db[_0x22e2('0x130')][_0x22e2('0x113')](db['User'],{'as':_0x22e2('0x161'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0x52')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x22e2('0x159'),'foreignKey':'OpenchannelQueueId'});db[_0x22e2('0x52')]['belongsTo'](db[_0x22e2('0x130')],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x185')});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x148')});db[_0x22e2('0x52')]['belongsTo'](db[_0x22e2('0x168')],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x171')});db[_0x22e2('0x106')]['hasMany'](db[_0x22e2('0x54')],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x186')});db[_0x22e2('0x106')][_0x22e2('0x110')](db['OpenchannelAccount'],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x185')});db['OpenchannelInteraction']['belongsTo'](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':'ContactId'});db[_0x22e2('0x106')][_0x22e2('0x110')](db['User'],{'as':_0x22e2('0x17b'),'foreignKey':_0x22e2('0xfd')});db[_0x22e2('0x106')]['belongsToMany'](db[_0x22e2('0x168')],{'through':_0x22e2('0x187'),'as':_0x22e2('0x167')});db[_0x22e2('0x106')][_0x22e2('0x113')](db['Tag'],{'through':_0x22e2('0x187'),'as':_0x22e2('0x169')});db[_0x22e2('0x106')]['belongsToMany'](db['User'],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x188'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0xff'),'as':_0x22e2('0x10')});db['OpenchannelMessage'][_0x22e2('0x110')](db['CmContact'],{'onDelete':'cascade','as':_0x22e2('0x164')});db[_0x22e2('0x54')][_0x22e2('0x110')](db[_0x22e2('0x106')],{'onDelete':_0x22e2('0xff'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x22e2('0x54')][_0x22e2('0x110')](db[_0x22e2('0xd7')],{'as':_0x22e2('0xd7'),'foreignKey':'AttachmentId'});db[_0x22e2('0x54')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x185')});db[_0x22e2('0x56')][_0x22e2('0x113')](db['User'],{'as':_0x22e2('0x161'),'through':_0x22e2('0x35'),'foreignKey':_0x22e2('0x189')});db['OpenchannelQueue'][_0x22e2('0x113')](db['Team'],{'through':_0x22e2('0x18a'),'as':_0x22e2('0x14b')});db[_0x22e2('0x58')][_0x22e2('0x100')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x22e2('0x16e'),'onDelete':'cascade'});db['ChatWebsite']['hasMany'](db[_0x22e2('0x15d')],{'as':_0x22e2('0x177'),'foreignKey':'ChatWebsiteId'});db[_0x22e2('0x58')][_0x22e2('0x100')](db[_0x22e2('0x62')],{'as':_0x22e2('0x18b')});db['ChatWebsite'][_0x22e2('0x100')](db[_0x22e2('0x108')],{'as':_0x22e2('0x178')});db[_0x22e2('0x58')][_0x22e2('0x100')](db[_0x22e2('0x18c')],{'as':'Applications'});db[_0x22e2('0x58')][_0x22e2('0x100')](db[_0x22e2('0x5c')],{'as':_0x22e2('0x14f')});db[_0x22e2('0x58')]['belongsTo'](db['CmList'],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db[_0x22e2('0x58')][_0x22e2('0x110')](db[_0x22e2('0x147')],{'as':_0x22e2('0x147'),'foreignKey':_0x22e2('0x148')});db['ChatWebsite'][_0x22e2('0x110')](db['MailAccount'],{'as':_0x22e2('0x12d'),'foreignKey':_0x22e2('0x15c')});db[_0x22e2('0x58')]['belongsTo'](db[_0x22e2('0x78')],{'as':_0x22e2('0x160'),'foreignKey':_0x22e2('0x149')});db[_0x22e2('0x58')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':'Agents','through':_0x22e2('0x12a')});db[_0x22e2('0x59')][_0x22e2('0x110')](db[_0x22e2('0x130')],{});db[_0x22e2('0x59')][_0x22e2('0x110')](db['CmList'],{'as':'List','foreignKey':_0x22e2('0x173')});db['OpenchannelQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':'Contact','foreignKey':_0x22e2('0x165')});db['OpenchannelQueueReport']['belongsTo'](db[_0x22e2('0x106')],{});db[_0x22e2('0x59')]['belongsTo'](db[_0x22e2('0x54')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x22e2('0x10')],{});db['OpenchannelQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x56')],{});db[_0x22e2('0x18c')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'as':_0x22e2('0x18d'),'foreignKey':_0x22e2('0xfd'),'onDelete':'restrict'});db[_0x22e2('0x18c')][_0x22e2('0x110')](db[_0x22e2('0x5e')],{'as':_0x22e2('0x18e'),'foreignKey':'ChatQueueId','onDelete':_0x22e2('0x159')});db[_0x22e2('0x18c')][_0x22e2('0x110')](db[_0x22e2('0x58')],{'as':_0x22e2('0x18f'),'foreignKey':_0x22e2('0x16e'),'onDelete':_0x22e2('0x159')});db[_0x22e2('0x18c')][_0x22e2('0x110')](db[_0x22e2('0x168')],{'onDelete':_0x22e2('0x159'),'foreignKey':_0x22e2('0x171')});db['ChatInteraction'][_0x22e2('0x100')](db['ChatMessage'],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x190')});db[_0x22e2('0x108')]['belongsTo'](db[_0x22e2('0x58')],{'as':_0x22e2('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0x22e2('0x108')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':'ContactId'});db[_0x22e2('0x108')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0x22e2('0x108')]['belongsToMany'](db[_0x22e2('0x168')],{'through':_0x22e2('0x191'),'as':_0x22e2('0x167')});db[_0x22e2('0x108')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x191'),'as':'ThroughTags'});db[_0x22e2('0x108')]['belongsToMany'](db[_0x22e2('0x10')],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x192'),'foreignKey':_0x22e2('0x190')});db['ChatMessage'][_0x22e2('0x110')](db['User'],{'onDelete':'cascade','as':_0x22e2('0x10')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x22e2('0xff'),'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165')});db['ChatMessage']['belongsTo'](db[_0x22e2('0x108')],{'onDelete':'cascade','as':_0x22e2('0x16c'),'foreignKey':_0x22e2('0x190')});db[_0x22e2('0x5c')]['belongsTo'](db[_0x22e2('0xd7')],{'as':_0x22e2('0xd7'),'foreignKey':'AttachmentId'});db[_0x22e2('0x5c')][_0x22e2('0x110')](db[_0x22e2('0x58')],{'as':'Account','foreignKey':_0x22e2('0x16e')});db['ChatOfflineMessage'][_0x22e2('0x100')](db[_0x22e2('0xd7')],{'as':_0x22e2('0x193'),'foreignKey':_0x22e2('0x170'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x16f')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'onDelete':_0x22e2('0xff'),'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x16f')][_0x22e2('0x110')](db[_0x22e2('0x58')],{'as':_0x22e2('0x16d'),'foreignKey':'ChatWebsiteId'});db[_0x22e2('0x5e')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x30'),'hooks':!![]});db[_0x22e2('0x5e')]['belongsToMany'](db['Team'],{'through':_0x22e2('0x194'),'as':'Teams'});db[_0x22e2('0x60')][_0x22e2('0x100')](db['ChatInternalMessage'],{'as':_0x22e2('0x14f'),'foreignKey':_0x22e2('0x195'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x60')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':'Members','through':_0x22e2('0x115')});db[_0x22e2('0x62')][_0x22e2('0x110')](db['ChatWebsite'],{'as':_0x22e2('0x18f'),'foreignKey':_0x22e2('0x16e')});db['CmCompany'][_0x22e2('0x100')](db[_0x22e2('0x66')],{'as':_0x22e2('0x116'),'foreignKey':_0x22e2('0x196')});db[_0x22e2('0x66')][_0x22e2('0x100')](db['CmHopper'],{'as':_0x22e2('0x197'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0x103')],{'as':_0x22e2('0x104'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x66')]['hasMany'](db[_0x22e2('0x6c')],{'as':_0x22e2('0x198'),'foreignKey':'ContactId'});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0x105')],{'as':_0x22e2('0x105'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0xc6')],{'as':_0x22e2('0x142'),'foreignKey':'ContactId'});db['CmContact'][_0x22e2('0x100')](db[_0x22e2('0x106')],{'as':'OpenchannelInteractions','foreignKey':_0x22e2('0x165'),'onDelete':'restrict'});db[_0x22e2('0x66')]['hasMany'](db[_0x22e2('0x108')],{'as':_0x22e2('0x109'),'foreignKey':_0x22e2('0x165'),'onDelete':_0x22e2('0x159')});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0x4e')],{'as':_0x22e2('0x10a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0x47')],{'as':_0x22e2('0x10b'),'foreignKey':_0x22e2('0x165'),'onDelete':'restrict'});db[_0x22e2('0x66')][_0x22e2('0x100')](db[_0x22e2('0x3d')],{'as':_0x22e2('0x10c'),'foreignKey':'ContactId','onDelete':_0x22e2('0x159')});db['CmContact'][_0x22e2('0x110')](db['CmCompany'],{'as':_0x22e2('0x199'),'foreignKey':_0x22e2('0x196')});db[_0x22e2('0x66')][_0x22e2('0x110')](db['CmList'],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173'),'onDelete':'cascade'});db[_0x22e2('0x66')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x117')});db['CmContact']['belongsToMany'](db[_0x22e2('0x168')],{'as':'Tags','through':_0x22e2('0x19a')});db[_0x22e2('0x66')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x19a'),'as':_0x22e2('0x169')});db[_0x22e2('0x68')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165'),'onDelete':'cascade'});db[_0x22e2('0x68')][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x68')][_0x22e2('0x110')](db['User'],{'as':_0x22e2('0x18d'),'foreignKey':_0x22e2('0xfd')});db['CmHopper'][_0x22e2('0x110')](db[_0x22e2('0x1a')],{'as':_0x22e2('0x18e'),'foreignKey':_0x22e2('0x13f'),'onDelete':'cascade'});db[_0x22e2('0x68')][_0x22e2('0x110')](db[_0x22e2('0xd3')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x22e2('0xff')});db[_0x22e2('0x68')][_0x22e2('0x110')](db['User'],{'as':'Owner','foreignKey':_0x22e2('0x19b')});db[_0x22e2('0x140')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165'),'onDelete':_0x22e2('0xff')});db['CmHopperBlack'][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x140')][_0x22e2('0x110')](db['VoiceQueue'],{'as':_0x22e2('0x18e'),'foreignKey':'VoiceQueueId','onDelete':_0x22e2('0xff')});db[_0x22e2('0x140')][_0x22e2('0x110')](db[_0x22e2('0xd3')],{'as':'Campaign','foreignKey':_0x22e2('0x19c'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x71')][_0x22e2('0x100')](db['Condition'],{'as':{'plural':_0x22e2('0x19d'),'singular':_0x22e2('0x19e')},'foreignKey':_0x22e2('0x19f'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x71')]['hasMany'](db[_0x22e2('0x75')],{'as':{'plural':_0x22e2('0x1a0'),'singular':_0x22e2('0x1a1')},'foreignKey':_0x22e2('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x22e2('0x71')]['hasMany'](db[_0x22e2('0x70')],{'as':_0x22e2('0x1a3'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x22e2('0x74')][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':_0x22e2('0x175'),'foreignKey':_0x22e2('0x1a4'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x147')][_0x22e2('0x100')](db[_0x22e2('0x147')],{'as':_0x22e2('0x1a5'),'foreignKey':'IntervalId','onDelete':_0x22e2('0xff'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x22e2('0x16')],{'as':_0x22e2('0x102'),'foreignKey':_0x22e2('0x148'),'onDelete':_0x22e2('0x159')});db['Interval'][_0x22e2('0x100')](db[_0x22e2('0x40')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x22e2('0x147')][_0x22e2('0x100')](db[_0x22e2('0x18c')],{'as':_0x22e2('0x1a6'),'foreignKey':'IntervalId'});db[_0x22e2('0x147')][_0x22e2('0x100')](db[_0x22e2('0x46')],{'as':_0x22e2('0x1a7'),'foreignKey':_0x22e2('0x148')});db[_0x22e2('0x147')]['hasMany'](db[_0x22e2('0x4d')],{'as':_0x22e2('0x1a8'),'foreignKey':_0x22e2('0x148')});db['Schedule']['belongsTo'](db[_0x22e2('0x12d')],{});db[_0x22e2('0x7d')][_0x22e2('0x110')](db[_0x22e2('0x1a9')],{'foreignKey':_0x22e2('0x1aa')});db[_0x22e2('0x7d')][_0x22e2('0x110')](db[_0x22e2('0x1ab')],{'foreignKey':'CustomReportId'});db['Sound'][_0x22e2('0x113')](db[_0x22e2('0x18')],{'as':_0x22e2('0x1ac'),'through':_0x22e2('0x1ad'),'onDelete':_0x22e2('0x159')});db['Tag'][_0x22e2('0x113')](db[_0x22e2('0x66')],{'through':_0x22e2('0x19a')});db[_0x22e2('0x168')][_0x22e2('0x113')](db[_0x22e2('0x108')],{'through':_0x22e2('0x191')});db[_0x22e2('0x168')]['belongsToMany'](db[_0x22e2('0x3d')],{'through':'mail_interaction_has_tags'});db[_0x22e2('0x168')][_0x22e2('0x113')](db['SmsInteraction'],{'through':_0x22e2('0x183')});db[_0x22e2('0x168')][_0x22e2('0x113')](db[_0x22e2('0x47')],{'through':_0x22e2('0x17c')});db[_0x22e2('0x168')][_0x22e2('0x113')](db[_0x22e2('0x106')],{'through':_0x22e2('0x187')});db[_0x22e2('0x168')]['belongsToMany'](db[_0x22e2('0xec')],{'through':'whatsapp_interaction_has_tags'});db['Trigger']['hasMany'](db[_0x22e2('0x75')],{'as':{'plural':_0x22e2('0x1ae'),'singular':_0x22e2('0x1af')},'foreignKey':_0x22e2('0x1b0'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x82')]['hasMany'](db[_0x22e2('0x75')],{'as':{'plural':_0x22e2('0x1b1'),'singular':_0x22e2('0x1b2')},'foreignKey':'TriggerAnyId','onDelete':_0x22e2('0xff'),'hooks':!![]});db['Trigger'][_0x22e2('0x100')](db[_0x22e2('0x70')],{'as':_0x22e2('0x1a3'),'foreignKey':_0x22e2('0x1b3'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x1ab')][_0x22e2('0x100')](db[_0x22e2('0x8b')],{'as':_0x22e2('0x1b4'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b5'),'hooks':!![]});db[_0x22e2('0x1a9')][_0x22e2('0x100')](db[_0x22e2('0x8b')],{'as':_0x22e2('0x1b4'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1aa')});db[_0x22e2('0x89')][_0x22e2('0x100')](db['AnalyticFieldReport'],{'as':_0x22e2('0x1b4'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b6')});db[_0x22e2('0x8b')][_0x22e2('0x110')](db[_0x22e2('0x89')],{'foreignKey':_0x22e2('0x1b6')});db[_0x22e2('0x8f')][_0x22e2('0x100')](db[_0x22e2('0x90')],{'as':_0x22e2('0x1b7'),'onDelete':'cascade','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x90')]['hasMany'](db[_0x22e2('0x92')],{'as':_0x22e2('0x1b9'),'onDelete':'cascade','foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x90')][_0x22e2('0x100')](db[_0x22e2('0x92')],{'as':'Descriptions','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x90')][_0x22e2('0x100')](db[_0x22e2('0x92')],{'as':_0x22e2('0x1b4'),'onDelete':_0x22e2('0xff'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x22e2('0x8f')],{'as':'Account','foreignKey':'AccountId'});db[_0x22e2('0x92')]['hasMany'](db[_0x22e2('0x92')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db['SalesforceField'][_0x22e2('0x100')](db[_0x22e2('0x92')],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x92')][_0x22e2('0x100')](db['SalesforceField'],{'as':_0x22e2('0x1be'),'foreignKey':_0x22e2('0x1bf')});db['SalesforceField'][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':'Variable','foreignKey':'VariableId'});db[_0x22e2('0x94')][_0x22e2('0x100')](db['SugarcrmConfiguration'],{'as':_0x22e2('0x1b7'),'onDelete':'cascade','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x96')][_0x22e2('0x100')](db[_0x22e2('0x98')],{'as':_0x22e2('0x1b9'),'onDelete':'cascade','foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x96')][_0x22e2('0x100')](db[_0x22e2('0x98')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x22e2('0x96')][_0x22e2('0x100')](db[_0x22e2('0x98')],{'as':_0x22e2('0x1b4'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x96')][_0x22e2('0x110')](db['SugarcrmAccount'],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x98')][_0x22e2('0x100')](db[_0x22e2('0x98')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x98')][_0x22e2('0x100')](db['SugarcrmField'],{'as':'Description','foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x98')][_0x22e2('0x100')](db[_0x22e2('0x98')],{'as':_0x22e2('0x1be'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x98')][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':'Variable','foreignKey':_0x22e2('0x1c0')});db['DeskAccount'][_0x22e2('0x100')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b8')});db['DeskConfiguration'][_0x22e2('0x100')](db[_0x22e2('0x9d')],{'as':'Subjects','onDelete':_0x22e2('0xff'),'foreignKey':'SubjectId'});db['DeskConfiguration'][_0x22e2('0x100')](db[_0x22e2('0x9d')],{'as':_0x22e2('0x1c1'),'onDelete':'cascade','foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x9b')]['hasMany'](db[_0x22e2('0x9d')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x22e2('0x9b')]['belongsTo'](db[_0x22e2('0x9a')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x9b')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x1c2')});db['DeskField'][_0x22e2('0x100')](db[_0x22e2('0x9d')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x9d')][_0x22e2('0x100')](db[_0x22e2('0x9d')],{'as':_0x22e2('0x1bd'),'foreignKey':'DescriptionId'});db[_0x22e2('0x9d')][_0x22e2('0x100')](db[_0x22e2('0x9d')],{'as':'Field','foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x9d')]['belongsTo'](db['Variable'],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0x1c3')][_0x22e2('0x100')](db[_0x22e2('0x9f')],{'as':_0x22e2('0x1b7'),'onDelete':'cascade','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x9f')]['hasMany'](db[_0x22e2('0x1c4')],{'as':_0x22e2('0x1b9'),'onDelete':'cascade','foreignKey':_0x22e2('0x1ba')});db['ZohoConfiguration'][_0x22e2('0x100')](db[_0x22e2('0x1c4')],{'as':'Descriptions','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x9f')][_0x22e2('0x100')](db[_0x22e2('0x1c4')],{'as':'Fields','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x9f')]['belongsTo'](db[_0x22e2('0x1c3')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x1c4')][_0x22e2('0x100')](db[_0x22e2('0x1c4')],{'as':'Subject','foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x1c4')][_0x22e2('0x100')](db[_0x22e2('0x1c4')],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0x1c4')][_0x22e2('0x100')](db[_0x22e2('0x1c4')],{'as':'Field','foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x1c4')][_0x22e2('0x110')](db['Variable'],{'as':_0x22e2('0x84'),'foreignKey':'VariableId'});db[_0x22e2('0xa2')][_0x22e2('0x100')](db['ZendeskConfiguration'],{'as':_0x22e2('0x1b7'),'onDelete':_0x22e2('0xff'),'foreignKey':'AccountId'});db[_0x22e2('0xa4')][_0x22e2('0x100')](db[_0x22e2('0xa5')],{'as':_0x22e2('0x1b9'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xa4')][_0x22e2('0x100')](db[_0x22e2('0xa5')],{'as':'Descriptions','foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xa4')][_0x22e2('0x100')](db[_0x22e2('0xa5')],{'as':_0x22e2('0x1b4'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x22e2('0x110')](db[_0x22e2('0xa2')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xa4')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x22e2('0x100')](db[_0x22e2('0xa5')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xa5')][_0x22e2('0x100')](db['ZendeskField'],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xa5')]['hasMany'](db['ZendeskField'],{'as':_0x22e2('0x1be'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0xa5')][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0xa7')][_0x22e2('0x100')](db[_0x22e2('0xa9')],{'as':'Configurations','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xa9')][_0x22e2('0x100')](db['FreshdeskField'],{'as':_0x22e2('0x1b9'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xa9')][_0x22e2('0x100')](db['FreshdeskField'],{'as':_0x22e2('0x1c1'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bb')});db['FreshdeskConfiguration'][_0x22e2('0x100')](db['FreshdeskField'],{'as':_0x22e2('0x1b4'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x22e2('0xa9')][_0x22e2('0x110')](db[_0x22e2('0xa7')],{'as':'Account','foreignKey':'AccountId'});db[_0x22e2('0xa9')][_0x22e2('0x113')](db[_0x22e2('0x168')],{'through':_0x22e2('0x1c5')});db[_0x22e2('0xab')][_0x22e2('0x100')](db[_0x22e2('0xab')],{'as':_0x22e2('0x1bc'),'foreignKey':'SubjectId'});db[_0x22e2('0xab')]['hasMany'](db[_0x22e2('0xab')],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db['FreshdeskField'][_0x22e2('0x100')](db[_0x22e2('0xab')],{'as':_0x22e2('0x1be'),'foreignKey':'FieldId'});db[_0x22e2('0xab')][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0xad')][_0x22e2('0x100')](db[_0x22e2('0x1c6')],{'as':'Configurations','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0x1c6')][_0x22e2('0x100')](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1b9'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x1c6')][_0x22e2('0x100')](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1c1'),'foreignKey':'DescriptionId'});db[_0x22e2('0x1c6')][_0x22e2('0x100')](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1b4'),'foreignKey':_0x22e2('0x1bf')});db['VtigerConfiguration'][_0x22e2('0x110')](db[_0x22e2('0xad')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db['VtigerField'][_0x22e2('0x100')](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1bc'),'foreignKey':'SubjectId'});db[_0x22e2('0xaf')][_0x22e2('0x100')](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1bd'),'foreignKey':'DescriptionId'});db[_0x22e2('0xaf')]['hasMany'](db[_0x22e2('0xaf')],{'as':_0x22e2('0x1be'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x22e2('0x84')],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0xb0')][_0x22e2('0x100')](db[_0x22e2('0x1c7')],{'as':_0x22e2('0x1b7'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1b8')});db['ServicenowConfiguration'][_0x22e2('0x100')](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1b9'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0x1c7')][_0x22e2('0x100')](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1c1'),'foreignKey':'DescriptionId'});db[_0x22e2('0x1c7')][_0x22e2('0x100')](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1b4'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0x1c7')][_0x22e2('0x110')](db[_0x22e2('0xb0')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xb3')][_0x22e2('0x100')](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xb3')]['hasMany'](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xb3')][_0x22e2('0x100')](db[_0x22e2('0xb3')],{'as':_0x22e2('0x1be'),'foreignKey':_0x22e2('0x1bf')});db['ServicenowField'][_0x22e2('0x110')](db['Variable'],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0xb5')][_0x22e2('0x100')](db[_0x22e2('0xb6')],{'as':_0x22e2('0x1b7'),'onDelete':'cascade','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xb5')][_0x22e2('0x110')](db[_0x22e2('0x157')],{'as':_0x22e2('0x157'),'foreignKey':_0x22e2('0x158')});db[_0x22e2('0xb6')][_0x22e2('0x100')](db[_0x22e2('0xb8')],{'as':_0x22e2('0x1b9'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xb6')]['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xb6')][_0x22e2('0x100')](db[_0x22e2('0xb8')],{'as':_0x22e2('0x1b4'),'onDelete':'cascade','foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0xb6')][_0x22e2('0x110')](db[_0x22e2('0xb5')],{'as':_0x22e2('0x16d'),'foreignKey':'AccountId'});db[_0x22e2('0xb8')]['hasMany'](db[_0x22e2('0xb8')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db['Dynamics365Field'][_0x22e2('0x100')](db['Dynamics365Field'],{'as':_0x22e2('0x1bd'),'foreignKey':'DescriptionId'});db[_0x22e2('0xb8')][_0x22e2('0x100')](db[_0x22e2('0xb8')],{'as':_0x22e2('0x1be'),'foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0xb8')][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db['FreshsalesAccount'][_0x22e2('0x100')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xbb')][_0x22e2('0x100')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xbb')][_0x22e2('0x100')](db[_0x22e2('0xbd')],{'as':_0x22e2('0x1c1'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xbb')][_0x22e2('0x100')](db[_0x22e2('0xbd')],{'as':_0x22e2('0x1b4'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x22e2('0x110')](db[_0x22e2('0xb9')],{'as':'Account','foreignKey':_0x22e2('0x1b8')});db[_0x22e2('0xbd')]['hasMany'](db[_0x22e2('0xbd')],{'as':_0x22e2('0x1bc'),'foreignKey':_0x22e2('0x1ba')});db[_0x22e2('0xbd')][_0x22e2('0x100')](db['FreshsalesField'],{'as':_0x22e2('0x1bd'),'foreignKey':_0x22e2('0x1bb')});db[_0x22e2('0xbd')][_0x22e2('0x100')](db[_0x22e2('0xbd')],{'as':'Field','foreignKey':_0x22e2('0x1bf')});db[_0x22e2('0xbd')][_0x22e2('0x110')](db[_0x22e2('0x84')],{'as':_0x22e2('0x84'),'foreignKey':_0x22e2('0x1c0')});db[_0x22e2('0xc0')][_0x22e2('0x110')](db[_0x22e2('0x58')],{});db['ChatQueueReport'][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':_0x22e2('0x173')});db['ChatQueueReport'][_0x22e2('0x110')](db['CmContact'],{'as':'Contact','foreignKey':_0x22e2('0x165')});db['ChatQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x108')],{});db[_0x22e2('0xc0')]['belongsTo'](db[_0x22e2('0x5c')],{});db['ChatQueueReport'][_0x22e2('0x110')](db['User'],{});db[_0x22e2('0xc0')][_0x22e2('0x110')](db[_0x22e2('0x5e')],{});db['ChatInternalMessage'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1c8')});db[_0x22e2('0xc2')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x1c9')});db[_0x22e2('0xc6')][_0x22e2('0x100')](db['JscriptyQuestionReport'],{'foreignKey':_0x22e2('0x1ca'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0xc6')][_0x22e2('0x100')](db['JscriptyAnswerReport'],{'foreignKey':_0x22e2('0x1ca'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x1cb')]['belongsTo'](db[_0x22e2('0x133')],{});db['SmsQueueReport']['belongsTo'](db[_0x22e2('0xe2')],{'as':'List','foreignKey':_0x22e2('0x173')});db[_0x22e2('0x1cb')]['belongsTo'](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':'ContactId'});db[_0x22e2('0x1cb')][_0x22e2('0x110')](db[_0x22e2('0x4e')],{});db[_0x22e2('0x1cb')]['belongsTo'](db[_0x22e2('0x181')],{});db['SmsQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x10')],{});db[_0x22e2('0x1cb')][_0x22e2('0x110')](db[_0x22e2('0x4f')],{});db[_0x22e2('0xc7')][_0x22e2('0x100')](db[_0x22e2('0xc6')],{'foreignKey':_0x22e2('0x1cc')});db[_0x22e2('0xc7')][_0x22e2('0x100')](db[_0x22e2('0x1cd')],{'foreignKey':_0x22e2('0x1cc')});db['JscriptyProject'][_0x22e2('0x100')](db[_0x22e2('0xc4')],{'foreignKey':'ProjectId'});db[_0x22e2('0xcc')][_0x22e2('0x113')](db['User'],{'as':_0x22e2('0x16a'),'through':_0x22e2('0x138')});db['Team'][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x11b')});db['Team'][_0x22e2('0x113')](db[_0x22e2('0x1a')],{'through':_0x22e2('0xf6'),'as':_0x22e2('0x11f')});db[_0x22e2('0x11a')]['belongsToMany'](db[_0x22e2('0x3a')],{'through':_0x22e2('0x162'),'as':'MailQueues'});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0x5e')],{'through':_0x22e2('0x194'),'as':_0x22e2('0x123')});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0x124')],{'through':_0x22e2('0x17e'),'as':'FaxQueues'});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0x4f')],{'through':_0x22e2('0x1ce'),'as':_0x22e2('0x126')});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0x56')],{'through':'team_has_openchannel_queues','as':_0x22e2('0x128')});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0xf3')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x22e2('0x11a')][_0x22e2('0x113')](db[_0x22e2('0x1cf')],{'through':_0x22e2('0xf8'),'as':'VoicePrefixes'});db[_0x22e2('0xd3')][_0x22e2('0x100')](db[_0x22e2('0x68')],{'as':_0x22e2('0x197'),'foreignKey':_0x22e2('0x19c')});db[_0x22e2('0xd3')]['hasMany'](db[_0x22e2('0x103')],{'as':_0x22e2('0x104'),'foreignKey':_0x22e2('0x19c')});db[_0x22e2('0xd3')]['hasMany'](db[_0x22e2('0x6c')],{'as':_0x22e2('0x198'),'foreignKey':_0x22e2('0x19c')});db[_0x22e2('0xd3')][_0x22e2('0x100')](db['CmHopperBlack'],{'as':_0x22e2('0x141'),'foreignKey':_0x22e2('0x19c')});db[_0x22e2('0xd3')][_0x22e2('0x110')](db[_0x22e2('0x144')],{'as':_0x22e2('0x144'),'foreignKey':_0x22e2('0x143')});db[_0x22e2('0xd3')][_0x22e2('0x110')](db[_0x22e2('0x144')],{'as':_0x22e2('0x145'),'foreignKey':'TrunkBackupId'});db[_0x22e2('0xd3')]['belongsTo'](db[_0x22e2('0x147')],{'as':_0x22e2('0x147'),'foreignKey':_0x22e2('0x148')});db[_0x22e2('0xd3')]['belongsTo'](db[_0x22e2('0xcc')],{'as':_0x22e2('0xcc'),'foreignKey':_0x22e2('0x1d0')});db[_0x22e2('0xd3')][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x118'),'through':_0x22e2('0x1d1')});db[_0x22e2('0xd3')][_0x22e2('0x113')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x14c'),'through':_0x22e2('0x1d2')});db[_0x22e2('0xd7')]['belongsTo'](db[_0x22e2('0x16f')],{'as':_0x22e2('0x16f'),'foreignKey':'ChatOfflineMessageId'});db['MailTransferReport'][_0x22e2('0x110')](db[_0x22e2('0x3e')],{});db[_0x22e2('0xda')][_0x22e2('0x110')](db[_0x22e2('0x3d')],{});db[_0x22e2('0xda')][_0x22e2('0x110')](db[_0x22e2('0x12d')],{'foreignKey':_0x22e2('0x1d3'),'as':_0x22e2('0x1d4')});db[_0x22e2('0xda')]['belongsTo'](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':_0x22e2('0x1d6')});db['MailTransferReport'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d7'),'as':'ToAgent'});db[_0x22e2('0xda')]['belongsTo'](db['MailQueue'],{'foreignKey':_0x22e2('0x1d8'),'as':_0x22e2('0x1d9')});db[_0x22e2('0xda')][_0x22e2('0x110')](db[_0x22e2('0x12d')],{'foreignKey':_0x22e2('0x1da'),'as':_0x22e2('0x1db')});db[_0x22e2('0xdc')][_0x22e2('0x110')](db['ChatMessage'],{});db[_0x22e2('0xdc')]['belongsTo'](db['ChatInteraction'],{});db[_0x22e2('0xdc')][_0x22e2('0x110')](db[_0x22e2('0x58')],{'foreignKey':_0x22e2('0x1dc'),'as':'FromAccount'});db[_0x22e2('0xdc')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':_0x22e2('0x1d6')});db['ChatTransferReport'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d7'),'as':_0x22e2('0x1dd')});db[_0x22e2('0xdc')][_0x22e2('0x110')](db[_0x22e2('0x5e')],{'foreignKey':'ToChatQueueId','as':_0x22e2('0x1d9')});db[_0x22e2('0xdc')]['belongsTo'](db[_0x22e2('0x58')],{'foreignKey':_0x22e2('0x1de'),'as':'ToAccount'});db[_0x22e2('0xde')][_0x22e2('0x110')](db[_0x22e2('0x49')],{});db[_0x22e2('0xde')][_0x22e2('0x110')](db[_0x22e2('0x47')],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0x22e2('0x1df'),'as':_0x22e2('0x1d4')});db[_0x22e2('0xde')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':_0x22e2('0x1d6')});db['FaxTransferReport']['belongsTo'](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d7'),'as':_0x22e2('0x1dd')});db[_0x22e2('0xde')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x22e2('0x1e0'),'as':_0x22e2('0x1d9')});db[_0x22e2('0xde')][_0x22e2('0x110')](db[_0x22e2('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x22e2('0x1db')});db[_0x22e2('0xe0')][_0x22e2('0x110')](db[_0x22e2('0x54')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x22e2('0x106')],{});db[_0x22e2('0xe0')]['belongsTo'](db[_0x22e2('0x130')],{'foreignKey':_0x22e2('0x1e1'),'as':_0x22e2('0x1d4')});db[_0x22e2('0xe0')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':'FromAgent'});db[_0x22e2('0xe0')]['belongsTo'](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d7'),'as':_0x22e2('0x1dd')});db[_0x22e2('0xe0')][_0x22e2('0x110')](db['OpenchannelQueue'],{'foreignKey':_0x22e2('0x1e2'),'as':_0x22e2('0x1d9')});db['OpenchannelTransferReport'][_0x22e2('0x110')](db[_0x22e2('0x130')],{'foreignKey':_0x22e2('0x1e3'),'as':_0x22e2('0x1db')});db[_0x22e2('0x1e4')]['belongsTo'](db['SmsMessage'],{});db[_0x22e2('0x1e4')]['belongsTo'](db['SmsInteraction'],{});db[_0x22e2('0x1e4')][_0x22e2('0x110')](db[_0x22e2('0x133')],{'foreignKey':_0x22e2('0x1e5'),'as':_0x22e2('0x1d4')});db['SmsTransferReport'][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':'FromAgent'});db[_0x22e2('0x1e4')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x22e2('0x1e4')][_0x22e2('0x110')](db[_0x22e2('0x4f')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0x22e2('0x1e4')][_0x22e2('0x110')](db[_0x22e2('0x133')],{'foreignKey':_0x22e2('0x1e6'),'as':_0x22e2('0x1db')});db['CmList'][_0x22e2('0x100')](db[_0x22e2('0x74')],{'as':_0x22e2('0x175'),'foreignKey':'ListId','onDelete':_0x22e2('0xff')});db[_0x22e2('0xe2')][_0x22e2('0x100')](db[_0x22e2('0x6f')],{'as':_0x22e2('0x1e7'),'foreignKey':'ListId'});db[_0x22e2('0xe2')][_0x22e2('0x100')](db['CmContact'],{'as':_0x22e2('0x116'),'onDelete':_0x22e2('0xff'),'foreignKey':_0x22e2('0x173')});db['CmList'][_0x22e2('0x100')](db['CmHopperFinal'],{'as':_0x22e2('0x104'),'foreignKey':'ListId'});db[_0x22e2('0xe2')]['hasMany'](db[_0x22e2('0x6c')],{'as':_0x22e2('0x1e8'),'foreignKey':_0x22e2('0x173')});db[_0x22e2('0xe2')]['hasMany'](db[_0x22e2('0x105')],{'as':'ReportAgentPreview','foreignKey':_0x22e2('0x173')});db['CmList'][_0x22e2('0x113')](db[_0x22e2('0x1a')],{'as':'Queues','through':_0x22e2('0x14a')});db[_0x22e2('0xe2')]['belongsToMany'](db['User'],{'as':_0x22e2('0x161'),'through':_0x22e2('0x119')});db['VoicePrefix'][_0x22e2('0x100')](db[_0x22e2('0x16')],{'as':_0x22e2('0x102'),'onDelete':'cascade'});db[_0x22e2('0x1cf')][_0x22e2('0x113')](db['User'],{'as':_0x22e2('0x161'),'through':_0x22e2('0xf9')});db[_0x22e2('0x1cf')][_0x22e2('0x113')](db[_0x22e2('0x11a')],{'through':_0x22e2('0xf8'),'as':_0x22e2('0x14b')});db[_0x22e2('0x111')][_0x22e2('0x100')](db['User'],{'as':_0x22e2('0x16a'),'foreignKey':_0x22e2('0x112')});db[_0x22e2('0x111')][_0x22e2('0x100')](db[_0x22e2('0xe4')],{'as':_0x22e2('0x1e9'),'foreignKey':_0x22e2('0x112'),'onDelete':'cascade'});db['UserProfileSection'][_0x22e2('0x100')](db[_0x22e2('0xe6')],{'as':_0x22e2('0x1ea'),'foreignKey':_0x22e2('0x1eb'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x136')][_0x22e2('0x100')](db['Disposition'],{'as':_0x22e2('0x175'),'foreignKey':_0x22e2('0x1ec'),'onDelete':_0x22e2('0xff')});db[_0x22e2('0x136')]['hasMany'](db[_0x22e2('0x15d')],{'as':_0x22e2('0x177'),'foreignKey':_0x22e2('0x1ec')});db[_0x22e2('0x136')][_0x22e2('0x100')](db[_0x22e2('0xee')],{'as':'Messages','foreignKey':_0x22e2('0x1ec')});db['WhatsappAccount']['hasMany'](db[_0x22e2('0xec')],{'as':_0x22e2('0x178')});db[_0x22e2('0x136')][_0x22e2('0x100')](db[_0x22e2('0xea')],{'as':'Applications'});db[_0x22e2('0x136')][_0x22e2('0x110')](db[_0x22e2('0xe2')],{'as':_0x22e2('0x15e'),'foreignKey':'ListId'});db[_0x22e2('0x136')][_0x22e2('0x110')](db[_0x22e2('0x78')],{'as':_0x22e2('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x22e2('0x136')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':_0x22e2('0x1ed')});db[_0x22e2('0xea')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'onDelete':_0x22e2('0x159')});db[_0x22e2('0xea')][_0x22e2('0x110')](db[_0x22e2('0xf3')],{'onDelete':_0x22e2('0x159')});db['WhatsappApplication']['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x22e2('0x159')});db['WhatsappApplication'][_0x22e2('0x110')](db[_0x22e2('0x147')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication'][_0x22e2('0x110')](db[_0x22e2('0x168')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x22e2('0xec')][_0x22e2('0x100')](db[_0x22e2('0xee')],{'as':_0x22e2('0x14f'),'onDelete':_0x22e2('0xff'),'foreignKey':'WhatsappInteractionId'});db[_0x22e2('0xec')]['belongsTo'](db[_0x22e2('0x136')],{'as':'Account','foreignKey':_0x22e2('0x1ec')});db[_0x22e2('0xec')]['belongsTo'](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':_0x22e2('0x165')});db[_0x22e2('0xec')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'as':'Owner','foreignKey':_0x22e2('0xfd')});db[_0x22e2('0xec')]['belongsToMany'](db[_0x22e2('0x168')],{'through':_0x22e2('0x1ee'),'as':_0x22e2('0x167')});db[_0x22e2('0xec')]['belongsToMany'](db[_0x22e2('0x168')],{'through':_0x22e2('0x1ee'),'as':_0x22e2('0x169')});db['WhatsappInteraction'][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x16a'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0x22e2('0xee')][_0x22e2('0x110')](db['User'],{'as':'User'});db[_0x22e2('0xee')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'onDelete':'cascade','as':_0x22e2('0x164')});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x22e2('0x1ef')});db['WhatsappMessage']['belongsTo'](db[_0x22e2('0x136')],{'as':_0x22e2('0x16d'),'foreignKey':_0x22e2('0x1ec')});db[_0x22e2('0xf0')]['belongsTo'](db[_0x22e2('0x136')],{});db[_0x22e2('0xf0')]['belongsTo'](db[_0x22e2('0xe2')],{'as':'List','foreignKey':'ListId'});db[_0x22e2('0xf0')][_0x22e2('0x110')](db[_0x22e2('0x66')],{'as':_0x22e2('0x164'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x22e2('0x110')](db[_0x22e2('0xec')],{});db[_0x22e2('0xf0')][_0x22e2('0x110')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x22e2('0x110')](db[_0x22e2('0xee')],{});db['WhatsappQueueReport'][_0x22e2('0x110')](db[_0x22e2('0x10')],{});db[_0x22e2('0xf1')]['belongsTo'](db[_0x22e2('0xee')],{});db['WhatsappTransferReport'][_0x22e2('0x110')](db['WhatsappInteraction'],{});db[_0x22e2('0xf1')][_0x22e2('0x110')](db[_0x22e2('0x136')],{'foreignKey':_0x22e2('0x1f0'),'as':'FromAccount'});db[_0x22e2('0xf1')][_0x22e2('0x110')](db[_0x22e2('0x136')],{'foreignKey':'ToWhatsappAccountId','as':_0x22e2('0x1db')});db['WhatsappTransferReport'][_0x22e2('0x110')](db[_0x22e2('0xf3')],{'foreignKey':_0x22e2('0x1f1'),'as':_0x22e2('0x1d9')});db[_0x22e2('0xf1')][_0x22e2('0x110')](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d5'),'as':_0x22e2('0x1d6')});db[_0x22e2('0xf1')]['belongsTo'](db[_0x22e2('0x10')],{'foreignKey':_0x22e2('0x1d7'),'as':'ToAgent'});db[_0x22e2('0xf3')][_0x22e2('0x113')](db[_0x22e2('0x10')],{'as':_0x22e2('0x161'),'through':'UserWhatsappQueue','foreignKey':_0x22e2('0x1f2')});db['WhatsappQueue']['belongsToMany'](db[_0x22e2('0x11a')],{'through':_0x22e2('0x1f3'),'as':'Teams'});db[_0x22e2('0xfa')]['belongsTo'](db[_0x22e2('0x10')],{'as':_0x22e2('0x1f4'),'foreignKey':_0x22e2('0xfd'),'onDelete':_0x22e2('0xff'),'hooks':!![]});db[_0x22e2('0x157')]['hasOne'](db[_0x22e2('0xb5')],{'as':_0x22e2('0xb5'),'onDelete':'restrict'});db[_0x22e2('0x157')][_0x22e2('0xfc')](db[_0x22e2('0x156')],{'as':_0x22e2('0x15a'),'onDelete':_0x22e2('0x159')});db[_0x22e2('0x157')]['hasOne'](db[_0x22e2('0x39')],{'as':'Smtp','onDelete':_0x22e2('0x159')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbf9c=['HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','CmContact','Contacts','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueue','MailQueues','UserMailQueue','ChatQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceQueueReport','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','MailApplication','Applications','Template','TemplateId','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsite','ChatWebsiteId','TagId','List','ListId','FaxAccountId','Exntensions','FaxMessage','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','CannedAnswer','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','Interaction','team_has_openchannel_queues','ChatApplication','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','UserChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','ChatInteractions','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','VoiceMusicOnHold','moh_has_sounds','sms_interaction_has_tags','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmConfiguration','Descriptions','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerField','ServicenowAccount','Dynamics365Configuration','FreshsalesAccount','FromId','SessionId','JscriptyAnswerReport','SmsQueueReport','JscriptyProject','ProjectId','JscriptyQuestionReport','team_has_mail_queues','ChatQueues','FaxQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','sequelize','lodash','determine','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','defaultsDeep','motion2','xcall','name','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','cascade','UserId','hasOne','userSetting','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xbf9c,0xe9));var _0xcbf9=function(_0x3d8dd6,_0x55fa28){_0x3d8dd6=_0x3d8dd6-0x0;var _0x19e85e=_0xbf9c[_0x3d8dd6];return _0x19e85e;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xcbf9('0x0'));var _=require(_0xcbf9('0x1'));var jstz=require('jstz');var timezone=jstz[_0xcbf9('0x2')]();config[_0xcbf9('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':'xcall','password':_0xcbf9('0x3'),'options':{'host':_0xcbf9('0x4'),'port':0xcea,'dialect':_0xcbf9('0x5'),'dialectOptions':{'charset':_0xcbf9('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xcbf9('0x7'),'collate':'utf8_general_ci'}}});config[_0xcbf9('0x8')]=_[_0xcbf9('0x9')](config[_0xcbf9('0x8')],{'database':_0xcbf9('0xa'),'username':_0xcbf9('0xb'),'password':_0xcbf9('0x3'),'options':{'host':_0xcbf9('0x4'),'port':0xcea,'dialect':_0xcbf9('0x5'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xcbf9('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcbf9('0x0')][_0xcbf9('0xd')],config['sequelize']['username'],config[_0xcbf9('0x0')][_0xcbf9('0xe')],config[_0xcbf9('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xcbf9('0xd')],config[_0xcbf9('0x8')]['username'],config[_0xcbf9('0x8')][_0xcbf9('0xe')],config[_0xcbf9('0x8')][_0xcbf9('0xf')])};db[_0xcbf9('0x10')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x12'));db[_0xcbf9('0x13')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xcbf9('0x14')]=db[_0xcbf9('0x0')]['import']('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x15'));db['VoiceMusicOnHold']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x16'));db[_0xcbf9('0x17')]=db['sequelize']['import'](_0xcbf9('0x18'));db[_0xcbf9('0x19')]=db['sequelize']['import'](_0xcbf9('0x1a'));db[_0xcbf9('0x1b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x1c'));db[_0xcbf9('0x1d')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x1e'));db['VoiceMailMessage']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x1f'));db[_0xcbf9('0x20')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x21'));db[_0xcbf9('0x22')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xcbf9('0x0')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x23'));db[_0xcbf9('0x24')]=db['sequelize']['import'](_0xcbf9('0x25'));db[_0xcbf9('0x26')]=db['sequelize'][_0xcbf9('0x11')]('../api/trunk/trunk.model');db[_0xcbf9('0x27')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x28'));db[_0xcbf9('0x29')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x2a'));db[_0xcbf9('0x2b')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x2c'));db['UserChatQueue']=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/userChatQueue/userChatQueue.model');db['UserMailQueue']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x2d'));db[_0xcbf9('0x2e')]=db[_0xcbf9('0x0')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xcbf9('0x2f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x30'));db[_0xcbf9('0x31')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x32'));db[_0xcbf9('0x33')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x34'));db[_0xcbf9('0x35')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x36'));db[_0xcbf9('0x37')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x38'));db['MailQueue']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x39'));db[_0xcbf9('0x3a')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xcbf9('0x3b')]=db['sequelize']['import'](_0xcbf9('0x3c'));db['MailMessage']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x3d'));db['MailApplication']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x3e'));db[_0xcbf9('0x3f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/mailQueueReport/mailQueueReport.model');db[_0xcbf9('0x40')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x41'));db[_0xcbf9('0x42')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x43'));db['FaxAccount']=db[_0xcbf9('0x0')]['import']('../api/faxAccount/faxAccount.model');db[_0xcbf9('0x44')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x45'));db[_0xcbf9('0x46')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x47'));db[_0xcbf9('0x48')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x49'));db[_0xcbf9('0x4a')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x4b'));db[_0xcbf9('0x4c')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x4d'));db[_0xcbf9('0x4e')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x4f'));db[_0xcbf9('0x50')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x51'));db[_0xcbf9('0x52')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x53'));db[_0xcbf9('0x54')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x55'));db['OpenchannelApplication']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x56'));db[_0xcbf9('0x57')]=db['sequelize'][_0xcbf9('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x58'));db[_0xcbf9('0x59')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5a'));db['ChatWebsite']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5b'));db[_0xcbf9('0x5c')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x5d'));db['ChatApplication']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x5e'));db['ChatInteraction']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x5f'));db[_0xcbf9('0x60')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x61'));db[_0xcbf9('0x62')]=db['sequelize']['import'](_0xcbf9('0x63'));db['ChatQueue']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x64'));db['ChatGroup']=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/chatGroup/chatGroup.model');db[_0xcbf9('0x65')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x66'));db[_0xcbf9('0x67')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x68'));db['CmContact']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x69'));db['CmHopper']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6a'));db[_0xcbf9('0x6b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6c'));db[_0xcbf9('0x6d')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x6e'));db[_0xcbf9('0x6f')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x70'));db[_0xcbf9('0x71')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x72'));db[_0xcbf9('0x73')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x74'));db[_0xcbf9('0x75')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/action/action.model');db[_0xcbf9('0x76')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x77'));db['CannedAnswer']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x78'));db[_0xcbf9('0x79')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/disposition/disposition.model');db[_0xcbf9('0x7a')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x7b'));db[_0xcbf9('0x7c')]=db['sequelize'][_0xcbf9('0x11')]('../api/interval/interval.model');db[_0xcbf9('0x7d')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x7e'));db['Cdr']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x7f'));db[_0xcbf9('0x80')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x81'));db[_0xcbf9('0x82')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/schedule/schedule.model');db['Sound']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x83'));db[_0xcbf9('0x84')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/tag/tag.model');db['Template']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x85'));db[_0xcbf9('0x86')]=db['sequelize'][_0xcbf9('0x11')]('../api/trigger/trigger.model');db[_0xcbf9('0x87')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x88'));db[_0xcbf9('0x89')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x8a'));db[_0xcbf9('0x8b')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/integrationReport/integrationReport.model');db[_0xcbf9('0x8c')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xcbf9('0x8d')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x8e'));db[_0xcbf9('0x8f')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x90'));db[_0xcbf9('0x91')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x92'));db[_0xcbf9('0x93')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x94'));db[_0xcbf9('0x95')]=db['sequelize']['import'](_0xcbf9('0x96'));db[_0xcbf9('0x97')]=db[_0xcbf9('0x0')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x98'));db[_0xcbf9('0x99')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x9a'));db[_0xcbf9('0x9b')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x9c'));db['SugarcrmConfiguration']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0x9d'));db[_0xcbf9('0x9e')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x9f'));db[_0xcbf9('0xa0')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xa1'));db['DeskConfiguration']=db['sequelize']['import'](_0xcbf9('0xa2'));db[_0xcbf9('0xa3')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intDeskField/intDeskField.model');db[_0xcbf9('0xa4')]=db['sequelize'][_0xcbf9('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0xcbf9('0xa5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xcbf9('0xa6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xcbf9('0x0')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xcbf9('0xa7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xa8'));db[_0xcbf9('0xa9')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xaa'));db[_0xcbf9('0xab')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xac'));db[_0xcbf9('0xad')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xae'));db[_0xcbf9('0xaf')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb0'));db['VtigerAccount']=db['sequelize'][_0xcbf9('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xcbf9('0xb1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb2'));db['VtigerField']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb3'));db['ServicenowAccount']=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xb4'));db[_0xcbf9('0xb5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb6'));db[_0xcbf9('0xb7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xb8'));db[_0xcbf9('0xb9')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xba'));db['Dynamics365Configuration']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xbb'));db[_0xcbf9('0xbc')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xbd'));db['FreshsalesAccount']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xbe'));db[_0xcbf9('0xbf')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xc0'));db[_0xcbf9('0xc1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc2'));db[_0xcbf9('0x89')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x8a'));db['Network']=db['sequelize']['import'](_0xcbf9('0xc3'));db[_0xcbf9('0xc4')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc5'));db[_0xcbf9('0xc6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc7'));db['JscriptyAnswerReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xc8'));db['JscriptyQuestionReport']=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xc9'));db[_0xcbf9('0xca')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xcb'));db['SmsQueueReport']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xcc'));db[_0xcbf9('0xcd')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/squareReport/squareReport.model');db[_0xcbf9('0xce')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xcf'));db['JscriptyProject']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xd0'));db[_0xcbf9('0xd1')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xd2'));db[_0xcbf9('0xd3')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xd4'));db[_0xcbf9('0xd5')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xd6'));db[_0xcbf9('0xd7')]=db[_0xcbf9('0x0')]['import']('../api/squareRecording/squareRecording.model');db[_0xcbf9('0xd8')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xd9'));db[_0xcbf9('0xda')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdb'));db['License']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdc'));db[_0xcbf9('0xdd')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/campaign/campaign.model');db[_0xcbf9('0xde')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xdf'));db[_0xcbf9('0xe0')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xe1'));db[_0xcbf9('0xe2')]=db['sequelize'][_0xcbf9('0x11')]('../api/plugin/plugin.model');db[_0xcbf9('0xe3')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0xe4'));db[_0xcbf9('0xe5')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xe6'));db[_0xcbf9('0xe7')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xe8'));db[_0xcbf9('0xe9')]=db['sequelize']['import'](_0xcbf9('0xea'));db[_0xcbf9('0xeb')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xec'));db[_0xcbf9('0xed')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xee'));db[_0xcbf9('0xef')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf0'));db[_0xcbf9('0xf1')]=db['sequelize'][_0xcbf9('0x11')]('../api/userProfile/userProfile.model');db[_0xcbf9('0xf2')]=db['sequelize']['import'](_0xcbf9('0xf3'));db[_0xcbf9('0xf4')]=db['sequelize']['import'](_0xcbf9('0xf5'));db[_0xcbf9('0xf6')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/userNotification/userNotification.model');db[_0xcbf9('0xf7')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf8'));db['WhatsappInteraction']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xf9'));db[_0xcbf9('0xfa')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0xfb'));db[_0xcbf9('0xfc')]=db['sequelize'][_0xcbf9('0x11')](_0xcbf9('0xfd'));db[_0xcbf9('0xfe')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xcbf9('0xff')]=db['sequelize']['import'](_0xcbf9('0x100'));db[_0xcbf9('0x101')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x102'));db[_0xcbf9('0x103')]=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x104'));db[_0xcbf9('0x105')]=db[_0xcbf9('0x0')]['import'](_0xcbf9('0x106'));db['UserVoicePrefix']=db[_0xcbf9('0x0')][_0xcbf9('0x11')](_0xcbf9('0x107'));db[_0xcbf9('0x108')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db['User']['hasOne'](db[_0xcbf9('0x1d')],{'as':'VoiceMail','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10b')](db['UserSetting'],{'as':_0xcbf9('0x10c'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x19')],{'as':_0xcbf9('0x10e'),'foreignKey':'UserId'});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x29')],{'as':_0xcbf9('0x10f'),'foreignKey':_0xcbf9('0x10a')});db['User']['hasMany'](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x113'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':'UserId'});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x57')],{'as':_0xcbf9('0x114'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x50')],{'as':'SmsInteractions','foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db['FaxInteraction'],{'as':_0xcbf9('0x116'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')][_0xcbf9('0x10d')](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x117'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x10')]['hasMany'](db[_0xcbf9('0x118')],{'as':_0xcbf9('0x119'),'foreignKey':_0xcbf9('0x10a')});db['User'][_0xcbf9('0x10d')](db[_0xcbf9('0xf6')],{'as':_0xcbf9('0x11a'),'foreignKey':_0xcbf9('0x11b')});db[_0xcbf9('0x10')][_0xcbf9('0x11c')](db[_0xcbf9('0xf1')],{'as':_0xcbf9('0xf1'),'foreignKey':_0xcbf9('0x11d')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x11f')],{'as':_0xcbf9('0x120'),'through':'chat_group_has_users'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x122'),'through':_0xcbf9('0x123')});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'as':'Lists','through':'cm_user_has_lists'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x124')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db['MailInteraction'],{'as':'MailInteractions','through':_0xcbf9('0x125')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x115')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x46')],{'as':_0xcbf9('0x116'),'through':_0xcbf9('0x126')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x127'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xcbf9('0x114'),'through':'user_has_openchannel_interactions'});db[_0xcbf9('0x10')]['belongsToMany'](db[_0xcbf9('0x118')],{'as':_0xcbf9('0x119'),'through':_0xcbf9('0x128')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x129'),'through':'UserVoiceQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xef')],{'as':_0xcbf9('0x12a'),'through':_0xcbf9('0x12b'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x12c')],{'as':_0xcbf9('0x12d'),'through':_0xcbf9('0x12e'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x12f')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xcbf9('0x11e')](db[_0xcbf9('0x48')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x54')],{'as':_0xcbf9('0x130'),'through':_0xcbf9('0x2f'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x59')],{'as':_0xcbf9('0x131'),'through':_0xcbf9('0x31'),'required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xff')],{'as':_0xcbf9('0x132'),'through':'UserWhatsappQueue','required':![]});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'through':_0xcbf9('0x133')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db['ChatWebsite'],{'as':_0xcbf9('0x134'),'through':_0xcbf9('0x135')});db['User']['belongsToMany'](db[_0xcbf9('0x136')],{'as':'FaxAccounts','through':_0xcbf9('0x137')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x139'),'through':_0xcbf9('0x13a')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x13c'),'through':_0xcbf9('0x13d')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0x4c')],{'as':_0xcbf9('0x13e'),'through':_0xcbf9('0x13f')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xf7')],{'as':_0xcbf9('0x140'),'through':_0xcbf9('0x141')});db[_0xcbf9('0x10')][_0xcbf9('0x11e')](db[_0xcbf9('0xd5')],{'as':_0xcbf9('0x142'),'through':_0xcbf9('0x143')});db[_0xcbf9('0x13')][_0xcbf9('0x10d')](db['VoiceExtension'],{'as':_0xcbf9('0x144'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x145')});db[_0xcbf9('0x14')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x110')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':'Applications','onDelete':'cascade'});db['VoiceMusicOnHold'][_0xcbf9('0x11e')](db['Sound'],{'as':_0xcbf9('0x146'),'through':'moh_has_sounds'});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0x29')],{'as':_0xcbf9('0x147'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x14b'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db['ReportAgentPreview'],{'as':_0xcbf9('0x71'),'foreignKey':'VoiceQueueId'});db[_0xcbf9('0x17')][_0xcbf9('0x10d')](db['CmHopperBlack'],{'as':_0xcbf9('0x14c'),'foreignKey':_0xcbf9('0x148')});db[_0xcbf9('0x17')]['hasMany'](db[_0xcbf9('0xca')],{'as':_0xcbf9('0x14d'),'foreignKey':_0xcbf9('0x148')});db['VoiceQueue'][_0xcbf9('0x11c')](db['Trunk'],{'as':_0xcbf9('0x26'),'foreignKey':_0xcbf9('0x14e')});db[_0xcbf9('0x17')][_0xcbf9('0x11c')](db[_0xcbf9('0x26')],{'as':_0xcbf9('0x14f'),'foreignKey':_0xcbf9('0x150')});db['VoiceQueue']['belongsTo'](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x17')][_0xcbf9('0x11c')](db['Pause'],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x17')][_0xcbf9('0x11e')](db['CmList'],{'as':_0xcbf9('0x154'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db['User'],{'as':_0xcbf9('0x155'),'through':'UserVoiceQueue'});db[_0xcbf9('0x17')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'as':_0xcbf9('0x156'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db[_0xcbf9('0xed')],{'as':'BlackLists','through':_0xcbf9('0x157')});db[_0xcbf9('0x19')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10'),'foreignKey':_0xcbf9('0x10a')});db['ScreenRecording'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'User','foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x1d')][_0xcbf9('0x10d')](db['VoiceMailMessage'],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x159'),'sourceKey':_0xcbf9('0x15a')});db[_0xcbf9('0x15b')][_0xcbf9('0x11c')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xcbf9('0x15a')});db[_0xcbf9('0x20')][_0xcbf9('0x10d')](db[_0xcbf9('0x15c')],{'as':_0xcbf9('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0xcbf9('0x20')]['hasMany'](db[_0xcbf9('0x15e')],{'as':_0xcbf9('0x15f'),'foreignKey':_0xcbf9('0x160'),'constraints':![]});db[_0xcbf9('0x20')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x20')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x35')][_0xcbf9('0x11c')](db['MailAccount'],{'as':_0xcbf9('0x138'),'foreignKey':_0xcbf9('0x162')});db['MailServerIn'][_0xcbf9('0x11c')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x37')][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x138'),'foreignKey':'MailAccountId'});db[_0xcbf9('0x37')]['belongsTo'](db['CloudProvider'],{'as':_0xcbf9('0x101'),'foreignKey':_0xcbf9('0x164'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x138')][_0xcbf9('0x10b')](db[_0xcbf9('0x35')],{'as':_0xcbf9('0x165'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x138')][_0xcbf9('0x10b')](db['MailServerOut'],{'as':_0xcbf9('0x166'),'onDelete':_0xcbf9('0x109')});db['MailAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x162'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db['CannedAnswer'],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db[_0xcbf9('0x169')],{'as':'Messages','foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x138')]['hasMany'](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x138')][_0xcbf9('0x10d')](db[_0xcbf9('0x16b')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0x138')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x16d')],{'as':_0xcbf9('0x16d'),'foreignKey':_0xcbf9('0x16e')});db[_0xcbf9('0x138')][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x138')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x13a')});db[_0xcbf9('0x12c')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x12e')});db[_0xcbf9('0x12c')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':'team_has_mail_queues','as':_0xcbf9('0x156')});db[_0xcbf9('0x3b')]['hasMany'](db[_0xcbf9('0x169')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x16f')});db[_0xcbf9('0x3b')]['belongsTo'](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x162')});db['MailInteraction'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x3b')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':'UserId'});db[_0xcbf9('0x3b')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x173'),'as':'Tags'});db[_0xcbf9('0x3b')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x173'),'as':_0xcbf9('0x174')});db['MailInteraction']['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x125'),'foreignKey':_0xcbf9('0x16f')});db[_0xcbf9('0x169')][_0xcbf9('0x10d')](db['Attachment'],{'as':_0xcbf9('0x176'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x169')]['belongsTo'](db['User'],{'as':_0xcbf9('0x10')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db[_0xcbf9('0x3b')],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x169')]['belongsTo'](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x177'),'foreignKey':_0xcbf9('0x178')});db[_0xcbf9('0x169')][_0xcbf9('0x11c')](db['ChatOfflineMessage'],{'as':_0xcbf9('0x62'),'foreignKey':'ChatOfflineMessageId'});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x16b')]['belongsTo'](db[_0xcbf9('0x12c')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db[_0xcbf9('0x138')],{'onDelete':'restrict'});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db['Interval'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x16b')][_0xcbf9('0x11c')](db['Tag'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x3f')]['belongsTo'](db[_0xcbf9('0x138')],{});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x3f')][_0xcbf9('0x11c')](db['MailInteraction'],{});db['MailQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x169')],{});db['MailQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x3f')]['belongsTo'](db[_0xcbf9('0x12c')],{});db[_0xcbf9('0x40')][_0xcbf9('0x10d')](db['DashboardItem'],{'as':'Items','onDelete':'cascade'});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':'Dispositions','foreignKey':_0xcbf9('0x17c'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db['CannedAnswer'],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db['FaxInteraction'],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x44')],{'as':'Applications'});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x17d'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x136')][_0xcbf9('0x10d')](db[_0xcbf9('0x17e')],{'as':_0xcbf9('0x158')});db[_0xcbf9('0x136')]['belongsTo'](db[_0xcbf9('0x26')],{'as':_0xcbf9('0x26')});db['FaxAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x136')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db['User'],{'onDelete':'restrict'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'onDelete':'restrict'});db[_0xcbf9('0x44')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':'restrict','foreignKey':_0xcbf9('0x179')});db['FaxInteraction'][_0xcbf9('0x10d')](db[_0xcbf9('0x17e')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FaxInteractionId'});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x46')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x46')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'fax_interaction_has_tags','as':_0xcbf9('0x17f')});db['FaxInteraction'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xcbf9('0x46')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xcbf9('0x180')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x46')],{'as':'Interaction','foreignKey':_0xcbf9('0x180')});db[_0xcbf9('0x17e')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db['FaxMessage']['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xcbf9('0x181')});db[_0xcbf9('0x17e')]['belongsTo'](db[_0xcbf9('0x136')],{'as':'Account','foreignKey':_0xcbf9('0x17c')});db[_0xcbf9('0x48')]['belongsToMany'](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x2e')});db['FaxQueue'][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x182'),'as':_0xcbf9('0x156')});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{});db[_0xcbf9('0x4a')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['FaxQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x46')],{});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db['FaxMessage'],{});db[_0xcbf9('0x4a')]['belongsTo'](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x4a')][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x183'),'onDelete':'cascade'});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xcbf9('0x4c')][_0xcbf9('0x10d')](db[_0xcbf9('0x52')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x4c')]['hasMany'](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x4c')]['hasMany'](db[_0xcbf9('0x4e')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0x4c')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':_0xcbf9('0x17b')});db['SmsAccount'][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x4c')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x13f')});db['SmsApplication'][_0xcbf9('0x11c')](db['User'],{'onDelete':'restrict'});db[_0xcbf9('0x4e')]['belongsTo'](db[_0xcbf9('0x54')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x4e')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db['SmsInteraction'][_0xcbf9('0x10d')](db[_0xcbf9('0x52')],{'as':'Messages','onDelete':_0xcbf9('0x109'),'foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db[_0xcbf9('0x4c')],{'as':'Account','foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x50')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x50')]['belongsTo'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x50')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':'sms_interaction_has_tags','as':_0xcbf9('0x17f')});db['SmsInteraction'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'sms_interaction_has_tags','as':_0xcbf9('0x174')});db[_0xcbf9('0x50')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':'user_has_sms_interactions','foreignKey':_0xcbf9('0x185')});db[_0xcbf9('0x52')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x10')});db['SmsMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171')});db[_0xcbf9('0x52')][_0xcbf9('0x11c')](db[_0xcbf9('0x50')],{'onDelete':_0xcbf9('0x109'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xcbf9('0x52')]['belongsTo'](db[_0xcbf9('0x4c')],{'as':'Account','foreignKey':_0xcbf9('0x183')});db[_0xcbf9('0x54')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xcbf9('0x54')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x186'),'as':_0xcbf9('0x156')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x187'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x57')],{'as':_0xcbf9('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x188')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x10d')](db[_0xcbf9('0x189')],{'as':_0xcbf9('0x16c'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x13b')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0x13b')][_0xcbf9('0x11c')](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':_0xcbf9('0x153')});db[_0xcbf9('0x13b')][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x13d')});db[_0xcbf9('0x189')]['belongsTo'](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x189')][_0xcbf9('0x11c')](db['OpenchannelQueue'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x18a')});db[_0xcbf9('0x189')]['belongsTo'](db[_0xcbf9('0x13b')],{'onDelete':_0xcbf9('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xcbf9('0x189')][_0xcbf9('0x11c')](db['Interval'],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db['OpenchannelApplication'][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xcbf9('0x57')][_0xcbf9('0x10d')](db[_0xcbf9('0x188')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x57')][_0xcbf9('0x11c')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db['OpenchannelInteraction'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xcbf9('0x57')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x18c'),'as':_0xcbf9('0x17f')});db['OpenchannelInteraction']['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x18c'),'as':_0xcbf9('0x174')});db['OpenchannelInteraction']['belongsToMany'](db['User'],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x18d'),'foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':'cascade','as':_0xcbf9('0x171')});db['OpenchannelMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x57')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x18b')});db[_0xcbf9('0x188')][_0xcbf9('0x11c')](db['Attachment'],{'as':'Attachment','foreignKey':_0xcbf9('0x181')});db['OpenchannelMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x13b')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x187')});db[_0xcbf9('0x59')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x31'),'foreignKey':_0xcbf9('0x18a')});db[_0xcbf9('0x59')]['belongsToMany'](db['Team'],{'through':_0xcbf9('0x18f'),'as':'Teams'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':'Dispositions','foreignKey':_0xcbf9('0x178'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':'Answers','foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0xcbf9('0x10d')](db[_0xcbf9('0x65')],{'as':'ProactiveActions'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':_0xcbf9('0x16a')});db[_0xcbf9('0x177')]['hasMany'](db[_0xcbf9('0x190')],{'as':'Applications'});db[_0xcbf9('0x177')][_0xcbf9('0x10d')](db[_0xcbf9('0x60')],{'as':'Messages'});db[_0xcbf9('0x177')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['ChatWebsite'][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':'IntervalId'});db[_0xcbf9('0x177')][_0xcbf9('0x11c')](db['MailAccount'],{'as':_0xcbf9('0x138'),'foreignKey':_0xcbf9('0x162')});db[_0xcbf9('0x177')]['belongsTo'](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x135')});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db['OpenchannelAccount'],{});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db['CmContact'],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db[_0xcbf9('0x57')],{});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x188')],{});db['OpenchannelQueueReport'][_0xcbf9('0x11c')](db['User'],{});db[_0xcbf9('0x5c')][_0xcbf9('0x11c')](db[_0xcbf9('0x59')],{});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x191'),'foreignKey':_0xcbf9('0x10a'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')]['belongsTo'](db['ChatQueue'],{'as':_0xcbf9('0x192'),'foreignKey':_0xcbf9('0x193'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':'Website','foreignKey':_0xcbf9('0x178'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x190')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x115')][_0xcbf9('0x10d')](db[_0xcbf9('0x60')],{'as':_0xcbf9('0x158'),'onDelete':'cascade','foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x178')});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0xcbf9('0x115')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x172'),'foreignKey':'UserId'});db[_0xcbf9('0x115')]['belongsToMany'](db['Tag'],{'through':_0xcbf9('0x195'),'as':'Tags'});db[_0xcbf9('0x115')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x195'),'as':'ThroughTags'});db[_0xcbf9('0x115')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':'Users','through':_0xcbf9('0x196'),'foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x60')]['belongsTo'](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x10')});db[_0xcbf9('0x60')][_0xcbf9('0x11c')](db['CmContact'],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db['ChatMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x115')],{'onDelete':_0xcbf9('0x109'),'as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x194')});db[_0xcbf9('0x60')][_0xcbf9('0x11c')](db[_0xcbf9('0xe0')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x178')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0xcbf9('0x176'),'foreignKey':_0xcbf9('0x197'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db['ChatOfflineMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xcbf9('0x161')});db['ChatOfflineMessage']['belongsTo'](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x170'),'foreignKey':'ChatWebsiteId'});db[_0xcbf9('0x12f')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':'Agents','through':_0xcbf9('0x198'),'hooks':!![]});db[_0xcbf9('0x12f')]['belongsToMany'](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x199'),'as':_0xcbf9('0x156')});db['ChatGroup']['hasMany'](db[_0xcbf9('0xc6')],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x19a'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x11f')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x147'),'through':_0xcbf9('0x19b')});db[_0xcbf9('0x65')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'as':_0xcbf9('0x19c'),'foreignKey':'ChatWebsiteId'});db[_0xcbf9('0x67')][_0xcbf9('0x10d')](db[_0xcbf9('0x121')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':'ContactId'});db['CmContact'][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x161')});db['CmContact'][_0xcbf9('0x10d')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x121')]['hasMany'](db[_0xcbf9('0xca')],{'as':'JscriptySessions','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x121')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x115')],{'as':_0xcbf9('0x19d'),'foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x50')],{'as':_0xcbf9('0x127'),'foreignKey':'ContactId','onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')][_0xcbf9('0x10d')](db[_0xcbf9('0x46')],{'as':'FaxInteractions','foreignKey':_0xcbf9('0x161'),'onDelete':'restrict'});db[_0xcbf9('0x121')]['hasMany'](db[_0xcbf9('0x3b')],{'as':_0xcbf9('0x117'),'foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x121')]['belongsTo'](db[_0xcbf9('0x67')],{'as':_0xcbf9('0x19e'),'foreignKey':'CompanyId'});db[_0xcbf9('0x121')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':'List','foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x121')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x123')});db[_0xcbf9('0x121')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'as':_0xcbf9('0x17f'),'through':'cm_contact_has_tags'});db['CmContact'][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x19f'),'as':'ThroughTags'});db[_0xcbf9('0x149')][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161'),'onDelete':'cascade'});db['CmHopper'][_0xcbf9('0x11c')](db['CmList'],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x149')]['belongsTo'](db['User'],{'as':_0xcbf9('0x191'),'foreignKey':'UserId'});db['CmHopper'][_0xcbf9('0x11c')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x192'),'foreignKey':_0xcbf9('0x148'),'onDelete':_0xcbf9('0x109')});db['CmHopper'][_0xcbf9('0x11c')](db['Campaign'],{'as':'Campaign','foreignKey':_0xcbf9('0x1a0'),'onDelete':_0xcbf9('0x109')});db['CmHopper'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0xcbf9('0x11c')](db['CmContact'],{'as':'Contact','foreignKey':_0xcbf9('0x161'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x6b')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b'),'onDelete':_0xcbf9('0x109')});db['CmHopperBlack'][_0xcbf9('0x11c')](db['VoiceQueue'],{'as':_0xcbf9('0x192'),'foreignKey':'VoiceQueueId','onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x6b')][_0xcbf9('0x11c')](db['Campaign'],{'as':_0xcbf9('0xdd'),'foreignKey':_0xcbf9('0x1a0'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0x76')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':_0xcbf9('0x1a1'),'singular':_0xcbf9('0x1a2')},'foreignKey':_0xcbf9('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xcbf9('0x76')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':'Any','singular':_0xcbf9('0x1a4')},'foreignKey':_0xcbf9('0x1a5'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcbf9('0x10d')](db[_0xcbf9('0x75')],{'as':'Actions','foreignKey':_0xcbf9('0x1a6'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x79')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x1a7'),'onDelete':_0xcbf9('0x109')});db['Interval'][_0xcbf9('0x10d')](db['Interval'],{'as':'Intervals','foreignKey':_0xcbf9('0x151'),'onDelete':_0xcbf9('0x109'),'hooks':!![],'required':![]});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'foreignKey':_0xcbf9('0x151'),'onDelete':'restrict'});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x16b')],{'as':_0xcbf9('0x1a8'),'foreignKey':'IntervalId'});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db['ChatApplication'],{'as':_0xcbf9('0x1a9'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db[_0xcbf9('0x44')],{'as':_0xcbf9('0x1aa'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x7c')][_0xcbf9('0x10d')](db['SmsApplication'],{'as':_0xcbf9('0x1ab'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x82')]['belongsTo'](db['MailAccount'],{});db[_0xcbf9('0x82')]['belongsTo'](db[_0xcbf9('0x8d')],{'foreignKey':_0xcbf9('0x1ac')});db['Schedule']['belongsTo'](db[_0xcbf9('0x8c')],{'foreignKey':_0xcbf9('0x1ad')});db[_0xcbf9('0x1ae')][_0xcbf9('0x11e')](db[_0xcbf9('0x1af')],{'as':'Mohs','through':_0xcbf9('0x1b0'),'onDelete':'restrict'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x121')],{'through':'cm_contact_has_tags'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x115')],{'through':'chat_interaction_has_tags'});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x3b')],{'through':_0xcbf9('0x173')});db[_0xcbf9('0x84')]['belongsToMany'](db[_0xcbf9('0x50')],{'through':_0xcbf9('0x1b1')});db[_0xcbf9('0x84')][_0xcbf9('0x11e')](db[_0xcbf9('0x46')],{'through':_0xcbf9('0x1b2')});db['Tag'][_0xcbf9('0x11e')](db[_0xcbf9('0x57')],{'through':_0xcbf9('0x18c')});db['Tag'][_0xcbf9('0x11e')](db['WhatsappInteraction'],{'through':_0xcbf9('0x1b3')});db[_0xcbf9('0x86')]['hasMany'](db[_0xcbf9('0x7a')],{'as':{'plural':'AllConditions','singular':_0xcbf9('0x1b4')},'foreignKey':_0xcbf9('0x1b5'),'onDelete':'cascade','hooks':!![]});db[_0xcbf9('0x86')][_0xcbf9('0x10d')](db[_0xcbf9('0x7a')],{'as':{'plural':_0xcbf9('0x1b6'),'singular':_0xcbf9('0x1b7')},'foreignKey':'TriggerAnyId','onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x86')][_0xcbf9('0x10d')](db['Action'],{'as':'Actions','foreignKey':_0xcbf9('0x1b8'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db[_0xcbf9('0x8c')][_0xcbf9('0x10d')](db[_0xcbf9('0x93')],{'as':_0xcbf9('0x1b9'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xcbf9('0x8d')][_0xcbf9('0x10d')](db['AnalyticFieldReport'],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1ac')});db['AnalyticMetric'][_0xcbf9('0x10d')](db[_0xcbf9('0x93')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'MetricId'});db[_0xcbf9('0x93')][_0xcbf9('0x11c')](db[_0xcbf9('0x91')],{'foreignKey':_0xcbf9('0x1ba')});db[_0xcbf9('0x97')]['hasMany'](db[_0xcbf9('0x1bb')],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1bb')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1bb')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xcbf9('0x10d')](db['SalesforceField'],{'as':'Fields','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x1bb')][_0xcbf9('0x11c')](db[_0xcbf9('0x97')],{'as':_0xcbf9('0x170'),'foreignKey':'AccountId'});db[_0xcbf9('0x99')][_0xcbf9('0x10d')](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x99')]['hasMany'](db[_0xcbf9('0x99')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x99')][_0xcbf9('0x10d')](db['SalesforceField'],{'as':_0xcbf9('0x1c4'),'foreignKey':'FieldId'});db[_0xcbf9('0x99')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0x9b')][_0xcbf9('0x10d')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1c6')]['hasMany'](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1c6')][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1c6')][_0xcbf9('0x10d')](db['SugarcrmField'],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db['SugarcrmConfiguration'][_0xcbf9('0x11c')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db['SugarcrmField'][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['SugarcrmField'][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0x9e')][_0xcbf9('0x10d')](db[_0xcbf9('0x9e')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x9e')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['DeskAccount']['hasMany'](db[_0xcbf9('0x1c8')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0x1c8')][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1be'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1c8')]['hasMany'](db[_0xcbf9('0xa3')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1c8')]['hasMany'](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0xcbf9('0x11c')](db[_0xcbf9('0xa0')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db['DeskConfiguration']['belongsToMany'](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1c9')});db[_0xcbf9('0xa3')][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['DeskField']['hasMany'](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db['DeskField'][_0xcbf9('0x10d')](db[_0xcbf9('0xa3')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa3')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['ZohoAccount'][_0xcbf9('0x10d')](db['ZohoConfiguration'],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db['ZohoField'],{'as':_0xcbf9('0x1be'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa5')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':'FieldId'});db[_0xcbf9('0xa5')]['belongsTo'](db[_0xcbf9('0xa4')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa6')][_0xcbf9('0x10d')](db[_0xcbf9('0xa6')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db['ZohoField'][_0xcbf9('0x10d')](db['ZohoField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcbf9('0xa6')][_0xcbf9('0x10d')](db['ZohoField'],{'as':'Field','foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa6')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db['ZendeskAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0xa7')],{'as':_0xcbf9('0x1bc'),'onDelete':'cascade','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa7')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':'Subjects','foreignKey':_0xcbf9('0x1bf')});db['ZendeskConfiguration']['hasMany'](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c7'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa7')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa7')]['belongsTo'](db[_0xcbf9('0x1ca')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xa7')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1cb')});db[_0xcbf9('0xa9')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xa9')][_0xcbf9('0x10d')](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xa9')]['hasMany'](db[_0xcbf9('0xa9')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xa9')]['belongsTo'](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':'VariableId'});db[_0xcbf9('0xab')][_0xcbf9('0x10d')](db[_0xcbf9('0xad')],{'as':'Configurations','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c7'),'onDelete':_0xcbf9('0x109'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xad')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1b9'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xad')][_0xcbf9('0x11c')](db[_0xcbf9('0xab')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xad')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':_0xcbf9('0x1cc')});db[_0xcbf9('0xaf')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xaf')][_0xcbf9('0x10d')](db[_0xcbf9('0xaf')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db['FreshdeskField'][_0xcbf9('0x10d')](db['FreshdeskField'],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xaf')][_0xcbf9('0x11c')](db['Variable'],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0x1cd')][_0xcbf9('0x10d')](db[_0xcbf9('0xb1')],{'as':'Configurations','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db['VtigerConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':'Subjects','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xb1')][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':_0xcbf9('0x1c7'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xb1')][_0xcbf9('0x10d')](db['VtigerField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb1')][_0xcbf9('0x11c')](db[_0xcbf9('0x1cd')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db['VtigerField']['hasMany'](db[_0xcbf9('0x1ce')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0x1ce')][_0xcbf9('0x10d')](db['VtigerField'],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0x1ce')][_0xcbf9('0x10d')](db[_0xcbf9('0x1ce')],{'as':'Field','foreignKey':'FieldId'});db[_0xcbf9('0x1ce')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0x1cf')][_0xcbf9('0x10d')](db[_0xcbf9('0xb5')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db['ServicenowConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1be'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c7'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xb5')][_0xcbf9('0x10d')](db['ServicenowField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb5')][_0xcbf9('0x11c')](db['ServicenowAccount'],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xb7')][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xb7')]['hasMany'](db['ServicenowField'],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xb7')][_0xcbf9('0x10d')](db[_0xcbf9('0xb7')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xb7')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':_0xcbf9('0x87'),'foreignKey':_0xcbf9('0x1c5')});db[_0xcbf9('0xb9')]['hasMany'](db[_0xcbf9('0x1d0')],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xb9')][_0xcbf9('0x11c')](db[_0xcbf9('0x101')],{'as':'CloudProvider','foreignKey':_0xcbf9('0x164')});db[_0xcbf9('0x1d0')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Subjects','onDelete':_0xcbf9('0x109'),'foreignKey':'SubjectId'});db[_0xcbf9('0x1d0')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Descriptions','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c3')});db['Dynamics365Configuration'][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Fields','onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0x1d0')][_0xcbf9('0x11c')](db[_0xcbf9('0xb9')],{'as':'Account','foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':'Subject','foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':_0xcbf9('0x1c2'),'foreignKey':'DescriptionId'});db[_0xcbf9('0xbc')][_0xcbf9('0x10d')](db[_0xcbf9('0xbc')],{'as':_0xcbf9('0x1c4'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xbc')][_0xcbf9('0x11c')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0x1d1')][_0xcbf9('0x10d')](db['FreshsalesConfiguration'],{'as':_0xcbf9('0x1bc'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xbf')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1be'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xbf')]['hasMany'](db[_0xcbf9('0xc1')],{'as':'Descriptions','foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xbf')]['hasMany'](db['FreshsalesField'],{'as':_0xcbf9('0x1b9'),'foreignKey':_0xcbf9('0x1c0')});db[_0xcbf9('0xbf')][_0xcbf9('0x11c')](db[_0xcbf9('0x1d1')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1bd')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c1'),'foreignKey':_0xcbf9('0x1bf')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c2'),'foreignKey':_0xcbf9('0x1c3')});db[_0xcbf9('0xc1')][_0xcbf9('0x10d')](db[_0xcbf9('0xc1')],{'as':_0xcbf9('0x1c4'),'foreignKey':'FieldId'});db[_0xcbf9('0xc1')][_0xcbf9('0x11c')](db[_0xcbf9('0x87')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{});db[_0xcbf9('0xc4')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':'Contact','foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x115')],{});db[_0xcbf9('0xc4')][_0xcbf9('0x11c')](db[_0xcbf9('0x60')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db['ChatQueueReport'][_0xcbf9('0x11c')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1d2')});db[_0xcbf9('0xc6')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x109'),'foreignKey':'ToId'});db[_0xcbf9('0xca')][_0xcbf9('0x10d')](db['JscriptyQuestionReport'],{'foreignKey':_0xcbf9('0x1d3'),'onDelete':'cascade'});db[_0xcbf9('0xca')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d4')],{'foreignKey':_0xcbf9('0x1d3'),'onDelete':'cascade'});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{});db[_0xcbf9('0x1d5')]['belongsTo'](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':'ListId'});db['SmsQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':_0xcbf9('0x161')});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db['SmsInteraction'],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x52')],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{});db[_0xcbf9('0x1d5')][_0xcbf9('0x11c')](db[_0xcbf9('0x54')],{});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0xca')],{'foreignKey':_0xcbf9('0x1d7')});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d8')],{'foreignKey':'ProjectId'});db[_0xcbf9('0x1d6')][_0xcbf9('0x10d')](db[_0xcbf9('0x1d4')],{'foreignKey':_0xcbf9('0x1d7')});db[_0xcbf9('0xd5')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x143')});db[_0xcbf9('0xda')]['belongsToMany'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x124')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'through':_0xcbf9('0x103'),'as':'VoiceQueues'});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x12c')],{'through':_0xcbf9('0x1d9'),'as':_0xcbf9('0x12d')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xcbf9('0x1da')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x48')],{'through':'team_has_fax_queues','as':_0xcbf9('0x1db')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0x54')],{'through':_0xcbf9('0x186'),'as':_0xcbf9('0x130')});db['Team'][_0xcbf9('0x11e')](db[_0xcbf9('0x59')],{'through':_0xcbf9('0x18f'),'as':_0xcbf9('0x131')});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0xff')],{'through':_0xcbf9('0x1dc'),'as':'WhatsappQueues'});db[_0xcbf9('0xda')][_0xcbf9('0x11e')](db[_0xcbf9('0xef')],{'through':_0xcbf9('0x105'),'as':_0xcbf9('0x12a')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x149')],{'as':_0xcbf9('0x14a'),'foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':'HopperFinals','foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x14b'),'foreignKey':_0xcbf9('0x1a0')});db[_0xcbf9('0xdd')][_0xcbf9('0x10d')](db[_0xcbf9('0x6b')],{'as':'HopperBlacks','foreignKey':_0xcbf9('0x1a0')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0xcbf9('0x26'),'foreignKey':_0xcbf9('0x14e')});db[_0xcbf9('0xdd')]['belongsTo'](db[_0xcbf9('0x26')],{'as':'TrunkBackup','foreignKey':_0xcbf9('0x150')});db[_0xcbf9('0xdd')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'as':_0xcbf9('0x7c'),'foreignKey':_0xcbf9('0x151')});db['Campaign'][_0xcbf9('0x11c')](db[_0xcbf9('0xd5')],{'as':_0xcbf9('0xd5'),'foreignKey':_0xcbf9('0x1dd')});db[_0xcbf9('0xdd')][_0xcbf9('0x11e')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x154'),'through':'campaigns_has_cm_lists'});db[_0xcbf9('0xdd')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0xcbf9('0x1de')});db[_0xcbf9('0xe0')][_0xcbf9('0x11c')](db[_0xcbf9('0x62')],{'as':_0xcbf9('0x62'),'foreignKey':_0xcbf9('0x197')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['MailMessage'],{});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db[_0xcbf9('0x138')],{'foreignKey':_0xcbf9('0x1df'),'as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xe3')][_0xcbf9('0x11c')](db['User'],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0xcbf9('0x1e5'),'as':_0xcbf9('0x1e6')});db[_0xcbf9('0xe3')]['belongsTo'](db[_0xcbf9('0x138')],{'foreignKey':_0xcbf9('0x1e7'),'as':_0xcbf9('0x1e8')});db[_0xcbf9('0xe5')]['belongsTo'](db[_0xcbf9('0x60')],{});db[_0xcbf9('0xe5')]['belongsTo'](db[_0xcbf9('0x115')],{});db['ChatTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'foreignKey':_0xcbf9('0x1e9'),'as':_0xcbf9('0x1e0')});db['ChatTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x12f')],{'foreignKey':'ToChatQueueId','as':_0xcbf9('0x1e6')});db[_0xcbf9('0xe5')][_0xcbf9('0x11c')](db[_0xcbf9('0x177')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xcbf9('0xe7')][_0xcbf9('0x11c')](db['FaxMessage'],{});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x46')],{});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'foreignKey':'FromFaxAccountId','as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db[_0xcbf9('0xe7')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x48')],{'foreignKey':_0xcbf9('0x1ea'),'as':_0xcbf9('0x1e6')});db['FaxTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x136')],{'foreignKey':_0xcbf9('0x1eb'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x188')],{});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db['OpenchannelInteraction'],{});db[_0xcbf9('0xe9')][_0xcbf9('0x11c')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0xcbf9('0x1e0')});db[_0xcbf9('0xe9')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db['OpenchannelTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xe9')]['belongsTo'](db[_0xcbf9('0x59')],{'foreignKey':'ToOpenchannelQueueId','as':_0xcbf9('0x1e6')});db['OpenchannelTransferReport']['belongsTo'](db[_0xcbf9('0x13b')],{'foreignKey':'ToOpenchannelAccountId','as':_0xcbf9('0x1e8')});db['SmsTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x52')],{});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x50')],{});db['SmsTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'foreignKey':_0xcbf9('0x1ec'),'as':_0xcbf9('0x1e0')});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':'FromAgent'});db['SmsTransferReport']['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x54')],{'foreignKey':_0xcbf9('0x1ed'),'as':_0xcbf9('0x1e6')});db[_0xcbf9('0xeb')][_0xcbf9('0x11c')](db[_0xcbf9('0x4c')],{'foreignKey':_0xcbf9('0x1ee'),'as':_0xcbf9('0x1e8')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db[_0xcbf9('0x79')],{'as':_0xcbf9('0x167'),'foreignKey':'ListId','onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db['CmContact'],{'as':_0xcbf9('0x122'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x10d')](db[_0xcbf9('0x6d')],{'as':_0xcbf9('0x112'),'foreignKey':_0xcbf9('0x17b')});db['CmList']['hasMany'](db[_0xcbf9('0x6f')],{'as':_0xcbf9('0x113'),'foreignKey':_0xcbf9('0x17b')});db['CmList'][_0xcbf9('0x10d')](db[_0xcbf9('0x71')],{'as':_0xcbf9('0x71'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xed')][_0xcbf9('0x11e')](db[_0xcbf9('0x17')],{'as':_0xcbf9('0x1ef'),'through':_0xcbf9('0x1f0')});db[_0xcbf9('0xed')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':'cm_user_has_lists'});db[_0xcbf9('0xef')][_0xcbf9('0x10d')](db[_0xcbf9('0x110')],{'as':_0xcbf9('0x111'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xef')][_0xcbf9('0x11e')](db['User'],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x12b')});db[_0xcbf9('0xef')][_0xcbf9('0x11e')](db[_0xcbf9('0xda')],{'through':_0xcbf9('0x105'),'as':_0xcbf9('0x156')});db['UserProfile']['hasMany'](db['User'],{'as':'Users','foreignKey':_0xcbf9('0x11d')});db[_0xcbf9('0xf1')][_0xcbf9('0x10d')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xcbf9('0x11d'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xf2')][_0xcbf9('0x10d')](db[_0xcbf9('0xf4')],{'as':_0xcbf9('0x1f1'),'foreignKey':_0xcbf9('0x1f2'),'onDelete':_0xcbf9('0x109')});db['WhatsappAccount'][_0xcbf9('0x10d')](db['Disposition'],{'as':_0xcbf9('0x167'),'foreignKey':_0xcbf9('0x1f3'),'onDelete':_0xcbf9('0x109')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db[_0xcbf9('0x184')],{'as':_0xcbf9('0x168'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db['WhatsappMessage'],{'as':_0xcbf9('0x158'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xf7')][_0xcbf9('0x10d')](db[_0xcbf9('0x118')],{'as':'Interactions'});db['WhatsappAccount'][_0xcbf9('0x10d')](db[_0xcbf9('0x1f4')],{'as':_0xcbf9('0x16c')});db[_0xcbf9('0xf7')][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db[_0xcbf9('0xf7')]['belongsTo'](db[_0xcbf9('0x7d')],{'as':_0xcbf9('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcbf9('0xf7')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x141')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db['WhatsappQueue'],{'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x1f4')]['belongsTo'](db[_0xcbf9('0xf7')],{'onDelete':'restrict'});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x7c')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x151')});db[_0xcbf9('0x1f4')][_0xcbf9('0x11c')](db[_0xcbf9('0x84')],{'onDelete':_0xcbf9('0x163'),'foreignKey':_0xcbf9('0x179')});db[_0xcbf9('0x118')][_0xcbf9('0x10d')](db[_0xcbf9('0xfa')],{'as':_0xcbf9('0x158'),'onDelete':_0xcbf9('0x109'),'foreignKey':_0xcbf9('0x1f5')});db[_0xcbf9('0x118')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{'as':_0xcbf9('0x170'),'foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0x118')]['belongsTo'](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0x118')]['belongsTo'](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x172'),'foreignKey':_0xcbf9('0x10a')});db[_0xcbf9('0x118')]['belongsToMany'](db[_0xcbf9('0x84')],{'through':'whatsapp_interaction_has_tags','as':_0xcbf9('0x17f')});db[_0xcbf9('0x118')][_0xcbf9('0x11e')](db[_0xcbf9('0x84')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xcbf9('0x118')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x175'),'through':_0xcbf9('0x128'),'foreignKey':_0xcbf9('0x1f5')});db['WhatsappMessage'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'as':'User'});db[_0xcbf9('0xfa')]['belongsTo'](db['CmContact'],{'onDelete':_0xcbf9('0x109'),'as':'Contact'});db[_0xcbf9('0xfa')][_0xcbf9('0x11c')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xcbf9('0x18e'),'foreignKey':_0xcbf9('0x1f5')});db[_0xcbf9('0xfa')][_0xcbf9('0x11c')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0xcbf9('0x1f3')});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{});db['WhatsappQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0xed')],{'as':_0xcbf9('0x17a'),'foreignKey':_0xcbf9('0x17b')});db['WhatsappQueueReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x121')],{'as':_0xcbf9('0x171'),'foreignKey':'ContactId'});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0x118')],{});db[_0xcbf9('0xfc')]['belongsTo'](db[_0xcbf9('0xff')],{});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db[_0xcbf9('0xfa')],{});db[_0xcbf9('0xfc')][_0xcbf9('0x11c')](db['User'],{});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db[_0xcbf9('0xfa')],{});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db['WhatsappInteraction'],{});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db['WhatsappAccount'],{'foreignKey':_0xcbf9('0x1f6'),'as':'FromAccount'});db[_0xcbf9('0xfe')][_0xcbf9('0x11c')](db[_0xcbf9('0xf7')],{'foreignKey':_0xcbf9('0x1f7'),'as':_0xcbf9('0x1e8')});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0xff')],{'foreignKey':_0xcbf9('0x1f8'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xcbf9('0x11c')](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e1'),'as':_0xcbf9('0x1e2')});db[_0xcbf9('0xfe')]['belongsTo'](db[_0xcbf9('0x10')],{'foreignKey':_0xcbf9('0x1e3'),'as':_0xcbf9('0x1e4')});db[_0xcbf9('0xff')][_0xcbf9('0x11e')](db[_0xcbf9('0x10')],{'as':_0xcbf9('0x155'),'through':_0xcbf9('0x33'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0xcbf9('0x11e')](db['Team'],{'through':_0xcbf9('0x1dc'),'as':'Teams'});db[_0xcbf9('0x108')][_0xcbf9('0x11c')](db['User'],{'as':_0xcbf9('0x1f9'),'foreignKey':_0xcbf9('0x10a'),'onDelete':_0xcbf9('0x109'),'hooks':!![]});db['CloudProvider'][_0xcbf9('0x10b')](db[_0xcbf9('0xb9')],{'as':_0xcbf9('0xb9'),'onDelete':_0xcbf9('0x163')});db[_0xcbf9('0x101')][_0xcbf9('0x10b')](db[_0xcbf9('0x35')],{'as':_0xcbf9('0x165'),'onDelete':'restrict'});db[_0xcbf9('0x101')][_0xcbf9('0x10b')](db[_0xcbf9('0x37')],{'as':_0xcbf9('0x166'),'onDelete':_0xcbf9('0x163')});module[_0xcbf9('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 7be050a..510689d 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb458=['./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/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/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','join','root','/apidoc','static','/www','/demo','/snippet','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','setupLoggers','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/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'];(function(_0x339c2c,_0x3161df){var _0xc6076d=function(_0x2aef73){while(--_0x2aef73){_0x339c2c['push'](_0x339c2c['shift']());}};_0xc6076d(++_0x3161df);}(_0xb458,0x103));var _0x8b45=function(_0x44a3a6,_0x59abd5){_0x44a3a6=_0x44a3a6-0x0;var _0x5e395b=_0xb458[_0x44a3a6];return _0x5e395b;};'use strict';var path=require(_0x8b45('0x0'));var express=require(_0x8b45('0x1'));var errors=require(_0x8b45('0x2'));var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x8b45('0x3')];var clientSideLogs=require(_0x8b45('0x4'));exports[_0x8b45('0x5')]=function(_0x13a8c6){return setupLoggers(_0x13a8c6)['then'](function(){_0x13a8c6[_0x8b45('0x6')]('/api/users',require('./api/user'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x7'),require(_0x8b45('0x8')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x9'),require('./api/voiceContext'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xa'),require(_0x8b45('0xb')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc'),require('./api/voiceMusicOnHold'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xd'),require('./api/voiceQueue'));_0x13a8c6['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xe'),require(_0x8b45('0xf')));_0x13a8c6['use'](_0x8b45('0x10'),require(_0x8b45('0x11')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x12'),require(_0x8b45('0x13')));_0x13a8c6[_0x8b45('0x6')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x14'),require(_0x8b45('0x15')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x16'),require(_0x8b45('0x17')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x18'),require(_0x8b45('0x19')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x1a'),require(_0x8b45('0x1b')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x1c'),require(_0x8b45('0x1d')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x1e'),require(_0x8b45('0x1f')));_0x13a8c6['use'](_0x8b45('0x20'),require(_0x8b45('0x21')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x22'),require(_0x8b45('0x23')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x24'),require(_0x8b45('0x25')));_0x13a8c6['use']('/api/mail/substatuses',require(_0x8b45('0x26')));_0x13a8c6['use'](_0x8b45('0x27'),require(_0x8b45('0x28')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x29'),require(_0x8b45('0x2a')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x2b'),require('./api/mailApplication'));_0x13a8c6['use'](_0x8b45('0x2c'),require(_0x8b45('0x2d')));_0x13a8c6['use']('/api/dashboards',require(_0x8b45('0x2e')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x2f'),require(_0x8b45('0x30')));_0x13a8c6['use'](_0x8b45('0x31'),require(_0x8b45('0x32')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x33'),require(_0x8b45('0x34')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x35'),require(_0x8b45('0x36')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x37'),require(_0x8b45('0x38')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x39'),require('./api/faxQueue'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x3a'),require(_0x8b45('0x3b')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x3c'),require(_0x8b45('0x3d')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x3e'),require('./api/smsApplication'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x3f'),require(_0x8b45('0x40')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x41'),require('./api/smsMessage'));_0x13a8c6[_0x8b45('0x6')]('/api/sms/queues',require('./api/smsQueue'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x42'),require(_0x8b45('0x43')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x44'),require(_0x8b45('0x45')));_0x13a8c6['use'](_0x8b45('0x46'),require(_0x8b45('0x47')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x48'),require('./api/openchannelMessage'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x49'),require(_0x8b45('0x4a')));_0x13a8c6['use'](_0x8b45('0x4b'),require(_0x8b45('0x4c')));_0x13a8c6[_0x8b45('0x6')]('/api/openchannel/reports/queue',require(_0x8b45('0x4d')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x4e'),require(_0x8b45('0x4f')));_0x13a8c6['use'](_0x8b45('0x50'),require(_0x8b45('0x51')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x52'),require(_0x8b45('0x53')));_0x13a8c6[_0x8b45('0x6')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x54'),require(_0x8b45('0x55')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x56'),require('./api/chatGroup'));_0x13a8c6[_0x8b45('0x6')]('/api/chat/proactive_actions',require(_0x8b45('0x57')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x58'),require(_0x8b45('0x59')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x5a'),require(_0x8b45('0x5b')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x5c'),require(_0x8b45('0x5d')));_0x13a8c6[_0x8b45('0x6')]('/api/cm/hopper_black',require(_0x8b45('0x5e')));_0x13a8c6['use'](_0x8b45('0x5f'),require('./api/cmHopperFinal'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x60'),require(_0x8b45('0x61')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x62'),require(_0x8b45('0x63')));_0x13a8c6['use'](_0x8b45('0x64'),require('./api/action'));_0x13a8c6['use'](_0x8b45('0x65'),require(_0x8b45('0x66')));_0x13a8c6[_0x8b45('0x6')]('/api/canned_answers',require(_0x8b45('0x67')));_0x13a8c6['use'](_0x8b45('0x68'),require(_0x8b45('0x69')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x6a'),require(_0x8b45('0x6b')));_0x13a8c6[_0x8b45('0x6')]('/api/intervals',require(_0x8b45('0x6c')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x6d'),require(_0x8b45('0x6e')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x6f'),require(_0x8b45('0x70')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x71'),require(_0x8b45('0x72')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x73'),require(_0x8b45('0x74')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x75'),require(_0x8b45('0x76')));_0x13a8c6['use']('/api/tags',require('./api/tag'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x77'),require(_0x8b45('0x78')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x79'),require(_0x8b45('0x7a')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x7b'),require('./api/variable'));_0x13a8c6[_0x8b45('0x6')]('/api/integrations',require(_0x8b45('0x7c')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x7d'),require(_0x8b45('0x7e')));_0x13a8c6['use'](_0x8b45('0x7f'),require(_0x8b45('0x80')));_0x13a8c6['use'](_0x8b45('0x81'),require(_0x8b45('0x82')));_0x13a8c6['use'](_0x8b45('0x83'),require(_0x8b45('0x84')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x85'),require(_0x8b45('0x86')));_0x13a8c6[_0x8b45('0x6')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x87'),require(_0x8b45('0x88')));_0x13a8c6['use'](_0x8b45('0x89'),require(_0x8b45('0x8a')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x8b'),require(_0x8b45('0x8c')));_0x13a8c6['use'](_0x8b45('0x8d'),require(_0x8b45('0x8e')));_0x13a8c6['use'](_0x8b45('0x8f'),require('./api/intSugarcrmAccount'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x90'),require(_0x8b45('0x91')));_0x13a8c6[_0x8b45('0x6')]('/api/integrations/sugarcrm/fields',require(_0x8b45('0x92')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x93'),require(_0x8b45('0x94')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x95'),require(_0x8b45('0x96')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x97'),require(_0x8b45('0x98')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x99'),require(_0x8b45('0x9a')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x9b'),require('./api/intZohoConfiguration'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x9c'),require(_0x8b45('0x9d')));_0x13a8c6['use'](_0x8b45('0x9e'),require(_0x8b45('0x9f')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xa0'),require('./api/intZendeskConfiguration'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xa1'),require(_0x8b45('0xa2')));_0x13a8c6[_0x8b45('0x6')]('/api/integrations/freshdesk/accounts',require(_0x8b45('0xa3')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xa4'),require(_0x8b45('0xa5')));_0x13a8c6[_0x8b45('0x6')]('/api/integrations/freshdesk/fields',require(_0x8b45('0xa6')));_0x13a8c6['use'](_0x8b45('0xa7'),require(_0x8b45('0xa8')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xa9'),require(_0x8b45('0xaa')));_0x13a8c6[_0x8b45('0x6')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xab'),require('./api/intServicenowAccount'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xac'),require(_0x8b45('0xad')));_0x13a8c6['use']('/api/integrations/servicenow/fields',require(_0x8b45('0xae')));_0x13a8c6[_0x8b45('0x6')]('/api/integrations/dynamics365/accounts',require(_0x8b45('0xaf')));_0x13a8c6['use'](_0x8b45('0xb0'),require('./api/intDynamics365Configuration'));_0x13a8c6['use'](_0x8b45('0xb1'),require(_0x8b45('0xb2')));_0x13a8c6['use'](_0x8b45('0xb3'),require(_0x8b45('0xb4')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xb5'),require(_0x8b45('0xb6')));_0x13a8c6['use'](_0x8b45('0xb7'),require(_0x8b45('0xb8')));_0x13a8c6[_0x8b45('0x6')]('/api/networks',require('./api/network'));_0x13a8c6[_0x8b45('0x6')]('/api/chat/reports/queue',require(_0x8b45('0xb9')));_0x13a8c6['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x13a8c6[_0x8b45('0x6')]('/api/jscripty/answers/reports',require(_0x8b45('0xba')));_0x13a8c6[_0x8b45('0x6')]('/api/jscripty/questions/reports',require(_0x8b45('0xbb')));_0x13a8c6[_0x8b45('0x6')]('/api/jscripty/sessions/reports',require(_0x8b45('0xbc')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xbd'),require(_0x8b45('0xbe')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xbf'),require(_0x8b45('0xc0')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc1'),require(_0x8b45('0xc2')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc3'),require('./api/jscriptyProject'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc4'),require(_0x8b45('0xc5')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc6'),require(_0x8b45('0xc7')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xc8'),require(_0x8b45('0xc9')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xca'),require(_0x8b45('0xcb')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xcc'),require(_0x8b45('0xcd')));_0x13a8c6['use'](_0x8b45('0xce'),require(_0x8b45('0xcf')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xd0'),require(_0x8b45('0xd1')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xd2'),require(_0x8b45('0xd3')));_0x13a8c6['use'](_0x8b45('0xd4'),require(_0x8b45('0xd5')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xd6'),require(_0x8b45('0xd7')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xd8'),require(_0x8b45('0xd9')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xda'),require(_0x8b45('0xdb')));_0x13a8c6['use']('/api/chat/reports/transfer',require(_0x8b45('0xdc')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xdd'),require(_0x8b45('0xde')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xdf'),require(_0x8b45('0xe0')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xe1'),require('./api/smsTransferReport'));_0x13a8c6['use'](_0x8b45('0xe2'),require(_0x8b45('0xe3')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xe4'),require('./api/voicePrefix'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xe5'),require(_0x8b45('0xe6')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xe7'),require(_0x8b45('0xe8')));_0x13a8c6['use']('/api/userProfile/resources',require(_0x8b45('0xe9')));_0x13a8c6['use']('/api/userNotifications',require('./api/userNotification'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xea'),require(_0x8b45('0xeb')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xec'),require(_0x8b45('0xed')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xee'),require(_0x8b45('0xef')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xf0'),require(_0x8b45('0xf1')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xf2'),require(_0x8b45('0xf3')));_0x13a8c6['use'](_0x8b45('0xf4'),require(_0x8b45('0xf5')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xf6'),require(_0x8b45('0xf7')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xf8'),require(_0x8b45('0xf9')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xfa'),require('./api/realtime'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xfb'),require(_0x8b45('0xfc')));_0x13a8c6[_0x8b45('0x6')]('/api/auth/local',require(_0x8b45('0xfd')));_0x13a8c6['use'](_0x8b45('0xfe'),require('./api/authGoogle'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0xff'),require(_0x8b45('0x100')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x101'),require(_0x8b45('0x102')));_0x13a8c6['use'](_0x8b45('0x103'),require(_0x8b45('0x104')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x105'),require('./api/version'));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x106'),require('./api/system'));_0x13a8c6['use'](_0x8b45('0x107'),require(_0x8b45('0x108')));_0x13a8c6[_0x8b45('0x6')]('/api/webbar',require(_0x8b45('0x109')));_0x13a8c6['use'](_0x8b45('0x10a'),clientSideLogs);_0x13a8c6[_0x8b45('0x6')]('/apidoc',express['static'](path[_0x8b45('0x10b')](config[_0x8b45('0x10c')],_0x8b45('0x10d'))));_0x13a8c6[_0x8b45('0x6')]('/www',express[_0x8b45('0x10e')](path[_0x8b45('0x10b')](config[_0x8b45('0x10c')],_0x8b45('0x10f'))));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x110'),express['static'](path[_0x8b45('0x10b')](config[_0x8b45('0x10c')],'/demo')));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x111'),express['static'](path['join'](config['root'],_0x8b45('0x112'),_0x8b45('0x113'))));_0x13a8c6[_0x8b45('0x6')](_0x8b45('0x114'),express[_0x8b45('0x10e')](path[_0x8b45('0x10b')](config[_0x8b45('0x10c')],'/server/files/plugins')));_0x13a8c6[_0x8b45('0x115')](_0x8b45('0x116'))[_0x8b45('0x117')](errors[0x194]);_0x13a8c6[_0x8b45('0x115')]('/*')[_0x8b45('0x117')](function(_0x10136e,_0x599d5c){_0x599d5c[_0x8b45('0x118')](path[_0x8b45('0x119')](_0x13a8c6[_0x8b45('0x117')](_0x8b45('0x11a'))+_0x8b45('0x11b')));});return _0x13a8c6;});}; \ No newline at end of file +var _0xe5b3=['/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections'];(function(_0x57d671,_0x1a101c){var _0x450dfe=function(_0x53c457){while(--_0x53c457){_0x57d671['push'](_0x57d671['shift']());}};_0x450dfe(++_0x1a101c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3c1ca7,_0x264ab5){_0x3c1ca7=_0x3c1ca7-0x0;var _0x2f7e2f=_0xe5b3[_0x3c1ca7];return _0x2f7e2f;};'use strict';var path=require('path');var express=require(_0x3e5b('0x0'));var errors=require(_0x3e5b('0x1'));var config=require(_0x3e5b('0x2'));var setupLoggers=require(_0x3e5b('0x3'))[_0x3e5b('0x4')];var clientSideLogs=require(_0x3e5b('0x5'));exports[_0x3e5b('0x6')]=function(_0x1e58ed){return setupLoggers(_0x1e58ed)[_0x3e5b('0x7')](function(){_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9'),require('./api/user'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa'),require('./api/voiceChanSpy'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb'),require(_0x3e5b('0xc')));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/extensions',require('./api/voiceExtension'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd'),require(_0x3e5b('0xe')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf'),require('./api/voiceQueue'));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/recordings',require(_0x3e5b('0x10')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x11'),require(_0x3e5b('0x12')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x13'),require(_0x3e5b('0x14')));_0x1e58ed['use'](_0x3e5b('0x15'),require('./api/voiceMailMessage'));_0x1e58ed['use']('/api/voice/calls/reports',require(_0x3e5b('0x16')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x17'),require('./api/voiceDialReport'));_0x1e58ed[_0x3e5b('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x18'),require('./api/voiceQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x19'),require('./api/memberReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1a'),require('./api/trunk'));_0x1e58ed['use'](_0x3e5b('0x1b'),require(_0x3e5b('0x1c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1d'),require(_0x3e5b('0x1e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x1f'),require(_0x3e5b('0x20')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x21'),require(_0x3e5b('0x22')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x23'),require(_0x3e5b('0x24')));_0x1e58ed['use'](_0x3e5b('0x25'),require(_0x3e5b('0x26')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x27'),require('./api/mailMessage'));_0x1e58ed[_0x3e5b('0x8')]('/api/mail/applications',require(_0x3e5b('0x28')));_0x1e58ed[_0x3e5b('0x8')]('/api/mail/reports/queue',require(_0x3e5b('0x29')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x2a'),require(_0x3e5b('0x2b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x2c'),require(_0x3e5b('0x2d')));_0x1e58ed[_0x3e5b('0x8')]('/api/fax/accounts',require(_0x3e5b('0x2e')));_0x1e58ed['use'](_0x3e5b('0x2f'),require('./api/faxApplication'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x30'),require(_0x3e5b('0x31')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x32'),require(_0x3e5b('0x33')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x34'),require(_0x3e5b('0x35')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x36'),require('./api/faxQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x37'),require(_0x3e5b('0x38')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x39'),require(_0x3e5b('0x3a')));_0x1e58ed[_0x3e5b('0x8')]('/api/sms/interactions',require(_0x3e5b('0x3b')));_0x1e58ed['use']('/api/sms/messages',require(_0x3e5b('0x3c')));_0x1e58ed[_0x3e5b('0x8')]('/api/sms/queues',require(_0x3e5b('0x3d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x3e'),require(_0x3e5b('0x3f')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x40'),require(_0x3e5b('0x41')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x42'),require(_0x3e5b('0x43')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x44'),require('./api/openchannelMessage'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x45'),require('./api/openchannelQueue'));_0x1e58ed['use'](_0x3e5b('0x46'),require('./api/chatWebsite'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x47'),require(_0x3e5b('0x48')));_0x1e58ed[_0x3e5b('0x8')]('/api/chat/applications',require(_0x3e5b('0x49')));_0x1e58ed['use'](_0x3e5b('0x4a'),require('./api/chatInteraction'));_0x1e58ed['use']('/api/chat/messages',require(_0x3e5b('0x4b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4c'),require(_0x3e5b('0x4d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4e'),require('./api/chatQueue'));_0x1e58ed['use']('/api/chat/groups',require('./api/chatGroup'));_0x1e58ed['use']('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x4f'),require(_0x3e5b('0x50')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x51'),require(_0x3e5b('0x52')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x53'),require(_0x3e5b('0x54')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x55'),require('./api/cmHopperBlack'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x56'),require(_0x3e5b('0x57')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x58'),require(_0x3e5b('0x59')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5a'),require(_0x3e5b('0x5b')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5c'),require('./api/action'));_0x1e58ed['use']('/api/automations',require('./api/automation'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5d'),require(_0x3e5b('0x5e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x5f'),require(_0x3e5b('0x60')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x61'),require(_0x3e5b('0x62')));_0x1e58ed[_0x3e5b('0x8')]('/api/intervals',require(_0x3e5b('0x63')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x64'),require(_0x3e5b('0x65')));_0x1e58ed[_0x3e5b('0x8')]('/api/cdr',require('./api/cdr'));_0x1e58ed['use'](_0x3e5b('0x66'),require(_0x3e5b('0x67')));_0x1e58ed[_0x3e5b('0x8')]('/api/schedules',require('./api/schedule'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x68'),require(_0x3e5b('0x69')));_0x1e58ed['use']('/api/tags',require(_0x3e5b('0x6a')));_0x1e58ed['use'](_0x3e5b('0x6b'),require(_0x3e5b('0x6c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x6d'),require(_0x3e5b('0x6e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x6f'),require(_0x3e5b('0x70')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations',require(_0x3e5b('0x71')));_0x1e58ed['use'](_0x3e5b('0x72'),require(_0x3e5b('0x73')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x74'),require(_0x3e5b('0x75')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x76'),require(_0x3e5b('0x77')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x78'),require(_0x3e5b('0x79')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7a'),require('./api/analyticMetric'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7b'),require(_0x3e5b('0x7c')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x7d'),require(_0x3e5b('0x7e')));_0x1e58ed['use'](_0x3e5b('0x7f'),require(_0x3e5b('0x80')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x81'),require(_0x3e5b('0x82')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x83'),require(_0x3e5b('0x84')));_0x1e58ed['use'](_0x3e5b('0x85'),require('./api/intSugarcrmAccount'));_0x1e58ed['use'](_0x3e5b('0x86'),require('./api/intSugarcrmConfiguration'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x87'),require(_0x3e5b('0x88')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x1e58ed['use']('/api/integrations/desk/configurations',require(_0x3e5b('0x89')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8a'),require(_0x3e5b('0x8b')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8c'),require(_0x3e5b('0x8d')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8e'),require('./api/intZohoField'));_0x1e58ed['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x8f'),require(_0x3e5b('0x90')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x91'),require(_0x3e5b('0x92')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x93'),require('./api/intFreshdeskAccount'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x94'),require(_0x3e5b('0x95')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x96'),require('./api/intFreshdeskField'));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/vtiger/accounts',require(_0x3e5b('0x97')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1e58ed['use'](_0x3e5b('0x98'),require('./api/intVtigerField'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x99'),require(_0x3e5b('0x9a')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9b'),require('./api/intServicenowConfiguration'));_0x1e58ed['use'](_0x3e5b('0x9c'),require(_0x3e5b('0x9d')));_0x1e58ed[_0x3e5b('0x8')]('/api/integrations/dynamics365/accounts',require(_0x3e5b('0x9e')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0x9f'),require(_0x3e5b('0xa0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa1'),require(_0x3e5b('0xa2')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa3'),require(_0x3e5b('0xa4')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa5'),require(_0x3e5b('0xa6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa7'),require(_0x3e5b('0xa8')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xa9'),require('./api/network'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xaa'),require('./api/chatQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xab'),require('./api/chatInternalMessage'));_0x1e58ed['use']('/api/jscripty/answers/reports',require(_0x3e5b('0xac')));_0x1e58ed[_0x3e5b('0x8')]('/api/jscripty/questions/reports',require(_0x3e5b('0xad')));_0x1e58ed[_0x3e5b('0x8')]('/api/jscripty/sessions/reports',require(_0x3e5b('0xae')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xaf'),require(_0x3e5b('0xb0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb1'),require(_0x3e5b('0xb2')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb3'),require('./api/squareReportDetail'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb4'),require(_0x3e5b('0xb5')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb6'),require(_0x3e5b('0xb7')));_0x1e58ed[_0x3e5b('0x8')]('/api/square/odbc',require('./api/squareOdbc'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb8'),require('./api/squareProject'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xb9'),require(_0x3e5b('0xba')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xbb'),require(_0x3e5b('0xbc')));_0x1e58ed[_0x3e5b('0x8')]('/api/teams',require(_0x3e5b('0xbd')));_0x1e58ed[_0x3e5b('0x8')]('/api/license',require('./api/license'));_0x1e58ed['use'](_0x3e5b('0xbe'),require(_0x3e5b('0xbf')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc0'),require(_0x3e5b('0xc1')));_0x1e58ed[_0x3e5b('0x8')]('/api/attachments',require(_0x3e5b('0xc2')));_0x1e58ed[_0x3e5b('0x8')]('/api/plugins',require(_0x3e5b('0xc3')));_0x1e58ed['use']('/api/mail/reports/transfer',require(_0x3e5b('0xc4')));_0x1e58ed[_0x3e5b('0x8')]('/api/chat/reports/transfer',require(_0x3e5b('0xc5')));_0x1e58ed[_0x3e5b('0x8')]('/api/fax/reports/transfer',require(_0x3e5b('0xc6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc7'),require(_0x3e5b('0xc8')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xc9'),require('./api/smsTransferReport'));_0x1e58ed['use'](_0x3e5b('0xca'),require('./api/cmList'));_0x1e58ed['use'](_0x3e5b('0xcb'),require(_0x3e5b('0xcc')));_0x1e58ed[_0x3e5b('0x8')]('/api/userProfiles',require(_0x3e5b('0xcd')));_0x1e58ed['use'](_0x3e5b('0xce'),require('./api/userProfileSection'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xcf'),require(_0x3e5b('0xd0')));_0x1e58ed[_0x3e5b('0x8')]('/api/userNotifications',require(_0x3e5b('0xd1')));_0x1e58ed['use'](_0x3e5b('0xd2'),require(_0x3e5b('0xd3')));_0x1e58ed['use'](_0x3e5b('0xd4'),require(_0x3e5b('0xd5')));_0x1e58ed[_0x3e5b('0x8')]('/api/whatsapp/interactions',require(_0x3e5b('0xd6')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd7'),require('./api/whatsappMessage'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd8'),require('./api/whatsappQueueReport'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xd9'),require(_0x3e5b('0xda')));_0x1e58ed['use'](_0x3e5b('0xdb'),require(_0x3e5b('0xdc')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xdd'),require('./api/cloudProvider'));_0x1e58ed[_0x3e5b('0x8')]('/api/realtime',require(_0x3e5b('0xde')));_0x1e58ed['use'](_0x3e5b('0xdf'),require(_0x3e5b('0xe0')));_0x1e58ed['use'](_0x3e5b('0xe1'),require(_0x3e5b('0xe2')));_0x1e58ed['use'](_0x3e5b('0xe3'),require(_0x3e5b('0xe4')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xe5'),require('./api/authActiveDirectory'));_0x1e58ed['use'](_0x3e5b('0xe6'),require(_0x3e5b('0xe7')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xe8'),require(_0x3e5b('0xe9')));_0x1e58ed[_0x3e5b('0x8')]('/api/version',require('./api/version'));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xea'),require(_0x3e5b('0xeb')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xec'),require(_0x3e5b('0xed')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xee'),require('./api/webbar'));_0x1e58ed['use'](_0x3e5b('0xef'),clientSideLogs);_0x1e58ed['use'](_0x3e5b('0xf0'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf0'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf4'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf4'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf5'),express['static'](path['join'](config[_0x3e5b('0xf3')],_0x3e5b('0xf5'))));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf6'),express['static'](path[_0x3e5b('0xf2')](config['root'],_0x3e5b('0xf7'),'3.0.0')));_0x1e58ed[_0x3e5b('0x8')](_0x3e5b('0xf8'),express[_0x3e5b('0xf1')](path[_0x3e5b('0xf2')](config[_0x3e5b('0xf3')],_0x3e5b('0xf9'))));_0x1e58ed[_0x3e5b('0xfa')](_0x3e5b('0xfb'))[_0x3e5b('0xfc')](errors[0x194]);_0x1e58ed['route']('/*')[_0x3e5b('0xfc')](function(_0x2ee814,_0x4c81dc){_0x4c81dc[_0x3e5b('0xfd')](path[_0x3e5b('0xfe')](_0x1e58ed[_0x3e5b('0xfc')](_0x3e5b('0xff'))+_0x3e5b('0x100')));});return _0x1e58ed;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 805764a..97b2545 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x078a=['Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x078a,0x176));var _0xa078=function(_0x505a75,_0x41dfec){_0x505a75=_0x505a75-0x0;var _0x123082=_0x078a[_0x505a75];return _0x123082;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa078('0x0'));var config=require(_0xa078('0x1'));exports['listen']=function(){return new Promise(function(_0x145a11,_0x4ca1d2){var _0x21e4d8={};_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/user/user.rpc'));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x3')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x4')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x5')));_0x21e4d8=_['merge'](_0x21e4d8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x6')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x7')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x8')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x9')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0xa')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0xb')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0xc')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0xd')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0xe')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0xf')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/mailMessage/mailMessage.rpc'));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x10')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x11')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/faxAccount/faxAccount.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x12')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x13')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x14')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x15')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x16')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/smsAccount/smsAccount.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x17')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/smsMessage/smsMessage.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x18')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x19')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x1a')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x1b')));_0x21e4d8=_['merge'](_0x21e4d8,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x1c')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/chatMessage/chatMessage.rpc'));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x1d')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x1e')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x1f')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x20')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x21')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x22')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x23')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x24')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/sound/sound.rpc'));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x25')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/trigger/trigger.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x26')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x27')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x28')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x29')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x21e4d8=_['merge'](_0x21e4d8,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2a')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2b')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2c')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2d')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2e')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x2f')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x30')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x31')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x32')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x33')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x34')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x35')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x36')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x37')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x38')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x39')));_0x21e4d8=_['merge'](_0x21e4d8,require(_0xa078('0x3a')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x3b')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x3c')));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x21e4d8=_[_0xa078('0x2')](_0x21e4d8,require(_0xa078('0x3d')));var _0x1a2e01=jayson[_0xa078('0x3e')](_0x21e4d8)[_0xa078('0x3f')]();var _0x4e721d=config[_0xa078('0x40')][_0xa078('0x41')]||config['port']+0x1;var _0x32e676=config[_0xa078('0x40')]['ip']||_0xa078('0x42');_0x1a2e01['on'](_0xa078('0x43'),function(_0x233a4c){return _0x4ca1d2(_0x233a4c);});_0x1a2e01[_0xa078('0x44')](_0x4e721d,_0x32e676,function(){console[_0xa078('0x45')](_0xa078('0x46'),_0x32e676,_0x4e721d);require(_0xa078('0x47'))[_0xa078('0x48')]();return _0x145a11(_0xa078('0x49')+_0x32e676+':'+_0x4e721d);});});}; \ No newline at end of file +var _0xe118=['port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','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/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc'];(function(_0x1486e5,_0x39684f){var _0x29d89b=function(_0x4a0a80){while(--_0x4a0a80){_0x1486e5['push'](_0x1486e5['shift']());}};_0x29d89b(++_0x39684f);}(_0xe118,0x7b));var _0x8e11=function(_0x221eb2,_0x2d65bc){_0x221eb2=_0x221eb2-0x0;var _0x3760ee=_0xe118[_0x221eb2];return _0x3760ee;};'use strict';var jayson=require(_0x8e11('0x0'));var _=require(_0x8e11('0x1'));var config=require('../config/environment');exports[_0x8e11('0x2')]=function(){return new Promise(function(_0x3f4f12,_0x2f1a9e){var _0x283c7e={};_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x4')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x5')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x6')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/voiceRecording/voiceRecording.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x7')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x8')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x9')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xa')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0xb')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/trunk/trunk.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/mailServerIn/mailServerIn.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xc')));_0x283c7e=_['merge'](_0x283c7e,require('../api/mailQueue/mailQueue.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0xd')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xe')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/mailApplication/mailApplication.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0xf')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/faxAccount/faxAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x10')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x11')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/faxMessage/faxMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x12')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x13')));_0x283c7e=_['merge'](_0x283c7e,require('../api/smsAccount/smsAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x14')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/smsMessage/smsMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x15')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x16')));_0x283c7e=_['merge'](_0x283c7e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x17')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x18')));_0x283c7e=_['merge'](_0x283c7e,require('../api/chatInteraction/chatInteraction.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x19')));_0x283c7e=_['merge'](_0x283c7e,require('../api/chatQueue/chatQueue.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1a')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x1b')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1c')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x1d')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1e')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x1f')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/template/template.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/trigger/trigger.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x20')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x21')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x22')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x23')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x24')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x283c7e=_['merge'](_0x283c7e,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x25')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x26')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x27')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x28')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x29')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/squareOdbc/squareOdbc.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2a')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2b')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x2c')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/campaign/campaign.rpc'));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2d')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2e')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x2f')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require(_0x8e11('0x30')));_0x283c7e=_[_0x8e11('0x3')](_0x283c7e,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x31')));_0x283c7e=_['merge'](_0x283c7e,require(_0x8e11('0x32')));var _0x44f6d3=jayson[_0x8e11('0x33')](_0x283c7e)[_0x8e11('0x34')]();var _0x5b44d3=config[_0x8e11('0x35')][_0x8e11('0x36')]||config[_0x8e11('0x36')]+0x1;var _0xee352c=config['rpc']['ip']||'localhost';_0x44f6d3['on'](_0x8e11('0x37'),function(_0x2968c9){return _0x2f1a9e(_0x2968c9);});_0x44f6d3[_0x8e11('0x2')](_0x5b44d3,_0xee352c,function(){console[_0x8e11('0x38')](_0x8e11('0x39'),_0xee352c,_0x5b44d3);require('../config/triggers')[_0x8e11('0x3a')]();return _0x3f4f12('RPC\x20listening\x20on\x20'+_0xee352c+':'+_0x5b44d3);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4f0fc31..0986c7f 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 _0x20a2=['lodash','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','520-Invalid','search','function','substring','no\x20code','replace','result=','substr','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util'];(function(_0x236c08,_0xa2ae1e){var _0x36c251=function(_0x6dfd81){while(--_0x6dfd81){_0x236c08['push'](_0x236c08['shift']());}};_0x36c251(++_0xa2ae1e);}(_0x20a2,0xf2));var _0x220a=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0x20a2[_0x350aeb];return _0x3c5273;};'use strict';var util=require(_0x220a('0x0'));var _=require(_0x220a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0x220a('0x2'));var AGIError=require(_0x220a('0x3'));function AGIChannel(_0x2d5d6c){var _0x328d6d=this,_0x40766a=new AGIReply(),_0xe391a4=![],_0x4e339e={};EventEmitter['call'](_0x328d6d);_0x2d5d6c[_0x220a('0x4')](_0x220a('0x5'));_0x2d5d6c[_0x220a('0x6')](0x8*0x3c*0x3c*0x3e8);_0x40766a[_0x220a('0x4')](_0x220a('0x5'));_0x40766a['on']('headers',function(_0x2970ac){for(var _0x3e5e13 in _0x2970ac){_0x328d6d[_0x3e5e13]=_0x2970ac[_0x3e5e13];}_0x328d6d[_0x220a('0x7')](_0x220a('0x8'));});_0x40766a['on'](_0x220a('0x9'),function(_0x43ed6e){if(_0x43ed6e[_0x220a('0xa')]()==_0x220a('0xb')){_0x328d6d[_0x220a('0x7')](_0x220a('0xb'));return;}if(_0x43ed6e['substring'](0x0,0xb)==_0x220a('0xc')){_0xe391a4=!![];}if(_0xe391a4){_0x4e339e['rx']+=_0x43ed6e+'\x0a';if(_0x43ed6e[_0x220a('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0xe391a4=![];}}else{_0x4e339e['rx']=_0x43ed6e;}if(_0xe391a4){return;}if(typeof _0x4e339e['cb']==_0x220a('0xe')){var _0x502a87=_0x4e339e['rx'][_0x220a('0xf')](0x0,0x3),_0x21c426=null,_0x19158c=null;_0x502a87=parseInt(_0x502a87);if(isNaN(_0x502a87)){_0x4e339e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x220a('0x10')});return;}if(_0x502a87!=0xc8){_0x4e339e['cb'](null,{'code':_0x502a87,'result':-0x1,'extra':'KO'});return;}_0x21c426=_0x4e339e['rx']['substring'](0x4)[_0x220a('0x11')](_0x220a('0x12'),'');if(_0x21c426['indexOf']('\x20')!=-0x1){_0x21c426=_0x21c426[_0x220a('0x13')](0x0,_0x21c426[_0x220a('0x14')]('\x20'));}if(_['startsWith'](_0x21c426,'-1')){_0x21c426=parseInt(_0x21c426);}_0x19158c=_0x4e339e['rx'][_0x220a('0x15')]('\x20');if(_0x19158c[_0x220a('0x16')]==0x3){_0x19158c=_0x19158c[0x2][_0x220a('0xf')](0x1,_0x19158c[0x2]['length']-0x1);}else if(_0x19158c[_0x220a('0x16')]>0x3){var _0x5498b1=/\((.+)\)/;var _0x18f5e0=_0x4e339e['rx'][_0x220a('0x17')](_0x5498b1);if(_0x18f5e0){_0x19158c=_0x18f5e0[0x1];}else{_0x19158c=null;}}else{_0x19158c=null;}_0x4e339e['cb'](null,{'code':_0x502a87,'result':_0x21c426,'extra':_0x19158c});}});_0x2d5d6c['on'](_0x220a('0x18'),function(_0xcea72b){_0x328d6d[_0x220a('0x7')](_0x220a('0x18'),new AGIError(_0x220a('0x19'),_0xcea72b[_0x220a('0x1a')]));});_0x2d5d6c['on']('close',function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1b'),new AGIError(_0x220a('0x1c')));});_0x2d5d6c['on'](_0x220a('0x1d'),function(){_0x328d6d[_0x220a('0x7')](_0x220a('0x1d'),new AGIError(_0x220a('0x1e')));_0x2d5d6c[_0x220a('0x1f')]();});_0x2d5d6c[_0x220a('0x20')](_0x40766a);this[_0x220a('0x21')]=function(_0x5be1fb,_0x5e6979){var _0x5be1fb=_0x5be1fb||'',_0x5e6979=typeof _0x5e6979==_0x220a('0xe')?_0x5e6979:new Function();_0x4e339e={'tx':_0x5be1fb,'rx':'','cb':_0x5e6979};_0x2d5d6c[_0x220a('0x22')](_0x5be1fb+'\x0a');},this[_0x220a('0x1b')]=function(){_0x2d5d6c[_0x220a('0x1f')]();};}util[_0x220a('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x220a('0x24')][_0x220a('0x25')]=function(_0x4f2ca1){return this[_0x220a('0x21')]['sync'](this,_0x4f2ca1);};AGIChannel[_0x220a('0x24')]['answer']=function(){return this[_0x220a('0x25')](_0x220a('0x26'));};AGIChannel[_0x220a('0x24')][_0x220a('0x27')]=function(_0x4378b2,_0x3ca893,_0x5be801){_0x4378b2=_0x4378b2===undefined?_0x220a('0x28'):_0x4378b2;_0x3ca893=_0x3ca893===undefined?'5':_0x3ca893;_0x5be801=_0x5be801===undefined?'1':_0x5be801;return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x2a'),_0x4378b2,_0x3ca893*0x3e8,_0x5be801));};AGIChannel[_0x220a('0x24')][_0x220a('0x2b')]=function(_0xc0225b){_0xc0225b=_0xc0225b||_0x220a('0x2c');return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x2d'),_0xc0225b));};AGIChannel[_0x220a('0x24')][_0x220a('0x2e')]=function(_0x573b2a,_0x324415){if(_[_0x220a('0x2f')](_0x324415)){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x30'),_0x573b2a,_0x324415[_0x220a('0x31')](',')));}return this[_0x220a('0x25')](util[_0x220a('0x29')]('EXEC\x20%s\x20%s',_0x573b2a,_0x324415));};AGIChannel[_0x220a('0x24')][_0x220a('0x32')]=function(_0x4fb37e){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x33'),_0x4fb37e));};AGIChannel['prototype']['setExtension']=function(_0x2f7826){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x34'),_0x2f7826));};AGIChannel[_0x220a('0x24')][_0x220a('0x35')]=function(_0x14ee00){return this[_0x220a('0x25')](util['format'](_0x220a('0x36'),_0x14ee00));};AGIChannel['prototype'][_0x220a('0xb')]=function(){return this[_0x220a('0x25')](_0x220a('0x37'));};AGIChannel[_0x220a('0x24')][_0x220a('0x38')]=function(_0x48cda,_0x1c32dc){var _0x451972=_[_0x220a('0x39')](_0x1c32dc)||_[_0x220a('0x3a')](_0x1c32dc)?_0x1c32dc[_0x220a('0x3b')]():_0x1c32dc;return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3c'),_0x48cda,_0x451972?_0x451972['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x220a('0x24')][_0x220a('0x3d')]=function(_0x502b49,_0x3f27b2){return this[_0x220a('0x25')](util[_0x220a('0x29')](_0x220a('0x3e'),_0x502b49,_0x3f27b2));};AGIChannel[_0x220a('0x24')][_0x220a('0x3f')]=function(_0x1efec4,_0x3028a1){return this['sendRequest'](util['format'](_0x220a('0x40'),_0x1efec4,_0x3028a1));};AGIChannel[_0x220a('0x24')][_0x220a('0x41')]=function(_0x423ae7,_0x1d1fdd){return this[_0x220a('0x25')](util['format'](_0x220a('0x42'),_0x423ae7,_0x1d1fdd));};AGIChannel[_0x220a('0x24')]['continueAt']=function(_0x6da1dc,_0x2f2d39,_0x331efa){_0x2f2d39=_0x2f2d39||this[_0x220a('0x43')];_0x331efa=_0x331efa||0x1;this[_0x220a('0x32')](_0x6da1dc);this[_0x220a('0x44')](_0x2f2d39);this[_0x220a('0x35')](_0x331efa);return this[_0x220a('0x2b')](util[_0x220a('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x6da1dc,_0x2f2d39,_0x331efa));};AGIChannel['prototype'][_0x220a('0x45')]=function(_0x5e7f71){return this['sendRequest'](util[_0x220a('0x29')](_0x220a('0x46'),_0x5e7f71));};AGIChannel[_0x220a('0x24')][_0x220a('0x47')]=function(_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x419b0b,_0x17162d){_0x4d6122=_0x4d6122||_0x220a('0x48');_0x122316=_0x122316||'';_0x1f53c6=_0x1f53c6===undefined?-0x1:_0x1f53c6==='-1'?-0x1:_0x1f53c6*0x3e8;_0x419b0b=_0x419b0b===undefined?'':'s='+_0x419b0b;_0x17162d=_0x17162d?'BEEP':'';return this[_0x220a('0x25')](util['format'](_0x220a('0x49'),_0x3421a5,_0x4d6122,_0x122316,_0x1f53c6,_0x17162d,_0x419b0b));};AGIChannel['prototype'][_0x220a('0x4a')]=function(_0x4515ae,_0x26c29b){_0x26c29b=_0x26c29b||'';return this[_0x220a('0x25')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4515ae,_0x26c29b));};AGIChannel[_0x220a('0x24')][_0x220a('0x4b')]=function(_0x468594){return this[_0x220a('0x2e')]('AGI',_0x468594);};AGIChannel[_0x220a('0x24')][_0x220a('0x4c')]=function(_0x34281b){return this[_0x220a('0x2e')](_0x220a('0x4d'),_0x34281b);};AGIChannel['prototype']['error']=function(_0x5de2b6,_0x481fed){this[_0x220a('0x2b')](util[_0x220a('0x29')](_0x220a('0x4e'),_0x5de2b6['id'],_0x5de2b6[_0x220a('0x4f')],_0x481fed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x220a('0x50')]=AGIChannel; \ No newline at end of file +var _0xacf5=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','prototype','sendRequest','command','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber'];(function(_0x9f93d1,_0x2ed4ec){var _0x271751=function(_0x3b9a33){while(--_0x3b9a33){_0x9f93d1['push'](_0x9f93d1['shift']());}};_0x271751(++_0x2ed4ec);}(_0xacf5,0x110));var _0x5acf=function(_0x138188,_0x1f4c40){_0x138188=_0x138188-0x0;var _0x3b10a1=_0xacf5[_0x138188];return _0x3b10a1;};'use strict';var util=require(_0x5acf('0x0'));var _=require(_0x5acf('0x1'));var EventEmitter=require(_0x5acf('0x2'))[_0x5acf('0x3')];var AGIReply=require(_0x5acf('0x4'));var AGIError=require(_0x5acf('0x5'));function AGIChannel(_0x2ba0dd){var _0x17bf56=this,_0xe57842=new AGIReply(),_0x40302f=![],_0x58e205={};EventEmitter[_0x5acf('0x6')](_0x17bf56);_0x2ba0dd[_0x5acf('0x7')](_0x5acf('0x8'));_0x2ba0dd[_0x5acf('0x9')](0x8*0x3c*0x3c*0x3e8);_0xe57842[_0x5acf('0x7')]('utf8');_0xe57842['on'](_0x5acf('0xa'),function(_0x5f12f0){for(var _0x64e6b7 in _0x5f12f0){_0x17bf56[_0x64e6b7]=_0x5f12f0[_0x64e6b7];}_0x17bf56[_0x5acf('0xb')]('ready');});_0xe57842['on'](_0x5acf('0xc'),function(_0x36c207){if(_0x36c207[_0x5acf('0xd')]()==_0x5acf('0xe')){_0x17bf56[_0x5acf('0xb')](_0x5acf('0xe'));return;}if(_0x36c207[_0x5acf('0xf')](0x0,0xb)==_0x5acf('0x10')){_0x40302f=!![];}if(_0x40302f){_0x58e205['rx']+=_0x36c207+'\x0a';if(_0x36c207[_0x5acf('0x11')](_0x5acf('0x12'))!=-0x1){_0x40302f=![];}}else{_0x58e205['rx']=_0x36c207;}if(_0x40302f){return;}if(typeof _0x58e205['cb']=='function'){var _0x572e1a=_0x58e205['rx'][_0x5acf('0xf')](0x0,0x3),_0x53afd8=null,_0x322294=null;_0x572e1a=parseInt(_0x572e1a);if(isNaN(_0x572e1a)){_0x58e205['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x572e1a!=0xc8){_0x58e205['cb'](null,{'code':_0x572e1a,'result':-0x1,'extra':'KO'});return;}_0x53afd8=_0x58e205['rx']['substring'](0x4)[_0x5acf('0x13')](_0x5acf('0x14'),'');if(_0x53afd8[_0x5acf('0x15')]('\x20')!=-0x1){_0x53afd8=_0x53afd8['substr'](0x0,_0x53afd8[_0x5acf('0x15')]('\x20'));}if(_[_0x5acf('0x16')](_0x53afd8,'-1')){_0x53afd8=parseInt(_0x53afd8);}_0x322294=_0x58e205['rx']['split']('\x20');if(_0x322294[_0x5acf('0x17')]==0x3){_0x322294=_0x322294[0x2]['substring'](0x1,_0x322294[0x2][_0x5acf('0x17')]-0x1);}else if(_0x322294[_0x5acf('0x17')]>0x3){var _0x27373f=/\((.+)\)/;var _0x195748=_0x58e205['rx'][_0x5acf('0x18')](_0x27373f);if(_0x195748){_0x322294=_0x195748[0x1];}else{_0x322294=null;}}else{_0x322294=null;}_0x58e205['cb'](null,{'code':_0x572e1a,'result':_0x53afd8,'extra':_0x322294});}});_0x2ba0dd['on'](_0x5acf('0x19'),function(_0x2987c4){_0x17bf56[_0x5acf('0xb')](_0x5acf('0x19'),new AGIError(_0x5acf('0x1a'),_0x2987c4[_0x5acf('0x1b')]));});_0x2ba0dd['on'](_0x5acf('0x1c'),function(){_0x17bf56['emit'](_0x5acf('0x1c'),new AGIError(_0x5acf('0x1d')));});_0x2ba0dd['on']('timeout',function(){_0x17bf56[_0x5acf('0xb')](_0x5acf('0x1e'),new AGIError(_0x5acf('0x1f')));_0x2ba0dd[_0x5acf('0x20')]();});_0x2ba0dd[_0x5acf('0x21')](_0xe57842);this['command']=function(_0x459fda,_0x329d65){var _0x459fda=_0x459fda||'',_0x329d65=typeof _0x329d65==_0x5acf('0x22')?_0x329d65:new Function();_0x58e205={'tx':_0x459fda,'rx':'','cb':_0x329d65};_0x2ba0dd[_0x5acf('0x23')](_0x459fda+'\x0a');},this[_0x5acf('0x1c')]=function(){_0x2ba0dd[_0x5acf('0x20')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x5acf('0x24')][_0x5acf('0x25')]=function(_0x910cd5){return this[_0x5acf('0x26')]['sync'](this,_0x910cd5);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x27')]=function(){return this[_0x5acf('0x25')]('ANSWER');};AGIChannel[_0x5acf('0x24')][_0x5acf('0x28')]=function(_0xc40536,_0x445537,_0x85c8b5){_0xc40536=_0xc40536===undefined?_0x5acf('0x29'):_0xc40536;_0x445537=_0x445537===undefined?'5':_0x445537;_0x85c8b5=_0x85c8b5===undefined?'1':_0x85c8b5;return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x2b'),_0xc40536,_0x445537*0x3e8,_0x85c8b5));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x2c')]=function(_0x52d304){_0x52d304=_0x52d304||_0x5acf('0x2d');return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x2e'),_0x52d304));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x2f')]=function(_0x9102f3,_0x5ddd31){if(_[_0x5acf('0x30')](_0x5ddd31)){return this[_0x5acf('0x25')](util['format'](_0x5acf('0x31'),_0x9102f3,_0x5ddd31[_0x5acf('0x32')](',')));}return this[_0x5acf('0x25')](util['format'](_0x5acf('0x31'),_0x9102f3,_0x5ddd31));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x33')]=function(_0xfc7ee1){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x34'),_0xfc7ee1));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x35')]=function(_0x30f54f){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x36'),_0x30f54f));};AGIChannel['prototype']['setPriority']=function(_0x4ce14d){return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x37'),_0x4ce14d));};AGIChannel[_0x5acf('0x24')][_0x5acf('0xe')]=function(){return this['sendRequest'](_0x5acf('0x38'));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x39')]=function(_0x9e5e4e,_0xe6ad98){var _0x53f097=_[_0x5acf('0x3a')](_0xe6ad98)||_[_0x5acf('0x3b')](_0xe6ad98)?_0xe6ad98[_0x5acf('0x3c')]():_0xe6ad98;return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x3d'),_0x9e5e4e,_0x53f097?_0x53f097[_0x5acf('0x3c')]()[_0x5acf('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x3e')]=function(_0x4c258b,_0x161446){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x3f'),_0x4c258b,_0x161446));};AGIChannel[_0x5acf('0x24')]['sayDigits']=function(_0x2038bc,_0x511447){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x40'),_0x2038bc,_0x511447));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x41')]=function(_0x39e19d,_0x18e21c){return this['sendRequest'](util[_0x5acf('0x2a')](_0x5acf('0x42'),_0x39e19d,_0x18e21c));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x43')]=function(_0x549f47,_0x5a0c4c,_0x257a03){_0x5a0c4c=_0x5a0c4c||this[_0x5acf('0x44')];_0x257a03=_0x257a03||0x1;this[_0x5acf('0x33')](_0x549f47);this[_0x5acf('0x35')](_0x5a0c4c);this[_0x5acf('0x45')](_0x257a03);return this[_0x5acf('0x2c')](util['format'](_0x5acf('0x46'),_0x549f47,_0x5a0c4c,_0x257a03));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x47')]=function(_0x1d5aa8){return this[_0x5acf('0x25')](util[_0x5acf('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x1d5aa8));};AGIChannel['prototype'][_0x5acf('0x48')]=function(_0x17e9ad,_0xdc43bc,_0x3fd927,_0x15e0cf,_0xc6c804,_0xb213e6){_0xdc43bc=_0xdc43bc||_0x5acf('0x49');_0x3fd927=_0x3fd927||'';_0x15e0cf=_0x15e0cf===undefined?-0x1:_0x15e0cf==='-1'?-0x1:_0x15e0cf*0x3e8;_0xc6c804=_0xc6c804===undefined?'':'s='+_0xc6c804;_0xb213e6=_0xb213e6?_0x5acf('0x4a'):'';return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x4b'),_0x17e9ad,_0xdc43bc,_0x3fd927,_0x15e0cf,_0xb213e6,_0xc6c804));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4c')]=function(_0x679e76,_0x52ee91){_0x52ee91=_0x52ee91||'';return this[_0x5acf('0x25')](util[_0x5acf('0x2a')](_0x5acf('0x4d'),_0x679e76,_0x52ee91));};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4e')]=function(_0x2e2062){return this[_0x5acf('0x2f')]('AGI',_0x2e2062);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x4f')]=function(_0x2e028f){return this['exec'](_0x5acf('0x50'),_0x2e028f);};AGIChannel[_0x5acf('0x24')][_0x5acf('0x19')]=function(_0x5c0329,_0x48d303){this[_0x5acf('0x2c')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5c0329['id'],_0x5c0329[_0x5acf('0x51')],_0x48d303));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5acf('0x52')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f2b3f5d..7a94b91 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 _0xac8d=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x4e6225,_0x531810){var _0x3464db=function(_0x15f7d2){while(--_0x15f7d2){_0x4e6225['push'](_0x4e6225['shift']());}};_0x3464db(++_0x531810);}(_0xac8d,0xa4));var _0xdac8=function(_0x4dbbbe,_0x4bfb8d){_0x4dbbbe=_0x4dbbbe-0x0;var _0x264093=_0xac8d[_0x4dbbbe];return _0x264093;};'use strict';var util=require(_0xdac8('0x0'));var error={'E_AGI_UNDEFINED':_0xdac8('0x1'),'E_AGI_ARGUMENT_PORT':_0xdac8('0x2'),'E_AGI_SERVER_ERROR':_0xdac8('0x3'),'E_AGI_SERVER_CLOSE':_0xdac8('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xdac8('0x5'),'E_AGI_SOCKET_ERROR':_0xdac8('0x6'),'E_AGI_SOCKET_CLOSE':_0xdac8('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xdac8('0x8'),'E_AGI_COMMAND_EMPTY':_0xdac8('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xdac8('0xa')};function AGIError(_0x30a376){var _0x30a376=_0x30a376||null,_0x853eeb=_0x853eeb||[],_0xa74c3f=0x1,_0xa4494b='';if(!error[_0x30a376]){_0x30a376=_0xdac8('0xb');}_0x853eeb[_0xdac8('0xc')](error[_0x30a376]);while(arguments[_0xa74c3f]){_0x853eeb['push'](arguments[_0xa74c3f]);_0xa74c3f++;}_0xa4494b=util['format'][_0xdac8('0xd')](util,_0x853eeb);this[_0xdac8('0xe')]=_0xa4494b;this[_0xdac8('0xf')]=_0x30a376;}module[_0xdac8('0x10')]=AGIError; \ No newline at end of file +var _0x2874=['name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','apply','message'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x2874,0x8e));var _0x4287=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x2874[_0x2605dc];return _0x4568c9;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x4287('0x0'),'E_AGI_ARGUMENT_PORT':_0x4287('0x1'),'E_AGI_SERVER_ERROR':_0x4287('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x4287('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4287('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x4287('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x4287('0x6'),'E_AGI_COMMAND_EMPTY':_0x4287('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x656395){var _0x656395=_0x656395||null,_0x331119=_0x331119||[],_0x1cdea7=0x1,_0x1a988f='';if(!error[_0x656395]){_0x656395=_0x4287('0x8');}_0x331119[_0x4287('0x9')](error[_0x656395]);while(arguments[_0x1cdea7]){_0x331119['push'](arguments[_0x1cdea7]);_0x1cdea7++;}_0x1a988f=util['format'][_0x4287('0xa')](util,_0x331119);this[_0x4287('0xb')]=_0x1a988f;this[_0x4287('0xc')]=_0x656395;}module[_0x4287('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c68fc14..390c33a 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 _0x0419=['vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','agi','menu','getdigits','getsecretdigits','vertices','prototype','addVertex','addEdge','edges','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','agicommand'];(function(_0xdb1285,_0xffc500){var _0x4b2a36=function(_0x12746f){while(--_0x12746f){_0xdb1285['push'](_0xdb1285['shift']());}};_0x4b2a36(++_0xffc500);}(_0x0419,0x153));var _0x9041=function(_0xab100c,_0x9dd251){_0xab100c=_0xab100c-0x0;var _0x883ed9=_0x0419[_0xab100c];return _0x883ed9;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x9041('0x0'));var verticesWithRetry=[_0x9041('0x1'),_0x9041('0x2'),_0x9041('0x3')];var Graph=function(){this[_0x9041('0x4')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x9041('0x5')][_0x9041('0x6')]=function(_0xa8686b){this[_0x9041('0x4')][_0xa8686b['id']]=_0xa8686b;this['edges'][_0xa8686b['id']]=[];};Graph[_0x9041('0x5')][_0x9041('0x7')]=function(_0x5457be,_0x48ac45,_0x39296c){this[_0x9041('0x8')][_0x5457be][_0x9041('0x9')]({'target':_0x48ac45,'condition':_0x39296c});this['numberOfEdges']+=0x1;};Graph[_0x9041('0x5')]['size']=function(){return _[_0x9041('0xa')](this[_0x9041('0x4')]);};Graph[_0x9041('0x5')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x9041('0x5')][_0x9041('0xb')]=function(_0x515475){return this['vertices'][_0x515475];};Graph[_0x9041('0x5')][_0x9041('0xc')]=function(_0x2874c4,_0x3eede8){if(!this[_0x9041('0x4')][_0x2874c4]){return logger[_0x9041('0xd')](_0x9041('0xe'));}var _0x23a86c=_0x3eede8(this[_0x9041('0x4')][_0x2874c4]);if(!_0x23a86c){return logger[_0x9041('0xd')](_0x9041('0xf'));}if(this['edges'][_0x2874c4]['length']===0x0){return logger['info'](_0x9041('0x10'));}for(var _0x3d2b64=0x0,_0x8dde9c=[],_0x54c323=![];_0x3d2b64\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','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','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x517971,_0x51f9c7){var _0x427bf2=function(_0x2a0db1){while(--_0x2a0db1){_0x517971['push'](_0x517971['shift']());}};_0x427bf2(++_0x51f9c7);}(_0x810a,0x10b));var _0xa810=function(_0x113276,_0x2df064){_0x113276=_0x113276-0x0;var _0x20f7ae=_0x810a[_0x113276];return _0x20f7ae;};'use strict';var parser=require('xml2json');var _=require(_0xa810('0x0'));var syncho=require(_0xa810('0x1'));var util=require(_0xa810('0x2'));var moment=require(_0xa810('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa810('0x4'));var utilLicense=require(_0xa810('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xa810('0x6'));var Graph=require(_0xa810('0x7'));var Vertices=require(_0xa810('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xa810('0x9')](config['agi'],{'ip':_0xa810('0xa'),'port':0x11dd});function connectionHandler(_0x5e4728){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5e4728);agiHandler(_0x5e4728);}catch(_0x5a4d6f){logger[_0xa810('0xb')](_0x5a4d6f[_0xa810('0xc')]);}});});}function listeningHandler(){console['log'](_0xa810('0xd'),config['agi'][_0xa810('0xe')]);logger[_0xa810('0xf')](util[_0xa810('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa810('0x4')]['ip'],config[_0xa810('0x4')][_0xa810('0xe')]));}function errorHandler(_0x1e074a){if(_0x1e074a&&_0x1e074a[_0xa810('0x11')]&&_0x1e074a[_0xa810('0x12')]){logger[_0xa810('0xb')](util['format'](_0xa810('0x13'),_0x1e074a[_0xa810('0x11')],_0x1e074a[_0xa810('0x12')]));}else{logger[_0xa810('0xb')](util[_0xa810('0x10')](_0xa810('0x14'),_0x1e074a['stack']));}}function closeHandler(){logger[_0xa810('0xf')](util[_0xa810('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xa810('0x15')],this['callerid'],this[_0xa810('0x16')],this[_0xa810('0x17')]));try{createSquareReport(this);}catch(_0x541cda){logger['error'](_0x541cda[_0xa810('0xc')]);}}function timeoutHandler(){logger[_0xa810('0xf')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa810('0x18')],this[_0xa810('0x15')],this[_0xa810('0x19')],this[_0xa810('0x16')],this[_0xa810('0x17')]));}function hangupHandler(){logger['info'](util[_0xa810('0x10')](_0xa810('0x1a'),this[_0xa810('0x18')],this[_0xa810('0x15')],this[_0xa810('0x19')],this['dnid'],this[_0xa810('0x17')]));this[_0xa810('0x1b')]=!![];}function getRoot(_0x277578){return parser[_0xa810('0x1c')](_0x277578,{'object':!![]})[_0xa810('0x1d')]['root'];}function addVertex(_0x3e21ff,_0x3a513c,_0x42dc6e){_0x3a513c[_0xa810('0x1e')]=_0x42dc6e;if(_0x3a513c[_0xa810('0x1f')](_0xa810('0x20'))){_0x3a513c[_0xa810('0x21')]=parseInt(_0x3a513c[_0xa810('0x20')],0xa);}_0x3e21ff[_0xa810('0x22')](_['omit'](_0x3a513c,_0xa810('0x23')));}function initGraph(_0x5843f8,_0x2e899f){var _0x11ab68=new Graph();for(var _0x3417c3 in _0x5843f8){if(_0x5843f8[_0xa810('0x1f')](_0x3417c3)){if(_[_0xa810('0x24')](_0x5843f8[_0x3417c3])){for(var _0x12da98=0x0;_0x12da98<_0x5843f8[_0x3417c3][_0xa810('0x25')];_0x12da98+=0x1){addVertex(_0x11ab68,_0x5843f8[_0x3417c3][_0x12da98],_0x3417c3);}}else{addVertex(_0x11ab68,_0x5843f8[_0x3417c3],_0x3417c3);}}}for(var _0x33accd=0x0;_0x33accd<_0x2e899f[_0xa810('0x25')];_0x33accd+=0x1){if(_0x2e899f[_0x33accd][_0xa810('0x26')]&&_0x2e899f[_0x33accd][_0xa810('0x27')]){_0x11ab68[_0xa810('0x28')](_0x2e899f[_0x33accd][_0xa810('0x26')],_0x2e899f[_0x33accd][_0xa810('0x27')],_0x2e899f[_0x33accd][_0xa810('0x29')]);}}return _0x11ab68;}function getSquareProject(_0xe97e44,_0x51b80f){rpc[_0xa810('0x2a')](_0xe97e44)['then'](function(_0x2d8169){_0x51b80f(null,_0x2d8169);})[_0xa810('0x2b')](function(_0x21e7c7){_0x51b80f(null,_0x21e7c7);});}function createSquareReport(_0x5186c4,_0x3e2e2f){rpc[_0xa810('0x2c')](_0x5186c4)[_0xa810('0x2d')](function(_0x2e0f12){if(_0x3e2e2f){_0x3e2e2f(null,_0x2e0f12);}})['catch'](function(_0x566af9){if(_0x3e2e2f){_0x3e2e2f(null,_0x566af9);}});}function setChannelVariables(_0x3f46a5){for(var _0x1419ed in _0x3f46a5){if(_0x3f46a5[_0xa810('0x1f')](_0x1419ed)){if(_0x1419ed[_0xa810('0x2e')](_0xa810('0x2f'))===0x0){_0x3f46a5[_0x1419ed[_0xa810('0x30')](0x4)]=_0x3f46a5[_0x1419ed];delete _0x3f46a5[_0x1419ed];}}}}function getLogFromObject(_0x230f2b){return util['inspect'](_0x230f2b,{'showHidden':![],'depth':null});}function agiHandler(_0x2836b3){var _0x20e51c,_0x4736c8,_0x42ab64,_0x1acb17,_0x4ef738;logger[_0xa810('0x31')](_0xa810('0x32'),JSON[_0xa810('0x33')](_0x2836b3,null,0x2));logger[_0xa810('0xf')](util[_0xa810('0x10')](_0xa810('0x34'),_0x2836b3[_0xa810('0x18')],_0x2836b3[_0xa810('0x15')],_0x2836b3[_0xa810('0x19')],_0x2836b3[_0xa810('0x16')],_0x2836b3[_0xa810('0x17')]));_0x2836b3['on'](_0xa810('0xb'),errorHandler);_0x2836b3['on'](_0xa810('0x35'),closeHandler);_0x2836b3['on'](_0xa810('0x36'),timeoutHandler);_0x2836b3[_0xa810('0x1b')]=![];_0x2836b3['on']('hangup',hangupHandler);var _0x493409=getSquareProject[_0xa810('0x37')](null,_0x2836b3['arg_1']);if(_0x493409){if(_0x493409['production']){_0x20e51c=getRoot(_0x493409[_0xa810('0x38')]);if(_0x20e51c&&_0x20e51c[_0xa810('0x39')]){logger['debug']('root',JSON[_0xa810('0x33')](_0x20e51c,null,0x2));_0x2836b3[_0xa810('0x3a')]=moment()[_0xa810('0x10')](_0xa810('0x3b'));_0x4736c8=initGraph(_['omit'](_0x20e51c,'mxCell'),_0x20e51c['mxCell']);_0x42ab64=new Vertices(_0x2836b3,rpc,mailRpc);logger[_0xa810('0xf')](util[_0xa810('0x10')](_0xa810('0x3c'),_0x2836b3[_0xa810('0x18')],_0x2836b3['calleridname'],_0x2836b3[_0xa810('0x19')],_0x2836b3['dnid'],_0x2836b3['uniqueid']));_0x4736c8[_0xa810('0x3d')](_0x20e51c[_0xa810('0x39')]['id'],function(_0x65679e){try{_0x65679e=_0x42ab64['clear'](_0x65679e);logger['debug']('vertex',JSON[_0xa810('0x33')](_0x65679e,null,0x2));if(_0x65679e[_0xa810('0x1e')]===_0xa810('0x3e')){logger['info'](_0xa810('0x3f'));_0x2836b3['context']=_0x65679e[_0xa810('0x40')]||_0x2836b3[_0xa810('0x40')];_0x2836b3[_0xa810('0x41')]=_0x65679e[_0xa810('0x41')];_0x2836b3[_0xa810('0x42')]=_0x65679e[_0xa810('0x42')]?_0x65679e[_0xa810('0x42')]-0x1:0x1;return null;}else if(_0x65679e&&_0x42ab64[_0x65679e['agicommand']]){_0x4ef738=_0x42ab64[_0x65679e[_0xa810('0x1e')]](_0x65679e);logger[_0xa810('0xf')](_0xa810('0x43'),JSON[_0xa810('0x33')](_0x4ef738,null,0x2));if(_0x4ef738&&_0x4ef738[_0xa810('0x44')]===AGI_CODE_SUCCESS&&_0x4ef738[_0xa810('0x45')]!==AGI_RESULT_ERROR&&!_0x2836b3[_0xa810('0x1b')]){logger['debug'](_0xa810('0x43'),getLogFromObject(_0x4ef738));return _[_0xa810('0x46')](_0x4ef738[_0xa810('0x45')])?null:_0x4ef738[_0xa810('0x45')][_0xa810('0x47')]();}else{logger[_0xa810('0xb')](_0xa810('0x43'),getLogFromObject(_0x4ef738));return null;}}else{logger[_0xa810('0xb')](_0xa810('0x48'));return null;}}catch(_0x253f01){logger[_0xa810('0xb')](_0x253f01['stack']);return null;}});if(_0x20e51c[_0xa810('0x49')]){logger['info'](util['format'](_0xa810('0x4a'),_0x2836b3[_0xa810('0x18')],_0x2836b3['calleridname'],_0x2836b3[_0xa810('0x19')],_0x2836b3[_0xa810('0x16')],_0x2836b3[_0xa810('0x17')]));_0x4736c8['traverseBFS'](_0x20e51c[_0xa810('0x49')]['id'],function(_0x5047ac){try{_0x5047ac=_0x42ab64['clear'](_0x5047ac);logger[_0xa810('0x31')](_0xa810('0x4b'),JSON[_0xa810('0x33')](_0x5047ac,null,0x2));if(_0x5047ac&&_0x42ab64[_0x5047ac[_0xa810('0x1e')]]){_0x4ef738=_0x42ab64[_0x5047ac[_0xa810('0x1e')]](_0x5047ac);if(_0x4ef738){logger[_0xa810('0x31')](_0xa810('0x43'),getLogFromObject(_0x4ef738));return _['isUndefined'](_0x4ef738[_0xa810('0x45')])?null:_0x4ef738[_0xa810('0x45')]['toString']();}else{logger[_0xa810('0xb')](_0xa810('0x43'),getLogFromObject(_0x4ef738));return null;}}else{logger[_0xa810('0xb')](_0xa810('0x48'));return null;}}catch(_0x59c28b){logger['error'](_0x59c28b[_0xa810('0xc')]);return null;}});}logger[_0xa810('0xf')](util[_0xa810('0x10')](_0xa810('0x4c'),_0x2836b3[_0xa810('0x18')],_0x2836b3[_0xa810('0x15')],_0x2836b3[_0xa810('0x19')],_0x2836b3[_0xa810('0x16')],_0x2836b3[_0xa810('0x17')]));logger[_0xa810('0xf')](util[_0xa810('0x10')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2836b3[_0xa810('0x40')],_0x2836b3[_0xa810('0x41')],parseInt(_0x2836b3[_0xa810('0x42')],0xa)+0x1));_0x2836b3[_0xa810('0x4d')](_0x2836b3[_0xa810('0x40')],_0x2836b3[_0xa810('0x41')],parseInt(_0x2836b3[_0xa810('0x42')],0xa)+0x1);_0x2836b3[_0xa810('0x35')]();}}else{logger[_0xa810('0xb')](util[_0xa810('0x10')](_0xa810('0x4e'),_0x2836b3['arg_1']));_0x2836b3[_0xa810('0x4d')](_0x2836b3[_0xa810('0x40')],_0x2836b3[_0xa810('0x41')],parseInt(_0x2836b3['priority'],0xa)+0x1);_0x2836b3['close']();}}else{logger[_0xa810('0xb')](util['format']('Project\x20%s\x20not\x20found',_0x2836b3['arg_1']));_0x2836b3[_0xa810('0x4d')](_0x2836b3[_0xa810('0x40')],_0x2836b3['extension'],parseInt(_0x2836b3[_0xa810('0x42')],0xa)+0x1);_0x2836b3[_0xa810('0x35')]();}}function main(){var _0x38748e;return utilLicense[_0xa810('0x4f')]()['then'](function(_0x41a052){if(_0x41a052){if(_0x41a052[_0xa810('0x50')]){if(_0x41a052[_0xa810('0x51')]&&_0x41a052[_0xa810('0x51')]>0x0){logger[_0xa810('0xf')](util[_0xa810('0x10')](_0xa810('0x52'),_0x41a052[_0xa810('0x51')]));_0x38748e=_0x41a052[_0xa810('0x51')];}else{logger['info'](_0xa810('0x53'));}}else{logger[_0xa810('0xf')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x38748e=-0x1;}}})[_0xa810('0x2b')](function(_0x384fa4){logger[_0xa810('0xb')](_0xa810('0x54'),_0x384fa4[_0xa810('0xc')]);})[_0xa810('0x49')](function(){var _0x7bb88e=require(_0xa810('0x55'))(config[_0xa810('0x4')][_0xa810('0xe')],config['agi']['ip'],_0x38748e);_0x7bb88e['on'](_0xa810('0xb'),errorHandler);_0x7bb88e['on']('listening',listeningHandler);_0x7bb88e['on']('connection',connectionHandler);_0x7bb88e['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x7e35=['isUndefined','result','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','port','listening','connection','xml2json','lodash','syncho','util','moment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','error','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','debug','variables','stringify','hangup','sync','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7e35,0x11c));var _0x57e3=function(_0x4badb7,_0x42e3aa){_0x4badb7=_0x4badb7-0x0;var _0x2aef47=_0x7e35[_0x4badb7];return _0x2aef47;};'use strict';var parser=require(_0x57e3('0x0'));var _=require(_0x57e3('0x1'));var syncho=require(_0x57e3('0x2'));var util=require(_0x57e3('0x3'));var moment=require(_0x57e3('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x57e3('0x5'));var utilLicense=require(_0x57e3('0x6'));var rpc=require(_0x57e3('0x7'));var mailRpc=require(_0x57e3('0x8'));var Graph=require(_0x57e3('0x9'));var Vertices=require(_0x57e3('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x57e3('0x5')]=_[_0x57e3('0xb')](config[_0x57e3('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x1badc8){process[_0x57e3('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1badc8);agiHandler(_0x1badc8);}catch(_0x1b11a9){logger['error'](_0x1b11a9['stack']);}});});}function listeningHandler(){console['log'](_0x57e3('0xd'),config[_0x57e3('0x5')]['port']);logger['info'](util[_0x57e3('0xe')](_0x57e3('0xf'),config[_0x57e3('0x5')]['ip'],config[_0x57e3('0x5')]['port']));}function errorHandler(_0x32a821){if(_0x32a821&&_0x32a821[_0x57e3('0x10')]&&_0x32a821['message']){logger[_0x57e3('0x11')](util[_0x57e3('0xe')]('[%s]\x20%s',_0x32a821[_0x57e3('0x10')],_0x32a821['message']));}else{logger['error'](util[_0x57e3('0xe')]('[ERROR]\x20%s',_0x32a821[_0x57e3('0x12')]));}}function closeHandler(){logger[_0x57e3('0x13')](util['format'](_0x57e3('0x14'),this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this[_0x57e3('0x19')]));try{createSquareReport(this);}catch(_0x27cd01){logger[_0x57e3('0x11')](_0x27cd01[_0x57e3('0x12')]);}}function timeoutHandler(){logger[_0x57e3('0x13')](util[_0x57e3('0xe')](_0x57e3('0x1a'),this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this[_0x57e3('0x19')]));}function hangupHandler(){logger[_0x57e3('0x13')](util[_0x57e3('0xe')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x57e3('0x15')],this[_0x57e3('0x16')],this[_0x57e3('0x17')],this[_0x57e3('0x18')],this['uniqueid']));this[_0x57e3('0x1b')]=!![];}function getRoot(_0x45d2f7){return parser['toJson'](_0x45d2f7,{'object':!![]})[_0x57e3('0x1c')]['root'];}function addVertex(_0x1c0175,_0x12d1ef,_0x4e200f){_0x12d1ef[_0x57e3('0x1d')]=_0x4e200f;if(_0x12d1ef['hasOwnProperty'](_0x57e3('0x1e'))){_0x12d1ef[_0x57e3('0x1f')]=parseInt(_0x12d1ef['retry'],0xa);}_0x1c0175[_0x57e3('0x20')](_[_0x57e3('0x21')](_0x12d1ef,_0x57e3('0x22')));}function initGraph(_0x230710,_0x1bd2a6){var _0x150868=new Graph();for(var _0x395167 in _0x230710){if(_0x230710[_0x57e3('0x23')](_0x395167)){if(_[_0x57e3('0x24')](_0x230710[_0x395167])){for(var _0x39b50e=0x0;_0x39b50e<_0x230710[_0x395167][_0x57e3('0x25')];_0x39b50e+=0x1){addVertex(_0x150868,_0x230710[_0x395167][_0x39b50e],_0x395167);}}else{addVertex(_0x150868,_0x230710[_0x395167],_0x395167);}}}for(var _0x4df245=0x0;_0x4df245<_0x1bd2a6['length'];_0x4df245+=0x1){if(_0x1bd2a6[_0x4df245][_0x57e3('0x26')]&&_0x1bd2a6[_0x4df245][_0x57e3('0x27')]){_0x150868[_0x57e3('0x28')](_0x1bd2a6[_0x4df245]['source'],_0x1bd2a6[_0x4df245][_0x57e3('0x27')],_0x1bd2a6[_0x4df245]['value']);}}return _0x150868;}function getSquareProject(_0x1b53a3,_0x2201f1){rpc[_0x57e3('0x29')](_0x1b53a3)[_0x57e3('0x2a')](function(_0x46d5bf){_0x2201f1(null,_0x46d5bf);})['catch'](function(_0x3d1fcf){_0x2201f1(null,_0x3d1fcf);});}function createSquareReport(_0x5e6d5b,_0x29f58f){rpc[_0x57e3('0x2b')](_0x5e6d5b)[_0x57e3('0x2a')](function(_0x143826){if(_0x29f58f){_0x29f58f(null,_0x143826);}})[_0x57e3('0x2c')](function(_0x1571fa){if(_0x29f58f){_0x29f58f(null,_0x1571fa);}});}function setChannelVariables(_0xe59ca1){for(var _0x3a4095 in _0xe59ca1){if(_0xe59ca1[_0x57e3('0x23')](_0x3a4095)){if(_0x3a4095[_0x57e3('0x2d')](_0x57e3('0x2e'))===0x0){_0xe59ca1[_0x3a4095[_0x57e3('0x2f')](0x4)]=_0xe59ca1[_0x3a4095];delete _0xe59ca1[_0x3a4095];}}}}function getLogFromObject(_0x916dbf){return util[_0x57e3('0x30')](_0x916dbf,{'showHidden':![],'depth':null});}function agiHandler(_0x319f1f){var _0x29ca04,_0xc6746b,_0x174c79,_0x496f12,_0x52d6dc;logger[_0x57e3('0x31')](_0x57e3('0x32'),JSON[_0x57e3('0x33')](_0x319f1f,null,0x2));logger['info'](util[_0x57e3('0xe')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));_0x319f1f['on'](_0x57e3('0x11'),errorHandler);_0x319f1f['on']('close',closeHandler);_0x319f1f['on']('timeout',timeoutHandler);_0x319f1f[_0x57e3('0x1b')]=![];_0x319f1f['on'](_0x57e3('0x34'),hangupHandler);var _0x109bdc=getSquareProject[_0x57e3('0x35')](null,_0x319f1f['arg_1']);if(_0x109bdc){if(_0x109bdc['production']){_0x29ca04=getRoot(_0x109bdc['production']);if(_0x29ca04&&_0x29ca04[_0x57e3('0x36')]){logger[_0x57e3('0x31')](_0x57e3('0x37'),JSON[_0x57e3('0x33')](_0x29ca04,null,0x2));_0x319f1f[_0x57e3('0x38')]=moment()[_0x57e3('0xe')](_0x57e3('0x39'));_0xc6746b=initGraph(_['omit'](_0x29ca04,_0x57e3('0x22')),_0x29ca04[_0x57e3('0x22')]);_0x174c79=new Vertices(_0x319f1f,rpc,mailRpc);logger[_0x57e3('0x13')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f['dnid'],_0x319f1f[_0x57e3('0x19')]));_0xc6746b[_0x57e3('0x3a')](_0x29ca04[_0x57e3('0x36')]['id'],function(_0x40bee5){try{_0x40bee5=_0x174c79[_0x57e3('0x3b')](_0x40bee5);logger[_0x57e3('0x31')](_0x57e3('0x3c'),JSON['stringify'](_0x40bee5,null,0x2));if(_0x40bee5[_0x57e3('0x1d')]===_0x57e3('0x3d')){logger[_0x57e3('0x13')](_0x57e3('0x3e'));_0x319f1f[_0x57e3('0x3f')]=_0x40bee5['context']||_0x319f1f[_0x57e3('0x3f')];_0x319f1f[_0x57e3('0x40')]=_0x40bee5['extension'];_0x319f1f[_0x57e3('0x41')]=_0x40bee5[_0x57e3('0x41')]?_0x40bee5[_0x57e3('0x41')]-0x1:0x1;return null;}else if(_0x40bee5&&_0x174c79[_0x40bee5[_0x57e3('0x1d')]]){_0x52d6dc=_0x174c79[_0x40bee5[_0x57e3('0x1d')]](_0x40bee5);logger[_0x57e3('0x13')](_0x57e3('0x42'),JSON['stringify'](_0x52d6dc,null,0x2));if(_0x52d6dc&&_0x52d6dc[_0x57e3('0x43')]===AGI_CODE_SUCCESS&&_0x52d6dc['result']!==AGI_RESULT_ERROR&&!_0x319f1f[_0x57e3('0x1b')]){logger[_0x57e3('0x31')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return _[_0x57e3('0x44')](_0x52d6dc[_0x57e3('0x45')])?null:_0x52d6dc[_0x57e3('0x45')]['toString']();}else{logger[_0x57e3('0x11')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return null;}}else{logger[_0x57e3('0x11')](_0x57e3('0x46'));return null;}}catch(_0x145d8d){logger['error'](_0x145d8d[_0x57e3('0x12')]);return null;}});if(_0x29ca04[_0x57e3('0x47')]){logger[_0x57e3('0x13')](util[_0x57e3('0xe')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));_0xc6746b['traverseBFS'](_0x29ca04[_0x57e3('0x47')]['id'],function(_0x378d8d){try{_0x378d8d=_0x174c79[_0x57e3('0x3b')](_0x378d8d);logger[_0x57e3('0x31')](_0x57e3('0x3c'),JSON['stringify'](_0x378d8d,null,0x2));if(_0x378d8d&&_0x174c79[_0x378d8d[_0x57e3('0x1d')]]){_0x52d6dc=_0x174c79[_0x378d8d[_0x57e3('0x1d')]](_0x378d8d);if(_0x52d6dc){logger[_0x57e3('0x31')](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return _['isUndefined'](_0x52d6dc[_0x57e3('0x45')])?null:_0x52d6dc[_0x57e3('0x45')]['toString']();}else{logger['error'](_0x57e3('0x42'),getLogFromObject(_0x52d6dc));return null;}}else{logger['error'](_0x57e3('0x46'));return null;}}catch(_0x3c651a){logger['error'](_0x3c651a['stack']);return null;}});}logger[_0x57e3('0x13')](util[_0x57e3('0xe')](_0x57e3('0x48'),_0x319f1f[_0x57e3('0x15')],_0x319f1f[_0x57e3('0x16')],_0x319f1f[_0x57e3('0x17')],_0x319f1f[_0x57e3('0x18')],_0x319f1f[_0x57e3('0x19')]));logger[_0x57e3('0x13')](util['format'](_0x57e3('0x49'),_0x319f1f[_0x57e3('0x3f')],_0x319f1f['extension'],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1));_0x319f1f[_0x57e3('0x4a')](_0x319f1f[_0x57e3('0x3f')],_0x319f1f['extension'],parseInt(_0x319f1f['priority'],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}else{logger[_0x57e3('0x11')](util[_0x57e3('0xe')](_0x57e3('0x4c'),_0x319f1f[_0x57e3('0x15')]));_0x319f1f['continueAt'](_0x319f1f[_0x57e3('0x3f')],_0x319f1f[_0x57e3('0x40')],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}else{logger['error'](util[_0x57e3('0xe')](_0x57e3('0x4d'),_0x319f1f[_0x57e3('0x15')]));_0x319f1f[_0x57e3('0x4a')](_0x319f1f[_0x57e3('0x3f')],_0x319f1f[_0x57e3('0x40')],parseInt(_0x319f1f[_0x57e3('0x41')],0xa)+0x1);_0x319f1f[_0x57e3('0x4b')]();}}function main(){var _0x33ce45;return utilLicense[_0x57e3('0x4e')]()[_0x57e3('0x2a')](function(_0x448ebf){if(_0x448ebf){if(_0x448ebf[_0x57e3('0x4f')]){if(_0x448ebf['callysquare']&&_0x448ebf[_0x57e3('0x50')]>0x0){logger[_0x57e3('0x13')](util['format'](_0x57e3('0x51'),_0x448ebf[_0x57e3('0x50')]));_0x33ce45=_0x448ebf['callysquare'];}else{logger[_0x57e3('0x13')](_0x57e3('0x52'));}}else{logger['info'](_0x57e3('0x53'));_0x33ce45=-0x1;}}})[_0x57e3('0x2c')](function(_0x3578a5){logger[_0x57e3('0x11')](_0x57e3('0x54'),_0x3578a5[_0x57e3('0x12')]);})[_0x57e3('0x47')](function(){var _0x5a6fa1=require('./server')(config['agi'][_0x57e3('0x55')],config[_0x57e3('0x5')]['ip'],_0x33ce45);_0x5a6fa1['on'](_0x57e3('0x11'),errorHandler);_0x5a6fa1['on'](_0x57e3('0x56'),listeningHandler);_0x5a6fa1['on'](_0x57e3('0x57'),connectionHandler);_0x5a6fa1['on'](_0x57e3('0x4b'),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 1e4f842..49afb16 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 _0xe255=['then','error','result','sendMailMessage','SendMail','bluebird','client','http','request'];(function(_0x50c58f,_0x274887){var _0x21435c=function(_0x3867d6){while(--_0x3867d6){_0x50c58f['push'](_0x50c58f['shift']());}};_0x21435c(++_0x274887);}(_0xe255,0x176));var _0x5e25=function(_0x1d5691,_0x6042b5){_0x1d5691=_0x1d5691-0x0;var _0x579db8=_0xe255[_0x1d5691];return _0x579db8;};'use strict';var BPromise=require(_0x5e25('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5e25('0x1')][_0x5e25('0x2')]({'port':0x232b});function request(_0x2f91a9,_0xceed16){return new BPromise(function(_0x1c58b5,_0x426525){return client[_0x5e25('0x3')](_0x2f91a9,_0xceed16)[_0x5e25('0x4')](function(_0x16b2dd){if(_0x16b2dd['error']){return _0x426525(_0x16b2dd[_0x5e25('0x5')]['message']);}else{return _0x1c58b5(_0x16b2dd[_0x5e25('0x6')]);}})['catch'](function(_0x358332){return _0x426525(_0x358332);});});}exports[_0x5e25('0x7')]=function(_0x1e93e6,_0x2326b){return request(_0x5e25('0x8'),{'account':_0x1e93e6,'message':_0x2326b});}; \ No newline at end of file +var _0xfb55=['result','catch','sendMailMessage','SendMail','http','request','error'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xfb55,0x131));var _0x5fb5=function(_0x56f70a,_0x3dc66b){_0x56f70a=_0x56f70a-0x0;var _0xf3ec0e=_0xfb55[_0x56f70a];return _0xf3ec0e;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x5fb5('0x0')]({'port':0x232b});function request(_0x5c91e1,_0x5d4f69){return new BPromise(function(_0x3556cf,_0x134dd5){return client[_0x5fb5('0x1')](_0x5c91e1,_0x5d4f69)['then'](function(_0x54478d){if(_0x54478d[_0x5fb5('0x2')]){return _0x134dd5(_0x54478d[_0x5fb5('0x2')]['message']);}else{return _0x3556cf(_0x54478d[_0x5fb5('0x3')]);}})[_0x5fb5('0x4')](function(_0x591fc1){return _0x134dd5(_0x591fc1);});});}exports[_0x5fb5('0x5')]=function(_0x3e2d82,_0x8e9abe){return request(_0x5fb5('0x6'),{'account':_0x3e2d82,'message':_0x8e9abe});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 652aae9..4632b86 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 _0xf4eb=['\x0d\x0a\x0d\x0a','toString','_inBody','substring','split','indexOf','slice','trim','headers','emit','line','util','_localBuffer','prototype','_transform'];(function(_0x11a069,_0x4d8d83){var _0x3c741e=function(_0x3552fa){while(--_0x3552fa){_0x11a069['push'](_0x11a069['shift']());}};_0x3c741e(++_0x4d8d83);}(_0xf4eb,0xec));var _0xbf4e=function(_0x348e64,_0x47aa9a){_0x348e64=_0x348e64-0x0;var _0x3dd47f=_0xf4eb[_0x348e64];return _0x3dd47f;};'use strict';var util=require(_0xbf4e('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x479210){Transform['call'](this,_0x479210);this[_0xbf4e('0x1')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xbf4e('0x2')][_0xbf4e('0x3')]=function(_0x32d1d7,_0x18c665,_0xa4dcf5){var _0x2fcfed='\x0a',_0x15b99f=['\x0a\x0a',_0xbf4e('0x4')],_0x540736=-0x1,_0x449d55=-0x1,_0x5013c2='',_0x5e23d4=0x0,_0xa4280c='',_0x3761c1='';this[_0xbf4e('0x1')]+=_0x32d1d7[_0xbf4e('0x5')]();_0xa4280c=this[_0xbf4e('0x1')];if(!this[_0xbf4e('0x6')]){_0x5e23d4=0x0;while(_0x15b99f[_0x5e23d4]){while((_0x449d55=_0xa4280c['indexOf'](_0x15b99f[_0x5e23d4]))!=-0x1){_0x5013c2=_0x15b99f[_0x5e23d4];_0x3761c1=_0xa4280c['substring'](0x0,_0x449d55);_0xa4280c=_0xa4280c[_0xbf4e('0x7')](_0x449d55+_0x5013c2['length']);var _0x448788=_0x3761c1[_0xbf4e('0x8')](_0x2fcfed),_0xcf6ba8=0x0,_0x54a96e={},_0x17fd01='',_0x5a3035='',_0x56d185=-0x1;while(_0x448788[_0xcf6ba8]){_0x56d185=_0x448788[_0xcf6ba8][_0xbf4e('0x9')](':');if(_0x56d185!=-0x1){_0x17fd01=_0x448788[_0xcf6ba8][_0xbf4e('0xa')](0x0,_0x56d185)[_0xbf4e('0xb')]();_0x5a3035=_0x448788[_0xcf6ba8][_0xbf4e('0xa')](_0x56d185+0x1)[_0xbf4e('0xb')]();if(_0x17fd01['length']>0x0){_0x54a96e[_0x17fd01]=_0x5a3035;}}else{}_0xcf6ba8++;}this['emit'](_0xbf4e('0xc'),_0x54a96e);this[_0xbf4e('0x6')]=!![];}_0x5e23d4++;}this[_0xbf4e('0x1')]=_0xa4280c;}else{while((_0x540736=_0xa4280c['indexOf'](_0x2fcfed))!=-0x1){_0x3761c1=_0xa4280c[_0xbf4e('0x7')](0x0,_0x540736);this[_0xbf4e('0xd')](_0xbf4e('0xe'),_0x3761c1);_0xa4280c=_0xa4280c[_0xbf4e('0x7')](_0x540736+_0x2fcfed['length']);}this[_0xbf4e('0x1')]=_0xa4280c;}_0xa4dcf5();};module['exports']=AGIReply; \ No newline at end of file +var _0x61ce=['exports','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','line'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x61ce,0xeb));var _0xe61c=function(_0x51c25d,_0x4a1994){_0x51c25d=_0x51c25d-0x0;var _0x279002=_0x61ce[_0x51c25d];return _0x279002;};'use strict';var util=require('util');var Transform=require(_0xe61c('0x0'))[_0xe61c('0x1')];function AGIReply(_0x5ed46f){Transform['call'](this,_0x5ed46f);this[_0xe61c('0x2')]='';this[_0xe61c('0x3')]=![];}util[_0xe61c('0x4')](AGIReply,Transform);AGIReply[_0xe61c('0x5')][_0xe61c('0x6')]=function(_0x1fc5f9,_0x18488d,_0x2b93cc){var _0x1f2797='\x0a',_0x547ad7=['\x0a\x0a',_0xe61c('0x7')],_0x3c77ca=-0x1,_0xca2144=-0x1,_0x3c4af4='',_0x15b204=0x0,_0x27b17c='',_0x5e80ae='';this[_0xe61c('0x2')]+=_0x1fc5f9[_0xe61c('0x8')]();_0x27b17c=this[_0xe61c('0x2')];if(!this[_0xe61c('0x3')]){_0x15b204=0x0;while(_0x547ad7[_0x15b204]){while((_0xca2144=_0x27b17c[_0xe61c('0x9')](_0x547ad7[_0x15b204]))!=-0x1){_0x3c4af4=_0x547ad7[_0x15b204];_0x5e80ae=_0x27b17c['substring'](0x0,_0xca2144);_0x27b17c=_0x27b17c[_0xe61c('0xa')](_0xca2144+_0x3c4af4[_0xe61c('0xb')]);var _0x59e1f2=_0x5e80ae['split'](_0x1f2797),_0x558658=0x0,_0x166f40={},_0x145f8c='',_0x1d5f35='',_0x3bd46b=-0x1;while(_0x59e1f2[_0x558658]){_0x3bd46b=_0x59e1f2[_0x558658][_0xe61c('0x9')](':');if(_0x3bd46b!=-0x1){_0x145f8c=_0x59e1f2[_0x558658][_0xe61c('0xc')](0x0,_0x3bd46b)[_0xe61c('0xd')]();_0x1d5f35=_0x59e1f2[_0x558658][_0xe61c('0xc')](_0x3bd46b+0x1)[_0xe61c('0xd')]();if(_0x145f8c[_0xe61c('0xb')]>0x0){_0x166f40[_0x145f8c]=_0x1d5f35;}}else{}_0x558658++;}this[_0xe61c('0xe')](_0xe61c('0xf'),_0x166f40);this[_0xe61c('0x3')]=!![];}_0x15b204++;}this[_0xe61c('0x2')]=_0x27b17c;}else{while((_0x3c77ca=_0x27b17c[_0xe61c('0x9')](_0x1f2797))!=-0x1){_0x5e80ae=_0x27b17c[_0xe61c('0xa')](0x0,_0x3c77ca);this['emit'](_0xe61c('0x10'),_0x5e80ae);_0x27b17c=_0x27b17c[_0xe61c('0xa')](_0x3c77ca+_0x1f2797[_0xe61c('0xb')]);}this[_0xe61c('0x2')]=_0x27b17c;}_0x2b93cc();};module[_0xe61c('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 1c6cb4e..32a1fbc 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 _0xd40a=['LogoutUser','bluebird','lodash','util','jayson/promise','request','then','error','message','catch','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getSoundById','ShowSound','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout'];(function(_0x2d2bf4,_0x10699f){var _0x16be04=function(_0x98901e){while(--_0x98901e){_0x2d2bf4['push'](_0x2d2bf4['shift']());}};_0x16be04(++_0x10699f);}(_0xd40a,0x169));var _0xad40=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd40a[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xad40('0x0'));var moment=require('moment');var _=require(_0xad40('0x1'));var util=require(_0xad40('0x2'));var jayson=require(_0xad40('0x3'));var client=jayson['client']['http']({'port':0x2329});function request(_0x5abb47,_0x8e5f26){return new BPromise(function(_0xd0ed2,_0x1e6a37){return client[_0xad40('0x4')](_0x5abb47,_0x8e5f26)[_0xad40('0x5')](function(_0x3ba326){if(_0x3ba326[_0xad40('0x6')]){return _0x1e6a37(_0x3ba326[_0xad40('0x6')][_0xad40('0x7')]);}else{return _0xd0ed2(_0x3ba326['result']);}})[_0xad40('0x8')](function(_0x2bf005){return _0x1e6a37(_0x2bf005);});});}exports['getSquareProjects']=function(){return request(_0xad40('0x9'),{'options':{'raw':![],'attributes':['id',_0xad40('0xa'),_0xad40('0xb')]}});};exports[_0xad40('0xc')]=function(_0x5114e5){return request(_0xad40('0xd'),{'options':{'raw':![],'where':{'name':_0x5114e5},'attributes':[_0xad40('0xb')]}});};exports[_0xad40('0xe')]=function(_0x327f73){return request(_0xad40('0xf'),{'options':{'raw':![],'where':{'id':_0x327f73},'include':[{'model':_0xad40('0x10'),'as':'Smtp','include':[{'model':'CloudProvider','as':_0xad40('0x11')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0xad40('0x12')]=function(_0x54470a){return request(_0xad40('0xd'),{'options':{'where':{'id':_0x54470a},'attributes':[_0xad40('0xa')]}});};exports[_0xad40('0x13')]=function(_0xa25688){return request(_0xad40('0x14'),{'options':{'where':{'id':_0xa25688},'attributes':[_0xad40('0xa')]}});};exports[_0xad40('0x15')]=function(_0x5f49c0){return request(_0xad40('0x16'),{'options':{'where':{'id':_0x5f49c0},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x1f3b03){return request(_0xad40('0x17'),{'options':{'where':{'id':_0x1f3b03},'attributes':[_0xad40('0x18')]}});};exports[_0xad40('0x19')]=function(_0x301bfd){return request('ShowUser',{'options':{'where':{'id':_0x301bfd},'attributes':['name']}});};exports[_0xad40('0x1a')]=function(_0x262b14){return request(_0xad40('0x1b'),{'options':{'where':{'phone':_0x262b14[_0xad40('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x198e7b){return request('ShowTrunk',{'options':{'where':{'id':_0x198e7b},'attributes':[_0xad40('0xa')]}});};exports[_0xad40('0x1d')]=function(_0x347abc){return request(_0xad40('0x1e'),{'options':{'where':{'id':_0x347abc},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x5d26da){return request(_0xad40('0x1f'),{'options':{'raw':![],'where':{'id':_0x5d26da},'include':[{'model':'Interval','as':_0xad40('0x20')}]}});};exports[_0xad40('0x21')]=function(_0x38f721){return request('ShowSmsAccount',{'options':{'where':{'id':_0x38f721},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x1499bb){return request(_0xad40('0x22'),{'body':_0x1499bb});};exports[_0xad40('0x23')]=function(_0x9cfe85){return request('CreateSquareDetailsReport',{'body':_0x9cfe85});};exports[_0xad40('0x24')]=function(_0x3196e0){return request(_0xad40('0x25'),{'body':_[_0xad40('0x26')](_0x3196e0,{'project_name':_0x3196e0[_0xad40('0x27')],'prev_project_name':_0x3196e0[_0xad40('0x28')]||'','is_subproject':_0x3196e0[_0xad40('0x28')]?!![]:![],'leaveAt':moment()[_0xad40('0x29')](_0xad40('0x2a'))})});};exports[_0xad40('0x2b')]=function(_0x22bf77){return request(_0xad40('0x2c'),{'body':_0x22bf77});};exports[_0xad40('0x2d')]=function(_0x15b1da){return request(_0xad40('0x2e'),{'body':_0x15b1da});};exports[_0xad40('0x2f')]=function(_0x440f7a){return request(_0xad40('0x30'),{'options':{'raw':![],'where':{'phone':_0x440f7a[_0xad40('0x1c')],'ListId':_0x440f7a[_0xad40('0x31')]}}})[_0xad40('0x5')](function(_0x5e0249){if(_0x5e0249){return _0x5e0249;}return request('CreateCmContact',{'body':_0x440f7a});});};exports[_0xad40('0x32')]=function(_0x3da920){return request(_0xad40('0x33'),{'options':{'where':{'id':_0x3da920},'attributes':[_0xad40('0xa')]}});};exports[_0xad40('0x34')]=function(_0xdb53c2,_0x4f6f4b){return request(_0xad40('0x35'),{'body':{'interface':_0x4f6f4b},'options':{'where':_0xdb53c2}});};exports[_0xad40('0x36')]=function(_0x19be07,_0x579483,_0x3e3f4a){return request(_0xad40('0x37'),{'body':{'type':_0x579483,'uniqueid':_0x3e3f4a},'options':{'where':_0x19be07}});};exports[_0xad40('0x38')]=function(_0xc3f194){return request(_0xad40('0x39'),{'body':{},'options':{'where':_0xc3f194}});};exports[_0xad40('0x3a')]=function(_0x2e0f26){return request(_0xad40('0x3b'),{'body':{},'options':{'where':_0x2e0f26}});}; \ No newline at end of file +var _0xdd31=['agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser'];(function(_0x4fba44,_0x10e53c){var _0x1b87ec=function(_0x20015c){while(--_0x20015c){_0x4fba44['push'](_0x4fba44['shift']());}};_0x1b87ec(++_0x10e53c);}(_0xdd31,0x169));var _0x1dd3=function(_0x25cf7b,_0x6556d4){_0x25cf7b=_0x25cf7b-0x0;var _0x104f79=_0xdd31[_0x25cf7b];return _0x104f79;};'use strict';var BPromise=require(_0x1dd3('0x0'));var moment=require(_0x1dd3('0x1'));var _=require(_0x1dd3('0x2'));var util=require(_0x1dd3('0x3'));var jayson=require(_0x1dd3('0x4'));var client=jayson[_0x1dd3('0x5')][_0x1dd3('0x6')]({'port':0x2329});function request(_0x387d98,_0x527f87){return new BPromise(function(_0x3c44ae,_0x5be012){return client[_0x1dd3('0x7')](_0x387d98,_0x527f87)[_0x1dd3('0x8')](function(_0x1ffda8){if(_0x1ffda8[_0x1dd3('0x9')]){return _0x5be012(_0x1ffda8[_0x1dd3('0x9')][_0x1dd3('0xa')]);}else{return _0x3c44ae(_0x1ffda8[_0x1dd3('0xb')]);}})[_0x1dd3('0xc')](function(_0x2d9833){return _0x5be012(_0x2d9833);});});}exports[_0x1dd3('0xd')]=function(){return request(_0x1dd3('0xe'),{'options':{'raw':![],'attributes':['id',_0x1dd3('0xf'),_0x1dd3('0x10')]}});};exports['getSquareProject']=function(_0x533189){return request(_0x1dd3('0x11'),{'options':{'raw':![],'where':{'name':_0x533189},'attributes':['production']}});};exports[_0x1dd3('0x12')]=function(_0x229c88){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x229c88},'include':[{'model':'MailServerOut','as':_0x1dd3('0x13'),'include':[{'model':_0x1dd3('0x14'),'as':'CloudProvider'}]}],'attributes':['id',_0x1dd3('0xf'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xef0922){return request(_0x1dd3('0x11'),{'options':{'where':{'id':_0xef0922},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x15')]=function(_0x8b388f){return request(_0x1dd3('0x16'),{'options':{'where':{'id':_0x8b388f},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x17')]=function(_0x5df5c9){return request(_0x1dd3('0x18'),{'options':{'where':{'id':_0x5df5c9},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x19')]=function(_0x21c624){return request(_0x1dd3('0x1a'),{'options':{'where':{'id':_0x21c624},'attributes':[_0x1dd3('0x1b')]}});};exports['getUserById']=function(_0x308e2b){return request(_0x1dd3('0x1c'),{'options':{'where':{'id':_0x308e2b},'attributes':['name']}});};exports[_0x1dd3('0x1d')]=function(_0x1ed738){return request(_0x1dd3('0x1e'),{'options':{'where':{'phone':_0x1ed738['phone']},'attributes':['id']}});};exports[_0x1dd3('0x1f')]=function(_0x11da73){return request(_0x1dd3('0x20'),{'options':{'where':{'id':_0x11da73},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x21')]=function(_0x33a763){return request(_0x1dd3('0x22'),{'options':{'where':{'id':_0x33a763},'attributes':[_0x1dd3('0x23')]}});};exports[_0x1dd3('0x24')]=function(_0x3264c8){return request(_0x1dd3('0x25'),{'options':{'raw':![],'where':{'id':_0x3264c8},'include':[{'model':_0x1dd3('0x26'),'as':_0x1dd3('0x27')}]}});};exports[_0x1dd3('0x28')]=function(_0x3454fc){return request(_0x1dd3('0x29'),{'options':{'where':{'id':_0x3454fc},'attributes':['id',_0x1dd3('0xf')]}});};exports[_0x1dd3('0x2a')]=function(_0xed19e1){return request(_0x1dd3('0x2b'),{'body':_0xed19e1});};exports[_0x1dd3('0x2c')]=function(_0x1ac0a5){return request(_0x1dd3('0x2d'),{'body':_0x1ac0a5});};exports[_0x1dd3('0x2e')]=function(_0x4d960d){return request(_0x1dd3('0x2f'),{'body':_[_0x1dd3('0x30')](_0x4d960d,{'project_name':_0x4d960d[_0x1dd3('0x31')],'prev_project_name':_0x4d960d[_0x1dd3('0x32')]||'','is_subproject':_0x4d960d[_0x1dd3('0x32')]?!![]:![],'leaveAt':moment()[_0x1dd3('0x33')](_0x1dd3('0x34'))})});};exports[_0x1dd3('0x35')]=function(_0x5ec0d2){return request(_0x1dd3('0x36'),{'body':_0x5ec0d2});};exports[_0x1dd3('0x37')]=function(_0x50d46e){return request(_0x1dd3('0x38'),{'body':_0x50d46e});};exports[_0x1dd3('0x39')]=function(_0x5c0fd8){return request(_0x1dd3('0x3a'),{'options':{'raw':![],'where':{'phone':_0x5c0fd8['phone'],'ListId':_0x5c0fd8[_0x1dd3('0x3b')]}}})[_0x1dd3('0x8')](function(_0x4b043b){if(_0x4b043b){return _0x4b043b;}return request(_0x1dd3('0x3c'),{'body':_0x5c0fd8});});};exports[_0x1dd3('0x3d')]=function(_0xf27cdc){return request(_0x1dd3('0x3e'),{'options':{'where':{'id':_0xf27cdc},'attributes':[_0x1dd3('0xf')]}});};exports[_0x1dd3('0x3f')]=function(_0x35f9d7,_0x51e264){return request(_0x1dd3('0x40'),{'body':{'interface':_0x51e264},'options':{'where':_0x35f9d7}});};exports[_0x1dd3('0x41')]=function(_0x4d2b56,_0x59fbdf,_0x5e3720){return request(_0x1dd3('0x42'),{'body':{'type':_0x59fbdf,'uniqueid':_0x5e3720},'options':{'where':_0x4d2b56}});};exports[_0x1dd3('0x43')]=function(_0x2db64f){return request(_0x1dd3('0x44'),{'body':{},'options':{'where':_0x2db64f}});};exports[_0x1dd3('0x45')]=function(_0x3f3546){return request(_0x1dd3('0x46'),{'body':{},'options':{'where':_0x3f3546}});}; \ 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 2783044..b231056 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 _0x0755=['exports','./polly','./lex'];(function(_0xa0d8a,_0x365a84){var _0x663df9=function(_0x11ec53){while(--_0x11ec53){_0xa0d8a['push'](_0xa0d8a['shift']());}};_0x663df9(++_0x365a84);}(_0x0755,0x7c));var _0x5075=function(_0x4af434,_0x39edfb){_0x4af434=_0x4af434-0x0;var _0x2219e7=_0x0755[_0x4af434];return _0x2219e7;};var polly=require(_0x5075('0x0'));var lex=require(_0x5075('0x1'));module[_0x5075('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x565f=['./lex','exports'];(function(_0x48dbb4,_0x3ef00f){var _0x1b34a3=function(_0x2295b0){while(--_0x2295b0){_0x48dbb4['push'](_0x48dbb4['shift']());}};_0x1b34a3(++_0x3ef00f);}(_0x565f,0x68));var _0xf565=function(_0x49d222,_0x373c22){_0x49d222=_0x49d222-0x0;var _0x4c0d5f=_0x565f[_0x49d222];return _0x4c0d5f;};var polly=require('./polly');var lex=require(_0xf565('0x0'));module[_0xf565('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1a8a92f..927e522 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file +var _0x750a=['exports'];(function(_0x1d857d,_0x457c94){var _0x2e2164=function(_0x6177cf){while(--_0x6177cf){_0x1d857d['push'](_0x1d857d['shift']());}};_0x2e2164(++_0x457c94);}(_0x750a,0x140));var _0xa750=function(_0x561580,_0xe513c6){_0x561580=_0x561580-0x0;var _0x189310=_0x750a[_0x561580];return _0x189310;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ 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 a7c3671..2331c99 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(_0x36fd56,_0x451be7){var _0x647e17=function(_0x520491){while(--_0x520491){_0x36fd56['push'](_0x36fd56['shift']());}};_0x647e17(++_0x451be7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x2c68b7,_0x4d5475){var _0x54616f=function(_0xd05753){while(--_0xd05753){_0x2c68b7['push'](_0x2c68b7['shift']());}};_0x54616f(++_0x4d5475);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 a234ee2..4c9d949 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 _0xfe2b=['exports'];(function(_0x105dfd,_0x238e66){var _0x1d5a9c=function(_0x9f9e0d){while(--_0x9f9e0d){_0x105dfd['push'](_0x105dfd['shift']());}};_0x1d5a9c(++_0x238e66);}(_0xfe2b,0x8e));var _0xbfe2=function(_0x32806d,_0x46e71b){_0x32806d=_0x32806d-0x0;var _0x437806=_0xfe2b[_0x32806d];return _0x437806;};'use strict';var polly=require('./lib/api');module[_0xbfe2('0x0')]=function(_0xb70398,_0x7a673f,_0xa1fc1,_0x5a4994,_0x11bbfc,_0x568647,_0x2573b3){return polly(_0xb70398,_0x7a673f,_0xa1fc1,_0x5a4994,_0x11bbfc,_0x568647,_0x2573b3);}; \ No newline at end of file +var _0xda2c=['exports'];(function(_0x305d3a,_0x1e5a37){var _0x587f68=function(_0x26ebe2){while(--_0x26ebe2){_0x305d3a['push'](_0x305d3a['shift']());}};_0x587f68(++_0x1e5a37);}(_0xda2c,0xe1));var _0xcda2=function(_0xa69b5,_0x18ff44){_0xa69b5=_0xa69b5-0x0;var _0x1ca183=_0xda2c[_0xa69b5];return _0x1ca183;};'use strict';var polly=require('./lib/api');module[_0xcda2('0x0')]=function(_0x294cfb,_0x271350,_0x4b0523,_0x57189d,_0x4284c8,_0x3dcd05,_0x2bc92b){return polly(_0x294cfb,_0x271350,_0x4b0523,_0x57189d,_0x4284c8,_0x3dcd05,_0x2bc92b);}; \ 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 81e00a7..91e443c 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 _0x7241=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x5778fd,_0x4c6af9){var _0x2c59d0=function(_0x5755f0){while(--_0x5755f0){_0x5778fd['push'](_0x5778fd['shift']());}};_0x2c59d0(++_0x4c6af9);}(_0x7241,0x1c6));var _0x1724=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x7241[_0x3511d3];return _0x5d6321;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x1724('0x0'));var rs=require(_0x1724('0x1'));var AWS=require(_0x1724('0x2'));function pollyResult(_0x388640,_0x41a491,_0x42723b){return new BPromise(function(_0x44346f,_0x53de7a){_0x388640[_0x1724('0x3')](_0x41a491,function(_0x3c06d5,_0x2d881d){if(_0x3c06d5){_0x53de7a(_0x3c06d5);}else if(_0x2d881d){if(_0x2d881d[_0x1724('0x4')]instanceof Buffer){fs[_0x1724('0x5')](_0x42723b,_0x2d881d[_0x1724('0x4')],function(_0x194590){if(_0x194590){_0x53de7a(_0x194590);}else{_0x44346f();}});}else{_0x53de7a(new Error(_0x1724('0x6')));}}else{_0x53de7a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1724('0x7')]=function(_0x205b5b,_0x1dbdff,_0x55243c,_0x40ae35,_0x5b5d80,_0x43643a,_0xf98b1e){var _0x22e38b=new AWS[(_0x1724('0x8'))]({'accessKeyId':_0x205b5b,'secretAccessKey':_0x1dbdff,'region':_0x55243c});var _0x21b759={'Text':_0x5b5d80,'TextType':_0x43643a||_0x1724('0x9'),'OutputFormat':'mp3','VoiceId':_0x40ae35};return pollyResult(_0x22e38b,_0x21b759,_0xf98b1e);}; \ No newline at end of file +var _0xb4c2=['aws-sdk','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xb4c2,0x69));var _0x2b4c=function(_0xaad061,_0x49cbd0){_0xaad061=_0xaad061-0x0;var _0x22c207=_0xb4c2[_0xaad061];return _0x22c207;};'use strict';var fs=require('fs');var path=require(_0x2b4c('0x0'));var BPromise=require(_0x2b4c('0x1'));var rs=require(_0x2b4c('0x2'));var AWS=require(_0x2b4c('0x3'));function pollyResult(_0x4a9dd2,_0xf48d6b,_0x523456){return new BPromise(function(_0x394bc7,_0x581e9e){_0x4a9dd2['synthesizeSpeech'](_0xf48d6b,function(_0x56fa2c,_0x3473a6){if(_0x56fa2c){_0x581e9e(_0x56fa2c);}else if(_0x3473a6){if(_0x3473a6[_0x2b4c('0x4')]instanceof Buffer){fs[_0x2b4c('0x5')](_0x523456,_0x3473a6[_0x2b4c('0x4')],function(_0x3a94ee){if(_0x3a94ee){_0x581e9e(_0x3a94ee);}else{_0x394bc7();}});}else{_0x581e9e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x581e9e(new Error(_0x2b4c('0x6')));}});});}module['exports']=function(_0x49541d,_0x2acc0d,_0x43e355,_0x4cd404,_0x497137,_0x2bffda,_0x823e7c){var _0x4abc17=new AWS[(_0x2b4c('0x7'))]({'accessKeyId':_0x49541d,'secretAccessKey':_0x2acc0d,'region':_0x43e355});var _0x359a8b={'Text':_0x497137,'TextType':_0x2bffda||'text','OutputFormat':_0x2b4c('0x8'),'VoiceId':_0x4cd404};return pollyResult(_0x4abc17,_0x359a8b,_0x823e7c);}; \ 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 241c379..c5be228 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 _0xf148=['./lib/api','exports'];(function(_0x54d5ba,_0x1f1ba9){var _0x6a592e=function(_0x394f8d){while(--_0x394f8d){_0x54d5ba['push'](_0x54d5ba['shift']());}};_0x6a592e(++_0x1f1ba9);}(_0xf148,0x7c));var _0x8f14=function(_0x59d342,_0xa450e0){_0x59d342=_0x59d342-0x0;var _0x26a52f=_0xf148[_0x59d342];return _0x26a52f;};'use strict';var asr=require(_0x8f14('0x0'));module[_0x8f14('0x1')]=function(_0x3fabbb,_0x5e39d0,_0x258f42,_0xf58585){return asr(_0x3fabbb,_0x5e39d0,_0x258f42);}; \ No newline at end of file +var _0x3e81=['exports'];(function(_0x2adb3d,_0x53b434){var _0x3c0694=function(_0xda6175){while(--_0xda6175){_0x2adb3d['push'](_0x2adb3d['shift']());}};_0x3c0694(++_0x53b434);}(_0x3e81,0x1ee));var _0x13e8=function(_0x4823e2,_0xe74585){_0x4823e2=_0x4823e2-0x0;var _0x5dc63d=_0x3e81[_0x4823e2];return _0x5dc63d;};'use strict';var asr=require('./lib/api');module[_0x13e8('0x0')]=function(_0x5e618b,_0x1998ca,_0x2716fb,_0x420f96){return asr(_0x5e618b,_0x1998ca,_0x2716fb);}; \ 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 868f9dd..f907068 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 _0x01fe=['exports','length','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x01fe,0x102));var _0xe01f=function(_0x2bfcc7,_0x422ff2){_0x2bfcc7=_0x2bfcc7-0x0;var _0x1cde30=_0x01fe[_0x2bfcc7];return _0x1cde30;};'use strict';var url=require(_0xe01f('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe01f('0x1');module[_0xe01f('0x2')]=function(_0x4a9e90,_0x577c82,_0x15f6ba){return new BPromise(function(_0x1212f6,_0x9505fa){var _0x92b885;if(typeof _0x4a9e90!=='string'||_0x4a9e90[_0xe01f('0x3')]===0x0){return _0x9505fa('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x577c82!==_0xe01f('0x4')||_0x577c82[_0xe01f('0x3')]===0x0){return _0x9505fa(_0xe01f('0x5'));}if(typeof _0x15f6ba!==_0xe01f('0x6')&&(typeof _0x15f6ba!==_0xe01f('0x4')||_0x15f6ba['length']===0x0)){return _0x9505fa(_0xe01f('0x7'));}try{_0x92b885=fs[_0xe01f('0x8')](_0x4a9e90)['toString'](_0xe01f('0x9'));}catch(_0x54334d){return _0x9505fa(_0x54334d);}return _0x1212f6({'method':_0xe01f('0xa'),'uri':host+_0xe01f('0xb')+_0x577c82,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xe01f('0xc'),'languageCode':_0x15f6ba},'audio':{'content':_0x92b885}},'json':!![]});});}; \ No newline at end of file +var _0xcb91=['lang\x20should\x20be\x20a\x20string','base64','POST','/v1/speech:recognize?key=','LINEAR16','https://speech.googleapis.com','exports','string','length','undefined'];(function(_0x5af4ce,_0x4374bf){var _0x581b03=function(_0x190db7){while(--_0x190db7){_0x5af4ce['push'](_0x5af4ce['shift']());}};_0x581b03(++_0x4374bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0xcb91[_0x17a32f];return _0x15a293;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x1cb9('0x0');module[_0x1cb9('0x1')]=function(_0x17d4ec,_0x22c4b8,_0x4c37e8){return new BPromise(function(_0x8c392f,_0x2c17b8){var _0x545a34;if(typeof _0x17d4ec!==_0x1cb9('0x2')||_0x17d4ec[_0x1cb9('0x3')]===0x0){return _0x2c17b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x22c4b8!==_0x1cb9('0x2')||_0x22c4b8[_0x1cb9('0x3')]===0x0){return _0x2c17b8('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c37e8!==_0x1cb9('0x4')&&(typeof _0x4c37e8!==_0x1cb9('0x2')||_0x4c37e8['length']===0x0)){return _0x2c17b8(_0x1cb9('0x5'));}try{_0x545a34=fs['readFileSync'](_0x17d4ec)['toString'](_0x1cb9('0x6'));}catch(_0x2fa15c){return _0x2c17b8(_0x2fa15c);}return _0x8c392f({'method':_0x1cb9('0x7'),'uri':host+_0x1cb9('0x8')+_0x22c4b8,'body':{'config':{'encoding':_0x1cb9('0x9'),'sampleRateHertz':'8000','languageCode':_0x4c37e8},'audio':{'content':_0x545a34}},'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 0bb5507..2f7cdaf 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 _0xd10d=['./asr','exports'];(function(_0x2381c9,_0xddadfd){var _0x5d10ee=function(_0x233323){while(--_0x233323){_0x2381c9['push'](_0x2381c9['shift']());}};_0x5d10ee(++_0xddadfd);}(_0xd10d,0x1b0));var _0xdd10=function(_0x58fa29,_0x1135f2){_0x58fa29=_0x58fa29-0x0;var _0x59044e=_0xd10d[_0x58fa29];return _0x59044e;};var asr=require(_0xdd10('0x0'));module[_0xdd10('0x1')]={'asr':asr}; \ No newline at end of file +var _0x22e4=['./asr','exports'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x22e4,0x80));var _0x422e=function(_0xb225a3,_0x5b8e23){_0xb225a3=_0xb225a3-0x0;var _0x59274c=_0x22e4[_0xb225a3];return _0x59274c;};var asr=require(_0x422e('0x0'));module[_0x422e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 9e763ce..d2fd740 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 _0x5f2c=['nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','unlink','error','pipe','data','end','wav','error\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','?key=','input','voice','text:synthesize','POST','audioContent','writeFile','.wav','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','.mp3','goggleTTS\x20path','googleASR','uri','results','map','alternatives','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','code','metadata','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','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','model=%s','freeform=3'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_0x5f2c,0x8b));var _0xc5f2=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f2c[_0x278e3c];return _0x3e2d9b;};'use strict';var apiai=require(_0xc5f2('0x0'));var BPromise=require(_0xc5f2('0x1'));var dialogflow=require(_0xc5f2('0x2'));var fs=require('fs');var http=require(_0xc5f2('0x3'));var https=require(_0xc5f2('0x4'));var md5=require('md5');var path=require(_0xc5f2('0x5'));var querystring=require(_0xc5f2('0x6'));var rp=require(_0xc5f2('0x7'));var rs=require(_0xc5f2('0x8'));var sox=require(_0xc5f2('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xc5f2('0xa'))[_0xc5f2('0xb')];var util=require(_0xc5f2('0xc'));var aws=require(_0xc5f2('0xd'));var google=require(_0xc5f2('0xe'));var sestek=require(_0xc5f2('0xf'));var tilde=require(_0xc5f2('0x10'));var logger=require(_0xc5f2('0x11'))(_0xc5f2('0x12'));var ISPEECH_API=_0xc5f2('0x13');function downloadFile(_0x122b53,_0x242070){return new BPromise(function(_0x5b852b,_0x32d01a){var _0x855456=urlParse(_0x122b53);var _0xdb8670=_0x855456[_0xc5f2('0x14')]===_0xc5f2('0x15')?https:http;var _0x390112={'host':_0x855456[_0xc5f2('0x16')],'path':_0x855456[_0xc5f2('0x5')],'headers':{'user-agent':_0xc5f2('0x17')}};_0xdb8670[_0xc5f2('0x18')](_0x390112,function(_0x362845){if(_0x362845[_0xc5f2('0x19')]!==0xc8){logger['error'](_0xc5f2('0x1a')+_0x122b53+_0xc5f2('0x1b')+_0x362845[_0xc5f2('0x19')]+'\x20('+_0x362845[_0xc5f2('0x1c')]+')');_0x32d01a(new Error(_0xc5f2('0x1a')+_0x122b53+_0xc5f2('0x1b')+_0x362845[_0xc5f2('0x19')]+'\x20('+_0x362845[_0xc5f2('0x1c')]+')'));return;}var _0x2ff195=fs['createWriteStream'](_0x242070);_0x2ff195['on']('finish',function(){logger[_0xc5f2('0x1d')](_0xc5f2('0x1e'));_0x2ff195[_0xc5f2('0x1f')](_0x5b852b);});_0x2ff195['on']('error',function(_0x23ed17){fs[_0xc5f2('0x20')](_0x242070);logger[_0xc5f2('0x21')]('download\x20error',_0x23ed17);_0x32d01a(_0x23ed17);});_0x362845[_0xc5f2('0x22')](_0x2ff195);})['on'](_0xc5f2('0x21'),function(_0x275147){logger[_0xc5f2('0x21')](_0x275147);_0x32d01a(_0x275147);})['end']();});}function uploadFile(_0x1c434d){return new BPromise(function(_0x3cc28a,_0x2bfab9){var _0x57978b=urlParse(_0x1c434d);var _0x54024d=_0x57978b['protocol']===_0xc5f2('0x15')?https:http;var _0x264c89={'host':_0x57978b['host'],'path':_0x57978b[_0xc5f2('0x5')],'headers':{'user-agent':_0xc5f2('0x17')}};_0x54024d['get'](_0x264c89,function(_0x14a949){if(_0x14a949[_0xc5f2('0x19')]!==0xc8){_0x2bfab9(new Error(_0xc5f2('0x1a')+_0x1c434d+_0xc5f2('0x1b')+_0x14a949[_0xc5f2('0x19')]+'\x20('+_0x14a949[_0xc5f2('0x1c')]+')'));return;}var _0x4a9a55='';_0x14a949['on'](_0xc5f2('0x23'),function(_0x2e0b21){_0x4a9a55+=_0x2e0b21;});_0x14a949['on'](_0xc5f2('0x24'),function(){_0x3cc28a(_0x4a9a55);});})['on'](_0xc5f2('0x21'),function(_0x4ca69e){_0x2bfab9(_0x4ca69e);})['end']();});}function convertFile(_0x507995,_0x5e2216){return new BPromise(function(_0x3f88e5,_0x1b90b2){var _0x485dfb=sox['transcode'](_0x507995,_0x5e2216,{'sampleRate':0x1f40,'format':_0xc5f2('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x485dfb['on']('error',function(_0x279cfd){logger[_0xc5f2('0x21')](_0xc5f2('0x26'),_0x279cfd);_0x1b90b2(_0x279cfd);});_0x485dfb['on'](_0xc5f2('0x24'),function(){logger[_0xc5f2('0x1d')]('finish\x20to\x20convert');_0x3f88e5();});_0x485dfb[_0xc5f2('0x27')]();});}function base64Decode(_0x1aed9d,_0x2e98fb){var _0x152636=path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+'.wav');fs[_0xc5f2('0x2b')](_0x152636,_0x1aed9d,_0xc5f2('0x2c'));return convertFile(_0x152636,_0x2e98fb)[_0xc5f2('0x2d')](function(){try{fs[_0xc5f2('0x20')](_0x152636);fs[_0xc5f2('0x2e')](_0x2e98fb,_0xc5f2('0x2f'));}catch(_0x51f16a){logger['error'](_0x51f16a);}return _0x2e98fb[_0xc5f2('0x30')]('.')[0x0];});}function base64Encode(_0x2cd5cf){var _0x4616df=fs[_0xc5f2('0x31')](_0x2cd5cf);return new Buffer(_0x4616df)['toString'](_0xc5f2('0x2c'));}exports['googleCloudTTS']=function(_0x1af323,_0x3054a4,_0x36415f,_0x964dbd,_0x4a90be,_0x2ef512){var _0x3d4225,_0x9e0381;var _0x385c80='https://texttospeech.googleapis.com/v1/';var _0x2b1cb1=_0xc5f2('0x32')+_0x1af323;var _0x43be42={};if(_0x3054a4==='ssml'){_0x43be42[_0xc5f2('0x33')]={'ssml':_0x36415f};}else{_0x43be42[_0xc5f2('0x33')]={'text':_0x36415f};};_0x43be42[_0xc5f2('0x34')]={'languageCode':_0x964dbd,'ssmlGender':_0x4a90be};_0x43be42['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x425d33={'url':_0x385c80+_0xc5f2('0x35')+_0x2b1cb1,'method':_0xc5f2('0x36'),'json':!![],'body':_0x43be42};return rp(_0x425d33)['then'](function(_0x12436c){return new BPromise(function(_0x443189,_0x40a7ed){_0x3d4225=path[_0xc5f2('0x28')](__dirname,'tmp',rs[_0xc5f2('0x2a')](0x4)+'.mp3');var _0x20eaca=Buffer['from'](_0x12436c[_0xc5f2('0x37')],_0xc5f2('0x2c'));return fs[_0xc5f2('0x38')](_0x3d4225,_0x20eaca,function(_0x49858f){_0x40a7ed(_0x49858f);},function(_0x55926f){fs[_0xc5f2('0x2e')](_0x3d4225,_0xc5f2('0x2f'));_0x443189(_0x55926f);});});})[_0xc5f2('0x2d')](function(_0x3499be){_0x9e0381=path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x39'));return convertFile(_0x3d4225,_0x9e0381);})[_0xc5f2('0x2d')](function(){try{fs[_0xc5f2('0x20')](_0x3d4225);fs[_0xc5f2('0x2e')](_0x9e0381,_0xc5f2('0x2f'));}catch(_0x2ebb90){logger['error'](_0x2ebb90);}logger[_0xc5f2('0x1d')](_0xc5f2('0x3a'),_0x9e0381[_0xc5f2('0x30')]('.')[0x0]);return _0x9e0381[_0xc5f2('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x49218b,_0xed3b62){var _0x5b7e04=_0xc5f2('0x3b');var _0x4d26c6,_0x445430;var _0x4ca5a2;var _0x5a9901={'encoding':_0xc5f2('0x3c'),'method':'POST','timeout':0x2710,'url':_0x5b7e04,'headers':{'Content-Type':_0xc5f2('0x3d')},'body':_0xc5f2('0x3e')+encodeURIComponent(JSON[_0xc5f2('0x3f')]([[[_0xc5f2('0x40'),JSON[_0xc5f2('0x3f')]([_0x49218b,_0xed3b62||'en',![],_0xc5f2('0x41')]),null,_0xc5f2('0x42')]]]))};return rp(_0x5a9901)[_0xc5f2('0x2d')](function(_0x3e3b79){try{_0x4ca5a2=eval(_0x3e3b79['slice'](0x5))[0x0][0x2];}catch(_0x2b5204){throw new Error(_0xc5f2('0x43')+_0x3e3b79[_0xc5f2('0x23')]);}if(!_0x4ca5a2){if(_0x49218b[_0xc5f2('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xc5f2('0x45')+_0xed3b62+'\x22\x20might\x20not\x20exist');}}try{_0x4ca5a2=eval(_0x4ca5a2)[0x0];}catch(_0x579ccc){throw new Error(_0xc5f2('0x43')+res[_0xc5f2('0x23')]);}const _0x4f74d5=_0x4ca5a2;_0x4d26c6=path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs['generate'](0x4)+_0xc5f2('0x46'));fs[_0xc5f2('0x2b')](_0x4d26c6,_0x4ca5a2,{'encoding':_0xc5f2('0x2c')});_0x445430=path['resolve'](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x39'));return convertFile(_0x4d26c6,_0x445430);})['then'](function(){try{fs['unlink'](_0x4d26c6);fs[_0xc5f2('0x2e')](_0x445430,'777');}catch(_0x2ef7f2){logger[_0xc5f2('0x21')](_0x2ef7f2);}logger[_0xc5f2('0x1d')](_0xc5f2('0x47'),_0x445430['split']('.')[0x0]);return _0x445430['split']('.')[0x0];});};exports[_0xc5f2('0x48')]=function(_0xc93e9d,_0x2969c7,_0x52d067){return google['asr'](_0xc93e9d,_0x2969c7,_0x52d067)[_0xc5f2('0x2d')](function(_0x4f4144){logger[_0xc5f2('0x1d')](_0x4f4144[_0xc5f2('0x49')]);return rp(_0x4f4144);})[_0xc5f2('0x2d')](function(_0x4f133a){var _0x42b732='';var _0x4c8b89=0x0;try{fs[_0xc5f2('0x20')](_0xc93e9d);}catch(_0x2562f9){logger['error'](_0x2562f9);}if(_0x4f133a&&_0x4f133a['results']){_0x42b732=_0x4f133a[_0xc5f2('0x4a')][_0xc5f2('0x4b')](function(_0x274486){return _0x274486&&_0x274486[_0xc5f2('0x4c')][0x0]&&_0x274486[_0xc5f2('0x4c')][0x0]['transcript']?_0x274486[_0xc5f2('0x4c')][0x0]['transcript']:'';})['join']('\x0a');_0x4c8b89=_0x4f133a[_0xc5f2('0x4a')][_0xc5f2('0x4b')](function(_0x4b84a4){return _0x4b84a4&&_0x4b84a4['alternatives'][0x0]&&_0x4b84a4[_0xc5f2('0x4c')][0x0][_0xc5f2('0x4d')]?_0x4b84a4['alternatives'][0x0][_0xc5f2('0x4d')]:0x0;})[_0xc5f2('0x4e')]('\x0a');}logger[_0xc5f2('0x1d')](_0xc5f2('0x4f'),_0x42b732);logger['info'](_0xc5f2('0x50'),_0x4c8b89);return{'transcript':_0x42b732,'confidence':_0x4c8b89};})[_0xc5f2('0x51')](function(_0x51d483){logger[_0xc5f2('0x21')](_0xc5f2('0x52'),_0x51d483[_0xc5f2('0x19')],_0x51d483[_0xc5f2('0x53')],_0x51d483[_0xc5f2('0x54')]);});};exports[_0xc5f2('0x55')]=function(_0x1bed9f,_0x8590b1,_0x3926cf,_0xc83958){var _0x3a0a31=apiai(_0x8590b1,{'language':_0xc83958||'en'});return _0x3a0a31[_0xc5f2('0x56')](_0x3926cf,{'sessionId':md5(_0x1bed9f)})[_0xc5f2('0x2d')](function(_0x46f75b){logger['info'](JSON[_0xc5f2('0x3f')](_0x46f75b));return{'source':_0x46f75b[_0xc5f2('0x57')][_0xc5f2('0x58')],'resolvedQuery':_0x46f75b[_0xc5f2('0x57')][_0xc5f2('0x59')],'action':_0x46f75b[_0xc5f2('0x57')]['action'],'actionIncomplete':_0x46f75b[_0xc5f2('0x57')][_0xc5f2('0x5a')],'speech':_0x46f75b[_0xc5f2('0x57')][_0xc5f2('0x5b')]['speech'],'score':_0x46f75b[_0xc5f2('0x57')]['score'],'statusCode':_0x46f75b['status'][_0xc5f2('0x5c')],'endConversation':_0x46f75b['result'][_0xc5f2('0x5d')]['endConversation']||![],'isFallbackIntent':_0x46f75b[_0xc5f2('0x57')][_0xc5f2('0x5d')]['isFallbackIntent']};});};exports[_0xc5f2('0x5e')]=function(_0x417d47,_0x17d941,_0x5cfb66,_0x5b2cba,_0x57d8d2,_0x4d988f){var _0x6c1dcb=_0x5b2cba[_0xc5f2('0x5f')](/\\n/g,'\x0a');var _0x4992be={'credentials':{'private_key':_0x6c1dcb,'client_email':_0x5cfb66}};var _0x3259e2=new dialogflow['SessionsClient'](_0x4992be);var _0xacc7f5=_0x3259e2[_0xc5f2('0x60')](_0x17d941,md5(_0x417d47));var _0x207a5a={'session':_0xacc7f5,'queryInput':{'text':{'text':_0x57d8d2,'languageCode':_0x4d988f}}};return _0x3259e2[_0xc5f2('0x61')](_0x207a5a)['then'](function(_0x3a0689){if(_0x3a0689&&_0x3a0689[_0xc5f2('0x44')]){logger[_0xc5f2('0x1d')](_0xc5f2('0x62'),JSON[_0xc5f2('0x3f')](_0x3a0689));var _0x39f83f=_0x3a0689[0x0];if(_0x39f83f){var _0x44a068={'action':_0x39f83f['queryResult'][_0xc5f2('0x63')],'allRequiredParamsPresent':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x65')],'endConversation':_0x39f83f['queryResult']['diagnosticInfo']&&_0x39f83f['queryResult'][_0xc5f2('0x66')]['fields']?_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x66')][_0xc5f2('0x67')][_0xc5f2('0x68')][_0xc5f2('0x69')]:![],'fulfillmentText':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x6a')],'intentName':_0x39f83f[_0xc5f2('0x64')]['intent'][_0xc5f2('0x53')],'intentDisplayName':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x6b')]['displayName'],'isFallbackIntent':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x6b')][_0xc5f2('0x6c')],'languageCode':_0x39f83f['queryResult']['languageCode'],'queryText':_0x39f83f[_0xc5f2('0x64')]['queryText'],'responseId':_0x39f83f['responseId'],'score':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x6d')],'speech':_0x39f83f[_0xc5f2('0x64')][_0xc5f2('0x6a')],'providerResponse':JSON['stringify'](_0x3a0689)};return _0x44a068;}}});};exports[_0xc5f2('0x6e')]=function(_0x2935a0,_0x5c1edc,_0x1fcbaa,_0x4a932a){return tilde['asr'](_0x2935a0,_0x5c1edc,_0x1fcbaa,_0x4a932a)[_0xc5f2('0x2d')](function(_0x4f7231){try{fs['unlink'](_0x2935a0);}catch(_0x4edbf9){logger['error'](_0x4edbf9);}logger[_0xc5f2('0x1d')](_0xc5f2('0x6f'),_0x4f7231['transcript']);logger[_0xc5f2('0x1d')]('Tilde\x20ASR\x20confidence',_0x4f7231[_0xc5f2('0x4d')]);return _0x4f7231;});};exports[_0xc5f2('0x70')]=function(_0x51354c,_0xa3bb9e,_0x429e80,_0x230a76,_0x772fac,_0x1c5e23){var _0x434a76=path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x46'));var _0x15aa7f;return aws[_0xc5f2('0x71')](_0x51354c,_0xa3bb9e,_0x429e80,_0x230a76,_0x772fac,_0x1c5e23,_0x434a76)['then'](function(){_0x15aa7f=path[_0xc5f2('0x28')](__dirname,'tmp',rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x39'));return convertFile(_0x434a76,_0x15aa7f);})[_0xc5f2('0x2d')](function(){try{fs['unlink'](_0x434a76);fs[_0xc5f2('0x2e')](_0x15aa7f,_0xc5f2('0x2f'));}catch(_0x576791){logger['error'](_0x576791);}return _0x15aa7f['split']('.')[0x0];});};exports[_0xc5f2('0x72')]=function(_0x131ab8,_0x4d1e54,_0x112f9d,_0x51d148,_0x1df725,_0x101ee5){return aws[_0xc5f2('0x73')](_0x131ab8,_0x4d1e54,_0x112f9d,_0x51d148,_0x1df725,_0x101ee5)[_0xc5f2('0x2d')](function(_0x32329d){logger[_0xc5f2('0x1d')](JSON['stringify'](_0x32329d));return _0x32329d;});};exports[_0xc5f2('0x74')]=function(_0x2742d3,_0x5180a5,_0x1915fd,_0x5a660a){var _0x23d8d7=util[_0xc5f2('0x75')](_0xc5f2('0x76'),ISPEECH_API,_0x2742d3,encodeURIComponent(_0x5180a5),_0x1915fd,_0x5a660a);var _0x1d5118=path[_0xc5f2('0x28')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x1bc07b;return downloadFile(_0x23d8d7,_0x1d5118)[_0xc5f2('0x2d')](function(){_0x1bc07b=path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x39'));return convertFile(_0x1d5118,_0x1bc07b);})['then'](function(){try{fs['unlink'](_0x1d5118);fs[_0xc5f2('0x2e')](_0x1bc07b,_0xc5f2('0x2f'));}catch(_0x39d258){logger[_0xc5f2('0x21')](_0x39d258);}return _0x1bc07b[_0xc5f2('0x30')]('.')[0x0];});};exports[_0xc5f2('0x77')]=function(_0x3a0f61,_0x4b4c0e,_0x39a86c,_0x32f220){var _0x1e0b6b=util['format'](_0xc5f2('0x78'),ISPEECH_API,_0x4b4c0e,_0x39a86c,base64Encode(_0x3a0f61),_0x32f220?util['format'](_0xc5f2('0x79'),encodeURIComponent(_0x32f220)):_0xc5f2('0x7a'));return uploadFile(_0x1e0b6b)['then'](function(_0x1bd0ac){return querystring[_0xc5f2('0xb')](_0x1bd0ac);});};exports['sestekNDA']=function(_0x1ca8b3,_0x1d9e7e){return sestek[_0xc5f2('0x7b')](_0x1ca8b3,_0x1d9e7e)[_0xc5f2('0x2d')](function(_0x20310){logger[_0xc5f2('0x1d')](JSON['stringify'](_0x20310));var _0x3d5677={'speech':_0x20310[_0xc5f2('0x7c')],'action':_0x20310[_0xc5f2('0x7d')]?_0x20310[_0xc5f2('0x7d')][_0xc5f2('0x7e')]:undefined,'actiondata':_0x20310[_0xc5f2('0x7d')]?_0x20310[_0xc5f2('0x7d')][_0xc5f2('0x7f')]:undefined};if(_0x20310[_0xc5f2('0x7d')]&&_0x20310[_0xc5f2('0x7d')][_0xc5f2('0x80')]){return base64Decode(_0x20310['channelData'][_0xc5f2('0x80')][_0xc5f2('0x81')],path[_0xc5f2('0x28')](__dirname,_0xc5f2('0x29'),rs[_0xc5f2('0x2a')](0x4)+_0xc5f2('0x39')))[_0xc5f2('0x2d')](function(_0x569919){_0x3d5677['audiofile']=_0x569919;return _0x3d5677;});}return _0x3d5677;});};exports[_0xc5f2('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x0b06=['finish\x20download\x20file','close','unlink','pipe','end','get','data','wav','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','chmodSync','777','split','readFileSync','toString','base64','?key=','ssml','input','POST','resolve','.mp3','from','audioContent','writeFile','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','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','text','channelData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','google-tts-api','url','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info'];(function(_0x3b6cb5,_0x337346){var _0x277e53=function(_0x4f78b4){while(--_0x4f78b4){_0x3b6cb5['push'](_0x3b6cb5['shift']());}};_0x277e53(++_0x337346);}(_0x0b06,0xe5));var _0x60b0=function(_0x58fa5d,_0x3a7145){_0x58fa5d=_0x58fa5d-0x0;var _0xacfcc1=_0x0b06[_0x58fa5d];return _0xacfcc1;};'use strict';var apiai=require(_0x60b0('0x0'));var BPromise=require(_0x60b0('0x1'));var dialogflow=require(_0x60b0('0x2'));var fs=require('fs');var http=require(_0x60b0('0x3'));var https=require('https');var md5=require(_0x60b0('0x4'));var path=require(_0x60b0('0x5'));var querystring=require(_0x60b0('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x60b0('0x7'));var urlParse=require(_0x60b0('0x8'))[_0x60b0('0x9')];var util=require(_0x60b0('0xa'));var aws=require(_0x60b0('0xb'));var google=require(_0x60b0('0xc'));var sestek=require(_0x60b0('0xd'));var tilde=require('./tilde');var logger=require(_0x60b0('0xe'))(_0x60b0('0xf'));var ISPEECH_API=_0x60b0('0x10');function downloadFile(_0x35665b,_0x590438){return new BPromise(function(_0x2aefc4,_0x952fb4){var _0x4c3a0e=urlParse(_0x35665b);var _0x262b65=_0x4c3a0e[_0x60b0('0x11')]===_0x60b0('0x12')?https:http;var _0x392a68={'host':_0x4c3a0e[_0x60b0('0x13')],'path':_0x4c3a0e[_0x60b0('0x5')],'headers':{'user-agent':_0x60b0('0x14')}};_0x262b65['get'](_0x392a68,function(_0x40625a){if(_0x40625a['statusCode']!==0xc8){logger[_0x60b0('0x15')](_0x60b0('0x16')+_0x35665b+_0x60b0('0x17')+_0x40625a[_0x60b0('0x18')]+'\x20('+_0x40625a[_0x60b0('0x19')]+')');_0x952fb4(new Error(_0x60b0('0x16')+_0x35665b+_0x60b0('0x17')+_0x40625a[_0x60b0('0x18')]+'\x20('+_0x40625a[_0x60b0('0x19')]+')'));return;}var _0x93d62c=fs[_0x60b0('0x1a')](_0x590438);_0x93d62c['on'](_0x60b0('0x1b'),function(){logger[_0x60b0('0x1c')](_0x60b0('0x1d'));_0x93d62c[_0x60b0('0x1e')](_0x2aefc4);});_0x93d62c['on'](_0x60b0('0x15'),function(_0x582d80){fs[_0x60b0('0x1f')](_0x590438);logger[_0x60b0('0x15')]('download\x20error',_0x582d80);_0x952fb4(_0x582d80);});_0x40625a[_0x60b0('0x20')](_0x93d62c);})['on'](_0x60b0('0x15'),function(_0x35ef37){logger[_0x60b0('0x15')](_0x35ef37);_0x952fb4(_0x35ef37);})[_0x60b0('0x21')]();});}function uploadFile(_0x257c18){return new BPromise(function(_0x5ed48e,_0x246951){var _0x365d98=urlParse(_0x257c18);var _0x25f6c8=_0x365d98[_0x60b0('0x11')]===_0x60b0('0x12')?https:http;var _0x438cfa={'host':_0x365d98[_0x60b0('0x13')],'path':_0x365d98[_0x60b0('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x25f6c8[_0x60b0('0x22')](_0x438cfa,function(_0x273274){if(_0x273274[_0x60b0('0x18')]!==0xc8){_0x246951(new Error(_0x60b0('0x16')+_0x257c18+_0x60b0('0x17')+_0x273274['statusCode']+'\x20('+_0x273274[_0x60b0('0x19')]+')'));return;}var _0x50ac23='';_0x273274['on'](_0x60b0('0x23'),function(_0x1a85dd){_0x50ac23+=_0x1a85dd;});_0x273274['on'](_0x60b0('0x21'),function(){_0x5ed48e(_0x50ac23);});})['on'](_0x60b0('0x15'),function(_0x5389f8){_0x246951(_0x5389f8);})['end']();});}function convertFile(_0x1d52b9,_0x27fb3c){return new BPromise(function(_0x3243af,_0xf8c404){var _0x4c63c4=sox['transcode'](_0x1d52b9,_0x27fb3c,{'sampleRate':0x1f40,'format':_0x60b0('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c63c4['on'](_0x60b0('0x15'),function(_0x5d1dd5){logger[_0x60b0('0x15')](_0x60b0('0x25'),_0x5d1dd5);_0xf8c404(_0x5d1dd5);});_0x4c63c4['on'](_0x60b0('0x21'),function(){logger[_0x60b0('0x1c')](_0x60b0('0x26'));_0x3243af();});_0x4c63c4['start']();});}function base64Decode(_0x13bf94,_0x200bbe){var _0x2ff11a=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x29'));fs['writeFileSync'](_0x2ff11a,_0x13bf94,'base64');return convertFile(_0x2ff11a,_0x200bbe)['then'](function(){try{fs[_0x60b0('0x1f')](_0x2ff11a);fs[_0x60b0('0x2a')](_0x200bbe,_0x60b0('0x2b'));}catch(_0x280e30){logger[_0x60b0('0x15')](_0x280e30);}return _0x200bbe[_0x60b0('0x2c')]('.')[0x0];});}function base64Encode(_0x4b1648){var _0x33bb30=fs[_0x60b0('0x2d')](_0x4b1648);return new Buffer(_0x33bb30)[_0x60b0('0x2e')](_0x60b0('0x2f'));}exports['googleCloudTTS']=function(_0x28ae86,_0x29e1e2,_0x4d6f25,_0x3c7198,_0x1a510e,_0xe9938e){var _0x55c70a,_0x3019fe;var _0x36ff24='https://texttospeech.googleapis.com/v1/';var _0x134b26=_0x60b0('0x30')+_0x28ae86;var _0x3f1d56={};if(_0x29e1e2===_0x60b0('0x31')){_0x3f1d56[_0x60b0('0x32')]={'ssml':_0x4d6f25};}else{_0x3f1d56[_0x60b0('0x32')]={'text':_0x4d6f25};};_0x3f1d56['voice']={'languageCode':_0x3c7198,'ssmlGender':_0x1a510e};_0x3f1d56['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4d56d3={'url':_0x36ff24+'text:synthesize'+_0x134b26,'method':_0x60b0('0x33'),'json':!![],'body':_0x3f1d56};return rp(_0x4d56d3)['then'](function(_0x391559){return new BPromise(function(_0x753317,_0x32a773){_0x55c70a=path[_0x60b0('0x34')](__dirname,'tmp',rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x10d5e8=Buffer[_0x60b0('0x36')](_0x391559[_0x60b0('0x37')],'base64');return fs[_0x60b0('0x38')](_0x55c70a,_0x10d5e8,function(_0x97e89c){_0x32a773(_0x97e89c);},function(_0x270444){fs[_0x60b0('0x2a')](_0x55c70a,'777');_0x753317(_0x270444);});});})[_0x60b0('0x39')](function(_0x5627be){_0x3019fe=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x55c70a,_0x3019fe);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x55c70a);fs[_0x60b0('0x2a')](_0x3019fe,'777');}catch(_0xd186fa){logger[_0x60b0('0x15')](_0xd186fa);}logger[_0x60b0('0x1c')](_0x60b0('0x3a'),_0x3019fe[_0x60b0('0x2c')]('.')[0x0]);return _0x3019fe['split']('.')[0x0];});};exports[_0x60b0('0x3b')]=function(_0x5c5001,_0x28098f){var _0x2ba8b7=_0x60b0('0x3c');var _0x2d76a1,_0x4490db;var _0x4775cf;var _0x3c33d2={'encoding':_0x60b0('0x3d'),'method':_0x60b0('0x33'),'timeout':0x2710,'url':_0x2ba8b7,'headers':{'Content-Type':_0x60b0('0x3e')},'body':_0x60b0('0x3f')+encodeURIComponent(JSON[_0x60b0('0x40')]([[[_0x60b0('0x41'),JSON[_0x60b0('0x40')]([_0x5c5001,_0x28098f||'en',![],'null']),null,_0x60b0('0x42')]]]))};return rp(_0x3c33d2)[_0x60b0('0x39')](function(_0x847eb6){try{_0x4775cf=eval(_0x847eb6['slice'](0x5))[0x0][0x2];}catch(_0x18e8cc){throw new Error('parse\x20response\x20failed:\x0a'+_0x847eb6[_0x60b0('0x23')]);}if(!_0x4775cf){if(_0x5c5001[_0x60b0('0x43')]>0xc8){throw new Error(_0x60b0('0x44'));}else{throw new Error('lang\x20\x22'+_0x28098f+_0x60b0('0x45'));}}try{_0x4775cf=eval(_0x4775cf)[0x0];}catch(_0x3b4480){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x60b0('0x23')]);}const _0xb38f46=_0x4775cf;_0x2d76a1=path[_0x60b0('0x34')](__dirname,'tmp',rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));fs[_0x60b0('0x46')](_0x2d76a1,_0x4775cf,{'encoding':_0x60b0('0x2f')});_0x4490db=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x2d76a1,_0x4490db);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x2d76a1);fs[_0x60b0('0x2a')](_0x4490db,_0x60b0('0x2b'));}catch(_0x126eb1){logger['error'](_0x126eb1);}logger[_0x60b0('0x1c')](_0x60b0('0x47'),_0x4490db[_0x60b0('0x2c')]('.')[0x0]);return _0x4490db[_0x60b0('0x2c')]('.')[0x0];});};exports[_0x60b0('0x48')]=function(_0x3004dc,_0x371743,_0x301e4d){return google[_0x60b0('0x49')](_0x3004dc,_0x371743,_0x301e4d)['then'](function(_0x2b7fbe){logger[_0x60b0('0x1c')](_0x2b7fbe['uri']);return rp(_0x2b7fbe);})[_0x60b0('0x39')](function(_0x45cc2c){var _0x14845a='';var _0x469114=0x0;try{fs['unlink'](_0x3004dc);}catch(_0x4d79a8){logger['error'](_0x4d79a8);}if(_0x45cc2c&&_0x45cc2c[_0x60b0('0x4a')]){_0x14845a=_0x45cc2c[_0x60b0('0x4a')]['map'](function(_0x57061f){return _0x57061f&&_0x57061f[_0x60b0('0x4b')][0x0]&&_0x57061f[_0x60b0('0x4b')][0x0][_0x60b0('0x4c')]?_0x57061f[_0x60b0('0x4b')][0x0]['transcript']:'';})[_0x60b0('0x4d')]('\x0a');_0x469114=_0x45cc2c[_0x60b0('0x4a')]['map'](function(_0x4a1d08){return _0x4a1d08&&_0x4a1d08[_0x60b0('0x4b')][0x0]&&_0x4a1d08[_0x60b0('0x4b')][0x0]['confidence']?_0x4a1d08[_0x60b0('0x4b')][0x0][_0x60b0('0x4e')]:0x0;})[_0x60b0('0x4d')]('\x0a');}logger[_0x60b0('0x1c')](_0x60b0('0x4f'),_0x14845a);logger[_0x60b0('0x1c')](_0x60b0('0x50'),_0x469114);return{'transcript':_0x14845a,'confidence':_0x469114};})[_0x60b0('0x51')](function(_0x433f16){logger[_0x60b0('0x15')](_0x60b0('0x52'),_0x433f16[_0x60b0('0x18')],_0x433f16['name'],_0x433f16[_0x60b0('0x53')]);});};exports[_0x60b0('0x54')]=function(_0x32921c,_0x228bb6,_0x2e6dda,_0x5d08d2){var _0x218c12=apiai(_0x228bb6,{'language':_0x5d08d2||'en'});return _0x218c12['textRequest'](_0x2e6dda,{'sessionId':md5(_0x32921c)})['then'](function(_0x1d2ab4){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x1d2ab4));return{'source':_0x1d2ab4['result'][_0x60b0('0x55')],'resolvedQuery':_0x1d2ab4['result'][_0x60b0('0x56')],'action':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x58')],'actionIncomplete':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x59')],'speech':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5a')][_0x60b0('0x5b')],'score':_0x1d2ab4[_0x60b0('0x57')]['score'],'statusCode':_0x1d2ab4[_0x60b0('0x5c')][_0x60b0('0x5d')],'endConversation':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5e')][_0x60b0('0x5f')]||![],'isFallbackIntent':_0x1d2ab4[_0x60b0('0x57')][_0x60b0('0x5e')][_0x60b0('0x60')]};});};exports[_0x60b0('0x61')]=function(_0x25e303,_0x1617e3,_0x3338b7,_0x33ba10,_0x306006,_0x1c4757){var _0x1960d6=_0x33ba10['replace'](/\\n/g,'\x0a');var _0x90a6ba={'credentials':{'private_key':_0x1960d6,'client_email':_0x3338b7}};var _0x3f4e44=new dialogflow[(_0x60b0('0x62'))](_0x90a6ba);var _0x18b946=_0x3f4e44['sessionPath'](_0x1617e3,md5(_0x25e303));var _0x3c5ca0={'session':_0x18b946,'queryInput':{'text':{'text':_0x306006,'languageCode':_0x1c4757}}};return _0x3f4e44[_0x60b0('0x63')](_0x3c5ca0)[_0x60b0('0x39')](function(_0x5c7851){if(_0x5c7851&&_0x5c7851[_0x60b0('0x43')]){logger[_0x60b0('0x1c')](_0x60b0('0x64'),JSON[_0x60b0('0x40')](_0x5c7851));var _0x1d9cb5=_0x5c7851[0x0];if(_0x1d9cb5){var _0xfedbd8={'action':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x58')],'allRequiredParamsPresent':_0x1d9cb5[_0x60b0('0x65')]['allRequiredParamsPresent'],'endConversation':_0x1d9cb5[_0x60b0('0x65')]['diagnosticInfo']&&_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x66')]['fields']?_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x66')][_0x60b0('0x67')][_0x60b0('0x68')][_0x60b0('0x69')]:![],'fulfillmentText':_0x1d9cb5[_0x60b0('0x65')]['fulfillmentText'],'intentName':_0x1d9cb5['queryResult']['intent']['name'],'intentDisplayName':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x6a')][_0x60b0('0x6b')],'isFallbackIntent':_0x1d9cb5['queryResult'][_0x60b0('0x6a')][_0x60b0('0x6c')],'languageCode':_0x1d9cb5[_0x60b0('0x65')]['languageCode'],'queryText':_0x1d9cb5['queryResult'][_0x60b0('0x6d')],'responseId':_0x1d9cb5[_0x60b0('0x6e')],'score':_0x1d9cb5['queryResult'][_0x60b0('0x6f')],'speech':_0x1d9cb5[_0x60b0('0x65')][_0x60b0('0x70')],'providerResponse':JSON[_0x60b0('0x40')](_0x5c7851)};return _0xfedbd8;}}});};exports['tildeASR']=function(_0x1dc05a,_0x2083f1,_0x95dd54,_0x565ca8){return tilde[_0x60b0('0x49')](_0x1dc05a,_0x2083f1,_0x95dd54,_0x565ca8)[_0x60b0('0x39')](function(_0x1e1e50){try{fs[_0x60b0('0x1f')](_0x1dc05a);}catch(_0x3fee49){logger[_0x60b0('0x15')](_0x3fee49);}logger[_0x60b0('0x1c')](_0x60b0('0x71'),_0x1e1e50[_0x60b0('0x4c')]);logger[_0x60b0('0x1c')]('Tilde\x20ASR\x20confidence',_0x1e1e50[_0x60b0('0x4e')]);return _0x1e1e50;});};exports[_0x60b0('0x72')]=function(_0x30258a,_0x7639bb,_0x574da4,_0x1c316f,_0x33088e,_0x31f569){var _0x44e7e6=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x1a90bc;return aws['polly'](_0x30258a,_0x7639bb,_0x574da4,_0x1c316f,_0x33088e,_0x31f569,_0x44e7e6)['then'](function(){_0x1a90bc=path[_0x60b0('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x60b0('0x29'));return convertFile(_0x44e7e6,_0x1a90bc);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x44e7e6);fs[_0x60b0('0x2a')](_0x1a90bc,_0x60b0('0x2b'));}catch(_0x1737d8){logger[_0x60b0('0x15')](_0x1737d8);}return _0x1a90bc['split']('.')[0x0];});};exports[_0x60b0('0x73')]=function(_0x3d30cd,_0x54706f,_0xce3a09,_0x572ae9,_0x397809,_0x5938e1){return aws[_0x60b0('0x74')](_0x3d30cd,_0x54706f,_0xce3a09,_0x572ae9,_0x397809,_0x5938e1)[_0x60b0('0x39')](function(_0x386568){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x386568));return _0x386568;});};exports['ispeechTTS']=function(_0x336892,_0x4118e5,_0x14c369,_0x368d78){var _0x4a30d9=util[_0x60b0('0x75')](_0x60b0('0x76'),ISPEECH_API,_0x336892,encodeURIComponent(_0x4118e5),_0x14c369,_0x368d78);var _0x2229f4=path['resolve'](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x35'));var _0x3ba818;return downloadFile(_0x4a30d9,_0x2229f4)[_0x60b0('0x39')](function(){_0x3ba818=path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+'.wav');return convertFile(_0x2229f4,_0x3ba818);})[_0x60b0('0x39')](function(){try{fs[_0x60b0('0x1f')](_0x2229f4);fs['chmodSync'](_0x3ba818,_0x60b0('0x2b'));}catch(_0x4adbbf){logger['error'](_0x4adbbf);}return _0x3ba818['split']('.')[0x0];});};exports[_0x60b0('0x77')]=function(_0x327939,_0x185b5f,_0x45acf9,_0xce825d){var _0x10d41b=util['format'](_0x60b0('0x78'),ISPEECH_API,_0x185b5f,_0x45acf9,base64Encode(_0x327939),_0xce825d?util['format'](_0x60b0('0x79'),encodeURIComponent(_0xce825d)):_0x60b0('0x7a'));return uploadFile(_0x10d41b)['then'](function(_0x1e78e3){return querystring[_0x60b0('0x9')](_0x1e78e3);});};exports[_0x60b0('0x7b')]=function(_0x53457b,_0x41979a){return sestek[_0x60b0('0x7c')](_0x53457b,_0x41979a)[_0x60b0('0x39')](function(_0x3d2f9e){logger[_0x60b0('0x1c')](JSON[_0x60b0('0x40')](_0x3d2f9e));var _0x581c3d={'speech':_0x3d2f9e[_0x60b0('0x7d')],'action':_0x3d2f9e[_0x60b0('0x7e')]?_0x3d2f9e[_0x60b0('0x7e')]['CustomAction']:undefined,'actiondata':_0x3d2f9e[_0x60b0('0x7e')]?_0x3d2f9e[_0x60b0('0x7e')]['CustomActionData']:undefined};if(_0x3d2f9e[_0x60b0('0x7e')]&&_0x3d2f9e['channelData'][_0x60b0('0x7f')]){return base64Decode(_0x3d2f9e[_0x60b0('0x7e')][_0x60b0('0x7f')][_0x60b0('0x80')],path[_0x60b0('0x34')](__dirname,_0x60b0('0x27'),rs[_0x60b0('0x28')](0x4)+_0x60b0('0x29')))[_0x60b0('0x39')](function(_0x2237a3){_0x581c3d['audiofile']=_0x2237a3;return _0x581c3d;});}return _0x581c3d;});};exports['dirName']=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 a408c91..7970aab 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 _0xaa4a=['exports'];(function(_0x2c4467,_0x37f2aa){var _0xfd3e14=function(_0x3b0b2b){while(--_0x3b0b2b){_0x2c4467['push'](_0x2c4467['shift']());}};_0xfd3e14(++_0x37f2aa);}(_0xaa4a,0x16b));var _0xaaa4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa4a[_0x14add3];return _0x4a174f;};var nda=require('./nda');module[_0xaaa4('0x0')]={'nda':nda}; \ No newline at end of file +var _0x6b76=['./nda'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6b76,0x146));var _0x66b7=function(_0x6520ad,_0x39a470){_0x6520ad=_0x6520ad-0x0;var _0x35d9f1=_0x6b76[_0x6520ad];return _0x35d9f1;};var nda=require(_0x66b7('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 3c4cfa4..0bd8c79 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 _0x6282=['message','Nda','uniqueid','callerid','calleridname','dnid','extension','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x304976,_0x14432b){var _0xb73047=function(_0x5d4e01){while(--_0x5d4e01){_0x304976['push'](_0x304976['shift']());}};_0xb73047(++_0x14432b);}(_0x6282,0x76));var _0x2628=function(_0x44dd2e,_0x26dd64){_0x44dd2e=_0x44dd2e-0x0;var _0x4ce541=_0x6282[_0x44dd2e];return _0x4ce541;};'use strict';var rp=require(_0x2628('0x0'));var url=require(_0x2628('0x1'));var logger=require(_0x2628('0x2'))(_0x2628('0x3'));module['exports']=function(_0x50e40f,_0x126d9a){var _0xc5c0c7={'method':'POST','uri':url[_0x2628('0x4')](_0x126d9a[_0x2628('0x5')],_0x2628('0x6')),'form':{'grant_type':_0x2628('0x7'),'username':_0x126d9a[_0x2628('0x8')],'password':_0x126d9a['password']},'json':!![]};return rp(_0xc5c0c7)[_0x2628('0x9')](function(_0x144ae8){var _0x2170a7={'method':_0x2628('0xa'),'uri':url[_0x2628('0x4')](_0x126d9a[_0x2628('0xb')],_0x2628('0xc')),'body':{'type':_0x126d9a[_0x2628('0xd')]||_0x2628('0xe'),'channelId':_0x2628('0xf'),'conversation':{'id':_0x50e40f[_0x2628('0x10')]},'from':{'id':_0x50e40f[_0x2628('0x11')],'name':_0x50e40f[_0x2628('0x12')]},'recipient':{'id':_0x50e40f[_0x2628('0x13')],'name':_0x50e40f[_0x2628('0x14')]},'text':_0x126d9a['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x144ae8[_0x2628('0x15')]},'json':!![]};if(_0x126d9a[_0x2628('0x16')]){_0x2170a7[_0x2628('0x17')][_0x2628('0x18')]['ProjectName']=_0x126d9a['project'];}if(_0x126d9a[_0x2628('0x19')]=='1'){_0x2170a7[_0x2628('0x17')][_0x2628('0x18')][_0x2628('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2628('0x1b')};}if(_0x126d9a['custom_action']){_0x2170a7[_0x2628('0x17')][_0x2628('0x18')][_0x2628('0x1c')]=_0x126d9a['custom_action'];if(_0x126d9a[_0x2628('0x1d')]){_0x2170a7[_0x2628('0x17')]['channelData'][_0x2628('0x1e')]=_0x126d9a['custom_action_data'];}}logger[_0x2628('0x1f')](JSON[_0x2628('0x20')](_0x2170a7));return rp(_0x2170a7);});}; \ No newline at end of file +var _0xc7a7=['custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings'];(function(_0x6d8765,_0x18f49a){var _0x385d34=function(_0x22ece8){while(--_0x22ece8){_0x6d8765['push'](_0x6d8765['shift']());}};_0x385d34(++_0x18f49a);}(_0xc7a7,0x171));var _0x7c7a=function(_0x495e46,_0x4bc819){_0x495e46=_0x495e46-0x0;var _0xab9d43=_0xc7a7[_0x495e46];return _0xab9d43;};'use strict';var rp=require(_0x7c7a('0x0'));var url=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('agi');module[_0x7c7a('0x3')]=function(_0x243925,_0x5c030a){var _0x2614cf={'method':_0x7c7a('0x4'),'uri':url[_0x7c7a('0x5')](_0x5c030a[_0x7c7a('0x6')],_0x7c7a('0x7')),'form':{'grant_type':_0x7c7a('0x8'),'username':_0x5c030a[_0x7c7a('0x9')],'password':_0x5c030a[_0x7c7a('0x8')]},'json':!![]};return rp(_0x2614cf)['then'](function(_0x361567){var _0x43e2af={'method':_0x7c7a('0x4'),'uri':url['resolve'](_0x5c030a[_0x7c7a('0xa')],_0x7c7a('0xb')),'body':{'type':_0x5c030a[_0x7c7a('0xc')]||_0x7c7a('0xd'),'channelId':_0x7c7a('0xe'),'conversation':{'id':_0x243925[_0x7c7a('0xf')]},'from':{'id':_0x243925[_0x7c7a('0x10')],'name':_0x243925[_0x7c7a('0x11')]},'recipient':{'id':_0x243925['dnid'],'name':_0x243925[_0x7c7a('0x12')]},'text':_0x5c030a[_0x7c7a('0x13')],'channelData':{}},'headers':{'Authorization':_0x7c7a('0x14')+_0x361567[_0x7c7a('0x15')]},'json':!![]};if(_0x5c030a[_0x7c7a('0x16')]){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')]['ProjectName']=_0x5c030a[_0x7c7a('0x16')];}if(_0x5c030a[_0x7c7a('0x19')]=='1'){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')][_0x7c7a('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5c030a[_0x7c7a('0x1b')]){_0x43e2af['body'][_0x7c7a('0x18')][_0x7c7a('0x1c')]=_0x5c030a[_0x7c7a('0x1b')];if(_0x5c030a[_0x7c7a('0x1d')]){_0x43e2af[_0x7c7a('0x17')][_0x7c7a('0x18')][_0x7c7a('0x1e')]=_0x5c030a[_0x7c7a('0x1d')];}}logger[_0x7c7a('0x1f')](JSON[_0x7c7a('0x20')](_0x43e2af));return rp(_0x43e2af);});}; \ 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 3ae246c..c49ec18 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 _0xa277=['./lib/api','exports'];(function(_0x5e5e19,_0x295b4e){var _0x15b097=function(_0x1f7499){while(--_0x1f7499){_0x5e5e19['push'](_0x5e5e19['shift']());}};_0x15b097(++_0x295b4e);}(_0xa277,0x13c));var _0x7a27=function(_0x349afc,_0x5b0dbe){_0x349afc=_0x349afc-0x0;var _0x3481b6=_0xa277[_0x349afc];return _0x3481b6;};'use strict';var asr=require(_0x7a27('0x0'));module[_0x7a27('0x1')]=function(_0x3db15c,_0x361238,_0x2fc50b,_0x39d0f1){return asr(_0x3db15c,_0x361238,_0x2fc50b,_0x39d0f1);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x151c30,_0x16f9bb,_0x4d6b8a,_0x456b66){return asr(_0x151c30,_0x16f9bb,_0x4d6b8a,_0x456b66);}; \ 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 245cd65..2e30166 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 _0xf633=['error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','unix','createReadStream','data','send','close','EOS'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf633,0x14d));var _0x3f63=function(_0x504dbb,_0x3b7737){_0x504dbb=_0x504dbb-0x0;var _0x3c4b19=_0xf633[_0x504dbb];return _0x3c4b19;};'use strict';var BPromise=require('bluebird');var _=require(_0x3f63('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3f63('0x1'));var crypto=require('crypto');var logger=require(_0x3f63('0x2'))(_0x3f63('0x3'));module[_0x3f63('0x4')]=function(_0xeedee7,_0x9e71b9,_0x32d412,_0xb0d9e5){return new BPromise(function(_0x184435,_0x47643a){logger[_0x3f63('0x5')](_0x3f63('0x6'),_0xb0d9e5||_0x3f63('0x7'));var _0x50e7bc=new WebSocket(_0xb0d9e5||_0x3f63('0x7'),{'perMessageDeflate':![]});var _0x482bec='';var _0x5b304c='0';var _0x198fd3='1';var _0x56367b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4cdf5a(_0x597d6b){var _0x3c2584=crypto[_0x3f63('0x8')](_0x3f63('0x9'));_0x3c2584[_0x3f63('0xa')](_0x597d6b);return _0x3c2584[_0x3f63('0xb')]('hex');}function _0x2d7ba4(){try{logger[_0x3f63('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x37b4a9=moment()[_0x3f63('0xc')]();var _0x2415f3=_0x4cdf5a(_0x37b4a9+_0x9e71b9+_0x32d412);_0x50e7bc['send'](JSON['stringify']({'appID':_0x9e71b9,'timestamp':_0x37b4a9,'appKey':_0x2415f3}));var _0x40b0d6=fs[_0x3f63('0xd')](_0xeedee7);_0x40b0d6['on'](_0x3f63('0xe'),function(_0x219210){_0x50e7bc[_0x3f63('0xf')](_0x219210);});_0x40b0d6['on'](_0x3f63('0x10'),function(){_0x50e7bc[_0x3f63('0xf')](_0x3f63('0x11'));});}catch(_0x5030ef){logger[_0x3f63('0x12')](_0x3f63('0x13'),JSON['stringify'](_0x5030ef));_0x50e7bc[_0x3f63('0x14')]();}}function _0x45eb55(_0x3c49e2){try{if(_0x3c49e2){var _0x3cc39f=JSON[_0x3f63('0x15')](_0x3c49e2);switch(_0x3cc39f['status']){case 0x0:if(_0x3cc39f[_0x3f63('0x16')]){if(_0x3cc39f[_0x3f63('0x16')][_0x3f63('0x17')]){logger[_0x3f63('0x5')](_0x3f63('0x18'),JSON[_0x3f63('0x19')](_0x3cc39f[_0x3f63('0x16')][_0x3f63('0x1a')]));_0x482bec=_0x3cc39f['result'][_0x3f63('0x1a')][0x0]['transcript'];_0x5b304c=_0x3cc39f[_0x3f63('0x16')][_0x3f63('0x1a')][0x0][_0x3f63('0x1b')];_0x198fd3='0';_0x56367b=_0x3f63('0x1c');_0x50e7bc['terminate']();}}break;case 0x1:logger['info'](_0x3f63('0x1d'));_0x198fd3='1';_0x56367b=_0x3f63('0x1d');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x198fd3='2';_0x56367b=_0x3f63('0x1e');break;case 0x9:logger[_0x3f63('0x5')](_0x3f63('0x1f'));_0x198fd3='9';_0x56367b=_0x3f63('0x1f');break;case 0xa:logger[_0x3f63('0x5')](_0x3f63('0x20'));_0x198fd3='10';_0x56367b=_0x3f63('0x20');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x198fd3='11';_0x56367b=_0x3f63('0x21');}}}catch(_0x54d2d8){logger['error'](_0x3f63('0x22'),JSON['stringify'](_0x54d2d8));_0x50e7bc[_0x3f63('0x14')]();}}function _0xa5a929(){logger[_0x3f63('0x5')](_0x3f63('0x23'));_0x184435({'transcript':_0x482bec,'confidence':_0x5b304c,'status':_0x198fd3,'status_message':_0x56367b});}function _0x5cce4a(_0x409d87){logger['error'](_0x3f63('0x24'));if(!_['isNil'](_0x409d87)){logger[_0x3f63('0x12')](_[_0x3f63('0x25')](_0x409d87)?JSON[_0x3f63('0x19')](_0x409d87):_0x409d87);}}_0x50e7bc['on']('open',_0x2d7ba4);_0x50e7bc['on'](_0x3f63('0x26'),_0x45eb55);_0x50e7bc['on'](_0x3f63('0x10'),_0xa5a929);_0x50e7bc['on']('error',_0x5cce4a);});}; \ No newline at end of file +var _0x5d7e=['createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','moment','../../../../../../config/logger','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send'];(function(_0x3f5584,_0x3edcf1){var _0x179661=function(_0x2d29e7){while(--_0x2d29e7){_0x3f5584['push'](_0x3f5584['shift']());}};_0x179661(++_0x3edcf1);}(_0x5d7e,0x13f));var _0xe5d7=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0x5d7e[_0x2e3107];return _0x833d69;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe5d7('0x0'));var crypto=require('crypto');var logger=require(_0xe5d7('0x1'))('agi');module[_0xe5d7('0x2')]=function(_0x3c272d,_0xbdff7a,_0x1a157d,_0x2c5ad8){return new BPromise(function(_0x4a7439,_0x446218){logger[_0xe5d7('0x3')]('Tilde\x20URI',_0x2c5ad8||_0xe5d7('0x4'));var _0x4cd1a6=new WebSocket(_0x2c5ad8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x5cfc7f='';var _0x4b84a9='0';var _0x1c899d='1';var _0x4c875a=_0xe5d7('0x5');function _0x2fdef0(_0x50442d){var _0x31631b=crypto['createHash']('sha1');_0x31631b[_0xe5d7('0x6')](_0x50442d);return _0x31631b['digest'](_0xe5d7('0x7'));}function _0x323bfd(){try{logger[_0xe5d7('0x3')](_0xe5d7('0x8'));var _0x4711ee=moment()[_0xe5d7('0x9')]();var _0x2ef7e8=_0x2fdef0(_0x4711ee+_0xbdff7a+_0x1a157d);_0x4cd1a6[_0xe5d7('0xa')](JSON['stringify']({'appID':_0xbdff7a,'timestamp':_0x4711ee,'appKey':_0x2ef7e8}));var _0x39d00e=fs[_0xe5d7('0xb')](_0x3c272d);_0x39d00e['on']('data',function(_0x3c15c4){_0x4cd1a6[_0xe5d7('0xa')](_0x3c15c4);});_0x39d00e['on'](_0xe5d7('0xc'),function(){_0x4cd1a6[_0xe5d7('0xa')](_0xe5d7('0xd'));});}catch(_0x136d7d){logger[_0xe5d7('0xe')](_0xe5d7('0xf'),JSON[_0xe5d7('0x10')](_0x136d7d));_0x4cd1a6[_0xe5d7('0x11')]();}}function _0x11f6d3(_0x3cd0a2){try{if(_0x3cd0a2){var _0x63112c=JSON['parse'](_0x3cd0a2);switch(_0x63112c[_0xe5d7('0x12')]){case 0x0:if(_0x63112c[_0xe5d7('0x13')]){if(_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x14')]){logger[_0xe5d7('0x3')]('Tilde\x20ASR\x20hypoteses',JSON[_0xe5d7('0x10')](_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')]));_0x5cfc7f=_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')][0x0][_0xe5d7('0x16')];_0x4b84a9=_0x63112c[_0xe5d7('0x13')][_0xe5d7('0x15')][0x0][_0xe5d7('0x17')];_0x1c899d='0';_0x4c875a=_0xe5d7('0x18');_0x4cd1a6[_0xe5d7('0x11')]();}}break;case 0x1:logger[_0xe5d7('0x3')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1c899d='1';_0x4c875a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xe5d7('0x3')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x1c899d='2';_0x4c875a=_0xe5d7('0x19');break;case 0x9:logger[_0xe5d7('0x3')](_0xe5d7('0x1a'));_0x1c899d='9';_0x4c875a=_0xe5d7('0x1a');break;case 0xa:logger[_0xe5d7('0x3')]('Authentication\x20failed.');_0x1c899d='10';_0x4c875a='Authentication\x20failed.';break;case 0xb:logger['info'](_0xe5d7('0x1b'));_0x1c899d='11';_0x4c875a=_0xe5d7('0x1b');}}}catch(_0x4f685e){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x4f685e));_0x4cd1a6['terminate']();}}function _0x945fdc(){logger['info'](_0xe5d7('0x1c'));_0x4a7439({'transcript':_0x5cfc7f,'confidence':_0x4b84a9,'status':_0x1c899d,'status_message':_0x4c875a});}function _0xe9c8f9(_0x71114a){logger['error'](_0xe5d7('0x1d'));if(!_[_0xe5d7('0x1e')](_0x71114a)){logger['error'](_['isObject'](_0x71114a)?JSON[_0xe5d7('0x10')](_0x71114a):_0x71114a);}}_0x4cd1a6['on'](_0xe5d7('0x1f'),_0x323bfd);_0x4cd1a6['on'](_0xe5d7('0x20'),_0x11f6d3);_0x4cd1a6['on']('close',_0x945fdc);_0x4cd1a6['on'](_0xe5d7('0xe'),_0xe9c8f9);});}; \ 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 d555c73..995d373 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 _0xca89=['exports'];(function(_0x14ab4e,_0x4333f7){var _0xa45831=function(_0x8a13b7){while(--_0x8a13b7){_0x14ab4e['push'](_0x14ab4e['shift']());}};_0xa45831(++_0x4333f7);}(_0xca89,0xc9));var _0x9ca8=function(_0x5c8ca2,_0x161608){_0x5c8ca2=_0x5c8ca2-0x0;var _0x184a8c=_0xca89[_0x5c8ca2];return _0x184a8c;};var asr=require('./asr');module[_0x9ca8('0x0')]={'asr':asr}; \ No newline at end of file +var _0xc693=['./asr','exports'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xc693,0x186));var _0x3c69=function(_0x377c42,_0x3aa8a4){_0x377c42=_0x377c42-0x0;var _0x3fa1f8=_0xc693[_0x377c42];return _0x3fa1f8;};var asr=require(_0x3c69('0x0'));module[_0x3c69('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6b2843f..e03b775 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 _0x3fd0=['E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','EventEmitter','./error','./channel','emit','error','E_AGI_ARGUMENT_PORT','listen','listening'];(function(_0x26fc81,_0x57fc19){var _0x9feece=function(_0x4344c3){while(--_0x4344c3){_0x26fc81['push'](_0x26fc81['shift']());}};_0x9feece(++_0x57fc19);}(_0x3fd0,0x1d8));var _0x03fd=function(_0x519f3c,_0x547f8e){_0x519f3c=_0x519f3c-0x0;var _0x1c6a46=_0x3fd0[_0x519f3c];return _0x1c6a46;};'use strict';var util=require(_0x03fd('0x0'));var net=require(_0x03fd('0x1'));var EventEmitter=require(_0x03fd('0x2'))[_0x03fd('0x3')];var AGIError=require(_0x03fd('0x4'));var AGIChannel=require(_0x03fd('0x5'));var AGIServer=function(_0x5bfa21,_0x310047,_0x413591){var _0x20dbf8=this,_0x5bfa21=_0x5bfa21||0x11dd,_0x310047=_0x310047||'127.0.0.1',_0x3804e5=null,_0x55c2cd=0x0;EventEmitter['call'](_0x20dbf8);function _0xe762a0(){if(!_0x5bfa21){_0x20dbf8[_0x03fd('0x6')](_0x03fd('0x7'),new AGIError(_0x03fd('0x8')));return![];}_0x3804e5=net['createServer']();_0x3804e5[_0x03fd('0x9')](_0x5bfa21,_0x310047);_0x3804e5['on'](_0x03fd('0xa'),function(){_0x20dbf8[_0x03fd('0x6')](_0x03fd('0xa'));});_0x3804e5['on']('connection',function(_0x8e45df){_0x3804e5['getConnections'](function(_0x57b6b1,_0x477a99){if(_0x57b6b1){_0x20dbf8[_0x03fd('0x6')](_0x03fd('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x57b6b1));}else if(_0x413591&&_0x413591<0x0){_0x20dbf8[_0x03fd('0x6')](_0x03fd('0x7'),new AGIError(_0x03fd('0xb')));_0x8e45df[_0x03fd('0xc')]();}else if(_0x413591&&_0x413591>0x0&&_0x413591<_0x477a99){_0x55c2cd+=0x1;_0x20dbf8[_0x03fd('0x6')](_0x03fd('0x7'),new AGIError(_0x03fd('0xd'),_0x55c2cd));_0x8e45df[_0x03fd('0xc')]();}else{var _0x3a7374=new AGIChannel(_0x8e45df);_0x3a7374['on'](_0x03fd('0xe'),function(){_0x20dbf8[_0x03fd('0x6')]('connection',_0x3a7374);});}});});_0x3804e5['on']('error',function(_0x49d74c){_0x20dbf8[_0x03fd('0x6')]('error',new AGIError(_0x03fd('0xf'),_0x49d74c[_0x03fd('0x10')]));});_0x3804e5['on']('close',function(){_0x20dbf8[_0x03fd('0x6')](_0x03fd('0x11'),new AGIError(_0x03fd('0x12')));});}process[_0x03fd('0x13')](function(){_0xe762a0();});};util[_0x03fd('0x14')](AGIServer,EventEmitter);module['exports']=function(_0xaacda8,_0xb3bc01,_0x39ea95){return new AGIServer(_0xaacda8,_0xb3bc01,_0x39ea95);}; \ No newline at end of file +var _0x5e05=['./error','./channel','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events'];(function(_0x490dbd,_0x5e4c05){var _0x23a4b9=function(_0x371127){while(--_0x371127){_0x490dbd['push'](_0x490dbd['shift']());}};_0x23a4b9(++_0x5e4c05);}(_0x5e05,0x132));var _0x55e0=function(_0x331ac5,_0x33b3b0){_0x331ac5=_0x331ac5-0x0;var _0x229961=_0x5e05[_0x331ac5];return _0x229961;};'use strict';var util=require('util');var net=require(_0x55e0('0x0'));var EventEmitter=require(_0x55e0('0x1'))['EventEmitter'];var AGIError=require(_0x55e0('0x2'));var AGIChannel=require(_0x55e0('0x3'));var AGIServer=function(_0x4c5a65,_0x2b1493,_0x7cb21a){var _0x415bc5=this,_0x4c5a65=_0x4c5a65||0x11dd,_0x2b1493=_0x2b1493||'127.0.0.1',_0x496a50=null,_0x32d216=0x0;EventEmitter['call'](_0x415bc5);function _0x2d6ebf(){if(!_0x4c5a65){_0x415bc5[_0x55e0('0x4')]('error',new AGIError(_0x55e0('0x5')));return![];}_0x496a50=net[_0x55e0('0x6')]();_0x496a50[_0x55e0('0x7')](_0x4c5a65,_0x2b1493);_0x496a50['on'](_0x55e0('0x8'),function(){_0x415bc5['emit'](_0x55e0('0x8'));});_0x496a50['on'](_0x55e0('0x9'),function(_0x20efcb){_0x496a50[_0x55e0('0xa')](function(_0x4b2947,_0x5da8a3){if(_0x4b2947){_0x415bc5[_0x55e0('0x4')](_0x55e0('0xb'),new AGIError(_0x55e0('0xc'),_0x4b2947));}else if(_0x7cb21a&&_0x7cb21a<0x0){_0x415bc5[_0x55e0('0x4')]('error',new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x20efcb[_0x55e0('0xd')]();}else if(_0x7cb21a&&_0x7cb21a>0x0&&_0x7cb21a<_0x5da8a3){_0x32d216+=0x1;_0x415bc5[_0x55e0('0x4')](_0x55e0('0xb'),new AGIError(_0x55e0('0xe'),_0x32d216));_0x20efcb[_0x55e0('0xd')]();}else{var _0x24bd8f=new AGIChannel(_0x20efcb);_0x24bd8f['on'](_0x55e0('0xf'),function(){_0x415bc5['emit']('connection',_0x24bd8f);});}});});_0x496a50['on'](_0x55e0('0xb'),function(_0x7cd5d4){_0x415bc5['emit'](_0x55e0('0xb'),new AGIError(_0x55e0('0xc'),_0x7cd5d4[_0x55e0('0x10')]));});_0x496a50['on'](_0x55e0('0x11'),function(){_0x415bc5['emit'](_0x55e0('0x11'),new AGIError(_0x55e0('0x12')));});}process[_0x55e0('0x13')](function(){_0x2d6ebf();});};util[_0x55e0('0x14')](AGIServer,EventEmitter);module[_0x55e0('0x15')]=function(_0x54cdad,_0x518f26,_0x3ca67b){return new AGIServer(_0x54cdad,_0x518f26,_0x3ca67b);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 49c9ec5..1587cb2 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 _0xfd07=['add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','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','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','DialogflowV2\x20is\x20unreachable','sesteknda','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','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','SIP/%s/%s','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','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','no\x20file\x20audio\x20selected','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','replaceAll','join','util','lodash','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','name','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','toUpperCase','body','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','split','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','agi','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'];(function(_0x242f47,_0x350d39){var _0x2102f3=function(_0x108418){while(--_0x108418){_0x242f47['push'](_0x242f47['shift']());}};_0x2102f3(++_0x350d39);}(_0xfd07,0x104));var _0x7fd0=function(_0x2e2334,_0x8ffa8b){_0x2e2334=_0x2e2334-0x0;var _0x31991c=_0xfd07[_0x2e2334];return _0x31991c;};'use strict';var fs=require('fs');var util=require(_0x7fd0('0x0'));var _=require(_0x7fd0('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x7fd0('0x2'));var rp=require(_0x7fd0('0x3'));var logger=require(_0x7fd0('0x4'))('agi');var config=require('../../config/environment');var shared=require(_0x7fd0('0x5'));var scripts=require(_0x7fd0('0x6'));var FILES_PATH=_0x7fd0('0x7');var recursiveMapAttributes=[_0x7fd0('0x8'),'rawBody'];var verticesWithRetry=[_0x7fd0('0x9'),_0x7fd0('0xa'),_0x7fd0('0xb')];var AGIVertices=function(_0x5960c4,_0x4dfb73,_0x27aa04){this['channel']=_0x5960c4;this[_0x7fd0('0xc')]=_0x4dfb73;this[_0x7fd0('0xd')]=_0x27aa04;};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xf')]=function(_0x441f63,_0x13d641){this[_0x7fd0('0xc')][_0x7fd0('0x10')](_0x441f63)[_0x7fd0('0x11')](function(_0x5d4afa){_0x13d641(null,_0x5d4afa?_0x5d4afa['name']:![]);})[_0x7fd0('0x12')](function(_0x465326){_0x13d641(_0x465326);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x13')]=function(_0x15ba65,_0x463526){this[_0x7fd0('0xc')]['getVoiceQueueById'](_0x15ba65)[_0x7fd0('0x11')](function(_0x407ae9){_0x463526(null,_0x407ae9?_0x407ae9[_0x7fd0('0x14')]:![]);})[_0x7fd0('0x12')](function(_0x2ab283){_0x463526(_0x2ab283);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x15')]=function(_0x1adf5d,_0x5ca99d){this[_0x7fd0('0xc')][_0x7fd0('0x16')](_0x1adf5d)['then'](function(_0x46741d){_0x5ca99d(null,_0x46741d?_0x46741d[_0x7fd0('0x14')]:![]);})[_0x7fd0('0x12')](function(_0x1db0e6){_0x5ca99d(_0x1db0e6);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x17')]=function(_0x458622,_0x330087){this[_0x7fd0('0xc')]['getSquareOdbcById'](_0x458622)[_0x7fd0('0x11')](function(_0x1ec783){_0x330087(null,_0x1ec783?_0x1ec783[_0x7fd0('0x18')]:![]);})['catch'](function(_0x30d9d6){_0x330087(_0x30d9d6);});};AGIVertices[_0x7fd0('0xe')]['getUser']=function(_0x19b2e3,_0xdd4a81){this[_0x7fd0('0xc')][_0x7fd0('0x19')](_0x19b2e3)[_0x7fd0('0x11')](function(_0x3090a6){_0xdd4a81(null,_0x3090a6?_0x3090a6[_0x7fd0('0x14')]:![]);})[_0x7fd0('0x12')](function(_0x39a23a){_0xdd4a81(_0x39a23a);});};AGIVertices[_0x7fd0('0xe')]['getTrunk']=function(_0x2bd958,_0x383d91){this['rpc'][_0x7fd0('0x1a')](_0x2bd958)[_0x7fd0('0x11')](function(_0x55cd93){_0x383d91(null,_0x55cd93?_0x55cd93[_0x7fd0('0x14')]:![]);})[_0x7fd0('0x12')](function(_0x4a80ee){_0x383d91(_0x4a80ee);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1b')]=function(_0x187102,_0x21297d){var _0x80b765=this;this[_0x7fd0('0xc')][_0x7fd0('0x1c')](_0x187102)['then'](function(_0x2279bc){_0x21297d(null,_0x2279bc?_0x80b765[_0x7fd0('0x1d')](_0x2279bc[_0x7fd0('0x1e')]):![]);})[_0x7fd0('0x12')](function(_0x23cbf0){_0x21297d(_0x23cbf0);});};AGIVertices[_0x7fd0('0xe')]['getMailAccount']=function(_0x1ab26c,_0x4c0012){this[_0x7fd0('0xc')][_0x7fd0('0x1f')](_0x1ab26c)[_0x7fd0('0x11')](function(_0x13e3bd){_0x4c0012(null,_0x13e3bd?_0x13e3bd:![]);})['catch'](function(_0x2d09cc){_0x4c0012(_0x2d09cc);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x20')]=function(_0x3448e8,_0x232581,_0x4abc5d){this[_0x7fd0('0xd')][_0x7fd0('0x20')](_0x3448e8,_0x232581)[_0x7fd0('0x11')](function(){_0x4abc5d(null);})[_0x7fd0('0x12')](function(_0x277924){_0x4abc5d(_0x277924);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x21')]=function(_0x260d54,_0x4af363){this[_0x7fd0('0xc')][_0x7fd0('0x22')](_0x260d54)['then'](function(_0x29de2b){if(_0x29de2b){if(_0x29de2b[_0x7fd0('0x23')]){_0x4af363(null,[_0x29de2b[_0x7fd0('0x24')]]);}else{_0x4af363(null,_[_0x7fd0('0x25')](_0x29de2b[_0x7fd0('0x26')],_0x7fd0('0x24')));}}else{_0x4af363(null,![]);}})['catch'](function(_0x34524c){_0x4af363(_0x34524c);});};AGIVertices[_0x7fd0('0xe')]['getSoundPath']=function(_0x348263){return util[_0x7fd0('0x27')](_0x7fd0('0x28'),FILES_PATH,_0x348263);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x29')]=function(_0x344bb1,_0x4db0a5,_0x59bc3f){odbc[_0x7fd0('0x2a')](_0x344bb1,function(_0x33ac7a){if(_0x33ac7a){logger[_0x7fd0('0x2b')](_0x7fd0('0x2c'),_0x33ac7a);_0x59bc3f(_0x33ac7a);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x7fd0('0x2d')](_0x4db0a5,function(_0xba1eb2,_0x21b14a){if(_0xba1eb2){logger[_0x7fd0('0x2e')](_0x7fd0('0x2f'),_0x4db0a5);_0x59bc3f(_0xba1eb2);}else{logger['info'](_0x7fd0('0x30'),_0x4db0a5);odbc[_0x7fd0('0x31')](function(_0x350e0a){if(_0x350e0a){logger['error'](_0x7fd0('0x32'),_0x350e0a);}_0x59bc3f(null,_0x21b14a);});}});}});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x33')]=function(_0x54f5be,_0x26a871){this['rpc'][_0x7fd0('0x34')](_0x54f5be)['then'](function(_0xd89029){_0x26a871(null,_0xd89029?_0xd89029:![]);})[_0x7fd0('0x12')](function(_0x405b11){_0x26a871(_0x405b11);});};AGIVertices[_0x7fd0('0xe')]['createSmsMessage']=function(_0x1d1278,_0x5a6ac2){this[_0x7fd0('0xc')][_0x7fd0('0x35')](_0x1d1278)[_0x7fd0('0x11')](function(_0x1a5ae0){_0x5a6ac2(null,_0x1a5ae0);})['catch'](function(_0x2dbfad){_0x5a6ac2(_0x2dbfad);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x36')]=function(_0x2005bf,_0x5c437b,_0x3823c7){this[_0x7fd0('0xc')][_0x7fd0('0x36')]({'uniqueid':this['channel'][_0x7fd0('0x37')],'node':_0x2005bf[_0x7fd0('0x38')],'application':_0x2005bf[_0x7fd0('0x39')],'data':_0x5c437b||null,'project_name':this[_0x7fd0('0x3a')][_0x7fd0('0x3b')],'callerid':this[_0x7fd0('0x3a')]['callerid']})[_0x7fd0('0x11')](function(_0x82bb2d){if(_0x3823c7){_0x3823c7(null,_0x82bb2d);}})[_0x7fd0('0x12')](function(_0x5b57ba){if(_0x3823c7){_0x3823c7(_0x5b57ba);}});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x3c')]=function(_0x58c080,_0x351f05,_0x582e94,_0x5193a9){this['rpc'][_0x7fd0('0x3c')]({'uniqueid':this[_0x7fd0('0x3a')]['uniqueid'],'callerid':this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],'calleridname':this[_0x7fd0('0x3a')][_0x7fd0('0x3e')],'context':this['channel'][_0x7fd0('0x3f')],'extension':this[_0x7fd0('0x3a')][_0x7fd0('0x40')],'priority':this[_0x7fd0('0x3a')][_0x7fd0('0x41')],'accountcode':this[_0x7fd0('0x3a')][_0x7fd0('0x42')],'dnid':this[_0x7fd0('0x3a')][_0x7fd0('0x43')],'projectName':this[_0x7fd0('0x3a')]['arg_1'],'saveName':_0x351f05,'filename':_0x58c080[_0x7fd0('0x44')]||_0x351f05,'savePath':_0x582e94})['then'](function(_0x3434af){_0x5193a9(null,_0x3434af);})[_0x7fd0('0x12')](function(_0x4a48a2){_0x5193a9(_0x4a48a2);});};AGIVertices['prototype'][_0x7fd0('0x45')]=function(_0x509447,_0x427bae,_0x56c07a,_0xa92c3,_0xf40c60){this[_0x7fd0('0xc')][_0x7fd0('0x45')]({'uniqueid':this[_0x7fd0('0x3a')]['uniqueid'],'body':_0x509447,'direction':_0x427bae,'providerName':_0x56c07a,'providerResponse':_0xa92c3})[_0x7fd0('0x11')](function(_0x2ef42a){if(_0xf40c60){_0xf40c60(null,_0x2ef42a);}})['catch'](function(_0x3f1515){if(_0xf40c60){_0xf40c60(_0x3f1515);}});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x46')]=function(_0x49d31d,_0x3c432c){this[_0x7fd0('0xc')][_0x7fd0('0x46')]({'firstName':_[_0x7fd0('0x47')](_0x49d31d[_0x7fd0('0x14')])||_[_0x7fd0('0x48')](_0x49d31d[_0x7fd0('0x14')])?_0x7fd0('0x49')+Math['random']():_0x49d31d[_0x7fd0('0x14')],'lastName':_[_0x7fd0('0x47')](_0x49d31d['lastName'])||_[_0x7fd0('0x48')](_0x49d31d[_0x7fd0('0x4a')])?null:_0x49d31d[_0x7fd0('0x4a')],'phone':_0x49d31d[_0x7fd0('0x4b')],'ListId':_0x49d31d[_0x7fd0('0x4c')],'scheduledat':_0x49d31d[_0x7fd0('0x4d')],'callbackUniqueid':this[_0x7fd0('0x3a')][_0x7fd0('0x37')],'tags':_0x7fd0('0x4e'),'description':_0x7fd0('0x4f')+_0x49d31d[_0x7fd0('0x4d')][_0x7fd0('0x50')](),'priority':_0x49d31d[_0x7fd0('0x51')]})[_0x7fd0('0x11')](function(_0x35ce0b){_0x3c432c(null,_0x35ce0b);})['catch'](function(_0x4ca932){_0x3c432c(_0x4ca932);});};AGIVertices['prototype'][_0x7fd0('0x52')]=function(_0x2b825b,_0x4c191d){this[_0x7fd0('0xc')][_0x7fd0('0x53')](_0x2b825b)[_0x7fd0('0x11')](function(_0x13d781){_0x4c191d(null,_0x13d781?_0x13d781[_0x7fd0('0x14')]:![]);})[_0x7fd0('0x12')](function(_0x32cc3d){_0x4c191d(_0x32cc3d);});};AGIVertices['prototype'][_0x7fd0('0x54')]=function(_0x2eb3a5,_0x360b14,_0x2c9b38){var _0x3b81ba={'role':'agent'};_0x3b81ba[_0x2eb3a5]=this[_0x7fd0('0x3a')][_0x7fd0('0x3d')];this['rpc']['agentPause'](_0x3b81ba,_0x360b14,this[_0x7fd0('0x3a')][_0x7fd0('0x37')])['then'](function(_0x3aa831){_0x2c9b38(null,_['isNil'](_0x3aa831)?![]:!![]);})[_0x7fd0('0x12')](function(_0x4fd5f4){logger[_0x7fd0('0x2b')](_0x4fd5f4);_0x2c9b38(null,![]);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x55')]=function(_0x4af5c4,_0x2b273e){var _0xc0fe4a={'role':_0x7fd0('0x56')};_0xc0fe4a[_0x4af5c4]=this[_0x7fd0('0x3a')]['callerid'];this[_0x7fd0('0xc')]['agentUnpause'](_0xc0fe4a)[_0x7fd0('0x11')](function(_0x16288b){_0x2b273e(null,_[_0x7fd0('0x48')](_0x16288b)?![]:!![]);})[_0x7fd0('0x12')](function(_0x4dbe79){logger[_0x7fd0('0x2b')](_0x4dbe79);_0x2b273e(null,![]);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x57')]=function(_0x2826c7,_0x5b440c){var _0x2b1143={'role':_0x7fd0('0x56')};_0x2b1143[_0x2826c7]=this[_0x7fd0('0x3a')][_0x7fd0('0x3d')];this[_0x7fd0('0xc')][_0x7fd0('0x57')](_0x2b1143)[_0x7fd0('0x11')](function(_0x344831){_0x5b440c(null,_[_0x7fd0('0x48')](_0x344831)?![]:!![]);})[_0x7fd0('0x12')](function(_0x47c548){logger[_0x7fd0('0x2b')](_0x47c548);_0x5b440c(null,![]);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x58')]=function(_0x53155c,_0x37f1cf){var _0x220ebf={'role':_0x7fd0('0x56')};_0x220ebf[_0x53155c]=this[_0x7fd0('0x3a')][_0x7fd0('0x3d')];var _0x2ade7b=_0x53155c!=_0x7fd0('0x59')?util['format'](_0x7fd0('0x5a'),_0x7fd0('0x5b'),this['channel'][_0x7fd0('0x3d')]):undefined;this[_0x7fd0('0xc')][_0x7fd0('0x58')](_0x220ebf,_0x2ade7b)[_0x7fd0('0x11')](function(_0x1ac28c){_0x37f1cf(null,_[_0x7fd0('0x48')](_0x1ac28c)?![]:!![]);})['catch'](function(_0x599296){logger[_0x7fd0('0x2b')](_0x599296);_0x37f1cf(null,![]);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x5c')]=function(_0x267620,_0x1f8722){sh[_0x7fd0('0x5d')](_[_0x7fd0('0x5e')](_0x267620),function(_0x2d4289,_0x56cd07){var _0x59766d=_0x56cd07[_0x7fd0('0x5f')](/(\r\n|\n|\r)/gm,'');_0x1f8722(null,_0x59766d);});};AGIVertices[_0x7fd0('0xe')]['googleCloudTTS']=function(_0x3535cf,_0x3caa6e){scripts[_0x7fd0('0x60')](_0x3535cf[_0x7fd0('0x61')],_0x3535cf[_0x7fd0('0x62')]||_0x7fd0('0x63'),_0x3535cf[_0x7fd0('0x63')],_0x3535cf[_0x7fd0('0x64')]||'en-US',_0x3535cf[_0x7fd0('0x65')]||_0x7fd0('0x66'),_0x3535cf[_0x7fd0('0x67')]||'MP3')[_0x7fd0('0x11')](function(_0x11596a){_0x3caa6e(null,_0x11596a);})[_0x7fd0('0x12')](function(_0x27bb44){_0x3caa6e(_0x27bb44);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x68')]=function(_0x17314d,_0x3e1aeb){scripts[_0x7fd0('0x68')](_0x17314d[_0x7fd0('0x63')],_0x17314d[_0x7fd0('0x69')]||'en',0x1)['then'](function(_0x23828a){_0x3e1aeb(null,_0x23828a);})[_0x7fd0('0x12')](function(_0x430e98){_0x3e1aeb(_0x430e98);});};AGIVertices['prototype'][_0x7fd0('0x6a')]=function(_0x5dca4a,_0x1a5575){var _0x5d17d0={'uri':_0x5dca4a[_0x7fd0('0x6b')],'method':_0x5dca4a[_0x7fd0('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5dca4a['timeout'])===_0x7fd0('0x6d')&&parseInt(_0x5dca4a[_0x7fd0('0x6e')])>=0x1?parseInt(_0x5dca4a[_0x7fd0('0x6e')])*0x3e8:0x5*0x3e8};if(_[_0x7fd0('0x6f')]([_0x7fd0('0x70'),'PUT'],_0x5d17d0[_0x7fd0('0x6c')][_0x7fd0('0x71')]())){try{_0x5d17d0[_0x7fd0('0x72')]=_0x5dca4a[_0x7fd0('0x73')]?JSON[_0x7fd0('0x74')](_0x5dca4a[_0x7fd0('0x73')]):{};}catch(_0x441d2a){logger[_0x7fd0('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x441d2a);}}try{_0x5d17d0[_0x7fd0('0x75')]=_0x5dca4a[_0x7fd0('0x8')]?JSON[_0x7fd0('0x74')](_0x5dca4a[_0x7fd0('0x8')]):{};}catch(_0x1337bf){logger[_0x7fd0('0x2b')](_0x7fd0('0x76'),_0x1337bf);}if(_0x5dca4a['computedVariables']){try{var _0x2b5b79=require(_0x5dca4a[_0x7fd0('0x77')])[_0x7fd0('0x78')](this,_0x5d17d0);_0x5d17d0['uri']=Mustache[_0x7fd0('0x79')](_0x5dca4a[_0x7fd0('0x6b')],_0x2b5b79,{},['$$','$$']);if(_0x5d17d0[_0x7fd0('0x75')]){_0x5d17d0[_0x7fd0('0x75')]=JSON[_0x7fd0('0x74')](Mustache['render'](JSON[_0x7fd0('0x7a')](_0x5d17d0['headers']),_0x2b5b79,{},['$$','$$']));}if(_0x5d17d0['body']){_0x5d17d0['body']=JSON[_0x7fd0('0x74')](Mustache[_0x7fd0('0x79')](JSON[_0x7fd0('0x7a')](_0x5d17d0[_0x7fd0('0x72')]),_0x2b5b79,{},['$$','$$']));}}catch(_0x445864){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x445864);}}rp(_0x5d17d0)[_0x7fd0('0x11')](function(_0x163970){var _0x293ddd={'statusCode':_0x163970[_0x7fd0('0x7b')]||0xc8,'statusMessage':_0x163970[_0x7fd0('0x7c')]||'OK','headers':_0x163970[_0x7fd0('0x75')]||{},'body':_0x163970[_0x7fd0('0x72')]||{}};_0x1a5575(null,_0x293ddd);})[_0x7fd0('0x12')](function(_0xb633f6){var _0x21a9c3={'statusCode':_0xb633f6['statusCode']||0x1f4,'statusMessage':_0xb633f6[_0x7fd0('0x7d')]||_0x7fd0('0x7e'),'headers':_0xb633f6[_0x7fd0('0x7f')]['headers']||{},'body':_0xb633f6[_0x7fd0('0x7f')][_0x7fd0('0x72')]||{}};_0x1a5575(null,_0x21a9c3);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x80')]=function(_0xd2d52b,_0x420a03){scripts[_0x7fd0('0x80')](this[_0x7fd0('0x3a')]['uniqueid'],_0xd2d52b[_0x7fd0('0x81')],_0xd2d52b[_0x7fd0('0x63')],_0xd2d52b[_0x7fd0('0x82')]||'en')[_0x7fd0('0x11')](function(_0x3d9132){_0x420a03(null,_0x3d9132);})[_0x7fd0('0x12')](function(_0x3b327b){_0x420a03(_0x3b327b);});};AGIVertices['prototype'][_0x7fd0('0x83')]=function(_0x20a00c,_0x24a00f){scripts[_0x7fd0('0x83')](this[_0x7fd0('0x3a')]['uniqueid'],_0x20a00c[_0x7fd0('0x84')],_0x20a00c[_0x7fd0('0x85')],_0x20a00c[_0x7fd0('0x86')],_0x20a00c[_0x7fd0('0x63')],_0x20a00c[_0x7fd0('0x87')]||'en')[_0x7fd0('0x11')](function(_0x2fbbe6){_0x24a00f(null,_0x2fbbe6);})[_0x7fd0('0x12')](function(_0xf059a5){_0x24a00f(_0xf059a5);});};AGIVertices[_0x7fd0('0xe')]['sestekNDA']=function(_0x577e52,_0xf74aea){scripts[_0x7fd0('0x88')](this[_0x7fd0('0x3a')],_0x577e52)[_0x7fd0('0x11')](function(_0x58571a){_0xf74aea(null,_0x58571a);})['catch'](function(_0x173e17){_0xf74aea(_0x173e17);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x89')]=function(_0x18086d,_0x169875){scripts[_0x7fd0('0x89')](_0x18086d['key'],_0x18086d[_0x7fd0('0x63')],_0x18086d[_0x7fd0('0x8a')]||_0x7fd0('0x8b'),_0x18086d[_0x7fd0('0x8c')])[_0x7fd0('0x11')](function(_0x36eff6){_0x169875(null,_0x36eff6);})[_0x7fd0('0x12')](function(_0x5e1779){_0x169875(_0x5e1779);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x8d')]=function(_0x3029ab,_0x31e3de,_0x2b70ce){scripts[_0x7fd0('0x8d')](_0x31e3de,_0x3029ab[_0x7fd0('0x81')],_0x3029ab[_0x7fd0('0x8e')]||_0x7fd0('0x8b'),this[_0x7fd0('0x8f')](_0x3029ab[_0x7fd0('0x90')])?_0x3029ab['model']:undefined)[_0x7fd0('0x11')](function(_0x45f3df){_0x2b70ce(null,_0x45f3df);})[_0x7fd0('0x12')](function(_0x3e98f0){_0x2b70ce(_0x3e98f0);});};AGIVertices[_0x7fd0('0xe')]['awsPolly']=function(_0x5b898b,_0x3af61b){scripts[_0x7fd0('0x91')](_0x5b898b[_0x7fd0('0x92')],_0x5b898b[_0x7fd0('0x93')],_0x5b898b['aws_polly_region'],_0x5b898b['aws_polly_voice']||_0x7fd0('0x94'),_0x5b898b['text'],_0x5b898b[_0x7fd0('0x95')]||_0x7fd0('0x63'))[_0x7fd0('0x11')](function(_0x793bda){_0x3af61b(null,_0x793bda);})['catch'](function(_0x34c836){_0x3af61b(_0x34c836);});};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x96')]=function(_0x4c8912,_0x9fcd8c){scripts[_0x7fd0('0x96')](this[_0x7fd0('0x3a')][_0x7fd0('0x37')],_0x4c8912[_0x7fd0('0x92')],_0x4c8912[_0x7fd0('0x93')],_0x4c8912[_0x7fd0('0x97')],_0x4c8912[_0x7fd0('0x63')],_0x4c8912[_0x7fd0('0x98')])['then'](function(_0x56f34f){_0x9fcd8c(null,_0x56f34f);})[_0x7fd0('0x12')](function(_0x198287){_0x9fcd8c(_0x198287);});};AGIVertices['prototype'][_0x7fd0('0x99')]=function(_0x435d8d,_0x126fa6,_0x531dba){scripts[_0x7fd0('0x99')](_0x126fa6,_0x435d8d[_0x7fd0('0x81')],_0x435d8d[_0x7fd0('0x9a')]||'en-US')['then'](function(_0x13fffa){_0x531dba(null,_0x13fffa);})[_0x7fd0('0x12')](function(_0x499f1b){_0x531dba(_0x499f1b);});};AGIVertices[_0x7fd0('0xe')]['tildeASR']=function(_0x4cfd5e,_0x9913fc,_0x1e6454){scripts[_0x7fd0('0x9b')](_0x9913fc,_0x4cfd5e[_0x7fd0('0x9c')],_0x4cfd5e[_0x7fd0('0x9d')],_0x4cfd5e[_0x7fd0('0x9e')])[_0x7fd0('0x11')](function(_0x3b6eb4){_0x1e6454(null,_0x3b6eb4);})[_0x7fd0('0x12')](function(_0x5f4c75){_0x1e6454(_0x5f4c75);});};AGIVertices[_0x7fd0('0xe')]['clear']=function(_0x31efa5){var _0x1bc56b=_[_0x7fd0('0x6f')](verticesWithRetry,_0x31efa5[_0x7fd0('0x39')])?_0x31efa5:_['clone'](_0x31efa5);for(var _0x275169 in _0x1bc56b){if(_0x1bc56b[_0x7fd0('0x9f')](_0x275169)){if(_0x1bc56b[_0x275169]&&_[_0x7fd0('0xa0')](_0x1bc56b[_0x275169])){if(_[_0x7fd0('0x6f')](recursiveMapAttributes,_0x275169)){_0x1bc56b[_0x275169]=this[_0x7fd0('0xa1')](_0x1bc56b[_0x275169]);}else{_0x1bc56b[_0x275169]=this[_0x7fd0('0xa2')](_0x1bc56b[_0x275169]);}}}}return _0x1bc56b;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x138a09){for(var _0x313c74 in _0x138a09){if(_0x138a09[_0x7fd0('0x9f')](_0x313c74)){if(_[_0x7fd0('0xa3')](_0x138a09[_0x313c74])){this[_0x7fd0('0xa4')](_0x138a09[_0x313c74]);}else if(_[_0x7fd0('0xa5')](_0x138a09[_0x313c74])){for(var _0xa4a067=0x0;_0xa4a067<_0x138a09[_0x313c74]['length'];_0xa4a067++){this['recursiveNodeIndex'](_0x138a09[_0x313c74][_0xa4a067]);}}else if(_[_0x7fd0('0xa0')](_0x138a09[_0x313c74])){_0x138a09[_0x313c74]=this['replaceAllVariables'](_0x138a09[_0x313c74]);}}}};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xa6')]=function(_0x35e963,_0x28220f){for(var _0x3011af in _0x35e963){if(_0x35e963[_0x7fd0('0x9f')](_0x3011af)){if(_[_0x7fd0('0xa3')](_0x35e963[_0x3011af])){if(!_[_0x7fd0('0x47')](_0x35e963[_0x3011af])){this['saveRestApiResult'](_0x35e963[_0x3011af],util[_0x7fd0('0x27')](_0x7fd0('0xa7'),_0x28220f,_0x3011af));}}else if(_[_0x7fd0('0xa5')](_0x35e963[_0x3011af])){for(var _0xdf129d=0x0;_0xdf129d<_0x35e963[_0x3011af][_0x7fd0('0xa8')];_0xdf129d++){this['saveRestApiResult'](_0x35e963[_0x3011af][_0xdf129d],util[_0x7fd0('0x27')](_0x7fd0('0xa7'),_0x28220f,_0x3011af+'['+_0xdf129d+']'));}}else{if(!_[_0x7fd0('0x48')](_0x35e963[_0x3011af])){this['channel'][_0x7fd0('0xa9')](util[_0x7fd0('0x27')]('%s.%s',_0x28220f,_0x3011af),_0x35e963[_0x3011af]);}}}}};AGIVertices['prototype'][_0x7fd0('0xa1')]=function(_0x880083){try{var _0x1f9abb=JSON['parse'](_0x880083);this[_0x7fd0('0xa4')](_0x1f9abb);return JSON['stringify'](_0x1f9abb);}catch(_0x576ffb){return this[_0x7fd0('0xa2')](_0x880083);}};AGIVertices['prototype'][_0x7fd0('0xa2')]=function(_0x17c50a){var _0xdcf13b=_0x17c50a['split']('{');for(var _0xfb75a0=0x1;_0xfb75a0<_0xdcf13b[_0x7fd0('0xa8')];_0xfb75a0+=0x1){var _0x2fff57=_0xdcf13b[_0xfb75a0][_0x7fd0('0xaa')]('}');if(_0x2fff57[_0x7fd0('0xa8')]>0x1){_0x17c50a=_0x17c50a['replaceAll']('{'+_0x2fff57[0x0]+'}',this['channel'][_0x7fd0('0xf')](_0x2fff57[0x0])['extra']||_0x2fff57[0x0]);}}if(_0xdcf13b[_0x7fd0('0xa8')]===0x1){return _0x17c50a[_0x7fd0('0x50')]();}return this['replaceAllVariables'](_0x17c50a);};AGIVertices[_0x7fd0('0xe')]['getAndSetVariable']=function(_0x53c7f4,_0x330360){var _0x6d4d67=this[_0x7fd0('0x3a')][_0x7fd0('0xf')](_0x53c7f4);if(_0x6d4d67['result']===-0x1){return _0x6d4d67;}logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x330360,_0x6d4d67['extra']));return this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](_0x330360,_0x6d4d67[_0x7fd0('0xab')]);};AGIVertices['prototype'][_0x7fd0('0x8f')]=function(_0x44c6df){return _0x44c6df&&_0x44c6df!=='0'&&_0x44c6df!=='-1'&&_0x44c6df!=='';};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xac')]=function(_0x139e6d){this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0x139e6d,'-');_0x139e6d[_0x7fd0('0xad')]=_0x139e6d[_0x7fd0('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xae')]=function(_0x29ba5b){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xaf'),_0x29ba5b[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x29ba5b['text'])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}var _0x147889='\x22'+_0x29ba5b[_0x7fd0('0x63')]+'\x22';if(this[_0x7fd0('0x8f')](_0x29ba5b['options'])){_0x147889+=','+_0x29ba5b['options'];}var _0x4c170e=this['channel'][_0x7fd0('0x5d')](_0x7fd0('0xb2'),_0x147889);if(_0x4c170e[_0x7fd0('0xb3')]===-0x1){return _0x4c170e;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0xb4'),_0x147889));};AGIVertices['prototype'][_0x7fd0('0xb5')]=function(_0x4961ff){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0xb6'),_0x4961ff[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x4961ff[_0x7fd0('0xb7')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0xffbeec=_0x4961ff[_0x7fd0('0xb7')];if(this[_0x7fd0('0x8f')](_0x4961ff[_0x7fd0('0x7f')])){_0xffbeec+=','+_0x4961ff[_0x7fd0('0x7f')];}var _0x35780f=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')](_0x7fd0('0xb8'),_0xffbeec);if(_0x35780f['result']===-0x1){return _0x35780f;}var _0x402b7e=this['getAndSetVariable'](_0x7fd0('0xb9'),_0x7fd0('0xba'));if(_0x402b7e['result']===-0x1){return _0x402b7e;}var _0x310fc1=this['getAndSetVariable'](_0x7fd0('0xbb'),_0x7fd0('0xbc'));if(_0x310fc1[_0x7fd0('0xb3')]===-0x1){return _0x310fc1;}var _0x4c214c=this[_0x7fd0('0xbd')]('RECOG_INSTANCE()',_0x7fd0('0xbe'));if(_0x4c214c[_0x7fd0('0xb3')]===-0x1){return _0x4c214c;}return this['channel']['noop'](util[_0x7fd0('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0xffbeec));};AGIVertices['prototype']['agi']=function(_0x56a3e2){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xbf'),_0x56a3e2[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0xc0')]([_0x56a3e2[_0x7fd0('0xc1')],_0x56a3e2[_0x7fd0('0xc2')]]);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xc3')]=function(_0x50996a){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xc4'),_0x50996a['label']));if(this[_0x7fd0('0x8f')](_0x50996a[_0x7fd0('0x6e')])){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0xc5'),_0x50996a[_0x7fd0('0x6e')]));var _0x174519=this[_0x7fd0('0x3a')][_0x7fd0('0xc6')](_0x50996a['timeout']);if(_0x174519[_0x7fd0('0xb3')]===-0x1){return _0x174519;}}return this[_0x7fd0('0x3a')][_0x7fd0('0xc3')]();};AGIVertices[_0x7fd0('0xe')]['callback']=function(_0x12af41){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xc7'),_0x12af41[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x12af41[_0x7fd0('0x4c')])){return this[_0x7fd0('0x3a')]['error'](_0x12af41,_0x7fd0('0xc8'));}_0x12af41[_0x7fd0('0x4d')]=moment();if(this[_0x7fd0('0x8f')](_0x12af41['delay'])){_0x12af41[_0x7fd0('0x4d')]=moment()[_0x7fd0('0xc9')](_0x12af41[_0x7fd0('0xca')],_0x7fd0('0xcb'));}if(!this[_0x7fd0('0x8f')](_0x12af41[_0x7fd0('0x51')])){_0x12af41[_0x7fd0('0x51')]=0x2;}this[_0x7fd0('0x46')][_0x7fd0('0x78')](this,_0x12af41);return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xcc'),_0x12af41[_0x7fd0('0x4b')],_0x12af41[_0x7fd0('0x4c')],_0x12af41[_0x7fd0('0x4d')]));};AGIVertices['prototype'][_0x7fd0('0xcd')]=function(_0x1c7eae){logger['info'](util['format'](_0x7fd0('0xce'),_0x1c7eae[_0x7fd0('0x38')]));var _0x33a79e=this[_0x7fd0('0x3a')]['exec'](_0x1c7eae['application'],_0x1c7eae[_0x7fd0('0x7f')]);if(_0x33a79e[_0x7fd0('0xb3')]===-0x1){return _0x33a79e;}return this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xcf'),_0x1c7eae[_0x7fd0('0xd0')],_0x1c7eae['options']));};AGIVertices['prototype'][_0x7fd0('0xd1')]=function(_0x2e69e5){logger[_0x7fd0('0x2e')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2e69e5['label']));if(!this[_0x7fd0('0x8f')](_0x2e69e5['text'])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('no\x20text\x20configured');}var _0x2da720='\x22'+_0x2e69e5[_0x7fd0('0x63')]+'\x22';if(this[_0x7fd0('0x8f')](_0x2e69e5[_0x7fd0('0x7f')])){_0x2da720+=','+_0x2e69e5[_0x7fd0('0x7f')];}var _0x148d9c=this['channel']['exec']('MRCPSynth',_0x2da720);if(_0x148d9c[_0x7fd0('0xb3')]===-0x1){return _0x148d9c;}return this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2da720));};AGIVertices[_0x7fd0('0xe')]['sestektts']=function(_0x17bc39){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0xd2'),_0x17bc39[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x17bc39[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}var _0x1e75be='\x22'+_0x17bc39[_0x7fd0('0x63')]+'\x22';if(this[_0x7fd0('0x8f')](_0x17bc39[_0x7fd0('0x7f')])){_0x1e75be+=','+_0x17bc39['options'];}var _0x1dc711=this[_0x7fd0('0x3a')]['exec']('MRCPSynth',_0x1e75be);if(_0x1dc711['result']===-0x1){return _0x1dc711;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xb4'),_0x1e75be));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xd3')]=function(_0x3f377a){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3f377a[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x3f377a[_0x7fd0('0xb7')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xd4'));}var _0xec4082=_0x3f377a[_0x7fd0('0xb7')];if(this[_0x7fd0('0x8f')](_0x3f377a[_0x7fd0('0x7f')])){_0xec4082+=','+_0x3f377a[_0x7fd0('0x7f')];}var _0x2c03d5=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')](_0x7fd0('0xb8'),_0xec4082);if(_0x2c03d5[_0x7fd0('0xb3')]===-0x1){return _0x2c03d5;}var _0x3b3ace=this[_0x7fd0('0xbd')](_0x7fd0('0xb9'),_0x7fd0('0xd5'));if(_0x3b3ace[_0x7fd0('0xb3')]===-0x1){return _0x3b3ace;}var _0x29f21f=this['getAndSetVariable'](_0x7fd0('0xbb'),_0x7fd0('0xd6'));if(_0x29f21f[_0x7fd0('0xb3')]===-0x1){return _0x29f21f;}var _0x3325fe=this[_0x7fd0('0xbd')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x3325fe['result']===-0x1){return _0x3325fe;}return this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0xec4082));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xd7')]=function(_0x44f526){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xd8'),_0x44f526['label']));if(!this[_0x7fd0('0x8f')](_0x44f526['grammar'])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('no\x20grammar\x20configured');}var _0x43a6ae=_0x44f526['grammar'];if(this['isConfigured'](_0x44f526[_0x7fd0('0x7f')])){_0x43a6ae+=','+_0x44f526[_0x7fd0('0x7f')];}var _0x58b5cb=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')]('MRCPRecog',_0x43a6ae);if(_0x58b5cb[_0x7fd0('0xb3')]===-0x1){return _0x58b5cb;}var _0x9cc3f3=this[_0x7fd0('0xbd')]('RECOG_CONFIDENCE()',_0x7fd0('0xd9'));if(_0x9cc3f3[_0x7fd0('0xb3')]===-0x1){return _0x9cc3f3;}var _0x483b1b=this[_0x7fd0('0xbd')](_0x7fd0('0xbb'),_0x7fd0('0xda'));if(_0x483b1b[_0x7fd0('0xb3')]===-0x1){return _0x483b1b;}var _0x3b0da1=this[_0x7fd0('0xbd')](_0x7fd0('0xdb'),_0x7fd0('0xdc'));if(_0x3b0da1[_0x7fd0('0xb3')]===-0x1){return _0x3b0da1;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xdd'),_0x43a6ae));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xde')]=function(_0x52e413){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xdf'),_0x52e413[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x52e413[_0x7fd0('0xe0')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x52e413,'no\x20database\x20selected');}var _0x2910be=this[_0x7fd0('0x17')][_0x7fd0('0x78')](this,_0x52e413[_0x7fd0('0xe0')]);if(!_0x2910be){return this[_0x7fd0('0x3a')]['error'](_0x52e413,'no\x20odbc\x20database\x20found');}if(!this[_0x7fd0('0x8f')](_0x52e413[_0x7fd0('0x2d')])){return this['channel'][_0x7fd0('0x2b')](_0x52e413,_0x7fd0('0xe1'));}var _0x5101c5=_0x52e413[_0x7fd0('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0xe2'),_0x5101c5));var _0x54dde7=this[_0x7fd0('0x29')]['sync'](this,_0x2910be,_0x5101c5);this['createSquareDetailsReport']['sync'](this,_0x52e413,_0x5101c5);if(!this['isConfigured'](_0x52e413[_0x7fd0('0xe3')])){return this[_0x7fd0('0x3a')]['noop'](_0x7fd0('0xe4'));}var _0x4d2e47=this[_0x7fd0('0xf')][_0x7fd0('0x78')](this,_0x52e413[_0x7fd0('0xe3')]);if(!_0x4d2e47){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x52e413,_0x7fd0('0xe5'));}var _0x34b90e=this;_0x54dde7[_0x7fd0('0xe6')](function(_0x38e973,_0x1eca33){Object[_0x7fd0('0xe7')](_0x38e973)[_0x7fd0('0xe6')](function(_0x28c30d){_0x34b90e[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0xe8'),_0x4d2e47,_0x1eca33,_0x28c30d),_0x38e973[_0x28c30d]);});});this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0xe9'),_0x4d2e47),_0x54dde7['length']);return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xea'),_0x4d2e47));};AGIVertices['prototype']['dial']=function(_0x5e202b){logger[_0x7fd0('0xeb')](util[_0x7fd0('0x27')](_0x7fd0('0xec'),_0x5e202b[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x5e202b[_0x7fd0('0xed')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x5e202b,'no\x20user\x20selected');}var _0x835b92=this[_0x7fd0('0xee')]['sync'](this,_0x5e202b[_0x7fd0('0xed')]);if(!_0x835b92){return this['channel']['error'](_0x5e202b,'no\x20user\x20found');}var _0x2ad703=this[_0x7fd0('0x3a')]['exec']('DIAL',[util[_0x7fd0('0x27')]('SIP/%s',_0x835b92),_0x5e202b[_0x7fd0('0x6e')],_0x5e202b[_0x7fd0('0xef')],_0x5e202b[_0x7fd0('0x6b')]]);if(_0x2ad703[_0x7fd0('0xb3')]===-0x1){return _0x2ad703;}return this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xf0'),'DIAL'));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xf1')]=function(_0x5cda4a){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0xf2'),_0x5cda4a['label']));if(!this[_0x7fd0('0x8f')](_0x5cda4a[_0x7fd0('0x81')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xf3'));}if(!this[_0x7fd0('0x8f')](_0x5cda4a[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}this['channel'][_0x7fd0('0xf4')]=!![];this[_0x7fd0('0x36')](_0x5cda4a);this['createSquareMessage'](_0x5cda4a[_0x7fd0('0x63')],'in','','');this['channel'][_0x7fd0('0xb0')](util['format'](_0x7fd0('0xf5'),_0x5cda4a[_0x7fd0('0x63')]));var _0x364163=this['googleDialogflow'][_0x7fd0('0x78')](this,_0x5cda4a);if(_0x364163){for(var _0x21b71e in _0x364163){if(_0x364163['hasOwnProperty'](_0x21b71e)){this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util[_0x7fd0('0x27')]('DIALOGFLOW_%s',_0x21b71e[_0x7fd0('0x71')]()),_0x364163[_0x21b71e]);}}this['createSquareMessage'](_0x364163[_0x7fd0('0xf6')],_0x7fd0('0xf7'),_0x7fd0('0xf1'),'');return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0xf8'),_0x364163[_0x7fd0('0xf6')]));}return this['channel'][_0x7fd0('0x2b')](_0x5cda4a,_0x7fd0('0xf9'));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xfa')]=function(_0x58b7cd){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0xfb'),_0x58b7cd[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x58b7cd['dialogflowV2_project_id'])){return this['channel']['noop'](_0x7fd0('0xfc'));}if(!this['isConfigured'](_0x58b7cd[_0x7fd0('0x85')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xfd'));}if(!this[_0x7fd0('0x8f')](_0x58b7cd[_0x7fd0('0x86')])){return this['channel'][_0x7fd0('0xb0')](_0x7fd0('0xfe'));}if(!this[_0x7fd0('0x8f')](_0x58b7cd['dialogflowV2_language'])){return this[_0x7fd0('0x3a')]['noop'](_0x7fd0('0xff'));}if(!this[_0x7fd0('0x8f')](_0x58b7cd[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')]['noop'](_0x7fd0('0xb1'));}this[_0x7fd0('0x3a')]['bot']=!![];this[_0x7fd0('0x36')](_0x58b7cd);this[_0x7fd0('0x45')](_0x58b7cd[_0x7fd0('0x63')],'in','','');this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x100'),_0x58b7cd[_0x7fd0('0x63')]));var _0x55cfec=this[_0x7fd0('0x83')][_0x7fd0('0x78')](this,_0x58b7cd);if(_0x55cfec){for(var _0x4b94e0 in _0x55cfec){if(_0x55cfec[_0x7fd0('0x9f')](_0x4b94e0)){if(_0x4b94e0!=='providerResponse'){this['channel'][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0x101'),_0x4b94e0['toUpperCase']()),_0x55cfec[_0x4b94e0]);}}}this['createSquareMessage'](_0x55cfec['speech'],'out',_0x7fd0('0xfa'),_0x55cfec['providerResponse']);return this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')]('DialogflowV2\x20Result\x20%s',_0x55cfec[_0x7fd0('0xf6')]));}return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x58b7cd,_0x7fd0('0x102'));};AGIVertices['prototype'][_0x7fd0('0x103')]=function(_0x1a389c){logger['info'](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1a389c[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x1a389c['ndauth_url'])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x104'));}if(!this[_0x7fd0('0x8f')](_0x1a389c[_0x7fd0('0x105')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x106'));}if(!this[_0x7fd0('0x8f')](_0x1a389c[_0x7fd0('0x107')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x108'));}if(!this[_0x7fd0('0x8f')](_0x1a389c[_0x7fd0('0x109')])){return this['channel'][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}this['channel'][_0x7fd0('0xf4')]=!![];this[_0x7fd0('0x36')](_0x1a389c);this[_0x7fd0('0x45')](_0x1a389c['text'],'in','','');this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x10a'),_0x1a389c[_0x7fd0('0x63')]));var _0x4853e9=this['sestekNDA']['sync'](this,_0x1a389c);if(_0x4853e9){for(var _0x3a8986 in _0x4853e9){if(_0x4853e9[_0x7fd0('0x9f')](_0x3a8986)){this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0x10b'),_0x3a8986['toUpperCase']()),_0x4853e9[_0x3a8986]);}}this[_0x7fd0('0x45')](_0x4853e9[_0x7fd0('0xf6')],'out',_0x7fd0('0x103'),'');if(_0x4853e9[_0x7fd0('0x10c')]){this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0x10d'),_0x4853e9[_0x7fd0('0x10c')]));var _0x5b880b=this[_0x7fd0('0x3a')][_0x7fd0('0x10e')](_0x4853e9['audiofile']);try{fs['unlink'](_0x4853e9[_0x7fd0('0x10c')]+_0x7fd0('0x10f'));}catch(_0x69b036){logger['error'](_0x69b036);}return _0x5b880b;}else{return this['channel'][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x110'),_0x4853e9[_0x7fd0('0xf6')]));}}return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x1a389c,_0x7fd0('0x111'));};AGIVertices['prototype']['end']=function(_0x5727c2){logger['info'](util['format'](_0x7fd0('0x112'),_0x5727c2['label']));return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('end');};AGIVertices[_0x7fd0('0xe')]['ext_dial']=function(_0x2482eb){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x113'),_0x2482eb['label']));var _0x2bb96b='';if(_0x2482eb['trunk_id']){if(!this[_0x7fd0('0x8f')](_0x2482eb[_0x7fd0('0x114')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x2482eb,_0x7fd0('0x115'));}else{var _0x40d357=parseInt(_0x2482eb[_0x7fd0('0x114')],0xa);if(isNaN(_0x40d357)){_0x2bb96b=_0x2482eb['trunk_id'];}else{_0x2bb96b=this[_0x7fd0('0x116')][_0x7fd0('0x78')](this,_0x2482eb[_0x7fd0('0x114')]);if(!_0x2bb96b){return this[_0x7fd0('0x3a')]['error'](_0x2482eb,_0x7fd0('0x117'));}}}}else if(_0x2482eb['trunk_name']){_0x2bb96b=_0x2482eb['trunk_name'];}else{return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x2482eb,'no\x20trunk\x20selected');}var _0x26d512=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')]('DIAL',[util[_0x7fd0('0x27')](_0x7fd0('0x118'),_0x2bb96b,_0x2482eb[_0x7fd0('0x4b')]),_0x2482eb[_0x7fd0('0x6e')],_0x2482eb['opts'],_0x2482eb[_0x7fd0('0x6b')]]);if(_0x26d512[_0x7fd0('0xb3')]===-0x1){return _0x26d512;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('Executed\x20command\x20%s',_0x7fd0('0x119')));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x11a')]=function(_0x858ccc){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x11b'),_0x858ccc[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('finally');};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xa')]=function(_0x4f8006){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4f8006[_0x7fd0('0x38')]));if(_0x4f8006[_0x7fd0('0xad')]===0x0){return this[_0x7fd0('0xac')](_0x4f8006);}_0x4f8006['retry']-=0x1;if(!this[_0x7fd0('0x8f')](_0x4f8006[_0x7fd0('0x11c')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x4f8006,'no\x20file\x20audio\x20selected');}var _0x548c4b=this['getSound'][_0x7fd0('0x78')](this,_0x4f8006[_0x7fd0('0x11c')]);if(!_0x548c4b){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x4f8006,_0x7fd0('0x11d'));}if(!this[_0x7fd0('0x8f')](_0x4f8006['variable_id'])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x162111=this[_0x7fd0('0x3a')][_0x7fd0('0x11e')](_0x548c4b,_0x4f8006[_0x7fd0('0x11f')],_0x4f8006[_0x7fd0('0x120')]);var _0xed2f67=_0x162111[_0x7fd0('0xb3')]?_0x162111[_0x7fd0('0xb3')][_0x7fd0('0x50')]():'';logger[_0x7fd0('0x2e')](_0x7fd0('0x121'),JSON[_0x7fd0('0x7a')](_0x162111));if(_0x162111['result']===-0x1){this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0x4f8006,_0xed2f67);return _0x162111;}else if(_0x162111[_0x7fd0('0xab')]==='timeout'){_0x162111[_0x7fd0('0xb3')]=_0xed2f67[_0x7fd0('0xa8')]>=parseInt(_0x4f8006[_0x7fd0('0x122')])?'x':'i';}else{_0x162111['result']=_0xed2f67[_0x7fd0('0xa8')]>=parseInt(_0x4f8006[_0x7fd0('0x122')])&&_0xed2f67[_0x7fd0('0xa8')]<=parseInt(_0x4f8006['maxdigit'])?'x':'i';}var _0x4340ae=this[_0x7fd0('0xf')]['sync'](this,_0x4f8006[_0x7fd0('0xe3')]);if(!_0x4340ae){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x4f8006,_0x7fd0('0xe5'));}this[_0x7fd0('0x3a')]['setVariable'](_0x4340ae,_0xed2f67);if(this['isConfigured'](_0x4f8006[_0x7fd0('0x123')])){var _0x183081=parseInt(_0x4f8006['hiddendigitsnum'],0xa);var _0x3a8bb1=rs[_0x7fd0('0x124')]({'charset':'*','length':_0x183081});var _0x1243f2=_0xed2f67[_0x7fd0('0xa8')];if(_0x1243f2>0x0){if(_0x1243f2>_0x183081){this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0x4f8006,_0x4f8006[_0x7fd0('0x125')]===_0x7fd0('0x126')?_0x3a8bb1+_0xed2f67[_0x7fd0('0x127')](_0x183081):_0xed2f67['substr'](0x0,_0x1243f2-_0x183081)+_0x3a8bb1);}else{this['createSquareDetailsReport']['sync'](this,_0x4f8006,rs[_0x7fd0('0x124')]({'charset':'*','length':_0x1243f2}));}}else{this[_0x7fd0('0x36')]['sync'](this,_0x4f8006,'');}}else{this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0x4f8006,_0xed2f67);}return _0x162111;};AGIVertices[_0x7fd0('0xe')]['getsecretdigits']=function(_0xf2584b){logger['info'](util['format'](_0x7fd0('0x128'),_0xf2584b[_0x7fd0('0x38')]));return this[_0x7fd0('0xa')](_0xf2584b);};AGIVertices['prototype']['goal']=function(_0x1b1766){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x129'),_0x1b1766[_0x7fd0('0x38')]));this['createSquareDetailsReport']['sync'](this,_0x1b1766,_0x1b1766[_0x7fd0('0x12a')]);return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format']('GOAL\x20%s',_0x1b1766[_0x7fd0('0x12a')]));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x12b')]=function(_0x1f4dd7){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x12c'),_0x1f4dd7['label']));if(!this[_0x7fd0('0x8f')](_0x1f4dd7['aws_access_key_id'])||!this[_0x7fd0('0x8f')](_0x1f4dd7[_0x7fd0('0x93')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x12d'));}if(!this[_0x7fd0('0x8f')](_0x1f4dd7[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('no\x20text\x20configured');}this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x1f4dd7[_0x7fd0('0x63')]));var _0x252ead=this[_0x7fd0('0x91')][_0x7fd0('0x78')](this,_0x1f4dd7);if(_0x252ead){this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x252ead));var _0x336874=this[_0x7fd0('0x3a')][_0x7fd0('0x10e')](_0x252ead);try{fs[_0x7fd0('0x12e')](_0x252ead+'.wav');}catch(_0x409a34){logger[_0x7fd0('0x2b')](_0x409a34);}return _0x336874;}return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x1f4dd7,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x12f')]=function(_0x303a60){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x130'),_0x303a60[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x303a60['aws_access_key_id'])||!this[_0x7fd0('0x8f')](_0x303a60['aws_secret_access_key'])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x12d'));}if(!this['isConfigured'](_0x303a60[_0x7fd0('0x98')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('no\x20bot\x20name\x20configured');}if(!this[_0x7fd0('0x8f')](_0x303a60[_0x7fd0('0x63')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x7fd0('0x3a')]['bot']=!![];this['createSquareDetailsReport'](_0x303a60);this['createSquareMessage'](_0x303a60['text'],'in','','');this['channel']['noop'](util[_0x7fd0('0x27')](_0x7fd0('0x131'),_0x303a60[_0x7fd0('0x63')]));var _0x34d921=this['awsLex']['sync'](this,_0x303a60);if(_0x34d921){for(var _0x48f4ab in _0x34d921){if(_0x34d921[_0x7fd0('0x9f')](_0x48f4ab)&&_[_0x7fd0('0xa0')](_0x34d921[_0x48f4ab])){this[_0x7fd0('0x3a')]['setVariable'](util[_0x7fd0('0x27')](_0x7fd0('0x132'),_0x48f4ab[_0x7fd0('0x71')]()),_0x34d921[_0x48f4ab]);}}if(_[_0x7fd0('0x48')](_0x34d921[_0x7fd0('0x7d')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x133'));}else{this[_0x7fd0('0x45')](_0x34d921['message'],_0x7fd0('0xf7'),_0x7fd0('0x134'),'');return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x135'),_0x34d921['message']));}}return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x303a60,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x7fd0('0x136')]=function(_0x4a7ca2){logger['info'](util['format'](_0x7fd0('0x137'),_0x4a7ca2['label'],_0x4a7ca2[_0x7fd0('0x6e')]));if(!this[_0x7fd0('0x8f')](_0x4a7ca2['key'])){return this[_0x7fd0('0x3a')]['noop']('no\x20key\x20configured');}var _0x3f43a8=_0x7fd0('0x138');var _0x1ffd5f=util['format'](_0x7fd0('0x139'),FILES_PATH,rs[_0x7fd0('0x124')](0x4));var _0x2169c8=util[_0x7fd0('0x27')](_0x7fd0('0xa7'),_0x1ffd5f,_0x3f43a8);var _0x40f37d=!![];if(_0x4a7ca2[_0x7fd0('0x13a')]==='NOBEEP'){_0x40f37d=![];}var _0x260a46=this['channel']['recordFile'](_0x1ffd5f,_0x3f43a8,_0x4a7ca2[_0x7fd0('0x13b')],_0x4a7ca2[_0x7fd0('0x6e')],undefined,_0x40f37d);if(_0x260a46['result']!==-0x1){this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0x13c'),_0x2169c8));var _0x35b3b7=this[_0x7fd0('0x99')][_0x7fd0('0x78')](this,_0x4a7ca2,_0x2169c8);if(_0x35b3b7){for(var _0x4c0add in _0x35b3b7){if(_0x35b3b7[_0x7fd0('0x9f')](_0x4c0add)){this[_0x7fd0('0x3a')]['setVariable'](util[_0x7fd0('0x27')](_0x7fd0('0x13d'),_0x4c0add[_0x7fd0('0x71')]()),_0x35b3b7[_0x4c0add]);}}return this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0x13e'),JSON[_0x7fd0('0x7a')](_0x35b3b7)));}}return _0x260a46;};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x13f')]=function(_0x47d967){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x140'),_0x47d967['label']));if(!this[_0x7fd0('0x8f')](_0x47d967[_0x7fd0('0x9c')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x141'));}if(!this[_0x7fd0('0x8f')](_0x47d967[_0x7fd0('0x9d')])){return this[_0x7fd0('0x3a')]['noop']('no\x20appsecret\x20configured');}var _0x515432=_0x7fd0('0x138');var _0x41cfef=util[_0x7fd0('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x7fd0('0x124')](0x4));var _0xa10580=util[_0x7fd0('0x27')](_0x7fd0('0xa7'),_0x41cfef,_0x515432);var _0x54da9e=!![];if(_0x47d967[_0x7fd0('0x13a')]===_0x7fd0('0x142')){_0x54da9e=![];}var _0x46ed4b=this[_0x7fd0('0x3a')][_0x7fd0('0x143')](_0x41cfef,_0x515432,_0x47d967[_0x7fd0('0x13b')],_0x47d967[_0x7fd0('0x6e')],undefined,_0x54da9e);if(_0x46ed4b[_0x7fd0('0xb3')]!==-0x1){this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x144'),_0xa10580));var _0xd98b37=this[_0x7fd0('0x9b')][_0x7fd0('0x78')](this,_0x47d967,_0xa10580);if(_0xd98b37){for(var _0xa99c4e in _0xd98b37){if(_0xd98b37[_0x7fd0('0x9f')](_0xa99c4e)){this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util['format']('TILDE_ASR_%s',_0xa99c4e[_0x7fd0('0x71')]()),_0xd98b37[_0xa99c4e]);}}return this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x145'),JSON[_0x7fd0('0x7a')](_0xd98b37)));}}return _0x46ed4b;};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x146')]=function(_0x5af3d2){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5af3d2['label']));return this[_0x7fd0('0x3a')]['continueAt'](_0x5af3d2[_0x7fd0('0x3f')],_0x5af3d2[_0x7fd0('0x40')],_0x5af3d2[_0x7fd0('0x41')]);};AGIVertices[_0x7fd0('0xe')]['gotoif']=function(_0x365c16){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x365c16[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x365c16[_0x7fd0('0x147')])){return this[_0x7fd0('0x3a')]['error'](_0x365c16,_0x7fd0('0x148'));}try{var _0x548389=eval(_0x365c16[_0x7fd0('0x147')])?_0x7fd0('0x149'):_0x7fd0('0x14a');this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x365c16[_0x7fd0('0x147')],_0x548389));return{'code':0xc8,'result':_0x548389};}catch(_0x787290){return{'code':0xc8,'result':_0x7fd0('0x14a')};}};AGIVertices['prototype'][_0x7fd0('0x14b')]=function(_0x3f6cd8){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x14c'),_0x3f6cd8[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x3f6cd8[_0x7fd0('0x14d')])){return this[_0x7fd0('0x3a')]['error'](_0x3f6cd8,'no\x20interval\x20configured');}var _0x548423=this[_0x7fd0('0x21')][_0x7fd0('0x78')](this,_0x3f6cd8['interval_id']);if(!_0x548423){return this[_0x7fd0('0x3a')]['error'](_0x3f6cd8,'no\x20intervals\x20found');}for(var _0x28d2f3=0x0;_0x28d2f3<_0x548423[_0x7fd0('0xa8')];_0x28d2f3+=0x1){var _0x440110=this['channel'][_0x7fd0('0xf')](util[_0x7fd0('0x27')](_0x7fd0('0x14e'),_0x548423[_0x28d2f3]));if(_0x440110[_0x7fd0('0xb3')]===-0x1){return _0x440110;}logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x14f'),_0x548423[_0x28d2f3],_0x440110[_0x7fd0('0xab')]));if(_0x440110[_0x7fd0('0xab')]===_0x7fd0('0x149')){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x14f'),_0x548423[_0x28d2f3],_0x7fd0('0x149')));this['channel']['noop'](util['format'](_0x7fd0('0x14f'),_0x548423[_0x28d2f3],'true'));return{'code':0xc8,'result':_0x7fd0('0x149')};}else{logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('IFTIME\x20%s\x20%s',_0x548423[_0x28d2f3],_0x7fd0('0x14a')));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('IFTIME\x20%s\x20%s',_0x548423[_0x28d2f3],_0x7fd0('0x14a')));}}return{'code':0xc8,'result':_0x7fd0('0x14a')};};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x150')]=function(_0x43c4f7){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x151'),_0x43c4f7[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0x150')]();};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x152')]=function(_0x39b481){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x153'),_0x39b481[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x39b481[_0x7fd0('0x81')])){return this[_0x7fd0('0x3a')]['noop'](_0x7fd0('0xf3'));}var _0x107108=_0x7fd0('0x138');var _0x2b01fd=util['format'](_0x7fd0('0x139'),FILES_PATH,rs[_0x7fd0('0x124')](0x4));var _0x5205e1=util[_0x7fd0('0x27')](_0x7fd0('0xa7'),_0x2b01fd,_0x107108);var _0x469414=!![];if(_0x39b481[_0x7fd0('0x13a')]===_0x7fd0('0x142')){_0x469414=![];}var _0x513073=this[_0x7fd0('0x3a')]['recordFile'](_0x2b01fd,_0x107108,_0x39b481['intKey'],_0x39b481[_0x7fd0('0x6e')],undefined,_0x469414);if(_0x513073[_0x7fd0('0xb3')]!==-0x1){this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('ispeech\x20%s\x20file\x20created',_0x5205e1));var _0x25d0fa=this[_0x7fd0('0x8d')][_0x7fd0('0x78')](this,_0x39b481,_0x5205e1);if(_0x25d0fa){for(var _0x352368 in _0x25d0fa){if(_0x25d0fa['hasOwnProperty'](_0x352368)){this['channel'][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0x154'),_0x352368[_0x7fd0('0x71')]()),_0x25d0fa[_0x352368]);}}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x155'),JSON[_0x7fd0('0x7a')](_0x25d0fa)));}}return _0x513073;};AGIVertices[_0x7fd0('0xe')]['ispeechtts']=function(_0x59b313){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x156'),_0x59b313[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x59b313[_0x7fd0('0x81')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('no\x20key\x20configured');}if(!this[_0x7fd0('0x8f')](_0x59b313[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x157'),_0x59b313[_0x7fd0('0x63')]));var _0xe9f076=this[_0x7fd0('0x89')][_0x7fd0('0x78')](this,_0x59b313);if(_0xe9f076){this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x158'),_0xe9f076));var _0x36caf8=this[_0x7fd0('0x3a')][_0x7fd0('0x10e')](_0xe9f076,_0x59b313[_0x7fd0('0x13b')]);try{fs['unlink'](_0xe9f076+_0x7fd0('0x10f'));}catch(_0x177440){logger[_0x7fd0('0x2b')](_0x177440);}return _0x36caf8;}return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x59b313,_0x7fd0('0x159'));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x15a')]=function(_0x4f88c8){logger['info'](util['format'](_0x7fd0('0x15b'),_0x4f88c8[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x4f88c8[_0x7fd0('0x15c')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x4f88c8,_0x7fd0('0x15d'));}logger[_0x7fd0('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x4f88c8[_0x7fd0('0x15c')]));var _0x2ed27a=this[_0x7fd0('0x58')][_0x7fd0('0x78')](this,_0x4f88c8[_0x7fd0('0x15c')]);if(_0x2ed27a){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7fd0('0x3a')]['callerid'],_0x4f88c8[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x15e'),this[_0x7fd0('0x3a')]['callerid'],_0x4f88c8[_0x7fd0('0x15c')]));return{'code':0xc8,'result':_0x7fd0('0x15f')};}else{logger['info'](util[_0x7fd0('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x4f88c8[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x160'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x4f88c8['findBy']));return{'code':0xc8,'result':_0x7fd0('0x161')};}};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x162')]=function(_0x180e36){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x163'),_0x180e36['label']));if(!this[_0x7fd0('0x8f')](_0x180e36[_0x7fd0('0x15c')])){return this['channel'][_0x7fd0('0x2b')](_0x180e36,_0x7fd0('0x15d'));}logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x164'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x180e36[_0x7fd0('0x15c')]));var _0x40ab01=this[_0x7fd0('0x57')][_0x7fd0('0x78')](this,_0x180e36['findBy']);if(_0x40ab01){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x180e36[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0x15e'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x180e36[_0x7fd0('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x7fd0('0x160'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x180e36[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x160'),this[_0x7fd0('0x3a')]['callerid'],_0x180e36[_0x7fd0('0x15c')]));return{'code':0xc8,'result':_0x7fd0('0x161')};}};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x165')]=function(_0x2dceb1){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x166'),_0x2dceb1[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x2dceb1['operation'])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x2dceb1,_0x7fd0('0x167'));}this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x168'),_0x2dceb1[_0x7fd0('0x169')]));var _0x146ad1=eval(_0x2dceb1[_0x7fd0('0x169')]);if(!this[_0x7fd0('0x8f')](_0x2dceb1[_0x7fd0('0xe3')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xe4'));}var _0x492ca0=this[_0x7fd0('0xf')][_0x7fd0('0x78')](this,_0x2dceb1['variable_id']);if(!_0x492ca0){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x2dceb1,_0x7fd0('0xe5'));}if(_[_0x7fd0('0xa5')](_0x146ad1)){var _0x373fa0=this;_0x146ad1[_0x7fd0('0xe6')](function(_0x1197c5,_0x202d09){_0x373fa0[_0x7fd0('0x3a')]['setVariable'](util[_0x7fd0('0x27')](_0x7fd0('0x16a'),_0x492ca0,_0x202d09),_0x1197c5);});return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x16b'),_0x492ca0));}else{return this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](_0x492ca0,_0x146ad1);}};AGIVertices['prototype'][_0x7fd0('0x9')]=function(_0x20a219){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x16c'),_0x20a219[_0x7fd0('0x38')]));if(_0x20a219[_0x7fd0('0xad')]===0x0){return this['maxRetry'](_0x20a219);}_0x20a219[_0x7fd0('0xad')]-=0x1;if(!this[_0x7fd0('0x8f')](_0x20a219['file_id'])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x20a219,_0x7fd0('0x16d'));}var _0x44b33c=this[_0x7fd0('0x1b')][_0x7fd0('0x78')](this,_0x20a219[_0x7fd0('0x11c')]);if(!_0x44b33c){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x20a219,_0x7fd0('0x11d'));}var _0x3d818a=this['channel'][_0x7fd0('0x11e')](_0x44b33c,_0x20a219[_0x7fd0('0x11f')],_0x20a219[_0x7fd0('0x16e')]);var _0x5e2b47=_0x3d818a[_0x7fd0('0xb3')];if(_0x3d818a['result']===-0x1){this[_0x7fd0('0x36')]['sync'](this,_0x20a219,'-1');return _0x3d818a;}else if(_0x3d818a[_0x7fd0('0xab')]===_0x7fd0('0x6e')){_0x3d818a[_0x7fd0('0xb3')]=_0x3d818a[_0x7fd0('0xb3')][_0x7fd0('0xa8')]>0x0?_0x3d818a[_0x7fd0('0xb3')]:'t';}else if(_[_0x7fd0('0x47')](_0x3d818a[_0x7fd0('0xb3')])){_0x3d818a[_0x7fd0('0xb3')]='#';_0x5e2b47='#';}if(!this[_0x7fd0('0x8f')](_0x20a219['variable_id'])){this['channel'][_0x7fd0('0xb0')](_0x7fd0('0xe4'));}else{var _0x40958b=this[_0x7fd0('0xf')]['sync'](this,_0x20a219[_0x7fd0('0xe3')]);if(!_0x40958b){return this['channel'][_0x7fd0('0x2b')](_0x20a219,_0x7fd0('0xe5'));}this['channel'][_0x7fd0('0xa9')](_0x40958b,_0x5e2b47);}this['createSquareDetailsReport'][_0x7fd0('0x78')](this,_0x20a219,_0x5e2b47);return _0x3d818a;};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0xb0')]=function(_0x483988){logger[_0x7fd0('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x483988[_0x7fd0('0x38')]));return this['channel']['noop'](_0x483988[_0x7fd0('0x16f')]||_0x483988[_0x7fd0('0x38')]);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x170')]=function(_0x33b260){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x171'),_0x33b260[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x33b260[_0x7fd0('0x15c')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x33b260,_0x7fd0('0x15d'));}logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x33b260[_0x7fd0('0x15c')]));var _0x25a0b7=this['getPause']['sync'](this,_0x33b260[_0x7fd0('0x172')]);var _0x42fc25=this[_0x7fd0('0x54')][_0x7fd0('0x78')](this,_0x33b260[_0x7fd0('0x15c')],_0x25a0b7);if(_0x42fc25){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x15e'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x33b260['findBy']));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x15e'),this['channel'][_0x7fd0('0x3d')],_0x33b260[_0x7fd0('0x15c')]));return{'code':0xc8,'result':_0x7fd0('0x15f')};}else{logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x160'),this['channel']['callerid'],_0x33b260[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')]['noop'](util['format'](_0x7fd0('0x15e'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0x33b260[_0x7fd0('0x15c')]));return{'code':0xc8,'result':_0x7fd0('0x161')};}};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x173')]=function(_0xf373e2){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x174'),_0xf373e2['label']));if(!this[_0x7fd0('0x8f')](_0xf373e2[_0x7fd0('0x11c')])){return this['channel'][_0x7fd0('0x2b')](_0xf373e2,_0x7fd0('0x16d'));}var _0x39a653=this[_0x7fd0('0x1b')]['sync'](this,_0xf373e2[_0x7fd0('0x11c')]);if(!_0x39a653){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0xf373e2,_0x7fd0('0x11d'));}var _0x144a70=this['channel'][_0x7fd0('0x5d')](_0x7fd0('0x175'),[_0x39a653,_0xf373e2['opts']]);if(_0x144a70[_0x7fd0('0xb3')]===-0x1){return _0x144a70;}return this[_0x7fd0('0x3a')]['noop'](util[_0x7fd0('0x27')](_0x7fd0('0xcf'),_0x7fd0('0x175'),_0x39a653));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x176')]=function(_0x3a04ce){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x177'),_0x3a04ce[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0x3a04ce[_0x7fd0('0x178')])){return this['channel']['error'](_0x3a04ce,_0x7fd0('0x179'));}var _0x5563a7='';var _0x1f79c7=parseInt(_0x3a04ce['queue_id'],0xa);if(isNaN(_0x1f79c7)){_0x5563a7=_0x3a04ce['queue_id'];}else{_0x5563a7=this[_0x7fd0('0x13')]['sync'](this,_0x3a04ce[_0x7fd0('0x178')]);if(!_0x5563a7){return this['channel']['error'](_0x3a04ce,'no\x20queue\x20found');}}var _0x255738='';if(this[_0x7fd0('0x8f')](_0x3a04ce['file_id'])){var _0x3bcfdb=this[_0x7fd0('0x1b')]['sync'](this,_0x3a04ce['file_id']);if(_0x3bcfdb){_0x255738=_0x3bcfdb;}}this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0x3a04ce,_0x5563a7);if(_0x3a04ce[_0x7fd0('0xef')][_0x7fd0('0x17a')]('x')<0x0){_0x3a04ce[_0x7fd0('0xef')]+='x';}if(_0x3a04ce[_0x7fd0('0xef')][_0x7fd0('0x17a')]('X')<0x0){_0x3a04ce[_0x7fd0('0xef')]+='X';}this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](_0x7fd0('0x17b'),_0x5563a7?_0x5563a7[_0x7fd0('0x17c')]():'');var _0x142738=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')](_0x7fd0('0x17d'),[_0x5563a7,_0x3a04ce['opts'],_0x3a04ce['url'],_0x255738,_0x3a04ce[_0x7fd0('0x6e')],_0x3a04ce['agi'],_0x3a04ce['macro'],_0x3a04ce[_0x7fd0('0x17e')],'',_0x3a04ce['position']]);if(_0x142738[_0x7fd0('0xb3')]===-0x1){return _0x142738;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x5563a7));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x17f')]=function(_0x208c46){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x180'),_0x208c46[_0x7fd0('0x38')]));var _0x310d58=_0x208c46['recordingFormat']||'wav';var _0x1f7c5e=util[_0x7fd0('0x27')](_0x7fd0('0x181'),this['channel'][_0x7fd0('0x37')],rs['generate'](0x5));var _0xab1449=util[_0x7fd0('0x27')](_0x7fd0('0x182'),FILES_PATH,_0x1f7c5e,_0x310d58);var _0x32808f=util[_0x7fd0('0x27')](_0x7fd0('0x139'),FILES_PATH,_0x1f7c5e);this[_0x7fd0('0x3c')][_0x7fd0('0x78')](this,_0x208c46,_0x1f7c5e,_0xab1449);this['channel'][_0x7fd0('0xa9')](_0x7fd0('0x183'),_0x1f7c5e);logger[_0x7fd0('0x2e')](_0x7fd0('0x184'),_0x32808f,_0x310d58,_0x208c46[_0x7fd0('0x185')],_0x208c46['timeout']);return this[_0x7fd0('0x3a')][_0x7fd0('0x143')](_0x32808f,_0x310d58,_0x208c46['escape_digits'],_0x208c46['timeout'],undefined,!![]);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x186')]=function(_0xed6125){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x187'),_0xed6125[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0xed6125[_0x7fd0('0x6b')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x188'));}var _0xa69324=this[_0x7fd0('0x6a')][_0x7fd0('0x78')](this,_0xed6125);logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x189'),util['inspect'](_0xa69324,{'showHidden':![],'depth':null})));if(!this[_0x7fd0('0x8f')](_0xed6125[_0x7fd0('0xe3')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x18a'));}var _0x247a22=this[_0x7fd0('0xf')][_0x7fd0('0x78')](this,_0xed6125['variable_id']);if(!_0x247a22){return this[_0x7fd0('0x3a')]['error'](_0xed6125,_0x7fd0('0xe5'));}this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](util[_0x7fd0('0x27')](_0x7fd0('0x18b'),_0x247a22),_0xa69324[_0x7fd0('0x7b')]?_0xa69324['statusCode']:_0x7fd0('0x18c'));this[_0x7fd0('0x3a')]['setVariable'](util[_0x7fd0('0x27')](_0x7fd0('0x18d'),_0x247a22),_0xa69324[_0x7fd0('0x7c')]?_0xa69324[_0x7fd0('0x7c')]:'OK');if(_0xa69324['body']){try{this[_0x7fd0('0xa6')](_0xa69324[_0x7fd0('0x72')],_0x247a22);}catch(_0x2a1d03){logger[_0x7fd0('0x2b')](util[_0x7fd0('0x27')](_0x7fd0('0x18e'),_0x247a22));}}return this['channel']['noop'](util[_0x7fd0('0x27')]('variable\x20%s\x20set',_0x247a22));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x18f')]=function(_0x3b0c31){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x190'),_0x3b0c31['label']));return this['channel'][_0x7fd0('0x191')](_0x3b0c31[_0x7fd0('0x192')][_0x7fd0('0x5f')](/\s+/g,''),_0x3b0c31[_0x7fd0('0x185')]);};AGIVertices['prototype'][_0x7fd0('0x193')]=function(_0x1c5a12){logger['info'](util[_0x7fd0('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1c5a12[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0x194')](_0x1c5a12['number'][_0x7fd0('0x5f')](/\s+/g,''),_0x1c5a12[_0x7fd0('0x185')]);};AGIVertices[_0x7fd0('0xe')]['sayphonetic']=function(_0x4c16aa){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x195'),_0x4c16aa[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0x196')](_0x4c16aa[_0x7fd0('0x63')],_0x4c16aa[_0x7fd0('0x185')]);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x197')]=function(_0xeda376){logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x198'),_0xeda376[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0xeda376[_0x7fd0('0x199')])){return this['channel'][_0x7fd0('0xb0')](_0x7fd0('0x19a'));}var _0x3e9b86=this[_0x7fd0('0x19b')][_0x7fd0('0x78')](this,_0xeda376[_0x7fd0('0x199')]);if(!_0x3e9b86||!_0x3e9b86[_0x7fd0('0x19c')]){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0xeda376,_0x7fd0('0x19d'));}var _0x471122={'from':util[_0x7fd0('0x27')](_0x7fd0('0x19e'),_0x3e9b86['name'],_0x3e9b86['email']||_0x3e9b86[_0x7fd0('0x19c')][_0x7fd0('0x19f')]),'to':_0xeda376['to']||'','cc':_0xeda376['cc']||'','bcc':_0xeda376[_0x7fd0('0x1a0')]||'','subject':_0xeda376[_0x7fd0('0x1a1')],'html':_0xeda376['text'],'text':_0xeda376[_0x7fd0('0x63')]};if(this[_0x7fd0('0x8f')](_0xeda376[_0x7fd0('0x1a2')])){}logger[_0x7fd0('0xeb')](_0x7fd0('0x1a3'),JSON[_0x7fd0('0x7a')](_0x471122));this[_0x7fd0('0x36')]['sync'](this,_0xeda376,_0xeda376[_0x7fd0('0x199')]);this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x1a4'),_0x3e9b86['name']));this[_0x7fd0('0x20')][_0x7fd0('0x78')](this,_0x3e9b86['smtpOptions'],_0x471122);return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x7fd0('0xe')]['sendFax']=function(_0x12b331){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x12b331[_0x7fd0('0x38')]));return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7fd0('0xe')]['sendSMS']=function(_0x13cb34){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1a5'),_0x13cb34[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x13cb34[_0x7fd0('0x1a6')])){return this['channel']['noop'](_0x7fd0('0x1a7'));}var _0x4ce59b=this[_0x7fd0('0x33')][_0x7fd0('0x78')](this,_0x13cb34['sms_account_id']);if(!_0x4ce59b){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x13cb34,_0x7fd0('0x1a8'));}var _0x53ec04={'body':_0x13cb34[_0x7fd0('0x1a9')],'phone':_0x13cb34['to']||'','SmsAccountId':_0x4ce59b['id']};logger[_0x7fd0('0xeb')](_0x7fd0('0x1aa'),JSON['stringify'](_0x53ec04));this['createSquareDetailsReport'][_0x7fd0('0x78')](this,_0x13cb34,_0x13cb34[_0x7fd0('0x1a6')]);this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4ce59b[_0x7fd0('0x14')]));this[_0x7fd0('0x35')][_0x7fd0('0x78')](this,_0x53ec04);return this[_0x7fd0('0x3a')]['noop'](_0x7fd0('0x1ab'));};AGIVertices[_0x7fd0('0xe')]['set']=function(_0x479036){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1ac'),_0x479036[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x479036[_0x7fd0('0xe3')])){return this[_0x7fd0('0x3a')]['error'](_0x479036,_0x7fd0('0x1ad'));}var _0x52deb6=this['getVariable'][_0x7fd0('0x78')](this,_0x479036[_0x7fd0('0xe3')]);if(!_0x52deb6){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x479036,_0x7fd0('0xe5'));}return this[_0x7fd0('0x3a')][_0x7fd0('0xa9')](_0x52deb6,_0x479036[_0x7fd0('0x1ae')]);};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1af')]=function(_0x19a026){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1b0'),_0x19a026[_0x7fd0('0x38')]));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0x1b1'));if(_0x19a026[_0x7fd0('0xc3')]===_0x7fd0('0x1b2')){this['channel'][_0x7fd0('0xb0')]('Answer');return this[_0x7fd0('0x3a')][_0x7fd0('0xc3')]();}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')]('Skipped\x20Answer');};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1b3')]=function(_0xb7ab74){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1b4'),_0xb7ab74['label']));if(!this[_0x7fd0('0x8f')](_0xb7ab74[_0x7fd0('0x1b5')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0xb7ab74,_0x7fd0('0x1b6'));}var _0xaec915=this[_0x7fd0('0x15')]['sync'](this,_0xb7ab74[_0x7fd0('0x1b5')]);if(!this[_0x7fd0('0x8f')](_0xaec915)){return this['channel'][_0x7fd0('0x2b')](_0xb7ab74,util[_0x7fd0('0x27')](_0x7fd0('0x1b7'),_0xb7ab74[_0x7fd0('0x1b5')]));}if(_0xaec915===this['channel'][_0x7fd0('0x3b')]){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0xb7ab74,_0x7fd0('0x1b8'));}this[_0x7fd0('0x36')]['sync'](this,_0xb7ab74,_0xaec915);var _0x49b9a0=this['channel'][_0x7fd0('0x5d')](_0x7fd0('0x1b9'),util[_0x7fd0('0x27')](_0x7fd0('0x1ba'),config[_0x7fd0('0xc0')]['host']||_0x7fd0('0x1bb'),_0xaec915,this['channel'][_0x7fd0('0x3b')]));if(_0x49b9a0[_0x7fd0('0xb3')]===-0x1){return _0x49b9a0;}return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0xcf'),_0x7fd0('0x1b9'),_0xaec915));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1bc')]=function(_0xec9be4){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1bd'),_0xec9be4[_0x7fd0('0x38')]));var _0x198c9e=this[_0x7fd0('0x5c')]['sync'](this,_0xec9be4[_0x7fd0('0xc1')]);this[_0x7fd0('0x36')][_0x7fd0('0x78')](this,_0xec9be4,_0xec9be4[_0x7fd0('0xc1')]);if(this[_0x7fd0('0x8f')](_0xec9be4[_0x7fd0('0xe3')])){var _0x164846=this[_0x7fd0('0xf')][_0x7fd0('0x78')](this,_0xec9be4[_0x7fd0('0xe3')]);if(_0x164846){this['channel'][_0x7fd0('0xa9')](_0x164846,_0x198c9e);return this['channel'][_0x7fd0('0xb0')](util[_0x7fd0('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xec9be4['command'],_0x164846));}}return this[_0x7fd0('0x3a')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xec9be4[_0x7fd0('0xc1')]));};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1be')]=function(_0x19548e){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1bf'),_0x19548e[_0x7fd0('0x38')]));_0x19548e[_0x7fd0('0x63')]=_0x19548e[_0x7fd0('0x63')][_0x7fd0('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7fd0('0x8f')](_0x19548e[_0x7fd0('0x61')])){return this[_0x7fd0('0x3a')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x7fd0('0x8f')](_0x19548e['text'])){return this[_0x7fd0('0x3a')]['noop']('no\x20text\x20configured');}this[_0x7fd0('0x3a')]['noop'](util['format'](_0x7fd0('0x1c0'),_0x19548e['text']));var _0x5888e9=this[_0x7fd0('0x60')][_0x7fd0('0x78')](this,_0x19548e);if(_0x5888e9){this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x1c1'),_0x5888e9));var _0x2dad94=this[_0x7fd0('0x3a')][_0x7fd0('0x10e')](_0x5888e9);try{fs['unlink'](_0x5888e9+_0x7fd0('0x10f'));}catch(_0x2b1ef4){logger[_0x7fd0('0x2b')](_0x2b1ef4);}return _0x2dad94;}return this['channel'][_0x7fd0('0x2b')](_0x19548e,_0x7fd0('0x1c2'));};AGIVertices[_0x7fd0('0xe')]['tts']=function(_0x419c6e){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1c3'),_0x419c6e[_0x7fd0('0x38')]));_0x419c6e[_0x7fd0('0x63')]=_0x419c6e[_0x7fd0('0x63')][_0x7fd0('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x419c6e[_0x7fd0('0x63')])){return this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](_0x7fd0('0xb1'));}this['channel'][_0x7fd0('0xb0')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x419c6e[_0x7fd0('0x63')]));var _0x3cf822=this[_0x7fd0('0x68')]['sync'](this,_0x419c6e);if(_0x3cf822){this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util[_0x7fd0('0x27')](_0x7fd0('0x1c4'),_0x3cf822));var _0x55d4c6=this['channel'][_0x7fd0('0x10e')](_0x3cf822);try{fs[_0x7fd0('0x12e')](_0x3cf822+_0x7fd0('0x10f'));}catch(_0x5a7d1d){logger['error'](_0x5a7d1d);}return _0x55d4c6;}return this['channel'][_0x7fd0('0x2b')](_0x419c6e,_0x7fd0('0x1c5'));};AGIVertices[_0x7fd0('0xe')]['unpause']=function(_0xbb1289){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x1c6'),_0xbb1289[_0x7fd0('0x38')]));if(!this[_0x7fd0('0x8f')](_0xbb1289[_0x7fd0('0x15c')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0xbb1289,_0x7fd0('0x15d'));}logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0xbb1289[_0x7fd0('0x15c')]));var _0x2f3468=this[_0x7fd0('0x55')][_0x7fd0('0x78')](this,_0xbb1289[_0x7fd0('0x15c')]);if(_0x2f3468){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')](_0x7fd0('0x15e'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0xbb1289['findBy']));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0xbb1289[_0x7fd0('0x15c')]));return{'code':0xc8,'result':_0x7fd0('0x15f')};}else{logger[_0x7fd0('0x2e')](util['format'](_0x7fd0('0x160'),this[_0x7fd0('0x3a')][_0x7fd0('0x3d')],_0xbb1289[_0x7fd0('0x15c')]));this[_0x7fd0('0x3a')][_0x7fd0('0xb0')](util['format'](_0x7fd0('0x160'),this['channel'][_0x7fd0('0x3d')],_0xbb1289[_0x7fd0('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7fd0('0xe')][_0x7fd0('0x1c7')]=function(_0x5b96b2){logger['info'](util[_0x7fd0('0x27')](_0x7fd0('0x1c8'),_0x5b96b2['label']));var _0x2cb768=this[_0x7fd0('0x3a')][_0x7fd0('0x5d')](_0x7fd0('0x1c9'),[_0x5b96b2[_0x7fd0('0x1ca')],_0x5b96b2['options']]);if(_0x2cb768[_0x7fd0('0xb3')]===-0x1){return _0x2cb768;}return this['channel'][_0x7fd0('0xb0')](util['format'](_0x7fd0('0xcf'),'VOICEMAIL',_0x5b96b2['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x1a8d64){logger[_0x7fd0('0x2e')](util[_0x7fd0('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1a8d64[_0x7fd0('0x38')]));if(!this['isConfigured'](_0x1a8d64[_0x7fd0('0xe3')])){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x1a8d64,'no\x20variable\x20selected');}var _0x371f46=this[_0x7fd0('0xf')]['sync'](this,_0x1a8d64[_0x7fd0('0xe3')]);if(!_0x371f46){return this[_0x7fd0('0x3a')][_0x7fd0('0x2b')](_0x1a8d64,_0x7fd0('0xe5'));}var _0x40be9b=this[_0x7fd0('0x3a')][_0x7fd0('0xf')](_0x371f46);return{'code':0xc8,'result':_0x40be9b[_0x7fd0('0xab')]?_0x40be9b[_0x7fd0('0xab')]:'-'};};String[_0x7fd0('0xe')][_0x7fd0('0x1cb')]=function(_0x327491,_0x593fd8){return this[_0x7fd0('0xaa')](_0x327491)[_0x7fd0('0x1cc')](_0x593fd8);};module['exports']=AGIVertices; \ No newline at end of file +var _0x9efc=['error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','key','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','exec','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20operation\x20configured','operation','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','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','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','odbc','randomstring','request-promise','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getSound','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','interval','%s/sounds/converted/%s','getQueryOdbc','open'];(function(_0x2c59f1,_0x1c7052){var _0x4b1e8c=function(_0xccda50){while(--_0xccda50){_0x2c59f1['push'](_0x2c59f1['shift']());}};_0x4b1e8c(++_0x1c7052);}(_0x9efc,0x19c));var _0xc9ef=function(_0x2053aa,_0x3df40e){_0x2053aa=_0x2053aa-0x0;var _0x30f5bb=_0x9efc[_0x2053aa];return _0x30f5bb;};'use strict';var fs=require('fs');var util=require(_0xc9ef('0x0'));var _=require(_0xc9ef('0x1'));var sh=require(_0xc9ef('0x2'));var odbc=require(_0xc9ef('0x3'))();var rs=require(_0xc9ef('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var shared=require(_0xc9ef('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xc9ef('0x8');var recursiveMapAttributes=[_0xc9ef('0x9'),_0xc9ef('0xa')];var verticesWithRetry=[_0xc9ef('0xb'),_0xc9ef('0xc'),_0xc9ef('0xd')];var AGIVertices=function(_0x2795e4,_0xf37f26,_0x418b6b){this[_0xc9ef('0xe')]=_0x2795e4;this[_0xc9ef('0xf')]=_0xf37f26;this['mailRpc']=_0x418b6b;};AGIVertices['prototype'][_0xc9ef('0x10')]=function(_0x502913,_0xe8aa1f){this['rpc'][_0xc9ef('0x11')](_0x502913)['then'](function(_0x56c2c0){_0xe8aa1f(null,_0x56c2c0?_0x56c2c0[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x2ce47b){_0xe8aa1f(_0x2ce47b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x15')]=function(_0x233017,_0x17eed6){this[_0xc9ef('0xf')][_0xc9ef('0x16')](_0x233017)[_0xc9ef('0x17')](function(_0x624d74){_0x17eed6(null,_0x624d74?_0x624d74['name']:![]);})[_0xc9ef('0x13')](function(_0x181c2b){_0x17eed6(_0x181c2b);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18')]=function(_0xaea0df,_0x54e2c3){this[_0xc9ef('0xf')][_0xc9ef('0x19')](_0xaea0df)[_0xc9ef('0x17')](function(_0x122fb8){_0x54e2c3(null,_0x122fb8?_0x122fb8[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x1a2519){_0x54e2c3(_0x1a2519);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1a')]=function(_0xcc0fd8,_0x2fc01a){this[_0xc9ef('0xf')][_0xc9ef('0x1b')](_0xcc0fd8)[_0xc9ef('0x17')](function(_0x572f83){_0x2fc01a(null,_0x572f83?_0x572f83[_0xc9ef('0x1c')]:![]);})[_0xc9ef('0x13')](function(_0x32999b){_0x2fc01a(_0x32999b);});};AGIVertices['prototype'][_0xc9ef('0x1d')]=function(_0x23a402,_0x1ffff8){this[_0xc9ef('0xf')]['getUserById'](_0x23a402)[_0xc9ef('0x17')](function(_0x27df1f){_0x1ffff8(null,_0x27df1f?_0x27df1f['name']:![]);})[_0xc9ef('0x13')](function(_0xcd720a){_0x1ffff8(_0xcd720a);});};AGIVertices['prototype'][_0xc9ef('0x1e')]=function(_0x394a40,_0x3e336a){this[_0xc9ef('0xf')]['getTrunkById'](_0x394a40)[_0xc9ef('0x17')](function(_0x3b425f){_0x3e336a(null,_0x3b425f?_0x3b425f[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x53bf57){_0x3e336a(_0x53bf57);});};AGIVertices['prototype'][_0xc9ef('0x1f')]=function(_0x40c51b,_0x6dc9ee){var _0x53e1fe=this;this[_0xc9ef('0xf')][_0xc9ef('0x20')](_0x40c51b)[_0xc9ef('0x17')](function(_0x4042fc){_0x6dc9ee(null,_0x4042fc?_0x53e1fe[_0xc9ef('0x21')](_0x4042fc['save_name']):![]);})['catch'](function(_0x458546){_0x6dc9ee(_0x458546);});};AGIVertices[_0xc9ef('0x14')]['getMailAccount']=function(_0x5987c1,_0x123005){this['rpc'][_0xc9ef('0x22')](_0x5987c1)['then'](function(_0x2bf9be){_0x123005(null,_0x2bf9be?_0x2bf9be:![]);})[_0xc9ef('0x13')](function(_0x178a50){_0x123005(_0x178a50);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x23')]=function(_0x148190,_0x5210ac,_0x2f957b){this[_0xc9ef('0x24')]['sendMailMessage'](_0x148190,_0x5210ac)[_0xc9ef('0x17')](function(){_0x2f957b(null);})[_0xc9ef('0x13')](function(_0xe040e){_0x2f957b(_0xe040e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x25')]=function(_0x56f2e0,_0x239c18){this[_0xc9ef('0xf')][_0xc9ef('0x26')](_0x56f2e0)[_0xc9ef('0x17')](function(_0x1abd64){if(_0x1abd64){if(_0x1abd64['IntervalId']){_0x239c18(null,[_0x1abd64['interval']]);}else{_0x239c18(null,_[_0xc9ef('0x27')](_0x1abd64[_0xc9ef('0x28')],_0xc9ef('0x29')));}}else{_0x239c18(null,![]);}})['catch'](function(_0x5f2393){_0x239c18(_0x5f2393);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x21')]=function(_0x49aa7f){return util['format'](_0xc9ef('0x2a'),FILES_PATH,_0x49aa7f);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x2b')]=function(_0x50ece6,_0x1b77d5,_0x434296){odbc[_0xc9ef('0x2c')](_0x50ece6,function(_0x4ef921){if(_0x4ef921){logger[_0xc9ef('0x2d')](_0xc9ef('0x2e'),_0x4ef921);_0x434296(_0x4ef921);}else{logger[_0xc9ef('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1b77d5,function(_0x44f3e5,_0x43a177){if(_0x44f3e5){logger['info'](_0xc9ef('0x30'),_0x1b77d5);_0x434296(_0x44f3e5);}else{logger['info'](_0xc9ef('0x31'),_0x1b77d5);odbc[_0xc9ef('0x32')](function(_0x3904ba){if(_0x3904ba){logger['error'](_0xc9ef('0x33'),_0x3904ba);}_0x434296(null,_0x43a177);});}});}});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x34')]=function(_0x115422,_0x35da4a){this[_0xc9ef('0xf')][_0xc9ef('0x35')](_0x115422)[_0xc9ef('0x17')](function(_0x33678d){_0x35da4a(null,_0x33678d?_0x33678d:![]);})['catch'](function(_0xe2b221){_0x35da4a(_0xe2b221);});};AGIVertices[_0xc9ef('0x14')]['createSmsMessage']=function(_0x39d2b0,_0x1fd1f0){this[_0xc9ef('0xf')][_0xc9ef('0x36')](_0x39d2b0)[_0xc9ef('0x17')](function(_0x2d0a9d){_0x1fd1f0(null,_0x2d0a9d);})[_0xc9ef('0x13')](function(_0x57bdbb){_0x1fd1f0(_0x57bdbb);});};AGIVertices[_0xc9ef('0x14')]['createSquareDetailsReport']=function(_0x42e7c0,_0x5f2b8c,_0x4ef754){this[_0xc9ef('0xf')][_0xc9ef('0x37')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'node':_0x42e7c0[_0xc9ef('0x39')],'application':_0x42e7c0[_0xc9ef('0x3a')],'data':_0x5f2b8c||null,'project_name':this[_0xc9ef('0xe')][_0xc9ef('0x3b')],'callerid':this['channel'][_0xc9ef('0x3c')]})['then'](function(_0x459ceb){if(_0x4ef754){_0x4ef754(null,_0x459ceb);}})[_0xc9ef('0x13')](function(_0x260677){if(_0x4ef754){_0x4ef754(_0x260677);}});};AGIVertices[_0xc9ef('0x14')]['createSquareRecording']=function(_0x32fb2d,_0x1d25f0,_0xb25053,_0x10e9f2){this['rpc'][_0xc9ef('0x3d')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'callerid':this['channel']['callerid'],'calleridname':this[_0xc9ef('0xe')][_0xc9ef('0x3e')],'context':this[_0xc9ef('0xe')]['context'],'extension':this[_0xc9ef('0xe')]['extension'],'priority':this[_0xc9ef('0xe')][_0xc9ef('0x3f')],'accountcode':this[_0xc9ef('0xe')][_0xc9ef('0x40')],'dnid':this[_0xc9ef('0xe')]['dnid'],'projectName':this[_0xc9ef('0xe')]['arg_1'],'saveName':_0x1d25f0,'filename':_0x32fb2d[_0xc9ef('0x41')]||_0x1d25f0,'savePath':_0xb25053})[_0xc9ef('0x17')](function(_0x3c635b){_0x10e9f2(null,_0x3c635b);})[_0xc9ef('0x13')](function(_0x2ff065){_0x10e9f2(_0x2ff065);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x42')]=function(_0x24553f,_0x216b74,_0x281cf5,_0x4028e8,_0x160633){this[_0xc9ef('0xf')][_0xc9ef('0x42')]({'uniqueid':this[_0xc9ef('0xe')][_0xc9ef('0x38')],'body':_0x24553f,'direction':_0x216b74,'providerName':_0x281cf5,'providerResponse':_0x4028e8})[_0xc9ef('0x17')](function(_0x8c3874){if(_0x160633){_0x160633(null,_0x8c3874);}})[_0xc9ef('0x13')](function(_0x2f8f19){if(_0x160633){_0x160633(_0x2f8f19);}});};AGIVertices[_0xc9ef('0x14')]['createCmContact']=function(_0x4a12c9,_0x66a935){this['rpc'][_0xc9ef('0x43')]({'firstName':_['isEmpty'](_0x4a12c9[_0xc9ef('0x12')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x12')])?_0xc9ef('0x45')+Math[_0xc9ef('0x46')]():_0x4a12c9[_0xc9ef('0x12')],'lastName':_[_0xc9ef('0x47')](_0x4a12c9[_0xc9ef('0x48')])||_[_0xc9ef('0x44')](_0x4a12c9[_0xc9ef('0x48')])?null:_0x4a12c9[_0xc9ef('0x48')],'phone':_0x4a12c9[_0xc9ef('0x49')],'ListId':_0x4a12c9[_0xc9ef('0x4a')],'scheduledat':_0x4a12c9[_0xc9ef('0x4b')],'callbackUniqueid':this['channel']['uniqueid'],'tags':'callback','description':_0xc9ef('0x4c')+_0x4a12c9['scheduledAt']['toString'](),'priority':_0x4a12c9[_0xc9ef('0x4d')]})[_0xc9ef('0x17')](function(_0x4f9d27){_0x66a935(null,_0x4f9d27);})[_0xc9ef('0x13')](function(_0x38dccb){_0x66a935(_0x38dccb);});};AGIVertices['prototype'][_0xc9ef('0x4e')]=function(_0x137555,_0x31908c){this[_0xc9ef('0xf')][_0xc9ef('0x4f')](_0x137555)[_0xc9ef('0x17')](function(_0xb9265a){_0x31908c(null,_0xb9265a?_0xb9265a[_0xc9ef('0x12')]:![]);})[_0xc9ef('0x13')](function(_0x462a19){_0x31908c(_0x462a19);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x50')]=function(_0x21e997,_0x250ad3,_0x18eda2){var _0x51a55f={'role':_0xc9ef('0x51')};_0x51a55f[_0x21e997]=this[_0xc9ef('0xe')][_0xc9ef('0x3c')];this[_0xc9ef('0xf')]['agentPause'](_0x51a55f,_0x250ad3,this[_0xc9ef('0xe')][_0xc9ef('0x38')])[_0xc9ef('0x17')](function(_0xe1baf4){_0x18eda2(null,_[_0xc9ef('0x44')](_0xe1baf4)?![]:!![]);})['catch'](function(_0x5f57cc){logger[_0xc9ef('0x2d')](_0x5f57cc);_0x18eda2(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x52')]=function(_0x54cc55,_0x1c8379){var _0x2a0c25={'role':'agent'};_0x2a0c25[_0x54cc55]=this[_0xc9ef('0xe')]['callerid'];this[_0xc9ef('0xf')]['agentUnpause'](_0x2a0c25)[_0xc9ef('0x17')](function(_0x32d0a7){_0x1c8379(null,_[_0xc9ef('0x44')](_0x32d0a7)?![]:!![]);})[_0xc9ef('0x13')](function(_0x5b678e){logger[_0xc9ef('0x2d')](_0x5b678e);_0x1c8379(null,![]);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x53')]=function(_0x85757f,_0x448177){var _0x437930={'role':_0xc9ef('0x51')};_0x437930[_0x85757f]=this['channel'][_0xc9ef('0x3c')];this[_0xc9ef('0xf')][_0xc9ef('0x53')](_0x437930)[_0xc9ef('0x17')](function(_0x5e38d4){_0x448177(null,_[_0xc9ef('0x44')](_0x5e38d4)?![]:!![]);})[_0xc9ef('0x13')](function(_0x349a10){logger[_0xc9ef('0x2d')](_0x349a10);_0x448177(null,![]);});};AGIVertices['prototype'][_0xc9ef('0x54')]=function(_0x3efc9a,_0x593fd3){var _0x26990f={'role':_0xc9ef('0x51')};_0x26990f[_0x3efc9a]=this['channel'][_0xc9ef('0x3c')];var _0x5235d9=_0x3efc9a!=_0xc9ef('0x55')?util[_0xc9ef('0x56')]('%s/%s@from-sip/n','LOCAL',this[_0xc9ef('0xe')][_0xc9ef('0x3c')]):undefined;this[_0xc9ef('0xf')][_0xc9ef('0x54')](_0x26990f,_0x5235d9)['then'](function(_0x151944){_0x593fd3(null,_['isNil'](_0x151944)?![]:!![]);})[_0xc9ef('0x13')](function(_0x553717){logger[_0xc9ef('0x2d')](_0x553717);_0x593fd3(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x14d108,_0x338df8){sh['exec'](_['trim'](_0x14d108),function(_0x254e77,_0x5162cf){var _0x22847b=_0x5162cf[_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'');_0x338df8(null,_0x22847b);});};AGIVertices['prototype'][_0xc9ef('0x58')]=function(_0x52269e,_0x213a79){scripts['googleCloudTTS'](_0x52269e[_0xc9ef('0x59')],_0x52269e[_0xc9ef('0x5a')]||_0xc9ef('0x5b'),_0x52269e[_0xc9ef('0x5b')],_0x52269e[_0xc9ef('0x5c')]||'en-US',_0x52269e[_0xc9ef('0x5d')]||_0xc9ef('0x5e'),_0x52269e['audioEncoding']||_0xc9ef('0x5f'))[_0xc9ef('0x17')](function(_0x1398d9){_0x213a79(null,_0x1398d9);})[_0xc9ef('0x13')](function(_0xc1049){_0x213a79(_0xc1049);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x60')]=function(_0x11dc8b,_0x42ad4){scripts[_0xc9ef('0x60')](_0x11dc8b[_0xc9ef('0x5b')],_0x11dc8b['google_tts_language']||'en',0x1)[_0xc9ef('0x17')](function(_0x2d8855){_0x42ad4(null,_0x2d8855);})[_0xc9ef('0x13')](function(_0x4b4620){_0x42ad4(_0x4b4620);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x61')]=function(_0x363032,_0x4e5f47){var _0x2ca308={'uri':_0x363032[_0xc9ef('0x62')],'method':_0x363032[_0xc9ef('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x363032[_0xc9ef('0x64')])===_0xc9ef('0x65')&&parseInt(_0x363032[_0xc9ef('0x64')])>=0x1?parseInt(_0x363032[_0xc9ef('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xc9ef('0x66')]([_0xc9ef('0x67'),'PUT'],_0x2ca308[_0xc9ef('0x63')][_0xc9ef('0x68')]())){try{_0x2ca308['body']=_0x363032[_0xc9ef('0xa')]?JSON['parse'](_0x363032[_0xc9ef('0xa')]):{};}catch(_0x19e3c7){logger[_0xc9ef('0x2d')](_0xc9ef('0x69'),_0x19e3c7);}}try{_0x2ca308[_0xc9ef('0x6a')]=_0x363032[_0xc9ef('0x9')]?JSON[_0xc9ef('0x6b')](_0x363032['rawHeaders']):{};}catch(_0x2bfe4d){logger[_0xc9ef('0x2d')](_0xc9ef('0x6c'),_0x2bfe4d);}if(_0x363032[_0xc9ef('0x6d')]){try{var _0x4be265=require(_0x363032['computedVariables'])[_0xc9ef('0x6e')](this,_0x2ca308);_0x2ca308[_0xc9ef('0x6f')]=Mustache[_0xc9ef('0x70')](_0x363032[_0xc9ef('0x62')],_0x4be265,{},['$$','$$']);if(_0x2ca308[_0xc9ef('0x6a')]){_0x2ca308[_0xc9ef('0x6a')]=JSON['parse'](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x6a')]),_0x4be265,{},['$$','$$']));}if(_0x2ca308[_0xc9ef('0x71')]){_0x2ca308[_0xc9ef('0x71')]=JSON[_0xc9ef('0x6b')](Mustache[_0xc9ef('0x70')](JSON['stringify'](_0x2ca308[_0xc9ef('0x71')]),_0x4be265,{},['$$','$$']));}}catch(_0x656c29){logger[_0xc9ef('0x2d')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x656c29);}}rp(_0x2ca308)['then'](function(_0x525c6c){var _0x17fffd={'statusCode':_0x525c6c['statusCode']||0xc8,'statusMessage':_0x525c6c[_0xc9ef('0x72')]||'OK','headers':_0x525c6c['headers']||{},'body':_0x525c6c['body']||{}};_0x4e5f47(null,_0x17fffd);})[_0xc9ef('0x13')](function(_0xbc5168){var _0x54ca4e={'statusCode':_0xbc5168['statusCode']||0x1f4,'statusMessage':_0xbc5168['message']||_0xc9ef('0x73'),'headers':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x6a')]||{},'body':_0xbc5168[_0xc9ef('0x74')][_0xc9ef('0x71')]||{}};_0x4e5f47(null,_0x54ca4e);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x75')]=function(_0x282026,_0x57d44b){scripts['googleDialogflow'](this[_0xc9ef('0xe')]['uniqueid'],_0x282026['key'],_0x282026['text'],_0x282026['dialogflow_language']||'en')[_0xc9ef('0x17')](function(_0x4f034c){_0x57d44b(null,_0x4f034c);})[_0xc9ef('0x13')](function(_0xfa2a57){_0x57d44b(_0xfa2a57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x76')]=function(_0xb6329f,_0x26237b){scripts[_0xc9ef('0x76')](this[_0xc9ef('0xe')]['uniqueid'],_0xb6329f['dialogflowV2_project_id'],_0xb6329f[_0xc9ef('0x77')],_0xb6329f[_0xc9ef('0x78')],_0xb6329f['text'],_0xb6329f[_0xc9ef('0x79')]||'en')['then'](function(_0x1493e3){_0x26237b(null,_0x1493e3);})[_0xc9ef('0x13')](function(_0x5586dd){_0x26237b(_0x5586dd);});};AGIVertices[_0xc9ef('0x14')]['sestekNDA']=function(_0x4f5dbd,_0x1a47e4){scripts['sestekNDA'](this[_0xc9ef('0xe')],_0x4f5dbd)['then'](function(_0x9fb1b6){_0x1a47e4(null,_0x9fb1b6);})['catch'](function(_0x5a1fe2){_0x1a47e4(_0x5a1fe2);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7a')]=function(_0x27e2d4,_0x91704c){scripts[_0xc9ef('0x7a')](_0x27e2d4['key'],_0x27e2d4[_0xc9ef('0x5b')],_0x27e2d4[_0xc9ef('0x7b')]||_0xc9ef('0x7c'),_0x27e2d4[_0xc9ef('0x7d')])[_0xc9ef('0x17')](function(_0x28f440){_0x91704c(null,_0x28f440);})[_0xc9ef('0x13')](function(_0x25ff57){_0x91704c(_0x25ff57);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x7e')]=function(_0x494bfe,_0x3ed381,_0x4fe532){scripts[_0xc9ef('0x7e')](_0x3ed381,_0x494bfe[_0xc9ef('0x7f')],_0x494bfe[_0xc9ef('0x80')]||_0xc9ef('0x7c'),this[_0xc9ef('0x81')](_0x494bfe[_0xc9ef('0x82')])?_0x494bfe['model']:undefined)[_0xc9ef('0x17')](function(_0x56ffdc){_0x4fe532(null,_0x56ffdc);})['catch'](function(_0x3112f3){_0x4fe532(_0x3112f3);});};AGIVertices['prototype'][_0xc9ef('0x83')]=function(_0x57b8ef,_0x36efc5){scripts[_0xc9ef('0x83')](_0x57b8ef[_0xc9ef('0x84')],_0x57b8ef[_0xc9ef('0x85')],_0x57b8ef[_0xc9ef('0x86')],_0x57b8ef[_0xc9ef('0x87')]||'Amy',_0x57b8ef[_0xc9ef('0x5b')],_0x57b8ef[_0xc9ef('0x88')]||_0xc9ef('0x5b'))['then'](function(_0x306546){_0x36efc5(null,_0x306546);})[_0xc9ef('0x13')](function(_0xf33e35){_0x36efc5(_0xf33e35);});};AGIVertices[_0xc9ef('0x14')]['awsLex']=function(_0x40a09c,_0x58089c){scripts['awsLex'](this[_0xc9ef('0xe')][_0xc9ef('0x38')],_0x40a09c[_0xc9ef('0x84')],_0x40a09c['aws_secret_access_key'],_0x40a09c[_0xc9ef('0x89')],_0x40a09c['text'],_0x40a09c[_0xc9ef('0x8a')])['then'](function(_0x29f821){_0x58089c(null,_0x29f821);})['catch'](function(_0x3862bd){_0x58089c(_0x3862bd);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8b')]=function(_0x429d75,_0x299b3e,_0x58742f){scripts[_0xc9ef('0x8b')](_0x299b3e,_0x429d75[_0xc9ef('0x7f')],_0x429d75[_0xc9ef('0x8c')]||'en-US')[_0xc9ef('0x17')](function(_0xc3c1cd){_0x58742f(null,_0xc3c1cd);})[_0xc9ef('0x13')](function(_0x246af1){_0x58742f(_0x246af1);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x8d')]=function(_0x17fc35,_0x31b5b3,_0x1a0be7){scripts['tildeASR'](_0x31b5b3,_0x17fc35[_0xc9ef('0x8e')],_0x17fc35[_0xc9ef('0x8f')],_0x17fc35[_0xc9ef('0x6f')])['then'](function(_0x2566de){_0x1a0be7(null,_0x2566de);})[_0xc9ef('0x13')](function(_0x89b157){_0x1a0be7(_0x89b157);});};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x90')]=function(_0x350677){var _0x53596a=_['includes'](verticesWithRetry,_0x350677['agicommand'])?_0x350677:_[_0xc9ef('0x91')](_0x350677);for(var _0x34253a in _0x53596a){if(_0x53596a[_0xc9ef('0x92')](_0x34253a)){if(_0x53596a[_0x34253a]&&_[_0xc9ef('0x93')](_0x53596a[_0x34253a])){if(_[_0xc9ef('0x66')](recursiveMapAttributes,_0x34253a)){_0x53596a[_0x34253a]=this[_0xc9ef('0x94')](_0x53596a[_0x34253a]);}else{_0x53596a[_0x34253a]=this[_0xc9ef('0x95')](_0x53596a[_0x34253a]);}}}}return _0x53596a;};AGIVertices[_0xc9ef('0x14')]['recursiveNodeIndex']=function(_0x3fc804){for(var _0x507544 in _0x3fc804){if(_0x3fc804['hasOwnProperty'](_0x507544)){if(_[_0xc9ef('0x96')](_0x3fc804[_0x507544])){this[_0xc9ef('0x97')](_0x3fc804[_0x507544]);}else if(_[_0xc9ef('0x98')](_0x3fc804[_0x507544])){for(var _0x4e5ebd=0x0;_0x4e5ebd<_0x3fc804[_0x507544][_0xc9ef('0x99')];_0x4e5ebd++){this[_0xc9ef('0x97')](_0x3fc804[_0x507544][_0x4e5ebd]);}}else if(_['isString'](_0x3fc804[_0x507544])){_0x3fc804[_0x507544]=this[_0xc9ef('0x95')](_0x3fc804[_0x507544]);}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x9a')]=function(_0x553c4a,_0x948bc9){for(var _0x5be3c4 in _0x553c4a){if(_0x553c4a[_0xc9ef('0x92')](_0x5be3c4)){if(_['isPlainObject'](_0x553c4a[_0x5be3c4])){if(!_[_0xc9ef('0x47')](_0x553c4a[_0x5be3c4])){this[_0xc9ef('0x9a')](_0x553c4a[_0x5be3c4],util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x948bc9,_0x5be3c4));}}else if(_['isArray'](_0x553c4a[_0x5be3c4])){for(var _0x25a37c=0x0;_0x25a37c<_0x553c4a[_0x5be3c4][_0xc9ef('0x99')];_0x25a37c++){this['saveRestApiResult'](_0x553c4a[_0x5be3c4][_0x25a37c],util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4+'['+_0x25a37c+']'));}}else{if(!_[_0xc9ef('0x44')](_0x553c4a[_0x5be3c4])){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')]('%s.%s',_0x948bc9,_0x5be3c4),_0x553c4a[_0x5be3c4]);}}}}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x94')]=function(_0x9edcf1){try{var _0x29044a=JSON[_0xc9ef('0x6b')](_0x9edcf1);this['recursiveNodeIndex'](_0x29044a);return JSON[_0xc9ef('0x9d')](_0x29044a);}catch(_0xd7b599){return this[_0xc9ef('0x95')](_0x9edcf1);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x95')]=function(_0x33a442){var _0x42ac7d=_0x33a442[_0xc9ef('0x9e')]('{');for(var _0x39df1f=0x1;_0x39df1f<_0x42ac7d[_0xc9ef('0x99')];_0x39df1f+=0x1){var _0x2727b9=_0x42ac7d[_0x39df1f][_0xc9ef('0x9e')]('}');if(_0x2727b9[_0xc9ef('0x99')]>0x1){_0x33a442=_0x33a442['replaceAll']('{'+_0x2727b9[0x0]+'}',this[_0xc9ef('0xe')][_0xc9ef('0x10')](_0x2727b9[0x0])[_0xc9ef('0x9f')]||_0x2727b9[0x0]);}}if(_0x42ac7d['length']===0x1){return _0x33a442[_0xc9ef('0xa0')]();}return this[_0xc9ef('0x95')](_0x33a442);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa1')]=function(_0x49983a,_0x1703d7){var _0x3a03d5=this[_0xc9ef('0xe')]['getVariable'](_0x49983a);if(_0x3a03d5[_0xc9ef('0xa2')]===-0x1){return _0x3a03d5;}logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa3'),_0x1703d7,_0x3a03d5['extra']));return this[_0xc9ef('0xe')]['setVariable'](_0x1703d7,_0x3a03d5['extra']);};AGIVertices[_0xc9ef('0x14')]['isConfigured']=function(_0x3d2ae1){return _0x3d2ae1&&_0x3d2ae1!=='0'&&_0x3d2ae1!=='-1'&&_0x3d2ae1!=='';};AGIVertices['prototype'][_0xc9ef('0xa4')]=function(_0x4bdd5c){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4bdd5c,'-');_0x4bdd5c[_0xc9ef('0xa5')]=_0x4bdd5c[_0xc9ef('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xa6')]=function(_0x359e53){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xa7'),_0x359e53[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}var _0x3947ab='\x22'+_0x359e53[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x359e53[_0xc9ef('0x74')])){_0x3947ab+=','+_0x359e53[_0xc9ef('0x74')];}var _0x2d4776=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3947ab);if(_0x2d4776['result']===-0x1){return _0x2d4776;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3947ab));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xab')]=function(_0x536f2e){logger['info'](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x536f2e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x536f2e['grammar'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x2a0bda=_0x536f2e[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x536f2e['options'])){_0x2a0bda+=','+_0x536f2e[_0xc9ef('0x74')];}var _0x565c32=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x2a0bda);if(_0x565c32[_0xc9ef('0xa2')]===-0x1){return _0x565c32;}var _0x1da388=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xaf'));if(_0x1da388[_0xc9ef('0xa2')]===-0x1){return _0x1da388;}var _0x36d1fb=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xb0'));if(_0x36d1fb[_0xc9ef('0xa2')]===-0x1){return _0x36d1fb;}var _0x55fd73=this[_0xc9ef('0xa1')]('RECOG_INSTANCE()',_0xc9ef('0xb1'));if(_0x55fd73['result']===-0x1){return _0x55fd73;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xb2'),_0x2a0bda));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x6')]=function(_0x22231a){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xb3'),_0x22231a[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x6')]([_0x22231a[_0xc9ef('0xb4')],_0x22231a['args']]);};AGIVertices[_0xc9ef('0x14')]['answer']=function(_0x189711){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb5'),_0x189711[_0xc9ef('0x39')]));if(this[_0xc9ef('0x81')](_0x189711[_0xc9ef('0x64')])){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb6'),_0x189711[_0xc9ef('0x64')]));var _0x375ba=this[_0xc9ef('0xe')]['wait'](_0x189711[_0xc9ef('0x64')]);if(_0x375ba[_0xc9ef('0xa2')]===-0x1){return _0x375ba;}}return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb8')]=function(_0x56a2d3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0xb9'),_0x56a2d3['label']));if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4a')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x56a2d3,'no\x20list\x20selected');}_0x56a2d3[_0xc9ef('0x4b')]=moment();if(this['isConfigured'](_0x56a2d3[_0xc9ef('0xba')])){_0x56a2d3[_0xc9ef('0x4b')]=moment()[_0xc9ef('0xbb')](_0x56a2d3[_0xc9ef('0xba')],'minutes');}if(!this[_0xc9ef('0x81')](_0x56a2d3[_0xc9ef('0x4d')])){_0x56a2d3[_0xc9ef('0x4d')]=0x2;}this[_0xc9ef('0x43')][_0xc9ef('0x6e')](this,_0x56a2d3);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbc'),_0x56a2d3[_0xc9ef('0x49')],_0x56a2d3[_0xc9ef('0x4a')],_0x56a2d3['scheduledAt']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xbd')]=function(_0x546e34){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x546e34[_0xc9ef('0x39')]));var _0x41700b=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0x546e34[_0xc9ef('0xbe')],_0x546e34[_0xc9ef('0x74')]);if(_0x41700b['result']===-0x1){return _0x41700b;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0x546e34['application'],_0x546e34['options']));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc0')]=function(_0x34b1a5){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xc1'),_0x34b1a5[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x34b1a5[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x3de43b='\x22'+_0x34b1a5[_0xc9ef('0x5b')]+'\x22';if(this[_0xc9ef('0x81')](_0x34b1a5['options'])){_0x3de43b+=','+_0x34b1a5[_0xc9ef('0x74')];}var _0x5589b5=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xaa'),_0x3de43b);if(_0x5589b5[_0xc9ef('0xa2')]===-0x1){return _0x5589b5;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x3de43b));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc4')]=function(_0x1c52e2){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1c52e2[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}var _0x1e5207='\x22'+_0x1c52e2['text']+'\x22';if(this[_0xc9ef('0x81')](_0x1c52e2[_0xc9ef('0x74')])){_0x1e5207+=','+_0x1c52e2['options'];}var _0x41720f=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xaa'),_0x1e5207);if(_0x41720f[_0xc9ef('0xa2')]===-0x1){return _0x41720f;}return this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xc3'),_0x1e5207));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xc5')]=function(_0x3056b9){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xc6'),_0x3056b9[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0xad')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x206e1f=_0x3056b9[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x3056b9[_0xc9ef('0x74')])){_0x206e1f+=','+_0x3056b9[_0xc9ef('0x74')];}var _0x45e067=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x206e1f);if(_0x45e067['result']===-0x1){return _0x45e067;}var _0x56f487=this[_0xc9ef('0xa1')]('RECOG_CONFIDENCE()',_0xc9ef('0xc7'));if(_0x56f487[_0xc9ef('0xa2')]===-0x1){return _0x56f487;}var _0x5cf085=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xc8'));if(_0x5cf085[_0xc9ef('0xa2')]===-0x1){return _0x5cf085;}var _0x147271=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),'LUMENVOX_ASR_INSTANCE');if(_0x147271['result']===-0x1){return _0x147271;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x206e1f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xca')]=function(_0x9fd023){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xcb'),_0x9fd023[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0xad')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xac'));}var _0x561d03=_0x9fd023[_0xc9ef('0xad')];if(this[_0xc9ef('0x81')](_0x9fd023[_0xc9ef('0x74')])){_0x561d03+=','+_0x9fd023[_0xc9ef('0x74')];}var _0x1b00ff=this['channel'][_0xc9ef('0xa9')](_0xc9ef('0xae'),_0x561d03);if(_0x1b00ff[_0xc9ef('0xa2')]===-0x1){return _0x1b00ff;}var _0x5e7635=this[_0xc9ef('0xa1')](_0xc9ef('0xcc'),_0xc9ef('0xcd'));if(_0x5e7635[_0xc9ef('0xa2')]===-0x1){return _0x5e7635;}var _0xb06252=this[_0xc9ef('0xa1')]('RECOG_INPUT()',_0xc9ef('0xce'));if(_0xb06252[_0xc9ef('0xa2')]===-0x1){return _0xb06252;}var _0x59bd93=this[_0xc9ef('0xa1')](_0xc9ef('0xc9'),_0xc9ef('0xcf'));if(_0x59bd93[_0xc9ef('0xa2')]===-0x1){return _0x59bd93;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xb2'),_0x561d03));};AGIVertices['prototype'][_0xc9ef('0xd0')]=function(_0x423d31){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0xd1'),_0x423d31[_0xc9ef('0x39')]));if(!this['isConfigured'](_0x423d31[_0xc9ef('0xd2')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd3'));}var _0x733fa5=this['getSquareOdbc'][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd2')]);if(!_0x733fa5){return this[_0xc9ef('0xe')]['error'](_0x423d31,_0xc9ef('0xd4'));}if(!this[_0xc9ef('0x81')](_0x423d31['query'])){return this['channel'][_0xc9ef('0x2d')](_0x423d31,_0xc9ef('0xd5'));}var _0x3cd3ed=_0x423d31[_0xc9ef('0xd6')][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xd7'),_0x3cd3ed));var _0x1463c3=this['getQueryOdbc'][_0xc9ef('0x6e')](this,_0x733fa5,_0x3cd3ed);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x423d31,_0x3cd3ed);if(!this[_0xc9ef('0x81')](_0x423d31[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x343a68=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x423d31[_0xc9ef('0xd8')]);if(!_0x343a68){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x423d31,'no\x20variable\x20found');}var _0x4ccab=this;_0x1463c3[_0xc9ef('0xda')](function(_0x213717,_0xc577e3){Object[_0xc9ef('0xdb')](_0x213717)[_0xc9ef('0xda')](function(_0x3ce224){_0x4ccab[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0xdc'),_0x343a68,_0xc577e3,_0x3ce224),_0x213717[_0x3ce224]);});});this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xdd'),_0x343a68),_0x1463c3[_0xc9ef('0x99')]);return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xde'),_0x343a68));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xdf')]=function(_0x426dcc){logger[_0xc9ef('0xe0')](util[_0xc9ef('0x56')](_0xc9ef('0xe1'),_0x426dcc['label']));if(!this[_0xc9ef('0x81')](_0x426dcc['sip_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe2'));}var _0xd36d8a=this[_0xc9ef('0x1d')][_0xc9ef('0x6e')](this,_0x426dcc['sip_id']);if(!_0xd36d8a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x426dcc,_0xc9ef('0xe3'));}var _0x3fa98e=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')]('SIP/%s',_0xd36d8a),_0x426dcc[_0xc9ef('0x64')],_0x426dcc[_0xc9ef('0xe5')],_0x426dcc[_0xc9ef('0x62')]]);if(_0x3fa98e[_0xc9ef('0xa2')]===-0x1){return _0x3fa98e;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')]['dialogflow']=function(_0x321e5c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xe7'),_0x321e5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x321e5c[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x321e5c);this[_0xc9ef('0x42')](_0x321e5c[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Dialogflow:\x20%s',_0x321e5c[_0xc9ef('0x5b')]));var _0x5c2090=this[_0xc9ef('0x75')][_0xc9ef('0x6e')](this,_0x321e5c);if(_0x5c2090){for(var _0x594371 in _0x5c2090){if(_0x5c2090['hasOwnProperty'](_0x594371)){this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('DIALOGFLOW_%s',_0x594371[_0xc9ef('0x68')]()),_0x5c2090[_0x594371]);}}this[_0xc9ef('0x42')](_0x5c2090[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xec'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xed'),_0x5c2090['speech']));}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x321e5c,_0xc9ef('0xee'));};AGIVertices['prototype']['dialogflowV2']=function(_0x13d5fa){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x13d5fa[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0xef')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf0'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x77')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf1'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x78')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xf2'));}if(!this[_0xc9ef('0x81')](_0x13d5fa[_0xc9ef('0x79')])){return this['channel'][_0xc9ef('0xa8')]('no\x20anguage\x20configured');}if(!this[_0xc9ef('0x81')](_0x13d5fa['text'])){return this[_0xc9ef('0xe')]['noop']('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this['createSquareDetailsReport'](_0x13d5fa);this['createSquareMessage'](_0x13d5fa['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xf3'),_0x13d5fa['text']));var _0x37e239=this[_0xc9ef('0x76')][_0xc9ef('0x6e')](this,_0x13d5fa);if(_0x37e239){for(var _0x21ead5 in _0x37e239){if(_0x37e239[_0xc9ef('0x92')](_0x21ead5)){if(_0x21ead5!==_0xc9ef('0xf4')){this['channel']['setVariable'](util[_0xc9ef('0x56')](_0xc9ef('0xf5'),_0x21ead5[_0xc9ef('0x68')]()),_0x37e239[_0x21ead5]);}}}this[_0xc9ef('0x42')](_0x37e239[_0xc9ef('0xea')],_0xc9ef('0xeb'),_0xc9ef('0xf6'),_0x37e239[_0xc9ef('0xf4')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xf7'),_0x37e239[_0xc9ef('0xea')]));}return this['channel'][_0xc9ef('0x2d')](_0x13d5fa,_0xc9ef('0xf8'));};AGIVertices[_0xc9ef('0x14')]['sesteknda']=function(_0x4812cf){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0xf9'),_0x4812cf[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfa')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xfb'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfc')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xfd'));}if(!this[_0xc9ef('0x81')](_0x4812cf[_0xc9ef('0xfe')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xff'));}if(!this[_0xc9ef('0x81')](_0x4812cf['ndassistant_url'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x4812cf);this[_0xc9ef('0x42')](_0x4812cf[_0xc9ef('0x5b')],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x100'),_0x4812cf[_0xc9ef('0x5b')]));var _0x1ea210=this[_0xc9ef('0x101')][_0xc9ef('0x6e')](this,_0x4812cf);if(_0x1ea210){for(var _0x3c1c92 in _0x1ea210){if(_0x1ea210['hasOwnProperty'](_0x3c1c92)){this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x102'),_0x3c1c92[_0xc9ef('0x68')]()),_0x1ea210[_0x3c1c92]);}}this[_0xc9ef('0x42')](_0x1ea210[_0xc9ef('0xea')],'out',_0xc9ef('0x103'),'');if(_0x1ea210['audiofile']){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x104'),_0x1ea210['audiofile']));var _0x4249f4=this['channel'][_0xc9ef('0x105')](_0x1ea210[_0xc9ef('0x106')]);try{fs[_0xc9ef('0x107')](_0x1ea210[_0xc9ef('0x106')]+_0xc9ef('0x108'));}catch(_0x486127){logger[_0xc9ef('0x2d')](_0x486127);}return _0x4249f4;}else{return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x109'),_0x1ea210[_0xc9ef('0xea')]));}}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4812cf,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x10a')]=function(_0x5a06d6){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x10b'),_0x5a06d6[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('end');};AGIVertices['prototype'][_0xc9ef('0x10c')]=function(_0x184eac){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x184eac[_0xc9ef('0x39')]));var _0x444fe0='';if(_0x184eac[_0xc9ef('0x10d')]){if(!this[_0xc9ef('0x81')](_0x184eac[_0xc9ef('0x10d')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20selected');}else{var _0x4a84f0=parseInt(_0x184eac[_0xc9ef('0x10d')],0xa);if(isNaN(_0x4a84f0)){_0x444fe0=_0x184eac['trunk_id'];}else{_0x444fe0=this[_0xc9ef('0x1e')][_0xc9ef('0x6e')](this,_0x184eac[_0xc9ef('0x10d')]);if(!_0x444fe0){return this['channel'][_0xc9ef('0x2d')](_0x184eac,'no\x20trunk\x20found');}}}}else if(_0x184eac[_0xc9ef('0x10e')]){_0x444fe0=_0x184eac['trunk_name'];}else{return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x184eac,_0xc9ef('0x10f'));}var _0x35c5c2=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0xe4'),[util[_0xc9ef('0x56')](_0xc9ef('0x110'),_0x444fe0,_0x184eac[_0xc9ef('0x49')]),_0x184eac[_0xc9ef('0x64')],_0x184eac[_0xc9ef('0xe5')],_0x184eac[_0xc9ef('0x62')]]);if(_0x35c5c2[_0xc9ef('0xa2')]===-0x1){return _0x35c5c2;}return this['channel'][_0xc9ef('0xa8')](util['format'](_0xc9ef('0xe6'),_0xc9ef('0xe4')));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x111')]=function(_0x9409c0){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x112'),_0x9409c0[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('finally');};AGIVertices['prototype'][_0xc9ef('0xc')]=function(_0x264b9e){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x113'),_0x264b9e[_0xc9ef('0x39')]));if(_0x264b9e[_0xc9ef('0xa5')]===0x0){return this[_0xc9ef('0xa4')](_0x264b9e);}_0x264b9e[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x264b9e['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x114'));}var _0x3e2a87=this[_0xc9ef('0x1f')]['sync'](this,_0x264b9e[_0xc9ef('0x115')]);if(!_0x3e2a87){return this['channel'][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x116'));}if(!this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0xd8')])){return this['channel']['error'](_0xc9ef('0xd9'));}var _0x3b416f=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x3e2a87,_0x264b9e[_0xc9ef('0x118')],_0x264b9e[_0xc9ef('0x119')]);var _0x3216a9=_0x3b416f[_0xc9ef('0xa2')]?_0x3b416f[_0xc9ef('0xa2')][_0xc9ef('0xa0')]():'';logger[_0xc9ef('0x2f')](_0xc9ef('0x11a'),JSON[_0xc9ef('0x9d')](_0x3b416f));if(_0x3b416f[_0xc9ef('0xa2')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x264b9e,_0x3216a9);return _0x3b416f;}else if(_0x3b416f[_0xc9ef('0x9f')]===_0xc9ef('0x64')){_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9['length']>=parseInt(_0x264b9e[_0xc9ef('0x11b')])?'x':'i';}else{_0x3b416f[_0xc9ef('0xa2')]=_0x3216a9[_0xc9ef('0x99')]>=parseInt(_0x264b9e['mindigit'])&&_0x3216a9[_0xc9ef('0x99')]<=parseInt(_0x264b9e['maxdigit'])?'x':'i';}var _0x126ea5=this['getVariable']['sync'](this,_0x264b9e[_0xc9ef('0xd8')]);if(!_0x126ea5){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x264b9e,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x126ea5,_0x3216a9);if(this[_0xc9ef('0x81')](_0x264b9e[_0xc9ef('0x11d')])){var _0x2aeadd=parseInt(_0x264b9e[_0xc9ef('0x11d')],0xa);var _0x3d4e76=rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x2aeadd});var _0x890848=_0x3216a9[_0xc9ef('0x99')];if(_0x890848>0x0){if(_0x890848>_0x2aeadd){this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x264b9e,_0x264b9e[_0xc9ef('0x11f')]===_0xc9ef('0x120')?_0x3d4e76+_0x3216a9[_0xc9ef('0x121')](_0x2aeadd):_0x3216a9[_0xc9ef('0x121')](0x0,_0x890848-_0x2aeadd)+_0x3d4e76);}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,rs[_0xc9ef('0x11e')]({'charset':'*','length':_0x890848}));}}else{this['createSquareDetailsReport']['sync'](this,_0x264b9e,'');}}else{this[_0xc9ef('0x37')]['sync'](this,_0x264b9e,_0x3216a9);}return _0x3b416f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xd')]=function(_0x8dcb07){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x122'),_0x8dcb07[_0xc9ef('0x39')]));return this['getdigits'](_0x8dcb07);};AGIVertices[_0xc9ef('0x14')]['goal']=function(_0x3a05c0){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x123'),_0x3a05c0[_0xc9ef('0x39')]));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x3a05c0,_0x3a05c0[_0xc9ef('0x124')]);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x125'),_0x3a05c0['goalname']));};AGIVertices['prototype'][_0xc9ef('0x126')]=function(_0xd048e9){logger['info'](util[_0xc9ef('0x56')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd048e9['label']));if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x84')])||!this['isConfigured'](_0xd048e9[_0xc9ef('0x85')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0xd048e9[_0xc9ef('0x5b')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x128'),_0xd048e9[_0xc9ef('0x5b')]));var _0x453081=this['awsPolly']['sync'](this,_0xd048e9);if(_0x453081){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x129'),_0x453081));var _0x566248=this['channel'][_0xc9ef('0x105')](_0x453081);try{fs[_0xc9ef('0x107')](_0x453081+_0xc9ef('0x108'));}catch(_0x43c2a2){logger['error'](_0x43c2a2);}return _0x566248;}return this['channel'][_0xc9ef('0x2d')](_0xd048e9,_0xc9ef('0x12a'));};AGIVertices[_0xc9ef('0x14')]['awslex']=function(_0x202c96){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x12b'),_0x202c96[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x202c96['aws_access_key_id'])||!this[_0xc9ef('0x81')](_0x202c96['aws_secret_access_key'])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x127'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x8a')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x12c'));}if(!this[_0xc9ef('0x81')](_0x202c96[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this[_0xc9ef('0xe')][_0xc9ef('0xe9')]=!![];this[_0xc9ef('0x37')](_0x202c96);this[_0xc9ef('0x42')](_0x202c96['text'],'in','','');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x202c96[_0xc9ef('0x5b')]));var _0x281bdf=this[_0xc9ef('0x12d')][_0xc9ef('0x6e')](this,_0x202c96);if(_0x281bdf){for(var _0x10f1f8 in _0x281bdf){if(_0x281bdf['hasOwnProperty'](_0x10f1f8)&&_[_0xc9ef('0x93')](_0x281bdf[_0x10f1f8])){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x12e'),_0x10f1f8[_0xc9ef('0x68')]()),_0x281bdf[_0x10f1f8]);}}if(_[_0xc9ef('0x44')](_0x281bdf[_0xc9ef('0x12f')])){return this['channel'][_0xc9ef('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xc9ef('0x42')](_0x281bdf[_0xc9ef('0x12f')],_0xc9ef('0xeb'),_0xc9ef('0x130'),'');return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x131'),_0x281bdf[_0xc9ef('0x12f')]));}}return this['channel'][_0xc9ef('0x2d')](_0x202c96,_0xc9ef('0x132'));};AGIVertices['prototype'][_0xc9ef('0x133')]=function(_0x1166bd){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x134'),_0x1166bd[_0xc9ef('0x39')],_0x1166bd[_0xc9ef('0x64')]));if(!this['isConfigured'](_0x1166bd[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20key\x20configured');}var _0x453ac3='wav';var _0x240f6e=util[_0xc9ef('0x56')]('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x418f41=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x240f6e,_0x453ac3);var _0x4caae4=!![];if(_0x1166bd[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x4caae4=![];}var _0x319b5a=this['channel'][_0xc9ef('0x137')](_0x240f6e,_0x453ac3,_0x1166bd[_0xc9ef('0x138')],_0x1166bd[_0xc9ef('0x64')],undefined,_0x4caae4);if(_0x319b5a[_0xc9ef('0xa2')]!==-0x1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x139'),_0x418f41));var _0x10f14d=this[_0xc9ef('0x8b')][_0xc9ef('0x6e')](this,_0x1166bd,_0x418f41);if(_0x10f14d){for(var _0x228ead in _0x10f14d){if(_0x10f14d[_0xc9ef('0x92')](_0x228ead)){this['channel'][_0xc9ef('0x9c')](util['format']('GOOGLE_ASR_%s',_0x228ead[_0xc9ef('0x68')]()),_0x10f14d[_0x228ead]);}}return this['channel']['noop'](util['format'](_0xc9ef('0x13a'),JSON[_0xc9ef('0x9d')](_0x10f14d)));}}return _0x319b5a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13b')]=function(_0x112996){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x13c'),_0x112996['label']));if(!this[_0xc9ef('0x81')](_0x112996['appid'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x13d'));}if(!this[_0xc9ef('0x81')](_0x112996[_0xc9ef('0x8f')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20appsecret\x20configured');}var _0x5102d9='wav';var _0x129cb7=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xc9ef('0x11e')](0x4));var _0x48f5f7=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x129cb7,_0x5102d9);var _0x220ecc=!![];if(_0x112996[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x220ecc=![];}var _0x547e2a=this[_0xc9ef('0xe')]['recordFile'](_0x129cb7,_0x5102d9,_0x112996[_0xc9ef('0x138')],_0x112996['timeout'],undefined,_0x220ecc);if(_0x547e2a[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('tilde\x20%s\x20file\x20created',_0x48f5f7));var _0x433bdf=this['tildeASR'][_0xc9ef('0x6e')](this,_0x112996,_0x48f5f7);if(_0x433bdf){for(var _0x4902d7 in _0x433bdf){if(_0x433bdf[_0xc9ef('0x92')](_0x4902d7)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util['format'](_0xc9ef('0x13e'),_0x4902d7[_0xc9ef('0x68')]()),_0x433bdf[_0x4902d7]);}}return this['channel']['noop'](util[_0xc9ef('0x56')]('TildeASR\x20Result\x20%s',JSON[_0xc9ef('0x9d')](_0x433bdf)));}}return _0x547e2a;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x13f')]=function(_0x5cbe53){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x140'),_0x5cbe53[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x141')](_0x5cbe53['context'],_0x5cbe53[_0xc9ef('0x142')],_0x5cbe53[_0xc9ef('0x3f')]);};AGIVertices[_0xc9ef('0x14')]['gotoif']=function(_0x5c5dad){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x143'),_0x5c5dad[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5c5dad[_0xc9ef('0x144')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x5c5dad,'no\x20condition\x20configured');}try{var _0x2e4760=eval(_0x5c5dad[_0xc9ef('0x144')])?_0xc9ef('0x145'):_0xc9ef('0x146');this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x147'),_0x5c5dad[_0xc9ef('0x144')],_0x2e4760));return{'code':0xc8,'result':_0x2e4760};}catch(_0x1c99c1){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x148')]=function(_0x1f7304){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x149'),_0x1f7304[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x1f7304[_0xc9ef('0x14a')])){return this[_0xc9ef('0xe')]['error'](_0x1f7304,'no\x20interval\x20configured');}var _0x196386=this['getIntervals']['sync'](this,_0x1f7304[_0xc9ef('0x14a')]);if(!_0x196386){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1f7304,_0xc9ef('0x14b'));}for(var _0x543c28=0x0;_0x543c28<_0x196386['length'];_0x543c28+=0x1){var _0x279bd9=this[_0xc9ef('0xe')][_0xc9ef('0x10')](util['format']('IFTIME(%s?true:false)',_0x196386[_0x543c28]));if(_0x279bd9['result']===-0x1){return _0x279bd9;}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0x279bd9[_0xc9ef('0x9f')]));if(_0x279bd9[_0xc9ef('0x9f')]===_0xc9ef('0x145')){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x145')));return{'code':0xc8,'result':'true'};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14c'),_0x196386[_0x543c28],_0xc9ef('0x146')));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('IFTIME\x20%s\x20%s',_0x196386[_0x543c28],'false'));}}return{'code':0xc8,'result':_0xc9ef('0x146')};};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x14d')]=function(_0xf6e8bd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x14e'),_0xf6e8bd[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x14d')]();};AGIVertices[_0xc9ef('0x14')]['ispeechasr']=function(_0x41e07f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x14f'),_0x41e07f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x41e07f[_0xc9ef('0x7f')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xe8'));}var _0x1adb5a=_0xc9ef('0x150');var _0x8b6352=util['format'](_0xc9ef('0x151'),FILES_PATH,rs['generate'](0x4));var _0xa6a933=util[_0xc9ef('0x56')](_0xc9ef('0x9b'),_0x8b6352,_0x1adb5a);var _0x12a58a=!![];if(_0x41e07f[_0xc9ef('0x135')]===_0xc9ef('0x136')){_0x12a58a=![];}var _0x32383f=this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x8b6352,_0x1adb5a,_0x41e07f[_0xc9ef('0x138')],_0x41e07f[_0xc9ef('0x64')],undefined,_0x12a58a);if(_0x32383f[_0xc9ef('0xa2')]!==-0x1){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x152'),_0xa6a933));var _0x3a97c8=this[_0xc9ef('0x7e')][_0xc9ef('0x6e')](this,_0x41e07f,_0xa6a933);if(_0x3a97c8){for(var _0x4bc2a6 in _0x3a97c8){if(_0x3a97c8[_0xc9ef('0x92')](_0x4bc2a6)){this[_0xc9ef('0xe')][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x153'),_0x4bc2a6[_0xc9ef('0x68')]()),_0x3a97c8[_0x4bc2a6]);}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x154'),JSON[_0xc9ef('0x9d')](_0x3a97c8)));}}return _0x32383f;};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x155')]=function(_0x148f5c){logger['info'](util['format'](_0xc9ef('0x156'),_0x148f5c[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x148f5c[_0xc9ef('0x7f')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0xe8'));}if(!this[_0xc9ef('0x81')](_0x148f5c['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x157'),_0x148f5c[_0xc9ef('0x5b')]));var _0x37ef76=this['ispeechTTS'][_0xc9ef('0x6e')](this,_0x148f5c);if(_0x37ef76){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('ispeech\x20%s\x20file\x20created',_0x37ef76));var _0x36f978=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x37ef76,_0x148f5c[_0xc9ef('0x138')]);try{fs[_0xc9ef('0x107')](_0x37ef76+'.wav');}catch(_0x17654c){logger[_0xc9ef('0x2d')](_0x17654c);}return _0x36f978;}return this[_0xc9ef('0xe')]['error'](_0x148f5c,_0xc9ef('0x158'));};AGIVertices['prototype']['login']=function(_0x29814d){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x29814d[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x29814d['findBy'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x29814d,_0xc9ef('0x159'));}logger['info'](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));var _0x47977d=this['agentLogin'][_0xc9ef('0x6e')](this,_0x29814d[_0xc9ef('0x15b')]);if(_0x47977d){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel']['callerid'],_0x29814d[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x29814d[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['logout']=function(_0x5e5d2b){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x160'),_0x5e5d2b[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x5e5d2b['findBy'])){return this[_0xc9ef('0xe')]['error'](_0x5e5d2b,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x5e5d2b[_0xc9ef('0x15b')]));var _0x7c08e6=this[_0xc9ef('0x53')][_0xc9ef('0x6e')](this,_0x5e5d2b[_0xc9ef('0x15b')]);if(_0x7c08e6){logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')]['callerid'],_0x5e5d2b['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')]['math']=function(_0x447d4e){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x447d4e[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x447d4e['operation'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x447d4e,_0xc9ef('0x161'));}this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format']('math\x20%s',_0x447d4e[_0xc9ef('0x162')]));var _0x2f08ae=eval(_0x447d4e[_0xc9ef('0x162')]);if(!this[_0xc9ef('0x81')](_0x447d4e['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}var _0x1c71d0=this['getVariable']['sync'](this,_0x447d4e[_0xc9ef('0xd8')]);if(!_0x1c71d0){return this[_0xc9ef('0xe')]['error'](_0x447d4e,_0xc9ef('0x11c'));}if(_[_0xc9ef('0x98')](_0x2f08ae)){var _0x48ddc5=this;_0x2f08ae[_0xc9ef('0xda')](function(_0x565bd9,_0x11a6f9){_0x48ddc5[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s[%s]',_0x1c71d0,_0x11a6f9),_0x565bd9);});return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x163'),_0x1c71d0));}else{return this['channel'][_0xc9ef('0x9c')](_0x1c71d0,_0x2f08ae);}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0xb')]=function(_0x41a2c1){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x164'),_0x41a2c1[_0xc9ef('0x39')]));if(_0x41a2c1['retry']===0x0){return this[_0xc9ef('0xa4')](_0x41a2c1);}_0x41a2c1[_0xc9ef('0xa5')]-=0x1;if(!this[_0xc9ef('0x81')](_0x41a2c1['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x114'));}var _0x15c874=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x41a2c1[_0xc9ef('0x115')]);if(!_0x15c874){return this[_0xc9ef('0xe')]['error'](_0x41a2c1,_0xc9ef('0x116'));}var _0x1cbb53=this[_0xc9ef('0xe')][_0xc9ef('0x117')](_0x15c874,_0x41a2c1['response'],_0x41a2c1[_0xc9ef('0x165')]);var _0x391aa6=_0x1cbb53['result'];if(_0x1cbb53[_0xc9ef('0xa2')]===-0x1){this[_0xc9ef('0x37')]['sync'](this,_0x41a2c1,'-1');return _0x1cbb53;}else if(_0x1cbb53['extra']===_0xc9ef('0x64')){_0x1cbb53['result']=_0x1cbb53[_0xc9ef('0xa2')]['length']>0x0?_0x1cbb53['result']:'t';}else if(_[_0xc9ef('0x47')](_0x1cbb53[_0xc9ef('0xa2')])){_0x1cbb53[_0xc9ef('0xa2')]='#';_0x391aa6='#';}if(!this[_0xc9ef('0x81')](_0x41a2c1[_0xc9ef('0xd8')])){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0xd9'));}else{var _0x3bd069=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x41a2c1['variable_id']);if(!_0x3bd069){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x41a2c1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](_0x3bd069,_0x391aa6);}this['createSquareDetailsReport']['sync'](this,_0x41a2c1,_0x391aa6);return _0x1cbb53;};AGIVertices['prototype']['noop']=function(_0x14f9b3){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x166'),_0x14f9b3['label']));return this[_0xc9ef('0xe')]['noop'](_0x14f9b3[_0xc9ef('0x167')]||_0x14f9b3[_0xc9ef('0x39')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x168')]=function(_0x495221){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x169'),_0x495221[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x495221['findBy'])){return this['channel'][_0xc9ef('0x2d')](_0x495221,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')]['callerid'],_0x495221[_0xc9ef('0x15b')]));var _0x2d2281=this['getPause'][_0xc9ef('0x6e')](this,_0x495221[_0xc9ef('0x16a')]);var _0x3c4d22=this[_0xc9ef('0x50')][_0xc9ef('0x6e')](this,_0x495221['findBy'],_0x2d2281);if(_0x3c4d22){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger['info'](util[_0xc9ef('0x56')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xc9ef('0x3c')],_0x495221['findBy']));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')]['callerid'],_0x495221['findBy']));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x16b')]=function(_0x3df1fd){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x16c'),_0x3df1fd['label']));if(!this['isConfigured'](_0x3df1fd['file_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3df1fd,_0xc9ef('0x114'));}var _0x3697ef=this[_0xc9ef('0x1f')][_0xc9ef('0x6e')](this,_0x3df1fd[_0xc9ef('0x115')]);if(!_0x3697ef){return this[_0xc9ef('0xe')]['error'](_0x3df1fd,'no\x20file\x20audio\x20found');}var _0x392f10=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x16d'),[_0x3697ef,_0x3df1fd['opts']]);if(_0x392f10[_0xc9ef('0xa2')]===-0x1){return _0x392f10;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),_0xc9ef('0x16d'),_0x3697ef));};AGIVertices['prototype'][_0xc9ef('0x16e')]=function(_0x15e7de){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x16f'),_0x15e7de[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x170')])){return this[_0xc9ef('0xe')]['error'](_0x15e7de,'no\x20queue\x20selected');}var _0x11072f='';var _0x51f7dc=parseInt(_0x15e7de[_0xc9ef('0x170')],0xa);if(isNaN(_0x51f7dc)){_0x11072f=_0x15e7de['queue_id'];}else{_0x11072f=this['getVoiceQueue'][_0xc9ef('0x6e')](this,_0x15e7de[_0xc9ef('0x170')]);if(!_0x11072f){return this['channel']['error'](_0x15e7de,_0xc9ef('0x171'));}}var _0x2a7f9b='';if(this[_0xc9ef('0x81')](_0x15e7de[_0xc9ef('0x115')])){var _0xe40fc5=this['getSound'][_0xc9ef('0x6e')](this,_0x15e7de['file_id']);if(_0xe40fc5){_0x2a7f9b=_0xe40fc5;}}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x15e7de,_0x11072f);if(_0x15e7de[_0xc9ef('0xe5')]['indexOf']('x')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='x';}if(_0x15e7de['opts'][_0xc9ef('0x172')]('X')<0x0){_0x15e7de[_0xc9ef('0xe5')]+='X';}this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x173'),_0x11072f?_0x11072f[_0xc9ef('0x174')]():'');var _0x6d9adc=this[_0xc9ef('0xe')]['exec'](_0xc9ef('0x175'),[_0x11072f,_0x15e7de['opts'],_0x15e7de[_0xc9ef('0x62')],_0x2a7f9b,_0x15e7de[_0xc9ef('0x64')],_0x15e7de[_0xc9ef('0x6')],_0x15e7de[_0xc9ef('0x176')],_0x15e7de[_0xc9ef('0x177')],'',_0x15e7de[_0xc9ef('0x178')]]);if(_0x6d9adc['result']===-0x1){return _0x6d9adc;}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x11072f));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x179')]=function(_0x17d573){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x17a'),_0x17d573[_0xc9ef('0x39')]));var _0x1c7140=_0x17d573['recordingFormat']||_0xc9ef('0x150');var _0x5f3c28=util[_0xc9ef('0x56')](_0xc9ef('0x17b'),this['channel'][_0xc9ef('0x38')],rs[_0xc9ef('0x11e')](0x5));var _0x5c8771=util['format'](_0xc9ef('0x17c'),FILES_PATH,_0x5f3c28,_0x1c7140);var _0x16f7b1=util['format'](_0xc9ef('0x151'),FILES_PATH,_0x5f3c28);this[_0xc9ef('0x3d')][_0xc9ef('0x6e')](this,_0x17d573,_0x5f3c28,_0x5c8771);this[_0xc9ef('0xe')][_0xc9ef('0x9c')](_0xc9ef('0x17d'),_0x5f3c28);logger[_0xc9ef('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')]);return this[_0xc9ef('0xe')][_0xc9ef('0x137')](_0x16f7b1,_0x1c7140,_0x17d573[_0xc9ef('0x17e')],_0x17d573[_0xc9ef('0x64')],undefined,!![]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x17f')]=function(_0x3b4ae1){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x180'),_0x3b4ae1[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x3b4ae1[_0xc9ef('0x62')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x181'));}var _0x24de27=this[_0xc9ef('0x61')][_0xc9ef('0x6e')](this,_0x3b4ae1);logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x182'),util[_0xc9ef('0x183')](_0x24de27,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b4ae1[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')]['noop'](_0xc9ef('0x184'));}var _0x18125a=this[_0xc9ef('0x10')][_0xc9ef('0x6e')](this,_0x3b4ae1['variable_id']);if(!_0x18125a){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x3b4ae1,_0xc9ef('0x11c'));}this['channel'][_0xc9ef('0x9c')](util[_0xc9ef('0x56')](_0xc9ef('0x185'),_0x18125a),_0x24de27['statusCode']?_0x24de27[_0xc9ef('0x186')]:_0xc9ef('0x187'));this[_0xc9ef('0xe')]['setVariable'](util[_0xc9ef('0x56')]('%s_STATUS_MESSAGE',_0x18125a),_0x24de27['statusMessage']?_0x24de27[_0xc9ef('0x72')]:'OK');if(_0x24de27['body']){try{this['saveRestApiResult'](_0x24de27[_0xc9ef('0x71')],_0x18125a);}catch(_0x128b5f){logger[_0xc9ef('0x2d')](util[_0xc9ef('0x56')](_0xc9ef('0x188'),_0x18125a));}}return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('variable\x20%s\x20set',_0x18125a));};AGIVertices['prototype']['saydigits']=function(_0x2c7900){logger[_0xc9ef('0x2f')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2c7900[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')]['sayDigits'](_0x2c7900[_0xc9ef('0x189')][_0xc9ef('0x57')](/\s+/g,''),_0x2c7900[_0xc9ef('0x17e')]);};AGIVertices['prototype'][_0xc9ef('0x18a')]=function(_0x21222b){logger['info'](util['format'](_0xc9ef('0x18b'),_0x21222b[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18c')](_0x21222b[_0xc9ef('0x65')][_0xc9ef('0x57')](/\s+/g,''),_0x21222b[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')]['sayphonetic']=function(_0x308d03){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x18d'),_0x308d03[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0x18e')](_0x308d03[_0xc9ef('0x5b')],_0x308d03[_0xc9ef('0x17e')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x18f')]=function(_0x3d5d0c){logger['info'](util[_0xc9ef('0x56')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3d5d0c['label']));if(!this['isConfigured'](_0x3d5d0c[_0xc9ef('0x190')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x191'));}var _0x1fe881=this[_0xc9ef('0x192')][_0xc9ef('0x6e')](this,_0x3d5d0c[_0xc9ef('0x190')]);if(!_0x1fe881||!_0x1fe881[_0xc9ef('0x193')]){return this[_0xc9ef('0xe')]['error'](_0x3d5d0c,_0xc9ef('0x194'));}var _0x5e9a88={'from':util[_0xc9ef('0x56')]('\x22%s\x22\x20<%s>',_0x1fe881[_0xc9ef('0x12')],_0x1fe881['email']||_0x1fe881[_0xc9ef('0x193')][_0xc9ef('0x195')]),'to':_0x3d5d0c['to']||'','cc':_0x3d5d0c['cc']||'','bcc':_0x3d5d0c[_0xc9ef('0x196')]||'','subject':_0x3d5d0c['subject'],'html':_0x3d5d0c[_0xc9ef('0x5b')],'text':_0x3d5d0c['text']};if(this['isConfigured'](_0x3d5d0c[_0xc9ef('0x197')])){}logger[_0xc9ef('0xe0')](_0xc9ef('0x198'),JSON[_0xc9ef('0x9d')](_0x5e9a88));this[_0xc9ef('0x37')]['sync'](this,_0x3d5d0c,_0x3d5d0c[_0xc9ef('0x190')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x199'),_0x1fe881[_0xc9ef('0x12')]));this[_0xc9ef('0x23')][_0xc9ef('0x6e')](this,_0x1fe881[_0xc9ef('0x19a')],_0x5e9a88);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19b'));};AGIVertices['prototype'][_0xc9ef('0x19c')]=function(_0x1226b9){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x19d'),_0x1226b9[_0xc9ef('0x39')]));return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x19e'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x19f')]=function(_0x9a621f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1a0'),_0x9a621f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x9a621f[_0xc9ef('0x1a1')])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1a2'));}var _0x34e0d1=this['getSmsAccount'][_0xc9ef('0x6e')](this,_0x9a621f[_0xc9ef('0x1a1')]);if(!_0x34e0d1){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x9a621f,_0xc9ef('0x1a3'));}var _0x1216ea={'body':_0x9a621f[_0xc9ef('0x1a4')],'phone':_0x9a621f['to']||'','SmsAccountId':_0x34e0d1['id']};logger['debug']('sendSMS\x20message',JSON[_0xc9ef('0x9d')](_0x1216ea));this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x9a621f,_0x9a621f[_0xc9ef('0x1a1')]);this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1a5'),_0x34e0d1[_0xc9ef('0x12')]));this[_0xc9ef('0x36')]['sync'](this,_0x1216ea);return this['channel']['noop'](_0xc9ef('0x1a6'));};AGIVertices['prototype'][_0xc9ef('0x1a7')]=function(_0x1abe8b){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1abe8b['label']));if(!this[_0xc9ef('0x81')](_0x1abe8b['variable_id'])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x1a8'));}var _0x25cabc=this['getVariable'][_0xc9ef('0x6e')](this,_0x1abe8b[_0xc9ef('0xd8')]);if(!_0x25cabc){return this['channel'][_0xc9ef('0x2d')](_0x1abe8b,_0xc9ef('0x11c'));}return this['channel'][_0xc9ef('0x9c')](_0x25cabc,_0x1abe8b[_0xc9ef('0x1a9')]);};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1aa')]=function(_0x1f6149){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x1ab'),_0x1f6149[_0xc9ef('0x39')]));this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1ac'));if(_0x1f6149[_0xc9ef('0xb7')]===_0xc9ef('0x1ad')){this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1ae'));return this[_0xc9ef('0xe')][_0xc9ef('0xb7')]();}return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0x1af'));};AGIVertices[_0xc9ef('0x14')]['subproject']=function(_0x4f4070){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b0'),_0x4f4070[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x4f4070[_0xc9ef('0x1b1')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,'no\x20subproject\x20selected');}var _0x48ce45=this[_0xc9ef('0x18')][_0xc9ef('0x6e')](this,_0x4f4070['project_id']);if(!this['isConfigured'](_0x48ce45)){return this[_0xc9ef('0xe')]['error'](_0x4f4070,util[_0xc9ef('0x56')](_0xc9ef('0x1b2'),_0x4f4070[_0xc9ef('0x1b1')]));}if(_0x48ce45===this[_0xc9ef('0xe')]['arg_1']){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x4f4070,_0xc9ef('0x1b3'));}this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0x4f4070,_0x48ce45);var _0x3dd088=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1b4'),util[_0xc9ef('0x56')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc9ef('0x6')]['host']||_0xc9ef('0x1b5'),_0x48ce45,this[_0xc9ef('0xe')]['arg_1']));if(_0x3dd088[_0xc9ef('0xa2')]===-0x1){return _0x3dd088;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')]('Executed\x20command\x20%s\x20%s',_0xc9ef('0x1b4'),_0x48ce45));};AGIVertices[_0xc9ef('0x14')]['system']=function(_0xe8fc97){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1b6'),_0xe8fc97['label']));var _0x218904=this[_0xc9ef('0x1b7')][_0xc9ef('0x6e')](this,_0xe8fc97[_0xc9ef('0xb4')]);this[_0xc9ef('0x37')][_0xc9ef('0x6e')](this,_0xe8fc97,_0xe8fc97[_0xc9ef('0xb4')]);if(this[_0xc9ef('0x81')](_0xe8fc97[_0xc9ef('0xd8')])){var _0x3c170c=this[_0xc9ef('0x10')]['sync'](this,_0xe8fc97[_0xc9ef('0xd8')]);if(_0x3c170c){this[_0xc9ef('0xe')]['setVariable'](_0x3c170c,_0x218904);return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util['format'](_0xc9ef('0x1b8'),_0xe8fc97[_0xc9ef('0xb4')],_0x3c170c));}}return this['channel']['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1b9'),_0xe8fc97[_0xc9ef('0xb4')]));};AGIVertices[_0xc9ef('0x14')]['google_cloud_tts']=function(_0xca4789){logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x1ba'),_0xca4789[_0xc9ef('0x39')]));_0xca4789[_0xc9ef('0x5b')]=_0xca4789[_0xc9ef('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0xca4789['apiKey'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')](_0xc9ef('0x1bb'));}if(!this['isConfigured'](_0xca4789['text'])){return this[_0xc9ef('0xe')][_0xc9ef('0xa8')]('no\x20text\x20configured');}this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x1bc'),_0xca4789[_0xc9ef('0x5b')]));var _0x227998=this[_0xc9ef('0x58')][_0xc9ef('0x6e')](this,_0xca4789);if(_0x227998){this[_0xc9ef('0xe')][_0xc9ef('0xa8')](util[_0xc9ef('0x56')](_0xc9ef('0x1bd'),_0x227998));var _0xaf53a2=this[_0xc9ef('0xe')][_0xc9ef('0x105')](_0x227998);try{fs[_0xc9ef('0x107')](_0x227998+_0xc9ef('0x108'));}catch(_0x39167d){logger[_0xc9ef('0x2d')](_0x39167d);}return _0xaf53a2;}return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0xca4789,_0xc9ef('0x1be'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1bf')]=function(_0x524a04){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x524a04[_0xc9ef('0x39')]));_0x524a04['text']=_0x524a04['text'][_0xc9ef('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc9ef('0x81')](_0x524a04[_0xc9ef('0x5b')])){return this['channel'][_0xc9ef('0xa8')](_0xc9ef('0xc2'));}this['channel'][_0xc9ef('0xa8')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x524a04['text']));var _0x1861b1=this[_0xc9ef('0x60')][_0xc9ef('0x6e')](this,_0x524a04);if(_0x1861b1){this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('Google\x20TTS\x20%s\x20file\x20created',_0x1861b1));var _0x1f93e9=this['channel'][_0xc9ef('0x105')](_0x1861b1);try{fs[_0xc9ef('0x107')](_0x1861b1+_0xc9ef('0x108'));}catch(_0x4a72a6){logger[_0xc9ef('0x2d')](_0x4a72a6);}return _0x1f93e9;}return this['channel'][_0xc9ef('0x2d')](_0x524a04,_0xc9ef('0x1c0'));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c1')]=function(_0x490e87){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x1c2'),_0x490e87[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x490e87[_0xc9ef('0x15b')])){return this[_0xc9ef('0xe')]['error'](_0x490e87,_0xc9ef('0x159'));}logger[_0xc9ef('0x2f')](util['format'](_0xc9ef('0x15a'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));var _0x2e2e8c=this[_0xc9ef('0x52')]['sync'](this,_0x490e87[_0xc9ef('0x15b')]);if(_0x2e2e8c){logger['info'](util[_0xc9ef('0x56')](_0xc9ef('0x15c'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this['channel'][_0xc9ef('0xa8')](util[_0xc9ef('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15d')};}else{logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this[_0xc9ef('0xe')][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0x15e'),this['channel'][_0xc9ef('0x3c')],_0x490e87[_0xc9ef('0x15b')]));return{'code':0xc8,'result':_0xc9ef('0x15f')};}};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c3')]=function(_0x4534d8){logger['info'](util['format'](_0xc9ef('0x1c4'),_0x4534d8[_0xc9ef('0x39')]));var _0x1251fc=this[_0xc9ef('0xe')][_0xc9ef('0xa9')](_0xc9ef('0x1c5'),[_0x4534d8[_0xc9ef('0x1c6')],_0x4534d8['options']]);if(_0x1251fc[_0xc9ef('0xa2')]===-0x1){return _0x1251fc;}return this[_0xc9ef('0xe')]['noop'](util[_0xc9ef('0x56')](_0xc9ef('0xbf'),'VOICEMAIL',_0x4534d8[_0xc9ef('0x1c6')]));};AGIVertices[_0xc9ef('0x14')][_0xc9ef('0x1c7')]=function(_0x54b78f){logger[_0xc9ef('0x2f')](util[_0xc9ef('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x54b78f[_0xc9ef('0x39')]));if(!this[_0xc9ef('0x81')](_0x54b78f[_0xc9ef('0xd8')])){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,'no\x20variable\x20selected');}var _0x1145fa=this[_0xc9ef('0x10')]['sync'](this,_0x54b78f['variable_id']);if(!_0x1145fa){return this[_0xc9ef('0xe')][_0xc9ef('0x2d')](_0x54b78f,_0xc9ef('0x11c'));}var _0x58b245=this['channel']['getVariable'](_0x1145fa);return{'code':0xc8,'result':_0x58b245[_0xc9ef('0x9f')]?_0x58b245['extra']:'-'};};String[_0xc9ef('0x14')]['replaceAll']=function(_0x5c1410,_0x2e42bd){return this[_0xc9ef('0x9e')](_0x5c1410)[_0xc9ef('0x1c8')](_0x2e42bd);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3af84ff..0c11a7b 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 _0x9243=['voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','error','[ACW][START]\x20%s','message','stopAcw','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','syncAgentConnect','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','prototype','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDispositionPause','Action','getAgent','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9243,0x1d5));var _0x3924=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0x9243[_0x22f85a];return _0xaa717;};'use strict';var util=require(_0x3924('0x0'));var _=require(_0x3924('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x3924('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x3924('0x3'));function Acw(_0x3e9420){this[_0x3924('0x4')]=_0x3e9420[_0x3924('0x4')];this[_0x3924('0x5')]=_0x3e9420['agents'];this['timers']=_0x3e9420[_0x3924('0x6')];this[_0x3924('0x7')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0x3924('0x8')](this));ami['on'](_0x3924('0x9'),this[_0x3924('0xa')][_0x3924('0x8')](this));ami['on'](_0x3924('0xb'),this[_0x3924('0xc')][_0x3924('0x8')](this));ami['on'](_0x3924('0xd'),this[_0x3924('0xe')][_0x3924('0x8')](this));ami['on']('attendedtransfer',this[_0x3924('0xf')]['bind'](this));ami['on'](_0x3924('0x10'),this[_0x3924('0x11')]['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x3fae41){var _0x2dcb08=moment()['milliseconds'](0x0);var _0x42e608=moment(_0x3fae41)[_0x3924('0x12')](0x0);return _0x2dcb08[_0x3924('0x13')](_0x42e608,_0x3924('0x14'));}Acw['prototype'][_0x3924('0x15')]=function(_0xb8225b){try{var _0x31c15d=this;var _0x40f1f2=this[_0x3924('0x7')][_0xb8225b][_0x3924('0x16')];var _0xbe941d=this[_0x3924('0x7')][_0xb8225b][_0x3924('0x17')];var _0x285d66=this['voiceQueues'][_0xbe941d];var _0x3dcaaf=![];var _0x5032c0=_0x3924('0x18');if(_0x285d66['mandatoryDisposition']){if(_0x285d66[_0x3924('0x19')]['name']){_0x3dcaaf=!![];_0x5032c0=_0x285d66[_0x3924('0x19')]['name'];}}ami[_0x3924('0x1a')]({'action':'QueuePause','interface':_0x40f1f2,'paused':!![],'reason':_0x5032c0})['then'](function(_0x5cbc01){if(_0x31c15d[_0x3924('0x5')][_0x40f1f2]){return RpcUser[_0x3924('0x1b')](_0x31c15d['agents'][_0x40f1f2]['id'])[_0x3924('0x1c')](function(_0x9e1029){if(_0x9e1029&&!_0x9e1029[_0x3924('0x1d')]){logger['info'](_0x3924('0x1e'),_0xb8225b,_0x40f1f2,_0xbe941d);var _0x2b3ced=_0x31c15d['channels'][_0xb8225b][_0x3924('0x1f')]&&_0x31c15d[_0x3924('0x7')][_0xb8225b][_0x3924('0x20')]?_0x31c15d[_0x3924('0x7')][_0xb8225b][_0x3924('0x20')]:_0xb8225b;return RpcUser[_0x3924('0x21')](_0x31c15d[_0x3924('0x5')][_0x40f1f2],_0x5032c0,_0x2b3ced)[_0x3924('0x1c')](function(_0x2a0035){if(!_0x3dcaaf){_0x31c15d[_0x3924('0x6')][_0x40f1f2]={};logger['info'](_0x3924('0x22'),_0xb8225b,_0x31c15d[_0x3924('0x4')][_0xbe941d][_0x3924('0x23')],_0x40f1f2,_0xbe941d);_0x31c15d[_0x3924('0x6')][_0x40f1f2][_0x3924('0x24')]=setTimeout(_0x31c15d['stopAcw'][_0x3924('0x8')](_0x31c15d,_0x40f1f2),_0x31c15d[_0x3924('0x4')][_0xbe941d]['acwTimeout']*0x3e8);_0x31c15d[_0x3924('0x6')][_0x40f1f2][_0x3924('0x25')]=moment()['format'](_0x3924('0x26'));_0x31c15d['timers'][_0x40f1f2][_0x3924('0x27')]=_0xb8225b;_0x31c15d[_0x3924('0x6')][_0x40f1f2][_0x3924('0x17')]=_0xbe941d;_0x31c15d['timers'][_0x40f1f2]['updateAcw']=function(){var _0xd1ad72=getDiff(_0x31c15d['timers'][_0x40f1f2][_0x3924('0x25')]);clearTimeout(_0x31c15d[_0x3924('0x6')][_0x40f1f2][_0x3924('0x24')]);_0x31c15d[_0x3924('0x6')][_0x40f1f2]['timer']=![];RpcVoiceAgentReport[_0x3924('0x28')]({'acwtime':_0xd1ad72},_0x31c15d[_0x3924('0x6')][_0x40f1f2][_0x3924('0x27')],_0x40f1f2)[_0x3924('0x1c')](function(_0x47ed0d){logger[_0x3924('0x29')](_0x3924('0x2a'),_0xb8225b,_0xd1ad72,_0x47ed0d);})['catch'](function(_0x387f12){logger['error'](_0x3924('0x2b'),_0xb8225b,_0x387f12);});delete _0x31c15d[_0x3924('0x6')][_0x40f1f2];};}});}else{logger['info'](_0x3924('0x2c'),_0xb8225b,_0x40f1f2,_0xbe941d);}});}})[_0x3924('0x2d')](function(_0x298012){logger[_0x3924('0x2e')](_0x3924('0x22'),_0xb8225b,_0x31c15d[_0x3924('0x4')][_0xbe941d][_0x3924('0x23')],_0x40f1f2,_0xbe941d);})['finally'](function(){delete _0x31c15d[_0x3924('0x7')][_0xb8225b];});}catch(_0x3bf24b){logger[_0x3924('0x2e')](_0x3924('0x2f'),_0x3bf24b[_0x3924('0x30')]);}};Acw['prototype'][_0x3924('0x31')]=function(_0x185946){try{var _0x534279=this;if(_0x534279[_0x3924('0x6')][_0x185946]){_0x534279['timers'][_0x185946][_0x3924('0x24')]=![];var _0x35fb95=_0x534279['timers'][_0x185946]['uniqueid'];var _0x1e1929=_0x534279[_0x3924('0x6')][_0x185946]['queue'];var _0x35bcbc=_0x534279[_0x3924('0x4')][_0x1e1929][_0x3924('0x23')];logger[_0x3924('0x29')]('[%s][TIMER][STOP][AGENT:%s]',_0x35fb95,_0x185946);RpcUser[_0x3924('0x32')](this[_0x3924('0x5')][_0x185946]);RpcVoiceAgentReport[_0x3924('0x28')]({'acwtime':_0x35bcbc,'agentacw':!![]},_0x35fb95,_0x185946)['then'](function(_0x57f3e4){logger[_0x3924('0x29')]('[%s][UPDATE][ACWTIME:%s]',_0x35fb95,_0x35bcbc,_0x57f3e4);})[_0x3924('0x2d')](function(_0x3aea56){logger['error'](_0x3924('0x2b'),_0x35fb95,_0x3aea56);});}else{logger['error'](_0x3924('0x33'),_0x185946);if(_0x534279[_0x3924('0x6')]){logger[_0x3924('0x29')]('[ACW][TIMERS]',JSON['stringify'](_0x534279[_0x3924('0x6')]));}}}catch(_0x96cd9c){logger[_0x3924('0x2e')](_0x3924('0x34'),_0x96cd9c[_0x3924('0x30')]);}};Acw['prototype'][_0x3924('0x35')]=function(_0xded222){try{if(this[_0x3924('0x4')][_0xded222['queue']]&&(this[_0x3924('0x4')][_0xded222[_0x3924('0x17')]]['acw']||this[_0x3924('0x4')][_0xded222[_0x3924('0x17')]][_0x3924('0x36')])){if(this[_0x3924('0x5')][_0xded222[_0x3924('0x16')]]){this[_0x3924('0x7')][_0xded222[_0x3924('0x27')]]={'queue':_0xded222[_0x3924('0x17')],'interface':_0xded222['interface'],'destlinkedid':_0xded222[_0x3924('0x20')]};}}}catch(_0xbd2e87){logger[_0x3924('0x2e')](_0x3924('0x37'),_0xbd2e87[_0x3924('0x30')]);}};Acw['prototype'][_0x3924('0x38')]=function(_0x28fcc2){try{if(this['voiceQueues'][_0x28fcc2[_0x3924('0x17')]]&&(this[_0x3924('0x4')][_0x28fcc2[_0x3924('0x17')]][_0x3924('0x39')]||this[_0x3924('0x4')][_0x28fcc2['queue']][_0x3924('0x36')])){if(this[_0x3924('0x5')][_0x28fcc2[_0x3924('0x16')]]){this[_0x3924('0x7')][_0x28fcc2[_0x3924('0x27')]]={'queue':_0x28fcc2[_0x3924('0x17')],'interface':_0x28fcc2[_0x3924('0x16')]};}}}catch(_0x55ffc1){logger['error'](_0x3924('0x3a'),_0x55ffc1[_0x3924('0x30')]);}};Acw['prototype'][_0x3924('0xa')]=function(_0x435057){try{if(this['channels'][_0x435057[_0x3924('0x27')]]&&_[_0x3924('0x3b')](this[_0x3924('0x7')][_0x435057[_0x3924('0x27')]][_0x3924('0x1f')])){logger[_0x3924('0x29')]('[%s][HANGUP:UNIQUEID]',_0x435057[_0x3924('0x27')]);this[_0x3924('0x15')](_0x435057[_0x3924('0x27')]);}else if(this[_0x3924('0x7')][_0x435057[_0x3924('0x3c')]]&&_[_0x3924('0x3b')](this[_0x3924('0x7')][_0x435057[_0x3924('0x3c')]][_0x3924('0x1f')])){logger[_0x3924('0x29')](_0x3924('0x3d'),_0x435057[_0x3924('0x3c')]);this['startAcw'](_0x435057['linkedid']);}}catch(_0x29c4d2){logger[_0x3924('0x2e')](_0x3924('0x3e'),_0x29c4d2[_0x3924('0x30')]);}};Acw['prototype']['syncHangup']=function(_0x299986){try{if(this[_0x3924('0x7')][_0x299986[_0x3924('0x27')]]&&this[_0x3924('0x7')][_0x299986[_0x3924('0x27')]][_0x3924('0x1f')]){logger[_0x3924('0x29')](_0x3924('0x3f'),_0x299986[_0x3924('0x27')]);this[_0x3924('0x15')](_0x299986[_0x3924('0x27')]);}else if(this[_0x3924('0x7')][_0x299986[_0x3924('0x3c')]]&&this[_0x3924('0x7')][_0x299986['linkedid']][_0x3924('0x1f')]){logger[_0x3924('0x29')](_0x3924('0x40'),_0x299986[_0x3924('0x3c')]);this[_0x3924('0x15')](_0x299986[_0x3924('0x3c')]);}}catch(_0x450586){logger[_0x3924('0x2e')]('[ACW][syncHangup]\x20%s',_0x450586['message']);}};Acw[_0x3924('0x41')][_0x3924('0xf')]=function(_0x1f1e78){try{if(!_[_0x3924('0x42')](this['channels'][_0x1f1e78['transfereeuniqueid']])){this[_0x3924('0x15')](_0x1f1e78['transfereeuniqueid']);if(this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x43')]]){this[_0x3924('0x7')][_0x1f1e78['secondtransfereruniqueid']][_0x3924('0x1f')]=!![];this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x44')]]=this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x43')]];delete this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x43')]];}}else if(!_[_0x3924('0x42')](this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x44')]])){this[_0x3924('0x15')](_0x1f1e78[_0x3924('0x44')]);if(this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x45')]]){this['channels'][_0x1f1e78[_0x3924('0x45')]][_0x3924('0x1f')]=!![];this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x46')]]=this[_0x3924('0x7')][_0x1f1e78[_0x3924('0x45')]];delete this[_0x3924('0x7')][_0x1f1e78['origtransfereruniqueid']];}}}catch(_0x43a9b9){logger[_0x3924('0x2e')](_0x3924('0x47'),_0x43a9b9['message']);}};Acw[_0x3924('0x41')][_0x3924('0x11')]=function(_0x2babbf){try{if(this[_0x3924('0x7')][_0x2babbf[_0x3924('0x48')]]){logger['info'](_0x3924('0x49'),JSON[_0x3924('0x4a')](_0x2babbf[_0x3924('0x48')]));this[_0x3924('0x15')](_0x2babbf[_0x3924('0x48')]);}else if(this[_0x3924('0x7')][_0x2babbf[_0x3924('0x4b')]]){logger[_0x3924('0x29')](_0x3924('0x4c'),JSON[_0x3924('0x4a')](_0x2babbf[_0x3924('0x4b')]));this[_0x3924('0x15')](_0x2babbf[_0x3924('0x4b')]);}}catch(_0x1ea7d5){logger['error'](_0x3924('0x4d'),_0x1ea7d5[_0x3924('0x30')]);}};Acw[_0x3924('0x41')]['syncAgentRingNoAnswer']=function(_0x428a37){try{if(this[_0x3924('0x4')][_0x428a37[_0x3924('0x17')]]&&this[_0x3924('0x4')][_0x428a37['queue']][_0x3924('0x4e')]==='all'){if(this['agents'][_0x428a37[_0x3924('0x16')]]){logger[_0x3924('0x29')](_0x3924('0x4f'),_0x428a37[_0x3924('0x27')],_0x428a37[_0x3924('0x16')],_0x428a37[_0x3924('0x17')]);return RpcUser[_0x3924('0x21')](this[_0x3924('0x5')][_0x428a37[_0x3924('0x16')]],_0x3924('0x50'),_0x428a37['uniqueid']);}}}catch(_0x2c2ba0){logger['error'](_0x3924('0x51'),_0x2c2ba0[_0x3924('0x30')]);}};module[_0x3924('0x52')]=Acw; \ No newline at end of file +var _0xe753=['Action','QueuePause','then','getAgent','voicePause','info','destlinkedid','savePause','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name'];(function(_0xb6408d,_0x5add08){var _0x406b0d=function(_0x225b3e){while(--_0x225b3e){_0xb6408d['push'](_0xb6408d['shift']());}};_0x406b0d(++_0x5add08);}(_0xe753,0x13f));var _0x3e75=function(_0x1a8e9d,_0x34808a){_0x1a8e9d=_0x1a8e9d-0x0;var _0x5a9810=_0xe753[_0x1a8e9d];return _0x5a9810;};'use strict';var util=require(_0x3e75('0x0'));var _=require(_0x3e75('0x1'));var moment=require(_0x3e75('0x2'));var ami=require(_0x3e75('0x3'));var logger=require('../../../config/logger')(_0x3e75('0x4'));var RpcUser=require(_0x3e75('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x341739){this[_0x3e75('0x6')]=_0x341739['voiceQueues'];this[_0x3e75('0x7')]=_0x341739[_0x3e75('0x7')];this[_0x3e75('0x8')]=_0x341739[_0x3e75('0x8')];this['channels']={};ami['on'](_0x3e75('0x9'),this[_0x3e75('0xa')]['bind'](this));ami['on'](_0x3e75('0xb'),this['syncHangupRequest'][_0x3e75('0xc')](this));ami['on']('hangup',this[_0x3e75('0xd')]['bind'](this));ami['on'](_0x3e75('0xe'),this[_0x3e75('0xf')][_0x3e75('0xc')](this));ami['on'](_0x3e75('0x10'),this[_0x3e75('0x11')]['bind'](this));ami['on'](_0x3e75('0x12'),this[_0x3e75('0x13')][_0x3e75('0xc')](this));ami['on'](_0x3e75('0x14'),this[_0x3e75('0x15')]['bind'](this));}function getDiff(_0x4e55b2){var _0x381c99=moment()[_0x3e75('0x16')](0x0);var _0x44be26=moment(_0x4e55b2)[_0x3e75('0x16')](0x0);return _0x381c99[_0x3e75('0x17')](_0x44be26,'seconds');}Acw[_0x3e75('0x18')][_0x3e75('0x19')]=function(_0x45ca39){try{var _0xedf93b=this;var _0x4351a9=this[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x1b')];var _0x27c8ab=this[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x1c')];var _0x259a18=this[_0x3e75('0x6')][_0x27c8ab];var _0x2f1c62=![];var _0x8981d4=_0x3e75('0x1d');if(_0x259a18[_0x3e75('0x1e')]){if(_0x259a18[_0x3e75('0x1f')][_0x3e75('0x20')]){_0x2f1c62=!![];_0x8981d4=_0x259a18['mandatoryDispositionPause'][_0x3e75('0x20')];}}ami[_0x3e75('0x21')]({'action':_0x3e75('0x22'),'interface':_0x4351a9,'paused':!![],'reason':_0x8981d4})[_0x3e75('0x23')](function(_0x506b39){if(_0xedf93b[_0x3e75('0x7')][_0x4351a9]){return RpcUser[_0x3e75('0x24')](_0xedf93b[_0x3e75('0x7')][_0x4351a9]['id'])['then'](function(_0x344db2){if(_0x344db2&&!_0x344db2[_0x3e75('0x25')]){logger[_0x3e75('0x26')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x45ca39,_0x4351a9,_0x27c8ab);var _0x1c4122=_0xedf93b['channels'][_0x45ca39]['attended']&&_0xedf93b[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x27')]?_0xedf93b[_0x3e75('0x1a')][_0x45ca39][_0x3e75('0x27')]:_0x45ca39;return RpcUser[_0x3e75('0x28')](_0xedf93b[_0x3e75('0x7')][_0x4351a9],_0x8981d4,_0x1c4122)[_0x3e75('0x23')](function(_0xb8ee23){if(!_0x2f1c62){_0xedf93b[_0x3e75('0x8')][_0x4351a9]={};logger[_0x3e75('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x45ca39,_0xedf93b['voiceQueues'][_0x27c8ab][_0x3e75('0x29')],_0x4351a9,_0x27c8ab);_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2a')]=setTimeout(_0xedf93b[_0x3e75('0x2b')]['bind'](_0xedf93b,_0x4351a9),_0xedf93b[_0x3e75('0x6')][_0x27c8ab][_0x3e75('0x29')]*0x3e8);_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2c')]=moment()[_0x3e75('0x2d')](_0x3e75('0x2e'));_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2f')]=_0x45ca39;_0xedf93b['timers'][_0x4351a9]['queue']=_0x27c8ab;_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x30')]=function(){var _0x3b7fc5=getDiff(_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2c')]);clearTimeout(_0xedf93b[_0x3e75('0x8')][_0x4351a9]['timer']);_0xedf93b['timers'][_0x4351a9][_0x3e75('0x2a')]=![];RpcVoiceAgentReport[_0x3e75('0x31')]({'acwtime':_0x3b7fc5},_0xedf93b[_0x3e75('0x8')][_0x4351a9][_0x3e75('0x2f')],_0x4351a9)[_0x3e75('0x23')](function(_0x294da9){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x45ca39,_0x3b7fc5,_0x294da9);})[_0x3e75('0x32')](function(_0x26ef85){logger[_0x3e75('0x33')](_0x3e75('0x34'),_0x45ca39,_0x26ef85);});delete _0xedf93b[_0x3e75('0x8')][_0x4351a9];};}});}else{logger[_0x3e75('0x26')](_0x3e75('0x35'),_0x45ca39,_0x4351a9,_0x27c8ab);}});}})[_0x3e75('0x32')](function(_0x239138){logger[_0x3e75('0x33')](_0x3e75('0x36'),_0x45ca39,_0xedf93b[_0x3e75('0x6')][_0x27c8ab]['acwTimeout'],_0x4351a9,_0x27c8ab);})[_0x3e75('0x37')](function(){delete _0xedf93b[_0x3e75('0x1a')][_0x45ca39];});}catch(_0x43dcb7){logger['error']('[ACW][START]\x20%s',_0x43dcb7[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['stopAcw']=function(_0x53cf0d){try{var _0x58d18a=this;if(_0x58d18a[_0x3e75('0x8')][_0x53cf0d]){_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x2a')]=![];var _0x46e222=_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x2f')];var _0x5555e7=_0x58d18a[_0x3e75('0x8')][_0x53cf0d][_0x3e75('0x1c')];var _0x2e955e=_0x58d18a[_0x3e75('0x6')][_0x5555e7]['acwTimeout'];logger[_0x3e75('0x26')]('[%s][TIMER][STOP][AGENT:%s]',_0x46e222,_0x53cf0d);RpcUser[_0x3e75('0x39')](this['agents'][_0x53cf0d]);RpcVoiceAgentReport['update']({'acwtime':_0x2e955e,'agentacw':!![]},_0x46e222,_0x53cf0d)[_0x3e75('0x23')](function(_0xd95d26){logger[_0x3e75('0x26')](_0x3e75('0x3a'),_0x46e222,_0x2e955e,_0xd95d26);})[_0x3e75('0x32')](function(_0x113898){logger[_0x3e75('0x33')](_0x3e75('0x34'),_0x46e222,_0x113898);});}else{logger[_0x3e75('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x53cf0d);if(_0x58d18a[_0x3e75('0x8')]){logger['info'](_0x3e75('0x3b'),JSON['stringify'](_0x58d18a[_0x3e75('0x8')]));}}}catch(_0x579f0e){logger['error'](_0x3e75('0x3c'),_0x579f0e[_0x3e75('0x38')]);}};Acw['prototype']['syncAgentConnect']=function(_0x26819e){try{if(this['voiceQueues'][_0x26819e[_0x3e75('0x1c')]]&&(this[_0x3e75('0x6')][_0x26819e[_0x3e75('0x1c')]][_0x3e75('0x4')]||this['voiceQueues'][_0x26819e['queue']][_0x3e75('0x1e')])){if(this[_0x3e75('0x7')][_0x26819e[_0x3e75('0x1b')]]){this[_0x3e75('0x1a')][_0x26819e[_0x3e75('0x2f')]]={'queue':_0x26819e['queue'],'interface':_0x26819e[_0x3e75('0x1b')],'destlinkedid':_0x26819e[_0x3e75('0x27')]};}}}catch(_0x3664c3){logger['error'](_0x3e75('0x3d'),_0x3664c3['message']);}};Acw[_0x3e75('0x18')]['syncAgentConnectPreview']=function(_0x3ec2e2){try{if(this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]&&(this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]['acw']||this[_0x3e75('0x6')][_0x3ec2e2[_0x3e75('0x1c')]]['mandatoryDisposition'])){if(this['agents'][_0x3ec2e2[_0x3e75('0x1b')]]){this[_0x3e75('0x1a')][_0x3ec2e2[_0x3e75('0x2f')]]={'queue':_0x3ec2e2[_0x3e75('0x1c')],'interface':_0x3ec2e2[_0x3e75('0x1b')]};}}}catch(_0x88812d){logger['error'](_0x3e75('0x3e'),_0x88812d[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncHangupRequest']=function(_0x54672c){try{if(this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x2f')]]&&_[_0x3e75('0x3f')](this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x2f')]][_0x3e75('0x40')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x54672c[_0x3e75('0x2f')]);this[_0x3e75('0x19')](_0x54672c[_0x3e75('0x2f')]);}else if(this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x41')]]&&_[_0x3e75('0x3f')](this[_0x3e75('0x1a')][_0x54672c[_0x3e75('0x41')]][_0x3e75('0x40')])){logger[_0x3e75('0x26')](_0x3e75('0x42'),_0x54672c[_0x3e75('0x41')]);this[_0x3e75('0x19')](_0x54672c[_0x3e75('0x41')]);}}catch(_0x4214f2){logger[_0x3e75('0x33')](_0x3e75('0x43'),_0x4214f2[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncHangup']=function(_0x28033c){try{if(this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x2f')]]&&this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x2f')]]['attended']){logger['info'](_0x3e75('0x44'),_0x28033c[_0x3e75('0x2f')]);this['startAcw'](_0x28033c[_0x3e75('0x2f')]);}else if(this[_0x3e75('0x1a')][_0x28033c[_0x3e75('0x41')]]&&this['channels'][_0x28033c[_0x3e75('0x41')]][_0x3e75('0x40')]){logger['info'](_0x3e75('0x45'),_0x28033c[_0x3e75('0x41')]);this[_0x3e75('0x19')](_0x28033c[_0x3e75('0x41')]);}}catch(_0x5be5f9){logger['error'](_0x3e75('0x46'),_0x5be5f9[_0x3e75('0x38')]);}};Acw['prototype'][_0x3e75('0x11')]=function(_0x3275e4){try{if(!_[_0x3e75('0x47')](this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x48')]])){this[_0x3e75('0x19')](_0x3275e4[_0x3e75('0x48')]);if(this[_0x3e75('0x1a')][_0x3275e4['secondtransfereruniqueid']]){this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x49')]][_0x3e75('0x40')]=!![];this['channels'][_0x3275e4[_0x3e75('0x4a')]]=this['channels'][_0x3275e4['secondtransfereruniqueid']];delete this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x49')]];}}else if(!_[_0x3e75('0x47')](this[_0x3e75('0x1a')][_0x3275e4[_0x3e75('0x4a')]])){this[_0x3e75('0x19')](_0x3275e4[_0x3e75('0x4a')]);if(this['channels'][_0x3275e4[_0x3e75('0x4b')]]){this['channels'][_0x3275e4[_0x3e75('0x4b')]][_0x3e75('0x40')]=!![];this['channels'][_0x3275e4[_0x3e75('0x48')]]=this['channels'][_0x3275e4['origtransfereruniqueid']];delete this['channels'][_0x3275e4[_0x3e75('0x4b')]];}}}catch(_0x473bcd){logger[_0x3e75('0x33')](_0x3e75('0x4c'),_0x473bcd[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')][_0x3e75('0x13')]=function(_0x3a42ef){try{if(this['channels'][_0x3a42ef[_0x3e75('0x4d')]]){logger[_0x3e75('0x26')](_0x3e75('0x4e'),JSON[_0x3e75('0x4f')](_0x3a42ef['transfereruniqueid']));this[_0x3e75('0x19')](_0x3a42ef[_0x3e75('0x4d')]);}else if(this[_0x3e75('0x1a')][_0x3a42ef[_0x3e75('0x50')]]){logger['info'](_0x3e75('0x51'),JSON[_0x3e75('0x4f')](_0x3a42ef[_0x3e75('0x50')]));this[_0x3e75('0x19')](_0x3a42ef[_0x3e75('0x50')]);}}catch(_0x2d0100){logger[_0x3e75('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x2d0100[_0x3e75('0x38')]);}};Acw[_0x3e75('0x18')]['syncAgentRingNoAnswer']=function(_0xf6c7a){try{if(this['voiceQueues'][_0xf6c7a[_0x3e75('0x1c')]]&&this[_0x3e75('0x6')][_0xf6c7a[_0x3e75('0x1c')]][_0x3e75('0x52')]===_0x3e75('0x53')){if(this[_0x3e75('0x7')][_0xf6c7a[_0x3e75('0x1b')]]){logger[_0x3e75('0x26')](_0x3e75('0x54'),_0xf6c7a['uniqueid'],_0xf6c7a[_0x3e75('0x1b')],_0xf6c7a[_0x3e75('0x1c')]);return RpcUser[_0x3e75('0x28')](this['agents'][_0xf6c7a['interface']],_0x3e75('0x55'),_0xf6c7a['uniqueid']);}}}catch(_0xb0811){logger['error'](_0x3e75('0x56'),_0xb0811[_0x3e75('0x38')]);}};module[_0x3e75('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e6599e7..41ac62b 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x39dfd6,_0x2c9f2d){var _0x46778d=function(_0x31c79e){while(--_0x31c79e){_0x39dfd6['push'](_0x39dfd6['shift']());}};_0x46778d(++_0x2c9f2d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +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(_0x11cba3,_0x573392){_0x11cba3=_0x11cba3-0x0;var _0x2ecac3=_0x2032[_0x11cba3];return _0x2ecac3;};'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 diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c3906b3..0f35e24 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xac4a,0x13f));var _0xaac4=function(_0x1d7a9d,_0x55f48e){_0x1d7a9d=_0x1d7a9d-0x0;var _0x11cbc2=_0xac4a[_0x1d7a9d];return _0x11cbc2;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 410c782..c660e4c 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 _0x4faf=['type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','substring','getQueue','util','moment','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4faf,0x133));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xf4fa('0x0'));var _=require('lodash');var moment=require(_0xf4fa('0x1'));function checkNameSurname(_0x3a5637,_0x3b6240,_0x372f36){var _0x4d760f='';if(!_[_0xf4fa('0x2')](_0x3b6240)&&'string'===typeof _0x3b6240){_0x4d760f+=_0x3b6240;}if(!_[_0xf4fa('0x2')](_0x372f36)&&'string'===typeof _0x372f36){_0x4d760f+='\x20'+_0x372f36;}if(_0x4d760f!==''){return _0x4d760f;}return _0x3a5637;}function Action(_0x142bb5,_0x45640d,_0x5f27ea){this[_0xf4fa('0x3')]=_0x142bb5;this[_0xf4fa('0x4')]=_0x5f27ea||undefined;this[_0xf4fa('0x5')]=checkNameSurname(_0x45640d[_0xf4fa('0x6')][_0xf4fa('0x7')],_0x45640d[_0xf4fa('0x6')][_0xf4fa('0x8')],_0x45640d[_0xf4fa('0x6')][_0xf4fa('0x9')]);this[_0xf4fa('0xa')]=_0x45640d[_0xf4fa('0x6')]['phone'];this[_0xf4fa('0xb')]=_0x142bb5[_0xf4fa('0x5')];this[_0xf4fa('0xc')]=_0x45640d[_0xf4fa('0xc')]||![];this[_0xf4fa('0xd')]=_0x142bb5[_0xf4fa('0xd')];this[_0xf4fa('0xe')]=_0x142bb5[_0xf4fa('0xe')]||0x3;this[_0xf4fa('0xf')]=_0x45640d[_0xf4fa('0xf')];this[_0xf4fa('0x10')]=_0x45640d['countbusyretry'];this[_0xf4fa('0x11')]=_0x45640d[_0xf4fa('0x11')];this[_0xf4fa('0x12')]=_0x45640d['countnoanswerretry'];this[_0xf4fa('0x13')]=_0x45640d[_0xf4fa('0x13')];this[_0xf4fa('0x14')]=_0x45640d[_0xf4fa('0x14')];this[_0xf4fa('0x15')]=_0x45640d[_0xf4fa('0x15')];this[_0xf4fa('0x16')]=_0x45640d[_0xf4fa('0x16')];this['countagentrejectretry']=_0x45640d[_0xf4fa('0x17')];this['ContactId']=_0x45640d[_0xf4fa('0x18')];this[_0xf4fa('0x19')]=_0x45640d[_0xf4fa('0x19')];this[_0xf4fa('0x1a')]=_0x45640d[_0xf4fa('0x1a')];this[_0xf4fa('0x1b')]=_0x45640d[_0xf4fa('0x1b')];this[_0xf4fa('0x1c')]=_0x45640d[_0xf4fa('0x1c')];this['idHopper']=_0x45640d['id'];this['ContactFirstName']=_0x45640d[_0xf4fa('0x6')][_0xf4fa('0x8')]||'';this['starttime']=moment()[_0xf4fa('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x45640d[_0xf4fa('0x1e')];this[_0xf4fa('0x1f')]=_0x45640d['callbackuniqueid'];this[_0xf4fa('0x20')]=_0x45640d[_0xf4fa('0x20')];this[_0xf4fa('0x21')]=_0x45640d[_0xf4fa('0x21')];this[_0xf4fa('0x22')]='';this[_0xf4fa('0x23')]='';}Action[_0xf4fa('0x24')]['getCaller']=function(){return util[_0xf4fa('0x1d')]('\x22%s\x22\x20<%s>',this[_0xf4fa('0x5')],this[_0xf4fa('0x3')][_0xf4fa('0x25')]>0x0?this[_0xf4fa('0xa')][_0xf4fa('0x26')](this[_0xf4fa('0x3')][_0xf4fa('0x25')]):this[_0xf4fa('0xa')]);};Action['prototype'][_0xf4fa('0x27')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0xc39f=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','string','uniqueid','Contact','firstName','number','phone','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x54ac56,_0x5149c9){var _0x4ae038=function(_0x4124d6){while(--_0x4124d6){_0x54ac56['push'](_0x54ac56['shift']());}};_0x4ae038(++_0x5149c9);}(_0xc39f,0x144));var _0xfc39=function(_0x53dba8,_0x4c8665){_0x53dba8=_0x53dba8-0x0;var _0x3a39e7=_0xc39f[_0x53dba8];return _0x3a39e7;};'use strict';var util=require(_0xfc39('0x0'));var _=require(_0xfc39('0x1'));var moment=require(_0xfc39('0x2'));function checkNameSurname(_0x304dd8,_0x1924a1,_0x3bddda){var _0x20ca81='';if(!_['isNil'](_0x1924a1)&&'string'===typeof _0x1924a1){_0x20ca81+=_0x1924a1;}if(!_['isNil'](_0x3bddda)&&_0xfc39('0x3')===typeof _0x3bddda){_0x20ca81+='\x20'+_0x3bddda;}if(_0x20ca81!==''){return _0x20ca81;}return _0x304dd8;}function Action(_0x547f56,_0x4e3a23,_0x23006b){this['voiceQueue']=_0x547f56;this[_0xfc39('0x4')]=_0x23006b||undefined;this['name']=checkNameSurname(_0x4e3a23['Contact']['phone'],_0x4e3a23[_0xfc39('0x5')][_0xfc39('0x6')],_0x4e3a23[_0xfc39('0x5')]['lastName']);this[_0xfc39('0x7')]=_0x4e3a23['Contact'][_0xfc39('0x8')];this['queue']=_0x547f56[_0xfc39('0x9')];this[_0xfc39('0xa')]=_0x4e3a23['active']||![];this['type']=_0x547f56['type'];this[_0xfc39('0xb')]=_0x547f56[_0xfc39('0xb')]||0x3;this[_0xfc39('0xc')]=_0x4e3a23[_0xfc39('0xc')];this[_0xfc39('0xd')]=_0x4e3a23[_0xfc39('0xd')];this['countcongestionretry']=_0x4e3a23[_0xfc39('0xe')];this['countnoanswerretry']=_0x4e3a23[_0xfc39('0xf')];this[_0xfc39('0x10')]=_0x4e3a23[_0xfc39('0x10')];this[_0xfc39('0x11')]=_0x4e3a23[_0xfc39('0x11')];this[_0xfc39('0x12')]=_0x4e3a23['countabandonedretry'];this['countmachineretry']=_0x4e3a23[_0xfc39('0x13')];this[_0xfc39('0x14')]=_0x4e3a23['countagentrejectretry'];this[_0xfc39('0x15')]=_0x4e3a23[_0xfc39('0x15')];this[_0xfc39('0x16')]=_0x4e3a23[_0xfc39('0x16')];this['UserId']=_0x4e3a23[_0xfc39('0x17')];this[_0xfc39('0x18')]=_0x4e3a23['VoiceQueueId'];this[_0xfc39('0x19')]=_0x4e3a23['CampaignId'];this['idHopper']=_0x4e3a23['id'];this[_0xfc39('0x1a')]=_0x4e3a23['Contact']['firstName']||'';this['starttime']=moment()[_0xfc39('0x1b')](_0xfc39('0x1c'));this[_0xfc39('0x1d')]=_0x4e3a23[_0xfc39('0x1d')];this[_0xfc39('0x1e')]=_0x4e3a23[_0xfc39('0x1e')];this[_0xfc39('0x1f')]=_0x4e3a23[_0xfc39('0x1f')];this[_0xfc39('0x20')]=_0x4e3a23[_0xfc39('0x20')];this[_0xfc39('0x21')]='';this['originatecalleridname']='';}Action[_0xfc39('0x22')][_0xfc39('0x23')]=function(){return util[_0xfc39('0x1b')](_0xfc39('0x24'),this[_0xfc39('0x9')],this[_0xfc39('0x25')][_0xfc39('0x26')]>0x0?this[_0xfc39('0x7')][_0xfc39('0x27')](this[_0xfc39('0x25')][_0xfc39('0x26')]):this[_0xfc39('0x7')]);};Action[_0xfc39('0x22')][_0xfc39('0x28')]=function(){return this[_0xfc39('0x29')];};module[_0xfc39('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e10c6d7..355d53d 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 _0x9b12=['moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash'];(function(_0x193f83,_0x5d25ba){var _0x55bdc9=function(_0x2f1e31){while(--_0x2f1e31){_0x193f83['push'](_0x193f83['shift']());}};_0x55bdc9(++_0x5d25ba);}(_0x9b12,0x1d8));var _0x29b1=function(_0x406089,_0x57017c){_0x406089=_0x406089-0x0;var _0x451282=_0x9b12[_0x406089];return _0x451282;};'use strict';var util=require('util');var _=require(_0x29b1('0x0'));var moment=require(_0x29b1('0x1'));function getSeconds(_0x347f35,_0x208f05){var _0x58c5cd=moment(_0x347f35)[_0x29b1('0x2')](0x0);var _0x1e8532=moment(_0x208f05)['milliseconds'](0x0);return _0x58c5cd[_0x29b1('0x3')](_0x1e8532,_0x29b1('0x4'));}function AgentComplete(_0x344d90,_0x182c2e){this[_0x29b1('0x5')]=0x4;this[_0x29b1('0x6')]=_0x29b1('0x7');this[_0x29b1('0x8')]=_0x344d90[_0x29b1('0x8')];this[_0x29b1('0x9')]=_0x344d90[_0x29b1('0x9')];this['campaigntype']=_0x344d90[_0x29b1('0x9')]===_0x29b1('0xa')?_0x29b1('0xb'):_0x344d90['type'];this['countbusyretry']=_0x344d90[_0x29b1('0xc')];this['countcongestionretry']=_0x344d90['countcongestionretry'];this['countnoanswerretry']=_0x344d90[_0x29b1('0xd')];this[_0x29b1('0xe')]=_0x344d90[_0x29b1('0xc')]+_0x344d90[_0x29b1('0xf')]+_0x344d90[_0x29b1('0xd')]+_0x344d90['countnosuchnumberretry']+_0x344d90[_0x29b1('0x10')]+_0x344d90['countabandonedretry']+_0x344d90[_0x29b1('0x11')]+_0x344d90[_0x29b1('0x12')];this['countnosuchnumberretry']=_0x344d90[_0x29b1('0x13')];this[_0x29b1('0x10')]=_0x344d90[_0x29b1('0x10')];this['countabandonedretry']=_0x344d90['countabandonedretry'];this[_0x29b1('0x11')]=_0x344d90['countmachineretry'];this[_0x29b1('0x12')]=_0x344d90['countagentrejectretry'];this[_0x29b1('0x14')]=_0x182c2e['uniqueid'];this[_0x29b1('0x15')]=_0x344d90[_0x29b1('0x16')];this[_0x29b1('0x17')]=_0x344d90[_0x29b1('0x18')];this[_0x29b1('0x19')]=_0x344d90[_0x29b1('0x19')];this[_0x29b1('0x1a')]=_0x344d90['responsetime'];this['answertime']=_0x344d90[_0x29b1('0x1b')];this[_0x29b1('0x1c')]=moment()['format'](_0x29b1('0x1d'));this['ringtime']=getSeconds(_0x344d90[_0x29b1('0x1a')],_0x344d90[_0x29b1('0x19')]);this['holdtime']=getSeconds(_0x344d90[_0x29b1('0x1b')],_0x344d90[_0x29b1('0x1a')]);this['talktime']=getSeconds(this[_0x29b1('0x1c')],_0x344d90[_0x29b1('0x1b')]);this[_0x29b1('0xb')]=_0x182c2e[_0x29b1('0xb')];this['membername']=_0x182c2e[_0x29b1('0x1e')];this[_0x29b1('0x1f')]=_0x182c2e[_0x29b1('0x1f')];this[_0x29b1('0x20')]=_0x344d90[_0x29b1('0x20')];this[_0x29b1('0x21')]=_0x344d90['callbackuniqueid'];this['callbackat']=_0x344d90[_0x29b1('0x22')];this[_0x29b1('0x23')]=_0x344d90[_0x29b1('0x23')];this['ContactId']=_0x344d90['ContactId'];this[_0x29b1('0x24')]=_0x344d90[_0x29b1('0x24')];this[_0x29b1('0x25')]=_0x344d90['UserId'];this[_0x29b1('0x26')]=_0x344d90[_0x29b1('0x26')];this[_0x29b1('0x27')]=_0x344d90[_0x29b1('0x27')];this['originatecalleridnum']=_0x344d90[_0x29b1('0x28')]||'';this[_0x29b1('0x29')]=_0x344d90['originatecalleridname']||'';}module[_0x29b1('0x2a')]=AgentComplete; \ No newline at end of file +var _0x991a=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','countbusyretry'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x991a,0x1c1));var _0xa991=function(_0x2a341e,_0x515d38){_0x2a341e=_0x2a341e-0x0;var _0x211412=_0x991a[_0x2a341e];return _0x211412;};'use strict';var util=require(_0xa991('0x0'));var _=require(_0xa991('0x1'));var moment=require(_0xa991('0x2'));function getSeconds(_0x4ee072,_0xee3a50){var _0x59cd57=moment(_0x4ee072)[_0xa991('0x3')](0x0);var _0x48052f=moment(_0xee3a50)[_0xa991('0x3')](0x0);return _0x59cd57[_0xa991('0x4')](_0x48052f,_0xa991('0x5'));}function AgentComplete(_0x15029e,_0x5ca732){this[_0xa991('0x6')]=0x4;this['statedesc']='Answer';this[_0xa991('0x7')]=_0x15029e['scheduledat'];this[_0xa991('0x8')]=_0x15029e['type'];this[_0xa991('0x9')]=_0x15029e[_0xa991('0x8')]==='outbound'?'queue':_0x15029e[_0xa991('0x8')];this[_0xa991('0xa')]=_0x15029e[_0xa991('0xa')];this[_0xa991('0xb')]=_0x15029e['countcongestionretry'];this[_0xa991('0xc')]=_0x15029e[_0xa991('0xc')];this[_0xa991('0xd')]=_0x15029e[_0xa991('0xa')]+_0x15029e[_0xa991('0xb')]+_0x15029e[_0xa991('0xc')]+_0x15029e[_0xa991('0xe')]+_0x15029e['countdropretry']+_0x15029e[_0xa991('0xf')]+_0x15029e[_0xa991('0x10')]+_0x15029e[_0xa991('0x11')];this[_0xa991('0xe')]=_0x15029e[_0xa991('0xe')];this[_0xa991('0x12')]=_0x15029e[_0xa991('0x12')];this[_0xa991('0xf')]=_0x15029e[_0xa991('0xf')];this[_0xa991('0x10')]=_0x15029e[_0xa991('0x10')];this[_0xa991('0x11')]=_0x15029e[_0xa991('0x11')];this['uniqueid']=_0x5ca732[_0xa991('0x13')];this[_0xa991('0x14')]=_0x15029e[_0xa991('0x15')];this[_0xa991('0x16')]=_0x15029e[_0xa991('0x17')];this[_0xa991('0x18')]=_0x15029e[_0xa991('0x18')];this[_0xa991('0x19')]=_0x15029e[_0xa991('0x19')];this[_0xa991('0x1a')]=_0x15029e['answertime'];this['endtime']=moment()[_0xa991('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa991('0x1c')]=getSeconds(_0x15029e['responsetime'],_0x15029e['starttime']);this[_0xa991('0x1d')]=getSeconds(_0x15029e['answertime'],_0x15029e['responsetime']);this[_0xa991('0x1e')]=getSeconds(this['endtime'],_0x15029e[_0xa991('0x1a')]);this[_0xa991('0x1f')]=_0x5ca732['queue'];this[_0xa991('0x20')]=_0x5ca732[_0xa991('0x20')];this['reason']=_0x5ca732[_0xa991('0x21')];this['callback']=_0x15029e[_0xa991('0x22')];this[_0xa991('0x23')]=_0x15029e[_0xa991('0x23')];this[_0xa991('0x24')]=_0x15029e[_0xa991('0x24')];this[_0xa991('0x25')]=_0x15029e[_0xa991('0x25')];this[_0xa991('0x26')]=_0x15029e[_0xa991('0x26')];this[_0xa991('0x27')]=_0x15029e[_0xa991('0x27')];this[_0xa991('0x28')]=_0x15029e[_0xa991('0x28')];this[_0xa991('0x29')]=_0x15029e['VoiceQueueId'];this[_0xa991('0x2a')]=_0x15029e[_0xa991('0x2a')];this[_0xa991('0x2b')]=_0x15029e[_0xa991('0x2b')]||'';this[_0xa991('0x2c')]=_0x15029e[_0xa991('0x2c')]||'';}module[_0xa991('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e437351..839fe3c 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 _0xac95=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime'];(function(_0x1708e0,_0x1cf4e2){var _0x5a4e51=function(_0x1d55a6){while(--_0x1d55a6){_0x1708e0['push'](_0x1708e0['shift']());}};_0x5a4e51(++_0x1cf4e2);}(_0xac95,0xa8));var _0x5ac9=function(_0x406c0c,_0x269520){_0x406c0c=_0x406c0c-0x0;var _0x54ea2a=_0xac95[_0x406c0c];return _0x54ea2a;};'use strict';var util=require(_0x5ac9('0x0'));var _=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));function getSeconds(_0x471ff6,_0x4c14a3){var _0x57ca1c=moment(_0x471ff6)[_0x5ac9('0x3')](0x0);var _0x1ebdea=moment(_0x4c14a3)['milliseconds'](0x0);return _0x57ca1c[_0x5ac9('0x4')](_0x1ebdea,_0x5ac9('0x5'));}function Final(_0x5b445a){this[_0x5ac9('0x6')]=_0x5b445a[_0x5ac9('0x6')];this[_0x5ac9('0x7')]=_0x5b445a['scheduledat'];this['type']=_0x5b445a[_0x5ac9('0x8')];this[_0x5ac9('0x9')]=_0x5b445a[_0x5ac9('0x8')]===_0x5ac9('0xa')?_0x5ac9('0xb'):_0x5b445a[_0x5ac9('0x8')];this['countbusyretry']=_0x5b445a[_0x5ac9('0xc')];this[_0x5ac9('0xd')]=_0x5b445a['countcongestionretry'];this[_0x5ac9('0xe')]=_0x5b445a['countnoanswerretry'];this[_0x5ac9('0xf')]=_0x5b445a['countbusyretry']+_0x5b445a[_0x5ac9('0xd')]+_0x5b445a[_0x5ac9('0xe')]+_0x5b445a[_0x5ac9('0x10')]+_0x5b445a[_0x5ac9('0x11')]+_0x5b445a['countabandonedretry']+_0x5b445a['countmachineretry']+_0x5b445a[_0x5ac9('0x12')];this['countnosuchnumberretry']=_0x5b445a[_0x5ac9('0x10')];this[_0x5ac9('0x11')]=_0x5b445a['countdropretry'];this[_0x5ac9('0x13')]=_0x5b445a[_0x5ac9('0x13')];this[_0x5ac9('0x14')]=_0x5b445a[_0x5ac9('0x14')];this[_0x5ac9('0x12')]=_0x5b445a[_0x5ac9('0x12')];this[_0x5ac9('0xb')]=_0x5b445a[_0x5ac9('0xb')];this[_0x5ac9('0x15')]=_0x5b445a['calleridname'];this['calleridnum']=_0x5b445a[_0x5ac9('0x16')];this[_0x5ac9('0x17')]=_0x5b445a[_0x5ac9('0x17')];this[_0x5ac9('0x18')]=_0x5b445a[_0x5ac9('0x18')];this[_0x5ac9('0x19')]=_0x5b445a[_0x5ac9('0x18')];this[_0x5ac9('0x1a')]=_0x5b445a[_0x5ac9('0x1a')]||0x0;this[_0x5ac9('0x1b')]=_0x5b445a[_0x5ac9('0x1b')]||0x0;this[_0x5ac9('0x1c')]=_0x5b445a[_0x5ac9('0x1c')]||0x0;this['callback']=_0x5b445a[_0x5ac9('0x1d')];this[_0x5ac9('0x1e')]=_0x5b445a[_0x5ac9('0x1e')];this[_0x5ac9('0x1f')]=_0x5b445a[_0x5ac9('0x1f')];this['recallme']=_0x5b445a[_0x5ac9('0x20')];this[_0x5ac9('0x21')]=_0x5b445a['ContactId'];this['ListId']=_0x5b445a['ListId'];this[_0x5ac9('0x22')]=_0x5b445a[_0x5ac9('0x22')];this['VoiceQueueId']=_0x5b445a['VoiceQueueId'];this[_0x5ac9('0x23')]=_0x5b445a['CampaignId'];this['originatecalleridnum']=_0x5b445a[_0x5ac9('0x24')]||'';this['originatecalleridname']=_0x5b445a[_0x5ac9('0x25')]||'';}module[_0x5ac9('0x26')]=Final; \ No newline at end of file +var _0x1c9a=['type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x278364,_0x1a81ec){_0x278364=_0x278364-0x0;var _0x58de78=_0x1c9a[_0x278364];return _0x58de78;};'use strict';var util=require(_0xa1c9('0x0'));var _=require(_0xa1c9('0x1'));var moment=require('moment');function getSeconds(_0x6084bf,_0x867bbb){var _0x38c48f=moment(_0x6084bf)[_0xa1c9('0x2')](0x0);var _0x3d8576=moment(_0x867bbb)['milliseconds'](0x0);return _0x38c48f[_0xa1c9('0x3')](_0x3d8576,'seconds');}function Final(_0x1716cb){this[_0xa1c9('0x4')]=_0x1716cb[_0xa1c9('0x4')];this[_0xa1c9('0x5')]=_0x1716cb[_0xa1c9('0x5')];this[_0xa1c9('0x6')]=_0x1716cb[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x1716cb[_0xa1c9('0x6')]===_0xa1c9('0x8')?_0xa1c9('0x9'):_0x1716cb[_0xa1c9('0x6')];this['countbusyretry']=_0x1716cb['countbusyretry'];this[_0xa1c9('0xa')]=_0x1716cb['countcongestionretry'];this[_0xa1c9('0xb')]=_0x1716cb[_0xa1c9('0xb')];this[_0xa1c9('0xc')]=_0x1716cb[_0xa1c9('0xd')]+_0x1716cb[_0xa1c9('0xa')]+_0x1716cb[_0xa1c9('0xb')]+_0x1716cb[_0xa1c9('0xe')]+_0x1716cb[_0xa1c9('0xf')]+_0x1716cb[_0xa1c9('0x10')]+_0x1716cb[_0xa1c9('0x11')]+_0x1716cb[_0xa1c9('0x12')];this[_0xa1c9('0xe')]=_0x1716cb[_0xa1c9('0xe')];this[_0xa1c9('0xf')]=_0x1716cb[_0xa1c9('0xf')];this[_0xa1c9('0x10')]=_0x1716cb[_0xa1c9('0x10')];this[_0xa1c9('0x11')]=_0x1716cb[_0xa1c9('0x11')];this[_0xa1c9('0x12')]=_0x1716cb['countagentrejectretry'];this[_0xa1c9('0x9')]=_0x1716cb['queue'];this[_0xa1c9('0x13')]=_0x1716cb[_0xa1c9('0x13')];this[_0xa1c9('0x14')]=_0x1716cb[_0xa1c9('0x14')];this[_0xa1c9('0x15')]=_0x1716cb[_0xa1c9('0x15')];this[_0xa1c9('0x16')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x1716cb[_0xa1c9('0x16')];this[_0xa1c9('0x18')]=_0x1716cb[_0xa1c9('0x18')]||0x0;this['holdtime']=_0x1716cb[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=_0x1716cb[_0xa1c9('0x1a')]||0x0;this[_0xa1c9('0x1b')]=_0x1716cb[_0xa1c9('0x1b')];this[_0xa1c9('0x1c')]=_0x1716cb[_0xa1c9('0x1c')];this[_0xa1c9('0x1d')]=_0x1716cb['callbackat'];this[_0xa1c9('0x1e')]=_0x1716cb[_0xa1c9('0x1e')];this['ContactId']=_0x1716cb[_0xa1c9('0x1f')];this[_0xa1c9('0x20')]=_0x1716cb[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x1716cb[_0xa1c9('0x21')];this['VoiceQueueId']=_0x1716cb[_0xa1c9('0x22')];this[_0xa1c9('0x23')]=_0x1716cb[_0xa1c9('0x23')];this['originatecalleridnum']=_0x1716cb[_0xa1c9('0x24')]||'';this[_0xa1c9('0x25')]=_0x1716cb[_0xa1c9('0x25')]||'';}module[_0xa1c9('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 a0eec9f..9dc31f2 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 _0x0679=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','IVR','reason'];(function(_0xff5684,_0xfe6e00){var _0x41e374=function(_0x145196){while(--_0x145196){_0xff5684['push'](_0xff5684['shift']());}};_0x41e374(++_0xfe6e00);}(_0x0679,0x113));var _0x9067=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x0679[_0xd0b415];return _0x2bdf2c;};'use strict';var util=require(_0x9067('0x0'));var _=require(_0x9067('0x1'));var moment=require(_0x9067('0x2'));function getSeconds(_0x33da5d,_0x11db76){var _0x4bd491=moment(_0x33da5d)[_0x9067('0x3')](0x0);var _0x14756f=moment(_0x11db76)['milliseconds'](0x0);return _0x4bd491['diff'](_0x14756f,_0x9067('0x4'));}function Hangup(_0x3fee47,_0x5a3e29){this[_0x9067('0x5')]=0x4;this['statedesc']=_0x9067('0x6');this[_0x9067('0x7')]=_0x3fee47['scheduledat'];this[_0x9067('0x8')]=_0x3fee47[_0x9067('0x8')];this[_0x9067('0x9')]=_0x3fee47[_0x9067('0x8')]==='outbound'?_0x9067('0xa'):_0x3fee47[_0x9067('0x8')];this['countbusyretry']=_0x3fee47[_0x9067('0xb')];this[_0x9067('0xc')]=_0x3fee47[_0x9067('0xc')];this[_0x9067('0xd')]=_0x3fee47['countnoanswerretry'];this[_0x9067('0xe')]=_0x3fee47[_0x9067('0xb')]+_0x3fee47[_0x9067('0xc')]+_0x3fee47['countnoanswerretry']+_0x3fee47[_0x9067('0xf')]+_0x3fee47['countdropretry']+_0x3fee47[_0x9067('0x10')]+_0x3fee47[_0x9067('0x11')]+_0x3fee47['countagentrejectretry'];this[_0x9067('0xf')]=_0x3fee47['countnosuchnumberretry'];this[_0x9067('0x12')]=_0x3fee47['countdropretry'];this[_0x9067('0x10')]=_0x3fee47[_0x9067('0x10')];this[_0x9067('0x11')]=_0x3fee47[_0x9067('0x11')];this['countagentrejectretry']=_0x3fee47['countagentrejectretry'];this[_0x9067('0x13')]=_0x5a3e29[_0x9067('0x13')];this[_0x9067('0x14')]=_0x3fee47[_0x9067('0x15')];this[_0x9067('0x16')]=_0x3fee47[_0x9067('0x17')];this[_0x9067('0x18')]=_0x3fee47[_0x9067('0x18')];this[_0x9067('0x19')]=_0x3fee47[_0x9067('0x19')];this[_0x9067('0x1a')]=moment()[_0x9067('0x1b')](_0x9067('0x1c'));this[_0x9067('0x1d')]=getSeconds(_0x3fee47[_0x9067('0x19')],_0x3fee47[_0x9067('0x18')]);this[_0x9067('0x1e')]=0x0;this['talktime']=getSeconds(this[_0x9067('0x1a')],_0x3fee47['responsetime']);this[_0x9067('0xa')]=_0x3fee47['queue'];this['membername']=_0x9067('0x1f');this[_0x9067('0x20')]=_0x5a3e29[_0x9067('0x21')];this[_0x9067('0x22')]=_0x3fee47[_0x9067('0x22')];this[_0x9067('0x23')]=_0x3fee47[_0x9067('0x23')];this[_0x9067('0x24')]=_0x3fee47[_0x9067('0x24')];this[_0x9067('0x25')]=_0x3fee47[_0x9067('0x25')];this[_0x9067('0x26')]=_0x3fee47[_0x9067('0x26')];this[_0x9067('0x27')]=_0x3fee47[_0x9067('0x27')];this[_0x9067('0x28')]=_0x3fee47[_0x9067('0x28')];this[_0x9067('0x29')]=_0x3fee47[_0x9067('0x29')];this['CampaignId']=_0x3fee47[_0x9067('0x2a')];}module[_0x9067('0x2b')]=Hangup; \ No newline at end of file +var _0x82ee=['moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash'];(function(_0x3e3483,_0x348b06){var _0x314cf2=function(_0x492859){while(--_0x492859){_0x3e3483['push'](_0x3e3483['shift']());}};_0x314cf2(++_0x348b06);}(_0x82ee,0x1cb));var _0xe82e=function(_0x3ce652,_0x58bc59){_0x3ce652=_0x3ce652-0x0;var _0x5e02b6=_0x82ee[_0x3ce652];return _0x5e02b6;};'use strict';var util=require('util');var _=require(_0xe82e('0x0'));var moment=require(_0xe82e('0x1'));function getSeconds(_0x3bbcba,_0xf4fecd){var _0x3b6d6f=moment(_0x3bbcba)['milliseconds'](0x0);var _0x9f14bb=moment(_0xf4fecd)[_0xe82e('0x2')](0x0);return _0x3b6d6f[_0xe82e('0x3')](_0x9f14bb,_0xe82e('0x4'));}function Hangup(_0x5c9d22,_0x14a2c1){this[_0xe82e('0x5')]=0x4;this[_0xe82e('0x6')]=_0xe82e('0x7');this['scheduledat']=_0x5c9d22[_0xe82e('0x8')];this[_0xe82e('0x9')]=_0x5c9d22[_0xe82e('0x9')];this[_0xe82e('0xa')]=_0x5c9d22[_0xe82e('0x9')]===_0xe82e('0xb')?_0xe82e('0xc'):_0x5c9d22[_0xe82e('0x9')];this[_0xe82e('0xd')]=_0x5c9d22[_0xe82e('0xd')];this[_0xe82e('0xe')]=_0x5c9d22['countcongestionretry'];this[_0xe82e('0xf')]=_0x5c9d22['countnoanswerretry'];this[_0xe82e('0x10')]=_0x5c9d22[_0xe82e('0xd')]+_0x5c9d22[_0xe82e('0xe')]+_0x5c9d22[_0xe82e('0xf')]+_0x5c9d22['countnosuchnumberretry']+_0x5c9d22[_0xe82e('0x11')]+_0x5c9d22[_0xe82e('0x12')]+_0x5c9d22['countmachineretry']+_0x5c9d22['countagentrejectretry'];this['countnosuchnumberretry']=_0x5c9d22[_0xe82e('0x13')];this['countdropretry']=_0x5c9d22[_0xe82e('0x11')];this[_0xe82e('0x12')]=_0x5c9d22[_0xe82e('0x12')];this[_0xe82e('0x14')]=_0x5c9d22[_0xe82e('0x14')];this[_0xe82e('0x15')]=_0x5c9d22['countagentrejectretry'];this[_0xe82e('0x16')]=_0x14a2c1['uniqueid'];this[_0xe82e('0x17')]=_0x5c9d22[_0xe82e('0x18')];this[_0xe82e('0x19')]=_0x5c9d22[_0xe82e('0x1a')];this[_0xe82e('0x1b')]=_0x5c9d22[_0xe82e('0x1b')];this[_0xe82e('0x1c')]=_0x5c9d22[_0xe82e('0x1c')];this[_0xe82e('0x1d')]=moment()[_0xe82e('0x1e')](_0xe82e('0x1f'));this[_0xe82e('0x20')]=getSeconds(_0x5c9d22[_0xe82e('0x1c')],_0x5c9d22[_0xe82e('0x1b')]);this[_0xe82e('0x21')]=0x0;this['talktime']=getSeconds(this[_0xe82e('0x1d')],_0x5c9d22[_0xe82e('0x1c')]);this[_0xe82e('0xc')]=_0x5c9d22[_0xe82e('0xc')];this[_0xe82e('0x22')]=_0xe82e('0x23');this['reason']=_0x14a2c1[_0xe82e('0x24')];this[_0xe82e('0x25')]=_0x5c9d22[_0xe82e('0x25')];this['callbackuniqueid']=_0x5c9d22['callbackuniqueid'];this[_0xe82e('0x26')]=_0x5c9d22[_0xe82e('0x26')];this[_0xe82e('0x27')]=_0x5c9d22[_0xe82e('0x27')];this[_0xe82e('0x28')]=_0x5c9d22[_0xe82e('0x28')];this[_0xe82e('0x29')]=_0x5c9d22[_0xe82e('0x29')];this[_0xe82e('0x2a')]=_0x5c9d22[_0xe82e('0x2a')];this[_0xe82e('0x2b')]=_0x5c9d22[_0xe82e('0x2b')];this[_0xe82e('0x2c')]=_0x5c9d22[_0xe82e('0x2c')];}module[_0xe82e('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 3b9fb8c..16c049e 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 _0x8d7e=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime'];(function(_0x602ca8,_0x568e82){var _0x26e8ab=function(_0x3fb700){while(--_0x3fb700){_0x602ca8['push'](_0x602ca8['shift']());}};_0x26e8ab(++_0x568e82);}(_0x8d7e,0x1e3));var _0xe8d7=function(_0x3778df,_0x54392a){_0x3778df=_0x3778df-0x0;var _0x212035=_0x8d7e[_0x3778df];return _0x212035;};'use strict';var util=require('util');var _=require(_0xe8d7('0x0'));var moment=require(_0xe8d7('0x1'));function getSeconds(_0x128c6a,_0x32bcf6){var _0x54e699=moment(_0x128c6a)[_0xe8d7('0x2')](0x0);var _0x5d4667=moment(_0x32bcf6)[_0xe8d7('0x2')](0x0);return _0x54e699[_0xe8d7('0x3')](_0x5d4667,_0xe8d7('0x4'));}function History(_0x3089ca){this['uniqueid']=_0x3089ca[_0xe8d7('0x5')];this['scheduledat']=_0x3089ca[_0xe8d7('0x6')]||undefined;this[_0xe8d7('0x7')]=_0x3089ca[_0xe8d7('0x7')];this[_0xe8d7('0x8')]=_0x3089ca[_0xe8d7('0x7')]==='outbound'?_0xe8d7('0x9'):_0x3089ca[_0xe8d7('0x7')];this[_0xe8d7('0xa')]=_0x3089ca[_0xe8d7('0xa')];this['countcongestionretry']=_0x3089ca[_0xe8d7('0xb')];this[_0xe8d7('0xc')]=_0x3089ca[_0xe8d7('0xc')];this[_0xe8d7('0xd')]=_0x3089ca[_0xe8d7('0xa')]+_0x3089ca['countcongestionretry']+_0x3089ca['countnoanswerretry']+_0x3089ca[_0xe8d7('0xe')]+_0x3089ca[_0xe8d7('0xf')]+_0x3089ca[_0xe8d7('0x10')]+_0x3089ca[_0xe8d7('0x11')]+_0x3089ca[_0xe8d7('0x12')];this[_0xe8d7('0xe')]=_0x3089ca[_0xe8d7('0xe')];this[_0xe8d7('0xf')]=_0x3089ca[_0xe8d7('0xf')];this['countabandonedretry']=_0x3089ca[_0xe8d7('0x10')];this[_0xe8d7('0x11')]=_0x3089ca['countmachineretry'];this['countagentrejectretry']=_0x3089ca[_0xe8d7('0x12')];this[_0xe8d7('0x9')]=_0x3089ca[_0xe8d7('0x9')];this['calleridname']=_0x3089ca[_0xe8d7('0x13')];this[_0xe8d7('0x14')]=_0x3089ca[_0xe8d7('0x15')];this['starttime']=_0x3089ca[_0xe8d7('0x16')];this[_0xe8d7('0x17')]=_0x3089ca[_0xe8d7('0x17')];this['endtime']=_0x3089ca[_0xe8d7('0x17')];this[_0xe8d7('0x18')]=getSeconds(_0x3089ca['responsetime'],_0x3089ca['starttime']);this[_0xe8d7('0x19')]=0x0;this[_0xe8d7('0x1a')]=0x0;this['callback']=_0x3089ca[_0xe8d7('0x1b')];this['callbackuniqueid']=_0x3089ca[_0xe8d7('0x1c')];this[_0xe8d7('0x1d')]=_0x3089ca[_0xe8d7('0x1d')];this[_0xe8d7('0x1e')]=_0x3089ca[_0xe8d7('0x1e')];this[_0xe8d7('0x1f')]=_0x3089ca['ContactId'];this[_0xe8d7('0x20')]=_0x3089ca[_0xe8d7('0x20')];this['UserId']=_0x3089ca[_0xe8d7('0x21')];this[_0xe8d7('0x22')]=_0x3089ca[_0xe8d7('0x22')];this['CampaignId']=_0x3089ca[_0xe8d7('0x23')];this[_0xe8d7('0x24')]=_0x3089ca[_0xe8d7('0x24')]||'';this[_0xe8d7('0x25')]=_0x3089ca[_0xe8d7('0x25')]||'';}module[_0xe8d7('0x26')]=History; \ No newline at end of file +var _0x2fe3=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x2fe3,0x187));var _0x32fe=function(_0x12fabf,_0xa88f60){_0x12fabf=_0x12fabf-0x0;var _0x288936=_0x2fe3[_0x12fabf];return _0x288936;};'use strict';var util=require(_0x32fe('0x0'));var _=require(_0x32fe('0x1'));var moment=require(_0x32fe('0x2'));function getSeconds(_0x2cd019,_0x42a438){var _0x28ee01=moment(_0x2cd019)[_0x32fe('0x3')](0x0);var _0x2552aa=moment(_0x42a438)[_0x32fe('0x3')](0x0);return _0x28ee01[_0x32fe('0x4')](_0x2552aa,_0x32fe('0x5'));}function History(_0x294ce8){this[_0x32fe('0x6')]=_0x294ce8[_0x32fe('0x6')];this[_0x32fe('0x7')]=_0x294ce8[_0x32fe('0x7')]||undefined;this[_0x32fe('0x8')]=_0x294ce8['type'];this['campaigntype']=_0x294ce8[_0x32fe('0x8')]===_0x32fe('0x9')?_0x32fe('0xa'):_0x294ce8[_0x32fe('0x8')];this[_0x32fe('0xb')]=_0x294ce8['countbusyretry'];this[_0x32fe('0xc')]=_0x294ce8[_0x32fe('0xc')];this[_0x32fe('0xd')]=_0x294ce8[_0x32fe('0xd')];this[_0x32fe('0xe')]=_0x294ce8[_0x32fe('0xb')]+_0x294ce8[_0x32fe('0xc')]+_0x294ce8['countnoanswerretry']+_0x294ce8[_0x32fe('0xf')]+_0x294ce8[_0x32fe('0x10')]+_0x294ce8['countabandonedretry']+_0x294ce8['countmachineretry']+_0x294ce8[_0x32fe('0x11')];this[_0x32fe('0xf')]=_0x294ce8[_0x32fe('0xf')];this[_0x32fe('0x10')]=_0x294ce8[_0x32fe('0x10')];this[_0x32fe('0x12')]=_0x294ce8[_0x32fe('0x12')];this[_0x32fe('0x13')]=_0x294ce8[_0x32fe('0x13')];this['countagentrejectretry']=_0x294ce8[_0x32fe('0x11')];this[_0x32fe('0xa')]=_0x294ce8[_0x32fe('0xa')];this[_0x32fe('0x14')]=_0x294ce8[_0x32fe('0x15')];this[_0x32fe('0x16')]=_0x294ce8[_0x32fe('0x17')];this[_0x32fe('0x18')]=_0x294ce8[_0x32fe('0x18')];this[_0x32fe('0x19')]=_0x294ce8['responsetime'];this[_0x32fe('0x1a')]=_0x294ce8[_0x32fe('0x19')];this[_0x32fe('0x1b')]=getSeconds(_0x294ce8['responsetime'],_0x294ce8[_0x32fe('0x18')]);this[_0x32fe('0x1c')]=0x0;this[_0x32fe('0x1d')]=0x0;this['callback']=_0x294ce8[_0x32fe('0x1e')];this['callbackuniqueid']=_0x294ce8[_0x32fe('0x1f')];this[_0x32fe('0x20')]=_0x294ce8[_0x32fe('0x20')];this[_0x32fe('0x21')]=_0x294ce8['recallme'];this[_0x32fe('0x22')]=_0x294ce8[_0x32fe('0x22')];this[_0x32fe('0x23')]=_0x294ce8[_0x32fe('0x23')];this[_0x32fe('0x24')]=_0x294ce8[_0x32fe('0x24')];this[_0x32fe('0x25')]=_0x294ce8[_0x32fe('0x25')];this[_0x32fe('0x26')]=_0x294ce8[_0x32fe('0x26')];this[_0x32fe('0x27')]=_0x294ce8['originatecalleridnum']||'';this[_0x32fe('0x28')]=_0x294ce8[_0x32fe('0x28')]||'';}module[_0x32fe('0x29')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 236a375..4c3fc4e 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 _0x53fb=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\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','predictiveIntervalTotalCalls','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','isNil','status','channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','resolve','catch','[countReScheduled]\x20','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','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ListId','UserId','[emptyContact]','Success','active','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','CampaignId','HANGUP','[syncHangupInAMDIvr]','countagentrejectretry','reason19\x20machine....','createStateFinal','ContactId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','AGI','dialQueueProject','Unknow','[syncHangupIvr][createHistory]','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','rrmemory','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','content','indexOf','true','push','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','[syncCampaigns]','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','countReScheduled','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','md5','ioredis','../preview/util/util','../../../config/environment/','booked','../../../config/logger','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/setting','./final','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod'];(function(_0x28ba9e,_0x1e8204){var _0x18c3cb=function(_0x2cf51b){while(--_0x2cf51b){_0x28ba9e['push'](_0x28ba9e['shift']());}};_0x18c3cb(++_0x1e8204);}(_0x53fb,0x1cb));var _0xb53f=function(_0x1d678d,_0x247444){_0x1d678d=_0x1d678d-0x0;var _0x245c22=_0x53fb[_0x1d678d];return _0x245c22;};'use strict';var util=require(_0xb53f('0x0'));var _=require(_0xb53f('0x1'));var BPromise=require(_0xb53f('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xb53f('0x3'));var Redis=require(_0xb53f('0x4'));var ut=require(_0xb53f('0x5'));var config=require(_0xb53f('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require('../../../config/logger')(_0xb53f('0x7'));var loggerPredictive=require(_0xb53f('0x8'))('predictive');var loggerPredictiveCalls=require(_0xb53f('0x8'))(_0xb53f('0x9'));var loggerSyncQueueSummary=require(_0xb53f('0x8'))('syncQueueSummary');var ami=require(_0xb53f('0xa'));config[_0xb53f('0xb')]=_[_0xb53f('0xc')](config['redis'],{'host':_0xb53f('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb53f('0xb')]));var cmHopper=require(_0xb53f('0xe'));var cmHopperHistory=require(_0xb53f('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xb53f('0x10'));var Action=require('./action');var History=require('./history');var Final=require(_0xb53f('0x11'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xb53f('0x12'));var ipAgi=process[_0xb53f('0x13')][_0xb53f('0x14')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0xb53f('0x15')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xb53f('0x16')]['enqueue']=function(_0x11a317){this[_0xb53f('0x17')]=this['tail']?this[_0xb53f('0x17')][_0xb53f('0x18')](_0x11a317):_0x11a317();};function Dialer(_0x13f4a4,_0x2d20af){this['sequence']=new Sequence();this['preview']=_0x2d20af;this['voiceQueues']=_0x13f4a4[_0xb53f('0x19')];this[_0xb53f('0x1a')]=_0x13f4a4[_0xb53f('0x1a')];this[_0xb53f('0x1b')]=_0x13f4a4[_0xb53f('0x1b')];this[_0xb53f('0x1c')]=_0x13f4a4['trunks'];this[_0xb53f('0x1d')]=config[_0xb53f('0x1d')]||0x2;this[_0xb53f('0x1e')]={};this[_0xb53f('0x1f')]={};this[_0xb53f('0x20')]={};this[_0xb53f('0x21')]={};this[_0xb53f('0x22')]={};this['startPredictive']={};this[_0xb53f('0x23')]={};this[_0xb53f('0x24')]={};this[_0xb53f('0x25')]={};this[_0xb53f('0x26')]={};ami['on'](_0xb53f('0x27'),this[_0xb53f('0x28')][_0xb53f('0x29')](this));ami['on']('queuecallerabandon',this[_0xb53f('0x2a')]['bind'](this));ami['on'](_0xb53f('0x2b'),this[_0xb53f('0x2c')]['bind'](this));ami['on'](_0xb53f('0x2d'),this[_0xb53f('0x2e')][_0xb53f('0x29')](this));ami['on'](_0xb53f('0x2f'),this[_0xb53f('0x30')][_0xb53f('0x29')](this));ami['on'](_0xb53f('0x31'),this['syncHangup'][_0xb53f('0x29')](this));ami['on'](_0xb53f('0x32'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xb53f('0x33')][_0xb53f('0x29')](this));ami['on'](_0xb53f('0x34'),this[_0xb53f('0x35')]['bind'](this));ami['on'](_0xb53f('0x36'),this[_0xb53f('0x37')][_0xb53f('0x29')](this));this['loopCampaigns']();this[_0xb53f('0x38')]();RpcSetting[_0xb53f('0x39')]()[_0xb53f('0x3a')](function(_0xa728af){previewRecallmeReminderInterval=_0xa728af['previewRecallmeReminderInterval'];});}function isNotNull(_0x4515d9){return _0x4515d9!==null&&!_[_0xb53f('0x3b')](_0x4515d9);}function checkIsLoggedIn(_0x2fa7f1,_0x237de1){return function(){if(_0x237de1<=0x0){_0x2fa7f1[_0xb53f('0x3c')]='AGENTS_NOT_LOGGED';throw _0x2fa7f1['name']+_0xb53f('0x3d');}};}function isActive(_0x246086){return _0x246086;}function checkIsActive(_0x48d49f,_0x449db7){return function(){if(!isActive(_0x449db7)){_0x48d49f['message']=_0xb53f('0x3e');throw _0x48d49f[_0xb53f('0x3f')]+_0xb53f('0x40');}};}function checkInterval(_0x469f41){return function(){if(!isNotNull(_0x469f41[_0xb53f('0x41')])){_0x469f41[_0xb53f('0x3c')]=_0xb53f('0x42');throw _0x469f41[_0xb53f('0x3f')]+_0xb53f('0x43');}if(!isNotNull(_0x469f41[_0xb53f('0x41')][_0xb53f('0x44')])){_0x469f41[_0xb53f('0x3c')]=_0xb53f('0x42');throw _0x469f41[_0xb53f('0x3f')]+_0xb53f('0x43');}if(!isNotNull(_[_0xb53f('0x45')](_0x469f41[_0xb53f('0x41')][_0xb53f('0x44')]))){_0x469f41['message']=_0xb53f('0x42');throw _0x469f41[_0xb53f('0x3f')]+_0xb53f('0x43');}};}function msgResponse(_0x4190a4,_0x4c45ea,_0xbecd37){return{'action':_0x4190a4,'response':_0x4c45ea,'message':_0xbecd37,'stack':_0xbecd37};}function myreject(_0x1e931f){return function(_0x4e9509){return _0x1e931f(msgResponse(_0xb53f('0x46'),_0xb53f('0x47'),JSON['stringify'](_0x4e9509)));};}function getSeconds(_0x143300,_0x12fe55){var _0x541ac6=moment(_0x143300)[_0xb53f('0x48')](0x0);var _0x41a63f=moment(_0x12fe55)['milliseconds'](0x0);return _0x541ac6['diff'](_0x41a63f,_0xb53f('0x49'));}function emit(_0x3db239,_0x294910,_0x431d66){io['to'](_0x3db239)[_0xb53f('0x4a')](_0x294910,_0x431d66);}function emitVoiceQueueSummary(_0x39b06c){if(_0x39b06c[_0xb53f('0x4b')]===_0xb53f('0x4c')){var _0x5bc3c5={'id':_0x39b06c['id'],'name':_0x39b06c[_0xb53f('0x3f')],'strategy':_0x39b06c[_0xb53f('0x4d')],'answered':_0x39b06c[_0xb53f('0x4e')],'available':_0x39b06c[_0xb53f('0x4f')],'loggedIn':_0x39b06c[_0xb53f('0x50')],'pTalking':_0x39b06c['pTalking'],'sumBillable':_0x39b06c['sumBillable'],'sumDuration':_0x39b06c['sumDuration'],'sumHoldTime':_0x39b06c[_0xb53f('0x51')]||0x0,'talking':_0x39b06c[_0xb53f('0x52')],'total':_0x39b06c['total'],'type':_0x39b06c[_0xb53f('0x4b')],'unmanaged':_0x39b06c[_0xb53f('0x53')],'abandoned':_0x39b06c[_0xb53f('0x54')],'waiting':_0x39b06c[_0xb53f('0x55')],'loggedInDb':_0x39b06c['loggedInDb'],'dialActive':_0x39b06c[_0xb53f('0x56')],'dialMethod':_0x39b06c[_0xb53f('0x57')],'dialOriginateCallerIdName':_0x39b06c[_0xb53f('0x58')],'dialOriginateCallerIdNumber':_0x39b06c[_0xb53f('0x59')],'dialOriginateTimeout':_0x39b06c[_0xb53f('0x5a')],'dialPrefix':_0x39b06c['dialPrefix'],'outboundAnswerAgiCallsDay':_0x39b06c[_0xb53f('0x5b')],'outboundAnswerCallsDay':_0x39b06c[_0xb53f('0x5c')],'outboundBlacklistCallsDay':_0x39b06c[_0xb53f('0x5d')],'outboundBusyCallsDay':_0x39b06c[_0xb53f('0x5e')],'outboundCongestionCallsDay':_0x39b06c[_0xb53f('0x5f')],'outboundDropCallsDayACS':_0x39b06c[_0xb53f('0x60')],'outboundDropCallsDayCallersExit':_0x39b06c[_0xb53f('0x61')],'outboundDropCallsDayTimeout':_0x39b06c['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x39b06c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x39b06c[_0xb53f('0x62')],'outboundOriginateFailureCallsDay':_0x39b06c['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x39b06c['outboundReCallsDay'],'outboundRejectCallsDay':_0x39b06c[_0xb53f('0x63')],'outboundUnknownCallsDay':_0x39b06c[_0xb53f('0x64')],'predictiveIntervalAnsweredCalls':_0x39b06c[_0xb53f('0x65')],'predictiveIntervalAvgHoldtime':_0x39b06c[_0xb53f('0x66')],'predictiveIntervalAvgTalktime':_0x39b06c[_0xb53f('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x39b06c[_0xb53f('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x39b06c[_0xb53f('0x69')],'predictiveIntervalErlangCalls':_0x39b06c[_0xb53f('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x39b06c[_0xb53f('0x6b')],'predictiveIntervalHitRate':_0x39b06c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x39b06c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x39b06c[_0xb53f('0x6c')],'predictiveIntervalAvailable':_0x39b06c[_0xb53f('0x6d')],'predictiveIntervalTotalCalls':_0x39b06c['predictiveIntervalTotalCalls'],'message':_0x39b06c[_0xb53f('0x3c')],'originated':_0x39b06c[_0xb53f('0x6e')],'erlangCalls':_0x39b06c[_0xb53f('0x6f')],'erlangCallToSecond':_0x39b06c[_0xb53f('0x70')],'erlangAbandonmentRate':_0x39b06c[_0xb53f('0x71')],'erlangBusyFactor':_0x39b06c[_0xb53f('0x72')],'startPredictive':_0x39b06c[_0xb53f('0x73')],'startProgressive':_0x39b06c[_0xb53f('0x23')]};if(_0x39b06c[_0xb53f('0x74')]){_0x5bc3c5['Trunk']={'id':_0x39b06c['Trunk']['id'],'name':_0x39b06c['Trunk'][_0xb53f('0x3f')],'active':_0x39b06c[_0xb53f('0x74')]['active'],'callerid':_0x39b06c[_0xb53f('0x74')][_0xb53f('0x75')]};}if(_0x39b06c[_0xb53f('0x41')]){_0x5bc3c5[_0xb53f('0x41')]={'id':_0x39b06c['Interval']['id'],'name':_0x39b06c[_0xb53f('0x41')][_0xb53f('0x3f')]};}var _0x69ea62=md5(JSON[_0xb53f('0x76')](_0x5bc3c5));if(_0x39b06c['md5']!==_0x69ea62){_0x39b06c[_0xb53f('0x3')]=_0x69ea62;emit(util[_0xb53f('0x77')](_0xb53f('0x78'),_0x5bc3c5['name']),_0xb53f('0x79'),_0x5bc3c5);}}}function emitCampaignSummary(_0x43c8da){if(_0x43c8da[_0xb53f('0x4b')]===_0xb53f('0x7a')){emit(util[_0xb53f('0x77')]('campaign:ivr:%s',_0x43c8da[_0xb53f('0x3f')]),_0xb53f('0x7b'),_0x43c8da);}}function checkGetDataPredictive(_0x404493){if(isNotNull(_0x404493)&&!_[_0xb53f('0x45')](_0x404493)){loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x7d'));loggerPredictive[_0xb53f('0x7c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x404493['predictiveIntervalTotalCalls']);loggerPredictive[_0xb53f('0x7c')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x404493[_0xb53f('0x65')]);loggerPredictive[_0xb53f('0x7c')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x404493[_0xb53f('0x69')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x404493['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0xb53f('0x7e'),_0x404493['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0xb53f('0x7f'),_0x404493[_0xb53f('0x67')]);loggerPredictive[_0xb53f('0x7c')]('---------------------------');if(_0x404493[_0xb53f('0x80')]>0x0){if(!_[_0xb53f('0x3b')](_0x404493[_0xb53f('0x67')])&&_0x404493[_0xb53f('0x67')]>0x0){return!![];}loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x81'));if(!_['isUndefined'](_0x404493[_0xb53f('0x66')])&&_0x404493['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0xb53f('0x82'));}else{loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x83'));}}else{loggerPredictive['info'](_0xb53f('0x84'));}return![];}function mergeDataErlangB(_0x48b460){return function(_0x23f347){loggerPredictive['info'](_0xb53f('0x85'));loggerPredictive['info'](_0xb53f('0x86'),_0x23f347[_0xb53f('0x6f')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23f347[_0xb53f('0x70')]);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x87'),_0x23f347[_0xb53f('0x71')]);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x88'),_0x23f347['erlangBusyFactor']);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x87'),_0x23f347['erlangAbandonmentRate']);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x89'));_['merge'](_0x48b460,_0x23f347);};}function getDiff(_0x32a723){var _0x7672a8=moment()['milliseconds'](0x0);var _0x869d3b=moment(_0x32a723)['milliseconds'](0x0);return _0x7672a8['diff'](_0x869d3b,_0xb53f('0x49'));}function ifInterval(_0xf34882,_0x2074f8){if(_[_0xb53f('0x3b')](_0x2074f8)){return![];}return getDiff(_0x2074f8)<_0xf34882*0x3c;}function freeVariablesPredictive(_0x64f127){if(isNotNull(_0x64f127)){if(!_[_0xb53f('0x3b')](_0x64f127[_0xb53f('0x23')])){_0x64f127[_0xb53f('0x23')]=undefined;loggerPredictive[_0xb53f('0x7c')](_0x64f127[_0xb53f('0x3f')],_0xb53f('0x8a'));}if(!_[_0xb53f('0x3b')](_0x64f127[_0xb53f('0x73')])){_0x64f127[_0xb53f('0x73')]=undefined;loggerPredictive['info'](_0x64f127[_0xb53f('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xb53f('0x3b')](_0x64f127[_0xb53f('0x8b')])){clearInterval(_0x64f127[_0xb53f('0x8b')]);_0x64f127['handlePredictive']=undefined;loggerPredictive[_0xb53f('0x7c')](_0x64f127['name'],_0xb53f('0x8c'));}}}function erlangb(_0xa63c1c,_0x24a422){if(_0x24a422===0x0){return 0x0;}var _0x1d9038=0x1;for(var _0x212b5b=0x1;_0x212b5b<=_0x24a422;_0x212b5b+=0x1){_0x1d9038=0x1+_0x1d9038*_0x212b5b/_0xa63c1c;}return 0x1/_0x1d9038;}function isVoiceQueueOutbound(_0x12dc5f){return _0x12dc5f==='outbound';}function isNotPreview(_0x554cea){return _0x554cea!==_0xb53f('0x8d');}function isCampaignIvr(_0x352078){return _0x352078===_0xb53f('0x7a');}function getCallerId(_0x4908b2,_0x18d96c,_0x4e80cf){if(!_[_0xb53f('0x3b')](_0x4e80cf)&&typeof _0x4e80cf==='string'&&!_['isEmpty'](_0x4e80cf)){if(!_[_0xb53f('0x3b')](_0x18d96c)&&typeof _0x18d96c===_0xb53f('0x8e')&&!_[_0xb53f('0x45')](_0x18d96c)){return util[_0xb53f('0x77')](_0xb53f('0x8f'),_0x18d96c,_0x4e80cf);}return util['format']('\x22%s\x22\x20<%s>',_0x4e80cf,_0x4e80cf);}if(!_[_0xb53f('0x3b')](_0x4908b2)&&typeof _0x4908b2===_0xb53f('0x8e')&&!_[_0xb53f('0x45')](_0x4908b2)){return _0x4908b2;}return _0xb53f('0x90');}function loggerCatchQueueSummary(_0x1dd559,_0x46e9ea){return function(_0x153f3a){freeVariablesPredictive(_0x46e9ea);emitVoiceQueueSummary(_0x46e9ea);emitCampaignSummary(_0x46e9ea);loggerSyncQueueSummary[_0xb53f('0x91')](_0x1dd559,util['inspect'](_0x153f3a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x338c4f,_0x4b8ca9){return function(_0xcc881a){loggerPredictive['error'](_0x4b8ca9[_0xb53f('0x3f')],_0x338c4f);loggerPredictive[_0xb53f('0x91')](_0xcc881a[_0xb53f('0x92')]);freeVariablesPredictive(_0x4b8ca9);};}function loggerCatch(_0x1476de){return function(_0x29a8fb){logger[_0xb53f('0x91')](_0x1476de,util[_0xb53f('0x93')](_0x29a8fb,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5ad5e1){return _0x5ad5e1&&!_[_0xb53f('0x3b')](_0x5ad5e1)&&_0x5ad5e1[_0xb53f('0x94')]>0x0;}function decremetOriginate(_0x27fcff){if(!_[_0xb53f('0x3b')](_0x27fcff)&&_0x27fcff!==null){if(typeof _0x27fcff[_0xb53f('0x6e')]!==_0xb53f('0x95')){if(_0x27fcff['originated']>0x0){_0x27fcff['originated']-=0x1;}else{logger[_0xb53f('0x91')](_0xb53f('0x96'));}}}else{logger[_0xb53f('0x91')](_0xb53f('0x97'));}}function checkContactLowerLimitOriginate(_0x435b6f,_0xad2f08,_0x22815d){if(_0xad2f08>_0x22815d){for(var _0x377415=0x0;_0x377415<_0xad2f08-_0x22815d;_0x377415+=0x1){decremetOriginate(_0x435b6f);}}}function loggerGetContactDialer(_0x516b69,_0x3406ff,_0x2160dd){return function(_0x3fdeee){checkContactLowerLimitOriginate(_0x3406ff,_0x2160dd,0x0);logger[_0xb53f('0x91')](_0x516b69,util[_0xb53f('0x93')](_0x3fdeee,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4ea5e7){return function(_0x51393e){if(isNotNull(_0x51393e)&&isNotNull(_0x51393e[0x0])){if(_0x51393e[0x0]['contactsRescheduled']>0x0){_0x4ea5e7['message']=_0xb53f('0x98');logger['info']('[getContactDialer2][ReScheduled]'+_0x4ea5e7[_0xb53f('0x3f')],_0x51393e[0x0][_0xb53f('0x99')],_0xb53f('0x9a'));}else{_0x4ea5e7['message']=_0xb53f('0x9b');logger[_0xb53f('0x7c')](_0xb53f('0x9c')+_0x4ea5e7[_0xb53f('0x3f')]);}}};}function notSendMessagesQueue(_0xf042f4){if(_0xf042f4[_0xb53f('0x9d')]){freeVariablesPredictive(_0xf042f4);if(_0xf042f4['originated']===0x0&&_0xf042f4['talking']===0x0&&_0xf042f4[_0xb53f('0x55')]===0x0&&(_0xf042f4[_0xb53f('0x9e')]||0x0)===0x0){_0xf042f4['sendMessageOneNotActive']=![];_0xf042f4[_0xb53f('0x4f')]=0x0;_0xf042f4[_0xb53f('0x3c')]=_0xb53f('0x3e');loggerSyncQueueSummary[_0xb53f('0x91')](_0xb53f('0x9f'),_0xf042f4[_0xb53f('0x3f')],_0xb53f('0xa0'));}else{_0xf042f4[_0xb53f('0x3c')]=_0xb53f('0xa1');loggerSyncQueueSummary[_0xb53f('0x91')](_0xb53f('0x9f'),_0xf042f4['name'],_0xb53f('0xa2'));}emitVoiceQueueSummary(_0xf042f4);}}function notSendMessagesCampaign(_0x3a4763){if(_0x3a4763['sendMessageOneNotActive']){if(_0x3a4763['originated']===0x0){_0x3a4763[_0xb53f('0x9d')]=![];_0x3a4763[_0xb53f('0x3c')]=_0xb53f('0x3e');loggerSyncQueueSummary['error'](_0xb53f('0xa3'),_0x3a4763['name'],'is\x20not\x20active');}else{_0x3a4763[_0xb53f('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xb53f('0x91')](_0xb53f('0xa3'),_0x3a4763['name'],_0xb53f('0xa2'));}emitCampaignSummary(_0x3a4763);}}function createObjHistory(_0x3d3d30,_0x581828,_0x55f4cc,_0x578fcc,_0x567c72){_0x3d3d30['message']=_0x55f4cc;var _0x16058c=new Action(_0x3d3d30,_0x581828);var _0x562dae=new History(_0x16058c);_0x562dae[_0xb53f('0xa4')]=_0x578fcc;_0x562dae[_0xb53f('0xa5')]=_0x567c72;_0x562dae[_0xb53f('0xa6')]=_0x16058c[_0xb53f('0xa7')];return _0x562dae;}Dialer[_0xb53f('0x16')][_0xb53f('0x38')]=function(){var _0x1617ec=this;setInterval(function(){_0x1617ec[_0xb53f('0xa8')](_0x1617ec[_0xb53f('0x21')],_0xb53f('0xa9'));_0x1617ec[_0xb53f('0xa8')](_0x1617ec[_0xb53f('0x1f')],_0xb53f('0xaa'));},0x32c8);};Dialer[_0xb53f('0x16')]['clearZombieChannels']=function(_0x6cbbf8,_0x15cc16){var _0x18868b=this;for(var _0x20593f in _0x6cbbf8){if(typeof _0x6cbbf8[_0x20593f]!=='undefined'){this[_0xb53f('0xab')][_0xb53f('0xac')](function(){if(!_[_0xb53f('0xad')](_0x6cbbf8[_0x20593f])){return ami['Action']({'action':_0xb53f('0xae'),'channel':_0x6cbbf8[_0x20593f][_0xb53f('0xaf')]})['catch'](function(_0x26cf58){if(_0x26cf58[_0xb53f('0x3c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x6cbbf8[_0x20593f]&&_0x6cbbf8[_0x20593f][_0xb53f('0x4b')]!==_0xb53f('0x7a')){_0x18868b[_0xb53f('0xb0')](_0x18868b[_0xb53f('0x19')][_0x6cbbf8[_0x20593f]['queue']]);logger[_0xb53f('0x91')](_0xb53f('0xb1'),_0x15cc16,_0x20593f,_0x6cbbf8[_0x20593f][_0xb53f('0xb2')]);delete _0x6cbbf8[_0x20593f];}if(_0x6cbbf8[_0x20593f]&&_0x6cbbf8[_0x20593f][_0xb53f('0x4b')]==='ivr'){_0x18868b[_0xb53f('0xb0')](_0x18868b['campaigns'][_0x6cbbf8[_0x20593f][_0xb53f('0xb2')]]);logger['error'](_0xb53f('0xb3'),_0x15cc16,_0x20593f,_0x6cbbf8[_0x20593f]['queue']);delete _0x6cbbf8[_0x20593f];}},0x2328);}});}});}}};Dialer[_0xb53f('0x16')]['countReScheduled']=function(_0x4d10dc){return BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](cmHopper['countReScheduled'](_0x4d10dc))[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xb6')));};Dialer['prototype'][_0xb53f('0xb7')]=function(_0x4c2109){return BPromise['resolve']()['then'](cmHopperBlack[_0xb53f('0xb7')](_0x4c2109))[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xb8')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x3740b8){return BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](cmHopperBlack[_0xb53f('0xb9')](_0x3740b8))[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xba')));};Dialer[_0xb53f('0x16')][_0xb53f('0xbb')]=function(_0x4cdcba){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopperHistory['avgHandleTime'](_0x4cdcba))[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xbc')));};Dialer[_0xb53f('0x16')][_0xb53f('0xbd')]=function(_0x571030){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopper['rescheduleContact'](_0x571030))[_0xb53f('0xb5')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xb53f('0x16')][_0xb53f('0xbe')]=function(_0x7d229d,_0x788413,_0x164bb6){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopper[_0xb53f('0xbe')](_0x7d229d,_0x788413,_0x164bb6))[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xbf')));};Dialer[_0xb53f('0x16')][_0xb53f('0xc0')]=function(_0x544113,_0x1557a4,_0x15444e,_0x3dee9e,_0xe2ed6e){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopper[_0xb53f('0xc0')](_0x544113,_0x1557a4,_0x15444e,_0x3dee9e))[_0xb53f('0xb5')](function(_0x150fce){_0xe2ed6e[_0xb53f('0xc1')]-=_0x15444e;_0xe2ed6e[_0xb53f('0xc1')]=_0xe2ed6e[_0xb53f('0xc1')]>0x0?_0xe2ed6e[_0xb53f('0xc1')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x150fce);});};Dialer['prototype']['getContactDialerIvr']=function(_0x529449,_0x31bf6f,_0x1bcf7f,_0x3be49b){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopper[_0xb53f('0xc2')](_0x529449,_0x31bf6f,_0x1bcf7f))[_0xb53f('0xb5')](function(_0x8678f){_0x3be49b[_0xb53f('0xc1')]-=_0x31bf6f;_0x3be49b[_0xb53f('0xc1')]=_0x3be49b[_0xb53f('0xc1')]>0x0?_0x3be49b[_0xb53f('0xc1')]:0x0;loggerCatch(_0xb53f('0xc3'))(_0x8678f);});};Dialer[_0xb53f('0x16')][_0xb53f('0xc4')]=function(_0x4df81d){return BPromise[_0xb53f('0xb4')]()['then'](voiceQueueRt[_0xb53f('0xc4')](_0x4df81d))['catch'](loggerCatch(_0xb53f('0xc5')));};Dialer['prototype'][_0xb53f('0xc6')]=function(_0x247c0a){return BPromise['resolve']()[_0xb53f('0x3a')](cmHopper['moveContactManagedDialer'](_0x247c0a))['catch'](loggerCatch(_0xb53f('0xc7')));};Dialer['prototype'][_0xb53f('0xc8')]=function(_0x52e30a){return BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](cmHopperHistory[_0xb53f('0xc8')](_0x52e30a))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0xb53f('0xb0')]=function(_0x7043f){if(!_[_0xb53f('0x3b')](_0x7043f)&&_0x7043f!==null){if(typeof _0x7043f[_0xb53f('0x6e')]!==_0xb53f('0x95')){if(_0x7043f['originated']>0x0){_0x7043f[_0xb53f('0x6e')]-=0x1;}else{logger[_0xb53f('0x91')](_0xb53f('0xc9'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xb53f('0x16')][_0xb53f('0xca')]=function(_0x3b7970,_0x1d9479){var _0x2d58a5=this;return function(_0x39375d){_0x2d58a5[_0xb53f('0xb0')](_0x1d9479);logger[_0xb53f('0x91')](_0x3b7970,util[_0xb53f('0x93')](_0x39375d,{'showHidden':![],'depth':null}));};};Dialer[_0xb53f('0x16')][_0xb53f('0xcb')]=function(_0x4ce137,_0x3cb39d,_0x40d729){var _0xa280b8={'state':0x19,'statedesc':_0xb53f('0xcc')};this[_0xb53f('0xb0')](_0x3cb39d);this[_0xb53f('0xcd')](_[_0xb53f('0xce')](_0xa280b8,_[_0xb53f('0xcf')](_0x40d729,['ContactId',_0xb53f('0xd0'),_0xb53f('0xd1'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0xb53f('0xd2'));logger['error'](_0x4ce137);};Dialer[_0xb53f('0x16')]['isSuccess']=function(_0x5c18dc){return _0x5c18dc===_0xb53f('0xd3');};Dialer[_0xb53f('0x16')]['isTrunkReachable']=function(_0x5ced4c){return!_['isUndefined'](_0x5ced4c)&&_0x5ced4c&&!_[_0xb53f('0x3b')](_0x5ced4c[_0xb53f('0x3f')])&&!_['isUndefined'](_0x5ced4c[_0xb53f('0xd4')])&&_0x5ced4c['active']&&(this[_0xb53f('0x1c')][util[_0xb53f('0x77')](_0xb53f('0xd5'),_0x5ced4c[_0xb53f('0x3f')])][_0xb53f('0xae')]===_0xb53f('0xd6')||this[_0xb53f('0x1c')][util[_0xb53f('0x77')](_0xb53f('0xd5'),_0x5ced4c[_0xb53f('0x3f')])][_0xb53f('0xae')]===_0xb53f('0xd7'));};Dialer[_0xb53f('0x16')][_0xb53f('0xcd')]=function(_0x1c69fb,_0x459ace,_0x11f725){this[_0xb53f('0xc8')](_0x1c69fb)['catch'](loggerCatch(_0x459ace));this[_0xb53f('0xc6')](_0x1c69fb)[_0xb53f('0xb5')](loggerCatch(_0x11f725));};Dialer['prototype']['syncVarSet']=function(_0x563492){var _0x3b0ce8=this[_0xb53f('0x21')][_0x563492[_0xb53f('0xd8')]];var _0x39331f;if(!_[_0xb53f('0xad')](_0x563492)&&!_[_0xb53f('0xad')](_0x563492[_0xb53f('0xd9')])&&!_[_0xb53f('0xad')](_0x563492[_0xb53f('0xd9')]['amdstatus'])&&_0x563492[_0xb53f('0xda')]===_0xb53f('0xdb')&&_0x3b0ce8){if(_0x3b0ce8['type']!==_0xb53f('0x7a')&&this[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0xdc')]&&_0x563492[_0xb53f('0xdd')]==='HANGUP'){delete this['uniqueId'][_0x563492['uniqueid']];this[_0xb53f('0xb0')](this[_0xb53f('0x19')][_0x3b0ce8['queue']]);this[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0x5c')]+=0x1;this[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0x5b')]+=0x1;_0x39331f=new Hangup(_0x3b0ce8,_0x563492);_0x39331f[_0xb53f('0xa4')]=0x12;_0x39331f['statedesc']=_0xb53f('0xde');_0x39331f[_0xb53f('0xdf')]=_0xb53f('0xe0');ami[_0xb53f('0x4a')]('custom:amd',ut[_0xb53f('0xe1')](_0x39331f,_0xb53f('0xe2')));this[_0xb53f('0xcd')](_0x39331f,_0xb53f('0xe3'),_0xb53f('0xe4'));}if(_0x3b0ce8[_0xb53f('0x4b')]!=='ivr'&&this[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0xdc')]&&_0x563492[_0xb53f('0xdd')]===_0xb53f('0xe5')){var _0x5b5412=this;return new BPromise(function(_0x5062ec,_0x2f0d6d){delete _0x5b5412[_0xb53f('0x21')][_0x563492[_0xb53f('0xd8')]];_0x5b5412[_0xb53f('0xb0')](_0x5b5412[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]]);_0x5b5412['voiceQueues'][_0x3b0ce8['queue']]['outboundAnswerCallsDay']+=0x1;_0x5b5412['voiceQueues'][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0x5b')]+=0x1;var _0x5a604d=_0x5b5412[_0xb53f('0x19')][_0x3b0ce8[_0xb53f('0xb2')]];var _0x326a27=new Hangup(_0x3b0ce8,_0x563492);_0x326a27[_0xb53f('0xa4')]=0x13;_0x326a27[_0xb53f('0xa5')]=_0xb53f('0xe6');_0x326a27[_0xb53f('0xdf')]=_0xb53f('0xe0');_0x326a27['countmachineretry']+=0x1;_0x326a27[_0xb53f('0xe7')]+=0x1;_0x326a27[_0xb53f('0xe2')]=!![];ami[_0xb53f('0x4a')](_0xb53f('0xe8'),ut[_0xb53f('0xe1')](_0x326a27,_0xb53f('0xe2')));_0x5b5412[_0xb53f('0xc8')](_0x326a27)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xe9')));if(_0x326a27[_0xb53f('0xea')]+_0x326a27[_0xb53f('0xeb')]+_0x326a27[_0xb53f('0xec')]+_0x326a27[_0xb53f('0xed')]+_0x326a27[_0xb53f('0xee')]+_0x326a27[_0xb53f('0xef')]+_0x326a27[_0xb53f('0xf0')]+_0x326a27['countagentrejectretry']>=_0x5a604d[_0xb53f('0xf1')]){_0x5b5412[_0xb53f('0xf2')](_0x326a27,_0x5062ec,_0x2f0d6d,'reason19\x20machine....');}else{if(_0x326a27[_0xb53f('0xf0')]>=_0x5a604d[_0xb53f('0xf3')]){_0x5b5412['createStateFinal'](_0x326a27,_0x5062ec,_0x2f0d6d,_0xb53f('0xf4'));}else{_0x5b5412[_0xb53f('0xbd')]({'active':![],'countmachineretry':_0x326a27[_0xb53f('0xf0')],'scheduledat':moment()[_0xb53f('0xf5')](_0x5a604d[_0xb53f('0xf6')],_0xb53f('0xf7'))['format'](_0xb53f('0xf8')),'ContactId':_0x326a27['ContactId'],'ListId':_0x326a27[_0xb53f('0xd0')],'VoiceQueueId':_0x326a27[_0xb53f('0xf9')]||undefined,'CampaignId':_0x326a27[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x5062ec({'reschedule':0x1});}}});}if(_0x3b0ce8[_0xb53f('0x4b')]==='ivr'&&this[_0xb53f('0x1a')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0xdc')]&&_0x563492['value']===_0xb53f('0xfb')){delete this[_0xb53f('0x21')][_0x563492[_0xb53f('0xd8')]];this[_0xb53f('0xb0')](this[_0xb53f('0x1a')][_0x3b0ce8['queue']]);_0x39331f=new Hangup(_0x3b0ce8,_0x563492);_0x39331f[_0xb53f('0xa4')]=0x12;_0x39331f[_0xb53f('0xa5')]='HangupInAMD';_0x39331f[_0xb53f('0xdf')]='AMD';ami[_0xb53f('0x4a')](_0xb53f('0xe8'),ut[_0xb53f('0xe1')](_0x39331f,_0xb53f('0xe2')));this[_0xb53f('0xcd')](_0x39331f,'[syncHangupInAMDIvr][createHistory]',_0xb53f('0xfc'));}if(_0x3b0ce8[_0xb53f('0x4b')]===_0xb53f('0x7a')&&this[_0xb53f('0x1a')][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0xdc')]&&_0x563492[_0xb53f('0xdd')]===_0xb53f('0xe5')){var _0x5b5412=this;return new BPromise(function(_0x4ead50,_0x342ff3){delete _0x5b5412[_0xb53f('0x21')][_0x563492[_0xb53f('0xd8')]];_0x5b5412[_0xb53f('0xb0')](_0x5b5412[_0xb53f('0x1a')][_0x3b0ce8[_0xb53f('0xb2')]]);_0x5b5412['campaigns'][_0x3b0ce8['queue']][_0xb53f('0x5c')]+=0x1;_0x5b5412['campaigns'][_0x3b0ce8[_0xb53f('0xb2')]][_0xb53f('0x5b')]+=0x1;var _0x302930=_0x5b5412['campaigns'][_0x3b0ce8['queue']];var _0x4e32b1=new Hangup(_0x3b0ce8,_0x563492);_0x4e32b1[_0xb53f('0xa4')]=0x13;_0x4e32b1[_0xb53f('0xa5')]=_0xb53f('0xe6');_0x4e32b1[_0xb53f('0xdf')]=_0xb53f('0xe0');_0x4e32b1[_0xb53f('0xf0')]+=0x1;_0x4e32b1[_0xb53f('0xe7')]+=0x1;_0x4e32b1[_0xb53f('0xe2')]=!![];ami[_0xb53f('0x4a')]('custom:amd',ut[_0xb53f('0xe1')](_0x4e32b1,_0xb53f('0xe2')));_0x5b5412[_0xb53f('0xc8')](_0x4e32b1)['catch'](loggerCatch(_0xb53f('0xe9')));if(_0x4e32b1[_0xb53f('0xea')]+_0x4e32b1['countcongestionretry']+_0x4e32b1[_0xb53f('0xec')]+_0x4e32b1['countnosuchnumberretry']+_0x4e32b1[_0xb53f('0xee')]+_0x4e32b1[_0xb53f('0xef')]+_0x4e32b1[_0xb53f('0xf0')]+_0x4e32b1[_0xb53f('0xfd')]>=_0x302930[_0xb53f('0xf1')]){_0x5b5412['stateGlobal'](_0x4e32b1,_0x4ead50,_0x342ff3,_0xb53f('0xfe'));}else{if(_0x4e32b1['countmachineretry']>=_0x302930['dialMachineMaxRetry']){_0x5b5412[_0xb53f('0xff')](_0x4e32b1,_0x4ead50,_0x342ff3,_0xb53f('0xf4'));}else{_0x5b5412[_0xb53f('0xbd')]({'active':![],'countmachineretry':_0x4e32b1[_0xb53f('0xf0')],'scheduledat':moment()[_0xb53f('0xf5')](_0x302930['dialMachineRetryFrequency'],'minutes')['format'](_0xb53f('0xf8')),'ContactId':_0x4e32b1[_0xb53f('0x100')],'ListId':_0x4e32b1[_0xb53f('0xd0')],'VoiceQueueId':_0x4e32b1['VoiceQueueId']||undefined,'CampaignId':_0x4e32b1[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x101')));_0x4ead50({'reschedule':0x1});}}});}}};Dialer[_0xb53f('0x16')]['syncHangup']=function(_0xa1c2ad){var _0x2e302d=this[_0xb53f('0x21')][_0xa1c2ad['uniqueid']];var _0x4d3501=this;var _0x553484;if(_0x2e302d&&_0x2e302d[_0xb53f('0x4b')]===_0xb53f('0x7a')){delete this[_0xb53f('0x21')][_0xa1c2ad[_0xb53f('0xd8')]];this['updateOriginated'](this[_0xb53f('0x1a')][_0x2e302d[_0xb53f('0xb2')]]);this[_0xb53f('0x1a')][_0x2e302d[_0xb53f('0xb2')]][_0xb53f('0x102')]+=0x1;_0x553484=new Hangup(_0x2e302d,_0xa1c2ad);this['createHistory'](_0x553484)[_0xb53f('0xb5')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x553484)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x103')));}if(_0x2e302d&&_0x2e302d[_0xb53f('0x4b')]!=='ivr'&&isNotNull(this[_0xb53f('0x19')][_0x2e302d[_0xb53f('0xb2')]]['dialQueueProject'])){delete this[_0xb53f('0x21')][_0xa1c2ad[_0xb53f('0xd8')]];this[_0xb53f('0xb0')](this[_0xb53f('0x19')][_0x2e302d[_0xb53f('0xb2')]]);this[_0xb53f('0x19')][_0x2e302d['queue']][_0xb53f('0x5c')]+=0x1;this[_0xb53f('0x19')][_0x2e302d[_0xb53f('0xb2')]][_0xb53f('0x5b')]+=0x1;_0x553484=new Hangup(_0x2e302d,_0xa1c2ad);_0x553484['state']=0x10;_0x553484['statedesc']='AnswerAGI';_0x553484['membername']=_0xb53f('0x104');this[_0xb53f('0xc8')](_0x553484)[_0xb53f('0xb5')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xb53f('0xc6')](_0x553484)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x103')));}if(_0x2e302d&&_0x2e302d['type']!==_0xb53f('0x7a')&&!isNotNull(this['voiceQueues'][_0x2e302d[_0xb53f('0xb2')]][_0xb53f('0x105')])){delete this[_0xb53f('0x21')][_0xa1c2ad['uniqueid']];this[_0xb53f('0xb0')](this[_0xb53f('0x19')][_0x2e302d[_0xb53f('0xb2')]]);this[_0xb53f('0x19')][_0x2e302d[_0xb53f('0xb2')]][_0xb53f('0x64')]+=0x1;_0x553484=new Hangup(_0x2e302d,_0xa1c2ad);_0x553484['state']=0xc;_0x553484[_0xb53f('0xa5')]=_0xa1c2ad['cause-txt'];_0x553484['membername']=_0xb53f('0x106');this['createHistory'](_0x553484)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x107')));this[_0xb53f('0xc6')](_0x553484)[_0xb53f('0xb5')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xb53f('0x16')][_0xb53f('0x2e')]=function(_0x379672){var _0x1b8482=this['uniqueId'][_0x379672['uniqueid']];var _0x2dc95f=this;if(this[_0xb53f('0x19')][_0x379672[_0xb53f('0xb2')]]){if(_0x1b8482&&_0x1b8482[_0xb53f('0x4b')]!=='ivr'){delete this[_0xb53f('0x21')][_0x379672[_0xb53f('0xd8')]];this[_0xb53f('0x19')][_0x379672['queue']][_0xb53f('0x5c')]+=0x1;var _0x57a740=new AgentComplete(_0x1b8482,_0x379672);if(_0x379672[_0xb53f('0x108')]===_0xb53f('0x109')){_0x57a740[_0xb53f('0x10a')]=this[_0xb53f('0x19')][_0x379672[_0xb53f('0xb2')]][_0xb53f('0x10b')]&&this[_0xb53f('0x19')][_0x379672[_0xb53f('0xb2')]]['dialAgiAfterHangupAgent']?moment()[_0xb53f('0x77')](_0xb53f('0xf8')):undefined;}this[_0xb53f('0xc8')](_0x57a740)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x10c')));this[_0xb53f('0xc6')](_0x57a740)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x10d')));}}};Dialer[_0xb53f('0x16')][_0xb53f('0x28')]=function(_0xbdec56){if(this['voiceQueues'][_0xbdec56[_0xb53f('0xb2')]]){if(this['uniqueId'][_0xbdec56[_0xb53f('0xd8')]]&&this[_0xb53f('0x21')][_0xbdec56[_0xb53f('0xd8')]][_0xb53f('0x4b')]!=='ivr'){this['updateOriginated'](this[_0xb53f('0x19')][_0xbdec56[_0xb53f('0xb2')]]);this[_0xb53f('0x21')][_0xbdec56[_0xb53f('0xd8')]][_0xb53f('0x10e')]=moment()[_0xb53f('0x77')](_0xb53f('0xf8'));}}};Dialer[_0xb53f('0x16')]['queueCallerAbandonCreateState']=function(_0x4ea202){this[_0xb53f('0xc8')](_0x4ea202)[_0xb53f('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xb53f('0xc6')](_0x4ea202)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x10f')));};Dialer[_0xb53f('0x16')]['syncQueueCallerAbandon']=function(_0x4666f1){var _0x10bb71=this[_0xb53f('0x21')][_0x4666f1['uniqueid']];var _0x29ccfc=this;if(this[_0xb53f('0x19')][_0x4666f1['queue']]){if(_0x10bb71&&_0x10bb71[_0xb53f('0x4b')]!==_0xb53f('0x7a')){delete this[_0xb53f('0x21')][_0x4666f1[_0xb53f('0xd8')]];this[_0xb53f('0xb0')](this['voiceQueues'][_0x4666f1[_0xb53f('0xb2')]]);_0x10bb71[_0xb53f('0x110')]=moment()['format'](_0xb53f('0xf8'));var _0x140a7e=new QueueCallerAbandon(_0x10bb71,_0x4666f1);if(getSeconds(_0x10bb71['droptime'],_0x10bb71[_0xb53f('0x111')])>=_0x10bb71['dialQueueTimeout']){this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x69')]+=0x1;this[_0xb53f('0x19')][_0x4666f1['queue']][_0xb53f('0x112')]+=0x1;this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x6b')]+=0x1;_0x140a7e['state']=0xa;_0x140a7e[_0xb53f('0xa5')]=_0xb53f('0x113');_0x140a7e[_0xb53f('0x114')]=_0xb53f('0x115');_0x140a7e['agiafterat']=this['voiceQueues'][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x10b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x140a7e[_0xb53f('0xee')]+=0x1;_0x140a7e[_0xb53f('0xe7')]+=0x1;if(_0x140a7e[_0xb53f('0xee')]>=this['voiceQueues'][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x116')]){this['queueCallerAbandonCreateState'](_0x140a7e);}else{this[_0xb53f('0xbd')]({'active':![],'countdropretry':_0x140a7e[_0xb53f('0xee')],'scheduledat':moment()[_0xb53f('0xf5')](this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]]['dialDropRetryFrequency'],'minutes')[_0xb53f('0x77')](_0xb53f('0xf8')),'ContactId':_0x10bb71[_0xb53f('0x100')],'ListId':_0x10bb71['ListId'],'VoiceQueueId':_0x10bb71[_0xb53f('0xf9')]||undefined,'CampaignId':_0x10bb71[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x117')));var _0xac4322=new History(_0x140a7e);_0xac4322[_0xb53f('0xa4')]=0xa;_0xac4322[_0xb53f('0xa5')]=_0xb53f('0x113');_0xac4322['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xac4322[_0xb53f('0xa6')]=_0xac4322[_0xb53f('0xa7')];_0xac4322[_0xb53f('0x118')]=_0x140a7e['calleridname'];_0xac4322[_0xb53f('0x119')]=_0x140a7e[_0xb53f('0x119')];this['createHistory'](_0xac4322)['catch'](loggerCatch(_0xb53f('0x11a')));}}else{this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x68')]+=0x1;this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x61')]+=0x1;_0x140a7e['state']=0xb;_0x140a7e[_0xb53f('0xa5')]=_0xb53f('0x11b');_0x140a7e[_0xb53f('0x114')]=_0xb53f('0x11c');_0x140a7e['countabandonedretry']+=0x1;_0x140a7e[_0xb53f('0xe7')]+=0x1;if(_0x140a7e[_0xb53f('0xef')]>=this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]][_0xb53f('0x11d')]){this['queueCallerAbandonCreateState'](_0x140a7e);}else{this[_0xb53f('0xbd')]({'active':![],'countabandonedretry':_0x140a7e[_0xb53f('0xef')],'scheduledat':moment()[_0xb53f('0xf5')](this[_0xb53f('0x19')][_0x4666f1[_0xb53f('0xb2')]]['dialAbandonedRetryFrequency'],_0xb53f('0xf7'))['format'](_0xb53f('0xf8')),'ContactId':_0x10bb71['ContactId'],'ListId':_0x10bb71[_0xb53f('0xd0')],'VoiceQueueId':_0x10bb71['VoiceQueueId']||undefined,'CampaignId':_0x10bb71[_0xb53f('0xfa')]||undefined})['catch'](loggerCatch(_0xb53f('0x11e')));var _0xac4322=new History(_0x140a7e);_0xac4322[_0xb53f('0xa4')]=0xb;_0xac4322[_0xb53f('0xa5')]=_0xb53f('0x11b');_0xac4322[_0xb53f('0xa7')]=moment()[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0xac4322[_0xb53f('0xa6')]=_0xac4322[_0xb53f('0xa7')];_0xac4322[_0xb53f('0x118')]=_0x140a7e[_0xb53f('0x118')];_0xac4322[_0xb53f('0x119')]=_0x140a7e[_0xb53f('0x119')];this[_0xb53f('0xc8')](_0xac4322)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x11f')));}}}}};Dialer[_0xb53f('0x16')][_0xb53f('0x120')]=function(_0x11cd3e){if(this[_0xb53f('0x1f')][_0x11cd3e[_0xb53f('0xd8')]]){this[_0xb53f('0x1f')][_0x11cd3e['uniqueid']]['channel']=_0x11cd3e[_0xb53f('0xaf')];}if(this['uniqueId'][_0x11cd3e[_0xb53f('0xd8')]]){this['uniqueId'][_0x11cd3e['uniqueid']][_0xb53f('0xaf')]=_0x11cd3e[_0xb53f('0xaf')];}};Dialer[_0xb53f('0x16')][_0xb53f('0x35')]=function(_0x499dff){if(strategy[this[_0xb53f('0x19')][this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]][_0xb53f('0xb2')]][_0xb53f('0x4d')]]===_0xb53f('0x15')){if(this['actions'][_0x499dff['actionid']]&&_[_0xb53f('0xad')](this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]][_0xb53f('0x122')])&&_0x499dff['status']==='1'&&_0x499dff[_0xb53f('0x123')]==='0'){if(this[_0xb53f('0x1b')][_0x499dff[_0xb53f('0x124')]]){if(!this['agents'][_0x499dff[_0xb53f('0x124')]][_0xb53f('0x122')]){this[_0xb53f('0x1b')][_0x499dff[_0xb53f('0x124')]]['locked']=!![];this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]][_0xb53f('0x122')]=!![];this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]][_0xb53f('0x124')]=_0x499dff['stateinterface'];}}}}else if((strategy[this[_0xb53f('0x19')][this[_0xb53f('0x1f')][_0x499dff['actionid']]['queue']]['strategy']]||_0xb53f('0x125'))===_0xb53f('0x125')){if(this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]]){if(this[_0xb53f('0x1b')][_0x499dff['stateinterface']]){this[_0xb53f('0x1f')][_0x499dff['actionid']][_0xb53f('0x124')]=_0x499dff[_0xb53f('0x124')];if(_[_0xb53f('0xad')](this[_0xb53f('0x25')][this['actions'][_0x499dff['actionid']]['queue']])){this[_0xb53f('0x25')][this[_0xb53f('0x1f')][_0x499dff['actionid']]['queue']]=[];}this[_0xb53f('0x25')][this[_0xb53f('0x1f')][_0x499dff['actionid']][_0xb53f('0xb2')]]['push'](_[_0xb53f('0xce')](_[_0xb53f('0xcf')](this[_0xb53f('0x1f')][_0x499dff[_0xb53f('0x121')]],[_0xb53f('0x126'),_0xb53f('0x124')]),{'status':_0x499dff[_0xb53f('0xae')],'paused':_0x499dff[_0xb53f('0x123')]}));}}}};function unlockQueueStatus(_0xe9dbf6,_0x307b8f){setTimeout(function(){if(_[_0xb53f('0x3b')](_0xe9dbf6[_0xb53f('0x127')])){loggerBooked[_0xb53f('0x91')](_0xb53f('0x128'),_0x307b8f);}_0xe9dbf6[_0xb53f('0x127')]=!![];loggerBooked[_0xb53f('0x7c')]('[booked][unlockQueueStatus]',_0x307b8f,JSON[_0xb53f('0x76')](_[_0xb53f('0xcf')](_0xe9dbf6,[_0xb53f('0x3f'),_0xb53f('0x127')])));},0x1f3);}Dialer[_0xb53f('0x16')][_0xb53f('0x37')]=function(_0x58f16a){var _0x18e5ae=this;var _0x3a8fc5=_0x18e5ae['voiceQueues'][_0x18e5ae[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]];if(strategy[this[_0xb53f('0x19')][this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]][_0xb53f('0x4d')]]===_0xb53f('0x15')){if(this[_0xb53f('0x1f')][_0x58f16a['actionid']]&&this[_0xb53f('0x1f')][_0x58f16a['actionid']][_0xb53f('0x124')]){this[_0xb53f('0x8d')]['run'](this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0x126')],this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0x124')])[_0xb53f('0xb5')](function(_0x3271ba){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x3271ba,{'showHidden':![],'depth':null}));})[_0xb53f('0x18')](function(){_0x18e5ae[_0xb53f('0xb0')](_0x18e5ae[_0xb53f('0x19')][_0x18e5ae['actions'][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]]);_0x18e5ae['agents'][_0x18e5ae['actions'][_0x58f16a['actionid']][_0xb53f('0x124')]]['locked']=![];delete _0x18e5ae[_0xb53f('0x1f')][_0x58f16a['actionid']];unlockQueueStatus(_0x3a8fc5);});}else{this[_0xb53f('0xb0')](this['voiceQueues'][this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x58f16a[_0xb53f('0x121')]]['ContactId'],'ListId':this[_0xb53f('0x1f')][_0x58f16a['actionid']]['ListId'],'VoiceQueueId':this[_0xb53f('0x1f')][_0x58f16a['actionid']][_0xb53f('0xf9')]||undefined,'CampaignId':this[_0xb53f('0x1f')][_0x58f16a['actionid']]['CampaignId']||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x129')));delete this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]];unlockQueueStatus(_0x3a8fc5);}}else if((strategy[this['voiceQueues'][this['actions'][_0x58f16a[_0xb53f('0x121')]]['queue']][_0xb53f('0x4d')]]||'rrmemory')===_0xb53f('0x125')){var _0xc9d83d;if(this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]]&&!_[_0xb53f('0x45')](this[_0xb53f('0x25')][this['actions'][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]])){if(this[_0xb53f('0x26')][_0x18e5ae['actions'][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]]){this[_0xb53f('0x26')][_0x18e5ae[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]]=this[_0xb53f('0x26')][this[_0xb53f('0x1f')][_0x58f16a['actionid']][_0xb53f('0xb2')]]?this[_0xb53f('0x26')][this['actions'][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]]:this[_0xb53f('0x25')][this['actions'][_0x58f16a['actionid']]['queue']]?this['queueBooked'][this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]][_0xb53f('0x12a')]||0x0:0x0;}this[_0xb53f('0x25')][this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]][_0xb53f('0xb2')]][_0xb53f('0x12a')]=this[_0xb53f('0x26')][this[_0xb53f('0x1f')][_0x58f16a[_0xb53f('0x121')]]['queue']];for(var _0x2d7e3f=0x0;_0x2d7e3f=0x0;})['catch'](myreject(_0x2a8612)));}}else{_0x220648[_0xb53f('0x14c')](ami[_0xb53f('0x146')]({'action':_0xb53f('0x147'),'command':util['format'](_0xb53f('0x148'),_0x4ac685,!_[_0xb53f('0x3b')](config[_0xb53f('0x142')][_0x56a868])?_0x56a868:'')})[_0xb53f('0x3a')](function(_0x327574){return _0x327574[_0xb53f('0x149')][_0xb53f('0x14a')](_0xb53f('0x14b'))>=0x0;})[_0xb53f('0xb5')](myreject(_0x2a8612)));}BPromise[_0xb53f('0x14d')](_0x220648)['then'](function(_0xe4cc42){var _0x39df79=_[_0xb53f('0x14e')](_0xe4cc42);if(_0x39df79){return _0x8076ce(_0x39df79);}else{_0x2d05e8[_0xb53f('0x3c')]=_0x2ed41a?_0xb53f('0x14f'):_0xb53f('0x150');return _0x2a8612(msgResponse(_0xb53f('0x151'),_0xb53f('0x13f'),_0xb53f('0x152')+_0x2ed41a+'\x20'+_0xf30a0b+_0xb53f('0x153')+util[_0xb53f('0x93')](_0x4ac685,{'showHidden':![],'depth':null})+_0xb53f('0x154')+_0x56a868));}})[_0xb53f('0xb5')](function(_0x19d40b){return _0x2a8612(msgResponse('ifTime',_0xb53f('0x13f'),JSON[_0xb53f('0x76')](_0x19d40b)));});});};Dialer[_0xb53f('0x16')]['checkDialMethod']=function(_0x45c801){var _0x5eee36=this;return function(){switch(_0x45c801['dialMethod']){case _0xb53f('0x155'):freeVariablesPredictive(_0x45c801);_0x5eee36[_0xb53f('0x156')](_0x45c801,0x1);break;case _0xb53f('0x157'):freeVariablesPredictive(_0x45c801);_0x5eee36[_0xb53f('0x156')](_0x45c801,_0x45c801[_0xb53f('0x158')]);break;case _0xb53f('0x159'):_0x5eee36[_0xb53f('0x159')](_0x45c801);break;case _0xb53f('0x7'):freeVariablesPredictive(_0x45c801);_0x5eee36[_0xb53f('0x156')](_0x45c801,0x1);break;default:freeVariablesPredictive(_0x45c801);logger[_0xb53f('0x91')](_0xb53f('0x15a'),_0x45c801[_0xb53f('0x3f')],_0xb53f('0x15b'));}};};Dialer[_0xb53f('0x16')][_0xb53f('0x15c')]=function(_0x3304b5){return BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](cmHopper[_0xb53f('0x15d')](_0x3304b5['id'],previewRecallmeReminderInterval))[_0xb53f('0x3a')](function(_0x43e8b2){for(var _0x416df6=0x0;_0x416df6<_0x43e8b2[_0xb53f('0x94')];_0x416df6++){var _0x4f0dc6=_0x43e8b2[_0x416df6][_0xb53f('0x15e')]['name'];if(_0x4f0dc6)io['to'](util[_0xb53f('0x77')](_0xb53f('0x15f'),_0x4f0dc6))[_0xb53f('0x4a')](_0xb53f('0x160'),{'hopper':_0x43e8b2[_0x416df6]});}})[_0xb53f('0xb5')](function(_0x502bf0){});};Dialer[_0xb53f('0x16')][_0xb53f('0x161')]=function(_0x4e37cf){var _0xbc005e=this;return function(){_0xbc005e[_0xb53f('0x162')](_0x4e37cf);};};Dialer[_0xb53f('0x16')][_0xb53f('0x30')]=function(_0x29a04c){var _0x5ac9b4=this;if(isNotPreview(_0x29a04c[_0xb53f('0x57')])){if(isVoiceQueueOutbound(_0x29a04c[_0xb53f('0x4b')])&&isActive(_0x29a04c[_0xb53f('0x56')])){_0x29a04c[_0xb53f('0x9d')]=!![];BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](checkIsLoggedIn(_0x29a04c,_0x29a04c[_0xb53f('0x50')]))[_0xb53f('0x3a')](checkIsActive(_0x29a04c,_0x29a04c['dialActive']))['then'](checkInterval(_0x29a04c))['then'](_0x5ac9b4[_0xb53f('0x138')](_0x29a04c))['then'](_0x5ac9b4[_0xb53f('0x13c')](_0x29a04c[_0xb53f('0x163')],_0x29a04c[_0xb53f('0x164')],_0x29a04c[_0xb53f('0x3f')],_0x29a04c))[_0xb53f('0x3a')](_0x5ac9b4[_0xb53f('0x13e')](_0x29a04c[_0xb53f('0x41')],_0x29a04c[_0xb53f('0x164')],_0x29a04c[_0xb53f('0x3f')],_0x29a04c))['then'](_0x5ac9b4['checkDialMethod'](_0x29a04c))[_0xb53f('0xb5')](loggerCatchQueueSummary(_0xb53f('0x165'),_0x29a04c));}else{notSendMessagesQueue(_0x29a04c);}}else{freeVariablesPredictive(_0x29a04c);if(_0x29a04c[_0xb53f('0x166')]){_0x5ac9b4['checkPreviewRecallReminder'](_0x29a04c);}}};Dialer[_0xb53f('0x16')][_0xb53f('0x137')]=function(){var _0x2524f2=this;var _0x4e19b9;for(var _0x36b804 in this[_0xb53f('0x1a')]){if(typeof this[_0xb53f('0x1a')][_0x36b804]!==_0xb53f('0x95')){_0x4e19b9=this[_0xb53f('0x1a')][_0x36b804];if(isCampaignIvr(_0x4e19b9[_0xb53f('0x4b')])&&isActive(_0x4e19b9[_0xb53f('0xd4')])){_0x4e19b9[_0xb53f('0x9d')]=!![];BPromise[_0xb53f('0xb4')]()[_0xb53f('0x3a')](checkIsActive(_0x4e19b9,_0x4e19b9[_0xb53f('0xd4')]))[_0xb53f('0x3a')](checkInterval(_0x4e19b9))[_0xb53f('0x3a')](_0x2524f2['checkIsTrunkReachable'](_0x4e19b9))[_0xb53f('0x3a')](_0x2524f2[_0xb53f('0x13c')](_0x4e19b9[_0xb53f('0x163')],_0x4e19b9[_0xb53f('0x164')],_0x4e19b9['name'],_0x4e19b9))[_0xb53f('0x3a')](_0x2524f2['checkIfTimeIntervals'](_0x4e19b9[_0xb53f('0x41')],_0x4e19b9[_0xb53f('0x164')],_0x4e19b9[_0xb53f('0x3f')],_0x4e19b9))['then'](_0x2524f2[_0xb53f('0x161')](_0x4e19b9))['catch'](loggerCatchQueueSummary(_0xb53f('0x167'),_0x4e19b9));}else{notSendMessagesCampaign(_0x4e19b9);}}}};function getCallerIdRandom(_0x4b8c23,_0x4c4b0d){var _0x140109;var _0x23bd84;var _0x530ab6;if(_0x4c4b0d<=0x0){_0x4c4b0d=0x1;}_0x140109=new RegExp('\x5cw{0,'+_0x4c4b0d+'}$');_0x23bd84=Math[_0xb53f('0x168')](0xa,_0x4c4b0d-0x1);_0x530ab6=Math['pow'](0xa,_0x4c4b0d)-0x1;return util[_0xb53f('0x77')]('%s',_['replace'](_0x4b8c23,_0x140109,_[_0xb53f('0x169')](_0x23bd84,_0x530ab6)));}function extractCalleridName(_0x5b3070){var _0x38e665=_0x5b3070[_0xb53f('0x16a')](/"(.*?)"/);return _0x38e665?_0x38e665[0x1]:_0x5b3070;}function extractCalleridNumber(_0x3e78f2){var _0x357048=_0x3e78f2[_0xb53f('0x16a')](/<(.*?)>/);return _0x357048?_0x357048[0x1]:_0x3e78f2;}Dialer[_0xb53f('0x16')][_0xb53f('0x16b')]=function(_0x13518f,_0x2dc200){var _0xd59bfe=this;var _0x1826b5=uuid['v4']();this[_0xb53f('0x1f')][_0x1826b5]=new Action(_0x13518f,_0x2dc200,_0x1826b5);return new BPromise(function(_0x2eb5c6,_0x22fc62){if(_['isUndefined'](_0x13518f)&&typeof _0x13518f!==_0xb53f('0x16c')){return _0x22fc62(msgResponse(_0xb53f('0x16d'),_0xb53f('0x13f'),_0xb53f('0x16e')));}if(_[_0xb53f('0x3b')](_0x2dc200[_0xb53f('0x16f')][_0xb53f('0x170')])||_0x2dc200[_0xb53f('0x16f')][_0xb53f('0x170')]===null){return _0x22fc62(msgResponse(_0xb53f('0x16d'),_0xb53f('0x13f'),_0xb53f('0x171')));}var _0x3f14c5={'XMD-CALLERID':_0xd59bfe[_0xb53f('0x1f')][_0x1826b5][_0xb53f('0x172')](),'XMD-AGI':_0x13518f[_0xb53f('0x105')]?util[_0xb53f('0x77')](_0xb53f('0x173'),ipAgi,_0x13518f[_0xb53f('0x105')]):_0xb53f('0x174'),'XMD-AGIAFTER':_0x13518f[_0xb53f('0x10b')]?util['format'](_0xb53f('0x173'),ipAgi,_0x13518f[_0xb53f('0x10b')]):_0xb53f('0x174'),'XMD-QUEUE':_0x13518f[_0xb53f('0x4b')]===_0xb53f('0x4c')?util['format'](_0xb53f('0x175'),_0x13518f['name'],_0x13518f[_0xb53f('0x176')]||'',_0x13518f[_0xb53f('0x177')]?'c':'',_0x13518f['dialQueueTimeout']||0x3):_0xb53f('0x174'),'XMD-CONTACTID':_0x2dc200[_0xb53f('0x100')],'XMD-CDRTYPE':_0xb53f('0x178'),'CALLERID(all)':_0xd59bfe[_0xb53f('0x1f')][_0x1826b5]['getCaller'](),'XMD-AMD':_0x13518f[_0xb53f('0xdc')]?_0xb53f('0x179'):_0xb53f('0x174'),'XMD-DESTINATION':_0xb53f('0xdb')};if(_0x13518f[_0xb53f('0xdc')]){_0x3f14c5[_0xb53f('0x17a')]=_0x13518f['dialAMDInitialSilence']||0x9c4;_0x3f14c5['XMD-AMDGREETING']=_0x13518f[_0xb53f('0x17b')]||0x5dc;_0x3f14c5[_0xb53f('0x17c')]=_0x13518f[_0xb53f('0x17d')]||0x320;_0x3f14c5[_0xb53f('0x17e')]=_0x13518f[_0xb53f('0x17f')]||0x1388;_0x3f14c5[_0xb53f('0x180')]=_0x13518f['dialAMDMinWordLength']||0x64;_0x3f14c5['XMD-AMDBETWEENWORDSSILENCE']=_0x13518f[_0xb53f('0x181')]||0x32;_0x3f14c5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x13518f['dialAMDMaximumNumberOfWords']||0x3;_0x3f14c5['XMD-AMDSILENCETHRESHOLD']=_0x13518f[_0xb53f('0x182')]||0x100;_0x3f14c5['XMD-AMDMAXIMUMWORDLENGTH']=_0x13518f[_0xb53f('0x183')]||0x1388;}if(_0x13518f[_0xb53f('0x4b')]===_0xb53f('0x4c')){_0x3f14c5[_0xb53f('0x184')]=_0x2dc200[_0xb53f('0xf9')];}else{_0x3f14c5['XMD-CAMPAIGNID']=_0x2dc200[_0xb53f('0xfa')];}for(var _0x1a8970 in _0x2dc200[_0xb53f('0x16f')]){if(typeof _0x2dc200[_0xb53f('0x16f')][_0x1a8970]!==_0xb53f('0x95')){if(isNotNull(_0x2dc200[_0xb53f('0x16f')][_0x1a8970])&&_0x1a8970!=='id'&&_0x1a8970!==_0xb53f('0x185')&&_0x1a8970!==_0xb53f('0x186')&&_0x1a8970!==_0xb53f('0x187')){_0x3f14c5[util[_0xb53f('0x77')]('%s%s',_0xb53f('0x188'),_[_0xb53f('0x189')](_0x1a8970))]=_0x2dc200[_0xb53f('0x16f')][_0x1a8970];}}}var _0x27c9b1=_0xd59bfe[_0xb53f('0x139')](_0x13518f[_0xb53f('0x74')])?getCallerId(_0x13518f[_0xb53f('0x74')][_0xb53f('0x75')],_0x13518f[_0xb53f('0x58')],_0x13518f[_0xb53f('0x18a')]>0x0?getCallerIdRandom(_0x13518f[_0xb53f('0x59')],_0x13518f['dialRandomLastDigitCallerIdNumber']):_0x13518f[_0xb53f('0x59')]):getCallerId(_[_0xb53f('0xad')](_0x13518f['TrunkBackup'])?_0x13518f[_0xb53f('0x74')]['callerid']:_0x13518f[_0xb53f('0x13a')][_0xb53f('0x75')],_0x13518f[_0xb53f('0x58')],_0x13518f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x13518f['dialOriginateCallerIdNumber'],_0x13518f['dialRandomLastDigitCallerIdNumber']):_0x13518f[_0xb53f('0x59')]);if(_0x27c9b1){_0x3f14c5[_0xb53f('0x18b')]=_0xd59bfe[_0xb53f('0x1f')][_0x1826b5][_0xb53f('0x18c')]=extractCalleridName(_0x27c9b1);_0x3f14c5[_0xb53f('0x18d')]=_0xd59bfe[_0xb53f('0x1f')][_0x1826b5][_0xb53f('0x18e')]=extractCalleridNumber(_0x27c9b1);}return ami[_0xb53f('0x146')]({'actionid':_0x1826b5,'action':_0xb53f('0x16d'),'channel':_0xd59bfe['isTrunkReachable'](_0x13518f[_0xb53f('0x74')])?util[_0xb53f('0x77')](_0xb53f('0x18f'),_0x13518f['Trunk'][_0xb53f('0x3f')],isNotNull(_0x13518f[_0xb53f('0x190')])?_0x13518f[_0xb53f('0x190')][_0xb53f('0x191')]()||'':'',_0x13518f[_0xb53f('0x192')]>0x0?_0x2dc200[_0xb53f('0x16f')][_0xb53f('0x170')]['substring'](_0x13518f[_0xb53f('0x192')]):_0x2dc200[_0xb53f('0x16f')][_0xb53f('0x170')]):util['format'](_0xb53f('0x18f'),_[_0xb53f('0xad')](_0x13518f[_0xb53f('0x13a')])?_0x13518f[_0xb53f('0x74')][_0xb53f('0x3f')]:_0x13518f[_0xb53f('0x13a')][_0xb53f('0x3f')],isNotNull(_0x13518f[_0xb53f('0x190')])?_0x13518f['dialPrefix'][_0xb53f('0x191')]()||'':'',_0x13518f[_0xb53f('0x192')]>0x0?_0x2dc200[_0xb53f('0x16f')]['phone'][_0xb53f('0x193')](_0x13518f[_0xb53f('0x192')]):_0x2dc200['Contact'][_0xb53f('0x170')]),'callerid':_0x27c9b1,'Exten':'xcally-motion-dialer','Context':_0xb53f('0x194'),'Priority':'1','variable':_0x3f14c5,'timeout':(_0x13518f[_0xb53f('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1826b5})[_0xb53f('0x3a')](function(_0x5ea69e){return _0x2eb5c6(_0x5ea69e);})['catch'](function(_0xd9789f){_0x13518f[_0xb53f('0x195')]+=0x1;var _0x594b6d=new History(_0xd59bfe['actions'][_0x1826b5]);logger['error'](util[_0xb53f('0x77')](_0xb53f('0x196'),JSON[_0xb53f('0x76')](_0xd9789f)));_0x594b6d[_0xb53f('0xa4')]=0xe;_0x594b6d[_0xb53f('0xa5')]=_0xb53f('0x197');_0x594b6d['starttime']=moment()['format'](_0xb53f('0xf8'));_0x594b6d['endtime']=_0x594b6d[_0xb53f('0xa7')];_0xd59bfe[_0xb53f('0xc8')](_0x594b6d)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x198')));_0xd59bfe[_0xb53f('0xc6')](_0x594b6d)['catch'](loggerCatch(_0xb53f('0x198')))['finally'](function(){delete _0xd59bfe[_0xb53f('0x1f')][_0x1826b5];return _0x22fc62(msgResponse(_0xb53f('0x16d'),_0xb53f('0x47'),_0xb53f('0x199')));});});});};Dialer[_0xb53f('0x16')]['syncOriginateResponse']=function(_0x282f85){var _0x24ada1=this[_0xb53f('0x1f')][_0x282f85[_0xb53f('0x121')]];if(_0x24ada1){delete this[_0xb53f('0x1f')][_0x282f85[_0xb53f('0x121')]];_0x24ada1[_0xb53f('0x111')]=moment()[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3c5e08=_0x24ada1[_0xb53f('0x4b')]===_0xb53f('0x7a')?this[_0xb53f('0x1a')][_0x24ada1['queue']]:this[_0xb53f('0x19')][_0x24ada1[_0xb53f('0x19a')]()];if(!this[_0xb53f('0x19b')](_0x282f85[_0xb53f('0x19c')])){this[_0xb53f('0xb0')](_0x3c5e08);return this[_0xb53f('0x19d')](_0x24ada1,_0x3c5e08,_0x282f85)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x19e')));}this[_0xb53f('0x21')][_0x282f85[_0xb53f('0xd8')]]=_0x24ada1;}};Dialer[_0xb53f('0x16')][_0xb53f('0x19f')]=function(_0x8816bb,_0x1e5dc1,_0x4bcd6c){var _0x4219ea=new History(_0x1e5dc1);if(_0x4219ea['countbusyretry']+_0x4219ea[_0xb53f('0xeb')]+_0x4219ea[_0xb53f('0xec')]+_0x4219ea[_0xb53f('0xed')]+_0x4219ea[_0xb53f('0xee')]+_0x4219ea[_0xb53f('0xef')]+_0x4219ea['countmachineretry']+_0x4219ea['countagentrejectretry']>=_0x4bcd6c['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x8816bb){case 0x3:if(_0x4219ea['countnoanswerretry']>=_0x4bcd6c[_0xb53f('0x1a0')]-0x1){return!![];}this[_0xb53f('0xbd')]({'active':![],'countnoanswerretry':_0x4219ea['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c[_0xb53f('0x1a1')],_0xb53f('0xf7'))[_0xb53f('0x77')](_0xb53f('0xf8')),'ContactId':_0x4219ea['ContactId'],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1a2')));break;case 0x5:if(_0x4219ea['countbusyretry']>=_0x4bcd6c['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4219ea[_0xb53f('0xea')]+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c[_0xb53f('0x1a3')],_0xb53f('0xf7'))[_0xb53f('0x77')](_0xb53f('0xf8')),'ContactId':_0x4219ea['ContactId'],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})['catch'](loggerCatch(_0xb53f('0x1a4')));break;case 0x8:if(_0x4219ea[_0xb53f('0xeb')]>=_0x4bcd6c['dialCongestionMaxRetry']-0x1){return!![];}this[_0xb53f('0xbd')]({'active':![],'countcongestionretry':_0x4219ea[_0xb53f('0xeb')]+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c[_0xb53f('0x1a5')],_0xb53f('0xf7'))[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4219ea[_0xb53f('0x100')],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1a6')));break;case 0x0:if(_0x4219ea[_0xb53f('0xed')]>=_0x4bcd6c[_0xb53f('0x1a7')]-0x1){return!![];}else{this[_0xb53f('0xbd')]({'active':![],'countnosuchnumberretry':_0x4219ea[_0xb53f('0xed')]+=0x1,'scheduledat':moment()['add'](_0x4bcd6c[_0xb53f('0x1a8')],_0xb53f('0xf7'))[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4219ea['ContactId'],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1a9')));}break;case 0xa:if(_0x4219ea[_0xb53f('0xee')]>=_0x4bcd6c['dialDropMaxRetry']-0x1){return!![];}this[_0xb53f('0xbd')]({'active':![],'countdropretry':_0x4219ea[_0xb53f('0xee')]+=0x1,'scheduledat':moment()['add'](_0x4bcd6c['dialDropRetryFrequency'],_0xb53f('0xf7'))[_0xb53f('0x77')](_0xb53f('0xf8')),'ContactId':_0x4219ea[_0xb53f('0x100')],'ListId':_0x4219ea['ListId'],'VoiceQueueId':_0x4219ea['VoiceQueueId']||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4219ea[_0xb53f('0xef')]>=_0x4bcd6c[_0xb53f('0x11d')]-0x1){return!![];}this[_0xb53f('0xbd')]({'active':![],'countabandonedretry':_0x4219ea[_0xb53f('0xef')]+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c[_0xb53f('0x1aa')],_0xb53f('0xf7'))[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4219ea[_0xb53f('0x100')],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea['VoiceQueueId']||undefined,'CampaignId':_0x4219ea['CampaignId']||undefined})[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x11e')));break;case 0x13:if(_0x4219ea[_0xb53f('0xf0')]>=_0x4bcd6c[_0xb53f('0xf3')]-0x1){return!![];}this[_0xb53f('0xbd')]({'active':![],'countmachineretry':_0x4219ea[_0xb53f('0xf0')]+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c['dialMachineRetryFrequency'],_0xb53f('0xf7'))[_0xb53f('0x77')](_0xb53f('0xf8')),'ContactId':_0x4219ea[_0xb53f('0x100')],'ListId':_0x4219ea[_0xb53f('0xd0')],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea[_0xb53f('0xfa')]||undefined})[_0xb53f('0xb5')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4219ea[_0xb53f('0xfd')]>=_0x4bcd6c[_0xb53f('0x1ab')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4219ea[_0xb53f('0xfd')]+=0x1,'scheduledat':moment()[_0xb53f('0xf5')](_0x4bcd6c['dialAgentRejectRetryFrequency'],'minutes')[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4219ea[_0xb53f('0x100')],'ListId':_0x4219ea['ListId'],'VoiceQueueId':_0x4219ea[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4219ea['CampaignId']||undefined})['catch'](loggerCatch(_0xb53f('0x1ac')));break;default:return!![];}};Dialer[_0xb53f('0x16')][_0xb53f('0x19d')]=function(_0x3cac75,_0x26892e,_0x21008e){var _0x57cdb9=this;var _0x1134de=new History(_0x3cac75);return new BPromise(function(_0x363c8c,_0x70de15){if(_['isUndefined'](_0x26892e)&&typeof _0x26892e!==_0xb53f('0x16c')){return _0x70de15(msgResponse(_0xb53f('0x1ad'),_0xb53f('0x13f'),_0xb53f('0x1ae')));}if(_[_0xb53f('0x3b')](_0x21008e)&&typeof _0x21008e!=='object'){return _0x70de15(msgResponse(_0xb53f('0x1ad'),_0xb53f('0x13f'),_0xb53f('0x1af')));}switch(_0x21008e[_0xb53f('0x108')]){case'0':_0x26892e[_0xb53f('0x62')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0x0;_0x1134de['statedesc']=_0xb53f('0x1b0');_0x1134de[_0xb53f('0xed')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;ami[_0xb53f('0x4a')](_0xb53f('0x1b1'),ut[_0xb53f('0xe1')](_0x3cac75,_0xb53f('0x1b2')));_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0xe9')));if(_0x57cdb9[_0xb53f('0x19f')](0x0,_0x3cac75,_0x26892e)){if(_0x1134de['countnosuchnumberretry']>=_0x26892e[_0xb53f('0x1a7')]){_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1b3'));}else{_0x57cdb9[_0xb53f('0xf2')](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1b3'));}}break;case'3':_0x26892e[_0xb53f('0x1b4')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0x3;_0x1134de[_0xb53f('0xa5')]='NoAnswer';_0x1134de[_0xb53f('0xec')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;ami[_0xb53f('0x4a')](_0xb53f('0x1b5'),ut['buildObj'](_0x3cac75,_0xb53f('0x1b6')));_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1b7')));if(_0x57cdb9[_0xb53f('0x19f')](0x3,_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xec')]>=_0x26892e[_0xb53f('0x1a0')]){_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,'reason\x203\x20ringing\x20no\x20answer');}else{_0x57cdb9['stateGlobal'](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1b8'));}}break;case'5':_0x26892e[_0xb53f('0x5e')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0x5;_0x1134de[_0xb53f('0xa5')]='Busy';_0x1134de[_0xb53f('0xea')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;ami[_0xb53f('0x4a')](_0xb53f('0x1b9'),ut['buildObj'](_0x3cac75,_0xb53f('0x1ba')));_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1bb')));if(_0x57cdb9[_0xb53f('0x19f')](0x5,_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xea')]>=_0x26892e[_0xb53f('0x1bc')]){_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1bd'));}else{_0x57cdb9[_0xb53f('0xf2')](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1bd'));}}break;case'8':_0x26892e[_0xb53f('0x5f')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0x8;_0x1134de[_0xb53f('0xa5')]=_0xb53f('0x1be');_0x1134de[_0xb53f('0xeb')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;ami[_0xb53f('0x4a')](_0xb53f('0x1bf'),ut['buildObj'](_0x3cac75,_0xb53f('0x1c0')));_0x57cdb9[_0xb53f('0xc8')](_0x1134de)['catch'](loggerCatch(_0xb53f('0x1c1')));if(_0x57cdb9[_0xb53f('0x19f')](0x8,_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xeb')]>=_0x26892e[_0xb53f('0x1c2')]){_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,'reason\x208\x20congestion');}else{_0x57cdb9['stateGlobal'](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1c3'));}}break;case'11':_0x26892e[_0xb53f('0x1c4')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0xb;_0x1134de['statedesc']='Abandoned';_0x1134de[_0xb53f('0xef')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x11f')));if(_0x57cdb9[_0xb53f('0x19f')](0xb,_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xef')]>=_0x26892e['dialAbandonedMaxRetry']){_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,'reason\x2011\x20abandoned');}else{_0x57cdb9[_0xb53f('0xf2')](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1c5'));}}break;case'20':_0x26892e['outboundRejectCallsDay']+=0x1;_0x1134de['state']=0x14;_0x1134de['statedesc']=_0xb53f('0x1c6');_0x1134de[_0xb53f('0xfd')]+=0x1;_0x1134de[_0xb53f('0xe7')]+=0x1;ami[_0xb53f('0x4a')]('custom:agentreject',ut[_0xb53f('0xe1')](_0x3cac75,_0xb53f('0x1c7')));_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1c8')));if(_0x57cdb9[_0xb53f('0x19f')](0x14,_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xfd')]>=_0x26892e['dialAgentRejectMaxRetry']){_0x57cdb9['createStateFinal'](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1c9'));}else{_0x57cdb9['stateGlobal'](_0x1134de,_0x363c8c,_0x70de15,_0xb53f('0x1c9'));}}break;default:_0x26892e[_0xb53f('0x64')]+=0x1;_0x1134de[_0xb53f('0xa4')]=0xc;_0x1134de[_0xb53f('0xa5')]=_0x21008e[_0xb53f('0x108')];_0x57cdb9[_0xb53f('0xc8')](_0x1134de)[_0xb53f('0xb5')](loggerCatch(_0xb53f('0x1ca')));if(_0x57cdb9[_0xb53f('0x19f')](_0x21008e[_0xb53f('0x108')],_0x3cac75,_0x26892e)){if(_0x1134de[_0xb53f('0xea')]+_0x1134de[_0xb53f('0xeb')]+_0x1134de['countnoanswerretry']+_0x1134de[_0xb53f('0xed')]+_0x1134de[_0xb53f('0xee')]+_0x1134de[_0xb53f('0xef')]+_0x1134de[_0xb53f('0xf0')]+_0x1134de[_0xb53f('0xfd')]>=_0x26892e[_0xb53f('0xf1')]){_0x57cdb9[_0xb53f('0xf2')](_0x1134de,_0x363c8c,_0x70de15,_0x21008e[_0xb53f('0x108')]);}else{_0x57cdb9[_0xb53f('0xff')](_0x1134de,_0x363c8c,_0x70de15,_0x21008e[_0xb53f('0x108')]);}}}});};Dialer[_0xb53f('0x16')][_0xb53f('0xf2')]=function(_0x43c868,_0x266ed1,_0x3df7e5,_0x15024f){var _0x2f918e=new Final(_0x43c868);_0x2f918e[_0xb53f('0xa4')]=0xf;_0x2f918e[_0xb53f('0xa5')]=_0xb53f('0x1cb');this[_0xb53f('0xff')](_0x2f918e,_0x266ed1,_0x3df7e5,_0x15024f);};Dialer[_0xb53f('0x16')][_0xb53f('0xff')]=function(_0x227a9f,_0x2c2a81,_0x47e88e,_0x51e8d9){this[_0xb53f('0xc6')](_0x227a9f)[_0xb53f('0x3a')](function(){return _0x2c2a81(msgResponse('[callProgressDetecting]',_0xb53f('0xd3'),_0x51e8d9));})['catch'](function(){return _0x47e88e(msgResponse(_0xb53f('0x1cc'),_0xb53f('0x13f'),_0xb53f('0x1cd')));});};Dialer[_0xb53f('0x16')]['predictive']=function(_0x1fc613){var _0x3d780e=_0x1fc613[_0xb53f('0x1ce')]/0x64;var _0x1f1b7a=_0x1fc613[_0xb53f('0x112')]/(_0x1fc613[_0xb53f('0x112')]+_0x1fc613[_0xb53f('0x5c')]);var _0x1678d0=Math[_0xb53f('0x1cf')](_0x1fc613[_0xb53f('0x6d')]*(_0x1fc613[_0xb53f('0x1d0')]/0x64));var _0x4ab618=Math['round'](_0x1fc613[_0xb53f('0x6d')]*(_0x1fc613[_0xb53f('0x1d1')]/0x64));var _0x3b4919=_0x1fc613[_0xb53f('0x4f')]+_0x1fc613[_0xb53f('0x52')];var _0x4f5c3=Math[_0xb53f('0x1d2')](_0x1fc613['erlangCalls']*_0x1fc613[_0xb53f('0x71')]*_0x1fc613[_0xb53f('0x1d3')]*_0x1fc613[_0xb53f('0x1d4')]);if(_[_0xb53f('0x3b')](_0x1fc613['startProgressive'])){if(!_[_0xb53f('0x3b')](_0x1fc613[_0xb53f('0x73')])){_0x1fc613[_0xb53f('0x73')]=undefined;loggerPredictive[_0xb53f('0x91')](_0xb53f('0x1d5'),_0xb53f('0x1d6'));}if(!_[_0xb53f('0x3b')](_0x1fc613[_0xb53f('0x8b')])){loggerPredictive['error'](_0xb53f('0x1d5'),_0xb53f('0x1d7'));clearInterval(_0x1fc613[_0xb53f('0x8b')]);_0x1fc613[_0xb53f('0x8b')]=undefined;}_0x1fc613[_0xb53f('0x23')]=moment()[_0xb53f('0x77')](_0xb53f('0xf8'));loggerPredictive[_0xb53f('0x7c')](_0x1fc613[_0xb53f('0x3f')],_0xb53f('0x1d8'),_0x1fc613[_0xb53f('0x23')]);this['handlePower'](_0x1fc613,0x1);}else if(ifInterval(_0x1fc613[_0xb53f('0x1d9')],_0x1fc613[_0xb53f('0x23')])){this[_0xb53f('0x156')](_0x1fc613,0x1);loggerPredictiveCalls[_0xb53f('0x7c')](_0xb53f('0x1da'),_0x1fc613[_0xb53f('0x23')],_0x1fc613[_0xb53f('0x3f')]);_0x1fc613['erlangCalls']=0x0;_0x1fc613[_0xb53f('0x6b')]=0x0;}else if(_0x3d780e<_0x1f1b7a&&_0x1fc613[_0xb53f('0x1db')]===_0xb53f('0x1dc')){freeVariablesPredictive(_0x1fc613);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x1dd'),'Dropped\x20calls\x20day',_0x1f1b7a,_0xb53f('0x23'),_0x1fc613[_0xb53f('0x3f')]);}else if(_0x4f5c3<_0x1fc613[_0xb53f('0x6b')]&&_0x1fc613['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x1fc613);loggerPredictive['info'](_0xb53f('0x1de'),_0xb53f('0x1df'),_0x4f5c3,_0xb53f('0x1e0'),_0x1fc613['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x1fc613[_0xb53f('0x3f')]);}else if(!ifInterval(_0x1fc613[_0xb53f('0x1d9')],_0x1fc613['startProgressive'])&&_[_0xb53f('0x3b')](_0x1fc613[_0xb53f('0x73')])&&!_[_0xb53f('0x3b')](_0x1fc613['startProgressive'])){_0x1fc613[_0xb53f('0x73')]=moment()[_0xb53f('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xb53f('0x7c')](_0x1fc613[_0xb53f('0x3f')],'started\x20in\x20predictive\x20at',_0x1fc613[_0xb53f('0x73')]);this[_0xb53f('0xbb')](_0x1fc613[_0xb53f('0x1d9')])[_0xb53f('0x3a')](this[_0xb53f('0x1e1')](_0x1fc613))[_0xb53f('0x3a')](mergeDataErlangB(_0x1fc613))['then'](this['startMethodPredictive'](_0x1fc613))[_0xb53f('0xb5')](loggerCatchPredictive(_0xb53f('0x1e2'),_0x1fc613));}else if(!ifInterval(_0x1fc613[_0xb53f('0x1d9')],_0x1fc613[_0xb53f('0x73')])){_0x1fc613['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1fc613[_0xb53f('0x73')]=moment()[_0xb53f('0x77')](_0xb53f('0xf8'));loggerPredictive[_0xb53f('0x7c')](_0x1fc613[_0xb53f('0x3f')],'recalculate\x20predictive\x20at',_0x1fc613[_0xb53f('0x73')]);clearInterval(_0x1fc613[_0xb53f('0x8b')]);_0x1fc613['handlePredictive']=undefined;this['averageHandleTime'](_0x1fc613[_0xb53f('0x1d9')])['then'](this['getDataPredictive'](_0x1fc613))[_0xb53f('0x3a')](mergeDataErlangB(_0x1fc613))['then'](this[_0xb53f('0x1e3')](_0x1fc613))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x1fc613));}else if(_0x1fc613[_0xb53f('0x6d')]&&_0x3b4919<_0x1fc613[_0xb53f('0x6d')]-_0x4ab618){freeVariablesPredictive(_0x1fc613);loggerPredictive[_0xb53f('0x7c')](_0x1fc613[_0xb53f('0x3f')],_0xb53f('0x1e4'),_0x3b4919,')\x20are\x20less\x20than\x20threshold\x20(',_0x1fc613[_0xb53f('0x6d')],'-',_0x4ab618,'=',_0x1fc613[_0xb53f('0x6d')]-_0x4ab618,')');}else if(_0x1fc613[_0xb53f('0x6d')]&&_0x3b4919>_0x1fc613[_0xb53f('0x6d')]+_0x1678d0){freeVariablesPredictive(_0x1fc613);loggerPredictive[_0xb53f('0x7c')](_0x1fc613[_0xb53f('0x3f')],_0xb53f('0x1e4'),_0x3b4919,')\x20are\x20more\x20than\x20threshold\x20(',_0x1fc613[_0xb53f('0x6d')],'+',_0x1678d0,'=',_0x1fc613['predictiveIntervalAvailable']+_0x1678d0,')');}};Dialer['prototype'][_0xb53f('0x1e1')]=function(_0x5081a8){var _0x3c3058=this;return function(_0x38d057){return new BPromise(function(_0x20e928,_0xbe8c28){_[_0xb53f('0xce')](_0x5081a8,_0x38d057[0x0]);if(checkGetDataPredictive(_0x38d057[0x0])){var _0x318c8a=_0x5081a8[_0xb53f('0x6d')]=_0x5081a8[_0xb53f('0x52')]+_0x5081a8[_0xb53f('0x4f')];var _0x39c408=_0x5081a8[_0xb53f('0x1d9')]*0x3c;var _0x10de8e=_0x38d057[0x0]['predictiveIntervalAvgTalktime']+_0x38d057[0x0][_0xb53f('0x66')];var _0x3d12b8=(_0x38d057[0x0][_0xb53f('0x65')]+_0x38d057[0x0][_0xb53f('0x69')]+_0x38d057[0x0][_0xb53f('0x68')])/_0x38d057[0x0][_0xb53f('0x80')];_0x5081a8[_0xb53f('0x1d3')]=_0x3d12b8>0x0?_0x3d12b8:0x1;switch(_0x5081a8[_0xb53f('0x1db')]){case _0xb53f('0x1dc'):var _0x596f6e=_0x5081a8[_0xb53f('0x1ce')]/0x64;return _0x3c3058['abandonmentRate'](_0x318c8a,_0x39c408,_0x10de8e,_0x3d12b8,_0x596f6e)[_0xb53f('0x3a')](function(_0x1224c){return _0x20e928(_0x1224c);});case'agentBusyFactor':var _0x473b70=_0x5081a8[_0xb53f('0x1ce')]/0x64;return _0x3c3058[_0xb53f('0x1e5')](_0x318c8a,_0x39c408,_0x10de8e,_0x3d12b8,_0x473b70)[_0xb53f('0x3a')](function(_0x3404ac){return _0x20e928(_0x3404ac);});default:return _0xbe8c28(msgResponse('[getDataPredictive]',_0xb53f('0x13f'),_0xb53f('0x1e6')));}}else{return _0xbe8c28(msgResponse(_0xb53f('0x1e7'),'Failure',_0xb53f('0x1e8')));}});};};Dialer[_0xb53f('0x16')][_0xb53f('0x1e9')]=function(_0x301de6){var _0x3a40c5=this;return function(_0x339350){return new BPromise(function(_0x2288c2,_0xc77679){_[_0xb53f('0xce')](_0x301de6,_0x339350[0x0]);if(checkGetDataPredictive(_0x339350[0x0])){loggerPredictive[_0xb53f('0x7c')](JSON[_0xb53f('0x76')](_0x339350[0x0]));if(_0x301de6[_0xb53f('0x1db')]===_0xb53f('0x1dc')){return _0x3a40c5[_0xb53f('0xc4')](_0x301de6['id'])[_0xb53f('0x3a')](function(_0x14b4c6){var _0x4d465a=_0x301de6['loggedIn']-_0x14b4c6[0x0]['outboundQueuePauses'];var _0x4184d4=_0x301de6[_0xb53f('0x1d9')]*0x3c;var _0x13791c=_0x339350[0x0][_0xb53f('0x67')]+_0x339350[0x0]['predictiveIntervalAvgHoldtime'];var _0x58aa7c=(_0x339350[0x0]['predictiveIntervalAnsweredCalls']+_0x339350[0x0][_0xb53f('0x69')]+_0x339350[0x0][_0xb53f('0x68')])/_0x339350[0x0][_0xb53f('0x80')];var _0x360bab=_0x301de6[_0xb53f('0x1ce')]/0x64;_0x301de6[_0xb53f('0x6c')]=_0x14b4c6[0x0][_0xb53f('0x1ea')]||0x0;_0x301de6[_0xb53f('0x1d3')]=_0x58aa7c>0x0?_0x58aa7c:0x1;return _0x3a40c5[_0xb53f('0x1eb')](_0x4d465a,_0x4184d4,_0x13791c,_0x58aa7c,_0x360bab);})[_0xb53f('0x3a')](function(_0x4ee303){return _0x2288c2(_0x4ee303);})[_0xb53f('0xb5')](function(_0x2d3c40){return _0xc77679(msgResponse(_0xb53f('0x1ec'),_0xb53f('0x13f'),JSON[_0xb53f('0x76')](_0x2d3c40)));});}if(_0x301de6[_0xb53f('0x1db')]===_0xb53f('0x1ed')){return _0x3a40c5[_0xb53f('0xc4')](_0x301de6['id'])['then'](function(_0x1761ba){var _0x2bc143=_0x301de6[_0xb53f('0x50')]-_0x1761ba[0x0][_0xb53f('0x1ea')];var _0x80b1af=_0x301de6[_0xb53f('0x1d9')]*0x3c;var _0x36d939=_0x339350[0x0][_0xb53f('0x67')]+_0x339350[0x0][_0xb53f('0x66')];var _0xe20fbc=(_0x339350[0x0][_0xb53f('0x65')]+_0x339350[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x339350[0x0][_0xb53f('0x68')])/_0x339350[0x0]['predictiveIntervalTotalCalls'];var _0x534375=_0x301de6[_0xb53f('0x1ce')]/0x64;_0x301de6[_0xb53f('0x6c')]=_0x1761ba[0x0][_0xb53f('0x1ea')]||0x0;_0x301de6[_0xb53f('0x1d3')]=_0xe20fbc>0x0?_0xe20fbc:0x1;return _0x3a40c5[_0xb53f('0x1e5')](_0x2bc143,_0x80b1af,_0x36d939,_0xe20fbc,_0x534375);})[_0xb53f('0x3a')](function(_0x16bbbb){return _0x2288c2(_0x16bbbb);})[_0xb53f('0xb5')](function(_0x33e64d){return _0xc77679(msgResponse('[CatchErlangB]',_0xb53f('0x13f'),JSON['stringify'](_0x33e64d)));});}}else{return _0xc77679(msgResponse(_0xb53f('0x1e7'),_0xb53f('0x13f'),_0xb53f('0x1e8')));}});};};Dialer[_0xb53f('0x16')][_0xb53f('0x1e3')]=function(_0x3aa552){var _0x52902c=this;return function(){var _0x3c803b=0x0;var _0x587747=Math[_0xb53f('0x1d2')](_0x3aa552['erlangCallToSecond']*0x3e8);if(_0x587747>0x0){_0x587747=_0x587747<0x64?0x64:_0x587747;loggerPredictive[_0xb53f('0x7c')](_0x3aa552[_0xb53f('0x3f')],_0xb53f('0x1ee'),_0x587747,'milliseconds');_0x3aa552[_0xb53f('0x8b')]=setInterval(function(){_0x52902c['handlePredictive'](_0x3aa552);loggerPredictiveCalls['info'](_0xb53f('0x1ef'),_0x3c803b+=0x1);},_0x587747);}else{loggerPredictive[_0xb53f('0x7c')](_0x3aa552['name'],_0xb53f('0x1f0'));}};};Dialer[_0xb53f('0x16')][_0xb53f('0x1f1')]=function(_0x3b2d1e,_0x4731a6){var _0x477563=this;return function(_0x441ab8){if(_[_0xb53f('0x45')](_0x441ab8)){if(_[_0xb53f('0xad')](_0x4731a6['UserId'])||!_0x4731a6[_0xb53f('0x1f2')]){if(_0x3b2d1e['dialMethod']==='booked'){_0x3b2d1e[_0xb53f('0x127')]=_[_0xb53f('0x3b')](_0x3b2d1e[_0xb53f('0x127')])?!![]:_0x3b2d1e[_0xb53f('0x127')];var _0x1dec36=uuid['v4']();_0x477563['actions'][_0x1dec36]=new Action(_0x3b2d1e,_0x4731a6,_0x1dec36);loggerBooked[_0xb53f('0x7c')](_0xb53f('0x1f3'),_0x1dec36,_0xb53f('0x1f4'),JSON[_0xb53f('0x76')](_0x3b2d1e[_0xb53f('0x127')]),'Queue:\x20',_0x3b2d1e[_0xb53f('0x3f')]);if(_0x3b2d1e[_0xb53f('0x127')]){_0x3b2d1e[_0xb53f('0x127')]=![];_0x477563[_0xb53f('0x25')][_0x477563['actions'][_0x1dec36][_0xb53f('0xb2')]]=[];ami[_0xb53f('0x146')]({'actionid':_0x1dec36,'action':_0xb53f('0x1f5'),'queue':_0x3b2d1e['name']})[_0xb53f('0xb5')](function(){_0x477563['updateOriginated'](_0x3b2d1e);_0x477563[_0xb53f('0xbd')]({'active':![],'ContactId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0x100')],'ListId':_0x477563['actions'][_0x1dec36][_0xb53f('0xd0')],'VoiceQueueId':_0x477563['actions'][_0x1dec36][_0xb53f('0xf9')]||undefined,'CampaignId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0xfa')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x477563[_0xb53f('0x1f')][_0x1dec36];});}else{loggerBooked[_0xb53f('0x7c')](_0xb53f('0x1f6'),JSON['stringify'](_0x3b2d1e[_0xb53f('0x127')]),'Queue:\x20',_0x3b2d1e[_0xb53f('0x3f')]);_0x477563[_0xb53f('0xb0')](_0x3b2d1e);_0x477563['rescheduleContact']({'active':![],'ContactId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0x100')],'ListId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0xd0')],'VoiceQueueId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0xf9')]||undefined,'CampaignId':_0x477563[_0xb53f('0x1f')][_0x1dec36][_0xb53f('0xfa')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x477563[_0xb53f('0x1f')][_0x1dec36];}}else{return _0x477563[_0xb53f('0x16b')](_0x3b2d1e,_0x4731a6);}}else{if(getDiff(_0x4731a6[_0xb53f('0x1f7')])<_0x3b2d1e['dialRecallMeTimeout']*0x3c){if(_0x4731a6[_0xb53f('0x15e')]&&!_0x4731a6[_0xb53f('0x15e')][_0xb53f('0x1f8')]){_0x477563[_0xb53f('0x8d')]['run'](_0x4731a6['id'])[_0xb53f('0x18')](function(){_0x477563[_0xb53f('0xb0')](_0x3b2d1e);});}else{_0x477563[_0xb53f('0xbe')]({'active':![]},_0x4731a6['id'],0x1)[_0xb53f('0x18')](function(){_0x477563[_0xb53f('0xb0')](_0x3b2d1e);});}}else{_0x3b2d1e[_0xb53f('0x1f9')]+=0x1;_0x477563[_0xb53f('0xb0')](_0x3b2d1e);if(_0x3b2d1e[_0xb53f('0x1fa')]){_0x477563[_0xb53f('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4731a6[_0xb53f('0x100')],'ListId':_0x4731a6['ListId'],'VoiceQueueId':_0x4731a6[_0xb53f('0xf9')]||undefined,'CampaignId':_0x4731a6[_0xb53f('0xfa')]||undefined})['catch'](loggerCatch(_0xb53f('0x1fb')));_0x477563[_0xb53f('0xc8')](createObjHistory(_0x3b2d1e,_0x4731a6,_0xb53f('0x1fc'),0x17,_0xb53f('0x1fd')))['catch'](loggerCatch(_0xb53f('0x1fe')));}else{_0x477563[_0xb53f('0xcd')](createObjHistory(_0x3b2d1e,_0x4731a6,_0xb53f('0x1ff'),0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x3b2d1e[_0xb53f('0x5d')]+=0x1;_0x477563[_0xb53f('0xcd')](createObjHistory(_0x3b2d1e,_0x4731a6,_0xb53f('0x200'),0xd,_0xb53f('0x201')),_0xb53f('0x202'),_0xb53f('0x203'));throw _0xb53f('0x204');}};};Dialer[_0xb53f('0x16')][_0xb53f('0x162')]=function(_0x1df6f2){var _0x10d0bb=this;var _0x5d0fb8=_0x1df6f2[_0xb53f('0x205')]-_0x1df6f2[_0xb53f('0x6e')]-_0x1df6f2['temp'];emitCampaignSummary(_0x1df6f2);if(_0x5d0fb8>0x0){if(_0x5d0fb8>this[_0xb53f('0x1d')]){_0x5d0fb8=this[_0xb53f('0x1d')];}_0x1df6f2[_0xb53f('0xc1')]+=_0x5d0fb8;this[_0xb53f('0xc2')](_0x1df6f2['id'],_0x5d0fb8,_0x1df6f2[_0xb53f('0x206')],_0x1df6f2)[_0xb53f('0x3a')](function(_0x60500b){_0x1df6f2[_0xb53f('0xc1')]-=_0x5d0fb8;_0x1df6f2['temp']=_0x1df6f2[_0xb53f('0xc1')]>0x0?_0x1df6f2[_0xb53f('0xc1')]:0x0;if(!checkContactEmpty(_0x60500b)){_0x1df6f2[_0xb53f('0x3c')]=_0xb53f('0x9b');logger[_0xb53f('0x7c')](_0xb53f('0x207')+_0x1df6f2[_0xb53f('0x3f')]);}else{_0x1df6f2[_0xb53f('0x6e')]+=_0x60500b[_0xb53f('0x94')];_0x1df6f2[_0xb53f('0x3c')]='RUNNING';for(var _0x50e033=0x0;_0x50e033<_0x60500b[_0xb53f('0x94')];_0x50e033+=0x1){_0x1df6f2['ivrTotalCallsDays']+=0x1;if(_[_0xb53f('0xad')](_0x60500b[_0x50e033])||_[_0xb53f('0xad')](_0x60500b[_0x50e033][_0xb53f('0x16f')])||_['isNil'](_0x60500b[_0x50e033][_0xb53f('0x16f')][_0xb53f('0x170')])){_0x10d0bb[_0xb53f('0xcb')]('[actionOriginate]\x20',_0x1df6f2,_0x60500b[_0x50e033]);}else{_0x10d0bb[_0xb53f('0xb9')](_[_0xb53f('0xcf')](_0x60500b[_0x50e033],[_0xb53f('0xfa'),'Contact.phone']))[_0xb53f('0x3a')](_0x10d0bb[_0xb53f('0x1f1')](_0x1df6f2,_0x60500b[_0x50e033]))[_0xb53f('0xb5')](_0x10d0bb[_0xb53f('0xca')](_0xb53f('0x208'),_0x1df6f2));}}}})[_0xb53f('0xb5')](loggerGetContactDialer(_0xb53f('0x209'),_0x1df6f2,_0x5d0fb8));}};Dialer[_0xb53f('0x16')][_0xb53f('0x156')]=function(_0x21dfb5,_0x46ce01){var _0x4e3137=this;var _0x1ed602=[];var _0x332f58=_0x46ce01>=0x1?_0x46ce01:0x1;if(_0x21dfb5[_0xb53f('0x57')]===_0xb53f('0x7')){_0x332f58=0x1;}var _0x4936be=Math[_0xb53f('0x1d2')](_0x21dfb5['available']*_0x332f58)-_0x21dfb5[_0xb53f('0x6e')]-_0x21dfb5[_0xb53f('0xc1')];emitVoiceQueueSummary(_0x21dfb5);if(_0x21dfb5[_0xb53f('0x20a')]>0x0){var _0x428d99=_0x21dfb5[_0xb53f('0x20a')]-_0x21dfb5['originated']-_0x21dfb5[_0xb53f('0x52')]-_0x21dfb5[_0xb53f('0xc1')]-_0x21dfb5[_0xb53f('0x9e')];if(_0x4936be>_0x428d99){_0x4936be=_0x428d99;}}if(_0x4936be>0x0){if(_0x21dfb5[_0xb53f('0x57')]===_0xb53f('0x7')){_0x4936be=0x1;}if(_0x4936be>this['maxNumberOriginate']){_0x4936be=this[_0xb53f('0x1d')];}_0x21dfb5[_0xb53f('0xc1')]+=_0x4936be;for(var _0x30c64e in this[_0xb53f('0x1b')]){if(typeof this[_0xb53f('0x1b')][_0x30c64e]!==_0xb53f('0x95')){if(this[_0xb53f('0x1b')][_0x30c64e][_0xb53f('0xa4')]==='not_inuse'&&this[_0xb53f('0x1b')][_0x30c64e][_0xb53f('0xae')]==='reachable'){_0x1ed602[_0xb53f('0x14c')](this[_0xb53f('0x1b')][_0x30c64e]['id']);}}}this[_0xb53f('0xc0')](_0x21dfb5['id'],_0x1ed602,_0x4936be,_0x21dfb5[_0xb53f('0x206')],_0x21dfb5)['then'](function(_0x117e33){_0x21dfb5[_0xb53f('0xc1')]-=_0x4936be;_0x21dfb5[_0xb53f('0xc1')]=_0x21dfb5[_0xb53f('0xc1')]>0x0?_0x21dfb5[_0xb53f('0xc1')]:0x0;if(!checkContactEmpty(_0x117e33)){_0x4e3137['countReScheduled'](_0x21dfb5)['then'](sendMessageReschedule(_0x21dfb5))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x21dfb5['originated']+=_0x117e33[_0xb53f('0x94')];_0x21dfb5[_0xb53f('0x3c')]=_0x21dfb5['dialMethod']===_0xb53f('0x7')?_0xb53f('0x179'):_0xb53f('0x20b');for(var _0x214cf6=0x0;_0x214cf6<_0x117e33[_0xb53f('0x94')];_0x214cf6+=0x1){if(_['isNil'](_0x117e33[_0x214cf6])||_[_0xb53f('0xad')](_0x117e33[_0x214cf6][_0xb53f('0x16f')])||_[_0xb53f('0xad')](_0x117e33[_0x214cf6][_0xb53f('0x16f')][_0xb53f('0x170')])){_0x4e3137[_0xb53f('0xcb')](_0xb53f('0x20c'),_0x21dfb5,_0x117e33[_0x214cf6]);}else{_0x4e3137[_0xb53f('0xb7')](_['pick'](_0x117e33[_0x214cf6],[_0xb53f('0xf9'),_0xb53f('0x20d')]))[_0xb53f('0x3a')](_0x4e3137[_0xb53f('0x1f1')](_0x21dfb5,_0x117e33[_0x214cf6]))[_0xb53f('0xb5')](_0x4e3137[_0xb53f('0xca')](_0xb53f('0x20c'),_0x21dfb5));}}}})[_0xb53f('0xb5')](loggerGetContactDialer(_0xb53f('0x20e'),_0x21dfb5,_0x4936be));}};Dialer[_0xb53f('0x16')]['handlePredictive']=function(_0x5402cd){if(_0x5402cd[_0xb53f('0x20a')]>0x0){var _0x4a6876=_0x5402cd[_0xb53f('0x20a')]-_0x5402cd['originated']-_0x5402cd[_0xb53f('0x52')];if(_0x4a6876>0x0){this[_0xb53f('0x20f')](_0x5402cd);}else{loggerPredictiveCalls['info'](_0xb53f('0x210'));}}else{this[_0xb53f('0x20f')](_0x5402cd);}};Dialer[_0xb53f('0x16')][_0xb53f('0x20f')]=function(_0x2c903f){var _0x1a943c=this;var _0x322f36=[];_0x2c903f[_0xb53f('0x6e')]+=0x1;for(var _0xbe9515 in this[_0xb53f('0x1b')]){if(typeof this[_0xb53f('0x1b')][_0xbe9515]!=='undefined'){if(this[_0xb53f('0x1b')][_0xbe9515][_0xb53f('0xa4')]===_0xb53f('0x211')&&this['agents'][_0xbe9515][_0xb53f('0xae')]==='reachable'){_0x322f36['push'](this[_0xb53f('0x1b')][_0xbe9515]['id']);}}}this['getContactDialer'](_0x2c903f['id'],_0x322f36,0x1,_0x2c903f['dialOrderByScheduledAt'],_0x2c903f)['then'](function(_0x1b8a56){if(!checkContactEmpty(_0x1b8a56)){checkContactLowerLimitOriginate(_0x2c903f,0x1,0x0);_0x1a943c[_0xb53f('0x212')](_0x2c903f)[_0xb53f('0x3a')](sendMessageReschedule(_0x2c903f))['catch'](loggerCatch(_0xb53f('0xb6')));}else{_0x2c903f[_0xb53f('0x3c')]=_0xb53f('0x20b');if(_[_0xb53f('0xad')](_0x1b8a56[0x0])||_[_0xb53f('0xad')](_0x1b8a56[0x0][_0xb53f('0x16f')])||_[_0xb53f('0xad')](_0x1b8a56[0x0][_0xb53f('0x16f')][_0xb53f('0x170')])){_0x1a943c[_0xb53f('0xcb')](_0xb53f('0x20c'),_0x2c903f,_0x1b8a56[0x0]);}else{_0x1a943c[_0xb53f('0xb7')](_[_0xb53f('0xcf')](_0x1b8a56[0x0],[_0xb53f('0xf9'),_0xb53f('0x20d')]))[_0xb53f('0x3a')](_0x1a943c['checkContactBlack'](_0x2c903f,_0x1b8a56[0x0]))[_0xb53f('0xb5')](_0x1a943c[_0xb53f('0xca')]('[actionOriginatePredictive]\x20',_0x2c903f));}}})[_0xb53f('0xb5')](loggerGetContactDialer(_0xb53f('0x213'),_0x2c903f,0x1));emitVoiceQueueSummary(_0x2c903f);};Dialer['prototype'][_0xb53f('0x1eb')]=function(_0x59c7f0,_0x17165f,_0x445f9f,_0x1185cf,_0x1b668f,_0x21bcda){loggerPredictive['info'](_0xb53f('0x214'));loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x215'),_0x59c7f0);loggerPredictive['info'](_0xb53f('0x216'),_0x17165f);loggerPredictive['info'](_0xb53f('0x217'),_0x445f9f);loggerPredictive['info'](_0xb53f('0x218'),_0x1185cf);loggerPredictive['info'](_0xb53f('0x219'),_0x1b668f);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x89'));return new BPromise(function(_0x48056b,_0x3a9621){if(_0x59c7f0<=0x0||isNaN(_0x59c7f0)){return _0x3a9621(msgResponse(_0xb53f('0x21a'),_0xb53f('0x47'),_0xb53f('0x21b')+_0x59c7f0));}if(_0x445f9f<=0x0||isNaN(_0x445f9f)){return _0x3a9621(msgResponse(_0xb53f('0x21a'),'Error',_0xb53f('0x21c')+_0x445f9f));}if(_0x1185cf<=0x0||isNaN(_0x1185cf)){return _0x3a9621(msgResponse(_0xb53f('0x21a'),_0xb53f('0x47'),_0xb53f('0x21d')+_0x1185cf));}if(_0x17165f<=0x0||isNaN(_0x17165f)){return _0x3a9621(msgResponse('[abandonmentRate]',_0xb53f('0x47'),_0xb53f('0x21e')+_0x17165f));}if(_0x1b668f<=0x0||isNaN(_0x1b668f)){return _0x3a9621(msgResponse(_0xb53f('0x21a'),_0xb53f('0x47'),'Amax\x20=\x20'+_0x1b668f));}_0x21bcda=_0x21bcda||0x0;var _0x2cb07f=0x1/_0x445f9f;var _0x5ac0ab=0x0;var _0x647dd8=0x0;var _0x36ac8f=0x0;var _0x24e20b=0x0;for(var _0x22c624=0x0;_0x36ac8f<_0x1b668f;_0x22c624+=0x1){_0x647dd8=_0x22c624/_0x17165f;_0x5ac0ab=(_0x1185cf*_0x647dd8+_0x21bcda)/_0x2cb07f;_0x36ac8f=erlangb(_0x5ac0ab,_0x59c7f0);_0x24e20b=_0x5ac0ab/_0x59c7f0*(0x1-erlangb(_0x5ac0ab,_0x59c7f0));}return _0x48056b({'erlangCalls':_0x22c624,'erlangCallToSecond':_0x17165f/_0x22c624,'erlangAbandonmentRate':_0x36ac8f,'erlangBusyFactor':_0x24e20b});});};Dialer['prototype'][_0xb53f('0x1e5')]=function(_0x4433d1,_0x45945d,_0x1029db,_0x9c3787,_0x1068a9,_0x2a192b){loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x21f'));loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x215'),_0x4433d1);loggerPredictive['info'](_0xb53f('0x216'),_0x45945d);loggerPredictive['info']('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',_0x1029db);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x218'),_0x9c3787);loggerPredictive[_0xb53f('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1068a9);loggerPredictive[_0xb53f('0x7c')](_0xb53f('0x89'));return new BPromise(function(_0xc56e29,_0x2bb568){if(_0x4433d1<=0x0||isNaN(_0x4433d1)){return _0x2bb568(msgResponse(_0xb53f('0x220'),_0xb53f('0x47'),_0xb53f('0x21b')+_0x4433d1));}if(_0x1029db<=0x0||isNaN(_0x1029db)){return _0x2bb568(msgResponse('[busyFactor]','Error',_0xb53f('0x21c')+_0x1029db));}if(_0x9c3787<=0x0||isNaN(_0x9c3787)){return _0x2bb568(msgResponse(_0xb53f('0x220'),'Error',_0xb53f('0x21d')+_0x9c3787));}if(_0x45945d<=0x0||isNaN(_0x45945d)){return _0x2bb568(msgResponse(_0xb53f('0x220'),_0xb53f('0x47'),_0xb53f('0x21e')+_0x45945d));}if(_0x1068a9<=0x0||isNaN(_0x1068a9)){return _0x2bb568(msgResponse(_0xb53f('0x220'),_0xb53f('0x47'),_0xb53f('0x221')+_0x1068a9));}_0x2a192b=_0x2a192b||0x0;var _0x50420e=0x1/_0x1029db;var _0x34eb09=0x0;var _0x2b22db=0x0;var _0x1d9298=0x0;var _0x45f419=0x0;for(var _0x35086e=0x0;_0x45f419<_0x1068a9;_0x35086e+=0x1){_0x2b22db=_0x35086e/_0x45945d;_0x34eb09=(_0x9c3787*_0x2b22db+_0x2a192b)/_0x50420e;_0x1d9298=erlangb(_0x34eb09,_0x4433d1);_0x45f419=_0x34eb09/_0x4433d1*(0x1-erlangb(_0x34eb09,_0x4433d1));}return _0xc56e29({'erlangCalls':_0x35086e,'erlangCallToSecond':_0x45945d/_0x35086e,'erlangAbandonmentRate':_0x1d9298,'erlangBusyFactor':_0x45f419});});};module[_0xb53f('0x222')]=Dialer; \ No newline at end of file +var _0x8f91=['pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','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','predictiveIntervalDroppedCallsTimeout','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','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','[uniqueid]','actions','[actions]','clearZombieChannels','isNil','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','HANGUP','HangupInAMD','AMD','custom:amd','buildObj','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','Machine','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','minutes','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','countnosuchnumberretry','countabandonedretry','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','CampaignId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','endtime','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridname','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','rrmemory','queueBooked','push','pick','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','isArray','command','iftime\x20%s,%s','interval','indexOf','content','true','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','dialMethod','handlePower','power','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','dialPreviewRecallmeReminder','checkPreviewRecallReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueTimeout','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[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(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','./action','./history','./final','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startProgressive','ivrOriginated','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Intervals','\x20INTERVAL_IS_NULL','isEmpty','Interval','INTERVAL_IS_NULL','Error','stringify','milliseconds','diff','emit','outbound','strategy','available','loggedIn'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x8f91,0x1c6));var _0x18f9=function(_0x58e330,_0x3fe9d0){_0x58e330=_0x58e330-0x0;var _0x152dc3=_0x8f91[_0x58e330];return _0x152dc3;};'use strict';var util=require(_0x18f9('0x0'));var _=require(_0x18f9('0x1'));var BPromise=require(_0x18f9('0x2'));var uuid=require(_0x18f9('0x3'));var moment=require(_0x18f9('0x4'));var rr=require('rr');var md5=require(_0x18f9('0x5'));var Redis=require(_0x18f9('0x6'));var ut=require('../preview/util/util');var config=require(_0x18f9('0x7'));var logger=require(_0x18f9('0x8'))(_0x18f9('0x9'));var loggerBooked=require(_0x18f9('0x8'))(_0x18f9('0xa'));var loggerPredictive=require(_0x18f9('0x8'))(_0x18f9('0xb'));var loggerPredictiveCalls=require(_0x18f9('0x8'))(_0x18f9('0xc'));var loggerSyncQueueSummary=require(_0x18f9('0x8'))(_0x18f9('0xd'));var ami=require(_0x18f9('0xe'));config[_0x18f9('0xf')]=_['defaults'](config[_0x18f9('0xf')],{'host':_0x18f9('0x10'),'port':0x18eb});var io=require(_0x18f9('0x11'))(new Redis(config[_0x18f9('0xf')]));var cmHopper=require(_0x18f9('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x18f9('0x13'));var History=require(_0x18f9('0x14'));var Final=require(_0x18f9('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x18f9('0x16'));var Hangup=require(_0x18f9('0x17'));var ipAgi=process[_0x18f9('0x18')][_0x18f9('0x19')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x18f9('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x18f9('0x1b')][_0x18f9('0x1c')]=function(_0xec3304){this[_0x18f9('0x1d')]=this['tail']?this['tail']['finally'](_0xec3304):_0xec3304();};function Dialer(_0x479aae,_0x398ac2){this[_0x18f9('0x1e')]=new Sequence();this[_0x18f9('0x1f')]=_0x398ac2;this[_0x18f9('0x20')]=_0x479aae[_0x18f9('0x20')];this[_0x18f9('0x21')]=_0x479aae[_0x18f9('0x21')];this[_0x18f9('0x22')]=_0x479aae[_0x18f9('0x22')];this[_0x18f9('0x23')]=_0x479aae[_0x18f9('0x23')];this[_0x18f9('0x24')]=config[_0x18f9('0x24')]||0x2;this[_0x18f9('0x25')]={};this['actions']={};this['contactsId']={};this[_0x18f9('0x26')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x18f9('0x27')]={};this[_0x18f9('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x18f9('0x29'),this[_0x18f9('0x2a')]['bind'](this));ami['on'](_0x18f9('0x2b'),this[_0x18f9('0x2c')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x2e'),this[_0x18f9('0x2f')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x30'),this['syncAgentComplete'][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x31'),this['syncQueueSummary'][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x32'),this['syncHangup'][_0x18f9('0x2d')](this));ami['on']('newexten',this[_0x18f9('0x33')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x34'),this[_0x18f9('0x35')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x36'),this[_0x18f9('0x37')][_0x18f9('0x2d')](this));ami['on'](_0x18f9('0x38'),this[_0x18f9('0x39')][_0x18f9('0x2d')](this));this[_0x18f9('0x3a')]();this[_0x18f9('0x3b')]();RpcSetting[_0x18f9('0x3c')]()['then'](function(_0x7e0eb2){previewRecallmeReminderInterval=_0x7e0eb2[_0x18f9('0x3d')];});}function isNotNull(_0x1ffc3e){return _0x1ffc3e!==null&&!_[_0x18f9('0x3e')](_0x1ffc3e);}function checkIsLoggedIn(_0xac5bb2,_0x1e3b99){return function(){if(_0x1e3b99<=0x0){_0xac5bb2[_0x18f9('0x3f')]='AGENTS_NOT_LOGGED';throw _0xac5bb2[_0x18f9('0x40')]+_0x18f9('0x41');}};}function isActive(_0x4c3698){return _0x4c3698;}function checkIsActive(_0x5bf603,_0xc17ad){return function(){if(!isActive(_0xc17ad)){_0x5bf603[_0x18f9('0x3f')]=_0x18f9('0x42');throw _0x5bf603[_0x18f9('0x40')]+_0x18f9('0x43');}};}function checkInterval(_0x37e8a2){return function(){if(!isNotNull(_0x37e8a2['Interval'])){_0x37e8a2['message']='INTERVAL_IS_NULL';throw _0x37e8a2['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x37e8a2['Interval'][_0x18f9('0x44')])){_0x37e8a2[_0x18f9('0x3f')]='INTERVAL_IS_NULL';throw _0x37e8a2['name']+_0x18f9('0x45');}if(!isNotNull(_[_0x18f9('0x46')](_0x37e8a2[_0x18f9('0x47')][_0x18f9('0x44')]))){_0x37e8a2['message']=_0x18f9('0x48');throw _0x37e8a2[_0x18f9('0x40')]+_0x18f9('0x45');}};}function msgResponse(_0x927f6b,_0x5200c2,_0x344ce1){return{'action':_0x927f6b,'response':_0x5200c2,'message':_0x344ce1,'stack':_0x344ce1};}function myreject(_0x5a5203){return function(_0x51dd10){return _0x5a5203(msgResponse('[ifTime][Action]',_0x18f9('0x49'),JSON[_0x18f9('0x4a')](_0x51dd10)));};}function getSeconds(_0x518800,_0x17f0fa){var _0x5c8f9c=moment(_0x518800)[_0x18f9('0x4b')](0x0);var _0x185d9d=moment(_0x17f0fa)[_0x18f9('0x4b')](0x0);return _0x5c8f9c[_0x18f9('0x4c')](_0x185d9d,'seconds');}function emit(_0x5c9110,_0x5d2b54,_0x394e86){io['to'](_0x5c9110)[_0x18f9('0x4d')](_0x5d2b54,_0x394e86);}function emitVoiceQueueSummary(_0x174417){if(_0x174417['type']===_0x18f9('0x4e')){var _0x25b9d3={'id':_0x174417['id'],'name':_0x174417[_0x18f9('0x40')],'strategy':_0x174417[_0x18f9('0x4f')],'answered':_0x174417['answered'],'available':_0x174417[_0x18f9('0x50')],'loggedIn':_0x174417[_0x18f9('0x51')],'pTalking':_0x174417[_0x18f9('0x52')],'sumBillable':_0x174417[_0x18f9('0x53')],'sumDuration':_0x174417['sumDuration'],'sumHoldTime':_0x174417[_0x18f9('0x54')]||0x0,'talking':_0x174417[_0x18f9('0x55')],'total':_0x174417[_0x18f9('0x56')],'type':_0x174417[_0x18f9('0x57')],'unmanaged':_0x174417['unmanaged'],'abandoned':_0x174417[_0x18f9('0x58')],'waiting':_0x174417[_0x18f9('0x59')],'loggedInDb':_0x174417[_0x18f9('0x5a')],'dialActive':_0x174417[_0x18f9('0x5b')],'dialMethod':_0x174417['dialMethod'],'dialOriginateCallerIdName':_0x174417['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x174417[_0x18f9('0x5c')],'dialOriginateTimeout':_0x174417[_0x18f9('0x5d')],'dialPrefix':_0x174417[_0x18f9('0x5e')],'outboundAnswerAgiCallsDay':_0x174417[_0x18f9('0x5f')],'outboundAnswerCallsDay':_0x174417[_0x18f9('0x60')],'outboundBlacklistCallsDay':_0x174417['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x174417[_0x18f9('0x61')],'outboundCongestionCallsDay':_0x174417[_0x18f9('0x62')],'outboundDropCallsDayACS':_0x174417[_0x18f9('0x63')],'outboundDropCallsDayCallersExit':_0x174417[_0x18f9('0x64')],'outboundDropCallsDayTimeout':_0x174417[_0x18f9('0x65')],'outboundNoAnswerCallsDay':_0x174417[_0x18f9('0x66')],'outboundNoSuchCallsDay':_0x174417[_0x18f9('0x67')],'outboundOriginateFailureCallsDay':_0x174417[_0x18f9('0x68')],'outboundReCallsDay':_0x174417['outboundReCallsDay'],'outboundRejectCallsDay':_0x174417['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x174417['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x174417[_0x18f9('0x69')],'predictiveIntervalAvgHoldtime':_0x174417[_0x18f9('0x6a')],'predictiveIntervalAvgTalktime':_0x174417[_0x18f9('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x174417[_0x18f9('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x174417['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x174417['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x174417[_0x18f9('0x6d')],'predictiveIntervalHitRate':_0x174417[_0x18f9('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x174417['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x174417[_0x18f9('0x6f')],'predictiveIntervalAvailable':_0x174417[_0x18f9('0x70')],'predictiveIntervalTotalCalls':_0x174417[_0x18f9('0x71')],'message':_0x174417['message'],'originated':_0x174417[_0x18f9('0x72')],'erlangCalls':_0x174417[_0x18f9('0x73')],'erlangCallToSecond':_0x174417[_0x18f9('0x74')],'erlangAbandonmentRate':_0x174417[_0x18f9('0x75')],'erlangBusyFactor':_0x174417[_0x18f9('0x76')],'startPredictive':_0x174417[_0x18f9('0x77')],'startProgressive':_0x174417[_0x18f9('0x27')]};if(_0x174417[_0x18f9('0x78')]){_0x25b9d3['Trunk']={'id':_0x174417[_0x18f9('0x78')]['id'],'name':_0x174417['Trunk'][_0x18f9('0x40')],'active':_0x174417[_0x18f9('0x78')]['active'],'callerid':_0x174417[_0x18f9('0x78')][_0x18f9('0x79')]};}if(_0x174417[_0x18f9('0x47')]){_0x25b9d3[_0x18f9('0x47')]={'id':_0x174417[_0x18f9('0x47')]['id'],'name':_0x174417['Interval']['name']};}var _0xb6b330=md5(JSON[_0x18f9('0x4a')](_0x25b9d3));if(_0x174417[_0x18f9('0x5')]!==_0xb6b330){_0x174417[_0x18f9('0x5')]=_0xb6b330;emit(util['format'](_0x18f9('0x7a'),_0x25b9d3[_0x18f9('0x40')]),_0x18f9('0x7b'),_0x25b9d3);}}}function emitCampaignSummary(_0x3a79e3){if(_0x3a79e3['type']===_0x18f9('0x7c')){emit(util[_0x18f9('0x7d')](_0x18f9('0x7e'),_0x3a79e3[_0x18f9('0x40')]),_0x18f9('0x7f'),_0x3a79e3);}}function checkGetDataPredictive(_0x1e433e){if(isNotNull(_0x1e433e)&&!_[_0x18f9('0x46')](_0x1e433e)){loggerPredictive[_0x18f9('0x80')](_0x18f9('0x81'));loggerPredictive[_0x18f9('0x80')](_0x18f9('0x82'),_0x1e433e['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x18f9('0x83'),_0x1e433e['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x18f9('0x84'),_0x1e433e[_0x18f9('0x85')]);loggerPredictive[_0x18f9('0x80')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e433e['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x86'),_0x1e433e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x87'),_0x1e433e[_0x18f9('0x6b')]);loggerPredictive[_0x18f9('0x80')]('---------------------------');if(_0x1e433e[_0x18f9('0x71')]>0x0){if(!_[_0x18f9('0x3e')](_0x1e433e[_0x18f9('0x6b')])&&_0x1e433e[_0x18f9('0x6b')]>0x0){return!![];}loggerPredictive[_0x18f9('0x80')](_0x18f9('0x88'));if(!_[_0x18f9('0x3e')](_0x1e433e[_0x18f9('0x6a')])&&_0x1e433e[_0x18f9('0x6a')]>0x0){return!![];}loggerPredictive[_0x18f9('0x80')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x18f9('0x80')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x342112){return function(_0x36d2ce){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x18f9('0x80')](_0x18f9('0x89'),_0x36d2ce[_0x18f9('0x73')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d2ce[_0x18f9('0x74')]);loggerPredictive['info'](_0x18f9('0x8a'),_0x36d2ce[_0x18f9('0x75')]);loggerPredictive[_0x18f9('0x80')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x36d2ce[_0x18f9('0x76')]);loggerPredictive['info'](_0x18f9('0x8a'),_0x36d2ce['erlangAbandonmentRate']);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x8b'));_[_0x18f9('0x8c')](_0x342112,_0x36d2ce);};}function getDiff(_0x111290){var _0x416b32=moment()[_0x18f9('0x4b')](0x0);var _0x1fa623=moment(_0x111290)['milliseconds'](0x0);return _0x416b32['diff'](_0x1fa623,_0x18f9('0x8d'));}function ifInterval(_0x595d3c,_0x5bde3b){if(_[_0x18f9('0x3e')](_0x5bde3b)){return![];}return getDiff(_0x5bde3b)<_0x595d3c*0x3c;}function freeVariablesPredictive(_0xf1c04c){if(isNotNull(_0xf1c04c)){if(!_['isUndefined'](_0xf1c04c[_0x18f9('0x27')])){_0xf1c04c[_0x18f9('0x27')]=undefined;loggerPredictive['info'](_0xf1c04c[_0x18f9('0x40')],_0x18f9('0x8e'));}if(!_[_0x18f9('0x3e')](_0xf1c04c[_0x18f9('0x77')])){_0xf1c04c[_0x18f9('0x77')]=undefined;loggerPredictive[_0x18f9('0x80')](_0xf1c04c[_0x18f9('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x18f9('0x3e')](_0xf1c04c[_0x18f9('0x8f')])){clearInterval(_0xf1c04c[_0x18f9('0x8f')]);_0xf1c04c[_0x18f9('0x8f')]=undefined;loggerPredictive[_0x18f9('0x80')](_0xf1c04c[_0x18f9('0x40')],_0x18f9('0x90'));}}}function erlangb(_0x3e9bd4,_0x154c86){if(_0x154c86===0x0){return 0x0;}var _0xb4450b=0x1;for(var _0x3db838=0x1;_0x3db838<=_0x154c86;_0x3db838+=0x1){_0xb4450b=0x1+_0xb4450b*_0x3db838/_0x3e9bd4;}return 0x1/_0xb4450b;}function isVoiceQueueOutbound(_0x532e4f){return _0x532e4f==='outbound';}function isNotPreview(_0x1ac7c1){return _0x1ac7c1!=='preview';}function isCampaignIvr(_0x261159){return _0x261159===_0x18f9('0x7c');}function getCallerId(_0x5c6ecf,_0x26b3f6,_0x4de6f7){if(!_[_0x18f9('0x3e')](_0x4de6f7)&&typeof _0x4de6f7===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x4de6f7)){if(!_[_0x18f9('0x3e')](_0x26b3f6)&&typeof _0x26b3f6===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x26b3f6)){return util[_0x18f9('0x7d')](_0x18f9('0x92'),_0x26b3f6,_0x4de6f7);}return util[_0x18f9('0x7d')](_0x18f9('0x92'),_0x4de6f7,_0x4de6f7);}if(!_[_0x18f9('0x3e')](_0x5c6ecf)&&typeof _0x5c6ecf===_0x18f9('0x91')&&!_[_0x18f9('0x46')](_0x5c6ecf)){return _0x5c6ecf;}return _0x18f9('0x93');}function loggerCatchQueueSummary(_0x14bea6,_0x4ad02d){return function(_0x28f1c4){freeVariablesPredictive(_0x4ad02d);emitVoiceQueueSummary(_0x4ad02d);emitCampaignSummary(_0x4ad02d);loggerSyncQueueSummary['error'](_0x14bea6,util['inspect'](_0x28f1c4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x266d4c,_0x486f13){return function(_0xf91c4b){loggerPredictive[_0x18f9('0x94')](_0x486f13[_0x18f9('0x40')],_0x266d4c);loggerPredictive[_0x18f9('0x94')](_0xf91c4b[_0x18f9('0x95')]);freeVariablesPredictive(_0x486f13);};}function loggerCatch(_0x5b6b12){return function(_0x5356e4){logger['error'](_0x5b6b12,util['inspect'](_0x5356e4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x833a0c){return _0x833a0c&&!_['isUndefined'](_0x833a0c)&&_0x833a0c[_0x18f9('0x96')]>0x0;}function decremetOriginate(_0x173944){if(!_[_0x18f9('0x3e')](_0x173944)&&_0x173944!==null){if(typeof _0x173944[_0x18f9('0x72')]!==_0x18f9('0x97')){if(_0x173944[_0x18f9('0x72')]>0x0){_0x173944[_0x18f9('0x72')]-=0x1;}else{logger['error'](_0x18f9('0x98'));}}}else{logger[_0x18f9('0x94')](_0x18f9('0x99'));}}function checkContactLowerLimitOriginate(_0x237d83,_0x47fc5e,_0x210feb){if(_0x47fc5e>_0x210feb){for(var _0x3786cc=0x0;_0x3786cc<_0x47fc5e-_0x210feb;_0x3786cc+=0x1){decremetOriginate(_0x237d83);}}}function loggerGetContactDialer(_0x107aac,_0x3c73da,_0x259ada){return function(_0x188f0c){checkContactLowerLimitOriginate(_0x3c73da,_0x259ada,0x0);logger[_0x18f9('0x94')](_0x107aac,util[_0x18f9('0x9a')](_0x188f0c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x124d2c){return function(_0x420e68){if(isNotNull(_0x420e68)&&isNotNull(_0x420e68[0x0])){if(_0x420e68[0x0][_0x18f9('0x9b')]>0x0){_0x124d2c[_0x18f9('0x3f')]=_0x18f9('0x9c');logger['info'](_0x18f9('0x9d')+_0x124d2c[_0x18f9('0x40')],_0x420e68[0x0]['contactsRescheduled'],'contacts');}else{_0x124d2c[_0x18f9('0x3f')]=_0x18f9('0x9e');logger['info'](_0x18f9('0x9f')+_0x124d2c['name']);}}};}function notSendMessagesQueue(_0x2cce3a){if(_0x2cce3a['sendMessageOneNotActive']){freeVariablesPredictive(_0x2cce3a);if(_0x2cce3a[_0x18f9('0x72')]===0x0&&_0x2cce3a['talking']===0x0&&_0x2cce3a[_0x18f9('0x59')]===0x0&&(_0x2cce3a[_0x18f9('0x52')]||0x0)===0x0){_0x2cce3a[_0x18f9('0xa0')]=![];_0x2cce3a[_0x18f9('0x50')]=0x0;_0x2cce3a[_0x18f9('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa1'),_0x2cce3a[_0x18f9('0x40')],_0x18f9('0xa2'));}else{_0x2cce3a[_0x18f9('0x3f')]=_0x18f9('0xa3');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2cce3a[_0x18f9('0x40')],_0x18f9('0xa4'));}emitVoiceQueueSummary(_0x2cce3a);}}function notSendMessagesCampaign(_0x44191f){if(_0x44191f['sendMessageOneNotActive']){if(_0x44191f[_0x18f9('0x72')]===0x0){_0x44191f[_0x18f9('0xa0')]=![];_0x44191f['message']=_0x18f9('0x42');loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa5'),_0x44191f[_0x18f9('0x40')],_0x18f9('0xa2'));}else{_0x44191f['message']=_0x18f9('0xa3');loggerSyncQueueSummary[_0x18f9('0x94')](_0x18f9('0xa5'),_0x44191f[_0x18f9('0x40')],'is\x20disactive');}emitCampaignSummary(_0x44191f);}}function createObjHistory(_0x435c9c,_0x19a00d,_0x5098d9,_0x12b06c,_0x22d148){_0x435c9c['message']=_0x5098d9;var _0x13d7c1=new Action(_0x435c9c,_0x19a00d);var _0x45c3b6=new History(_0x13d7c1);_0x45c3b6[_0x18f9('0xa6')]=_0x12b06c;_0x45c3b6[_0x18f9('0xa7')]=_0x22d148;_0x45c3b6['endtime']=_0x13d7c1['starttime'];return _0x45c3b6;}Dialer[_0x18f9('0x1b')][_0x18f9('0x3b')]=function(){var _0x55e4e1=this;setInterval(function(){_0x55e4e1['clearZombieChannels'](_0x55e4e1['uniqueId'],_0x18f9('0xa8'));_0x55e4e1['clearZombieChannels'](_0x55e4e1[_0x18f9('0xa9')],_0x18f9('0xaa'));},0x32c8);};Dialer[_0x18f9('0x1b')][_0x18f9('0xab')]=function(_0x1ac820,_0x173ef8){var _0x2a12a7=this;for(var _0x31a4fe in _0x1ac820){if(typeof _0x1ac820[_0x31a4fe]!==_0x18f9('0x97')){this['sequence']['enqueue'](function(){if(!_[_0x18f9('0xac')](_0x1ac820[_0x31a4fe])){return ami[_0x18f9('0xad')]({'action':'status','channel':_0x1ac820[_0x31a4fe][_0x18f9('0xae')]})[_0x18f9('0xaf')](function(_0x5128e8){if(_0x5128e8[_0x18f9('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1ac820[_0x31a4fe]&&_0x1ac820[_0x31a4fe][_0x18f9('0x57')]!==_0x18f9('0x7c')){_0x2a12a7[_0x18f9('0xb0')](_0x2a12a7['voiceQueues'][_0x1ac820[_0x31a4fe]['queue']]);logger['error']('[Dialer][checkChannel]',_0x173ef8,_0x31a4fe,_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]);delete _0x1ac820[_0x31a4fe];}if(_0x1ac820[_0x31a4fe]&&_0x1ac820[_0x31a4fe][_0x18f9('0x57')]===_0x18f9('0x7c')){_0x2a12a7[_0x18f9('0xb0')](_0x2a12a7[_0x18f9('0x21')][_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]]);logger[_0x18f9('0x94')](_0x18f9('0xb2'),_0x173ef8,_0x31a4fe,_0x1ac820[_0x31a4fe][_0x18f9('0xb1')]);delete _0x1ac820[_0x31a4fe];}},0x2328);}});}});}}};Dialer[_0x18f9('0x1b')][_0x18f9('0xb3')]=function(_0x2a4f13){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper['countReScheduled'](_0x2a4f13))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xb6')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xb7')]=function(_0x38545b){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperBlack[_0x18f9('0xb7')](_0x38545b))[_0x18f9('0xaf')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x18f9('0x1b')][_0x18f9('0xb8')]=function(_0x2f5d8b){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperBlack[_0x18f9('0xb8')](_0x2f5d8b))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xb9')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xba')]=function(_0x34635c){return BPromise['resolve']()[_0x18f9('0xb5')](cmHopperHistory[_0x18f9('0xbb')](_0x34635c))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xbc')));};Dialer['prototype'][_0x18f9('0xbd')]=function(_0xe94bd4){return BPromise[_0x18f9('0xb4')]()['then'](cmHopper[_0x18f9('0xbd')](_0xe94bd4))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xbe')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xbf')]=function(_0x67f216,_0x4c7e5b,_0x5f0b3e){return BPromise[_0x18f9('0xb4')]()['then'](cmHopper[_0x18f9('0xbf')](_0x67f216,_0x4c7e5b,_0x5f0b3e))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc0')));};Dialer['prototype'][_0x18f9('0xc1')]=function(_0x12de95,_0x341b7b,_0x101e2d,_0x1e9749,_0x4aae49){return BPromise['resolve']()['then'](cmHopper[_0x18f9('0xc1')](_0x12de95,_0x341b7b,_0x101e2d,_0x1e9749))[_0x18f9('0xaf')](function(_0x34b5ab){_0x4aae49[_0x18f9('0xc2')]-=_0x101e2d;_0x4aae49['temp']=_0x4aae49['temp']>0x0?_0x4aae49[_0x18f9('0xc2')]:0x0;loggerCatch(_0x18f9('0xc3'))(_0x34b5ab);});};Dialer[_0x18f9('0x1b')][_0x18f9('0xc4')]=function(_0x35307a,_0xefa8c9,_0x4e3484,_0x39b536){return BPromise['resolve']()['then'](cmHopper[_0x18f9('0xc4')](_0x35307a,_0xefa8c9,_0x4e3484))[_0x18f9('0xaf')](function(_0x494c27){_0x39b536[_0x18f9('0xc2')]-=_0xefa8c9;_0x39b536[_0x18f9('0xc2')]=_0x39b536[_0x18f9('0xc2')]>0x0?_0x39b536[_0x18f9('0xc2')]:0x0;loggerCatch(_0x18f9('0xc5'))(_0x494c27);});};Dialer[_0x18f9('0x1b')][_0x18f9('0xc6')]=function(_0x296ce1){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](voiceQueueRt['getVoiceQueueRtPauses'](_0x296ce1))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc7')));};Dialer[_0x18f9('0x1b')]['moveContactManagedDialer']=function(_0x2ffbaa){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper[_0x18f9('0xc8')](_0x2ffbaa))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xc9')));};Dialer[_0x18f9('0x1b')][_0x18f9('0xca')]=function(_0x43dd34){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopperHistory[_0x18f9('0xca')](_0x43dd34))['catch'](loggerCatch(_0x18f9('0xcb')));};Dialer['prototype'][_0x18f9('0xb0')]=function(_0x281a7d){if(!_[_0x18f9('0x3e')](_0x281a7d)&&_0x281a7d!==null){if(typeof _0x281a7d[_0x18f9('0x72')]!==_0x18f9('0x97')){if(_0x281a7d[_0x18f9('0x72')]>0x0){_0x281a7d[_0x18f9('0x72')]-=0x1;}else{logger[_0x18f9('0x94')](_0x18f9('0xcc'));}}}else{logger[_0x18f9('0x94')](_0x18f9('0xcd'));}};Dialer[_0x18f9('0x1b')][_0x18f9('0xce')]=function(_0x351f4f,_0xe39f8a){var _0x45258d=this;return function(_0x5bb0de){_0x45258d[_0x18f9('0xb0')](_0xe39f8a);logger['error'](_0x351f4f,util[_0x18f9('0x9a')](_0x5bb0de,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x26cdb4,_0x4596f3,_0x1f6939){var _0x1f4368={'state':0x19,'statedesc':_0x18f9('0xcf')};this[_0x18f9('0xb0')](_0x4596f3);this['saveInDb'](_['merge'](_0x1f4368,_['pick'](_0x1f6939,[_0x18f9('0xd0'),_0x18f9('0xd1'),_0x18f9('0xd2'),_0x18f9('0xd3'),'CampaignId'])),_0x18f9('0xd4'),_0x18f9('0xd5'));logger[_0x18f9('0x94')](_0x26cdb4);};Dialer['prototype'][_0x18f9('0xd6')]=function(_0x37d7d8){return _0x37d7d8===_0x18f9('0xd7');};Dialer['prototype'][_0x18f9('0xd8')]=function(_0x36449b){return!_[_0x18f9('0x3e')](_0x36449b)&&_0x36449b&&!_[_0x18f9('0x3e')](_0x36449b['name'])&&!_[_0x18f9('0x3e')](_0x36449b[_0x18f9('0xd9')])&&_0x36449b[_0x18f9('0xd9')]&&(this['trunks'][util[_0x18f9('0x7d')](_0x18f9('0xda'),_0x36449b[_0x18f9('0x40')])][_0x18f9('0xdb')]===_0x18f9('0xdc')||this[_0x18f9('0x23')][util[_0x18f9('0x7d')](_0x18f9('0xda'),_0x36449b[_0x18f9('0x40')])][_0x18f9('0xdb')]===_0x18f9('0xdd'));};Dialer[_0x18f9('0x1b')][_0x18f9('0xde')]=function(_0x34bc55,_0x5464b8,_0x1b9613){this[_0x18f9('0xca')](_0x34bc55)[_0x18f9('0xaf')](loggerCatch(_0x5464b8));this[_0x18f9('0xc8')](_0x34bc55)[_0x18f9('0xaf')](loggerCatch(_0x1b9613));};Dialer[_0x18f9('0x1b')][_0x18f9('0x35')]=function(_0x4e79ad){var _0x422656=this[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];var _0x2a95ea;if(!_[_0x18f9('0xac')](_0x4e79ad)&&!_[_0x18f9('0xac')](_0x4e79ad[_0x18f9('0xe0')])&&!_[_0x18f9('0xac')](_0x4e79ad[_0x18f9('0xe0')][_0x18f9('0xe1')])&&_0x4e79ad['exten']==='xcally-motion-dialer'&&_0x422656){if(_0x422656[_0x18f9('0x57')]!==_0x18f9('0x7c')&&this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]['dialAMDActive']&&_0x4e79ad['value']===_0x18f9('0xe2')){delete this[_0x18f9('0x26')][_0x4e79ad['uniqueid']];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]);this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;_0x2a95ea=new Hangup(_0x422656,_0x4e79ad);_0x2a95ea[_0x18f9('0xa6')]=0x12;_0x2a95ea[_0x18f9('0xa7')]=_0x18f9('0xe3');_0x2a95ea['membername']=_0x18f9('0xe4');ami[_0x18f9('0x4d')](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2a95ea,'amd'));this[_0x18f9('0xde')](_0x2a95ea,_0x18f9('0xe7'),'[syncHangupInAMD]');}if(_0x422656[_0x18f9('0x57')]!==_0x18f9('0x7c')&&this[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0xe8')]&&_0x4e79ad['value']===_0x18f9('0xe9')){var _0x3df167=this;return new BPromise(function(_0x1d5cb7,_0x54e08f){delete _0x3df167[_0x18f9('0x26')][_0x4e79ad['uniqueid']];_0x3df167['updateOriginated'](_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]]);_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x60')]+=0x1;_0x3df167[_0x18f9('0x20')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;var _0x451b74=_0x3df167[_0x18f9('0x20')][_0x422656['queue']];var _0x2532d3=new Hangup(_0x422656,_0x4e79ad);_0x2532d3[_0x18f9('0xa6')]=0x13;_0x2532d3[_0x18f9('0xa7')]=_0x18f9('0xea');_0x2532d3[_0x18f9('0xeb')]='AMD';_0x2532d3[_0x18f9('0xec')]+=0x1;_0x2532d3[_0x18f9('0xed')]+=0x1;_0x2532d3[_0x18f9('0xee')]=!![];ami[_0x18f9('0x4d')](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2532d3,_0x18f9('0xee')));_0x3df167[_0x18f9('0xca')](_0x2532d3)['catch'](loggerCatch(_0x18f9('0xef')));if(_0x2532d3[_0x18f9('0xf0')]+_0x2532d3[_0x18f9('0xf1')]+_0x2532d3[_0x18f9('0xf2')]+_0x2532d3['countnosuchnumberretry']+_0x2532d3[_0x18f9('0xf3')]+_0x2532d3['countabandonedretry']+_0x2532d3[_0x18f9('0xec')]+_0x2532d3[_0x18f9('0xf4')]>=_0x451b74[_0x18f9('0xf5')]){_0x3df167[_0x18f9('0xf6')](_0x2532d3,_0x1d5cb7,_0x54e08f,_0x18f9('0xf7'));}else{if(_0x2532d3[_0x18f9('0xec')]>=_0x451b74[_0x18f9('0xf8')]){_0x3df167[_0x18f9('0xf9')](_0x2532d3,_0x1d5cb7,_0x54e08f,'reason\x2019\x20machine....');}else{_0x3df167[_0x18f9('0xbd')]({'active':![],'countmachineretry':_0x2532d3[_0x18f9('0xec')],'scheduledat':moment()[_0x18f9('0xfa')](_0x451b74['dialMachineRetryFrequency'],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2532d3[_0x18f9('0xd0')],'ListId':_0x2532d3['ListId'],'VoiceQueueId':_0x2532d3[_0x18f9('0xd3')]||undefined,'CampaignId':_0x2532d3['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));_0x1d5cb7({'reschedule':0x1});}}});}if(_0x422656['type']===_0x18f9('0x7c')&&this[_0x18f9('0x21')][_0x422656['queue']]['dialAMDActive']&&_0x4e79ad[_0x18f9('0xfd')]===_0x18f9('0xe2')){delete this[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this['campaigns'][_0x422656[_0x18f9('0xb1')]]);_0x2a95ea=new Hangup(_0x422656,_0x4e79ad);_0x2a95ea[_0x18f9('0xa6')]=0x12;_0x2a95ea[_0x18f9('0xa7')]=_0x18f9('0xe3');_0x2a95ea[_0x18f9('0xeb')]=_0x18f9('0xe4');ami['emit'](_0x18f9('0xe5'),ut[_0x18f9('0xe6')](_0x2a95ea,_0x18f9('0xee')));this[_0x18f9('0xde')](_0x2a95ea,_0x18f9('0xfe'),'[syncHangupInAMDIvr]');}if(_0x422656[_0x18f9('0x57')]===_0x18f9('0x7c')&&this['campaigns'][_0x422656[_0x18f9('0xb1')]]['dialAMDActive']&&_0x4e79ad[_0x18f9('0xfd')]===_0x18f9('0xe9')){var _0x3df167=this;return new BPromise(function(_0x259a33,_0x35c086){delete _0x3df167[_0x18f9('0x26')][_0x4e79ad[_0x18f9('0xdf')]];_0x3df167['updateOriginated'](_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]]);_0x3df167[_0x18f9('0x21')][_0x422656['queue']]['outboundAnswerCallsDay']+=0x1;_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;var _0x363d8d=_0x3df167[_0x18f9('0x21')][_0x422656[_0x18f9('0xb1')]];var _0x3dc5e6=new Hangup(_0x422656,_0x4e79ad);_0x3dc5e6['state']=0x13;_0x3dc5e6[_0x18f9('0xa7')]=_0x18f9('0xea');_0x3dc5e6[_0x18f9('0xeb')]=_0x18f9('0xe4');_0x3dc5e6[_0x18f9('0xec')]+=0x1;_0x3dc5e6[_0x18f9('0xed')]+=0x1;_0x3dc5e6[_0x18f9('0xee')]=!![];ami[_0x18f9('0x4d')]('custom:amd',ut[_0x18f9('0xe6')](_0x3dc5e6,'amd'));_0x3df167['createHistory'](_0x3dc5e6)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xef')));if(_0x3dc5e6['countbusyretry']+_0x3dc5e6[_0x18f9('0xf1')]+_0x3dc5e6[_0x18f9('0xf2')]+_0x3dc5e6[_0x18f9('0xff')]+_0x3dc5e6[_0x18f9('0xf3')]+_0x3dc5e6[_0x18f9('0x100')]+_0x3dc5e6['countmachineretry']+_0x3dc5e6[_0x18f9('0xf4')]>=_0x363d8d[_0x18f9('0xf5')]){_0x3df167[_0x18f9('0xf6')](_0x3dc5e6,_0x259a33,_0x35c086,'reason19\x20machine....');}else{if(_0x3dc5e6[_0x18f9('0xec')]>=_0x363d8d['dialMachineMaxRetry']){_0x3df167[_0x18f9('0xf9')](_0x3dc5e6,_0x259a33,_0x35c086,_0x18f9('0x101'));}else{_0x3df167['rescheduleContact']({'active':![],'countmachineretry':_0x3dc5e6['countmachineretry'],'scheduledat':moment()[_0x18f9('0xfa')](_0x363d8d[_0x18f9('0x102')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x3dc5e6['ContactId'],'ListId':_0x3dc5e6['ListId'],'VoiceQueueId':_0x3dc5e6['VoiceQueueId']||undefined,'CampaignId':_0x3dc5e6[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));_0x259a33({'reschedule':0x1});}}});}}};Dialer[_0x18f9('0x1b')]['syncHangup']=function(_0x6746c5){var _0x277f94=this['uniqueId'][_0x6746c5[_0x18f9('0xdf')]];var _0x42b580=this;var _0x5aed9e;if(_0x277f94&&_0x277f94[_0x18f9('0x57')]===_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this['updateOriginated'](this[_0x18f9('0x21')][_0x277f94[_0x18f9('0xb1')]]);this[_0x18f9('0x21')][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x105')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this[_0x18f9('0xc8')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x107')));}if(_0x277f94&&_0x277f94['type']!==_0x18f9('0x7c')&&isNotNull(this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]]['dialQueueProject'])){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]]);this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x60')]+=0x1;this['voiceQueues'][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x5f')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);_0x5aed9e[_0x18f9('0xa6')]=0x10;_0x5aed9e[_0x18f9('0xa7')]='AnswerAGI';_0x5aed9e[_0x18f9('0xeb')]='AGI';this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this[_0x18f9('0xc8')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x107')));}if(_0x277f94&&_0x277f94[_0x18f9('0x57')]!==_0x18f9('0x7c')&&!isNotNull(this[_0x18f9('0x20')][_0x277f94['queue']][_0x18f9('0x108')])){delete this[_0x18f9('0x26')][_0x6746c5[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x277f94[_0x18f9('0xb1')]]);this[_0x18f9('0x20')][_0x277f94[_0x18f9('0xb1')]][_0x18f9('0x109')]+=0x1;_0x5aed9e=new Hangup(_0x277f94,_0x6746c5);_0x5aed9e[_0x18f9('0xa6')]=0xc;_0x5aed9e[_0x18f9('0xa7')]=_0x6746c5['cause-txt'];_0x5aed9e[_0x18f9('0xeb')]='Unknow';this[_0x18f9('0xca')](_0x5aed9e)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x106')));this['moveContactManagedDialer'](_0x5aed9e)['catch'](loggerCatch(_0x18f9('0x107')));}};Dialer[_0x18f9('0x1b')]['syncAgentComplete']=function(_0x489cfe){var _0x555302=this[_0x18f9('0x26')][_0x489cfe[_0x18f9('0xdf')]];var _0x59ffa1=this;if(this['voiceQueues'][_0x489cfe[_0x18f9('0xb1')]]){if(_0x555302&&_0x555302['type']!==_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0x489cfe['uniqueid']];this[_0x18f9('0x20')][_0x489cfe['queue']][_0x18f9('0x60')]+=0x1;var _0x37600b=new AgentComplete(_0x555302,_0x489cfe);if(_0x489cfe[_0x18f9('0x10a')]===_0x18f9('0x10b')){_0x37600b[_0x18f9('0x10c')]=this[_0x18f9('0x20')][_0x489cfe[_0x18f9('0xb1')]][_0x18f9('0x10d')]&&this[_0x18f9('0x20')][_0x489cfe[_0x18f9('0xb1')]][_0x18f9('0x10e')]?moment()[_0x18f9('0x7d')](_0x18f9('0x103')):undefined;}this[_0x18f9('0xca')](_0x37600b)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x10f')));this['moveContactManagedDialer'](_0x37600b)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x110')));}}};Dialer[_0x18f9('0x1b')][_0x18f9('0x2a')]=function(_0x156716){if(this[_0x18f9('0x20')][_0x156716[_0x18f9('0xb1')]]){if(this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]]&&this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]][_0x18f9('0x57')]!==_0x18f9('0x7c')){this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0x156716[_0x18f9('0xb1')]]);this[_0x18f9('0x26')][_0x156716[_0x18f9('0xdf')]][_0x18f9('0x111')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));}}};Dialer['prototype'][_0x18f9('0x112')]=function(_0x1ea864){this[_0x18f9('0xca')](_0x1ea864)['catch'](loggerCatch(_0x18f9('0x10f')));this[_0x18f9('0xc8')](_0x1ea864)['catch'](loggerCatch(_0x18f9('0x113')));};Dialer[_0x18f9('0x1b')]['syncQueueCallerAbandon']=function(_0xa13520){var _0x4a6ca1=this[_0x18f9('0x26')][_0xa13520[_0x18f9('0xdf')]];var _0x3bfe99=this;if(this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]){if(_0x4a6ca1&&_0x4a6ca1[_0x18f9('0x57')]!==_0x18f9('0x7c')){delete this[_0x18f9('0x26')][_0xa13520[_0x18f9('0xdf')]];this[_0x18f9('0xb0')](this[_0x18f9('0x20')][_0xa13520['queue']]);_0x4a6ca1[_0x18f9('0x114')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));var _0x3020aa=new QueueCallerAbandon(_0x4a6ca1,_0xa13520);if(getSeconds(_0x4a6ca1[_0x18f9('0x114')],_0x4a6ca1[_0x18f9('0x115')])>=_0x4a6ca1['dialQueueTimeout']){this[_0x18f9('0x20')][_0xa13520['queue']][_0x18f9('0x85')]+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x65')]+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x6d')]+=0x1;_0x3020aa['state']=0xa;_0x3020aa[_0x18f9('0xa7')]=_0x18f9('0x116');_0x3020aa['dropreason']=_0x18f9('0x117');_0x3020aa[_0x18f9('0x10c')]=this[_0x18f9('0x20')][_0xa13520['queue']]['dialQueueProject2']?moment()[_0x18f9('0x7d')](_0x18f9('0x103')):undefined;_0x3020aa['countdropretry']+=0x1;_0x3020aa['countglobal']+=0x1;if(_0x3020aa['countdropretry']>=this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x118')]){this[_0x18f9('0x112')](_0x3020aa);}else{this[_0x18f9('0xbd')]({'active':![],'countdropretry':_0x3020aa[_0x18f9('0xf3')],'scheduledat':moment()['add'](this['voiceQueues'][_0xa13520[_0x18f9('0xb1')]]['dialDropRetryFrequency'],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x4a6ca1['ContactId'],'ListId':_0x4a6ca1['ListId'],'VoiceQueueId':_0x4a6ca1[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4a6ca1[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x119')));var _0x228792=new History(_0x3020aa);_0x228792['state']=0xa;_0x228792[_0x18f9('0xa7')]='Drop';_0x228792[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x228792[_0x18f9('0x11b')]=_0x228792['starttime'];_0x228792['calleridname']=_0x3020aa['calleridname'];_0x228792[_0x18f9('0x11c')]=_0x3020aa[_0x18f9('0x11c')];this[_0x18f9('0xca')](_0x228792)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x11d')));}}else{this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x18f9('0x20')][_0xa13520[_0x18f9('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x3020aa[_0x18f9('0xa6')]=0xb;_0x3020aa['statedesc']=_0x18f9('0x11e');_0x3020aa[_0x18f9('0x11f')]='CALLEREXIT';_0x3020aa['countabandonedretry']+=0x1;_0x3020aa['countglobal']+=0x1;if(_0x3020aa[_0x18f9('0x100')]>=this['voiceQueues'][_0xa13520[_0x18f9('0xb1')]][_0x18f9('0x120')]){this[_0x18f9('0x112')](_0x3020aa);}else{this[_0x18f9('0xbd')]({'active':![],'countabandonedretry':_0x3020aa[_0x18f9('0x100')],'scheduledat':moment()[_0x18f9('0xfa')](this[_0x18f9('0x20')][_0xa13520['queue']][_0x18f9('0x121')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x4a6ca1[_0x18f9('0xd0')],'ListId':_0x4a6ca1['ListId'],'VoiceQueueId':_0x4a6ca1[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4a6ca1['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x228792=new History(_0x3020aa);_0x228792[_0x18f9('0xa6')]=0xb;_0x228792[_0x18f9('0xa7')]=_0x18f9('0x11e');_0x228792[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x228792[_0x18f9('0x11b')]=_0x228792['starttime'];_0x228792[_0x18f9('0x122')]=_0x3020aa[_0x18f9('0x122')];_0x228792[_0x18f9('0x11c')]=_0x3020aa[_0x18f9('0x11c')];this[_0x18f9('0xca')](_0x228792)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x123')));}}}}};Dialer['prototype'][_0x18f9('0x33')]=function(_0x33032d){if(this[_0x18f9('0xa9')][_0x33032d[_0x18f9('0xdf')]]){this[_0x18f9('0xa9')][_0x33032d[_0x18f9('0xdf')]]['channel']=_0x33032d[_0x18f9('0xae')];}if(this[_0x18f9('0x26')][_0x33032d[_0x18f9('0xdf')]]){this[_0x18f9('0x26')][_0x33032d[_0x18f9('0xdf')]][_0x18f9('0xae')]=_0x33032d['channel'];}};Dialer[_0x18f9('0x1b')]['syncQueueMember']=function(_0x250888){if(strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]===_0x18f9('0x1a')){if(this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]&&_['isNil'](this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['locked'])&&_0x250888[_0x18f9('0xdb')]==='1'&&_0x250888[_0x18f9('0x125')]==='0'){if(this['agents'][_0x250888[_0x18f9('0x126')]]){if(!this['agents'][_0x250888[_0x18f9('0x126')]][_0x18f9('0x127')]){this[_0x18f9('0x22')][_0x250888['stateinterface']][_0x18f9('0x127')]=!![];this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['locked']=!![];this['actions'][_0x250888[_0x18f9('0x124')]][_0x18f9('0x126')]=_0x250888[_0x18f9('0x126')];}}}}else if((strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]['queue']][_0x18f9('0x4f')]]||_0x18f9('0x128'))==='rrmemory'){if(this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]]){if(this[_0x18f9('0x22')][_0x250888[_0x18f9('0x126')]]){this['actions'][_0x250888[_0x18f9('0x124')]][_0x18f9('0x126')]=_0x250888[_0x18f9('0x126')];if(_['isNil'](this['queueBooked'][this[_0x18f9('0xa9')][_0x250888['actionid']]['queue']])){this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]]=[];}this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x12a')](_[_0x18f9('0x8c')](_[_0x18f9('0x12b')](this[_0x18f9('0xa9')][_0x250888[_0x18f9('0x124')]],[_0x18f9('0x12c'),_0x18f9('0x126')]),{'status':_0x250888['status'],'paused':_0x250888['paused']}));}}}};function unlockQueueStatus(_0x22d7bc,_0x27e620){setTimeout(function(){if(_[_0x18f9('0x3e')](_0x22d7bc['queueStatusComplete'])){loggerBooked[_0x18f9('0x94')]('[unlockQueueStatus][undefined]',_0x27e620);}_0x22d7bc[_0x18f9('0x12d')]=!![];loggerBooked[_0x18f9('0x80')](_0x18f9('0x12e'),_0x27e620,JSON['stringify'](_[_0x18f9('0x12b')](_0x22d7bc,[_0x18f9('0x40'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x18f9('0x1b')]['syncQueueStatusComplete']=function(_0x4a0dbb){var _0x4c949=this;var _0x1d28b4=_0x4c949[_0x18f9('0x20')][_0x4c949['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]];if(strategy[this['voiceQueues'][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]===_0x18f9('0x1a')){if(this['actions'][_0x4a0dbb[_0x18f9('0x124')]]&&this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')]){this['preview'][_0x18f9('0x12f')](this['actions'][_0x4a0dbb[_0x18f9('0x124')]]['idHopper'],this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')])['catch'](function(_0x2aa96b){logger['error'](_0x18f9('0x130'),util['inspect'](_0x2aa96b,{'showHidden':![],'depth':null}));})[_0x18f9('0x131')](function(){_0x4c949[_0x18f9('0xb0')](_0x4c949['voiceQueues'][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]]['queue']]);_0x4c949[_0x18f9('0x22')][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x126')]][_0x18f9('0x127')]=![];delete _0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]];unlockQueueStatus(_0x1d28b4);});}else{this[_0x18f9('0xb0')](this[_0x18f9('0x20')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xd0')],'ListId':this['actions'][_0x4a0dbb['actionid']][_0x18f9('0xd1')],'VoiceQueueId':this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xd3')]||undefined,'CampaignId':this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x132')));delete this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]];unlockQueueStatus(_0x1d28b4);}}else if((strategy[this[_0x18f9('0x20')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]][_0x18f9('0x4f')]]||'rrmemory')===_0x18f9('0x128')){var _0x264400;if(this['actions'][_0x4a0dbb[_0x18f9('0x124')]]&&!_[_0x18f9('0x46')](this[_0x18f9('0x129')][this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]])){if(this[_0x18f9('0x133')][_0x4c949[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]){this[_0x18f9('0x133')][_0x4c949['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]=this[_0x18f9('0x133')][this[_0x18f9('0xa9')][_0x4a0dbb['actionid']][_0x18f9('0xb1')]]?this[_0x18f9('0x133')][this[_0x18f9('0xa9')][_0x4a0dbb['actionid']][_0x18f9('0xb1')]]:this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]?this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]['_rr']||0x0:0x0;}this[_0x18f9('0x129')][this[_0x18f9('0xa9')][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]]['_rr']=this[_0x18f9('0x133')][this['actions'][_0x4a0dbb[_0x18f9('0x124')]][_0x18f9('0xb1')]];for(var _0x35ae9d=0x0;_0x35ae9d=0x0;})[_0x18f9('0xaf')](myreject(_0x4f3374)));}}else{_0x44d49d[_0x18f9('0x12a')](ami[_0x18f9('0xad')]({'action':'command','command':util[_0x18f9('0x7d')](_0x18f9('0x148'),_0x5c6535,!_['isUndefined'](config[_0x18f9('0x145')][_0x4010e9])?_0x4010e9:'')})[_0x18f9('0xb5')](function(_0x30b14c){return _0x30b14c[_0x18f9('0x14b')][_0x18f9('0x14a')](_0x18f9('0x14c'))>=0x0;})[_0x18f9('0xaf')](myreject(_0x4f3374)));}BPromise['all'](_0x44d49d)[_0x18f9('0xb5')](function(_0x38ef2a){var _0x2cbb38=_[_0x18f9('0x14d')](_0x38ef2a);if(_0x2cbb38){return _0x4097ea(_0x2cbb38);}else{_0x1f96db[_0x18f9('0x3f')]=_0xa63762?_0x18f9('0x14e'):_0x18f9('0x14f');return _0x4f3374(msgResponse(_0x18f9('0x150'),'Failure',_0x18f9('0x151')+_0xa63762+'\x20'+_0x1ad6bc+'\x20Interval\x20is\x20overtime:\x20'+util[_0x18f9('0x9a')](_0x5c6535,{'showHidden':![],'depth':null})+_0x18f9('0x152')+_0x4010e9));}})['catch'](function(_0x340a8e){return _0x4f3374(msgResponse(_0x18f9('0x140'),'Failure',JSON[_0x18f9('0x4a')](_0x340a8e)));});});};Dialer['prototype']['checkDialMethod']=function(_0x2b2e98){var _0x115c67=this;return function(){switch(_0x2b2e98[_0x18f9('0x153')]){case'progressive':freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,0x1);break;case _0x18f9('0x155'):freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,_0x2b2e98['dialPowerLevel']);break;case _0x18f9('0xb'):_0x115c67[_0x18f9('0xb')](_0x2b2e98);break;case _0x18f9('0xa'):freeVariablesPredictive(_0x2b2e98);_0x115c67[_0x18f9('0x154')](_0x2b2e98,0x1);break;default:freeVariablesPredictive(_0x2b2e98);logger[_0x18f9('0x94')]('Queue',_0x2b2e98[_0x18f9('0x40')],_0x18f9('0x156'));}};};Dialer[_0x18f9('0x1b')]['checkPreviewRecallReminder']=function(_0x5d9c4a){return BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](cmHopper[_0x18f9('0x157')](_0x5d9c4a['id'],previewRecallmeReminderInterval))[_0x18f9('0xb5')](function(_0xc0fa47){for(var _0x19619f=0x0;_0x19619f<_0xc0fa47['length'];_0x19619f++){var _0x5986f6=_0xc0fa47[_0x19619f][_0x18f9('0x158')][_0x18f9('0x40')];if(_0x5986f6)io['to'](util[_0x18f9('0x7d')](_0x18f9('0x159'),_0x5986f6))[_0x18f9('0x4d')]('user:dialPreviewRecallReminder',{'hopper':_0xc0fa47[_0x19619f]});}})[_0x18f9('0xaf')](function(_0x19f316){});};Dialer[_0x18f9('0x1b')]['launchHandleIvr']=function(_0x12f645){var _0x3c4345=this;return function(){_0x3c4345[_0x18f9('0x15a')](_0x12f645);};};Dialer[_0x18f9('0x1b')][_0x18f9('0xd')]=function(_0xfe6f82){var _0x13e085=this;if(isNotPreview(_0xfe6f82[_0x18f9('0x153')])){if(isVoiceQueueOutbound(_0xfe6f82[_0x18f9('0x57')])&&isActive(_0xfe6f82[_0x18f9('0x5b')])){_0xfe6f82[_0x18f9('0xa0')]=!![];BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](checkIsLoggedIn(_0xfe6f82,_0xfe6f82[_0x18f9('0x51')]))[_0x18f9('0xb5')](checkIsActive(_0xfe6f82,_0xfe6f82[_0x18f9('0x5b')]))['then'](checkInterval(_0xfe6f82))[_0x18f9('0xb5')](_0x13e085[_0x18f9('0x13c')](_0xfe6f82))[_0x18f9('0xb5')](_0x13e085[_0x18f9('0x15b')](_0xfe6f82[_0x18f9('0x15c')],_0xfe6f82[_0x18f9('0x15d')],_0xfe6f82[_0x18f9('0x40')],_0xfe6f82))[_0x18f9('0xb5')](_0x13e085['checkIfTimeIntervals'](_0xfe6f82['Interval'],_0xfe6f82['dialTimezone'],_0xfe6f82[_0x18f9('0x40')],_0xfe6f82))[_0x18f9('0xb5')](_0x13e085['checkDialMethod'](_0xfe6f82))[_0x18f9('0xaf')](loggerCatchQueueSummary('[syncQueueSummary]',_0xfe6f82));}else{notSendMessagesQueue(_0xfe6f82);}}else{freeVariablesPredictive(_0xfe6f82);if(_0xfe6f82[_0x18f9('0x15e')]){_0x13e085[_0x18f9('0x15f')](_0xfe6f82);}}};Dialer['prototype'][_0x18f9('0x13b')]=function(){var _0x25894b=this;var _0x5c3cfa;for(var _0x197b92 in this[_0x18f9('0x21')]){if(typeof this[_0x18f9('0x21')][_0x197b92]!==_0x18f9('0x97')){_0x5c3cfa=this['campaigns'][_0x197b92];if(isCampaignIvr(_0x5c3cfa[_0x18f9('0x57')])&&isActive(_0x5c3cfa['active'])){_0x5c3cfa['sendMessageOneNotActive']=!![];BPromise[_0x18f9('0xb4')]()[_0x18f9('0xb5')](checkIsActive(_0x5c3cfa,_0x5c3cfa[_0x18f9('0xd9')]))[_0x18f9('0xb5')](checkInterval(_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x13c')](_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b['checkIfTime'](_0x5c3cfa[_0x18f9('0x15c')],_0x5c3cfa[_0x18f9('0x15d')],_0x5c3cfa['name'],_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x13f')](_0x5c3cfa[_0x18f9('0x47')],_0x5c3cfa['dialTimezone'],_0x5c3cfa[_0x18f9('0x40')],_0x5c3cfa))[_0x18f9('0xb5')](_0x25894b[_0x18f9('0x160')](_0x5c3cfa))['catch'](loggerCatchQueueSummary(_0x18f9('0x161'),_0x5c3cfa));}else{notSendMessagesCampaign(_0x5c3cfa);}}}};function getCallerIdRandom(_0x1fc34e,_0x1e9f0c){var _0x500af1;var _0x273fc4;var _0xd0e840;if(_0x1e9f0c<=0x0){_0x1e9f0c=0x1;}_0x500af1=new RegExp(_0x18f9('0x162')+_0x1e9f0c+'}$');_0x273fc4=Math[_0x18f9('0x163')](0xa,_0x1e9f0c-0x1);_0xd0e840=Math[_0x18f9('0x163')](0xa,_0x1e9f0c)-0x1;return util[_0x18f9('0x7d')]('%s',_[_0x18f9('0x164')](_0x1fc34e,_0x500af1,_[_0x18f9('0x165')](_0x273fc4,_0xd0e840)));}function extractCalleridName(_0x14fc39){var _0xf7f47b=_0x14fc39[_0x18f9('0x166')](/"(.*?)"/);return _0xf7f47b?_0xf7f47b[0x1]:_0x14fc39;}function extractCalleridNumber(_0x5d13f3){var _0x4cfb60=_0x5d13f3[_0x18f9('0x166')](/<(.*?)>/);return _0x4cfb60?_0x4cfb60[0x1]:_0x5d13f3;}Dialer[_0x18f9('0x1b')][_0x18f9('0x167')]=function(_0x3c2985,_0x4a9f6e){var _0x17d204=this;var _0x66dbf8=uuid['v4']();this['actions'][_0x66dbf8]=new Action(_0x3c2985,_0x4a9f6e,_0x66dbf8);return new BPromise(function(_0x5b0aff,_0xbe3115){if(_[_0x18f9('0x3e')](_0x3c2985)&&typeof _0x3c2985!==_0x18f9('0x168')){return _0xbe3115(msgResponse('originate',_0x18f9('0x143'),_0x18f9('0x169')));}if(_['isUndefined'](_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')])||_0x4a9f6e[_0x18f9('0x16a')]['phone']===null){return _0xbe3115(msgResponse(_0x18f9('0x16c'),_0x18f9('0x143'),_0x18f9('0x16d')));}var _0x3bd6a0={'XMD-CALLERID':_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x16e')](),'XMD-AGI':_0x3c2985['dialQueueProject']?util[_0x18f9('0x7d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c2985[_0x18f9('0x108')]):'NONE','XMD-AGIAFTER':_0x3c2985[_0x18f9('0x10d')]?util['format'](_0x18f9('0x16f'),ipAgi,_0x3c2985[_0x18f9('0x10d')]):_0x18f9('0x170'),'XMD-QUEUE':_0x3c2985[_0x18f9('0x57')]==='outbound'?util[_0x18f9('0x7d')]('\x22%s,%s%s,,,%s\x22',_0x3c2985[_0x18f9('0x40')],_0x3c2985['dialQueueOptions']||'',_0x3c2985[_0x18f9('0x10e')]?'c':'',_0x3c2985[_0x18f9('0x171')]||0x3):_0x18f9('0x170'),'XMD-CONTACTID':_0x4a9f6e['ContactId'],'XMD-CDRTYPE':_0x18f9('0x9'),'CALLERID(all)':_0x17d204['actions'][_0x66dbf8]['getCaller'](),'XMD-AMD':_0x3c2985[_0x18f9('0xe8')]?_0x18f9('0x172'):_0x18f9('0x170'),'XMD-DESTINATION':_0x18f9('0x173')};if(_0x3c2985[_0x18f9('0xe8')]){_0x3bd6a0[_0x18f9('0x174')]=_0x3c2985[_0x18f9('0x175')]||0x9c4;_0x3bd6a0['XMD-AMDGREETING']=_0x3c2985['dialAMDGreeting']||0x5dc;_0x3bd6a0['XMD-AMDAFTERGREETINGSILENCE']=_0x3c2985['dialAMDAfterGreetingSilence']||0x320;_0x3bd6a0[_0x18f9('0x176')]=_0x3c2985[_0x18f9('0x177')]||0x1388;_0x3bd6a0[_0x18f9('0x178')]=_0x3c2985[_0x18f9('0x179')]||0x64;_0x3bd6a0['XMD-AMDBETWEENWORDSSILENCE']=_0x3c2985[_0x18f9('0x17a')]||0x32;_0x3bd6a0[_0x18f9('0x17b')]=_0x3c2985[_0x18f9('0x17c')]||0x3;_0x3bd6a0[_0x18f9('0x17d')]=_0x3c2985[_0x18f9('0x17e')]||0x100;_0x3bd6a0[_0x18f9('0x17f')]=_0x3c2985[_0x18f9('0x180')]||0x1388;}if(_0x3c2985[_0x18f9('0x57')]===_0x18f9('0x4e')){_0x3bd6a0['XMD-VOICEQUEUEID']=_0x4a9f6e[_0x18f9('0xd3')];}else{_0x3bd6a0[_0x18f9('0x181')]=_0x4a9f6e[_0x18f9('0x104')];}for(var _0x8a2e06 in _0x4a9f6e[_0x18f9('0x16a')]){if(typeof _0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06]!==_0x18f9('0x97')){if(isNotNull(_0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06])&&_0x8a2e06!=='id'&&_0x8a2e06!=='tags'&&_0x8a2e06!==_0x18f9('0x182')&&_0x8a2e06!==_0x18f9('0x183')){_0x3bd6a0[util[_0x18f9('0x7d')]('%s%s',_0x18f9('0x184'),_[_0x18f9('0x185')](_0x8a2e06))]=_0x4a9f6e[_0x18f9('0x16a')][_0x8a2e06];}}}var _0x534975=_0x17d204[_0x18f9('0xd8')](_0x3c2985[_0x18f9('0x78')])?getCallerId(_0x3c2985[_0x18f9('0x78')]['callerid'],_0x3c2985[_0x18f9('0x186')],_0x3c2985[_0x18f9('0x187')]>0x0?getCallerIdRandom(_0x3c2985[_0x18f9('0x5c')],_0x3c2985['dialRandomLastDigitCallerIdNumber']):_0x3c2985[_0x18f9('0x5c')]):getCallerId(_[_0x18f9('0xac')](_0x3c2985[_0x18f9('0x13d')])?_0x3c2985['Trunk'][_0x18f9('0x79')]:_0x3c2985[_0x18f9('0x13d')][_0x18f9('0x79')],_0x3c2985[_0x18f9('0x186')],_0x3c2985['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3c2985[_0x18f9('0x5c')],_0x3c2985[_0x18f9('0x187')]):_0x3c2985['dialOriginateCallerIdNumber']);if(_0x534975){_0x3bd6a0['XMD-ORIGINATECALLERIDNAME']=_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x188')]=extractCalleridName(_0x534975);_0x3bd6a0['XMD-ORIGINATECALLERIDNUM']=_0x17d204[_0x18f9('0xa9')][_0x66dbf8][_0x18f9('0x189')]=extractCalleridNumber(_0x534975);}return ami[_0x18f9('0xad')]({'actionid':_0x66dbf8,'action':_0x18f9('0x16c'),'channel':_0x17d204[_0x18f9('0xd8')](_0x3c2985[_0x18f9('0x78')])?util['format'](_0x18f9('0x18a'),_0x3c2985['Trunk'][_0x18f9('0x40')],isNotNull(_0x3c2985[_0x18f9('0x5e')])?_0x3c2985[_0x18f9('0x5e')][_0x18f9('0x18b')]()||'':'',_0x3c2985[_0x18f9('0x18c')]>0x0?_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')][_0x18f9('0x18d')](_0x3c2985[_0x18f9('0x18c')]):_0x4a9f6e[_0x18f9('0x16a')]['phone']):util[_0x18f9('0x7d')](_0x18f9('0x18a'),_[_0x18f9('0xac')](_0x3c2985[_0x18f9('0x13d')])?_0x3c2985[_0x18f9('0x78')][_0x18f9('0x40')]:_0x3c2985[_0x18f9('0x13d')][_0x18f9('0x40')],isNotNull(_0x3c2985[_0x18f9('0x5e')])?_0x3c2985[_0x18f9('0x5e')][_0x18f9('0x18b')]()||'':'',_0x3c2985[_0x18f9('0x18c')]>0x0?_0x4a9f6e[_0x18f9('0x16a')][_0x18f9('0x16b')]['substring'](_0x3c2985[_0x18f9('0x18c')]):_0x4a9f6e['Contact']['phone']),'callerid':_0x534975,'Exten':_0x18f9('0x173'),'Context':_0x18f9('0x18e'),'Priority':'1','variable':_0x3bd6a0,'timeout':(_0x3c2985['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x66dbf8})[_0x18f9('0xb5')](function(_0x14414c){return _0x5b0aff(_0x14414c);})[_0x18f9('0xaf')](function(_0x435438){_0x3c2985[_0x18f9('0x68')]+=0x1;var _0x165a7c=new History(_0x17d204[_0x18f9('0xa9')][_0x66dbf8]);logger[_0x18f9('0x94')](util[_0x18f9('0x7d')](_0x18f9('0x18f'),JSON[_0x18f9('0x4a')](_0x435438)));_0x165a7c[_0x18f9('0xa6')]=0xe;_0x165a7c[_0x18f9('0xa7')]=_0x18f9('0x190');_0x165a7c[_0x18f9('0x11a')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));_0x165a7c[_0x18f9('0x11b')]=_0x165a7c[_0x18f9('0x11a')];_0x17d204[_0x18f9('0xca')](_0x165a7c)['catch'](loggerCatch(_0x18f9('0x191')));_0x17d204[_0x18f9('0xc8')](_0x165a7c)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x191')))[_0x18f9('0x131')](function(){delete _0x17d204[_0x18f9('0xa9')][_0x66dbf8];return _0xbe3115(msgResponse(_0x18f9('0x16c'),'Error',_0x18f9('0x192')));});});});};Dialer[_0x18f9('0x1b')][_0x18f9('0x2f')]=function(_0x2702f4){var _0x438e30=this[_0x18f9('0xa9')][_0x2702f4[_0x18f9('0x124')]];if(_0x438e30){delete this['actions'][_0x2702f4[_0x18f9('0x124')]];_0x438e30[_0x18f9('0x115')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));var _0x33b091=_0x438e30[_0x18f9('0x57')]===_0x18f9('0x7c')?this['campaigns'][_0x438e30['queue']]:this[_0x18f9('0x20')][_0x438e30[_0x18f9('0x193')]()];if(!this['isSuccess'](_0x2702f4[_0x18f9('0x194')])){this['updateOriginated'](_0x33b091);return this[_0x18f9('0x195')](_0x438e30,_0x33b091,_0x2702f4)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x196')));}this[_0x18f9('0x26')][_0x2702f4[_0x18f9('0xdf')]]=_0x438e30;}};Dialer[_0x18f9('0x1b')]['checkRetriveMax']=function(_0x4b188e,_0x27c5b9,_0x4f9472){var _0x5919c0=new History(_0x27c5b9);if(_0x5919c0[_0x18f9('0xf0')]+_0x5919c0['countcongestionretry']+_0x5919c0['countnoanswerretry']+_0x5919c0[_0x18f9('0xff')]+_0x5919c0[_0x18f9('0xf3')]+_0x5919c0[_0x18f9('0x100')]+_0x5919c0[_0x18f9('0xec')]+_0x5919c0[_0x18f9('0xf4')]>=_0x4f9472[_0x18f9('0xf5')]-0x1){return!![];}switch(_0x4b188e){case 0x3:if(_0x5919c0[_0x18f9('0xf2')]>=_0x4f9472[_0x18f9('0x197')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countnoanswerretry':_0x5919c0['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x198')],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0['VoiceQueueId']||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x199')));break;case 0x5:if(_0x5919c0['countbusyretry']>=_0x4f9472[_0x18f9('0x19a')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countbusyretry':_0x5919c0[_0x18f9('0xf0')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x19b')],'minutes')[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5919c0[_0x18f9('0xf1')]>=_0x4f9472[_0x18f9('0x19c')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countcongestionretry':_0x5919c0[_0x18f9('0xf1')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x19d')],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x19e')));break;case 0x0:if(_0x5919c0[_0x18f9('0xff')]>=_0x4f9472[_0x18f9('0x19f')]-0x1){return!![];}else{this[_0x18f9('0xbd')]({'active':![],'countnosuchnumberretry':_0x5919c0['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472['dialNoSuchNumberRetryFrequency'],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0['VoiceQueueId']||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a0')));}break;case 0xa:if(_0x5919c0[_0x18f9('0xf3')]>=_0x4f9472[_0x18f9('0x118')]-0x1){return!![];}this[_0x18f9('0xbd')]({'active':![],'countdropretry':_0x5919c0['countdropretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x1a1')],_0x18f9('0xfb'))[_0x18f9('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0['CampaignId']||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x119')));break;case 0xb:if(_0x5919c0['countabandonedretry']>=_0x4f9472[_0x18f9('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x5919c0[_0x18f9('0x100')]+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472['dialAbandonedRetryFrequency'],'minutes')[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0['ContactId'],'ListId':_0x5919c0['ListId'],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a2')));break;case 0x13:if(_0x5919c0['countmachineretry']>=_0x4f9472['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x5919c0[_0x18f9('0xec')]+=0x1,'scheduledat':moment()['add'](_0x4f9472[_0x18f9('0x102')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0xfc')));break;case 0x14:if(_0x5919c0[_0x18f9('0xf4')]>=_0x4f9472[_0x18f9('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x5919c0['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x18f9('0xfa')](_0x4f9472[_0x18f9('0x1a4')],_0x18f9('0xfb'))[_0x18f9('0x7d')](_0x18f9('0x103')),'ContactId':_0x5919c0[_0x18f9('0xd0')],'ListId':_0x5919c0[_0x18f9('0xd1')],'VoiceQueueId':_0x5919c0[_0x18f9('0xd3')]||undefined,'CampaignId':_0x5919c0[_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1a5')));break;default:return!![];}};Dialer[_0x18f9('0x1b')][_0x18f9('0x195')]=function(_0x5d9ef8,_0x397a39,_0x40709c){var _0x485b3a=this;var _0x132d02=new History(_0x5d9ef8);return new BPromise(function(_0x54868a,_0x5dd119){if(_[_0x18f9('0x3e')](_0x397a39)&&typeof _0x397a39!=='object'){return _0x5dd119(msgResponse('[callProgressDetecting]',_0x18f9('0x143'),'entity\x20is\x20undefine'));}if(_[_0x18f9('0x3e')](_0x40709c)&&typeof _0x40709c!==_0x18f9('0x168')){return _0x5dd119(msgResponse('[callProgressDetecting]','Failure',_0x18f9('0x1a6')));}switch(_0x40709c['reason']){case'0':_0x397a39[_0x18f9('0x67')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x0;_0x132d02[_0x18f9('0xa7')]=_0x18f9('0x1a7');_0x132d02[_0x18f9('0xff')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit'](_0x18f9('0x1a8'),ut[_0x18f9('0xe6')](_0x5d9ef8,_0x18f9('0x1a9')));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x485b3a[_0x18f9('0x1aa')](0x0,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xff')]>=_0x397a39[_0x18f9('0x19f')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1ab'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1ab'));}}break;case'3':_0x397a39[_0x18f9('0x66')]+=0x1;_0x132d02['state']=0x3;_0x132d02['statedesc']=_0x18f9('0x1ac');_0x132d02[_0x18f9('0xf2')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami[_0x18f9('0x4d')]('custom:agentnoanswer',ut['buildObj'](_0x5d9ef8,_0x18f9('0x1ad')));_0x485b3a[_0x18f9('0xca')](_0x132d02)['catch'](loggerCatch(_0x18f9('0x1ae')));if(_0x485b3a[_0x18f9('0x1aa')](0x3,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf2')]>=_0x397a39[_0x18f9('0x197')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1af'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1af'));}}break;case'5':_0x397a39[_0x18f9('0x61')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x5;_0x132d02[_0x18f9('0xa7')]=_0x18f9('0x1b0');_0x132d02[_0x18f9('0xf0')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami[_0x18f9('0x4d')](_0x18f9('0x1b1'),ut['buildObj'](_0x5d9ef8,_0x18f9('0x1b2')));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1b3')));if(_0x485b3a[_0x18f9('0x1aa')](0x5,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf0')]>=_0x397a39[_0x18f9('0x19a')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b4'));}else{_0x485b3a['stateGlobal'](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b4'));}}break;case'8':_0x397a39['outboundCongestionCallsDay']+=0x1;_0x132d02[_0x18f9('0xa6')]=0x8;_0x132d02['statedesc']=_0x18f9('0x1b5');_0x132d02[_0x18f9('0xf1')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0x18f9('0xe6')](_0x5d9ef8,'congestion'));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1b6')));if(_0x485b3a[_0x18f9('0x1aa')](0x8,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf1')]>=_0x397a39[_0x18f9('0x19c')]){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b7'));}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b7'));}}break;case'11':_0x397a39[_0x18f9('0x1b8')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0xb;_0x132d02[_0x18f9('0xa7')]='Abandoned';_0x132d02[_0x18f9('0x100')]+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;_0x485b3a[_0x18f9('0xca')](_0x132d02)['catch'](loggerCatch(_0x18f9('0x123')));if(_0x485b3a[_0x18f9('0x1aa')](0xb,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0x100')]>=_0x397a39['dialAbandonedMaxRetry']){_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b9'));}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1b9'));}}break;case'20':_0x397a39[_0x18f9('0x1ba')]+=0x1;_0x132d02[_0x18f9('0xa6')]=0x14;_0x132d02[_0x18f9('0xa7')]='AgentReject';_0x132d02['countagentrejectretry']+=0x1;_0x132d02[_0x18f9('0xed')]+=0x1;ami['emit'](_0x18f9('0x1bb'),ut[_0x18f9('0xe6')](_0x5d9ef8,'agentreject'));_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1bc')));if(_0x485b3a[_0x18f9('0x1aa')](0x14,_0x5d9ef8,_0x397a39)){if(_0x132d02[_0x18f9('0xf4')]>=_0x397a39[_0x18f9('0x1a3')]){_0x485b3a['createStateFinal'](_0x132d02,_0x54868a,_0x5dd119,'reason\x2020\x20agentreject');}else{_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x18f9('0x1bd'));}}break;default:_0x397a39[_0x18f9('0x109')]+=0x1;_0x132d02['state']=0xc;_0x132d02['statedesc']=_0x40709c['reason'];_0x485b3a['createHistory'](_0x132d02)[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1be')));if(_0x485b3a[_0x18f9('0x1aa')](_0x40709c[_0x18f9('0x10a')],_0x5d9ef8,_0x397a39)){if(_0x132d02['countbusyretry']+_0x132d02[_0x18f9('0xf1')]+_0x132d02[_0x18f9('0xf2')]+_0x132d02['countnosuchnumberretry']+_0x132d02[_0x18f9('0xf3')]+_0x132d02[_0x18f9('0x100')]+_0x132d02[_0x18f9('0xec')]+_0x132d02['countagentrejectretry']>=_0x397a39[_0x18f9('0xf5')]){_0x485b3a[_0x18f9('0xf6')](_0x132d02,_0x54868a,_0x5dd119,_0x40709c['reason']);}else{_0x485b3a[_0x18f9('0xf9')](_0x132d02,_0x54868a,_0x5dd119,_0x40709c[_0x18f9('0x10a')]);}}}});};Dialer[_0x18f9('0x1b')][_0x18f9('0xf6')]=function(_0x320a45,_0x455dae,_0x20a2a9,_0x1475f2){var _0x4bd633=new Final(_0x320a45);_0x4bd633['state']=0xf;_0x4bd633[_0x18f9('0xa7')]='Global';this[_0x18f9('0xf9')](_0x4bd633,_0x455dae,_0x20a2a9,_0x1475f2);};Dialer[_0x18f9('0x1b')][_0x18f9('0xf9')]=function(_0x30eaee,_0x1b1469,_0x3b1312,_0x411b4b){this[_0x18f9('0xc8')](_0x30eaee)['then'](function(){return _0x1b1469(msgResponse(_0x18f9('0x1bf'),'Success',_0x411b4b));})[_0x18f9('0xaf')](function(){return _0x3b1312(msgResponse(_0x18f9('0x1c0'),_0x18f9('0x143'),_0x18f9('0x1c1')));});};Dialer[_0x18f9('0x1b')]['predictive']=function(_0x28aa4a){var _0x41e4a6=_0x28aa4a['dialPredictiveOptimizationPercentage']/0x64;var _0x2ac0ef=_0x28aa4a[_0x18f9('0x65')]/(_0x28aa4a[_0x18f9('0x65')]+_0x28aa4a[_0x18f9('0x60')]);var _0x425a47=Math[_0x18f9('0x1c2')](_0x28aa4a[_0x18f9('0x70')]*(_0x28aa4a['predictiveIntervalMaxThreshold']/0x64));var _0x26250b=Math[_0x18f9('0x1c2')](_0x28aa4a[_0x18f9('0x70')]*(_0x28aa4a[_0x18f9('0x1c3')]/0x64));var _0x55b287=_0x28aa4a[_0x18f9('0x50')]+_0x28aa4a['talking'];var _0x3d809d=Math[_0x18f9('0x1c4')](_0x28aa4a['erlangCalls']*_0x28aa4a[_0x18f9('0x75')]*_0x28aa4a[_0x18f9('0x6e')]*_0x28aa4a[_0x18f9('0x1c5')]);if(_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x27')])){if(!_[_0x18f9('0x3e')](_0x28aa4a['startPredictive'])){_0x28aa4a[_0x18f9('0x77')]=undefined;loggerPredictive[_0x18f9('0x94')](_0x18f9('0x1c6'),_0x18f9('0x1c7'));}if(!_['isUndefined'](_0x28aa4a[_0x18f9('0x8f')])){loggerPredictive['error'](_0x18f9('0x1c6'),_0x18f9('0x1c8'));clearInterval(_0x28aa4a[_0x18f9('0x8f')]);_0x28aa4a[_0x18f9('0x8f')]=undefined;}_0x28aa4a[_0x18f9('0x27')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a['name'],_0x18f9('0x1c9'),_0x28aa4a['startProgressive']);this[_0x18f9('0x154')](_0x28aa4a,0x1);}else if(ifInterval(_0x28aa4a[_0x18f9('0x1ca')],_0x28aa4a[_0x18f9('0x27')])){this[_0x18f9('0x154')](_0x28aa4a,0x1);loggerPredictiveCalls[_0x18f9('0x80')]('[startMethodPredictive][StartProgressive][Loop]',_0x28aa4a[_0x18f9('0x27')],_0x28aa4a[_0x18f9('0x40')]);_0x28aa4a[_0x18f9('0x73')]=0x0;_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x41e4a6<_0x2ac0ef&&_0x28aa4a[_0x18f9('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x1cc'),_0x18f9('0x1cd'),_0x2ac0ef,_0x18f9('0x27'),_0x28aa4a[_0x18f9('0x40')]);}else if(_0x3d809d<_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls']&&_0x28aa4a['dialPredictiveOptimization']===_0x18f9('0x1ce')){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x1cf'),_0x18f9('0x1d0'),_0x3d809d,_0x18f9('0x1d1'),_0x28aa4a['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x28aa4a[_0x18f9('0x40')]);}else if(!ifInterval(_0x28aa4a['dialPredictiveInterval'],_0x28aa4a['startProgressive'])&&_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x77')])&&!_[_0x18f9('0x3e')](_0x28aa4a[_0x18f9('0x27')])){_0x28aa4a['startPredictive']=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],_0x18f9('0x1d2'),_0x28aa4a[_0x18f9('0x77')]);this[_0x18f9('0xba')](_0x28aa4a[_0x18f9('0x1ca')])[_0x18f9('0xb5')](this[_0x18f9('0x1d3')](_0x28aa4a))['then'](mergeDataErlangB(_0x28aa4a))[_0x18f9('0xb5')](this[_0x18f9('0x1d4')](_0x28aa4a))[_0x18f9('0xaf')](loggerCatchPredictive(_0x18f9('0x1d5'),_0x28aa4a));}else if(!ifInterval(_0x28aa4a[_0x18f9('0x1ca')],_0x28aa4a[_0x18f9('0x77')])){_0x28aa4a[_0x18f9('0x6d')]=0x0;_0x28aa4a[_0x18f9('0x77')]=moment()[_0x18f9('0x7d')](_0x18f9('0x103'));loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],_0x18f9('0x1d6'),_0x28aa4a[_0x18f9('0x77')]);clearInterval(_0x28aa4a[_0x18f9('0x8f')]);_0x28aa4a['handlePredictive']=undefined;this[_0x18f9('0xba')](_0x28aa4a[_0x18f9('0x1ca')])[_0x18f9('0xb5')](this[_0x18f9('0x1d3')](_0x28aa4a))['then'](mergeDataErlangB(_0x28aa4a))[_0x18f9('0xb5')](this[_0x18f9('0x1d4')](_0x28aa4a))['catch'](loggerCatchPredictive(_0x18f9('0x1d7'),_0x28aa4a));}else if(_0x28aa4a['predictiveIntervalAvailable']&&_0x55b287<_0x28aa4a[_0x18f9('0x70')]-_0x26250b){freeVariablesPredictive(_0x28aa4a);loggerPredictive['info'](_0x28aa4a['name'],_0x18f9('0x1d8'),_0x55b287,_0x18f9('0x1d9'),_0x28aa4a[_0x18f9('0x70')],'-',_0x26250b,'=',_0x28aa4a['predictiveIntervalAvailable']-_0x26250b,')');}else if(_0x28aa4a['predictiveIntervalAvailable']&&_0x55b287>_0x28aa4a[_0x18f9('0x70')]+_0x425a47){freeVariablesPredictive(_0x28aa4a);loggerPredictive[_0x18f9('0x80')](_0x28aa4a[_0x18f9('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x55b287,_0x18f9('0x1da'),_0x28aa4a[_0x18f9('0x70')],'+',_0x425a47,'=',_0x28aa4a[_0x18f9('0x70')]+_0x425a47,')');}};Dialer[_0x18f9('0x1b')][_0x18f9('0x1d3')]=function(_0x446771){var _0x1d5370=this;return function(_0x2e2f51){return new BPromise(function(_0x30c6fe,_0x17250d){_[_0x18f9('0x8c')](_0x446771,_0x2e2f51[0x0]);if(checkGetDataPredictive(_0x2e2f51[0x0])){var _0x796501=_0x446771[_0x18f9('0x70')]=_0x446771[_0x18f9('0x55')]+_0x446771[_0x18f9('0x50')];var _0x44dad4=_0x446771[_0x18f9('0x1ca')]*0x3c;var _0x573cee=_0x2e2f51[0x0][_0x18f9('0x6b')]+_0x2e2f51[0x0][_0x18f9('0x6a')];var _0x4c9258=(_0x2e2f51[0x0]['predictiveIntervalAnsweredCalls']+_0x2e2f51[0x0][_0x18f9('0x85')]+_0x2e2f51[0x0][_0x18f9('0x6c')])/_0x2e2f51[0x0]['predictiveIntervalTotalCalls'];_0x446771['predictiveIntervalHitRate']=_0x4c9258>0x0?_0x4c9258:0x1;switch(_0x446771[_0x18f9('0x1cb')]){case _0x18f9('0x1ce'):var _0x6c16fc=_0x446771[_0x18f9('0x1db')]/0x64;return _0x1d5370[_0x18f9('0x1dc')](_0x796501,_0x44dad4,_0x573cee,_0x4c9258,_0x6c16fc)[_0x18f9('0xb5')](function(_0x569ed){return _0x30c6fe(_0x569ed);});case _0x18f9('0x1dd'):var _0x3e851d=_0x446771['dialPredictiveOptimizationPercentage']/0x64;return _0x1d5370['busyFactor'](_0x796501,_0x44dad4,_0x573cee,_0x4c9258,_0x3e851d)[_0x18f9('0xb5')](function(_0x16a179){return _0x30c6fe(_0x16a179);});default:return _0x17250d(msgResponse('[getDataPredictive]',_0x18f9('0x143'),'Unknown\x20Predictive'));}}else{return _0x17250d(msgResponse(_0x18f9('0x1de'),_0x18f9('0x143'),_0x18f9('0x1df')));}});};};Dialer[_0x18f9('0x1b')][_0x18f9('0x1e0')]=function(_0x2fef90){var _0x6a33a=this;return function(_0x164e5d){return new BPromise(function(_0x4bbf9e,_0x2258b9){_[_0x18f9('0x8c')](_0x2fef90,_0x164e5d[0x0]);if(checkGetDataPredictive(_0x164e5d[0x0])){loggerPredictive[_0x18f9('0x80')](JSON[_0x18f9('0x4a')](_0x164e5d[0x0]));if(_0x2fef90[_0x18f9('0x1cb')]===_0x18f9('0x1ce')){return _0x6a33a[_0x18f9('0xc6')](_0x2fef90['id'])['then'](function(_0x218e08){var _0x467f61=_0x2fef90[_0x18f9('0x51')]-_0x218e08[0x0]['outboundQueuePauses'];var _0x484d79=_0x2fef90['dialPredictiveInterval']*0x3c;var _0x4a4b61=_0x164e5d[0x0][_0x18f9('0x6b')]+_0x164e5d[0x0][_0x18f9('0x6a')];var _0x2f6023=(_0x164e5d[0x0]['predictiveIntervalAnsweredCalls']+_0x164e5d[0x0][_0x18f9('0x85')]+_0x164e5d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x164e5d[0x0][_0x18f9('0x71')];var _0x5d37da=_0x2fef90[_0x18f9('0x1db')]/0x64;_0x2fef90[_0x18f9('0x6f')]=_0x218e08[0x0][_0x18f9('0x1e1')]||0x0;_0x2fef90[_0x18f9('0x6e')]=_0x2f6023>0x0?_0x2f6023:0x1;return _0x6a33a[_0x18f9('0x1dc')](_0x467f61,_0x484d79,_0x4a4b61,_0x2f6023,_0x5d37da);})[_0x18f9('0xb5')](function(_0x2fa13e){return _0x4bbf9e(_0x2fa13e);})[_0x18f9('0xaf')](function(_0x15f2db){return _0x2258b9(msgResponse(_0x18f9('0x1e2'),_0x18f9('0x143'),JSON['stringify'](_0x15f2db)));});}if(_0x2fef90['dialPredictiveOptimization']===_0x18f9('0x1dd')){return _0x6a33a[_0x18f9('0xc6')](_0x2fef90['id'])[_0x18f9('0xb5')](function(_0x4f3d76){var _0x1da4f2=_0x2fef90[_0x18f9('0x51')]-_0x4f3d76[0x0][_0x18f9('0x1e1')];var _0x4e0da4=_0x2fef90[_0x18f9('0x1ca')]*0x3c;var _0x565bbf=_0x164e5d[0x0][_0x18f9('0x6b')]+_0x164e5d[0x0][_0x18f9('0x6a')];var _0x1a9f4a=(_0x164e5d[0x0][_0x18f9('0x69')]+_0x164e5d[0x0][_0x18f9('0x85')]+_0x164e5d[0x0][_0x18f9('0x6c')])/_0x164e5d[0x0][_0x18f9('0x71')];var _0x407b1a=_0x2fef90[_0x18f9('0x1db')]/0x64;_0x2fef90[_0x18f9('0x6f')]=_0x4f3d76[0x0][_0x18f9('0x1e1')]||0x0;_0x2fef90[_0x18f9('0x6e')]=_0x1a9f4a>0x0?_0x1a9f4a:0x1;return _0x6a33a['busyFactor'](_0x1da4f2,_0x4e0da4,_0x565bbf,_0x1a9f4a,_0x407b1a);})[_0x18f9('0xb5')](function(_0x349a31){return _0x4bbf9e(_0x349a31);})[_0x18f9('0xaf')](function(_0x3e271d){return _0x2258b9(msgResponse(_0x18f9('0x1e2'),_0x18f9('0x143'),JSON[_0x18f9('0x4a')](_0x3e271d)));});}}else{return _0x2258b9(msgResponse(_0x18f9('0x1de'),_0x18f9('0x143'),'check\x20failure'));}});};};Dialer[_0x18f9('0x1b')][_0x18f9('0x1d4')]=function(_0x558d49){var _0x3b8136=this;return function(){var _0x25ffc9=0x0;var _0x5f5431=Math['floor'](_0x558d49['erlangCallToSecond']*0x3e8);if(_0x5f5431>0x0){_0x5f5431=_0x5f5431<0x64?0x64:_0x5f5431;loggerPredictive[_0x18f9('0x80')](_0x558d49['name'],'one\x20call\x20every:',_0x5f5431,_0x18f9('0x4b'));_0x558d49[_0x18f9('0x8f')]=setInterval(function(){_0x3b8136[_0x18f9('0x8f')](_0x558d49);loggerPredictiveCalls[_0x18f9('0x80')]('[handlePredictive]',_0x25ffc9+=0x1);},_0x5f5431);}else{loggerPredictive[_0x18f9('0x80')](_0x558d49[_0x18f9('0x40')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x18f9('0x1e3')]=function(_0x462173,_0x4e4d41){var _0x3eaae2=this;return function(_0x4101c6){if(_[_0x18f9('0x46')](_0x4101c6)){if(_[_0x18f9('0xac')](_0x4e4d41[_0x18f9('0xd2')])||!_0x4e4d41[_0x18f9('0x1e4')]){if(_0x462173[_0x18f9('0x153')]===_0x18f9('0xa')){_0x462173[_0x18f9('0x12d')]=_['isUndefined'](_0x462173[_0x18f9('0x12d')])?!![]:_0x462173[_0x18f9('0x12d')];var _0x5d6eb5=uuid['v4']();_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5]=new Action(_0x462173,_0x4e4d41,_0x5d6eb5);loggerBooked[_0x18f9('0x80')]('[booked][checkContactBlack]',_0x5d6eb5,_0x18f9('0x1e5'),JSON[_0x18f9('0x4a')](_0x462173[_0x18f9('0x12d')]),_0x18f9('0x1e6'),_0x462173[_0x18f9('0x40')]);if(_0x462173[_0x18f9('0x12d')]){_0x462173['queueStatusComplete']=![];_0x3eaae2[_0x18f9('0x129')][_0x3eaae2['actions'][_0x5d6eb5]['queue']]=[];ami[_0x18f9('0xad')]({'actionid':_0x5d6eb5,'action':_0x18f9('0x1e7'),'queue':_0x462173[_0x18f9('0x40')]})[_0x18f9('0xaf')](function(){_0x3eaae2[_0x18f9('0xb0')](_0x462173);_0x3eaae2['rescheduleContact']({'active':![],'ContactId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd0')],'ListId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd1')],'VoiceQueueId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd3')]||undefined,'CampaignId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1e8')));delete _0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5];});}else{loggerBooked[_0x18f9('0x80')](_0x18f9('0x1e9'),JSON[_0x18f9('0x4a')](_0x462173[_0x18f9('0x12d')]),_0x18f9('0x1e6'),_0x462173['name']);_0x3eaae2[_0x18f9('0xb0')](_0x462173);_0x3eaae2['rescheduleContact']({'active':![],'ContactId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd0')],'ListId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd1')],'VoiceQueueId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0xd3')]||undefined,'CampaignId':_0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5][_0x18f9('0x104')]||undefined})[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1e8')));delete _0x3eaae2[_0x18f9('0xa9')][_0x5d6eb5];}}else{return _0x3eaae2['actionOriginate'](_0x462173,_0x4e4d41);}}else{if(getDiff(_0x4e4d41[_0x18f9('0x1ea')])<_0x462173[_0x18f9('0x1eb')]*0x3c){if(_0x4e4d41[_0x18f9('0x158')]&&!_0x4e4d41[_0x18f9('0x158')][_0x18f9('0x1ec')]){_0x3eaae2[_0x18f9('0x1f')][_0x18f9('0x12f')](_0x4e4d41['id'])[_0x18f9('0x131')](function(){_0x3eaae2['updateOriginated'](_0x462173);});}else{_0x3eaae2[_0x18f9('0xbf')]({'active':![]},_0x4e4d41['id'],0x1)[_0x18f9('0x131')](function(){_0x3eaae2['updateOriginated'](_0x462173);});}}else{_0x462173['outboundReCallsDay']+=0x1;_0x3eaae2['updateOriginated'](_0x462173);if(_0x462173['dialRecallInQueue']){_0x3eaae2[_0x18f9('0xbd')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e4d41[_0x18f9('0xd0')],'ListId':_0x4e4d41[_0x18f9('0xd1')],'VoiceQueueId':_0x4e4d41[_0x18f9('0xd3')]||undefined,'CampaignId':_0x4e4d41[_0x18f9('0x104')]||undefined})['catch'](loggerCatch(_0x18f9('0x1ed')));_0x3eaae2[_0x18f9('0xca')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1ee'),0x17,_0x18f9('0x1ef')))[_0x18f9('0xaf')](loggerCatch(_0x18f9('0x1f0')));}else{_0x3eaae2[_0x18f9('0xde')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1f1'),0x16,_0x18f9('0x1f2')),_0x18f9('0x1f3'),_0x18f9('0x1f4'));}}}}else{_0x462173[_0x18f9('0x1f5')]+=0x1;_0x3eaae2[_0x18f9('0xde')](createObjHistory(_0x462173,_0x4e4d41,_0x18f9('0x1f6'),0xd,_0x18f9('0x1f7')),_0x18f9('0x1f8'),'[Originate][MoveBlacklist]');throw _0x18f9('0x1f9');}};};Dialer[_0x18f9('0x1b')]['handleIvr']=function(_0x362948){var _0x1b1948=this;var _0x2601b0=_0x362948[_0x18f9('0x1fa')]-_0x362948['originated']-_0x362948[_0x18f9('0xc2')];emitCampaignSummary(_0x362948);if(_0x2601b0>0x0){if(_0x2601b0>this[_0x18f9('0x24')]){_0x2601b0=this[_0x18f9('0x24')];}_0x362948[_0x18f9('0xc2')]+=_0x2601b0;this[_0x18f9('0xc4')](_0x362948['id'],_0x2601b0,_0x362948[_0x18f9('0x1fb')],_0x362948)['then'](function(_0x31d98b){_0x362948[_0x18f9('0xc2')]-=_0x2601b0;_0x362948[_0x18f9('0xc2')]=_0x362948[_0x18f9('0xc2')]>0x0?_0x362948[_0x18f9('0xc2')]:0x0;if(!checkContactEmpty(_0x31d98b)){_0x362948[_0x18f9('0x3f')]=_0x18f9('0x9e');logger[_0x18f9('0x80')](_0x18f9('0x1fc')+_0x362948[_0x18f9('0x40')]);}else{_0x362948['originated']+=_0x31d98b[_0x18f9('0x96')];_0x362948[_0x18f9('0x3f')]=_0x18f9('0x1fd');for(var _0x165847=0x0;_0x165847<_0x31d98b[_0x18f9('0x96')];_0x165847+=0x1){_0x362948[_0x18f9('0x1fe')]+=0x1;if(_['isNil'](_0x31d98b[_0x165847])||_[_0x18f9('0xac')](_0x31d98b[_0x165847][_0x18f9('0x16a')])||_['isNil'](_0x31d98b[_0x165847][_0x18f9('0x16a')]['phone'])){_0x1b1948[_0x18f9('0x1ff')](_0x18f9('0x200'),_0x362948,_0x31d98b[_0x165847]);}else{_0x1b1948['checkIsBlackListIvr'](_[_0x18f9('0x12b')](_0x31d98b[_0x165847],[_0x18f9('0x104'),'Contact.phone']))[_0x18f9('0xb5')](_0x1b1948[_0x18f9('0x1e3')](_0x362948,_0x31d98b[_0x165847]))['catch'](_0x1b1948[_0x18f9('0xce')](_0x18f9('0x201'),_0x362948));}}}})['catch'](loggerGetContactDialer(_0x18f9('0x202'),_0x362948,_0x2601b0));}};Dialer[_0x18f9('0x1b')][_0x18f9('0x154')]=function(_0x45fac0,_0x44158d){var _0x3aeaef=this;var _0x3fc492=[];var _0x4f5fdd=_0x44158d>=0x1?_0x44158d:0x1;if(_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')){_0x4f5fdd=0x1;}var _0x424c06=Math[_0x18f9('0x1c4')](_0x45fac0['available']*_0x4f5fdd)-_0x45fac0[_0x18f9('0x72')]-_0x45fac0[_0x18f9('0xc2')];emitVoiceQueueSummary(_0x45fac0);if(_0x45fac0[_0x18f9('0x203')]>0x0){var _0x2c164f=_0x45fac0[_0x18f9('0x203')]-_0x45fac0['originated']-_0x45fac0[_0x18f9('0x55')]-_0x45fac0[_0x18f9('0xc2')]-_0x45fac0[_0x18f9('0x52')];if(_0x424c06>_0x2c164f){_0x424c06=_0x2c164f;}}if(_0x424c06>0x0){if(_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')){_0x424c06=0x1;}if(_0x424c06>this[_0x18f9('0x24')]){_0x424c06=this['maxNumberOriginate'];}_0x45fac0[_0x18f9('0xc2')]+=_0x424c06;for(var _0x504456 in this[_0x18f9('0x22')]){if(typeof this[_0x18f9('0x22')][_0x504456]!==_0x18f9('0x97')){if(this['agents'][_0x504456][_0x18f9('0xa6')]===_0x18f9('0x204')&&this['agents'][_0x504456][_0x18f9('0xdb')]===_0x18f9('0xdc')){_0x3fc492['push'](this[_0x18f9('0x22')][_0x504456]['id']);}}}this[_0x18f9('0xc1')](_0x45fac0['id'],_0x3fc492,_0x424c06,_0x45fac0[_0x18f9('0x1fb')],_0x45fac0)[_0x18f9('0xb5')](function(_0x398625){_0x45fac0['temp']-=_0x424c06;_0x45fac0[_0x18f9('0xc2')]=_0x45fac0[_0x18f9('0xc2')]>0x0?_0x45fac0[_0x18f9('0xc2')]:0x0;if(!checkContactEmpty(_0x398625)){_0x3aeaef[_0x18f9('0xb3')](_0x45fac0)['then'](sendMessageReschedule(_0x45fac0))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x45fac0[_0x18f9('0x72')]+=_0x398625[_0x18f9('0x96')];_0x45fac0[_0x18f9('0x3f')]=_0x45fac0[_0x18f9('0x153')]===_0x18f9('0xa')?_0x18f9('0x172'):_0x18f9('0x1fd');for(var _0x1f1434=0x0;_0x1f1434<_0x398625[_0x18f9('0x96')];_0x1f1434+=0x1){if(_['isNil'](_0x398625[_0x1f1434])||_[_0x18f9('0xac')](_0x398625[_0x1f1434][_0x18f9('0x16a')])||_[_0x18f9('0xac')](_0x398625[_0x1f1434][_0x18f9('0x16a')][_0x18f9('0x16b')])){_0x3aeaef[_0x18f9('0x1ff')](_0x18f9('0x200'),_0x45fac0,_0x398625[_0x1f1434]);}else{_0x3aeaef['checkIsBlackList'](_[_0x18f9('0x12b')](_0x398625[_0x1f1434],[_0x18f9('0xd3'),_0x18f9('0x205')]))[_0x18f9('0xb5')](_0x3aeaef[_0x18f9('0x1e3')](_0x45fac0,_0x398625[_0x1f1434]))['catch'](_0x3aeaef[_0x18f9('0xce')]('[actionOriginate]\x20',_0x45fac0));}}}})['catch'](loggerGetContactDialer(_0x18f9('0x206'),_0x45fac0,_0x424c06));}};Dialer[_0x18f9('0x1b')][_0x18f9('0x8f')]=function(_0x5cf5b0){if(_0x5cf5b0[_0x18f9('0x203')]>0x0){var _0x423e4b=_0x5cf5b0['dialLimitQueue']-_0x5cf5b0[_0x18f9('0x72')]-_0x5cf5b0['talking'];if(_0x423e4b>0x0){this[_0x18f9('0x207')](_0x5cf5b0);}else{loggerPredictiveCalls[_0x18f9('0x80')](_0x18f9('0x208'));}}else{this[_0x18f9('0x207')](_0x5cf5b0);}};Dialer[_0x18f9('0x1b')]['tryOriginatePredictive']=function(_0x4b30ac){var _0x387f38=this;var _0x218f01=[];_0x4b30ac['originated']+=0x1;for(var _0x4afda9 in this[_0x18f9('0x22')]){if(typeof this[_0x18f9('0x22')][_0x4afda9]!==_0x18f9('0x97')){if(this['agents'][_0x4afda9][_0x18f9('0xa6')]===_0x18f9('0x204')&&this[_0x18f9('0x22')][_0x4afda9]['status']==='reachable'){_0x218f01['push'](this[_0x18f9('0x22')][_0x4afda9]['id']);}}}this['getContactDialer'](_0x4b30ac['id'],_0x218f01,0x1,_0x4b30ac[_0x18f9('0x1fb')],_0x4b30ac)[_0x18f9('0xb5')](function(_0x4ec09e){if(!checkContactEmpty(_0x4ec09e)){checkContactLowerLimitOriginate(_0x4b30ac,0x1,0x0);_0x387f38['countReScheduled'](_0x4b30ac)['then'](sendMessageReschedule(_0x4b30ac))['catch'](loggerCatch(_0x18f9('0xb6')));}else{_0x4b30ac[_0x18f9('0x3f')]=_0x18f9('0x1fd');if(_[_0x18f9('0xac')](_0x4ec09e[0x0])||_['isNil'](_0x4ec09e[0x0][_0x18f9('0x16a')])||_[_0x18f9('0xac')](_0x4ec09e[0x0][_0x18f9('0x16a')][_0x18f9('0x16b')])){_0x387f38['emptyContact']('[actionOriginate]\x20',_0x4b30ac,_0x4ec09e[0x0]);}else{_0x387f38['checkIsBlackList'](_[_0x18f9('0x12b')](_0x4ec09e[0x0],['VoiceQueueId','Contact.phone']))[_0x18f9('0xb5')](_0x387f38[_0x18f9('0x1e3')](_0x4b30ac,_0x4ec09e[0x0]))['catch'](_0x387f38[_0x18f9('0xce')](_0x18f9('0x209'),_0x4b30ac));}}})['catch'](loggerGetContactDialer(_0x18f9('0x20a'),_0x4b30ac,0x1));emitVoiceQueueSummary(_0x4b30ac);};Dialer[_0x18f9('0x1b')][_0x18f9('0x1dc')]=function(_0x1f672d,_0x2e1438,_0x4657e4,_0x291b7f,_0x1f9333,_0x3af799){loggerPredictive['info'](_0x18f9('0x20b'));loggerPredictive['info']('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',_0x1f672d);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20c'),_0x2e1438);loggerPredictive[_0x18f9('0x80')]('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',_0x4657e4);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20d'),_0x291b7f);loggerPredictive[_0x18f9('0x80')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1f9333);loggerPredictive['info'](_0x18f9('0x8b'));return new BPromise(function(_0x41d71d,_0xb3e0ec){if(_0x1f672d<=0x0||isNaN(_0x1f672d)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x20f')+_0x1f672d));}if(_0x4657e4<=0x0||isNaN(_0x4657e4)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x210')+_0x4657e4));}if(_0x291b7f<=0x0||isNaN(_0x291b7f)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),_0x18f9('0x211')+_0x291b7f));}if(_0x2e1438<=0x0||isNaN(_0x2e1438)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),_0x18f9('0x49'),'interval\x20=\x20'+_0x2e1438));}if(_0x1f9333<=0x0||isNaN(_0x1f9333)){return _0xb3e0ec(msgResponse(_0x18f9('0x20e'),'Error',_0x18f9('0x212')+_0x1f9333));}_0x3af799=_0x3af799||0x0;var _0x15fb8d=0x1/_0x4657e4;var _0x107b48=0x0;var _0x9deff2=0x0;var _0x26d4a8=0x0;var _0x5a0ad0=0x0;for(var _0x2a4b8b=0x0;_0x26d4a8<_0x1f9333;_0x2a4b8b+=0x1){_0x9deff2=_0x2a4b8b/_0x2e1438;_0x107b48=(_0x291b7f*_0x9deff2+_0x3af799)/_0x15fb8d;_0x26d4a8=erlangb(_0x107b48,_0x1f672d);_0x5a0ad0=_0x107b48/_0x1f672d*(0x1-erlangb(_0x107b48,_0x1f672d));}return _0x41d71d({'erlangCalls':_0x2a4b8b,'erlangCallToSecond':_0x2e1438/_0x2a4b8b,'erlangAbandonmentRate':_0x26d4a8,'erlangBusyFactor':_0x5a0ad0});});};Dialer[_0x18f9('0x1b')]['busyFactor']=function(_0xc91b4d,_0x828b94,_0x130766,_0x5ac2c9,_0x327028,_0x162499){loggerPredictive[_0x18f9('0x80')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x18f9('0x80')]('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',_0xc91b4d);loggerPredictive['info'](_0x18f9('0x20c'),_0x828b94);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x213'),_0x130766);loggerPredictive[_0x18f9('0x80')](_0x18f9('0x20d'),_0x5ac2c9);loggerPredictive[_0x18f9('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x327028);loggerPredictive[_0x18f9('0x80')]('---------------------------');return new BPromise(function(_0x3defea,_0x4589dd){if(_0xc91b4d<=0x0||isNaN(_0xc91b4d)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),'m\x20=\x20'+_0xc91b4d));}if(_0x130766<=0x0||isNaN(_0x130766)){return _0x4589dd(msgResponse('[busyFactor]','Error',_0x18f9('0x210')+_0x130766));}if(_0x5ac2c9<=0x0||isNaN(_0x5ac2c9)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),_0x18f9('0x211')+_0x5ac2c9));}if(_0x828b94<=0x0||isNaN(_0x828b94)){return _0x4589dd(msgResponse(_0x18f9('0x214'),_0x18f9('0x49'),_0x18f9('0x215')+_0x828b94));}if(_0x327028<=0x0||isNaN(_0x327028)){return _0x4589dd(msgResponse('[busyFactor]',_0x18f9('0x49'),_0x18f9('0x216')+_0x327028));}_0x162499=_0x162499||0x0;var _0x58902f=0x1/_0x130766;var _0x52376f=0x0;var _0x3b86ca=0x0;var _0x56bff1=0x0;var _0x1a312f=0x0;for(var _0x5c3319=0x0;_0x1a312f<_0x327028;_0x5c3319+=0x1){_0x3b86ca=_0x5c3319/_0x828b94;_0x52376f=(_0x5ac2c9*_0x3b86ca+_0x162499)/_0x58902f;_0x56bff1=erlangb(_0x52376f,_0xc91b4d);_0x1a312f=_0x52376f/_0xc91b4d*(0x1-erlangb(_0x52376f,_0xc91b4d));}return _0x3defea({'erlangCalls':_0x5c3319,'erlangCallToSecond':_0x828b94/_0x5c3319,'erlangAbandonmentRate':_0x56bff1,'erlangBusyFactor':_0x1a312f});});};module[_0x18f9('0x217')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 8f63f9d..ad357a9 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 _0xbc8f=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','connectedlinename','reason','callback','callbackat','recallme','ContactId'];(function(_0x2bd88d,_0x2d5dc3){var _0x5516d4=function(_0x1272c8){while(--_0x1272c8){_0x2bd88d['push'](_0x2bd88d['shift']());}};_0x5516d4(++_0x2d5dc3);}(_0xbc8f,0x146));var _0xfbc8=function(_0x1a2302,_0x5e3ce6){_0x1a2302=_0x1a2302-0x0;var _0x2262e1=_0xbc8f[_0x1a2302];return _0x2262e1;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x119c66,_0x5486df){var _0x56f420=moment(_0x119c66)[_0xfbc8('0x0')](0x0);var _0x53ecb7=moment(_0x5486df)[_0xfbc8('0x0')](0x0);return _0x56f420[_0xfbc8('0x1')](_0x53ecb7,_0xfbc8('0x2'));}function QueueCallerAbandon(_0x217445,_0xae818b){this[_0xfbc8('0x3')]=_0x217445[_0xfbc8('0x3')];this[_0xfbc8('0x4')]=_0x217445['type'];this[_0xfbc8('0x5')]=_0x217445[_0xfbc8('0x4')]===_0xfbc8('0x6')?_0xfbc8('0x7'):_0x217445[_0xfbc8('0x4')];this[_0xfbc8('0x8')]=_0x217445['countbusyretry'];this[_0xfbc8('0x9')]=_0x217445[_0xfbc8('0x9')];this[_0xfbc8('0xa')]=_0x217445[_0xfbc8('0xa')];this[_0xfbc8('0xb')]=_0x217445[_0xfbc8('0x8')]+_0x217445[_0xfbc8('0x9')]+_0x217445[_0xfbc8('0xa')]+_0x217445[_0xfbc8('0xc')]+_0x217445[_0xfbc8('0xd')]+_0x217445['countabandonedretry']+_0x217445['countmachineretry']+_0x217445['countagentrejectretry'];this[_0xfbc8('0xc')]=_0x217445[_0xfbc8('0xc')];this[_0xfbc8('0xd')]=_0x217445[_0xfbc8('0xd')];this[_0xfbc8('0xe')]=_0x217445[_0xfbc8('0xe')];this['countmachineretry']=_0x217445[_0xfbc8('0xf')];this[_0xfbc8('0x10')]=_0x217445['countagentrejectretry'];this['uniqueid']=_0xae818b[_0xfbc8('0x11')];this[_0xfbc8('0x12')]=_0x217445[_0xfbc8('0x13')];this[_0xfbc8('0x14')]=_0x217445[_0xfbc8('0x15')];this[_0xfbc8('0x16')]=_0x217445['starttime'];this['responsetime']=_0x217445[_0xfbc8('0x17')];this[_0xfbc8('0x18')]=_0x217445['droptime'];this[_0xfbc8('0x19')]=this[_0xfbc8('0x18')];this['ringtime']=getSeconds(_0x217445[_0xfbc8('0x17')],_0x217445[_0xfbc8('0x16')]);this[_0xfbc8('0x1a')]=getSeconds(this['droptime'],_0x217445[_0xfbc8('0x17')]);this[_0xfbc8('0x1b')]=0x0;this[_0xfbc8('0x7')]=_0xae818b['queue'];this['membername']=_0xae818b[_0xfbc8('0x1c')];this[_0xfbc8('0x1d')]=_0xae818b[_0xfbc8('0x1d')];this[_0xfbc8('0x1e')]=_0x217445[_0xfbc8('0x1e')];this['callbackuniqueid']=_0x217445['callbackuniqueid'];this[_0xfbc8('0x1f')]=_0x217445['callbackat'];this[_0xfbc8('0x20')]=_0x217445[_0xfbc8('0x20')];this[_0xfbc8('0x21')]=_0x217445[_0xfbc8('0x21')];this[_0xfbc8('0x22')]=_0x217445[_0xfbc8('0x22')];this[_0xfbc8('0x23')]=_0x217445['UserId'];this['VoiceQueueId']=_0x217445[_0xfbc8('0x24')];this[_0xfbc8('0x25')]=_0x217445[_0xfbc8('0x25')];this['originatecalleridnum']=_0x217445['originatecalleridnum']||'';this['originatecalleridname']=_0x217445[_0xfbc8('0x26')]||'';}module[_0xfbc8('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xa413=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','droptime','talktime','queue','reason','callback'];(function(_0x12592d,_0xd6f9e2){var _0x11219c=function(_0x1374af){while(--_0x1374af){_0x12592d['push'](_0x12592d['shift']());}};_0x11219c(++_0xd6f9e2);}(_0xa413,0x184));var _0x3a41=function(_0x57f0e5,_0x40efbe){_0x57f0e5=_0x57f0e5-0x0;var _0x489c51=_0xa413[_0x57f0e5];return _0x489c51;};'use strict';var util=require(_0x3a41('0x0'));var _=require(_0x3a41('0x1'));var moment=require(_0x3a41('0x2'));function getSeconds(_0x54ef90,_0x72782){var _0x2d0aff=moment(_0x54ef90)['milliseconds'](0x0);var _0x1fe7d2=moment(_0x72782)[_0x3a41('0x3')](0x0);return _0x2d0aff[_0x3a41('0x4')](_0x1fe7d2,_0x3a41('0x5'));}function QueueCallerAbandon(_0x1333f2,_0x4123a6){this[_0x3a41('0x6')]=_0x1333f2[_0x3a41('0x6')];this['type']=_0x1333f2[_0x3a41('0x7')];this[_0x3a41('0x8')]=_0x1333f2[_0x3a41('0x7')]===_0x3a41('0x9')?'queue':_0x1333f2[_0x3a41('0x7')];this[_0x3a41('0xa')]=_0x1333f2[_0x3a41('0xa')];this[_0x3a41('0xb')]=_0x1333f2[_0x3a41('0xb')];this[_0x3a41('0xc')]=_0x1333f2[_0x3a41('0xc')];this[_0x3a41('0xd')]=_0x1333f2[_0x3a41('0xa')]+_0x1333f2[_0x3a41('0xb')]+_0x1333f2['countnoanswerretry']+_0x1333f2[_0x3a41('0xe')]+_0x1333f2['countdropretry']+_0x1333f2[_0x3a41('0xf')]+_0x1333f2[_0x3a41('0x10')]+_0x1333f2[_0x3a41('0x11')];this[_0x3a41('0xe')]=_0x1333f2[_0x3a41('0xe')];this[_0x3a41('0x12')]=_0x1333f2[_0x3a41('0x12')];this[_0x3a41('0xf')]=_0x1333f2[_0x3a41('0xf')];this[_0x3a41('0x10')]=_0x1333f2[_0x3a41('0x10')];this['countagentrejectretry']=_0x1333f2[_0x3a41('0x11')];this['uniqueid']=_0x4123a6[_0x3a41('0x13')];this[_0x3a41('0x14')]=_0x1333f2[_0x3a41('0x15')];this[_0x3a41('0x16')]=_0x1333f2[_0x3a41('0x17')];this['starttime']=_0x1333f2[_0x3a41('0x18')];this['responsetime']=_0x1333f2[_0x3a41('0x19')];this['droptime']=_0x1333f2['droptime'];this[_0x3a41('0x1a')]=this[_0x3a41('0x1b')];this['ringtime']=getSeconds(_0x1333f2[_0x3a41('0x19')],_0x1333f2['starttime']);this['holdtime']=getSeconds(this[_0x3a41('0x1b')],_0x1333f2[_0x3a41('0x19')]);this[_0x3a41('0x1c')]=0x0;this[_0x3a41('0x1d')]=_0x4123a6[_0x3a41('0x1d')];this['membername']=_0x4123a6['connectedlinename'];this['reason']=_0x4123a6[_0x3a41('0x1e')];this[_0x3a41('0x1f')]=_0x1333f2['callback'];this[_0x3a41('0x20')]=_0x1333f2[_0x3a41('0x20')];this['callbackat']=_0x1333f2[_0x3a41('0x21')];this[_0x3a41('0x22')]=_0x1333f2['recallme'];this[_0x3a41('0x23')]=_0x1333f2[_0x3a41('0x23')];this[_0x3a41('0x24')]=_0x1333f2[_0x3a41('0x24')];this[_0x3a41('0x25')]=_0x1333f2[_0x3a41('0x25')];this[_0x3a41('0x26')]=_0x1333f2[_0x3a41('0x26')];this['CampaignId']=_0x1333f2[_0x3a41('0x27')];this[_0x3a41('0x28')]=_0x1333f2[_0x3a41('0x28')]||'';this[_0x3a41('0x29')]=_0x1333f2[_0x3a41('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4243531..402272e 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(_0x2c3590,_0x34b37f){var _0x17d930=function(_0x4d606f){while(--_0x4d606f){_0x2c3590['push'](_0x2c3590['shift']());}};_0x17d930(++_0x34b37f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x37ba3b,_0x9d415b){var _0x2368a5=function(_0x30dcda){while(--_0x30dcda){_0x37ba3b['push'](_0x37ba3b['shift']());}};_0x2368a5(++_0x9d415b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 4e2e737..d55b549 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 _0x97c1=['lodash','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','then','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','merge','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','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','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','execOriginate','addVariables','ext','.pdf','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0x197c('0x0'));var _=require(_0x197c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x197c('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x197c('0x3'));var gs=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var ami=require(_0x197c('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x197c('0x8'));var Action=require(_0x197c('0x9'));var faxAccount=require(_0x197c('0xa'));var attachment=require(_0x197c('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5d42c5){this[_0x197c('0xc')]={};this['faxAccounts']=_0x5d42c5[_0x197c('0xd')];this[_0x197c('0xe')]=_0x5d42c5[_0x197c('0xe')];this[_0x197c('0xf')]={};ami['on']('newchannel',this[_0x197c('0x10')][_0x197c('0x11')](this));ami['on'](_0x197c('0x12'),this[_0x197c('0x13')][_0x197c('0x11')](this));ami['on']('newstate',this[_0x197c('0x14')][_0x197c('0x11')](this));ami['on'](_0x197c('0x15'),this[_0x197c('0x16')]['bind'](this));ami['on'](_0x197c('0x17'),this[_0x197c('0x18')][_0x197c('0x11')](this));ami['on'](_0x197c('0x19'),this[_0x197c('0x1a')][_0x197c('0x11')](this));ami['on']('hangup',this['syncHangup'][_0x197c('0x11')](this));ami['on'](_0x197c('0x1b'),this[_0x197c('0x1c')][_0x197c('0x11')](this));}Fax[_0x197c('0x1d')][_0x197c('0x10')]=function(_0x437050){if(_0x437050[_0x197c('0x1e')]==='from-voip-provider'){for(var _0x372311 in this['faxAccounts']){if(this['faxAccounts'][_0x197c('0x1f')](_0x372311)){if(_0x437050[_0x197c('0x20')]===this[_0x197c('0xd')][_0x372311][_0x197c('0x21')]){this['channels'][_0x437050[_0x197c('0x22')]]={};this[_0x197c('0xc')][_0x437050[_0x197c('0x22')]]['channel']=_0x437050[_0x197c('0x23')];this[_0x197c('0xc')][_0x437050[_0x197c('0x22')]]['id']=this[_0x197c('0xd')][_0x372311]['id'];this[_0x197c('0xc')][_0x437050[_0x197c('0x22')]][_0x197c('0x24')]=this[_0x197c('0xd')][_0x372311][_0x197c('0x24')];logger[_0x197c('0x25')](_0x437050[_0x197c('0x22')],_0x197c('0x26'));}}}}if(this[_0x197c('0xf')][_0x437050[_0x197c('0x22')]]){this[_0x197c('0xc')][_0x437050[_0x197c('0x22')]]={};this['channels'][_0x437050[_0x197c('0x22')]][_0x197c('0x23')]=_0x437050[_0x197c('0x23')];logger['info'](_0x437050[_0x197c('0x22')],_0x197c('0x26'));}};Fax['prototype']['syncVarSet']=function(_0x12b37b){if(this['channels'][_0x12b37b[_0x197c('0x22')]]){for(var _0x14b0aa in _0x12b37b[_0x197c('0x27')]){if(_0x12b37b[_0x197c('0x27')][_0x197c('0x1f')](_0x14b0aa)){this[_0x197c('0xc')][_0x12b37b[_0x197c('0x22')]][_0x14b0aa]=_0x12b37b[_0x197c('0x28')];}}}};Fax[_0x197c('0x1d')]['syncNewState']=function(_0x50dea3){if(this['channels'][_0x50dea3['uniqueid']]){this[_0x197c('0xc')][_0x50dea3['uniqueid']][_0x197c('0x29')]=_0x50dea3[_0x197c('0x29')];this['channels'][_0x50dea3[_0x197c('0x22')]]['channelstatedesc']=_0x50dea3[_0x197c('0x2a')];}};Fax[_0x197c('0x1d')][_0x197c('0x16')]=function(_0x365f9f){if(this[_0x197c('0xc')][_0x365f9f[_0x197c('0x22')]]){for(var _0x176d83 in _0x365f9f[_0x197c('0x27')]){if(_0x365f9f[_0x197c('0x27')]['hasOwnProperty'](_0x176d83)){this['channels'][_0x365f9f[_0x197c('0x22')]][_0x176d83]=_0x365f9f[_0x197c('0x28')];}}}};Fax[_0x197c('0x1d')][_0x197c('0x18')]=function(_0x2c3623){if(this[_0x197c('0xc')][_0x2c3623[_0x197c('0x22')]]){this['channels'][_0x2c3623['uniqueid']][_0x197c('0x2b')]=_0x2c3623[_0x197c('0x2b')];this['channels'][_0x2c3623['uniqueid']][_0x197c('0x2c')]=_0x2c3623[_0x197c('0x2c')];this[_0x197c('0xc')][_0x2c3623[_0x197c('0x22')]][_0x197c('0x21')]=_0x2c3623[_0x197c('0x21')];this[_0x197c('0xc')][_0x2c3623[_0x197c('0x22')]][_0x197c('0x2d')]=_0x2c3623['filename'];logger[_0x197c('0x25')](_0x2c3623[_0x197c('0x22')],_0x197c('0x2e'));}};Fax[_0x197c('0x1d')][_0x197c('0x1a')]=function(_0x151e2f){var _0x50ec25=this;if(this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]]){var _0x2c6cbc=this['channels'][_0x151e2f[_0x197c('0x22')]]['id'];this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]][_0x197c('0x2f')]=_0x151e2f[_0x197c('0x2f')];this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]][_0x197c('0x30')]=_0x151e2f[_0x197c('0x30')];this[_0x197c('0xc')][_0x151e2f['uniqueid']][_0x197c('0x21')]=_0x151e2f[_0x197c('0x21')];this['channels'][_0x151e2f['uniqueid']][_0x197c('0x31')]=_0x151e2f[_0x197c('0x31')];this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]][_0x197c('0x32')]=_0x151e2f['transferrate'];this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]][_0x197c('0x2d')]=_0x151e2f[_0x197c('0x2d')];this[_0x197c('0xc')][_0x151e2f['uniqueid']][_0x197c('0x33')]=_0x151e2f[_0x197c('0x33')];if(this[_0x197c('0xc')][_0x151e2f[_0x197c('0x22')]][_0x197c('0x30')]>0x0){tiff2pdf(_0x151e2f['filename'],_0x197c('0x34'),function(_0x3f417d){logger[_0x197c('0x25')](_0x151e2f[_0x197c('0x22')],_0x197c('0x35'),_0x3f417d[_0x197c('0x36')]);attachment[_0x197c('0x37')]({'name':path[_0x197c('0x38')](_0x151e2f[_0x197c('0x2d')])[_0x197c('0x24')],'basename':path[_0x197c('0x38')](_0x151e2f['filename'])['name']+'.pdf','type':'application/pdf'})[_0x197c('0x39')](function(_0x34271f){faxAccount['notify'](_0x2c6cbc,{'from':_0x151e2f[_0x197c('0x33')],'mapKey':_0x197c('0x6'),'body':path['parse'](_0x151e2f[_0x197c('0x2d')])[_0x197c('0x24')]+'.pdf','AttachmentId':_0x34271f['id']})[_0x197c('0x3a')](function(_0x233ae1){logger['error'](_0x151e2f[_0x197c('0x22')],_0x197c('0x3b'),JSON[_0x197c('0x3c')](_0x233ae1));});})['catch'](function(_0x3b36e5){logger[_0x197c('0x3d')](_0x151e2f[_0x197c('0x22')],_0x197c('0x3e'),JSON['stringify'](_0x3b36e5));});});}logger[_0x197c('0x25')](_0x151e2f[_0x197c('0x22')],_0x197c('0x3e'));}};Fax['prototype']['syncOriginateResponse']=function(_0x3a5089){if(this[_0x197c('0xf')][_0x3a5089[_0x197c('0x22')]]){_[_0x197c('0x3f')](this[_0x197c('0xc')][_0x3a5089[_0x197c('0x22')]],_['pick'](_0x3a5089,[_0x197c('0x40'),'reason']));}};function updateStatus(_0x28be4b){if(_0x28be4b[_0x197c('0x41')]){faxMessage[_0x197c('0x42')](_0x28be4b[_0x197c('0x41')],{'failMessage':_0x197c('0x43')})[_0x197c('0x39')](function(_0x172720){ut[_0x197c('0x44')]('[Fax][Message][Error][Updated]',_0x172720);})[_0x197c('0x3a')](function(_0x1224f2){ut[_0x197c('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x1224f2);});}else{ut[_0x197c('0x44')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x197c('0x1d')][_0x197c('0x45')]=function(_0x1ec51a,_0x22a106,_0x1d7cdd){var _0x304537=this;var _0x360599={};if(_0x22a106){_0x360599={'read':_0x22a106};}else{_0x360599={'failMessage':_0x1d7cdd};}if(this[_0x197c('0xf')][_0x1ec51a]['AttachmentId']){faxMessage[_0x197c('0x42')](this[_0x197c('0xf')][_0x1ec51a][_0x197c('0x41')],_0x360599)['then'](function(_0x244faa){ut[_0x197c('0x44')](_0x197c('0x46'),_0x244faa);})[_0x197c('0x3a')](function(_0x3388fa){ut['logger']('[Fax][Message][NoUpdate1]',_0x3388fa);})[_0x197c('0x47')](function(){delete _0x304537[_0x197c('0xc')][_0x1ec51a];delete _0x304537[_0x197c('0xf')][_0x1ec51a];});}else{ut[_0x197c('0x44')](_0x197c('0x48'));delete this['channels'][_0x1ec51a];delete this['actions'][_0x1ec51a];}};Fax[_0x197c('0x1d')][_0x197c('0x49')]=function(_0x5855bd){var _0xb3747b=this;if(this[_0x197c('0xc')][_0x5855bd[_0x197c('0x22')]]){if(this[_0x197c('0xf')][_0x5855bd[_0x197c('0x22')]]){this[_0x197c('0xc')][_0x5855bd['uniqueid']]['id']=this[_0x197c('0xf')][_0x5855bd[_0x197c('0x22')]]['id'];this['channels'][_0x5855bd['uniqueid']][_0x197c('0x24')]=this['actions'][_0x5855bd[_0x197c('0x22')]][_0x197c('0x24')];}logger[_0x197c('0x25')](_0x5855bd['uniqueid'],this[_0x197c('0xf')][_0x5855bd[_0x197c('0x22')]]?'\x20hangup\x20sendFile\x20':_0x197c('0x4a'),JSON[_0x197c('0x3c')](this[_0x197c('0xc')][_0x5855bd['uniqueid']]));if(this[_0x197c('0xf')][_0x5855bd[_0x197c('0x22')]]){if(this['channels'][_0x5855bd['uniqueid']][_0x197c('0x4b')]>0x0&&this[_0x197c('0xc')][_0x5855bd[_0x197c('0x22')]]['faxstatus']===_0x197c('0x4c')){this[_0x197c('0x45')](_0x5855bd[_0x197c('0x22')],!![]);}else{this['updateStatus'](_0x5855bd[_0x197c('0x22')],![],this[_0x197c('0xc')][_0x5855bd[_0x197c('0x22')]][_0x197c('0x4d')]?_0x197c('0x4e')+this[_0x197c('0xc')][_0x5855bd[_0x197c('0x22')]][_0x197c('0x4d')]:_0x197c('0x4f'));}}}};Fax[_0x197c('0x1d')]['send']=function(_0x1f7ad0){var _0x572649=this;return new BPromise(function(_0x491162,_0x4a8e13){_0x572649['execOriginate'](_0x1f7ad0,_0x572649[_0x197c('0xd')][_0x1f7ad0[_0x197c('0x50')]])[_0x197c('0x39')](function(_0x3ad734){ut['logger'](_0x197c('0x51'),_0x3ad734);_0x491162(ut['message'](_0x197c('0x52')));})['catch'](function(_0x9df94b){ut['logger'](_0x197c('0x53'),_0x9df94b);updateStatus(_0x1f7ad0);_0x4a8e13(ut[_0x197c('0x36')](_0x197c('0x54')));});});};Fax[_0x197c('0x1d')]['checkAfterSend']=function(_0x2bbec2){var _0x304cb7=this;return new BPromise(function(_0x33ae9c,_0x523a69){var _0x2a4857=_0x304cb7[_0x197c('0x55')](_0x304cb7[_0x197c('0xd')][_0x2bbec2[_0x197c('0x50')]][_0x197c('0x56')],_0x2bbec2);if(_0x2a4857[_0x197c('0x57')]){_0x33ae9c(ut[_0x197c('0x36')](_0x197c('0x58')));}else{_0x523a69(ut[_0x197c('0x36')](_0x2a4857[_0x197c('0x36')]));}});};function originate(_0x342efa,_0x25d3c1,_0x43c0b2){return new BPromise(function(_0x395fce,_0x2b1c78){if(_0x43c0b2){var _0x18d530=util[_0x197c('0x59')](_0x197c('0x5a'),path['parse'](_0x342efa['path'])['name'],_0x342efa[_0x197c('0x5b')]);gs['execute'](_0x18d530)[_0x197c('0x39')](function(){_0x342efa['path']=util['format'](_0x197c('0x5c'),path[_0x197c('0x38')](_0x342efa[_0x197c('0x5b')])['dir'],path[_0x197c('0x38')](_0x342efa[_0x197c('0x5b')])['name']);_0x25d3c1[_0x197c('0x5d')]=_0x342efa[_0x197c('0x5b')];ut[_0x197c('0x44')](_0x197c('0x5e'),'');ami['Action'](ut[_0x197c('0x5f')](_0x342efa,_0x25d3c1))['then'](function(_0x315bd3){_0x395fce(_0x315bd3);})['catch'](function(_0x9411e8){_0x2b1c78(_0x9411e8);});})[_0x197c('0x3a')](function(_0x272674){_0x2b1c78(_0x272674);});}else{ami['Action'](ut[_0x197c('0x5f')](_0x342efa,_0x25d3c1))[_0x197c('0x39')](function(_0x328655){_0x395fce(_0x328655);})['catch'](function(_0xa6a5af){_0x2b1c78(_0xa6a5af);});}});}Fax[_0x197c('0x1d')][_0x197c('0x60')]=function(_0x284f54,_0xae273e){var _0x1c18aa=this;return new BPromise(function(_0x4bc7cc,_0x6f6c09){var _0x4f3192=uuid['v4']();var _0x51c88c=ut[_0x197c('0x61')](_0x284f54,_0xae273e);_0x1c18aa[_0x197c('0xf')][_0x4f3192]=new Action(_0x4f3192,_0xae273e,_0x284f54);var _0x58e708=_0x1c18aa[_0x197c('0xf')][_0x4f3192];if(path[_0x197c('0x38')](_0x284f54[_0x197c('0x5b')])[_0x197c('0x62')]===_0x197c('0x63')){originate(_0x58e708,_0x51c88c,!![])['then'](function(_0x5da64e){_0x4bc7cc(_0x5da64e);})['catch'](function(_0x5575fe){_0x6f6c09(_0x5575fe);});}else{originate(_0x58e708,_0x51c88c,![])[_0x197c('0x39')](function(_0x3d024b){_0x4bc7cc(_0x3d024b);})['catch'](function(_0x52e58b){_0x6f6c09(_0x52e58b);});}});};Fax[_0x197c('0x1d')]['isTrunkReachable']=function(_0x4b1088){return!_[_0x197c('0x64')](_0x4b1088)&&!_[_0x197c('0x64')](_0x4b1088[_0x197c('0x24')])&&!_[_0x197c('0x64')](_0x4b1088[_0x197c('0x65')])&&_0x4b1088[_0x197c('0x65')]&&!_['isNil'](this[_0x197c('0xe')][util[_0x197c('0x59')](_0x197c('0x66'),_0x4b1088[_0x197c('0x24')])])&&!_[_0x197c('0x64')](this[_0x197c('0xe')][util[_0x197c('0x59')]('SIP/%s',_0x4b1088[_0x197c('0x24')])][_0x197c('0x2c')])&&(this[_0x197c('0xe')][util[_0x197c('0x59')](_0x197c('0x66'),_0x4b1088[_0x197c('0x24')])]['status']===_0x197c('0x67')||this[_0x197c('0xe')][util['format'](_0x197c('0x66'),_0x4b1088[_0x197c('0x24')])][_0x197c('0x2c')]===_0x197c('0x68'));};Fax[_0x197c('0x1d')]['checkTrunk']=function(_0x54f819,_0x4e9b93){if(!this[_0x197c('0x69')](_0x54f819)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x197c('0x64')](_0x54f819)?'':_0x54f819[_0x197c('0x24')]+_0x197c('0x6a'));return{'isValid':![],'message':_0x197c('0x6b')};}if(_[_0x197c('0x64')](_0x4e9b93['fax'])){ut['logger'](_0x197c('0x6c'),JSON[_0x197c('0x3c')](_0x4e9b93));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x197c('0x64')](_0x4e9b93[_0x197c('0x5b')])){ut[_0x197c('0x44')](_0x197c('0x6d'),JSON[_0x197c('0x3c')](_0x4e9b93));return{'isValid':![],'message':_0x197c('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x197c('0x6f')]=Fax; \ No newline at end of file +var _0x4024=['Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','../../../config/logger','fax','./channel','./util/util','./action','../rpc/attachment','channels','trunks','actions','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','faxAccounts','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0x4024,0x89));var _0x4402=function(_0x58bf75,_0x296b1c){_0x58bf75=_0x58bf75-0x0;var _0x4f8cb7=_0x4024[_0x58bf75];return _0x4f8cb7;};'use strict';var util=require(_0x4402('0x0'));var _=require(_0x4402('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4402('0x2'));var moment=require(_0x4402('0x3'));var path=require('path');var tiff2pdf=require(_0x4402('0x4'));var gs=require('./util/gs');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x4402('0x7'));var ut=require(_0x4402('0x8'));var Action=require(_0x4402('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4402('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5c0b70){this[_0x4402('0xb')]={};this['faxAccounts']=_0x5c0b70['faxAccounts'];this[_0x4402('0xc')]=_0x5c0b70['trunks'];this[_0x4402('0xd')]={};ami['on']('newchannel',this[_0x4402('0xe')]['bind'](this));ami['on'](_0x4402('0xf'),this[_0x4402('0x10')]['bind'](this));ami['on'](_0x4402('0x11'),this[_0x4402('0x12')][_0x4402('0x13')](this));ami['on']('newexten',this[_0x4402('0x14')][_0x4402('0x13')](this));ami['on'](_0x4402('0x15'),this[_0x4402('0x16')][_0x4402('0x13')](this));ami['on'](_0x4402('0x17'),this[_0x4402('0x18')][_0x4402('0x13')](this));ami['on'](_0x4402('0x19'),this[_0x4402('0x1a')][_0x4402('0x13')](this));ami['on'](_0x4402('0x1b'),this[_0x4402('0x1c')][_0x4402('0x13')](this));}Fax[_0x4402('0x1d')][_0x4402('0xe')]=function(_0x399c24){if(_0x399c24[_0x4402('0x1e')]===_0x4402('0x1f')){for(var _0x231382 in this['faxAccounts']){if(this['faxAccounts'][_0x4402('0x20')](_0x231382)){if(_0x399c24[_0x4402('0x21')]===this['faxAccounts'][_0x231382][_0x4402('0x22')]){this[_0x4402('0xb')][_0x399c24['uniqueid']]={};this[_0x4402('0xb')][_0x399c24['uniqueid']]['channel']=_0x399c24[_0x4402('0x23')];this[_0x4402('0xb')][_0x399c24[_0x4402('0x24')]]['id']=this['faxAccounts'][_0x231382]['id'];this[_0x4402('0xb')][_0x399c24['uniqueid']]['name']=this[_0x4402('0x25')][_0x231382][_0x4402('0x26')];logger[_0x4402('0x27')](_0x399c24[_0x4402('0x24')],_0x4402('0x28'));}}}}if(this[_0x4402('0xd')][_0x399c24[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x399c24[_0x4402('0x24')]]={};this['channels'][_0x399c24[_0x4402('0x24')]]['channel']=_0x399c24[_0x4402('0x23')];logger[_0x4402('0x27')](_0x399c24[_0x4402('0x24')],_0x4402('0x28'));}};Fax['prototype'][_0x4402('0x10')]=function(_0x4e9cb5){if(this['channels'][_0x4e9cb5[_0x4402('0x24')]]){for(var _0x395e49 in _0x4e9cb5[_0x4402('0x29')]){if(_0x4e9cb5[_0x4402('0x29')][_0x4402('0x20')](_0x395e49)){this['channels'][_0x4e9cb5[_0x4402('0x24')]][_0x395e49]=_0x4e9cb5['value'];}}}};Fax[_0x4402('0x1d')][_0x4402('0x12')]=function(_0x42dd32){if(this['channels'][_0x42dd32[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x42dd32[_0x4402('0x24')]][_0x4402('0x2a')]=_0x42dd32[_0x4402('0x2a')];this[_0x4402('0xb')][_0x42dd32[_0x4402('0x24')]][_0x4402('0x2b')]=_0x42dd32[_0x4402('0x2b')];}};Fax[_0x4402('0x1d')][_0x4402('0x14')]=function(_0x50748c){if(this[_0x4402('0xb')][_0x50748c['uniqueid']]){for(var _0x336168 in _0x50748c['variable']){if(_0x50748c[_0x4402('0x29')][_0x4402('0x20')](_0x336168)){this[_0x4402('0xb')][_0x50748c[_0x4402('0x24')]][_0x336168]=_0x50748c[_0x4402('0x2c')];}}}};Fax['prototype'][_0x4402('0x16')]=function(_0x3fa7ae){if(this[_0x4402('0xb')][_0x3fa7ae['uniqueid']]){this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]]['operation']=_0x3fa7ae[_0x4402('0x2d')];this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x2e')]=_0x3fa7ae[_0x4402('0x2e')];this[_0x4402('0xb')][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x22')]=_0x3fa7ae[_0x4402('0x22')];this['channels'][_0x3fa7ae[_0x4402('0x24')]][_0x4402('0x2f')]=_0x3fa7ae[_0x4402('0x2f')];logger['info'](_0x3fa7ae[_0x4402('0x24')],_0x4402('0x30'));}};Fax['prototype']['syncReceiveFax']=function(_0x2b9d51){var _0x5b7c2e=this;if(this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]]){var _0x5569a2=this['channels'][_0x2b9d51['uniqueid']]['id'];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x31')]=_0x2b9d51[_0x4402('0x31')];this['channels'][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x32')]=_0x2b9d51[_0x4402('0x32')];this['channels'][_0x2b9d51[_0x4402('0x24')]]['localstationid']=_0x2b9d51[_0x4402('0x22')];this[_0x4402('0xb')][_0x2b9d51['uniqueid']][_0x4402('0x33')]=_0x2b9d51['resolution'];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]]['transferrate']=_0x2b9d51[_0x4402('0x34')];this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x2f')]=_0x2b9d51['filename'];this['channels'][_0x2b9d51[_0x4402('0x24')]]['calleridnum']=_0x2b9d51[_0x4402('0x35')];if(this[_0x4402('0xb')][_0x2b9d51[_0x4402('0x24')]][_0x4402('0x32')]>0x0){tiff2pdf(_0x2b9d51[_0x4402('0x2f')],_0x4402('0x36'),function(_0x173040){logger[_0x4402('0x27')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x37'),_0x173040['message']);attachment[_0x4402('0x38')]({'name':path[_0x4402('0x39')](_0x2b9d51['filename'])[_0x4402('0x26')],'basename':path[_0x4402('0x39')](_0x2b9d51['filename'])[_0x4402('0x26')]+_0x4402('0x3a'),'type':_0x4402('0x3b')})[_0x4402('0x3c')](function(_0x13a3a4){faxAccount['notify'](_0x5569a2,{'from':_0x2b9d51[_0x4402('0x35')],'mapKey':_0x4402('0x6'),'body':path[_0x4402('0x39')](_0x2b9d51[_0x4402('0x2f')])[_0x4402('0x26')]+_0x4402('0x3a'),'AttachmentId':_0x13a3a4['id']})[_0x4402('0x3d')](function(_0x136c9c){logger[_0x4402('0x3e')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x3f'),JSON['stringify'](_0x136c9c));});})[_0x4402('0x3d')](function(_0x4ff240){logger[_0x4402('0x3e')](_0x2b9d51[_0x4402('0x24')],'\x20receiveFax\x20',JSON[_0x4402('0x40')](_0x4ff240));});});}logger[_0x4402('0x27')](_0x2b9d51[_0x4402('0x24')],_0x4402('0x41'));}};Fax[_0x4402('0x1d')][_0x4402('0x1c')]=function(_0x5b094b){if(this[_0x4402('0xd')][_0x5b094b[_0x4402('0x24')]]){_[_0x4402('0x42')](this[_0x4402('0xb')][_0x5b094b[_0x4402('0x24')]],_[_0x4402('0x43')](_0x5b094b,[_0x4402('0x44'),_0x4402('0x45')]));}};function updateStatus(_0x216488){if(_0x216488['AttachmentId']){faxMessage['update'](_0x216488['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4402('0x3c')](function(_0x29e67b){ut[_0x4402('0x46')](_0x4402('0x47'),_0x29e67b);})['catch'](function(_0x169bb2){ut[_0x4402('0x46')](_0x4402('0x48'),_0x169bb2);});}else{ut[_0x4402('0x46')](_0x4402('0x49'));}}Fax[_0x4402('0x1d')][_0x4402('0x4a')]=function(_0x53d306,_0x325b20,_0x2a8085){var _0x38e6d1=this;var _0x11c162={};if(_0x325b20){_0x11c162={'read':_0x325b20};}else{_0x11c162={'failMessage':_0x2a8085};}if(this[_0x4402('0xd')][_0x53d306][_0x4402('0x4b')]){faxMessage['update'](this[_0x4402('0xd')][_0x53d306][_0x4402('0x4b')],_0x11c162)[_0x4402('0x3c')](function(_0x295c9b){ut[_0x4402('0x46')](_0x4402('0x4c'),_0x295c9b);})[_0x4402('0x3d')](function(_0x5dbf62){ut['logger'](_0x4402('0x4d'),_0x5dbf62);})[_0x4402('0x4e')](function(){delete _0x38e6d1[_0x4402('0xb')][_0x53d306];delete _0x38e6d1['actions'][_0x53d306];});}else{ut['logger'](_0x4402('0x4f'));delete this[_0x4402('0xb')][_0x53d306];delete this[_0x4402('0xd')][_0x53d306];}};Fax[_0x4402('0x1d')][_0x4402('0x1a')]=function(_0x37ba14){var _0x248104=this;if(this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]){if(this[_0x4402('0xd')][_0x37ba14[_0x4402('0x24')]]){this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]['id']=this['actions'][_0x37ba14[_0x4402('0x24')]]['id'];this['channels'][_0x37ba14[_0x4402('0x24')]]['name']=this[_0x4402('0xd')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x26')];}logger[_0x4402('0x27')](_0x37ba14[_0x4402('0x24')],this[_0x4402('0xd')][_0x37ba14['uniqueid']]?_0x4402('0x50'):_0x4402('0x51'),JSON[_0x4402('0x40')](this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]));if(this['actions'][_0x37ba14[_0x4402('0x24')]]){if(this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x52')]>0x0&&this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x15')]===_0x4402('0x53')){this['updateStatus'](_0x37ba14[_0x4402('0x24')],!![]);}else{this[_0x4402('0x4a')](_0x37ba14['uniqueid'],![],this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x4402('0xb')][_0x37ba14[_0x4402('0x24')]][_0x4402('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x4402('0x1d')][_0x4402('0x55')]=function(_0x30e49b){var _0x55f261=this;return new BPromise(function(_0x2fe275,_0x41a2c6){_0x55f261[_0x4402('0x56')](_0x30e49b,_0x55f261['faxAccounts'][_0x30e49b[_0x4402('0x57')]])[_0x4402('0x3c')](function(_0x4f9865){ut['logger'](_0x4402('0x58'),_0x4f9865);_0x2fe275(ut['message'](_0x4402('0x59')));})[_0x4402('0x3d')](function(_0x4a83ac){ut['logger'](_0x4402('0x5a'),_0x4a83ac);updateStatus(_0x30e49b);_0x41a2c6(ut[_0x4402('0x5b')](_0x4402('0x5c')));});});};Fax[_0x4402('0x1d')]['checkAfterSend']=function(_0x1ee8a9){var _0x30e5d5=this;return new BPromise(function(_0x22ed41,_0x168095){var _0x2b2b40=_0x30e5d5[_0x4402('0x5d')](_0x30e5d5[_0x4402('0x25')][_0x1ee8a9['FaxAccountId']][_0x4402('0x5e')],_0x1ee8a9);if(_0x2b2b40[_0x4402('0x5f')]){_0x22ed41(ut['message']('Trunk\x20Reachable'));}else{_0x168095(ut[_0x4402('0x5b')](_0x2b2b40['message']));}});};function originate(_0x30569e,_0x586689,_0xc2ac06){return new BPromise(function(_0x10b89a,_0x22260b){if(_0xc2ac06){var _0x3f196a=util[_0x4402('0x60')](_0x4402('0x61'),path[_0x4402('0x39')](_0x30569e[_0x4402('0x62')])[_0x4402('0x26')],_0x30569e[_0x4402('0x62')]);gs[_0x4402('0x63')](_0x3f196a)[_0x4402('0x3c')](function(){_0x30569e[_0x4402('0x62')]=util[_0x4402('0x60')](_0x4402('0x64'),path[_0x4402('0x39')](_0x30569e['path'])[_0x4402('0x65')],path[_0x4402('0x39')](_0x30569e[_0x4402('0x62')])['name']);_0x586689[_0x4402('0x66')]=_0x30569e['path'];ut[_0x4402('0x46')](_0x4402('0x67'),'');ami[_0x4402('0x68')](ut[_0x4402('0x69')](_0x30569e,_0x586689))['then'](function(_0xac8513){_0x10b89a(_0xac8513);})['catch'](function(_0x127d47){_0x22260b(_0x127d47);});})[_0x4402('0x3d')](function(_0x24ee20){_0x22260b(_0x24ee20);});}else{ami['Action'](ut[_0x4402('0x69')](_0x30569e,_0x586689))['then'](function(_0x349ad1){_0x10b89a(_0x349ad1);})[_0x4402('0x3d')](function(_0x1be905){_0x22260b(_0x1be905);});}});}Fax[_0x4402('0x1d')][_0x4402('0x56')]=function(_0x1d0bf4,_0x19b427){var _0x2bed7c=this;return new BPromise(function(_0x438048,_0x5054f9){var _0x44d806=uuid['v4']();var _0x55a767=ut[_0x4402('0x6a')](_0x1d0bf4,_0x19b427);_0x2bed7c[_0x4402('0xd')][_0x44d806]=new Action(_0x44d806,_0x19b427,_0x1d0bf4);var _0x4734ef=_0x2bed7c[_0x4402('0xd')][_0x44d806];if(path[_0x4402('0x39')](_0x1d0bf4[_0x4402('0x62')])[_0x4402('0x6b')]==='.pdf'){originate(_0x4734ef,_0x55a767,!![])[_0x4402('0x3c')](function(_0x2a6dc1){_0x438048(_0x2a6dc1);})[_0x4402('0x3d')](function(_0x4c4845){_0x5054f9(_0x4c4845);});}else{originate(_0x4734ef,_0x55a767,![])[_0x4402('0x3c')](function(_0x59fc06){_0x438048(_0x59fc06);})[_0x4402('0x3d')](function(_0x4f3d70){_0x5054f9(_0x4f3d70);});}});};Fax[_0x4402('0x1d')][_0x4402('0x6c')]=function(_0x552962){return!_[_0x4402('0x6d')](_0x552962)&&!_['isNil'](_0x552962[_0x4402('0x26')])&&!_[_0x4402('0x6d')](_0x552962['active'])&&_0x552962[_0x4402('0x6e')]&&!_[_0x4402('0x6d')](this['trunks'][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962['name'])])&&!_[_0x4402('0x6d')](this[_0x4402('0xc')][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962[_0x4402('0x26')])][_0x4402('0x2e')])&&(this[_0x4402('0xc')][util[_0x4402('0x60')](_0x4402('0x6f'),_0x552962[_0x4402('0x26')])][_0x4402('0x2e')]===_0x4402('0x70')||this[_0x4402('0xc')][util[_0x4402('0x60')]('SIP/%s',_0x552962[_0x4402('0x26')])][_0x4402('0x2e')]==='unmonitored');};Fax[_0x4402('0x1d')]['checkTrunk']=function(_0x2c7ff5,_0x778945){if(!this[_0x4402('0x6c')](_0x2c7ff5)){ut['logger'](_0x4402('0x71'),_[_0x4402('0x6d')](_0x2c7ff5)?'':_0x2c7ff5[_0x4402('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4402('0x72')};}if(_[_0x4402('0x6d')](_0x778945[_0x4402('0x6')])){ut[_0x4402('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x4402('0x40')](_0x778945));return{'isValid':![],'message':_0x4402('0x73')};}if(_[_0x4402('0x6d')](_0x778945[_0x4402('0x62')])){ut[_0x4402('0x46')](_0x4402('0x74'),JSON[_0x4402('0x40')](_0x778945));return{'isValid':![],'message':_0x4402('0x75')};}return{'isValid':!![],'message':_0x4402('0x76')};};module[_0x4402('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d700d5b..48f594a 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 _0x248f=['lodash','../rpc/faxAccount','error','inspect','notify','catch','util','bluebird','../../../config/logger','preview'];(function(_0x20b04c,_0xd79139){var _0x5b4236=function(_0x5c4f9e){while(--_0x5c4f9e){_0x20b04c['push'](_0x20b04c['shift']());}};_0x5b4236(++_0xd79139);}(_0x248f,0x88));var _0xf248=function(_0x1331b2,_0x3df22b){_0x1331b2=_0x1331b2-0x0;var _0x10f741=_0x248f[_0x1331b2];return _0x10f741;};'use strict';var util=require(_0xf248('0x0'));var BPromise=require(_0xf248('0x1'));var logger=require(_0xf248('0x2'))(_0xf248('0x3'));var _=require(_0xf248('0x4'));var faxAccount=require(_0xf248('0x5'));function loggerCatch(_0xe1f684){return function(_0x50e4a5){logger[_0xf248('0x6')](_0xe1f684,util[_0xf248('0x7')](_0x50e4a5,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x279dd4,_0x1e69d7){return BPromise['resolve']()['then'](faxAccount[_0xf248('0x8')](_0x279dd4,_0x1e69d7))[_0xf248('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xc20a=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xc20a,0x161));var _0xac20=function(_0x37205b,_0x332146){_0x37205b=_0x37205b-0x0;var _0x2757f3=_0xc20a[_0x37205b];return _0x2757f3;};'use strict';var util=require(_0xac20('0x0'));var BPromise=require('bluebird');var logger=require(_0xac20('0x1'))(_0xac20('0x2'));var _=require(_0xac20('0x3'));var faxAccount=require(_0xac20('0x4'));function loggerCatch(_0x4a8b56){return function(_0x13ec33){logger[_0xac20('0x5')](_0x4a8b56,util[_0xac20('0x6')](_0x13ec33,{'showHidden':![],'depth':null}));};}exports[_0xac20('0x7')]=function(_0x43df9b,_0x5e39b8){return BPromise[_0xac20('0x8')]()[_0xac20('0x9')](faxAccount[_0xac20('0x7')](_0x43df9b,_0x5e39b8))['catch'](loggerCatch(_0xac20('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 375ab09..6a902cb 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 _0x0369=['Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process','execute','info'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0369,0x191));var _0x9036=function(_0x364ca8,_0x4e43e4){_0x364ca8=_0x364ca8-0x0;var _0x33cd8b=_0x0369[_0x364ca8];return _0x33cd8b;};'use strict';var util=require(_0x9036('0x0'));var logger=require(_0x9036('0x1'))(_0x9036('0x2'));var BPromise=require(_0x9036('0x3'));var exec=require(_0x9036('0x4'))['exec'];exports[_0x9036('0x5')]=function(_0x488e7f){return new BPromise(function(_0x5d3da7,_0x3af2d2){exec(_0x488e7f,function(_0x1d976f,_0x66ccec,_0x3991a7){logger[_0x9036('0x6')](_0x9036('0x7'),_0x66ccec);if(_0x1d976f){logger[_0x9036('0x6')](_0x9036('0x7'),'\x20Error\x20:',util['inspect'](_0x1d976f,{'showHidden':![],'depth':null}),_0x66ccec,_0x3991a7);_0x3af2d2(_0x1d976f);}_0x5d3da7(_0x66ccec);});});}; \ No newline at end of file +var _0xd747=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0xe4ce33,_0x3ed33f){var _0x556572=function(_0x502635){while(--_0x502635){_0xe4ce33['push'](_0xe4ce33['shift']());}};_0x556572(++_0x3ed33f);}(_0xd747,0x169));var _0x7d74=function(_0x242345,_0x37f974){_0x242345=_0x242345-0x0;var _0x29cb44=_0xd747[_0x242345];return _0x29cb44;};'use strict';var util=require(_0x7d74('0x0'));var logger=require(_0x7d74('0x1'))(_0x7d74('0x2'));var BPromise=require(_0x7d74('0x3'));var exec=require(_0x7d74('0x4'))[_0x7d74('0x5')];exports[_0x7d74('0x6')]=function(_0xfe3952){return new BPromise(function(_0xf4b241,_0x4fbad2){exec(_0xfe3952,function(_0x4dab2b,_0x8a5d68,_0x39631a){logger[_0x7d74('0x7')](_0x7d74('0x8'),_0x8a5d68);if(_0x4dab2b){logger[_0x7d74('0x7')](_0x7d74('0x8'),_0x7d74('0x9'),util[_0x7d74('0xa')](_0x4dab2b,{'showHidden':![],'depth':null}),_0x8a5d68,_0x39631a);_0x4fbad2(_0x4dab2b);}_0xf4b241(_0x8a5d68);});});}; \ 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 8e70a1f..f6cf33f 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 _0x4489=['\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','localstationid','path','variablesAction','originate','xcally-motion-fax','format'];(function(_0x52452e,_0xbbff70){var _0x5a4743=function(_0x1ed304){while(--_0x1ed304){_0x52452e['push'](_0x52452e['shift']());}};_0x5a4743(++_0xbbff70);}(_0x4489,0x1cf));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x9448('0x0'));var moment=require(_0x9448('0x1'));var logger=require(_0x9448('0x2'))(_0x9448('0x3'));exports[_0x9448('0x4')]=function(_0x397604){return{'message':_0x397604};};exports['logger']=function(_0x30600a,_0x2755a3){logger[_0x9448('0x5')](_0x30600a,util[_0x9448('0x6')](_0x2755a3,{'showHidden':![],'depth':null}));};exports[_0x9448('0x7')]=function(_0x546c32,_0x34ccc7){var _0x348b27={'XMF-ECM':_0x34ccc7[_0x9448('0x8')],'XMF-HEADERINFO':_0x34ccc7[_0x9448('0x9')],'XMF-MINRATE':_0x34ccc7[_0x9448('0xa')],'XMF-MAXRATE':_0x34ccc7[_0x9448('0xb')],'XMF-MODEM':util['format'](_0x9448('0xc'),_0x34ccc7[_0x9448('0xd')]),'XMF-GATEWAY':_0x34ccc7[_0x9448('0xe')],'XMF-FAXDETECT':_0x34ccc7['faxdetect'],'XMF-T38TIMEOUT':_0x34ccc7['t38timeout'],'XMF-LOCALSTATIONID':_0x34ccc7[_0x9448('0xf')],'XMF-PATH':_0x546c32[_0x9448('0x10')]};return _0x348b27;};exports[_0x9448('0x11')]=function(_0x5e10fd,_0x3b065e){return{'actionid':_0x5e10fd['uniqueid'],'action':_0x9448('0x12'),'channel':_0x5e10fd['channel'],'Exten':_0x9448('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x9448('0x14')](_0x9448('0x15'),_0x5e10fd['headerinfo']?_0x5e10fd[_0x9448('0x9')]:'',_0x5e10fd['localstationid']),'variable':_0x3b065e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5e10fd['uniqueid']};}; \ No newline at end of file +var _0xac7f=['inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','fax','message','logger'];(function(_0x3e744,_0x27129){var _0xdbf4b=function(_0x2aee99){while(--_0x2aee99){_0x3e744['push'](_0x3e744['shift']());}};_0xdbf4b(++_0x27129);}(_0xac7f,0x15c));var _0xfac7=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xac7f[_0xc4001c];return _0x49f7bc;};'use strict';var util=require(_0xfac7('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xfac7('0x1'));exports[_0xfac7('0x2')]=function(_0x1bda10){return{'message':_0x1bda10};};exports[_0xfac7('0x3')]=function(_0x2d7b84,_0x19b0a4){logger['info'](_0x2d7b84,util[_0xfac7('0x4')](_0x19b0a4,{'showHidden':![],'depth':null}));};exports[_0xfac7('0x5')]=function(_0x381d9e,_0x40bd30){var _0x138a07={'XMF-ECM':_0x40bd30['ecm'],'XMF-HEADERINFO':_0x40bd30[_0xfac7('0x6')],'XMF-MINRATE':_0x40bd30['minrate'],'XMF-MAXRATE':_0x40bd30[_0xfac7('0x7')],'XMF-MODEM':util[_0xfac7('0x8')](_0xfac7('0x9'),_0x40bd30[_0xfac7('0xa')]),'XMF-GATEWAY':_0x40bd30[_0xfac7('0xb')],'XMF-FAXDETECT':_0x40bd30[_0xfac7('0xc')],'XMF-T38TIMEOUT':_0x40bd30[_0xfac7('0xd')],'XMF-LOCALSTATIONID':_0x40bd30[_0xfac7('0xe')],'XMF-PATH':_0x381d9e[_0xfac7('0xf')]};return _0x138a07;};exports[_0xfac7('0x10')]=function(_0x44bbd3,_0x4acc3b){return{'actionid':_0x44bbd3[_0xfac7('0x11')],'action':_0xfac7('0x12'),'channel':_0x44bbd3[_0xfac7('0x13')],'Exten':'xcally-motion-fax','Context':_0xfac7('0x14'),'Priority':'1','callerid':util['format'](_0xfac7('0x15'),_0x44bbd3[_0xfac7('0x6')]?_0x44bbd3[_0xfac7('0x6')]:'',_0x44bbd3['localstationid']),'variable':_0x4acc3b,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x44bbd3[_0xfac7('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8a504d0..46799c2 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 _0x9850=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','[index.js][main]','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts'];(function(_0x2c4ee0,_0x2b2341){var _0x281568=function(_0x4e8667){while(--_0x4e8667){_0x2c4ee0['push'](_0x2c4ee0['shift']());}};_0x281568(++_0x2b2341);}(_0x9850,0xe1));var _0x0985=function(_0x1b61b1,_0x125577){_0x1b61b1=_0x1b61b1-0x0;var _0x3626b2=_0x9850[_0x1b61b1];return _0x3626b2;};'use strict';var BPromise=require(_0x0985('0x0'));var util=require(_0x0985('0x1'));var moment=require(_0x0985('0x2'));var server=require('./server');var Realtime=require(_0x0985('0x3'));var Report=require(_0x0985('0x4'));var Acw=require(_0x0985('0x5'));var Trigger=require(_0x0985('0x6'));var Dialer=require('./dialer');var Preview=require(_0x0985('0x7'));var Fax=require(_0x0985('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x0985('0x9'));var voiceQueueReport=require(_0x0985('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x0985('0xb'));var template=require(_0x0985('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0985('0xd'));var voiceExtension=require(_0x0985('0xe'));var faxAccount=require(_0x0985('0xf'));var zendesk=require(_0x0985('0x10'));var salesforce=require(_0x0985('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0985('0x12'));var desk=require(_0x0985('0x13'));var zoho=require(_0x0985('0x14'));var vtiger=require(_0x0985('0x15'));var freshsales=require(_0x0985('0x16'));var servicenow=require(_0x0985('0x17'));var dynamics365=require(_0x0985('0x18'));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(_0x0985('0x19'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0985('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x0985('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0985('0x1c')]()[_0x0985('0x1d')](user['getAgents']())[_0x0985('0x1d')](realtime[_0x0985('0x1e')]())[_0x0985('0x1d')](user[_0x0985('0x1f')]())[_0x0985('0x1d')](realtime[_0x0985('0x20')]())[_0x0985('0x1d')](trunk['getTrunks']())['then'](realtime[_0x0985('0x21')]())['then'](voiceQueue[_0x0985('0x22')]())[_0x0985('0x1d')](realtime[_0x0985('0x23')]())[_0x0985('0x1d')](trigger['getTriggers']())[_0x0985('0x1d')](realtime[_0x0985('0x24')]())[_0x0985('0x1d')](template[_0x0985('0x25')]())[_0x0985('0x1d')](realtime[_0x0985('0x26')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime[_0x0985('0x27')]())[_0x0985('0x1d')](salesforce[_0x0985('0x28')]())[_0x0985('0x1d')](realtime[_0x0985('0x29')]())[_0x0985('0x1d')](sugarcrm[_0x0985('0x2a')]())['then'](realtime[_0x0985('0x2b')]())['then'](freshdesk[_0x0985('0x2c')]())[_0x0985('0x1d')](realtime['initFreshdeskAccounts']())['then'](desk[_0x0985('0x2d')]())[_0x0985('0x1d')](realtime['initDeskAccounts']())[_0x0985('0x1d')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0x0985('0x1d')](vtiger[_0x0985('0x2e')]())[_0x0985('0x1d')](realtime[_0x0985('0x2f')]())[_0x0985('0x1d')](freshsales[_0x0985('0x30')]())[_0x0985('0x1d')](realtime[_0x0985('0x31')]())[_0x0985('0x1d')](servicenow['getServicenowAccounts']())['then'](realtime[_0x0985('0x32')]())[_0x0985('0x1d')](dynamics365[_0x0985('0x33')]())['then'](realtime[_0x0985('0x34')]())['then'](campaign[_0x0985('0x35')]())[_0x0985('0x1d')](realtime[_0x0985('0x36')]())[_0x0985('0x1d')](voiceExtension[_0x0985('0x37')]())[_0x0985('0x1d')](realtime[_0x0985('0x38')]())[_0x0985('0x1d')](faxAccount[_0x0985('0x39')]())[_0x0985('0x1d')](realtime[_0x0985('0x3a')]())[_0x0985('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x0985('0x1c')]()[_0x0985('0x1d')](voiceQueueReport[_0x0985('0x3b')]())[_0x0985('0x1d')](realtime['initVoiceQueueReports']())[_0x0985('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x0985('0x1d')](realtime[_0x0985('0x3c')]())[_0x0985('0x1d')](cmHopperHistory[_0x0985('0x3d')]())[_0x0985('0x1d')](realtime[_0x0985('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x0985('0x1d')](realtime[_0x0985('0x3f')]())[_0x0985('0x40')](function(_0x3857f7){logger[_0x0985('0x41')](_0x0985('0x42'),util[_0x0985('0x43')](_0x3857f7,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x0985('0x1d')](function(_0x3faf75){return initRealtime();})[_0x0985('0x1d')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x0985('0x40')](function(_0x437a86){logger[_0x0985('0x41')](_0x0985('0x44'),util['inspect'](_0x437a86,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x72ac=['bluebird','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]'];(function(_0x45f6e2,_0xe72d77){var _0x573b09=function(_0x3aa398){while(--_0x3aa398){_0x45f6e2['push'](_0x45f6e2['shift']());}};_0x573b09(++_0xe72d77);}(_0x72ac,0xd5));var _0xc72a=function(_0x17c648,_0x3185b0){_0x17c648=_0x17c648-0x0;var _0x22dc52=_0x72ac[_0x17c648];return _0x22dc52;};'use strict';var BPromise=require(_0xc72a('0x0'));var util=require(_0xc72a('0x1'));var moment=require(_0xc72a('0x2'));var server=require('./server');var Realtime=require(_0xc72a('0x3'));var Report=require(_0xc72a('0x4'));var Acw=require(_0xc72a('0x5'));var Trigger=require(_0xc72a('0x6'));var Dialer=require(_0xc72a('0x7'));var Preview=require(_0xc72a('0x8'));var Fax=require(_0xc72a('0x9'));var user=require(_0xc72a('0xa'));var voiceQueue=require(_0xc72a('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc72a('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xc72a('0xd'));var cmHopperHistory=require(_0xc72a('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xc72a('0xf'));var faxAccount=require(_0xc72a('0x10'));var zendesk=require(_0xc72a('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xc72a('0x12'));var freshdesk=require(_0xc72a('0x13'));var desk=require(_0xc72a('0x14'));var zoho=require(_0xc72a('0x15'));var vtiger=require(_0xc72a('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xc72a('0x17'));var dynamics365=require(_0xc72a('0x18'));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(_0xc72a('0x19'))(_0xc72a('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc72a('0x1b')](_0xc72a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc72a('0x1b')](_0xc72a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc72a('0x1d')]()[_0xc72a('0x1e')](user[_0xc72a('0x1f')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x20')]())[_0xc72a('0x1e')](user[_0xc72a('0x21')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x22')]())[_0xc72a('0x1e')](trunk[_0xc72a('0x23')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x24')]())[_0xc72a('0x1e')](voiceQueue['getVoiceQueues']())[_0xc72a('0x1e')](realtime[_0xc72a('0x25')]())[_0xc72a('0x1e')](trigger['getTriggers']())[_0xc72a('0x1e')](realtime['initTriggers']())[_0xc72a('0x1e')](template[_0xc72a('0x26')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x27')]())['then'](zendesk[_0xc72a('0x28')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x29')]())[_0xc72a('0x1e')](salesforce[_0xc72a('0x2a')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2b')]())[_0xc72a('0x1e')](sugarcrm[_0xc72a('0x2c')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2d')]())[_0xc72a('0x1e')](freshdesk[_0xc72a('0x2e')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x2f')]())[_0xc72a('0x1e')](desk[_0xc72a('0x30')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x31')]())['then'](zoho[_0xc72a('0x32')]())[_0xc72a('0x1e')](realtime['initZohoAccounts']())[_0xc72a('0x1e')](vtiger['getVtigerAccounts']())[_0xc72a('0x1e')](realtime[_0xc72a('0x33')]())['then'](freshsales[_0xc72a('0x34')]())['then'](realtime['initFreshsalesAccounts']())[_0xc72a('0x1e')](servicenow[_0xc72a('0x35')]())[_0xc72a('0x1e')](realtime['initServicenowAccounts']())['then'](dynamics365[_0xc72a('0x36')]())[_0xc72a('0x1e')](realtime['initDynamics365Accounts']())[_0xc72a('0x1e')](campaign[_0xc72a('0x37')]())[_0xc72a('0x1e')](realtime['initCampaigns']())[_0xc72a('0x1e')](voiceExtension[_0xc72a('0x38')]())[_0xc72a('0x1e')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xc72a('0x39')]())['then'](realtime[_0xc72a('0x3a')]())[_0xc72a('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xc72a('0x1d')]()[_0xc72a('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0xc72a('0x1e')](realtime[_0xc72a('0x3b')]())[_0xc72a('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xc72a('0x3c')]())[_0xc72a('0x1e')](cmHopperHistory[_0xc72a('0x3d')]())[_0xc72a('0x1e')](realtime[_0xc72a('0x3e')]())[_0xc72a('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xc72a('0x1e')](realtime[_0xc72a('0x3f')]())[_0xc72a('0x40')](function(_0x5e785e){logger[_0xc72a('0x41')](_0xc72a('0x42'),util[_0xc72a('0x43')](_0x5e785e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xc72a('0x44')](realtime,preview,fax)[_0xc72a('0x1e')](function(_0x37daad){return initRealtime();})['then'](function(){return initParams();})[_0xc72a('0x1e')](function(){report[_0xc72a('0x45')]();setInterval(initRealtime,0x1388);})[_0xc72a('0x40')](function(_0x1fbe04){logger[_0xc72a('0x41')](_0xc72a('0x46'),util[_0xc72a('0x43')](_0x1fbe04,{'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 69b475f..3d83e5b 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xedd9,0xfc));var _0x9edd=function(_0x5f5ac5,_0x526505){_0x5f5ac5=_0x5f5ac5-0x0;var _0x3697f2=_0xedd9[_0x5f5ac5];return _0x3697f2;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0x34e8=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','inuse','talking','voiceStatus','toNumber','format','voiceStatusCallerIdNumber','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile'];(function(_0x57eef5,_0x293b3b){var _0x4e3233=function(_0x18229b){while(--_0x18229b){_0x57eef5['push'](_0x57eef5['shift']());}};_0x4e3233(++_0x293b3b);}(_0x34e8,0x12c));var _0x834e=function(_0x399f8d,_0x4e77ce){_0x399f8d=_0x399f8d-0x0;var _0x223874=_0x34e8[_0x399f8d];return _0x223874;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var Redis=require('ioredis');var config=require(_0x834e('0x4'));config[_0x834e('0x5')]=_[_0x834e('0x6')](config[_0x834e('0x5')],{'host':_0x834e('0x7'),'port':0x18eb});var io=require(_0x834e('0x8'))(new Redis(config[_0x834e('0x5')]));function Agent(_0x4a2018){this['id']=_0x4a2018['id']||0x0;this[_0x834e('0x9')]=_0x4a2018['name']||'';this[_0x834e('0xa')]=_0x4a2018[_0x834e('0xa')]||'';this[_0x834e('0xb')]=_0x4a2018[_0x834e('0xb')]||'';this[_0x834e('0xc')]=_0x4a2018[_0x834e('0xc')]||'';this[_0x834e('0xd')]=_0x834e('0xe');this[_0x834e('0xf')]=0x0;this[_0x834e('0x10')]=_0x834e('0xe');this[_0x834e('0x11')]='';this[_0x834e('0x12')]='';this[_0x834e('0x13')]='';this[_0x834e('0x14')]='';this[_0x834e('0x15')]=_0x4a2018[_0x834e('0x15')]||![];this['voiceStatus']=_0x834e('0xe');this[_0x834e('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x834e('0x17')]='';this[_0x834e('0x18')]=![];this[_0x834e('0x19')]=![];this[_0x834e('0x3')]='';}Agent['prototype'][_0x834e('0x1a')]=function(_0x302cbd){var _0x57274a;if(_0x302cbd&&_0x302cbd[_0x834e('0xd')]){_0x57274a=_0x302cbd['state'][_0x834e('0x1b')]();switch(_0x57274a){case _0x834e('0x1c'):_0x57274a='idle';break;case _0x834e('0x1d'):_0x57274a=_0x834e('0x1e');break;}}if(_0x57274a&&this[_0x834e('0x1f')]!==_0x57274a||_0x302cbd['statePause']){this[_0x834e('0x16')]=_[_0x834e('0x20')](moment()[_0x834e('0x21')]('x'));}if(_0x57274a){this[_0x834e('0x1f')]=_0x57274a;}var _0x237947={'id':this['id'],'name':this[_0x834e('0x9')],'email':this[_0x834e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x834e('0xc')],'state':this[_0x834e('0xd')],'stateTime':this[_0x834e('0xf')],'status':this[_0x834e('0x10')],'address':this['address'],'online':this[_0x834e('0x15')],'voiceStatus':this[_0x834e('0x1f')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x834e('0x22')],'voiceStatusQueue':this[_0x834e('0x17')],'interface':this[_0x834e('0x14')],'onhold':this['onhold']};var _0x4e3f48=md5(JSON[_0x834e('0x23')](_0x237947));if(this[_0x834e('0x3')]!==_0x4e3f48){this['md5']=_0x4e3f48;io['to'](util[_0x834e('0x21')](_0x834e('0x24'),_0x237947['name']))[_0x834e('0x25')](_0x834e('0x26'),_0x237947);io[_0x834e('0x25')]('user:presence',_0x237947);}};module[_0x834e('0x27')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a3c35f6..e405b70 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 _0x5966=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x3321ca,_0x1c1598){var _0x3bf909=function(_0x70931a){while(--_0x70931a){_0x3321ca['push'](_0x3321ca['shift']());}};_0x3bf909(++_0x1c1598);}(_0x5966,0x148));var _0x6596=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x5966[_0x21d0c3];return _0x4df18e;};'use strict';function Campaign(_0x4a9a7c){this['id']=_0x4a9a7c['id']||0x0;this[_0x6596('0x0')]=_0x4a9a7c[_0x6596('0x0')]||'';this[_0x6596('0x1')]=_0x4a9a7c[_0x6596('0x1')]||_0x6596('0x2');this[_0x6596('0x3')]=0x0;this['temp']=0x0;this[_0x6596('0x4')]=0x0;this[_0x6596('0x5')]=0x0;this[_0x6596('0x6')]='';this[_0x6596('0x7')]=!![];this[_0x6596('0x8')]=_0x4a9a7c['active'];this[_0x6596('0x9')]=_0x4a9a7c['limitCalls'];this['dialTimezone']=_0x4a9a7c[_0x6596('0xa')]||null;this['dialGlobalInterval']=_0x4a9a7c[_0x6596('0xb')]?_0x4a9a7c[_0x6596('0xb')]:null;this[_0x6596('0xc')]=_0x4a9a7c['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4a9a7c[_0x6596('0xd')];this[_0x6596('0xe')]=_0x4a9a7c[_0x6596('0xe')]||0x1e;this[_0x6596('0xf')]=_0x4a9a7c['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4a9a7c[_0x6596('0x10')];this['dialBusyMaxRetry']=_0x4a9a7c['dialBusyMaxRetry'];this[_0x6596('0x11')]=_0x4a9a7c[_0x6596('0x11')];this[_0x6596('0x12')]=_0x4a9a7c[_0x6596('0x12')];this[_0x6596('0x13')]=_0x4a9a7c['dialNoAnswerRetryFrequency'];this[_0x6596('0x14')]=_0x4a9a7c[_0x6596('0x14')];this['dialNoSuchNumberMaxRetry']=_0x4a9a7c[_0x6596('0x15')]||0x3;this[_0x6596('0x16')]=_0x4a9a7c['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6596('0x17')]=_0x4a9a7c[_0x6596('0x17')]||0x3;this[_0x6596('0x18')]=_0x4a9a7c['dialDropRetryFrequency']||0x96;this[_0x6596('0x19')]=_0x4a9a7c[_0x6596('0x19')]||0x3;this[_0x6596('0x1a')]=_0x4a9a7c[_0x6596('0x1a')]||0x96;this[_0x6596('0x1b')]=_0x4a9a7c['dialMachineMaxRetry']||0x3;this[_0x6596('0x1c')]=_0x4a9a7c[_0x6596('0x1c')]||0x96;this[_0x6596('0x1d')]=_0x4a9a7c[_0x6596('0x1d')]||0x3;this[_0x6596('0x1e')]=_0x4a9a7c['dialAgentRejectRetryFrequency']||0x96;this[_0x6596('0x1f')]=_0x4a9a7c[_0x6596('0x1f')]||_0x6596('0x20');this[_0x6596('0x21')]=_0x4a9a7c[_0x6596('0x21')]||undefined;this[_0x6596('0x22')]=_0x4a9a7c[_0x6596('0x22')]||undefined;this[_0x6596('0x23')]=_0x4a9a7c[_0x6596('0x23')]||undefined;this[_0x6596('0x24')]=_0x4a9a7c[_0x6596('0x24')]?_0x4a9a7c[_0x6596('0x24')]:undefined;this[_0x6596('0x25')]=_0x4a9a7c[_0x6596('0x25')]?_0x4a9a7c[_0x6596('0x25')]:undefined;this[_0x6596('0x26')]=_0x4a9a7c[_0x6596('0x26')]?_0x4a9a7c[_0x6596('0x26')]:undefined;this['SquareProject']=_0x4a9a7c[_0x6596('0x27')]?_0x4a9a7c[_0x6596('0x27')]:undefined;this[_0x6596('0x28')]=_0x4a9a7c[_0x6596('0x27')]?_0x4a9a7c['SquareProject'][_0x6596('0x0')]:undefined;this[_0x6596('0x29')]=_0x4a9a7c[_0x6596('0x29')]||![];this['dialAMDInitialSilence']=_0x4a9a7c[_0x6596('0x2a')];this[_0x6596('0x2b')]=_0x4a9a7c[_0x6596('0x2b')];this[_0x6596('0x2c')]=_0x4a9a7c['dialAMDAfterGreetingSilence'];this[_0x6596('0x2d')]=_0x4a9a7c['dialAMDTotalAnalysisTime'];this[_0x6596('0x2e')]=_0x4a9a7c[_0x6596('0x2e')];this[_0x6596('0x2f')]=_0x4a9a7c['dialAMDBetweenWordsSilence'];this[_0x6596('0x30')]=_0x4a9a7c[_0x6596('0x30')];this['dialAMDSilenceThreshold']=_0x4a9a7c[_0x6596('0x31')];this[_0x6596('0x32')]=_0x4a9a7c['dialAMDMaximumWordLength'];}module[_0x6596('0x33')]=Campaign; \ No newline at end of file +var _0x6d8b=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0x6d8b,0xb8));var _0xb6d8=function(_0x352833,_0x348f7f){_0x352833=_0x352833-0x0;var _0x29c92b=_0x6d8b[_0x352833];return _0x29c92b;};'use strict';function Campaign(_0x1e83fb){this['id']=_0x1e83fb['id']||0x0;this[_0xb6d8('0x0')]=_0x1e83fb[_0xb6d8('0x0')]||'';this[_0xb6d8('0x1')]=_0x1e83fb[_0xb6d8('0x1')]||_0xb6d8('0x2');this[_0xb6d8('0x3')]=0x0;this[_0xb6d8('0x4')]=0x0;this[_0xb6d8('0x5')]=0x0;this[_0xb6d8('0x6')]=0x0;this['message']='';this[_0xb6d8('0x7')]=!![];this[_0xb6d8('0x8')]=_0x1e83fb[_0xb6d8('0x8')];this[_0xb6d8('0x9')]=_0x1e83fb[_0xb6d8('0x9')];this[_0xb6d8('0xa')]=_0x1e83fb[_0xb6d8('0xa')]||null;this[_0xb6d8('0xb')]=_0x1e83fb[_0xb6d8('0xb')]?_0x1e83fb['dialGlobalInterval']:null;this[_0xb6d8('0xc')]=_0x1e83fb[_0xb6d8('0xc')];this['dialOriginateCallerIdNumber']=_0x1e83fb[_0xb6d8('0xd')];this[_0xb6d8('0xe')]=_0x1e83fb[_0xb6d8('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x1e83fb[_0xb6d8('0xf')];this[_0xb6d8('0x10')]=_0x1e83fb[_0xb6d8('0x10')];this[_0xb6d8('0x11')]=_0x1e83fb[_0xb6d8('0x11')];this[_0xb6d8('0x12')]=_0x1e83fb[_0xb6d8('0x12')];this[_0xb6d8('0x13')]=_0x1e83fb[_0xb6d8('0x13')];this[_0xb6d8('0x14')]=_0x1e83fb['dialNoAnswerRetryFrequency'];this[_0xb6d8('0x15')]=_0x1e83fb[_0xb6d8('0x15')];this[_0xb6d8('0x16')]=_0x1e83fb[_0xb6d8('0x16')]||0x3;this[_0xb6d8('0x17')]=_0x1e83fb['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1e83fb[_0xb6d8('0x18')]||0x3;this[_0xb6d8('0x19')]=_0x1e83fb[_0xb6d8('0x19')]||0x96;this[_0xb6d8('0x1a')]=_0x1e83fb[_0xb6d8('0x1a')]||0x3;this[_0xb6d8('0x1b')]=_0x1e83fb['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1e83fb[_0xb6d8('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x1e83fb[_0xb6d8('0x1d')]||0x96;this[_0xb6d8('0x1e')]=_0x1e83fb[_0xb6d8('0x1e')]||0x3;this[_0xb6d8('0x1f')]=_0x1e83fb[_0xb6d8('0x1f')]||0x96;this[_0xb6d8('0x20')]=_0x1e83fb[_0xb6d8('0x20')]||_0xb6d8('0x21');this[_0xb6d8('0x22')]=_0x1e83fb[_0xb6d8('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1e83fb['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x1e83fb[_0xb6d8('0x23')]||undefined;this['TrunkBackup']=_0x1e83fb[_0xb6d8('0x24')]?_0x1e83fb[_0xb6d8('0x24')]:undefined;this[_0xb6d8('0x25')]=_0x1e83fb[_0xb6d8('0x25')]?_0x1e83fb[_0xb6d8('0x25')]:undefined;this[_0xb6d8('0x26')]=_0x1e83fb[_0xb6d8('0x26')]?_0x1e83fb[_0xb6d8('0x26')]:undefined;this[_0xb6d8('0x27')]=_0x1e83fb[_0xb6d8('0x27')]?_0x1e83fb[_0xb6d8('0x27')]:undefined;this['dialQueueProject']=_0x1e83fb[_0xb6d8('0x27')]?_0x1e83fb['SquareProject']['name']:undefined;this[_0xb6d8('0x28')]=_0x1e83fb['dialAMDActive']||![];this[_0xb6d8('0x29')]=_0x1e83fb[_0xb6d8('0x29')];this[_0xb6d8('0x2a')]=_0x1e83fb[_0xb6d8('0x2a')];this['dialAMDAfterGreetingSilence']=_0x1e83fb['dialAMDAfterGreetingSilence'];this[_0xb6d8('0x2b')]=_0x1e83fb[_0xb6d8('0x2b')];this[_0xb6d8('0x2c')]=_0x1e83fb[_0xb6d8('0x2c')];this['dialAMDBetweenWordsSilence']=_0x1e83fb[_0xb6d8('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1e83fb[_0xb6d8('0x2e')];this['dialAMDSilenceThreshold']=_0x1e83fb[_0xb6d8('0x2f')];this[_0xb6d8('0x30')]=_0x1e83fb['dialAMDMaximumWordLength'];}module[_0xb6d8('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 132646a..097c87c 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 _0x5eef=['uniqueid','linkedid','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','mohtime','exports','destinationchannel','calleridname','connectedlinename','accountcode','context'];(function(_0x4b94b9,_0x190691){var _0x4882f7=function(_0x333519){while(--_0x333519){_0x4b94b9['push'](_0x4b94b9['shift']());}};_0x4882f7(++_0x190691);}(_0x5eef,0x9c));var _0xf5ee=function(_0x569a22,_0x42fda5){_0x569a22=_0x569a22-0x0;var _0x351fc2=_0x5eef[_0x569a22];return _0x351fc2;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xf5ee('0x0')]='';this['calleridnum']=0x0;this[_0xf5ee('0x1')]='';this['connectedlinenum']=undefined;this[_0xf5ee('0x2')]=undefined;this[_0xf5ee('0x3')]=0x0;this[_0xf5ee('0x4')]='';this[_0xf5ee('0x5')]=0x0;this[_0xf5ee('0x6')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0xf5ee('0x7')]=null;this[_0xf5ee('0x8')]=![];this['abandoned']=![];this[_0xf5ee('0x9')]='';this[_0xf5ee('0xa')]='';this[_0xf5ee('0xb')]=0x0;this[_0xf5ee('0xc')]=0x0;this[_0xf5ee('0xd')]=0x0;this[_0xf5ee('0xe')]=null;this[_0xf5ee('0xf')]=null;this[_0xf5ee('0x10')]=null;this[_0xf5ee('0x11')]=![];this[_0xf5ee('0x12')]=null;this['queue']=null;this[_0xf5ee('0x13')]=[];this['transfercalleridnum']=undefined;this[_0xf5ee('0x14')]=undefined;this['transferType']=undefined;this[_0xf5ee('0x15')]=0x0;}module[_0xf5ee('0x16')]=Channel; \ No newline at end of file +var _0xc306=['unmanaged','abandoned','lastdata','duration','billableseconds','type','monitor','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime','endtime'];(function(_0x49d340,_0x5dd793){var _0x33a20c=function(_0x4780a2){while(--_0x4780a2){_0x49d340['push'](_0x49d340['shift']());}};_0x33a20c(++_0x5dd793);}(_0xc306,0x1a9));var _0x6c30=function(_0x82fc46,_0x3381e9){_0x82fc46=_0x82fc46-0x0;var _0x3c31d4=_0xc306[_0x82fc46];return _0x3c31d4;};'use strict';function Channel(){this[_0x6c30('0x0')]=null;this['channel']='';this[_0x6c30('0x1')]='';this[_0x6c30('0x2')]=0x0;this[_0x6c30('0x3')]='';this[_0x6c30('0x4')]=undefined;this[_0x6c30('0x5')]=undefined;this['accountcode']=0x0;this[_0x6c30('0x6')]='';this['uniqueid']=0x0;this[_0x6c30('0x7')]=0x0;this[_0x6c30('0x8')]=0x0;this[_0x6c30('0x9')]=![];this[_0x6c30('0xa')]=null;this[_0x6c30('0xb')]=null;this[_0x6c30('0xc')]=![];this[_0x6c30('0xd')]=![];this['lastapplication']='';this[_0x6c30('0xe')]='';this[_0x6c30('0xf')]=0x0;this[_0x6c30('0x10')]=0x0;this['holdtime']=0x0;this[_0x6c30('0x11')]=null;this['tag']=null;this['disposition']=null;this[_0x6c30('0x12')]=![];this['monitorFilename']=null;this['queue']=null;this['monitors']=[];this[_0x6c30('0x13')]=undefined;this[_0x6c30('0x14')]=undefined;this[_0x6c30('0x15')]=undefined;this['mohtime']=0x0;}module[_0x6c30('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b44d998..42bcb8f 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 _0xd6cb=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd6cb,0x1e3));var _0xbd6c=function(_0x475dce,_0x1754ff){_0x475dce=_0x475dce-0x0;var _0x40687a=_0xd6cb[_0x475dce];return _0x40687a;};'use strict';function DeskAccount(_0x2cf21d){this['id']=_0x2cf21d['id']||0x0;this[_0xbd6c('0x0')]=_0x2cf21d[_0xbd6c('0x0')]||'';this[_0xbd6c('0x1')]=_0x2cf21d[_0xbd6c('0x1')]||'';this[_0xbd6c('0x2')]=_0x2cf21d[_0xbd6c('0x2')]||'';this[_0xbd6c('0x3')]=_0x2cf21d[_0xbd6c('0x3')]||'';this[_0xbd6c('0x4')]=_0x2cf21d[_0xbd6c('0x4')]||'';this[_0xbd6c('0x5')]=_0x2cf21d[_0xbd6c('0x5')]||'';this[_0xbd6c('0x6')]=_0x2cf21d['consumerSecret']||'';this['token']=_0x2cf21d[_0xbd6c('0x7')]||'';this[_0xbd6c('0x8')]=_0x2cf21d[_0xbd6c('0x8')]||'';this[_0xbd6c('0x9')]=_0x2cf21d[_0xbd6c('0x9')]||'';this[_0xbd6c('0xa')]=_0x2cf21d[_0xbd6c('0xa')]||'';this[_0xbd6c('0xb')]=_0x2cf21d[_0xbd6c('0xb')]||{};}module[_0xbd6c('0xc')]=DeskAccount; \ No newline at end of file +var _0x54b9=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x54b9,0x192));var _0x954b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x54b9[_0x15bc81];return _0x59440e;};'use strict';function DeskAccount(_0x379e0f){this['id']=_0x379e0f['id']||0x0;this[_0x954b('0x0')]=_0x379e0f[_0x954b('0x0')]||'';this[_0x954b('0x1')]=_0x379e0f[_0x954b('0x1')]||'';this['remoteUri']=_0x379e0f[_0x954b('0x2')]||'';this['authType']=_0x379e0f[_0x954b('0x3')]||'';this['password']=_0x379e0f[_0x954b('0x4')]||'';this['consumerKey']=_0x379e0f[_0x954b('0x5')]||'';this[_0x954b('0x6')]=_0x379e0f['consumerSecret']||'';this[_0x954b('0x7')]=_0x379e0f[_0x954b('0x7')]||'';this[_0x954b('0x8')]=_0x379e0f[_0x954b('0x8')]||'';this[_0x954b('0x9')]=_0x379e0f[_0x954b('0x9')]||'';this[_0x954b('0xa')]=_0x379e0f[_0x954b('0xa')]||'';this[_0x954b('0xb')]=_0x379e0f[_0x954b('0xb')]||{};}module[_0x954b('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 259f1f3..b58ac46 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 _0xf64d=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x56e598,_0x229667){var _0x28023a=function(_0x58eeff){while(--_0x58eeff){_0x56e598['push'](_0x56e598['shift']());}};_0x28023a(++_0x229667);}(_0xf64d,0xb0));var _0xdf64=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0xf64d[_0x1f78cb];return _0x2cf6b8;};'use strict';function Dynamics365Account(_0x5ed6d1){this['id']=_0x5ed6d1['id']||0x0;this[_0xdf64('0x0')]=_0x5ed6d1[_0xdf64('0x0')]||'';this[_0xdf64('0x1')]=_0x5ed6d1[_0xdf64('0x1')]||'';this['password']=_0x5ed6d1[_0xdf64('0x2')]||'';this[_0xdf64('0x3')]=_0x5ed6d1['remoteUri']||'';this['tenantId']=_0x5ed6d1[_0xdf64('0x4')]||'';this[_0xdf64('0x5')]=_0x5ed6d1[_0xdf64('0x5')]||'';this[_0xdf64('0x6')]=_0x5ed6d1[_0xdf64('0x6')]||{};this[_0xdf64('0x7')]=_0x5ed6d1[_0xdf64('0x7')]||'';this['modernAuthentication']=_0x5ed6d1['modernAuthentication']||![];this[_0xdf64('0x8')]=_0x5ed6d1['Configurations']||{};this['CloudProvider']=_0x5ed6d1['CloudProvider']||{};}module[_0xdf64('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xa1d3=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name'];(function(_0x4797a3,_0x1fdb72){var _0x560fe6=function(_0x2479ab){while(--_0x2479ab){_0x4797a3['push'](_0x4797a3['shift']());}};_0x560fe6(++_0x1fdb72);}(_0xa1d3,0x77));var _0x3a1d=function(_0x2ce08c,_0x58ce90){_0x2ce08c=_0x2ce08c-0x0;var _0x3db6bd=_0xa1d3[_0x2ce08c];return _0x3db6bd;};'use strict';function Dynamics365Account(_0x43b8f9){this['id']=_0x43b8f9['id']||0x0;this[_0x3a1d('0x0')]=_0x43b8f9[_0x3a1d('0x0')]||'';this[_0x3a1d('0x1')]=_0x43b8f9[_0x3a1d('0x1')]||'';this[_0x3a1d('0x2')]=_0x43b8f9[_0x3a1d('0x2')]||'';this[_0x3a1d('0x3')]=_0x43b8f9[_0x3a1d('0x3')]||'';this[_0x3a1d('0x4')]=_0x43b8f9[_0x3a1d('0x4')]||'';this[_0x3a1d('0x5')]=_0x43b8f9[_0x3a1d('0x5')]||'';this[_0x3a1d('0x6')]=_0x43b8f9[_0x3a1d('0x6')]||{};this[_0x3a1d('0x7')]=_0x43b8f9['serverUrl']||'';this['modernAuthentication']=_0x43b8f9[_0x3a1d('0x8')]||![];this[_0x3a1d('0x9')]=_0x43b8f9[_0x3a1d('0x9')]||{};this['CloudProvider']=_0x43b8f9['CloudProvider']||{};}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 d1ce8e4..0f644b3 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 _0xd1cf=['ListId','key','exports','name','description','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd1cf,0x73));var _0xfd1c=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0xd1cf[_0x57b236];return _0x4feb29;};'use strict';function FaxAccount(_0x2a3b34){this['id']=_0x2a3b34['id']||0x0;this[_0xfd1c('0x0')]=_0x2a3b34[_0xfd1c('0x0')]||'';this[_0xfd1c('0x1')]=_0x2a3b34[_0xfd1c('0x1')];this['ecm']=_0x2a3b34['ecm'];this['headerinfo']=_0x2a3b34[_0xfd1c('0x2')];this['localstationid']=_0x2a3b34['localstationid'];this[_0xfd1c('0x3')]=_0x2a3b34[_0xfd1c('0x3')]||0x960;this[_0xfd1c('0x4')]=_0x2a3b34[_0xfd1c('0x4')]||0x3840;this[_0xfd1c('0x5')]=_0x2a3b34[_0xfd1c('0x5')]||_0xfd1c('0x6');this[_0xfd1c('0x7')]=_0x2a3b34[_0xfd1c('0x7')]||'no';this[_0xfd1c('0x8')]=_0x2a3b34[_0xfd1c('0x8')]||'no';this['t38timeout']=_0x2a3b34[_0xfd1c('0x9')]||0x1388;this[_0xfd1c('0xa')]=_0x2a3b34[_0xfd1c('0xa')]||_0xfd1c('0xb');this[_0xfd1c('0xc')]=_0x2a3b34[_0xfd1c('0xc')]?_0x2a3b34[_0xfd1c('0xc')]:undefined;this[_0xfd1c('0xd')]=_0x2a3b34['ListId'];this['key']=_0x2a3b34[_0xfd1c('0xe')];}module[_0xfd1c('0xf')]=FaxAccount; \ No newline at end of file +var _0x4700=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x2b7440,_0x2f6e35){var _0x4829fa=function(_0x412f53){while(--_0x412f53){_0x2b7440['push'](_0x2b7440['shift']());}};_0x4829fa(++_0x2f6e35);}(_0x4700,0x15d));var _0x0470=function(_0x102a8f,_0x435e0a){_0x102a8f=_0x102a8f-0x0;var _0x5170d6=_0x4700[_0x102a8f];return _0x5170d6;};'use strict';function FaxAccount(_0x4fdc8d){this['id']=_0x4fdc8d['id']||0x0;this[_0x0470('0x0')]=_0x4fdc8d[_0x0470('0x0')]||'';this['description']=_0x4fdc8d[_0x0470('0x1')];this[_0x0470('0x2')]=_0x4fdc8d[_0x0470('0x2')];this[_0x0470('0x3')]=_0x4fdc8d[_0x0470('0x3')];this['localstationid']=_0x4fdc8d[_0x0470('0x4')];this[_0x0470('0x5')]=_0x4fdc8d[_0x0470('0x5')]||0x960;this['maxrate']=_0x4fdc8d[_0x0470('0x6')]||0x3840;this[_0x0470('0x7')]=_0x4fdc8d[_0x0470('0x7')]||_0x0470('0x8');this[_0x0470('0x9')]=_0x4fdc8d[_0x0470('0x9')]||'no';this[_0x0470('0xa')]=_0x4fdc8d[_0x0470('0xa')]||'no';this[_0x0470('0xb')]=_0x4fdc8d[_0x0470('0xb')]||0x1388;this[_0x0470('0xc')]=_0x4fdc8d[_0x0470('0xc')]||_0x0470('0xd');this[_0x0470('0xe')]=_0x4fdc8d[_0x0470('0xe')]?_0x4fdc8d[_0x0470('0xe')]:undefined;this[_0x0470('0xf')]=_0x4fdc8d['ListId'];this['key']=_0x4fdc8d['key'];}module[_0x0470('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fd898c2..1d87a2e 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 _0xb9ca=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x42180e,_0x2f5949){var _0x10563c=function(_0x3ce08e){while(--_0x3ce08e){_0x42180e['push'](_0x42180e['shift']());}};_0x10563c(++_0x2f5949);}(_0xb9ca,0x135));var _0xab9c=function(_0x2ddf2d,_0x272b8a){_0x2ddf2d=_0x2ddf2d-0x0;var _0x53dd02=_0xb9ca[_0x2ddf2d];return _0x53dd02;};'use strict';function FreshdeskAccount(_0x1a5e98){this['id']=_0x1a5e98['id']||0x0;this['name']=_0x1a5e98[_0xab9c('0x0')]||'';this[_0xab9c('0x1')]=_0x1a5e98[_0xab9c('0x1')]||'';this[_0xab9c('0x2')]=_0x1a5e98['token']||'';this[_0xab9c('0x3')]=_0x1a5e98[_0xab9c('0x3')]||'';this[_0xab9c('0x4')]=_0x1a5e98[_0xab9c('0x4')]||'';this[_0xab9c('0x5')]=_0x1a5e98[_0xab9c('0x5')]||{};}module[_0xab9c('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd99d=['Configurations','exports','name','username','remoteUri'];(function(_0x572323,_0x22a96d){var _0x27fe0a=function(_0x55641b){while(--_0x55641b){_0x572323['push'](_0x572323['shift']());}};_0x27fe0a(++_0x22a96d);}(_0xd99d,0xcf));var _0xdd99=function(_0x440c21,_0x8ee17){_0x440c21=_0x440c21-0x0;var _0x1584aa=_0xd99d[_0x440c21];return _0x1584aa;};'use strict';function FreshdeskAccount(_0x441f07){this['id']=_0x441f07['id']||0x0;this[_0xdd99('0x0')]=_0x441f07[_0xdd99('0x0')]||'';this['username']=_0x441f07[_0xdd99('0x1')]||'';this['apiKey']=_0x441f07['token']||'';this[_0xdd99('0x2')]=_0x441f07[_0xdd99('0x2')]||'';this['serverUrl']=_0x441f07['serverUrl']||'';this[_0xdd99('0x3')]=_0x441f07[_0xdd99('0x3')]||{};}module[_0xdd99('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2273b56..ddc9a2e 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 _0xa261=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x23a608,_0x35d4f0){var _0x89c004=function(_0x2d2049){while(--_0x2d2049){_0x23a608['push'](_0x23a608['shift']());}};_0x89c004(++_0x35d4f0);}(_0xa261,0x1a3));var _0x1a26=function(_0x24b60f,_0x2984a4){_0x24b60f=_0x24b60f-0x0;var _0x5e1ae0=_0xa261[_0x24b60f];return _0x5e1ae0;};'use strict';function FreshsalesAccount(_0x13f4f0){this['id']=_0x13f4f0['id']||0x0;this['name']=_0x13f4f0[_0x1a26('0x0')]||'';this[_0x1a26('0x1')]=_0x13f4f0[_0x1a26('0x1')]||'';this[_0x1a26('0x2')]=_0x13f4f0[_0x1a26('0x3')]||'';this['remoteUri']=_0x13f4f0['remoteUri']||'';this['serverUrl']=_0x13f4f0[_0x1a26('0x4')]||'';this[_0x1a26('0x5')]=_0x13f4f0[_0x1a26('0x5')]||{};}module[_0x1a26('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x4cc7=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x468d12,_0x10ef66){_0x468d12=_0x468d12-0x0;var _0x176a61=_0x4cc7[_0x468d12];return _0x176a61;};'use strict';function FreshsalesAccount(_0x13d27d){this['id']=_0x13d27d['id']||0x0;this[_0x74cc('0x0')]=_0x13d27d[_0x74cc('0x0')]||'';this[_0x74cc('0x1')]=_0x13d27d[_0x74cc('0x1')]||'';this[_0x74cc('0x2')]=_0x13d27d[_0x74cc('0x3')]||'';this[_0x74cc('0x4')]=_0x13d27d['remoteUri']||'';this[_0x74cc('0x5')]=_0x13d27d[_0x74cc('0x5')]||'';this[_0x74cc('0x6')]=_0x13d27d[_0x74cc('0x6')]||{};}module[_0x74cc('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index de04f20..7af8f0b 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 _0xe4c5=['channel','connectedlinenum','context','priority','assigned','lastAssignedTo','voice','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x3cea31,_0x26118f){var _0x324736=function(_0x4ad644){while(--_0x4ad644){_0x3cea31['push'](_0x3cea31['shift']());}};_0x324736(++_0x26118f);}(_0xe4c5,0xa6));var _0x5e4c=function(_0x557868,_0x1c233d){_0x557868=_0x557868-0x0;var _0x106e0b=_0xe4c5[_0x557868];return _0x106e0b;};'use strict';function QueueReport(){this[_0x5e4c('0x0')]=_0x5e4c('0x1');this[_0x5e4c('0x2')]='';this[_0x5e4c('0x3')]='';this[_0x5e4c('0x4')]='';this[_0x5e4c('0x5')]='';this[_0x5e4c('0x6')]=null;this[_0x5e4c('0x7')]=null;this['position']=0x1;this[_0x5e4c('0x8')]=0x1;this[_0x5e4c('0x9')]=![];this[_0x5e4c('0xa')]=null;this[_0x5e4c('0xb')]=![];this[_0x5e4c('0xc')]=null;this[_0x5e4c('0xd')]=![];this[_0x5e4c('0xe')]=null;this[_0x5e4c('0xf')]=0x1;this[_0x5e4c('0x10')]='';this[_0x5e4c('0x11')]='';this['connectedlinename']='';this['accountcode']='';this[_0x5e4c('0x12')]='';this['exten']='';this[_0x5e4c('0x13')]='';this['holdtime']=0x0;this[_0x5e4c('0x14')]=![];this[_0x5e4c('0x15')]='';this['motionChannel']=_0x5e4c('0x16');this[_0x5e4c('0x17')]=0x0;this[_0x5e4c('0x18')]={};}module[_0x5e4c('0x19')]=QueueReport; \ No newline at end of file +var _0x70b1=['priority','holdtime','motionChannel','voice','variables','exports','inbound','calleridname','queue','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context'];(function(_0x1edf2a,_0x55c423){var _0x5698f0=function(_0x237e51){while(--_0x237e51){_0x1edf2a['push'](_0x1edf2a['shift']());}};_0x5698f0(++_0x55c423);}(_0x70b1,0x195));var _0x170b=function(_0x527bd6,_0x541763){_0x527bd6=_0x527bd6-0x0;var _0xd1aa5b=_0x70b1[_0x527bd6];return _0xd1aa5b;};'use strict';function QueueReport(){this['type']=_0x170b('0x0');this['uniqueid']='';this['calleridnum']='';this[_0x170b('0x1')]='';this[_0x170b('0x2')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x170b('0x3')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x170b('0x4')]=null;this[_0x170b('0x5')]=![];this[_0x170b('0x6')]=null;this[_0x170b('0x7')]=![];this[_0x170b('0x8')]=null;this[_0x170b('0x9')]=0x1;this['channel']='';this[_0x170b('0xa')]='';this[_0x170b('0xb')]='';this['accountcode']='';this[_0x170b('0xc')]='';this['exten']='';this[_0x170b('0xd')]='';this[_0x170b('0xe')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x170b('0xf')]=_0x170b('0x10');this['mohtime']=0x0;this[_0x170b('0x11')]={};}module[_0x170b('0x12')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ec1c5cf..417e844 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 _0xed4a=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xed4a,0xd2));var _0xaed4=function(_0x3765a3,_0x4e5c6d){_0x3765a3=_0x3765a3-0x0;var _0x221278=_0xed4a[_0x3765a3];return _0x221278;};'use strict';function SalesforceAccount(_0x3121c0){this['id']=_0x3121c0['id']||0x0;this[_0xaed4('0x0')]=_0x3121c0['name']||'';this['username']=_0x3121c0[_0xaed4('0x1')]||'';this[_0xaed4('0x2')]=_0x3121c0[_0xaed4('0x2')]||'';this['password']=_0x3121c0[_0xaed4('0x3')]||'';this[_0xaed4('0x4')]=_0x3121c0['clientId']||'';this[_0xaed4('0x5')]=_0x3121c0[_0xaed4('0x5')]||'';this[_0xaed4('0x6')]=_0x3121c0[_0xaed4('0x6')]||'';this[_0xaed4('0x7')]=_0x3121c0[_0xaed4('0x7')]||_0xaed4('0x8');this['serverUrl']=_0x3121c0[_0xaed4('0x9')]||'';this[_0xaed4('0xa')]=_0x3121c0[_0xaed4('0xa')]||{};}module[_0xaed4('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x4744=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri'];(function(_0x5b1d45,_0x1bc88f){var _0x2b8d39=function(_0x3542d6){while(--_0x3542d6){_0x5b1d45['push'](_0x5b1d45['shift']());}};_0x2b8d39(++_0x1bc88f);}(_0x4744,0x152));var _0x4474=function(_0x5c65a9,_0x5411f9){_0x5c65a9=_0x5c65a9-0x0;var _0x1436bb=_0x4744[_0x5c65a9];return _0x1436bb;};'use strict';function SalesforceAccount(_0x160043){this['id']=_0x160043['id']||0x0;this[_0x4474('0x0')]=_0x160043[_0x4474('0x0')]||'';this[_0x4474('0x1')]=_0x160043[_0x4474('0x1')]||'';this[_0x4474('0x2')]=_0x160043[_0x4474('0x2')]||'';this['password']=_0x160043[_0x4474('0x3')]||'';this[_0x4474('0x4')]=_0x160043[_0x4474('0x4')]||'';this[_0x4474('0x5')]=_0x160043[_0x4474('0x5')]||'';this[_0x4474('0x6')]=_0x160043[_0x4474('0x6')]||'';this[_0x4474('0x7')]=_0x160043['type']||_0x4474('0x8');this[_0x4474('0x9')]=_0x160043['serverUrl']||'';this[_0x4474('0xa')]=_0x160043[_0x4474('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e1a2dfd..6f9843e 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 _0xe165=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1bd41f,_0x1044e2){var _0x456a47=function(_0x68f5ff){while(--_0x68f5ff){_0x1bd41f['push'](_0x1bd41f['shift']());}};_0x456a47(++_0x1044e2);}(_0xe165,0x1b5));var _0x5e16=function(_0x5f5c7e,_0x302743){_0x5f5c7e=_0x5f5c7e-0x0;var _0x181466=_0xe165[_0x5f5c7e];return _0x181466;};'use strict';function ServicenowAccount(_0x2afaf3){this['id']=_0x2afaf3['id']||0x0;this['name']=_0x2afaf3[_0x5e16('0x0')]||'';this[_0x5e16('0x1')]=_0x2afaf3[_0x5e16('0x1')]||'';this[_0x5e16('0x2')]=_0x2afaf3['password']||'';this[_0x5e16('0x3')]=_0x2afaf3[_0x5e16('0x3')]||'';this[_0x5e16('0x4')]=_0x2afaf3[_0x5e16('0x4')]||'';this[_0x5e16('0x5')]=_0x2afaf3['Configurations']||{};}module[_0x5e16('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xa7f0=['password','serverUrl','Configurations','name'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xa7f0,0x1c7));var _0x0a7f=function(_0x1fd838,_0x584cc8){_0x1fd838=_0x1fd838-0x0;var _0x313172=_0xa7f0[_0x1fd838];return _0x313172;};'use strict';function ServicenowAccount(_0x2a68b0){this['id']=_0x2a68b0['id']||0x0;this[_0x0a7f('0x0')]=_0x2a68b0[_0x0a7f('0x0')]||'';this['username']=_0x2a68b0['username']||'';this[_0x0a7f('0x1')]=_0x2a68b0[_0x0a7f('0x1')]||'';this['remoteUri']=_0x2a68b0['remoteUri']||'';this[_0x0a7f('0x2')]=_0x2a68b0[_0x0a7f('0x2')]||'';this[_0x0a7f('0x3')]=_0x2a68b0[_0x0a7f('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 4479900..f1fa85d 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 _0xc9c5=['username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3d1199,_0xd132ab){var _0xf93545=function(_0x3caf69){while(--_0x3caf69){_0x3d1199['push'](_0x3d1199['shift']());}};_0xf93545(++_0xd132ab);}(_0xc9c5,0x150));var _0x5c9c=function(_0x594163,_0xf3583c){_0x594163=_0x594163-0x0;var _0x18c749=_0xc9c5[_0x594163];return _0x18c749;};'use strict';function SugarcrmAccount(_0x2d5706){this['id']=_0x2d5706['id']||0x0;this['name']=_0x2d5706['name']||'';this[_0x5c9c('0x0')]=_0x2d5706[_0x5c9c('0x0')]||'';this[_0x5c9c('0x1')]=_0x2d5706['password']||'';this[_0x5c9c('0x2')]=_0x2d5706['remoteUri']||'';this[_0x5c9c('0x3')]=_0x2d5706[_0x5c9c('0x3')]||'';this[_0x5c9c('0x4')]=_0x2d5706['Configurations']||{};}module[_0x5c9c('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x5336=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x107afe,_0x1f22f2){var _0x119487=function(_0x96327b){while(--_0x96327b){_0x107afe['push'](_0x107afe['shift']());}};_0x119487(++_0x1f22f2);}(_0x5336,0x190));var _0x6533=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5336[_0x17d9e3];return _0x14192d;};'use strict';function SugarcrmAccount(_0x58dac3){this['id']=_0x58dac3['id']||0x0;this[_0x6533('0x0')]=_0x58dac3['name']||'';this['username']=_0x58dac3['username']||'';this[_0x6533('0x1')]=_0x58dac3[_0x6533('0x1')]||'';this[_0x6533('0x2')]=_0x58dac3[_0x6533('0x2')]||'';this[_0x6533('0x3')]=_0x58dac3[_0x6533('0x3')]||'';this[_0x6533('0x4')]=_0x58dac3[_0x6533('0x4')]||{};}module[_0x6533('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ac4d728..a501152 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 _0x3e05=['address','exports','name','accountcode','unknown','stateTime','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e05,0x64));var _0x53e0=function(_0x3f03ba,_0x4d6ece){_0x3f03ba=_0x3f03ba-0x0;var _0x2ac75b=_0x3e05[_0x3f03ba];return _0x2ac75b;};'use strict';function Telephone(_0x2817b9){this['id']=_0x2817b9['id']||0x0;this[_0x53e0('0x0')]=_0x2817b9[_0x53e0('0x0')]||'';this[_0x53e0('0x1')]=_0x2817b9['accountcode']||'';this['state']=_0x53e0('0x2');this[_0x53e0('0x3')]=0x0;this[_0x53e0('0x4')]=_0x53e0('0x2');this[_0x53e0('0x5')]='';}module[_0x53e0('0x6')]=Telephone; \ No newline at end of file +var _0x119c=['status','unknown','exports','name','accountcode','state','stateTime'];(function(_0x275c28,_0x480425){var _0x29c07d=function(_0x2012d0){while(--_0x2012d0){_0x275c28['push'](_0x275c28['shift']());}};_0x29c07d(++_0x480425);}(_0x119c,0xea));var _0xc119=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x119c[_0x467488];return _0x56107f;};'use strict';function Telephone(_0x1a596d){this['id']=_0x1a596d['id']||0x0;this[_0xc119('0x0')]=_0x1a596d['name']||'';this[_0xc119('0x1')]=_0x1a596d[_0xc119('0x1')]||'';this[_0xc119('0x2')]='unknown';this[_0xc119('0x3')]=0x0;this[_0xc119('0x4')]=_0xc119('0x5');this['address']='';}module[_0xc119('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4671305..7f8ff0f 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 _0xb10b=['name','html'];(function(_0x1839c9,_0x404880){var _0x5766b2=function(_0x4f7165){while(--_0x4f7165){_0x1839c9['push'](_0x1839c9['shift']());}};_0x5766b2(++_0x404880);}(_0xb10b,0x12a));var _0xbb10=function(_0x538bd3,_0x1e3c75){_0x538bd3=_0x538bd3-0x0;var _0x5e2fd7=_0xb10b[_0x538bd3];return _0x5e2fd7;};'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 +var _0xa9e0=['exports','name'];(function(_0x240ca0,_0x3ea2b4){var _0x1ce1e9=function(_0x2c228b){while(--_0x2c228b){_0x240ca0['push'](_0x240ca0['shift']());}};_0x1ce1e9(++_0x3ea2b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 86372b5..c410611 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(_0x11935a,_0x535085){var _0x138b37=function(_0x4c725a){while(--_0x4c725a){_0x11935a['push'](_0x11935a['shift']());}};_0x138b37(++_0x535085);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x9c5558,_0x338954){_0x9c5558=_0x9c5558-0x0;var _0x347a69=_0x9ffd[_0x9c5558];return _0x347a69;};'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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x3556db,_0x1c1c4b){var _0x510337=function(_0x587010){while(--_0x587010){_0x3556db['push'](_0x3556db['shift']());}};_0x510337(++_0x1c1c4b);}(_0x8603,0x190));var _0x3860=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x8603[_0x516927];return _0x30749b;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6fe50c2..21185cf 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 _0xe374=['registry','indexOf','split','port','domain','domainport','refresh','address','defaultuser','exports','active','name','state','unknown'];(function(_0x54fa28,_0x18ed55){var _0x32c6bc=function(_0x210e10){while(--_0x210e10){_0x54fa28['push'](_0x54fa28['shift']());}};_0x32c6bc(++_0x18ed55);}(_0xe374,0x1a0));var _0x4e37=function(_0x5c2872,_0x121cc4){_0x5c2872=_0x5c2872-0x0;var _0x1f0d1a=_0xe374[_0x5c2872];return _0x1f0d1a;};'use strict';function Trunk(_0x27a604){this['id']=_0x27a604['id']||0x0;this[_0x4e37('0x0')]=_0x27a604[_0x4e37('0x0')]||![];this[_0x4e37('0x1')]=_0x27a604[_0x4e37('0x1')]||'';this[_0x4e37('0x2')]=_0x4e37('0x3');this['stateTime']=0x0;this['status']='unknown';this[_0x4e37('0x4')]=_0x27a604[_0x4e37('0x4')]&&_0x27a604[_0x4e37('0x4')][_0x4e37('0x5')](':')?_0x27a604[_0x4e37('0x4')][_0x4e37('0x6')](':')[0x0]:'';this['host']='';this[_0x4e37('0x7')]='';this[_0x4e37('0x8')]='';this[_0x4e37('0x9')]='';this[_0x4e37('0xa')]='';this['stateRegistry']=_0x4e37('0x3');this['registrationtime']='';this[_0x4e37('0xb')]='';this[_0x4e37('0xc')]=_0x27a604[_0x4e37('0xc')]||'';}module[_0x4e37('0xd')]=Trunk; \ No newline at end of file +var _0x11c7=['stateRegistry','registrationtime','address','defaultuser','active','name','state','stateTime','status','unknown','registry','indexOf','port','domain','domainport','refresh'];(function(_0x40da2f,_0x37e0cb){var _0x416bba=function(_0x39580a){while(--_0x39580a){_0x40da2f['push'](_0x40da2f['shift']());}};_0x416bba(++_0x37e0cb);}(_0x11c7,0x184));var _0x711c=function(_0x5ab4c6,_0x22d226){_0x5ab4c6=_0x5ab4c6-0x0;var _0x26495f=_0x11c7[_0x5ab4c6];return _0x26495f;};'use strict';function Trunk(_0x179750){this['id']=_0x179750['id']||0x0;this[_0x711c('0x0')]=_0x179750[_0x711c('0x0')]||![];this[_0x711c('0x1')]=_0x179750[_0x711c('0x1')]||'';this[_0x711c('0x2')]='unknown';this[_0x711c('0x3')]=0x0;this[_0x711c('0x4')]=_0x711c('0x5');this[_0x711c('0x6')]=_0x179750[_0x711c('0x6')]&&_0x179750['registry'][_0x711c('0x7')](':')?_0x179750[_0x711c('0x6')]['split'](':')[0x0]:'';this['host']='';this[_0x711c('0x8')]='';this[_0x711c('0x9')]='';this[_0x711c('0xa')]='';this[_0x711c('0xb')]='';this[_0x711c('0xc')]='unknown';this[_0x711c('0xd')]='';this[_0x711c('0xe')]='';this[_0x711c('0xf')]=_0x179750[_0x711c('0xf')]||'';}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 06580cc..82b4ecf 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 _0xe949=['mandatoryDisposition','exten','recordingFormat'];(function(_0x33b23d,_0xd790e7){var _0xcccb27=function(_0x538ac9){while(--_0x538ac9){_0x33b23d['push'](_0x33b23d['shift']());}};_0xcccb27(++_0xd790e7);}(_0xe949,0x1d8));var _0x9e94=function(_0x4f35a1,_0x324269){_0x4f35a1=_0x4f35a1-0x0;var _0x1ce8fc=_0xe949[_0x4f35a1];return _0x1ce8fc;};'use strict';function voiceExtension(_0xdfc5d5){this['id']=_0xdfc5d5['id']||0x0;this[_0x9e94('0x0')]=_0xdfc5d5['exten']||'';this[_0x9e94('0x1')]=_0xdfc5d5['recordingFormat']||'none';this[_0x9e94('0x2')]=_0xdfc5d5[_0x9e94('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xcbf4=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1798cb,_0xafe39f){var _0x4a68ed=function(_0x2e9265){while(--_0x2e9265){_0x1798cb['push'](_0x1798cb['shift']());}};_0x4a68ed(++_0xafe39f);}(_0xcbf4,0xc2));var _0x4cbf=function(_0x1d9362,_0x358c28){_0x1d9362=_0x1d9362-0x0;var _0x3abf6c=_0xcbf4[_0x1d9362];return _0x3abf6c;};'use strict';function voiceExtension(_0x5dddfc){this['id']=_0x5dddfc['id']||0x0;this[_0x4cbf('0x0')]=_0x5dddfc[_0x4cbf('0x0')]||'';this['recordingFormat']=_0x5dddfc[_0x4cbf('0x1')]||_0x4cbf('0x2');this[_0x4cbf('0x3')]=_0x5dddfc[_0x4cbf('0x3')]||![];}module[_0x4cbf('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 76b5c2a..56e60e6 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 _0xabc3=['outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDispositionPause','unknown','inuse','invalid','unavailable','ringinuse','wav','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','message','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay'];(function(_0x3252b9,_0x50b267){var _0x57012d=function(_0x18c757){while(--_0x18c757){_0x3252b9['push'](_0x3252b9['shift']());}};_0x57012d(++_0x50b267);}(_0xabc3,0x170));var _0x3abc=function(_0x1a42e1,_0xc1031e){_0x1a42e1=_0x1a42e1-0x0;var _0x289fab=_0xabc3[_0x1a42e1];return _0x289fab;};'use strict';var statusDesc=[_0x3abc('0x0'),'not_inuse',_0x3abc('0x1'),'busy',_0x3abc('0x2'),_0x3abc('0x3'),'ringing',_0x3abc('0x4'),'onhold'];var monitorFormat={'wav':_0x3abc('0x5'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x3abc('0x6'),'roundrobin':_0x3abc('0x7')};function VoiceQueue(_0x2f689d){this['id']=_0x2f689d['id']||0x0;this[_0x3abc('0x8')]=_0x2f689d[_0x3abc('0x8')]||'';this[_0x3abc('0x9')]=_0x2f689d[_0x3abc('0x9')]||'';this[_0x3abc('0xa')]=_0x2f689d[_0x3abc('0xa')]||_0x3abc('0xb');this[_0x3abc('0xc')]=0x0;this[_0x3abc('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x3abc('0xe')]=0x0;this[_0x3abc('0xf')]=0x0;this[_0x3abc('0x10')]=0x0;this[_0x3abc('0x11')]=0x0;this[_0x3abc('0x12')]=0x0;this['available']=0x0;this[_0x3abc('0x13')]=_0x2f689d[_0x3abc('0x13')]||![];this[_0x3abc('0x14')]=_0x2f689d[_0x3abc('0x14')]||0xa;this[_0x3abc('0x15')]=_0x2f689d[_0x3abc('0x15')]||'no';this['sendMessageOneNotActive']=!![];this[_0x3abc('0x16')]='';this[_0x3abc('0x17')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x2f689d['dialTimezone']||null;this[_0x3abc('0x18')]=_0x2f689d[_0x3abc('0x18')]?_0x2f689d[_0x3abc('0x18')]:null;this[_0x3abc('0x19')]=_0x2f689d[_0x3abc('0x19')];this[_0x3abc('0x1a')]=_0x2f689d['dialMethod']||_0x3abc('0x1b');this[_0x3abc('0x1c')]=_0x2f689d[_0x3abc('0x1c')]||0x0;this[_0x3abc('0x1d')]=_0x2f689d['dialLimitQueue']||0x0;this[_0x3abc('0x1e')]=_0x2f689d[_0x3abc('0x1e')]||0x1;this[_0x3abc('0x1f')]=_0x2f689d[_0x3abc('0x1f')]||_0x3abc('0x20');this[_0x3abc('0x21')]=_0x2f689d[_0x3abc('0x21')]||0.03;this['dialPredictiveInterval']=_0x2f689d[_0x3abc('0x22')]||0x258;this[_0x3abc('0x23')]=_0x2f689d[_0x3abc('0x23')]||'anonymous';this[_0x3abc('0x24')]=_0x2f689d['dialOriginateCallerIdNumber']||_0x3abc('0x25');this['dialOriginateTimeout']=_0x2f689d[_0x3abc('0x26')]||0x1e;this['dialQueueOptions']=_0x2f689d[_0x3abc('0x27')]||_0x3abc('0x28');this[_0x3abc('0x29')]=_0x2f689d[_0x3abc('0x29')]||0x3;this['dialQueueProject']=_0x2f689d[_0x3abc('0x2a')]||undefined;this[_0x3abc('0x2b')]=_0x2f689d['dialCongestionMaxRetry']||0x3;this[_0x3abc('0x2c')]=_0x2f689d['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x2f689d['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x2f689d['dialBusyRetryFrequency']||0x96;this[_0x3abc('0x2d')]=_0x2f689d[_0x3abc('0x2d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2f689d[_0x3abc('0x2e')]||0x96;this[_0x3abc('0x2f')]=_0x2f689d[_0x3abc('0x2f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x2f689d['dialNoSuchNumberRetryFrequency']||0x96;this[_0x3abc('0x30')]=_0x2f689d[_0x3abc('0x30')]||0x3;this[_0x3abc('0x31')]=_0x2f689d[_0x3abc('0x31')]||0x96;this['dialAbandonedMaxRetry']=_0x2f689d[_0x3abc('0x32')]||0x3;this['dialAbandonedRetryFrequency']=_0x2f689d[_0x3abc('0x33')]||0x96;this[_0x3abc('0x34')]=_0x2f689d[_0x3abc('0x34')]||0x3;this[_0x3abc('0x35')]=_0x2f689d[_0x3abc('0x35')]||0x96;this[_0x3abc('0x36')]=_0x2f689d[_0x3abc('0x36')]||0x3;this[_0x3abc('0x37')]=_0x2f689d[_0x3abc('0x37')]||0x96;this[_0x3abc('0x38')]=_0x2f689d['dialGlobalMaxRetry']||0x4;this[_0x3abc('0x39')]=_0x2f689d[_0x3abc('0x39')]?_0x2f689d['Trunk']:undefined;this[_0x3abc('0x3a')]=_0x2f689d['TrunkBackup']?_0x2f689d[_0x3abc('0x3a')]:undefined;this['dialPrefix']=_0x2f689d['dialPrefix']||undefined;this[_0x3abc('0x3b')]=_0x2f689d[_0x3abc('0x3b')]?_0x2f689d['Interval']:undefined;this[_0x3abc('0x3c')]=_0x2f689d[_0x3abc('0x3c')]||_0x3abc('0x3d');this[_0x3abc('0x3e')]=_0x2f689d[_0x3abc('0x3e')]||undefined;this['dialCutDigit']=_0x2f689d[_0x3abc('0x3f')]||undefined;this[_0x3abc('0x40')]=strategy[_0x2f689d[_0x3abc('0x40')]]||_0x3abc('0x6');this[_0x3abc('0x41')]=!![];this[_0x3abc('0x42')]=_0x2f689d['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2f689d[_0x3abc('0x43')];this[_0x3abc('0x44')]=_0x2f689d['dialAMDGreeting'];this[_0x3abc('0x45')]=_0x2f689d[_0x3abc('0x45')];this['dialAMDTotalAnalysisTime']=_0x2f689d[_0x3abc('0x46')];this[_0x3abc('0x47')]=_0x2f689d[_0x3abc('0x47')];this['dialAMDBetweenWordsSilence']=_0x2f689d[_0x3abc('0x48')];this[_0x3abc('0x49')]=_0x2f689d[_0x3abc('0x49')];this[_0x3abc('0x4a')]=_0x2f689d['dialAMDSilenceThreshold'];this[_0x3abc('0x4b')]=_0x2f689d[_0x3abc('0x4b')];this['outboundRejectCallsDay']=0x0;this[_0x3abc('0x4c')]=0x0;this[_0x3abc('0x4d')]=_0x2f689d['timeout'];this[_0x3abc('0x4e')]=0x0;this[_0x3abc('0x4f')]=0x0;this[_0x3abc('0x50')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x3abc('0x51')]=0x0;this[_0x3abc('0x52')]=0x0;this[_0x3abc('0x53')]=0x0;this[_0x3abc('0x54')]=0x0;this[_0x3abc('0x55')]=0x0;this[_0x3abc('0x56')]=0x0;this[_0x3abc('0x57')]=0x0;this[_0x3abc('0x58')]=0x0;this[_0x3abc('0x59')]=0x0;this[_0x3abc('0x5a')]=undefined;this[_0x3abc('0x5b')]=undefined;this[_0x3abc('0x5c')]=undefined;this[_0x3abc('0x5d')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x3abc('0x5e')]=0x0;this[_0x3abc('0x5f')]=0x0;this[_0x3abc('0x60')]=0x0;this[_0x3abc('0x61')]=0x0;this[_0x3abc('0x62')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x3abc('0x63')]=0x0;this[_0x3abc('0x64')]=_0x2f689d['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x3abc('0x65')]=_0x2f689d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x3abc('0x66')]=0x0;this[_0x3abc('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x3abc('0x68')]=0x0;this['erlangCallToSecond']=0x0;this[_0x3abc('0x69')]=0x0;this[_0x3abc('0x6a')]=0x0;this[_0x3abc('0x6b')]=_0x2f689d[_0x3abc('0x6b')]||0x1e;this['dialRecallInQueue']=_0x2f689d['dialRecallInQueue']||![];this[_0x3abc('0x6c')]=!!_0x2f689d['dialPreviewAutoRecallMe']||![];this[_0x3abc('0x6d')]=!!_0x2f689d[_0x3abc('0x6d')]||![];this[_0x3abc('0x6e')]=_0x2f689d[_0x3abc('0x6e')]||undefined;this[_0x3abc('0x6f')]=_0x2f689d[_0x3abc('0x6f')]||![];this['dialAgiAfterHangupAgent']=_0x2f689d['dialAgiAfterHangupAgent']||![];this[_0x3abc('0x9')]=monitorFormat[_0x2f689d[_0x3abc('0x9')]]?monitorFormat[_0x2f689d['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2f689d['mandatoryDisposition']||![];this[_0x3abc('0x70')]=_0x2f689d[_0x3abc('0x70')]?_0x2f689d[_0x3abc('0x70')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x0dbc=['dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0xb79b5f,_0x1097ec){var _0x461681=function(_0x2c2661){while(--_0x2c2661){_0xb79b5f['push'](_0xb79b5f['shift']());}};_0x461681(++_0x1097ec);}(_0x0dbc,0x1a1));var _0xc0db=function(_0x14b1e9,_0xdef18c){_0x14b1e9=_0x14b1e9-0x0;var _0x132088=_0x0dbc[_0x14b1e9];return _0x132088;};'use strict';var statusDesc=[_0xc0db('0x0'),_0xc0db('0x1'),'inuse',_0xc0db('0x2'),'invalid','unavailable',_0xc0db('0x3'),_0xc0db('0x4'),_0xc0db('0x5')];var monitorFormat={'wav':_0xc0db('0x6'),'wav49':_0xc0db('0x7'),'gsm':_0xc0db('0x8')};var strategy={'rrmemory':_0xc0db('0x9'),'roundrobin':_0xc0db('0xa')};function VoiceQueue(_0x9cfd61){this['id']=_0x9cfd61['id']||0x0;this[_0xc0db('0xb')]=_0x9cfd61[_0xc0db('0xb')]||'';this[_0xc0db('0xc')]=_0x9cfd61[_0xc0db('0xc')]||'';this[_0xc0db('0xd')]=_0x9cfd61[_0xc0db('0xd')]||_0xc0db('0xe');this[_0xc0db('0xf')]=0x0;this['talking']=0x0;this[_0xc0db('0x10')]=0x0;this[_0xc0db('0x11')]=0x0;this[_0xc0db('0x12')]=0x0;this[_0xc0db('0x13')]=0x0;this[_0xc0db('0x14')]=0x0;this['unmanaged']=0x0;this[_0xc0db('0x15')]=0x0;this[_0xc0db('0x16')]=0x0;this[_0xc0db('0x17')]=0x0;this['acw']=_0x9cfd61[_0xc0db('0x18')]||![];this[_0xc0db('0x19')]=_0x9cfd61[_0xc0db('0x19')]||0xa;this[_0xc0db('0x1a')]=_0x9cfd61['autopause']||'no';this[_0xc0db('0x1b')]=!![];this['message']='';this[_0xc0db('0x1c')]=0x0;this['temp']=0x0;this[_0xc0db('0x1d')]=_0x9cfd61[_0xc0db('0x1d')]||null;this[_0xc0db('0x1e')]=_0x9cfd61['dialGlobalInterval']?_0x9cfd61['dialGlobalInterval']:null;this[_0xc0db('0x1f')]=_0x9cfd61[_0xc0db('0x1f')];this[_0xc0db('0x20')]=_0x9cfd61[_0xc0db('0x20')]||_0xc0db('0x21');this[_0xc0db('0x22')]=_0x9cfd61[_0xc0db('0x22')]||0x0;this['dialLimitQueue']=_0x9cfd61[_0xc0db('0x23')]||0x0;this['dialPowerLevel']=_0x9cfd61[_0xc0db('0x24')]||0x1;this[_0xc0db('0x25')]=_0x9cfd61[_0xc0db('0x25')]||_0xc0db('0x26');this[_0xc0db('0x27')]=_0x9cfd61[_0xc0db('0x27')]||0.03;this[_0xc0db('0x28')]=_0x9cfd61[_0xc0db('0x28')]||0x258;this['dialOriginateCallerIdName']=_0x9cfd61[_0xc0db('0x29')]||_0xc0db('0x2a');this['dialOriginateCallerIdNumber']=_0x9cfd61[_0xc0db('0x2b')]||_0xc0db('0x2a');this['dialOriginateTimeout']=_0x9cfd61[_0xc0db('0x2c')]||0x1e;this[_0xc0db('0x2d')]=_0x9cfd61[_0xc0db('0x2d')]||_0xc0db('0x2e');this['dialQueueTimeout']=_0x9cfd61['dialQueueTimeout']||0x3;this[_0xc0db('0x2f')]=_0x9cfd61[_0xc0db('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x9cfd61[_0xc0db('0x30')]||0x3;this[_0xc0db('0x31')]=_0x9cfd61[_0xc0db('0x31')]||0x96;this[_0xc0db('0x32')]=_0x9cfd61['dialBusyMaxRetry']||0x3;this[_0xc0db('0x33')]=_0x9cfd61[_0xc0db('0x33')]||0x96;this[_0xc0db('0x34')]=_0x9cfd61['dialNoAnswerMaxRetry']||0x3;this[_0xc0db('0x35')]=_0x9cfd61[_0xc0db('0x35')]||0x96;this[_0xc0db('0x36')]=_0x9cfd61['dialNoSuchNumberMaxRetry']||0x3;this[_0xc0db('0x37')]=_0x9cfd61[_0xc0db('0x37')]||0x96;this['dialDropMaxRetry']=_0x9cfd61[_0xc0db('0x38')]||0x3;this[_0xc0db('0x39')]=_0x9cfd61[_0xc0db('0x39')]||0x96;this['dialAbandonedMaxRetry']=_0x9cfd61[_0xc0db('0x3a')]||0x3;this[_0xc0db('0x3b')]=_0x9cfd61['dialAbandonedRetryFrequency']||0x96;this[_0xc0db('0x3c')]=_0x9cfd61[_0xc0db('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x9cfd61[_0xc0db('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x9cfd61[_0xc0db('0x3e')]||0x3;this[_0xc0db('0x3f')]=_0x9cfd61[_0xc0db('0x3f')]||0x96;this['dialGlobalMaxRetry']=_0x9cfd61[_0xc0db('0x40')]||0x4;this[_0xc0db('0x41')]=_0x9cfd61['Trunk']?_0x9cfd61[_0xc0db('0x41')]:undefined;this[_0xc0db('0x42')]=_0x9cfd61['TrunkBackup']?_0x9cfd61[_0xc0db('0x42')]:undefined;this[_0xc0db('0x43')]=_0x9cfd61[_0xc0db('0x43')]||undefined;this[_0xc0db('0x44')]=_0x9cfd61[_0xc0db('0x44')]?_0x9cfd61[_0xc0db('0x44')]:undefined;this['dialOrderByScheduledAt']=_0x9cfd61['dialOrderByScheduledAt']||_0xc0db('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x9cfd61[_0xc0db('0x46')]||undefined;this[_0xc0db('0x47')]=_0x9cfd61[_0xc0db('0x47')]||undefined;this['strategy']=strategy[_0x9cfd61[_0xc0db('0x48')]]||_0xc0db('0x9');this['queueStatusComplete']=!![];this[_0xc0db('0x49')]=_0x9cfd61[_0xc0db('0x49')]||![];this[_0xc0db('0x4a')]=_0x9cfd61[_0xc0db('0x4a')];this[_0xc0db('0x4b')]=_0x9cfd61[_0xc0db('0x4b')];this['dialAMDAfterGreetingSilence']=_0x9cfd61[_0xc0db('0x4c')];this[_0xc0db('0x4d')]=_0x9cfd61[_0xc0db('0x4d')];this['dialAMDMinWordLength']=_0x9cfd61[_0xc0db('0x4e')];this['dialAMDBetweenWordsSilence']=_0x9cfd61[_0xc0db('0x4f')];this[_0xc0db('0x50')]=_0x9cfd61['dialAMDMaximumNumberOfWords'];this[_0xc0db('0x51')]=_0x9cfd61[_0xc0db('0x51')];this['dialAMDMaximumWordLength']=_0x9cfd61['dialAMDMaximumWordLength'];this[_0xc0db('0x52')]=0x0;this[_0xc0db('0x53')]=0x0;this[_0xc0db('0x54')]=_0x9cfd61[_0xc0db('0x54')];this['outboundAnswerCallsDay']=0x0;this[_0xc0db('0x55')]=0x0;this[_0xc0db('0x56')]=0x0;this[_0xc0db('0x57')]=0x0;this[_0xc0db('0x58')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xc0db('0x59')]=0x0;this[_0xc0db('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xc0db('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xc0db('0x5c')]=0x0;this[_0xc0db('0x5d')]=undefined;this['startPredictive']=undefined;this[_0xc0db('0x5e')]=undefined;this[_0xc0db('0x5f')]=1.05;this[_0xc0db('0x60')]=0x0;this[_0xc0db('0x61')]=0x0;this[_0xc0db('0x62')]=0x0;this[_0xc0db('0x63')]=0x0;this[_0xc0db('0x64')]=0x0;this[_0xc0db('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x9cfd61[_0xc0db('0x66')]||0x14;this['predictiveIntervalMinThreshold']=_0x9cfd61['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc0db('0x67')]=0x0;this[_0xc0db('0x68')]=0x0;this[_0xc0db('0x69')]=0x1;this[_0xc0db('0x6a')]=0x0;this[_0xc0db('0x6b')]=0x0;this[_0xc0db('0x6c')]=0x0;this[_0xc0db('0x6d')]=0x0;this['dialRecallMeTimeout']=_0x9cfd61[_0xc0db('0x6e')]||0x1e;this[_0xc0db('0x6f')]=_0x9cfd61[_0xc0db('0x6f')]||![];this[_0xc0db('0x70')]=!!_0x9cfd61[_0xc0db('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x9cfd61[_0xc0db('0x71')]||![];this['dialQueueProject2']=_0x9cfd61[_0xc0db('0x72')]||undefined;this[_0xc0db('0x73')]=_0x9cfd61['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x9cfd61[_0xc0db('0x74')]||![];this[_0xc0db('0xc')]=monitorFormat[_0x9cfd61[_0xc0db('0xc')]]?monitorFormat[_0x9cfd61[_0xc0db('0xc')]]:undefined;this[_0xc0db('0x75')]=_0x9cfd61[_0xc0db('0x75')]||![];this[_0xc0db('0x76')]=_0x9cfd61[_0xc0db('0x76')]?_0x9cfd61[_0xc0db('0x76')]:undefined;}module[_0xc0db('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 89dc06d..92dce99 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 _0xbd03=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0xbd03,0xcf));var _0x3bd0=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0xbd03[_0x359bbe];return _0x1b3353;};'use strict';function VtigerAccount(_0x2644d0){this['id']=_0x2644d0['id']||0x0;this[_0x3bd0('0x0')]=_0x2644d0['name']||'';this['username']=_0x2644d0[_0x3bd0('0x1')]||'';this[_0x3bd0('0x2')]=_0x2644d0[_0x3bd0('0x2')]||'';this['remoteUri']=_0x2644d0[_0x3bd0('0x3')]||'';this[_0x3bd0('0x4')]=_0x2644d0[_0x3bd0('0x4')]||'';this[_0x3bd0('0x5')]=_0x2644d0[_0x3bd0('0x5')]||{};}module[_0x3bd0('0x6')]=VtigerAccount; \ No newline at end of file +var _0xf0f4=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xf0f4,0x1b4));var _0x4f0f=function(_0x224e23,_0x56ab5e){_0x224e23=_0x224e23-0x0;var _0x137faa=_0xf0f4[_0x224e23];return _0x137faa;};'use strict';function VtigerAccount(_0x150fc0){this['id']=_0x150fc0['id']||0x0;this[_0x4f0f('0x0')]=_0x150fc0[_0x4f0f('0x0')]||'';this[_0x4f0f('0x1')]=_0x150fc0[_0x4f0f('0x1')]||'';this['accessKey']=_0x150fc0['accessKey']||'';this[_0x4f0f('0x2')]=_0x150fc0[_0x4f0f('0x2')]||'';this[_0x4f0f('0x3')]=_0x150fc0[_0x4f0f('0x3')]||'';this['Configurations']=_0x150fc0[_0x4f0f('0x4')]||{};}module[_0x4f0f('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 18b72d5..793c3de 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 _0x62bf=['authType','type','serverUrl','Configurations','name','password','token','remoteUri'];(function(_0x59b2b5,_0x55c20a){var _0x658e36=function(_0x11a5d4){while(--_0x11a5d4){_0x59b2b5['push'](_0x59b2b5['shift']());}};_0x658e36(++_0x55c20a);}(_0x62bf,0x64));var _0xf62b=function(_0x2cb04d,_0x28ec29){_0x2cb04d=_0x2cb04d-0x0;var _0x50fbc8=_0x62bf[_0x2cb04d];return _0x50fbc8;};'use strict';function ZendeskAccount(_0x4216aa){this['id']=_0x4216aa['id']||0x0;this[_0xf62b('0x0')]=_0x4216aa[_0xf62b('0x0')]||'';this['username']=_0x4216aa['username']||'';this[_0xf62b('0x1')]=_0x4216aa[_0xf62b('0x1')]||'';this['token']=_0x4216aa[_0xf62b('0x2')]||'';this[_0xf62b('0x3')]=_0x4216aa[_0xf62b('0x3')]||'';this[_0xf62b('0x4')]=_0x4216aa['authType']||'';this['type']=_0x4216aa[_0xf62b('0x5')]||'integrationTab';this[_0xf62b('0x6')]=_0x4216aa[_0xf62b('0x6')]||'';this[_0xf62b('0x7')]=_0x4216aa['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x2250=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x102446,_0x304dcf){var _0x35a364=function(_0x573f34){while(--_0x573f34){_0x102446['push'](_0x102446['shift']());}};_0x35a364(++_0x304dcf);}(_0x2250,0x8e));var _0x0225=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x2250[_0x40bffc];return _0x3007e9;};'use strict';function ZendeskAccount(_0x176e92){this['id']=_0x176e92['id']||0x0;this[_0x0225('0x0')]=_0x176e92['name']||'';this[_0x0225('0x1')]=_0x176e92[_0x0225('0x1')]||'';this['password']=_0x176e92[_0x0225('0x2')]||'';this['token']=_0x176e92[_0x0225('0x3')]||'';this[_0x0225('0x4')]=_0x176e92[_0x0225('0x4')]||'';this[_0x0225('0x5')]=_0x176e92[_0x0225('0x5')]||'';this[_0x0225('0x6')]=_0x176e92[_0x0225('0x6')]||_0x0225('0x7');this['serverUrl']=_0x176e92[_0x0225('0x8')]||'';this[_0x0225('0x9')]=_0x176e92[_0x0225('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 4f94d9f..0df86d6 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 _0xc0d3=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x1f5647,_0x51664d){var _0x3fbc15=function(_0x5433ba){while(--_0x5433ba){_0x1f5647['push'](_0x1f5647['shift']());}};_0x3fbc15(++_0x51664d);}(_0xc0d3,0xe6));var _0x3c0d=function(_0x38f5f2,_0x3334f8){_0x38f5f2=_0x38f5f2-0x0;var _0x45b6ef=_0xc0d3[_0x38f5f2];return _0x45b6ef;};'use strict';function ZohoAccount(_0x2c1c40){this['id']=_0x2c1c40['id']||0x0;this[_0x3c0d('0x0')]=_0x2c1c40[_0x3c0d('0x0')]||'';this[_0x3c0d('0x1')]=_0x2c1c40[_0x3c0d('0x1')]||'';this[_0x3c0d('0x2')]=_0x2c1c40[_0x3c0d('0x2')]||'';this[_0x3c0d('0x3')]=_0x2c1c40[_0x3c0d('0x3')]||'';this[_0x3c0d('0x4')]=_0x2c1c40[_0x3c0d('0x4')]||'';this[_0x3c0d('0x5')]=_0x2c1c40[_0x3c0d('0x5')]||'';this[_0x3c0d('0x6')]=_0x2c1c40[_0x3c0d('0x6')]||'';this[_0x3c0d('0x7')]=_0x2c1c40['code']||'';this[_0x3c0d('0x8')]=_0x2c1c40[_0x3c0d('0x8')]||'';this[_0x3c0d('0x9')]=_0x2c1c40[_0x3c0d('0x9')]||{};}module[_0x3c0d('0xa')]=ZohoAccount; \ No newline at end of file +var _0xfa4d=['refreshToken','Configurations','exports','name','host','zone','clientId','clientSecret','code'];(function(_0x2b0fec,_0x564d17){var _0x374f6b=function(_0x349a88){while(--_0x349a88){_0x2b0fec['push'](_0x2b0fec['shift']());}};_0x374f6b(++_0x564d17);}(_0xfa4d,0x17d));var _0xdfa4=function(_0x2fe92d,_0x35452f){_0x2fe92d=_0x2fe92d-0x0;var _0x51b146=_0xfa4d[_0x2fe92d];return _0x51b146;};'use strict';function ZohoAccount(_0x5866cc){this['id']=_0x5866cc['id']||0x0;this[_0xdfa4('0x0')]=_0x5866cc[_0xdfa4('0x0')]||'';this['description']=_0x5866cc['description']||'';this[_0xdfa4('0x1')]=_0x5866cc[_0xdfa4('0x1')]||'';this['zone']=_0x5866cc[_0xdfa4('0x2')]||'';this[_0xdfa4('0x3')]=_0x5866cc[_0xdfa4('0x3')]||'';this[_0xdfa4('0x4')]=_0x5866cc[_0xdfa4('0x4')]||'';this['serverUrl']=_0x5866cc['serverUrl']||'';this[_0xdfa4('0x5')]=_0x5866cc['code']||'';this[_0xdfa4('0x6')]=_0x5866cc[_0xdfa4('0x6')]||'';this['Configurations']=_0x5866cc[_0xdfa4('0x7')]||{};}module[_0xdfa4('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 27ede95..129b086 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 _0xe50e=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','exports','lodash','string','isNil','idContact','queue','type','campaigntype','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid'];(function(_0xd0f807,_0x4e88db){var _0x403285=function(_0x2be118){while(--_0x2be118){_0xd0f807['push'](_0xd0f807['shift']());}};_0x403285(++_0x4e88db);}(_0xe50e,0x1ae));var _0xee50=function(_0xf4a9c3,_0xad6030){_0xf4a9c3=_0xf4a9c3-0x0;var _0x2b9ce9=_0xe50e[_0xf4a9c3];return _0x2b9ce9;};'use strict';var util=require('util');var _=require(_0xee50('0x0'));var moment=require('moment');function checkNameSurname(_0x1671fe,_0x1ac2fb,_0x5509bc){var _0x12b66a='';if(!_['isNil'](_0x1ac2fb)&&_0xee50('0x1')===typeof _0x1ac2fb){_0x12b66a+=_0x1ac2fb;}if(!_[_0xee50('0x2')](_0x5509bc)&&'string'===typeof _0x5509bc){_0x12b66a+='\x20'+_0x5509bc;}if(_0x12b66a!==''){return _0x12b66a;}return _0x1671fe;}function Action(_0x309c05,_0x1bc972,_0x6b7d85,_0x360189,_0x5826a0){this['uniqueid']=_0x6b7d85||undefined;this[_0xee50('0x3')]=_0x309c05['id'];this[_0xee50('0x4')]=_0x1bc972['name'];this[_0xee50('0x5')]=_0x1bc972[_0xee50('0x5')];this[_0xee50('0x6')]='queue';this['dialAnswer']=![];this[_0xee50('0x7')]=_['isNil'](_0x309c05[_0xee50('0x8')])?undefined:_0x309c05[_0xee50('0x8')][_0xee50('0x9')];this[_0xee50('0xa')]=this['membername']?util[_0xee50('0xb')](_0xee50('0xc'),this[_0xee50('0x7')]):_0x360189||undefined;this[_0xee50('0xd')]=checkNameSurname(_0x309c05[_0xee50('0xe')][_0xee50('0xf')],_0x309c05[_0xee50('0xe')][_0xee50('0x10')],_0x309c05[_0xee50('0xe')][_0xee50('0x11')]);this[_0xee50('0x12')]=_0x309c05['active']||![];this[_0xee50('0x13')]=_0x309c05['Contact'][_0xee50('0xf')];this['scheduledat']=_0x309c05[_0xee50('0x14')];this[_0xee50('0x15')]=_0x309c05['countbusyretry']||0x0;this[_0xee50('0x16')]=_0x309c05[_0xee50('0x16')]||0x0;this[_0xee50('0x17')]=_0x309c05[_0xee50('0x17')]||0x0;this[_0xee50('0x18')]=(_0x309c05['countbusyretry']||0x0)+(_0x309c05['countcongestionretry']||0x0)+(_0x309c05[_0xee50('0x17')]||0x0)+(_0x309c05[_0xee50('0x19')]||0x0)+(_0x309c05[_0xee50('0x1a')]||0x0)+(_0x309c05[_0xee50('0x1b')]||0x0)+(_0x309c05['countmachineretry']||0x0)+(_0x309c05[_0xee50('0x1c')]||0x0);this[_0xee50('0x19')]=_0x309c05[_0xee50('0x19')]||0x0;this[_0xee50('0x1a')]=_0x309c05[_0xee50('0x1a')]||0x0;this[_0xee50('0x1b')]=_0x309c05[_0xee50('0x1b')]||0x0;this[_0xee50('0x1d')]=_0x309c05[_0xee50('0x1d')]||0x0;this[_0xee50('0x1c')]=_0x309c05[_0xee50('0x1c')]||0x0;this[_0xee50('0x1e')]=_0x309c05[_0xee50('0x1e')];this['callbackuniqueid']=_0x309c05[_0xee50('0x1f')];this[_0xee50('0x20')]=_0x309c05[_0xee50('0x20')];this[_0xee50('0x21')]=_0x309c05['recallme'];this[_0xee50('0x22')]=_0x309c05[_0xee50('0x22')];this[_0xee50('0x23')]=_0x309c05[_0xee50('0x23')];this[_0xee50('0x24')]=_[_0xee50('0x2')](_0x309c05['Agent'])?_0x309c05[_0xee50('0x24')]:_0x309c05['Agent']['id'];this[_0xee50('0x25')]=_0x309c05[_0xee50('0x25')];this[_0xee50('0x26')]='';this[_0xee50('0x27')]='';}Action['prototype'][_0xee50('0x28')]=function(){return util[_0xee50('0xb')]('\x22%s\x22\x20<%s>',this[_0xee50('0xd')],this['number']);};module[_0xee50('0x29')]=Action; \ No newline at end of file +var _0xcc8f=['string','uniqueid','idContact','queue','name','type','dialAnswer','Agent','channelAgent','membername','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','isNil'];(function(_0x5546d5,_0x35060d){var _0x29c539=function(_0xc9b23e){while(--_0xc9b23e){_0x5546d5['push'](_0x5546d5['shift']());}};_0x29c539(++_0x35060d);}(_0xcc8f,0x100));var _0xfcc8=function(_0x2dc979,_0xc3b9e7){_0x2dc979=_0x2dc979-0x0;var _0x412b9f=_0xcc8f[_0x2dc979];return _0x412b9f;};'use strict';var util=require(_0xfcc8('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x2a53b5,_0xe29639,_0x2e5516){var _0x5c45b7='';if(!_['isNil'](_0xe29639)&&'string'===typeof _0xe29639){_0x5c45b7+=_0xe29639;}if(!_[_0xfcc8('0x1')](_0x2e5516)&&_0xfcc8('0x2')===typeof _0x2e5516){_0x5c45b7+='\x20'+_0x2e5516;}if(_0x5c45b7!==''){return _0x5c45b7;}return _0x2a53b5;}function Action(_0x2a64c8,_0x330548,_0x46a5ca,_0x3d17da,_0x48d637){this[_0xfcc8('0x3')]=_0x46a5ca||undefined;this[_0xfcc8('0x4')]=_0x2a64c8['id'];this[_0xfcc8('0x5')]=_0x330548[_0xfcc8('0x6')];this[_0xfcc8('0x7')]=_0x330548['type'];this['campaigntype']=_0xfcc8('0x5');this[_0xfcc8('0x8')]=![];this['membername']=_['isNil'](_0x2a64c8[_0xfcc8('0x9')])?undefined:_0x2a64c8[_0xfcc8('0x9')][_0xfcc8('0x6')];this[_0xfcc8('0xa')]=this[_0xfcc8('0xb')]?util[_0xfcc8('0xc')]('SIP/%s',this[_0xfcc8('0xb')]):_0x3d17da||undefined;this[_0xfcc8('0xd')]=checkNameSurname(_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0xf')],_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0x10')],_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0x11')]);this[_0xfcc8('0x12')]=_0x2a64c8[_0xfcc8('0x12')]||![];this[_0xfcc8('0x13')]=_0x2a64c8[_0xfcc8('0xe')][_0xfcc8('0xf')];this['scheduledat']=_0x2a64c8['scheduledat'];this['countbusyretry']=_0x2a64c8['countbusyretry']||0x0;this[_0xfcc8('0x14')]=_0x2a64c8[_0xfcc8('0x14')]||0x0;this[_0xfcc8('0x15')]=_0x2a64c8[_0xfcc8('0x15')]||0x0;this[_0xfcc8('0x16')]=(_0x2a64c8[_0xfcc8('0x17')]||0x0)+(_0x2a64c8[_0xfcc8('0x14')]||0x0)+(_0x2a64c8[_0xfcc8('0x15')]||0x0)+(_0x2a64c8[_0xfcc8('0x18')]||0x0)+(_0x2a64c8['countdropretry']||0x0)+(_0x2a64c8[_0xfcc8('0x19')]||0x0)+(_0x2a64c8[_0xfcc8('0x1a')]||0x0)+(_0x2a64c8[_0xfcc8('0x1b')]||0x0);this[_0xfcc8('0x18')]=_0x2a64c8[_0xfcc8('0x18')]||0x0;this[_0xfcc8('0x1c')]=_0x2a64c8[_0xfcc8('0x1c')]||0x0;this[_0xfcc8('0x19')]=_0x2a64c8[_0xfcc8('0x19')]||0x0;this[_0xfcc8('0x1a')]=_0x2a64c8[_0xfcc8('0x1a')]||0x0;this['countagentrejectretry']=_0x2a64c8[_0xfcc8('0x1b')]||0x0;this['callback']=_0x2a64c8['callback'];this[_0xfcc8('0x1d')]=_0x2a64c8[_0xfcc8('0x1d')];this[_0xfcc8('0x1e')]=_0x2a64c8[_0xfcc8('0x1e')];this[_0xfcc8('0x1f')]=_0x2a64c8[_0xfcc8('0x1f')];this[_0xfcc8('0x20')]=_0x2a64c8[_0xfcc8('0x20')];this[_0xfcc8('0x21')]=_0x2a64c8[_0xfcc8('0x21')];this['UserId']=_[_0xfcc8('0x1')](_0x2a64c8[_0xfcc8('0x9')])?_0x2a64c8[_0xfcc8('0x22')]:_0x2a64c8['Agent']['id'];this[_0xfcc8('0x23')]=_0x2a64c8[_0xfcc8('0x23')];this[_0xfcc8('0x24')]='';this[_0xfcc8('0x25')]='';}Action[_0xfcc8('0x26')][_0xfcc8('0x27')]=function(){return util['format'](_0xfcc8('0x28'),this[_0xfcc8('0xd')],this[_0xfcc8('0x29')]);};module[_0xfcc8('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 999fda3..6151192 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 _0xc3b5=['countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','catch','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','TrunkBackup','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','starttime','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','responsetime','unlockContact','idContact','rejected','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','syncHangupRequest','addVariable','variables','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency'];(function(_0x28a5eb,_0x513eac){var _0xb4d010=function(_0x201a4d){while(--_0x201a4d){_0x28a5eb['push'](_0x28a5eb['shift']());}};_0xb4d010(++_0x513eac);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x465703,_0x17887b){_0x465703=_0x465703-0x0;var _0x1080cd=_0xc3b5[_0x465703];return _0x1080cd;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x5c3b('0x0'));var uuid=require(_0x5c3b('0x1'));var moment=require(_0x5c3b('0x2'));var md5=require(_0x5c3b('0x3'));var Redis=require(_0x5c3b('0x4'));var config=require(_0x5c3b('0x5'));var logger=require(_0x5c3b('0x6'))(_0x5c3b('0x7'));var loggerAction=require('../../../config/logger')(_0x5c3b('0x8'));var ami=require(_0x5c3b('0x9'));var rpcDb=require('./rpcDb');var Action=require(_0x5c3b('0xa'));var ut=require(_0x5c3b('0xb'));config[_0x5c3b('0xc')]=_[_0x5c3b('0xd')](config['redis'],{'host':_0x5c3b('0xe'),'port':0x18eb});var io=require(_0x5c3b('0xf'))(new Redis(config[_0x5c3b('0xc')]));var Sequence=function(){};Sequence[_0x5c3b('0x10')]['enqueue']=function(_0x20dd86){this[_0x5c3b('0x11')]=this[_0x5c3b('0x11')]?this[_0x5c3b('0x11')][_0x5c3b('0x12')](_0x20dd86):_0x20dd86();};function Preview(_0x5b9f7e){this[_0x5c3b('0x13')]=new Sequence();this[_0x5c3b('0x14')]=_0x5b9f7e['voiceQueues'];this[_0x5c3b('0x15')]=_0x5b9f7e[_0x5c3b('0x15')];this['actions']={};this[_0x5c3b('0x16')]=_0x5b9f7e[_0x5c3b('0x16')];this[_0x5c3b('0x17')]=0x0;ami['on'](_0x5c3b('0x18'),this[_0x5c3b('0x19')][_0x5c3b('0x1a')](this));ami['on'](_0x5c3b('0x1b'),this['syncHangup'][_0x5c3b('0x1a')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x5c3b('0x1a')](this));ami['on'](_0x5c3b('0x1c'),this[_0x5c3b('0x1d')]['bind'](this));ami['on'](_0x5c3b('0x1e'),this[_0x5c3b('0x1f')][_0x5c3b('0x1a')](this));ami['on']('varset',this[_0x5c3b('0x20')][_0x5c3b('0x1a')](this));ami['on']('attendedtransfer',this[_0x5c3b('0x21')][_0x5c3b('0x1a')](this));ami['on'](_0x5c3b('0x22'),this[_0x5c3b('0x23')][_0x5c3b('0x1a')](this));this[_0x5c3b('0x24')](this[_0x5c3b('0x14')]);}function emit(_0x1af39c,_0xc63307,_0x1138b0){io['to'](_0x1af39c)['emit'](_0xc63307,_0x1138b0);}function emitCampaignPreview(_0x555495){if(_0x555495[_0x5c3b('0x25')]===_0x5c3b('0x26')){var _0x5942f1={'id':_0x555495['id'],'name':_0x555495[_0x5c3b('0x27')],'strategy':_0x555495['strategy'],'answered':_0x555495[_0x5c3b('0x28')],'available':_0x555495[_0x5c3b('0x29')],'loggedIn':_0x555495[_0x5c3b('0x2a')],'pTalking':_0x555495[_0x5c3b('0x2b')],'sumBillable':_0x555495['sumBillable'],'sumDuration':_0x555495[_0x5c3b('0x2c')],'sumHoldTime':_0x555495[_0x5c3b('0x2d')]||0x0,'talking':_0x555495['talking'],'total':_0x555495[_0x5c3b('0x2e')],'type':_0x555495[_0x5c3b('0x25')],'unmanaged':_0x555495[_0x5c3b('0x2f')],'abandoned':_0x555495[_0x5c3b('0x30')],'waiting':_0x555495['waiting'],'loggedInDb':_0x555495[_0x5c3b('0x31')],'dialActive':_0x555495[_0x5c3b('0x32')],'dialMethod':_0x555495[_0x5c3b('0x33')],'dialOriginateCallerIdName':_0x555495[_0x5c3b('0x34')],'dialOriginateCallerIdNumber':_0x555495[_0x5c3b('0x35')],'dialOriginateTimeout':_0x555495[_0x5c3b('0x36')],'dialPrefix':_0x555495['dialPrefix'],'outboundAnswerAgiCallsDay':_0x555495['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x555495['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x555495[_0x5c3b('0x37')],'outboundBusyCallsDay':_0x555495[_0x5c3b('0x38')],'outboundCongestionCallsDay':_0x555495['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x555495[_0x5c3b('0x39')],'outboundDropCallsDayCallersExit':_0x555495[_0x5c3b('0x3a')],'outboundDropCallsDayTimeout':_0x555495[_0x5c3b('0x3b')],'outboundNoAnswerCallsDay':_0x555495[_0x5c3b('0x3c')],'outboundNoSuchCallsDay':_0x555495[_0x5c3b('0x3d')],'outboundOriginateFailureCallsDay':_0x555495[_0x5c3b('0x3e')],'outboundReCallsDay':_0x555495[_0x5c3b('0x3f')],'outboundRejectCallsDay':_0x555495[_0x5c3b('0x40')],'outboundUnknownCallsDay':_0x555495[_0x5c3b('0x41')],'outboundAbandonedCallsDay':_0x555495[_0x5c3b('0x42')],'predictiveIntervalAnsweredCalls':_0x555495[_0x5c3b('0x43')],'predictiveIntervalAvgHoldtime':_0x555495[_0x5c3b('0x44')],'predictiveIntervalAvgTalktime':_0x555495['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x555495[_0x5c3b('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x555495[_0x5c3b('0x46')],'predictiveIntervalErlangCalls':_0x555495[_0x5c3b('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x555495[_0x5c3b('0x48')],'predictiveIntervalHitRate':_0x555495[_0x5c3b('0x49')],'predictiveIntervalMultiplicativeFactor':_0x555495[_0x5c3b('0x4a')],'predictiveIntervalPauses':_0x555495[_0x5c3b('0x4b')],'predictiveIntervalAvailable':_0x555495[_0x5c3b('0x4c')],'predictiveIntervalTotalCalls':_0x555495[_0x5c3b('0x4d')],'message':_0x555495[_0x5c3b('0x4e')],'originated':_0x555495[_0x5c3b('0x4f')],'erlangCalls':_0x555495[_0x5c3b('0x50')],'erlangCallToSecond':_0x555495[_0x5c3b('0x51')],'erlangAbandonmentRate':_0x555495[_0x5c3b('0x52')],'erlangBusyFactor':_0x555495[_0x5c3b('0x53')],'startPredictive':_0x555495[_0x5c3b('0x54')],'startProgressive':_0x555495[_0x5c3b('0x55')]};if(_0x555495['Trunk']){_0x5942f1[_0x5c3b('0x56')]={'id':_0x555495[_0x5c3b('0x56')]['id'],'name':_0x555495[_0x5c3b('0x56')][_0x5c3b('0x27')],'active':_0x555495['Trunk'][_0x5c3b('0x57')],'callerid':_0x555495[_0x5c3b('0x56')]['callerid']};}if(_0x555495[_0x5c3b('0x58')]){_0x5942f1[_0x5c3b('0x58')]={'id':_0x555495[_0x5c3b('0x58')]['id'],'name':_0x555495[_0x5c3b('0x58')][_0x5c3b('0x27')]};}var _0x27e7f7=md5(JSON[_0x5c3b('0x59')](_0x5942f1));if(_0x555495[_0x5c3b('0x3')]!==_0x27e7f7){_0x555495[_0x5c3b('0x3')]=_0x27e7f7;emit(util['format'](_0x5c3b('0x5a'),_0x5942f1[_0x5c3b('0x27')]),'voice_queue:save',_0x5942f1);}}}function emitVoiceQueueChannelRemove(_0x59e079){logger[_0x5c3b('0x5b')](_0x5c3b('0x5c'),JSON[_0x5c3b('0x59')](_0x59e079));emit(util[_0x5c3b('0x5d')](_0x5c3b('0x5a'),_0x59e079[_0x5c3b('0x27')]),_0x5c3b('0x5e'),_0x59e079);io['emit']('voice_queue_presence:remove',_0x59e079);}function notSendMessagesQueue(_0x3a641e){if(_0x3a641e[_0x5c3b('0x5f')]){if(_0x3a641e[_0x5c3b('0x4f')]===0x0&&_0x3a641e[_0x5c3b('0x2b')]===0x0){_0x3a641e['sendMessageOneNotActive']=![];_0x3a641e[_0x5c3b('0x29')]=0x0;_0x3a641e['paused']=0x0;_0x3a641e[_0x5c3b('0x4e')]=_0x5c3b('0x60');ut[_0x5c3b('0x61')](_0x5c3b('0x62'),_0x3a641e[_0x5c3b('0x27')]+_0x5c3b('0x63'));}else{_0x3a641e[_0x5c3b('0x4e')]=_0x5c3b('0x64');ut[_0x5c3b('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3a641e['name']+_0x5c3b('0x65'));}emitCampaignPreview(_0x3a641e);}}Preview[_0x5c3b('0x10')][_0x5c3b('0x24')]=function(){var _0x2d9e7b=this;setInterval(function(){_0x2d9e7b[_0x5c3b('0x66')]();},0x7cf);};Preview[_0x5c3b('0x10')][_0x5c3b('0x66')]=function(){var _0x1d9427=this[_0x5c3b('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x37f9ac in _0x1d9427){if(_0x1d9427[_0x5c3b('0x67')](_0x37f9ac)&&(_0x1d9427[_0x37f9ac][_0x5c3b('0x33')]==='preview'||_0x1d9427[_0x37f9ac][_0x5c3b('0x33')]===_0x5c3b('0x68'))&&_0x1d9427[_0x37f9ac][_0x5c3b('0x25')]===_0x5c3b('0x26')){if(this[_0x5c3b('0x17')]>0x7){this[_0x5c3b('0x17')]=0x0;this[_0x5c3b('0x69')]();}}if(_0x1d9427[_0x5c3b('0x67')](_0x37f9ac)&&_0x1d9427[_0x37f9ac][_0x5c3b('0x33')]===_0x5c3b('0x7')&&_0x1d9427[_0x37f9ac][_0x5c3b('0x25')]==='outbound'){if(_0x1d9427[_0x37f9ac][_0x5c3b('0x32')]){this['setMessage'](_0x1d9427[_0x37f9ac]);if(_0x1d9427[_0x37f9ac][_0x5c3b('0x6a')])this[_0x5c3b('0x6b')](_0x1d9427[_0x37f9ac]);}else{notSendMessagesQueue(_0x1d9427[_0x37f9ac]);}}}};Preview['prototype'][_0x5c3b('0x6c')]=function(_0x285346){var _0x37325e=this;this['sequence'][_0x5c3b('0x6d')](function(){if(!_['isNil'](_0x37325e[_0x5c3b('0x6e')][_0x285346])){loggerAction[_0x5c3b('0x5b')](_0x5c3b('0x6f'),_0x285346,_0x5c3b('0x70'),_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')],_0x5c3b('0x72'),JSON[_0x5c3b('0x59')](_0x37325e[_0x5c3b('0x14')][_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]]['originated']),_0x5c3b('0x73'),JSON['stringify'](_0x37325e[_0x5c3b('0x14')][_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]]['pTalking']),JSON[_0x5c3b('0x59')](_0x37325e[_0x5c3b('0x6e')][_0x285346]['dialAnswer']),JSON[_0x5c3b('0x59')](_[_0x5c3b('0x74')](_0x37325e[_0x5c3b('0x6e')][_0x285346],[_0x5c3b('0x75'),_0x5c3b('0x76'),_0x5c3b('0x77'),_0x5c3b('0x78')])));return ami[_0x5c3b('0x79')]({'action':_0x5c3b('0x7a'),'channel':_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x7b')]})['catch'](function(_0x525bc6){if(_0x525bc6['message']===_0x5c3b('0x7c')){setTimeout(function(){if(_0x37325e[_0x5c3b('0x6e')][_0x285346]){ut['updateOriginated'](_0x37325e[_0x5c3b('0x14')][_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]],_0x5c3b('0x7d'));if(_0x37325e['actions'][_0x285346][_0x5c3b('0x7e')]===!![]){ut[_0x5c3b('0x7f')](_0x37325e['campaignsPreview'][_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]],_0x5c3b('0x7d'));ut[_0x5c3b('0x80')](_0x5c3b('0x81')+_0x285346,_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]);}ut[_0x5c3b('0x80')](_0x5c3b('0x82')+_0x285346,_0x37325e[_0x5c3b('0x6e')][_0x285346][_0x5c3b('0x71')]);delete _0x37325e[_0x5c3b('0x6e')][_0x285346];}},0x2328);}});}});};Preview[_0x5c3b('0x10')]['clearZombieChannels']=function(){var _0x5191b5=this;loggerAction[_0x5c3b('0x5b')](_0x5c3b('0x83'),_[_0x5c3b('0x84')](this['actions']));for(var _0x51f6b3 in this['actions']){if(_0x5191b5[_0x5c3b('0x6e')]['hasOwnProperty'](_0x51f6b3)){_0x5191b5[_0x5c3b('0x6c')](_0x51f6b3);}}};Preview[_0x5c3b('0x10')][_0x5c3b('0x6b')]=function(_0x3d5218){var _0x3976c0=this;rpcDb['getContactRecallMe'](_0x3d5218['id'],ut[_0x5c3b('0x85')](this['agents']))[_0x5c3b('0x86')](function(_0x5e55e4){if(!_[_0x5c3b('0x87')](_0x5e55e4)){for(var _0x87f956=0x0;_0x87f956<_0x5e55e4[_0x5c3b('0x88')];_0x87f956+=0x1){if(ut[_0x5c3b('0x89')](_0x5e55e4[_0x87f956][_0x5c3b('0x8a')])<_0x3d5218[_0x5c3b('0x8b')]*0x3c){if(_0x5e55e4[_0x87f956][_0x5c3b('0x8c')]&&!_0x5e55e4[_0x87f956][_0x5c3b('0x8c')][_0x5c3b('0x8d')]){_0x3976c0[_0x5c3b('0x8e')](_0x5e55e4[_0x87f956]['id'])[_0x5c3b('0x86')](ut['logger2']('[RecallMe]'))['catch'](ut[_0x5c3b('0x8f')](_0x5c3b('0x90')));}else{rpcDb[_0x5c3b('0x91')](_0x5e55e4[_0x87f956]['id']);}}else{var _0x150868=new Action(_0x5e55e4[_0x87f956],_0x3d5218);_0x150868['starttime']=moment()['format'](_0x5c3b('0x92'));_0x3d5218['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x150868,0x17,_0x5c3b('0x93'));if(_0x3d5218[_0x5c3b('0x94')]){rpcDb[_0x5c3b('0x95')](ut[_0x5c3b('0x96')](_0x5e55e4[_0x87f956]));rpcDb[_0x5c3b('0x97')](_0x150868,_0x5c3b('0x98'));}else{ut[_0x5c3b('0x99')](_0x150868,0x16,_0x5c3b('0x9a'));rpcDb[_0x5c3b('0x97')](_0x150868,_0x5c3b('0x9b'));rpcDb[_0x5c3b('0x9c')](_0x150868,_0x5c3b('0x9b'));}}}}})['catch'](ut[_0x5c3b('0x8f')]('[getContactRecallMe]'));};Preview[_0x5c3b('0x10')][_0x5c3b('0x9d')]=function(_0x2e0907){_0x2e0907[_0x5c3b('0x5f')]=!![];if(ut[_0x5c3b('0x9e')](_0x2e0907[_0x5c3b('0x2a')])){_0x2e0907[_0x5c3b('0x4e')]=_0x5c3b('0x9f');}else if(!ut['isActive'](_0x2e0907[_0x5c3b('0x32')])){_0x2e0907['message']='NOT_ACTIVE';}else if(!this[_0x5c3b('0xa0')](_0x2e0907[_0x5c3b('0x56')])){if(!this[_0x5c3b('0xa0')](_0x2e0907['TrunkBackup'])){_0x2e0907[_0x5c3b('0x4e')]=_0x5c3b('0xa1');}else{_0x2e0907[_0x5c3b('0x4e')]='ACTIVE';}}else{_0x2e0907[_0x5c3b('0x4e')]='ACTIVE';}emitCampaignPreview(_0x2e0907);};Preview[_0x5c3b('0x10')][_0x5c3b('0xa2')]=function(_0x1a7ccd,_0x5a2e94,_0x44a8b9){var _0x5f17c1=this;var _0x22ba96=this[_0x5c3b('0x6e')][_0x5a2e94];var _0x19647a=this['campaignsPreview'][_0x22ba96[_0x5c3b('0x71')]];var _0x5dd15b;if(_0x19647a){switch(_0x44a8b9){case'1':_0x19647a[_0x5c3b('0x3d')]+=0x1;_0x22ba96[_0x5c3b('0xa3')]+=0x1;_0x22ba96[_0x5c3b('0xa4')]=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x0,_0x5c3b('0xa6'));ami[_0x5c3b('0xa7')](_0x5c3b('0xa8'),ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xaa')));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xab'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a['dialGlobalMaxRetry']){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0xf,_0x5c3b('0xad'));rpcDb['createCustomerFinal'](_0x5dd15b,_0x5c3b('0xae'));}else{if(_0x22ba96[_0x5c3b('0xa3')]>=_0x19647a[_0x5c3b('0xaf')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xae'));}else{rpcDb[_0x5c3b('0xb0')](ut[_0x5c3b('0xb1')](_0x22ba96,_0x5c3b('0xa3'),_0x19647a[_0x5c3b('0xb2')]),_0x22ba96['unlockAgent'],_0x22ba96['activeContact']);}}delete this['actions'][_0x1a7ccd['linkedid']];break;case'ANSWER':var _0x274b66=moment()[_0x5c3b('0x5d')](_0x5c3b('0x92'));_0x22ba96['responsetime']=_0x274b66;_0x22ba96[_0x5c3b('0xb3')]=_0x274b66;_0x22ba96['dialAnswer']=!![];_0x19647a[_0x5c3b('0x2b')]+=0x1;logger[_0x5c3b('0x5b')](_0x5c3b('0xb4'),_0x22ba96[_0x5c3b('0xb5')],_0x5c3b('0xb6'),_0x19647a[_0x5c3b('0x27')],_0x5c3b('0x73'),_0x19647a[_0x5c3b('0x2b')]);ami[_0x5c3b('0xa7')](_0x5c3b('0xb7'),ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xb8'),this['campaignsPreview'][_0x22ba96[_0x5c3b('0x71')]]));if(_0x19647a[_0x5c3b('0xb9')]){ami[_0x5c3b('0xa7')](_0x5c3b('0xba'),ut[_0x5c3b('0xbb')](_0x22ba96));}break;case'16':ami[_0x5c3b('0xa7')]('custom:agentcomplete',ut['buildObj'](_0x22ba96,_0x5c3b('0xbc'),this[_0x5c3b('0x14')][_0x22ba96['queue']]));emitVoiceQueueChannelRemove(ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xbc')));_0x19647a[_0x5c3b('0xbd')]+=0x1;_0x19647a['total']+=0x1;_0x19647a[_0x5c3b('0x28')]+=0x1;ut[_0x5c3b('0x7f')](_0x19647a,_0x5c3b('0xbe'));_0x22ba96[_0x5c3b('0xa4')]=ut['totalGlobal'](_0x22ba96);ut['logCustomer'](_0x22ba96,0x4,_0x5c3b('0xbf'));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xc0'));rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xc1'));rpcDb[_0x5c3b('0xc2')](_0x22ba96);_0x19647a[_0x5c3b('0x2c')]+=_0x22ba96[_0x5c3b('0xc3')];_0x19647a[_0x5c3b('0xc4')]+=_0x22ba96['talktime'];logger[_0x5c3b('0x5b')](_0x5c3b('0xc5'),_0x22ba96[_0x5c3b('0xb5')],_0x5c3b('0xb6'),_0x19647a[_0x5c3b('0x27')],_0x5c3b('0x73'),_0x19647a[_0x5c3b('0x2b')]);delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xc6')]];break;case'BUSY':_0x19647a[_0x5c3b('0x38')]+=0x1;_0x22ba96[_0x5c3b('0xc7')]+=0x1;_0x22ba96[_0x5c3b('0xa4')]=ut[_0x5c3b('0xa5')](_0x22ba96);ut['logCustomer'](_0x22ba96,0x5,'Busy');ami['emit'](_0x5c3b('0xc8'),ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xc9')));rpcDb['createCustomerHistory'](_0x22ba96,_0x5c3b('0xca'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut['cloneAction'](_0x22ba96,0xf,_0x5c3b('0xad'));rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xcc'));}else{if(_0x22ba96['countbusyretry']>=_0x19647a[_0x5c3b('0xcd')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xca'));}else{rpcDb[_0x5c3b('0xb0')](ut[_0x5c3b('0xb1')](_0x22ba96,'countbusyretry',_0x19647a[_0x5c3b('0xce')]),_0x22ba96[_0x5c3b('0xcf')],_0x22ba96['activeContact']);}}break;case'NOANSWER':_0x19647a['outboundNoAnswerCallsDay']+=0x1;_0x22ba96[_0x5c3b('0xd0')]+=0x1;_0x22ba96[_0x5c3b('0xa4')]=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x3,'NoAnswer');ami[_0x5c3b('0xa7')](_0x5c3b('0xd1'),ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xd2')));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xd3'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0xf,_0x5c3b('0xad'));rpcDb['createCustomerFinal'](_0x5dd15b,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x22ba96[_0x5c3b('0xd0')]>=_0x19647a[_0x5c3b('0xd4')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xd3'));}else{rpcDb[_0x5c3b('0xb0')](ut['scheduledAt'](_0x22ba96,_0x5c3b('0xd0'),_0x19647a[_0x5c3b('0xd5')]),_0x22ba96[_0x5c3b('0xcf')],_0x22ba96[_0x5c3b('0xd6')]);}}break;case _0x5c3b('0xd7'):_0x19647a[_0x5c3b('0xd8')]+=0x1;_0x22ba96['countcongestionretry']+=0x1;_0x22ba96['countglobal']=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x8,'Congestion');ami[_0x5c3b('0xa7')](_0x5c3b('0xd9'),ut['buildObj'](_0x22ba96,_0x5c3b('0xda')));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xdb'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0xf,'Global');rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xdc'));}else{if(_0x22ba96[_0x5c3b('0xdd')]>=_0x19647a[_0x5c3b('0xde')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x5c3b('0xb0')](ut[_0x5c3b('0xb1')](_0x22ba96,_0x5c3b('0xdd'),_0x19647a[_0x5c3b('0xce')]),_0x22ba96['unlockAgent'],_0x22ba96[_0x5c3b('0xd6')]);}}break;case'CANCEL':_0x19647a[_0x5c3b('0x40')]+=0x1;_0x22ba96['countagentrejectretry']+=0x1;_0x22ba96[_0x5c3b('0xa4')]=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x14,'AgentReject');ami['emit'](_0x5c3b('0xdf'),ut['buildObj'](_0x22ba96,_0x5c3b('0xe0')));rpcDb[_0x5c3b('0x97')](_0x22ba96,'[syncHangupRequest][logAgentReject]');if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a['dialGlobalMaxRetry']){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0x14,_0x5c3b('0xe1'));rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xe2'));}else{if(_0x22ba96[_0x5c3b('0xe3')]>=_0x19647a[_0x5c3b('0xe4')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xe2'));}else{rpcDb[_0x5c3b('0xb0')](ut['scheduledAt'](_0x22ba96,'countagentrejectretry',_0x19647a['dialAgentRejectRetryFrequency']),_0x22ba96['unlockAgent'],_0x22ba96[_0x5c3b('0xd6')]);}}break;case'ABANDONED':_0x19647a[_0x5c3b('0x42')]+=0x1;_0x22ba96[_0x5c3b('0xe5')]+=0x1;_0x22ba96[_0x5c3b('0xa4')]=ut[_0x5c3b('0xa5')](_0x22ba96);ut['logCustomer'](_0x22ba96,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x22ba96,_0x5c3b('0xe6'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut['cloneAction'](_0x22ba96,0xf,_0x5c3b('0xad'));rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xe6'));}else{if(_0x22ba96[_0x5c3b('0xe7')]>=_0x19647a[_0x5c3b('0xe8')]){rpcDb[_0x5c3b('0x9c')](_0x22ba96,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x5c3b('0xb0')](ut[_0x5c3b('0xb1')](_0x22ba96,_0x5c3b('0xe5'),_0x19647a[_0x5c3b('0xe9')]),_0x22ba96['unlockAgent'],_0x22ba96['activeContact']);}}break;case'18':_0x19647a[_0x5c3b('0x41')]+=0x1;_0x22ba96[_0x5c3b('0xea')]+=0x1;_0x22ba96['countglobal']=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x12,_0x1a7ccd[_0x5c3b('0xeb')]||_0x1a7ccd[_0x5c3b('0xec')]);ami[_0x5c3b('0xa7')]('custom:amd',ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xed')));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xee'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0xf,'Global');rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xee'));}else{rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xee'));}delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xc6')]];break;case'19':_0x19647a['outboundUnknownCallsDay']+=0x1;_0x22ba96['countglobal']=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0x13,_0x1a7ccd[_0x5c3b('0xeb')]||_0x1a7ccd[_0x5c3b('0xec')]);ami[_0x5c3b('0xa7')]('custom:amd',ut[_0x5c3b('0xa9')](_0x22ba96,_0x5c3b('0xed')));rpcDb[_0x5c3b('0x97')](_0x22ba96,_0x5c3b('0xef'));if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a[_0x5c3b('0xcb')]){_0x5dd15b=ut[_0x5c3b('0xac')](_0x22ba96,0xf,'Global');rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xef'));}else{rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xef'));}delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xc6')]];break;default:if(_0x22ba96[_0x5c3b('0x7e')]){ut[_0x5c3b('0x7f')](_0x19647a,'[default]');ut[_0x5c3b('0x80')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x19647a[_0x5c3b('0x27')],_0x1a7ccd);}_0x19647a[_0x5c3b('0x41')]+=0x1;_0x22ba96['countglobal']=ut[_0x5c3b('0xa5')](_0x22ba96);ut[_0x5c3b('0x99')](_0x22ba96,0xc,_0x1a7ccd[_0x5c3b('0xeb')]||_0x1a7ccd[_0x5c3b('0xec')]);rpcDb['createCustomerHistory'](_0x22ba96,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x5c3b('0xa5')](_0x22ba96)>=_0x19647a['dialGlobalMaxRetry']){_0x5dd15b=ut['cloneAction'](_0x22ba96,0xf,'Global');rpcDb[_0x5c3b('0x9c')](_0x5dd15b,_0x5c3b('0xf0'));}else{rpcDb[_0x5c3b('0x9c')](_0x22ba96,_0x5c3b('0xf0'));}delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xc6')]];}if(!(_0x22ba96[_0x5c3b('0x7e')]&&_0x44a8b9==='16')){ut[_0x5c3b('0xf1')](_0x19647a,_0x5c3b('0xf2'));logger[_0x5c3b('0x5b')](_0x5c3b('0xf3'),_0x22ba96[_0x5c3b('0xb5')],_0x5c3b('0xb6'),_0x19647a['name'],_0x5c3b('0x72'),_0x19647a['originated']);}if(_0x44a8b9!==_0x5c3b('0xf4')){delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xc6')]];delete this[_0x5c3b('0x6e')][_0x1a7ccd[_0x5c3b('0xf5')]];}}};Preview[_0x5c3b('0x10')][_0x5c3b('0xf6')]=function(_0x4b3915,_0x32311c,_0x108355){if(_[_0x5c3b('0xf7')](_0x32311c)&&_0x5c3b('0xf8')!==typeof _0x32311c){return;}if(_[_0x5c3b('0xf7')](_0x108355)&&_0x5c3b('0xf8')!==typeof _0x108355){return;}switch(_0x108355[_0x5c3b('0xf9')]){case'0':ut[_0x5c3b('0xfa')](_0x4b3915,0x0,_0x5c3b('0xa6'));rpcDb[_0x5c3b('0xfb')](_0x4b3915,_0x5c3b('0xfc'));break;case'3':ut[_0x5c3b('0xfa')](_0x4b3915,0x3,'NoAnswer');rpcDb[_0x5c3b('0xfb')](_0x4b3915,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x5c3b('0xfa')](_0x4b3915,0x5,_0x5c3b('0xfd'));rpcDb[_0x5c3b('0xfb')](_0x4b3915,_0x5c3b('0xfe'));break;case'8':ut[_0x5c3b('0xfa')](_0x4b3915,0x8,'Congestion');rpcDb[_0x5c3b('0xfb')](_0x4b3915,_0x5c3b('0xff'));break;case'22':ut[_0x5c3b('0xfa')](_0x4b3915,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x4b3915,_0x5c3b('0x100'));break;default:ut[_0x5c3b('0xfa')](_0x4b3915,0xc,_0x108355[_0x5c3b('0xf9')]);rpcDb['createAgentHistory'](_0x4b3915,_0x5c3b('0xff'));}ut[_0x5c3b('0xf1')](_0x32311c,_0x5c3b('0x101'));logger[_0x5c3b('0x5b')]('[originated][decrement][callProgressDetectingAgent]',_0x4b3915[_0x5c3b('0xb5')],_0x5c3b('0xb6'),_0x32311c['name'],_0x5c3b('0x72'),_0x32311c[_0x5c3b('0x4f')]);delete this[_0x5c3b('0x6e')][_0x4b3915[_0x5c3b('0xb5')]];};Preview['prototype'][_0x5c3b('0x102')]=function(_0x2eca92,_0x2273e7,_0xafb31b,_0x58a95d,_0x2ac67d){var _0x755f8c=this;return new BPromise(function(_0x115f66,_0x1f7eb1){if(_[_0x5c3b('0x87')](_0x2273e7)||_[_0x5c3b('0x87')](_0x2273e7[_0x5c3b('0x103')])||_[_0x5c3b('0x87')](_0x2273e7[_0x5c3b('0x103')]['phone'])||_[_0x5c3b('0x87')](_0x2273e7[_0x5c3b('0x77')])){_0x1f7eb1(ut[_0x5c3b('0x4e')]('Contact\x20is\x20undefined',_0x58a95d,_0x2ac67d));return;}var _0x4a20a0=uuid['v4']();var _0x40d1e2=_0x755f8c['campaignsPreview'][_0x2273e7['Queue'][_0x5c3b('0x27')]];var _0x555054=_0xafb31b?_0x755f8c[_0x5c3b('0x16')][_0xafb31b]['id']:undefined;_0x755f8c[_0x5c3b('0x6e')][_0x4a20a0]=new Action(_0x2273e7,_0x40d1e2,_0x4a20a0,_0xafb31b,_0x555054);var _0x270810=_0x755f8c[_0x5c3b('0x6e')][_0x4a20a0];_0x270810[_0x5c3b('0xcf')]=_0x58a95d;_0x270810[_0x5c3b('0xd6')]=_0x2ac67d;_0x270810['lookAgent']=_0xafb31b;if(_['isEmpty'](_0x2eca92)){_0x755f8c[_0x5c3b('0x104')](_0x270810,_0x40d1e2,_0x2273e7,_0xafb31b)[_0x5c3b('0x86')](function(_0x3ac720){logger['info']('[Preview][execCall][success]',_0x5c3b('0x105')+_0x270810[_0x5c3b('0x71')]+_0x5c3b('0x106')+_0x270810['idContact'],JSON[_0x5c3b('0x59')](_0x3ac720));ami[_0x5c3b('0xa7')](_0x5c3b('0x107'),ut[_0x5c3b('0xa9')](_0x270810,'called',_0x755f8c[_0x5c3b('0x14')][_0x270810['queue']]));_0x115f66(ut[_0x5c3b('0x4e')](_0x5c3b('0x108')));})[_0x5c3b('0x109')](function(_0x1d7667){ut[_0x5c3b('0x61')](_0x5c3b('0x10a'),_0x1d7667);_0x1f7eb1(ut[_0x5c3b('0x4e')](_0x5c3b('0x10b'),_0x58a95d,_0x2ac67d));});}else{_0x40d1e2['outboundBlacklistCallsDay']+=0x1;ut[_0x5c3b('0x10c')](_0x270810);rpcDb[_0x5c3b('0x10d')](_0x270810,_0x5c3b('0x10e'));delete _0x755f8c['actions'][_0x4a20a0];_0x1f7eb1(ut[_0x5c3b('0x4e')](_0x5c3b('0x10f'),_0x58a95d,_0x2ac67d));}});};Preview['prototype'][_0x5c3b('0xa0')]=function(_0x2e2b23){return!_[_0x5c3b('0x87')](_0x2e2b23)&&!_[_0x5c3b('0x87')](_0x2e2b23[_0x5c3b('0x27')])&&!_[_0x5c3b('0x87')](_0x2e2b23[_0x5c3b('0x57')])&&_0x2e2b23[_0x5c3b('0x57')]&&!_['isNil'](this['trunks'][util[_0x5c3b('0x5d')](_0x5c3b('0x110'),_0x2e2b23[_0x5c3b('0x27')])])&&!_[_0x5c3b('0x87')](this['trunks'][util[_0x5c3b('0x5d')](_0x5c3b('0x110'),_0x2e2b23[_0x5c3b('0x27')])][_0x5c3b('0x7a')])&&(this[_0x5c3b('0x15')][util[_0x5c3b('0x5d')](_0x5c3b('0x110'),_0x2e2b23[_0x5c3b('0x27')])][_0x5c3b('0x7a')]==='reachable'||this['trunks'][util[_0x5c3b('0x5d')](_0x5c3b('0x110'),_0x2e2b23[_0x5c3b('0x27')])][_0x5c3b('0x7a')]===_0x5c3b('0x111'));};Preview['prototype'][_0x5c3b('0x8e')]=function(_0x4be050,_0x561c34){var _0x3d0594=this;return new BPromise(function(_0x39dffe,_0x40afd5){_0x3d0594[_0x5c3b('0x112')](_0x4be050,_0x561c34)[_0x5c3b('0x86')](function(_0x3da184){_0x39dffe(_[_0x5c3b('0x74')](_0x3da184,['message']));})[_0x5c3b('0x109')](function(_0x5e47eb){if(_0x5e47eb[_0x5c3b('0x113')]){rpcDb['unlockContact'](_0x4be050);}if(_0x5e47eb[_0x5c3b('0x57')]){rpcDb['disableContact'](_0x4be050);}_0x40afd5(_['pick'](_0x5e47eb,[_0x5c3b('0x4e')]));});});};Preview[_0x5c3b('0x10')][_0x5c3b('0x112')]=function(_0x2f7425,_0xc72105){var _0x5b6415=this;return new BPromise(function(_0x5bc39c,_0xa94ed9){var _0x53e729,_0x46a3ab;rpcDb[_0x5c3b('0x114')](_0x2f7425)['then'](function(_0x29bff8){if(!_[_0x5c3b('0x87')](_0x29bff8[0x0])){_0x46a3ab=_0x29bff8[0x0][_0x5c3b('0x115')]?![]:!![];_0x53e729=_0x29bff8[0x0][_0x5c3b('0x115')]?!![]:![];_0x53e729=_0xc72105?!![]:_0x53e729;}var _0x3d6446=_0x5b6415[_0x5c3b('0x116')](_0x29bff8);if(_0x3d6446['isValid']){rpcDb[_0x5c3b('0x117')](_[_0x5c3b('0x74')](_0x29bff8[0x0],[_0x5c3b('0x77'),_0x5c3b('0x118')]))[_0x5c3b('0x86')](function(_0x34d361){_0x5b6415['checkInBlack'](_0x34d361,_0x29bff8[0x0],_0xc72105,_0x46a3ab,_0x53e729)[_0x5c3b('0x86')](function(_0xe29d8e){_0x5bc39c(_0xe29d8e);})[_0x5c3b('0x109')](function(_0x1c2504){_0xa94ed9(_0x1c2504);});})[_0x5c3b('0x109')](function(_0x370e18){ut['logger'](_0x5c3b('0x119'),_0x370e18);_0xa94ed9(ut[_0x5c3b('0x4e')](_0x5c3b('0x11a'),_0x46a3ab,_0x53e729));});}else{_0xa94ed9(ut[_0x5c3b('0x4e')](_0x3d6446[_0x5c3b('0x4e')],_0x46a3ab,_0x53e729));}})[_0x5c3b('0x109')](function(_0x1b0dc4){ut[_0x5c3b('0x61')](_0x5c3b('0x11b'),_0x1b0dc4);_0xa94ed9(ut[_0x5c3b('0x4e')](_0x5c3b('0x11a'),![],!![]));});});};Preview[_0x5c3b('0x10')]['validateContact']=function(_0x48c0ef){if(_['isNil'](_0x48c0ef)||_[_0x5c3b('0x11c')](_0x48c0ef)||!_['isNil'](_0x48c0ef[0x0][_0x5c3b('0x8c')])&&_[_0x5c3b('0x87')](_0x48c0ef[0x0][_0x5c3b('0x8c')]['name'])){ut[_0x5c3b('0x61')](_0x5c3b('0x11d'),_0x48c0ef);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5078db=this[_0x5c3b('0x14')][_0x48c0ef[0x0]['Queue'][_0x5c3b('0x27')]];_0x5078db[_0x5c3b('0x4e')]='ACTIVE';if(_['isNil'](_0x5078db)){ut[_0x5c3b('0x61')](_0x5c3b('0x11e'),_0x5078db);return{'isValid':![],'message':_0x5c3b('0x11f')};}if(!this[_0x5c3b('0xa0')](_0x5078db['Trunk'])){ut[_0x5c3b('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x5078db[_0x5c3b('0x27')]+_0x5c3b('0x120'));if(!this['isTrunkReachable'](_0x5078db['TrunkBackup'])){ut[_0x5c3b('0x61')](_0x5c3b('0x121'),_0x5078db[_0x5c3b('0x27')]+_0x5c3b('0x122'));return{'isValid':![],'message':_0x5c3b('0x123')};}}if(!ut[_0x5c3b('0x124')](_0x5078db[_0x5c3b('0x32')])){ut[_0x5c3b('0x61')](_0x5c3b('0x125'),_0x5078db[_0x5c3b('0x27')]+_0x5c3b('0x126'));return{'isValid':![],'message':_0x5c3b('0x127')+_0x5078db[_0x5c3b('0x27')]+_0x5c3b('0x126')};}return{'isValid':!![],'message':_0x5c3b('0x128')};};Preview[_0x5c3b('0x10')][_0x5c3b('0x104')]=function(_0x48e8f1,_0x14ce5d,_0x42c86d,_0x8d361){var _0x3e9c76=this;return new BPromise(function(_0x3d85c5,_0x20daf8){var _0x5a68f4=_0x48e8f1['uniqueid'];var _0x43d6e7=_0x3e9c76[_0x5c3b('0xa0')](_0x14ce5d[_0x5c3b('0x56')])?util['format'](_0x5c3b('0x129'),_0x14ce5d['Trunk'][_0x5c3b('0x27')],_[_0x5c3b('0x87')](_0x14ce5d[_0x5c3b('0x12a')])?'':_0x14ce5d[_0x5c3b('0x12a')][_0x5c3b('0x12b')]()||'',_0x14ce5d[_0x5c3b('0x12c')]>0x0?_0x42c86d[_0x5c3b('0x103')][_0x5c3b('0x12d')]['substring'](_0x14ce5d[_0x5c3b('0x12c')]):_0x42c86d['Contact'][_0x5c3b('0x12d')]):util[_0x5c3b('0x5d')](_0x5c3b('0x129'),_[_0x5c3b('0x87')](_0x14ce5d[_0x5c3b('0x12e')])?_0x14ce5d['Trunk'][_0x5c3b('0x27')]:_0x14ce5d[_0x5c3b('0x12e')][_0x5c3b('0x27')],_[_0x5c3b('0x87')](_0x14ce5d['dialPrefix'])?'':_0x14ce5d[_0x5c3b('0x12a')][_0x5c3b('0x12b')]()||'',_0x14ce5d[_0x5c3b('0x12c')]>0x0?_0x42c86d[_0x5c3b('0x103')][_0x5c3b('0x12d')][_0x5c3b('0x12f')](_0x14ce5d[_0x5c3b('0x12c')]):_0x42c86d[_0x5c3b('0x103')][_0x5c3b('0x12d')]);var _0x32e482=_0x3e9c76[_0x5c3b('0xa0')](_0x14ce5d[_0x5c3b('0x56')])?ut[_0x5c3b('0x130')](_0x14ce5d[_0x5c3b('0x56')][_0x5c3b('0x131')],_0x14ce5d[_0x5c3b('0x34')],_0x14ce5d[_0x5c3b('0x132')]>0x0?ut['getCallerIdRandom'](_0x14ce5d[_0x5c3b('0x35')],_0x14ce5d[_0x5c3b('0x132')]):_0x14ce5d['dialOriginateCallerIdNumber']):ut[_0x5c3b('0x130')](_[_0x5c3b('0x87')](_0x14ce5d[_0x5c3b('0x12e')])?_0x14ce5d[_0x5c3b('0x56')][_0x5c3b('0x131')]:_0x14ce5d[_0x5c3b('0x12e')]['callerid'],_0x14ce5d['dialOriginateCallerIdName'],_0x14ce5d[_0x5c3b('0x132')]>0x0?ut[_0x5c3b('0x133')](_0x14ce5d[_0x5c3b('0x35')],_0x14ce5d['dialRandomLastDigitCallerIdNumber']):_0x14ce5d[_0x5c3b('0x35')]);if(_0x32e482){_0x48e8f1[_0x5c3b('0x134')]=ut['extractCalleridName'](_0x32e482);_0x48e8f1[_0x5c3b('0x135')]=ut[_0x5c3b('0x136')](_0x32e482);}var _0x26344d=ut[_0x5c3b('0x137')](_0x14ce5d,_0x42c86d,_0x43d6e7,_0x32e482,_0x5a68f4,_0x48e8f1);_['merge'](_0x48e8f1,ut['toLowerVariables'](_0x26344d));_0x48e8f1[_0x5c3b('0x138')]=moment()[_0x5c3b('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x5c3b('0x79')](ut['variablesAction'](_0x48e8f1,_0x14ce5d,_0x26344d,_0x48e8f1[_0x5c3b('0xd6')],_0x8d361))['then'](function(_0x13ad02){_0x14ce5d['originated']+=0x1;logger[_0x5c3b('0x5b')](_0x5c3b('0x139'),_0x5a68f4,_0x5c3b('0xb6'),_0x14ce5d[_0x5c3b('0x27')],_0x5c3b('0x72'),_0x14ce5d['originated']);_0x3d85c5(_0x13ad02);})['catch'](function(_0x2b2833){ut['logAgent'](_0x48e8f1,0xe,_0x5c3b('0x13a'));rpcDb[_0x5c3b('0xfb')](_0x48e8f1,_0x5c3b('0x13b'));_0x20daf8(_0x2b2833);});});};Preview[_0x5c3b('0x10')][_0x5c3b('0x1f')]=function(_0x168396){if(this[_0x5c3b('0x6e')][_0x168396['linkedid']]){this[_0x5c3b('0x6e')][_0x168396[_0x5c3b('0xc6')]]['channel']=_0x168396[_0x5c3b('0x7b')];}};Preview[_0x5c3b('0x10')][_0x5c3b('0x19')]=function(_0x5029d7){var _0x4d8885=this;var _0x225072=this[_0x5c3b('0x6e')][_0x5029d7[_0x5c3b('0x13c')]];if(_0x225072){if(_0x225072[_0x5c3b('0x13d')]&&this[_0x5c3b('0x16')][_0x225072[_0x5c3b('0x13d')]]){ut[_0x5c3b('0x13e')](_0x225072,this[_0x5c3b('0x16')][_0x225072['lookAgent']]['name'],this[_0x5c3b('0x16')][_0x225072[_0x5c3b('0x13d')]]['id']);}var _0x3dc516=_[_0x5c3b('0x13f')](_0x225072);_0x3dc516[_0x5c3b('0x140')]=moment()['format'](_0x5c3b('0x92'));var _0x4ff854=_0x4d8885[_0x5c3b('0x14')][_0x225072[_0x5c3b('0x71')]];if(ut['isFailure'](_0x5029d7['response'])){if(_0x225072[_0x5c3b('0xcf')]){rpcDb[_0x5c3b('0x141')](_0x225072['idContact']);}if(_0x225072[_0x5c3b('0xd6')]){rpcDb[_0x5c3b('0x91')](_0x225072[_0x5c3b('0x142')]);}ami['emit']('custom:agentringnoanswer',ut['buildObj'](_0x225072,_0x5c3b('0x143'),this[_0x5c3b('0x14')][_0x225072[_0x5c3b('0x71')]]));this[_0x5c3b('0xf6')](_0x3dc516,_0x4ff854,_0x5029d7);}else{_0x225072[_0x5c3b('0x138')]=moment()[_0x5c3b('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x3dc516,0x4,_0x5c3b('0xbf'));rpcDb[_0x5c3b('0xfb')](_0x3dc516,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x5c3b('0x10')][_0x5c3b('0x144')]=function(_0x167c7c){var _0x494470=this;var _0x12de90=this[_0x5c3b('0x6e')][_0x167c7c[_0x5c3b('0xc6')]];var _0x1ff861;if(_0x12de90){_0x1ff861=this[_0x5c3b('0x14')][_0x12de90[_0x5c3b('0x71')]];logger[_0x5c3b('0x5b')](_0x5c3b('0x145'),_0x167c7c['linkedid'],_0x5c3b('0xb6'),_0x1ff861[_0x5c3b('0x27')],_0x5c3b('0x73'),_0x1ff861[_0x5c3b('0x2b')]);}if(this[_0x5c3b('0x6e')][_0x167c7c['linkedid']]&&_0x167c7c[_0x5c3b('0xc6')]!==_0x167c7c[_0x5c3b('0xb5')]){if(_0x167c7c[_0x5c3b('0x146')]==='16'&&this[_0x5c3b('0x6e')][_0x167c7c[_0x5c3b('0xc6')]][_0x5c3b('0x7e')]){this[_0x5c3b('0xa2')](_0x167c7c,_0x167c7c[_0x5c3b('0xc6')],_0x167c7c[_0x5c3b('0x146')]);}else if(this['actions'][_0x167c7c[_0x5c3b('0xc6')]]['dialAnswer']){logger[_0x5c3b('0x5b')](_0x5c3b('0x147'),_0x167c7c['linkedid'],_0x167c7c[_0x5c3b('0x146')],_0x5c3b('0xb6'),_0x1ff861[_0x5c3b('0x27')],'pTalking:\x20',_0x1ff861['pTalking']);this['callProgressDetectingCustomer'](_0x167c7c,_0x167c7c[_0x5c3b('0xc6')],_0x167c7c[_0x5c3b('0x146')]);}}else if(_0x12de90&&_['isNil'](_0x12de90[_0x5c3b('0x148')])&&_0x1ff861[_0x5c3b('0x149')]&&_0x167c7c[_0x5c3b('0xc6')]===_0x167c7c[_0x5c3b('0xb5')]&&_[_0x5c3b('0x87')](_0x167c7c[_0x5c3b('0xf9')])&&_0x167c7c[_0x5c3b('0x146')]==='16'&&_0x167c7c[_0x5c3b('0x14a')]==='6'&&_['isUndefined'](_0x12de90[_0x5c3b('0x14b')])){if(_0x12de90['unlockAgent']){rpcDb[_0x5c3b('0x141')](_0x12de90[_0x5c3b('0x142')]);}if(_0x12de90['activeContact']){rpcDb[_0x5c3b('0x91')](_0x12de90[_0x5c3b('0x142')]);}_0x167c7c[_0x5c3b('0xf9')]='22';this[_0x5c3b('0xf6')](_0x12de90,_0x1ff861,_0x167c7c);}else if(_0x12de90&&_0x12de90[_0x5c3b('0x14b')]){if(_0x167c7c[_0x5c3b('0x146')]==='16'&&this[_0x5c3b('0x6e')][_0x167c7c[_0x5c3b('0xc6')]][_0x5c3b('0x7e')]){logger[_0x5c3b('0x5b')]('[syncHangup][talking][transfer]',_0x167c7c['linkedid'],_0x167c7c[_0x5c3b('0x146')],_0x5c3b('0xb6'),_0x1ff861['name'],_0x5c3b('0x73'),_0x1ff861[_0x5c3b('0x2b')]);this[_0x5c3b('0xa2')](_0x167c7c,_0x167c7c[_0x5c3b('0xc6')],_0x167c7c[_0x5c3b('0x146')]);}else if(this[_0x5c3b('0x6e')][_0x167c7c[_0x5c3b('0xc6')]][_0x5c3b('0x7e')]){logger[_0x5c3b('0x5b')](_0x5c3b('0x147'),_0x167c7c['linkedid'],_0x167c7c[_0x5c3b('0x146')],_0x5c3b('0xb6'),_0x1ff861[_0x5c3b('0x27')],_0x5c3b('0x73'),_0x1ff861[_0x5c3b('0x2b')]);this['callProgressDetectingCustomer'](_0x167c7c,_0x167c7c[_0x5c3b('0xc6')],_0x167c7c[_0x5c3b('0x146')]);}}};Preview[_0x5c3b('0x10')][_0x5c3b('0x1d')]=function(_0x44ab8e){if(this[_0x5c3b('0x6e')][_0x44ab8e[_0x5c3b('0xf5')]]&&_0x44ab8e[_0x5c3b('0xf5')]!==_0x44ab8e[_0x5c3b('0x14c')]){this[_0x5c3b('0xa2')](_0x44ab8e,_0x44ab8e['destlinkedid'],_0x44ab8e[_0x5c3b('0xec')]);}};Preview['prototype'][_0x5c3b('0x14d')]=function(_0x42b916){if(this[_0x5c3b('0x6e')][_0x42b916[_0x5c3b('0xc6')]]&&_0x42b916['linkedid']!==_0x42b916[_0x5c3b('0xb5')]&&!this[_0x5c3b('0x6e')][_0x42b916[_0x5c3b('0xc6')]][_0x5c3b('0x7e')]){if(_0x42b916[_0x5c3b('0x146')]==='1'){this[_0x5c3b('0xa2')](_0x42b916,_0x42b916[_0x5c3b('0xc6')],_0x42b916[_0x5c3b('0x146')]);}}};Preview[_0x5c3b('0x10')][_0x5c3b('0x14e')]=function(_0x394456,_0x4a9107,_0x1ee8b6){if(this['actions'][_0x394456]){if(_[_0x5c3b('0x87')](this[_0x5c3b('0x6e')][_0x394456][_0x5c3b('0x14f')])){this[_0x5c3b('0x6e')][_0x394456]['variables']={};}this['actions'][_0x394456][_0x5c3b('0x14f')][_0x4a9107]=_0x1ee8b6;}};Preview['prototype'][_0x5c3b('0x20')]=function(_0x1c3413){try{if(!_[_0x5c3b('0x87')](_0x1c3413)){if(ut['filterKey'](_[_0x5c3b('0x150')](_0x1c3413[_0x5c3b('0x151')])[0x0])){this['addVariable'](_0x1c3413[_0x5c3b('0xb5')],_[_0x5c3b('0x150')](_0x1c3413[_0x5c3b('0x151')])[0x0],_0x1c3413[_0x5c3b('0x152')]);}}}catch(_0x4d091d){logger[_0x5c3b('0x153')](_0x5c3b('0x154'),util[_0x5c3b('0x155')](_0x4d091d,{'showHidden':![],'depth':null}));}};Preview[_0x5c3b('0x10')][_0x5c3b('0x21')]=function(_0x51b642){if(_0x51b642){if(this[_0x5c3b('0x6e')][_0x51b642[_0x5c3b('0x156')]]){this['actions'][_0x51b642[_0x5c3b('0x156')]][_0x5c3b('0x14b')]=!![];}}};Preview['prototype'][_0x5c3b('0x23')]=function(_0x17ba18){if(_0x17ba18){if(this[_0x5c3b('0x6e')][_0x17ba18[_0x5c3b('0x157')]]){this[_0x5c3b('0x6e')][_0x17ba18[_0x5c3b('0x157')]]['transfer']=!![];}}};module[_0x5c3b('0x158')]=Preview; \ No newline at end of file +var _0x8958=['Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countglobal','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','activeContact','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','phone','trim','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridnum','extractCalleridNumber','addVariables','variablesAction','[originated][increment]','OriginateError','syncOriginateResponse','actionid','logLookAgent','responsetime','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfererlinkedid','exports','lodash','ioredis','../../../config/logger','preview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','hasOwnProperty','dialMethod','booked','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','actions','queue','pick','UserId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','complete','buildObj','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry'];(function(_0x20311e,_0x8dbfe0){var _0x16281b=function(_0x230cfc){while(--_0x230cfc){_0x20311e['push'](_0x20311e['shift']());}};_0x16281b(++_0x8dbfe0);}(_0x8958,0x93));var _0x8895=function(_0x11e7c1,_0x56077c){_0x11e7c1=_0x11e7c1-0x0;var _0x4e4b69=_0x8958[_0x11e7c1];return _0x4e4b69;};'use strict';var util=require('util');var _=require(_0x8895('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require('md5');var Redis=require(_0x8895('0x1'));var config=require('../../../config/environment');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var loggerAction=require(_0x8895('0x2'))('actionPreview');var ami=require(_0x8895('0x4'));var rpcDb=require(_0x8895('0x5'));var Action=require(_0x8895('0x6'));var ut=require(_0x8895('0x7'));config[_0x8895('0x8')]=_['defaults'](config[_0x8895('0x8')],{'host':_0x8895('0x9'),'port':0x18eb});var io=require(_0x8895('0xa'))(new Redis(config[_0x8895('0x8')]));var Sequence=function(){};Sequence[_0x8895('0xb')][_0x8895('0xc')]=function(_0x22a12b){this[_0x8895('0xd')]=this[_0x8895('0xd')]?this[_0x8895('0xd')]['finally'](_0x22a12b):_0x22a12b();};function Preview(_0x1cf600){this[_0x8895('0xe')]=new Sequence();this[_0x8895('0xf')]=_0x1cf600[_0x8895('0x10')];this[_0x8895('0x11')]=_0x1cf600[_0x8895('0x11')];this['actions']={};this[_0x8895('0x12')]=_0x1cf600[_0x8895('0x12')];this[_0x8895('0x13')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x8895('0x14')](this));ami['on']('hangup',this[_0x8895('0x15')][_0x8895('0x14')](this));ami['on'](_0x8895('0x16'),this[_0x8895('0x17')][_0x8895('0x14')](this));ami['on']('dialend',this[_0x8895('0x18')][_0x8895('0x14')](this));ami['on'](_0x8895('0x19'),this[_0x8895('0x1a')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1b'),this[_0x8895('0x1c')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1d'),this[_0x8895('0x1e')][_0x8895('0x14')](this));ami['on'](_0x8895('0x1f'),this[_0x8895('0x20')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x3daf43,_0x456282,_0x2d189c){io['to'](_0x3daf43)[_0x8895('0x21')](_0x456282,_0x2d189c);}function emitCampaignPreview(_0x3f7d5a){if(_0x3f7d5a[_0x8895('0x22')]===_0x8895('0x23')){var _0xc1ce17={'id':_0x3f7d5a['id'],'name':_0x3f7d5a['name'],'strategy':_0x3f7d5a[_0x8895('0x24')],'answered':_0x3f7d5a[_0x8895('0x25')],'available':_0x3f7d5a[_0x8895('0x26')],'loggedIn':_0x3f7d5a[_0x8895('0x27')],'pTalking':_0x3f7d5a[_0x8895('0x28')],'sumBillable':_0x3f7d5a['sumBillable'],'sumDuration':_0x3f7d5a['sumDuration'],'sumHoldTime':_0x3f7d5a[_0x8895('0x29')]||0x0,'talking':_0x3f7d5a[_0x8895('0x2a')],'total':_0x3f7d5a[_0x8895('0x2b')],'type':_0x3f7d5a[_0x8895('0x22')],'unmanaged':_0x3f7d5a['unmanaged'],'abandoned':_0x3f7d5a[_0x8895('0x2c')],'waiting':_0x3f7d5a[_0x8895('0x2d')],'loggedInDb':_0x3f7d5a[_0x8895('0x2e')],'dialActive':_0x3f7d5a['dialActive'],'dialMethod':_0x3f7d5a['dialMethod'],'dialOriginateCallerIdName':_0x3f7d5a[_0x8895('0x2f')],'dialOriginateCallerIdNumber':_0x3f7d5a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3f7d5a[_0x8895('0x30')],'dialPrefix':_0x3f7d5a[_0x8895('0x31')],'outboundAnswerAgiCallsDay':_0x3f7d5a[_0x8895('0x32')],'outboundAnswerCallsDay':_0x3f7d5a[_0x8895('0x33')],'outboundBlacklistCallsDay':_0x3f7d5a[_0x8895('0x34')],'outboundBusyCallsDay':_0x3f7d5a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3f7d5a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3f7d5a[_0x8895('0x35')],'outboundDropCallsDayCallersExit':_0x3f7d5a[_0x8895('0x36')],'outboundDropCallsDayTimeout':_0x3f7d5a[_0x8895('0x37')],'outboundNoAnswerCallsDay':_0x3f7d5a[_0x8895('0x38')],'outboundNoSuchCallsDay':_0x3f7d5a[_0x8895('0x39')],'outboundOriginateFailureCallsDay':_0x3f7d5a['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f7d5a['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f7d5a[_0x8895('0x3a')],'outboundUnknownCallsDay':_0x3f7d5a[_0x8895('0x3b')],'outboundAbandonedCallsDay':_0x3f7d5a[_0x8895('0x3c')],'predictiveIntervalAnsweredCalls':_0x3f7d5a[_0x8895('0x3d')],'predictiveIntervalAvgHoldtime':_0x3f7d5a[_0x8895('0x3e')],'predictiveIntervalAvgTalktime':_0x3f7d5a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f7d5a[_0x8895('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x3f7d5a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f7d5a[_0x8895('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f7d5a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f7d5a[_0x8895('0x41')],'predictiveIntervalMultiplicativeFactor':_0x3f7d5a[_0x8895('0x42')],'predictiveIntervalPauses':_0x3f7d5a[_0x8895('0x43')],'predictiveIntervalAvailable':_0x3f7d5a[_0x8895('0x44')],'predictiveIntervalTotalCalls':_0x3f7d5a[_0x8895('0x45')],'message':_0x3f7d5a['message'],'originated':_0x3f7d5a[_0x8895('0x46')],'erlangCalls':_0x3f7d5a[_0x8895('0x47')],'erlangCallToSecond':_0x3f7d5a[_0x8895('0x48')],'erlangAbandonmentRate':_0x3f7d5a[_0x8895('0x49')],'erlangBusyFactor':_0x3f7d5a[_0x8895('0x4a')],'startPredictive':_0x3f7d5a['startPredictive'],'startProgressive':_0x3f7d5a[_0x8895('0x4b')]};if(_0x3f7d5a['Trunk']){_0xc1ce17[_0x8895('0x4c')]={'id':_0x3f7d5a['Trunk']['id'],'name':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4d')],'active':_0x3f7d5a[_0x8895('0x4c')][_0x8895('0x4e')],'callerid':_0x3f7d5a[_0x8895('0x4c')]['callerid']};}if(_0x3f7d5a[_0x8895('0x4f')]){_0xc1ce17['Interval']={'id':_0x3f7d5a[_0x8895('0x4f')]['id'],'name':_0x3f7d5a[_0x8895('0x4f')][_0x8895('0x4d')]};}var _0x9297ea=md5(JSON[_0x8895('0x50')](_0xc1ce17));if(_0x3f7d5a[_0x8895('0x51')]!==_0x9297ea){_0x3f7d5a['md5']=_0x9297ea;emit(util[_0x8895('0x52')](_0x8895('0x53'),_0xc1ce17['name']),_0x8895('0x54'),_0xc1ce17);}}}function emitVoiceQueueChannelRemove(_0x54ca09){logger[_0x8895('0x55')](_0x8895('0x56'),JSON['stringify'](_0x54ca09));emit(util[_0x8895('0x52')](_0x8895('0x53'),_0x54ca09['name']),'voice_queue_channel:remove',_0x54ca09);io[_0x8895('0x21')](_0x8895('0x57'),_0x54ca09);}function notSendMessagesQueue(_0x55aacc){if(_0x55aacc[_0x8895('0x58')]){if(_0x55aacc[_0x8895('0x46')]===0x0&&_0x55aacc['pTalking']===0x0){_0x55aacc[_0x8895('0x58')]=![];_0x55aacc[_0x8895('0x26')]=0x0;_0x55aacc[_0x8895('0x59')]=0x0;_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5b');ut[_0x8895('0x5c')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x55aacc[_0x8895('0x4d')]+'\x20is\x20not\x20active');}else{_0x55aacc[_0x8895('0x5a')]=_0x8895('0x5d');ut['logger'](_0x8895('0x5e'),_0x55aacc['name']+_0x8895('0x5f'));}emitCampaignPreview(_0x55aacc);}}Preview['prototype']['loopCampaigns']=function(){var _0x51277b=this;setInterval(function(){_0x51277b['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x447ed6=this[_0x8895('0xf')];this['clockClearZombieChannels']+=0x1;for(var _0x4835d7 in _0x447ed6){if(_0x447ed6[_0x8895('0x60')](_0x4835d7)&&(_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'||_0x447ed6[_0x4835d7][_0x8895('0x61')]===_0x8895('0x62'))&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(this[_0x8895('0x13')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x447ed6['hasOwnProperty'](_0x4835d7)&&_0x447ed6[_0x4835d7][_0x8895('0x61')]==='preview'&&_0x447ed6[_0x4835d7][_0x8895('0x22')]===_0x8895('0x23')){if(_0x447ed6[_0x4835d7][_0x8895('0x63')]){this[_0x8895('0x64')](_0x447ed6[_0x4835d7]);if(_0x447ed6[_0x4835d7]['dialPreviewAutoRecallMe'])this[_0x8895('0x65')](_0x447ed6[_0x4835d7]);}else{notSendMessagesQueue(_0x447ed6[_0x4835d7]);}}}};Preview[_0x8895('0xb')][_0x8895('0x66')]=function(_0x167302){var _0x2d585c=this;this[_0x8895('0xe')][_0x8895('0xc')](function(){if(!_[_0x8895('0x67')](_0x2d585c['actions'][_0x167302])){loggerAction[_0x8895('0x55')](_0x8895('0x68'),_0x167302,'Queue',_0x2d585c[_0x8895('0x69')][_0x167302]['queue'],'originated:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302]['queue']][_0x8895('0x46')]),'pTalking:\x20',JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]][_0x8895('0x28')]),JSON[_0x8895('0x50')](_0x2d585c[_0x8895('0x69')][_0x167302]['dialAnswer']),JSON['stringify'](_[_0x8895('0x6b')](_0x2d585c[_0x8895('0x69')][_0x167302],['contactId',_0x8895('0x6c'),'VoiceQueueId','ListId'])));return ami[_0x8895('0x6d')]({'action':'status','channel':_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6e')]})[_0x8895('0x6f')](function(_0x459e1a){if(_0x459e1a[_0x8895('0x5a')]===_0x8895('0x70')){setTimeout(function(){if(_0x2d585c[_0x8895('0x69')][_0x167302]){ut[_0x8895('0x71')](_0x2d585c['campaignsPreview'][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));if(_0x2d585c['actions'][_0x167302][_0x8895('0x73')]===!![]){ut[_0x8895('0x74')](_0x2d585c[_0x8895('0xf')][_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]],_0x8895('0x72'));ut[_0x8895('0x75')](_0x8895('0x76')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);}ut['loggerError'](_0x8895('0x77')+_0x167302,_0x2d585c[_0x8895('0x69')][_0x167302][_0x8895('0x6a')]);delete _0x2d585c[_0x8895('0x69')][_0x167302];}},0x2328);}});}});};Preview[_0x8895('0xb')]['clearZombieChannels']=function(){var _0x1b3c99=this;loggerAction[_0x8895('0x55')](_0x8895('0x78'),_[_0x8895('0x79')](this[_0x8895('0x69')]));for(var _0x58dd6c in this[_0x8895('0x69')]){if(_0x1b3c99[_0x8895('0x69')][_0x8895('0x60')](_0x58dd6c)){_0x1b3c99['clearZombieChannel'](_0x58dd6c);}}};Preview[_0x8895('0xb')][_0x8895('0x65')]=function(_0x2c777b){var _0x4ec8eb=this;rpcDb[_0x8895('0x7a')](_0x2c777b['id'],ut[_0x8895('0x7b')](this['agents']))[_0x8895('0x7c')](function(_0x26f68c){if(!_['isNil'](_0x26f68c)){for(var _0x2f990a=0x0;_0x2f990a<_0x26f68c[_0x8895('0x7d')];_0x2f990a+=0x1){if(ut[_0x8895('0x7e')](_0x26f68c[_0x2f990a][_0x8895('0x7f')])<_0x2c777b['dialRecallMeTimeout']*0x3c){if(_0x26f68c[_0x2f990a]['Agent']&&!_0x26f68c[_0x2f990a][_0x8895('0x80')][_0x8895('0x81')]){_0x4ec8eb[_0x8895('0x82')](_0x26f68c[_0x2f990a]['id'])['then'](ut[_0x8895('0x83')](_0x8895('0x84')))['catch'](ut[_0x8895('0x83')]('[RecallMe]'));}else{rpcDb[_0x8895('0x85')](_0x26f68c[_0x2f990a]['id']);}}else{var _0x2bd955=new Action(_0x26f68c[_0x2f990a],_0x2c777b);_0x2bd955[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));_0x2c777b['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x2bd955,0x17,_0x8895('0x88'));if(_0x2c777b[_0x8895('0x89')]){rpcDb['rescheduleContactInQueue'](ut[_0x8895('0x8a')](_0x26f68c[_0x2f990a]));rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8c'));}else{ut[_0x8895('0x8d')](_0x2bd955,0x16,'RecallFailedTimeout');rpcDb[_0x8895('0x8b')](_0x2bd955,_0x8895('0x8e'));rpcDb[_0x8895('0x8f')](_0x2bd955,_0x8895('0x8e'));}}}}})[_0x8895('0x6f')](ut[_0x8895('0x83')](_0x8895('0x90')));};Preview[_0x8895('0xb')][_0x8895('0x64')]=function(_0x21c7bb){_0x21c7bb[_0x8895('0x58')]=!![];if(ut[_0x8895('0x91')](_0x21c7bb[_0x8895('0x27')])){_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x92');}else if(!ut['isActive'](_0x21c7bb['dialActive'])){_0x21c7bb['message']=_0x8895('0x5b');}else if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x4c')])){if(!this[_0x8895('0x93')](_0x21c7bb[_0x8895('0x94')])){_0x21c7bb['message']=_0x8895('0x95');}else{_0x21c7bb[_0x8895('0x5a')]='ACTIVE';}}else{_0x21c7bb[_0x8895('0x5a')]=_0x8895('0x96');}emitCampaignPreview(_0x21c7bb);};Preview[_0x8895('0xb')][_0x8895('0x97')]=function(_0x3ee89e,_0x526ac9,_0x6440ea){var _0x3c318c=this;var _0x119624=this[_0x8895('0x69')][_0x526ac9];var _0x113ac4=this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]];var _0x5e7048;if(_0x113ac4){switch(_0x6440ea){case'1':_0x113ac4[_0x8895('0x39')]+=0x1;_0x119624[_0x8895('0x98')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x0,_0x8895('0x9a'));ami[_0x8895('0x21')](_0x8895('0x9b'),ut['buildObj'](_0x119624,_0x8895('0x9c')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0x9d'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xa0'));}else{if(_0x119624['countnosuchnumberretry']>=_0x113ac4[_0x8895('0xa1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0x98'),_0x113ac4['dialNoSuchNumberRetryFrequency']),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xa6'):var _0x42d342=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x119624['responsetime']=_0x42d342;_0x119624[_0x8895('0xa7')]=_0x42d342;_0x119624['dialAnswer']=!![];_0x113ac4[_0x8895('0x28')]+=0x1;logger[_0x8895('0x55')]('[syncHangup][talking][increment]',_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xaa'),_0x113ac4[_0x8895('0x28')]);ami['emit'](_0x8895('0xab'),ut['buildObj'](_0x119624,'connect',this[_0x8895('0xf')][_0x119624['queue']]));if(_0x113ac4[_0x8895('0xac')]){ami[_0x8895('0x21')](_0x8895('0xad'),ut[_0x8895('0xae')](_0x119624));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x119624,_0x8895('0xaf'),this[_0x8895('0xf')][_0x119624[_0x8895('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0x8895('0xb0')](_0x119624,_0x8895('0xaf')));_0x113ac4[_0x8895('0x33')]+=0x1;_0x113ac4['total']+=0x1;_0x113ac4[_0x8895('0x25')]+=0x1;ut[_0x8895('0x74')](_0x113ac4,_0x8895('0xb1'));_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x4,_0x8895('0xb2'));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xb3'));rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8895('0xb4')](_0x119624);_0x113ac4[_0x8895('0xb5')]+=_0x119624['talktime'];_0x113ac4[_0x8895('0xb6')]+=_0x119624[_0x8895('0xb7')];logger[_0x8895('0x55')](_0x8895('0xb8'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],'pTalking:\x20',_0x113ac4[_0x8895('0x28')]);delete this['actions'][_0x3ee89e[_0x8895('0xa5')]];break;case _0x8895('0xb9'):_0x113ac4[_0x8895('0xba')]+=0x1;_0x119624[_0x8895('0xbb')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x5,_0x8895('0xbc'));ami[_0x8895('0x21')](_0x8895('0xbd'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xbe')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xc0'));}else{if(_0x119624[_0x8895('0xbb')]>=_0x113ac4[_0x8895('0xc1')]){rpcDb['createCustomerFinal'](_0x119624,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xbb'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624['activeContact']);}}break;case _0x8895('0xc3'):_0x113ac4[_0x8895('0x38')]+=0x1;_0x119624['countnoanswerretry']+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x3,_0x8895('0xc5'));ami[_0x8895('0x21')](_0x8895('0xc6'),ut['buildObj'](_0x119624,_0x8895('0xc7')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xc8'));}else{if(_0x119624['countnoanswerretry']>=_0x113ac4['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xc9'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xca'),_0x113ac4[_0x8895('0xcb')]),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xcd'):_0x113ac4[_0x8895('0xce')]+=0x1;_0x119624['countcongestionretry']+=0x1;_0x119624['countglobal']=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x8,_0x8895('0xcf'));ami[_0x8895('0x21')](_0x8895('0xd0'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xd1')));rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xd2'));}else{if(_0x119624[_0x8895('0xd3')]>=_0x113ac4[_0x8895('0xd4')]){rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xd5'));}else{rpcDb[_0x8895('0xa2')](ut['scheduledAt'](_0x119624,_0x8895('0xd3'),_0x113ac4[_0x8895('0xc2')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case _0x8895('0xd6'):_0x113ac4['outboundRejectCallsDay']+=0x1;_0x119624[_0x8895('0xd7')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x14,_0x8895('0xd8'));ami[_0x8895('0x21')](_0x8895('0xd9'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xda')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xdb'));if(ut['totalGlobal'](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0x14,_0x8895('0xd8'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xdc'));}else{if(_0x119624['countagentrejectretry']>=_0x113ac4[_0x8895('0xdd')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xdc'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,_0x8895('0xd7'),_0x113ac4['dialAgentRejectRetryFrequency']),_0x119624['unlockAgent'],_0x119624[_0x8895('0xcc')]);}}break;case'ABANDONED':_0x113ac4['outboundAbandonedCallsDay']+=0x1;_0x119624[_0x8895('0xde')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xb,_0x8895('0xdf'));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xe0'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,_0x8895('0x9f'));rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xe0'));}else{if(_0x119624[_0x8895('0xe1')]>=_0x113ac4[_0x8895('0xe2')]){rpcDb['createCustomerFinal'](_0x119624,_0x8895('0xe0'));}else{rpcDb[_0x8895('0xa2')](ut[_0x8895('0xa3')](_0x119624,'countabandonedretry',_0x113ac4[_0x8895('0xe3')]),_0x119624[_0x8895('0xa4')],_0x119624[_0x8895('0xcc')]);}}break;case'18':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624[_0x8895('0xe4')]+=0x1;_0x119624[_0x8895('0xc4')]=ut[_0x8895('0x99')](_0x119624);ut['logCustomer'](_0x119624,0x12,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb['createCustomerHistory'](_0x119624,_0x8895('0xe9'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4['dialGlobalMaxRetry']){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xe9'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;case'19':_0x113ac4[_0x8895('0x3b')]+=0x1;_0x119624['countglobal']=ut[_0x8895('0x99')](_0x119624);ut[_0x8895('0x8d')](_0x119624,0x13,_0x3ee89e[_0x8895('0xe5')]||_0x3ee89e[_0x8895('0xe6')]);ami[_0x8895('0x21')](_0x8895('0xe7'),ut[_0x8895('0xb0')](_0x119624,_0x8895('0xe8')));rpcDb[_0x8895('0x8b')](_0x119624,_0x8895('0xea'));if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut['cloneAction'](_0x119624,0xf,_0x8895('0x9f'));rpcDb[_0x8895('0x8f')](_0x5e7048,_0x8895('0xea'));}else{rpcDb[_0x8895('0x8f')](_0x119624,'[callProgressDetectingCustomer][machine]');}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];break;default:if(_0x119624['dialAnswer']){ut['decrementTalkink'](_0x113ac4,_0x8895('0xeb'));ut['loggerError'](_0x8895('0xec')+_0x113ac4['name'],_0x3ee89e);}_0x113ac4['outboundUnknownCallsDay']+=0x1;_0x119624[_0x8895('0xc4')]=ut['totalGlobal'](_0x119624);ut[_0x8895('0x8d')](_0x119624,0xc,_0x3ee89e['cause-txt']||_0x3ee89e[_0x8895('0xe6')]);rpcDb[_0x8895('0x8b')](_0x119624,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x8895('0x99')](_0x119624)>=_0x113ac4[_0x8895('0xbf')]){_0x5e7048=ut[_0x8895('0x9e')](_0x119624,0xf,'Global');rpcDb['createCustomerFinal'](_0x5e7048,_0x8895('0xed'));}else{rpcDb[_0x8895('0x8f')](_0x119624,_0x8895('0xed'));}delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];}if(!(_0x119624[_0x8895('0x73')]&&_0x6440ea==='16')){ut[_0x8895('0x71')](_0x113ac4,_0x8895('0xee'));logger[_0x8895('0x55')](_0x8895('0xef'),_0x119624[_0x8895('0xa8')],_0x8895('0xa9'),_0x113ac4[_0x8895('0x4d')],_0x8895('0xf0'),_0x113ac4['originated']);}if(_0x6440ea!==_0x8895('0xa6')){delete this[_0x8895('0x69')][_0x3ee89e[_0x8895('0xa5')]];delete this[_0x8895('0x69')][_0x3ee89e['destlinkedid']];}}};Preview[_0x8895('0xb')][_0x8895('0xf1')]=function(_0xf3b3e5,_0x20752d,_0x124e1b){if(_[_0x8895('0xf2')](_0x20752d)&&_0x8895('0xf3')!==typeof _0x20752d){return;}if(_[_0x8895('0xf2')](_0x124e1b)&&_0x8895('0xf3')!==typeof _0x124e1b){return;}switch(_0x124e1b[_0x8895('0xf4')]){case'0':ut[_0x8895('0xf5')](_0xf3b3e5,0x0,_0x8895('0x9a'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf7'));break;case'3':ut[_0x8895('0xf5')](_0xf3b3e5,0x3,_0x8895('0xc5'));rpcDb['createAgentHistory'](_0xf3b3e5,_0x8895('0xf8'));break;case'5':ut['logAgent'](_0xf3b3e5,0x5,_0x8895('0xbc'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xf9'));break;case'8':ut['logAgent'](_0xf3b3e5,0x8,_0x8895('0xcf'));rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8895('0xf5')](_0xf3b3e5,0x16,'AnswerAGI');rpcDb[_0x8895('0xf6')](_0xf3b3e5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xf3b3e5,0xc,_0x124e1b[_0x8895('0xf4')]);rpcDb[_0x8895('0xf6')](_0xf3b3e5,_0x8895('0xfa'));}ut[_0x8895('0x71')](_0x20752d,_0x8895('0xfb'));logger['info'](_0x8895('0xfc'),_0xf3b3e5['uniqueid'],'\x20Queue',_0x20752d[_0x8895('0x4d')],_0x8895('0xf0'),_0x20752d['originated']);delete this[_0x8895('0x69')][_0xf3b3e5[_0x8895('0xa8')]];};Preview[_0x8895('0xb')]['checkInBlack']=function(_0x3816b4,_0x431b18,_0x114200,_0x54e1b5,_0x465c2b){var _0x34a3c9=this;return new BPromise(function(_0x87bfe4,_0x3a1882){if(_[_0x8895('0x67')](_0x431b18)||_[_0x8895('0x67')](_0x431b18[_0x8895('0xfd')])||_[_0x8895('0x67')](_0x431b18['Contact']['phone'])||_[_0x8895('0x67')](_0x431b18['VoiceQueueId'])){_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0xfe'),_0x54e1b5,_0x465c2b));return;}var _0x270a6e=uuid['v4']();var _0x21d14b=_0x34a3c9[_0x8895('0xf')][_0x431b18[_0x8895('0xff')][_0x8895('0x4d')]];var _0x44951a=_0x114200?_0x34a3c9[_0x8895('0x12')][_0x114200]['id']:undefined;_0x34a3c9[_0x8895('0x69')][_0x270a6e]=new Action(_0x431b18,_0x21d14b,_0x270a6e,_0x114200,_0x44951a);var _0x119bf3=_0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x119bf3['unlockAgent']=_0x54e1b5;_0x119bf3[_0x8895('0xcc')]=_0x465c2b;_0x119bf3[_0x8895('0x100')]=_0x114200;if(_[_0x8895('0x101')](_0x3816b4)){_0x34a3c9[_0x8895('0x102')](_0x119bf3,_0x21d14b,_0x431b18,_0x114200)[_0x8895('0x7c')](function(_0x3c68a9){logger[_0x8895('0x55')](_0x8895('0x103'),_0x8895('0x104')+_0x119bf3[_0x8895('0x6a')]+_0x8895('0x105')+_0x119bf3[_0x8895('0x106')],JSON[_0x8895('0x50')](_0x3c68a9));ami[_0x8895('0x21')]('custom:agentcalled',ut[_0x8895('0xb0')](_0x119bf3,'called',_0x34a3c9['campaignsPreview'][_0x119bf3['queue']]));_0x87bfe4(ut[_0x8895('0x5a')](_0x8895('0x107')));})[_0x8895('0x6f')](function(_0x560732){ut[_0x8895('0x5c')](_0x8895('0x108'),_0x560732);_0x3a1882(ut[_0x8895('0x5a')]('Call\x20failed',_0x54e1b5,_0x465c2b));});}else{_0x21d14b[_0x8895('0x34')]+=0x1;ut[_0x8895('0x109')](_0x119bf3);rpcDb[_0x8895('0x10a')](_0x119bf3,'[Blacklist][error]');delete _0x34a3c9[_0x8895('0x69')][_0x270a6e];_0x3a1882(ut[_0x8895('0x5a')](_0x8895('0x10b'),_0x54e1b5,_0x465c2b));}});};Preview[_0x8895('0xb')][_0x8895('0x93')]=function(_0x3273c1){return!_['isNil'](_0x3273c1)&&!_[_0x8895('0x67')](_0x3273c1[_0x8895('0x4d')])&&!_['isNil'](_0x3273c1[_0x8895('0x4e')])&&_0x3273c1[_0x8895('0x4e')]&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])])&&!_[_0x8895('0x67')](this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1['name'])]['status'])&&(this[_0x8895('0x11')][util[_0x8895('0x52')](_0x8895('0x10c'),_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10e')||this[_0x8895('0x11')][util['format']('SIP/%s',_0x3273c1[_0x8895('0x4d')])][_0x8895('0x10d')]===_0x8895('0x10f'));};Preview[_0x8895('0xb')][_0x8895('0x82')]=function(_0x3b465c,_0x28aeb9){var _0x2ff7e6=this;return new BPromise(function(_0x1be275,_0x8f1f00){_0x2ff7e6['execRun'](_0x3b465c,_0x28aeb9)[_0x8895('0x7c')](function(_0x5033d6){_0x1be275(_[_0x8895('0x6b')](_0x5033d6,[_0x8895('0x5a')]));})[_0x8895('0x6f')](function(_0x5e109c){if(_0x5e109c['unlock']){rpcDb['unlockContact'](_0x3b465c);}if(_0x5e109c[_0x8895('0x4e')]){rpcDb['disableContact'](_0x3b465c);}_0x8f1f00(_[_0x8895('0x6b')](_0x5e109c,[_0x8895('0x5a')]));});});};Preview[_0x8895('0xb')]['execRun']=function(_0x3ccf2a,_0x3a348d){var _0x50136b=this;return new BPromise(function(_0x2bd804,_0x564234){var _0x9ce4f5,_0xa87a01;rpcDb[_0x8895('0x110')](_0x3ccf2a)[_0x8895('0x7c')](function(_0x1d5fd7){if(!_['isNil'](_0x1d5fd7[0x0])){_0xa87a01=_0x1d5fd7[0x0]['recallme']?![]:!![];_0x9ce4f5=_0x1d5fd7[0x0][_0x8895('0x111')]?!![]:![];_0x9ce4f5=_0x3a348d?!![]:_0x9ce4f5;}var _0x41d7f9=_0x50136b[_0x8895('0x112')](_0x1d5fd7);if(_0x41d7f9[_0x8895('0x113')]){rpcDb[_0x8895('0x114')](_[_0x8895('0x6b')](_0x1d5fd7[0x0],['VoiceQueueId','Contact.phone']))[_0x8895('0x7c')](function(_0x3a6226){_0x50136b[_0x8895('0x115')](_0x3a6226,_0x1d5fd7[0x0],_0x3a348d,_0xa87a01,_0x9ce4f5)[_0x8895('0x7c')](function(_0x448496){_0x2bd804(_0x448496);})['catch'](function(_0x50baed){_0x564234(_0x50baed);});})[_0x8895('0x6f')](function(_0x4f0a55){ut['logger'](_0x8895('0x116'),_0x4f0a55);_0x564234(ut[_0x8895('0x5a')]('Call\x20unsuccessful',_0xa87a01,_0x9ce4f5));});}else{_0x564234(ut[_0x8895('0x5a')](_0x41d7f9['message'],_0xa87a01,_0x9ce4f5));}})[_0x8895('0x6f')](function(_0x242a19){ut[_0x8895('0x5c')](_0x8895('0x117'),_0x242a19);_0x564234(ut[_0x8895('0x5a')](_0x8895('0x118'),![],!![]));});});};Preview['prototype'][_0x8895('0x112')]=function(_0x3ecc83){if(_[_0x8895('0x67')](_0x3ecc83)||_[_0x8895('0x101')](_0x3ecc83)||!_[_0x8895('0x67')](_0x3ecc83[0x0][_0x8895('0x80')])&&_['isNil'](_0x3ecc83[0x0][_0x8895('0x80')][_0x8895('0x4d')])){ut[_0x8895('0x5c')](_0x8895('0x119'),_0x3ecc83);return{'isValid':![],'message':_0x8895('0x11a')};}var _0x57230f=this['campaignsPreview'][_0x3ecc83[0x0]['Queue'][_0x8895('0x4d')]];_0x57230f[_0x8895('0x5a')]=_0x8895('0x96');if(_['isNil'](_0x57230f)){ut['logger'](_0x8895('0x11b'),_0x57230f);return{'isValid':![],'message':_0x8895('0x11c')};}if(!this[_0x8895('0x93')](_0x57230f[_0x8895('0x4c')])){ut[_0x8895('0x5c')](_0x8895('0x11d'),'campaign\x20Name:\x20'+_0x57230f['name']+_0x8895('0x11e'));if(!this[_0x8895('0x93')](_0x57230f['TrunkBackup'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x57230f['name']+_0x8895('0x11f'));return{'isValid':![],'message':_0x8895('0x120')};}}if(!ut[_0x8895('0x121')](_0x57230f['dialActive'])){ut[_0x8895('0x5c')]('[Preview][validateContact][Campaign\x20Active]',_0x57230f[_0x8895('0x4d')]+_0x8895('0x122'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57230f[_0x8895('0x4d')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8895('0x123')};};Preview[_0x8895('0xb')][_0x8895('0x102')]=function(_0x20f05c,_0x5eca7f,_0x4036ab,_0x4bf06a){var _0x2f2490=this;return new BPromise(function(_0x28506a,_0x30baea){var _0x2ecc8b=_0x20f05c[_0x8895('0xa8')];var _0x1f5eb7=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?util[_0x8895('0x52')](_0x8895('0x124'),_0x5eca7f[_0x8895('0x4c')]['name'],_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')]['trim']()||'',_0x5eca7f[_0x8895('0x125')]>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab[_0x8895('0xfd')][_0x8895('0x127')]):util[_0x8895('0x52')](_0x8895('0x124'),_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')]['name']:_0x5eca7f['TrunkBackup'][_0x8895('0x4d')],_['isNil'](_0x5eca7f[_0x8895('0x31')])?'':_0x5eca7f[_0x8895('0x31')][_0x8895('0x128')]()||'',_0x5eca7f['dialCutDigit']>0x0?_0x4036ab[_0x8895('0xfd')]['phone'][_0x8895('0x126')](_0x5eca7f[_0x8895('0x125')]):_0x4036ab['Contact'][_0x8895('0x127')]);var _0x30e5a2=_0x2f2490[_0x8895('0x93')](_0x5eca7f[_0x8895('0x4c')])?ut[_0x8895('0x129')](_0x5eca7f['Trunk'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f['dialRandomLastDigitCallerIdNumber']):_0x5eca7f[_0x8895('0x12b')]):ut[_0x8895('0x129')](_[_0x8895('0x67')](_0x5eca7f[_0x8895('0x94')])?_0x5eca7f[_0x8895('0x4c')][_0x8895('0x12a')]:_0x5eca7f['TrunkBackup'][_0x8895('0x12a')],_0x5eca7f[_0x8895('0x2f')],_0x5eca7f[_0x8895('0x12c')]>0x0?ut[_0x8895('0x12d')](_0x5eca7f[_0x8895('0x12b')],_0x5eca7f[_0x8895('0x12c')]):_0x5eca7f[_0x8895('0x12b')]);if(_0x30e5a2){_0x20f05c['originatecalleridname']=ut['extractCalleridName'](_0x30e5a2);_0x20f05c[_0x8895('0x12e')]=ut[_0x8895('0x12f')](_0x30e5a2);}var _0x43523c=ut[_0x8895('0x130')](_0x5eca7f,_0x4036ab,_0x1f5eb7,_0x30e5a2,_0x2ecc8b,_0x20f05c);_['merge'](_0x20f05c,ut['toLowerVariables'](_0x43523c));_0x20f05c[_0x8895('0x86')]=moment()[_0x8895('0x52')](_0x8895('0x87'));ami[_0x8895('0x6d')](ut[_0x8895('0x131')](_0x20f05c,_0x5eca7f,_0x43523c,_0x20f05c[_0x8895('0xcc')],_0x4bf06a))['then'](function(_0x4c4148){_0x5eca7f[_0x8895('0x46')]+=0x1;logger[_0x8895('0x55')](_0x8895('0x132'),_0x2ecc8b,_0x8895('0xa9'),_0x5eca7f[_0x8895('0x4d')],_0x8895('0xf0'),_0x5eca7f[_0x8895('0x46')]);_0x28506a(_0x4c4148);})[_0x8895('0x6f')](function(_0x18a523){ut['logAgent'](_0x20f05c,0xe,_0x8895('0x133'));rpcDb[_0x8895('0xf6')](_0x20f05c,'[originateFailure][logOriginateFailure]');_0x30baea(_0x18a523);});});};Preview[_0x8895('0xb')][_0x8895('0x1a')]=function(_0x3ff7fa){if(this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]]){this[_0x8895('0x69')][_0x3ff7fa[_0x8895('0xa5')]][_0x8895('0x6e')]=_0x3ff7fa['channel'];}};Preview['prototype'][_0x8895('0x134')]=function(_0xc93e09){var _0x398041=this;var _0xc35be9=this[_0x8895('0x69')][_0xc93e09[_0x8895('0x135')]];if(_0xc35be9){if(_0xc35be9['lookAgent']&&this[_0x8895('0x12')][_0xc35be9[_0x8895('0x100')]]){ut[_0x8895('0x136')](_0xc35be9,this['agents'][_0xc35be9[_0x8895('0x100')]][_0x8895('0x4d')],this[_0x8895('0x12')][_0xc35be9['lookAgent']]['id']);}var _0x1a62b4=_['clone'](_0xc35be9);_0x1a62b4[_0x8895('0x137')]=moment()[_0x8895('0x52')](_0x8895('0x87'));var _0x447dc0=_0x398041[_0x8895('0xf')][_0xc35be9['queue']];if(ut['isFailure'](_0xc93e09[_0x8895('0x138')])){if(_0xc35be9['unlockAgent']){rpcDb[_0x8895('0x139')](_0xc35be9[_0x8895('0x106')]);}if(_0xc35be9[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0xc35be9[_0x8895('0x106')]);}ami[_0x8895('0x21')](_0x8895('0x13a'),ut[_0x8895('0xb0')](_0xc35be9,'rejected',this[_0x8895('0xf')][_0xc35be9[_0x8895('0x6a')]]));this[_0x8895('0xf1')](_0x1a62b4,_0x447dc0,_0xc93e09);}else{_0xc35be9['starttime']=moment()[_0x8895('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x8895('0xf5')](_0x1a62b4,0x4,_0x8895('0xb2'));rpcDb[_0x8895('0xf6')](_0x1a62b4,_0x8895('0x13b'));}}};Preview[_0x8895('0xb')][_0x8895('0x15')]=function(_0x55d290){var _0x1186fa=this;var _0x466d3a=this[_0x8895('0x69')][_0x55d290['linkedid']];var _0x268d3c;if(_0x466d3a){_0x268d3c=this['campaignsPreview'][_0x466d3a[_0x8895('0x6a')]];logger[_0x8895('0x55')](_0x8895('0x13c'),_0x55d290[_0x8895('0xa5')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);}if(this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]]&&_0x55d290[_0x8895('0xa5')]!==_0x55d290['uniqueid']){if(_0x55d290['cause']==='16'&&this[_0x8895('0x69')][_0x55d290[_0x8895('0xa5')]][_0x8895('0x73')]){this['callProgressDetectingCustomer'](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}else if(this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')]);}}else if(_0x466d3a&&_[_0x8895('0x67')](_0x466d3a[_0x8895('0x13f')])&&_0x268d3c[_0x8895('0x140')]&&_0x55d290[_0x8895('0xa5')]===_0x55d290['uniqueid']&&_[_0x8895('0x67')](_0x55d290[_0x8895('0xf4')])&&_0x55d290[_0x8895('0x13d')]==='16'&&_0x55d290[_0x8895('0x141')]==='6'&&_[_0x8895('0xf2')](_0x466d3a[_0x8895('0x142')])){if(_0x466d3a['unlockAgent']){rpcDb['unlockContact'](_0x466d3a[_0x8895('0x106')]);}if(_0x466d3a[_0x8895('0xcc')]){rpcDb[_0x8895('0x85')](_0x466d3a[_0x8895('0x106')]);}_0x55d290[_0x8895('0xf4')]='22';this[_0x8895('0xf1')](_0x466d3a,_0x268d3c,_0x55d290);}else if(_0x466d3a&&_0x466d3a[_0x8895('0x142')]){if(_0x55d290['cause']==='16'&&this['actions'][_0x55d290[_0x8895('0xa5')]]['dialAnswer']){logger[_0x8895('0x55')](_0x8895('0x143'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],'\x20Queue',_0x268d3c[_0x8895('0x4d')],_0x8895('0xaa'),_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}else if(this[_0x8895('0x69')][_0x55d290['linkedid']][_0x8895('0x73')]){logger[_0x8895('0x55')](_0x8895('0x13e'),_0x55d290[_0x8895('0xa5')],_0x55d290[_0x8895('0x13d')],_0x8895('0xa9'),_0x268d3c[_0x8895('0x4d')],'pTalking:\x20',_0x268d3c[_0x8895('0x28')]);this[_0x8895('0x97')](_0x55d290,_0x55d290['linkedid'],_0x55d290[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['syncDialEnd']=function(_0x4c4240){if(this[_0x8895('0x69')][_0x4c4240[_0x8895('0x144')]]&&_0x4c4240[_0x8895('0x144')]!==_0x4c4240[_0x8895('0x145')]){this[_0x8895('0x97')](_0x4c4240,_0x4c4240[_0x8895('0x144')],_0x4c4240[_0x8895('0xe6')]);}};Preview[_0x8895('0xb')]['syncHangupRequest']=function(_0x28ec87){if(this['actions'][_0x28ec87[_0x8895('0xa5')]]&&_0x28ec87[_0x8895('0xa5')]!==_0x28ec87[_0x8895('0xa8')]&&!this[_0x8895('0x69')][_0x28ec87[_0x8895('0xa5')]]['dialAnswer']){if(_0x28ec87[_0x8895('0x13d')]==='1'){this[_0x8895('0x97')](_0x28ec87,_0x28ec87[_0x8895('0xa5')],_0x28ec87[_0x8895('0x13d')]);}}};Preview[_0x8895('0xb')]['addVariable']=function(_0x419702,_0x3a7d70,_0x4b937f){if(this['actions'][_0x419702]){if(_[_0x8895('0x67')](this[_0x8895('0x69')][_0x419702][_0x8895('0x146')])){this[_0x8895('0x69')][_0x419702][_0x8895('0x146')]={};}this[_0x8895('0x69')][_0x419702][_0x8895('0x146')][_0x3a7d70]=_0x4b937f;}};Preview['prototype'][_0x8895('0x1c')]=function(_0x49928b){try{if(!_[_0x8895('0x67')](_0x49928b)){if(ut[_0x8895('0x147')](_['keys'](_0x49928b['variable'])[0x0])){this[_0x8895('0x148')](_0x49928b[_0x8895('0xa8')],_[_0x8895('0x149')](_0x49928b['variable'])[0x0],_0x49928b[_0x8895('0x14a')]);}}}catch(_0x47837c){logger['error'](_0x8895('0x14b'),util[_0x8895('0x14c')](_0x47837c,{'showHidden':![],'depth':null}));}};Preview[_0x8895('0xb')][_0x8895('0x1e')]=function(_0x592e3b){if(_0x592e3b){if(this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']]){this[_0x8895('0x69')][_0x592e3b['transfertargetlinkedid']][_0x8895('0x142')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xe5a83a){if(_0xe5a83a){if(this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]]){this[_0x8895('0x69')][_0xe5a83a[_0x8895('0x14d')]][_0x8895('0x142')]=!![];}}};module[_0x8895('0x14e')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index afa38e6..5f88ea5 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 _0x56d1=['then','[createHistory]\x20','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','catch','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','exten','xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve'];(function(_0x51cc75,_0x7f40c3){var _0x3c3111=function(_0x184ce9){while(--_0x184ce9){_0x51cc75['push'](_0x51cc75['shift']());}};_0x3c3111(++_0x7f40c3);}(_0x56d1,0x18d));var _0x156d=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0x56d1[_0x2e5f9c];return _0x538b44;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x156d('0x0'))(_0x156d('0x1'));var _=require('lodash');var cmHopper=require(_0x156d('0x2'));var cmHopperFinal=require(_0x156d('0x3'));var cmHopperHistory=require(_0x156d('0x4'));var cmHopperBlack=require(_0x156d('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x156d('0x6'));var voiceQueueReport=require(_0x156d('0x7'));function loggerCatch(_0x1732af){return function(_0x45361b){logger[_0x156d('0x8')](_0x1732af,util[_0x156d('0x9')](_0x45361b,{'showHidden':![],'depth':null}));};}function create(_0x25084c){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopperHistory['createHistory'](_0x25084c))['catch'](loggerCatch(_0x156d('0xc')));}function createAgent(_0xb29c0a){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](agentReportPreview[_0x156d('0xd')](_0xb29c0a))['catch'](loggerCatch(_0x156d('0xc')));}function moveContact(_0x118d45){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopper['moveContactManagedDialer'](_0x118d45,!![]))['catch'](loggerCatch(_0x156d('0xe')));}exports[_0x156d('0xf')]=function(_0x96820b){return BPromise['resolve']()[_0x156d('0xb')](cmHopperBlack[_0x156d('0xf')](_0x96820b))[_0x156d('0x10')](loggerCatch(_0x156d('0x11')));};exports[_0x156d('0x12')]=function(_0x52b5c4){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopper[_0x156d('0x12')](_0x52b5c4))[_0x156d('0x10')](loggerCatch(_0x156d('0x13')));};exports[_0x156d('0xd')]=function(_0x4b6952,_0x5a07c7){create(_0x4b6952)['catch'](loggerCatch(_0x5a07c7));moveContact(_0x4b6952)[_0x156d('0x10')](loggerCatch(_0x5a07c7));};exports['createAgentHistory']=function(_0x256319,_0x59807e){createAgent(_0x256319)[_0x156d('0x10')](loggerCatch(_0x59807e));};exports[_0x156d('0x14')]=function(_0x5eadde,_0x229452){create(_0x5eadde)['catch'](loggerCatch(_0x229452));};exports[_0x156d('0x15')]=function(_0x2b7c85,_0x1245b5){moveContact(_0x2b7c85)[_0x156d('0x10')](loggerCatch(_0x1245b5));};exports['rescheduleContact']=function(_0x16817e,_0x50fe83,_0x2067ce){if(_0x50fe83){_0x16817e[_0x156d('0x16')]=null;}if(_0x2067ce){_0x16817e[_0x156d('0x17')]=![];}return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopper['rescheduleContact'](_0x16817e))[_0x156d('0x10')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x48fe3d){return BPromise[_0x156d('0xa')]()['then'](cmHopper[_0x156d('0x18')](_0x48fe3d))['catch'](loggerCatch(_0x156d('0x19')));};exports[_0x156d('0x1a')]=function(_0x24bae9){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopper[_0x156d('0x1a')]({'UserId':null},_0x24bae9,0x1))[_0x156d('0x10')](loggerCatch(_0x156d('0x1b')));};exports[_0x156d('0x1c')]=function(_0x2a6b9e){return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](cmHopper[_0x156d('0x1a')]({'active':![]},_0x2a6b9e,0x1))[_0x156d('0x10')](loggerCatch(_0x156d('0x1d')));};exports['crateCustomerReportQueue']=function(_0x338375){var _0x325940={};_0x325940['type']=_0x338375[_0x156d('0x1e')];_0x325940[_0x156d('0x1f')]=_0x338375['uniqueid'];_0x325940[_0x156d('0x20')]=_0x338375[_0x156d('0x20')];_0x325940[_0x156d('0x21')]=_0x338375['calleridname'];_0x325940['queue']=_0x338375[_0x156d('0x22')];_0x325940['queuecallerjoinAt']=_0x338375[_0x156d('0x23')];_0x325940[_0x156d('0x24')]=_0x338375[_0x156d('0x23')];_0x325940['queuecallercomplete']=0x1;_0x325940[_0x156d('0x25')]=_0x338375[_0x156d('0x26')];_0x325940[_0x156d('0x27')]=_0x338375[_0x156d('0x28')];_0x325940['context']='from-sip';_0x325940[_0x156d('0x29')]=_0x156d('0x2a');_0x325940['holdtime']=0x0;_0x325940[_0x156d('0x2b')]=0x1;_0x325940['lastAssignedTo']=_0x338375[_0x156d('0x28')];_0x325940[_0x156d('0x2c')]=_0x156d('0x2d');return BPromise[_0x156d('0xa')]()[_0x156d('0xb')](voiceQueueReport[_0x156d('0x2e')](_0x325940))[_0x156d('0x10')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x156d('0x2f')]=function(_0xcfcd76,_0xb3f57f){return BPromise['resolve']()[_0x156d('0xb')](cmHopper[_0x156d('0x2f')](_0xcfcd76,_0xb3f57f))[_0x156d('0x10')](loggerCatch(_0x156d('0x30')));};exports[_0x156d('0x31')]=function(_0x13bd85){return BPromise[_0x156d('0xa')]()['then'](cmHopper[_0x156d('0x32')](_0x13bd85,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x2731=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','endtime','connectedlinename','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x2731,0x1cf));var _0x1273=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2731[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x1273('0x0'));var BPromise=require(_0x1273('0x1'));var logger=require(_0x1273('0x2'))(_0x1273('0x3'));var _=require('lodash');var cmHopper=require(_0x1273('0x4'));var cmHopperFinal=require(_0x1273('0x5'));var cmHopperHistory=require(_0x1273('0x6'));var cmHopperBlack=require(_0x1273('0x7'));var voiceQueueRt=require(_0x1273('0x8'));var agentReportPreview=require(_0x1273('0x9'));var voiceQueueReport=require(_0x1273('0xa'));function loggerCatch(_0x5431de){return function(_0x73484b){logger[_0x1273('0xb')](_0x5431de,util['inspect'](_0x73484b,{'showHidden':![],'depth':null}));};}function create(_0x3910f1){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopperHistory[_0x1273('0xe')](_0x3910f1))[_0x1273('0xf')](loggerCatch(_0x1273('0x10')));}function createAgent(_0x59b1e9){return BPromise['resolve']()[_0x1273('0xd')](agentReportPreview[_0x1273('0xe')](_0x59b1e9))[_0x1273('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4717ea){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper[_0x1273('0x11')](_0x4717ea,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x260e43){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopperBlack[_0x1273('0x12')](_0x260e43))['catch'](loggerCatch(_0x1273('0x13')));};exports[_0x1273('0x14')]=function(_0x12a5ff){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x14')](_0x12a5ff))[_0x1273('0xf')](loggerCatch(_0x1273('0x15')));};exports['createHistory']=function(_0x10400c,_0x344b09){create(_0x10400c)[_0x1273('0xf')](loggerCatch(_0x344b09));moveContact(_0x10400c)[_0x1273('0xf')](loggerCatch(_0x344b09));};exports[_0x1273('0x16')]=function(_0x1a45a7,_0x3711df){createAgent(_0x1a45a7)[_0x1273('0xf')](loggerCatch(_0x3711df));};exports[_0x1273('0x17')]=function(_0x55687f,_0x586c1a){create(_0x55687f)[_0x1273('0xf')](loggerCatch(_0x586c1a));};exports[_0x1273('0x18')]=function(_0x525967,_0x465a86){moveContact(_0x525967)['catch'](loggerCatch(_0x465a86));};exports[_0x1273('0x19')]=function(_0x260778,_0x3a7ae7,_0x4597c0){if(_0x3a7ae7){_0x260778[_0x1273('0x1a')]=null;}if(_0x4597c0){_0x260778[_0x1273('0x1b')]=![];}return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper[_0x1273('0x19')](_0x260778))[_0x1273('0xf')](loggerCatch(_0x1273('0x1c')));};exports[_0x1273('0x1d')]=function(_0xb8b809){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x1d')](_0xb8b809))[_0x1273('0xf')](loggerCatch(_0x1273('0x1e')));};exports[_0x1273('0x1f')]=function(_0x13df56){return BPromise[_0x1273('0xc')]()['then'](cmHopper[_0x1273('0x1f')]({'UserId':null},_0x13df56,0x1))[_0x1273('0xf')](loggerCatch(_0x1273('0x20')));};exports[_0x1273('0x21')]=function(_0x374611){return BPromise[_0x1273('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x374611,0x1))[_0x1273('0xf')](loggerCatch(_0x1273('0x22')));};exports[_0x1273('0x23')]=function(_0x924e84){var _0x5bc1f8={};_0x5bc1f8[_0x1273('0x24')]=_0x924e84['type'];_0x5bc1f8['uniqueid']=_0x924e84[_0x1273('0x25')];_0x5bc1f8['calleridnum']=_0x924e84[_0x1273('0x26')];_0x5bc1f8['calleridname']=_0x924e84[_0x1273('0x27')];_0x5bc1f8[_0x1273('0x28')]=_0x924e84[_0x1273('0x28')];_0x5bc1f8['queuecallerjoinAt']=_0x924e84[_0x1273('0x29')];_0x5bc1f8['queuecallerleaveAt']=_0x924e84[_0x1273('0x29')];_0x5bc1f8['queuecallercomplete']=0x1;_0x5bc1f8['queuecallercompleteAt']=_0x924e84[_0x1273('0x2a')];_0x5bc1f8[_0x1273('0x2b')]=_0x924e84['membername'];_0x5bc1f8[_0x1273('0x2c')]=_0x1273('0x2d');_0x5bc1f8[_0x1273('0x2e')]='xcally-motion-preview';_0x5bc1f8[_0x1273('0x2f')]=0x0;_0x5bc1f8[_0x1273('0x30')]=0x1;_0x5bc1f8['lastAssignedTo']=_0x924e84['membername'];_0x5bc1f8[_0x1273('0x31')]=_0x1273('0x32');return BPromise['resolve']()[_0x1273('0xd')](voiceQueueReport[_0x1273('0x33')](_0x5bc1f8))[_0x1273('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x23d63d,_0x10edcc){return BPromise[_0x1273('0xc')]()[_0x1273('0xd')](cmHopper['getContactRecallMe'](_0x23d63d,_0x10edcc))['catch'](loggerCatch(_0x1273('0x34')));};exports[_0x1273('0x35')]=function(_0x42d269){return BPromise[_0x1273('0xc')]()['then'](cmHopper['rescheduleContact'](_0x42d269,!![],!![]))[_0x1273('0xf')](loggerCatch(_0x1273('0x36')));}; \ 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 6c0d078..ea73d16 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 _0xf922=['name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countnoanswerretry','countnosuchnumberretry','clone','Global','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','scheduledat','countbusyretry','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue'];(function(_0x4c03c3,_0x1c7bc1){var _0x5925e1=function(_0x7a2283){while(--_0x7a2283){_0x4c03c3['push'](_0x4c03c3['shift']());}};_0x5925e1(++_0x1c7bc1);}(_0xf922,0x18c));var _0x2f92=function(_0x3aab7f,_0x18d72c){_0x3aab7f=_0x3aab7f-0x0;var _0x3c2be6=_0xf922[_0x3aab7f];return _0x3c2be6;};'use strict';var util=require(_0x2f92('0x0'));var _=require('lodash');var moment=require(_0x2f92('0x1'));var logger=require(_0x2f92('0x2'))(_0x2f92('0x3'));var ipAgi=process[_0x2f92('0x4')][_0x2f92('0x5')]||_0x2f92('0x6');function getSeconds(_0xb6ff02,_0xe2f9a6){var _0xb76ba2=moment(_0xb6ff02)[_0x2f92('0x7')](0x0);var _0x5859dc=moment(_0xe2f9a6)[_0x2f92('0x7')](0x0);return _0xb76ba2[_0x2f92('0x8')](_0x5859dc,_0x2f92('0x9'));}exports[_0x2f92('0xa')]=function(_0x16e941){return function(_0xe35f46){logger[_0x2f92('0xb')](_0x16e941,util[_0x2f92('0xc')](_0xe35f46,{'showHidden':![],'depth':null}));};};exports[_0x2f92('0xd')]=function(_0x41fea4,_0x5075a0){logger['info'](_0x41fea4,util[_0x2f92('0xc')](_0x5075a0,{'showHidden':![],'depth':null}));};exports[_0x2f92('0xe')]=function(_0x4f8668,_0x74725e){logger[_0x2f92('0xb')](_0x4f8668,util[_0x2f92('0xc')](_0x74725e,{'showHidden':![],'depth':null}));};exports[_0x2f92('0xf')]=function(_0x1f29a7){return function(_0x166b90){logger[_0x2f92('0x10')](_0x1f29a7,util[_0x2f92('0xc')](_0x166b90,{'showHidden':![],'depth':null}));};};exports[_0x2f92('0x11')]=function(_0x41a26b,_0x3835bc,_0x14120b){return{'message':_0x41a26b,'unlock':_0x3835bc,'active':_0x14120b};};exports[_0x2f92('0x12')]=function(_0x37675a,_0x379213,_0x6cc798){if(!_['isUndefined'](_0x6cc798)&&_0x2f92('0x13')===typeof _0x6cc798&&!_[_0x2f92('0x14')](_0x6cc798)){if(!_[_0x2f92('0x15')](_0x379213)&&_0x2f92('0x13')===typeof _0x379213&&!_[_0x2f92('0x14')](_0x379213)){return util[_0x2f92('0x16')](_0x2f92('0x17'),_0x379213,_0x6cc798);}return util[_0x2f92('0x16')](_0x2f92('0x17'),_0x6cc798,_0x6cc798);}if(!_[_0x2f92('0x15')](_0x37675a)&&_0x2f92('0x13')===typeof _0x37675a&&!_[_0x2f92('0x14')](_0x37675a)){return _0x37675a;}return'\x22\x22\x20<>';};exports[_0x2f92('0x18')]=function(_0x5d927e){if(_[_0x2f92('0x19')](_0x5d927e)){return![];}return _0x5d927e;};exports['addVariables']=function(_0x5a10aa,_0x256b92,_0x175d2d,_0x13cb61,_0x340151,_0x23662c){var _0x207f1e={'XMD-QUEUE':_0x256b92[_0x2f92('0x1a')]?_0x256b92['Queue'][_0x2f92('0x1b')]:'','XMD-CALLERID':_0x13cb61,'XMD-CALLERID-PREVIEW':_0x23662c?util[_0x2f92('0x16')]('\x22%s\x22\x20<%s>',_0x23662c['calleridname'],_0x23662c[_0x2f92('0x1c')]):_0x13cb61,'XMD-DIALID':_0x340151,'XMD-CONTACTID':_0x256b92[_0x2f92('0x1d')],'XMD-CDRTYPE':_0x2f92('0x1e'),'CALLERID(all)':_0x13cb61,'XMD-VOICEQUEUEID':_0x256b92[_0x2f92('0x1f')],'XMD-DIALCHANNEL':_0x175d2d,'XMD-DIALTIMEOUT':_0x5a10aa[_0x2f92('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x2f92('0x21'),_0x5a10aa[_0x2f92('0x22')]?'g':'',_['isEmpty'](_0x5a10aa[_0x2f92('0x23')])?'':_0x2f92('0x24')),'XMD-DIALURL':_0x5a10aa['dialPreviewUrl']||'','XMD-AGI':_0x5a10aa[_0x2f92('0x25')]?util[_0x2f92('0x16')](_0x2f92('0x26'),ipAgi,_0x5a10aa[_0x2f92('0x25')]):'NONE','XMD-AGIAFTER':_0x5a10aa[_0x2f92('0x22')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5a10aa[_0x2f92('0x22')]):_0x2f92('0x27'),'XMD-ORIGINATECALLERIDNUM':_0x23662c?_0x23662c[_0x2f92('0x28')]:'','XMD-ORIGINATECALLERIDNAME':_0x23662c?_0x23662c[_0x2f92('0x29')]:'','XMD-DESTINATION':_0x2f92('0x2a'),'SIPADDHEADER':_0x2f92('0x2b')};if(!_['isEmpty'](_0x5a10aa['monitor_format'])){_0x207f1e[util[_0x2f92('0x16')]('%s',_0x2f92('0x2c'))]=_0x5a10aa['monitor_format'];_0x207f1e[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x340151;}if(_0x256b92&&_0x256b92[_0x2f92('0x2d')]){for(var _0x7aa153 in _0x256b92['Contact']){if(_0x256b92[_0x2f92('0x2d')][_0x2f92('0x2e')](_0x7aa153)){if(!_['isNil'](_0x256b92[_0x2f92('0x2d')][_0x7aa153])&&_0x7aa153!=='id'&&_0x7aa153!==_0x2f92('0x2f')&&_0x7aa153!==_0x2f92('0x30')&&_0x7aa153!==_0x2f92('0x31')){_0x207f1e[util[_0x2f92('0x16')](_0x2f92('0x32'),'XMD-',_['toUpper'](_0x7aa153))]=_0x256b92[_0x2f92('0x2d')][_0x7aa153];}}}}return _0x207f1e;};exports[_0x2f92('0x33')]=function(_0x556ff7){var _0x18ad9d={};for(var _0xa86c8 in _0x556ff7){if(_0x556ff7[_0x2f92('0x2e')](_0xa86c8)){_0x18ad9d[util['format']('%s',_[_0x2f92('0x34')](_0xa86c8))]=_0x556ff7[_0xa86c8];}}return{'variables':_0x18ad9d};};exports[_0x2f92('0x35')]=function(_0x3807ce,_0x2f3486){if(!_['isNil'](_0x3807ce)){if(_0x3807ce[_0x2f92('0x2e')](_0x2f92('0x36'))){if(_0x3807ce['originated']>0x0){_0x3807ce['originated']-=0x1;}else{logger[_0x2f92('0xb')](_0x2f92('0x37'),_0x2f3486);}}}else{logger[_0x2f92('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2f3486);}};exports['logBlacklist']=function(_0x21bf19){var _0xec03ea=moment()[_0x2f92('0x16')](_0x2f92('0x38'));_0x21bf19[_0x2f92('0x39')]=0xd;_0x21bf19[_0x2f92('0x3a')]=_0x2f92('0x3b');_0x21bf19[_0x2f92('0x3c')]=_0xec03ea;_0x21bf19[_0x2f92('0x3d')]=_0xec03ea;_0x21bf19[_0x2f92('0x3e')]=_0xec03ea;};exports[_0x2f92('0x3f')]=function(_0x27b28c,_0x50740c,_0x1caaa6){var _0x3f8154=moment()['format'](_0x2f92('0x38'));_0x27b28c['state']=_0x50740c;_0x27b28c['statedesc']=_0x1caaa6;_0x27b28c[_0x2f92('0x3d')]=_0x3f8154;_0x27b28c[_0x2f92('0x40')]=getSeconds(_0x27b28c[_0x2f92('0x3d')],_0x27b28c[_0x2f92('0x3c')]);};exports[_0x2f92('0x41')]=function(_0x24f01d,_0xa3d52a,_0x182002){_0x24f01d['membername']=_0xa3d52a;_0x24f01d[_0x2f92('0x42')]=_0x182002;};exports[_0x2f92('0x43')]=function(_0xf5ff90,_0x39dd10,_0x3ebda3){var _0x133e0c=moment()[_0x2f92('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0xf5ff90[_0x2f92('0x39')]=_0x39dd10;_0xf5ff90[_0x2f92('0x3a')]=_0x3ebda3;_0xf5ff90[_0x2f92('0x3d')]=_0xf5ff90['responsetime']?_0xf5ff90[_0x2f92('0x3d')]:_0x133e0c;_0xf5ff90[_0x2f92('0x3e')]=_0xf5ff90[_0x2f92('0x3e')]?_0xf5ff90[_0x2f92('0x3e')]:_0x133e0c;_0xf5ff90['ringtime']=getSeconds(_0xf5ff90[_0x2f92('0x3d')]||0x0,_0xf5ff90[_0x2f92('0x3c')]||0x0);_0xf5ff90[_0x2f92('0x44')]=_0xf5ff90[_0x2f92('0x45')]?getSeconds(_0xf5ff90[_0x2f92('0x3e')],_0xf5ff90[_0x2f92('0x45')]):0x0;};exports[_0x2f92('0x46')]=function(_0x40c406){return _0x40c406===_0x2f92('0x47');};exports[_0x2f92('0x48')]=function(_0x2274f5,_0x28bbdd,_0x47dc8a,_0x32ef5c,_0x9481f7){var _0x3abf04=_0x32ef5c?_0x2f92('0x49'):_0x2274f5[_0x2f92('0x4a')];_0x3abf04=_0x9481f7?_0x2f92('0x4b'):_0x3abf04;return{'actionid':_0x2274f5[_0x2f92('0x4c')],'action':_0x2f92('0x4d'),'channel':_0x2274f5[_0x2f92('0x4e')],'callerid':util[_0x2f92('0x16')]('\x22%s\x22\x20<%s>',_0x3abf04,_0x2274f5[_0x2f92('0x1c')]),'Exten':_0x2f92('0x2a'),'Context':_0x2f92('0x4f'),'Priority':'1','variable':_0x47dc8a,'timeout':(_0x28bbdd['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2274f5[_0x2f92('0x4c')]};};exports[_0x2f92('0x50')]=function(_0xa12ef0){return _0xa12ef0['countbusyretry']+_0xa12ef0['countcongestionretry']+_0xa12ef0[_0x2f92('0x51')]+_0xa12ef0['countagentrejectretry']+_0xa12ef0[_0x2f92('0x52')];};exports['cloneAction']=function(_0x33fcf7){var _0x5eb083=_[_0x2f92('0x53')](_0x33fcf7);_0x5eb083['state']=0xf;_0x5eb083[_0x2f92('0x3a')]=_0x2f92('0x54');return _0x5eb083;};exports['scheduledAt']=function(_0x3b693e,_0x281407,_0x575bbb){var _0x5d8b8f={};_0x5d8b8f[_0x281407]=_0x3b693e[_0x281407];_0x5d8b8f['active']=![];_0x5d8b8f['scheduledat']=moment()['add'](_0x575bbb,_0x2f92('0x55'))[_0x2f92('0x16')](_0x2f92('0x38'));_0x5d8b8f[_0x2f92('0x1d')]=_0x3b693e['ContactId'];_0x5d8b8f[_0x2f92('0x56')]=_0x3b693e[_0x2f92('0x56')];_0x5d8b8f[_0x2f92('0x1f')]=_0x3b693e[_0x2f92('0x1f')]||undefined;return _0x5d8b8f;};exports[_0x2f92('0x57')]=function(_0x5aaba3,_0x27f15c){if(!_[_0x2f92('0x19')](_0x5aaba3)){if(_0x5aaba3['pTalking']>0x0){_0x5aaba3[_0x2f92('0x58')]-=0x1;}else{logger[_0x2f92('0xb')](_0x27f15c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2f92('0xb')](_0x27f15c,_0x2f92('0x59'));}};exports[_0x2f92('0x5a')]=function(_0x7b52d0){if(_0x7b52d0<=0x0){return!![];}return![];};exports[_0x2f92('0x5b')]=function(_0x46f280,_0x5549aa,_0x7f0133){_0x46f280[_0x2f92('0x5c')]=_0x5549aa;_0x46f280[_0x2f92('0x1b')]=_0x46f280[_0x2f92('0x5d')];_0x46f280[_0x2f92('0x5e')]=_0x46f280[_0x2f92('0x4e')];_0x46f280['motionChannel']=_0x2f92('0x5f');if(_0x7f0133){_0x46f280[_0x2f92('0x60')]=_0x7f0133[_0x2f92('0x60')];}return _0x46f280;};exports[_0x2f92('0x61')]=function(_0x350545){var _0x5a89ed={};_0x5a89ed[_0x2f92('0x5d')]=_0x350545['queue'];_0x5a89ed['interface']=_0x350545[_0x2f92('0x4e')];_0x5a89ed[_0x2f92('0x4c')]=_0x350545[_0x2f92('0x4c')];return _0x5a89ed;};exports[_0x2f92('0x62')]=function(_0x5612e1){var _0x5591e5=[];for(var _0x32b640 in _0x5612e1){if(_0x5612e1[_0x2f92('0x2e')](_0x32b640)){if(!_[_0x2f92('0x19')](_0x5612e1[_0x32b640])&&_0x5612e1[_0x32b640][_0x2f92('0x39')]===_0x2f92('0x63')&&_0x5612e1[_0x32b640]['status']===_0x2f92('0x64')){_0x5591e5[_0x2f92('0x65')](_0x5612e1[_0x32b640]['id']);}}}return _0x5591e5;};exports[_0x2f92('0x66')]=function(_0x2dcf65){var _0x38c7a7=moment()[_0x2f92('0x7')](0x0);var _0x18cca6=moment(_0x2dcf65)[_0x2f92('0x7')](0x0);return _0x38c7a7['diff'](_0x18cca6,_0x2f92('0x9'));};exports['createBody']=function(_0x115fef){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x115fef[_0x2f92('0x1d')],'ListId':_0x115fef[_0x2f92('0x56')],'VoiceQueueId':_0x115fef[_0x2f92('0x1f')]||undefined,'CampaignId':_0x115fef[_0x2f92('0x67')]||undefined};};exports[_0x2f92('0x68')]=function(_0x4d602e){if(_0x4d602e===_0x2f92('0x4c')||_0x4d602e===_0x2f92('0x69')||_0x4d602e===_0x2f92('0x5d')||_0x4d602e==='type'||_0x4d602e===_0x2f92('0x6a')||_0x4d602e===_0x2f92('0x6b')||_0x4d602e===_0x2f92('0x6c')||_0x4d602e==='channelAgent'||_0x4d602e===_0x2f92('0x4a')||_0x4d602e==='active'||_0x4d602e==='calleridnum'||_0x4d602e===_0x2f92('0x6d')||_0x4d602e===_0x2f92('0x6e')||_0x4d602e===_0x2f92('0x6f')||_0x4d602e===_0x2f92('0x51')||_0x4d602e==='countglobal'||_0x4d602e===_0x2f92('0x70')||_0x4d602e===_0x2f92('0x71')||_0x4d602e===_0x2f92('0x72')||_0x4d602e===_0x2f92('0x73')||_0x4d602e===_0x2f92('0x1d')||_0x4d602e===_0x2f92('0x56')||_0x4d602e===_0x2f92('0x42')||_0x4d602e==='VoiceQueueId'||_0x4d602e==='sipcallid'||_0x4d602e==='xmd-voicequeueid'||_0x4d602e==='xmd-queue'||_0x4d602e===_0x2f92('0x74')||_0x4d602e===_0x2f92('0x75')||_0x4d602e===_0x2f92('0x76')||_0x4d602e===_0x2f92('0x77')||_0x4d602e===_0x2f92('0x78')||_0x4d602e===_0x2f92('0x79')||_0x4d602e==='xmd-dialchannel'||_0x4d602e===_0x2f92('0x7a')||_0x4d602e===_0x2f92('0x7b')||_0x4d602e===_0x2f92('0x7c')||_0x4d602e==='xmd-agiafter'||_0x4d602e===_0x2f92('0x7d')||_0x4d602e===_0x2f92('0x7e')||_0x4d602e===_0x2f92('0x7f')||_0x4d602e===_0x2f92('0x80')||_0x4d602e==='rtpaudioqosjitterbridged'||_0x4d602e==='rtpaudioqosloss'||_0x4d602e==='rtpaudioqoslossbridged'||_0x4d602e===_0x2f92('0x81')||_0x4d602e===_0x2f92('0x82')||_0x4d602e==='rtpaudioqos'||_0x4d602e===_0x2f92('0x7f')||_0x4d602e===_0x2f92('0x80')||_0x4d602e==='rtpaudioqosjitterbridged'||_0x4d602e===_0x2f92('0x83')||_0x4d602e===_0x2f92('0x84')||_0x4d602e==='rtpaudioqosrtt'||_0x4d602e===_0x2f92('0x82')||_0x4d602e===_0x2f92('0x85')||_0x4d602e===_0x2f92('0x86')||_0x4d602e===_0x2f92('0x39')||_0x4d602e==='statedesc'){return![];}return!![];};exports[_0x2f92('0x87')]=function(_0x59beac,_0x3e147a){var _0x159cad,_0xe8a9bf,_0x57f837;if(_0x3e147a<=0x0){_0x3e147a=0x1;}_0x159cad=new RegExp(_0x2f92('0x88')+_0x3e147a+'}$');_0xe8a9bf=Math[_0x2f92('0x89')](0xa,_0x3e147a-0x1);_0x57f837=Math[_0x2f92('0x89')](0xa,_0x3e147a)-0x1;return util[_0x2f92('0x16')]('%s',_[_0x2f92('0x8a')](_0x59beac,_0x159cad,_[_0x2f92('0x8b')](_0xe8a9bf,_0x57f837)));};exports['extractCalleridName']=function(_0x288a3f){var _0x2deab5=_0x288a3f['match'](/"(.*?)"/);return _0x2deab5?_0x2deab5[0x1]:_0x288a3f;};exports[_0x2f92('0x8c')]=function(_0x8620e9){var _0x1feb21=_0x8620e9['match'](/<(.*?)>/);return _0x1feb21?_0x1feb21[0x1]:_0x8620e9;}; \ No newline at end of file +var _0x61ab=['NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','Contact','hasOwnProperty','tags','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','add','minutes','ListId','pTalking','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','reachable','push','getDiff','milliseconds','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','lodash','moment','preview','env','127.0.0.1','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x61ab,0x1db));var _0xb61a=function(_0xbbe973,_0x481cbb){_0xbbe973=_0xbbe973-0x0;var _0x13b770=_0x61ab[_0xbbe973];return _0x13b770;};'use strict';var util=require('util');var _=require(_0xb61a('0x0'));var moment=require(_0xb61a('0x1'));var logger=require('../../../../config/logger')(_0xb61a('0x2'));var ipAgi=process[_0xb61a('0x3')]['XCALLY_IP_AGI']||_0xb61a('0x4');function getSeconds(_0x4661f2,_0x20056e){var _0x514374=moment(_0x4661f2)['milliseconds'](0x0);var _0x334edb=moment(_0x20056e)['milliseconds'](0x0);return _0x514374[_0xb61a('0x5')](_0x334edb,_0xb61a('0x6'));}exports[_0xb61a('0x7')]=function(_0x3a78ef){return function(_0x174a1a){logger[_0xb61a('0x8')](_0x3a78ef,util[_0xb61a('0x9')](_0x174a1a,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xa')]=function(_0x8a6d41,_0x5a7733){logger[_0xb61a('0xb')](_0x8a6d41,util[_0xb61a('0x9')](_0x5a7733,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3ad300,_0x15fb06){logger[_0xb61a('0x8')](_0x3ad300,util[_0xb61a('0x9')](_0x15fb06,{'showHidden':![],'depth':null}));};exports[_0xb61a('0xc')]=function(_0x52fa5d){return function(_0x2c835e){logger[_0xb61a('0xb')](_0x52fa5d,util[_0xb61a('0x9')](_0x2c835e,{'showHidden':![],'depth':null}));};};exports[_0xb61a('0xd')]=function(_0x59c8b5,_0x5bf234,_0x24b37e){return{'message':_0x59c8b5,'unlock':_0x5bf234,'active':_0x24b37e};};exports[_0xb61a('0xe')]=function(_0x3f0b9e,_0x2bd8e9,_0x49441f){if(!_['isUndefined'](_0x49441f)&&'string'===typeof _0x49441f&&!_[_0xb61a('0xf')](_0x49441f)){if(!_[_0xb61a('0x10')](_0x2bd8e9)&&_0xb61a('0x11')===typeof _0x2bd8e9&&!_['isEmpty'](_0x2bd8e9)){return util[_0xb61a('0x12')]('\x22%s\x22\x20<%s>',_0x2bd8e9,_0x49441f);}return util[_0xb61a('0x12')](_0xb61a('0x13'),_0x49441f,_0x49441f);}if(!_[_0xb61a('0x10')](_0x3f0b9e)&&'string'===typeof _0x3f0b9e&&!_[_0xb61a('0xf')](_0x3f0b9e)){return _0x3f0b9e;}return _0xb61a('0x14');};exports['isActive']=function(_0xe260d6){if(_[_0xb61a('0x15')](_0xe260d6)){return![];}return _0xe260d6;};exports['addVariables']=function(_0xc26cbe,_0x4f33f8,_0x37efec,_0x30adc3,_0x120dd1,_0x41a7de){var _0x59fa7b={'XMD-QUEUE':_0x4f33f8[_0xb61a('0x16')]?_0x4f33f8[_0xb61a('0x16')][_0xb61a('0x17')]:'','XMD-CALLERID':_0x30adc3,'XMD-CALLERID-PREVIEW':_0x41a7de?util[_0xb61a('0x12')](_0xb61a('0x13'),_0x41a7de[_0xb61a('0x18')],_0x41a7de[_0xb61a('0x19')]):_0x30adc3,'XMD-DIALID':_0x120dd1,'XMD-CONTACTID':_0x4f33f8[_0xb61a('0x1a')],'XMD-CDRTYPE':_0xb61a('0x1b'),'CALLERID(all)':_0x30adc3,'XMD-VOICEQUEUEID':_0x4f33f8[_0xb61a('0x1c')],'XMD-DIALCHANNEL':_0x37efec,'XMD-DIALTIMEOUT':_0xc26cbe[_0xb61a('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb61a('0x12')]('\x22rtTxX%s%s\x22',_0xc26cbe[_0xb61a('0x1e')]?'g':'',_[_0xb61a('0xf')](_0xc26cbe['monitor_format'])?'':_0xb61a('0x1f')),'XMD-DIALURL':_0xc26cbe[_0xb61a('0x20')]||'','XMD-AGI':_0xc26cbe['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0xc26cbe['dialQueueProject']):_0xb61a('0x21'),'XMD-AGIAFTER':_0xc26cbe[_0xb61a('0x1e')]?util[_0xb61a('0x12')](_0xb61a('0x22'),ipAgi,_0xc26cbe['dialQueueProject2']):_0xb61a('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x41a7de?_0x41a7de[_0xb61a('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x41a7de?_0x41a7de[_0xb61a('0x24')]:'','XMD-DESTINATION':_0xb61a('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xb61a('0xf')](_0xc26cbe[_0xb61a('0x26')])){_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0xc26cbe[_0xb61a('0x26')];_0x59fa7b[util[_0xb61a('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x120dd1;}if(_0x4f33f8&&_0x4f33f8[_0xb61a('0x27')]){for(var _0x37f274 in _0x4f33f8['Contact']){if(_0x4f33f8['Contact'][_0xb61a('0x28')](_0x37f274)){if(!_[_0xb61a('0x15')](_0x4f33f8[_0xb61a('0x27')][_0x37f274])&&_0x37f274!=='id'&&_0x37f274!==_0xb61a('0x29')&&_0x37f274!=='createdAt'&&_0x37f274!=='updatedAt'){_0x59fa7b[util[_0xb61a('0x12')]('%s%s','XMD-',_['toUpper'](_0x37f274))]=_0x4f33f8['Contact'][_0x37f274];}}}}return _0x59fa7b;};exports[_0xb61a('0x2a')]=function(_0x22cdf2){var _0x849121={};for(var _0x1d24b4 in _0x22cdf2){if(_0x22cdf2[_0xb61a('0x28')](_0x1d24b4)){_0x849121[util[_0xb61a('0x12')]('%s',_[_0xb61a('0x2b')](_0x1d24b4))]=_0x22cdf2[_0x1d24b4];}}return{'variables':_0x849121};};exports['updateOriginated']=function(_0xdb1c35,_0x4c6281){if(!_[_0xb61a('0x15')](_0xdb1c35)){if(_0xdb1c35[_0xb61a('0x28')](_0xb61a('0x2c'))){if(_0xdb1c35['originated']>0x0){_0xdb1c35[_0xb61a('0x2c')]-=0x1;}else{logger[_0xb61a('0x8')](_0xb61a('0x2d'),_0x4c6281);}}}else{logger['error'](_0xb61a('0x2e'),_0x4c6281);}};exports['logBlacklist']=function(_0x581f92){var _0x45d662=moment()[_0xb61a('0x12')](_0xb61a('0x2f'));_0x581f92[_0xb61a('0x30')]=0xd;_0x581f92[_0xb61a('0x31')]=_0xb61a('0x32');_0x581f92[_0xb61a('0x33')]=_0x45d662;_0x581f92['responsetime']=_0x45d662;_0x581f92[_0xb61a('0x34')]=_0x45d662;};exports[_0xb61a('0x35')]=function(_0x2759b9,_0x10d4fe,_0x14e9d8){var _0x348ac1=moment()[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2759b9[_0xb61a('0x30')]=_0x10d4fe;_0x2759b9['statedesc']=_0x14e9d8;_0x2759b9['responsetime']=_0x348ac1;_0x2759b9['ringtime']=getSeconds(_0x2759b9[_0xb61a('0x36')],_0x2759b9[_0xb61a('0x33')]);};exports['logLookAgent']=function(_0x5280b4,_0x44f883,_0x43a4e7){_0x5280b4['membername']=_0x44f883;_0x5280b4[_0xb61a('0x37')]=_0x43a4e7;};exports[_0xb61a('0x38')]=function(_0x49d82c,_0x5eaa68,_0x546e09){var _0x303de4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x49d82c[_0xb61a('0x30')]=_0x5eaa68;_0x49d82c[_0xb61a('0x31')]=_0x546e09;_0x49d82c[_0xb61a('0x36')]=_0x49d82c[_0xb61a('0x36')]?_0x49d82c[_0xb61a('0x36')]:_0x303de4;_0x49d82c[_0xb61a('0x34')]=_0x49d82c[_0xb61a('0x34')]?_0x49d82c[_0xb61a('0x34')]:_0x303de4;_0x49d82c[_0xb61a('0x39')]=getSeconds(_0x49d82c[_0xb61a('0x36')]||0x0,_0x49d82c[_0xb61a('0x33')]||0x0);_0x49d82c[_0xb61a('0x3a')]=_0x49d82c[_0xb61a('0x3b')]?getSeconds(_0x49d82c[_0xb61a('0x34')],_0x49d82c[_0xb61a('0x3b')]):0x0;};exports[_0xb61a('0x3c')]=function(_0x5b0a81){return _0x5b0a81===_0xb61a('0x3d');};exports['variablesAction']=function(_0x328598,_0x431164,_0x365b37,_0x176eac,_0x461aa2){var _0x472f1b=_0x176eac?_0xb61a('0x3e'):_0x328598[_0xb61a('0x18')];_0x472f1b=_0x461aa2?_0xb61a('0x3f'):_0x472f1b;return{'actionid':_0x328598[_0xb61a('0x40')],'action':_0xb61a('0x41'),'channel':_0x328598[_0xb61a('0x42')],'callerid':util[_0xb61a('0x12')](_0xb61a('0x13'),_0x472f1b,_0x328598[_0xb61a('0x19')]),'Exten':_0xb61a('0x25'),'Context':_0xb61a('0x43'),'Priority':'1','variable':_0x365b37,'timeout':(_0x431164[_0xb61a('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x328598[_0xb61a('0x40')]};};exports['totalGlobal']=function(_0x1e32b4){return _0x1e32b4[_0xb61a('0x45')]+_0x1e32b4[_0xb61a('0x46')]+_0x1e32b4[_0xb61a('0x47')]+_0x1e32b4[_0xb61a('0x48')]+_0x1e32b4[_0xb61a('0x49')];};exports['cloneAction']=function(_0x1cbcee){var _0x160a09=_['clone'](_0x1cbcee);_0x160a09[_0xb61a('0x30')]=0xf;_0x160a09[_0xb61a('0x31')]=_0xb61a('0x4a');return _0x160a09;};exports[_0xb61a('0x4b')]=function(_0x54baa4,_0x7d567d,_0x354b2d){var _0x53ffb3={};_0x53ffb3[_0x7d567d]=_0x54baa4[_0x7d567d];_0x53ffb3[_0xb61a('0x4c')]=![];_0x53ffb3['scheduledat']=moment()[_0xb61a('0x4d')](_0x354b2d,_0xb61a('0x4e'))[_0xb61a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x53ffb3[_0xb61a('0x1a')]=_0x54baa4[_0xb61a('0x1a')];_0x53ffb3[_0xb61a('0x4f')]=_0x54baa4[_0xb61a('0x4f')];_0x53ffb3[_0xb61a('0x1c')]=_0x54baa4[_0xb61a('0x1c')]||undefined;return _0x53ffb3;};exports['decrementTalkink']=function(_0x341054,_0x28c937){if(!_[_0xb61a('0x15')](_0x341054)){if(_0x341054[_0xb61a('0x50')]>0x0){_0x341054[_0xb61a('0x50')]-=0x1;}else{logger['error'](_0x28c937,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb61a('0x8')](_0x28c937,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5bbcc5){if(_0x5bbcc5<=0x0){return!![];}return![];};exports[_0xb61a('0x51')]=function(_0x115565,_0x41ddad,_0xd8e473){_0x115565[_0xb61a('0x52')]=_0x41ddad;_0x115565[_0xb61a('0x17')]=_0x115565[_0xb61a('0x53')];_0x115565['interface']=_0x115565['channelAgent'];_0x115565[_0xb61a('0x54')]=_0xb61a('0x55');if(_0xd8e473){_0x115565[_0xb61a('0x56')]=_0xd8e473[_0xb61a('0x56')];}return _0x115565;};exports['buildAcw']=function(_0x202c49){var _0x209c51={};_0x209c51[_0xb61a('0x53')]=_0x202c49[_0xb61a('0x53')];_0x209c51['interface']=_0x202c49['channelAgent'];_0x209c51[_0xb61a('0x40')]=_0x202c49[_0xb61a('0x40')];return _0x209c51;};exports['agentReadyId']=function(_0x3d5a00){var _0x383fd9=[];for(var _0x12102e in _0x3d5a00){if(_0x3d5a00[_0xb61a('0x28')](_0x12102e)){if(!_['isNil'](_0x3d5a00[_0x12102e])&&_0x3d5a00[_0x12102e][_0xb61a('0x30')]==='not_inuse'&&_0x3d5a00[_0x12102e]['status']===_0xb61a('0x57')){_0x383fd9[_0xb61a('0x58')](_0x3d5a00[_0x12102e]['id']);}}}return _0x383fd9;};exports[_0xb61a('0x59')]=function(_0x2e8415){var _0x5cc433=moment()[_0xb61a('0x5a')](0x0);var _0xbe4fbb=moment(_0x2e8415)['milliseconds'](0x0);return _0x5cc433['diff'](_0xbe4fbb,_0xb61a('0x6'));};exports['createBody']=function(_0x32672f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32672f[_0xb61a('0x1a')],'ListId':_0x32672f[_0xb61a('0x4f')],'VoiceQueueId':_0x32672f['VoiceQueueId']||undefined,'CampaignId':_0x32672f[_0xb61a('0x5b')]||undefined};};exports[_0xb61a('0x5c')]=function(_0x288969){if(_0x288969==='uniqueid'||_0x288969==='idContact'||_0x288969==='queue'||_0x288969===_0xb61a('0x5d')||_0x288969===_0xb61a('0x5e')||_0x288969===_0xb61a('0x5f')||_0x288969===_0xb61a('0x60')||_0x288969==='channelAgent'||_0x288969==='calleridname'||_0x288969===_0xb61a('0x4c')||_0x288969==='calleridnum'||_0x288969==='scheduledat'||_0x288969===_0xb61a('0x45')||_0x288969===_0xb61a('0x46')||_0x288969===_0xb61a('0x47')||_0x288969==='countglobal'||_0x288969==='callback'||_0x288969===_0xb61a('0x61')||_0x288969===_0xb61a('0x62')||_0x288969===_0xb61a('0x63')||_0x288969===_0xb61a('0x1a')||_0x288969===_0xb61a('0x4f')||_0x288969===_0xb61a('0x37')||_0x288969===_0xb61a('0x1c')||_0x288969===_0xb61a('0x64')||_0x288969===_0xb61a('0x65')||_0x288969===_0xb61a('0x66')||_0x288969===_0xb61a('0x67')||_0x288969===_0xb61a('0x68')||_0x288969===_0xb61a('0x69')||_0x288969===_0xb61a('0x6a')||_0x288969===_0xb61a('0x6b')||_0x288969===_0xb61a('0x6c')||_0x288969===_0xb61a('0x6d')||_0x288969===_0xb61a('0x6e')||_0x288969==='xmd-cdrtype'||_0x288969===_0xb61a('0x6f')||_0x288969===_0xb61a('0x70')||_0x288969==='xmd-agi'||_0x288969==='rtpaudioqos'||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969===_0xb61a('0x73')||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969===_0xb61a('0x76')||_0x288969==='rtpaudioqosrttbridged'||_0x288969===_0xb61a('0x77')||_0x288969===_0xb61a('0x71')||_0x288969===_0xb61a('0x72')||_0x288969==='rtpaudioqosjitterbridged'||_0x288969===_0xb61a('0x74')||_0x288969===_0xb61a('0x75')||_0x288969==='rtpaudioqosrtt'||_0x288969===_0xb61a('0x78')||_0x288969===_0xb61a('0x79')||_0x288969===_0xb61a('0x7a')||_0x288969==='state'||_0x288969===_0xb61a('0x31')){return![];}return!![];};exports[_0xb61a('0x7b')]=function(_0x427403,_0x2a7f2c){var _0x33f1bf,_0x3e4cc3,_0x2907ed;if(_0x2a7f2c<=0x0){_0x2a7f2c=0x1;}_0x33f1bf=new RegExp('\x5cw{0,'+_0x2a7f2c+'}$');_0x3e4cc3=Math[_0xb61a('0x7c')](0xa,_0x2a7f2c-0x1);_0x2907ed=Math['pow'](0xa,_0x2a7f2c)-0x1;return util[_0xb61a('0x12')]('%s',_['replace'](_0x427403,_0x33f1bf,_[_0xb61a('0x7d')](_0x3e4cc3,_0x2907ed)));};exports[_0xb61a('0x7e')]=function(_0x276512){var _0x1681fc=_0x276512['match'](/"(.*?)"/);return _0x1681fc?_0x1681fc[0x1]:_0x276512;};exports['extractCalleridNumber']=function(_0x51c0c9){var _0x2df697=_0x51c0c9['match'](/<(.*?)>/);return _0x2df697?_0x2df697[0x1]:_0x51c0c9;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3d9c468..2507e7c 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 _0xcc17=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcc17,0xf0));var _0x7cc1=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcc17[_0x5d7227];return _0x15ac55;};'use strict';exports['queueadd']={'queue':{'type':_0x7cc1('0x0'),'required':!![]},'interface':{'type':_0x7cc1('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x7cc1('0x1'),'required':![]},'paused':{'type':_0x7cc1('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x7cc1('0x0'),'required':!![]},'interface':{'type':_0x7cc1('0x0'),'required':!![]}};exports[_0x7cc1('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x7cc1('0x2')},'reason':{'type':_0x7cc1('0x0'),'required':![]}};exports[_0x7cc1('0x4')]={'module':{'type':'string','required':![]}};exports[_0x7cc1('0x5')]={'uniqueid':{'type':_0x7cc1('0x0'),'required':!![]}};exports[_0x7cc1('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x7cc1('0x0')},'format':{'type':_0x7cc1('0x0')},'mixmonitorid':{'type':_0x7cc1('0x0')}};exports[_0x7cc1('0x7')]={'uniqueid':{'type':_0x7cc1('0x0'),'required':!![]}};exports[_0x7cc1('0x8')]={'uniqueid':{'type':_0x7cc1('0x0'),'required':!![]},'exten':{'type':_0x7cc1('0x0'),'required':!![]},'context':{'type':_0x7cc1('0x0')}}; \ No newline at end of file +var _0xcbdc=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0xcbdc,0xb0));var _0xccbd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcbdc[_0x2c91e9];return _0x13f0ff;};'use strict';exports[_0xccbd('0x0')]={'queue':{'type':_0xccbd('0x1'),'required':!![]},'interface':{'type':_0xccbd('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xccbd('0x2'),'required':![]},'paused':{'type':_0xccbd('0x3'),'required':![]}};exports[_0xccbd('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x5')]={'interface':{'type':_0xccbd('0x1'),'required':!![]},'paused':{'type':_0xccbd('0x3')},'reason':{'type':_0xccbd('0x1'),'required':![]}};exports[_0xccbd('0x6')]={'module':{'type':'string','required':![]}};exports[_0xccbd('0x7')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x8')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]},'filename':{'type':_0xccbd('0x1')},'format':{'type':_0xccbd('0x1')},'mixmonitorid':{'type':_0xccbd('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]}};exports[_0xccbd('0x9')]={'uniqueid':{'type':_0xccbd('0x1'),'required':!![]},'exten':{'type':_0xccbd('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c0142cb..e5eadfb 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 _0x8f5c=['queuecallerexit','queuecallerabandon','abandoned','sumHoldTime','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallerleaveAt','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','faxAccounts','mapKeys','hasOwnProperty','format','isNil','interface','SIP/%s','name','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','agents','isUndefined','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0x8f5c,0x1de));var _0xc8f5=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x8f5c[_0x1ee62e];return _0x27c6c8;};'use strict';var BPromise=require(_0xc8f5('0x0'));var util=require(_0xc8f5('0x1'));var _=require(_0xc8f5('0x2'));var moment=require(_0xc8f5('0x3'));var Agent=require(_0xc8f5('0x4'));var Telephone=require(_0xc8f5('0x5'));var Trunk=require(_0xc8f5('0x6'));var VoiceQueue=require(_0xc8f5('0x7'));var Trigger=require(_0xc8f5('0x8'));var Template=require('../model/template');var Campaign=require(_0xc8f5('0x9'));var VoiceExtension=require(_0xc8f5('0xa'));var ZendeskAccount=require(_0xc8f5('0xb'));var SalesforceAccount=require(_0xc8f5('0xc'));var FreshdeskAccount=require(_0xc8f5('0xd'));var SugarcrmAccount=require(_0xc8f5('0xe'));var ZohoAccount=require(_0xc8f5('0xf'));var DeskAccount=require(_0xc8f5('0x10'));var VtigerAccount=require(_0xc8f5('0x11'));var ServicenowAccount=require(_0xc8f5('0x12'));var Dynamics365Account=require(_0xc8f5('0x13'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0xc8f5('0x14')]={};this[_0xc8f5('0x15')]={};this[_0xc8f5('0x16')]={};this[_0xc8f5('0x17')]={};this[_0xc8f5('0x18')]={};this[_0xc8f5('0x19')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc8f5('0x1a')]={};this['channels']={};this['queueChannels']={};this[_0xc8f5('0x1b')]={};this['timers']={};this['settings']={};this[_0xc8f5('0x1c')]={};this[_0xc8f5('0x1d')]={};this[_0xc8f5('0x1e')]={};this[_0xc8f5('0x1f')]={};this['zohoAccounts']={};this[_0xc8f5('0x20')]={};this[_0xc8f5('0x21')]={};this[_0xc8f5('0x22')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this[_0xc8f5('0x23')]={};};function freeIsNotKey(_0x13ddc7,_0x17e0d1,_0x315e73){var _0x5071cc=_[_0xc8f5('0x24')](_0x13ddc7,function(_0x4e8bbe,_0x2c758d){return _0x4e8bbe[_0x315e73];});for(var _0x224d51 in _0x17e0d1){if(_0x17e0d1[_0xc8f5('0x25')](_0x224d51)){if(!_0x5071cc[_0x224d51]){delete _0x17e0d1[_0x224d51];}}}}function freeIsNotKeySip(_0x1c35e2,_0x5effe4){var _0x3ef0e8=_[_0xc8f5('0x24')](_0x1c35e2,function(_0x4626ec,_0x2eb4b8){return util[_0xc8f5('0x26')]('SIP/%s',_0x4626ec['name']);});for(var _0x49ff51 in _0x5effe4){if(_0x5effe4[_0xc8f5('0x25')](_0x49ff51)){if(!_0x3ef0e8[_0x49ff51]){delete _0x5effe4[_0x49ff51];}}}}function freeIsNotKeyAgent(_0x5a1682,_0x421eec){var _0x4a56db=_['mapKeys'](_0x5a1682,function(_0x54fe7d,_0x2d2b18){var _0x5e549a=_[_0xc8f5('0x27')](_0x54fe7d[_0xc8f5('0x28')])?util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0x54fe7d[_0xc8f5('0x2a')]):_0x54fe7d[_0xc8f5('0x28')];return _0x5e549a;});for(var _0x654b94 in _0x421eec){if(_0x421eec['hasOwnProperty'](_0x654b94)){if(!_0x4a56db[_0x654b94]){delete _0x421eec[_0x654b94];}}}}function clearVoiceCallReports(_0xa03f35){_0xa03f35['total']=0x0;_0xa03f35[_0xc8f5('0x2b')]=0x0;_0xa03f35['sumHoldTime']=0x0;_0xa03f35[_0xc8f5('0x2c')]=0x0;_0xa03f35[_0xc8f5('0x2d')]=0x0;}function clearCampaigns(_0x1a5d6a){if(!_[_0xc8f5('0x2e')](_0x1a5d6a)){for(var _0x57ee37 in _0x1a5d6a){if(_0x1a5d6a[_0xc8f5('0x25')](_0x57ee37)){_0x1a5d6a[_0x57ee37][_0xc8f5('0x2f')]=0x0;_0x1a5d6a[_0x57ee37][_0xc8f5('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1d2190){if(!_['isEmpty'](_0x1d2190)){for(var _0x3cc496 in _0x1d2190){if(_0x1d2190[_0xc8f5('0x25')](_0x3cc496)){_0x1d2190[_0x3cc496][_0xc8f5('0x31')]=0x0;_0x1d2190[_0x3cc496]['answered']=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x32')]=0x0;_0x1d2190[_0x3cc496]['abandoned']=0x0;_0x1d2190[_0x3cc496]['sumHoldTime']=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x2c')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x2d')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x33')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x34')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x35')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x36')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x37')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x38')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x39')]=0x0;_0x1d2190[_0x3cc496]['outboundDropCallsDayCallersExit']=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3a')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3b')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3c')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3d')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x33')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3e')]=0x0;_0x1d2190[_0x3cc496][_0xc8f5('0x3f')]=!![];}}}}Realtime['prototype'][_0xc8f5('0x40')]=function(_0x3874bc,_0x276fad){for(var _0x33b950 in _0x276fad){if(_0x3874bc[_0xc8f5('0x25')](_0x33b950)){_0x3874bc[_0x33b950]=_0x276fad[_0x33b950];}}};Realtime[_0xc8f5('0x41')][_0xc8f5('0x42')]=function(){var _0x5f24b1=this;return function(_0x103177){if(_0x103177){freeIsNotKeyAgent(_0x103177,_0x5f24b1['agents']);for(var _0x98761c=0x0,_0xbbb2af={},_0x434d46={};_0x98761c<_0x103177[_0xc8f5('0x43')];_0x98761c+=0x1){_0xbbb2af=_0x103177[_0x98761c];var _0x444dac=_[_0xc8f5('0x27')](_0xbbb2af['interface'])?util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0xbbb2af[_0xc8f5('0x2a')]):_0xbbb2af[_0xc8f5('0x28')];if(_['isUndefined'](_0x5f24b1[_0xc8f5('0x44')][_0x444dac])){_0x5f24b1[_0xc8f5('0x44')][_0x444dac]=new Agent(_0xbbb2af);}else{_0x5f24b1['mergeFromDatabase'](_0x5f24b1[_0xc8f5('0x44')][_0x444dac],_0xbbb2af);}}}return _0x5f24b1[_0xc8f5('0x44')];};};Realtime[_0xc8f5('0x41')]['initTelephones']=function(){var _0x6c20cb=this;return function(_0x5afc2c){if(_0x5afc2c){freeIsNotKeySip(_0x5afc2c,_0x6c20cb[_0xc8f5('0x14')]);for(var _0x1298dd=0x0,_0x1b3e30={},_0x35faa5={};_0x1298dd<_0x5afc2c[_0xc8f5('0x43')];_0x1298dd+=0x1){_0x1b3e30=_0x5afc2c[_0x1298dd];if(_[_0xc8f5('0x45')](_0x6c20cb['telephones'][util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0x1b3e30['name'])])){_0x6c20cb[_0xc8f5('0x14')][util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0x1b3e30['name'])]=new Telephone(_0x1b3e30);}else{_0x6c20cb['mergeFromDatabase'](_0x6c20cb['telephones'][util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0x1b3e30[_0xc8f5('0x2a')])],_0x1b3e30);}}}return _0x6c20cb['telephones'];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x46')]=function(){var _0x31ad81=this;return function(_0x69db4d){if(_0x69db4d){freeIsNotKeySip(_0x69db4d,_0x31ad81[_0xc8f5('0x15')]);for(var _0x578e1d=0x0,_0xe456f5={},_0x29868b={};_0x578e1d<_0x69db4d[_0xc8f5('0x43')];_0x578e1d+=0x1){_0xe456f5=_0x69db4d[_0x578e1d];if(_['isUndefined'](_0x31ad81[_0xc8f5('0x15')][util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0xe456f5[_0xc8f5('0x2a')])])){_0x31ad81[_0xc8f5('0x15')][util[_0xc8f5('0x26')](_0xc8f5('0x29'),_0xe456f5['name'])]=new Trunk(_0xe456f5);}else{_0x31ad81['mergeFromDatabase'](_0x31ad81['trunks'][util[_0xc8f5('0x26')]('SIP/%s',_0xe456f5[_0xc8f5('0x2a')])],_0xe456f5);}}}return _0x31ad81[_0xc8f5('0x15')];};};Realtime['prototype'][_0xc8f5('0x47')]=function(){var _0x59d330=this;return function(_0x120242){if(_0x120242){freeIsNotKey(_0x120242,_0x59d330[_0xc8f5('0x16')],_0xc8f5('0x2a'));for(var _0x6cee64=0x0,_0x92d02c={},_0x125c9e={};_0x6cee64<_0x120242[_0xc8f5('0x43')];_0x6cee64+=0x1){_0x92d02c=_0x120242[_0x6cee64];if(_[_0xc8f5('0x45')](_0x59d330[_0xc8f5('0x16')][_0x92d02c['name']])){_0x59d330[_0xc8f5('0x16')][_0x92d02c[_0xc8f5('0x2a')]]=new VoiceQueue(_0x92d02c);}else{_0x59d330[_0xc8f5('0x40')](_0x59d330[_0xc8f5('0x16')][_0x92d02c[_0xc8f5('0x2a')]],_0x92d02c);}}}return _0x59d330['voiceQueues'];};};Realtime[_0xc8f5('0x41')]['initTriggers']=function(){var _0x35e79b=this;return function(_0x26ee2f){if(_0x26ee2f){freeIsNotKey(_0x26ee2f,_0x35e79b['triggers'],'id');for(var _0x5cfb7d=0x0,_0x50c8f8={},_0x44c962={};_0x5cfb7d<_0x26ee2f[_0xc8f5('0x43')];_0x5cfb7d+=0x1){_0x50c8f8=_0x26ee2f[_0x5cfb7d];if(_[_0xc8f5('0x45')](_0x35e79b['triggers'][_0x50c8f8['id']])){_0x35e79b[_0xc8f5('0x17')][_0x50c8f8['id']]=new Trigger(_0x50c8f8);}else{_0x35e79b['mergeFromDatabase'](_0x35e79b[_0xc8f5('0x17')][_0x50c8f8['id']],_0x50c8f8);}}}return _0x35e79b[_0xc8f5('0x17')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x48')]=function(){var _0x393404=this;return function(_0x1e270b){if(_0x1e270b){freeIsNotKey(_0x1e270b,_0x393404['templates'],'id');for(var _0x568b34=0x0,_0x5a1037={},_0x4dff83={};_0x568b34<_0x1e270b[_0xc8f5('0x43')];_0x568b34+=0x1){_0x5a1037=_0x1e270b[_0x568b34];if(_[_0xc8f5('0x45')](_0x393404[_0xc8f5('0x19')][_0x5a1037['id']])){_0x393404[_0xc8f5('0x19')][_0x5a1037['id']]=new Template(_0x5a1037);}else{_0x393404['mergeFromDatabase'](_0x393404[_0xc8f5('0x19')][_0x5a1037['id']],_0x5a1037);}}}return _0x393404[_0xc8f5('0x19')];};};Realtime['prototype'][_0xc8f5('0x49')]=function(){var _0x2baaeb=this;return function(_0x48e2ce){if(_0x48e2ce){freeIsNotKey(_0x48e2ce,_0x2baaeb[_0xc8f5('0x1c')],'id');for(var _0x54c356=0x0,_0x2afb14={},_0x278d0b={};_0x54c356<_0x48e2ce[_0xc8f5('0x43')];_0x54c356+=0x1){_0x2afb14=_0x48e2ce[_0x54c356];if(_['isUndefined'](_0x2baaeb['zendeskAccounts'][_0x2afb14['id']])){_0x2baaeb[_0xc8f5('0x1c')][_0x2afb14['id']]=new ZendeskAccount(_0x2afb14);}else{_0x2baaeb['mergeFromDatabase'](_0x2baaeb[_0xc8f5('0x1c')][_0x2afb14['id']],_0x2afb14);}}}return _0x2baaeb['zendeskAccounts'];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x4a')]=function(){var _0x5aac58=this;return function(_0x6f2cb0){if(_0x6f2cb0){freeIsNotKey(_0x6f2cb0,_0x5aac58[_0xc8f5('0x1d')],'id');for(var _0x314ca0=0x0,_0x53272c={},_0x284bdc={};_0x314ca0<_0x6f2cb0[_0xc8f5('0x43')];_0x314ca0+=0x1){_0x53272c=_0x6f2cb0[_0x314ca0];if(_['isUndefined'](_0x5aac58[_0xc8f5('0x1d')][_0x53272c['id']])){_0x5aac58['salesforceAccounts'][_0x53272c['id']]=new SalesforceAccount(_0x53272c);}else{_0x5aac58[_0xc8f5('0x40')](_0x5aac58[_0xc8f5('0x1d')][_0x53272c['id']],_0x53272c);}}}return _0x5aac58[_0xc8f5('0x1d')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x4b')]=function(){var _0x4afa12=this;return function(_0x400f95){if(_0x400f95){freeIsNotKey(_0x400f95,_0x4afa12[_0xc8f5('0x1f')],'id');for(var _0x3c56f1=0x0,_0x4bb95b={},_0x7b0463={};_0x3c56f1<_0x400f95[_0xc8f5('0x43')];_0x3c56f1+=0x1){_0x4bb95b=_0x400f95[_0x3c56f1];if(_[_0xc8f5('0x45')](_0x4afa12[_0xc8f5('0x1f')][_0x4bb95b['id']])){_0x4afa12[_0xc8f5('0x1f')][_0x4bb95b['id']]=new FreshdeskAccount(_0x4bb95b);}else{_0x4afa12[_0xc8f5('0x40')](_0x4afa12[_0xc8f5('0x1f')][_0x4bb95b['id']],_0x4bb95b);}}}return _0x4afa12[_0xc8f5('0x1f')];};};Realtime['prototype'][_0xc8f5('0x4c')]=function(){var _0x430063=this;return function(_0x8ee5fd){if(_0x8ee5fd){freeIsNotKey(_0x8ee5fd,_0x430063[_0xc8f5('0x4d')],'id');for(var _0xef9a85=0x0,_0x564b2f={},_0x1c97b9={};_0xef9a85<_0x8ee5fd[_0xc8f5('0x43')];_0xef9a85+=0x1){_0x564b2f=_0x8ee5fd[_0xef9a85];if(_['isUndefined'](_0x430063['zohoAccounts'][_0x564b2f['id']])){_0x430063[_0xc8f5('0x4d')][_0x564b2f['id']]=new ZohoAccount(_0x564b2f);}else{_0x430063[_0xc8f5('0x40')](_0x430063[_0xc8f5('0x4d')][_0x564b2f['id']],_0x564b2f);}}}return _0x430063[_0xc8f5('0x4d')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x4e')]=function(){var _0x11901a=this;return function(_0x24cf36){if(_0x24cf36){freeIsNotKey(_0x24cf36,_0x11901a[_0xc8f5('0x20')],'id');for(var _0xeeb610=0x0,_0x328dc5={},_0xba59e1={};_0xeeb610<_0x24cf36[_0xc8f5('0x43')];_0xeeb610+=0x1){_0x328dc5=_0x24cf36[_0xeeb610];if(_['isUndefined'](_0x11901a[_0xc8f5('0x20')][_0x328dc5['id']])){_0x11901a[_0xc8f5('0x20')][_0x328dc5['id']]=new DeskAccount(_0x328dc5);}else{_0x11901a['mergeFromDatabase'](_0x11901a[_0xc8f5('0x20')][_0x328dc5['id']],_0x328dc5);}}}return _0x11901a[_0xc8f5('0x20')];};};Realtime['prototype'][_0xc8f5('0x4f')]=function(){var _0x125255=this;return function(_0x43a416){if(_0x43a416){freeIsNotKey(_0x43a416,_0x125255[_0xc8f5('0x1e')],'id');for(var _0x420d4f=0x0,_0x91bbc1={},_0x337ac7={};_0x420d4f<_0x43a416[_0xc8f5('0x43')];_0x420d4f+=0x1){_0x91bbc1=_0x43a416[_0x420d4f];if(_[_0xc8f5('0x45')](_0x125255['sugarcrmAccounts'][_0x91bbc1['id']])){_0x125255['sugarcrmAccounts'][_0x91bbc1['id']]=new SugarcrmAccount(_0x91bbc1);}else{_0x125255[_0xc8f5('0x40')](_0x125255[_0xc8f5('0x1e')][_0x91bbc1['id']],_0x91bbc1);}}}return _0x125255['sugarcrmAccounts'];};};Realtime['prototype'][_0xc8f5('0x50')]=function(){var _0x258ba0=this;return function(_0x212ac6){if(_0x212ac6){freeIsNotKey(_0x212ac6,_0x258ba0[_0xc8f5('0x21')],'id');for(var _0x3d4c82=0x0,_0x152395={},_0x434d23={};_0x3d4c82<_0x212ac6[_0xc8f5('0x43')];_0x3d4c82+=0x1){_0x152395=_0x212ac6[_0x3d4c82];if(_[_0xc8f5('0x45')](_0x258ba0[_0xc8f5('0x21')][_0x152395['id']])){_0x258ba0[_0xc8f5('0x21')][_0x152395['id']]=new VtigerAccount(_0x152395);}else{_0x258ba0[_0xc8f5('0x40')](_0x258ba0['vtigerAccounts'][_0x152395['id']],_0x152395);}}}return _0x258ba0[_0xc8f5('0x21')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x51')]=function(){var _0xadd33=this;return function(_0x26ee6d){if(_0x26ee6d){freeIsNotKey(_0x26ee6d,_0xadd33['servicenowAccounts'],'id');for(var _0x1417ef=0x0,_0x533c7b={},_0x402f07={};_0x1417ef<_0x26ee6d[_0xc8f5('0x43')];_0x1417ef+=0x1){_0x533c7b=_0x26ee6d[_0x1417ef];if(_[_0xc8f5('0x45')](_0xadd33[_0xc8f5('0x22')][_0x533c7b['id']])){_0xadd33[_0xc8f5('0x22')][_0x533c7b['id']]=new ServicenowAccount(_0x533c7b);}else{_0xadd33[_0xc8f5('0x40')](_0xadd33[_0xc8f5('0x22')][_0x533c7b['id']],_0x533c7b);}}}return _0xadd33['servicenowAccounts'];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x52')]=function(){var _0x16f5a3=this;return function(_0x281c19){if(_0x281c19){freeIsNotKey(_0x281c19,_0x16f5a3['dynamics365Accounts'],'id');for(var _0x590513=0x0,_0x2094ef={},_0x557c4c={};_0x590513<_0x281c19[_0xc8f5('0x43')];_0x590513+=0x1){_0x2094ef=_0x281c19[_0x590513];if(_['isUndefined'](_0x16f5a3[_0xc8f5('0x53')][_0x2094ef['id']])){_0x16f5a3[_0xc8f5('0x53')][_0x2094ef['id']]=new Dynamics365Account(_0x2094ef);}else{_0x16f5a3['mergeFromDatabase'](_0x16f5a3['dynamics365Accounts'][_0x2094ef['id']],_0x2094ef);}}}return _0x16f5a3[_0xc8f5('0x53')];};};Realtime['prototype'][_0xc8f5('0x54')]=function(){var _0x395027=this;return function(_0x2a10f9){if(_0x2a10f9){freeIsNotKey(_0x2a10f9,_0x395027[_0xc8f5('0x55')],'id');for(var _0x280370=0x0,_0x800217={},_0x5ece96={};_0x280370<_0x2a10f9[_0xc8f5('0x43')];_0x280370+=0x1){_0x800217=_0x2a10f9[_0x280370];if(_['isUndefined'](_0x395027['freshsalesAccounts'][_0x800217['id']])){_0x395027[_0xc8f5('0x55')][_0x800217['id']]=new FreshsalesAccount(_0x800217);}else{_0x395027['mergeFromDatabase'](_0x395027['freshsalesAccounts'][_0x800217['id']],_0x800217);}}}return _0x395027[_0xc8f5('0x55')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x56')]=function(){var _0x41952e=this;return function(_0x32afd0){for(var _0xcf1279=0x0;_0xcf1279<_0x32afd0[_0xc8f5('0x43')];_0xcf1279+=0x1){_[_0xc8f5('0x57')](_0x41952e['voiceQueues'][_0x32afd0[_0xcf1279][_0xc8f5('0x2a')]],_0x32afd0[_0xcf1279]);}return _0x41952e[_0xc8f5('0x16')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x58')]=function(){var _0x338975=this;return function(_0x56a001){clearVoiceQueues(_0x338975[_0xc8f5('0x16')]);if(_0x56a001){_0x56a001=_[_0xc8f5('0x59')](_0x56a001,_0xc8f5('0x5a'));for(var _0x545b10 in _0x56a001){if(_0x56a001[_0xc8f5('0x25')](_0x545b10)){var _0x367a2e={};for(var _0x19b797=0x0;_0x19b797<_0x56a001[_0x545b10][_0xc8f5('0x43')];_0x19b797+=0x1){var _0x5644e7=_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x5b')];if(_0x338975[_0xc8f5('0x16')][_0x5644e7]){if(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x5c')]){_0x338975[_0xc8f5('0x16')][_0x5644e7]['unmanaged']+=0x1;}if(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x5d')]){_0x338975[_0xc8f5('0x16')][_0x5644e7][_0xc8f5('0x5e')]+=0x1;}_0x338975[_0xc8f5('0x16')][_0x5644e7][_0xc8f5('0x5f')]+=moment(_0x56a001[_0x545b10][_0x19b797]['queuecallerleaveAt'])[_0xc8f5('0x60')](moment(_0x56a001[_0x545b10][_0x19b797]['queuecallerjoinAt']),_0xc8f5('0x61'))||0x0;if(_0x19b797===_0x56a001[_0x545b10]['length']-0x1){_0x338975[_0xc8f5('0x16')][_0x5644e7]['sumDuration']+=moment(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x62')]||_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x63')]||_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x64')])[_0xc8f5('0x60')](moment(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x65')]),_0xc8f5('0x61'))||0x0;_0x338975[_0xc8f5('0x16')][_0x5644e7]['total']+=0x1;if(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x66')]){_0x338975[_0xc8f5('0x16')][_0x5644e7]['answered']+=0x1;_0x338975[_0xc8f5('0x16')][_0x5644e7]['sumBillable']+=moment(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x62')])[_0xc8f5('0x60')](moment(_0x56a001[_0x545b10][_0x19b797][_0xc8f5('0x67')]),_0xc8f5('0x61'))||0x0;}}else{_0x338975['voiceQueues'][_0x5644e7]['sumDuration']+=_0x338975[_0xc8f5('0x16')][_0x5644e7]['sumHoldTime']||0x0;}}}}}}return _0x338975[_0xc8f5('0x16')];};};Realtime[_0xc8f5('0x41')]['initVoiceCallReports']=function(){var _0x4dce35=this;return function(_0x55fc34){clearVoiceCallReports(_0x4dce35[_0xc8f5('0x68')]);if(_0x55fc34){for(var _0x546856=0x0;_0x546856<_0x55fc34[_0xc8f5('0x43')];_0x546856+=0x1){_0x4dce35['outbound'][_0xc8f5('0x31')]+=0x1;_0x4dce35[_0xc8f5('0x68')][_0xc8f5('0x2c')]+=_0x55fc34[_0x546856][_0xc8f5('0x69')];if(_0x55fc34[_0x546856]['disposition']===_0xc8f5('0x6a')){_0x4dce35['outbound'][_0xc8f5('0x2b')]+=0x1;_0x4dce35[_0xc8f5('0x68')]['sumHoldTime']+=_0x55fc34[_0x546856][_0xc8f5('0x69')]-_0x55fc34[_0x546856]['billableseconds']||0x0;_0x4dce35['outbound'][_0xc8f5('0x2d')]+=_0x55fc34[_0x546856][_0xc8f5('0x6b')];}}}return _0x4dce35[_0xc8f5('0x68')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x6c')]=function(){var _0x479449=this;return function(_0x46f89f){if(_0x46f89f){freeIsNotKey(_0x46f89f,_0x479449[_0xc8f5('0x18')],'name');for(var _0x5f4548=0x0,_0x53ea1a={};_0x5f4548<_0x46f89f[_0xc8f5('0x43')];_0x5f4548+=0x1){_0x53ea1a=_0x46f89f[_0x5f4548];if(_[_0xc8f5('0x45')](_0x479449[_0xc8f5('0x18')][_0x53ea1a[_0xc8f5('0x2a')]])){_0x479449[_0xc8f5('0x18')][_0x53ea1a[_0xc8f5('0x2a')]]=new Campaign(_0x53ea1a);}else{_0x479449[_0xc8f5('0x40')](_0x479449[_0xc8f5('0x18')][_0x53ea1a[_0xc8f5('0x2a')]],_0x53ea1a);_0x479449[_0xc8f5('0x18')][_0x53ea1a['name']][_0xc8f5('0x6d')]=_0x53ea1a[_0xc8f5('0x6e')]?_0x53ea1a[_0xc8f5('0x6e')][_0xc8f5('0x2a')]:undefined;}}}return _0x479449[_0xc8f5('0x18')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x5d6f19=this;return function(_0x145a17){if(_0x145a17){freeIsNotKey(_0x145a17,_0x5d6f19[_0xc8f5('0x1a')],'id');for(var _0x242a1b=0x0,_0x9ed35e={};_0x242a1b<_0x145a17[_0xc8f5('0x43')];_0x242a1b+=0x1){_0x9ed35e=_0x145a17[_0x242a1b];if(_[_0xc8f5('0x45')](_0x5d6f19[_0xc8f5('0x1a')][_0x9ed35e['id']])){_0x5d6f19['voiceExtensions'][_0x9ed35e['id']]=new VoiceExtension(_0x9ed35e);}else{_0x5d6f19[_0xc8f5('0x40')](_0x5d6f19[_0xc8f5('0x1a')][_0x9ed35e['id']],_0x9ed35e);}}}return _0x5d6f19[_0xc8f5('0x1a')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x6f')]=function(){var _0x3fce72=this;return function(_0x316f89){clearCampaigns(_0x3fce72[_0xc8f5('0x18')]);for(var _0x5a1afe=0x0;_0x5a1afe<_0x316f89[_0xc8f5('0x43')];_0x5a1afe+=0x1){_['merge'](_0x3fce72['campaigns'][_0x316f89[_0x5a1afe]['name']],_0x316f89[_0x5a1afe]);}return _0x3fce72[_0xc8f5('0x18')];};};Realtime[_0xc8f5('0x41')][_0xc8f5('0x70')]=function(){var _0x49ab2b=this;return function(_0x4f212a){if(_0x4f212a){freeIsNotKey(_0x4f212a,_0x49ab2b[_0xc8f5('0x23')],'id');for(var _0x3c81ac=0x0,_0x102dd3={},_0x23a809={};_0x3c81ac<_0x4f212a[_0xc8f5('0x43')];_0x3c81ac+=0x1){_0x102dd3=_0x4f212a[_0x3c81ac];if(_[_0xc8f5('0x45')](_0x49ab2b[_0xc8f5('0x23')][_0x102dd3['id']])){_0x49ab2b[_0xc8f5('0x23')][_0x102dd3['id']]=new FaxAccount(_0x102dd3);}else{_0x49ab2b[_0xc8f5('0x40')](_0x49ab2b[_0xc8f5('0x23')][_0x102dd3['id']],_0x102dd3);}}}return _0x49ab2b[_0xc8f5('0x23')];};};module[_0xc8f5('0x71')]=Realtime; \ No newline at end of file +var _0x2f5b=['templates','voiceExtensions','channels','queueChannels','outboundChannels','sugarcrmAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initVoiceQueues','voiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','sumDuration','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','util','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2f5b,0xc6));var _0xb2f5=function(_0x487c25,_0x4530e5){_0x487c25=_0x487c25-0x0;var _0x1fe915=_0x2f5b[_0x487c25];return _0x1fe915;};'use strict';var BPromise=require('bluebird');var util=require(_0xb2f5('0x0'));var _=require('lodash');var moment=require(_0xb2f5('0x1'));var Agent=require(_0xb2f5('0x2'));var Telephone=require(_0xb2f5('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xb2f5('0x4'));var Trigger=require('../model/trigger');var Template=require(_0xb2f5('0x5'));var Campaign=require(_0xb2f5('0x6'));var VoiceExtension=require(_0xb2f5('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xb2f5('0x8'));var FreshdeskAccount=require(_0xb2f5('0x9'));var SugarcrmAccount=require(_0xb2f5('0xa'));var ZohoAccount=require(_0xb2f5('0xb'));var DeskAccount=require(_0xb2f5('0xc'));var VtigerAccount=require(_0xb2f5('0xd'));var ServicenowAccount=require(_0xb2f5('0xe'));var Dynamics365Account=require(_0xb2f5('0xf'));var FreshsalesAccount=require(_0xb2f5('0x10'));var FaxAccount=require(_0xb2f5('0x11'));var Realtime=function(){this[_0xb2f5('0x12')]={};this[_0xb2f5('0x13')]={};this[_0xb2f5('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0xb2f5('0x15')]={};this[_0xb2f5('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xb2f5('0x17')]={};this[_0xb2f5('0x18')]={};this[_0xb2f5('0x19')]={};this[_0xb2f5('0x1a')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0xb2f5('0x1b')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xb2f5('0x1c')]={};this[_0xb2f5('0x1d')]={};this['dynamics365Accounts']={};this[_0xb2f5('0x1e')]={};this['faxAccounts']={};};function freeIsNotKey(_0x494770,_0x195cba,_0x8dc24a){var _0x5b76b9=_['mapKeys'](_0x494770,function(_0x204854,_0x5d8d98){return _0x204854[_0x8dc24a];});for(var _0x2dc398 in _0x195cba){if(_0x195cba[_0xb2f5('0x1f')](_0x2dc398)){if(!_0x5b76b9[_0x2dc398]){delete _0x195cba[_0x2dc398];}}}}function freeIsNotKeySip(_0x1fffb2,_0x1de846){var _0x165df4=_[_0xb2f5('0x20')](_0x1fffb2,function(_0x272c59,_0x489eee){return util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x272c59[_0xb2f5('0x23')]);});for(var _0x43a0eb in _0x1de846){if(_0x1de846[_0xb2f5('0x1f')](_0x43a0eb)){if(!_0x165df4[_0x43a0eb]){delete _0x1de846[_0x43a0eb];}}}}function freeIsNotKeyAgent(_0x2164fa,_0x5829da){var _0x4cefcd=_[_0xb2f5('0x20')](_0x2164fa,function(_0x5ce6f5,_0x2efe6e){var _0x2a24d8=_[_0xb2f5('0x24')](_0x5ce6f5['interface'])?util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x5ce6f5['name']):_0x5ce6f5[_0xb2f5('0x25')];return _0x2a24d8;});for(var _0x40af04 in _0x5829da){if(_0x5829da['hasOwnProperty'](_0x40af04)){if(!_0x4cefcd[_0x40af04]){delete _0x5829da[_0x40af04];}}}}function clearVoiceCallReports(_0x39a607){_0x39a607[_0xb2f5('0x26')]=0x0;_0x39a607[_0xb2f5('0x27')]=0x0;_0x39a607['sumHoldTime']=0x0;_0x39a607['sumDuration']=0x0;_0x39a607[_0xb2f5('0x28')]=0x0;}function clearCampaigns(_0x295c3a){if(!_['isEmpty'](_0x295c3a)){for(var _0x2d4ae3 in _0x295c3a){if(_0x295c3a[_0xb2f5('0x1f')](_0x2d4ae3)){_0x295c3a[_0x2d4ae3][_0xb2f5('0x29')]=0x0;_0x295c3a[_0x2d4ae3][_0xb2f5('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x53e4a1){if(!_[_0xb2f5('0x2b')](_0x53e4a1)){for(var _0x527670 in _0x53e4a1){if(_0x53e4a1[_0xb2f5('0x1f')](_0x527670)){_0x53e4a1[_0x527670][_0xb2f5('0x26')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x27')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2c')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2d')]=0x0;_0x53e4a1[_0x527670]['sumHoldTime']=0x0;_0x53e4a1[_0x527670]['sumDuration']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x28')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2e')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2f')]=0x0;_0x53e4a1[_0x527670]['outboundBusyCallsDay']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x30')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x31')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x32')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x33')]=0x0;_0x53e4a1[_0x527670]['outboundDropCallsDayCallersExit']=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x34')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x35')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x36')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x37')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x2e')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x38')]=0x0;_0x53e4a1[_0x527670][_0xb2f5('0x39')]=!![];}}}}Realtime[_0xb2f5('0x3a')][_0xb2f5('0x3b')]=function(_0x4e2511,_0x3008e7){for(var _0x1a98ca in _0x3008e7){if(_0x4e2511[_0xb2f5('0x1f')](_0x1a98ca)){_0x4e2511[_0x1a98ca]=_0x3008e7[_0x1a98ca];}}};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x3c')]=function(){var _0x13ea46=this;return function(_0x37909c){if(_0x37909c){freeIsNotKeyAgent(_0x37909c,_0x13ea46['agents']);for(var _0xcd1d3a=0x0,_0x56bbd7={},_0x4624ba={};_0xcd1d3a<_0x37909c[_0xb2f5('0x3d')];_0xcd1d3a+=0x1){_0x56bbd7=_0x37909c[_0xcd1d3a];var _0x18e73e=_[_0xb2f5('0x24')](_0x56bbd7[_0xb2f5('0x25')])?util[_0xb2f5('0x21')]('SIP/%s',_0x56bbd7[_0xb2f5('0x23')]):_0x56bbd7[_0xb2f5('0x25')];if(_[_0xb2f5('0x3e')](_0x13ea46[_0xb2f5('0x12')][_0x18e73e])){_0x13ea46[_0xb2f5('0x12')][_0x18e73e]=new Agent(_0x56bbd7);}else{_0x13ea46[_0xb2f5('0x3b')](_0x13ea46[_0xb2f5('0x12')][_0x18e73e],_0x56bbd7);}}}return _0x13ea46[_0xb2f5('0x12')];};};Realtime['prototype'][_0xb2f5('0x3f')]=function(){var _0x26e24a=this;return function(_0x101375){if(_0x101375){freeIsNotKeySip(_0x101375,_0x26e24a[_0xb2f5('0x13')]);for(var _0x4638d8=0x0,_0x466c8a={},_0x59a0cd={};_0x4638d8<_0x101375[_0xb2f5('0x3d')];_0x4638d8+=0x1){_0x466c8a=_0x101375[_0x4638d8];if(_[_0xb2f5('0x3e')](_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a[_0xb2f5('0x23')])])){_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a['name'])]=new Telephone(_0x466c8a);}else{_0x26e24a[_0xb2f5('0x3b')](_0x26e24a['telephones'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x466c8a[_0xb2f5('0x23')])],_0x466c8a);}}}return _0x26e24a['telephones'];};};Realtime[_0xb2f5('0x3a')]['initTrunks']=function(){var _0x5290fb=this;return function(_0x32471d){if(_0x32471d){freeIsNotKeySip(_0x32471d,_0x5290fb[_0xb2f5('0x14')]);for(var _0x12c71d=0x0,_0x2ae3bd={},_0x4a659e={};_0x12c71d<_0x32471d[_0xb2f5('0x3d')];_0x12c71d+=0x1){_0x2ae3bd=_0x32471d[_0x12c71d];if(_['isUndefined'](_0x5290fb['trunks'][util['format'](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])])){_0x5290fb['trunks'][util[_0xb2f5('0x21')](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])]=new Trunk(_0x2ae3bd);}else{_0x5290fb[_0xb2f5('0x3b')](_0x5290fb[_0xb2f5('0x14')][util['format'](_0xb2f5('0x22'),_0x2ae3bd[_0xb2f5('0x23')])],_0x2ae3bd);}}}return _0x5290fb['trunks'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x40')]=function(){var _0x1c6119=this;return function(_0x3de53b){if(_0x3de53b){freeIsNotKey(_0x3de53b,_0x1c6119[_0xb2f5('0x41')],_0xb2f5('0x23'));for(var _0x3dc733=0x0,_0x53416d={},_0x4e2289={};_0x3dc733<_0x3de53b[_0xb2f5('0x3d')];_0x3dc733+=0x1){_0x53416d=_0x3de53b[_0x3dc733];if(_[_0xb2f5('0x3e')](_0x1c6119['voiceQueues'][_0x53416d['name']])){_0x1c6119[_0xb2f5('0x41')][_0x53416d[_0xb2f5('0x23')]]=new VoiceQueue(_0x53416d);}else{_0x1c6119[_0xb2f5('0x3b')](_0x1c6119['voiceQueues'][_0x53416d[_0xb2f5('0x23')]],_0x53416d);}}}return _0x1c6119[_0xb2f5('0x41')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x42')]=function(){var _0x54bce8=this;return function(_0x560678){if(_0x560678){freeIsNotKey(_0x560678,_0x54bce8['triggers'],'id');for(var _0x3b521a=0x0,_0x3df677={},_0xf28bfa={};_0x3b521a<_0x560678[_0xb2f5('0x3d')];_0x3b521a+=0x1){_0x3df677=_0x560678[_0x3b521a];if(_['isUndefined'](_0x54bce8['triggers'][_0x3df677['id']])){_0x54bce8[_0xb2f5('0x43')][_0x3df677['id']]=new Trigger(_0x3df677);}else{_0x54bce8[_0xb2f5('0x3b')](_0x54bce8[_0xb2f5('0x43')][_0x3df677['id']],_0x3df677);}}}return _0x54bce8[_0xb2f5('0x43')];};};Realtime['prototype'][_0xb2f5('0x44')]=function(){var _0x21c33b=this;return function(_0x12d512){if(_0x12d512){freeIsNotKey(_0x12d512,_0x21c33b[_0xb2f5('0x16')],'id');for(var _0x2a6d28=0x0,_0x207c9f={},_0x3fd30e={};_0x2a6d28<_0x12d512[_0xb2f5('0x3d')];_0x2a6d28+=0x1){_0x207c9f=_0x12d512[_0x2a6d28];if(_['isUndefined'](_0x21c33b[_0xb2f5('0x16')][_0x207c9f['id']])){_0x21c33b['templates'][_0x207c9f['id']]=new Template(_0x207c9f);}else{_0x21c33b[_0xb2f5('0x3b')](_0x21c33b['templates'][_0x207c9f['id']],_0x207c9f);}}}return _0x21c33b[_0xb2f5('0x16')];};};Realtime['prototype'][_0xb2f5('0x45')]=function(){var _0x53497c=this;return function(_0x571379){if(_0x571379){freeIsNotKey(_0x571379,_0x53497c[_0xb2f5('0x46')],'id');for(var _0x9a740a=0x0,_0x1bd6ee={},_0x1872aa={};_0x9a740a<_0x571379[_0xb2f5('0x3d')];_0x9a740a+=0x1){_0x1bd6ee=_0x571379[_0x9a740a];if(_[_0xb2f5('0x3e')](_0x53497c['zendeskAccounts'][_0x1bd6ee['id']])){_0x53497c[_0xb2f5('0x46')][_0x1bd6ee['id']]=new ZendeskAccount(_0x1bd6ee);}else{_0x53497c[_0xb2f5('0x3b')](_0x53497c[_0xb2f5('0x46')][_0x1bd6ee['id']],_0x1bd6ee);}}}return _0x53497c[_0xb2f5('0x46')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x47')]=function(){var _0x239197=this;return function(_0x299398){if(_0x299398){freeIsNotKey(_0x299398,_0x239197[_0xb2f5('0x48')],'id');for(var _0x3deb36=0x0,_0xe82db5={},_0x40c9ec={};_0x3deb36<_0x299398[_0xb2f5('0x3d')];_0x3deb36+=0x1){_0xe82db5=_0x299398[_0x3deb36];if(_[_0xb2f5('0x3e')](_0x239197[_0xb2f5('0x48')][_0xe82db5['id']])){_0x239197[_0xb2f5('0x48')][_0xe82db5['id']]=new SalesforceAccount(_0xe82db5);}else{_0x239197[_0xb2f5('0x3b')](_0x239197[_0xb2f5('0x48')][_0xe82db5['id']],_0xe82db5);}}}return _0x239197[_0xb2f5('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x4c8dc6=this;return function(_0x4b1f52){if(_0x4b1f52){freeIsNotKey(_0x4b1f52,_0x4c8dc6[_0xb2f5('0x49')],'id');for(var _0x5946e1=0x0,_0x4400d0={},_0x5d53c4={};_0x5946e1<_0x4b1f52[_0xb2f5('0x3d')];_0x5946e1+=0x1){_0x4400d0=_0x4b1f52[_0x5946e1];if(_[_0xb2f5('0x3e')](_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']])){_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']]=new FreshdeskAccount(_0x4400d0);}else{_0x4c8dc6[_0xb2f5('0x3b')](_0x4c8dc6[_0xb2f5('0x49')][_0x4400d0['id']],_0x4400d0);}}}return _0x4c8dc6[_0xb2f5('0x49')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4a')]=function(){var _0x4bfaef=this;return function(_0x352054){if(_0x352054){freeIsNotKey(_0x352054,_0x4bfaef[_0xb2f5('0x4b')],'id');for(var _0x4d0efc=0x0,_0x157a76={},_0x32fe17={};_0x4d0efc<_0x352054[_0xb2f5('0x3d')];_0x4d0efc+=0x1){_0x157a76=_0x352054[_0x4d0efc];if(_[_0xb2f5('0x3e')](_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']])){_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']]=new ZohoAccount(_0x157a76);}else{_0x4bfaef[_0xb2f5('0x3b')](_0x4bfaef[_0xb2f5('0x4b')][_0x157a76['id']],_0x157a76);}}}return _0x4bfaef[_0xb2f5('0x4b')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4c')]=function(){var _0x49155d=this;return function(_0x524d76){if(_0x524d76){freeIsNotKey(_0x524d76,_0x49155d[_0xb2f5('0x4d')],'id');for(var _0x48cc5c=0x0,_0x32b045={},_0x322151={};_0x48cc5c<_0x524d76[_0xb2f5('0x3d')];_0x48cc5c+=0x1){_0x32b045=_0x524d76[_0x48cc5c];if(_['isUndefined'](_0x49155d['deskAccounts'][_0x32b045['id']])){_0x49155d[_0xb2f5('0x4d')][_0x32b045['id']]=new DeskAccount(_0x32b045);}else{_0x49155d['mergeFromDatabase'](_0x49155d[_0xb2f5('0x4d')][_0x32b045['id']],_0x32b045);}}}return _0x49155d[_0xb2f5('0x4d')];};};Realtime[_0xb2f5('0x3a')]['initSugarcrmAccounts']=function(){var _0x24ddb9=this;return function(_0x4ba2ae){if(_0x4ba2ae){freeIsNotKey(_0x4ba2ae,_0x24ddb9[_0xb2f5('0x1b')],'id');for(var _0x480957=0x0,_0xde6bb8={},_0x4bdaee={};_0x480957<_0x4ba2ae[_0xb2f5('0x3d')];_0x480957+=0x1){_0xde6bb8=_0x4ba2ae[_0x480957];if(_[_0xb2f5('0x3e')](_0x24ddb9[_0xb2f5('0x1b')][_0xde6bb8['id']])){_0x24ddb9['sugarcrmAccounts'][_0xde6bb8['id']]=new SugarcrmAccount(_0xde6bb8);}else{_0x24ddb9[_0xb2f5('0x3b')](_0x24ddb9[_0xb2f5('0x1b')][_0xde6bb8['id']],_0xde6bb8);}}}return _0x24ddb9[_0xb2f5('0x1b')];};};Realtime['prototype'][_0xb2f5('0x4e')]=function(){var _0xc54b41=this;return function(_0x57ec40){if(_0x57ec40){freeIsNotKey(_0x57ec40,_0xc54b41[_0xb2f5('0x1c')],'id');for(var _0x31984a=0x0,_0x31054e={},_0x1dbb83={};_0x31984a<_0x57ec40[_0xb2f5('0x3d')];_0x31984a+=0x1){_0x31054e=_0x57ec40[_0x31984a];if(_[_0xb2f5('0x3e')](_0xc54b41[_0xb2f5('0x1c')][_0x31054e['id']])){_0xc54b41[_0xb2f5('0x1c')][_0x31054e['id']]=new VtigerAccount(_0x31054e);}else{_0xc54b41[_0xb2f5('0x3b')](_0xc54b41['vtigerAccounts'][_0x31054e['id']],_0x31054e);}}}return _0xc54b41[_0xb2f5('0x1c')];};};Realtime[_0xb2f5('0x3a')]['initServicenowAccounts']=function(){var _0x1cb5e5=this;return function(_0x117760){if(_0x117760){freeIsNotKey(_0x117760,_0x1cb5e5[_0xb2f5('0x1d')],'id');for(var _0x21cb87=0x0,_0x5b9c0f={},_0x4ad35f={};_0x21cb87<_0x117760[_0xb2f5('0x3d')];_0x21cb87+=0x1){_0x5b9c0f=_0x117760[_0x21cb87];if(_[_0xb2f5('0x3e')](_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']])){_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']]=new ServicenowAccount(_0x5b9c0f);}else{_0x1cb5e5[_0xb2f5('0x3b')](_0x1cb5e5[_0xb2f5('0x1d')][_0x5b9c0f['id']],_0x5b9c0f);}}}return _0x1cb5e5[_0xb2f5('0x1d')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x4f')]=function(){var _0x12d483=this;return function(_0x36961a){if(_0x36961a){freeIsNotKey(_0x36961a,_0x12d483[_0xb2f5('0x50')],'id');for(var _0x5caf8d=0x0,_0x5b8ff9={},_0x300ead={};_0x5caf8d<_0x36961a[_0xb2f5('0x3d')];_0x5caf8d+=0x1){_0x5b8ff9=_0x36961a[_0x5caf8d];if(_[_0xb2f5('0x3e')](_0x12d483['dynamics365Accounts'][_0x5b8ff9['id']])){_0x12d483[_0xb2f5('0x50')][_0x5b8ff9['id']]=new Dynamics365Account(_0x5b8ff9);}else{_0x12d483[_0xb2f5('0x3b')](_0x12d483['dynamics365Accounts'][_0x5b8ff9['id']],_0x5b8ff9);}}}return _0x12d483['dynamics365Accounts'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x51')]=function(){var _0xe570=this;return function(_0x29da18){if(_0x29da18){freeIsNotKey(_0x29da18,_0xe570['freshsalesAccounts'],'id');for(var _0x3ec2df=0x0,_0x71eead={},_0xbcfbb8={};_0x3ec2df<_0x29da18[_0xb2f5('0x3d')];_0x3ec2df+=0x1){_0x71eead=_0x29da18[_0x3ec2df];if(_['isUndefined'](_0xe570[_0xb2f5('0x1e')][_0x71eead['id']])){_0xe570[_0xb2f5('0x1e')][_0x71eead['id']]=new FreshsalesAccount(_0x71eead);}else{_0xe570[_0xb2f5('0x3b')](_0xe570[_0xb2f5('0x1e')][_0x71eead['id']],_0x71eead);}}}return _0xe570[_0xb2f5('0x1e')];};};Realtime['prototype'][_0xb2f5('0x52')]=function(){var _0x3dba11=this;return function(_0x3bd32e){for(var _0x11af28=0x0;_0x11af28<_0x3bd32e[_0xb2f5('0x3d')];_0x11af28+=0x1){_[_0xb2f5('0x53')](_0x3dba11['voiceQueues'][_0x3bd32e[_0x11af28][_0xb2f5('0x23')]],_0x3bd32e[_0x11af28]);}return _0x3dba11['voiceQueues'];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x54')]=function(){var _0x1eea6e=this;return function(_0x446858){clearVoiceQueues(_0x1eea6e[_0xb2f5('0x41')]);if(_0x446858){_0x446858=_[_0xb2f5('0x55')](_0x446858,'uniqueid');for(var _0x226e4d in _0x446858){if(_0x446858[_0xb2f5('0x1f')](_0x226e4d)){var _0x36b22a={};for(var _0x438b08=0x0;_0x438b08<_0x446858[_0x226e4d][_0xb2f5('0x3d')];_0x438b08+=0x1){var _0x541869=_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x56')];if(_0x1eea6e['voiceQueues'][_0x541869]){if(_0x446858[_0x226e4d][_0x438b08]['queuecallerexit']){_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x2c')]+=0x1;}if(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x57')]){_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x2d')]+=0x1;}_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x58')]+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x59')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5b')]),'seconds')||0x0;if(_0x438b08===_0x446858[_0x226e4d][_0xb2f5('0x3d')]-0x1){_0x1eea6e['voiceQueues'][_0x541869]['sumDuration']+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5c')]||_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5d')]||_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5e')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5b')]),_0xb2f5('0x5f'))||0x0;_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x26')]+=0x1;if(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x60')]){_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x27')]+=0x1;_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x28')]+=moment(_0x446858[_0x226e4d][_0x438b08][_0xb2f5('0x5c')])[_0xb2f5('0x5a')](moment(_0x446858[_0x226e4d][_0x438b08]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x1eea6e['voiceQueues'][_0x541869][_0xb2f5('0x61')]+=_0x1eea6e[_0xb2f5('0x41')][_0x541869][_0xb2f5('0x58')]||0x0;}}}}}}return _0x1eea6e[_0xb2f5('0x41')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x62')]=function(){var _0x5a4e31=this;return function(_0x41a0ac){clearVoiceCallReports(_0x5a4e31[_0xb2f5('0x63')]);if(_0x41a0ac){for(var _0x10fa58=0x0;_0x10fa58<_0x41a0ac[_0xb2f5('0x3d')];_0x10fa58+=0x1){_0x5a4e31['outbound'][_0xb2f5('0x26')]+=0x1;_0x5a4e31[_0xb2f5('0x63')]['sumDuration']+=_0x41a0ac[_0x10fa58][_0xb2f5('0x64')];if(_0x41a0ac[_0x10fa58][_0xb2f5('0x65')]==='ANSWERED'){_0x5a4e31['outbound']['answered']+=0x1;_0x5a4e31[_0xb2f5('0x63')][_0xb2f5('0x58')]+=_0x41a0ac[_0x10fa58][_0xb2f5('0x64')]-_0x41a0ac[_0x10fa58][_0xb2f5('0x66')]||0x0;_0x5a4e31['outbound']['sumBillable']+=_0x41a0ac[_0x10fa58][_0xb2f5('0x66')];}}}return _0x5a4e31[_0xb2f5('0x63')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x67')]=function(){var _0x4aed5c=this;return function(_0x18e367){if(_0x18e367){freeIsNotKey(_0x18e367,_0x4aed5c[_0xb2f5('0x15')],_0xb2f5('0x23'));for(var _0x116728=0x0,_0x396d4b={};_0x116728<_0x18e367[_0xb2f5('0x3d')];_0x116728+=0x1){_0x396d4b=_0x18e367[_0x116728];if(_[_0xb2f5('0x3e')](_0x4aed5c[_0xb2f5('0x15')][_0x396d4b[_0xb2f5('0x23')]])){_0x4aed5c['campaigns'][_0x396d4b[_0xb2f5('0x23')]]=new Campaign(_0x396d4b);}else{_0x4aed5c[_0xb2f5('0x3b')](_0x4aed5c[_0xb2f5('0x15')][_0x396d4b['name']],_0x396d4b);_0x4aed5c[_0xb2f5('0x15')][_0x396d4b[_0xb2f5('0x23')]][_0xb2f5('0x68')]=_0x396d4b[_0xb2f5('0x69')]?_0x396d4b[_0xb2f5('0x69')][_0xb2f5('0x23')]:undefined;}}}return _0x4aed5c[_0xb2f5('0x15')];};};Realtime['prototype'][_0xb2f5('0x6a')]=function(){var _0x5e1f7c=this;return function(_0x547971){if(_0x547971){freeIsNotKey(_0x547971,_0x5e1f7c[_0xb2f5('0x17')],'id');for(var _0x567d71=0x0,_0x4765a0={};_0x567d71<_0x547971[_0xb2f5('0x3d')];_0x567d71+=0x1){_0x4765a0=_0x547971[_0x567d71];if(_[_0xb2f5('0x3e')](_0x5e1f7c['voiceExtensions'][_0x4765a0['id']])){_0x5e1f7c[_0xb2f5('0x17')][_0x4765a0['id']]=new VoiceExtension(_0x4765a0);}else{_0x5e1f7c[_0xb2f5('0x3b')](_0x5e1f7c[_0xb2f5('0x17')][_0x4765a0['id']],_0x4765a0);}}}return _0x5e1f7c[_0xb2f5('0x17')];};};Realtime[_0xb2f5('0x3a')][_0xb2f5('0x6b')]=function(){var _0x32717a=this;return function(_0x539b19){clearCampaigns(_0x32717a[_0xb2f5('0x15')]);for(var _0x6a2137=0x0;_0x6a2137<_0x539b19['length'];_0x6a2137+=0x1){_['merge'](_0x32717a[_0xb2f5('0x15')][_0x539b19[_0x6a2137][_0xb2f5('0x23')]],_0x539b19[_0x6a2137]);}return _0x32717a[_0xb2f5('0x15')];};};Realtime['prototype'][_0xb2f5('0x6c')]=function(){var _0x5d4acd=this;return function(_0x5e43d3){if(_0x5e43d3){freeIsNotKey(_0x5e43d3,_0x5d4acd[_0xb2f5('0x6d')],'id');for(var _0x412746=0x0,_0x3515c3={},_0x2f34cf={};_0x412746<_0x5e43d3[_0xb2f5('0x3d')];_0x412746+=0x1){_0x3515c3=_0x5e43d3[_0x412746];if(_[_0xb2f5('0x3e')](_0x5d4acd['faxAccounts'][_0x3515c3['id']])){_0x5d4acd[_0xb2f5('0x6d')][_0x3515c3['id']]=new FaxAccount(_0x3515c3);}else{_0x5d4acd[_0xb2f5('0x3b')](_0x5d4acd['faxAccounts'][_0x3515c3['id']],_0x3515c3);}}}return _0x5d4acd[_0xb2f5('0x6d')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9ca1964..2681a79 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 _0x945e=['disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitors','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','phone','substring','lastIndexOf','voiceDialReport','transfererlinkedid','attendedTransfer','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','attendedtransfer','name','find','accountcode','interface','format','SIP/%s','voiceQueueReport','length','findAgent','lastAssignedTo','isNil','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0x945e,0xd4));var _0xe945=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x945e[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var moment=require(_0xe945('0x0'));var util=require(_0xe945('0x1'));var config=require(_0xe945('0x2'));var ami=require(_0xe945('0x3'));var RpcVoiceAgentReport=require(_0xe945('0x4'));var RpcVoiceCallReport=require(_0xe945('0x5'));var RpcVoiceDialReport=require(_0xe945('0x6'));var RpcMemberReport=require(_0xe945('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xe945('0x8'));var RpcVoiceTransferReport=require(_0xe945('0x9'));var VoiceQueueReport=require(_0xe945('0xa'));var VoiceCallReport=require(_0xe945('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xe945('0xc'));var UserReport=require(_0xe945('0xd'));function Report(_0x3fc21b){this['realtime']=_0x3fc21b;this[_0xe945('0xe')]=_0x3fc21b[_0xe945('0xe')];this[_0xe945('0xf')]=_0x3fc21b[_0xe945('0xf')];}Report[_0xe945('0x10')]['sync']=function(_0x25d9fd){var _0x1b6f54=new VoiceQueueReport(this['realtime']);var _0x2c2508=new VoiceAgentReport(this[_0xe945('0x11')]);var _0x22c2c5=new VoiceDialReport(this['realtime']);var _0x187a93=new VoiceCallReport(this['realtime']);var _0x1873f0=new UserReport(this['realtime']);if(config['xdr']&&config[_0xe945('0x12')][_0xe945('0x13')]){ami['on'](_0xe945('0x14'),this['voiceQueueReport'][_0xe945('0x15')](this));ami['on'](_0xe945('0x16'),this[_0xe945('0x17')][_0xe945('0x15')](this));ami['on'](_0xe945('0x18'),this[_0xe945('0x19')]['bind'](this));ami['on'](_0xe945('0x1a'),this['voiceDialReport'][_0xe945('0x15')](this));ami['on']('blindtransfer',this[_0xe945('0x1b')][_0xe945('0x15')](this));ami['on'](_0xe945('0x1c'),this['attendedTransfer'][_0xe945('0x15')](this));}};Report['prototype']['findAgent']=function(_0x3ddc0a){var _0x4b28cb;_0x4b28cb=_['find'](this[_0xe945('0xe')],function(_0x165ea3){return _0x165ea3['accountcode']==_0x3ddc0a||_0x165ea3[_0xe945('0x1d')]==_0x3ddc0a;});if(_['isNil'](_0x4b28cb)){var _0xd3d7c8=_[_0xe945('0x1e')](this[_0xe945('0xf')],function(_0xb4f79f){return _0xb4f79f[_0xe945('0x1f')]==_0x3ddc0a||_0xb4f79f[_0xe945('0x1d')]==_0x3ddc0a;});if(_0xd3d7c8){_0x4b28cb=_[_0xe945('0x1e')](this['agents'],function(_0x478d8a){return _0x478d8a[_0xe945('0x20')]==util[_0xe945('0x21')](_0xe945('0x22'),_0xd3d7c8['name']);});}}return _0x4b28cb;};Report[_0xe945('0x10')][_0xe945('0x23')]=function(_0x2e8761){for(var _0x51e000=0x0;_0x51e000<_0x2e8761[_0xe945('0x24')];_0x51e000+=0x1){var _0x2b4306=this[_0xe945('0x25')](_0x2e8761[_0x51e000]['connectedlinenum']);if(_0x2b4306){_0x2e8761[_0x51e000][_0xe945('0x1f')]=_0x2b4306[_0xe945('0x1f')];_0x2e8761[_0x51e000]['assigned']=!![];_0x2e8761[_0x51e000][_0xe945('0x26')]=_0x2b4306[_0xe945('0x1d')];_0x2e8761[_0x51e000][_0xe945('0x20')]=_[_0xe945('0x27')](_0x2b4306['interface'])?util['format']('SIP/%s',_0x2b4306['name']):_0x2b4306[_0xe945('0x20')];if(_0x2e8761[_0x51e000]['queuecallercomplete']){_0x2e8761[_0x51e000][_0xe945('0x28')]=moment()[_0xe945('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2e8761[_0x51e000]['queuecallerexit']){_0x2e8761[_0x51e000]['queuecallerexitAt']=moment()[_0xe945('0x21')](_0xe945('0x29'));}RpcMemberReport[_0xe945('0x23')](_0x2e8761[_0x51e000]);}RpcVoiceQueueReport[_0xe945('0x2a')](_0x2e8761[_0x51e000]);}};function extractCalleridNumber(_0x7de48d){var _0x269c23=_0x7de48d[_0xe945('0x2b')](/<(.*?)>/);return _0x269c23?_0x269c23[0x1]:_0x7de48d;}Report[_0xe945('0x10')][_0xe945('0x2c')]=function(_0x248fe2){for(var _0x1b6374=0x0;_0x1b6374','calleridname','transfers','linkedid','uniqueid','blindTransfer','split','UserId','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf'];(function(_0x430892,_0x30c05d){var _0xdd8af7=function(_0x35ccc9){while(--_0x35ccc9){_0x430892['push'](_0x430892['shift']());}};_0xdd8af7(++_0x30c05d);}(_0xedd9,0x1d8));var _0x9edd=function(_0x4b1ff9,_0x22f764){_0x4b1ff9=_0x4b1ff9-0x0;var _0x548df3=_0xedd9[_0x4b1ff9];return _0x548df3;};'use strict';var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var config=require(_0x9edd('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x9edd('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x9edd('0x5'));var RpcMemberReport=require(_0x9edd('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x9edd('0x7'));var RpcVoiceTransferReport=require(_0x9edd('0x8'));var VoiceQueueReport=require(_0x9edd('0x9'));var VoiceCallReport=require(_0x9edd('0xa'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9edd('0xb'));var UserReport=require(_0x9edd('0xc'));function Report(_0x33aace){this['realtime']=_0x33aace;this[_0x9edd('0xd')]=_0x33aace[_0x9edd('0xd')];this[_0x9edd('0xe')]=_0x33aace['telephones'];}Report[_0x9edd('0xf')][_0x9edd('0x10')]=function(_0x241e15){var _0x1445a7=new VoiceQueueReport(this[_0x9edd('0x11')]);var _0x4657d4=new VoiceAgentReport(this['realtime']);var _0x5f5c09=new VoiceDialReport(this['realtime']);var _0xddd307=new VoiceCallReport(this['realtime']);var _0x3e297d=new UserReport(this[_0x9edd('0x11')]);if(config[_0x9edd('0x12')]&&config[_0x9edd('0x12')][_0x9edd('0x13')]){ami['on'](_0x9edd('0x14'),this[_0x9edd('0x15')][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x17'),this[_0x9edd('0x18')][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x19'),this['voiceAgentReport'][_0x9edd('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x9edd('0x16')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x9edd('0x16')](this));ami['on'](_0x9edd('0x1a'),this['attendedTransfer'][_0x9edd('0x16')](this));}};Report[_0x9edd('0xf')][_0x9edd('0x1b')]=function(_0x22bc0e){var _0x5ed25c;_0x5ed25c=_['find'](this['agents'],function(_0x2e5ee6){return _0x2e5ee6[_0x9edd('0x1c')]==_0x22bc0e||_0x2e5ee6[_0x9edd('0x1d')]==_0x22bc0e;});if(_[_0x9edd('0x1e')](_0x5ed25c)){var _0x5837ee=_['find'](this[_0x9edd('0xe')],function(_0x226513){return _0x226513[_0x9edd('0x1c')]==_0x22bc0e||_0x226513['name']==_0x22bc0e;});if(_0x5837ee){_0x5ed25c=_[_0x9edd('0x1f')](this[_0x9edd('0xd')],function(_0x175bb0){return _0x175bb0[_0x9edd('0x20')]==util[_0x9edd('0x21')](_0x9edd('0x22'),_0x5837ee['name']);});}}return _0x5ed25c;};Report[_0x9edd('0xf')]['voiceQueueReport']=function(_0x590ac0){for(var _0x31d664=0x0;_0x31d664<_0x590ac0[_0x9edd('0x23')];_0x31d664+=0x1){var _0x4a7e63=this[_0x9edd('0x1b')](_0x590ac0[_0x31d664][_0x9edd('0x24')]);if(_0x4a7e63){_0x590ac0[_0x31d664][_0x9edd('0x1c')]=_0x4a7e63[_0x9edd('0x1c')];_0x590ac0[_0x31d664][_0x9edd('0x25')]=!![];_0x590ac0[_0x31d664][_0x9edd('0x26')]=_0x4a7e63[_0x9edd('0x1d')];_0x590ac0[_0x31d664][_0x9edd('0x20')]=_[_0x9edd('0x1e')](_0x4a7e63[_0x9edd('0x20')])?util[_0x9edd('0x21')](_0x9edd('0x22'),_0x4a7e63[_0x9edd('0x1d')]):_0x4a7e63[_0x9edd('0x20')];if(_0x590ac0[_0x31d664][_0x9edd('0x27')]){_0x590ac0[_0x31d664]['queuecallercompleteAt']=moment()[_0x9edd('0x21')](_0x9edd('0x28'));}if(_0x590ac0[_0x31d664][_0x9edd('0x29')]){_0x590ac0[_0x31d664]['queuecallerexitAt']=moment()[_0x9edd('0x21')](_0x9edd('0x28'));}RpcMemberReport[_0x9edd('0x15')](_0x590ac0[_0x31d664]);}RpcVoiceQueueReport[_0x9edd('0x2a')](_0x590ac0[_0x31d664]);}};function extractCalleridNumber(_0x360a35){var _0x5662ad=_0x360a35[_0x9edd('0x2b')](/<(.*?)>/);return _0x5662ad?_0x5662ad[0x1]:_0x360a35;}Report[_0x9edd('0xf')][_0x9edd('0x2c')]=function(_0x1db543){for(var _0x3bc790=0x0;_0x3bc7900x0?_0x3b431d:0x0;this[_0x48c3('0x11')][_0x5ade3b[_0x48c3('0x67')]][_0x48c3('0x2c')]=this[_0x48c3('0x11')][_0x5ade3b['queue']][_0x48c3('0x2c')]>_['toNumber'](_0x5ade3b[_0x48c3('0x6d')])?_[_0x48c3('0x6e')](_0x5ade3b['loggedin']):this[_0x48c3('0x11')][_0x5ade3b[_0x48c3('0x67')]]['talking'];this[_0x48c3('0x6f')](this[_0x48c3('0x11')][_0x5ade3b['queue']],'queuesummary');}logger['debug'](_0x48c3('0x70'),util[_0x48c3('0x39')](this[_0x48c3('0x11')][_0x5ade3b['queue']],{'showHidden':![],'depth':null}));ami[_0x48c3('0x41')](_0x48c3('0x71'),this['voiceQueues'][_0x5ade3b[_0x48c3('0x67')]]);}}}catch(_0xd4fde0){logger[_0x48c3('0x37')](_0x48c3('0x64'),util[_0x48c3('0x39')](_0xd4fde0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48c3('0xa')]['syncQueueSummaryComplete']=function(_0x4150db){logger[_0x48c3('0x43')](_0x48c3('0x72'),util[_0x48c3('0x39')](_0x4150db,{'showHidden':![],'depth':null}));this[_0x48c3('0x12')]=!![];};VoiceQueueReport[_0x48c3('0xa')][_0x48c3('0x18')]=function(_0x1b8e2d){try{if(this['isNotNull'](_0x1b8e2d)){logger[_0x48c3('0x43')](_0x48c3('0x73'),_0x1b8e2d[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x1b8e2d,{'showHidden':![],'depth':null}));if(_[_0x48c3('0x74')](this[_0x48c3('0xe')][_0x1b8e2d['uniqueid']]))this['queueReports'][_0x1b8e2d[_0x48c3('0x4b')]]=[];if(_[_0x48c3('0x74')](this[_0x48c3('0x10')][_0x1b8e2d['uniqueid']]))this['channels'][_0x1b8e2d[_0x48c3('0x4b')]]={};var _0x52bb87=new QueueReport();_0x52bb87[_0x48c3('0x48')]=_0x1b8e2d[_0x48c3('0x67')];_0x52bb87['type']=this['voiceQueues'][_0x52bb87[_0x48c3('0x48')]]&&this[_0x48c3('0x11')][_0x52bb87['name']][_0x48c3('0x4e')]?this[_0x48c3('0x11')][_0x52bb87[_0x48c3('0x48')]][_0x48c3('0x4e')]||_0x48c3('0x4f'):_0x48c3('0x4f');_0x52bb87[_0x48c3('0x67')]=_0x1b8e2d[_0x48c3('0x67')];_0x52bb87[_0x48c3('0x75')]=moment()[_0x48c3('0x46')](_0x48c3('0x76'));_0x52bb87[_0x48c3('0x77')]=_0x1b8e2d['position'];_0x52bb87[_0x48c3('0x78')]=_0x1b8e2d['count'];_0x52bb87[_0x48c3('0x4b')]=_0x1b8e2d[_0x48c3('0x4b')];_0x52bb87[_0x48c3('0x79')]=this['channels'][_0x1b8e2d['uniqueid']][_0x48c3('0x79')];logger[_0x48c3('0x69')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x52bb87[_0x48c3('0x48')],_0x52bb87['type']);_['merge'](_0x52bb87,_[_0x48c3('0x7a')](_0x1b8e2d,_[_0x48c3('0x7b')](_0x52bb87)));this[_0x48c3('0xe')][_0x1b8e2d[_0x48c3('0x4b')]][_0x48c3('0x7c')](_0x52bb87);this['channels'][_0x1b8e2d[_0x48c3('0x4b')]]=_0x52bb87;this[_0x48c3('0x42')](_0x52bb87,_0x48c3('0x17'));}}catch(_0x4059c4){logger[_0x48c3('0x37')](_0x48c3('0x73'),_0x1b8e2d['uniqueid'],util['inspect'](_0x4059c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x1f165f){try{if(this[_0x48c3('0x66')](_0x1f165f)){logger['debug'](_0x48c3('0x7d'),_0x1f165f[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x1f165f,{'showHidden':![],'depth':null}));if(this[_0x48c3('0xe')][_0x1f165f['uniqueid']]){var _0x361d2b=_[_0x48c3('0x7e')](this[_0x48c3('0xe')][_0x1f165f['uniqueid']]);_0x361d2b[_0x48c3('0x7f')]=![];_0x361d2b[_0x48c3('0x80')]=null;_0x361d2b[_0x48c3('0x81')]=_0x1f165f['holdtime'];_0x361d2b[_0x48c3('0x82')]=_0x1f165f[_0x48c3('0x82')];_0x361d2b['queuecallerabandon']=!![];_0x361d2b['queuecallerabandonAt']=moment()[_0x48c3('0x46')](_0x48c3('0x76'));_0x361d2b['queuecallerexitreason']=_0x48c3('0x83');_0x361d2b['lastAssignedTo']=null;logger[_0x48c3('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x361d2b[_0x48c3('0x48')],_0x361d2b[_0x48c3('0x4e')]);this[_0x48c3('0x10')][_0x1f165f['uniqueid']]=_0x361d2b;this[_0x48c3('0x3f')](_0x361d2b,_0x48c3('0x19'));}}}catch(_0x5966fc){logger['error'](_0x48c3('0x7d'),_0x1f165f[_0x48c3('0x4b')],util['inspect'](_0x5966fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48c3('0xa')][_0x48c3('0x1a')]=function(_0x5ab506){try{if(this[_0x48c3('0x66')](_0x5ab506)){logger['debug'](_0x48c3('0x84'),_0x5ab506['uniqueid'],util[_0x48c3('0x39')](_0x5ab506,{'showHidden':![],'depth':null}));if(this[_0x48c3('0xe')][_0x5ab506[_0x48c3('0x4b')]]){var _0x509bfb=_[_0x48c3('0x7e')](this['queueReports'][_0x5ab506[_0x48c3('0x4b')]]);_0x509bfb['queuecallerleaveAt']=moment()[_0x48c3('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x509bfb[_0x48c3('0x85')]=_0x5ab506[_0x48c3('0x85')];_0x509bfb['connectedlinename']=_0x5ab506[_0x48c3('0x86')];logger[_0x48c3('0x69')](_0x48c3('0x87'),_0x509bfb['name'],_0x509bfb[_0x48c3('0x4e')],_0x5ab506['connectedlinenum'],_0x5ab506[_0x48c3('0x86')]);this[_0x48c3('0x10')][_0x5ab506[_0x48c3('0x4b')]]=_0x509bfb;this['emitVoiceQueueChannelSave'](_0x509bfb,_0x48c3('0x88'));}}}catch(_0x2190b5){logger[_0x48c3('0x37')](_0x48c3('0x84'),_0x5ab506[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x2190b5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x5c2d26){try{if(this[_0x48c3('0x66')](_0x5c2d26)){logger['debug'](_0x48c3('0x89'),_0x5c2d26[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x5c2d26,{'showHidden':![],'depth':null}));if(this[_0x48c3('0xe')][_0x5c2d26[_0x48c3('0x4b')]]){var _0x349c5a=_[_0x48c3('0x7e')](this[_0x48c3('0xe')][_0x5c2d26[_0x48c3('0x4b')]]);_0x349c5a[_0x48c3('0x7f')]=!![];_0x349c5a[_0x48c3('0x8a')]='COMPLETEDBYAGENT';logger[_0x48c3('0x69')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x349c5a[_0x48c3('0x48')],_0x349c5a[_0x48c3('0x4e')]);}}}catch(_0x3870d7){logger[_0x48c3('0x37')](_0x48c3('0x89'),_0x5c2d26[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x3870d7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48c3('0xa')][_0x48c3('0x1c')]=function(_0x254861){try{if(this[_0x48c3('0x66')](_0x254861)){logger[_0x48c3('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x254861['uniqueid'],util[_0x48c3('0x39')](_0x254861,{'showHidden':![],'depth':null}));if(this[_0x48c3('0xe')][_0x254861[_0x48c3('0x4b')]]){var _0x3be25a=_['last'](this[_0x48c3('0xe')][_0x254861['uniqueid']]);_0x3be25a['queuecallerabandon']=![];_0x3be25a[_0x48c3('0x8b')]=null;_0x3be25a[_0x48c3('0x8c')]=!![];_0x3be25a[_0x48c3('0x8d')]=_0x254861[_0x48c3('0x8e')];_0x3be25a[_0x48c3('0x81')]=_0x254861['holdtime'];_0x3be25a[_0x48c3('0x7f')]=!![];_0x3be25a[_0x48c3('0x8f')]=![];_0x3be25a[_0x48c3('0x90')]=null;if(!_0x3be25a[_0x48c3('0x91')]){if(_0x254861[_0x48c3('0x92')]==_0x48c3('0x91')){_0x3be25a['queuecallerexitreason']=_0x48c3('0x93');logger[_0x48c3('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3be25a[_0x48c3('0x48')],_0x3be25a['type']);}else{if(_[_0x48c3('0x94')](_0x254861[_0x48c3('0x33')][_0x48c3('0x95')](),'local/')){if(this[_0x48c3('0xe')][_0x254861[_0x48c3('0x96')]]){var _0x16fd8c=_[_0x48c3('0x7e')](this[_0x48c3('0xe')][_0x254861[_0x48c3('0x96')]]);_0x16fd8c[_0x48c3('0x7f')]=![];_0x16fd8c[_0x48c3('0x8f')]=!![];_0x16fd8c[_0x48c3('0x90')]=moment(_0x3be25a[_0x48c3('0x75')])[_0x48c3('0x97')](_0x254861[_0x48c3('0x81')],_0x48c3('0x98'))['format'](_0x48c3('0x76'));_0x16fd8c[_0x48c3('0x8a')]=_0x48c3('0x99');_0x16fd8c[_0x48c3('0x91')]=!![];_0x16fd8c[_0x48c3('0x9a')]=_0x48c3('0x9b');_0x16fd8c[_0x48c3('0x9c')]=_0x254861[_0x48c3('0x9d')];_0x16fd8c[_0x48c3('0x9e')]=_0x254861['uniqueid'];logger['info'](_0x48c3('0x9f'),_0x16fd8c[_0x48c3('0x48')],_0x16fd8c[_0x48c3('0x4e')]);var _0x12e916=this[_0x48c3('0xe')][_0x254861[_0x48c3('0x96')]];this['queueReports'][_0x254861[_0x48c3('0x96')]]=this['queueReports'][_0x254861[_0x48c3('0x4b')]];this[_0x48c3('0xe')][_0x254861[_0x48c3('0x4b')]]=_0x12e916;}}else{_0x3be25a[_0x48c3('0x8a')]=_0x48c3('0xa0')+_0x254861[_0x48c3('0x92')]['toUpperCase']();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3be25a[_0x48c3('0x48')],_0x3be25a['type'],_0x3be25a[_0x48c3('0x8a')]);}}}this[_0x48c3('0x10')][_0x254861['uniqueid']]=_0x3be25a;this[_0x48c3('0x3f')](_0x3be25a,'agentcomplete');}}}catch(_0x13eb11){logger[_0x48c3('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x254861['uniqueid'],util[_0x48c3('0x39')](_0x13eb11,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x48c3('0x20')]=function(_0x3e4f00){try{if(this[_0x48c3('0x66')](_0x3e4f00)){logger[_0x48c3('0x43')](_0x48c3('0xa1'),_0x3e4f00[_0x48c3('0x4b')],util['inspect'](_0x3e4f00,{'showHidden':![],'depth':null}));this['addVariable'](_0x3e4f00['uniqueid'],_[_0x48c3('0x7b')](_0x3e4f00['variable'])[0x0],_0x3e4f00[_0x48c3('0xa2')]);if(this['queueReports'][_0x3e4f00['uniqueid']]){var _0x22d0ca=_[_0x48c3('0x7e')](this[_0x48c3('0xe')][_0x3e4f00['uniqueid']]);if(_0x22d0ca){if(this[_0x48c3('0x66')](_0x3e4f00[_0x48c3('0xa3')])&&this[_0x48c3('0x66')](_0x3e4f00[_0x48c3('0xa3')][_0x48c3('0xa4')])){switch(_0x3e4f00[_0x48c3('0xa2')]){case'CONTINUE':_0x22d0ca[_0x48c3('0x8f')]=![];_0x22d0ca[_0x48c3('0x90')]=null;break;case'TIMEOUT':_0x22d0ca[_0x48c3('0xa5')]='timeout';_0x22d0ca[_0x48c3('0x8f')]=!![];_0x22d0ca[_0x48c3('0x90')]=moment()[_0x48c3('0x46')](_0x48c3('0x76'));_0x22d0ca['queuecallerleaveAt']=moment()[_0x48c3('0x46')](_0x48c3('0x76'));logger[_0x48c3('0x43')](_0x48c3('0xa6'),_0x3e4f00[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x22d0ca,{'showHidden':![],'depth':null}));ami['emit'](_0x48c3('0xa7'),_0x22d0ca);break;default:_0x22d0ca[_0x48c3('0x8f')]=!![];_0x22d0ca[_0x48c3('0x90')]=moment()['format'](_0x48c3('0x76'));_0x22d0ca[_0x48c3('0xa8')]=moment()['format'](_0x48c3('0x76'));}_0x22d0ca[_0x48c3('0x19')]=![];_0x22d0ca['queuecallerabandonAt']=null;_0x22d0ca['queuecallerexitreason']=_0x3e4f00[_0x48c3('0xa2')];this[_0x48c3('0x10')][_0x3e4f00['uniqueid']]=_0x22d0ca;this['emitVoiceQueueChannelRemove'](_0x22d0ca,_0x48c3('0x1f'));}else if(this[_0x48c3('0x66')](_0x3e4f00[_0x48c3('0xa3')])&&this[_0x48c3('0x66')](_0x3e4f00[_0x48c3('0xa3')][_0x48c3('0xa9')])){if(!_0x22d0ca[_0x48c3('0x19')]){_0x22d0ca[_0x48c3('0x8f')]=!![];_0x22d0ca[_0x48c3('0x90')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22d0ca[_0x48c3('0x8a')]='EXITWITHKEY';_0x22d0ca['queuecallerleaveAt']=moment()[_0x48c3('0x46')](_0x48c3('0x76'));this['channels'][_0x3e4f00[_0x48c3('0x4b')]]=_0x22d0ca;}}logger[_0x48c3('0x69')](_0x48c3('0xaa'),_0x3e4f00[_0x48c3('0x4b')],_0x22d0ca[_0x48c3('0x48')],_0x22d0ca[_0x48c3('0x4e')],_[_0x48c3('0x7b')](_0x3e4f00[_0x48c3('0xa3')])[0x0],_0x3e4f00[_0x48c3('0xa2')]);_0x22d0ca[_0x48c3('0x3b')]=this[_0x48c3('0x3b')][_0x3e4f00[_0x48c3('0x4b')]];}}}}catch(_0x2e10f7){logger[_0x48c3('0x37')](_0x48c3('0xa1'),_0x3e4f00['uniqueid'],util[_0x48c3('0x39')](_0x2e10f7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x48c3('0xa')][_0x48c3('0xab')]=function(_0x3999d1,_0x580108,_0x27174d){var _0x49c014=['rtpaudioqos',_0x48c3('0xac'),_0x48c3('0xad'),_0x48c3('0xae'),_0x48c3('0xaf'),_0x48c3('0xb0'),_0x48c3('0xb1'),_0x48c3('0xb2'),_0x48c3('0xb3'),_0x48c3('0xb4'),_0x48c3('0xb5'),'bridgepvtcallid',_0x48c3('0xb6'),_0x48c3('0xb7'),_0x48c3('0xb8'),_0x48c3('0xb9'),_0x48c3('0x8e'),_0x48c3('0xba'),_0x48c3('0xbb')];if(!_['isNil'](_0x580108)&&!_['includes'](_0x49c014,_0x580108)){if(_[_0x48c3('0x74')](this[_0x48c3('0x3b')][_0x3999d1])){this[_0x48c3('0x3b')][_0x3999d1]={};}this[_0x48c3('0x3b')][_0x3999d1][_0x580108]=_0x27174d;}};VoiceQueueReport[_0x48c3('0xa')][_0x48c3('0x22')]=function(_0x25f5ba){try{if(this[_0x48c3('0x66')](_0x25f5ba)){logger[_0x48c3('0x43')]('[%s][voiceQueueReport][hangup]',_0x25f5ba[_0x48c3('0x4b')],util[_0x48c3('0x39')](_0x25f5ba,{'showHidden':![],'depth':null}));if(this[_0x48c3('0xe')][_0x25f5ba[_0x48c3('0x4b')]]){for(var _0x42413f=0x0,_0x57f764={};_0x42413f0x0?_0xc8cb4c:0x0;this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]]['talking']=this['voiceQueues'][_0x80ffe7[_0xb5c2('0x6b')]]['talking']>_[_0xb5c2('0x6d')](_0x80ffe7[_0xb5c2('0x6f')])?_['toNumber'](_0x80ffe7[_0xb5c2('0x6f')]):this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]][_0xb5c2('0x57')];this[_0xb5c2('0x4f')](this[_0xb5c2('0x14')][_0x80ffe7[_0xb5c2('0x6b')]],_0xb5c2('0x17'));}logger[_0xb5c2('0x5c')](_0xb5c2('0x70'),util[_0xb5c2('0x3a')](this['voiceQueues'][_0x80ffe7[_0xb5c2('0x6b')]],{'showHidden':![],'depth':null}));ami[_0xb5c2('0x41')](_0xb5c2('0x71'),this[_0xb5c2('0x14')][_0x80ffe7['queue']]);}}}catch(_0x2678cb){logger[_0xb5c2('0x3c')](_0xb5c2('0x67'),util[_0xb5c2('0x3a')](_0x2678cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x1b')]=function(_0x43b3be){logger[_0xb5c2('0x5c')](_0xb5c2('0x72'),util[_0xb5c2('0x3a')](_0x43b3be,{'showHidden':![],'depth':null}));this[_0xb5c2('0x65')]=!![];};VoiceQueueReport['prototype'][_0xb5c2('0x73')]=function(_0x51ee5d){try{if(this['isNotNull'](_0x51ee5d)){logger[_0xb5c2('0x5c')](_0xb5c2('0x74'),_0x51ee5d['uniqueid'],util['inspect'](_0x51ee5d,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x51ee5d[_0xb5c2('0x45')]]))this[_0xb5c2('0x11')][_0x51ee5d[_0xb5c2('0x45')]]=[];if(_[_0xb5c2('0x75')](this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]))this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]={};var _0xc61b88=new QueueReport();_0xc61b88[_0xb5c2('0x4d')]=_0x51ee5d[_0xb5c2('0x6b')];_0xc61b88[_0xb5c2('0x76')]=this[_0xb5c2('0x14')][_0xc61b88[_0xb5c2('0x4d')]]&&this['voiceQueues'][_0xc61b88[_0xb5c2('0x4d')]][_0xb5c2('0x76')]?this[_0xb5c2('0x14')][_0xc61b88['name']][_0xb5c2('0x76')]||'inbound':_0xb5c2('0x50');_0xc61b88[_0xb5c2('0x6b')]=_0x51ee5d[_0xb5c2('0x6b')];_0xc61b88[_0xb5c2('0x77')]=moment()['format'](_0xb5c2('0x78'));_0xc61b88[_0xb5c2('0x79')]=_0x51ee5d['position'];_0xc61b88[_0xb5c2('0x7a')]=_0x51ee5d[_0xb5c2('0x7a')];_0xc61b88[_0xb5c2('0x45')]=_0x51ee5d['uniqueid'];_0xc61b88['routealias']=this[_0xb5c2('0x13')][_0x51ee5d[_0xb5c2('0x45')]]['routealias'];logger[_0xb5c2('0x69')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xc61b88[_0xb5c2('0x4d')],_0xc61b88['type']);_['merge'](_0xc61b88,_[_0xb5c2('0x7b')](_0x51ee5d,_['keys'](_0xc61b88)));this[_0xb5c2('0x11')][_0x51ee5d[_0xb5c2('0x45')]]['push'](_0xc61b88);this['channels'][_0x51ee5d[_0xb5c2('0x45')]]=_0xc61b88;this[_0xb5c2('0x42')](_0xc61b88,_0xb5c2('0x1c'));}}catch(_0x51ee96){logger[_0xb5c2('0x3c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x51ee5d[_0xb5c2('0x45')],util['inspect'](_0x51ee96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x1d')]=function(_0x484637){try{if(this[_0xb5c2('0x5f')](_0x484637)){logger[_0xb5c2('0x5c')](_0xb5c2('0x7c'),_0x484637[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x484637,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x484637[_0xb5c2('0x45')]]){var _0x29121f=_['last'](this[_0xb5c2('0x11')][_0x484637[_0xb5c2('0x45')]]);_0x29121f['queuecallercomplete']=![];_0x29121f[_0xb5c2('0x7d')]=null;_0x29121f[_0xb5c2('0x7e')]=_0x484637['holdtime'];_0x29121f[_0xb5c2('0x7f')]=_0x484637[_0xb5c2('0x7f')];_0x29121f['queuecallerabandon']=!![];_0x29121f[_0xb5c2('0x80')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x29121f['queuecallerexitreason']=_0xb5c2('0x81');_0x29121f[_0xb5c2('0x82')]=null;logger[_0xb5c2('0x69')](_0xb5c2('0x83'),_0x29121f[_0xb5c2('0x4d')],_0x29121f[_0xb5c2('0x76')]);this[_0xb5c2('0x13')][_0x484637[_0xb5c2('0x45')]]=_0x29121f;this[_0xb5c2('0x84')](_0x29121f,'queuecallerabandon');}}}catch(_0x6d2af6){logger[_0xb5c2('0x3c')](_0xb5c2('0x7c'),_0x484637[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x6d2af6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')]['syncQueueCallerLeave']=function(_0x2d7274){try{if(this[_0xb5c2('0x5f')](_0x2d7274)){logger['debug'](_0xb5c2('0x85'),_0x2d7274[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x2d7274,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x2d7274[_0xb5c2('0x45')]]){var _0x2ecc74=_[_0xb5c2('0x86')](this['queueReports'][_0x2d7274[_0xb5c2('0x45')]]);_0x2ecc74[_0xb5c2('0x87')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x2ecc74[_0xb5c2('0x88')]=_0x2d7274['connectedlinenum'];_0x2ecc74[_0xb5c2('0x89')]=_0x2d7274[_0xb5c2('0x89')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2ecc74[_0xb5c2('0x4d')],_0x2ecc74[_0xb5c2('0x76')],_0x2d7274[_0xb5c2('0x88')],_0x2d7274[_0xb5c2('0x89')]);this[_0xb5c2('0x13')][_0x2d7274[_0xb5c2('0x45')]]=_0x2ecc74;this[_0xb5c2('0x42')](_0x2ecc74,'queuecallerleave');}}}catch(_0x371a2c){logger[_0xb5c2('0x3c')](_0xb5c2('0x85'),_0x2d7274[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x371a2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x22')]=function(_0x18bed8){try{if(this[_0xb5c2('0x5f')](_0x18bed8)){logger[_0xb5c2('0x5c')](_0xb5c2('0x8a'),_0x18bed8['uniqueid'],util['inspect'](_0x18bed8,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x18bed8[_0xb5c2('0x45')]]){var _0x5b067f=_[_0xb5c2('0x86')](this['queueReports'][_0x18bed8[_0xb5c2('0x45')]]);_0x5b067f[_0xb5c2('0x8b')]=!![];_0x5b067f[_0xb5c2('0x4b')]='COMPLETEDBYAGENT';logger[_0xb5c2('0x69')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x5b067f[_0xb5c2('0x4d')],_0x5b067f['type']);}}}catch(_0x260776){logger[_0xb5c2('0x3c')](_0xb5c2('0x8a'),_0x18bed8[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x260776,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x1a1d9a){try{if(this[_0xb5c2('0x5f')](_0x1a1d9a)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x1a1d9a['uniqueid'],util[_0xb5c2('0x3a')](_0x1a1d9a,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]]){var _0x11e82d=_[_0xb5c2('0x86')](this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]]);_0x11e82d[_0xb5c2('0x8c')]=![];_0x11e82d[_0xb5c2('0x80')]=null;_0x11e82d[_0xb5c2('0x8d')]=!![];_0x11e82d[_0xb5c2('0x82')]=_0x1a1d9a[_0xb5c2('0x8e')];_0x11e82d[_0xb5c2('0x7e')]=_0x1a1d9a['holdtime'];_0x11e82d[_0xb5c2('0x8b')]=!![];_0x11e82d['queuecallerexit']=![];_0x11e82d['queuecallerexitAt']=null;if(!_0x11e82d[_0xb5c2('0x8f')]){if(_0x1a1d9a[_0xb5c2('0x90')]==_0xb5c2('0x8f')){_0x11e82d[_0xb5c2('0x4b')]=_0xb5c2('0x91');logger[_0xb5c2('0x69')](_0xb5c2('0x92'),_0x11e82d[_0xb5c2('0x4d')],_0x11e82d[_0xb5c2('0x76')]);}else{if(_['startsWith'](_0x1a1d9a[_0xb5c2('0x37')][_0xb5c2('0x93')](),_0xb5c2('0x94'))){if(this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]]){var _0xcfcb8b=_['last'](this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]]);_0xcfcb8b['queuecallercomplete']=![];_0xcfcb8b[_0xb5c2('0x96')]=!![];_0xcfcb8b[_0xb5c2('0x97')]=moment(_0x11e82d[_0xb5c2('0x77')])[_0xb5c2('0x98')](_0x1a1d9a[_0xb5c2('0x7e')],_0xb5c2('0x99'))[_0xb5c2('0x46')](_0xb5c2('0x78'));_0xcfcb8b['queuecallerexitreason']=_0xb5c2('0x9a');_0xcfcb8b[_0xb5c2('0x8f')]=!![];_0xcfcb8b[_0xb5c2('0x9b')]='FORWARD';_0xcfcb8b[_0xb5c2('0x9c')]=_0x1a1d9a[_0xb5c2('0x9d')];_0xcfcb8b[_0xb5c2('0x9e')]=_0x1a1d9a[_0xb5c2('0x45')];logger[_0xb5c2('0x69')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0xcfcb8b['name'],_0xcfcb8b[_0xb5c2('0x76')]);var _0x5a38c4=this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x95')]];this[_0xb5c2('0x11')][_0x1a1d9a['linkedid']]=this[_0xb5c2('0x11')][_0x1a1d9a[_0xb5c2('0x45')]];this[_0xb5c2('0x11')][_0x1a1d9a['uniqueid']]=_0x5a38c4;}}else{_0x11e82d[_0xb5c2('0x4b')]=_0xb5c2('0x9f')+_0x1a1d9a['reason']['toUpperCase']();logger[_0xb5c2('0x69')](_0xb5c2('0xa0'),_0x11e82d[_0xb5c2('0x4d')],_0x11e82d[_0xb5c2('0x76')],_0x11e82d[_0xb5c2('0x4b')]);}}}this[_0xb5c2('0x13')][_0x1a1d9a[_0xb5c2('0x45')]]=_0x11e82d;this[_0xb5c2('0x84')](_0x11e82d,_0xb5c2('0xa1'));}}}catch(_0xd0b72b){logger['error'](_0xb5c2('0xa2'),_0x1a1d9a['uniqueid'],util[_0xb5c2('0x3a')](_0xd0b72b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb5c2('0xd')][_0xb5c2('0x24')]=function(_0x430f08){try{if(this['isNotNull'](_0x430f08)){logger['debug'](_0xb5c2('0xa3'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x430f08,{'showHidden':![],'depth':null}));this[_0xb5c2('0xa4')](_0x430f08['uniqueid'],_['keys'](_0x430f08['variable'])[0x0],_0x430f08['value']);if(this[_0xb5c2('0x11')][_0x430f08['uniqueid']]){var _0x422410=_[_0xb5c2('0x86')](this[_0xb5c2('0x11')][_0x430f08[_0xb5c2('0x45')]]);if(_0x422410){if(this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')])&&this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')]['queuestatus'])){switch(_0x430f08[_0xb5c2('0xa6')]){case'CONTINUE':_0x422410['queuecallerexit']=![];_0x422410[_0xb5c2('0x97')]=null;break;case _0xb5c2('0xa7'):_0x422410['lastevent']=_0xb5c2('0xa8');_0x422410['queuecallerexit']=!![];_0x422410['queuecallerexitAt']=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x422410['queuecallerleaveAt']=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));logger[_0xb5c2('0x5c')](_0xb5c2('0xa9'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x422410,{'showHidden':![],'depth':null}));ami[_0xb5c2('0x41')](_0xb5c2('0xaa'),_0x422410);break;default:_0x422410[_0xb5c2('0x96')]=!![];_0x422410[_0xb5c2('0x97')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));_0x422410[_0xb5c2('0x87')]=moment()[_0xb5c2('0x46')](_0xb5c2('0x78'));}_0x422410[_0xb5c2('0x8c')]=![];_0x422410[_0xb5c2('0x80')]=null;_0x422410['queuecallerexitreason']=_0x430f08['value'];this[_0xb5c2('0x13')][_0x430f08[_0xb5c2('0x45')]]=_0x422410;this[_0xb5c2('0x84')](_0x422410,_0xb5c2('0x23'));}else if(this[_0xb5c2('0x5f')](_0x430f08['variable'])&&this[_0xb5c2('0x5f')](_0x430f08[_0xb5c2('0xa5')][_0xb5c2('0xab')])){if(!_0x422410['queuecallerabandon']){_0x422410[_0xb5c2('0x96')]=!![];_0x422410[_0xb5c2('0x97')]=moment()[_0xb5c2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x422410[_0xb5c2('0x4b')]=_0xb5c2('0xac');_0x422410[_0xb5c2('0x87')]=moment()['format'](_0xb5c2('0x78'));this[_0xb5c2('0x13')][_0x430f08[_0xb5c2('0x45')]]=_0x422410;}}logger[_0xb5c2('0x69')](_0xb5c2('0xad'),_0x430f08[_0xb5c2('0x45')],_0x422410['name'],_0x422410[_0xb5c2('0x76')],_[_0xb5c2('0xae')](_0x430f08['variable'])[0x0],_0x430f08[_0xb5c2('0xa6')]);_0x422410[_0xb5c2('0x16')]=this['variables'][_0x430f08['uniqueid']];}}}}catch(_0xf3ac7c){logger[_0xb5c2('0x3c')](_0xb5c2('0xa3'),_0x430f08[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0xf3ac7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb5c2('0xa4')]=function(_0x9338a0,_0x1c3b6e,_0x227fe4){var _0x2c3936=[_0xb5c2('0xaf'),_0xb5c2('0xb0'),_0xb5c2('0xb1'),_0xb5c2('0xb2'),'rtpaudioqosloss',_0xb5c2('0xb3'),_0xb5c2('0xb4'),_0xb5c2('0xb5'),_0xb5c2('0xb6'),'sipuri',_0xb5c2('0xb7'),'bridgepvtcallid','membercalls','memberdynamic',_0xb5c2('0xb8'),_0xb5c2('0xb9'),_0xb5c2('0x8e'),_0xb5c2('0xba'),'memberrealtime'];if(!_['isNil'](_0x1c3b6e)&&!_[_0xb5c2('0xbb')](_0x2c3936,_0x1c3b6e)){if(_[_0xb5c2('0x75')](this[_0xb5c2('0x16')][_0x9338a0])){this[_0xb5c2('0x16')][_0x9338a0]={};}this['variables'][_0x9338a0][_0x1c3b6e]=_0x227fe4;}};VoiceQueueReport['prototype'][_0xb5c2('0x26')]=function(_0x19c402){try{if(this['isNotNull'](_0x19c402)){logger[_0xb5c2('0x5c')]('[%s][voiceQueueReport][hangup]',_0x19c402[_0xb5c2('0x45')],util[_0xb5c2('0x3a')](_0x19c402,{'showHidden':![],'depth':null}));if(this[_0xb5c2('0x11')][_0x19c402['uniqueid']]){for(var _0x542087=0x0,_0x555304={};_0x542087=0x0?moment(_0x409b14[_0xda0c('0x16')])['diff'](_0x409b14[_0xda0c('0x15')],_0xda0c('0xc')):null,'data1':_0xda0c('0x17'),'data2':_0x409b14[_0xda0c('0x11')],'data3':_0x409b14['exten'],'data4':_0x409b14['dialstring']||null,'role':_0xda0c('0x10'),'internal':_0x409b14[_0xda0c('0x11')]?_[_0xda0c('0x12')](_0x409b14[_0xda0c('0x11')]):undefined,'uniqueid':_0x409b14[_0xda0c('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x36c2=['accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','diff','queuecallerleaveAt','seconds','calleridnum','exten','queue','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36c2,0x1da));var _0x236c=function(_0x4a186a,_0x159675){_0x4a186a=_0x4a186a-0x0;var _0x4fa33f=_0x36c2[_0x4a186a];return _0x4fa33f;};'use strict';var moment=require(_0x236c('0x0'));var _=require(_0x236c('0x1'));var util=require(_0x236c('0x2'));var client=require(_0x236c('0x3'));exports[_0x236c('0x4')]=function(_0x4aafce){var _0x447b73=_0x4aafce[_0x236c('0x5')]||_0x4aafce[_0x236c('0x6')];return client[_0x236c('0x7')](_0x236c('0x8'),{'body':{'channel':_0x236c('0x9'),'membername':_0x4aafce[_0x236c('0xa')],'interface':_[_0x236c('0xb')](_0x4aafce[_0x236c('0xc')])?util[_0x236c('0xd')](_0x236c('0xe'),_0x4aafce['lastAssignedTo']):_0x4aafce[_0x236c('0xc')],'type':'TALKING','enterAt':_0x4aafce['queuecallerleaveAt'],'exitAt':_0x447b73,'duration':moment(_0x447b73)[_0x236c('0xf')](_0x4aafce[_0x236c('0x10')],_0x236c('0x11')),'data1':'inbound','data2':_0x4aafce[_0x236c('0x12')],'data3':_0x4aafce[_0x236c('0x13')],'data4':null,'data5':_0x4aafce[_0x236c('0x14')],'role':_0x236c('0x15'),'internal':_0x4aafce[_0x236c('0x16')]?_[_0x236c('0x17')](_0x4aafce[_0x236c('0x16')]):undefined,'uniqueid':_0x4aafce[_0x236c('0x18')]},'log':'CreateMemberReport'});};exports[_0x236c('0x19')]=function(_0x49d976){return client['Request'](_0x236c('0x8'),{'body':{'channel':'voice','membername':_0x49d976[_0x236c('0x1a')],'interface':_0x49d976[_0x236c('0xc')],'type':_0x236c('0x1b'),'enterAt':_0x49d976[_0x236c('0x1c')],'exitAt':_0x49d976[_0x236c('0x1d')],'duration':moment(_0x49d976[_0x236c('0x1d')])[_0x236c('0xf')](_0x49d976['starttime'],_0x236c('0x11'))>=0x0?moment(_0x49d976['endtime'])['diff'](_0x49d976[_0x236c('0x1c')],_0x236c('0x11')):null,'data1':'outbound','data2':_0x49d976[_0x236c('0x16')],'data3':_0x49d976[_0x236c('0x13')],'data4':_0x49d976[_0x236c('0x1e')]||null,'role':_0x236c('0x15'),'internal':_0x49d976[_0x236c('0x16')]?_['toNumber'](_0x49d976[_0x236c('0x16')]):undefined,'uniqueid':_0x49d976['uniqueid']},'log':_0x236c('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7a13215..6de5b37 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 _0x5566=['stopRecordingOnTransfer','GetSettings','../client','Request','ShowSetting'];(function(_0x53866b,_0x30aae4){var _0x234a33=function(_0x2069e5){while(--_0x2069e5){_0x53866b['push'](_0x53866b['shift']());}};_0x234a33(++_0x30aae4);}(_0x5566,0x179));var _0x6556=function(_0x5f3f60,_0x5623b3){_0x5f3f60=_0x5f3f60-0x0;var _0x3f0e96=_0x5566[_0x5f3f60];return _0x3f0e96;};'use strict';var client=require(_0x6556('0x0'));exports['getSettings']=function(){return client[_0x6556('0x1')](_0x6556('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6556('0x3'),'previewRecallmeReminderInterval']},'log':_0x6556('0x4')});}; \ No newline at end of file +var _0xeb3f=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xeb3f[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xfeb3('0x0'));exports[_0xfeb3('0x1')]=function(){return client[_0xfeb3('0x2')](_0xfeb3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfeb3('0x4'),_0xfeb3('0x5')]},'log':_0xfeb3('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 31d4694..04d0e9e 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 _0xd523=['getTemplates','GetTemplate','name','html','../client'];(function(_0xeef7e6,_0x10cbd7){var _0x338713=function(_0x3a662a){while(--_0x3a662a){_0xeef7e6['push'](_0xeef7e6['shift']());}};_0x338713(++_0x10cbd7);}(_0xd523,0x153));var _0x3d52=function(_0x43dafc,_0x3555c1){_0x43dafc=_0x43dafc-0x0;var _0x2ccad1=_0xd523[_0x43dafc];return _0x2ccad1;};'use strict';var client=require(_0x3d52('0x0'));exports[_0x3d52('0x1')]=function(_0x3d35b0){return function(_0x3fcfcb){return client['Request'](_0x3d52('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3d52('0x3'),_0x3d52('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xbc1d=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x827009,_0x3a840f){var _0x2d55a2=function(_0x25c7f9){while(--_0x25c7f9){_0x827009['push'](_0x827009['shift']());}};_0x2d55a2(++_0x3a840f);}(_0xbc1d,0x12a));var _0xdbc1=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xbc1d[_0x164760];return _0x8b91b2;};'use strict';var client=require(_0xdbc1('0x0'));exports[_0xdbc1('0x1')]=function(_0x22ccb6){return function(_0x5b6851){return client[_0xdbc1('0x2')](_0xdbc1('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xdbc1('0x4')]},'log':_0xdbc1('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4056db8..a36fb57 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 _0x47ef=['operator','AnyConditions','value','Action','data1','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x47ef,0x88));var _0xf47e=function(_0xc1c567,_0x4447ca){_0xc1c567=_0xc1c567-0x0;var _0xffea38=_0x47ef[_0xc1c567];return _0xffea38;};'use strict';var client=require(_0xf47e('0x0'));exports[_0xf47e('0x1')]=function(_0xbdd09a){return function(_0x132ddc){return client[_0xf47e('0x2')](_0xf47e('0x3'),{'options':{'raw':![],'attributes':['id',_0xf47e('0x4'),'channel',_0xf47e('0x5')],'include':[{'model':_0xf47e('0x6'),'as':_0xf47e('0x7'),'attributes':['id','field',_0xf47e('0x8'),'value']},{'model':_0xf47e('0x6'),'as':_0xf47e('0x9'),'attributes':['id','field',_0xf47e('0x8'),_0xf47e('0xa')]},{'model':_0xf47e('0xb'),'as':'Actions','attributes':['id','action',_0xf47e('0xc'),_0xf47e('0xd'),_0xf47e('0xe'),_0xf47e('0xf'),_0xf47e('0x10'),'data6',_0xf47e('0x11')]}]},'log':_0xf47e('0x3')});};}; \ No newline at end of file +var _0x0e45=['status','Condition','AllConditions','field','operator','value','Action','Actions','action','data3','data4','data5','data6','getTriggers','Request','name','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e45,0x12e));var _0x50e4=function(_0x23eaf0,_0x4efdb0){_0x23eaf0=_0x23eaf0-0x0;var _0x5a2529=_0x0e45[_0x23eaf0];return _0x5a2529;};'use strict';var client=require('../client');exports[_0x50e4('0x0')]=function(_0x488740){return function(_0x555144){return client[_0x50e4('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x50e4('0x2'),_0x50e4('0x3'),_0x50e4('0x4')],'include':[{'model':_0x50e4('0x5'),'as':_0x50e4('0x6'),'attributes':['id',_0x50e4('0x7'),_0x50e4('0x8'),_0x50e4('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x50e4('0x7'),_0x50e4('0x8'),_0x50e4('0x9')]},{'model':_0x50e4('0xa'),'as':_0x50e4('0xb'),'attributes':['id',_0x50e4('0xc'),'data1','data2',_0x50e4('0xd'),_0x50e4('0xe'),_0x50e4('0xf'),_0x50e4('0x10'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5318e56..11f25f3 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 _0xf6c1=['GetTrunk','Request','name','defaultuser'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xf6c1,0x99));var _0x1f6c=function(_0x47081c,_0x423f86){_0x47081c=_0x47081c-0x0;var _0x44bbab=_0xf6c1[_0x47081c];return _0x44bbab;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x14a784){return function(_0xd137f){return client[_0x1f6c('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1f6c('0x1'),'registry',_0x1f6c('0x2')]},'log':_0x1f6c('0x3')});};}; \ No newline at end of file +var _0x6666=['GetTrunk','name','../client'];(function(_0x42ff07,_0x118ced){var _0x21457b=function(_0x5e4a2d){while(--_0x5e4a2d){_0x42ff07['push'](_0x42ff07['shift']());}};_0x21457b(++_0x118ced);}(_0x6666,0x6e));var _0x6666=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x6666[_0x4e7d25];return _0x526fe6;};'use strict';var client=require(_0x6666('0x0'));exports['getTrunks']=function(_0x5b2ac4){return function(_0x59e3ca){return client['Request'](_0x6666('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6666('0x2'),'registry','defaultuser']},'log':_0x6666('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 80244d7..3d21e5e 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 _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x2b9dd9,_0x743a92){var _0x1c64c6=function(_0x30e74f){while(--_0x30e74f){_0x2b9dd9['push'](_0x2b9dd9['shift']());}};_0x1c64c6(++_0x743a92);}(_0x34e8,0x12c));var _0x834e=function(_0xc0a90a,_0x34977){_0xc0a90a=_0xc0a90a-0x0;var _0x3d2784=_0x34e8[_0xc0a90a];return _0x3d2784;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x59ae41,_0xbbee18){var _0x57d8c0=function(_0x13df66){while(--_0x13df66){_0x59ae41['push'](_0x59ae41['shift']());}};_0x57d8c0(++_0xbbee18);}(_0x70e0,0x17b));var _0x070e=function(_0x13789b,_0x47c524){_0x13789b=_0x13789b-0x0;var _0x3f7a8b=_0x70e0[_0x13789b];return _0x3f7a8b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0e16c17..cea7a32 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 _0x5a1a=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x282f9a,_0x63dff){var _0x52528c=function(_0xcf1c4c){while(--_0xcf1c4c){_0x282f9a['push'](_0x282f9a['shift']());}};_0x52528c(++_0x63dff);}(_0x5a1a,0xfc));var _0xa5a1=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x5a1a[_0x1c4409];return _0x356d8f;};'use strict';var client=require('../client');exports['create']=function(_0x1165a5){return client[_0xa5a1('0x0')]('CreateVoiceAgentReport',{'body':_0x1165a5,'log':_0xa5a1('0x1')});};exports[_0xa5a1('0x2')]=function(_0x4aaf04,_0x96f1b2,_0x4f0336){return client['Request']('UpdateVoiceAgentReport',{'body':_0x4aaf04,'options':{'where':{'uniqueid':_0x96f1b2,'interface':_0x4f0336,'agentcomplete':!![]}},'log':_0xa5a1('0x3')});}; \ No newline at end of file +var _0x6b26=['../client','create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x38b4d5,_0x24a77e){var _0x43603e=function(_0x49f8f1){while(--_0x49f8f1){_0x38b4d5['push'](_0x38b4d5['shift']());}};_0x43603e(++_0x24a77e);}(_0x6b26,0x127));var _0x66b2=function(_0x3792a5,_0x1a9252){_0x3792a5=_0x3792a5-0x0;var _0x67f262=_0x6b26[_0x3792a5];return _0x67f262;};'use strict';var client=require(_0x66b2('0x0'));exports[_0x66b2('0x1')]=function(_0x1a8af5){return client['Request'](_0x66b2('0x2'),{'body':_0x1a8af5,'log':_0x66b2('0x2')});};exports[_0x66b2('0x3')]=function(_0x87e521,_0x358598,_0x1d78b6){return client['Request'](_0x66b2('0x4'),{'body':_0x87e521,'options':{'where':{'uniqueid':_0x358598,'interface':_0x1d78b6,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3e104c4..3475f6d 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 _0x067c=['DOCUMENTATION','getVoiceCallReports','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid'];(function(_0x50e6bc,_0x15d72f){var _0x5c6f61=function(_0x4bdf43){while(--_0x4bdf43){_0x50e6bc['push'](_0x50e6bc['shift']());}};_0x5c6f61(++_0x15d72f);}(_0x067c,0x96));var _0xc067=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x067c[_0x1529a3];return _0x1a0d4b;};'use strict';var moment=require(_0xc067('0x0'));var util=require(_0xc067('0x1'));var _=require(_0xc067('0x2'));var client=require(_0xc067('0x3'));exports[_0xc067('0x4')]=function(_0x47df94){return client[_0xc067('0x5')](_0xc067('0x6'),{'body':_[_0xc067('0x7')](_0x47df94,{'source':_0x47df94[_0xc067('0x8')],'destinationcontext':_0x47df94[_0xc067('0x9')],'callerid':_0x47df94[_0xc067('0xa')],'amaflags':_0xc067('0xb')}),'log':'CreateVoiceCallReport'});};exports[_0xc067('0xc')]=function(){return function(){return client[_0xc067('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xc067('0xd')],'createdAt':{'$between':[moment()[_0xc067('0xe')]('day')['format'](_0xc067('0xf')),moment()[_0xc067('0x10')](_0xc067('0x11'))[_0xc067('0x12')](_0xc067('0xf'))]}},'attributes':['type',_0xc067('0x13'),_0xc067('0x14'),_0xc067('0x15')]},'log':_0xc067('0x16')});};}; \ No newline at end of file +var _0x531c=['Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x3939b2,_0x38e2cc){var _0x576cbd=function(_0x68df6a){while(--_0x68df6a){_0x3939b2['push'](_0x3939b2['shift']());}};_0x576cbd(++_0x38e2cc);}(_0x531c,0xa3));var _0xc531=function(_0x4008f0,_0x17f1b2){_0x4008f0=_0x4008f0-0x0;var _0xb42e88=_0x531c[_0x4008f0];return _0xb42e88;};'use strict';var moment=require(_0xc531('0x0'));var util=require(_0xc531('0x1'));var _=require(_0xc531('0x2'));var client=require(_0xc531('0x3'));exports[_0xc531('0x4')]=function(_0x38c441){return client[_0xc531('0x5')](_0xc531('0x6'),{'body':_['merge'](_0x38c441,{'source':_0x38c441[_0xc531('0x7')],'destinationcontext':_0x38c441['context'],'callerid':_0x38c441['callerid'],'amaflags':_0xc531('0x8')}),'log':_0xc531('0x6')});};exports[_0xc531('0x9')]=function(){return function(){return client['Request'](_0xc531('0xa'),{'options':{'where':{'type':[_0xc531('0xb')],'createdAt':{'$between':[moment()[_0xc531('0xc')](_0xc531('0xd'))[_0xc531('0xe')](_0xc531('0xf')),moment()[_0xc531('0x10')]('day')[_0xc531('0xe')](_0xc531('0xf'))]}},'attributes':['type',_0xc531('0x11'),_0xc531('0x12'),_0xc531('0x13')]},'log':_0xc531('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 236490a..c2b2fc9 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 _0x8975=['Request','CreateVoiceDialReport','../client','create'];(function(_0x305fd0,_0x1c6d65){var _0x16544f=function(_0x2833bc){while(--_0x2833bc){_0x305fd0['push'](_0x305fd0['shift']());}};_0x16544f(++_0x1c6d65);}(_0x8975,0x1aa));var _0x5897=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8975[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x5897('0x0'));exports[_0x5897('0x1')]=function(_0x2e8e82){return client[_0x5897('0x2')](_0x5897('0x3'),{'body':_0x2e8e82,'log':_0x5897('0x3')});}; \ No newline at end of file +var _0x95b8=['create','Request','CreateVoiceDialReport'];(function(_0x1dd6e7,_0x1cda2b){var _0xb53aa4=function(_0xd2ac7b){while(--_0xd2ac7b){_0x1dd6e7['push'](_0x1dd6e7['shift']());}};_0xb53aa4(++_0x1cda2b);}(_0x95b8,0x8a));var _0x895b=function(_0x5e073c,_0x3e3ba0){_0x5e073c=_0x5e073c-0x0;var _0x5bc328=_0x95b8[_0x5e073c];return _0x5bc328;};'use strict';var client=require('../client');exports[_0x895b('0x0')]=function(_0x44e3c8){return client[_0x895b('0x1')](_0x895b('0x2'),{'body':_0x44e3c8,'log':_0x895b('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a7f6518..d26f87c 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 _0x2242=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x5ee86b,_0x30931c){var _0x12c922=function(_0xc1a3a6){while(--_0xc1a3a6){_0x5ee86b['push'](_0x5ee86b['shift']());}};_0x12c922(++_0x30931c);}(_0x2242,0x1a3));var _0x2224=function(_0x1993f1,_0x3c7a07){_0x1993f1=_0x1993f1-0x0;var _0x5e5f4a=_0x2242[_0x1993f1];return _0x5e5f4a;};'use strict';var client=require(_0x2224('0x0'));exports[_0x2224('0x1')]=function(){return function(){return client[_0x2224('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2224('0x3'),_0x2224('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xe739=['exten','../client','Request','GetVoiceExtension'];(function(_0x26e394,_0x2302b6){var _0x4f0848=function(_0x3945e){while(--_0x3945e){_0x26e394['push'](_0x26e394['shift']());}};_0x4f0848(++_0x2302b6);}(_0xe739,0x105));var _0x9e73=function(_0x4f4cf3,_0x3a52df){_0x4f4cf3=_0x4f4cf3-0x0;var _0x46ba3b=_0xe739[_0x4f4cf3];return _0x46ba3b;};'use strict';var client=require(_0x9e73('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x9e73('0x1')](_0x9e73('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9e73('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 04f5248..35cb7a0 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 _0xbf02=['dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue'];(function(_0x35450e,_0x1ad7b3){var _0xfbb741=function(_0x254135){while(--_0x254135){_0x35450e['push'](_0x35450e['shift']());}};_0xfbb741(++_0x1ad7b3);}(_0xbf02,0x139));var _0x2bf0=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xbf02[_0x36ed48];return _0x51c63a;};'use strict';var client=require(_0x2bf0('0x0'));exports[_0x2bf0('0x1')]=function(){return function(){return client[_0x2bf0('0x2')](_0x2bf0('0x3'),{'options':{'raw':![],'attributes':['id',_0x2bf0('0x4'),_0x2bf0('0x5'),_0x2bf0('0x6'),'autopause',_0x2bf0('0x7'),'type',_0x2bf0('0x8'),_0x2bf0('0x9'),_0x2bf0('0xa'),_0x2bf0('0xb'),_0x2bf0('0xc'),_0x2bf0('0xd'),_0x2bf0('0xe'),'dialPredictiveInterval',_0x2bf0('0xf'),_0x2bf0('0x10'),'dialOriginateTimeout',_0x2bf0('0x11'),_0x2bf0('0x12'),_0x2bf0('0x13'),'dialCongestionMaxRetry',_0x2bf0('0x14'),_0x2bf0('0x15'),'dialBusyRetryFrequency',_0x2bf0('0x16'),_0x2bf0('0x17'),_0x2bf0('0x18'),_0x2bf0('0x19'),_0x2bf0('0x1a'),_0x2bf0('0x1b'),_0x2bf0('0x1c'),_0x2bf0('0x1d'),_0x2bf0('0x1e'),_0x2bf0('0x1f'),_0x2bf0('0x20'),_0x2bf0('0x21'),_0x2bf0('0x22'),_0x2bf0('0x23'),_0x2bf0('0x24'),_0x2bf0('0x25'),_0x2bf0('0x26'),_0x2bf0('0x27'),_0x2bf0('0x28'),_0x2bf0('0x29'),_0x2bf0('0x2a'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x2bf0('0x2b'),_0x2bf0('0x7'),'strategy',_0x2bf0('0x2c'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x2bf0('0x2d'),_0x2bf0('0x2e'),'dialDropRetryFrequency',_0x2bf0('0x2f'),_0x2bf0('0x30'),_0x2bf0('0x31'),_0x2bf0('0x32'),_0x2bf0('0x33'),_0x2bf0('0x34'),_0x2bf0('0x35'),_0x2bf0('0x36'),'dialPredictiveIntervalMinThreshold',_0x2bf0('0x37'),_0x2bf0('0x38')],'include':[{'model':_0x2bf0('0x39'),'as':_0x2bf0('0x39'),'attributes':['id','name','callerid',_0x2bf0('0x3a')]},{'model':_0x2bf0('0x3b'),'as':_0x2bf0('0x3c'),'attributes':['id','name']},{'model':'Trunk','as':_0x2bf0('0x3d'),'attributes':['id',_0x2bf0('0x4'),_0x2bf0('0x3e'),_0x2bf0('0x3a')]},{'model':'Interval','as':_0x2bf0('0x3f'),'attributes':['id',_0x2bf0('0x4')],'include':[{'model':_0x2bf0('0x3f'),'as':'Intervals','attributes':['id',_0x2bf0('0x4'),_0x2bf0('0x40')]}]}]},'log':_0x2bf0('0x1')});};}; \ No newline at end of file +var _0x5f55=['dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent'];(function(_0x353d3d,_0xc7ebc){var _0x1c5409=function(_0x54838e){while(--_0x54838e){_0x353d3d['push'](_0x353d3d['shift']());}};_0x1c5409(++_0xc7ebc);}(_0x5f55,0x14c));var _0x55f5=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0x5f55[_0x28278f];return _0x3d9f74;};'use strict';var client=require(_0x55f5('0x0'));exports[_0x55f5('0x1')]=function(){return function(){return client[_0x55f5('0x2')](_0x55f5('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0x55f5('0x4'),'autopause',_0x55f5('0x5'),'type',_0x55f5('0x6'),'dialMethod',_0x55f5('0x7'),'dialLimitQueue',_0x55f5('0x8'),_0x55f5('0x9'),_0x55f5('0xa'),_0x55f5('0xb'),_0x55f5('0xc'),_0x55f5('0xd'),'dialOriginateTimeout','dialQueueOptions',_0x55f5('0xe'),_0x55f5('0xf'),_0x55f5('0x10'),_0x55f5('0x11'),_0x55f5('0x12'),_0x55f5('0x13'),_0x55f5('0x14'),_0x55f5('0x15'),_0x55f5('0x16'),_0x55f5('0x17'),_0x55f5('0x18'),'dialPrefix',_0x55f5('0x19'),_0x55f5('0x1a'),_0x55f5('0x1b'),_0x55f5('0x1c'),_0x55f5('0x1d'),_0x55f5('0x1e'),'dialAMDMinWordLength',_0x55f5('0x1f'),_0x55f5('0x20'),_0x55f5('0x21'),_0x55f5('0x22'),_0x55f5('0x23'),_0x55f5('0x24'),_0x55f5('0x25'),_0x55f5('0x26'),_0x55f5('0x27'),_0x55f5('0x28'),'dialQueueProject2',_0x55f5('0x5'),'strategy',_0x55f5('0x29'),_0x55f5('0x2a'),_0x55f5('0x2b'),_0x55f5('0x2c'),'dialDropMaxRetry',_0x55f5('0x2d'),_0x55f5('0x2e'),_0x55f5('0x2f'),_0x55f5('0x30'),_0x55f5('0x31'),_0x55f5('0x32'),_0x55f5('0x33'),'mandatoryDisposition',_0x55f5('0x34'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x55f5('0x35'),'as':_0x55f5('0x35'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x37'),'active']},{'model':'Pause','as':_0x55f5('0x38'),'attributes':['id',_0x55f5('0x36')]},{'model':_0x55f5('0x35'),'as':_0x55f5('0x39'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x37'),_0x55f5('0x3a')]},{'model':_0x55f5('0x3b'),'as':_0x55f5('0x3b'),'attributes':['id',_0x55f5('0x36')],'include':[{'model':'Interval','as':_0x55f5('0x3c'),'attributes':['id',_0x55f5('0x36'),_0x55f5('0x3d')]}]}]},'log':_0x55f5('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4b70e05..4681577 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(_0x748ca3,_0x34bf24){var _0x54e410=function(_0x2b63af){while(--_0x2b63af){_0x748ca3['push'](_0x748ca3['shift']());}};_0x54e410(++_0x34bf24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x4ec629,_0x32b05b){var _0x1bf5e6=function(_0x1d2bba){while(--_0x1d2bba){_0x4ec629['push'](_0x4ec629['shift']());}};_0x1bf5e6(++_0x32b05b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 9a2e3f9..f4485dd 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 _0x9d8a=['getVoiceQueueRtPauses','../client','Request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9d8a,0x8e));var _0xa9d8=function(_0x2d9f02,_0x5b7597){_0x2d9f02=_0x2d9f02-0x0;var _0x514b53=_0x9d8a[_0x2d9f02];return _0x514b53;};'use strict';var client=require(_0xa9d8('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5afc99){return function(){return client[_0xa9d8('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5afc99,'paused':!![]},'raw':!![]},'log':_0xa9d8('0x2')});};}; \ No newline at end of file +var _0xab28=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x48e679,_0x54bda6){var _0x5cd916=function(_0x2895d9){while(--_0x2895d9){_0x48e679['push'](_0x48e679['shift']());}};_0x5cd916(++_0x54bda6);}(_0xab28,0x91));var _0x8ab2=function(_0x481844,_0x259b1f){_0x481844=_0x481844-0x0;var _0x2afc17=_0xab28[_0x481844];return _0x2afc17;};'use strict';var client=require(_0x8ab2('0x0'));exports['getVoiceQueueRtPauses']=function(_0x24ddea){return function(){return client[_0x8ab2('0x1')](_0x8ab2('0x2'),{'options':{'where':{'VoiceQueueId':_0x24ddea,'paused':!![]},'raw':!![]},'log':_0x8ab2('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e2875f8..cbb3959 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1e5006,_0x35afb0){var _0x3d3611=function(_0x47405f){while(--_0x47405f){_0x1e5006['push'](_0x1e5006['shift']());}};_0x3d3611(++_0x35afb0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x32c3f4,_0x13990e){var _0x889a18=function(_0x3fc7fa){while(--_0x3fc7fa){_0x32c3f4['push'](_0x32c3f4['shift']());}};_0x889a18(++_0x13990e);}(_0x7a54,0x106));var _0x47a5=function(_0x56c12d,_0x2bc288){_0x56c12d=_0x56c12d-0x0;var _0x518cce=_0x7a54[_0x56c12d];return _0x518cce;};'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 5edc972..bf88820 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 _0x93d8=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','origtransferercontext','origtransfererexten','attended','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','isexternal','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x93d8,0x144));var _0x893d=function(_0x948976,_0x164334){_0x948976=_0x948976-0x0;var _0x59c21a=_0x93d8[_0x948976];return _0x59c21a;};'use strict';var client=require('../client');exports[_0x893d('0x0')]={};exports['blindTransfer']=function(_0x5d82f1){return client[_0x893d('0x1')](_0x893d('0x2'),{'body':{'result':_0x5d82f1[_0x893d('0x3')],'transfererchannel':_0x5d82f1[_0x893d('0x4')],'transferercalleridnum':_0x5d82f1[_0x893d('0x5')],'transferercalleridname':_0x5d82f1[_0x893d('0x6')],'transfererconnectedlinenum':_0x5d82f1[_0x893d('0x7')],'transfererconnectedlinename':_0x5d82f1[_0x893d('0x8')],'transfereraccountcode':_0x5d82f1[_0x893d('0x9')],'transferercontext':_0x5d82f1[_0x893d('0xa')],'transfererexten':_0x5d82f1['transfererexten'],'transfererlinkedid':_0x5d82f1[_0x893d('0xb')],'transfereechannel':_0x5d82f1[_0x893d('0xc')],'transfereecalleridnum':_0x5d82f1[_0x893d('0xd')],'transfereecalleridname':_0x5d82f1[_0x893d('0xe')],'transfereeconnectedlinenum':_0x5d82f1['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5d82f1[_0x893d('0xf')],'transfereeaccountcode':_0x5d82f1[_0x893d('0x10')],'transfereecontext':_0x5d82f1['transfereecontext'],'transfereeexten':_0x5d82f1['transfereeexten'],'transfereelinkedid':_0x5d82f1['transfereelinkedid'],'isexternal':_0x5d82f1[_0x893d('0x11')],'context':_0x5d82f1[_0x893d('0x12')],'extension':_0x5d82f1[_0x893d('0x13')],'type':'blind'},'log':_0x893d('0x2')});};exports['attendedTransfer']=function(_0x20f995){return client['Request'](_0x893d('0x2'),{'body':{'result':_0x20f995[_0x893d('0x3')],'transfererchannel':_0x20f995[_0x893d('0x14')],'transferercalleridnum':_0x20f995[_0x893d('0x15')],'transferercalleridname':_0x20f995[_0x893d('0x16')],'transfererconnectedlinenum':_0x20f995[_0x893d('0x17')],'transfererconnectedlinename':_0x20f995['secondtransfererconnectedlinename'],'transfereraccountcode':_0x20f995[_0x893d('0x18')],'transferercontext':_0x20f995[_0x893d('0x19')],'transfererexten':_0x20f995['secondtransfererexten'],'transfererlinkedid':_0x20f995['origtransfererlinkedid'],'transfereechannel':_0x20f995[_0x893d('0x1a')],'transfereecalleridnum':_0x20f995[_0x893d('0x1b')],'transfereecalleridname':_0x20f995[_0x893d('0x1c')],'transfereeconnectedlinenum':_0x20f995[_0x893d('0x1d')],'transfereeconnectedlinename':_0x20f995[_0x893d('0x1e')],'transfereeaccountcode':_0x20f995['transfertargetaccountcode'],'transfereecontext':_0x20f995['transfertargetcontext'],'transfereeexten':_0x20f995[_0x893d('0x1f')],'transfereelinkedid':_0x20f995['transfertargetlinkedid'],'isexternal':_0x20f995[_0x893d('0x11')],'context':_0x20f995[_0x893d('0x20')],'extension':_0x20f995[_0x893d('0x21')],'type':_0x893d('0x22')},'log':_0x893d('0x2')});}; \ No newline at end of file +var _0xf4f9=['transfereeexten','transfereelinkedid','context','extension','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext'];(function(_0x360793,_0x41e89f){var _0x35b64a=function(_0x3a3280){while(--_0x3a3280){_0x360793['push'](_0x360793['shift']());}};_0x35b64a(++_0x41e89f);}(_0xf4f9,0x8d));var _0x9f4f=function(_0x2351f6,_0x55c6b6){_0x2351f6=_0x2351f6-0x0;var _0x307814=_0xf4f9[_0x2351f6];return _0x307814;};'use strict';var client=require('../client');exports[_0x9f4f('0x0')]={};exports[_0x9f4f('0x1')]=function(_0x223ced){return client[_0x9f4f('0x2')](_0x9f4f('0x3'),{'body':{'result':_0x223ced[_0x9f4f('0x4')],'transfererchannel':_0x223ced[_0x9f4f('0x5')],'transferercalleridnum':_0x223ced[_0x9f4f('0x6')],'transferercalleridname':_0x223ced[_0x9f4f('0x7')],'transfererconnectedlinenum':_0x223ced[_0x9f4f('0x8')],'transfererconnectedlinename':_0x223ced[_0x9f4f('0x9')],'transfereraccountcode':_0x223ced[_0x9f4f('0xa')],'transferercontext':_0x223ced[_0x9f4f('0xb')],'transfererexten':_0x223ced[_0x9f4f('0xc')],'transfererlinkedid':_0x223ced[_0x9f4f('0xd')],'transfereechannel':_0x223ced[_0x9f4f('0xe')],'transfereecalleridnum':_0x223ced[_0x9f4f('0xf')],'transfereecalleridname':_0x223ced[_0x9f4f('0x10')],'transfereeconnectedlinenum':_0x223ced['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x223ced['transfereeconnectedlinename'],'transfereeaccountcode':_0x223ced[_0x9f4f('0x11')],'transfereecontext':_0x223ced[_0x9f4f('0x12')],'transfereeexten':_0x223ced[_0x9f4f('0x13')],'transfereelinkedid':_0x223ced[_0x9f4f('0x14')],'isexternal':_0x223ced['isexternal'],'context':_0x223ced[_0x9f4f('0x15')],'extension':_0x223ced[_0x9f4f('0x16')],'type':'blind'},'log':_0x9f4f('0x3')});};exports['attendedTransfer']=function(_0x3c5ca9){return client['Request'](_0x9f4f('0x3'),{'body':{'result':_0x3c5ca9[_0x9f4f('0x4')],'transfererchannel':_0x3c5ca9[_0x9f4f('0x17')],'transferercalleridnum':_0x3c5ca9[_0x9f4f('0x18')],'transferercalleridname':_0x3c5ca9['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c5ca9[_0x9f4f('0x19')],'transfererconnectedlinename':_0x3c5ca9[_0x9f4f('0x1a')],'transfereraccountcode':_0x3c5ca9[_0x9f4f('0x1b')],'transferercontext':_0x3c5ca9[_0x9f4f('0x1c')],'transfererexten':_0x3c5ca9['secondtransfererexten'],'transfererlinkedid':_0x3c5ca9[_0x9f4f('0x1d')],'transfereechannel':_0x3c5ca9[_0x9f4f('0x1e')],'transfereecalleridnum':_0x3c5ca9[_0x9f4f('0x1f')],'transfereecalleridname':_0x3c5ca9[_0x9f4f('0x20')],'transfereeconnectedlinenum':_0x3c5ca9[_0x9f4f('0x21')],'transfereeconnectedlinename':_0x3c5ca9[_0x9f4f('0x22')],'transfereeaccountcode':_0x3c5ca9['transfertargetaccountcode'],'transfereecontext':_0x3c5ca9[_0x9f4f('0x23')],'transfereeexten':_0x3c5ca9['transfertargetexten'],'transfereelinkedid':_0x3c5ca9[_0x9f4f('0x24')],'isexternal':_0x3c5ca9[_0x9f4f('0x25')],'context':_0x3c5ca9[_0x9f4f('0x26')],'extension':_0x3c5ca9['origtransfererexten'],'type':_0x9f4f('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3b1fa3b..bb38df2 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 _0x0eeb=['originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','emit','custom:','event','faxAccounts','send','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../ami','listen','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','then','message','catch','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0eeb[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var jayson=require(_0xb0ee('0x2'));var schema=require(_0xb0ee('0x3'));var BPromise=require(_0xb0ee('0x4'));var moment=require(_0xb0ee('0x5'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xb0ee('0x6'));exports[_0xb0ee('0x7')]=function(_0x13a7ce,_0x76bf19,_0x209dda){return new BPromise(function(_0x453fa4,_0x17f445){var _0x5377b4={'QueuePause':function(_0x207a85){return new Promise(function(_0x586bc9,_0x13c198){var _0x3fb986=util[_0xb0ee('0x8')](_0xb0ee('0x9'),_0xb0ee('0xa'),_0x207a85[_0xb0ee('0xb')]);if(_0x13a7ce['timers']&&_0x13a7ce['timers'][_0x3fb986]&&_0x13a7ce[_0xb0ee('0xc')][_0x3fb986][_0xb0ee('0xd')]){_0x13a7ce['timers'][_0x3fb986]['updateAcw']();}if(_0x13a7ce[_0xb0ee('0xe')][_0x3fb986]){_0x13a7ce[_0xb0ee('0xe')][_0x3fb986][_0xb0ee('0xf')]({'statePause':_0x207a85[_0xb0ee('0x10')]?!![]:![]});}_0x586bc9({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x1675b3){var _0x538f86=this;return new Promise(function(_0x478f98,_0x5c27b6){if(ami[_0xb0ee('0x11')]()==![]){return _0x5c27b6(_0x538f86[_0xb0ee('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xb0ee('0x13')][_0xb0ee('0x14')],_0xb0ee('0x15')][_0xb0ee('0x16')]('\x20')));}_0x1675b3=_[_0xb0ee('0x17')](_0x1675b3,_[_0xb0ee('0x18')](properties[_0xb0ee('0x19')]));_0x1675b3[_0xb0ee('0x1a')]='Reload';return ami['Action'](_0x1675b3)[_0xb0ee('0x1b')](function(_0x5702d8){_0x478f98({'code':0xc8,'message':_0x5702d8[_0xb0ee('0x1c')]});})[_0xb0ee('0x1d')](function(_0x480e51){_0x5c27b6(_0x538f86['error'](0x1f5,_0x480e51[_0xb0ee('0x1c')]));});});},'Command':function(_0x2bd14a){var _0x13c8a9=this;return new Promise(function(_0x4ce528,_0x1c5ed4){if(ami[_0xb0ee('0x11')]()==![]){return _0x1c5ed4(_0x13c8a9[_0xb0ee('0x12')](0x1f4,[config[_0xb0ee('0x13')]['ip'],config['asterisk'][_0xb0ee('0x14')],_0xb0ee('0x15')][_0xb0ee('0x16')]('\x20')));}_0x2bd14a=_[_0xb0ee('0x17')](_0x2bd14a,_0xb0ee('0x1e'));_0x2bd14a[_0xb0ee('0x1a')]=_0xb0ee('0x1f');return ami[_0xb0ee('0x20')](_0x2bd14a)[_0xb0ee('0x1b')](function(_0xc019d5){_0x4ce528({'code':0xc8,'message':_0xc019d5[_0xb0ee('0x21')]});})[_0xb0ee('0x1d')](function(_0x140c8f){_0x1c5ed4(_0x13c8a9[_0xb0ee('0x12')](0x1f5,_0x140c8f[_0xb0ee('0x1c')]));});});},'VoiceQueues':function(_0x5a1197){return new Promise(function(_0x151188,_0x4c4433){var _0x53bccd=[];for(var _0x3442b7 in _0x13a7ce[_0xb0ee('0x22')]){if(_0x13a7ce[_0xb0ee('0x22')][_0xb0ee('0x23')](_0x3442b7)){var _0x560e40=_0x13a7ce[_0xb0ee('0x22')][_0x3442b7];var _0x379e19={'id':_0x560e40['id'],'name':_0x560e40[_0xb0ee('0xb')],'strategy':_0x560e40[_0xb0ee('0x24')],'answered':_0x560e40['answered'],'available':_0x560e40['available'],'loggedIn':_0x560e40[_0xb0ee('0x25')],'pTalking':_0x560e40[_0xb0ee('0x26')],'sumBillable':_0x560e40[_0xb0ee('0x27')],'sumDuration':_0x560e40[_0xb0ee('0x28')],'sumHoldTime':_0x560e40[_0xb0ee('0x29')]||0x0,'talking':_0x560e40['talking'],'total':_0x560e40['total'],'type':_0x560e40[_0xb0ee('0x2a')],'unmanaged':_0x560e40[_0xb0ee('0x2b')],'abandoned':_0x560e40[_0xb0ee('0x2c')],'waiting':_0x560e40[_0xb0ee('0x2d')],'loggedInDb':_0x560e40[_0xb0ee('0x2e')]};if(_0x560e40[_0xb0ee('0x2a')]===_0xb0ee('0x2f')){_0x379e19[_0xb0ee('0x30')]=_0x560e40[_0xb0ee('0x30')];_0x379e19['dialMethod']=_0x560e40[_0xb0ee('0x31')];_0x379e19[_0xb0ee('0x32')]=_0x560e40[_0xb0ee('0x32')];_0x379e19[_0xb0ee('0x33')]=_0x560e40[_0xb0ee('0x33')];_0x379e19[_0xb0ee('0x34')]=_0x560e40[_0xb0ee('0x34')];_0x379e19[_0xb0ee('0x35')]=_0x560e40['dialPrefix'];_0x379e19[_0xb0ee('0x36')]=_0x560e40['temp'];_0x379e19[_0xb0ee('0x37')]=_0x560e40[_0xb0ee('0x37')];_0x379e19[_0xb0ee('0x38')]=_0x560e40['outboundAnswerCallsDay'];_0x379e19['outboundBlacklistCallsDay']=_0x560e40['outboundBlacklistCallsDay'];_0x379e19['outboundBusyCallsDay']=_0x560e40[_0xb0ee('0x39')];_0x379e19[_0xb0ee('0x3a')]=_0x560e40['outboundCongestionCallsDay'];_0x379e19[_0xb0ee('0x3b')]=_0x560e40['outboundDropCallsDayACS'];_0x379e19['outboundDropCallsDayCallersExit']=_0x560e40[_0xb0ee('0x3c')];_0x379e19['outboundDropCallsDayTimeout']=_0x560e40['outboundDropCallsDayTimeout'];_0x379e19['outboundNoAnswerCallsDay']=_0x560e40[_0xb0ee('0x3d')];_0x379e19[_0xb0ee('0x3e')]=_0x560e40['outboundNoSuchCallsDay'];_0x379e19[_0xb0ee('0x3f')]=_0x560e40[_0xb0ee('0x3f')];_0x379e19[_0xb0ee('0x40')]=_0x560e40[_0xb0ee('0x40')];_0x379e19[_0xb0ee('0x41')]=_0x560e40[_0xb0ee('0x41')];_0x379e19[_0xb0ee('0x42')]=_0x560e40[_0xb0ee('0x42')];_0x379e19[_0xb0ee('0x43')]=_0x560e40[_0xb0ee('0x43')];_0x379e19[_0xb0ee('0x44')]=_0x560e40[_0xb0ee('0x44')];_0x379e19[_0xb0ee('0x45')]=_0x560e40[_0xb0ee('0x45')];_0x379e19[_0xb0ee('0x46')]=_0x560e40[_0xb0ee('0x46')];_0x379e19[_0xb0ee('0x47')]=_0x560e40[_0xb0ee('0x47')];_0x379e19[_0xb0ee('0x48')]=_0x560e40[_0xb0ee('0x48')];_0x379e19[_0xb0ee('0x49')]=_0x560e40['predictiveIntervalErlangCallsDroppedCalls'];_0x379e19['predictiveIntervalHitRate']=_0x560e40[_0xb0ee('0x4a')];_0x379e19['predictiveIntervalMultiplicativeFactor']=_0x560e40[_0xb0ee('0x4b')];_0x379e19[_0xb0ee('0x4c')]=_0x560e40[_0xb0ee('0x4c')];_0x379e19[_0xb0ee('0x4d')]=_0x560e40[_0xb0ee('0x4d')];_0x379e19['predictiveIntervalTotalCalls']=_0x560e40[_0xb0ee('0x4e')];_0x379e19[_0xb0ee('0x1c')]=_0x560e40['message'];_0x379e19[_0xb0ee('0x4f')]=_0x560e40[_0xb0ee('0x4f')];_0x379e19[_0xb0ee('0x50')]=_0x560e40[_0xb0ee('0x50')];_0x379e19[_0xb0ee('0x51')]=_0x560e40[_0xb0ee('0x51')];_0x379e19[_0xb0ee('0x52')]=_0x560e40['erlangAbandonmentRate'];_0x379e19[_0xb0ee('0x53')]=_0x560e40[_0xb0ee('0x53')];_0x379e19['startPredictive']=_0x560e40[_0xb0ee('0x54')];_0x379e19['startProgressive']=_0x560e40[_0xb0ee('0x55')];}if(_0x560e40['Trunk']){_0x379e19[_0xb0ee('0x56')]={'id':_0x560e40['Trunk']['id'],'name':_0x560e40[_0xb0ee('0x56')][_0xb0ee('0xb')],'active':_0x560e40[_0xb0ee('0x56')][_0xb0ee('0x57')],'callerid':_0x560e40[_0xb0ee('0x56')][_0xb0ee('0x58')]};}if(_0x560e40[_0xb0ee('0x59')]){_0x379e19[_0xb0ee('0x59')]={'id':_0x560e40[_0xb0ee('0x59')]['id'],'name':_0x560e40[_0xb0ee('0x59')][_0xb0ee('0xb')]};}_0x53bccd[_0xb0ee('0x5a')](_0x379e19);}}_0x151188({'count':_0x53bccd[_0xb0ee('0x5b')],'rows':_0x53bccd});});},'UpdateVoiceQueue':function(_0x3283e1){return new Promise(function(_0x29c77f,_0x1fe004){var _0x531285=_['find'](_0x13a7ce[_0xb0ee('0x22')],{'id':parseInt(_0x3283e1['id'])});var _0x1c9b6f=_['omit'](_0x3283e1,['id']);if(_0x531285){for(var _0x3ef149 in _0x1c9b6f){if(typeof _0x1c9b6f[_0x3ef149]!=='undefined'&&typeof _0x531285[_0x3ef149]!==_0xb0ee('0x5c')){_0x531285[_0x3ef149]=_0x1c9b6f[_0x3ef149];}}_0x29c77f(_0x531285);}else{_0x1fe004();}});},'VoiceChannels':function(_0x10b262){return new Promise(function(_0x27ad3f,_0x75d703){var _0xc97f89=_[_0xb0ee('0x5d')](_0x13a7ce[_0xb0ee('0x5e')]);_0x27ad3f({'count':_0xc97f89[_0xb0ee('0x5b')],'rows':_0xc97f89});});},'VoiceChannelMixMonitor':function(_0xd75cb7){var _0x9dc38a=this;return new Promise(function(_0x27ad24,_0x481163){if(ami['isConnected']()==![]){return _0x481163(_0x9dc38a['error'](0x1f4,[config[_0xb0ee('0x13')]['ip'],config[_0xb0ee('0x13')]['username'],_0xb0ee('0x15')][_0xb0ee('0x16')]('\x20')));}var _0x17e916=schema(properties[_0xb0ee('0x5f')])[_0xb0ee('0x3')](_0xd75cb7);if(_0x17e916[_0xb0ee('0x5b')]>0x0){return _0x481163(_0x9dc38a['error'](0x1f4,_[_0xb0ee('0x60')](_0x17e916,_0xb0ee('0x1c'))['join'](',\x20')));}var _0x32df68=_['find'](_0x13a7ce[_0xb0ee('0x5e')],{'uniqueid':_0xd75cb7[_0xb0ee('0x61')]});if(_0x32df68&&_0x32df68[_0xb0ee('0x62')]){var _0x599412=util['format'](_0xb0ee('0x63'),_0xd75cb7['filename']||_0xd75cb7[_0xb0ee('0x61')],_0xd75cb7[_0xb0ee('0x8')]||_0xb0ee('0x64'));return ami[_0xb0ee('0x20')]({'action':_0xb0ee('0x65'),'channel':_0x32df68[_0xb0ee('0x62')],'file':_0x599412,'options':'ai(mixmonitorid)'})[_0xb0ee('0x1b')](function(_0x341adf){var _0x4ec9bf=_[_0xb0ee('0x66')](_0x32df68[_0xb0ee('0x67')],{'filename':_0xb0ee('0x68')+_0x599412[_0xb0ee('0x69')]()});if(_[_0xb0ee('0x6a')](_0x4ec9bf)){_0x32df68[_0xb0ee('0x67')][_0xb0ee('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x599412[_0xb0ee('0x69')](),'createdAt':moment()[_0xb0ee('0x8')](_0xb0ee('0x6b')),'mixmonitorid':_0x341adf['mixmonitorid'],'status':_0xb0ee('0x6c')});}else{_0x4ec9bf[_0xb0ee('0x6d')]=_0x341adf[_0xb0ee('0x6d')];_0x4ec9bf[_0xb0ee('0x6e')]='rec';}_0x27ad24({'code':0xc8,'message':[_0xd75cb7[_0xb0ee('0x61')],_0xb0ee('0x6f'),_0x341adf[_0xb0ee('0x6d')]]['join']('\x20'),'mixmonitorid':_0x341adf[_0xb0ee('0x6d')]});})[_0xb0ee('0x1d')](function(_0x46deb9){_0x481163(_0x9dc38a[_0xb0ee('0x12')](0x1f5,[_0xd75cb7[_0xb0ee('0x61')],_0x46deb9[_0xb0ee('0x1c')][_0xb0ee('0x69')]()][_0xb0ee('0x16')]('\x20')));});}else{return _0x481163(_0x9dc38a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1b1311){var _0x40b4e4=this;return new Promise(function(_0x1ba436,_0x2f7068){if(ami[_0xb0ee('0x11')]()==![]){return _0x2f7068(_0x40b4e4['error'](0x1f4,[config[_0xb0ee('0x13')]['ip'],config['asterisk'][_0xb0ee('0x14')],'ami\x20disconnected']['join']('\x20')));}var _0x105f42=schema(properties[_0xb0ee('0x5f')])[_0xb0ee('0x3')](_0x1b1311);if(_0x105f42[_0xb0ee('0x5b')]>0x0){return _0x2f7068(_0x40b4e4[_0xb0ee('0x12')](0x1f4,_[_0xb0ee('0x60')](_0x105f42,_0xb0ee('0x1c'))[_0xb0ee('0x16')](',\x20')));}var _0x155a88=_[_0xb0ee('0x66')](_0x13a7ce[_0xb0ee('0x5e')],{'uniqueid':_0x1b1311['uniqueid']});if(_0x155a88){return BPromise['resolve']()['then'](function(){if(_0x155a88[_0xb0ee('0x62')]){return ami['Action']({'action':_0xb0ee('0x70'),'channel':_0x155a88['channel'],'mixmonitorid':_0x1b1311['mixmonitorid']})[_0xb0ee('0x1d')](function(_0x1b42aa){});}})['then'](function(){if(_0x155a88[_0xb0ee('0x71')]){return ami[_0xb0ee('0x20')]({'action':_0xb0ee('0x70'),'channel':_0x155a88['destinationchannel'],'mixmonitorid':_0x1b1311[_0xb0ee('0x6d')]})[_0xb0ee('0x1d')](function(_0x12c781){});}})[_0xb0ee('0x1b')](function(_0x3281de){var _0x285499=_[_0xb0ee('0x66')](_0x155a88['monitors'],{'mixmonitorid':_0x1b1311['mixmonitorid']});if(_0x285499){_0x285499[_0xb0ee('0x6e')]=_0xb0ee('0x72');}})[_0xb0ee('0x1b')](function(){var _0x387072=util[_0xb0ee('0x8')](_0xb0ee('0x63'),_0x1b1311['filename']||_0x1b1311[_0xb0ee('0x61')],_0x1b1311['format']||_0xb0ee('0x64'));var _0x2bdb86=_[_0xb0ee('0x66')](_0x155a88['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x387072[_0xb0ee('0x69')]()});if(_0x2bdb86){_0x2bdb86[_0xb0ee('0x6e')]=_0xb0ee('0x72');}})[_0xb0ee('0x1b')](function(){_0x1ba436({'code':0xc8,'message':[_0x1b1311[_0xb0ee('0x61')],_0xb0ee('0x73')][_0xb0ee('0x16')]('\x20')});})[_0xb0ee('0x1d')](function(_0xa2f2ef){_0x2f7068(_0x40b4e4[_0xb0ee('0x12')](0x1f5,[_0x1b1311[_0xb0ee('0x61')],_0xa2f2ef['message'][_0xb0ee('0x69')]()]['join']('\x20')));});}else{return _0x2f7068(_0x40b4e4[_0xb0ee('0x12')](0x1f5,_0xb0ee('0x74')));}});},'VoiceQueuesChannels':function(_0xd52d8c){return new Promise(function(_0x46faf5,_0x13ee76){var _0x252b68=_[_0xb0ee('0x5d')](_0x13a7ce['queueChannels']);_0x46faf5({'count':_0x252b68[_0xb0ee('0x5b')],'rows':_0x252b68});});},'VoiceQueuesChannel':function(_0x358238){var _0x17ce21=this;return new Promise(function(_0x4f06a3,_0xa085e4){var _0x1cbaf9=schema(properties[_0xb0ee('0x75')])[_0xb0ee('0x3')](_0x358238);if(_0x1cbaf9['length']>0x0){return _0xa085e4(_0x17ce21[_0xb0ee('0x12')](0x1f4,_[_0xb0ee('0x60')](_0x1cbaf9,'message')[_0xb0ee('0x16')](',\x20')));}var _0x59caab=_[_0xb0ee('0x66')](_0x13a7ce[_0xb0ee('0x76')],{'uniqueid':_0x358238[_0xb0ee('0x61')]});if(_0x59caab){_0x4f06a3(_0x59caab);}else{return _0xa085e4(_0x17ce21[_0xb0ee('0x12')](0x1f5,_0xb0ee('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x3e8f10){var _0x3712ce=this;return new Promise(function(_0x2d5685,_0x203b46){if(ami[_0xb0ee('0x11')]()==![]){return _0x203b46(_0x3712ce[_0xb0ee('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xb0ee('0x13')]['username'],_0xb0ee('0x15')]['join']('\x20')));}var _0x451d75=schema(properties[_0xb0ee('0x77')])[_0xb0ee('0x3')](_0x3e8f10);if(_0x451d75[_0xb0ee('0x5b')]>0x0){return _0x203b46(_0x3712ce['error'](0x1f4,_[_0xb0ee('0x60')](_0x451d75,'message')['join'](',\x20')));}var _0x16f2ff=_['find'](_0x13a7ce[_0xb0ee('0x76')],{'uniqueid':_0x3e8f10[_0xb0ee('0x61')]});if(_0x16f2ff&&_0x16f2ff[_0xb0ee('0x62')]){return ami['Action']({'action':_0xb0ee('0x78'),'channel':_0x16f2ff[_0xb0ee('0x62')]})[_0xb0ee('0x1b')](function(_0x2228c7){_0x2d5685({'code':0xc8,'message':[_0x3e8f10[_0xb0ee('0x61')],_0x2228c7[_0xb0ee('0x1c')][_0xb0ee('0x69')]()][_0xb0ee('0x16')]('\x20')});})[_0xb0ee('0x1d')](function(_0x371a13){_0x203b46(_0x3712ce[_0xb0ee('0x12')](0x1f5,[_0x3e8f10[_0xb0ee('0x61')],_0x371a13['message']['toLowerCase']()][_0xb0ee('0x16')]('\x20')));});}else{return _0x203b46(_0x3712ce[_0xb0ee('0x12')](0x1f5,_0xb0ee('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x1b53ea){var _0x1aed71=this;return new Promise(function(_0x47f06f,_0xe26a66){if(ami[_0xb0ee('0x11')]()==![]){return _0xe26a66(_0x1aed71[_0xb0ee('0x12')](0x1f4,[config[_0xb0ee('0x13')]['ip'],config[_0xb0ee('0x13')][_0xb0ee('0x14')],_0xb0ee('0x15')][_0xb0ee('0x16')]('\x20')));}var _0x58a6f2=schema(properties[_0xb0ee('0x79')])[_0xb0ee('0x3')](_0x1b53ea);if(_0x58a6f2['length']>0x0){return _0xe26a66(_0x1aed71[_0xb0ee('0x12')](0x1f4,_[_0xb0ee('0x60')](_0x58a6f2,'message')[_0xb0ee('0x16')](',\x20')));}var _0x5f0e6d=_['find'](_0x13a7ce[_0xb0ee('0x76')],{'uniqueid':_0x1b53ea[_0xb0ee('0x61')]});if(_0x5f0e6d&&_0x5f0e6d[_0xb0ee('0x62')]){return ami['Action']({'action':'Redirect','channel':_0x5f0e6d[_0xb0ee('0x62')],'exten':_0x1b53ea[_0xb0ee('0x7a')],'context':_0x1b53ea[_0xb0ee('0x7b')]||_0x5f0e6d['context'],'priority':0x1})[_0xb0ee('0x1b')](function(_0x445c3f){_0x47f06f({'code':0xc8,'message':[_0x1b53ea['uniqueid'],_0x445c3f['message']['toLowerCase']()]['join']('\x20')});})[_0xb0ee('0x1d')](function(_0x3066b6){_0xe26a66(_0x1aed71[_0xb0ee('0x12')](0x1f5,[_0x1b53ea['uniqueid'],_0x3066b6[_0xb0ee('0x1c')]['toLowerCase']()]['join']('\x20')));});}else{return _0xe26a66(_0x1aed71['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2b2597){return new Promise(function(_0x345eb7,_0x586bce){var _0x5a634a=_[_0xb0ee('0x5d')](_0x13a7ce[_0xb0ee('0xe')]);_0x345eb7({'count':_0x5a634a['length'],'rows':_0x5a634a});});},'Telephones':function(_0x4b0e71){return new Promise(function(_0x195707,_0x4608f4){var _0x5169bc=_['values'](_0x13a7ce[_0xb0ee('0x7c')]);_0x195707({'count':_0x5169bc['length'],'rows':_0x5169bc});});},'Trunks':function(_0x4f6f59){return new Promise(function(_0x3e8034,_0x472b1c){var _0x471e4a=_[_0xb0ee('0x5d')](_0x13a7ce[_0xb0ee('0x7d')]);_0x3e8034({'count':_0x471e4a[_0xb0ee('0x5b')],'rows':_0x471e4a});});},'OutboundChannels':function(_0x55c96c){return new Promise(function(_0x437dd1,_0x11a80c){var _0x3e2f22=_['values'](_0x13a7ce[_0xb0ee('0x7e')]);_0x437dd1({'count':_0x3e2f22['length'],'rows':_0x3e2f22});});},'Outbound':function(_0xa22b39){return new Promise(function(_0x50d3c7,_0x4c1a66){_0x50d3c7(_0x13a7ce[_0xb0ee('0x2f')]);});},'Campaigns':function(_0x445c83){return new Promise(function(_0x4e7981,_0x163b65){var _0x1726ad=_[_0xb0ee('0x5d')](_0x13a7ce[_0xb0ee('0x7f')]);_0x4e7981({'count':_0x1726ad[_0xb0ee('0x5b')],'rows':_0x1726ad});});},'VoiceQueuesPreview':function(_0x2406df){var _0x206de5=this;return new Promise(function(_0x44a5ad,_0x222491){_0x76bf19[_0xb0ee('0x80')](_0x2406df['id'])[_0xb0ee('0x1b')](function(_0x39dd25){_0x44a5ad({'code':0xc8,'message':_0x39dd25[_0xb0ee('0x1c')]});})[_0xb0ee('0x1d')](function(_0x59e4f1){_0x222491(_0x206de5[_0xb0ee('0x12')](0x1f4,_0x59e4f1[_0xb0ee('0x1c')]));});});},'EventManager':function(_0x4a0b5b){var _0x2e4ffe=this;return new Promise(function(_0x554405,_0x2e7604){if(!_0x4a0b5b['event']){return _0x2e7604(_0x2e4ffe[_0xb0ee('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xb0ee('0x81')](_0xb0ee('0x82')+_0x4a0b5b[_0xb0ee('0x83')],_0x4a0b5b[_0xb0ee('0x1c')]);_0x554405({'code':0xc8,'message':_0x4a0b5b});});},'FaxAccounts':function(_0x96d5c6){return new Promise(function(_0xf74391,_0x50a7c0){var _0x314e3c=_[_0xb0ee('0x5d')](_0x13a7ce[_0xb0ee('0x84')]);_0xf74391({'count':_0x314e3c[_0xb0ee('0x5b')],'rows':_0x314e3c});});},'SendFax':function(_0x48d347){var _0x351c45=this;return new Promise(function(_0x4ebb8b,_0x469490){_0x209dda[_0xb0ee('0x85')](_0x48d347)['then'](function(_0x2ce819){_0x4ebb8b({'code':0xc8,'message':_0x2ce819[_0xb0ee('0x1c')]});})['catch'](function(_0x249c57){_0x469490(_0x351c45['error'](0x1f4,_0x249c57[_0xb0ee('0x1c')]));});});},'CheckAfterSend':function(_0xa0ab4d){var _0x500722=this;return new Promise(function(_0x54a398,_0x1713e2){_0x209dda[_0xb0ee('0x86')](_0xa0ab4d)[_0xb0ee('0x1b')](function(_0x188773){_0x54a398({'code':0xc8,'message':_0x188773['message']});})[_0xb0ee('0x1d')](function(_0x1a2f27){_0x1713e2(_0x500722[_0xb0ee('0x12')](0x1f4,_0x1a2f27[_0xb0ee('0x1c')]));});});}};var _0x1ad658=jayson['server'](_0x5377b4)['http']();_0x1ad658['on'](_0xb0ee('0x12'),function(_0x51c4ed){return _0x17f445(_0x51c4ed);});_0x1ad658[_0xb0ee('0x7')](0x232a,_0xb0ee('0x87'),function(){console[_0xb0ee('0x88')](_0xb0ee('0x89'),0x232a);return _0x453fa4('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x5e0e=['moment','../../../config/environment','../properties','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','catch','message','error','command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','waiting','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','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','undefined','values','voicechannel','find','channels','uniqueid','channel','format','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','filename','wav','StopMixMonitor\x20Success','queueChannels','Hangup','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird'];(function(_0x3a43ff,_0x21ec1d){var _0x3a39ad=function(_0x391bb3){while(--_0x391bb3){_0x3a43ff['push'](_0x3a43ff['shift']());}};_0x3a39ad(++_0x21ec1d);}(_0x5e0e,0x89));var _0xe5e0=function(_0x2b5947,_0x2383a6){_0x2b5947=_0x2b5947-0x0;var _0x3080a3=_0x5e0e[_0x2b5947];return _0x3080a3;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var jayson=require('jayson/promise');var schema=require(_0xe5e0('0x2'));var BPromise=require(_0xe5e0('0x3'));var moment=require(_0xe5e0('0x4'));var config=require(_0xe5e0('0x5'));var properties=require(_0xe5e0('0x6'));var ami=require('../ami');exports[_0xe5e0('0x7')]=function(_0x52407b,_0x239262,_0x3e564e){return new BPromise(function(_0x2ff9ac,_0x1a4c51){var _0xa91224={'QueuePause':function(_0x156c30){return new Promise(function(_0x59a81f,_0x4059cf){var _0x29199a=util['format'](_0xe5e0('0x8'),_0xe5e0('0x9'),_0x156c30[_0xe5e0('0xa')]);if(_0x52407b[_0xe5e0('0xb')]&&_0x52407b[_0xe5e0('0xb')][_0x29199a]&&_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xc')]){_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xd')]();}if(_0x52407b[_0xe5e0('0xe')][_0x29199a]){_0x52407b[_0xe5e0('0xe')][_0x29199a][_0xe5e0('0xf')]({'statePause':_0x156c30[_0xe5e0('0x10')]?!![]:![]});}_0x59a81f({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x5cabeb){var _0x43638e=this;return new Promise(function(_0x1100cc,_0x24f33d){if(ami[_0xe5e0('0x11')]()==![]){return _0x24f33d(_0x43638e['error'](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x5cabeb=_[_0xe5e0('0x16')](_0x5cabeb,_[_0xe5e0('0x17')](properties[_0xe5e0('0x18')]));_0x5cabeb[_0xe5e0('0x19')]='Reload';return ami[_0xe5e0('0x1a')](_0x5cabeb)['then'](function(_0x417077){_0x1100cc({'code':0xc8,'message':_0x417077['message']});})[_0xe5e0('0x1b')](function(_0x150c3a){_0x24f33d(_0x43638e['error'](0x1f5,_0x150c3a[_0xe5e0('0x1c')]));});});},'Command':function(_0x4a7ea4){var _0xa81bd4=this;return new Promise(function(_0xce7366,_0x3a2480){if(ami[_0xe5e0('0x11')]()==![]){return _0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x4a7ea4=_[_0xe5e0('0x16')](_0x4a7ea4,_0xe5e0('0x1e'));_0x4a7ea4[_0xe5e0('0x19')]='Command';return ami['Action'](_0x4a7ea4)[_0xe5e0('0x1f')](function(_0x228368){_0xce7366({'code':0xc8,'message':_0x228368[_0xe5e0('0x20')]});})[_0xe5e0('0x1b')](function(_0x3596ca){_0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f5,_0x3596ca[_0xe5e0('0x1c')]));});});},'VoiceQueues':function(_0x48071c){return new Promise(function(_0xf45724,_0x5df2be){var _0x332c4e=[];for(var _0x6f21de in _0x52407b[_0xe5e0('0x21')]){if(_0x52407b[_0xe5e0('0x21')][_0xe5e0('0x22')](_0x6f21de)){var _0x4867f2=_0x52407b['voiceQueues'][_0x6f21de];var _0x25fe90={'id':_0x4867f2['id'],'name':_0x4867f2['name'],'strategy':_0x4867f2[_0xe5e0('0x23')],'answered':_0x4867f2[_0xe5e0('0x24')],'available':_0x4867f2[_0xe5e0('0x25')],'loggedIn':_0x4867f2[_0xe5e0('0x26')],'pTalking':_0x4867f2[_0xe5e0('0x27')],'sumBillable':_0x4867f2[_0xe5e0('0x28')],'sumDuration':_0x4867f2['sumDuration'],'sumHoldTime':_0x4867f2[_0xe5e0('0x29')]||0x0,'talking':_0x4867f2['talking'],'total':_0x4867f2[_0xe5e0('0x2a')],'type':_0x4867f2[_0xe5e0('0x2b')],'unmanaged':_0x4867f2[_0xe5e0('0x2c')],'abandoned':_0x4867f2['abandoned'],'waiting':_0x4867f2[_0xe5e0('0x2d')],'loggedInDb':_0x4867f2[_0xe5e0('0x2e')]};if(_0x4867f2[_0xe5e0('0x2b')]===_0xe5e0('0x2f')){_0x25fe90[_0xe5e0('0x30')]=_0x4867f2['dialActive'];_0x25fe90[_0xe5e0('0x31')]=_0x4867f2[_0xe5e0('0x31')];_0x25fe90[_0xe5e0('0x32')]=_0x4867f2[_0xe5e0('0x32')];_0x25fe90['dialOriginateCallerIdNumber']=_0x4867f2[_0xe5e0('0x33')];_0x25fe90[_0xe5e0('0x34')]=_0x4867f2[_0xe5e0('0x34')];_0x25fe90[_0xe5e0('0x35')]=_0x4867f2[_0xe5e0('0x35')];_0x25fe90[_0xe5e0('0x36')]=_0x4867f2[_0xe5e0('0x36')];_0x25fe90[_0xe5e0('0x37')]=_0x4867f2[_0xe5e0('0x37')];_0x25fe90[_0xe5e0('0x38')]=_0x4867f2[_0xe5e0('0x38')];_0x25fe90[_0xe5e0('0x39')]=_0x4867f2[_0xe5e0('0x39')];_0x25fe90[_0xe5e0('0x3a')]=_0x4867f2[_0xe5e0('0x3a')];_0x25fe90[_0xe5e0('0x3b')]=_0x4867f2['outboundCongestionCallsDay'];_0x25fe90['outboundDropCallsDayACS']=_0x4867f2[_0xe5e0('0x3c')];_0x25fe90[_0xe5e0('0x3d')]=_0x4867f2[_0xe5e0('0x3d')];_0x25fe90['outboundDropCallsDayTimeout']=_0x4867f2[_0xe5e0('0x3e')];_0x25fe90[_0xe5e0('0x3f')]=_0x4867f2[_0xe5e0('0x3f')];_0x25fe90['outboundNoSuchCallsDay']=_0x4867f2[_0xe5e0('0x40')];_0x25fe90[_0xe5e0('0x41')]=_0x4867f2[_0xe5e0('0x41')];_0x25fe90[_0xe5e0('0x42')]=_0x4867f2['outboundReCallsDay'];_0x25fe90[_0xe5e0('0x43')]=_0x4867f2['outboundRejectCallsDay'];_0x25fe90[_0xe5e0('0x44')]=_0x4867f2['outboundUnknownCallsDay'];_0x25fe90[_0xe5e0('0x45')]=_0x4867f2['predictiveIntervalAnsweredCalls'];_0x25fe90[_0xe5e0('0x46')]=_0x4867f2[_0xe5e0('0x46')];_0x25fe90['predictiveIntervalAvgTalktime']=_0x4867f2[_0xe5e0('0x47')];_0x25fe90[_0xe5e0('0x48')]=_0x4867f2[_0xe5e0('0x48')];_0x25fe90[_0xe5e0('0x49')]=_0x4867f2[_0xe5e0('0x49')];_0x25fe90[_0xe5e0('0x4a')]=_0x4867f2[_0xe5e0('0x4a')];_0x25fe90[_0xe5e0('0x4b')]=_0x4867f2[_0xe5e0('0x4b')];_0x25fe90[_0xe5e0('0x4c')]=_0x4867f2[_0xe5e0('0x4c')];_0x25fe90['predictiveIntervalMultiplicativeFactor']=_0x4867f2[_0xe5e0('0x4d')];_0x25fe90[_0xe5e0('0x4e')]=_0x4867f2[_0xe5e0('0x4e')];_0x25fe90[_0xe5e0('0x4f')]=_0x4867f2[_0xe5e0('0x4f')];_0x25fe90['predictiveIntervalTotalCalls']=_0x4867f2[_0xe5e0('0x50')];_0x25fe90[_0xe5e0('0x1c')]=_0x4867f2[_0xe5e0('0x1c')];_0x25fe90[_0xe5e0('0x51')]=_0x4867f2['originated'];_0x25fe90[_0xe5e0('0x52')]=_0x4867f2[_0xe5e0('0x52')];_0x25fe90[_0xe5e0('0x53')]=_0x4867f2[_0xe5e0('0x53')];_0x25fe90[_0xe5e0('0x54')]=_0x4867f2['erlangAbandonmentRate'];_0x25fe90[_0xe5e0('0x55')]=_0x4867f2['erlangBusyFactor'];_0x25fe90['startPredictive']=_0x4867f2[_0xe5e0('0x56')];_0x25fe90[_0xe5e0('0x57')]=_0x4867f2[_0xe5e0('0x57')];}if(_0x4867f2[_0xe5e0('0x58')]){_0x25fe90[_0xe5e0('0x58')]={'id':_0x4867f2['Trunk']['id'],'name':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0xa')],'active':_0x4867f2['Trunk']['active'],'callerid':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0x59')]};}if(_0x4867f2[_0xe5e0('0x5a')]){_0x25fe90[_0xe5e0('0x5a')]={'id':_0x4867f2[_0xe5e0('0x5a')]['id'],'name':_0x4867f2['Interval'][_0xe5e0('0xa')]};}_0x332c4e[_0xe5e0('0x5b')](_0x25fe90);}}_0xf45724({'count':_0x332c4e[_0xe5e0('0x5c')],'rows':_0x332c4e});});},'UpdateVoiceQueue':function(_0x56994a){return new Promise(function(_0x3b86e1,_0x21b731){var _0x12ba02=_['find'](_0x52407b['voiceQueues'],{'id':parseInt(_0x56994a['id'])});var _0x43df1d=_['omit'](_0x56994a,['id']);if(_0x12ba02){for(var _0x3084ff in _0x43df1d){if(typeof _0x43df1d[_0x3084ff]!==_0xe5e0('0x5d')&&typeof _0x12ba02[_0x3084ff]!==_0xe5e0('0x5d')){_0x12ba02[_0x3084ff]=_0x43df1d[_0x3084ff];}}_0x3b86e1(_0x12ba02);}else{_0x21b731();}});},'VoiceChannels':function(_0x160803){return new Promise(function(_0x183e81,_0x2138ae){var _0x38fd91=_[_0xe5e0('0x5e')](_0x52407b['channels']);_0x183e81({'count':_0x38fd91['length'],'rows':_0x38fd91});});},'VoiceChannelMixMonitor':function(_0x552a9e){var _0x314ee7=this;return new Promise(function(_0x4fd77b,_0x494257){if(ami['isConnected']()==![]){return _0x494257(_0x314ee7['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],_0xe5e0('0x14')]['join']('\x20')));}var _0x47974f=schema(properties[_0xe5e0('0x5f')])[_0xe5e0('0x2')](_0x552a9e);if(_0x47974f['length']>0x0){return _0x494257(_0x314ee7['error'](0x1f4,_['map'](_0x47974f,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x3836cb=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x552a9e[_0xe5e0('0x62')]});if(_0x3836cb&&_0x3836cb[_0xe5e0('0x63')]){var _0x530d10=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x552a9e['filename']||_0x552a9e[_0xe5e0('0x62')],_0x552a9e[_0xe5e0('0x64')]||'wav');return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x66'),'channel':_0x3836cb[_0xe5e0('0x63')],'file':_0x530d10,'options':_0xe5e0('0x67')})[_0xe5e0('0x1f')](function(_0x38e40){var _0x4cfdd1=_[_0xe5e0('0x60')](_0x3836cb[_0xe5e0('0x68')],{'filename':_0xe5e0('0x69')+_0x530d10[_0xe5e0('0x6a')]()});if(_[_0xe5e0('0x6b')](_0x4cfdd1)){_0x3836cb['monitors'][_0xe5e0('0x5b')]({'filename':_0xe5e0('0x69')+_0x530d10['toLowerCase'](),'createdAt':moment()[_0xe5e0('0x64')](_0xe5e0('0x6c')),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')],'status':_0xe5e0('0x6e')});}else{_0x4cfdd1[_0xe5e0('0x6d')]=_0x38e40[_0xe5e0('0x6d')];_0x4cfdd1[_0xe5e0('0x6f')]=_0xe5e0('0x6e');}_0x4fd77b({'code':0xc8,'message':[_0x552a9e[_0xe5e0('0x62')],_0xe5e0('0x70'),_0x38e40['mixmonitorid']][_0xe5e0('0x15')]('\x20'),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')]});})['catch'](function(_0x44d6bd){_0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,[_0x552a9e[_0xe5e0('0x62')],_0x44d6bd[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()][_0xe5e0('0x15')]('\x20')));});}else{return _0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x12e5a3){var _0x38c0e8=this;return new Promise(function(_0x21f7ed,_0x37c521){if(ami[_0xe5e0('0x11')]()==![]){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],'ami\x20disconnected'][_0xe5e0('0x15')]('\x20')));}var _0xe7caf6=schema(properties[_0xe5e0('0x5f')])['validate'](_0x12e5a3);if(_0xe7caf6[_0xe5e0('0x5c')]>0x0){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0xe7caf6,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x13932c=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x12e5a3[_0xe5e0('0x62')]});if(_0x13932c){return BPromise[_0xe5e0('0x73')]()[_0xe5e0('0x1f')](function(){if(_0x13932c['channel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c[_0xe5e0('0x63')],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x5b15fc){});}})[_0xe5e0('0x1f')](function(){if(_0x13932c['destinationchannel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c['destinationchannel'],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x596990){});}})[_0xe5e0('0x1f')](function(_0x312293){var _0x24f370=_[_0xe5e0('0x60')](_0x13932c[_0xe5e0('0x68')],{'mixmonitorid':_0x12e5a3['mixmonitorid']});if(_0x24f370){_0x24f370[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){var _0x52106a=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x12e5a3[_0xe5e0('0x75')]||_0x12e5a3[_0xe5e0('0x62')],_0x12e5a3[_0xe5e0('0x64')]||_0xe5e0('0x76'));var _0x17fb65=_[_0xe5e0('0x60')](_0x13932c['monitors'],{'filename':_0xe5e0('0x69')+_0x52106a[_0xe5e0('0x6a')]()});if(_0x17fb65){_0x17fb65[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){_0x21f7ed({'code':0xc8,'message':[_0x12e5a3[_0xe5e0('0x62')],_0xe5e0('0x77')]['join']('\x20')});})['catch'](function(_0x3803d8){_0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f5,[_0x12e5a3[_0xe5e0('0x62')],_0x3803d8[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')));});}else{return _0x37c521(_0x38c0e8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d4908){return new Promise(function(_0xd0bb59,_0x41df32){var _0x49a874=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x78')]);_0xd0bb59({'count':_0x49a874[_0xe5e0('0x5c')],'rows':_0x49a874});});},'VoiceQueuesChannel':function(_0x214df7){var _0x16cfe1=this;return new Promise(function(_0x16ac31,_0x1e3281){var _0x105b24=schema(properties['voicequeuechannel'])[_0xe5e0('0x2')](_0x214df7);if(_0x105b24[_0xe5e0('0x5c')]>0x0){return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f4,_['map'](_0x105b24,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x5cdbbf=_['find'](_0x52407b['queueChannels'],{'uniqueid':_0x214df7[_0xe5e0('0x62')]});if(_0x5cdbbf){_0x16ac31(_0x5cdbbf);}else{return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x296d5c){var _0x394a7f=this;return new Promise(function(_0x34caa4,_0xc140c9){if(ami[_0xe5e0('0x11')]()==![]){return _0xc140c9(_0x394a7f['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x58dcef=schema(properties['voicequeuechannelhangup'])[_0xe5e0('0x2')](_0x296d5c);if(_0x58dcef['length']>0x0){return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0x58dcef,_0xe5e0('0x1c'))['join'](',\x20')));}var _0x261a5a=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x296d5c['uniqueid']});if(_0x261a5a&&_0x261a5a[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x79'),'channel':_0x261a5a[_0xe5e0('0x63')]})['then'](function(_0x12d9f5){_0x34caa4({'code':0xc8,'message':[_0x296d5c[_0xe5e0('0x62')],_0x12d9f5[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x135bad){_0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,[_0x296d5c[_0xe5e0('0x62')],_0x135bad['message'][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x44aa4f){var _0x5a9b7a=this;return new Promise(function(_0x5365d7,_0x3ddad0){if(ami['isConnected']()==![]){return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}var _0xa5b53d=schema(properties['voicequeuechannelredirect'])[_0xe5e0('0x2')](_0x44aa4f);if(_0xa5b53d[_0xe5e0('0x5c')]>0x0){return _0x3ddad0(_0x5a9b7a['error'](0x1f4,_[_0xe5e0('0x72')](_0xa5b53d,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x520691=_['find'](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x44aa4f[_0xe5e0('0x62')]});if(_0x520691&&_0x520691[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x7a'),'channel':_0x520691[_0xe5e0('0x63')],'exten':_0x44aa4f[_0xe5e0('0x7b')],'context':_0x44aa4f[_0xe5e0('0x7c')]||_0x520691['context'],'priority':0x1})[_0xe5e0('0x1f')](function(_0x4b8620){_0x5365d7({'code':0xc8,'message':[_0x44aa4f[_0xe5e0('0x62')],_0x4b8620['message']['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x3ab8ca){_0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,[_0x44aa4f['uniqueid'],_0x3ab8ca[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x39f0fc){return new Promise(function(_0x309012,_0x59c32f){var _0x3fb1c3=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0xe')]);_0x309012({'count':_0x3fb1c3['length'],'rows':_0x3fb1c3});});},'Telephones':function(_0x47b2e7){return new Promise(function(_0x27ae6a,_0x56eac2){var _0x272856=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7d')]);_0x27ae6a({'count':_0x272856[_0xe5e0('0x5c')],'rows':_0x272856});});},'Trunks':function(_0x2233d6){return new Promise(function(_0x430b70,_0x26e9dc){var _0x3ecced=_['values'](_0x52407b['trunks']);_0x430b70({'count':_0x3ecced[_0xe5e0('0x5c')],'rows':_0x3ecced});});},'OutboundChannels':function(_0x57c295){return new Promise(function(_0x24cbd1,_0x3e719e){var _0x4c47e7=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7e')]);_0x24cbd1({'count':_0x4c47e7[_0xe5e0('0x5c')],'rows':_0x4c47e7});});},'Outbound':function(_0x42523b){return new Promise(function(_0x282fb6,_0x1c1318){_0x282fb6(_0x52407b[_0xe5e0('0x2f')]);});},'Campaigns':function(_0x25991a){return new Promise(function(_0x5b2c5d,_0x491dd3){var _0x5d5bd4=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7f')]);_0x5b2c5d({'count':_0x5d5bd4[_0xe5e0('0x5c')],'rows':_0x5d5bd4});});},'VoiceQueuesPreview':function(_0x4fcf7e){var _0x520e3c=this;return new Promise(function(_0x102ea7,_0x1d9a34){_0x239262[_0xe5e0('0x80')](_0x4fcf7e['id'])[_0xe5e0('0x1f')](function(_0x54b7c2){_0x102ea7({'code':0xc8,'message':_0x54b7c2[_0xe5e0('0x1c')]});})[_0xe5e0('0x1b')](function(_0x28da71){_0x1d9a34(_0x520e3c[_0xe5e0('0x1d')](0x1f4,_0x28da71[_0xe5e0('0x1c')]));});});},'EventManager':function(_0x1a558f){var _0x3280ed=this;return new Promise(function(_0x31023a,_0x2bf02c){if(!_0x1a558f[_0xe5e0('0x81')]){return _0x2bf02c(_0x3280ed[_0xe5e0('0x1d')](0x1f4,_0xe5e0('0x82')));}ami[_0xe5e0('0x83')](_0xe5e0('0x84')+_0x1a558f[_0xe5e0('0x81')],_0x1a558f['message']);_0x31023a({'code':0xc8,'message':_0x1a558f});});},'FaxAccounts':function(_0x2f7df8){return new Promise(function(_0x54922c,_0x35fbd6){var _0x568aca=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x85')]);_0x54922c({'count':_0x568aca[_0xe5e0('0x5c')],'rows':_0x568aca});});},'SendFax':function(_0x36231d){var _0x6989a6=this;return new Promise(function(_0x524ab0,_0x411720){_0x3e564e[_0xe5e0('0x86')](_0x36231d)['then'](function(_0x3a20e4){_0x524ab0({'code':0xc8,'message':_0x3a20e4[_0xe5e0('0x1c')]});})['catch'](function(_0xb6b336){_0x411720(_0x6989a6['error'](0x1f4,_0xb6b336['message']));});});},'CheckAfterSend':function(_0x56f40a){var _0x58ca90=this;return new Promise(function(_0x2794b0,_0x371ef5){_0x3e564e[_0xe5e0('0x87')](_0x56f40a)[_0xe5e0('0x1f')](function(_0x597cdd){_0x2794b0({'code':0xc8,'message':_0x597cdd[_0xe5e0('0x1c')]});})['catch'](function(_0xc922ac){_0x371ef5(_0x58ca90['error'](0x1f4,_0xc922ac[_0xe5e0('0x1c')]));});});}};var _0x5bfaf0=jayson[_0xe5e0('0x88')](_0xa91224)[_0xe5e0('0x89')]();_0x5bfaf0['on'](_0xe5e0('0x1d'),function(_0xc804a2){return _0x1a4c51(_0xc804a2);});_0x5bfaf0['listen'](0x232a,_0xe5e0('0x8a'),function(){console[_0xe5e0('0x8b')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2ff9ac(_0xe5e0('0x8c')+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 7ef0785..e7be56a 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 _0x425d=['map','routeId','destcalleridnum','calleridnum','fax','createdAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or'];(function(_0x553864,_0x10491f){var _0x418ded=function(_0x118f92){while(--_0x118f92){_0x553864['push'](_0x553864['shift']());}};_0x418ded(++_0x10491f);}(_0x425d,0x1e0));var _0xd425=function(_0x244fab,_0x134fb1){_0x244fab=_0x244fab-0x0;var _0x3dfe22=_0x425d[_0x244fab];return _0x3dfe22;};'use strict';var _=require(_0xd425('0x0'));var BPromise=require('bluebird');var Redis=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var config=require(_0xd425('0x3'));var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var cmContactRpc=require(_0xd425('0x6'));config[_0xd425('0x7')]=_['defaults'](config[_0xd425('0x7')],{'host':_0xd425('0x8'),'port':0x18eb});var io=require(_0xd425('0x9'))(new Redis(config[_0xd425('0x7')]));function emit(_0x1d97d9,_0x1d2ed0,_0x50b061,_0xb6ba8e,_0x374c3d){logger[_0xd425('0xa')](_0xd425('0xb'),_0x1d97d9,_0x1d2ed0['id'],_0x50b061,_0xb6ba8e,JSON[_0xd425('0xc')](_0x374c3d));io['to'](_0x50b061)[_0xd425('0xd')](_0xb6ba8e,_0x374c3d);}exports[_0xd425('0xe')]=function(_0x1969ba,_0x3a7a01,_0x35a7f4,_0x3d2bcf){var _0x10d463,_0x26f6d2;var _0x448149={};var _0x179742=Number(_0x35a7f4[_0xd425('0xf')]);var _0x9bb611=_0x35a7f4[_0xd425('0x10')]?Boolean(Number(_0x35a7f4[_0xd425('0x10')])):![];var _0x18eafb;var _0x51263f=![];if(!_[_0xd425('0x11')](_0x35a7f4[_0xd425('0x12')])){if(_0x35a7f4[_0xd425('0x12')]=='1')_0x51263f=!![];}if(!_0x51263f){if(_0x3d2bcf['xmd-contactid']){_0x448149['id']=_0x3d2bcf[_0xd425('0x13')];}}if(!_0x448149['id']){_0x448149[_0xd425('0x14')]=_0x179742;_0x18eafb=_0x35a7f4[_0xd425('0x15')]&&_0x35a7f4[_0xd425('0x15')]!=='0'?_0x35a7f4[_0xd425('0x15')]['split'](','):[_0xd425('0x16')];_0x448149[_0xd425('0x17')]=_[_0xd425('0x18')](_0x18eafb,function(_0x5dda0c){var _0x5d6585={};_0x5d6585[_0x5dda0c]=_0x3d2bcf[_0xd425('0x19')]?_0x3d2bcf[_0xd425('0x1a')]:_0x3d2bcf[_0xd425('0x1b')];return _0x5d6585;});}var _0x1155bc=['id','firstName','lastName','phone','mobile',_0xd425('0x1c'),_0xd425('0x14'),_0xd425('0x1d'),'scheduledAt',_0xd425('0x1e')];var _0x7e982e=_['union'](_0x1155bc,_0x18eafb);BPromise[_0xd425('0x1f')]()[_0xd425('0x20')](cmContactRpc[_0xd425('0x21')]({'attributes':_0x7e982e,'where':_0x448149}))[_0xd425('0x20')](function(_0x3e93db){_0x26f6d2=_0x3e93db;if(!_[_0xd425('0x22')](_0x26f6d2)){if(_0x26f6d2[_0xd425('0x23')]===0x1){_0x10d463=_0x26f6d2[0x0];logger[_0xd425('0xa')](_0xd425('0x24'),_0x3d2bcf[_0xd425('0x25')],_0x3a7a01['id'],_0x10d463['id']);}else{logger[_0xd425('0xa')](_0xd425('0x26'),_0x3d2bcf['uniqueid'],_0x3a7a01['id'],_[_0xd425('0x18')](_0x26f6d2,'id')[_0xd425('0x27')](','));}return;}else{logger[_0xd425('0xa')](_0xd425('0x28'),_0x3d2bcf[_0xd425('0x25')],_0x3a7a01['id']);var _0x400dd7={'ListId':_0x179742};var _0x3c3402=_0x35a7f4['data4']&&_0x35a7f4[_0xd425('0x29')]!=='0'?_0x35a7f4[_0xd425('0x29')]:_0xd425('0x16');if(_0x9bb611){logger['info'](_0xd425('0x2a'),_0x3d2bcf[_0xd425('0x25')],_0x3a7a01['id']);_0x400dd7[_0x3c3402]=_[_0xd425('0x11')](_0x3d2bcf[_0xd425('0x19')])?_0x3d2bcf[_0xd425('0x1b')]:_0x3d2bcf[_0xd425('0x1a')];if(_[_0xd425('0x11')](_0x3d2bcf[_0xd425('0x19')])){_0x400dd7[_0xd425('0x2b')]=_0x3d2bcf[_0xd425('0x2c')]&&_0x3d2bcf['calleridname']!==_0xd425('0x2d')?_0x3d2bcf[_0xd425('0x2c')]:_0xd425('0x2e');}else{_0x400dd7[_0xd425('0x2b')]=_0x3d2bcf[_0xd425('0x2f')]&&_0x3d2bcf[_0xd425('0x2f')]!==_0xd425('0x2d')?_0x3d2bcf[_0xd425('0x2f')]:_0xd425('0x2e');}return BPromise[_0xd425('0x1f')]()[_0xd425('0x20')](cmContactRpc['createContact'](_0x400dd7))[_0xd425('0x20')](function(_0x2a2a9b){_0x10d463=_0x2a2a9b;_0x26f6d2[_0xd425('0x30')](_0x2a2a9b);if(_0x10d463){logger[_0xd425('0xa')](_0xd425('0x31'),_0x3d2bcf['uniqueid'],_0x3a7a01['id'],_0x10d463['id']);}return;});}else{logger[_0xd425('0xa')](_0xd425('0x32'),_0x3d2bcf['uniqueid'],_0x3a7a01['id']);_0x400dd7[_0x3c3402]=_['isNil'](_0x3d2bcf['routeId'])?_0x3d2bcf[_0xd425('0x1b')]:_0x3d2bcf[_0xd425('0x1a')];if(_[_0xd425('0x11')](_0x3d2bcf[_0xd425('0x19')])){_0x400dd7['firstName']=_0x3d2bcf[_0xd425('0x2c')]&&_0x3d2bcf[_0xd425('0x2c')]!==_0xd425('0x2d')?_0x3d2bcf[_0xd425('0x2c')]:_0xd425('0x2e');}else{_0x400dd7[_0xd425('0x2b')]=_0x3d2bcf[_0xd425('0x2f')]&&_0x3d2bcf['destcalleridname']!==_0xd425('0x2d')?_0x3d2bcf['destcalleridname']:_0xd425('0x2e');}_0x10d463=_0x400dd7;_0x26f6d2[_0xd425('0x30')](_0x400dd7);return;}}})[_0xd425('0x20')](function(){if(_0x1969ba){emit(_0x3d2bcf['uniqueid'],_0x3a7a01,util[_0xd425('0x33')](_0xd425('0x34'),_0x1969ba[_0xd425('0x35')]),util[_0xd425('0x33')]('trigger:%s',_0x35a7f4[_0xd425('0x36')][_0xd425('0x37')]()),{'evt':_['merge'](_0x3d2bcf,{'autoCreate':_0x9bb611}),'contact':_0x10d463===undefined?{}:_0x10d463,'contacts':_0x26f6d2['length']===0x0?undefined:_0x26f6d2});}});}; \ No newline at end of file +var _0x0e85=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x0e85,0x7c));var _0x50e8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0e85[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var Redis=require('ioredis');var util=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x50e8('0x4')]=_['defaults'](config[_0x50e8('0x4')],{'host':_0x50e8('0x5'),'port':0x18eb});var io=require(_0x50e8('0x6'))(new Redis(config[_0x50e8('0x4')]));function emit(_0x5e8b01,_0x3ce904,_0x108edc,_0x42665e,_0x988da0){logger[_0x50e8('0x7')](_0x50e8('0x8'),_0x5e8b01,_0x3ce904['id'],_0x108edc,_0x42665e,JSON['stringify'](_0x988da0));io['to'](_0x108edc)[_0x50e8('0x9')](_0x42665e,_0x988da0);}exports[_0x50e8('0xa')]=function(_0x19d1bc,_0x2d4750,_0x154b9e,_0x194a89){var _0x45dc6f,_0x3d25ea;var _0x55ba0a={};var _0x56707f=Number(_0x154b9e[_0x50e8('0xb')]);var _0x24d381=_0x154b9e['data2']?Boolean(Number(_0x154b9e['data2'])):![];var _0x3cb45c;var _0x2abda1=![];if(!_[_0x50e8('0xc')](_0x154b9e[_0x50e8('0xd')])){if(_0x154b9e['data5']=='1')_0x2abda1=!![];}if(!_0x2abda1){if(_0x194a89[_0x50e8('0xe')]){_0x55ba0a['id']=_0x194a89[_0x50e8('0xe')];}}if(!_0x55ba0a['id']){_0x55ba0a[_0x50e8('0xf')]=_0x56707f;_0x3cb45c=_0x154b9e['data3']&&_0x154b9e['data3']!=='0'?_0x154b9e[_0x50e8('0x10')][_0x50e8('0x11')](','):[_0x50e8('0x12')];_0x55ba0a[_0x50e8('0x13')]=_[_0x50e8('0x14')](_0x3cb45c,function(_0x1f0338){var _0x5642bf={};_0x5642bf[_0x1f0338]=_0x194a89['routeId']?_0x194a89[_0x50e8('0x15')]:_0x194a89[_0x50e8('0x16')];return _0x5642bf;});}var _0x40d060=['id',_0x50e8('0x17'),_0x50e8('0x18'),_0x50e8('0x12'),_0x50e8('0x19'),'fax',_0x50e8('0xf'),'createdAt',_0x50e8('0x1a'),_0x50e8('0x1b')];var _0xd263d=_[_0x50e8('0x1c')](_0x40d060,_0x3cb45c);BPromise[_0x50e8('0x1d')]()['then'](cmContactRpc[_0x50e8('0x1e')]({'attributes':_0xd263d,'where':_0x55ba0a}))[_0x50e8('0x1f')](function(_0x58110d){_0x3d25ea=_0x58110d;if(!_[_0x50e8('0x20')](_0x3d25ea)){if(_0x3d25ea[_0x50e8('0x21')]===0x1){_0x45dc6f=_0x3d25ea[0x0];logger['info'](_0x50e8('0x22'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id'],_0x45dc6f['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x194a89['uniqueid'],_0x2d4750['id'],_[_0x50e8('0x14')](_0x3d25ea,'id')[_0x50e8('0x24')](','));}return;}else{logger[_0x50e8('0x7')](_0x50e8('0x25'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);var _0x13b6e9={'ListId':_0x56707f};var _0x53d848=_0x154b9e[_0x50e8('0x26')]&&_0x154b9e[_0x50e8('0x26')]!=='0'?_0x154b9e['data4']:_0x50e8('0x12');if(_0x24d381){logger[_0x50e8('0x7')](_0x50e8('0x27'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_['isNil'](_0x194a89[_0x50e8('0x28')])?_0x194a89['calleridnum']:_0x194a89[_0x50e8('0x15')];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9['firstName']=_0x194a89[_0x50e8('0x29')]&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x29')]:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89['destcalleridname']!==_0x50e8('0x2a')?_0x194a89[_0x50e8('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x50e8('0x1f')](cmContactRpc[_0x50e8('0x2d')](_0x13b6e9))[_0x50e8('0x1f')](function(_0x47ace2){_0x45dc6f=_0x47ace2;_0x3d25ea['push'](_0x47ace2);if(_0x45dc6f){logger[_0x50e8('0x7')](_0x50e8('0x2e'),_0x194a89['uniqueid'],_0x2d4750['id'],_0x45dc6f['id']);}return;});}else{logger[_0x50e8('0x7')](_0x50e8('0x2f'),_0x194a89[_0x50e8('0x23')],_0x2d4750['id']);_0x13b6e9[_0x53d848]=_[_0x50e8('0xc')](_0x194a89['routeId'])?_0x194a89[_0x50e8('0x16')]:_0x194a89['destcalleridnum'];if(_[_0x50e8('0xc')](_0x194a89[_0x50e8('0x28')])){_0x13b6e9[_0x50e8('0x17')]=_0x194a89['calleridname']&&_0x194a89[_0x50e8('0x29')]!==_0x50e8('0x2a')?_0x194a89['calleridname']:_0x50e8('0x2b');}else{_0x13b6e9[_0x50e8('0x17')]=_0x194a89[_0x50e8('0x2c')]&&_0x194a89[_0x50e8('0x2c')]!==''?_0x194a89[_0x50e8('0x2c')]:_0x50e8('0x2b');}_0x45dc6f=_0x13b6e9;_0x3d25ea[_0x50e8('0x30')](_0x13b6e9);return;}}})[_0x50e8('0x1f')](function(){if(_0x19d1bc){emit(_0x194a89['uniqueid'],_0x2d4750,util[_0x50e8('0x31')](_0x50e8('0x32'),_0x19d1bc[_0x50e8('0x33')]),util['format']('trigger:%s',_0x154b9e['action'][_0x50e8('0x34')]()),{'evt':_[_0x50e8('0x35')](_0x194a89,{'autoCreate':_0x24d381}),'contact':_0x45dc6f===undefined?{}:_0x45dc6f,'contacts':_0x3d25ea[_0x50e8('0x21')]===0x0?undefined:_0x3d25ea});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fe03921..1927a24 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 _0x75b6=['format','user:%s','name','trigger:%s:%s','toLowerCase','data1','jscripty','trigger:%s','exec','integration','voiceExtensions','routeId','urlforward','script','parse','query','replace','channel','AllConditions','checkConditions','AnyConditions','some','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','queue','agent','membername','lastevent','null','substatus','offlineMessage','created','exports','util','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','trigger','redis','defaults','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','zendeskAccounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','checkTriggers','hasOwnProperty','checkTrigger','merge','variables','Actions','length','interface','action','contactmanager','motionbar','browser','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','data3','isNil','location','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments'];(function(_0x325ee2,_0xaf1371){var _0x7f2741=function(_0x15569a){while(--_0x15569a){_0x325ee2['push'](_0x325ee2['shift']());}};_0x7f2741(++_0xaf1371);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x675b('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0x675b('0x1'));var Redis=require(_0x675b('0x2'));var urlforward=require(_0x675b('0x3'));var integration=require('./integration');var cmContact=require(_0x675b('0x4'));var script=require(_0x675b('0x5'));var config=require(_0x675b('0x6'));var logger=require('../../../config/logger')(_0x675b('0x7'));var ami=require('../ami');config[_0x675b('0x8')]=_[_0x675b('0x9')](config[_0x675b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x675b('0xa'))(new Redis(config['redis']));var operators={'equals':function(_0x1375e3,_0xf730f5){return _0x1375e3==_0xf730f5;},'not_equals':function(_0x24cf1c,_0xa32225){return _0x24cf1c!=_0xa32225;}};var barAndWebActions=[_0x675b('0xb'),_0x675b('0xc'),_0x675b('0xd')];function Trigger(_0xc9347b){this[_0x675b('0xe')]=_0xc9347b[_0x675b('0xe')];this['agents']=_0xc9347b[_0x675b('0xf')];this[_0x675b('0x10')]=_0xc9347b[_0x675b('0x10')];this[_0x675b('0x11')]=_0xc9347b['templates'];this['voiceExtensions']=_0xc9347b['voiceExtensions'];this['zendeskAccounts']=_0xc9347b['zendeskAccounts'];this[_0x675b('0x12')]=_0xc9347b['freshdeskAccounts'];this['salesforceAccounts']=_0xc9347b[_0x675b('0x13')];this[_0x675b('0x14')]=_0xc9347b[_0x675b('0x14')];this[_0x675b('0x15')]=_0xc9347b['zohoAccounts'];this[_0x675b('0x16')]=_0xc9347b[_0x675b('0x16')];this[_0x675b('0x17')]=_0xc9347b[_0x675b('0x17')];this[_0x675b('0x18')]=_0xc9347b[_0x675b('0x18')];this[_0x675b('0x19')]=_0xc9347b[_0x675b('0x19')];this['freshsalesAccounts']=_0xc9347b['freshsalesAccounts'];this[_0x675b('0x1a')]={'zendesk':this[_0x675b('0x1b')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x675b('0x14')],'zoho':this[_0x675b('0x15')],'desk':this[_0x675b('0x16')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x675b('0x19')],'freshsales':this[_0x675b('0x1c')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x1f'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x20'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x21'),this[_0x675b('0x1d')]['bind'](this));ami['on'](_0x675b('0x22'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x23'),this['syncCustomEvent'][_0x675b('0x1e')](this));ami['on'](_0x675b('0x24'),this['syncCustomEvent'][_0x675b('0x1e')](this));ami['on']('custom:agentcongestion',this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on']('custom:agentreject',this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x25'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x26'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x27'),this[_0x675b('0x28')]['bind'](this));ami['on'](_0x675b('0x29'),this[_0x675b('0x28')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2a'),this['syncAgentDial'][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2b'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2c'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2d'),this['syncCustomEvent'][_0x675b('0x1e')](this));ami['on']('custom:incomingmessage',this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2e'),this['syncCustomEvent'][_0x675b('0x1e')](this));ami['on'](_0x675b('0x2f'),this[_0x675b('0x1d')][_0x675b('0x1e')](this));ami['on'](_0x675b('0x30'),this[_0x675b('0x1d')]['bind'](this));}Trigger[_0x675b('0x31')][_0x675b('0x32')]=function(_0x5437d4,_0x4b239e,_0x918e1c){logger[_0x675b('0x33')](_0x5437d4,_0x4b239e,JSON[_0x675b('0x34')](_0x918e1c));io['to'](_0x5437d4)[_0x675b('0x32')](_0x4b239e,_0x918e1c);};Trigger[_0x675b('0x31')][_0x675b('0x1d')]=function(_0x2a0d1d){var _0x37710a=_[_0x675b('0x35')](_0x2a0d1d);if(typeof _0x37710a[_0x675b('0x36')]===_0x675b('0x37')){_0x37710a['motionChannel']='voice';}this[_0x675b('0x38')](_0x37710a);};Trigger['prototype'][_0x675b('0x28')]=function(_0x457a37){if(this[_0x675b('0xf')][_0x457a37['interface']]){this['syncCustomEvent'](_0x457a37);}};Trigger['prototype'][_0x675b('0x38')]=function(_0x48bf5a){var _0x399099;for(var _0x5a8083 in this['triggers']){if(this[_0x675b('0xe')][_0x675b('0x39')](_0x5a8083)){if(this[_0x675b('0xe')][_0x5a8083]['status']){_0x399099=this[_0x675b('0x3a')](this[_0x675b('0xe')][_0x5a8083],_0x48bf5a);if(_0x399099){_[_0x675b('0x3b')](_0x48bf5a,_0x48bf5a[_0x675b('0x3c')]);for(var _0x29d076=0x0,_0x4e789a,_0x45e6d4,_0x69d4bb;_0x29d0760x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x187214,_0x55e4b3){var _0x27a84a=function(_0x5157cf){while(--_0x5157cf){_0x187214['push'](_0x187214['shift']());}};_0x27a84a(++_0x55e4b3);}(_0x814b,0x1a2));var _0xb814=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x814b[_0x266ddc];return _0x39c1d7;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ 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 6429783..42f8bd2 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 _0x5aae=['%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','clientSecret','access_token','error','toUpperCase','message','then','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','enduserId','outbound','GET','replace','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','nameField','customField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','/systemusers(','callDirection','queue','phonecalls','ticketId','format'];(function(_0x40d58b,_0x5b1503){var _0x26f998=function(_0x4888e0){while(--_0x4888e0){_0x40d58b['push'](_0x40d58b['shift']());}};_0x26f998(++_0x5b1503);}(_0x5aae,0x15a));var _0xe5aa=function(_0x115d8d,_0xacde78){_0x115d8d=_0x115d8d-0x0;var _0x250c76=_0x5aae[_0x115d8d];return _0x250c76;};'use strict';var _=require(_0xe5aa('0x0'));var rp=require(_0xe5aa('0x1'));var util=require(_0xe5aa('0x2'));var intUtil=require(_0xe5aa('0x3'));var md5=require('md5');var Redis=require(_0xe5aa('0x4'));var logger=require(_0xe5aa('0x5'))(_0xe5aa('0x6'));var config=require('../../../../config/environment');config[_0xe5aa('0x7')]=_[_0xe5aa('0x8')](config[_0xe5aa('0x7')],{'host':_0xe5aa('0x9'),'port':0x18eb});var io=require(_0xe5aa('0xa'))(new Redis(config['redis']));function getAuthToken(_0x448de3,_0x5431fa,_0x11c1ab){if(_0x448de3[_0xe5aa('0xb')]){_0x448de3[_0xe5aa('0xc')]=_0x448de3[_0xe5aa('0xd')][_0xe5aa('0xe')];_0x448de3[_0xe5aa('0xf')]=_0x448de3['CloudProvider'][_0xe5aa('0x10')];return Promise[_0xe5aa('0x11')](_0x448de3[_0xe5aa('0xd')][_0xe5aa('0x12')]);}var _0x12832c={'method':_0xe5aa('0x13'),'uri':_0x5431fa,'form':{'client_id':_0x448de3['clientId'],'resource':_0x448de3[_0xe5aa('0xc')],'username':_0x448de3[_0xe5aa('0x14')],'password':_0x448de3[_0xe5aa('0x15')],'grant_type':_0xe5aa('0x15'),'client_secret':_0x448de3[_0xe5aa('0x16')]},'json':!![]};return rp(_0x12832c)['then'](function(_0x412b75){return _0x412b75[_0xe5aa('0x17')];})['catch'](function(_0x3a1dbe){logger[_0xe5aa('0x18')]('['+[_0x11c1ab[_0xe5aa('0x19')]()]+']\x20Wrong\x20credentials!');return _0x3a1dbe[_0xe5aa('0x1a')];});}function getUser(_0x399ff1,_0x3de4f3,_0x471a7c,_0x4ad133,_0x10144c,_0x15f647){return new Promise(function(_0xa2ab60,_0x4281ea){return getAuthToken(_0x3de4f3,_0x4ad133,_0x15f647)[_0xe5aa('0x1b')](function(_0x12c737){var _0x5796e0={'method':'GET','uri':_0x10144c+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xe5aa('0x1c')+_0x12c737,'OData-Version':_0xe5aa('0x1d')},'json':!![]};return rp(_0x5796e0);})['then'](function(_0x47021c){var _0x54b36d=_0x47021c[_0xe5aa('0x1e')];var _0x19d216=![];var _0x47cb09=null;if(!_[_0xe5aa('0x1f')](_0x471a7c)){if(intUtil[_0xe5aa('0x20')](_0x471a7c[_0xe5aa('0x21')])){_0x399ff1['userEmail']=_0x471a7c[_0xe5aa('0x21')];for(_0x47cb09=0x0;_0x47cb09<_0x54b36d[_0xe5aa('0x22')];_0x47cb09++){if(_0x54b36d[_0x47cb09][_0xe5aa('0x23')]===_0x471a7c[_0xe5aa('0x21')]&&!_0x54b36d[_0x47cb09][_0xe5aa('0x24')]){_0x19d216=!![];logger[_0xe5aa('0x25')]('['+[_0x15f647[_0xe5aa('0x19')]()]+_0xe5aa('0x26')+_0x54b36d[_0x47cb09][_0xe5aa('0x27')]+'!');_0x399ff1[_0xe5aa('0x28')]=_0x54b36d[_0x47cb09][_0xe5aa('0x27')];}}}}if(!_0x19d216){logger['info']('['+[_0x15f647[_0xe5aa('0x19')]()]+_0xe5aa('0x29'));_0x399ff1['userEmail']=_0x3de4f3[_0xe5aa('0x14')];for(_0x47cb09=0x0;_0x47cb09<_0x54b36d['length'];_0x47cb09++){if(_0x54b36d[_0x47cb09][_0xe5aa('0x23')]===_0x3de4f3[_0xe5aa('0x14')]){_0x399ff1[_0xe5aa('0x28')]=_0x54b36d[_0x47cb09]['systemuserid'];}}}_0xa2ab60(_0x399ff1);})[_0xe5aa('0x2a')](function(_0x4dae31){_0x4281ea(_0x4dae31[_0xe5aa('0x1a')]);});});}function createEndUser(_0x162903,_0x1f77f6,_0x55e4e7,_0x3c47d8,_0x55b17e,_0xb29893){return new Promise(function(_0x3d97d8,_0x2bc1e4){return getAuthToken(_0x1f77f6,_0x55e4e7,_0xb29893)[_0xe5aa('0x1b')](function(_0x5d3fd9){var _0xef09f6=_0xb29893[_0xe5aa('0x2b')]()==='outbound'?_0x55b17e[_0xe5aa('0x2c')]:_0x55b17e[_0xe5aa('0x2d')];var _0x1d5a9e={'method':_0xe5aa('0x13'),'uri':_0x3c47d8+_0xe5aa('0x2e'),'body':{'telephone1':_0xef09f6,'fullname':_0xef09f6,'firstname':_0xef09f6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x162903[_0xe5aa('0x28')]+')'},'headers':{'Authorization':_0xe5aa('0x1c')+_0x5d3fd9,'OData-Version':_0xe5aa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x1d5a9e);})[_0xe5aa('0x1b')](function(_0x288a0){var _0x1d5d94=_0x288a0['headers'][_0xe5aa('0x2f')];var _0x498246=_0x1d5d94[_0xe5aa('0x30')](_0x1d5d94[_0xe5aa('0x31')]('(')+0x1,_0x1d5d94['lastIndexOf'](')'));_0x162903[_0xe5aa('0x32')]=_0x498246;_0x3d97d8(_0x162903);})[_0xe5aa('0x2a')](function(_0x58ea7f){_0x2bc1e4(_0x58ea7f[_0xe5aa('0x1a')]);});});}function getEndUser(_0x7de527,_0x2deec1,_0x200814,_0x813d02,_0x10b7d3,_0x445094,_0x260248){var _0x94d98e=_0x445094[_0xe5aa('0x2b')]()===_0xe5aa('0x33')?_0x10b7d3[_0xe5aa('0x2c')]:_0x10b7d3[_0xe5aa('0x2d')];return getAuthToken(_0x2deec1,_0x200814,_0x445094)[_0xe5aa('0x1b')](function(_0x478853){var _0x46011c={'method':_0xe5aa('0x34'),'uri':_0x813d02+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x94d98e[_0xe5aa('0x35')]('+','%2b')+'\x27','headers':{'Authorization':_0xe5aa('0x1c')+_0x478853,'If-None-Match':null,'OData-Version':_0xe5aa('0x1d')},'json':!![]};return rp(_0x46011c);})['then'](function(_0xf82ba){var _0x3d011c=![];if(!_0xf82ba)return _0x3d011c;var _0xa852f7=_0xf82ba[_0xe5aa('0x1e')];for(var _0x161f75=0x0;_0x161f75<_0xa852f7[_0xe5aa('0x22')];_0x161f75++){if(_0xa852f7[_0x161f75][_0xe5aa('0x36')]===_0x94d98e){_0x3d011c=!![];_0x7de527['enduserId']=_0xa852f7[_0x161f75][_0xe5aa('0x37')];}}return _0x3d011c;})['then'](function(_0x71ec22){if(_0x71ec22)return _0x7de527;if(_0x260248===_0xe5aa('0x38')){logger[_0xe5aa('0x25')]('['+[_0x445094['toUpperCase']()]+_0xe5aa('0x39'));return _0x7de527;}return createEndUser(_0x7de527,_0x2deec1,_0x200814,_0x813d02,_0x10b7d3,_0x445094)['then'](function(_0x41a9bb){logger[_0xe5aa('0x25')]('['+[_0x445094[_0xe5aa('0x19')]()]+_0xe5aa('0x3a'),_0x41a9bb[_0xe5aa('0x32')]);return _0x41a9bb;});});}function getCustomFields(_0x20090f,_0x3dc652,_0x52d0e2){var _0x51bf24={};if(_0x20090f[_0xe5aa('0x22')]>0x0){_[_0xe5aa('0x3b')](_0x20090f,function(_0x51eaec){if(_[_0xe5aa('0x3c')]([_0xe5aa('0x3d'),'picklist'],_0x51eaec['type'])&&_0x51eaec[_0xe5aa('0x3e')]&&!_0x51eaec[_0xe5aa('0x3f')]){var _0x4fc156=_0x51eaec['idField'][_0xe5aa('0x2b')]();var _0x2fd292=_0x4fc156[_0xe5aa('0x30')](0x0,_0x4fc156['indexOf']('_'));var _0x53f332=_0x4fc156[_0xe5aa('0x30')](_0x4fc156[_0xe5aa('0x40')]('_')+0x1);if(_0x2fd292===_0x52d0e2){_0x51bf24[_0x53f332]=_0x51eaec[_0xe5aa('0x41')];}}});}return _0x51bf24;}function getTicket(_0x105e1f,_0x314938,_0x46de5e,_0xd49913,_0x4fa45d,_0x191b60,_0x2b439d){return new Promise(function(_0x5f353c,_0x1738be){var _0xddd4fb;return getAuthToken(_0x314938,_0x46de5e,_0x2b439d)[_0xe5aa('0x1b')](function(_0x379a72){if(_0x191b60['ticketType']===_0xe5aa('0x42')){_0xddd4fb={'method':_0xe5aa('0x13'),'uri':_0xd49913+_0xe5aa('0x43'),'body':Object[_0xe5aa('0x44')]({},{'title':intUtil[_0xe5aa('0x45')](_0x191b60[_0xe5aa('0x46')],_0x4fa45d,'\x20'),'description':intUtil['getString'](_0x191b60[_0xe5aa('0x47')],_0x4fa45d,'\x0a'),'customerid_contact@odata.bind':_0x105e1f[_0xe5aa('0x32')]?_0xe5aa('0x48')+_0x105e1f[_0xe5aa('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x105e1f[_0xe5aa('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x191b60[_0xe5aa('0x49')],_0x4fa45d,_0x191b60['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x379a72,'OData-Version':_0xe5aa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x191b60[_0xe5aa('0x4a')]===_0xe5aa('0x4b')){var _0x4641c9=_0x105e1f[_0xe5aa('0x32')]?[{'partyid_systemuser@odata.bind':_0xe5aa('0x4c')+_0x105e1f[_0xe5aa('0x28')]+')','participationtypemask':_0x105e1f['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xe5aa('0x48')+_0x105e1f[_0xe5aa('0x32')]+')','participationtypemask':_0x105e1f[_0xe5aa('0x4d')]===_0xe5aa('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe5aa('0x4c')+_0x105e1f[_0xe5aa('0x28')]+')','participationtypemask':_0x105e1f['callDirection']===_0xe5aa('0x4e')?0x2:0x1}];_0xddd4fb={'method':_0xe5aa('0x13'),'uri':_0xd49913+_0xe5aa('0x4f'),'body':Object[_0xe5aa('0x44')]({},{'subject':intUtil[_0xe5aa('0x45')](_0x191b60['Subjects'],_0x4fa45d,'\x20'),'phonenumber':String(_0x4fa45d[_0xe5aa('0x2d')]),'description':intUtil['getString'](_0x191b60[_0xe5aa('0x47')],_0x4fa45d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x105e1f['enduserId']?_0xe5aa('0x48')+_0x105e1f[_0xe5aa('0x32')]+')':undefined,'ownerid@odata.bind':_0xe5aa('0x4c')+_0x105e1f[_0xe5aa('0x28')]+')','directioncode':_0x105e1f[_0xe5aa('0x4d')]===_0xe5aa('0x4e')?![]:!![],'phonecall_activity_parties':_0x4641c9},getCustomFields(_0x191b60['Fields'],_0x4fa45d,_0x191b60[_0xe5aa('0x4a')])),'headers':{'Authorization':_0xe5aa('0x1c')+_0x379a72,'OData-Version':_0xe5aa('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xddd4fb);})['then'](function(_0x460ccb){var _0x97ffae=_0x460ccb['headers'][_0xe5aa('0x2f')];var _0x42bc55=_0x97ffae['substring'](_0x97ffae['lastIndexOf']('(')+0x1,_0x97ffae[_0xe5aa('0x31')](')'));_0x105e1f[_0xe5aa('0x50')]=_0x42bc55;_0x5f353c(_0x105e1f);})[_0xe5aa('0x2a')](function(_0xc4f3c2){_0x1738be(_0xc4f3c2[_0xe5aa('0x1a')]);});});}function emit(_0x60485a,_0x44b11f,_0x1eba09,_0x40422e){var _0x46aabc={'uri':util[_0xe5aa('0x51')](_0xe5aa('0x52'),_0x60485a,_0x1eba09,_0x40422e)};io['to'](util[_0xe5aa('0x51')](_0xe5aa('0x53'),_0x44b11f))[_0xe5aa('0x54')]('trigger:browser:url',_0x46aabc);}exports['cs']=function(_0x2737bd,_0x31907c,_0x2ecbcc,_0x4663b7,_0x3a6d21,_0x152f20,_0x3b50ae,_0x15be0a){var _0x44f169={};_0x152f20[_0xe5aa('0xc')]=_0x152f20[_0xe5aa('0xb')]?intUtil['stripTrailingSlash'](_0x152f20[_0xe5aa('0xd')][_0xe5aa('0xe')]):intUtil[_0xe5aa('0x55')](_0x152f20[_0xe5aa('0xc')]);_0x152f20[_0xe5aa('0x56')]=intUtil[_0xe5aa('0x55')](_0x152f20[_0xe5aa('0x56')]);_0x44f169[_0xe5aa('0x4d')]=_0x15be0a===_0xe5aa('0x4e')||_0x15be0a===_0xe5aa('0x57')?_0xe5aa('0x4e'):_0xe5aa('0x33');var _0x1d37c2=_0x152f20[_0xe5aa('0xb')]?util[_0xe5aa('0x51')]('%s/api/data/v9.0/',_0x152f20[_0xe5aa('0xd')][_0xe5aa('0xe')]):util[_0xe5aa('0x51')](_0xe5aa('0x58'),_0x152f20['remoteUri']);var _0x1a0f9c=util[_0xe5aa('0x51')](_0xe5aa('0x59'),_0x152f20[_0xe5aa('0xf')]);var _0x4afc9e=util[_0xe5aa('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x152f20['serverUrl'],_0x31907c[_0xe5aa('0x5a')],md5(_0x31907c[_0xe5aa('0x5a')]));if(_0x3a6d21&&_0x3a6d21[_0xe5aa('0x5b')]){logger[_0xe5aa('0x25')](_0xe5aa('0x5c'),'Recording\x20is\x20enabled!');_0x31907c[_0xe5aa('0x5d')]=_0x4afc9e;}else if(_0x3b50ae&&_0x3b50ae[_0xe5aa('0x5e')]&&_0x3b50ae['recordingFormat']!==_0xe5aa('0x5f')){logger[_0xe5aa('0x25')](_0xe5aa('0x60'),_0xe5aa('0x61'));_0x31907c[_0xe5aa('0x5d')]=_0x4afc9e;}else{_0x31907c[_0xe5aa('0x5d')]='';}return getUser(_0x44f169,_0x152f20,_0x4663b7,_0x1a0f9c,_0x1d37c2,_0x15be0a)[_0xe5aa('0x1b')](function(_0xff2f72){logger[_0xe5aa('0x25')]('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x62'),_0xff2f72[_0xe5aa('0x28')]);logger[_0xe5aa('0x25')]('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x63'),_0xff2f72[_0xe5aa('0x64')]);return getEndUser(_0xff2f72,_0x152f20,_0x1a0f9c,_0x1d37c2,_0x31907c,_0x15be0a,_0x2ecbcc[_0xe5aa('0x65')]);})[_0xe5aa('0x1b')](function(_0x3407e3){logger['info']('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x66'),_0x3407e3[_0xe5aa('0x32')]);logger['info']('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x67'),_0x31907c[_0xe5aa('0x2d')]);return getTicket(_0x3407e3,_0x152f20,_0x1a0f9c,_0x1d37c2,_0x31907c,_0x2ecbcc,_0x15be0a);})[_0xe5aa('0x1b')](function(_0x34a329){logger[_0xe5aa('0x25')](util['format']('['+_0x15be0a['toUpperCase']()+_0xe5aa('0x68'),_0x2ecbcc[_0xe5aa('0x4a')],_0x34a329['ticketId']));logger[_0xe5aa('0x25')](util['format']('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x69'),_0x15be0a));if(_0x15be0a!==_0xe5aa('0x57')){logger[_0xe5aa('0x25')]('['+_0x15be0a[_0xe5aa('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x152f20['remoteUri'],_0x4663b7['name'],_0x2ecbcc['ticketType'],_0x34a329[_0xe5aa('0x50')]);}})['catch'](function(_0x379ed4){logger[_0xe5aa('0x18')]('['+_0x15be0a[_0xe5aa('0x19')]()+_0xe5aa('0x6a'),_0x379ed4[_0xe5aa('0x1a')]);});}; \ No newline at end of file +var _0x1d20=['password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','then','value','isNil','validateEmail','email','info',']\x20Agent\x20found\x20','systemuserid','userEmail','length','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','headers','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20created!','includes','string','type','nameField','customField','idField','substring','indexOf','ticketType','incidents','getString','Subjects','/contacts(','Fields','phonecall','callDirection','queue','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','clientId','username'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x1d20,0x176));var _0x01d2=function(_0x8bab96,_0x3e9c96){_0x8bab96=_0x8bab96-0x0;var _0x39e14d=_0x1d20[_0x8bab96];return _0x39e14d;};'use strict';var _=require(_0x01d2('0x0'));var rp=require(_0x01d2('0x1'));var util=require(_0x01d2('0x2'));var intUtil=require('./util');var md5=require(_0x01d2('0x3'));var Redis=require(_0x01d2('0x4'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x01d2('0x5'));config['redis']=_['defaults'](config[_0x01d2('0x6')],{'host':_0x01d2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x43d0af,_0x36d669,_0x282a4d){if(_0x43d0af[_0x01d2('0x8')]){_0x43d0af[_0x01d2('0x9')]=_0x43d0af[_0x01d2('0xa')][_0x01d2('0xb')];_0x43d0af[_0x01d2('0xc')]=_0x43d0af[_0x01d2('0xa')][_0x01d2('0xd')];return Promise[_0x01d2('0xe')](_0x43d0af['CloudProvider'][_0x01d2('0xf')]);}var _0x5dbe11={'method':'POST','uri':_0x36d669,'form':{'client_id':_0x43d0af[_0x01d2('0x10')],'resource':_0x43d0af[_0x01d2('0x9')],'username':_0x43d0af[_0x01d2('0x11')],'password':_0x43d0af[_0x01d2('0x12')],'grant_type':_0x01d2('0x12'),'client_secret':_0x43d0af[_0x01d2('0x13')]},'json':!![]};return rp(_0x5dbe11)['then'](function(_0x4f94db){return _0x4f94db['access_token'];})[_0x01d2('0x14')](function(_0x1be123){logger[_0x01d2('0x15')]('['+[_0x282a4d[_0x01d2('0x16')]()]+_0x01d2('0x17'));return _0x1be123[_0x01d2('0x18')];});}function getUser(_0x7c012e,_0x39ec19,_0x55bef6,_0x1eda97,_0x18f573,_0x102078){return new Promise(function(_0x4519ab,_0x359cb1){return getAuthToken(_0x39ec19,_0x1eda97,_0x102078)['then'](function(_0x212dab){var _0x462ec5={'method':_0x01d2('0x19'),'uri':_0x18f573+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x01d2('0x1a')+_0x212dab,'OData-Version':_0x01d2('0x1b')},'json':!![]};return rp(_0x462ec5);})[_0x01d2('0x1c')](function(_0x5a746a){var _0x2755db=_0x5a746a[_0x01d2('0x1d')];var _0x4f5c88=![];var _0x435007=null;if(!_[_0x01d2('0x1e')](_0x55bef6)){if(intUtil[_0x01d2('0x1f')](_0x55bef6[_0x01d2('0x20')])){_0x7c012e['userEmail']=_0x55bef6[_0x01d2('0x20')];for(_0x435007=0x0;_0x435007<_0x2755db['length'];_0x435007++){if(_0x2755db[_0x435007]['internalemailaddress']===_0x55bef6['email']&&!_0x2755db[_0x435007]['isdisabled']){_0x4f5c88=!![];logger[_0x01d2('0x21')]('['+[_0x102078['toUpperCase']()]+_0x01d2('0x22')+_0x2755db[_0x435007]['systemuserid']+'!');_0x7c012e['userId']=_0x2755db[_0x435007][_0x01d2('0x23')];}}}}if(!_0x4f5c88){logger[_0x01d2('0x21')]('['+[_0x102078[_0x01d2('0x16')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x7c012e[_0x01d2('0x24')]=_0x39ec19[_0x01d2('0x11')];for(_0x435007=0x0;_0x435007<_0x2755db[_0x01d2('0x25')];_0x435007++){if(_0x2755db[_0x435007]['internalemailaddress']===_0x39ec19['username']){_0x7c012e[_0x01d2('0x26')]=_0x2755db[_0x435007][_0x01d2('0x23')];}}}_0x4519ab(_0x7c012e);})[_0x01d2('0x14')](function(_0x142b24){_0x359cb1(_0x142b24[_0x01d2('0x18')]);});});}function createEndUser(_0x20b4c8,_0x176f04,_0x1bfce3,_0x785675,_0x1a5634,_0xceb4a8){return new Promise(function(_0x3c9aa3,_0x3c93e9){return getAuthToken(_0x176f04,_0x1bfce3,_0xceb4a8)[_0x01d2('0x1c')](function(_0x286679){var _0x2cc186=_0xceb4a8[_0x01d2('0x27')]()===_0x01d2('0x28')?_0x1a5634[_0x01d2('0x29')]:_0x1a5634[_0x01d2('0x2a')];var _0x321463={'method':_0x01d2('0x2b'),'uri':_0x785675+'contacts','body':{'telephone1':_0x2cc186,'fullname':_0x2cc186,'firstname':_0x2cc186,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x01d2('0x2c')+_0x20b4c8['userId']+')'},'headers':{'Authorization':_0x01d2('0x1a')+_0x286679,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x321463);})[_0x01d2('0x1c')](function(_0x62436d){var _0xcabb08=_0x62436d[_0x01d2('0x2d')]['odata-entityid'];var _0xcce8cf=_0xcabb08['substring'](_0xcabb08[_0x01d2('0x2e')]('(')+0x1,_0xcabb08[_0x01d2('0x2e')](')'));_0x20b4c8[_0x01d2('0x2f')]=_0xcce8cf;_0x3c9aa3(_0x20b4c8);})[_0x01d2('0x14')](function(_0xf10ae2){_0x3c93e9(_0xf10ae2[_0x01d2('0x18')]);});});}function getEndUser(_0x2bfbc1,_0x21ca73,_0x2c75d,_0x4d40c1,_0x3a968e,_0x4030d9,_0x5e6fce){var _0x3442a2=_0x4030d9[_0x01d2('0x27')]()===_0x01d2('0x28')?_0x3a968e[_0x01d2('0x29')]:_0x3a968e[_0x01d2('0x2a')];return getAuthToken(_0x21ca73,_0x2c75d,_0x4030d9)[_0x01d2('0x1c')](function(_0x4035d8){var _0x367974={'method':_0x01d2('0x19'),'uri':_0x4d40c1+_0x01d2('0x30')+_0x3442a2['replace']('+',_0x01d2('0x31'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4035d8,'If-None-Match':null,'OData-Version':_0x01d2('0x1b')},'json':!![]};return rp(_0x367974);})['then'](function(_0x59462e){var _0x4c6f47=![];if(!_0x59462e)return _0x4c6f47;var _0x91f811=_0x59462e[_0x01d2('0x1d')];for(var _0x5945c6=0x0;_0x5945c6<_0x91f811['length'];_0x5945c6++){if(_0x91f811[_0x5945c6]['telephone1']===_0x3442a2){_0x4c6f47=!![];_0x2bfbc1[_0x01d2('0x2f')]=_0x91f811[_0x5945c6][_0x01d2('0x32')];}}return _0x4c6f47;})[_0x01d2('0x1c')](function(_0x5614a4){if(_0x5614a4)return _0x2bfbc1;if(_0x5e6fce==='nothing'){logger['info']('['+[_0x4030d9['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x2bfbc1;}return createEndUser(_0x2bfbc1,_0x21ca73,_0x2c75d,_0x4d40c1,_0x3a968e,_0x4030d9)['then'](function(_0x4cc898){logger[_0x01d2('0x21')]('['+[_0x4030d9[_0x01d2('0x16')]()]+_0x01d2('0x33'),_0x4cc898[_0x01d2('0x2f')]);return _0x4cc898;});});}function getCustomFields(_0x25eff9,_0x1ccaa4,_0x2ebbcb){var _0x115e7d={};if(_0x25eff9['length']>0x0){_['forEach'](_0x25eff9,function(_0x1bbaa4){if(_[_0x01d2('0x34')]([_0x01d2('0x35'),'picklist'],_0x1bbaa4[_0x01d2('0x36')])&&_0x1bbaa4[_0x01d2('0x37')]&&!_0x1bbaa4[_0x01d2('0x38')]){var _0x5b599f=_0x1bbaa4[_0x01d2('0x39')][_0x01d2('0x27')]();var _0x5ddb01=_0x5b599f[_0x01d2('0x3a')](0x0,_0x5b599f[_0x01d2('0x3b')]('_'));var _0x161983=_0x5b599f[_0x01d2('0x3a')](_0x5b599f['indexOf']('_')+0x1);if(_0x5ddb01===_0x2ebbcb){_0x115e7d[_0x161983]=_0x1bbaa4['content'];}}});}return _0x115e7d;}function getTicket(_0x572816,_0xd8a007,_0x633dfe,_0x48be23,_0x594ba1,_0x585305,_0x7cdf88){return new Promise(function(_0x47a2b6,_0x299116){var _0x5d0a40;return getAuthToken(_0xd8a007,_0x633dfe,_0x7cdf88)[_0x01d2('0x1c')](function(_0x30898a){if(_0x585305[_0x01d2('0x3c')]==='incident'){_0x5d0a40={'method':'POST','uri':_0x48be23+_0x01d2('0x3d'),'body':Object['assign']({},{'title':intUtil[_0x01d2('0x3e')](_0x585305[_0x01d2('0x3f')],_0x594ba1,'\x20'),'description':intUtil[_0x01d2('0x3e')](_0x585305['Descriptions'],_0x594ba1,'\x0a'),'customerid_contact@odata.bind':_0x572816[_0x01d2('0x2f')]?_0x01d2('0x40')+_0x572816[_0x01d2('0x2f')]+')':undefined,'ownerid@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x585305[_0x01d2('0x41')],_0x594ba1,_0x585305['ticketType'])),'headers':{'Authorization':_0x01d2('0x1a')+_0x30898a,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x585305[_0x01d2('0x3c')]===_0x01d2('0x42')){var _0x4a8a66=_0x572816[_0x01d2('0x2f')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x572816[_0x01d2('0x26')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]===_0x01d2('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x01d2('0x40')+_0x572816[_0x01d2('0x2f')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]===_0x01d2('0x44')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','participationtypemask':_0x572816[_0x01d2('0x43')]==='queue'?0x2:0x1}];_0x5d0a40={'method':_0x01d2('0x2b'),'uri':_0x48be23+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x01d2('0x3e')](_0x585305['Subjects'],_0x594ba1,'\x20'),'phonenumber':String(_0x594ba1[_0x01d2('0x2a')]),'description':intUtil[_0x01d2('0x3e')](_0x585305[_0x01d2('0x45')],_0x594ba1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x572816[_0x01d2('0x2f')]?'/contacts('+_0x572816[_0x01d2('0x2f')]+')':undefined,'ownerid@odata.bind':_0x01d2('0x2c')+_0x572816[_0x01d2('0x26')]+')','directioncode':_0x572816['callDirection']===_0x01d2('0x44')?![]:!![],'phonecall_activity_parties':_0x4a8a66},getCustomFields(_0x585305[_0x01d2('0x41')],_0x594ba1,_0x585305[_0x01d2('0x3c')])),'headers':{'Authorization':_0x01d2('0x1a')+_0x30898a,'OData-Version':_0x01d2('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5d0a40);})['then'](function(_0x16891b){var _0x376840=_0x16891b[_0x01d2('0x2d')][_0x01d2('0x46')];var _0x23aca8=_0x376840[_0x01d2('0x3a')](_0x376840['lastIndexOf']('(')+0x1,_0x376840['lastIndexOf'](')'));_0x572816[_0x01d2('0x47')]=_0x23aca8;_0x47a2b6(_0x572816);})[_0x01d2('0x14')](function(_0x58bbe2){_0x299116(_0x58bbe2['message']);});});}function emit(_0x37c668,_0x31e81a,_0x30ed90,_0xa36f8f){var _0x5a7e5a={'uri':util[_0x01d2('0x48')](_0x01d2('0x49'),_0x37c668,_0x30ed90,_0xa36f8f)};io['to'](util[_0x01d2('0x48')]('user:%s',_0x31e81a))[_0x01d2('0x4a')](_0x01d2('0x4b'),_0x5a7e5a);}exports['cs']=function(_0x413e32,_0x118b75,_0x1207d0,_0x5edaea,_0x5d103b,_0x541cb2,_0x1fdb35,_0x2a8ea7){var _0x29f06f={};_0x541cb2[_0x01d2('0x9')]=_0x541cb2['modernAuthentication']?intUtil[_0x01d2('0x4c')](_0x541cb2['CloudProvider'][_0x01d2('0xb')]):intUtil[_0x01d2('0x4c')](_0x541cb2[_0x01d2('0x9')]);_0x541cb2[_0x01d2('0x4d')]=intUtil[_0x01d2('0x4c')](_0x541cb2['serverUrl']);_0x29f06f[_0x01d2('0x43')]=_0x2a8ea7===_0x01d2('0x44')||_0x2a8ea7==='unmanaged'?_0x01d2('0x44'):_0x01d2('0x28');var _0x28a1f4=_0x541cb2['modernAuthentication']?util[_0x01d2('0x48')](_0x01d2('0x4e'),_0x541cb2['CloudProvider'][_0x01d2('0xb')]):util['format'](_0x01d2('0x4e'),_0x541cb2['remoteUri']);var _0xbd9491=util['format'](_0x01d2('0x4f'),_0x541cb2['tenantId']);var _0x1544ce=util[_0x01d2('0x48')](_0x01d2('0x50'),_0x541cb2['serverUrl'],_0x118b75[_0x01d2('0x51')],md5(_0x118b75['uniqueid']));if(_0x5d103b&&_0x5d103b[_0x01d2('0x52')]){logger[_0x01d2('0x21')](_0x01d2('0x53'),'Recording\x20is\x20enabled!');_0x118b75[_0x01d2('0x54')]=_0x1544ce;}else if(_0x1fdb35&&_0x1fdb35['recordingFormat']&&_0x1fdb35[_0x01d2('0x55')]!==_0x01d2('0x56')){logger[_0x01d2('0x21')](_0x01d2('0x57'),'Recording\x20is\x20enabled!');_0x118b75[_0x01d2('0x54')]=_0x1544ce;}else{_0x118b75[_0x01d2('0x54')]='';}return getUser(_0x29f06f,_0x541cb2,_0x5edaea,_0xbd9491,_0x28a1f4,_0x2a8ea7)[_0x01d2('0x1c')](function(_0x2dbdc4){logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x58'),_0x2dbdc4['userId']);logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x59'),_0x2dbdc4[_0x01d2('0x24')]);return getEndUser(_0x2dbdc4,_0x541cb2,_0xbd9491,_0x28a1f4,_0x118b75,_0x2a8ea7,_0x1207d0[_0x01d2('0x5a')]);})[_0x01d2('0x1c')](function(_0x436ef7){logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5b'),_0x436ef7[_0x01d2('0x2f')]);logger[_0x01d2('0x21')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5c'),_0x118b75[_0x01d2('0x2a')]);return getTicket(_0x436ef7,_0x541cb2,_0xbd9491,_0x28a1f4,_0x118b75,_0x1207d0,_0x2a8ea7);})[_0x01d2('0x1c')](function(_0x2e4098){logger['info'](util[_0x01d2('0x48')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5d'),_0x1207d0['ticketType'],_0x2e4098[_0x01d2('0x47')]));logger[_0x01d2('0x21')](util[_0x01d2('0x48')]('['+_0x2a8ea7[_0x01d2('0x16')]()+_0x01d2('0x5e'),_0x2a8ea7));if(_0x2a8ea7!==_0x01d2('0x5f')){logger['info']('['+_0x2a8ea7['toUpperCase']()+']',_0x01d2('0x60'));emit(_0x541cb2[_0x01d2('0x9')],_0x5edaea['name'],_0x1207d0['ticketType'],_0x2e4098[_0x01d2('0x47')]);}})[_0x01d2('0x14')](function(_0x5c982e){logger[_0x01d2('0x15')]('['+_0x2a8ea7['toUpperCase']()+_0x01d2('0x61'),_0x5c982e[_0x01d2('0x18')]);});}; \ 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 a92bc4c..844f34c 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 _0x86be=['uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','error','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','freshdesk','defaults','redis','localhost','socket.io-emitter','application/json','info','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','keyBy','custom_fields','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach','picklist','type','nameField','content','includes','string','idField','customField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0x86be,0xd0));var _0xe86b=function(_0x3481dc,_0x23c24b){_0x3481dc=_0x3481dc-0x0;var _0x1f2efa=_0x86be[_0x3481dc];return _0x1f2efa;};'use strict';var _=require(_0xe86b('0x0'));var rp=require('request-promise');var md5=require(_0xe86b('0x1'));var util=require(_0xe86b('0x2'));var Redis=require(_0xe86b('0x3'));var intUtil=require('./util');var config=require(_0xe86b('0x4'));var logger=require('../../../../config/logger')(_0xe86b('0x5'));config['redis']=_[_0xe86b('0x6')](config[_0xe86b('0x7')],{'host':_0xe86b('0x8'),'port':0x18eb});var io=require(_0xe86b('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xe86b('0xa'),'Accept':'application/json'};function emit(_0x438009,_0xf9a47a,_0x18402e){io['to'](_0x438009)['emit'](_0xf9a47a,_0x18402e);}function getTicket(_0x5a5220,_0x4cd460,_0x452d87,_0x64b498,_0x42ae9d){logger[_0xe86b('0xb')]('Creating\x20new\x20ticket...');var _0x38ae03=_[_0xe86b('0xc')]({'responder_id':_0x4cd460['id'],'requester_id':_0x452d87['id'],'name':util[_0xe86b('0xd')](_0xe86b('0xe'),_0x42ae9d['calleridname']),'phone':_0x42ae9d[_0xe86b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe86b('0x10')](_0x64b498[_0xe86b('0x11')],_0x42ae9d,'\x20'),'description':intUtil[_0xe86b('0x10')](_0x64b498[_0xe86b('0x12')],_0x42ae9d,_0xe86b('0x13')),'tags':getTags(_0x64b498[_0xe86b('0x14')],_0xe86b('0x15'))},getCustomFields(_0x64b498['Fields'],_0x42ae9d));_0x38ae03['custom_fields']=_['mapValues'](_[_0xe86b('0x16')](_0x38ae03[_0xe86b('0x17')],'id'),'value');return request({'uri':util[_0xe86b('0xd')](_0xe86b('0x18'),_0x5a5220[_0xe86b('0x19')]),'method':_0xe86b('0x1a'),'body':_0x38ae03})[_0xe86b('0x1b')](function(_0xd845eb){logger[_0xe86b('0xb')](_0xe86b('0x1c'));return _0xd845eb;});}function getUser(_0x85eced,_0xae7916){if(intUtil[_0xe86b('0x1d')](_0xae7916)){return request({'uri':util['format'](_0xe86b('0x1e'),_0x85eced[_0xe86b('0x19')]),'qs':{'email':_0xae7916}})[_0xe86b('0x1b')](function(_0x493d5a){if(_0x493d5a[_0xe86b('0x1f')]){logger[_0xe86b('0xb')](_0xe86b('0x20'));return _['find'](_0x493d5a,function(_0x324625){return _0x324625[_0xe86b('0x21')][_0xe86b('0x22')]===_0xae7916;});}else{logger[_0xe86b('0xb')](_0xe86b('0x23'));return request({'uri':util['format'](_0xe86b('0x24'),_0x85eced[_0xe86b('0x19')])})[_0xe86b('0x1b')](function(_0x4de336){logger[_0xe86b('0xb')](_0xe86b('0x25'));return _0x4de336;});}});}else{logger[_0xe86b('0xb')](_0xe86b('0x26'));return request({'uri':util[_0xe86b('0xd')](_0xe86b('0x24'),_0x85eced[_0xe86b('0x19')])})[_0xe86b('0x1b')](function(_0x2fa583){logger[_0xe86b('0xb')](_0xe86b('0x25'));return _0x2fa583;});}}function getEndUser(_0x482f21,_0x429b8a,_0x57a54f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x57a54f);return request({'uri':util[_0xe86b('0xd')]('%s/api/v2/contacts',_0x482f21[_0xe86b('0x19')]),'qs':{'phone':_0x57a54f}})[_0xe86b('0x1b')](function(_0x388f38){if(_0x388f38[_0xe86b('0x1f')]){logger[_0xe86b('0xb')](_0xe86b('0x27'));return _['find'](_0x388f38,{'phone':_0x57a54f});}else{logger[_0xe86b('0xb')](_0xe86b('0x28'));return request({'uri':util[_0xe86b('0xd')](_0xe86b('0x29'),_0x482f21[_0xe86b('0x19')]),'method':_0xe86b('0x1a'),'body':{'name':_0x429b8a,'phone':_0x57a54f}})['then'](function(_0x1c537b){logger[_0xe86b('0xb')]('Enduser\x20created.');return _0x1c537b;});}});}function getAuth(_0xfadda5){return util[_0xe86b('0xd')](_0xe86b('0x2a'),new Buffer(_0xfadda5['apiKey']+':X')[_0xe86b('0x2b')](_0xe86b('0x2c')));}function request(_0x3a1862){logger[_0xe86b('0x2d')](_0xe86b('0x2e'),JSON['stringify'](_0x3a1862));return rp(_['defaults'](_0x3a1862,{'method':_0xe86b('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x9a51d5,_0x226547){var _0x4b7fb5=[];if(_0x9a51d5&&_0x9a51d5[_0xe86b('0x1f')]>0x0){_0x4b7fb5=_[_0xe86b('0x30')](_0x9a51d5,_0x226547);}return _0x4b7fb5;}function getCustomFields(_0x5a55fa,_0x123015){var _0x26d0c2=[];var _0x33b7e7={'custom_fields':[]};if(_0x5a55fa[_0xe86b('0x1f')]>0x0){_[_0xe86b('0x31')](_0x5a55fa,function(_0x326503){if(_['includes'](['string',_0xe86b('0x32')],_0x326503[_0xe86b('0x33')])&&_0x326503[_0xe86b('0x34')]&&!_0x326503['customField']){_0x33b7e7[_0x326503['nameField']['toLowerCase']()]=_0x326503[_0xe86b('0x35')]['toString']();}else if(_[_0xe86b('0x36')]([_0xe86b('0x37'),_0xe86b('0x32')],_0x326503[_0xe86b('0x33')])&&_0x326503[_0xe86b('0x38')]&&_0x326503[_0xe86b('0x39')]){_0x33b7e7[_0xe86b('0x17')]['push']({'id':_0x326503['idField'],'value':_0x326503[_0xe86b('0x35')][_0xe86b('0x2b')]()});}else if(_0x326503[_0xe86b('0x33')]===_0xe86b('0x3a')&&_0x326503['variableName']&&_0x326503[_0xe86b('0x38')]&&_0x326503[_0xe86b('0x39')]){_0x123015[_0x326503[_0xe86b('0x3b')]]&&_0x33b7e7[_0xe86b('0x17')][_0xe86b('0x3c')]({'id':_0x326503[_0xe86b('0x38')],'value':_0x123015[_0x326503[_0xe86b('0x3b')]][_0xe86b('0x2b')]()});}else if(_0x326503[_0xe86b('0x33')]===_0xe86b('0x3d')&&_0x326503[_0xe86b('0x3e')]&&_0x326503[_0xe86b('0x3e')][_0xe86b('0x15')]&&_0x326503[_0xe86b('0x38')]&&_0x326503[_0xe86b('0x39')]){_0x123015[_0x326503['Variable'][_0xe86b('0x15')][_0xe86b('0x3f')]()]&&_0x33b7e7[_0xe86b('0x17')][_0xe86b('0x3c')]({'id':_0x326503['idField'],'value':_0x123015[_0x326503[_0xe86b('0x3e')][_0xe86b('0x15')][_0xe86b('0x3f')]()][_0xe86b('0x2b')]()});}});}return _0x33b7e7;}exports[_0xe86b('0x40')]=function(_0xc9e0c6,_0x2b3081,_0x18c220,_0x20619a,_0x2d3426,_0x35108c){var _0x29cd88,_0x3f64d1;_0x35108c['remoteUri']=intUtil[_0xe86b('0x41')](_0x35108c[_0xe86b('0x19')]);_0x35108c['serverUrl']=intUtil[_0xe86b('0x41')](_0x35108c[_0xe86b('0x42')]);if(_0x2d3426&&_0x2d3426[_0xe86b('0x43')]){logger[_0xe86b('0xb')]('[QUEUE]',_0xe86b('0x44'));_0x2b3081[_0xe86b('0x45')]=util[_0xe86b('0xd')](_0xe86b('0x46'),_0x35108c[_0xe86b('0x42')],_0x2b3081[_0xe86b('0x47')],md5(_0x2b3081[_0xe86b('0x47')]));}else{_0x2b3081['recordingURL']='';}headers['Authorization']=getAuth(_0x35108c);return getUser(_0x35108c,_0x20619a['email'])[_0xe86b('0x1b')](function(_0x416298){_0x29cd88=_0x416298;logger[_0xe86b('0xb')](_0xe86b('0x48'),_0x29cd88['id']);return getEndUser(_0x35108c,_0x2b3081[_0xe86b('0x49')],_0x2b3081[_0xe86b('0xf')]);})[_0xe86b('0x1b')](function(_0x2903f6){_0x3f64d1=_0x2903f6;logger['info'](_0xe86b('0x4a'),_0x3f64d1['id']);return getTicket(_0x35108c,_0x29cd88,_0x3f64d1,_0x18c220,_0x2b3081);})['then'](function(_0x5af8af){if(_0x5af8af&&_0x5af8af['id']){logger[_0xe86b('0xb')](_0xe86b('0x1c'));logger[_0xe86b('0xb')](_0xe86b('0x4b'),_0x5af8af['id']);logger['info']('[QUEUE]',_0xe86b('0x4c'));emit(util[_0xe86b('0xd')](_0xe86b('0x4d'),_0x20619a[_0xe86b('0x15')]),_0xe86b('0x4e'),{'uri':util[_0xe86b('0xd')]('%s/helpdesk/tickets/%d',_0x35108c[_0xe86b('0x19')],_0x5af8af['id'])});}})[_0xe86b('0x4f')](function(_0x33f6a1){logger['error'](_0xe86b('0x50'),JSON[_0xe86b('0x51')](_0x33f6a1));});};exports[_0xe86b('0x52')]=function(_0x458fbf,_0x5adf4d,_0x5b2248,_0x49988b,_0x26883c,_0x53ce98,_0x238071){var _0x15f32b,_0x44eb03;_0x53ce98['remoteUri']=intUtil['stripTrailingSlash'](_0x53ce98[_0xe86b('0x19')]);_0x53ce98[_0xe86b('0x42')]=intUtil[_0xe86b('0x41')](_0x53ce98[_0xe86b('0x42')]);if(_0x238071&&_0x238071['recordingFormat']&&_0x238071[_0xe86b('0x53')]!==_0xe86b('0x54')){logger[_0xe86b('0xb')](_0xe86b('0x55'),_0xe86b('0x44'));_0x5adf4d['recordingURL']=util['format'](_0xe86b('0x46'),_0x53ce98[_0xe86b('0x42')],_0x5adf4d['uniqueid'],md5(_0x5adf4d[_0xe86b('0x47')]));}headers[_0xe86b('0x56')]=getAuth(_0x53ce98);return getUser(_0x53ce98,_0x49988b['email'])[_0xe86b('0x1b')](function(_0x4444fb){_0x15f32b=_0x4444fb;logger['info']('The\x20User\x20ID\x20is:',_0x15f32b['id']);return getEndUser(_0x53ce98,_0x5adf4d[_0xe86b('0x57')],_0x5adf4d[_0xe86b('0x58')]);})[_0xe86b('0x1b')](function(_0x2d2b34){_0x44eb03=_0x2d2b34;logger[_0xe86b('0xb')](_0xe86b('0x4a'),_0x44eb03['id']);return getTicket(_0x53ce98,_0x15f32b,_0x44eb03,_0x5b2248,_0x5adf4d);})[_0xe86b('0x1b')](function(_0x57443a){if(_0x57443a&&_0x57443a['id']){logger['info'](_0xe86b('0x1c'));logger[_0xe86b('0xb')]('The\x20Ticket\x20ID\x20is:',_0x57443a['id']);logger[_0xe86b('0xb')](_0xe86b('0x55'),_0xe86b('0x4c'));emit(util['format'](_0xe86b('0x4d'),_0x49988b['name']),_0xe86b('0x4e'),{'uri':util['format'](_0xe86b('0x59'),_0x53ce98[_0xe86b('0x19')],_0x57443a['id'])});}})[_0xe86b('0x4f')](function(_0x33b456){logger[_0xe86b('0x5a')](_0xe86b('0x55'),JSON['stringify'](_0x33b456));});};exports['unmanaged']=function(_0x2143ce,_0x1f8d73,_0x51dbe8,_0x125e9b,_0x5a4965,_0x1585c5){var _0x93dddd,_0x28ed64;_0x1585c5[_0xe86b('0x19')]=intUtil[_0xe86b('0x41')](_0x1585c5['remoteUri']);_0x1585c5[_0xe86b('0x42')]=intUtil[_0xe86b('0x41')](_0x1585c5[_0xe86b('0x42')]);if(_0x5a4965&&_0x5a4965[_0xe86b('0x43')]){logger['info']('['+_0x1f8d73[_0xe86b('0x5b')][_0xe86b('0x5c')]()+']',_0xe86b('0x44'));_0x1f8d73[_0xe86b('0x45')]=util[_0xe86b('0xd')](_0xe86b('0x46'),_0x1585c5[_0xe86b('0x42')],_0x1f8d73[_0xe86b('0x47')],md5(_0x1f8d73[_0xe86b('0x47')]));}else{_0x1f8d73[_0xe86b('0x45')]='';}headers['Authorization']=getAuth(_0x1585c5);return getUser(_0x1585c5,'')[_0xe86b('0x1b')](function(_0x5db820){_0x93dddd=_0x5db820;logger[_0xe86b('0xb')](_0xe86b('0x48'),_0x93dddd['id']);return getEndUser(_0x1585c5,_0x1f8d73['calleridname'],_0x1f8d73[_0xe86b('0xf')]);})[_0xe86b('0x1b')](function(_0x398c30){_0x28ed64=_0x398c30;logger[_0xe86b('0xb')](_0xe86b('0x4a'),_0x28ed64['id']);return getTicket(_0x1585c5,_0x93dddd,_0x28ed64,_0x51dbe8,_0x1f8d73);})['then'](function(_0x701fc0){if(_0x701fc0){logger[_0xe86b('0xb')]('Ticket\x20created!');logger[_0xe86b('0xb')](_0xe86b('0x4b'),_0x701fc0['id']);}})[_0xe86b('0x4f')](function(_0xc2f85f){logger[_0xe86b('0x5a')]('['+_0x1f8d73['lastevent'][_0xe86b('0x5c')]()+']',JSON[_0xe86b('0x51')](_0xc2f85f));});}; \ No newline at end of file +var _0x8cf6=['Tags','name','Fields','custom_fields','keyBy','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','info','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','apiKey','debug','[HTTP]','stringify','GET','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','push','variable','variableName','customField','idField','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x8f3a26,_0xf35df0){var _0x37a687=function(_0x3a04dc){while(--_0x3a04dc){_0x8f3a26['push'](_0x8f3a26['shift']());}};_0x37a687(++_0xf35df0);}(_0x8cf6,0x1c4));var _0x68cf=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x8cf6[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x68cf('0x0'));var rp=require('request-promise');var md5=require(_0x68cf('0x1'));var util=require(_0x68cf('0x2'));var Redis=require(_0x68cf('0x3'));var intUtil=require(_0x68cf('0x4'));var config=require(_0x68cf('0x5'));var logger=require(_0x68cf('0x6'))(_0x68cf('0x7'));config[_0x68cf('0x8')]=_[_0x68cf('0x9')](config[_0x68cf('0x8')],{'host':_0x68cf('0xa'),'port':0x18eb});var io=require(_0x68cf('0xb'))(new Redis(config[_0x68cf('0x8')]));var headers={'Content-Type':_0x68cf('0xc'),'Accept':'application/json'};function emit(_0x48500d,_0x54132a,_0xf3c763){io['to'](_0x48500d)[_0x68cf('0xd')](_0x54132a,_0xf3c763);}function getTicket(_0x4c2b84,_0x545767,_0x2c7be3,_0x5655f2,_0x23514f){logger['info'](_0x68cf('0xe'));var _0x50f3e7=_[_0x68cf('0xf')]({'responder_id':_0x545767['id'],'requester_id':_0x2c7be3['id'],'name':util[_0x68cf('0x10')]('Caller\x20-\x20%s',_0x23514f[_0x68cf('0x11')]),'phone':_0x23514f[_0x68cf('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x68cf('0x13')](_0x5655f2[_0x68cf('0x14')],_0x23514f,'\x20'),'description':intUtil[_0x68cf('0x13')](_0x5655f2[_0x68cf('0x15')],_0x23514f,_0x68cf('0x16')),'tags':getTags(_0x5655f2[_0x68cf('0x17')],_0x68cf('0x18'))},getCustomFields(_0x5655f2[_0x68cf('0x19')],_0x23514f));_0x50f3e7[_0x68cf('0x1a')]=_['mapValues'](_[_0x68cf('0x1b')](_0x50f3e7[_0x68cf('0x1a')],'id'),_0x68cf('0x1c'));return request({'uri':util[_0x68cf('0x10')]('%s/api/v2/tickets',_0x4c2b84[_0x68cf('0x1d')]),'method':_0x68cf('0x1e'),'body':_0x50f3e7})[_0x68cf('0x1f')](function(_0x5958e9){logger['info'](_0x68cf('0x20'));return _0x5958e9;});}function getUser(_0x2ddb33,_0x53a54b){if(intUtil[_0x68cf('0x21')](_0x53a54b)){return request({'uri':util[_0x68cf('0x10')](_0x68cf('0x22'),_0x2ddb33['remoteUri']),'qs':{'email':_0x53a54b}})['then'](function(_0x265b85){if(_0x265b85[_0x68cf('0x23')]){logger[_0x68cf('0x24')]('Agent\x20found!');return _[_0x68cf('0x25')](_0x265b85,function(_0xf9b7ce){return _0xf9b7ce[_0x68cf('0x26')][_0x68cf('0x27')]===_0x53a54b;});}else{logger[_0x68cf('0x24')](_0x68cf('0x28'));return request({'uri':util['format'](_0x68cf('0x29'),_0x2ddb33['remoteUri'])})[_0x68cf('0x1f')](function(_0x385cd0){logger[_0x68cf('0x24')](_0x68cf('0x2a'));return _0x385cd0;});}});}else{logger[_0x68cf('0x24')](_0x68cf('0x2b'));return request({'uri':util[_0x68cf('0x10')](_0x68cf('0x29'),_0x2ddb33[_0x68cf('0x1d')])})[_0x68cf('0x1f')](function(_0x304985){logger['info']('Admin\x20account\x20selected.');return _0x304985;});}}function getEndUser(_0x2d7862,_0x24b2f5,_0x4fa6e0){logger[_0x68cf('0x24')](_0x68cf('0x2c'),_0x4fa6e0);return request({'uri':util['format']('%s/api/v2/contacts',_0x2d7862[_0x68cf('0x1d')]),'qs':{'phone':_0x4fa6e0}})['then'](function(_0x348e5d){if(_0x348e5d[_0x68cf('0x23')]){logger['info'](_0x68cf('0x2d'));return _[_0x68cf('0x25')](_0x348e5d,{'phone':_0x4fa6e0});}else{logger[_0x68cf('0x24')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x68cf('0x2e'),_0x2d7862['remoteUri']),'method':_0x68cf('0x1e'),'body':{'name':_0x24b2f5,'phone':_0x4fa6e0}})['then'](function(_0x111efa){logger[_0x68cf('0x24')]('Enduser\x20created.');return _0x111efa;});}});}function getAuth(_0x2c462d){return util[_0x68cf('0x10')]('Basic\x20%s',new Buffer(_0x2c462d[_0x68cf('0x2f')]+':X')['toString']('base64'));}function request(_0x44e25c){logger[_0x68cf('0x30')](_0x68cf('0x31'),JSON[_0x68cf('0x32')](_0x44e25c));return rp(_[_0x68cf('0x9')](_0x44e25c,{'method':_0x68cf('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x44d715,_0x1d2aaf){var _0x120285=[];if(_0x44d715&&_0x44d715['length']>0x0){_0x120285=_['map'](_0x44d715,_0x1d2aaf);}return _0x120285;}function getCustomFields(_0x1f8ce9,_0x16b4a2){var _0x368315=[];var _0x58309f={'custom_fields':[]};if(_0x1f8ce9[_0x68cf('0x23')]>0x0){_[_0x68cf('0x34')](_0x1f8ce9,function(_0x5def7f){if(_[_0x68cf('0x35')]([_0x68cf('0x36'),'picklist'],_0x5def7f[_0x68cf('0x37')])&&_0x5def7f['nameField']&&!_0x5def7f['customField']){_0x58309f[_0x5def7f[_0x68cf('0x38')][_0x68cf('0x39')]()]=_0x5def7f[_0x68cf('0x3a')][_0x68cf('0x3b')]();}else if(_[_0x68cf('0x35')]([_0x68cf('0x36'),_0x68cf('0x3c')],_0x5def7f[_0x68cf('0x37')])&&_0x5def7f['idField']&&_0x5def7f['customField']){_0x58309f[_0x68cf('0x1a')][_0x68cf('0x3d')]({'id':_0x5def7f['idField'],'value':_0x5def7f['content'][_0x68cf('0x3b')]()});}else if(_0x5def7f[_0x68cf('0x37')]===_0x68cf('0x3e')&&_0x5def7f[_0x68cf('0x3f')]&&_0x5def7f['idField']&&_0x5def7f[_0x68cf('0x40')]){_0x16b4a2[_0x5def7f[_0x68cf('0x3f')]]&&_0x58309f['custom_fields'][_0x68cf('0x3d')]({'id':_0x5def7f[_0x68cf('0x41')],'value':_0x16b4a2[_0x5def7f[_0x68cf('0x3f')]][_0x68cf('0x3b')]()});}else if(_0x5def7f[_0x68cf('0x37')]===_0x68cf('0x42')&&_0x5def7f[_0x68cf('0x43')]&&_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')]&&_0x5def7f[_0x68cf('0x41')]&&_0x5def7f['customField']){_0x16b4a2[_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')][_0x68cf('0x39')]()]&&_0x58309f[_0x68cf('0x1a')]['push']({'id':_0x5def7f[_0x68cf('0x41')],'value':_0x16b4a2[_0x5def7f[_0x68cf('0x43')][_0x68cf('0x18')]['toLowerCase']()]['toString']()});}});}return _0x58309f;}exports[_0x68cf('0x44')]=function(_0x4aaacf,_0x645df7,_0x3449c0,_0x1bf09d,_0x5aab54,_0x16f7ba){var _0x104cf2,_0x22dfd8;_0x16f7ba['remoteUri']=intUtil[_0x68cf('0x45')](_0x16f7ba[_0x68cf('0x1d')]);_0x16f7ba[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x16f7ba['serverUrl']);if(_0x5aab54&&_0x5aab54[_0x68cf('0x47')]){logger[_0x68cf('0x24')](_0x68cf('0x48'),'Recording\x20is\x20enabled!');_0x645df7[_0x68cf('0x49')]=util[_0x68cf('0x10')](_0x68cf('0x4a'),_0x16f7ba[_0x68cf('0x46')],_0x645df7[_0x68cf('0x4b')],md5(_0x645df7[_0x68cf('0x4b')]));}else{_0x645df7['recordingURL']='';}headers[_0x68cf('0x4c')]=getAuth(_0x16f7ba);return getUser(_0x16f7ba,_0x1bf09d[_0x68cf('0x27')])[_0x68cf('0x1f')](function(_0x51f4a6){_0x104cf2=_0x51f4a6;logger[_0x68cf('0x24')]('The\x20User\x20ID\x20is:',_0x104cf2['id']);return getEndUser(_0x16f7ba,_0x645df7[_0x68cf('0x11')],_0x645df7[_0x68cf('0x12')]);})[_0x68cf('0x1f')](function(_0x158f4e){_0x22dfd8=_0x158f4e;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x22dfd8['id']);return getTicket(_0x16f7ba,_0x104cf2,_0x22dfd8,_0x3449c0,_0x645df7);})[_0x68cf('0x1f')](function(_0x14fe71){if(_0x14fe71&&_0x14fe71['id']){logger[_0x68cf('0x24')](_0x68cf('0x20'));logger['info'](_0x68cf('0x4e'),_0x14fe71['id']);logger[_0x68cf('0x24')](_0x68cf('0x48'),_0x68cf('0x4f'));emit(util[_0x68cf('0x10')]('user:%s',_0x1bf09d[_0x68cf('0x18')]),'trigger:browser:url',{'uri':util[_0x68cf('0x10')](_0x68cf('0x50'),_0x16f7ba[_0x68cf('0x1d')],_0x14fe71['id'])});}})[_0x68cf('0x51')](function(_0x2b3d1d){logger[_0x68cf('0x52')](_0x68cf('0x48'),JSON[_0x68cf('0x32')](_0x2b3d1d));});};exports[_0x68cf('0x53')]=function(_0x235287,_0x17e67e,_0x15279e,_0x420958,_0xb710a9,_0x4bf3f2,_0x5ed96f){var _0x12d08e,_0x247420;_0x4bf3f2[_0x68cf('0x1d')]=intUtil['stripTrailingSlash'](_0x4bf3f2['remoteUri']);_0x4bf3f2[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x4bf3f2[_0x68cf('0x46')]);if(_0x5ed96f&&_0x5ed96f[_0x68cf('0x54')]&&_0x5ed96f[_0x68cf('0x54')]!==_0x68cf('0x55')){logger[_0x68cf('0x24')]('[OUTBOUND]',_0x68cf('0x56'));_0x17e67e[_0x68cf('0x49')]=util['format'](_0x68cf('0x4a'),_0x4bf3f2['serverUrl'],_0x17e67e[_0x68cf('0x4b')],md5(_0x17e67e[_0x68cf('0x4b')]));}headers[_0x68cf('0x4c')]=getAuth(_0x4bf3f2);return getUser(_0x4bf3f2,_0x420958[_0x68cf('0x27')])[_0x68cf('0x1f')](function(_0x5367e4){_0x12d08e=_0x5367e4;logger[_0x68cf('0x24')](_0x68cf('0x57'),_0x12d08e['id']);return getEndUser(_0x4bf3f2,_0x17e67e['destcalleridname'],_0x17e67e[_0x68cf('0x58')]);})[_0x68cf('0x1f')](function(_0x297ddb){_0x247420=_0x297ddb;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x247420['id']);return getTicket(_0x4bf3f2,_0x12d08e,_0x247420,_0x15279e,_0x17e67e);})[_0x68cf('0x1f')](function(_0x63db44){if(_0x63db44&&_0x63db44['id']){logger['info'](_0x68cf('0x20'));logger[_0x68cf('0x24')]('The\x20Ticket\x20ID\x20is:',_0x63db44['id']);logger[_0x68cf('0x24')](_0x68cf('0x59'),_0x68cf('0x4f'));emit(util['format'](_0x68cf('0x5a'),_0x420958['name']),_0x68cf('0x5b'),{'uri':util[_0x68cf('0x10')](_0x68cf('0x50'),_0x4bf3f2[_0x68cf('0x1d')],_0x63db44['id'])});}})[_0x68cf('0x51')](function(_0x20fdff){logger['error'](_0x68cf('0x59'),JSON[_0x68cf('0x32')](_0x20fdff));});};exports[_0x68cf('0x5c')]=function(_0x4c14ca,_0x25bd60,_0x502746,_0x4feea2,_0x1053f7,_0x3fda8e){var _0x4eef5b,_0x452004;_0x3fda8e[_0x68cf('0x1d')]=intUtil['stripTrailingSlash'](_0x3fda8e[_0x68cf('0x1d')]);_0x3fda8e[_0x68cf('0x46')]=intUtil[_0x68cf('0x45')](_0x3fda8e[_0x68cf('0x46')]);if(_0x1053f7&&_0x1053f7[_0x68cf('0x47')]){logger[_0x68cf('0x24')]('['+_0x25bd60[_0x68cf('0x5d')][_0x68cf('0x5e')]()+']',_0x68cf('0x56'));_0x25bd60[_0x68cf('0x49')]=util[_0x68cf('0x10')](_0x68cf('0x4a'),_0x3fda8e[_0x68cf('0x46')],_0x25bd60[_0x68cf('0x4b')],md5(_0x25bd60[_0x68cf('0x4b')]));}else{_0x25bd60[_0x68cf('0x49')]='';}headers['Authorization']=getAuth(_0x3fda8e);return getUser(_0x3fda8e,'')[_0x68cf('0x1f')](function(_0x2a4b41){_0x4eef5b=_0x2a4b41;logger[_0x68cf('0x24')]('The\x20User\x20ID\x20is:',_0x4eef5b['id']);return getEndUser(_0x3fda8e,_0x25bd60['calleridname'],_0x25bd60[_0x68cf('0x12')]);})[_0x68cf('0x1f')](function(_0x595f01){_0x452004=_0x595f01;logger[_0x68cf('0x24')](_0x68cf('0x4d'),_0x452004['id']);return getTicket(_0x3fda8e,_0x4eef5b,_0x452004,_0x502746,_0x25bd60);})[_0x68cf('0x1f')](function(_0x576477){if(_0x576477){logger[_0x68cf('0x24')](_0x68cf('0x20'));logger[_0x68cf('0x24')](_0x68cf('0x4e'),_0x576477['id']);}})['catch'](function(_0x282350){logger[_0x68cf('0x52')]('['+_0x25bd60['lastevent'][_0x68cf('0x5e')]()+']',JSON['stringify'](_0x282350));});}; \ 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 e28a9ea..cae4135 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 _0xb0d1=['bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','Admin\x20selected','error','message','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','lodash','util','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb0d1,0x9b));var _0x1b0d=function(_0x2b12f7,_0x39f636){_0x2b12f7=_0x2b12f7-0x0;var _0x33942b=_0xb0d1[_0x2b12f7];return _0x33942b;};'use strict';var _=require(_0x1b0d('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x1b0d('0x1'));var moment=require(_0x1b0d('0x2'));var Promise=require(_0x1b0d('0x3'));var Redis=require(_0x1b0d('0x4'));var intUtil=require(_0x1b0d('0x5'));var config=require(_0x1b0d('0x6'));var logger=require(_0x1b0d('0x7'))('freshsales');config[_0x1b0d('0x8')]=_[_0x1b0d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1b0d('0xa'))(new Redis(config[_0x1b0d('0x8')]));function getAdminId(_0x39fac8,_0x23fb7b,_0x2863e6,_0x43cc0f){return new Promise(function(_0x3c8b5b,_0x2a6c0f){var _0x4629b3=![];var _0x4b4eb2={'method':_0x1b0d('0xb'),'uri':_0x43cc0f+_0x1b0d('0xc'),'json':!![]};_0x4b4eb2[_0x1b0d('0xd')]=_0x2863e6;logger['info'](_0x1b0d('0xe'));return rp(_0x4b4eb2)[_0x1b0d('0xf')](function(_0x4d18c6){if(_0x4d18c6){var _0x378430=_0x4d18c6[_0x1b0d('0x10')];var _0x15d829=null;for(_0x15d829=0x0;_0x15d829<_0x378430[_0x1b0d('0x11')];_0x15d829++){if(_0x378430[_0x15d829][_0x1b0d('0x12')]===_0x39fac8[_0x1b0d('0x13')]){_0x39fac8['adminId']=_0x378430[_0x15d829]['id'];_0x4629b3=!![];}}if(_0x4629b3){logger[_0x1b0d('0x14')](_0x1b0d('0x15'),_0x39fac8[_0x1b0d('0x16')]);_0x3c8b5b(_0x39fac8);}else{_0x2a6c0f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2a6c0f({'statusCode':0x194,'message':_0x1b0d('0x17')});}})[_0x1b0d('0x18')](function(_0x9330b0){logger['error']('['+[_0x23fb7b[_0x1b0d('0x19')]()]+']',_0x9330b0['message']);_0x2a6c0f(_0x9330b0);});});}function getUser(_0x171bfa,_0x508640,_0x3e521b){return function(_0x35b72e){return new Promise(function(_0x1f8443,_0x3076bf){var _0x58357f={'method':_0x1b0d('0xb'),'uri':_0x3e521b+_0x1b0d('0xc'),'json':!![]};_0x58357f['headers']=_0x508640;logger[_0x1b0d('0x14')]('Getting\x20user\x20list');return rp(_0x58357f)[_0x1b0d('0xf')](function(_0x349c17){if(_0x349c17){var _0x12af86=_0x349c17[_0x1b0d('0x10')];var _0x2f1171=![];var _0x584c5c=null;if(_0x35b72e['agentEmail']!==null){logger[_0x1b0d('0x14')](_0x1b0d('0x1a'),_0x35b72e[_0x1b0d('0x1b')]);_0x35b72e[_0x1b0d('0x1c')]=_0x35b72e['agentEmail'];for(_0x584c5c=0x0;_0x584c5c<_0x12af86[_0x1b0d('0x11')];_0x584c5c++){if(_0x12af86[_0x584c5c][_0x1b0d('0x12')]===_0x35b72e[_0x1b0d('0x1b')]){_0x2f1171=!![];_0x35b72e[_0x1b0d('0x1d')]=_0x12af86[_0x584c5c]['id'];logger[_0x1b0d('0x14')]('User\x20found:',_0x35b72e[_0x1b0d('0x1d')]);}}}if(!_0x2f1171){logger[_0x1b0d('0x14')](_0x1b0d('0x1e'));_0x35b72e[_0x1b0d('0x1c')]=_0x35b72e['adminEmail'];_0x35b72e[_0x1b0d('0x1d')]=_0x35b72e[_0x1b0d('0x16')];_0x2f1171=!![];}if(_0x2f1171){_0x1f8443(_0x35b72e);}else{_0x3076bf({'statusCode':0x194,'message':_0x1b0d('0x17')});}}else{_0x3076bf({'statusCode':0x194,'message':_0x1b0d('0x17')});}})[_0x1b0d('0x18')](function(_0x35d7f6){logger[_0x1b0d('0x1f')]('['+[_0x171bfa[_0x1b0d('0x19')]()]+']',_0x35d7f6[_0x1b0d('0x20')]);_0x3076bf(_0x35d7f6);});});};}function searchContact(_0x22b95b,_0x5bcb12,_0x116311,_0x1e1f0f){return new Promise(function(_0x30cdfd,_0x235659){var _0x390f37={'method':_0x1b0d('0xb'),'headers':_0x5bcb12,'uri':_0x22b95b+'/api/lookup?q='+_0x1e1f0f+_0x1b0d('0x21')+_0x116311+_0x1b0d('0x22'),'json':!![]};rp(_0x390f37)[_0x1b0d('0xf')](function(_0x3cfedb){var _0xac8957=_[_0x1b0d('0x23')](_0x3cfedb[_0x1b0d('0x24')]['contacts'],[_0x116311,_0x1e1f0f]);_0x30cdfd(_0xac8957);})[_0x1b0d('0x18')](function(_0x67f048){_0x235659(_0x67f048);});});}function getEndUser(_0x12cf58,_0x16a079,_0x3e29c7){return function(_0x45f23c){return new Promise(function(_0x573db2,_0x2ca5e5){logger['info'](util[_0x1b0d('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x45f23c[_0x1b0d('0x26')]));searchContact(_0x3e29c7,_0x16a079,_0x1b0d('0x27'),_0x45f23c[_0x1b0d('0x26')])[_0x1b0d('0xf')](function(_0x1b3e67){if(_0x1b3e67){_0x45f23c['endUserId']=_0x1b3e67['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x45f23c[_0x1b0d('0x28')]);return _0x573db2(_0x45f23c);}searchContact(_0x3e29c7,_0x16a079,_0x1b0d('0x29'),_0x45f23c[_0x1b0d('0x26')])[_0x1b0d('0xf')](function(_0xe1a528){if(_0xe1a528){_0x45f23c[_0x1b0d('0x28')]=_0xe1a528['id'];logger[_0x1b0d('0x14')](_0x1b0d('0x2a'),_0x45f23c[_0x1b0d('0x28')]);return _0x573db2(_0x45f23c);}createEndUser(_0x45f23c,_0x12cf58,_0x16a079,_0x3e29c7)['then'](function(_0x2d8f7a){logger['info'](_0x1b0d('0x2b'),_0x2d8f7a[_0x1b0d('0x28')]);return _0x573db2(_0x2d8f7a);});});})[_0x1b0d('0x18')](function(_0x16b11b){_0x2ca5e5(_0x16b11b);});});};}function createEndUser(_0x49e889,_0x2967f1,_0x1530ac,_0x16214b){return new Promise(function(_0x227fec,_0x4ab664){var _0xa1b53a=moment();var _0x461863={'method':_0x1b0d('0x2c'),'uri':_0x16214b+'/api/contacts','body':{'contact':{'last_name':_0x49e889[_0x1b0d('0x26')],'work_number':_0x49e889[_0x1b0d('0x26')],'mobile_number':_0x49e889[_0x1b0d('0x26')],'owner_id':_0x49e889[_0x1b0d('0x1d')],'created_at':_0xa1b53a[_0x1b0d('0x25')](_0x1b0d('0x2d'))}},'json':!![]};_0x461863[_0x1b0d('0xd')]=_0x1530ac;logger[_0x1b0d('0x14')](_0x1b0d('0x2e'));return rp(_0x461863)['then'](function(_0xdbf740){_0x49e889[_0x1b0d('0x28')]=_0xdbf740[_0x1b0d('0x2f')]['id'];_0x227fec(_0x49e889);})[_0x1b0d('0x18')](function(_0x4012aa){logger[_0x1b0d('0x1f')]('['+[_0x2967f1[_0x1b0d('0x19')]()]+']',_0x4012aa['message']);_0x4ab664(_0x4012aa['message']);});});}function getTicket(_0x39753a,_0x1cb35f,_0x30befc,_0x466cd5,_0x412f3d){return function(_0x278786){logger[_0x1b0d('0x14')](_0x1b0d('0x30'));return new Promise(function(_0x27ad53,_0x15db7e){var _0x54ca73=moment();var _0x4573b5={'method':'POST','uri':_0x30befc+'/api/tasks','body':{'title':intUtil['getString'](_0x466cd5[_0x1b0d('0x31')],_0x412f3d,'\x20'),'description':intUtil[_0x1b0d('0x32')](_0x466cd5[_0x1b0d('0x33')],_0x412f3d,'\x0a'),'owner_id':_0x278786[_0x1b0d('0x1d')],'creater_id':_0x278786[_0x1b0d('0x16')],'targetable_id':_0x278786[_0x1b0d('0x28')],'targetable_type':_0x1b0d('0x34'),'created_at':_0x54ca73[_0x1b0d('0x25')](_0x1b0d('0x2d')),'due_date':_0x54ca73['add'](0x1e,'m')[_0x1b0d('0x25')](_0x1b0d('0x2d'))},'json':!![]};_0x4573b5['headers']=_0x1cb35f;return rp(_0x4573b5)['then'](function(_0x47f8c6){_0x278786[_0x1b0d('0x35')]=_0x47f8c6['task']['id'];logger[_0x1b0d('0x14')](_0x1b0d('0x36'),_0x278786[_0x1b0d('0x35')]);_0x27ad53(_0x278786);})[_0x1b0d('0x18')](function(_0x2ab217){logger[_0x1b0d('0x1f')]('['+[_0x39753a[_0x1b0d('0x19')]()]+']',_0x2ab217['message']);_0x15db7e(_0x2ab217['message']);});});};}function emit(_0x48dd87,_0x16cf54,_0x55b665){var _0x571a7c={'uri':_0x48dd87+'/contacts/'+_0x55b665};io['to'](util[_0x1b0d('0x25')]('user:%s',_0x16cf54))[_0x1b0d('0x37')](_0x1b0d('0x38'),_0x571a7c);}exports['cs']=function(_0x5767bb,_0x48cd89,_0x535f03,_0x122091,_0x167f91,_0x428ab0,_0x83145a,_0x1db841){var _0xa9cd0e={};var _0x107a59={'Authorization':_0x1b0d('0x39')+_0x428ab0[_0x1b0d('0x3a')]};_0x428ab0[_0x1b0d('0x3b')]=intUtil['stripTrailingSlash'](_0x428ab0[_0x1b0d('0x3b')]);_0x428ab0['serverUrl']=intUtil['stripTrailingSlash'](_0x428ab0[_0x1b0d('0x3c')]);var _0x56d077=_0x428ab0[_0x1b0d('0x3b')];_0xa9cd0e[_0x1b0d('0x13')]=_0x428ab0[_0x1b0d('0x3d')];_0xa9cd0e[_0x1b0d('0x26')]=_0x1db841[_0x1b0d('0x3e')]()==='outbound'?_0x48cd89[_0x1b0d('0x3f')]:_0x48cd89[_0x1b0d('0x40')];_0xa9cd0e[_0x1b0d('0x41')]=_0x1db841===_0x1b0d('0x42')||_0x1db841===_0x1b0d('0x43')?_0x1b0d('0x42'):'outbound';if(_0x122091){_0xa9cd0e['agentEmail']=_0x122091[_0x1b0d('0x12')];}var _0x2ec4af=util[_0x1b0d('0x25')](_0x1b0d('0x44'),_0x428ab0[_0x1b0d('0x3c')],_0x48cd89[_0x1b0d('0x45')],md5(_0x48cd89[_0x1b0d('0x45')]));if(_0x167f91&&_0x167f91[_0x1b0d('0x46')]){logger[_0x1b0d('0x14')](_0x1b0d('0x47'),_0x1b0d('0x48'));_0x48cd89[_0x1b0d('0x49')]=_0x2ec4af;}else if(_0x83145a&&_0x83145a[_0x1b0d('0x4a')]&&_0x83145a[_0x1b0d('0x4a')]!==_0x1b0d('0x4b')){logger[_0x1b0d('0x14')](_0x1b0d('0x4c'),'Recording\x20is\x20enabled!');_0x48cd89[_0x1b0d('0x49')]=_0x2ec4af;}else{_0x48cd89[_0x1b0d('0x49')]='';}return getAdminId(_0xa9cd0e,_0x1db841,_0x107a59,_0x56d077)[_0x1b0d('0xf')](getUser(_0x1db841,_0x107a59,_0x56d077))[_0x1b0d('0xf')](getEndUser(_0x1db841,_0x107a59,_0x56d077))[_0x1b0d('0xf')](getTicket(_0x1db841,_0x107a59,_0x56d077,_0x535f03,_0x48cd89))[_0x1b0d('0xf')](function(_0x4e6bd3){logger[_0x1b0d('0x14')](util[_0x1b0d('0x25')](_0x1b0d('0x4d'),_0x4e6bd3['ticketId']));if(_0x1db841!=='unmanaged'){logger[_0x1b0d('0x14')]('['+[_0x1db841['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x56d077,_0x122091[_0x1b0d('0x4e')],_0x4e6bd3[_0x1b0d('0x28')]);}})[_0x1b0d('0x18')](function(_0x5cbffd){logger[_0x1b0d('0x1f')]('['+[_0x1db841['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x5cbffd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xff70=['request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','socket.io-emitter','redis','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','/api/lookup?q=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','format','contact','POST','getString','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','error','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash'];(function(_0x38b6f0,_0x26fee4){var _0x19d435=function(_0x9d20b2){while(--_0x9d20b2){_0x38b6f0['push'](_0x38b6f0['shift']());}};_0x19d435(++_0x26fee4);}(_0xff70,0x1df));var _0x0ff7=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0xff70[_0x4cdcdc];return _0x4704ce;};'use strict';var _=require(_0x0ff7('0x0'));var rp=require(_0x0ff7('0x1'));var md5=require(_0x0ff7('0x2'));var util=require('util');var moment=require(_0x0ff7('0x3'));var Promise=require('bluebird');var Redis=require(_0x0ff7('0x4'));var intUtil=require(_0x0ff7('0x5'));var config=require(_0x0ff7('0x6'));var logger=require(_0x0ff7('0x7'))(_0x0ff7('0x8'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0ff7('0x9'))(new Redis(config[_0x0ff7('0xa')]));function getAdminId(_0x5a4f9f,_0x24d7bf,_0x1d20e0,_0x3f4a03){return new Promise(function(_0x21fc14,_0x9ad26e){var _0x5cd236=![];var _0x57ec42={'method':_0x0ff7('0xb'),'uri':_0x3f4a03+_0x0ff7('0xc'),'json':!![]};_0x57ec42['headers']=_0x1d20e0;logger[_0x0ff7('0xd')](_0x0ff7('0xe'));return rp(_0x57ec42)['then'](function(_0x40709e){if(_0x40709e){var _0x295260=_0x40709e[_0x0ff7('0xf')];var _0x23889b=null;for(_0x23889b=0x0;_0x23889b<_0x295260[_0x0ff7('0x10')];_0x23889b++){if(_0x295260[_0x23889b][_0x0ff7('0x11')]===_0x5a4f9f['adminEmail']){_0x5a4f9f[_0x0ff7('0x12')]=_0x295260[_0x23889b]['id'];_0x5cd236=!![];}}if(_0x5cd236){logger[_0x0ff7('0xd')]('Admin\x20found:',_0x5a4f9f[_0x0ff7('0x12')]);_0x21fc14(_0x5a4f9f);}else{_0x9ad26e({'statusCode':0x194,'message':_0x0ff7('0x13')});}}else{_0x9ad26e({'statusCode':0x194,'message':_0x0ff7('0x13')});}})[_0x0ff7('0x14')](function(_0x6444a0){logger['error']('['+[_0x24d7bf['toUpperCase']()]+']',_0x6444a0[_0x0ff7('0x15')]);_0x9ad26e(_0x6444a0);});});}function getUser(_0x7ed2a1,_0x24463f,_0x335a4d){return function(_0xc5f79a){return new Promise(function(_0x26b463,_0xecb9e4){var _0x556f2d={'method':_0x0ff7('0xb'),'uri':_0x335a4d+'/api/selector/owners','json':!![]};_0x556f2d[_0x0ff7('0x16')]=_0x24463f;logger['info'](_0x0ff7('0x17'));return rp(_0x556f2d)[_0x0ff7('0x18')](function(_0x157116){if(_0x157116){var _0x5a1b4c=_0x157116[_0x0ff7('0xf')];var _0x3fdde4=![];var _0x559c3d=null;if(_0xc5f79a[_0x0ff7('0x19')]!==null){logger['info'](_0x0ff7('0x1a'),_0xc5f79a[_0x0ff7('0x19')]);_0xc5f79a[_0x0ff7('0x1b')]=_0xc5f79a['agentEmail'];for(_0x559c3d=0x0;_0x559c3d<_0x5a1b4c[_0x0ff7('0x10')];_0x559c3d++){if(_0x5a1b4c[_0x559c3d][_0x0ff7('0x11')]===_0xc5f79a[_0x0ff7('0x19')]){_0x3fdde4=!![];_0xc5f79a[_0x0ff7('0x1c')]=_0x5a1b4c[_0x559c3d]['id'];logger['info'](_0x0ff7('0x1d'),_0xc5f79a[_0x0ff7('0x1c')]);}}}if(!_0x3fdde4){logger[_0x0ff7('0xd')](_0x0ff7('0x1e'));_0xc5f79a[_0x0ff7('0x1b')]=_0xc5f79a[_0x0ff7('0x1f')];_0xc5f79a[_0x0ff7('0x1c')]=_0xc5f79a[_0x0ff7('0x12')];_0x3fdde4=!![];}if(_0x3fdde4){_0x26b463(_0xc5f79a);}else{_0xecb9e4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xecb9e4({'statusCode':0x194,'message':_0x0ff7('0x13')});}})[_0x0ff7('0x14')](function(_0x2ea043){logger['error']('['+[_0x7ed2a1[_0x0ff7('0x20')]()]+']',_0x2ea043[_0x0ff7('0x15')]);_0xecb9e4(_0x2ea043);});});};}function searchContact(_0x1619f0,_0x5d25be,_0xb6f483,_0xe71e11){return new Promise(function(_0x5f319c,_0x54af7e){var _0x46329a={'method':'GET','headers':_0x5d25be,'uri':_0x1619f0+_0x0ff7('0x21')+_0xe71e11+'&f='+_0xb6f483+'&entities=contact','json':!![]};rp(_0x46329a)[_0x0ff7('0x18')](function(_0x435b24){var _0x51e9d6=_[_0x0ff7('0x22')](_0x435b24[_0x0ff7('0x23')][_0x0ff7('0x23')],[_0xb6f483,_0xe71e11]);_0x5f319c(_0x51e9d6);})[_0x0ff7('0x14')](function(_0x651bd6){_0x54af7e(_0x651bd6);});});}function getEndUser(_0x128fb9,_0x2c064b,_0x1477cc){return function(_0x56aa20){return new Promise(function(_0x4fb843,_0x54f4ac){logger[_0x0ff7('0xd')](util['format'](_0x0ff7('0x24'),_0x56aa20[_0x0ff7('0x25')]));searchContact(_0x1477cc,_0x2c064b,'mobile_number',_0x56aa20['contactNumber'])['then'](function(_0x5d199d){if(_0x5d199d){_0x56aa20[_0x0ff7('0x26')]=_0x5d199d['id'];logger[_0x0ff7('0xd')](_0x0ff7('0x27'),_0x56aa20[_0x0ff7('0x26')]);return _0x4fb843(_0x56aa20);}searchContact(_0x1477cc,_0x2c064b,'work_number',_0x56aa20[_0x0ff7('0x25')])[_0x0ff7('0x18')](function(_0x200034){if(_0x200034){_0x56aa20[_0x0ff7('0x26')]=_0x200034['id'];logger[_0x0ff7('0xd')](_0x0ff7('0x28'),_0x56aa20['endUserId']);return _0x4fb843(_0x56aa20);}createEndUser(_0x56aa20,_0x128fb9,_0x2c064b,_0x1477cc)[_0x0ff7('0x18')](function(_0x34b722){logger[_0x0ff7('0xd')](_0x0ff7('0x29'),_0x34b722['endUserId']);return _0x4fb843(_0x34b722);});});})['catch'](function(_0x3d4e79){_0x54f4ac(_0x3d4e79);});});};}function createEndUser(_0xadfce1,_0x413608,_0x5e5d38,_0x3b61cb){return new Promise(function(_0x5d2eec,_0x1ce838){var _0x10380b=moment();var _0x583a77={'method':'POST','uri':_0x3b61cb+_0x0ff7('0x2a'),'body':{'contact':{'last_name':_0xadfce1[_0x0ff7('0x25')],'work_number':_0xadfce1[_0x0ff7('0x25')],'mobile_number':_0xadfce1['contactNumber'],'owner_id':_0xadfce1['userId'],'created_at':_0x10380b[_0x0ff7('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x583a77[_0x0ff7('0x16')]=_0x5e5d38;logger[_0x0ff7('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x583a77)[_0x0ff7('0x18')](function(_0x561d5f){_0xadfce1['endUserId']=_0x561d5f[_0x0ff7('0x2c')]['id'];_0x5d2eec(_0xadfce1);})[_0x0ff7('0x14')](function(_0x39ab43){logger['error']('['+[_0x413608[_0x0ff7('0x20')]()]+']',_0x39ab43[_0x0ff7('0x15')]);_0x1ce838(_0x39ab43[_0x0ff7('0x15')]);});});}function getTicket(_0x524460,_0x2a8bac,_0x4d742f,_0x58e054,_0x3a00cf){return function(_0xd8781e){logger[_0x0ff7('0xd')]('Creating\x20new\x20task');return new Promise(function(_0xcdab1a,_0x321086){var _0x11c871=moment();var _0x1fab6e={'method':_0x0ff7('0x2d'),'uri':_0x4d742f+'/api/tasks','body':{'title':intUtil[_0x0ff7('0x2e')](_0x58e054['Subjects'],_0x3a00cf,'\x20'),'description':intUtil[_0x0ff7('0x2e')](_0x58e054[_0x0ff7('0x2f')],_0x3a00cf,'\x0a'),'owner_id':_0xd8781e[_0x0ff7('0x1c')],'creater_id':_0xd8781e['adminId'],'targetable_id':_0xd8781e[_0x0ff7('0x26')],'targetable_type':'Contact','created_at':_0x11c871[_0x0ff7('0x2b')](_0x0ff7('0x30')),'due_date':_0x11c871[_0x0ff7('0x31')](0x1e,'m')[_0x0ff7('0x2b')](_0x0ff7('0x30'))},'json':!![]};_0x1fab6e[_0x0ff7('0x16')]=_0x2a8bac;return rp(_0x1fab6e)['then'](function(_0x27702c){_0xd8781e[_0x0ff7('0x32')]=_0x27702c[_0x0ff7('0x33')]['id'];logger['info'](_0x0ff7('0x34'),_0xd8781e[_0x0ff7('0x32')]);_0xcdab1a(_0xd8781e);})[_0x0ff7('0x14')](function(_0x4ef258){logger[_0x0ff7('0x35')]('['+[_0x524460[_0x0ff7('0x20')]()]+']',_0x4ef258[_0x0ff7('0x15')]);_0x321086(_0x4ef258[_0x0ff7('0x15')]);});});};}function emit(_0x235b40,_0x3e7478,_0x4e63ac){var _0x3737b7={'uri':_0x235b40+_0x0ff7('0x36')+_0x4e63ac};io['to'](util[_0x0ff7('0x2b')](_0x0ff7('0x37'),_0x3e7478))[_0x0ff7('0x38')]('trigger:browser:url',_0x3737b7);}exports['cs']=function(_0x3b28dc,_0x5a047d,_0x319646,_0x421c29,_0x7f12ce,_0x159f30,_0xc5f46f,_0x23c09e){var _0x354c11={};var _0x52e993={'Authorization':_0x0ff7('0x39')+_0x159f30[_0x0ff7('0x3a')]};_0x159f30[_0x0ff7('0x3b')]=intUtil[_0x0ff7('0x3c')](_0x159f30[_0x0ff7('0x3b')]);_0x159f30['serverUrl']=intUtil[_0x0ff7('0x3c')](_0x159f30[_0x0ff7('0x3d')]);var _0x182a91=_0x159f30['remoteUri'];_0x354c11[_0x0ff7('0x1f')]=_0x159f30[_0x0ff7('0x3e')];_0x354c11[_0x0ff7('0x25')]=_0x23c09e['toLowerCase']()===_0x0ff7('0x3f')?_0x5a047d[_0x0ff7('0x40')]:_0x5a047d[_0x0ff7('0x41')];_0x354c11[_0x0ff7('0x42')]=_0x23c09e===_0x0ff7('0x43')||_0x23c09e===_0x0ff7('0x44')?_0x0ff7('0x43'):'outbound';if(_0x421c29){_0x354c11[_0x0ff7('0x19')]=_0x421c29[_0x0ff7('0x11')];}var _0x215bb1=util[_0x0ff7('0x2b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x159f30[_0x0ff7('0x3d')],_0x5a047d[_0x0ff7('0x45')],md5(_0x5a047d[_0x0ff7('0x45')]));if(_0x7f12ce&&_0x7f12ce[_0x0ff7('0x46')]){logger['info'](_0x0ff7('0x47'),_0x0ff7('0x48'));_0x5a047d[_0x0ff7('0x49')]=_0x215bb1;}else if(_0xc5f46f&&_0xc5f46f[_0x0ff7('0x4a')]&&_0xc5f46f[_0x0ff7('0x4a')]!==_0x0ff7('0x4b')){logger[_0x0ff7('0xd')](_0x0ff7('0x4c'),_0x0ff7('0x48'));_0x5a047d['recordingURL']=_0x215bb1;}else{_0x5a047d[_0x0ff7('0x49')]='';}return getAdminId(_0x354c11,_0x23c09e,_0x52e993,_0x182a91)['then'](getUser(_0x23c09e,_0x52e993,_0x182a91))[_0x0ff7('0x18')](getEndUser(_0x23c09e,_0x52e993,_0x182a91))[_0x0ff7('0x18')](getTicket(_0x23c09e,_0x52e993,_0x182a91,_0x319646,_0x5a047d))['then'](function(_0x809d69){logger[_0x0ff7('0xd')](util[_0x0ff7('0x2b')](_0x0ff7('0x4d'),_0x809d69[_0x0ff7('0x32')]));if(_0x23c09e!==_0x0ff7('0x44')){logger['info']('['+[_0x23c09e[_0x0ff7('0x20')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x182a91,_0x421c29[_0x0ff7('0x4e')],_0x809d69[_0x0ff7('0x26')]);}})[_0x0ff7('0x14')](function(_0x19685a){logger[_0x0ff7('0x35')]('['+[_0x23c09e[_0x0ff7('0x20')]()]+_0x0ff7('0x4f'),util['inspect'](_0x19685a,{'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 499e064..49df99c 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 _0xa76a=['%s\x20configuration\x20#%s\x20not\x20found','error','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','unknown\x20integration','../../../../config/logger','[EXEC]','format'];(function(_0x101673,_0x535a02){var _0x1485ee=function(_0x4f16a8){while(--_0x4f16a8){_0x101673['push'](_0x101673['shift']());}};_0x1485ee(++_0x535a02);}(_0xa76a,0x6e));var _0xaa76=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa76a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xaa76('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xaa76('0x1'));var sugarcrm=require(_0xaa76('0x2'));var freshdesk=require(_0xaa76('0x3'));var zoho=require(_0xaa76('0x4'));var desk=require(_0xaa76('0x5'));var vtiger=require(_0xaa76('0x6'));var servicenow=require(_0xaa76('0x7'));var dynamics365=require(_0xaa76('0x8'));var freshsales=require(_0xaa76('0x9'));var integrations=[_0xaa76('0xa'),_0xaa76('0xb'),_0xaa76('0xc'),_0xaa76('0xd'),_0xaa76('0xe'),_0xaa76('0xf'),_0xaa76('0x10'),_0xaa76('0x11'),'freshsales',_0xaa76('0x12')];exports[_0xaa76('0x13')]=function(_0x1b9278,_0x579afd,_0x51dddb,_0x1d14b5,_0x208bc4,_0x2525ad){if(_0x51dddb){if(_[_0xaa76('0x14')](integrations,_0x1b9278[_0xaa76('0x15')]['toLowerCase']())){try{var _0x2ef424=null;var _0x1bff17='';var _0x59a407=_0x51dddb[_0x1b9278['data1'][_0xaa76('0x16')]()];if(_0x59a407){var _0x24dc5d=_0x59a407[_0x1b9278[_0xaa76('0x17')]];if(_0x24dc5d){var _0x21750c=_[_0xaa76('0x18')](_0x24dc5d[_0xaa76('0x19')],{'id':parseInt(_0x1b9278[_0xaa76('0x1a')],0xa)});if(_0x21750c){if(_0x1d14b5){if(_0x208bc4&&_0x579afd[_0xaa76('0x1b')]){_0x1bff17='queue';}else if(_0x579afd[_0xaa76('0x1c')]){_0x1bff17='outbound';}else{console[_0xaa76('0x1d')]('EVENT\x20UNKNOWN',_0x579afd);}}else{_0x1bff17='unmanaged';}switch(_0x1b9278[_0xaa76('0x15')][_0xaa76('0x16')]()){case'zendesk':zendesk[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case _0xaa76('0xb'):salesforce[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case _0xaa76('0xc'):sugarcrm[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case _0xaa76('0xd'):freshdesk[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case'zoho':zoho[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case _0xaa76('0xf'):desk[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case _0xaa76('0x10'):vtiger[_0x1bff17](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad);break;case'freshsales':freshsales['cs'](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad,_0x1bff17);break;case'servicenow':servicenow['cs'](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad,_0x1bff17);break;case'dynamics365':dynamics365['cs'](_0x1b9278,_0x579afd,_0x21750c,_0x1d14b5,_0x208bc4,_0x24dc5d,_0x2525ad,_0x1bff17);break;default:console['log'](_0xaa76('0x1e'));}}else{_0x2ef424=require(_0xaa76('0x1f'))(_0x1b9278[_0xaa76('0x15')][_0xaa76('0x16')]());_0x2ef424['error'](_0xaa76('0x20'),util[_0xaa76('0x21')](_0xaa76('0x22'),_0x1b9278[_0xaa76('0x15')][_0xaa76('0x16')](),_0x1b9278[_0xaa76('0x1a')]));}}else{_0x2ef424=require(_0xaa76('0x1f'))(_0x1b9278[_0xaa76('0x15')][_0xaa76('0x16')]());_0x2ef424[_0xaa76('0x23')]('[EXEC]',util[_0xaa76('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x1b9278[_0xaa76('0x15')][_0xaa76('0x16')](),_0x1b9278[_0xaa76('0x17')]));}}else{}}catch(_0xbc7a8){console[_0xaa76('0x23')](_0xbc7a8);}}}}; \ No newline at end of file +var _0xfecf=['./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','desk','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','data2','util','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x3c357e,_0x4c3edf){var _0x5cec9c=function(_0x428f21){while(--_0x428f21){_0x3c357e['push'](_0x3c357e['shift']());}};_0x5cec9c(++_0x4c3edf);}(_0xfecf,0x1f2));var _0xffec=function(_0x59a71e,_0x5710cb){_0x59a71e=_0x59a71e-0x0;var _0x25e6d4=_0xfecf[_0x59a71e];return _0x25e6d4;};'use strict';var _=require('lodash');var util=require(_0xffec('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xffec('0x1'));var zoho=require(_0xffec('0x2'));var desk=require(_0xffec('0x3'));var vtiger=require(_0xffec('0x4'));var servicenow=require(_0xffec('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xffec('0x6'));var integrations=['zendesk',_0xffec('0x7'),_0xffec('0x8'),_0xffec('0x9'),_0xffec('0xa'),'desk',_0xffec('0xb'),_0xffec('0xc'),_0xffec('0xd'),_0xffec('0xe')];exports[_0xffec('0xf')]=function(_0x34788b,_0x21fbcd,_0x4d4652,_0x4e9cec,_0x509dbc,_0x3be1f3){if(_0x4d4652){if(_['includes'](integrations,_0x34788b[_0xffec('0x10')][_0xffec('0x11')]())){try{var _0x37ee7a=null;var _0x401848='';var _0x3b6f20=_0x4d4652[_0x34788b[_0xffec('0x10')][_0xffec('0x11')]()];if(_0x3b6f20){var _0x2433bf=_0x3b6f20[_0x34788b['data2']];if(_0x2433bf){var _0x2d1603=_[_0xffec('0x12')](_0x2433bf[_0xffec('0x13')],{'id':parseInt(_0x34788b[_0xffec('0x14')],0xa)});if(_0x2d1603){if(_0x4e9cec){if(_0x509dbc&&_0x21fbcd[_0xffec('0x15')]){_0x401848=_0xffec('0x15');}else if(_0x21fbcd['routeId']){_0x401848=_0xffec('0x16');}else{console['log'](_0xffec('0x17'),_0x21fbcd);}}else{_0x401848=_0xffec('0x18');}switch(_0x34788b['data1'][_0xffec('0x11')]()){case _0xffec('0x19'):zendesk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'salesforce':salesforce[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0x8'):sugarcrm[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'freshdesk':freshdesk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0xa'):zoho[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0x1a'):desk[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case'vtiger':vtiger[_0x401848](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3);break;case _0xffec('0xd'):freshsales['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;case _0xffec('0xe'):servicenow['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;case'dynamics365':dynamics365['cs'](_0x34788b,_0x21fbcd,_0x2d1603,_0x4e9cec,_0x509dbc,_0x2433bf,_0x3be1f3,_0x401848);break;default:console[_0xffec('0x1b')](_0xffec('0x1c'));}}else{_0x37ee7a=require('../../../../config/logger')(_0x34788b[_0xffec('0x10')][_0xffec('0x11')]());_0x37ee7a[_0xffec('0x1d')](_0xffec('0x1e'),util[_0xffec('0x1f')](_0xffec('0x20'),_0x34788b[_0xffec('0x10')]['toLowerCase'](),_0x34788b[_0xffec('0x14')]));}}else{_0x37ee7a=require(_0xffec('0x21'))(_0x34788b['data1'][_0xffec('0x11')]());_0x37ee7a[_0xffec('0x1d')](_0xffec('0x1e'),util[_0xffec('0x1f')](_0xffec('0x22'),_0x34788b[_0xffec('0x10')][_0xffec('0x11')](),_0x34788b[_0xffec('0x23')]));}}else{}}catch(_0x38e059){console['error'](_0x38e059);}}}}; \ 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 b889a86..028a0b3 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 _0x8998=['jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','find','execute','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Contact','Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','No\x20Company','forEach','includes','picklist','idField','content','toString','type','variableName','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','destcalleridnum','Fields','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','lastevent','lodash','moment','bluebird','md5'];(function(_0x37eb28,_0x57b951){var _0x3a11c3=function(_0x12f6d5){while(--_0x12f6d5){_0x37eb28['push'](_0x37eb28['shift']());}};_0x3a11c3(++_0x57b951);}(_0x8998,0x79));var _0x8899=function(_0x2c369d,_0x4a9c03){_0x2c369d=_0x2c369d-0x0;var _0x348412=_0x8998[_0x2c369d];return _0x348412;};'use strict';var _=require(_0x8899('0x0'));var rp=require('request-promise');var moment=require(_0x8899('0x1'));var BPromise=require(_0x8899('0x2'));var md5=require(_0x8899('0x3'));var jsforce=require(_0x8899('0x4'));var util=require('util');var Redis=require(_0x8899('0x5'));var intUtil=require(_0x8899('0x6'));var config=require(_0x8899('0x7'));var logger=require(_0x8899('0x8'))(_0x8899('0x9'));config[_0x8899('0xa')]=_[_0x8899('0xb')](config[_0x8899('0xa')],{'host':_0x8899('0xc'),'port':0x18eb});var io=require(_0x8899('0xd'))(new Redis(config[_0x8899('0xa')]));function emit(_0xe941,_0x2b7fe7,_0x33087e){io['to'](_0xe941)[_0x8899('0xe')](_0x2b7fe7,_0x33087e);}function getTicket(_0x10062e,_0x2ed536,_0x3fed32,_0x212e87,_0x11f2e7,_0x491f69,_0x268c20,_0xca5ad1){var _0x4f20e6=Object[_0x8899('0xf')]({},{'OwnerId':_0x2ed536['id'],'Subject':intUtil[_0x8899('0x10')](_0x212e87[_0x8899('0x11')],_0x11f2e7,'\x20'),'Description':intUtil[_0x8899('0x10')](_0x212e87['Descriptions'],_0x11f2e7,'\x0a')},getCustomFields(_0x491f69,_0x11f2e7));if(_0x3fed32){if(_0x212e87[_0x8899('0x12')]===_0x8899('0x13')){_0x4f20e6['ActivityDate']=moment[_0x8899('0x14')]();_0x4f20e6['IsReminderSet']=![];_0x4f20e6[_0x8899('0x15')]=![];if(_0x3fed32[_0x8899('0x16')]===_0x8899('0x17')||_0x3fed32[_0x8899('0x16')]===_0x8899('0x18')){_0x4f20e6[_0x8899('0x19')]=_0x3fed32['id'];}else if(_0x3fed32['endUserType']===_0x8899('0x1a')){_0x4f20e6[_0x8899('0x1b')]=_0x3fed32['id'];}}else if(_0x212e87[_0x8899('0x12')]===_0x8899('0x1c')){if(_0x3fed32[_0x8899('0x16')]===_0x8899('0x17')){_0x4f20e6[_0x8899('0x1d')]=_0x3fed32['id'];}else if(_0x3fed32[_0x8899('0x16')]===_0x8899('0x1a')){_0x4f20e6[_0x8899('0x1e')]=_0x3fed32['id'];}else if(_0x3fed32[_0x8899('0x16')]===_0x8899('0x18')&&_0x212e87[_0x8899('0x1f')]){_0x4f20e6[_0x212e87[_0x8899('0x1f')]]=_0x3fed32['id'];}else{logger[_0x8899('0x20')](_0x8899('0x21'));}}}return _0x268c20[_0x8899('0x22')](_0x212e87['ticketType'])[_0x8899('0x23')](_0x4f20e6);}function getUser(_0xf87975,_0x1b7206,_0xcf2465){if(!_['isNil'](_0x1b7206)&&intUtil[_0x8899('0x24')](_0x1b7206)){var _0x269d1e={'Email':_0x1b7206};var _0x2b53b9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xcf2465[_0x8899('0x22')]('User')[_0x8899('0x25')](_0x269d1e,_0x2b53b9)[_0x8899('0x26')]()['then'](function(_0x34497e){if(_0x34497e[_0x8899('0x27')]){var _0x33942c=_['find'](_0x34497e,function(_0x56fa1d){return _0x56fa1d[_0x8899('0x28')]===_0x1b7206;});if(_0x33942c){logger['info']('Agent\x20%s\x20found.',_0x1b7206);return BPromise['resolve']({'id':_0x33942c['Id'],'name':_0x33942c[_0x8899('0x29')]});}}else{logger[_0x8899('0x20')](_0x8899('0x2a'),_0x1b7206);return _0xcf2465[_0x8899('0x2b')]()[_0x8899('0x2c')](function(_0x4c5bd8){return BPromise[_0x8899('0x2d')]({'id':_0x4c5bd8[_0x8899('0x2e')],'name':_0x4c5bd8[_0x8899('0x2f')]});});}});}else{logger[_0x8899('0x20')](_0x8899('0x2a'),_0x1b7206);return _0xcf2465[_0x8899('0x2b')]()['then'](function(_0x3f03be){return BPromise[_0x8899('0x2d')]({'id':_0x3f03be[_0x8899('0x2e')],'name':_0x3f03be['display_name']});});}}function getEndUser(_0x5bab06,_0x17122b,_0x216359,_0x195472,_0x29c037){var _0x1d51d8={'$or':{'Phone':_0x195472}};var _0x5df7f2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8899('0x2d')]()[_0x8899('0x2c')](function(){logger[_0x8899('0x20')](_0x8899('0x30'),_0x195472,_0x17122b[_0x8899('0x31')]);switch(_0x17122b[_0x8899('0x31')]){case _0x8899('0x32'):var _0x1af91f=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x34')]){var _0x167594={};_0x167594[_0x17122b[_0x8899('0x34')]]=_0x195472;_[_0x8899('0x35')](_0x1af91f['$or'],_0x167594);}return _0x29c037[_0x8899('0x22')]('Contact')['find'](_0x1af91f,_0x5df7f2)['execute']()[_0x8899('0x2c')](function(_0x117c2f){if(_0x117c2f&&_0x117c2f['length']){return _0x117c2f;}else{var _0x3fd9d=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b['additionalSearchLead']){var _0x46c87e={};_0x46c87e[_0x17122b[_0x8899('0x36')]]=_0x195472;_[_0x8899('0x35')](_0x3fd9d['$or'],_0x46c87e);}return _0x29c037[_0x8899('0x22')](_0x8899('0x37'))[_0x8899('0x25')](_0x3fd9d,_0x5df7f2);}});case _0x8899('0x38'):var _0x3a4fe0=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x39')]){var _0x167594={};_0x167594[_0x17122b['additionalSearchAccount']]=_0x195472;_[_0x8899('0x35')](_0x3a4fe0[_0x8899('0x3a')],_0x167594);}return _0x29c037[_0x8899('0x22')]('Account')[_0x8899('0x25')](_0x3a4fe0,_0x5df7f2)[_0x8899('0x26')]()[_0x8899('0x2c')](function(_0x492486){if(_0x492486&&_0x492486[_0x8899('0x27')]){return _0x492486;}else{var _0x512332=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x34')]){var _0xb6bac5={};_0xb6bac5[_0x17122b[_0x8899('0x34')]]=_0x195472;_['merge'](_0x512332[_0x8899('0x3a')],_0xb6bac5);}return _0x29c037[_0x8899('0x22')](_0x8899('0x3b'))[_0x8899('0x25')](_0x512332,_0x5df7f2)[_0x8899('0x2c')](function(_0x5c463f){if(_0x5c463f&&_0x5c463f['length']){return _0x5c463f;}else{var _0x3d8149=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x36')]){var _0xe2211d={};_0xe2211d[_0x17122b[_0x8899('0x36')]]=_0x195472;_['merge'](_0x3d8149['$or'],_0xe2211d);}return _0x29c037['sobject'](_0x8899('0x37'))[_0x8899('0x25')](_0x3d8149,_0x5df7f2);}});}});case _0x8899('0x17'):var _0x1af91f=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x34')]){var _0x167594={};_0x167594[_0x17122b[_0x8899('0x34')]]=_0x195472;_[_0x8899('0x35')](_0x1af91f[_0x8899('0x3a')],_0x167594);}return _0x29c037[_0x8899('0x22')](_0x8899('0x3b'))['find'](_0x1af91f,_0x5df7f2)['execute']();case _0x8899('0x18'):var _0x40b0ec=_['cloneDeep'](_0x1d51d8);if(_0x17122b[_0x8899('0x36')]){var _0x167594={};_0x167594[_0x17122b[_0x8899('0x36')]]=_0x195472;_[_0x8899('0x35')](_0x40b0ec[_0x8899('0x3a')],_0x167594);}return _0x29c037[_0x8899('0x22')]('Lead')[_0x8899('0x25')](_0x40b0ec,_0x5df7f2);case _0x8899('0x1a'):var _0x3a4fe0=_[_0x8899('0x33')](_0x1d51d8);if(_0x17122b[_0x8899('0x39')]){var _0x167594={};_0x167594[_0x17122b[_0x8899('0x39')]]=_0x195472;_['merge'](_0x3a4fe0[_0x8899('0x3a')],_0x167594);}return _0x29c037[_0x8899('0x22')](_0x8899('0x3c'))['find'](_0x3a4fe0,_0x5df7f2);default:return null;}})[_0x8899('0x2c')](function(_0x5d86be){if(_0x5d86be&&_0x5d86be[_0x8899('0x27')]){var _0x267c06=_[_0x8899('0x3d')](_0x5d86be);if(_0x267c06){return BPromise['resolve']({'id':_0x267c06['Id'],'name':_0x267c06['Name'],'phone':_0x267c06[_0x8899('0x3e')],'endUserType':_0x267c06[_0x8899('0x3f')]['type'][_0x8899('0x40')]()});}}})['then'](function(_0x151079){if(_0x151079){logger[_0x8899('0x20')](_0x8899('0x41'),_0x151079['endUserType'],_0x195472);return BPromise[_0x8899('0x2d')](_0x151079);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x195472);var _0x508d44={'Phone':_0x195472};if(_0x17122b[_0x8899('0x42')]){if(_0x17122b[_0x8899('0x42')]===_0x8899('0x17')){logger[_0x8899('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x195472,_0x17122b[_0x8899('0x42')]);_0x508d44['LastName']=_0x216359!==_0x8899('0x43')?_0x216359:util[_0x8899('0x44')](_0x8899('0x45'),_0x195472);}else if(_0x17122b[_0x8899('0x42')]===_0x8899('0x18')){logger['info'](_0x8899('0x46'),_0x195472,_0x17122b['moduleCreate']);_0x508d44[_0x8899('0x47')]=_0x216359!==''?_0x216359:util[_0x8899('0x44')](_0x8899('0x45'),_0x195472);_0x508d44['Company']=_0x8899('0x48');}else if(_0x17122b[_0x8899('0x42')]===_0x8899('0x1a')){logger[_0x8899('0x20')](_0x8899('0x46'),_0x195472,_0x17122b[_0x8899('0x42')]);_0x508d44[_0x8899('0x29')]=_0x216359!==_0x8899('0x43')?_0x216359:util[_0x8899('0x44')](_0x8899('0x45'),_0x195472);}else{return null;}}return _0x29c037[_0x8899('0x22')](_['upperFirst'](_0x17122b[_0x8899('0x42')]))['create'](_0x508d44)[_0x8899('0x2c')](function(_0x23411d){return BPromise[_0x8899('0x2d')]({'id':_0x23411d['id'],'endUserType':_0x17122b[_0x8899('0x42')]});});}});}function getCustomFields(_0x2e7528,_0x586b74){var _0x388b93={};if(_0x2e7528['length']>0x0){_[_0x8899('0x49')](_0x2e7528,function(_0x3ffa9e){if(_[_0x8899('0x4a')](['string',_0x8899('0x4b')],_0x3ffa9e['type'])&&_0x3ffa9e[_0x8899('0x4c')]){_0x388b93[_0x3ffa9e[_0x8899('0x4c')]]=_0x3ffa9e[_0x8899('0x4d')][_0x8899('0x4e')]();}else if(_0x3ffa9e[_0x8899('0x4f')]==='variable'&&_0x3ffa9e['variableName']&&_0x3ffa9e[_0x8899('0x4c')]){_0x586b74[_0x3ffa9e['variableName']]&&(_0x388b93[_0x3ffa9e[_0x8899('0x4c')]]=_0x586b74[_0x3ffa9e[_0x8899('0x50')]]['toString']());}else if(_0x3ffa9e['type']==='customVariable'&&_0x3ffa9e['Variable']&&_0x3ffa9e[_0x8899('0x51')]['name']&&_0x3ffa9e[_0x8899('0x4c')]){_0x586b74[_0x3ffa9e[_0x8899('0x51')]['name'][_0x8899('0x40')]()]&&(_0x388b93[_0x3ffa9e[_0x8899('0x4c')]]=_0x586b74[_0x3ffa9e[_0x8899('0x51')][_0x8899('0x52')][_0x8899('0x40')]()][_0x8899('0x4e')]());}});}return _0x388b93;}function getConnection(_0x56a001){var _0x55abd5=_0x56a001[_0x8899('0x53')]['concat'](_0x56a001[_0x8899('0x54')]);var _0x998fac=new jsforce[(_0x8899('0x55'))]({'oauth2':{'loginUrl':_0x56a001[_0x8899('0x56')]||_0x8899('0x57'),'clientId':_0x56a001[_0x8899('0x58')],'clientSecret':_0x56a001[_0x8899('0x59')]}});return _0x998fac[_0x8899('0x5a')](_0x56a001[_0x8899('0x5b')],_0x55abd5)[_0x8899('0x2c')](function(){logger[_0x8899('0x20')](_0x8899('0x5c'));return _0x998fac;});}exports['queue']=function(_0x2854dd,_0xda6da,_0x467637,_0x1df1d1,_0x1fafc8,_0x3fa5e4){var _0x4c8998,_0x3c19bf,_0x41fb89,_0x2ea3;_0x3fa5e4[_0x8899('0x5d')]=intUtil['stripTrailingSlash'](_0x3fa5e4['serverUrl']);_0x3fa5e4['remoteUri']=intUtil[_0x8899('0x5e')](_0x3fa5e4[_0x8899('0x56')]);if(_0x1fafc8&&_0x1fafc8[_0x8899('0x5f')]){logger[_0x8899('0x20')](_0x8899('0x60'),_0x8899('0x61'));_0xda6da[_0x8899('0x62')]=util['format'](_0x8899('0x63'),_0x3fa5e4[_0x8899('0x5d')],_0xda6da['uniqueid'],md5(_0xda6da[_0x8899('0x64')]));}else{_0xda6da[_0x8899('0x62')]='';}return getConnection(_0x3fa5e4)[_0x8899('0x2c')](function(_0x3323bc){_0x2ea3=_0x3323bc;return getUser(_0x3fa5e4,_0x1df1d1[_0x8899('0x65')],_0x2ea3);})['then'](function(_0x23820b){_0x4c8998=_0x23820b;return getEndUser(_0x3fa5e4,_0x467637,_0xda6da[_0x8899('0x66')],_0xda6da[_0x8899('0x67')],_0x2ea3);})[_0x8899('0x2c')](function(_0x524a6c){_0x3c19bf=_0x524a6c;return getTicket(_0x3fa5e4,_0x4c8998,_0x3c19bf,_0x467637,_0xda6da,_0x467637['Fields'],_0x2ea3,_0x8899('0x68'));})[_0x8899('0x2c')](function(_0x5197dc){_0x41fb89=_0x5197dc;logger[_0x8899('0x20')](_0x8899('0x69'),_0x41fb89['id']);logger[_0x8899('0x20')](_0x8899('0x6a'),_0x41fb89['id'],_0x1df1d1['name'],_0x3fa5e4[_0x8899('0x4f')]);switch(_0x3fa5e4[_0x8899('0x4f')]){case _0x8899('0x6b'):emit(util[_0x8899('0x44')](_0x8899('0x6c'),_0x1df1d1['name']),_0x8899('0x6d'),{'recordId':_0x41fb89['id']});break;case _0x8899('0x6e'):emit(util['format'](_0x8899('0x6c'),_0x1df1d1[_0x8899('0x52')]),_0x8899('0x6f'),{'uri':util[_0x8899('0x44')](_0x8899('0x70'),_0x2ea3[_0x8899('0x71')],_0x41fb89['id'])});break;default:logger[_0x8899('0x72')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8899('0x73')](function(_0x3044b2){logger['error'](_0x8899('0x60'),_0x3044b2);});};exports[_0x8899('0x74')]=function(_0x399275,_0x1c1749,_0x4a8aff,_0x208162,_0x22e4c7,_0x492761,_0x9bc854){var _0x1f2b78,_0x5cc4e4,_0x52f070,_0x2195e6;_0x492761[_0x8899('0x5d')]=intUtil[_0x8899('0x5e')](_0x492761['serverUrl']);_0x492761['remoteUri']=intUtil['stripTrailingSlash'](_0x492761['remoteUri']);if(_0x9bc854&&_0x9bc854['recordingFormat']&&_0x9bc854[_0x8899('0x75')]!==_0x8899('0x76')){logger[_0x8899('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1c1749[_0x8899('0x62')]=util[_0x8899('0x44')](_0x8899('0x63'),_0x492761['serverUrl'],_0x1c1749[_0x8899('0x64')],md5(_0x1c1749[_0x8899('0x64')]));}return getConnection(_0x492761)[_0x8899('0x2c')](function(_0x374244){_0x2195e6=_0x374244;return getUser(_0x492761,_0x208162['email'],_0x2195e6);})[_0x8899('0x2c')](function(_0x13d31b){_0x1f2b78=_0x13d31b;return getEndUser(_0x492761,_0x4a8aff,_0x1c1749['destcalleridname'],_0x1c1749[_0x8899('0x77')],_0x2195e6);})[_0x8899('0x2c')](function(_0x5c3581){_0x5cc4e4=_0x5c3581;return getTicket(_0x492761,_0x1f2b78,_0x5cc4e4,_0x4a8aff,_0x1c1749,_0x4a8aff[_0x8899('0x78')],_0x2195e6,_0x8899('0x74'));})[_0x8899('0x2c')](function(_0x5cc944){_0x52f070=_0x5cc944;logger[_0x8899('0x20')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x52f070['id']);logger[_0x8899('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x52f070['id'],_0x208162[_0x8899('0x52')],_0x492761['type']);switch(_0x492761[_0x8899('0x4f')]){case _0x8899('0x6b'):emit(util[_0x8899('0x44')](_0x8899('0x6c'),_0x208162[_0x8899('0x52')]),_0x8899('0x6d'),{'recordId':_0x52f070['id']});break;case _0x8899('0x6e'):emit(util[_0x8899('0x44')](_0x8899('0x6c'),_0x208162[_0x8899('0x52')]),_0x8899('0x6f'),{'uri':util['format'](_0x8899('0x70'),_0x2195e6[_0x8899('0x71')],_0x52f070['id'])});break;default:logger[_0x8899('0x72')](_0x8899('0x79'),_0x8899('0x7a'));}})[_0x8899('0x73')](function(_0x5d7ecc){logger[_0x8899('0x72')](_0x8899('0x79'),_0x5d7ecc);});};exports['unmanaged']=function(_0x755095,_0x28b40e,_0x5449ef,_0x5957e7,_0x460f91,_0x31e605){var _0x3c9b4a,_0x2d00a7,_0x2b3f7b,_0x20b67a;_0x31e605[_0x8899('0x5d')]=intUtil[_0x8899('0x5e')](_0x31e605[_0x8899('0x5d')]);_0x31e605[_0x8899('0x56')]=intUtil[_0x8899('0x5e')](_0x31e605[_0x8899('0x56')]);if(_0x460f91&&_0x460f91[_0x8899('0x5f')]){logger[_0x8899('0x20')]('['+_0x28b40e['lastevent'][_0x8899('0x7b')]()+']',_0x8899('0x61'));_0x28b40e[_0x8899('0x62')]=util['format'](_0x8899('0x63'),_0x31e605[_0x8899('0x5d')],_0x28b40e['uniqueid'],md5(_0x28b40e[_0x8899('0x64')]));}else{_0x28b40e[_0x8899('0x62')]='';}return getConnection(_0x31e605)[_0x8899('0x2c')](function(_0x1b7ea5){_0x20b67a=_0x1b7ea5;if(!_['isNil'](_0x5957e7)){return getUser(_0x31e605,_0x5957e7['name'],_0x20b67a);}else{return getUser(_0x31e605,null,_0x20b67a);}})[_0x8899('0x2c')](function(_0xebd821){_0x3c9b4a=_0xebd821;return getEndUser(_0x31e605,_0x5449ef,_0x28b40e['calleridname'],_0x28b40e['calleridnum'],_0x20b67a);})['then'](function(_0xd08c5d){_0x2d00a7=_0xd08c5d;return getTicket(_0x31e605,_0x3c9b4a,_0x2d00a7,_0x5449ef,_0x28b40e,_0x5449ef[_0x8899('0x78')],_0x20b67a);})[_0x8899('0x2c')](function(_0x3ae5b4){_0x2b3f7b=_0x3ae5b4;logger[_0x8899('0x20')]('['+_0x28b40e['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x2b3f7b['id']);logger[_0x8899('0x20')]('['+_0x28b40e[_0x8899('0x7c')][_0x8899('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x31e605['type']);})['catch'](function(_0x455a69){logger['error']('['+_0x28b40e[_0x8899('0x7c')][_0x8899('0x7b')]()+']',_0x455a69);});}; \ No newline at end of file +var _0x3330=['LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','toString','variableName','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','lastevent','isNil','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','endUserType','contact','WhoId','WhatId','ContactId','account','AccountId','lead','leadId','info','sobject','create','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','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'];(function(_0x40e4c4,_0x225995){var _0x4667f9=function(_0x19e483){while(--_0x19e483){_0x40e4c4['push'](_0x40e4c4['shift']());}};_0x4667f9(++_0x225995);}(_0x3330,0x136));var _0x0333=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3330[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0333('0x0'));var rp=require(_0x0333('0x1'));var moment=require(_0x0333('0x2'));var BPromise=require(_0x0333('0x3'));var md5=require('md5');var jsforce=require(_0x0333('0x4'));var util=require(_0x0333('0x5'));var Redis=require('ioredis');var intUtil=require(_0x0333('0x6'));var config=require('../../../../config/environment');var logger=require(_0x0333('0x7'))(_0x0333('0x8'));config[_0x0333('0x9')]=_[_0x0333('0xa')](config[_0x0333('0x9')],{'host':_0x0333('0xb'),'port':0x18eb});var io=require(_0x0333('0xc'))(new Redis(config[_0x0333('0x9')]));function emit(_0x4d34e2,_0x2eb9ca,_0x236f64){io['to'](_0x4d34e2)['emit'](_0x2eb9ca,_0x236f64);}function getTicket(_0x3d31fb,_0x182816,_0x2b53d4,_0x154a16,_0x13f62c,_0x3a8fe7,_0x822a85,_0x5313d8){var _0x5f465f=Object['assign']({},{'OwnerId':_0x182816['id'],'Subject':intUtil[_0x0333('0xd')](_0x154a16[_0x0333('0xe')],_0x13f62c,'\x20'),'Description':intUtil[_0x0333('0xd')](_0x154a16[_0x0333('0xf')],_0x13f62c,'\x0a')},getCustomFields(_0x3a8fe7,_0x13f62c));if(_0x2b53d4){if(_0x154a16[_0x0333('0x10')]===_0x0333('0x11')){_0x5f465f[_0x0333('0x12')]=moment[_0x0333('0x13')]();_0x5f465f['IsReminderSet']=![];_0x5f465f['IsRecurrence']=![];if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x15')||_0x2b53d4['endUserType']==='lead'){_0x5f465f[_0x0333('0x16')]=_0x2b53d4['id'];}else if(_0x2b53d4['endUserType']==='account'){_0x5f465f[_0x0333('0x17')]=_0x2b53d4['id'];}}else if(_0x154a16['ticketType']==='Case'){if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x15')){_0x5f465f[_0x0333('0x18')]=_0x2b53d4['id'];}else if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x19')){_0x5f465f[_0x0333('0x1a')]=_0x2b53d4['id'];}else if(_0x2b53d4[_0x0333('0x14')]===_0x0333('0x1b')&&_0x154a16[_0x0333('0x1c')]){_0x5f465f[_0x154a16[_0x0333('0x1c')]]=_0x2b53d4['id'];}else{logger[_0x0333('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x822a85[_0x0333('0x1e')](_0x154a16[_0x0333('0x10')])[_0x0333('0x1f')](_0x5f465f);}function getUser(_0x4cba9e,_0xd97ce4,_0x4586e8){if(!_['isNil'](_0xd97ce4)&&intUtil['validateEmail'](_0xd97ce4)){var _0x3623ea={'Email':_0xd97ce4};var _0xbe239f={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4586e8[_0x0333('0x1e')](_0x0333('0x20'))[_0x0333('0x21')](_0x3623ea,_0xbe239f)[_0x0333('0x22')]()[_0x0333('0x23')](function(_0x177a93){if(_0x177a93[_0x0333('0x24')]){var _0x526290=_[_0x0333('0x21')](_0x177a93,function(_0x555e46){return _0x555e46[_0x0333('0x25')]===_0xd97ce4;});if(_0x526290){logger[_0x0333('0x1d')](_0x0333('0x26'),_0xd97ce4);return BPromise[_0x0333('0x27')]({'id':_0x526290['Id'],'name':_0x526290[_0x0333('0x28')]});}}else{logger[_0x0333('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd97ce4);return _0x4586e8[_0x0333('0x29')]()[_0x0333('0x23')](function(_0x4bce7f){return BPromise[_0x0333('0x27')]({'id':_0x4bce7f['user_id'],'name':_0x4bce7f[_0x0333('0x2a')]});});}});}else{logger[_0x0333('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xd97ce4);return _0x4586e8['identity']()['then'](function(_0x3c0dae){return BPromise[_0x0333('0x27')]({'id':_0x3c0dae[_0x0333('0x2b')],'name':_0x3c0dae[_0x0333('0x2a')]});});}}function getEndUser(_0x4524c3,_0xd705c8,_0x159cbb,_0xe4705a,_0x4a6cdd){var _0xd20d62={'$or':{'Phone':_0xe4705a}};var _0x19fd4f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0x0333('0x2c'),_0xe4705a,_0xd705c8[_0x0333('0x2d')]);switch(_0xd705c8[_0x0333('0x2d')]){case _0x0333('0x2e'):var _0x4201bd=_['cloneDeep'](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x2f')]]=_0xe4705a;_[_0x0333('0x30')](_0x4201bd['$or'],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')]('Contact')[_0x0333('0x21')](_0x4201bd,_0x19fd4f)[_0x0333('0x22')]()[_0x0333('0x23')](function(_0x3a9252){if(_0x3a9252&&_0x3a9252[_0x0333('0x24')]){return _0x3a9252;}else{var _0x4f9561=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x3f8e8f={};_0x3f8e8f[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_['merge'](_0x4f9561[_0x0333('0x33')],_0x3f8e8f);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x34'))['find'](_0x4f9561,_0x19fd4f);}});case _0x0333('0x35'):var _0xbcccce=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8['additionalSearchAccount']){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x36')]]=_0xe4705a;_[_0x0333('0x30')](_0xbcccce[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x37'))[_0x0333('0x21')](_0xbcccce,_0x19fd4f)['execute']()[_0x0333('0x23')](function(_0x65777f){if(_0x65777f&&_0x65777f[_0x0333('0x24')]){return _0x65777f;}else{var _0x119775=_['cloneDeep'](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x5dbb02={};_0x5dbb02[_0xd705c8['additionalSearchContact']]=_0xe4705a;_[_0x0333('0x30')](_0x119775[_0x0333('0x33')],_0x5dbb02);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x38'))[_0x0333('0x21')](_0x119775,_0x19fd4f)[_0x0333('0x23')](function(_0x227bee){if(_0x227bee&&_0x227bee['length']){return _0x227bee;}else{var _0x2c3f32=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x1c33df={};_0x1c33df[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_[_0x0333('0x30')](_0x2c3f32[_0x0333('0x33')],_0x1c33df);}return _0x4a6cdd['sobject'](_0x0333('0x34'))[_0x0333('0x21')](_0x2c3f32,_0x19fd4f);}});}});case _0x0333('0x15'):var _0x4201bd=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x2f')]){var _0x27f69c={};_0x27f69c[_0xd705c8['additionalSearchContact']]=_0xe4705a;_[_0x0333('0x30')](_0x4201bd[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x38'))[_0x0333('0x21')](_0x4201bd,_0x19fd4f)[_0x0333('0x22')]();case _0x0333('0x1b'):var _0x33537e=_[_0x0333('0x31')](_0xd20d62);if(_0xd705c8[_0x0333('0x32')]){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x32')]]=_0xe4705a;_[_0x0333('0x30')](_0x33537e[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')]('Lead')[_0x0333('0x21')](_0x33537e,_0x19fd4f);case _0x0333('0x19'):var _0xbcccce=_['cloneDeep'](_0xd20d62);if(_0xd705c8['additionalSearchAccount']){var _0x27f69c={};_0x27f69c[_0xd705c8[_0x0333('0x36')]]=_0xe4705a;_[_0x0333('0x30')](_0xbcccce[_0x0333('0x33')],_0x27f69c);}return _0x4a6cdd[_0x0333('0x1e')](_0x0333('0x37'))[_0x0333('0x21')](_0xbcccce,_0x19fd4f);default:return null;}})[_0x0333('0x23')](function(_0x5c1a51){if(_0x5c1a51&&_0x5c1a51['length']){var _0xfc42ca=_[_0x0333('0x39')](_0x5c1a51);if(_0xfc42ca){return BPromise[_0x0333('0x27')]({'id':_0xfc42ca['Id'],'name':_0xfc42ca['Name'],'phone':_0xfc42ca[_0x0333('0x3a')],'endUserType':_0xfc42ca['attributes'][_0x0333('0x3b')][_0x0333('0x3c')]()});}}})['then'](function(_0x5bd511){if(_0x5bd511){logger['info'](_0x0333('0x3d'),_0x5bd511[_0x0333('0x14')],_0xe4705a);return BPromise[_0x0333('0x27')](_0x5bd511);}else{logger[_0x0333('0x1d')](_0x0333('0x3e'),_0xe4705a);var _0x1db440={'Phone':_0xe4705a};if(_0xd705c8['moduleCreate']){if(_0xd705c8['moduleCreate']===_0x0333('0x15')){logger[_0x0333('0x1d')](_0x0333('0x3f'),_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440[_0x0333('0x41')]=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util[_0x0333('0x43')](_0x0333('0x44'),_0xe4705a);}else if(_0xd705c8['moduleCreate']===_0x0333('0x1b')){logger[_0x0333('0x1d')](_0x0333('0x3f'),_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440[_0x0333('0x41')]=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util[_0x0333('0x43')](_0x0333('0x44'),_0xe4705a);_0x1db440[_0x0333('0x45')]=_0x0333('0x46');}else if(_0xd705c8[_0x0333('0x40')]===_0x0333('0x19')){logger[_0x0333('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xe4705a,_0xd705c8[_0x0333('0x40')]);_0x1db440['Name']=_0x159cbb!==_0x0333('0x42')?_0x159cbb:util['format'](_0x0333('0x44'),_0xe4705a);}else{return null;}}return _0x4a6cdd[_0x0333('0x1e')](_[_0x0333('0x47')](_0xd705c8[_0x0333('0x40')]))[_0x0333('0x1f')](_0x1db440)[_0x0333('0x23')](function(_0x2f6103){return BPromise['resolve']({'id':_0x2f6103['id'],'endUserType':_0xd705c8[_0x0333('0x40')]});});}});}function getCustomFields(_0x2799f9,_0x58acfa){var _0x28934f={};if(_0x2799f9[_0x0333('0x24')]>0x0){_[_0x0333('0x48')](_0x2799f9,function(_0x2012fa){if(_[_0x0333('0x49')](['string',_0x0333('0x4a')],_0x2012fa['type'])&&_0x2012fa[_0x0333('0x4b')]){_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x2012fa[_0x0333('0x4c')][_0x0333('0x4d')]();}else if(_0x2012fa[_0x0333('0x3b')]==='variable'&&_0x2012fa[_0x0333('0x4e')]&&_0x2012fa[_0x0333('0x4b')]){_0x58acfa[_0x2012fa[_0x0333('0x4e')]]&&(_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x58acfa[_0x2012fa[_0x0333('0x4e')]][_0x0333('0x4d')]());}else if(_0x2012fa[_0x0333('0x3b')]==='customVariable'&&_0x2012fa['Variable']&&_0x2012fa[_0x0333('0x4f')][_0x0333('0x50')]&&_0x2012fa['idField']){_0x58acfa[_0x2012fa['Variable'][_0x0333('0x50')]['toLowerCase']()]&&(_0x28934f[_0x2012fa[_0x0333('0x4b')]]=_0x58acfa[_0x2012fa['Variable']['name'][_0x0333('0x3c')]()]['toString']());}});}return _0x28934f;}function getConnection(_0x2c84d9){var _0x454e93=_0x2c84d9[_0x0333('0x51')]['concat'](_0x2c84d9[_0x0333('0x52')]);var _0x55822a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2c84d9[_0x0333('0x53')]||_0x0333('0x54'),'clientId':_0x2c84d9[_0x0333('0x55')],'clientSecret':_0x2c84d9[_0x0333('0x56')]}});return _0x55822a['login'](_0x2c84d9[_0x0333('0x57')],_0x454e93)[_0x0333('0x23')](function(){logger[_0x0333('0x1d')](_0x0333('0x58'));return _0x55822a;});}exports[_0x0333('0x59')]=function(_0x53e4cd,_0x2b2931,_0x591040,_0x2eae36,_0x549368,_0x565690){var _0x217a53,_0x3a8884,_0x1e596f,_0x3c1a05;_0x565690['serverUrl']=intUtil['stripTrailingSlash'](_0x565690[_0x0333('0x5a')]);_0x565690[_0x0333('0x53')]=intUtil[_0x0333('0x5b')](_0x565690[_0x0333('0x53')]);if(_0x549368&&_0x549368[_0x0333('0x5c')]){logger['info'](_0x0333('0x5d'),_0x0333('0x5e'));_0x2b2931[_0x0333('0x5f')]=util['format'](_0x0333('0x60'),_0x565690[_0x0333('0x5a')],_0x2b2931[_0x0333('0x61')],md5(_0x2b2931[_0x0333('0x61')]));}else{_0x2b2931[_0x0333('0x5f')]='';}return getConnection(_0x565690)[_0x0333('0x23')](function(_0x18a9f3){_0x3c1a05=_0x18a9f3;return getUser(_0x565690,_0x2eae36[_0x0333('0x62')],_0x3c1a05);})[_0x0333('0x23')](function(_0x4feef0){_0x217a53=_0x4feef0;return getEndUser(_0x565690,_0x591040,_0x2b2931[_0x0333('0x63')],_0x2b2931['calleridnum'],_0x3c1a05);})['then'](function(_0x1322ad){_0x3a8884=_0x1322ad;return getTicket(_0x565690,_0x217a53,_0x3a8884,_0x591040,_0x2b2931,_0x591040[_0x0333('0x64')],_0x3c1a05,_0x0333('0x59'));})['then'](function(_0x2b4e58){_0x1e596f=_0x2b4e58;logger[_0x0333('0x1d')](_0x0333('0x65'),_0x1e596f['id']);logger[_0x0333('0x1d')](_0x0333('0x66'),_0x1e596f['id'],_0x2eae36[_0x0333('0x50')],_0x565690['type']);switch(_0x565690[_0x0333('0x3b')]){case _0x0333('0x67'):emit(util[_0x0333('0x43')](_0x0333('0x68'),_0x2eae36[_0x0333('0x50')]),'trigger:salesforce:display',{'recordId':_0x1e596f['id']});break;case'newTab':emit(util['format'](_0x0333('0x68'),_0x2eae36[_0x0333('0x50')]),'trigger:browser:url',{'uri':util['format'](_0x0333('0x69'),_0x3c1a05['instanceUrl'],_0x1e596f['id'])});break;default:logger[_0x0333('0x6a')](_0x0333('0x6b'));}})['catch'](function(_0x1118db){logger[_0x0333('0x6a')]('[QUEUE]',_0x1118db);});};exports[_0x0333('0x6c')]=function(_0x4938f3,_0x39945a,_0xab1e03,_0x3ebc50,_0x1f9bbf,_0x596e80,_0x3d0942){var _0x5368b6,_0x490bcc,_0x2dfc26,_0x4c458f;_0x596e80['serverUrl']=intUtil[_0x0333('0x5b')](_0x596e80[_0x0333('0x5a')]);_0x596e80[_0x0333('0x53')]=intUtil['stripTrailingSlash'](_0x596e80[_0x0333('0x53')]);if(_0x3d0942&&_0x3d0942['recordingFormat']&&_0x3d0942[_0x0333('0x6d')]!==_0x0333('0x6e')){logger[_0x0333('0x1d')](_0x0333('0x6f'),_0x0333('0x5e'));_0x39945a[_0x0333('0x5f')]=util['format'](_0x0333('0x60'),_0x596e80[_0x0333('0x5a')],_0x39945a['uniqueid'],md5(_0x39945a['uniqueid']));}return getConnection(_0x596e80)[_0x0333('0x23')](function(_0xb02347){_0x4c458f=_0xb02347;return getUser(_0x596e80,_0x3ebc50[_0x0333('0x62')],_0x4c458f);})[_0x0333('0x23')](function(_0x5c589d){_0x5368b6=_0x5c589d;return getEndUser(_0x596e80,_0xab1e03,_0x39945a[_0x0333('0x70')],_0x39945a[_0x0333('0x71')],_0x4c458f);})[_0x0333('0x23')](function(_0x1129e4){_0x490bcc=_0x1129e4;return getTicket(_0x596e80,_0x5368b6,_0x490bcc,_0xab1e03,_0x39945a,_0xab1e03['Fields'],_0x4c458f,_0x0333('0x6c'));})['then'](function(_0x6a1324){_0x2dfc26=_0x6a1324;logger['info'](_0x0333('0x72'),_0x2dfc26['id']);logger[_0x0333('0x1d')](_0x0333('0x73'),_0x2dfc26['id'],_0x3ebc50['name'],_0x596e80[_0x0333('0x3b')]);switch(_0x596e80[_0x0333('0x3b')]){case _0x0333('0x67'):emit(util[_0x0333('0x43')](_0x0333('0x68'),_0x3ebc50['name']),'trigger:salesforce:display',{'recordId':_0x2dfc26['id']});break;case'newTab':emit(util[_0x0333('0x43')]('user:%s',_0x3ebc50[_0x0333('0x50')]),'trigger:browser:url',{'uri':util['format'](_0x0333('0x69'),_0x4c458f[_0x0333('0x74')],_0x2dfc26['id'])});break;default:logger[_0x0333('0x6a')](_0x0333('0x6f'),_0x0333('0x75'));}})[_0x0333('0x76')](function(_0x567460){logger['error']('[OUTBOUND]',_0x567460);});};exports['unmanaged']=function(_0x237c11,_0x4f3c4d,_0x39e1cf,_0x4f17b5,_0x32e814,_0x5d34f2){var _0x19ecdb,_0x90ecfe,_0x111f40,_0x13ba83;_0x5d34f2['serverUrl']=intUtil[_0x0333('0x5b')](_0x5d34f2[_0x0333('0x5a')]);_0x5d34f2[_0x0333('0x53')]=intUtil[_0x0333('0x5b')](_0x5d34f2[_0x0333('0x53')]);if(_0x32e814&&_0x32e814['monitor_format']){logger[_0x0333('0x1d')]('['+_0x4f3c4d[_0x0333('0x77')]['toUpperCase']()+']',_0x0333('0x5e'));_0x4f3c4d[_0x0333('0x5f')]=util[_0x0333('0x43')](_0x0333('0x60'),_0x5d34f2[_0x0333('0x5a')],_0x4f3c4d[_0x0333('0x61')],md5(_0x4f3c4d[_0x0333('0x61')]));}else{_0x4f3c4d[_0x0333('0x5f')]='';}return getConnection(_0x5d34f2)['then'](function(_0x4d313a){_0x13ba83=_0x4d313a;if(!_[_0x0333('0x78')](_0x4f17b5)){return getUser(_0x5d34f2,_0x4f17b5['name'],_0x13ba83);}else{return getUser(_0x5d34f2,null,_0x13ba83);}})[_0x0333('0x23')](function(_0x29dfd0){_0x19ecdb=_0x29dfd0;return getEndUser(_0x5d34f2,_0x39e1cf,_0x4f3c4d[_0x0333('0x63')],_0x4f3c4d[_0x0333('0x79')],_0x13ba83);})[_0x0333('0x23')](function(_0x217f9d){_0x90ecfe=_0x217f9d;return getTicket(_0x5d34f2,_0x19ecdb,_0x90ecfe,_0x39e1cf,_0x4f3c4d,_0x39e1cf[_0x0333('0x64')],_0x13ba83);})[_0x0333('0x23')](function(_0x45cf85){_0x111f40=_0x45cf85;logger[_0x0333('0x1d')]('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+_0x0333('0x7b'),_0x111f40['id']);logger['info']('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+_0x0333('0x7c'),_0x5d34f2[_0x0333('0x3b')]);})[_0x0333('0x76')](function(_0x3170d1){logger['error']('['+_0x4f3c4d[_0x0333('0x77')][_0x0333('0x7a')]()+']',_0x3170d1);});}; \ 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 058c869..b9688f8 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 _0x2590=['bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','length','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','sys_user?','user','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','toLowerCase','toString','customField','content','variable','variableName','idField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x2590,0x1af));var _0x0259=function(_0x34774f,_0x455055){_0x34774f=_0x34774f-0x0;var _0x2c084f=_0x2590[_0x34774f];return _0x2c084f;};'use strict';var _=require(_0x0259('0x0'));var Promise=require(_0x0259('0x1'));var rp=require(_0x0259('0x2'));var util=require(_0x0259('0x3'));var md5=require(_0x0259('0x4'));var Redis=require(_0x0259('0x5'));var intUtil=require(_0x0259('0x6'));var config=require(_0x0259('0x7'));var logger=require(_0x0259('0x8'))(_0x0259('0x9'));config[_0x0259('0xa')]=_['defaults'](config[_0x0259('0xa')],{'host':_0x0259('0xb'),'port':0x18eb});var io=require(_0x0259('0xc'))(new Redis(config[_0x0259('0xa')]));function getAdminUser(_0x53b6cd,_0x2999ca,_0x1b9528,_0xdcbde1,_0x19f4b9,_0xb4e877){return new Promise(function(_0xe867cc,_0x5606f3){var _0x433e8c={'method':_0x0259('0xd'),'uri':_0xdcbde1+_0x0259('0xe')+'&'+_0x19f4b9+'&'+_0xb4e877,'auth':_0x2999ca,'json':!![]};return rp(_0x433e8c)[_0x0259('0xf')](function(_0x2f9a02){if(_0x2f9a02[_0x0259('0x10')]['length']>0x0){_0x1b9528[_0x0259('0x11')]=_0x2f9a02['result'][0x0][_0x0259('0x12')];}logger['info']('['+[_0x53b6cd[_0x0259('0x13')]()]+_0x0259('0x14'),_0x1b9528);_0xe867cc(_0x1b9528);})[_0x0259('0x15')](function(_0x50b4d9){logger[_0x0259('0x16')]('['+[_0x53b6cd[_0x0259('0x13')]()]+']',_0x50b4d9[_0x0259('0x17')]);_0x5606f3(_0x50b4d9[_0x0259('0x17')]);});});}function getUser(_0xe599a9,_0xd54bf6,_0x818068,_0x2ee959,_0x430ce2){return function(_0x337f91){logger['info']('['+[_0xe599a9[_0x0259('0x13')]()]+_0x0259('0x18'),_0x337f91);return new Promise(function(_0x56a593,_0x245d65){if(intUtil[_0x0259('0x19')](_0x337f91[_0x0259('0x1a')])){var _0x1740e1={'method':_0x0259('0xd'),'uri':_0x818068+_0x0259('0x1b')+_0x337f91[_0x0259('0x1a')]+'&'+_0x2ee959+'&'+_0x430ce2,'auth':_0xd54bf6,'json':!![]};logger[_0x0259('0x1c')]('['+[_0xe599a9['toUpperCase']()]+_0x0259('0x1d'),_0x1740e1);return rp(_0x1740e1)[_0x0259('0xf')](function(_0x6eddfa){logger[_0x0259('0x1c')]('['+[_0xe599a9['toUpperCase']()]+'],\x20getUser\x20entity',_0x6eddfa);if(_0x6eddfa[_0x0259('0x10')][_0x0259('0x1e')]>0x0&&String(_0x6eddfa['result'][0x0]['active'])===_0x0259('0x1f')){_0x337f91[_0x0259('0x20')]=_0x6eddfa[_0x0259('0x10')][0x0][_0x0259('0x12')];}else{_0x337f91['userId']=_0x337f91[_0x0259('0x11')];_0x337f91[_0x0259('0x1a')]=_0x337f91[_0x0259('0x21')];}logger['info']('['+[_0xe599a9['toUpperCase']()]+_0x0259('0x22'),_0x337f91);_0x56a593(_0x337f91);})[_0x0259('0x15')](function(_0x166e38){logger[_0x0259('0x16')]('['+[_0xe599a9[_0x0259('0x13')]()]+']',_0x166e38[_0x0259('0x17')]);_0x245d65(_0x166e38[_0x0259('0x17')]);});}else{logger[_0x0259('0x1c')]('['+[_0xe599a9[_0x0259('0x13')]()]+']\x20using\x20admin\x20profile');_0x337f91[_0x0259('0x20')]=_0x337f91[_0x0259('0x11')];_0x337f91[_0x0259('0x1a')]=_0x337f91[_0x0259('0x21')];_0x56a593(_0x337f91);}});};}function createEndUser(_0x195abb,_0x4a92c4,_0x154628,_0x3ef2d9,_0x58418d){logger[_0x0259('0x1c')]('['+[_0x195abb[_0x0259('0x13')]()]+_0x0259('0x23'),_0x154628);return new Promise(function(_0x3fb5bc,_0x1bd6c7){var _0x5ac506={'method':'POST','uri':_0x3ef2d9+_0x0259('0x24')+_0x58418d,'body':{'user_name':_0x154628['endUserNumber'],'roles':_0x0259('0x25'),'first_name':_0x154628[_0x0259('0x26')],'active':'true','date_format':_0x0259('0x27'),'phone':_0x154628[_0x0259('0x26')]},'auth':_0x4a92c4,'json':!![]};return rp(_0x5ac506)['then'](function(_0x21e610){logger[_0x0259('0x1c')]('['+[_0x195abb[_0x0259('0x13')]()]+'],\x20EndUser\x20schema',_0x21e610[_0x0259('0x10')]);_0x154628['endUserId']=_0x21e610[_0x0259('0x10')]['sys_id'];_0x3fb5bc(_0x154628);})[_0x0259('0x15')](function(_0x38148c){logger[_0x0259('0x16')]('['+[_0x195abb[_0x0259('0x13')]()]+']',_0x38148c[_0x0259('0x17')]);_0x1bd6c7(_0x38148c[_0x0259('0x17')]);});});}function getEndUser(_0x4de17b,_0x357185,_0x1b5302,_0xd58a7b,_0x456596){return function(_0x379420){logger[_0x0259('0x1c')]('['+[_0x4de17b[_0x0259('0x13')]()]+_0x0259('0x28'),_0x379420);return new Promise(function(_0x4bdd5a,_0x50626c){var _0x2dd28d={'method':_0x0259('0xd'),'uri':_0x1b5302+_0x0259('0x29')+_0x379420[_0x0259('0x26')]+'&'+_0xd58a7b+'&'+_0x456596,'auth':_0x357185,'json':!![]};return rp(_0x2dd28d)[_0x0259('0xf')](function(_0x16351d){if(_0x16351d[_0x0259('0x10')]['length']>0x0){_0x379420[_0x0259('0x2a')]=_0x16351d[_0x0259('0x10')][0x0][_0x0259('0x12')];logger[_0x0259('0x1c')]('['+[_0x4de17b[_0x0259('0x13')]()]+_0x0259('0x2b'),_0x379420);_0x4bdd5a(_0x379420);}else{return createEndUser(_0x4de17b,_0x357185,_0x379420,_0x1b5302,_0xd58a7b)['then'](function(_0x957b20){logger[_0x0259('0x1c')]('['+[_0x4de17b[_0x0259('0x13')]()]+'],\x20createEndUser\x20crm',_0x957b20);_0x4bdd5a(_0x957b20);});}})[_0x0259('0x15')](function(_0x2c7058){logger[_0x0259('0x16')]('['+[_0x4de17b[_0x0259('0x13')]()]+']',_0x2c7058[_0x0259('0x17')]);_0x50626c(_0x2c7058['message']);});});};}function getCustomFields(_0x22f952,_0x58a09e){var _0x15222c={};if(_0x22f952[_0x0259('0x1e')]>0x0){_[_0x0259('0x2c')](_0x22f952,function(_0x586742){if(_[_0x0259('0x2d')]([_0x0259('0x2e'),_0x0259('0x2f')],_0x586742[_0x0259('0x30')])&&_0x586742[_0x0259('0x31')]&&!_0x586742['customField']){_0x15222c[_0x586742[_0x0259('0x31')][_0x0259('0x32')]()]=_0x586742['content'][_0x0259('0x33')]();}else if(_[_0x0259('0x2d')]([_0x0259('0x2e'),_0x0259('0x2f')],_0x586742[_0x0259('0x30')])&&_0x586742['idField']&&_0x586742[_0x0259('0x34')]){_0x15222c[_0x586742['idField'][_0x0259('0x32')]()]=_0x586742[_0x0259('0x35')][_0x0259('0x33')]();}else if(_0x586742[_0x0259('0x30')]===_0x0259('0x36')&&_0x586742[_0x0259('0x37')]&&_0x586742[_0x0259('0x38')]&&_0x586742[_0x0259('0x34')]){_0x15222c[_0x586742[_0x0259('0x38')][_0x0259('0x32')]()]=_0x58a09e[_0x586742[_0x0259('0x37')]][_0x0259('0x33')]();}else if(_0x586742['type']==='customVariable'&&_0x586742[_0x0259('0x39')]&&_0x586742[_0x0259('0x39')]['name']&&_0x586742[_0x0259('0x38')]&&_0x586742[_0x0259('0x34')]){_0x15222c[_0x586742[_0x0259('0x38')]['toLowerCase']()]=_0x58a09e[_0x586742[_0x0259('0x39')][_0x0259('0x3a')][_0x0259('0x32')]()][_0x0259('0x33')]();}});}return _0x15222c;}function getTicket(_0x5805c7,_0xd8531c,_0x33500e,_0x5e8cb4,_0x383b95,_0x2455d7){return function(_0x27b40b){logger[_0x0259('0x1c')]('['+[_0x5805c7[_0x0259('0x13')]()]+_0x0259('0x3b'),_0x27b40b);return new Promise(function(_0x37bed3,_0x16f4fa){var _0x5d2308=_0x5805c7[_0x0259('0x32')]()===_0x0259('0x3c')?_0x27b40b[_0x0259('0x20')]:_0x27b40b[_0x0259('0x2a')];var _0x22e958={'method':_0x0259('0x3d'),'uri':_0x33500e+_0x0259('0x3e')+'?'+_0x2455d7,'body':Object['assign']({},{'active':_0x0259('0x1f'),'caller_id':_0x5d2308,'assigned_to':_0x27b40b[_0x0259('0x20')],'short_description':intUtil[_0x0259('0x3f')](_0x5e8cb4[_0x0259('0x40')],_0x383b95,'\x20'),'description':intUtil[_0x0259('0x3f')](_0x5e8cb4['Descriptions'],_0x383b95,'\x0a')},getCustomFields(_0x5e8cb4[_0x0259('0x41')],_0x383b95)),'auth':_0xd8531c,'json':!![]};return rp(_0x22e958)[_0x0259('0xf')](function(_0x2ddc68){logger[_0x0259('0x1c')]('['+[_0x5805c7[_0x0259('0x13')]()]+_0x0259('0x42'),_0x2ddc68[_0x0259('0x10')]);_0x27b40b['ticketId']=_0x2ddc68['result'][_0x0259('0x12')];_0x27b40b[_0x0259('0x43')]=_0x2ddc68[_0x0259('0x10')][_0x0259('0x44')];logger[_0x0259('0x1c')]('['+[_0x5805c7[_0x0259('0x13')]()]+_0x0259('0x45'),_0x27b40b);_0x37bed3(_0x27b40b);})[_0x0259('0x15')](function(_0x1c239c){logger['error']('['+[_0x5805c7[_0x0259('0x13')]()]+']',_0x1c239c[_0x0259('0x17')]);_0x16f4fa(_0x1c239c['message']);});});};}function createRemoteTag(_0x22b235,_0x51957e,_0x24f7b2,_0x4463c9){return new Promise(function(_0x142659,_0x29b758){var _0x795d9b={'method':_0x0259('0x3d'),'uri':_0x24f7b2+_0x0259('0x46')+'?'+_0x4463c9,'body':{'short_description':_0x22b235,'global':!![],'active':!![],'name':_0x22b235},'auth':_0x51957e,'json':!![]};return rp(_0x795d9b)[_0x0259('0xf')](function(_0x35719b){var _0x998e1f=_0x35719b[_0x0259('0x10')][_0x0259('0x12')];_0x142659(_0x998e1f);});});}function getRemoteTag(_0x687e5c,_0x1e3d77,_0x174cc0,_0xc21a47,_0x3961f2){return new Promise(function(_0x429f27,_0x3b13a6){var _0x4848ac={'method':_0x0259('0xd'),'uri':_0x174cc0+_0x0259('0x46')+_0x0259('0x47')+_0x687e5c+'&'+_0xc21a47,'auth':_0x1e3d77,'json':!![]};return rp(_0x4848ac)['then'](function(_0x5e074e){if(_0x5e074e[_0x0259('0x10')]['length']>0x0){var _0x4218ba=_0x5e074e[_0x0259('0x10')][0x0][_0x0259('0x12')];_0x429f27(_0x4218ba);}else{return createRemoteTag(_0x687e5c,_0x1e3d77,_0x174cc0,_0xc21a47)[_0x0259('0xf')](function(_0x3debbb){_0x429f27(_0x3debbb);});}});});}function assignTagToIncident(_0x556cc5,_0x2d18a9,_0x4eb5c6,_0x17613f,_0x5aaf96){return new Promise(function(_0x5ced01,_0xc710c2){var _0x190fe3={'method':_0x0259('0x3d'),'uri':_0x4eb5c6+_0x0259('0x48')+'?'+_0x5aaf96,'body':{'label':_0x556cc5,'table':'incident','id_type':_0x0259('0x49'),'table_key':_0x17613f['ticketId'],'title':_0x0259('0x4a')+_0x17613f[_0x0259('0x43')],'id_display':_0x17613f[_0x0259('0x43')]},'auth':_0x2d18a9,'json':!![]};return rp(_0x190fe3)['then'](function(_0x365cb6){_0x5ced01();})[_0x0259('0x15')](function(){_0x5ced01();});});}function manageTags(_0x217dbf,_0x214860,_0x37b215,_0x5d9b77,_0x36ded1,_0x21ecf5,_0x4c1129){return new Promise(function(_0x1e5113,_0x5efeab){var _0x59523a=[];_0x214860[_0x0259('0x2c')](function(_0xce6d1b){_0x59523a[_0x0259('0x4b')](getRemoteTag(_0xce6d1b,_0x37b215,_0x5d9b77,_0x21ecf5,_0x4c1129));});return Promise['all'](_0x59523a)[_0x0259('0xf')](function(_0x221664){if(_0x221664[_0x0259('0x1e')]){logger['info']('['+[_0x217dbf[_0x0259('0x13')]()]+_0x0259('0x4c'),_0x221664);var _0x181e33=[];_0x221664[_0x0259('0x2c')](function(_0xeda209){_0x181e33[_0x0259('0x4b')](assignTagToIncident(_0xeda209,_0x37b215,_0x5d9b77,_0x36ded1,_0x21ecf5));});return Promise[_0x0259('0x4d')](_0x181e33)[_0x0259('0xf')](function(){_0x1e5113();})['catch'](function(){_0x1e5113();});}else{_0x1e5113();}});});}function getTags(_0x3d9d77,_0x491e2a,_0x30fabf,_0x2762ec,_0xb82709,_0x2d4785){return function(_0x309117){return new Promise(function(_0x832de8,_0x324316){var _0x94ceb9=[];var _0x51e812=_0x2762ec[_0x0259('0x4e')];if(_0x51e812&&_0x51e812[_0x0259('0x1e')]>0x0){_0x94ceb9=_['map'](_0x51e812,_0x0259('0x3a'));}if(_0x94ceb9[_0x0259('0x1e')]>0x0){return manageTags(_0x3d9d77,_0x94ceb9,_0x491e2a,_0x30fabf,_0x309117,_0xb82709,_0x2d4785)['then'](function(){_0x832de8(_0x309117);});}else{_0x832de8(_0x309117);}});};}function emit(_0x5d74ec,_0x3e923c,_0x3e6fdb){var _0x1be20b=_0x0259('0x4f')+_0x0259('0x50')+_0x0259('0x51')+'%255EORDERBYDESCnumber';var _0x5c2c4d={'uri':_0x5d74ec+_0x0259('0x52')+_0x3e6fdb+_0x1be20b};io['to'](util[_0x0259('0x53')](_0x0259('0x54'),_0x3e923c))[_0x0259('0x55')]('trigger:browser:url',_0x5c2c4d);}exports['cs']=function(_0x12ed15,_0x5a1316,_0x3689ab,_0x47eca1,_0x126dda,_0x1c3c59,_0x1547a0,_0x107a25){var _0xfe1d1d={};var _0x2fe8ae={'user':_0x1c3c59[_0x0259('0x56')],'pass':_0x1c3c59[_0x0259('0x57')]};var _0x129d7b=_0x0259('0x58');var _0x2fdef6='sysparm_display_value=true';_0x1c3c59[_0x0259('0x59')]=intUtil[_0x0259('0x5a')](_0x1c3c59[_0x0259('0x59')]);_0x1c3c59[_0x0259('0x5b')]=intUtil[_0x0259('0x5a')](_0x1c3c59[_0x0259('0x5b')]);var _0x586070=util[_0x0259('0x53')]('%s/api/now/table/',_0x1c3c59['remoteUri']);_0xfe1d1d['userEmail']=!_[_0x0259('0x5c')](_0x47eca1)?_0x47eca1['email']:null;_0xfe1d1d[_0x0259('0x21')]=_0x1c3c59[_0x0259('0x5d')];_0xfe1d1d[_0x0259('0x26')]=_0x107a25[_0x0259('0x32')]()===_0x0259('0x3c')?_0x5a1316[_0x0259('0x5e')]:_0x5a1316['calleridnum'];_0xfe1d1d[_0x0259('0x5f')]=_0x107a25===_0x0259('0x60')||_0x107a25===_0x0259('0x61')?'queue':_0x0259('0x3c');var _0x36302c=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c3c59['serverUrl'],_0x5a1316[_0x0259('0x62')],md5(_0x5a1316[_0x0259('0x62')]));if(_0x126dda&&_0x126dda[_0x0259('0x63')]){logger['info'](_0x0259('0x64'),'Recording\x20is\x20enabled!');_0x5a1316['recordingURL']=_0x36302c;}else if(_0x1547a0&&_0x1547a0[_0x0259('0x65')]&&_0x1547a0[_0x0259('0x65')]!==_0x0259('0x66')){logger['info']('[OUTBOUND]',_0x0259('0x67'));_0x5a1316['recordingURL']=_0x36302c;}else{_0x5a1316['recordingURL']='';}return getAdminUser(_0x107a25,_0x2fe8ae,_0xfe1d1d,_0x586070,_0x2fdef6,_0x129d7b)['then'](getUser(_0x107a25,_0x2fe8ae,_0x586070,_0x2fdef6,_0x129d7b))['then'](getEndUser(_0x107a25,_0x2fe8ae,_0x586070,_0x2fdef6,_0x129d7b))[_0x0259('0xf')](getTicket(_0x107a25,_0x2fe8ae,_0x586070,_0x3689ab,_0x5a1316,_0x2fdef6))['then'](function(_0x1c8633){logger[_0x0259('0x1c')](util[_0x0259('0x53')](_0x0259('0x68'),_0x1c8633[_0x0259('0x69')]));logger[_0x0259('0x1c')](util['format']('call\x20direction:\x20%s',_0x107a25));if(_0x107a25!==_0x0259('0x61')){logger[_0x0259('0x1c')]('['+[_0x107a25['toUpperCase']()]+']',_0x0259('0x6a'));emit(_0x1c3c59[_0x0259('0x59')],_0x47eca1['name'],_0x1c8633[_0x0259('0x69')]);}})[_0x0259('0x15')](function(_0x1d2350){logger[_0x0259('0x16')]('['+[_0x107a25[_0x0259('0x13')]()]+_0x0259('0x6b'),util['inspect'](_0x1d2350,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4d65=['format','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','],\x20getAdminUser\x20crm','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','info','],\x20getUser\x20entity','length','active','true','userId','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','toString','string','customField','content','variable','variableName','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','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','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','calleridnum','queue','unmanaged','outbound'];(function(_0x3235c2,_0x3054ba){var _0x38b1a9=function(_0x37c665){while(--_0x37c665){_0x3235c2['push'](_0x3235c2['shift']());}};_0x38b1a9(++_0x3054ba);}(_0x4d65,0xec));var _0x54d6=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x4d65[_0x18a79d];return _0x4f8848;};'use strict';var _=require('lodash');var Promise=require(_0x54d6('0x0'));var rp=require(_0x54d6('0x1'));var util=require(_0x54d6('0x2'));var md5=require(_0x54d6('0x3'));var Redis=require('ioredis');var intUtil=require(_0x54d6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x54d6('0x5'))(_0x54d6('0x6'));config['redis']=_[_0x54d6('0x7')](config[_0x54d6('0x8')],{'host':_0x54d6('0x9'),'port':0x18eb});var io=require(_0x54d6('0xa'))(new Redis(config[_0x54d6('0x8')]));function getAdminUser(_0x33c570,_0x344d11,_0x5a1cc6,_0x1c752b,_0x33f8fa,_0x8e9891){return new Promise(function(_0x40cca0,_0xa0902b){var _0x269a46={'method':_0x54d6('0xb'),'uri':_0x1c752b+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x33f8fa+'&'+_0x8e9891,'auth':_0x344d11,'json':!![]};return rp(_0x269a46)[_0x54d6('0xc')](function(_0x3bc8c2){if(_0x3bc8c2['result']['length']>0x0){_0x5a1cc6[_0x54d6('0xd')]=_0x3bc8c2[_0x54d6('0xe')][0x0][_0x54d6('0xf')];}logger['info']('['+[_0x33c570['toUpperCase']()]+_0x54d6('0x10'),_0x5a1cc6);_0x40cca0(_0x5a1cc6);})['catch'](function(_0x2b22d6){logger[_0x54d6('0x11')]('['+[_0x33c570[_0x54d6('0x12')]()]+']',_0x2b22d6[_0x54d6('0x13')]);_0xa0902b(_0x2b22d6['message']);});});}function getUser(_0x3ec591,_0x52fe7d,_0x3a8dcb,_0x269ebd,_0x181d6a){return function(_0x1f86c0){logger['info']('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x14'),_0x1f86c0);return new Promise(function(_0x5e240f,_0x31eb23){if(intUtil[_0x54d6('0x15')](_0x1f86c0[_0x54d6('0x16')])){var _0x188bd4={'method':_0x54d6('0xb'),'uri':_0x3a8dcb+_0x54d6('0x17')+_0x1f86c0['userEmail']+'&'+_0x269ebd+'&'+_0x181d6a,'auth':_0x52fe7d,'json':!![]};logger['info']('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x18'),_0x188bd4);return rp(_0x188bd4)[_0x54d6('0xc')](function(_0x349f85){logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x1a'),_0x349f85);if(_0x349f85['result'][_0x54d6('0x1b')]>0x0&&String(_0x349f85[_0x54d6('0xe')][0x0][_0x54d6('0x1c')])===_0x54d6('0x1d')){_0x1f86c0[_0x54d6('0x1e')]=_0x349f85[_0x54d6('0xe')][0x0]['sys_id'];}else{_0x1f86c0[_0x54d6('0x1e')]=_0x1f86c0[_0x54d6('0xd')];_0x1f86c0[_0x54d6('0x16')]=_0x1f86c0[_0x54d6('0x1f')];}logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+'],\x20getUser\x20crm',_0x1f86c0);_0x5e240f(_0x1f86c0);})[_0x54d6('0x20')](function(_0x3a1819){logger[_0x54d6('0x11')]('['+[_0x3ec591[_0x54d6('0x12')]()]+']',_0x3a1819[_0x54d6('0x13')]);_0x31eb23(_0x3a1819[_0x54d6('0x13')]);});}else{logger[_0x54d6('0x19')]('['+[_0x3ec591[_0x54d6('0x12')]()]+_0x54d6('0x21'));_0x1f86c0[_0x54d6('0x1e')]=_0x1f86c0[_0x54d6('0xd')];_0x1f86c0[_0x54d6('0x16')]=_0x1f86c0[_0x54d6('0x1f')];_0x5e240f(_0x1f86c0);}});};}function createEndUser(_0x29671f,_0x6a98f6,_0x4aca0d,_0x4100e5,_0x454ba6){logger[_0x54d6('0x19')]('['+[_0x29671f['toUpperCase']()]+_0x54d6('0x22'),_0x4aca0d);return new Promise(function(_0x5cf889,_0x52f3ea){var _0x212f0e={'method':_0x54d6('0x23'),'uri':_0x4100e5+'sys_user?'+_0x454ba6,'body':{'user_name':_0x4aca0d[_0x54d6('0x24')],'roles':_0x54d6('0x25'),'first_name':_0x4aca0d[_0x54d6('0x24')],'active':'true','date_format':'System','phone':_0x4aca0d[_0x54d6('0x24')]},'auth':_0x6a98f6,'json':!![]};return rp(_0x212f0e)[_0x54d6('0xc')](function(_0x2278d5){logger['info']('['+[_0x29671f[_0x54d6('0x12')]()]+'],\x20EndUser\x20schema',_0x2278d5['result']);_0x4aca0d[_0x54d6('0x26')]=_0x2278d5[_0x54d6('0xe')][_0x54d6('0xf')];_0x5cf889(_0x4aca0d);})[_0x54d6('0x20')](function(_0xfd1f94){logger['error']('['+[_0x29671f[_0x54d6('0x12')]()]+']',_0xfd1f94['message']);_0x52f3ea(_0xfd1f94[_0x54d6('0x13')]);});});}function getEndUser(_0x4ce600,_0x188406,_0x533685,_0x1cae7d,_0x626d34){return function(_0x273673){logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x27'),_0x273673);return new Promise(function(_0x32f01b,_0x32653d){var _0x493b27={'method':_0x54d6('0xb'),'uri':_0x533685+_0x54d6('0x28')+_0x273673[_0x54d6('0x24')]+'&'+_0x1cae7d+'&'+_0x626d34,'auth':_0x188406,'json':!![]};return rp(_0x493b27)['then'](function(_0x2e4f8f){if(_0x2e4f8f['result']['length']>0x0){_0x273673[_0x54d6('0x26')]=_0x2e4f8f[_0x54d6('0xe')][0x0]['sys_id'];logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x29'),_0x273673);_0x32f01b(_0x273673);}else{return createEndUser(_0x4ce600,_0x188406,_0x273673,_0x533685,_0x1cae7d)[_0x54d6('0xc')](function(_0x3aeac2){logger[_0x54d6('0x19')]('['+[_0x4ce600[_0x54d6('0x12')]()]+_0x54d6('0x2a'),_0x3aeac2);_0x32f01b(_0x3aeac2);});}})[_0x54d6('0x20')](function(_0xc7286d){logger[_0x54d6('0x11')]('['+[_0x4ce600[_0x54d6('0x12')]()]+']',_0xc7286d[_0x54d6('0x13')]);_0x32653d(_0xc7286d[_0x54d6('0x13')]);});});};}function getCustomFields(_0x230373,_0x44157f){var _0x19450a={};if(_0x230373[_0x54d6('0x1b')]>0x0){_[_0x54d6('0x2b')](_0x230373,function(_0x3cfcf7){if(_[_0x54d6('0x2c')](['string',_0x54d6('0x2d')],_0x3cfcf7[_0x54d6('0x2e')])&&_0x3cfcf7[_0x54d6('0x2f')]&&!_0x3cfcf7['customField']){_0x19450a[_0x3cfcf7['nameField'][_0x54d6('0x30')]()]=_0x3cfcf7['content'][_0x54d6('0x31')]();}else if(_[_0x54d6('0x2c')]([_0x54d6('0x32'),_0x54d6('0x2d')],_0x3cfcf7[_0x54d6('0x2e')])&&_0x3cfcf7['idField']&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7['idField'][_0x54d6('0x30')]()]=_0x3cfcf7[_0x54d6('0x34')][_0x54d6('0x31')]();}else if(_0x3cfcf7[_0x54d6('0x2e')]===_0x54d6('0x35')&&_0x3cfcf7[_0x54d6('0x36')]&&_0x3cfcf7[_0x54d6('0x37')]&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7[_0x54d6('0x37')][_0x54d6('0x30')]()]=_0x44157f[_0x3cfcf7[_0x54d6('0x36')]][_0x54d6('0x31')]();}else if(_0x3cfcf7['type']===_0x54d6('0x38')&&_0x3cfcf7[_0x54d6('0x39')]&&_0x3cfcf7['Variable'][_0x54d6('0x3a')]&&_0x3cfcf7[_0x54d6('0x37')]&&_0x3cfcf7[_0x54d6('0x33')]){_0x19450a[_0x3cfcf7[_0x54d6('0x37')][_0x54d6('0x30')]()]=_0x44157f[_0x3cfcf7['Variable'][_0x54d6('0x3a')]['toLowerCase']()]['toString']();}});}return _0x19450a;}function getTicket(_0x391fb7,_0x3937c7,_0x65dd24,_0x1a1395,_0xfa7951,_0x262642){return function(_0x8de3a6){logger[_0x54d6('0x19')]('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x3b'),_0x8de3a6);return new Promise(function(_0x9a06ac,_0xe1b0b2){var _0x27ea54=_0x391fb7[_0x54d6('0x30')]()==='outbound'?_0x8de3a6['userId']:_0x8de3a6['endUserId'];var _0x2be251={'method':_0x54d6('0x23'),'uri':_0x65dd24+_0x54d6('0x3c')+'?'+_0x262642,'body':Object['assign']({},{'active':_0x54d6('0x1d'),'caller_id':_0x27ea54,'assigned_to':_0x8de3a6[_0x54d6('0x1e')],'short_description':intUtil[_0x54d6('0x3d')](_0x1a1395[_0x54d6('0x3e')],_0xfa7951,'\x20'),'description':intUtil[_0x54d6('0x3d')](_0x1a1395[_0x54d6('0x3f')],_0xfa7951,'\x0a')},getCustomFields(_0x1a1395[_0x54d6('0x40')],_0xfa7951)),'auth':_0x3937c7,'json':!![]};return rp(_0x2be251)[_0x54d6('0xc')](function(_0x33f4b5){logger[_0x54d6('0x19')]('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x41'),_0x33f4b5[_0x54d6('0xe')]);_0x8de3a6[_0x54d6('0x42')]=_0x33f4b5[_0x54d6('0xe')][_0x54d6('0xf')];_0x8de3a6['ticketNumber']=_0x33f4b5['result'][_0x54d6('0x43')];logger['info']('['+[_0x391fb7[_0x54d6('0x12')]()]+_0x54d6('0x44'),_0x8de3a6);_0x9a06ac(_0x8de3a6);})[_0x54d6('0x20')](function(_0x4d0be0){logger[_0x54d6('0x11')]('['+[_0x391fb7[_0x54d6('0x12')]()]+']',_0x4d0be0['message']);_0xe1b0b2(_0x4d0be0[_0x54d6('0x13')]);});});};}function createRemoteTag(_0xdbeb5c,_0x5da022,_0x4a3a05,_0xc5e34b){return new Promise(function(_0x5dcbb2,_0x23b6f6){var _0x1c66cb={'method':'POST','uri':_0x4a3a05+_0x54d6('0x45')+'?'+_0xc5e34b,'body':{'short_description':_0xdbeb5c,'global':!![],'active':!![],'name':_0xdbeb5c},'auth':_0x5da022,'json':!![]};return rp(_0x1c66cb)[_0x54d6('0xc')](function(_0x4a14a6){var _0x2e41d5=_0x4a14a6[_0x54d6('0xe')]['sys_id'];_0x5dcbb2(_0x2e41d5);});});}function getRemoteTag(_0xba9cb6,_0x4c7383,_0x47e760,_0x2f88e6,_0x10cff6){return new Promise(function(_0x4d9fe0,_0x5bc6b8){var _0x38479d={'method':'GET','uri':_0x47e760+'label'+_0x54d6('0x46')+_0xba9cb6+'&'+_0x2f88e6,'auth':_0x4c7383,'json':!![]};return rp(_0x38479d)[_0x54d6('0xc')](function(_0x3af50){if(_0x3af50[_0x54d6('0xe')][_0x54d6('0x1b')]>0x0){var _0x375ad4=_0x3af50[_0x54d6('0xe')][0x0][_0x54d6('0xf')];_0x4d9fe0(_0x375ad4);}else{return createRemoteTag(_0xba9cb6,_0x4c7383,_0x47e760,_0x2f88e6)['then'](function(_0x3a4ffe){_0x4d9fe0(_0x3a4ffe);});}});});}function assignTagToIncident(_0x84926e,_0x41092d,_0x48745e,_0x1eb8c4,_0x307ac2){return new Promise(function(_0x376a11,_0x5c2869){var _0x5b35a0={'method':'POST','uri':_0x48745e+_0x54d6('0x47')+'?'+_0x307ac2,'body':{'label':_0x84926e,'table':_0x54d6('0x3c'),'id_type':_0x54d6('0x48'),'table_key':_0x1eb8c4[_0x54d6('0x42')],'title':_0x54d6('0x49')+_0x1eb8c4[_0x54d6('0x4a')],'id_display':_0x1eb8c4[_0x54d6('0x4a')]},'auth':_0x41092d,'json':!![]};return rp(_0x5b35a0)['then'](function(_0xb4e436){_0x376a11();})[_0x54d6('0x20')](function(){_0x376a11();});});}function manageTags(_0x1b96b7,_0x1ba8c6,_0x17ffb1,_0x491bdf,_0x5e7c2a,_0x4f013d,_0x59515f){return new Promise(function(_0x3706b4,_0x4815b9){var _0x420fe4=[];_0x1ba8c6[_0x54d6('0x2b')](function(_0x35bc43){_0x420fe4[_0x54d6('0x4b')](getRemoteTag(_0x35bc43,_0x17ffb1,_0x491bdf,_0x4f013d,_0x59515f));});return Promise[_0x54d6('0x4c')](_0x420fe4)['then'](function(_0x421f64){if(_0x421f64[_0x54d6('0x1b')]){logger[_0x54d6('0x19')]('['+[_0x1b96b7[_0x54d6('0x12')]()]+_0x54d6('0x4d'),_0x421f64);var _0x4019ab=[];_0x421f64[_0x54d6('0x2b')](function(_0x2e8a05){_0x4019ab[_0x54d6('0x4b')](assignTagToIncident(_0x2e8a05,_0x17ffb1,_0x491bdf,_0x5e7c2a,_0x4f013d));});return Promise[_0x54d6('0x4c')](_0x4019ab)[_0x54d6('0xc')](function(){_0x3706b4();})[_0x54d6('0x20')](function(){_0x3706b4();});}else{_0x3706b4();}});});}function getTags(_0x16956d,_0x447109,_0x5b3206,_0x2f22a2,_0x52bc88,_0x292029){return function(_0x5a2b31){return new Promise(function(_0x4a145a,_0x320ccd){var _0x2a9b31=[];var _0x6d645e=_0x2f22a2[_0x54d6('0x4e')];if(_0x6d645e&&_0x6d645e[_0x54d6('0x1b')]>0x0){_0x2a9b31=_[_0x54d6('0x4f')](_0x6d645e,_0x54d6('0x3a'));}if(_0x2a9b31[_0x54d6('0x1b')]>0x0){return manageTags(_0x16956d,_0x2a9b31,_0x447109,_0x5b3206,_0x5a2b31,_0x52bc88,_0x292029)[_0x54d6('0xc')](function(){_0x4a145a(_0x5a2b31);});}else{_0x4a145a(_0x5a2b31);}});};}function emit(_0x1a6262,_0x140dc6,_0x91b714){var _0x4838e4=_0x54d6('0x50')+_0x54d6('0x51')+_0x54d6('0x52')+_0x54d6('0x53');var _0x362e40={'uri':_0x1a6262+_0x54d6('0x54')+_0x91b714+_0x4838e4};io['to'](util['format'](_0x54d6('0x55'),_0x140dc6))[_0x54d6('0x56')](_0x54d6('0x57'),_0x362e40);}exports['cs']=function(_0x548a17,_0x4aed2c,_0x2fb322,_0x1413ce,_0x2fe010,_0x2cee23,_0x5a94eb,_0x3c9459){var _0x42eb3f={};var _0xc2b758={'user':_0x2cee23[_0x54d6('0x58')],'pass':_0x2cee23['password']};var _0x1d6203=_0x54d6('0x59');var _0x5d8eb4=_0x54d6('0x5a');_0x2cee23[_0x54d6('0x5b')]=intUtil['stripTrailingSlash'](_0x2cee23[_0x54d6('0x5b')]);_0x2cee23[_0x54d6('0x5c')]=intUtil[_0x54d6('0x5d')](_0x2cee23['serverUrl']);var _0x1c716e=util['format'](_0x54d6('0x5e'),_0x2cee23[_0x54d6('0x5b')]);_0x42eb3f['userEmail']=!_['isNil'](_0x1413ce)?_0x1413ce[_0x54d6('0x5f')]:null;_0x42eb3f[_0x54d6('0x1f')]=_0x2cee23[_0x54d6('0x5f')];_0x42eb3f[_0x54d6('0x24')]=_0x3c9459[_0x54d6('0x30')]()==='outbound'?_0x4aed2c['destcalleridnum']:_0x4aed2c[_0x54d6('0x60')];_0x42eb3f['callDirection']=_0x3c9459===_0x54d6('0x61')||_0x3c9459===_0x54d6('0x62')?_0x54d6('0x61'):_0x54d6('0x63');var _0x3ff33c=util[_0x54d6('0x64')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cee23['serverUrl'],_0x4aed2c[_0x54d6('0x65')],md5(_0x4aed2c[_0x54d6('0x65')]));if(_0x2fe010&&_0x2fe010[_0x54d6('0x66')]){logger['info']('[QUEUE]',_0x54d6('0x67'));_0x4aed2c['recordingURL']=_0x3ff33c;}else if(_0x5a94eb&&_0x5a94eb[_0x54d6('0x68')]&&_0x5a94eb[_0x54d6('0x68')]!==_0x54d6('0x69')){logger[_0x54d6('0x19')](_0x54d6('0x6a'),'Recording\x20is\x20enabled!');_0x4aed2c[_0x54d6('0x6b')]=_0x3ff33c;}else{_0x4aed2c[_0x54d6('0x6b')]='';}return getAdminUser(_0x3c9459,_0xc2b758,_0x42eb3f,_0x1c716e,_0x5d8eb4,_0x1d6203)[_0x54d6('0xc')](getUser(_0x3c9459,_0xc2b758,_0x1c716e,_0x5d8eb4,_0x1d6203))[_0x54d6('0xc')](getEndUser(_0x3c9459,_0xc2b758,_0x1c716e,_0x5d8eb4,_0x1d6203))[_0x54d6('0xc')](getTicket(_0x3c9459,_0xc2b758,_0x1c716e,_0x2fb322,_0x4aed2c,_0x5d8eb4))['then'](function(_0x1fcd8f){logger[_0x54d6('0x19')](util[_0x54d6('0x64')](_0x54d6('0x6c'),_0x1fcd8f['ticketId']));logger['info'](util[_0x54d6('0x64')](_0x54d6('0x6d'),_0x3c9459));if(_0x3c9459!==_0x54d6('0x62')){logger[_0x54d6('0x19')]('['+[_0x3c9459[_0x54d6('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cee23[_0x54d6('0x5b')],_0x1413ce[_0x54d6('0x3a')],_0x1fcd8f[_0x54d6('0x42')]);}})[_0x54d6('0x20')](function(_0x452b0e){logger['error']('['+[_0x3c9459[_0x54d6('0x12')]()]+_0x54d6('0x6e'),util[_0x54d6('0x6f')](_0x452b0e,{'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 cabec53..a5f7ed4 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 _0x0d4b=['Subjects','description','getString','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','Contacts','parent_name','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','then','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','serverUrl','uri','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','%s/service/v4_1/rest.php','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','info','name'];(function(_0x3cb46e,_0x52111f){var _0x1e03dc=function(_0x10793d){while(--_0x10793d){_0x3cb46e['push'](_0x3cb46e['shift']());}};_0x1e03dc(++_0x52111f);}(_0x0d4b,0x67));var _0xb0d4=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x0d4b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb0d4('0x0'));var rp=require(_0xb0d4('0x1'));var BPromise=require(_0xb0d4('0x2'));var md5=require(_0xb0d4('0x3'));var util=require(_0xb0d4('0x4'));var Redis=require(_0xb0d4('0x5'));var intUtil=require(_0xb0d4('0x6'));var config=require(_0xb0d4('0x7'));var logger=require(_0xb0d4('0x8'))('sugarcrm');config[_0xb0d4('0x9')]=_[_0xb0d4('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb0d4('0xb'))(new Redis(config[_0xb0d4('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x167f0e,_0xb6c8fc,_0x55455d){io['to'](_0x167f0e)[_0xb0d4('0xc')](_0xb6c8fc,_0x55455d);}function getTicket(_0x2deb4a,_0x5953e4,_0x3dd730,_0x3363b8,_0x4dbb8b,_0x590b10,_0x2f648a,_0x3505b3){logger[_0xb0d4('0xd')]('Creating\x20new\x20ticket...');var _0x2e6d7a=new Date();var _0x5909af=[{'name':_0xb0d4('0xe'),'value':intUtil['getString'](_0x3363b8[_0xb0d4('0xf')],_0x4dbb8b,'\x20')},{'name':'assigned_user_id','value':_0x5953e4['id']},{'name':'created_by','value':_0x5953e4['id']},{'name':_0xb0d4('0x10'),'value':intUtil[_0xb0d4('0x11')](_0x3363b8[_0xb0d4('0x12')],_0x4dbb8b,'\x0a')},{'name':_0xb0d4('0x13'),'value':_0x2e6d7a[_0xb0d4('0x14')]()[_0xb0d4('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xb0d4('0x16'),'value':'15'},{'name':_0xb0d4('0x17'),'value':_0x3dd730['id']},{'name':_0xb0d4('0x18'),'value':_0xb0d4('0x19')},{'name':_0xb0d4('0x1a'),'value':_0x3dd730[_0xb0d4('0xe')]},{'name':'direction','value':_0x3505b3}];if(_0x590b10['length']){_[_0xb0d4('0x1b')](_0x590b10,function(_0x3c931e){if(_0x4dbb8b[_0x3c931e[_0xb0d4('0x1c')]]){_0x5909af[_0xb0d4('0x1d')]({'name':_0x3c931e[_0xb0d4('0x1e')],'value':_0x4dbb8b[_0x3c931e[_0xb0d4('0x1c')]]});}});}return request({'form':{'method':_0xb0d4('0x1f'),'input_type':_0xb0d4('0x20'),'response_type':_0xb0d4('0x20'),'rest_data':JSON['stringify']({'session':_0x2f648a['id'],'module_name':_0xb0d4('0x21'),'name_value_list':_0x5909af})}});}function getAuth(_0x3b2776){return util['format'](_0xb0d4('0x22'),new Buffer(_0x3b2776['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x362e9f){return request({'form':{'method':_0xb0d4('0x23'),'input_type':_0xb0d4('0x20'),'response_type':_0xb0d4('0x20'),'rest_data':JSON[_0xb0d4('0x24')]({'session':_0x362e9f['id']})}});}function getUser(_0x4fd3ee,_0x1398a3,_0x5b2563){if(!_[_0xb0d4('0x25')](_0x1398a3)){logger[_0xb0d4('0xd')](_0xb0d4('0x26'),_0x1398a3);return request({'form':{'method':_0xb0d4('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb0d4('0x24')]({'session':_0x5b2563['id'],'module_name':_0xb0d4('0x28'),'query':util[_0xb0d4('0x29')](_0xb0d4('0x2a'),_0x1398a3),'order_by':'','offset':'0','select_fields':['id','name',_0xb0d4('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x934d1d){if(_0x934d1d[_0xb0d4('0x2c')][_0xb0d4('0x2d')]){var _0x6b3df8=_[_0xb0d4('0x2e')](_0x934d1d['entry_list'],function(_0x31c49e){return _0x31c49e[_0xb0d4('0x2f')][_0xb0d4('0x2b')][_0xb0d4('0x30')]===_0x1398a3;});if(_0x6b3df8){logger[_0xb0d4('0xd')](_0xb0d4('0x31'));return BPromise[_0xb0d4('0x32')]({'id':_0x6b3df8[_0xb0d4('0x2f')]['id'][_0xb0d4('0x30')],'name':_0x6b3df8[_0xb0d4('0x2f')][_0xb0d4('0xe')][_0xb0d4('0x30')]});}}logger[_0xb0d4('0xd')](_0xb0d4('0x33'));return BPromise['resolve']({'id':_0x5b2563['name_value_list'][_0xb0d4('0x34')][_0xb0d4('0x30')],'name':_0x5b2563['name_value_list']['user_name'][_0xb0d4('0x30')]});});}else{logger[_0xb0d4('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5b2563['name_value_list'][_0xb0d4('0x34')]['value'],'name':_0x5b2563[_0xb0d4('0x2f')][_0xb0d4('0x2b')][_0xb0d4('0x30')]});}}function getEndUser(_0x2a7ddf,_0x442065,_0x2205c9,_0x1cfd8c){logger[_0xb0d4('0xd')](_0xb0d4('0x35'),_0x2205c9);return request({'form':{'method':_0xb0d4('0x27'),'input_type':'JSON','response_type':_0xb0d4('0x20'),'rest_data':JSON[_0xb0d4('0x24')]({'session':_0x1cfd8c['id'],'module_name':_0xb0d4('0x19'),'query':util[_0xb0d4('0x29')](_0xb0d4('0x36'),_0x2205c9),'order_by':'','offset':'0','select_fields':['id',_0xb0d4('0xe'),_0xb0d4('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x232b15){if(_0x232b15['entry_list'][_0xb0d4('0x2d')]){var _0x37036f=_[_0xb0d4('0x2e')](_0x232b15['entry_list'],function(_0x13b4db){return _0x13b4db[_0xb0d4('0x2f')]['phone_home'][_0xb0d4('0x30')]===_0x2205c9;});if(_0x37036f){logger['info'](_0xb0d4('0x38'));return BPromise[_0xb0d4('0x32')]({'id':_0x37036f['name_value_list']['id'][_0xb0d4('0x30')],'name':_0x37036f['name_value_list'][_0xb0d4('0xe')][_0xb0d4('0x30')],'phone':_0x37036f[_0xb0d4('0x2f')][_0xb0d4('0x37')][_0xb0d4('0x30')]});}}else{logger['info'](_0xb0d4('0x39'));return request({'form':{'method':_0xb0d4('0x1f'),'input_type':'JSON','response_type':_0xb0d4('0x20'),'rest_data':JSON['stringify']({'session':_0x1cfd8c['id'],'module_name':'Contacts','name_value_list':[{'name':_0xb0d4('0x3a'),'value':_0x442065!==_0xb0d4('0x3b')?_0x442065:util['format']('Caller\x20-\x20%s',_0x2205c9)},{'name':_0xb0d4('0x37'),'value':_0x2205c9}]})}})['then'](function(_0x1bf3c2){logger[_0xb0d4('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x1bf3c2['id'],'name':_0x1bf3c2['entry_list'][_0xb0d4('0x3a')][_0xb0d4('0x30')],'phone':_0x1bf3c2[_0xb0d4('0x2c')][_0xb0d4('0x37')][_0xb0d4('0x30')]});});}});}function request(_0x5aca46){logger['debug'](_0xb0d4('0x3c'),JSON[_0xb0d4('0x24')](_0x5aca46));return rp(_[_0xb0d4('0x3d')](def,_0x5aca46));}function getTags(_0x4b2e50,_0x263f71){var _0x8e59dd=[];if(_0x4b2e50&&_0x4b2e50['length']>0x0){_0x8e59dd=_[_0xb0d4('0x3e')](_0x4b2e50,_0x263f71);}return _0x8e59dd;}function getCustomFields(_0x117d6b,_0x464c33){var _0xaeec1f=[];var _0xcd333a={'custom_fields':[]};if(_0x117d6b[_0xb0d4('0x2d')]>0x0){_[_0xb0d4('0x1b')](_0x117d6b,function(_0x2dea8c){if(_0x2dea8c[_0xb0d4('0x3f')]===_0xb0d4('0x40')&&_0x2dea8c[_0xb0d4('0x41')]&&!_0x2dea8c[_0xb0d4('0x42')]){_0xcd333a[_0x2dea8c[_0xb0d4('0x41')][_0xb0d4('0x43')]()]=_0x2dea8c[_0xb0d4('0x44')][_0xb0d4('0x45')]();}else if(_0x2dea8c[_0xb0d4('0x3f')]===_0xb0d4('0x40')&&_0x2dea8c[_0xb0d4('0x1e')]&&_0x2dea8c[_0xb0d4('0x42')]){_0xcd333a[_0xb0d4('0x46')]['push']({'id':_0x2dea8c[_0xb0d4('0x1e')],'value':_0x2dea8c[_0xb0d4('0x44')][_0xb0d4('0x45')]()});}else if(_0x2dea8c[_0xb0d4('0x3f')]==='variable'&&_0x2dea8c[_0xb0d4('0x1c')]&&_0x2dea8c['idField']&&_0x2dea8c['customField']){_0x464c33[_0x2dea8c[_0xb0d4('0x1c')]]&&_0xcd333a['custom_fields'][_0xb0d4('0x1d')]({'id':_0x2dea8c['idField'],'value':_0x464c33[_0x2dea8c[_0xb0d4('0x1c')]][_0xb0d4('0x45')]()});}else if(_0x2dea8c[_0xb0d4('0x3f')]==='customVariable'&&_0x2dea8c[_0xb0d4('0x47')]&&_0x2dea8c['Variable']['name']&&_0x2dea8c[_0xb0d4('0x1e')]&&_0x2dea8c[_0xb0d4('0x42')]){_0x464c33[_0x2dea8c[_0xb0d4('0x47')][_0xb0d4('0xe')][_0xb0d4('0x43')]()]&&_0xcd333a[_0xb0d4('0x46')][_0xb0d4('0x1d')]({'id':_0x2dea8c[_0xb0d4('0x1e')],'value':_0x464c33[_0x2dea8c['Variable']['name'][_0xb0d4('0x43')]()]['toString']()});}});}return _0xcd333a;}function getConnection(_0x512558){return request({'method':'POST','form':{'method':_0xb0d4('0x48'),'input_type':_0xb0d4('0x20'),'response_type':'JSON','rest_data':JSON[_0xb0d4('0x24')]({'user_auth':{'user_name':_0x512558[_0xb0d4('0x49')],'password':_0x512558[_0xb0d4('0x4a')],'encryption':_0xb0d4('0x4b')},'application':_0xb0d4('0x4c')})}})[_0xb0d4('0x4d')](function(_0xec7c90){var _0x48fb89=_0xec7c90;if(_0x48fb89['id']){def[_0xb0d4('0x4e')]=_0x48fb89['id'];return BPromise[_0xb0d4('0x32')](_0x48fb89);}else{throw new Error(util['format'](_0xb0d4('0x4f'),_0x512558['id']));}});}function setRelationship(_0x463484,_0x4710b5,_0x1eea66,_0x352f50){return request({'form':{'method':'set_relationship','input_type':_0xb0d4('0x20'),'response_type':'JSON','rest_data':JSON[_0xb0d4('0x24')]({'session':_0x463484['id'],'module_name':_0xb0d4('0x21'),'module_id':_0x1eea66['id'],'link_field_name':_0x352f50,'related_ids':[_0x4710b5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb0d4('0x50')]=function(_0x195f10,_0x261fd7,_0x34da0d,_0x120994,_0x50028a,_0x34e007){var _0x197667,_0x2893d8,_0x20ec34,_0x564bb9;_0x34e007['remoteUri']=intUtil[_0xb0d4('0x51')](_0x34e007['remoteUri']);_0x34e007[_0xb0d4('0x52')]=intUtil[_0xb0d4('0x51')](_0x34e007[_0xb0d4('0x52')]);def[_0xb0d4('0x53')]=util[_0xb0d4('0x29')]('%s/service/v4_1/rest.php',_0x34e007[_0xb0d4('0x54')]);if(_0x50028a&&_0x50028a[_0xb0d4('0x55')]){logger['info'](_0xb0d4('0x56'),_0xb0d4('0x57'));_0x261fd7[_0xb0d4('0x58')]=util['format'](_0xb0d4('0x59'),_0x34e007['serverUrl'],_0x261fd7['uniqueid'],md5(_0x261fd7[_0xb0d4('0x5a')]));}else{_0x261fd7[_0xb0d4('0x58')]='';}return getConnection(_0x34e007)[_0xb0d4('0x4d')](function(_0x5d7485){_0x564bb9=_0x5d7485;return getUser(_0x34e007,_0x120994['name'],_0x564bb9);})[_0xb0d4('0x4d')](function(_0x28159b){_0x197667=_0x28159b;logger[_0xb0d4('0xd')](_0xb0d4('0x5b'),_0x197667['id']);return getEndUser(_0x34e007,_0x261fd7[_0xb0d4('0x5c')],_0x261fd7[_0xb0d4('0x5d')],_0x564bb9);})[_0xb0d4('0x4d')](function(_0x40700b){_0x2893d8=_0x40700b;logger[_0xb0d4('0xd')](_0xb0d4('0x5e'),_0x2893d8['id']);return getTicket(_0x34e007,_0x197667,_0x2893d8,_0x34da0d,_0x261fd7,_0x34da0d[_0xb0d4('0x5f')],_0x564bb9,_0xb0d4('0x60'));})[_0xb0d4('0x4d')](function(_0x214fb1){_0x20ec34=_0x214fb1;logger[_0xb0d4('0xd')]('Ticket\x20created!');logger[_0xb0d4('0xd')](_0xb0d4('0x61'),_0x20ec34['id']);return setRelationship(_0x564bb9,_0x197667,_0x20ec34,_0xb0d4('0x62'));})[_0xb0d4('0x4d')](function(){return setRelationship(_0x564bb9,_0x2893d8,_0x20ec34,_0xb0d4('0x63'));})[_0xb0d4('0x4d')](function(){return getServerInfo(_0x564bb9);})['then'](function(_0x2a46ed){var _0x4dd189=parseInt(_0x2a46ed[_0xb0d4('0x64')][_0xb0d4('0x65')](0x0));var _0x400bd4=util[_0xb0d4('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x34e007['remoteUri'],_0x20ec34['id']);if(_0x4dd189>0x6){_0x400bd4=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x34e007[_0xb0d4('0x54')],_0x20ec34['id']);}logger[_0xb0d4('0xd')](_0xb0d4('0x56'),_0xb0d4('0x66'));emit(util[_0xb0d4('0x29')]('user:%s',_0x120994[_0xb0d4('0xe')]),_0xb0d4('0x67'),{'uri':_0x400bd4});})['catch'](function(_0x1d394a){logger[_0xb0d4('0x68')](_0xb0d4('0x56'),JSON[_0xb0d4('0x24')](_0x1d394a));});};exports[_0xb0d4('0x69')]=function(_0x47cae3,_0x2acc99,_0xd6954e,_0x20704f,_0x29be94,_0x4f9377,_0x4da2ee){var _0x231c61,_0x464c53,_0x34a246,_0x227ca3;_0x4f9377['remoteUri']=intUtil[_0xb0d4('0x51')](_0x4f9377[_0xb0d4('0x54')]);_0x4f9377[_0xb0d4('0x52')]=intUtil[_0xb0d4('0x51')](_0x4f9377[_0xb0d4('0x52')]);def[_0xb0d4('0x53')]=util[_0xb0d4('0x29')]('%s/service/v4_1/rest.php',_0x4f9377[_0xb0d4('0x54')]);if(_0x4da2ee&&_0x4da2ee[_0xb0d4('0x6a')]&&_0x4da2ee['recordingFormat']!==_0xb0d4('0x6b')){logger['info'](_0xb0d4('0x6c'),_0xb0d4('0x57'));_0x2acc99[_0xb0d4('0x58')]=util['format'](_0xb0d4('0x59'),_0x4f9377[_0xb0d4('0x52')],_0x2acc99[_0xb0d4('0x5a')],md5(_0x2acc99[_0xb0d4('0x5a')]));}return getConnection(_0x4f9377)['then'](function(_0x3e0637){_0x227ca3=_0x3e0637;return getUser(_0x4f9377,_0x20704f[_0xb0d4('0xe')],_0x227ca3);})['then'](function(_0x8300aa){_0x231c61=_0x8300aa;logger[_0xb0d4('0xd')](_0xb0d4('0x5b'),_0x231c61['id']);return getEndUser(_0x4f9377,_0x2acc99[_0xb0d4('0x6d')],_0x2acc99[_0xb0d4('0x6e')],_0x227ca3);})[_0xb0d4('0x4d')](function(_0x481908){_0x464c53=_0x481908;logger[_0xb0d4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x464c53['id']);return getTicket(_0x4f9377,_0x231c61,_0x464c53,_0xd6954e,_0x2acc99,_0xd6954e[_0xb0d4('0x5f')],_0x227ca3,_0xb0d4('0x6f'));})['then'](function(_0x48c6cd){_0x34a246=_0x48c6cd;logger['info']('Ticket\x20created!');logger[_0xb0d4('0xd')]('The\x20Ticket\x20ID\x20is:',_0x34a246['id']);return setRelationship(_0x227ca3,_0x231c61,_0x34a246,_0xb0d4('0x62'));})[_0xb0d4('0x4d')](function(){return setRelationship(_0x227ca3,_0x464c53,_0x34a246,_0xb0d4('0x63'));})['then'](function(){return getServerInfo(_0x227ca3);})[_0xb0d4('0x4d')](function(_0x32db2e){var _0x44e504=parseInt(_0x32db2e[_0xb0d4('0x64')][_0xb0d4('0x65')](0x0));var _0x4603c9=util[_0xb0d4('0x29')](_0xb0d4('0x70'),_0x4f9377['remoteUri'],_0x34a246['id']);if(_0x44e504>0x6){_0x4603c9=util['format'](_0xb0d4('0x71'),_0x4f9377['remoteUri'],_0x34a246['id']);}logger[_0xb0d4('0xd')]('[OUTBOUND]',_0xb0d4('0x66'));emit(util[_0xb0d4('0x29')](_0xb0d4('0x72'),_0x20704f['name']),_0xb0d4('0x67'),{'uri':_0x4603c9});})[_0xb0d4('0x73')](function(_0x340a08){logger[_0xb0d4('0x68')](_0xb0d4('0x6c'),JSON[_0xb0d4('0x24')](_0x340a08));});};exports['unmanaged']=function(_0x235360,_0xb3b766,_0x3887e5,_0x7842e7,_0x245430,_0x545017){var _0x5e16c4,_0x53b7fc,_0x1cfb1f,_0x426b5e;_0x545017['remoteUri']=intUtil[_0xb0d4('0x51')](_0x545017[_0xb0d4('0x54')]);_0x545017['serverUrl']=intUtil[_0xb0d4('0x51')](_0x545017['serverUrl']);def[_0xb0d4('0x53')]=util[_0xb0d4('0x29')](_0xb0d4('0x74'),_0x545017[_0xb0d4('0x54')]);if(_0x245430&&_0x245430[_0xb0d4('0x55')]){logger[_0xb0d4('0xd')]('['+_0xb3b766['lastevent'][_0xb0d4('0x75')]()+']',_0xb0d4('0x57'));_0xb3b766['recordingURL']=util[_0xb0d4('0x29')](_0xb0d4('0x59'),_0x545017[_0xb0d4('0x52')],_0xb3b766['uniqueid'],md5(_0xb3b766[_0xb0d4('0x5a')]));}else{_0xb3b766[_0xb0d4('0x58')]='';}return getConnection(_0x545017)[_0xb0d4('0x4d')](function(_0x3fcd30){_0x426b5e=_0x3fcd30;if(!_[_0xb0d4('0x25')](_0x7842e7)){return getUser(_0x545017,_0x7842e7['name'],_0x426b5e);}else{return getUser(_0x545017,null,_0x426b5e);}})[_0xb0d4('0x4d')](function(_0x43c98b){_0x5e16c4=_0x43c98b;logger[_0xb0d4('0xd')](_0xb0d4('0x5b'),_0x5e16c4['id']);return getEndUser(_0x545017,_0xb3b766[_0xb0d4('0x5c')],_0xb3b766[_0xb0d4('0x5d')],_0x426b5e);})[_0xb0d4('0x4d')](function(_0x39cb97){_0x53b7fc=_0x39cb97;logger[_0xb0d4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x53b7fc['id']);return getTicket(_0x545017,_0x5e16c4,_0x53b7fc,_0x3887e5,_0xb3b766,_0x3887e5[_0xb0d4('0x5f')],_0x426b5e,_0xb0d4('0x60'));})[_0xb0d4('0x4d')](function(_0x21028d){_0x1cfb1f=_0x21028d;logger[_0xb0d4('0xd')]('Ticket\x20created!');logger[_0xb0d4('0xd')]('The\x20Ticket\x20ID\x20is:',_0x1cfb1f['id']);return setRelationship(_0x426b5e,_0x5e16c4,_0x1cfb1f,_0xb0d4('0x62'));})[_0xb0d4('0x4d')](function(){return setRelationship(_0x426b5e,_0x53b7fc,_0x1cfb1f,'contacts');})[_0xb0d4('0x4d')](function(){return getServerInfo(_0x426b5e);})[_0xb0d4('0x73')](function(_0xa23b36){logger['error']('['+_0xb3b766['lastevent'][_0xb0d4('0x75')]()+']',JSON['stringify'](_0xa23b36));});}; \ No newline at end of file +var _0x0b65=['get_server_info','Employees','user_name','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','content','toString','variable','push','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','stripTrailingSlash','toUpperCase','isNil','lastevent','lodash','request-promise','bluebird','md5','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64'];(function(_0x1fe22d,_0x135642){var _0x2dcd3e=function(_0x3786da){while(--_0x3786da){_0x1fe22d['push'](_0x1fe22d['shift']());}};_0x2dcd3e(++_0x135642);}(_0x0b65,0x1b6));var _0x50b6=function(_0x44cf59,_0x33e739){_0x44cf59=_0x44cf59-0x0;var _0xae0bda=_0x0b65[_0x44cf59];return _0xae0bda;};'use strict';var _=require(_0x50b6('0x0'));var rp=require(_0x50b6('0x1'));var BPromise=require(_0x50b6('0x2'));var md5=require(_0x50b6('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x50b6('0x4'))(_0x50b6('0x5'));config[_0x50b6('0x6')]=_[_0x50b6('0x7')](config[_0x50b6('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x50b6('0x8'))(new Redis(config[_0x50b6('0x6')]));var def={'method':_0x50b6('0x9'),'json':!![]};function emit(_0x1d2573,_0x5400b7,_0x554885){io['to'](_0x1d2573)[_0x50b6('0xa')](_0x5400b7,_0x554885);}function getTicket(_0x44e011,_0x33da75,_0x2c1ff3,_0x45fa4d,_0x118a46,_0x32a644,_0x14d47f,_0x49e228){logger[_0x50b6('0xb')](_0x50b6('0xc'));var _0x850ba7=new Date();var _0x378d16=[{'name':_0x50b6('0xd'),'value':intUtil[_0x50b6('0xe')](_0x45fa4d[_0x50b6('0xf')],_0x118a46,'\x20')},{'name':'assigned_user_id','value':_0x33da75['id']},{'name':_0x50b6('0x10'),'value':_0x33da75['id']},{'name':'description','value':intUtil[_0x50b6('0xe')](_0x45fa4d[_0x50b6('0x11')],_0x118a46,'\x0a')},{'name':_0x50b6('0x12'),'value':_0x850ba7[_0x50b6('0x13')]()[_0x50b6('0x14')](0x0,0x13)[_0x50b6('0x15')]('T','\x20')},{'name':_0x50b6('0x16'),'value':'0'},{'name':_0x50b6('0x17'),'value':'15'},{'name':_0x50b6('0x18'),'value':_0x2c1ff3['id']},{'name':_0x50b6('0x19'),'value':'Contacts'},{'name':_0x50b6('0x1a'),'value':_0x2c1ff3['name']},{'name':_0x50b6('0x1b'),'value':_0x49e228}];if(_0x32a644['length']){_[_0x50b6('0x1c')](_0x32a644,function(_0x483177){if(_0x118a46[_0x483177[_0x50b6('0x1d')]]){_0x378d16['push']({'name':_0x483177[_0x50b6('0x1e')],'value':_0x118a46[_0x483177[_0x50b6('0x1d')]]});}});}return request({'form':{'method':_0x50b6('0x1f'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x14d47f['id'],'module_name':'Calls','name_value_list':_0x378d16})}});}function getAuth(_0x16312a){return util[_0x50b6('0x22')](_0x50b6('0x23'),new Buffer(_0x16312a[_0x50b6('0x24')]+':X')['toString'](_0x50b6('0x25')));}function getServerInfo(_0x5f28dc){return request({'form':{'method':_0x50b6('0x26'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x5f28dc['id']})}});}function getUser(_0x17a3a4,_0xac8a19,_0x1e8381){if(!_['isNil'](_0xac8a19)){logger[_0x50b6('0xb')]('Getting\x20agent\x20with\x20name',_0xac8a19);return request({'form':{'method':'get_entry_list','input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'session':_0x1e8381['id'],'module_name':_0x50b6('0x27'),'query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xac8a19),'order_by':'','offset':'0','select_fields':['id',_0x50b6('0xd'),_0x50b6('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x50b6('0x29')](function(_0x58b348){if(_0x58b348[_0x50b6('0x2a')][_0x50b6('0x2b')]){var _0x200668=_['find'](_0x58b348[_0x50b6('0x2a')],function(_0x58febb){return _0x58febb[_0x50b6('0x2c')][_0x50b6('0x28')][_0x50b6('0x2d')]===_0xac8a19;});if(_0x200668){logger[_0x50b6('0xb')](_0x50b6('0x2e'));return BPromise[_0x50b6('0x2f')]({'id':_0x200668[_0x50b6('0x2c')]['id'][_0x50b6('0x2d')],'name':_0x200668['name_value_list']['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x50b6('0x2f')]({'id':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x30')]['value'],'name':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x28')][_0x50b6('0x2d')]});});}else{logger[_0x50b6('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x50b6('0x2f')]({'id':_0x1e8381['name_value_list'][_0x50b6('0x30')][_0x50b6('0x2d')],'name':_0x1e8381[_0x50b6('0x2c')][_0x50b6('0x28')]['value']});}}function getEndUser(_0x4e6460,_0x1accb4,_0x5d5aee,_0x71e7d2){logger[_0x50b6('0xb')](_0x50b6('0x31'),_0x5d5aee);return request({'form':{'method':_0x50b6('0x32'),'input_type':_0x50b6('0x20'),'response_type':'JSON','rest_data':JSON[_0x50b6('0x21')]({'session':_0x71e7d2['id'],'module_name':_0x50b6('0x33'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x5d5aee),'order_by':'','offset':'0','select_fields':['id','name',_0x50b6('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x50b6('0x29')](function(_0xea9848){if(_0xea9848['entry_list'][_0x50b6('0x2b')]){var _0x3711cf=_['find'](_0xea9848[_0x50b6('0x2a')],function(_0x4bc5f4){return _0x4bc5f4[_0x50b6('0x2c')][_0x50b6('0x34')]['value']===_0x5d5aee;});if(_0x3711cf){logger['info']('Enduser\x20found!');return BPromise[_0x50b6('0x2f')]({'id':_0x3711cf[_0x50b6('0x2c')]['id'][_0x50b6('0x2d')],'name':_0x3711cf['name_value_list'][_0x50b6('0xd')]['value'],'phone':_0x3711cf[_0x50b6('0x2c')][_0x50b6('0x34')]['value']});}}else{logger['info'](_0x50b6('0x35'));return request({'form':{'method':_0x50b6('0x1f'),'input_type':'JSON','response_type':_0x50b6('0x20'),'rest_data':JSON['stringify']({'session':_0x71e7d2['id'],'module_name':_0x50b6('0x33'),'name_value_list':[{'name':_0x50b6('0x36'),'value':_0x1accb4!==_0x50b6('0x37')?_0x1accb4:util[_0x50b6('0x22')](_0x50b6('0x38'),_0x5d5aee)},{'name':_0x50b6('0x34'),'value':_0x5d5aee}]})}})[_0x50b6('0x29')](function(_0x1b4aae){logger[_0x50b6('0xb')](_0x50b6('0x39'));return BPromise[_0x50b6('0x2f')]({'id':_0x1b4aae['id'],'name':_0x1b4aae['entry_list'][_0x50b6('0x36')][_0x50b6('0x2d')],'phone':_0x1b4aae[_0x50b6('0x2a')][_0x50b6('0x34')][_0x50b6('0x2d')]});});}});}function request(_0x3db720){logger[_0x50b6('0x3a')]('[HTTP]',JSON['stringify'](_0x3db720));return rp(_[_0x50b6('0x3b')](def,_0x3db720));}function getTags(_0x535f59,_0x2001db){var _0x3f946e=[];if(_0x535f59&&_0x535f59[_0x50b6('0x2b')]>0x0){_0x3f946e=_[_0x50b6('0x3c')](_0x535f59,_0x2001db);}return _0x3f946e;}function getCustomFields(_0x21d3e8,_0x10186a){var _0x1c31b1=[];var _0x4f1d48={'custom_fields':[]};if(_0x21d3e8[_0x50b6('0x2b')]>0x0){_[_0x50b6('0x1c')](_0x21d3e8,function(_0xc502ff){if(_0xc502ff[_0x50b6('0x3d')]===_0x50b6('0x3e')&&_0xc502ff[_0x50b6('0x3f')]&&!_0xc502ff[_0x50b6('0x40')]){_0x4f1d48[_0xc502ff[_0x50b6('0x3f')][_0x50b6('0x41')]()]=_0xc502ff['content']['toString']();}else if(_0xc502ff['type']==='string'&&_0xc502ff[_0x50b6('0x1e')]&&_0xc502ff[_0x50b6('0x40')]){_0x4f1d48[_0x50b6('0x42')]['push']({'id':_0xc502ff[_0x50b6('0x1e')],'value':_0xc502ff[_0x50b6('0x43')][_0x50b6('0x44')]()});}else if(_0xc502ff[_0x50b6('0x3d')]===_0x50b6('0x45')&&_0xc502ff[_0x50b6('0x1d')]&&_0xc502ff['idField']&&_0xc502ff[_0x50b6('0x40')]){_0x10186a[_0xc502ff[_0x50b6('0x1d')]]&&_0x4f1d48[_0x50b6('0x42')][_0x50b6('0x46')]({'id':_0xc502ff[_0x50b6('0x1e')],'value':_0x10186a[_0xc502ff[_0x50b6('0x1d')]][_0x50b6('0x44')]()});}else if(_0xc502ff['type']==='customVariable'&&_0xc502ff[_0x50b6('0x47')]&&_0xc502ff[_0x50b6('0x47')]['name']&&_0xc502ff[_0x50b6('0x1e')]&&_0xc502ff[_0x50b6('0x40')]){_0x10186a[_0xc502ff[_0x50b6('0x47')][_0x50b6('0xd')]['toLowerCase']()]&&_0x4f1d48[_0x50b6('0x42')][_0x50b6('0x46')]({'id':_0xc502ff['idField'],'value':_0x10186a[_0xc502ff[_0x50b6('0x47')][_0x50b6('0xd')][_0x50b6('0x41')]()][_0x50b6('0x44')]()});}});}return _0x4f1d48;}function getConnection(_0x590ceb){return request({'method':_0x50b6('0x9'),'form':{'method':_0x50b6('0x48'),'input_type':_0x50b6('0x20'),'response_type':_0x50b6('0x20'),'rest_data':JSON[_0x50b6('0x21')]({'user_auth':{'user_name':_0x590ceb[_0x50b6('0x49')],'password':_0x590ceb[_0x50b6('0x4a')],'encryption':'PLAIN'},'application':_0x50b6('0x4b')})}})[_0x50b6('0x29')](function(_0x1c3dae){var _0x4d51d2=_0x1c3dae;if(_0x4d51d2['id']){def[_0x50b6('0x4c')]=_0x4d51d2['id'];return BPromise[_0x50b6('0x2f')](_0x4d51d2);}else{throw new Error(util[_0x50b6('0x22')](_0x50b6('0x4d'),_0x590ceb['id']));}});}function setRelationship(_0x3ef7e6,_0x3931fc,_0x59cc75,_0x36a184){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x50b6('0x21')]({'session':_0x3ef7e6['id'],'module_name':_0x50b6('0x4e'),'module_id':_0x59cc75['id'],'link_field_name':_0x36a184,'related_ids':[_0x3931fc['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x50b6('0x4f')]=function(_0x25f884,_0x5415ee,_0x32ed74,_0x7483f8,_0x356dce,_0x4fe3b6){var _0x3cfa5e,_0x5c6792,_0x449fac,_0x5bcf28;_0x4fe3b6[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x4fe3b6[_0x50b6('0x50')]);_0x4fe3b6['serverUrl']=intUtil['stripTrailingSlash'](_0x4fe3b6[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util[_0x50b6('0x22')](_0x50b6('0x53'),_0x4fe3b6[_0x50b6('0x50')]);if(_0x356dce&&_0x356dce[_0x50b6('0x54')]){logger[_0x50b6('0xb')](_0x50b6('0x55'),_0x50b6('0x56'));_0x5415ee[_0x50b6('0x57')]=util[_0x50b6('0x22')](_0x50b6('0x58'),_0x4fe3b6[_0x50b6('0x51')],_0x5415ee[_0x50b6('0x59')],md5(_0x5415ee[_0x50b6('0x59')]));}else{_0x5415ee[_0x50b6('0x57')]='';}return getConnection(_0x4fe3b6)[_0x50b6('0x29')](function(_0x27d0f6){_0x5bcf28=_0x27d0f6;return getUser(_0x4fe3b6,_0x7483f8[_0x50b6('0xd')],_0x5bcf28);})[_0x50b6('0x29')](function(_0x2f7995){_0x3cfa5e=_0x2f7995;logger['info'](_0x50b6('0x5a'),_0x3cfa5e['id']);return getEndUser(_0x4fe3b6,_0x5415ee[_0x50b6('0x5b')],_0x5415ee[_0x50b6('0x5c')],_0x5bcf28);})[_0x50b6('0x29')](function(_0x2438bf){_0x5c6792=_0x2438bf;logger['info'](_0x50b6('0x5d'),_0x5c6792['id']);return getTicket(_0x4fe3b6,_0x3cfa5e,_0x5c6792,_0x32ed74,_0x5415ee,_0x32ed74['Fields'],_0x5bcf28,_0x50b6('0x5e'));})[_0x50b6('0x29')](function(_0x295397){_0x449fac=_0x295397;logger[_0x50b6('0xb')]('Ticket\x20created!');logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x449fac['id']);return setRelationship(_0x5bcf28,_0x3cfa5e,_0x449fac,_0x50b6('0x60'));})[_0x50b6('0x29')](function(){return setRelationship(_0x5bcf28,_0x5c6792,_0x449fac,'contacts');})['then'](function(){return getServerInfo(_0x5bcf28);})[_0x50b6('0x29')](function(_0x2b6b73){var _0x22b980=parseInt(_0x2b6b73['version'][_0x50b6('0x61')](0x0));var _0x2c46c9=util[_0x50b6('0x22')](_0x50b6('0x62'),_0x4fe3b6[_0x50b6('0x50')],_0x449fac['id']);if(_0x22b980>0x6){_0x2c46c9=util[_0x50b6('0x22')](_0x50b6('0x63'),_0x4fe3b6[_0x50b6('0x50')],_0x449fac['id']);}logger[_0x50b6('0xb')](_0x50b6('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x50b6('0x22')](_0x50b6('0x64'),_0x7483f8['name']),'trigger:browser:url',{'uri':_0x2c46c9});})[_0x50b6('0x65')](function(_0x1d8b6b){logger[_0x50b6('0x66')](_0x50b6('0x55'),JSON[_0x50b6('0x21')](_0x1d8b6b));});};exports[_0x50b6('0x67')]=function(_0x340cc1,_0x161291,_0x4385cd,_0x276958,_0x494404,_0x221981,_0x5557ed){var _0x26b99e,_0x1a74ef,_0x12ca91,_0x43737c;_0x221981[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x221981[_0x50b6('0x50')]);_0x221981[_0x50b6('0x51')]=intUtil['stripTrailingSlash'](_0x221981[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util['format'](_0x50b6('0x53'),_0x221981[_0x50b6('0x50')]);if(_0x5557ed&&_0x5557ed['recordingFormat']&&_0x5557ed[_0x50b6('0x68')]!==_0x50b6('0x69')){logger[_0x50b6('0xb')](_0x50b6('0x6a'),_0x50b6('0x56'));_0x161291[_0x50b6('0x57')]=util[_0x50b6('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x221981['serverUrl'],_0x161291[_0x50b6('0x59')],md5(_0x161291[_0x50b6('0x59')]));}return getConnection(_0x221981)[_0x50b6('0x29')](function(_0x327e06){_0x43737c=_0x327e06;return getUser(_0x221981,_0x276958['name'],_0x43737c);})[_0x50b6('0x29')](function(_0x19b18d){_0x26b99e=_0x19b18d;logger[_0x50b6('0xb')]('The\x20User\x20ID\x20is:',_0x26b99e['id']);return getEndUser(_0x221981,_0x161291[_0x50b6('0x6b')],_0x161291[_0x50b6('0x6c')],_0x43737c);})[_0x50b6('0x29')](function(_0x25c572){_0x1a74ef=_0x25c572;logger[_0x50b6('0xb')](_0x50b6('0x5d'),_0x1a74ef['id']);return getTicket(_0x221981,_0x26b99e,_0x1a74ef,_0x4385cd,_0x161291,_0x4385cd[_0x50b6('0x6d')],_0x43737c,'Outbound');})[_0x50b6('0x29')](function(_0x4260da){_0x12ca91=_0x4260da;logger[_0x50b6('0xb')](_0x50b6('0x6e'));logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x12ca91['id']);return setRelationship(_0x43737c,_0x26b99e,_0x12ca91,'users');})['then'](function(){return setRelationship(_0x43737c,_0x1a74ef,_0x12ca91,_0x50b6('0x6f'));})['then'](function(){return getServerInfo(_0x43737c);})[_0x50b6('0x29')](function(_0x1fe92c){var _0x38790c=parseInt(_0x1fe92c[_0x50b6('0x70')][_0x50b6('0x61')](0x0));var _0x56266b=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x221981[_0x50b6('0x50')],_0x12ca91['id']);if(_0x38790c>0x6){_0x56266b=util[_0x50b6('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x221981[_0x50b6('0x50')],_0x12ca91['id']);}logger[_0x50b6('0xb')](_0x50b6('0x6a'),_0x50b6('0x71'));emit(util[_0x50b6('0x22')](_0x50b6('0x64'),_0x276958['name']),'trigger:browser:url',{'uri':_0x56266b});})[_0x50b6('0x65')](function(_0x4656c6){logger[_0x50b6('0x66')](_0x50b6('0x6a'),JSON[_0x50b6('0x21')](_0x4656c6));});};exports[_0x50b6('0x72')]=function(_0x1d3ba8,_0x3a99f8,_0x479028,_0x3028bc,_0x390d86,_0x13b69b){var _0x543260,_0x188647,_0x3dceef,_0x54bc36;_0x13b69b[_0x50b6('0x50')]=intUtil['stripTrailingSlash'](_0x13b69b[_0x50b6('0x50')]);_0x13b69b[_0x50b6('0x51')]=intUtil[_0x50b6('0x73')](_0x13b69b[_0x50b6('0x51')]);def[_0x50b6('0x52')]=util[_0x50b6('0x22')](_0x50b6('0x53'),_0x13b69b[_0x50b6('0x50')]);if(_0x390d86&&_0x390d86[_0x50b6('0x54')]){logger[_0x50b6('0xb')]('['+_0x3a99f8['lastevent'][_0x50b6('0x74')]()+']',_0x50b6('0x56'));_0x3a99f8[_0x50b6('0x57')]=util[_0x50b6('0x22')](_0x50b6('0x58'),_0x13b69b[_0x50b6('0x51')],_0x3a99f8[_0x50b6('0x59')],md5(_0x3a99f8['uniqueid']));}else{_0x3a99f8[_0x50b6('0x57')]='';}return getConnection(_0x13b69b)[_0x50b6('0x29')](function(_0x37c623){_0x54bc36=_0x37c623;if(!_[_0x50b6('0x75')](_0x3028bc)){return getUser(_0x13b69b,_0x3028bc[_0x50b6('0xd')],_0x54bc36);}else{return getUser(_0x13b69b,null,_0x54bc36);}})[_0x50b6('0x29')](function(_0x19b399){_0x543260=_0x19b399;logger[_0x50b6('0xb')](_0x50b6('0x5a'),_0x543260['id']);return getEndUser(_0x13b69b,_0x3a99f8['calleridname'],_0x3a99f8[_0x50b6('0x5c')],_0x54bc36);})['then'](function(_0x2938a4){_0x188647=_0x2938a4;logger[_0x50b6('0xb')]('The\x20Enduser\x20ID\x20is:',_0x188647['id']);return getTicket(_0x13b69b,_0x543260,_0x188647,_0x479028,_0x3a99f8,_0x479028['Fields'],_0x54bc36,_0x50b6('0x5e'));})[_0x50b6('0x29')](function(_0x161ecb){_0x3dceef=_0x161ecb;logger[_0x50b6('0xb')](_0x50b6('0x6e'));logger[_0x50b6('0xb')](_0x50b6('0x5f'),_0x3dceef['id']);return setRelationship(_0x54bc36,_0x543260,_0x3dceef,_0x50b6('0x60'));})[_0x50b6('0x29')](function(){return setRelationship(_0x54bc36,_0x188647,_0x3dceef,_0x50b6('0x6f'));})[_0x50b6('0x29')](function(){return getServerInfo(_0x54bc36);})[_0x50b6('0x65')](function(_0x5a1e7a){logger[_0x50b6('0x66')]('['+_0x3a99f8[_0x50b6('0x76')]['toUpperCase']()+']',JSON[_0x50b6('0x21')](_0x5a1e7a));});}; \ 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 0bcfff9..8130a92 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 _0x64c8=['name','format','key','keyType','%s:\x20%s','toLowerCase','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','variable','variableName','toString','customVariable','Variable'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x64c8,0xe4));var _0x864c=function(_0x1f0234,_0x52cbc8){_0x1f0234=_0x1f0234-0x0;var _0x55b9d0=_0x64c8[_0x1f0234];return _0x55b9d0;};'use strict';var _=require(_0x864c('0x0'));var util=require(_0x864c('0x1'));exports[_0x864c('0x2')]=function(_0x5bafad,_0x1f8fa3,_0x8e74ee){var _0x212b60=[];if(_0x5bafad[_0x864c('0x3')]>0x0){var _0x15d469=_['sortBy'](_0x5bafad,['id']);for(var _0x49e7b4=0x0;_0x49e7b4<_0x15d469[_0x864c('0x3')];_0x49e7b4++){var _0x3717af=_0x15d469[_0x49e7b4];if(_0x3717af[_0x864c('0x4')]===_0x864c('0x5')){_0x212b60[_0x864c('0x6')](_0x3717af['content']);}else if(_0x3717af[_0x864c('0x4')]===_0x864c('0x7')&&_0x3717af['variableName']){_0x1f8fa3[_0x3717af[_0x864c('0x8')]]&&_0x212b60[_0x864c('0x6')](_0x1f8fa3[_0x3717af[_0x864c('0x8')]][_0x864c('0x9')]());}else if(_0x3717af['type']===_0x864c('0xa')&&_0x3717af[_0x864c('0xb')]&&_0x3717af[_0x864c('0xb')]['name']){_0x1f8fa3[_0x3717af[_0x864c('0xb')][_0x864c('0xc')]['toLowerCase']()]&&_0x212b60[_0x864c('0x6')](_0x1f8fa3[_0x3717af[_0x864c('0xb')][_0x864c('0xc')]['toLowerCase']()][_0x864c('0x9')]());}else if(_0x3717af[_0x864c('0x4')]==='keyValue'){if(_0x3717af['keyType']===_0x864c('0x5')&&_0x3717af['key']){_0x212b60[_0x864c('0x6')](util[_0x864c('0xd')]('%s:\x20%s',_0x3717af[_0x864c('0xe')],_0x3717af['keyContent']));}else if(_0x3717af[_0x864c('0xf')]===_0x864c('0x7')&&_0x3717af[_0x864c('0x8')]&&_0x3717af[_0x864c('0xe')]){_0x1f8fa3[_0x3717af[_0x864c('0x8')]]&&_0x212b60['push'](util['format'](_0x864c('0x10'),_0x3717af[_0x864c('0xe')],_0x1f8fa3[_0x3717af[_0x864c('0x8')]]));}else if(_0x3717af['keyType']===_0x864c('0xa')&&_0x3717af[_0x864c('0xb')]&&_0x3717af[_0x864c('0xb')][_0x864c('0xc')]&&_0x3717af[_0x864c('0xe')]){_0x1f8fa3[_0x3717af[_0x864c('0xb')][_0x864c('0xc')][_0x864c('0x11')]()]&&_0x212b60[_0x864c('0x6')](util[_0x864c('0xd')](_0x864c('0x10'),_0x3717af[_0x864c('0xe')],_0x1f8fa3[_0x3717af[_0x864c('0xb')][_0x864c('0xc')][_0x864c('0x11')]()]));}}}}return _0x212b60['join'](_0x8e74ee);};exports[_0x864c('0x12')]=function(_0x586638){var _0x8a4028=_0x586638[_0x864c('0x13')](-0x1);if(_0x8a4028==='/'){_0x586638=_0x586638[_0x864c('0x14')](0x0,_0x586638['lastIndexOf'](_0x8a4028));}return _0x586638;};exports[_0x864c('0x15')]=function(_0x54c35e){if(!_[_0x864c('0x16')](_0x54c35e)&&_0x54c35e!==''){var _0x191c48=/^(([^<>()\[\]\\.,;:\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 _0x191c48[_0x864c('0x17')](String(_0x54c35e)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4000=['string','format','%s:\x20%s','keyContent','keyType','key','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','length','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x160b71,_0x2ed489){var _0x32a6e1=function(_0x57c9b3){while(--_0x57c9b3){_0x160b71['push'](_0x160b71['shift']());}};_0x32a6e1(++_0x2ed489);}(_0x4000,0x8e));var _0x0400=function(_0x49e28d,_0x1d73de){_0x49e28d=_0x49e28d-0x0;var _0x1a498f=_0x4000[_0x49e28d];return _0x1a498f;};'use strict';var _=require(_0x0400('0x0'));var util=require('util');exports['getString']=function(_0x40a25a,_0x4d5380,_0x3e46c1){var _0xd131c8=[];if(_0x40a25a[_0x0400('0x1')]>0x0){var _0x1ae487=_['sortBy'](_0x40a25a,['id']);for(var _0x501a28=0x0;_0x501a28<_0x1ae487[_0x0400('0x1')];_0x501a28++){var _0x28e515=_0x1ae487[_0x501a28];if(_0x28e515['type']==='string'){_0xd131c8[_0x0400('0x2')](_0x28e515['content']);}else if(_0x28e515[_0x0400('0x3')]===_0x0400('0x4')&&_0x28e515[_0x0400('0x5')]){_0x4d5380[_0x28e515[_0x0400('0x5')]]&&_0xd131c8[_0x0400('0x2')](_0x4d5380[_0x28e515[_0x0400('0x5')]][_0x0400('0x6')]());}else if(_0x28e515['type']===_0x0400('0x7')&&_0x28e515[_0x0400('0x8')]&&_0x28e515[_0x0400('0x8')]['name']){_0x4d5380[_0x28e515['Variable'][_0x0400('0x9')][_0x0400('0xa')]()]&&_0xd131c8[_0x0400('0x2')](_0x4d5380[_0x28e515['Variable']['name'][_0x0400('0xa')]()][_0x0400('0x6')]());}else if(_0x28e515[_0x0400('0x3')]===_0x0400('0xb')){if(_0x28e515['keyType']===_0x0400('0xc')&&_0x28e515['key']){_0xd131c8['push'](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515['key'],_0x28e515[_0x0400('0xf')]));}else if(_0x28e515[_0x0400('0x10')]===_0x0400('0x4')&&_0x28e515[_0x0400('0x5')]&&_0x28e515[_0x0400('0x11')]){_0x4d5380[_0x28e515[_0x0400('0x5')]]&&_0xd131c8[_0x0400('0x2')](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515['key'],_0x4d5380[_0x28e515[_0x0400('0x5')]]));}else if(_0x28e515[_0x0400('0x10')]===_0x0400('0x7')&&_0x28e515[_0x0400('0x8')]&&_0x28e515[_0x0400('0x8')][_0x0400('0x9')]&&_0x28e515[_0x0400('0x11')]){_0x4d5380[_0x28e515[_0x0400('0x8')][_0x0400('0x9')][_0x0400('0xa')]()]&&_0xd131c8[_0x0400('0x2')](util[_0x0400('0xd')](_0x0400('0xe'),_0x28e515[_0x0400('0x11')],_0x4d5380[_0x28e515[_0x0400('0x8')][_0x0400('0x9')][_0x0400('0xa')]()]));}}}}return _0xd131c8['join'](_0x3e46c1);};exports[_0x0400('0x12')]=function(_0x43a47e){var _0x53542b=_0x43a47e['slice'](-0x1);if(_0x53542b==='/'){_0x43a47e=_0x43a47e['substring'](0x0,_0x43a47e[_0x0400('0x13')](_0x53542b));}return _0x43a47e;};exports[_0x0400('0x14')]=function(_0x3295d2){if(!_[_0x0400('0x15')](_0x3295d2)&&_0x3295d2!==''){var _0x3106bd=/^(([^<>()\[\]\\.,;:\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 _0x3106bd['test'](String(_0x3295d2)[_0x0400('0xa')]());}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 17e8957..e4e89e2 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x28ec5b,_0x545ba4){var _0x4c2e6f=function(_0x19de50){while(--_0x19de50){_0x28ec5b['push'](_0x28ec5b['shift']());}};_0x4c2e6f(++_0x545ba4);}(_0xe706,0xa3));var _0x6e70=function(_0x1efa5c,_0x4deafb){_0x1efa5c=_0x1efa5c-0x0;var _0x4f8376=_0xe706[_0x1efa5c];return _0x4f8376;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2e839b,_0x1c3fe5){var _0x6b275d=function(_0x5e051){while(--_0x5e051){_0x2e839b['push'](_0x2e839b['shift']());}};_0x6b275d(++_0x1c3fe5);}(_0xe706,0xa3));var _0x6e70=function(_0x2020ea,_0x26fc4f){_0x2020ea=_0x2020ea-0x0;var _0x3657fe=_0xe706[_0x2020ea];return _0x3657fe;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 01c369a..aa079c3 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 _0xf9ee=['merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','length','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','GET','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','newTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf9ee,0xd0));var _0xef9e=function(_0x451736,_0x50a871){_0x451736=_0x451736-0x0;var _0x2475d4=_0xf9ee[_0x451736];return _0x2475d4;};'use strict';var _=require(_0xef9e('0x0'));var rp=require(_0xef9e('0x1'));var md5=require(_0xef9e('0x2'));var util=require(_0xef9e('0x3'));var Redis=require('ioredis');var intUtil=require(_0xef9e('0x4'));var config=require(_0xef9e('0x5'));var logger=require('../../../../config/logger')(_0xef9e('0x6'));config['redis']=_[_0xef9e('0x7')](config[_0xef9e('0x8')],{'host':_0xef9e('0x9'),'port':0x18eb});var io=require(_0xef9e('0xa'))(new Redis(config[_0xef9e('0x8')]));function emit(_0x2c3777,_0x44d1c2,_0x41375b){io['to'](_0x2c3777)[_0xef9e('0xb')](_0x44d1c2,_0x41375b);}var headers={'Content-Type':_0xef9e('0xc'),'Accept':_0xef9e('0xc')};function getTicket(_0x547c3d,_0x129fc4,_0x3a5fa3,_0x4bb3a4,_0x39dcf4){logger[_0xef9e('0xd')](_0xef9e('0xe'));return request({'uri':util['format'](_0xef9e('0xf'),_0x547c3d[_0xef9e('0x10')]),'method':_0xef9e('0x11'),'body':{'ticket':_[_0xef9e('0x12')]({'requester_id':_0x3a5fa3['id'],'submitter_id':_0x129fc4?_0x129fc4['id']:undefined,'assignee_id':_0x129fc4?_0x129fc4['id']:undefined,'tags':getTags(_0x4bb3a4[_0xef9e('0x13')],'name'),'subject':intUtil['getString'](_0x4bb3a4[_0xef9e('0x14')],_0x39dcf4,'\x20'),'description':intUtil[_0xef9e('0x15')](_0x4bb3a4[_0xef9e('0x16')],_0x39dcf4,'\x0a'),'comment':{'public':![],'body':intUtil[_0xef9e('0x15')](_0x4bb3a4[_0xef9e('0x16')],_0x39dcf4,'\x0a')}},getCustomFields(_0x4bb3a4[_0xef9e('0x17')],_0x39dcf4))}})[_0xef9e('0x18')](function(_0x552bbf){logger[_0xef9e('0xd')](_0xef9e('0x19'));return _0x552bbf[_0xef9e('0x1a')];});}function getUser(_0x8af7db,_0x4a83a0){if(intUtil[_0xef9e('0x1b')](_0x4a83a0)){logger[_0xef9e('0xd')]('Getting\x20agent\x20with\x20email',_0x4a83a0);return request({'uri':util[_0xef9e('0x1c')](_0xef9e('0x1d'),_0x8af7db['remoteUri']),'qs':{'query':util['format'](_0xef9e('0x1e'),_0x4a83a0)}})[_0xef9e('0x18')](function(_0x501568){if(_0x501568[_0xef9e('0x1f')]){logger[_0xef9e('0xd')](_0xef9e('0x20'));return _['find'](_0x501568['results'],{'email':_0x4a83a0,'role':_0xef9e('0x21')});}else{logger[_0xef9e('0xd')](_0xef9e('0x22'));return request({'uri':util[_0xef9e('0x1c')]('%s/users/me.json',_0x8af7db[_0xef9e('0x10')])})[_0xef9e('0x18')](function(_0x57ff56){logger[_0xef9e('0xd')](_0xef9e('0x23'));return _0x57ff56[_0xef9e('0x24')];});}});}else{logger[_0xef9e('0xd')](_0xef9e('0x22'));return request({'uri':util[_0xef9e('0x1c')]('%s/users/me.json',_0x8af7db[_0xef9e('0x10')])})['then'](function(_0x4bdd7e){logger['info'](_0xef9e('0x23'));return _0x4bdd7e[_0xef9e('0x24')];});}}function getEndUser(_0x4110fd,_0x218876,_0x1a008a){logger[_0xef9e('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1a008a);return request({'uri':util[_0xef9e('0x1c')](_0xef9e('0x1d'),_0x4110fd[_0xef9e('0x10')]),'qs':{'query':util[_0xef9e('0x1c')]('type:user\x20role:end-user\x20phone:%s',_0x1a008a)}})[_0xef9e('0x18')](function(_0x5e40dc){var _0x40058d;if(_0x5e40dc['results'][_0xef9e('0x25')]){_0x5e40dc[_0xef9e('0x26')]=_[_0xef9e('0x27')](_0x5e40dc[_0xef9e('0x26')],{'suspended':![],'role':_0xef9e('0x28')});if(_0x5e40dc['results'][_0xef9e('0x25')]){_0x40058d=_[_0xef9e('0x29')](_0x5e40dc[_0xef9e('0x26')]);}}if(_0x40058d){logger['info'](_0xef9e('0x2a'));return _0x40058d;}else{logger[_0xef9e('0xd')](_0xef9e('0x2b'));return request({'uri':util['format'](_0xef9e('0x2c'),_0x4110fd[_0xef9e('0x10')]),'method':'POST','body':{'user':{'role':_0xef9e('0x28'),'name':util[_0xef9e('0x1c')]('Caller\x20-\x20%s',_0x218876||_0x1a008a),'phone':_0x1a008a}}})[_0xef9e('0x18')](function(_0x2e1d5a){logger[_0xef9e('0xd')](_0xef9e('0x2d'));return _0x2e1d5a[_0xef9e('0x24')];});}});}function getAuth(_0x126630){var _0x46aa2a;if(_0x126630[_0xef9e('0x2e')]===_0xef9e('0x2f')){_0x46aa2a=util[_0xef9e('0x1c')]('%s:%s',_0x126630[_0xef9e('0x30')],_0x126630[_0xef9e('0x2f')]);}else if(_0x126630[_0xef9e('0x2e')]===_0xef9e('0x31')){_0x46aa2a=util[_0xef9e('0x1c')](_0xef9e('0x32'),_0x126630[_0xef9e('0x30')],_0x126630['token']);}return util[_0xef9e('0x1c')](_0xef9e('0x33'),new Buffer(_0x46aa2a)[_0xef9e('0x34')](_0xef9e('0x35')));}function request(_0x3d9ff5){logger[_0xef9e('0x36')](_0xef9e('0x37'),JSON['stringify'](_0x3d9ff5));return rp(_['defaults'](_0x3d9ff5,{'method':_0xef9e('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x37ad16,_0x544a18){var _0x8bde6f=[];if(_0x37ad16&&_0x37ad16[_0xef9e('0x25')]>0x0){_0x8bde6f=_['map'](_0x37ad16,_0x544a18);}return _0x8bde6f;}function getCustomFields(_0x108c3b,_0x418e9b){var _0x946ea5=[];var _0x29bfa2={'custom_fields':[]};if(_0x108c3b['length']>0x0){_[_0xef9e('0x39')](_0x108c3b,function(_0x7e7eb7){if(_[_0xef9e('0x3a')](['string',_0xef9e('0x3b')],_0x7e7eb7[_0xef9e('0x3c')])&&_0x7e7eb7[_0xef9e('0x3d')]&&!_0x7e7eb7[_0xef9e('0x3e')]){_0x29bfa2[_0x7e7eb7['nameField'][_0xef9e('0x3f')]()]=_0x7e7eb7[_0xef9e('0x40')][_0xef9e('0x34')]();}else if(_[_0xef9e('0x3a')]([_0xef9e('0x41'),_0xef9e('0x3b')],_0x7e7eb7[_0xef9e('0x3c')])&&_0x7e7eb7[_0xef9e('0x42')]&&_0x7e7eb7[_0xef9e('0x3e')]){_0x29bfa2[_0xef9e('0x43')][_0xef9e('0x44')]({'id':_0x7e7eb7[_0xef9e('0x42')],'value':_0x7e7eb7[_0xef9e('0x40')][_0xef9e('0x34')]()});}else if(_0x7e7eb7[_0xef9e('0x3c')]===_0xef9e('0x45')&&_0x7e7eb7[_0xef9e('0x46')]&&_0x7e7eb7[_0xef9e('0x42')]&&_0x7e7eb7[_0xef9e('0x3e')]){_0x418e9b[_0x7e7eb7[_0xef9e('0x46')]]&&_0x29bfa2[_0xef9e('0x43')]['push']({'id':_0x7e7eb7[_0xef9e('0x42')],'value':_0x418e9b[_0x7e7eb7[_0xef9e('0x46')]][_0xef9e('0x34')]()});}else if(_0x7e7eb7['type']===_0xef9e('0x47')&&_0x7e7eb7[_0xef9e('0x48')]&&_0x7e7eb7[_0xef9e('0x48')][_0xef9e('0x49')]&&_0x7e7eb7[_0xef9e('0x42')]&&_0x7e7eb7[_0xef9e('0x3e')]){_0x418e9b[_0x7e7eb7[_0xef9e('0x48')][_0xef9e('0x49')]['toLowerCase']()]&&_0x29bfa2[_0xef9e('0x43')][_0xef9e('0x44')]({'id':_0x7e7eb7[_0xef9e('0x42')],'value':_0x418e9b[_0x7e7eb7[_0xef9e('0x48')][_0xef9e('0x49')][_0xef9e('0x3f')]()][_0xef9e('0x34')]()});}});}return _0x29bfa2;}exports[_0xef9e('0x4a')]=function(_0x51dfab,_0x409e5c,_0x43884c,_0x6b4369,_0x16cd91,_0x30fa2e){var _0x39ee0a,_0x3cae70;_0x30fa2e[_0xef9e('0x10')]=intUtil[_0xef9e('0x4b')](_0x30fa2e[_0xef9e('0x10')]);_0x30fa2e[_0xef9e('0x4c')]=intUtil[_0xef9e('0x4b')](_0x30fa2e[_0xef9e('0x4c')]);if(_0x16cd91&&_0x16cd91[_0xef9e('0x4d')]){logger[_0xef9e('0xd')](_0xef9e('0x4e'),'Recording\x20is\x20enabled!');_0x409e5c[_0xef9e('0x4f')]=util[_0xef9e('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30fa2e[_0xef9e('0x4c')],_0x409e5c[_0xef9e('0x50')],md5(_0x409e5c['uniqueid']));}else{_0x409e5c[_0xef9e('0x4f')]='';}headers[_0xef9e('0x51')]=getAuth(_0x30fa2e);return getUser(_0x30fa2e,_0x6b4369['email'])['then'](function(_0x837c5e){_0x39ee0a=_0x837c5e;logger[_0xef9e('0xd')]('The\x20User\x20ID\x20is:',_0x39ee0a['id']);return getEndUser(_0x30fa2e,_0x409e5c[_0xef9e('0x52')],_0x409e5c[_0xef9e('0x53')]);})[_0xef9e('0x18')](function(_0x408389){_0x3cae70=_0x408389;logger['info'](_0xef9e('0x54'),_0x3cae70['id']);return getTicket(_0x30fa2e,_0x39ee0a,_0x3cae70,_0x43884c,_0x409e5c);})[_0xef9e('0x18')](function(_0x10fdd7){if(_0x10fdd7){logger[_0xef9e('0xd')](_0xef9e('0x55'),_0x10fdd7['id']);switch(_0x30fa2e[_0xef9e('0x3c')]){case'integrationTab':logger[_0xef9e('0xd')](_0xef9e('0x4e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xef9e('0x1c')](_0xef9e('0x56'),_0x30fa2e['remoteUri'],_0x39ee0a['id'],_0x10fdd7['id']),'method':'POST'});case'newTab':logger[_0xef9e('0xd')](_0xef9e('0x4e'),_0xef9e('0x57'));emit(util[_0xef9e('0x1c')](_0xef9e('0x58'),_0x6b4369[_0xef9e('0x49')]),_0xef9e('0x59'),{'uri':util[_0xef9e('0x1c')](_0xef9e('0x5a'),_0x30fa2e[_0xef9e('0x10')][_0xef9e('0x5b')](_0xef9e('0x5c'),''),_0x10fdd7['id'])});break;default:logger[_0xef9e('0x5d')](_0xef9e('0x4e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xef9e('0x5e')](function(_0x344c05){logger['error'](_0xef9e('0x5f'),util[_0xef9e('0x60')](_0x344c05,{'showHidden':!![],'depth':null}));});};exports[_0xef9e('0x61')]=function(_0x43967d,_0x265063,_0x34889c,_0x459349,_0x367623,_0x1773ee,_0x57d255){var _0x330092,_0x251d29;_0x1773ee[_0xef9e('0x10')]=intUtil[_0xef9e('0x4b')](_0x1773ee[_0xef9e('0x10')]);_0x1773ee['serverUrl']=intUtil[_0xef9e('0x4b')](_0x1773ee[_0xef9e('0x4c')]);if(_0x57d255&&_0x57d255[_0xef9e('0x62')]&&_0x57d255[_0xef9e('0x62')]!=='none'){logger[_0xef9e('0xd')](_0xef9e('0x63'),'Recording\x20is\x20enabled!');_0x265063[_0xef9e('0x4f')]=util[_0xef9e('0x1c')](_0xef9e('0x64'),_0x1773ee[_0xef9e('0x4c')],_0x265063['uniqueid'],md5(_0x265063[_0xef9e('0x50')]));}headers[_0xef9e('0x51')]=getAuth(_0x1773ee);return getUser(_0x1773ee,_0x459349[_0xef9e('0x65')])['then'](function(_0x2f94d4){_0x330092=_0x2f94d4;logger[_0xef9e('0xd')]('The\x20User\x20ID\x20is:',_0x330092['id']);return getEndUser(_0x1773ee,_0x265063[_0xef9e('0x66')],_0x265063[_0xef9e('0x67')]);})[_0xef9e('0x18')](function(_0x2ecea3){_0x251d29=_0x2ecea3;logger[_0xef9e('0xd')](_0xef9e('0x54'),_0x251d29['id']);return getTicket(_0x1773ee,_0x330092,_0x251d29,_0x34889c,_0x265063);})['then'](function(_0x2c72ae){if(_0x2c72ae){logger['info'](_0xef9e('0x55'),_0x2c72ae['id']);switch(_0x1773ee[_0xef9e('0x3c')]){case'integrationTab':logger['info']('[OUTBOUND]',_0xef9e('0x68'));return request({'uri':util[_0xef9e('0x1c')](_0xef9e('0x56'),_0x1773ee[_0xef9e('0x10')],_0x330092['id'],_0x2c72ae['id']),'method':_0xef9e('0x11')});case _0xef9e('0x69'):logger['info']('[OUTBOUND]',_0xef9e('0x57'));emit(util[_0xef9e('0x1c')]('user:%s',_0x459349[_0xef9e('0x49')]),_0xef9e('0x59'),{'uri':util[_0xef9e('0x1c')](_0xef9e('0x5a'),_0x1773ee[_0xef9e('0x10')][_0xef9e('0x5b')](_0xef9e('0x5c'),''),_0x2c72ae['id'])});break;default:logger['error'](_0xef9e('0x63'),_0xef9e('0x6a'));}}})['catch'](function(_0x7146c0){logger[_0xef9e('0x5d')](_0xef9e('0x6b'),util[_0xef9e('0x60')](_0x7146c0,{'showHidden':!![],'depth':null}));});};exports[_0xef9e('0x6c')]=function(_0x20d12a,_0x5b94b6,_0x53a5ad,_0x378f21,_0x31b847,_0xf5bdef){var _0xa8bd6a,_0x36dec3;_0xf5bdef['remoteUri']=intUtil[_0xef9e('0x4b')](_0xf5bdef['remoteUri']);_0xf5bdef[_0xef9e('0x4c')]=intUtil[_0xef9e('0x4b')](_0xf5bdef[_0xef9e('0x4c')]);if(_0x31b847&&_0x31b847['monitor_format']){logger[_0xef9e('0xd')]('['+_0x5b94b6['lastevent'][_0xef9e('0x6d')]()+']',_0xef9e('0x6e'));_0x5b94b6[_0xef9e('0x4f')]=util[_0xef9e('0x1c')](_0xef9e('0x64'),_0xf5bdef[_0xef9e('0x4c')],_0x5b94b6[_0xef9e('0x50')],md5(_0x5b94b6[_0xef9e('0x50')]));}else{_0x5b94b6[_0xef9e('0x4f')]='';}headers[_0xef9e('0x51')]=getAuth(_0xf5bdef);return getUser(_0xf5bdef)[_0xef9e('0x18')](function(_0x568a17){_0xa8bd6a=_0x568a17;logger[_0xef9e('0xd')]('The\x20User\x20ID\x20is:',_0xa8bd6a['id']);return getEndUser(_0xf5bdef,_0x5b94b6[_0xef9e('0x52')],_0x5b94b6[_0xef9e('0x53')]);})[_0xef9e('0x18')](function(_0x3ebb34){_0x36dec3=_0x3ebb34;logger[_0xef9e('0xd')](_0xef9e('0x54'),_0x36dec3['id']);return getTicket(_0xf5bdef,_0xa8bd6a,_0x36dec3,_0x53a5ad,_0x5b94b6);})[_0xef9e('0x18')](function(_0x1642ac){if(_0x1642ac){logger[_0xef9e('0xd')](_0xef9e('0x55'),_0x1642ac['id']);}})[_0xef9e('0x5e')](function(_0x2637f4){logger['error']('['+_0x5b94b6[_0xef9e('0x6f')][_0xef9e('0x6d')]()+']'+_0xef9e('0x70'),util['inspect'](_0x2637f4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x78d5=['The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','toUpperCase','Recording\x20is\x20enabled!','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','user','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','idField','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x78d5,0x8b));var _0x578d=function(_0x3b283f,_0x42f000){_0x3b283f=_0x3b283f-0x0;var _0x3cb345=_0x78d5[_0x3b283f];return _0x3cb345;};'use strict';var _=require(_0x578d('0x0'));var rp=require(_0x578d('0x1'));var md5=require(_0x578d('0x2'));var util=require(_0x578d('0x3'));var Redis=require('ioredis');var intUtil=require(_0x578d('0x4'));var config=require(_0x578d('0x5'));var logger=require(_0x578d('0x6'))('zendesk');config[_0x578d('0x7')]=_[_0x578d('0x8')](config[_0x578d('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x578d('0x7')]));function emit(_0x3b5a65,_0x47799e,_0x3762c8){io['to'](_0x3b5a65)[_0x578d('0x9')](_0x47799e,_0x3762c8);}var headers={'Content-Type':_0x578d('0xa'),'Accept':_0x578d('0xa')};function getTicket(_0x287576,_0x350ae3,_0x11d7b8,_0x74e160,_0x591cf0){logger[_0x578d('0xb')](_0x578d('0xc'));return request({'uri':util[_0x578d('0xd')](_0x578d('0xe'),_0x287576[_0x578d('0xf')]),'method':_0x578d('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x11d7b8['id'],'submitter_id':_0x350ae3?_0x350ae3['id']:undefined,'assignee_id':_0x350ae3?_0x350ae3['id']:undefined,'tags':getTags(_0x74e160[_0x578d('0x11')],_0x578d('0x12')),'subject':intUtil[_0x578d('0x13')](_0x74e160[_0x578d('0x14')],_0x591cf0,'\x20'),'description':intUtil[_0x578d('0x13')](_0x74e160[_0x578d('0x15')],_0x591cf0,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x74e160[_0x578d('0x15')],_0x591cf0,'\x0a')}},getCustomFields(_0x74e160[_0x578d('0x16')],_0x591cf0))}})[_0x578d('0x17')](function(_0xb34f17){logger['info']('Ticket\x20created!');return _0xb34f17[_0x578d('0x18')];});}function getUser(_0x513351,_0x31cbfc){if(intUtil[_0x578d('0x19')](_0x31cbfc)){logger['info']('Getting\x20agent\x20with\x20email',_0x31cbfc);return request({'uri':util['format']('%s/search.json',_0x513351[_0x578d('0xf')]),'qs':{'query':util['format'](_0x578d('0x1a'),_0x31cbfc)}})['then'](function(_0x51f3dc){if(_0x51f3dc['count']){logger['info']('Agent\x20found!');return _[_0x578d('0x1b')](_0x51f3dc[_0x578d('0x1c')],{'email':_0x31cbfc,'role':_0x578d('0x1d')});}else{logger[_0x578d('0xb')](_0x578d('0x1e'));return request({'uri':util[_0x578d('0xd')](_0x578d('0x1f'),_0x513351['remoteUri'])})[_0x578d('0x17')](function(_0x7eaf6){logger[_0x578d('0xb')](_0x578d('0x20'));return _0x7eaf6['user'];});}});}else{logger['info'](_0x578d('0x1e'));return request({'uri':util[_0x578d('0xd')]('%s/users/me.json',_0x513351[_0x578d('0xf')])})[_0x578d('0x17')](function(_0x506cb4){logger['info'](_0x578d('0x20'));return _0x506cb4['user'];});}}function getEndUser(_0x4fbbdf,_0x100577,_0x4455bb){logger[_0x578d('0xb')](_0x578d('0x21'),_0x4455bb);return request({'uri':util['format'](_0x578d('0x22'),_0x4fbbdf[_0x578d('0xf')]),'qs':{'query':util[_0x578d('0xd')](_0x578d('0x23'),_0x4455bb)}})[_0x578d('0x17')](function(_0x19e4de){var _0x23de8f;if(_0x19e4de[_0x578d('0x1c')][_0x578d('0x24')]){_0x19e4de['results']=_[_0x578d('0x25')](_0x19e4de[_0x578d('0x1c')],{'suspended':![],'role':_0x578d('0x26')});if(_0x19e4de[_0x578d('0x1c')][_0x578d('0x24')]){_0x23de8f=_[_0x578d('0x27')](_0x19e4de[_0x578d('0x1c')]);}}if(_0x23de8f){logger['info'](_0x578d('0x28'));return _0x23de8f;}else{logger[_0x578d('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x578d('0x29'),_0x4fbbdf['remoteUri']),'method':_0x578d('0x10'),'body':{'user':{'role':_0x578d('0x26'),'name':util[_0x578d('0xd')](_0x578d('0x2a'),_0x100577||_0x4455bb),'phone':_0x4455bb}}})[_0x578d('0x17')](function(_0x3e8435){logger[_0x578d('0xb')](_0x578d('0x2b'));return _0x3e8435[_0x578d('0x2c')];});}});}function getAuth(_0xef9dd2){var _0x4e8133;if(_0xef9dd2[_0x578d('0x2d')]==='password'){_0x4e8133=util[_0x578d('0xd')](_0x578d('0x2e'),_0xef9dd2[_0x578d('0x2f')],_0xef9dd2[_0x578d('0x30')]);}else if(_0xef9dd2[_0x578d('0x2d')]===_0x578d('0x31')){_0x4e8133=util[_0x578d('0xd')]('%s/token:%s',_0xef9dd2[_0x578d('0x2f')],_0xef9dd2[_0x578d('0x31')]);}return util[_0x578d('0xd')](_0x578d('0x32'),new Buffer(_0x4e8133)[_0x578d('0x33')](_0x578d('0x34')));}function request(_0x110295){logger[_0x578d('0x35')](_0x578d('0x36'),JSON['stringify'](_0x110295));return rp(_[_0x578d('0x8')](_0x110295,{'method':_0x578d('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x2f1fc0,_0x4c3839){var _0x4f89ca=[];if(_0x2f1fc0&&_0x2f1fc0['length']>0x0){_0x4f89ca=_[_0x578d('0x38')](_0x2f1fc0,_0x4c3839);}return _0x4f89ca;}function getCustomFields(_0x2b06ea,_0x70787a){var _0x5e9720=[];var _0x19d4f5={'custom_fields':[]};if(_0x2b06ea[_0x578d('0x24')]>0x0){_['forEach'](_0x2b06ea,function(_0x317741){if(_[_0x578d('0x39')]([_0x578d('0x3a'),_0x578d('0x3b')],_0x317741[_0x578d('0x3c')])&&_0x317741[_0x578d('0x3d')]&&!_0x317741[_0x578d('0x3e')]){_0x19d4f5[_0x317741[_0x578d('0x3d')][_0x578d('0x3f')]()]=_0x317741[_0x578d('0x40')][_0x578d('0x33')]();}else if(_[_0x578d('0x39')](['string',_0x578d('0x3b')],_0x317741[_0x578d('0x3c')])&&_0x317741['idField']&&_0x317741['customField']){_0x19d4f5[_0x578d('0x41')]['push']({'id':_0x317741[_0x578d('0x42')],'value':_0x317741[_0x578d('0x40')]['toString']()});}else if(_0x317741[_0x578d('0x3c')]===_0x578d('0x43')&&_0x317741[_0x578d('0x44')]&&_0x317741['idField']&&_0x317741[_0x578d('0x3e')]){_0x70787a[_0x317741[_0x578d('0x44')]]&&_0x19d4f5['custom_fields'][_0x578d('0x45')]({'id':_0x317741['idField'],'value':_0x70787a[_0x317741[_0x578d('0x44')]][_0x578d('0x33')]()});}else if(_0x317741[_0x578d('0x3c')]===_0x578d('0x46')&&_0x317741['Variable']&&_0x317741[_0x578d('0x47')][_0x578d('0x12')]&&_0x317741[_0x578d('0x42')]&&_0x317741['customField']){_0x70787a[_0x317741['Variable'][_0x578d('0x12')][_0x578d('0x3f')]()]&&_0x19d4f5['custom_fields'][_0x578d('0x45')]({'id':_0x317741[_0x578d('0x42')],'value':_0x70787a[_0x317741['Variable']['name']['toLowerCase']()][_0x578d('0x33')]()});}});}return _0x19d4f5;}exports['queue']=function(_0x4b3bb5,_0x3f3248,_0x377f34,_0x57e6cf,_0x297b68,_0x4f2305){var _0x53762a,_0xdc9ab8;_0x4f2305['remoteUri']=intUtil[_0x578d('0x48')](_0x4f2305[_0x578d('0xf')]);_0x4f2305[_0x578d('0x49')]=intUtil['stripTrailingSlash'](_0x4f2305[_0x578d('0x49')]);if(_0x297b68&&_0x297b68[_0x578d('0x4a')]){logger[_0x578d('0xb')](_0x578d('0x4b'),'Recording\x20is\x20enabled!');_0x3f3248[_0x578d('0x4c')]=util[_0x578d('0xd')](_0x578d('0x4d'),_0x4f2305['serverUrl'],_0x3f3248[_0x578d('0x4e')],md5(_0x3f3248['uniqueid']));}else{_0x3f3248[_0x578d('0x4c')]='';}headers[_0x578d('0x4f')]=getAuth(_0x4f2305);return getUser(_0x4f2305,_0x57e6cf[_0x578d('0x50')])['then'](function(_0x46dab7){_0x53762a=_0x46dab7;logger['info'](_0x578d('0x51'),_0x53762a['id']);return getEndUser(_0x4f2305,_0x3f3248['calleridname'],_0x3f3248[_0x578d('0x52')]);})[_0x578d('0x17')](function(_0x249e2d){_0xdc9ab8=_0x249e2d;logger[_0x578d('0xb')](_0x578d('0x53'),_0xdc9ab8['id']);return getTicket(_0x4f2305,_0x53762a,_0xdc9ab8,_0x377f34,_0x3f3248);})['then'](function(_0x40e150){if(_0x40e150){logger['info'](_0x578d('0x54'),_0x40e150['id']);switch(_0x4f2305[_0x578d('0x3c')]){case _0x578d('0x55'):logger['info'](_0x578d('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4f2305[_0x578d('0xf')],_0x53762a['id'],_0x40e150['id']),'method':_0x578d('0x10')});case _0x578d('0x56'):logger['info'](_0x578d('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x578d('0xd')](_0x578d('0x57'),_0x57e6cf[_0x578d('0x12')]),_0x578d('0x58'),{'uri':util['format'](_0x578d('0x59'),_0x4f2305['remoteUri'][_0x578d('0x5a')](_0x578d('0x5b'),''),_0x40e150['id'])});break;default:logger[_0x578d('0x5c')](_0x578d('0x4b'),_0x578d('0x5d'));}}})[_0x578d('0x5e')](function(_0x452c0d){logger[_0x578d('0x5c')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x578d('0x5f')](_0x452c0d,{'showHidden':!![],'depth':null}));});};exports[_0x578d('0x60')]=function(_0x124b92,_0x278a37,_0x6f394,_0x46cd4f,_0x2f86d4,_0x3ab88b,_0x3e976e){var _0x4fad99,_0x5c267c;_0x3ab88b['remoteUri']=intUtil[_0x578d('0x48')](_0x3ab88b['remoteUri']);_0x3ab88b[_0x578d('0x49')]=intUtil[_0x578d('0x48')](_0x3ab88b['serverUrl']);if(_0x3e976e&&_0x3e976e[_0x578d('0x61')]&&_0x3e976e[_0x578d('0x61')]!==_0x578d('0x62')){logger[_0x578d('0xb')](_0x578d('0x63'),'Recording\x20is\x20enabled!');_0x278a37['recordingURL']=util[_0x578d('0xd')](_0x578d('0x4d'),_0x3ab88b[_0x578d('0x49')],_0x278a37['uniqueid'],md5(_0x278a37['uniqueid']));}headers[_0x578d('0x4f')]=getAuth(_0x3ab88b);return getUser(_0x3ab88b,_0x46cd4f[_0x578d('0x50')])[_0x578d('0x17')](function(_0x2fd136){_0x4fad99=_0x2fd136;logger[_0x578d('0xb')](_0x578d('0x51'),_0x4fad99['id']);return getEndUser(_0x3ab88b,_0x278a37[_0x578d('0x64')],_0x278a37[_0x578d('0x65')]);})['then'](function(_0x3e71e3){_0x5c267c=_0x3e71e3;logger[_0x578d('0xb')](_0x578d('0x53'),_0x5c267c['id']);return getTicket(_0x3ab88b,_0x4fad99,_0x5c267c,_0x6f394,_0x278a37);})[_0x578d('0x17')](function(_0x337a37){if(_0x337a37){logger[_0x578d('0xb')]('The\x20Ticket\x20ID\x20is:',_0x337a37['id']);switch(_0x3ab88b[_0x578d('0x3c')]){case _0x578d('0x55'):logger[_0x578d('0xb')](_0x578d('0x63'),_0x578d('0x66'));return request({'uri':util[_0x578d('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3ab88b[_0x578d('0xf')],_0x4fad99['id'],_0x337a37['id']),'method':_0x578d('0x10')});case'newTab':logger[_0x578d('0xb')](_0x578d('0x63'),_0x578d('0x67'));emit(util[_0x578d('0xd')]('user:%s',_0x46cd4f[_0x578d('0x12')]),'trigger:browser:url',{'uri':util['format'](_0x578d('0x59'),_0x3ab88b[_0x578d('0xf')][_0x578d('0x5a')](_0x578d('0x5b'),''),_0x337a37['id'])});break;default:logger[_0x578d('0x5c')](_0x578d('0x63'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x578d('0x5e')](function(_0x54fc88){logger[_0x578d('0x5c')](_0x578d('0x68'),util[_0x578d('0x5f')](_0x54fc88,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x567e57,_0x376c27,_0x68513a,_0x2c68b5,_0x419cb6,_0x2378df){var _0xcb7718,_0x41b6b1;_0x2378df[_0x578d('0xf')]=intUtil[_0x578d('0x48')](_0x2378df[_0x578d('0xf')]);_0x2378df['serverUrl']=intUtil[_0x578d('0x48')](_0x2378df['serverUrl']);if(_0x419cb6&&_0x419cb6[_0x578d('0x4a')]){logger[_0x578d('0xb')]('['+_0x376c27['lastevent'][_0x578d('0x69')]()+']',_0x578d('0x6a'));_0x376c27[_0x578d('0x4c')]=util[_0x578d('0xd')](_0x578d('0x4d'),_0x2378df[_0x578d('0x49')],_0x376c27['uniqueid'],md5(_0x376c27[_0x578d('0x4e')]));}else{_0x376c27[_0x578d('0x4c')]='';}headers[_0x578d('0x4f')]=getAuth(_0x2378df);return getUser(_0x2378df)[_0x578d('0x17')](function(_0x1f88e0){_0xcb7718=_0x1f88e0;logger[_0x578d('0xb')](_0x578d('0x51'),_0xcb7718['id']);return getEndUser(_0x2378df,_0x376c27[_0x578d('0x6b')],_0x376c27[_0x578d('0x52')]);})[_0x578d('0x17')](function(_0x3d443f){_0x41b6b1=_0x3d443f;logger['info'](_0x578d('0x53'),_0x41b6b1['id']);return getTicket(_0x2378df,_0xcb7718,_0x41b6b1,_0x68513a,_0x376c27);})[_0x578d('0x17')](function(_0x4ee8a5){if(_0x4ee8a5){logger[_0x578d('0xb')](_0x578d('0x54'),_0x4ee8a5['id']);}})[_0x578d('0x5e')](function(_0xad1821){logger['error']('['+_0x376c27[_0x578d('0x6c')][_0x578d('0x69')]()+']'+_0x578d('0x6d'),util[_0x578d('0x5f')](_0xad1821,{'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 b0a6b51..44c4eec 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 _0x5dd2=['toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','add','seconds','catch','error','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','connect','Answered','rejected','Rejected','Abandoned','Call_Result','Timeout','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','The\x20Call\x20ID\x20is:','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','toUpperCase','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','calleridnum','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','debug','length','includes','picklist','idField','content','toString','type','variable','customVariable','Variable','name'];(function(_0x2b8862,_0x22c1c0){var _0x41983d=function(_0x1e1deb){while(--_0x1e1deb){_0x2b8862['push'](_0x2b8862['shift']());}};_0x41983d(++_0x22c1c0);}(_0x5dd2,0x1a7));var _0x25dd=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x5dd2[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x25dd('0x0'));var rp=require('request-promise');var md5=require(_0x25dd('0x1'));var util=require('util');var intUtil=require(_0x25dd('0x2'));var moment=require(_0x25dd('0x3'));var Redis=require(_0x25dd('0x4'));var BPromise=require(_0x25dd('0x5'));var config=require(_0x25dd('0x6'));var logger=require('../../../../config/logger')(_0x25dd('0x7'));config['redis']=_[_0x25dd('0x8')](config[_0x25dd('0x9')],{'host':_0x25dd('0xa'),'port':0x18eb});var io=require(_0x25dd('0xb'))(new Redis(config[_0x25dd('0x9')]));function emit(_0x362dd0,_0x1fc3aa,_0x2ca243){io['to'](_0x362dd0)['emit'](_0x1fc3aa,_0x2ca243);}function request(_0x805229){logger[_0x25dd('0xc')]('[HTTP]',JSON['stringify'](_0x805229));return rp(_0x805229);}function getCustomFields(_0x3a58c2,_0x274864){var _0x156714={};if(_0x3a58c2[_0x25dd('0xd')]>0x0){_['forEach'](_0x3a58c2,function(_0x5d5d90){if(_[_0x25dd('0xe')](['string',_0x25dd('0xf')],_0x5d5d90['type'])&&_0x5d5d90[_0x25dd('0x10')]){_0x156714[_0x5d5d90[_0x25dd('0x10')]]=_0x5d5d90[_0x25dd('0x11')][_0x25dd('0x12')]();}else if(_0x5d5d90[_0x25dd('0x13')]===_0x25dd('0x14')&&_0x5d5d90['variableName']&&_0x5d5d90[_0x25dd('0x10')]&&_0x274864[_0x5d5d90['variableName']]){_0x156714[_0x5d5d90[_0x25dd('0x10')]]=_0x274864[_0x5d5d90['variableName']]['toString']();}else if(_0x5d5d90[_0x25dd('0x13')]===_0x25dd('0x15')&&_0x5d5d90['Variable']&&_0x5d5d90[_0x25dd('0x16')][_0x25dd('0x17')]&&_0x5d5d90[_0x25dd('0x10')]&&_0x274864[_0x5d5d90[_0x25dd('0x16')]['name'][_0x25dd('0x18')]()]){_0x156714[_0x5d5d90[_0x25dd('0x10')]]=_0x274864[_0x5d5d90[_0x25dd('0x16')]['name'][_0x25dd('0x18')]()][_0x25dd('0x12')]();}});}return _0x156714;}function getName(_0xcf40a3){if(_0xcf40a3[_0x25dd('0x19')]('\x20')>0x0){var _0x27bf58=_0xcf40a3['split'](/ (.+)/);if(_0x27bf58[0x1]){return _0x27bf58;}}return[_0xcf40a3,_0xcf40a3];}var accountsTokens={};function getAccessToken(_0xf51101){return new Promise(function(_0x562f5d,_0xd9ff90){if(!_[_0x25dd('0x1a')](accountsTokens[_0xf51101['id']])&&!_['isNil'](accountsTokens[_0xf51101['id']][_0x25dd('0x1b')])){if(moment()[_0x25dd('0x1c')](accountsTokens[_0xf51101['id']][_0x25dd('0x1d')])){_0x562f5d(accountsTokens[_0xf51101['id']][_0x25dd('0x1b')]);}}var _0x5a972f;switch(_0xf51101[_0x25dd('0x1e')]){case'US':_0x5a972f='https://accounts.zoho.com';break;case'AU':_0x5a972f='https://accounts.zoho.com.au';break;case'EU':_0x5a972f=_0x25dd('0x1f');break;case'IN':_0x5a972f=_0x25dd('0x20');break;case'CN':_0x5a972f='https://accounts.zoho.com.cn';break;default:_0x5a972f=_0x25dd('0x1f');break;}var _0x2486bc={'method':_0x25dd('0x21'),'uri':_0x5a972f+_0x25dd('0x22'),'qs':{'refresh_token':_0xf51101[_0x25dd('0x23')],'client_id':_0xf51101['clientId'],'client_secret':_0xf51101[_0x25dd('0x24')],'grant_type':_0x25dd('0x25')},'json':!![]};return rp(_0x2486bc)['then'](function(_0x395f59){accountsTokens[_0xf51101['id']]={'access_token':_0x395f59[_0x25dd('0x1b')],'expires_in':moment()[_0x25dd('0x26')](_0x395f59[_0x25dd('0x1d')],_0x25dd('0x27'))};_0x562f5d(_0x395f59[_0x25dd('0x1b')]);})[_0x25dd('0x28')](function(_0x5de3e4){logger[_0x25dd('0x29')]('Failing\x20creating\x20the\x20access_token',_0x5de3e4[_0x25dd('0x2a')]);_0xd9ff90(_0x5de3e4);});});}function getUser(_0x394877,_0x262a79,_0x1a8532,_0x26ae27){logger[_0x25dd('0x2b')](_0x25dd('0x2c'));return request({'method':'GET','uri':util[_0x25dd('0x2d')](_0x25dd('0x2e'),_0x262a79),'qs':{'type':_0x25dd('0x2f')},'headers':{'Authorization':_0x25dd('0x30')+_0x394877},'json':!![]})[_0x25dd('0x31')](function(_0x113841){if(_0x113841[_0x25dd('0x32')]){var _0x449636=-0x1;if(_[_0x25dd('0x33')](_0x113841[_0x25dd('0x32')])){if(!_['isNil'](_0x26ae27)){_0x449636=_['findIndex'](_0x113841['users'],function(_0x1c797c){return _0x1c797c[_0x25dd('0x34')]===_0x26ae27;});}if(_0x449636>=0x0){logger[_0x25dd('0x2b')](_0x25dd('0x35'));}else{logger[_0x25dd('0x2b')](_0x25dd('0x36'));_0x449636=_[_0x25dd('0x37')](_0x113841[_0x25dd('0x32')],function(_0x57f7f7){return _0x57f7f7[_0x25dd('0x38')]['name']===_0x25dd('0x39');});}return _0x113841['users'][_0x449636];}else{if(_0x113841[_0x25dd('0x3a')][_0x25dd('0x38')][_0x25dd('0x17')]===_0x25dd('0x39')){logger['info'](_0x25dd('0x36'));user=_0x113841[_0x25dd('0x3a')];return user;}else{logger[_0x25dd('0x29')](_0x25dd('0x3b'),JSON[_0x25dd('0x3c')](_0x113841));throw new Error(_0x25dd('0x3d')+JSON[_0x25dd('0x3c')](_0x113841));}}}else{logger[_0x25dd('0x29')](_0x25dd('0x3b'),JSON[_0x25dd('0x3c')](_0x113841));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x113841));}})[_0x25dd('0x28')](function(_0x1eb950){console[_0x25dd('0x29')](_0x1eb950);});}function getZohoUser(_0x322468,_0x2c39fc){return new BPromise(function(_0x41a362,_0x5180d5){request(_0x322468)[_0x25dd('0x31')](function(_0x27f06e){var _0x5371a0=null;if(_0x27f06e){_0x5371a0=_0x27f06e[_0x25dd('0x3e')][0x0];_0x5371a0[_0x25dd('0x3f')]=_0x2c39fc;}_0x41a362(_0x5371a0);})['catch'](function(_0x125258){_0x5180d5(_0x125258);});});}function createEndUser(_0x141516,_0x559907,_0x1afc85,_0x412086,_0x85fa86,_0x592aa9){var _0x1afc85=getName(_0x1afc85);return request({'method':_0x25dd('0x21'),'uri':_0x25dd('0x40')+_0x559907+'/crm/v2/'+_['startCase'](_0x592aa9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1afc85[0x1],'First_Name':_0x1afc85[0x0],'Phone':_0x412086,'Owner':{'name':!_[_0x25dd('0x1a')](_0x85fa86[_0x25dd('0x41')][_0x25dd('0x17')])?_0x85fa86[_0x25dd('0x41')]['name']:!_['isNil'](_0x85fa86[_0x25dd('0x42')])?_0x85fa86['first_name']+'\x20'+_0x85fa86[_0x25dd('0x43')]:_0x85fa86[_0x25dd('0x43')],'id':_0x85fa86['id']}}]},'headers':{'Authorization':_0x25dd('0x30')+_0x141516},'json':!![]})['then'](function(_0x5f376f){if(_0x5f376f&&_0x5f376f[_0x25dd('0x3e')][0x0][_0x25dd('0x44')]===_0x25dd('0x45')){var _0x33b901=_0x5f376f[_0x25dd('0x3e')][0x0][_0x25dd('0x46')];_0x33b901['enduserType']=_[_0x25dd('0x47')](_0x592aa9['moduleCreate'])+'s';return _0x33b901;}logger['error'](_0x25dd('0x3b'),JSON[_0x25dd('0x3c')](data));throw new Error(_0x25dd('0x48')+JSON[_0x25dd('0x3c')](data));})['catch'](function(_0x500fe7){console[_0x25dd('0x49')]('CREATE\x20ERROR',_0x500fe7);});}function getEndUser(_0xc2f5c3,_0x5c9464,_0x57efbd,_0x590ace,_0x53574f,_0x11b667,_0x5625e7){var _0x5f442a={'method':'GET','uri':'','headers':{'Authorization':_0x25dd('0x30')+_0xc2f5c3},'json':!![]};switch(_0x5625e7[_0x25dd('0x4a')]){case'contact_lead':_0x5f442a['uri']='https://www.zohoapis.'+_0x5c9464+_0x25dd('0x4b')+_0x53574f+'))';return getZohoUser(_0x5f442a,_0x25dd('0x4c'))[_0x25dd('0x31')](function(_0x2ad2eb){if(_0x2ad2eb)return _0x2ad2eb;_0x5f442a[_0x25dd('0x4d')]=_0x25dd('0x40')+_0x5c9464+_0x25dd('0x4e')+_0x53574f+'))';return getZohoUser(_0x5f442a,_0x25dd('0x4f'))['then'](function(_0x34113f){if(_0x34113f)return _0x34113f;if(_0x5625e7[_0x25dd('0x50')]!=_0x25dd('0x51')){return createEndUser(_0xc2f5c3,_0x5c9464,_0x590ace,_0x53574f,_0x11b667,_0x5625e7);}else{return{};}});});break;case _0x25dd('0x52'):_0x5f442a[_0x25dd('0x4d')]=_0x25dd('0x40')+_0x5c9464+_0x25dd('0x4b')+_0x53574f+'))';return getZohoUser(_0x5f442a,_0x25dd('0x4c'))[_0x25dd('0x31')](function(_0xd29c81){if(_0xd29c81)return _0xd29c81;if(_0x5625e7[_0x25dd('0x50')]!=_0x25dd('0x51')){return createEndUser(_0xc2f5c3,_0x5c9464,_0x590ace,_0x53574f,_0x11b667,_0x5625e7);}else{return{};}});break;case _0x25dd('0x53'):_0x5f442a[_0x25dd('0x4d')]=_0x25dd('0x40')+_0x5c9464+_0x25dd('0x4e')+_0x53574f+'))';return getZohoUser(_0x5f442a,_0x25dd('0x4f'))['then'](function(_0x2dfe5a){if(_0x2dfe5a)return _0x2dfe5a;if(_0x5625e7[_0x25dd('0x50')]!=_0x25dd('0x51')){return createEndUser(_0xc2f5c3,_0x5c9464,_0x590ace,_0x53574f,_0x11b667,_0x5625e7);}else{return{};}});break;}}function getCall(_0x45e054,_0x188f39,_0x17e9fa,_0x3c6c90,_0x46d9b2,_0x1b2b0f,_0x4f4698,_0x311c0c){logger[_0x25dd('0x2b')](_0x25dd('0x54'));var _0x5163fa={};_0x5163fa[_0x25dd('0x55')]={'name':!_['isNil'](_0x3c6c90[_0x25dd('0x41')][_0x25dd('0x17')])&&!_[_0x25dd('0x1a')](_0x3c6c90[_0x25dd('0x38')][_0x25dd('0x17')])&&_0x3c6c90['profile'][_0x25dd('0x17')]===_0x25dd('0x56')?_0x3c6c90[_0x25dd('0x41')][_0x25dd('0x17')]:!_[_0x25dd('0x1a')](_0x3c6c90[_0x25dd('0x42')])?_0x3c6c90['first_name']+'\x20'+_0x3c6c90[_0x25dd('0x43')]:_0x3c6c90[_0x25dd('0x43')],'id':_0x3c6c90['id']};_0x5163fa[_0x25dd('0x57')]=intUtil[_0x25dd('0x58')](_0x1b2b0f['Subjects'],_0x4f4698,'\x20');_0x5163fa[_0x25dd('0x59')]=intUtil[_0x25dd('0x58')](_0x1b2b0f[_0x25dd('0x5a')],_0x4f4698,'\x0a');if(_0x46d9b2[_0x25dd('0x3f')]===_0x25dd('0x4c')){_0x5163fa[_0x25dd('0x5b')]={'name':!_[_0x25dd('0x1a')](_0x46d9b2[_0x25dd('0x5c')])?_0x46d9b2[_0x25dd('0x5c')]:!_[_0x25dd('0x1a')](_0x46d9b2['First_Name'])?_0x46d9b2[_0x25dd('0x5d')]+'\x20'+_0x46d9b2['Last_Name']:_0x46d9b2['Last_Name'],'id':_0x46d9b2['id']};}if(_0x46d9b2['enduserType']==='Leads'){_0x5163fa[_0x25dd('0x5e')]={'name':!_['isNil'](_0x46d9b2[_0x25dd('0x5c')])?_0x46d9b2[_0x25dd('0x5c')]:!_[_0x25dd('0x1a')](_0x46d9b2['First_Name'])?_0x46d9b2[_0x25dd('0x5d')]+'\x20'+_0x46d9b2[_0x25dd('0x5f')]:_0x46d9b2['Last_Name'],'id':_0x46d9b2['id']};_0x5163fa[_0x25dd('0x60')]=_[_0x25dd('0x47')](_0x46d9b2['enduserType']);}if(_0x4f4698['talktime']){_0x5163fa[_0x25dd('0x61')]=moment[_0x25dd('0x62')](parseInt(_0x4f4698[_0x25dd('0x63')])*0x3e8)['format'](_0x25dd('0x64'));}else if(_0x4f4698[_0x25dd('0x65')]&&_0x4f4698[_0x25dd('0x66')]){_0x5163fa[_0x25dd('0x61')]=moment['utc'](moment(_0x4f4698[_0x25dd('0x66')],_0x25dd('0x67'))[_0x25dd('0x68')](moment(_0x4f4698['starttime'],_0x25dd('0x67'))))[_0x25dd('0x2d')](_0x25dd('0x64'));}switch(_0x4f4698[_0x25dd('0x69')]){case'called':_0x5163fa['Call_Result']=_0x25dd('0x6a');break;case _0x25dd('0x6b'):case _0x25dd('0x6c'):_0x5163fa['Call_Result']=_0x25dd('0x6d');break;case _0x25dd('0x6e'):_0x5163fa['Call_Result']=_0x25dd('0x6f');break;case'abandoned':_0x5163fa['Call_Result']=_0x25dd('0x70');break;case'timeout':_0x5163fa[_0x25dd('0x71')]=_0x25dd('0x72');default:}_0x5163fa['Call_Start_Time']=(_0x311c0c==='outbound'?moment(_0x4f4698[_0x25dd('0x73')])[_0x25dd('0x2d')](_0x25dd('0x67')):moment(_0x4f4698[_0x25dd('0x74')])[_0x25dd('0x2d')](_0x25dd('0x67')))||moment()[_0x25dd('0x2d')](_0x25dd('0x67'));_0x5163fa[_0x25dd('0x75')]=_0x311c0c||_0x25dd('0x76');_0x5163fa=_[_0x25dd('0x77')](_0x5163fa,getCustomFields(_0x1b2b0f[_0x25dd('0x78')],_0x4f4698));return request({'method':_0x25dd('0x21'),'uri':_0x25dd('0x40')+_0x188f39+_0x25dd('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45e054},'body':{'data':[_0x5163fa]},'json':!![]})[_0x25dd('0x31')](function(_0x1ea8b2){if(_0x1ea8b2&&_0x1ea8b2[_0x25dd('0x3e')][0x0][_0x25dd('0x44')]==='SUCCESS'){logger[_0x25dd('0x2b')]('Call\x20created!');return{'id':_0x1ea8b2[_0x25dd('0x3e')][0x0][_0x25dd('0x46')]['id']};}})['catch'](function(_0xa02a86){logger[_0x25dd('0x2b')]('err',_0xa02a86[_0x25dd('0x2a')]);console[_0x25dd('0x49')]('err',_0xa02a86);});}exports[_0x25dd('0x7a')]=function(_0x4847d7,_0xe41e2d,_0x296e47,_0x4cdf83,_0x5111a5,_0x41db3e){var _0x196eaa,_0x46d156,_0xa39796;_0x41db3e[_0x25dd('0x7b')]=intUtil[_0x25dd('0x7c')](_0x41db3e[_0x25dd('0x7b')]);_0x41db3e[_0x25dd('0x7d')]=intUtil['stripTrailingSlash'](_0x41db3e['serverUrl']);if(_0x5111a5&&_0x5111a5[_0x25dd('0x7e')]){logger[_0x25dd('0x2b')](_0x25dd('0x7f'),'Recording\x20is\x20enabled!');_0xe41e2d[_0x25dd('0x80')]=_0x41db3e['serverUrl']+_0x25dd('0x81')+_0xe41e2d[_0x25dd('0x82')]+'/downloads?type=uniqueid&token='+md5(_0xe41e2d[_0x25dd('0x82')]);}else{_0xe41e2d[_0x25dd('0x80')]='';}var _0x6b586e=_0x41db3e[_0x25dd('0x7b')]===_0x25dd('0x83')?'eu':_0x25dd('0x84');return getAccessToken(_0x41db3e)[_0x25dd('0x31')](function(_0x49984d){_0xa39796=_0x49984d;return getUser(_0xa39796,_0x6b586e,_0x41db3e,_0x4cdf83['email']);})[_0x25dd('0x31')](function(_0x14c634){_0x196eaa=_0x14c634;logger['info'](_0x25dd('0x85'),_0x196eaa['id']);return getEndUser(_0xa39796,_0x6b586e,_0x41db3e,_0xe41e2d[_0x25dd('0x86')],_0xe41e2d['calleridnum'],_0x196eaa,_0x296e47);})['then'](function(_0x16723a){_0x46d156=_0x16723a;return getCall(_0xa39796,_0x6b586e,_0x41db3e,_0x196eaa,_0x46d156,_0x296e47,_0xe41e2d,_0x25dd('0x76'));})[_0x25dd('0x31')](function(_0x41ba84){if(_0x41ba84){logger[_0x25dd('0x2b')]('The\x20Call\x20ID\x20is:',_0x41ba84['id']);logger[_0x25dd('0x2b')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x25dd('0x2d')](_0x25dd('0x87'),_0x4cdf83[_0x25dd('0x17')]),_0x25dd('0x88'),{'uri':'https://crm.'+_0x41db3e[_0x25dd('0x7b')]+_0x25dd('0x89')+_0x41ba84['id']});}})['catch'](function(_0x5a82b6){logger['error'](_0x25dd('0x7f'),JSON['stringify'](_0x5a82b6));});};exports['outbound']=function(_0x2b5a20,_0x14b165,_0x3f94fe,_0xced6e3,_0x4a06fa,_0x7a3b22,_0x42f8b1){var _0x3be927,_0x428cea,_0xbf98ad;_0x7a3b22[_0x25dd('0x7b')]=intUtil[_0x25dd('0x7c')](_0x7a3b22['host']);_0x7a3b22['serverUrl']=intUtil['stripTrailingSlash'](_0x7a3b22['serverUrl']);if(_0x42f8b1&&_0x42f8b1[_0x25dd('0x8a')]&&_0x42f8b1[_0x25dd('0x8a')]!==_0x25dd('0x8b')){logger[_0x25dd('0x2b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x14b165[_0x25dd('0x80')]=_0x7a3b22['serverUrl']+'/api/voice/recordings/'+_0x14b165[_0x25dd('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x14b165['uniqueid']);}var _0x53aa48=_0x7a3b22['host']===_0x25dd('0x83')?'eu':_0x25dd('0x84');return getAccessToken(_0x7a3b22)[_0x25dd('0x31')](function(_0x4c1b97){_0xbf98ad=_0x4c1b97;return getUser(_0xbf98ad,_0x53aa48,_0x7a3b22,_0xced6e3[_0x25dd('0x34')]);})[_0x25dd('0x31')](function(_0x4b2a6a){_0x3be927=_0x4b2a6a;logger['info'](_0x25dd('0x85'),_0x3be927['id']);return getEndUser(_0xbf98ad,_0x53aa48,_0x7a3b22,_0x14b165[_0x25dd('0x8c')],_0x14b165['destcalleridnum'],_0x3be927,_0x3f94fe);})[_0x25dd('0x31')](function(_0x2925cf){_0x428cea=_0x2925cf;return getCall(_0xbf98ad,_0x53aa48,_0x7a3b22,_0x3be927,_0x428cea,_0x3f94fe,_0x14b165,'Outbound');})['then'](function(_0x2a7b02){if(_0x2a7b02){logger[_0x25dd('0x2b')](_0x25dd('0x8d'),_0x2a7b02['id']);logger[_0x25dd('0x2b')](_0x25dd('0x8e'),_0x25dd('0x8f'));emit(util[_0x25dd('0x2d')](_0x25dd('0x87'),_0xced6e3[_0x25dd('0x17')]),_0x25dd('0x88'),{'uri':_0x25dd('0x90')+_0x7a3b22[_0x25dd('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2a7b02['id']});}})[_0x25dd('0x28')](function(_0x46aa94){logger[_0x25dd('0x29')]('[OUTBOUND]',JSON[_0x25dd('0x3c')](_0x46aa94));});};exports['unmanaged']=function(_0x1c800a,_0xe70b43,_0x48da4e,_0x14036c,_0x16ee75,_0x858873){var _0x22e791,_0x3cdf26,_0x2822fe;_0x858873[_0x25dd('0x7b')]=intUtil[_0x25dd('0x7c')](_0x858873[_0x25dd('0x7b')]);_0x858873[_0x25dd('0x7d')]=intUtil[_0x25dd('0x7c')](_0x858873['serverUrl']);if(_0x16ee75&&_0x16ee75[_0x25dd('0x7e')]){logger['info']('['+_0xe70b43[_0x25dd('0x69')][_0x25dd('0x91')]()+']',_0x25dd('0x92'));_0xe70b43[_0x25dd('0x80')]=_0x858873['serverUrl']+_0x25dd('0x81')+_0xe70b43[_0x25dd('0x82')]+_0x25dd('0x93')+md5(_0xe70b43[_0x25dd('0x82')]);}else{_0xe70b43[_0x25dd('0x80')]='';}var _0x354ec9=_0x858873[_0x25dd('0x7b')]==='zoho.eu'?'eu':_0x25dd('0x84');return getAccessToken(_0x858873)[_0x25dd('0x31')](function(_0x282420){_0x2822fe=_0x282420;return getUser(_0x2822fe,_0x354ec9,_0x858873);})[_0x25dd('0x31')](function(_0x5a95c1){_0x22e791=_0x5a95c1;logger[_0x25dd('0x2b')]('The\x20User\x20ID\x20is:',_0x22e791['id']);return getEndUser(_0x2822fe,_0x354ec9,_0x858873,_0xe70b43[_0x25dd('0x86')],_0xe70b43[_0x25dd('0x94')],_0x22e791,_0x48da4e);})[_0x25dd('0x31')](function(_0x4b1386){_0x3cdf26=_0x4b1386;return getCall(_0x2822fe,_0x354ec9,_0x858873,_0x22e791,_0x3cdf26,_0x48da4e,_0xe70b43,_0x25dd('0x76'));})[_0x25dd('0x31')](function(_0x47ba0e){if(_0x47ba0e){logger['info']('The\x20Call\x20ID\x20is:',_0x47ba0e['id']);}})['catch'](function(_0x59f4ca){logger[_0x25dd('0x29')]('['+_0xe70b43[_0x25dd('0x69')][_0x25dd('0x91')]()+']',JSON[_0x25dd('0x3c')](_0x59f4ca));});}; \ No newline at end of file +var _0xa4ff=['Timeout','Call_Start_Time','Inbound','merge','Call\x20created!','err','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','lodash','request-promise','util','moment','ioredis','bluebird','zoho','redis','localhost','socket.io-emitter','emit','stringify','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','Failing\x20creating\x20the\x20access_token','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','isArrayLikeObject','findIndex','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','users','user','The\x20failing\x20result\x20is','error','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','Abandoned'];(function(_0x2776c0,_0x3bdc05){var _0x42b7b7=function(_0x94d837){while(--_0x94d837){_0x2776c0['push'](_0x2776c0['shift']());}};_0x42b7b7(++_0x3bdc05);}(_0xa4ff,0xb5));var _0xfa4f=function(_0x175ca4,_0x3a74c4){_0x175ca4=_0x175ca4-0x0;var _0x8c846d=_0xa4ff[_0x175ca4];return _0x8c846d;};'use strict';var _=require(_0xfa4f('0x0'));var rp=require(_0xfa4f('0x1'));var md5=require('md5');var util=require(_0xfa4f('0x2'));var intUtil=require('./util');var moment=require(_0xfa4f('0x3'));var Redis=require(_0xfa4f('0x4'));var BPromise=require(_0xfa4f('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xfa4f('0x6'));config[_0xfa4f('0x7')]=_['defaults'](config[_0xfa4f('0x7')],{'host':_0xfa4f('0x8'),'port':0x18eb});var io=require(_0xfa4f('0x9'))(new Redis(config[_0xfa4f('0x7')]));function emit(_0x594a75,_0x7e9b4b,_0x54b318){io['to'](_0x594a75)[_0xfa4f('0xa')](_0x7e9b4b,_0x54b318);}function request(_0x36ea8a){logger['debug']('[HTTP]',JSON[_0xfa4f('0xb')](_0x36ea8a));return rp(_0x36ea8a);}function getCustomFields(_0x3512ed,_0x466aaf){var _0x56a5b5={};if(_0x3512ed['length']>0x0){_[_0xfa4f('0xc')](_0x3512ed,function(_0x327b02){if(_[_0xfa4f('0xd')](['string',_0xfa4f('0xe')],_0x327b02[_0xfa4f('0xf')])&&_0x327b02['idField']){_0x56a5b5[_0x327b02[_0xfa4f('0x10')]]=_0x327b02[_0xfa4f('0x11')][_0xfa4f('0x12')]();}else if(_0x327b02[_0xfa4f('0xf')]===_0xfa4f('0x13')&&_0x327b02[_0xfa4f('0x14')]&&_0x327b02[_0xfa4f('0x10')]&&_0x466aaf[_0x327b02['variableName']]){_0x56a5b5[_0x327b02[_0xfa4f('0x10')]]=_0x466aaf[_0x327b02[_0xfa4f('0x14')]][_0xfa4f('0x12')]();}else if(_0x327b02[_0xfa4f('0xf')]===_0xfa4f('0x15')&&_0x327b02[_0xfa4f('0x16')]&&_0x327b02['Variable'][_0xfa4f('0x17')]&&_0x327b02[_0xfa4f('0x10')]&&_0x466aaf[_0x327b02[_0xfa4f('0x16')][_0xfa4f('0x17')][_0xfa4f('0x18')]()]){_0x56a5b5[_0x327b02['idField']]=_0x466aaf[_0x327b02[_0xfa4f('0x16')][_0xfa4f('0x17')][_0xfa4f('0x18')]()]['toString']();}});}return _0x56a5b5;}function getName(_0x2d36e6){if(_0x2d36e6['indexOf']('\x20')>0x0){var _0x24f031=_0x2d36e6['split'](/ (.+)/);if(_0x24f031[0x1]){return _0x24f031;}}return[_0x2d36e6,_0x2d36e6];}var accountsTokens={};function getAccessToken(_0x516f5c){return new Promise(function(_0x430da9,_0x5d22f3){if(!_['isNil'](accountsTokens[_0x516f5c['id']])&&!_[_0xfa4f('0x19')](accountsTokens[_0x516f5c['id']][_0xfa4f('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x516f5c['id']]['expires_in'])){_0x430da9(accountsTokens[_0x516f5c['id']][_0xfa4f('0x1a')]);}}var _0x4883e2;switch(_0x516f5c[_0xfa4f('0x1b')]){case'US':_0x4883e2=_0xfa4f('0x1c');break;case'AU':_0x4883e2='https://accounts.zoho.com.au';break;case'EU':_0x4883e2=_0xfa4f('0x1d');break;case'IN':_0x4883e2=_0xfa4f('0x1e');break;case'CN':_0x4883e2=_0xfa4f('0x1f');break;default:_0x4883e2=_0xfa4f('0x1d');break;}var _0x3e14a2={'method':_0xfa4f('0x20'),'uri':_0x4883e2+_0xfa4f('0x21'),'qs':{'refresh_token':_0x516f5c[_0xfa4f('0x22')],'client_id':_0x516f5c[_0xfa4f('0x23')],'client_secret':_0x516f5c[_0xfa4f('0x24')],'grant_type':_0xfa4f('0x25')},'json':!![]};return rp(_0x3e14a2)['then'](function(_0x27b191){accountsTokens[_0x516f5c['id']]={'access_token':_0x27b191[_0xfa4f('0x1a')],'expires_in':moment()[_0xfa4f('0x26')](_0x27b191['expires_in'],_0xfa4f('0x27'))};_0x430da9(_0x27b191['access_token']);})['catch'](function(_0x4103eb){logger['error'](_0xfa4f('0x28'),_0x4103eb[_0xfa4f('0x29')]);_0x5d22f3(_0x4103eb);});});}function getUser(_0x5d01fb,_0x1b27c5,_0x84db02,_0x17ce68){logger['info']('Search\x20user');return request({'method':_0xfa4f('0x2a'),'uri':util[_0xfa4f('0x2b')](_0xfa4f('0x2c'),_0x1b27c5),'qs':{'type':_0xfa4f('0x2d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d01fb},'json':!![]})[_0xfa4f('0x2e')](function(_0x9e60ee){if(_0x9e60ee['users']){var _0x52a7e1=-0x1;if(_[_0xfa4f('0x2f')](_0x9e60ee['users'])){if(!_[_0xfa4f('0x19')](_0x17ce68)){_0x52a7e1=_[_0xfa4f('0x30')](_0x9e60ee['users'],function(_0xadc033){return _0xadc033['email']===_0x17ce68;});}if(_0x52a7e1>=0x0){logger[_0xfa4f('0x31')](_0xfa4f('0x32'));}else{logger[_0xfa4f('0x31')](_0xfa4f('0x33'));_0x52a7e1=_[_0xfa4f('0x30')](_0x9e60ee['users'],function(_0xeeb6f3){return _0xeeb6f3[_0xfa4f('0x34')][_0xfa4f('0x17')]===_0xfa4f('0x35');});}return _0x9e60ee[_0xfa4f('0x36')][_0x52a7e1];}else{if(_0x9e60ee[_0xfa4f('0x37')]['profile'][_0xfa4f('0x17')]==='Administrator'){logger[_0xfa4f('0x31')](_0xfa4f('0x33'));user=_0x9e60ee[_0xfa4f('0x37')];return user;}else{logger['error'](_0xfa4f('0x38'),JSON[_0xfa4f('0xb')](_0x9e60ee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x9e60ee));}}}else{logger[_0xfa4f('0x39')](_0xfa4f('0x38'),JSON['stringify'](_0x9e60ee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xfa4f('0xb')](_0x9e60ee));}})[_0xfa4f('0x3a')](function(_0x4ad1cb){console['error'](_0x4ad1cb);});}function getZohoUser(_0x18e1ce,_0x5a5a52){return new BPromise(function(_0x2e7e92,_0x3d67fa){request(_0x18e1ce)[_0xfa4f('0x2e')](function(_0x2f0695){var _0x12b767=null;if(_0x2f0695){_0x12b767=_0x2f0695[_0xfa4f('0x3b')][0x0];_0x12b767[_0xfa4f('0x3c')]=_0x5a5a52;}_0x2e7e92(_0x12b767);})['catch'](function(_0x1b8bd4){_0x3d67fa(_0x1b8bd4);});});}function createEndUser(_0x40ea0c,_0x57f46e,_0x202d8f,_0x4c47a3,_0x5eeb7d,_0xfbed9d){var _0x202d8f=getName(_0x202d8f);return request({'method':_0xfa4f('0x20'),'uri':_0xfa4f('0x3d')+_0x57f46e+_0xfa4f('0x3e')+_[_0xfa4f('0x3f')](_0xfbed9d['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x202d8f[0x1],'First_Name':_0x202d8f[0x0],'Phone':_0x4c47a3,'Owner':{'name':!_['isNil'](_0x5eeb7d[_0xfa4f('0x40')]['name'])?_0x5eeb7d[_0xfa4f('0x40')][_0xfa4f('0x17')]:!_[_0xfa4f('0x19')](_0x5eeb7d[_0xfa4f('0x41')])?_0x5eeb7d['first_name']+'\x20'+_0x5eeb7d[_0xfa4f('0x42')]:_0x5eeb7d['last_name'],'id':_0x5eeb7d['id']}}]},'headers':{'Authorization':_0xfa4f('0x43')+_0x40ea0c},'json':!![]})['then'](function(_0xfaa94f){if(_0xfaa94f&&_0xfaa94f['data'][0x0][_0xfa4f('0x44')]===_0xfa4f('0x45')){var _0x78b814=_0xfaa94f[_0xfa4f('0x3b')][0x0][_0xfa4f('0x46')];_0x78b814[_0xfa4f('0x3c')]=_['startCase'](_0xfbed9d[_0xfa4f('0x47')])+'s';return _0x78b814;}logger[_0xfa4f('0x39')](_0xfa4f('0x38'),JSON[_0xfa4f('0xb')](data));throw new Error(_0xfa4f('0x48')+JSON[_0xfa4f('0xb')](data));})[_0xfa4f('0x3a')](function(_0x208b04){console[_0xfa4f('0x49')](_0xfa4f('0x4a'),_0x208b04);});}function getEndUser(_0x46aba1,_0x4bae17,_0x4f54fc,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63){var _0x4e6d7e={'method':_0xfa4f('0x2a'),'uri':'','headers':{'Authorization':_0xfa4f('0x43')+_0x46aba1},'json':!![]};switch(_0x4f0b63[_0xfa4f('0x4b')]){case _0xfa4f('0x4c'):_0x4e6d7e[_0xfa4f('0x4d')]=_0xfa4f('0x3d')+_0x4bae17+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x4e'))[_0xfa4f('0x2e')](function(_0x518801){if(_0x518801)return _0x518801;_0x4e6d7e['uri']=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x4f')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,'Leads')[_0xfa4f('0x2e')](function(_0x4579e3){if(_0x4579e3)return _0x4579e3;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});});break;case _0xfa4f('0x51'):_0x4e6d7e[_0xfa4f('0x4d')]=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x52')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x4e'))[_0xfa4f('0x2e')](function(_0x1828dd){if(_0x1828dd)return _0x1828dd;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});break;case'lead':_0x4e6d7e['uri']=_0xfa4f('0x3d')+_0x4bae17+_0xfa4f('0x4f')+_0x48a9c9+'))';return getZohoUser(_0x4e6d7e,_0xfa4f('0x53'))[_0xfa4f('0x2e')](function(_0x1640af){if(_0x1640af)return _0x1640af;if(_0x4f0b63['moduleCreate']!=_0xfa4f('0x50')){return createEndUser(_0x46aba1,_0x4bae17,_0x1dbc55,_0x48a9c9,_0x54961e,_0x4f0b63);}else{return{};}});break;}}function getCall(_0x38ea71,_0x1af838,_0x5df6d9,_0x4d509f,_0x10b11b,_0x20c23c,_0x28aa37,_0x524280){logger[_0xfa4f('0x31')](_0xfa4f('0x54'));var _0x20523a={};_0x20523a[_0xfa4f('0x55')]={'name':!_[_0xfa4f('0x19')](_0x4d509f[_0xfa4f('0x40')][_0xfa4f('0x17')])&&!_['isNil'](_0x4d509f['profile'][_0xfa4f('0x17')])&&_0x4d509f[_0xfa4f('0x34')][_0xfa4f('0x17')]==='administrator'?_0x4d509f[_0xfa4f('0x40')][_0xfa4f('0x17')]:!_[_0xfa4f('0x19')](_0x4d509f['first_name'])?_0x4d509f[_0xfa4f('0x41')]+'\x20'+_0x4d509f[_0xfa4f('0x42')]:_0x4d509f[_0xfa4f('0x42')],'id':_0x4d509f['id']};_0x20523a['Subject']=intUtil['getString'](_0x20c23c['Subjects'],_0x28aa37,'\x20');_0x20523a['Description']=intUtil[_0xfa4f('0x56')](_0x20c23c[_0xfa4f('0x57')],_0x28aa37,'\x0a');if(_0x10b11b['enduserType']==='Contacts'){_0x20523a[_0xfa4f('0x58')]={'name':!_[_0xfa4f('0x19')](_0x10b11b[_0xfa4f('0x59')])?_0x10b11b[_0xfa4f('0x59')]:!_[_0xfa4f('0x19')](_0x10b11b[_0xfa4f('0x5a')])?_0x10b11b[_0xfa4f('0x5a')]+'\x20'+_0x10b11b[_0xfa4f('0x5b')]:_0x10b11b['Last_Name'],'id':_0x10b11b['id']};}if(_0x10b11b[_0xfa4f('0x3c')]===_0xfa4f('0x53')){_0x20523a[_0xfa4f('0x5c')]={'name':!_['isNil'](_0x10b11b['Full_Name'])?_0x10b11b['Full_Name']:!_['isNil'](_0x10b11b[_0xfa4f('0x5a')])?_0x10b11b['First_Name']+'\x20'+_0x10b11b[_0xfa4f('0x5b')]:_0x10b11b[_0xfa4f('0x5b')],'id':_0x10b11b['id']};_0x20523a[_0xfa4f('0x5d')]=_[_0xfa4f('0x3f')](_0x10b11b[_0xfa4f('0x3c')]);}if(_0x28aa37[_0xfa4f('0x5e')]){_0x20523a['Call_Duration']=moment[_0xfa4f('0x5f')](parseInt(_0x28aa37[_0xfa4f('0x5e')])*0x3e8)[_0xfa4f('0x2b')](_0xfa4f('0x60'));}else if(_0x28aa37['answertime']&&_0x28aa37['endtime']){_0x20523a['Call_Duration']=moment['utc'](moment(_0x28aa37[_0xfa4f('0x61')],_0xfa4f('0x62'))['diff'](moment(_0x28aa37[_0xfa4f('0x63')],_0xfa4f('0x62'))))['format']('mm:ss');}switch(_0x28aa37[_0xfa4f('0x64')]){case _0xfa4f('0x65'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x67');break;case'complete':case _0xfa4f('0x68'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x69');break;case _0xfa4f('0x6a'):_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x6b');break;case'abandoned':_0x20523a['Call_Result']=_0xfa4f('0x6c');break;case'timeout':_0x20523a[_0xfa4f('0x66')]=_0xfa4f('0x6d');default:}_0x20523a[_0xfa4f('0x6e')]=(_0x524280==='outbound'?moment(_0x28aa37[_0xfa4f('0x63')])[_0xfa4f('0x2b')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x28aa37['agentcalledAt'])[_0xfa4f('0x2b')](_0xfa4f('0x62')))||moment()[_0xfa4f('0x2b')](_0xfa4f('0x62'));_0x20523a['Call_Type']=_0x524280||_0xfa4f('0x6f');_0x20523a=_[_0xfa4f('0x70')](_0x20523a,getCustomFields(_0x20c23c['Fields'],_0x28aa37));return request({'method':_0xfa4f('0x20'),'uri':_0xfa4f('0x3d')+_0x1af838+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x38ea71},'body':{'data':[_0x20523a]},'json':!![]})['then'](function(_0x4bb7bd){if(_0x4bb7bd&&_0x4bb7bd[_0xfa4f('0x3b')][0x0][_0xfa4f('0x44')]===_0xfa4f('0x45')){logger[_0xfa4f('0x31')](_0xfa4f('0x71'));return{'id':_0x4bb7bd[_0xfa4f('0x3b')][0x0][_0xfa4f('0x46')]['id']};}})[_0xfa4f('0x3a')](function(_0xab4b4f){logger[_0xfa4f('0x31')](_0xfa4f('0x72'),_0xab4b4f[_0xfa4f('0x29')]);console[_0xfa4f('0x49')](_0xfa4f('0x72'),_0xab4b4f);});}exports['queue']=function(_0x5cd4b0,_0xebf2b5,_0x539203,_0x7c5f82,_0x5e1a1e,_0x3694fc){var _0x380df2,_0x1499dc,_0x423e29;_0x3694fc[_0xfa4f('0x73')]=intUtil['stripTrailingSlash'](_0x3694fc[_0xfa4f('0x73')]);_0x3694fc[_0xfa4f('0x74')]=intUtil[_0xfa4f('0x75')](_0x3694fc[_0xfa4f('0x74')]);if(_0x5e1a1e&&_0x5e1a1e['monitor_format']){logger[_0xfa4f('0x31')](_0xfa4f('0x76'),_0xfa4f('0x77'));_0xebf2b5[_0xfa4f('0x78')]=_0x3694fc[_0xfa4f('0x74')]+_0xfa4f('0x79')+_0xebf2b5[_0xfa4f('0x7a')]+_0xfa4f('0x7b')+md5(_0xebf2b5[_0xfa4f('0x7a')]);}else{_0xebf2b5[_0xfa4f('0x78')]='';}var _0x2fd14c=_0x3694fc[_0xfa4f('0x73')]==='zoho.eu'?'eu':_0xfa4f('0x7c');return getAccessToken(_0x3694fc)[_0xfa4f('0x2e')](function(_0x344c54){_0x423e29=_0x344c54;return getUser(_0x423e29,_0x2fd14c,_0x3694fc,_0x7c5f82[_0xfa4f('0x7d')]);})['then'](function(_0x593691){_0x380df2=_0x593691;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x380df2['id']);return getEndUser(_0x423e29,_0x2fd14c,_0x3694fc,_0xebf2b5[_0xfa4f('0x7f')],_0xebf2b5[_0xfa4f('0x80')],_0x380df2,_0x539203);})[_0xfa4f('0x2e')](function(_0x53064a){_0x1499dc=_0x53064a;return getCall(_0x423e29,_0x2fd14c,_0x3694fc,_0x380df2,_0x1499dc,_0x539203,_0xebf2b5,'Inbound');})[_0xfa4f('0x2e')](function(_0x57f9b0){if(_0x57f9b0){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0x57f9b0['id']);logger[_0xfa4f('0x31')](_0xfa4f('0x76'),_0xfa4f('0x82'));emit(util[_0xfa4f('0x2b')](_0xfa4f('0x83'),_0x7c5f82['name']),_0xfa4f('0x84'),{'uri':_0xfa4f('0x85')+_0x3694fc[_0xfa4f('0x73')]+_0xfa4f('0x86')+_0x57f9b0['id']});}})[_0xfa4f('0x3a')](function(_0x4280a4){logger[_0xfa4f('0x39')](_0xfa4f('0x76'),JSON[_0xfa4f('0xb')](_0x4280a4));});};exports[_0xfa4f('0x87')]=function(_0x2dc40d,_0x3601cf,_0x581114,_0x5c00bb,_0x36c9f9,_0x5d19ec,_0x3092d5){var _0x170690,_0x3eefe4,_0x30e685;_0x5d19ec[_0xfa4f('0x73')]=intUtil[_0xfa4f('0x75')](_0x5d19ec[_0xfa4f('0x73')]);_0x5d19ec['serverUrl']=intUtil[_0xfa4f('0x75')](_0x5d19ec[_0xfa4f('0x74')]);if(_0x3092d5&&_0x3092d5['recordingFormat']&&_0x3092d5[_0xfa4f('0x88')]!=='none'){logger['info'](_0xfa4f('0x89'),'Recording\x20is\x20enabled!');_0x3601cf[_0xfa4f('0x78')]=_0x5d19ec[_0xfa4f('0x74')]+_0xfa4f('0x79')+_0x3601cf['uniqueid']+_0xfa4f('0x7b')+md5(_0x3601cf['uniqueid']);}var _0x5717c3=_0x5d19ec[_0xfa4f('0x73')]===_0xfa4f('0x8a')?'eu':_0xfa4f('0x7c');return getAccessToken(_0x5d19ec)['then'](function(_0x465294){_0x30e685=_0x465294;return getUser(_0x30e685,_0x5717c3,_0x5d19ec,_0x5c00bb[_0xfa4f('0x7d')]);})[_0xfa4f('0x2e')](function(_0x2dabd7){_0x170690=_0x2dabd7;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x170690['id']);return getEndUser(_0x30e685,_0x5717c3,_0x5d19ec,_0x3601cf[_0xfa4f('0x8b')],_0x3601cf[_0xfa4f('0x8c')],_0x170690,_0x581114);})['then'](function(_0x1d1367){_0x3eefe4=_0x1d1367;return getCall(_0x30e685,_0x5717c3,_0x5d19ec,_0x170690,_0x3eefe4,_0x581114,_0x3601cf,_0xfa4f('0x8d'));})['then'](function(_0xa619bc){if(_0xa619bc){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0xa619bc['id']);logger['info'](_0xfa4f('0x89'),_0xfa4f('0x82'));emit(util[_0xfa4f('0x2b')]('user:%s',_0x5c00bb[_0xfa4f('0x17')]),_0xfa4f('0x84'),{'uri':'https://crm.'+_0x5d19ec[_0xfa4f('0x73')]+_0xfa4f('0x86')+_0xa619bc['id']});}})['catch'](function(_0x1abf71){logger['error'](_0xfa4f('0x89'),JSON[_0xfa4f('0xb')](_0x1abf71));});};exports[_0xfa4f('0x8e')]=function(_0x3fca32,_0x14bb35,_0x9e2fa4,_0x40b02e,_0x5586bf,_0x128149){var _0x3bfcf7,_0x398d96,_0x2a2b74;_0x128149['host']=intUtil[_0xfa4f('0x75')](_0x128149['host']);_0x128149['serverUrl']=intUtil['stripTrailingSlash'](_0x128149['serverUrl']);if(_0x5586bf&&_0x5586bf[_0xfa4f('0x8f')]){logger[_0xfa4f('0x31')]('['+_0x14bb35[_0xfa4f('0x64')][_0xfa4f('0x90')]()+']',_0xfa4f('0x77'));_0x14bb35[_0xfa4f('0x78')]=_0x128149[_0xfa4f('0x74')]+'/api/voice/recordings/'+_0x14bb35[_0xfa4f('0x7a')]+_0xfa4f('0x7b')+md5(_0x14bb35[_0xfa4f('0x7a')]);}else{_0x14bb35[_0xfa4f('0x78')]='';}var _0x26a638=_0x128149[_0xfa4f('0x73')]===_0xfa4f('0x8a')?'eu':_0xfa4f('0x7c');return getAccessToken(_0x128149)[_0xfa4f('0x2e')](function(_0x1d7e54){_0x2a2b74=_0x1d7e54;return getUser(_0x2a2b74,_0x26a638,_0x128149);})[_0xfa4f('0x2e')](function(_0x401d3c){_0x3bfcf7=_0x401d3c;logger[_0xfa4f('0x31')](_0xfa4f('0x7e'),_0x3bfcf7['id']);return getEndUser(_0x2a2b74,_0x26a638,_0x128149,_0x14bb35['calleridname'],_0x14bb35[_0xfa4f('0x80')],_0x3bfcf7,_0x9e2fa4);})[_0xfa4f('0x2e')](function(_0x5013f9){_0x398d96=_0x5013f9;return getCall(_0x2a2b74,_0x26a638,_0x128149,_0x3bfcf7,_0x398d96,_0x9e2fa4,_0x14bb35,_0xfa4f('0x6f'));})[_0xfa4f('0x2e')](function(_0xe22ae3){if(_0xe22ae3){logger[_0xfa4f('0x31')](_0xfa4f('0x81'),_0xe22ae3['id']);}})[_0xfa4f('0x3a')](function(_0x2dd70a){logger[_0xfa4f('0x39')]('['+_0x14bb35[_0xfa4f('0x64')][_0xfa4f('0x90')]()+']',JSON[_0xfa4f('0xb')](_0x2dd70a));});}; \ 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 423e1b5..3e521cf 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 _0x59bd=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3'];(function(_0xac18c1,_0x2f3d07){var _0x53b5c2=function(_0x4ea836){while(--_0x4ea836){_0xac18c1['push'](_0xac18c1['shift']());}};_0x53b5c2(++_0x2f3d07);}(_0x59bd,0x125));var _0xd59b=function(_0x2ce1bd,_0x492a67){_0x2ce1bd=_0x2ce1bd-0x0;var _0x33abc5=_0x59bd[_0x2ce1bd];return _0x33abc5;};'use strict';var util=require('util');var sh=require(_0xd59b('0x0'));var Mustache=require(_0xd59b('0x1'));var logger=require(_0xd59b('0x2'))(_0xd59b('0x3'));exports[_0xd59b('0x4')]=function(_0x92f635,_0x5ba302){var _0x5692ca=_0x92f635['data2']?_0x92f635[_0xd59b('0x5')]:'Script';var _0x36b78c=_0x92f635[_0xd59b('0x6')]?Mustache[_0xd59b('0x7')](_0x92f635['data3'],_0x5ba302):_0x5ba302;sh[_0xd59b('0x4')](_0x36b78c,function(_0x3b51bf,_0x9b5278,_0x389d74){if(_0x3b51bf!==0x0){logger[_0xd59b('0x8')](util[_0xd59b('0x9')](_0xd59b('0xa'),_0x5692ca,_0x36b78c,_0x3b51bf,_0x389d74));}else{logger[_0xd59b('0xb')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5692ca,_0x36b78c,_0x9b5278));}});}; \ No newline at end of file +var _0x48da=['trigger','exec','data2','Script','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger'];(function(_0x22e279,_0x1996fb){var _0x3c0af6=function(_0x461a2e){while(--_0x461a2e){_0x22e279['push'](_0x22e279['shift']());}};_0x3c0af6(++_0x1996fb);}(_0x48da,0xee));var _0xa48d=function(_0xcd5f58,_0x2271d7){_0xcd5f58=_0xcd5f58-0x0;var _0x394039=_0x48da[_0xcd5f58];return _0x394039;};'use strict';var util=require(_0xa48d('0x0'));var sh=require(_0xa48d('0x1'));var Mustache=require(_0xa48d('0x2'));var logger=require(_0xa48d('0x3'))(_0xa48d('0x4'));exports[_0xa48d('0x5')]=function(_0x142d9e,_0x2f6825){var _0x126bb0=_0x142d9e[_0xa48d('0x6')]?_0x142d9e[_0xa48d('0x6')]:_0xa48d('0x7');var _0x4cff78=_0x142d9e['data3']?Mustache['render'](_0x142d9e['data3'],_0x2f6825):_0x2f6825;sh[_0xa48d('0x5')](_0x4cff78,function(_0x58c84c,_0x357f0a,_0xb8c531){if(_0x58c84c!==0x0){logger['error'](util[_0xa48d('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x126bb0,_0x4cff78,_0x58c84c,_0xb8c531));}else{logger[_0xa48d('0x9')](util['format'](_0xa48d('0xa'),_0x126bb0,_0x4cff78,_0x357f0a));}});}; \ 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 d145a4d..f1cb516 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 _0xb4eb=['body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','format','%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','message','request-promise','lodash','../../../../config/logger','exec','data1','render','data2','data5','number','headers','parse','stack','toUpperCase','GET','POST','PUT','data7'];(function(_0x3f8e55,_0x11ed7f){var _0xb2b87b=function(_0x1bb134){while(--_0x1bb134){_0x3f8e55['push'](_0x3f8e55['shift']());}};_0xb2b87b(++_0x11ed7f);}(_0xb4eb,0x10f));var _0xbb4e=function(_0x2bbe57,_0x16dcd5){_0x2bbe57=_0x2bbe57-0x0;var _0x132edd=_0xb4eb[_0x2bbe57];return _0x132edd;};'use strict';var rp=require(_0xbb4e('0x0'));var util=require('util');var _=require(_0xbb4e('0x1'));var Mustache=require('mustache');var logger=require(_0xbb4e('0x2'))('trigger');exports[_0xbb4e('0x3')]=function(_0x43e1bd,_0x5b62dd){var _0x14077f,_0x43f436;var _0xeff2d5={'method':_0x43e1bd[_0xbb4e('0x4')]['toUpperCase'](),'uri':Mustache[_0xbb4e('0x5')](_0x43e1bd[_0xbb4e('0x6')],_0x5b62dd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x43e1bd[_0xbb4e('0x7')])===_0xbb4e('0x8')&&parseInt(_0x43e1bd[_0xbb4e('0x7')])>=0x1&&parseInt(_0x43e1bd[_0xbb4e('0x7')])<=0xa?parseInt(_0x43e1bd[_0xbb4e('0x7')])*0x3e8:0x5*0x3e8};try{_0xeff2d5[_0xbb4e('0x9')]=_0x43e1bd['data6']?JSON[_0xbb4e('0xa')](Mustache['render'](_0x43e1bd['data6'],_0x5b62dd)):{};}catch(_0x40c020){logger['error'](_0x40c020[_0xbb4e('0xb')]);}switch(_0x43e1bd[_0xbb4e('0x4')][_0xbb4e('0xc')]()){case _0xbb4e('0xd'):case'DELETE':_0x14077f=null;_0xeff2d5['qs']=_0x5b62dd;break;case _0xbb4e('0xe'):case _0xbb4e('0xf'):if(_0x43e1bd[_0xbb4e('0x10')]){try{_0x14077f=JSON[_0xbb4e('0xa')](Mustache[_0xbb4e('0x5')](_0x43e1bd[_0xbb4e('0x10')],_0x5b62dd));_0xeff2d5[_0xbb4e('0x11')]=_0x14077f;}catch(_0xb37541){logger['error'](_0xb37541[_0xbb4e('0xb')]);logger[_0xbb4e('0x12')](_0xbb4e('0x13'));}}else{_0x14077f=_0x5b62dd;_0xeff2d5[_0xbb4e('0x11')]=_0x14077f;}break;}logger[_0xbb4e('0x14')](util['format'](_0xbb4e('0x15'),_0x43e1bd[_0xbb4e('0x4')],_0x43e1bd[_0xbb4e('0x6')],JSON[_0xbb4e('0x16')](_0xeff2d5)));rp(_0xeff2d5)[_0xbb4e('0x17')](function(_0x393e8b){_0x14077f=!_[_0xbb4e('0x18')](_0x14077f)?_0xbb4e('0x19')+_0x14077f:'';_0x43f436=typeof _0x393e8b[_0xbb4e('0x11')]==='object'?JSON[_0xbb4e('0x16')](_0x393e8b[_0xbb4e('0x11')]):_0x393e8b[_0xbb4e('0x11')];logger[_0xbb4e('0x14')](util[_0xbb4e('0x1a')](_0xbb4e('0x1b'),_0x43e1bd[_0xbb4e('0x4')],_0x43e1bd['data2'],_0x393e8b[_0xbb4e('0x1c')],_0x43f436));})[_0xbb4e('0x1d')](function(_0x406673){logger[_0xbb4e('0x12')](util[_0xbb4e('0x1a')](_0xbb4e('0x1e'),_0x43e1bd[_0xbb4e('0x4')],_0x43e1bd[_0xbb4e('0x6')],_0x406673[_0xbb4e('0x1c')],_0x406673['name'],_0x406673[_0xbb4e('0x1f')]));});}; \ No newline at end of file +var _0x5752=['headers','parse','data6','data1','GET','POST','PUT','data7','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','toUpperCase','render','data2','data5','number'];(function(_0xf67fa7,_0x3dbf9e){var _0xd2e6d7=function(_0x3ade7e){while(--_0x3ade7e){_0xf67fa7['push'](_0xf67fa7['shift']());}};_0xd2e6d7(++_0x3dbf9e);}(_0x5752,0xbb));var _0x2575=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x5752[_0x2d2c16];return _0x53f2fb;};'use strict';var rp=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var _=require(_0x2575('0x2'));var Mustache=require(_0x2575('0x3'));var logger=require('../../../../config/logger')(_0x2575('0x4'));exports[_0x2575('0x5')]=function(_0x3dc944,_0x27c93b){var _0x528763,_0x4e41bc;var _0xf7bbfa={'method':_0x3dc944['data1'][_0x2575('0x6')](),'uri':Mustache[_0x2575('0x7')](_0x3dc944[_0x2575('0x8')],_0x27c93b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3dc944[_0x2575('0x9')])===_0x2575('0xa')&&parseInt(_0x3dc944['data5'])>=0x1&&parseInt(_0x3dc944[_0x2575('0x9')])<=0xa?parseInt(_0x3dc944['data5'])*0x3e8:0x5*0x3e8};try{_0xf7bbfa[_0x2575('0xb')]=_0x3dc944['data6']?JSON[_0x2575('0xc')](Mustache['render'](_0x3dc944[_0x2575('0xd')],_0x27c93b)):{};}catch(_0x1c9e6f){logger['error'](_0x1c9e6f['stack']);}switch(_0x3dc944[_0x2575('0xe')][_0x2575('0x6')]()){case _0x2575('0xf'):case'DELETE':_0x528763=null;_0xf7bbfa['qs']=_0x27c93b;break;case _0x2575('0x10'):case _0x2575('0x11'):if(_0x3dc944[_0x2575('0x12')]){try{_0x528763=JSON['parse'](Mustache[_0x2575('0x7')](_0x3dc944[_0x2575('0x12')],_0x27c93b));_0xf7bbfa[_0x2575('0x13')]=_0x528763;}catch(_0x59e43e){logger['error'](_0x59e43e[_0x2575('0x14')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x528763=_0x27c93b;_0xf7bbfa[_0x2575('0x13')]=_0x528763;}break;}logger[_0x2575('0x15')](util[_0x2575('0x16')](_0x2575('0x17'),_0x3dc944['data1'],_0x3dc944[_0x2575('0x8')],JSON['stringify'](_0xf7bbfa)));rp(_0xf7bbfa)['then'](function(_0x5c682b){_0x528763=!_[_0x2575('0x18')](_0x528763)?',\x20request\x20body:\x20'+_0x528763:'';_0x4e41bc=typeof _0x5c682b[_0x2575('0x13')]===_0x2575('0x19')?JSON[_0x2575('0x1a')](_0x5c682b[_0x2575('0x13')]):_0x5c682b[_0x2575('0x13')];logger[_0x2575('0x15')](util[_0x2575('0x16')](_0x2575('0x1b'),_0x3dc944[_0x2575('0xe')],_0x3dc944['data2'],_0x5c682b[_0x2575('0x1c')],_0x4e41bc));})['catch'](function(_0x4e3876){logger[_0x2575('0x1d')](util['format'](_0x2575('0x1e'),_0x3dc944['data1'],_0x3dc944[_0x2575('0x8')],_0x4e3876[_0x2575('0x1c')],_0x4e3876[_0x2575('0x1f')],_0x4e3876[_0x2575('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f79945b..25ab57f 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 _0xa286=['then','debug','rpc','error','message','catch','exports','jayson/promise','routing','http','Request','request'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0xa286,0x103));var _0x6a28=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0xa286[_0x22ee1e];return _0x49a5c9;};'use strict';var jayson=require(_0x6a28('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x6a28('0x1'));var client=jayson['client'][_0x6a28('0x2')]({'port':0x2329});client[_0x6a28('0x3')]=function(_0x3c8fcb,_0x12bd3c){return new BPromise(function(_0x43aaa6,_0x52b888){return client[_0x6a28('0x4')](_0x3c8fcb,_0x12bd3c)[_0x6a28('0x5')](function(_0x538604){logger[_0x6a28('0x6')](_0x6a28('0x7'),_0x6a28('0x1'),_0x3c8fcb,_0x12bd3c,_0x538604);if(_0x538604[_0x6a28('0x8')]){logger[_0x6a28('0x8')](_0x6a28('0x7'),_0x6a28('0x1'),_0x3c8fcb,_0x538604[_0x6a28('0x8')][_0x6a28('0x9')],_0x12bd3c);return _0x52b888(_0x538604[_0x6a28('0x8')][_0x6a28('0x9')]);}else{return _0x43aaa6(_0x538604['result']);}})[_0x6a28('0xa')](function(_0x9508a1){logger[_0x6a28('0x8')](_0x6a28('0x7'),_0x6a28('0x1'),_0x3c8fcb,_0x9508a1,_0x12bd3c);return _0x52b888(_0x9508a1);});});};module[_0x6a28('0xb')]=client; \ No newline at end of file +var _0x76f1=['client','http','request','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing'];(function(_0x39f331,_0xe550f){var _0x348d48=function(_0x2f87b5){while(--_0x2f87b5){_0x39f331['push'](_0x39f331['shift']());}};_0x348d48(++_0xe550f);}(_0x76f1,0xe1));var _0x176f=function(_0x2ff0b7,_0x4caee3){_0x2ff0b7=_0x2ff0b7-0x0;var _0x71165f=_0x76f1[_0x2ff0b7];return _0x71165f;};'use strict';var jayson=require(_0x176f('0x0'));var BPromise=require('bluebird');var logger=require(_0x176f('0x1'))(_0x176f('0x2'));var client=jayson[_0x176f('0x3')][_0x176f('0x4')]({'port':0x2329});client['Request']=function(_0x3413ac,_0x39e116){return new BPromise(function(_0x41ed21,_0x4a7dfa){return client[_0x176f('0x5')](_0x3413ac,_0x39e116)['then'](function(_0x49cca6){logger['debug'](_0x176f('0x6'),'routing',_0x3413ac,_0x39e116,_0x49cca6);if(_0x49cca6[_0x176f('0x7')]){logger[_0x176f('0x7')](_0x176f('0x6'),'routing',_0x3413ac,_0x49cca6[_0x176f('0x7')][_0x176f('0x8')],_0x39e116);return _0x4a7dfa(_0x49cca6['error'][_0x176f('0x8')]);}else{return _0x41ed21(_0x49cca6[_0x176f('0x9')]);}})[_0x176f('0xa')](function(_0xe4dad8){logger[_0x176f('0x7')]('rpc','routing',_0x3413ac,_0xe4dad8,_0x39e116);return _0x4a7dfa(_0xe4dad8);});});};module[_0x176f('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 62fdc3d..e9d5db2 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 _0xb974=['initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','error','./server','./realtime','./lib/email','../../config/logger','email','then','getMailAccounts'];(function(_0x123f12,_0x3fe15e){var _0x5c9e58=function(_0x183948){while(--_0x183948){_0x123f12['push'](_0x123f12['shift']());}};_0x5c9e58(++_0x3fe15e);}(_0xb974,0xe3));var _0x4b97=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb974[_0x2dafbe];return _0x58a45a;};'use strict';var server=require(_0x4b97('0x0'));var Realtime=require(_0x4b97('0x1'));var EmailChannel=require(_0x4b97('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x4b97('0x3'))(_0x4b97('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x4b97('0x5')](mailAccount[_0x4b97('0x6')]())[_0x4b97('0x5')](realtime[_0x4b97('0x7')]())['then'](function(){email['refresh'](realtime[_0x4b97('0x8')]);return realtime;});}function main(){return server[_0x4b97('0x9')](realtime,email)[_0x4b97('0x5')](function(){return initRealtime();})[_0x4b97('0x5')](function(){return setting['getSettings']();})['then'](function(_0xc8b296){return setInterval(initRealtime,_0xc8b296[_0x4b97('0xa')]*0x3e8);})[_0x4b97('0xb')](function(_0x57edd8){logger[_0x4b97('0xc')]('Email\x20service\x20initialization',_0x57edd8);});}main(); \ No newline at end of file +var _0x1142=['catch','error','Email\x20service\x20initialization','./server','./rpc/setting','email','resolve','getMailAccounts','initMailAccounts','then','refresh','mailAccounts','listen','loginMailFrequency'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0x1142,0x153));var _0x2114=function(_0xe5ba98,_0x1065e5){_0xe5ba98=_0xe5ba98-0x0;var _0x4a4704=_0x1142[_0xe5ba98];return _0x4a4704;};'use strict';var server=require(_0x2114('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0x2114('0x1'));var logger=require('../../config/logger')(_0x2114('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2114('0x3')]()['then'](mailAccount[_0x2114('0x4')]())['then'](realtime[_0x2114('0x5')]())[_0x2114('0x6')](function(){email[_0x2114('0x7')](realtime[_0x2114('0x8')]);return realtime;});}function main(){return server[_0x2114('0x9')](realtime,email)[_0x2114('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x2114('0x6')](function(_0x5a1f8c){return setInterval(initRealtime,_0x5a1f8c[_0x2114('0xa')]*0x3e8);})[_0x2114('0xb')](function(_0xe63f4c){logger[_0x2114('0xc')](_0x2114('0xd'),_0xe63f4c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f774ae3..2c98f8e 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 _0x1163=['emit','name','key','Imap','status','messageStatus','stringify','md5','refresh','hasOwnProperty','active','service','provider','custom','handleImapBox','bind','handleImapEmail','end','error','handleImapError','disabled','messages','total','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','handleImapEnd','verifySmtp','isNil','Smtp','verify','verified','exports','moment','bluebird','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','mailAccounts','imapAccounts','smtp','prototype'];(function(_0x2091a0,_0x3af10c){var _0x503fb9=function(_0xea8771){while(--_0xea8771){_0x2091a0['push'](_0x2091a0['shift']());}};_0x503fb9(++_0x3af10c);}(_0x1163,0x8d));var _0x3116=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0x1163[_0x3a8b7c];return _0x40eb80;};'use strict';var _=require('lodash');var moment=require(_0x3116('0x0'));var BPromise=require(_0x3116('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x3116('0x2'));var logger=require(_0x3116('0x3'))(_0x3116('0x4'));config[_0x3116('0x5')]=_[_0x3116('0x6')](config[_0x3116('0x5')],{'host':_0x3116('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x3116('0x8'));var EmailSmtp=require(_0x3116('0x9'));var mailAccount=require(_0x3116('0xa'));var md5Accounts={};function EmailChannel(_0x5d5464){logger['info']('start\x20email\x20channel');this[_0x3116('0xb')]=_0x5d5464[_0x3116('0xb')];this[_0x3116('0xc')]={};this[_0x3116('0xd')]=new EmailSmtp();}EmailChannel[_0x3116('0xe')][_0x3116('0xf')]=function(_0x433d0e){var _0x48de3b=this[_0x3116('0xb')][_0x433d0e];var _0x13f9aa={'id':_0x48de3b['id'],'name':_0x48de3b[_0x3116('0x10')],'key':_0x48de3b[_0x3116('0x11')],'active':_0x48de3b['active'],'Imap':{'status':_0x48de3b[_0x3116('0x12')][_0x3116('0x13')],'messageStatus':_0x48de3b[_0x3116('0x12')][_0x3116('0x14')],'total':_0x48de3b[_0x3116('0x12')]['total']}};if(_['isNil'](md5Accounts[_0x433d0e])){md5Accounts[_0x433d0e]={};}var _0x27b1c8=md5(JSON[_0x3116('0x15')](_0x13f9aa));if(md5Accounts[_0x433d0e]['md5']!==_0x27b1c8){md5Accounts[_0x433d0e][_0x3116('0x16')]=_0x27b1c8;io['emit']('mailAccount:update',_0x13f9aa);}};EmailChannel['prototype'][_0x3116('0x17')]=function(_0x13680d){for(var _0x32a5dc in _0x13680d){if(_0x13680d[_0x3116('0x18')](_0x32a5dc)){if(_0x13680d[_0x32a5dc][_0x3116('0x12')]&&_0x13680d[_0x32a5dc][_0x3116('0x19')]){var _0x2d5e7d=_0x13680d[_0x32a5dc][_0x3116('0x12')];if(!_0x2d5e7d[_0x3116('0x1a')]&&_0x13680d[_0x32a5dc][_0x3116('0x1b')]!==_0x3116('0x1c'))_0x2d5e7d[_0x3116('0x1a')]=_0x13680d[_0x32a5dc][_0x3116('0x1b')];if(!this[_0x3116('0xc')]['hasOwnProperty'](_0x2d5e7d['id'])){this[_0x3116('0xc')][_0x2d5e7d['id']]=new EmailImap(_0x2d5e7d,_0x13680d[_0x32a5dc][_0x3116('0x4')]);this[_0x3116('0xc')][_0x2d5e7d['id']]['on']('box',this[_0x3116('0x1d')][_0x3116('0x1e')](this,_0x32a5dc));this['imapAccounts'][_0x2d5e7d['id']]['on'](_0x3116('0x4'),this[_0x3116('0x1f')][_0x3116('0x1e')](this,_0x32a5dc));this[_0x3116('0xc')][_0x2d5e7d['id']]['on'](_0x3116('0x20'),this['handleImapEnd'][_0x3116('0x1e')](this,_0x32a5dc));this[_0x3116('0xc')][_0x2d5e7d['id']]['on'](_0x3116('0x21'),this[_0x3116('0x22')]['bind'](this,_0x32a5dc));}}else{if(_['isNil'](this[_0x3116('0xb')][_0x32a5dc][_0x3116('0x12')])){this[_0x3116('0xb')][_0x32a5dc][_0x3116('0x12')]={};}this[_0x3116('0xb')][_0x32a5dc]['Imap'][_0x3116('0x13')]=_0x3116('0x23');this['mailAccounts'][_0x32a5dc][_0x3116('0x12')][_0x3116('0x14')]='';this[_0x3116('0xf')](_0x32a5dc);}}}};EmailChannel[_0x3116('0xe')]['handleImapBox']=function(_0x1dc0fc,_0x22d83d){if(this[_0x3116('0xb')][_0x1dc0fc]){this[_0x3116('0xb')][_0x1dc0fc][_0x3116('0x12')][_0x3116('0x13')]='connected';this['mailAccounts'][_0x1dc0fc]['Imap'][_0x3116('0x14')]=_0x22d83d[_0x3116('0x10')];if(_0x22d83d[_0x3116('0x24')]){this[_0x3116('0xb')][_0x1dc0fc]['Imap']['total']=_0x22d83d['messages'][_0x3116('0x25')];}return this[_0x3116('0xf')](_0x1dc0fc);}};EmailChannel['prototype'][_0x3116('0x1f')]=function(_0x5787f4,_0x103ebd){logger[_0x3116('0x26')](_0x3116('0x27'),_0x103ebd[_0x3116('0x28')],_0x103ebd['lastName'],_0x103ebd[_0x3116('0x29')],_0x5787f4);if(this['mailAccounts'][_0x5787f4]){return mailAccount['notify'](_0x5787f4,_0x103ebd)[_0x3116('0x2a')](function(_0x5f6437){if(_0x5f6437){logger[_0x3116('0x26')](_0x3116('0x2b'));}})[_0x3116('0x2c')](function(_0x5dca4f){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5dca4f));});}};EmailChannel[_0x3116('0xe')][_0x3116('0x2d')]=function(_0x39d48c){if(this[_0x3116('0xb')][_0x39d48c]&&this[_0x3116('0xb')][_0x39d48c][_0x3116('0x12')]){if(this[_0x3116('0xc')][this[_0x3116('0xb')][_0x39d48c][_0x3116('0x12')]['id']]){delete this[_0x3116('0xc')][this['mailAccounts'][_0x39d48c][_0x3116('0x12')]['id']];}this[_0x3116('0xb')][_0x39d48c]['Imap']['lastSync']=moment();this[_0x3116('0xf')](_0x39d48c);}};EmailChannel[_0x3116('0xe')][_0x3116('0x22')]=function(_0x2892f3,_0x5d400d){if(this[_0x3116('0xb')][_0x2892f3]){this['mailAccounts'][_0x2892f3][_0x3116('0x12')][_0x3116('0x13')]=_0x3116('0x21');this[_0x3116('0xb')][_0x2892f3]['Imap'][_0x3116('0x14')]=_0x5d400d;return this['emit'](_0x2892f3);}};EmailChannel['prototype']['sendMail']=function(_0x17581c,_0x1e7ce8){return this[_0x3116('0xd')]['send'](_0x17581c,_0x1e7ce8);};EmailChannel[_0x3116('0xe')][_0x3116('0x2e')]=function(_0x375053){var _0x1c0588=this;if(this[_0x3116('0xb')][_0x375053['id']]){if(_[_0x3116('0x2f')](this[_0x3116('0xb')][_0x375053['id']][_0x3116('0x30')])){this[_0x3116('0xb')][_0x375053['id']][_0x3116('0x30')]={};}this[_0x3116('0xb')][_0x375053['id']][_0x3116('0x30')]['lastSync']=moment();return new BPromise(function(_0x33fd2b,_0x558533){return _0x1c0588[_0x3116('0xd')][_0x3116('0x31')](_0x375053)['then'](function(_0x1aa0b7){_0x1c0588['mailAccounts'][_0x375053['id']][_0x3116('0x30')]['status']=_0x3116('0x32');_0x1c0588['mailAccounts'][_0x375053['id']][_0x3116('0x30')][_0x3116('0x14')]='';_0x1c0588[_0x3116('0xf')](_0x375053['id']);_0x33fd2b(_0x1aa0b7);})[_0x3116('0x2c')](function(_0x50740b){_0x1c0588['mailAccounts'][_0x375053['id']][_0x3116('0x30')][_0x3116('0x13')]=_0x3116('0x21');_0x1c0588[_0x3116('0xb')][_0x375053['id']][_0x3116('0x30')][_0x3116('0x14')]=_0x50740b;_0x1c0588[_0x3116('0xf')](_0x375053['id']);_0x558533(_0x50740b);});});}return this[_0x3116('0xd')]['verify'](_0x375053);};module[_0x3116('0x33')]=EmailChannel; \ No newline at end of file +var _0xed0f=['md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','hasOwnProperty','service','provider','custom','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','messages','total','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','sendMail','Smtp','lastSync','verify','verified','lodash','bluebird'];(function(_0x56007e,_0x14b813){var _0x192962=function(_0x4949d1){while(--_0x4949d1){_0x56007e['push'](_0x56007e['shift']());}};_0x192962(++_0x14b813);}(_0xed0f,0x107));var _0xfed0=function(_0x2231fe,_0x43f533){_0x2231fe=_0x2231fe-0x0;var _0x386277=_0xed0f[_0x2231fe];return _0x386277;};'use strict';var _=require(_0xfed0('0x0'));var moment=require('moment');var BPromise=require(_0xfed0('0x1'));var md5=require(_0xfed0('0x2'));var Redis=require(_0xfed0('0x3'));var config=require(_0xfed0('0x4'));var logger=require(_0xfed0('0x5'))('email');config[_0xfed0('0x6')]=_[_0xfed0('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfed0('0x8'))(new Redis(config[_0xfed0('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xfed0('0x9'));var md5Accounts={};function EmailChannel(_0x556c12){logger[_0xfed0('0xa')](_0xfed0('0xb'));this[_0xfed0('0xc')]=_0x556c12[_0xfed0('0xc')];this[_0xfed0('0xd')]={};this[_0xfed0('0xe')]=new EmailSmtp();}EmailChannel[_0xfed0('0xf')][_0xfed0('0x10')]=function(_0x4baaf0){var _0x2552d=this['mailAccounts'][_0x4baaf0];var _0x246a8c={'id':_0x2552d['id'],'name':_0x2552d[_0xfed0('0x11')],'key':_0x2552d[_0xfed0('0x12')],'active':_0x2552d[_0xfed0('0x13')],'Imap':{'status':_0x2552d[_0xfed0('0x14')][_0xfed0('0x15')],'messageStatus':_0x2552d[_0xfed0('0x14')][_0xfed0('0x16')],'total':_0x2552d[_0xfed0('0x14')]['total']}};if(_[_0xfed0('0x17')](md5Accounts[_0x4baaf0])){md5Accounts[_0x4baaf0]={};}var _0x25840a=md5(JSON[_0xfed0('0x18')](_0x246a8c));if(md5Accounts[_0x4baaf0]['md5']!==_0x25840a){md5Accounts[_0x4baaf0]['md5']=_0x25840a;io[_0xfed0('0x10')](_0xfed0('0x19'),_0x246a8c);}};EmailChannel[_0xfed0('0xf')]['refresh']=function(_0x17cb67){for(var _0x51a50a in _0x17cb67){if(_0x17cb67[_0xfed0('0x1a')](_0x51a50a)){if(_0x17cb67[_0x51a50a]['Imap']&&_0x17cb67[_0x51a50a]['active']){var _0x301a21=_0x17cb67[_0x51a50a]['Imap'];if(!_0x301a21[_0xfed0('0x1b')]&&_0x17cb67[_0x51a50a][_0xfed0('0x1c')]!==_0xfed0('0x1d'))_0x301a21['service']=_0x17cb67[_0x51a50a][_0xfed0('0x1c')];if(!this[_0xfed0('0xd')]['hasOwnProperty'](_0x301a21['id'])){this[_0xfed0('0xd')][_0x301a21['id']]=new EmailImap(_0x301a21,_0x17cb67[_0x51a50a][_0xfed0('0x1e')]);this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x1f'),this[_0xfed0('0x20')][_0xfed0('0x21')](this,_0x51a50a));this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x1e'),this['handleImapEmail']['bind'](this,_0x51a50a));this['imapAccounts'][_0x301a21['id']]['on'](_0xfed0('0x22'),this[_0xfed0('0x23')][_0xfed0('0x21')](this,_0x51a50a));this[_0xfed0('0xd')][_0x301a21['id']]['on'](_0xfed0('0x24'),this[_0xfed0('0x25')][_0xfed0('0x21')](this,_0x51a50a));}}else{if(_['isNil'](this[_0xfed0('0xc')][_0x51a50a][_0xfed0('0x14')])){this['mailAccounts'][_0x51a50a][_0xfed0('0x14')]={};}this[_0xfed0('0xc')][_0x51a50a][_0xfed0('0x14')][_0xfed0('0x15')]='disabled';this['mailAccounts'][_0x51a50a][_0xfed0('0x14')][_0xfed0('0x16')]='';this[_0xfed0('0x10')](_0x51a50a);}}}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x20')]=function(_0x1abd39,_0x222cbb){if(this[_0xfed0('0xc')][_0x1abd39]){this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')][_0xfed0('0x15')]='connected';this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')]['messageStatus']=_0x222cbb['name'];if(_0x222cbb[_0xfed0('0x26')]){this[_0xfed0('0xc')][_0x1abd39][_0xfed0('0x14')][_0xfed0('0x27')]=_0x222cbb[_0xfed0('0x26')][_0xfed0('0x27')];}return this[_0xfed0('0x10')](_0x1abd39);}};EmailChannel['prototype']['handleImapEmail']=function(_0x16e68b,_0x30d4a7){logger[_0xfed0('0xa')](_0xfed0('0x28'),_0x30d4a7[_0xfed0('0x29')],_0x30d4a7['lastName'],_0x30d4a7[_0xfed0('0x2a')],_0x16e68b);if(this[_0xfed0('0xc')][_0x16e68b]){return mailAccount[_0xfed0('0x2b')](_0x16e68b,_0x30d4a7)[_0xfed0('0x2c')](function(_0x584ec0){if(_0x584ec0){logger[_0xfed0('0xa')](_0xfed0('0x2d'));}})[_0xfed0('0x2e')](function(_0x3163c8){logger[_0xfed0('0x24')](_0xfed0('0x2f'),JSON[_0xfed0('0x18')](_0x3163c8));});}};EmailChannel['prototype'][_0xfed0('0x23')]=function(_0x523fd6){if(this['mailAccounts'][_0x523fd6]&&this[_0xfed0('0xc')][_0x523fd6][_0xfed0('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x523fd6][_0xfed0('0x14')]['id']]){delete this[_0xfed0('0xd')][this['mailAccounts'][_0x523fd6][_0xfed0('0x14')]['id']];}this[_0xfed0('0xc')][_0x523fd6][_0xfed0('0x14')]['lastSync']=moment();this[_0xfed0('0x10')](_0x523fd6);}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x25')]=function(_0x36db6b,_0x560cf0){if(this[_0xfed0('0xc')][_0x36db6b]){this[_0xfed0('0xc')][_0x36db6b][_0xfed0('0x14')][_0xfed0('0x15')]='error';this[_0xfed0('0xc')][_0x36db6b][_0xfed0('0x14')]['messageStatus']=_0x560cf0;return this['emit'](_0x36db6b);}};EmailChannel[_0xfed0('0xf')][_0xfed0('0x30')]=function(_0x5c4fbd,_0x5e182f){return this[_0xfed0('0xe')]['send'](_0x5c4fbd,_0x5e182f);};EmailChannel[_0xfed0('0xf')]['verifySmtp']=function(_0x2f6ec8){var _0x28d8f8=this;if(this['mailAccounts'][_0x2f6ec8['id']]){if(_[_0xfed0('0x17')](this[_0xfed0('0xc')][_0x2f6ec8['id']]['Smtp'])){this[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')]={};}this['mailAccounts'][_0x2f6ec8['id']]['Smtp'][_0xfed0('0x32')]=moment();return new BPromise(function(_0x129f7c,_0x176622){return _0x28d8f8[_0xfed0('0xe')][_0xfed0('0x33')](_0x2f6ec8)[_0xfed0('0x2c')](function(_0x4eb4fe){_0x28d8f8['mailAccounts'][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x15')]=_0xfed0('0x34');_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x16')]='';_0x28d8f8[_0xfed0('0x10')](_0x2f6ec8['id']);_0x129f7c(_0x4eb4fe);})[_0xfed0('0x2e')](function(_0x45f43a){_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']]['Smtp'][_0xfed0('0x15')]='error';_0x28d8f8[_0xfed0('0xc')][_0x2f6ec8['id']][_0xfed0('0x31')][_0xfed0('0x16')]=_0x45f43a;_0x28d8f8[_0xfed0('0x10')](_0x2f6ec8['id']);_0x176622(_0x45f43a);});});}return this['smtp'][_0xfed0('0x33')](_0x2f6ec8);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d3d8a8c..c659c83 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 _0xc0d7=['parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','imap','once','handleReady','bind','end','handleEnd','error','handleError','connect','prototype','getAccount','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','message','handleFetchMessage','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x280f7c,_0x190529){_0x280f7c=_0x280f7c-0x0;var _0x1a01c7=_0xc0d7[_0x280f7c];return _0x1a01c7;};'use strict';var _=require('lodash');var util=require('util');var Imap=require('imap');var simpleParser=require(_0x7c0d('0x0'))[_0x7c0d('0x1')];var Iconv=require(_0x7c0d('0x2'))[_0x7c0d('0x3')];var EventEmitter=require(_0x7c0d('0x4'))[_0x7c0d('0x5')];var utils=require(_0x7c0d('0x6'));var logger=require(_0x7c0d('0x7'))(_0x7c0d('0x8'));function EmailImap(_0x5a6a70,_0x507bc0){this[_0x7c0d('0x9')]=_0x7c0d('0xa');this[_0x7c0d('0xb')]=this['getAccount'](_0x5a6a70,_0x507bc0);this[_0x7c0d('0xc')]=new Imap(this[_0x7c0d('0xb')]);this[_0x7c0d('0xc')][_0x7c0d('0xd')]('ready',this[_0x7c0d('0xe')][_0x7c0d('0xf')](this));this['imap']['once'](_0x7c0d('0x10'),this[_0x7c0d('0x11')]['bind'](this));this[_0x7c0d('0xc')]['on'](_0x7c0d('0x12'),this[_0x7c0d('0x13')][_0x7c0d('0xf')](this));this[_0x7c0d('0xc')][_0x7c0d('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x7c0d('0x15')][_0x7c0d('0x16')]=function(_0x2ee593,_0x25c4a8){var _0x33dd94={'connTimeout':_0x2ee593[_0x7c0d('0x17')]?_0x2ee593[_0x7c0d('0x17')]*0x3e8:0x2710,'authTimeout':_0x2ee593[_0x7c0d('0x18')]?_0x2ee593['authTimeout']*0x3e8:0x1388};if(_0x2ee593[_0x7c0d('0x19')]){_0x33dd94['user']=_0x2ee593[_0x7c0d('0x1a')];_0x33dd94['email']=_0x25c4a8||_0x2ee593[_0x7c0d('0x1a')]||_0x7c0d('0x1b');if(_0x2ee593[_0x7c0d('0x1c')]){_0x33dd94[_0x7c0d('0x1d')]=utils[_0x7c0d('0x1e')](_0x2ee593[_0x7c0d('0x1f')][_0x7c0d('0x20')],_0x2ee593[_0x7c0d('0x1a')]);}else{_0x33dd94[_0x7c0d('0x21')]=_0x2ee593[_0x7c0d('0x21')];}}else{if(_0x2ee593[_0x7c0d('0x22')]){_0x33dd94[_0x7c0d('0x1a')]=_0x2ee593[_0x7c0d('0x1a')];_0x33dd94[_0x7c0d('0x21')]=_0x2ee593[_0x7c0d('0x21')];}}_0x33dd94[_0x7c0d('0x23')]=_0x2ee593[_0x7c0d('0x23')];_0x33dd94[_0x7c0d('0x24')]=_0x2ee593[_0x7c0d('0x24')]||0x3e1;if(_0x2ee593['tls']){_0x33dd94['tls']=!![];}else{_0x33dd94['tls']=![];_0x33dd94['autotls']='required';}return _0x33dd94;};EmailImap[_0x7c0d('0x15')][_0x7c0d('0xe')]=function(){this[_0x7c0d('0xc')][_0x7c0d('0x25')](this[_0x7c0d('0x9')],![],this[_0x7c0d('0x26')][_0x7c0d('0xf')](this));};EmailImap['prototype'][_0x7c0d('0x26')]=function(_0xb7d5e4,_0x5aa006){if(_0xb7d5e4){this['handleError'](_0xb7d5e4,!![]);}else{this[_0x7c0d('0x27')]('box',_0x5aa006);this[_0x7c0d('0x28')]();}};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x29')]=function(_0x34309){if(_0x34309){this[_0x7c0d('0x13')](_0x34309,!![]);}else{this['imap'][_0x7c0d('0x10')]();}};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x28')]=function(){this[_0x7c0d('0xc')][_0x7c0d('0x2a')](['UNSEEN'],this[_0x7c0d('0x2b')]['bind'](this));};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x2b')]=function(_0x15569b,_0x5aa43a){if(_0x15569b){this[_0x7c0d('0x13')](_0x15569b,!![]);}else{if(_0x5aa43a[_0x7c0d('0x2c')]){try{var _0x4f66ef=this[_0x7c0d('0xc')]['fetch'](_0x5aa43a,{'bodies':'','markSeen':!![]});_0x4f66ef['on'](_0x7c0d('0x2d'),this[_0x7c0d('0x2e')]['bind'](this));_0x4f66ef['once'](_0x7c0d('0x12'),this['handleFetchError'][_0x7c0d('0xf')](this));_0x4f66ef[_0x7c0d('0xd')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x56e908){logger[_0x7c0d('0x12')](_0x56e908);}}else{this['imap'][_0x7c0d('0x2f')](!![],this[_0x7c0d('0x29')]['bind'](this));}}};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x2e')]=function(_0x13d6f2){_0x13d6f2['on'](_0x7c0d('0x30'),this['handleMessageBody'][_0x7c0d('0xf')](this));_0x13d6f2[_0x7c0d('0xd')](_0x7c0d('0x31'),this[_0x7c0d('0x32')][_0x7c0d('0xf')](this));_0x13d6f2[_0x7c0d('0xd')](_0x7c0d('0x10'),this[_0x7c0d('0x33')][_0x7c0d('0xf')](this));};EmailImap[_0x7c0d('0x15')]['handleMessageBody']=function(_0x692e16){simpleParser(_0x692e16,{'Iconv':Iconv},this[_0x7c0d('0x34')]['bind'](this));};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x32')]=function(){};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x33')]=function(){};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x34')]=function(_0x4c15c0,_0x2c8520){if(_0x4c15c0){logger[_0x7c0d('0x12')](_0x4c15c0);}else{var _0x309f6b=this;utils[_0x7c0d('0x35')](this[_0x7c0d('0xb')],_0x2c8520,function(_0x5b0193){_0x309f6b['emit'](_0x7c0d('0x8'),_0x5b0193);});}};EmailImap[_0x7c0d('0x15')]['handleFetchEnd']=function(){this[_0x7c0d('0xc')]['closeBox'](!![],this[_0x7c0d('0x29')][_0x7c0d('0xf')](this));};EmailImap['prototype'][_0x7c0d('0x36')]=function(_0x5b2080){this[_0x7c0d('0x13')](_0x5b2080);this[_0x7c0d('0xc')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7c0d('0x15')][_0x7c0d('0x11')]=function(){this[_0x7c0d('0x27')](_0x7c0d('0x10'));};EmailImap['prototype']['handleError']=function(_0x114210,_0x4bd8c3){logger['error'](_0x7c0d('0x13'),this['account'][_0x7c0d('0x8')],JSON[_0x7c0d('0x37')](_0x114210));var _0x527e33='';if(_0x114210){if(_0x114210[_0x7c0d('0x38')]){_0x527e33=_0x114210[_0x7c0d('0x38')];}else{for(var _0x2449a3 in _0x114210){if(_0x114210[_0x7c0d('0x39')](_0x2449a3)){_0x527e33+=_[_0x7c0d('0x3a')](_0x2449a3)+':\x20'+_0x114210[_0x2449a3]+'\x0a';}}}}if(_0x4bd8c3){this['imap'][_0x7c0d('0x10')]();}else{this[_0x7c0d('0x27')]('error',_0x527e33);this[_0x7c0d('0x27')](_0x7c0d('0x10'));}};module[_0x7c0d('0x3b')]=EmailImap; \ No newline at end of file +var _0xc1c6=['mailbox','handleOpenBox','emit','box','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','handleSimpleParser','handleMessageEnd','error','parser','textCode','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','email','INBOX','account','getAccount','once','handleReady','bind','handleEnd','handleError','inherits','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','generateXOAuth2Token','data5','password','host','port','tls','autotls','required','prototype','openBox'];(function(_0x30746a,_0x3b3626){var _0x5af371=function(_0x445e6a){while(--_0x445e6a){_0x30746a['push'](_0x30746a['shift']());}};_0x5af371(++_0x3b3626);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x59e3e6,_0x429711){_0x59e3e6=_0x59e3e6-0x0;var _0x38dce5=_0xc1c6[_0x59e3e6];return _0x38dce5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var Imap=require(_0x6c1c('0x2'));var simpleParser=require('mailparser')[_0x6c1c('0x3')];var Iconv=require('iconv')[_0x6c1c('0x4')];var EventEmitter=require(_0x6c1c('0x5'))[_0x6c1c('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x6c1c('0x7'));function EmailImap(_0x524a6b,_0x50c1bb){this['mailbox']=_0x6c1c('0x8');this[_0x6c1c('0x9')]=this[_0x6c1c('0xa')](_0x524a6b,_0x50c1bb);this[_0x6c1c('0x2')]=new Imap(this['account']);this[_0x6c1c('0x2')][_0x6c1c('0xb')]('ready',this[_0x6c1c('0xc')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')][_0x6c1c('0xb')]('end',this[_0x6c1c('0xe')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')]['on']('error',this[_0x6c1c('0xf')][_0x6c1c('0xd')](this));this[_0x6c1c('0x2')]['connect']();}util[_0x6c1c('0x10')](EmailImap,EventEmitter);EmailImap['prototype'][_0x6c1c('0xa')]=function(_0x15a1fc,_0x2d279e){var _0x154107={'connTimeout':_0x15a1fc[_0x6c1c('0x11')]?_0x15a1fc[_0x6c1c('0x11')]*0x3e8:0x2710,'authTimeout':_0x15a1fc[_0x6c1c('0x12')]?_0x15a1fc[_0x6c1c('0x12')]*0x3e8:0x1388};if(_0x15a1fc[_0x6c1c('0x13')]){_0x154107['user']=_0x15a1fc[_0x6c1c('0x14')];_0x154107[_0x6c1c('0x7')]=_0x2d279e||_0x15a1fc['user']||_0x6c1c('0x15');if(_0x15a1fc[_0x6c1c('0x16')]){_0x154107['xoauth2']=utils[_0x6c1c('0x17')](_0x15a1fc['CloudProvider'][_0x6c1c('0x18')],_0x15a1fc[_0x6c1c('0x14')]);}else{_0x154107['password']=_0x15a1fc[_0x6c1c('0x19')];}}else{if(_0x15a1fc['authentication']){_0x154107[_0x6c1c('0x14')]=_0x15a1fc[_0x6c1c('0x14')];_0x154107[_0x6c1c('0x19')]=_0x15a1fc[_0x6c1c('0x19')];}}_0x154107[_0x6c1c('0x1a')]=_0x15a1fc[_0x6c1c('0x1a')];_0x154107[_0x6c1c('0x1b')]=_0x15a1fc[_0x6c1c('0x1b')]||0x3e1;if(_0x15a1fc[_0x6c1c('0x1c')]){_0x154107[_0x6c1c('0x1c')]=!![];}else{_0x154107[_0x6c1c('0x1c')]=![];_0x154107[_0x6c1c('0x1d')]=_0x6c1c('0x1e');}return _0x154107;};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0xc')]=function(){this[_0x6c1c('0x2')][_0x6c1c('0x20')](this[_0x6c1c('0x21')],![],this[_0x6c1c('0x22')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x22')]=function(_0x2ef382,_0x7ff10d){if(_0x2ef382){this[_0x6c1c('0xf')](_0x2ef382,!![]);}else{this[_0x6c1c('0x23')](_0x6c1c('0x24'),_0x7ff10d);this[_0x6c1c('0x25')]();}};EmailImap[_0x6c1c('0x1f')]['handleCloseBox']=function(_0x2595c3){if(_0x2595c3){this['handleError'](_0x2595c3,!![]);}else{this[_0x6c1c('0x2')]['end']();}};EmailImap[_0x6c1c('0x1f')]['readUnseen']=function(){this[_0x6c1c('0x2')][_0x6c1c('0x26')](['UNSEEN'],this[_0x6c1c('0x27')][_0x6c1c('0xd')](this));};EmailImap['prototype'][_0x6c1c('0x27')]=function(_0x19a8f1,_0xdcef7){if(_0x19a8f1){this[_0x6c1c('0xf')](_0x19a8f1,!![]);}else{if(_0xdcef7['length']){try{var _0x52c036=this[_0x6c1c('0x2')][_0x6c1c('0x28')](_0xdcef7,{'bodies':'','markSeen':!![]});_0x52c036['on'](_0x6c1c('0x29'),this[_0x6c1c('0x2a')][_0x6c1c('0xd')](this));_0x52c036[_0x6c1c('0xb')]('error',this[_0x6c1c('0x2b')][_0x6c1c('0xd')](this));_0x52c036['once'](_0x6c1c('0x2c'),this[_0x6c1c('0x2d')][_0x6c1c('0xd')](this));}catch(_0x15b6d2){logger['error'](_0x15b6d2);}}else{this[_0x6c1c('0x2')][_0x6c1c('0x2e')](!![],this[_0x6c1c('0x2f')]['bind'](this));}}};EmailImap[_0x6c1c('0x1f')]['handleFetchMessage']=function(_0x6870a4){_0x6870a4['on']('body',this[_0x6c1c('0x30')][_0x6c1c('0xd')](this));_0x6870a4[_0x6c1c('0xb')]('attributes',this['handleMessageAttributes'][_0x6c1c('0xd')](this));_0x6870a4[_0x6c1c('0xb')](_0x6c1c('0x2c'),this['handleMessageEnd'][_0x6c1c('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x794e73){simpleParser(_0x794e73,{'Iconv':Iconv},this[_0x6c1c('0x31')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')]['handleMessageAttributes']=function(){};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x32')]=function(){};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x31')]=function(_0x173a54,_0x398e95){if(_0x173a54){logger[_0x6c1c('0x33')](_0x173a54);}else{var _0x988821=this;utils[_0x6c1c('0x34')](this[_0x6c1c('0x9')],_0x398e95,function(_0x47d75e){_0x988821[_0x6c1c('0x23')](_0x6c1c('0x7'),_0x47d75e);});}};EmailImap[_0x6c1c('0x1f')][_0x6c1c('0x2d')]=function(){this[_0x6c1c('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x6c1c('0x1f')]['handleFetchError']=function(_0x4d7dc6){this[_0x6c1c('0xf')](_0x4d7dc6);this[_0x6c1c('0x2')]['closeBox'](!![],this[_0x6c1c('0x2f')][_0x6c1c('0xd')](this));};EmailImap[_0x6c1c('0x1f')]['handleEnd']=function(){this[_0x6c1c('0x23')](_0x6c1c('0x2c'));};EmailImap['prototype'][_0x6c1c('0xf')]=function(_0x4cc30f,_0x111eb8){logger[_0x6c1c('0x33')](_0x6c1c('0xf'),this[_0x6c1c('0x9')][_0x6c1c('0x7')],JSON['stringify'](_0x4cc30f));var _0x23a8c3='';if(_0x4cc30f){if(_0x4cc30f[_0x6c1c('0x35')]){_0x23a8c3=_0x4cc30f[_0x6c1c('0x35')];}else{for(var _0x5d4058 in _0x4cc30f){if(_0x4cc30f[_0x6c1c('0x36')](_0x5d4058)){_0x23a8c3+=_[_0x6c1c('0x37')](_0x5d4058)+':\x20'+_0x4cc30f[_0x5d4058]+'\x0a';}}}}if(_0x111eb8){this[_0x6c1c('0x2')][_0x6c1c('0x2c')]();}else{this[_0x6c1c('0x23')]('error',_0x23a8c3);this[_0x6c1c('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d9509d9..01c0d21 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 _0x135a=['send','use','compile','sendMail','toString','verify','createTransport','Not\x20verifired','nodemailer-plugin-inline-base64','prototype'];(function(_0x45865c,_0x3d0da2){var _0x51f894=function(_0x2493f2){while(--_0x2493f2){_0x45865c['push'](_0x45865c['shift']());}};_0x51f894(++_0x3d0da2);}(_0x135a,0x6c));var _0xa135=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x135a[_0x17d9e3];return _0x14192d;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xa135('0x0'));function EmailSmtp(){}EmailSmtp[_0xa135('0x1')][_0xa135('0x2')]=function(_0x19c5a8,_0x2da052){return new Promise(function(_0x5c40bd,_0x570e91){var _0x883d67=nodemailer['createTransport'](_0x19c5a8);_0x883d67[_0xa135('0x3')](_0xa135('0x4'),inlineBase64());_0x883d67[_0xa135('0x5')](_0x2da052,function(_0x299aa0,_0x26688f){if(_0x299aa0){_0x570e91(_0x299aa0[_0xa135('0x6')]());}else{_0x5c40bd(_0x26688f);}});});};EmailSmtp[_0xa135('0x1')][_0xa135('0x7')]=function(_0x3c0ecd){return new Promise(function(_0x188d65,_0xe4407f){var _0x31ae36=nodemailer[_0xa135('0x8')](_0x3c0ecd);_0x31ae36['verify'](function(_0x28cbaf,_0x350a54){if(_0x28cbaf){_0xe4407f(_0x28cbaf[_0xa135('0x6')]());}else{if(_0x350a54){_0x188d65(_0x350a54);}else{_0xe4407f(_0xa135('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x2ef3=['toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail'];(function(_0x110a90,_0x187d0a){var _0x54f73f=function(_0x13d65a){while(--_0x13d65a){_0x110a90['push'](_0x110a90['shift']());}};_0x54f73f(++_0x187d0a);}(_0x2ef3,0x7d));var _0x32ef=function(_0x450830,_0x32ca8e){_0x450830=_0x450830-0x0;var _0x42d885=_0x2ef3[_0x450830];return _0x42d885;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x32ef('0x0'));function EmailSmtp(){}EmailSmtp[_0x32ef('0x1')][_0x32ef('0x2')]=function(_0x4d1bfb,_0x37422a){return new Promise(function(_0x48d66e,_0x5c5aa0){var _0x2d4288=nodemailer[_0x32ef('0x3')](_0x4d1bfb);_0x2d4288[_0x32ef('0x4')](_0x32ef('0x5'),inlineBase64());_0x2d4288[_0x32ef('0x6')](_0x37422a,function(_0x45316,_0x2f8df){if(_0x45316){_0x5c5aa0(_0x45316[_0x32ef('0x7')]());}else{_0x48d66e(_0x2f8df);}});});};EmailSmtp[_0x32ef('0x1')][_0x32ef('0x8')]=function(_0x451f9b){return new Promise(function(_0x14506c,_0x12e8cc){var _0x1bc13c=nodemailer['createTransport'](_0x451f9b);_0x1bc13c[_0x32ef('0x8')](function(_0x53b1d8,_0x3df845){if(_0x53b1d8){_0x12e8cc(_0x53b1d8[_0x32ef('0x7')]());}else{if(_0x3df845){_0x14506c(_0x3df845);}else{_0x12e8cc(_0x32ef('0x9'));}}});});};module[_0x32ef('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2fcf108..305cfe9 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 _0x3458=['generate','html','\x20[Attachment:\x20','\x20]','textAsHtml','body','Empty\x20message

','Attachments','Title','Data','user=','utf-8','toString','lodash','moment','randomstring','path','util','email','../../../config/environment','value','address','@xcally.com','head','name','indexOf','split','length','slice','join','Anonymous','isEmpty'];(function(_0x48d3ad,_0x290e43){var _0xa60d6e=function(_0x424a3e){while(--_0x424a3e){_0x48d3ad['push'](_0x48d3ad['shift']());}};_0xa60d6e(++_0x290e43);}(_0x3458,0x19d));var _0x8345=function(_0x19f07d,_0x670b92){_0x19f07d=_0x19f07d-0x0;var _0x60f613=_0x3458[_0x19f07d];return _0x60f613;};'use strict';var _=require(_0x8345('0x0'));var moment=require(_0x8345('0x1'));var random=require(_0x8345('0x2'));var fs=require('fs');var path=require(_0x8345('0x3'));var util=require(_0x8345('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x8345('0x5'));var config=require(_0x8345('0x6'));function getAddress(_0x416f7a){var _0x4d250f=_['head'](_0x416f7a[_0x8345('0x7')]);return _0x4d250f&&_0x4d250f[_0x8345('0x8')]?_0x4d250f[_0x8345('0x8')]:'anonymous'+random['generate'](0x6)+_0x8345('0x9');}function getFirstName(_0x5eea57){var _0x54fca3=_[_0x8345('0xa')](_0x5eea57[_0x8345('0x7')]);if(_0x54fca3&&_0x54fca3[_0x8345('0xb')]){if(_0x54fca3[_0x8345('0xb')]==_0x54fca3[_0x8345('0x8')]){return _0x54fca3['name']['substring'](0x0,_0x54fca3[_0x8345('0xb')][_0x8345('0xc')]('@'));}var _0x13cf4c=_0x54fca3[_0x8345('0xb')][_0x8345('0xd')](/\s+/);return _0x13cf4c[_0x8345('0xe')]>0x1?_0x13cf4c[_0x8345('0xf')](0x0,-0x1)[_0x8345('0x10')]('\x20'):_0x54fca3[_0x8345('0xb')];}return _0x8345('0x11');}function getLastName(_0x43861e){var _0x4e84db=_[_0x8345('0xa')](_0x43861e[_0x8345('0x7')]);if(_0x4e84db&&_0x4e84db[_0x8345('0xb')]){var _0x49c205=_0x4e84db[_0x8345('0xb')]['split'](/\s+/);return _0x49c205['length']>0x1?_0x49c205['pop']():'';}return'';}function getMails(_0x223330,_0x704073){var _0x2a0e1a='';for(var _0x4977e9=0x0;_0x4977e9<_0x704073[_0x8345('0x7')][_0x8345('0xe')];_0x4977e9+=0x1){if(_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]!==_0x223330){if(!_[_0x8345('0x12')](_0x2a0e1a)){_0x2a0e1a+=',';}_0x2a0e1a+=_0x704073['value'][_0x4977e9][_0x8345('0xb')]||_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]||'';_0x2a0e1a+='\x20<';_0x2a0e1a+=_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]?_0x704073[_0x8345('0x7')][_0x4977e9][_0x8345('0x8')]:'anonymous'+random[_0x8345('0x13')](0x6)+_0x8345('0x9');_0x2a0e1a+='>';}}return _0x2a0e1a;}function parseEmail(_0x2c025e,_0x61b172,_0x45e873){if(_0x61b172['html']){var _0x1d931a=/)<[^<]*)*<\/script>/gi;while(_0x1d931a['test'](_0x61b172[_0x8345('0x14')])){_0x61b172[_0x8345('0x14')]=_0x61b172[_0x8345('0x14')]['replace'](_0x1d931a,'');}if(_0x61b172[_0x8345('0x14')]['includes'](_0x8345('0x15'))){var _0x479611=[];_0x61b172[_0x8345('0x16')][_0x8345('0x17')](_0x12c2cd=>{_0x479611['push'](_0x12c2cd[_0x8345('0x18')]);});var _0x492f9a=/]+>/g;var _0x2f7eef=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x35e73d=_0x61b172[_0x8345('0x14')][_0x8345('0x19')](_0x2f7eef,_0x8345('0x1a'));var _0x1d1da2=_0x35e73d['replace'](_0x492f9a,_0x8345('0x1b'));for(let _0x5604ea=0x0;_0x5604ea<_0x479611['length'];_0x5604ea++){var _0x33697f=_0x1d1da2[_0x8345('0x19')](_0x8345('0x1b'),_0x8345('0x1c')+_0x479611[_0x5604ea]+_0x8345('0x1d'));_0x1d1da2=_0x33697f;}_0x61b172[_0x8345('0x14')]=_0x1d1da2;}_0x45e873['body']=_0x61b172[_0x8345('0x14')];}else{_0x45e873['body']=_0x61b172[_0x8345('0x1e')];}if(_0x45e873['body']){_0x45e873['body']=_0x45e873[_0x8345('0x1f')][_0x8345('0x19')](/0x0){var _0x7b3e4d=[_0x8345('0x32'),_0x8345('0x33'),'Precedence:\x20auto_reply'];for(var _0x3adc09=0x0;_0x3adc09<_0x61b172[_0x8345('0x31')][_0x8345('0xe')];_0x3adc09++){var _0x1292fa=_[_0x8345('0xc')](_0x7b3e4d,_0x61b172[_0x8345('0x31')][_0x3adc09][_0x8345('0x34')]);if(_0x1292fa>=0x0){_0x45e873[_0x8345('0x35')]=!![];}}}return _0x45e873;}exports[_0x8345('0x36')]=function(_0x54a953,_0x24113a,_0x163984){var _0x3b1499={'from':getAddress(_0x24113a[_0x8345('0x37')]),'firstName':getFirstName(_0x24113a['from']),'lastName':getLastName(_0x24113a[_0x8345('0x37')]),'mapKey':_0x8345('0x5'),'message':{'from':getMails(_0x54a953[_0x8345('0x5')],_0x24113a['from']),'to':_0x54a953[_0x8345('0x5')],'cc':'','subject':_0x24113a[_0x8345('0x38')]||'','messageId':_0x24113a['messageId'],'inReplyTo':_0x24113a[_0x8345('0x39')],'sentAt':moment(_0x24113a[_0x8345('0x3a')])[_0x8345('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x24113a[_0x8345('0x14')]&&!_0x24113a['textAsHtml']){var _0x40ee54=_[_0x8345('0x3b')](_0x24113a[_0x8345('0x16')],{'contentType':'application/ms-tnef'});if(_0x40ee54[_0x8345('0xe')]){logger['info'](util[_0x8345('0x29')](_0x8345('0x3c'),_0x24113a[_0x8345('0x3d')]));tnef[_0x8345('0x3e')](_[_0x8345('0x3f')](_0x40ee54)['content'],function(_0x5382d0,_0x1f08fd){if(_0x1f08fd){_0x24113a[_0x8345('0x14')]=_0x1f08fd[_0x8345('0x40')]||_0x8345('0x41');if(_0x1f08fd[_0x8345('0x42')]){for(var _0x282858=0x0;_0x282858<_0x1f08fd[_0x8345('0x42')][_0x8345('0xe')];_0x282858++){var _0x5cbdb0=_0x1f08fd[_0x8345('0x42')][_0x282858];_0x3b1499[_0x8345('0x21')][_0x8345('0x16')]['push']({'filename':_0x5cbdb0[_0x8345('0x43')],'content':Buffer[_0x8345('0x37')](_0x5cbdb0[_0x8345('0x44')])});}}}_0x163984(parseEmail(_0x54a953,_0x24113a,_0x3b1499));});}else{_0x24113a[_0x8345('0x14')]=_0x8345('0x41');_0x163984(parseEmail(_0x54a953,_0x24113a,_0x3b1499));}}else{_0x163984(parseEmail(_0x54a953,_0x24113a,_0x3b1499));}};exports['generateXOAuth2Token']=function(_0x486f7b,_0x35f99d){var _0x435e12=[_0x8345('0x45')+(_0x35f99d||''),'auth=Bearer\x20'+_0x486f7b,'',''];return Buffer[_0x8345('0x37')](_0x435e12[_0x8345('0x10')](''),_0x8345('0x46'))[_0x8345('0x47')]('base64');}; \ No newline at end of file +var _0x1ea3=['../../../config/environment','generate','@xcally.com','value','name','substring','indexOf','slice','join','Anonymous','head','length','pop','address','isEmpty','anonymous','html','test','replace','includes','','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','util','node-tnef','../../../config/logger'];(function(_0x962fa2,_0x59d469){var _0x3411e3=function(_0x11398b){while(--_0x11398b){_0x962fa2['push'](_0x962fa2['shift']());}};_0x3411e3(++_0x59d469);}(_0x1ea3,0x1c2));var _0x31ea=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1ea3[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var moment=require(_0x31ea('0x0'));var random=require(_0x31ea('0x1'));var fs=require('fs');var path=require(_0x31ea('0x2'));var util=require(_0x31ea('0x3'));var tnef=require(_0x31ea('0x4'));var logger=require(_0x31ea('0x5'))('email');var config=require(_0x31ea('0x6'));function getAddress(_0xf1d998){var _0xe53963=_['head'](_0xf1d998['value']);return _0xe53963&&_0xe53963['address']?_0xe53963['address']:'anonymous'+random[_0x31ea('0x7')](0x6)+_0x31ea('0x8');}function getFirstName(_0x3dec7b){var _0x3b10ce=_['head'](_0x3dec7b[_0x31ea('0x9')]);if(_0x3b10ce&&_0x3b10ce[_0x31ea('0xa')]){if(_0x3b10ce[_0x31ea('0xa')]==_0x3b10ce['address']){return _0x3b10ce[_0x31ea('0xa')][_0x31ea('0xb')](0x0,_0x3b10ce['name'][_0x31ea('0xc')]('@'));}var _0xc580ec=_0x3b10ce['name']['split'](/\s+/);return _0xc580ec['length']>0x1?_0xc580ec[_0x31ea('0xd')](0x0,-0x1)[_0x31ea('0xe')]('\x20'):_0x3b10ce[_0x31ea('0xa')];}return _0x31ea('0xf');}function getLastName(_0x20e87b){var _0x3623a1=_[_0x31ea('0x10')](_0x20e87b[_0x31ea('0x9')]);if(_0x3623a1&&_0x3623a1[_0x31ea('0xa')]){var _0x5bc1de=_0x3623a1[_0x31ea('0xa')]['split'](/\s+/);return _0x5bc1de[_0x31ea('0x11')]>0x1?_0x5bc1de[_0x31ea('0x12')]():'';}return'';}function getMails(_0x36f2c8,_0x29dd62){var _0xa21e62='';for(var _0x5140d7=0x0;_0x5140d7<_0x29dd62[_0x31ea('0x9')][_0x31ea('0x11')];_0x5140d7+=0x1){if(_0x29dd62['value'][_0x5140d7][_0x31ea('0x13')]!==_0x36f2c8){if(!_[_0x31ea('0x14')](_0xa21e62)){_0xa21e62+=',';}_0xa21e62+=_0x29dd62['value'][_0x5140d7][_0x31ea('0xa')]||_0x29dd62[_0x31ea('0x9')][_0x5140d7]['address']||'';_0xa21e62+='\x20<';_0xa21e62+=_0x29dd62[_0x31ea('0x9')][_0x5140d7][_0x31ea('0x13')]?_0x29dd62[_0x31ea('0x9')][_0x5140d7][_0x31ea('0x13')]:_0x31ea('0x15')+random[_0x31ea('0x7')](0x6)+_0x31ea('0x8');_0xa21e62+='>';}}return _0xa21e62;}function parseEmail(_0xb713e9,_0x50f9b0,_0x4d438e){if(_0x50f9b0[_0x31ea('0x16')]){var _0x10e859=/)<[^<]*)*<\/script>/gi;while(_0x10e859[_0x31ea('0x17')](_0x50f9b0['html'])){_0x50f9b0[_0x31ea('0x16')]=_0x50f9b0[_0x31ea('0x16')][_0x31ea('0x18')](_0x10e859,'');}if(_0x50f9b0[_0x31ea('0x16')][_0x31ea('0x19')](_0x31ea('0x1a'))){var _0x288d59=[];_0x50f9b0[_0x31ea('0x1b')][_0x31ea('0x1c')](_0xc61874=>{_0x288d59[_0x31ea('0x1d')](_0xc61874['filename']);});var _0x527eb5=/]+>/g;var _0x43b1c8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4cb12b=_0x50f9b0[_0x31ea('0x16')]['replace'](_0x43b1c8,_0x31ea('0x1e'));var _0x3b871b=_0x4cb12b[_0x31ea('0x18')](_0x527eb5,_0x31ea('0x1f'));for(let _0x5ec003=0x0;_0x5ec003<_0x288d59['length'];_0x5ec003++){var _0xd61778=_0x3b871b[_0x31ea('0x18')]('_IMG','\x20[Attachment:\x20'+_0x288d59[_0x5ec003]+_0x31ea('0x20'));_0x3b871b=_0xd61778;}_0x50f9b0[_0x31ea('0x16')]=_0x3b871b;}_0x4d438e['body']=_0x50f9b0[_0x31ea('0x16')];}else{_0x4d438e[_0x31ea('0x21')]=_0x50f9b0[_0x31ea('0x22')];}if(_0x4d438e[_0x31ea('0x21')]){_0x4d438e[_0x31ea('0x21')]=_0x4d438e[_0x31ea('0x21')][_0x31ea('0x18')](/0x0){var _0x36954f=[_0x31ea('0x33'),'X-Auto-Response-Suppress:\x20All',_0x31ea('0x34')];for(var _0x526115=0x0;_0x526115<_0x50f9b0[_0x31ea('0x32')][_0x31ea('0x11')];_0x526115++){var _0x4e0638=_['indexOf'](_0x36954f,_0x50f9b0['headerLines'][_0x526115][_0x31ea('0x35')]);if(_0x4e0638>=0x0){_0x4d438e[_0x31ea('0x36')]=!![];}}}return _0x4d438e;}exports['parser']=function(_0x4aeb41,_0x409699,_0x498140){var _0xb05edc={'from':getAddress(_0x409699[_0x31ea('0x37')]),'firstName':getFirstName(_0x409699['from']),'lastName':getLastName(_0x409699['from']),'mapKey':'email','message':{'from':getMails(_0x4aeb41[_0x31ea('0x26')],_0x409699['from']),'to':_0x4aeb41[_0x31ea('0x26')],'cc':'','subject':_0x409699[_0x31ea('0x38')]||'','messageId':_0x409699[_0x31ea('0x39')],'inReplyTo':_0x409699[_0x31ea('0x3a')],'sentAt':moment(_0x409699[_0x31ea('0x3b')])['format'](_0x31ea('0x3c')),'attach':![],'attachments':[]}};if(!_0x409699[_0x31ea('0x16')]&&!_0x409699[_0x31ea('0x22')]){var _0x3a88f6=_[_0x31ea('0x3d')](_0x409699[_0x31ea('0x1b')],{'contentType':'application/ms-tnef'});if(_0x3a88f6[_0x31ea('0x11')]){logger[_0x31ea('0x3e')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x409699[_0x31ea('0x39')]));tnef[_0x31ea('0x3f')](_[_0x31ea('0x40')](_0x3a88f6)[_0x31ea('0x41')],function(_0x124418,_0x201985){if(_0x201985){_0x409699['html']=_0x201985[_0x31ea('0x42')]||'

Empty\x20message

';if(_0x201985[_0x31ea('0x43')]){for(var _0x486b96=0x0;_0x486b96<_0x201985[_0x31ea('0x43')][_0x31ea('0x11')];_0x486b96++){var _0x482a97=_0x201985[_0x31ea('0x43')][_0x486b96];_0xb05edc[_0x31ea('0x24')]['attachments']['push']({'filename':_0x482a97[_0x31ea('0x44')],'content':Buffer['from'](_0x482a97[_0x31ea('0x45')])});}}}_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));});}else{_0x409699[_0x31ea('0x16')]=_0x31ea('0x46');_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));}}else{_0x498140(parseEmail(_0x4aeb41,_0x409699,_0xb05edc));}};exports[_0x31ea('0x47')]=function(_0x27e1b6,_0x55b108){var _0x24a45c=['user='+(_0x55b108||''),_0x31ea('0x48')+_0x27e1b6,'',''];return Buffer[_0x31ea('0x37')](_0x24a45c[_0x31ea('0xe')](''),_0x31ea('0x49'))[_0x31ea('0x4a')](_0x31ea('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 50126fa..71a5c74 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 _0x666f=['key','SERV','active','Imap','Smtp','lodash','name','Service'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0x666f,0xf5));var _0xf666=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x666f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf666('0x0'));function MailAccount(_0x2a3522){this['id']=_0x2a3522['id']||0x0;this[_0xf666('0x1')]=_0x2a3522[_0xf666('0x1')]||_0xf666('0x2');this[_0xf666('0x3')]=_0x2a3522[_0xf666('0x3')]||_0xf666('0x4');this[_0xf666('0x5')]=_0x2a3522[_0xf666('0x5')]||![];this[_0xf666('0x6')]=_0x2a3522[_0xf666('0x6')]||[];this['Smtp']=_0x2a3522[_0xf666('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x724b=['active','Imap','Smtp','lodash','name','Service','key','SERV'];(function(_0x28b89d,_0x347152){var _0x3c1127=function(_0x4c7759){while(--_0x4c7759){_0x28b89d['push'](_0x28b89d['shift']());}};_0x3c1127(++_0x347152);}(_0x724b,0x17b));var _0xb724=function(_0x5953c,_0x252939){_0x5953c=_0x5953c-0x0;var _0x8766ae=_0x724b[_0x5953c];return _0x8766ae;};'use strict';var _=require(_0xb724('0x0'));function MailAccount(_0x1e3469){this['id']=_0x1e3469['id']||0x0;this['name']=_0x1e3469[_0xb724('0x1')]||_0xb724('0x2');this['key']=_0x1e3469[_0xb724('0x3')]||_0xb724('0x4');this[_0xb724('0x5')]=_0x1e3469[_0xb724('0x5')]||![];this[_0xb724('0x6')]=_0x1e3469[_0xb724('0x6')]||[];this[_0xb724('0x7')]=_0x1e3469[_0xb724('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 8f7d3a2..70a952a 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 _0x0ca3=['mailAccounts','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ca3,0xd7));var _0x30ca=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x0ca3[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require('lodash');var MailAccount=require(_0x30ca('0x0'));var Realtime=function(){this[_0x30ca('0x1')]={};};function freeIsNotKey(_0x2a62d8,_0x3e4463,_0x409c89){var _0x17c4c1=_['mapKeys'](_0x2a62d8,function(_0x18cbea,_0xda49b9){return _0x18cbea[_0x409c89];});for(var _0x2136f in _0x3e4463){if(_0x3e4463['hasOwnProperty'](_0x2136f)){if(!_0x17c4c1[_0x2136f]){delete _0x3e4463[_0x2136f];}}}}Realtime[_0x30ca('0x2')]['mergeFromDatabase']=function(_0x7e5416,_0x28fe86){for(var _0x4d2a1c in _0x28fe86){if(_0x7e5416[_0x30ca('0x3')](_0x4d2a1c)){_0x7e5416[_0x4d2a1c]=_0x28fe86[_0x4d2a1c];}}};Realtime[_0x30ca('0x2')][_0x30ca('0x4')]=function(){var _0x156a23=this;return function(_0xd1c897){if(_0xd1c897){freeIsNotKey(_0xd1c897,_0x156a23[_0x30ca('0x1')],'id');for(var _0x348144=0x0,_0x17f7c6={},_0xf4d186={};_0x348144<_0xd1c897[_0x30ca('0x5')];_0x348144+=0x1){_0x17f7c6=_0xd1c897[_0x348144];if(_[_0x30ca('0x6')](_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']])){_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']]=new MailAccount(_0x17f7c6);}else{_[_0x30ca('0x7')](_0x156a23[_0x30ca('0x1')][_0x17f7c6['id']],_0x17f7c6);}}}return _0x156a23[_0x30ca('0x1')];};};module[_0x30ca('0x8')]=Realtime; \ No newline at end of file +var _0xa5ea=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','lodash','mailAccounts','mapKeys'];(function(_0x478a19,_0x2ff359){var _0x7fd2fa=function(_0x2aeb50){while(--_0x2aeb50){_0x478a19['push'](_0x478a19['shift']());}};_0x7fd2fa(++_0x2ff359);}(_0xa5ea,0xa8));var _0xaa5e=function(_0x367fcb,_0x26a793){_0x367fcb=_0x367fcb-0x0;var _0xbd6cfe=_0xa5ea[_0x367fcb];return _0xbd6cfe;};'use strict';var _=require(_0xaa5e('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xaa5e('0x1')]={};};function freeIsNotKey(_0x24b60c,_0x480bcc,_0x81612f){var _0x2b8df8=_[_0xaa5e('0x2')](_0x24b60c,function(_0x3f172e,_0x536049){return _0x3f172e[_0x81612f];});for(var _0x5427a8 in _0x480bcc){if(_0x480bcc['hasOwnProperty'](_0x5427a8)){if(!_0x2b8df8[_0x5427a8]){delete _0x480bcc[_0x5427a8];}}}}Realtime[_0xaa5e('0x3')][_0xaa5e('0x4')]=function(_0x47510c,_0x5cdec7){for(var _0x27348e in _0x5cdec7){if(_0x47510c[_0xaa5e('0x5')](_0x27348e)){_0x47510c[_0x27348e]=_0x5cdec7[_0x27348e];}}};Realtime[_0xaa5e('0x3')][_0xaa5e('0x6')]=function(){var _0x1775f9=this;return function(_0x15c801){if(_0x15c801){freeIsNotKey(_0x15c801,_0x1775f9[_0xaa5e('0x1')],'id');for(var _0x3349b0=0x0,_0x36e16a={},_0x4b4066={};_0x3349b0<_0x15c801[_0xaa5e('0x7')];_0x3349b0+=0x1){_0x36e16a=_0x15c801[_0x3349b0];if(_[_0xaa5e('0x8')](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']])){_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']]=new MailAccount(_0x36e16a);}else{_['merge'](_0x1775f9[_0xaa5e('0x1')][_0x36e16a['id']],_0x36e16a);}}}return _0x1775f9[_0xaa5e('0x1')];};};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 d89da0c..513a81e 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 _0xf981=['TemplateId','MailServerIn','Imap','data5','CloudProvider','MailServerOut','Smtp','type','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','key','ListId'];(function(_0x2a7ecc,_0x3ee0b0){var _0x57cf6b=function(_0x123f21){while(--_0x123f21){_0x2a7ecc['push'](_0x2a7ecc['shift']());}};_0x57cf6b(++_0x3ee0b0);}(_0xf981,0xe6));var _0x1f98=function(_0x3a2ae7,_0x568762){_0x3a2ae7=_0x3a2ae7-0x0;var _0x531c3e=_0xf981[_0x3a2ae7];return _0x531c3e;};'use strict';var client=require(_0x1f98('0x0'));exports[_0x1f98('0x1')]=function(){return function(){return client[_0x1f98('0x2')](_0x1f98('0x3'),{'options':{'attributes':['id',_0x1f98('0x4'),_0x1f98('0x5'),_0x1f98('0x6'),_0x1f98('0x7'),'active',_0x1f98('0x8'),_0x1f98('0x9'),_0x1f98('0xa')],'raw':![],'include':[{'model':_0x1f98('0xb'),'as':_0x1f98('0xc'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x1f98('0x6'),'type',_0x1f98('0xd')],'as':_0x1f98('0xe')}]},{'model':_0x1f98('0xf'),'as':_0x1f98('0x10'),'include':[{'model':_0x1f98('0xe'),'attributes':['id','name',_0x1f98('0x6'),_0x1f98('0x11'),_0x1f98('0xd')],'as':_0x1f98('0xe')}]}]},'log':'getMailAccount'});};};exports[_0x1f98('0x12')]=function(_0x508e25,_0x4398ea){return client[_0x1f98('0x2')](_0x1f98('0x13'),{'account':{'id':_0x508e25},'body':_0x4398ea,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xb1fc=['getMailAccounts','GetMailAccount','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client'];(function(_0x29ac6b,_0x184514){var _0x44a29b=function(_0x2dad03){while(--_0x2dad03){_0x29ac6b['push'](_0x29ac6b['shift']());}};_0x44a29b(++_0x184514);}(_0xb1fc,0xb3));var _0xcb1f=function(_0x2c27cd,_0x236f70){_0x2c27cd=_0x2c27cd-0x0;var _0x17e297=_0xb1fc[_0x2c27cd];return _0x17e297;};'use strict';var client=require(_0xcb1f('0x0'));exports[_0xcb1f('0x1')]=function(){return function(){return client['Request'](_0xcb1f('0x2'),{'options':{'attributes':['id',_0xcb1f('0x3'),_0xcb1f('0x4'),_0xcb1f('0x5'),_0xcb1f('0x6'),_0xcb1f('0x7'),_0xcb1f('0x8'),_0xcb1f('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0xcb1f('0xa'),'as':_0xcb1f('0xb'),'include':[{'model':_0xcb1f('0xc'),'attributes':['id',_0xcb1f('0x3'),_0xcb1f('0x5'),_0xcb1f('0xd'),_0xcb1f('0xe')],'as':_0xcb1f('0xc')}]},{'model':'MailServerOut','as':_0xcb1f('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xcb1f('0x3'),'service',_0xcb1f('0xd'),_0xcb1f('0xe')],'as':_0xcb1f('0xc')}]}]},'log':_0xcb1f('0x10')});};};exports[_0xcb1f('0x11')]=function(_0x404975,_0x1666f2){return client[_0xcb1f('0x12')](_0xcb1f('0x13'),{'account':{'id':_0x404975},'body':_0x1666f2,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5406346..fa10f4e 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 _0xb05e=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb05e,0x13c));var _0xeb05=function(_0x49c7f5,_0x5f0a07){_0x49c7f5=_0x49c7f5-0x0;var _0x437a81=_0xb05e[_0x49c7f5];return _0x437a81;};'use strict';var client=require(_0xeb05('0x0'));exports[_0xeb05('0x1')]=function(){return client[_0xeb05('0x2')](_0xeb05('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xeb05('0x4')});}; \ No newline at end of file +var _0x3471=['GetSettings','../client','Request','ShowSetting','loginMailFrequency'];(function(_0x497c47,_0x29ff53){var _0x23baf0=function(_0x26ad71){while(--_0x26ad71){_0x497c47['push'](_0x497c47['shift']());}};_0x23baf0(++_0x29ff53);}(_0x3471,0x7e));var _0x1347=function(_0x1a0ea7,_0x42d30a){_0x1a0ea7=_0x1a0ea7-0x0;var _0xd10e97=_0x3471[_0x1a0ea7];return _0xd10e97;};'use strict';var client=require(_0x1347('0x0'));exports['getSettings']=function(){return client[_0x1347('0x1')](_0x1347('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x1347('0x3')]},'log':_0x1347('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a828a2a..60e12dd 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(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 1f80cc5..b4612f3 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 _0x293f=['redis','localhost','socket.io-redis','default','../../config/express','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','socket.io'];(function(_0x5606a1,_0x20c3d1){var _0x595b16=function(_0x3f7816){while(--_0x3f7816){_0x5606a1['push'](_0x5606a1['shift']());}};_0x595b16(++_0x20c3d1);}(_0x293f,0x1ef));var _0xf293=function(_0x5cb053,_0x251505){_0x5cb053=_0x5cb053-0x0;var _0x170164=_0x293f[_0x5cb053];return _0x170164;};'use strict';var _=require(_0xf293('0x0'));var http=require(_0xf293('0x1'));var express=require(_0xf293('0x2'));var sticky=require(_0xf293('0x3'));var Redis=require(_0xf293('0x4'));var config=require(_0xf293('0x5'));var app=express();var server=http[_0xf293('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0xf293('0x7')](server,config['port'])){var socketio=require(_0xf293('0x8'))(server,{'transports':['websocket','polling']});config[_0xf293('0x9')]=_['defaults'](config[_0xf293('0x9')],{'host':_0xf293('0xa'),'port':0x18eb});socketio['adapter'](require(_0xf293('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xf293('0x9')])}));require('../../config/triggers')[_0xf293('0xc')]();require('../../config/socketio')[_0xf293('0xc')](socketio);require(_0xf293('0xd'))[_0xf293('0xc')](app);require(_0xf293('0xe'))[_0xf293('0xc')](app);}else{server['once']('listening',function(){console[_0xf293('0xf')](_0xf293('0x10'),config['port']);});}exports=module[_0xf293('0x11')]=app; \ No newline at end of file +var _0x7bbe=['default','../../config/socketio','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','createServer','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers'];(function(_0x5831a3,_0x4463b7){var _0x198912=function(_0xa0d267){while(--_0xa0d267){_0x5831a3['push'](_0x5831a3['shift']());}};_0x198912(++_0x4463b7);}(_0x7bbe,0x75));var _0xe7bb=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x7bbe[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xe7bb('0x0'));var http=require(_0xe7bb('0x1'));var express=require('express');var sticky=require(_0xe7bb('0x2'));var Redis=require(_0xe7bb('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xe7bb('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0xe7bb('0x5')](server,config[_0xe7bb('0x6')])){var socketio=require('socket.io')(server,{'transports':[_0xe7bb('0x7'),_0xe7bb('0x8')]});config[_0xe7bb('0x9')]=_[_0xe7bb('0xa')](config[_0xe7bb('0x9')],{'host':_0xe7bb('0xb'),'port':0x18eb});socketio[_0xe7bb('0xc')](require(_0xe7bb('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xe7bb('0x9')])}));require(_0xe7bb('0xe'))[_0xe7bb('0xf')]();require(_0xe7bb('0x10'))[_0xe7bb('0xf')](socketio);require(_0xe7bb('0x11'))[_0xe7bb('0xf')](app);require(_0xe7bb('0x12'))[_0xe7bb('0xf')](app);}else{server[_0xe7bb('0x13')]('listening',function(){console['log'](_0xe7bb('0x14'),config[_0xe7bb('0x6')]);});}exports=module[_0xe7bb('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b09a35a..6740f09 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 _0x36d1=['request','then','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0xc2efdb,_0xf7047){var _0x4c98c4=function(_0x16c6a2){while(--_0x16c6a2){_0xc2efdb['push'](_0xc2efdb['shift']());}};_0x4c98c4(++_0xf7047);}(_0x36d1,0x71));var _0x136d=function(_0x397473,_0x5b6ec2){_0x397473=_0x397473-0x0;var _0x57f0e5=_0x36d1[_0x397473];return _0x57f0e5;};'use strict';var jayson=require(_0x136d('0x0'));var BPromise=require(_0x136d('0x1'));var logger=require(_0x136d('0x2'))(_0x136d('0x3'));var client=jayson[_0x136d('0x4')][_0x136d('0x5')]({'port':0x2329});client[_0x136d('0x6')]=function(_0x44d6e8,_0x443b96){return new BPromise(function(_0x42c5c5,_0x350547){return client[_0x136d('0x7')](_0x44d6e8,_0x443b96)[_0x136d('0x8')](function(_0x94ee4b){logger['debug']('rpc',_0x136d('0x3'),_0x44d6e8,_0x443b96,_0x94ee4b);if(_0x94ee4b['error']){logger[_0x136d('0x9')](_0x136d('0xa'),_0x136d('0x3'),_0x44d6e8,_0x94ee4b[_0x136d('0x9')][_0x136d('0xb')],_0x443b96);return _0x350547(_0x94ee4b[_0x136d('0x9')][_0x136d('0xb')]);}else{return _0x42c5c5(_0x94ee4b[_0x136d('0xc')]);}})[_0x136d('0xd')](function(_0x2a816d){logger[_0x136d('0x9')](_0x136d('0xa'),_0x136d('0x3'),_0x44d6e8,_0x2a816d,_0x443b96);return _0x350547(_0x2a816d);});});};module[_0x136d('0xe')]=client; \ No newline at end of file +var _0xc43f=['client','http','Request','request','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing'];(function(_0x2cfe28,_0x3046b0){var _0x298e58=function(_0x56883a){while(--_0x56883a){_0x2cfe28['push'](_0x2cfe28['shift']());}};_0x298e58(++_0x3046b0);}(_0xc43f,0x1aa));var _0xfc43=function(_0x4bc8a0,_0x5333aa){_0x4bc8a0=_0x4bc8a0-0x0;var _0x44db33=_0xc43f[_0x4bc8a0];return _0x44db33;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfc43('0x0'));var logger=require(_0xfc43('0x1'))(_0xfc43('0x2'));var client=jayson[_0xfc43('0x3')][_0xfc43('0x4')]({'port':0x2329});client[_0xfc43('0x5')]=function(_0x21d527,_0x2dc831){return new BPromise(function(_0x517691,_0xf7fe6e){return client[_0xfc43('0x6')](_0x21d527,_0x2dc831)['then'](function(_0x51488d){logger[_0xfc43('0x7')](_0xfc43('0x8'),_0xfc43('0x2'),_0x21d527,_0x2dc831,_0x51488d);if(_0x51488d[_0xfc43('0x9')]){logger[_0xfc43('0x9')](_0xfc43('0x8'),_0xfc43('0x2'),_0x21d527,_0x51488d[_0xfc43('0x9')][_0xfc43('0xa')],_0x2dc831);return _0xf7fe6e(_0x51488d[_0xfc43('0x9')]['message']);}else{return _0x517691(_0x51488d[_0xfc43('0xb')]);}})['catch'](function(_0x229678){logger[_0xfc43('0x9')](_0xfc43('0x8'),'routing',_0x21d527,_0x229678,_0x2dc831);return _0xf7fe6e(_0x229678);});});};module[_0xfc43('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4b6c1c8..e68818b 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 _0x7778=['./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user'];(function(_0x3c3b57,_0x5c6241){var _0x630592=function(_0x527535){while(--_0x527535){_0x3c3b57['push'](_0x3c3b57['shift']());}};_0x630592(++_0x5c6241);}(_0x7778,0x19a));var _0x8777=function(_0x36ccc7,_0x4ac285){_0x36ccc7=_0x36ccc7-0x0;var _0x50ce1f=_0x7778[_0x36ccc7];return _0x50ce1f;};'use strict';var BPromise=require(_0x8777('0x0'));var server=require(_0x8777('0x1'));var Realtime=require(_0x8777('0x2'));var user=require(_0x8777('0x3'));var interval=require(_0x8777('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8777('0x5'));var smsQueue=require(_0x8777('0x6'));var mailQueue=require(_0x8777('0x7'));var faxQueue=require(_0x8777('0x8'));var whatsappQueue=require(_0x8777('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8777('0xa')]()['then'](user[_0x8777('0xb')]())[_0x8777('0xc')](realtime['initAgents']())[_0x8777('0xc')](interval[_0x8777('0xd')]())['then'](realtime['initIntervals']())['then'](openchannelQueue[_0x8777('0xe')]())[_0x8777('0xc')](realtime[_0x8777('0xf')]())[_0x8777('0xc')](chatQueue[_0x8777('0x10')]())['then'](realtime['initChatQueues']())['then'](smsQueue[_0x8777('0x11')]())['then'](realtime['initSmsQueues']())[_0x8777('0xc')](mailQueue['getMailQueues']())[_0x8777('0xc')](realtime[_0x8777('0x12')]())[_0x8777('0xc')](faxQueue['getFaxQueues']())[_0x8777('0xc')](realtime['initFaxQueues']())['then'](whatsappQueue[_0x8777('0x13')]())[_0x8777('0xc')](realtime[_0x8777('0x14')]())[_0x8777('0xc')](function(){return realtime;});}function main(){return server[_0x8777('0x15')](realtime)[_0x8777('0xc')](function(_0x569bfe){return initRealtime();})[_0x8777('0xc')](function(_0x408c2a){return setInterval(initRealtime,0x1388);})[_0x8777('0x16')](function(_0xf750a9){console['log'](_0xf750a9);});}main(); \ No newline at end of file +var _0x633e=['./rpc/mailQueue','./rpc/faxQueue','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x2e368b,_0x146562){var _0x4aed27=function(_0xbba92f){while(--_0xbba92f){_0x2e368b['push'](_0x2e368b['shift']());}};_0x4aed27(++_0x146562);}(_0x633e,0x1f4));var _0xe633=function(_0x5cc179,_0x317135){_0x5cc179=_0x5cc179-0x0;var _0x5d74ed=_0x633e[_0x5cc179];return _0x5d74ed;};'use strict';var BPromise=require('bluebird');var server=require(_0xe633('0x0'));var Realtime=require(_0xe633('0x1'));var user=require(_0xe633('0x2'));var interval=require(_0xe633('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xe633('0x4'));var smsQueue=require(_0xe633('0x5'));var mailQueue=require(_0xe633('0x6'));var faxQueue=require(_0xe633('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xe633('0x8')](user[_0xe633('0x9')]())['then'](realtime['initAgents']())['then'](interval[_0xe633('0xa')]())[_0xe633('0x8')](realtime[_0xe633('0xb')]())['then'](openchannelQueue[_0xe633('0xc')]())[_0xe633('0x8')](realtime[_0xe633('0xd')]())[_0xe633('0x8')](chatQueue[_0xe633('0xe')]())[_0xe633('0x8')](realtime[_0xe633('0xf')]())[_0xe633('0x8')](smsQueue['getSmsQueues']())[_0xe633('0x8')](realtime['initSmsQueues']())['then'](mailQueue[_0xe633('0x10')]())[_0xe633('0x8')](realtime[_0xe633('0x11')]())[_0xe633('0x8')](faxQueue[_0xe633('0x12')]())[_0xe633('0x8')](realtime[_0xe633('0x13')]())[_0xe633('0x8')](whatsappQueue[_0xe633('0x14')]())[_0xe633('0x8')](realtime[_0xe633('0x15')]())[_0xe633('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe633('0x8')](function(_0x204fea){return initRealtime();})['then'](function(_0x355e14){return setInterval(initRealtime,0x1388);})['catch'](function(_0x20856c){console[_0xe633('0x16')](_0x20856c);});}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 ab9ad50..1918474 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 _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x110479,_0x492d7b){var _0x55335=function(_0xe4731b){while(--_0xe4731b){_0x110479['push'](_0x110479['shift']());}};_0x55335(++_0x492d7b);}(_0x814b,0x1a2));var _0xb814=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x814b[_0x1d2bc8];return _0x1857e1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x465e8a,_0x32643b){var _0x15fc9f=function(_0x2f3f24){while(--_0x2f3f24){_0x465e8a['push'](_0x465e8a['shift']());}};_0x15fc9f(++_0x32643b);}(_0xe14b,0x93));var _0xbe14=function(_0x8330e6,_0x975b7){_0x8330e6=_0x8330e6-0x0;var _0x511354=_0xe14b[_0x8330e6];return _0x511354;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index e29f21f..6228c26 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 _0x4a05=['SendMail','jayson/promise','http','request','then','error','message','catch','sendMailMessage'];(function(_0x27526a,_0x28f76c){var _0x323d29=function(_0x4201cd){while(--_0x4201cd){_0x27526a['push'](_0x27526a['shift']());}};_0x323d29(++_0x28f76c);}(_0x4a05,0x157));var _0x54a0=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x4a05[_0x349367];return _0x14179b;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x54a0('0x0'));var client=jayson['client'][_0x54a0('0x1')]({'port':0x232b});function request(_0x4bb43e,_0x1a3380){return new BPromise(function(_0x29af6d,_0x2a1353){return client[_0x54a0('0x2')](_0x4bb43e,_0x1a3380)[_0x54a0('0x3')](function(_0x2feb3b){if(_0x2feb3b['error']){return _0x2a1353(_0x2feb3b[_0x54a0('0x4')][_0x54a0('0x5')]);}else{return _0x29af6d(_0x2feb3b['result']);}})[_0x54a0('0x6')](function(_0x1d09c5){return _0x2a1353(_0x1d09c5);});});}exports[_0x54a0('0x7')]=function(_0x55fab6,_0x1c2d7c){return request(_0x54a0('0x8'),{'account':_0x55fab6,'message':_0x1c2d7c});}; \ No newline at end of file +var _0xe40c=['request','error','result','catch','SendMail','jayson/promise','client'];(function(_0x1043ea,_0x25ef75){var _0x55bf65=function(_0x22e00c){while(--_0x22e00c){_0x1043ea['push'](_0x1043ea['shift']());}};_0x55bf65(++_0x25ef75);}(_0xe40c,0x1be));var _0xce40=function(_0x4330ab,_0x141abd){_0x4330ab=_0x4330ab-0x0;var _0x1d764d=_0xe40c[_0x4330ab];return _0x1d764d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xce40('0x0'));var client=jayson[_0xce40('0x1')]['http']({'port':0x232b});function request(_0x4e9f2b,_0x28ea84){return new BPromise(function(_0x3fd06b,_0x51ed61){return client[_0xce40('0x2')](_0x4e9f2b,_0x28ea84)['then'](function(_0x1be735){if(_0x1be735[_0xce40('0x3')]){return _0x51ed61(_0x1be735[_0xce40('0x3')]['message']);}else{return _0x3fd06b(_0x1be735[_0xce40('0x4')]);}})[_0xce40('0x5')](function(_0xade196){return _0x51ed61(_0xade196);});});}exports['sendMailMessage']=function(_0x302e54,_0x4c12f5){return request(_0xce40('0x6'),{'account':_0x302e54,'message':_0x4c12f5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3fa55bd..5962213 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 _0x7ace=['chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','Status','mailStatusTime','faxCurrentCapacity','openchannelStatusTime','busyQueue','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime'];(function(_0x17210b,_0x11d41a){var _0x4ffa61=function(_0x2d70b4){while(--_0x2d70b4){_0x17210b['push'](_0x17210b['shift']());}};_0x4ffa61(++_0x11d41a);}(_0x7ace,0xd6));var _0xe7ac=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7ace[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xe7ac('0x0'));var moment=require(_0xe7ac('0x1'));var md5=require(_0xe7ac('0x2'));var Redis=require(_0xe7ac('0x3'));var config=require(_0xe7ac('0x4'));config[_0xe7ac('0x5')]=_[_0xe7ac('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe7ac('0x5')]));function Agent(_0xc1a549){this['id']=_0xc1a549['id']||0x0;this[_0xe7ac('0x7')]=_0xc1a549[_0xe7ac('0x7')]||'';this[_0xe7ac('0x8')]=_0xc1a549[_0xe7ac('0x8')]||!![];this[_0xe7ac('0x9')]=_0xc1a549[_0xe7ac('0x9')]||![];this[_0xe7ac('0xa')]=_0xc1a549['chatPause']||![];this[_0xe7ac('0xb')]=_0xc1a549[_0xe7ac('0xb')]||![];this[_0xe7ac('0xc')]=_0xc1a549[_0xe7ac('0xc')]||![];this[_0xe7ac('0xd')]=_0xc1a549['smsPause']||![];this[_0xe7ac('0xe')]=_0xc1a549['openchannelPause']||![];this[_0xe7ac('0xf')]=_0xe7ac('0x10');this[_0xe7ac('0x11')]=0x0;this['chatCapacity']=_0xc1a549[_0xe7ac('0x12')]||0x0;this[_0xe7ac('0x13')]=0x0;this[_0xe7ac('0x14')]=_0xe7ac('0x10');this['mailStatusTime']=0x0;this[_0xe7ac('0x15')]=_0xc1a549[_0xe7ac('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xe7ac('0x16')]=_0xe7ac('0x10');this[_0xe7ac('0x17')]=0x0;this[_0xe7ac('0x18')]=_0xc1a549[_0xe7ac('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe7ac('0x19')]=_0xe7ac('0x10');this[_0xe7ac('0x1a')]=0x0;this[_0xe7ac('0x1b')]=_0xc1a549[_0xe7ac('0x1b')]||0x0;this[_0xe7ac('0x1c')]=0x0;this[_0xe7ac('0x1d')]='unknown';this[_0xe7ac('0x1e')]=0x0;this[_0xe7ac('0x1f')]=_0xc1a549[_0xe7ac('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xe7ac('0x20')]=_0xe7ac('0x10');this['openchannelStatusTime']=0x0;this[_0xe7ac('0x21')]=_0xc1a549[_0xe7ac('0x21')]||0x0;this[_0xe7ac('0x22')]=0x0;this[_0xe7ac('0x23')]=![];this['busyQueue']=undefined;this['md5']='';this[_0xe7ac('0x24')]();}Agent[_0xe7ac('0x25')][_0xe7ac('0x26')]=function(_0x28f1e7){if(this[_0x28f1e7+'CurrentCapacity']>0x0){if(this[_0x28f1e7+'Capacity']>0x0&&this[_0x28f1e7+_0xe7ac('0x27')]>=this[_0x28f1e7+'Capacity']){return _0xe7ac('0x28');}else{return _0xe7ac('0x29');}}else{return _0xe7ac('0x2a');}};Agent[_0xe7ac('0x25')][_0xe7ac('0x24')]=function(){var _0x5e5d89=[_0xe7ac('0x2b'),_0xe7ac('0x2c'),_0xe7ac('0x2d'),_0xe7ac('0x2e'),_0xe7ac('0x2f'),_0xe7ac('0x30')];for(var _0x25d173=0x0;_0x25d173<_0x5e5d89[_0xe7ac('0x31')];_0x25d173+=0x1){var _0x1a93ac=this['getChannelStatus'](_0x5e5d89[_0x25d173]);if(this[_0x5e5d89[_0x25d173]+'Status']!==_0x1a93ac){this[_0x5e5d89[_0x25d173]+_0xe7ac('0x32')]=_['toNumber'](moment()['format']('x'));}this[_0x5e5d89[_0x25d173]+_0xe7ac('0x33')]=_0x1a93ac;}var _0x1c0326={'id':this['id'],'name':this[_0xe7ac('0x7')],'online':this[_0xe7ac('0x8')],'voicePause':this[_0xe7ac('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xe7ac('0xb')],'smsPause':this[_0xe7ac('0xd')],'faxPause':this[_0xe7ac('0xc')],'openchannelPause':this[_0xe7ac('0xe')],'chatStatus':this[_0xe7ac('0xf')],'chatStatusTime':this[_0xe7ac('0x11')],'chatCapacity':this[_0xe7ac('0x12')],'chatCurrentCapacity':this[_0xe7ac('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xe7ac('0x34')],'mailCapacity':this[_0xe7ac('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xe7ac('0x16')],'faxStatusTime':this[_0xe7ac('0x17')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe7ac('0x35')],'smsStatus':this[_0xe7ac('0x19')],'smsStatusTime':this[_0xe7ac('0x1a')],'smsCapacity':this[_0xe7ac('0x1b')],'smsCurrentCapacity':this[_0xe7ac('0x1c')],'whatsappStatus':this[_0xe7ac('0x1d')],'whatsappStatusTime':this[_0xe7ac('0x1e')],'whatsappCapacity':this[_0xe7ac('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xe7ac('0x36')],'openchannelCapacity':this[_0xe7ac('0x21')],'openchannelCurrentCapacity':this[_0xe7ac('0x22')],'busy':this[_0xe7ac('0x23')],'busyQueue':this[_0xe7ac('0x37')]};var _0x58b079=md5(JSON['stringify'](_0x1c0326));if(this['md5']!==_0x58b079){this[_0xe7ac('0x2')]=_0x58b079;io['emit'](_0xe7ac('0x38'),_0x1c0326);}};module[_0xe7ac('0x39')]=Agent; \ No newline at end of file +var _0xd21d=['whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime'];(function(_0x490da9,_0x31214f){var _0x5b9821=function(_0x1423e0){while(--_0x1423e0){_0x490da9['push'](_0x490da9['shift']());}};_0x5b9821(++_0x31214f);}(_0xd21d,0x14e));var _0xdd21=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xd21d[_0xf0bc07];return _0x1c50c2;};'use strict';var _=require('lodash');var moment=require(_0xdd21('0x0'));var md5=require(_0xdd21('0x1'));var Redis=require(_0xdd21('0x2'));var config=require(_0xdd21('0x3'));config[_0xdd21('0x4')]=_[_0xdd21('0x5')](config[_0xdd21('0x4')],{'host':_0xdd21('0x6'),'port':0x18eb});var io=require(_0xdd21('0x7'))(new Redis(config[_0xdd21('0x4')]));function Agent(_0x429912){this['id']=_0x429912['id']||0x0;this[_0xdd21('0x8')]=_0x429912['name']||'';this[_0xdd21('0x9')]=_0x429912[_0xdd21('0x9')]||!![];this[_0xdd21('0xa')]=_0x429912['voicePause']||![];this[_0xdd21('0xb')]=_0x429912[_0xdd21('0xb')]||![];this[_0xdd21('0xc')]=_0x429912[_0xdd21('0xc')]||![];this[_0xdd21('0xd')]=_0x429912[_0xdd21('0xd')]||![];this[_0xdd21('0xe')]=_0x429912[_0xdd21('0xe')]||![];this[_0xdd21('0xf')]=_0x429912[_0xdd21('0xf')]||![];this[_0xdd21('0x10')]=_0xdd21('0x11');this['chatStatusTime']=0x0;this[_0xdd21('0x12')]=_0x429912['chatCapacity']||0x0;this[_0xdd21('0x13')]=0x0;this[_0xdd21('0x14')]=_0xdd21('0x11');this[_0xdd21('0x15')]=0x0;this[_0xdd21('0x16')]=_0x429912[_0xdd21('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xdd21('0x17')]=_0xdd21('0x11');this[_0xdd21('0x18')]=0x0;this['faxCapacity']=_0x429912['faxCapacity']||0x0;this[_0xdd21('0x19')]=0x0;this[_0xdd21('0x1a')]=_0xdd21('0x11');this[_0xdd21('0x1b')]=0x0;this[_0xdd21('0x1c')]=_0x429912[_0xdd21('0x1c')]||0x0;this[_0xdd21('0x1d')]=0x0;this[_0xdd21('0x1e')]=_0xdd21('0x11');this[_0xdd21('0x1f')]=0x0;this[_0xdd21('0x20')]=_0x429912[_0xdd21('0x20')]||0x0;this[_0xdd21('0x21')]=0x0;this[_0xdd21('0x22')]=_0xdd21('0x11');this[_0xdd21('0x23')]=0x0;this[_0xdd21('0x24')]=_0x429912[_0xdd21('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xdd21('0x25')]=![];this[_0xdd21('0x26')]=undefined;this['md5']='';this[_0xdd21('0x27')]();}Agent[_0xdd21('0x28')][_0xdd21('0x29')]=function(_0x42eb44){if(this[_0x42eb44+_0xdd21('0x2a')]>0x0){if(this[_0x42eb44+_0xdd21('0x2b')]>0x0&&this[_0x42eb44+_0xdd21('0x2a')]>=this[_0x42eb44+_0xdd21('0x2b')]){return'maxcapacity';}else{return _0xdd21('0x2c');}}else{return'idle';}};Agent[_0xdd21('0x28')][_0xdd21('0x27')]=function(){var _0xee272=['mail',_0xdd21('0x2d'),_0xdd21('0x2e'),_0xdd21('0x2f'),_0xdd21('0x30'),_0xdd21('0x31')];for(var _0x234cba=0x0;_0x234cba<_0xee272[_0xdd21('0x32')];_0x234cba+=0x1){var _0x591075=this['getChannelStatus'](_0xee272[_0x234cba]);if(this[_0xee272[_0x234cba]+_0xdd21('0x33')]!==_0x591075){this[_0xee272[_0x234cba]+_0xdd21('0x34')]=_[_0xdd21('0x35')](moment()[_0xdd21('0x36')]('x'));}this[_0xee272[_0x234cba]+_0xdd21('0x33')]=_0x591075;}var _0x44e3ed={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xdd21('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xdd21('0xc')],'smsPause':this[_0xdd21('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xdd21('0xf')],'chatStatus':this[_0xdd21('0x10')],'chatStatusTime':this[_0xdd21('0x37')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xdd21('0x13')],'mailStatus':this[_0xdd21('0x14')],'mailStatusTime':this[_0xdd21('0x15')],'mailCapacity':this[_0xdd21('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xdd21('0x17')],'faxStatusTime':this[_0xdd21('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xdd21('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xdd21('0x1b')],'smsCapacity':this[_0xdd21('0x1c')],'smsCurrentCapacity':this[_0xdd21('0x1d')],'whatsappStatus':this[_0xdd21('0x1e')],'whatsappStatusTime':this[_0xdd21('0x1f')],'whatsappCapacity':this[_0xdd21('0x20')],'whatsappCurrentCapacity':this[_0xdd21('0x21')],'openchannelStatus':this[_0xdd21('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xdd21('0x38')],'busy':this[_0xdd21('0x25')],'busyQueue':this[_0xdd21('0x26')]};var _0x2f3d12=md5(JSON[_0xdd21('0x39')](_0x44e3ed));if(this['md5']!==_0x2f3d12){this[_0xdd21('0x1')]=_0x2f3d12;io[_0xdd21('0x3a')](_0xdd21('0x3b'),_0x44e3ed);}};module[_0xdd21('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 ef57c2f..b5282cf 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 _0xd724=['beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','available','stringify','format','emit','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xd724,0x170));var _0x4d72=function(_0x2d8189,_0x3fa97c){_0x2d8189=_0x2d8189-0x0;var _0x3f36f2=_0xd724[_0x2d8189];return _0x3f36f2;};'use strict';var _=require(_0x4d72('0x0'));var md5=require('md5');var util=require(_0x4d72('0x1'));var Redis=require(_0x4d72('0x2'));var config=require('../../../config/environment');config[_0x4d72('0x3')]=_[_0x4d72('0x4')](config[_0x4d72('0x3')],{'host':_0x4d72('0x5'),'port':0x18eb});var io=require(_0x4d72('0x6'))(new Redis(config['redis']));function ChatQueue(_0x321130){this['id']=_0x321130['id']||0x0;this[_0x4d72('0x7')]=_0x321130['name']||'';this[_0x4d72('0x8')]=_0x321130[_0x4d72('0x8')]||0xa;this[_0x4d72('0x9')]=_0x321130[_0x4d72('0x9')]||_0x4d72('0xa');this[_0x4d72('0xb')]=_0x321130[_0x4d72('0xb')];this[_0x4d72('0xc')]={};this[_0x4d72('0xd')]=0x0;this[_0x4d72('0xe')]='';this[_0x4d72('0xf')]();this['updateRealtime']();}ChatQueue[_0x4d72('0x10')][_0x4d72('0xf')]=function(){var _0x8ca660=this[_0x4d72('0xc')][_0x4d72('0x11')];this[_0x4d72('0xc')]=_['map'](this[_0x4d72('0xb')],'id');this[_0x4d72('0xc')]['_rr']=_0x8ca660;};ChatQueue[_0x4d72('0x10')][_0x4d72('0x12')]=function(){this[_0x4d72('0x13')]=0x0;this[_0x4d72('0x14')]=0x0;for(var _0x20ca27=0x0;_0x20ca27=0x0?this[_0x4d72('0x16')]:0x0;var _0x8fb66e={'id':this['id'],'available':this[_0x4d72('0x16')],'loggedIn':this[_0x4d72('0x13')],'name':this[_0x4d72('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x5c3c8d=md5(JSON[_0x4d72('0x17')](_0x8fb66e));if(this['md5']!==_0x5c3c8d){this[_0x4d72('0xe')]=_0x5c3c8d;io['to'](util[_0x4d72('0x18')]('chat:queue:%s',_0x8fb66e[_0x4d72('0x7')]))[_0x4d72('0x19')]('chat_queue:save',_0x8fb66e);}};module[_0x4d72('0x1a')]=ChatQueue; \ No newline at end of file +var _0xbabe=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash'];(function(_0x38f967,_0xe1e2dd){var _0x3831be=function(_0x10c530){while(--_0x10c530){_0x38f967['push'](_0x38f967['shift']());}};_0x3831be(++_0xe1e2dd);}(_0xbabe,0x17f));var _0xebab=function(_0xdaf61,_0x3e5392){_0xdaf61=_0xdaf61-0x0;var _0x5c7da9=_0xbabe[_0xdaf61];return _0x5c7da9;};'use strict';var _=require(_0xebab('0x0'));var md5=require('md5');var util=require(_0xebab('0x1'));var Redis=require(_0xebab('0x2'));var config=require(_0xebab('0x3'));config[_0xebab('0x4')]=_[_0xebab('0x5')](config[_0xebab('0x4')],{'host':_0xebab('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebab('0x4')]));function ChatQueue(_0x20cb0b){this['id']=_0x20cb0b['id']||0x0;this[_0xebab('0x7')]=_0x20cb0b[_0xebab('0x7')]||'';this[_0xebab('0x8')]=_0x20cb0b[_0xebab('0x8')]||0xa;this['strategy']=_0x20cb0b[_0xebab('0x9')]||_0xebab('0xa');this['Agents']=_0x20cb0b[_0xebab('0xb')];this['mapAgentsId']={};this[_0xebab('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0xebab('0xd')]();}ChatQueue[_0xebab('0xe')][_0xebab('0xf')]=function(){var _0xc12f92=this[_0xebab('0x10')]['_rr'];this['mapAgentsId']=_[_0xebab('0x11')](this[_0xebab('0xb')],'id');this[_0xebab('0x10')][_0xebab('0x12')]=_0xc12f92;};ChatQueue[_0xebab('0xe')][_0xebab('0xd')]=function(){this[_0xebab('0x13')]=0x0;this[_0xebab('0x14')]=0x0;for(var _0x1dfeab=0x0;_0x1dfeab=0x0?this[_0xebab('0x18')]:0x0;var _0x1e1a6f={'id':this['id'],'available':this[_0xebab('0x18')],'loggedIn':this[_0xebab('0x13')],'name':this[_0xebab('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4bbe6f=md5(JSON[_0xebab('0x19')](_0x1e1a6f));if(this[_0xebab('0x1a')]!==_0x4bbe6f){this[_0xebab('0x1a')]=_0x4bbe6f;io['to'](util[_0xebab('0x1b')](_0xebab('0x1c'),_0x1e1a6f[_0xebab('0x7')]))[_0xebab('0x1d')](_0xebab('0x1e'),_0x1e1a6f);}};module[_0xebab('0x1f')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d410eb9..ce27984 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 _0x9fc8=['loggedIn','length','faxPause','available','paused','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9fc8,0x166));var _0x89fc=function(_0x49f80f,_0x3b4b70){_0x49f80f=_0x49f80f-0x0;var _0x12bc8b=_0x9fc8[_0x49f80f];return _0x12bc8b;};'use strict';var _=require(_0x89fc('0x0'));var md5=require(_0x89fc('0x1'));var util=require(_0x89fc('0x2'));var Redis=require('ioredis');var config=require(_0x89fc('0x3'));config[_0x89fc('0x4')]=_[_0x89fc('0x5')](config[_0x89fc('0x4')],{'host':_0x89fc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x89fc('0x4')]));function FaxQueue(_0x55846f){this['id']=_0x55846f['id']||0x0;this[_0x89fc('0x7')]=_0x55846f[_0x89fc('0x7')]||'';this[_0x89fc('0x8')]=_0x55846f[_0x89fc('0x8')]||0xa;this[_0x89fc('0x9')]=_0x55846f['strategy']||_0x89fc('0xa');this[_0x89fc('0xb')]=_0x55846f[_0x89fc('0xb')];this['mapAgentsId']={};this[_0x89fc('0xc')]=0x0;this[_0x89fc('0x1')]='';this[_0x89fc('0xd')]();this[_0x89fc('0xe')]();}FaxQueue[_0x89fc('0xf')][_0x89fc('0xd')]=function(){var _0x642e3c=this['mapAgentsId']['_rr'];this[_0x89fc('0x10')]=_[_0x89fc('0x11')](this['Agents'],'id');this[_0x89fc('0x10')][_0x89fc('0x12')]=_0x642e3c;};FaxQueue[_0x89fc('0xf')][_0x89fc('0xe')]=function(){this[_0x89fc('0x13')]=0x0;this['paused']=0x0;for(var _0x420492=0x0;_0x420492=0x0?this[_0x89fc('0x16')]:0x0;var _0x175847={'id':this['id'],'available':this['available'],'loggedIn':this[_0x89fc('0x13')],'name':this[_0x89fc('0x7')],'paused':this[_0x89fc('0x17')],'waiting':this[_0x89fc('0xc')]};var _0x3aa060=md5(JSON[_0x89fc('0x18')](_0x175847));if(this['md5']!==_0x3aa060){this[_0x89fc('0x1')]=_0x3aa060;io['to'](util[_0x89fc('0x19')](_0x89fc('0x1a'),_0x175847[_0x89fc('0x7')]))['emit'](_0x89fc('0x1b'),_0x175847);}};module[_0x89fc('0x1c')]=FaxQueue; \ No newline at end of file +var _0xfa89=['md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xfa89,0x1cb));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x9fa8('0x0'));var util=require('util');var Redis=require(_0x9fa8('0x1'));var config=require(_0x9fa8('0x2'));config[_0x9fa8('0x3')]=_['defaults'](config[_0x9fa8('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x9fa8('0x4'))(new Redis(config['redis']));function FaxQueue(_0x3b8d86){this['id']=_0x3b8d86['id']||0x0;this[_0x9fa8('0x5')]=_0x3b8d86[_0x9fa8('0x5')]||'';this[_0x9fa8('0x6')]=_0x3b8d86[_0x9fa8('0x6')]||0xa;this[_0x9fa8('0x7')]=_0x3b8d86[_0x9fa8('0x7')]||'beepall';this[_0x9fa8('0x8')]=_0x3b8d86[_0x9fa8('0x8')];this[_0x9fa8('0x9')]={};this[_0x9fa8('0xa')]=0x0;this[_0x9fa8('0x0')]='';this[_0x9fa8('0xb')]();this[_0x9fa8('0xc')]();}FaxQueue['prototype'][_0x9fa8('0xb')]=function(){var _0x5360c4=this['mapAgentsId'][_0x9fa8('0xd')];this[_0x9fa8('0x9')]=_[_0x9fa8('0xe')](this[_0x9fa8('0x8')],'id');this[_0x9fa8('0x9')]['_rr']=_0x5360c4;};FaxQueue[_0x9fa8('0xf')][_0x9fa8('0xc')]=function(){this[_0x9fa8('0x10')]=0x0;this[_0x9fa8('0x11')]=0x0;for(var _0x5e95a7=0x0;_0x5e95a7=0x0?this['available']:0x0;var _0x2f6457={'id':this['id'],'available':this[_0x9fa8('0x15')],'loggedIn':this[_0x9fa8('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9fa8('0xa')]};var _0x53844f=md5(JSON[_0x9fa8('0x16')](_0x2f6457));if(this[_0x9fa8('0x0')]!==_0x53844f){this['md5']=_0x53844f;io['to'](util[_0x9fa8('0x17')](_0x9fa8('0x18'),_0x2f6457[_0x9fa8('0x5')]))['emit'](_0x9fa8('0x19'),_0x2f6457);}};module[_0x9fa8('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 3c0ffd6..022df9c 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 _0xdcea=['Intervals','exports','name'];(function(_0x113c43,_0x171537){var _0x25a1ac=function(_0x5544b2){while(--_0x5544b2){_0x113c43['push'](_0x113c43['shift']());}};_0x25a1ac(++_0x171537);}(_0xdcea,0x1a9));var _0xadce=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0xdcea[_0x4c94d1];return _0x48c2c3;};'use strict';function Interval(_0x2c0373){this['id']=_0x2c0373['id']||0x0;this[_0xadce('0x0')]=_0x2c0373[_0xadce('0x0')]||'';this[_0xadce('0x1')]=_0x2c0373[_0xadce('0x1')]||{};}module[_0xadce('0x2')]=Interval; \ No newline at end of file +var _0x6cbe=['name','Intervals'];(function(_0x2809c6,_0x753ba8){var _0x162017=function(_0x5d2a4c){while(--_0x5d2a4c){_0x2809c6['push'](_0x2809c6['shift']());}};_0x162017(++_0x753ba8);}(_0x6cbe,0x1b6));var _0xe6cb=function(_0x27c436,_0x283d5f){_0x27c436=_0x27c436-0x0;var _0x453a21=_0x6cbe[_0x27c436];return _0x453a21;};'use strict';function Interval(_0x31fcd2){this['id']=_0x31fcd2['id']||0x0;this[_0xe6cb('0x0')]=_0x31fcd2[_0xe6cb('0x0')]||'';this[_0xe6cb('0x1')]=_0x31fcd2['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 7fa554b..5a6e616 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 _0x7aa2=['name','format','mail_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','updateRouting','_rr','map','mapAgentsId','prototype','loggedIn','online','mailPause','paused','available'];(function(_0x37fcda,_0x2f5aa1){var _0xf5ed91=function(_0x3c3241){while(--_0x3c3241){_0x37fcda['push'](_0x37fcda['shift']());}};_0xf5ed91(++_0x2f5aa1);}(_0x7aa2,0xe4));var _0x27aa=function(_0xe2d14f,_0x49fd0e){_0xe2d14f=_0xe2d14f-0x0;var _0x4522d2=_0x7aa2[_0xe2d14f];return _0x4522d2;};'use strict';var _=require(_0x27aa('0x0'));var md5=require('md5');var util=require(_0x27aa('0x1'));var Redis=require('ioredis');var config=require(_0x27aa('0x2'));config[_0x27aa('0x3')]=_[_0x27aa('0x4')](config[_0x27aa('0x3')],{'host':_0x27aa('0x5'),'port':0x18eb});var io=require(_0x27aa('0x6'))(new Redis(config[_0x27aa('0x3')]));function MailQueue(_0x454278){this['id']=_0x454278['id']||0x0;this['name']=_0x454278['name']||'';this[_0x27aa('0x7')]=_0x454278[_0x27aa('0x7')]||0xa;this[_0x27aa('0x8')]=_0x454278[_0x27aa('0x8')]||_0x27aa('0x9');this[_0x27aa('0xa')]=_0x454278[_0x27aa('0xa')];this['mapAgentsId']={};this[_0x27aa('0xb')]=0x0;this[_0x27aa('0xc')]='';this['updateRouting']();this[_0x27aa('0xd')]();}MailQueue['prototype'][_0x27aa('0xe')]=function(){var _0x204fa9=this['mapAgentsId'][_0x27aa('0xf')];this['mapAgentsId']=_[_0x27aa('0x10')](this[_0x27aa('0xa')],'id');this[_0x27aa('0x11')]['_rr']=_0x204fa9;};MailQueue[_0x27aa('0x12')]['updateRealtime']=function(){this[_0x27aa('0x13')]=0x0;this['paused']=0x0;for(var _0x47fe6e=0x0;_0x47fe6e=0x0?this['available']:0x0;var _0xf5e83e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x27aa('0x13')],'name':this[_0x27aa('0x18')],'paused':this[_0x27aa('0x16')],'waiting':this[_0x27aa('0xb')]};var _0xbb1d33=md5(JSON['stringify'](_0xf5e83e));if(this[_0x27aa('0xc')]!==_0xbb1d33){this[_0x27aa('0xc')]=_0xbb1d33;io['to'](util[_0x27aa('0x19')]('mail:queue:%s',_0xf5e83e[_0x27aa('0x18')]))['emit'](_0x27aa('0x1a'),_0xf5e83e);}};module[_0x27aa('0x1b')]=MailQueue; \ No newline at end of file +var _0xdc81=['lodash','md5','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','emit','mail_queue:save'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xdc81,0x82));var _0x1dc8=function(_0x1aa033,_0x3c824e){_0x1aa033=_0x1aa033-0x0;var _0x287f76=_0xdc81[_0x1aa033];return _0x287f76;};'use strict';var _=require(_0x1dc8('0x0'));var md5=require(_0x1dc8('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1dc8('0x2')]=_[_0x1dc8('0x3')](config[_0x1dc8('0x2')],{'host':_0x1dc8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1dc8('0x2')]));function MailQueue(_0x287b90){this['id']=_0x287b90['id']||0x0;this['name']=_0x287b90[_0x1dc8('0x5')]||'';this[_0x1dc8('0x6')]=_0x287b90['timeout']||0xa;this['strategy']=_0x287b90[_0x1dc8('0x7')]||_0x1dc8('0x8');this[_0x1dc8('0x9')]=_0x287b90[_0x1dc8('0x9')];this['mapAgentsId']={};this[_0x1dc8('0xa')]=0x0;this[_0x1dc8('0x1')]='';this[_0x1dc8('0xb')]();this[_0x1dc8('0xc')]();}MailQueue[_0x1dc8('0xd')][_0x1dc8('0xb')]=function(){var _0x3e164f=this[_0x1dc8('0xe')][_0x1dc8('0xf')];this['mapAgentsId']=_[_0x1dc8('0x10')](this['Agents'],'id');this[_0x1dc8('0xe')][_0x1dc8('0xf')]=_0x3e164f;};MailQueue[_0x1dc8('0xd')]['updateRealtime']=function(){this[_0x1dc8('0x11')]=0x0;this[_0x1dc8('0x12')]=0x0;for(var _0x529d44=0x0;_0x529d44=0x0?this[_0x1dc8('0x16')]:0x0;var _0x11883c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1dc8('0x11')],'name':this[_0x1dc8('0x5')],'paused':this['paused'],'waiting':this[_0x1dc8('0xa')]};var _0x21ea2d=md5(JSON[_0x1dc8('0x17')](_0x11883c));if(this[_0x1dc8('0x1')]!==_0x21ea2d){this[_0x1dc8('0x1')]=_0x21ea2d;io['to'](util['format']('mail:queue:%s',_0x11883c[_0x1dc8('0x5')]))[_0x1dc8('0x18')](_0x1dc8('0x19'),_0x11883c);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 766d610..c5a1b2d 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x1261,0x144));var _0x1126=function(_0x54fbed,_0x3c77a7){_0x54fbed=_0x54fbed-0x0;var _0x333bbc=_0x1261[_0x54fbed];return _0x333bbc;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index e1b4c0d..32cb9e8 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 _0xc577=['loggedIn','available','stringify','format','sms:queue:%s','emit','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','paused','length','online'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xc577,0x172));var _0x7c57=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xc577[_0xaf025d];return _0x1c77cb;};'use strict';var _=require(_0x7c57('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7c57('0x1'));var config=require(_0x7c57('0x2'));config[_0x7c57('0x3')]=_[_0x7c57('0x4')](config[_0x7c57('0x3')],{'host':_0x7c57('0x5'),'port':0x18eb});var io=require(_0x7c57('0x6'))(new Redis(config['redis']));function SmsQueue(_0x447d52){this['id']=_0x447d52['id']||0x0;this[_0x7c57('0x7')]=_0x447d52[_0x7c57('0x7')]||'';this[_0x7c57('0x8')]=_0x447d52[_0x7c57('0x8')]||0xa;this['strategy']=_0x447d52['strategy']||'beepall';this[_0x7c57('0x9')]=_0x447d52['Agents'];this[_0x7c57('0xa')]={};this[_0x7c57('0xb')]=0x0;this[_0x7c57('0xc')]='';this[_0x7c57('0xd')]();this['updateRealtime']();}SmsQueue[_0x7c57('0xe')][_0x7c57('0xd')]=function(){var _0x4b5b56=this[_0x7c57('0xa')][_0x7c57('0xf')];this[_0x7c57('0xa')]=_[_0x7c57('0x10')](this[_0x7c57('0x9')],'id');this[_0x7c57('0xa')][_0x7c57('0xf')]=_0x4b5b56;};SmsQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x7c57('0x11')]=0x0;for(var _0x373a4b=0x0;_0x373a4b=0x0?this['available']:0x0;var _0x20dd80={'id':this['id'],'available':this[_0x7c57('0x15')],'loggedIn':this[_0x7c57('0x14')],'name':this[_0x7c57('0x7')],'paused':this[_0x7c57('0x11')],'waiting':this[_0x7c57('0xb')]};var _0x2931c4=md5(JSON[_0x7c57('0x16')](_0x20dd80));if(this[_0x7c57('0xc')]!==_0x2931c4){this['md5']=_0x2931c4;io['to'](util[_0x7c57('0x17')](_0x7c57('0x18'),_0x20dd80[_0x7c57('0x7')]))[_0x7c57('0x19')]('sms_queue:save',_0x20dd80);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xe205=['_rr','map','prototype','loggedIn','length','online','paused','available','stringify','format','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId'];(function(_0x365b81,_0x240945){var _0x4b3f21=function(_0x43fa3a){while(--_0x43fa3a){_0x365b81['push'](_0x365b81['shift']());}};_0x4b3f21(++_0x240945);}(_0xe205,0xa7));var _0x5e20=function(_0x4d0bc1,_0x3ad0dd){_0x4d0bc1=_0x4d0bc1-0x0;var _0x3f824a=_0xe205[_0x4d0bc1];return _0x3f824a;};'use strict';var _=require(_0x5e20('0x0'));var md5=require(_0x5e20('0x1'));var util=require(_0x5e20('0x2'));var Redis=require(_0x5e20('0x3'));var config=require(_0x5e20('0x4'));config[_0x5e20('0x5')]=_[_0x5e20('0x6')](config[_0x5e20('0x5')],{'host':_0x5e20('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e20('0x5')]));function SmsQueue(_0x1b26a2){this['id']=_0x1b26a2['id']||0x0;this[_0x5e20('0x8')]=_0x1b26a2[_0x5e20('0x8')]||'';this['timeout']=_0x1b26a2['timeout']||0xa;this[_0x5e20('0x9')]=_0x1b26a2['strategy']||'beepall';this[_0x5e20('0xa')]=_0x1b26a2[_0x5e20('0xa')];this['mapAgentsId']={};this[_0x5e20('0xb')]=0x0;this[_0x5e20('0x1')]='';this[_0x5e20('0xc')]();this[_0x5e20('0xd')]();}SmsQueue['prototype'][_0x5e20('0xc')]=function(){var _0xda6476=this[_0x5e20('0xe')][_0x5e20('0xf')];this[_0x5e20('0xe')]=_[_0x5e20('0x10')](this['Agents'],'id');this[_0x5e20('0xe')][_0x5e20('0xf')]=_0xda6476;};SmsQueue[_0x5e20('0x11')]['updateRealtime']=function(){this[_0x5e20('0x12')]=0x0;this['paused']=0x0;for(var _0x1f47f3=0x0;_0x1f47f3=0x0?this[_0x5e20('0x16')]:0x0;var _0xf3488f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5e20('0x12')],'name':this[_0x5e20('0x8')],'paused':this['paused'],'waiting':this[_0x5e20('0xb')]};var _0x1b1457=md5(JSON[_0x5e20('0x17')](_0xf3488f));if(this[_0x5e20('0x1')]!==_0x1b1457){this['md5']=_0x1b1457;io['to'](util[_0x5e20('0x18')]('sms:queue:%s',_0xf3488f['name']))['emit']('sms_queue:save',_0xf3488f);}};module[_0x5e20('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 5a1cb46..b89b6a0 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 _0x9fb2=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x377eda,_0x258df5){var _0x207c8e=function(_0x3d3d3d){while(--_0x3d3d3d){_0x377eda['push'](_0x377eda['shift']());}};_0x207c8e(++_0x258df5);}(_0x9fb2,0x112));var _0x29fb=function(_0x5e8874,_0x134292){_0x5e8874=_0x5e8874-0x0;var _0x4bf1de=_0x9fb2[_0x5e8874];return _0x4bf1de;};'use strict';var _=require(_0x29fb('0x0'));var md5=require(_0x29fb('0x1'));var util=require(_0x29fb('0x2'));var Redis=require(_0x29fb('0x3'));var config=require(_0x29fb('0x4'));config['redis']=_['defaults'](config[_0x29fb('0x5')],{'host':_0x29fb('0x6'),'port':0x18eb});var io=require(_0x29fb('0x7'))(new Redis(config[_0x29fb('0x5')]));function WhatsappQueue(_0x21b415){this['id']=_0x21b415['id']||0x0;this['name']=_0x21b415[_0x29fb('0x8')]||'';this[_0x29fb('0x9')]=_0x21b415['timeout']||0xa;this[_0x29fb('0xa')]=_0x21b415[_0x29fb('0xa')]||'beepall';this[_0x29fb('0xb')]=_0x21b415[_0x29fb('0xb')];this[_0x29fb('0xc')]={};this[_0x29fb('0xd')]=0x0;this[_0x29fb('0x1')]='';this[_0x29fb('0xe')]();this[_0x29fb('0xf')]();}WhatsappQueue[_0x29fb('0x10')][_0x29fb('0xe')]=function(){var _0x54844a=this[_0x29fb('0xc')][_0x29fb('0x11')];this[_0x29fb('0xc')]=_[_0x29fb('0x12')](this[_0x29fb('0xb')],'id');this['mapAgentsId'][_0x29fb('0x11')]=_0x54844a;};WhatsappQueue[_0x29fb('0x10')][_0x29fb('0xf')]=function(){this[_0x29fb('0x13')]=0x0;this[_0x29fb('0x14')]=0x0;for(var _0x4e1adb=0x0;_0x4e1adb=0x0?this['available']:0x0;var _0x26bf79={'id':this['id'],'available':this[_0x29fb('0x17')],'loggedIn':this[_0x29fb('0x13')],'name':this[_0x29fb('0x8')],'paused':this[_0x29fb('0x14')],'waiting':this[_0x29fb('0xd')]};var _0x1d7ef3=md5(JSON['stringify'](_0x26bf79));if(this[_0x29fb('0x1')]!==_0x1d7ef3){this['md5']=_0x1d7ef3;io['to'](util[_0x29fb('0x18')](_0x29fb('0x19'),_0x26bf79[_0x29fb('0x8')]))[_0x29fb('0x1a')](_0x29fb('0x1b'),_0x26bf79);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x9ad4=['defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','available','loggedIn','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9ad4,0xa4));var _0x49ad=function(_0x5837a4,_0x15c0f7){_0x5837a4=_0x5837a4-0x0;var _0x1feb62=_0x9ad4[_0x5837a4];return _0x1feb62;};'use strict';var _=require('lodash');var md5=require(_0x49ad('0x0'));var util=require(_0x49ad('0x1'));var Redis=require('ioredis');var config=require(_0x49ad('0x2'));config[_0x49ad('0x3')]=_[_0x49ad('0x4')](config[_0x49ad('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x49ad('0x5'))(new Redis(config[_0x49ad('0x3')]));function WhatsappQueue(_0x52d61f){this['id']=_0x52d61f['id']||0x0;this[_0x49ad('0x6')]=_0x52d61f[_0x49ad('0x6')]||'';this[_0x49ad('0x7')]=_0x52d61f[_0x49ad('0x7')]||0xa;this[_0x49ad('0x8')]=_0x52d61f['strategy']||'beepall';this[_0x49ad('0x9')]=_0x52d61f[_0x49ad('0x9')];this[_0x49ad('0xa')]={};this[_0x49ad('0xb')]=0x0;this[_0x49ad('0x0')]='';this[_0x49ad('0xc')]();this[_0x49ad('0xd')]();}WhatsappQueue[_0x49ad('0xe')][_0x49ad('0xc')]=function(){var _0x52bd91=this[_0x49ad('0xa')][_0x49ad('0xf')];this[_0x49ad('0xa')]=_[_0x49ad('0x10')](this['Agents'],'id');this[_0x49ad('0xa')][_0x49ad('0xf')]=_0x52bd91;};WhatsappQueue[_0x49ad('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x49ad('0x11')]=0x0;for(var _0x5f4d1f=0x0;_0x5f4d1f=0x0?this[_0x49ad('0x14')]:0x0;var _0x118bb0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x49ad('0x6')],'paused':this[_0x49ad('0x11')],'waiting':this[_0x49ad('0xb')]};var _0x19dd4a=md5(JSON[_0x49ad('0x16')](_0x118bb0));if(this[_0x49ad('0x0')]!==_0x19dd4a){this['md5']=_0x19dd4a;io['to'](util[_0x49ad('0x17')](_0x49ad('0x18'),_0x118bb0[_0x49ad('0x6')]))[_0x49ad('0x19')](_0x49ad('0x1a'),_0x118bb0);}};module[_0x49ad('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8e60040..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(_0x4ad953,_0x5e789d){var _0x10a154=function(_0x35f22a){while(--_0x35f22a){_0x4ad953['push'](_0x4ad953['shift']());}};_0x10a154(++_0x5e789d);}(_0xb10b,0x12a));var _0xbb10=function(_0x579042,_0x5a356f){_0x579042=_0x579042-0x0;var _0x3546af=_0xb10b[_0x579042];return _0x3546af;};'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 f5a22df..2fd4138 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 _0x5a51=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x412d8b,_0x54ea50){var _0x1c82b4=function(_0x2b1435){while(--_0x2b1435){_0x412d8b['push'](_0x412d8b['shift']());}};_0x1c82b4(++_0x54ea50);}(_0x5a51,0x9f));var _0x15a5=function(_0x31cb9e,_0x378a09){_0x31cb9e=_0x31cb9e-0x0;var _0x1752ac=_0x5a51[_0x31cb9e];return _0x1752ac;};'use strict';var client=require(_0x15a5('0x0'));exports[_0x15a5('0x1')]=function(_0x497cc4,_0x317f47){return client[_0x15a5('0x2')](_0x15a5('0x3'),{'body':_0x317f47,'options':{'where':{'id':_0x497cc4}},'log':_0x15a5('0x4')});};exports['addTags']=function(_0x8fa7b5,_0x12af31){return client[_0x15a5('0x2')](_0x15a5('0x5'),{'body':_0x12af31,'options':{'where':{'id':_0x8fa7b5}},'log':_0x15a5('0x6')});}; \ No newline at end of file +var _0xc575=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x3042d5,_0x349534){var _0x1acfef=function(_0x5a920f){while(--_0x5a920f){_0x3042d5['push'](_0x3042d5['shift']());}};_0x1acfef(++_0x349534);}(_0xc575,0xe7));var _0x5c57=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0xc575[_0x4a4a43];return _0x5893a6;};'use strict';var client=require('../client');exports[_0x5c57('0x0')]=function(_0x23e18b,_0x54294e){return client['Request']('UpdateChatInteraction',{'body':_0x54294e,'options':{'where':{'id':_0x23e18b}},'log':_0x5c57('0x1')});};exports['addTags']=function(_0x47bc66,_0xdd904d){return client['Request'](_0x5c57('0x2'),{'body':_0xdd904d,'options':{'where':{'id':_0x47bc66}},'log':_0x5c57('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ae156d2..f8ead29 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 _0xd633=['CreateChatMessage','../client'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xd633,0x111));var _0x3d63=function(_0x2f3a33,_0x2c8d83){_0x2f3a33=_0x2f3a33-0x0;var _0x4d9469=_0xd633[_0x2f3a33];return _0x4d9469;};'use strict';var client=require(_0x3d63('0x0'));exports['create']=function(_0x2fc3e4){return client['Request'](_0x3d63('0x1'),{'body':_0x2fc3e4,'log':'createChatMessage'});}; \ No newline at end of file +var _0xa94d=['Request','CreateChatMessage','createChatMessage'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa94d,0xed));var _0xda94=function(_0x1d2bb7,_0x12c9b6){_0x1d2bb7=_0x1d2bb7-0x0;var _0x52e953=_0xa94d[_0x1d2bb7];return _0x52e953;};'use strict';var client=require('../client');exports['create']=function(_0x1d157a){return client[_0xda94('0x0')](_0xda94('0x1'),{'body':_0x1d157a,'log':_0xda94('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index bc3bd31..44f1787 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 _0xc7a3=['name','timeout','strategy','Agents','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x1b6b0f,_0x1e31b8){var _0x1ccc12=function(_0x9b2736){while(--_0x9b2736){_0x1b6b0f['push'](_0x1b6b0f['shift']());}};_0x1ccc12(++_0x1e31b8);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x87463d,_0x3ad0d7){_0x87463d=_0x87463d-0x0;var _0x23723c=_0xc7a3[_0x87463d];return _0x23723c;};'use strict';var client=require('../client');exports[_0x3c7a('0x0')]=function(){return function(){return client[_0x3c7a('0x1')](_0x3c7a('0x2'),{'options':{'raw':![],'attributes':['id',_0x3c7a('0x3'),_0x3c7a('0x4'),_0x3c7a('0x5')],'include':[{'model':'User','as':_0x3c7a('0x6'),'attributes':['id',_0x3c7a('0x3'),'online',_0x3c7a('0x7')]}]},'log':_0x3c7a('0x0')});};}; \ No newline at end of file +var _0xb458=['User','Agents','online','../client','getChatQueues','Request','timeout','strategy'];(function(_0x29fbf6,_0x48ff24){var _0x18a882=function(_0x4b10ce){while(--_0x4b10ce){_0x29fbf6['push'](_0x29fbf6['shift']());}};_0x18a882(++_0x48ff24);}(_0xb458,0x103));var _0x8b45=function(_0x39df6e,_0x548a5a){_0x39df6e=_0x39df6e-0x0;var _0xcbceb6=_0xb458[_0x39df6e];return _0xcbceb6;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x8b45('0x3'),_0x8b45('0x4')],'include':[{'model':_0x8b45('0x5'),'as':_0x8b45('0x6'),'attributes':['id','name',_0x8b45('0x7'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 47cee04..cd61750 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 _0x9b87=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport','update'];(function(_0xea61c4,_0x19805f){var _0x229ae6=function(_0x451149){while(--_0x451149){_0xea61c4['push'](_0xea61c4['shift']());}};_0x229ae6(++_0x19805f);}(_0x9b87,0x8e));var _0x79b8=function(_0x2eab50,_0x3ae62f){_0x2eab50=_0x2eab50-0x0;var _0x30cbd6=_0x9b87[_0x2eab50];return _0x30cbd6;};'use strict';var client=require(_0x79b8('0x0'));exports[_0x79b8('0x1')]=function(_0x20fb46){return client[_0x79b8('0x2')](_0x79b8('0x3'),{'body':_0x20fb46,'log':_0x79b8('0x3')});};exports[_0x79b8('0x4')]=function(_0xb4e3e7,_0xbc1e74){return client[_0x79b8('0x2')](_0x79b8('0x5'),{'body':_0xbc1e74,'options':{'where':{'uniqueid':_0xb4e3e7},'order':[['id',_0x79b8('0x6')]],'limit':0x1},'log':_0x79b8('0x5')});}; \ No newline at end of file +var _0x27c5=['DESC','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x327fb0,_0x387a15){var _0x13b762=function(_0x24d37a){while(--_0x24d37a){_0x327fb0['push'](_0x327fb0['shift']());}};_0x13b762(++_0x387a15);}(_0x27c5,0x173));var _0x527c=function(_0x33a6bd,_0x564362){_0x33a6bd=_0x33a6bd-0x0;var _0x339aff=_0x27c5[_0x33a6bd];return _0x339aff;};'use strict';var client=require('../client');exports['create']=function(_0x157017){return client[_0x527c('0x0')](_0x527c('0x1'),{'body':_0x157017,'log':'CreateChatQueueReport'});};exports[_0x527c('0x2')]=function(_0x458db1,_0x371ae5){return client[_0x527c('0x0')](_0x527c('0x3'),{'body':_0x371ae5,'options':{'where':{'uniqueid':_0x458db1},'order':[['id',_0x527c('0x4')]],'limit':0x1},'log':_0x527c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 86f2f79..e2bc011 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x536082,_0x46e681){_0x536082=_0x536082-0x0;var _0x2a159b=_0x7a54[_0x536082];return _0x2a159b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x425c62,_0x41eb91){var _0x20b356=function(_0x280015){while(--_0x280015){_0x425c62['push'](_0x425c62['shift']());}};_0x20b356(++_0x41eb91);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 f59f0dd..bd78919 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 _0x5160=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0x2f8468,_0x159134){var _0x11132b=function(_0x46977b){while(--_0x46977b){_0x2f8468['push'](_0x2f8468['shift']());}};_0x11132b(++_0x159134);}(_0x5160,0xe0));var _0x0516=function(_0x21f4bf,_0x217103){_0x21f4bf=_0x21f4bf-0x0;var _0x5d1538=_0x5160[_0x21f4bf];return _0x5d1538;};'use strict';var client=require(_0x0516('0x0'));exports[_0x0516('0x1')]=function(_0x289ebb){return client['Request'](_0x0516('0x2'),{'body':_0x289ebb,'log':_0x0516('0x3')});}; \ No newline at end of file +var _0x1209=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x3b2ef1,_0x58e546){var _0x123c52=function(_0x2c0967){while(--_0x2c0967){_0x3b2ef1['push'](_0x3b2ef1['shift']());}};_0x123c52(++_0x58e546);}(_0x1209,0xde));var _0x9120=function(_0x32b4aa,_0x12eba6){_0x32b4aa=_0x32b4aa-0x0;var _0x473160=_0x1209[_0x32b4aa];return _0x473160;};'use strict';var client=require(_0x9120('0x0'));exports[_0x9120('0x1')]=function(_0x307930){return client[_0x9120('0x2')](_0x9120('0x3'),{'body':_0x307930,'log':_0x9120('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 3179c59..1fa1e9d 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 _0x5f8d=['Request','GetFaxQueue','name','timeout','strategy','online','faxPause','../client'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5f8d,0x137));var _0xd5f8=function(_0x59bf02,_0x58b4eb){_0x59bf02=_0x59bf02-0x0;var _0xa9400f=_0x5f8d[_0x59bf02];return _0xa9400f;};'use strict';var client=require(_0xd5f8('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xd5f8('0x1')](_0xd5f8('0x2'),{'options':{'raw':![],'attributes':['id',_0xd5f8('0x3'),_0xd5f8('0x4'),_0xd5f8('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xd5f8('0x3'),_0xd5f8('0x6'),_0xd5f8('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x8ded=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name'];(function(_0x4c9198,_0x27d807){var _0x3c0463=function(_0x2faaed){while(--_0x2faaed){_0x4c9198['push'](_0x4c9198['shift']());}};_0x3c0463(++_0x27d807);}(_0x8ded,0x110));var _0xd8de=function(_0x743f68,_0x56e670){_0x743f68=_0x743f68-0x0;var _0x46383f=_0x8ded[_0x743f68];return _0x46383f;};'use strict';var client=require(_0xd8de('0x0'));exports[_0xd8de('0x1')]=function(){return function(){return client[_0xd8de('0x2')](_0xd8de('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xd8de('0x4'),_0xd8de('0x5')],'include':[{'model':'User','as':_0xd8de('0x6'),'attributes':['id',_0xd8de('0x7'),_0xd8de('0x8'),_0xd8de('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e09aee4..3dbf702 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 _0x09bb=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x09bb,0x130));var _0xb09b=function(_0x47fafa,_0x335680){_0x47fafa=_0x47fafa-0x0;var _0x34108f=_0x09bb[_0x47fafa];return _0x34108f;};'use strict';var client=require(_0xb09b('0x0'));exports[_0xb09b('0x1')]=function(_0x187c75){return client[_0xb09b('0x2')]('CreateFaxQueueReport',{'body':_0x187c75,'log':_0xb09b('0x3')});};exports[_0xb09b('0x4')]=function(_0x1ef66e,_0x5300e9){return client[_0xb09b('0x2')]('UpdateFaxQueueReport',{'body':_0x5300e9,'options':{'where':{'uniqueid':_0x1ef66e},'order':[['id',_0xb09b('0x5')]],'limit':0x1},'log':_0xb09b('0x6')});}; \ No newline at end of file +var _0xa2e9=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x218bda,_0xfbee7){var _0x4ea5d2=function(_0x4457c0){while(--_0x4457c0){_0x218bda['push'](_0x218bda['shift']());}};_0x4ea5d2(++_0xfbee7);}(_0xa2e9,0x167));var _0x9a2e=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0xa2e9[_0xb83ec2];return _0x4d2fbf;};'use strict';var client=require(_0x9a2e('0x0'));exports['create']=function(_0x17468d){return client[_0x9a2e('0x1')](_0x9a2e('0x2'),{'body':_0x17468d,'log':'CreateFaxQueueReport'});};exports[_0x9a2e('0x3')]=function(_0x37e1f2,_0x4c8253){return client[_0x9a2e('0x1')](_0x9a2e('0x4'),{'body':_0x4c8253,'options':{'where':{'uniqueid':_0x37e1f2},'order':[['id',_0x9a2e('0x5')]],'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 0c4433a..aba3368 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 _0x6e13=['interval','../client','getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x42a888,_0x3e0a67){var _0x1bf418=function(_0x9dd47e){while(--_0x9dd47e){_0x42a888['push'](_0x42a888['shift']());}};_0x1bf418(++_0x3e0a67);}(_0x6e13,0x149));var _0x36e1=function(_0x54899a,_0x432a27){_0x54899a=_0x54899a-0x0;var _0x5a294c=_0x6e13[_0x54899a];return _0x5a294c;};'use strict';var client=require(_0x36e1('0x0'));exports[_0x36e1('0x1')]=function(){return function(){return client[_0x36e1('0x2')](_0x36e1('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x36e1('0x4')],'include':[{'model':_0x36e1('0x5'),'as':_0x36e1('0x6'),'attributes':['id','name',_0x36e1('0x7')]}]},'log':_0x36e1('0x1')});};}; \ No newline at end of file +var _0x9379=['../client','getIntervals','name','Interval','Intervals','interval'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9379,0xea));var _0x9937=function(_0x55bda2,_0x4315d0){_0x55bda2=_0x55bda2-0x0;var _0x2e0c4c=_0x9379[_0x55bda2];return _0x2e0c4c;};'use strict';var client=require(_0x9937('0x0'));exports[_0x9937('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x9937('0x2')],'include':[{'model':_0x9937('0x3'),'as':_0x9937('0x4'),'attributes':['id','name',_0x9937('0x5')]}]},'log':_0x9937('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e1591d7..197c262 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 _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x34a161,_0x52a77b){var _0x4412a1=function(_0x32e665){while(--_0x32e665){_0x34a161['push'](_0x34a161['shift']());}};_0x4412a1(++_0x52a77b);}(_0x781d,0x14a));var _0xd781=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x781d[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});}; \ No newline at end of file +var _0x5f66=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x283fc5,_0x1f70f6){var _0x5377c8=function(_0x40076a){while(--_0x40076a){_0x283fc5['push'](_0x283fc5['shift']());}};_0x5377c8(++_0x1f70f6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var client=require('../client');exports[_0x65f6('0x0')]=function(_0x4a3887,_0x2d5fd9){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'body':_0x2d5fd9,'options':{'where':{'id':_0x4a3887}},'log':_0x65f6('0x3')});};exports[_0x65f6('0x4')]=function(_0x5eb9ad,_0x3c5029){return client['Request'](_0x65f6('0x5'),{'body':_0x3c5029,'options':{'where':{'id':_0x5eb9ad}},'log':_0x65f6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 107a86e..2e4dfc4 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 _0x1ef0=['Request','CreateMailMessage','createMailMessage','create'];(function(_0x256291,_0x477e35){var _0x4a063d=function(_0x284320){while(--_0x284320){_0x256291['push'](_0x256291['shift']());}};_0x4a063d(++_0x477e35);}(_0x1ef0,0x1d3));var _0x01ef=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x1ef0[_0x24259d];return _0x5a701;};'use strict';var client=require('../client');exports[_0x01ef('0x0')]=function(_0x56bfb6){return client[_0x01ef('0x1')](_0x01ef('0x2'),{'body':_0x56bfb6,'log':_0x01ef('0x3')});}; \ No newline at end of file +var _0x218f=['create','CreateMailMessage','createMailMessage','../client'];(function(_0x40be3c,_0x5618ef){var _0x5c2b9c=function(_0x56ccd0){while(--_0x56ccd0){_0x40be3c['push'](_0x40be3c['shift']());}};_0x5c2b9c(++_0x5618ef);}(_0x218f,0x12b));var _0xf218=function(_0x1d9509,_0x558168){_0x1d9509=_0x1d9509-0x0;var _0x2be027=_0x218f[_0x1d9509];return _0x2be027;};'use strict';var client=require(_0xf218('0x0'));exports[_0xf218('0x1')]=function(_0x31741d){return client['Request'](_0xf218('0x2'),{'body':_0x31741d,'log':_0xf218('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e326c91..bd935d3 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 _0x6a75=['timeout','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x5d743a,_0x386cc3){var _0x2f0fec=function(_0x48b71e){while(--_0x48b71e){_0x5d743a['push'](_0x5d743a['shift']());}};_0x2f0fec(++_0x386cc3);}(_0x6a75,0x1db));var _0x56a7=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6a75[_0x1d24eb];return _0x1dc576;};'use strict';var client=require(_0x56a7('0x0'));exports[_0x56a7('0x1')]=function(){return function(){return client[_0x56a7('0x2')](_0x56a7('0x3'),{'options':{'raw':![],'attributes':['id',_0x56a7('0x4'),_0x56a7('0x5'),'strategy'],'include':[{'model':_0x56a7('0x6'),'as':_0x56a7('0x7'),'attributes':['id',_0x56a7('0x4'),_0x56a7('0x8'),_0x56a7('0x9')]}]},'log':_0x56a7('0x1')});};}; \ No newline at end of file +var _0xb495=['GetMailQueue','name','timeout','strategy','User','Agents','mailPause','../client','getMailQueues','Request'];(function(_0xd7ee0e,_0x2a69b0){var _0x5f2b3e=function(_0x568bf9){while(--_0x568bf9){_0xd7ee0e['push'](_0xd7ee0e['shift']());}};_0x5f2b3e(++_0x2a69b0);}(_0xb495,0x93));var _0x5b49=function(_0x155b25,_0x80a08d){_0x155b25=_0x155b25-0x0;var _0x503a8c=_0xb495[_0x155b25];return _0x503a8c;};'use strict';var client=require(_0x5b49('0x0'));exports[_0x5b49('0x1')]=function(){return function(){return client[_0x5b49('0x2')](_0x5b49('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b49('0x4'),_0x5b49('0x5'),_0x5b49('0x6')],'include':[{'model':_0x5b49('0x7'),'as':_0x5b49('0x8'),'attributes':['id',_0x5b49('0x4'),'online',_0x5b49('0x9')]}]},'log':_0x5b49('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 94e1c1f..44d800a 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 _0x210e=['Request','update','DESC','UpdateMailQueueReport','create'];(function(_0x404ed5,_0x259d1e){var _0x58d236=function(_0x7a1c66){while(--_0x7a1c66){_0x404ed5['push'](_0x404ed5['shift']());}};_0x58d236(++_0x259d1e);}(_0x210e,0xc7));var _0xe210=function(_0x541a6c,_0x2e4bf9){_0x541a6c=_0x541a6c-0x0;var _0x3d559d=_0x210e[_0x541a6c];return _0x3d559d;};'use strict';var client=require('../client');exports[_0xe210('0x0')]=function(_0x52d37b){return client[_0xe210('0x1')]('CreateMailQueueReport',{'body':_0x52d37b,'log':'CreateMailQueueReport'});};exports[_0xe210('0x2')]=function(_0x542731,_0x2b5bb6){return client['Request']('UpdateMailQueueReport',{'body':_0x2b5bb6,'options':{'where':{'uniqueid':_0x542731},'order':[['id',_0xe210('0x3')]],'limit':0x1},'log':_0xe210('0x4')});}; \ No newline at end of file +var _0xdd7a=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport','update'];(function(_0x49a449,_0x1a86f6){var _0xf699cb=function(_0x1425cb){while(--_0x1425cb){_0x49a449['push'](_0x49a449['shift']());}};_0xf699cb(++_0x1a86f6);}(_0xdd7a,0x8e));var _0xadd7=function(_0x5ea19d,_0x3b8a9f){_0x5ea19d=_0x5ea19d-0x0;var _0x2d371e=_0xdd7a[_0x5ea19d];return _0x2d371e;};'use strict';var client=require('../client');exports['create']=function(_0xeccdd9){return client[_0xadd7('0x0')](_0xadd7('0x1'),{'body':_0xeccdd9,'log':_0xadd7('0x1')});};exports[_0xadd7('0x2')]=function(_0x1bd8b9,_0x577db1){return client['Request'](_0xadd7('0x3'),{'body':_0x577db1,'options':{'where':{'uniqueid':_0x1bd8b9},'order':[['id',_0xadd7('0x4')]],'limit':0x1},'log':_0xadd7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a5d4fec..7656b87 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 _0xaed5=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x34b1b8,_0x54c9bf){var _0x542dd8=function(_0xff3f89){while(--_0xff3f89){_0x34b1b8['push'](_0x34b1b8['shift']());}};_0x542dd8(++_0x54c9bf);}(_0xaed5,0x136));var _0x5aed=function(_0x504557,_0x39fb8d){_0x504557=_0x504557-0x0;var _0x5bc2e0=_0xaed5[_0x504557];return _0x5bc2e0;};'use strict';var client=require(_0x5aed('0x0'));exports[_0x5aed('0x1')]=function(_0x40623d,_0x7f9dcb){return client[_0x5aed('0x2')](_0x5aed('0x3'),{'body':_0x7f9dcb,'options':{'where':{'id':_0x40623d}},'log':_0x5aed('0x4')});};exports['addTags']=function(_0x3abdb9,_0x38f8e4){return client[_0x5aed('0x2')](_0x5aed('0x5'),{'body':_0x38f8e4,'options':{'where':{'id':_0x3abdb9}},'log':_0x5aed('0x6')});}; \ No newline at end of file +var _0xa365=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x2011ae,_0x4bec4b){var _0x1bfa52=function(_0x3492da){while(--_0x3492da){_0x2011ae['push'](_0x2011ae['shift']());}};_0x1bfa52(++_0x4bec4b);}(_0xa365,0x1ed));var _0x5a36=function(_0x3f0a10,_0x244777){_0x3f0a10=_0x3f0a10-0x0;var _0x22475f=_0xa365[_0x3f0a10];return _0x22475f;};'use strict';var client=require(_0x5a36('0x0'));exports['update']=function(_0x4090fa,_0x26fb6b){return client[_0x5a36('0x1')](_0x5a36('0x2'),{'body':_0x26fb6b,'options':{'where':{'id':_0x4090fa}},'log':'updateOpenchannelInteraction'});};exports[_0x5a36('0x3')]=function(_0x113ca1,_0x86c9ce){return client[_0x5a36('0x1')](_0x5a36('0x4'),{'body':_0x86c9ce,'options':{'where':{'id':_0x113ca1}},'log':_0x5a36('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index cbeba6e..aa40a84 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 _0xd8c2=['create','Request','createOpenchannelMessage','../client'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0xd8c2,0x193));var _0x2d8c=function(_0x36e80f,_0x542a23){_0x36e80f=_0x36e80f-0x0;var _0x120973=_0xd8c2[_0x36e80f];return _0x120973;};'use strict';var client=require(_0x2d8c('0x0'));exports[_0x2d8c('0x1')]=function(_0x100cb3){return client[_0x2d8c('0x2')]('CreateOpenchannelMessage',{'body':_0x100cb3,'log':_0x2d8c('0x3')});}; \ No newline at end of file +var _0x6551=['../client','Request'];(function(_0x28d90a,_0x518da0){var _0x27c430=function(_0x55f8ad){while(--_0x55f8ad){_0x28d90a['push'](_0x28d90a['shift']());}};_0x27c430(++_0x518da0);}(_0x6551,0x1c0));var _0x1655=function(_0x144567,_0x356b5d){_0x144567=_0x144567-0x0;var _0x1b5901=_0x6551[_0x144567];return _0x1b5901;};'use strict';var client=require(_0x1655('0x0'));exports['create']=function(_0xed6f58){return client[_0x1655('0x1')]('CreateOpenchannelMessage',{'body':_0xed6f58,'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 7ff45bb..1889c6a 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 _0xf4e2=['timeout','strategy','User','Agents','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x22d598,_0x259d66){var _0x47477f=function(_0x517d4f){while(--_0x517d4f){_0x22d598['push'](_0x22d598['shift']());}};_0x47477f(++_0x259d66);}(_0xf4e2,0xb4));var _0x2f4e=function(_0x34eb0d,_0x43448b){_0x34eb0d=_0x34eb0d-0x0;var _0x309bb3=_0xf4e2[_0x34eb0d];return _0x309bb3;};'use strict';var client=require('../client');exports[_0x2f4e('0x0')]=function(){return function(){return client[_0x2f4e('0x1')](_0x2f4e('0x2'),{'options':{'raw':![],'attributes':['id',_0x2f4e('0x3'),_0x2f4e('0x4'),_0x2f4e('0x5')],'include':[{'model':_0x2f4e('0x6'),'as':_0x2f4e('0x7'),'attributes':['id','name','online','openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x5dda=['timeout','strategy','Agents','online','openchannelPause','../client','GetOpenchannelQueue','name'];(function(_0x4dfbed,_0xf04fc1){var _0x5232f6=function(_0x534493){while(--_0x534493){_0x4dfbed['push'](_0x4dfbed['shift']());}};_0x5232f6(++_0xf04fc1);}(_0x5dda,0xed));var _0xa5dd=function(_0x2c82c3,_0x12e4ba){_0x2c82c3=_0x2c82c3-0x0;var _0x3af250=_0x5dda[_0x2c82c3];return _0x3af250;};'use strict';var client=require(_0xa5dd('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xa5dd('0x1'),{'options':{'raw':![],'attributes':['id',_0xa5dd('0x2'),_0xa5dd('0x3'),_0xa5dd('0x4')],'include':[{'model':'User','as':_0xa5dd('0x5'),'attributes':['id',_0xa5dd('0x2'),_0xa5dd('0x6'),_0xa5dd('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d4d74c0..92b08bf 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 _0xcb39=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x1b34a2,_0x54fd28){var _0x59120b=function(_0x29723f){while(--_0x29723f){_0x1b34a2['push'](_0x1b34a2['shift']());}};_0x59120b(++_0x54fd28);}(_0xcb39,0xee));var _0x9cb3=function(_0x1b2779,_0x181d22){_0x1b2779=_0x1b2779-0x0;var _0x162929=_0xcb39[_0x1b2779];return _0x162929;};'use strict';var client=require(_0x9cb3('0x0'));exports[_0x9cb3('0x1')]=function(_0x35d46e){return client[_0x9cb3('0x2')](_0x9cb3('0x3'),{'body':_0x35d46e,'log':_0x9cb3('0x3')});};exports[_0x9cb3('0x4')]=function(_0x1068b6,_0x2bcec9){return client[_0x9cb3('0x2')](_0x9cb3('0x5'),{'body':_0x2bcec9,'options':{'where':{'uniqueid':_0x1068b6},'order':[['id',_0x9cb3('0x6')]],'limit':0x1},'log':_0x9cb3('0x5')});}; \ No newline at end of file +var _0xdace=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0xdace,0xad));var _0xedac=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xdace[_0x3afe18];return _0x19ed1f;};'use strict';var client=require(_0xedac('0x0'));exports[_0xedac('0x1')]=function(_0x422a31){return client[_0xedac('0x2')](_0xedac('0x3'),{'body':_0x422a31,'log':_0xedac('0x3')});};exports[_0xedac('0x4')]=function(_0x1bc6dd,_0x2bcfa3){return client[_0xedac('0x2')](_0xedac('0x5'),{'body':_0x2bcfa3,'options':{'where':{'uniqueid':_0x1bc6dd},'order':[['id',_0xedac('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e7bfe1d..486c3d0 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 _0x7a2d=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x46fe8f,_0x1474ca){var _0x6ac068=function(_0x4552d9){while(--_0x4552d9){_0x46fe8f['push'](_0x46fe8f['shift']());}};_0x6ac068(++_0x1474ca);}(_0x7a2d,0x142));var _0xd7a2=function(_0x467ad8,_0x5886bf){_0x467ad8=_0x467ad8-0x0;var _0x354a88=_0x7a2d[_0x467ad8];return _0x354a88;};'use strict';var client=require(_0xd7a2('0x0'));exports[_0xd7a2('0x1')]=function(_0xf948c3,_0x3b21fc){return client[_0xd7a2('0x2')](_0xd7a2('0x3'),{'body':_0x3b21fc,'options':{'where':{'id':_0xf948c3}},'log':_0xd7a2('0x4')});};exports['addTags']=function(_0x500472,_0x7370d9){return client[_0xd7a2('0x2')](_0xd7a2('0x5'),{'body':_0x7370d9,'options':{'where':{'id':_0x500472}},'log':_0xd7a2('0x6')});}; \ No newline at end of file +var _0x95f4=['AddTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','Request'];(function(_0x1a03fe,_0x30a3cd){var _0x4d9d1a=function(_0xd7a059){while(--_0xd7a059){_0x1a03fe['push'](_0x1a03fe['shift']());}};_0x4d9d1a(++_0x30a3cd);}(_0x95f4,0xf1));var _0x495f=function(_0x3ceecb,_0x12f19f){_0x3ceecb=_0x3ceecb-0x0;var _0x53028b=_0x95f4[_0x3ceecb];return _0x53028b;};'use strict';var client=require(_0x495f('0x0'));exports[_0x495f('0x1')]=function(_0x1cc98d,_0x495214){return client['Request'](_0x495f('0x2'),{'body':_0x495214,'options':{'where':{'id':_0x1cc98d}},'log':_0x495f('0x3')});};exports['addTags']=function(_0x501377,_0x87cc22){return client[_0x495f('0x4')](_0x495f('0x5'),{'body':_0x87cc22,'options':{'where':{'id':_0x501377}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 761d9c2..5442357 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 _0x5f78=['Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x5d110a,_0x76e6c8){var _0x506ea1=function(_0xaf1ad5){while(--_0xaf1ad5){_0x5d110a['push'](_0x5d110a['shift']());}};_0x506ea1(++_0x76e6c8);}(_0x5f78,0x19b));var _0x85f7=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0x5f78[_0x2074db];return _0x27324c;};'use strict';var client=require(_0x85f7('0x0'));exports['create']=function(_0x4af509){return client[_0x85f7('0x1')](_0x85f7('0x2'),{'body':_0x4af509,'log':_0x85f7('0x3')});}; \ No newline at end of file +var _0x5bde=['Request','CreateSmsMessage','../client','create'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5bde,0x1ce));var _0xe5bd=function(_0x165e34,_0x36f348){_0x165e34=_0x165e34-0x0;var _0x2d990d=_0x5bde[_0x165e34];return _0x2d990d;};'use strict';var client=require(_0xe5bd('0x0'));exports[_0xe5bd('0x1')]=function(_0x20373a){return client[_0xe5bd('0x2')](_0xe5bd('0x3'),{'body':_0x20373a,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 57a12b6..d379525 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x47e7a2,_0x2aac8e){var _0x5d415d=function(_0x543233){while(--_0x543233){_0x47e7a2['push'](_0x47e7a2['shift']());}};_0x5d415d(++_0x2aac8e);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x3fe8b2,_0x50542c){var _0x431b0c=function(_0xcbd46c){while(--_0xcbd46c){_0x3fe8b2['push'](_0x3fe8b2['shift']());}};_0x431b0c(++_0x50542c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xcb91[_0x1df7b8];return _0x29d911;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 517828c..50fa395 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x4a7d6f,_0x462a32){var _0x5b047e=function(_0x433422){while(--_0x433422){_0x4a7d6f['push'](_0x4a7d6f['shift']());}};_0x5b047e(++_0x462a32);}(_0x3e74,0x175));var _0x43e7=function(_0x2ca93e,_0x5ae9ca){_0x2ca93e=_0x2ca93e-0x0;var _0x18cd71=_0x3e74[_0x2ca93e];return _0x18cd71;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xedd9,0xfc));var _0x9edd=function(_0x1047b4,_0x57bb01){_0x1047b4=_0x1047b4-0x0;var _0x3e6e60=_0xedd9[_0x1047b4];return _0x3e6e60;};'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 70802b1..b5751da 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(_0x2f2367,_0x3a992e){var _0x3e7eb8=function(_0x2df534){while(--_0x2df534){_0x2f2367['push'](_0x2f2367['shift']());}};_0x3e7eb8(++_0x3a992e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x1ea2a2,_0x2c2803){var _0x1eba24=function(_0x5377a7){while(--_0x5377a7){_0x1ea2a2['push'](_0x1ea2a2['shift']());}};_0x1eba24(++_0x2c2803);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 57cd36e..d013151 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 _0x49c1=['Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x49d62d,_0x26fe1d){var _0x229204=function(_0x2c0f39){while(--_0x2c0f39){_0x49d62d['push'](_0x49d62d['shift']());}};_0x229204(++_0x26fe1d);}(_0x49c1,0xef));var _0x149c=function(_0x2a470f,_0x1c5347){_0x2a470f=_0x2a470f-0x0;var _0x126383=_0x49c1[_0x2a470f];return _0x126383;};'use strict';var client=require(_0x149c('0x0'));exports['update']=function(_0x466227,_0x2f0c65){return client[_0x149c('0x1')]('UpdateWhatsappInteraction',{'body':_0x2f0c65,'options':{'where':{'id':_0x466227}},'log':_0x149c('0x2')});};exports[_0x149c('0x3')]=function(_0x4c3294,_0xdb4fdf){return client[_0x149c('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xdb4fdf,'options':{'where':{'id':_0x4c3294}},'log':_0x149c('0x4')});}; \ No newline at end of file +var _0x0295=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','updateWhatsappInteraction'];(function(_0x418bb9,_0x14cb6a){var _0x237bc2=function(_0x32bc41){while(--_0x32bc41){_0x418bb9['push'](_0x418bb9['shift']());}};_0x237bc2(++_0x14cb6a);}(_0x0295,0x1f0));var _0x5029=function(_0x135573,_0x479526){_0x135573=_0x135573-0x0;var _0x13ea56=_0x0295[_0x135573];return _0x13ea56;};'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 diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b65fc3e..d834e93 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 _0xca05=['../client','create','Request','CreateWhatsappMessage'];(function(_0xcda377,_0x1e2678){var _0x1c024f=function(_0x1aeb61){while(--_0x1aeb61){_0xcda377['push'](_0xcda377['shift']());}};_0x1c024f(++_0x1e2678);}(_0xca05,0x148));var _0x5ca0=function(_0x3ba422,_0x53303c){_0x3ba422=_0x3ba422-0x0;var _0x20b5dd=_0xca05[_0x3ba422];return _0x20b5dd;};'use strict';var client=require(_0x5ca0('0x0'));exports[_0x5ca0('0x1')]=function(_0x40f55c){return client[_0x5ca0('0x2')](_0x5ca0('0x3'),{'body':_0x40f55c,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x2ad6=['Request','createWhatsappMessage','../client','create'];(function(_0x3bf265,_0x24ebd6){var _0x40ef92=function(_0x5234eb){while(--_0x5234eb){_0x3bf265['push'](_0x3bf265['shift']());}};_0x40ef92(++_0x24ebd6);}(_0x2ad6,0x1be));var _0x62ad=function(_0x44d977,_0x5d35ed){_0x44d977=_0x44d977-0x0;var _0x526d43=_0x2ad6[_0x44d977];return _0x526d43;};'use strict';var client=require(_0x62ad('0x0'));exports[_0x62ad('0x1')]=function(_0x5211f9){return client[_0x62ad('0x2')]('CreateWhatsappMessage',{'body':_0x5211f9,'log':_0x62ad('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c63c655..2b6b476 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 _0xa34a=['strategy','Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x4737a0,_0x36520e){var _0x4d558b=function(_0xaa9825){while(--_0xaa9825){_0x4737a0['push'](_0x4737a0['shift']());}};_0x4d558b(++_0x36520e);}(_0xa34a,0x137));var _0xaa34=function(_0x5b53bc,_0x595d90){_0x5b53bc=_0x5b53bc-0x0;var _0x141486=_0xa34a[_0x5b53bc];return _0x141486;};'use strict';var client=require(_0xaa34('0x0'));exports[_0xaa34('0x1')]=function(){return function(){return client['Request'](_0xaa34('0x2'),{'options':{'raw':![],'attributes':['id',_0xaa34('0x3'),'timeout',_0xaa34('0x4')],'include':[{'model':'User','as':_0xaa34('0x5'),'attributes':['id',_0xaa34('0x3'),_0xaa34('0x6'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x24b9=['timeout','strategy','User','online','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x1f1305,_0x2435f5){var _0x571a9d=function(_0x411dfc){while(--_0x411dfc){_0x1f1305['push'](_0x1f1305['shift']());}};_0x571a9d(++_0x2435f5);}(_0x24b9,0x74));var _0x924b=function(_0x466e89,_0xede644){_0x466e89=_0x466e89-0x0;var _0x40b366=_0x24b9[_0x466e89];return _0x40b366;};'use strict';var client=require('../client');exports[_0x924b('0x0')]=function(){return function(){return client[_0x924b('0x1')](_0x924b('0x2'),{'options':{'raw':![],'attributes':['id',_0x924b('0x3'),_0x924b('0x4'),_0x924b('0x5')],'include':[{'model':_0x924b('0x6'),'as':'Agents','attributes':['id',_0x924b('0x3'),_0x924b('0x7'),'whatsappPause']}]},'log':_0x924b('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 7e202de..c9870bd 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 _0x3e65=['../client','create','update','UpdateWhatsappQueueReport','DESC'];(function(_0x5880d8,_0x30b0a5){var _0x88264a=function(_0x5ec626){while(--_0x5ec626){_0x5880d8['push'](_0x5880d8['shift']());}};_0x88264a(++_0x30b0a5);}(_0x3e65,0x1e5));var _0x53e6=function(_0x1e65ce,_0x1ba8d9){_0x1e65ce=_0x1e65ce-0x0;var _0x4d84f8=_0x3e65[_0x1e65ce];return _0x4d84f8;};'use strict';var client=require(_0x53e6('0x0'));exports[_0x53e6('0x1')]=function(_0xcdd1d6){return client['Request']('CreateWhatsappQueueReport',{'body':_0xcdd1d6,'log':'CreateWhatsappQueueReport'});};exports[_0x53e6('0x2')]=function(_0x449e0c,_0x1fb7ac){return client['Request'](_0x53e6('0x3'),{'body':_0x1fb7ac,'options':{'where':{'uniqueid':_0x449e0c},'order':[['id',_0x53e6('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x3e68=['Request','CreateWhatsappQueueReport','update','DESC','../client','create'];(function(_0x280c35,_0x4b9a51){var _0x13fabb=function(_0x480507){while(--_0x480507){_0x280c35['push'](_0x280c35['shift']());}};_0x13fabb(++_0x4b9a51);}(_0x3e68,0x8e));var _0x83e6=function(_0x1b092a,_0x1f2475){_0x1b092a=_0x1b092a-0x0;var _0x22c7b6=_0x3e68[_0x1b092a];return _0x22c7b6;};'use strict';var client=require(_0x83e6('0x0'));exports[_0x83e6('0x1')]=function(_0x52ed85){return client[_0x83e6('0x2')]('CreateWhatsappQueueReport',{'body':_0x52ed85,'log':_0x83e6('0x3')});};exports[_0x83e6('0x4')]=function(_0x519bce,_0xdbfc8e){return client['Request']('UpdateWhatsappQueueReport',{'body':_0xdbfc8e,'options':{'where':{'uniqueid':_0x519bce},'order':[['id',_0x83e6('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 839d883..fb6d648 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 _0xac44=['timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','join','find','timeout','createQueue','channel','START:%s','rules','end','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x254435,_0x2565da){var _0x484b59=function(_0x340b5a){while(--_0x340b5a){_0x254435['push'](_0x254435['shift']());}};_0x484b59(++_0x2565da);}(_0xac44,0x143));var _0x4ac4=function(_0x288598,_0x404a76){_0x288598=_0x288598-0x0;var _0x44c336=_0xac44[_0x288598];return _0x44c336;};'use strict';var schema=require(_0x4ac4('0x0'));var _=require('lodash');var util=require(_0x4ac4('0x1'));var seqqueue=require(_0x4ac4('0x2'));var logger=require(_0x4ac4('0x3'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x4ac4('0x4'),'required':!![],'message':_0x4ac4('0x5')},'timeout':{'type':_0x4ac4('0x6'),'message':_0x4ac4('0x7')}});function writeLog(_0x21ed24,_0x23654a,_0x4fcf24){return logger[_0x4ac4('0x8')](util[_0x4ac4('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x21ed24,_0x23654a['name'],_0x4fcf24));}function handleFindAgent(_0x4445e2){return function(_0x433437){return _0x433437[_0x4ac4('0xa')][_0x4ac4('0xb')]()===_0x4445e2['toLowerCase']();};}exports['consequence']=function(_0x22ea45,_0x58ea4b,_0x4f011f,_0x37a5c4){return function(_0xdd68ec){try{var _0x4c17db={'name':_0x58ea4b[0x0],'timeout':_0x58ea4b[0x1]};var _0x1117f8=queue['validate'](_0x4c17db,{'typecast':!![]});if(_0x1117f8[_0x4ac4('0xc')]){logger[_0x4ac4('0xd')](_0x4ac4('0xe'),_0x22ea45,_[_0x4ac4('0xf')](_0x1117f8,'message')[_0x4ac4('0x10')](',\x20'));_0xdd68ec['stop']();}else{var _0x4994d9=_[_0x4ac4('0x11')](_0x4f011f['agents'],handleFindAgent(_0x4c17db['name']));if(_0x4994d9){var _0xc372bc=(_0x4c17db[_0x4ac4('0x12')]||0xa)*0x3e8;var _0x55615b,_0x194e55;var _0x5028f1=seqqueue[_0x4ac4('0x13')](_0xc372bc);_0x5028f1['id']=_0x22ea45;_0x5028f1['atimeout']=_0xc372bc;_0x5028f1['channel']=_0x37a5c4[_0x4ac4('0x14')];writeLog(_0x22ea45,_0x4994d9,util[_0x4ac4('0x9')](_0x4ac4('0x15'),_0xc372bc));_0x4f011f[_0x4ac4('0x16')][_0x22ea45]['on'](_0x4ac4('0x17'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x22ea45);clearTimeout(_0x194e55);_0x194e55=undefined;_0x5028f1[_0x4ac4('0x18')]();if(_0x4f011f[_0x4ac4('0x16')][_0x22ea45]){delete _0x4f011f[_0x4ac4('0x16')][_0x22ea45];}_0xdd68ec[_0x4ac4('0x19')]();});_0x4f011f[_0x4ac4('0x16')][_0x22ea45]['on'](_0x4ac4('0x1a'),function(){if(_0x4f011f[_0x4ac4('0x16')][_0x22ea45]){delete _0x4f011f[_0x4ac4('0x16')][_0x22ea45];}});_0x194e55=setTimeout(function(){logger[_0x4ac4('0x8')](_0x4ac4('0x1b'),_0x22ea45);clearTimeout(_0x194e55);_0x5028f1[_0x4ac4('0x18')]();_0xdd68ec[_0x4ac4('0x1c')]();},_0xc372bc);strategy[_0x4ac4('0x1d')](_0x5028f1,_0x4994d9,_0x4f011f,_0x37a5c4);}else{logger[_0x4ac4('0xd')](_0x4ac4('0x1e'),_0x22ea45,_0x4c17db['name']);_0xdd68ec[_0x4ac4('0x19')]();}}}catch(_0x15fb3e){console['log'](_0x15fb3e);logger['error'](_0x4ac4('0x1f'),_0x22ea45,_0x15fb3e[_0x4ac4('0x20')]);_0xdd68ec['stop']();}};}; \ No newline at end of file +var _0x6fe2=['name','consequence','length','error','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x6fe2,0x141));var _0x26fe=function(_0x34d28a,_0x338792){_0x34d28a=_0x34d28a-0x0;var _0x62a1a8=_0x6fe2[_0x34d28a];return _0x62a1a8;};'use strict';var schema=require(_0x26fe('0x0'));var _=require(_0x26fe('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x26fe('0x2'))(_0x26fe('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x26fe('0x4')},'timeout':{'type':'number','message':_0x26fe('0x5')}});function writeLog(_0x550629,_0x3e814c,_0x2683d0){return logger[_0x26fe('0x6')](util[_0x26fe('0x7')](_0x26fe('0x8'),_0x550629,_0x3e814c['name'],_0x2683d0));}function handleFindAgent(_0x4aab9e){return function(_0x48651d){return _0x48651d[_0x26fe('0x9')]['toLowerCase']()===_0x4aab9e['toLowerCase']();};}exports[_0x26fe('0xa')]=function(_0x48204d,_0x4424a1,_0xa088ed,_0x1db6f6){return function(_0x581f81){try{var _0x50eb51={'name':_0x4424a1[0x0],'timeout':_0x4424a1[0x1]};var _0x34c94b=queue['validate'](_0x50eb51,{'typecast':!![]});if(_0x34c94b[_0x26fe('0xb')]){logger[_0x26fe('0xc')]('[%s][AGENT]\x20%s',_0x48204d,_['map'](_0x34c94b,_0x26fe('0xd'))['join'](',\x20'));_0x581f81[_0x26fe('0xe')]();}else{var _0x399324=_[_0x26fe('0xf')](_0xa088ed[_0x26fe('0x10')],handleFindAgent(_0x50eb51['name']));if(_0x399324){var _0x1da8a5=(_0x50eb51[_0x26fe('0x11')]||0xa)*0x3e8;var _0x37f70f,_0x34c5f5;var _0x9ce65b=seqqueue[_0x26fe('0x12')](_0x1da8a5);_0x9ce65b['id']=_0x48204d;_0x9ce65b[_0x26fe('0x13')]=_0x1da8a5;_0x9ce65b[_0x26fe('0x14')]=_0x1db6f6[_0x26fe('0x14')];writeLog(_0x48204d,_0x399324,util[_0x26fe('0x7')](_0x26fe('0x15'),_0x1da8a5));_0xa088ed[_0x26fe('0x16')][_0x48204d]['on'](_0x26fe('0x17'),function(){logger[_0x26fe('0x6')](_0x26fe('0x18'),_0x48204d);clearTimeout(_0x34c5f5);_0x34c5f5=undefined;_0x9ce65b[_0x26fe('0x19')]();if(_0xa088ed[_0x26fe('0x16')][_0x48204d]){delete _0xa088ed[_0x26fe('0x16')][_0x48204d];}_0x581f81[_0x26fe('0xe')]();});_0xa088ed[_0x26fe('0x16')][_0x48204d]['on'](_0x26fe('0x1a'),function(){if(_0xa088ed[_0x26fe('0x16')][_0x48204d]){delete _0xa088ed['rules'][_0x48204d];}});_0x34c5f5=setTimeout(function(){logger[_0x26fe('0x6')]('[%s][AGENT]\x20ROUTING\x20END',_0x48204d);clearTimeout(_0x34c5f5);_0x9ce65b[_0x26fe('0x19')]();_0x581f81['next']();},_0x1da8a5);strategy['agent'](_0x9ce65b,_0x399324,_0xa088ed,_0x1db6f6);}else{logger[_0x26fe('0xc')](_0x26fe('0x1b'),_0x48204d,_0x50eb51[_0x26fe('0x9')]);_0x581f81[_0x26fe('0xe')]();}}}catch(_0x475e1a){console[_0x26fe('0x1c')](_0x475e1a);logger[_0x26fe('0xc')](_0x26fe('0x1d'),_0x48204d,_0x475e1a['stack']);_0x581f81[_0x26fe('0xe')]();}};}; \ 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 3c63d1a..9913441 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 _0x43e9=['AccountId','isEmpty','body','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','providerResponse','stringify','dialogState','Failed','next','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst'];(function(_0x3bd4ec,_0x4cb5ce){var _0x5062dc=function(_0x1e14a3){while(--_0x1e14a3){_0x3bd4ec['push'](_0x3bd4ec['shift']());}};_0x5062dc(++_0x4cb5ce);}(_0x43e9,0x126));var _0x943e=function(_0x5103ee,_0x56b8e2){_0x5103ee=_0x5103ee-0x0;var _0x347366=_0x43e9[_0x5103ee];return _0x347366;};'use strict';var _=require(_0x943e('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x943e('0x1'));var logger=require(_0x943e('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x943e('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x943e('0x4')),'whatsappMessage':require(_0x943e('0x5'))};exports['consequence']=function(_0x561352,_0x20561f){return function(_0x5448a5){try{if(!_[_0x943e('0x6')](this['interaction'][_0x943e('0x7')])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x561352,_0x943e('0x8'));return _0x5448a5['next']();}var _0x2ecb9b={'ContactId':this[_0x943e('0x9')]['id'],'sentAt':moment()['format'](_0x943e('0xa')),'direction':_0x943e('0xb')};if(this[_0x943e('0xc')]===_0x943e('0xd')||this[_0x943e('0xc')]===_0x943e('0xe')){_0x2ecb9b[_0x943e('0xf')]=this[_0x943e('0x10')][_0x943e('0xf')];}var _0xa94469=this[_0x943e('0xc')];if(_0xa94469===_0x943e('0x11')){_0x2ecb9b[_0x943e('0x12')]=this[_0x943e('0x13')]['id'];}else{_0x2ecb9b[_[_0x943e('0x14')](_0xa94469)+_0x943e('0x15')]=this[_0x943e('0x13')]['id'];}_0x2ecb9b[_['upperFirst'](_0xa94469)+'InteractionId']=this['interaction']['id'];if(this[_0x943e('0x10')]['created']){var _0x2dfea0=_0x20561f[0x4];if(!_[_0x943e('0x16')](_0x2dfea0)){_0x2ecb9b[_0x943e('0x17')]=utils[_0x943e('0x18')](_0x2dfea0,this);return rpc[_0xa94469+_0x943e('0x19')]['create'](_0x2ecb9b)[_0x943e('0x1a')](function(_0x28da00){logger['info'](_0x943e('0x1b'),_0x561352,_0x2ecb9b[_0x943e('0x17')]);})[_0x943e('0x1c')](function(_0x20f318){logger[_0x943e('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x561352,JSON['stringify'](_0x20f318));})['finally'](function(){logger[_0x943e('0x1e')](_0x943e('0x1f'),_0x561352);_0x5448a5[_0x943e('0x20')]();});}else{logger[_0x943e('0x1e')](_0x943e('0x21'),_0x561352);_0x5448a5[_0x943e('0x20')]();}}else{var _0x405181=this;var _0x4289a8=new AWS[(_0x943e('0x22'))]({'accessKeyId':_0x20561f[0x0],'secretAccessKey':_0x20561f[0x1],'region':_0x20561f[0x2]});var _0xb904c1={'botAlias':'$LATEST','botName':_0x20561f[0x3],'inputText':this[_0x943e('0x23')][_0x943e('0x17')],'userId':this[_0x943e('0xc')]+':'+this[_0x943e('0x10')]['id'][_0x943e('0x24')]()};_0x4289a8[_0x943e('0x25')](_0xb904c1,function(_0x5e91da,_0x3ba792){if(_0x5e91da){logger['error']('[%s][AMAZONLEX]\x20%s',_0x561352,_0x5e91da[_0x943e('0x23')]);_0x5448a5['next']();}else if(_0x3ba792&&_0x3ba792[_0x943e('0x23')]){_0x405181['body']['amazonlex']=_0x3ba792;_0x2ecb9b[_0x943e('0x17')]=_0x3ba792[_0x943e('0x23')];_0x2ecb9b[_0x943e('0x26')]=_0x943e('0x27');_0x2ecb9b[_0x943e('0x28')]=JSON[_0x943e('0x29')](_0x3ba792);return rpc[_0xa94469+'Message']['create'](_0x2ecb9b)[_0x943e('0x1a')](function(_0x514d2f){logger[_0x943e('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x561352,_0x2ecb9b[_0x943e('0x17')]);if(_0x3ba792[_0x943e('0x2a')]==_0x943e('0x2b')){_0x5448a5['next']();}else{_0x5448a5[_0x943e('0x20')]();}})[_0x943e('0x1c')](function(_0x43f2d7){logger[_0x943e('0x1d')](_0x943e('0x1b'),_0x561352,JSON[_0x943e('0x29')](_0x43f2d7));_0x5448a5[_0x943e('0x2c')]();});}else{_0x5448a5[_0x943e('0x2c')]();}});}}catch(_0x487fc0){logger[_0x943e('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x561352,JSON['stringify'](_0x487fc0));_0x5448a5[_0x943e('0x20')]();}};}; \ No newline at end of file +var _0x06fb=['phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','body','toString','postText','providerName','amazonlex','then','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp'];(function(_0x3568bf,_0x33c3ba){var _0xc93b4d=function(_0x14d1b5){while(--_0x14d1b5){_0x3568bf['push'](_0x3568bf['shift']());}};_0xc93b4d(++_0x33c3ba);}(_0x06fb,0x1b4));var _0xb06f=function(_0x2c55d1,_0x558f3d){_0x2c55d1=_0x2c55d1-0x0;var _0x5de2dd=_0x06fb[_0x2c55d1];return _0x5de2dd;};'use strict';var _=require(_0xb06f('0x0'));var moment=require(_0xb06f('0x1'));var AWS=require(_0xb06f('0x2'));var utils=require(_0xb06f('0x3'));var logger=require('../../../../config/logger')(_0xb06f('0x4'));var rpc={'chatMessage':require(_0xb06f('0x5')),'openchannelMessage':require(_0xb06f('0x6')),'mailMessage':require(_0xb06f('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb06f('0x8')),'whatsappMessage':require(_0xb06f('0x9'))};exports[_0xb06f('0xa')]=function(_0x124154,_0xd27a8){return function(_0x7059e){try{if(!_[_0xb06f('0xb')](this[_0xb06f('0xc')][_0xb06f('0xd')])){logger[_0xb06f('0xe')](_0xb06f('0xf'),_0x124154,_0xb06f('0x10'));return _0x7059e['next']();}var _0x255eaf={'ContactId':this[_0xb06f('0x11')]['id'],'sentAt':moment()[_0xb06f('0x12')](_0xb06f('0x13')),'direction':_0xb06f('0x14')};if(this[_0xb06f('0x15')]==='sms'||this[_0xb06f('0x15')]===_0xb06f('0x16')){_0x255eaf['phone']=this[_0xb06f('0xc')][_0xb06f('0x17')];}var _0x57de11=this['channel'];if(_0x57de11==='chat'){_0x255eaf[_0xb06f('0x18')]=this[_0xb06f('0x19')]['id'];}else{_0x255eaf[_[_0xb06f('0x1a')](_0x57de11)+_0xb06f('0x1b')]=this[_0xb06f('0x19')]['id'];}_0x255eaf[_[_0xb06f('0x1a')](_0x57de11)+_0xb06f('0x1c')]=this['interaction']['id'];if(this['interaction']['created']){var _0x471af5=_0xd27a8[0x4];if(!_[_0xb06f('0x1d')](_0x471af5)){_0x255eaf['body']=utils['getMustacheRender'](_0x471af5,this);return rpc[_0x57de11+_0xb06f('0x1e')][_0xb06f('0x1f')](_0x255eaf)['then'](function(_0x4d04ac){logger['info']('[%s][AMAZONLEX]\x20%s',_0x124154,_0x255eaf['body']);})[_0xb06f('0x20')](function(_0x208947){logger[_0xb06f('0x21')](_0xb06f('0xf'),_0x124154,JSON[_0xb06f('0x22')](_0x208947));})[_0xb06f('0x23')](function(){logger[_0xb06f('0xe')](_0xb06f('0x24'),_0x124154);_0x7059e[_0xb06f('0x25')]();});}else{logger[_0xb06f('0xe')](_0xb06f('0x26'),_0x124154);_0x7059e[_0xb06f('0x25')]();}}else{var _0x262808=this;var _0x1a37ca=new AWS[(_0xb06f('0x27'))]({'accessKeyId':_0xd27a8[0x0],'secretAccessKey':_0xd27a8[0x1],'region':_0xd27a8[0x2]});var _0x2001d4={'botAlias':_0xb06f('0x28'),'botName':_0xd27a8[0x3],'inputText':this[_0xb06f('0x29')][_0xb06f('0x2a')],'userId':this[_0xb06f('0x15')]+':'+this['interaction']['id'][_0xb06f('0x2b')]()};_0x1a37ca[_0xb06f('0x2c')](_0x2001d4,function(_0x20f4f0,_0x3f37eb){if(_0x20f4f0){logger['error'](_0xb06f('0xf'),_0x124154,_0x20f4f0[_0xb06f('0x29')]);_0x7059e['next']();}else if(_0x3f37eb&&_0x3f37eb[_0xb06f('0x29')]){_0x262808[_0xb06f('0x2a')]['amazonlex']=_0x3f37eb;_0x255eaf[_0xb06f('0x2a')]=_0x3f37eb['message'];_0x255eaf[_0xb06f('0x2d')]=_0xb06f('0x2e');_0x255eaf['providerResponse']=JSON['stringify'](_0x3f37eb);return rpc[_0x57de11+_0xb06f('0x1e')][_0xb06f('0x1f')](_0x255eaf)[_0xb06f('0x2f')](function(_0x32e923){logger[_0xb06f('0xe')](_0xb06f('0xf'),_0x124154,_0x255eaf[_0xb06f('0x2a')]);if(_0x3f37eb[_0xb06f('0x30')]==_0xb06f('0x31')){_0x7059e[_0xb06f('0x32')]();}else{_0x7059e['stop']();}})[_0xb06f('0x20')](function(_0x349c48){logger[_0xb06f('0x21')]('[%s][AMAZONLEX]\x20%s',_0x124154,JSON[_0xb06f('0x22')](_0x349c48));_0x7059e['next']();});}else{_0x7059e[_0xb06f('0x32')]();}});}}catch(_0x572308){logger['error']('[%s][AMAZONLEX]\x20%s',_0x124154,JSON[_0xb06f('0x22')](_0x572308));_0x7059e[_0xb06f('0x25')]();}};}; \ 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 539dd69..ba7f0f5 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 _0x3a1b=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Message','inReplyTo','messageId','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','finally','resolve','then','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','stop','moment'];(function(_0x36bf6b,_0x5dd433){var _0x20db61=function(_0x39267c){while(--_0x39267c){_0x36bf6b['push'](_0x36bf6b['shift']());}};_0x20db61(++_0x5dd433);}(_0x3a1b,0x158));var _0xb3a1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3a1b[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var moment=require(_0xb3a1('0x0'));var utils=require(_0xb3a1('0x1'));var logger=require(_0xb3a1('0x2'))(_0xb3a1('0x3'));var rpc={'chatMessage':require(_0xb3a1('0x4')),'openchannelMessage':require(_0xb3a1('0x5')),'mailMessage':require(_0xb3a1('0x6')),'smsMessage':require(_0xb3a1('0x7')),'faxMessage':require(_0xb3a1('0x8')),'whatsappMessage':require(_0xb3a1('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb3a1('0xa')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xb3a1('0xb')),'whatsappInteraction':require(_0xb3a1('0xc'))};var mailRpc=require(_0xb3a1('0xd'));exports[_0xb3a1('0xe')]=function(_0xd58c3b,_0x1ba00d,_0x5d66c5,_0x46b508){return function(_0x3a4ca9){try{var _0x3ab73f=this[_0xb3a1('0xf')];if(_0x3ab73f===_0xb3a1('0x10')&&_0x46b508[_0xb3a1('0x11')][_0xb3a1('0x12')]){logger[_0xb3a1('0x13')](_0xb3a1('0x14'),_0xd58c3b,_0xb3a1('0x15'));return _0x3a4ca9[_0xb3a1('0x16')]();}if(_0x1ba00d[0x0]==='1'&&(_[_0xb3a1('0x17')](this[_0xb3a1('0x18')]['created'])||!this[_0xb3a1('0x18')]['created'])){logger['info'](_0xb3a1('0x14'),_0xd58c3b,_0xb3a1('0x19'));return _0x3a4ca9[_0xb3a1('0x16')]();}if(_0x1ba00d[0x0]==='2'&&this[_0xb3a1('0x18')][_0xb3a1('0x1a')]){logger[_0xb3a1('0x13')](_0xb3a1('0x1b'),_0xd58c3b,_0xb3a1('0x1c'));return _0x3a4ca9['next']();}var _0x1307e9={'ContactId':this[_0xb3a1('0x1d')]['id'],'sentAt':moment()[_0xb3a1('0x1e')](_0xb3a1('0x1f')),'direction':'out'};if(this[_0xb3a1('0xf')]===_0xb3a1('0x10')){_0x1307e9[_0xb3a1('0x11')]=utils[_0xb3a1('0x20')](_0x1ba00d[0x2],this);}else{_0x1307e9['body']=utils['getMustacheRender'](_0x1ba00d[0x1],this);}if(this['message']){_0x1307e9['to']=this[_0xb3a1('0x21')][_0xb3a1('0x22')]||'';if(this['channel']===_0xb3a1('0x10')&&_0x1ba00d[0x1]==='1'){_0x1307e9['cc']=this['message']['cc']||'';}_0x1307e9[_0xb3a1('0x22')]=this['message']['to']||'';_0x1307e9[_0xb3a1('0x23')]=this[_0xb3a1('0x21')][_0xb3a1('0x23')]||'';_0x1307e9[_0xb3a1('0x24')]=!![];if(this[_0xb3a1('0x21')][_0xb3a1('0x25')]){_0x1307e9[_0xb3a1('0x25')]='';_0x1307e9[_0xb3a1('0x25')]+=_[_0xb3a1('0x26')](this['message']['subject'],'Re:')?'':_0xb3a1('0x27');_0x1307e9[_0xb3a1('0x25')]+=this[_0xb3a1('0x21')][_0xb3a1('0x25')];}}if(this['channel']===_0xb3a1('0x28')){_0x1307e9[_0xb3a1('0x29')]=this[_0xb3a1('0x2a')]['id'];}else{_0x1307e9[_['upperFirst'](this[_0xb3a1('0xf')])+_0xb3a1('0x2b')]=this['account']['id'];}_0x1307e9[_[_0xb3a1('0x2c')](this['channel'])+_0xb3a1('0x2d')]=this[_0xb3a1('0x18')]['id'];var _0x5873d3=this[_0xb3a1('0x18')];if(rpc[this['channel']+_0xb3a1('0x2e')]){if(this[_0xb3a1('0xf')]===_0xb3a1('0x10')){_0x1307e9[_0xb3a1('0x2f')]=this[_0xb3a1('0x21')][_0xb3a1('0x30')];_0x1307e9['html']=''+_['replace'](_0x1307e9[_0xb3a1('0x11')],_0xb3a1('0x31'),_0xb3a1('0x32'))+_0xb3a1('0x33');_0x1307e9[_0xb3a1('0x34')]={'Auto-Submitted':_0xb3a1('0x35'),'X-Auto-Response-Suppress':_0xb3a1('0x36'),'Precedence':_0xb3a1('0x37')};return mailRpc[_0xb3a1('0x38')](this['account'][_0xb3a1('0x39')],_0x1307e9)['then'](function(_0x2882c7){logger['info'](_0xb3a1('0x3a'),_0xd58c3b);_0x1307e9['messageId']=_0x2882c7[_0xb3a1('0x21')][_0xb3a1('0x30')];return rpc[_0x3ab73f+'Message'][_0xb3a1('0x3b')](_0x1307e9);})['then'](function(_0xb17f72){logger[_0xb3a1('0x13')](_0xb3a1('0x14'),_0xd58c3b,JSON[_0xb3a1('0x3c')](_0xb17f72));})[_0xb3a1('0x3d')](function(_0x53ed4e){logger[_0xb3a1('0x3e')]('[RPC][%s][AUTOREPLY]\x20%s',_0xd58c3b,JSON[_0xb3a1('0x3c')](_0x53ed4e));})[_0xb3a1('0x3f')](function(){Promise[_0xb3a1('0x40')]()[_0xb3a1('0x41')](function(){if(_0x1ba00d[0x0]!=='2'||_0x5873d3[_0xb3a1('0x1a')])return;return rpc[_0x3ab73f+'Interaction']['update'](_0x5873d3['id'],{'autoreplyExecuted':!![]})[_0xb3a1('0x41')](function(_0x3e50bb){logger[_0xb3a1('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xd58c3b,JSON[_0xb3a1('0x3c')](_0x3e50bb));})['catch'](function(_0x388c07){logger[_0xb3a1('0x3e')](_0xb3a1('0x42'),_0xd58c3b,JSON['stringify'](_0x388c07));});})[_0xb3a1('0x41')](function(){_0x3a4ca9[_0xb3a1('0x16')]();});});}else{return rpc[this[_0xb3a1('0xf')]+_0xb3a1('0x2e')]['create'](_0x1307e9)[_0xb3a1('0x41')](function(){logger[_0xb3a1('0x13')](_0xb3a1('0x14'),_0xd58c3b,_0x1307e9[_0xb3a1('0x11')]);})[_0xb3a1('0x3d')](function(_0x13448b){logger[_0xb3a1('0x3e')]('[%s][AUTOREPLY]\x20%s',_0xd58c3b,JSON['stringify'](_0x13448b));})[_0xb3a1('0x3f')](function(){Promise[_0xb3a1('0x40')]()[_0xb3a1('0x41')](function(){if(_0x1ba00d[0x0]!=='2'||_0x5873d3['autoreplyExecuted'])return;return rpc[_0x3ab73f+'Interaction'][_0xb3a1('0x43')](_0x5873d3['id'],{'autoreplyExecuted':!![]})[_0xb3a1('0x41')](function(_0x2c2cc2){logger[_0xb3a1('0x13')](_0xb3a1('0x1b'),_0xd58c3b,JSON[_0xb3a1('0x3c')](_0x2c2cc2));})[_0xb3a1('0x3d')](function(_0x3f726e){logger['error'](_0xb3a1('0x42'),_0xd58c3b,JSON['stringify'](_0x3f726e));});})['then'](function(){_0x3a4ca9['next']();});});}}}catch(_0x1e38ca){logger['error'](_0xb3a1('0x14'),_0xd58c3b,JSON[_0xb3a1('0x3c')](_0x1e38ca));_0x3a4ca9[_0xb3a1('0x44')]();}};}; \ No newline at end of file +var _0xfcd2=['subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','InteractionId','inReplyTo','','replace','';_0x2e7002['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x2fcd('0x32')};return mailRpc[_0x2fcd('0x33')](this['account'][_0x2fcd('0x34')],_0x2e7002)[_0x2fcd('0x35')](function(_0x24eafb){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x37ad55);_0x2e7002[_0x2fcd('0x36')]=_0x24eafb[_0x2fcd('0x22')][_0x2fcd('0x36')];return rpc[_0x25f964+_0x2fcd('0x37')][_0x2fcd('0x38')](_0x2e7002);})[_0x2fcd('0x35')](function(_0x134b2b){logger[_0x2fcd('0x14')](_0x2fcd('0x15'),_0x37ad55,JSON['stringify'](_0x134b2b));})[_0x2fcd('0x39')](function(_0x52a799){logger['error'](_0x2fcd('0x3a'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x52a799));})[_0x2fcd('0x3c')](function(){Promise['resolve']()['then'](function(){if(_0x4cfae7[0x0]!=='2'||_0x4a35cc[_0x2fcd('0x1b')])return;return rpc[_0x25f964+'Interaction'][_0x2fcd('0x3d')](_0x4a35cc['id'],{'autoreplyExecuted':!![]})[_0x2fcd('0x35')](function(_0x54e483){logger[_0x2fcd('0x14')](_0x2fcd('0x1c'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x54e483));})['catch'](function(_0x43be2f){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x43be2f));});})[_0x2fcd('0x35')](function(){_0x20d6f1[_0x2fcd('0x16')]();});});}else{return rpc[this[_0x2fcd('0x10')]+_0x2fcd('0x37')][_0x2fcd('0x38')](_0x2e7002)[_0x2fcd('0x35')](function(){logger[_0x2fcd('0x14')]('[%s][AUTOREPLY]\x20%s',_0x37ad55,_0x2e7002[_0x2fcd('0x12')]);})['catch'](function(_0x1d74de){logger[_0x2fcd('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x1d74de));})['finally'](function(){Promise['resolve']()[_0x2fcd('0x35')](function(){if(_0x4cfae7[0x0]!=='2'||_0x4a35cc[_0x2fcd('0x1b')])return;return rpc[_0x25f964+_0x2fcd('0x3f')][_0x2fcd('0x3d')](_0x4a35cc['id'],{'autoreplyExecuted':!![]})[_0x2fcd('0x35')](function(_0x2aa699){logger['info'](_0x2fcd('0x1c'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x2aa699));})[_0x2fcd('0x39')](function(_0x3dc0b8){logger['error'](_0x2fcd('0x40'),_0x37ad55,JSON[_0x2fcd('0x3b')](_0x3dc0b8));});})[_0x2fcd('0x35')](function(){_0x20d6f1[_0x2fcd('0x16')]();});});}}}catch(_0x3c38f5){logger['error']('[%s][AUTOREPLY]\x20%s',_0x37ad55,JSON[_0x2fcd('0x3b')](_0x3c38f5));_0x20d6f1[_0x2fcd('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index e5e4ff9..e5288c4 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x946b=['[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info'];(function(_0xf2cbf2,_0x1b5910){var _0x1e3dfc=function(_0x14006a){while(--_0x14006a){_0xf2cbf2['push'](_0xf2cbf2['shift']());}};_0x1e3dfc(++_0x1b5910);}(_0x946b,0x139));var _0xb946=function(_0x260175,_0x11c5e4){_0x260175=_0x260175-0x0;var _0x12bf17=_0x946b[_0x260175];return _0x12bf17;};'use strict';var moment=require(_0xb946('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb946('0x1')),'mailInteraction':require(_0xb946('0x2')),'faxInteraction':require(_0xb946('0x3')),'whatsappInteraction':require(_0xb946('0x4'))};exports[_0xb946('0x5')]=function(_0x2f271c,_0x2c164b,_0x43c784,_0x134e0a){return function(_0x201c75){try{logger[_0xb946('0x6')](_0xb946('0x7'),_0x2f271c,_0x2c164b[0x0]);var _0x3d2065={'closed':0x1,'closedAt':moment()[_0xb946('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xb946('0x9'),'disposition':_0x2c164b[0x0]};if(rpc[_0x134e0a[_0xb946('0xa')]+_0xb946('0xb')]){rpc[_0x134e0a[_0xb946('0xa')]+_0xb946('0xb')]['update'](_0x134e0a[_0xb946('0xc')]['id'],_0x3d2065)[_0xb946('0xd')](function(_0x28a665){logger[_0xb946('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2f271c,_0x134e0a['interaction']['id']);})[_0xb946('0xe')](function(_0x4b4b2d){logger[_0xb946('0xf')](_0xb946('0x10'),_0x2f271c,JSON[_0xb946('0x11')](_0x4b4b2d));})[_0xb946('0x12')](function(){_0x201c75[_0xb946('0x13')]();});}}catch(_0x1a8021){logger['error'](_0xb946('0x10'),_0x2f271c,JSON[_0xb946('0x11')](_0x1a8021));_0x201c75[_0xb946('0x13')]();}};}; \ No newline at end of file +var _0x07a7=['../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x3cbfc8,_0x308899){var _0x5e28c6=function(_0x29dabc){while(--_0x29dabc){_0x3cbfc8['push'](_0x3cbfc8['shift']());}};_0x5e28c6(++_0x308899);}(_0x07a7,0x1db));var _0x707a=function(_0x32ab60,_0x22a4de){_0x32ab60=_0x32ab60-0x0;var _0x2613a3=_0x07a7[_0x32ab60];return _0x2613a3;};'use strict';var moment=require(_0x707a('0x0'));var logger=require(_0x707a('0x1'))('routing');var rpc={'chatInteraction':require(_0x707a('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x707a('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x707a('0x4')),'whatsappInteraction':require(_0x707a('0x5'))};exports[_0x707a('0x6')]=function(_0x285cb1,_0xb0172f,_0x5d96ab,_0x4313c1){return function(_0x354df6){try{logger[_0x707a('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0x285cb1,_0xb0172f[0x0]);var _0x24a9f6={'closed':0x1,'closedAt':moment()[_0x707a('0x8')](_0x707a('0x9')),'closeReason':'system','disposition':_0xb0172f[0x0]};if(rpc[_0x4313c1[_0x707a('0xa')]+_0x707a('0xb')]){rpc[_0x4313c1['channel']+_0x707a('0xb')][_0x707a('0xc')](_0x4313c1[_0x707a('0xd')]['id'],_0x24a9f6)['then'](function(_0x24e3c8){logger[_0x707a('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x285cb1,_0x4313c1['interaction']['id']);})[_0x707a('0xe')](function(_0x220597){logger['error'](_0x707a('0xf'),_0x285cb1,JSON[_0x707a('0x10')](_0x220597));})[_0x707a('0x11')](function(){_0x354df6[_0x707a('0x12')]();});}}catch(_0x553884){logger[_0x707a('0x13')]('[%s][CLOSE]\x20%s',_0x285cb1,JSON[_0x707a('0x10')](_0x553884));_0x354df6[_0x707a('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 5718746..b46d9c9 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2484=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result','speech','providerName','providerResponse','metadata','endConversation','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x1d1498,_0x1f8ca6){var _0x11109a=function(_0x143ca8){while(--_0x143ca8){_0x1d1498['push'](_0x1d1498['shift']());}};_0x11109a(++_0x1f8ca6);}(_0x2484,0x178));var _0x4248=function(_0x3a4061,_0x57aa2a){_0x3a4061=_0x3a4061-0x0;var _0x51814c=_0x2484[_0x3a4061];return _0x51814c;};'use strict';var _=require(_0x4248('0x0'));var moment=require(_0x4248('0x1'));var apiai=require('apiai-promise');var md5=require(_0x4248('0x2'));var utils=require(_0x4248('0x3'));var logger=require(_0x4248('0x4'))(_0x4248('0x5'));var rpc={'chatMessage':require(_0x4248('0x6')),'openchannelMessage':require(_0x4248('0x7')),'mailMessage':require(_0x4248('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4248('0x9')),'whatsappMessage':require(_0x4248('0xa'))};exports[_0x4248('0xb')]=function(_0x189f42,_0x412c18){return function(_0x14500e){try{if(!_['isNil'](this[_0x4248('0xc')][_0x4248('0xd')])){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x4248('0x10'));return _0x14500e[_0x4248('0x11')]();}var _0x13cb06={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4248('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x4248('0x13')};if(this[_0x4248('0x14')]===_0x4248('0x15')||this['channel']==='whatsapp'){_0x13cb06[_0x4248('0x16')]=this['interaction'][_0x4248('0x16')];}var _0xf4efc8=this[_0x4248('0x14')];if(_0xf4efc8===_0x4248('0x17')){_0x13cb06[_0x4248('0x18')]=this['account']['id'];}else{_0x13cb06[_[_0x4248('0x19')](_0xf4efc8)+_0x4248('0x1a')]=this[_0x4248('0x1b')]['id'];}_0x13cb06[_[_0x4248('0x19')](_0xf4efc8)+_0x4248('0x1c')]=this['interaction']['id'];if(this[_0x4248('0xc')][_0x4248('0x1d')]){var _0x3283f2=_0x412c18[0x2];if(!_[_0x4248('0x1e')](_0x3283f2)){_0x13cb06[_0x4248('0x1f')]=utils[_0x4248('0x20')](_0x3283f2,this);return rpc[_0xf4efc8+_0x4248('0x21')][_0x4248('0x22')](_0x13cb06)[_0x4248('0x23')](function(_0xd03b87){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x13cb06[_0x4248('0x1f')]);})[_0x4248('0x24')](function(_0x1d8821){logger[_0x4248('0x25')](_0x4248('0xf'),_0x189f42,JSON[_0x4248('0x26')](_0x1d8821));})['finally'](function(){logger[_0x4248('0xe')](_0x4248('0x27'),_0x189f42);_0x14500e[_0x4248('0x28')]();});}else{logger[_0x4248('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x189f42);_0x14500e[_0x4248('0x28')]();}}else{var _0x37b1b3=this;var _0x30b232=apiai(_0x412c18[0x0],{'language':_0x412c18[0x1]||'en'});return _0x30b232['textRequest'](this[_0x4248('0x29')][_0x4248('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0x4248('0x23')](function(_0x598681){_0x37b1b3[_0x4248('0x1f')][_0x4248('0x2a')]=_0x598681;_0x13cb06[_0x4248('0x1f')]=_0x598681[_0x4248('0x2b')]['fulfillment'][_0x4248('0x2c')];_0x13cb06[_0x4248('0x2d')]=_0x4248('0x2a');_0x13cb06[_0x4248('0x2e')]=JSON[_0x4248('0x26')](_0x598681);return rpc[_0xf4efc8+_0x4248('0x21')][_0x4248('0x22')](_0x13cb06)[_0x4248('0x23')](function(_0x74b7e0){logger[_0x4248('0xe')](_0x4248('0xf'),_0x189f42,_0x13cb06[_0x4248('0x1f')]);if(_0x598681[_0x4248('0x2b')][_0x4248('0x2f')][_0x4248('0x30')]){_0x14500e[_0x4248('0x11')]();}else{_0x14500e['stop']();}})[_0x4248('0x24')](function(_0x40ca90){logger[_0x4248('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x189f42,JSON[_0x4248('0x26')](_0x40ca90));_0x14500e[_0x4248('0x11')]();});})[_0x4248('0x24')](function(_0x45dd44){logger[_0x4248('0x25')](_0x4248('0xf'),_0x189f42,_0x45dd44[_0x4248('0x29')]);_0x14500e['next']();});}}catch(_0x5d665d){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x189f42,JSON['stringify'](_0x5d665d));_0x14500e['stop']();}};}; \ No newline at end of file +var _0x905a=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','sms','channel','interaction','phone','chat','ChatWebsiteId','upperFirst','account','created','isEmpty','body','getMustacheRender','Message','create','then','info','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','dialogflow','providerResponse','metadata','endConversation','next','catch','lodash','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x905a,0xeb));var _0xa905=function(_0x3c94a8,_0x644951){_0x3c94a8=_0x3c94a8-0x0;var _0x4d877f=_0x905a[_0x3c94a8];return _0x4d877f;};'use strict';var _=require(_0xa905('0x0'));var moment=require('moment');var apiai=require(_0xa905('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0xa905('0x2'))(_0xa905('0x3'));var rpc={'chatMessage':require(_0xa905('0x4')),'openchannelMessage':require(_0xa905('0x5')),'mailMessage':require(_0xa905('0x6')),'smsMessage':require(_0xa905('0x7')),'faxMessage':require(_0xa905('0x8')),'whatsappMessage':require(_0xa905('0x9'))};exports[_0xa905('0xa')]=function(_0x3a0072,_0x18c72e){return function(_0x16ac5b){try{if(!_[_0xa905('0xb')](this['interaction'][_0xa905('0xc')])){logger['info'](_0xa905('0xd'),_0x3a0072,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x16ac5b['next']();}var _0x34922c={'ContactId':this[_0xa905('0xe')]['id'],'sentAt':moment()['format'](_0xa905('0xf')),'direction':'out'};if(this['channel']===_0xa905('0x10')||this[_0xa905('0x11')]==='whatsapp'){_0x34922c['phone']=this[_0xa905('0x12')][_0xa905('0x13')];}var _0x509c0a=this[_0xa905('0x11')];if(_0x509c0a===_0xa905('0x14')){_0x34922c[_0xa905('0x15')]=this['account']['id'];}else{_0x34922c[_[_0xa905('0x16')](_0x509c0a)+'AccountId']=this[_0xa905('0x17')]['id'];}_0x34922c[_[_0xa905('0x16')](_0x509c0a)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xa905('0x18')]){var _0x15a4df=_0x18c72e[0x2];if(!_[_0xa905('0x19')](_0x15a4df)){_0x34922c[_0xa905('0x1a')]=utils[_0xa905('0x1b')](_0x15a4df,this);return rpc[_0x509c0a+_0xa905('0x1c')][_0xa905('0x1d')](_0x34922c)[_0xa905('0x1e')](function(_0xa59b33){logger[_0xa905('0x1f')](_0xa905('0xd'),_0x3a0072,_0x34922c[_0xa905('0x1a')]);})['catch'](function(_0x334433){logger[_0xa905('0x20')](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x334433));})[_0xa905('0x22')](function(){logger[_0xa905('0x1f')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a0072);_0x16ac5b[_0xa905('0x23')]();});}else{logger[_0xa905('0x1f')](_0xa905('0x24'),_0x3a0072);_0x16ac5b[_0xa905('0x23')]();}}else{var _0x5c4b50=this;var _0x1da420=apiai(_0x18c72e[0x0],{'language':_0x18c72e[0x1]||'en'});return _0x1da420[_0xa905('0x25')](this[_0xa905('0x26')][_0xa905('0x1a')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x23fb4e){_0x5c4b50[_0xa905('0x1a')]['dialogflow']=_0x23fb4e;_0x34922c[_0xa905('0x1a')]=_0x23fb4e[_0xa905('0x27')][_0xa905('0x28')][_0xa905('0x29')];_0x34922c['providerName']=_0xa905('0x2a');_0x34922c[_0xa905('0x2b')]=JSON['stringify'](_0x23fb4e);return rpc[_0x509c0a+_0xa905('0x1c')][_0xa905('0x1d')](_0x34922c)[_0xa905('0x1e')](function(_0x2ff254){logger[_0xa905('0x1f')](_0xa905('0xd'),_0x3a0072,_0x34922c[_0xa905('0x1a')]);if(_0x23fb4e['result'][_0xa905('0x2c')][_0xa905('0x2d')]){_0x16ac5b[_0xa905('0x2e')]();}else{_0x16ac5b[_0xa905('0x23')]();}})[_0xa905('0x2f')](function(_0x5d99eb){logger['error'](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x5d99eb));_0x16ac5b[_0xa905('0x2e')]();});})[_0xa905('0x2f')](function(_0x4f0e23){logger[_0xa905('0x20')](_0xa905('0xd'),_0x3a0072,_0x4f0e23[_0xa905('0x26')]);_0x16ac5b[_0xa905('0x2e')]();});}}catch(_0x2cc596){logger['error'](_0xa905('0xd'),_0x3a0072,JSON[_0xa905('0x21')](_0x2cc596));_0x16ac5b[_0xa905('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 801b663..eae7c3f 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdffd=['push','all','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0xdffd,0xd7));var _0xddff=function(_0x1d8ae1,_0x1f30c9){_0x1d8ae1=_0x1d8ae1-0x0;var _0x22166e=_0xdffd[_0x1d8ae1];return _0x22166e;};'use strict';var _=require(_0xddff('0x0'));var dialogflow=require(_0xddff('0x1'));var md5=require(_0xddff('0x2'));var moment=require('moment');var Promise=require(_0xddff('0x3'));var logger=require(_0xddff('0x4'))(_0xddff('0x5'));var utils=require(_0xddff('0x6'));var rpc={'chatMessage':require(_0xddff('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xddff('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xddff('0x9')),'whatsappMessage':require(_0xddff('0xa'))};function createMessage(_0x56a36,_0x48c423,_0x1e6e53,_0x4ca4ce){return new Promise(function(_0x499221,_0x344572){var _0x24a67d=_[_0xddff('0xb')](_0x1e6e53);_0x24a67d[_0xddff('0xc')]=_0x4ca4ce;return rpc[_0x48c423+_0xddff('0xd')][_0xddff('0xe')](_0x24a67d)[_0xddff('0xf')](function(){logger[_0xddff('0x10')](_0xddff('0x11'),_0x56a36,_0x24a67d[_0xddff('0xc')]);_0x499221();})[_0xddff('0x12')](function(_0x43a901){logger[_0xddff('0x13')](_0xddff('0x11'),_0x56a36,JSON[_0xddff('0x14')](_0x43a901));_0x344572(_0x43a901);});});}exports[_0xddff('0x15')]=function(_0x18ec5e,_0x48495a){return function(_0x31212f){try{if(!_['isNil'](this[_0xddff('0x16')][_0xddff('0x17')])){logger[_0xddff('0x10')](_0xddff('0x11'),_0x18ec5e,_0xddff('0x18'));return _0x31212f[_0xddff('0x19')]();}var _0x4fdb14={'ContactId':this[_0xddff('0x1a')]['id'],'sentAt':moment()[_0xddff('0x1b')](_0xddff('0x1c')),'direction':_0xddff('0x1d')};if(this['channel']==='sms'||this[_0xddff('0x1e')]==='whatsapp'){_0x4fdb14[_0xddff('0x1f')]=this[_0xddff('0x16')][_0xddff('0x1f')];}var _0x2c973b=this[_0xddff('0x1e')];if(_0x2c973b===_0xddff('0x20')){_0x4fdb14[_0xddff('0x21')]=this[_0xddff('0x22')]['id'];}else{_0x4fdb14[_[_0xddff('0x23')](_0x2c973b)+_0xddff('0x24')]=this[_0xddff('0x22')]['id'];}_0x4fdb14[_[_0xddff('0x23')](_0x2c973b)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0xddff('0x25')]){var _0x51aa7b=_0x48495a[0x4];if(!_[_0xddff('0x26')](_0x51aa7b)){_0x4fdb14[_0xddff('0xc')]=utils[_0xddff('0x27')](_0x51aa7b,this);return rpc[_0x2c973b+'Message'][_0xddff('0xe')](_0x4fdb14)[_0xddff('0xf')](function(_0x206fba){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x18ec5e,_0x4fdb14[_0xddff('0xc')]);})[_0xddff('0x12')](function(_0x465670){logger[_0xddff('0x13')](_0xddff('0x11'),_0x18ec5e,JSON['stringify'](_0x465670));})[_0xddff('0x28')](function(){logger[_0xddff('0x10')](_0xddff('0x29'),_0x18ec5e);_0x31212f[_0xddff('0x2a')]();});}else{logger[_0xddff('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18ec5e);_0x31212f['stop']();}}else{var _0x5f2499=this;var _0x248d24=_0x48495a[0x2][_0xddff('0x2b')](/\\n/g,'\x0a');var _0x49f6a9={'credentials':{'private_key':_0x248d24,'client_email':_0x48495a[0x1]}};var _0x9f12d8=new dialogflow[(_0xddff('0x2c'))](_0x49f6a9);var _0x3760ab=_0x9f12d8['sessionPath'](_0x48495a[0x0],md5(_0x5f2499[_0xddff('0x16')]['id']));var _0x3ff651={'session':_0x3760ab,'queryInput':{'text':{'text':_0x5f2499[_0xddff('0x2d')][_0xddff('0xc')],'languageCode':_0x48495a[0x3]||'en'}}};return _0x9f12d8[_0xddff('0x2e')](_0x3ff651)[_0xddff('0xf')](function(_0x328272){if(_0x328272&&_0x328272[_0xddff('0x2f')]){_0x5f2499[_0xddff('0xc')][_0xddff('0x30')]=_0x328272;var _0x28b626=_0x328272[0x0];var _0x3f0a1e=_0x28b626['queryResult']['diagnosticInfo']&&_0x28b626[_0xddff('0x31')][_0xddff('0x32')][_0xddff('0x33')]?_0x28b626[_0xddff('0x31')][_0xddff('0x32')][_0xddff('0x33')][_0xddff('0x34')][_0xddff('0x35')]:![];_0x5f2499[_0xddff('0xc')][_0xddff('0x36')]=_0x28b626[_0xddff('0x31')][_0xddff('0x37')];_0x5f2499['body'][_0xddff('0x38')]=_0x28b626[_0xddff('0x31')]['allRequiredParamsPresent'];_0x5f2499[_0xddff('0xc')][_0xddff('0x39')]=_0x28b626[_0xddff('0x31')][_0xddff('0x32')]&&_0x28b626['queryResult'][_0xddff('0x32')][_0xddff('0x33')]?_0x28b626[_0xddff('0x31')][_0xddff('0x32')][_0xddff('0x33')][_0xddff('0x34')]['boolValue']:![];_0x5f2499[_0xddff('0xc')]['DIALOGFLOWV2_INTENTNAME']=_0x28b626[_0xddff('0x31')][_0xddff('0x3a')]['name'];_0x5f2499[_0xddff('0xc')][_0xddff('0x3b')]=_0x28b626['queryResult'][_0xddff('0x3a')]['displayName'];_0x5f2499['body'][_0xddff('0x3c')]=_0x28b626[_0xddff('0x31')][_0xddff('0x3a')]['isFallback'];_0x5f2499[_0xddff('0xc')][_0xddff('0x3d')]=_0x28b626['queryResult'][_0xddff('0x3e')];_0x5f2499[_0xddff('0xc')][_0xddff('0x3f')]=_0x28b626[_0xddff('0x31')][_0xddff('0x40')];_0x5f2499['body'][_0xddff('0x41')]=_0x28b626['queryResult'][_0xddff('0x42')];_0x4fdb14['providerName']='dialogflowV2';_0x4fdb14[_0xddff('0x43')]=JSON[_0xddff('0x14')](_0x328272);var _0x52adc8=[];for(var _0x35150d=0x0;_0x35150d<_0x328272[_0xddff('0x2f')];_0x35150d++){var _0x36433b=_0x328272[_0x35150d];if(_0x36433b&&_0x36433b[_0xddff('0x31')]&&_0x36433b['queryResult'][_0xddff('0x44')]){_0x52adc8[_0xddff('0x45')](createMessage(_0x18ec5e,_0x2c973b,_0x4fdb14,_0x36433b[_0xddff('0x31')][_0xddff('0x44')]));}}return Promise[_0xddff('0x46')](_0x52adc8)[_0xddff('0xf')](function(){if(_0x3f0a1e){_0x31212f[_0xddff('0x19')]();}else{_0x31212f['stop']();}})[_0xddff('0x12')](function(_0x225eaf){logger[_0xddff('0x13')](_0xddff('0x11'),_0x18ec5e,JSON['stringify'](_0x225eaf));_0x31212f[_0xddff('0x19')]();});}})[_0xddff('0x12')](function(_0x415b18){logger[_0xddff('0x13')](_0xddff('0x11'),_0x18ec5e,_0x415b18[_0xddff('0x2d')]);_0x31212f['next']();});}}catch(_0x22b40c){logger[_0xddff('0x13')](_0xddff('0x11'),_0x18ec5e,JSON[_0xddff('0x14')](_0x22b40c));_0x31212f[_0xddff('0x2a')]();}};}; \ No newline at end of file +var _0x8bea=['message','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','providerResponse','fulfillmentText','push','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath'];(function(_0x57e901,_0x1a2de2){var _0x463f38=function(_0x3d0d2e){while(--_0x3d0d2e){_0x57e901['push'](_0x57e901['shift']());}};_0x463f38(++_0x1a2de2);}(_0x8bea,0xfc));var _0xa8be=function(_0x1e2393,_0x5e51f1){_0x1e2393=_0x1e2393-0x0;var _0x451f52=_0x8bea[_0x1e2393];return _0x451f52;};'use strict';var _=require(_0xa8be('0x0'));var dialogflow=require(_0xa8be('0x1'));var md5=require(_0xa8be('0x2'));var moment=require(_0xa8be('0x3'));var Promise=require(_0xa8be('0x4'));var logger=require(_0xa8be('0x5'))('routing');var utils=require(_0xa8be('0x6'));var rpc={'chatMessage':require(_0xa8be('0x7')),'openchannelMessage':require(_0xa8be('0x8')),'mailMessage':require(_0xa8be('0x9')),'smsMessage':require(_0xa8be('0xa')),'faxMessage':require(_0xa8be('0xb')),'whatsappMessage':require(_0xa8be('0xc'))};function createMessage(_0x200872,_0x4066a2,_0x5e726d,_0x20b355){return new Promise(function(_0x28363e,_0x4e1001){var _0x1c4b09=_[_0xa8be('0xd')](_0x5e726d);_0x1c4b09['body']=_0x20b355;return rpc[_0x4066a2+_0xa8be('0xe')][_0xa8be('0xf')](_0x1c4b09)[_0xa8be('0x10')](function(){logger[_0xa8be('0x11')](_0xa8be('0x12'),_0x200872,_0x1c4b09[_0xa8be('0x13')]);_0x28363e();})[_0xa8be('0x14')](function(_0x54fa96){logger[_0xa8be('0x15')](_0xa8be('0x12'),_0x200872,JSON[_0xa8be('0x16')](_0x54fa96));_0x4e1001(_0x54fa96);});});}exports[_0xa8be('0x17')]=function(_0x375210,_0x373c85){return function(_0x5cdc84){try{if(!_['isNil'](this[_0xa8be('0x18')][_0xa8be('0x19')])){logger[_0xa8be('0x11')](_0xa8be('0x12'),_0x375210,_0xa8be('0x1a'));return _0x5cdc84[_0xa8be('0x1b')]();}var _0x288c14={'ContactId':this[_0xa8be('0x1c')]['id'],'sentAt':moment()[_0xa8be('0x1d')](_0xa8be('0x1e')),'direction':_0xa8be('0x1f')};if(this[_0xa8be('0x20')]==='sms'||this[_0xa8be('0x20')]==='whatsapp'){_0x288c14[_0xa8be('0x21')]=this['interaction'][_0xa8be('0x21')];}var _0x153611=this['channel'];if(_0x153611==='chat'){_0x288c14[_0xa8be('0x22')]=this[_0xa8be('0x23')]['id'];}else{_0x288c14[_[_0xa8be('0x24')](_0x153611)+_0xa8be('0x25')]=this['account']['id'];}_0x288c14[_[_0xa8be('0x24')](_0x153611)+_0xa8be('0x26')]=this[_0xa8be('0x18')]['id'];if(this[_0xa8be('0x18')][_0xa8be('0x27')]){var _0x45e324=_0x373c85[0x4];if(!_[_0xa8be('0x28')](_0x45e324)){_0x288c14[_0xa8be('0x13')]=utils['getMustacheRender'](_0x45e324,this);return rpc[_0x153611+'Message'][_0xa8be('0xf')](_0x288c14)[_0xa8be('0x10')](function(_0x22460e){logger['info'](_0xa8be('0x12'),_0x375210,_0x288c14[_0xa8be('0x13')]);})[_0xa8be('0x14')](function(_0x3e05d0){logger[_0xa8be('0x15')](_0xa8be('0x12'),_0x375210,JSON[_0xa8be('0x16')](_0x3e05d0));})[_0xa8be('0x29')](function(){logger[_0xa8be('0x11')](_0xa8be('0x2a'),_0x375210);_0x5cdc84[_0xa8be('0x2b')]();});}else{logger['info'](_0xa8be('0x2c'),_0x375210);_0x5cdc84[_0xa8be('0x2b')]();}}else{var _0x310336=this;var _0x1ade40=_0x373c85[0x2][_0xa8be('0x2d')](/\\n/g,'\x0a');var _0x14d2dd={'credentials':{'private_key':_0x1ade40,'client_email':_0x373c85[0x1]}};var _0x34b60e=new dialogflow[(_0xa8be('0x2e'))](_0x14d2dd);var _0x5b62c5=_0x34b60e[_0xa8be('0x2f')](_0x373c85[0x0],md5(_0x310336[_0xa8be('0x18')]['id']));var _0x30a64b={'session':_0x5b62c5,'queryInput':{'text':{'text':_0x310336[_0xa8be('0x30')][_0xa8be('0x13')],'languageCode':_0x373c85[0x3]||'en'}}};return _0x34b60e[_0xa8be('0x31')](_0x30a64b)[_0xa8be('0x10')](function(_0x451847){if(_0x451847&&_0x451847[_0xa8be('0x32')]){_0x310336[_0xa8be('0x13')]['dialogflowV2']=_0x451847;var _0x104561=_0x451847[0x0];var _0x4b39a6=_0x104561[_0xa8be('0x33')][_0xa8be('0x34')]&&_0x104561[_0xa8be('0x33')][_0xa8be('0x34')]['fields']?_0x104561[_0xa8be('0x33')][_0xa8be('0x34')][_0xa8be('0x35')][_0xa8be('0x36')]['boolValue']:![];_0x310336[_0xa8be('0x13')][_0xa8be('0x37')]=_0x104561['queryResult'][_0xa8be('0x38')];_0x310336[_0xa8be('0x13')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x104561['queryResult'][_0xa8be('0x39')];_0x310336['body'][_0xa8be('0x3a')]=_0x104561['queryResult']['diagnosticInfo']&&_0x104561[_0xa8be('0x33')]['diagnosticInfo'][_0xa8be('0x35')]?_0x104561['queryResult'][_0xa8be('0x34')][_0xa8be('0x35')][_0xa8be('0x36')][_0xa8be('0x3b')]:![];_0x310336[_0xa8be('0x13')][_0xa8be('0x3c')]=_0x104561['queryResult'][_0xa8be('0x3d')][_0xa8be('0x3e')];_0x310336['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x104561['queryResult'][_0xa8be('0x3d')][_0xa8be('0x3f')];_0x310336[_0xa8be('0x13')][_0xa8be('0x40')]=_0x104561[_0xa8be('0x33')][_0xa8be('0x3d')][_0xa8be('0x41')];_0x310336['body'][_0xa8be('0x42')]=_0x104561[_0xa8be('0x33')][_0xa8be('0x43')];_0x310336['body']['DIALOGFLOWV2_QUERYTEXT']=_0x104561[_0xa8be('0x33')][_0xa8be('0x44')];_0x310336['body'][_0xa8be('0x45')]=_0x104561[_0xa8be('0x33')]['intentDetectionConfidence'];_0x288c14[_0xa8be('0x46')]=_0xa8be('0x47');_0x288c14[_0xa8be('0x48')]=JSON['stringify'](_0x451847);var _0xcc0544=[];for(var _0x29bb3=0x0;_0x29bb3<_0x451847[_0xa8be('0x32')];_0x29bb3++){var _0x133e54=_0x451847[_0x29bb3];if(_0x133e54&&_0x133e54['queryResult']&&_0x133e54[_0xa8be('0x33')][_0xa8be('0x49')]){_0xcc0544[_0xa8be('0x4a')](createMessage(_0x375210,_0x153611,_0x288c14,_0x133e54['queryResult'][_0xa8be('0x49')]));}}return Promise['all'](_0xcc0544)[_0xa8be('0x10')](function(){if(_0x4b39a6){_0x5cdc84[_0xa8be('0x1b')]();}else{_0x5cdc84[_0xa8be('0x2b')]();}})[_0xa8be('0x14')](function(_0x188499){logger[_0xa8be('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x375210,JSON['stringify'](_0x188499));_0x5cdc84[_0xa8be('0x1b')]();});}})[_0xa8be('0x14')](function(_0x1ff7bb){logger['error'](_0xa8be('0x12'),_0x375210,_0x1ff7bb[_0xa8be('0x30')]);_0x5cdc84[_0xa8be('0x1b')]();});}}catch(_0xd092f){logger[_0xa8be('0x15')]('[%s][DIALOGFLOWV2]\x20%s',_0x375210,JSON[_0xa8be('0x16')](_0xd092f));_0x5cdc84[_0xa8be('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index f2835ed..17da2d2 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ee1=['../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','[%s][GOTOIF]\x20%s','map','message','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils'];(function(_0x1c15d5,_0x3d52e6){var _0x1bad2c=function(_0x22bd4f){while(--_0x22bd4f){_0x1c15d5['push'](_0x1c15d5['shift']());}};_0x1bad2c(++_0x3d52e6);}(_0x5ee1,0x175));var _0x15ee=function(_0x3302bb,_0x11c44a){_0x3302bb=_0x3302bb-0x0;var _0x360c64=_0x5ee1[_0x3302bb];return _0x360c64;};'use strict';var schema=require(_0x15ee('0x0'));var _=require(_0x15ee('0x1'));var htmlToText=require(_0x15ee('0x2'));var utils=require(_0x15ee('0x3'));var logger=require(_0x15ee('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x15ee('0x5'),'required':!![],'message':_0x15ee('0x6')},'priorityTrue':{'type':_0x15ee('0x7'),'message':_0x15ee('0x8')},'priorityFalse':{'type':_0x15ee('0x7'),'message':_0x15ee('0x9')}});exports[_0x15ee('0xa')]=function(_0x117d18,_0x4baa79){return function(_0x2a60c2){try{var _0x51eaa6={'condition':htmlToText[_0x15ee('0xb')](utils['getMustacheRender'](_0x4baa79[0x0],this),{'wordwrap':![]})[_0x15ee('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4baa79[0x1],'priorityFalse':_0x4baa79[0x2]};var _0x430000=gotoif['validate'](_0x51eaa6,{'typecast':!![]});if(_0x430000['length']){logger['error'](_0x15ee('0xd'),_0x117d18,_[_0x15ee('0xe')](_0x430000,_0x15ee('0xf'))['join'](',\x20'));_0x2a60c2['stop']();}else{try{var _0xaac67e=eval('('+_0x51eaa6[_0x15ee('0x10')]+')');var _0x20186f=_0xaac67e?_0x51eaa6[_0x15ee('0x11')]:_0x51eaa6[_0x15ee('0x12')];logger['info'](_0x15ee('0x13'),_0x117d18,_0x51eaa6[_0x15ee('0x10')],_0xaac67e,_0x20186f||'next');if(_0x20186f){var _0x35d86a=_[_0x15ee('0x14')](_0x2a60c2[_0x15ee('0x15')](),{'p':_0x20186f});if(_0x35d86a>=0x0){logger[_0x15ee('0x16')](_0x15ee('0x17'),_0x117d18,_0x20186f||_0x15ee('0x18'),_0x35d86a);_0x2a60c2[_0x15ee('0x18')](_0x35d86a);}else{logger[_0x15ee('0x16')](_0x15ee('0x19'),_0x117d18,_0x20186f||_0x15ee('0x18'));_0x2a60c2[_0x15ee('0x1a')]();}}else{_0x2a60c2['next']();}}catch(_0xc413bc){logger[_0x15ee('0x1b')](_0x15ee('0x1c'),_0x117d18,_0xc413bc['message']);_0x2a60c2[_0x15ee('0x1a')]();}}}catch(_0x31357a){logger[_0x15ee('0x1b')](_0x15ee('0xd'),_0x117d18,JSON['stringify'](_0x31357a));_0x2a60c2['stop']();}};}; \ No newline at end of file +var _0xb084=['error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','validate','lodash','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb084,0x196));var _0x4b08=function(_0x5b687c,_0x61bdcc){_0x5b687c=_0x5b687c-0x0;var _0x23e9ed=_0xb084[_0x5b687c];return _0x23e9ed;};'use strict';var schema=require(_0x4b08('0x0'));var _=require(_0x4b08('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x4b08('0x2'));var logger=require(_0x4b08('0x3'))(_0x4b08('0x4'));var gotoif=schema({'condition':{'type':_0x4b08('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x4b08('0x6'),'message':_0x4b08('0x7')},'priorityFalse':{'type':_0x4b08('0x6'),'message':_0x4b08('0x8')}});exports[_0x4b08('0x9')]=function(_0x3f33a3,_0x199f84){return function(_0x196e8c){try{var _0x32d06a={'condition':htmlToText[_0x4b08('0xa')](utils[_0x4b08('0xb')](_0x199f84[0x0],this),{'wordwrap':![]})[_0x4b08('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x199f84[0x1],'priorityFalse':_0x199f84[0x2]};var _0x1d4242=gotoif['validate'](_0x32d06a,{'typecast':!![]});if(_0x1d4242[_0x4b08('0xd')]){logger[_0x4b08('0xe')](_0x4b08('0xf'),_0x3f33a3,_['map'](_0x1d4242,_0x4b08('0x10'))[_0x4b08('0x11')](',\x20'));_0x196e8c[_0x4b08('0x12')]();}else{try{var _0x59e76b=eval('('+_0x32d06a[_0x4b08('0x13')]+')');var _0x6e756d=_0x59e76b?_0x32d06a['priorityTrue']:_0x32d06a[_0x4b08('0x14')];logger[_0x4b08('0x15')](_0x4b08('0x16'),_0x3f33a3,_0x32d06a[_0x4b08('0x13')],_0x59e76b,_0x6e756d||_0x4b08('0x17'));if(_0x6e756d){var _0x83c6c3=_[_0x4b08('0x18')](_0x196e8c[_0x4b08('0x19')](),{'p':_0x6e756d});if(_0x83c6c3>=0x0){logger[_0x4b08('0x15')](_0x4b08('0x1a'),_0x3f33a3,_0x6e756d||_0x4b08('0x17'),_0x83c6c3);_0x196e8c['next'](_0x83c6c3);}else{logger[_0x4b08('0x15')](_0x4b08('0x1b'),_0x3f33a3,_0x6e756d||_0x4b08('0x17'));_0x196e8c[_0x4b08('0x12')]();}}else{_0x196e8c[_0x4b08('0x17')]();}}catch(_0x284c68){logger[_0x4b08('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3f33a3,_0x284c68[_0x4b08('0x10')]);_0x196e8c[_0x4b08('0x12')]();}}}catch(_0x3778fa){logger[_0x4b08('0xe')](_0x4b08('0xf'),_0x3f33a3,JSON['stringify'](_0x3778fa));_0x196e8c[_0x4b08('0x12')]();}};}; \ 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 17959a7..02b6f75 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 _0x14e6=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','number'];(function(_0x407c2e,_0x4561af){var _0x47193a=function(_0x26ef45){while(--_0x26ef45){_0x407c2e['push'](_0x407c2e['shift']());}};_0x47193a(++_0x4561af);}(_0x14e6,0x1ab));var _0x614e=function(_0x4da6c4,_0x2f2213){_0x4da6c4=_0x4da6c4-0x0;var _0x48feaa=_0x14e6[_0x4da6c4];return _0x48feaa;};'use strict';var schema=require(_0x614e('0x0'));var _=require(_0x614e('0x1'));var logger=require(_0x614e('0x2'))(_0x614e('0x3'));var gotop=schema({'priority':{'type':_0x614e('0x4'),'required':!![],'message':_0x614e('0x5')}});exports[_0x614e('0x6')]=function(_0xbf9e16,_0x42ff85){return function(_0xa1bb79){try{var _0xaba486={'priority':_0x42ff85[0x0]};var _0x1be466=gotop[_0x614e('0x0')](_0xaba486,{'typecast':!![]});if(_0x1be466[_0x614e('0x7')]){logger[_0x614e('0x8')](_0x614e('0x9'),_0xbf9e16,_['map'](_0x1be466,'message')[_0x614e('0xa')](',\x20'));_0xa1bb79[_0x614e('0xb')]();}else{logger[_0x614e('0xc')](_0x614e('0xd'),_0xbf9e16,_0xaba486[_0x614e('0xe')]);if(_0xaba486['priority']){var _0x3879c9=_['findIndex'](_0xa1bb79[_0x614e('0xf')](),{'p':_0xaba486['priority']});if(_0x3879c9>=0x0){logger[_0x614e('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xbf9e16,_0xaba486[_0x614e('0xe')]||'next',_0x3879c9);_0xa1bb79['next'](_0x3879c9);}else{logger[_0x614e('0xc')](_0x614e('0x10'),_0xbf9e16,_0xaba486[_0x614e('0xe')]||_0x614e('0x11'));_0xa1bb79[_0x614e('0xb')]();}}else{_0xa1bb79['next']();}}}catch(_0x2ff3d6){logger[_0x614e('0x8')](_0x614e('0x9'),_0xbf9e16,JSON['stringify'](_0x2ff3d6));_0xa1bb79[_0x614e('0xb')]();}};}; \ No newline at end of file +var _0x086f=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x592286,_0x114c0f){var _0x5255cd=function(_0x26e984){while(--_0x26e984){_0x592286['push'](_0x592286['shift']());}};_0x5255cd(++_0x114c0f);}(_0x086f,0x7b));var _0xf086=function(_0x464592,_0x945b3b){_0x464592=_0x464592-0x0;var _0x420da2=_0x086f[_0x464592];return _0x420da2;};'use strict';var schema=require('validate');var _=require(_0xf086('0x0'));var logger=require('../../../../config/logger')(_0xf086('0x1'));var gotop=schema({'priority':{'type':_0xf086('0x2'),'required':!![],'message':_0xf086('0x3')}});exports[_0xf086('0x4')]=function(_0x204531,_0x30e69c){return function(_0x27a9b6){try{var _0x13bd37={'priority':_0x30e69c[0x0]};var _0xa40172=gotop['validate'](_0x13bd37,{'typecast':!![]});if(_0xa40172['length']){logger['error'](_0xf086('0x5'),_0x204531,_['map'](_0xa40172,'message')[_0xf086('0x6')](',\x20'));_0x27a9b6[_0xf086('0x7')]();}else{logger[_0xf086('0x8')](_0xf086('0x9'),_0x204531,_0x13bd37[_0xf086('0xa')]);if(_0x13bd37[_0xf086('0xa')]){var _0x185fba=_[_0xf086('0xb')](_0x27a9b6['rules'](),{'p':_0x13bd37[_0xf086('0xa')]});if(_0x185fba>=0x0){logger[_0xf086('0x8')](_0xf086('0xc'),_0x204531,_0x13bd37[_0xf086('0xa')]||_0xf086('0xd'),_0x185fba);_0x27a9b6[_0xf086('0xd')](_0x185fba);}else{logger[_0xf086('0x8')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x204531,_0x13bd37[_0xf086('0xa')]||_0xf086('0xd'));_0x27a9b6[_0xf086('0x7')]();}}else{_0x27a9b6[_0xf086('0xd')]();}}}catch(_0x4f4665){logger['error'](_0xf086('0x5'),_0x204531,JSON[_0xf086('0xe')](_0x4f4665));_0x27a9b6[_0xf086('0x7')]();}};}; \ 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 19b3709..58ebf51 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 _0xb688=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0xb688,0xcf));var _0x8b68=function(_0x1260b0,_0x1d6967){_0x1260b0=_0x1260b0-0x0;var _0x46802b=_0xb688[_0x1260b0];return _0x46802b;};'use strict';var _=require('lodash');var utils=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var rpc={'chatMessage':require(_0x8b68('0x3')),'openchannelMessage':require(_0x8b68('0x4')),'mailMessage':require(_0x8b68('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8b68('0x6')),'whatsappMessage':require(_0x8b68('0x7'))};exports[_0x8b68('0x8')]=function(_0x12d40e,_0x583d16){return function(_0x34314e){try{var _0x57ee56={'body':utils[_0x8b68('0x9')](_0x583d16[0x0],this),'ContactId':this[_0x8b68('0xa')]['id']};if(this[_0x8b68('0xb')]===_0x8b68('0xc')){_0x57ee56[_0x8b68('0xd')]=this[_0x8b68('0xe')]['id'];}else{_0x57ee56[_[_0x8b68('0xf')](this[_0x8b68('0xb')])+_0x8b68('0x10')]=this[_0x8b68('0xe')]['id'];}_0x57ee56[_[_0x8b68('0xf')](this[_0x8b68('0xb')])+_0x8b68('0x11')]=this['interaction']['id'];if(rpc[this[_0x8b68('0xb')]+_0x8b68('0x12')]){return rpc[this[_0x8b68('0xb')]+_0x8b68('0x12')][_0x8b68('0x13')](_0x57ee56)[_0x8b68('0x14')](function(_0xaa8725){logger[_0x8b68('0x15')](_0x8b68('0x16'),_0x12d40e,_0x57ee56['body']);_0x34314e[_0x8b68('0x17')]();})['catch'](function(_0x5e3c66){logger[_0x8b68('0x18')](_0x8b68('0x16'),_0x12d40e,JSON[_0x8b68('0x19')](_0x5e3c66));_0x34314e['stop']();});}}catch(_0x5c8d0e){logger[_0x8b68('0x18')]('[%s][MESSAGE]\x20%s',_0x12d40e,JSON[_0x8b68('0x19')](_0x5c8d0e));_0x34314e[_0x8b68('0x1a')]();}};}; \ No newline at end of file +var _0xbefc=['[%s][MESSAGE]\x20%s','body','next','catch','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','Message','create','then'];(function(_0x147892,_0x2bf1b5){var _0x4654e1=function(_0x438fc9){while(--_0x438fc9){_0x147892['push'](_0x147892['shift']());}};_0x4654e1(++_0x2bf1b5);}(_0xbefc,0x195));var _0xcbef=function(_0x3ffe17,_0x38b78b){_0x3ffe17=_0x3ffe17-0x0;var _0x574346=_0xbefc[_0x3ffe17];return _0x574346;};'use strict';var _=require('lodash');var utils=require(_0xcbef('0x0'));var logger=require(_0xcbef('0x1'))(_0xcbef('0x2'));var rpc={'chatMessage':require(_0xcbef('0x3')),'openchannelMessage':require(_0xcbef('0x4')),'mailMessage':require(_0xcbef('0x5')),'smsMessage':require(_0xcbef('0x6')),'faxMessage':require(_0xcbef('0x7')),'whatsappMessage':require(_0xcbef('0x8'))};exports[_0xcbef('0x9')]=function(_0x1645e3,_0x3fe826){return function(_0x4753d1){try{var _0x17bf41={'body':utils[_0xcbef('0xa')](_0x3fe826[0x0],this),'ContactId':this[_0xcbef('0xb')]['id']};if(this[_0xcbef('0xc')]===_0xcbef('0xd')){_0x17bf41[_0xcbef('0xe')]=this[_0xcbef('0xf')]['id'];}else{_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'AccountId']=this[_0xcbef('0xf')]['id'];}_0x17bf41[_[_0xcbef('0x10')](this[_0xcbef('0xc')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')]){return rpc[this[_0xcbef('0xc')]+_0xcbef('0x11')][_0xcbef('0x12')](_0x17bf41)[_0xcbef('0x13')](function(_0x2ae1a2){logger['info'](_0xcbef('0x14'),_0x1645e3,_0x17bf41[_0xcbef('0x15')]);_0x4753d1[_0xcbef('0x16')]();})[_0xcbef('0x17')](function(_0x3c6e80){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x3c6e80));_0x4753d1['stop']();});}}catch(_0x13e6e6){logger[_0xcbef('0x18')](_0xcbef('0x14'),_0x1645e3,JSON['stringify'](_0x13e6e6));_0x4753d1['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 16a8097..bb01fc2 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 _0x1c9f=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','stringify','./utils'];(function(_0x3b352b,_0x5ea454){var _0x565538=function(_0x219d32){while(--_0x219d32){_0x3b352b['push'](_0x3b352b['shift']());}};_0x565538(++_0x5ea454);}(_0x1c9f,0x14f));var _0xf1c9=function(_0x5ab033,_0xde15c9){_0x5ab033=_0x5ab033-0x0;var _0x58d44b=_0x1c9f[_0x5ab033];return _0x58d44b;};'use strict';var utils=require(_0xf1c9('0x0'));var logger=require(_0xf1c9('0x1'))(_0xf1c9('0x2'));exports[_0xf1c9('0x3')]=function(_0xb14392,_0x312273){return function(_0xae8057){try{logger[_0xf1c9('0x4')](_0xf1c9('0x5'),_0xb14392,utils['getMustacheRender'](_0x312273[0x0],this));_0xae8057['next']();}catch(_0x2c86eb){logger['error'](_0xf1c9('0x5'),_0xb14392,JSON[_0xf1c9('0x6')](_0x2c86eb));_0xae8057['stop']();}};}; \ No newline at end of file +var _0xba03=['routing','consequence','[%s][NOOP]\x20%s','next','stop','./utils'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xba03,0x161));var _0x3ba0=function(_0x1dcdb5,_0x13b7c6){_0x1dcdb5=_0x1dcdb5-0x0;var _0x30d81e=_0xba03[_0x1dcdb5];return _0x30d81e;};'use strict';var utils=require(_0x3ba0('0x0'));var logger=require('../../../../config/logger')(_0x3ba0('0x1'));exports[_0x3ba0('0x2')]=function(_0x181de7,_0x21aef2){return function(_0x13b217){try{logger['info'](_0x3ba0('0x3'),_0x181de7,utils['getMustacheRender'](_0x21aef2[0x0],this));_0x13b217[_0x3ba0('0x4')]();}catch(_0x1a768b){logger['error']('[%s][NOOP]\x20%s',_0x181de7,JSON['stringify'](_0x1a768b));_0x13b217[_0x3ba0('0x5')]();}};}; \ 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 0dfb5d4..785f80f 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 _0x0e0f=['stack','validate','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','format','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','stop','find','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','log'];(function(_0x3f3f18,_0x52da8e){var _0xf9916=function(_0x1b2686){while(--_0x1b2686){_0x3f3f18['push'](_0x3f3f18['shift']());}};_0xf9916(++_0x52da8e);}(_0x0e0f,0xe5));var _0xf0e0=function(_0x16654c,_0x159dc5){_0x16654c=_0x16654c-0x0;var _0x157cd5=_0x0e0f[_0x16654c];return _0x157cd5;};'use strict';var schema=require(_0xf0e0('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0xf0e0('0x1'));var moment=require(_0xf0e0('0x2'));var Redis=require(_0xf0e0('0x3'));var config=require(_0xf0e0('0x4'));var logger=require(_0xf0e0('0x5'))('routing');var strategy=require(_0xf0e0('0x6'));config[_0xf0e0('0x7')]=_['defaults'](config[_0xf0e0('0x7')],{'host':_0xf0e0('0x8'),'port':0x18eb});var io=require(_0xf0e0('0x9'))(new Redis(config[_0xf0e0('0x7')]));var attributes=['id',_0xf0e0('0xa'),_0xf0e0('0xb'),_0xf0e0('0xc'),_0xf0e0('0xd'),_0xf0e0('0xe')];function emit(_0x4d2f73,_0xed8cc3,_0x47fb29){io['to'](_0x4d2f73)[_0xf0e0('0xf')](_0xed8cc3,_0x47fb29);}function emitChannelQueueInteraction(_0x3e890d,_0x28397d,_0x55d54c,_0x59b7b7,_0x533eeb,_0x4a01b3,_0x10e087,_0x4931a8){var _0x501c86=_[_0xf0e0('0x10')](_0x55d54c);_0x501c86['queue_id']=_0x4931a8;_0x501c86[_0xf0e0('0xc')]=_0x28397d;_0x501c86[_0xf0e0('0xb')]=_0x59b7b7;_0x501c86['id']=_0x533eeb;if(_0x4a01b3){_0x10e087[util['format']('%sQueuesWaitingInteractions',_0x3e890d)][_0x533eeb]=_[_0xf0e0('0x11')](_0x501c86,attributes);}else{delete _0x10e087[util['format'](_0xf0e0('0x12'),_0x3e890d)][_0x533eeb];}emit(util['format'](_0xf0e0('0x13'),_0x3e890d,_0x28397d),util['format'](_0xf0e0('0x14'),_0x3e890d,_0x4a01b3?_0xf0e0('0x15'):'remove'),_[_0xf0e0('0x11')](_0x501c86,attributes));}var rpc={'openchannelQueueReport':require(_0xf0e0('0x16')),'mailQueueReport':require(_0xf0e0('0x17')),'chatQueueReport':require(_0xf0e0('0x18')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xf0e0('0x19')),'whatsappQueueReport':require(_0xf0e0('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf0e0('0x1b'),'message':_0xf0e0('0x1c')}});function startRouting(_0x51c8c8,_0x207c23,_0x5e84f3,_0x5bdf6c){if(_0x51c8c8&&_0x207c23&&_0x5e84f3){_0x207c23['waiting']+=0x1;var _0x350649={'uniqueid':_0x51c8c8,'from':_0x5e84f3[_0xf0e0('0x1d')]?_0x5e84f3['body']['from']:'','joinAt':moment()['format'](_0xf0e0('0x1e')),'ContactId':_0x5e84f3['contact']?_0x5e84f3['contact']['id']:null,'ListId':_0x5e84f3['list']?_0x5e84f3['list']['id']:null};_0x350649[_[_0xf0e0('0x1f')](_0x5e84f3[_0xf0e0('0x20')])+_0xf0e0('0x21')]=_0x207c23['id']||null;_0x350649[_[_0xf0e0('0x1f')](_0x5e84f3['channel'])+_0xf0e0('0x22')]=_0x5e84f3[_0xf0e0('0x23')]?_0x5e84f3['interaction']['id']:null;_0x350649[_[_0xf0e0('0x1f')](_0x5e84f3['channel'])+_0xf0e0('0x24')]=_0x5e84f3[_0xf0e0('0x25')]?_0x5e84f3['message']['id']:null;_0x350649[_[_0xf0e0('0x1f')](_0x5e84f3[_0xf0e0('0x20')])+(_0x5e84f3['channel']!==_0xf0e0('0x26')?_0xf0e0('0x27'):_0xf0e0('0x28'))]=_0x5e84f3[_0xf0e0('0xb')]?_0x5e84f3[_0xf0e0('0xb')]['id']:null;logger[_0xf0e0('0x29')](util[_0xf0e0('0x2a')](_0xf0e0('0x2b'),_0x51c8c8,_0x207c23[_0xf0e0('0x2c')]));emitChannelQueueInteraction(_0x5e84f3[_0xf0e0('0x20')],_0x207c23[_0xf0e0('0x2c')],_0x350649,_0x5e84f3['account'][_0xf0e0('0x2c')],_0x5e84f3['message']['id'],!![],_0x5bdf6c,_0x207c23['id']);if(rpc[_0x5e84f3[_0xf0e0('0x20')]+'QueueReport']){return rpc[_0x5e84f3[_0xf0e0('0x20')]+_0xf0e0('0x2d')][_0xf0e0('0x2e')](_0x350649)[_0xf0e0('0x2f')](function(_0x5b21f2){logger[_0xf0e0('0x30')](_0xf0e0('0x31'));});}}}function stopRouting(_0x45d005,_0x2ca25b,_0x51f10b,_0x1c2c16){if(_0x45d005&&_0x2ca25b){_0x2ca25b[_0xf0e0('0x32')]-=0x1;var _0x1929ac={'leaveAt':moment()[_0xf0e0('0x2a')](_0xf0e0('0x1e')),'acceptAt':moment()['format'](_0xf0e0('0x1e')),'reason':_0xf0e0('0x33')};logger[_0xf0e0('0x29')](util[_0xf0e0('0x2a')](_0xf0e0('0x34'),_0x45d005,_0x2ca25b['name']));emitChannelQueueInteraction(_0x51f10b[_0xf0e0('0x20')],_0x2ca25b[_0xf0e0('0x2c')],_0x51f10b['body'],_0x51f10b[_0xf0e0('0xb')][_0xf0e0('0x2c')],_0x51f10b[_0xf0e0('0x25')]['id'],![],_0x1c2c16,_0x2ca25b['id']);if(rpc[_0x51f10b[_0xf0e0('0x20')]+_0xf0e0('0x2d')]){return rpc[_0x51f10b[_0xf0e0('0x20')]+_0xf0e0('0x2d')]['update'](_0x45d005,_0x1929ac)[_0xf0e0('0x2f')](function(_0x414432){logger[_0xf0e0('0x30')](_0xf0e0('0x35'));});}}}function endRouting(_0x35f06f,_0x184dfc,_0x55de65,_0x56b47f){if(_0x35f06f&&_0x184dfc){_0x184dfc[_0xf0e0('0x32')]-=0x1;var _0x5addaf={'leaveAt':moment()[_0xf0e0('0x2a')](_0xf0e0('0x1e')),'exitAt':moment()[_0xf0e0('0x2a')](_0xf0e0('0x1e')),'reason':'timeout'};logger['info'](util[_0xf0e0('0x2a')](_0xf0e0('0x36'),_0x35f06f,_0x184dfc[_0xf0e0('0x2c')]));emitChannelQueueInteraction(_0x55de65[_0xf0e0('0x20')],_0x184dfc[_0xf0e0('0x2c')],_0x55de65[_0xf0e0('0x1d')],_0x55de65[_0xf0e0('0xb')][_0xf0e0('0x2c')],_0x55de65[_0xf0e0('0x25')]['id'],![],_0x56b47f);if(rpc[_0x55de65[_0xf0e0('0x20')]+'QueueReport']){return rpc[_0x55de65['channel']+_0xf0e0('0x2d')][_0xf0e0('0x37')](_0x35f06f,_0x5addaf)[_0xf0e0('0x2f')](function(_0x3a3b63){logger[_0xf0e0('0x30')](_0xf0e0('0x35'));});}}}function handleFindQueue(_0x131e45){return function(_0x395b02){return _0x395b02[_0xf0e0('0x2c')]['toLowerCase']()===_0x131e45[_0xf0e0('0x38')]();};}exports[_0xf0e0('0x39')]=function(_0x58a046,_0x15e924,_0x20ab51,_0x335012){return function(_0x51e2fe){try{var _0x45fea9={'name':_0x15e924[0x0],'timeout':_0x15e924[0x1]};var _0x5b099a=queue['validate'](_0x45fea9,{'typecast':!![]});if(_0x5b099a['length']){logger['error'](_0xf0e0('0x3a'),_0x58a046,_['map'](_0x5b099a,_0xf0e0('0x25'))[_0xf0e0('0x3b')](',\x20'));_0x51e2fe[_0xf0e0('0x3c')]();}else{var _0x5c654e=_[_0xf0e0('0x3d')](_0x20ab51[_0x335012['channel']+'Queues'],handleFindQueue(_0x45fea9[_0xf0e0('0x2c')]));if(_0x5c654e){startRouting(_0x58a046,_0x5c654e,_0x335012,_0x20ab51);var _0x5a458d=(_0x5c654e['timeout']||0xa)*0x3e8;var _0x14b7d1=(_0x45fea9[_0xf0e0('0x3e')]||0x14)*0x3e8;var _0x4e8cb9,_0x5af675;if(_0x5a458d>_0x14b7d1){_0x14b7d1=_0x5a458d;}var _0x4fbed0=seqqueue[_0xf0e0('0x3f')](_0x5a458d);_0x4fbed0['id']=_0x58a046;_0x4fbed0[_0xf0e0('0x40')]=_0x5a458d;_0x4fbed0[_0xf0e0('0x41')]=_0x14b7d1;_0x4fbed0[_0xf0e0('0x20')]=_0x335012[_0xf0e0('0x20')];_0x20ab51[_0xf0e0('0x42')][_0x58a046]['on'](_0xf0e0('0x43'),function(){logger['info'](_0xf0e0('0x44'),_0x58a046);stopRouting(_0x58a046,_0x5c654e,_0x335012,_0x20ab51);clearTimeout(_0x4e8cb9);_0x4e8cb9=undefined;_0x4fbed0[_0xf0e0('0x45')](!![]);if(_0x20ab51[_0xf0e0('0x42')][_0x58a046]){delete _0x20ab51[_0xf0e0('0x42')][_0x58a046];}_0x51e2fe[_0xf0e0('0x3c')]();});_0x20ab51['rules'][_0x58a046]['on'](_0xf0e0('0x46'),function(){if(_0x20ab51[_0xf0e0('0x42')][_0x58a046]){delete _0x20ab51['rules'][_0x58a046];}});_0x4e8cb9=setTimeout(function(){logger['info'](_0xf0e0('0x47'),_0x58a046);endRouting(_0x58a046,_0x5c654e,_0x335012,_0x20ab51);clearTimeout(_0x4e8cb9);_0x4fbed0['close'](!![]);_0x51e2fe['next']();},_0x14b7d1);switch(_0x5c654e[_0xf0e0('0x48')]){case _0xf0e0('0x49'):strategy[_0xf0e0('0x49')](_0x4fbed0,_0x5c654e,_0x20ab51,_0x335012);break;default:strategy['beepall'](_0x4fbed0,_0x5c654e,_0x20ab51,_0x335012);}}else{logger[_0xf0e0('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x58a046,_0x45fea9[_0xf0e0('0x2c')]);_0x51e2fe['stop']();}}}catch(_0x35100a){console[_0xf0e0('0x4a')](_0x35100a);logger['error']('[%s][QUEUE]\x20%s',_0x58a046,_0x35100a[_0xf0e0('0x4b')]);_0x51e2fe[_0xf0e0('0x3c')]();}};}; \ No newline at end of file +var _0x6e91=['upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','accepted','info','update','update\x20queue\x20report','timeout','catch','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','queue_id','account','queue','joinAt','clone','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x6e91,0x15e));var _0x16e9=function(_0x4416a4,_0x562fd6){_0x4416a4=_0x4416a4-0x0;var _0xadbdae=_0x6e91[_0x4416a4];return _0xadbdae;};'use strict';var schema=require(_0x16e9('0x0'));var _=require(_0x16e9('0x1'));var util=require(_0x16e9('0x2'));var seqqueue=require(_0x16e9('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x16e9('0x4'));var logger=require(_0x16e9('0x5'))(_0x16e9('0x6'));var strategy=require(_0x16e9('0x7'));config['redis']=_[_0x16e9('0x8')](config['redis'],{'host':_0x16e9('0x9'),'port':0x18eb});var io=require(_0x16e9('0xa'))(new Redis(config[_0x16e9('0xb')]));var attributes=['id',_0x16e9('0xc'),_0x16e9('0xd'),_0x16e9('0xe'),'from',_0x16e9('0xf')];function emit(_0x3c476f,_0x3ea8ec,_0x4ae13b){io['to'](_0x3c476f)['emit'](_0x3ea8ec,_0x4ae13b);}function emitChannelQueueInteraction(_0xfb4608,_0x23bcc1,_0x3cc2cd,_0x1c90db,_0x45a4fd,_0x20f3f7,_0x55296f,_0x5eb751){var _0x1defcf=_[_0x16e9('0x10')](_0x3cc2cd);_0x1defcf[_0x16e9('0xc')]=_0x5eb751;_0x1defcf[_0x16e9('0xe')]=_0x23bcc1;_0x1defcf[_0x16e9('0xd')]=_0x1c90db;_0x1defcf['id']=_0x45a4fd;if(_0x20f3f7){_0x55296f[util[_0x16e9('0x11')]('%sQueuesWaitingInteractions',_0xfb4608)][_0x45a4fd]=_[_0x16e9('0x12')](_0x1defcf,attributes);}else{delete _0x55296f[util[_0x16e9('0x11')](_0x16e9('0x13'),_0xfb4608)][_0x45a4fd];}emit(util[_0x16e9('0x11')]('%s:queue:%s',_0xfb4608,_0x23bcc1),util[_0x16e9('0x11')]('%s_queue_waiting_interaction:%s',_0xfb4608,_0x20f3f7?_0x16e9('0x14'):_0x16e9('0x15')),_[_0x16e9('0x12')](_0x1defcf,attributes));}var rpc={'openchannelQueueReport':require(_0x16e9('0x16')),'mailQueueReport':require(_0x16e9('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x16e9('0x18')),'faxQueueReport':require(_0x16e9('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x16e9('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x16e9('0x1b'),'message':_0x16e9('0x1c')}});function startRouting(_0x16a27a,_0x31139e,_0x475b6e,_0x32e014){if(_0x16a27a&&_0x31139e&&_0x475b6e){_0x31139e[_0x16e9('0x1d')]+=0x1;var _0xa546a={'uniqueid':_0x16a27a,'from':_0x475b6e[_0x16e9('0x1e')]?_0x475b6e[_0x16e9('0x1e')][_0x16e9('0x1f')]:'','joinAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'ContactId':_0x475b6e[_0x16e9('0x21')]?_0x475b6e[_0x16e9('0x21')]['id']:null,'ListId':_0x475b6e[_0x16e9('0x22')]?_0x475b6e[_0x16e9('0x22')]['id']:null};_0xa546a[_[_0x16e9('0x23')](_0x475b6e['channel'])+_0x16e9('0x24')]=_0x31139e['id']||null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+_0x16e9('0x26')]=_0x475b6e[_0x16e9('0x27')]?_0x475b6e[_0x16e9('0x27')]['id']:null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+_0x16e9('0x28')]=_0x475b6e[_0x16e9('0x29')]?_0x475b6e[_0x16e9('0x29')]['id']:null;_0xa546a[_[_0x16e9('0x23')](_0x475b6e[_0x16e9('0x25')])+(_0x475b6e[_0x16e9('0x25')]!==_0x16e9('0x2a')?_0x16e9('0x2b'):_0x16e9('0x2c'))]=_0x475b6e[_0x16e9('0xd')]?_0x475b6e[_0x16e9('0xd')]['id']:null;logger['info'](util[_0x16e9('0x11')](_0x16e9('0x2d'),_0x16a27a,_0x31139e['name']));emitChannelQueueInteraction(_0x475b6e[_0x16e9('0x25')],_0x31139e['name'],_0xa546a,_0x475b6e[_0x16e9('0xd')][_0x16e9('0x2e')],_0x475b6e[_0x16e9('0x29')]['id'],!![],_0x32e014,_0x31139e['id']);if(rpc[_0x475b6e[_0x16e9('0x25')]+_0x16e9('0x2f')]){return rpc[_0x475b6e[_0x16e9('0x25')]+_0x16e9('0x2f')]['create'](_0xa546a)['catch'](function(_0xfd19f5){logger[_0x16e9('0x30')](_0x16e9('0x31'));});}}}function stopRouting(_0xb1faa5,_0x583f8b,_0x17b6bd,_0x28b8c2){if(_0xb1faa5&&_0x583f8b){_0x583f8b[_0x16e9('0x1d')]-=0x1;var _0x3b05ff={'leaveAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'acceptAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'reason':_0x16e9('0x32')};logger[_0x16e9('0x33')](util[_0x16e9('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0xb1faa5,_0x583f8b[_0x16e9('0x2e')]));emitChannelQueueInteraction(_0x17b6bd['channel'],_0x583f8b['name'],_0x17b6bd['body'],_0x17b6bd[_0x16e9('0xd')][_0x16e9('0x2e')],_0x17b6bd[_0x16e9('0x29')]['id'],![],_0x28b8c2,_0x583f8b['id']);if(rpc[_0x17b6bd[_0x16e9('0x25')]+_0x16e9('0x2f')]){return rpc[_0x17b6bd[_0x16e9('0x25')]+'QueueReport'][_0x16e9('0x34')](_0xb1faa5,_0x3b05ff)['catch'](function(_0x353599){logger['error'](_0x16e9('0x35'));});}}}function endRouting(_0x30b786,_0x3389ff,_0x25359d,_0x375300){if(_0x30b786&&_0x3389ff){_0x3389ff[_0x16e9('0x1d')]-=0x1;var _0x592684={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x16e9('0x11')](_0x16e9('0x20')),'reason':_0x16e9('0x36')};logger[_0x16e9('0x33')](util[_0x16e9('0x11')]('[%s][END:QUEUE][NAME:%s]',_0x30b786,_0x3389ff[_0x16e9('0x2e')]));emitChannelQueueInteraction(_0x25359d[_0x16e9('0x25')],_0x3389ff[_0x16e9('0x2e')],_0x25359d[_0x16e9('0x1e')],_0x25359d[_0x16e9('0xd')][_0x16e9('0x2e')],_0x25359d[_0x16e9('0x29')]['id'],![],_0x375300);if(rpc[_0x25359d[_0x16e9('0x25')]+'QueueReport']){return rpc[_0x25359d['channel']+_0x16e9('0x2f')][_0x16e9('0x34')](_0x30b786,_0x592684)[_0x16e9('0x37')](function(_0x55ae69){logger[_0x16e9('0x30')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x2cc24a){return function(_0xd79421){return _0xd79421[_0x16e9('0x2e')][_0x16e9('0x38')]()===_0x2cc24a[_0x16e9('0x38')]();};}exports['consequence']=function(_0x19265d,_0x42ded8,_0x8c2496,_0xf6f6b){return function(_0x58255b){try{var _0xd4cac8={'name':_0x42ded8[0x0],'timeout':_0x42ded8[0x1]};var _0x50d26e=queue['validate'](_0xd4cac8,{'typecast':!![]});if(_0x50d26e[_0x16e9('0x39')]){logger[_0x16e9('0x30')](_0x16e9('0x3a'),_0x19265d,_[_0x16e9('0x3b')](_0x50d26e,_0x16e9('0x29'))['join'](',\x20'));_0x58255b[_0x16e9('0x3c')]();}else{var _0x582007=_[_0x16e9('0x3d')](_0x8c2496[_0xf6f6b['channel']+'Queues'],handleFindQueue(_0xd4cac8['name']));if(_0x582007){startRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);var _0x593213=(_0x582007['timeout']||0xa)*0x3e8;var _0x1508da=(_0xd4cac8[_0x16e9('0x36')]||0x14)*0x3e8;var _0x38fccc,_0x41db1f;if(_0x593213>_0x1508da){_0x1508da=_0x593213;}var _0x121711=seqqueue[_0x16e9('0x3e')](_0x593213);_0x121711['id']=_0x19265d;_0x121711['atimeout']=_0x593213;_0x121711[_0x16e9('0x3f')]=_0x1508da;_0x121711[_0x16e9('0x25')]=_0xf6f6b[_0x16e9('0x25')];_0x8c2496['rules'][_0x19265d]['on'](_0x16e9('0x40'),function(){logger[_0x16e9('0x33')](_0x16e9('0x41'),_0x19265d);stopRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);clearTimeout(_0x38fccc);_0x38fccc=undefined;_0x121711[_0x16e9('0x42')](!![]);if(_0x8c2496[_0x16e9('0x43')][_0x19265d]){delete _0x8c2496[_0x16e9('0x43')][_0x19265d];}_0x58255b[_0x16e9('0x3c')]();});_0x8c2496[_0x16e9('0x43')][_0x19265d]['on'](_0x16e9('0x44'),function(){if(_0x8c2496[_0x16e9('0x43')][_0x19265d]){delete _0x8c2496[_0x16e9('0x43')][_0x19265d];}});_0x38fccc=setTimeout(function(){logger[_0x16e9('0x33')](_0x16e9('0x45'),_0x19265d);endRouting(_0x19265d,_0x582007,_0xf6f6b,_0x8c2496);clearTimeout(_0x38fccc);_0x121711[_0x16e9('0x42')](!![]);_0x58255b[_0x16e9('0x46')]();},_0x1508da);switch(_0x582007[_0x16e9('0x47')]){case'rrmemory':strategy[_0x16e9('0x48')](_0x121711,_0x582007,_0x8c2496,_0xf6f6b);break;default:strategy[_0x16e9('0x49')](_0x121711,_0x582007,_0x8c2496,_0xf6f6b);}}else{logger[_0x16e9('0x30')](_0x16e9('0x4a'),_0x19265d,_0xd4cac8['name']);_0x58255b['stop']();}}}catch(_0xdbf47e){console[_0x16e9('0x4b')](_0xdbf47e);logger[_0x16e9('0x30')]('[%s][QUEUE]\x20%s',_0x19265d,_0xdbf47e[_0x16e9('0x4c')]);_0x58255b[_0x16e9('0x3c')]();}};}; \ 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 dfc63ad..b939da8 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 _0x5c96=['push','handleRun','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','busy','agents','busyQueue','showNotification','writeLog','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','squeue','agent','realtime','bind','timeout','handleTimeout','drained','prototype'];(function(_0x843c30,_0x30d256){var _0x19c706=function(_0x4e09c7){while(--_0x4e09c7){_0x843c30['push'](_0x843c30['shift']());}};_0x19c706(++_0x30d256);}(_0x5c96,0x18a));var _0x65c9=function(_0x3f8045,_0x51244b){_0x3f8045=_0x3f8045-0x0;var _0x54b69c=_0x5c96[_0x3f8045];return _0x54b69c;};'use strict';var _=require(_0x65c9('0x0'));var uuid=require('uuid');var util=require(_0x65c9('0x1'));var logger=require(_0x65c9('0x2'))(_0x65c9('0x3'));var Agent=function(_0x1c50f9,_0x23641b,_0x36923c,_0x225512){this['notificationId']=uuid['v4']();this[_0x65c9('0x4')]=_0x1c50f9;this[_0x65c9('0x5')]=_0x23641b;this[_0x65c9('0x6')]=_0x36923c;this[_0x65c9('0x3')]=_0x225512;this[_0x65c9('0x4')]['push'](this['handleRun'][_0x65c9('0x7')](this),this['handleTimeout'][_0x65c9('0x7')](this));this['squeue']['on'](_0x65c9('0x8'),this[_0x65c9('0x9')]['bind'](this));this['squeue']['on'](_0x65c9('0xa'),this['handleDrained'][_0x65c9('0x7')](this));};Agent[_0x65c9('0xb')][_0x65c9('0xc')]=function(){this[_0x65c9('0x4')][_0x65c9('0xc')](this[_0x65c9('0xd')][_0x65c9('0x7')](this),this[_0x65c9('0x9')]['bind'](this));};Agent['prototype'][_0x65c9('0xe')]=function(){this[_0x65c9('0x9')](!![]);};Agent[_0x65c9('0xb')]['handleRun']=function(_0x4a22be){logger[_0x65c9('0xf')](_0x65c9('0x10'),this[_0x65c9('0x4')]['id'],this[_0x65c9('0x5')]['id']);if(_[_0x65c9('0x11')](this[_0x65c9('0x6')]['agents'][this[_0x65c9('0x5')]['id']])){logger[_0x65c9('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x65c9('0x4')]['id'],this[_0x65c9('0x5')]['id']);setTimeout(this[_0x65c9('0xc')][_0x65c9('0x7')](this),0x3e8);}else{if(this[_0x65c9('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0x65c9('0x4')]['id'],this['realtime']['agents'][this[_0x65c9('0x5')]['id']],this['squeue']['channel'],![])){this[_0x65c9('0x6')]['agents'][this[_0x65c9('0x5')]['id']][_0x65c9('0x12')]=!![];this[_0x65c9('0x6')][_0x65c9('0x13')][this['agent']['id']][_0x65c9('0x14')]=undefined;util[_0x65c9('0x15')](this['notificationId'],this[_0x65c9('0x4')]['id'],this[_0x65c9('0x6')][_0x65c9('0x13')][this[_0x65c9('0x5')]['id']],null,this['routing']);util[_0x65c9('0x16')](this[_0x65c9('0x4')]['id'],this[_0x65c9('0x6')][_0x65c9('0x13')][this[_0x65c9('0x5')]['id']],'RINGING'+(this[_0x65c9('0x3')][_0x65c9('0x17')]?':FORCED':''));}else{logger['info'](_0x65c9('0x18'),this['squeue']['id'],this[_0x65c9('0x5')]['id']);setTimeout(this[_0x65c9('0xc')][_0x65c9('0x7')](this),0x3e8);}}};Agent['prototype'][_0x65c9('0x9')]=function(_0x3abd3d){if(_['isNil'](this[_0x65c9('0x6')][_0x65c9('0x13')][this[_0x65c9('0x5')]['id']])){return logger[_0x65c9('0xf')](_0x65c9('0x19'),this['squeue']['id'],this['agent']['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x65c9('0x4')]['id'],this[_0x65c9('0x5')]['id']);util[_0x65c9('0x1a')](this['notificationId'],this[_0x65c9('0x4')]['id'],this[_0x65c9('0x6')]['agents'][this[_0x65c9('0x5')]['id']],null,this[_0x65c9('0x3')]);this[_0x65c9('0x6')]['agents'][this[_0x65c9('0x5')]['id']][_0x65c9('0x12')]=![];this[_0x65c9('0x6')][_0x65c9('0x13')][this['agent']['id']][_0x65c9('0x14')]=undefined;util[_0x65c9('0x16')](this['squeue']['id'],this['realtime'][_0x65c9('0x13')][this[_0x65c9('0x5')]['id']],_0x3abd3d?_0x65c9('0x1b'):_0x65c9('0x1c'));}if(!_0x3abd3d){setTimeout(this[_0x65c9('0xc')][_0x65c9('0x7')](this),0x3e8);}};function agent(_0x42ee1b,_0x3b9f8e,_0x24200e,_0x3bd2ab){return new Agent(_0x42ee1b,_0x3b9f8e,_0x24200e,_0x3bd2ab);}module['exports']=agent; \ No newline at end of file +var _0x5ea2=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports'];(function(_0x57f6e4,_0x2f0c3e){var _0x1847a6=function(_0x322979){while(--_0x322979){_0x57f6e4['push'](_0x57f6e4['shift']());}};_0x1847a6(++_0x2f0c3e);}(_0x5ea2,0x1ce));var _0x25ea=function(_0x1903c8,_0x228b68){_0x1903c8=_0x1903c8-0x0;var _0x4ba31c=_0x5ea2[_0x1903c8];return _0x4ba31c;};'use strict';var _=require('lodash');var uuid=require(_0x25ea('0x0'));var util=require(_0x25ea('0x1'));var logger=require(_0x25ea('0x2'))(_0x25ea('0x3'));var Agent=function(_0x3c461d,_0x4593fc,_0x1543ab,_0x190db7){this[_0x25ea('0x4')]=uuid['v4']();this[_0x25ea('0x5')]=_0x3c461d;this[_0x25ea('0x6')]=_0x4593fc;this[_0x25ea('0x7')]=_0x1543ab;this['routing']=_0x190db7;this['squeue'][_0x25ea('0x8')](this['handleRun'][_0x25ea('0x9')](this),this[_0x25ea('0xa')][_0x25ea('0x9')](this));this[_0x25ea('0x5')]['on'](_0x25ea('0xb'),this[_0x25ea('0xa')][_0x25ea('0x9')](this));this[_0x25ea('0x5')]['on'](_0x25ea('0xc'),this[_0x25ea('0xd')][_0x25ea('0x9')](this));};Agent[_0x25ea('0xe')]['push']=function(){this['squeue'][_0x25ea('0x8')](this['handleRun'][_0x25ea('0x9')](this),this[_0x25ea('0xa')][_0x25ea('0x9')](this));};Agent[_0x25ea('0xe')][_0x25ea('0xd')]=function(){this[_0x25ea('0xa')](!![]);};Agent['prototype'][_0x25ea('0xf')]=function(_0xbe86b7){logger[_0x25ea('0x10')](_0x25ea('0x11'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']])){logger[_0x25ea('0x10')](_0x25ea('0x13'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);setTimeout(this['push'][_0x25ea('0x9')](this),0x3e8);}else{if(this[_0x25ea('0x3')][_0x25ea('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],this[_0x25ea('0x5')][_0x25ea('0x15')],![])){this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x16')]=!![];this['realtime']['agents'][this[_0x25ea('0x6')]['id']][_0x25ea('0x17')]=undefined;util['showNotification'](this[_0x25ea('0x4')],this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],null,this['routing']);util['writeLog'](this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')]['agents'][this[_0x25ea('0x6')]['id']],_0x25ea('0x18')+(this[_0x25ea('0x3')]['forcedOwnership']?_0x25ea('0x19'):''));}else{logger[_0x25ea('0x10')](_0x25ea('0x1a'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);setTimeout(this['push'][_0x25ea('0x9')](this),0x3e8);}}};Agent['prototype'][_0x25ea('0xa')]=function(_0x36bcfe){if(_[_0x25ea('0x1b')](this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']])){return logger[_0x25ea('0x10')](_0x25ea('0x13'),this[_0x25ea('0x5')]['id'],this[_0x25ea('0x6')]['id']);}else{logger['info'](_0x25ea('0x1c'),this[_0x25ea('0x5')]['id'],this['agent']['id']);util['hideNotification'](this[_0x25ea('0x4')],this[_0x25ea('0x5')]['id'],this['realtime']['agents'][this[_0x25ea('0x6')]['id']],null,this[_0x25ea('0x3')]);this['realtime'][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x16')]=![];this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']][_0x25ea('0x17')]=undefined;util[_0x25ea('0x1d')](this[_0x25ea('0x5')]['id'],this[_0x25ea('0x7')][_0x25ea('0x12')][this[_0x25ea('0x6')]['id']],_0x36bcfe?_0x25ea('0x1e'):_0x25ea('0x1f'));}if(!_0x36bcfe){setTimeout(this[_0x25ea('0x8')][_0x25ea('0x9')](this),0x3e8);}};function agent(_0x1f6bd9,_0x20ea56,_0x4a4c03,_0x4d4693){return new Agent(_0x1f6bd9,_0x20ea56,_0x4a4c03,_0x4d4693);}module[_0x25ea('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 c90a433..3b5302e 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 _0x5a5a=['STOP','TIMEOUT','busy','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','push','handleRun','bind','handleTimeout','timeout','squeue','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification'];(function(_0x374fc6,_0x222498){var _0x4f7916=function(_0x17bf8a){while(--_0x17bf8a){_0x374fc6['push'](_0x374fc6['shift']());}};_0x4f7916(++_0x222498);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x55595d,_0x62144){_0x55595d=_0x55595d-0x0;var _0x3b0c2e=_0x5a5a[_0x55595d];return _0x3b0c2e;};'use strict';var _=require('lodash');var uuid=require(_0xa5a5('0x0'));var util=require(_0xa5a5('0x1'));var logger=require(_0xa5a5('0x2'))(_0xa5a5('0x3'));var Beepall=function(_0x42cf19,_0x50c2ad,_0x1e6eca,_0x3307f1){this[_0xa5a5('0x4')]=uuid['v4']();this['squeue']=_0x42cf19;this['queue']=_0x50c2ad;this[_0xa5a5('0x5')]=_0x1e6eca;this[_0xa5a5('0x3')]=_0x3307f1;this['squeue'][_0xa5a5('0x6')](this[_0xa5a5('0x7')][_0xa5a5('0x8')](this),this[_0xa5a5('0x9')][_0xa5a5('0x8')](this));this['squeue']['on'](_0xa5a5('0xa'),this[_0xa5a5('0x9')][_0xa5a5('0x8')](this));this[_0xa5a5('0xb')]['on'](_0xa5a5('0xc'),this[_0xa5a5('0xd')][_0xa5a5('0x8')](this));};Beepall[_0xa5a5('0xe')][_0xa5a5('0x6')]=function(){this[_0xa5a5('0xb')][_0xa5a5('0x6')](this[_0xa5a5('0x7')]['bind'](this),this[_0xa5a5('0x9')][_0xa5a5('0x8')](this));};Beepall[_0xa5a5('0xe')][_0xa5a5('0xd')]=function(_0x462acd){this[_0xa5a5('0x9')](!![]);};Beepall['prototype'][_0xa5a5('0x7')]=function(_0x2f5900){var _0x14b6da=!![];if(!_[_0xa5a5('0xf')](this[_0xa5a5('0x10')])&&!_[_0xa5a5('0xf')](this[_0xa5a5('0x10')][_0xa5a5('0x11')])&&this['queue'][_0xa5a5('0x11')][_0xa5a5('0x12')]>0x0){for(var _0x4571f5=0x0,_0x184652;_0x4571f50x0){for(var _0x51110b=0x0,_0x191b7f;_0x51110b0x0&&_0x1e512d[_0x219be1+_0x5474('0x26')]>=_0x1e512d[_0x219be1+'Capacity']){writeLog(_0xe4850d,_0x1e512d,_0x219be1[_0x5474('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5474('0x28')]=function(_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a){return sendNotification(!![],_0x1384e4,_0x2a8730,_0x5865fe,_0x574ed6,_0x42b99a);};exports['hideNotification']=function(_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb){return sendNotification(![],_0x57731b,_0x5d2381,_0x492a31,_0x168dee,_0x1b8adb);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x8ace=['\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','emit','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x27c28c,_0x49ba23){_0x27c28c=_0x27c28c-0x0;var _0x1f5669=_0x8ace[_0x27c28c];return _0x1f5669;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var utils=require(_0xe8ac('0x2'));var Mustache=require(_0xe8ac('0x3'));var Redis=require(_0xe8ac('0x4'));var config=require(_0xe8ac('0x5'));var logger=require(_0xe8ac('0x6'))(_0xe8ac('0x7'));config[_0xe8ac('0x8')]=_[_0xe8ac('0x9')](config[_0xe8ac('0x8')],{'host':_0xe8ac('0xa'),'port':0x18eb});var io=require(_0xe8ac('0xb'))(new Redis(config[_0xe8ac('0x8')]));function emit(_0x4eb087,_0x2d56f0,_0x1357ed){io['to'](_0x4eb087)['emit'](_0x2d56f0,_0x1357ed);}function sendNotification(_0x5c83e1,_0x4644ef,_0x513793,_0x1b5467,_0x271fdb,_0x19d9c8){io['to'](util[_0xe8ac('0xc')](_0xe8ac('0xd'),_0x1b5467[_0xe8ac('0xe')]))['emit'](_0xe8ac('0xf'),_0x1b5467);var _0x2e3b25=_0x19d9c8||{};var _0x1f71ff=_0x513793['split']('.');var _0x15b0cf={'uniqueid':_0x4644ef,'channel':_0x1f71ff[0x0],'id':_0x1f71ff[0x1],'title':_0x1f71ff[0x0]+_0xe8ac('0x10'),'interactionId':_0x1f71ff[0x2],'queue':_0x271fdb?_0x271fdb['name']:null,'sound':_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x12')],'shake':_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x13')]};try{if(!_0x2e3b25[_0xe8ac('0x14')]){_0x2e3b25[_0xe8ac('0x14')]={};}if(_0x271fdb){_0x2e3b25[_0xe8ac('0x14')][_0xe8ac('0x15')]=_0x271fdb;}else if(_0x2e3b25[_0xe8ac('0x14')][_0xe8ac('0x15')]){delete _0x2e3b25['body'][_0xe8ac('0x15')];}_0x15b0cf[_0xe8ac('0x16')]=utils['getMustacheRender'](_0x2e3b25[_0xe8ac('0x11')][_0xe8ac('0x17')],_0x2e3b25);}catch(_0x1421df){_0x15b0cf[_0xe8ac('0x16')]=_0xe8ac('0x18');logger[_0xe8ac('0x19')](util['format']('[%s][QUEUE]\x20%s',_0x4644ef,_0x1421df['message']));}io['to'](util[_0xe8ac('0xc')](_0xe8ac('0xd'),_0x1b5467['name']))[_0xe8ac('0x1a')](util['format'](_0xe8ac('0x1b'),_0x5c83e1?_0xe8ac('0x1c'):'remove'),_0x15b0cf);}function writeLog(_0x6258f8,_0x169929,_0x13aa7c){return logger[_0xe8ac('0x1d')](util['format'](_0xe8ac('0x1e'),_0x6258f8,_0x169929['name'],_0x13aa7c));}exports[_0xe8ac('0x1f')]=function(_0x3933d2,_0x3c3a78,_0x252440,_0x36108c){if(_0x3c3a78[_0xe8ac('0x20')]){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x21'));return![];}if(!_0x3c3a78['online']){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x22'));return![];}if(_0x3c3a78[_0x252440+_0xe8ac('0x23')]){writeLog(_0x3933d2,_0x3c3a78,_0xe8ac('0x24'));return![];}if(_0x36108c&&_0x3c3a78[_0xe8ac('0x25')](_0x252440+_0xe8ac('0x26'))&&_0x3c3a78[_0xe8ac('0x25')](_0x252440+_0xe8ac('0x27'))){if(_0x3c3a78[_0x252440+_0xe8ac('0x26')]>0x0&&_0x3c3a78[_0x252440+_0xe8ac('0x27')]>=_0x3c3a78[_0x252440+'Capacity']){writeLog(_0x3933d2,_0x3c3a78,_0x252440['toUpperCase']()+_0xe8ac('0x28'));return![];}}return!![];};exports[_0xe8ac('0x29')]=function(_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08){return sendNotification(!![],_0x59512c,_0x2a78c6,_0x5948aa,_0x54f94c,_0x4c1d08);};exports[_0xe8ac('0x2a')]=function(_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8){return sendNotification(![],_0x41294e,_0x3798c5,_0x5d7562,_0x156550,_0x41ffe8);};exports[_0xe8ac('0x2b')]=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 5e5f789..5c94cab 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 _0x192f=['../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','validate','lodash'];(function(_0x35d007,_0x132d5c){var _0x5e960f=function(_0x56771c){while(--_0x56771c){_0x35d007['push'](_0x35d007['shift']());}};_0x5e960f(++_0x132d5c);}(_0x192f,0xd6));var _0xf192=function(_0x211a57,_0x181dbf){_0x211a57=_0x211a57-0x0;var _0x306f48=_0x192f[_0x211a57];return _0x306f48;};'use strict';var schema=require(_0xf192('0x0'));var sh=require('shelljs');var _=require(_0xf192('0x1'));var utils=require('./utils');var logger=require(_0xf192('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xf192('0x3')}});exports[_0xf192('0x4')]=function(_0x1a2945,_0x22d0b0){return function(_0x1df2e1){try{var _0x221f55={'command':_0x22d0b0[0x0]};var _0x5a05b0=system[_0xf192('0x0')](_0x221f55,{'typecast':!![]});if(_0x5a05b0[_0xf192('0x5')]){logger['error'](_0xf192('0x6'),_0x1a2945,_[_0xf192('0x7')](_0x5a05b0,_0xf192('0x8'))[_0xf192('0x9')](',\x20'));logger[_0xf192('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1a2945);_0x1df2e1['next']();}else{var _0x3004d1=this;var _0x3389aa=utils[_0xf192('0xb')](_0x22d0b0[0x0],this);logger[_0xf192('0xa')](_0xf192('0xc'),_0x1a2945,_0x3389aa);sh[_0xf192('0xd')](_[_0xf192('0xe')](_0x3389aa),function(_0x1ae751,_0x5be8c7){logger[_0xf192('0xa')](_0xf192('0xf'),_0x1a2945,_0x1ae751);if(_0x1ae751==0x0){var _0x127c90=_0x5be8c7[_0xf192('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xf192('0x11')](_0x22d0b0[0x1])||_[_0xf192('0x12')](_0x22d0b0[0x1])){logger[_0xf192('0xa')](_0xf192('0x13'),_0x1a2945);_0x3004d1[_0xf192('0x14')][_0x22d0b0[0x1]]=_0x127c90;}else{logger[_0xf192('0xa')](_0xf192('0x15'),_0x1a2945,_0x22d0b0[0x1],_0x127c90);_0x3004d1[_0xf192('0x14')][_0x22d0b0[0x1]]=_0x127c90;}}_0x1df2e1['next']();});}}catch(_0x1bd912){logger[_0xf192('0x16')]('[%s][SYSTEM]\x20%s',_0x1a2945,_[_0xf192('0x17')](_0x1bd912)?JSON[_0xf192('0x18')](_0x1bd912):_0x1bd912);logger[_0xf192('0xa')](_0xf192('0x19'),_0x1a2945);_0x1df2e1[_0xf192('0x1a')]();}};}; \ No newline at end of file +var _0x3f18=['replace','isNil','isEmpty','info','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','validate','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x3f18,0x1aa));var _0x83f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f18[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x83f1('0x0'));var sh=require('shelljs');var _=require(_0x83f1('0x1'));var utils=require('./utils');var logger=require(_0x83f1('0x2'))(_0x83f1('0x3'));var system=schema({'command':{'type':_0x83f1('0x4'),'required':!![],'message':_0x83f1('0x5')}});exports['consequence']=function(_0x282d9d,_0x5e8af8){return function(_0x5bfd2d){try{var _0x4bf5e9={'command':_0x5e8af8[0x0]};var _0x37f390=system['validate'](_0x4bf5e9,{'typecast':!![]});if(_0x37f390[_0x83f1('0x6')]){logger[_0x83f1('0x7')](_0x83f1('0x8'),_0x282d9d,_['map'](_0x37f390,_0x83f1('0x9'))[_0x83f1('0xa')](',\x20'));logger['info'](_0x83f1('0xb'),_0x282d9d);_0x5bfd2d[_0x83f1('0xc')]();}else{var _0x194b53=this;var _0x2792a0=utils[_0x83f1('0xd')](_0x5e8af8[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x282d9d,_0x2792a0);sh['exec'](_['trim'](_0x2792a0),function(_0x301f1b,_0x488614){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x282d9d,_0x301f1b);if(_0x301f1b==0x0){var _0x365c56=_0x488614[_0x83f1('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x83f1('0xf')](_0x5e8af8[0x1])||_[_0x83f1('0x10')](_0x5e8af8[0x1])){logger[_0x83f1('0x11')](_0x83f1('0x12'),_0x282d9d);_0x194b53['body'][_0x5e8af8[0x1]]=_0x365c56;}else{logger['info'](_0x83f1('0x13'),_0x282d9d,_0x5e8af8[0x1],_0x365c56);_0x194b53[_0x83f1('0x14')][_0x5e8af8[0x1]]=_0x365c56;}}_0x5bfd2d[_0x83f1('0xc')]();});}}catch(_0x1004bc){logger['error'](_0x83f1('0x8'),_0x282d9d,_[_0x83f1('0x15')](_0x1004bc)?JSON['stringify'](_0x1004bc):_0x1004bc);logger[_0x83f1('0x11')](_0x83f1('0xb'),_0x282d9d);_0x5bfd2d[_0x83f1('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index b4b068a..e02f932 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 _0x3fef=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','join','info'];(function(_0x317804,_0x31b0ec){var _0x929295=function(_0x547960){while(--_0x547960){_0x317804['push'](_0x317804['shift']());}};_0x929295(++_0x31b0ec);}(_0x3fef,0x1b4));var _0xf3fe=function(_0x85a7f4,_0x4e700d){_0x85a7f4=_0x85a7f4-0x0;var _0x554ea7=_0x3fef[_0x85a7f4];return _0x554ea7;};'use strict';var schema=require(_0xf3fe('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xf3fe('0x1')),'smsInteraction':require(_0xf3fe('0x2')),'mailInteraction':require(_0xf3fe('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xf3fe('0x4'))};var logger=require(_0xf3fe('0x5'))(_0xf3fe('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xf3fe('0x7')}});exports[_0xf3fe('0x8')]=function(_0xa3aae2,_0x2c1d32,_0x41d44b,_0x28191d){return function(_0x563688){try{var _0x8b4a3d={'tag':_0x2c1d32[0x0]};var _0x48c138=tag[_0xf3fe('0x0')](_0x8b4a3d,{'typecast':!![]});if(_0x48c138[_0xf3fe('0x9')]){logger[_0xf3fe('0xa')]('[%s][TAG]\x20%s',_0xa3aae2,_[_0xf3fe('0xb')](_0x48c138,'message')[_0xf3fe('0xc')](',\x20'));logger[_0xf3fe('0xd')](_0xf3fe('0xe'),_0xa3aae2);_0x563688[_0xf3fe('0xf')]();}else{var _0x210cb5={'ids':[_0x2c1d32[0x0]]};if(rpc[_0x28191d[_0xf3fe('0x10')]+_0xf3fe('0x11')]){rpc[_0x28191d[_0xf3fe('0x10')]+'Interaction'][_0xf3fe('0x12')](_0x28191d['interaction']['id'],_0x210cb5)[_0xf3fe('0x13')](function(_0x2207e9){logger[_0xf3fe('0xd')](_0xf3fe('0x14'),_0xa3aae2,_0x2c1d32[0x1],_0x28191d['channel'],_0x28191d['interaction']['id']);})['catch'](function(_0x1f5637){logger[_0xf3fe('0xa')](_0xf3fe('0x15'),_0xa3aae2,JSON[_0xf3fe('0x16')](_0x1f5637));logger[_0xf3fe('0xd')](_0xf3fe('0xe'),_0xa3aae2);})[_0xf3fe('0x17')](function(){_0x563688['next']();});}}}catch(_0x4e4e24){logger[_0xf3fe('0xa')](_0xf3fe('0x15'),_0xa3aae2,_[_0xf3fe('0x18')](_0x4e4e24)?JSON['stringify'](_0x4e4e24):_0x4e4e24);logger[_0xf3fe('0xd')](_0xf3fe('0xe'),_0xa3aae2);_0x563688[_0xf3fe('0xf')]();}};}; \ No newline at end of file +var _0xbc91=['channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','info','next'];(function(_0x42cbf3,_0x27a08c){var _0x51bcd7=function(_0x1b506e){while(--_0x1b506e){_0x42cbf3['push'](_0x42cbf3['shift']());}};_0x51bcd7(++_0x27a08c);}(_0xbc91,0x10f));var _0x1bc9=function(_0x5046c5,_0xd3806b){_0x5046c5=_0x5046c5-0x0;var _0x3898e8=_0xbc91[_0x5046c5];return _0x3898e8;};'use strict';var schema=require(_0x1bc9('0x0'));var _=require(_0x1bc9('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1bc9('0x2')),'whatsappInteraction':require(_0x1bc9('0x3'))};var logger=require(_0x1bc9('0x4'))(_0x1bc9('0x5'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1bc9('0x6')}});exports[_0x1bc9('0x7')]=function(_0x699b98,_0x2cc8e5,_0x3491d6,_0x5a69c3){return function(_0x4dc973){try{var _0x1f2c7b={'tag':_0x2cc8e5[0x0]};var _0x26f74a=tag[_0x1bc9('0x0')](_0x1f2c7b,{'typecast':!![]});if(_0x26f74a[_0x1bc9('0x8')]){logger[_0x1bc9('0x9')](_0x1bc9('0xa'),_0x699b98,_[_0x1bc9('0xb')](_0x26f74a,_0x1bc9('0xc'))['join'](',\x20'));logger[_0x1bc9('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x699b98);_0x4dc973[_0x1bc9('0xe')]();}else{var _0xf9a14e={'ids':[_0x2cc8e5[0x0]]};if(rpc[_0x5a69c3[_0x1bc9('0xf')]+_0x1bc9('0x10')]){rpc[_0x5a69c3[_0x1bc9('0xf')]+_0x1bc9('0x10')][_0x1bc9('0x11')](_0x5a69c3['interaction']['id'],_0xf9a14e)[_0x1bc9('0x12')](function(_0x336e29){logger[_0x1bc9('0xd')](_0x1bc9('0x13'),_0x699b98,_0x2cc8e5[0x1],_0x5a69c3[_0x1bc9('0xf')],_0x5a69c3[_0x1bc9('0x14')]['id']);})[_0x1bc9('0x15')](function(_0x5b6b27){logger[_0x1bc9('0x9')](_0x1bc9('0xa'),_0x699b98,JSON[_0x1bc9('0x16')](_0x5b6b27));logger[_0x1bc9('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x699b98);})[_0x1bc9('0x17')](function(){_0x4dc973[_0x1bc9('0xe')]();});}}}catch(_0x4c920d){logger[_0x1bc9('0x9')]('[%s][TAG]\x20%s',_0x699b98,_[_0x1bc9('0x18')](_0x4c920d)?JSON['stringify'](_0x4c920d):_0x4c920d);logger[_0x1bc9('0xd')](_0x1bc9('0x19'),_0x699b98);_0x4dc973[_0x1bc9('0xe')]();}};}; \ 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 b76faa7..be65eae 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 _0x7cf6=['error','[%s][TVOX]\x20%s','isObject','stop','info','next','request-promise','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&data='];(function(_0x5454a4,_0x301069){var _0x37bdc2=function(_0x4be41b){while(--_0x4be41b){_0x5454a4['push'](_0x5454a4['shift']());}};_0x37bdc2(++_0x301069);}(_0x7cf6,0x114));var _0x67cf=function(_0x486867,_0x52a530){_0x486867=_0x486867-0x0;var _0x3d3c99=_0x7cf6[_0x486867];return _0x3d3c99;};'use strict';var rp=require(_0x67cf('0x0'));var logger=require('../../../../config/logger')('routing');var _=require(_0x67cf('0x1'));var arr=[];exports[_0x67cf('0x2')]=function(_0x1638e0,_0x18b7e2){return function(_0x5dac3d){var _0x5eb72f=_0x18b7e2[0xa];var _0x2c0025=_0x18b7e2[0xb];var _0xa1c069=_0x18b7e2[0xc];var _0x249298=_0x18b7e2[0xd];var _0x3ae919=_0x18b7e2[0xe];var _0x189137=_0x18b7e2[0xf]['replace'](/\n/g,_0x67cf('0x3'));var _0x71496b=_0x18b7e2[0x10][_0x67cf('0x4')](/\n/g,'\x20');if(!arr[_0x67cf('0x5')](_0x2c0025)){arr[_0x67cf('0x6')](_0x2c0025);var _0x31c6fb=_0x18b7e2[0x3];var _0x25518e=_0x18b7e2[0x4];var _0x549a03=_0x18b7e2[0x1];var _0x85ef38=_0x18b7e2[0x0];var _0x4f694c={};_0x4f694c[_0x67cf('0x7')]=_0x18b7e2[0x8]+_0x67cf('0x8')+_0xa1c069+'|'+_0x5eb72f+'|'+_0x249298+'|'+_0x2c0025+'|'+_0x3ae919;_0x4f694c[_0x67cf('0x9')]=_0x18b7e2[0x7]+_0x67cf('0x8')+_0xa1c069+'|'+_0x5eb72f+'|'+_0x249298+'|'+_0x2c0025+'|'+_0x3ae919+'|'+_0x189137+'|'+_0x71496b;_0x4f694c[_0x67cf('0xa')]=_0x18b7e2[0x9];var _0x32d82f={};_0x32d82f['jsonrpc']=_0x67cf('0xb');_0x32d82f[_0x67cf('0xc')]=_0x67cf('0xd');var _0x2a9f6c=[];_0x2a9f6c[_0x67cf('0x6')](_0x18b7e2[0x2]);_0x2a9f6c[_0x67cf('0x6')](_0x18b7e2[0x5]);_0x2a9f6c['push'](_0x18b7e2[0x6]);_0x32d82f[_0x67cf('0xe')]=_0x2a9f6c;_0x32d82f['id']=0x1;var _0x44b0b2=JSON[_0x67cf('0xf')](_0x32d82f);var _0x3d1acf={'encoding':_0x67cf('0x10'),'method':_0x67cf('0x11'),'timeout':0x2710,'url':_0x31c6fb,'headers':{'Content-Type':_0x67cf('0x12')},'body':_0x44b0b2};return rp(_0x3d1acf)[_0x67cf('0x13')](function(_0x1a2251){const _0xcedd2d=JSON[_0x67cf('0x14')](_0x1a2251);if(!_0xcedd2d[_0x67cf('0x15')]['logged']){throw new Error(_0x67cf('0x16'));}var _0x566726=_0x2c0025;var _0x186fdd='channelId='+_0x549a03+'&serviceId='+_0x85ef38+'&sessionId='+_0x566726+_0x67cf('0x17')+JSON[_0x67cf('0xf')](_0x4f694c);var _0x59186b=_0x25518e+'?'+_0x186fdd;return rp(_0x59186b);})['then'](function(_0x219e18){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x1638e0,_0x219e18);_0x5dac3d['stop']();})['catch'](function(_0x4078fe){logger[_0x67cf('0x18')](_0x67cf('0x19'),_0x1638e0,_[_0x67cf('0x1a')](_0x4078fe)?JSON['stringify'](_0x4078fe):_0x4078fe);_0x5dac3d[_0x67cf('0x1b')]();});}else{logger[_0x67cf('0x1c')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1638e0);_0x5dac3d[_0x67cf('0x1d')]();}};}; \ No newline at end of file +var _0x2d14=['params','stringify','utf8','application/json-rpc','then','result','logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','method','login'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x2d14,0x75));var _0x42d1=function(_0x1a5a6d,_0x42518c){_0x1a5a6d=_0x1a5a6d-0x0;var _0x2b2b3e=_0x2d14[_0x1a5a6d];return _0x2b2b3e;};'use strict';var rp=require(_0x42d1('0x0'));var logger=require('../../../../config/logger')(_0x42d1('0x1'));var _=require(_0x42d1('0x2'));var arr=[];exports[_0x42d1('0x3')]=function(_0x393f9e,_0x501155){return function(_0x236c8c){var _0x5084d5=_0x501155[0xa];var _0x3e7c21=_0x501155[0xb];var _0x3c850c=_0x501155[0xc];var _0x239e72=_0x501155[0xd];var _0x46ba9c=_0x501155[0xe];var _0x3e8b3c=_0x501155[0xf][_0x42d1('0x4')](/\n/g,_0x42d1('0x5'));var _0x1103cf=_0x501155[0x10][_0x42d1('0x4')](/\n/g,'\x20');if(!arr[_0x42d1('0x6')](_0x3e7c21)){arr[_0x42d1('0x7')](_0x3e7c21);var _0x9d0472=_0x501155[0x3];var _0x44bd49=_0x501155[0x4];var _0x4b2efd=_0x501155[0x1];var _0x1a45b5=_0x501155[0x0];var _0x4da19f={};_0x4da19f['urlOnAnswer']=_0x501155[0x8]+_0x42d1('0x8')+_0x3c850c+'|'+_0x5084d5+'|'+_0x239e72+'|'+_0x3e7c21+'|'+_0x46ba9c;_0x4da19f[_0x42d1('0x9')]=_0x501155[0x7]+_0x42d1('0x8')+_0x3c850c+'|'+_0x5084d5+'|'+_0x239e72+'|'+_0x3e7c21+'|'+_0x46ba9c+'|'+_0x3e8b3c+'|'+_0x1103cf;_0x4da19f[_0x42d1('0xa')]=_0x501155[0x9];var _0x12f4f4={};_0x12f4f4[_0x42d1('0xb')]=_0x42d1('0xc');_0x12f4f4[_0x42d1('0xd')]=_0x42d1('0xe');var _0xa92848=[];_0xa92848[_0x42d1('0x7')](_0x501155[0x2]);_0xa92848['push'](_0x501155[0x5]);_0xa92848[_0x42d1('0x7')](_0x501155[0x6]);_0x12f4f4[_0x42d1('0xf')]=_0xa92848;_0x12f4f4['id']=0x1;var _0x451386=JSON[_0x42d1('0x10')](_0x12f4f4);var _0x22e208={'encoding':_0x42d1('0x11'),'method':'POST','timeout':0x2710,'url':_0x9d0472,'headers':{'Content-Type':_0x42d1('0x12')},'body':_0x451386};return rp(_0x22e208)[_0x42d1('0x13')](function(_0xcb684d){const _0x17eeae=JSON['parse'](_0xcb684d);if(!_0x17eeae[_0x42d1('0x14')][_0x42d1('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x129202=_0x3e7c21;var _0x364436=_0x42d1('0x16')+_0x4b2efd+_0x42d1('0x17')+_0x1a45b5+_0x42d1('0x18')+_0x129202+'&data='+JSON['stringify'](_0x4da19f);var _0x415891=_0x44bd49+'?'+_0x364436;return rp(_0x415891);})[_0x42d1('0x13')](function(_0x38d5f9){logger[_0x42d1('0x19')](_0x42d1('0x1a'),_0x393f9e,_0x38d5f9);_0x236c8c[_0x42d1('0x1b')]();})[_0x42d1('0x1c')](function(_0x3060df){logger[_0x42d1('0x1d')](_0x42d1('0x1e'),_0x393f9e,_['isObject'](_0x3060df)?JSON['stringify'](_0x3060df):_0x3060df);_0x236c8c[_0x42d1('0x1b')]();});}else{logger['info'](_0x42d1('0x1f'),_0x393f9e);_0x236c8c[_0x42d1('0x20')]();}};}; \ 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 7e40bdb..e3a1514 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4fd12c,_0x6cc87c){var _0x105174=function(_0xa84fe0){while(--_0xa84fe0){_0x4fd12c['push'](_0x4fd12c['shift']());}};_0x105174(++_0x6cc87c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x41577a,_0x2f2a68){var _0x85eb08=function(_0x2ef7e3){while(--_0x2ef7e3){_0x41577a['push'](_0x41577a['shift']());}};_0x85eb08(++_0x2f2a68);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1316e00..eaf9b09 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 _0xa446=['127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','catch','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http'];(function(_0x21ecc8,_0x2bdead){var _0x510c1d=function(_0x3b6862){while(--_0x3b6862){_0x21ecc8['push'](_0x21ecc8['shift']());}};_0x510c1d(++_0x2bdead);}(_0xa446,0xc6));var _0x6a44=function(_0x4d822c,_0x3ae665){_0x4d822c=_0x4d822c-0x0;var _0xdc2439=_0xa446[_0x4d822c];return _0xdc2439;};'use strict';var _=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x6a44('0x2'));var BPromise=require('bluebird');var uuid=require(_0x6a44('0x3'));var utils=require('./applications/utils');var config=require(_0x6a44('0x4'));var logger=require('../../../config/logger')(_0x6a44('0x5'));var rpc={'openchannelQueueReport':require(_0x6a44('0x6')),'mailQueueReport':require(_0x6a44('0x7')),'chatQueueReport':require(_0x6a44('0x8')),'smsQueueReport':require(_0x6a44('0x9')),'faxQueueReport':require(_0x6a44('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6a44('0xb'));function getId(_0x36a426,_0x4f72f8,_0x78c684){return util[_0x6a44('0xc')]('%s.%s.%s',_0x36a426,_0x4f72f8||0x0,_0x78c684||0x0);}function getIntervals(_0x38a9ad,_0x2657b9){var _0x419ccd=[];if(!_[_0x6a44('0xd')](_0x2657b9[_0x6a44('0xe')])&&!_[_0x6a44('0xd')](_0x38a9ad[_0x2657b9[_0x6a44('0xe')]])&&!_['isNil'](_0x38a9ad[_0x2657b9[_0x6a44('0xe')]][_0x6a44('0xf')])){_0x419ccd=_['map'](_0x38a9ad[_0x2657b9[_0x6a44('0xe')]][_0x6a44('0xf')],_0x6a44('0x10'));}else if(!_['isNil'](_0x2657b9[_0x6a44('0x10')])){_0x419ccd=[_0x2657b9[_0x6a44('0x10')]];}return _0x419ccd;}exports[_0x6a44('0x11')]=function(_0xb1d987){_0xb1d987[_0x6a44('0x12')]={};return new BPromise(function(_0x1481ed,_0x553bc1){var _0x52aa9c={'Start':function(_0x260be6){var _0x973938=this;return new Promise(function(_0x577275,_0xa665c0){if(_0x260be6){try{var _0x38f796=[];var _0x41af8f=getId(_0x260be6[_0x6a44('0x13')],_0x260be6[_0x6a44('0x14')]?_0x260be6[_0x6a44('0x14')]['id']:0x0,_0x260be6[_0x6a44('0x15')]?_0x260be6[_0x6a44('0x15')]['id']:0x0);if(_0x260be6[_0x6a44('0x16')]&&_[_0x6a44('0x17')](_0x260be6[_0x6a44('0x16')])&&_0x260be6[_0x6a44('0x16')][_0x6a44('0x18')]){for(var _0x108c4b=0x0;_0x108c4b<_0x260be6['applications']['length'];_0x108c4b+=0x1){var _0x5e3673=_0x260be6[_0x6a44('0x16')][_0x108c4b];if(fs[_0x6a44('0x19')](path[_0x6a44('0x1a')](__dirname,_0x6a44('0x16'),_0x5e3673['app']+_0x6a44('0x1b')))){var _0x24ba62=[];switch(_0x5e3673['app'][_0x6a44('0x1c')]()){case _0x6a44('0x1d'):var _0x406247=_0x5e3673[_0x6a44('0x1e')][_0x6a44('0x1f')](',');if(_0x260be6[_0x6a44('0x13')]===_0x6a44('0x20')){_0x24ba62[_0x6a44('0x21')](_0x406247[0x0]);_0x24ba62[_0x6a44('0x21')](_0x406247[0x1]);_0x24ba62['push'](_0x406247[_0x6a44('0x22')](0x2,_0x406247[_0x6a44('0x18')])[_0x6a44('0x1a')](','));}else{_0x24ba62[_0x6a44('0x21')](_0x406247[0x0]);_0x24ba62['push'](_0x406247[_0x6a44('0x22')](0x1,_0x406247['length'])[_0x6a44('0x1a')](','));}break;case _0x6a44('0x23'):var _0x23d6a1=_0x5e3673[_0x6a44('0x1e')][_0x6a44('0x1f')](',');_0x24ba62[_0x6a44('0x21')](_0x23d6a1[0x0]);_0x24ba62[_0x6a44('0x21')](_0x23d6a1[0x1]);_0x24ba62[_0x6a44('0x21')](_0x23d6a1[_0x6a44('0x22')](0x2,_0x23d6a1['length'])['join'](','));break;case _0x6a44('0x24'):var _0x5abc23=_0x5e3673[_0x6a44('0x1e')]['split'](',');_0x24ba62['push'](_0x5abc23[0x0]);_0x24ba62[_0x6a44('0x21')](_0x5abc23[0x1]);_0x24ba62[_0x6a44('0x21')](_0x5abc23[0x2]);_0x24ba62[_0x6a44('0x21')](_0x5abc23[0x3]);_0x24ba62['push'](_0x5abc23[_0x6a44('0x22')](0x4,_0x5abc23['length'])[_0x6a44('0x1a')](','));break;case _0x6a44('0x25'):var _0x4b41c6=_0x5e3673['appdata'][_0x6a44('0x1f')](',');_0x24ba62[_0x6a44('0x21')](_0x4b41c6[0x0]);_0x24ba62[_0x6a44('0x21')](_0x4b41c6[0x1]);_0x24ba62['push'](_0x4b41c6[0x2]);_0x24ba62['push'](_0x4b41c6[0x3]);_0x24ba62[_0x6a44('0x21')](_0x4b41c6[_0x6a44('0x22')](0x4,_0x4b41c6[_0x6a44('0x18')])['join'](','));break;case _0x6a44('0x14'):_0x24ba62[_0x6a44('0x21')](_0x5e3673[_0x6a44('0x1e')]);break;case _0x6a44('0x26'):_0x24ba62[_0x6a44('0x21')](_0x5e3673[_0x6a44('0x27')]);_0x24ba62[_0x6a44('0x21')](_0x5e3673[_0x6a44('0x1e')]);break;case _0x6a44('0x28'):var _0x42d95a=utils[_0x6a44('0x29')](_0x260be6[_0x6a44('0x2a')]['notificationTemplate'],_0x260be6);var _0x198977=_0x5e3673['appdata']['split'](',');_0x24ba62['push'](_0x198977[0x0]);_0x24ba62['push'](_0x198977[0x1]);_0x24ba62[_0x6a44('0x21')](_0x198977[0x2]);_0x24ba62['push'](_0x198977[0x3]);_0x24ba62[_0x6a44('0x21')](_0x198977[0x4]);_0x24ba62['push'](_0x198977[0x5]);_0x24ba62[_0x6a44('0x21')](_0x198977[0x6]);_0x24ba62[_0x6a44('0x21')](_0x198977[0x7]);_0x24ba62['push'](_0x198977[0x8]);_0x24ba62['push'](_0x198977[0x9]);_0x24ba62[_0x6a44('0x21')](_0x198977[0xa]);_0x24ba62[_0x6a44('0x21')](_0x260be6[_0x6a44('0x15')]['id']);_0x24ba62[_0x6a44('0x21')](_0x260be6['message']['id']);_0x24ba62[_0x6a44('0x21')](_0x5e3673[_0x6a44('0x2b')]);_0x24ba62[_0x6a44('0x21')](_0x260be6[_0x6a44('0x15')][_0x6a44('0x2c')]);_0x24ba62[_0x6a44('0x21')](_0x260be6['body'][_0x6a44('0x2d')]);_0x24ba62[_0x6a44('0x21')](_0x42d95a);break;default:_0x24ba62=_['isNil'](_0x5e3673[_0x6a44('0x1e')])?[]:_0x5e3673['appdata'][_0x6a44('0x1f')](',');}var _0x527df6={'id':util[_0x6a44('0xc')](_0x6a44('0x2e'),_0x41af8f,_0x5e3673['id'],_0x5e3673[_0x6a44('0x2f')]),'condition':require(_0x6a44('0x30'))[_0x6a44('0x31')](_0x41af8f,getIntervals(_0xb1d987['intervals'],_0x5e3673),_0xb1d987),'consequence':require(_0x6a44('0x32')+_0x5e3673[_0x6a44('0x2f')])[_0x6a44('0x33')](_0x41af8f,_0x24ba62,_0xb1d987,_0x260be6),'p':_0x5e3673['priority']||0x0};logger[_0x6a44('0x34')](_0x6a44('0x35'),_0x527df6['id'],'on\x20interval',getIntervals(_0xb1d987['intervals'],_0x5e3673)['join']('\x20|\x20'));_0x38f796[_0x6a44('0x21')](_0x527df6);}else{logger[_0x6a44('0x36')](_0x6a44('0x37'),path[_0x6a44('0x1a')](__dirname,_0x6a44('0x16'),_0x5e3673['app']+'.js'));}}_0xb1d987[_0x6a44('0x12')][_0x41af8f]=new RuleEngine(_0x38f796);_0xb1d987[_0x6a44('0x12')][_0x41af8f][_0x6a44('0x38')](_0x260be6,function(_0x4eb5d6){logger[_0x6a44('0x34')](_0x6a44('0x39'),JSON[_0x6a44('0x3a')](_0x4eb5d6['matchPath']));if(_0xb1d987[_0x6a44('0x12')][_0x41af8f]){_0xb1d987[_0x6a44('0x12')][_0x41af8f][_0x6a44('0x3b')](_0x6a44('0x3c'));}});return _0x577275({'code':0xc8,'message':_0x260be6});}else{logger[_0x6a44('0x34')](_0x6a44('0x3d'));return _0x577275({'code':0xc8,'message':_0x260be6});}}catch(_0x32b24d){logger[_0x6a44('0x36')](_0x32b24d['stack']);return _0xa665c0(_0x973938[_0x6a44('0x36')](0x1f4,_0x32b24d));}}return _0xa665c0(_0x6a44('0x3e'));});},'AcceptMessage':function(_0x2ccdbc){var _0x446fbf=this;return new Promise(function(_0x1362c7,_0x3fcb0b){if(_0x2ccdbc[_0x6a44('0x3f')]&&_0x2ccdbc[_0x6a44('0x3f')]['id']){if(_0xb1d987[_0x6a44('0x40')][_0x2ccdbc['agent']['id']]){_0xb1d987[_0x6a44('0x40')][_0x2ccdbc[_0x6a44('0x3f')]['id']][_0x6a44('0x41')]=![];_0xb1d987[_0x6a44('0x40')][_0x2ccdbc[_0x6a44('0x3f')]['id']][_0x6a44('0x42')]=undefined;}}if(_0x2ccdbc[_0x6a44('0x14')]&&_0x2ccdbc[_0x6a44('0x14')]['id']){try{var _0x4de88b=getId(_0x2ccdbc[_0x6a44('0x13')],_0x2ccdbc[_0x6a44('0x14')]?_0x2ccdbc[_0x6a44('0x14')]['id']:0x0,_0x2ccdbc['interaction']?_0x2ccdbc[_0x6a44('0x15')]['id']:0x0);if(_0xb1d987['rules'][_0x4de88b]){_0xb1d987['rules'][_0x4de88b][_0x6a44('0x3b')](_0x6a44('0x43'));if(rpc[_0x2ccdbc['channel']+'QueueReport']){rpc[_0x2ccdbc[_0x6a44('0x13')]+_0x6a44('0x44')]['update'](_0x4de88b,{'UserId':_0x2ccdbc[_0x6a44('0x14')]['UserId']})[_0x6a44('0x45')](function(_0x434ded){logger[_0x6a44('0x36')]('error\x20update\x20queue\x20report');});}}return _0x1362c7({'code':0xc8,'message':_0x2ccdbc});}catch(_0x52b343){logger['error'](_0x52b343['stack']);return _0x3fcb0b(_0x446fbf[_0x6a44('0x36')](0x1f4,_0x52b343));}}logger[_0x6a44('0x36')](_0x6a44('0x46'));return _0x3fcb0b(_0x446fbf[_0x6a44('0x36')](0x1f4,_0x6a44('0x46')));});},'RejectMessage':function(_0x598d7a){var _0x288224=this;return new Promise(function(_0x560ab2,_0x28855c){if(_0x598d7a[_0x6a44('0x3f')]&&_0x598d7a['agent']['id']){try{if(_0xb1d987[_0x6a44('0x40')][_0x598d7a[_0x6a44('0x3f')]['id']]){_0xb1d987['agents'][_0x598d7a[_0x6a44('0x3f')]['id']][_0x6a44('0x41')]=![];_0xb1d987[_0x6a44('0x40')][_0x598d7a[_0x6a44('0x3f')]['id']][_0x6a44('0x42')]=undefined;}return _0x560ab2({'code':0xc8,'message':_0x598d7a});}catch(_0x40fd42){logger[_0x6a44('0x36')](_0x40fd42[_0x6a44('0x47')]);return _0x28855c(_0x288224[_0x6a44('0x36')](0x1f4,_0x40fd42));}}logger[_0x6a44('0x36')]('message\x20is\x20empty');return _0x28855c(_0x288224[_0x6a44('0x36')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1e3ac1){var _0x2eb803=this;return new Promise(function(_0x224d7c,_0x11d9b2){if(_0x1e3ac1[_0x6a44('0x13')]&&_0x1e3ac1['interaction']&&_0x1e3ac1[_0x6a44('0x15')]['id']){try{var _0x13231c=getId(_0x1e3ac1[_0x6a44('0x13')],_0x1e3ac1[_0x6a44('0x14')]?_0x1e3ac1[_0x6a44('0x14')]['id']:0x0,_0x1e3ac1[_0x6a44('0x15')]?_0x1e3ac1[_0x6a44('0x15')]['id']:0x0);if(_0xb1d987[_0x6a44('0x12')][_0x13231c]){_0xb1d987[_0x6a44('0x12')][_0x13231c][_0x6a44('0x3b')](_0x6a44('0x43'));}return _0x224d7c({'code':0xc8,'message':_0x1e3ac1});}catch(_0x51e7df){logger[_0x6a44('0x36')](_0x51e7df[_0x6a44('0x47')]);return _0x11d9b2(_0x2eb803[_0x6a44('0x36')](0x1f4,_0x51e7df));}}logger[_0x6a44('0x36')](_0x6a44('0x46'));return _0x11d9b2(_0x2eb803[_0x6a44('0x36')](0x1f4,_0x6a44('0x46')));});},'AgentCapacity':function(_0x330263){var _0x276625=this;return new Promise(function(_0x4fabb8,_0x1d6d70){if(_0xb1d987[_0x6a44('0x40')][_0x6a44('0x48')](_0x330263['id'])){for(var _0x800265 in _0x330263['capacity']){if(_0x330263[_0x6a44('0x49')][_0x6a44('0x48')](_0x800265)){if(_0xb1d987[_0x6a44('0x40')][_0x330263['id']]['hasOwnProperty'](_0x800265+_0x6a44('0x4a'))){_0xb1d987['agents'][_0x330263['id']][_0x800265+'CurrentCapacity']=parseInt(_0x330263[_0x6a44('0x49')][_0x800265],0xa);}}}_0xb1d987[_0x6a44('0x40')][_0x330263['id']][_0x6a44('0x4b')]();return _0x4fabb8({'code':0xc8,'message':_0xb1d987[_0x6a44('0x40')][_0x330263['id']]});}else{return _0x1d6d70(_0x276625[_0x6a44('0x36')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x5b8d44){return new Promise(function(_0x362607,_0x50c12b){var _0x4abebd=_[_0x6a44('0x4c')](_0xb1d987[_0x6a44('0x40')]);_0x362607({'count':_0x4abebd[_0x6a44('0x18')],'rows':_0x4abebd});});},'ChatQueues':function(_0x2aaea3){return new Promise(function(_0x5e02ed,_0x214529){var _0x564be2=[];for(var _0x59b390 in _0xb1d987['chatQueues']){if(_0xb1d987[_0x6a44('0x4d')][_0x6a44('0x48')](_0x59b390)){var _0x418a7e=_0xb1d987['chatQueues'][_0x59b390];var _0x252ea4={'id':_0x418a7e['id'],'available':_0x418a7e[_0x6a44('0x4e')],'loggedIn':_0x418a7e[_0x6a44('0x4f')],'name':_0x418a7e[_0x6a44('0x50')],'paused':_0x418a7e[_0x6a44('0x51')],'waiting':_0x418a7e[_0x6a44('0x52')]};_0x564be2['push'](_0x252ea4);}}_0x5e02ed({'count':_0x564be2[_0x6a44('0x18')],'rows':_0x564be2});});},'MailQueues':function(_0x20d5bf){return new Promise(function(_0x4f3890,_0x3d6dc6){var _0x3fdddf=[];for(var _0x3c95e1 in _0xb1d987['mailQueues']){if(_0xb1d987['mailQueues'][_0x6a44('0x48')](_0x3c95e1)){var _0x30a300=_0xb1d987['mailQueues'][_0x3c95e1];var _0x21f957={'id':_0x30a300['id'],'available':_0x30a300['available'],'loggedIn':_0x30a300[_0x6a44('0x4f')],'name':_0x30a300[_0x6a44('0x50')],'paused':_0x30a300[_0x6a44('0x51')],'waiting':_0x30a300[_0x6a44('0x52')]};_0x3fdddf['push'](_0x21f957);}}_0x4f3890({'count':_0x3fdddf['length'],'rows':_0x3fdddf});});},'OpenchannelQueues':function(_0x1d202c){return new Promise(function(_0x46dbe5,_0x46a77a){var _0x229bc4=[];for(var _0x230932 in _0xb1d987[_0x6a44('0x53')]){if(_0xb1d987[_0x6a44('0x53')][_0x6a44('0x48')](_0x230932)){var _0x36e872=_0xb1d987[_0x6a44('0x53')][_0x230932];var _0x8d2ac7={'id':_0x36e872['id'],'available':_0x36e872[_0x6a44('0x4e')],'loggedIn':_0x36e872[_0x6a44('0x4f')],'name':_0x36e872[_0x6a44('0x50')],'paused':_0x36e872[_0x6a44('0x51')],'waiting':_0x36e872[_0x6a44('0x52')]};_0x229bc4[_0x6a44('0x21')](_0x8d2ac7);}}_0x46dbe5({'count':_0x229bc4[_0x6a44('0x18')],'rows':_0x229bc4});});},'SmsQueues':function(_0x566c17){return new Promise(function(_0x35459e,_0x5374f2){var _0x15fd6d=[];for(var _0x469433 in _0xb1d987[_0x6a44('0x54')]){if(_0xb1d987[_0x6a44('0x54')]['hasOwnProperty'](_0x469433)){var _0x33ddac=_0xb1d987[_0x6a44('0x54')][_0x469433];var _0x984f87={'id':_0x33ddac['id'],'available':_0x33ddac[_0x6a44('0x4e')],'loggedIn':_0x33ddac[_0x6a44('0x4f')],'name':_0x33ddac[_0x6a44('0x50')],'paused':_0x33ddac['paused'],'waiting':_0x33ddac[_0x6a44('0x52')]};_0x15fd6d[_0x6a44('0x21')](_0x984f87);}}_0x35459e({'count':_0x15fd6d[_0x6a44('0x18')],'rows':_0x15fd6d});});},'FaxQueues':function(_0x34e348){return new Promise(function(_0x36c59d,_0x13aead){var _0x57fd0b=[];for(var _0x1c813c in _0xb1d987[_0x6a44('0x55')]){if(_0xb1d987['faxQueues'][_0x6a44('0x48')](_0x1c813c)){var _0x463126=_0xb1d987[_0x6a44('0x55')][_0x1c813c];var _0x4cd9f5={'id':_0x463126['id'],'available':_0x463126[_0x6a44('0x4e')],'loggedIn':_0x463126['loggedIn'],'name':_0x463126[_0x6a44('0x50')],'paused':_0x463126['paused'],'waiting':_0x463126[_0x6a44('0x52')]};_0x57fd0b['push'](_0x4cd9f5);}}_0x36c59d({'count':_0x57fd0b[_0x6a44('0x18')],'rows':_0x57fd0b});});},'WhatsappQueues':function(_0x457d9e){return new Promise(function(_0xeba1e2,_0x4e6082){var _0x576cd9=[];for(var _0x8b5a04 in _0xb1d987[_0x6a44('0x56')]){if(_0xb1d987[_0x6a44('0x56')][_0x6a44('0x48')](_0x8b5a04)){var _0x2f1c3e=_0xb1d987['whatsappQueues'][_0x8b5a04];var _0xdb434a={'id':_0x2f1c3e['id'],'available':_0x2f1c3e[_0x6a44('0x4e')],'loggedIn':_0x2f1c3e[_0x6a44('0x4f')],'name':_0x2f1c3e[_0x6a44('0x50')],'paused':_0x2f1c3e[_0x6a44('0x51')],'waiting':_0x2f1c3e[_0x6a44('0x52')]};_0x576cd9[_0x6a44('0x21')](_0xdb434a);}}_0xeba1e2({'count':_0x576cd9['length'],'rows':_0x576cd9});});},'ChatQueuesWaitingInteractions':function(_0x322129){return new Promise(function(_0x25681f,_0x2ec199){var _0x7c3bc7=_[_0x6a44('0x4c')](_0xb1d987[_0x6a44('0x57')]);_0x25681f({'count':_0x7c3bc7[_0x6a44('0x18')],'rows':_0x7c3bc7});});},'MailQueuesWaitingInteractions':function(_0x2f383e){return new Promise(function(_0x13f364,_0x49d513){var _0x4781fb=_[_0x6a44('0x4c')](_0xb1d987['mailQueuesWaitingInteractions']);_0x13f364({'count':_0x4781fb['length'],'rows':_0x4781fb});});},'OpenchannelQueuesWaitingInteractions':function(_0x417f64){return new Promise(function(_0x44a2e2,_0xcf855c){var _0x1ca4c9=_[_0x6a44('0x4c')](_0xb1d987['openchannelQueuesWaitingInteractions']);_0x44a2e2({'count':_0x1ca4c9[_0x6a44('0x18')],'rows':_0x1ca4c9});});},'SmsQueuesWaitingInteractions':function(_0x5a93ea){return new Promise(function(_0x14096b,_0x1bf50d){var _0x301bce=_['values'](_0xb1d987[_0x6a44('0x58')]);_0x14096b({'count':_0x301bce[_0x6a44('0x18')],'rows':_0x301bce});});},'FaxQueuesWaitingInteractions':function(_0x2b450d){return new Promise(function(_0x3cc19d,_0x114eb0){var _0x43d9d5=_['values'](_0xb1d987[_0x6a44('0x59')]);_0x3cc19d({'count':_0x43d9d5['length'],'rows':_0x43d9d5});});},'WhatsappQueuesWaitingInteractions':function(_0x48fec3){return new Promise(function(_0x1ab60b,_0x44e1f0){var _0x51880a=_['values'](_0xb1d987[_0x6a44('0x5a')]);_0x1ab60b({'count':_0x51880a[_0x6a44('0x18')],'rows':_0x51880a});});}};var _0x10917d=jayson[_0x6a44('0x5b')](_0x52aa9c)[_0x6a44('0x5c')]();_0x10917d['on'](_0x6a44('0x36'),function(_0x208c6e){logger[_0x6a44('0x36')](JSON[_0x6a44('0x3a')](_0x208c6e));return _0x553bc1(_0x208c6e);});_0x10917d[_0x6a44('0x11')](0x232c,_0x6a44('0x5d'),function(){console[_0x6a44('0x5e')](_0x6a44('0x5f'),0x232c);return _0x1481ed(_0x6a44('0x60')+0x232c);});});}; \ No newline at end of file +var _0x05b0=['existsSync','join','.js','app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','path','jayson/promise','uuid','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','isArray','applications','length'];(function(_0x10890a,_0x282ef5){var _0x4a91bb=function(_0x43d9d5){while(--_0x43d9d5){_0x10890a['push'](_0x10890a['shift']());}};_0x4a91bb(++_0x282ef5);}(_0x05b0,0x188));var _0x005b=function(_0x190f0f,_0x55ef9c){_0x190f0f=_0x190f0f-0x0;var _0x4d6736=_0x05b0[_0x190f0f];return _0x4d6736;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0x005b('0x0'));var fs=require('fs');var jayson=require(_0x005b('0x1'));var BPromise=require('bluebird');var uuid=require(_0x005b('0x2'));var utils=require(_0x005b('0x3'));var config=require('../../../config/environment');var logger=require(_0x005b('0x4'))(_0x005b('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x005b('0x6')),'chatQueueReport':require(_0x005b('0x7')),'smsQueueReport':require(_0x005b('0x8')),'faxQueueReport':require(_0x005b('0x9')),'whatsappQueueReport':require(_0x005b('0xa'))};var RuleEngine=require(_0x005b('0xb'));function getId(_0x263bc9,_0x5cff7f,_0x224892){return util[_0x005b('0xc')]('%s.%s.%s',_0x263bc9,_0x5cff7f||0x0,_0x224892||0x0);}function getIntervals(_0x53fff4,_0x451641){var _0x4d41b8=[];if(!_['isNil'](_0x451641['IntervalId'])&&!_[_0x005b('0xd')](_0x53fff4[_0x451641[_0x005b('0xe')]])&&!_['isNil'](_0x53fff4[_0x451641[_0x005b('0xe')]][_0x005b('0xf')])){_0x4d41b8=_[_0x005b('0x10')](_0x53fff4[_0x451641[_0x005b('0xe')]][_0x005b('0xf')],_0x005b('0x11'));}else if(!_[_0x005b('0xd')](_0x451641['interval'])){_0x4d41b8=[_0x451641['interval']];}return _0x4d41b8;}exports['listen']=function(_0x309c8f){_0x309c8f['rules']={};return new BPromise(function(_0x3e2c82,_0x52f822){var _0x1c8eed={'Start':function(_0x1f7743){var _0x2ce01e=this;return new Promise(function(_0x1991e8,_0x337ca1){if(_0x1f7743){try{var _0x500c1a=[];var _0xa3c3fb=getId(_0x1f7743[_0x005b('0x12')],_0x1f7743[_0x005b('0x13')]?_0x1f7743['message']['id']:0x0,_0x1f7743[_0x005b('0x14')]?_0x1f7743[_0x005b('0x14')]['id']:0x0);if(_0x1f7743['applications']&&_[_0x005b('0x15')](_0x1f7743[_0x005b('0x16')])&&_0x1f7743[_0x005b('0x16')][_0x005b('0x17')]){for(var _0xf51601=0x0;_0xf51601<_0x1f7743['applications'][_0x005b('0x17')];_0xf51601+=0x1){var _0x38cc3b=_0x1f7743['applications'][_0xf51601];if(fs[_0x005b('0x18')](path[_0x005b('0x19')](__dirname,_0x005b('0x16'),_0x38cc3b['app']+_0x005b('0x1a')))){var _0x145c36=[];switch(_0x38cc3b[_0x005b('0x1b')][_0x005b('0x1c')]()){case _0x005b('0x1d'):var _0x2e3ccd=_0x38cc3b['appdata'][_0x005b('0x1e')](',');if(_0x1f7743[_0x005b('0x12')]===_0x005b('0x1f')){_0x145c36['push'](_0x2e3ccd[0x0]);_0x145c36[_0x005b('0x20')](_0x2e3ccd[0x1]);_0x145c36['push'](_0x2e3ccd[_0x005b('0x21')](0x2,_0x2e3ccd['length'])['join'](','));}else{_0x145c36[_0x005b('0x20')](_0x2e3ccd[0x0]);_0x145c36[_0x005b('0x20')](_0x2e3ccd[_0x005b('0x21')](0x1,_0x2e3ccd[_0x005b('0x17')])[_0x005b('0x19')](','));}break;case _0x005b('0x22'):var _0x3d4a1c=_0x38cc3b[_0x005b('0x23')]['split'](',');_0x145c36[_0x005b('0x20')](_0x3d4a1c[0x0]);_0x145c36[_0x005b('0x20')](_0x3d4a1c[0x1]);_0x145c36[_0x005b('0x20')](_0x3d4a1c[_0x005b('0x21')](0x2,_0x3d4a1c[_0x005b('0x17')])[_0x005b('0x19')](','));break;case _0x005b('0x24'):var _0x49561a=_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x49561a[0x0]);_0x145c36[_0x005b('0x20')](_0x49561a[0x1]);_0x145c36['push'](_0x49561a[0x2]);_0x145c36['push'](_0x49561a[0x3]);_0x145c36[_0x005b('0x20')](_0x49561a[_0x005b('0x21')](0x4,_0x49561a['length'])['join'](','));break;case _0x005b('0x25'):var _0x5b555f=_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x5b555f[0x0]);_0x145c36['push'](_0x5b555f[0x1]);_0x145c36['push'](_0x5b555f[0x2]);_0x145c36[_0x005b('0x20')](_0x5b555f[0x3]);_0x145c36[_0x005b('0x20')](_0x5b555f[_0x005b('0x21')](0x4,_0x5b555f['length'])['join'](','));break;case _0x005b('0x13'):_0x145c36[_0x005b('0x20')](_0x38cc3b['appdata']);break;case _0x005b('0x26'):_0x145c36['push'](_0x38cc3b[_0x005b('0x27')]);_0x145c36['push'](_0x38cc3b['appdata']);break;case _0x005b('0x28'):var _0x413d90=utils[_0x005b('0x29')](_0x1f7743[_0x005b('0x2a')][_0x005b('0x2b')],_0x1f7743);var _0x52bffe=_0x38cc3b['appdata'][_0x005b('0x1e')](',');_0x145c36[_0x005b('0x20')](_0x52bffe[0x0]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x1]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x2]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x3]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x4]);_0x145c36['push'](_0x52bffe[0x5]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x6]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x7]);_0x145c36[_0x005b('0x20')](_0x52bffe[0x8]);_0x145c36['push'](_0x52bffe[0x9]);_0x145c36[_0x005b('0x20')](_0x52bffe[0xa]);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x14')]['id']);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x13')]['id']);_0x145c36[_0x005b('0x20')](_0x38cc3b[_0x005b('0x2c')]);_0x145c36[_0x005b('0x20')](_0x1f7743[_0x005b('0x14')][_0x005b('0x2d')]);_0x145c36['push'](_0x1f7743[_0x005b('0x2e')][_0x005b('0x2e')]);_0x145c36['push'](_0x413d90);break;default:_0x145c36=_[_0x005b('0xd')](_0x38cc3b[_0x005b('0x23')])?[]:_0x38cc3b[_0x005b('0x23')][_0x005b('0x1e')](',');}var _0x4ec11c={'id':util[_0x005b('0xc')](_0x005b('0x2f'),_0xa3c3fb,_0x38cc3b['id'],_0x38cc3b['app']),'condition':require(_0x005b('0x30'))[_0x005b('0x31')](_0xa3c3fb,getIntervals(_0x309c8f[_0x005b('0x32')],_0x38cc3b),_0x309c8f),'consequence':require(_0x005b('0x33')+_0x38cc3b[_0x005b('0x1b')])['consequence'](_0xa3c3fb,_0x145c36,_0x309c8f,_0x1f7743),'p':_0x38cc3b['priority']||0x0};logger[_0x005b('0x34')](_0x005b('0x35'),_0x4ec11c['id'],_0x005b('0x36'),getIntervals(_0x309c8f[_0x005b('0x32')],_0x38cc3b)[_0x005b('0x19')]('\x20|\x20'));_0x500c1a[_0x005b('0x20')](_0x4ec11c);}else{logger[_0x005b('0x37')](_0x005b('0x38'),path[_0x005b('0x19')](__dirname,_0x005b('0x16'),_0x38cc3b[_0x005b('0x1b')]+'.js'));}}_0x309c8f[_0x005b('0x39')][_0xa3c3fb]=new RuleEngine(_0x500c1a);_0x309c8f['rules'][_0xa3c3fb][_0x005b('0x3a')](_0x1f7743,function(_0x26375b){logger['info'](_0x005b('0x3b'),JSON[_0x005b('0x3c')](_0x26375b[_0x005b('0x3d')]));if(_0x309c8f[_0x005b('0x39')][_0xa3c3fb]){_0x309c8f['rules'][_0xa3c3fb][_0x005b('0x3e')](_0x005b('0x3f'));}});return _0x1991e8({'code':0xc8,'message':_0x1f7743});}else{logger[_0x005b('0x34')](_0x005b('0x40'));return _0x1991e8({'code':0xc8,'message':_0x1f7743});}}catch(_0x3a5d41){logger[_0x005b('0x37')](_0x3a5d41[_0x005b('0x41')]);return _0x337ca1(_0x2ce01e[_0x005b('0x37')](0x1f4,_0x3a5d41));}}return _0x337ca1(_0x005b('0x42'));});},'AcceptMessage':function(_0x5699d8){var _0x1fed84=this;return new Promise(function(_0x30947e,_0x34fabc){if(_0x5699d8[_0x005b('0x43')]&&_0x5699d8[_0x005b('0x43')]['id']){if(_0x309c8f['agents'][_0x5699d8[_0x005b('0x43')]['id']]){_0x309c8f[_0x005b('0x44')][_0x5699d8[_0x005b('0x43')]['id']]['busy']=![];_0x309c8f[_0x005b('0x44')][_0x5699d8['agent']['id']]['busyQueue']=undefined;}}if(_0x5699d8['message']&&_0x5699d8['message']['id']){try{var _0x134a46=getId(_0x5699d8[_0x005b('0x12')],_0x5699d8[_0x005b('0x13')]?_0x5699d8[_0x005b('0x13')]['id']:0x0,_0x5699d8['interaction']?_0x5699d8[_0x005b('0x14')]['id']:0x0);if(_0x309c8f[_0x005b('0x39')][_0x134a46]){_0x309c8f['rules'][_0x134a46][_0x005b('0x3e')](_0x005b('0x45'));if(rpc[_0x5699d8[_0x005b('0x12')]+_0x005b('0x46')]){rpc[_0x5699d8[_0x005b('0x12')]+'QueueReport'][_0x005b('0x47')](_0x134a46,{'UserId':_0x5699d8[_0x005b('0x13')][_0x005b('0x48')]})[_0x005b('0x49')](function(_0x19ca85){logger[_0x005b('0x37')]('error\x20update\x20queue\x20report');});}}return _0x30947e({'code':0xc8,'message':_0x5699d8});}catch(_0x44fee3){logger[_0x005b('0x37')](_0x44fee3[_0x005b('0x41')]);return _0x34fabc(_0x1fed84[_0x005b('0x37')](0x1f4,_0x44fee3));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x34fabc(_0x1fed84['error'](0x1f4,_0x005b('0x4a')));});},'RejectMessage':function(_0x13a680){var _0x5cea23=this;return new Promise(function(_0x5bbc78,_0x22bf46){if(_0x13a680[_0x005b('0x43')]&&_0x13a680[_0x005b('0x43')]['id']){try{if(_0x309c8f[_0x005b('0x44')][_0x13a680[_0x005b('0x43')]['id']]){_0x309c8f[_0x005b('0x44')][_0x13a680[_0x005b('0x43')]['id']]['busy']=![];_0x309c8f[_0x005b('0x44')][_0x13a680['agent']['id']]['busyQueue']=undefined;}return _0x5bbc78({'code':0xc8,'message':_0x13a680});}catch(_0x35d9df){logger[_0x005b('0x37')](_0x35d9df[_0x005b('0x41')]);return _0x22bf46(_0x5cea23['error'](0x1f4,_0x35d9df));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x22bf46(_0x5cea23[_0x005b('0x37')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x17018b){var _0x4f4130=this;return new Promise(function(_0x41f077,_0x20540a){if(_0x17018b['channel']&&_0x17018b[_0x005b('0x14')]&&_0x17018b[_0x005b('0x14')]['id']){try{var _0x2a4559=getId(_0x17018b[_0x005b('0x12')],_0x17018b[_0x005b('0x13')]?_0x17018b[_0x005b('0x13')]['id']:0x0,_0x17018b['interaction']?_0x17018b[_0x005b('0x14')]['id']:0x0);if(_0x309c8f[_0x005b('0x39')][_0x2a4559]){_0x309c8f[_0x005b('0x39')][_0x2a4559][_0x005b('0x3e')](_0x005b('0x45'));}return _0x41f077({'code':0xc8,'message':_0x17018b});}catch(_0x630c8){logger['error'](_0x630c8[_0x005b('0x41')]);return _0x20540a(_0x4f4130['error'](0x1f4,_0x630c8));}}logger[_0x005b('0x37')](_0x005b('0x4a'));return _0x20540a(_0x4f4130[_0x005b('0x37')](0x1f4,_0x005b('0x4a')));});},'AgentCapacity':function(_0x31e6f5){var _0x2ee675=this;return new Promise(function(_0x31355d,_0x45f561){if(_0x309c8f[_0x005b('0x44')][_0x005b('0x4b')](_0x31e6f5['id'])){for(var _0x20a986 in _0x31e6f5[_0x005b('0x4c')]){if(_0x31e6f5[_0x005b('0x4c')][_0x005b('0x4b')](_0x20a986)){if(_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']]['hasOwnProperty'](_0x20a986+_0x005b('0x4d'))){_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']][_0x20a986+_0x005b('0x4d')]=parseInt(_0x31e6f5[_0x005b('0x4c')][_0x20a986],0xa);}}}_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']][_0x005b('0x4e')]();return _0x31355d({'code':0xc8,'message':_0x309c8f[_0x005b('0x44')][_0x31e6f5['id']]});}else{return _0x45f561(_0x2ee675['error'](0x1f4,_0x005b('0x4f')));}});},'Agents':function(_0x4a5ae5){return new Promise(function(_0x379b37,_0x4bd368){var _0x21d474=_[_0x005b('0x50')](_0x309c8f['agents']);_0x379b37({'count':_0x21d474[_0x005b('0x17')],'rows':_0x21d474});});},'ChatQueues':function(_0x275094){return new Promise(function(_0x10d9d2,_0x2b7f3e){var _0x2d3aeb=[];for(var _0x6fc481 in _0x309c8f[_0x005b('0x51')]){if(_0x309c8f[_0x005b('0x51')][_0x005b('0x4b')](_0x6fc481)){var _0x4262d9=_0x309c8f['chatQueues'][_0x6fc481];var _0x56209a={'id':_0x4262d9['id'],'available':_0x4262d9[_0x005b('0x52')],'loggedIn':_0x4262d9[_0x005b('0x53')],'name':_0x4262d9[_0x005b('0x54')],'paused':_0x4262d9[_0x005b('0x55')],'waiting':_0x4262d9[_0x005b('0x56')]};_0x2d3aeb[_0x005b('0x20')](_0x56209a);}}_0x10d9d2({'count':_0x2d3aeb[_0x005b('0x17')],'rows':_0x2d3aeb});});},'MailQueues':function(_0x28f177){return new Promise(function(_0x396db4,_0x34069e){var _0x3f0853=[];for(var _0x42ce59 in _0x309c8f[_0x005b('0x57')]){if(_0x309c8f['mailQueues'][_0x005b('0x4b')](_0x42ce59)){var _0x453e64=_0x309c8f['mailQueues'][_0x42ce59];var _0xaca777={'id':_0x453e64['id'],'available':_0x453e64[_0x005b('0x52')],'loggedIn':_0x453e64[_0x005b('0x53')],'name':_0x453e64[_0x005b('0x54')],'paused':_0x453e64[_0x005b('0x55')],'waiting':_0x453e64[_0x005b('0x56')]};_0x3f0853[_0x005b('0x20')](_0xaca777);}}_0x396db4({'count':_0x3f0853[_0x005b('0x17')],'rows':_0x3f0853});});},'OpenchannelQueues':function(_0x2c4280){return new Promise(function(_0x5a6146,_0x46cd37){var _0x30e985=[];for(var _0x7a2336 in _0x309c8f[_0x005b('0x58')]){if(_0x309c8f[_0x005b('0x58')][_0x005b('0x4b')](_0x7a2336)){var _0x11c502=_0x309c8f[_0x005b('0x58')][_0x7a2336];var _0x21c970={'id':_0x11c502['id'],'available':_0x11c502[_0x005b('0x52')],'loggedIn':_0x11c502[_0x005b('0x53')],'name':_0x11c502[_0x005b('0x54')],'paused':_0x11c502[_0x005b('0x55')],'waiting':_0x11c502['waiting']};_0x30e985[_0x005b('0x20')](_0x21c970);}}_0x5a6146({'count':_0x30e985['length'],'rows':_0x30e985});});},'SmsQueues':function(_0xcf64fb){return new Promise(function(_0x511691,_0x38dba1){var _0x369819=[];for(var _0x38ff2b in _0x309c8f[_0x005b('0x59')]){if(_0x309c8f[_0x005b('0x59')][_0x005b('0x4b')](_0x38ff2b)){var _0x426340=_0x309c8f['smsQueues'][_0x38ff2b];var _0x4d1908={'id':_0x426340['id'],'available':_0x426340[_0x005b('0x52')],'loggedIn':_0x426340[_0x005b('0x53')],'name':_0x426340['name'],'paused':_0x426340[_0x005b('0x55')],'waiting':_0x426340[_0x005b('0x56')]};_0x369819['push'](_0x4d1908);}}_0x511691({'count':_0x369819[_0x005b('0x17')],'rows':_0x369819});});},'FaxQueues':function(_0x570c86){return new Promise(function(_0x46e257,_0x5496bf){var _0x16a3d8=[];for(var _0x1c38a4 in _0x309c8f['faxQueues']){if(_0x309c8f[_0x005b('0x5a')][_0x005b('0x4b')](_0x1c38a4)){var _0x1cd0b6=_0x309c8f[_0x005b('0x5a')][_0x1c38a4];var _0x1b3d90={'id':_0x1cd0b6['id'],'available':_0x1cd0b6[_0x005b('0x52')],'loggedIn':_0x1cd0b6[_0x005b('0x53')],'name':_0x1cd0b6['name'],'paused':_0x1cd0b6[_0x005b('0x55')],'waiting':_0x1cd0b6[_0x005b('0x56')]};_0x16a3d8[_0x005b('0x20')](_0x1b3d90);}}_0x46e257({'count':_0x16a3d8[_0x005b('0x17')],'rows':_0x16a3d8});});},'WhatsappQueues':function(_0x264d3a){return new Promise(function(_0x314ac6,_0x34ac7b){var _0x3fe0e3=[];for(var _0x4294b3 in _0x309c8f[_0x005b('0x5b')]){if(_0x309c8f[_0x005b('0x5b')][_0x005b('0x4b')](_0x4294b3)){var _0x372369=_0x309c8f[_0x005b('0x5b')][_0x4294b3];var _0x4e43f2={'id':_0x372369['id'],'available':_0x372369['available'],'loggedIn':_0x372369[_0x005b('0x53')],'name':_0x372369[_0x005b('0x54')],'paused':_0x372369['paused'],'waiting':_0x372369['waiting']};_0x3fe0e3[_0x005b('0x20')](_0x4e43f2);}}_0x314ac6({'count':_0x3fe0e3[_0x005b('0x17')],'rows':_0x3fe0e3});});},'ChatQueuesWaitingInteractions':function(_0x4291be){return new Promise(function(_0x65807b,_0x32b9bd){var _0x19addd=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5c')]);_0x65807b({'count':_0x19addd[_0x005b('0x17')],'rows':_0x19addd});});},'MailQueuesWaitingInteractions':function(_0x456e44){return new Promise(function(_0x59d464,_0x11a6ab){var _0x4a2e7a=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5d')]);_0x59d464({'count':_0x4a2e7a[_0x005b('0x17')],'rows':_0x4a2e7a});});},'OpenchannelQueuesWaitingInteractions':function(_0x581b79){return new Promise(function(_0x3aa379,_0x1921a5){var _0x2696fb=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5e')]);_0x3aa379({'count':_0x2696fb[_0x005b('0x17')],'rows':_0x2696fb});});},'SmsQueuesWaitingInteractions':function(_0x44dd54){return new Promise(function(_0x54a58b,_0x118e8f){var _0x4b5bf6=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x5f')]);_0x54a58b({'count':_0x4b5bf6['length'],'rows':_0x4b5bf6});});},'FaxQueuesWaitingInteractions':function(_0x2de5b6){return new Promise(function(_0x103ef4,_0x1e9683){var _0x1a2efb=_[_0x005b('0x50')](_0x309c8f[_0x005b('0x60')]);_0x103ef4({'count':_0x1a2efb[_0x005b('0x17')],'rows':_0x1a2efb});});},'WhatsappQueuesWaitingInteractions':function(_0x2107cb){return new Promise(function(_0x14d189,_0xa30ed2){var _0x360b08=_[_0x005b('0x50')](_0x309c8f['whatsappQueuesWaitingInteractions']);_0x14d189({'count':_0x360b08[_0x005b('0x17')],'rows':_0x360b08});});}};var _0x3ab540=jayson[_0x005b('0x61')](_0x1c8eed)[_0x005b('0x62')]();_0x3ab540['on'](_0x005b('0x37'),function(_0x44bc20){logger[_0x005b('0x37')](JSON[_0x005b('0x3c')](_0x44bc20));return _0x52f822(_0x44bc20);});_0x3ab540[_0x005b('0x63')](0x232c,_0x005b('0x64'),function(){console[_0x005b('0x65')](_0x005b('0x66'),0x232c);return _0x3e2c82(_0x005b('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3818c7c..e164d8e 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 _0x37b8=['stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x37b8,0x1c3));var _0x837b=function(_0x1570e4,_0x244686){_0x1570e4=_0x1570e4-0x0;var _0x428d09=_0x37b8[_0x1570e4];return _0x428d09;};'use strict';var util=require('util');var BPromise=require(_0x837b('0x0'));var jayson=require(_0x837b('0x1'));var _=require(_0x837b('0x2'));var logger=require(_0x837b('0x3'))(_0x837b('0x4'));var client=jayson[_0x837b('0x5')][_0x837b('0x6')]({'port':0x232a});function request(_0x28ae25,_0x463365){return new BPromise(function(_0xf43271,_0x5b256c){return client[_0x837b('0x7')](_0x28ae25,_0x463365)[_0x837b('0x8')](function(_0x3ff07c){if(_0x3ff07c[_0x837b('0x9')]){return _0x5b256c(_0x3ff07c[_0x837b('0x9')][_0x837b('0xa')]);}else{return _0xf43271(_0x3ff07c[_0x837b('0xb')]);}})[_0x837b('0xc')](function(_0x1e48bc){return _0x5b256c(_0x1e48bc);});});}exports[_0x837b('0xd')]=function(_0x4de451,_0x5624df,_0x5be283){return function(_0x52635f){if(_0x5be283[_0x837b('0xe')]&&!_0x5be283[_0x837b('0xe')][_0x4de451]){logger[_0x837b('0xf')](_0x837b('0x10'),_0x4de451);return _0x52635f['stop']();}var _0x18a025=[];for(var _0x574f56=0x0;_0x574f56<_0x5624df[_0x837b('0x11')];_0x574f56+=0x1){_0x18a025[_0x837b('0x12')](request(_0x837b('0x13'),{'command':util[_0x837b('0x14')](_0x837b('0x15'),_0x5624df[_0x574f56])})[_0x837b('0x8')](function(_0x5d191e){return _0x5d191e&&_0x5d191e[_0x837b('0xa')]&&_0x5d191e[_0x837b('0xa')][_0x837b('0x16')]('true')>=0x0?!![]:![];})[_0x837b('0xc')](function(_0x2d5ee4){logger[_0x837b('0x9')](_0x837b('0x17'),_0x4de451,_0x5624df[_0x574f56]);}));}BPromise[_0x837b('0x18')](_0x18a025)['then'](function(_0x4e608f){var _0x14675c=_['some'](_0x4e608f);logger['info'](_0x837b('0x19'),_0x4de451,_0x5624df['join'](_0x837b('0x1a')),_0x14675c);_0x52635f[_0x837b('0x1b')](_0x14675c);})[_0x837b('0xc')](function(_0x196f4d){console['log'](_0x196f4d);logger['error'](_0x837b('0x19'),_0x4de451,_0x5624df[_0x837b('0x1c')](_0x837b('0x1a')),_0x196f4d[_0x837b('0x1d')]);_0x52635f['stop']();});};}; \ No newline at end of file +var _0x77b0=['result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0x77b0,0x195));var _0x077b=function(_0x5dc5b0,_0x2654fa){_0x5dc5b0=_0x5dc5b0-0x0;var _0x3cb5e7=_0x77b0[_0x5dc5b0];return _0x3cb5e7;};'use strict';var util=require(_0x077b('0x0'));var BPromise=require('bluebird');var jayson=require(_0x077b('0x1'));var _=require(_0x077b('0x2'));var logger=require(_0x077b('0x3'))(_0x077b('0x4'));var client=jayson[_0x077b('0x5')][_0x077b('0x6')]({'port':0x232a});function request(_0x28a1be,_0x1a26d3){return new BPromise(function(_0x2b5202,_0x53ba90){return client[_0x077b('0x7')](_0x28a1be,_0x1a26d3)[_0x077b('0x8')](function(_0x34c91c){if(_0x34c91c[_0x077b('0x9')]){return _0x53ba90(_0x34c91c[_0x077b('0x9')][_0x077b('0xa')]);}else{return _0x2b5202(_0x34c91c[_0x077b('0xb')]);}})[_0x077b('0xc')](function(_0x7458e8){return _0x53ba90(_0x7458e8);});});}exports['condition']=function(_0x30b58e,_0x53dd2b,_0x42c5d4){return function(_0x3b32c8){if(_0x42c5d4[_0x077b('0xd')]&&!_0x42c5d4[_0x077b('0xd')][_0x30b58e]){logger[_0x077b('0xe')](_0x077b('0xf'),_0x30b58e);return _0x3b32c8[_0x077b('0x10')]();}var _0x423f3b=[];for(var _0x3402de=0x0;_0x3402de<_0x53dd2b[_0x077b('0x11')];_0x3402de+=0x1){_0x423f3b[_0x077b('0x12')](request(_0x077b('0x13'),{'command':util[_0x077b('0x14')](_0x077b('0x15'),_0x53dd2b[_0x3402de])})['then'](function(_0x300f56){return _0x300f56&&_0x300f56[_0x077b('0xa')]&&_0x300f56['message'][_0x077b('0x16')](_0x077b('0x17'))>=0x0?!![]:![];})['catch'](function(_0x4541c9){logger[_0x077b('0x9')](_0x077b('0x18'),_0x30b58e,_0x53dd2b[_0x3402de]);}));}BPromise['all'](_0x423f3b)[_0x077b('0x8')](function(_0x55d989){var _0x5e967e=_[_0x077b('0x19')](_0x55d989);logger[_0x077b('0xe')](_0x077b('0x1a'),_0x30b58e,_0x53dd2b[_0x077b('0x1b')](_0x077b('0x1c')),_0x5e967e);_0x3b32c8[_0x077b('0x1d')](_0x5e967e);})[_0x077b('0xc')](function(_0x48c0d7){console[_0x077b('0x1e')](_0x48c0d7);logger[_0x077b('0x9')](_0x077b('0x1a'),_0x30b58e,_0x53dd2b['join'](_0x077b('0x1c')),_0x48c0d7[_0x077b('0x1f')]);_0x3b32c8[_0x077b('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 6ac80c7..041651a 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 _0x57f8=['agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','isNil','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','[%s][agents][hangup]','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','connectedlinenum','lastevent','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0x57f8,0x198));var _0x857f=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0x57f8[_0x153738];return _0x3028d9;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var utils=require(_0x857f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e6e52,_0x3c0125){utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x4'),_0x1e6e52[_0x857f('0x5')],_0x1e6e52[_0x857f('0x6')],_0x1e6e52[_0x857f('0x7')],_0x1e6e52[_0x857f('0x8')],_0x1e6e52[_0x857f('0x9')],_0x1e6e52['calleridnum'],_0x1e6e52[_0x857f('0xa')],_0x1e6e52[_0x857f('0xb')]));if(_0x1e6e52[_0x857f('0x7')]){utils['getVoiceQueueByName'](_0x1e6e52[_0x857f('0x7')])[_0x857f('0xc')](function(_0x960b76){if(_0x960b76){_0x1e6e52['type']=_0x960b76[_0x857f('0xd')];_0x1e6e52[_0x857f('0xe')]=_0x1e6e52[_0x857f('0xf')]?_0x960b76['acw']:![];_0x1e6e52[_0x857f('0x10')]=_0x1e6e52[_0x857f('0xe')]?_0x960b76[_0x857f('0x11')]:0x0;}utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);});}else{utils[_0x857f('0x12')](_0x857f('0x13'),_0x1e6e52);}if(_0x3c0125){delete transfers[_0x1e6e52['uniqueid']];}else{delete agents[_0x1e6e52[_0x857f('0x14')]];}}exports[_0x857f('0x15')]=function(_0x373333){try{utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333['uniqueid']),_0x373333);agents[_0x373333[_0x857f('0x14')]]=_0x373333;agents[_0x373333['destuniqueid']][_0x857f('0x17')]=utils['now']();agents[_0x373333[_0x857f('0x14')]][_0x857f('0xb')]='called';agents[_0x373333[_0x857f('0x14')]][_0x857f('0xa')]=null;agents[_0x373333[_0x857f('0x14')]][_0x857f('0x18')]=null;utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x19'),_0x373333[_0x857f('0x5')],agents[_0x373333[_0x857f('0x14')]][_0x857f('0x8')],_0x373333[_0x857f('0x14')]));}catch(_0x59e0e1){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][agentcalled]',_0x373333[_0x857f('0x5')]),_0x59e0e1);}};exports[_0x857f('0x1b')]=function(_0x377587){try{if(!_['isNil'](agents[_0x377587['destuniqueid']])){utils[_0x857f('0x16')](util[_0x857f('0x3')](_0x857f('0x1c'),_0x377587['uniqueid']),_0x377587);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x1d'),_0x377587['uniqueid'],agents[_0x377587[_0x857f('0x14')]][_0x857f('0x8')],_0x377587['destuniqueid']));agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1b')]=!![];agents[_0x377587[_0x857f('0x14')]][_0x857f('0x1e')]=utils[_0x857f('0x1f')]();agents[_0x377587[_0x857f('0x14')]][_0x857f('0xb')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x21')]=_0x857f('0x20');agents[_0x377587[_0x857f('0x14')]][_0x857f('0x22')]=_0x377587[_0x857f('0x23')]?parseInt(_0x377587['ringtime'])/0x3e8:0x0;agents[_0x377587[_0x857f('0x14')]][_0x857f('0x24')]=0x0;unanswered[_0x857f('0x25')](_0x377587[_0x857f('0x14')]);}}catch(_0x58c2de){utils[_0x857f('0x1a')](util['format'](_0x857f('0x1c'),_0x377587[_0x857f('0x5')]),_0x58c2de);}};exports[_0x857f('0x26')]=function(_0x2ab814){try{_[_0x857f('0x27')](agents,function(_0x464e8f,_0x1c4fff){if(_0x464e8f[_0x857f('0x5')]==_0x2ab814[_0x857f('0x5')]&&!_[_0x857f('0x28')](unanswered,_0x464e8f[_0x857f('0x14')])){utils[_0x857f('0x16')](util[_0x857f('0x3')]('[%s][agents][queuecallerabandon]',_0x2ab814[_0x857f('0x5')]),_0x2ab814);utils[_0x857f('0x2')](util['format'](_0x857f('0x29'),_0x2ab814[_0x857f('0x5')],_0x464e8f['membername'],_0x464e8f[_0x857f('0x14')]));_0x464e8f[_0x857f('0x1b')]=!![];_0x464e8f['agentringnoanswerAt']=utils[_0x857f('0x1f')]();_0x464e8f[_0x857f('0xb')]=_0x857f('0x2a');_0x464e8f[_0x857f('0x21')]='abandoned';_0x464e8f['holdtime']=_0x2ab814[_0x857f('0x22')];_0x464e8f[_0x857f('0x24')]=0x0;writeDB(_0x464e8f);}});}catch(_0x4c88fa){utils[_0x857f('0x1a')](util['format'](_0x857f('0x2b'),_0x2ab814[_0x857f('0x5')]),_0x4c88fa);}};exports[_0x857f('0x2c')]=function(_0x438ff1){try{if(agents[_0x438ff1[_0x857f('0x14')]]){utils['debug'](util['format'](_0x857f('0x2d'),_0x438ff1['uniqueid']),_0x438ff1);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x2e'),_0x438ff1['uniqueid'],agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x8')],_0x438ff1[_0x857f('0x14')]));agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();agents[_0x438ff1[_0x857f('0x14')]]['connectedlinenum']=_0x438ff1[_0x857f('0xa')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x18')]=_0x438ff1[_0x857f('0x18')];agents[_0x438ff1[_0x857f('0x14')]][_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];agents[_0x438ff1['destuniqueid']][_0x857f('0xb')]=_0x857f('0x30');_[_0x857f('0x27')](agents,function(_0xc2ac41,_0x196c95){if(_0xc2ac41[_0x857f('0x14')]!=_0x438ff1['destuniqueid']&&_0xc2ac41[_0x857f('0x5')]==_0x438ff1[_0x857f('0x5')]){_0xc2ac41[_0x857f('0x24')]=0x0;_0xc2ac41[_0x857f('0x22')]=_0x438ff1[_0x857f('0x23')];_0xc2ac41[_0x857f('0x1b')]=!![];_0xc2ac41[_0x857f('0x1e')]=utils[_0x857f('0x1f')]();_0xc2ac41['lastevent']=_0x857f('0x31');_0xc2ac41[_0x857f('0x21')]=_0x857f('0x31');_0xc2ac41[_0x857f('0x32')]=_0x438ff1[_0x857f('0x14')];_0xc2ac41[_0x857f('0x33')]=_0x438ff1[_0x857f('0x8')];writeDB(_0xc2ac41);}});}}catch(_0x42d922){utils[_0x857f('0x1a')](util[_0x857f('0x3')](_0x857f('0x2d'),_0x438ff1[_0x857f('0x5')]),_0x42d922);}};exports[_0x857f('0xf')]=function(_0x376f71){try{if(!_['isNil'](agents[_0x376f71[_0x857f('0x14')]])){utils['debug'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x376f71);utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x35'),_0x376f71[_0x857f('0x5')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x8')],_0x376f71[_0x857f('0x14')]));agents[_0x376f71[_0x857f('0x14')]]['agentcomplete']=!![];agents[_0x376f71['destuniqueid']][_0x857f('0x36')]=utils['now']();agents[_0x376f71[_0x857f('0x14')]]['talktime']=utils[_0x857f('0x37')](agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x36')],agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x2f')]);agents[_0x376f71[_0x857f('0x14')]][_0x857f('0x21')]=_0x376f71[_0x857f('0x21')];agents[_0x376f71['destuniqueid']][_0x857f('0xb')]=_0x857f('0x38');writeDB(agents[_0x376f71[_0x857f('0x14')]]);}}catch(_0x19c967){utils['error'](util[_0x857f('0x3')](_0x857f('0x34'),_0x376f71[_0x857f('0x5')]),_0x19c967);}};exports[_0x857f('0x39')]=function(_0x67563){try{if(!_['isNil'](agents[_0x67563[_0x857f('0x3a')]])){utils[_0x857f('0x16')](util['format'](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x67563);utils['info'](util[_0x857f('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x67563[_0x857f('0x5')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x8')],agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')]));agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3c')]=!![];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x3d')]=_0x857f('0x3e');agents[_0x67563['transfereruniqueid']][_0x857f('0x3f')]=_0x67563[_0x857f('0x40')];agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x41')]=agents[_0x67563[_0x857f('0x3a')]][_0x857f('0x5')];}}catch(_0x12712a){utils['error'](util[_0x857f('0x3')](_0x857f('0x3b'),_0x67563[_0x857f('0x5')]),_0x12712a);}};exports[_0x857f('0x42')]=function(_0x22eab9){try{utils[_0x857f('0x16')](util['format'](_0x857f('0x43'),_0x22eab9[_0x857f('0x44')]),_0x22eab9);if(_0x22eab9[_0x857f('0x44')]==_0x22eab9[_0x857f('0x45')]){if(!_[_0x857f('0x46')](agents[_0x22eab9[_0x857f('0x47')]])){utils[_0x857f('0x2')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x22eab9['origtransfereruniqueid'],agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x8')]));agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x3f')]=_0x22eab9['origtransfererexten'];agents[_0x22eab9[_0x857f('0x47')]]['transferuniqueid']=_0x22eab9[_0x857f('0x44')];}if(_0x22eab9[_0x857f('0x48')]&&agents[_0x22eab9['transfereeuniqueid']]){agents[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x48')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x48')]]);transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4b')]=agents[_0x22eab9[_0x857f('0x47')]]['calleridnum'];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x47')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x17')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x48')]]['holdtime']=0x0;transfers[_0x22eab9[_0x857f('0x48')]][_0x857f('0x49')]=0x2;}}else if(_0x22eab9[_0x857f('0x47')]==_0x22eab9[_0x857f('0x4d')]){if(!_['isNil'](agents[_0x22eab9[_0x857f('0x44')]])){utils['info'](util[_0x857f('0x3')](_0x857f('0x4e'),_0x22eab9[_0x857f('0x44')],agents[_0x22eab9[_0x857f('0x44')]]['membername']));agents[_0x22eab9['origtransfereruniqueid']][_0x857f('0x3c')]=!![];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x3d')]='ATTENDED';agents[_0x22eab9[_0x857f('0x44')]]['transferexten']=_0x22eab9[_0x857f('0x4f')];agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x41')]=_0x22eab9['secondtransfereruniqueid'];}if(_0x22eab9['transfertargetuniqueid']&&agents[_0x22eab9[_0x857f('0x50')]]){agents[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x1;transfers[_0x22eab9[_0x857f('0x50')]]=_[_0x857f('0x4a')](agents[_0x22eab9[_0x857f('0x50')]]);transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4b')]=agents[_0x22eab9['origtransfereruniqueid']]['calleridnum'];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x4c')]=agents[_0x22eab9[_0x857f('0x44')]][_0x857f('0x4c')];transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x17')]=utils['now']();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x2f')]=utils[_0x857f('0x1f')]();transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x22')]=0x0;transfers[_0x22eab9[_0x857f('0x50')]][_0x857f('0x49')]=0x2;}}}catch(_0x39ad7c){utils[_0x857f('0x1a')](util[_0x857f('0x3')]('[%s][agents][attendedtransfer]',_0x22eab9[_0x857f('0x44')]),_0x39ad7c);}};exports['hangup']=function(_0x5ec513){try{utils[_0x857f('0x16')](util['format']('[%s][agents][hangup]',_0x5ec513[_0x857f('0x5')]),_0x5ec513);if(agents[_0x5ec513['uniqueid']]&&agents[_0x5ec513[_0x857f('0x5')]]['reason']===_0x857f('0x20')){if(_0x5ec513[_0x857f('0x51')]==='21'){agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]='rejected';agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x52');}utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513['uniqueid']]['membername'],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);var _0x2d7d33=unanswered['indexOf'](_0x5ec513[_0x857f('0x5')]);if(_0x2d7d33>-0x1){unanswered[_0x857f('0x54')](_0x2d7d33,0x1);}}if(transfers[_0x5ec513[_0x857f('0x5')]]){transfers[_0x5ec513['uniqueid']]['agentcomplete']=!![];transfers[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils['now']();transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x24')]=utils['diffTime'](transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x36')],transfers[_0x5ec513['uniqueid']][_0x857f('0x2f')]);transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0x21')]=_0x857f('0x55');transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util[_0x857f('0x3')](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],transfers[_0x5ec513[_0x857f('0x5')]]['membername'],transfers[_0x5ec513['uniqueid']]['reason'],transfers[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]));writeDB(transfers[_0x5ec513[_0x857f('0x5')]],!![]);}if(agents[_0x5ec513[_0x857f('0x5')]]&&agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]){agents[_0x5ec513[_0x857f('0x5')]]['agentcomplete']=!![];agents[_0x5ec513[_0x857f('0x5')]]['agentcompleteAt']=utils[_0x857f('0x1f')]();agents[_0x5ec513['uniqueid']]['talktime']=utils[_0x857f('0x37')](agents[_0x5ec513['uniqueid']][_0x857f('0x36')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x2f')]);agents[_0x5ec513['uniqueid']][_0x857f('0x21')]=agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x3c')]?_0x857f('0x3c'):_0x857f('0x55');agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0xb')]=_0x857f('0x38');utils[_0x857f('0x2')](util['format'](_0x857f('0x53'),_0x5ec513[_0x857f('0x5')],agents[_0x5ec513[_0x857f('0x5')]][_0x857f('0x8')],agents[_0x5ec513['uniqueid']][_0x857f('0x21')],agents[_0x5ec513['uniqueid']][_0x857f('0xb')]));writeDB(agents[_0x5ec513[_0x857f('0x5')]]);}}catch(_0x15df2f){utils[_0x857f('0x1a')](util['format'](_0x857f('0x56'),_0x5ec513['uniqueid']),_0x15df2f);}}; \ No newline at end of file +var _0xb7e7=['answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','./utils','format','uniqueid','channel','queue','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime','ringtime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere'];(function(_0x473dfb,_0x39cc88){var _0x1ddce0=function(_0x500011){while(--_0x500011){_0x473dfb['push'](_0x473dfb['shift']());}};_0x1ddce0(++_0x39cc88);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb7e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var utils=require(_0x7b7e('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x518dc6,_0x1b7cc7){utils['info'](util[_0x7b7e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x518dc6[_0x7b7e('0x3')],_0x518dc6[_0x7b7e('0x4')],_0x518dc6[_0x7b7e('0x5')],_0x518dc6['membername'],_0x518dc6['interface'],_0x518dc6[_0x7b7e('0x6')],_0x518dc6[_0x7b7e('0x7')],_0x518dc6[_0x7b7e('0x8')]));if(_0x518dc6['queue']){utils[_0x7b7e('0x9')](_0x518dc6[_0x7b7e('0x5')])[_0x7b7e('0xa')](function(_0x1647e5){if(_0x1647e5){_0x518dc6[_0x7b7e('0xb')]=_0x1647e5[_0x7b7e('0xb')];_0x518dc6[_0x7b7e('0xc')]=_0x518dc6['agentcomplete']?_0x1647e5[_0x7b7e('0xd')]:![];_0x518dc6[_0x7b7e('0xe')]=_0x518dc6[_0x7b7e('0xc')]?_0x1647e5[_0x7b7e('0xf')]:0x0;}utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);});}else{utils[_0x7b7e('0x10')](_0x7b7e('0x11'),_0x518dc6);}if(_0x1b7cc7){delete transfers[_0x518dc6[_0x7b7e('0x3')]];}else{delete agents[_0x518dc6['destuniqueid']];}}exports[_0x7b7e('0x12')]=function(_0x430eab){try{utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][agentcalled]',_0x430eab['uniqueid']),_0x430eab);agents[_0x430eab[_0x7b7e('0x13')]]=_0x430eab;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();agents[_0x430eab[_0x7b7e('0x13')]]['lastevent']='called';agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x7')]=null;agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x16')]=null;utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x18'),_0x430eab[_0x7b7e('0x3')],agents[_0x430eab[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x430eab[_0x7b7e('0x13')]));}catch(_0x14f4fe){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x1b'),_0x430eab[_0x7b7e('0x3')]),_0x14f4fe);}};exports[_0x7b7e('0x1c')]=function(_0x49eddb){try{if(!_[_0x7b7e('0x1d')](agents[_0x49eddb[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util['format'](_0x7b7e('0x1f'),_0x49eddb[_0x7b7e('0x3')]),_0x49eddb);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x20'),_0x49eddb[_0x7b7e('0x3')],agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x49eddb['destuniqueid']));agents[_0x49eddb['destuniqueid']]['agentringnoanswer']=!![];agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();agents[_0x49eddb['destuniqueid']]['lastevent']='timeout';agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x7b7e('0x23');agents[_0x49eddb[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x49eddb['ringtime']?parseInt(_0x49eddb[_0x7b7e('0x25')])/0x3e8:0x0;agents[_0x49eddb[_0x7b7e('0x13')]]['talktime']=0x0;unanswered['push'](_0x49eddb['destuniqueid']);}}catch(_0x12ef0b){utils[_0x7b7e('0x1a')](util['format'](_0x7b7e('0x1f'),_0x49eddb['uniqueid']),_0x12ef0b);}};exports[_0x7b7e('0x26')]=function(_0xb9b6bf){try{_[_0x7b7e('0x27')](agents,function(_0x5515ca,_0x3960b8){if(_0x5515ca[_0x7b7e('0x3')]==_0xb9b6bf[_0x7b7e('0x3')]&&!_[_0x7b7e('0x28')](unanswered,_0x5515ca[_0x7b7e('0x13')])){utils['debug'](util[_0x7b7e('0x2')]('[%s][agents][queuecallerabandon]',_0xb9b6bf[_0x7b7e('0x3')]),_0xb9b6bf);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x29'),_0xb9b6bf[_0x7b7e('0x3')],_0x5515ca[_0x7b7e('0x19')],_0x5515ca[_0x7b7e('0x13')]));_0x5515ca['agentringnoanswer']=!![];_0x5515ca['agentringnoanswerAt']=utils[_0x7b7e('0x15')]();_0x5515ca[_0x7b7e('0x8')]='abandoned';_0x5515ca[_0x7b7e('0x22')]=_0x7b7e('0x2a');_0x5515ca[_0x7b7e('0x24')]=_0xb9b6bf['holdtime'];_0x5515ca[_0x7b7e('0x2b')]=0x0;writeDB(_0x5515ca);}});}catch(_0x256908){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x2c'),_0xb9b6bf[_0x7b7e('0x3')]),_0x256908);}};exports[_0x7b7e('0x2d')]=function(_0x202f04){try{if(agents[_0x202f04[_0x7b7e('0x13')]]){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x2e'),_0x202f04[_0x7b7e('0x3')]),_0x202f04);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x2f'),_0x202f04['uniqueid'],agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x19')],_0x202f04[_0x7b7e('0x13')]));agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x7')]=_0x202f04[_0x7b7e('0x7')];agents[_0x202f04[_0x7b7e('0x13')]]['connectedlinename']=_0x202f04[_0x7b7e('0x16')];agents[_0x202f04[_0x7b7e('0x13')]][_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];agents[_0x202f04['destuniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x31');_[_0x7b7e('0x27')](agents,function(_0x5c58c0,_0x4a2888){if(_0x5c58c0[_0x7b7e('0x13')]!=_0x202f04['destuniqueid']&&_0x5c58c0[_0x7b7e('0x3')]==_0x202f04[_0x7b7e('0x3')]){_0x5c58c0['talktime']=0x0;_0x5c58c0[_0x7b7e('0x24')]=_0x202f04[_0x7b7e('0x25')];_0x5c58c0[_0x7b7e('0x1c')]=!![];_0x5c58c0[_0x7b7e('0x21')]=utils[_0x7b7e('0x15')]();_0x5c58c0[_0x7b7e('0x8')]=_0x7b7e('0x32');_0x5c58c0[_0x7b7e('0x22')]=_0x7b7e('0x32');_0x5c58c0['answeredelsewheredestinationuniqueid']=_0x202f04['destuniqueid'];_0x5c58c0[_0x7b7e('0x33')]=_0x202f04['membername'];writeDB(_0x5c58c0);}});}}catch(_0x41c8a6){utils['error'](util['format'](_0x7b7e('0x2e'),_0x202f04['uniqueid']),_0x41c8a6);}};exports[_0x7b7e('0x34')]=function(_0x52051c){try{if(!_[_0x7b7e('0x1d')](agents[_0x52051c[_0x7b7e('0x13')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')]('[%s][agents][agentcomplete]',_0x52051c[_0x7b7e('0x3')]),_0x52051c);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x35'),_0x52051c[_0x7b7e('0x3')],agents[_0x52051c[_0x7b7e('0x13')]]['membername'],_0x52051c['destuniqueid']));agents[_0x52051c['destuniqueid']][_0x7b7e('0x34')]=!![];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x2b')]=utils['diffTime'](agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x36')],agents[_0x52051c['destuniqueid']]['agentconnectAt']);agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x22')]=_0x52051c[_0x7b7e('0x22')];agents[_0x52051c[_0x7b7e('0x13')]][_0x7b7e('0x8')]=_0x7b7e('0x37');writeDB(agents[_0x52051c['destuniqueid']]);}}catch(_0x2673eb){utils['error'](util[_0x7b7e('0x2')](_0x7b7e('0x38'),_0x52051c[_0x7b7e('0x3')]),_0x2673eb);}};exports[_0x7b7e('0x39')]=function(_0x58e4e6){try{if(!_[_0x7b7e('0x1d')](agents[_0x58e4e6[_0x7b7e('0x3a')]])){utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6['uniqueid']),_0x58e4e6);utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x3c'),_0x58e4e6[_0x7b7e('0x3')],agents[_0x58e4e6[_0x7b7e('0x3a')]]['membername'],agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3')]));agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3d')]=!![];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x3e')]=_0x7b7e('0x3f');agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x40')]=_0x58e4e6['extension'];agents[_0x58e4e6[_0x7b7e('0x3a')]][_0x7b7e('0x41')]=agents[_0x58e4e6['transfereruniqueid']][_0x7b7e('0x3')];}}catch(_0x44e3a0){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x3b'),_0x58e4e6[_0x7b7e('0x3')]),_0x44e3a0);}};exports[_0x7b7e('0x42')]=function(_0x5f15ce){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x5f15ce);if(_0x5f15ce['origtransfereruniqueid']==_0x5f15ce['origtransfererlinkedid']){if(!_['isNil'](agents[_0x5f15ce[_0x7b7e('0x45')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5f15ce['origtransfereruniqueid'],agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x19')]));agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x40')]=_0x5f15ce['origtransfererexten'];agents[_0x5f15ce[_0x7b7e('0x45')]][_0x7b7e('0x41')]=_0x5f15ce[_0x7b7e('0x44')];}if(_0x5f15ce[_0x7b7e('0x46')]&&agents[_0x5f15ce[_0x7b7e('0x46')]]){agents[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x46')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfereeuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x6')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x49')]=agents[_0x5f15ce['secondtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x14')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x30')]=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce['transfereeuniqueid']][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x46')]][_0x7b7e('0x47')]=0x2;}}else if(_0x5f15ce[_0x7b7e('0x45')]==_0x5f15ce['secondtransfererlinkedid']){if(!_[_0x7b7e('0x1d')](agents[_0x5f15ce[_0x7b7e('0x44')]])){utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x4a'),_0x5f15ce[_0x7b7e('0x44')],agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x19')]));agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x3d')]=!![];agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x3e')]='ATTENDED';agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x40')]=_0x5f15ce[_0x7b7e('0x4b')];agents[_0x5f15ce[_0x7b7e('0x44')]][_0x7b7e('0x41')]=_0x5f15ce['secondtransfereruniqueid'];}if(_0x5f15ce[_0x7b7e('0x4c')]&&agents[_0x5f15ce[_0x7b7e('0x4c')]]){agents[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x1;transfers[_0x5f15ce[_0x7b7e('0x4c')]]=_[_0x7b7e('0x48')](agents[_0x5f15ce['transfertargetuniqueid']]);transfers[_0x5f15ce[_0x7b7e('0x4c')]]['calleridnum']=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x6')];transfers[_0x5f15ce['transfertargetuniqueid']][_0x7b7e('0x49')]=agents[_0x5f15ce['origtransfereruniqueid']][_0x7b7e('0x49')];transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentcalledAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]]['agentconnectAt']=utils[_0x7b7e('0x15')]();transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x24')]=0x0;transfers[_0x5f15ce[_0x7b7e('0x4c')]][_0x7b7e('0x47')]=0x2;}}}catch(_0x2147d9){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x43'),_0x5f15ce[_0x7b7e('0x44')]),_0x2147d9);}};exports['hangup']=function(_0x59ecf9){try{utils[_0x7b7e('0x1e')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9[_0x7b7e('0x3')]),_0x59ecf9);if(agents[_0x59ecf9[_0x7b7e('0x3')]]&&agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]==='timeout'){if(_0x59ecf9[_0x7b7e('0x4e')]==='21'){agents[_0x59ecf9[_0x7b7e('0x3')]]['reason']=_0x7b7e('0x4f');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x4f');}utils[_0x7b7e('0x17')](util[_0x7b7e('0x2')](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]]['reason'],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);var _0x122053=unanswered[_0x7b7e('0x51')](_0x59ecf9[_0x7b7e('0x3')]);if(_0x122053>-0x1){unanswered[_0x7b7e('0x52')](_0x122053,0x1);}}if(transfers[_0x59ecf9['uniqueid']]){transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x34')]=!![];transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt']=utils[_0x7b7e('0x15')]();transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](transfers[_0x59ecf9[_0x7b7e('0x3')]]['agentcompleteAt'],transfers[_0x59ecf9['uniqueid']]['agentconnectAt']);transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=_0x7b7e('0x54');transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],transfers[_0x59ecf9['uniqueid']][_0x7b7e('0x22')],transfers[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]));writeDB(transfers[_0x59ecf9[_0x7b7e('0x3')]],!![]);}if(agents[_0x59ecf9['uniqueid']]&&agents[_0x59ecf9['uniqueid']][_0x7b7e('0x30')]){agents[_0x59ecf9['uniqueid']][_0x7b7e('0x34')]=!![];agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')]=utils[_0x7b7e('0x15')]();agents[_0x59ecf9['uniqueid']][_0x7b7e('0x2b')]=utils[_0x7b7e('0x53')](agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x36')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x30')]);agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')]=agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x3d')]?_0x7b7e('0x3d'):_0x7b7e('0x54');agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x8')]=_0x7b7e('0x37');utils[_0x7b7e('0x17')](util['format'](_0x7b7e('0x50'),_0x59ecf9[_0x7b7e('0x3')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x19')],agents[_0x59ecf9[_0x7b7e('0x3')]][_0x7b7e('0x22')],agents[_0x59ecf9[_0x7b7e('0x3')]]['lastevent']));writeDB(agents[_0x59ecf9[_0x7b7e('0x3')]]);}}catch(_0x3880be){utils[_0x7b7e('0x1a')](util[_0x7b7e('0x2')](_0x7b7e('0x4d'),_0x59ecf9['uniqueid']),_0x3880be);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 1c8424b..5cd260c 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 _0x077e=['lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\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','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0x077e,0x14a));var _0xe077=function(_0x496b57,_0xf202a0){_0x496b57=_0x496b57-0x0;var _0x119177=_0x077e[_0x496b57];return _0x119177;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var utils=require(_0xe077('0x2'));var transfers=require(_0xe077('0x3'));var dispositions=['NO\x20ANSWER',_0xe077('0x4'),_0xe077('0x4'),_0xe077('0x5'),'NO\x20ANSWER',_0xe077('0x5'),_0xe077('0x6'),_0xe077('0x7'),_0xe077('0x4'),_0xe077('0x4'),_0xe077('0x4')];var channels={};function writeDB(_0x2810b4){var _0x2e5a85;if(transfers[_0xe077('0x8')][_0x2810b4[_0xe077('0x9')]]){_0x2e5a85=_0x2810b4[_0xe077('0x9')];_0x2810b4[_0xe077('0x9')]=transfers['blinds'][_0x2810b4[_0xe077('0x9')]][_0xe077('0xa')];}utils['info'](util[_0xe077('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2810b4[_0xe077('0x9')],_0x2810b4['channel'],_0x2810b4[_0xe077('0xc')],_0x2810b4[_0xe077('0xd')],_0x2810b4[_0xe077('0xe')],_0x2810b4[_0xe077('0xf')],_0x2810b4[_0xe077('0x10')],_0x2810b4[_0xe077('0x11')]));if(_0x2810b4[_0xe077('0x12')]){utils[_0xe077('0x13')](_0x2810b4[_0xe077('0x12')])[_0xe077('0x14')](function(_0x1d8673){if(_0x1d8673){_0x2810b4['UserId']=_0x1d8673['id'];}utils[_0xe077('0x15')](_0xe077('0x16'),_0x2810b4);});}else{utils['request']('CreateVoiceCallReport',_0x2810b4);}if(channels[_0x2810b4['uniqueid']]){delete channels[_0x2810b4[_0xe077('0x9')]];}else if(_0x2e5a85&&channels[_0x2e5a85]){if(!transfers[_0xe077('0x8')][_0x2e5a85][_0xe077('0x17')])delete transfers[_0xe077('0x8')][_0x2e5a85];delete channels[_0x2e5a85];}}exports[_0xe077('0x18')]=function(_0x1787fa){try{utils[_0xe077('0x19')](util[_0xe077('0xb')](_0xe077('0x1a'),_0x1787fa[_0xe077('0x9')]),_0x1787fa);if(_0x1787fa['uniqueid']==_0x1787fa[_0xe077('0x1b')]&&_0x1787fa[_0xe077('0x1c')]!=_0xe077('0x1d')){utils['info'](util[_0xe077('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1787fa[_0xe077('0x9')],_0x1787fa[_0xe077('0x1e')],_0x1787fa[_0xe077('0x1f')]));channels[_0x1787fa['uniqueid']]={'uniqueid':_0x1787fa[_0xe077('0x9')],'accountcode':_0x1787fa[_0xe077('0x12')],'source':_0x1787fa[_0xe077('0xf')],'destination':_0x1787fa[_0xe077('0x1f')],'destinationcontext':_0x1787fa[_0xe077('0x1e')],'channel':_0x1787fa[_0xe077('0x1c')],'starttime':utils[_0xe077('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe077('0x5'),'amaflags':_0xe077('0x21')};}}catch(_0x5d9a10){utils[_0xe077('0x22')](util[_0xe077('0xb')]('[%s][calls][newchannel]',_0x1787fa[_0xe077('0x9')]),_0x5d9a10);}};exports[_0xe077('0x23')]=function(_0x1db4f1){try{utils[_0xe077('0x19')](util[_0xe077('0xb')](_0xe077('0x24'),_0x1db4f1[_0xe077('0x9')]),_0x1db4f1);if(!_[_0xe077('0x25')](channels[_0x1db4f1['uniqueid']])&&_0x1db4f1[_0xe077('0x26')]==0x6){utils[_0xe077('0x27')](util[_0xe077('0xb')](_0xe077('0x28'),_0x1db4f1[_0xe077('0x9')],_0x1db4f1[_0xe077('0x1e')],_0x1db4f1[_0xe077('0x1c')]));if(_[_0xe077('0x25')](channels[_0x1db4f1[_0xe077('0x9')]][_0xe077('0x29')])){channels[_0x1db4f1[_0xe077('0x9')]][_0xe077('0x29')]=utils[_0xe077('0x20')]();}}else if(!_['isNil'](channels[_0x1db4f1[_0xe077('0x1b')]])&&_0x1db4f1['channelstate']==0x6&&_0x1db4f1[_0xe077('0x1e')]!=_0xe077('0x2a')){utils[_0xe077('0x27')](util['format'](_0xe077('0x2b'),_0x1db4f1[_0xe077('0x9')],_0x1db4f1[_0xe077('0x1b')],_0x1db4f1[_0xe077('0x1e')],_0x1db4f1[_0xe077('0x1c')]));channels[_0x1db4f1[_0xe077('0x1b')]][_0xe077('0x12')]=_0x1db4f1[_0xe077('0x12')];channels[_0x1db4f1[_0xe077('0x1b')]][_0xe077('0x2c')]=_0x1db4f1[_0xe077('0x1c')];if(_[_0xe077('0x25')](channels[_0x1db4f1[_0xe077('0x1b')]][_0xe077('0x2d')])){channels[_0x1db4f1[_0xe077('0x1b')]]['answertime']=utils['now']();}channels[_0x1db4f1[_0xe077('0x1b')]][_0xe077('0x2e')]=dispositions[_['toNumber'](_0x1db4f1['channelstate'])]||_0xe077('0x6');}}catch(_0x3870b1){utils[_0xe077('0x22')](util[_0xe077('0xb')]('[%s][calls][newstate]',_0x1db4f1['uniqueid']),_0x3870b1);}};exports[_0xe077('0x2f')]=function(_0x18ae9f){try{if(!_[_0xe077('0x25')](channels[_0x18ae9f[_0xe077('0x9')]])){utils[_0xe077('0x19')](util['format'](_0xe077('0x30'),_0x18ae9f['uniqueid']),_0x18ae9f);if(_['isNil'](channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x31')])){channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x31')]=_0x18ae9f[_0xe077('0x32')]+'\x20<'+_0x18ae9f['calleridnum']+'>';}utils[_0xe077('0x27')](util[_0xe077('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x18ae9f[_0xe077('0x9')],channels[_0x18ae9f['uniqueid']]['callerid'],_0x18ae9f[_0xe077('0x33')]));channels[_0x18ae9f['uniqueid']]['endtime']=utils[_0xe077('0x20')]();channels[_0x18ae9f[_0xe077('0x9')]]['duration']=utils['diffTime'](channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x34')],channels[_0x18ae9f['uniqueid']]['starttime']);channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x35')]=channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x2d')]?utils[_0xe077('0x36')](channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x34')],channels[_0x18ae9f[_0xe077('0x9')]][_0xe077('0x2d')]):0x0;writeDB(channels[_0x18ae9f[_0xe077('0x9')]]);}}catch(_0x2c4332){utils[_0xe077('0x22')](util[_0xe077('0xb')]('[%s][calls][hangup]',_0x18ae9f[_0xe077('0x9')]),_0x2c4332);}};exports[_0xe077('0x37')]=function(_0x5d0825){try{if(!_[_0xe077('0x25')](channels[_0x5d0825[_0xe077('0x38')]])){utils[_0xe077('0x19')](util['format'](_0xe077('0x39'),_0x5d0825[_0xe077('0x3a')]),_0x5d0825);if(channels[_0x5d0825[_0xe077('0x38')]]['channel']==_0x5d0825[_0xe077('0x3b')]){utils['info'](util[_0xe077('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5d0825['origtransfereruniqueid'],_0x5d0825[_0xe077('0x38')],_0x5d0825['secondtransfererchannel']));channels[_0x5d0825[_0xe077('0x38')]]['destinationchannel']=_0x5d0825['secondtransfererchannel'];channels[_0x5d0825[_0xe077('0x38')]][_0xe077('0x3c')]=_0xe077('0x3d');}else if(channels[_0x5d0825[_0xe077('0x38')]][_0xe077('0x1c')]=_0x5d0825[_0xe077('0x3e')]){utils['info'](util[_0xe077('0xb')](_0xe077('0x3f'),_0x5d0825[_0xe077('0x3a')],_0x5d0825[_0xe077('0x38')],_0x5d0825[_0xe077('0x40')]));channels[_0x5d0825['localtwolinkedid']]['destinationchannel']=_0x5d0825[_0xe077('0x40')];channels[_0x5d0825[_0xe077('0x38')]][_0xe077('0x3c')]='_attended';}}}catch(_0xa4c344){utils[_0xe077('0x22')](util[_0xe077('0xb')](_0xe077('0x39'),_0x5d0825[_0xe077('0x3a')]),_0xa4c344);}};exports[_0xe077('0x41')]=function(_0x112375){try{if(!_[_0xe077('0x25')](channels[_0x112375[_0xe077('0x9')]])){utils[_0xe077('0x19')](util[_0xe077('0xb')](_0xe077('0x42'),_0x112375['uniqueid']),_0x112375);channels[_0x112375[_0xe077('0x9')]][_0xe077('0x43')]=utils[_0xe077('0x20')]();utils['info'](util['format'](_0xe077('0x44'),_0x112375[_0xe077('0x9')],channels[_0x112375[_0xe077('0x9')]][_0xe077('0x43')]));}}catch(_0x4b9ff7){utils[_0xe077('0x22')](util[_0xe077('0xb')](_0xe077('0x42'),_0x112375['uniqueid']),_0x4b9ff7);}};exports[_0xe077('0x45')]=function(_0x513a6f){try{if(!_[_0xe077('0x25')](channels[_0x513a6f[_0xe077('0x9')]])){utils[_0xe077('0x19')](util[_0xe077('0xb')](_0xe077('0x46'),_0x513a6f['uniqueid']),_0x513a6f);if(!_[_0xe077('0x25')](channels[_0x513a6f['uniqueid']][_0xe077('0x43')])){channels[_0x513a6f['uniqueid']][_0xe077('0x47')]+=utils[_0xe077('0x36')](utils[_0xe077('0x20')](),channels[_0x513a6f[_0xe077('0x9')]]['musiconholdstartAt']);utils['info'](util['format'](_0xe077('0x48'),_0x513a6f['uniqueid'],channels[_0x513a6f['uniqueid']][_0xe077('0x47')]));delete channels[_0x513a6f[_0xe077('0x9')]][_0xe077('0x43')];}}}catch(_0x115409){utils[_0xe077('0x22')](util['format'](_0xe077('0x46'),_0x513a6f[_0xe077('0x9')]),_0x115409);}};exports['varset']=function(_0x53131){try{if(!_[_0xe077('0x25')](channels[_0x53131[_0xe077('0x9')]])){utils['debug'](util[_0xe077('0xb')](_0xe077('0x49'),_0x53131['uniqueid']),_0x53131);if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')]['xmd-originatecalleridnum'])){utils[_0xe077('0x27')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x53131[_0xe077('0x9')],_0x53131[_0xe077('0x4b')]));channels[_0x53131[_0xe077('0x9')]][_0xe077('0x4c')]=_0x53131['value'];}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x4d')])){utils['info'](util[_0xe077('0xb')](_0xe077('0x4e'),_0x53131[_0xe077('0x9')],_0x53131[_0xe077('0x4b')]));channels[_0x53131[_0xe077('0x9')]][_0xe077('0x4f')]=_0x53131['value'];channels[_0x53131[_0xe077('0x9')]][_0xe077('0x31')]='\x22'+_0x53131[_0xe077('0x4b')]+_0xe077('0x50')+_0x53131[_0xe077('0x4b')]+'>';}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x51')])||!_[_0xe077('0x25')](_0x53131['variable'][_0xe077('0x52')])){utils['info'](util[_0xe077('0xb')](_0xe077('0x53'),_0x53131[_0xe077('0x9')],!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')]['xmd-callerid-preview'])?_0xe077('0x51'):'xmd-callerid',_0x53131[_0xe077('0x4b')]));channels[_0x53131[_0xe077('0x9')]]['callerid']=_0x53131[_0xe077('0x4b')];}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x54')])||!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x55')])){utils['info'](util[_0xe077('0xb')](_0xe077('0x53'),_0x53131[_0xe077('0x9')],!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')]['xmd-queue'])?_0xe077('0x54'):'xmcs-queue',_0x53131[_0xe077('0x4b')]));channels[_0x53131[_0xe077('0x9')]][_0xe077('0x56')]=_0xe077('0x57');channels[_0x53131['uniqueid']][_0xe077('0x58')]=_0x53131[_0xe077('0x4b')];channels[_0x53131[_0xe077('0x9')]][_0xe077('0xc')]=!![];}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x59')])){utils[_0xe077('0x27')](util[_0xe077('0xb')](_0xe077('0x5a'),_0x53131[_0xe077('0x9')],_0x53131[_0xe077('0x4b')]));channels[_0x53131['uniqueid']]['ContactId']=_0x53131[_0xe077('0x4b')];}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')]['xmd-cdrtype'])){utils['info'](util[_0xe077('0xb')](_0xe077('0x5b'),_0x53131[_0xe077('0x9')],_0x53131[_0xe077('0x4b')]));channels[_0x53131[_0xe077('0x9')]][_0xe077('0x5c')]=_0x53131['value'];}if(!_[_0xe077('0x25')](_0x53131[_0xe077('0x4a')][_0xe077('0x5d')])){utils[_0xe077('0x27')](util[_0xe077('0xb')](_0xe077('0x5e'),_0x53131[_0xe077('0x9')],_0x53131[_0xe077('0x4b')]));channels[_0x53131['uniqueid']]['routeid']=_0x53131[_0xe077('0x4b')];}if(!_[_0xe077('0x25')](_0x53131['variable']['sipcallid'])){utils[_0xe077('0x27')](util[_0xe077('0xb')](_0xe077('0x5f'),_0x53131[_0xe077('0x9')],_0x53131['value']));channels[_0x53131[_0xe077('0x9')]]['sipcallid']=_0x53131[_0xe077('0x4b')];}}}catch(_0x3d38ea){utils[_0xe077('0x22')](util[_0xe077('0xb')](_0xe077('0x49'),_0x53131['uniqueid']),_0x3d38ea);}};exports['newexten']=function(_0x18fd47){try{if(!_[_0xe077('0x25')](channels[_0x18fd47[_0xe077('0x9')]])){utils[_0xe077('0x19')](util['format'](_0xe077('0x60'),_0x18fd47[_0xe077('0x9')]),_0x18fd47);utils['info'](util[_0xe077('0xb')](_0xe077('0x61'),_0x18fd47['uniqueid'],_0x18fd47['application'],_0x18fd47[_0xe077('0x62')]));if(_0x18fd47[_0xe077('0x63')]['toLowerCase']()=='set'&&_[_0xe077('0x64')](_0x18fd47[_0xe077('0x62')][_0xe077('0x65')](),_0xe077('0x66'))){var _0xcd762b=_0x18fd47[_0xe077('0x62')][_0xe077('0x67')]('=');var _0x4b01c3=_0xcd762b[0x0][_0xe077('0x68')](_0xcd762b[0x0][_0xe077('0x69')]('(')+0x1,_0xcd762b[0x0]['lastIndexOf'](')'));var _0x1e7312=_0xcd762b[0x1];channels[_0x18fd47[_0xe077('0x9')]][_0x4b01c3]=_0x1e7312;}if(!_[_0xe077('0x6a')]([_0xe077('0x2f'),'noop',_0xe077('0x6b'),_0xe077('0x6c'),_0xe077('0x6d')],_0x18fd47[_0xe077('0x63')][_0xe077('0x65')]())){channels[_0x18fd47[_0xe077('0x9')]]['lastapplication']=_0x18fd47[_0xe077('0x63')];channels[_0x18fd47[_0xe077('0x9')]][_0xe077('0x58')]=_0x18fd47[_0xe077('0x62')];}}}catch(_0x3879f6){utils['error'](util[_0xe077('0xb')](_0xe077('0x60'),_0x18fd47[_0xe077('0x9')]),_0x3879f6);}}; \ No newline at end of file +var _0x98a7=['split','substring','lastIndexOf','includes','noop','gotoif','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','recording','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','error','newstate','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr'];(function(_0x49478e,_0x777dce){var _0x4ff8a3=function(_0xeb97c3){while(--_0xeb97c3){_0x49478e['push'](_0x49478e['shift']());}};_0x4ff8a3(++_0x777dce);}(_0x98a7,0xdf));var _0x798a=function(_0xa6bdce,_0x491429){_0xa6bdce=_0xa6bdce-0x0;var _0x594480=_0x98a7[_0xa6bdce];return _0x594480;};'use strict';var _=require(_0x798a('0x0'));var util=require(_0x798a('0x1'));var utils=require(_0x798a('0x2'));var transfers=require(_0x798a('0x3'));var dispositions=[_0x798a('0x4'),_0x798a('0x5'),_0x798a('0x5'),'NO\x20ANSWER',_0x798a('0x4'),_0x798a('0x4'),_0x798a('0x6'),_0x798a('0x7'),_0x798a('0x5'),_0x798a('0x5'),_0x798a('0x5')];var channels={};function writeDB(_0x231211){var _0x23e98a;if(transfers[_0x798a('0x8')][_0x231211['uniqueid']]){_0x23e98a=_0x231211[_0x798a('0x9')];_0x231211['uniqueid']=transfers['blinds'][_0x231211[_0x798a('0x9')]][_0x798a('0xa')];}utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0xd'),_0x231211['uniqueid'],_0x231211[_0x798a('0xe')],_0x231211[_0x798a('0xf')],_0x231211['membername'],_0x231211[_0x798a('0x10')],_0x231211[_0x798a('0x11')],_0x231211[_0x798a('0x12')],_0x231211['lastevent']));if(_0x231211['accountcode']){utils[_0x798a('0x13')](_0x231211[_0x798a('0x14')])[_0x798a('0x15')](function(_0x36a05a){if(_0x36a05a){_0x231211[_0x798a('0x16')]=_0x36a05a['id'];}utils['request'](_0x798a('0x17'),_0x231211);});}else{utils['request'](_0x798a('0x17'),_0x231211);}if(channels[_0x231211[_0x798a('0x9')]]){delete channels[_0x231211[_0x798a('0x9')]];}else if(_0x23e98a&&channels[_0x23e98a]){if(!transfers[_0x798a('0x8')][_0x23e98a][_0x798a('0x18')])delete transfers['blinds'][_0x23e98a];delete channels[_0x23e98a];}}exports['newchannel']=function(_0x3427d5){try{utils['debug'](util[_0x798a('0xc')](_0x798a('0x19'),_0x3427d5['uniqueid']),_0x3427d5);if(_0x3427d5[_0x798a('0x9')]==_0x3427d5[_0x798a('0x1a')]&&_0x3427d5[_0x798a('0xe')]!=_0x798a('0x1b')){utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3427d5['uniqueid'],_0x3427d5[_0x798a('0x1c')],_0x3427d5[_0x798a('0x1d')]));channels[_0x3427d5[_0x798a('0x9')]]={'uniqueid':_0x3427d5[_0x798a('0x9')],'accountcode':_0x3427d5[_0x798a('0x14')],'source':_0x3427d5['calleridnum'],'destination':_0x3427d5[_0x798a('0x1d')],'destinationcontext':_0x3427d5[_0x798a('0x1c')],'channel':_0x3427d5[_0x798a('0xe')],'starttime':utils[_0x798a('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x798a('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x3a9e9f){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][newchannel]',_0x3427d5['uniqueid']),_0x3a9e9f);}};exports[_0x798a('0x20')]=function(_0x546b4c){try{utils[_0x798a('0x21')](util[_0x798a('0xc')](_0x798a('0x22'),_0x546b4c[_0x798a('0x9')]),_0x546b4c);if(!_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x9')]])&&_0x546b4c[_0x798a('0x24')]==0x6){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x25'),_0x546b4c['uniqueid'],_0x546b4c[_0x798a('0x1c')],_0x546b4c[_0x798a('0xe')]));if(_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x9')]][_0x798a('0x26')])){channels[_0x546b4c[_0x798a('0x9')]][_0x798a('0x26')]=utils[_0x798a('0x1e')]();}}else if(!_[_0x798a('0x23')](channels[_0x546b4c['linkedid']])&&_0x546b4c[_0x798a('0x24')]==0x6&&_0x546b4c['context']!=_0x798a('0x27')){utils[_0x798a('0xb')](util['format'](_0x798a('0x28'),_0x546b4c[_0x798a('0x9')],_0x546b4c[_0x798a('0x1a')],_0x546b4c[_0x798a('0x1c')],_0x546b4c[_0x798a('0xe')]));channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x14')]=_0x546b4c['accountcode'];channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x29')]=_0x546b4c[_0x798a('0xe')];if(_[_0x798a('0x23')](channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2a')])){channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2a')]=utils[_0x798a('0x1e')]();}channels[_0x546b4c[_0x798a('0x1a')]][_0x798a('0x2b')]=dispositions[_[_0x798a('0x2c')](_0x546b4c[_0x798a('0x24')])]||_0x798a('0x6');}}catch(_0x543374){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][newstate]',_0x546b4c[_0x798a('0x9')]),_0x543374);}};exports[_0x798a('0x2d')]=function(_0x47fdb0){try{if(!_[_0x798a('0x23')](channels[_0x47fdb0[_0x798a('0x9')]])){utils[_0x798a('0x21')](util[_0x798a('0xc')]('[%s][calls][hangup]',_0x47fdb0[_0x798a('0x9')]),_0x47fdb0);if(_[_0x798a('0x23')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')])){channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')]=_0x47fdb0[_0x798a('0x2f')]+'\x20<'+_0x47fdb0['calleridnum']+'>';}utils[_0x798a('0xb')](util['format'](_0x798a('0x30'),_0x47fdb0[_0x798a('0x9')],channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2e')],_0x47fdb0['cause-txt']));channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')]=utils[_0x798a('0x1e')]();channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x32')]=utils[_0x798a('0x33')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')],channels[_0x47fdb0[_0x798a('0x9')]]['starttime']);channels[_0x47fdb0['uniqueid']]['billableseconds']=channels[_0x47fdb0[_0x798a('0x9')]]['answertime']?utils[_0x798a('0x33')](channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x31')],channels[_0x47fdb0[_0x798a('0x9')]][_0x798a('0x2a')]):0x0;writeDB(channels[_0x47fdb0['uniqueid']]);}}catch(_0x325602){utils['error'](util[_0x798a('0xc')](_0x798a('0x34'),_0x47fdb0['uniqueid']),_0x325602);}};exports[_0x798a('0x35')]=function(_0xbb494b){try{if(!_[_0x798a('0x23')](channels[_0xbb494b[_0x798a('0x36')]])){utils[_0x798a('0x21')](util[_0x798a('0xc')]('[%s][calls][attendedtransfer]',_0xbb494b[_0x798a('0x37')]),_0xbb494b);if(channels[_0xbb494b['localtwolinkedid']][_0x798a('0xe')]==_0xbb494b[_0x798a('0x38')]){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x39'),_0xbb494b[_0x798a('0x37')],_0xbb494b[_0x798a('0x36')],_0xbb494b['secondtransfererchannel']));channels[_0xbb494b[_0x798a('0x36')]][_0x798a('0x29')]=_0xbb494b['secondtransfererchannel'];channels[_0xbb494b[_0x798a('0x36')]][_0x798a('0x3a')]=_0x798a('0x3b');}else if(channels[_0xbb494b['localtwolinkedid']]['channel']=_0xbb494b['transfertargetchannel']){utils[_0x798a('0xb')](util['format'](_0x798a('0x39'),_0xbb494b[_0x798a('0x37')],_0xbb494b[_0x798a('0x36')],_0xbb494b[_0x798a('0x3c')]));channels[_0xbb494b['localtwolinkedid']][_0x798a('0x29')]=_0xbb494b[_0x798a('0x3c')];channels[_0xbb494b['localtwolinkedid']][_0x798a('0x3a')]=_0x798a('0x3b');}}}catch(_0x2e215a){utils[_0x798a('0x1f')](util['format'](_0x798a('0x3d'),_0xbb494b[_0x798a('0x37')]),_0x2e215a);}};exports['musiconholdstart']=function(_0x29ffb9){try{if(!_['isNil'](channels[_0x29ffb9[_0x798a('0x9')]])){utils[_0x798a('0x21')](util['format'](_0x798a('0x3e'),_0x29ffb9[_0x798a('0x9')]),_0x29ffb9);channels[_0x29ffb9[_0x798a('0x9')]][_0x798a('0x3f')]=utils[_0x798a('0x1e')]();utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x40'),_0x29ffb9[_0x798a('0x9')],channels[_0x29ffb9[_0x798a('0x9')]][_0x798a('0x3f')]));}}catch(_0x2a3d87){utils[_0x798a('0x1f')](util[_0x798a('0xc')](_0x798a('0x3e'),_0x29ffb9[_0x798a('0x9')]),_0x2a3d87);}};exports[_0x798a('0x41')]=function(_0x4cba9c){try{if(!_[_0x798a('0x23')](channels[_0x4cba9c[_0x798a('0x9')]])){utils['debug'](util[_0x798a('0xc')](_0x798a('0x42'),_0x4cba9c[_0x798a('0x9')]),_0x4cba9c);if(!_[_0x798a('0x23')](channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x3f')])){channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x43')]+=utils['diffTime'](utils[_0x798a('0x1e')](),channels[_0x4cba9c['uniqueid']][_0x798a('0x3f')]);utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x4cba9c[_0x798a('0x9')],channels[_0x4cba9c['uniqueid']][_0x798a('0x43')]));delete channels[_0x4cba9c[_0x798a('0x9')]][_0x798a('0x3f')];}}}catch(_0x244d29){utils['error'](util[_0x798a('0xc')](_0x798a('0x42'),_0x4cba9c[_0x798a('0x9')]),_0x244d29);}};exports[_0x798a('0x44')]=function(_0x171a55){try{if(!_[_0x798a('0x23')](channels[_0x171a55['uniqueid']])){utils[_0x798a('0x21')](util[_0x798a('0xc')](_0x798a('0x45'),_0x171a55['uniqueid']),_0x171a55);if(!_['isNil'](_0x171a55[_0x798a('0x46')]['xmd-originatecalleridnum'])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x47'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x49')]=_0x171a55[_0x798a('0x48')];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x4a')])){utils[_0x798a('0xb')](util[_0x798a('0xc')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']][_0x798a('0x4b')]=_0x171a55[_0x798a('0x48')];channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x2e')]='\x22'+_0x171a55['value']+_0x798a('0x4c')+_0x171a55['value']+'>';}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x4d')])||!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')]['xmd-callerid'])){utils['info'](util[_0x798a('0xc')](_0x798a('0x4e'),_0x171a55['uniqueid'],!_['isNil'](_0x171a55[_0x798a('0x46')][_0x798a('0x4d')])?_0x798a('0x4d'):_0x798a('0x4f'),_0x171a55['value']));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x2e')]=_0x171a55['value'];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x50')])||!_['isNil'](_0x171a55[_0x798a('0x46')]['xmcs-queue'])){utils[_0x798a('0xb')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x171a55[_0x798a('0x9')],!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x50')])?_0x798a('0x50'):_0x798a('0x51'),_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']][_0x798a('0x52')]=_0x798a('0x53');channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x54')]=_0x171a55[_0x798a('0x48')];channels[_0x171a55['uniqueid']][_0x798a('0xf')]=!![];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x55')])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x56'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x57')]=_0x171a55[_0x798a('0x48')];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x58')])){utils[_0x798a('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x171a55['uniqueid'],_0x171a55[_0x798a('0x48')]));channels[_0x171a55[_0x798a('0x9')]][_0x798a('0x59')]=_0x171a55['value'];}if(!_[_0x798a('0x23')](_0x171a55[_0x798a('0x46')][_0x798a('0x5a')])){utils[_0x798a('0xb')](util[_0x798a('0xc')](_0x798a('0x5b'),_0x171a55[_0x798a('0x9')],_0x171a55[_0x798a('0x48')]));channels[_0x171a55['uniqueid']]['routeid']=_0x171a55[_0x798a('0x48')];}if(!_['isNil'](_0x171a55['variable'][_0x798a('0x5c')])){utils[_0x798a('0xb')](util['format'](_0x798a('0x5d'),_0x171a55[_0x798a('0x9')],_0x171a55['value']));channels[_0x171a55[_0x798a('0x9')]]['sipcallid']=_0x171a55[_0x798a('0x48')];}}}catch(_0x5bfc12){utils[_0x798a('0x1f')](util[_0x798a('0xc')]('[%s][calls][varset]',_0x171a55[_0x798a('0x9')]),_0x5bfc12);}};exports[_0x798a('0x5e')]=function(_0x4b6202){try{if(!_[_0x798a('0x23')](channels[_0x4b6202[_0x798a('0x9')]])){utils['debug'](util[_0x798a('0xc')]('[%s][calls][newexten]',_0x4b6202['uniqueid']),_0x4b6202);utils[_0x798a('0xb')](util['format'](_0x798a('0x5f'),_0x4b6202[_0x798a('0x9')],_0x4b6202[_0x798a('0x60')],_0x4b6202[_0x798a('0x61')]));if(_0x4b6202[_0x798a('0x60')][_0x798a('0x62')]()=='set'&&_[_0x798a('0x63')](_0x4b6202['appdata']['toLowerCase'](),_0x798a('0x64'))){var _0x31f90f=_0x4b6202[_0x798a('0x61')][_0x798a('0x65')]('=');var _0x4f9440=_0x31f90f[0x0][_0x798a('0x66')](_0x31f90f[0x0][_0x798a('0x67')]('(')+0x1,_0x31f90f[0x0][_0x798a('0x67')](')'));var _0x40cc19=_0x31f90f[0x1];channels[_0x4b6202[_0x798a('0x9')]][_0x4f9440]=_0x40cc19;}if(!_[_0x798a('0x68')]([_0x798a('0x2d'),_0x798a('0x69'),'execif','set',_0x798a('0x6a')],_0x4b6202[_0x798a('0x60')]['toLowerCase']())){channels[_0x4b6202[_0x798a('0x9')]]['lastapplication']=_0x4b6202[_0x798a('0x60')];channels[_0x4b6202[_0x798a('0x9')]][_0x798a('0x54')]=_0x4b6202['appdata'];}}}catch(_0x168fbb){utils[_0x798a('0x1f')](util['format'](_0x798a('0x6b'),_0x4b6202[_0x798a('0x9')]),_0x168fbb);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8c63172..1c6dc5c 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 _0xd07f=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x5c7ab9,_0x147fca){var _0x47e6cb=function(_0x4bcaeb){while(--_0x4bcaeb){_0x5c7ab9['push'](_0x5c7ab9['shift']());}};_0x47e6cb(++_0x147fca);}(_0xd07f,0x165));var _0xfd07=function(_0x1b0b03,_0xf4a51f){_0x1b0b03=_0x1b0b03-0x0;var _0x58ea98=_0xd07f[_0x1b0b03];return _0x58ea98;};'use strict';var utils=require(_0xfd07('0x0'));exports[_0xfd07('0x1')]=function(){utils[_0xfd07('0x2')](_0xfd07('0x3'));};exports[_0xfd07('0x4')]=function(){utils[_0xfd07('0x2')](_0xfd07('0x5'));};exports[_0xfd07('0x6')]=function(){utils[_0xfd07('0x2')]('[core]\x20fullybooted');};exports[_0xfd07('0x7')]=function(_0x21d9be){utils[_0xfd07('0x7')](_0xfd07('0x8'),_0x21d9be);};exports[_0xfd07('0x9')]=function(){utils[_0xfd07('0x2')](_0xfd07('0xa'));};exports[_0xfd07('0xb')]=function(_0x4b5232){}; \ No newline at end of file +var _0xc2f9=['[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x18b112,_0x4b3e8c){var _0x3b8831=function(_0x3765bb){while(--_0x3765bb){_0x18b112['push'](_0x18b112['shift']());}};_0x3b8831(++_0x4b3e8c);}(_0xc2f9,0x167));var _0x9c2f=function(_0x8bc89,_0x3c83bc){_0x8bc89=_0x8bc89-0x0;var _0x2c42b6=_0xc2f9[_0x8bc89];return _0x2c42b6;};'use strict';var utils=require(_0x9c2f('0x0'));exports['connect']=function(){utils['info'](_0x9c2f('0x1'));};exports[_0x9c2f('0x2')]=function(){utils[_0x9c2f('0x3')](_0x9c2f('0x4'));};exports[_0x9c2f('0x5')]=function(){utils['info'](_0x9c2f('0x6'));};exports[_0x9c2f('0x7')]=function(_0xc8c200){utils[_0x9c2f('0x7')](_0x9c2f('0x8'),_0xc8c200);};exports[_0x9c2f('0x9')]=function(){utils[_0x9c2f('0x3')](_0x9c2f('0xa'));};exports[_0x9c2f('0xb')]=function(_0x447361){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 76f7c8a..099dc0e 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 _0xad1c=['error','[%s][dials][varset]','dialbegin','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','calleridname','cause-txt','assign','duration','diffTime','endtime','holdtime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','varset','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xad1c,0x107));var _0xcad1=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xad1c[_0x5416db];return _0x243e35;};'use strict';var _=require('lodash');var util=require(_0xcad1('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x2f4bf1){utils[_0xcad1('0x1')](util[_0xcad1('0x2')](_0xcad1('0x3'),_0x2f4bf1[_0xcad1('0x4')],_0x2f4bf1[_0xcad1('0x5')],_0x2f4bf1[_0xcad1('0x6')],_0x2f4bf1[_0xcad1('0x7')],_0x2f4bf1['connectedlinenum'],_0x2f4bf1[_0xcad1('0x8')]));utils[_0xcad1('0x9')](_0xcad1('0xa'),_0x2f4bf1);delete dials[_0x2f4bf1[_0xcad1('0x4')]];}exports['newexten']=function(_0x57650a){try{utils[_0xcad1('0xb')](util[_0xcad1('0x2')](_0xcad1('0xc'),_0x57650a[_0xcad1('0x4')]),_0x57650a);utils[_0xcad1('0x1')](util[_0xcad1('0x2')](_0xcad1('0xd'),_0x57650a[_0xcad1('0x4')],_0x57650a[_0xcad1('0xe')],_0x57650a[_0xcad1('0xf')]));if(_0x57650a[_0xcad1('0xe')][_0xcad1('0x10')]()==_0xcad1('0x11')&&_[_0xcad1('0x12')](_0x57650a['appdata']['toLowerCase'](),_0xcad1('0x13'))){var _0x1bc538=_0x57650a['appdata'][_0xcad1('0x14')]('=');dials[_0x57650a[_0xcad1('0x4')]]={'routeId':_0x1bc538[0x1]};}}catch(_0x6a54ed){utils['error'](util[_0xcad1('0x2')](_0xcad1('0xc'),_0x57650a['uniqueid']),_0x6a54ed);}};exports[_0xcad1('0x15')]=function(_0x4e10cb){try{utils[_0xcad1('0xb')](util['format']('[%s][dials][varset]',_0x4e10cb['uniqueid']),_0x4e10cb);if(!_[_0xcad1('0x16')](_0x4e10cb['variable']['outboundrouteid'])){utils[_0xcad1('0x1')](util[_0xcad1('0x2')](_0xcad1('0x17'),_0x4e10cb[_0xcad1('0x4')],_0x4e10cb['value']));dials[_0x4e10cb[_0xcad1('0x4')]]={'routeId':_0x4e10cb[_0xcad1('0x18')]};}}catch(_0x3e17fe){utils[_0xcad1('0x19')](util[_0xcad1('0x2')](_0xcad1('0x1a'),_0x4e10cb[_0xcad1('0x4')]),_0x3e17fe);}};exports[_0xcad1('0x1b')]=function(_0x3863ea){try{if(!_[_0xcad1('0x16')](dials[_0x3863ea[_0xcad1('0x4')]])){utils[_0xcad1('0xb')](util[_0xcad1('0x2')]('[%s][dials][dialbegin]',_0x3863ea[_0xcad1('0x4')]),_0x3863ea);dials[_0x3863ea[_0xcad1('0x4')]]=_['assign'](dials[_0x3863ea['uniqueid']],_0x3863ea);dials[_0x3863ea['uniqueid']][_0xcad1('0x1c')]=utils[_0xcad1('0x1d')]();dials[_0x3863ea[_0xcad1('0x4')]][_0xcad1('0x1e')]=_0xcad1('0x1f');utils['info'](util['format'](_0xcad1('0x20'),_0x3863ea['uniqueid'],dials[_0x3863ea[_0xcad1('0x4')]]['starttime']));}}catch(_0x4f5c39){utils[_0xcad1('0x19')](util['format'](_0xcad1('0x21'),_0x3863ea[_0xcad1('0x4')]),_0x4f5c39);}};exports[_0xcad1('0x22')]=function(_0x53af03){try{if(!_['isNil'](dials[_0x53af03[_0xcad1('0x4')]])){utils[_0xcad1('0xb')](util[_0xcad1('0x2')]('[%s][dials][dialend]',_0x53af03[_0xcad1('0x4')]),_0x53af03);dials[_0x53af03[_0xcad1('0x4')]][_0xcad1('0x8')]=_0x53af03['dialstatus'];if(_0x53af03[_0xcad1('0x8')]==_0xcad1('0x23')){dials[_0x53af03['uniqueid']]=_['assign'](dials[_0x53af03[_0xcad1('0x4')]],_0x53af03);dials[_0x53af03[_0xcad1('0x4')]]['answertime']=utils[_0xcad1('0x1d')]();dials[_0x53af03[_0xcad1('0x4')]]['lastevent']='connect';utils[_0xcad1('0x1')](util[_0xcad1('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x53af03[_0xcad1('0x4')],_0x53af03['dialstatus'],dials[_0x53af03[_0xcad1('0x4')]][_0xcad1('0x24')]));}else{utils[_0xcad1('0x1')](util['format'](_0xcad1('0x25'),_0x53af03[_0xcad1('0x4')],_0x53af03[_0xcad1('0x8')]));}}}catch(_0x11a5be){utils[_0xcad1('0x19')](util[_0xcad1('0x2')](_0xcad1('0x26'),_0x53af03[_0xcad1('0x4')]),_0x11a5be);}};exports['hangup']=function(_0x9fa67){try{if(!_[_0xcad1('0x16')](dials[_0x9fa67['uniqueid']])){utils[_0xcad1('0xb')](util[_0xcad1('0x2')](_0xcad1('0x27'),_0x9fa67[_0xcad1('0x4')]),_0x9fa67);utils[_0xcad1('0x1')](util[_0xcad1('0x2')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x9fa67[_0xcad1('0x4')],_0x9fa67[_0xcad1('0x7')],_0x9fa67[_0xcad1('0x28')],_0x9fa67[_0xcad1('0x29')]));dials[_0x9fa67['uniqueid']]=_[_0xcad1('0x2a')](dials[_0x9fa67[_0xcad1('0x4')]],{'endtime':utils[_0xcad1('0x1d')](),'lastevent':'complete'});dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x2b')]=utils[_0xcad1('0x2c')](dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x2d')],dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x1c')]);dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x2e')]=utils[_0xcad1('0x2c')](dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x24')]||dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x2d')],dials[_0x9fa67[_0xcad1('0x4')]]['starttime']);dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x2f')]=dials[_0x9fa67[_0xcad1('0x4')]]['answertime']?utils[_0xcad1('0x2c')](dials[_0x9fa67[_0xcad1('0x4')]]['endtime'],dials[_0x9fa67[_0xcad1('0x4')]][_0xcad1('0x24')]):0x0;writeDB(dials[_0x9fa67[_0xcad1('0x4')]]);}}catch(_0x382a3c){utils[_0xcad1('0x19')](util[_0xcad1('0x2')](_0xcad1('0x27'),_0x9fa67[_0xcad1('0x4')]),_0x382a3c);}}; \ No newline at end of file +var _0x5f79=['dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','dialstatus','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','cause-txt','complete','duration','endtime','diffTime','billableseconds','[%s][dials][hangup]','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x1a3e2b,_0xa75584){var _0x23969f=function(_0x4c69d3){while(--_0x4c69d3){_0x1a3e2b['push'](_0x1a3e2b['shift']());}};_0x23969f(++_0xa75584);}(_0x5f79,0x14a));var _0x95f7=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x5f79[_0x154192];return _0x3c2792;};'use strict';var _=require(_0x95f7('0x0'));var util=require(_0x95f7('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x383479){utils[_0x95f7('0x2')](util[_0x95f7('0x3')](_0x95f7('0x4'),_0x383479[_0x95f7('0x5')],_0x383479['channel'],_0x383479[_0x95f7('0x6')],_0x383479[_0x95f7('0x7')],_0x383479[_0x95f7('0x8')],_0x383479['dialstatus']));utils[_0x95f7('0x9')](_0x95f7('0xa'),_0x383479);delete dials[_0x383479[_0x95f7('0x5')]];}exports[_0x95f7('0xb')]=function(_0x34b09f){try{utils['debug'](util[_0x95f7('0x3')](_0x95f7('0xc'),_0x34b09f[_0x95f7('0x5')]),_0x34b09f);utils[_0x95f7('0x2')](util['format'](_0x95f7('0xd'),_0x34b09f[_0x95f7('0x5')],_0x34b09f[_0x95f7('0xe')],_0x34b09f[_0x95f7('0xf')]));if(_0x34b09f['application'][_0x95f7('0x10')]()==_0x95f7('0x11')&&_[_0x95f7('0x12')](_0x34b09f[_0x95f7('0xf')]['toLowerCase'](),_0x95f7('0x13'))){var _0x9ea4b1=_0x34b09f[_0x95f7('0xf')][_0x95f7('0x14')]('=');dials[_0x34b09f[_0x95f7('0x5')]]={'routeId':_0x9ea4b1[0x1]};}}catch(_0x1678c9){utils[_0x95f7('0x15')](util[_0x95f7('0x3')]('[%s][dials][newexten]',_0x34b09f[_0x95f7('0x5')]),_0x1678c9);}};exports[_0x95f7('0x16')]=function(_0xae79d4){try{utils[_0x95f7('0x17')](util[_0x95f7('0x3')](_0x95f7('0x18'),_0xae79d4[_0x95f7('0x5')]),_0xae79d4);if(!_[_0x95f7('0x19')](_0xae79d4['variable'][_0x95f7('0x1a')])){utils[_0x95f7('0x2')](util[_0x95f7('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0xae79d4[_0x95f7('0x5')],_0xae79d4[_0x95f7('0x1b')]));dials[_0xae79d4[_0x95f7('0x5')]]={'routeId':_0xae79d4['value']};}}catch(_0x4aa5cf){utils[_0x95f7('0x15')](util[_0x95f7('0x3')]('[%s][dials][varset]',_0xae79d4[_0x95f7('0x5')]),_0x4aa5cf);}};exports[_0x95f7('0x1c')]=function(_0x5e24ae){try{if(!_[_0x95f7('0x19')](dials[_0x5e24ae[_0x95f7('0x5')]])){utils['debug'](util[_0x95f7('0x3')](_0x95f7('0x1d'),_0x5e24ae[_0x95f7('0x5')]),_0x5e24ae);dials[_0x5e24ae['uniqueid']]=_[_0x95f7('0x1e')](dials[_0x5e24ae[_0x95f7('0x5')]],_0x5e24ae);dials[_0x5e24ae['uniqueid']]['starttime']=utils[_0x95f7('0x1f')]();dials[_0x5e24ae[_0x95f7('0x5')]][_0x95f7('0x20')]=_0x95f7('0x21');utils['info'](util[_0x95f7('0x3')](_0x95f7('0x22'),_0x5e24ae[_0x95f7('0x5')],dials[_0x5e24ae[_0x95f7('0x5')]][_0x95f7('0x23')]));}}catch(_0x287c68){utils[_0x95f7('0x15')](util['format']('[%s][dials][dialbegin]',_0x5e24ae[_0x95f7('0x5')]),_0x287c68);}};exports['dialend']=function(_0x4785de){try{if(!_[_0x95f7('0x19')](dials[_0x4785de[_0x95f7('0x5')]])){utils[_0x95f7('0x17')](util['format'](_0x95f7('0x24'),_0x4785de['uniqueid']),_0x4785de);dials[_0x4785de['uniqueid']][_0x95f7('0x25')]=_0x4785de[_0x95f7('0x25')];if(_0x4785de[_0x95f7('0x25')]=='ANSWER'){dials[_0x4785de[_0x95f7('0x5')]]=_['assign'](dials[_0x4785de[_0x95f7('0x5')]],_0x4785de);dials[_0x4785de[_0x95f7('0x5')]]['answertime']=utils[_0x95f7('0x1f')]();dials[_0x4785de['uniqueid']][_0x95f7('0x20')]=_0x95f7('0x26');utils['info'](util[_0x95f7('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4785de['uniqueid'],_0x4785de['dialstatus'],dials[_0x4785de['uniqueid']][_0x95f7('0x27')]));}else{utils[_0x95f7('0x2')](util[_0x95f7('0x3')](_0x95f7('0x28'),_0x4785de[_0x95f7('0x5')],_0x4785de[_0x95f7('0x25')]));}}}catch(_0x53b7be){utils[_0x95f7('0x15')](util[_0x95f7('0x3')](_0x95f7('0x24'),_0x4785de[_0x95f7('0x5')]),_0x53b7be);}};exports['hangup']=function(_0x4f29b4){try{if(!_[_0x95f7('0x19')](dials[_0x4f29b4[_0x95f7('0x5')]])){utils[_0x95f7('0x17')](util['format']('[%s][dials][hangup]',_0x4f29b4[_0x95f7('0x5')]),_0x4f29b4);utils[_0x95f7('0x2')](util[_0x95f7('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4f29b4[_0x95f7('0x5')],_0x4f29b4[_0x95f7('0x7')],_0x4f29b4['calleridname'],_0x4f29b4[_0x95f7('0x29')]));dials[_0x4f29b4[_0x95f7('0x5')]]=_[_0x95f7('0x1e')](dials[_0x4f29b4[_0x95f7('0x5')]],{'endtime':utils[_0x95f7('0x1f')](),'lastevent':_0x95f7('0x2a')});dials[_0x4f29b4['uniqueid']][_0x95f7('0x2b')]=utils['diffTime'](dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2c')],dials[_0x4f29b4['uniqueid']][_0x95f7('0x23')]);dials[_0x4f29b4['uniqueid']]['holdtime']=utils[_0x95f7('0x2d')](dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x27')]||dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2c')],dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x23')]);dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x2e')]=dials[_0x4f29b4[_0x95f7('0x5')]][_0x95f7('0x27')]?utils[_0x95f7('0x2d')](dials[_0x4f29b4['uniqueid']][_0x95f7('0x2c')],dials[_0x4f29b4[_0x95f7('0x5')]]['answertime']):0x0;writeDB(dials[_0x4f29b4[_0x95f7('0x5')]]);}}catch(_0x5ac860){utils[_0x95f7('0x15')](util['format'](_0x95f7('0x2f'),_0x4f29b4[_0x95f7('0x5')]),_0x5ac860);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4dc8749..8525554 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 _0xdc19=['password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','error','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','xdr','disabled','env','production','local','asterisk','port','username'];(function(_0x590584,_0x35db98){var _0x43951e=function(_0x2c2fbb){while(--_0x2c2fbb){_0x590584['push'](_0x590584['shift']());}};_0x43951e(++_0x35db98);}(_0xdc19,0x159));var _0x9dc1=function(_0x19628b,_0x449889){_0x19628b=_0x19628b-0x0;var _0x4164a3=_0xdc19[_0x19628b];return _0x4164a3;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x9dc1('0x0'));var util=require(_0x9dc1('0x1'));var isXDREnabled=config[_0x9dc1('0x2')]&&config[_0x9dc1('0x2')][_0x9dc1('0x3')]?!config[_0x9dc1('0x2')][_0x9dc1('0x3')]:!![];var isProduction=config[_0x9dc1('0x4')]===_0x9dc1('0x5')||![];var isLocalAsterisk=config[_0x9dc1('0x2')]&&config[_0x9dc1('0x2')][_0x9dc1('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x9dc1('0x7')][_0x9dc1('0x8')],config['asterisk']['ip'],config[_0x9dc1('0x7')][_0x9dc1('0x9')],config['asterisk'][_0x9dc1('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x9dc1('0xb')](_0x9dc1('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x9dc1('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x9dc1('0xe'));var queues=require('./queues.controller');var recordings=require(_0x9dc1('0xf'));var members=require(_0x9dc1('0x10'));var dials=require(_0x9dc1('0x11'));var transfers=require(_0x9dc1('0x12'));var core=require('./core.controller');ami['on'](_0x9dc1('0x13'),core['connect']);ami['on'](_0x9dc1('0x14'),core['shutdown']);ami['on'](_0x9dc1('0x15'),core['fullybooted']);ami['on']('error',core['error']);ami['on']('close',core[_0x9dc1('0x16')]);ami['on'](_0x9dc1('0x17'),core[_0x9dc1('0x17')]);ami['on'](_0x9dc1('0x18'),function(_0x4d8a7a){try{utils['debug'](util[_0x9dc1('0x19')](_0x9dc1('0x1a'),_0x4d8a7a['device']),_0x4d8a7a);members[_0x9dc1('0x18')](_0x4d8a7a);}catch(_0x416b55){utils['error'](util[_0x9dc1('0x19')](_0x9dc1('0x1a'),_0x4d8a7a[_0x9dc1('0x1b')]),_0x416b55);}});ami['on']('agentcalled',function(_0x24e737){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x1d'),_0x24e737[_0x9dc1('0x1e')]),_0x24e737);agents[_0x9dc1('0x1f')](_0x24e737);}catch(_0x5999c0){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x1d'),_0x24e737[_0x9dc1('0x1e')]),_0x5999c0);}});ami['on'](_0x9dc1('0x21'),function(_0x1717d9){try{utils[_0x9dc1('0x1c')](util['format'](_0x9dc1('0x22'),_0x1717d9[_0x9dc1('0x1e')]),_0x1717d9);agents[_0x9dc1('0x21')](_0x1717d9);}catch(_0x1a2888){utils['error'](util[_0x9dc1('0x19')](_0x9dc1('0x22'),_0x1717d9[_0x9dc1('0x1e')]),_0x1a2888);}});ami['on'](_0x9dc1('0x23'),function(_0x2261cd){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')]('[%s][index][agentconnect]',_0x2261cd[_0x9dc1('0x1e')]),_0x2261cd);agents[_0x9dc1('0x23')](_0x2261cd);queues[_0x9dc1('0x23')](_0x2261cd);}catch(_0x5df88d){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x24'),_0x2261cd[_0x9dc1('0x1e')]),_0x5df88d);}});ami['on'](_0x9dc1('0x25'),function(_0x14b373){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x26'),_0x14b373[_0x9dc1('0x1e')]),_0x14b373);agents[_0x9dc1('0x25')](_0x14b373);queues[_0x9dc1('0x25')](_0x14b373);members[_0x9dc1('0x25')](_0x14b373);}catch(_0x58c28a){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x26'),_0x14b373[_0x9dc1('0x1e')]),_0x58c28a);}});ami['on']('queuecallerabandon',function(_0x807e93){try{utils['debug'](util[_0x9dc1('0x19')](_0x9dc1('0x27'),_0x807e93['uniqueid']),_0x807e93);agents[_0x9dc1('0x28')](_0x807e93);queues[_0x9dc1('0x28')](_0x807e93);}catch(_0x243180){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x27'),_0x807e93['uniqueid']),_0x243180);}});ami['on'](_0x9dc1('0x29'),function(_0x460ca5){try{utils['debug'](util[_0x9dc1('0x19')]('[%s][index][queuecallerjoin]',_0x460ca5[_0x9dc1('0x1e')]),_0x460ca5);queues[_0x9dc1('0x29')](_0x460ca5);recordings[_0x9dc1('0x29')](_0x460ca5);}catch(_0x2a5d65){utils['error'](util[_0x9dc1('0x19')](_0x9dc1('0x2a'),_0x460ca5[_0x9dc1('0x1e')]),_0x2a5d65);}});ami['on'](_0x9dc1('0x2b'),function(_0x288d14){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x2c'),_0x288d14[_0x9dc1('0x1e')]),_0x288d14);queues[_0x9dc1('0x2b')](_0x288d14);}catch(_0x42885c){utils['error'](util['format'](_0x9dc1('0x2c'),_0x288d14['uniqueid']),_0x42885c);}});ami['on']('musiconholdstart',function(_0x2eb009){try{utils[_0x9dc1('0x1c')](util['format']('[%s][index][musiconholdstart]',_0x2eb009[_0x9dc1('0x1e')]),_0x2eb009);queues[_0x9dc1('0x2d')](_0x2eb009);calls[_0x9dc1('0x2d')](_0x2eb009);}catch(_0x23c895){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x2e'),_0x2eb009['uniqueid']),_0x23c895);}});ami['on'](_0x9dc1('0x2f'),function(_0x449e6d){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x30'),_0x449e6d[_0x9dc1('0x1e')]),_0x449e6d);queues[_0x9dc1('0x2f')](_0x449e6d);calls[_0x9dc1('0x2f')](_0x449e6d);}catch(_0x36f47e){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')]('[%s][index][musiconholdstop]',_0x449e6d[_0x9dc1('0x1e')]),_0x36f47e);}});ami['on'](_0x9dc1('0x31'),function(_0x1fea15){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x32'),_0x1fea15[_0x9dc1('0x1e')]),_0x1fea15);calls[_0x9dc1('0x31')](_0x1fea15);recordings[_0x9dc1('0x31')](_0x1fea15);}catch(_0x1178ba){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x32'),_0x1fea15[_0x9dc1('0x1e')]),_0x1178ba);}});ami['on'](_0x9dc1('0x33'),function(_0x540f27){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')]('[%s][index][hangup]',_0x540f27[_0x9dc1('0x1e')]),_0x540f27);calls[_0x9dc1('0x33')](_0x540f27);recordings['hangup'](_0x540f27);dials[_0x9dc1('0x33')](_0x540f27);agents['hangup'](_0x540f27);queues[_0x9dc1('0x33')](_0x540f27);}catch(_0x824afc){utils[_0x9dc1('0x20')](util['format'](_0x9dc1('0x34'),_0x540f27['uniqueid']),_0x824afc);}});ami['on'](_0x9dc1('0x35'),function(_0x14972c){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x36'),_0x14972c[_0x9dc1('0x1e')]),_0x14972c);members[_0x9dc1('0x35')](_0x14972c);}catch(_0x464787){utils[_0x9dc1('0x20')](util['format'](_0x9dc1('0x36'),_0x14972c[_0x9dc1('0x1e')]),_0x464787);}});ami['on'](_0x9dc1('0x37'),function(_0x3bf11a){try{utils[_0x9dc1('0x1c')](util['format'](_0x9dc1('0x38'),_0x3bf11a[_0x9dc1('0x1e')]),_0x3bf11a);queues[_0x9dc1('0x37')](_0x3bf11a);agents[_0x9dc1('0x37')](_0x3bf11a);transfers[_0x9dc1('0x37')](_0x3bf11a);recordings[_0x9dc1('0x37')](_0x3bf11a);}catch(_0x1a9c1d){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')]('[%s][index][blindtransfer]',_0x3bf11a[_0x9dc1('0x1e')]),_0x1a9c1d);}});ami['on'](_0x9dc1('0x39'),function(_0x24ee96){try{utils[_0x9dc1('0x1c')](util['format']('[%s][index][attendedtransfer]',_0x24ee96[_0x9dc1('0x3a')]),_0x24ee96);queues['attendedtransfer'](_0x24ee96);transfers[_0x9dc1('0x39')](_0x24ee96);agents[_0x9dc1('0x39')](_0x24ee96);calls[_0x9dc1('0x39')](_0x24ee96);}catch(_0x4b1cb6){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x3b'),_0x24ee96[_0x9dc1('0x3a')]),_0x4b1cb6);}});ami['on']('varset',function(_0x27982c){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x3c'),_0x27982c[_0x9dc1('0x1e')]),_0x27982c);queues[_0x9dc1('0x3d')](_0x27982c);recordings[_0x9dc1('0x3d')](_0x27982c);calls[_0x9dc1('0x3d')](_0x27982c);dials[_0x9dc1('0x3d')](_0x27982c);}catch(_0x16b2da){utils['error'](util[_0x9dc1('0x19')](_0x9dc1('0x3c'),_0x27982c[_0x9dc1('0x1e')]),_0x16b2da);}});ami['on'](_0x9dc1('0x3e'),function(_0x213fc5){try{utils['debug'](util[_0x9dc1('0x19')](_0x9dc1('0x3f'),_0x213fc5[_0x9dc1('0x1e')]),_0x213fc5);calls[_0x9dc1('0x3e')](_0x213fc5);recordings[_0x9dc1('0x3e')](_0x213fc5);dials['newexten'](_0x213fc5);}catch(_0x50aa07){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x3f'),_0x213fc5[_0x9dc1('0x1e')]),_0x50aa07);}});ami['on']('newchannel',function(_0x3910c6){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x40'),_0x3910c6['uniqueid']),_0x3910c6);calls['newchannel'](_0x3910c6);recordings[_0x9dc1('0x41')](_0x3910c6);}catch(_0x33b3fd){utils[_0x9dc1('0x20')](util[_0x9dc1('0x19')](_0x9dc1('0x40'),_0x3910c6[_0x9dc1('0x1e')]),_0x33b3fd);}});ami['on'](_0x9dc1('0x42'),function(_0xc40508){try{utils[_0x9dc1('0x1c')](util[_0x9dc1('0x19')](_0x9dc1('0x43'),_0xc40508[_0x9dc1('0x1e')]),_0xc40508);dials[_0x9dc1('0x42')](_0xc40508);}catch(_0x2dc20e){utils['error'](util[_0x9dc1('0x19')](_0x9dc1('0x44'),_0xc40508[_0x9dc1('0x1e')]),_0x2dc20e);}});ami['on'](_0x9dc1('0x45'),function(_0x276d3b){try{utils['debug'](util[_0x9dc1('0x19')](_0x9dc1('0x46'),_0x276d3b[_0x9dc1('0x1e')]),_0x276d3b);dials[_0x9dc1('0x45')](_0x276d3b);}catch(_0x4b0fbe){utils['error'](util['format'](_0x9dc1('0x46'),_0x276d3b[_0x9dc1('0x1e')]),_0x4b0fbe);}});} \ No newline at end of file +var _0x1ee5=['cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x1ee5,0x174));var _0x51ee=function(_0xb247a7,_0x22c245){_0xb247a7=_0xb247a7-0x0;var _0xedb31e=_0x1ee5[_0xb247a7];return _0xedb31e;};var AsteriskManager=require('asterisk-manager');var config=require(_0x51ee('0x0'));var utils=require(_0x51ee('0x1'));var util=require(_0x51ee('0x2'));var isXDREnabled=config[_0x51ee('0x3')]&&config[_0x51ee('0x3')]['disabled']?!config['xdr'][_0x51ee('0x4')]:!![];var isProduction=config[_0x51ee('0x5')]===_0x51ee('0x6')||![];var isLocalAsterisk=config[_0x51ee('0x3')]&&config[_0x51ee('0x3')][_0x51ee('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x51ee('0x8')][_0x51ee('0x9')],config[_0x51ee('0x8')]['ip'],config[_0x51ee('0x8')][_0x51ee('0xa')],config[_0x51ee('0x8')][_0x51ee('0xb')],!![]);ami[_0x51ee('0xc')]();if(!isXDREnabled){utils[_0x51ee('0xd')](_0x51ee('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x51ee('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x51ee('0xf'));var calls=require(_0x51ee('0x10'));var queues=require(_0x51ee('0x11'));var recordings=require(_0x51ee('0x12'));var members=require(_0x51ee('0x13'));var dials=require(_0x51ee('0x14'));var transfers=require('./transfers.controller');var core=require(_0x51ee('0x15'));ami['on']('connect',core[_0x51ee('0x16')]);ami['on'](_0x51ee('0x17'),core[_0x51ee('0x17')]);ami['on']('fullybooted',core[_0x51ee('0x18')]);ami['on'](_0x51ee('0x19'),core[_0x51ee('0x19')]);ami['on']('close',core[_0x51ee('0x1a')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x51ee('0x1b'),function(_0x181dcc){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x1e'),_0x181dcc[_0x51ee('0x1f')]),_0x181dcc);members['devicestatechange'](_0x181dcc);}catch(_0x550a90){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x1e'),_0x181dcc[_0x51ee('0x1f')]),_0x550a90);}});ami['on'](_0x51ee('0x20'),function(_0x760e18){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x21'),_0x760e18['uniqueid']),_0x760e18);agents['agentcalled'](_0x760e18);}catch(_0x3acc3e){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x21'),_0x760e18[_0x51ee('0x22')]),_0x3acc3e);}});ami['on'](_0x51ee('0x23'),function(_0x32123a){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][agentringnoanswer]',_0x32123a[_0x51ee('0x22')]),_0x32123a);agents['agentringnoanswer'](_0x32123a);}catch(_0x3ad295){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][agentringnoanswer]',_0x32123a[_0x51ee('0x22')]),_0x3ad295);}});ami['on']('agentconnect',function(_0x2e6670){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x24'),_0x2e6670[_0x51ee('0x22')]),_0x2e6670);agents['agentconnect'](_0x2e6670);queues[_0x51ee('0x25')](_0x2e6670);}catch(_0x5aa462){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x24'),_0x2e6670['uniqueid']),_0x5aa462);}});ami['on']('agentcomplete',function(_0x587555){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][agentcomplete]',_0x587555[_0x51ee('0x22')]),_0x587555);agents[_0x51ee('0x26')](_0x587555);queues['agentcomplete'](_0x587555);members['agentcomplete'](_0x587555);}catch(_0x5b584b){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x27'),_0x587555[_0x51ee('0x22')]),_0x5b584b);}});ami['on']('queuecallerabandon',function(_0x4dadfa){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x28'),_0x4dadfa[_0x51ee('0x22')]),_0x4dadfa);agents[_0x51ee('0x29')](_0x4dadfa);queues[_0x51ee('0x29')](_0x4dadfa);}catch(_0x26cd7d){utils['error'](util[_0x51ee('0x1d')](_0x51ee('0x28'),_0x4dadfa[_0x51ee('0x22')]),_0x26cd7d);}});ami['on'](_0x51ee('0x2a'),function(_0x4c0aea){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x2b'),_0x4c0aea['uniqueid']),_0x4c0aea);queues[_0x51ee('0x2a')](_0x4c0aea);recordings[_0x51ee('0x2a')](_0x4c0aea);}catch(_0x5b2840){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x2b'),_0x4c0aea[_0x51ee('0x22')]),_0x5b2840);}});ami['on']('queuecallerleave',function(_0x56eb84){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][queuecallerleave]',_0x56eb84['uniqueid']),_0x56eb84);queues[_0x51ee('0x2c')](_0x56eb84);}catch(_0x1fdb2c){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x2d'),_0x56eb84[_0x51ee('0x22')]),_0x1fdb2c);}});ami['on'](_0x51ee('0x2e'),function(_0x1b3550){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x2f'),_0x1b3550[_0x51ee('0x22')]),_0x1b3550);queues[_0x51ee('0x2e')](_0x1b3550);calls[_0x51ee('0x2e')](_0x1b3550);}catch(_0x4e141e){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x2f'),_0x1b3550[_0x51ee('0x22')]),_0x4e141e);}});ami['on'](_0x51ee('0x30'),function(_0x172119){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x31'),_0x172119[_0x51ee('0x22')]),_0x172119);queues['musiconholdstop'](_0x172119);calls[_0x51ee('0x30')](_0x172119);}catch(_0x7bffea){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x172119['uniqueid']),_0x7bffea);}});ami['on']('newstate',function(_0x3343e3){try{utils['debug'](util['format'](_0x51ee('0x32'),_0x3343e3[_0x51ee('0x22')]),_0x3343e3);calls[_0x51ee('0x33')](_0x3343e3);recordings['newstate'](_0x3343e3);}catch(_0x194a28){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x32'),_0x3343e3[_0x51ee('0x22')]),_0x194a28);}});ami['on']('hangup',function(_0x278fd0){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x34'),_0x278fd0[_0x51ee('0x22')]),_0x278fd0);calls[_0x51ee('0x35')](_0x278fd0);recordings['hangup'](_0x278fd0);dials[_0x51ee('0x35')](_0x278fd0);agents[_0x51ee('0x35')](_0x278fd0);queues['hangup'](_0x278fd0);}catch(_0x2870e4){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][hangup]',_0x278fd0[_0x51ee('0x22')]),_0x2870e4);}});ami['on'](_0x51ee('0x36'),function(_0x52f1e0){try{utils['debug'](util['format'](_0x51ee('0x37'),_0x52f1e0['uniqueid']),_0x52f1e0);members[_0x51ee('0x36')](_0x52f1e0);}catch(_0x21b4d4){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')]('[%s][index][cdr]',_0x52f1e0[_0x51ee('0x22')]),_0x21b4d4);}});ami['on'](_0x51ee('0x38'),function(_0x54fb98){try{utils['debug'](util['format'](_0x51ee('0x39'),_0x54fb98['uniqueid']),_0x54fb98);queues['blindtransfer'](_0x54fb98);agents[_0x51ee('0x38')](_0x54fb98);transfers[_0x51ee('0x38')](_0x54fb98);recordings['blindtransfer'](_0x54fb98);}catch(_0x300d76){utils[_0x51ee('0x19')](util['format'](_0x51ee('0x39'),_0x54fb98['uniqueid']),_0x300d76);}});ami['on'](_0x51ee('0x3a'),function(_0x4f02d9){try{utils['debug'](util[_0x51ee('0x1d')](_0x51ee('0x3b'),_0x4f02d9[_0x51ee('0x3c')]),_0x4f02d9);queues[_0x51ee('0x3a')](_0x4f02d9);transfers[_0x51ee('0x3a')](_0x4f02d9);agents['attendedtransfer'](_0x4f02d9);calls[_0x51ee('0x3a')](_0x4f02d9);}catch(_0x403f8c){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x3b'),_0x4f02d9[_0x51ee('0x3c')]),_0x403f8c);}});ami['on'](_0x51ee('0x3d'),function(_0x4b10c6){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')]('[%s][index][varset]',_0x4b10c6[_0x51ee('0x22')]),_0x4b10c6);queues[_0x51ee('0x3d')](_0x4b10c6);recordings[_0x51ee('0x3d')](_0x4b10c6);calls[_0x51ee('0x3d')](_0x4b10c6);dials[_0x51ee('0x3d')](_0x4b10c6);}catch(_0x5e6603){utils['error'](util['format']('[%s][index][varset]',_0x4b10c6[_0x51ee('0x22')]),_0x5e6603);}});ami['on'](_0x51ee('0x3e'),function(_0x54f836){try{utils[_0x51ee('0x1c')](util[_0x51ee('0x1d')](_0x51ee('0x3f'),_0x54f836[_0x51ee('0x22')]),_0x54f836);calls['newexten'](_0x54f836);recordings[_0x51ee('0x3e')](_0x54f836);dials[_0x51ee('0x3e')](_0x54f836);}catch(_0x5f3206){utils['error'](util[_0x51ee('0x1d')]('[%s][index][newexten]',_0x54f836[_0x51ee('0x22')]),_0x5f3206);}});ami['on']('newchannel',function(_0xf8c326){try{utils['debug'](util['format'](_0x51ee('0x40'),_0xf8c326['uniqueid']),_0xf8c326);calls['newchannel'](_0xf8c326);recordings[_0x51ee('0x41')](_0xf8c326);}catch(_0x56c2b5){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x40'),_0xf8c326[_0x51ee('0x22')]),_0x56c2b5);}});ami['on'](_0x51ee('0x42'),function(_0x2b6235){try{utils['debug'](util['format'](_0x51ee('0x43'),_0x2b6235['uniqueid']),_0x2b6235);dials[_0x51ee('0x42')](_0x2b6235);}catch(_0x533929){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x44'),_0x2b6235[_0x51ee('0x22')]),_0x533929);}});ami['on'](_0x51ee('0x45'),function(_0x17ed65){try{utils[_0x51ee('0x1c')](util['format'](_0x51ee('0x46'),_0x17ed65[_0x51ee('0x22')]),_0x17ed65);dials[_0x51ee('0x45')](_0x17ed65);}catch(_0x2f51fe){utils[_0x51ee('0x19')](util[_0x51ee('0x1d')](_0x51ee('0x46'),_0x17ed65['uniqueid']),_0x2f51fe);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4848df1..e8faa5d 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 _0x83f1=['CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','NOT_INUSE','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','assign','data1','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','util','Local/_attended@transfer','Queue:','format','uniqueid','interface','channel','data2','membername','name','internal','request'];(function(_0x35d21e,_0x178505){var _0x3ed9ec=function(_0x25741e){while(--_0x25741e){_0x35d21e['push'](_0x35d21e['shift']());}};_0x3ed9ec(++_0x178505);}(_0x83f1,0xa8));var _0x183f=function(_0xcae483,_0x5083e2){_0xcae483=_0xcae483-0x0;var _0x35d6bf=_0x83f1[_0xcae483];return _0x35d6bf;};'use strict';var _=require('lodash');var util=require(_0x183f('0x0'));var utils=require('./utils');var members={};var exclude=[_0x183f('0x1'),_0x183f('0x2')];function writeDB(_0x59375f){utils['info'](util[_0x183f('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x59375f[_0x183f('0x4')],_0x59375f[_0x183f('0x5')],_0x59375f[_0x183f('0x6')],_0x59375f[_0x183f('0x7')],_0x59375f[_0x183f('0x8')],_0x59375f['type']));if(_0x59375f[_0x183f('0x5')]){utils['getUserByInterface'](_0x59375f[_0x183f('0x5')])['then'](function(_0x5a76fc){if(_0x5a76fc){_0x59375f['membername']=_0x5a76fc[_0x183f('0x9')];_0x59375f[_0x183f('0xa')]=_0x5a76fc[_0x183f('0xa')];utils[_0x183f('0xb')](_0x183f('0xc'),_0x59375f);}else{utils[_0x183f('0xd')](_0x59375f['interface'][_0x183f('0xe')]('/')[0x1])['then'](function(_0x5bfd41){if(_0x5bfd41){_0x59375f[_0x183f('0x8')]=_0x5bfd41[_0x183f('0x9')];_0x59375f[_0x183f('0xa')]=_0x5bfd41['internal'];utils[_0x183f('0xb')](_0x183f('0xc'),_0x59375f);}});}})[_0x183f('0xf')](function(_0x471f31){utils[_0x183f('0x10')](util[_0x183f('0x3')](_0x183f('0x11'),_0x59375f[_0x183f('0x4')]),_0x471f31);});}delete members[_0x59375f[_0x183f('0x5')]];}function startsWith(_0x5ec14d,_0x410293){return _['some'](_0x5ec14d,function(_0x4a0d4f){return _[_0x183f('0x12')](_0x410293,_0x4a0d4f);});}exports[_0x183f('0x13')]=function(_0x4030a8){try{utils[_0x183f('0x14')](util[_0x183f('0x3')](_0x183f('0x15'),members[_0x4030a8['device']]?members[_0x4030a8['device']][_0x183f('0x4')]:_0x4030a8[_0x183f('0x16')]),_0x4030a8);utils[_0x183f('0x17')](util['format'](_0x183f('0x18'),members[_0x4030a8['device']]?members[_0x4030a8[_0x183f('0x16')]][_0x183f('0x4')]:_0x4030a8[_0x183f('0x16')],_0x4030a8[_0x183f('0x19')],_0x4030a8[_0x183f('0x16')]));switch(_0x4030a8[_0x183f('0x19')]){case'INUSE':case _0x183f('0x1a'):if(!startsWith(exclude,_0x4030a8[_0x183f('0x16')])){members[_0x4030a8[_0x183f('0x16')]]={'channel':_0x183f('0x1b'),'interface':_0x4030a8[_0x183f('0x16')],'type':_0x183f('0x1c'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x183f('0x1d'):if(!_['isNil'](members[_0x4030a8[_0x183f('0x16')]])){members[_0x4030a8[_0x183f('0x16')]]['exitAt']=utils['now']();members[_0x4030a8['device']]['duration']=utils[_0x183f('0x1e')](members[_0x4030a8[_0x183f('0x16')]]['exitAt'],members[_0x4030a8[_0x183f('0x16')]][_0x183f('0x1f')]);if(members[_0x4030a8['device']][_0x183f('0x4')]){writeDB(members[_0x4030a8[_0x183f('0x16')]]);}}break;default:break;}}catch(_0x33a981){utils['error'](util[_0x183f('0x3')](_0x183f('0x15'),members[_0x4030a8[_0x183f('0x16')]]?members[_0x4030a8['device']][_0x183f('0x4')]:_0x4030a8[_0x183f('0x16')]),_0x33a981);}};exports[_0x183f('0x20')]=function(_0x256b2c){try{if(!_[_0x183f('0x21')](members[_0x256b2c[_0x183f('0x5')]])){utils[_0x183f('0x14')](util[_0x183f('0x3')](_0x183f('0x22'),_0x256b2c[_0x183f('0x4')]),_0x256b2c);utils[_0x183f('0x17')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x256b2c[_0x183f('0x4')],_0x256b2c[_0x183f('0x5')],_0x256b2c[_0x183f('0x23')]));members[_0x256b2c['interface']]=_['assign'](members[_0x256b2c[_0x183f('0x5')]],{'data4':_0x256b2c[_0x183f('0x23')],'uniqueid':_0x256b2c[_0x183f('0x4')]});}}catch(_0x623119){utils[_0x183f('0x10')](util[_0x183f('0x3')](_0x183f('0x22'),_0x256b2c[_0x183f('0x4')]),_0x623119);}};exports[_0x183f('0x24')]=function(_0x13a8af){try{utils[_0x183f('0x14')](util['format'](_0x183f('0x25'),_0x13a8af[_0x183f('0x4')]),_0x13a8af);if(_0x13a8af[_0x183f('0x6')]){var _0x488f65=_0x13a8af[_0x183f('0x6')]['split']('-')[0x0];if(!_[_0x183f('0x21')](members[_0x488f65])){members[_0x488f65]=_[_0x183f('0x26')](members[_0x488f65],{'data1':members[_0x488f65][_0x183f('0x27')]||_0x13a8af[_0x183f('0x28')],'data2':members[_0x488f65][_0x183f('0x7')]||_0x13a8af['source'],'data3':members[_0x488f65][_0x183f('0x29')]||_0x13a8af[_0x183f('0x2a')],'uniqueid':members[_0x488f65][_0x183f('0x4')]||_0x13a8af['uniqueid']});utils['info'](util[_0x183f('0x3')](_0x183f('0x2b'),_0x13a8af['uniqueid'],members[_0x488f65][_0x183f('0x27')],members[_0x488f65][_0x183f('0x7')],members[_0x488f65][_0x183f('0x29')]));if(members[_0x488f65]['exitAt']){writeDB(members[_0x488f65]);}}}if(_0x13a8af[_0x183f('0x2c')]){var _0x542c94=_0x13a8af[_0x183f('0x2c')][_0x183f('0xe')]('-')[0x0];if(!_[_0x183f('0x21')](members[_0x542c94])){members[_0x542c94]=_[_0x183f('0x26')](members[_0x542c94],{'data1':members[_0x542c94][_0x183f('0x27')]||_0x13a8af[_0x183f('0x28')],'data2':members[_0x542c94]['data2']||_0x13a8af['source'],'data3':members[_0x542c94]['data3']||_0x13a8af[_0x183f('0x2a')],'uniqueid':members[_0x542c94][_0x183f('0x4')]||_0x13a8af[_0x183f('0x4')]});utils[_0x183f('0x17')](util[_0x183f('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x13a8af[_0x183f('0x4')],members[_0x542c94][_0x183f('0x27')],members[_0x542c94][_0x183f('0x7')],members[_0x542c94][_0x183f('0x29')]));if(members[_0x542c94]['exitAt']){writeDB(members[_0x542c94]);}}}}catch(_0x5eb1f1){utils[_0x183f('0x10')](util['format'](_0x183f('0x25'),_0x13a8af[_0x183f('0x4')]),_0x5eb1f1);}}; \ No newline at end of file +var _0xce92=['source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','data3','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','channel','membername','type','interface','getUserByInterface','then','internal','getUserByName','split','name','request','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','now','agent','NOT_INUSE','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','data1'];(function(_0x538e11,_0x3c01f2){var _0xebfb03=function(_0x34f22f){while(--_0x34f22f){_0x538e11['push'](_0x538e11['shift']());}};_0xebfb03(++_0x3c01f2);}(_0xce92,0x186));var _0x2ce9=function(_0x5e1f24,_0x442000){_0x5e1f24=_0x5e1f24-0x0;var _0x53823d=_0xce92[_0x5e1f24];return _0x53823d;};'use strict';var _=require(_0x2ce9('0x0'));var util=require('util');var utils=require(_0x2ce9('0x1'));var members={};var exclude=[_0x2ce9('0x2'),_0x2ce9('0x3')];function writeDB(_0x203ff1){utils[_0x2ce9('0x4')](util[_0x2ce9('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x203ff1['uniqueid'],_0x203ff1['interface'],_0x203ff1[_0x2ce9('0x6')],_0x203ff1['data2'],_0x203ff1[_0x2ce9('0x7')],_0x203ff1[_0x2ce9('0x8')]));if(_0x203ff1[_0x2ce9('0x9')]){utils[_0x2ce9('0xa')](_0x203ff1[_0x2ce9('0x9')])[_0x2ce9('0xb')](function(_0xd1c721){if(_0xd1c721){_0x203ff1[_0x2ce9('0x7')]=_0xd1c721['name'];_0x203ff1[_0x2ce9('0xc')]=_0xd1c721[_0x2ce9('0xc')];utils['request']('CreateMemberReport',_0x203ff1);}else{utils[_0x2ce9('0xd')](_0x203ff1[_0x2ce9('0x9')][_0x2ce9('0xe')]('/')[0x1])[_0x2ce9('0xb')](function(_0x5b29f2){if(_0x5b29f2){_0x203ff1[_0x2ce9('0x7')]=_0x5b29f2[_0x2ce9('0xf')];_0x203ff1[_0x2ce9('0xc')]=_0x5b29f2[_0x2ce9('0xc')];utils[_0x2ce9('0x10')](_0x2ce9('0x11'),_0x203ff1);}});}})[_0x2ce9('0x12')](function(_0x589f20){utils[_0x2ce9('0x13')](util[_0x2ce9('0x5')](_0x2ce9('0x14'),_0x203ff1[_0x2ce9('0x15')]),_0x589f20);});}delete members[_0x203ff1[_0x2ce9('0x9')]];}function startsWith(_0x27841d,_0x5c9432){return _[_0x2ce9('0x16')](_0x27841d,function(_0x270828){return _['startsWith'](_0x5c9432,_0x270828);});}exports[_0x2ce9('0x17')]=function(_0x528818){try{utils[_0x2ce9('0x18')](util[_0x2ce9('0x5')](_0x2ce9('0x19'),members[_0x528818['device']]?members[_0x528818['device']]['uniqueid']:_0x528818[_0x2ce9('0x1a')]),_0x528818);utils['info'](util['format'](_0x2ce9('0x1b'),members[_0x528818['device']]?members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x15')]:_0x528818[_0x2ce9('0x1a')],_0x528818[_0x2ce9('0x1c')],_0x528818[_0x2ce9('0x1a')]));switch(_0x528818[_0x2ce9('0x1c')]){case'INUSE':case _0x2ce9('0x1d'):if(!startsWith(exclude,_0x528818[_0x2ce9('0x1a')])){members[_0x528818['device']]={'channel':'voice','interface':_0x528818[_0x2ce9('0x1a')],'type':_0x2ce9('0x1e'),'enterAt':utils[_0x2ce9('0x1f')](),'role':_0x2ce9('0x20')};}break;case _0x2ce9('0x21'):if(!_['isNil'](members[_0x528818[_0x2ce9('0x1a')]])){members[_0x528818['device']][_0x2ce9('0x22')]=utils['now']();members[_0x528818[_0x2ce9('0x1a')]]['duration']=utils['diffTime'](members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x22')],members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x23')]);if(members[_0x528818[_0x2ce9('0x1a')]][_0x2ce9('0x15')]){writeDB(members[_0x528818[_0x2ce9('0x1a')]]);}}break;default:break;}}catch(_0x4bc703){utils[_0x2ce9('0x13')](util[_0x2ce9('0x5')](_0x2ce9('0x19'),members[_0x528818[_0x2ce9('0x1a')]]?members[_0x528818['device']][_0x2ce9('0x15')]:_0x528818['device']),_0x4bc703);}};exports[_0x2ce9('0x24')]=function(_0x335a49){try{if(!_[_0x2ce9('0x25')](members[_0x335a49['interface']])){utils[_0x2ce9('0x18')](util['format'](_0x2ce9('0x26'),_0x335a49[_0x2ce9('0x15')]),_0x335a49);utils['info'](util[_0x2ce9('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x335a49['uniqueid'],_0x335a49[_0x2ce9('0x9')],_0x335a49[_0x2ce9('0x27')]));members[_0x335a49[_0x2ce9('0x9')]]=_['assign'](members[_0x335a49['interface']],{'data4':_0x335a49[_0x2ce9('0x27')],'uniqueid':_0x335a49[_0x2ce9('0x15')]});}}catch(_0x1b7424){utils[_0x2ce9('0x13')](util['format'](_0x2ce9('0x26'),_0x335a49[_0x2ce9('0x15')]),_0x1b7424);}};exports['cdr']=function(_0x4c8a7d){try{utils[_0x2ce9('0x18')](util[_0x2ce9('0x5')]('[%s][members][cdr]',_0x4c8a7d[_0x2ce9('0x15')]),_0x4c8a7d);if(_0x4c8a7d[_0x2ce9('0x6')]){var _0x265955=_0x4c8a7d[_0x2ce9('0x6')]['split']('-')[0x0];if(!_['isNil'](members[_0x265955])){members[_0x265955]=_[_0x2ce9('0x28')](members[_0x265955],{'data1':members[_0x265955][_0x2ce9('0x29')]||_0x4c8a7d[_0x2ce9('0x8')],'data2':members[_0x265955]['data2']||_0x4c8a7d[_0x2ce9('0x2a')],'data3':members[_0x265955]['data3']||_0x4c8a7d[_0x2ce9('0x2b')],'uniqueid':members[_0x265955]['uniqueid']||_0x4c8a7d[_0x2ce9('0x15')]});utils[_0x2ce9('0x4')](util[_0x2ce9('0x5')](_0x2ce9('0x2c'),_0x4c8a7d[_0x2ce9('0x15')],members[_0x265955][_0x2ce9('0x29')],members[_0x265955][_0x2ce9('0x2d')],members[_0x265955][_0x2ce9('0x2e')]));if(members[_0x265955][_0x2ce9('0x22')]){writeDB(members[_0x265955]);}}}if(_0x4c8a7d['destinationchannel']){var _0x20e61a=_0x4c8a7d[_0x2ce9('0x2f')]['split']('-')[0x0];if(!_[_0x2ce9('0x25')](members[_0x20e61a])){members[_0x20e61a]=_[_0x2ce9('0x28')](members[_0x20e61a],{'data1':members[_0x20e61a][_0x2ce9('0x29')]||_0x4c8a7d[_0x2ce9('0x8')],'data2':members[_0x20e61a]['data2']||_0x4c8a7d[_0x2ce9('0x2a')],'data3':members[_0x20e61a]['data3']||_0x4c8a7d['destination'],'uniqueid':members[_0x20e61a]['uniqueid']||_0x4c8a7d[_0x2ce9('0x15')]});utils[_0x2ce9('0x4')](util['format'](_0x2ce9('0x2c'),_0x4c8a7d[_0x2ce9('0x15')],members[_0x20e61a][_0x2ce9('0x29')],members[_0x20e61a][_0x2ce9('0x2d')],members[_0x20e61a][_0x2ce9('0x2e')]));if(members[_0x20e61a]['exitAt']){writeDB(members[_0x20e61a]);}}}}catch(_0x43bbe5){utils['error'](util[_0x2ce9('0x5')]('[%s][members][cdr]',_0x4c8a7d[_0x2ce9('0x15')]),_0x43bbe5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index de9e08d..798a454 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 _0x0785=['connectedlinenum','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','then','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','holdtime','diffTime','count'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x0785,0x160));var _0x5078=function(_0x3b8c97,_0x55e350){_0x3b8c97=_0x3b8c97-0x0;var _0x2d94e1=_0x0785[_0x3b8c97];return _0x2d94e1;};'use strict';var _=require(_0x5078('0x0'));var util=require(_0x5078('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x4e6eb5){utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x4'),_0x4e6eb5[_0x5078('0x5')],_0x4e6eb5[_0x5078('0x6')],_0x4e6eb5[_0x5078('0x7')],_0x4e6eb5[_0x5078('0x8')],_0x4e6eb5[_0x5078('0x9')],_0x4e6eb5['accountcode'],_0x4e6eb5[_0x5078('0xa')]));if(_0x4e6eb5[_0x5078('0x7')]){utils['getVoiceQueueByName'](_0x4e6eb5[_0x5078('0x7')])[_0x5078('0xb')](function(_0x3d582e){if(_0x3d582e){_0x4e6eb5['type']=_0x3d582e['type'];}utils[_0x5078('0xc')]('CreateVoiceQueueReport',_0x4e6eb5);});}else{utils['request'](_0x5078('0xd'),_0x4e6eb5);}if(_0x4e6eb5['transfereduniqueid']){delete queues[_0x4e6eb5[_0x5078('0xe')]];}else{delete queues[_0x4e6eb5[_0x5078('0x5')]];}}exports[_0x5078('0xf')]=function(_0x466abc){try{utils[_0x5078('0x10')](util[_0x5078('0x3')](_0x5078('0x11'),_0x466abc[_0x5078('0x5')]),_0x466abc);utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x12'),_0x466abc['uniqueid'],_0x466abc[_0x5078('0x7')],_0x466abc[_0x5078('0x13')]));queues[_0x466abc[_0x5078('0x5')]]=_[_0x5078('0x14')](_0x466abc,{'originalposition':_0x466abc[_0x5078('0x13')],'queuecallerjoinAt':utils[_0x5078('0x15')](),'mohtime':0x0});}catch(_0x5f3a79){utils[_0x5078('0x16')](util[_0x5078('0x3')]('[%s][queues][queuecallerjoin]',_0x466abc[_0x5078('0x5')]),_0x5f3a79);}};exports['hangup']=function(_0x2da3ed){try{if(!_['isNil'](queues[_0x2da3ed['uniqueid']])){utils[_0x5078('0x10')](util[_0x5078('0x3')](_0x5078('0x17'),_0x2da3ed[_0x5078('0x5')]),_0x2da3ed);if(queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0x18')]){if(!queues[_0x2da3ed[_0x5078('0x5')]]['queuecallerabandon']&&!queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0x19')]){queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0x1a')]=!![];queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0x1b')]=utils[_0x5078('0x15')]();queues[_0x2da3ed['uniqueid']]['queuecallerexitreason']=_0x5078('0x1c');}utils['info'](util[_0x5078('0x3')](_0x5078('0x1d'),_0x2da3ed[_0x5078('0x5')],queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0x1e')],queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0xa')]));writeDB(queues[_0x2da3ed[_0x5078('0x5')]]);}else if(queues[_0x2da3ed[_0x5078('0x5')]]['transfereduniqueid']){utils[_0x5078('0x2')](util['format'](_0x5078('0x1f'),_0x2da3ed[_0x5078('0x5')],queues[_0x2da3ed['uniqueid']]['name'],queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0xe')]));queues[queues[_0x2da3ed[_0x5078('0x5')]][_0x5078('0xe')]]=queues[_0x2da3ed['uniqueid']];queues[queues[_0x2da3ed['uniqueid']][_0x5078('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x2da3ed[_0x5078('0x5')]];}}}catch(_0x13c1a6){utils[_0x5078('0x16')](util[_0x5078('0x3')](_0x5078('0x17'),_0x2da3ed[_0x5078('0x5')]),_0x13c1a6);}};exports['varset']=function(_0xe554be){try{utils[_0x5078('0x10')](util[_0x5078('0x3')](_0x5078('0x20'),_0xe554be[_0x5078('0x5')]),_0xe554be);if(!_[_0x5078('0x21')](_0xe554be[_0x5078('0x22')][_0x5078('0x23')])&&_0xe554be[_0x5078('0x24')][_0x5078('0x25')]()!==_0x5078('0x26')){if(!_[_0x5078('0x21')](queues[_0xe554be[_0x5078('0x5')]])){queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x27')]=![];queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x28')]=null;queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x19')]=!![];queues[_0xe554be['uniqueid']][_0x5078('0x29')]=utils[_0x5078('0x15')]();queues[_0xe554be[_0x5078('0x5')]][_0x5078('0xa')]=_0xe554be[_0x5078('0x24')][_0x5078('0x25')]();utils['info'](util[_0x5078('0x3')](_0x5078('0x2a'),_0xe554be[_0x5078('0x5')],queues[_0xe554be['uniqueid']][_0x5078('0x1e')],_0xe554be['value'],queues[_0xe554be[_0x5078('0x5')]][_0x5078('0xa')]));writeDB(queues[_0xe554be[_0x5078('0x5')]]);}}else if(!_[_0x5078('0x21')](_0xe554be['variable']['queueposition'])){if(!_[_0x5078('0x21')](queues[_0xe554be[_0x5078('0x5')]])&&!queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x27')]){queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x27')]=![];queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x28')]=null;queues[_0xe554be[_0x5078('0x5')]][_0x5078('0x19')]=!![];queues[_0xe554be[_0x5078('0x5')]]['queuecallerexitAt']=utils[_0x5078('0x15')]();queues[_0xe554be[_0x5078('0x5')]][_0x5078('0xa')]=_0x5078('0x2b');utils[_0x5078('0x2')](util[_0x5078('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0xe554be[_0x5078('0x5')],queues[_0xe554be[_0x5078('0x5')]]['name'],_0xe554be['value'],queues[_0xe554be[_0x5078('0x5')]][_0x5078('0xa')]));}}}catch(_0x545e46){utils['error'](util[_0x5078('0x3')](_0x5078('0x20'),_0xe554be[_0x5078('0x5')]),_0x545e46);}};exports[_0x5078('0x27')]=function(_0x440819){try{if(!_[_0x5078('0x21')](queues[_0x440819[_0x5078('0x5')]])){utils[_0x5078('0x10')](util[_0x5078('0x3')]('[%s][queues][queuecallerabandon]',_0x440819[_0x5078('0x5')]),_0x440819);queues[_0x440819[_0x5078('0x5')]][_0x5078('0x19')]=![];queues[_0x440819[_0x5078('0x5')]]['queuecallerexitAt']=null;queues[_0x440819[_0x5078('0x5')]][_0x5078('0x27')]=!![];queues[_0x440819['uniqueid']][_0x5078('0x28')]=utils[_0x5078('0x15')]();queues[_0x440819[_0x5078('0x5')]][_0x5078('0xa')]='ABANDONED';utils['info'](util[_0x5078('0x3')](_0x5078('0x2c'),_0x440819[_0x5078('0x5')],queues[_0x440819[_0x5078('0x5')]][_0x5078('0x1e')],queues[_0x440819[_0x5078('0x5')]][_0x5078('0xa')]));}}catch(_0xee3dab){utils[_0x5078('0x16')](util[_0x5078('0x3')](_0x5078('0x2d'),_0x440819[_0x5078('0x5')]),_0xee3dab);}};exports['queuecallerleave']=function(_0x488bfc){try{if(!_[_0x5078('0x21')](queues[_0x488bfc[_0x5078('0x5')]])){utils[_0x5078('0x10')](util[_0x5078('0x3')](_0x5078('0x2e'),_0x488bfc['uniqueid']),_0x488bfc);utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x2f'),_0x488bfc['uniqueid'],queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x1e')],_0x488bfc['connectedlinenum'],_0x488bfc['connectedlinename']));queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x30')]=!![];queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x18')]=utils[_0x5078('0x15')]();queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x31')]=utils[_0x5078('0x32')](queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x18')],queues[_0x488bfc[_0x5078('0x5')]]['queuecallerjoinAt']);queues[_0x488bfc['uniqueid']][_0x5078('0x13')]=_0x488bfc['position'];queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x33')]=_0x488bfc[_0x5078('0x33')];queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x34')]=_0x488bfc[_0x5078('0x34')];queues[_0x488bfc[_0x5078('0x5')]][_0x5078('0x35')]=_0x488bfc[_0x5078('0x35')];}}catch(_0x5ee023){utils[_0x5078('0x16')](util['format'](_0x5078('0x2e'),_0x488bfc[_0x5078('0x5')]),_0x5ee023);}};exports['agentconnect']=function(_0x3f3f9a){try{if(!_[_0x5078('0x21')](queues[_0x3f3f9a[_0x5078('0x5')]])){utils['debug'](util[_0x5078('0x3')]('[%s][queues][agentconnect]',_0x3f3f9a[_0x5078('0x5')]),_0x3f3f9a);utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x36'),_0x3f3f9a[_0x5078('0x5')],queues[_0x3f3f9a[_0x5078('0x5')]][_0x5078('0x1e')],_0x3f3f9a[_0x5078('0x37')],_0x3f3f9a[_0x5078('0x38')]));queues[_0x3f3f9a['uniqueid']][_0x5078('0x27')]=![];queues[_0x3f3f9a[_0x5078('0x5')]][_0x5078('0x27')]=![];queues[_0x3f3f9a[_0x5078('0x5')]][_0x5078('0x28')]=null;queues[_0x3f3f9a['uniqueid']]['queuecallerexit']=![];queues[_0x3f3f9a['uniqueid']][_0x5078('0xa')]=null;queues[_0x3f3f9a['uniqueid']][_0x5078('0x29')]=null;queues[_0x3f3f9a[_0x5078('0x5')]][_0x5078('0x39')]=!![];queues[_0x3f3f9a[_0x5078('0x5')]][_0x5078('0x3a')]=_0x3f3f9a[_0x5078('0x38')];queues[_0x3f3f9a[_0x5078('0x5')]]['lastAssignedTo']=_0x3f3f9a[_0x5078('0x37')];}}catch(_0x2ce800){utils[_0x5078('0x16')](util[_0x5078('0x3')]('[%s][queues][agentconnect]',_0x3f3f9a[_0x5078('0x5')]),_0x2ce800);}};exports[_0x5078('0x3b')]=function(_0x1c55de){try{if(!_[_0x5078('0x21')](queues[_0x1c55de['uniqueid']])){if(queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x18')]){utils[_0x5078('0x10')](util[_0x5078('0x3')]('[%s][queues][agentcomplete]',_0x1c55de[_0x5078('0x5')]),_0x1c55de);queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x27')]=![];queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x27')]=![];queues[_0x1c55de['uniqueid']][_0x5078('0x28')]=null;queues[_0x1c55de['uniqueid']][_0x5078('0x19')]=![];queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x29')]=null;queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x39')]=!![];queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x8')]=_0x1c55de[_0x5078('0x37')];queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x1a')]=!![];queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x1b')]=utils[_0x5078('0x15')]();if(_0x1c55de['reason']==_0x5078('0x3c')){if(!queues[_0x1c55de[_0x5078('0x5')]]['transfer']){queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0xa')]='TRANSFER';}}else{queues[_0x1c55de[_0x5078('0x5')]]['queuecallerexitreason']='COMPLETEDBY'+_0x1c55de[_0x5078('0x3d')][_0x5078('0x25')]();}utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x3e'),_0x1c55de['uniqueid'],queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0x1e')],_0x1c55de[_0x5078('0x37')],queues[_0x1c55de[_0x5078('0x5')]][_0x5078('0xa')]));writeDB(queues[_0x1c55de[_0x5078('0x5')]]);}}}catch(_0x3d3019){utils[_0x5078('0x16')](util[_0x5078('0x3')](_0x5078('0x3f'),_0x1c55de[_0x5078('0x5')]),_0x3d3019);}};exports[_0x5078('0x40')]=function(_0x13af4a){try{if(!_[_0x5078('0x21')](queues[_0x13af4a['transfereeuniqueid']])){utils[_0x5078('0x10')](util[_0x5078('0x3')]('[%s][queues][blindtransfer]',_0x13af4a[_0x5078('0x5')]),_0x13af4a);queues[_0x13af4a[_0x5078('0x41')]]['transfer']=!![];queues[_0x13af4a[_0x5078('0x41')]]['transfertype']=_0x5078('0x42');queues[_0x13af4a[_0x5078('0x41')]][_0x5078('0x43')]=_0x13af4a['extension'];queues[_0x13af4a['transfereeuniqueid']][_0x5078('0x44')]=_0x13af4a[_0x5078('0x41')];queues[_0x13af4a['transfereeuniqueid']]['queuecallerexitreason']=_0x5078('0x45');utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x46'),_0x13af4a[_0x5078('0x5')],queues[_0x13af4a['transfereeuniqueid']]['name'],_0x13af4a[_0x5078('0x41')],_0x13af4a[_0x5078('0x47')]));}}catch(_0x52c9e1){utils[_0x5078('0x16')](util[_0x5078('0x3')](_0x5078('0x48'),_0x13af4a[_0x5078('0x5')]),_0x52c9e1);}};exports['attendedtransfer']=function(_0x136d21){try{utils[_0x5078('0x10')](util[_0x5078('0x3')]('[%s][queues][attendedtransfer]',_0x136d21[_0x5078('0x49')]),_0x136d21);if(_0x136d21[_0x5078('0x49')]==_0x136d21[_0x5078('0x4a')]){if(!_[_0x5078('0x21')](queues[_0x136d21[_0x5078('0x4b')]])){utils[_0x5078('0x2')](util['format'](_0x5078('0x4c'),_0x136d21[_0x5078('0x49')],queues[_0x136d21[_0x5078('0x4b')]]['name'],_0x136d21[_0x5078('0x4d')]));queues[_0x136d21[_0x5078('0x4b')]]['transfer']=!![];queues[_0x136d21[_0x5078('0x4b')]]['transfertype']=_0x5078('0x4e');queues[_0x136d21['secondtransfererlinkedid']][_0x5078('0x43')]=_0x136d21[_0x5078('0x4d')];queues[_0x136d21['secondtransfererlinkedid']][_0x5078('0x44')]=_0x136d21[_0x5078('0x49')];queues[_0x136d21[_0x5078('0x4b')]][_0x5078('0xa')]=_0x5078('0x4f');}if(!_[_0x5078('0x21')](queues[_0x136d21['origtransfererlinkedid']])){if(_0x136d21['transfereelinkedid']&&queues[_0x136d21[_0x5078('0x50')]]){queues[_0x136d21[_0x5078('0x50')]][_0x5078('0x51')]=0x1;queues[_0x136d21[_0x5078('0x41')]]=_[_0x5078('0x52')](queues[_0x136d21[_0x5078('0x50')]]);queues[_0x136d21[_0x5078('0x41')]][_0x5078('0xe')]=_0x136d21[_0x5078('0x53')];queues[_0x136d21['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x136d21['transfereeuniqueid']][_0x5078('0x9')]=queues[_0x136d21[_0x5078('0x4b')]][_0x5078('0x9')];queues[_0x136d21['transfereeuniqueid']][_0x5078('0x54')]=queues[_0x136d21['secondtransfererlinkedid']]['calleridname'];queues[_0x136d21[_0x5078('0x41')]][_0x5078('0x55')]=utils[_0x5078('0x15')]();queues[_0x136d21['transfereeuniqueid']][_0x5078('0x18')]=utils[_0x5078('0x15')]();queues[_0x136d21[_0x5078('0x41')]][_0x5078('0x31')]=0x0;queues[_0x136d21[_0x5078('0x41')]][_0x5078('0x56')]=0x0;utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x57'),_0x136d21[_0x5078('0x49')],queues[_0x136d21['transfereeuniqueid']]['name'],queues[_0x136d21[_0x5078('0x41')]][_0x5078('0x9')],queues[_0x136d21['transfereeuniqueid']][_0x5078('0x54')]));}else{utils[_0x5078('0x2')](util[_0x5078('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x136d21[_0x5078('0x49')],queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x1e')],_0x136d21[_0x5078('0x4b')]));queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0xe')]=_0x136d21[_0x5078('0x4b')];}}}else if(_0x136d21['secondtransfereruniqueid']==_0x136d21[_0x5078('0x4b')]){if(!_[_0x5078('0x21')](queues[_0x136d21['origtransfererlinkedid']])){utils[_0x5078('0x2')](util[_0x5078('0x3')](_0x5078('0x58'),_0x136d21[_0x5078('0x49')],queues[_0x136d21['origtransfererlinkedid']][_0x5078('0x1e')],_0x136d21[_0x5078('0x59')],_0x136d21[_0x5078('0x5a')]));queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x3c')]=!![];queues[_0x136d21['origtransfererlinkedid']]['transfertype']=_0x5078('0x4e');queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x43')]=_0x136d21[_0x5078('0x5a')];queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x44')]=_0x136d21['secondtransfereruniqueid'];queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0xa')]=_0x5078('0x4f');}if(!_[_0x5078('0x21')](queues[_0x136d21[_0x5078('0x4b')]])){if(_0x136d21[_0x5078('0x5b')]&&queues[_0x136d21[_0x5078('0x5b')]]){queues[_0x136d21[_0x5078('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x136d21[_0x5078('0x53')]]=_[_0x5078('0x52')](queues[_0x136d21[_0x5078('0x5b')]]);queues[_0x136d21[_0x5078('0x53')]][_0x5078('0xe')]=_0x136d21['transfertargetuniqueid'];queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x51')]=0x2;queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x9')]=queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x9')];queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x54')]=queues[_0x136d21[_0x5078('0x4a')]][_0x5078('0x54')];queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x55')]=utils[_0x5078('0x15')]();queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x18')]=utils[_0x5078('0x15')]();queues[_0x136d21[_0x5078('0x53')]][_0x5078('0x31')]=0x0;queues[_0x136d21[_0x5078('0x53')]]['mohtime']=0x0;utils[_0x5078('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x136d21['origtransfereruniqueid'],queues[_0x136d21['transfertargetuniqueid']]['name'],queues[_0x136d21[_0x5078('0x53')]][_0x5078('0xe')],queues[_0x136d21['transfertargetuniqueid']][_0x5078('0x9')],queues[_0x136d21[_0x5078('0x53')]]['calleridname']));}else{utils['info'](util[_0x5078('0x3')](_0x5078('0x5c'),_0x136d21[_0x5078('0x49')],queues[_0x136d21[_0x5078('0x4b')]][_0x5078('0x1e')],_0x136d21[_0x5078('0x4a')]));queues[_0x136d21[_0x5078('0x4b')]][_0x5078('0xe')]=_0x136d21[_0x5078('0x4a')];}}}}catch(_0x7aacda){utils[_0x5078('0x16')](util[_0x5078('0x3')](_0x5078('0x5d'),_0x136d21[_0x5078('0x49')]),_0x7aacda);}};exports[_0x5078('0x5e')]=function(_0xb83f8a){try{if(!_[_0x5078('0x21')](queues[_0xb83f8a[_0x5078('0x5')]])){utils[_0x5078('0x10')](util[_0x5078('0x3')](_0x5078('0x5f'),_0xb83f8a[_0x5078('0x5')]),_0xb83f8a);queues[_0xb83f8a[_0x5078('0x5')]][_0x5078('0x60')]=utils[_0x5078('0x15')]();utils['info'](util[_0x5078('0x3')](_0x5078('0x61'),_0xb83f8a[_0x5078('0x5')],queues[_0xb83f8a['uniqueid']]['name'],queues[_0xb83f8a[_0x5078('0x5')]][_0x5078('0x60')]));}}catch(_0x2e5ab7){utils[_0x5078('0x16')](util[_0x5078('0x3')]('[%s][queues][musiconholdstart]',_0xb83f8a['uniqueid']),_0x2e5ab7);}};exports[_0x5078('0x62')]=function(_0x1acdd2){try{if(!_[_0x5078('0x21')](queues[_0x1acdd2[_0x5078('0x5')]])){if(!_['isNil'](queues[_0x1acdd2['uniqueid']][_0x5078('0x60')])){utils[_0x5078('0x10')](util['format'](_0x5078('0x63'),_0x1acdd2[_0x5078('0x5')]),_0x1acdd2);queues[_0x1acdd2[_0x5078('0x5')]][_0x5078('0x56')]+=utils[_0x5078('0x32')](utils[_0x5078('0x15')](),queues[_0x1acdd2['uniqueid']][_0x5078('0x60')]);utils[_0x5078('0x2')](util['format'](_0x5078('0x64'),_0x1acdd2[_0x5078('0x5')],queues[_0x1acdd2['uniqueid']][_0x5078('0x1e')],queues[_0x1acdd2[_0x5078('0x5')]][_0x5078('0x56')]));delete queues[_0x1acdd2[_0x5078('0x5')]][_0x5078('0x60')];}}}catch(_0x1735d7){utils['error'](util['format'](_0x5078('0x63'),_0x1acdd2[_0x5078('0x5')]),_0x1735d7);}}; \ No newline at end of file +var _0xffa7=['[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT'];(function(_0x1a2eab,_0x291b0f){var _0x526e2e=function(_0xc2934a){while(--_0xc2934a){_0x1a2eab['push'](_0x1a2eab['shift']());}};_0x526e2e(++_0x291b0f);}(_0xffa7,0x12a));var _0x7ffa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xffa7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7ffa('0x0'));var util=require('util');var utils=require(_0x7ffa('0x1'));var queues={};function writeDB(_0x3486ae){utils['info'](util[_0x7ffa('0x2')](_0x7ffa('0x3'),_0x3486ae[_0x7ffa('0x4')],_0x3486ae[_0x7ffa('0x5')],_0x3486ae['queue'],_0x3486ae[_0x7ffa('0x6')],_0x3486ae['calleridnum'],_0x3486ae['accountcode'],_0x3486ae[_0x7ffa('0x7')]));if(_0x3486ae['queue']){utils[_0x7ffa('0x8')](_0x3486ae[_0x7ffa('0x9')])[_0x7ffa('0xa')](function(_0x4c72f1){if(_0x4c72f1){_0x3486ae[_0x7ffa('0xb')]=_0x4c72f1[_0x7ffa('0xb')];}utils[_0x7ffa('0xc')](_0x7ffa('0xd'),_0x3486ae);});}else{utils['request'](_0x7ffa('0xd'),_0x3486ae);}if(_0x3486ae[_0x7ffa('0xe')]){delete queues[_0x3486ae[_0x7ffa('0xe')]];}else{delete queues[_0x3486ae[_0x7ffa('0x4')]];}}exports[_0x7ffa('0xf')]=function(_0x5d7f11){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x11'),_0x5d7f11[_0x7ffa('0x4')]),_0x5d7f11);utils[_0x7ffa('0x12')](util['format'](_0x7ffa('0x13'),_0x5d7f11['uniqueid'],_0x5d7f11[_0x7ffa('0x9')],_0x5d7f11[_0x7ffa('0x14')]));queues[_0x5d7f11['uniqueid']]=_['assign'](_0x5d7f11,{'originalposition':_0x5d7f11[_0x7ffa('0x14')],'queuecallerjoinAt':utils[_0x7ffa('0x15')](),'mohtime':0x0});}catch(_0x179da6){utils['error'](util['format'](_0x7ffa('0x11'),_0x5d7f11[_0x7ffa('0x4')]),_0x179da6);}};exports[_0x7ffa('0x16')]=function(_0x50572d){try{if(!_['isNil'](queues[_0x50572d[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x17'),_0x50572d['uniqueid']),_0x50572d);if(queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x18')]){if(!queues[_0x50572d['uniqueid']][_0x7ffa('0x19')]&&!queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x1a')]){queues[_0x50572d['uniqueid']][_0x7ffa('0x1b')]=!![];queues[_0x50572d[_0x7ffa('0x4')]]['queuecallercompleteAt']=utils[_0x7ffa('0x15')]();queues[_0x50572d['uniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x1c');}utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x1d'),_0x50572d[_0x7ffa('0x4')],queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x50572d['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x50572d['uniqueid']]);}else if(queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]){utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x1f'),_0x50572d['uniqueid'],queues[_0x50572d['uniqueid']][_0x7ffa('0x1e')],queues[_0x50572d[_0x7ffa('0x4')]]['transfereduniqueid']));queues[queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]]=queues[_0x50572d[_0x7ffa('0x4')]];queues[queues[_0x50572d[_0x7ffa('0x4')]][_0x7ffa('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x50572d[_0x7ffa('0x4')]];}}}catch(_0xad34c9){utils['error'](util[_0x7ffa('0x2')]('[%s][queues][hangup]',_0x50572d[_0x7ffa('0x4')]),_0xad34c9);}};exports[_0x7ffa('0x20')]=function(_0x364510){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x21'),_0x364510[_0x7ffa('0x4')]),_0x364510);if(!_[_0x7ffa('0x22')](_0x364510['variable'][_0x7ffa('0x23')])&&_0x364510[_0x7ffa('0x24')][_0x7ffa('0x25')]()!==_0x7ffa('0x26')){if(!_['isNil'](queues[_0x364510[_0x7ffa('0x4')]])){queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x364510['uniqueid']][_0x7ffa('0x27')]=null;queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1a')]=!![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x28')]=utils['now']();queues[_0x364510['uniqueid']][_0x7ffa('0x7')]=_0x364510[_0x7ffa('0x24')][_0x7ffa('0x25')]();utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x364510[_0x7ffa('0x4')],queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x364510[_0x7ffa('0x24')],queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x7')]));writeDB(queues[_0x364510[_0x7ffa('0x4')]]);}}else if(!_[_0x7ffa('0x22')](_0x364510[_0x7ffa('0x29')][_0x7ffa('0x2a')])){if(!_[_0x7ffa('0x22')](queues[_0x364510[_0x7ffa('0x4')]])&&!queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]){queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x1a')]=!![];queues[_0x364510[_0x7ffa('0x4')]][_0x7ffa('0x28')]=utils['now']();queues[_0x364510['uniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x2b');utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x2c'),_0x364510[_0x7ffa('0x4')],queues[_0x364510['uniqueid']][_0x7ffa('0x1e')],_0x364510[_0x7ffa('0x24')],queues[_0x364510['uniqueid']][_0x7ffa('0x7')]));}}}catch(_0xcb72a7){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][varset]',_0x364510['uniqueid']),_0xcb72a7);}};exports[_0x7ffa('0x19')]=function(_0x133816){try{if(!_[_0x7ffa('0x22')](queues[_0x133816[_0x7ffa('0x4')]])){utils['debug'](util[_0x7ffa('0x2')](_0x7ffa('0x2e'),_0x133816[_0x7ffa('0x4')]),_0x133816);queues[_0x133816[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x19')]=!![];queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x27')]=utils['now']();queues[_0x133816['uniqueid']]['queuecallerexitreason']=_0x7ffa('0x2f');utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x133816['uniqueid'],queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x133816[_0x7ffa('0x4')]][_0x7ffa('0x7')]));}}catch(_0x559568){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerabandon]',_0x133816['uniqueid']),_0x559568);}};exports[_0x7ffa('0x30')]=function(_0x1bfb8e){try{if(!_[_0x7ffa('0x22')](queues[_0x1bfb8e[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x31'),_0x1bfb8e['uniqueid']),_0x1bfb8e);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x32'),_0x1bfb8e['uniqueid'],queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x1bfb8e[_0x7ffa('0x33')],_0x1bfb8e[_0x7ffa('0x34')]));queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x30')]=!![];queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x18')]=utils['now']();queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x35')]=utils[_0x7ffa('0x36')](queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x18')],queues[_0x1bfb8e[_0x7ffa('0x4')]]['queuecallerjoinAt']);queues[_0x1bfb8e[_0x7ffa('0x4')]][_0x7ffa('0x14')]=_0x1bfb8e[_0x7ffa('0x14')];queues[_0x1bfb8e['uniqueid']][_0x7ffa('0x37')]=_0x1bfb8e[_0x7ffa('0x37')];queues[_0x1bfb8e[_0x7ffa('0x4')]]['connectedlinenum']=_0x1bfb8e[_0x7ffa('0x33')];queues[_0x1bfb8e[_0x7ffa('0x4')]]['connectedlinename']=_0x1bfb8e[_0x7ffa('0x34')];}}catch(_0x593a24){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')]('[%s][queues][queuecallerleave]',_0x1bfb8e[_0x7ffa('0x4')]),_0x593a24);}};exports['agentconnect']=function(_0x449f0d){try{if(!_[_0x7ffa('0x22')](queues[_0x449f0d['uniqueid']])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x38'),_0x449f0d[_0x7ffa('0x4')]),_0x449f0d);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x39'),_0x449f0d[_0x7ffa('0x4')],queues[_0x449f0d[_0x7ffa('0x4')]]['name'],_0x449f0d[_0x7ffa('0x3a')],_0x449f0d[_0x7ffa('0x3b')]));queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x449f0d['uniqueid']]['queuecallerabandon']=![];queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x449f0d[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x449f0d['uniqueid']]['queuecallerexitreason']=null;queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x449f0d[_0x7ffa('0x4')]][_0x7ffa('0x3c')]=!![];queues[_0x449f0d['uniqueid']][_0x7ffa('0x3d')]=_0x449f0d[_0x7ffa('0x3b')];queues[_0x449f0d['uniqueid']]['lastAssignedTo']=_0x449f0d[_0x7ffa('0x3a')];}}catch(_0x1a3098){utils[_0x7ffa('0x2d')](util[_0x7ffa('0x2')](_0x7ffa('0x38'),_0x449f0d[_0x7ffa('0x4')]),_0x1a3098);}};exports[_0x7ffa('0x3e')]=function(_0x9d0a3d){try{if(!_[_0x7ffa('0x22')](queues[_0x9d0a3d['uniqueid']])){if(queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x18')]){utils['debug'](util[_0x7ffa('0x2')](_0x7ffa('0x3f'),_0x9d0a3d['uniqueid']),_0x9d0a3d);queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x19')]=![];queues[_0x9d0a3d[_0x7ffa('0x4')]]['queuecallerabandon']=![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x27')]=null;queues[_0x9d0a3d[_0x7ffa('0x4')]]['queuecallerexit']=![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x28')]=null;queues[_0x9d0a3d['uniqueid']][_0x7ffa('0x3c')]=!![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x6')]=_0x9d0a3d[_0x7ffa('0x3a')];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x1b')]=!![];queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x40')]=utils[_0x7ffa('0x15')]();if(_0x9d0a3d[_0x7ffa('0x41')]=='transfer'){if(!queues[_0x9d0a3d[_0x7ffa('0x4')]]['transfer']){queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x7')]=_0x7ffa('0x42');}}else{queues[_0x9d0a3d['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x9d0a3d[_0x7ffa('0x41')][_0x7ffa('0x25')]();}utils[_0x7ffa('0x12')](util['format'](_0x7ffa('0x43'),_0x9d0a3d[_0x7ffa('0x4')],queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],_0x9d0a3d['membername'],queues[_0x9d0a3d[_0x7ffa('0x4')]][_0x7ffa('0x7')]));writeDB(queues[_0x9d0a3d[_0x7ffa('0x4')]]);}}}catch(_0x1b0ea6){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x3f'),_0x9d0a3d[_0x7ffa('0x4')]),_0x1b0ea6);}};exports[_0x7ffa('0x44')]=function(_0x3eb0f5){try{if(!_['isNil'](queues[_0x3eb0f5[_0x7ffa('0x45')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x3eb0f5[_0x7ffa('0x4')]),_0x3eb0f5);queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x46')]=!![];queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x47')]=_0x7ffa('0x48');queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x49')]=_0x3eb0f5[_0x7ffa('0x4a')];queues[_0x3eb0f5[_0x7ffa('0x45')]]['transferuniqueid']=_0x3eb0f5[_0x7ffa('0x45')];queues[_0x3eb0f5['transfereeuniqueid']][_0x7ffa('0x7')]=_0x7ffa('0x4b');utils[_0x7ffa('0x12')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3eb0f5[_0x7ffa('0x4')],queues[_0x3eb0f5[_0x7ffa('0x45')]][_0x7ffa('0x1e')],_0x3eb0f5[_0x7ffa('0x45')],_0x3eb0f5['extension']));}}catch(_0x502361){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x4c'),_0x3eb0f5[_0x7ffa('0x4')]),_0x502361);}};exports[_0x7ffa('0x4d')]=function(_0x50854c){try{utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')](_0x7ffa('0x4e'),_0x50854c['origtransfereruniqueid']),_0x50854c);if(_0x50854c[_0x7ffa('0x4f')]==_0x50854c[_0x7ffa('0x50')]){if(!_[_0x7ffa('0x22')](queues[_0x50854c['secondtransfererlinkedid']])){utils['info'](util[_0x7ffa('0x2')](_0x7ffa('0x51'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['secondtransfererlinkedid']][_0x7ffa('0x1e')],_0x50854c[_0x7ffa('0x52')]));queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x46')]=!![];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x47')]=_0x7ffa('0x54');queues[_0x50854c[_0x7ffa('0x53')]]['transferexten']=_0x50854c['origtransfererexten'];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x55')]=_0x50854c[_0x7ffa('0x4f')];queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x7')]=_0x7ffa('0x56');}if(!_['isNil'](queues[_0x50854c[_0x7ffa('0x50')]])){if(_0x50854c[_0x7ffa('0x57')]&&queues[_0x50854c[_0x7ffa('0x57')]]){queues[_0x50854c[_0x7ffa('0x57')]][_0x7ffa('0x58')]=0x1;queues[_0x50854c[_0x7ffa('0x45')]]=_['clone'](queues[_0x50854c[_0x7ffa('0x57')]]);queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x59')];queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x58')]=0x2;queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x5a')]=queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x5a')];queues[_0x50854c['transfereeuniqueid']][_0x7ffa('0x5b')]=queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0x5b')];queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x5c')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x18')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x45')]][_0x7ffa('0x35')]=0x0;queues[_0x50854c['transfereeuniqueid']][_0x7ffa('0x5d')]=0x0;utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x5e'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c[_0x7ffa('0x45')]]['name'],queues[_0x50854c['transfereeuniqueid']]['calleridnum'],queues[_0x50854c[_0x7ffa('0x45')]]['calleridname']));}else{utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x5f'),_0x50854c['origtransfereruniqueid'],queues[_0x50854c[_0x7ffa('0x50')]]['name'],_0x50854c[_0x7ffa('0x53')]));queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x53')];}}}else if(_0x50854c[_0x7ffa('0x60')]==_0x50854c[_0x7ffa('0x53')]){if(!_[_0x7ffa('0x22')](queues[_0x50854c['origtransfererlinkedid']])){utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x61'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x1e')],_0x50854c['secondtransfereruniqueid'],_0x50854c[_0x7ffa('0x62')]));queues[_0x50854c['origtransfererlinkedid']]['transfer']=!![];queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x47')]=_0x7ffa('0x54');queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x49')]=_0x50854c[_0x7ffa('0x62')];queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x55')]=_0x50854c['secondtransfereruniqueid'];queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x7')]=_0x7ffa('0x56');}if(!_[_0x7ffa('0x22')](queues[_0x50854c['secondtransfererlinkedid']])){if(_0x50854c[_0x7ffa('0x63')]&&queues[_0x50854c['transfertargetlinkedid']]){queues[_0x50854c[_0x7ffa('0x63')]]['queuecallerenterreason']=0x1;queues[_0x50854c[_0x7ffa('0x59')]]=_[_0x7ffa('0x64')](queues[_0x50854c[_0x7ffa('0x63')]]);queues[_0x50854c[_0x7ffa('0x59')]]['transfereduniqueid']=_0x50854c[_0x7ffa('0x59')];queues[_0x50854c['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x50854c['transfertargetuniqueid']]['calleridnum']=queues[_0x50854c[_0x7ffa('0x50')]][_0x7ffa('0x5a')];queues[_0x50854c[_0x7ffa('0x59')]]['calleridname']=queues[_0x50854c['origtransfererlinkedid']][_0x7ffa('0x5b')];queues[_0x50854c['transfertargetuniqueid']][_0x7ffa('0x5c')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x18')]=utils[_0x7ffa('0x15')]();queues[_0x50854c[_0x7ffa('0x59')]]['holdtime']=0x0;queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5d')]=0x0;utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x65'),_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x1e')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0xe')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5a')],queues[_0x50854c[_0x7ffa('0x59')]][_0x7ffa('0x5b')]));}else{utils['info'](util[_0x7ffa('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x50854c[_0x7ffa('0x4f')],queues[_0x50854c['secondtransfererlinkedid']]['name'],_0x50854c[_0x7ffa('0x50')]));queues[_0x50854c[_0x7ffa('0x53')]][_0x7ffa('0xe')]=_0x50854c[_0x7ffa('0x50')];}}}}catch(_0x3698ff){utils['error'](util['format'](_0x7ffa('0x4e'),_0x50854c[_0x7ffa('0x4f')]),_0x3698ff);}};exports[_0x7ffa('0x66')]=function(_0x388d1c){try{if(!_[_0x7ffa('0x22')](queues[_0x388d1c[_0x7ffa('0x4')]])){utils[_0x7ffa('0x10')](util['format']('[%s][queues][musiconholdstart]',_0x388d1c[_0x7ffa('0x4')]),_0x388d1c);queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x67')]=utils[_0x7ffa('0x15')]();utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x68'),_0x388d1c['uniqueid'],queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x388d1c[_0x7ffa('0x4')]][_0x7ffa('0x67')]));}}catch(_0x29d4f9){utils[_0x7ffa('0x2d')](util['format'](_0x7ffa('0x69'),_0x388d1c[_0x7ffa('0x4')]),_0x29d4f9);}};exports[_0x7ffa('0x6a')]=function(_0x1d958d){try{if(!_[_0x7ffa('0x22')](queues[_0x1d958d[_0x7ffa('0x4')]])){if(!_[_0x7ffa('0x22')](queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')])){utils[_0x7ffa('0x10')](util[_0x7ffa('0x2')]('[%s][queues][musiconholdstop]',_0x1d958d[_0x7ffa('0x4')]),_0x1d958d);queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x5d')]+=utils['diffTime'](utils['now'](),queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')]);utils[_0x7ffa('0x12')](util[_0x7ffa('0x2')](_0x7ffa('0x6b'),_0x1d958d[_0x7ffa('0x4')],queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x1e')],queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x5d')]));delete queues[_0x1d958d[_0x7ffa('0x4')]][_0x7ffa('0x67')];}}}catch(_0xfe9f5){utils['error'](util[_0x7ffa('0x2')](_0x7ffa('0x6c'),_0x1d958d[_0x7ffa('0x4')]),_0xfe9f5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f2a553c..fddbf2d 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 _0x4639=['application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./utils','./transfers.controller','format','blinds','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','debug','[%s][recordings][newchannel]','linkedid','info','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','transfer','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s'];(function(_0x479dfd,_0x47ff77){var _0x5b82b4=function(_0x3b0d0c){while(--_0x3b0d0c){_0x479dfd['push'](_0x479dfd['shift']());}};_0x5b82b4(++_0x47ff77);}(_0x4639,0x131));var _0x9463=function(_0x5a5a88,_0x5d0b5b){_0x5a5a88=_0x5a5a88-0x0;var _0x2c7efb=_0x4639[_0x5a5a88];return _0x2c7efb;};'use strict';var _=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var utils=require(_0x9463('0x2'));var transfers=require(_0x9463('0x3'));var recordings={};function writeDB(_0xfedc01){var _0x580dd0;utils['info'](util[_0x9463('0x4')]('[%s][recordings][writeDB]',_0xfedc01['uniqueid']));if(transfers[_0x9463('0x5')][_0xfedc01[_0x9463('0x6')]]){_0x580dd0=_0xfedc01[_0x9463('0x6')];_0xfedc01[_0x9463('0x6')]=transfers[_0x9463('0x5')][_0xfedc01[_0x9463('0x6')]]['transfereeuniqueid'];}if(_0xfedc01[_0x9463('0x7')]){utils[_0x9463('0x8')](_0xfedc01['accountcode'])['then'](function(_0x462854){if(_0x462854){_0xfedc01[_0x9463('0x9')]=_0x462854[_0x9463('0xa')];_0xfedc01[_0x9463('0xb')]=_0x462854['id'];}utils['request']('CreateVoiceRecording',_0xfedc01);});}else{utils[_0x9463('0xc')]('CreateVoiceRecording',_0xfedc01);}if(_0x580dd0)delete transfers[_0x9463('0x5')][_0x580dd0];}exports['newchannel']=function(_0x54bada){try{utils[_0x9463('0xd')](util[_0x9463('0x4')](_0x9463('0xe'),_0x54bada['uniqueid']),_0x54bada);if(_0x54bada[_0x9463('0x6')]==_0x54bada[_0x9463('0xf')]){utils[_0x9463('0x10')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x54bada[_0x9463('0x6')],_0x54bada['context'],_0x54bada[_0x9463('0x11')]));recordings[_0x54bada[_0x9463('0x6')]]={'uniqueid':_0x54bada[_0x9463('0x6')],'accountcode':_0x54bada['accountcode'],'exten':_0x54bada[_0x9463('0x11')],'context':_0x54bada['context'],'channel':_0x54bada[_0x9463('0x12')],'monitors':[]};}}catch(_0x5a894e){utils[_0x9463('0x13')](util[_0x9463('0x4')](_0x9463('0xe'),_0x54bada[_0x9463('0x6')]),_0x5a894e);}};exports[_0x9463('0x14')]=function(_0x116c6a){try{utils['debug'](util[_0x9463('0x4')](_0x9463('0x15'),_0x116c6a['uniqueid']),_0x116c6a);if(!_[_0x9463('0x16')](recordings[_0x116c6a[_0x9463('0x6')]])&&_0x116c6a[_0x9463('0x17')]==0x6){utils[_0x9463('0x10')](util[_0x9463('0x4')](_0x9463('0x18'),_0x116c6a[_0x9463('0x6')],_0x116c6a[_0x9463('0x19')],_0x116c6a[_0x9463('0x12')]));}else if(!_[_0x9463('0x16')](recordings[_0x116c6a['linkedid']])&&_0x116c6a[_0x9463('0x17')]==0x6&&_0x116c6a[_0x9463('0x19')]!=_0x9463('0x1a')){utils[_0x9463('0x10')](util[_0x9463('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x116c6a[_0x9463('0x6')],_0x116c6a[_0x9463('0xf')],_0x116c6a[_0x9463('0x19')],_0x116c6a['channel']));recordings[_0x116c6a[_0x9463('0xf')]]['accountcode']=_0x116c6a[_0x9463('0x7')];}}catch(_0x3ab732){utils[_0x9463('0x13')](util[_0x9463('0x4')](_0x9463('0x15'),_0x116c6a[_0x9463('0x6')]),_0x3ab732);}};exports[_0x9463('0x1b')]=function(_0x3c4a78){try{if(!_[_0x9463('0x16')](_0x3c4a78['variable'])&&!_[_0x9463('0x16')](_0x3c4a78[_0x9463('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x9463('0x4')](_0x9463('0x1d'),_0x3c4a78['uniqueid']),_0x3c4a78);utils[_0x9463('0x10')](util[_0x9463('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x3c4a78[_0x9463('0x6')],_0x3c4a78['variable'],_0x3c4a78[_0x9463('0x1e')]));if(_[_0x9463('0x1f')](_0x3c4a78[_0x9463('0x1e')],_0x9463('0x20'))){_0x3c4a78[_0x9463('0x1e')]=_0x3c4a78[_0x9463('0x1e')][_0x9463('0x21')](_0x9463('0x20'),_0x9463('0x22'));}if(recordings[_0x3c4a78[_0x9463('0xf')]]){var _0x248d03=_[_0x9463('0x23')](recordings[_0x3c4a78['linkedid']][_0x9463('0x24')],{'value':_0x3c4a78[_0x9463('0x1e')]});if(_[_0x9463('0x16')](_0x248d03)){recordings[_0x3c4a78[_0x9463('0xf')]][_0x9463('0x24')]['push']({'value':_0x3c4a78[_0x9463('0x1e')]});}}}}catch(_0x40759f){utils[_0x9463('0x13')](util[_0x9463('0x4')]('[%s][recordings][varset]',_0x3c4a78[_0x9463('0x6')]),_0x40759f);}};exports[_0x9463('0x25')]=function(_0x315b2c){try{if(!_[_0x9463('0x16')](recordings[_0x315b2c[_0x9463('0x6')]])){utils[_0x9463('0xd')](util['format'](_0x9463('0x26'),_0x315b2c[_0x9463('0x6')]),_0x315b2c);utils[_0x9463('0x10')](util['format'](_0x9463('0x27'),_0x315b2c[_0x9463('0x6')],_0x315b2c[_0x9463('0x28')],_0x315b2c[_0x9463('0x29')],_0x315b2c[_0x9463('0x2a')]));recordings[_0x315b2c['uniqueid']][_0x9463('0x28')]=_0x315b2c[_0x9463('0x28')];recordings[_0x315b2c[_0x9463('0x6')]][_0x9463('0x29')]=_0x315b2c['calleridname'];recordings[_0x315b2c[_0x9463('0x6')]][_0x9463('0x2b')]=_0x315b2c[_0x9463('0x2b')];recordings[_0x315b2c[_0x9463('0x6')]][_0x9463('0x2c')]=_0x315b2c[_0x9463('0x2c')];if(recordings[_0x315b2c[_0x9463('0x6')]]['type']==_0x9463('0x2d')&&recordings[_0x315b2c[_0x9463('0x6')]][_0x9463('0x7')]){recordings[_0x315b2c['uniqueid']][_0x9463('0x2b')]=recordings[_0x315b2c['uniqueid']]['accountcode'];recordings[_0x315b2c[_0x9463('0x6')]][_0x9463('0x2c')]='';}recordings[_0x315b2c['uniqueid']][_0x9463('0x24')][_0x9463('0x2e')](function(_0x129303){var _0xcabc77=_[_0x9463('0x2f')](recordings[_0x315b2c[_0x9463('0x6')]]);_0xcabc77['value']=_0x129303['value'];writeDB(_0xcabc77);});delete recordings[_0x315b2c[_0x9463('0x6')]];}}catch(_0x2b70f8){utils[_0x9463('0x13')](util[_0x9463('0x4')](_0x9463('0x26'),_0x315b2c['uniqueid']),_0x2b70f8);}};exports['newexten']=function(_0x4905c6){try{if(!_[_0x9463('0x16')](recordings[_0x4905c6[_0x9463('0x6')]])){utils[_0x9463('0xd')](util[_0x9463('0x4')](_0x9463('0x30'),_0x4905c6['uniqueid']),_0x4905c6);utils[_0x9463('0x10')](util['format'](_0x9463('0x31'),_0x4905c6[_0x9463('0x6')],_0x4905c6[_0x9463('0x32')],_0x4905c6['appdata']));if(_0x4905c6[_0x9463('0x32')][_0x9463('0x33')]()==_0x9463('0x34')&&_[_0x9463('0x35')](_0x4905c6[_0x9463('0x36')][_0x9463('0x33')](),_0x9463('0x37'))){var _0x462e79=_0x4905c6[_0x9463('0x36')][_0x9463('0x38')]('=');var _0x184b61=_0x462e79[0x0][_0x9463('0x39')](_0x462e79[0x0][_0x9463('0x3a')]('(')+0x1,_0x462e79[0x0][_0x9463('0x3a')](')'));var _0x4c0db9=_0x462e79[0x1];recordings[_0x4905c6['uniqueid']][_0x184b61]=_0x4c0db9;}}}catch(_0x2cafec){utils['error'](util[_0x9463('0x4')](_0x9463('0x30'),_0x4905c6[_0x9463('0x6')]),_0x2cafec);}};exports[_0x9463('0x3b')]=function(_0x401814){try{if(!_['isNil'](recordings[_0x401814[_0x9463('0x6')]])){utils[_0x9463('0xd')](util[_0x9463('0x4')](_0x9463('0x3c'),_0x401814[_0x9463('0x6')]),_0x401814);utils[_0x9463('0x10')](util[_0x9463('0x4')](_0x9463('0x3d'),_0x401814[_0x9463('0x6')],_0x401814['queue']));recordings[_0x401814[_0x9463('0x6')]][_0x9463('0x3e')]=_0x401814[_0x9463('0x3e')];}}catch(_0x200a95){utils[_0x9463('0x13')](util[_0x9463('0x4')](_0x9463('0x3c'),_0x401814[_0x9463('0x6')]),_0x200a95);}};exports[_0x9463('0x3f')]=function(_0x1d457b){try{utils[_0x9463('0xd')](util[_0x9463('0x4')]('[%s][recordings][blindtransfer]',_0x1d457b['uniqueid']),_0x1d457b);utils['info'](util[_0x9463('0x4')](_0x9463('0x40'),_0x1d457b[_0x9463('0x6')],_0x1d457b[_0x9463('0x41')],_0x1d457b['transferercalleridname'],_0x1d457b[_0x9463('0x42')],_0x1d457b[_0x9463('0x43')]));if(recordings[_0x1d457b[_0x9463('0x44')]]&&transfers[_0x9463('0x5')][_0x1d457b[_0x9463('0x44')]]){transfers[_0x9463('0x5')][_0x1d457b[_0x9463('0x44')]][_0x9463('0x45')]=!![];}}catch(_0x351f4d){utils[_0x9463('0x13')](util[_0x9463('0x4')](_0x9463('0x46'),_0x1d457b[_0x9463('0x6')]),_0x351f4d);}}; \ No newline at end of file +var _0xa52f=['transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','monitors','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','[%s][recordings][writeDB]','uniqueid','blinds'];(function(_0x537893,_0x23e5bd){var _0x265c06=function(_0x59ab4f){while(--_0x59ab4f){_0x537893['push'](_0x537893['shift']());}};_0x265c06(++_0x23e5bd);}(_0xa52f,0xd1));var _0xfa52=function(_0x3da955,_0x26dd20){_0x3da955=_0x3da955-0x0;var _0x2c57ba=_0xa52f[_0x3da955];return _0x2c57ba;};'use strict';var _=require(_0xfa52('0x0'));var util=require(_0xfa52('0x1'));var utils=require(_0xfa52('0x2'));var transfers=require(_0xfa52('0x3'));var recordings={};function writeDB(_0x55dacf){var _0x2c3209;utils['info'](util['format'](_0xfa52('0x4'),_0x55dacf[_0xfa52('0x5')]));if(transfers['blinds'][_0x55dacf['uniqueid']]){_0x2c3209=_0x55dacf[_0xfa52('0x5')];_0x55dacf[_0xfa52('0x5')]=transfers[_0xfa52('0x6')][_0x55dacf['uniqueid']][_0xfa52('0x7')];}if(_0x55dacf[_0xfa52('0x8')]){utils[_0xfa52('0x9')](_0x55dacf[_0xfa52('0x8')])[_0xfa52('0xa')](function(_0x5188ef){if(_0x5188ef){_0x55dacf[_0xfa52('0xb')]=_0x5188ef[_0xfa52('0xc')];_0x55dacf[_0xfa52('0xd')]=_0x5188ef['id'];}utils[_0xfa52('0xe')](_0xfa52('0xf'),_0x55dacf);});}else{utils[_0xfa52('0xe')]('CreateVoiceRecording',_0x55dacf);}if(_0x2c3209)delete transfers['blinds'][_0x2c3209];}exports[_0xfa52('0x10')]=function(_0x5e7dae){try{utils[_0xfa52('0x11')](util['format'](_0xfa52('0x12'),_0x5e7dae[_0xfa52('0x5')]),_0x5e7dae);if(_0x5e7dae[_0xfa52('0x5')]==_0x5e7dae[_0xfa52('0x13')]){utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x16'),_0x5e7dae[_0xfa52('0x5')],_0x5e7dae[_0xfa52('0x17')],_0x5e7dae[_0xfa52('0x18')]));recordings[_0x5e7dae[_0xfa52('0x5')]]={'uniqueid':_0x5e7dae[_0xfa52('0x5')],'accountcode':_0x5e7dae[_0xfa52('0x8')],'exten':_0x5e7dae[_0xfa52('0x18')],'context':_0x5e7dae['context'],'channel':_0x5e7dae['channel'],'monitors':[]};}}catch(_0x249fb7){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x12'),_0x5e7dae[_0xfa52('0x5')]),_0x249fb7);}};exports[_0xfa52('0x1a')]=function(_0xa03a9c){try{utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x1b'),_0xa03a9c[_0xfa52('0x5')]),_0xa03a9c);if(!_['isNil'](recordings[_0xa03a9c[_0xfa52('0x5')]])&&_0xa03a9c[_0xfa52('0x1c')]==0x6){utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x1d'),_0xa03a9c[_0xfa52('0x5')],_0xa03a9c[_0xfa52('0x17')],_0xa03a9c[_0xfa52('0x1e')]));}else if(!_[_0xfa52('0x1f')](recordings[_0xa03a9c[_0xfa52('0x13')]])&&_0xa03a9c[_0xfa52('0x1c')]==0x6&&_0xa03a9c[_0xfa52('0x17')]!='transfer'){utils[_0xfa52('0x14')](util['format'](_0xfa52('0x20'),_0xa03a9c['uniqueid'],_0xa03a9c[_0xfa52('0x13')],_0xa03a9c[_0xfa52('0x17')],_0xa03a9c[_0xfa52('0x1e')]));recordings[_0xa03a9c[_0xfa52('0x13')]][_0xfa52('0x8')]=_0xa03a9c['accountcode'];}}catch(_0x5b128e){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x1b'),_0xa03a9c[_0xfa52('0x5')]),_0x5b128e);}};exports[_0xfa52('0x21')]=function(_0x5b9eef){try{if(!_[_0xfa52('0x1f')](_0x5b9eef[_0xfa52('0x22')])&&!_[_0xfa52('0x1f')](_0x5b9eef[_0xfa52('0x22')][_0xfa52('0x23')])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x24'),_0x5b9eef[_0xfa52('0x5')]),_0x5b9eef);utils['info'](util[_0xfa52('0x15')](_0xfa52('0x25'),_0x5b9eef[_0xfa52('0x5')],_0x5b9eef[_0xfa52('0x22')],_0x5b9eef[_0xfa52('0x26')]));if(_[_0xfa52('0x27')](_0x5b9eef[_0xfa52('0x26')],'.wav49')){_0x5b9eef['value']=_0x5b9eef[_0xfa52('0x26')][_0xfa52('0x28')](_0xfa52('0x29'),_0xfa52('0x2a'));}if(recordings[_0x5b9eef[_0xfa52('0x13')]]){var _0x2b86f6=_['find'](recordings[_0x5b9eef[_0xfa52('0x13')]][_0xfa52('0x2b')],{'value':_0x5b9eef[_0xfa52('0x26')]});if(_[_0xfa52('0x1f')](_0x2b86f6)){recordings[_0x5b9eef[_0xfa52('0x13')]][_0xfa52('0x2b')]['push']({'value':_0x5b9eef[_0xfa52('0x26')]});}}}}catch(_0x5a2b95){utils[_0xfa52('0x19')](util[_0xfa52('0x15')](_0xfa52('0x24'),_0x5b9eef[_0xfa52('0x5')]),_0x5a2b95);}};exports['hangup']=function(_0x1fcd9e){try{if(!_[_0xfa52('0x1f')](recordings[_0x1fcd9e['uniqueid']])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')]('[%s][recordings][hangup]',_0x1fcd9e[_0xfa52('0x5')]),_0x1fcd9e);utils[_0xfa52('0x14')](util['format'](_0xfa52('0x2c'),_0x1fcd9e[_0xfa52('0x5')],_0x1fcd9e[_0xfa52('0x2d')],_0x1fcd9e['calleridname'],_0x1fcd9e[_0xfa52('0x2e')]));recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x2d')]=_0x1fcd9e[_0xfa52('0x2d')];recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x2f')]=_0x1fcd9e['calleridname'];recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x30')]=_0x1fcd9e[_0xfa52('0x30')];recordings[_0x1fcd9e[_0xfa52('0x5')]]['connectedlinename']=_0x1fcd9e['connectedlinename'];if(recordings[_0x1fcd9e[_0xfa52('0x5')]]['type']==_0xfa52('0x31')&&recordings[_0x1fcd9e['uniqueid']][_0xfa52('0x8')]){recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x30')]=recordings[_0x1fcd9e[_0xfa52('0x5')]][_0xfa52('0x8')];recordings[_0x1fcd9e[_0xfa52('0x5')]]['connectedlinename']='';}recordings[_0x1fcd9e['uniqueid']][_0xfa52('0x2b')][_0xfa52('0x32')](function(_0x2fa6eb){var _0x3b9e31=_[_0xfa52('0x33')](recordings[_0x1fcd9e[_0xfa52('0x5')]]);_0x3b9e31[_0xfa52('0x26')]=_0x2fa6eb['value'];writeDB(_0x3b9e31);});delete recordings[_0x1fcd9e[_0xfa52('0x5')]];}}catch(_0x394e29){utils[_0xfa52('0x19')](util[_0xfa52('0x15')]('[%s][recordings][hangup]',_0x1fcd9e[_0xfa52('0x5')]),_0x394e29);}};exports[_0xfa52('0x34')]=function(_0x16973a){try{if(!_['isNil'](recordings[_0x16973a[_0xfa52('0x5')]])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x35'),_0x16973a[_0xfa52('0x5')]),_0x16973a);utils[_0xfa52('0x14')](util[_0xfa52('0x15')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x16973a[_0xfa52('0x5')],_0x16973a[_0xfa52('0x36')],_0x16973a['appdata']));if(_0x16973a[_0xfa52('0x36')][_0xfa52('0x37')]()==_0xfa52('0x38')&&_[_0xfa52('0x39')](_0x16973a[_0xfa52('0x3a')][_0xfa52('0x37')](),_0xfa52('0x3b'))){var _0x267d1b=_0x16973a[_0xfa52('0x3a')]['split']('=');var _0x1ef383=_0x267d1b[0x0][_0xfa52('0x3c')](_0x267d1b[0x0]['lastIndexOf']('(')+0x1,_0x267d1b[0x0][_0xfa52('0x3d')](')'));var _0x50f6e=_0x267d1b[0x1];recordings[_0x16973a[_0xfa52('0x5')]][_0x1ef383]=_0x50f6e;}}}catch(_0x438093){utils['error'](util[_0xfa52('0x15')](_0xfa52('0x35'),_0x16973a[_0xfa52('0x5')]),_0x438093);}};exports[_0xfa52('0x3e')]=function(_0x59a2ab){try{if(!_[_0xfa52('0x1f')](recordings[_0x59a2ab[_0xfa52('0x5')]])){utils[_0xfa52('0x11')](util[_0xfa52('0x15')](_0xfa52('0x3f'),_0x59a2ab['uniqueid']),_0x59a2ab);utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x40'),_0x59a2ab[_0xfa52('0x5')],_0x59a2ab['queue']));recordings[_0x59a2ab[_0xfa52('0x5')]][_0xfa52('0x41')]=_0x59a2ab[_0xfa52('0x41')];}}catch(_0x2ea8d5){utils['error'](util['format'](_0xfa52('0x3f'),_0x59a2ab['uniqueid']),_0x2ea8d5);}};exports['blindtransfer']=function(_0x257aef){try{utils[_0xfa52('0x11')](util[_0xfa52('0x15')]('[%s][recordings][blindtransfer]',_0x257aef[_0xfa52('0x5')]),_0x257aef);utils[_0xfa52('0x14')](util[_0xfa52('0x15')](_0xfa52('0x42'),_0x257aef['uniqueid'],_0x257aef[_0xfa52('0x43')],_0x257aef[_0xfa52('0x44')],_0x257aef[_0xfa52('0x45')],_0x257aef['transfereecalleridname']));if(recordings[_0x257aef[_0xfa52('0x46')]]&&transfers[_0xfa52('0x6')][_0x257aef[_0xfa52('0x46')]]){transfers[_0xfa52('0x6')][_0x257aef[_0xfa52('0x46')]][_0xfa52('0x47')]=!![];}}catch(_0x5054a6){utils[_0xfa52('0x19')](util[_0xfa52('0x15')]('[%s][recordings][blindtransfer]',_0x257aef[_0xfa52('0x5')]),_0x5054a6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c555575..db8538a 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 _0x9c15=['origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x4c59fe,_0x28b083){var _0x1a90f5=function(_0x13bc31){while(--_0x13bc31){_0x4c59fe['push'](_0x4c59fe['shift']());}};_0x1a90f5(++_0x28b083);}(_0x9c15,0xb4));var _0x59c1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9c15[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x59c1('0x0'));var utils=require(_0x59c1('0x1'));function writeDB(_0x11c7b6){utils[_0x59c1('0x2')](util[_0x59c1('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x11c7b6[_0x59c1('0x4')]==='attended'?_0x11c7b6[_0x59c1('0x5')]:_0x11c7b6[_0x59c1('0x6')],_0x11c7b6[_0x59c1('0x4')]));utils[_0x59c1('0x7')](_0x59c1('0x8'),_0x11c7b6);}exports[_0x59c1('0x9')]={};exports[_0x59c1('0xa')]=function(_0x71c430){try{utils[_0x59c1('0xb')](util[_0x59c1('0x3')](_0x59c1('0xc'),_0x71c430['uniqueid']),_0x71c430);utils[_0x59c1('0x2')](util[_0x59c1('0x3')](_0x59c1('0xd'),_0x71c430[_0x59c1('0x6')],_0x71c430['transferercalleridnum'],_0x71c430[_0x59c1('0xe')],_0x71c430['transfereecalleridnum'],_0x71c430[_0x59c1('0xf')]));_0x71c430[_0x59c1('0x4')]='blind';exports[_0x59c1('0x9')][_0x71c430[_0x59c1('0x10')]]=_0x71c430;writeDB(_0x71c430);}catch(_0x1f90f8){utils[_0x59c1('0x11')](util[_0x59c1('0x3')]('[%s][transfers][blindtransfer]',_0x71c430[_0x59c1('0x6')]),_0x1f90f8);}};exports['attendedtransfer']=function(_0x2d4e71){try{utils[_0x59c1('0xb')](util[_0x59c1('0x3')]('[%s][transfers][attendedtransfer]',_0x2d4e71[_0x59c1('0x5')]),_0x2d4e71);utils[_0x59c1('0x2')](util[_0x59c1('0x3')](_0x59c1('0x12'),_0x2d4e71[_0x59c1('0x5')],_0x2d4e71['origtransferercalleridnum'],_0x2d4e71['origtransferercalleridname'],_0x2d4e71['transfertargetcalleridnum'],_0x2d4e71[_0x59c1('0x13')]));_0x2d4e71=_[_0x59c1('0x14')](_0x2d4e71,{'transfererchannel':_0x2d4e71['origtransfererchannel'],'transferercalleridnum':_0x2d4e71[_0x59c1('0x15')],'transferercalleridname':_0x2d4e71[_0x59c1('0x16')],'transfererconnectedlinenum':_0x2d4e71[_0x59c1('0x17')],'transfererconnectedlinename':_0x2d4e71[_0x59c1('0x18')],'transfereraccountcode':_0x2d4e71[_0x59c1('0x19')],'transferercontext':_0x2d4e71['secondtransferercontext'],'transfererexten':_0x2d4e71[_0x59c1('0x1a')],'transfererlinkedid':_0x2d4e71[_0x59c1('0x1b')],'context':_0x2d4e71[_0x59c1('0x1c')],'extension':_0x2d4e71[_0x59c1('0x1d')],'type':_0x59c1('0x1e')});if(_[_0x59c1('0x1f')](_0x2d4e71['transfereechannel'])){_0x2d4e71=_[_0x59c1('0x14')](_0x2d4e71,{'transfereechannel':_0x2d4e71[_0x59c1('0x20')],'transfereecalleridnum':_0x2d4e71[_0x59c1('0x21')],'transfereecalleridname':_0x2d4e71[_0x59c1('0x13')],'transfereeconnectedlinenum':_0x2d4e71[_0x59c1('0x22')],'transfereeconnectedlinename':_0x2d4e71[_0x59c1('0x23')],'transfereeaccountcode':_0x2d4e71[_0x59c1('0x24')],'transfereecontext':_0x2d4e71[_0x59c1('0x25')],'transfereeexten':_0x2d4e71[_0x59c1('0x26')],'transfereelinkedid':_0x2d4e71[_0x59c1('0x27')]});}writeDB(_0x2d4e71);}catch(_0x1d3bae){utils[_0x59c1('0x11')](util['format'](_0x59c1('0x28'),_0x2d4e71[_0x59c1('0x5')]),_0x1d3bae);}}; \ No newline at end of file +var _0x3d99=['origtransferercontext','origtransfererexten','transfereechannel','assign','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x57b4f2,_0x582a17){var _0x421370=function(_0x4c7c7c){while(--_0x4c7c7c){_0x57b4f2['push'](_0x57b4f2['shift']());}};_0x421370(++_0x582a17);}(_0x3d99,0x7f));var _0x93d9=function(_0xb69275,_0x59541e){_0xb69275=_0xb69275-0x0;var _0x310754=_0x3d99[_0xb69275];return _0x310754;};'use strict';var _=require(_0x93d9('0x0'));var util=require(_0x93d9('0x1'));var utils=require(_0x93d9('0x2'));function writeDB(_0x2723f0){utils[_0x93d9('0x3')](util[_0x93d9('0x4')](_0x93d9('0x5'),_0x2723f0['type']===_0x93d9('0x6')?_0x2723f0[_0x93d9('0x7')]:_0x2723f0[_0x93d9('0x8')],_0x2723f0[_0x93d9('0x9')]));utils[_0x93d9('0xa')](_0x93d9('0xb'),_0x2723f0);}exports['blinds']={};exports['blindtransfer']=function(_0x53e939){try{utils['debug'](util[_0x93d9('0x4')]('[%s][transfers][blindtransfer]',_0x53e939[_0x93d9('0x8')]),_0x53e939);utils['info'](util[_0x93d9('0x4')](_0x93d9('0xc'),_0x53e939['uniqueid'],_0x53e939['transferercalleridnum'],_0x53e939[_0x93d9('0xd')],_0x53e939[_0x93d9('0xe')],_0x53e939['transfereecalleridname']));_0x53e939[_0x93d9('0x9')]=_0x93d9('0xf');exports['blinds'][_0x53e939['transfereruniqueid']]=_0x53e939;writeDB(_0x53e939);}catch(_0x4e7481){utils['error'](util[_0x93d9('0x4')]('[%s][transfers][blindtransfer]',_0x53e939[_0x93d9('0x8')]),_0x4e7481);}};exports[_0x93d9('0x10')]=function(_0xfd727f){try{utils[_0x93d9('0x11')](util[_0x93d9('0x4')](_0x93d9('0x12'),_0xfd727f['origtransfereruniqueid']),_0xfd727f);utils['info'](util[_0x93d9('0x4')](_0x93d9('0x13'),_0xfd727f['origtransfereruniqueid'],_0xfd727f[_0x93d9('0x14')],_0xfd727f[_0x93d9('0x15')],_0xfd727f[_0x93d9('0x16')],_0xfd727f['transfertargetcalleridname']));_0xfd727f=_['assign'](_0xfd727f,{'transfererchannel':_0xfd727f[_0x93d9('0x17')],'transferercalleridnum':_0xfd727f[_0x93d9('0x14')],'transferercalleridname':_0xfd727f[_0x93d9('0x15')],'transfererconnectedlinenum':_0xfd727f[_0x93d9('0x18')],'transfererconnectedlinename':_0xfd727f[_0x93d9('0x19')],'transfereraccountcode':_0xfd727f['origtransfereraccountcode'],'transferercontext':_0xfd727f[_0x93d9('0x1a')],'transfererexten':_0xfd727f[_0x93d9('0x1b')],'transfererlinkedid':_0xfd727f[_0x93d9('0x1c')],'context':_0xfd727f[_0x93d9('0x1d')],'extension':_0xfd727f[_0x93d9('0x1e')],'type':_0x93d9('0x6')});if(_['isNil'](_0xfd727f[_0x93d9('0x1f')])){_0xfd727f=_[_0x93d9('0x20')](_0xfd727f,{'transfereechannel':_0xfd727f['transfertargetchannel'],'transfereecalleridnum':_0xfd727f[_0x93d9('0x16')],'transfereecalleridname':_0xfd727f[_0x93d9('0x21')],'transfereeconnectedlinenum':_0xfd727f[_0x93d9('0x22')],'transfereeconnectedlinename':_0xfd727f[_0x93d9('0x23')],'transfereeaccountcode':_0xfd727f['transfertargetaccountcode'],'transfereecontext':_0xfd727f[_0x93d9('0x24')],'transfereeexten':_0xfd727f[_0x93d9('0x25')],'transfereelinkedid':_0xfd727f[_0x93d9('0x26')]});}writeDB(_0xfd727f);}catch(_0x49f37f){utils['error'](util[_0x93d9('0x4')](_0x93d9('0x12'),_0xfd727f[_0x93d9('0x7')]),_0x49f37f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a64c4b7..2778578 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 _0x43a5=['add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','../../config/logger','info','inspect','debug','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','result','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','error','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','request','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime'];(function(_0x257599,_0x4b624c){var _0x41b318=function(_0x571729){while(--_0x571729){_0x257599['push'](_0x257599['shift']());}};_0x41b318(++_0x4b624c);}(_0x43a5,0x196));var _0x543a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43a5[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x543a('0x0'));var moment=require(_0x543a('0x1'));var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x543a('0x2'))('xdr');exports[_0x543a('0x3')]=function(_0x2b33ef,_0x405143){logger[_0x543a('0x3')](_0x2b33ef,_0x405143?util[_0x543a('0x4')](_0x405143,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x22b510,_0x3cdafb){logger[_0x543a('0x5')](_0x22b510,_0x3cdafb?util['inspect'](_0x3cdafb,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5ca969,_0x3f82c4){logger['error'](_0x5ca969,_0x3f82c4?util['inspect'](_0x3f82c4,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xada5c5,_0x310d1d){return client['request'](_0xada5c5,{'body':_0x310d1d})[_0x543a('0x6')](function(_0x1c7daa){logger[_0x543a('0x5')](_0x543a('0x7'),_0xada5c5,_0x1c7daa?util[_0x543a('0x4')](_0x1c7daa,{'showHidden':![],'depth':null}):'');})[_0x543a('0x8')](function(_0x3d60d7){logger['error'](_0x543a('0x7'),_0xada5c5,_0x3d60d7?util['inspect'](_0x3d60d7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x32f390){return client['request'](_0x543a('0x9'),{'options':{'raw':!![],'attributes':['id',_0x543a('0xa'),_0x543a('0xb'),_0x543a('0xc')],'where':_0x32f390,'limit':0x1}})[_0x543a('0x6')](function(_0x3d8fce){logger[_0x543a('0x5')]('[utils][getUser]\x20where:%s',JSON[_0x543a('0xd')](_0x32f390),_0x3d8fce?util[_0x543a('0x4')](_0x3d8fce,{'showHidden':![],'depth':null}):'');return _0x3d8fce[_0x543a('0xe')]['length']?_0x3d8fce[_0x543a('0xe')][0x0]:null;});}exports[_0x543a('0xf')]=function(_0x38f35d){return new BPromise(function(_0x564eed,_0x558690){if(_0x38f35d){return getUser({'internal':_0x38f35d})[_0x543a('0x6')](function(_0x52e914){logger[_0x543a('0x3')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x38f35d,_0x52e914?_0x543a('0x10'):_0x543a('0x11'));return _0x564eed(_0x52e914);})[_0x543a('0x8')](function(_0x3c50b7){logger['error'](_0x543a('0x12'),_0x3c50b7?util['inspect'](_0x3c50b7,{'showHidden':![],'depth':null}):'');return _0x564eed(null);});}return _0x564eed(null);});};exports[_0x543a('0x13')]=function(_0x52e38c){return new BPromise(function(_0x23f2dd,_0x39a4c4){if(_0x52e38c){return getUser({'interface':_0x52e38c})[_0x543a('0x6')](function(_0x550112){logger[_0x543a('0x3')](_0x543a('0x14'),_0x52e38c,_0x550112?'found':'notfound');return _0x23f2dd(_0x550112);})[_0x543a('0x8')](function(_0xaeb2ed){logger[_0x543a('0x15')](_0x543a('0x16'),_0xaeb2ed?util[_0x543a('0x4')](_0xaeb2ed,{'showHidden':![],'depth':null}):'');return _0x23f2dd(null);});}return _0x23f2dd(null);});};exports['getUserByName']=function(_0x44c651){return new BPromise(function(_0x8c2de,_0xe61429){if(_0x44c651){return getUser({'name':_0x44c651})['then'](function(_0xf1cc78){logger[_0x543a('0x3')](_0x543a('0x17'),_0x44c651,_0xf1cc78?_0x543a('0x10'):_0x543a('0x11'));return _0x8c2de(_0xf1cc78);})[_0x543a('0x8')](function(_0xef9bec){logger[_0x543a('0x15')](_0x543a('0x18'),_0xef9bec?util[_0x543a('0x4')](_0xef9bec,{'showHidden':![],'depth':null}):'');return _0x8c2de(null);});}return _0x8c2de(null);});};exports['getVoiceQueueByName']=function(_0x5cbc0e){return new BPromise(function(_0xbb6bab,_0x373985){if(_0x5cbc0e){return client[_0x543a('0x19')](_0x543a('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x543a('0xb'),_0x543a('0x1b'),_0x543a('0x1c'),_0x543a('0x1d')],'where':{'name':_0x5cbc0e},'limit':0x1}})['then'](function(_0x19ead5){logger['debug'](_0x543a('0x1e'),_0x5cbc0e,_0x19ead5?util[_0x543a('0x4')](_0x19ead5,{'showHidden':![],'depth':null}):'');logger[_0x543a('0x3')](_0x543a('0x1f'),_0x5cbc0e,_0x19ead5?_0x543a('0x10'):_0x543a('0x11'));return _0xbb6bab(_0x19ead5[_0x543a('0xe')][_0x543a('0x20')]?_0x19ead5[_0x543a('0xe')][0x0]:null);})[_0x543a('0x8')](function(_0x455678){logger[_0x543a('0x15')]('[utils][getVoiceQueueByName]',_0x455678?util[_0x543a('0x4')](_0x455678,{'showHidden':![],'depth':null}):'');return _0xbb6bab(null);});}return _0xbb6bab(null);});};exports[_0x543a('0x21')]=function(_0x9c8fdb,_0x36bee0){return moment(_0x9c8fdb)[_0x543a('0x22')](_0x36bee0,'seconds')[_0x543a('0x23')](_0x543a('0x24'));};exports[_0x543a('0x25')]=function(_0x3cce99,_0x573ab5){return moment(_0x3cce99)['subtract'](_0x573ab5,_0x543a('0x26'))[_0x543a('0x23')](_0x543a('0x24'));};exports[_0x543a('0x27')]=function(_0x5b26e4,_0x4de0f5){return moment(_0x5b26e4)[_0x543a('0x28')](moment(_0x4de0f5),_0x543a('0x26'));};exports['sumTime']=function(_0x108a86,_0x234851){return parseInt(_0x108a86,0xa)+parseInt(_0x234851,0xa);};exports[_0x543a('0x29')]=function(){return moment()[_0x543a('0x23')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x543a('0x2a')]=function(_0x4d235b,_0x5bf5b5){if(_0x5bf5b5){return moment(_0x4d235b)[_0x543a('0x2a')](_0x5bf5b5);}return!![];};exports[_0x543a('0x2b')]=function(_0x5acd72,_0x1aa8d9){if(_0x1aa8d9){return moment(_0x5acd72)[_0x543a('0x2b')](_0x1aa8d9);}else if(_0x5acd72){return!![];}return![];}; \ No newline at end of file +var _0x40bd=['internal','name','interface','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','seconds','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x40bd,0x1d2));var _0xd40b=function(_0x5af4f0,_0x163be2){_0x5af4f0=_0x5af4f0-0x0;var _0x4eefac=_0x40bd[_0x5af4f0];return _0x4eefac;};'use strict';var BPromise=require(_0xd40b('0x0'));var jayson=require(_0xd40b('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xd40b('0x2')][_0xd40b('0x3')]({'port':0x2329});var logger=require(_0xd40b('0x4'))(_0xd40b('0x5'));exports[_0xd40b('0x6')]=function(_0x386c53,_0x299d82){logger[_0xd40b('0x6')](_0x386c53,_0x299d82?util['inspect'](_0x299d82,{'showHidden':![],'depth':null}):'');};exports[_0xd40b('0x7')]=function(_0x118b34,_0x19c798){logger['debug'](_0x118b34,_0x19c798?util[_0xd40b('0x8')](_0x19c798,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x74d181,_0x5bcb1b){logger[_0xd40b('0x9')](_0x74d181,_0x5bcb1b?util['inspect'](_0x5bcb1b,{'showHidden':![],'depth':null}):'');};exports[_0xd40b('0xa')]=function(_0x10c84b,_0x2ea678){return client['request'](_0x10c84b,{'body':_0x2ea678})[_0xd40b('0xb')](function(_0x4ecc11){logger[_0xd40b('0x7')](_0xd40b('0xc'),_0x10c84b,_0x4ecc11?util[_0xd40b('0x8')](_0x4ecc11,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x37bf2e){logger[_0xd40b('0x9')](_0xd40b('0xc'),_0x10c84b,_0x37bf2e?util[_0xd40b('0x8')](_0x37bf2e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2bfa79){return client[_0xd40b('0xa')](_0xd40b('0xd'),{'options':{'raw':!![],'attributes':['id',_0xd40b('0xe'),_0xd40b('0xf'),_0xd40b('0x10')],'where':_0x2bfa79,'limit':0x1}})[_0xd40b('0xb')](function(_0x4b70bb){logger[_0xd40b('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xd40b('0x11')](_0x2bfa79),_0x4b70bb?util[_0xd40b('0x8')](_0x4b70bb,{'showHidden':![],'depth':null}):'');return _0x4b70bb[_0xd40b('0x12')]['length']?_0x4b70bb['result'][0x0]:null;});}exports[_0xd40b('0x13')]=function(_0x4e20e9){return new BPromise(function(_0x2d008d,_0x4c7689){if(_0x4e20e9){return getUser({'internal':_0x4e20e9})[_0xd40b('0xb')](function(_0x48c750){logger[_0xd40b('0x6')](_0xd40b('0x14'),_0x4e20e9,_0x48c750?'found':_0xd40b('0x15'));return _0x2d008d(_0x48c750);})[_0xd40b('0x16')](function(_0x26bab7){logger[_0xd40b('0x9')](_0xd40b('0x17'),_0x26bab7?util['inspect'](_0x26bab7,{'showHidden':![],'depth':null}):'');return _0x2d008d(null);});}return _0x2d008d(null);});};exports['getUserByInterface']=function(_0x346a90){return new BPromise(function(_0x20d9b5,_0x4f7dc8){if(_0x346a90){return getUser({'interface':_0x346a90})['then'](function(_0xa08de7){logger['info'](_0xd40b('0x18'),_0x346a90,_0xa08de7?_0xd40b('0x19'):'notfound');return _0x20d9b5(_0xa08de7);})[_0xd40b('0x16')](function(_0x1b02b7){logger[_0xd40b('0x9')]('[utils][getUserByInterface]',_0x1b02b7?util[_0xd40b('0x8')](_0x1b02b7,{'showHidden':![],'depth':null}):'');return _0x20d9b5(null);});}return _0x20d9b5(null);});};exports[_0xd40b('0x1a')]=function(_0x5cba5e){return new BPromise(function(_0x28e8fb,_0x217ee1){if(_0x5cba5e){return getUser({'name':_0x5cba5e})[_0xd40b('0xb')](function(_0x2980ac){logger[_0xd40b('0x6')](_0xd40b('0x1b'),_0x5cba5e,_0x2980ac?_0xd40b('0x19'):_0xd40b('0x15'));return _0x28e8fb(_0x2980ac);})[_0xd40b('0x16')](function(_0x3f2da6){logger['error'](_0xd40b('0x1c'),_0x3f2da6?util[_0xd40b('0x8')](_0x3f2da6,{'showHidden':![],'depth':null}):'');return _0x28e8fb(null);});}return _0x28e8fb(null);});};exports[_0xd40b('0x1d')]=function(_0x25f64b){return new BPromise(function(_0x1ca3f3,_0x3dc4e3){if(_0x25f64b){return client[_0xd40b('0xa')](_0xd40b('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xd40b('0xf'),_0xd40b('0x1f'),_0xd40b('0x20'),_0xd40b('0x21')],'where':{'name':_0x25f64b},'limit':0x1}})['then'](function(_0x2bbd1c){logger['debug'](_0xd40b('0x22'),_0x25f64b,_0x2bbd1c?util[_0xd40b('0x8')](_0x2bbd1c,{'showHidden':![],'depth':null}):'');logger[_0xd40b('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x25f64b,_0x2bbd1c?'found':_0xd40b('0x15'));return _0x1ca3f3(_0x2bbd1c[_0xd40b('0x12')][_0xd40b('0x23')]?_0x2bbd1c[_0xd40b('0x12')][0x0]:null);})[_0xd40b('0x16')](function(_0x13f738){logger[_0xd40b('0x9')](_0xd40b('0x24'),_0x13f738?util[_0xd40b('0x8')](_0x13f738,{'showHidden':![],'depth':null}):'');return _0x1ca3f3(null);});}return _0x1ca3f3(null);});};exports[_0xd40b('0x25')]=function(_0xf5f6a9,_0x3e3f76){return moment(_0xf5f6a9)['add'](_0x3e3f76,'seconds')[_0xd40b('0x26')](_0xd40b('0x27'));};exports[_0xd40b('0x28')]=function(_0x3b27a9,_0x4aa501){return moment(_0x3b27a9)[_0xd40b('0x29')](_0x4aa501,'seconds')[_0xd40b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xd40b('0x2a')]=function(_0x1c2b40,_0x67c2d3){return moment(_0x1c2b40)[_0xd40b('0x2b')](moment(_0x67c2d3),_0xd40b('0x2c'));};exports['sumTime']=function(_0x2cecdd,_0x34422e){return parseInt(_0x2cecdd,0xa)+parseInt(_0x34422e,0xa);};exports[_0xd40b('0x2d')]=function(){return moment()['format'](_0xd40b('0x27'));};exports['isAfter']=function(_0x74f4ba,_0x2ef4a7){if(_0x2ef4a7){return moment(_0x74f4ba)[_0xd40b('0x2e')](_0x2ef4a7);}return!![];};exports[_0xd40b('0x2f')]=function(_0x58dc51,_0x53e10b){if(_0x53e10b){return moment(_0x58dc51)['isBefore'](_0x53e10b);}else if(_0x58dc51){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 7ecc562..157f050 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 _0x1960=['test','setupLoggers','lodash','express-winston','fileLogger','./safe-template','safeTemplate','/var','log','xcally','join','name','ensureDir','client','then','user','data','timestamp','catch','error','api','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','url','statusCode','responseTime','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','other','agent_name'];(function(_0x2096c5,_0x192abb){var _0xf5a852=function(_0x29fdca){while(--_0x29fdca){_0x2096c5['push'](_0x2096c5['shift']());}};_0xf5a852(++_0x192abb);}(_0x1960,0x1ba));var _0x0196=function(_0x16029e,_0x4c66f3){_0x16029e=_0x16029e-0x0;var _0x302b40=_0x1960[_0x16029e];return _0x302b40;};var fs=require('fs-extra');var _=require(_0x0196('0x0'));var ewinston=require(_0x0196('0x1'));var path=require('path');var util=require('util');var fileLogger=require('./loggers')[_0x0196('0x2')];var safeTemplate=require(_0x0196('0x3'))[_0x0196('0x4')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x2cfb41(_0x2a7aaf){var _0x29bac5=path['join'](_0x0196('0x5'),_0x0196('0x6'),_0x0196('0x7'));var _0x3f5939=path[_0x0196('0x8')]('client',_0x2a7aaf['role']+'-'+_0x2a7aaf[_0x0196('0x9')]);return fs[_0x0196('0xa')](path['join'](_0x29bac5,_0x3f5939))['then'](function(){var _0x1bc77e=fileLogger(_0x0196('0xb'),path[_0x0196('0x8')](_0x29bac5,_0x3f5939));return _0x1bc77e;})['catch'](function(_0x4d1ef4){throw _0x4d1ef4;});}this['log']=function(_0x26d4ae,_0x22cd95,_0x297155,_0x528ec4){return _0x2cfb41(_0x26d4ae['user'])['then'](function(_0x3e363f){var _0x19de44=_0x3e363f[_0x22cd95];return _0x19de44;})[_0x0196('0xc')](function(_0x42e66e){var _0x24ab8f=_0x26d4ae[_0x0196('0xd')]?_0x26d4ae[_0x0196('0xd')]['id']:'no-user';var _0x3b4502=_0x528ec4[_0x0196('0xe')];var _0x4d1dfd=_0x528ec4[_0x0196('0xf')];var _0x41ae2f=new Date(Number(_0x4d1dfd));return _0x42e66e(_0x24ab8f,_0x41ae2f,_0x297155,_0x3b4502);})[_0x0196('0x10')](function(_0x2813fe){fileLogger(_0x0196('0xb'))[_0x0196('0x11')](_0x2813fe);});};}function setupLoggers(_0x2691aa){return new Promise(function(_0xb374d4){var _0x201e04=new ClientSideLogger();var _0x1bfbaa=fileLogger(_0x0196('0x12'));var _0x478025=fileLogger(_0x0196('0x13'));_0x2691aa['set']('client-side-logger',_0x201e04);_0x2691aa['use'](ewinston[_0x0196('0x14')]({'winstonInstance':_0x1bfbaa,'meta':![],'statusLevels':!![],'msg':function(_0x16f5cd,_0x2d26df){var _0x51642a=_0x0196('0x15');if(!_[_0x0196('0x16')](_0x16f5cd[_0x0196('0x17')])){_0x51642a+=_0x0196('0x18');var _0x3b919e=_0x16f5cd[_0x0196('0x17')];maskSensitiveData(_0x3b919e);}return safeTemplate(util[_0x0196('0x19')](_0x51642a,_0x16f5cd[_0x0196('0x1a')],_0x16f5cd['headers'][_0x0196('0x1b')]?_0x16f5cd[_0x0196('0x1c')]['x-forwarded-for']:_0x16f5cd[_0x0196('0x1d')]['remoteAddress']||_0x16f5cd['ip'],_0x16f5cd[_0x0196('0x1e')],_0x2d26df[_0x0196('0x1f')],_0x2d26df[_0x0196('0x20')],_0x16f5cd['user']?_0x16f5cd[_0x0196('0xd')]['id']:null,_0x16f5cd[_0x0196('0xd')]?_0x16f5cd['user']['name']:null,_0x16f5cd[_0x0196('0xd')]?_0x16f5cd['user'][_0x0196('0x21')]:null,_0x3b919e?util[_0x0196('0x22')](_0x3b919e,![],null):''));}}));_0x2691aa[_0x0196('0x23')](ewinston[_0x0196('0x14')]({'winstonInstance':_0x478025,'meta':![],'statusLevels':!![],'msg':function(_0xe7528,_0x311466){var _0x517d28=_0x0196('0x24');if(_0xe7528[_0x0196('0x17')]&&_0xe7528[_0x0196('0x17')][_0x0196('0x25')]&&_0xe7528['body'][_0x0196('0x26')]){_0x517d28='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x0196('0x19')](_0x517d28,_0xe7528[_0x0196('0x1a')],_0xe7528[_0x0196('0x1c')][_0x0196('0x1b')]?_0xe7528[_0x0196('0x1c')][_0x0196('0x1b')]:_0xe7528[_0x0196('0x1d')][_0x0196('0x27')]||_0xe7528['ip'],_0xe7528[_0x0196('0x1e')],_0x311466[_0x0196('0x1f')],_0x311466['responseTime'],_0xe7528[_0x0196('0xd')]?_0xe7528[_0x0196('0xd')]['id']:null,_0xe7528[_0x0196('0xd')]?_0xe7528['user'][_0x0196('0x9')]:null,_0xe7528['user']?_0xe7528[_0x0196('0xd')][_0x0196('0x21')]:null,_0xe7528[_0x0196('0x17')]&&_0xe7528[_0x0196('0x17')][_0x0196('0x25')]?_0xe7528[_0x0196('0x17')][_0x0196('0x25')]:_0x0196('0x28'),_0xe7528[_0x0196('0x17')]&&_0xe7528[_0x0196('0x17')][_0x0196('0x26')]?_0xe7528[_0x0196('0x17')][_0x0196('0x26')]:'',_0xe7528[_0x0196('0x17')]&&_0xe7528[_0x0196('0x17')][_0x0196('0x29')]?_0xe7528['body'][_0x0196('0x29')]:'');},'ignoreRoute':function(_0x58fac4){var _0xf66ecc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xf66ecc[_0x0196('0x2a')](_0x58fac4[_0x0196('0x1e')]);}}));return _0xb374d4();});}exports[_0x0196('0x2b')]=setupLoggers; \ No newline at end of file +var _0x8521=['express-winston','path','./loggers','fileLogger','./safe-template','maskSensitiveData','join','/var','log','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','connection','device','agent_name','test','setupLoggers','fs-extra','lodash'];(function(_0x2f54ed,_0x372e19){var _0x1daa43=function(_0x37fa26){while(--_0x37fa26){_0x2f54ed['push'](_0x2f54ed['shift']());}};_0x1daa43(++_0x372e19);}(_0x8521,0x19c));var _0x1852=function(_0x15a40b,_0x491b44){_0x15a40b=_0x15a40b-0x0;var _0x238ff3=_0x8521[_0x15a40b];return _0x238ff3;};var fs=require(_0x1852('0x0'));var _=require(_0x1852('0x1'));var ewinston=require(_0x1852('0x2'));var path=require(_0x1852('0x3'));var util=require('util');var fileLogger=require(_0x1852('0x4'))[_0x1852('0x5')];var safeTemplate=require(_0x1852('0x6'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x1852('0x7')];function ClientSideLogger(){function _0x5f4a9e(_0x4d535b){var _0x34ffa7=path[_0x1852('0x8')](_0x1852('0x9'),_0x1852('0xa'),'xcally');var _0x37cd59=path[_0x1852('0x8')](_0x1852('0xb'),_0x4d535b[_0x1852('0xc')]+'-'+_0x4d535b[_0x1852('0xd')]);return fs[_0x1852('0xe')](path[_0x1852('0x8')](_0x34ffa7,_0x37cd59))[_0x1852('0xf')](function(){var _0x133ffe=fileLogger(_0x1852('0xb'),path['join'](_0x34ffa7,_0x37cd59));return _0x133ffe;})[_0x1852('0x10')](function(_0x404653){throw _0x404653;});}this[_0x1852('0xa')]=function(_0x2dadb0,_0x4a8ce4,_0x28d1cf,_0x58b55f){return _0x5f4a9e(_0x2dadb0['user'])[_0x1852('0xf')](function(_0xa9b016){var _0x2c9617=_0xa9b016[_0x4a8ce4];return _0x2c9617;})[_0x1852('0xf')](function(_0x1c559f){var _0x389a1d=_0x2dadb0[_0x1852('0x11')]?_0x2dadb0[_0x1852('0x11')]['id']:_0x1852('0x12');var _0x5e9524=_0x58b55f[_0x1852('0x13')];var _0x53788b=_0x58b55f[_0x1852('0x14')];var _0x56fc53=new Date(Number(_0x53788b));return _0x1c559f(_0x389a1d,_0x56fc53,_0x28d1cf,_0x5e9524);})['catch'](function(_0x4deb11){fileLogger(_0x1852('0xb'))['error'](_0x4deb11);});};}function setupLoggers(_0x26e56b){return new Promise(function(_0x1e63d3){var _0x5cad53=new ClientSideLogger();var _0x3f25fa=fileLogger('api');var _0x3b7b6e=fileLogger(_0x1852('0x15'));_0x26e56b[_0x1852('0x16')](_0x1852('0x17'),_0x5cad53);_0x26e56b[_0x1852('0x18')](ewinston[_0x1852('0x19')]({'winstonInstance':_0x3f25fa,'meta':![],'statusLevels':!![],'msg':function(_0xc59433,_0x1e7a30){var _0x5e3f8a=_0x1852('0x1a');if(!_[_0x1852('0x1b')](_0xc59433[_0x1852('0x1c')])){_0x5e3f8a+=_0x1852('0x1d');var _0x42bd60=_0xc59433[_0x1852('0x1c')];maskSensitiveData(_0x42bd60);}return safeTemplate(util['format'](_0x5e3f8a,_0xc59433['method'],_0xc59433[_0x1852('0x1e')]['x-forwarded-for']?_0xc59433['headers'][_0x1852('0x1f')]:_0xc59433['connection'][_0x1852('0x20')]||_0xc59433['ip'],_0xc59433[_0x1852('0x21')],_0x1e7a30[_0x1852('0x22')],_0x1e7a30[_0x1852('0x23')],_0xc59433[_0x1852('0x11')]?_0xc59433['user']['id']:null,_0xc59433[_0x1852('0x11')]?_0xc59433[_0x1852('0x11')][_0x1852('0xd')]:null,_0xc59433[_0x1852('0x11')]?_0xc59433[_0x1852('0x11')][_0x1852('0xc')]:null,_0x42bd60?util['inspect'](_0x42bd60,![],null):''));}}));_0x26e56b[_0x1852('0x18')](ewinston['logger']({'winstonInstance':_0x3b7b6e,'meta':![],'statusLevels':!![],'msg':function(_0x2a4502,_0x4a019a){var _0x3084e9=_0x1852('0x24');if(_0x2a4502[_0x1852('0x1c')]&&_0x2a4502[_0x1852('0x1c')]['device']&&_0x2a4502[_0x1852('0x1c')][_0x1852('0x25')]){_0x3084e9=_0x1852('0x26');}return util[_0x1852('0x27')](_0x3084e9,_0x2a4502[_0x1852('0x28')],_0x2a4502['headers'][_0x1852('0x1f')]?_0x2a4502[_0x1852('0x1e')]['x-forwarded-for']:_0x2a4502[_0x1852('0x29')][_0x1852('0x20')]||_0x2a4502['ip'],_0x2a4502[_0x1852('0x21')],_0x4a019a[_0x1852('0x22')],_0x4a019a[_0x1852('0x23')],_0x2a4502[_0x1852('0x11')]?_0x2a4502['user']['id']:null,_0x2a4502[_0x1852('0x11')]?_0x2a4502['user'][_0x1852('0xd')]:null,_0x2a4502['user']?_0x2a4502[_0x1852('0x11')][_0x1852('0xc')]:null,_0x2a4502['body']&&_0x2a4502[_0x1852('0x1c')]['device']?_0x2a4502[_0x1852('0x1c')][_0x1852('0x2a')]:'other',_0x2a4502['body']&&_0x2a4502['body'][_0x1852('0x25')]?_0x2a4502[_0x1852('0x1c')][_0x1852('0x25')]:'',_0x2a4502[_0x1852('0x1c')]&&_0x2a4502[_0x1852('0x1c')][_0x1852('0x2b')]?_0x2a4502[_0x1852('0x1c')][_0x1852('0x2b')]:'');},'ignoreRoute':function(_0x23d27f){var _0x152319=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x152319[_0x1852('0x2c')](_0x23d27f[_0x1852('0x21')]);}}));return _0x1e63d3();});}exports[_0x1852('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b914f8d..f7edfc6 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2433=['Logger','transports','%s-%s','error','warn','fileLogger','path','util','winston','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x2b1a65,_0x54be9a){var _0x2c1475=function(_0x57bc08){while(--_0x57bc08){_0x2b1a65['push'](_0x2b1a65['shift']());}};_0x2c1475(++_0x54be9a);}(_0x2433,0xde));var _0x3243=function(_0x576a47,_0x421ea6){_0x576a47=_0x576a47-0x0;var _0x24a79e=_0x2433[_0x576a47];return _0x24a79e;};'use strict';var path=require(_0x3243('0x0'));var util=require(_0x3243('0x1'));var moment=require('moment');var winston=require(_0x3243('0x2'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x3243('0x3')][_0x3243('0x4')]():_0x3243('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':_0x3243('0x6'),'error':'red','warn':_0x3243('0x7'),'info':'white','print':_0x3243('0x8'),'success':_0x3243('0x9'),'http':_0x3243('0xa'),'verbose':_0x3243('0xb'),'debug':'bold\x20blue','silly':_0x3243('0xc')};winston[_0x3243('0xd')](XC_LOG_COLORS);function getLogFileName(_0x550464,_0x40de66,_0x4927a6){var _0x2c0e41=_0x550464||'/var/log/xcally';return path[_0x3243('0xe')](_0x2c0e41,util[_0x3243('0xf')](_0x3243('0x10'),_0x40de66,_0x4927a6));}function formatter(_0x179c37,_0x4a3e14){_0x4a3e14[_0x3243('0x11')]=_0x4a3e14[_0x3243('0x11')][_0x3243('0x12')](/@@{/g,_0x3243('0x13'))['replace'](/}@@/g,_0x3243('0x14'))['replace'](/@{/g,'{{')[_0x3243('0x12')](/}@/g,'}}');return util['format'](_0x3243('0x15'),moment()[_0x3243('0xf')](_0x3243('0x16')),_0x4a3e14[_0x3243('0x17')][_0x3243('0x18')](),_0x179c37,_0x4a3e14[_0x3243('0x11')]);}function fileFormat(_0x1815e5,_0x22d1c3){_0x22d1c3[_0x3243('0x11')]=_0x22d1c3[_0x3243('0x11')][_0x3243('0x12')](/@@{/g,_0x3243('0x13'))[_0x3243('0x12')](/}@@/g,_0x3243('0x14'))['replace'](/@{/g,'{{')[_0x3243('0x12')](/}@/g,'}}');var _0x3b9a66=_0x22d1c3[_0x3243('0x19')]&&Object[_0x3243('0x1a')](_0x22d1c3[_0x3243('0x19')])[_0x3243('0x1b')]?'\x0a\x09'+JSON[_0x3243('0x1c')](_0x22d1c3[_0x3243('0x19')]):'';return util[_0x3243('0xf')](_0x3243('0x1d'),moment()[_0x3243('0xf')](_0x3243('0x16')),_0x22d1c3['level'][_0x3243('0x18')](),_0x1815e5,_0x22d1c3['message'],_0x3b9a66);}function consoleLogger(){var _0x541953=new winston[(_0x3243('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3243('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x3aff3c){return formatter('',_0x3aff3c);}})]});return _0x541953;}function fileLogger(_0x28f917,_0x1bdaa2){var _0x364cd7=new winston[(_0x3243('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0x3243('0xf')](_0x3243('0x20'),_0x28f917,_0x3243('0x21')),'filename':getLogFileName(_0x1bdaa2,_0x28f917,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d8b19){return fileFormat(_0x28f917,_0x3d8b19);}}),new winston[(_0x3243('0x1f'))]['File']({'name':util[_0x3243('0xf')](_0x3243('0x20'),_0x28f917,debugLevel),'filename':getLogFileName(_0x1bdaa2,_0x28f917,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fc21b){return fileFormat(_0x28f917,_0x4fc21b);}}),new winston[(_0x3243('0x1f'))]['Console']({'level':_0x3243('0x22'),'json':![],'formatter':function(_0x53fb18){return fileFormat(_0x28f917,_0x53fb18);}})]});return _0x364cd7;}exports['consoleLogger']=consoleLogger;exports[_0x3243('0x23')]=fileLogger; \ No newline at end of file +var _0x1c96=['info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','{{{','meta','keys','length','stringify','level','Logger','transports','Console','warn','File','%s-%s','error','path','util','moment','winston','../config/environment','debugLevel','toLowerCase'];(function(_0x4528cf,_0x3b1892){var _0x4bca53=function(_0x47d77b){while(--_0x47d77b){_0x4528cf['push'](_0x4528cf['shift']());}};_0x4bca53(++_0x3b1892);}(_0x1c96,0x16b));var _0x61c9=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x1c96[_0xdd2bfa];return _0x55397e;};'use strict';var path=require(_0x61c9('0x0'));var util=require(_0x61c9('0x1'));var moment=require(_0x61c9('0x2'));var winston=require(_0x61c9('0x3'));var config=require(_0x61c9('0x4'));var debugLevel=config[_0x61c9('0x5')]?config[_0x61c9('0x5')][_0x61c9('0x6')]():_0x61c9('0x7');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':_0x61c9('0x8'),'error':_0x61c9('0x9'),'warn':'bold\x20yellow','info':_0x61c9('0xa'),'print':_0x61c9('0xb'),'success':'bold\x20green','http':_0x61c9('0xc'),'verbose':_0x61c9('0xd'),'debug':_0x61c9('0xe'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x557610,_0x457474,_0x4cd275){var _0x35c67b=_0x557610||_0x61c9('0xf');return path[_0x61c9('0x10')](_0x35c67b,util[_0x61c9('0x11')]('%s-%s.log',_0x457474,_0x4cd275));}function formatter(_0x293d04,_0x515cad){_0x515cad['message']=_0x515cad[_0x61c9('0x12')][_0x61c9('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x61c9('0x14'))[_0x61c9('0x13')](/@{/g,'{{')[_0x61c9('0x13')](/}@/g,'}}');return util[_0x61c9('0x11')](_0x61c9('0x15'),moment()['format'](_0x61c9('0x16')),_0x515cad['level'][_0x61c9('0x17')](),_0x293d04,_0x515cad[_0x61c9('0x12')]);}function fileFormat(_0x44ac1d,_0x19adfc){_0x19adfc['message']=_0x19adfc['message'][_0x61c9('0x13')](/@@{/g,_0x61c9('0x18'))[_0x61c9('0x13')](/}@@/g,_0x61c9('0x14'))[_0x61c9('0x13')](/@{/g,'{{')[_0x61c9('0x13')](/}@/g,'}}');var _0x32b011=_0x19adfc[_0x61c9('0x19')]&&Object[_0x61c9('0x1a')](_0x19adfc['meta'])[_0x61c9('0x1b')]?'\x0a\x09'+JSON[_0x61c9('0x1c')](_0x19adfc[_0x61c9('0x19')]):'';return util[_0x61c9('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x61c9('0x11')](_0x61c9('0x16')),_0x19adfc[_0x61c9('0x1d')]['toUpperCase'](),_0x44ac1d,_0x19adfc[_0x61c9('0x12')],_0x32b011);}function consoleLogger(){var _0x3a38ad=new winston[(_0x61c9('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x61c9('0x1f'))][(_0x61c9('0x20'))]({'level':_0x61c9('0x21'),'json':![],'formatter':function(_0x3afeeb){return formatter('',_0x3afeeb);}})]});return _0x3a38ad;}function fileLogger(_0x5db441,_0x41e786){var _0x51a609=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x61c9('0x1f'))][(_0x61c9('0x22'))]({'name':util[_0x61c9('0x11')](_0x61c9('0x23'),_0x5db441,'error'),'filename':getLogFileName(_0x41e786,_0x5db441,_0x61c9('0x24')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53eabe){return fileFormat(_0x5db441,_0x53eabe);}}),new winston[(_0x61c9('0x1f'))][(_0x61c9('0x22'))]({'name':util[_0x61c9('0x11')](_0x61c9('0x23'),_0x5db441,debugLevel),'filename':getLogFileName(_0x41e786,_0x5db441,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d96d6){return fileFormat(_0x5db441,_0x4d96d6);}}),new winston[(_0x61c9('0x1f'))][(_0x61c9('0x20'))]({'level':_0x61c9('0x21'),'json':![],'formatter':function(_0x7378a6){return fileFormat(_0x5db441,_0x7378a6);}})]});return _0x51a609;}exports['consoleLogger']=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 82e5400..94a6119 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 _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x46b38d,_0x49cdf7){var _0x12a55f=function(_0x16f8a6){while(--_0x16f8a6){_0x46b38d['push'](_0x46b38d['shift']());}};_0x12a55f(++_0x49cdf7);}(_0x66fa,0x117));var _0xa66f=function(_0x23d377,_0x4122ad){_0x23d377=_0x23d377-0x0;var _0x27d089=_0x66fa[_0x23d377];return _0x27d089;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x1a85,0x178));var _0x51a8=function(_0x4f526c,_0x6c4dbe){_0x4f526c=_0x4f526c-0x0;var _0x38a51e=_0x1a85[_0x4f526c];return _0x38a51e;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index be290dc..4e2ef17 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['safeTemplate','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x19cf87,_0x14ab8e){var _0x3651fb=function(_0x326dfb){while(--_0x326dfb){_0x19cf87['push'](_0x19cf87['shift']());}};_0x3651fb(++_0x14ab8e);}(_0x0972,0x64));var _0x2097=function(_0x1a0d18,_0x1e9a9b){_0x1a0d18=_0x1a0d18-0x0;var _0x1bbc33=_0x0972[_0x1a0d18];return _0x1bbc33;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1591ae){return _0x1591ae==='{{'?'{\x20{\x20':_0x2097('0x0');}function safeTemplate(_0x4ec7aa){var _0x36912c=_0x4ec7aa;if(typeof _0x4ec7aa===_0x2097('0x1')){_0x36912c=_0x4ec7aa['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2097('0x2')](_0x4ec7aa)){_0x36912c=_0x4ec7aa[_0x2097('0x3')](function(_0xe6fbae){return safeTemplate(_0xe6fbae);});}else if(_[_0x2097('0x4')](_0x4ec7aa)){_0x36912c=Object[_0x2097('0x5')](_0x4ec7aa)[_0x2097('0x6')](function(_0x2b4f21,_0x59739f){_0x2b4f21[_0x59739f]=safeTemplate(_0x4ec7aa[_0x59739f]);return _0x2b4f21;},{});}return _0x36912c;}module[_0x2097('0x7')][_0x2097('0x8')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x8952,0x17e));var _0x2895=function(_0x2869fe,_0x5b6a7b){_0x2869fe=_0x2869fe-0x0;var _0x41a960=_0x8952[_0x2869fe];return _0x41a960;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file